@g1cloud/bpmn-modeler-next 5.0.0-alpha.27 → 5.0.0-alpha.28

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,14 +1,14 @@
1
- (function(Q,Ct){typeof exports=="object"&&typeof module<"u"?Ct(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],Ct):(Q=typeof globalThis<"u"?globalThis:Q||self,Ct(Q.BpmnModeler={},Q.Vue))})(this,(function(Q,Ct){"use strict";var ZD=Object.defineProperty;var QD=(Q,Ct,wi)=>Ct in Q?ZD(Q,Ct,{enumerable:!0,configurable:!0,writable:!0,value:wi}):Q[Ct]=wi;var Kr=(Q,Ct,wi)=>QD(Q,typeof Ct!="symbol"?Ct+"":Ct,wi);const wi=["startEvent","endEvent","userTask","serviceTask","task","sendTask","receiveTask","exclusiveGateway","parallelGateway"];function $f(e){return wi.includes(e)}const jf="http://g1project.net/spec/bpmn/bwl/1.0",bu="bwl",xu=["top-left","top","top-right","right","bottom-right","bottom","bottom-left","left"],Ff={name:"bwl-hints",uri:jf,prefix:bu,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"}]}]},wu="bwl.undoEpisode",Hf=new WeakSet;function Tx(e){Hf.has(e)||(e.register(wu,{preExecute(t){try{t.run()}catch(n){t.error=n}}}),Hf.add(e))}function zf(e,t){Tx(e);const n={run:t};if(e.execute(wu,n),n.error!==void 0)throw e.canUndo()&&e.undo(),n.error}const Vf=["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"],Mx={description:"생략 = 보존, null = 제거.",anyOf:[{type:"string"},{type:"null"}]},kx={type:"object",description:"레인. 배열 선언 순서 = 풀 내 상→하 순서.",properties:{id:{type:"string"},name:{type:"string"}},required:["id"],additionalProperties:!1},Dx={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},Ox={type:"object",description:"플로우 노드. 좌표는 지정하지 않는다 — 배치는 resolver 가 결정한다.",properties:{id:{type:"string"},type:{type:"string",enum:[...wi]},name:{type:"string"},participant:{type:"string",description:"소속 풀 id(협업 문서)."},lane:{type:"string",description:"소속 레인 id(풀 정의에 선언된 것)."}},required:["id","type"],additionalProperties:!1},Lx={type:"object",description:"분기 조건 — 게이트웨이가 아닌 플로우에 붙인다. MVP 는 label 만.",properties:{label:{type:"string"}},required:["label"],additionalProperties:!1},Ix={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},Nx={type:"object",description:"메시지 플로우(풀 경계를 넘는 연결 — 노드 또는 블랙박스 풀 자체가 끝점).",properties:{id:{type:"string"},source:{type:"string"},target:{type:"string"},name:{type:"string"}},required:["id","source","target"],additionalProperties:!1},Bx={type:"object",properties:{id:{type:"string"},name:{type:"string"}},required:["id"],additionalProperties:!1},$x={type:"object",description:"데이터 입출력 연관. 방향 = source→target(태스크→스토어 = 쓰기, 스토어→태스크 = 읽기).",properties:{id:{type:"string"},source:{type:"string"},target:{type:"string"}},required:["source","target"],additionalProperties:!1},jx={type:"object",properties:{id:{type:"string"},text:{type:"string"}},required:["id","text"],additionalProperties:!1},Fx={type:"object",description:"연관선(주석 ↔ 요소).",properties:{id:{type:"string"},source:{type:"string"},target:{type:"string"}},required:["source","target"],additionalProperties:!1},Hx={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},zx={type:"object",description:"주석 방위 힌트 — 앵커 요소 기준 상대 배치. 있으면 결정적 배치, 없으면 휴리스틱.",properties:{anchor:{type:"string",description:"기준 요소 id."},side:{type:"string",enum:[...xu]},offset:{type:"number",description:"앵커 가장자리 → 주석 가장자리 간격(px). 생략 시 50."}},required:["anchor","side"],additionalProperties:!1};function nn(e,t){return{type:"object",description:t.description,properties:{kind:{const:e},...t.properties},required:["kind",...t.required??[]],additionalProperties:!1}}const Vx={"participant.add":nn("participant.add",{description:"풀 추가. order = 풀 세로 순서 힌트 — **작을수록 위**(생략 시 op 순서가 곧 배치 순서). 값은 상대 순서만 쓰므로 1,2,3… 연속이든 10,20,30 간격이든 같다.",properties:{participant:{$ref:"#/$defs/irParticipant"},order:{type:"integer"}},required:["participant"]}),"participant.update":nn("participant.update",{description:"풀 이름/레인 갱신. lanes 는 전체 재선언(생략 = 보존) — 기존 레인을 유지하려면 함께 다시 나열한다.",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"},lanes:{type:"array",items:{$ref:"#/$defs/irLane"}}},required:["id"]}),"node.add":nn("node.add",{description:'플로우 노드 추가. band = 가로 밴드 순번 힌트(주 흐름 0, 갈래 1, 2…) — 위/아래가 아니라 "주 흐름에서 몇 번째 갈래"다. 행 배치(어느 갈래가 위/아래인지)는 호스트가 정한다(대칭·메시지 방향). 레인이 있으면 그 레인 안의 밴드다 — 한 레인 안에서 게이트웨이 출구를 갈라 놓을 때 쓴다. 컨테이너(풀·레인)는 밴드 수만큼 자란다.',properties:{node:{$ref:"#/$defs/irNode"},band:{type:"integer",description:"0 이상 정수(음수는 payload-invalid 로 거부)."}},required:["node"]}),"node.update":nn("node.update",{description:"노드 이름/레인/타입 갱신. lane = 레인 재배정(이동), type = 태스크·이벤트 타입 전환.",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"},lane:{type:"string"},type:{type:"string",enum:[...wi]}},required:["id"]}),"sequenceFlow.add":nn("sequenceFlow.add",{description:"시퀀스 플로우 추가. 분기 조건은 게이트웨이가 아닌 플로우의 condition 에 싣는다.",properties:{flow:{$ref:"#/$defs/irSequenceFlow"}},required:["flow"]}),"sequenceFlow.update":nn("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":nn("messageFlow.add",{description:"메시지 플로우 추가(풀 경계를 넘는 연결).",properties:{flow:{$ref:"#/$defs/irMessageFlow"}},required:["flow"]}),"messageFlow.update":nn("messageFlow.update",{description:"메시지 플로우 이름 갱신.",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"}},required:["id"]}),"dataStore.add":nn("dataStore.add",{description:"데이터 스토어 추가(+ 입출력 연관 동반 가능).",properties:{dataStore:{$ref:"#/$defs/irDataStore"},associations:{type:"array",items:{$ref:"#/$defs/irDataAssociation"}}},required:["dataStore"]}),"dataStore.update":nn("dataStore.update",{description:"데이터 스토어 이름 갱신.",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"}},required:["id"]}),"dataAssociation.add":nn("dataAssociation.add",{description:"기존 노드 ↔ 기존 데이터 스토어의 입출력 연관 추가.",properties:{association:{$ref:"#/$defs/irDataAssociation"}},required:["association"]}),"association.add":nn("association.add",{description:"주석 ↔ 요소 연관 추가(한쪽 끝은 주석). 주석 신설과 함께면 annotation.add 의 association 을 쓰고, 이 op 는 추가 연관(한 주석에 여러 연관)용.",properties:{association:{$ref:"#/$defs/irAssociation"}},required:["association"]}),"annotation.add":nn("annotation.add",{description:"텍스트 주석 추가. association 으로 대상 요소와 연결하고, placement 로 방위를 지정하면 결정적 배치된다.",properties:{annotation:{$ref:"#/$defs/irTextAnnotation"},association:{$ref:"#/$defs/irAssociation"},placement:{$ref:"#/$defs/bwlPlacement"}},required:["annotation"]}),"annotation.update":nn("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":nn("group.add",{description:"그룹 추가 — 바운즈는 members 의 bbox 로 산출되므로 좌표를 지정하지 않는다.",properties:{group:{$ref:"#/$defs/irGroup"}},required:["group"]}),"group.update":nn("group.update",{description:"그룹 이름/멤버 갱신. members 는 전체 재선언(생략 = 보존).",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"},members:{type:"array",items:{type:"string"}}},required:["id"]}),"element.remove":nn("element.remove",{description:"요소 제거(카테고리 무관). 부착된 연결선은 함께 제거된다.",properties:{id:{type:"string"}},required:["id"]})},Gf={anyOf:Vf.map(e=>Vx[e])},Gx={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:kx,irParticipant:Dx,irNode:Ox,irFlowCondition:Lx,irSequenceFlow:Ix,irMessageFlow:Nx,irDataStore:Bx,irDataAssociation:$x,irTextAnnotation:jx,irAssociation:Fx,irGroup:Hx,bwlPlacement:zx,nullableString:Mx,symbolicOp:Gf}};function Eu(e){return Array.prototype.concat.apply([],e)}const Ho=Object.prototype.toString,Wx=Object.prototype.hasOwnProperty;function Sr(e){return e===void 0}function $t(e){return e!==void 0}function Xr(e){return e==null}function _e(e){return Ho.call(e)==="[object Array]"}function Gt(e){return Ho.call(e)==="[object Object]"}function we(e){return Ho.call(e)==="[object Number]"}function Wt(e){const t=Ho.call(e);return t==="[object Function]"||t==="[object AsyncFunction]"||t==="[object GeneratorFunction]"||t==="[object AsyncGeneratorFunction]"||t==="[object Proxy]"}function wn(e){return Ho.call(e)==="[object String]"}function Ux(e){if(!_e(e))throw new Error("must supply array")}function En(e,t){return!Xr(e)&&Wx.call(e,t)}function st(e,t){const n=Za(t);let i;return M(e,function(r,o){if(n(r,o))return i=r,!1}),i}function Wf(e,t){const n=Za(t);let i=_e(e)?-1:void 0;return M(e,function(r,o){if(n(r,o))return i=o,!1}),i}function Oe(e,t){const n=Za(t);let i=[];return M(e,function(r,o){n(r,o)&&i.push(r)}),i}function M(e,t){let n,i;if(Sr(e))return;const r=_e(e)?Zx:Xx;for(let o in e)if(En(e,o)&&(n=e[o],i=t(n,r(o)),i===!1))return n}function Yx(e,t){if(Sr(e))return[];Ux(e);const n=Za(t);return e.filter(function(i,r){return!n(i,r)})}function Sn(e,t,n){return M(e,function(i,r){n=t(n,i,r)}),n}function Rr(e,t){return!!Sn(e,function(n,i,r){return n&&t(i,r)},!0)}function Vi(e,t){return!!st(e,t)}function rn(e,t){let n=[];return M(e,function(i,r){n.push(t(i,r))}),n}function Xa(e){return e&&Object.keys(e)||[]}function qx(e){return Xa(e).length}function Zr(e){return rn(e,t=>t)}function Qr(e,t,n={}){return t=Su(t),M(e,function(i){let r=t(i)||"_",o=n[r];o||(o=n[r]=[]),o.push(i)}),n}function Uf(e,...t){e=Su(e);let n={};return M(t,r=>Qr(r,e,n)),rn(n,function(r,o){return r[0]})}const Kx=Uf;function oi(e,t){t=Su(t);let n=[];return M(e,function(i,r){let o=t(i,r),a={d:o,v:i};for(var s=0;s<n.length;s++){let{d:c}=n[s];if(o<c){n.splice(s,0,a);return}}n.push(a)}),rn(n,i=>i.v)}function Jr(e){return function(t){return Rr(e,function(n,i){return t[i]===n})}}function Su(e){return Wt(e)?e:t=>t[e]}function Za(e){return Wt(e)?e:t=>t===e}function Xx(e){return e}function Zx(e){return Number(e)}function Ru(e,t){let n,i,r,o;function a(p){let f=Date.now(),d=p?0:o+t-f;if(d>0)return s(d);e.apply(r,i),c()}function s(p){n=setTimeout(a,p)}function c(){n&&clearTimeout(n),n=o=i=r=void 0}function u(){n&&a(!0),c()}function l(...p){o=Date.now(),i=p,r=this,n||s(t)}return l.flush=u,l.cancel=c,l}function vn(e,t){return e.bind(t)}function O(e,...t){return Object.assign(e,...t)}function Qx(e,t,n){let i=e;return M(t,function(r,o){if(typeof r!="number"&&typeof r!="string")throw new Error("illegal key type: "+typeof r+". Key should be of type number or string.");if(r==="constructor")throw new Error("illegal key: constructor");if(r==="__proto__")throw new Error("illegal key: __proto__");let a=t[o+1],s=i[r];$t(a)&&Xr(s)&&(s=i[r]=isNaN(+a)?{}:[]),Sr(a)?Sr(n)?delete i[r]:i[r]=n:i=s}),e}function ni(e,t){let n={},i=Object(e);return M(t,function(r){r in i&&(n[r]=e[r])}),n}function ai(e,t){let n={},i=Object(e);return M(i,function(r,o){t.indexOf(o)===-1&&(n[o]=r)}),n}function Cu(){}Cu.prototype.get=function(e){return this.$model.properties.get(this,e)},Cu.prototype.set=function(e,t){this.$model.properties.set(this,e,t)};function Yf(e,t){this.model=e,this.properties=t}Yf.prototype.createType=function(e){var t=this.model,n=this.properties,i=Object.create(Cu.prototype);M(e.properties,function(a){!a.isMany&&a.default!==void 0&&(i[a.name]=a.default)}),n.defineModel(i,t),n.defineDescriptor(i,e);var r=e.ns.name;function o(a){n.define(this,"$type",{value:r,enumerable:!0}),n.define(this,"$attrs",{value:{}}),n.define(this,"$parent",{writable:!0}),M(a,vn(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 Jx=O(Object.create(null),{String:!0,Boolean:!0,Integer:!0,Real:!0,Element:!0}),qf=O(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 Pu(e,t){var n=qf[e];return n?n(t):t}function Au(e){return!!Jx[e]}function Kf(e){return!!qf[e]}function on(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 Nn(e){this.ns=e,this.name=e.name,this.allTypes=[],this.allTypesByName=Object.create(null),this.properties=[],this.propertiesByName=Object.create(null)}Nn.prototype.build=function(){return ni(this,["ns","name","allTypes","allTypesByName","properties","propertiesByName","bodyProperty","idProperty"])},Nn.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)},Nn.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},Nn.prototype.redefineProperty=function(e,t,n){var i=e.ns.prefix,r=t.split("#"),o=on(r[0],i),a=on(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},Nn.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},Nn.prototype.removeNamedProperty=function(e){var t=e.ns,n=this.propertiesByName;delete n[t.name],delete n[t.localName]},Nn.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},Nn.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},Nn.prototype.assertNotTrait=function(e){if((e.extends||[]).length)throw new Error(`cannot create <${e.name}> extending <${e.extends}>`)},Nn.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")},Nn.prototype.hasProperty=function(e){return this.propertiesByName[e]},Nn.prototype.addTrait=function(e,t){t&&this.assertNotTrait(e);var n=this.allTypesByName,i=this.allTypes,r=e.name;r in n||(M(e.properties,vn(function(o){o=O({},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 Gi(e,t){this.packageMap=Object.create(null),this.typeMap=Object.create(null),this.packages=[],this.properties=t,M(e,vn(this.registerPackage,this))}Gi.prototype.getPackage=function(e){return this.packageMap[e]},Gi.prototype.getPackages=function(){return this.packages},Gi.prototype.registerPackage=function(e){e=O({},e);var t=this.packageMap;Xf(t,e,"prefix"),Xf(t,e,"uri"),M(e.types,vn(function(n){this.registerType(n,e)},this)),t[e.uri]=t[e.prefix]=e,this.packages.push(e)},Gi.prototype.registerType=function(e,t){e=O({},e,{superClass:(e.superClass||[]).slice(),extends:(e.extends||[]).slice(),properties:(e.properties||[]).slice(),meta:O({},e.meta||{})});var n=on(e.name,t.prefix),i=n.name,r=Object.create(null);M(e.properties,vn(function(o){var a=on(o.name,n.prefix),s=a.name;Au(o.type)||(o.type=on(o.type,a.prefix).name),O(o,{ns:a,name:s}),r[s]=o},this)),O(e,{ns:n,name:i,propertiesByName:r}),M(e.extends,vn(function(o){var a=on(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},Gi.prototype.mapTypes=function(e,t,n){var i=Au(e.name)?{name:e.name}:this.typeMap[e.name],r=this;function o(c,u){var l=on(c,Au(c)?"":e.prefix);r.mapTypes(l,t,u)}function a(c){return o(c,!0)}function s(c){return o(c,!1)}if(!i)throw new Error("unknown type <"+e.name+">");M(i.superClass,n?a:s),t(i,!n),M(i.traits,a)},Gi.prototype.getEffectiveDescriptor=function(e){var t=on(e),n=new Nn(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},Gi.prototype.definePackage=function(e,t){this.properties.define(e,"$pkg",{value:t})};function Xf(e,t,n){var i=t[n];if(i in e)throw new Error("package with "+n+" <"+i+"> already defined")}function Cr(e){this.model=e}Cr.prototype.set=function(e,t,n){if(!wn(t)||!t.length)throw new TypeError("property name must be a non-empty string");var i=this.getProperty(e,t),r=i&&i.name;e0(n)?i?delete e[r]:delete e.$attrs[Tu(t)]:i?r in e?e[r]=n:Zf(e,i,n):e.$attrs[Tu(t)]=n},Cr.prototype.get=function(e,t){var n=this.getProperty(e,t);if(!n)return e.$attrs[Tu(t)];var i=n.name;return!e[i]&&n.isMany&&Zf(e,n,[]),e[i]},Cr.prototype.define=function(e,t,n){if(!n.writable){var i=n.value;n=O({},n,{get:function(){return i}}),delete n.value}Object.defineProperty(e,t,n)},Cr.prototype.defineDescriptor=function(e,t){this.define(e,"$descriptor",{value:t})},Cr.prototype.defineModel=function(e,t){this.define(e,"$model",{value:t})},Cr.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 e0(e){return typeof e>"u"}function Zf(e,t,n){Object.defineProperty(e,t.name,{enumerable:!t.isReference,writable:!0,value:n,configurable:!0})}function Tu(e){return e.replace(/^:/,"")}function Hn(e,t={}){this.properties=new Cr(this),this.factory=new Yf(this,this.properties),this.registry=new Gi(e,this.properties),this.typeCache=Object.create(null),this.config=t}Hn.prototype.create=function(e,t){var n=this.getType(e);if(!n)throw new Error("unknown type <"+e+">");return new n(t)},Hn.prototype.getType=function(e){var t=this.typeCache,n=wn(e)?e:e.ns.name,i=t[n];return i||(e=this.registry.getEffectiveDescriptor(n),i=t[n]=this.factory.createType(e)),i},Hn.prototype.createAny=function(e,t,n){var i=on(e),r={$type:e,$instanceOf:function(a){return a===this.$type},get:function(a){return this[a]},set:function(a,s){Qx(this,[a],s)}},o={name:e,isGeneric:!0,ns:{prefix:i.prefix,localName:i.localName,uri:t}};return this.properties.defineDescriptor(r,o),this.properties.defineModel(r,this),this.properties.define(r,"get",{enumerable:!1,writable:!0}),this.properties.define(r,"set",{enumerable:!1,writable:!0}),this.properties.define(r,"$parent",{enumerable:!1,writable:!0}),this.properties.define(r,"$instanceOf",{enumerable:!1,writable:!0}),M(n,function(a,s){Gt(a)&&a.value!==void 0?r[a.name]=a.value:r[s]=a}),r},Hn.prototype.getPackage=function(e){return this.registry.getPackage(e)},Hn.prototype.getPackages=function(){return this.registry.getPackages()},Hn.prototype.getElementDescriptor=function(e){return e.$descriptor},Hn.prototype.hasType=function(e,t){t===void 0&&(t=e,e=this);var n=e.$model.getElementDescriptor(e);return t in n.allTypesByName},Hn.prototype.getPropertyDescriptor=function(e,t){return this.getElementDescriptor(e).propertiesByName[t]},Hn.prototype.getTypeDescriptor=function(e){return this.registry.typeMap[e]};var Qf=String.fromCharCode,t0=Object.prototype.hasOwnProperty,n0=/&#(\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 i0(e,t,n,i){return i?t0.call(zo,i)?zo[i]:"&"+i+";":Qf(t||parseInt(n,16))}function Pr(e){return e.length>3&&e.indexOf("&")!==-1?e.replace(n0,i0):e}var Jf="non-whitespace outside of root node";function Wi(e){return new Error(e)}function r0(e){return"missing namespace for prefix <"+e+">"}function Qa(e){return{get:e,enumerable:!0}}function o0(e){var t=Object.create(null),n;for(n in e)t[n]=e[n];return t}var ed=Symbol("nameCache");function Mu(e){return e+"$uri"}function a0(e){var t=Object.create(null),n,i;for(n in e)i=e[n],t[i]=i,t[Mu(i)]=n;return t}function Ja(){return{line:0,column:0}}function s0(e){throw e}function td(e){if(!this)return new td(e);var t=e&&e.proxy,n,i,r,o,a=s0,s,c,u,l,p=Ja,f=!1,d=!1,h="",m=!1,g=!1,R=null,w=!1,b,x,E,T;function L(N){N instanceof Error||(N=Wi(N)),R=N,a(N,p)}function A(N){s&&(N instanceof Error||(N=Wi(N)),s(N,p))}this.on=function(N,G){if(typeof G!="function")throw Wi("required args <name, cb>");switch(N){case"openTag":i=G;break;case"text":n=G;break;case"closeTag":r=G;break;case"error":a=G;break;case"warn":s=G;break;case"cdata":o=G;break;case"attention":l=G;break;case"question":u=G;break;case"comment":c=G;break;default:throw Wi("unsupported event: "+N)}return this},this.ns=function(N){if(typeof N>"u"&&(N={}),typeof N!="object")throw Wi("required args <nsMap={}>");var G=Object.create(null),fe;for(fe in N)G[fe]=N[fe];return g=!0,T=G,this};function j(){b=g?[]:null,x=g?a0(T):null,E=[],p=Ja,w=!1,R=null,d=!1,h=""}this.parse=function(N){if(typeof N!="string")throw Wi("required args <xml=string>");if(f)throw Wi("parse during stream; call end() first");return j(),H(N),p=Ja,w=!1,R},this.write=function(N){if(typeof N!="string")throw Wi("required args <xml=string>");return f||(j(),f=!0),R||(h=H(h+N,!0)||""),this},this.end=function(){return f||j(),f=!1,R||H(h),h="",p=Ja,w=!1,R},this.stop=function(){w=!0};function H(N,G=!1){var fe=null,Fe=null,lt,Y=0,de=!1,he=!1,se=0,ce=0,ee,F,$,U,ke,Lt,C,_,y,D="",I=0,W;function oe(tt,It){var un=tt.indexOf(":");if(un===-1)return tt;var ln=x[tt.substring(0,un)];return ln?It===ln?tt.substr(un+1):ln+tt.substr(un):(A(r0(tt.substring(0,un))),null)}function Pe(){if(W!==null)return W;var tt,It,un=g&&x.xmlns,ln=g&&m?[]:null,at=I,Nt=D,pn=Nt.length,jo,fn,Ln,In,Rt,Er={},Fo=new Set,xn,He,Xe;e:for(;at<pn;at++)if(xn=!1,He=Nt.charCodeAt(at),!(He===32||He<14&&He>8)){for((He<65||He>122||He>90&&He<97)&&He!==95&&He!==58&&(A("illegal first char attribute name"),xn=!0),Xe=at+1;Xe<pn;Xe++)if(He=Nt.charCodeAt(Xe),!(He>96&&He<123||He>64&&He<91||He>47&&He<59||He===46||He===45||He===95)){if(He===32||He<14&&He>8){A("missing attribute value"),at=Xe;continue e}if(He===61)break;A("illegal attribute name char"),xn=!0}if(Rt=Nt.substring(at,Xe),Rt==="xmlns:xmlns"&&(A("illegal declaration of xmlns"),xn=!0),He=Nt.charCodeAt(Xe+1),He===34)Xe=Nt.indexOf('"',at=Xe+2),Xe===-1&&(Xe=Nt.indexOf("'",at),Xe!==-1&&(A("attribute value quote missmatch"),xn=!0));else if(He===39)Xe=Nt.indexOf("'",at=Xe+2),Xe===-1&&(Xe=Nt.indexOf('"',at),Xe!==-1&&(A("attribute value quote missmatch"),xn=!0));else for(A("missing attribute value quotes"),xn=!0,Xe=Xe+1;Xe<pn&&(He=Nt.charCodeAt(Xe+1),!(He===32||He<14&&He>8));Xe++);for(Xe===-1&&(A("missing closing quotes"),Xe=pn,xn=!0),xn||(Ln=Nt.substring(at,Xe)),at=Xe;Xe+1<pn&&(He=Nt.charCodeAt(Xe+1),!(He===32||He<14&&He>8));Xe++)at===Xe&&(A("illegal character after attribute end"),xn=!0);if(at=Xe+1,xn)continue e;if(Fo.has(Rt)){A("attribute <"+Rt+"> already defined");continue}if(Fo.add(Rt),!g){Er[Rt]=Ln;continue}if(m){if(fn=Rt==="xmlns"?"xmlns":Rt.charCodeAt(0)===120&&Rt.substr(0,6)==="xmlns:"?Rt.substr(6):null,fn!==null){if(tt=Pr(Ln),It=Mu(fn),In=T[tt],!In){if(fn==="xmlns"||It in x&&x[It]!==tt)do In="ns"+Y++;while(typeof x[In]<"u");else In=fn;T[tt]=In}x[fn]!==In&&(jo||(x=o0(x),jo=!0),x[fn]=In,fn==="xmlns"&&(x[Mu(In)]=tt,un=In),x[It]=tt),Er[Rt]=Ln;continue}ln.push(Rt,Ln);continue}Rt=oe(Rt,un),Rt!==null&&(Er[Rt]=Ln)}if(m)for(at=0,pn=ln.length;at<pn;at++)Rt=oe(ln[at++],un),Ln=ln[at],Rt!==null&&(Er[Rt]=Ln);return W=Er}function Ue(){for(var tt=/(\r\n|\r|\n)/g,It=0,un=0,ln=0,at=ce,Nt,pn;se>=ln&&(Nt=tt.exec(N),!(!Nt||(at=Nt[0].length+Nt.index,at>se)));)It+=1,ln=at;return se==-1?(un=at,pn=N.substring(ce)):ce===0?pn=N.substring(ce,se):(un=se-ln,pn=ce==-1?N.substring(se):N.substring(se,ce+1)),{data:pn,line:It,column:un}}for(p=Ue,t&&(y=Object.create({},{name:Qa(function(){return C}),originalName:Qa(function(){return _}),attrs:Qa(Pe),ns:Qa(function(){return x})}));ce!==-1;){if(N.charCodeAt(ce)===60?se=ce:se=N.indexOf("<",ce),se===-1){if(G)return N.substring(ce);if(E.length)return L("unexpected end of file");if(!d)return L("missing start tag");ce<N.length&&N.substring(ce).trim()&&A(Jf);return}if(d||(d=!0),ce!==se){if(E.length){if(n&&(n(N.substring(ce,se),Pr,p),w))return}else if(N.substring(ce,se).trim()&&(A(Jf),w))return}if(U=N.charCodeAt(se+1),U===33){if($=N.charCodeAt(se+2),$===91&&N.substr(se+3,6)==="CDATA["){if(ce=N.indexOf("]]>",se),ce===-1)return G?N.substring(se):L("unclosed cdata");if(o&&(o(N.substring(se+9,ce),p),w))return;ce+=3;continue}if($===45&&N.charCodeAt(se+3)===45){if(ce=N.indexOf("-->",se),ce===-1)return G?N.substring(se):L("unclosed comment");if(c&&(c(N.substring(se+4,ce),Pr,p),w))return;ce+=3;continue}}if(U===63){if(ce=N.indexOf("?>",se),ce===-1)return G?N.substring(se):L("unclosed question");if(u&&(u(N.substring(se,ce+2),p),w))return;ce+=2;continue}for(ee=se+1;;ee++){if(ke=N.charCodeAt(ee),isNaN(ke))return G?N.substring(se):(ce=-1,L("unclosed tag"));if(ke===34)$=N.indexOf('"',ee+1),ee=$!==-1?$:ee;else if(ke===39)$=N.indexOf("'",ee+1),ee=$!==-1?$:ee;else if(ke===62){ce=ee;break}}if(U===33){if(l&&(l(N.substring(se,ce+1),Pr,p),w))return;ce+=1;continue}if(W={},U===47){if(de=!1,he=!0,!E.length)return L("missing open tag");if(ee=C=E.pop(),$=se+2+ee.length,N.substring(se+2,$)!==ee)return L("closing tag mismatch");for(;$<ce;$++)if(U=N.charCodeAt($),!(U===32||U>8&&U<14))return L("close tag")}else{if(N.charCodeAt(ce-1)===47?(ee=C=N.substring(se+1,ce-1),de=!0,he=!0):(ee=C=N.substring(se+1,ce),de=!0,he=!1),!(U>96&&U<123||U>64&&U<91||U===95||U===58))return L("illegal first char nodeName");for($=1,F=ee.length;$<F;$++)if(U=ee.charCodeAt($),!(U>96&&U<123||U>64&&U<91||U>47&&U<59||U===45||U===95||U==46)){if(U===32||U<14&&U>8){C=ee.substring(0,$),W=null;break}return L("invalid nodeName")}he||E.push(C)}if(g){lt=x,de&&(he||b.push(lt),W===null&&(m=ee.indexOf("xmlns",$)!==-1)&&(I=$,D=ee,Pe(),m=!1)),_=C,Fe!==x&&(fe=x[ed],fe===void 0&&(fe=x[ed]=Object.create(null)),Fe=x);var ft=fe[C];if(ft!==void 0)C=ft;else{if(U=C.indexOf(":"),U!==-1){if(Lt=x[C.substring(0,U)],!Lt)return L("missing namespace on <"+_+">");C=C.substr(U+1)}else Lt=x.xmlns;Lt&&(C=Lt+":"+C),fe[_]=C}}if(de&&(I=$,D=ee,i&&(t?i(y,Pr,he,p):i(C,Pe,Pr,he,p),w)))return;if(he){if(r&&(r(t?y:C,Pr,de,p),w))return;g&&(de?x=lt:x=b.pop())}ce+=1}}}function nd(e){return e.xml&&e.xml.tagAlias==="lowerCase"}var ku={xsi:"http://www.w3.org/2001/XMLSchema-instance",xml:"http://www.w3.org/XML/1998/namespace"},id="property";function rd(e){return e.xml&&e.xml.serialize}function c0(e){const t=rd(e);return t!==id&&(t||null)}function u0(e){return e.charAt(0).toUpperCase()+e.slice(1)}function od(e,t){return nd(t)?e.prefix+":"+u0(e.localName):e.name}function l0(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 p0(e,t,n){const i=on(e,t.xmlns),r=`${t[i.prefix]||i.prefix}:${i.localName}`,o=on(r);var a=n.getPackage(o.prefix);return l0(o,a)}function Ui(e){return new Error(e)}function Ei(e){return e.$descriptor}function f0(e){O(this,e),this.elementsById={},this.references=[],this.warnings=[],this.addReference=function(t){this.references.push(t)},this.addElement=function(t){if(!t)throw Ui("expected element");var n=this.elementsById,i=Ei(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 Ui("duplicate ID <"+o+">");n[o]=t}},this.addWarning=function(t){this.warnings.push(t)}}function Vo(){}Vo.prototype.handleEnd=function(){},Vo.prototype.handleText=function(){},Vo.prototype.handleNode=function(){};function Du(){}Du.prototype=Object.create(Vo.prototype),Du.prototype.handleNode=function(){return this};function eo(){}eo.prototype=Object.create(Vo.prototype),eo.prototype.handleText=function(e){this.body=(this.body||"")+e};function Go(e,t){this.property=e,this.context=t}Go.prototype=Object.create(eo.prototype),Go.prototype.handleNode=function(e){if(this.element)throw Ui("expected no sub nodes");return this.element=this.createReference(e),this},Go.prototype.handleEnd=function(){this.element.id=this.body},Go.prototype.createReference=function(e){return{property:this.property.ns.name,id:""}};function Ou(e,t){this.element=t,this.propertyDesc=e}Ou.prototype=Object.create(eo.prototype),Ou.prototype.handleEnd=function(){var e=this.body||"",t=this.element,n=this.propertyDesc;e=Pu(n.type,e),n.isMany?t.get(n.name).push(e):t.set(n.name,e)};function es(){}es.prototype=Object.create(eo.prototype),es.prototype.handleNode=function(e){var t=this,n=this.element;return n?t=this.handleChild(e):(n=this.element=this.createElement(e),this.context.addElement(n)),t};function dn(e,t,n){this.model=e,this.type=e.getType(t),this.context=n}dn.prototype=Object.create(es.prototype),dn.prototype.addReference=function(e){this.context.addReference(e)},dn.prototype.handleText=function(e){var t=this.element,n=Ei(t),i=n.bodyProperty;if(!i)throw Ui("unexpected body text <"+e+">");eo.prototype.handleText.call(this,e)},dn.prototype.handleEnd=function(){var e=this.body,t=this.element,n=Ei(t),i=n.bodyProperty;i&&e!==void 0&&(e=Pu(i.type,e),t.set(i.name,e))},dn.prototype.createElement=function(e){var t=e.attributes,n=this.type,i=Ei(n),r=this.context,o=new n({}),a=this.model,s;return M(t,function(c,u){var l=i.propertiesByName[u],p;l&&l.isReference?l.isMany?(p=c.split(" "),M(p,function(f){r.addReference({element:o,property:l.ns.name,id:f})})):r.addReference({element:o,property:l.ns.name,id:c}):(l?c=Pu(l.type,c):u==="xmlns"?u=":"+u:(s=on(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},dn.prototype.getPropertyForNode=function(e){var t=e.name,n=on(t),i=this.type,r=this.model,o=Ei(i),a=n.name,s=o.propertiesByName[a];if(s&&!s.isAttr){const u=c0(s);if(u){const l=e.attributes[u];if(l){const p=p0(l,e.ns,r),f=r.getType(p);return O({},s,{effectiveType:Ei(f).name})}}return s}var c=r.getPackage(n.prefix);if(c){const u=od(n,c),l=r.getType(u);if(s=st(o.properties,function(p){return!p.isVirtual&&!p.isReference&&!p.isAttribute&&l.hasType(p.type)}),s)return O({},s,{effectiveType:Ei(l).name})}else if(s=st(o.properties,function(u){return!u.isReference&&!u.isAttribute&&u.type==="Element"}),s)return s;throw Ui("unrecognized element <"+n.name+">")},dn.prototype.toString=function(){return"ElementDescriptor["+Ei(this.type).name+"]"},dn.prototype.valueHandler=function(e,t){return new Ou(e,t)},dn.prototype.referenceHandler=function(e){return new Go(e,this.context)},dn.prototype.handler=function(e){return e==="Element"?new to(this.model,e,this.context):new dn(this.model,e,this.context)},dn.prototype.handleChild=function(e){var t,n,i,r;if(t=this.getPropertyForNode(e),i=this.element,n=t.effectiveType||t.type,Kf(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?(O(o,{element:i}),this.context.addReference(o)):o.$parent=i),r};function Lu(e,t,n){dn.call(this,e,t,n)}Lu.prototype=Object.create(dn.prototype),Lu.prototype.createElement=function(e){var t=e.name,n=on(t),i=this.model,r=this.type,o=i.getPackage(n.prefix),a=o&&od(n,o)||t;if(!r.hasType(a))throw Ui("unexpected element <"+e.originalName+">");return dn.prototype.createElement.call(this,e)};function to(e,t,n){this.model=e,this.context=n}to.prototype=Object.create(es.prototype),to.prototype.createElement=function(e){var t=e.name,n=on(t),i=n.prefix,r=e.ns[i+"$uri"],o=e.attributes;return this.model.createAny(t,r,o)},to.prototype.handleChild=function(e){var t=new to(this.model,"Element",this.context).handleNode(e),n=this.element,i=t.element,r;return i!==void 0&&(r=n.$children=n.$children||[],r.push(i),i.$parent=n),t},to.prototype.handleEnd=function(){this.body&&(this.element.$body=this.body)};function Iu(e){e instanceof Hn&&(e={model:e}),O(this,{lax:!1},e)}Iu.prototype.fromXML=function(e,t,n){var i=t.rootHandler;t instanceof dn?(i=t,t={}):typeof t=="string"?(i=this.handler(t),t={}):typeof i=="string"&&(i=this.handler(i));var r=this.model,o=this.lax,a=new f0(O({},t,{rootHandler:i})),s=new td({proxy:!0}),c=d0();i.context=a,c.push(i);function u(E,T,L){var A=T(),j=A.line,H=A.column,N=A.data;N.charAt(0)==="<"&&N.indexOf(" ")!==-1&&(N=N.slice(0,N.indexOf(" "))+">");var G="unparsable content "+(N?N+" ":"")+`detected
2
- line: `+j+`
3
- column: `+H+`
4
- nested error: `+E.message;if(L)return a.addWarning({message:G,error:E}),!0;throw Ui(G)}function l(E,T){return u(E,T,!0)}function p(){var E=a.elementsById,T=a.references,L,A;for(L=0;A=T[L];L++){var j=A.element,H=E[A.id],N=Ei(j).propertiesByName[A.property];if(H||a.addWarning({message:"unresolved reference <"+A.id+">",element:A.element,property:A.property,value:A.id}),N.isMany){var G=j.get(N.name),fe=G.indexOf(A);fe===-1&&(fe=G.length),H?G[fe]=H:G.splice(fe,1)}else j.set(N.name,H)}}function f(){c.pop().handleEnd()}var d=/^<\?xml /i,h=/ encoding="([^"]+)"/i,m=/^utf-8$/i;function g(E){if(d.test(E)){var T=h.exec(E),L=T&&T[1];!L||m.test(L)||a.addWarning({message:"unsupported document encoding <"+L+">, falling back to UTF-8"})}}function R(E,T){var L=c.peek();try{c.push(L.handleNode(E))}catch(A){u(A,T,o)&&c.push(new Du)}}function w(E,T){try{c.peek().handleText(E)}catch(L){l(L,T)}}function b(E,T){E.trim()&&w(E,T)}var x=r.getPackages().reduce(function(E,T){return E[T.uri]=T.prefix,E},Object.entries(ku).reduce(function(E,[T,L]){return E[L]=T,E},r.config&&r.config.nsMap||{}));return s.ns(x).on("openTag",function(E,T,L,A){var j=E.attrs||{},H=Object.keys(j).reduce(function(G,fe){var Fe=T(j[fe]);return G[fe]=Fe,G},{}),N={name:E.name,originalName:E.originalName,attributes:H,ns:E.ns};R(N,A)}).on("question",g).on("closeTag",f).on("cdata",w).on("text",function(E,T,L){b(T(E),L)}).on("error",u).on("warn",l),new Promise(function(E,T){var L;try{s.parse(e),p()}catch(G){L=G}var A=i.element;!L&&!A&&(L=Ui("failed to parse document as <"+i.type.$descriptor.name+">"));var j=a.warnings,H=a.references,N=a.elementsById;return L?(L.warnings=j,T(L)):E({rootElement:A,elementsById:N,references:H,warnings:j})})},Iu.prototype.handler=function(e){return new Lu(this.model,e)};function d0(){var e=[];return Object.defineProperty(e,"peek",{value:function(){return this[this.length-1]}}),e}var h0=`<?xml version="1.0" encoding="UTF-8"?>
5
- `,m0=/<|>|'|"|&|\n\r|\n/g,ad=/<|>|&/g;function si(e){this.prefixMap={},this.uriMap={},this.used={},this.wellknown=[],this.custom=[],this.parent=e,this.defaultPrefixMap=e&&e.defaultPrefixMap||{}}si.prototype.mapDefaultPrefixes=function(e){this.defaultPrefixMap=e},si.prototype.defaultUriByPrefix=function(e){return this.defaultPrefixMap[e]},si.prototype.byUri=function(e){return this.uriMap[e]||this.parent&&this.parent.byUri(e)},si.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)},si.prototype.uriByPrefix=function(e){return this.prefixMap[e||"xmlns"]||this.parent&&this.parent.uriByPrefix(e)},si.prototype.mapPrefix=function(e,t){this.prefixMap[e||"xmlns"]=t},si.prototype.getNSKey=function(e){return e.prefix!==void 0?e.uri+"|"+e.prefix:e.uri},si.prototype.logUsed=function(e){var t=e.uri,n=this.getNSKey(e);this.used[n]=this.byUri(t),this.parent&&this.parent.logUsed(e)},si.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 g0(e){return e.charAt(0).toLowerCase()+e.slice(1)}function y0(e,t){return nd(t)?g0(e):e}function sd(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})}function cd(e){return wn(e)?e:(e.prefix?e.prefix+":":"")+e.localName}function v0(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 _0(e,t){return t.isGeneric?O({localName:t.ns.localName},e):O({localName:y0(t.ns.localName,t.$pkg)},e)}function b0(e,t){return O({localName:t.ns.localName},e)}function x0(e){var t=e.$descriptor;return Oe(t.properties,function(n){var i=n.name;if(n.isVirtual||!En(e,i))return!1;var r=e[i];return r===n.default||r===null?!1:n.isMany?r.length:!0})}var w0={"\n":"#10","\n\r":"#10",'"':"#34","'":"#39","<":"#60",">":"#62","&":"#38"},E0={"<":"lt",">":"gt","&":"amp"};function ud(e,t,n){return e=wn(e)?e:""+e,e.replace(t,function(i){return"&"+n[i]+";"})}function S0(e){return ud(e,m0,w0)}function R0(e){return ud(e,ad,E0)}function C0(e){return Oe(e,function(t){return t.isAttr})}function P0(e){return Oe(e,function(t){return!t.isAttr})}function Nu(e){this.tagName=e}Nu.prototype.build=function(e){return this.element=e,this},Nu.prototype.serializeTo=function(e){e.appendIndent().append("<"+this.tagName+">"+this.element.id+"</"+this.tagName+">").appendNewLine()};function Ar(){}Ar.prototype.serializeValue=Ar.prototype.serializeTo=function(e){e.append(this.escape?R0(this.value):this.value)},Ar.prototype.build=function(e,t){return this.value=t,e.type==="String"&&t.search(ad)!==-1&&(this.escape=!0),this};function Bu(e){this.tagName=e}sd(Bu,Ar),Bu.prototype.serializeTo=function(e){e.appendIndent().append("<"+this.tagName+">"),this.serializeValue(e),e.append("</"+this.tagName+">").appendNewLine()};function dt(e,t){this.body=[],this.attrs=[],this.parent=e,this.propertyDescriptor=t}dt.prototype.build=function(e){this.element=e;var t=e.$descriptor,n=this.propertyDescriptor,i,r,o=t.isGeneric;return o?i=this.parseGenericNsAttributes(e):i=this.parseNsAttributes(e),n?this.ns=this.nsPropertyTagName(n):this.ns=this.nsTagName(t),this.tagName=this.addTagName(this.ns),o?this.parseGenericContainments(e):(r=x0(e),this.parseAttributes(C0(r)),this.parseContainments(P0(r))),this.parseGenericAttributes(e,i),this},dt.prototype.nsTagName=function(e){var t=this.logNamespaceUsed(e.ns);return _0(t,e)},dt.prototype.nsPropertyTagName=function(e){var t=this.logNamespaceUsed(e.ns);return b0(t,e)},dt.prototype.isLocalNs=function(e){return e.uri===this.ns.uri},dt.prototype.nsAttributeName=function(e){var t;if(wn(e)?t=on(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}:O({localName:t.localName},n)},dt.prototype.parseGenericNsAttributes=function(e){return Object.entries(e).filter(([t,n])=>!t.startsWith("$")&&this.parseNsAttribute(e,t,n)).map(([t,n])=>({name:t,value:n}))},dt.prototype.parseGenericContainments=function(e){var t=e.$body;t&&this.body.push(new Ar().build({type:"String"},t));var n=e.$children;n&&M(n,i=>{this.body.push(new dt(this).build(i))})},dt.prototype.parseNsAttribute=function(e,t,n){var i=e.$model,r=on(t),o;if(r.prefix==="xmlns"&&(o={prefix:r.localName,uri:n}),!r.prefix&&r.localName==="xmlns"&&(o={uri:n}),!o)return{name:t,value:n};if(i&&i.getPackage(n))this.logNamespace(o,!0,!0);else{var a=this.logNamespaceUsed(o,!0);this.getNamespaces().logUsed(a)}},dt.prototype.parseNsAttributes=function(e){var t=this,n=e.$attrs,i=[];return M(n,function(r,o){var a=t.parseNsAttribute(e,o,r);a&&i.push(a)}),i},dt.prototype.parseGenericAttributes=function(e,t){var n=this;M(t,function(i){try{n.addAttribute(n.nsAttributeName(i.name),i.value)}catch(r){typeof console<"u"&&console.warn(`missing namespace information for <${i.name}=${i.value}> on`,e,r)}})},dt.prototype.parseContainments=function(e){var t=this,n=this.body,i=this.element;M(e,function(r){var o=i.get(r.name),a=r.isReference,s=r.isMany;if(s||(o=[o]),r.isBody)n.push(new Ar().build(r,o[0]));else if(Kf(r.type))M(o,function(u){n.push(new Bu(t.addTagName(t.nsPropertyTagName(r))).build(r,u))});else if(a)M(o,function(u){n.push(new Nu(t.addTagName(t.nsPropertyTagName(r))).build(u))});else{var c=rd(r);M(o,function(u){var l;c?c===id?l=new dt(t,r):l=new ts(t,r,c):l=new dt(t),n.push(l.build(u))})}})},dt.prototype.getNamespaces=function(e){var t=this.namespaces,n=this.parent,i;return t||(i=n&&n.getNamespaces(),e||!i?this.namespaces=t=new si(i):t=i),t},dt.prototype.logNamespace=function(e,t,n){var i=this.getNamespaces(n),r=e.uri,o=e.prefix,a=i.byUri(r);return(!a||n)&&i.add(e,t),i.mapPrefix(o,r),e},dt.prototype.logNamespaceUsed=function(e,t){var n=this.getNamespaces(t),i=e.prefix,r=e.uri,o,a,s;if(!i&&!r)return{localName:e.localName};if(s=n.defaultUriByPrefix(i),r=r||s||n.uriByPrefix(i),!r)throw new Error("no namespace uri given for prefix <"+i+">");if(e=n.byUri(r),!e&&!i&&(e=this.logNamespace({uri:r},s===r,!0)),!e){for(o=i,a=1;n.uriByPrefix(o);)o=i+"_"+a++;e=this.logNamespace({prefix:o,uri:r},s===r)}return i&&n.mapPrefix(i,r),e},dt.prototype.parseAttributes=function(e){var t=this,n=this.element;M(e,function(i){var r=n.get(i.name);if(i.isReference)if(!i.isMany)r=r.id;else{var o=[];M(r,function(a){o.push(a.id)}),r=o.join(" ")}t.addAttribute(t.nsAttributeName(i),r)})},dt.prototype.addTagName=function(e){var t=this.logNamespaceUsed(e);return this.getNamespaces().logUsed(t),cd(e)},dt.prototype.addAttribute=function(e,t){var n=this.attrs;wn(t)&&(t=S0(t));var i=Wf(n,function(o){return o.name.localName===e.localName&&o.name.uri===e.uri&&o.name.prefix===e.prefix}),r={name:e,value:t};i!==-1?n.splice(i,1,r):n.push(r)},dt.prototype.serializeAttributes=function(e){var t=this.attrs,n=this.namespaces;n&&(t=v0(n).concat(t)),M(t,function(i){e.append(" ").append(cd(i.name)).append('="').append(i.value).append('"')})},dt.prototype.serializeTo=function(e){var t=this.body[0],n=t&&t.constructor!==Ar;e.appendIndent().append("<"+this.tagName),this.serializeAttributes(e),e.append(t?">":" />"),t&&(n&&e.appendNewLine().indent(),M(this.body,function(i){i.serializeTo(e)}),n&&e.unindent().appendIndent(),e.append("</"+this.tagName+">")),e.appendNewLine()};function ts(e,t,n){dt.call(this,e,t),this.serialization=n}sd(ts,dt),ts.prototype.parseNsAttributes=function(e){var t=dt.prototype.parseNsAttributes.call(this,e).filter(a=>a.name!==this.serialization),n=e.$descriptor;if(n.name===this.propertyDescriptor.type)return t;var i=this.typeNs=this.nsTagName(n);this.getNamespaces().logUsed(this.typeNs);var r=e.$model.getPackage(i.uri),o=r.xml&&r.xml.typePrefix||"";return this.addAttribute(this.nsAttributeName(this.serialization),(i.prefix?i.prefix+":":"")+o+n.ns.localName),t},ts.prototype.isLocalNs=function(e){return e.uri===(this.typeNs||this.ns).uri};function A0(){this.value="",this.write=function(e){this.value+=e}}function T0(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 M0(e){e=O({format:!1,preamble:!0},e||{});function t(n,i){var r=i||new A0,o=new T0(r,e.format);e.preamble&&o.append(h0);var a=new dt,s=n.$model;if(a.getNamespaces().mapDefaultPrefixes(k0(s)),a.build(n).serializeTo(o),!i)return r.value}return{toXML:t}}function k0(e){const t=e.config&&e.config.nsMap||{},n={};for(const i in ku)n[i]=ku[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 ns(e,t){Hn.call(this,e,t)}ns.prototype=Object.create(Hn.prototype),ns.prototype.fromXML=function(e,t,n){wn(t)||(n=t,t="bpmn:Definitions");var i=new Iu(O({model:this,lax:!0},n)),r=i.handler(t);return i.fromXML(e,r)},ns.prototype.toXML=function(e,t){var n=new M0(t);return new Promise(function(i,r){try{var o=n.toXML(e);return i({xml:o})}catch(a){return r(a)}})};var D0="BPMN20",O0="http://www.omg.org/spec/BPMN/20100524/MODEL",L0="bpmn",I0=[],N0=[{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"}]}],B0=[{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"}]}],$0={tagAlias:"lowerCase",typePrefix:"t"},j0={name:D0,uri:O0,prefix:L0,associations:I0,types:N0,enumerations:B0,xml:$0},F0="BPMNDI",H0="http://www.omg.org/spec/BPMN/20100524/DI",z0="bpmndi",V0=[{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"]}],G0=[{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"}]}],W0=[],U0={name:F0,uri:H0,prefix:z0,types:V0,enumerations:G0,associations:W0},Y0="DC",q0="http://www.omg.org/spec/DD/20100524/DC",K0="dc",X0=[{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}]}],Z0=[],Q0={name:Y0,uri:q0,prefix:K0,types:X0,associations:Z0},J0="DI",ew="http://www.omg.org/spec/DD/20100524/DI",tw="di",nw=[{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"}]}],iw=[],rw={tagAlias:"lowerCase"},ow={name:J0,uri:ew,prefix:tw,types:nw,associations:iw,xml:rw},aw="bpmn.io colors for BPMN",sw="http://bpmn.io/schema/bpmn/biocolor/1.0",cw="bioc",uw=[{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"}]}],lw=[],pw=[],fw={name:aw,uri:sw,prefix:cw,types:uw,enumerations:lw,associations:pw},dw="BPMN in Color",hw="http://www.omg.org/spec/BPMN/non-normative/color/1.0",mw="color",gw=[{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"}]}],yw=[],vw=[],_w={name:dw,uri:hw,prefix:mw,types:gw,enumerations:yw,associations:vw};const bw={bpmn:j0,bpmndi:U0,dc:Q0,di:ow,bioc:fw,color:_w};function ld(e,t){const n=O({},bw,e);return new ns(n,t)}const xw={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"}},ww="http://www.omg.org/spec/BPMN/non-normative/extensions/i18n/1.0",pd="i18n",is={[pd]:xw,[bu]:Ff};function fd(){return ld(is)}const dd=fd();async function $u(e){const{rootElement:t,warnings:n}=await dd.fromXML(e,"bpmn:Definitions");return{definitions:t,warnings:n}}async function Ew(e){const{xml:t}=await dd.toXML(e,{format:!0});return t}function ju(e){return e.map(t=>typeof t=="string"?t:t.message??String(t))}const no={cjkEm:.865,upperEm:.68,lowerEm:.5,digitEm:.556,spaceEm:.278,otherEm:.35,ascentEm:.9,descentEm:.25},Sw=/[ᄀ-ᇿ -〿぀-ヿ㐀-鿿가-힯＀-⦆]/;function Rw(e){const t=no;return Sw.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 io(e,t){let n=0;for(const i of e)n+=t*Rw(i);return n}function hd(e=globalThis,{textMeasurement:t="approximate"}={}){if(!(e!=null&&e.SVGElement))throw new Error("installHeadlessBpmnDom: DOM 전역이 없다 — jsdom window 를 전역에 올린 뒤 호출할 것");t==="approximate"&&Cw(e),Pw(e),Aw(e),Tw(e)}function Cw(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:io(r,o),fontBoundingBoxAscent:o*no.ascentEm,fontBoundingBoxDescent:o*no.descentEm,actualBoundingBoxAscent:o*no.ascentEm,actualBoundingBoxDescent:o*no.descentEm}}};t.getContext=()=>n}function Pw(e){if(e.SVGMatrix)return;class t{constructor(){Kr(this,"a",1);Kr(this,"b",0);Kr(this,"c",0);Kr(this,"d",1);Kr(this,"e",0);Kr(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 Aw(e){var o;const t=()=>{const a=new e.SVGMatrix;return{type:0,matrix:a,setTranslate(s,c){a.e=s,a.f=c},setScale(s,c){a.a=s,a.d=c},setRotate(s,c=0,u=0){const l=s*Math.PI/180,p=Math.cos(l),f=Math.sin(l);a.a=p,a.b=f,a.c=-f,a.d=p,a.e=c-p*c+f*u,a.f=u-f*c-p*u},setMatrix(s){Object.assign(a,s)}}},n=a=>{const s=t();return Object.assign(s.matrix,a),s},i=(o=e.SVGSVGElement)==null?void 0:o.prototype;i&&!i.createSVGTransform&&(i.createSVGTransform=t,i.createSVGTransformFromMatrix=n,i.createSVGMatrix=()=>new e.SVGMatrix,i.createSVGPoint=()=>({x:0,y:0,matrixTransform:()=>({x:0,y:0})}));const r=e.SVGElement.prototype;Object.getOwnPropertyDescriptor(r,"transform")||Object.defineProperty(r,"transform",{configurable:!0,get(){if(!this.__headlessTransformList){const a=[];this.__headlessTransformList={baseVal:{get numberOfItems(){return a.length},clear:()=>{a.length=0},appendItem:s=>(a.push(s),s),getItem:s=>a[s],createSVGTransformFromMatrix:n,consolidate:()=>a[a.length-1]??null}}}return this.__headlessTransformList}})}function Tw(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:io(n,12),height:14}})}const rs=new Set(["bpmn:Participant","bpmn:Lane","bpmn:Group","bpmn:SubProcess","bpmn:AdHocSubProcess","bpmn:Transaction"]),Mw=1,kw=2;function Yi(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"label-on-shared-segment":return`l|${e.edge}|${e.other}`;case"annotation-over-label":return`a|${e.annotation}|${e.label}`;case"group-overlap-unintended":return`g|${e.groups[0]}|${e.groups[1]}`;case"group-on-container-boundary":return`gb|${e.group}|${e.container}|${e.side}`;case"pool-name-over-label":return`pn|${e.pool}|${e.label}`}}const md=20,gd=5,Dw=3,yd=12,Ow=yd*1.2;function Fu(e,t){const n=t.split(/\r?\n/),i=Math.max(...n.map(o=>io(o,yd))),r=n.length*Ow;return{x:e.x+e.width/2-i/2,y:e.y+e.height/2-r/2,width:i,height:r}}const vd=1;function hn(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 os(e,t){let n=null;const i=e.type!==t.type;for(const r of hn(e))for(const o of hn(t)){if(r.axis!==o.axis||Math.abs(r.at-o.at)>vd)continue;const a=r.dir!==o.dir?"opposite":i?"mixed":null;if(!a)continue;const s=Math.min(r.hi,o.hi)-Math.max(r.lo,o.lo);s>=md&&(!n||s>n.length)&&(n={axis:r.axis,length:s,kind:a})}return n}function _d(e,t){const n=os(e,t);return n&&n.kind==="opposite"?{axis:n.axis,length:n.length}:null}function Lw(e,t){let n=0;for(const i of t)i.id!==e.id&&_d(e,i)&&n++;return n}function Tr(e,t){let n=0;for(const i of t)i.id!==e.id&&os(e,i)&&n++;return n}const bd=15,xd=20;function Iw(e,t){const n=t.axis==="v"?[e.x,e.x+e.width]:[e.y,e.y+e.height];if(t.at<n[0]-xd||t.at>n[1]+xd)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 Hu=20;function as(e,t){const n=[];for(const i of t){if(i.axis!==e.axis||Math.abs(i.at-e.at)>vd)continue;const r=Math.max(e.lo,i.lo),o=Math.min(e.hi,i.hi);o-r<md||n.push([r-Hu,o+Hu])}return n}function ss(e,t){const n=e.label;if(!n)return null;let i=null;for(const r of hn(e)){const o=Iw(n,r);if(o){for(const a of t)if(a.id!==e.id&&!(i&&a.id>=i.other)){for(const[s,c]of as(r,hn(a)))if(Math.min(c,o[1])>Math.max(s,o[0])){i={other:a.id,axis:r.axis};break}}}}return i}const Nw=1,Bw=(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 $w(e,t,n,i){const r=n.x+i,o=n.y+i,a=n.x+n.width-i,s=n.y+n.height-i;if(a<=r||s<=o)return!1;const c=t.x-e.x,u=t.y-e.y;let l=0,p=1;const f=(d,h)=>{if(h===0)return d<=0;const m=d/h;if(h>0){if(m>p)return!1;m>l&&(l=m)}else{if(m<l)return!1;m<p&&(p=m)}return!0};return f(r-e.x,c)&&f(e.x-a,-c)&&f(o-e.y,u)&&f(e.y-s,-u)&&p>l}function zu(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 jw=(e,t)=>e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height,ro=1;function Si(e,t){const n=e.x+ro,i=e.x+e.width-ro,r=e.y+ro,o=e.y+e.height-ro;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 Wo(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 wd(e,t){const n=e.label;if(!n)return null;if(hn(e).some(i=>Si(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(hn(i).some(r=>Si(n,r)))return i.id;for(const i of t.shapes.filter(r=>r.container).sort((r,o)=>r.id.localeCompare(o.id)))if(Wo(i).some(r=>Si(n,r)))return i.id;return null}function zn(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($w(e.waypoints[o],e.waypoints[o+1],r,kw)){i.push(r);break}}return i}function Fw(e,t,n,i){const r=(u,l,p)=>(l.x-u.x)*(p.y-u.y)-(l.y-u.y)*(p.x-u.x),o=r(n,i,e),a=r(n,i,t),s=r(e,t,n),c=r(e,t,i);return o*a<0&&s*c<0}const Ed=(e,t)=>e.endpoints.some(n=>t.endpoints.includes(n));function cs(e,t){let n=0;for(const i of t){if(i.id===e.id||Ed(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++)Fw(e.waypoints[o],e.waypoints[o+1],i.waypoints[a],i.waypoints[a+1])&&(r=!0);r&&n++}return n}function Ri(e,t){let n=0;for(const i of t)i.id===e.id||Ed(e,i)||cs(e,[i])>0&&(n+=i.type===e.type?2:1);return n}function Sd(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++)cs(n[i],[n[r]])>0&&(t+=n[i].type===n[r].type?2:1);return t}function Vu(e){const t=[],n=e.edges;for(let i=0;i<n.length;i++)for(let r=i+1;r<n.length;r++)if(cs(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 Rd(e){var n;const t=(n=ht(e==null?void 0:e.extensionElements))==null?void 0:n.values;if(Array.isArray(t))for(const i of t){const r=ht(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 Cd=e=>e?{members:e}:{},Ci=e=>e.shapes.filter(t=>!t.container);function Hw(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 Pd(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(hn(i).some(r=>Si(n,r)))return i.id;for(const i of[...t.shapes].filter(r=>r.container).sort((r,o)=>r.id.localeCompare(o.id)))if(Wo(i).some(r=>Si(n,r)))return i.id;return null}function Uo(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 qi(e){const t=[],n=e.shapes.filter(p=>!p.container);for(const p of e.edges)for(const f of zn(p,n))t.push({kind:"edge-crosses-shape",edge:p.id,shape:f.id});const i=n.filter(p=>!p.attached);for(let p=0;p<i.length;p++)for(let f=p+1;f<i.length;f++){const d=i[p],h=i[f];if(!zu(d,h,Mw))continue;const m=d.id<h.id?[d.id,h.id]:[h.id,d.id];t.push({kind:"shape-overlap",shapes:m,identical:jw(d,h)})}const r=e.shapes.filter(p=>p.type==="bpmn:Group"&&Array.isArray(p.members)&&p.members.length>0);for(let p=0;p<r.length;p++)for(let f=p+1;f<r.length;f++){const d=r[p],h=r[f],m=Math.min(d.x+d.width,h.x+h.width)-Math.max(d.x,h.x),g=Math.min(d.y+d.height,h.y+h.height)-Math.max(d.y,h.y);if(m<=gd||g<=gd)continue;const R=new Set(h.members);d.members.some(w=>R.has(w))||t.push({kind:"group-overlap-unintended",groups:d.id<h.id?[d.id,h.id]:[h.id,d.id]})}const o=e.shapes.filter(p=>p.container&&p.type!=="bpmn:Group"&&p.type!=="bpmn:Lane");for(const p of e.shapes.filter(f=>f.type==="bpmn:Group"))for(const f of o){const d=p.x<f.x+f.width&&f.x<p.x+p.width,h=p.y<f.y+f.height&&f.y<p.y+p.height,m=[["top",p.y,f.y,d],["bottom",p.y+p.height,f.y+f.height,d],["left",p.x,f.x,h],["right",p.x+p.width,f.x+f.width,h]];for(const[g,R,w,b]of m)b&&Math.abs(R-w)<=Dw&&t.push({kind:"group-on-container-boundary",group:p.id,container:f.id,side:g})}for(let p=0;p<e.edges.length;p++)for(let f=p+1;f<e.edges.length;f++){const d=e.edges[p],h=e.edges[f],m=os(d,h);if(!m)continue;const g=d.id<h.id?[d.id,h.id]:[h.id,d.id];t.push({kind:m.kind==="opposite"?"edge-overlap-opposite":"edge-overlap-mixed",edges:g,axis:m.axis,length:Math.round(m.length)})}for(const p of e.edges){if(!p.label)continue;const f=ss(p,e.edges);f&&t.push({kind:"label-on-shared-segment",edge:p.id,other:f.other,axis:f.axis})}for(const p of e.edges){if(!p.label)continue;const f=wd(p,e);f&&t.push({kind:"label-over-line",edge:p.id,line:f})}const a=new Set(n.map(p=>p.id)),s=e.shapes.filter(p=>p.type==="bpmn:Participant"&&p.label);for(const p of[...n,...s.filter(f=>!a.has(f.id))]){if(!p.label)continue;const f=Pd(p,e);f&&t.push({kind:"label-over-line",edge:p.id,line:f})}const c=new Set(e.shapes.filter(p=>p.type==="bpmn:TextAnnotation").map(p=>p.id));for(const p of s)for(const{owner:f,rect:d}of Uo(e))f===p.id||c.has(f)||zu(p.label,d,ro)&&t.push({kind:"pool-name-over-label",pool:p.id,label:f});const u=Uo(e);for(const p of n)if(p.type==="bpmn:TextAnnotation")for(const{owner:f,rect:d}of u)f!==p.id&&zu(p,d,ro)&&t.push({kind:"annotation-over-label",annotation:p.id,label:f});const l=new Map(e.shapes.map(p=>[p.id,p]));for(const p of n){const f=p.parent??Hw(p,e,l);if(!f)continue;const d=l.get(f);!d||!d.container||Bw(d,p,Nw)||t.push({kind:"shape-outside-container",shape:p.id,container:d.id})}return t.sort((p,f)=>Yi(p).localeCompare(Yi(f)))}const ht=e=>typeof e=="object"&&e!==null?e:void 0,xt=e=>typeof e=="number"?e:0,Mr=e=>{const t=ht(e);return typeof(t==null?void 0:t.id)=="string"?t.id:void 0};function zw(e){const t=ht(e);if(!t)return[];const n=[];for(const i of["sourceRef","targetRef"]){const r=t[i];for(const o of Array.isArray(r)?r:[r]){const a=Mr(o);a&&n.push(a)}}return n}function Vw(e,t){const n=ht(e.$parent);if(!n)return;const i=typeof n.$type=="string"?n.$type:"";if(i==="bpmn:Process"){const r=Mr(n);return r?t.get(r):void 0}if(rs.has(i)&&i!=="bpmn:Lane"&&i!=="bpmn:Group")return Mr(n)}function Ad(e){var a,s,c,u,l;const t=[],n=[],i=((a=ht(e))==null?void 0:a.diagrams)??[],r=new Map,o=new Set;for(const p of((s=ht(e))==null?void 0:s.rootElements)??[]){const f=ht(p);if((f==null?void 0:f.$type)==="bpmn:Collaboration")for(const d of f.participants??[]){const h=ht(d),m=Mr(h),g=Mr(h==null?void 0:h.processRef);m&&g?r.set(g,m):m&&o.add(m)}}for(const p of i){const f=ht((c=ht(p))==null?void 0:c.plane),d=(f==null?void 0:f.planeElement)??[];for(const h of d){const m=ht(h);if(!m)continue;const g=ht(m.bpmnElement),R=typeof(g==null?void 0:g.id)=="string"?g.id:void 0;if(!R)continue;const w=typeof(g==null?void 0:g.$type)=="string"?g.$type:"",b=ht(m.bounds);if(b){const E=m.isExpanded===!1&&w!=="bpmn:Participant",T=ht((u=ht(m.label))==null?void 0:u.bounds),L={id:R,type:w,x:xt(b.x),y:xt(b.y),width:xt(b.width),height:xt(b.height),container:rs.has(w)&&!E,attached:(g==null?void 0:g.attachedToRef)!==void 0,...g?{parent:Vw(g,r)}:{},...T?{label:{x:xt(T.x),y:xt(T.y),width:xt(T.width),height:xt(T.height)}}:{},...w==="bpmn:Group"?Cd(Rd(g)):{}},A=m.isHorizontal!==!1,j=typeof(g==null?void 0:g.name)=="string"?g.name:"";o.has(R)&&A&&j&&(L.label=Fu(L,j)),t.push(L);continue}const x=m.waypoint;if(Array.isArray(x)){const E=ht((l=ht(m.label))==null?void 0:l.bounds);n.push({id:R,type:w,waypoints:x.map(T=>{var L,A;return{x:xt((L=ht(T))==null?void 0:L.x),y:xt((A=ht(T))==null?void 0:A.y)}}),endpoints:zw(g),...E?{label:{x:xt(E.x),y:xt(E.y),width:xt(E.width),height:xt(E.height)}}:{}})}}}return{shapes:t,edges:n}}function Td(e){return qi(Ad(e))}async function Gw(e){const{definitions:t,warnings:n}=await $u(e);return{findings:Td(t),warnings:n}}function Ut(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 m=ht(o.label);n.push({id:o.id,type:a,waypoints:s.map(g=>({x:xt(g.x),y:xt(g.y)})),endpoints:[Mr(o.source),Mr(o.target)].filter(g=>!!g),...m&&typeof m.x=="number"?{label:{x:m.x,y:xt(m.y),width:xt(m.width),height:xt(m.height)}}:{}});continue}if(typeof o.x!="number"||typeof o.y!="number")continue;const c=ht(o.businessObject),u=ht(o.label);let l=ht(o.parent);for(;l&&l.type==="bpmn:Lane";)l=ht(l.parent);const p=typeof(l==null?void 0:l.type)=="string"?l.type:"",f=l&&rs.has(p)&&p!=="bpmn:Group"&&typeof l.id=="string"?l.id:void 0,d={id:o.id,type:a,x:o.x,y:o.y,width:xt(o.width),height:xt(o.height),container:rs.has(a)&&(a==="bpmn:Participant"||o.collapsed!==!0),attached:(c==null?void 0:c.attachedToRef)!==void 0,...f!==void 0?{parent:f}:{},...u&&typeof u.x=="number"?{label:{x:u.x,y:xt(u.y),width:xt(u.width),height:xt(u.height)}}:{},...a==="bpmn:Group"?Cd(Rd(c)):{}},h=typeof(c==null?void 0:c.name)=="string"?c.name:"";a==="bpmn:Participant"&&!(c!=null&&c.processRef)&&h&&((i=ht(o.di))==null?void 0:i.isHorizontal)!==!1&&(d.label=Fu(d,h)),t.push(d)}return{shapes:t,edges:n}}const Ww={"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 Uw(e,t){const n=Ww[e];return n||(e==="label"||e.startsWith("bpmndi:")?"other":e.startsWith("bpmn:")&&!("waypoints"in t&&t.waypoints)?"flowNode":"other")}function Md(e){let t=e.parent;for(;t;){if(t.type==="bpmn:Participant")return t.id;t=t.parent}}function kd(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 Uw(i.type,i)},lanesOf:n=>t().filter(i=>i.type==="bpmn:Lane"&&Md(i)===n).sort((i,r)=>i.y-r.y).map(i=>i.id),participantOf:n=>{const i=e.get(n);return i?Md(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 Dd=20,Yw=4,Pt=(e,t)=>Math.abs(e-t)<.5;function Od(e,t,n,i=Dd){if(Pt(e.y,t.y)&&!Pt(e.x,t.x)){const r=Math.min(e.x,t.x),o=Math.max(e.x,t.x);if(!(r<n.x-i&&n.x+n.width+i<o))return null;const a=e.x<t.x?n.x-i:n.x+n.width+i,s=e.x<t.x?n.x+n.width+i:n.x-i,c=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(Pt(e.x,t.x)&&!Pt(e.y,t.y)){const r=Math.min(e.y,t.y),o=Math.max(e.y,t.y);if(!(r<n.y-i&&n.y+n.height+i<o))return null;const a=e.y<t.y?n.y-i:n.y+n.height+i,s=e.y<t.y?n.y+n.height+i:n.y-i,c=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 Ld(e,t,n=Dd){if(e.length!==4)return null;const[i,r,o,a]=e;if(Pt(i.y,r.y)&&Pt(r.x,o.x)&&Pt(o.y,a.y)){const s=c=>[i,{x:c,y:i.y},{x:c,y:a.y},a];return[s(t.x-n),s(t.x+t.width+n)]}if(Pt(i.x,r.x)&&Pt(r.y,o.y)&&Pt(o.x,a.x)){const s=c=>[i,{x:i.x,y:c},{x:a.x,y:c},a];return[s(t.y-n),s(t.y+t.height+n)]}return null}function Gu(e,t){if(e.endpoints.length!==2)return[];const n=t.find(p=>p.id===e.endpoints[0]),i=t.find(p=>p.id===e.endpoints[1]);if(!n||!i)return[];if(i.x<=n.x+n.width)return[];const r=n.y+n.height/2,o=i.y+i.height/2;if(r>=i.y&&r<=i.y+i.height)return[];const a=i.x+i.width/2,s=n.x+n.width/2,c=r>o,u=[{x:n.x+n.width,y:r},{x:a,y:r},{x:a,y:c?i.y+i.height:i.y}],l=[{x:s,y:c?n.y:n.y+n.height},{x:s,y:o},{x:i.x,y:o}];return[u,l]}const Id=30,qw=[0,-25,25,-40,40];function Kw(e,t){if(e.type!=="bpmn:MessageFlow"||e.endpoints.length!==2)return[];const n=t.find(f=>f.id===e.endpoints[0]),i=t.find(f=>f.id===e.endpoints[1]);if(!n||!i)return[];const r=n.y+n.height/2,o=i.y+i.height/2;if(i.y<n.y+n.height&&i.y+i.height>n.y)return[];const a=o<r,s=a?n.y+n.height:n.y,c=a?s+Id:s-Id,u=a?i.y+i.height:i.y,l=n.x+n.width/2,p=i.x+i.width/2;return qw.map(f=>[{x:l,y:s},{x:l,y:c},{x:p+f,y:c},{x:p+f,y:u}])}const Xw=(e,t,n)=>[...e.slice(0,t+1),...n,...e.slice(t+1)],us=(e,t,n)=>zn({...e,waypoints:t},n).length;function Nd(e,t,n,i){let r=[...e.waypoints],o=us(e,r,t);if(o===0)return null;let a=!1;for(const p of Gu(e,t))if(us(e,p,t)===0)return p;const s=(i??[]).filter(p=>p.id!==e.id).flatMap(hn),c=p=>hn({...e,waypoints:p}).some(f=>as(f,s).length>0),u=Kw(e,t).filter(p=>us(e,p,t)===0);if(u.length)return u.find(p=>!c(p))??u[0];const l=p=>!n||p.every(f=>f.x>=n.x&&f.x<=n.x+n.width&&f.y>=n.y&&f.y<=n.y+n.height);for(let p=0;p<Yw&&o>0;p++){let f=!1;for(let d=0;d+1<r.length&&!f;d++){const h=r[d],m=r[d+1];for(const g of t){if(e.endpoints.includes(g.id)||zn({...e,waypoints:[h,m]},[g]).length===0)continue;const R=Od(h,m,g),w=R?R.map(x=>Xw(r,d,x)):Ld(r,g)??[];if(!w.length)continue;const b=[...w].sort((x,E)=>Number(l(E))-Number(l(x)));for(const x of b){const E=us(e,x,t);if(E<o){r=x,o=E,f=!0,a=!0;break}}if(f)break}}if(!f)break}return a&&o===0?r:null}function Bd(e,t){const{elementRegistry:n}=e,i=e.modeling,r=Ut(n),o=Ci(r),a=qi(r).filter(c=>c.kind==="edge-crosses-shape"&&!t.has(Yi(c)));if(!a.length)return;const s=new Map;for(const c of a){if(c.kind!=="edge-crosses-shape"||s.has(c.edge))continue;const u=r.edges.find(l=>l.id===c.edge);u&&s.set(c.edge,u)}for(const[c,u]of s){const l=n.get(c);if(!l)continue;const p=l.parent,f=p&&typeof p.x=="number"&&typeof p.width=="number"?{x:p.x,y:p.y,width:p.width,height:p.height}:void 0,d=Nd(u,o,f,r.edges);d&&i.updateWaypoints(l,d)}}const Zw=10;function $d(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 jd(e,t){if(e.waypoints.length<2||e.endpoints.length!==2)return null;const n=t.shapes.filter(G=>G.type==="bpmn:Participant"&&G.container),i=t.shapes.find(G=>G.id===e.endpoints[0]),r=t.shapes.find(G=>G.id===e.endpoints[1]);if(!i||!r)return null;const o=$d(i,n),a=$d(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(G=>G.id!==o.id&&G.id!==a.id&&G.y>=c.y+c.height&&G.y+G.height<=u.y).sort((G,fe)=>G.y-fe.y);if(!l.length)return null;const p=l[0],f=l[l.length-1],d=(c.y+c.height+p.y)/2,h=(f.y+f.height+u.y)/2,m=s?d:h,g=s?h:d,R=e.waypoints[0],w=e.waypoints[e.waypoints.length-1],b=Ci(t),x=t.edges.filter(G=>G.id!==e.id),E=Ri(e,x),T=zn(e,b).length;if(E===0&&T===0)return null;const L=Math.min(...l.map(G=>G.x)),A=Math.max(...l.map(G=>G.x+G.width)),j=(R.x+w.x)/2,H=G=>G.filter((fe,Fe)=>Fe===0||!(Pt(fe.x,G[Fe-1].x)&&Pt(fe.y,G[Fe-1].y)));let N;for(let G=L;G<=A;G+=Zw){const fe=H([R,{x:R.x,y:m},{x:G,y:m},{x:G,y:g},{x:w.x,y:g},w]),Fe={...e,waypoints:fe};if(zn(Fe,b).length>0)continue;const lt=Ri(Fe,x),Y=Math.abs(G-j);(!N||lt<N.cross||lt===N.cross&&Y<N.detour)&&(N={pts:fe,cross:lt,detour:Y})}return N&&(T>0?N.cross<=E:N.cross<E)?N.pts:null}function Fd(e,t){const{elementRegistry:n}=e,i=e.modeling,r=Ut(n);for(const o of r.edges){if(o.type!=="bpmn:MessageFlow"||t.has(o.id))continue;const a=Ut(n),s=a.edges.find(l=>l.id===o.id);if(!s)continue;const c=jd(s,a);if(!c)continue;const u=n.get(o.id);u&&i.updateWaypoints(u,c)}}const oo=[25,-25,40,-40],ls=35;function Hd(e,t){if(e.type!=="bpmn:SequenceFlow")return[];const n=t.get(e.endpoints[0]??""),i=t.get(e.endpoints[1]??"");if(!n||!i)return[];if(i.x+i.width>n.x)return[];const r=n.y+n.height/2;if(r>=i.y&&r<=i.y+i.height)return[];const o=i.x+i.width/2,a=n.x+n.width/2,s=r<i.y,c=s?i.y:i.y+i.height,u=s?n.y:n.y+n.height,l=s?n.y-ls:n.y+n.height+ls,p=[];for(const w of[0,...oo]){if(Math.abs(w)>=i.width/2-5)continue;const b=o+w;p.push({pts:[{x:n.x,y:r},{x:b,y:r},{x:b,y:c}],cost:Math.abs(w)});for(const x of[0,...oo]){if(Math.abs(x)>=n.width/2-5)continue;const E=a+x;p.push({pts:[{x:E,y:u},{x:E,y:l},{x:b,y:l},{x:b,y:c}],cost:Math.abs(w)+Math.abs(x)})}}const f=50,d=i.y+i.height/2,h=s?n.y+n.height:n.y;for(const w of[0,...oo]){if(Math.abs(w)>=n.width/2-5)continue;const b=a+w;p.push({pts:[{x:b,y:h},{x:b,y:d},{x:i.x+i.width,y:d}],cost:f+Math.abs(w)})}const m=60,g=s?i.y+i.height:i.y,R=s?i.y+i.height+ls:i.y-ls;for(const w of[0,...oo]){if(Math.abs(w)>=i.width/2-5)continue;const b=o+w;for(const x of[0,...oo]){if(Math.abs(x)>=n.width/2-5)continue;const E=a+x;p.push({pts:[{x:E,y:h},{x:E,y:R},{x:b,y:R},{x:b,y:g}],cost:m+Math.abs(w)+Math.abs(x)})}}return p}const ps=30;function zd(e,t){for(let n=1;n<e.length-2;n++){const i=e[n],r=e[n+1],o=Pt(i.y,r.y)&&!Pt(i.x,r.x),a=Pt(i.x,r.x)&&!Pt(i.y,r.y);if(!(!o&&!a))for(const s of t)if(o){const c=Math.min(i.x,r.x);if(Math.max(i.x,r.x)<=s.x||c>=s.x+s.width)continue;if(Math.abs(i.y-s.y)<ps||Math.abs(i.y-(s.y+s.height))<ps)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)<ps||Math.abs(i.x-(s.x+s.width))<ps)return!0}}return!1}const fs=40;function Qw(e,t,n){let i=0;for(const r of t){if(r.container||n.includes(r.id))continue;const o=r.x-fs,a=r.x+r.width+fs,s=r.y-fs,c=r.y+r.height+fs;for(let u=1;u<e.length-2;u++){const l=e[u],p=e[u+1],f={x:Math.min(l.x,p.x),y:Math.min(l.y,p.y)},d={x:Math.max(l.x,p.x),y:Math.max(l.y,p.y)};if(f.x<a&&d.x>o&&f.y<c&&d.y>s){i++;break}}}return i}function Vd(e,t){if(e.type!=="bpmn:SequenceFlow")return null;const n=t.shapes.filter(w=>w.container),i=new Map(t.shapes.map(w=>[w.id,w])),r=Ci(t),o=t.edges.filter(w=>w.id!==e.id),a=Tr(e,o),s=Ri(e,o),c=w=>Qw(w,t.shapes,e.endpoints)+(zd(w,n)?1:0),u=c(e.waypoints),l=w=>{if(!w)return;const b=w.x+w.width/2,x=w.y+w.height/2;return n.find(E=>E.type==="bpmn:Lane"&&b>=E.x&&b<=E.x+E.width&&x>=E.y&&x<=E.y+E.height)},p=l(i.get(e.endpoints[0]??"")),f=l(i.get(e.endpoints[1]??"")),d=!!p&&!!f&&p.id!==f.id,h=w=>{if(!d||!f)return!1;for(let b=1;b<w.length-2;b++){const x=w[b],E=w[b+1];if(Pt(x.y,E.y)&&!Pt(x.x,E.x)&&x.y>f.y&&x.y<f.y+f.height)return!0}return!1},m=h(e.waypoints);if(!zd(e.waypoints,n)&&!(d&&!m))return null;const g=w=>w.reduce((b,x,E)=>E?b+Math.abs(x.x-w[E-1].x)+Math.abs(x.y-w[E-1].y):0,0);let R;for(const{pts:w,cost:b}of Hd(e,i)){const x={...e,waypoints:w};if(zn(x,r).length>0||Tr(x,o)>a||Ri(x,o)>s)continue;const E=c(w),T=h(w);if(!(T&&!m)&&E>=u)continue;const A=T?0:1,j=g(w);(!R||A<R.lane||A===R.lane&&(E<R.sc||E===R.sc&&(b<R.cost||b===R.cost&&j<R.len)))&&(R={pts:w,sc:E,lane:A,cost:b,len:j})}return(R==null?void 0:R.pts)??null}function Jw(e,t){const{elementRegistry:n}=e,i=e.modeling,r=Ut(n).edges.filter(o=>!t.has(o.id)&&o.waypoints.length>=4).map(o=>o.id).sort();for(const o of r){const a=Ut(n),s=a.edges.find(d=>d.id===o);if(!s||s.waypoints.length<4)continue;const c=Ci(a),u=a.edges.filter(d=>d.id!==o),l=zn(s,c).length,p=Tr(s,u),f=Ri(s,u);for(const d of Gu(s,a.shapes)){if(d.length>=s.waypoints.length)continue;const h={...s,waypoints:d};if(zn(h,c).length>l||Tr(h,u)>p||Ri(h,u)>f)continue;const m=n.get(o);m&&i.updateWaypoints(m,d);break}}}function Gd(e,t){const{elementRegistry:n}=e,i=e.modeling,r=Ut(n).edges.filter(o=>o.type==="bpmn:SequenceFlow"&&!t.has(o.id)).map(o=>o.id).sort();for(const o of r){const a=Ut(n),s=a.edges.find(l=>l.id===o);if(!s)continue;const c=Vd(s,a);if(!c)continue;const u=n.get(o);u&&i.updateWaypoints(u,c)}}function eE(e,t){const n=e.waypoints;if(n.length<3)return[];const i=[],r=t.get(e.endpoints[0]??""),o=t.get(e.endpoints[1]??""),a=Pt(n[0].x,n[1].x)&&!Pt(n[0].y,n[1].y),s=Pt(n[n.length-1].x,n[n.length-2].x)&&!Pt(n[n.length-1].y,n[n.length-2].y);for(const c of oo){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 Wd(e,t){const n=new Map(t.shapes.map(l=>[l.id,l])),i=Ci(t),r=t.edges.filter(l=>l.id!==e.id),o=Tr(e,r);if(o===0)return null;const a=Ri(e,r);let s;const c=l=>l.reduce((p,f,d)=>d?p+Math.abs(f.x-l[d-1].x)+Math.abs(f.y-l[d-1].y):0,0),u=[...Hd(e,n),...eE(e,n)];for(const{pts:l,cost:p}of u){const f={...e,waypoints:l};if(zn(f,i).length>0)continue;const d=Tr(f,r),h=Ri(f,r);if(d>=o||h-a>o-d)continue;const m=c(l);(!s||d<s.opposite||d===s.opposite&&(h<s.cross||h===s.cross&&(p<s.cost||p===s.cost&&m<s.len)))&&(s={pts:l,opposite:d,cross:h,cost:p,len:m})}return(s==null?void 0:s.pts)??null}function Ud(e,t,n){const{elementRegistry:i}=e,r=e.modeling,o=Ut(i),a=qi(o).filter(l=>(l.kind==="edge-overlap-opposite"||l.kind==="edge-overlap-mixed")&&!t.has(Yi(l)));if(!a.length)return;const s=new Set;for(const l of a)if(!(l.kind!=="edge-overlap-opposite"&&l.kind!=="edge-overlap-mixed"))for(const p of l.edges)n.has(p)||s.add(p);const c=l=>{var p;return((p=o.edges.find(f=>f.id===l))==null?void 0:p.type)??""},u=[...s].sort((l,p)=>{const f=c(l)==="bpmn:SequenceFlow"?0:1,d=c(p)==="bpmn:SequenceFlow"?0:1;return f!==d?f-d:l.localeCompare(p)});for(const l of u){const p=Ut(i),f=p.edges.find(m=>m.id===l);if(!f)continue;const d=Wd(f,p);if(!d)continue;const h=i.get(l);h&&r.updateWaypoints(h,d)}}const tE=10,nE=(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 Yd(e,t){const n=e.label;if(!n)return null;const i=t.edges.filter(a=>a.id!==e.id);if(!ss(e,i))return null;const r=Ci(t),o=i.flatMap(hn);for(const a of hn(e)){let s=[[a.lo,a.hi]];for(const[d,h]of as(a,o))s=s.flatMap(([m,g])=>{const R=[];return d>m&&R.push([m,Math.min(g,d)]),h<g&&R.push([Math.max(m,h),g]),R.filter(([w,b])=>b>w)});const c=a.axis==="h"?n.width:n.height,u=s.find(([d,h])=>h-d>=c+tE*2);if(!u)continue;const l=(u[0]+u[1])/2,p=a.axis==="h"?{x:l,y:a.at-bd}:{x:a.at+Rn+n.width/2,y:l},f={x:p.x-n.width/2,y:p.y-n.height/2,width:n.width,height:n.height};if(!ss({...e,label:f},i)&&!r.some(d=>!e.endpoints.includes(d.id)&&nE(f,d)))return f}return null}const Rn=8;function qd(e,t){const n=e.label;if(!n)return null;const i=hn(e);if(!i.length)return null;const r=n.x+n.width/2,o=n.y+n.height/2,a=f=>{const d=f.axis==="h"?r:o,h=f.axis==="h"?o-f.at:r-f.at,m=d<f.lo?f.lo-d:d>f.hi?d-f.hi:0;return Math.hypot(h,m)},s=i.reduce((f,d)=>a(d)<a(f)?d:f,i[0]),c=[...i,...t.edges.filter(f=>f.id!==e.id).flatMap(hn),...t.shapes.filter(f=>f.container).flatMap(Wo)],u=f=>!c.some(d=>Si(f,d));if(u(n))return null;const l=(s.axis==="v"?n.height:n.width)+Rn,p=[0,-l,l,-2*l,2*l];if(s.axis==="v")for(const f of[s.at+Rn,s.at-Rn-n.width])for(const d of p){const h=n.y+d;if(h<s.lo||h+n.height>s.hi)continue;const m={...n,x:f,y:h};if(u(m))return m}else for(const f of[s.at-Rn-n.height,s.at+Rn])for(const d of p){const h=n.x+d;if(h<s.lo||h+n.width>s.hi)continue;const m={...n,x:h,y:f};if(u(m))return m}return null}function Kd(e,t){const{elementRegistry:n}=e,i=e.modeling,r=Ut(n);for(const o of r.edges){if(!o.label||t.has(o.id))continue;const a=qd(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 Xd(e,t,n){const{elementRegistry:i}=e,r=e.modeling,o=Ut(i),a=qi(o).filter(s=>s.kind==="label-on-shared-segment"&&!t.has(Yi(s)));for(const s of a){if(s.kind!=="label-on-shared-segment"||n.has(s.edge))continue;const c=o.edges.find(f=>f.id===s.edge);if(!c)continue;const u=Yd(c,o);if(!u)continue;const l=i.get(s.edge),p=l==null?void 0:l.label;p&&r.moveElements([p],{x:u.x-p.x,y:u.y-p.y})}}function Zd(e,t){const n=e.label;if(!n)return null;const i=[...t.edges.flatMap(hn),...t.shapes.filter(f=>f.container).flatMap(Wo)],r=i.filter(f=>Si(n,f));if(!r.length)return null;const o=t.shapes.filter(f=>!f.container&&f.id!==e.id),a=Uo(t).filter(f=>f.owner!==e.id).map(f=>f.rect),s=(f,d)=>f.x<d.x+d.width&&d.x<f.x+f.width&&f.y<d.y+d.height&&d.y<f.y+f.height,c=f=>!i.some(d=>Si(f,d))&&!o.some(d=>s(f,d))&&!a.some(d=>s(f,d)),u=[];for(const f of r)f.axis==="h"?u.push({...n,y:f.at-Rn-n.height},{...n,y:f.at+Rn}):u.push({...n,x:f.at-Rn-n.width},{...n,x:f.at+Rn});const l=e.x+e.width/2,p=e.y+e.height/2;return u.push({...n,x:l-n.width/2,y:e.y+e.height+Rn},{...n,x:l-n.width/2,y:e.y-Rn-n.height},{...n,x:e.x+e.width+Rn,y:p-n.height/2},{...n,x:e.x-Rn-n.width,y:p-n.height/2}),u.find(c)??null}function Qd(e,t){const{elementRegistry:n}=e,i=e.modeling,r=Ut(n);for(const o of r.shapes){if(o.container||!o.label||t.has(o.id))continue;const a=Zd(o,Ut(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 iE=/^[\p{L}_][\p{L}\p{N}_.\-]*$/u,Jd=new Set(["sequenceFlow","messageFlow","dataAssociation","association"]),eh={"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}]},ds=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),Wu=e=>typeof e=="string"&&e!=="";function rE(e){const t=[];function n(i,r,o,a){if(a===null){Wu(o)||t.push({kind:"payload-invalid",opIndex:i,field:r});return}if(!ds(o)){t.push({kind:"payload-invalid",opIndex:i,field:r});return}for(const s of a)Wu(o[s])||t.push({kind:"payload-invalid",opIndex:i,field:`${r}.${s}`})}return e.forEach((i,r)=>{if(!ds(i)||!Wu(i.kind)||!(i.kind in eh)){t.push({kind:"payload-invalid",opIndex:r,field:"kind"});return}for(const o of eh[i.kind]){const a=o.path.endsWith("[]"),s=a?o.path.slice(0,-2):o.path,c=s.split(".");let u=i;for(const p of c.slice(0,-1)){if(!ds(u))break;u=u[p]}if(!ds(u))continue;const l=u[c[c.length-1]];if(!(l===void 0&&o.optional)&&!(l===null&&o.optional)){if(!a){n(r,o.path,l,o.shape);continue}if(!Array.isArray(l)){t.push({kind:"payload-invalid",opIndex:r,field:o.path});continue}l.forEach((p,f)=>n(r,`${s}[${f}]`,p,o.shape))}}if(i.kind==="node.add"){const o=i.band;o!==void 0&&(!Number.isInteger(o)||o<0)&&t.push({kind:"payload-invalid",opIndex:r,field:"band"})}}),t}function th(e,t){const n=rE(e);if(n.length>0)return n;const i=[],r=new Map,o=new Map;function a(f,d,h){if(!iE.test(d)){i.push({kind:"id-invalid",opIndex:f,id:d});return}if(t.categoryOf(d)!==void 0||r.has(d)){i.push({kind:"id-duplicate",opIndex:f,id:d});return}r.set(d,{...h,opIndex:f})}e.forEach((f,d)=>{var h;switch(f.kind){case"participant.add":a(d,f.participant.id,{category:"participant",lanes:(f.participant.lanes??[]).map(m=>m.id)});for(const m of f.participant.lanes??[])a(d,m.id,{category:"lane"});break;case"node.add":a(d,f.node.id,{category:"flowNode",participant:f.node.participant});break;case"sequenceFlow.add":a(d,f.flow.id,{category:"sequenceFlow"});break;case"messageFlow.add":a(d,f.flow.id,{category:"messageFlow"});break;case"dataStore.add":a(d,f.dataStore.id,{category:"dataStore"});for(const m of f.associations??[])m.id&&a(d,m.id,{category:"dataAssociation"});break;case"dataAssociation.add":f.association.id&&a(d,f.association.id,{category:"dataAssociation"});break;case"association.add":f.association.id&&a(d,f.association.id,{category:"association"});break;case"annotation.add":a(d,f.annotation.id,{category:"annotation"}),(h=f.association)!=null&&h.id&&a(d,f.association.id,{category:"association"});break;case"group.add":a(d,f.group.id,{category:"group"});break;case"participant.update":if(f.lanes){o.set(f.id,f.lanes.map(m=>m.id));for(const m of f.lanes)t.categoryOf(m.id)===void 0&&a(d,m.id,{category:"lane"})}break}});const s=f=>{var d;return((d=r.get(f))==null?void 0:d.category)??t.categoryOf(f)},c=f=>{const d=r.get(f);return d?d.category==="participant"?f:d.participant:t.categoryOf(f)==="participant"?f:t.participantOf(f)};function u(f,d,h,m){const g=s(d);if(g===void 0){i.push({kind:"ref-missing",opIndex:f,ref:d,role:h});return}if(m&&!m.includes(g)){i.push({kind:"ref-category",opIndex:f,ref:d,role:h,expected:m.join("|"),actual:g});return}return g}const l=t.isCollaboration()||e.some(f=>f.kind==="participant.add");return e.forEach((f,d)=>{var h;switch(f.kind){case"participant.add":break;case"node.add":{const{participant:m,lane:g}=f.node;if(m===void 0){(l||g!==void 0)&&i.push({kind:"participant-required",opIndex:d,id:f.node.id});break}if(u(d,m,"participant",["participant"])===void 0)break;g!==void 0&&((((h=r.get(m))==null?void 0:h.lanes)??o.get(m)??t.lanesOf(m)).includes(g)||i.push({kind:"lane-unknown",opIndex:d,lane:g,participant:m}));break}case"sequenceFlow.add":{const{id:m,source:g,target:R,name:w,condition:b}=f.flow,x=u(d,g,"source",["flowNode"]),E=u(d,R,"target",["flowNode"]);x&&E&&c(g)!==c(R)&&i.push({kind:"flow-cross-pool",opIndex:d,id:m}),w!==void 0&&b!==void 0&&i.push({kind:"condition-name-conflict",opIndex:d,id:m});break}case"messageFlow.add":{const{id:m,source:g,target:R}=f.flow,w=u(d,g,"source",["flowNode","participant"]),b=u(d,R,"target",["flowNode","participant"]);if(w&&b){const x=c(g),E=c(R);x!==void 0&&x===E&&i.push({kind:"message-flow-same-pool",opIndex:d,id:m})}break}case"dataStore.add":{for(const m of f.associations??[]){if([m.source,m.target].filter(w=>w===f.dataStore.id).length!==1){i.push({kind:"data-association-ends",opIndex:d,source:m.source,target:m.target});continue}const R=m.source===f.dataStore.id?m.target:m.source;u(d,R,"dataAssociation",["flowNode"])}break}case"dataAssociation.add":{const{source:m,target:g}=f.association,R=u(d,m,"source"),w=u(d,g,"target");if(R&&w){const b=new Set([R,w]);b.has("dataStore")&&b.has("flowNode")||i.push({kind:"data-association-ends",opIndex:d,source:m,target:g})}break}case"association.add":{const{id:m,source:g,target:R}=f.association,w=u(d,g,"source"),b=u(d,R,"target");w&&b&&w!=="annotation"&&b!=="annotation"&&i.push({kind:"association-detached",opIndex:d,annotation:m??`${g}->${R}`});break}case"annotation.add":{if(f.association){const{source:m,target:g}=f.association;if(m!==f.annotation.id&&g!==f.annotation.id)i.push({kind:"association-detached",opIndex:d,annotation:f.annotation.id});else{const R=m===f.annotation.id?g:m;u(d,R,"association")}}f.placement&&u(d,f.placement.anchor,"anchor");break}case"group.add":{for(const m of f.group.members??[]){const g=u(d,m,"member");g&&Jd.has(g)&&i.push({kind:"ref-category",opIndex:d,ref:m,role:"member",expected:"shape",actual:g})}break}case"participant.update":{if(p(d,f.id,"participant")===void 0)break;if(f.lanes){const m=t.lanesOf(f.id),g=f.lanes.map(w=>w.id);for(const w of m)g.includes(w)||i.push({kind:"lane-shrink-unsupported",opIndex:d,participant:f.id,lane:w});for(const w of g)t.categoryOf(w)!==void 0&&!m.includes(w)&&i.push({kind:"id-duplicate",opIndex:d,id:w});const R=g.filter(w=>m.includes(w));R.length===m.length&&R.some((w,b)=>w!==m[b])&&i.push({kind:"lane-reorder-unsupported",opIndex:d,participant:f.id})}break}case"node.update":{if(p(d,f.id,"flowNode")===void 0)break;if(f.lane!==void 0){const m=t.participantOf(f.id);(m?o.get(m)??t.lanesOf(m):[]).includes(f.lane)||i.push({kind:"lane-unknown",opIndex:d,lane:f.lane,participant:m??""})}break}case"sequenceFlow.update":{if(p(d,f.id,"sequenceFlow")===void 0)break;if(f.name!==void 0&&f.condition!==void 0&&i.push({kind:"condition-name-conflict",opIndex:d,id:f.id}),f.source!==void 0||f.target!==void 0){const m=f.source===void 0||u(d,f.source,"source",["flowNode"])!==void 0,g=f.target===void 0||u(d,f.target,"target",["flowNode"])!==void 0,R=t.endpointsOf(f.id),w=f.source??(R==null?void 0:R.source),b=f.target??(R==null?void 0:R.target);m&&g&&w!==void 0&&b!==void 0&&new Set([c(w),c(b),c(f.id)]).size>1&&i.push({kind:"flow-cross-pool",opIndex:d,id:f.id})}break}case"messageFlow.update":p(d,f.id,"messageFlow");break;case"dataStore.update":p(d,f.id,"dataStore");break;case"annotation.update":{if(p(d,f.id,"annotation")===void 0)break;f.placement&&u(d,f.placement.anchor,"anchor");break}case"group.update":{if(p(d,f.id,"group")===void 0)break;for(const m of f.members??[]){const g=u(d,m,"member");g&&Jd.has(g)&&i.push({kind:"ref-category",opIndex:d,ref:m,role:"member",expected:"shape",actual:g})}break}case"element.remove":{p(d,f.id)==="lane"&&i.push({kind:"ref-category",opIndex:d,ref:f.id,role:"target",expected:"removable",actual:"lane"});break}}}),i;function p(f,d,h){if(r.has(d)){i.push({kind:"target-added-in-batch",opIndex:f,id:d});return}const m=t.categoryOf(d);if(m===void 0){i.push({kind:"ref-missing",opIndex:f,ref:d,role:"target"});return}if(h&&m!==h){i.push({kind:"ref-category",opIndex:f,ref:d,role:"target",expected:h,actual:m});return}return m}}function nh(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 hs(e){return`bpmn:${e[0].toUpperCase()}${e.slice(1)}`}const Uu={"top-left":[-1,-1],top:[0,-1],"top-right":[1,-1],right:[1,0],"bottom-right":[1,1],bottom:[0,1],"bottom-left":[-1,1],left:[-1,0]};function Xt(e,t){return e.filter(n=>n.kind===t)}function ih(e,t){var wx,Ex,Sx,Rx,Cx,Px;const{modeling:n,bpmnFactory:i,elementFactory:r,elementRegistry:o,canvas:a,autoPlace:s,bpmnReplace:c}=t,u=()=>a.getRootElement(),l=S=>o.get(S),p=S=>{const P=l(S);if(!P)throw new Error(`하강 참조 해소 실패: ${S}`);return P},f=S=>{let P=S.parent;for(;P;){if(P.type==="bpmn:Participant")return P;P=P.parent}},d=Xt(e,"participant.add"),h=Xt(e,"node.add"),m=Xt(e,"sequenceFlow.add"),g=Xt(e,"messageFlow.add"),R=Xt(e,"dataStore.add"),w=Xt(e,"dataAssociation.add"),b=Xt(e,"annotation.add"),x=Xt(e,"group.add"),E=new Map(h.map(S=>[S.node.id,S])),T=(S,P,k)=>{var pe;const z=S.businessObject,V=(((pe=z.extensionElements)==null?void 0:pe.values)??[]).filter(J=>J.$type!==P),B=k?[...V,i.create(P,k)]:V;if(!B.length){z.extensionElements&&n.updateProperties(S,{extensionElements:void 0});return}const K=i.create("bpmn:ExtensionElements",{values:B});B.forEach(J=>{J.$parent=K}),n.updateProperties(S,{extensionElements:K})},L=S=>({anchor:S.anchor,side:S.side,...S.offset!==void 0?{offset:S.offset}:{}});for(const S of Xt(e,"element.remove")){const P=l(S.id);P&&n.removeElements([P])}const A=S=>o.filter(P=>{var k;return P.type==="bpmn:Lane"&&((k=f(P))==null?void 0:k.id)===S}).sort((P,k)=>P.y-k.y);for(const S of Xt(e,"participant.update")){const P=p(S.id);if(S.name!==void 0&&n.updateProperties(P,{name:S.name??void 0}),!S.lanes)continue;const k=A(S.id);if(!k.length){n.splitLane(P,S.lanes.length),A(S.id).forEach((V,B)=>{const K=S.lanes[B];K&&n.updateProperties(V,{id:K.id,name:K.name})});continue}const z=new Set(k.map(V=>V.id));S.lanes.forEach((V,B)=>{if(z.has(V.id)){n.updateProperties(p(V.id),{name:V.name});return}const K=B===0?n.addLane(A(S.id)[0],"top"):n.addLane(p(S.lanes[B-1].id),"bottom");n.updateProperties(K,{id:V.id,name:V.name})})}const j=150,H=130,N=80,G=90,fe=180,Fe=new Set;for(const S of d){Fe.add(`pool:${S.participant.id}`);for(const P of S.participant.lanes??[])Fe.add(P.id)}const lt=new Map;for(const S of h){const P=S.node.lane??`pool:${S.node.participant??""}`;let k=lt.get(P);k||lt.set(P,k=new Set([0])),S.band!==void 0&&k.add(S.band)}const Y=new Map;for(const[S,P]of lt){if(!Fe.has(S))continue;const k=[...P].sort((B,K)=>B-K),z=k.map((B,K)=>K===0?0:K%2===1?Math.ceil(K/2):-(K/2)),V=Math.min(...z);Y.set(S,new Map(k.map((B,K)=>[B,z[K]-V])))}{const S=new Map;for(const P of d)(P.participant.lanes??[]).forEach((k,z)=>S.set(k.id,z));for(const[P,k]of Y){if(!S.has(P)||k.size<2)continue;const z=S.get(P),V=k.get(0)??0,B=new Set;for(const Ne of h){if(Ne.node.lane!==P||(Ne.band??0)!==0||!Ne.node.type.endsWith("Gateway"))continue;const Te={in:new Set,out:new Set,cross:new Set};for(const ve of m){const nt=ve.flow.source===Ne.node.id;if(!nt&&ve.flow.target!==Ne.node.id)continue;const Bt=E.get(nt?ve.flow.target:ve.flow.source);if(!Bt||Bt.node.participant!==Ne.node.participant||!Bt.node.lane)continue;let Et,pt=!1;if(Bt.node.lane!==P){const Fn=S.get(Bt.node.lane);if(Fn===void 0)continue;Et=Fn>z?"down":"up",pt=!0}else{const Fn=k.get(Bt.band??0)??V;Et=Fn>V?"down":Fn<V?"up":void 0}Et&&(Te[nt?"out":"in"].add(Et),pt&&Te.cross.add(Et))}for(const ve of["up","down"])Te.in.has(ve)&&Te.out.has(ve)&&Te.cross.has(ve)&&B.add(ve)}if(B.size!==1)continue;const[K]=B,pe=Math.max(...k.values()),J=K==="down"?pe:0;if(V===J)continue;const ue=[...k.entries()].filter(([Ne])=>Ne!==0).sort((Ne,Te)=>Ne[1]-Te[1]),Ye=[...Array(pe+1).keys()].filter(Ne=>Ne!==J),ct=new Map([[0,J]]);ue.forEach(([Ne],Te)=>ct.set(Ne,Ye[Te])),Y.set(P,ct)}}const de=S=>{var P;return(((P=lt.get(S))==null?void 0:P.size)??0)>1},he=S=>S.band??(S.node.lane||!de(`pool:${S.node.participant??""}`)?void 0:0),se=new Map,ce=S=>se.get(S.node.id)??he(S),ee=new Set,F=new Set;{const S=new Map;for(const z of m)S.set(z.flow.target,(S.get(z.flow.target)??0)+1);const P=z=>{const V=[],B=new Set([z]),K=[z];for(;K.length;){const pe=K.shift();V.push(pe);for(const J of m)J.flow.source!==pe||B.has(J.flow.target)||(S.get(J.flow.target)??0)!==1||(B.add(J.flow.target),K.push(J.flow.target))}return V},k=(z,V)=>{var B;return((B=Y.get(z))==null?void 0:B.get(V))??V};for(const z of h){if(!z.node.type.endsWith("Gateway"))continue;const V=z.node.lane??`pool:${z.node.participant??""}`,B=Y.get(V);if(!B||B.size<2)continue;const K=ce(z);if(K===void 0||k(V,K)!==k(V,0))continue;const pe=k(V,K),J=m.filter(ve=>ve.flow.source===z.node.id).map(ve=>E.get(ve.flow.target)).filter(ve=>!!ve&&(ve.node.lane??`pool:${ve.node.participant??""}`)===V),ue=J.filter(ve=>{const nt=ce(ve);return nt!==void 0&&k(V,nt)===pe&&(S.get(ve.node.id)??0)===1}),Ye=J.some(ve=>{const nt=ce(ve);return nt!==void 0&&k(V,nt)>pe});if(ue.length!==1||!Ye)continue;const ct=new Set(J.flatMap(ve=>P(ve.node.id)));if(!m.some(ve=>ve.flow.target===z.node.id&&ct.has(ve.flow.source)))continue;const Te=new Map;for(const[ve,nt]of B)Te.set(ve,nt+1);Te.set(-1,0),Y.set(V,Te);for(const ve of P(ue[0].node.id))E.has(ve)&&(se.set(ve,-1),F.add(ve));ee.add(z.node.id)}}const $=(S,P)=>{var k;return((k=Y.get(S))==null?void 0:k.get(P))??P},U=new Map;for(const[S,P]of lt){let k=0;for(const z of P)k=Math.max(k,$(S,z));U.set(S,k)}const ke=S=>fe+j*S,Lt=d.map((S,P)=>({op:S,declared:P}));Lt.sort((S,P)=>{const k=S.op.order??Number.POSITIVE_INFINITY,z=P.op.order??Number.POSITIVE_INFINITY;return k!==z?k-z:S.declared-P.declared});let C=80;for(const S of o.getAll())S.parent===u()&&"height"in S&&typeof S.y=="number"&&(C=Math.max(C,S.y+S.height+60));for(const{op:S}of Lt){const P=S.participant,k=h.filter(Ne=>Ne.node.participant===P.id).length,z=((wx=P.lanes)==null?void 0:wx.length)??0,V=Math.max(1200,k*160+300),B=(P.lanes??[]).map(Ne=>ke(U.get(Ne.id)??0)),K=B.reduce((Ne,Te)=>Ne+Te,0);z&&K<300&&(B[z-1]+=300-K);const pe=Math.max(300,j*((U.get(`pool:${P.id}`)??0)+1)),J=P.blackBox||k+z===0?120:z?Math.max(300,K):pe,ue=r.createShape({type:"bpmn:Participant",businessObject:i.create("bpmn:Participant",{id:P.id,name:P.name,...S.order!==void 0?{"bwl:poolOrder":S.order}:{},...P.blackBox?{}:{processRef:i.create("bpmn:Process")}}),width:V,height:J,isExpanded:!0}),Ye=n.createShape(ue,{x:100+V/2,y:C+J/2},u()),ct=P.lanes??[];if(ct.length&&n.splitLane(Ye,ct.length),ct.length){const Ne=o.filter(Te=>{var ve;return Te.type==="bpmn:Lane"&&((ve=f(Te))==null?void 0:ve.id)===P.id}).sort((Te,ve)=>Te.y-ve.y);if(Ne.forEach((Te,ve)=>{const nt=ct[ve];nt&&n.updateProperties(Te,{id:nt.id,name:nt.name})}),B.some(Te=>Te!==Ye.height/z)){let Te=Ye.y;Ne.forEach((ve,nt)=>{const Bt=B[nt];n.resizeShape(ve,{x:ve.x,y:Te,width:ve.width,height:Bt}),Te+=Bt})}}C=Ye.y+Ye.height+60}const _=S=>{var z;const P=E.get(S);if(P)return P.node.participant??"";const k=l(S);return k?k.type==="bpmn:Participant"?k.id:((z=f(k))==null?void 0:z.id)??"":""},y=new Map,D=S=>{let P=y.get(S);return P||y.set(S,P={nodes:[],flows:[]}),P};for(const S of h)D(S.node.participant??"").nodes.push(S);for(const S of m)D(_(S.flow.source)).flows.push(S);const I=S=>{var P;return i.create("bpmn:SequenceFlow",{id:S.id,name:S.name??((P=S.condition)==null?void 0:P.label)})},W=(S,P)=>r.createShape({type:hs(S.type),businessObject:i.create(hs(S.type),{id:S.id,name:S.name,...P!==void 0?{"bwl:band":P}:{}})}),oe=[...Lt.map(({op:S})=>S.participant.id).filter(S=>y.has(S)),...[...y.keys()].filter(S=>!d.some(P=>P.participant.id===S))],Pe=S=>S.endsWith("Gateway");for(const S of oe){const P=y.get(S),k=S?p(S):void 0,z=k?k.x+150:250;let V=k?k.y+80:120;const B=(ne,ge,le)=>{const Ze=u().children.filter(qe=>!("waypoints"in qe&&qe.waypoints)&&qe.id!==ge&&typeof qe.y=="number"&&qe.y>=ne);Ze.length&&n.moveElements(Ze,{x:0,y:le})},K=(ne,ge)=>{if(ne){const Ae=p(ne),Ke=ke(ge);if(Ae.height>=Ke)return;const Vt=Ke-Ae.height,ae=f(Ae),We=ae?ae.y+ae.height:Ae.y+Ae.height;n.resizeLane(Ae,{x:Ae.x,y:Ae.y,width:Ae.width,height:Ke},!1),B(We,ae==null?void 0:ae.id,Vt);return}if(!k)return;const le=j*(ge+1);if(k.height>=le)return;const Ze=le-k.height,qe=k.y+k.height;n.resizeShape(k,{x:k.x,y:k.y,width:k.width,height:le}),B(qe,k.id,Ze)},pe=(ne,ge,le)=>{if(ne){const Ze=p(ne);return Ze.y+Math.min(Ze.height/2,G)+$(ne,ge??0)*j}return ge!==void 0&&k?k.y+N+$(`pool:${S}`,ge)*j:le},J=(ne,ge,le)=>{if(ne){const Ze=p(ne);return Ze.y+Math.min(Ze.height/2,G)+ge*j}return k?k.y+N+ge*j:le},ue=ne=>ne.participant?p(ne.participant):u(),Ye=30,ct=(ne,ge,le,Ze)=>{const qe=le-ge.width/2,Ae=Ze-ge.height/2;return(ne.children??[]).find(Ke=>!("waypoints"in Ke&&Ke.waypoints)&&Ke.type!=="bpmn:Lane"&&Ke.type!=="label"&&typeof Ke.x=="number"&&qe<Ke.x+Ke.width+Ye&&qe+ge.width+Ye>Ke.x&&Ae<Ke.y+Ke.height&&Ae+ge.height>Ke.y)},Ne=(ne,ge,le,Ze,qe,Ae)=>{const Ke=le!==void 0||Ze!==void 0,Vt=$(le??`pool:${S}`,Ze??0);if(Ke)for(let Le=0;Le<4;Le++){const Be=J(le,Vt+Le,Ae);if(!ct(ne,ge,qe,Be))return K(le,Vt+Le),{x:qe,y:Be}}const ae=pe(le,Ze,Ae);Ke&&K(le,Vt);let We=qe;for(let Le=0;Le<64;Le++){const Be=ct(ne,ge,We,ae);if(!Be)break;We=Be.x+Be.width+H+ge.width/2}return{x:We,y:ae}},Te=new Set(P.flows.map(ne=>ne.flow.target)),ve=new Map;for(const ne of P.nodes){if(Te.has(ne.node.id))continue;const ge=W(ne.node,ne.band),le=he(ne),Ze=ne.node.lane?`${ne.node.lane}|${le??""}`:le!==void 0?`band:${le}`:"",qe=ue(ne.node),Ae=Ne(qe,ge,ne.node.lane,le,ve.get(Ze)??z,V);n.createShape(ge,Ae,qe),ve.set(Ze,Ae.x+ge.width+H),!ne.node.lane&&le===void 0&&(V+=160)}const nt=new Set,Bt=new Map,Et=new Map,pt=new Map;if(S&&Fe.has(`pool:${S}`)){const ne=new Map;for(const ae of P.flows)ne.set(ae.flow.target,(ne.get(ae.flow.target)??0)+1);const ge=ae=>pe(ae.node.lane,ce(ae),Number.NaN),le=new Set,Ze=ae=>{var Be;const We=(Be=E.get(ae))==null?void 0:Be.node.participant;if(We)return l(We);const Le=l(ae);if(Le)return Le.type==="bpmn:Participant"?Le:f(Le)},qe=ae=>{const We=[],Le=new Set([ae]),Be=[ae];for(;Be.length;){const gt=Be.shift(),Qe=E.get(gt);Qe&&We.push(Qe);for(const Ee of P.flows)Ee.flow.source!==gt||Le.has(Ee.flow.target)||(ne.get(Ee.flow.target)??0)!==1||(Le.add(Ee.flow.target),Be.push(Ee.flow.target))}return We},Ae=ae=>{if(!k)return;const We=new Set(ae.map(gt=>gt.node.id));let Le=!1,Be=!1;for(const gt of g){if(!We.has(gt.flow.source))continue;const Qe=Ze(gt.flow.target);!Qe||Qe.id===k.id||(Qe.y<k.y?Le=!0:Be=!0)}return Le&&!Be?"up":Be&&!Le?"down":void 0};for(const ae of P.nodes){if(!Pe(ae.node.type))continue;const We=pe(ae.node.lane,he(ae),Number.NaN);if(Number.isNaN(We))continue;const Le=[];for(const Ee of P.flows){if(Ee.flow.source!==ae.node.id)continue;const ze=E.get(Ee.flow.target);if(!ze||ze.node.lane!==ae.node.lane||(ne.get(ze.node.id)??0)!==1)continue;const Je=he(ze);if(Je===void 0)continue;const yn=pe(ze.node.lane,Je,Number.NaN);if(Number.isNaN(yn))continue;const qr=qe(ze.node.id),Kt=Ae(qr);Kt&&Le.push({subtree:qr,band:Je,row:yn,dir:Kt})}if(!Le.some(Ee=>Ee.dir==="up")||!Le.some(Ee=>Ee.dir==="down")||!Le.some(Ee=>Ee.dir==="up"&&Le.some(ze=>ze.dir==="down"&&ze.row<Ee.row)))continue;const gt=[...Le].sort((Ee,ze)=>Ee.row-ze.row);[...Le.filter(Ee=>Ee.dir==="up"),...Le.filter(Ee=>Ee.dir==="down")].sort((Ee,ze)=>Ee.dir===ze.dir?Ee.row-ze.row:Ee.dir==="up"?-1:1).forEach((Ee,ze)=>{const Je=gt[ze].band;if(Je!==Ee.band){le.add(ae.node.id);for(const yn of Ee.subtree)he(yn)===Ee.band&&se.set(yn.node.id,Je)}})}const Ke=ae=>{if(!k)return;const We=new Set(ae.map(gt=>gt.node.id));let Le=!1,Be=!1;for(const gt of g){if(!We.has(gt.flow.target))continue;const Qe=Ze(gt.flow.source);!Qe||Qe.id===k.id||(Qe.y<k.y?Le=!0:Be=!0)}return Le&&!Be?"up":Be&&!Le?"down":void 0};for(const ae of P.nodes){if(!Pe(ae.node.type))continue;const We=ae.node.lane??`pool:${S}`,Le=Y.get(We);if(!Le||Le.size<2)continue;const Be=Le.get(0);if(Be===void 0)continue;const gt=Math.max(...Le.values()),Qe=Be===gt&&Be!==0?"down":void 0;if(!Qe)continue;const Ee=[];for(const Kt of P.flows){if(Kt.flow.source!==ae.node.id)continue;const ti=E.get(Kt.flow.target);if(!ti||ti.node.lane!==ae.node.lane||(ne.get(ti.node.id)??0)!==1)continue;const Ax=ce(ti);Ax!==void 0&&Ee.push({t:ti,subtree:qe(ti.node.id),band:Ax})}const ze=Ee.find(Kt=>(Le.get(Kt.band)??Kt.band)===Be);if(!ze||Ke(ze.subtree)===Qe||Ae(ze.subtree)===Qe)continue;const Je=Ee.find(Kt=>Kt!==ze&&Ke(Kt.subtree)===Qe);if(!Je)continue;const yn=ze.band,qr=Je.band;for(const Kt of ze.subtree)ce(Kt)===yn&&se.set(Kt.node.id,qr);for(const Kt of Je.subtree)ce(Kt)===qr&&se.set(Kt.node.id,yn);le.add(ae.node.id)}for(const ae of P.nodes){if(!Pe(ae.node.type))continue;const We=ge(ae);if(Number.isNaN(We)||b.some(Ee=>{var ze,Je;return(((ze=Ee.placement)==null?void 0:ze.anchor)??(Ee.association?Ee.association.source===Ee.annotation.id?Ee.association.target:Ee.association.source:void 0))===ae.node.id&&((Je=Ee.placement)==null?void 0:Je.side.startsWith("bottom"))}))continue;let Be,gt=!1,Qe;for(const Ee of P.flows){if(Ee.flow.source!==ae.node.id)continue;const ze=E.get(Ee.flow.target);if(!ze||!ze.node.lane&&he(ze)===void 0)continue;const Je=ge(ze);Number.isNaN(Je)||(Math.abs(Je-We)<.5&&(gt=!0),Je>We?!Be||Je>Be.row?Be={id:ze.node.id,row:Je,count:1}:Je===Be.row&&Be.count++:Je<We&&ze.node.lane===ae.node.lane&&(!Qe||Je>Qe.row?Qe={op:ze,row:Je,count:1}:Je===Qe.row&&Qe.count++))}Be&&Be.count===1&&(ne.get(Be.id)??0)===1&&!le.has(ae.node.id)&&nt.add(Be.id),!gt&&Qe&&Qe.count===1&&(ne.get(Qe.op.node.id)??0)===1&&!ee.has(ae.node.id)&&Bt.set(Qe.op.node.id,{lane:ae.node.lane,band:ce(ae)})}const Vt=new Map;for(const ae of g)Vt.set(ae.flow.target,[...Vt.get(ae.flow.target)??[],ae]);for(const ae of P.nodes){const We=Vt.get(ae.node.id);if(!We||We.length!==1||!ne.get(ae.node.id)||!ae.node.lane&&he(ae)===void 0||F.has(ae.node.id))continue;const Le=(Ex=E.get(We[0].flow.source))==null?void 0:Ex.node.participant,Be=Le?l(Le):void 0;if(!Be||!k||Be.id===k.id)continue;const gt=ae.node.lane??`pool:${S}`,Qe=Y.get(gt);if(!Qe)continue;const Ee=Qe.get(0)??0,ze=(Qe.get(ce(ae)??0)??Ee)-Ee;if(ze===0)continue;const Je=Be.y<k.y;if(Je&&ze<0||!Je&&ze>0)continue;let yn;for(const[qr,Kt]of Qe){const ti=Kt-Ee;(Je&&ti<0&&(!yn||ti<yn.row)||!Je&&ti>0&&(!yn||ti>yn.row))&&(yn={band:qr,row:ti})}yn&&Et.set(ae.node.id,{lane:ae.node.lane,band:yn.band})}}const Fn=new Set;let _u=0;for(;_u++<P.nodes.length+2;){for(let le=0;le<P.nodes.length+P.flows.length+2;le++){let Ze=!1;for(const qe of P.flows){const Ae=qe.flow;if(Fn.has(Ae.id))continue;const Ke=l(Ae.source);if(!Ke)continue;const Vt=l(Ae.target),ae=E.get(Ae.target);if(!Vt&&ae){const We=W(ae.node,ae.band),Le=ce(ae);if(ae.node.lane||Le!==void 0){const Be=ue(ae.node),gt=Ke,Qe=gt.x+(pt.get(Ae.source)??0)+gt.width+H,Ee=Bt.get(Ae.target)??Et.get(Ae.target),ze=Ne(Be,We,Ee?Ee.lane:ae.node.lane,Ee?Ee.band:Le,nt.has(Ae.target)?gt.x+gt.width/2:Qe,Number.NaN),Je=n.createShape(We,ze,Be);nt.has(Ae.target)&&pt.set(Ae.target,Qe-(Je.x+Je.width/2)),n.connect(Ke,Je,{type:"bpmn:SequenceFlow",businessObject:I(Ae)})}else s.append(Ke,We,{connection:{type:"bpmn:SequenceFlow",businessObject:I(Ae)}})}else if(Vt)n.connect(Ke,Vt,{type:"bpmn:SequenceFlow",businessObject:I(Ae)});else continue;Fn.add(Ae.id),Ze=!0}if(!Ze)break}const ne=P.nodes.filter(le=>!l(le.node.id));if(!ne.length)break;const ge=ne[0];{const le=W(ge.node,ge.band),Ze=ue(ge.node),qe=he(ge);n.createShape(le,Ne(Ze,le,ge.node.lane,qe,z,V),Ze),!ge.node.lane&&qe===void 0&&(V+=160)}}}const Ue=40,ft=(S,P=()=>!0)=>{const k=l(S);if(!k)return[];const z=[k],V=new Set([S]);for(let B=0;B<z.length;B++){const K=z[B].id;for(const pe of m){const J=pe.flow.target;if(pe.flow.source!==K||V.has(J)||!E.has(J))continue;V.add(J);const ue=l(J);ue&&P(ue)&&z.push(ue)}}return z},tt=(S,P=()=>!0)=>{const k=l(S);if(!k)return[];const z=[k],V=new Set([S]);for(let B=0;B<z.length;B++){const K=z[B].id;for(const pe of m){const J=pe.flow.source;if(pe.flow.target!==K||V.has(J)||!E.has(J))continue;V.add(J);const ue=l(J);ue&&P(ue)&&z.push(ue)}}return z};for(const S of Xt(e,"sequenceFlow.update")){if(S.target===void 0)continue;const P=E.get(S.target);if(!P)continue;const k=l(S.target),z=l(S.id);if(!k||!z)continue;const V=S.source!==void 0?l(S.source):z.source,B=z.target;if(!V||!B||B.id===k.id)continue;const K=ft(S.target),pe=new Set(K.map(Te=>Te.id)),J=Math.min(...K.map(Te=>Te.x)),ue=Math.max(...K.map(Te=>Te.x+Te.width)),Ye=V.x+V.width,ct=ue-J+Ue*2-(B.x-Ye);if(ct>0){const Te=f(k),ve=(Te==null?void 0:Te.children)??[],nt=pt=>pt.type==="bpmn:Lane",Bt=ve.filter(pt=>!("waypoints"in pt&&pt.waypoints)&&!nt(pt)&&!pe.has(pt.id)&&pt.x>=B.x),Et=Te?[Te,...ve.filter(pt=>nt(pt))]:[];Bt.length&&n.createSpace(Bt,Et,{x:ct,y:0},"e",B.x-1)}const Ne=P.node.lane||P.band!==void 0?k.y+k.height/2:V.y+V.height/2;n.moveElements(K,{x:Ye+Ue-J,y:Ne-(k.y+k.height/2)})}const It=(S,P)=>{const k=P.target===S,z=p(P.source),V=p(P.target),B=k?"bpmn:DataOutputAssociation":"bpmn:DataInputAssociation";n.connect(z,V,P.id?{type:B,businessObject:i.create(B,{id:P.id})}:{type:B})},un=100,ln=S=>{for(const P of d){if(!P.participant.blackBox)continue;const k=l(P.participant.id);if(!k)continue;const z=[];for(const B of g){const K=B.flow.source===P.participant.id?B.flow.target:B.flow.target===P.participant.id?B.flow.source:void 0,pe=K?l(K):void 0;pe&&typeof pe.x=="number"&&pe.type!=="bpmn:Participant"&&z.push(pe)}if(!z.length)continue;const V=Math.max(...z.map(B=>B.x+B.width/2))+un;if(V>k.x+k.width&&n.resizeShape(k,{x:k.x,y:k.y,width:V-k.x,height:k.height}),!!S)for(const B of g){const K=l(B.flow.id),pe=B.flow.source===P.participant.id?B.flow.target:B.flow.target===P.participant.id?B.flow.source:void 0,J=pe?l(pe):void 0;if(!K||!J||J.type==="bpmn:Participant")continue;const ue=J.x+J.width/2;if(ue<k.x+10||ue>k.x+k.width-10)continue;const Ye=k.y>J.y,ct=Ye?J.y+J.height:J.y,Ne=Ye?k.y:k.y+k.height,Te=B.flow.source===P.participant.id?[{x:ue,y:Ne},{x:ue,y:ct}]:[{x:ue,y:ct},{x:ue,y:Ne}],ve=Ut(o),nt={...ve.edges.find(Bt=>Bt.id===B.flow.id),waypoints:Te};zn(nt,Ci(ve)).length||n.updateWaypoints(K,Te)}}};ln(!1);for(const S of g){const P=S.flow;n.connect(p(P.source),p(P.target),{type:"bpmn:MessageFlow",businessObject:i.create("bpmn:MessageFlow",{id:P.id,name:P.name})})}const at=100,Nt=30,pn=4,jo=S=>!("waypoints"in S&&S.waypoints)&&S.type!=="bpmn:Lane"&&S.type!=="label"&&typeof S.x=="number",fn=()=>{const S=Ut(o);return{bad:qi(S).filter(P=>P.kind==="edge-crosses-shape"||P.kind==="edge-overlap-opposite"||P.kind==="edge-overlap-mixed").length,crossings:Sd(S),straight:S.edges.filter(P=>P.type==="bpmn:MessageFlow"&&P.waypoints.length===2).length}},Ln=S=>{const P=Ut(o),k=P.edges.find(z=>z.id===S);return k?zn(k,Ci(P)).length:0},In=S=>Ln(S)>0,Rt=(S,P,k)=>{const z=new Set(S.map(ue=>ue.id)),V=(P.children??[]).filter(jo).filter(ue=>!z.has(ue.id));if(S.some(ue=>V.some(Ye=>ue.x+k<Ye.x+Ye.width+Nt&&ue.x+k+ue.width+Nt>Ye.x&&ue.y<Ye.y+Ye.height&&ue.y+ue.height>Ye.y)))return null;const K=P.width;n.moveElements(S,{x:k,y:0});const J=Math.max(...S.map(ue=>ue.x+ue.width))+150-(P.x+P.width);return J>0&&n.resizeShape(P,{x:P.x,y:P.y,width:P.width+J,height:P.height}),()=>{n.moveElements(S,{x:-k,y:0}),J>0&&n.resizeShape(P,{x:P.x,y:P.y,width:K,height:P.height})}},Er=(S,P)=>P.bad>S.bad||P.crossings>S.crossings&&P.straight<=S.straight&&P.bad>=S.bad,Fo=(S,P,k,z=()=>!0)=>{const V=fn(),B=Rt(S,P,k);if(!B)return!1;const K=fn();return Er(V,K)||!z()?(B(),!1):!0},xn=S=>{var P;return!!((P=E.get(S))!=null&&P.node.participant)},He=new Map;for(const S of g){if(!xn(S.flow.target))continue;const P=He.get(S.flow.target)??[];P.push(S),He.set(S.flow.target,P)}const Xe=[...He.keys()],dx=new Set(m.map(S=>S.flow.target)),hx=S=>Lt.findIndex(({op:P})=>P.participant.id===S);Xe.sort((S,P)=>{var V,B;const k=dx.has(S)?1:0,z=dx.has(P)?1:0;return k!==z?k-z:hx((V=E.get(S))==null?void 0:V.node.participant)-hx((B=E.get(P))==null?void 0:B.node.participant)});const qa=S=>S.x+S.width/2,mx=S=>{let P;for(const k of He.get(S)??[]){const z=l(k.flow.source);if(!z)continue;const V=qa(z);(!P||V>P.cx)&&(P={op:k,cx:V})}return P==null?void 0:P.op},WD=S=>{const P=mx(S),k=l(S),z=P?l(P.flow.source):void 0;return k&&z?qa(z)-qa(k):void 0},UD=S=>{const P=WD(S);return P!==void 0&&Math.abs(P)<at},Bf=S=>{const P=mx(S);if(!P)return null;const k=l(S),z=l(P.flow.source);if(!k||!z)return null;const V=qa(z)-qa(k);if(V>=at){const B=p(E.get(S).node.participant);return{subtree:ft(S,K=>K.x>=k.x),pool:B,dx:V}}if(-V>=at&&xn(P.flow.source)){const B=p(E.get(P.flow.source).node.participant);return{subtree:ft(P.flow.source,K=>K.x>=z.x&&!UD(K.id)),pool:B,dx:-V}}return null},gx=()=>Xe.map(S=>({id:S,plan:Bf(S)})).filter(S=>!!S.plan).sort((S,P)=>Math.min(...S.plan.subtree.map(k=>k.x))-Math.min(...P.plan.subtree.map(k=>k.x))).map(S=>S.id);for(let S=0;S<3;S++){const P=fn(),k=[];for(const V of gx()){const B=Bf(V);if(!B)continue;const K=Rt(B.subtree,B.pool,B.dx);K&&k.push(K)}if(!k.length)break;if(!Er(P,fn()))continue;for(const V of k.reverse())V();let z=!1;for(const V of gx()){const B=Bf(V);B&&Fo(B.subtree,B.pool,B.dx)&&(z=!0)}if(!z)break}for(const S of Xe.flatMap(P=>He.get(P)??[])){if(!In(S.flow.id))continue;const P=l(S.flow.target);if(!P)continue;const k=p(E.get(S.flow.target).node.participant),z=ft(S.flow.target,K=>K.x>=P.x),V=P.width+H,B=Ln(S.flow.id);for(let K=1;K<=pn&&!Fo(z,k,V*K,()=>Ln(S.flow.id)<B);K++);}for(const S of g){if(!In(S.flow.id))continue;const P=l(S.flow.source),k=l(S.flow.target);if(!P||!k||P.type==="bpmn:Participant"||k.type==="bpmn:Participant")continue;const z=P.x+P.width/2;if(Math.abs(z-(k.x+k.width/2))>15)continue;const[V,B]=P.y<k.y?[P.y+P.height,k.y]:[k.y+k.height,P.y],K=[...E.values()].map(pe=>l(pe.node.id)).filter(pe=>!!pe&&pe.id!==P.id&&pe.id!==k.id).filter(pe=>pe.x<=z&&z<=pe.x+pe.width&&pe.y+pe.height>V&&pe.y<B).sort((pe,J)=>pe.x-J.x);for(const pe of K){const J=(Sx=E.get(pe.id))==null?void 0:Sx.node.participant,ue=J?l(J):void 0;if(!ue)continue;const Ye=[...E.values()].filter(Et=>Et.node.participant===J).map(Et=>Et.node.id),ct=Et=>Et.map(pt=>l(pt)).filter(pt=>!!pt),Te=[tt(pe.id,Et=>{var pt;return((pt=E.get(Et.id))==null?void 0:pt.node.participant)===J}),ct(Ye)].filter(Et=>Et.length),ve=pe.width+H,nt=Ln(S.flow.id);let Bt=!1;for(const Et of Te){for(let pt=1;pt<=pn;pt++)if(Fo(Et,ue,ve*pt,()=>Ln(S.flow.id)<nt)){Bt=!0;break}if(Bt)break}if(!In(S.flow.id))break}}{const S=k=>k.y+k.height/2,P=[];for(const k of E.keys()){if(!xn(k))continue;const z=m.filter(K=>K.flow.target===k);if(z.length!==1)continue;const V=l(z[0].flow.source),B=l(k);!V||!B||!E.has(V.id)||Math.abs(S(V)-S(B))>1||B.x-(V.x+V.width)<=H+1||P.push({id:k,pred:V,node:B})}P.sort((k,z)=>k.node.x-z.node.x);for(const{id:k}of P){const z=E.get(k),V=l(k),B=l(m.find(Ne=>Ne.flow.target===k).flow.source);if(!V||!B)continue;const K=V.x-(B.x+B.width);if(K<=H+1)continue;const pe=p(z.node.participant),J=ft(k,Ne=>Ne.x>=V.x),ue=fn(),Ye=Rt(J,pe,-(K-H));if(!Ye)continue;const ct=fn();(ct.bad>ue.bad||ct.crossings>=ue.crossings)&&Ye()}}ln(!0);for(const S of R){const P=S.associations??[],k=P.map(B=>B.source===S.dataStore.id?B.target:B.source).map(l).find(Boolean),z=k?f(k)??u():u(),V=k?{x:k.x+k.width/2,y:k.y+k.height+110}:{x:200,y:C+60};n.createShape({type:"bpmn:DataStoreReference",businessObject:i.create("bpmn:DataStoreReference",{id:S.dataStore.id,name:S.dataStore.name})},V,z);for(const B of P)It(S.dataStore.id,B)}for(const S of w){const k=p(S.association.target).type==="bpmn:DataStoreReference"?S.association.target:S.association.source;It(k,S.association)}let yx=0;const YD=10,vx=(S,P)=>{for(const k of P.map(z=>f(z)).filter(z=>!!z)){const z=YD,V=k.y,B=k.y+k.height,K=k.x,pe=k.x+k.width;if(Math.abs(S.y-V)<z){const J=V+z-S.y;S.y+=J,S.height-=J}if(Math.abs(S.y+S.height-B)<z&&(S.height=B-z-S.y),Math.abs(S.x-K)<z){const J=K+z-S.x;S.x+=J,S.width-=J}Math.abs(S.x+S.width-pe)<z&&(S.width=pe-z-S.x)}};for(const S of x){const P=(S.group.members??[]).map(l).filter(B=>!!B),k=40;let z;if(P.length){const B=Math.min(...P.map(ue=>ue.x))-k,K=Math.min(...P.map(ue=>ue.y))-k,pe=Math.max(...P.map(ue=>ue.x+ue.width))+k,J=Math.max(...P.map(ue=>ue.y+ue.height))+k;z={x:B,y:K,width:pe-B,height:J-K},vx(z,P)}else z={x:300+yx*350,y:40,width:300,height:200},yx++;const V=n.createShape({type:"bpmn:Group",businessObject:i.create("bpmn:Group",{id:S.group.id}),width:z.width,height:z.height},{x:z.x+z.width/2,y:z.y+z.height/2},u());S.group.name&&n.updateLabel(V,S.group.name),(Rx=S.group.members)!=null&&Rx.length&&T(V,"bwl:Members",{refs:S.group.members.join(" ")})}const _x=S=>{const P=S.waypoints;if(P!=null&&P.length){const z=P[Math.floor((P.length-1)/2)];return{x:z.x,y:z.y,width:0,height:0}}const k=S;return{x:k.x,y:k.y,width:k.width,height:k.height}};let Ka=0;const bx=12,xx=14,qD=15,KD=300,XD=S=>{const P=S.split(`
7
- `),k=Math.max(...P.map(B=>io(B,bx))),z=Math.max(100,Math.min(KD,Math.ceil(k)+xx)),V=P.reduce((B,K)=>B+Math.max(1,Math.ceil((io(K,bx)+xx)/z)),0);return{width:z,height:Math.max(30,V*qD+10)}},tn=10;for(const S of b){const P=S.association,k=((Cx=S.placement)==null?void 0:Cx.anchor)??(P?P.source===S.annotation.id?P.target:P.source:void 0),z=k?l(k):void 0,V=z?_x(z):void 0,B=XD(S.annotation.text??"");let K;if(V&&S.placement){const[Ye,ct]=Uu[S.placement.side],Ne=S.placement.offset??50;K={x:V.x+V.width/2+Ye*(V.width/2+B.width/2+Ne),y:V.y+V.height/2+ct*(V.height/2+B.height/2+Ne)}}else V?(K={x:V.x+V.width/2+180+Ka%3*260,y:V.y-110-Ka%2*95},Ka++):(K={x:300+Ka*260,y:60},Ka++);const pe=z?f(z)??u():u(),J=pe;if(V&&typeof J.x=="number"&&typeof J.width=="number"&&J.type==="bpmn:Participant"){const Ye=(ne,ge)=>{const[le,Ze]=Uu[ne];let qe={x:V.x+V.width/2+le*(V.width/2+B.width/2+ge),y:V.y+V.height/2+Ze*(V.height/2+B.height/2+ge)};const Ae=J.x+tn+B.width/2,Ke=J.x+J.width-tn-B.width/2,Vt=J.y+tn+B.height/2,ae=J.y+J.height-tn-B.height/2,We={x:Math.min(Ke,Math.max(Ae,qe.x)),y:Math.min(ae,Math.max(Vt,qe.y))};return(We.x!==qe.x||We.y!==qe.y)&&(qe=Math.abs(We.x-(V.x+V.width/2))<(V.width+B.width)/2+tn&&Math.abs(We.y-(V.y+V.height/2))<(V.height+B.height)/2+tn?{x:V.x+V.width+tn+B.width/2,y:We.y}:We),qe},ct=(J.children??[]).filter(ne=>!("waypoints"in ne&&ne.waypoints)&&ne.type!=="bpmn:Lane"&&ne.type!=="label"&&typeof ne.x=="number"),Ne=Ut(o),Te=Ne.edges.flatMap(hn),ve=Uo(Ne).map(ne=>ne.rect),nt=ne=>({x0:ne.x-B.width/2-tn,x1:ne.x+B.width/2+tn,y0:ne.y-B.height/2-tn,y1:ne.y+B.height/2+tn}),Bt=ne=>{const ge=nt(ne);return ct.some(le=>ge.x0<le.x+le.width&&ge.x1>le.x&&ge.y0<le.y+le.height&&ge.y1>le.y)},Et=ne=>{const ge=nt(ne);return Te.some(le=>le.axis==="h"?le.at>ge.y0&&le.at<ge.y1&&le.lo<ge.x1&&le.hi>ge.x0:le.at>ge.x0&&le.at<ge.x1&&le.lo<ge.y1&&le.hi>ge.y0)},pt=ne=>{const ge=nt(ne);return ve.some(le=>ge.x0<le.x+le.width&&ge.x1>le.x&&ge.y0<le.y+le.height&&ge.y1>le.y)},Fn=ne=>Bt(ne)||Et(ne)||pt(ne),_u=ne=>ne.x-B.width/2>=J.x&&ne.x+B.width/2<=J.x+J.width&&ne.y-B.height/2>=J.y&&ne.y+B.height/2<=J.y+J.height;if(S.placement){const ne=Ae=>Ae.startsWith("top")?Ae.replace(/^top/,"bottom"):Ae.replace(/^bottom/,"top"),ge=Ae=>Ae.endsWith("left")?Ae.replace(/left$/,"right"):Ae.replace(/right$/,"left"),le=S.placement.side,Ze=[le,ne(le),ge(le),ne(ge(le)),"top","bottom","left","right","top-left","top-right","bottom-left","bottom-right"],qe=S.placement.offset??50;if(K=Ye(le,qe),Fn(K)){const Ae=new Set;for(const Ke of Ze){if(Ae.has(Ke))continue;Ae.add(Ke);const Vt=Ye(Ke,qe);if(_u(Vt)&&!Fn(Vt)){K=Vt;break}}}}else{const ne=J.x+tn+B.width/2,ge=J.x+J.width-tn-B.width/2,le=J.y+tn+B.height/2,Ze=J.y+J.height-tn-B.height/2;if(K={x:Math.min(ge,Math.max(ne,K.x)),y:Math.min(Ze,Math.max(le,K.y))},Fn(K)){const qe=(V.width+B.width)/2+tn,Ke=[{x:K.x+qe,y:K.y},{x:K.x-qe,y:K.y},{x:K.x,y:K.y-B.height-tn},{x:K.x,y:K.y+B.height+tn}].filter(_u).find(Vt=>!Fn(Vt));Ke&&(K=Ke)}}}const ue=n.createShape({type:"bpmn:TextAnnotation",width:B.width,height:B.height,businessObject:i.create("bpmn:TextAnnotation",{id:S.annotation.id,text:S.annotation.text})},K,pe);if(P){const Ye=ct=>ct===S.annotation.id?ue:p(ct);n.connect(Ye(P.source),Ye(P.target),P.id?{type:"bpmn:Association",businessObject:i.create("bpmn:Association",{id:P.id})}:{type:"bpmn:Association"})}S.placement&&T(ue,"bwl:Placement",L(S.placement))}for(const S of Xt(e,"association.add")){const P=S.association;n.connect(p(P.source),p(P.target),P.id?{type:"bpmn:Association",businessObject:i.create("bpmn:Association",{id:P.id})}:{type:"bpmn:Association"})}for(const S of Xt(e,"node.update")){let P=p(S.id);if(S.type&&hs(S.type)!==P.type&&(P=c.replaceElement(P,{type:hs(S.type)})),S.name!==void 0&&n.updateProperties(P,{name:S.name??void 0}),S.lane){const k=p(S.lane),z=k.y+k.height/2-(P.y+P.height/2);z!==0&&n.moveElements([P],{x:0,y:z})}}for(const S of Xt(e,"sequenceFlow.update")){const P=p(S.id);if(S.source!==void 0||S.target!==void 0){const k=P,z=S.source!==void 0?p(S.source):k.source,V=S.target!==void 0?p(S.target):k.target,B=K=>({x:K.x+K.width/2,y:K.y+K.height/2});n.reconnect(k,z,V,[B(z),B(V)])}S.name!==void 0&&n.updateProperties(P,{name:S.name??void 0}),S.condition!==void 0&&n.updateProperties(P,{name:((Px=S.condition)==null?void 0:Px.label)??void 0})}for(const S of Xt(e,"messageFlow.update"))S.name!==void 0&&n.updateProperties(p(S.id),{name:S.name??void 0});for(const S of Xt(e,"dataStore.update"))S.name!==void 0&&n.updateProperties(p(S.id),{name:S.name??void 0});for(const S of Xt(e,"annotation.update")){const P=p(S.id);if(S.text!==void 0&&n.updateProperties(P,{text:S.text}),S.placement===null)T(P,"bwl:Placement",null);else if(S.placement){const k=_x(p(S.placement.anchor)),[z,V]=Uu[S.placement.side],B=S.placement.offset??50,K=k.x+k.width/2+z*(k.width/2+P.width/2+B),pe=k.y+k.height/2+V*(k.height/2+P.height/2+B);n.moveElements([P],{x:K-(P.x+P.width/2),y:pe-(P.y+P.height/2)}),T(P,"bwl:Placement",L(S.placement))}}for(const S of Xt(e,"group.update")){const P=p(S.id);if(S.name!==void 0&&n.updateLabel(P,S.name??""),S.members){const k=S.members.map(l).filter(z=>!!z);if(k.length){const V=Math.min(...k.map(ue=>ue.x))-40,B=Math.min(...k.map(ue=>ue.y))-40,K=Math.max(...k.map(ue=>ue.x+ue.width))+40,pe=Math.max(...k.map(ue=>ue.y+ue.height))+40,J={x:V,y:B,width:K-V,height:pe-B};vx(J,k),n.resizeShape(P,J)}T(P,"bwl:Members",{refs:S.members.join(" ")})}}}function rh(e,t,n=ih){const i=nh(e),r=th(t,kd(i.elementRegistry)),o={edgeCrossings:{before:0,after:0,pairs:[]}};if(r.length)return{ok:!1,issues:r,findings:[],stats:o};const a=Ut(i.elementRegistry),s=new Set(qi(a).map(Yi)),c=new Set(a.edges.map(m=>m.id)),u=new Set(a.shapes.map(m=>m.id)),l=Vu(a).length,p=e.get("commandStack");try{zf(p,()=>{n(t,i),Fd(i,c),Bd(i,s),Ud(i,s,c),Gd(i,c),Jw(i,c),Xd(i,s,c),Kd(i,c),Qd(i,u)})}catch(m){return{ok:!1,issues:[{kind:"lower-failed",message:m instanceof Error?m.message:String(m)}],findings:[],stats:o}}const f=Ut(i.elementRegistry),d=qi(f).filter(m=>!s.has(Yi(m))),h=Vu(f);return{ok:!0,issues:[],findings:d,stats:{edgeCrossings:{before:l,after:h.length,pairs:h}}}}function oE(e){const t=e.slice(e.indexOf(":")+1);return t.charAt(0).toLowerCase()+t.slice(1)}function aE(e,t){return typeof e.get=="function"?e.get(t):e[t]}function oh(e,t){const n=aE(e,t);return typeof n=="number"&&Number.isFinite(n)?n:void 0}function ah(e,t){var i;return(((i=e.extensionElements)==null?void 0:i.values)??[]).find(r=>(r==null?void 0:r.$type)===t)}function sE(e){return typeof e=="string"&&xu.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 sh(e){const t=e.rootElements??[],n=t.find(Y=>Y.$type==="bpmn:Collaboration"),i=new Map(t.filter(Y=>Y.$type==="bpmn:Process").map(Y=>[Y.id,Y])),r=[],o=[],a=[],s=[],c=[],u=[],l={poolOrders:{},bands:{},placements:{}},p=[],f=[],d=[],h=[],m=[],g=[],R=new Set,w=new Set,b=Y=>{Y&&R.add(Y)},x=Y=>{R.add(Y),w.add(Y)},E=Y=>{const de=ah(Y,"bwl:Placement");if(!de)return;const he=typeof de.anchor=="string"?de.anchor:void 0;if(!he||!sE(de.side))return;const se=typeof de.offset=="number"?de.offset:void 0;m.push({owner:Y.id,anchor:he,side:de.side,...se!==void 0?{offset:se}:{}})},T=Y=>{const de=ah(Y,"bwl:Members"),he=typeof(de==null?void 0:de.refs)=="string"?de.refs.split(/\s+/).filter(Boolean):[];he.length&&g.push({owner:Y.id,refs:he})},L=Y=>{var de;for(const he of Y)switch(b(he.id),he.$type){case"bpmn:TextAnnotation":x(he.id),s.push({id:he.id,text:typeof he.text=="string"?he.text:""}),E(he);break;case"bpmn:Association":d.push({id:he.id,type:he.$type,source:ci(he.sourceRef),target:ci(he.targetRef)});break;case"bpmn:Group":{x(he.id);const se=(de=he.categoryValueRef)==null?void 0:de.value;c.push({id:he.id,...typeof se=="string"&&se?{name:se}:{}}),T(he);break}default:u.push({id:he.id,type:he.$type,reason:"type-outside-mvp"})}},A=(Y,de)=>{const he=Y.flowElements??[],se=(Y.laneSets??[]).flatMap(ee=>ee.lanes??[]),ce=new Map;for(const ee of se){b(ee.id);for(const F of ee.flowNodeRef??[]){const $=ci(F);$&&ce.set($,ee.id)}}for(const ee of he){if(b(ee.id),ee.$type==="bpmn:SequenceFlow"){p.push({id:ee.id,source:ci(ee.sourceRef),target:ci(ee.targetRef),...typeof ee.name=="string"&&ee.name?{name:ee.name}:{}});continue}if(ee.$type==="bpmn:DataStoreReference"){x(ee.id),a.push({id:ee.id,...ee.name?{name:ee.name}:{}});continue}const F=oE(ee.$type);if(!$f(F)){u.push({id:ee.id,type:ee.$type,reason:"type-outside-mvp"});continue}x(ee.id),o.push({id:ee.id,type:F,...ee.name?{name:ee.name}:{},...de?{participant:de}:{},...ce.has(ee.id)?{lane:ce.get(ee.id)}:{}});const $=oh(ee,"bwl:band");$!==void 0&&(l.bands[ee.id]=$);for(const U of ee.dataOutputAssociations??[])b(U.id),h.push({id:U.id,type:U.$type,source:ee.id,target:ci(U.targetRef)});for(const U of ee.dataInputAssociations??[])b(U.id),h.push({id:U.id,type:U.$type,source:ci((U.sourceRef??[])[0]),target:ee.id})}L(Y.artifacts??[])};if(n){const Y=new Set;for(const de of n.participants??[]){x(de.id);const he=ci(de.processRef);he&&Y.add(he);const se=he?i.get(he):void 0,ce=((se==null?void 0:se.laneSets)??[]).flatMap(U=>U.lanes??[]),ee=ce.map(U=>({id:U.id,...U.name?{name:U.name}:{}}));for(const U of ee)x(U.id);const F=!se||(se.flowElements??[]).length===0&&ce.length===0&&(se.artifacts??[]).length===0;r.push({id:de.id,...de.name?{name:de.name}:{},...F?{blackBox:!0}:{},...ee.length?{lanes:ee}:{}});const $=oh(de,"bwl:poolOrder");$!==void 0&&(l.poolOrders[de.id]=$),se&&A(se,de.id)}for(const de of n.messageFlows??[])b(de.id),f.push({id:de.id,source:ci(de.sourceRef),target:ci(de.targetRef),...typeof de.name=="string"&&de.name?{name:de.name}:{}});L(n.artifacts??[]);for(const[de,he]of i)!Y.has(de)&&(he.flowElements??[]).length>0&&u.push({id:de,type:he.$type,reason:"unreachable-process"})}else for(const Y of i.values())A(Y);const j=[],H=[],N=[],G=[],fe=(Y,de)=>!!Y&&!!de&&w.has(Y)&&w.has(de);for(const Y of p){if(!fe(Y.source,Y.target)){u.push({id:Y.id,type:"bpmn:SequenceFlow",reason:"endpoint-outside-mvp"});continue}j.push({id:Y.id,source:Y.source,target:Y.target,...Y.name?{name:Y.name}:{}}),w.add(Y.id)}for(const Y of f){if(!fe(Y.source,Y.target)){u.push({id:Y.id,type:"bpmn:MessageFlow",reason:"endpoint-outside-mvp"});continue}H.push({id:Y.id,source:Y.source,target:Y.target,...Y.name?{name:Y.name}:{}}),w.add(Y.id)}for(const Y of h){if(!fe(Y.source,Y.target)){u.push({id:Y.id??"",type:Y.type,reason:"endpoint-outside-mvp"});continue}G.push({...Y.id?{id:Y.id}:{},source:Y.source,target:Y.target}),Y.id&&w.add(Y.id)}for(const Y of d){if(!fe(Y.source,Y.target)){u.push({id:Y.id??"",type:Y.type,reason:"endpoint-outside-mvp"});continue}N.push({...Y.id?{id:Y.id}:{},source:Y.source,target:Y.target})}const Fe=new Map(c.map(Y=>[Y.id,Y]));for(const{owner:Y,refs:de}of g){const he=de.filter(ce=>R.has(ce)),se=Fe.get(Y);se&&he.length&&(se.members=he)}for(const Y of m)R.has(Y.anchor)&&(l.placements[Y.owner]={anchor:Y.anchor,side:Y.side,...Y.offset!==void 0?{offset:Y.offset}:{}});return{definition:{...r.length?{participants:r}:{},nodes:o,sequenceFlows:j,...H.length?{messageFlows:H}:{},...a.length?{dataStores:a}:{},...G.length?{dataAssociations:G}:{},...s.length?{annotations:s}:{},...N.length?{associations:N}:{},...c.length?{groups:c}:{}},hints:l,omitted:u}}async function cE(e){const{definitions:t,warnings:n}=await $u(e);return{...sh(t),warnings:n}}function uE(e,t,n,i={}){return{documentId:e,baseVersion:t,ops:[...n],origin:i.origin??"agent",clientOpId:(i.mkClientOpId??(()=>crypto.randomUUID()))()}}async function ch(e,t,{currentVersion:n}){if(t.baseVersion!==n)return{status:"conflict",baseVersion:t.baseVersion,currentVersion:n};const i=rh(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 lE=Symbol("bpmn-editor");function pE(){const e=Ct.ref(!1),t=Ct.ref(!0),n=Ct.ref(!1);let i,r;const o=()=>{e.value=!0};function a(u,l){u.get("canvas").getContainer().style.pointerEvents=l?"":"none";const p=u.get("keyboard");l?(r&&p.bind(r),r=void 0):r||(r=p.getBinding(),p.unbind())}function s(){if(!i)throw new Error("modeler not attached — 뷰 @ready 후 attach() 필요");return i}function c(){return i==null?void 0:i.get("commandStack")}return{dirty:e,editable:t,agentBusy:n,attach(u){i&&this.detach(),i=u,i.get("eventBus").on("commandStack.changed",o),t.value||a(i,!1)},detach(){i==null||i.get("eventBus").off("commandStack.changed",o),i&&!t.value&&a(i,!0),r=void 0,i=void 0},setEditable(u){t.value=u,i&&a(i,u)},async applyAgentBatch(u,l){const p=s();n.value=!0;try{const f=await ch(p,u,{currentVersion:l});return f.status==="applied"&&(e.value=!1),f}finally{n.value=!1}},async importXml(u){const{warnings:l}=await s().importXML(u);return e.value=!1,{warnings: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 ie(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}function fE(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Yu={exports:{}},uh;function dE(){if(uh)return Yu.exports;uh=1;var e=Yu.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},Yu.exports}var hE=dE(),mE=fE(hE);function ui(e){if(!(this instanceof ui))return new ui(e);e=e||[128,36,1],this._seed=e.length?mE.rack(e[0],e[1],e[2]):e}ui.prototype.next=function(e){return this._seed(e||!0)},ui.prototype.nextPrefixed=function(e,t){var n;do n=e+this.next(!0);while(this.assigned(n));return this.claim(n,t),n},ui.prototype.claim=function(e,t){this._seed.set(e,t||!0)},ui.prototype.assigned=function(e){return this._seed.get(e)||!1},ui.prototype.unclaim=function(e){delete this._seed.hats[e]},ui.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 ut(e,t=globalThis.document){var u;if(typeof e!="string")throw new TypeError("String expected");const n=/^<!--(.*?)-->$/s.exec(e);if(n)return t.createComment(n[1]);const i=(u=/<([\w:]+)/.exec(e))==null?void 0:u[1];if(!i)return t.createTextNode(e);if(e=e.trim(),i==="body"){const l=t.createElement("html");l.innerHTML=e;const{lastChild:p}=l;return p.remove(),p}let[r,o,a]=Object.hasOwn(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 gE(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 mn(e,...t){const n=e.style;return M(t,function(i){i&&M(i,function(r,o){n[o]=r})}),e}function an(e,t,n){return arguments.length==2?e.getAttribute(t):n===null?e.removeAttribute(t):(e.setAttribute(t,n),e)}const yE=Object.prototype.toString;function mt(e){return new Ki(e)}function Ki(e){if(!e||!e.nodeType)throw new Error("A DOM element reference is required");this.el=e,this.list=e.classList}Ki.prototype.add=function(e){return this.list.add(e),this},Ki.prototype.remove=function(e){return yE.call(e)=="[object RegExp]"?this.removeMatching(e):(this.list.remove(e),this)},Ki.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},Ki.prototype.toggle=function(e,t){return typeof t<"u"?t!==this.list.toggle(e,t)&&this.list.toggle(e):this.list.toggle(e),this},Ki.prototype.array=function(){return Array.from(this.list)},Ki.prototype.has=Ki.prototype.contains=function(e){return this.list.contains(e)};function ms(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 vE(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var gs={},lh;function _E(){if(lh)return gs;lh=1;var e,t,n;function i(){e=window.addEventListener?"addEventListener":"attachEvent",t=window.removeEventListener?"removeEventListener":"detachEvent",n=e!=="addEventListener"?"on":""}return gs.bind=function(r,o,a,s){return e||i(),r[e](n+o,a,s||!1),a},gs.unbind=function(r,o,a,s){return t||i(),r[t](n+o,a,s||!1),a},gs}var ph=_E(),bE=vE(ph),Se=gE({__proto__:null,default:bE},[ph]),fh=["focus","blur"];function xE(e,t,n,i,r){return fh.indexOf(n)!==-1&&(r=!0),Se.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 wE(e,t,n,i){return fh.indexOf(t)!==-1&&(i=!0),Se.unbind(e,t,n,i)}var Cn={bind:xE,unbind:wE};function qu(e,t){return e&&typeof e.matches=="function"&&e.matches(t)||!1}function et(e,t){return t=t||document,t.querySelector(e)}function ys(e,t){return t=t||document,t.querySelectorAll(e)}function li(e){e.parentNode&&e.parentNode.removeChild(e)}function EE(e,t){if(e.ownerDocument!==t.ownerDocument)try{return t.ownerDocument.importNode(e,!0)}catch{}return e}function SE(e,t){return t.appendChild(EE(e,t))}function Re(e,t){return SE(t,e),e}var Ku=2,dh={"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":Ku,"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":Ku,"text-anchor":1,"text-decoration":1,"text-rendering":1,"unicode-bidi":1,visibility:1,"word-spacing":1,"writing-mode":1};function RE(e,t){return dh[t]?e.style[t]:e.getAttributeNS(null,t)}function hh(e,t,n){var i=t.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase(),r=dh[i];r?(r===Ku&&typeof n=="number"&&(n=String(n)+"px"),e.style[i]=n):e.setAttributeNS(null,t,n)}function CE(e,t){var n=Object.keys(t),i,r;for(i=0,r;r=n[i];i++)hh(e,r,t[r])}function re(e,t,n){if(typeof t=="string")if(n!==void 0)hh(e,t,n);else return RE(e,t);else CE(e,t);return e}const PE=Object.prototype.toString;function je(e){return new Xi(e)}function Xi(e){if(!e||!e.nodeType)throw new Error("A DOM element reference is required");this.el=e,this.list=e.classList}Xi.prototype.add=function(e){return this.list.add(e),this},Xi.prototype.remove=function(e){return PE.call(e)=="[object RegExp]"?this.removeMatching(e):(this.list.remove(e),this)},Xi.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},Xi.prototype.toggle=function(e,t){return typeof t<"u"?t!==this.list.toggle(e,t)&&this.list.toggle(e):this.list.toggle(e),this},Xi.prototype.array=function(){return Array.from(this.list)},Xi.prototype.has=Xi.prototype.contains=function(e){return this.list.contains(e)};function vs(e){for(var t;t=e.firstChild;)e.removeChild(t);return e}function mh(e){return e.cloneNode(!0)}var Xu={svg:"http://www.w3.org/2000/svg"},gh='<svg xmlns="'+Xu.svg+'"';function AE(e){var t=!1;e.substring(0,4)==="<svg"?e.indexOf(Xu.svg)===-1&&(e=gh+e.substring(4)):(e=gh+">"+e+"</svg>",t=!0);var n=TE(e);if(!t)return n;for(var i=document.createDocumentFragment(),r=n.firstChild;r.firstChild;)i.appendChild(r.firstChild);return i}function TE(e){var t;return t=new DOMParser,t.async=!1,t.parseFromString(e,"text/xml")}function me(e,t){var n;return e=e.trim(),e.charAt(0)==="<"?(n=AE(e).firstChild,n=document.importNode(n,!0)):n=document.createElementNS(Xu.svg,e),t&&re(n,t),n}var Zu=null;function yh(){return Zu===null&&(Zu=me("svg")),Zu}function vh(e,t){var n,i,r=Object.keys(t);for(n=0;i=r[n];n++)e[i]=t[i];return e}function ME(e,t,n,i,r,o){var a=yh().createSVGMatrix();switch(arguments.length){case 0:return a;case 1:return vh(a,e);case 6:return vh(a,{a:e,b:t,c:n,d:i,e:r,f:o})}}function Yo(e){return yh().createSVGTransform()}var _h=/([&<>]{1})/g,kE=/([&<>\n\r"]{1})/g,DE={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"'"};function Qu(e,t){function n(i,r){return DE[r]||r}return e.replace(t,n)}function bh(e,t){var n,i,r,o,a;switch(e.nodeType){case 3:t.push(Qu(e.textContent,_h));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,'="',Qu(o.value,kE),'"');if(e.hasChildNodes()){for(t.push(">"),a=e.childNodes,n=0,i=a.length;n<i;++n)bh(a.item(n),t);t.push("</",e.tagName,">")}else t.push("/>");break;case 8:t.push("<!--",Qu(e.nodeValue,_h),"-->");break;case 4:t.push("<![CDATA[",e.nodeValue,"]]>");break;default:throw new Error("unable to handle node "+e.nodeType)}return t}function OE(e){for(var t=e.firstChild,n=[];t;)bh(t,n),t=t.nextSibling;return n.join("")}function xh(e,t){return OE(e)}function Ft(e){var t=e.parentNode;return t&&t.removeChild(e),e}function LE(e,t){return t instanceof SVGMatrix?e.createSVGTransformFromMatrix(t):t}function IE(e,t){var n,i;for(e.clear(),n=0;i=t[n];n++)e.appendItem(LE(e,i))}function qo(e,t){var n=e.transform.baseVal;return t&&(Array.isArray(t)||(t=[t]),IE(n,t)),n.consolidate()}const NE=/^class[ {]/;function BE(e){return NE.test(e.toString())}function Ju(e){return Array.isArray(e)}function el(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function _s(...e){e.length===1&&Ju(e[0])&&(e=e[0]),e=[...e];const t=e.pop();return t.$inject=e,t}const $E=/constructor\s*[^(]*\(\s*([^)]*)\)/m,jE=/^(?:async\s+)?(?:function\s*[^(]*)?(?:\(\s*([^)]*)\)|(\w+))/m,FE=/\/\*([^*]*)\*\//m;function HE(e){if(typeof e!="function")throw new Error(`Cannot annotate "${e}". Expected a function!`);const t=e.toString().match(BE(e)?$E:jE);if(!t)return[];const n=t[1]||t[2];return n&&n.split(",").map(i=>{const r=i.match(FE);return(r&&r[1]||i).trim()})||[]}function wh(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 E=b.split(".");let T=c(E.shift());for(;E.length;)T=T[E.shift()];return T}if(el(o,b))return o[b];if(el(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(Ju(b))b=_s(b.slice());else throw s(`Cannot invoke "${b}". Expected a function!`);const T=(b.$inject||HE(b)).map(L=>el(x,L)?x[L]:c(L));return{fn:b,dependencies:T}}function l(b){const{fn:x,dependencies:E}=u(b),T=Function.prototype.bind.call(x,null,...E);return new T}function p(b,x,E){const{fn:T,dependencies:L}=u(b,E);return T.apply(x,L)}function f(b){return _s(x=>b.get(x))}function d(b,x){if(x&&x.length){const E=Object.create(null),T=Object.create(null),L=[],A=[],j=[];let H,N,G,fe;for(let Fe in r)H=r[Fe],x.indexOf(Fe)!==-1&&(H[2]==="private"?(N=L.indexOf(H[3]),N===-1?(G=H[3].createChild([],x),fe=f(G),L.push(H[3]),A.push(G),j.push(fe),E[Fe]=[fe,Fe,"private",G]):E[Fe]=[j[N],Fe,"private",A[N]]):E[Fe]=[H[2],H[1]],T[Fe]=!0),(H[2]==="factory"||H[2]==="type")&&H[1].$scope&&x.forEach(lt=>{H[1].$scope.indexOf(lt)!==-1&&(E[Fe]=[H[2],H[1]],T[lt]=!0)});x.forEach(Fe=>{if(!T[Fe])throw new Error('No provider for "'+Fe+'". Cannot use provider from the parent!')}),b.unshift(E)}return new wh(b,a)}const h={factory:p,type:l,value:function(b){return b}};function m(b,x){const E=b.__init__||[];return function(){E.forEach(T=>{typeof T=="string"?x.get(T):x.invoke(T)})}}function g(b){const x=b.__exports__;if(x){const E=b.__modules__,T=Object.keys(b).reduce((N,G)=>(G!=="__exports__"&&G!=="__modules__"&&G!=="__init__"&&G!=="__depends__"&&(N[G]=b[G]),N),Object.create(null)),L=(E||[]).concat(T),A=d(L),j=_s(function(N){return A.get(N)});x.forEach(function(N){r[N]=[j,N,"private",A]});const H=(b.__init__||[]).slice();return H.unshift(function(){A.init()}),b=Object.assign({},b,{__init__:H}),m(b,A)}return Object.keys(b).forEach(function(E){if(E==="__init__"||E==="__depends__")return;const T=b[E];if(T[2]==="private"){r[E]=T;return}const L=T[0],A=T[1];r[E]=[h[L],zE(L,A),L]}),m(b,a)}function R(b,x){return b.indexOf(x)!==-1||(b=(x.__depends__||[]).reduce(R,b),b.indexOf(x)!==-1)?b:b.concat(x)}function w(b){const x=b.reduce(R,[]).map(g);let E=!1;return function(){E||(E=!0,x.forEach(T=>T()))}}this.get=c,this.invoke=p,this.instantiate=l,this.createChild=d,this.init=w(e)}function zE(e,t){return e!=="value"&&Ju(t)&&(t=_s(t.slice())),t}var VE=1e3;function Pi(e,t){var n=this;t=t||VE,e.on(["render.shape","render.connection"],t,function(i,r){var o=i.type,a=r.element,s=r.gfx,c=r.attrs;if(n.canRender(a))return o==="render.shape"?n.drawShape(s,a,c):n.drawConnection(s,a,c)}),e.on(["render.getShapePath","render.getConnectionPath"],t,function(i,r){if(n.canRender(r))return i.type==="render.getShapePath"?n.getShapePath(r):n.getConnectionPath(r)})}Pi.prototype.canRender=function(e){},Pi.prototype.drawShape=function(e,t){},Pi.prototype.drawConnection=function(e,t){},Pi.prototype.getShapePath=function(e){},Pi.prototype.getConnectionPath=function(e){};function Dr(e){return e.flat().join(",").replace(/,?([A-Za-z]),?/g,"$1")}function GE(e){return["M",e.x,e.y]}function tl(e){return["L",e.x,e.y]}function WE(e,t,n){return["C",e.x,e.y,t.x,t.y,n.x,n.y]}function UE(e,t){const n=e.length,i=[GE(e[0])];for(let r=1;r<n;r++){const o=e[r-1],a=e[r],s=e[r+1];if(!s||!t){i.push(tl(a));continue}const c=Math.min(t,nl(a.x-o.x,a.y-o.y),nl(s.x-a.x,s.y-a.y));if(!c){i.push(tl(a));continue}const u=bs(a,o,c),l=bs(a,o,c*.5),p=bs(a,s,c),f=bs(a,s,c*.5);i.push(tl(u)),i.push(WE(l,f,p))}return i}function bs(e,t,n){const i=t.x-e.x,r=t.y-e.y,o=nl(i,r),a=n/o;return{x:e.x+i*a,y:e.y+r*a}}function nl(e,t){return Math.sqrt(Math.pow(e,2)+Math.pow(t,2))}function Ko(e,t,n){we(t)&&(n=t,t=null),t||(t={});const i=me("path",t);return we(n)&&(i.dataset.cornerRadius=String(n)),il(i,e)}function il(e,t){const n=parseInt(e.dataset.cornerRadius,10)||0;return re(e,{d:Dr(UE(t,n))}),e}function xs(e){var t=new Set(e);return Oe(e,function(n){for(var i=n.parent;i;){if(t.has(i))return!1;i=i.parent}return!0})}function Or(e,t,n){n=n||0,_e(e)||(e=[e]),M(e,function(i,r){var o=t(i,r,n);_e(o)&&o.length&&Or(o,t,n+1)})}function rl(e,t,n){var i=new Set,r=new Set;return Or(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 Xo(e,t){return rl(e)}function YE(e,t,n){Sr(t)&&(t=!0),Gt(t)&&(n=t,t=!0),n=n||{};var i=Zo(n.allShapes),r=Zo(n.allConnections),o=Zo(n.enclosedElements),a=Zo(n.enclosedConnections),s=Zo(n.topLevel,t&&Qr(e,function(l){return l.id}));function c(l){s[l.source.id]&&s[l.target.id]&&(s[l.id]=[l]),i[l.source.id]&&i[l.target.id]&&(a[l.id]=o[l.id]=l),r[l.id]=l}function u(l){if(o[l.id]=l,l.waypoints)a[l.id]=r[l.id]=l;else return i[l.id]=l,M(l.incoming,c),M(l.outgoing,c),l.children}return Or(e,u),{allShapes:i,allConnections:r,topLevel:s,enclosedConnections:a,enclosedElements:o}}function At(e,t){t=!!t,_e(e)||(e=[e]);var n,i,r,o;return M(e,function(a){var s=a;a.waypoints&&!t&&(s=At(a.waypoints,!0));var c=s.x,u=s.y,l=s.height||0,p=s.width||0;(c<n||n===void 0)&&(n=c),(u<i||i===void 0)&&(i=u),(c+p>r||r===void 0)&&(r=c+p),(u+l>o||o===void 0)&&(o=u+l)}),{x:n,y:i,height:o-i,width:r-n}}function ao(e,t){var n={};return M(e,function(i){var r=i;r.waypoints&&(r=At(r)),!we(t.y)&&r.x>t.x&&(n[i.id]=i),!we(t.x)&&r.y>t.y&&(n[i.id]=i),r.x>t.x&&r.y>t.y&&(we(t.width)&&we(t.height)&&r.width+r.x<t.width+t.x&&r.height+r.y<t.height+t.y||!we(t.width)||!we(t.height))&&(n[i.id]=i)}),n}function Eh(e){return"waypoints"in e?"connection":"x"in e?"shape":"root"}function Sh(e){return!!(e&&e.isFrame)}function Zo(e,t){return O({},e||{},t||{})}var qE=1;function Zi(e,t){Pi.call(this,e,qE),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})}ie(Zi,Pi),Zi.prototype.canRender=function(){return!0},Zi.prototype.drawShape=function(t,n,i){var r=me("rect");return re(r,{x:0,y:0,width:n.width||0,height:n.height||0}),Sh(n)?re(r,O({},this.FRAME_STYLE,i||{})):re(r,O({},this.SHAPE_STYLE,i||{})),Re(t,r),r},Zi.prototype.drawConnection=function(t,n,i){var r=Ko(n.waypoints,O({},this.CONNECTION_STYLE,i||{}));return Re(t,r),r},Zi.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)},Zi.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)},Zi.$inject=["eventBus","styles"];function KE(){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 O(o,{class:n})},this.style=function(n,i){!_e(n)&&!i&&(i=n,n=[]);var r=Sn(n,function(o,a){return O(o,e[a]||{})},{});return i?O(r,i):r},this.computeStyle=function(n,i,r){return _e(i)||(r=i,i=[]),t.style(i||[],O({},r,n||{}))}}const XE={__init__:["defaultRenderer"],defaultRenderer:["type",Zi],styles:["type",KE]};function wt(e,t){if(!e||!t)return-1;var n=e.indexOf(t);return n!==-1&&e.splice(n,1),n}function St(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 ol(e,t){return!e||!t?-1:e.indexOf(t)}function Qo(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=Qo(e,t);return Math.abs(r/o)<=i}var ZE=2;function Ai(e,t){var n=Array.from(arguments).flat();const i={x:"v",y:"h"};for(const[r,o]of Object.entries(i))if(QE(r,n))return o;return!1}function QE(e,t){const n=t[0];return Rr(t,function(i){return Math.abs(n[e]-i[e])<=ZE})}function Rh(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 sl(e,t){return{x:Math.round(e.x+(t.x-e.x)/2),y:Math.round(e.y+(t.y-e.y)/2)}}var JE=/,?([a-z]),?/gi,Ch=parseFloat,Tt=Math,Qi=Tt.PI,pi=Tt.min,fi=Tt.max,Ph=Tt.pow,Ji=Tt.abs,e1=/([a-z])[\s,]*((-?\d*\.?\d*(?:e[-+]?\d+)?[\s]*,?[\s]*)+)/ig,t1=/(-?\d*\.?\d*(?:e[-+]?\d+)?)[\s]*,?[\s]*/ig,Ah=Array.isArray||function(e){return e instanceof Array};function n1(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function i1(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 r1(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 n1(r,i)?(i1(o,i),r[i]):(o.length>=1e3&&delete r[o.shift()],o.push(i),r[i]=e(...arguments),r[i])}return t}function o1(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(e1,function(i,r,o){var a=[],s=r.toLowerCase();for(o.replace(t1,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=ul,n}function a1(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 s1(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 cl(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 ul(){return this.join(",").replace(JE,"$1")}function c1(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=ul,t}function Th(e,t,n,i,r,o,a,s,c){var u=1-c,l=Ph(u,3),p=Ph(u,2),f=c*c,d=f*c,h=l*e+p*3*c*n+u*3*c*c*r+d*a,m=l*t+p*3*c*i+u*3*c*c*o+d*s;return{x:ws(h),y:ws(m)}}function Mh(e){var t=h1(...e);return cl(t.x0,t.y0,t.x1-t.x0,t.y1-t.y0)}function er(e,t,n){return t>=e.x&&t<=e.x+e.width&&n>=e.y&&n<=e.y+e.height}function u1(e,t){return e=cl(e),t=cl(t),er(t,e.x,e.y)||er(t,e.x2,e.y)||er(t,e.x,e.y2)||er(t,e.x2,e.y2)||er(e,t.x,t.y)||er(e,t.x2,t.y)||er(e,t.x,t.y2)||er(e,t.x2,t.y2)||(e.x<t.x2&&e.x>t.x||t.x<e.x2&&t.x>e.x)&&(e.y<t.y2&&e.y>t.y||t.y<e.y2&&t.y>e.y)}function kh(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 Dh(e,t,n,i,r,o,a,s,c){c==null&&(c=1),c=c>1?1:c<0?0:c;for(var u=c/2,l=12,p=[-.1252,.1252,-.3678,.3678,-.5873,.5873,-.7699,.7699,-.9041,.9041,-.9816,.9816],f=[.2491,.2491,.2335,.2335,.2032,.2032,.1601,.1601,.1069,.1069,.0472,.0472],d=0,h=0;h<l;h++){var m=u*p[h]+u,g=kh(m,e,n,r,a),R=kh(m,t,i,o,s),w=g*g+R*R;d+=f[h]*Tt.sqrt(w)}return u*d}function l1(e,t,n,i,r,o,a,s){if(!(fi(e,n)<pi(r,a)||pi(e,n)>fi(r,a)||fi(t,i)<pi(o,s)||pi(t,i)>fi(o,s))){var c=(e*i-t*n)*(r-a)-(e-n)*(r*s-o*a),u=(e*i-t*n)*(o-s)-(t-i)*(r*s-o*a),l=(e-n)*(o-s)-(t-i)*(r-a);if(l){var p=ws(c/l),f=ws(u/l),d=+p.toFixed(2),h=+f.toFixed(2);if(!(d<+pi(e,n).toFixed(2)||d>+fi(e,n).toFixed(2)||d<+pi(r,a).toFixed(2)||d>+fi(r,a).toFixed(2)||h<+pi(t,i).toFixed(2)||h>+fi(t,i).toFixed(2)||h<+pi(o,s).toFixed(2)||h>+fi(o,s).toFixed(2)))return{x:p,y:f}}}}function ws(e){return Math.round(e*1e11)/1e11}function p1(e,t,n){var i=Mh(e),r=Mh(t);if(!u1(i,r))return[];var o=Dh(...e),a=Dh(...t),s=Lh(e)?1:~~(o/5)||1,c=Lh(t)?1:~~(a/5)||1,u=new Array(s+1),l=new Array(c+1),p={},f=[],d,h;for(d=0;d<s+1;d++){var m=Th(...e,d/s);u[d]={x:m.x,y:m.y,t:d/s}}for(d=0;d<c+1;d++)m=Th(...t,d/c),l[d]={x:m.x,y:m.y,t:d/c};for(d=0;d<s;d++)for(h=0;h<c;h++){var g=u[d],R=u[d+1],w=l[h],b=l[h+1],x=Ji(R.x-g.x)<.01?"y":"x",E=Ji(b.x-w.x)<.01?"y":"x",T=l1(g.x,g.y,R.x,R.y,w.x,w.y,b.x,b.y),L;if(T){if(L=T.x.toFixed(9)+"#"+T.y.toFixed(9),p[L])continue;p[L]=!0;var A=g.t+Ji((T[x]-g[x])/(R[x]-g[x]))*(R.t-g.t),j=w.t+Ji((T[E]-w[E])/(b[E]-w[E]))*(b.t-w.t);A>=0&&A<=1&&j>=0&&j<=1&&f.push({x:T.x,y:T.y,t1:A,t2:j})}}return f}function Oh(e,t,n){e=Bh(e),t=Bh(t);for(var i,r,o,a,s,c,u,l,p,f,d=n?0:[],h=0,m=e.length;h<m;h++){var g=e[h];if(g[0]=="M")i=s=g[1],r=c=g[2];else{g[0]=="C"?(p=[i,r,...g.slice(1)],i=p[6],r=p[7]):(p=[i,r,i,r,s,c,s,c],i=s,r=c);for(var R=0,w=t.length;R<w;R++){var b=t[R];if(b[0]=="M")o=u=b[1],a=l=b[2];else{b[0]=="C"?(f=[o,a,...b.slice(1)],o=f[6],a=f[7]):(f=[o,a,o,a,u,l,u,l],o=u,a=l);var x=p1(p,f);{for(var E=0,T=x.length;E<T;E++)x[E].segment1=h,x[E].segment2=R,x[E].bez1=p,x[E].bez2=f;d=d.concat(x)}}}}}return d}function f1(e){return Ah(e)&&Ah(e[0])}function d1(e){if(a1(e))return e;var t=new Array(e.length),n=0,i=0,r=0,o=0,a=0,s;e[0][0]=="M"&&(n=+e[0][1],i=+e[0][2],r=n,o=i,a++,t[0]=["M",n,i]);for(var c,u,l=a,p=e.length;l<p;l++){if(u=e[l],s=u[0],t[l]=c=new Array(u.length),s!=s.toUpperCase())switch(c[0]=s.toUpperCase(),c[0]){case"A":c[1]=u[1],c[2]=u[2],c[3]=u[3],c[4]=u[4],c[5]=u[5],c[6]=+u[6]+n,c[7]=+u[7]+i;break;case"V":c[1]=+u[1]+i;break;case"H":c[1]=+u[1]+n;break;case"M":r=+u[1]+n,o=+u[2]+i;default:for(var f=1,d=u.length;f<d;f++)c[f]=+u[f]+(f%2?n:i)}else for(var h=0,m=u.length;h<m;h++)c[h]=u[h];switch(s=s.toUpperCase(),c[0]){case"Z":n=+r,i=+o;break;case"H":n=c[1];break;case"V":i=c[1];break;case"M":r=c[c.length-2],o=c[c.length-1];default:n=c[c.length-2],i=c[c.length-1]}}return t.toString=ul,t}function Lh(e){return e[0]===e[2]&&e[1]===e[3]&&e[4]===e[6]&&e[5]===e[7]}function Es(e,t,n,i){return[e,t,n,i,n,i]}function Ih(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 Nh(e,t,n,i,r,o,a,s,c,u){var l=Qi*120/180,p=Qi/180*(+r||0),f=[],d,h=r1(function(C,_,y){var D=C*Tt.cos(y)-_*Tt.sin(y),I=C*Tt.sin(y)+_*Tt.cos(y);return{x:D,y:I}});if(u)L=u[0],A=u[1],E=u[2],T=u[3];else{d=h(e,t,-p),e=d.x,t=d.y,d=h(s,c,-p),s=d.x,c=d.y;var m=(e-s)/2,g=(t-c)/2,R=m*m/(n*n)+g*g/(i*i);R>1&&(R=Tt.sqrt(R),n=R*n,i=R*i);var w=n*n,b=i*i,x=(o==a?-1:1)*Tt.sqrt(Ji((w*b-w*g*g-b*m*m)/(w*g*g+b*m*m))),E=x*n*g/i+(e+s)/2,T=x*-i*m/n+(t+c)/2,L=Tt.asin(((t-T)/i).toFixed(9)),A=Tt.asin(((c-T)/i).toFixed(9));L=e<E?Qi-L:L,A=s<E?Qi-A:A,L<0&&(L=Qi*2+L),A<0&&(A=Qi*2+A),a&&L>A&&(L=L-Qi*2),!a&&A>L&&(A=A-Qi*2)}var j=A-L;if(Ji(j)>l){var H=A,N=s,G=c;A=L+l*(a&&A>L?1:-1),s=E+n*Tt.cos(A),c=T+i*Tt.sin(A),f=Nh(s,c,n,i,r,0,a,N,G,[A,H,E,T])}j=A-L;var fe=Tt.cos(L),Fe=Tt.sin(L),lt=Tt.cos(A),Y=Tt.sin(A),de=Tt.tan(j/4),he=4/3*n*de,se=4/3*i*de,ce=[e,t],ee=[e+he*Fe,t-se*fe],F=[s+he*Y,c-se*lt],$=[s,c];if(ee[0]=2*ce[0]-ee[0],ee[1]=2*ce[1]-ee[1],u)return[ee,F,$].concat(f);f=[ee,F,$].concat(f).join().split(",");for(var U=[],ke=0,Lt=f.length;ke<Lt;ke++)U[ke]=ke%2?h(f[ke-1],f[ke],p).y:h(f[ke],f[ke+1],p).x;return U}function h1(e,t,n,i,r,o,a,s){for(var c=[],u=[[],[]],l,p,f,d,h,m,g,R,w=0;w<2;++w){if(w==0?(p=6*e-12*n+6*r,l=-3*e+9*n-9*r+3*a,f=3*n-3*e):(p=6*t-12*i+6*o,l=-3*t+9*i-9*o+3*s,f=3*i-3*t),Ji(l)<1e-12){if(Ji(p)<1e-12)continue;d=-f/p,0<d&&d<1&&c.push(d);continue}g=p*p-4*f*l,R=Tt.sqrt(g),!(g<0)&&(h=(-p+R)/(2*l),0<h&&h<1&&c.push(h),m=(-p-R)/(2*l),0<m&&m<1&&c.push(m))}for(var b=c.length,x=b,E;b--;)d=c[b],E=1-d,u[0][b]=E*E*E*e+3*E*E*d*n+3*E*d*d*r+d*d*d*a,u[1][b]=E*E*E*t+3*E*E*d*i+3*E*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:pi(...u[0]),y0:pi(...u[1]),x1:fi(...u[0]),y1:fi(...u[1])}}function Bh(e){if(f1(e)||(e=o1(e)),s1(e))return e;for(var t=c1(d1(e)),n={x:0,y:0,bx:0,by:0,X:0,Y:0,qx:null,qy:null},i=function(f,d,h){var m,g;if(!f)return["C",d.x,d.y,d.x,d.y,d.x,d.y];switch(!(f[0]in{T:1,Q:1})&&(d.qx=d.qy=null),f[0]){case"M":d.X=f[1],d.Y=f[2];break;case"A":f=["C",...Nh(d.x,d.y,...f.slice(1))];break;case"S":h=="C"||h=="S"?(m=d.x*2-d.bx,g=d.y*2-d.by):(m=d.x,g=d.y),f=["C",m,g,...f.slice(1)];break;case"T":h=="Q"||h=="T"?(d.qx=d.x*2-d.qx,d.qy=d.y*2-d.qy):(d.qx=d.x,d.qy=d.y),f=["C",...Ih(d.x,d.y,d.qx,d.qy,f[1],f[2])];break;case"Q":d.qx=f[1],d.qy=f[2],f=["C",...Ih(d.x,d.y,f[1],f[2],f[3],f[4])];break;case"L":f=["C",...Es(d.x,d.y,f[1],f[2])];break;case"H":f=["C",...Es(d.x,d.y,f[1],d.y)];break;case"V":f=["C",...Es(d.x,d.y,d.x,f[1])];break;case"Z":f=["C",...Es(d.x,d.y,d.X,d.Y)];break}return f},r=function(f,d){if(f[d].length>7){f[d].shift();for(var h=f[d];h.length;)o[d]="A",f.splice(d++,0,["C",...h.splice(0,6)]);f.splice(d,1),u=t.length}},o=[],a="",s="",c=0,u=t.length;c<u;c++){t[c]&&(a=t[c][0]),a!="C"&&(o[c]=a,c&&(s=o[c-1])),t[c]=i(t[c],n,s),o[c]!="A"&&a=="C"&&(o[c]="C"),r(t,c);var l=t[c],p=l.length;n.x=l[p-2],n.y=l[p-1],n.bx=Ch(l[p-4])||n.x,n.by=Ch(l[p-3])||n.y}return t}function it(e){return Gt(e)&&En(e,"waypoints")}function Me(e){return Gt(e)&&En(e,"labelTarget")}function m1(e){return Gt(e)&&Xr(e.parent)}function $h(e){return{x:Math.round(e.x),y:Math.round(e.y),width:Math.round(e.width),height:Math.round(e.height)}}function Ti(e){return{x:Math.round(e.x),y:Math.round(e.y)}}function ye(e){return{top:e.y,right:e.x+(e.width||0),bottom:e.y+(e.height||0),left:e.x}}function Ss(e){return{x:e.left,y:e.top,width:e.right-e.left,height:e.bottom-e.top}}function g1(e){return Ti({x:e.x+(e.width||0)/2,y:e.y+(e.height||0)/2})}function y1(e){for(var t=e.waypoints,n=t.reduce(function(u,l,p){var f=t[p-1];if(f){var d=u[u.length-1],h=d&&d.endLength||0,m=b1(f,l);u.push({start:f,end:l,startLength:h,endLength:h+m,length:m})}return u},[]),i=n.reduce(function(u,l){return u+l.length},0),r=i/2,o=0,a=n[o];a.endLength<r;)a=n[++o];var s=(r-a.startLength)/a.length,c={x:a.start.x+(a.end.x-a.start.x)*s,y:a.start.y+(a.end.y-a.start.y)*s};return c}function be(e){return it(e)?y1(e):g1(e)}function Zt(e,t,n){n=n||0,Gt(n)||(n={x:n,y:n});var i=ye(e),r=ye(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 Jo(e,t,n){var i=v1(e,t);return i.length===1||i.length===2&&Qo(i[0],i[1])<1?Ti(i[0]):i.length>1?(i=oi(i,function(r){var o=Math.floor(r.t2*100)||1;return o=100-o,o=(o<10?"0":"")+o,r.segment2+"#"+o}),Ti(i[n?0:i.length-1])):null}function v1(e,t){return Oh(e,t)}function _1(e){e=e.slice();for(var t=0,n,i,r;e[t];)n=e[t],i=e[t-1],r=e[t+1],Qo(n,r)===0||al(i,r,n)?e.splice(t,1):t++;return e}function b1(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function Rs(e,t){return Math.round(e*t)/t}function jh(e){return we(e)?e+"px":e}function x1(e){for(;e.parent;)e=e.parent;return e}function w1(e){e=O({},{width:"100%",height:"100%"},e);const t=e.container||document.body,n=document.createElement("div");return n.setAttribute("class","djs-container djs-parent"),mn(n,{position:"relative",overflow:"hidden",width:jh(e.width),height:jh(e.height)}),t.appendChild(n),n}function Fh(e,t,n){const i=me("g");je(i).add(t);const r=n!==void 0?n:e.childNodes.length-1;return e.insertBefore(i,e.childNodes[r]||null),i}const E1="base",Hh=0,S1=1,R1={shape:["x","y","width","height"],connection:["waypoints"]};function xe(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||{})}xe.$inject=["config.canvas","eventBus","graphicsFactory","elementRegistry"],xe.prototype._init=function(e){const t=this._eventBus,n=this._container=w1(e),i=this._svg=me("svg");re(i,{width:"100%",height:"100%"}),an(i,"tabindex",0),e.autoFocus&&t.on("element.hover",()=>{this.restoreFocus()}),t.on("element.mousedown",500,o=>{this.focus()}),i.addEventListener("focusin",()=>{this._setFocused(!0)}),i.addEventListener("focusout",()=>{this._setFocused(!1)}),i.addEventListener("mouseover",()=>{this._eventBus.fire("canvas.mouseover")}),i.addEventListener("mouseout",()=>{this._eventBus.fire("canvas.mouseout")}),Re(n,i);const r=this._viewport=Fh(i,"viewport");e.deferUpdate&&(this._viewboxChanged=Ru(this._viewboxChanged,300)),this._restoreFocus=Ru(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)},xe.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},xe.prototype._setFocused=function(e){e!=this._focused&&(this._focused=e,this._eventBus.fire("canvas.focus.changed",{focused:e}))},xe.prototype._clear=function(){this._elementRegistry.getAll().forEach(t=>{const n=Eh(t);n==="root"?this.removeRootElement(t):this._removeElement(t,n)}),this._planes=[],this._rootElement=null,delete this._cachedViewbox},xe.prototype.focus=function(){this._svg.focus({preventScroll:!0}),this._setFocused(!0)},xe.prototype.restoreFocus=function(){this._restoreFocus()},xe.prototype._restoreFocus=function(){document.activeElement===document.body&&this.focus()},xe.prototype.isFocused=function(){return this._focused},xe.prototype.getDefaultLayer=function(){return this.getLayer(E1,Hh)},xe.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},xe.prototype._getChildIndex=function(e){return Sn(this._layers,function(t,n){return n.visible&&e>=n.index&&t++,t},0)},xe.prototype._createLayer=function(e,t){typeof t>"u"&&(t=S1);const n=this._getChildIndex(t);return{group:Fh(this._viewport,"layer-"+e,n),index:t,visible:!0}},xe.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},xe.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&&(Ft(n),t.visible=!1),n},xe.prototype._removeLayer=function(e){const t=this._layers[e];t&&(delete this._layers[e],Ft(t.group))},xe.prototype.getActiveLayer=function(){const e=this._findPlaneForRoot(this.getRootElement());return e?e.layer:null},xe.prototype.findRoot=function(e){const t=this._resolveElements(e);let n;for(const i of t){const r=this._findPlaneForRoot(x1(i));if(!r||n&&r.rootElement!==n)return;n=r.rootElement}return n},xe.prototype.getRootElements=function(){return this._planes.map(function(e){return e.rootElement})},xe.prototype._findPlaneForRoot=function(e){return st(this._planes,function(t){return t.rootElement===e})},xe.prototype._resolveElement=function(e){return typeof e=="string"?this._elementRegistry.get(e):e},xe.prototype._resolveElements=function(e){return _e(e)||(e=[e]),e.map(t=>this._resolveElement(t)).filter(Boolean)},xe.prototype.getContainer=function(){return this._container},xe.prototype._updateMarker=function(e,t,n){let i;e=this._resolveElement(e),e.markers=e.markers||new Set,i=this._elementRegistry._elements[e.id],i&&(M([i.gfx,i.secondaryGfx],function(r){r&&(n?(e.markers.add(t),je(r).add(t)):(e.markers.delete(t),je(r).remove(t)))}),this._eventBus.fire("element.marker.update",{element:e,gfx:i.gfx,marker:t,add:!!n}))},xe.prototype.addMarker=function(e,t){this._updateMarker(e,t,!0)},xe.prototype.removeMarker=function(e,t){this._updateMarker(e,t,!1)},xe.prototype.hasMarker=function(e,t){return e=this._resolveElement(e),e.markers?e.markers.has(t):!1},xe.prototype.toggleMarker=function(e,t){this.hasMarker(e,t)?this.removeMarker(e,t):this.addMarker(e,t)},xe.prototype.getRootElement=function(){const e=this._rootElement;return e||this._planes.length?e:this.setRootElement(this.addRootElement(null))},xe.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,Hh);return this.hideLayer(n),this._addRoot(e,i),this._planes.push({rootElement:e,layer:i}),e},xe.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},xe.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},xe.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)},xe.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})},xe.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})},xe.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=R1[e];if(!Rr(n,function(r){return typeof t[r]<"u"}))throw new Error("must supply { "+n.join(", ")+" } with "+e)},xe.prototype._setParent=function(e,t,n){St(t.children,e,n),e.parent=t},xe.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},xe.prototype.addShape=function(e,t,n){return this._addElement("shape",e,t,n)},xe.prototype.addConnection=function(e,t,n){return this._addElement("connection",e,t,n)},xe.prototype._removeElement=function(e,t){const n=this._elementRegistry,i=this._graphicsFactory,r=this._eventBus;if(e=n.get(e.id||e),!!e)return r.fire(t+".remove",{element:e}),i.remove(e),wt(e.parent&&e.parent.children,e),e.parent=null,r.fire(t+".removed",{element:e}),n.remove(e),e},xe.prototype.removeShape=function(e){return this._removeElement(e,"shape")},xe.prototype.removeConnection=function(e){return this._removeElement(e,"connection")},xe.prototype.getGraphics=function(e,t){return this._elementRegistry.getGraphics(e,t)},xe.prototype._changeViewbox=function(e){this._eventBus.fire("canvas.viewbox.changing"),e.apply(this),this._cachedViewbox=null,this._viewboxChanged()},xe.prototype._viewboxChanged=function(){this._eventBus.fire("canvas.viewbox.changed",{viewbox:this.viewbox()})},xe.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);qo(t,l)});else return o=this._rootElement?this.getActiveLayer():null,i=o&&o.getBBox()||{},a=qo(t),r=a?a.matrix:ME(),s=Rs(r.a,1e3),c=Rs(-r.e||0,1e3),u=Rs(-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},xe.prototype.scroll=function(e){const t=this._viewport;let n=t.getCTM();return e&&this._changeViewbox(function(){e=O({dx:0,dy:0},e||{}),n=this._svg.createSVGMatrix().translate(e.dx,e.dy).multiply(n),zh(t,n)}),{x:n.e,y:n.f}},xe.prototype.scrollToElement=function(e,t){let n=100;const i=this._resolveElements(e);if(!i.length)return;const r=this.findRoot(i);if(!r)return;r!==this.getRootElement()&&this.setRootElement(r);const o=i.filter(h=>h!=r);if(!o.length)return;t||(t={}),typeof t=="number"&&(n=t),t={top:t.top||n,right:t.right||n,bottom:t.bottom||n,left:t.left||n};const a=At(o),s=ye(a),c=this.viewbox(),u=this.zoom();let l,p;c.y+=t.top/u,c.x+=t.left/u,c.width-=(t.right+t.left)/u,c.height-=(t.bottom+t.top)/u;const f=ye(c);if(!(a.width<c.width&&a.height<c.height))l=a.x-c.x,p=a.y-c.y;else{const h=Math.max(0,s.right-f.right),m=Math.min(0,s.left-f.left),g=Math.max(0,s.bottom-f.bottom),R=Math.min(0,s.top-f.top);l=h||m,p=g||R}this.scroll({dx:-l*u,dy:-p*u})},xe.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)}),Rs(i.a,1e3)};function zh(e,t){const n="matrix("+t.a+","+t.b+","+t.c+","+t.d+","+t.e+","+t.f+")";e.setAttribute("transform",n)}xe.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},xe.prototype._setZoom=function(e,t){const n=this._svg,i=this._viewport,r=n.createSVGMatrix(),o=n.createSVGPoint();let a,s,c,u,l;c=i.getCTM();const p=c.a;return t?(a=O(o,t),s=a.matrixTransform(c.inverse()),u=r.translate(s.x,s.y).scale(1/p*e).translate(-s.x,-s.y),l=c.multiply(u)):l=r.scale(e),zh(this._viewport,l),l},xe.prototype.getSize=function(){return{width:this._container.clientWidth,height:this._container.clientHeight}},xe.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}},xe.prototype.resized=function(){delete this._cachedViewbox,this._eventBus.fire("canvas.resized")};var so="data-element-id";function Bn(e){this._elements={},this._eventBus=e}Bn.$inject=["eventBus"],Bn.prototype.add=function(e,t,n){var i=e.id;this._validateId(i),re(t,so,i),n&&re(n,so,i),this._elements[i]={element:e,gfx:t,secondaryGfx:n}},Bn.prototype.remove=function(e){var t=this._elements,n=e.id||e,i=n&&t[n];i&&(re(i.gfx,so,""),i.secondaryGfx&&re(i.secondaryGfx,so,""),delete t[n])},Bn.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)},Bn.prototype.updateGraphics=function(e,t,n){var i=e.id||e,r=this._elements[i];return n?r.secondaryGfx=t:r.gfx=t,t&&re(t,so,i),t},Bn.prototype.get=function(e){var t;typeof e=="string"?t=e:t=e&&re(e,so);var n=this._elements[t];return n&&n.element},Bn.prototype.filter=function(e){var t=[];return this.forEach(function(n,i){e(n,i)&&t.push(n)}),t},Bn.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}},Bn.prototype.getAll=function(){return this.filter(function(e){return e})},Bn.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)})},Bn.prototype.getGraphics=function(e,t){var n=e.id||e,i=this._elements[n];return i&&(t?i.secondaryGfx:i.gfx)},Bn.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 C1(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 P1(e){return e.__refs_collection===!0}function A1(e,t){return Object.prototype.hasOwnProperty.call(e,t.name||t)}function Vh(e,t,n){var i=C1(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 T1(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 Vn(e,t){if(!(this instanceof Vn))return new Vn(e,t);e.inverse=t,t.inverse=e,this.props={},this.props[e.name]=e,this.props[t.name]=t}Vn.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?Vh(this,t,e):T1(this,t,e)},Vn.prototype.ensureRefsCollection=function(e,t){var n=e[t.name];return P1(n)||Vh(this,t,e),n},Vn.prototype.ensureBound=function(e,t){A1(e,t)||this.bind(e,t)},Vn.prototype.unset=function(e,t,n){e&&(this.ensureBound(e,t),t.collection?this.ensureRefsCollection(e,t).remove(n):e[t.name]=void 0)},Vn.prototype.set=function(e,t,n){e&&(this.ensureBound(e,t),t.collection?this.ensureRefsCollection(e,t).add(n):e[t.name]=n)};var ll=new Vn({name:"children",enumerable:!0,collection:!0},{name:"parent"}),Gh=new Vn({name:"labels",enumerable:!0,collection:!0},{name:"labelTarget"}),Wh=new Vn({name:"attachers",collection:!0},{name:"host"}),Uh=new Vn({name:"outgoing",collection:!0},{name:"source"}),Yh=new Vn({name:"incoming",collection:!0},{name:"target"});function co(){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)}}),ll.bind(this,"parent"),Gh.bind(this,"labels"),Uh.bind(this,"outgoing"),Yh.bind(this,"incoming")}function ea(){co.call(this),ll.bind(this,"children"),Wh.bind(this,"host"),Wh.bind(this,"attachers")}ie(ea,co);function qh(){co.call(this),ll.bind(this,"children")}ie(qh,ea);function Kh(){ea.call(this),Gh.bind(this,"labelTarget")}ie(Kh,ea);function Xh(){co.call(this),Uh.bind(this,"source"),Yh.bind(this,"target")}ie(Xh,co);var M1={connection:Xh,shape:ea,label:Kh,root:qh};function k1(e,t){var n=M1[e];if(!n)throw new Error("unknown type: <"+e+">");return O(new n,t)}function D1(e){return e instanceof co}function Mi(){this._uid=12}Mi.prototype.createRoot=function(e){return this.create("root",e)},Mi.prototype.createLabel=function(e){return this.create("label",e)},Mi.prototype.createShape=function(e){return this.create("shape",e)},Mi.prototype.createConnection=function(e){return this.create("connection",e)},Mi.prototype.create=function(e,t){return t=O({},t||{}),t.id||(t.id=e+"_"+this._uid++),k1(e,t)};var Cs="__fn",Zh=1e3,O1=Array.prototype.slice;function Pn(){this._listeners={},this.on("diagram.destroy",1,this._destroy,this)}Pn.prototype.on=function(e,t,n,i){if(e=_e(e)?e:[e],Wt(t)&&(i=n,n=t,t=Zh),!we(t))throw new Error("priority must be a number");var r=n;i&&(r=vn(n,i),r[Cs]=n[Cs]||n);var o=this;e.forEach(function(a){o._addListener(a,{priority:t,callback:r,next:null})})},Pn.prototype.once=function(e,t,n,i){var r=this;if(Wt(t)&&(i=n,n=t,t=Zh),!we(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[Cs]=n,this.on(e,t,o)},Pn.prototype.off=function(e,t){e=_e(e)?e:[e];var n=this;e.forEach(function(i){n._removeListener(i,t)})},Pn.prototype.createEvent=function(e){var t=new ta;return t.init(e),t},Pn.prototype.fire=function(e,t){var n,i,r,o;if(o=O1.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 ta?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}},Pn.prototype.handleError=function(e){return this.fire("error",{error:e})===!1},Pn.prototype._destroy=function(){this._listeners={}},Pn.prototype._invokeListeners=function(e,t,n){for(var i;n&&!e.cancelBubble;)i=this._invokeListener(e,t,n),n=n.next;return i},Pn.prototype._invokeListener=function(e,t,n){var i;if(n.callback.__isTomb)return i;try{i=L1(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},Pn.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},Pn.prototype._getListeners=function(e){return this._listeners[e]},Pn.prototype._setListeners=function(e,t){this._listeners[e]=t},Pn.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[Cs]===t)&&(r?r.next=i:this._setListeners(e,i)),r=n,n=i};function ta(){}ta.prototype.stopPropagation=function(){this.cancelBubble=!0},ta.prototype.preventDefault=function(){this.defaultPrevented=!0},ta.prototype.init=function(e){O(this,e||{})};function L1(e,t){return e.apply(null,t)}function Lr(e){return e.childNodes[0]}function I1(e){return e.parentNode.childNodes[1]}function Ps(e,t,n,i,r){var o=Yo();o.setTranslate(t,n);var a=Yo();a.setRotate(i||0,0,0);var s=Yo();s.setScale(1,1),qo(e,[o,a,s])}function Qt(e,t,n){var i=Yo();i.setTranslate(t,n),qo(e,i)}function Qh(e,t){var n=Yo();n.setRotate(t,0,0),qo(e,n)}function $n(e,t){this._eventBus=e,this._elementRegistry=t}$n.$inject=["eventBus","elementRegistry"],$n.prototype._getChildrenContainer=function(e){var t=this._elementRegistry.getGraphics(e),n;return e.parent?(n=I1(t),n||(n=me("g"),je(n).add("djs-children"),Re(t.parentNode,n))):n=t,n},$n.prototype._clear=function(e){var t=Lr(e);return ms(t),t},$n.prototype._createContainer=function(e,t,n,i){var r=me("g");je(r).add("djs-group"),typeof n<"u"?N1(r,t,t.childNodes[n]):Re(t,r);var o=me("g");je(o).add("djs-element"),je(o).add("djs-"+e),i&&je(o).add("djs-frame"),Re(r,o);var a=me("g");return je(a).add("djs-visual"),Re(o,a),o},$n.prototype.create=function(e,t,n){var i=this._getChildrenContainer(t.parent);return this._createContainer(e,i,n,Sh(t))},$n.prototype.updateContainments=function(e){var t=this,n=this._elementRegistry,i;i=Sn(e,function(r,o){return o.parent&&(r[o.parent.id]=o.parent),r},{}),M(i,function(r){var o=r.children;if(o){var a=t._getChildrenContainer(r),s=a.firstChild;M(o,function(c){var u=n.getGraphics(c).parentNode;u===s?s=s.nextSibling:a.insertBefore(u,s)})}})},$n.prototype.drawShape=function(e,t,n={}){var i=this._eventBus;return i.fire("render.shape",{gfx:e,element:t,attrs:n})},$n.prototype.getShapePath=function(e){var t=this._eventBus;return t.fire("render.getShapePath",e)},$n.prototype.drawConnection=function(e,t,n={}){var i=this._eventBus;return i.fire("render.connection",{gfx:e,element:t,attrs:n})},$n.prototype.getConnectionPath=function(e){var t=this._eventBus;return t.fire("render.getConnectionPath",e)},$n.prototype.update=function(e,t,n){if(t.parent){var i=this._clear(n);if(e==="shape")this.drawShape(i,t),Qt(n,t.x,t.y);else if(e==="connection")this.drawConnection(i,t);else throw new Error("unknown type: "+e);t.hidden?re(n,"display","none"):re(n,"display","block")}},$n.prototype.remove=function(e){var t=this._elementRegistry.getGraphics(e);Ft(t.parentNode)};function N1(e,t,n){var i=n||t.firstChild;e!==i&&t.insertBefore(e,i)}const B1={__depends__:[XE],__init__:["canvas"],canvas:["type",xe],elementRegistry:["type",Bn],elementFactory:["type",Mi],eventBus:["type",Pn],graphicsFactory:["type",$n]};function $1(e){var t=new wh(e);return t.init(),t}function j1(e){e=e||{};var t={config:["value",e]},n=[t,B1].concat(e.modules||[]);return $1(n)}function tr(e,t){this._injector=t||j1(e),this.get("eventBus").fire("diagram.init")}tr.prototype.get=function(e,t){return this._injector.get(e,t)},tr.prototype.invoke=function(e,t,n){return this._injector.invoke(e,t,n)},tr.prototype.destroy=function(){this.get("eventBus").fire("diagram.destroy")},tr.prototype.clear=function(){this.get("eventBus").fire("diagram.clear")};function sn(e){return e?"<"+e.$type+(e.id?' id="'+e.id:"")+'" />':"<null>"}function _n(e,t){return e.$instanceOf(t)}function F1(e){return st(e.rootElements,function(t){return _n(t,"bpmn:Process")||_n(t,"bpmn:Collaboration")})}function H1(e){var t={},n=[],i={};function r(F,$){return function(U){F(U,$)}}function o(F){t[F.id]=F}function a(F){return t[F.id]}function s(F,$){var U=F.gfx;if(U)throw new Error(`already rendered ${sn(F)}`);return e.element(F,i[F.id],$)}function c(F,$){return e.root(F,i[F.id],$)}function u(F,$){try{var U=i[F.id]&&s(F,$);return o(F),U}catch(ke){l(ke.message,{element:F,error:ke}),console.error(`failed to import ${sn(F)}`,ke)}}function l(F,$){e.error(F,$)}var p=this.registerDi=function($){var U=$.bpmnElement;U?i[U.id]?l(`multiple DI elements defined for ${sn(U)}`,{element:U}):i[U.id]=$:l(`no bpmnElement referenced in ${sn($)}`,{element:$})};function f(F){d(F.plane)}function d(F){p(F),M(F.planeElement,h)}function h(F){p(F)}this.handleDefinitions=function($,U){var ke=$.diagrams;if(U&&ke.indexOf(U)===-1)throw new Error("diagram not part of <bpmn:Definitions />");if(!U&&ke&&ke.length&&(U=ke[0]),!U)throw new Error("no diagram to display");i={},f(U);var Lt=U.plane;if(!Lt)throw new Error(`no plane for ${sn(U)}`);var C=Lt.bpmnElement;if(!C)if(C=F1($),C)l(`correcting missing bpmnElement on ${sn(Lt)} to ${sn(C)}`),Lt.bpmnElement=C,p(Lt);else throw new Error("no process or collaboration to display");var _=c(C,Lt);if(_n(C,"bpmn:Process")||_n(C,"bpmn:SubProcess"))g(C,_);else if(_n(C,"bpmn:Collaboration"))ce(C,_),R($.rootElements,_);else throw new Error(`unsupported bpmnElement for ${sn(Lt)}: ${sn(C)}`);m(n)};var m=this.handleDeferred=function(){for(var $;n.length;)$=n.shift(),$()};function g(F,$){de(F,$),j(F.ioSpecification,$),A(F.artifacts,$),o(F)}function R(F,$){var U=Oe(F,function(ke){return!a(ke)&&_n(ke,"bpmn:Process")&&ke.laneSets});U.forEach(r(g,$))}function w(F,$){u(F,$)}function b(F,$){M(F,r(w,$))}function x(F,$){u(F,$)}function E(F,$){u(F,$)}function T(F,$){u(F,$)}function L(F,$){u(F,$)}function A(F,$){M(F,function(U){_n(U,"bpmn:Association")?n.push(function(){L(U,$)}):L(U,$)})}function j(F,$){F&&(M(F.dataInputs,r(E,$)),M(F.dataOutputs,r(T,$)))}var H=this.handleSubProcess=function($,U){de($,U),A($.artifacts,U)};function N(F,$){var U=u(F,$);_n(F,"bpmn:SubProcess")&&H(F,U||$),_n(F,"bpmn:Activity")&&j(F.ioSpecification,$),n.push(function(){M(F.dataInputAssociations,r(x,$)),M(F.dataOutputAssociations,r(x,$))})}function G(F,$){u(F,$)}function fe(F,$){u(F,$)}function Fe(F,$){n.push(function(){var U=u(F,$);F.childLaneSet&&lt(F.childLaneSet,U||$),ee(F)})}function lt(F,$){M(F.lanes,r(Fe,$))}function Y(F,$){M(F,r(lt,$))}function de(F,$){he(F.flowElements,$),F.laneSets&&Y(F.laneSets,$)}function he(F,$){M(F,function(U){_n(U,"bpmn:SequenceFlow")?n.push(function(){G(U,$)}):_n(U,"bpmn:BoundaryEvent")?n.unshift(function(){N(U,$)}):_n(U,"bpmn:FlowNode")?N(U,$):_n(U,"bpmn:DataObject")||(_n(U,"bpmn:DataStoreReference")||_n(U,"bpmn:DataObjectReference")?fe(U,$):l(`unrecognized flowElement ${sn(U)} in context ${sn($&&$.businessObject)}`,{element:U,context:$}))})}function se(F,$){var U=u(F,$),ke=F.processRef;ke&&g(ke,U||$)}function ce(F,$){M(F.participants,r(se,$)),n.push(function(){b(F.messageFlows,$)}),A(F.artifacts,$)}function ee(F){M(F.flowNodeRef,function($){var U=$.get("lanes");U&&U.push(F)})}}function v(e,t){var n=Z(e);return n&&typeof n.$instanceOf=="function"&&n.$instanceOf(t)}function De(e,t){return Vi(t,function(n){return v(e,n)})}function Z(e){return e&&e.businessObject||e}function Ve(e){return e&&e.di}function z1(e,t,n){var i,r,o,a,s=[];function c(u,l){var p={root:function(m,g){return i.add(m,g)},element:function(m,g,R){return i.add(m,g,R)},error:function(m,g){s.push({message:m,context:g})}},f=new H1(p);l=l||u.diagrams&&u.diagrams[0];var d=V1(u,l);if(!d)throw new Error("no diagram to display");M(d,function(m){f.handleDefinitions(u,m)});var h=l.plane.bpmnElement.id;o.setRootElement(o.findRoot(h+"_plane")||o.findRoot(h))}return new Promise(function(u,l){try{return i=e.get("bpmnImporter"),r=e.get("eventBus"),o=e.get("canvas"),r.fire("import.render.start",{definitions:t}),c(t,n),r.fire("import.render.complete",{error:a,warnings:s}),u({warnings:s})}catch(p){return p.warnings=s,l(p)}})}function V1(e,t){if(!(!t||!t.plane)){var n=t.plane.bpmnElement,i=n;!v(n,"bpmn:Process")&&!v(n,"bpmn:Collaboration")&&(i=G1(n));var r;v(i,"bpmn:Collaboration")?r=i:r=st(e.rootElements,function(u){if(v(u,"bpmn:Collaboration"))return st(u.participants,function(l){return l.processRef===i})});var o=[i];r&&(o=rn(r.participants,function(u){return u.processRef}),o.push(r));var a=Jh(o),s=[t],c=[n];return M(e.diagrams,function(u){if(u.plane){var l=u.plane.bpmnElement;a.indexOf(l)!==-1&&c.indexOf(l)===-1&&(s.push(u),c.push(l))}}),s}}function Jh(e){var t=[];return M(e,function(n){n&&(t.push(n),t=t.concat(Jh(n.flowElements)))}),t}function G1(e){for(var t=e;t;){if(v(t,"bpmn:Process"))return t;t=t.$parent}}var W1='<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>',em=W1,tm={verticalAlign:"middle"},nm={color:"#404040"},U1={zIndex:"1001",position:"fixed",top:"0",left:"0",right:"0",bottom:"0"},Y1={width:"100%",height:"100%",background:"rgba(40,40,40,0.2)"},q1={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"},K1='<div class="bjs-powered-by-lightbox"><div class="backdrop"></div><div class="notice"><a href="https://bpmn.io" target="_blank" rel="noopener" class="link">'+em+'</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>',di;function X1(){di=ut(K1),mn(di,U1),mn(et("svg",di),tm),mn(et(".backdrop",di),Y1),mn(et(".notice",di),q1),mn(et(".link",di),nm,{margin:"15px 20px 15px 10px",alignSelf:"center"})}function Z1(){di||(X1(),Cn.bind(di,".backdrop","click",function(e){document.body.removeChild(di)})),document.body.appendChild(di)}const As=5,im="djs-outline-hidden";function yt(e){e=O({},J1,e),this._moddle=this._createModdle(e),this._container=this._createContainer(e),this._init(this._container,this._moddle,e),tS(this._container)}ie(yt,tr),yt.prototype.importXML=async function(t,n){const i=this;function r(a){return i.get("eventBus").createEvent(a)}let o=[];try{t=this._emit("import.parse.start",{xml:t})||t;let a;try{a=await this._moddle.fromXML(t,"bpmn:Definitions")}catch(f){throw this._emit("import.parse.complete",{error:f}),f}let s=a.rootElement;const c=a.references,u=a.warnings,l=a.elementsById;o=o.concat(u),s=this._emit("import.parse.complete",r({error:null,definitions:s,elementsById:l,references:c,warnings:o}))||s;const p=await this.importDefinitions(s,n);return o=o.concat(p.warnings),this._emit("import.done",{error:null,warnings:o}),{warnings:o}}catch(a){let s=a;throw o=o.concat(s.warnings||[]),Ts(s,o),s=Q1(s),this._emit("import.done",{error:s,warnings:s.warnings}),s}},yt.prototype.importDefinitions=async function(t,n){return this._setDefinitions(t),{warnings:(await this.open(n)).warnings}},yt.prototype.open=async function(t){const n=this._definitions;let i=t;if(!n){const o=new Error("no XML imported");throw Ts(o,[]),o}if(typeof t=="string"&&(i=eS(n,t),!i)){const o=new Error("BPMNDiagram <"+t+"> not found");throw Ts(o,[]),o}try{this.clear()}catch(o){throw Ts(o,[]),o}const{warnings:r}=await z1(this,n,i);return{warnings:r}},yt.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},yt.prototype.saveSVG=async function(){this._emit("saveSVG.start");let t,n;try{const i=this.get("canvas"),r=i.getActiveLayer(),o=et(":scope > defs",i._svg),a=xh(r),s=o?"<defs>"+xh(o)+"</defs>":"",c=i.getContainer();mt(c).add(im);let u;try{u=r.getBBox()}finally{mt(c).remove(im)}const l=u.x-As,p=u.y-As,f=u.width+As*2,d=u.height+As*2;t=`<?xml version="1.0" encoding="utf-8"?>
1
+ (function(Q,Ct){typeof exports=="object"&&typeof module<"u"?Ct(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],Ct):(Q=typeof globalThis<"u"?globalThis:Q||self,Ct(Q.BpmnModeler={},Q.Vue))})(this,(function(Q,Ct){"use strict";var eO=Object.defineProperty;var tO=(Q,Ct,wi)=>Ct in Q?eO(Q,Ct,{enumerable:!0,configurable:!0,writable:!0,value:wi}):Q[Ct]=wi;var Kr=(Q,Ct,wi)=>tO(Q,typeof Ct!="symbol"?Ct+"":Ct,wi);const wi=["startEvent","endEvent","userTask","serviceTask","task","sendTask","receiveTask","exclusiveGateway","parallelGateway"];function jf(e){return wi.includes(e)}const Ff="http://g1project.net/spec/bpmn/bwl/1.0",bu="bwl",xu=["top-left","top","top-right","right","bottom-right","bottom","bottom-left","left"],Hf={name:"bwl-hints",uri:Ff,prefix:bu,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"}]}]},wu="bwl.undoEpisode",zf=new WeakSet;function Mx(e){zf.has(e)||(e.register(wu,{preExecute(t){try{t.run()}catch(n){t.error=n}}}),zf.add(e))}function Vf(e,t){Mx(e);const n={run:t};if(e.execute(wu,n),n.error!==void 0)throw e.canUndo()&&e.undo(),n.error}const Gf=["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"],kx={description:"생략 = 보존, null = 제거.",anyOf:[{type:"string"},{type:"null"}]},Dx={type:"object",description:"레인. 배열 선언 순서 = 풀 내 상→하 순서.",properties:{id:{type:"string"},name:{type:"string"}},required:["id"],additionalProperties:!1},Ox={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},Lx={type:"object",description:"플로우 노드. 좌표는 지정하지 않는다 — 배치는 resolver 가 결정한다.",properties:{id:{type:"string"},type:{type:"string",enum:[...wi]},name:{type:"string"},participant:{type:"string",description:"소속 풀 id(협업 문서)."},lane:{type:"string",description:"소속 레인 id(풀 정의에 선언된 것)."}},required:["id","type"],additionalProperties:!1},Ix={type:"object",description:"분기 조건 — 게이트웨이가 아닌 플로우에 붙인다. MVP 는 label 만.",properties:{label:{type:"string"}},required:["label"],additionalProperties:!1},Nx={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},Bx={type:"object",description:"메시지 플로우(풀 경계를 넘는 연결 — 노드 또는 블랙박스 풀 자체가 끝점).",properties:{id:{type:"string"},source:{type:"string"},target:{type:"string"},name:{type:"string"}},required:["id","source","target"],additionalProperties:!1},$x={type:"object",properties:{id:{type:"string"},name:{type:"string"}},required:["id"],additionalProperties:!1},jx={type:"object",description:"데이터 입출력 연관. 방향 = source→target(태스크→스토어 = 쓰기, 스토어→태스크 = 읽기).",properties:{id:{type:"string"},source:{type:"string"},target:{type:"string"}},required:["source","target"],additionalProperties:!1},Fx={type:"object",properties:{id:{type:"string"},text:{type:"string"}},required:["id","text"],additionalProperties:!1},Hx={type:"object",description:"연관선(주석 ↔ 요소).",properties:{id:{type:"string"},source:{type:"string"},target:{type:"string"}},required:["source","target"],additionalProperties:!1},zx={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},Vx={type:"object",description:"주석 방위 힌트 — 앵커 요소 기준 상대 배치. 있으면 결정적 배치, 없으면 휴리스틱.",properties:{anchor:{type:"string",description:"기준 요소 id."},side:{type:"string",enum:[...xu]},offset:{type:"number",description:"앵커 가장자리 → 주석 가장자리 간격(px). 생략 시 50."}},required:["anchor","side"],additionalProperties:!1};function nn(e,t){return{type:"object",description:t.description,properties:{kind:{const:e},...t.properties},required:["kind",...t.required??[]],additionalProperties:!1}}const Gx={"participant.add":nn("participant.add",{description:"풀 추가. order = 풀 세로 순서 힌트 — **작을수록 위**(생략 시 op 순서가 곧 배치 순서). 값은 상대 순서만 쓰므로 1,2,3… 연속이든 10,20,30 간격이든 같다.",properties:{participant:{$ref:"#/$defs/irParticipant"},order:{type:"integer"}},required:["participant"]}),"participant.update":nn("participant.update",{description:"풀 이름/레인 갱신. lanes 는 전체 재선언(생략 = 보존) — 기존 레인을 유지하려면 함께 다시 나열한다.",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"},lanes:{type:"array",items:{$ref:"#/$defs/irLane"}}},required:["id"]}),"node.add":nn("node.add",{description:'플로우 노드 추가. band = 가로 밴드 순번 힌트(주 흐름 0, 갈래 1, 2…) — 위/아래가 아니라 "주 흐름에서 몇 번째 갈래"다. 행 배치(어느 갈래가 위/아래인지)는 호스트가 정한다(대칭·메시지 방향). 레인이 있으면 그 레인 안의 밴드다 — 한 레인 안에서 게이트웨이 출구를 갈라 놓을 때 쓴다. 컨테이너(풀·레인)는 밴드 수만큼 자란다.',properties:{node:{$ref:"#/$defs/irNode"},band:{type:"integer",description:"0 이상 정수(음수는 payload-invalid 로 거부)."}},required:["node"]}),"node.update":nn("node.update",{description:"노드 이름/레인/타입 갱신. lane = 레인 재배정(이동), type = 태스크·이벤트 타입 전환.",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"},lane:{type:"string"},type:{type:"string",enum:[...wi]}},required:["id"]}),"sequenceFlow.add":nn("sequenceFlow.add",{description:"시퀀스 플로우 추가. 분기 조건은 게이트웨이가 아닌 플로우의 condition 에 싣는다.",properties:{flow:{$ref:"#/$defs/irSequenceFlow"}},required:["flow"]}),"sequenceFlow.update":nn("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":nn("messageFlow.add",{description:"메시지 플로우 추가(풀 경계를 넘는 연결).",properties:{flow:{$ref:"#/$defs/irMessageFlow"}},required:["flow"]}),"messageFlow.update":nn("messageFlow.update",{description:"메시지 플로우 이름 갱신.",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"}},required:["id"]}),"dataStore.add":nn("dataStore.add",{description:"데이터 스토어 추가(+ 입출력 연관 동반 가능).",properties:{dataStore:{$ref:"#/$defs/irDataStore"},associations:{type:"array",items:{$ref:"#/$defs/irDataAssociation"}}},required:["dataStore"]}),"dataStore.update":nn("dataStore.update",{description:"데이터 스토어 이름 갱신.",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"}},required:["id"]}),"dataAssociation.add":nn("dataAssociation.add",{description:"기존 노드 ↔ 기존 데이터 스토어의 입출력 연관 추가.",properties:{association:{$ref:"#/$defs/irDataAssociation"}},required:["association"]}),"association.add":nn("association.add",{description:"주석 ↔ 요소 연관 추가(한쪽 끝은 주석). 주석 신설과 함께면 annotation.add 의 association 을 쓰고, 이 op 는 추가 연관(한 주석에 여러 연관)용.",properties:{association:{$ref:"#/$defs/irAssociation"}},required:["association"]}),"annotation.add":nn("annotation.add",{description:"텍스트 주석 추가. association 으로 대상 요소와 연결하고, placement 로 방위를 지정하면 결정적 배치된다.",properties:{annotation:{$ref:"#/$defs/irTextAnnotation"},association:{$ref:"#/$defs/irAssociation"},placement:{$ref:"#/$defs/bwlPlacement"}},required:["annotation"]}),"annotation.update":nn("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":nn("group.add",{description:"그룹 추가 — 바운즈는 members 의 bbox 로 산출되므로 좌표를 지정하지 않는다.",properties:{group:{$ref:"#/$defs/irGroup"}},required:["group"]}),"group.update":nn("group.update",{description:"그룹 이름/멤버 갱신. members 는 전체 재선언(생략 = 보존).",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"},members:{type:"array",items:{type:"string"}}},required:["id"]}),"element.remove":nn("element.remove",{description:"요소 제거(카테고리 무관). 부착된 연결선은 함께 제거된다.",properties:{id:{type:"string"}},required:["id"]})},Wf={anyOf:Gf.map(e=>Gx[e])},Wx={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:Dx,irParticipant:Ox,irNode:Lx,irFlowCondition:Ix,irSequenceFlow:Nx,irMessageFlow:Bx,irDataStore:$x,irDataAssociation:jx,irTextAnnotation:Fx,irAssociation:Hx,irGroup:zx,bwlPlacement:Vx,nullableString:kx,symbolicOp:Wf}};function Eu(e){return Array.prototype.concat.apply([],e)}const Ho=Object.prototype.toString,Ux=Object.prototype.hasOwnProperty;function Sr(e){return e===void 0}function $t(e){return e!==void 0}function Xr(e){return e==null}function _e(e){return Ho.call(e)==="[object Array]"}function Gt(e){return Ho.call(e)==="[object Object]"}function we(e){return Ho.call(e)==="[object Number]"}function Wt(e){const t=Ho.call(e);return t==="[object Function]"||t==="[object AsyncFunction]"||t==="[object GeneratorFunction]"||t==="[object AsyncGeneratorFunction]"||t==="[object Proxy]"}function wn(e){return Ho.call(e)==="[object String]"}function Yx(e){if(!_e(e))throw new Error("must supply array")}function En(e,t){return!Xr(e)&&Ux.call(e,t)}function st(e,t){const n=Xa(t);let i;return k(e,function(r,o){if(n(r,o))return i=r,!1}),i}function Uf(e,t){const n=Xa(t);let i=_e(e)?-1:void 0;return k(e,function(r,o){if(n(r,o))return i=o,!1}),i}function Oe(e,t){const n=Xa(t);let i=[];return k(e,function(r,o){n(r,o)&&i.push(r)}),i}function k(e,t){let n,i;if(Sr(e))return;const r=_e(e)?Qx:Zx;for(let o in e)if(En(e,o)&&(n=e[o],i=t(n,r(o)),i===!1))return n}function qx(e,t){if(Sr(e))return[];Yx(e);const n=Xa(t);return e.filter(function(i,r){return!n(i,r)})}function Sn(e,t,n){return k(e,function(i,r){n=t(n,i,r)}),n}function Rr(e,t){return!!Sn(e,function(n,i,r){return n&&t(i,r)},!0)}function Vi(e,t){return!!st(e,t)}function rn(e,t){let n=[];return k(e,function(i,r){n.push(t(i,r))}),n}function Ka(e){return e&&Object.keys(e)||[]}function Kx(e){return Ka(e).length}function Zr(e){return rn(e,t=>t)}function Qr(e,t,n={}){return t=Su(t),k(e,function(i){let r=t(i)||"_",o=n[r];o||(o=n[r]=[]),o.push(i)}),n}function Yf(e,...t){e=Su(e);let n={};return k(t,r=>Qr(r,e,n)),rn(n,function(r,o){return r[0]})}const Xx=Yf;function oi(e,t){t=Su(t);let n=[];return k(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)}),rn(n,i=>i.v)}function Jr(e){return function(t){return Rr(e,function(n,i){return t[i]===n})}}function Su(e){return Wt(e)?e:t=>t[e]}function Xa(e){return Wt(e)?e:t=>t===e}function Zx(e){return e}function Qx(e){return Number(e)}function Ru(e,t){let n,i,r,o;function a(p){let f=Date.now(),d=p?0:o+t-f;if(d>0)return s(d);e.apply(r,i),c()}function s(p){n=setTimeout(a,p)}function c(){n&&clearTimeout(n),n=o=i=r=void 0}function u(){n&&a(!0),c()}function l(...p){o=Date.now(),i=p,r=this,n||s(t)}return l.flush=u,l.cancel=c,l}function vn(e,t){return e.bind(t)}function O(e,...t){return Object.assign(e,...t)}function Jx(e,t,n){let i=e;return k(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];$t(a)&&Xr(s)&&(s=i[r]=isNaN(+a)?{}:[]),Sr(a)?Sr(n)?delete i[r]:i[r]=n:i=s}),e}function ni(e,t){let n={},i=Object(e);return k(t,function(r){r in i&&(n[r]=e[r])}),n}function ai(e,t){let n={},i=Object(e);return k(i,function(r,o){t.indexOf(o)===-1&&(n[o]=r)}),n}function Cu(){}Cu.prototype.get=function(e){return this.$model.properties.get(this,e)},Cu.prototype.set=function(e,t){this.$model.properties.set(this,e,t)};function qf(e,t){this.model=e,this.properties=t}qf.prototype.createType=function(e){var t=this.model,n=this.properties,i=Object.create(Cu.prototype);k(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}),k(a,vn(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 e0=O(Object.create(null),{String:!0,Boolean:!0,Integer:!0,Real:!0,Element:!0}),Kf=O(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 Pu(e,t){var n=Kf[e];return n?n(t):t}function Au(e){return!!e0[e]}function Xf(e){return!!Kf[e]}function on(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 Nn(e){this.ns=e,this.name=e.name,this.allTypes=[],this.allTypesByName=Object.create(null),this.properties=[],this.propertiesByName=Object.create(null)}Nn.prototype.build=function(){return ni(this,["ns","name","allTypes","allTypesByName","properties","propertiesByName","bodyProperty","idProperty"])},Nn.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)},Nn.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},Nn.prototype.redefineProperty=function(e,t,n){var i=e.ns.prefix,r=t.split("#"),o=on(r[0],i),a=on(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},Nn.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},Nn.prototype.removeNamedProperty=function(e){var t=e.ns,n=this.propertiesByName;delete n[t.name],delete n[t.localName]},Nn.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},Nn.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},Nn.prototype.assertNotTrait=function(e){if((e.extends||[]).length)throw new Error(`cannot create <${e.name}> extending <${e.extends}>`)},Nn.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")},Nn.prototype.hasProperty=function(e){return this.propertiesByName[e]},Nn.prototype.addTrait=function(e,t){t&&this.assertNotTrait(e);var n=this.allTypesByName,i=this.allTypes,r=e.name;r in n||(k(e.properties,vn(function(o){o=O({},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 Gi(e,t){this.packageMap=Object.create(null),this.typeMap=Object.create(null),this.packages=[],this.properties=t,k(e,vn(this.registerPackage,this))}Gi.prototype.getPackage=function(e){return this.packageMap[e]},Gi.prototype.getPackages=function(){return this.packages},Gi.prototype.registerPackage=function(e){e=O({},e);var t=this.packageMap;Zf(t,e,"prefix"),Zf(t,e,"uri"),k(e.types,vn(function(n){this.registerType(n,e)},this)),t[e.uri]=t[e.prefix]=e,this.packages.push(e)},Gi.prototype.registerType=function(e,t){e=O({},e,{superClass:(e.superClass||[]).slice(),extends:(e.extends||[]).slice(),properties:(e.properties||[]).slice(),meta:O({},e.meta||{})});var n=on(e.name,t.prefix),i=n.name,r=Object.create(null);k(e.properties,vn(function(o){var a=on(o.name,n.prefix),s=a.name;Au(o.type)||(o.type=on(o.type,a.prefix).name),O(o,{ns:a,name:s}),r[s]=o},this)),O(e,{ns:n,name:i,propertiesByName:r}),k(e.extends,vn(function(o){var a=on(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},Gi.prototype.mapTypes=function(e,t,n){var i=Au(e.name)?{name:e.name}:this.typeMap[e.name],r=this;function o(c,u){var l=on(c,Au(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+">");k(i.superClass,n?a:s),t(i,!n),k(i.traits,a)},Gi.prototype.getEffectiveDescriptor=function(e){var t=on(e),n=new Nn(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},Gi.prototype.definePackage=function(e,t){this.properties.define(e,"$pkg",{value:t})};function Zf(e,t,n){var i=t[n];if(i in e)throw new Error("package with "+n+" <"+i+"> already defined")}function Cr(e){this.model=e}Cr.prototype.set=function(e,t,n){if(!wn(t)||!t.length)throw new TypeError("property name must be a non-empty string");var i=this.getProperty(e,t),r=i&&i.name;t0(n)?i?delete e[r]:delete e.$attrs[Tu(t)]:i?r in e?e[r]=n:Qf(e,i,n):e.$attrs[Tu(t)]=n},Cr.prototype.get=function(e,t){var n=this.getProperty(e,t);if(!n)return e.$attrs[Tu(t)];var i=n.name;return!e[i]&&n.isMany&&Qf(e,n,[]),e[i]},Cr.prototype.define=function(e,t,n){if(!n.writable){var i=n.value;n=O({},n,{get:function(){return i}}),delete n.value}Object.defineProperty(e,t,n)},Cr.prototype.defineDescriptor=function(e,t){this.define(e,"$descriptor",{value:t})},Cr.prototype.defineModel=function(e,t){this.define(e,"$model",{value:t})},Cr.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 t0(e){return typeof e>"u"}function Qf(e,t,n){Object.defineProperty(e,t.name,{enumerable:!t.isReference,writable:!0,value:n,configurable:!0})}function Tu(e){return e.replace(/^:/,"")}function Hn(e,t={}){this.properties=new Cr(this),this.factory=new qf(this,this.properties),this.registry=new Gi(e,this.properties),this.typeCache=Object.create(null),this.config=t}Hn.prototype.create=function(e,t){var n=this.getType(e);if(!n)throw new Error("unknown type <"+e+">");return new n(t)},Hn.prototype.getType=function(e){var t=this.typeCache,n=wn(e)?e:e.ns.name,i=t[n];return i||(e=this.registry.getEffectiveDescriptor(n),i=t[n]=this.factory.createType(e)),i},Hn.prototype.createAny=function(e,t,n){var i=on(e),r={$type:e,$instanceOf:function(a){return a===this.$type},get:function(a){return this[a]},set:function(a,s){Jx(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}),k(n,function(a,s){Gt(a)&&a.value!==void 0?r[a.name]=a.value:r[s]=a}),r},Hn.prototype.getPackage=function(e){return this.registry.getPackage(e)},Hn.prototype.getPackages=function(){return this.registry.getPackages()},Hn.prototype.getElementDescriptor=function(e){return e.$descriptor},Hn.prototype.hasType=function(e,t){t===void 0&&(t=e,e=this);var n=e.$model.getElementDescriptor(e);return t in n.allTypesByName},Hn.prototype.getPropertyDescriptor=function(e,t){return this.getElementDescriptor(e).propertiesByName[t]},Hn.prototype.getTypeDescriptor=function(e){return this.registry.typeMap[e]};var Jf=String.fromCharCode,n0=Object.prototype.hasOwnProperty,i0=/&#(\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 r0(e,t,n,i){return i?n0.call(zo,i)?zo[i]:"&"+i+";":Jf(t||parseInt(n,16))}function Pr(e){return e.length>3&&e.indexOf("&")!==-1?e.replace(i0,r0):e}var ed="non-whitespace outside of root node";function Wi(e){return new Error(e)}function o0(e){return"missing namespace for prefix <"+e+">"}function Za(e){return{get:e,enumerable:!0}}function a0(e){var t=Object.create(null),n;for(n in e)t[n]=e[n];return t}var td=Symbol("nameCache");function Mu(e){return e+"$uri"}function s0(e){var t=Object.create(null),n,i;for(n in e)i=e[n],t[i]=i,t[Mu(i)]=n;return t}function Qa(){return{line:0,column:0}}function c0(e){throw e}function nd(e){if(!this)return new nd(e);var t=e&&e.proxy,n,i,r,o,a=c0,s,c,u,l,p=Qa,f=!1,d=!1,h="",m=!1,g=!1,R=null,w=!1,b,x,E,T;function L(B){B instanceof Error||(B=Wi(B)),R=B,a(B,p)}function A(B){s&&(B instanceof Error||(B=Wi(B)),s(B,p))}this.on=function(B,G){if(typeof G!="function")throw Wi("required args <name, cb>");switch(B){case"openTag":i=G;break;case"text":n=G;break;case"closeTag":r=G;break;case"error":a=G;break;case"warn":s=G;break;case"cdata":o=G;break;case"attention":l=G;break;case"question":u=G;break;case"comment":c=G;break;default:throw Wi("unsupported event: "+B)}return this},this.ns=function(B){if(typeof B>"u"&&(B={}),typeof B!="object")throw Wi("required args <nsMap={}>");var G=Object.create(null),fe;for(fe in B)G[fe]=B[fe];return g=!0,T=G,this};function F(){b=g?[]:null,x=g?s0(T):null,E=[],p=Qa,w=!1,R=null,d=!1,h=""}this.parse=function(B){if(typeof B!="string")throw Wi("required args <xml=string>");if(f)throw Wi("parse during stream; call end() first");return F(),z(B),p=Qa,w=!1,R},this.write=function(B){if(typeof B!="string")throw Wi("required args <xml=string>");return f||(F(),f=!0),R||(h=z(h+B,!0)||""),this},this.end=function(){return f||F(),f=!1,R||z(h),h="",p=Qa,w=!1,R},this.stop=function(){w=!0};function z(B,G=!1){var fe=null,Fe=null,lt,q=0,de=!1,he=!1,ce=0,ue=0,ee,H,$,U,ke,Lt,P,_,y,D="",N=0,W;function ae(tt,It){var un=tt.indexOf(":");if(un===-1)return tt;var ln=x[tt.substring(0,un)];return ln?It===ln?tt.substr(un+1):ln+tt.substr(un):(A(o0(tt.substring(0,un))),null)}function Pe(){if(W!==null)return W;var tt,It,un=g&&x.xmlns,ln=g&&m?[]:null,at=N,Nt=D,pn=Nt.length,jo,fn,Ln,In,Rt,Er={},Fo=new Set,xn,He,Xe;e:for(;at<pn;at++)if(xn=!1,He=Nt.charCodeAt(at),!(He===32||He<14&&He>8)){for((He<65||He>122||He>90&&He<97)&&He!==95&&He!==58&&(A("illegal first char attribute name"),xn=!0),Xe=at+1;Xe<pn;Xe++)if(He=Nt.charCodeAt(Xe),!(He>96&&He<123||He>64&&He<91||He>47&&He<59||He===46||He===45||He===95)){if(He===32||He<14&&He>8){A("missing attribute value"),at=Xe;continue e}if(He===61)break;A("illegal attribute name char"),xn=!0}if(Rt=Nt.substring(at,Xe),Rt==="xmlns:xmlns"&&(A("illegal declaration of xmlns"),xn=!0),He=Nt.charCodeAt(Xe+1),He===34)Xe=Nt.indexOf('"',at=Xe+2),Xe===-1&&(Xe=Nt.indexOf("'",at),Xe!==-1&&(A("attribute value quote missmatch"),xn=!0));else if(He===39)Xe=Nt.indexOf("'",at=Xe+2),Xe===-1&&(Xe=Nt.indexOf('"',at),Xe!==-1&&(A("attribute value quote missmatch"),xn=!0));else for(A("missing attribute value quotes"),xn=!0,Xe=Xe+1;Xe<pn&&(He=Nt.charCodeAt(Xe+1),!(He===32||He<14&&He>8));Xe++);for(Xe===-1&&(A("missing closing quotes"),Xe=pn,xn=!0),xn||(Ln=Nt.substring(at,Xe)),at=Xe;Xe+1<pn&&(He=Nt.charCodeAt(Xe+1),!(He===32||He<14&&He>8));Xe++)at===Xe&&(A("illegal character after attribute end"),xn=!0);if(at=Xe+1,xn)continue e;if(Fo.has(Rt)){A("attribute <"+Rt+"> already defined");continue}if(Fo.add(Rt),!g){Er[Rt]=Ln;continue}if(m){if(fn=Rt==="xmlns"?"xmlns":Rt.charCodeAt(0)===120&&Rt.substr(0,6)==="xmlns:"?Rt.substr(6):null,fn!==null){if(tt=Pr(Ln),It=Mu(fn),In=T[tt],!In){if(fn==="xmlns"||It in x&&x[It]!==tt)do In="ns"+q++;while(typeof x[In]<"u");else In=fn;T[tt]=In}x[fn]!==In&&(jo||(x=a0(x),jo=!0),x[fn]=In,fn==="xmlns"&&(x[Mu(In)]=tt,un=In),x[It]=tt),Er[Rt]=Ln;continue}ln.push(Rt,Ln);continue}Rt=ae(Rt,un),Rt!==null&&(Er[Rt]=Ln)}if(m)for(at=0,pn=ln.length;at<pn;at++)Rt=ae(ln[at++],un),Ln=ln[at],Rt!==null&&(Er[Rt]=Ln);return W=Er}function Ue(){for(var tt=/(\r\n|\r|\n)/g,It=0,un=0,ln=0,at=ue,Nt,pn;ce>=ln&&(Nt=tt.exec(B),!(!Nt||(at=Nt[0].length+Nt.index,at>ce)));)It+=1,ln=at;return ce==-1?(un=at,pn=B.substring(ue)):ue===0?pn=B.substring(ue,ce):(un=ce-ln,pn=ue==-1?B.substring(ce):B.substring(ce,ue+1)),{data:pn,line:It,column:un}}for(p=Ue,t&&(y=Object.create({},{name:Za(function(){return P}),originalName:Za(function(){return _}),attrs:Za(Pe),ns:Za(function(){return x})}));ue!==-1;){if(B.charCodeAt(ue)===60?ce=ue:ce=B.indexOf("<",ue),ce===-1){if(G)return B.substring(ue);if(E.length)return L("unexpected end of file");if(!d)return L("missing start tag");ue<B.length&&B.substring(ue).trim()&&A(ed);return}if(d||(d=!0),ue!==ce){if(E.length){if(n&&(n(B.substring(ue,ce),Pr,p),w))return}else if(B.substring(ue,ce).trim()&&(A(ed),w))return}if(U=B.charCodeAt(ce+1),U===33){if($=B.charCodeAt(ce+2),$===91&&B.substr(ce+3,6)==="CDATA["){if(ue=B.indexOf("]]>",ce),ue===-1)return G?B.substring(ce):L("unclosed cdata");if(o&&(o(B.substring(ce+9,ue),p),w))return;ue+=3;continue}if($===45&&B.charCodeAt(ce+3)===45){if(ue=B.indexOf("-->",ce),ue===-1)return G?B.substring(ce):L("unclosed comment");if(c&&(c(B.substring(ce+4,ue),Pr,p),w))return;ue+=3;continue}}if(U===63){if(ue=B.indexOf("?>",ce),ue===-1)return G?B.substring(ce):L("unclosed question");if(u&&(u(B.substring(ce,ue+2),p),w))return;ue+=2;continue}for(ee=ce+1;;ee++){if(ke=B.charCodeAt(ee),isNaN(ke))return G?B.substring(ce):(ue=-1,L("unclosed tag"));if(ke===34)$=B.indexOf('"',ee+1),ee=$!==-1?$:ee;else if(ke===39)$=B.indexOf("'",ee+1),ee=$!==-1?$:ee;else if(ke===62){ue=ee;break}}if(U===33){if(l&&(l(B.substring(ce,ue+1),Pr,p),w))return;ue+=1;continue}if(W={},U===47){if(de=!1,he=!0,!E.length)return L("missing open tag");if(ee=P=E.pop(),$=ce+2+ee.length,B.substring(ce+2,$)!==ee)return L("closing tag mismatch");for(;$<ue;$++)if(U=B.charCodeAt($),!(U===32||U>8&&U<14))return L("close tag")}else{if(B.charCodeAt(ue-1)===47?(ee=P=B.substring(ce+1,ue-1),de=!0,he=!0):(ee=P=B.substring(ce+1,ue),de=!0,he=!1),!(U>96&&U<123||U>64&&U<91||U===95||U===58))return L("illegal first char nodeName");for($=1,H=ee.length;$<H;$++)if(U=ee.charCodeAt($),!(U>96&&U<123||U>64&&U<91||U>47&&U<59||U===45||U===95||U==46)){if(U===32||U<14&&U>8){P=ee.substring(0,$),W=null;break}return L("invalid nodeName")}he||E.push(P)}if(g){lt=x,de&&(he||b.push(lt),W===null&&(m=ee.indexOf("xmlns",$)!==-1)&&(N=$,D=ee,Pe(),m=!1)),_=P,Fe!==x&&(fe=x[td],fe===void 0&&(fe=x[td]=Object.create(null)),Fe=x);var ft=fe[P];if(ft!==void 0)P=ft;else{if(U=P.indexOf(":"),U!==-1){if(Lt=x[P.substring(0,U)],!Lt)return L("missing namespace on <"+_+">");P=P.substr(U+1)}else Lt=x.xmlns;Lt&&(P=Lt+":"+P),fe[_]=P}}if(de&&(N=$,D=ee,i&&(t?i(y,Pr,he,p):i(P,Pe,Pr,he,p),w)))return;if(he){if(r&&(r(t?y:P,Pr,de,p),w))return;g&&(de?x=lt:x=b.pop())}ue+=1}}}function id(e){return e.xml&&e.xml.tagAlias==="lowerCase"}var ku={xsi:"http://www.w3.org/2001/XMLSchema-instance",xml:"http://www.w3.org/XML/1998/namespace"},rd="property";function od(e){return e.xml&&e.xml.serialize}function u0(e){const t=od(e);return t!==rd&&(t||null)}function l0(e){return e.charAt(0).toUpperCase()+e.slice(1)}function ad(e,t){return id(t)?e.prefix+":"+l0(e.localName):e.name}function p0(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 f0(e,t,n){const i=on(e,t.xmlns),r=`${t[i.prefix]||i.prefix}:${i.localName}`,o=on(r);var a=n.getPackage(o.prefix);return p0(o,a)}function Ui(e){return new Error(e)}function Ei(e){return e.$descriptor}function d0(e){O(this,e),this.elementsById={},this.references=[],this.warnings=[],this.addReference=function(t){this.references.push(t)},this.addElement=function(t){if(!t)throw Ui("expected element");var n=this.elementsById,i=Ei(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 Ui("duplicate ID <"+o+">");n[o]=t}},this.addWarning=function(t){this.warnings.push(t)}}function Vo(){}Vo.prototype.handleEnd=function(){},Vo.prototype.handleText=function(){},Vo.prototype.handleNode=function(){};function Du(){}Du.prototype=Object.create(Vo.prototype),Du.prototype.handleNode=function(){return this};function eo(){}eo.prototype=Object.create(Vo.prototype),eo.prototype.handleText=function(e){this.body=(this.body||"")+e};function Go(e,t){this.property=e,this.context=t}Go.prototype=Object.create(eo.prototype),Go.prototype.handleNode=function(e){if(this.element)throw Ui("expected no sub nodes");return this.element=this.createReference(e),this},Go.prototype.handleEnd=function(){this.element.id=this.body},Go.prototype.createReference=function(e){return{property:this.property.ns.name,id:""}};function Ou(e,t){this.element=t,this.propertyDesc=e}Ou.prototype=Object.create(eo.prototype),Ou.prototype.handleEnd=function(){var e=this.body||"",t=this.element,n=this.propertyDesc;e=Pu(n.type,e),n.isMany?t.get(n.name).push(e):t.set(n.name,e)};function Ja(){}Ja.prototype=Object.create(eo.prototype),Ja.prototype.handleNode=function(e){var t=this,n=this.element;return n?t=this.handleChild(e):(n=this.element=this.createElement(e),this.context.addElement(n)),t};function dn(e,t,n){this.model=e,this.type=e.getType(t),this.context=n}dn.prototype=Object.create(Ja.prototype),dn.prototype.addReference=function(e){this.context.addReference(e)},dn.prototype.handleText=function(e){var t=this.element,n=Ei(t),i=n.bodyProperty;if(!i)throw Ui("unexpected body text <"+e+">");eo.prototype.handleText.call(this,e)},dn.prototype.handleEnd=function(){var e=this.body,t=this.element,n=Ei(t),i=n.bodyProperty;i&&e!==void 0&&(e=Pu(i.type,e),t.set(i.name,e))},dn.prototype.createElement=function(e){var t=e.attributes,n=this.type,i=Ei(n),r=this.context,o=new n({}),a=this.model,s;return k(t,function(c,u){var l=i.propertiesByName[u],p;l&&l.isReference?l.isMany?(p=c.split(" "),k(p,function(f){r.addReference({element:o,property:l.ns.name,id:f})})):r.addReference({element:o,property:l.ns.name,id:c}):(l?c=Pu(l.type,c):u==="xmlns"?u=":"+u:(s=on(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},dn.prototype.getPropertyForNode=function(e){var t=e.name,n=on(t),i=this.type,r=this.model,o=Ei(i),a=n.name,s=o.propertiesByName[a];if(s&&!s.isAttr){const u=u0(s);if(u){const l=e.attributes[u];if(l){const p=f0(l,e.ns,r),f=r.getType(p);return O({},s,{effectiveType:Ei(f).name})}}return s}var c=r.getPackage(n.prefix);if(c){const u=ad(n,c),l=r.getType(u);if(s=st(o.properties,function(p){return!p.isVirtual&&!p.isReference&&!p.isAttribute&&l.hasType(p.type)}),s)return O({},s,{effectiveType:Ei(l).name})}else if(s=st(o.properties,function(u){return!u.isReference&&!u.isAttribute&&u.type==="Element"}),s)return s;throw Ui("unrecognized element <"+n.name+">")},dn.prototype.toString=function(){return"ElementDescriptor["+Ei(this.type).name+"]"},dn.prototype.valueHandler=function(e,t){return new Ou(e,t)},dn.prototype.referenceHandler=function(e){return new Go(e,this.context)},dn.prototype.handler=function(e){return e==="Element"?new to(this.model,e,this.context):new dn(this.model,e,this.context)},dn.prototype.handleChild=function(e){var t,n,i,r;if(t=this.getPropertyForNode(e),i=this.element,n=t.effectiveType||t.type,Xf(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?(O(o,{element:i}),this.context.addReference(o)):o.$parent=i),r};function Lu(e,t,n){dn.call(this,e,t,n)}Lu.prototype=Object.create(dn.prototype),Lu.prototype.createElement=function(e){var t=e.name,n=on(t),i=this.model,r=this.type,o=i.getPackage(n.prefix),a=o&&ad(n,o)||t;if(!r.hasType(a))throw Ui("unexpected element <"+e.originalName+">");return dn.prototype.createElement.call(this,e)};function to(e,t,n){this.model=e,this.context=n}to.prototype=Object.create(Ja.prototype),to.prototype.createElement=function(e){var t=e.name,n=on(t),i=n.prefix,r=e.ns[i+"$uri"],o=e.attributes;return this.model.createAny(t,r,o)},to.prototype.handleChild=function(e){var t=new to(this.model,"Element",this.context).handleNode(e),n=this.element,i=t.element,r;return i!==void 0&&(r=n.$children=n.$children||[],r.push(i),i.$parent=n),t},to.prototype.handleEnd=function(){this.body&&(this.element.$body=this.body)};function Iu(e){e instanceof Hn&&(e={model:e}),O(this,{lax:!1},e)}Iu.prototype.fromXML=function(e,t,n){var i=t.rootHandler;t instanceof dn?(i=t,t={}):typeof t=="string"?(i=this.handler(t),t={}):typeof i=="string"&&(i=this.handler(i));var r=this.model,o=this.lax,a=new d0(O({},t,{rootHandler:i})),s=new nd({proxy:!0}),c=h0();i.context=a,c.push(i);function u(E,T,L){var A=T(),F=A.line,z=A.column,B=A.data;B.charAt(0)==="<"&&B.indexOf(" ")!==-1&&(B=B.slice(0,B.indexOf(" "))+">");var G="unparsable content "+(B?B+" ":"")+`detected
2
+ line: `+F+`
3
+ column: `+z+`
4
+ nested error: `+E.message;if(L)return a.addWarning({message:G,error:E}),!0;throw Ui(G)}function l(E,T){return u(E,T,!0)}function p(){var E=a.elementsById,T=a.references,L,A;for(L=0;A=T[L];L++){var F=A.element,z=E[A.id],B=Ei(F).propertiesByName[A.property];if(z||a.addWarning({message:"unresolved reference <"+A.id+">",element:A.element,property:A.property,value:A.id}),B.isMany){var G=F.get(B.name),fe=G.indexOf(A);fe===-1&&(fe=G.length),z?G[fe]=z:G.splice(fe,1)}else F.set(B.name,z)}}function f(){c.pop().handleEnd()}var d=/^<\?xml /i,h=/ encoding="([^"]+)"/i,m=/^utf-8$/i;function g(E){if(d.test(E)){var T=h.exec(E),L=T&&T[1];!L||m.test(L)||a.addWarning({message:"unsupported document encoding <"+L+">, falling back to UTF-8"})}}function R(E,T){var L=c.peek();try{c.push(L.handleNode(E))}catch(A){u(A,T,o)&&c.push(new Du)}}function w(E,T){try{c.peek().handleText(E)}catch(L){l(L,T)}}function b(E,T){E.trim()&&w(E,T)}var x=r.getPackages().reduce(function(E,T){return E[T.uri]=T.prefix,E},Object.entries(ku).reduce(function(E,[T,L]){return E[L]=T,E},r.config&&r.config.nsMap||{}));return s.ns(x).on("openTag",function(E,T,L,A){var F=E.attrs||{},z=Object.keys(F).reduce(function(G,fe){var Fe=T(F[fe]);return G[fe]=Fe,G},{}),B={name:E.name,originalName:E.originalName,attributes:z,ns:E.ns};R(B,A)}).on("question",g).on("closeTag",f).on("cdata",w).on("text",function(E,T,L){b(T(E),L)}).on("error",u).on("warn",l),new Promise(function(E,T){var L;try{s.parse(e),p()}catch(G){L=G}var A=i.element;!L&&!A&&(L=Ui("failed to parse document as <"+i.type.$descriptor.name+">"));var F=a.warnings,z=a.references,B=a.elementsById;return L?(L.warnings=F,T(L)):E({rootElement:A,elementsById:B,references:z,warnings:F})})},Iu.prototype.handler=function(e){return new Lu(this.model,e)};function h0(){var e=[];return Object.defineProperty(e,"peek",{value:function(){return this[this.length-1]}}),e}var m0=`<?xml version="1.0" encoding="UTF-8"?>
5
+ `,g0=/<|>|'|"|&|\n\r|\n/g,sd=/<|>|&/g;function si(e){this.prefixMap={},this.uriMap={},this.used={},this.wellknown=[],this.custom=[],this.parent=e,this.defaultPrefixMap=e&&e.defaultPrefixMap||{}}si.prototype.mapDefaultPrefixes=function(e){this.defaultPrefixMap=e},si.prototype.defaultUriByPrefix=function(e){return this.defaultPrefixMap[e]},si.prototype.byUri=function(e){return this.uriMap[e]||this.parent&&this.parent.byUri(e)},si.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)},si.prototype.uriByPrefix=function(e){return this.prefixMap[e||"xmlns"]||this.parent&&this.parent.uriByPrefix(e)},si.prototype.mapPrefix=function(e,t){this.prefixMap[e||"xmlns"]=t},si.prototype.getNSKey=function(e){return e.prefix!==void 0?e.uri+"|"+e.prefix:e.uri},si.prototype.logUsed=function(e){var t=e.uri,n=this.getNSKey(e);this.used[n]=this.byUri(t),this.parent&&this.parent.logUsed(e)},si.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 y0(e){return e.charAt(0).toLowerCase()+e.slice(1)}function v0(e,t){return id(t)?y0(e):e}function cd(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})}function ud(e){return wn(e)?e:(e.prefix?e.prefix+":":"")+e.localName}function _0(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 b0(e,t){return t.isGeneric?O({localName:t.ns.localName},e):O({localName:v0(t.ns.localName,t.$pkg)},e)}function x0(e,t){return O({localName:t.ns.localName},e)}function w0(e){var t=e.$descriptor;return Oe(t.properties,function(n){var i=n.name;if(n.isVirtual||!En(e,i))return!1;var r=e[i];return r===n.default||r===null?!1:n.isMany?r.length:!0})}var E0={"\n":"#10","\n\r":"#10",'"':"#34","'":"#39","<":"#60",">":"#62","&":"#38"},S0={"<":"lt",">":"gt","&":"amp"};function ld(e,t,n){return e=wn(e)?e:""+e,e.replace(t,function(i){return"&"+n[i]+";"})}function R0(e){return ld(e,g0,E0)}function C0(e){return ld(e,sd,S0)}function P0(e){return Oe(e,function(t){return t.isAttr})}function A0(e){return Oe(e,function(t){return!t.isAttr})}function Nu(e){this.tagName=e}Nu.prototype.build=function(e){return this.element=e,this},Nu.prototype.serializeTo=function(e){e.appendIndent().append("<"+this.tagName+">"+this.element.id+"</"+this.tagName+">").appendNewLine()};function Ar(){}Ar.prototype.serializeValue=Ar.prototype.serializeTo=function(e){e.append(this.escape?C0(this.value):this.value)},Ar.prototype.build=function(e,t){return this.value=t,e.type==="String"&&t.search(sd)!==-1&&(this.escape=!0),this};function Bu(e){this.tagName=e}cd(Bu,Ar),Bu.prototype.serializeTo=function(e){e.appendIndent().append("<"+this.tagName+">"),this.serializeValue(e),e.append("</"+this.tagName+">").appendNewLine()};function dt(e,t){this.body=[],this.attrs=[],this.parent=e,this.propertyDescriptor=t}dt.prototype.build=function(e){this.element=e;var t=e.$descriptor,n=this.propertyDescriptor,i,r,o=t.isGeneric;return o?i=this.parseGenericNsAttributes(e):i=this.parseNsAttributes(e),n?this.ns=this.nsPropertyTagName(n):this.ns=this.nsTagName(t),this.tagName=this.addTagName(this.ns),o?this.parseGenericContainments(e):(r=w0(e),this.parseAttributes(P0(r)),this.parseContainments(A0(r))),this.parseGenericAttributes(e,i),this},dt.prototype.nsTagName=function(e){var t=this.logNamespaceUsed(e.ns);return b0(t,e)},dt.prototype.nsPropertyTagName=function(e){var t=this.logNamespaceUsed(e.ns);return x0(t,e)},dt.prototype.isLocalNs=function(e){return e.uri===this.ns.uri},dt.prototype.nsAttributeName=function(e){var t;if(wn(e)?t=on(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}:O({localName:t.localName},n)},dt.prototype.parseGenericNsAttributes=function(e){return Object.entries(e).filter(([t,n])=>!t.startsWith("$")&&this.parseNsAttribute(e,t,n)).map(([t,n])=>({name:t,value:n}))},dt.prototype.parseGenericContainments=function(e){var t=e.$body;t&&this.body.push(new Ar().build({type:"String"},t));var n=e.$children;n&&k(n,i=>{this.body.push(new dt(this).build(i))})},dt.prototype.parseNsAttribute=function(e,t,n){var i=e.$model,r=on(t),o;if(r.prefix==="xmlns"&&(o={prefix:r.localName,uri:n}),!r.prefix&&r.localName==="xmlns"&&(o={uri:n}),!o)return{name:t,value:n};if(i&&i.getPackage(n))this.logNamespace(o,!0,!0);else{var a=this.logNamespaceUsed(o,!0);this.getNamespaces().logUsed(a)}},dt.prototype.parseNsAttributes=function(e){var t=this,n=e.$attrs,i=[];return k(n,function(r,o){var a=t.parseNsAttribute(e,o,r);a&&i.push(a)}),i},dt.prototype.parseGenericAttributes=function(e,t){var n=this;k(t,function(i){try{n.addAttribute(n.nsAttributeName(i.name),i.value)}catch(r){typeof console<"u"&&console.warn(`missing namespace information for <${i.name}=${i.value}> on`,e,r)}})},dt.prototype.parseContainments=function(e){var t=this,n=this.body,i=this.element;k(e,function(r){var o=i.get(r.name),a=r.isReference,s=r.isMany;if(s||(o=[o]),r.isBody)n.push(new Ar().build(r,o[0]));else if(Xf(r.type))k(o,function(u){n.push(new Bu(t.addTagName(t.nsPropertyTagName(r))).build(r,u))});else if(a)k(o,function(u){n.push(new Nu(t.addTagName(t.nsPropertyTagName(r))).build(u))});else{var c=od(r);k(o,function(u){var l;c?c===rd?l=new dt(t,r):l=new es(t,r,c):l=new dt(t),n.push(l.build(u))})}})},dt.prototype.getNamespaces=function(e){var t=this.namespaces,n=this.parent,i;return t||(i=n&&n.getNamespaces(),e||!i?this.namespaces=t=new si(i):t=i),t},dt.prototype.logNamespace=function(e,t,n){var i=this.getNamespaces(n),r=e.uri,o=e.prefix,a=i.byUri(r);return(!a||n)&&i.add(e,t),i.mapPrefix(o,r),e},dt.prototype.logNamespaceUsed=function(e,t){var n=this.getNamespaces(t),i=e.prefix,r=e.uri,o,a,s;if(!i&&!r)return{localName:e.localName};if(s=n.defaultUriByPrefix(i),r=r||s||n.uriByPrefix(i),!r)throw new Error("no namespace uri given for prefix <"+i+">");if(e=n.byUri(r),!e&&!i&&(e=this.logNamespace({uri:r},s===r,!0)),!e){for(o=i,a=1;n.uriByPrefix(o);)o=i+"_"+a++;e=this.logNamespace({prefix:o,uri:r},s===r)}return i&&n.mapPrefix(i,r),e},dt.prototype.parseAttributes=function(e){var t=this,n=this.element;k(e,function(i){var r=n.get(i.name);if(i.isReference)if(!i.isMany)r=r.id;else{var o=[];k(r,function(a){o.push(a.id)}),r=o.join(" ")}t.addAttribute(t.nsAttributeName(i),r)})},dt.prototype.addTagName=function(e){var t=this.logNamespaceUsed(e);return this.getNamespaces().logUsed(t),ud(e)},dt.prototype.addAttribute=function(e,t){var n=this.attrs;wn(t)&&(t=R0(t));var i=Uf(n,function(o){return o.name.localName===e.localName&&o.name.uri===e.uri&&o.name.prefix===e.prefix}),r={name:e,value:t};i!==-1?n.splice(i,1,r):n.push(r)},dt.prototype.serializeAttributes=function(e){var t=this.attrs,n=this.namespaces;n&&(t=_0(n).concat(t)),k(t,function(i){e.append(" ").append(ud(i.name)).append('="').append(i.value).append('"')})},dt.prototype.serializeTo=function(e){var t=this.body[0],n=t&&t.constructor!==Ar;e.appendIndent().append("<"+this.tagName),this.serializeAttributes(e),e.append(t?">":" />"),t&&(n&&e.appendNewLine().indent(),k(this.body,function(i){i.serializeTo(e)}),n&&e.unindent().appendIndent(),e.append("</"+this.tagName+">")),e.appendNewLine()};function es(e,t,n){dt.call(this,e,t),this.serialization=n}cd(es,dt),es.prototype.parseNsAttributes=function(e){var t=dt.prototype.parseNsAttributes.call(this,e).filter(a=>a.name!==this.serialization),n=e.$descriptor;if(n.name===this.propertyDescriptor.type)return t;var i=this.typeNs=this.nsTagName(n);this.getNamespaces().logUsed(this.typeNs);var r=e.$model.getPackage(i.uri),o=r.xml&&r.xml.typePrefix||"";return this.addAttribute(this.nsAttributeName(this.serialization),(i.prefix?i.prefix+":":"")+o+n.ns.localName),t},es.prototype.isLocalNs=function(e){return e.uri===(this.typeNs||this.ns).uri};function T0(){this.value="",this.write=function(e){this.value+=e}}function M0(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 k0(e){e=O({format:!1,preamble:!0},e||{});function t(n,i){var r=i||new T0,o=new M0(r,e.format);e.preamble&&o.append(m0);var a=new dt,s=n.$model;if(a.getNamespaces().mapDefaultPrefixes(D0(s)),a.build(n).serializeTo(o),!i)return r.value}return{toXML:t}}function D0(e){const t=e.config&&e.config.nsMap||{},n={};for(const i in ku)n[i]=ku[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 ts(e,t){Hn.call(this,e,t)}ts.prototype=Object.create(Hn.prototype),ts.prototype.fromXML=function(e,t,n){wn(t)||(n=t,t="bpmn:Definitions");var i=new Iu(O({model:this,lax:!0},n)),r=i.handler(t);return i.fromXML(e,r)},ts.prototype.toXML=function(e,t){var n=new k0(t);return new Promise(function(i,r){try{var o=n.toXML(e);return i({xml:o})}catch(a){return r(a)}})};var O0="BPMN20",L0="http://www.omg.org/spec/BPMN/20100524/MODEL",I0="bpmn",N0=[],B0=[{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"}]}],$0=[{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"}]}],j0={tagAlias:"lowerCase",typePrefix:"t"},F0={name:O0,uri:L0,prefix:I0,associations:N0,types:B0,enumerations:$0,xml:j0},H0="BPMNDI",z0="http://www.omg.org/spec/BPMN/20100524/DI",V0="bpmndi",G0=[{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"]}],W0=[{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"}]}],U0=[],Y0={name:H0,uri:z0,prefix:V0,types:G0,enumerations:W0,associations:U0},q0="DC",K0="http://www.omg.org/spec/DD/20100524/DC",X0="dc",Z0=[{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}]}],Q0=[],J0={name:q0,uri:K0,prefix:X0,types:Z0,associations:Q0},ew="DI",tw="http://www.omg.org/spec/DD/20100524/DI",nw="di",iw=[{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"}]}],rw=[],ow={tagAlias:"lowerCase"},aw={name:ew,uri:tw,prefix:nw,types:iw,associations:rw,xml:ow},sw="bpmn.io colors for BPMN",cw="http://bpmn.io/schema/bpmn/biocolor/1.0",uw="bioc",lw=[{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"}]}],pw=[],fw=[],dw={name:sw,uri:cw,prefix:uw,types:lw,enumerations:pw,associations:fw},hw="BPMN in Color",mw="http://www.omg.org/spec/BPMN/non-normative/color/1.0",gw="color",yw=[{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"}]}],vw=[],_w=[],bw={name:hw,uri:mw,prefix:gw,types:yw,enumerations:vw,associations:_w};const xw={bpmn:F0,bpmndi:Y0,dc:J0,di:aw,bioc:dw,color:bw};function pd(e,t){const n=O({},xw,e);return new ts(n,t)}const ww={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"}},Ew="http://www.omg.org/spec/BPMN/non-normative/extensions/i18n/1.0",fd="i18n",ns={[fd]:ww,[bu]:Hf};function dd(){return pd(ns)}const hd=dd();async function $u(e){const{rootElement:t,warnings:n}=await hd.fromXML(e,"bpmn:Definitions");return{definitions:t,warnings:n}}async function Sw(e){const{xml:t}=await hd.toXML(e,{format:!0});return t}function ju(e){return e.map(t=>typeof t=="string"?t:t.message??String(t))}const no={cjkEm:.865,upperEm:.68,lowerEm:.5,digitEm:.556,spaceEm:.278,otherEm:.35,ascentEm:.9,descentEm:.25},Rw=/[ᄀ-ᇿ -〿぀-ヿ㐀-鿿가-힯＀-⦆]/;function Cw(e){const t=no;return Rw.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 io(e,t){let n=0;for(const i of e)n+=t*Cw(i);return n}function md(e=globalThis,{textMeasurement:t="approximate"}={}){if(!(e!=null&&e.SVGElement))throw new Error("installHeadlessBpmnDom: DOM 전역이 없다 — jsdom window 를 전역에 올린 뒤 호출할 것");t==="approximate"&&Pw(e),Aw(e),Tw(e),Mw(e)}function Pw(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:io(r,o),fontBoundingBoxAscent:o*no.ascentEm,fontBoundingBoxDescent:o*no.descentEm,actualBoundingBoxAscent:o*no.ascentEm,actualBoundingBoxDescent:o*no.descentEm}}};t.getContext=()=>n}function Aw(e){if(e.SVGMatrix)return;class t{constructor(){Kr(this,"a",1);Kr(this,"b",0);Kr(this,"c",0);Kr(this,"d",1);Kr(this,"e",0);Kr(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 Tw(e){var o;const t=()=>{const a=new e.SVGMatrix;return{type:0,matrix:a,setTranslate(s,c){a.e=s,a.f=c},setScale(s,c){a.a=s,a.d=c},setRotate(s,c=0,u=0){const l=s*Math.PI/180,p=Math.cos(l),f=Math.sin(l);a.a=p,a.b=f,a.c=-f,a.d=p,a.e=c-p*c+f*u,a.f=u-f*c-p*u},setMatrix(s){Object.assign(a,s)}}},n=a=>{const s=t();return Object.assign(s.matrix,a),s},i=(o=e.SVGSVGElement)==null?void 0:o.prototype;i&&!i.createSVGTransform&&(i.createSVGTransform=t,i.createSVGTransformFromMatrix=n,i.createSVGMatrix=()=>new e.SVGMatrix,i.createSVGPoint=()=>({x:0,y:0,matrixTransform:()=>({x:0,y:0})}));const r=e.SVGElement.prototype;Object.getOwnPropertyDescriptor(r,"transform")||Object.defineProperty(r,"transform",{configurable:!0,get(){if(!this.__headlessTransformList){const a=[];this.__headlessTransformList={baseVal:{get numberOfItems(){return a.length},clear:()=>{a.length=0},appendItem:s=>(a.push(s),s),getItem:s=>a[s],createSVGTransformFromMatrix:n,consolidate:()=>a[a.length-1]??null}}}return this.__headlessTransformList}})}function Mw(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:io(n,12),height:14}})}const is=new Set(["bpmn:Participant","bpmn:Lane","bpmn:Group","bpmn:SubProcess","bpmn:AdHocSubProcess","bpmn:Transaction"]),kw=1,Dw=2;function Yi(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"label-on-shared-segment":return`l|${e.edge}|${e.other}`;case"annotation-over-label":return`a|${e.annotation}|${e.label}`;case"group-overlap-unintended":return`g|${e.groups[0]}|${e.groups[1]}`;case"group-on-container-boundary":return`gb|${e.group}|${e.container}|${e.side}`;case"pool-name-over-label":return`pn|${e.pool}|${e.label}`}}const gd=20,yd=5,Ow=3,vd=12,Lw=vd*1.2;function Fu(e,t){const n=t.split(/\r?\n/),i=Math.max(...n.map(o=>io(o,vd))),r=n.length*Lw;return{x:e.x+e.width/2-i/2,y:e.y+e.height/2-r/2,width:i,height:r}}const _d=1;function hn(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 rs(e,t){let n=null;const i=e.type!==t.type;for(const r of hn(e))for(const o of hn(t)){if(r.axis!==o.axis||Math.abs(r.at-o.at)>_d)continue;const a=r.dir!==o.dir?"opposite":i?"mixed":null;if(!a)continue;const s=Math.min(r.hi,o.hi)-Math.max(r.lo,o.lo);s>=gd&&(!n||s>n.length)&&(n={axis:r.axis,length:s,kind:a})}return n}function bd(e,t){const n=rs(e,t);return n&&n.kind==="opposite"?{axis:n.axis,length:n.length}:null}function Iw(e,t){let n=0;for(const i of t)i.id!==e.id&&bd(e,i)&&n++;return n}function Tr(e,t){let n=0;for(const i of t)i.id!==e.id&&rs(e,i)&&n++;return n}const xd=15,wd=20;function Nw(e,t){const n=t.axis==="v"?[e.x,e.x+e.width]:[e.y,e.y+e.height];if(t.at<n[0]-wd||t.at>n[1]+wd)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 Hu=20;function os(e,t){const n=[];for(const i of t){if(i.axis!==e.axis||Math.abs(i.at-e.at)>_d)continue;const r=Math.max(e.lo,i.lo),o=Math.min(e.hi,i.hi);o-r<gd||n.push([r-Hu,o+Hu])}return n}function as(e,t){const n=e.label;if(!n)return null;let i=null;for(const r of hn(e)){const o=Nw(n,r);if(o){for(const a of t)if(a.id!==e.id&&!(i&&a.id>=i.other)){for(const[s,c]of os(r,hn(a)))if(Math.min(c,o[1])>Math.max(s,o[0])){i={other:a.id,axis:r.axis};break}}}}return i}const Bw=1,$w=(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 jw(e,t,n,i){const r=n.x+i,o=n.y+i,a=n.x+n.width-i,s=n.y+n.height-i;if(a<=r||s<=o)return!1;const c=t.x-e.x,u=t.y-e.y;let l=0,p=1;const f=(d,h)=>{if(h===0)return d<=0;const m=d/h;if(h>0){if(m>p)return!1;m>l&&(l=m)}else{if(m<l)return!1;m<p&&(p=m)}return!0};return f(r-e.x,c)&&f(e.x-a,-c)&&f(o-e.y,u)&&f(e.y-s,-u)&&p>l}function zu(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 Fw=(e,t)=>e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height,ro=1;function Si(e,t){const n=e.x+ro,i=e.x+e.width-ro,r=e.y+ro,o=e.y+e.height-ro;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 Wo(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 Ed(e,t){const n=e.label;if(!n)return null;if(hn(e).some(i=>Si(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(hn(i).some(r=>Si(n,r)))return i.id;for(const i of t.shapes.filter(r=>r.container).sort((r,o)=>r.id.localeCompare(o.id)))if(Wo(i).some(r=>Si(n,r)))return i.id;return null}function zn(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(jw(e.waypoints[o],e.waypoints[o+1],r,Dw)){i.push(r);break}}return i}function Hw(e,t,n,i){const r=(u,l,p)=>(l.x-u.x)*(p.y-u.y)-(l.y-u.y)*(p.x-u.x),o=r(n,i,e),a=r(n,i,t),s=r(e,t,n),c=r(e,t,i);return o*a<0&&s*c<0}const Sd=(e,t)=>e.endpoints.some(n=>t.endpoints.includes(n));function ss(e,t){let n=0;for(const i of t){if(i.id===e.id||Sd(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++)Hw(e.waypoints[o],e.waypoints[o+1],i.waypoints[a],i.waypoints[a+1])&&(r=!0);r&&n++}return n}function Ri(e,t){let n=0;for(const i of t)i.id===e.id||Sd(e,i)||ss(e,[i])>0&&(n+=i.type===e.type?2:1);return n}function Rd(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++)ss(n[i],[n[r]])>0&&(t+=n[i].type===n[r].type?2:1);return t}function Vu(e){const t=[],n=e.edges;for(let i=0;i<n.length;i++)for(let r=i+1;r<n.length;r++)if(ss(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 Cd(e){var n;const t=(n=ht(e==null?void 0:e.extensionElements))==null?void 0:n.values;if(Array.isArray(t))for(const i of t){const r=ht(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 Pd=e=>e?{members:e}:{},Ci=e=>e.shapes.filter(t=>!t.container);function zw(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 Ad(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(hn(i).some(r=>Si(n,r)))return i.id;for(const i of[...t.shapes].filter(r=>r.container).sort((r,o)=>r.id.localeCompare(o.id)))if(Wo(i).some(r=>Si(n,r)))return i.id;return null}function Uo(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 qi(e){const t=[],n=e.shapes.filter(p=>!p.container);for(const p of e.edges)for(const f of zn(p,n))t.push({kind:"edge-crosses-shape",edge:p.id,shape:f.id});const i=n.filter(p=>!p.attached);for(let p=0;p<i.length;p++)for(let f=p+1;f<i.length;f++){const d=i[p],h=i[f];if(!zu(d,h,kw))continue;const m=d.id<h.id?[d.id,h.id]:[h.id,d.id];t.push({kind:"shape-overlap",shapes:m,identical:Fw(d,h)})}const r=e.shapes.filter(p=>p.type==="bpmn:Group"&&Array.isArray(p.members)&&p.members.length>0);for(let p=0;p<r.length;p++)for(let f=p+1;f<r.length;f++){const d=r[p],h=r[f],m=Math.min(d.x+d.width,h.x+h.width)-Math.max(d.x,h.x),g=Math.min(d.y+d.height,h.y+h.height)-Math.max(d.y,h.y);if(m<=yd||g<=yd)continue;const R=new Set(h.members);d.members.some(w=>R.has(w))||t.push({kind:"group-overlap-unintended",groups:d.id<h.id?[d.id,h.id]:[h.id,d.id]})}const o=e.shapes.filter(p=>p.container&&p.type!=="bpmn:Group"&&p.type!=="bpmn:Lane");for(const p of e.shapes.filter(f=>f.type==="bpmn:Group"))for(const f of o){const d=p.x<f.x+f.width&&f.x<p.x+p.width,h=p.y<f.y+f.height&&f.y<p.y+p.height,m=[["top",p.y,f.y,d],["bottom",p.y+p.height,f.y+f.height,d],["left",p.x,f.x,h],["right",p.x+p.width,f.x+f.width,h]];for(const[g,R,w,b]of m)b&&Math.abs(R-w)<=Ow&&t.push({kind:"group-on-container-boundary",group:p.id,container:f.id,side:g})}for(let p=0;p<e.edges.length;p++)for(let f=p+1;f<e.edges.length;f++){const d=e.edges[p],h=e.edges[f],m=rs(d,h);if(!m)continue;const g=d.id<h.id?[d.id,h.id]:[h.id,d.id];t.push({kind:m.kind==="opposite"?"edge-overlap-opposite":"edge-overlap-mixed",edges:g,axis:m.axis,length:Math.round(m.length)})}for(const p of e.edges){if(!p.label)continue;const f=as(p,e.edges);f&&t.push({kind:"label-on-shared-segment",edge:p.id,other:f.other,axis:f.axis})}for(const p of e.edges){if(!p.label)continue;const f=Ed(p,e);f&&t.push({kind:"label-over-line",edge:p.id,line:f})}const a=new Set(n.map(p=>p.id)),s=e.shapes.filter(p=>p.type==="bpmn:Participant"&&p.label);for(const p of[...n,...s.filter(f=>!a.has(f.id))]){if(!p.label)continue;const f=Ad(p,e);f&&t.push({kind:"label-over-line",edge:p.id,line:f})}const c=new Set(e.shapes.filter(p=>p.type==="bpmn:TextAnnotation").map(p=>p.id));for(const p of s)for(const{owner:f,rect:d}of Uo(e))f===p.id||c.has(f)||zu(p.label,d,ro)&&t.push({kind:"pool-name-over-label",pool:p.id,label:f});const u=Uo(e);for(const p of n)if(p.type==="bpmn:TextAnnotation")for(const{owner:f,rect:d}of u)f!==p.id&&zu(p,d,ro)&&t.push({kind:"annotation-over-label",annotation:p.id,label:f});const l=new Map(e.shapes.map(p=>[p.id,p]));for(const p of n){const f=p.parent??zw(p,e,l);if(!f)continue;const d=l.get(f);!d||!d.container||$w(d,p,Bw)||t.push({kind:"shape-outside-container",shape:p.id,container:d.id})}return t.sort((p,f)=>Yi(p).localeCompare(Yi(f)))}const ht=e=>typeof e=="object"&&e!==null?e:void 0,xt=e=>typeof e=="number"?e:0,Mr=e=>{const t=ht(e);return typeof(t==null?void 0:t.id)=="string"?t.id:void 0};function Vw(e){const t=ht(e);if(!t)return[];const n=[];for(const i of["sourceRef","targetRef"]){const r=t[i];for(const o of Array.isArray(r)?r:[r]){const a=Mr(o);a&&n.push(a)}}return n}function Gw(e,t){const n=ht(e.$parent);if(!n)return;const i=typeof n.$type=="string"?n.$type:"";if(i==="bpmn:Process"){const r=Mr(n);return r?t.get(r):void 0}if(is.has(i)&&i!=="bpmn:Lane"&&i!=="bpmn:Group")return Mr(n)}function Td(e){var a,s,c,u,l;const t=[],n=[],i=((a=ht(e))==null?void 0:a.diagrams)??[],r=new Map,o=new Set;for(const p of((s=ht(e))==null?void 0:s.rootElements)??[]){const f=ht(p);if((f==null?void 0:f.$type)==="bpmn:Collaboration")for(const d of f.participants??[]){const h=ht(d),m=Mr(h),g=Mr(h==null?void 0:h.processRef);m&&g?r.set(g,m):m&&o.add(m)}}for(const p of i){const f=ht((c=ht(p))==null?void 0:c.plane),d=(f==null?void 0:f.planeElement)??[];for(const h of d){const m=ht(h);if(!m)continue;const g=ht(m.bpmnElement),R=typeof(g==null?void 0:g.id)=="string"?g.id:void 0;if(!R)continue;const w=typeof(g==null?void 0:g.$type)=="string"?g.$type:"",b=ht(m.bounds);if(b){const E=m.isExpanded===!1&&w!=="bpmn:Participant",T=ht((u=ht(m.label))==null?void 0:u.bounds),L={id:R,type:w,x:xt(b.x),y:xt(b.y),width:xt(b.width),height:xt(b.height),container:is.has(w)&&!E,attached:(g==null?void 0:g.attachedToRef)!==void 0,...g?{parent:Gw(g,r)}:{},...T?{label:{x:xt(T.x),y:xt(T.y),width:xt(T.width),height:xt(T.height)}}:{},...w==="bpmn:Group"?Pd(Cd(g)):{}},A=m.isHorizontal!==!1,F=typeof(g==null?void 0:g.name)=="string"?g.name:"";o.has(R)&&A&&F&&(L.label=Fu(L,F)),t.push(L);continue}const x=m.waypoint;if(Array.isArray(x)){const E=ht((l=ht(m.label))==null?void 0:l.bounds);n.push({id:R,type:w,waypoints:x.map(T=>{var L,A;return{x:xt((L=ht(T))==null?void 0:L.x),y:xt((A=ht(T))==null?void 0:A.y)}}),endpoints:Vw(g),...E?{label:{x:xt(E.x),y:xt(E.y),width:xt(E.width),height:xt(E.height)}}:{}})}}}return{shapes:t,edges:n}}function Md(e){return qi(Td(e))}async function Ww(e){const{definitions:t,warnings:n}=await $u(e);return{findings:Md(t),warnings:n}}function Ut(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 m=ht(o.label);n.push({id:o.id,type:a,waypoints:s.map(g=>({x:xt(g.x),y:xt(g.y)})),endpoints:[Mr(o.source),Mr(o.target)].filter(g=>!!g),...m&&typeof m.x=="number"?{label:{x:m.x,y:xt(m.y),width:xt(m.width),height:xt(m.height)}}:{}});continue}if(typeof o.x!="number"||typeof o.y!="number")continue;const c=ht(o.businessObject),u=ht(o.label);let l=ht(o.parent);for(;l&&l.type==="bpmn:Lane";)l=ht(l.parent);const p=typeof(l==null?void 0:l.type)=="string"?l.type:"",f=l&&is.has(p)&&p!=="bpmn:Group"&&typeof l.id=="string"?l.id:void 0,d={id:o.id,type:a,x:o.x,y:o.y,width:xt(o.width),height:xt(o.height),container:is.has(a)&&(a==="bpmn:Participant"||o.collapsed!==!0),attached:(c==null?void 0:c.attachedToRef)!==void 0,...f!==void 0?{parent:f}:{},...u&&typeof u.x=="number"?{label:{x:u.x,y:xt(u.y),width:xt(u.width),height:xt(u.height)}}:{},...a==="bpmn:Group"?Pd(Cd(c)):{}},h=typeof(c==null?void 0:c.name)=="string"?c.name:"";a==="bpmn:Participant"&&!(c!=null&&c.processRef)&&h&&((i=ht(o.di))==null?void 0:i.isHorizontal)!==!1&&(d.label=Fu(d,h)),t.push(d)}return{shapes:t,edges:n}}const Uw={"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 Yw(e,t){const n=Uw[e];return n||(e==="label"||e.startsWith("bpmndi:")?"other":e.startsWith("bpmn:")&&!("waypoints"in t&&t.waypoints)?"flowNode":"other")}function kd(e){let t=e.parent;for(;t;){if(t.type==="bpmn:Participant")return t.id;t=t.parent}}function Dd(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 Yw(i.type,i)},lanesOf:n=>t().filter(i=>i.type==="bpmn:Lane"&&kd(i)===n).sort((i,r)=>i.y-r.y).map(i=>i.id),participantOf:n=>{const i=e.get(n);return i?kd(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 Od=20,qw=4,Pt=(e,t)=>Math.abs(e-t)<.5;function Ld(e,t,n,i=Od){if(Pt(e.y,t.y)&&!Pt(e.x,t.x)){const r=Math.min(e.x,t.x),o=Math.max(e.x,t.x);if(!(r<n.x-i&&n.x+n.width+i<o))return null;const a=e.x<t.x?n.x-i:n.x+n.width+i,s=e.x<t.x?n.x+n.width+i:n.x-i,c=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(Pt(e.x,t.x)&&!Pt(e.y,t.y)){const r=Math.min(e.y,t.y),o=Math.max(e.y,t.y);if(!(r<n.y-i&&n.y+n.height+i<o))return null;const a=e.y<t.y?n.y-i:n.y+n.height+i,s=e.y<t.y?n.y+n.height+i:n.y-i,c=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 Id(e,t,n=Od){if(e.length!==4)return null;const[i,r,o,a]=e;if(Pt(i.y,r.y)&&Pt(r.x,o.x)&&Pt(o.y,a.y)){const s=c=>[i,{x:c,y:i.y},{x:c,y:a.y},a];return[s(t.x-n),s(t.x+t.width+n)]}if(Pt(i.x,r.x)&&Pt(r.y,o.y)&&Pt(o.x,a.x)){const s=c=>[i,{x:i.x,y:c},{x:a.x,y:c},a];return[s(t.y-n),s(t.y+t.height+n)]}return null}function Gu(e,t){if(e.endpoints.length!==2)return[];const n=t.find(p=>p.id===e.endpoints[0]),i=t.find(p=>p.id===e.endpoints[1]);if(!n||!i)return[];if(i.x<=n.x+n.width)return[];const r=n.y+n.height/2,o=i.y+i.height/2;if(r>=i.y&&r<=i.y+i.height)return[];const a=i.x+i.width/2,s=n.x+n.width/2,c=r>o,u=[{x:n.x+n.width,y:r},{x:a,y:r},{x:a,y:c?i.y+i.height:i.y}],l=[{x:s,y:c?n.y:n.y+n.height},{x:s,y:o},{x:i.x,y:o}];return[u,l]}const Nd=30,Kw=[0,-25,25,-40,40];function Xw(e,t){if(e.type!=="bpmn:MessageFlow"||e.endpoints.length!==2)return[];const n=t.find(f=>f.id===e.endpoints[0]),i=t.find(f=>f.id===e.endpoints[1]);if(!n||!i)return[];const r=n.y+n.height/2,o=i.y+i.height/2;if(i.y<n.y+n.height&&i.y+i.height>n.y)return[];const a=o<r,s=a?n.y+n.height:n.y,c=a?s+Nd:s-Nd,u=a?i.y+i.height:i.y,l=n.x+n.width/2,p=i.x+i.width/2;return Kw.map(f=>[{x:l,y:s},{x:l,y:c},{x:p+f,y:c},{x:p+f,y:u}])}const Zw=(e,t,n)=>[...e.slice(0,t+1),...n,...e.slice(t+1)],cs=(e,t,n)=>zn({...e,waypoints:t},n).length;function Bd(e,t,n,i){let r=[...e.waypoints],o=cs(e,r,t);if(o===0)return null;let a=!1;for(const p of Gu(e,t))if(cs(e,p,t)===0)return p;const s=(i??[]).filter(p=>p.id!==e.id).flatMap(hn),c=p=>hn({...e,waypoints:p}).some(f=>os(f,s).length>0),u=Xw(e,t).filter(p=>cs(e,p,t)===0);if(u.length)return u.find(p=>!c(p))??u[0];const l=p=>!n||p.every(f=>f.x>=n.x&&f.x<=n.x+n.width&&f.y>=n.y&&f.y<=n.y+n.height);for(let p=0;p<qw&&o>0;p++){let f=!1;for(let d=0;d+1<r.length&&!f;d++){const h=r[d],m=r[d+1];for(const g of t){if(e.endpoints.includes(g.id)||zn({...e,waypoints:[h,m]},[g]).length===0)continue;const R=Ld(h,m,g),w=R?R.map(x=>Zw(r,d,x)):Id(r,g)??[];if(!w.length)continue;const b=[...w].sort((x,E)=>Number(l(E))-Number(l(x)));for(const x of b){const E=cs(e,x,t);if(E<o){r=x,o=E,f=!0,a=!0;break}}if(f)break}}if(!f)break}return a&&o===0?r:null}function $d(e,t){const{elementRegistry:n}=e,i=e.modeling,r=Ut(n),o=Ci(r),a=qi(r).filter(c=>c.kind==="edge-crosses-shape"&&!t.has(Yi(c)));if(!a.length)return;const s=new Map;for(const c of a){if(c.kind!=="edge-crosses-shape"||s.has(c.edge))continue;const u=r.edges.find(l=>l.id===c.edge);u&&s.set(c.edge,u)}for(const[c,u]of s){const l=n.get(c);if(!l)continue;const p=l.parent,f=p&&typeof p.x=="number"&&typeof p.width=="number"?{x:p.x,y:p.y,width:p.width,height:p.height}:void 0,d=Bd(u,o,f,r.edges);d&&i.updateWaypoints(l,d)}}const Qw=10;function jd(e,t){if(e.parent){const r=t.find(o=>o.id===e.parent);if(r)return r}const n=e.x+e.width/2,i=e.y+e.height/2;return t.find(r=>n>=r.x&&n<=r.x+r.width&&i>=r.y&&i<=r.y+r.height)}function Fd(e,t){if(e.waypoints.length<2||e.endpoints.length!==2)return null;const n=t.shapes.filter(G=>G.type==="bpmn:Participant"&&G.container),i=t.shapes.find(G=>G.id===e.endpoints[0]),r=t.shapes.find(G=>G.id===e.endpoints[1]);if(!i||!r)return null;const o=jd(i,n),a=jd(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(G=>G.id!==o.id&&G.id!==a.id&&G.y>=c.y+c.height&&G.y+G.height<=u.y).sort((G,fe)=>G.y-fe.y);if(!l.length)return null;const p=l[0],f=l[l.length-1],d=(c.y+c.height+p.y)/2,h=(f.y+f.height+u.y)/2,m=s?d:h,g=s?h:d,R=e.waypoints[0],w=e.waypoints[e.waypoints.length-1],b=Ci(t),x=t.edges.filter(G=>G.id!==e.id),E=Ri(e,x),T=zn(e,b).length;if(E===0&&T===0)return null;const L=Math.min(...l.map(G=>G.x)),A=Math.max(...l.map(G=>G.x+G.width)),F=(R.x+w.x)/2,z=G=>G.filter((fe,Fe)=>Fe===0||!(Pt(fe.x,G[Fe-1].x)&&Pt(fe.y,G[Fe-1].y)));let B;for(let G=L;G<=A;G+=Qw){const fe=z([R,{x:R.x,y:m},{x:G,y:m},{x:G,y:g},{x:w.x,y:g},w]),Fe={...e,waypoints:fe};if(zn(Fe,b).length>0)continue;const lt=Ri(Fe,x),q=Math.abs(G-F);(!B||lt<B.cross||lt===B.cross&&q<B.detour)&&(B={pts:fe,cross:lt,detour:q})}return B&&(T>0?B.cross<=E:B.cross<E)?B.pts:null}function Hd(e,t){const{elementRegistry:n}=e,i=e.modeling,r=Ut(n);for(const o of r.edges){if(o.type!=="bpmn:MessageFlow"||t.has(o.id))continue;const a=Ut(n),s=a.edges.find(l=>l.id===o.id);if(!s)continue;const c=Fd(s,a);if(!c)continue;const u=n.get(o.id);u&&i.updateWaypoints(u,c)}}const oo=[25,-25,40,-40],us=35;function zd(e,t){if(e.type!=="bpmn:SequenceFlow")return[];const n=t.get(e.endpoints[0]??""),i=t.get(e.endpoints[1]??"");if(!n||!i)return[];if(i.x+i.width>n.x)return[];const r=n.y+n.height/2;if(r>=i.y&&r<=i.y+i.height)return[];const o=i.x+i.width/2,a=n.x+n.width/2,s=r<i.y,c=s?i.y:i.y+i.height,u=s?n.y:n.y+n.height,l=s?n.y-us:n.y+n.height+us,p=[];for(const w of[0,...oo]){if(Math.abs(w)>=i.width/2-5)continue;const b=o+w;p.push({pts:[{x:n.x,y:r},{x:b,y:r},{x:b,y:c}],cost:Math.abs(w)});for(const x of[0,...oo]){if(Math.abs(x)>=n.width/2-5)continue;const E=a+x;p.push({pts:[{x:E,y:u},{x:E,y:l},{x:b,y:l},{x:b,y:c}],cost:Math.abs(w)+Math.abs(x)})}}const f=50,d=i.y+i.height/2,h=s?n.y+n.height:n.y;for(const w of[0,...oo]){if(Math.abs(w)>=n.width/2-5)continue;const b=a+w;p.push({pts:[{x:b,y:h},{x:b,y:d},{x:i.x+i.width,y:d}],cost:f+Math.abs(w)})}const m=60,g=s?i.y+i.height:i.y,R=s?i.y+i.height+us:i.y-us;for(const w of[0,...oo]){if(Math.abs(w)>=i.width/2-5)continue;const b=o+w;for(const x of[0,...oo]){if(Math.abs(x)>=n.width/2-5)continue;const E=a+x;p.push({pts:[{x:E,y:h},{x:E,y:R},{x:b,y:R},{x:b,y:g}],cost:m+Math.abs(w)+Math.abs(x)})}}return p}const ls=30;function Vd(e,t){for(let n=1;n<e.length-2;n++){const i=e[n],r=e[n+1],o=Pt(i.y,r.y)&&!Pt(i.x,r.x),a=Pt(i.x,r.x)&&!Pt(i.y,r.y);if(!(!o&&!a))for(const s of t)if(o){const c=Math.min(i.x,r.x);if(Math.max(i.x,r.x)<=s.x||c>=s.x+s.width)continue;if(Math.abs(i.y-s.y)<ls||Math.abs(i.y-(s.y+s.height))<ls)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)<ls||Math.abs(i.x-(s.x+s.width))<ls)return!0}}return!1}const ps=40;function Jw(e,t,n){let i=0;for(const r of t){if(r.container||n.includes(r.id))continue;const o=r.x-ps,a=r.x+r.width+ps,s=r.y-ps,c=r.y+r.height+ps;for(let u=1;u<e.length-2;u++){const l=e[u],p=e[u+1],f={x:Math.min(l.x,p.x),y:Math.min(l.y,p.y)},d={x:Math.max(l.x,p.x),y:Math.max(l.y,p.y)};if(f.x<a&&d.x>o&&f.y<c&&d.y>s){i++;break}}}return i}function Gd(e,t){if(e.type!=="bpmn:SequenceFlow")return null;const n=t.shapes.filter(w=>w.container),i=new Map(t.shapes.map(w=>[w.id,w])),r=Ci(t),o=t.edges.filter(w=>w.id!==e.id),a=Tr(e,o),s=Ri(e,o),c=w=>Jw(w,t.shapes,e.endpoints)+(Vd(w,n)?1:0),u=c(e.waypoints),l=w=>{if(!w)return;const b=w.x+w.width/2,x=w.y+w.height/2;return n.find(E=>E.type==="bpmn:Lane"&&b>=E.x&&b<=E.x+E.width&&x>=E.y&&x<=E.y+E.height)},p=l(i.get(e.endpoints[0]??"")),f=l(i.get(e.endpoints[1]??"")),d=!!p&&!!f&&p.id!==f.id,h=w=>{if(!d||!f)return!1;for(let b=1;b<w.length-2;b++){const x=w[b],E=w[b+1];if(Pt(x.y,E.y)&&!Pt(x.x,E.x)&&x.y>f.y&&x.y<f.y+f.height)return!0}return!1},m=h(e.waypoints);if(!Vd(e.waypoints,n)&&!(d&&!m))return null;const g=w=>w.reduce((b,x,E)=>E?b+Math.abs(x.x-w[E-1].x)+Math.abs(x.y-w[E-1].y):0,0);let R;for(const{pts:w,cost:b}of zd(e,i)){const x={...e,waypoints:w};if(zn(x,r).length>0||Tr(x,o)>a||Ri(x,o)>s)continue;const E=c(w),T=h(w);if(!(T&&!m)&&E>=u)continue;const A=T?0:1,F=g(w);(!R||A<R.lane||A===R.lane&&(E<R.sc||E===R.sc&&(b<R.cost||b===R.cost&&F<R.len)))&&(R={pts:w,sc:E,lane:A,cost:b,len:F})}return(R==null?void 0:R.pts)??null}function eE(e,t){const{elementRegistry:n}=e,i=e.modeling,r=Ut(n).edges.filter(o=>!t.has(o.id)&&o.waypoints.length>=4).map(o=>o.id).sort();for(const o of r){const a=Ut(n),s=a.edges.find(d=>d.id===o);if(!s||s.waypoints.length<4)continue;const c=Ci(a),u=a.edges.filter(d=>d.id!==o),l=zn(s,c).length,p=Tr(s,u),f=Ri(s,u);for(const d of Gu(s,a.shapes)){if(d.length>=s.waypoints.length)continue;const h={...s,waypoints:d};if(zn(h,c).length>l||Tr(h,u)>p||Ri(h,u)>f)continue;const m=n.get(o);m&&i.updateWaypoints(m,d);break}}}function Wd(e,t){const{elementRegistry:n}=e,i=e.modeling,r=Ut(n).edges.filter(o=>o.type==="bpmn:SequenceFlow"&&!t.has(o.id)).map(o=>o.id).sort();for(const o of r){const a=Ut(n),s=a.edges.find(l=>l.id===o);if(!s)continue;const c=Gd(s,a);if(!c)continue;const u=n.get(o);u&&i.updateWaypoints(u,c)}}function tE(e,t){const n=e.waypoints;if(n.length<3)return[];const i=[],r=t.get(e.endpoints[0]??""),o=t.get(e.endpoints[1]??""),a=Pt(n[0].x,n[1].x)&&!Pt(n[0].y,n[1].y),s=Pt(n[n.length-1].x,n[n.length-2].x)&&!Pt(n[n.length-1].y,n[n.length-2].y);for(const c of oo){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 Ud(e,t){const n=new Map(t.shapes.map(l=>[l.id,l])),i=Ci(t),r=t.edges.filter(l=>l.id!==e.id),o=Tr(e,r);if(o===0)return null;const a=Ri(e,r);let s;const c=l=>l.reduce((p,f,d)=>d?p+Math.abs(f.x-l[d-1].x)+Math.abs(f.y-l[d-1].y):0,0),u=[...zd(e,n),...tE(e,n)];for(const{pts:l,cost:p}of u){const f={...e,waypoints:l};if(zn(f,i).length>0)continue;const d=Tr(f,r),h=Ri(f,r);if(d>=o||h-a>o-d)continue;const m=c(l);(!s||d<s.opposite||d===s.opposite&&(h<s.cross||h===s.cross&&(p<s.cost||p===s.cost&&m<s.len)))&&(s={pts:l,opposite:d,cross:h,cost:p,len:m})}return(s==null?void 0:s.pts)??null}function Yd(e,t,n){const{elementRegistry:i}=e,r=e.modeling,o=Ut(i),a=qi(o).filter(l=>(l.kind==="edge-overlap-opposite"||l.kind==="edge-overlap-mixed")&&!t.has(Yi(l)));if(!a.length)return;const s=new Set;for(const l of a)if(!(l.kind!=="edge-overlap-opposite"&&l.kind!=="edge-overlap-mixed"))for(const p of l.edges)n.has(p)||s.add(p);const c=l=>{var p;return((p=o.edges.find(f=>f.id===l))==null?void 0:p.type)??""},u=[...s].sort((l,p)=>{const f=c(l)==="bpmn:SequenceFlow"?0:1,d=c(p)==="bpmn:SequenceFlow"?0:1;return f!==d?f-d:l.localeCompare(p)});for(const l of u){const p=Ut(i),f=p.edges.find(m=>m.id===l);if(!f)continue;const d=Ud(f,p);if(!d)continue;const h=i.get(l);h&&r.updateWaypoints(h,d)}}const nE=10,iE=(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 qd(e,t){const n=e.label;if(!n)return null;const i=t.edges.filter(a=>a.id!==e.id);if(!as(e,i))return null;const r=Ci(t),o=i.flatMap(hn);for(const a of hn(e)){let s=[[a.lo,a.hi]];for(const[d,h]of os(a,o))s=s.flatMap(([m,g])=>{const R=[];return d>m&&R.push([m,Math.min(g,d)]),h<g&&R.push([Math.max(m,h),g]),R.filter(([w,b])=>b>w)});const c=a.axis==="h"?n.width:n.height,u=s.find(([d,h])=>h-d>=c+nE*2);if(!u)continue;const l=(u[0]+u[1])/2,p=a.axis==="h"?{x:l,y:a.at-xd}:{x:a.at+Rn+n.width/2,y:l},f={x:p.x-n.width/2,y:p.y-n.height/2,width:n.width,height:n.height};if(!as({...e,label:f},i)&&!r.some(d=>!e.endpoints.includes(d.id)&&iE(f,d)))return f}return null}const Rn=8;function Kd(e,t){const n=e.label;if(!n)return null;const i=hn(e);if(!i.length)return null;const r=n.x+n.width/2,o=n.y+n.height/2,a=f=>{const d=f.axis==="h"?r:o,h=f.axis==="h"?o-f.at:r-f.at,m=d<f.lo?f.lo-d:d>f.hi?d-f.hi:0;return Math.hypot(h,m)},s=i.reduce((f,d)=>a(d)<a(f)?d:f,i[0]),c=[...i,...t.edges.filter(f=>f.id!==e.id).flatMap(hn),...t.shapes.filter(f=>f.container).flatMap(Wo)],u=f=>!c.some(d=>Si(f,d));if(u(n))return null;const l=(s.axis==="v"?n.height:n.width)+Rn,p=[0,-l,l,-2*l,2*l];if(s.axis==="v")for(const f of[s.at+Rn,s.at-Rn-n.width])for(const d of p){const h=n.y+d;if(h<s.lo||h+n.height>s.hi)continue;const m={...n,x:f,y:h};if(u(m))return m}else for(const f of[s.at-Rn-n.height,s.at+Rn])for(const d of p){const h=n.x+d;if(h<s.lo||h+n.width>s.hi)continue;const m={...n,x:h,y:f};if(u(m))return m}return null}function Xd(e,t){const{elementRegistry:n}=e,i=e.modeling,r=Ut(n);for(const o of r.edges){if(!o.label||t.has(o.id))continue;const a=Kd(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 Zd(e,t,n){const{elementRegistry:i}=e,r=e.modeling,o=Ut(i),a=qi(o).filter(s=>s.kind==="label-on-shared-segment"&&!t.has(Yi(s)));for(const s of a){if(s.kind!=="label-on-shared-segment"||n.has(s.edge))continue;const c=o.edges.find(f=>f.id===s.edge);if(!c)continue;const u=qd(c,o);if(!u)continue;const l=i.get(s.edge),p=l==null?void 0:l.label;p&&r.moveElements([p],{x:u.x-p.x,y:u.y-p.y})}}function Qd(e,t){const n=e.label;if(!n)return null;const i=[...t.edges.flatMap(hn),...t.shapes.filter(f=>f.container).flatMap(Wo)],r=i.filter(f=>Si(n,f));if(!r.length)return null;const o=t.shapes.filter(f=>!f.container&&f.id!==e.id),a=Uo(t).filter(f=>f.owner!==e.id).map(f=>f.rect),s=(f,d)=>f.x<d.x+d.width&&d.x<f.x+f.width&&f.y<d.y+d.height&&d.y<f.y+f.height,c=f=>!i.some(d=>Si(f,d))&&!o.some(d=>s(f,d))&&!a.some(d=>s(f,d)),u=[];for(const f of r)f.axis==="h"?u.push({...n,y:f.at-Rn-n.height},{...n,y:f.at+Rn}):u.push({...n,x:f.at-Rn-n.width},{...n,x:f.at+Rn});const l=e.x+e.width/2,p=e.y+e.height/2;return u.push({...n,x:l-n.width/2,y:e.y+e.height+Rn},{...n,x:l-n.width/2,y:e.y-Rn-n.height},{...n,x:e.x+e.width+Rn,y:p-n.height/2},{...n,x:e.x-Rn-n.width,y:p-n.height/2}),u.find(c)??null}function Jd(e,t){const{elementRegistry:n}=e,i=e.modeling,r=Ut(n);for(const o of r.shapes){if(o.container||!o.label||t.has(o.id))continue;const a=Qd(o,Ut(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 rE=/^[\p{L}_][\p{L}\p{N}_.\-]*$/u,eh=new Set(["sequenceFlow","messageFlow","dataAssociation","association"]),th={"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}]},fs=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),Wu=e=>typeof e=="string"&&e!=="";function oE(e){const t=[];function n(i,r,o,a){if(a===null){Wu(o)||t.push({kind:"payload-invalid",opIndex:i,field:r});return}if(!fs(o)){t.push({kind:"payload-invalid",opIndex:i,field:r});return}for(const s of a)Wu(o[s])||t.push({kind:"payload-invalid",opIndex:i,field:`${r}.${s}`})}return e.forEach((i,r)=>{if(!fs(i)||!Wu(i.kind)||!(i.kind in th)){t.push({kind:"payload-invalid",opIndex:r,field:"kind"});return}for(const o of th[i.kind]){const a=o.path.endsWith("[]"),s=a?o.path.slice(0,-2):o.path,c=s.split(".");let u=i;for(const p of c.slice(0,-1)){if(!fs(u))break;u=u[p]}if(!fs(u))continue;const l=u[c[c.length-1]];if(!(l===void 0&&o.optional)&&!(l===null&&o.optional)){if(!a){n(r,o.path,l,o.shape);continue}if(!Array.isArray(l)){t.push({kind:"payload-invalid",opIndex:r,field:o.path});continue}l.forEach((p,f)=>n(r,`${s}[${f}]`,p,o.shape))}}if(i.kind==="node.add"){const o=i.band;o!==void 0&&(!Number.isInteger(o)||o<0)&&t.push({kind:"payload-invalid",opIndex:r,field:"band"})}}),t}function nh(e,t){const n=oE(e);if(n.length>0)return n;const i=[],r=new Map,o=new Map;function a(f,d,h){if(!rE.test(d)){i.push({kind:"id-invalid",opIndex:f,id:d});return}if(t.categoryOf(d)!==void 0||r.has(d)){i.push({kind:"id-duplicate",opIndex:f,id:d});return}r.set(d,{...h,opIndex:f})}e.forEach((f,d)=>{var h;switch(f.kind){case"participant.add":a(d,f.participant.id,{category:"participant",lanes:(f.participant.lanes??[]).map(m=>m.id)});for(const m of f.participant.lanes??[])a(d,m.id,{category:"lane"});break;case"node.add":a(d,f.node.id,{category:"flowNode",participant:f.node.participant});break;case"sequenceFlow.add":a(d,f.flow.id,{category:"sequenceFlow"});break;case"messageFlow.add":a(d,f.flow.id,{category:"messageFlow"});break;case"dataStore.add":a(d,f.dataStore.id,{category:"dataStore"});for(const m of f.associations??[])m.id&&a(d,m.id,{category:"dataAssociation"});break;case"dataAssociation.add":f.association.id&&a(d,f.association.id,{category:"dataAssociation"});break;case"association.add":f.association.id&&a(d,f.association.id,{category:"association"});break;case"annotation.add":a(d,f.annotation.id,{category:"annotation"}),(h=f.association)!=null&&h.id&&a(d,f.association.id,{category:"association"});break;case"group.add":a(d,f.group.id,{category:"group"});break;case"participant.update":if(f.lanes){o.set(f.id,f.lanes.map(m=>m.id));for(const m of f.lanes)t.categoryOf(m.id)===void 0&&a(d,m.id,{category:"lane"})}break}});const s=f=>{var d;return((d=r.get(f))==null?void 0:d.category)??t.categoryOf(f)},c=f=>{const d=r.get(f);return d?d.category==="participant"?f:d.participant:t.categoryOf(f)==="participant"?f:t.participantOf(f)};function u(f,d,h,m){const g=s(d);if(g===void 0){i.push({kind:"ref-missing",opIndex:f,ref:d,role:h});return}if(m&&!m.includes(g)){i.push({kind:"ref-category",opIndex:f,ref:d,role:h,expected:m.join("|"),actual:g});return}return g}const l=t.isCollaboration()||e.some(f=>f.kind==="participant.add");return e.forEach((f,d)=>{var h;switch(f.kind){case"participant.add":break;case"node.add":{const{participant:m,lane:g}=f.node;if(m===void 0){(l||g!==void 0)&&i.push({kind:"participant-required",opIndex:d,id:f.node.id});break}if(u(d,m,"participant",["participant"])===void 0)break;g!==void 0&&((((h=r.get(m))==null?void 0:h.lanes)??o.get(m)??t.lanesOf(m)).includes(g)||i.push({kind:"lane-unknown",opIndex:d,lane:g,participant:m}));break}case"sequenceFlow.add":{const{id:m,source:g,target:R,name:w,condition:b}=f.flow,x=u(d,g,"source",["flowNode"]),E=u(d,R,"target",["flowNode"]);x&&E&&c(g)!==c(R)&&i.push({kind:"flow-cross-pool",opIndex:d,id:m}),w!==void 0&&b!==void 0&&i.push({kind:"condition-name-conflict",opIndex:d,id:m});break}case"messageFlow.add":{const{id:m,source:g,target:R}=f.flow,w=u(d,g,"source",["flowNode","participant"]),b=u(d,R,"target",["flowNode","participant"]);if(w&&b){const x=c(g),E=c(R);x!==void 0&&x===E&&i.push({kind:"message-flow-same-pool",opIndex:d,id:m})}break}case"dataStore.add":{for(const m of f.associations??[]){if([m.source,m.target].filter(w=>w===f.dataStore.id).length!==1){i.push({kind:"data-association-ends",opIndex:d,source:m.source,target:m.target});continue}const R=m.source===f.dataStore.id?m.target:m.source;u(d,R,"dataAssociation",["flowNode"])}break}case"dataAssociation.add":{const{source:m,target:g}=f.association,R=u(d,m,"source"),w=u(d,g,"target");if(R&&w){const b=new Set([R,w]);b.has("dataStore")&&b.has("flowNode")||i.push({kind:"data-association-ends",opIndex:d,source:m,target:g})}break}case"association.add":{const{id:m,source:g,target:R}=f.association,w=u(d,g,"source"),b=u(d,R,"target");w&&b&&w!=="annotation"&&b!=="annotation"&&i.push({kind:"association-detached",opIndex:d,annotation:m??`${g}->${R}`});break}case"annotation.add":{if(f.association){const{source:m,target:g}=f.association;if(m!==f.annotation.id&&g!==f.annotation.id)i.push({kind:"association-detached",opIndex:d,annotation:f.annotation.id});else{const R=m===f.annotation.id?g:m;u(d,R,"association")}}f.placement&&u(d,f.placement.anchor,"anchor");break}case"group.add":{for(const m of f.group.members??[]){const g=u(d,m,"member");g&&eh.has(g)&&i.push({kind:"ref-category",opIndex:d,ref:m,role:"member",expected:"shape",actual:g})}break}case"participant.update":{if(p(d,f.id,"participant")===void 0)break;if(f.lanes){const m=t.lanesOf(f.id),g=f.lanes.map(w=>w.id);for(const w of m)g.includes(w)||i.push({kind:"lane-shrink-unsupported",opIndex:d,participant:f.id,lane:w});for(const w of g)t.categoryOf(w)!==void 0&&!m.includes(w)&&i.push({kind:"id-duplicate",opIndex:d,id:w});const R=g.filter(w=>m.includes(w));R.length===m.length&&R.some((w,b)=>w!==m[b])&&i.push({kind:"lane-reorder-unsupported",opIndex:d,participant:f.id})}break}case"node.update":{if(p(d,f.id,"flowNode")===void 0)break;if(f.lane!==void 0){const m=t.participantOf(f.id);(m?o.get(m)??t.lanesOf(m):[]).includes(f.lane)||i.push({kind:"lane-unknown",opIndex:d,lane:f.lane,participant:m??""})}break}case"sequenceFlow.update":{if(p(d,f.id,"sequenceFlow")===void 0)break;if(f.name!==void 0&&f.condition!==void 0&&i.push({kind:"condition-name-conflict",opIndex:d,id:f.id}),f.source!==void 0||f.target!==void 0){const m=f.source===void 0||u(d,f.source,"source",["flowNode"])!==void 0,g=f.target===void 0||u(d,f.target,"target",["flowNode"])!==void 0,R=t.endpointsOf(f.id),w=f.source??(R==null?void 0:R.source),b=f.target??(R==null?void 0:R.target);m&&g&&w!==void 0&&b!==void 0&&new Set([c(w),c(b),c(f.id)]).size>1&&i.push({kind:"flow-cross-pool",opIndex:d,id:f.id})}break}case"messageFlow.update":p(d,f.id,"messageFlow");break;case"dataStore.update":p(d,f.id,"dataStore");break;case"annotation.update":{if(p(d,f.id,"annotation")===void 0)break;f.placement&&u(d,f.placement.anchor,"anchor");break}case"group.update":{if(p(d,f.id,"group")===void 0)break;for(const m of f.members??[]){const g=u(d,m,"member");g&&eh.has(g)&&i.push({kind:"ref-category",opIndex:d,ref:m,role:"member",expected:"shape",actual:g})}break}case"element.remove":{p(d,f.id)==="lane"&&i.push({kind:"ref-category",opIndex:d,ref:f.id,role:"target",expected:"removable",actual:"lane"});break}}}),i;function p(f,d,h){if(r.has(d)){i.push({kind:"target-added-in-batch",opIndex:f,id:d});return}const m=t.categoryOf(d);if(m===void 0){i.push({kind:"ref-missing",opIndex:f,ref:d,role:"target"});return}if(h&&m!==h){i.push({kind:"ref-category",opIndex:f,ref:d,role:"target",expected:h,actual:m});return}return m}}function ih(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 ds(e){return`bpmn:${e[0].toUpperCase()}${e.slice(1)}`}const Uu={"top-left":[-1,-1],top:[0,-1],"top-right":[1,-1],right:[1,0],"bottom-right":[1,1],bottom:[0,1],"bottom-left":[-1,1],left:[-1,0]};function Xt(e,t){return e.filter(n=>n.kind===t)}function rh(e,t){var Ex,Sx,Rx,Cx,Px,Ax;const{modeling:n,bpmnFactory:i,elementFactory:r,elementRegistry:o,canvas:a,autoPlace:s,bpmnReplace:c}=t,u=()=>a.getRootElement(),l=S=>o.get(S),p=S=>{const C=l(S);if(!C)throw new Error(`하강 참조 해소 실패: ${S}`);return C},f=S=>{let C=S.parent;for(;C;){if(C.type==="bpmn:Participant")return C;C=C.parent}},d=Xt(e,"participant.add"),h=Xt(e,"node.add"),m=Xt(e,"sequenceFlow.add"),g=Xt(e,"messageFlow.add"),R=Xt(e,"dataStore.add"),w=Xt(e,"dataAssociation.add"),b=Xt(e,"annotation.add"),x=Xt(e,"group.add"),E=new Map(h.map(S=>[S.node.id,S])),T=(S,C,M)=>{var oe;const j=S.businessObject,V=(((oe=j.extensionElements)==null?void 0:oe.values)??[]).filter(J=>J.$type!==C),I=M?[...V,i.create(C,M)]:V;if(!I.length){j.extensionElements&&n.updateProperties(S,{extensionElements:void 0});return}const Y=i.create("bpmn:ExtensionElements",{values:I});I.forEach(J=>{J.$parent=Y}),n.updateProperties(S,{extensionElements:Y})},L=S=>({anchor:S.anchor,side:S.side,...S.offset!==void 0?{offset:S.offset}:{}});for(const S of Xt(e,"element.remove")){const C=l(S.id);C&&n.removeElements([C])}const A=S=>o.filter(C=>{var M;return C.type==="bpmn:Lane"&&((M=f(C))==null?void 0:M.id)===S}).sort((C,M)=>C.y-M.y);for(const S of Xt(e,"participant.update")){const C=p(S.id);if(S.name!==void 0&&n.updateProperties(C,{name:S.name??void 0}),!S.lanes)continue;const M=A(S.id);if(!M.length){n.splitLane(C,S.lanes.length),A(S.id).forEach((V,I)=>{const Y=S.lanes[I];Y&&n.updateProperties(V,{id:Y.id,name:Y.name})});continue}const j=new Set(M.map(V=>V.id));S.lanes.forEach((V,I)=>{if(j.has(V.id)){n.updateProperties(p(V.id),{name:V.name});return}const Y=I===0?n.addLane(A(S.id)[0],"top"):n.addLane(p(S.lanes[I-1].id),"bottom");n.updateProperties(Y,{id:V.id,name:V.name})})}const F=150,z=130,B=80,G=90,fe=180,Fe=new Set;for(const S of d){Fe.add(`pool:${S.participant.id}`);for(const C of S.participant.lanes??[])Fe.add(C.id)}const lt=new Map;for(const S of h){const C=S.node.lane??`pool:${S.node.participant??""}`;let M=lt.get(C);M||lt.set(C,M=new Set([0])),S.band!==void 0&&M.add(S.band)}const q=new Map;for(const[S,C]of lt){if(!Fe.has(S))continue;const M=[...C].sort((I,Y)=>I-Y),j=M.map((I,Y)=>Y===0?0:Y%2===1?Math.ceil(Y/2):-(Y/2)),V=Math.min(...j);q.set(S,new Map(M.map((I,Y)=>[I,j[Y]-V])))}{const S=new Map;for(const C of d)(C.participant.lanes??[]).forEach((M,j)=>S.set(M.id,j));for(const[C,M]of q){if(!S.has(C)||M.size<2)continue;const j=S.get(C),V=M.get(0)??0,I=new Set;for(const Ne of h){if(Ne.node.lane!==C||(Ne.band??0)!==0||!Ne.node.type.endsWith("Gateway"))continue;const Te={in:new Set,out:new Set,cross:new Set};for(const ve of m){const nt=ve.flow.source===Ne.node.id;if(!nt&&ve.flow.target!==Ne.node.id)continue;const Bt=E.get(nt?ve.flow.target:ve.flow.source);if(!Bt||Bt.node.participant!==Ne.node.participant||!Bt.node.lane)continue;let Et,pt=!1;if(Bt.node.lane!==C){const Fn=S.get(Bt.node.lane);if(Fn===void 0)continue;Et=Fn>j?"down":"up",pt=!0}else{const Fn=M.get(Bt.band??0)??V;Et=Fn>V?"down":Fn<V?"up":void 0}Et&&(Te[nt?"out":"in"].add(Et),pt&&Te.cross.add(Et))}for(const ve of["up","down"])Te.in.has(ve)&&Te.out.has(ve)&&Te.cross.has(ve)&&I.add(ve)}if(I.size!==1)continue;const[Y]=I,oe=Math.max(...M.values()),J=Y==="down"?oe:0;if(V===J)continue;const le=[...M.entries()].filter(([Ne])=>Ne!==0).sort((Ne,Te)=>Ne[1]-Te[1]),Ye=[...Array(oe+1).keys()].filter(Ne=>Ne!==J),ct=new Map([[0,J]]);le.forEach(([Ne],Te)=>ct.set(Ne,Ye[Te])),q.set(C,ct)}}const de=S=>{var C;return(((C=lt.get(S))==null?void 0:C.size)??0)>1},he=S=>S.band??(S.node.lane||!de(`pool:${S.node.participant??""}`)?void 0:0),ce=new Map,ue=S=>ce.get(S.node.id)??he(S),ee=new Set,H=new Set;{const S=new Map;for(const j of m)S.set(j.flow.target,(S.get(j.flow.target)??0)+1);const C=j=>{const V=[],I=new Set([j]),Y=[j];for(;Y.length;){const oe=Y.shift();V.push(oe);for(const J of m)J.flow.source!==oe||I.has(J.flow.target)||(S.get(J.flow.target)??0)!==1||(I.add(J.flow.target),Y.push(J.flow.target))}return V},M=(j,V)=>{var I;return((I=q.get(j))==null?void 0:I.get(V))??V};for(const j of h){if(!j.node.type.endsWith("Gateway"))continue;const V=j.node.lane??`pool:${j.node.participant??""}`,I=q.get(V);if(!I||I.size<2)continue;const Y=ue(j);if(Y===void 0||M(V,Y)!==M(V,0))continue;const oe=M(V,Y),J=m.filter(ve=>ve.flow.source===j.node.id).map(ve=>E.get(ve.flow.target)).filter(ve=>!!ve&&(ve.node.lane??`pool:${ve.node.participant??""}`)===V),le=J.filter(ve=>{const nt=ue(ve);return nt!==void 0&&M(V,nt)===oe&&(S.get(ve.node.id)??0)===1}),Ye=J.some(ve=>{const nt=ue(ve);return nt!==void 0&&M(V,nt)>oe});if(le.length!==1||!Ye)continue;const ct=new Set(J.flatMap(ve=>C(ve.node.id)));if(!m.some(ve=>ve.flow.target===j.node.id&&ct.has(ve.flow.source)))continue;const Te=new Map;for(const[ve,nt]of I)Te.set(ve,nt+1);Te.set(-1,0),q.set(V,Te);for(const ve of C(le[0].node.id))E.has(ve)&&(ce.set(ve,-1),H.add(ve));ee.add(j.node.id)}}const $=(S,C)=>{var M;return((M=q.get(S))==null?void 0:M.get(C))??C},U=new Map;for(const[S,C]of lt){let M=0;for(const j of C)M=Math.max(M,$(S,j));U.set(S,M)}const ke=S=>fe+F*S,Lt=d.map((S,C)=>({op:S,declared:C}));Lt.sort((S,C)=>{const M=S.op.order??Number.POSITIVE_INFINITY,j=C.op.order??Number.POSITIVE_INFINITY;return M!==j?M-j:S.declared-C.declared});let P=80;for(const S of o.getAll())S.parent===u()&&"height"in S&&typeof S.y=="number"&&(P=Math.max(P,S.y+S.height+60));for(const{op:S}of Lt){const C=S.participant,M=h.filter(Ne=>Ne.node.participant===C.id).length,j=((Ex=C.lanes)==null?void 0:Ex.length)??0,V=Math.max(1200,M*160+300),I=(C.lanes??[]).map(Ne=>ke(U.get(Ne.id)??0)),Y=I.reduce((Ne,Te)=>Ne+Te,0);j&&Y<300&&(I[j-1]+=300-Y);const oe=Math.max(300,F*((U.get(`pool:${C.id}`)??0)+1)),J=C.blackBox||M+j===0?120:j?Math.max(300,Y):oe,le=r.createShape({type:"bpmn:Participant",businessObject:i.create("bpmn:Participant",{id:C.id,name:C.name,...S.order!==void 0?{"bwl:poolOrder":S.order}:{},...C.blackBox?{}:{processRef:i.create("bpmn:Process")}}),width:V,height:J,isExpanded:!0}),Ye=n.createShape(le,{x:100+V/2,y:P+J/2},u()),ct=C.lanes??[];if(ct.length&&n.splitLane(Ye,ct.length),ct.length){const Ne=o.filter(Te=>{var ve;return Te.type==="bpmn:Lane"&&((ve=f(Te))==null?void 0:ve.id)===C.id}).sort((Te,ve)=>Te.y-ve.y);if(Ne.forEach((Te,ve)=>{const nt=ct[ve];nt&&n.updateProperties(Te,{id:nt.id,name:nt.name})}),I.some(Te=>Te!==Ye.height/j)){let Te=Ye.y;Ne.forEach((ve,nt)=>{const Bt=I[nt];n.resizeShape(ve,{x:ve.x,y:Te,width:ve.width,height:Bt}),Te+=Bt})}}P=Ye.y+Ye.height+60}const _=S=>{var j;const C=E.get(S);if(C)return C.node.participant??"";const M=l(S);return M?M.type==="bpmn:Participant"?M.id:((j=f(M))==null?void 0:j.id)??"":""},y=new Map,D=S=>{let C=y.get(S);return C||y.set(S,C={nodes:[],flows:[]}),C};for(const S of h)D(S.node.participant??"").nodes.push(S);for(const S of m)D(_(S.flow.source)).flows.push(S);const N=S=>{var C;return i.create("bpmn:SequenceFlow",{id:S.id,name:S.name??((C=S.condition)==null?void 0:C.label)})},W=(S,C)=>r.createShape({type:ds(S.type),businessObject:i.create(ds(S.type),{id:S.id,name:S.name,...C!==void 0?{"bwl:band":C}:{}})}),ae=[...Lt.map(({op:S})=>S.participant.id).filter(S=>y.has(S)),...[...y.keys()].filter(S=>!d.some(C=>C.participant.id===S))],Pe=S=>S.endsWith("Gateway");for(const S of ae){const C=y.get(S),M=S?p(S):void 0,j=M?M.x+150:250;let V=M?M.y+80:120;const I=(ne,ge,pe)=>{const Ze=u().children.filter(qe=>!("waypoints"in qe&&qe.waypoints)&&qe.id!==ge&&typeof qe.y=="number"&&qe.y>=ne);Ze.length&&n.moveElements(Ze,{x:0,y:pe})},Y=(ne,ge)=>{if(ne){const Ae=p(ne),Ke=ke(ge);if(Ae.height>=Ke)return;const Vt=Ke-Ae.height,se=f(Ae),We=se?se.y+se.height:Ae.y+Ae.height;n.resizeLane(Ae,{x:Ae.x,y:Ae.y,width:Ae.width,height:Ke},!1),I(We,se==null?void 0:se.id,Vt);return}if(!M)return;const pe=F*(ge+1);if(M.height>=pe)return;const Ze=pe-M.height,qe=M.y+M.height;n.resizeShape(M,{x:M.x,y:M.y,width:M.width,height:pe}),I(qe,M.id,Ze)},oe=(ne,ge,pe)=>{if(ne){const Ze=p(ne);return Ze.y+Math.min(Ze.height/2,G)+$(ne,ge??0)*F}return ge!==void 0&&M?M.y+B+$(`pool:${S}`,ge)*F:pe},J=(ne,ge,pe)=>{if(ne){const Ze=p(ne);return Ze.y+Math.min(Ze.height/2,G)+ge*F}return M?M.y+B+ge*F:pe},le=ne=>ne.participant?p(ne.participant):u(),Ye=30,ct=(ne,ge,pe,Ze)=>{const qe=pe-ge.width/2,Ae=Ze-ge.height/2;return(ne.children??[]).find(Ke=>!("waypoints"in Ke&&Ke.waypoints)&&Ke.type!=="bpmn:Lane"&&Ke.type!=="label"&&typeof Ke.x=="number"&&qe<Ke.x+Ke.width+Ye&&qe+ge.width+Ye>Ke.x&&Ae<Ke.y+Ke.height&&Ae+ge.height>Ke.y)},Ne=(ne,ge,pe,Ze,qe,Ae)=>{const Ke=pe!==void 0||Ze!==void 0,Vt=$(pe??`pool:${S}`,Ze??0);if(Ke)for(let Le=0;Le<4;Le++){const Be=J(pe,Vt+Le,Ae);if(!ct(ne,ge,qe,Be))return Y(pe,Vt+Le),{x:qe,y:Be}}const se=oe(pe,Ze,Ae);Ke&&Y(pe,Vt);let We=qe;for(let Le=0;Le<64;Le++){const Be=ct(ne,ge,We,se);if(!Be)break;We=Be.x+Be.width+z+ge.width/2}return{x:We,y:se}},Te=new Set(C.flows.map(ne=>ne.flow.target)),ve=new Map;for(const ne of C.nodes){if(Te.has(ne.node.id))continue;const ge=W(ne.node,ne.band),pe=he(ne),Ze=ne.node.lane?`${ne.node.lane}|${pe??""}`:pe!==void 0?`band:${pe}`:"",qe=le(ne.node),Ae=Ne(qe,ge,ne.node.lane,pe,ve.get(Ze)??j,V);n.createShape(ge,Ae,qe),ve.set(Ze,Ae.x+ge.width+z),!ne.node.lane&&pe===void 0&&(V+=160)}const nt=new Set,Bt=new Map,Et=new Map,pt=new Map;if(S&&Fe.has(`pool:${S}`)){const ne=new Map;for(const se of C.flows)ne.set(se.flow.target,(ne.get(se.flow.target)??0)+1);const ge=se=>oe(se.node.lane,ue(se),Number.NaN),pe=new Set,Ze=se=>{var Be;const We=(Be=E.get(se))==null?void 0:Be.node.participant;if(We)return l(We);const Le=l(se);if(Le)return Le.type==="bpmn:Participant"?Le:f(Le)},qe=se=>{const We=[],Le=new Set([se]),Be=[se];for(;Be.length;){const gt=Be.shift(),Qe=E.get(gt);Qe&&We.push(Qe);for(const Ee of C.flows)Ee.flow.source!==gt||Le.has(Ee.flow.target)||(ne.get(Ee.flow.target)??0)!==1||(Le.add(Ee.flow.target),Be.push(Ee.flow.target))}return We},Ae=se=>{if(!M)return;const We=new Set(se.map(gt=>gt.node.id));let Le=!1,Be=!1;for(const gt of g){if(!We.has(gt.flow.source))continue;const Qe=Ze(gt.flow.target);!Qe||Qe.id===M.id||(Qe.y<M.y?Le=!0:Be=!0)}return Le&&!Be?"up":Be&&!Le?"down":void 0};for(const se of C.nodes){if(!Pe(se.node.type))continue;const We=oe(se.node.lane,he(se),Number.NaN);if(Number.isNaN(We))continue;const Le=[];for(const Ee of C.flows){if(Ee.flow.source!==se.node.id)continue;const ze=E.get(Ee.flow.target);if(!ze||ze.node.lane!==se.node.lane||(ne.get(ze.node.id)??0)!==1)continue;const Je=he(ze);if(Je===void 0)continue;const yn=oe(ze.node.lane,Je,Number.NaN);if(Number.isNaN(yn))continue;const qr=qe(ze.node.id),Kt=Ae(qr);Kt&&Le.push({subtree:qr,band:Je,row:yn,dir:Kt})}if(!Le.some(Ee=>Ee.dir==="up")||!Le.some(Ee=>Ee.dir==="down")||!Le.some(Ee=>Ee.dir==="up"&&Le.some(ze=>ze.dir==="down"&&ze.row<Ee.row)))continue;const gt=[...Le].sort((Ee,ze)=>Ee.row-ze.row);[...Le.filter(Ee=>Ee.dir==="up"),...Le.filter(Ee=>Ee.dir==="down")].sort((Ee,ze)=>Ee.dir===ze.dir?Ee.row-ze.row:Ee.dir==="up"?-1:1).forEach((Ee,ze)=>{const Je=gt[ze].band;if(Je!==Ee.band){pe.add(se.node.id);for(const yn of Ee.subtree)he(yn)===Ee.band&&ce.set(yn.node.id,Je)}})}const Ke=se=>{if(!M)return;const We=new Set(se.map(gt=>gt.node.id));let Le=!1,Be=!1;for(const gt of g){if(!We.has(gt.flow.target))continue;const Qe=Ze(gt.flow.source);!Qe||Qe.id===M.id||(Qe.y<M.y?Le=!0:Be=!0)}return Le&&!Be?"up":Be&&!Le?"down":void 0};for(const se of C.nodes){if(!Pe(se.node.type))continue;const We=se.node.lane??`pool:${S}`,Le=q.get(We);if(!Le||Le.size<2)continue;const Be=Le.get(0);if(Be===void 0)continue;const gt=Math.max(...Le.values()),Qe=Be===gt&&Be!==0?"down":void 0;if(!Qe)continue;const Ee=[];for(const Kt of C.flows){if(Kt.flow.source!==se.node.id)continue;const ti=E.get(Kt.flow.target);if(!ti||ti.node.lane!==se.node.lane||(ne.get(ti.node.id)??0)!==1)continue;const Tx=ue(ti);Tx!==void 0&&Ee.push({t:ti,subtree:qe(ti.node.id),band:Tx})}const ze=Ee.find(Kt=>(Le.get(Kt.band)??Kt.band)===Be);if(!ze||Ke(ze.subtree)===Qe||Ae(ze.subtree)===Qe)continue;const Je=Ee.find(Kt=>Kt!==ze&&Ke(Kt.subtree)===Qe);if(!Je)continue;const yn=ze.band,qr=Je.band;for(const Kt of ze.subtree)ue(Kt)===yn&&ce.set(Kt.node.id,qr);for(const Kt of Je.subtree)ue(Kt)===qr&&ce.set(Kt.node.id,yn);pe.add(se.node.id)}for(const se of C.nodes){if(!Pe(se.node.type))continue;const We=ge(se);if(Number.isNaN(We)||b.some(Ee=>{var ze,Je;return(((ze=Ee.placement)==null?void 0:ze.anchor)??(Ee.association?Ee.association.source===Ee.annotation.id?Ee.association.target:Ee.association.source:void 0))===se.node.id&&((Je=Ee.placement)==null?void 0:Je.side.startsWith("bottom"))}))continue;let Be,gt=!1,Qe;for(const Ee of C.flows){if(Ee.flow.source!==se.node.id)continue;const ze=E.get(Ee.flow.target);if(!ze||!ze.node.lane&&he(ze)===void 0)continue;const Je=ge(ze);Number.isNaN(Je)||(Math.abs(Je-We)<.5&&(gt=!0),Je>We?!Be||Je>Be.row?Be={id:ze.node.id,row:Je,count:1}:Je===Be.row&&Be.count++:Je<We&&ze.node.lane===se.node.lane&&(!Qe||Je>Qe.row?Qe={op:ze,row:Je,count:1}:Je===Qe.row&&Qe.count++))}Be&&Be.count===1&&(ne.get(Be.id)??0)===1&&!pe.has(se.node.id)&&nt.add(Be.id),!gt&&Qe&&Qe.count===1&&(ne.get(Qe.op.node.id)??0)===1&&!ee.has(se.node.id)&&Bt.set(Qe.op.node.id,{lane:se.node.lane,band:ue(se)})}const Vt=new Map;for(const se of g)Vt.set(se.flow.target,[...Vt.get(se.flow.target)??[],se]);for(const se of C.nodes){const We=Vt.get(se.node.id);if(!We||We.length!==1||!ne.get(se.node.id)||!se.node.lane&&he(se)===void 0||H.has(se.node.id))continue;const Le=(Sx=E.get(We[0].flow.source))==null?void 0:Sx.node.participant,Be=Le?l(Le):void 0;if(!Be||!M||Be.id===M.id)continue;const gt=se.node.lane??`pool:${S}`,Qe=q.get(gt);if(!Qe)continue;const Ee=Qe.get(0)??0,ze=(Qe.get(ue(se)??0)??Ee)-Ee;if(ze===0)continue;const Je=Be.y<M.y;if(Je&&ze<0||!Je&&ze>0)continue;let yn;for(const[qr,Kt]of Qe){const ti=Kt-Ee;(Je&&ti<0&&(!yn||ti<yn.row)||!Je&&ti>0&&(!yn||ti>yn.row))&&(yn={band:qr,row:ti})}yn&&Et.set(se.node.id,{lane:se.node.lane,band:yn.band})}}const Fn=new Set;let _u=0;for(;_u++<C.nodes.length+2;){for(let pe=0;pe<C.nodes.length+C.flows.length+2;pe++){let Ze=!1;for(const qe of C.flows){const Ae=qe.flow;if(Fn.has(Ae.id))continue;const Ke=l(Ae.source);if(!Ke)continue;const Vt=l(Ae.target),se=E.get(Ae.target);if(!Vt&&se){const We=W(se.node,se.band),Le=ue(se);if(se.node.lane||Le!==void 0){const Be=le(se.node),gt=Ke,Qe=gt.x+(pt.get(Ae.source)??0)+gt.width+z,Ee=Bt.get(Ae.target)??Et.get(Ae.target),ze=Ne(Be,We,Ee?Ee.lane:se.node.lane,Ee?Ee.band:Le,nt.has(Ae.target)?gt.x+gt.width/2:Qe,Number.NaN),Je=n.createShape(We,ze,Be);nt.has(Ae.target)&&pt.set(Ae.target,Qe-(Je.x+Je.width/2)),n.connect(Ke,Je,{type:"bpmn:SequenceFlow",businessObject:N(Ae)})}else s.append(Ke,We,{connection:{type:"bpmn:SequenceFlow",businessObject:N(Ae)}})}else if(Vt)n.connect(Ke,Vt,{type:"bpmn:SequenceFlow",businessObject:N(Ae)});else continue;Fn.add(Ae.id),Ze=!0}if(!Ze)break}const ne=C.nodes.filter(pe=>!l(pe.node.id));if(!ne.length)break;const ge=ne[0];{const pe=W(ge.node,ge.band),Ze=le(ge.node),qe=he(ge);n.createShape(pe,Ne(Ze,pe,ge.node.lane,qe,j,V),Ze),!ge.node.lane&&qe===void 0&&(V+=160)}}}const Ue=40,ft=(S,C=()=>!0)=>{const M=l(S);if(!M)return[];const j=[M],V=new Set([S]);for(let I=0;I<j.length;I++){const Y=j[I].id;for(const oe of m){const J=oe.flow.target;if(oe.flow.source!==Y||V.has(J)||!E.has(J))continue;V.add(J);const le=l(J);le&&C(le)&&j.push(le)}}return j},tt=(S,C=()=>!0)=>{const M=l(S);if(!M)return[];const j=[M],V=new Set([S]);for(let I=0;I<j.length;I++){const Y=j[I].id;for(const oe of m){const J=oe.flow.source;if(oe.flow.target!==Y||V.has(J)||!E.has(J))continue;V.add(J);const le=l(J);le&&C(le)&&j.push(le)}}return j};for(const S of Xt(e,"sequenceFlow.update")){if(S.target===void 0)continue;const C=E.get(S.target);if(!C)continue;const M=l(S.target),j=l(S.id);if(!M||!j)continue;const V=S.source!==void 0?l(S.source):j.source,I=j.target;if(!V||!I||I.id===M.id)continue;const Y=ft(S.target),oe=new Set(Y.map(Te=>Te.id)),J=Math.min(...Y.map(Te=>Te.x)),le=Math.max(...Y.map(Te=>Te.x+Te.width)),Ye=V.x+V.width,ct=le-J+Ue*2-(I.x-Ye);if(ct>0){const Te=f(M),ve=(Te==null?void 0:Te.children)??[],nt=pt=>pt.type==="bpmn:Lane",Bt=ve.filter(pt=>!("waypoints"in pt&&pt.waypoints)&&!nt(pt)&&!oe.has(pt.id)&&pt.x>=I.x),Et=Te?[Te,...ve.filter(pt=>nt(pt))]:[];Bt.length&&n.createSpace(Bt,Et,{x:ct,y:0},"e",I.x-1)}const Ne=C.node.lane||C.band!==void 0?M.y+M.height/2:V.y+V.height/2;n.moveElements(Y,{x:Ye+Ue-J,y:Ne-(M.y+M.height/2)})}const It=(S,C)=>{const M=C.target===S,j=p(C.source),V=p(C.target),I=M?"bpmn:DataOutputAssociation":"bpmn:DataInputAssociation";n.connect(j,V,C.id?{type:I,businessObject:i.create(I,{id:C.id})}:{type:I})},un=100,ln=S=>{for(const C of d){if(!C.participant.blackBox)continue;const M=l(C.participant.id);if(!M)continue;const j=[];for(const I of g){const Y=I.flow.source===C.participant.id?I.flow.target:I.flow.target===C.participant.id?I.flow.source:void 0,oe=Y?l(Y):void 0;oe&&typeof oe.x=="number"&&oe.type!=="bpmn:Participant"&&j.push(oe)}if(!j.length)continue;const V=Math.max(...j.map(I=>I.x+I.width/2))+un;if(V>M.x+M.width&&n.resizeShape(M,{x:M.x,y:M.y,width:V-M.x,height:M.height}),!!S)for(const I of g){const Y=l(I.flow.id),oe=I.flow.source===C.participant.id?I.flow.target:I.flow.target===C.participant.id?I.flow.source:void 0,J=oe?l(oe):void 0;if(!Y||!J||J.type==="bpmn:Participant")continue;const le=J.x+J.width/2;if(le<M.x+10||le>M.x+M.width-10)continue;const Ye=M.y>J.y,ct=Ye?J.y+J.height:J.y,Ne=Ye?M.y:M.y+M.height,Te=I.flow.source===C.participant.id?[{x:le,y:Ne},{x:le,y:ct}]:[{x:le,y:ct},{x:le,y:Ne}],ve=Ut(o),nt={...ve.edges.find(Bt=>Bt.id===I.flow.id),waypoints:Te};zn(nt,Ci(ve)).length||n.updateWaypoints(Y,Te)}}};ln(!1);for(const S of g){const C=S.flow;n.connect(p(C.source),p(C.target),{type:"bpmn:MessageFlow",businessObject:i.create("bpmn:MessageFlow",{id:C.id,name:C.name})})}const at=100,Nt=30,pn=4,jo=S=>!("waypoints"in S&&S.waypoints)&&S.type!=="bpmn:Lane"&&S.type!=="label"&&typeof S.x=="number",fn=()=>{const S=Ut(o);return{bad:qi(S).filter(C=>C.kind==="edge-crosses-shape"||C.kind==="edge-overlap-opposite"||C.kind==="edge-overlap-mixed").length,crossings:Rd(S),straight:S.edges.filter(C=>C.type==="bpmn:MessageFlow"&&C.waypoints.length===2).length}},Ln=S=>{const C=Ut(o),M=C.edges.find(j=>j.id===S);return M?zn(M,Ci(C)).length:0},In=S=>Ln(S)>0,Rt=(S,C,M)=>{const j=new Set(S.map(le=>le.id)),V=(C.children??[]).filter(jo).filter(le=>!j.has(le.id));if(S.some(le=>V.some(Ye=>le.x+M<Ye.x+Ye.width+Nt&&le.x+M+le.width+Nt>Ye.x&&le.y<Ye.y+Ye.height&&le.y+le.height>Ye.y)))return null;const Y=C.width;n.moveElements(S,{x:M,y:0});const J=Math.max(...S.map(le=>le.x+le.width))+150-(C.x+C.width);return J>0&&n.resizeShape(C,{x:C.x,y:C.y,width:C.width+J,height:C.height}),()=>{n.moveElements(S,{x:-M,y:0}),J>0&&n.resizeShape(C,{x:C.x,y:C.y,width:Y,height:C.height})}},Er=(S,C)=>C.bad>S.bad||C.crossings>S.crossings&&C.straight<=S.straight&&C.bad>=S.bad,Fo=(S,C,M,j=()=>!0)=>{const V=fn(),I=Rt(S,C,M);if(!I)return!1;const Y=fn();return Er(V,Y)||!j()?(I(),!1):!0},xn=S=>{var C;return!!((C=E.get(S))!=null&&C.node.participant)},He=new Map;for(const S of g){if(!xn(S.flow.target))continue;const C=He.get(S.flow.target)??[];C.push(S),He.set(S.flow.target,C)}const Xe=[...He.keys()],hx=new Set(m.map(S=>S.flow.target)),mx=S=>Lt.findIndex(({op:C})=>C.participant.id===S);Xe.sort((S,C)=>{var V,I;const M=hx.has(S)?1:0,j=hx.has(C)?1:0;return M!==j?M-j:mx((V=E.get(S))==null?void 0:V.node.participant)-mx((I=E.get(C))==null?void 0:I.node.participant)});const vu=S=>S.x+S.width/2,UD=S=>{const C=new Map;for(const V of o.getAll()){const I=V;if(!I.waypoints||!I.source||!I.target)continue;(C.get(I.source.id)??C.set(I.source.id,[]).get(I.source.id)).push(I.target.id)}const M=new Set([S]),j=[S];for(let V=0;V<j.length;V++)for(const I of C.get(j[V])??[])M.has(I)||(M.add(I),j.push(I));return M},YD=(S,C)=>{const M=UD(C);let j;for(const V of o.getAll()){const I=V;if(I.type!=="bpmn:MessageFlow"||!I.source||!I.target||I.target.id!==S||M.has(I.source.id))continue;const Y=I.source;if(typeof Y.x!="number"||Y.type==="bpmn:Participant")continue;const oe=vu(Y);(j===void 0||oe>j)&&(j=oe)}return j},Bf=(S,C)=>{const M=l(S.flow.source);if(M)return M.type==="bpmn:Participant"?YD(M.id,C):vu(M)},gx=S=>{let C;for(const M of He.get(S)??[]){const j=Bf(M,S);j!==void 0&&(!C||j>C.cx)&&(C={op:M,cx:j})}return C==null?void 0:C.op},qD=S=>{const C=gx(S),M=l(S),j=C?Bf(C,S):void 0;return M&&j!==void 0?j-vu(M):void 0},KD=S=>{const C=qD(S);return C!==void 0&&Math.abs(C)<at},$f=S=>{const C=gx(S);if(!C)return null;const M=l(S),j=l(C.flow.source),V=Bf(C,S);if(!M||!j||V===void 0)return null;const I=V-vu(M);if(I>=at){const Y=p(E.get(S).node.participant);return{subtree:ft(S,oe=>oe.x>=M.x),pool:Y,dx:I}}if(-I>=at&&xn(C.flow.source)){const Y=p(E.get(C.flow.source).node.participant);return{subtree:ft(C.flow.source,oe=>oe.x>=j.x&&!KD(oe.id)),pool:Y,dx:-I}}return null},yx=()=>Xe.map(S=>({id:S,plan:$f(S)})).filter(S=>!!S.plan).sort((S,C)=>Math.min(...S.plan.subtree.map(M=>M.x))-Math.min(...C.plan.subtree.map(M=>M.x))).map(S=>S.id);for(let S=0;S<3;S++){const C=fn(),M=[];for(const V of yx()){const I=$f(V);if(!I)continue;const Y=Rt(I.subtree,I.pool,I.dx);Y&&M.push(Y)}if(!M.length)break;if(!Er(C,fn()))continue;for(const V of M.reverse())V();let j=!1;for(const V of yx()){const I=$f(V);I&&Fo(I.subtree,I.pool,I.dx)&&(j=!0)}if(!j)break}for(const S of Xe.flatMap(C=>He.get(C)??[])){if(!In(S.flow.id))continue;const C=l(S.flow.target);if(!C)continue;const M=p(E.get(S.flow.target).node.participant),j=ft(S.flow.target,Y=>Y.x>=C.x),V=C.width+z,I=Ln(S.flow.id);for(let Y=1;Y<=pn&&!Fo(j,M,V*Y,()=>Ln(S.flow.id)<I);Y++);}for(const S of g){if(!In(S.flow.id))continue;const C=l(S.flow.source),M=l(S.flow.target);if(!C||!M||C.type==="bpmn:Participant"||M.type==="bpmn:Participant")continue;const j=C.x+C.width/2;if(Math.abs(j-(M.x+M.width/2))>15)continue;const[V,I]=C.y<M.y?[C.y+C.height,M.y]:[M.y+M.height,C.y],Y=[...E.values()].map(oe=>l(oe.node.id)).filter(oe=>!!oe&&oe.id!==C.id&&oe.id!==M.id).filter(oe=>oe.x<=j&&j<=oe.x+oe.width&&oe.y+oe.height>V&&oe.y<I).sort((oe,J)=>oe.x-J.x);for(const oe of Y){const J=(Rx=E.get(oe.id))==null?void 0:Rx.node.participant,le=J?l(J):void 0;if(!le)continue;const Ye=[...E.values()].filter(Et=>Et.node.participant===J).map(Et=>Et.node.id),ct=Et=>Et.map(pt=>l(pt)).filter(pt=>!!pt),Te=[tt(oe.id,Et=>{var pt;return((pt=E.get(Et.id))==null?void 0:pt.node.participant)===J}),ct(Ye)].filter(Et=>Et.length),ve=oe.width+z,nt=Ln(S.flow.id);let Bt=!1;for(const Et of Te){for(let pt=1;pt<=pn;pt++)if(Fo(Et,le,ve*pt,()=>Ln(S.flow.id)<nt)){Bt=!0;break}if(Bt)break}if(!In(S.flow.id))break}}{const S=M=>M.y+M.height/2,C=[];for(const M of E.keys()){if(!xn(M))continue;const j=m.filter(Y=>Y.flow.target===M);if(j.length!==1)continue;const V=l(j[0].flow.source),I=l(M);!V||!I||!E.has(V.id)||Math.abs(S(V)-S(I))>1||I.x-(V.x+V.width)<=z+1||C.push({id:M,pred:V,node:I})}C.sort((M,j)=>M.node.x-j.node.x);for(const{id:M}of C){const j=E.get(M),V=l(M),I=l(m.find(Ne=>Ne.flow.target===M).flow.source);if(!V||!I)continue;const Y=V.x-(I.x+I.width);if(Y<=z+1)continue;const oe=p(j.node.participant),J=ft(M,Ne=>Ne.x>=V.x),le=fn(),Ye=Rt(J,oe,-(Y-z));if(!Ye)continue;const ct=fn();(ct.bad>le.bad||ct.crossings>=le.crossings)&&Ye()}}ln(!0);for(const S of R){const C=S.associations??[],M=C.map(I=>I.source===S.dataStore.id?I.target:I.source).map(l).find(Boolean),j=M?f(M)??u():u(),V=M?{x:M.x+M.width/2,y:M.y+M.height+110}:{x:200,y:P+60};n.createShape({type:"bpmn:DataStoreReference",businessObject:i.create("bpmn:DataStoreReference",{id:S.dataStore.id,name:S.dataStore.name})},V,j);for(const I of C)It(S.dataStore.id,I)}for(const S of w){const M=p(S.association.target).type==="bpmn:DataStoreReference"?S.association.target:S.association.source;It(M,S.association)}let vx=0;const XD=10,_x=(S,C)=>{for(const M of C.map(j=>f(j)).filter(j=>!!j)){const j=XD,V=M.y,I=M.y+M.height,Y=M.x,oe=M.x+M.width;if(Math.abs(S.y-V)<j){const J=V+j-S.y;S.y+=J,S.height-=J}if(Math.abs(S.y+S.height-I)<j&&(S.height=I-j-S.y),Math.abs(S.x-Y)<j){const J=Y+j-S.x;S.x+=J,S.width-=J}Math.abs(S.x+S.width-oe)<j&&(S.width=oe-j-S.x)}};for(const S of x){const C=(S.group.members??[]).map(l).filter(I=>!!I),M=40;let j;if(C.length){const I=Math.min(...C.map(le=>le.x))-M,Y=Math.min(...C.map(le=>le.y))-M,oe=Math.max(...C.map(le=>le.x+le.width))+M,J=Math.max(...C.map(le=>le.y+le.height))+M;j={x:I,y:Y,width:oe-I,height:J-Y},_x(j,C)}else j={x:300+vx*350,y:40,width:300,height:200},vx++;const V=n.createShape({type:"bpmn:Group",businessObject:i.create("bpmn:Group",{id:S.group.id}),width:j.width,height:j.height},{x:j.x+j.width/2,y:j.y+j.height/2},u());S.group.name&&n.updateLabel(V,S.group.name),(Cx=S.group.members)!=null&&Cx.length&&T(V,"bwl:Members",{refs:S.group.members.join(" ")})}const bx=S=>{const C=S.waypoints;if(C!=null&&C.length){const j=C[Math.floor((C.length-1)/2)];return{x:j.x,y:j.y,width:0,height:0}}const M=S;return{x:M.x,y:M.y,width:M.width,height:M.height}};let qa=0;const xx=12,wx=14,ZD=15,QD=300,JD=S=>{const C=S.split(`
7
+ `),M=Math.max(...C.map(I=>io(I,xx))),j=Math.max(100,Math.min(QD,Math.ceil(M)+wx)),V=C.reduce((I,Y)=>I+Math.max(1,Math.ceil((io(Y,xx)+wx)/j)),0);return{width:j,height:Math.max(30,V*ZD+10)}},tn=10;for(const S of b){const C=S.association,M=((Px=S.placement)==null?void 0:Px.anchor)??(C?C.source===S.annotation.id?C.target:C.source:void 0),j=M?l(M):void 0,V=j?bx(j):void 0,I=JD(S.annotation.text??"");let Y;if(V&&S.placement){const[Ye,ct]=Uu[S.placement.side],Ne=S.placement.offset??50;Y={x:V.x+V.width/2+Ye*(V.width/2+I.width/2+Ne),y:V.y+V.height/2+ct*(V.height/2+I.height/2+Ne)}}else V?(Y={x:V.x+V.width/2+180+qa%3*260,y:V.y-110-qa%2*95},qa++):(Y={x:300+qa*260,y:60},qa++);const oe=j?f(j)??u():u(),J=oe;if(V&&typeof J.x=="number"&&typeof J.width=="number"&&J.type==="bpmn:Participant"){const Ye=(ne,ge)=>{const[pe,Ze]=Uu[ne];let qe={x:V.x+V.width/2+pe*(V.width/2+I.width/2+ge),y:V.y+V.height/2+Ze*(V.height/2+I.height/2+ge)};const Ae=J.x+tn+I.width/2,Ke=J.x+J.width-tn-I.width/2,Vt=J.y+tn+I.height/2,se=J.y+J.height-tn-I.height/2,We={x:Math.min(Ke,Math.max(Ae,qe.x)),y:Math.min(se,Math.max(Vt,qe.y))};return(We.x!==qe.x||We.y!==qe.y)&&(qe=Math.abs(We.x-(V.x+V.width/2))<(V.width+I.width)/2+tn&&Math.abs(We.y-(V.y+V.height/2))<(V.height+I.height)/2+tn?{x:V.x+V.width+tn+I.width/2,y:We.y}:We),qe},ct=(J.children??[]).filter(ne=>!("waypoints"in ne&&ne.waypoints)&&ne.type!=="bpmn:Lane"&&ne.type!=="label"&&typeof ne.x=="number"),Ne=Ut(o),Te=Ne.edges.flatMap(hn),ve=Uo(Ne).map(ne=>ne.rect),nt=ne=>({x0:ne.x-I.width/2-tn,x1:ne.x+I.width/2+tn,y0:ne.y-I.height/2-tn,y1:ne.y+I.height/2+tn}),Bt=ne=>{const ge=nt(ne);return ct.some(pe=>ge.x0<pe.x+pe.width&&ge.x1>pe.x&&ge.y0<pe.y+pe.height&&ge.y1>pe.y)},Et=ne=>{const ge=nt(ne);return Te.some(pe=>pe.axis==="h"?pe.at>ge.y0&&pe.at<ge.y1&&pe.lo<ge.x1&&pe.hi>ge.x0:pe.at>ge.x0&&pe.at<ge.x1&&pe.lo<ge.y1&&pe.hi>ge.y0)},pt=ne=>{const ge=nt(ne);return ve.some(pe=>ge.x0<pe.x+pe.width&&ge.x1>pe.x&&ge.y0<pe.y+pe.height&&ge.y1>pe.y)},Fn=ne=>Bt(ne)||Et(ne)||pt(ne),_u=ne=>ne.x-I.width/2>=J.x&&ne.x+I.width/2<=J.x+J.width&&ne.y-I.height/2>=J.y&&ne.y+I.height/2<=J.y+J.height;if(S.placement){const ne=Ae=>Ae.startsWith("top")?Ae.replace(/^top/,"bottom"):Ae.replace(/^bottom/,"top"),ge=Ae=>Ae.endsWith("left")?Ae.replace(/left$/,"right"):Ae.replace(/right$/,"left"),pe=S.placement.side,Ze=[pe,ne(pe),ge(pe),ne(ge(pe)),"top","bottom","left","right","top-left","top-right","bottom-left","bottom-right"],qe=S.placement.offset??50;if(Y=Ye(pe,qe),Fn(Y)){const Ae=new Set;for(const Ke of Ze){if(Ae.has(Ke))continue;Ae.add(Ke);const Vt=Ye(Ke,qe);if(_u(Vt)&&!Fn(Vt)){Y=Vt;break}}}}else{const ne=J.x+tn+I.width/2,ge=J.x+J.width-tn-I.width/2,pe=J.y+tn+I.height/2,Ze=J.y+J.height-tn-I.height/2;if(Y={x:Math.min(ge,Math.max(ne,Y.x)),y:Math.min(Ze,Math.max(pe,Y.y))},Fn(Y)){const qe=(V.width+I.width)/2+tn,Ke=[{x:Y.x+qe,y:Y.y},{x:Y.x-qe,y:Y.y},{x:Y.x,y:Y.y-I.height-tn},{x:Y.x,y:Y.y+I.height+tn}].filter(_u).find(Vt=>!Fn(Vt));Ke&&(Y=Ke)}}}const le=n.createShape({type:"bpmn:TextAnnotation",width:I.width,height:I.height,businessObject:i.create("bpmn:TextAnnotation",{id:S.annotation.id,text:S.annotation.text})},Y,oe);if(C){const Ye=ct=>ct===S.annotation.id?le:p(ct);n.connect(Ye(C.source),Ye(C.target),C.id?{type:"bpmn:Association",businessObject:i.create("bpmn:Association",{id:C.id})}:{type:"bpmn:Association"})}S.placement&&T(le,"bwl:Placement",L(S.placement))}for(const S of Xt(e,"association.add")){const C=S.association;n.connect(p(C.source),p(C.target),C.id?{type:"bpmn:Association",businessObject:i.create("bpmn:Association",{id:C.id})}:{type:"bpmn:Association"})}for(const S of Xt(e,"node.update")){let C=p(S.id);if(S.type&&ds(S.type)!==C.type&&(C=c.replaceElement(C,{type:ds(S.type)})),S.name!==void 0&&n.updateProperties(C,{name:S.name??void 0}),S.lane){const M=p(S.lane),j=M.y+M.height/2-(C.y+C.height/2);j!==0&&n.moveElements([C],{x:0,y:j})}}for(const S of Xt(e,"sequenceFlow.update")){const C=p(S.id);if(S.source!==void 0||S.target!==void 0){const M=C,j=S.source!==void 0?p(S.source):M.source,V=S.target!==void 0?p(S.target):M.target,I=Y=>({x:Y.x+Y.width/2,y:Y.y+Y.height/2});n.reconnect(M,j,V,[I(j),I(V)])}S.name!==void 0&&n.updateProperties(C,{name:S.name??void 0}),S.condition!==void 0&&n.updateProperties(C,{name:((Ax=S.condition)==null?void 0:Ax.label)??void 0})}for(const S of Xt(e,"messageFlow.update"))S.name!==void 0&&n.updateProperties(p(S.id),{name:S.name??void 0});for(const S of Xt(e,"dataStore.update"))S.name!==void 0&&n.updateProperties(p(S.id),{name:S.name??void 0});for(const S of Xt(e,"annotation.update")){const C=p(S.id);if(S.text!==void 0&&n.updateProperties(C,{text:S.text}),S.placement===null)T(C,"bwl:Placement",null);else if(S.placement){const M=bx(p(S.placement.anchor)),[j,V]=Uu[S.placement.side],I=S.placement.offset??50,Y=M.x+M.width/2+j*(M.width/2+C.width/2+I),oe=M.y+M.height/2+V*(M.height/2+C.height/2+I);n.moveElements([C],{x:Y-(C.x+C.width/2),y:oe-(C.y+C.height/2)}),T(C,"bwl:Placement",L(S.placement))}}for(const S of Xt(e,"group.update")){const C=p(S.id);if(S.name!==void 0&&n.updateLabel(C,S.name??""),S.members){const M=S.members.map(l).filter(j=>!!j);if(M.length){const V=Math.min(...M.map(le=>le.x))-40,I=Math.min(...M.map(le=>le.y))-40,Y=Math.max(...M.map(le=>le.x+le.width))+40,oe=Math.max(...M.map(le=>le.y+le.height))+40,J={x:V,y:I,width:Y-V,height:oe-I};_x(J,M),n.resizeShape(C,J)}T(C,"bwl:Members",{refs:S.members.join(" ")})}}}function oh(e,t,n=rh){const i=ih(e),r=nh(t,Dd(i.elementRegistry)),o={edgeCrossings:{before:0,after:0,pairs:[]}};if(r.length)return{ok:!1,issues:r,findings:[],stats:o};const a=Ut(i.elementRegistry),s=new Set(qi(a).map(Yi)),c=new Set(a.edges.map(m=>m.id)),u=new Set(a.shapes.map(m=>m.id)),l=Vu(a).length,p=e.get("commandStack");try{Vf(p,()=>{n(t,i),Hd(i,c),$d(i,s),Yd(i,s,c),Wd(i,c),eE(i,c),Zd(i,s,c),Xd(i,c),Jd(i,u)})}catch(m){return{ok:!1,issues:[{kind:"lower-failed",message:m instanceof Error?m.message:String(m)}],findings:[],stats:o}}const f=Ut(i.elementRegistry),d=qi(f).filter(m=>!s.has(Yi(m))),h=Vu(f);return{ok:!0,issues:[],findings:d,stats:{edgeCrossings:{before:l,after:h.length,pairs:h}}}}function aE(e){const t=e.slice(e.indexOf(":")+1);return t.charAt(0).toLowerCase()+t.slice(1)}function sE(e,t){return typeof e.get=="function"?e.get(t):e[t]}function ah(e,t){const n=sE(e,t);return typeof n=="number"&&Number.isFinite(n)?n:void 0}function sh(e,t){var i;return(((i=e.extensionElements)==null?void 0:i.values)??[]).find(r=>(r==null?void 0:r.$type)===t)}function cE(e){return typeof e=="string"&&xu.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 ch(e){const t=e.rootElements??[],n=t.find(q=>q.$type==="bpmn:Collaboration"),i=new Map(t.filter(q=>q.$type==="bpmn:Process").map(q=>[q.id,q])),r=[],o=[],a=[],s=[],c=[],u=[],l={poolOrders:{},bands:{},placements:{}},p=[],f=[],d=[],h=[],m=[],g=[],R=new Set,w=new Set,b=q=>{q&&R.add(q)},x=q=>{R.add(q),w.add(q)},E=q=>{const de=sh(q,"bwl:Placement");if(!de)return;const he=typeof de.anchor=="string"?de.anchor:void 0;if(!he||!cE(de.side))return;const ce=typeof de.offset=="number"?de.offset:void 0;m.push({owner:q.id,anchor:he,side:de.side,...ce!==void 0?{offset:ce}:{}})},T=q=>{const de=sh(q,"bwl:Members"),he=typeof(de==null?void 0:de.refs)=="string"?de.refs.split(/\s+/).filter(Boolean):[];he.length&&g.push({owner:q.id,refs:he})},L=q=>{var de;for(const he of q)switch(b(he.id),he.$type){case"bpmn:TextAnnotation":x(he.id),s.push({id:he.id,text:typeof he.text=="string"?he.text:""}),E(he);break;case"bpmn:Association":d.push({id:he.id,type:he.$type,source:ci(he.sourceRef),target:ci(he.targetRef)});break;case"bpmn:Group":{x(he.id);const ce=(de=he.categoryValueRef)==null?void 0:de.value;c.push({id:he.id,...typeof ce=="string"&&ce?{name:ce}:{}}),T(he);break}default:u.push({id:he.id,type:he.$type,reason:"type-outside-mvp"})}},A=(q,de)=>{const he=q.flowElements??[],ce=(q.laneSets??[]).flatMap(ee=>ee.lanes??[]),ue=new Map;for(const ee of ce){b(ee.id);for(const H of ee.flowNodeRef??[]){const $=ci(H);$&&ue.set($,ee.id)}}for(const ee of he){if(b(ee.id),ee.$type==="bpmn:SequenceFlow"){p.push({id:ee.id,source:ci(ee.sourceRef),target:ci(ee.targetRef),...typeof ee.name=="string"&&ee.name?{name:ee.name}:{}});continue}if(ee.$type==="bpmn:DataStoreReference"){x(ee.id),a.push({id:ee.id,...ee.name?{name:ee.name}:{}});continue}const H=aE(ee.$type);if(!jf(H)){u.push({id:ee.id,type:ee.$type,reason:"type-outside-mvp"});continue}x(ee.id),o.push({id:ee.id,type:H,...ee.name?{name:ee.name}:{},...de?{participant:de}:{},...ue.has(ee.id)?{lane:ue.get(ee.id)}:{}});const $=ah(ee,"bwl:band");$!==void 0&&(l.bands[ee.id]=$);for(const U of ee.dataOutputAssociations??[])b(U.id),h.push({id:U.id,type:U.$type,source:ee.id,target:ci(U.targetRef)});for(const U of ee.dataInputAssociations??[])b(U.id),h.push({id:U.id,type:U.$type,source:ci((U.sourceRef??[])[0]),target:ee.id})}L(q.artifacts??[])};if(n){const q=new Set;for(const de of n.participants??[]){x(de.id);const he=ci(de.processRef);he&&q.add(he);const ce=he?i.get(he):void 0,ue=((ce==null?void 0:ce.laneSets)??[]).flatMap(U=>U.lanes??[]),ee=ue.map(U=>({id:U.id,...U.name?{name:U.name}:{}}));for(const U of ee)x(U.id);const H=!ce||(ce.flowElements??[]).length===0&&ue.length===0&&(ce.artifacts??[]).length===0;r.push({id:de.id,...de.name?{name:de.name}:{},...H?{blackBox:!0}:{},...ee.length?{lanes:ee}:{}});const $=ah(de,"bwl:poolOrder");$!==void 0&&(l.poolOrders[de.id]=$),ce&&A(ce,de.id)}for(const de of n.messageFlows??[])b(de.id),f.push({id:de.id,source:ci(de.sourceRef),target:ci(de.targetRef),...typeof de.name=="string"&&de.name?{name:de.name}:{}});L(n.artifacts??[]);for(const[de,he]of i)!q.has(de)&&(he.flowElements??[]).length>0&&u.push({id:de,type:he.$type,reason:"unreachable-process"})}else for(const q of i.values())A(q);const F=[],z=[],B=[],G=[],fe=(q,de)=>!!q&&!!de&&w.has(q)&&w.has(de);for(const q of p){if(!fe(q.source,q.target)){u.push({id:q.id,type:"bpmn:SequenceFlow",reason:"endpoint-outside-mvp"});continue}F.push({id:q.id,source:q.source,target:q.target,...q.name?{name:q.name}:{}}),w.add(q.id)}for(const q of f){if(!fe(q.source,q.target)){u.push({id:q.id,type:"bpmn:MessageFlow",reason:"endpoint-outside-mvp"});continue}z.push({id:q.id,source:q.source,target:q.target,...q.name?{name:q.name}:{}}),w.add(q.id)}for(const q of h){if(!fe(q.source,q.target)){u.push({id:q.id??"",type:q.type,reason:"endpoint-outside-mvp"});continue}G.push({...q.id?{id:q.id}:{},source:q.source,target:q.target}),q.id&&w.add(q.id)}for(const q of d){if(!fe(q.source,q.target)){u.push({id:q.id??"",type:q.type,reason:"endpoint-outside-mvp"});continue}B.push({...q.id?{id:q.id}:{},source:q.source,target:q.target})}const Fe=new Map(c.map(q=>[q.id,q]));for(const{owner:q,refs:de}of g){const he=de.filter(ue=>R.has(ue)),ce=Fe.get(q);ce&&he.length&&(ce.members=he)}for(const q of m)R.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:F,...z.length?{messageFlows:z}:{},...a.length?{dataStores:a}:{},...G.length?{dataAssociations:G}:{},...s.length?{annotations:s}:{},...B.length?{associations:B}:{},...c.length?{groups:c}:{}},hints:l,omitted:u}}async function uE(e){const{definitions:t,warnings:n}=await $u(e);return{...ch(t),warnings:n}}function lE(e,t,n,i={}){return{documentId:e,baseVersion:t,ops:[...n],origin:i.origin??"agent",clientOpId:(i.mkClientOpId??(()=>crypto.randomUUID()))()}}async function uh(e,t,{currentVersion:n}){if(t.baseVersion!==n)return{status:"conflict",baseVersion:t.baseVersion,currentVersion:n};const i=oh(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 pE=Symbol("bpmn-editor");function fE(){const e=Ct.ref(!1),t=Ct.ref(!0),n=Ct.ref(!1);let i,r;const o=()=>{e.value=!0};function a(u,l){u.get("canvas").getContainer().style.pointerEvents=l?"":"none";const p=u.get("keyboard");l?(r&&p.bind(r),r=void 0):r||(r=p.getBinding(),p.unbind())}function s(){if(!i)throw new Error("modeler not attached — 뷰 @ready 후 attach() 필요");return i}function c(){return i==null?void 0:i.get("commandStack")}return{dirty:e,editable:t,agentBusy:n,attach(u){i&&this.detach(),i=u,i.get("eventBus").on("commandStack.changed",o),t.value||a(i,!1)},detach(){i==null||i.get("eventBus").off("commandStack.changed",o),i&&!t.value&&a(i,!0),r=void 0,i=void 0},setEditable(u){t.value=u,i&&a(i,u)},async applyAgentBatch(u,l){const p=s();n.value=!0;try{const f=await uh(p,u,{currentVersion:l});return f.status==="applied"&&(e.value=!1),f}finally{n.value=!1}},async importXml(u){const{warnings:l}=await s().importXML(u);return e.value=!1,{warnings: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 ie(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}function dE(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Yu={exports:{}},lh;function hE(){if(lh)return Yu.exports;lh=1;var e=Yu.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},Yu.exports}var mE=hE(),gE=dE(mE);function ui(e){if(!(this instanceof ui))return new ui(e);e=e||[128,36,1],this._seed=e.length?gE.rack(e[0],e[1],e[2]):e}ui.prototype.next=function(e){return this._seed(e||!0)},ui.prototype.nextPrefixed=function(e,t){var n;do n=e+this.next(!0);while(this.assigned(n));return this.claim(n,t),n},ui.prototype.claim=function(e,t){this._seed.set(e,t||!0)},ui.prototype.assigned=function(e){return this._seed.get(e)||!1},ui.prototype.unclaim=function(e){delete this._seed.hats[e]},ui.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 ut(e,t=globalThis.document){var u;if(typeof e!="string")throw new TypeError("String expected");const n=/^<!--(.*?)-->$/s.exec(e);if(n)return t.createComment(n[1]);const i=(u=/<([\w:]+)/.exec(e))==null?void 0:u[1];if(!i)return t.createTextNode(e);if(e=e.trim(),i==="body"){const l=t.createElement("html");l.innerHTML=e;const{lastChild:p}=l;return p.remove(),p}let[r,o,a]=Object.hasOwn(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 yE(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 mn(e,...t){const n=e.style;return k(t,function(i){i&&k(i,function(r,o){n[o]=r})}),e}function an(e,t,n){return arguments.length==2?e.getAttribute(t):n===null?e.removeAttribute(t):(e.setAttribute(t,n),e)}const vE=Object.prototype.toString;function mt(e){return new Ki(e)}function Ki(e){if(!e||!e.nodeType)throw new Error("A DOM element reference is required");this.el=e,this.list=e.classList}Ki.prototype.add=function(e){return this.list.add(e),this},Ki.prototype.remove=function(e){return vE.call(e)=="[object RegExp]"?this.removeMatching(e):(this.list.remove(e),this)},Ki.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},Ki.prototype.toggle=function(e,t){return typeof t<"u"?t!==this.list.toggle(e,t)&&this.list.toggle(e):this.list.toggle(e),this},Ki.prototype.array=function(){return Array.from(this.list)},Ki.prototype.has=Ki.prototype.contains=function(e){return this.list.contains(e)};function hs(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 _E(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var ms={},ph;function bE(){if(ph)return ms;ph=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 fh=bE(),xE=_E(fh),Se=yE({__proto__:null,default:xE},[fh]),dh=["focus","blur"];function wE(e,t,n,i,r){return dh.indexOf(n)!==-1&&(r=!0),Se.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 EE(e,t,n,i){return dh.indexOf(t)!==-1&&(i=!0),Se.unbind(e,t,n,i)}var Cn={bind:wE,unbind:EE};function qu(e,t){return e&&typeof e.matches=="function"&&e.matches(t)||!1}function et(e,t){return t=t||document,t.querySelector(e)}function gs(e,t){return t=t||document,t.querySelectorAll(e)}function li(e){e.parentNode&&e.parentNode.removeChild(e)}function SE(e,t){if(e.ownerDocument!==t.ownerDocument)try{return t.ownerDocument.importNode(e,!0)}catch{}return e}function RE(e,t){return t.appendChild(SE(e,t))}function Re(e,t){return RE(t,e),e}var Ku=2,hh={"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":Ku,"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":Ku,"text-anchor":1,"text-decoration":1,"text-rendering":1,"unicode-bidi":1,visibility:1,"word-spacing":1,"writing-mode":1};function CE(e,t){return hh[t]?e.style[t]:e.getAttributeNS(null,t)}function mh(e,t,n){var i=t.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase(),r=hh[i];r?(r===Ku&&typeof n=="number"&&(n=String(n)+"px"),e.style[i]=n):e.setAttributeNS(null,t,n)}function PE(e,t){var n=Object.keys(t),i,r;for(i=0,r;r=n[i];i++)mh(e,r,t[r])}function re(e,t,n){if(typeof t=="string")if(n!==void 0)mh(e,t,n);else return CE(e,t);else PE(e,t);return e}const AE=Object.prototype.toString;function je(e){return new Xi(e)}function Xi(e){if(!e||!e.nodeType)throw new Error("A DOM element reference is required");this.el=e,this.list=e.classList}Xi.prototype.add=function(e){return this.list.add(e),this},Xi.prototype.remove=function(e){return AE.call(e)=="[object RegExp]"?this.removeMatching(e):(this.list.remove(e),this)},Xi.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},Xi.prototype.toggle=function(e,t){return typeof t<"u"?t!==this.list.toggle(e,t)&&this.list.toggle(e):this.list.toggle(e),this},Xi.prototype.array=function(){return Array.from(this.list)},Xi.prototype.has=Xi.prototype.contains=function(e){return this.list.contains(e)};function ys(e){for(var t;t=e.firstChild;)e.removeChild(t);return e}function gh(e){return e.cloneNode(!0)}var Xu={svg:"http://www.w3.org/2000/svg"},yh='<svg xmlns="'+Xu.svg+'"';function TE(e){var t=!1;e.substring(0,4)==="<svg"?e.indexOf(Xu.svg)===-1&&(e=yh+e.substring(4)):(e=yh+">"+e+"</svg>",t=!0);var n=ME(e);if(!t)return n;for(var i=document.createDocumentFragment(),r=n.firstChild;r.firstChild;)i.appendChild(r.firstChild);return i}function ME(e){var t;return t=new DOMParser,t.async=!1,t.parseFromString(e,"text/xml")}function me(e,t){var n;return e=e.trim(),e.charAt(0)==="<"?(n=TE(e).firstChild,n=document.importNode(n,!0)):n=document.createElementNS(Xu.svg,e),t&&re(n,t),n}var Zu=null;function vh(){return Zu===null&&(Zu=me("svg")),Zu}function _h(e,t){var n,i,r=Object.keys(t);for(n=0;i=r[n];n++)e[i]=t[i];return e}function kE(e,t,n,i,r,o){var a=vh().createSVGMatrix();switch(arguments.length){case 0:return a;case 1:return _h(a,e);case 6:return _h(a,{a:e,b:t,c:n,d:i,e:r,f:o})}}function Yo(e){return vh().createSVGTransform()}var bh=/([&<>]{1})/g,DE=/([&<>\n\r"]{1})/g,OE={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"'"};function Qu(e,t){function n(i,r){return OE[r]||r}return e.replace(t,n)}function xh(e,t){var n,i,r,o,a;switch(e.nodeType){case 3:t.push(Qu(e.textContent,bh));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,'="',Qu(o.value,DE),'"');if(e.hasChildNodes()){for(t.push(">"),a=e.childNodes,n=0,i=a.length;n<i;++n)xh(a.item(n),t);t.push("</",e.tagName,">")}else t.push("/>");break;case 8:t.push("<!--",Qu(e.nodeValue,bh),"-->");break;case 4:t.push("<![CDATA[",e.nodeValue,"]]>");break;default:throw new Error("unable to handle node "+e.nodeType)}return t}function LE(e){for(var t=e.firstChild,n=[];t;)xh(t,n),t=t.nextSibling;return n.join("")}function wh(e,t){return LE(e)}function Ft(e){var t=e.parentNode;return t&&t.removeChild(e),e}function IE(e,t){return t instanceof SVGMatrix?e.createSVGTransformFromMatrix(t):t}function NE(e,t){var n,i;for(e.clear(),n=0;i=t[n];n++)e.appendItem(IE(e,i))}function qo(e,t){var n=e.transform.baseVal;return t&&(Array.isArray(t)||(t=[t]),NE(n,t)),n.consolidate()}const BE=/^class[ {]/;function $E(e){return BE.test(e.toString())}function Ju(e){return Array.isArray(e)}function el(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function vs(...e){e.length===1&&Ju(e[0])&&(e=e[0]),e=[...e];const t=e.pop();return t.$inject=e,t}const jE=/constructor\s*[^(]*\(\s*([^)]*)\)/m,FE=/^(?:async\s+)?(?:function\s*[^(]*)?(?:\(\s*([^)]*)\)|(\w+))/m,HE=/\/\*([^*]*)\*\//m;function zE(e){if(typeof e!="function")throw new Error(`Cannot annotate "${e}". Expected a function!`);const t=e.toString().match($E(e)?jE:FE);if(!t)return[];const n=t[1]||t[2];return n&&n.split(",").map(i=>{const r=i.match(HE);return(r&&r[1]||i).trim()})||[]}function Eh(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 E=b.split(".");let T=c(E.shift());for(;E.length;)T=T[E.shift()];return T}if(el(o,b))return o[b];if(el(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(Ju(b))b=vs(b.slice());else throw s(`Cannot invoke "${b}". Expected a function!`);const T=(b.$inject||zE(b)).map(L=>el(x,L)?x[L]:c(L));return{fn:b,dependencies:T}}function l(b){const{fn:x,dependencies:E}=u(b),T=Function.prototype.bind.call(x,null,...E);return new T}function p(b,x,E){const{fn:T,dependencies:L}=u(b,E);return T.apply(x,L)}function f(b){return vs(x=>b.get(x))}function d(b,x){if(x&&x.length){const E=Object.create(null),T=Object.create(null),L=[],A=[],F=[];let z,B,G,fe;for(let Fe in r)z=r[Fe],x.indexOf(Fe)!==-1&&(z[2]==="private"?(B=L.indexOf(z[3]),B===-1?(G=z[3].createChild([],x),fe=f(G),L.push(z[3]),A.push(G),F.push(fe),E[Fe]=[fe,Fe,"private",G]):E[Fe]=[F[B],Fe,"private",A[B]]):E[Fe]=[z[2],z[1]],T[Fe]=!0),(z[2]==="factory"||z[2]==="type")&&z[1].$scope&&x.forEach(lt=>{z[1].$scope.indexOf(lt)!==-1&&(E[Fe]=[z[2],z[1]],T[lt]=!0)});x.forEach(Fe=>{if(!T[Fe])throw new Error('No provider for "'+Fe+'". Cannot use provider from the parent!')}),b.unshift(E)}return new Eh(b,a)}const h={factory:p,type:l,value:function(b){return b}};function m(b,x){const E=b.__init__||[];return function(){E.forEach(T=>{typeof T=="string"?x.get(T):x.invoke(T)})}}function g(b){const x=b.__exports__;if(x){const E=b.__modules__,T=Object.keys(b).reduce((B,G)=>(G!=="__exports__"&&G!=="__modules__"&&G!=="__init__"&&G!=="__depends__"&&(B[G]=b[G]),B),Object.create(null)),L=(E||[]).concat(T),A=d(L),F=vs(function(B){return A.get(B)});x.forEach(function(B){r[B]=[F,B,"private",A]});const z=(b.__init__||[]).slice();return z.unshift(function(){A.init()}),b=Object.assign({},b,{__init__:z}),m(b,A)}return Object.keys(b).forEach(function(E){if(E==="__init__"||E==="__depends__")return;const T=b[E];if(T[2]==="private"){r[E]=T;return}const L=T[0],A=T[1];r[E]=[h[L],VE(L,A),L]}),m(b,a)}function R(b,x){return b.indexOf(x)!==-1||(b=(x.__depends__||[]).reduce(R,b),b.indexOf(x)!==-1)?b:b.concat(x)}function w(b){const x=b.reduce(R,[]).map(g);let E=!1;return function(){E||(E=!0,x.forEach(T=>T()))}}this.get=c,this.invoke=p,this.instantiate=l,this.createChild=d,this.init=w(e)}function VE(e,t){return e!=="value"&&Ju(t)&&(t=vs(t.slice())),t}var GE=1e3;function Pi(e,t){var n=this;t=t||GE,e.on(["render.shape","render.connection"],t,function(i,r){var o=i.type,a=r.element,s=r.gfx,c=r.attrs;if(n.canRender(a))return o==="render.shape"?n.drawShape(s,a,c):n.drawConnection(s,a,c)}),e.on(["render.getShapePath","render.getConnectionPath"],t,function(i,r){if(n.canRender(r))return i.type==="render.getShapePath"?n.getShapePath(r):n.getConnectionPath(r)})}Pi.prototype.canRender=function(e){},Pi.prototype.drawShape=function(e,t){},Pi.prototype.drawConnection=function(e,t){},Pi.prototype.getShapePath=function(e){},Pi.prototype.getConnectionPath=function(e){};function Dr(e){return e.flat().join(",").replace(/,?([A-Za-z]),?/g,"$1")}function WE(e){return["M",e.x,e.y]}function tl(e){return["L",e.x,e.y]}function UE(e,t,n){return["C",e.x,e.y,t.x,t.y,n.x,n.y]}function YE(e,t){const n=e.length,i=[WE(e[0])];for(let r=1;r<n;r++){const o=e[r-1],a=e[r],s=e[r+1];if(!s||!t){i.push(tl(a));continue}const c=Math.min(t,nl(a.x-o.x,a.y-o.y),nl(s.x-a.x,s.y-a.y));if(!c){i.push(tl(a));continue}const u=_s(a,o,c),l=_s(a,o,c*.5),p=_s(a,s,c),f=_s(a,s,c*.5);i.push(tl(u)),i.push(UE(l,f,p))}return i}function _s(e,t,n){const i=t.x-e.x,r=t.y-e.y,o=nl(i,r),a=n/o;return{x:e.x+i*a,y:e.y+r*a}}function nl(e,t){return Math.sqrt(Math.pow(e,2)+Math.pow(t,2))}function Ko(e,t,n){we(t)&&(n=t,t=null),t||(t={});const i=me("path",t);return we(n)&&(i.dataset.cornerRadius=String(n)),il(i,e)}function il(e,t){const n=parseInt(e.dataset.cornerRadius,10)||0;return re(e,{d:Dr(YE(t,n))}),e}function bs(e){var t=new Set(e);return Oe(e,function(n){for(var i=n.parent;i;){if(t.has(i))return!1;i=i.parent}return!0})}function Or(e,t,n){n=n||0,_e(e)||(e=[e]),k(e,function(i,r){var o=t(i,r,n);_e(o)&&o.length&&Or(o,t,n+1)})}function rl(e,t,n){var i=new Set,r=new Set;return Or(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 Xo(e,t){return rl(e)}function qE(e,t,n){Sr(t)&&(t=!0),Gt(t)&&(n=t,t=!0),n=n||{};var i=Zo(n.allShapes),r=Zo(n.allConnections),o=Zo(n.enclosedElements),a=Zo(n.enclosedConnections),s=Zo(n.topLevel,t&&Qr(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,k(l.incoming,c),k(l.outgoing,c),l.children}return Or(e,u),{allShapes:i,allConnections:r,topLevel:s,enclosedConnections:a,enclosedElements:o}}function At(e,t){t=!!t,_e(e)||(e=[e]);var n,i,r,o;return k(e,function(a){var s=a;a.waypoints&&!t&&(s=At(a.waypoints,!0));var c=s.x,u=s.y,l=s.height||0,p=s.width||0;(c<n||n===void 0)&&(n=c),(u<i||i===void 0)&&(i=u),(c+p>r||r===void 0)&&(r=c+p),(u+l>o||o===void 0)&&(o=u+l)}),{x:n,y:i,height:o-i,width:r-n}}function ao(e,t){var n={};return k(e,function(i){var r=i;r.waypoints&&(r=At(r)),!we(t.y)&&r.x>t.x&&(n[i.id]=i),!we(t.x)&&r.y>t.y&&(n[i.id]=i),r.x>t.x&&r.y>t.y&&(we(t.width)&&we(t.height)&&r.width+r.x<t.width+t.x&&r.height+r.y<t.height+t.y||!we(t.width)||!we(t.height))&&(n[i.id]=i)}),n}function Sh(e){return"waypoints"in e?"connection":"x"in e?"shape":"root"}function Rh(e){return!!(e&&e.isFrame)}function Zo(e,t){return O({},e||{},t||{})}var KE=1;function Zi(e,t){Pi.call(this,e,KE),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})}ie(Zi,Pi),Zi.prototype.canRender=function(){return!0},Zi.prototype.drawShape=function(t,n,i){var r=me("rect");return re(r,{x:0,y:0,width:n.width||0,height:n.height||0}),Rh(n)?re(r,O({},this.FRAME_STYLE,i||{})):re(r,O({},this.SHAPE_STYLE,i||{})),Re(t,r),r},Zi.prototype.drawConnection=function(t,n,i){var r=Ko(n.waypoints,O({},this.CONNECTION_STYLE,i||{}));return Re(t,r),r},Zi.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)},Zi.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)},Zi.$inject=["eventBus","styles"];function XE(){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 O(o,{class:n})},this.style=function(n,i){!_e(n)&&!i&&(i=n,n=[]);var r=Sn(n,function(o,a){return O(o,e[a]||{})},{});return i?O(r,i):r},this.computeStyle=function(n,i,r){return _e(i)||(r=i,i=[]),t.style(i||[],O({},r,n||{}))}}const ZE={__init__:["defaultRenderer"],defaultRenderer:["type",Zi],styles:["type",XE]};function wt(e,t){if(!e||!t)return-1;var n=e.indexOf(t);return n!==-1&&e.splice(n,1),n}function St(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 ol(e,t){return!e||!t?-1:e.indexOf(t)}function Qo(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=Qo(e,t);return Math.abs(r/o)<=i}var QE=2;function Ai(e,t){var n=Array.from(arguments).flat();const i={x:"v",y:"h"};for(const[r,o]of Object.entries(i))if(JE(r,n))return o;return!1}function JE(e,t){const n=t[0];return Rr(t,function(i){return Math.abs(n[e]-i[e])<=QE})}function Ch(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 sl(e,t){return{x:Math.round(e.x+(t.x-e.x)/2),y:Math.round(e.y+(t.y-e.y)/2)}}var e1=/,?([a-z]),?/gi,Ph=parseFloat,Tt=Math,Qi=Tt.PI,pi=Tt.min,fi=Tt.max,Ah=Tt.pow,Ji=Tt.abs,t1=/([a-z])[\s,]*((-?\d*\.?\d*(?:e[-+]?\d+)?[\s]*,?[\s]*)+)/ig,n1=/(-?\d*\.?\d*(?:e[-+]?\d+)?)[\s]*,?[\s]*/ig,Th=Array.isArray||function(e){return e instanceof Array};function i1(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function r1(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 o1(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 i1(r,i)?(r1(o,i),r[i]):(o.length>=1e3&&delete r[o.shift()],o.push(i),r[i]=e(...arguments),r[i])}return t}function a1(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(t1,function(i,r,o){var a=[],s=r.toLowerCase();for(o.replace(n1,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=ul,n}function s1(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 c1(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 cl(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 ul(){return this.join(",").replace(e1,"$1")}function u1(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=ul,t}function Mh(e,t,n,i,r,o,a,s,c){var u=1-c,l=Ah(u,3),p=Ah(u,2),f=c*c,d=f*c,h=l*e+p*3*c*n+u*3*c*c*r+d*a,m=l*t+p*3*c*i+u*3*c*c*o+d*s;return{x:xs(h),y:xs(m)}}function kh(e){var t=m1(...e);return cl(t.x0,t.y0,t.x1-t.x0,t.y1-t.y0)}function er(e,t,n){return t>=e.x&&t<=e.x+e.width&&n>=e.y&&n<=e.y+e.height}function l1(e,t){return e=cl(e),t=cl(t),er(t,e.x,e.y)||er(t,e.x2,e.y)||er(t,e.x,e.y2)||er(t,e.x2,e.y2)||er(e,t.x,t.y)||er(e,t.x2,t.y)||er(e,t.x,t.y2)||er(e,t.x2,t.y2)||(e.x<t.x2&&e.x>t.x||t.x<e.x2&&t.x>e.x)&&(e.y<t.y2&&e.y>t.y||t.y<e.y2&&t.y>e.y)}function Dh(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 Oh(e,t,n,i,r,o,a,s,c){c==null&&(c=1),c=c>1?1:c<0?0:c;for(var u=c/2,l=12,p=[-.1252,.1252,-.3678,.3678,-.5873,.5873,-.7699,.7699,-.9041,.9041,-.9816,.9816],f=[.2491,.2491,.2335,.2335,.2032,.2032,.1601,.1601,.1069,.1069,.0472,.0472],d=0,h=0;h<l;h++){var m=u*p[h]+u,g=Dh(m,e,n,r,a),R=Dh(m,t,i,o,s),w=g*g+R*R;d+=f[h]*Tt.sqrt(w)}return u*d}function p1(e,t,n,i,r,o,a,s){if(!(fi(e,n)<pi(r,a)||pi(e,n)>fi(r,a)||fi(t,i)<pi(o,s)||pi(t,i)>fi(o,s))){var c=(e*i-t*n)*(r-a)-(e-n)*(r*s-o*a),u=(e*i-t*n)*(o-s)-(t-i)*(r*s-o*a),l=(e-n)*(o-s)-(t-i)*(r-a);if(l){var p=xs(c/l),f=xs(u/l),d=+p.toFixed(2),h=+f.toFixed(2);if(!(d<+pi(e,n).toFixed(2)||d>+fi(e,n).toFixed(2)||d<+pi(r,a).toFixed(2)||d>+fi(r,a).toFixed(2)||h<+pi(t,i).toFixed(2)||h>+fi(t,i).toFixed(2)||h<+pi(o,s).toFixed(2)||h>+fi(o,s).toFixed(2)))return{x:p,y:f}}}}function xs(e){return Math.round(e*1e11)/1e11}function f1(e,t,n){var i=kh(e),r=kh(t);if(!l1(i,r))return[];var o=Oh(...e),a=Oh(...t),s=Ih(e)?1:~~(o/5)||1,c=Ih(t)?1:~~(a/5)||1,u=new Array(s+1),l=new Array(c+1),p={},f=[],d,h;for(d=0;d<s+1;d++){var m=Mh(...e,d/s);u[d]={x:m.x,y:m.y,t:d/s}}for(d=0;d<c+1;d++)m=Mh(...t,d/c),l[d]={x:m.x,y:m.y,t:d/c};for(d=0;d<s;d++)for(h=0;h<c;h++){var g=u[d],R=u[d+1],w=l[h],b=l[h+1],x=Ji(R.x-g.x)<.01?"y":"x",E=Ji(b.x-w.x)<.01?"y":"x",T=p1(g.x,g.y,R.x,R.y,w.x,w.y,b.x,b.y),L;if(T){if(L=T.x.toFixed(9)+"#"+T.y.toFixed(9),p[L])continue;p[L]=!0;var A=g.t+Ji((T[x]-g[x])/(R[x]-g[x]))*(R.t-g.t),F=w.t+Ji((T[E]-w[E])/(b[E]-w[E]))*(b.t-w.t);A>=0&&A<=1&&F>=0&&F<=1&&f.push({x:T.x,y:T.y,t1:A,t2:F})}}return f}function Lh(e,t,n){e=$h(e),t=$h(t);for(var i,r,o,a,s,c,u,l,p,f,d=n?0:[],h=0,m=e.length;h<m;h++){var g=e[h];if(g[0]=="M")i=s=g[1],r=c=g[2];else{g[0]=="C"?(p=[i,r,...g.slice(1)],i=p[6],r=p[7]):(p=[i,r,i,r,s,c,s,c],i=s,r=c);for(var R=0,w=t.length;R<w;R++){var b=t[R];if(b[0]=="M")o=u=b[1],a=l=b[2];else{b[0]=="C"?(f=[o,a,...b.slice(1)],o=f[6],a=f[7]):(f=[o,a,o,a,u,l,u,l],o=u,a=l);var x=f1(p,f);{for(var E=0,T=x.length;E<T;E++)x[E].segment1=h,x[E].segment2=R,x[E].bez1=p,x[E].bez2=f;d=d.concat(x)}}}}}return d}function d1(e){return Th(e)&&Th(e[0])}function h1(e){if(s1(e))return e;var t=new Array(e.length),n=0,i=0,r=0,o=0,a=0,s;e[0][0]=="M"&&(n=+e[0][1],i=+e[0][2],r=n,o=i,a++,t[0]=["M",n,i]);for(var c,u,l=a,p=e.length;l<p;l++){if(u=e[l],s=u[0],t[l]=c=new Array(u.length),s!=s.toUpperCase())switch(c[0]=s.toUpperCase(),c[0]){case"A":c[1]=u[1],c[2]=u[2],c[3]=u[3],c[4]=u[4],c[5]=u[5],c[6]=+u[6]+n,c[7]=+u[7]+i;break;case"V":c[1]=+u[1]+i;break;case"H":c[1]=+u[1]+n;break;case"M":r=+u[1]+n,o=+u[2]+i;default:for(var f=1,d=u.length;f<d;f++)c[f]=+u[f]+(f%2?n:i)}else for(var h=0,m=u.length;h<m;h++)c[h]=u[h];switch(s=s.toUpperCase(),c[0]){case"Z":n=+r,i=+o;break;case"H":n=c[1];break;case"V":i=c[1];break;case"M":r=c[c.length-2],o=c[c.length-1];default:n=c[c.length-2],i=c[c.length-1]}}return t.toString=ul,t}function Ih(e){return e[0]===e[2]&&e[1]===e[3]&&e[4]===e[6]&&e[5]===e[7]}function ws(e,t,n,i){return[e,t,n,i,n,i]}function Nh(e,t,n,i,r,o){var a=.3333333333333333,s=2/3;return[a*e+s*n,a*t+s*i,a*r+s*n,a*o+s*i,r,o]}function Bh(e,t,n,i,r,o,a,s,c,u){var l=Qi*120/180,p=Qi/180*(+r||0),f=[],d,h=o1(function(P,_,y){var D=P*Tt.cos(y)-_*Tt.sin(y),N=P*Tt.sin(y)+_*Tt.cos(y);return{x:D,y:N}});if(u)L=u[0],A=u[1],E=u[2],T=u[3];else{d=h(e,t,-p),e=d.x,t=d.y,d=h(s,c,-p),s=d.x,c=d.y;var m=(e-s)/2,g=(t-c)/2,R=m*m/(n*n)+g*g/(i*i);R>1&&(R=Tt.sqrt(R),n=R*n,i=R*i);var w=n*n,b=i*i,x=(o==a?-1:1)*Tt.sqrt(Ji((w*b-w*g*g-b*m*m)/(w*g*g+b*m*m))),E=x*n*g/i+(e+s)/2,T=x*-i*m/n+(t+c)/2,L=Tt.asin(((t-T)/i).toFixed(9)),A=Tt.asin(((c-T)/i).toFixed(9));L=e<E?Qi-L:L,A=s<E?Qi-A:A,L<0&&(L=Qi*2+L),A<0&&(A=Qi*2+A),a&&L>A&&(L=L-Qi*2),!a&&A>L&&(A=A-Qi*2)}var F=A-L;if(Ji(F)>l){var z=A,B=s,G=c;A=L+l*(a&&A>L?1:-1),s=E+n*Tt.cos(A),c=T+i*Tt.sin(A),f=Bh(s,c,n,i,r,0,a,B,G,[A,z,E,T])}F=A-L;var fe=Tt.cos(L),Fe=Tt.sin(L),lt=Tt.cos(A),q=Tt.sin(A),de=Tt.tan(F/4),he=4/3*n*de,ce=4/3*i*de,ue=[e,t],ee=[e+he*Fe,t-ce*fe],H=[s+he*q,c-ce*lt],$=[s,c];if(ee[0]=2*ue[0]-ee[0],ee[1]=2*ue[1]-ee[1],u)return[ee,H,$].concat(f);f=[ee,H,$].concat(f).join().split(",");for(var U=[],ke=0,Lt=f.length;ke<Lt;ke++)U[ke]=ke%2?h(f[ke-1],f[ke],p).y:h(f[ke],f[ke+1],p).x;return U}function m1(e,t,n,i,r,o,a,s){for(var c=[],u=[[],[]],l,p,f,d,h,m,g,R,w=0;w<2;++w){if(w==0?(p=6*e-12*n+6*r,l=-3*e+9*n-9*r+3*a,f=3*n-3*e):(p=6*t-12*i+6*o,l=-3*t+9*i-9*o+3*s,f=3*i-3*t),Ji(l)<1e-12){if(Ji(p)<1e-12)continue;d=-f/p,0<d&&d<1&&c.push(d);continue}g=p*p-4*f*l,R=Tt.sqrt(g),!(g<0)&&(h=(-p+R)/(2*l),0<h&&h<1&&c.push(h),m=(-p-R)/(2*l),0<m&&m<1&&c.push(m))}for(var b=c.length,x=b,E;b--;)d=c[b],E=1-d,u[0][b]=E*E*E*e+3*E*E*d*n+3*E*d*d*r+d*d*d*a,u[1][b]=E*E*E*t+3*E*E*d*i+3*E*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:pi(...u[0]),y0:pi(...u[1]),x1:fi(...u[0]),y1:fi(...u[1])}}function $h(e){if(d1(e)||(e=a1(e)),c1(e))return e;for(var t=u1(h1(e)),n={x:0,y:0,bx:0,by:0,X:0,Y:0,qx:null,qy:null},i=function(f,d,h){var m,g;if(!f)return["C",d.x,d.y,d.x,d.y,d.x,d.y];switch(!(f[0]in{T:1,Q:1})&&(d.qx=d.qy=null),f[0]){case"M":d.X=f[1],d.Y=f[2];break;case"A":f=["C",...Bh(d.x,d.y,...f.slice(1))];break;case"S":h=="C"||h=="S"?(m=d.x*2-d.bx,g=d.y*2-d.by):(m=d.x,g=d.y),f=["C",m,g,...f.slice(1)];break;case"T":h=="Q"||h=="T"?(d.qx=d.x*2-d.qx,d.qy=d.y*2-d.qy):(d.qx=d.x,d.qy=d.y),f=["C",...Nh(d.x,d.y,d.qx,d.qy,f[1],f[2])];break;case"Q":d.qx=f[1],d.qy=f[2],f=["C",...Nh(d.x,d.y,f[1],f[2],f[3],f[4])];break;case"L":f=["C",...ws(d.x,d.y,f[1],f[2])];break;case"H":f=["C",...ws(d.x,d.y,f[1],d.y)];break;case"V":f=["C",...ws(d.x,d.y,d.x,f[1])];break;case"Z":f=["C",...ws(d.x,d.y,d.X,d.Y)];break}return f},r=function(f,d){if(f[d].length>7){f[d].shift();for(var h=f[d];h.length;)o[d]="A",f.splice(d++,0,["C",...h.splice(0,6)]);f.splice(d,1),u=t.length}},o=[],a="",s="",c=0,u=t.length;c<u;c++){t[c]&&(a=t[c][0]),a!="C"&&(o[c]=a,c&&(s=o[c-1])),t[c]=i(t[c],n,s),o[c]!="A"&&a=="C"&&(o[c]="C"),r(t,c);var l=t[c],p=l.length;n.x=l[p-2],n.y=l[p-1],n.bx=Ph(l[p-4])||n.x,n.by=Ph(l[p-3])||n.y}return t}function it(e){return Gt(e)&&En(e,"waypoints")}function Me(e){return Gt(e)&&En(e,"labelTarget")}function g1(e){return Gt(e)&&Xr(e.parent)}function jh(e){return{x:Math.round(e.x),y:Math.round(e.y),width:Math.round(e.width),height:Math.round(e.height)}}function Ti(e){return{x:Math.round(e.x),y:Math.round(e.y)}}function ye(e){return{top:e.y,right:e.x+(e.width||0),bottom:e.y+(e.height||0),left:e.x}}function Es(e){return{x:e.left,y:e.top,width:e.right-e.left,height:e.bottom-e.top}}function y1(e){return Ti({x:e.x+(e.width||0)/2,y:e.y+(e.height||0)/2})}function v1(e){for(var t=e.waypoints,n=t.reduce(function(u,l,p){var f=t[p-1];if(f){var d=u[u.length-1],h=d&&d.endLength||0,m=x1(f,l);u.push({start:f,end:l,startLength:h,endLength:h+m,length:m})}return u},[]),i=n.reduce(function(u,l){return u+l.length},0),r=i/2,o=0,a=n[o];a.endLength<r;)a=n[++o];var s=(r-a.startLength)/a.length,c={x:a.start.x+(a.end.x-a.start.x)*s,y:a.start.y+(a.end.y-a.start.y)*s};return c}function be(e){return it(e)?v1(e):y1(e)}function Zt(e,t,n){n=n||0,Gt(n)||(n={x:n,y:n});var i=ye(e),r=ye(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 Jo(e,t,n){var i=_1(e,t);return i.length===1||i.length===2&&Qo(i[0],i[1])<1?Ti(i[0]):i.length>1?(i=oi(i,function(r){var o=Math.floor(r.t2*100)||1;return o=100-o,o=(o<10?"0":"")+o,r.segment2+"#"+o}),Ti(i[n?0:i.length-1])):null}function _1(e,t){return Lh(e,t)}function b1(e){e=e.slice();for(var t=0,n,i,r;e[t];)n=e[t],i=e[t-1],r=e[t+1],Qo(n,r)===0||al(i,r,n)?e.splice(t,1):t++;return e}function x1(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function Ss(e,t){return Math.round(e*t)/t}function Fh(e){return we(e)?e+"px":e}function w1(e){for(;e.parent;)e=e.parent;return e}function E1(e){e=O({},{width:"100%",height:"100%"},e);const t=e.container||document.body,n=document.createElement("div");return n.setAttribute("class","djs-container djs-parent"),mn(n,{position:"relative",overflow:"hidden",width:Fh(e.width),height:Fh(e.height)}),t.appendChild(n),n}function Hh(e,t,n){const i=me("g");je(i).add(t);const r=n!==void 0?n:e.childNodes.length-1;return e.insertBefore(i,e.childNodes[r]||null),i}const S1="base",zh=0,R1=1,C1={shape:["x","y","width","height"],connection:["waypoints"]};function xe(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||{})}xe.$inject=["config.canvas","eventBus","graphicsFactory","elementRegistry"],xe.prototype._init=function(e){const t=this._eventBus,n=this._container=E1(e),i=this._svg=me("svg");re(i,{width:"100%",height:"100%"}),an(i,"tabindex",0),e.autoFocus&&t.on("element.hover",()=>{this.restoreFocus()}),t.on("element.mousedown",500,o=>{this.focus()}),i.addEventListener("focusin",()=>{this._setFocused(!0)}),i.addEventListener("focusout",()=>{this._setFocused(!1)}),i.addEventListener("mouseover",()=>{this._eventBus.fire("canvas.mouseover")}),i.addEventListener("mouseout",()=>{this._eventBus.fire("canvas.mouseout")}),Re(n,i);const r=this._viewport=Hh(i,"viewport");e.deferUpdate&&(this._viewboxChanged=Ru(this._viewboxChanged,300)),this._restoreFocus=Ru(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)},xe.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},xe.prototype._setFocused=function(e){e!=this._focused&&(this._focused=e,this._eventBus.fire("canvas.focus.changed",{focused:e}))},xe.prototype._clear=function(){this._elementRegistry.getAll().forEach(t=>{const n=Sh(t);n==="root"?this.removeRootElement(t):this._removeElement(t,n)}),this._planes=[],this._rootElement=null,delete this._cachedViewbox},xe.prototype.focus=function(){this._svg.focus({preventScroll:!0}),this._setFocused(!0)},xe.prototype.restoreFocus=function(){this._restoreFocus()},xe.prototype._restoreFocus=function(){document.activeElement===document.body&&this.focus()},xe.prototype.isFocused=function(){return this._focused},xe.prototype.getDefaultLayer=function(){return this.getLayer(S1,zh)},xe.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},xe.prototype._getChildIndex=function(e){return Sn(this._layers,function(t,n){return n.visible&&e>=n.index&&t++,t},0)},xe.prototype._createLayer=function(e,t){typeof t>"u"&&(t=R1);const n=this._getChildIndex(t);return{group:Hh(this._viewport,"layer-"+e,n),index:t,visible:!0}},xe.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},xe.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&&(Ft(n),t.visible=!1),n},xe.prototype._removeLayer=function(e){const t=this._layers[e];t&&(delete this._layers[e],Ft(t.group))},xe.prototype.getActiveLayer=function(){const e=this._findPlaneForRoot(this.getRootElement());return e?e.layer:null},xe.prototype.findRoot=function(e){const t=this._resolveElements(e);let n;for(const i of t){const r=this._findPlaneForRoot(w1(i));if(!r||n&&r.rootElement!==n)return;n=r.rootElement}return n},xe.prototype.getRootElements=function(){return this._planes.map(function(e){return e.rootElement})},xe.prototype._findPlaneForRoot=function(e){return st(this._planes,function(t){return t.rootElement===e})},xe.prototype._resolveElement=function(e){return typeof e=="string"?this._elementRegistry.get(e):e},xe.prototype._resolveElements=function(e){return _e(e)||(e=[e]),e.map(t=>this._resolveElement(t)).filter(Boolean)},xe.prototype.getContainer=function(){return this._container},xe.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&&(k([i.gfx,i.secondaryGfx],function(r){r&&(n?(e.markers.add(t),je(r).add(t)):(e.markers.delete(t),je(r).remove(t)))}),this._eventBus.fire("element.marker.update",{element:e,gfx:i.gfx,marker:t,add:!!n}))},xe.prototype.addMarker=function(e,t){this._updateMarker(e,t,!0)},xe.prototype.removeMarker=function(e,t){this._updateMarker(e,t,!1)},xe.prototype.hasMarker=function(e,t){return e=this._resolveElement(e),e.markers?e.markers.has(t):!1},xe.prototype.toggleMarker=function(e,t){this.hasMarker(e,t)?this.removeMarker(e,t):this.addMarker(e,t)},xe.prototype.getRootElement=function(){const e=this._rootElement;return e||this._planes.length?e:this.setRootElement(this.addRootElement(null))},xe.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,zh);return this.hideLayer(n),this._addRoot(e,i),this._planes.push({rootElement:e,layer:i}),e},xe.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},xe.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},xe.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)},xe.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})},xe.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})},xe.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=C1[e];if(!Rr(n,function(r){return typeof t[r]<"u"}))throw new Error("must supply { "+n.join(", ")+" } with "+e)},xe.prototype._setParent=function(e,t,n){St(t.children,e,n),e.parent=t},xe.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},xe.prototype.addShape=function(e,t,n){return this._addElement("shape",e,t,n)},xe.prototype.addConnection=function(e,t,n){return this._addElement("connection",e,t,n)},xe.prototype._removeElement=function(e,t){const n=this._elementRegistry,i=this._graphicsFactory,r=this._eventBus;if(e=n.get(e.id||e),!!e)return r.fire(t+".remove",{element:e}),i.remove(e),wt(e.parent&&e.parent.children,e),e.parent=null,r.fire(t+".removed",{element:e}),n.remove(e),e},xe.prototype.removeShape=function(e){return this._removeElement(e,"shape")},xe.prototype.removeConnection=function(e){return this._removeElement(e,"connection")},xe.prototype.getGraphics=function(e,t){return this._elementRegistry.getGraphics(e,t)},xe.prototype._changeViewbox=function(e){this._eventBus.fire("canvas.viewbox.changing"),e.apply(this),this._cachedViewbox=null,this._viewboxChanged()},xe.prototype._viewboxChanged=function(){this._eventBus.fire("canvas.viewbox.changed",{viewbox:this.viewbox()})},xe.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);qo(t,l)});else return o=this._rootElement?this.getActiveLayer():null,i=o&&o.getBBox()||{},a=qo(t),r=a?a.matrix:kE(),s=Ss(r.a,1e3),c=Ss(-r.e||0,1e3),u=Ss(-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},xe.prototype.scroll=function(e){const t=this._viewport;let n=t.getCTM();return e&&this._changeViewbox(function(){e=O({dx:0,dy:0},e||{}),n=this._svg.createSVGMatrix().translate(e.dx,e.dy).multiply(n),Vh(t,n)}),{x:n.e,y:n.f}},xe.prototype.scrollToElement=function(e,t){let n=100;const i=this._resolveElements(e);if(!i.length)return;const r=this.findRoot(i);if(!r)return;r!==this.getRootElement()&&this.setRootElement(r);const o=i.filter(h=>h!=r);if(!o.length)return;t||(t={}),typeof t=="number"&&(n=t),t={top:t.top||n,right:t.right||n,bottom:t.bottom||n,left:t.left||n};const a=At(o),s=ye(a),c=this.viewbox(),u=this.zoom();let l,p;c.y+=t.top/u,c.x+=t.left/u,c.width-=(t.right+t.left)/u,c.height-=(t.bottom+t.top)/u;const f=ye(c);if(!(a.width<c.width&&a.height<c.height))l=a.x-c.x,p=a.y-c.y;else{const h=Math.max(0,s.right-f.right),m=Math.min(0,s.left-f.left),g=Math.max(0,s.bottom-f.bottom),R=Math.min(0,s.top-f.top);l=h||m,p=g||R}this.scroll({dx:-l*u,dy:-p*u})},xe.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)}),Ss(i.a,1e3)};function Vh(e,t){const n="matrix("+t.a+","+t.b+","+t.c+","+t.d+","+t.e+","+t.f+")";e.setAttribute("transform",n)}xe.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},xe.prototype._setZoom=function(e,t){const n=this._svg,i=this._viewport,r=n.createSVGMatrix(),o=n.createSVGPoint();let a,s,c,u,l;c=i.getCTM();const p=c.a;return t?(a=O(o,t),s=a.matrixTransform(c.inverse()),u=r.translate(s.x,s.y).scale(1/p*e).translate(-s.x,-s.y),l=c.multiply(u)):l=r.scale(e),Vh(this._viewport,l),l},xe.prototype.getSize=function(){return{width:this._container.clientWidth,height:this._container.clientHeight}},xe.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}},xe.prototype.resized=function(){delete this._cachedViewbox,this._eventBus.fire("canvas.resized")};var so="data-element-id";function Bn(e){this._elements={},this._eventBus=e}Bn.$inject=["eventBus"],Bn.prototype.add=function(e,t,n){var i=e.id;this._validateId(i),re(t,so,i),n&&re(n,so,i),this._elements[i]={element:e,gfx:t,secondaryGfx:n}},Bn.prototype.remove=function(e){var t=this._elements,n=e.id||e,i=n&&t[n];i&&(re(i.gfx,so,""),i.secondaryGfx&&re(i.secondaryGfx,so,""),delete t[n])},Bn.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)},Bn.prototype.updateGraphics=function(e,t,n){var i=e.id||e,r=this._elements[i];return n?r.secondaryGfx=t:r.gfx=t,t&&re(t,so,i),t},Bn.prototype.get=function(e){var t;typeof e=="string"?t=e:t=e&&re(e,so);var n=this._elements[t];return n&&n.element},Bn.prototype.filter=function(e){var t=[];return this.forEach(function(n,i){e(n,i)&&t.push(n)}),t},Bn.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}},Bn.prototype.getAll=function(){return this.filter(function(e){return e})},Bn.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)})},Bn.prototype.getGraphics=function(e,t){var n=e.id||e,i=this._elements[n];return i&&(t?i.secondaryGfx:i.gfx)},Bn.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 P1(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 A1(e){return e.__refs_collection===!0}function T1(e,t){return Object.prototype.hasOwnProperty.call(e,t.name||t)}function Gh(e,t,n){var i=P1(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 M1(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 Vn(e,t){if(!(this instanceof Vn))return new Vn(e,t);e.inverse=t,t.inverse=e,this.props={},this.props[e.name]=e,this.props[t.name]=t}Vn.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?Gh(this,t,e):M1(this,t,e)},Vn.prototype.ensureRefsCollection=function(e,t){var n=e[t.name];return A1(n)||Gh(this,t,e),n},Vn.prototype.ensureBound=function(e,t){T1(e,t)||this.bind(e,t)},Vn.prototype.unset=function(e,t,n){e&&(this.ensureBound(e,t),t.collection?this.ensureRefsCollection(e,t).remove(n):e[t.name]=void 0)},Vn.prototype.set=function(e,t,n){e&&(this.ensureBound(e,t),t.collection?this.ensureRefsCollection(e,t).add(n):e[t.name]=n)};var ll=new Vn({name:"children",enumerable:!0,collection:!0},{name:"parent"}),Wh=new Vn({name:"labels",enumerable:!0,collection:!0},{name:"labelTarget"}),Uh=new Vn({name:"attachers",collection:!0},{name:"host"}),Yh=new Vn({name:"outgoing",collection:!0},{name:"source"}),qh=new Vn({name:"incoming",collection:!0},{name:"target"});function co(){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)}}),ll.bind(this,"parent"),Wh.bind(this,"labels"),Yh.bind(this,"outgoing"),qh.bind(this,"incoming")}function ea(){co.call(this),ll.bind(this,"children"),Uh.bind(this,"host"),Uh.bind(this,"attachers")}ie(ea,co);function Kh(){co.call(this),ll.bind(this,"children")}ie(Kh,ea);function Xh(){ea.call(this),Wh.bind(this,"labelTarget")}ie(Xh,ea);function Zh(){co.call(this),Yh.bind(this,"source"),qh.bind(this,"target")}ie(Zh,co);var k1={connection:Zh,shape:ea,label:Xh,root:Kh};function D1(e,t){var n=k1[e];if(!n)throw new Error("unknown type: <"+e+">");return O(new n,t)}function O1(e){return e instanceof co}function Mi(){this._uid=12}Mi.prototype.createRoot=function(e){return this.create("root",e)},Mi.prototype.createLabel=function(e){return this.create("label",e)},Mi.prototype.createShape=function(e){return this.create("shape",e)},Mi.prototype.createConnection=function(e){return this.create("connection",e)},Mi.prototype.create=function(e,t){return t=O({},t||{}),t.id||(t.id=e+"_"+this._uid++),D1(e,t)};var Rs="__fn",Qh=1e3,L1=Array.prototype.slice;function Pn(){this._listeners={},this.on("diagram.destroy",1,this._destroy,this)}Pn.prototype.on=function(e,t,n,i){if(e=_e(e)?e:[e],Wt(t)&&(i=n,n=t,t=Qh),!we(t))throw new Error("priority must be a number");var r=n;i&&(r=vn(n,i),r[Rs]=n[Rs]||n);var o=this;e.forEach(function(a){o._addListener(a,{priority:t,callback:r,next:null})})},Pn.prototype.once=function(e,t,n,i){var r=this;if(Wt(t)&&(i=n,n=t,t=Qh),!we(t))throw new Error("priority must be a number");function o(){o.__isTomb=!0;var a=n.apply(i,arguments);return r.off(e,o),a}o[Rs]=n,this.on(e,t,o)},Pn.prototype.off=function(e,t){e=_e(e)?e:[e];var n=this;e.forEach(function(i){n._removeListener(i,t)})},Pn.prototype.createEvent=function(e){var t=new ta;return t.init(e),t},Pn.prototype.fire=function(e,t){var n,i,r,o;if(o=L1.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 ta?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}},Pn.prototype.handleError=function(e){return this.fire("error",{error:e})===!1},Pn.prototype._destroy=function(){this._listeners={}},Pn.prototype._invokeListeners=function(e,t,n){for(var i;n&&!e.cancelBubble;)i=this._invokeListener(e,t,n),n=n.next;return i},Pn.prototype._invokeListener=function(e,t,n){var i;if(n.callback.__isTomb)return i;try{i=I1(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},Pn.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},Pn.prototype._getListeners=function(e){return this._listeners[e]},Pn.prototype._setListeners=function(e,t){this._listeners[e]=t},Pn.prototype._removeListener=function(e,t){var n=this._getListeners(e),i,r,o;if(!t){this._setListeners(e,null);return}for(;n;)i=n.next,o=n.callback,(o===t||o[Rs]===t)&&(r?r.next=i:this._setListeners(e,i)),r=n,n=i};function ta(){}ta.prototype.stopPropagation=function(){this.cancelBubble=!0},ta.prototype.preventDefault=function(){this.defaultPrevented=!0},ta.prototype.init=function(e){O(this,e||{})};function I1(e,t){return e.apply(null,t)}function Lr(e){return e.childNodes[0]}function N1(e){return e.parentNode.childNodes[1]}function Cs(e,t,n,i,r){var o=Yo();o.setTranslate(t,n);var a=Yo();a.setRotate(i||0,0,0);var s=Yo();s.setScale(1,1),qo(e,[o,a,s])}function Qt(e,t,n){var i=Yo();i.setTranslate(t,n),qo(e,i)}function Jh(e,t){var n=Yo();n.setRotate(t,0,0),qo(e,n)}function $n(e,t){this._eventBus=e,this._elementRegistry=t}$n.$inject=["eventBus","elementRegistry"],$n.prototype._getChildrenContainer=function(e){var t=this._elementRegistry.getGraphics(e),n;return e.parent?(n=N1(t),n||(n=me("g"),je(n).add("djs-children"),Re(t.parentNode,n))):n=t,n},$n.prototype._clear=function(e){var t=Lr(e);return hs(t),t},$n.prototype._createContainer=function(e,t,n,i){var r=me("g");je(r).add("djs-group"),typeof n<"u"?B1(r,t,t.childNodes[n]):Re(t,r);var o=me("g");je(o).add("djs-element"),je(o).add("djs-"+e),i&&je(o).add("djs-frame"),Re(r,o);var a=me("g");return je(a).add("djs-visual"),Re(o,a),o},$n.prototype.create=function(e,t,n){var i=this._getChildrenContainer(t.parent);return this._createContainer(e,i,n,Rh(t))},$n.prototype.updateContainments=function(e){var t=this,n=this._elementRegistry,i;i=Sn(e,function(r,o){return o.parent&&(r[o.parent.id]=o.parent),r},{}),k(i,function(r){var o=r.children;if(o){var a=t._getChildrenContainer(r),s=a.firstChild;k(o,function(c){var u=n.getGraphics(c).parentNode;u===s?s=s.nextSibling:a.insertBefore(u,s)})}})},$n.prototype.drawShape=function(e,t,n={}){var i=this._eventBus;return i.fire("render.shape",{gfx:e,element:t,attrs:n})},$n.prototype.getShapePath=function(e){var t=this._eventBus;return t.fire("render.getShapePath",e)},$n.prototype.drawConnection=function(e,t,n={}){var i=this._eventBus;return i.fire("render.connection",{gfx:e,element:t,attrs:n})},$n.prototype.getConnectionPath=function(e){var t=this._eventBus;return t.fire("render.getConnectionPath",e)},$n.prototype.update=function(e,t,n){if(t.parent){var i=this._clear(n);if(e==="shape")this.drawShape(i,t),Qt(n,t.x,t.y);else if(e==="connection")this.drawConnection(i,t);else throw new Error("unknown type: "+e);t.hidden?re(n,"display","none"):re(n,"display","block")}},$n.prototype.remove=function(e){var t=this._elementRegistry.getGraphics(e);Ft(t.parentNode)};function B1(e,t,n){var i=n||t.firstChild;e!==i&&t.insertBefore(e,i)}const $1={__depends__:[ZE],__init__:["canvas"],canvas:["type",xe],elementRegistry:["type",Bn],elementFactory:["type",Mi],eventBus:["type",Pn],graphicsFactory:["type",$n]};function j1(e){var t=new Eh(e);return t.init(),t}function F1(e){e=e||{};var t={config:["value",e]},n=[t,$1].concat(e.modules||[]);return j1(n)}function tr(e,t){this._injector=t||F1(e),this.get("eventBus").fire("diagram.init")}tr.prototype.get=function(e,t){return this._injector.get(e,t)},tr.prototype.invoke=function(e,t,n){return this._injector.invoke(e,t,n)},tr.prototype.destroy=function(){this.get("eventBus").fire("diagram.destroy")},tr.prototype.clear=function(){this.get("eventBus").fire("diagram.clear")};function sn(e){return e?"<"+e.$type+(e.id?' id="'+e.id:"")+'" />':"<null>"}function _n(e,t){return e.$instanceOf(t)}function H1(e){return st(e.rootElements,function(t){return _n(t,"bpmn:Process")||_n(t,"bpmn:Collaboration")})}function z1(e){var t={},n=[],i={};function r(H,$){return function(U){H(U,$)}}function o(H){t[H.id]=H}function a(H){return t[H.id]}function s(H,$){var U=H.gfx;if(U)throw new Error(`already rendered ${sn(H)}`);return e.element(H,i[H.id],$)}function c(H,$){return e.root(H,i[H.id],$)}function u(H,$){try{var U=i[H.id]&&s(H,$);return o(H),U}catch(ke){l(ke.message,{element:H,error:ke}),console.error(`failed to import ${sn(H)}`,ke)}}function l(H,$){e.error(H,$)}var p=this.registerDi=function($){var U=$.bpmnElement;U?i[U.id]?l(`multiple DI elements defined for ${sn(U)}`,{element:U}):i[U.id]=$:l(`no bpmnElement referenced in ${sn($)}`,{element:$})};function f(H){d(H.plane)}function d(H){p(H),k(H.planeElement,h)}function h(H){p(H)}this.handleDefinitions=function($,U){var ke=$.diagrams;if(U&&ke.indexOf(U)===-1)throw new Error("diagram not part of <bpmn:Definitions />");if(!U&&ke&&ke.length&&(U=ke[0]),!U)throw new Error("no diagram to display");i={},f(U);var Lt=U.plane;if(!Lt)throw new Error(`no plane for ${sn(U)}`);var P=Lt.bpmnElement;if(!P)if(P=H1($),P)l(`correcting missing bpmnElement on ${sn(Lt)} to ${sn(P)}`),Lt.bpmnElement=P,p(Lt);else throw new Error("no process or collaboration to display");var _=c(P,Lt);if(_n(P,"bpmn:Process")||_n(P,"bpmn:SubProcess"))g(P,_);else if(_n(P,"bpmn:Collaboration"))ue(P,_),R($.rootElements,_);else throw new Error(`unsupported bpmnElement for ${sn(Lt)}: ${sn(P)}`);m(n)};var m=this.handleDeferred=function(){for(var $;n.length;)$=n.shift(),$()};function g(H,$){de(H,$),F(H.ioSpecification,$),A(H.artifacts,$),o(H)}function R(H,$){var U=Oe(H,function(ke){return!a(ke)&&_n(ke,"bpmn:Process")&&ke.laneSets});U.forEach(r(g,$))}function w(H,$){u(H,$)}function b(H,$){k(H,r(w,$))}function x(H,$){u(H,$)}function E(H,$){u(H,$)}function T(H,$){u(H,$)}function L(H,$){u(H,$)}function A(H,$){k(H,function(U){_n(U,"bpmn:Association")?n.push(function(){L(U,$)}):L(U,$)})}function F(H,$){H&&(k(H.dataInputs,r(E,$)),k(H.dataOutputs,r(T,$)))}var z=this.handleSubProcess=function($,U){de($,U),A($.artifacts,U)};function B(H,$){var U=u(H,$);_n(H,"bpmn:SubProcess")&&z(H,U||$),_n(H,"bpmn:Activity")&&F(H.ioSpecification,$),n.push(function(){k(H.dataInputAssociations,r(x,$)),k(H.dataOutputAssociations,r(x,$))})}function G(H,$){u(H,$)}function fe(H,$){u(H,$)}function Fe(H,$){n.push(function(){var U=u(H,$);H.childLaneSet&&lt(H.childLaneSet,U||$),ee(H)})}function lt(H,$){k(H.lanes,r(Fe,$))}function q(H,$){k(H,r(lt,$))}function de(H,$){he(H.flowElements,$),H.laneSets&&q(H.laneSets,$)}function he(H,$){k(H,function(U){_n(U,"bpmn:SequenceFlow")?n.push(function(){G(U,$)}):_n(U,"bpmn:BoundaryEvent")?n.unshift(function(){B(U,$)}):_n(U,"bpmn:FlowNode")?B(U,$):_n(U,"bpmn:DataObject")||(_n(U,"bpmn:DataStoreReference")||_n(U,"bpmn:DataObjectReference")?fe(U,$):l(`unrecognized flowElement ${sn(U)} in context ${sn($&&$.businessObject)}`,{element:U,context:$}))})}function ce(H,$){var U=u(H,$),ke=H.processRef;ke&&g(ke,U||$)}function ue(H,$){k(H.participants,r(ce,$)),n.push(function(){b(H.messageFlows,$)}),A(H.artifacts,$)}function ee(H){k(H.flowNodeRef,function($){var U=$.get("lanes");U&&U.push(H)})}}function v(e,t){var n=Z(e);return n&&typeof n.$instanceOf=="function"&&n.$instanceOf(t)}function De(e,t){return Vi(t,function(n){return v(e,n)})}function Z(e){return e&&e.businessObject||e}function Ve(e){return e&&e.di}function V1(e,t,n){var i,r,o,a,s=[];function c(u,l){var p={root:function(m,g){return i.add(m,g)},element:function(m,g,R){return i.add(m,g,R)},error:function(m,g){s.push({message:m,context:g})}},f=new z1(p);l=l||u.diagrams&&u.diagrams[0];var d=G1(u,l);if(!d)throw new Error("no diagram to display");k(d,function(m){f.handleDefinitions(u,m)});var h=l.plane.bpmnElement.id;o.setRootElement(o.findRoot(h+"_plane")||o.findRoot(h))}return new Promise(function(u,l){try{return i=e.get("bpmnImporter"),r=e.get("eventBus"),o=e.get("canvas"),r.fire("import.render.start",{definitions:t}),c(t,n),r.fire("import.render.complete",{error:a,warnings:s}),u({warnings:s})}catch(p){return p.warnings=s,l(p)}})}function G1(e,t){if(!(!t||!t.plane)){var n=t.plane.bpmnElement,i=n;!v(n,"bpmn:Process")&&!v(n,"bpmn:Collaboration")&&(i=W1(n));var r;v(i,"bpmn:Collaboration")?r=i:r=st(e.rootElements,function(u){if(v(u,"bpmn:Collaboration"))return st(u.participants,function(l){return l.processRef===i})});var o=[i];r&&(o=rn(r.participants,function(u){return u.processRef}),o.push(r));var a=em(o),s=[t],c=[n];return k(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 em(e){var t=[];return k(e,function(n){n&&(t.push(n),t=t.concat(em(n.flowElements)))}),t}function W1(e){for(var t=e;t;){if(v(t,"bpmn:Process"))return t;t=t.$parent}}var U1='<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>',tm=U1,nm={verticalAlign:"middle"},im={color:"#404040"},Y1={zIndex:"1001",position:"fixed",top:"0",left:"0",right:"0",bottom:"0"},q1={width:"100%",height:"100%",background:"rgba(40,40,40,0.2)"},K1={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"},X1='<div class="bjs-powered-by-lightbox"><div class="backdrop"></div><div class="notice"><a href="https://bpmn.io" target="_blank" rel="noopener" class="link">'+tm+'</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>',di;function Z1(){di=ut(X1),mn(di,Y1),mn(et("svg",di),nm),mn(et(".backdrop",di),q1),mn(et(".notice",di),K1),mn(et(".link",di),im,{margin:"15px 20px 15px 10px",alignSelf:"center"})}function Q1(){di||(Z1(),Cn.bind(di,".backdrop","click",function(e){document.body.removeChild(di)})),document.body.appendChild(di)}const Ps=5,rm="djs-outline-hidden";function yt(e){e=O({},eS,e),this._moddle=this._createModdle(e),this._container=this._createContainer(e),this._init(this._container,this._moddle,e),nS(this._container)}ie(yt,tr),yt.prototype.importXML=async function(t,n){const i=this;function r(a){return i.get("eventBus").createEvent(a)}let o=[];try{t=this._emit("import.parse.start",{xml:t})||t;let a;try{a=await this._moddle.fromXML(t,"bpmn:Definitions")}catch(f){throw this._emit("import.parse.complete",{error:f}),f}let s=a.rootElement;const c=a.references,u=a.warnings,l=a.elementsById;o=o.concat(u),s=this._emit("import.parse.complete",r({error:null,definitions:s,elementsById:l,references:c,warnings:o}))||s;const p=await this.importDefinitions(s,n);return o=o.concat(p.warnings),this._emit("import.done",{error:null,warnings:o}),{warnings:o}}catch(a){let s=a;throw o=o.concat(s.warnings||[]),As(s,o),s=J1(s),this._emit("import.done",{error:s,warnings:s.warnings}),s}},yt.prototype.importDefinitions=async function(t,n){return this._setDefinitions(t),{warnings:(await this.open(n)).warnings}},yt.prototype.open=async function(t){const n=this._definitions;let i=t;if(!n){const o=new Error("no XML imported");throw As(o,[]),o}if(typeof t=="string"&&(i=tS(n,t),!i)){const o=new Error("BPMNDiagram <"+t+"> not found");throw As(o,[]),o}try{this.clear()}catch(o){throw As(o,[]),o}const{warnings:r}=await V1(this,n,i);return{warnings:r}},yt.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},yt.prototype.saveSVG=async function(){this._emit("saveSVG.start");let t,n;try{const i=this.get("canvas"),r=i.getActiveLayer(),o=et(":scope > defs",i._svg),a=wh(r),s=o?"<defs>"+wh(o)+"</defs>":"",c=i.getContainer();mt(c).add(rm);let u;try{u=r.getBBox()}finally{mt(c).remove(rm)}const l=u.x-Ps,p=u.y-Ps,f=u.width+Ps*2,d=u.height+Ps*2;t=`<?xml version="1.0" encoding="utf-8"?>
8
8
  <!-- created with bpmn-js / http://bpmn.io -->
9
9
  <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
10
- <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="`+f+'" height="'+d+'" viewBox="'+l+" "+p+" "+f+" "+d+'" version="1.1">'+s+a+"</svg>"}catch(i){n=i}if(this._emit("saveSVG.done",{error:n,svg:t}),n)throw n;return{svg:t}},yt.prototype._setDefinitions=function(e){this._definitions=e},yt.prototype.getModules=function(){return this._modules},yt.prototype.clear=function(){this.getDefinitions()&&tr.prototype.clear.call(this)},yt.prototype.destroy=function(){tr.prototype.destroy.call(this),li(this._container)},yt.prototype.on=function(e,t,n,i){return this.get("eventBus").on(e,t,n,i)},yt.prototype.off=function(e,t){this.get("eventBus").off(e,t)},yt.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=et(e)),e.appendChild(this._container),this._emit("attach",{}),this.get("canvas").resized()},yt.prototype.getDefinitions=function(){return this._definitions},yt.prototype.detach=function(){const e=this._container,t=e.parentNode;t&&(this._emit("detach",{}),t.removeChild(e))},yt.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=O(ai(n,["additionalModules"]),{canvas:O({},n.canvas,{container:e}),modules:a});tr.call(this,s),n&&n.container&&this.attachTo(n.container)},yt.prototype._emit=function(e,t){return this.get("eventBus").fire(e,t)},yt.prototype._createContainer=function(e){const t=ut('<div class="bjs-container"></div>');return mn(t,{width:rm(e.width),height:rm(e.height),position:e.position}),t},yt.prototype._createModdle=function(e){const t=O({},this._moddleExtensions,e.moddleExtensions);return new ld(t)},yt.prototype._modules=[];function Ts(e,t){return e.warnings=t,e}function Q1(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 J1={width:"100%",height:"100%",position:"relative"};function rm(e){return e+(we(e)?"px":"")}function eS(e,t){return t&&st(e.diagrams,function(n){return n.id===t})||null}function tS(e){const n='<a href="http://bpmn.io" target="_blank" class="bjs-powered-by" title="Powered by bpmn.io" >'+em+"</a>",i=ut(n);mn(et("svg",i),tm),mn(i,nm,{position:"absolute",bottom:"15px",right:"15px",zIndex:"100"}),e.appendChild(i),Se.bind(i,"click",function(r){Z1(),r.preventDefault()})}function uo(e){yt.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)}ie(uo,yt),uo.prototype._createModdle=function(e){var t=yt.prototype._createModdle.call(this,e);return t.ids=new ui([32,36,1]),t},uo.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 $e(e,t){return v(e,"bpmn:CallActivity")?!1:v(e,"bpmn:SubProcess")?(t=t||Ve(e),t&&v(t,"bpmndi:BPMNPlane")?!0:t&&!!t.isExpanded):v(e,"bpmn:Participant")?!!Z(e).processRef:!0}function Yt(e){if(!(!v(e,"bpmn:Participant")&&!v(e,"bpmn:Lane"))){var t=Ve(e).isHorizontal;return t===void 0?!0:t}}function nS(e){return e&&Z(e).isInterrupting!==!1}function cn(e){return e&&!!Z(e).triggeredByEvent}function lo(e,t){var n=Z(e).eventDefinitions;return Vi(n,function(i){return v(i,t)})}function iS(e){return lo(e,"bpmn:ErrorEventDefinition")}function rS(e){return lo(e,"bpmn:EscalationEventDefinition")}function oS(e){return lo(e,"bpmn:CompensateEventDefinition")}var Ir={width:90,height:20},om=15;function nr(e){return v(e,"bpmn:Event")||v(e,"bpmn:Gateway")||v(e,"bpmn:DataStoreReference")||v(e,"bpmn:DataObjectReference")||v(e,"bpmn:DataInput")||v(e,"bpmn:DataOutput")||v(e,"bpmn:SequenceFlow")||v(e,"bpmn:MessageFlow")||v(e,"bpmn:Group")}function Ms(e){return Me(e.label)}function aS(e){var t=e.length/2-1,n=e[Math.floor(t)],i=e[Math.ceil(t+.01)],r=sS(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-=om:a+=om,{x:a,y:s}}function sS(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 pl(e){return e.waypoints?aS(e.waypoints):v(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 cS(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=pl(t),i=Ir),O({x:n.x-i.width/2,y:n.y-i.height/2},i)}function am(e){if(v(e,"bpmn:FlowElement")||v(e,"bpmn:Participant")||v(e,"bpmn:Lane")||v(e,"bpmn:SequenceFlow")||v(e,"bpmn:MessageFlow")||v(e,"bpmn:DataInput")||v(e,"bpmn:DataOutput"))return"name";if(v(e,"bpmn:TextAnnotation"))return"text";if(v(e,"bpmn:Group"))return"categoryValueRef"}function uS(e){var t=e.categoryValueRef;return t&&t.value||""}function jn(e){var t=e.businessObject,n=am(t);if(n)return n==="categoryValueRef"?uS(t):t[n]||""}function lS(e,t){var n=e.businessObject,i=am(n);if(i)if(i==="categoryValueRef"){if(!n[i])return e;n[i].value=t}else n[i]=t;return e}function pS(e){return Me(e)&&nr(e.labelTarget)}var po=7;function sm(e){let t=[];return M(e.incoming,n=>{v(n,"bpmn:Association")&&v(n.source,"bpmn:TextAnnotation")&&t.push({annotation:n.source,association:n})}),M(e.outgoing,n=>{v(n,"bpmn:Association")&&v(n.target,"bpmn:TextAnnotation")&&t.push({annotation:n.target,association:n})}),t}function na(e){const t=new Map;return M(rl(e),n=>{M(sm(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 fl="hsl(225, 10%, 15%)",fS="white";function hi(e,t){return Vi(e.eventDefinitions,function(n){return n.$type===t})}function dS(e){return e.$type==="bpmn:IntermediateThrowEvent"||e.$type==="bpmn:EndEvent"}function hS(e){var t=e.dataObjectRef;return e.isCollection||t&&t.isCollection}function Ie(e,t,n){var i=Ve(e);return n||i.get("color:background-color")||i.get("bioc:fill")||t||fS}function te(e,t,n){var i=Ve(e);return n||i.get("color:border-color")||i.get("bioc:stroke")||t||fl}function ia(e,t,n,i){var r=Ve(e),o=r.get("label");return i||o&&o.get("color:color")||t||te(e,n)}function cm(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 dl(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 mS(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 gS(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 ra(e,t={}){return{width:Gn(e,t),height:An(e,t)}}function Gn(e,t={}){return En(t,"width")?t.width:e.width}function An(e,t={}){return En(t,"height")?t.height:e.height}var yS=new ui,vS=10,ks=3,_S=1.5,Ds=10,bS=4,fo=.95,xS=1,wS=.25;function Nr(e,t,n,i,r,o,a){Pi.call(this,t,a);var s=e&&e.defaultFillColor,c=e&&e.defaultStrokeColor,u=e&&e.defaultLabelColor;function l(C){return n.computeStyle(C,{strokeLinecap:"round",strokeLinejoin:"round",stroke:fl,strokeWidth:2,fill:"white"})}function p(C){return n.computeStyle(C,["no-fill"],{strokeLinecap:"round",strokeLinejoin:"round",stroke:fl,strokeWidth:2})}function f(C,_){var{ref:y={x:0,y:0},scale:D=1,element:I,parentGfx:W=r._svg}=_,oe=me("marker",{id:C,viewBox:"0 0 20 20",refX:y.x,refY:y.y,markerWidth:20*D,markerHeight:20*D,orient:"auto"});Re(oe,I);var Pe=et(":scope > defs",W);Pe||(Pe=me("defs"),Re(W,Pe)),Re(Pe,oe)}function d(C,_,y,D){var I=yS.nextPrefixed("marker-");return h(C,I,_,y,D),"url(#"+I+")"}function h(C,_,y,D,I){if(y==="sequenceflow-end"){var W=me("path",{d:"M 1 5 L 11 10 L 1 15 Z",...l({fill:I,stroke:I,strokeWidth:1})});f(_,{element:W,ref:{x:11,y:10},scale:.5,parentGfx:C})}if(y==="messageflow-start"){var oe=me("circle",{cx:6,cy:6,r:3.5,...l({fill:D,stroke:I,strokeWidth:1,strokeDasharray:[1e4,1]})});f(_,{element:oe,ref:{x:6,y:6},parentGfx:C})}if(y==="messageflow-end"){var Pe=me("path",{d:"m 1 5 l 0 -3 l 7 3 l -7 3 z",...l({fill:D,stroke:I,strokeWidth:1,strokeDasharray:[1e4,1]})});f(_,{element:Pe,ref:{x:8.5,y:5},parentGfx:C})}if(y==="association-start"){var Ue=me("path",{d:"M 11 5 L 1 10 L 11 15",...p({fill:"none",stroke:I,strokeWidth:1.5,strokeDasharray:[1e4,1]})});f(_,{element:Ue,ref:{x:1,y:10},scale:.5,parentGfx:C})}if(y==="association-end"){var ft=me("path",{d:"M 1 5 L 11 10 L 1 15",...p({fill:"none",stroke:I,strokeWidth:1.5,strokeDasharray:[1e4,1]})});f(_,{element:ft,ref:{x:11,y:10},scale:.5,parentGfx:C})}if(y==="conditional-flow-marker"){var tt=me("path",{d:"M 0 10 L 8 6 L 16 10 L 8 14 Z",...l({fill:D,stroke:I})});f(_,{element:tt,ref:{x:-1,y:10},scale:.5,parentGfx:C})}if(y==="conditional-default-flow-marker"){var It=me("path",{d:"M 6 4 L 10 16",...l({stroke:I,fill:"none"})});f(_,{element:It,ref:{x:0,y:10},scale:.5,parentGfx:C})}}function m(C,_,y,D,I={}){Gt(D)&&(I=D,D=0),D=D||0,I=l(I);var W=_/2,oe=y/2,Pe=me("circle",{cx:W,cy:oe,r:Math.round((_+y)/4-D),...I});return Re(C,Pe),Pe}function g(C,_,y,D,I,W){Gt(I)&&(W=I,I=0),I=I||0,W=l(W);var oe=me("rect",{x:I,y:I,width:_-I*2,height:y-I*2,rx:D,ry:D,...W});return Re(C,oe),oe}function R(C,_,y,D){var I=_/2,W=y/2,oe=[{x:I,y:0},{x:_,y:W},{x:I,y},{x:0,y:W}],Pe=oe.map(function(ft){return ft.x+","+ft.y}).join(" ");D=l(D);var Ue=me("polygon",{...D,points:Pe});return Re(C,Ue),Ue}function w(C,_,y,D){y=p(y);var I=Ko(_,y,D);return Re(C,I),I}function b(C,_,y){return w(C,_,y,5)}function x(C,_,y){y=p(y);var D=me("path",{...y,d:_});return Re(C,D),D}function E(C,_,y,D){return x(_,y,O({"data-marker":C},D))}function T(C){return Lt[C]}function L(C){return function(_,y,D){return T(C)(_,y,D)}}var A={"bpmn:MessageEventDefinition":function(C,_,y={},D){var I=i.getScaledPath("EVENT_MESSAGE",{xScaleFactor:.9,yScaleFactor:.9,containerWidth:y.width||_.width,containerHeight:y.height||_.height,position:{mx:.235,my:.315}}),W=D?te(_,c,y.stroke):Ie(_,s,y.fill),oe=D?Ie(_,s,y.fill):te(_,c,y.stroke),Pe=x(C,I,{fill:W,stroke:oe,strokeWidth:1});return Pe},"bpmn:TimerEventDefinition":function(C,_,y={}){var D=y.width||_.width,I=y.height||_.height,W=y.width?1:2,oe=m(C,D,I,.2*I,{fill:Ie(_,s,y.fill),stroke:te(_,c,y.stroke),strokeWidth:W}),Pe=i.getScaledPath("EVENT_TIMER_WH",{xScaleFactor:.75,yScaleFactor:.75,containerWidth:D,containerHeight:I,position:{mx:.5,my:.5}});x(C,Pe,{stroke:te(_,c,y.stroke),strokeWidth:W});for(var Ue=0;Ue<12;Ue++){var ft=i.getScaledPath("EVENT_TIMER_LINE",{xScaleFactor:.75,yScaleFactor:.75,containerWidth:D,containerHeight:I,position:{mx:.5,my:.5}}),tt=D/2,It=I/2;x(C,ft,{strokeWidth:1,stroke:te(_,c,y.stroke),transform:"rotate("+Ue*30+","+It+","+tt+")"})}return oe},"bpmn:EscalationEventDefinition":function(C,_,y={},D){var I=i.getScaledPath("EVENT_ESCALATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:y.width||_.width,containerHeight:y.height||_.height,position:{mx:.5,my:.2}}),W=D?te(_,c,y.stroke):Ie(_,s,y.fill);return x(C,I,{fill:W,stroke:te(_,c,y.stroke),strokeWidth:1})},"bpmn:ConditionalEventDefinition":function(C,_,y={}){var D=i.getScaledPath("EVENT_CONDITIONAL",{xScaleFactor:1,yScaleFactor:1,containerWidth:y.width||_.width,containerHeight:y.height||_.height,position:{mx:.5,my:.222}});return x(C,D,{fill:Ie(_,s,y.fill),stroke:te(_,c,y.stroke),strokeWidth:1})},"bpmn:LinkEventDefinition":function(C,_,y={},D){var I=i.getScaledPath("EVENT_LINK",{xScaleFactor:1,yScaleFactor:1,containerWidth:_.width,containerHeight:_.height,position:{mx:.57,my:.263}}),W=D?te(_,c,y.stroke):Ie(_,s,y.fill);return x(C,I,{fill:W,stroke:te(_,c,y.stroke),strokeWidth:1})},"bpmn:ErrorEventDefinition":function(C,_,y={},D){var I=i.getScaledPath("EVENT_ERROR",{xScaleFactor:1.1,yScaleFactor:1.1,containerWidth:y.width||_.width,containerHeight:y.height||_.height,position:{mx:.2,my:.722}}),W=D?te(_,c,y.stroke):Ie(_,s,y.fill);return x(C,I,{fill:W,stroke:te(_,c,y.stroke),strokeWidth:1})},"bpmn:CancelEventDefinition":function(C,_,y={},D){var I=i.getScaledPath("EVENT_CANCEL_45",{xScaleFactor:1,yScaleFactor:1,containerWidth:_.width,containerHeight:_.height,position:{mx:.638,my:-.055}}),W=D?te(_,c,y.stroke):"none",oe=x(C,I,{fill:W,stroke:te(_,c,y.stroke),strokeWidth:1});return Qh(oe,45),oe},"bpmn:CompensateEventDefinition":function(C,_,y={},D){var I=i.getScaledPath("EVENT_COMPENSATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:y.width||_.width,containerHeight:y.height||_.height,position:{mx:.22,my:.5}}),W=D?te(_,c,y.stroke):Ie(_,s,y.fill);return x(C,I,{fill:W,stroke:te(_,c,y.stroke),strokeWidth:1})},"bpmn:SignalEventDefinition":function(C,_,y={},D){var I=i.getScaledPath("EVENT_SIGNAL",{xScaleFactor:.9,yScaleFactor:.9,containerWidth:y.width||_.width,containerHeight:y.height||_.height,position:{mx:.5,my:.2}}),W=D?te(_,c,y.stroke):Ie(_,s,y.fill);return x(C,I,{strokeWidth:1,fill:W,stroke:te(_,c,y.stroke)})},"bpmn:MultipleEventDefinition":function(C,_,y={},D){var I=i.getScaledPath("EVENT_MULTIPLE",{xScaleFactor:1.1,yScaleFactor:1.1,containerWidth:y.width||_.width,containerHeight:y.height||_.height,position:{mx:.211,my:.36}}),W=D?te(_,c,y.stroke):Ie(_,s,y.fill);return x(C,I,{fill:W,stroke:te(_,c,y.stroke),strokeWidth:1})},"bpmn:ParallelMultipleEventDefinition":function(C,_,y={}){var D=i.getScaledPath("EVENT_PARALLEL_MULTIPLE",{xScaleFactor:1.2,yScaleFactor:1.2,containerWidth:y.width||_.width,containerHeight:y.height||_.height,position:{mx:.458,my:.194}});return x(C,D,{fill:Ie(_,s,y.fill),stroke:te(_,c,y.stroke),strokeWidth:1})},"bpmn:TerminateEventDefinition":function(C,_,y={}){var D=m(C,_.width,_.height,8,{fill:te(_,c,y.stroke),stroke:te(_,c,y.stroke),strokeWidth:4});return D}};function j(C,_,y={},D){var I=Z(C),W=dS(I),oe=D||C;return I.get("eventDefinitions")&&I.get("eventDefinitions").length>1?I.get("parallelMultiple")?A["bpmn:ParallelMultipleEventDefinition"](_,oe,y,W):A["bpmn:MultipleEventDefinition"](_,oe,y,W):hi(I,"bpmn:MessageEventDefinition")?A["bpmn:MessageEventDefinition"](_,oe,y,W):hi(I,"bpmn:TimerEventDefinition")?A["bpmn:TimerEventDefinition"](_,oe,y,W):hi(I,"bpmn:ConditionalEventDefinition")?A["bpmn:ConditionalEventDefinition"](_,oe,y,W):hi(I,"bpmn:SignalEventDefinition")?A["bpmn:SignalEventDefinition"](_,oe,y,W):hi(I,"bpmn:EscalationEventDefinition")?A["bpmn:EscalationEventDefinition"](_,oe,y,W):hi(I,"bpmn:LinkEventDefinition")?A["bpmn:LinkEventDefinition"](_,oe,y,W):hi(I,"bpmn:ErrorEventDefinition")?A["bpmn:ErrorEventDefinition"](_,oe,y,W):hi(I,"bpmn:CancelEventDefinition")?A["bpmn:CancelEventDefinition"](_,oe,y,W):hi(I,"bpmn:CompensateEventDefinition")?A["bpmn:CompensateEventDefinition"](_,oe,y,W):hi(I,"bpmn:TerminateEventDefinition")?A["bpmn:TerminateEventDefinition"](_,oe,y,W):null}var H={ParticipantMultiplicityMarker:function(C,_,y={}){var D=Gn(_,y),I=An(_,y),W=i.getScaledPath("MARKER_PARALLEL",{xScaleFactor:1,yScaleFactor:1,containerWidth:D,containerHeight:I,position:{mx:(D/2-6)/D,my:(I-15)/I}});E("participant-multiplicity",C,W,{strokeWidth:2,fill:Ie(_,s,y.fill),stroke:te(_,c,y.stroke)})},SubProcessMarker:function(C,_,y={}){var D=g(C,14,14,0,{strokeWidth:1,fill:Ie(_,s,y.fill),stroke:te(_,c,y.stroke)});Qt(D,_.width/2-7.5,_.height-20);var I=i.getScaledPath("MARKER_SUB_PROCESS",{xScaleFactor:1.5,yScaleFactor:1.5,containerWidth:_.width,containerHeight:_.height,position:{mx:(_.width/2-7.5)/_.width,my:(_.height-20)/_.height}});E("sub-process",C,I,{fill:Ie(_,s,y.fill),stroke:te(_,c,y.stroke)})},ParallelMarker:function(C,_,y){var D=Gn(_,y),I=An(_,y),W=i.getScaledPath("MARKER_PARALLEL",{xScaleFactor:1,yScaleFactor:1,containerWidth:D,containerHeight:I,position:{mx:(D/2+y.parallel)/D,my:(I-20)/I}});E("parallel",C,W,{fill:Ie(_,s,y.fill),stroke:te(_,c,y.stroke)})},SequentialMarker:function(C,_,y){var D=i.getScaledPath("MARKER_SEQUENTIAL",{xScaleFactor:1,yScaleFactor:1,containerWidth:_.width,containerHeight:_.height,position:{mx:(_.width/2+y.seq)/_.width,my:(_.height-19)/_.height}});E("sequential",C,D,{fill:Ie(_,s,y.fill),stroke:te(_,c,y.stroke)})},CompensationMarker:function(C,_,y){var D=i.getScaledPath("MARKER_COMPENSATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:_.width,containerHeight:_.height,position:{mx:(_.width/2+y.compensation)/_.width,my:(_.height-13)/_.height}});E("compensation",C,D,{strokeWidth:1,fill:Ie(_,s,y.fill),stroke:te(_,c,y.stroke)})},LoopMarker:function(C,_,y){var D=Gn(_,y),I=An(_,y),W=i.getScaledPath("MARKER_LOOP",{xScaleFactor:1,yScaleFactor:1,containerWidth:D,containerHeight:I,position:{mx:(D/2+y.loop)/D,my:(I-7)/I}});E("loop",C,W,{strokeWidth:1.5,fill:"none",stroke:te(_,c,y.stroke),strokeMiterlimit:.5})},AdhocMarker:function(C,_,y){var D=Gn(_,y),I=An(_,y),W=i.getScaledPath("MARKER_ADHOC",{xScaleFactor:1,yScaleFactor:1,containerWidth:D,containerHeight:I,position:{mx:(D/2+y.adhoc)/D,my:(I-15)/I}});E("adhoc",C,W,{strokeWidth:1,fill:te(_,c,y.stroke),stroke:te(_,c,y.stroke)})}};function N(C,_,y,D){H[C](_,y,D)}function G(C,_,y=[],D={}){D={fill:D.fill,stroke:D.stroke,width:Gn(_,D),height:An(_,D)};var I=Z(_),W=y.includes("SubProcessMarker");W?D={...D,seq:-21,parallel:-22,compensation:-25,loop:-18,adhoc:10}:D={...D,seq:-5,parallel:-6,compensation:-7,loop:0,adhoc:-8},I.get("isForCompensation")&&y.push("CompensationMarker"),v(I,"bpmn:AdHocSubProcess")&&(y.push("AdhocMarker"),W||O(D,{compensation:D.compensation-18}));var oe=I.get("loopCharacteristics"),Pe=oe&&oe.get("isSequential");oe&&(O(D,{compensation:D.compensation-18}),y.includes("AdhocMarker")&&O(D,{seq:-23,loop:-18,parallel:-24}),Pe===void 0&&y.push("LoopMarker"),Pe===!1&&y.push("ParallelMarker"),Pe===!0&&y.push("SequentialMarker")),y.includes("CompensationMarker")&&y.length===1&&O(D,{compensation:-8}),M(y,function(Ue){N(Ue,C,_,D)})}function fe(C,_,y={}){y=O({size:{width:100}},y);var D=o.createText(_||"",y);return je(D).add("djs-label"),Re(C,D),D}function Fe(C,_,y,D={}){var I=Z(_),W=ra({x:_.x,y:_.y,width:_.width,height:_.height},D);return fe(C,I.name,{align:y,box:W,padding:7,style:{fill:ia(_,u,c,D.stroke)}})}function lt(C,_,y={}){var D={width:_.width,height:_.height,x:_.width/2+_.x,y:_.height/2+_.y};return fe(C,jn(_),{box:D,style:O({},o.getExternalStyle(),{fill:ia(_,u,c,y.stroke)})})}function Y(C,_,y,D={}){var I=Yt(y),W=fe(C,_,{box:{height:30,width:I?An(y,D):Gn(y,D)},align:"center-middle",style:{fill:ia(y,u,c,D.stroke)}});if(I){var oe=-1*An(y,D);Ps(W,0,-oe,270)}}function de(C,_,y={}){var{width:D,height:I}=ra(_,y);return g(C,D,I,Ds,{...y,fill:Ie(_,s,y.fill),fillOpacity:fo,stroke:te(_,c,y.stroke)})}function he(C,_,y={}){var D=Z(_),I=Ie(_,s,y.fill),W=te(_,c,y.stroke);return(D.get("associationDirection")==="One"||D.get("associationDirection")==="Both")&&(y.markerEnd=d(C,"association-end",I,W)),D.get("associationDirection")==="Both"&&(y.markerStart=d(C,"association-start",I,W)),y=Ge(y,["markerStart","markerEnd"]),b(C,_.waypoints,{...y,stroke:W,strokeDasharray:"0, 5"})}function se(C,_,y={}){var D=Ie(_,s,y.fill),I=te(_,c,y.stroke),W=i.getScaledPath("DATA_OBJECT_PATH",{xScaleFactor:1,yScaleFactor:1,containerWidth:_.width,containerHeight:_.height,position:{mx:.474,my:.296}}),oe=x(C,W,{fill:D,fillOpacity:fo,stroke:I}),Pe=Z(_);if(hS(Pe)){var Ue=i.getScaledPath("DATA_OBJECT_COLLECTION_PATH",{xScaleFactor:1,yScaleFactor:1,containerWidth:_.width,containerHeight:_.height,position:{mx:.33,my:(_.height-18)/_.height}});x(C,Ue,{strokeWidth:2,fill:D,stroke:I})}return oe}function ce(C,_,y={}){return m(C,_.width,_.height,{fillOpacity:fo,...y,fill:Ie(_,s,y.fill),stroke:te(_,c,y.stroke)})}function ee(C,_,y={}){return R(C,_.width,_.height,{fill:Ie(_,s,y.fill),fillOpacity:fo,stroke:te(_,c,y.stroke)})}function F(C,_,y={}){var D=g(C,Gn(_,y),An(_,y),0,{fill:Ie(_,s,y.fill),fillOpacity:y.fillOpacity||fo,stroke:te(_,c,y.stroke),strokeWidth:1.5}),I=Z(_);if(v(I,"bpmn:Lane")){var W=I.get("name");Y(C,W,_,y)}return D}function $(C,_,y={}){var D=de(C,_,y),I=$e(_);if(cn(_)&&(re(D,{strokeDasharray:"0, 5.5",strokeWidth:2.5}),!I)){var W=Z(_).flowElements||[],oe=W.filter(Pe=>v(Pe,"bpmn:StartEvent"));oe.length===1&&U(oe[0],C,y,_)}return Fe(C,_,I?"center-top":"center-middle",y),I?G(C,_,void 0,y):G(C,_,["SubProcessMarker"],y),D}function U(C,_,y,D){var I=22,W={fill:Ie(D,s,y.fill),stroke:te(D,c,y.stroke),width:I,height:I},oe=Z(C).isInterrupting,Pe=oe?0:3,Ue=oe?1:1.2,ft=20,tt=(I-ft)/2,It="translate("+tt+","+tt+")";m(_,ft,ft,{fill:W.fill,stroke:W.stroke,strokeWidth:Ue,strokeDasharray:Pe,transform:It}),j(C,_,W,D)}function ke(C,_,y={}){var D=de(C,_,y);return Fe(C,_,"center-middle",y),G(C,_,void 0,y),D}var Lt=this.handlers={"bpmn:AdHocSubProcess":function(C,_,y={}){return $e(_)?y=Ge(y,["fill","stroke","width","height"]):y=Ge(y,["fill","stroke"]),$(C,_,y)},"bpmn:Association":function(C,_,y={}){return y=Ge(y,["fill","stroke"]),he(C,_,y)},"bpmn:BoundaryEvent":function(C,_,y={}){var{renderIcon:D=!0}=y;y=Ge(y,["fill","stroke"]);var I=Z(_),W=I.get("cancelActivity");y={strokeWidth:1.5,fill:Ie(_,s,y.fill),fillOpacity:xS,stroke:te(_,c,y.stroke)},W||(y.strokeDasharray="6");var oe=ce(C,_,y);return m(C,_.width,_.height,ks,{...y,fill:"none"}),D&&j(_,C,y),oe},"bpmn:BusinessRuleTask":function(C,_,y={}){y=Ge(y,["fill","stroke"]);var D=ke(C,_,y),I=i.getScaledPath("TASK_TYPE_BUSINESS_RULE_MAIN",{abspos:{x:8,y:8}}),W=x(C,I);re(W,{fill:Ie(_,s,y.fill),stroke:te(_,c,y.stroke),strokeWidth:1});var oe=i.getScaledPath("TASK_TYPE_BUSINESS_RULE_HEADER",{abspos:{x:8,y:8}}),Pe=x(C,oe);return re(Pe,{fill:te(_,c,y.stroke),stroke:te(_,c,y.stroke),strokeWidth:1}),D},"bpmn:CallActivity":function(C,_,y={}){return y=Ge(y,["fill","stroke"]),$(C,_,{strokeWidth:5,...y})},"bpmn:ComplexGateway":function(C,_,y={}){y=Ge(y,["fill","stroke"]);var D=ee(C,_,y),I=i.getScaledPath("GATEWAY_COMPLEX",{xScaleFactor:.5,yScaleFactor:.5,containerWidth:_.width,containerHeight:_.height,position:{mx:.46,my:.26}});return x(C,I,{fill:te(_,c,y.stroke),stroke:te(_,c,y.stroke),strokeWidth:1}),D},"bpmn:DataInput":function(C,_,y={}){y=Ge(y,["fill","stroke"]);var D=i.getRawPath("DATA_ARROW"),I=se(C,_,y);return x(C,D,{fill:"none",stroke:te(_,c,y.stroke),strokeWidth:1}),I},"bpmn:DataInputAssociation":function(C,_,y={}){return y=Ge(y,["fill","stroke"]),he(C,_,{...y,markerEnd:d(C,"association-end",Ie(_,s,y.fill),te(_,c,y.stroke))})},"bpmn:DataObject":function(C,_,y={}){return y=Ge(y,["fill","stroke"]),se(C,_,y)},"bpmn:DataObjectReference":L("bpmn:DataObject"),"bpmn:DataOutput":function(C,_,y={}){y=Ge(y,["fill","stroke"]);var D=i.getRawPath("DATA_ARROW"),I=se(C,_,y);return x(C,D,{strokeWidth:1,fill:te(_,c,y.stroke),stroke:te(_,c,y.stroke)}),I},"bpmn:DataOutputAssociation":function(C,_,y={}){return y=Ge(y,["fill","stroke"]),he(C,_,{...y,markerEnd:d(C,"association-end",Ie(_,s,y.fill),te(_,c,y.stroke))})},"bpmn:DataStoreReference":function(C,_,y={}){y=Ge(y,["fill","stroke"]);var D=i.getScaledPath("DATA_STORE",{xScaleFactor:1,yScaleFactor:1,containerWidth:_.width,containerHeight:_.height,position:{mx:0,my:.133}});return x(C,D,{fill:Ie(_,s,y.fill),fillOpacity:fo,stroke:te(_,c,y.stroke),strokeWidth:2})},"bpmn:EndEvent":function(C,_,y={}){var{renderIcon:D=!0}=y;y=Ge(y,["fill","stroke"]);var I=ce(C,_,{...y,strokeWidth:4});return D&&j(_,C,y),I},"bpmn:EventBasedGateway":function(C,_,y={}){y=Ge(y,["fill","stroke"]);var D=Z(_),I=ee(C,_,y);m(C,_.width,_.height,_.height*.2,{fill:Ie(_,"none",y.fill),stroke:te(_,c,y.stroke),strokeWidth:1});var W=D.get("eventGatewayType"),oe=!!D.get("instantiate");function Pe(){var ft=i.getScaledPath("GATEWAY_EVENT_BASED",{xScaleFactor:.18,yScaleFactor:.18,containerWidth:_.width,containerHeight:_.height,position:{mx:.36,my:.44}});x(C,ft,{fill:"none",stroke:te(_,c,y.stroke),strokeWidth:2})}if(W==="Parallel"){var Ue=i.getScaledPath("GATEWAY_PARALLEL",{xScaleFactor:.4,yScaleFactor:.4,containerWidth:_.width,containerHeight:_.height,position:{mx:.474,my:.296}});x(C,Ue,{fill:"none",stroke:te(_,c,y.stroke),strokeWidth:1})}else W==="Exclusive"&&(oe||m(C,_.width,_.height,_.height*.26,{fill:"none",stroke:te(_,c,y.stroke),strokeWidth:1}),Pe());return I},"bpmn:ExclusiveGateway":function(C,_,y={}){y=Ge(y,["fill","stroke"]);var D=ee(C,_,y),I=i.getScaledPath("GATEWAY_EXCLUSIVE",{xScaleFactor:.4,yScaleFactor:.4,containerWidth:_.width,containerHeight:_.height,position:{mx:.32,my:.3}}),W=Ve(_);return W.get("isMarkerVisible")&&x(C,I,{fill:te(_,c,y.stroke),stroke:te(_,c,y.stroke),strokeWidth:1}),D},"bpmn:Gateway":function(C,_,y={}){return y=Ge(y,["fill","stroke"]),ee(C,_,y)},"bpmn:Group":function(C,_,y={}){return y=Ge(y,["fill","stroke","width","height"]),g(C,_.width,_.height,Ds,{stroke:te(_,c,y.stroke),strokeWidth:1.5,strokeDasharray:"10, 6, 0, 6",fill:"none",pointerEvents:"none",width:Gn(_,y),height:An(_,y)})},"bpmn:InclusiveGateway":function(C,_,y={}){y=Ge(y,["fill","stroke"]);var D=ee(C,_,y);return m(C,_.width,_.height,_.height*.24,{fill:Ie(_,s,y.fill),stroke:te(_,c,y.stroke),strokeWidth:2.5}),D},"bpmn:IntermediateEvent":function(C,_,y={}){var{renderIcon:D=!0}=y;y=Ge(y,["fill","stroke"]);var I=ce(C,_,{...y,strokeWidth:1.5});return m(C,_.width,_.height,ks,{fill:"none",stroke:te(_,c,y.stroke),strokeWidth:1.5}),D&&j(_,C,y),I},"bpmn:IntermediateCatchEvent":L("bpmn:IntermediateEvent"),"bpmn:IntermediateThrowEvent":L("bpmn:IntermediateEvent"),"bpmn:Lane":function(C,_,y={}){return y=Ge(y,["fill","stroke","width","height"]),F(C,_,{...y,fillOpacity:wS})},"bpmn:ManualTask":function(C,_,y={}){y=Ge(y,["fill","stroke"]);var D=ke(C,_,y),I=i.getScaledPath("TASK_TYPE_MANUAL",{abspos:{x:17,y:15}});return x(C,I,{fill:Ie(_,s,y.fill),stroke:te(_,c,y.stroke),strokeWidth:.5}),D},"bpmn:MessageFlow":function(C,_,y={}){y=Ge(y,["fill","stroke"]);var D=Z(_),I=Ve(_),W=Ie(_,s,y.fill),oe=te(_,c,y.stroke),Pe=b(C,_.waypoints,{markerEnd:d(C,"messageflow-end",W,oe),markerStart:d(C,"messageflow-start",W,oe),stroke:oe,strokeDasharray:"10, 11",strokeWidth:1.5});if(D.get("messageRef")){var Ue=Pe.getPointAtLength(Pe.getTotalLength()/2),ft=i.getScaledPath("MESSAGE_FLOW_MARKER",{abspos:{x:Ue.x,y:Ue.y}}),tt={strokeWidth:1};I.get("messageVisibleKind")==="initiating"?(tt.fill=W,tt.stroke=oe):(tt.fill=oe,tt.stroke=W);var It=x(C,ft,tt),un=D.get("messageRef"),ln=un.get("name"),at=fe(C,ln,{align:"center-top",fitBox:!0,style:{fill:oe}}),Nt=It.getBBox(),pn=at.getBBox(),jo=Ue.x-pn.width/2,fn=Ue.y+Nt.height/2+vS;Ps(at,jo,fn,0)}return Pe},"bpmn:ParallelGateway":function(C,_,y={}){y=Ge(y,["fill","stroke"]);var D=ee(C,_,y),I=i.getScaledPath("GATEWAY_PARALLEL",{xScaleFactor:.6,yScaleFactor:.6,containerWidth:_.width,containerHeight:_.height,position:{mx:.46,my:.2}});return x(C,I,{fill:te(_,c,y.stroke),stroke:te(_,c,y.stroke),strokeWidth:1}),D},"bpmn:Participant":function(C,_,y={}){y=Ge(y,["fill","stroke","width","height"]);var D=F(C,_,y),I=$e(_),W=Yt(_),oe=Z(_),Pe=oe.get("name");if(I){var Ue=W?[{x:30,y:0},{x:30,y:An(_,y)}]:[{x:0,y:30},{x:Gn(_,y),y:30}];w(C,Ue,{stroke:te(_,c,y.stroke),strokeWidth:_S}),Y(C,Pe,_,y)}else{var ft=ra(_,y);W||(ft.height=Gn(_,y),ft.width=An(_,y));var tt=fe(C,Pe,{box:ft,align:"center-middle",style:{fill:ia(_,u,c,y.stroke)}});if(!W){var It=-1*An(_,y);Ps(tt,0,-It,270)}}return oe.get("participantMultiplicity")&&N("ParticipantMultiplicityMarker",C,_,y),D},"bpmn:ReceiveTask":function(C,_,y={}){y=Ge(y,["fill","stroke"]);var D=Z(_),I=ke(C,_,y),W;return D.get("instantiate")?(m(C,28,28,20*.22,{fill:Ie(_,s,y.fill),stroke:te(_,c,y.stroke),strokeWidth:1}),W=i.getScaledPath("TASK_TYPE_INSTANTIATING_SEND",{abspos:{x:7.77,y:9.52}})):W=i.getScaledPath("TASK_TYPE_SEND",{xScaleFactor:.9,yScaleFactor:.9,containerWidth:21,containerHeight:14,position:{mx:.3,my:.4}}),x(C,W,{fill:Ie(_,s,y.fill),stroke:te(_,c,y.stroke),strokeWidth:1}),I},"bpmn:ScriptTask":function(C,_,y={}){y=Ge(y,["fill","stroke"]);var D=ke(C,_,y),I=i.getScaledPath("TASK_TYPE_SCRIPT",{abspos:{x:15,y:20}});return x(C,I,{fill:Ie(_,s,y.fill),stroke:te(_,c,y.stroke),strokeWidth:1}),D},"bpmn:SendTask":function(C,_,y={}){y=Ge(y,["fill","stroke"]);var D=ke(C,_,y),I=i.getScaledPath("TASK_TYPE_SEND",{xScaleFactor:1,yScaleFactor:1,containerWidth:21,containerHeight:14,position:{mx:.285,my:.357}});return x(C,I,{fill:te(_,c,y.stroke),stroke:Ie(_,s,y.fill),strokeWidth:1}),D},"bpmn:SequenceFlow":function(C,_,y={}){y=Ge(y,["fill","stroke"]);var D=Ie(_,s,y.fill),I=te(_,c,y.stroke),W=b(C,_.waypoints,{markerEnd:d(C,"sequenceflow-end",D,I),stroke:I}),oe=Z(_),{source:Pe}=_;if(Pe){var Ue=Z(Pe);oe.get("conditionExpression")&&v(Ue,"bpmn:Activity")&&re(W,{markerStart:d(C,"conditional-flow-marker",D,I)}),Ue.get("default")&&(v(Ue,"bpmn:Gateway")||v(Ue,"bpmn:Activity"))&&Ue.get("default")===oe&&re(W,{markerStart:d(C,"conditional-default-flow-marker",D,I)})}return W},"bpmn:ServiceTask":function(C,_,y={}){y=Ge(y,["fill","stroke"]);var D=ke(C,_,y);m(C,10,10,{fill:Ie(_,s,y.fill),stroke:"none",transform:"translate(6, 6)"});var I=i.getScaledPath("TASK_TYPE_SERVICE",{abspos:{x:12,y:18}});x(C,I,{fill:Ie(_,s,y.fill),stroke:te(_,c,y.stroke),strokeWidth:1}),m(C,10,10,{fill:Ie(_,s,y.fill),stroke:"none",transform:"translate(11, 10)"});var W=i.getScaledPath("TASK_TYPE_SERVICE",{abspos:{x:17,y:22}});return x(C,W,{fill:Ie(_,s,y.fill),stroke:te(_,c,y.stroke),strokeWidth:1}),D},"bpmn:StartEvent":function(C,_,y={}){var{renderIcon:D=!0}=y;y=Ge(y,["fill","stroke"]);var I=Z(_);I.get("isInterrupting")||(y={...y,strokeDasharray:"6"});var W=ce(C,_,y);return D&&j(_,C,y),W},"bpmn:SubProcess":function(C,_,y={}){return $e(_)?y=Ge(y,["fill","stroke","width","height"]):y=Ge(y,["fill","stroke"]),$(C,_,y)},"bpmn:Task":function(C,_,y={}){return y=Ge(y,["fill","stroke"]),ke(C,_,y)},"bpmn:TextAnnotation":function(C,_,y={}){y=Ge(y,["fill","stroke"]);var{width:D,height:I}=ra(_,y),W=g(C,D,I,0,0,{fill:"none",stroke:"none"}),oe=i.getScaledPath("TEXT_ANNOTATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:D,containerHeight:I,position:{mx:0,my:0}});x(C,oe,{stroke:te(_,c,y.stroke)});var Pe=Z(_),Ue=Pe.get("text")||"";return fe(C,Ue,{align:"left-top",box:ra(_,y),padding:po,style:{fill:ia(_,u,c,y.stroke)}}),W},"bpmn:Transaction":function(C,_,y={}){$e(_)?y=Ge(y,["fill","stroke","width","height"]):y=Ge(y,["fill","stroke"]);var D=$(C,_,{strokeWidth:1.5,...y}),I=n.style(["no-fill","no-events"],{stroke:te(_,c,y.stroke),strokeWidth:1.5}),W=$e(_);return W||(y={}),g(C,Gn(_,y),An(_,y),Ds-ks,ks,I),D},"bpmn:UserTask":function(C,_,y={}){y=Ge(y,["fill","stroke"]);var D=ke(C,_,y),I=15,W=12,oe=i.getScaledPath("TASK_TYPE_USER_1",{abspos:{x:I,y:W}});x(C,oe,{fill:Ie(_,s,y.fill),stroke:te(_,c,y.stroke),strokeWidth:.5});var Pe=i.getScaledPath("TASK_TYPE_USER_2",{abspos:{x:I,y:W}});x(C,Pe,{fill:Ie(_,s,y.fill),stroke:te(_,c,y.stroke),strokeWidth:.5});var Ue=i.getScaledPath("TASK_TYPE_USER_3",{abspos:{x:I,y:W}});return x(C,Ue,{fill:te(_,c,y.stroke),stroke:te(_,c,y.stroke),strokeWidth:.5}),D},label:function(C,_,y={}){return lt(C,_,y)}};this._drawPath=x,this._renderer=T}ie(Nr,Pi),Nr.$inject=["config.bpmnRenderer","eventBus","styles","pathMap","canvas","textRenderer"],Nr.prototype.canRender=function(e){return v(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 Me(e)?dl(e,bS):v(e,"bpmn:Event")?cm(e):v(e,"bpmn:Activity")?dl(e,Ds):v(e,"bpmn:Gateway")?mS(e):gS(e)};function Ge(e,t=[]){return t.reduce((n,i)=>(e[i]&&(n[i]=e[i]),n),{})}var ES=0,SS={width:150,height:50};function RS(e){var t=e.split("-");return{horizontal:t[0]||"center",vertical:t[1]||"top"}}function CS(e){return Gt(e)?O({top:0,left:0,right:0,bottom:0},e):{top:e,left:e,right:e,bottom:e}}var hl=null;function PS(){return hl||(hl=document.createElement("canvas").getContext("2d")),hl}function AS(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(um(e.fontSize)||"12px"),t.push(e.fontFamily||"sans-serif"),t.join(" ")}function um(e){if(e!=null)return typeof e=="number"||/^-?\d+(\.\d+)?$/.test(e)?e+"px":e}function TS(e,t){var n=PS();if(!n)return{width:0,height:0};n.font=AS(t),"letterSpacing"in n&&(n.letterSpacing=um(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 MS(e,t,n){for(var i=e.shift(),r=i,o;;){if(o=TS(r,n),o.width=r?o.width:0,r===" "||r===""||o.width<Math.round(t)||r.length<2)return kS(e,r,i,o);r=OS(r,o.width,t)}}function kS(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 lm="­";function DS(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===lm)&&r.pop();break}var a=r[r.length-1];return a&&a===lm&&(r[r.length-1]="-"),r.join("")}function OS(e,t,n){var i=Math.max(e.length*(n/t),1),r=DS(e,i);return r||(r=e.slice(0,Math.max(Math.round(i-1),1))),r}function Os(e){this._config=O({},{size:SS,padding:ES,style:{},align:"center-top"},e||{})}Os.prototype.createText=function(e,t){return this.layoutText(e,t).element},Os.prototype.getDimensions=function(e,t){return this.layoutText(e,t).dimensions},Os.prototype.layoutText=function(e,t){for(var n=O({},this._config.size,t.box),i=O({},this._config.style,t.style),r=RS(t.align||this._config.align),o=CS(t.padding!==void 0?t.padding:this._config.padding),a=t.fitBox||!1,s=LS(i),c=e.split(/\u00AD?\r?\n/),u=[],l=n.width-o.left-o.right;c.length;)u.push(MS(c,l,i));r.vertical==="middle"&&(o.top=o.bottom=0);var p=Sn(u,function(g,R,w){return g+(s||R.height)},0)+o.top+o.bottom,f=Sn(u,function(g,R,w){return R.width>g?R.width:g},0),d=o.top;r.vertical==="middle"&&(d+=(n.height-p)/2),d-=(s||u[0].height)/4;var h=me("text");re(h,i),M(u,function(g){var R;switch(d+=s||g.height,r.horizontal){case"left":R=o.left;break;case"right":R=(a?f:l)-o.right-g.width;break;default:R=Math.max(((a?f:l)-g.width)/2+o.left,0)}var w=me("tspan");re(w,{x:R,y:d}),w.textContent=g.text,Re(h,w)});var m={width:f,height:p};return{dimensions:m,element:h}};function LS(e){if("fontSize"in e&&"lineHeight"in e)return e.lineHeight*parseInt(e.fontSize,10)}var IS=12,NS=1.2,BS=40;function pm(e){var t=O({fontFamily:"Arial, sans-serif",fontSize:IS,fontWeight:"normal",lineHeight:NS},e&&e.defaultStyle||{}),n=parseInt(t.fontSize,10)-1,i=O({},t,{fontSize:n},e&&e.externalStyle||{}),r=new Os({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:po});return{x:a.x,y:a.y,width:a.width,height:Math.max(BS,Math.round(c.height))}},this.getDimensions=function(a,s){return r.getDimensions(a,s||{})};function o(a,s,c){return r.getDimensions(a,O({box:s},c))}this.createText=function(a,s){return r.createText(a,s||{})},this.getDefaultStyle=function(){return t},this.getExternalStyle=function(){return i}}pm.$inject=["config.textRenderer"];function $S(){this.pathMap={EVENT_MESSAGE:{d:"m {mx},{my} l 0,{e.y1} l {e.x1},0 l 0,-{e.y1} z l {e.x0},{e.y0} l {e.x0},-{e.y0}",height:36,width:36,heightElements:[6,14],widthElements:[10.5,21]},EVENT_SIGNAL:{d:"M {mx},{my} l {e.x0},{e.y0} l -{e.x1},0 Z",height:36,width:36,heightElements:[18],widthElements:[10,20]},EVENT_ESCALATION:{d:"M {mx},{my} l {e.x0},{e.y0} l -{e.x0},-{e.y1} l -{e.x0},{e.y1} Z",height:36,width:36,heightElements:[20,7],widthElements:[8]},EVENT_CONDITIONAL:{d:"M {e.x0},{e.y0} l {e.x1},0 l 0,{e.y2} l -{e.x1},0 Z M {e.x2},{e.y3} l {e.x0},0 M {e.x2},{e.y4} l {e.x0},0 M {e.x2},{e.y5} l {e.x0},0 M {e.x2},{e.y6} l {e.x0},0 M {e.x2},{e.y7} l {e.x0},0 M {e.x2},{e.y8} l {e.x0},0 ",height:36,width:36,heightElements:[8.5,14.5,18,11.5,14.5,17.5,20.5,23.5,26.5],widthElements:[10.5,14.5,12.5]},EVENT_LINK:{d:"m {mx},{my} 0,{e.y0} -{e.x1},0 0,{e.y1} {e.x1},0 0,{e.y0} {e.x0},-{e.y2} -{e.x0},-{e.y2} z",height:36,width:36,heightElements:[4.4375,6.75,7.8125],widthElements:[9.84375,13.5]},EVENT_ERROR:{d:"m {mx},{my} {e.x0},-{e.y0} {e.x1},-{e.y1} {e.x2},{e.y2} {e.x3},-{e.y3} -{e.x4},{e.y4} -{e.x5},-{e.y5} z",height:36,width:36,heightElements:[.023,8.737,8.151,16.564,10.591,8.714],widthElements:[.085,6.672,6.97,4.273,5.337,6.636]},EVENT_CANCEL_45:{d:"m {mx},{my} -{e.x1},0 0,{e.x0} {e.x1},0 0,{e.y1} {e.x0},0 0,-{e.y1} {e.x1},0 0,-{e.y0} -{e.x1},0 0,-{e.y1} -{e.x0},0 z",height:36,width:36,heightElements:[4.75,8.5],widthElements:[4.75,8.5]},EVENT_COMPENSATION:{d:"m {mx},{my} {e.x0},-{e.y0} 0,{e.y1} z m {e.x1},-{e.y2} {e.x2},-{e.y3} 0,{e.y1} -{e.x2},-{e.y3} z",height:36,width:36,heightElements:[6.5,13,.4,6.1],widthElements:[9,9.3,8.7]},EVENT_TIMER_WH:{d:"M {mx},{my} l {e.x0},-{e.y0} m -{e.x0},{e.y0} l {e.x1},{e.y1} ",height:36,width:36,heightElements:[10,2],widthElements:[3,7]},EVENT_TIMER_LINE:{d:"M {mx},{my} m {e.x0},{e.y0} l -{e.x1},{e.y1} ",height:36,width:36,heightElements:[10,3],widthElements:[0,0]},EVENT_MULTIPLE:{d:"m {mx},{my} {e.x1},-{e.y0} {e.x1},{e.y0} -{e.x0},{e.y1} -{e.x2},0 z",height:36,width:36,heightElements:[6.28099,12.56199],widthElements:[3.1405,9.42149,12.56198]},EVENT_PARALLEL_MULTIPLE:{d:"m {mx},{my} {e.x0},0 0,{e.y1} {e.x1},0 0,{e.y0} -{e.x1},0 0,{e.y1} -{e.x0},0 0,-{e.y1} -{e.x1},0 0,-{e.y0} {e.x1},0 z",height:36,width:36,heightElements:[2.56228,7.68683],widthElements:[2.56228,7.68683]},GATEWAY_EXCLUSIVE:{d:"m {mx},{my} {e.x0},{e.y0} {e.x1},{e.y0} {e.x2},0 {e.x4},{e.y2} {e.x4},{e.y1} {e.x2},0 {e.x1},{e.y3} {e.x0},{e.y3} {e.x3},0 {e.x5},{e.y1} {e.x5},{e.y2} {e.x3},0 z",height:17.5,width:17.5,heightElements:[8.5,6.5312,-6.5312,-8.5],widthElements:[6.5,-6.5,3,-3,5,-5]},GATEWAY_PARALLEL:{d:"m {mx},{my} 0,{e.y1} -{e.x1},0 0,{e.y0} {e.x1},0 0,{e.y1} {e.x0},0 0,-{e.y1} {e.x1},0 0,-{e.y0} -{e.x1},0 0,-{e.y1} -{e.x0},0 z",height:30,width:30,heightElements:[5,12.5],widthElements:[5,12.5]},GATEWAY_EVENT_BASED:{d:"m {mx},{my} {e.x0},{e.y0} {e.x0},{e.y1} {e.x1},{e.y2} {e.x2},0 z",height:11,width:11,heightElements:[-6,6,12,-12],widthElements:[9,-3,-12]},GATEWAY_COMPLEX:{d:"m {mx},{my} 0,{e.y0} -{e.x0},-{e.y1} -{e.x1},{e.y2} {e.x0},{e.y1} -{e.x2},0 0,{e.y3} {e.x2},0 -{e.x0},{e.y1} l {e.x1},{e.y2} {e.x0},-{e.y1} 0,{e.y0} {e.x3},0 0,-{e.y0} {e.x0},{e.y1} {e.x1},-{e.y2} -{e.x0},-{e.y1} {e.x2},0 0,-{e.y3} -{e.x2},0 {e.x0},-{e.y1} -{e.x1},-{e.y2} -{e.x0},{e.y1} 0,-{e.y0} -{e.x3},0 z",height:17.125,width:17.125,heightElements:[4.875,3.4375,2.125,3],widthElements:[3.4375,2.125,4.875,3]},DATA_OBJECT_PATH:{d:"m 0,0 {e.x1},0 {e.x0},{e.y0} 0,{e.y1} -{e.x2},0 0,-{e.y2} {e.x1},0 0,{e.y0} {e.x0},0",height:61,width:51,heightElements:[10,50,60],widthElements:[10,40,50,60]},DATA_OBJECT_COLLECTION_PATH:{d:"m{mx},{my} m 3,2 l 0,10 m 3,-10 l 0,10 m 3,-10 l 0,10",height:10,width:10,heightElements:[],widthElements:[]},DATA_ARROW:{d:"m 5,9 9,0 0,-3 5,5 -5,5 0,-3 -9,0 z",height:61,width:51,heightElements:[],widthElements:[]},DATA_STORE:{d:"m {mx},{my} l 0,{e.y2} c {e.x0},{e.y1} {e.x1},{e.y1} {e.x2},0 l 0,-{e.y2} c -{e.x0},-{e.y1} -{e.x1},-{e.y1} -{e.x2},0c {e.x0},{e.y1} {e.x1},{e.y1} {e.x2},0 m -{e.x2},{e.y0}c {e.x0},{e.y1} {e.x1},{e.y1} {e.x2},0m -{e.x2},{e.y0}c {e.x0},{e.y1} {e.x1},{e.y1} {e.x2},0",height:61,width:61,heightElements:[7,10,45],widthElements:[2,58,60]},TEXT_ANNOTATION:{d:"m {mx}, {my} m 10,0 l -10,0 l 0,{e.y0} l 10,0",height:30,width:10,heightElements:[30],widthElements:[10]},MARKER_SUB_PROCESS:{d:"m{mx},{my} m 7,2 l 0,10 m -5,-5 l 10,0",height:10,width:10,heightElements:[],widthElements:[]},MARKER_PARALLEL:{d:"m{mx},{my} m 3,2 l 0,10 m 3,-10 l 0,10 m 3,-10 l 0,10",height:10,width:10,heightElements:[],widthElements:[]},MARKER_SEQUENTIAL:{d:"m{mx},{my} m 0,3 l 10,0 m -10,3 l 10,0 m -10,3 l 10,0",height:10,width:10,heightElements:[],widthElements:[]},MARKER_COMPENSATION:{d:"m {mx},{my} 7,-5 0,10 z m 7.1,-0.3 6.9,-4.7 0,10 -6.9,-4.7 z",height:10,width:21,heightElements:[],widthElements:[]},MARKER_LOOP:{d:"m {mx},{my} c 3.526979,0 6.386161,-2.829858 6.386161,-6.320661 0,-3.490806 -2.859182,-6.320661 -6.386161,-6.320661 -3.526978,0 -6.38616,2.829855 -6.38616,6.320661 0,1.745402 0.714797,3.325567 1.870463,4.469381 0.577834,0.571908 1.265885,1.034728 2.029916,1.35457 l -0.718163,-3.909793 m 0.718163,3.909793 -3.885211,0.802902",height:13.9,width:13.7,heightElements:[],widthElements:[]},MARKER_ADHOC:{d:"m {mx},{my} m 0.84461,2.64411 c 1.05533,-1.23780996 2.64337,-2.07882 4.29653,-1.97997996 2.05163,0.0805 3.85579,1.15803 5.76082,1.79107 1.06385,0.34139996 2.24454,0.1438 3.18759,-0.43767 0.61743,-0.33642 1.2775,-0.64078 1.7542,-1.17511 0,0.56023 0,1.12046 0,1.6807 -0.98706,0.96237996 -2.29792,1.62393996 -3.6918,1.66181996 -1.24459,0.0927 -2.46671,-0.2491 -3.59505,-0.74812 -1.35789,-0.55965 -2.75133,-1.33436996 -4.27027,-1.18121996 -1.37741,0.14601 -2.41842,1.13685996 -3.44288,1.96782996 z",height:4,width:15,heightElements:[],widthElements:[]},TASK_TYPE_SEND:{d:"m {mx},{my} l 0,{e.y1} l {e.x1},0 l 0,-{e.y1} z l {e.x0},{e.y0} l {e.x0},-{e.y0}",height:14,width:21,heightElements:[6,14],widthElements:[10.5,21]},TASK_TYPE_SCRIPT:{d:"m {mx},{my} c 9.966553,-6.27276 -8.000926,-7.91932 2.968968,-14.938 l -8.802728,0 c -10.969894,7.01868 6.997585,8.66524 -2.968967,14.938 z m -7,-12 l 5,0 m -4.5,3 l 4.5,0 m -3,3 l 5,0m -4,3 l 5,0",height:15,width:12.6,heightElements:[6,14],widthElements:[10.5,21]},TASK_TYPE_USER_1:{d:"m {mx},{my} c 0.909,-0.845 1.594,-2.049 1.594,-3.385 0,-2.554 -1.805,-4.62199999 -4.357,-4.62199999 -2.55199998,0 -4.28799998,2.06799999 -4.28799998,4.62199999 0,1.348 0.974,2.562 1.89599998,3.405 -0.52899998,0.187 -5.669,2.097 -5.794,4.7560005 v 6.718 h 17 v -6.718 c 0,-2.2980005 -5.5279996,-4.5950005 -6.0509996,-4.7760005 zm -8,6 l 0,5.5 m 11,0 l 0,-5"},TASK_TYPE_USER_2:{d:"m {mx},{my} m 2.162,1.009 c 0,2.4470005 -2.158,4.4310005 -4.821,4.4310005 -2.66499998,0 -4.822,-1.981 -4.822,-4.4310005 "},TASK_TYPE_USER_3:{d:"m {mx},{my} m -6.9,-3.80 c 0,0 2.25099998,-2.358 4.27399998,-1.177 2.024,1.181 4.221,1.537 4.124,0.965 -0.098,-0.57 -0.117,-3.79099999 -4.191,-4.13599999 -3.57499998,0.001 -4.20799998,3.36699999 -4.20699998,4.34799999 z"},TASK_TYPE_MANUAL:{d:"m {mx},{my} c 0.234,-0.01 5.604,0.008 8.029,0.004 0.808,0 1.271,-0.172 1.417,-0.752 0.227,-0.898 -0.334,-1.314 -1.338,-1.316 -2.467,-0.01 -7.886,-0.004 -8.108,-0.004 -0.014,-0.079 0.016,-0.533 0,-0.61 0.195,-0.042 8.507,0.006 9.616,0.002 0.877,-0.007 1.35,-0.438 1.353,-1.208 0.003,-0.768 -0.479,-1.09 -1.35,-1.091 -2.968,-0.002 -9.619,-0.013 -9.619,-0.013 v -0.591 c 0,0 5.052,-0.016 7.225,-0.016 0.888,-0.002 1.354,-0.416 1.351,-1.193 -0.006,-0.761 -0.492,-1.196 -1.361,-1.196 -3.473,-0.005 -10.86,-0.003 -11.0829995,-0.003 -0.022,-0.047 -0.045,-0.094 -0.069,-0.139 0.3939995,-0.319 2.0409995,-1.626 2.4149995,-2.017 0.469,-0.4870005 0.519,-1.1650005 0.162,-1.6040005 -0.414,-0.511 -0.973,-0.5 -1.48,-0.236 -1.4609995,0.764 -6.5999995,3.6430005 -7.7329995,4.2710005 -0.9,0.499 -1.516,1.253 -1.882,2.19 -0.37000002,0.95 -0.17,2.01 -0.166,2.979 0.004,0.718 -0.27300002,1.345 -0.055,2.063 0.629,2.087 2.425,3.312 4.859,3.318 4.6179995,0.014 9.2379995,-0.139 13.8569995,-0.158 0.755,-0.004 1.171,-0.301 1.182,-1.033 0.012,-0.754 -0.423,-0.969 -1.183,-0.973 -1.778,-0.01 -5.824,-0.004 -6.04,-0.004 10e-4,-0.084 0.003,-0.586 10e-4,-0.67 z"},TASK_TYPE_INSTANTIATING_SEND:{d:"m {mx},{my} l 0,8.4 l 12.6,0 l 0,-8.4 z l 6.3,3.6 l 6.3,-3.6"},TASK_TYPE_SERVICE:{d:"m {mx},{my} v -1.71335 c 0.352326,-0.0705 0.703932,-0.17838 1.047628,-0.32133 0.344416,-0.14465 0.665822,-0.32133 0.966377,-0.52145 l 1.19431,1.18005 1.567487,-1.57688 -1.195028,-1.18014 c 0.403376,-0.61394 0.683079,-1.29908 0.825447,-2.01824 l 1.622133,-0.01 v -2.2196 l -1.636514,0.01 c -0.07333,-0.35153 -0.178319,-0.70024 -0.323564,-1.04372 -0.145244,-0.34406 -0.321407,-0.6644 -0.522735,-0.96217 l 1.131035,-1.13631 -1.583305,-1.56293 -1.129598,1.13589 c -0.614052,-0.40108 -1.302883,-0.68093 -2.022633,-0.82247 l 0.0093,-1.61852 h -2.241173 l 0.0042,1.63124 c -0.353763,0.0736 -0.705369,0.17977 -1.049785,0.32371 -0.344415,0.14437 -0.665102,0.32092 -0.9635006,0.52046 l -1.1698628,-1.15823 -1.5667691,1.5792 1.1684265,1.15669 c -0.4026573,0.61283 -0.68308,1.29797 -0.8247287,2.01713 l -1.6588041,0.003 v 2.22174 l 1.6724648,-0.006 c 0.073327,0.35077 0.1797598,0.70243 0.3242851,1.04472 0.1452428,0.34448 0.3214064,0.6644 0.5227339,0.96066 l -1.1993431,1.19723 1.5840256,1.56011 1.1964668,-1.19348 c 0.6140517,0.40346 1.3028827,0.68232 2.0233517,0.82331 l 7.19e-4,1.69892 h 2.226848 z m 0.221462,-3.9957 c -1.788948,0.7502 -3.8576,-0.0928 -4.6097055,-1.87438 -0.7521065,-1.78321 0.090598,-3.84627 1.8802645,-4.59604 1.78823,-0.74936 3.856881,0.0929 4.608987,1.87437 0.752106,1.78165 -0.0906,3.84612 -1.879546,4.59605 z"},TASK_TYPE_SERVICE_FILL:{d:"m {mx},{my} c -1.788948,0.7502 -3.8576,-0.0928 -4.6097055,-1.87438 -0.7521065,-1.78321 0.090598,-3.84627 1.8802645,-4.59604 1.78823,-0.74936 3.856881,0.0929 4.608987,1.87437 0.752106,1.78165 -0.0906,3.84612 -1.879546,4.59605 z"},TASK_TYPE_BUSINESS_RULE_HEADER:{d:"m {mx},{my} 0,4 20,0 0,-4 z"},TASK_TYPE_BUSINESS_RULE_MAIN:{d:"m {mx},{my} 0,12 20,0 0,-12 zm 0,8 l 20,0 m -13,-4 l 0,8"},MESSAGE_FLOW_MARKER:{d:"m {mx},{my} m -10.5 ,-7 l 0,14 l 21,0 l 0,-14 z l 10.5,6 l 10.5,-6"}},this.getRawPath=function(t){return this.pathMap[t].d},this.getScaledPath=function(t,n){var i=this.pathMap[t],r,o;n.abspos?(r=n.abspos.x,o=n.abspos.y):(r=n.containerWidth*n.position.mx,o=n.containerHeight*n.position.my);var a={};if(n.position){for(var s=n.containerHeight/i.height*n.yScaleFactor,c=n.containerWidth/i.width*n.xScaleFactor,u=0;u<i.heightElements.length;u++)a["y"+u]=i.heightElements[u]*s;for(var l=0;l<i.widthElements.length;l++)a["x"+l]=i.widthElements[l]*c}var p=zS(i.d,{mx:r,my:o,e:a});return p}}var jS=/\{([^{}]+)\}/g,FS=/(?:(?:^|\.)(.+?)(?=\[|\.|$|\()|\[('|")(.+?)\2\])(\(\))?/g;function HS(e,t,n){var i=n;return t.replace(FS,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 zS(e,t){return String(e).replace(jS,function(n,i){return HS(n,i,t)})}const VS={__init__:["bpmnRenderer"],bpmnRenderer:["type",Nr],textRenderer:["type",pm],pathMap:["type",$S]};function GS(e,t){return t=t||{},e.replace(/{([^}]+)}/g,function(n,i){return t[i]||"{"+i+"}"})}const oa={translate:["value",GS]};function Ls(e,t,n){return O({id:e.id,type:e.$type,businessObject:e,di:t},n)}function WS(e,t,n){var i=e.waypoint;return!i||i.length<2?[be(t),be(n)]:i.map(function(r){return{x:r.x,y:r.y}})}function fm(e,t,n){return new Error(`element ${sn(t)} referenced by ${sn(e)}#${n} not yet drawn`)}function ki(e,t,n,i,r){this._eventBus=e,this._canvas=t,this._elementFactory=n,this._elementRegistry=i,this._textRenderer=r}ki.$inject=["eventBus","canvas","elementFactory","elementRegistry","textRenderer"],ki.prototype.add=function(e,t,n){var i,r,o;if(v(t,"bpmndi:BPMNPlane")){var a=v(e,"bpmn:SubProcess")?{id:e.id+"_plane"}:{};i=this._elementFactory.createRoot(Ls(e,t,a)),this._canvas.addRootElement(i)}else if(v(t,"bpmndi:BPMNShape")){var s=!$e(e,t),c=YS(e);r=n&&(n.hidden||n.collapsed);var u=t.bounds;i=this._elementFactory.createShape(Ls(e,t,{collapsed:s,hidden:r,x:Math.round(u.x),y:Math.round(u.y),width:Math.round(u.width),height:Math.round(u.height),isFrame:c})),v(e,"bpmn:BoundaryEvent")&&this._attachBoundary(e,i),v(e,"bpmn:Lane")&&(o=0),v(e,"bpmn:DataStoreReference")&&(US(n,be(u))||(n=this._canvas.findRoot(n))),this._canvas.addShape(i,n,o)}else if(v(t,"bpmndi:BPMNEdge")){var l=this._getSource(e),p=this._getTarget(e);r=n&&(n.hidden||n.collapsed),i=this._elementFactory.createConnection(Ls(e,t,{hidden:r,source:l,target:p,waypoints:WS(t,l,p)})),v(e,"bpmn:DataAssociation")&&(n=this._canvas.findRoot(n)),this._canvas.addConnection(i,n,o)}else throw new Error(`unknown di ${sn(t)} for element ${sn(e)}`);return nr(e)&&jn(i)&&this.addLabel(e,t,i),this._eventBus.fire("bpmnElement.added",{element:i}),i},ki.prototype._attachBoundary=function(e,t){var n=e.attachedToRef;if(!n)throw new Error(`missing ${sn(e)}#attachedToRef`);var i=this._elementRegistry.get(n.id),r=i&&i.attachers;if(!i)throw fm(e,n,"attachedToRef");t.host=i,r||(i.attachers=r=[]),r.indexOf(t)===-1&&r.push(t)},ki.prototype.addLabel=function(e,t,n){var i,r,o;return i=cS(t,n),r=jn(n),r&&(i=this._textRenderer.getExternalLabelBounds(i,r)),o=this._elementFactory.createLabel(Ls(e,t,{id:e.id+"_label",labelTarget:n,type:"label",hidden:n.hidden||!jn(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)},ki.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?fm(e,i,t+"Ref"):new Error(`${sn(e)}#${t} Ref not specified`)},ki.prototype._getSource=function(e){return this._getConnectedElement(e,"source")},ki.prototype._getTarget=function(e){return this._getConnectedElement(e,"target")},ki.prototype._getElement=function(e){return this._elementRegistry.get(e.id)};function US(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 YS(e){return v(e,"bpmn:Group")}const dm={__depends__:[VS,{__depends__:[oa],bpmnImporter:["type",ki]}]};function aa(e){return{x:e.x+e.width/2,y:e.y+e.height/2}}function ii(e,t){return{x:e.x-t.x,y:e.y-t.y}}function ml(e){return Math.log(e)/Math.log(10)}var qS=1e3;function X(e){this._eventBus=e}X.$inject=["eventBus"];function KS(e,t){return function(n){return e.call(t||null,n.context,n.command,n)}}X.prototype.on=function(e,t,n,i,r,o){if((Wt(t)||we(t))&&(o=r,r=i,i=n,n=t,t=null),Wt(n)&&(o=r,r=i,i=n,n=qS),Gt(r)&&(o=r,r=!1),!Wt(i))throw new Error("handlerFn must be a function");_e(e)||(e=[e]);var a=this._eventBus;M(e,function(s){var c=["commandStack",s,t].filter(function(u){return u}).join(".");a.on(c,n,r?KS(i,o):i,o)})},X.prototype.canExecute=Di("canExecute"),X.prototype.preExecute=Di("preExecute"),X.prototype.preExecuted=Di("preExecuted"),X.prototype.execute=Di("execute"),X.prototype.executed=Di("executed"),X.prototype.postExecute=Di("postExecute"),X.prototype.postExecuted=Di("postExecuted"),X.prototype.revert=Di("revert"),X.prototype.reverted=Di("reverted");function Di(e){return function(n,i,r,o,a){(Wt(n)||we(n))&&(a=o,o=r,r=i,i=n,n=null),this.on(n,e,i,r,o,a)}}var gl=["top","bottom","left","right"],Is=10;function yl(e,t){X.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(Ms(r)&&!it(r)){var o=QS(r);o&&i(r,o)}}function i(r,o){var a=be(r),s=r.label,c=be(s);if(s.parent){var u=ye(r),l;switch(o){case"top":l={x:a.x,y:u.top-Is-s.height/2};break;case"left":l={x:u.left-Is-s.width/2,y:a.y};break;case"bottom":l={x:a.x,y:u.bottom+Is+s.height/2};break;case"right":l={x:u.right+Is+s.width/2,y:a.y};break}var p=ii(l,c);t.moveShape(s,p)}}}ie(yl,X),yl.$inject=["eventBus","modeling"];function XS(e){var t=e.host,n=be(e),i=Zt(n,t),r;i.indexOf("-")>=0?r=i.split("-"):r=[i];var o=gl.filter(function(a){return r.indexOf(a)===-1});return o}function ZS(e){var t=be(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 hm(t,i)});return n}function QS(e){var t=be(e.label),n=be(e),i=hm(n,t);if(JS(i)){var r=ZS(e);if(e.host){var o=XS(e);r=r.concat(o)}var a=gl.filter(function(s){return r.indexOf(s)===-1});return a.indexOf(i)!==-1?Zt(e.label,e)!=="intersect"?void 0:i:a[0]}}function hm(e,t){return Zt(t,e,5)}function JS(e){return gl.indexOf(e)!==-1}function vl(e){X.call(this,e),this.preExecute("shape.append",function(t){var n=t.source,i=t.shape;t.position||(v(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)}ie(vl,X),vl.$inject=["eventBus"];var eR=1500;function _l(e,t,n){e.invoke(X,this),this.preExecute("elements.delete",eR,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=Oe(r,u=>v(u,"bpmn:Participant")||v(u,"bpmn:SubProcess"));if(!o.length)return[];var a=n.getRootElement(),s=new Set(a.children.filter(u=>v(u,"bpmn:Artifact"))),c=new Set;return M(o,u=>{const l=new Set(Zr(ao(Array.from(s),At(u))));c=c.union(l),s=s.difference(l)}),Array.from(c)}}ie(_l,X),_l.$inject=["injector","eventBus","canvas"];function bl(e,t){e.invoke(X,this),this.postExecute("shape.move",function(n){var i=n.newParent,r=n.shape,o=Oe(r.incoming.concat(r.outgoing),function(a){return v(a,"bpmn:Association")});M(o,function(a){t.moveConnection(a,{x:0,y:0},i)})},!0)}ie(bl,X),bl.$inject=["injector","modeling"];function ho(e,t){for(wn(t)&&(t=[t]);e=e.parent;)if(De(e,t))return e;return null}function mm(e,t){var n=ho(e,"bpmn:Process");if(n)return!0;var i=["bpmn:Participant","bpmn:Lane"];if(n=ho(e,i),n)return Yt(n);if(De(e,i))return Yt(e);var r;for(r=Z(e);r&&!v(r,"bpmn:Process");r=r.$parent);if(!t)return!0;var o=t.find(function(a){var s=Z(a);return s&&s.get("processRef")===r});return o?Yt(o):!0}var gm=500;function Ns(e,t){t.invoke(X,this),this._bpmnReplace=e;var n=this;this.postExecuted("elements.create",gm,function(i){var r=i.elements;r=r.filter(function(o){var a=o.host;return ym(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",gm,function(i){var r=i.shapes,o=i.newHost;if(r.length===1){var a=r[0];ym(a,o)&&(i.shapes=[n._replaceShape(a,o)])}},!0)}Ns.$inject=["bpmnReplace","injector"],ie(Ns,X),Ns.prototype._replaceShape=function(e,t){var n=tR(e),i={type:"bpmn:BoundaryEvent",host:t};return n&&(i.eventDefinitionType=n.$type),this._bpmnReplace.replaceElement(e,i,{layoutConnection:!1})};function tR(e){var t=Z(e),n=t.eventDefinitions;return n&&n[0]}function ym(e,t){return!Me(e)&&De(e,["bpmn:IntermediateThrowEvent","bpmn:IntermediateCatchEvent"])&&!!t}function xl(e,t){X.call(this,e);function n(i){return Oe(i.attachers,function(r){return v(r,"bpmn:BoundaryEvent")})}this.postExecute("connection.create",function(i){var r=i.context.source,o=i.context.target,a=n(o);v(r,"bpmn:EventBasedGateway")&&v(o,"bpmn:ReceiveTask")&&a.length>0&&t.removeElements(a)}),this.postExecute("connection.reconnect",function(i){var r=i.context.oldSource,o=i.context.newSource;v(r,"bpmn:Gateway")&&v(o,"bpmn:EventBasedGateway")&&M(o.outgoing,function(a){var s=a.target,c=n(s);v(s,"bpmn:ReceiveTask")&&c.length>0&&t.removeElements(c)})})}xl.$inject=["eventBus","modeling"],ie(xl,X);function vm(e){return e.create("bpmn:Category")}function nR(e){return e.create("bpmn:CategoryValue")}function _m(e,t){var n=t.get("categoryValueRef");return n||(n=t.categoryValueRef=nR(e)),n.$parent||(n.$parent=vm(e)),n}function iR(e,t,n){return St(t.get("categoryValue"),e),e.$parent=t,St(n.get("rootElements"),t),t.$parent=n,e}function rR(e){var t=e.$parent;return t&&(wt(t.get("categoryValue"),e),e.$parent=null),e}function oR(e){var t=e.$parent;return t&&(wt(t.get("rootElements"),e),e.$parent=null),e}var aR=500;function wl(e,t,n){n.invoke(X,this);function i(c){return t.filter(function(u){return v(u,"bpmn:Group")&&!u.labelTarget}).map(Z).filter(function(u){return u!==c})}function r(c,u){return i(u).some(function(l){return l.get("categoryValueRef")===c})}function o(c,u){return i(u).some(function(l){var p=l.get("categoryValueRef");return p&&p.$parent===c})}function a(c,u){c&&u&&iR(c,u,e.getDefinitions())}function s(c,u,l){u&&!o(u,l)&&oR(u),c&&!r(c,l)&&rR(c)}this.executed(["shape.create","label.create"],function(c){var u=c.labelTarget||c.shape;!v(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;!v(u,"bpmn:Group")||u.labelTarget||s(c.categoryValue,c.category,Z(u))},!0),this.executed(["shape.move","shape.resize"],aR,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,Z(u))},!0),this.executed("group.updateRefs",function(c){bm(c).forEach(function(u){a(u.categoryValue,u.category)})},!0),this.reverted("group.updateRefs",function(c){bm(c).forEach(function(u){s(u.categoryValue,u.category,Z(u.groupShape))})},!0),this.executed("shape.delete",function(c){var u=c.shape;!v(u,"bpmn:Group")||u.labelTarget||s(c.categoryValue,c.category,Z(u))},!0),this.reverted("shape.delete",function(c){var u=c.shape;!v(u,"bpmn:Group")||u.labelTarget||a(c.categoryValue,c.category)},!0)}wl.$inject=["bpmnjs","elementRegistry","injector"],ie(wl,X);function bm(e){var t;return((t=e.updates)==null?void 0:t.groups)||[]}function El(e,t,n){X.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 R=g.source,w=g.target;mo(R)&&sa(w)&&l(w)}function r(g){const R=g.connection,w=g.source,b=g.target;mo(w)&&Bs(b)&&(u(b),f(w,[R]))}function o(g){const R=g.newTarget,w=g.oldSource,b=g.oldTarget;if(b!==R){const x=w;sa(b)&&l(b),mo(x)&&Bs(R)&&u(R)}}function a(g){const{element:R}=g;sa(R)?(p(R),d(R)):Bs(R)&&h(R)}function s(g){const{newData:R,oldShape:w}=g;if(mo(g.oldShape)&&R.eventDefinitionType!=="bpmn:CompensateEventDefinition"||R.type!=="bpmn:BoundaryEvent"){const b=w.outgoing.find(({target:x})=>sa(x));b&&b.target&&(g._connectionTarget=b.target)}else if(!mo(g.oldShape)&&R.eventDefinitionType==="bpmn:CompensateEventDefinition"&&R.type==="bpmn:BoundaryEvent"){const b=w.outgoing.find(({target:x})=>Bs(x));b&&b.target&&(g._connectionTarget=b.target),m(w)}}function c(g){const{_connectionTarget:R,newShape:w}=g;R&&t.connect(w,R)}function u(g){t.updateProperties(g,{isForCompensation:!0})}function l(g){t.updateProperties(g,{isForCompensation:void 0})}function p(g){for(const R of g.incoming)n.canConnect(R.source,g)||t.removeConnection(R);for(const R of g.outgoing)n.canConnect(g,R.target)||t.removeConnection(R)}function f(g,R){g.outgoing.filter(x=>v(x,"bpmn:Association")).filter(x=>sa(x.target)&&!R.includes(x)).forEach(x=>t.removeConnection(x))}function d(g){const R=g.attachers.slice();R.length&&t.removeElements(R)}function h(g){const R=g.incoming.filter(w=>mo(w.source));t.removeElements(R)}function m(g){const R=g.outgoing.filter(w=>v(w,"bpmn:SequenceFlow"));t.removeElements(R)}}ie(El,X),El.$inject=["eventBus","modeling","bpmnRules"];function sa(e){const t=Z(e);return t&&t.get("isForCompensation")}function mo(e){return e&&v(e,"bpmn:BoundaryEvent")&&lo(e,"bpmn:CompensateEventDefinition")}function Bs(e){return e&&v(e,"bpmn:Activity")&&!cn(e)}function Sl(e){e.invoke(X,this),this.preExecute("shape.create",1500,function(t){var n=t.context,i=n.parent,r=n.shape;v(i,"bpmn:Lane")&&!v(r,"bpmn:Lane")&&(n.parent=ho(i,"bpmn:Participant"))})}Sl.$inject=["injector"],ie(Sl,X);function Rl(e,t){X.call(this,e),this.preExecute("shape.create",function(n){var a;var i=n.context,r=i.shape;if(v(r,"bpmn:DataObjectReference")&&r.type!=="label"){var o=t.create("bpmn:DataObject");o.isCollection=((a=r.businessObject.dataObjectRef)==null?void 0:a.isCollection)||!1,r.businessObject.dataObjectRef=o}})}Rl.$inject=["eventBus","bpmnFactory"],ie(Rl,X);var Cl=20,Pl=20,xm=30,$s=2e3;function Al(e,t,n){X.call(this,t),t.on(["create.start","shape.move.start"],$s,function(r){var o=r.context,a=o.shape,s=e.getRootElement();if(!(!v(a,"bpmn:Participant")||!v(s,"bpmn:Process")||!s.children.length)){var c=s.children.filter(function(p){return!v(p,"bpmn:Group")&&!Me(p)&&!it(p)});if(c.length){var u=At(c),l=sR(a,u);O(a,l),o.createConstraints=cR(a,u)}}}),t.on("create.start",$s,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}v(a,"bpmn:Participant")&&v(s,"bpmn:Process")&&(t.on("element.hover",$s,u),t.once("create.cleanup",function(){t.off("element.hover",u)}))});function i(){var r=e.getRootElement();return v(r,"bpmn:Collaboration")?r:n.makeCollaboration()}this.preExecute("elements.create",$s,function(r){var o=r.elements,a=r.parent,s=uR(o),c;s&&v(a,"bpmn:Process")&&(r.parent=i(),c=r.hints=r.hints||{},c.participant=s,c.process=a,c.processRef=Z(s).get("processRef"))},!0),this.preExecute("shape.create",function(r){var o=r.parent,a=r.shape;v(a,"bpmn:Participant")&&v(o,"bpmn:Process")&&(r.parent=i(),r.process=o,r.processRef=Z(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)&&Z(s).set("processRef",Z(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)&&Z(c).set("processRef",s)},!0),this.postExecute("shape.create",function(r){var o=r.hints||{},a=r.process||r.hints.process,s=r.shape,c=o.participant;if(a){var u=a.children.slice();c?s===c&&n.moveElements(u,{x:0,y:0},c):n.moveElements(u,{x:0,y:0},s)}},!0)}Al.$inject=["canvas","eventBus","modeling"],ie(Al,X);function sR(e,t){t={width:t.width+Cl*2+xm,height:t.height+Pl*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 cR(e,t){return t=ye(t),{bottom:t.top+e.height/2-Pl,left:t.right-e.width/2+Cl,top:t.bottom-e.height/2+Pl,right:t.left+e.width/2-Cl-xm}}function uR(e){return st(e,function(t){return v(t,"bpmn:Participant")})}var wm="__targetRef_placeholder";function Tl(e,t){X.call(this,e),this.executed(["connection.create","connection.delete","connection.move","connection.reconnect"],Em(o)),this.reverted(["connection.create","connection.delete","connection.move","connection.reconnect"],Em(o));function n(a,s,c){var u=a.get("dataInputAssociations");return st(u,function(l){return l!==c&&l.targetRef===s})}function i(a,s){var c=a.get("properties"),u=st(c,function(l){return l.name===wm});return!u&&s&&(u=t.create("bpmn:Property",{name:wm}),St(c,u)),u}function r(a,s){var c=i(a);c&&(n(a,c,s)||wt(a.get("properties"),c))}function o(a){var s=a.context,c=s.connection,u=c.businessObject,l=c.target,p=l&&l.businessObject,f=s.newTarget,d=f&&f.businessObject,h=s.oldTarget||s.target,m=h&&h.businessObject,g=c.businessObject,R;m&&m!==p&&r(m,u),d&&d!==p&&r(d,u),p?(R=i(p,!0),g.targetRef=R):g.targetRef=null}}Tl.$inject=["eventBus","bpmnFactory"],ie(Tl,X);function Em(e){return function(t){var n=t.context,i=n.connection;if(v(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 Ml(e,t,n,i){X.call(this,i),t.registerHandler("dataStore.updateContainment",js);function r(){return n.filter(function(s){return v(s,"bpmn:Participant")&&Z(s).processRef})[0]}function o(s){return s.children.filter(function(c){return v(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:Ve(s),newSemanticParent:l.processRef||l,newDiParent:Ve(c)})}}this.preExecute("shape.create",function(s){var c=s.context,u=c.shape;v(u,"bpmn:DataStoreReference")&&u.type!=="label"&&(c.hints||(c.hints={}),c.hints.autoResize=!1)}),this.preExecute("elements.move",function(s){var c=s.context,u=c.shapes,l=u.filter(function(p){return v(p,"bpmn:DataStoreReference")});l.length&&(c.hints||(c.hints={}),c.hints.autoResize=u.filter(function(p){return!v(p,"bpmn:DataStoreReference")}))}),this.postExecute("shape.create",function(s){var c=s.context,u=c.shape,l=u.parent;v(u,"bpmn:DataStoreReference")&&u.type!=="label"&&v(l,"bpmn:Collaboration")&&a(u)}),this.postExecute("shape.move",function(s){var c=s.context,u=c.shape,l=c.oldParent,p=u.parent;if(!v(l,"bpmn:Collaboration")&&v(u,"bpmn:DataStoreReference")&&u.type!=="label"&&v(p,"bpmn:Collaboration")){var f=v(l,"bpmn:Participant")?l:pR(l,"bpmn:Participant");a(u,f)}}),this.postExecute("shape.delete",function(s){var c=s.context,u=c.shape,l=e.getRootElement();De(u,["bpmn:Participant","bpmn:SubProcess"])&&v(l,"bpmn:Collaboration")&&o(l).filter(function(p){return lR(p,u)}).forEach(function(p){a(p)})}),this.postExecute("canvas.updateRoot",function(s){var c=s.context,u=c.oldRoot,l=c.newRoot,p=o(u);p.forEach(function(f){v(l,"bpmn:Process")&&a(f,l)})})}Ml.$inject=["canvas","commandStack","elementRegistry","eventBus"],ie(Ml,X);function lR(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 pR(e,t){for(;e.parent;){if(v(e.parent,t))return e.parent;e=e.parent}}var Fs=Math.max,Hs=Math.min,fR=20;function Sm(e,t){return{top:e.top-t.top,right:e.right-t.right,bottom:e.bottom-t.bottom,left:e.left-t.left}}function dR(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 hR(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 zs(e,t,n){var i=t[e],r=n.min&&n.min[e],o=n.max&&n.max[e];return we(r)&&(i=(/top|left/.test(e)?Hs:Fs)(i,r)),we(o)&&(i=(/top|left/.test(e)?Fs:Hs)(i,o)),i}function mR(e,t){if(!t)return e;var n=ye(e);return Ss({top:zs("top",n,t),right:zs("right",n,t),bottom:zs("bottom",n,t),left:zs("left",n,t)})}function gR(e,t,n,i){var r=ye(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?ye(i):o,s={top:Hs(o.top,a.top),left:Hs(o.left,a.left),bottom:Fs(o.bottom,a.bottom),right:Fs(o.right,a.right)};return Ss(s)}function ca(e,t){return typeof e<"u"?e:fR}function yR(e,t){var n,i,r,o;return typeof t=="object"?(n=ca(t.left),i=ca(t.right),r=ca(t.top),o=ca(t.bottom)):n=i=r=o=ca(t),{x:e.x-n,y:e.y-r,width:e.width+n+i,height:e.height+r+o}}function vR(e){return!(e.waypoints||e.type==="label")}function Rm(e,t){var n;if(e.length===void 0?n=Oe(e.children,vR):n=e,n.length)return yR(At(n),t)}var ir=Math.abs;function _R(e,t){return Sm(ye(t),ye(e))}var bR=["bpmn:Participant","bpmn:Process","bpmn:SubProcess"],Wn=30;function Vs(e,t){return t=t||[],e.children.filter(function(n){v(n,"bpmn:Lane")&&(Vs(n,t),t.push(n))}),t}function rr(e){return e.children.filter(function(t){return v(t,"bpmn:Lane")})}function Un(e){return ho(e,bR)||e}function xR(e,t){var n=Un(e),i=v(n,"bpmn:Process")?[]:[n],r=Vs(n,i),o=ye(e),a=ye(t),s=_R(e,t),c=[],u=Yt(e);return r.forEach(function(l){if(l!==e){var p=u?0:s.top,f=u?s.right:0,d=u?0:s.bottom,h=u?s.left:0,m=ye(l);s.top&&(ir(m.bottom-o.top)<10&&(d=a.top-m.bottom),ir(m.top-o.top)<5&&(p=a.top-m.top)),s.left&&(ir(m.right-o.left)<10&&(f=a.left-m.right),ir(m.left-o.left)<5&&(h=a.left-m.left)),s.bottom&&(ir(m.top-o.bottom)<10&&(p=a.bottom-m.top),ir(m.bottom-o.bottom)<5&&(d=a.bottom-m.bottom)),s.right&&(ir(m.left-o.right)<10&&(h=a.right-m.left),ir(m.right-o.right)<5&&(f=a.right-m.right)),(p||f||d||h)&&c.push({shape:l,newBounds:hR(l,{top:p,right:f,bottom:d,left:h})})}}),c}var wR=500;function kl(e,t){X.call(this,e);function n(i,r){var o=Yt(i),a=rr(r),s=[],c=[],u=[],l=[];if(Or(a,function(g){return o?g.y>i.y?c.push(g):s.push(g):g.x>i.x?l.push(g):u.push(g),g.children}),!!a.length){var p;o?c.length&&s.length?p=i.height/2:p=i.height:l.length&&u.length?p=i.width/2:p=i.width;var f,d,h,m;s.length&&(f=t.calculateAdjustments(s,"y",p,i.y-10),t.makeSpace(f.movingShapes,f.resizingShapes,{x:0,y:p},"s")),c.length&&(d=t.calculateAdjustments(c,"y",-p,i.y+i.height+10),t.makeSpace(d.movingShapes,d.resizingShapes,{x:0,y:-p},"n")),u.length&&(h=t.calculateAdjustments(u,"x",p,i.x-10),t.makeSpace(h.movingShapes,h.resizingShapes,{x:p,y:0},"e")),l.length&&(m=t.calculateAdjustments(l,"x",-p,i.x+i.width+10),t.makeSpace(m.movingShapes,m.resizingShapes,{x:-p,y:0},"w"))}}this.postExecuted("shape.delete",wR,function(i){var r=i.context,o=r.hints,a=r.shape,s=r.oldParent;v(a,"bpmn:Lane")&&(o&&o.nested||n(a,s))})}kl.$inject=["eventBus","spaceTool"],ie(kl,X);var Cm=500;function Gs(e,t){t.invoke(X,this),this._bpmnReplace=e;var n=this;this.postExecuted("elements.create",Cm,function(i){var r=i.elements;r.filter(function(o){var a=o.host;return Pm(o,a)}).map(function(o){return r.indexOf(o)}).forEach(function(o){i.elements[o]=n._replaceShape(r[o])})},!0),this.preExecute("elements.move",Cm,function(i){var r=i.shapes,o=i.newHost;r.forEach(function(a,s){var c=a.host;Pm(a,SR(r,c)?c:o)&&(r[s]=n._replaceShape(a))})},!0)}Gs.$inject=["bpmnReplace","injector"],ie(Gs,X),Gs.prototype._replaceShape=function(e){var t=ER(e),n;return t?n={type:"bpmn:IntermediateCatchEvent",eventDefinitionType:t.$type}:n={type:"bpmn:IntermediateThrowEvent"},this._bpmnReplace.replaceElement(e,n,{layoutConnection:!1})};function ER(e){var t=Z(e),n=t.eventDefinitions;return n&&n[0]}function Pm(e,t){return!Me(e)&&v(e,"bpmn:BoundaryEvent")&&!t}function SR(e,t){return e.indexOf(t)!==-1}var Ws=Math.round,RR=Math.max;function CR(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 PR(e){var t=[];return e.forEach(function(n,i){t.push([i===0?"M":"L",n.x,n.y])}),t}var Am=10;function AR(e,t){var n,i;for(n=0;i=e[n];n++)if(Qo(i,t)<=Am)return{point:e[n],bendpoint:!0,index:n};return null}function TR(e,t){var n=Oh(CR(t,Am),PR(e)),i=n[0],r=n[n.length-1],o;return i?i!==r?i.segment2!==r.segment2?(o=RR(i.segment2,r.segment2)-1,{point:e[o],bendpoint:!0,index:o}):{point:{x:Ws(i.x+r.x)/2,y:Ws(i.y+r.y)/2},index:i.segment2}:{point:{x:Ws(i.x),y:Ws(i.y)},index:i.segment2}:null}function Dl(e,t){return AR(e,t)||TR(e,t)}function Ol(e,t,n){X.call(this,e);function i(r,o,a){var s=o.waypoints,c,u,l,p,f,d,h,m=r.outgoing.slice(),g=r.incoming.slice(),R;we(a.width)?R=be(a):R=a;var w=Dl(s,R);if(w){if(c=s.slice(0,w.index),u=s.slice(w.index+(w.bendpoint?1:0)),!c.length||!u.length)return;l=w.bendpoint?s[w.index]:R,(c.length===1||!Tm(r,c[c.length-1]))&&c.push(Mm(l)),(u.length===1||!Tm(r,u[0]))&&u.unshift(Mm(l))}p=o.source,f=o.target,t.canConnect(p,r,o)&&(n.reconnectEnd(o,r,c||R),d=o),t.canConnect(r,f,o)&&(d?h=n.connect(r,f,{type:o.type,waypoints:u}):(n.reconnectStart(o,r,u||R),h=o));var b=[].concat(d&&Oe(g,function(x){return x.source===d.source})||[],h&&Oe(m,function(x){return x.target===h.target})||[]);b.length&&n.removeElements(b)}this.preExecute("elements.move",function(r){var o=r.newParent,a=r.shapes,s=r.delta,c=a[0];if(!(!c||!o)){o&&o.waypoints&&(r.newParent=o=o.parent);var u=be(c),l={x:u.x+s.x,y:u.y+s.y},p=st(o.children,function(f){var d=t.canInsert(a,f);return d&&Dl(f.waypoints,l)});p&&(r.targetFlow=p,r.position=l)}},!0),this.postExecuted("elements.move",function(r){var o=r.shapes,a=r.targetFlow,s=r.position;a&&i(o[0],a,s)},!0),this.preExecute("shape.create",function(r){var o=r.parent,a=r.shape;t.canInsert(a,o)&&(r.targetFlow=o,r.parent=o.parent)},!0),this.postExecuted("shape.create",function(r){var o=r.shape,a=r.targetFlow,s=r.position;a&&i(o,a,s)},!0)}ie(Ol,X),Ol.$inject=["eventBus","bpmnRules","modeling"];function Tm(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 Mm(e){return O({},e)}function Ll(e,t){X.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)&&go(r)){var c=[];v(o,"bpmn:EventBasedGateway")?c=a.incoming.filter(u=>u!==r&&go(u)):c=a.incoming.filter(u=>u!==r&&go(u)&&v(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(v(r,"bpmn:EventBasedGateway")){var o=r.outgoing.filter(go).reduce(function(a,s){return a.includes(s.target)?a:a.concat(s.target)},[]);o.forEach(function(a){a.incoming.filter(go).forEach(function(s){const c=a.incoming.filter(go).filter(function(u){return u.source===r});(s.source!==r||c.length>1)&&t.removeConnection(s)})})}})}Ll.$inject=["eventBus","modeling"],ie(Ll,X);function go(e){return v(e,"bpmn:SequenceFlow")}var Us=1500,km=2e3;function Dm(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"],Us,function(i){var r=i.context,o=r.shape||i.shape,a=i.hover;v(a,"bpmn:Lane")&&!De(o,["bpmn:Lane","bpmn:Participant"])&&(i.hover=Un(a),i.hoverGfx=e.getGraphics(i.hover));var s=n.getRootElement();a&&a!==s&&(o.labelTarget||De(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"],Us,function(i){var r=i.hover;v(r,"bpmn:Lane")&&(i.hover=Un(r)||r,i.hoverGfx=e.getGraphics(i.hover))}),t.on(["bendpoint.move.hover"],Us,function(i){var r=i.context,o=i.hover,a=r.type;v(o,"bpmn:Lane")&&/reconnect/.test(a)&&(i.hover=Un(o)||o,i.hoverGfx=e.getGraphics(i.hover))}),t.on(["connect.start"],Us,function(i){var r=i.context,o=r.start;v(o,"bpmn:Lane")&&(r.start=Un(o)||o)}),t.on("shape.move.start",km,function(i){var r=i.shape;v(r,"bpmn:Lane")&&(i.shape=Un(r)||r)}),t.on("spaceTool.move",km,function(i){var r=i.hover;r&&v(r,"bpmn:Lane")&&(i.hover=Un(r))})}Dm.$inject=["elementRegistry","eventBus","canvas"];var Om=770;function Il(e,t,n,i){n.invoke(X,this);function r(s,c){var u=Z(s),l=c.categoryValue||u.categoryValueRef;l||(l=_m(e,u));var p=c.category||l.$parent||vm(e);u.categoryValueRef=l,l.$parent=p,c.categoryValue=l,c.category=p}function o(s,c){var u=Z(s),l=c.categoryValue||u.categoryValueRef,p=c.category||l&&l.$parent;l&&(c.categoryValue=l,c.category=p,u.categoryValueRef=null)}this.execute("label.create",function(s){var c=s.context,u=c.labelTarget;v(u,"bpmn:Group")&&r(u,c)}),this.revert("label.create",function(s){var c=s.context,u=c.labelTarget;v(u,"bpmn:Group")&&o(u,c)}),this.execute("shape.delete",function(s){var c=s.context,u=c.shape,l=Z(u);if(!(!v(u,"bpmn:Group")||u.labelTarget)){var p=c.categoryValue=l.categoryValueRef;p&&(c.category=p.$parent,l.categoryValueRef=null)}}),this.reverted("shape.delete",function(s){var c=s.context,u=c.shape;if(!(!v(u,"bpmn:Group")||u.labelTarget)){var l=c.category,p=c.categoryValue,f=Z(u);p&&(f.categoryValueRef=p,p.$parent=l)}}),this.execute("shape.create",function(s){var c=s.context,u=c.shape,l=c.hints||{};!v(u,"bpmn:Group")||u.labelTarget||l.createElementsBehavior===!1&&!Z(u).categoryValueRef&&!c.categoryValue||r(u,c)}),this.reverted("shape.create",function(s){var c=s.context,u=c.shape,l=c.hints||{};!v(u,"bpmn:Group")||u.labelTarget||l.createElementsBehavior===!1&&!Z(u).categoryValueRef&&!c.categoryValue||o(u,c)}),this.executed(["shape.move","shape.resize"],function(s){var c=s.context,u=c.shape;!v(u,"bpmn:Group")||u.labelTarget||Z(u).categoryValueRef||r(u,c)}),this.reverted(["shape.move","shape.resize"],function(s){var c=s.context,u=c.shape;!v(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",Om,function(s){var c=s.descriptor,u=s.element;if(!(!v(u,"bpmn:Group")||u.labelTarget)){var l=Z(u);if(l.categoryValueRef){var p=l.categoryValueRef;c.categoryValue=a(p,!0),p.$parent&&(c.category=a(p.$parent,!0))}}}),t.on("copyPaste.pasteElement",Om,function(s){var c=s.descriptor,u=c.businessObject,l=c.categoryValue,p=c.category;l&&(l=u.categoryValueRef=a(l)),p&&(l.$parent=a(p)),delete c.category,delete c.categoryValue})}Il.$inject=["bpmnFactory","eventBus","injector","moddleCopy"],ie(Il,X);function Nl(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 Lm(e){function t(i,r,o){var a={x:o.x,y:o.y-50},s={x:o.x-50,y:o.y},c=Nl(i,r,o,a),u=Nl(i,r,o,s),l;c&&u?Im(c,o)>Im(u,o)?l=u:l=c:l=c||u,i.original=l}function n(i){var r=i.waypoints;t(r[0],r[1],be(i.source)),t(r[r.length-1],r[r.length-2],be(i.target))}e.on("bpmnElement.added",function(i){var r=i.element;r.waypoints&&n(r)})}Lm.$inject=["eventBus"];function Im(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function Bl(e){X.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=Z(i),o=Ve(i);if(De(r,t)){var a=o.get("isHorizontal");a===void 0&&(a=!0),o.set("isHorizontal",a)}})}Bl.$inject=["eventBus"],ie(Bl,X);function Nm(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}function Bm(e){return Math.atan((e[1].y-e[0].y)/(e[1].x-e[0].x))}function MR(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 kR(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 $l(e,t){var n=t[0],i=t[1],r={x:i.x-n.x,y:i.y-n.y},o=kR([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 $m(e,t){var n=$l(e,t),i={x:n.x-e.x,y:n.y-e.y};return Nm(i)}function ua(e,t){return Nm({x:e.x-t.x,y:e.y-t.y})}var jm=Math.sqrt,Fm=Math.min,DR=Math.max,Hm=Math.abs;function zm(e){return Math.pow(e,2)}function la(e,t){return jm(zm(e.x-t.x)+zm(e.y-t.y))}function OR(e,t){var n=0,i,r,o,a,s,c,u,l,p,f,d;for(n=0;n<t.length-1;n++){if(i=t[n],r=t[n+1],Gm(i,r)?u=[i]:(o=la(e,i),a=la(e,r),c=Fm(o,a),u=LR(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:Gm(i,u[0])?n:n+1}),u.length===2&&(s=NR(u[0],u[1]),l={type:"segment",position:s,segmentIndex:n,relativeLocation:la(i,s)/la(i,r)}),p=la(l.position,e),(!d||f>p)&&(d=l,f=p)}return d}function LR(e,t,n,i){var r=t.x-e.x,o=t.y-e.y,a=n.x-e.x,s=n.y-e.y,c=r*r+o*o,u=r*a+o*s,l=a*a+s*s-i*i,p=u/c,f=l/c,d=p*p-f;if(d<0&&d>-1e-6&&(d=0),d<0)return[];var h=jm(d),m=-p+h,g=-p-h,R={x:e.x-r*m,y:e.y-o*m};if(d===0)return[R];var w={x:e.x-r*g,y:e.y-o*g};return[R,w].filter(function(b){return IR(b,e,t)})}function IR(e,t,n){return Vm(e.x,t.x,n.x)&&Vm(e.y,t.y,n.y)}function Vm(e,t,n){return e>=Fm(t,n)-Ys&&e<=DR(t,n)+Ys}function NR(e,t){return{x:(e.x+t.x)/2,y:(e.y+t.y)/2}}var Ys=.1;function Gm(e,t){return Hm(e.x-t.x)<=Ys&&Hm(e.y-t.y)<=Ys}function BR(e,t,n,i){var r=n.segmentIndex,o=t.length-e.length;if(i.segmentMove){var a=i.segmentMove.segmentStartIndex,s=i.segmentMove.newSegmentStartIndex;return r===a?s:r>=s?r+o<s?s:r+o:r}if(i.bendpointMove){var c=i.bendpointMove.insert,u=i.bendpointMove.bendpointIndex,l;if(o===0)return r;if(r>=u&&(l=c?r+1:r-1),r<u&&(l=r,c&&n.type!=="bendpoint"&&u-1===r)){var p=Um(t,u);p<n.relativeLocation&&l++}return l}return o===0?r:i.connectionStart&&r===0?0:i.connectionEnd&&r===e.length-2?t.length-2:Math.floor((t.length-2)/2)}function Wm(e,t,n,i){var r=0,o=0,a={point:e,delta:{x:0,y:0}},s=OR(e,n),c=s.segmentIndex,u=BR(n,t,s,i);if(u<0||u>t.length-2||u===null)return a;var l=Ym(n,c),p=Ym(t,u),f=s.position,d=jR(l,f),h=$R(l,p);if(s.type==="bendpoint"){var m=t.length-n.length,g=s.bendpointIndex,R=n[g];if(t.indexOf(R)!==-1)return a;if(m===0){var w=t[g];return r=w.x-s.position.x,o=w.y-s.position.y,{delta:{x:r,y:o},point:{x:e.x+r,y:e.y+o}}}m<0&&g!==0&&g<n.length-1&&(d=Um(n,g))}var b={x:(p[1].x-p[0].x)*d+p[0].x,y:(p[1].y-p[0].y)*d+p[0].y},x=MR({x:e.x-f.x,y:e.y-f.y},h);return r=b.x+x.x-e.x,o=b.y+x.y-e.y,{point:Ti(b),delta:Ti({x:r,y:o})}}function Um(e,t){var n=ua(e[t-1],e[t]),i=ua(e[t],e[t+1]),r=n/(n+i);return r}function $R(e,t){var n=Bm(e),i=Bm(t);return i-n}function Ym(e,t){return[e[t],e[t+1]]}function jR(e,t){var n=ua(e[0],e[1]),i=ua(e[0],t);return n===0?0:i/n}function FR(e,t,n,i){var r=be(e);return Wm(r,t,n,i).delta}function pa(e,t,n){var i=aa(t),r=aa(n),o=ii(e,i),a={x:o.x*(n.width/t.width),y:o.y*(n.height/t.height)};return Ti({x:r.x+a.x,y:r.y+a.y})}function qm(e,t,n){var i=aa(e),r=aa(t),o=aa(n),a=ii(e,i),s=ii(i,r),c=HR(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 Ti({x:l.x+a.x-e.x,y:l.y+a.y-e.y})}function HR(e,t,n){var i=ye(t),r=ye(n);if(zR(i,r))return null;var o=Zt(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=Zt(n,s),c!==o?null:a}function zR(e,t){return VR(e,t)||GR(e,t)}function VR(e,t){return e.right!==t.right&&e.left!==t.left}function GR(e,t){return e.top!==t.top&&e.bottom!==t.bottom}var Km="name",Xm="text";function jl(e,t,n,i){X.call(this,e),this.postExecute("element.updateProperties",r),this.postExecute("element.updateModdleProperties",a=>{Z(a.context.element)===a.context.moddleElement&&r(a)});function r(a){var s=a.context,c=s.element,u=s.properties;if(Km in u&&t.updateLabel(c,u[Km]),Xm in u&&v(c,"bpmn:TextAnnotation")){var l=i.getTextAnnotationBounds({x:c.x,y:c.y,width:c.width,height:c.height},u[Xm]||"");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;Me(u)||!nr(u)||jn(u)&&t.updateLabel(u,jn(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=O({},s.hints),p=s.newWaypoints||c.waypoints,f=s.oldWaypoints;return typeof l.startChanged>"u"&&(l.startChanged=!!l.connectionStart),typeof l.endChanged>"u"&&(l.endChanged=!!l.connectionEnd),FR(u,p,f,l)}this.postExecute(["connection.layout","connection.updateWaypoints"],function(a){var s=a.context,c=s.hints||{};if(c.labelBehavior!==!1){var u=s.connection,l=u.label,p;!l||!l.parent||(p=o(a),t.moveShape(l,p))}}),this.postExecute(["shape.replace"],function(a){var s=a.context,c=s.newShape,u=s.oldShape,l=Z(c);l&&nr(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(!(!Me(c)||u.autoResize)){var l=s.newBounds,p=i.getDimensions(jn(c)||"",{box:l,style:i.getExternalStyle()}),f=Math.ceil(p.height),d=l.y!==c.y,h=c.y+c.height;s.newBounds={width:l.width,height:f,x:l.x,y:d?h-f:l.y}}}),this.postExecute("shape.resize",function(a){var s=a.context,c=s.shape,u=s.newBounds,l=s.oldBounds;if(Ms(c)){var p=c.label,f=be(p),d=YR(l),h=UR(f,d),m=WR(h,l,u);t.moveShape(p,m)}})}ie(jl,X),jl.$inject=["eventBus","modeling","bpmnFactory","textRenderer"];function WR(e,t,n){var i=pa(e,t,n);return Ti(ii(i,e))}function UR(e,t){if(t.length){var n=qR(e,t);return $l(e,n)}}function YR(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 qR(e,t){var n=t.map(function(r){return{line:r,distance:$m(e,r)}}),i=oi(n,"distance");return i[0].line}function KR(e,t,n,i){return Wm(e,t,n,i).point}function Fl(e,t){X.call(this,e);function n(i,r){var o=i.context,a=o.connection,s=O({},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),KR(r,c,u,s)}this.postExecute(["connection.layout","connection.updateWaypoints"],function(i){var r=i.context,o=r.connection,a=o.outgoing,s=o.incoming;s.forEach(function(c){var u=c.waypoints[c.waypoints.length-1],l=n(i,u),p=[].concat(c.waypoints.slice(0,-1),[l]);t.updateWaypoints(c,p)}),a.forEach(function(c){var u=c.waypoints[0],l=n(i,u),p=[].concat([l],c.waypoints.slice(1));t.updateWaypoints(c,p)})}),this.postExecute(["connection.move"],function(i){var r=i.context,o=r.connection,a=o.outgoing,s=o.incoming,c=r.delta;s.forEach(function(u){var l=u.waypoints[u.waypoints.length-1],p={x:l.x+c.x,y:l.y+c.y},f=[].concat(u.waypoints.slice(0,-1),[p]);t.updateWaypoints(u,f)}),a.forEach(function(u){var l=u.waypoints[0],p={x:l.x+c.x,y:l.y+c.y},f=[].concat([p],u.waypoints.slice(1));t.updateWaypoints(u,f)})})}ie(Fl,X),Fl.$inject=["eventBus","modeling"];function qs(e,t,n){var i=Xs(e),r=Qm(i,t),o=i[0];return r.length?r[r.length-1]:pa(o.original||o,n,t)}function Ks(e,t,n){var i=Xs(e),r=Qm(i,t),o=i[i.length-1];return r.length?r[0]:pa(o.original||o,n,t)}function Hl(e,t,n){var i=Xs(e),r=Zm(t,n),o=i[0];return pa(o.original||o,r,t)}function zl(e,t,n){var i=Xs(e),r=Zm(t,n),o=i[i.length-1];return pa(o.original||o,r,t)}function Zm(e,t){return{x:e.x-t.x,y:e.y-t.y,width:e.width,height:e.height}}function Xs(e){var t=e.waypoints;if(!t.length)throw new Error("connection#"+e.id+": no waypoints");return t}function Qm(e,t){var n=rn(e,ZR);return Oe(n,function(i){return XR(i,t)})}function XR(e,t){return Zt(t,e,1)==="intersect"}function ZR(e){return e.original||e}function Vl(e,t){X.call(this,e),this.postExecute("shape.replace",function(n){var i=n.oldShape,r=n.newShape;if(QR(i,r)){var o=JR(i);o.incoming.forEach(function(a){var s=Ks(a,r,i);t.reconnectEnd(a,r,s)}),o.outgoing.forEach(function(a){var s=qs(a,r,i);t.reconnectStart(a,r,s)})}},!0)}Vl.$inject=["eventBus","modeling"],ie(Vl,X);function QR(e,t){return v(e,"bpmn:Participant")&&$e(e)&&v(t,"bpmn:Participant")&&!$e(t)}function JR(e){var t=Xo([e]),n=[],i=[];return t.forEach(function(r){r!==e&&(r.incoming.forEach(function(o){v(o,"bpmn:MessageFlow")&&n.push(o)}),r.outgoing.forEach(function(o){v(o,"bpmn:MessageFlow")&&i.push(o)}))},[]),{incoming:n,outgoing:i}}const eC=["bpmn:MessageEventDefinition","bpmn:TimerEventDefinition","bpmn:EscalationEventDefinition","bpmn:ConditionalEventDefinition","bpmn:SignalEventDefinition"];function Jm(e){const t=Z(e);if(!v(t,"bpmn:BoundaryEvent")&&!(v(t,"bpmn:StartEvent")&&cn(t.$parent)))return!1;const n=t.get("eventDefinitions");return!n||!n.length?!1:eC.some(i=>v(n[0],i))}function eg(e){return v(e,"bpmn:BoundaryEvent")?"cancelActivity":"isInterrupting"}function Gl(e,t){e.invoke(X,this),this.postExecuted("shape.replace",function(n){const i=n.context.oldShape,r=n.context.newShape,o=n.context.hints;if(!Jm(r))return;const a=eg(r);if(o.targetElement&&o.targetElement[a]!==void 0)return;const c=Z(i).get(a),u=Z(r).get(a);c!==u&&t.updateProperties(r,{[a]:c})})}Gl.$inject=["injector","modeling"],ie(Gl,X);function Wl(e,t){X.call(this,e),this.preExecute("shape.resize",function(n){var i=n.shape,r=Ve(i),o=r&&r.get("label"),a=o&&o.get("bounds");a&&t.updateModdleProperties(i,o,{bounds:void 0})},!0)}ie(Wl,X),Wl.$inject=["eventBus","modeling"];function Ul(e,t,n){X.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(!(!v(o,"bpmn:SequenceFlow")||!v(a,"bpmn:SequenceFlow"))&&t.canConnect(o.source,a.target,o)){var s=tC(o.waypoints,a.waypoints);n.reconnectEnd(o,a.target,s)}}})}ie(Ul,X),Ul.$inject=["eventBus","bpmnRules","modeling"];function yo(e){return e.original||e}function tC(e,t){var n=Nl(yo(e[e.length-2]),yo(e[e.length-1]),yo(t[1]),yo(t[0]));return n?[].concat(e.slice(0,e.length-1),[n],t.slice(1)):[yo(e[0]),yo(t[t.length-1])]}function Yl(e,t){X.call(this,e),this.preExecute("shape.delete",function(n){var i=n.shape,r=i.parent;v(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)}Yl.$inject=["eventBus","modeling"],ie(Yl,X);function ql(e,t,n,i){X.call(this,e);var r=i.get("dragging",!1);function o(c){var u=c.source,l=c.target,p=c.parent;if(p){var f,d;v(c,"bpmn:SequenceFlow")&&(n.canConnectSequenceFlow(u,l)||(d=!0),n.canConnectMessageFlow(u,l)&&(f="bpmn:MessageFlow")),v(c,"bpmn:MessageFlow")&&(n.canConnectMessageFlow(u,l)||(d=!0),n.canConnectSequenceFlow(u,l)&&(f="bpmn:SequenceFlow")),d&&t.removeConnection(c),f&&t.connect(u,l,{type:f,waypoints:c.waypoints.slice()})}}function a(c){var u=c.context,l=u.connection,p=u.newSource||l.source,f=u.newTarget||l.target,d,h;d=n.canConnect(p,f),!(!d||d.type===l.type)&&(h=t.connect(p,f,{type:d.type,associationDirection:d.associationDirection,waypoints:l.waypoints.slice()}),l.parent&&t.removeConnection(l),u.connection=h,r&&s(l,h))}function s(c,u){var l=r.context(),p=l&&l.payload.previousSelection,f;!p||!p.length||(f=p.indexOf(c),f!==-1&&p.splice(f,1,u))}this.postExecuted("elements.move",function(c){var u=c.closure,l=u.allConnections;M(l,o)},!0),this.preExecute("connection.reconnect",a),this.postExecuted("element.updateProperties",function(c){var u=c.context,l=u.properties,p=u.element,f=p.businessObject,d;l.default&&(d=st(p.outgoing,Jr({id:p.businessObject.default.id})),d&&t.updateProperties(d,{conditionExpression:void 0})),l.conditionExpression&&f.sourceRef.default===f&&t.updateProperties(p.source,{default:void 0})})}ie(ql,X),ql.$inject=["eventBus","modeling","bpmnRules","injector"];function Zs(e,t,n,i,r,o){i.invoke(X,this),this._bpmnReplace=e,this._elementRegistry=n,this._selection=o,this.postExecuted(["elements.create"],500,function(a){var s=a.context,c=s.parent,u=s.elements,l=Sn(u,function(p,f){var d=t.canReplace([f],f.host||f.parent||c);return d?p.concat(d.replacements):p},[]);l.length&&this._replaceElements(u,l)},this),this.postExecuted(["elements.move"],500,function(a){var s=a.context,c=s.newParent,u=s.newHost,l=[];M(s.closure.topLevel,function(f){cn(f)?l=l.concat(f.children):l=l.concat(f)}),l.length===1&&u&&(c=u);var p=t.canReplace(l,c);p&&this._replaceElements(l,p.replacements,u)},this),this.postExecute(["shape.replace"],1500,function(a){var s=a.context,c=s.oldShape,u=s.newShape,l=c.attachers,p;l&&l.length&&(p=t.canReplace(l,u),this._replaceElements(l,p.replacements))},this),this.postExecuted(["shape.replace"],1500,function(a){var s=a.context,c=s.oldShape,u=s.newShape;r.unclaimId(c.businessObject.id,c.businessObject),r.updateProperties(u,{id:c.id})})}ie(Zs,X),Zs.prototype._replaceElements=function(e,t){var n=this._elementRegistry,i=this._bpmnReplace,r=this._selection;M(t,function(o){var a={type:o.newElementType},s=n.get(o.oldElementId),c=e.indexOf(s);e[c]=i.replaceElement(s,a,{select:!1})}),t&&r.select(e)},Zs.$inject=["bpmnReplace","bpmnRules","elementRegistry","injector","modeling","selection"];var nC=1500,iC={width:140,height:120},Kl={width:300,height:60},Xl={width:60,height:300},Qs={width:300,height:150},Js={width:150,height:300},tg={width:140,height:120},ng={width:100,height:40};function ig(e){e.on("resize.start",nC,function(t){var n=t.context,i=n.shape,r=n.direction,o=n.balanced;(v(i,"bpmn:Lane")||v(i,"bpmn:Participant"))&&(n.resizeConstraints=cC(i,r,o)),v(i,"bpmn:SubProcess")&&$e(i)&&(n.minDimensions=tg),v(i,"bpmn:TextAnnotation")&&(n.minDimensions=ng)})}ig.$inject=["eventBus"];var or=Math.abs,rC=Math.min,oC=Math.max;function rg(e,t,n,i){var r=e[t];e[t]=r===void 0?n:i(n,r)}function vo(e,t,n){return rg(e,t,n,rC)}function _o(e,t,n){return rg(e,t,n,oC)}var aC={top:20,left:50,right:20,bottom:20},sC={top:50,left:20,right:20,bottom:20};function cC(e,t,n){var i=Un(e),r=!0,o=!0,a=Vs(i,[i]),s=ye(e),c={},u={},l=Yt(e),p=l?Kl:Xl;/n/.test(t)?u.top=s.bottom-p.height:/e/.test(t)?u.right=s.left+p.width:/s/.test(t)?u.bottom=s.top+p.height:/w/.test(t)&&(u.left=s.right-p.width),a.forEach(function(h){var m=ye(h);l?(m.top<s.top-10&&(r=!1),m.bottom>s.bottom+10&&(o=!1)):(m.left<s.left-10&&(r=!1),m.right>s.right+10&&(o=!1)),/n/.test(t)&&(n&&or(s.top-m.bottom)<10&&_o(c,"top",m.top+p.height),or(s.top-m.top)<5&&vo(u,"top",m.bottom-p.height)),/e/.test(t)&&(n&&or(s.right-m.left)<10&&vo(c,"right",m.right-p.width),or(s.right-m.right)<5&&_o(u,"right",m.left+p.width)),/s/.test(t)&&(n&&or(s.bottom-m.top)<10&&vo(c,"bottom",m.bottom-p.height),or(s.bottom-m.bottom)<5&&_o(u,"bottom",m.top+p.height)),/w/.test(t)&&(n&&or(s.left-m.right)<10&&_o(c,"left",m.left+p.width),or(s.left-m.left)<5&&vo(u,"left",m.right-p.width))});var f=i.children.filter(function(h){return!h.hidden&&!h.waypoints&&(v(h,"bpmn:FlowElement")||v(h,"bpmn:Artifact"))}),d=l?aC:sC;return f.forEach(function(h){var m=ye(h);/n/.test(t)&&(!l||r)&&vo(u,"top",m.top-d.top),/e/.test(t)&&(l||o)&&_o(u,"right",m.right+d.right),/s/.test(t)&&(!l||o)&&_o(u,"bottom",m.bottom+d.bottom),/w/.test(t)&&(l||r)&&vo(u,"left",m.left-d.left)}),{min:u,max:c}}function og(e){!e||typeof e.stopPropagation!="function"||e.stopPropagation()}function bo(e){return e.originalEvent||e.srcEvent}function Zl(e){og(e),og(bo(e))}function Br(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 ag(){return/mac/i.test(navigator.platform)}function sg(e,t){return(bo(e)||e).button===t}function ar(e){return sg(e,0)}function uC(e){return sg(e,1)}function fa(e){var t=bo(e)||e;return ar(e)?ag()?t.metaKey:t.ctrlKey:!1}function ec(e){var t=bo(e)||e;return ar(e)&&t.shiftKey}var cg=1001;function ug(e,t){e.on("resize.start",cg+500,function(n){var i=n.context,r=i.shape;(v(r,"bpmn:Lane")||v(r,"bpmn:Participant"))&&(i.balanced=!fa(n))}),e.on("resize.end",cg,function(n){var i=n.context,r=i.shape,o=i.canExecute,a=i.newBounds;if(v(r,"bpmn:Lane")||v(r,"bpmn:Participant"))return o&&(a=$h(a),t.resizeLane(r,a,i.balanced)),!1})}ug.$inject=["eventBus","modeling"];var lC=500;function Ql(e,t,n,i,r){n.invoke(X,this);function o(l){return De(l,["bpmn:ReceiveTask","bpmn:SendTask"])||pC(l,["bpmn:ErrorEventDefinition","bpmn:EscalationEventDefinition","bpmn:MessageEventDefinition","bpmn:SignalEventDefinition"])}function a(l){var p=e.getDefinitions(),f=p.get("rootElements");return!!st(f,Jr({id:l.id}))}function s(l){if(v(l,"bpmn:ErrorEventDefinition"))return"errorRef";if(v(l,"bpmn:EscalationEventDefinition"))return"escalationRef";if(v(l,"bpmn:MessageEventDefinition"))return"messageRef";if(v(l,"bpmn:SignalEventDefinition"))return"signalRef"}function c(l){if(De(l,["bpmn:ReceiveTask","bpmn:SendTask"]))return l.get("messageRef");var p=l.get("eventDefinitions"),f=p[0];return f.get(s(f))}function u(l,p){if(De(l,["bpmn:ReceiveTask","bpmn:SendTask"]))return l.set("messageRef",p);var f=l.get("eventDefinitions"),d=f[0];return d.set(s(d),p)}this.executed(["shape.create","element.updateProperties","element.updateModdleProperties"],function(l){var p=l.shape||l.element;if(o(p)){var f=Z(p),d=c(f),h;d&&!a(d)&&(h=e.getDefinitions().get("rootElements"),St(h,d),l.addedRootElement=d)}},!0),this.reverted(["shape.create","element.updateProperties","element.updateModdleProperties"],function(l){var p=l.addedRootElement;if(p){var f=e.getDefinitions().get("rootElements");wt(f,p)}},!0),t.on("copyPaste.copyElement",function(l){var p=l.descriptor,f=l.element;if(!(f.labelTarget||!o(f))){var d=Z(f),h=c(d);h&&(p.referencedRootElement=h)}}),t.on("copyPaste.pasteElement",lC,function(l){var p=l.descriptor,f=p.businessObject,d=p.referencedRootElement;d&&(a(d)||(d=i.copyElement(d,r.create(d.$type))),u(f,d),delete p.referencedRootElement)})}Ql.$inject=["bpmnjs","eventBus","injector","moddleCopy","bpmnFactory"],ie(Ql,X);function pC(e,t){return _e(t)||(t=[t]),Vi(t,function(n){return lo(e,n)})}var lg=Math.max;function pg(e){e.on("spaceTool.getMinDimensions",function(t){var n=t.shapes,i=t.axis,r=t.start,o={};return M(n,function(a){var s=a.id;v(a,"bpmn:Participant")&&(o[s]=dC(a,i,r)),v(a,"bpmn:Lane")&&(o[s]=Yt(a)?Kl:Xl),v(a,"bpmn:SubProcess")&&$e(a)&&(o[s]=tg),v(a,"bpmn:TextAnnotation")&&(o[s]=ng),v(a,"bpmn:Group")&&(o[s]=iC)}),o})}pg.$inject=["eventBus"];function fC(e){return e==="x"}function dC(e,t,n){var i=Yt(e);if(!gC(e))return i?Qs:Js;var r=fC(t),o={};return r?i?o=Qs:o={width:mC(e,n,r),height:Js.height}:i?o={width:Qs.width,height:hC(e,n,r)}:o=Js,o}function hC(e,t,n){var i;return i=yC(e,t,n),lg(Qs.height,i)}function mC(e,t,n){var i;return i=vC(e,t,n),lg(Js.width,i)}function gC(e){return!!rr(e).length}function yC(e,t,n){var i=rr(e),r;return r=Jl(i,t,n),e.height-r.height+Kl.height}function vC(e,t,n){var i=rr(e),r;return r=Jl(i,t,n),e.width-r.width+Xl.width}function Jl(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=rr(r),o.length?Jl(o,t,n):r}var fg="_plane";function dg(e){var t=e.id;return _C(t)}function mi(e){var t=e.id;return v(e,"bpmn:SubProcess")?hg(t):t}function $r(e){return hg(e)}function tc(e){var t=Ve(e);return v(t,"bpmndi:BPMNPlane")}function hg(e){return e+fg}function _C(e){return e.replace(new RegExp(fg+"$"),"")}var mg=400,bC=600,gg={x:180,y:160};function Oi(e,t,n,i,r,o,a){X.call(this,t),this._canvas=e,this._eventBus=t,this._modeling=n,this._elementFactory=i,this._bpmnFactory=r,this._bpmnjs=o,this._elementRegistry=a;var s=this;function c(p){return v(p,"bpmn:SubProcess")&&!$e(p)}function u(p){var f=p.shape,d=p.newRootElement,h=Z(f);d=s._addDiagram(d||h),p.newRootElement=e.addRootElement(d)}function l(p){var f=p.shape,d=Z(f);s._removeDiagram(d);var h=p.newRootElement=a.get(mi(d));e.removeRootElement(h)}this.executed("shape.create",function(p){var f=p.shape;c(f)&&u(p)},!0),this.postExecuted("elements.create",function(p){var f=p.elements;M(f,function(d){if(c(d)){var h=a.get(mi(d));if(!(!h||!d.children||!d.children.length)){var m=yg(d);s._showRecursively(m),s._moveChildrenToShape(m,h)}}})},!0),this.reverted("shape.create",function(p){var f=p.shape;c(f)&&l(p)},!0),this.preExecute("shape.delete",function(p){var f=p.shape;!v(f,"bpmn:SubProcess")||!$e(f)||M(na([f]),d=>{n.removeShape(d.annotation)})},!0),this.preExecuted("shape.delete",function(p){var f=p.shape;if(c(f)){var d=a.get(mi(f));d&&n.removeElements(d.children.slice())}},!0),this.executed("shape.delete",function(p){var f=p.shape;c(f)&&l(p)},!0),this.reverted("shape.delete",function(p){var f=p.shape;c(f)&&u(p)},!0),this.preExecuted("shape.replace",function(p){var f=p.oldShape,d=p.newShape;!c(f)||!c(d)||(p.oldRoot=e.removeRootElement(mi(f)))},!0),this.postExecuted("shape.replace",function(p){var f=p.newShape,d=p.oldRoot,h=e.findRoot(mi(f));if(!(!d||!h)){var m=d.children;n.moveElements(m,{x:0,y:0},h)}},!0),this.executed("element.updateProperties",function(p){var f=p.element;if(v(f,"bpmn:SubProcess")){var d=p.properties,h=p.oldProperties,m=h.id,g=d.id;if(m!==g){if(tc(f)){a.updateId(f,$r(g)),a.updateId(m,g);return}var R=a.get($r(m));R&&a.updateId($r(m),$r(g))}}},!0),this.reverted("element.updateProperties",function(p){var f=p.element;if(v(f,"bpmn:SubProcess")){var d=p.properties,h=p.oldProperties,m=h.id,g=d.id;if(m!==g){if(tc(f)){a.updateId(f,$r(m)),a.updateId(g,m);return}var R=a.get($r(g));R&&a.updateId(R,$r(m))}}},!0),t.on("element.changed",function(p){var f=p.element;if(tc(f)){var d=f,h=a.get(dg(d));!h||h===d||t.fire("element.changed",{element:h})}}),this.executed("shape.toggleCollapse",mg,function(p){var f=p.shape;v(f,"bpmn:SubProcess")&&($e(f)?l(p):(u(p),s._showRecursively(f.children)))},!0),this.reverted("shape.toggleCollapse",mg,function(p){var f=p.shape;v(f,"bpmn:SubProcess")&&($e(f)?l(p):(u(p),s._showRecursively(f.children)))},!0),this.postExecuted("shape.toggleCollapse",bC,function(p){var f=p.shape;if(v(f,"bpmn:SubProcess")){var d=p.newRootElement;if(d)if($e(f))s._moveChildrenToShape(d.children.slice(),f),M(na(f.children),m=>{n.moveShape(m.annotation,{x:0,y:0},f.parent),M(m.associations,g=>{n.moveConnection(g,{x:0,y:0},f.parent)})});else{s._disconnectSharedAnnotations(f);var h=yg(f);s._moveChildrenToShape(h,d)}}},!0),t.on("copyPaste.createTree",function(p){var f=p.element,d=p.children;if(c(f)){var h=mi(f),m=a.get(h);m&&d.push.apply(d,m.children)}}),t.on("copyPaste.copyElement",function(p){var f=p.descriptor,d=p.element,h=p.elements,m=d.parent,g=v(Ve(m),"bpmndi:BPMNPlane");if(g){var R=dg(m),w=st(h,function(b){return b.id===R});w&&(f.parent=w.id)}}),t.on("copyPaste.pasteElement",function(p){var f=p.descriptor;f.parent&&(c(f.parent)||f.parent.hidden)&&(f.hidden=!0)})}ie(Oi,X),Oi.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=At(i),o;if(!t.x)o={x:gg.x-r.x,y:gg.y-r.y};else{var a=be(t),s=be(r);o={x:a.x-s.x,y:a.y-s.y}}n.moveElements(e,o,t,{autoResize:!1})}},Oi.prototype._disconnectSharedAnnotations=function(e){var t=this._modeling,n=new Set(sm(e).map(i=>i.annotation));n.size&&M(na(e.children),i=>{n.has(i.annotation)&&M(i.associations,r=>{t.removeConnection(r)})})},Oi.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},Oi.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},Oi.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:mi(e),type:e.$type,di:i,businessObject:e,collapsed:!0});return o},Oi.prototype._removeDiagram=function(e){var t=this._bpmnjs,n=t.getDefinitions().diagrams,i=st(n,function(r){return r.plane.bpmnElement.id===e.id});return n.splice(n.indexOf(i),1),i},Oi.$inject=["canvas","eventBus","modeling","elementFactory","bpmnFactory","bpmnjs","elementRegistry"];function xC(e){var t=[];return M(na(e),n=>{t.push(n.annotation),t.push.apply(t,n.associations)}),t}function yg(e){return e.children.slice().concat(xC(e.children)).concat(wC(e))}function wC(e){return rl(e.children||[]).reduce(function(t,n){return n.label&&n.label.parent!==e&&t.push(n.label),t},[])}function ep(e,t){e.invoke(X,this),this.postExecuted("shape.replace",function(n){var i=n.context.oldShape,r=n.context.newShape;if(!(!v(r,"bpmn:SubProcess")||v(r,"bpmn:AdHocSubProcess")||!(v(i,"bpmn:Task")||v(i,"bpmn:CallActivity"))||!$e(r))){var o=EC(r);t.createShape({type:"bpmn:StartEvent"},o,r)}})}ep.$inject=["injector","modeling"],ie(ep,X);function EC(e){return{x:e.x+e.width/6,y:e.y+e.height/2}}function tp(e,t){X.call(this,e),this.preExecute("connection.create",function(n){const{target:i}=n;v(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&&v(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(!(!v(r,"bpmn:TextAnnotation")||o.autoResize)){var a=i.newBounds,s=t.getTextAnnotationBounds(a,jn(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}}})}ie(tp,X),tp.$inject=["eventBus","textRenderer"];function np(e,t){X.call(this,e),this.postExecuted("shape.toggleCollapse",1500,function(n){var i=n.shape;if($e(i))return;var r=Xo(i);r.forEach(function(a){var s=a.incoming.slice(),c=a.outgoing.slice();M(s,function(u){o(u,!0)}),M(c,function(u){o(u,!1)})});function o(a,s){r.indexOf(a.source)!==-1&&r.indexOf(a.target)!==-1||v(a,"bpmn:Association")&&(v(a.source,"bpmn:TextAnnotation")||v(a.target,"bpmn:TextAnnotation"))||(s?t.reconnectEnd(a,i,be(i)):t.reconnectStart(a,i,be(i)))}},!0)}ie(np,X),np.$inject=["eventBus","modeling"];var ip=500;function rp(e,t,n){X.call(this,e);function i(a){a.length&&a.forEach(function(s){s.type==="label"&&!s.businessObject.name&&(s.hidden=!0)})}function r(a,s){var c=a.children,u=s,l,p;return l=SC(c).concat([a]),p=Rm(l),p?(u.width=Math.max(p.width,u.width),u.height=Math.max(p.height,u.height),u.x=p.x+(p.width-u.width)/2,u.y=p.y+(p.height-u.height)/2):(u.x=a.x+(a.width-u.width)/2,u.y=a.y+(a.height-u.height)/2),u}function o(a,s){return{x:a.x+(a.width-s.width)/2,y:a.y+(a.height-s.height)/2,width:s.width,height:s.height}}this.executed(["shape.toggleCollapse"],ip,function(a){var s=a.context,c=s.shape;v(c,"bpmn:SubProcess")&&(c.collapsed?Ve(c).isExpanded=!1:(i(c.children),Ve(c).isExpanded=!0))}),this.reverted(["shape.toggleCollapse"],ip,function(a){var s=a.context,c=s.shape;c.collapsed?Ve(c).isExpanded=!1:Ve(c).isExpanded=!0}),this.postExecuted(["shape.toggleCollapse"],ip,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"})})}ie(rp,X),rp.$inject=["eventBus","elementFactory","modeling"];function SC(e){return e.filter(function(t){return!t.hidden})}function op(e,t,n,i){t.invoke(X,this),this.preExecute("shape.delete",function(r){var o=r.context,a=o.shape,s=a.businessObject;Me(a)||(v(a,"bpmn:Participant")&&$e(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;v(r,"bpmn:Collaboration")&&n.ids.unclaim(o.id)})}ie(op,X),op.$inject=["canvas","injector","moddle","modeling"];function ap(e,t){X.call(this,e),this.preExecute("connection.delete",function(n){var i=n.context,r=i.connection,o=r.source;RC(r,o)&&t.updateProperties(o,{default:null})})}ie(ap,X),ap.$inject=["eventBus","modeling"];function RC(e,t){if(!v(e,"bpmn:SequenceFlow"))return!1;var n=Z(t),i=Z(e);return n.get("default")===i}var CC=500,PC=5e3,vg=["shape.create","shape.delete","shape.move","shape.resize"],_g=[...vg,"spaceTool","lane.add","lane.resize","lane.split","elements.create","elements.delete","elements.move"];function sp(e,t){X.call(this,e);var n;function i(){return n=n||new AC,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(_g,PC,function(){i()}),this.postExecuted(_g,CC,function(){o()}),this.preExecute(vg,function(a){var s=a.context,c=s.shape,u=r();!c||c.labelTarget||(v(c,"bpmn:Lane")&&u.addLane(c),v(c,"bpmn:FlowNode")&&u.addFlowNode(c))})}sp.$inject=["eventBus","modeling"],ie(sp,X);function AC(){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 TC=500,MC=5e3,bg=["connection.create","connection.delete","connection.layout","connection.move","connection.reconnect","connection.updateWaypoints","shape.create","shape.delete","shape.move","shape.resize"],xg=[...bg,"elements.create","elements.delete","elements.move","label.create","spaceTool"];function cp(e,t){X.call(this,e);var n;function i(){return n=n||new kC,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(xg,MC,function(){i()}),this.postExecuted(xg,TC,function(){o()}),this.preExecute(bg,function(a){var s=a.context.connection||a.context.shape,c=r();!s||s.labelTarget||(v(s,"bpmn:FlowElement")&&c.addFlowElement(s),v(s,"bpmn:Group")&&c.addGroup(s))}),this.preExecute("label.create",function(a){var s=a.context.labelTarget;v(s,"bpmn:Group")&&r().addGroup(s)})}cp.$inject=["eventBus","modeling"],ie(cp,X);function kC(){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 up(e,t){X.call(this,e),this.postExecuted("elements.create",function(n){const i=n.context,r=i.elements;for(const o of r)DC(o)&&!LC(o)&&t.updateProperties(o,{isForCompensation:void 0})})}ie(up,X),up.$inject=["eventBus","modeling"];function DC(e){const t=Z(e);return t&&t.isForCompensation}function OC(e){return e&&v(e,"bpmn:BoundaryEvent")&&lo(e,"bpmn:CompensateEventDefinition")}function LC(e){return e.incoming.filter(n=>OC(n.source)).length>0}const IC={__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",yl],appendBehavior:["type",vl],associationBehavior:["type",bl],attachEventBehavior:["type",Ns],artifactBehavior:["type",_l],boundaryEventBehavior:["type",xl],categoryRootElementReferenceBehavior:["type",wl],compensateBoundaryEventBehaviour:["type",El],createBehavior:["type",Sl],createDataObjectBehavior:["type",Rl],createParticipantBehavior:["type",Al],dataInputAssociationBehavior:["type",Tl],dataStoreBehavior:["type",Ml],deleteLaneBehavior:["type",kl],detachEventBehavior:["type",Gs],dropOnFlowBehavior:["type",Ol],eventBasedGatewayBehavior:["type",Ll],fixHoverBehavior:["type",Dm],groupBehavior:["type",Il],importDockingFix:["type",Lm],isHorizontalFix:["type",Bl],labelBehavior:["type",jl],layoutConnectionBehavior:["type",Fl],messageFlowBehavior:["type",Vl],nonInterruptingBehavior:["type",Gl],removeElementBehavior:["type",Ul],removeEmbeddedLabelBoundsBehavior:["type",Wl],removeParticipantBehavior:["type",Yl],replaceConnectionBehavior:["type",ql],replaceElementBehaviour:["type",Zs],resizeBehavior:["type",ig],resizeLaneBehavior:["type",ug],rootElementReferenceBehavior:["type",Ql],spaceToolBehavior:["type",pg],subProcessPlaneBehavior:["type",Oi],subProcessStartEventBehavior:["type",ep],textAnnotationBehavior:["type",tp],toggleCollapseConnectionBehaviour:["type",np],toggleElementCollapseBehaviour:["type",rp],unclaimIdBehavior:["type",op],unsetDefaultFlowBehavior:["type",ap],updateFlowNodeRefsBehavior:["type",sp],updateCategoryValueRefsBehavior:["type",cp],setCompensationActivityAfterPasteBehavior:["type",up]};function lp(e){this._commandStack=e.get("commandStack",!1)}lp.$inject=["injector"],lp.prototype.allowed=function(e,t){var n=!0,i=this._commandStack;return i&&(n=i.canExecute(e,t)),n===void 0?!0:n};const gi={__init__:["rules"],rules:["type",lp]};function Yn(e){X.call(this,e),this.init()}Yn.$inject=["eventBus"],ie(Yn,X),Yn.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)})},Yn.prototype.init=function(){};function wg(e,t){var n=Zt(e,t,-15);return n!=="intersect"?n:null}function Jt(e){Yn.call(this,e)}ie(Jt,Yn),Jt.$inject=["eventBus"],Jt.prototype.init=function(){this.addRule("connection.start",function(e){var t=e.source;return NC(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 ic(t,n)}finally{r&&(n.parent=null)}}),this.addRule("connection.reconnect",function(e){var t=e.connection,n=e.source,i=e.target;return ic(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 Ig(t,n,i)}),this.addRule("elements.create",function(e){var t=e.elements,n=e.position,i=e.target;return it(i)&&!rc(t,i)?!1:Rr(t,function(r){return it(r)?ic(r.source,r.target,r):r.host?da(r,r.host,null,n):hp(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 Tg(a)&&!n.includes(a.host)})?!1:da(n,t,null,i)||Og(n,t,i)||Lg(n,t)||rc(n,t)}),this.addRule("shape.create",function(e){return hp(e.shape,e.target,e.source,e.position)}),this.addRule("shape.attach",function(e){return da(e.shape,e.target,null,e.position)}),this.addRule("element.copy",function(e){var t=e.element,n=e.elements;return Fg(n,t)})},Jt.prototype.canConnectMessageFlow=$g,Jt.prototype.canConnectSequenceFlow=jg,Jt.prototype.canConnectDataAssociation=mp,Jt.prototype.canConnectAssociation=Ng,Jt.prototype.canConnectCompensationAssociation=Bg,Jt.prototype.canMove=Lg,Jt.prototype.canAttach=da,Jt.prototype.canReplace=Og,Jt.prototype.canDrop=xo,Jt.prototype.canInsert=rc,Jt.prototype.canCreate=hp,Jt.prototype.canConnect=ic,Jt.prototype.canResize=Ig,Jt.prototype.canCopy=Fg;function NC(e){return pp(e)?null:De(e,["bpmn:FlowNode","bpmn:InteractionNode","bpmn:DataObjectReference","bpmn:DataStoreReference","bpmn:Group","bpmn:TextAnnotation"])}function pp(e){return!e||Me(e)}function Eg(e){do{if(v(e,"bpmn:Process"))return Z(e);if(v(e,"bpmn:Participant"))return Z(e).processRef||Z(e)}while(e=e.parent)}function fp(e){return v(e,"bpmn:TextAnnotation")}function dp(e){return v(e,"bpmn:Group")&&!e.labelTarget}function Sg(e){return v(e,"bpmn:BoundaryEvent")&&yi(e,"bpmn:CompensateEventDefinition")}function nc(e){return Z(e).isForCompensation}function BC(e,t){var n=Eg(e),i=Eg(t);return n===i}function $C(e){return v(e,"bpmn:InteractionNode")&&!v(e,"bpmn:BoundaryEvent")&&(!v(e,"bpmn:Event")||v(e,"bpmn:ThrowEvent")&&Pg(e,"bpmn:MessageEventDefinition"))}function jC(e){return v(e,"bpmn:InteractionNode")&&!nc(e)&&(!v(e,"bpmn:Event")||v(e,"bpmn:CatchEvent")&&Pg(e,"bpmn:MessageEventDefinition"))&&!(v(e,"bpmn:BoundaryEvent")&&!yi(e,"bpmn:MessageEventDefinition"))}function Rg(e){for(var t=e;t=t.parent;){if(v(t,"bpmn:FlowElementsContainer"))return Z(t);if(v(t,"bpmn:Participant"))return Z(t).processRef}return null}function Cg(e,t){var n=Rg(e),i=Rg(t);return n===i}function yi(e,t){var n=Z(e);return!!st(n.eventDefinitions||[],function(i){return v(i,t)})}function Pg(e,t){var n=Z(e);return(n.eventDefinitions||[]).every(function(i){return v(i,t)})}function FC(e){return v(e,"bpmn:FlowNode")&&!v(e,"bpmn:EndEvent")&&!cn(e)&&!(v(e,"bpmn:IntermediateThrowEvent")&&yi(e,"bpmn:LinkEventDefinition"))&&!Sg(e)&&!nc(e)}function HC(e){return v(e,"bpmn:FlowNode")&&!v(e,"bpmn:StartEvent")&&!v(e,"bpmn:BoundaryEvent")&&!cn(e)&&!(v(e,"bpmn:IntermediateCatchEvent")&&yi(e,"bpmn:LinkEventDefinition"))&&!nc(e)}function zC(e){return v(e,"bpmn:ReceiveTask")||v(e,"bpmn:IntermediateCatchEvent")&&(yi(e,"bpmn:MessageEventDefinition")||yi(e,"bpmn:TimerEventDefinition")||yi(e,"bpmn:ConditionalEventDefinition")||yi(e,"bpmn:SignalEventDefinition"))}function VC(e){for(var t=[];e;)e=e.parent,e&&t.push(e);return t}function Ag(e,t){var n=VC(t);return n.indexOf(e)!==-1}function ic(e,t,n){if(pp(e)||pp(t))return null;if(!v(n,"bpmn:DataAssociation")){if($g(e,t))return{type:"bpmn:MessageFlow"};if(jg(e,t))return{type:"bpmn:SequenceFlow"}}var i=mp(e,t);return i||(Bg(e,t)?{type:"bpmn:Association",associationDirection:"One"}:Ng(e,t)?{type:"bpmn:Association",associationDirection:"None"}:!1)}function xo(e,t){return Me(e)||dp(e)?!0:v(t,"bpmn:Participant")&&!$e(t)?!1:v(e,"bpmn:Participant")?v(t,"bpmn:Process")||v(t,"bpmn:Collaboration"):De(e,["bpmn:DataInput","bpmn:DataOutput"])&&e.parent?t===e.parent:v(e,"bpmn:Lane")?v(t,"bpmn:Participant")||v(t,"bpmn:Lane"):v(e,"bpmn:BoundaryEvent")&&!GC(e)?!1:v(e,"bpmn:FlowElement")&&!v(e,"bpmn:DataStoreReference")?v(t,"bpmn:FlowElementsContainer")?$e(t):De(t,["bpmn:Participant","bpmn:Lane"]):v(e,"bpmn:DataStoreReference")&&v(t,"bpmn:Collaboration")?Vi(Z(t).get("participants"),function(n){return!!n.get("processRef")}):De(e,["bpmn:Artifact","bpmn:DataAssociation","bpmn:DataStoreReference"])?De(t,["bpmn:Collaboration","bpmn:Lane","bpmn:Participant","bpmn:Process","bpmn:SubProcess"]):v(e,"bpmn:MessageFlow")?v(t,"bpmn:Collaboration")||e.source.parent==t||e.target.parent==t:!1}function GC(e){return Z(e).cancelActivity&&(Mg(e)||kg(e))}function Tg(e){return!Me(e)&&v(e,"bpmn:BoundaryEvent")}function WC(e){return v(e,"bpmn:Lane")}function UC(e){return Tg(e)||v(e,"bpmn:IntermediateThrowEvent")&&Mg(e)?!0:v(e,"bpmn:IntermediateCatchEvent")&&kg(e)}function Mg(e){var t=Z(e);return t&&!(t.eventDefinitions&&t.eventDefinitions.length)}function kg(e){return Dg(e,["bpmn:MessageEventDefinition","bpmn:TimerEventDefinition","bpmn:SignalEventDefinition","bpmn:ConditionalEventDefinition"])}function Dg(e,t){return t.some(function(n){return yi(e,n)})}function YC(e){return v(e,"bpmn:ReceiveTask")&&st(e.incoming,function(t){return v(t.source,"bpmn:EventBasedGateway")})}function da(e,t,n,i){if(Array.isArray(e)||(e=[e]),e.length!==1)return!1;var r=e[0];return Me(r)||!UC(r)||cn(t)||!v(t,"bpmn:Activity")||nc(t)||i&&!wg(i,t)||YC(t)?!1:"attach"}function Og(e,t,n){if(!t)return!1;var i={replacements:[]};return M(e,function(r){cn(t)||v(r,"bpmn:StartEvent")&&r.type!=="label"&&xo(r,t)&&(nS(r)||i.replacements.push({oldElementId:r.id,newElementType:"bpmn:StartEvent"}),(iS(r)||rS(r)||oS(r))&&i.replacements.push({oldElementId:r.id,newElementType:"bpmn:StartEvent"}),Dg(r,["bpmn:MessageEventDefinition","bpmn:TimerEventDefinition","bpmn:SignalEventDefinition","bpmn:ConditionalEventDefinition"])&&v(t,"bpmn:SubProcess")&&i.replacements.push({oldElementId:r.id,newElementType:"bpmn:StartEvent"})),v(t,"bpmn:Transaction")||yi(r,"bpmn:CancelEventDefinition")&&r.type!=="label"&&(v(r,"bpmn:EndEvent")&&xo(r,t)&&i.replacements.push({oldElementId:r.id,newElementType:"bpmn:EndEvent"}),v(r,"bpmn:BoundaryEvent")&&da(r,t,null,n)&&i.replacements.push({oldElementId:r.id,newElementType:"bpmn:BoundaryEvent"}))}),i.replacements.length?i:!1}function Lg(e,t){return Vi(e,WC)?!1:t===void 0?!0:t===null?!1:e.every(function(n){return xo(n,t)})}function hp(e,t,n,i){return t?Me(e)||dp(e)?!0:xo(e,t)||rc(e,t):!1}function Ig(e,t,n){return v(e,"bpmn:SubProcess")?$e(e)&&(!t||t.width>=100&&t.height>=80):v(e,"bpmn:Lane")||v(e,"bpmn:Participant")?!0:fp(e)?n?n==="e"||n==="w":!0:dp(e)?!0:Me(e)?n?n==="e"||n==="w":!0:!1}function qC(e,t){var n=fp(e),i=fp(t);return(n||i)&&n!==i}function Ng(e,t){return Ag(t,e)||Ag(e,t)?!1:qC(e,t)?!0:!!mp(e,t)}function Bg(e,t){return Cg(e,t)&&Sg(e)&&v(t,"bpmn:Activity")&&!XC(t,e)&&!cn(t)}function $g(e,t){return zg(e)&&!zg(t)?!1:$C(e)&&jC(t)&&!BC(e,t)}function jg(e,t){return FC(e)&&HC(t)&&Cg(e,t)&&!(v(e,"bpmn:EventBasedGateway")&&!zC(t))}function mp(e,t){return De(e,["bpmn:DataObjectReference","bpmn:DataStoreReference"])&&De(t,["bpmn:Activity","bpmn:ThrowEvent"])?{type:"bpmn:DataInputAssociation"}:De(t,["bpmn:DataObjectReference","bpmn:DataStoreReference"])&&De(e,["bpmn:Activity","bpmn:CatchEvent"])?{type:"bpmn:DataOutputAssociation"}:!1}function rc(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:De(t,["bpmn:SequenceFlow","bpmn:MessageFlow"])&&!Me(t)&&v(e,"bpmn:FlowNode")&&!v(e,"bpmn:BoundaryEvent")&&xo(e,t.parent)}function gp(e,t){return e&&t&&e.indexOf(t)!==-1}function Fg(e,t){return Me(t)?!0:!(v(t,"bpmn:Lane")&&!gp(e,t.parent)||v(t,"bpmn:MessageFlow")&&!KC(e,t))}function KC(e,t){var n=Hg(t.source),i=Hg(t.target);return gp(e,n)&&gp(e,i)}function Hg(e){for(;e;e=e.parent)if(v(e,"bpmn:Participant"))return e;return null}function zg(e){return ho(e,"bpmn:Process")||ho(e,"bpmn:Collaboration")}function XC(e,t){return e.attachers.includes(t)}const ZC={__depends__:[gi],__init__:["bpmnRules"],bpmnRules:["type",Jt]};var QC=2e3;function Vg(e,t){e.on("saveXML.start",QC,n);function n(){var i=t.getRootElements();M(i,function(r){var o=Ve(r),a,s;a=Xo([r]),a=Oe(a,function(c){return c!==r&&!c.labelTarget}),s=rn(a,Ve),o.set("planeElement",s)})}}Vg.$inject=["eventBus","canvas"];const JC={__init__:["bpmnDiOrdering"],bpmnDiOrdering:["type",Vg]};function oc(e){X.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)})}oc.prototype.getOrdering=function(e,t){return null},ie(oc,X);function yp(e,t){oc.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=st(n,function(c){return De(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&&!De(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||v(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=Wf(s.children,function(p){return!a.labelTarget&&p.labelTarget?!1:c.level<r(p).level});return l!==-1&&u!==-1&&u<l&&(l-=1),{index:l,parent:s}}}yp.$inject=["eventBus","canvas"],ie(yp,oc);const eP={__init__:["bpmnOrderingProvider"],bpmnOrderingProvider:["type",yp]};function ha(){}ha.prototype.get=function(){return this._data},ha.prototype.set=function(e){this._data=e},ha.prototype.clear=function(){var e=this._data;return delete this._data,e},ha.prototype.isEmpty=function(){return!this._data};const tP={clipboard:["type",ha]};var Gg=1500;function Wg(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",Gg,function(s){o(s)})}),(function(){var a,s;t.on("element.hover",function(c){a=c.gfx,s=c.element}),t.on("element.hover",Gg,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=Br(a),c=document.elementFromPoint(s.x,s.y),nP(c)}}Wg.$inject=["elementRegistry","eventBus","injector"];function nP(e){return kr(e,"svg, .djs-element",!0)}const iP={__init__:["hoverFix"],hoverFix:["type",Wg]};function rP(e){return!0}function ac(e){return ar(e)||uC(e)}var Ug=500;function Yg(e,t,n){var i=this;function r(A,j,H){if(!s(A,j)){var N,G,fe;H?G=t.getGraphics(H):(N=j.delegateTarget||j.target,N&&(G=N,H=t.get(G))),!(!G||!H)&&(fe=e.fire(A,{element:H,gfx:G,originalEvent:j}),fe===!1&&(j.stopPropagation(),j.preventDefault()))}}var o={};function a(A){return o[A]}function s(A,j){var H=u[A]||ar;return!H(j)}var c={click:"element.click",contextmenu:"element.contextmenu",dblclick:"element.dblclick",mousedown:"element.mousedown",mousemove:"element.mousemove",mouseover:"element.hover",mouseout:"element.out",mouseup:"element.mouseup"},u={"element.contextmenu":rP,"element.mousedown":ac,"element.mouseup":ac,"element.click":ac,"element.dblclick":ac};function l(A,j,H){var N=c[A];if(!N)throw new Error("unmapped DOM event name <"+A+">");return r(N,j,H)}var p="svg, .djs-element";function f(A,j,H,N){var G=o[H]=function(fe){r(H,fe)};N&&(u[H]=N),G.$delegate=Cn.bind(A,p,j,G)}function d(A,j,H){var N=a(H);N&&Cn.unbind(A,j,N.$delegate)}function h(A){M(c,function(j,H){f(A,H,j)})}function m(A){M(c,function(j,H){d(A,H,j)})}e.on("canvas.destroy",function(A){m(A.svg)}),e.on("canvas.init",function(A){h(A.svg)}),e.on(["shape.added","connection.added"],function(A){var j=A.element,H=A.gfx;e.fire("interactionEvents.createHit",{element:j,gfx:H})}),e.on(["shape.changed","connection.changed"],Ug,function(A){var j=A.element,H=A.gfx;e.fire("interactionEvents.updateHit",{element:j,gfx:H})}),e.on("interactionEvents.createHit",Ug,function(A){var j=A.element,H=A.gfx;i.createDefaultHit(j,H)}),e.on("interactionEvents.updateHit",function(A){var j=A.element,H=A.gfx;i.updateDefaultHit(j,H)});var g=E("djs-hit djs-hit-stroke"),R=E("djs-hit djs-hit-click-stroke"),w=E("djs-hit djs-hit-all"),b=E("djs-hit djs-hit-no-move"),x={all:w,"click-stroke":R,stroke:g,"no-move":b};function E(A,j){return j=O({stroke:"white",strokeWidth:15},j||{}),n.cls(A,["no-fill","no-border"],j)}function T(A,j){var H=x[j];if(!H)throw new Error("invalid hit type <"+j+">");return re(A,H),A}function L(A,j){Re(A,j)}this.removeHits=function(A){var j=ys(".djs-hit",A);M(j,Ft)},this.createDefaultHit=function(A,j){var H=A.waypoints,N=A.isFrame,G;return H?this.createWaypointsHit(j,H):(G=N?"stroke":"all",this.createBoxHit(j,G,{width:A.width,height:A.height}))},this.createWaypointsHit=function(A,j){var H=Ko(j);return T(H,"stroke"),L(A,H),H},this.createBoxHit=function(A,j,H){H=O({x:0,y:0},H);var N=me("rect");return T(N,j),re(N,H),L(A,N),N},this.updateDefaultHit=function(A,j){var H=et(".djs-hit",j);if(H)return A.waypoints?il(H,A.waypoints):re(H,{width:A.width,height:A.height}),H},this.fire=r,this.triggerMouseEvent=l,this.mouseHandler=a,this.registerEvent=f,this.unregisterEvent=d}Yg.$inject=["eventBus","elementRegistry","styles"];const sc={__init__:["interactionEvents"],interactionEvents:["type",Yg]};function wo(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)})}wo.$inject=["eventBus","canvas"],wo.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()})}},wo.prototype.get=function(){return Array.from(this._selectedElements)},wo.prototype.isSelected=function(e){return this._selectedElements.has(e)},wo.prototype.select=function(e,t){var n=this.get();_e(e)||(e=e?[e]:[]);var i=this._canvas,r=i.getRootElement();e=e.filter(function(o){var a=i.findRoot(o);return r===a}),t?M(e,o=>{this._selectedElements.add(o)}):this._selectedElements=new Set(e),this._eventBus.fire("selection.changed",{oldSelection:n,newSelection:this.get()})};var qg="hover",Kg="selected";function Xg(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,qg)}),t.on("element.out",function(r){i(r.element,qg)}),t.on("selection.changed",function(r){function o(u){i(u,Kg)}function a(u){n(u,Kg)}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)})}Xg.$inject=["canvas","eventBus"];function Zg(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;_e(u)?t.select(u):t.select(s.filter(oP))}}),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=st(o,function(c){return a.id===c.id});s||t.select(a)}),e.on("element.click",function(r){if(ar(r)){var o=r.element;o===n.getRootElement()&&(o=null);var a=t.isSelected(o),s=t.get().length>1,c=ec(r);if(a&&s)return c?t.deselect(o):t.select(o);a?t.deselect(o):t.select(o,c)}})}Zg.$inject=["eventBus","selection","canvas","elementRegistry"];function oP(e){return!e.hidden}const qn={__init__:["selectionVisuals","selectionBehavior"],__depends__:[sc],selection:["type",wo],selectionVisuals:["type",Xg],selectionBehavior:["type",Zg]};var aP=/^djs-cursor-.*$/;function cc(e){var t=mt(document.body);t.removeMatching(aP),e&&t.add("djs-cursor-"+e)}function Qg(){cc(null)}var sP=5e3;function Jg(e,t){t=t||"element.click";function n(){return!1}return e.once(t,sP,n),function(){e.off(t,n)}}var cP=["c","C"],uP=["v","V"],lP=["d","D"],pP=["x","X"],fP=["y","Y"],ey=["z","Z"];function dP(e){return e.ctrlKey||e.metaKey||e.shiftKey||e.altKey}function Tn(e){return e.altKey?!1:e.ctrlKey||e.metaKey}function Ht(e,t){return e=_e(e)?e:[e],e.indexOf(t.key)!==-1||e.indexOf(t.code)!==-1}function vp(e){return e.shiftKey}function hP(e){return Tn(e)&&Ht(cP,e)}function mP(e){return Tn(e)&&Ht(uP,e)}function gP(e){return Tn(e)&&Ht(lP,e)}function yP(e){return Tn(e)&&Ht(pP,e)}function vP(e){return Tn(e)&&!vp(e)&&Ht(ey,e)}function _P(e){return Tn(e)&&(Ht(fP,e)||Ht(ey,e)&&vp(e))}var Eo=Math.round,ty="djs-drag-active";function jr(e){e.preventDefault()}function bP(e){return typeof TouchEvent<"u"&&e instanceof TouchEvent}function xP(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(),E=t._container.getBoundingClientRect();return{x:x.x+(b.x-E.left)/x.scale,y:x.y+(b.y-E.top)/x.scale}}function s(b,x){x=x||o;var E=e.createEvent(O({},x.payload,x.data,{isTouch:x.isTouch}));return e.fire("drag."+b,E)===!1?!1:e.fire(x.prefix+"."+b,E)}function c(b){var x=b.filter(function(E){return i.get(E.id)});x.length&&n.select(x)}function u(b,x){var E=o.payload,T=o.displacement,L=o.globalStart,A=Br(b),j=ii(A,L),H=o.localStart,N=a(A),G=ii(N,H);if(!o.active&&(x||xP(j)>o.threshold)){if(O(E,{x:Eo(H.x+T.x),y:Eo(H.y+T.y),dx:0,dy:0},{originalEvent:b}),s("start")===!1)return g();o.active=!0,o.keepSelection||(E.previousSelection=n.get(),n.select(null)),o.cursor&&cc(o.cursor),t.addMarker(t.getRootElement(),ty)}Zl(b),o.active&&(O(E,{x:Eo(N.x+T.x),y:Eo(N.y+T.y),dx:Eo(G.x),dy:Eo(G.y)},{originalEvent:b}),s("move"))}function l(b){var x,E=!0;o.active&&(b&&(o.payload.originalEvent=b,Zl(b)),E=s("end")),E===!1&&s("rejected"),x=R(E!==!0),s("ended",x)}function p(b){Ht("Escape",b)&&(jr(b),g())}function f(b){var x;o.active&&(x=Jg(e),setTimeout(x,400),jr(b)),l(b)}function d(b){u(b)}function h(b){var x=o.payload;x.hoverGfx=b.gfx,x.hover=b.element,s("hover")}function m(b){s("out");var x=o.payload;x.hoverGfx=null,x.hover=null}function g(b){var x;if(o){var E=o.active;E&&s("cancel"),x=R(b),E&&s("canceled",x)}}function R(b){var x,E;s("cleanup"),Qg(),o.trapClick?E=f:E=l,Se.unbind(document,"mousemove",u),Se.unbind(document,"dragstart",jr),Se.unbind(document,"selectstart",jr),Se.unbind(document,"mousedown",E,!0),Se.unbind(document,"mouseup",E,!0),Se.unbind(document,"keyup",p),Se.unbind(document,"touchstart",d,!0),Se.unbind(document,"touchcancel",g,!0),Se.unbind(document,"touchmove",u,!0),Se.unbind(document,"touchend",l,!0),e.off("element.hover",h),e.off("element.out",m),t.removeMarker(t.getRootElement(),ty);var T=o.payload.previousSelection;return b!==!1&&T&&!n.get().length&&c(T),x=o,o=null,x}function w(b,x,E,T){o&&g(!1),typeof x=="string"&&(T=E,E=x,x=null),T=O({},r,T||{});var L=T.data||{},A,j,H,N,G;if(T.trapClick?N=f:N=l,b?(A=bo(b)||b,j=Br(b),Zl(b),A.type==="dragstart"&&jr(A)):(A=null,j={x:0,y:0}),H=a(j),x||(x=H),G=bP(A),o=O({prefix:E,data:L,payload:{},globalStart:j,displacement:ii(x,H),localStart:H,isTouch:G},T),T.manual||(G?(Se.bind(document,"touchstart",d,!0),Se.bind(document,"touchcancel",g,!0),Se.bind(document,"touchmove",u,!0),Se.bind(document,"touchend",l,!0)):(Se.bind(document,"mousemove",u),Se.bind(document,"dragstart",jr),Se.bind(document,"selectstart",jr),Se.bind(document,"mousedown",N,!0),Se.bind(document,"mouseup",N,!0)),Se.bind(document,"keyup",p),e.on("element.hover",h),e.on("element.out",m)),s("init")===!1)return g(),!1;T.autoActivate&&u(b,!0)}e.on("diagram.destroy",g),this.init=w,this.move=u,this.hover=h,this.out=m,this.end=l,this.cancel=g,this.context=function(){return o},this.setOptions=function(b){O(r,b)}}ny.$inject=["eventBus","canvas","selection","elementRegistry"];const Li={__depends__:[iP,qn],dragging:["type",ny]};function So(e){this._counter=0,this._prefix=(e?e+"-":"")+Math.floor(Math.random()*1e9)+"-"}So.prototype.next=function(){return this._prefix+ ++this._counter};const wP=new So("ps");var EP=["marker-start","marker-mid","marker-end"],SP=["circle","ellipse","line","path","polygon","polyline","path","rect"];function sr(e,t,n,i){this._elementRegistry=e,this._canvas=n,this._styles=i}sr.$inject=["elementRegistry","eventBus","canvas","styles"],sr.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")},sr.prototype.getGfx=function(e){return this._elementRegistry.getGraphics(e)},sr.prototype.addDragger=function(e,t,n,i="djs-dragger"){n=n||this.getGfx(e);var r=mh(n);return this._cloneMarkers(Lr(r),i),re(r,this._styles.cls(i,[])),Re(t,r),re(r,"data-preview-support-element-id",e.id),r},sr.prototype.addFrame=function(e,t){var n=me("rect",{class:"djs-resize-overlay",width:e.width,height:e.height,x:e.x,y:e.y});return Re(t,n),re(n,"data-preview-support-element-id",e.id),n},sr.prototype._cloneMarkers=function(e,t="djs-dragger",n=e){var i=this;e.childNodes&&e.childNodes.forEach(r=>{i._cloneMarkers(r,t,n)}),AP(e)&&EP.forEach(function(r){if(re(e,r)){var o=RP(e,r,i._canvas.getContainer());o&&i._cloneMarker(n,e,o,r,t)}})},sr.prototype._cloneMarker=function(e,t,n,i,r="djs-dragger"){var o=[n.id,r,wP.next()].join("-"),a=et("marker#"+n.id,e);e=e||this._canvas._svg;var s=a||mh(n);s.id=o,je(s).add(r);var c=et(":scope > defs",e);c||(c=me("defs"),Re(e,c)),Re(c,s);var u=PP(s.id);re(t,i,u)};function RP(e,t,n){var i=CP(re(e,t));return et("marker#"+i,n||document)}function CP(e){return e.match(/url\(['"]?#([^'"]*)['"]?\)/)[1]}function PP(e){return"url(#"+e+")"}function AP(e){return SP.indexOf(e.nodeName)!==-1}const Ro={__init__:["previewSupport"],previewSupport:["type",sr]};var TP="drop-ok",iy="drop-not-ok",ry="attach-ok",oy="new-parent",ay="create",MP=2e3;function sy(e,t,n,i,r){function o(c,u,l,p,f){if(!u)return!1;c=Oe(c,function(w){var b=w.labelTarget;return!w.parent&&!(Me(w)&&c.indexOf(b)!==-1)});var d=st(c,function(w){return!it(w)}),h=!1,m=!1,g=!1;uy(c)&&(h=r.allowed("shape.attach",{position:l,shape:d,target:u})),h||(uy(c)?g=r.allowed("shape.create",{position:l,shape:d,source:p,target:u}):g=r.allowed("elements.create",{elements:c,position:l,target:u}));var R=f.connectionTarget;return g||h?(d&&p&&(m=r.allowed("connection.create",{source:R===p?d:p,target:R===p?p:d,hints:{targetParent:u,targetAttach:h}})),{attach:h,connect:m}):g===null||h===null?null:!1}function a(c,u){[ry,TP,iy,oy].forEach(function(l){l===u?e.addMarker(c,l):e.removeMarker(c,l)})}n.on(["create.move","create.hover"],function(c){var u=c.context,l=u.elements,p=c.hover,f=u.source,d=u.hints||{};if(!p){u.canExecute=!1,u.target=null;return}cy(c);var h={x:c.x,y:c.y},m=u.canExecute=p&&o(l,p,h,f,d);p&&m!==null&&(u.target=p,m&&m.attach?a(p,ry):a(p,m?oy: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,p=u.shape,f=u.elements,d=u.target,h=u.canExecute,m=h&&h.attach,g=h&&h.connect,R=u.hints||{};if(h===!1||!d)return!1;cy(c);var w={x:c.x,y:c.y};g?p=i.appendShape(l,p,w,d,{attach:m,connection:g===!0?{}:g,connectionTarget:R.connectionTarget}):(f=i.createElements(f,w,d,O({},R,{attach:m})),p=st(f,function(b){return!it(b)})),O(u,{elements:f,shape:p}),O(c,{elements:f,shape:p})});function s(){var c=t.context();c&&c.prefix===ay&&t.cancel()}n.on("create.init",function(){n.on("elements.changed",s),n.once(["create.cancel","create.end"],MP,function(){n.off("elements.changed",s)})}),this.start=function(c,u,l){_e(u)||(u=[u]);var p=st(u,function(h){return!it(h)});if(p){l=O({elements:u,hints:{},shape:p},l||{}),M(u,function(h){we(h.x)||(h.x=0),we(h.y)||(h.y=0)});var f=Oe(u,function(h){return!h.hidden}),d=At(f);M(u,function(h){it(h)&&(h.waypoints=rn(h.waypoints,function(m){return{x:m.x-d.x-d.width/2,y:m.y-d.y-d.height/2}})),O(h,{x:h.x-d.x-d.width/2,y:h.y-d.y-d.height/2})}),t.init(c,ay,{cursor:"grabbing",autoActivate:!0,data:{shape:p,elements:u,context:l}})}}}sy.$inject=["canvas","dragging","eventBus","modeling","rules"];function cy(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 uy(e){return e&&e.length===1&&!it(e[0])}var kP=750;function ly(e,t,n,i,r){function o(a){var s=me("g");re(s,r.cls("djs-drag-group",["no-events"]));var c=me("g");return a.forEach(function(u){var l;u.hidden||(u.waypoints?(l=n._createContainer("connection",c),n.drawConnection(Lr(l),u)):(l=n._createContainer("shape",c),n.drawShape(Lr(l),u),Qt(l,u.x,u.y)),i.addDragger(u,s,l))}),s}t.on("create.move",kP,function(a){var s=a.hover,c=a.context,u=c.elements,l=c.dragGroup;l||(l=c.dragGroup=o(u));var p;s?(l.parentNode||(p=e.getActiveLayer(),Re(p,l)),Qt(l,a.x,a.y)):Ft(l)}),t.on("create.cleanup",function(a){var s=a.context,c=s.dragGroup;c&&Ft(c)})}ly.$inject=["canvas","eventBus","graphicsFactory","previewSupport","styles"];const uc={__depends__:[Li,Ro,gi,qn],__init__:["create","createPreview"],create:["type",sy],createPreview:["type",ly]};function _p(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)})}_p.$inject=["eventBus"],_p.prototype.getLastMoveEvent=function(){return this._lastMoveEvent||DP(0,0)};function DP(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 ma={__init__:["mouse"],mouse:["type",_p]};var py=2e3;function Mn(e,t,n,i,r,o,a,s){this._canvas=e,this._create=t,this._elementFactory=i,this._eventBus=r,this._modeling=o,this._mouse=a,this._rules=s,r.on("copyPaste.copyElement",function(c){var u=c.descriptor,l=c.element,p=c.elementsSet;u.priority=1,u.id=l.id,p.has(l.parent)&&(u.parent=l.parent.id),OP(l)&&(u.priority=2,u.host=l.host.id),it(l)&&(u.priority=3,u.source=l.source.id,u.target=l.target.id,u.waypoints=LP(l)),Me(l)&&(u.priority=4,u.labelTarget=l.labelTarget.id),M(["x","y","width","height"],function(f){we(l[f])&&(u[f]=l[f])}),u.hidden=l.hidden,u.collapsed=l.collapsed}),r.on("copyPaste.elementsCopied",py,function(c){var u;((u=c.hints)==null?void 0:u.clip)!==!1&&n.set(c.tree)}),r.on("copyPaste.pasteElements",py,function(c){c.tree||(c.tree=n.get())}),r.on("copyPaste.pasteElements",function(c){var u=c.hints;O(u,{createElementsBehavior:!1})})}Mn.$inject=["canvas","create","clipboard","elementFactory","eventBus","modeling","mouse","rules"],Mn.prototype.copy=function(e,t={}){var n,i;return _e(e)||(e=e?[e]:[]),n=this._eventBus.fire("copyPaste.canCopyElements",{elements:e}),n===!1?i={}:i=this.createTree(_e(n)?n:e),this._eventBus.fire("copyPaste.elementsCopied",{elements:e,tree:i,hints:t}),i},Mn.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})}}},Mn.prototype.duplicate=function(e,t={}){var n=this.copy(e,{clip:!1});return this.paste({...t,tree:n})},Mn.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},Mn.prototype._getElementIdsFromTree=function(e){var t={};return M(e,function(n){M(n,function(i){i.id&&(t[i.id]=!0)})}),t},Mn.prototype._paste=function(e,t,n,i){M(e,function(o){we(o.x)||(o.x=0),we(o.y)||(o.y=0)});var r=At(e);return M(e,function(o){it(o)&&(o.waypoints=rn(o.waypoints,function(a){return{x:a.x-r.x-r.width/2,y:a.y-r.y-r.height/2}})),O(o,{x:o.x-r.x-r.width/2,y:o.y-r.y-r.height/2})}),this._modeling.createElements(e,n,t,O({},i))},Mn.prototype._createElements=function(e){var t=this,n=this._eventBus,i={},r=[];return M(e,function(o,a){o=oi(o,"priority"),M(o,function(s){var c=O({},ai(s,["priority"]));i[s.parent]?c.parent=i[s.parent]:delete c.parent,n.fire("copyPaste.pasteElement",{cache:i,descriptor:c});var u;if(it(c)){c.source=i[s.source],c.target=i[s.target],u=i[s.id]=t.createConnection(c),r.push(u);return}if(Me(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},Mn.prototype.createConnection=function(e){var t=this._elementFactory.createConnection(ai(e,["id"]));return t},Mn.prototype.createLabel=function(e){var t=this._elementFactory.createLabel(ai(e,["id"]));return t},Mn.prototype.createShape=function(e){var t=this._elementFactory.createShape(ai(e,["id"]));return t},Mn.prototype.hasRelations=function(e,t,n){return n||(n=new Set(t)),!(it(e)&&(!n.has(e.source)||!n.has(e.target))||Me(e)&&!n.has(e.labelTarget))},Mn.prototype.createTree=function(e){var t=this._rules,n=this,i={},r=[],o=new Map,a=xs(e);function s(p,f){return t.allowed("element.copy",{element:p,elements:f})}function c(p,f){var d=o.get(p);if(!d){var h={element:p,depth:f};r.push(h),o.set(p,h);return}if(d.depth<f){r=u(d,r);var m={element:d.element,depth:f};r.push(m),o.set(p,m)}}function u(p,f){var d=f.indexOf(p);return d!==-1&&f.splice(d,1),f}Or(a,function(p,f,d){if(Me(p))return;M(p.labels,function(g){c(g,d)});function h(g){g&&g.length&&M(g,function(R){M(R.labels,function(w){c(w,d)}),c(R,d)})}M([p.attachers,p.incoming,p.outgoing],h),c(p,d);var m=[];return p.children&&(m=p.children.slice()),n._eventBus.fire("copyPaste.createTree",{element:p,children:m}),m}),e=rn(r,function(p){return p.element});var l=new Set(e);return r=rn(r,function(p){return p.descriptor={},n._eventBus.fire("copyPaste.copyElement",{descriptor:p.descriptor,element:p.element,elements:e,elementsSet:l}),p}),r=oi(r,function(p){return p.descriptor.priority}),e=rn(r,function(p){return p.element}),M(r,function(p){var f=p.depth;if(!n.hasRelations(p.element,e,l)){dy(p.element,e),l.delete(p.element);return}if(!s(p.element,e)){dy(p.element,e),l.delete(p.element);return}i[f]||(i[f]=[]),i[f].push(p.descriptor)}),i};function OP(e){return!!e.host}function LP(e){return rn(e.waypoints,function(t){return t=fy(t),t.original&&(t.original=fy(t.original)),t})}function fy(e){return O({},e)}function dy(e,t){var n=t.indexOf(e);return n===-1?t:t.splice(n,1)}const IP={__depends__:[tP,uc,ma,gi],__init__:["copyPaste"],copyPaste:["type",Mn]};function bp(e,t,n){_e(n)||(n=[n]),M(n,function(i){Sr(e[i])||(t[i]=e[i])})}var xp=750;function hy(e,t,n){function i(c,u){var l=e.create(c.$type);return n.copyElement(c,l,null,u)}t.on("copyPaste.copyElement",xp,function(c){var u=c.descriptor,l=c.element,p=Z(l);if(Me(l))return u;var f=u.businessObject=i(p,!0),d=u.di=i(Ve(l),!0);d.bpmnElement=f,bp(f,u,"name"),bp(d,u,"isExpanded"),p.default&&(u.default=p.default.id)});var r="-bpmn-js-refs";function o(c){return c[r]=c[r]||{}}function a(c,u){c[r]=u}function s(c,u,l){var p=Z(c);return c.default&&(l[c.default]={element:p,property:"default"}),c.host&&(Z(c).attachedToRef=Z(u[c.host])),ai(l,Sn(l,function(f,d,h){var m=d.element,g=d.property;return h===c.id&&(m.set(g,p),f.push(c.id)),f},[]))}t.on("copyPaste.pasteElement",function(c){var u=c.cache,l=c.descriptor,p=l.businessObject,f=l.di;if(Me(l)){l.businessObject=Z(u[l.labelTarget]),l.di=Ve(u[l.labelTarget]);return}p=l.businessObject=i(p),f=l.di=i(f),f.bpmnElement=p,bp(l,p,["isExpanded","name"]),l.type=p.$type}),t.on("copyPaste.copyElement",xp,function(c){var u=c.descriptor,l=c.element;if(v(l,"bpmn:Participant")){var p=Z(l);p.processRef&&(u.processRef=i(p.processRef,!0))}}),t.on("copyPaste.pasteElement",function(c){var u=c.descriptor,l=u.processRef;l&&(u.processRef=i(l))}),t.on("copyPaste.createTree",function(c){var u=c.element,l=c.children;v(u,"bpmn:SubProcess")&&M(na(l),p=>{l.push(p.annotation)})}),t.on("copyPaste.pasteElement",xp,function(c){var u=c.cache,l=c.descriptor;a(u,s(l,u,o(u)))})}hy.$inject=["bpmnFactory","eventBus","moddleCopy"];const NP=["artifacts","dataInputAssociations","dataOutputAssociations","default","flowElements","lanes","incoming","outgoing","categoryValue"],BP=["errorRef","escalationRef","messageRef","signalRef","dataObjectRef"];function ga(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 oi(r,o=>o==="extensionElements")}),e.on("moddleCopy.canCopyProperty",i=>{const{parent:r,property:o,propertyName:a}=i,s=Gt(r)&&r.$descriptor;if(a&&BP.includes(a))return o;if(a&&NP.includes(a)||a&&s&&!st(s.properties,Jr({name:a})))return!1}),e.on("moddleCopy.canSetCopiedProperty",i=>{const{property:r}=i;if(v(r,"bpmn:ExtensionElements")&&(!r.values||!r.values.length))return!1})}ga.$inject=["eventBus","bpmnFactory","moddle"],ga.prototype.copyElement=function(e,t,n,i=!1){n&&!_e(n)&&(n=[n]),n=n||wp(e.$descriptor);const r=this._eventBus.fire("moddleCopy.canCopyProperties",{propertyNames:n,sourceElement:e,targetElement:t,clone:i});return r===!1||(_e(r)&&(n=r),M(n,o=>{let a;En(e,o)&&(a=e.get(o));const s=this.copyProperty(a,t,o,i);!$t(s)||this._eventBus.fire("moddleCopy.canSetCopiedProperty",{parent:t,property:s,propertyName:o})===!1||t.set(o,s)})),t},ga.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 Gt(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):_e(e)?Sn(e,(a,s)=>{const c=this.copyProperty(s,t,n,i);return c?a.concat(c):a},[]):Gt(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},ga.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 wp(e,t){return Sn(e.properties,(n,i)=>t&&i.default?n:n.concat(i.name),[])}const my={__depends__:[IP],__init__:["bpmnCopyPaste","moddleCopy"],bpmnCopyPaste:["type",hy],moddleCopy:["type",ga]};var gy=Math.round;function Ep(e,t){this._modeling=e,this._eventBus=t}Ep.$inject=["modeling","eventBus"],Ep.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=gy(s+o/2),l=gy(c+a/2),p=i.replaceShape(e,O({},t,{x:u,y:l,width:o,height:a}),n);return r.fire("replace.end",{element:e,newElement:p,hints:n}),p};function yy(e,t){t.on("replace.end",500,function(n){const{newElement:i,hints:r={}}=n;r.select!==!1&&e.select(i)})}yy.$inject=["selection","eventBus"];const $P={__init__:["replace","replaceSelectionBehavior"],replaceSelectionBehavior:["type",yy],replace:["type",Ep]};function jP(e,t,n){_e(n)||(n=[n]),M(n,function(i){Sr(e[i])||(t[i]=e[i])})}var FP=["cancelActivity","instantiate","eventGatewayType","triggeredByEvent","isInterrupting"];function HP(e,t){var n=e&&En(e,"collapsed")?e.collapsed:!$e(e),i;return t&&(En(t,"collapsed")||En(t,"isExpanded"))?i=En(t,"collapsed")?t.collapsed:!t.isExpanded:i=n,n!==i}function vy(e,t,n,i,r,o){function a(s,c,u){u=u||{};var l=c.type,p=s.businessObject;if(lc(p)&&(l==="bpmn:SubProcess"||l==="bpmn:AdHocSubProcess")&&HP(s,c))return i.toggleCollapse(s),s;var f=e.create(l),d={type:l,businessObject:f};d.di={},l==="bpmn:ExclusiveGateway"&&(d.di.isMarkerVisible=!0),jP(s.di,d.di,["fill","stroke","background-color","border-color","color"]);var h=wp(p.$descriptor),m=wp(f.$descriptor,!0),g=zP(h,m);O(f,ni(c,FP));var R=Oe(g,function(x){return x==="eventDefinitions"?_y(s,c.eventDefinitionType):x==="loopCharacteristics"?!cn(f):En(f,x)||x==="processRef"&&c.isExpanded===!1||x==="triggeredByEvent"?!1:x==="isForCompensation"?!cn(f):!0});if(f=n.copyElement(p,f,R),c.eventDefinitionType&&(_y(f,c.eventDefinitionType)||(d.eventDefinitionType=c.eventDefinitionType,d.eventDefinitionAttrs=c.eventDefinitionAttrs)),v(p,"bpmn:Activity")){if(lc(p))d.isExpanded=$e(s);else if(c&&En(c,"isExpanded")){d.isExpanded=c.isExpanded;var w=t.getDefaultSize(f,{isExpanded:d.isExpanded});d.width=w.width,d.height=w.height,d.x=s.x-(d.width-s.width)/2,d.y=s.y-(d.height-s.height)/2}$e(s)&&!v(p,"bpmn:Task")&&d.isExpanded&&(d.width=s.width,d.height=s.height)}if(lc(p)&&!lc(f)&&(u.moveChildren=!1),v(p,"bpmn:Participant")){c.isExpanded===!0?f.processRef=e.create("bpmn:Process"):u.moveChildren=!1;var b=Yt(s);Ve(s).isHorizontal||(Ve(d).isHorizontal=b),d.width=b?s.width:t.getDefaultSize(d).width,d.height=b?t.getDefaultSize(d).height:s.height}return o.allowed("shape.resize",{shape:f})||(d.height=t.getDefaultSize(d).height,d.width=t.getDefaultSize(d).width),f.name=p.name,De(p,["bpmn:ExclusiveGateway","bpmn:InclusiveGateway","bpmn:Activity"])&&De(f,["bpmn:ExclusiveGateway","bpmn:InclusiveGateway","bpmn:Activity"])&&(f.default=p.default),c.host&&!v(p,"bpmn:BoundaryEvent")&&v(f,"bpmn:BoundaryEvent")&&(d.host=c.host),(d.type==="bpmn:DataStoreReference"||d.type==="bpmn:DataObjectReference")&&(d.x=s.x+(s.width-d.width)/2),r.replaceElement(s,d,{...u,targetElement:c})}this.replaceElement=a}vy.$inject=["bpmnFactory","elementFactory","moddleCopy","modeling","replace","rules"];function lc(e){return v(e,"bpmn:SubProcess")}function _y(e,t){var n=Z(e);return t&&n.get("eventDefinitions").some(function(i){return v(i,t)})}function zP(e,t){return e.filter(function(n){return t.includes(n)})}const by={__depends__:[my,$P,qn],bpmnReplace:["type",vy]};var VP=250;function Fr(e){this._eventBus=e,this._tools=[],this._active=null}Fr.$inject=["eventBus"],Fr.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)},Fr.prototype.isActive=function(e){return e&&this._active===e},Fr.prototype.length=function(e){return this._tools.length},Fr.prototype.setActive=function(e){var t=this._eventBus;this._active!==e&&(this._active=e,t.fire("tool-manager.update",{tool:e}))},Fr.prototype.bindEvents=function(e,t){var n=this._eventBus,i=[];n.on(t.tool+".init",function(r){var o=r.context;if(!o.reactivate&&this.isActive(e)){this.setActive(null);return}this.setActive(e)},this),M(t,function(r){i.push(r+".ended"),i.push(r+".canceled")}),n.on(i,VP,function(r){this._active&&(GP(r)||this.setActive(null))},this)};function GP(e){var t=e.originalEvent&&e.originalEvent.target;return t&&kr(t,'.group[data-group="tools"]')}const pc={__depends__:[Li],__init__:["toolManager"],toolManager:["type",Fr]};function WP(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 UP(e,t){var n=[],i=new Set(e);M(t,function(o){i.add(o)});var r=new Set;return i.forEach(function(o){var a=o.incoming,s=o.outgoing;M(a.concat(s),function(c){var u=c.source,l=c.target;(i.has(u)||i.has(l))&&(r.has(c)||(r.add(c),n.push(c)))})}),n}function YP(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 Sp=Math.abs,qP=Math.round,Ii={x:"width",y:"height"},xy="crosshair",cr={n:"top",w:"left",s:"bottom",e:"right"},KP=1500,fc={n:"s",w:"e",s:"n",e:"w"},dc=20;function Kn(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",KP,function(c){var u=c.context,l=u.initialized;l||(l=u.initialized=s.init(c,u)),l&&Ey(c)}),n.on("spaceTool.end",function(c){var u=c.context,l=u.axis,p=u.direction,f=u.movingShapes,d=u.resizingShapes,h=u.start;if(u.initialized){Ey(c);var m={x:0,y:0};m[l]=qP(c["d"+l]),s.makeSpace(f,d,m,p,h),n.once("spaceTool.ended",function(g){s.activateSelection(g.originalEvent,!0,!0)})}})}Kn.$inject=["canvas","dragging","eventBus","modeling","rules","toolManager","mouse"],Kn.prototype.activateSelection=function(e,t,n){this._dragging.init(e,"spaceTool.selection",{autoActivate:t,cursor:xy,data:{context:{reactivate:n}},trapClick:!1})},Kn.prototype.activateMakeSpace=function(e){this._dragging.init(e,"spaceTool",{autoActivate:!0,cursor:xy,data:{context:{}}})},Kn.prototype.makeSpace=function(e,t,n,i,r){return this._modeling.createSpace(e,t,n,i,r)},Kn.prototype.init=function(e,t){var n=Sp(e.dx)>Sp(e.dy)?"x":"y",i=e["d"+n],r=e[n]-i;if(Sp(i)<5)return!1;i<0&&(i*=-1),fa(e)&&(i*=-1);var o=WP(n,i),a=this._canvas.getRootElement();!ec(e)&&e.hover&&(a=e.hover);var s=[...Xo(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=XP(c,n,o,r,u);return O(t,c,{axis:n,direction:o,spaceToolConstraints:l,start:r}),cc("resize-"+(n==="x"?"ew":"ns")),!0},Kn.prototype.calculateAdjustments=function(e,t,n,i){var r=this._rules,o=[],a=[],s=new Set,c=new Set,u=[],l=[];function p(d){s.has(d)||(s.add(d),o.push(d));var h=d.label;h&&!s.has(h)&&(s.add(h),o.push(h))}function f(d){c.has(d)||(c.add(d),a.push(d))}return M(e,function(d){if(!(!d.parent||Me(d))){if(it(d)){l.push(d);return}var h=d[t],m=h+d[Ii[t]];if(ZP(d)&&(n>0&&be(d)[t]>i||n<0&&be(d)[t]<i)){u.push(d);return}if(n>0&&h>i||n<0&&m<i){p(d);return}if(h<i&&m>i&&r.allowed("shape.resize",{shape:d})){f(d);return}}}),M(o,function(d){var h=d.attachers;h&&M(h,function(m){p(m)})}),M(u,function(d){var h=d.host;(s.has(h)||c.has(h))&&p(d)}),M(l,function(d){var h=d.source,m=d.target,g=d.label;(s.has(h)||c.has(h))&&(s.has(m)||c.has(m))&&g&&p(g)}),{movingShapes:o,resizingShapes:a}},Kn.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateSelection(e,!!e)},Kn.prototype.isActive=function(){var e=this._dragging.context();return e?/^spaceTool/.test(e.prefix):!1};function wy(e){return{top:e.top-dc,right:e.right+dc,bottom:e.bottom+dc,left:e.left-dc}}function Ey(e){var t=e.context,n=t.spaceToolConstraints;if(n){var i,r;we(n.left)&&(i=Math.max(e.x,n.left),e.dx=e.dx+i-e.x,e.x=i),we(n.right)&&(i=Math.min(e.x,n.right),e.dx=e.dx+i-e.x,e.x=i),we(n.top)&&(r=Math.max(e.y,n.top),e.dy=e.dy+r-e.y,e.y=r),we(n.bottom)&&(r=Math.min(e.y,n.bottom),e.dy=e.dy+r-e.y,e.y=r)}}function XP(e,t,n,i,r){var o=e.movingShapes,a=e.resizingShapes;if(a.length){var s={},c,u,l=new Set(o),p=new Set(a);return M(a,function(f){var d=f.attachers,h=f.children,m=ye(f),g=Oe(h,function(G){return!it(G)&&!Me(G)&&!l.has(G)&&!p.has(G)}),R=Oe(h,function(G){return!it(G)&&!Me(G)&&l.has(G)}),w,b,x,E=[],T=[],L,A,j,H;g.length&&(b=wy(ye(At(g))),w=i-m[cr[n]]+b[cr[n]],n==="n"?s.bottom=u=we(u)?Math.min(u,w):w:n==="w"?s.right=u=we(u)?Math.min(u,w):w:n==="s"?s.top=c=we(c)?Math.max(c,w):w:n==="e"&&(s.left=c=we(c)?Math.max(c,w):w)),R.length&&(x=wy(ye(At(R))),w=i-x[cr[fc[n]]]+m[cr[fc[n]]],n==="n"?s.bottom=u=we(u)?Math.min(u,w):w:n==="w"?s.right=u=we(u)?Math.min(u,w):w:n==="s"?s.top=c=we(c)?Math.max(c,w):w:n==="e"&&(s.left=c=we(c)?Math.max(c,w):w)),d&&d.length&&(d.forEach(function(G){l.has(G)?E.push(G):T.push(G)}),E.length&&(L=ye(At(E.map(be))),A=m[cr[fc[n]]]-(L[cr[fc[n]]]-i)),T.length&&(j=ye(At(T.map(be))),H=j[cr[n]]-(m[cr[n]]-i)),n==="n"?(w=Math.min(A||1/0,H||1/0),s.bottom=u=we(u)?Math.min(u,w):w):n==="w"?(w=Math.min(A||1/0,H||1/0),s.right=u=we(u)?Math.min(u,w):w):n==="s"?(w=Math.max(A||-1/0,H||-1/0),s.top=c=we(c)?Math.max(c,w):w):n==="e"&&(w=Math.max(A||-1/0,H||-1/0),s.left=c=we(c)?Math.max(c,w):w));var N=r&&r[f.id];N&&(n==="n"?(w=i+f[Ii[t]]-N[Ii[t]],s.bottom=u=we(u)?Math.min(u,w):w):n==="w"?(w=i+f[Ii[t]]-N[Ii[t]],s.right=u=we(u)?Math.min(u,w):w):n==="s"?(w=i-f[Ii[t]]+N[Ii[t]],s.top=c=we(c)?Math.max(c,w):w):n==="e"&&(w=i-f[Ii[t]]+N[Ii[t]],s.left=c=we(c)?Math.max(c,w):w))}),s}}function ZP(e){return!!e.host}var Rp="djs-dragging",Sy="djs-resizing",QP=250,hc=Math.max;function Ry(e,t,n,i,r){function o(a,s){M(a,function(c){r.addDragger(c,s),n.addMarker(c,Rp)})}e.on("spaceTool.selection.start",function(a){var s=n.getLayer("space"),c=a.context,u={x:"M 0,-10000 L 0,10000",y:"M -10000,0 L 10000,0"},l=me("g");re(l,i.cls("djs-crosshair-group",["no-events"])),Re(s,l);var p=me("path");re(p,"d",u.x),je(p).add("djs-crosshair"),Re(l,p);var f=me("path");re(f,"d",u.y),je(f).add("djs-crosshair"),Re(l,f),c.crosshairGroup=l}),e.on("spaceTool.selection.move",function(a){var s=a.context.crosshairGroup;Qt(s,a.x,a.y)}),e.on("spaceTool.selection.cleanup",function(a){var s=a.context,c=s.crosshairGroup;c&&Ft(c)}),e.on("spaceTool.move",QP,function(a){var s=a.context,c=s.line,u=s.axis,l=s.movingShapes,p=s.resizingShapes;if(s.initialized){if(!s.dragGroup){var f=n.getLayer("space");c=me("path"),re(c,"d","M0,0 L0,0"),je(c).add("djs-crosshair"),Re(f,c),s.line=c;var d=me("g");re(d,i.cls("djs-drag-group",["no-events"])),Re(n.getActiveLayer(),d),o(l,d);var h=new Set(l);M(p,function(T){h.add(T)});var m=new Set,g=s.movingConnections=[];h.forEach(function(T){M(T.outgoing,function(L){m.has(L)||!it(L)||!h.has(L.target)||(m.add(L),g.push(L))})}),o(g,d),s.dragGroup=d}if(!s.frameGroup){var R=me("g");re(R,i.cls("djs-frame-group",["no-events"])),Re(n.getActiveLayer(),R);var w=[];M(p,function(T){var L=r.addFrame(T,R),A=L.getBBox();w.push({element:L,initialBounds:A}),n.addMarker(T,Sy)}),s.frameGroup=R,s.frames=w}var b={x:"M"+a.x+", -10000 L"+a.x+", 10000",y:"M -10000, "+a.y+" L 10000, "+a.y};re(c,{d:b[u]});var x={x:"y",y:"x"},E={x:a.dx,y:a.dy};E[x[s.axis]]=0,Qt(s.dragGroup,E.x,E.y),M(s.frames,function(T){var L=T.element,A=T.initialBounds,j,H;s.direction==="e"?re(L,{width:hc(A.width+E.x,5)}):(j=hc(A.width-E.x,5),re(L,{width:j,x:A.x+A.width-j})),s.direction==="s"?re(L,{height:hc(A.height+E.y,5)}):(H=hc(A.height-E.y,5),re(L,{height:H,y:A.y+A.height-H}))})}}),e.on("spaceTool.cleanup",function(a){var s=a.context,c=s.movingShapes,u=s.movingConnections,l=s.resizingShapes,p=s.line,f=s.dragGroup,d=s.frameGroup;M(c,function(h){n.removeMarker(h,Rp)}),M(u,function(h){n.removeMarker(h,Rp)}),f&&(Ft(p),Ft(f)),M(l,function(h){n.removeMarker(h,Sy)}),d&&Ft(d)})}Ry.$inject=["eventBus","elementRegistry","canvas","styles","previewSupport"];const JP={__init__:["spaceToolPreview"],__depends__:[Li,gi,pc,Ro,ma],spaceTool:["type",Kn],spaceToolPreview:["type",Ry]};function mc(e,t){e.invoke(Kn,this),this._canvas=t}mc.$inject=["injector","canvas"],ie(mc,Kn),mc.prototype.calculateAdjustments=function(e,t,n,i){var r=this._canvas.getRootElement(),o=e[0]===r?null:e[0],a=[];o&&(a=Zr(ao(r.children.filter(u=>v(u,"bpmn:Artifact")),At(o))));const s=[...e,...a];var c=Kn.prototype.calculateAdjustments.call(this,s,t,n,i);return c.resizingShapes=c.resizingShapes.filter(function(u){return!(v(u,"bpmn:TextAnnotation")||eA(u)&&(t==="y"&&Yt(u)||t==="x"&&!Yt(u)))}),c};function eA(e){return v(e,"bpmn:Participant")&&!Z(e).processRef}const Cy={__depends__:[JP],spaceTool:["type",mc]};function vt(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)}vt.$inject=["eventBus","injector"],vt.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()},vt.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},vt.prototype.clear=function(e){this._stack.length=0,this._stackIdx=-1,e!==!1&&this._fire("changed",{trigger:"clear"})},vt.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()}},vt.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()}},vt.prototype.register=function(e,t){this._setHandler(e,t)},vt.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)},vt.prototype.canUndo=function(){return!!this._getUndoAction()},vt.prototype.canRedo=function(){return!!this._getRedoAction()},vt.prototype._getRedoAction=function(){return this._stack[this._stackIdx+1]},vt.prototype._getUndoAction=function(){return this._stack[this._stackIdx]},vt.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)})},vt.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},vt.prototype._createId=function(){return this._uid++},vt.prototype._atomicDo=function(e){const t=this._currentExecution;t.atomic=!0;try{e()}finally{t.atomic=!1}},vt.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()},vt.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)},vt.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:Uf("id",i.reverse())}),i.length=0,this._fire("changed",{trigger:t}),e.trigger=null)},vt.prototype._markDirty=function(e){const t=this._currentExecution;e&&(e=_e(e)?e:[e],t.dirty=t.dirty.concat(e))},vt.prototype._executedAction=function(e,t){const n=++this._stackIdx;t||this._stack.splice(n,this._stack.length,e)},vt.prototype._revertedAction=function(e){this._stackIdx--},vt.prototype._getHandler=function(e){return this._handlerMap[e]},vt.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 tA={commandStack:["type",vt]};function ur(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 nA=250,Py=1400;function Cp(e,t,n){X.call(this,t);var i=e.get("movePreview",!1);t.on("shape.move.start",Py,function(r){var o=r.context,a=o.shapes,s=o.validatedShapes;o.shapes=Ay(a),o.validatedShapes=Ay(s)}),i&&t.on("shape.move.start",nA,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",Py,function(r){var o=r.context,a=o.closure,s=a.enclosedElements,c=[];M(s,function(u){M(u.labels,function(l){s[l.id]||c.push(l)})}),a.addAll(c)}),this.preExecute(["connection.delete","shape.delete"],function(r){var o=r.context,a=o.connection||o.shape;ur(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=ol(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&&(St(s.labels,a,c),a.labelTarget=s)})}ie(Cp,X),Cp.$inject=["injector","eventBus","modeling"];function Ay(e){var t=new Set(e);return Oe(e,function(n){return!t.has(n.labelTarget)})}const iA={__init__:["labelSupport"],labelSupport:["type",Cp]};var rA=251,Ty=1401,My="attach-ok";function Pp(e,t,n,i,r){X.call(this,t);var o=e.get("movePreview",!1);t.on("shape.move.start",Ty,function(a){var s=a.context,c=s.shapes,u=s.validatedShapes;s.shapes=oA(c),s.validatedShapes=aA(u)}),o&&t.on("shape.move.start",rA,function(a){var s=a.context,c=s.shapes,u=Ap(c);M(u,function(l){o.makeDraggable(s,l,!0),M(l.labels,function(p){o.makeDraggable(s,p,!0)})})}),o&&t.on("shape.move.start",function(a){var s=a.context,c=s.shapes;if(c.length===1){var u=c[0],l=u.host;l&&(n.addMarker(l,My),t.once(["shape.move.out","shape.move.cleanup"],function(){n.removeMarker(l,My)}))}}),this.preExecuted("elements.move",Ty,function(a){var s=a.context,c=s.closure,u=s.shapes,l=Ap(u);M(l,function(p){c.add(p,c.topLevel[p.host.id])})}),this.postExecuted("elements.move",function(a){var s=a.context,c=s.shapes,u=s.newHost,l;u&&c.length!==1||(u?l=c:l=Oe(c,function(p){var f=p.host;return sA(p)&&!cA(c,f)}),M(l,function(p){r.updateAttachment(p,u)}))}),this.postExecuted("elements.move",function(a){var s=a.context.shapes;M(s,function(c){M(c.attachers,function(u){M(u.outgoing.slice(),function(l){var p=i.allowed("connection.reconnect",{connection:l,source:l.source,target:l.target});p||r.removeConnection(l)}),M(u.incoming.slice(),function(l){var p=i.allowed("connection.reconnect",{connection:l,source:l.source,target:l.target});p||r.removeConnection(l)})})})}),this.postExecute("shape.create",function(a){var s=a.context,c=s.shape,u=s.host;u&&r.updateAttachment(c,u)}),this.postExecute("shape.replace",function(a){var s=a.context,c=s.oldShape,u=s.newShape;ur(c.attachers,function(l){var p=i.allowed("elements.move",{target:u,shapes:[l]});p==="attach"?r.updateAttachment(l,u):r.removeShape(l)}),u.attachers.length&&M(u.attachers,function(l){var p=qm(l,c,u);r.moveShape(l,p,l.parent)})}),this.postExecute("shape.resize",function(a){var s=a.context,c=s.shape,u=s.oldBounds,l=s.newBounds,p=c.attachers,f=s.hints||{};f.attachSupport!==!1&&M(p,function(d){var h=qm(d,u,l);r.moveShape(d,h,d.parent),M(d.labels,function(m){r.moveShape(m,h,m.parent)})})}),this.preExecute("shape.delete",function(a){var s=a.context.shape;ur(s.attachers,function(c){r.removeShape(c)}),s.host&&r.updateAttachment(s,null)})}ie(Pp,X),Pp.$inject=["injector","eventBus","canvas","rules","modeling"];function Ap(e){return Eu(rn(e,function(t){return t.attachers||[]}))}function oA(e){var t=Ap(e);return Kx("id",e,t)}function aA(e){var t=Qr(e,"id");return Oe(e,function(n){for(;n;){if(n.host&&t[n.host.id])return!1;n=n.parent}return!0})}function sA(e){return!!e.host}function cA(e,t){return e.indexOf(t)!==-1}const uA={__depends__:[gi],__init__:["attachSupport"],attachSupport:["type",Pp]};function ky(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(Eh(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)})}ky.$inject=["eventBus","canvas","elementRegistry","graphicsFactory"];const Tp={__init__:["changeSupport"],changeSupport:["type",ky]};function Xn(e){this._model=e}Xn.$inject=["moddle"],Xn.prototype._needsId=function(e){return De(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"])},Xn.prototype._ensureId=function(e){if(e.id){this._model.ids.claim(e.id,e);return}var t;v(e,"bpmn:Activity")?t="Activity":v(e,"bpmn:Event")?t="Event":v(e,"bpmn:Gateway")?t="Gateway":De(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))},Xn.prototype.create=function(e,t){var n=this._model.create(e,t||{});return this._ensureId(n),n},Xn.prototype.createDiLabel=function(){return this.create("bpmndi:BPMNLabel",{bounds:this.createDiBounds()})},Xn.prototype.createDiShape=function(e,t){return this.create("bpmndi:BPMNShape",O({bpmnElement:e,bounds:this.createDiBounds()},t))},Xn.prototype.createDiBounds=function(e){return this.create("dc:Bounds",e)},Xn.prototype.createDiWaypoints=function(e){var t=this;return rn(e,function(n){return t.createDiWaypoint(n)})},Xn.prototype.createDiWaypoint=function(e){return this.create("dc:Point",ni(e,["x","y"]))},Xn.prototype.createDiEdge=function(e,t){return this.create("bpmndi:BPMNEdge",O({bpmnElement:e,waypoint:this.createDiWaypoints([])},t))},Xn.prototype.createDiPlane=function(e,t){return this.create("bpmndi:BPMNPlane",O({bpmnElement:e},t))};function kn(e,t,n){X.call(this,e),this._bpmnFactory=t;var i=this;function r(d){var h=d.context,m=h.hints||{},g;!h.cropped&&m.createElementsBehavior!==!1&&(g=h.connection,g.waypoints=n.getCroppedWaypoints(g),h.cropped=!0)}this.executed(["connection.layout","connection.create"],r),this.reverted(["connection.layout"],function(d){delete d.context.cropped});function o(d){var h=d.context;i.updateParent(h.shape||h.connection,h.oldParent)}function a(d){var h=d.context,m=h.shape||h.connection,g=h.parent||h.newParent;i.updateParent(m,g)}this.executed(["shape.move","shape.create","shape.delete","connection.create","connection.move","connection.delete"],Dn(o)),this.reverted(["shape.move","shape.create","shape.delete","connection.create","connection.move","connection.delete"],Dn(a));function s(d){var h=d.context,m=h.oldRoot,g=m.children;M(g,function(R){v(R,"bpmn:BaseElement")&&i.updateParent(R)})}this.executed(["canvas.updateRoot"],s),this.reverted(["canvas.updateRoot"],s);function c(d){var h=d.context.shape;v(h,"bpmn:BaseElement")&&i.updateBounds(h)}this.executed(["shape.move","shape.create","shape.resize"],Dn(function(d){d.context.shape.type!=="label"&&c(d)})),this.reverted(["shape.move","shape.create","shape.resize"],Dn(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"],Dn(u)),this.reverted(["connection.create","connection.move","connection.delete","connection.reconnect"],Dn(u));function l(d){i.updateConnectionWaypoints(d.context.connection)}this.executed(["connection.layout","connection.move","connection.updateWaypoints"],Dn(l)),this.reverted(["connection.layout","connection.move","connection.updateWaypoints"],Dn(l)),this.executed("connection.reconnect",Dn(function(d){var h=d.context,m=h.connection,g=h.oldSource,R=h.newSource,w=Z(m),b=Z(g),x=Z(R);w.conditionExpression&&!De(x,["bpmn:Activity","bpmn:ExclusiveGateway","bpmn:InclusiveGateway"])&&(h.oldConditionExpression=w.conditionExpression,delete w.conditionExpression),g!==R&&b.default===w&&(h.oldDefault=b.default,delete b.default)})),this.reverted("connection.reconnect",Dn(function(d){var h=d.context,m=h.connection,g=h.oldSource,R=h.newSource,w=Z(m),b=Z(g),x=Z(R);h.oldConditionExpression&&(w.conditionExpression=h.oldConditionExpression),h.oldDefault&&(b.default=h.oldDefault,delete x.default)}));function p(d){i.updateAttachment(d.context)}this.executed(["element.updateAttachment"],Dn(p)),this.reverted(["element.updateAttachment"],Dn(p)),this.executed("element.updateLabel",Dn(f)),this.reverted("element.updateLabel",Dn(f));function f(d){const{element:h}=d.context,m=jn(h),g=Ve(h),R=g&&g.get("label");nr(h)||tc(h)||(m&&!R?g.set("label",t.create("bpmndi:BPMNLabel")):!m&&R&&g.set("label",void 0))}}ie(kn,X),kn.$inject=["eventBus","bpmnFactory","connectionDocking"],kn.prototype.updateAttachment=function(e){var t=e.shape,n=t.businessObject,i=t.host;n.attachedToRef=i&&i.businessObject},kn.prototype.updateParent=function(e,t){if(!Me(e)&&!(v(e,"bpmn:DataStoreReference")&&e.parent&&v(e.parent,"bpmn:Collaboration"))){var n=e.parent,i=e.businessObject,r=Ve(e),o=n&&n.businessObject,a=Ve(n);v(e,"bpmn:FlowNode")&&this.updateFlowNodeRefs(i,o,t&&t.businessObject),v(e,"bpmn:DataOutputAssociation")&&(e.source?o=e.source.businessObject:o=null),v(e,"bpmn:DataInputAssociation")&&(e.target?o=e.target.businessObject:o=null),this.updateSemanticParent(i,o),v(e,"bpmn:DataObjectReference")&&i.dataObjectRef&&this.updateSemanticParent(i.dataObjectRef,o),this.updateDiParent(r,a)}},kn.prototype.updateBounds=function(e){var t=Ve(e),n=pA(e);if(n){var i=ii(n,t.get("bounds"));O(n,{x:e.x+i.x,y:e.y+i.y})}var r=Me(e)?this._getLabel(t):t,o=r.bounds;o||(o=this._bpmnFactory.createDiBounds(),r.set("bounds",o)),O(o,{x:e.x,y:e.y,width:e.width,height:e.height})},kn.prototype.updateFlowNodeRefs=function(e,t,n){if(n!==t){var i,r;v(n,"bpmn:Lane")&&(i=n.get("flowNodeRef"),wt(i,e)),v(t,"bpmn:Lane")&&(r=t.get("flowNodeRef"),St(r,e))}},kn.prototype.updateDiConnection=function(e,t,n){var i=Ve(e),r=Ve(t),o=Ve(n);i.sourceElement&&i.sourceElement.bpmnElement!==Z(t)&&(i.sourceElement=t&&r),i.targetElement&&i.targetElement.bpmnElement!==Z(n)&&(i.targetElement=n&&o)},kn.prototype.updateDiParent=function(e,t){if(t&&!v(t,"bpmndi:BPMNPlane")&&(t=t.$parent),e.$parent!==t){var n=(t||e.$parent).get("planeElement");t?(n.push(e),e.$parent=t):(wt(n,e),e.$parent=null)}};function lA(e){for(;e&&!v(e,"bpmn:Definitions");)e=e.$parent;return e}kn.prototype.getLaneSet=function(e){var t,n;return v(e,"bpmn:Lane")?(t=e.childLaneSet,t||(t=this._bpmnFactory.create("bpmn:LaneSet"),e.childLaneSet=t,t.$parent=e),t):(v(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)},kn.prototype.updateSemanticParent=function(e,t,n){var i;if(e.$parent!==t&&!((v(e,"bpmn:DataInput")||v(e,"bpmn:DataOutput"))&&(v(t,"bpmn:Participant")&&"processRef"in t&&(t=t.processRef),"ioSpecification"in t&&t.ioSpecification===e.$parent))){if(v(e,"bpmn:Lane"))t&&(t=this.getLaneSet(t)),i="lanes";else if(v(e,"bpmn:FlowElement")){if(t){if(v(t,"bpmn:Participant"))t=t.processRef;else if(v(t,"bpmn:Lane"))do t=t.$parent.$parent;while(v(t,"bpmn:Lane"))}i="flowElements"}else if(v(e,"bpmn:Artifact")){for(;t&&!v(t,"bpmn:Process")&&!v(t,"bpmn:SubProcess")&&!v(t,"bpmn:Collaboration");)if(v(t,"bpmn:Participant")){t=t.processRef;break}else t=t.$parent;i="artifacts"}else if(v(e,"bpmn:MessageFlow"))i="messageFlows";else if(v(e,"bpmn:Participant")){i="participants";var r=e.processRef,o;r&&(o=lA(e.$parent||t),e.$parent&&(wt(o.get("rootElements"),r),r.$parent=null),t&&(St(o.get("rootElements"),r),r.$parent=o))}else v(e,"bpmn:DataOutputAssociation")?i="dataOutputAssociations":v(e,"bpmn:DataInputAssociation")&&(i="dataInputAssociations");if(!i)throw new Error(`no parent for <${e.id}> in <${t.id}>`);var a;if(e.$parent&&(a=e.$parent.get(i),wt(a,e)),t?(a=t.get(i),a.push(e),e.$parent=t):e.$parent=null,n){var s=n.get(i);wt(a,e),t&&(s||(s=[],t.set(i,s)),s.push(e))}}},kn.prototype.updateConnectionWaypoints=function(e){var t=Ve(e);t.set("waypoint",this._bpmnFactory.createDiWaypoints(e.waypoints))},kn.prototype.updateConnection=function(e){var t=e.connection,n=Z(t),i=t.source,r=Z(i),o=t.target,a=Z(t.target),s;if(v(n,"bpmn:DataAssociation"))v(n,"bpmn:DataInputAssociation")?(n.get("sourceRef")[0]=r,s=e.parent||e.newParent||a,this.updateSemanticParent(n,a,s)):v(n,"bpmn:DataOutputAssociation")&&(s=e.parent||e.newParent||r,this.updateSemanticParent(n,r,s),n.targetRef=a);else{var c=v(n,"bpmn:SequenceFlow");n.sourceRef!==r&&(c&&(wt(n.sourceRef&&n.sourceRef.get("outgoing"),n),r&&r.get("outgoing")&&r.get("outgoing").push(n)),n.sourceRef=r),n.targetRef!==a&&(c&&(wt(n.targetRef&&n.targetRef.get("incoming"),n),a&&a.get("incoming")&&a.get("incoming").push(n)),n.targetRef=a)}this.updateConnectionWaypoints(t),this.updateDiConnection(t,i,o)},kn.prototype._getLabel=function(e){return e.label||(e.label=this._bpmnFactory.createDiLabel()),e.label};function Dn(e){return function(t){var n=t.context,i=n.shape||n.connection||n.element;v(i,"bpmn:BaseElement")&&e(t)}}function pA(e){if(v(e,"bpmn:Activity")){var t=Ve(e);if(t){var n=t.get("label");if(n)return n.get("bounds")}}}function lr(e,t){Mi.call(this),this._bpmnFactory=e,this._moddle=t}ie(lr,Mi),lr.$inject=["bpmnFactory","moddle"],lr.prototype._baseCreate=Mi.prototype.create,lr.prototype.create=function(e,t){if(e==="label"){var n=t.di||this._bpmnFactory.createDiLabel();return this._baseCreate(e,O({type:"label",di:n},Ir,t))}return this.createElement(e,t)},lr.prototype.createElement=function(e,t){t=O({},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(!dA(r)){var o=O({},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)}v(i,"bpmn:Group")&&(t=O({isFrame:!0},t)),t=fA(i,t,["processRef","isInterrupting","associationDirection","isForCompensation"]),t.isExpanded&&(t=Mp(r,t,"isExpanded")),De(i,["bpmn:Lane","bpmn:Participant"])&&(t=Mp(r,t,"isHorizontal")),v(i,"bpmn:SubProcess")&&(t.collapsed=!$e(i,r)),v(i,"bpmn:ExclusiveGateway")&&(En(r,"isMarkerVisible")?r.isMarkerVisible===void 0&&(r.isMarkerVisible=!1):r.isMarkerVisible=!0),$t(t.triggeredByEvent)&&(i.triggeredByEvent=t.triggeredByEvent,delete t.triggeredByEvent),$t(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=O({id:i.id},n,t,{businessObject:i,di:r}),this._baseCreate(e,t)},lr.prototype.getDefaultSize=function(e,t){var n=Z(e);if(t=t||Ve(e),v(n,"bpmn:SubProcess"))return $e(n,t)?{width:350,height:200}:{width:100,height:80};if(v(n,"bpmn:Task"))return{width:100,height:80};if(v(n,"bpmn:Gateway"))return{width:50,height:50};if(v(n,"bpmn:Event"))return{width:36,height:36};if(v(n,"bpmn:Participant")){var i=t.isHorizontal===void 0||t.isHorizontal===!0;return $e(n,t)?i?{width:600,height:250}:{width:250,height:600}:i?{width:400,height:60}:{width:60,height:400}}return v(n,"bpmn:Lane")?{width:400,height:100}:v(n,"bpmn:DataObjectReference")?{width:36,height:50}:v(n,"bpmn:DataStoreReference")?{width:50,height:50}:v(n,"bpmn:TextAnnotation")?{width:100,height:40}:v(n,"bpmn:Group")?{width:300,height:300}:{width:100,height:80}},lr.prototype.createParticipantShape=function(e){return Gt(e)||(e={isExpanded:e}),e=O({type:"bpmn:Participant"},e||{}),e.isExpanded!==!1&&(e.processRef=this._bpmnFactory.create("bpmn:Process")),this.createShape(e)};function fA(e,t,n){return M(n,function(i){t=Mp(e,t,i)}),t}function Mp(e,t,n){return t[n]===void 0?t:(e[n]=t[n],ai(t,[n]))}function dA(e){return De(e,["bpmndi:BPMNShape","bpmndi:BPMNEdge","bpmndi:BPMNDiagram","bpmndi:BPMNPlane"])}function gc(e,t){this._modeling=e,this._canvas=t}gc.$inject=["modeling","canvas"],gc.prototype.preExecute=function(e){var t=this._modeling,n=e.elements,i=e.alignment;M(n,function(r){var o={x:0,y:0};$t(i.left)?o.x=i.left-r.x:$t(i.right)?o.x=i.right-r.width-r.x:$t(i.center)?o.x=i.center-Math.round(r.width/2)-r.x:$t(i.top)?o.y=i.top-r.y:$t(i.bottom)?o.y=i.bottom-r.height-r.y:$t(i.middle)&&(o.y=i.middle-Math.round(r.height/2)-r.y),t.moveElements([r],o,r.parent)})},gc.prototype.postExecute=function(e){};function yc(e){this._modeling=e}yc.$inject=["modeling"],yc.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},yc.prototype.postExecute=function(e){var t=e.hints||{};hA(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 hA(e,t){return Vi(e.outgoing,function(n){return n.target===t})}function vc(e,t){this._canvas=e,this._layouter=t}vc.$inject=["canvas","layouter"],vc.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},vc.prototype.revert=function(e){var t=e.connection;return this._canvas.removeConnection(t),t.source=null,t.target=null,t};var _c=Math.round;function kp(e){this._modeling=e}kp.$inject=["modeling"],kp.prototype.preExecute=function(e){var t=e.elements,n=e.parent,i=e.parentIndex,r=e.position,o=e.hints,a=this._modeling;M(t,function(p){we(p.x)||(p.x=0),we(p.y)||(p.y=0)});var s=Oe(t,function(p){return!p.hidden}),c=At(s);M(t,function(p){it(p)&&(p.waypoints=rn(p.waypoints,function(f){return{x:_c(f.x-c.x-c.width/2+r.x),y:_c(f.y-c.y-c.height/2+r.y)}})),O(p,{x:_c(p.x-c.x-c.width/2+r.x),y:_c(p.y-c.y-c.height/2+r.y)})});var u=new Set(xs(t)),l={};M(t,function(p){if(it(p)){l[p.id]=we(i)?a.createConnection(l[p.source.id],l[p.target.id],i,p,p.parent||n,o):a.createConnection(l[p.source.id],l[p.target.id],p,p.parent||n,o);return}var f=O({},o);u.has(p)||(f.autoResize=!1),Me(p)&&(f=ai(f,["attach"])),l[p.id]=we(i)?a.createShape(p,ni(p,["x","y","width","height"]),p.parent||n,i,f):a.createShape(p,ni(p,["x","y","width","height"]),p.parent||n,f)}),e.elements=Zr(l)};var Dy=Math.round;function pr(e){this._canvas=e}pr.$inject=["canvas"],pr.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?O(t,n):O(t,{x:n.x-Dy(t.width/2),y:n.y-Dy(t.height/2)}),this._canvas.addShape(t,i,r),t},pr.prototype.revert=function(e){var t=e.shape;return this._canvas.removeShape(t),t};function ya(e){pr.call(this,e)}ie(ya,pr),ya.$inject=["canvas"];var mA=pr.prototype.execute;ya.prototype.execute=function(e){var t=e.shape;return yA(t),t.labelTarget=e.labelTarget,mA.call(this,e)};var gA=pr.prototype.revert;ya.prototype.revert=function(e){return e.shape.labelTarget=null,gA.call(this,e)};function yA(e){["width","height"].forEach(function(t){typeof e[t]>"u"&&(e[t]=0)})}function va(e,t){this._canvas=e,this._modeling=t}va.$inject=["canvas","modeling"],va.prototype.preExecute=function(e){var t=this._modeling,n=e.connection;ur(n.incoming,function(i){t.removeConnection(i,{nested:!0})}),ur(n.outgoing,function(i){t.removeConnection(i,{nested:!0})})},va.prototype.execute=function(e){var t=e.connection,n=t.parent;return e.parent=n,e.parentIndex=ol(n.children,t),e.source=t.source,e.target=t.target,this._canvas.removeConnection(t),t.source=null,t.target=null,t},va.prototype.revert=function(e){var t=e.connection,n=e.parent,i=e.parentIndex;return t.source=e.source,t.target=e.target,St(n.children,t,i),this._canvas.addConnection(t,n),t};function Dp(e,t){this._modeling=e,this._elementRegistry=t}Dp.$inject=["modeling","elementRegistry"],Dp.prototype.postExecute=function(e){var t=this._modeling,n=this._elementRegistry,i=e.elements;M(i,function(r){n.get(r.id)&&(r.waypoints?t.removeConnection(r):t.removeShape(r))})};function _a(e,t){this._canvas=e,this._modeling=t}_a.$inject=["canvas","modeling"],_a.prototype.preExecute=function(e){var t=this._modeling,n=e.shape;ur(n.incoming,function(i){t.removeConnection(i,{nested:!0})}),ur(n.outgoing,function(i){t.removeConnection(i,{nested:!0})}),ur(n.children,function(i){it(i)?t.removeConnection(i,{nested:!0}):t.removeShape(i,{nested:!0})})},_a.prototype.execute=function(e){var t=this._canvas,n=e.shape,i=n.parent;return e.oldParent=i,e.oldParentIndex=ol(i.children,n),t.removeShape(n),n},_a.prototype.revert=function(e){var t=this._canvas,n=e.shape,i=e.oldParent,r=e.oldParentIndex;return St(i.children,n,r),t.addShape(n,i),n};function bc(e){this._modeling=e}bc.$inject=["modeling"];var Oy={x:"y",y:"x"};bc.prototype.preExecute=function(e){var t=this._modeling,n=e.groups,i=e.axis,r=e.dimension;function o(g,R){g.range.min=Math.min(R[i],g.range.min),g.range.max=Math.max(R[i]+R[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,R){var w={y:0};w[i]=g-a(R),w[i]&&(w[Oy[i]]=0,t.moveElements([R],w,R.parent))}var l=n[0],p=s(n),f=n[p],d,h,m=0;M(n,function(g,R){var w,b,x;if(g.elements.length<2){R&&R!==n.length-1&&(o(g,g.elements[0]),m+=c(g.range));return}w=oi(g.elements,i),b=w[0],R===p&&(b=w[s(w)]),x=a(b),g.range=null,M(w,function(E){if(u(x,E),g.range===null){g.range={min:E[i],max:E[i]+E[r]};return}o(g,E)}),R&&R!==n.length-1&&(m+=c(g.range))}),h=Math.abs(f.range.min-l.range.max),d=Math.round((h-m)/(n.length-1)),!(d<n.length-1)&&M(n,function(g,R){var w={},b;g===l||g===f||(b=n[R-1],g.range.max=0,M(g.elements,function(x,E){w[Oy[i]]=0,w[i]=b.range.max-x[i]+d,g.range.min!==x[i]&&(w[i]+=x[i]-g.range.min),w[i]&&t.moveElements([x],w,x.parent),g.range.max=Math.max(x[i]+x[r],E?g.range.max:0)}))})},bc.prototype.postExecute=function(e){};function xc(e,t){this._layouter=e,this._canvas=t}xc.$inject=["layouter","canvas"],xc.prototype.execute=function(e){var t=e.connection,n=t.waypoints;return O(e,{oldWaypoints:n}),t.waypoints=this._layouter.layoutConnection(t,e.hints),t},xc.prototype.revert=function(e){var t=e.connection;return t.waypoints=e.oldWaypoints,t};function Op(){}Op.prototype.execute=function(e){var t=e.connection,n=e.delta,i=e.newParent||t.parent,r=e.newParentIndex,o=t.parent;return e.oldParent=o,e.oldParentIndex=wt(o.children,t),St(i.children,t,r),t.parent=i,M(t.waypoints,function(a){a.x+=n.x,a.y+=n.y,a.original&&(a.original.x+=n.x,a.original.y+=n.y)}),t},Op.prototype.revert=function(e){var t=e.connection,n=t.parent,i=e.oldParent,r=e.oldParentIndex,o=e.delta;return wt(n.children,t),St(i.children,t,r),t.parent=i,M(t.waypoints,function(a){a.x-=o.x,a.y-=o.y,a.original&&(a.original.x-=o.x,a.original.y-=o.y)}),t};function Lp(){this.allShapes={},this.allConnections={},this.enclosedElements={},this.enclosedConnections={},this.topLevel={}}Lp.prototype.add=function(e,t){return this.addAll([e],t)},Lp.prototype.addAll=function(e,t){var n=YE(e,!!t,this);return O(this,n),this};function ba(e){this._modeling=e}ba.prototype.moveRecursive=function(e,t,n){return e?this.moveClosure(this.getClosure(e),t,n):[]},ba.prototype.moveClosure=function(e,t,n,i,r){var o=this._modeling,a=e.allShapes,s=e.allConnections,c=e.enclosedConnections,u=e.topLevel,l=!1;r&&r.parent===n&&(l=!0),M(a,function(p){o.moveShape(p,t,u[p.id]&&!l&&n,{recurse:!1,layout:!1})}),M(s,function(p){var f=!!a[p.source.id],d=!!a[p.target.id];c[p.id]&&f&&d?o.moveConnection(p,t,u[p.id]&&!l&&n):o.layoutConnection(p,{connectionStart:f&&Hl(p,p.source,t),connectionEnd:d&&zl(p,p.target,t)})})},ba.prototype.getClosure=function(e){return new Lp().addAll(e,!0)};function wc(e){this._helper=new ba(e)}wc.$inject=["modeling"],wc.prototype.preExecute=function(e){e.closure=this._helper.getClosure(e.shapes)},wc.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 ba(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=ni(t,["x","y","width","height"]),e.oldParent=o,e.oldParentIndex=wt(o.children,t),St(i.children,t,r),O(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&&(M(t.incoming,function(o){r.layoutConnection(o,{connectionEnd:zl(o,t,n)})}),M(t.outgoing,function(o){r.layoutConnection(o,{connectionStart:Hl(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 St(n.children,t,i),O(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 xa(e){this._modeling=e}xa.$inject=["modeling"],xa.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 _e(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},xa.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||Ly(_e(r)?r[0]:r)),i&&(!n||o.docking==="target")&&(a.connectionEnd=a.connectionEnd||Ly(_e(r)?r[r.length-1]:r)),o.newWaypoints&&(a.waypoints=o.newWaypoints),this._modeling.layoutConnection(t,a))},xa.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 Ly(e){return e.original||e}function Ni(e,t){this._modeling=e,this._rules=t}Ni.$inject=["modeling","rules"],Ni.prototype.preExecute=function(e){var t=this,n=this._modeling,i=this._rules,r=e.oldShape,o=e.newData,a=e.hints||{},s;function c(h,m,g){return i.allowed("connection.reconnect",{connection:g,source:h,target:m})}var u={x:o.x,y:o.y},l={x:r.x,y:r.y,width:r.width,height:r.height};s=e.newShape=e.newShape||t.createShape(o,u,r.parent,a),r.host&&n.updateAttachment(s,r.host);var p;a.moveChildren!==!1&&(p=r.children.slice(),n.moveElements(p,{x:0,y:0},s,a));var f=r.incoming.slice(),d=r.outgoing.slice();M(f,function(h){var m=h.source,g=c(m,s,h);g&&t.reconnectEnd(h,s,Ks(h,s,l),a)}),M(d,function(h){var m=h.target,g=c(s,m,h);g&&t.reconnectStart(h,s,qs(h,s,l),a)})},Ni.prototype.postExecute=function(e){var t=e.oldShape;this._modeling.removeShape(t)},Ni.prototype.execute=function(e){},Ni.prototype.revert=function(e){},Ni.prototype.createShape=function(e,t,n,i){return this._modeling.createShape(e,t,n,i)},Ni.prototype.reconnectStart=function(e,t,n,i){this._modeling.reconnectStart(e,t,n,i)},Ni.prototype.reconnectEnd=function(e,t,n,i){this._modeling.reconnectEnd(e,t,n,i)};function wa(e){this._modeling=e}wa.$inject=["modeling"],wa.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},O(t,{width:n.width,height:n.height,x:n.x,y:n.y}),t},wa.prototype.postExecute=function(e){var t=this._modeling,n=e.shape,i=e.oldBounds,r=e.hints||{};r.layout!==!1&&(M(n.incoming,function(o){t.layoutConnection(o,{connectionEnd:Ks(o,n,i)})}),M(n.outgoing,function(o){t.layoutConnection(o,{connectionStart:qs(o,n,i)})}))},wa.prototype.revert=function(e){var t=e.shape,n=e.oldBounds;return O(t,{width:n.width,height:n.height,x:n.x,y:n.y}),t};function fr(e){this._modeling=e}fr.$inject=["modeling"],fr.prototype.preExecute=function(e){var t=e.delta,n=e.direction,i=e.movingShapes,r=e.resizingShapes,o=e.start,a={};this.moveShapes(i,t),M(r,function(s){a[s.id]=_A(s)}),this.resizeShapes(r,t,n),this.updateConnectionWaypoints(UP(i,r),t,n,o,i,r,a)},fr.prototype.execute=function(){},fr.prototype.revert=function(){},fr.prototype.moveShapes=function(e,t){var n=this;M(e,function(i){n._modeling.moveShape(i,t,null,{autoResize:!1,layout:!1,recurse:!1})})},fr.prototype.resizeShapes=function(e,t,n){var i=this;M(e,function(r){var o=YP(r,n,t);i._modeling.resizeShape(r,o,null,{attachSupport:!1,autoResize:!1,layout:!1})})},fr.prototype.updateConnectionWaypoints=function(e,t,n,i,r,o,a){var s=this,c=new Set(r),u=new Set(o);M(e,function(l){var p=l.source,f=l.target,d=vA(l),h=Ny(n),m={},g=c.has(p)||u.has(p),R=c.has(f)||u.has(f);g&&R?(d=rn(d,function(w){return By(w,i,n)&&(w[h]=w[h]+t[h]),w.original&&By(w.original,i,n)&&(w.original[h]=w.original[h]+t[h]),w}),s._modeling.updateWaypoints(l,d,{labelBehavior:!1})):(g||R)&&(c.has(p)?m.connectionStart=Hl(l,p,t):c.has(f)?m.connectionEnd=zl(l,f,t):u.has(p)?m.connectionStart=qs(l,p,a[p.id]):u.has(f)&&(m.connectionEnd=Ks(l,f,a[f.id])),s._modeling.layoutConnection(l,m))})};function Iy(e){return O({},e)}function vA(e){return rn(e.waypoints,function(t){return t=Iy(t),t.original&&(t.original=Iy(t.original)),t})}function Ny(e){switch(e){case"n":return"y";case"w":return"x";case"s":return"y";case"e":return"x"}}function By(e,t,n){var i=Ny(n);if(/e|s/.test(n))return e[i]>t;if(/n|w/.test(n))return e[i]<t}function _A(e){return{x:e.x,y:e.y,height:e.height,width:e.width}}function Ec(e){this._modeling=e}Ec.$inject=["modeling"],Ec.prototype.execute=function(e){var t=e.shape,n=t.children;e.oldChildrenVisibility=$y(n),t.collapsed=!t.collapsed;var i=jy(n,t.collapsed);return[t].concat(i)},Ec.prototype.revert=function(e){var t=e.shape,n=e.oldChildrenVisibility,i=t.children,r=Fy(i,n);return t.collapsed=!t.collapsed,[t].concat(r)};function $y(e){var t={};return M(e,function(n){t[n.id]=n.hidden,n.children&&(t=O({},t,$y(n.children)))}),t}function jy(e,t){var n=[];return M(e,function(i){i.hidden=t,n=n.concat(i),i.children&&(n=n.concat(jy(i.children,i.collapsed||t)))}),n}function Fy(e,t){var n=[];return M(e,function(i){i.hidden=t[i.id],n=n.concat(i),i.children&&(n=n.concat(Fy(i.children,t)))}),n}function Sc(e){this._modeling=e}Sc.$inject=["modeling"],Sc.prototype.execute=function(e){var t=e.shape,n=e.newHost,i=t.host;return e.oldHost=i,e.attacherIdx=Hy(i,t),zy(n,t),t.host=n,t},Sc.prototype.revert=function(e){var t=e.shape,n=e.newHost,i=e.oldHost,r=e.attacherIdx;return t.host=i,Hy(n,t),zy(i,t,r),t};function Hy(e,t){return wt(e&&e.attachers,t)}function zy(e,t,n){if(e){var i=e.attachers;i||(e.attachers=i=[]),St(i,t,n)}}function Ip(){}Ip.prototype.execute=function(e){var t=e.connection,n=e.newWaypoints;return e.oldWaypoints=t.waypoints,t.waypoints=n,t},Ip.prototype.revert=function(e){var t=e.connection,n=e.oldWaypoints;return t.waypoints=n,t};function rt(e,t,n){this._eventBus=e,this._elementFactory=t,this._commandStack=n;var i=this;e.on("diagram.init",function(){i.registerHandlers(n)})}rt.$inject=["eventBus","elementFactory","commandStack"],rt.prototype.getHandlers=function(){return{"shape.append":yc,"shape.create":pr,"shape.delete":_a,"shape.move":Hr,"shape.resize":wa,"shape.replace":Ni,"shape.toggleCollapse":Ec,spaceTool:fr,"label.create":ya,"connection.create":vc,"connection.delete":va,"connection.move":Op,"connection.layout":xc,"connection.updateWaypoints":Ip,"connection.reconnect":xa,"elements.create":kp,"elements.move":wc,"elements.delete":Dp,"elements.distribute":bc,"elements.align":gc,"element.updateAttachment":Sc}},rt.prototype.registerHandlers=function(e){M(this.getHandlers(),function(t,n){e.registerHandler(n,t)})},rt.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)},rt.prototype.updateAttachment=function(e,t){var n={shape:e,newHost:t};this._commandStack.execute("element.updateAttachment",n)},rt.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)},rt.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)},rt.prototype.layoutConnection=function(e,t){var n={connection:e,hints:t||{}};this._commandStack.execute("connection.layout",n)},rt.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},rt.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},rt.prototype.createElements=function(e,t,n,i,r){_e(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},rt.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},rt.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},rt.prototype.removeElements=function(e){var t={elements:e};this._commandStack.execute("elements.delete",t)},rt.prototype.distributeElements=function(e,t,n){var i={groups:e,axis:t,dimension:n};this._commandStack.execute("elements.distribute",i)},rt.prototype.removeShape=function(e,t){var n={shape:e,hints:t||{}};this._commandStack.execute("shape.delete",n)},rt.prototype.removeConnection=function(e,t){var n={connection:e,hints:t||{}};this._commandStack.execute("connection.delete",n)},rt.prototype.replaceShape=function(e,t,n){var i={oldShape:e,newData:t,hints:n||{}};return this._commandStack.execute("shape.replace",i),i.newShape},rt.prototype.alignElements=function(e,t){var n={elements:e,alignment:t};this._commandStack.execute("elements.align",n)},rt.prototype.resizeShape=function(e,t,n,i){var r={shape:e,newBounds:t,minBounds:n,hints:i};this._commandStack.execute("shape.resize",r)},rt.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)},rt.prototype.updateWaypoints=function(e,t,n){var i={connection:e,newWaypoints:t,hints:n||{}};this._commandStack.execute("connection.updateWaypoints",i)},rt.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)},rt.prototype.reconnectStart=function(e,t,n,i){i||(i={}),this.reconnect(e,t,e.target,n,O(i,{docking:"source"}))},rt.prototype.reconnectEnd=function(e,t,n,i){i||(i={}),this.reconnect(e,e.source,t,n,O(i,{docking:"target"}))},rt.prototype.connect=function(e,t,n,i){return this.createConnection(e,t,n||{},e.parent,i)},rt.prototype._create=function(e,t){return D1(t)?t:this._elementFactory.create(e,t)},rt.prototype.toggleCollapse=function(e,t){var n={shape:e,hints:t||{}};this._commandStack.execute("shape.toggleCollapse",n)};function Ea(e){this._elementRegistry=e}Ea.$inject=["elementRegistry"],Ea.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||bA(n,Xa(i));return Vy(n,i),e.oldProperties=o,e.changed=r,r},Ea.prototype.revert=function(e){var t=e.oldProperties,n=e.moddleElement,i=e.changed;return Vy(n,t),i},Ea.prototype._getVisualReferences=function(e){var t=this._elementRegistry;return v(e,"bpmn:DataObject")?xA(e,t):[]};function bA(e,t){return Sn(t,function(n,i){return n[i]=e.get(i),n},{})}function Vy(e,t){M(t,function(n,i){e.set(i,n)})}function xA(e,t){return t.filter(function(n){return v(n,"bpmn:DataObjectReference")&&Z(n).dataObjectRef===e})}var Sa="default",Bi="id",Gy="di",wA={width:0,height:0};function Ra(e,t,n,i){this._elementRegistry=e,this._moddle=t,this._modeling=n,this._textRenderer=i}Ra.$inject=["elementRegistry","moddle","modeling","textRenderer"],Ra.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=PA(e.properties),s=e.oldProperties||EA(t,a);return Wy(a,o)&&(r.unclaim(o[Bi]),i.updateId(t,a[Bi]),r.claim(a[Bi],o)),Sa in a&&(a[Sa]&&n.push(i.get(a[Sa].id)),o[Sa]&&n.push(i.get(o[Sa].id))),Uy(t,a),e.oldProperties=s,e.changed=n,n},Ra.prototype.postExecute=function(e){var t=e.element,n=t.label,i=n&&Z(n).name;if(i){var r=this._textRenderer.getExternalLabelBounds(n,i);this._modeling.resizeShape(n,r,wA)}},Ra.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 Uy(t,i),Wy(n,r)&&(a.unclaim(n[Bi]),o.updateId(t,i[Bi]),a.claim(i[Bi],r)),e.changed};function Wy(e,t){return Bi in e&&e[Bi]!==t[Bi]}function EA(e,t){var n=Xa(t),i=e.businessObject,r=Ve(e);return Sn(n,function(o,a){return a!==Gy?o[a]=i.get(a):o[a]=SA(r,Xa(t.di)),o},{})}function SA(e,t){return Sn(t,function(n,i){return n[i]=e&&e.get(i),n},{})}function Uy(e,t){var n=e.businessObject,i=Ve(e);M(t,function(r,o){o!==Gy?n.set(o,r):i&&RA(i,r)})}function RA(e,t){M(t,function(n,i){e.set(i,n)})}var CA=["default"];function PA(e){var t=O({},e);return CA.forEach(function(n){n in e&&(t[n]=Z(t[n]))}),t}function Rc(e,t){this._canvas=e,this._modeling=t}Rc.$inject=["canvas","modeling"],Rc.prototype.execute=function(e){var t=this._canvas,n=e.newRoot,i=n.businessObject,r=t.getRootElement(),o=r.businessObject,a=o.$parent,s=Ve(r);return t.setRootElement(n),t.removeRootElement(r),St(a.rootElements,i),i.$parent=a,wt(a.rootElements,o),o.$parent=null,r.di=null,s.bpmnElement=i,n.di=s,e.oldRoot=r,[]},Rc.prototype.revert=function(e){var t=this._canvas,n=e.newRoot,i=n.businessObject,r=e.oldRoot,o=r.businessObject,a=i.$parent,s=Ve(n);return t.setRootElement(r),t.removeRootElement(n),wt(a.rootElements,i),i.$parent=null,St(a.rootElements,o),o.$parent=a,n.di=null,s.bpmnElement=o,r.di=s,[]};function Np(e,t){this._modeling=e,this._spaceTool=t}Np.$inject=["modeling","spaceTool"],Np.prototype.preExecute=function(e){var t=this._spaceTool,n=this._modeling,i=e.shape,r=e.location,o=Un(i),a=o===i,s=a?i:i.parent,c=rr(s),u=Yt(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+Wn,y:i.y,width:i.width-Wn,height:i.height}:{x:i.x,y:i.y+Wn,width:i.width,height:i.height-Wn};n.createShape({type:"bpmn:Lane",isHorizontal:u},l,s)}var p=[];Or(o,function(x){return p.push(x),x.label&&p.push(x.label),x===i?[]:Oe(x.children,function(E){return E!==i})});var f,d,h,m,g;r==="top"?(f=-120,d=i.y,h=d+10,m="n",g="y"):r==="left"?(f=-120,d=i.x,h=d+10,m="w",g="x"):r==="bottom"?(f=120,d=i.y+i.height,h=d-10,m="s",g="y"):r==="right"&&(f=120,d=i.x+i.width,h=d-10,m="e",g="x");var R=t.calculateAdjustments(p,g,f,h),w=u?{x:0,y:f}:{x:f,y:0};t.makeSpace(R.movingShapes,R.resizingShapes,w,m,h);var b=u?{x:i.x+(a?Wn:0),y:d-(r==="top"?120:0),width:i.width-(a?Wn:0),height:120}:{x:d-(r==="left"?120:0),y:i.y+(a?Wn:0),width:120,height:i.height-(a?Wn:0)};e.newLane=n.createShape({type:"bpmn:Lane",isHorizontal:u},b,s)};function Bp(e){this._modeling=e}Bp.$inject=["modeling"],Bp.prototype.preExecute=function(e){var t=this._modeling,n=e.shape,i=e.count,r=rr(n),o=r.length;if(o>i)throw new Error(`more than <${i}> child lanes`);var a=Yt(n),s=a?n.height:n.width,c=Math.round(s/i),u,l,p,f;for(f=0;f<i;f++)f===i-1?u=s-c*f:u=c,l=a?{x:n.x+Wn,y:n.y+f*c,width:n.width-Wn,height:u}:{x:n.x+f*c,y:n.y+Wn,width:u,height:n.height-Wn},f<o?t.resizeShape(r[f],l):(p={type:"bpmn:Lane",isHorizontal:a},t.createShape(p,l,n))};function Ca(e,t){this._modeling=e,this._spaceTool=t}Ca.$inject=["modeling","spaceTool"],Ca.prototype.preExecute=function(e){var t=e.shape,n=e.newBounds,i=e.balanced;i!==!1?this.resizeBalanced(t,n):this.resizeSpace(t,n)},Ca.prototype.resizeBalanced=function(e,t){var n=this._modeling,i=xR(e,t);n.resizeShape(e,t),i.forEach(function(r){n.resizeShape(r.shape,r.newBounds)})},Ca.prototype.resizeSpace=function(e,t){var n=this._spaceTool,i=ye(e),r=ye(t),o=Sm(r,i),a=Un(e),s=[],c=[];Or(a,function(h){return s.push(h),(v(h,"bpmn:Lane")||v(h,"bpmn:Participant"))&&c.push(h),h.children});var u,l,p,f,d;(o.bottom||o.top)&&(u=o.bottom||o.top,l=e.y+(o.bottom?e.height:0)+(o.bottom?-10:10),p=o.bottom?"s":"n",f=o.top>0||o.bottom<0?-u:u,d=n.calculateAdjustments(s,"y",f,l),n.makeSpace(d.movingShapes,d.resizingShapes,{x:0,y:u},p)),(o.left||o.right)&&(u=o.right||o.left,l=e.x+(o.right?e.width:0)+(o.right?-10:100),p=o.right?"e":"w",f=o.left>0||o.right<0?-u:u,d=n.calculateAdjustments(c,"x",f,l),n.makeSpace(d.movingShapes,d.resizingShapes,{x:u,y:0},p))};var Pa="flowNodeRef",$p="lanes";function Cc(){}Cc.prototype._computeUpdates=function(e,t){var n=[],i=[],r={},o=[];function a(l,p){var f=ye(p),d={x:l.x+l.width/2,y:l.y+l.height/2};return d.x>f.left&&d.x<f.right&&d.y>f.top&&d.y<f.bottom}function s(l){n.indexOf(l)===-1&&(o.push(l),n.push(l))}function c(l){var p=Un(l);return r[p.id]||(r[p.id]=Vs(p)),r[p.id]}function u(l){if(!l.parent)return[];var p=c(l);return p.filter(function(f){return a(l,f)}).map(function(f){return f.businessObject})}return t.forEach(function(l){var p=Un(l);if(!(!p||n.indexOf(p)!==-1)){var f=p.children.filter(function(d){return v(d,"bpmn:FlowNode")});f.forEach(s),n.push(p)}}),e.forEach(s),o.forEach(function(l){var p=l.businessObject,f=p.get($p),d=f.slice(),h=u(l);i.push({flowNode:p,remove:d,add:h})}),t.forEach(function(l){var p=l.businessObject;l.parent||p.get(Pa).forEach(function(f){i.push({flowNode:f,remove:[p],add:[]})})}),i},Cc.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($p);n.remove.forEach(function(o){wt(r,o),wt(o.get(Pa),i)}),n.add.forEach(function(o){St(r,o),St(o.get(Pa),i)})}),[]},Cc.prototype.revert=function(e){var t=e.updates;return t.forEach(function(n){var i=n.flowNode,r=i.get($p);n.add.forEach(function(o){wt(r,o),wt(o.get(Pa),i)}),n.remove.forEach(function(o){St(r,o),St(o.get(Pa),i)})}),[]};var jp="categoryValueRef";function Aa(e,t){this._bpmnFactory=e,this._elementRegistry=t}Aa.$inject=["bpmnFactory","elementRegistry"],Aa.prototype._computeUpdates=function(e,t){var n=this._elementRegistry,i=this._bpmnFactory,r=new Map,o=[],a=new Map;function s(w,b,x){if(b){var E=a.get(w);E||(E={},a.set(w,E)),!(x&&E.present)&&(!x&&E.past||(x?E.present={categoryValue:b,root:Fp(w)}:E.past={categoryValue:b}))}}function c(w){r.set(w,Z(w))}function u(){n.filter(function(w){return v(w,"bpmn:FlowElement")&&!Me(w)&&w.parent}).forEach(c)}function l(w){var b=Z(w),x=b.get("categoryValueRef");return x||(x=_m(i,b),o.push(AA(w,x))),x}function p(w){return w.reduce(function(b,x){var E=Fp(x),T=b.get(E);return T||(T=[],b.set(E,T)),T.push(x),b},new Map)}e=Array.from(e||[]);var f=p(e);t.length&&u(),e.forEach(c),n.filter(function(w){return v(w,"bpmn:Group")&&!Me(w)&&w.parent}).forEach(function(w){var b=Z(w).get("categoryValueRef");if(!b){var x=Fp(w),E=f.get(x)||[],T=ao(E,w),L=Object.keys(T).length>0;L&&(b=l(w))}s(w,b,!0)}),t.forEach(function(w){s(w.groupShape,w.categoryValue,!1)}),o.length&&u();var d=Array.from(r.keys()),h=Array.from(a.values()).reduce(function(w,b){return b.present&&w.add(b.present.categoryValue),b.past&&w.add(b.past.categoryValue),w},new Set),m=new Map,g=p(d);a.forEach(function(w,b){var x=w.present;if(x){var E=g.get(x.root)||[],T=ao(E,b);E.forEach(function(L){if(T[L.id]){var A=m.get(L);A||(A=new Set,m.set(L,A)),A.add(x.categoryValue)}})}});var R=d.reduce(function(w,b){var x=r.get(b),E=x.get(jp),T=new Set(E),L=m.get(b)||new Set,A=Array.from(L).filter(function(H){return!T.has(H)}),j=E.filter(function(H){return h.has(H)&&!L.has(H)});return(A.length||j.length)&&w.push({businessObject:x,categoryValuesToAdd:A,categoryValuesToRemove:j}),w},[]);return{flowElements:R,groups:o}},Aa.prototype.execute=function(e){var t=e.updates;return t||(t=e.updates=this._computeUpdates(e.affectedFlowElements,e.affectedGroupEntries)),TA(t.groups),kA(t.flowElements),[]},Aa.prototype.revert=function(e){var t=e.updates;return DA(t.flowElements),MA(t.groups),[]};function AA(e,t){return{groupShape:e,categoryValue:t,category:t.$parent}}function TA(e){e.forEach(function(t){Z(t.groupShape).categoryValueRef=t.categoryValue,t.categoryValue.$parent=t.category})}function MA(e){e.forEach(function(t){Z(t.groupShape).categoryValueRef=null})}function kA(e){e.forEach(function(t){var n=t.businessObject,i=n.get(jp);t.categoryValuesToRemove.forEach(function(r){wt(i,r)}),t.categoryValuesToAdd.forEach(function(r){St(i,r,!0)})})}function DA(e){e.forEach(function(t){var n=t.businessObject,i=n.get(jp);t.categoryValuesToAdd.forEach(function(r){wt(i,r)}),t.categoryValuesToRemove.forEach(function(r){St(i,r,!0)})})}function Fp(e){for(;e.parent;)e=e.parent;return e}function Pc(e){this._moddle=e}Pc.$inject=["moddle"],Pc.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),[]},Pc.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 OA={fill:void 0,stroke:void 0};function Hp(e){this._commandStack=e,this._normalizeColor=function(t){if(t){if(wn(t)){var n=LA(t);if(n)return n}throw new Error(`invalid color value: ${t}`)}}}Hp.$inject=["commandStack"],Hp.prototype.postExecute=function(e){var t=e.elements,n=e.colors||OA,i=this,r={};"fill"in n&&O(r,{"background-color":this._normalizeColor(n.fill)}),"stroke"in n&&O(r,{"border-color":this._normalizeColor(n.stroke)}),M(t,function(o){var a=it(o)?ni(r,["border-color"]):r,s=Ve(o);if(IA(a),Me(o)){if(!s||!v(s.label,"bpmndi:BPMNLabel"))return;i._commandStack.execute("element.updateModdleProperties",{element:o,moddleElement:s.label,properties:{color:r["border-color"]}})}else{if(!De(s,["bpmndi:BPMNEdge","bpmndi:BPMNShape"]))return;i._commandStack.execute("element.updateProperties",{element:o,properties:{di:a}})}})};function LA(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 IA(e){"border-color"in e&&(e.stroke=e["border-color"]),"background-color"in e&&(e.fill=e["background-color"])}var NA={width:0,height:0};function Yy(e,t,n){function i(c,u){var l=c.label||c,p=c.labelTarget||c;return lS(l,u),[l,p]}function r(c){var u=c.element,l=u.businessObject,p=c.newLabel;if(!Me(u)&&nr(u)&&!Ms(u)&&!qy(p)){var f=7,d=pl(u);d={x:d.x,y:d.y+f},e.createLabel(u,d,{id:l.id+"_label",businessObject:l,di:u.di})}}function o(c){return c.oldLabel=jn(c.element),i(c.element,c.newLabel)}function a(c){return i(c.element,c.oldLabel)}function s(c){var u=c.element,l=u.label||u,p=c.newLabel,f=c.newBounds,d=c.hints||{};if(!(!Me(l)&&!v(l,"bpmn:TextAnnotation"))){if(Me(l)&&qy(p)){d.removeShape!==!1&&e.removeShape(l,{unsetLabel:!1});return}var h=jn(u);typeof f>"u"&&(f=t.getExternalLabelBounds(l,h)),f&&e.resizeShape(l,f,NA)}}this.preExecute=r,this.execute=o,this.revert=a,this.postExecute=s}Yy.$inject=["modeling","textRenderer","bpmnFactory"];function qy(e){return!e||!e.trim()}function en(e,t,n,i){rt.call(this,e,t,n),this._bpmnRules=i}ie(en,rt),en.$inject=["eventBus","elementFactory","commandStack","bpmnRules"],en.prototype.getHandlers=function(){var e=rt.prototype.getHandlers.call(this);return e["element.updateModdleProperties"]=Ea,e["element.updateProperties"]=Ra,e["canvas.updateRoot"]=Rc,e["lane.add"]=Np,e["lane.resize"]=Ca,e["lane.split"]=Bp,e["lane.updateRefs"]=Cc,e["group.updateRefs"]=Aa,e["id.updateClaim"]=Pc,e["element.setColor"]=Hp,e["element.updateLabel"]=Yy,e},en.prototype.updateLabel=function(e,t,n,i){this._commandStack.execute("element.updateLabel",{element:e,newLabel:t,newBounds:n,hints:i||{}})},en.prototype.connect=function(e,t,n,i){var r=this._bpmnRules;if(n||(n=r.canConnect(e,t)),!!n)return this.createConnection(e,t,n,e.parent,i)},en.prototype.updateModdleProperties=function(e,t,n){this._commandStack.execute("element.updateModdleProperties",{element:e,moddleElement:t,properties:n})},en.prototype.updateProperties=function(e,t){this._commandStack.execute("element.updateProperties",{element:e,properties:t})},en.prototype.resizeLane=function(e,t,n){this._commandStack.execute("lane.resize",{shape:e,newBounds:t,balanced:n})},en.prototype.addLane=function(e,t){var n={shape:e,location:t};return this._commandStack.execute("lane.add",n),n.newLane},en.prototype.splitLane=function(e,t){this._commandStack.execute("lane.split",{shape:e,count:t})},en.prototype.makeCollaboration=function(){var e=this._create("root",{type:"bpmn:Collaboration"}),t={newRoot:e};return this._commandStack.execute("canvas.updateRoot",t),e},en.prototype.makeProcess=function(){var e=this._create("root",{type:"bpmn:Process"}),t={newRoot:e};return this._commandStack.execute("canvas.updateRoot",t),e},en.prototype.updateLaneRefs=function(e,t){this._commandStack.execute("lane.updateRefs",{flowNodeShapes:e,laneShapes:t})},en.prototype.updateCategoryValueRefs=function(e,t){this._commandStack.execute("group.updateRefs",{affectedFlowElements:e,affectedGroupEntries:t})},en.prototype.claimId=function(e,t){this._commandStack.execute("id.updateClaim",{id:e,element:t,claiming:!0})},en.prototype.unclaimId=function(e,t){this._commandStack.execute("id.updateClaim",{id:e,element:t})},en.prototype.setColor=function(e,t){e.length||(e=[e]),this._commandStack.execute("element.setColor",{elements:e,colors:t})};function Ky(){}Ky.prototype.layoutConnection=function(e,t){return t=t||{},[t.connectionStart||be(t.source||e.source),t.connectionEnd||be(t.target||e.target)]};var Ac=20,BA=5,Tc=Math.round,Xy=20,$A={"h:h":20,"v:v":20,"h:v":-10,"v:h":-10};function jA(e,t){return!{t:/top/,r:/right/,b:/bottom/,l:/left/,h:/./,v:/./}[t].test(e)}function FA(e,t){return{t:/top/,r:/right/,b:/bottom/,l:/left/,h:/left|right/,v:/top|bottom/}[e].test(t)}function Zy(e,t,n){var i=Zt(t,e,BA),r=n.split(":")[0],o=Tc((t.x-e.x)/2+e.x),a=Tc((t.y-e.y)/2+e.y),s,c,u=FA(r,i),l=/h|r|l/.test(r),p=!1,f=!1;return u?(s=l?{x:o,y:e.y}:{x:e.x,y:a},c=l?"h:h":"v:v"):(p=jA(i,r),c=l?"h:v":"v:h",p?l?(f=a===e.y,s={x:e.x+Ac*(/l/.test(r)?-1:1),y:f?a+Ac:a}):(f=o===e.x,s={x:f?o+Ac:o,y:e.y+Ac*(/t/.test(r)?-1:1)}):s={x:o,y:a}),{waypoints:zp(e,s,c).concat(s),directions:c,turnNextDirections:f}}function HA(e,t,n){return Zy(e,t,n)}function zA(e,t,n){var i=Zy(t,e,Qy(n));return{waypoints:i.waypoints.slice().reverse(),directions:Qy(i.directions),turnNextDirections:i.turnNextDirections}}function VA(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=zp(e.waypoints[e.waypoints.length-1],t.waypoints[0],r);return{waypoints:o,directions:r}}function Qy(e){return e.split(":").reverse().join(":")}function GA(e,t,n){var i=Tc((t.x-e.x)/2+e.x),r=Tc((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 zp(e,t,n){if(n=n||"h:h",!JA(n))throw new Error("unknown directions: <"+n+">: must be specified as <start>:<end> with start/end in { h,v,t,r,b,l }");if(ev(n)){var i=HA(e,t,n),r=zA(e,t,n),o=VA(i,r);return[].concat(i.waypoints,o.waypoints,r.waypoints)}return GA(e,t,n)}function WA(e,t,n){var i=zp(e,t,n);return i.unshift(e),i.push(t),nv(i)}function UA(e,t,n,i,r){var o=r&&r.preferredLayouts||[],a=Yx(o,"straight")[0]||"h:h",s=$A[a]||0,c=Zt(e,t,s),u=QA(c,a);n=n||be(e),i=i||be(t);var l=u.split(":"),p=tv(n,e,l[0],eT(c)),f=tv(i,t,l[1],c);return WA(p,f,u)}function YA(e,t,n,i,r,o){_e(n)&&(r=n,o=i,n=be(e),i=be(t)),o=O({preferredLayouts:[]},o),r=r||[];var a=o.preferredLayouts,s=a.indexOf("straight")!==-1,c;return c=s&&KA(e,t,n,i,o),c||(c=o.connectionEnd&&ZA(t,e,i,r),c)||(c=o.connectionStart&&XA(e,t,n,r),c)?c:!o.connectionStart&&!o.connectionEnd&&r&&r.length?r:UA(e,t,n,i,o)}function qA(e,t,n){return e>=t&&e<=n}function Jy(e,t,n){var i={x:"width",y:"height"};return qA(t[e],n[e],n[e]+n[i[e]])}function KA(e,t,n,i,r){var o={},a,s;return s=Zt(e,t),/^(top|bottom|left|right)$/.test(s)?(/top|bottom/.test(s)&&(a="x"),/left|right/.test(s)&&(a="y"),r.preserveDocking==="target"?Jy(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:Jy(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 XA(e,t,n,i){return Vp(e,t,n,i)}function ZA(e,t,n,i){var r=i.slice().reverse();return r=Vp(e,t,n,r),r?r.reverse():null}function Vp(e,t,n,i){function r(l){return l.length<3?!0:l.length>4?!1:!!st(l,function(p,f){var d=l[f-1];return d&&Qo(p,d)<3})}function o(l,p,f){var d=Ai(p,l);switch(d){case"v":return{x:f.x,y:l.y};case"h":return{x:l.x,y:f.y}}return{x:l.x,y:l.y}}function a(l,p,f){var d;for(d=l.length-2;d!==0;d--)if(Rh(l[d],p,Xy)||Rh(l[d],f,Xy))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=Vp(e,t,n,u)),c&&Ai(c)?null:c}function QA(e,t){if(ev(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 JA(e){return e&&/^h|v|t|r|b|l:h|v|t|r|b|l$/.test(e)}function ev(e){return e&&/t|r|b|l/.test(e)}function eT(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 tv(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 al(r,o,n,0)||t.push(n),t},[])}var tT=-10,nT=40,iT={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},rT={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},Gp={top:"bottom","top-right":"bottom-left","top-left":"bottom-right",right:"left",bottom:"top","bottom-right":"top-left","bottom-left":"top-right",left:"right"},Ta={top:"t",right:"r",bottom:"b",left:"l"};function Mc(e){this._elementRegistry=e}ie(Mc,Ky),Mc.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)),(v(e,"bpmn:Association")||v(e,"bpmn:DataAssociation"))&&r&&!rv(n,i))return[].concat([o],r.slice(1,-1),[a]);var l=mm(n,s)?iT:rT;return v(e,"bpmn:MessageFlow")?c=aT(n,i,l):(v(e,"bpmn:SequenceFlow")||rv(n,i))&&(n===i?c={preferredLayouts:fT(n,e,l)}:v(n,"bpmn:BoundaryEvent")?c={preferredLayouts:dT(n,i,a,l)}:Ma(n)||Ma(i)?c={preferredLayouts:l.subProcess,preserveDocking:cT(n)}:v(n,"bpmn:Gateway")?c={preferredLayouts:l.fromGateway}:v(i,"bpmn:Gateway")?c={preferredLayouts:l.toGateway}:c={preferredLayouts:l.default}),c&&(c=O(c,t),u=nv(YA(n,i,o,a,r,c))),u||[o,a]};function oT(e){var t=e.host;return Zt(be(e),t,tT)}function aT(e,t,n){return{preferredLayouts:n.messageFlow,preserveDocking:sT(e,t)}}function sT(e,t){return v(t,"bpmn:Participant")?"source":v(e,"bpmn:Participant")?"target":Ma(t)?"source":Ma(e)||v(t,"bpmn:Event")?"target":v(e,"bpmn:Event")?"source":null}function cT(e){return Ma(e)?"target":"source"}function iv(e,t){return e?e.original||e:be(t)}function rv(e,t){return v(t,"bpmn:Activity")&&v(e,"bpmn:BoundaryEvent")&&t.businessObject.isForCompensation}function Ma(e){return v(e,"bpmn:SubProcess")&&$e(e)}function zr(e,t){return e===t}function uT(e,t){return t.indexOf(e)!==-1}function Co(e){var t=/right|left/.exec(e);return t&&t[0]}function Po(e){var t=/top|bottom/.exec(e);return t&&t[0]}function ov(e,t){return Gp[e]===t}function lT(e,t){var n=Co(e),i=Gp[n];return t.indexOf(i)!==-1}function pT(e,t){var n=Po(e),i=Gp[n];return t.indexOf(i)!==-1}function av(e){return e==="right"||e==="left"}function fT(e,t,n){var i=t.waypoints,r=i&&i.length&&Zt(i[0],e);return r==="top"?n.loop.fromTop:r==="right"?n.loop.fromRight:r==="left"?n.loop.fromLeft:n.loop.fromBottom}function dT(e,t,n,i){var r=be(e),o=be(t),a=oT(e),s,c,u=zr(e.host,t),l=uT(a,["top","right","bottom","left"]),p=Zt(o,r,{x:e.width/2+t.width/2,y:e.height/2+t.height/2});return u?hT(a,l,e,t,n,i):(s=mT(a,p,l,i.isHorizontal),c=gT(a,p,l,i.isHorizontal),[s+":"+c])}function hT(e,t,n,i,r,o){var a=t?e:o.isHorizontal?Po(e):Co(e),s=Ta[a],c;return t?av(e)?c=sv("y",n,i,r)?"h":o.boundaryLoop.alternateHorizontalSide:c=sv("x",n,i,r)?"v":o.boundaryLoop.alternateVerticalSide:c=o.boundaryLoop.default,[s+":"+c]}function sv(e,t,n,i){var r=nT;return!(Wp(e,i,n,r)||Wp(e,i,{x:n.x+n.width,y:n.y+n.height},r)||Wp(e,i,be(t),r))}function Wp(e,t,n,i){return Math.abs(t[e]-n[e])<i}function mT(e,t,n,i){if(n)return Ta[e];var r=Po(e),o=Co(e),a=Po(t),s=Co(t);if(i){if(zr(r,a)||ov(o,s))return Ta[r]}else if(zr(o,s)||ov(r,a))return Ta[o];return Ta[i?o:r]}function gT(e,t,n,i){if(n)return av(e)?lT(e,t)||zr(e,t)?"h":"v":pT(e,t)||zr(e,t)?"v":"h";var r=Po(e),o=Co(e),a=Po(t),s=Co(t);return a&&!s?"v":s&&!a?"h":i?zr(r,a)?"h":"v":zr(o,s)?"v":"h"}Mc.$inject=["elementRegistry"];function cv(e){return O({original:e.point.original||e.point},e.actual)}function dr(e,t){this._elementRegistry=e,this._graphicsFactory=t}dr.$inject=["elementRegistry","graphicsFactory"],dr.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(cv(i)),o.push(cv(r)),o},dr.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}},dr.prototype._getIntersection=function(e,t,n){var i=this._getShapePath(e),r=this._getConnectionPath(t);return Jo(i,r,n)},dr.prototype._getConnectionPath=function(e){return this._graphicsFactory.getConnectionPath(e)},dr.prototype._getShapePath=function(e){return this._graphicsFactory.getShapePath(e)},dr.prototype._getGfx=function(e){return this._elementRegistry.getGraphics(e)};const Up={__init__:["modeling","bpmnUpdater"],__depends__:[IC,ZC,JC,eP,by,tA,iA,uA,qn,Tp,Cy],bpmnFactory:["type",Xn],bpmnUpdater:["type",kn],elementFactory:["type",lr],modeling:["type",en],layouter:["type",Mc],connectionDocking:["type",dr]};var yT=10,uv=50,vT=250;function Yp(e,t,n,i){for(var r;r=_T(e,n,t);)n=i(t,n,r);return n}function qp(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 _T(e,t,n){var i={x:t.x-n.width/2,y:t.y-n.height/2,width:n.width,height:n.height},r=xT(e);return st(r,function(o){if(o===n)return!1;var a=Zt(o,i,yT);return a==="intersect"})}function bT(e,t){t||(t={});function n(h){return h.source===e?1:-1}var i=t.defaultDistance||uv,r=t.direction||"e",o=t.filter,a=t.getWeight||n,s=t.maxDistance||vT,c=t.reference||"start";o||(o=ST);function u(h,m){return r==="n"?c==="start"?ye(h).top-ye(m).bottom:c==="center"?ye(h).top-be(m).y:ye(h).top-ye(m).top:r==="w"?c==="start"?ye(h).left-ye(m).right:c==="center"?ye(h).left-be(m).x:ye(h).left-ye(m).left:r==="s"?c==="start"?ye(m).top-ye(h).bottom:c==="center"?be(m).y-ye(h).bottom:ye(m).bottom-ye(h).bottom:c==="start"?ye(m).left-ye(h).right:c==="center"?be(m).x-ye(h).right:ye(m).right-ye(h).right}var l=e.incoming.filter(o).map(function(h){var m=a(h),g=m<0?u(h.source,e):u(e,h.source);return{id:h.source.id,distance:g,weight:m}}),p=e.outgoing.filter(o).map(function(h){var m=a(h),g=m>0?u(e,h.target):u(h.target,e);return{id:h.target.id,distance:g,weight:m}}),f=l.concat(p).reduce(function(h,m){return h[m.id+"__weight_"+m.weight]=m,h},{}),d=Sn(f,function(h,m){var g=m.distance,R=m.weight;return g<0||g>s||(h[String(g)]||(h[String(g)]=0),h[String(g)]+=1*R,(!h.distance||h[h.distance]<h[String(g)])&&(h.distance=g)),h},{});return d.distance||i}function xT(e){var t=Kp(e);return e.host&&(t=t.concat(Kp(e.host))),e.attachers&&(t=t.concat(e.attachers.reduce(function(n,i){return n.concat(Kp(i))},[]))),t}function Kp(e){return ET(e).concat(wT(e))}function wT(e){return e.incoming.map(function(t){return t.source})}function ET(e){return e.outgoing.map(function(t){return t.target})}function ST(){return!0}var RT=100;function lv(e,t,n){e.on("autoPlace",RT,function(i){var r=i.shape,o=i.source;return CT(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}}lv.$inject=["eventBus","modeling","canvas"];function CT(e,t,n){n||(n={});var i=n.defaultDistance||uv,r=be(e),o=ye(e);return{x:o.right+i+t.width/2,y:r.y}}function pv(e,t){e.on("autoPlace.end",500,function(n){t.select(n.shape)})}pv.$inject=["eventBus","selection"];const PT={__init__:["autoPlaceSelectionBehavior"],autoPlace:["type",lv],autoPlaceSelectionBehavior:["type",pv]};function fv(e,t,n){var i=mm(e,n);if(v(t,"bpmn:TextAnnotation"))return TT(e,t,i);if(De(t,["bpmn:DataObjectReference","bpmn:DataStoreReference"]))return MT(e,t,i);if(v(t,"bpmn:FlowNode"))return AT(e,t,i)}function AT(e,t,n){var i=ye(e),r=be(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=bT(e,{filter:function(d){return v(d,"bpmn:SequenceFlow")},direction:o.directionHint}),s=30,c=o.minDistance,u=o.baseOrientation;v(e,"bpmn:BoundaryEvent")&&(u=Zt(e,e.host,-25),u.indexOf(o.boundaryOrientation)!==-1&&(s*=-1));var l=n?{x:i.right+a+t.width/2,y:r.y+dv(u,c,o)}:{x:r.x+dv(u,c,o),y:i.bottom+a+t.height/2},p={margin:s,minDistance:c},f=n?{y:p}:{x:p};return Yp(e,t,l,qp(f))}function dv(e,t,n){return e.includes(n.start)?-1*t:e.includes(n.end)?t:0}function TT(e,t,n){var i=ye(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};it(e)&&(r=be(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 Yp(e,t,r,qp(a))}function MT(e,t,n){var i=ye(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 Yp(e,t,r,qp(a))}function hv(e,t){e.on("autoPlace",function(n){var i=n.shape,r=n.source;return fv(r,i,t)})}hv.$inject=["eventBus","elementRegistry"];const kc={__depends__:[PT],__init__:["bpmnAutoPlace"],bpmnAutoPlace:["type",hv]},mv=[dm,oa,Up,kc];function kT(e={}){hd(globalThis,e.dom);const t=document.createElement("div");return document.body.appendChild(t),new uo({container:t,moddleExtensions:e.moddleExtensions??is,additionalModules:[...mv,...e.additionalModules??[]]})}var DT=new So("ov"),OT=500;function qt(e,t,n,i){this._eventBus=t,this._canvas=n,this._elementRegistry=i,this._ids=DT,this._overlayDefaults=O({show:null,scale:!0},e&&e.defaults),this._overlays={},this._overlayContainers=[],this._overlayRoot=LT(n.getContainer()),this._init()}qt.$inject=["config.overlays","eventBus","canvas","elementRegistry"],qt.prototype.get=function(e){if(wn(e)&&(e={id:e}),wn(e.element)&&(e.element=this._elementRegistry.get(e.element)),e.element){var t=this._getOverlayContainer(e.element,!0);return t?e.type?Oe(t.overlays,Jr({type:e.type})):t.overlays.slice():[]}else return e.type?Oe(this._overlays,Jr({type:e.type})):e.id?this._overlays[e.id]:null},qt.prototype.add=function(e,t,n){if(Gt(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=O({},this._overlayDefaults,n,{id:i,type:t,element:e,html:n.html}),this._addOverlay(n),i},qt.prototype.remove=function(e){var t=this.get(e)||[];_e(t)||(t=[t]);var n=this;M(t,function(i){var r=n._getOverlayContainer(i.element,!0);if(i&&(li(i.html),li(i.htmlContainer),delete i.htmlContainer,delete i.element,delete n._overlays[i.id]),r){var o=r.overlays.indexOf(i);o!==-1&&r.overlays.splice(o,1)}})},qt.prototype.isShown=function(){return this._overlayRoot.style.display!=="none"},qt.prototype.show=function(){Dc(this._overlayRoot)},qt.prototype.hide=function(){Dc(this._overlayRoot,!1)},qt.prototype.clear=function(){this._overlays={},this._overlayContainers=[],ms(this._overlayRoot)},qt.prototype._updateOverlayContainer=function(e){var t=e.element,n=e.html,i=t.x,r=t.y;if(t.waypoints){var o=At(t);i=o.x,r=o.y}gv(n,i,r),an(e.html,"data-container-id",t.id)},qt.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=At(i).width:a=i.width,r=t.right*-1+a}if(t.bottom!==void 0){var s;i.waypoints?s=At(i).height:s=i.height,o=t.bottom*-1+s}gv(n,r||0,o||0),this._updateOverlayVisibilty(e,this._canvas.viewbox())},qt.prototype._createOverlayContainer=function(e){var t=ut('<div class="djs-overlays" />');mn(t,{position:"absolute"}),this._overlayRoot.appendChild(t);var n={html:t,element:e,overlays:[]};return this._updateOverlayContainer(n),this._overlayContainers.push(n),n},qt.prototype._updateRoot=function(e){var t=e.scale||1,n="matrix("+[t,0,0,t,-1*e.x*t,-1*e.y*t].join(",")+")";yv(this._overlayRoot,n)},qt.prototype._getOverlayContainer=function(e,t){var n=st(this._overlayContainers,function(i){return i.element===e});return!n&&!t?this._createOverlayContainer(e):n},qt.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)),wn(i)&&(i=ut(i)),o=this._getOverlayContainer(n),r=ut('<div class="djs-overlay" data-overlay-id="'+t+'">'),mn(r,{position:"absolute"}),r.appendChild(i),e.type&&mt(r).add("djs-overlay-"+e.type);var a=this._canvas.findRoot(n),s=this._canvas.getRootElement();Dc(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())},qt.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&&($t(r)&&r>t.scale||$t(o)&&o<t.scale))&&(c=!1),Dc(a,c),this._updateOverlayScale(e,t)},qt.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),$t(i)&&t.scale<i&&(a=(1/t.scale||1)*i),$t(r)&&t.scale>r&&(a=(1/t.scale||1)*r)),$t(a)&&(s="scale("+a+","+a+")"),yv(o,s)},qt.prototype._updateOverlaysVisibilty=function(e){var t=this;M(this._overlays,function(n){t._updateOverlayVisibilty(n,e)})},qt.prototype._init=function(){var e=this._eventBus,t=this;function n(i){t._updateRoot(i),t._updateOverlaysVisibilty(i),t.show()}e.on("canvas.viewbox.changing",function(i){t.hide()}),e.on("canvas.viewbox.changed",function(i){n(i.viewbox)}),e.on(["shape.remove","connection.remove"],function(i){var r=i.element,o=t.get({element:r});M(o,function(c){t.remove(c.id)});var a=t._getOverlayContainer(r);if(a){li(a.html);var s=t._overlayContainers.indexOf(a);s!==-1&&t._overlayContainers.splice(s,1)}}),e.on("element.changed",OT,function(i){var r=i.element,o=t._getOverlayContainer(r,!0);o&&(M(o.overlays,function(a){t._updateOverlay(a)}),t._updateOverlayContainer(o))}),e.on("element.marker.update",function(i){var r=t._getOverlayContainer(i.element,!0);r&&mt(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 LT(e){var t=ut('<div class="djs-overlay-container" />');return mn(t,{position:"absolute",width:0,height:0}),e.insertBefore(t,e.firstChild),t}function gv(e,t,n){mn(e,{left:t+"px",top:n+"px"})}function Dc(e,t){e.style.display=t===!1?"none":""}function yv(e,t){e.style["transform-origin"]="top left",["","-ms-","-webkit-"].forEach(function(n){e.style[n+"transform"]=t})}const Oc={__init__:["overlays"],overlays:["type",qt]};function Xp(e,t){t.invoke(X,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)})}ie(Xp,X),Xp.$inject=["canvas","injector"];const IT={__init__:["rootElementsBehavior"],rootElementsBehavior:["type",Xp]};function ka(e){return CSS.escape(e)}var NT={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"};function vv(e){return e=""+e,e&&e.replace(/[&<>"']/g,function(t){return NT[t]})}var BT="bjs-breadcrumbs-shown";function _v(e,t,n){var i=ut('<ul class="bjs-breadcrumbs"></ul>'),r=n.getContainer(),o=mt(r);r.appendChild(i);var a=[];e.on("element.changed",function(c){var u=c.element,l=Z(u),p=st(a,function(f){return f===l});p&&s()});function s(c){c&&(a=$T(c));var u=a.flatMap(function(p){var f=n.findRoot(mi(p))||n.findRoot(p.id);if(!f&&v(p,"bpmn:Process")){var d=t.find(function(g){var R=Z(g);return R&&R.get("processRef")===p});f=d&&n.findRoot(d.id)}if(!f)return[];var h=vv(p.name||p.id),m=ut('<li><span class="bjs-crumb"><a title="'+h+'">'+h+"</a></span></li>");return m.addEventListener("click",function(){n.setRootElement(f)}),m});i.innerHTML="";var l=u.length>1;o.toggle(BT,l),u.forEach(function(p){i.appendChild(p)})}e.on("root.set",function(c){s(c.element)})}_v.$inject=["eventBus","elementRegistry","canvas"];function $T(e){for(var t=Z(e),n=[],i=t;i;i=i.$parent)(v(i,"bpmn:SubProcess")||v(i,"bpmn:Process"))&&n.push(i);return n.reverse()}function bv(e,t){var n=null,i=new jT;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,!(!v(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})}bv.$inject=["eventBus","canvas"];function jT(){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 xv={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;v(a,"bpmn:SubProcess")&&!o.isExpanded&&n.push(a),HT(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=FT(e),i={x:n.x-xv.x,y:n.y-xv.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=wv(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 wv(e){return v(e,"bpmndi:BPMNDiagram")?e:wv(e.$parent)}function FT(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=ye(n.bounds);t.top=Math.min(i.top,t.top),t.left=Math.min(i.left,t.left)}}),Ss(t)}function HT(e,t){var n=e.$parent;return!(!v(n,"bpmn:SubProcess")||n===t.bpmnElement||De(e,["bpmn:DataInputAssociation","bpmn:DataOutputAssociation"]))}var Lc=250,zT='<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>',VT="bjs-drilldown-empty";function hr(e,t,n,i,r){X.call(this,t),this._canvas=e,this._eventBus=t,this._elementRegistry=n,this._overlays=i,this._translate=r;var o=this;this.executed("shape.toggleCollapse",Lc,function(a){var s=a.shape;o._canDrillDown(s)?o._addOverlay(s):o._removeOverlay(s)},!0),this.reverted("shape.toggleCollapse",Lc,function(a){var s=a.shape;o._canDrillDown(s)?o._addOverlay(s):o._removeOverlay(s)},!0),this.executed(["shape.create","shape.move","shape.delete"],Lc,function(a){var s=a.oldParent,c=a.newParent||a.parent,u=a.shape;o._canDrillDown(u)&&o._addOverlay(u),o._updateDrilldownOverlay(s),o._updateDrilldownOverlay(c),o._updateDrilldownOverlay(u)},!0),this.reverted(["shape.create","shape.move","shape.delete"],Lc,function(a){var s=a.oldParent,c=a.newParent||a.parent,u=a.shape;o._canDrillDown(u)&&o._addOverlay(u),o._updateDrilldownOverlay(s),o._updateDrilldownOverlay(c),o._updateDrilldownOverlay(u)},!0),t.on("import.render.complete",function(){n.filter(function(a){return o._canDrillDown(a)}).map(function(a){o._addOverlay(a)})})}ie(hr,X),hr.prototype._updateDrilldownOverlay=function(e){var t=this._canvas;if(e){var n=t.findRoot(e);n&&this._updateOverlayVisibility(n)}},hr.prototype._canDrillDown=function(e){var t=this._canvas;return v(e,"bpmn:SubProcess")&&t.findRoot(mi(e))},hr.prototype._updateOverlayVisibility=function(e){var t=this._overlays,n=Z(e),i=t.get({element:n.id,type:"drilldown"})[0];if(i){var r=n&&n.get("flowElements")&&n.get("flowElements").length;mt(i.html).toggle(VT,!r)}},hr.prototype._addOverlay=function(e){var t=this._canvas,n=this._overlays,i=Z(e),r=n.get({element:e,type:"drilldown"});r.length&&this._removeOverlay(e);var o=ut('<button type="button" class="bjs-drilldown">'+zT+"</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(mi(e)))}),n.add(e,"drilldown",{position:{bottom:-7,right:-8},html:o}),this._updateOverlayVisibility(e)},hr.prototype._removeOverlay=function(e){var t=this._overlays;t.remove({element:e,type:"drilldown"})},hr.$inject=["canvas","eventBus","elementRegistry","overlays","translate"];const GT={__depends__:[Oc,Tp,IT],__init__:["drilldownBreadcrumbs","drilldownOverlayBehavior","drilldownCentering","subprocessCompatibility"],drilldownBreadcrumbs:["type",_v],drilldownCentering:["type",bv],drilldownOverlayBehavior:["type",hr],subprocessCompatibility:["type",Vr]};function mr(e){yt.call(this,e)}ie(mr,yt),mr.prototype._modules=[dm,GT,Oc,qn,oa],mr.prototype._moddleExtensions={};var Ic="keyboard.keydown",WT="keyboard.keyup",UT=1e3,Ev="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 gn(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(Ev));var i=e&&e.bind!==!1;t.on("canvas.init",function(r){n._target=r.svg,i&&n.bind(),n._fire("init")})}gn.$inject=["config.keyboard","eventBus"],gn.prototype._keydownHandler=function(e){this._keyHandler(e,Ic)},gn.prototype._keyupHandler=function(e){this._keyHandler(e,WT)},gn.prototype._keyHandler=function(e,t){var n;if(!this._isEventIgnored(e)){var i={keyEvent:e};n=this._eventBus.fire(t||Ic,i),n&&e.preventDefault()}},gn.prototype._isEventIgnored=function(e){return!1},gn.prototype.bind=function(e){e&&console.error("unsupported argument <node>",new Error(Ev)),this.unbind(),e=this._node=this._target,Se.bind(e,"keydown",this._keydownHandler),Se.bind(e,"keyup",this._keyupHandler),this._fire("bind")},gn.prototype.getBinding=function(){return this._node},gn.prototype.unbind=function(){var e=this._node;e&&(this._fire("unbind"),Se.unbind(e,"keydown",this._keydownHandler),Se.unbind(e,"keyup",this._keyupHandler)),this._node=null},gn.prototype._fire=function(e){this._eventBus.fire("keyboard."+e,{node:this._node})},gn.prototype.addListener=function(e,t,n){Wt(e)&&(n=t,t=e,e=UT),this._eventBus.on(n||Ic,e,t)},gn.prototype.removeListener=function(e,t){this._eventBus.off(t||Ic,e)},gn.prototype.hasModifier=dP,gn.prototype.isCmd=Tn,gn.prototype.isShift=vp,gn.prototype.isKey=Ht;var YT=500;function Ao(e,t){var n=this;e.on("editorActions.init",YT,function(i){var r=i.editorActions;n.registerBindings(t,r)})}Ao.$inject=["eventBus","keyboard"],Ao.prototype.registerBindings=function(e,t){function n(i,r){t.isRegistered(i)&&e.addListener(r)}n("undo",function(i){var r=i.keyEvent;if(vP(r))return t.trigger("undo"),!0}),n("redo",function(i){var r=i.keyEvent;if(_P(r))return t.trigger("redo"),!0}),n("copy",function(i){var r=i.keyEvent;if(hP(r))return t.trigger("copy"),!0}),n("paste",function(i){var r=i.keyEvent;if(mP(r))return t.trigger("paste"),!0}),n("duplicate",function(i){var r=i.keyEvent;if(gP(r))return t.trigger("duplicate"),!0}),n("cut",function(i){var r=i.keyEvent;if(yP(r))return t.trigger("cut"),!0}),n("stepZoom",function(i){var r=i.keyEvent;if(Ht(["+","Add","="],r)&&Tn(r))return t.trigger("stepZoom",{value:1}),!0}),n("stepZoom",function(i){var r=i.keyEvent;if(Ht(["-","Subtract"],r)&&Tn(r))return t.trigger("stepZoom",{value:-1}),!0}),n("zoom",function(i){var r=i.keyEvent;if(Ht("0",r)&&Tn(r))return t.trigger("zoom",{value:1}),!0}),n("removeSelection",function(i){var r=i.keyEvent;if(Ht(["Backspace","Delete","Del"],r))return t.trigger("removeSelection"),!0})};const Zp={__init__:["keyboard","keyboardBindings"],keyboard:["type",gn],keyboardBindings:["type",Ao]};var qT={moveSpeed:50,moveSpeedAccelerated:200};function Sv(e,t,n){var i=this;this._config=O({},qT,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})}}Sv.$inject=["config.keyboardMove","keyboard","canvas"];const Rv={__depends__:[Zp],__init__:["keyboardMove"],keyboardMove:["type",Sv]};var KT=15;function Cv(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=Br(s),p=ii(l,c);if(!n.dragging&&XT(p)>KT&&(n.dragging=!0,u===0&&Jg(e),cc("grab")),n.dragging){var f=n.last||n.start;p=ii(l,f),t.scroll({dx:p.x,dy:p.y}),n.last=l}s.preventDefault()}function o(s){Se.unbind(document,"mousemove",r),Se.unbind(document,"mouseup",o),n=null,Qg()}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:Br(s)},Se.bind(document,"mousemove",r),Se.bind(document,"mouseup",o),!0}}this.isActive=function(){return!!n}}Cv.$inject=["eventBus","canvas"];function XT(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}const Pv={__init__:["moveCanvas"],moveCanvas:["type",Cv]};function Av(e,t){var n=ml(e.min),i=ml(e.max),r=Math.abs(n)+Math.abs(i);return r/t}function ZT(e,t){return Math.max(e.min,Math.min(e.max,t))}var QT=Math.sign||function(e){return e>=0?1:-1},Qp={min:.2,max:4},Tv=10,JT=.1,eM=.75;function vi(e,t,n){e=e||{},this._enabled=!1,this._canvas=n,this._container=n._container,this._handleWheel=vn(this._handleWheel,this),this._totalDelta=0,this._scale=e.scale||eM;var i=this;t.on("canvas.mouseover",function(){i._init(e.enabled!==!1)}),t.on("canvas.mouseout",function(){i._init(!1)})}vi.$inject=["config.zoomScroll","eventBus","canvas"],vi.prototype.scroll=function(t){this._canvas.scroll(t)},vi.prototype.reset=function(){this._canvas.zoom("fit-viewport")},vi.prototype.zoom=function(t,n){var i=Av(Qp,Tv*2);this._totalDelta+=t,Math.abs(this._totalDelta)>JT&&(this._zoom(t,n,i),this._totalDelta=0)},vi.prototype._handleWheel=function(t){if(this._enabled){var n=this._container;t.preventDefault();var i=t.ctrlKey||ag()&&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))*QT(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)}},vi.prototype.stepZoom=function(t,n){var i=Av(Qp,Tv);this._zoom(t,n,i)},vi.prototype._zoom=function(e,t,n){var i=this._canvas,r=e>0?1:-1,o=ml(i.zoom()),a=Math.round(o/n)*n;a+=n*r;var s=Math.pow(10,a);i.zoom(ZT(Qp,s),t)},vi.prototype.toggle=function(t){var n=this._container,i=this._handleWheel,r=this._enabled;return typeof t>"u"&&(t=!r),r!==t&&Se[t?"bind":"unbind"](n,"wheel",i,!1),this._enabled=t,t},vi.prototype._init=function(e){this.toggle(e)};const Mv={__init__:["zoomScroll"],zoomScroll:["type",vi]};function Da(e){mr.call(this,e)}ie(Da,mr),Da.prototype._navigationModules=[Rv,Pv,Mv],Da.prototype._modules=[].concat(mr.prototype._modules,Da.prototype._navigationModules);function Jp(e){return e&&e[e.length-1]}function kv(e){return e.y}function Dv(e){return e.x}var tM={left:Dv,center:Dv,right:function(e){return e.x+e.width},top:kv,middle:kv,bottom:function(e){return e.y+e.height}};function To(e,t){this._modeling=e,this._rules=t}To.$inject=["modeling","rules"],To.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}},To.prototype._isType=function(e,t){return t.indexOf(e)!==-1},To.prototype._alignmentPosition=function(e,t){var n=this._getOrientationDetails(e),i=n.axis,r=n.dimension,o={},a={},s=!1,c,u,l;function p(f,d){return Math.round((f[i]+d[i]+d[r])/2)}if(this._isType(e,["left","top"]))o[e]=t[0][i];else if(this._isType(e,["right","bottom"]))l=Jp(t),o[e]=l[i]+l[r];else if(this._isType(e,["center","middle"])){if(M(t,function(f){var d=f[i]+Math.round(f[r]/2);a[d]?a[d].elements.push(f):a[d]={elements:[f],center:d}}),c=oi(a,function(f){return f.elements.length>1&&(s=!0),f.elements.length}),s)return o[e]=Jp(c).center,o;u=t[0],t=oi(t,function(f){return f[i]+f[r]}),l=Jp(t),o[e]=p(u,l)}return o},To.prototype.trigger=function(e,t){var n=this._modeling,i,r=Oe(e,function(c){return!(c.waypoints||c.host||c.labelTarget)});if(i=this._rules.allowed("elements.align",{elements:r}),_e(i)&&(r=i),!(r.length<2||!i)){var o=tM[t],a=oi(r,o),s=this._alignmentPosition(t,a);n.alignElements(a,s)}};const nM={__init__:["alignElements"],alignElements:["type",To]},iM=new So;function Mo(e){this._scheduled={},e.on("diagram.destroy",()=>{Object.keys(this._scheduled).forEach(t=>{this.cancel(t)})})}Mo.$inject=["eventBus"],Mo.prototype.schedule=function(e,t=iM.next()){this.cancel(t);const n=this._schedule(e,t);return this._scheduled[t]=n,n.promise},Mo.prototype._schedule=function(e,t){const n=rM();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}},Mo.prototype.cancel=function(e){const t=this._scheduled[e];t&&(this._cancel(t),this._scheduled[e]=null)},Mo.prototype._cancel=function(e){clearTimeout(e.executionId)};function rM(){const e={};return e.promise=new Promise((t,n)=>{e.resolve=t,e.reject=n}),e}const oM={scheduler:["type",Mo]};var aM="djs-element-hidden",Nc=".entry",sM=1e3,Ov=8,cM=300;function Mt(e,t,n,i){this._canvas=e,this._elementRegistry=t,this._eventBus=n,this._scheduler=i,this._current=null,this._init()}Mt.$inject=["canvas","elementRegistry","eventBus","scheduler"],Mt.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=_e(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=_e(i.target)?i.target:[i.target];r.includes(n)&&e._updateVisibility()}}),this._container=this._createContainer()},Mt.prototype._createContainer=function(){var e=ut('<div class="djs-context-pad-parent"></div>');return this._canvas.getContainer().appendChild(e),e},Mt.prototype.registerProvider=function(e,t){t||(t=e,e=sM),this._eventBus.on("contextPad.getProviders",e,function(n){n.providers.push(t)})},Mt.prototype.getEntries=function(e){var t=this._getProviders(),n=_e(e)?"getMultiElementContextPadEntries":"getContextPadEntries",i={};return M(t,function(r){if(Wt(r[n])){var o=r[n](e);Wt(o)?i=o(i):M(o,function(a,s){i[s]=a})}}),i},Mt.prototype.trigger=function(e,t,n){var i=this,r,o,a=t.delegateTarget||t.target;if(!a)return t.preventDefault();if(r=an(a,"data-action"),o=t.originalEvent||t,e==="mouseover"){this._timeout=setTimeout(function(){i._mouseout=i.triggerEntry(r,"hover",o,n)},cM);return}else if(e==="mouseout"){clearTimeout(this._timeout),this._mouseout&&(this._mouseout(),this._mouseout=null);return}return this.triggerEntry(r,e,o,n)},Mt.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(Wt(s)){if(t==="click")return s(n,r,i)}else if(s[t])return s[t](n,r,i);n.preventDefault()}}}},Mt.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))}},Mt.prototype._getProviders=function(){var e=this._eventBus.createEvent({type:"contextPad.getProviders",providers:[]});return this._eventBus.fire(e),e.providers},Mt.prototype._updateAndOpen=function(e){var t=this.getEntries(e),n=this._createHtml(e),i;M(t,function(r,o){var a=r.group||"default",s=ut(r.html||'<div class="entry" draggable="true"></div>'),c;an(s,"data-action",o),c=et("[data-group="+ka(a)+"]",n),c||(c=ut('<div class="group"></div>'),an(c,"data-group",a),n.appendChild(c)),c.appendChild(s),r.className&&uM(s,r.className),r.title&&an(s,"title",r.title),r.imageUrl&&(i=ut("<img>"),an(i,"src",r.imageUrl),i.style.width="100%",i.style.height="100%",s.appendChild(i))}),mt(n).add("open"),this._current={entries:t,html:n,target:e},this._updatePosition(),this._updateVisibility(),this._eventBus.fire("contextPad.open",{current:this._current})},Mt.prototype._createHtml=function(e){var t=this,n=ut('<div class="djs-context-pad"></div>');return Cn.bind(n,Nc,"click",function(i){t.trigger("click",i)}),Cn.bind(n,Nc,"dragstart",function(i){t.trigger("dragstart",i)}),Cn.bind(n,Nc,"mouseover",function(i){t.trigger("mouseover",i)}),Cn.bind(n,Nc,"mouseout",function(i){t.trigger("mouseout",i)}),Se.bind(n,"mousedown",function(i){i.stopPropagation()}),this._container.appendChild(n),this._eventBus.fire("contextPad.create",{target:e,pad:n}),n},Mt.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()&&pM(this._current.target,e)?t=this._current.html:t=this._createHtml(e),{html:t}},Mt.prototype.close=function(){this.isOpen()&&(clearTimeout(this._timeout),this._container.innerHTML="",this._eventBus.fire("contextPad.close",{current:this._current}),this._current=null)},Mt.prototype.isOpen=function(e){var t=this._current;if(!t)return!1;if(!e)return!0;var n=t.target;return _e(e)!==_e(n)?!1:_e(e)?e.length===n.length&&Rr(e,function(i){return n.includes(i)}):n===e},Mt.prototype.isShown=function(){return this.isOpen()&&mt(this._current.html).has("open")},Mt.prototype.show=function(){this.isOpen()&&(mt(this._current.html).add("open"),this._updatePosition(),this._eventBus.fire("contextPad.show",{current:this._current}))},Mt.prototype.hide=function(){this.isOpen()&&(mt(this._current.html).remove("open"),this._eventBus.fire("contextPad.hide",{current:this._current}))},Mt.prototype._getPosition=function(e){if(!_e(e)&&it(e)){var t=this._canvas.viewbox(),n=lM(e),i=n.x*t.scale-t.x*t.scale,r=n.y*t.scale-t.y*t.scale;return{left:i+Ov*this._canvas.zoom(),top:r}}var o=this._canvas.getContainer(),a=o.getBoundingClientRect(),s=this._getTargetBounds(e);return{left:s.right-a.left+Ov*this._canvas.zoom(),top:s.top-a.top}},Mt.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")},Mt.prototype._updateVisibility=function(){const e=()=>{if(this.isOpen()){var t=this,n=this._current.target,i=_e(n)?n:[n],r=i.some(function(o){return t._canvas.hasMarker(o,aM)});r?t.hide():t.show()}};this._scheduler.schedule(e,"ContextPad#_updateVisibility")},Mt.prototype._getTargetBounds=function(e){var t=this,n=_e(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 uM(e,t){var n=mt(e);t=_e(t)?t:t.split(/\s+/g),t.forEach(function(i){n.add(i)})}function lM(e){return e.waypoints[e.waypoints.length-1]}function pM(e,t){return e=_e(e)?e:[e],t=_e(t)?t:[t],e.length===t.length&&Rr(e,function(n){return t.includes(n)})}const Lv={__depends__:[sc,oM,Oc],contextPad:["type",Mt]};var Bc,_t,Iv,gr,Nv,Bv,$v,ef,$c,Oa,jv,tf,nf,rf,jc={},Fc=[],fM=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,Hc=Array.isArray;function $i(e,t){for(var n in t)e[n]=t[n];return e}function of(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function Fv(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?Bc.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 zc(e,a,i,r,null)}function zc(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??++Iv,__i:-1,__u:0};return r==null&&_t.vnode!=null&&_t.vnode(o),o}function Vc(e){return e.children}function Gc(e,t){this.props=e,this.context=t}function Gr(e,t){if(t==null)return e.__?Gr(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"?Gr(e):null}function dM(e){if(e.__P&&e.__d){var t=e.__v,n=t.__e,i=[],r=[],o=$i({},t);o.__v=t.__v+1,_t.vnode&&_t.vnode(o),af(e.__P,o,t,e.__n,e.__P.namespaceURI,32&t.__u?[n]:null,i,n??Gr(t),!!(32&t.__u),r),o.__v=t.__v,o.__.__k[o.__i]=o,qv(i,o,r),t.__e=t.__=null,o.__e!=n&&Hv(o)}}function Hv(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}),Hv(e)}function zv(e){(!e.__d&&(e.__d=!0)&&gr.push(e)&&!Wc.__r++||Nv!=_t.debounceRendering)&&((Nv=_t.debounceRendering)||Bv)(Wc)}function Wc(){try{for(var e,t=1;gr.length;)gr.length>t&&gr.sort($v),e=gr.shift(),t=gr.length,dM(e)}finally{gr.length=Wc.__r=0}}function Vv(e,t,n,i,r,o,a,s,c,u,l){var p,f,d,h,m,g,R=i&&i.__k||Fc,w=t.length;for(c=hM(n,t,R,c,w),p=0;p<w;p++)(d=n.__k[p])!=null&&(f=d.__i!=-1&&R[d.__i]||jc,d.__i=p,g=af(e,d,f,r,o,a,s,c,u,l),h=d.__e,d.ref&&f.ref!=d.ref&&(f.ref&&sf(f.ref,null,d),l.push(d.ref,d.__c||h,d)),m==null&&h!=null&&(m=h),4&d.__u?(c=Gv(d,c,e),f.__e&&(f.__e=null)):typeof d.type=="function"&&g!==void 0?c=g:h&&(c=h.nextSibling),d.__u&=-7);return n.__e=m,c}function hM(e,t,n,i,r){var o,a,s,c,u,l=n.length,p=l,f=0;for(e.__k=new Array(r),o=0;o<r;o++)(a=t[o])!=null&&typeof a!="boolean"&&typeof a!="function"?(typeof a=="string"||typeof a=="number"||typeof a=="bigint"||a.constructor==String?a=e.__k[o]=zc(null,a,null,null,null):Hc(a)?a=e.__k[o]=zc(Vc,{children:a},null,null,null):a.constructor===void 0&&a.__b>0?a=e.__k[o]=zc(a.type,a.props,a.key,a.ref?a.ref:null,a.__v):e.__k[o]=a,c=o+f,a.__=e,a.__b=e.__b+1,s=null,(u=a.__i=mM(a,n,c,p))!=-1&&(p--,(s=n[u])&&(s.__u|=2)),s==null||s.__v==null?(u==-1&&(r>l?f--:r<l&&f++),typeof a.type!="function"&&(a.__u|=4)):u!=c&&(u==c-1?f--:u==c+1?f++:(u>c?f--:f++,a.__u|=4))):e.__k[o]=null;if(p)for(o=0;o<l;o++)(s=n[o])!=null&&(2&s.__u)==0&&(s.__e==i&&(i=Gr(s)),Xv(s,s));return i}function Gv(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=Gv(i[r],t,n));return t}e.__e!=t&&(t&&e.type&&!t.parentNode&&(t=Gr(e)),t=n.insertBefore(e.__e,t||null));do t=t&&t.nextSibling;while(t!=null&&t.nodeType==8);return t}function mM(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 Wv(e,t,n){t[0]=="-"?e.setProperty(t,n??""):e[t]=n==null?"":typeof n!="number"||fM.test(t)?n:n+"px"}function Uc(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||Wv(e.style,t,"");if(n)for(t in n)i&&n[t]==i[t]||Wv(e.style,t,n[t])}else if(t[0]=="o"&&t[1]=="n")o=t!=(t=t.replace(jv,"$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[Oa]=i[Oa]:(n[Oa]=tf,e.addEventListener(t,o?rf:nf,o)):e.removeEventListener(t,o?rf:nf,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 Uv(e){return function(t){if(this.l){var n=this.l[t.type+e];if(t[$c]==null)t[$c]=tf++;else if(t[$c]<n[Oa])return;return n(_t.event?_t.event(t):t)}}}function af(e,t,n,i,r,o,a,s,c,u){var l,p,f,d,h,m,g,R,w,b,x,E,T,L,A,j,H=t.type;if(t.constructor!==void 0)return null;128&n.__u&&(c=!!(32&n.__u),o=[s=t.__e=n.__e]),(l=_t.__b)&&l(t);e:if(typeof H=="function"){p=a.length;try{if(w=t.props,b=H.prototype&&H.prototype.render,x=(l=H.contextType)&&i[l.__c],E=l?x?x.props.value:l.__:i,n.__c?R=(f=t.__c=n.__c).__=f.__E:(b?t.__c=f=new H(w,E):(t.__c=f=new Gc(w,E),f.constructor=H,f.render=yM),x&&x.sub(f),f.state||(f.state={}),f.__n=i,d=f.__d=!0,f.__h=[],f._sb=[]),b&&f.__s==null&&(f.__s=f.state),b&&H.getDerivedStateFromProps!=null&&(f.__s==f.state&&(f.__s=$i({},f.__s)),$i(f.__s,H.getDerivedStateFromProps(w,f.__s))),h=f.props,m=f.state,f.__v=t,d)b&&H.getDerivedStateFromProps==null&&f.componentWillMount!=null&&f.componentWillMount(),b&&f.componentDidMount!=null&&f.__h.push(f.componentDidMount);else{if(b&&H.getDerivedStateFromProps==null&&w!==h&&f.componentWillReceiveProps!=null&&f.componentWillReceiveProps(w,E),t.__v==n.__v||!f.__e&&f.shouldComponentUpdate!=null&&f.shouldComponentUpdate(w,f.__s,E)===!1){t.__v!=n.__v&&(f.props=w,f.state=f.__s,f.__d=!1),t.__e=n.__e,t.__k=n.__k,t.__k.some(function(N){N&&(N.__=t)}),Fc.push.apply(f.__h,f._sb),f._sb=[],f.__h.length&&a.push(f),s=Gr(n);break e}f.componentWillUpdate!=null&&f.componentWillUpdate(w,f.__s,E),b&&f.componentDidUpdate!=null&&f.__h.push(function(){f.componentDidUpdate(h,m,g)})}if(f.context=E,f.props=w,f.__P=e,f.__e=!1,T=_t.__r,L=0,b)f.state=f.__s,f.__d=!1,T&&T(t),l=f.render(f.props,f.state,f.context),Fc.push.apply(f.__h,f._sb),f._sb=[];else do f.__d=!1,T&&T(t),l=f.render(f.props,f.state,f.context),f.state=f.__s;while(f.__d&&++L<25);f.state=f.__s,f.getChildContext!=null&&(i=$i($i({},i),f.getChildContext())),b&&!d&&f.getSnapshotBeforeUpdate!=null&&(g=f.getSnapshotBeforeUpdate(h,m)),A=l!=null&&l.type===Vc&&l.key==null?Kv(l.props.children):l,s=Vv(e,Hc(A)?A:[A],t,n,i,r,o,a,s,c,u),f.base=t.__e,t.__u&=-161,f.__h.length&&a.push(f),R&&(f.__E=f.__=null)}catch(N){if(a.length=p,t.__v=null,c||o!=null){if(N.then){for(t.__u|=c?160:128;s&&s.nodeType==8&&s.nextSibling;)s=s.nextSibling;o!=null&&(o[o.indexOf(s)]=null),t.__e=s}else if(o!=null)for(j=o.length;j--;)of(o[j])}else t.__e=n.__e;t.__k==null&&(t.__k=n.__k||[]),N.then||Yv(t),_t.__e(N,t,n)}}else o==null&&t.__v==n.__v?(t.__k=n.__k,t.__e=n.__e):s=t.__e=gM(n.__e,t,n,i,r,o,a,c,u);return(l=_t.diffed)&&l(t),128&t.__u?void 0:s}function Yv(e){e&&(e.__c&&(e.__c.__e=!0),e.__k&&e.__k.some(Yv))}function qv(e,t,n){for(var i=0;i<n.length;i++)sf(n[i],n[++i],n[++i]);_t.__c&&_t.__c(t,e),e.some(function(r){try{e=r.__h,r.__h=[],e.some(function(o){o.call(r)})}catch(o){_t.__e(o,r.__v)}})}function Kv(e){return typeof e!="object"||e==null||e.__b>0?e:Hc(e)?e.map(Kv):e.constructor!==void 0?null:$i({},e)}function gM(e,t,n,i,r,o,a,s,c){var u,l,p,f,d,h,m,g=n.props||jc,R=t.props,w=t.type;if(w=="svg"?r="http://www.w3.org/2000/svg":w=="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==!!w&&(w?d.localName==w:d.nodeType==3)){e=d,o[u]=null;break}}if(e==null){if(w==null)return document.createTextNode(R);e=document.createElementNS(r,w,R.is&&R),s&&(_t.__m&&_t.__m(t,o),s=!1),o=null}if(w==null)g===R||s&&e.data==R||(e.data=R);else{if(o=w=="textarea"&&R.defaultValue!=null?null:o&&Bc.call(e.childNodes),!s&&o!=null)for(g={},u=0;u<e.attributes.length;u++)g[(d=e.attributes[u]).name]=d.value;for(u in g)d=g[u],u=="dangerouslySetInnerHTML"?p=d:u=="children"||u in R||u=="value"&&"defaultValue"in R||u=="checked"&&"defaultChecked"in R||Uc(e,u,null,d,r);for(u in R)d=R[u],u=="children"?f=d:u=="dangerouslySetInnerHTML"?l=d:u=="value"?h=d:u=="checked"?m=d:s&&typeof d!="function"||g[u]===d||Uc(e,u,d,g[u],r);if(l)s||p&&(l.__html==p.__html||l.__html==e.innerHTML)||(e.innerHTML=l.__html),t.__k=[];else if(p&&(e.innerHTML=""),Vv(t.type=="template"?e.content:e,Hc(f)?f:[f],t,n,i,w=="foreignObject"?"http://www.w3.org/1999/xhtml":r,o,a,o?o[0]:n.__k&&Gr(n,0),s,c),o!=null)for(u=o.length;u--;)of(o[u]);s&&w!="textarea"||(u="value",w=="progress"&&h==null?e.removeAttribute("value"):h!=null&&(h!==e[u]||w=="progress"&&!h||w=="option"&&h!=g[u])&&Uc(e,u,h,g[u],r),u="checked",m!=null&&m!=e[u]&&Uc(e,u,m,g[u],r))}return e}function sf(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){_t.__e(r,n)}}function Xv(e,t,n){var i,r;if(_t.unmount&&_t.unmount(e),(i=e.ref)&&(i.current&&i.current!=e.__e||sf(i,null,t)),(i=e.__c)!=null){if(i.componentWillUnmount)try{i.componentWillUnmount()}catch(o){_t.__e(o,t)}i.base=i.__P=i.__n=null}if(i=e.__k)for(r=0;r<i.length;r++)i[r]&&Xv(i[r],t,n||typeof e.type!="function");n||of(e.__e),e.__c=e.__=e.__e=void 0}function yM(e,t,n){return this.constructor(e,n)}function Zv(e,t,n){var i,r,o,a;t==document&&(t=document.documentElement),_t.__&&_t.__(e,t),r=(i=!1)?null:t.__k,o=[],a=[],af(t,e=t.__k=Fv(Vc,null,[e]),r||jc,jc,t.namespaceURI,r?null:t.firstChild?Bc.call(t.childNodes):null,o,r?r.__e:t.firstChild,i,a),qv(o,e,a),e.props.children=null}Bc=Fc.slice,_t={__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}},Iv=0,Gc.prototype.setState=function(e,t){var n;n=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=$i({},this.state),typeof e=="function"&&(e=e($i({},n),this.props)),e&&$i(n,e),e!=null&&this.__v&&(t&&this._sb.push(t),zv(this))},Gc.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),zv(this))},Gc.prototype.render=Vc,gr=[],Bv=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,$v=function(e,t){return e.__v.__b-t.__v.__b},Wc.__r=0,ef=Math.random().toString(8),$c="__d"+ef,Oa="__a"+ef,jv=/(PointerCapture)$|Capture$/i,tf=0,nf=Uv(!1),rf=Uv(!0);var Qv=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,Qv(e,s,n,["",null])),i.push(r),s[0]?t[0]|=2:(t[o-2]=0,t[o]=r)):i.push(s)}return i},Jv=new Map;function vM(e){var t=Jv.get(this);return t||(t=new Map,Jv.set(this,t)),(t=Qv(this,t.get(e)||(t.set(e,t=(function(n){for(var i,r,o=1,a="",s="",c=[0],u=function(f){o===1&&(f||(a=a.replace(/^\s*\n\s*|\s*\n\s*$/g,"")))?c.push(0,f,a):o===3&&(f||a)?(c.push(3,f,a),o=2):o===2&&a==="..."&&f?c.push(4,f,0):o===2&&a&&!f?c.push(5,0,!0,a):o>=5&&((a||!f&&o===5)&&(c.push(o,0,a,r),o=6),f&&(c.push(o,f,0,r),o=6)),a=""},l=0;l<n.length;l++){l&&(o===1&&u(),u(l));for(var p=0;p<n[l].length;p++)i=n[l][p],o===1?i==="<"?(u(),c=[c],o=3):a+=i:o===4?a==="--"&&i===">"?(o=1,a=""):a=i+a[0]:s?i===s?s="":a+=i:i==='"'||i==="'"?s=i:i===">"?(u(),o=1):o&&(i==="="?(o=5,r=a,a=""):i==="/"&&(o<5||n[l][p+1]===">")?(u(),o===3&&(c=c[0]),o=c,(c=c[0]).push(2,0,o),o=0):i===" "||i===" "||i===`
11
- `||i==="\r"?(u(),o=2):a+=i),o===3&&a==="!--"&&(o=4,c=c[0])}return u(),c})(e)),t),arguments,[])).length>1?t:t[0]}var ot=vM.bind(Fv),ko,kt,cf,e_,La=0,t_=[],zt=_t,n_=zt.__b,i_=zt.__r,r_=zt.diffed,o_=zt.__c,a_=zt.unmount,s_=zt.__;function Yc(e,t){zt.__h&&zt.__h(kt,e,La||t),La=0;var n=kt.__H||(kt.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({}),n.__[e]}function uf(e){return La=1,_M(u_,e)}function _M(e,t,n){var i=Yc(ko++,2);if(i.t=e,!i.__c&&(i.__=[u_(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=kt,!kt.__f)){var r=function(s,c,u){if(!i.__c.__H)return!0;var l=!1,p=i.__c.props!==s;if(i.__c.__H.__.some(function(d){if(d.__N){l=!0;var h=d.__[0];d.__=d.__N,d.__N=void 0,h!==d.__[0]&&(p=!0)}}),o){var f=o.call(this,s,c,u);return l?f||p:f}return!l||p};kt.__f=!0;var o=kt.shouldComponentUpdate,a=kt.componentWillUpdate;kt.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)},kt.shouldComponentUpdate=r}return i.__N||i.__}function qc(e,t){var n=Yc(ko++,3);!zt.__s&&ff(n.__H,t)&&(n.__=e,n.u=t,kt.__H.__h.push(n))}function lf(e,t){var n=Yc(ko++,4);!zt.__s&&ff(n.__H,t)&&(n.__=e,n.u=t,kt.__h.push(n))}function Kc(e){return La=5,ji(function(){return{current:e}},[])}function ji(e,t){var n=Yc(ko++,7);return ff(n.__H,t)&&(n.__=e(),n.__H=t,n.__h=e),n.__}function Ia(e,t){return La=8,ji(function(){return e},t)}function bM(){for(var e;e=t_.shift();){var t=e.__H;if(e.__P&&t)try{t.__h.some(Xc),t.__h.some(pf),t.__h=[]}catch(n){t.__h=[],zt.__e(n,e.__v)}}}zt.__b=function(e){kt=null,n_&&n_(e)},zt.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),s_&&s_(e,t)},zt.__r=function(e){i_&&i_(e),ko=0;var t=(kt=e.__c).__H;t&&(cf===kt?(t.__h=[],kt.__h=[],t.__.some(function(n){n.__N&&(n.__=n.__N),n.u=n.__N=void 0})):(t.__h.some(Xc),t.__h.some(pf),t.__h=[],ko=0)),cf=kt},zt.diffed=function(e){r_&&r_(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(t_.push(t)!==1&&e_===zt.requestAnimationFrame||((e_=zt.requestAnimationFrame)||xM)(bM)),t.__H.__.some(function(n){n.u&&(n.__H=n.u,n.u=void 0)})),cf=kt=null},zt.__c=function(e,t){t.some(function(n){try{n.__h.some(Xc),n.__h=n.__h.filter(function(i){return!i.__||pf(i)})}catch(i){t.some(function(r){r.__h&&(r.__h=[])}),t=[],zt.__e(i,n.__v)}}),o_&&o_(e,t)},zt.unmount=function(e){a_&&a_(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.some(function(i){try{Xc(i)}catch(r){t=r}}),n.__H=void 0,t&&zt.__e(t,n.__v))};var c_=typeof requestAnimationFrame=="function";function xM(e){var t,n=function(){clearTimeout(i),c_&&cancelAnimationFrame(t),setTimeout(e)},i=setTimeout(n,35);c_&&(t=requestAnimationFrame(n))}function Xc(e){var t=kt,n=e.__c;typeof n=="function"&&(e.__c=void 0,n()),kt=t}function pf(e){var t=kt;e.__c=e.__(),kt=t}function ff(e,t){return!e||e.length!==t.length||t.some(function(n,i){return n!==e[i]})}function u_(e,t){return typeof t=="function"?t(e):t}function wM(e){const{navigationStack:t,setNavigationStack:n}=e,i=ji(()=>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 ot`
10
+ <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="`+f+'" height="'+d+'" viewBox="'+l+" "+p+" "+f+" "+d+'" version="1.1">'+s+a+"</svg>"}catch(i){n=i}if(this._emit("saveSVG.done",{error:n,svg:t}),n)throw n;return{svg:t}},yt.prototype._setDefinitions=function(e){this._definitions=e},yt.prototype.getModules=function(){return this._modules},yt.prototype.clear=function(){this.getDefinitions()&&tr.prototype.clear.call(this)},yt.prototype.destroy=function(){tr.prototype.destroy.call(this),li(this._container)},yt.prototype.on=function(e,t,n,i){return this.get("eventBus").on(e,t,n,i)},yt.prototype.off=function(e,t){this.get("eventBus").off(e,t)},yt.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=et(e)),e.appendChild(this._container),this._emit("attach",{}),this.get("canvas").resized()},yt.prototype.getDefinitions=function(){return this._definitions},yt.prototype.detach=function(){const e=this._container,t=e.parentNode;t&&(this._emit("detach",{}),t.removeChild(e))},yt.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=O(ai(n,["additionalModules"]),{canvas:O({},n.canvas,{container:e}),modules:a});tr.call(this,s),n&&n.container&&this.attachTo(n.container)},yt.prototype._emit=function(e,t){return this.get("eventBus").fire(e,t)},yt.prototype._createContainer=function(e){const t=ut('<div class="bjs-container"></div>');return mn(t,{width:om(e.width),height:om(e.height),position:e.position}),t},yt.prototype._createModdle=function(e){const t=O({},this._moddleExtensions,e.moddleExtensions);return new pd(t)},yt.prototype._modules=[];function As(e,t){return e.warnings=t,e}function J1(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 eS={width:"100%",height:"100%",position:"relative"};function om(e){return e+(we(e)?"px":"")}function tS(e,t){return t&&st(e.diagrams,function(n){return n.id===t})||null}function nS(e){const n='<a href="http://bpmn.io" target="_blank" class="bjs-powered-by" title="Powered by bpmn.io" >'+tm+"</a>",i=ut(n);mn(et("svg",i),nm),mn(i,im,{position:"absolute",bottom:"15px",right:"15px",zIndex:"100"}),e.appendChild(i),Se.bind(i,"click",function(r){Q1(),r.preventDefault()})}function uo(e){yt.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)}ie(uo,yt),uo.prototype._createModdle=function(e){var t=yt.prototype._createModdle.call(this,e);return t.ids=new ui([32,36,1]),t},uo.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 $e(e,t){return v(e,"bpmn:CallActivity")?!1:v(e,"bpmn:SubProcess")?(t=t||Ve(e),t&&v(t,"bpmndi:BPMNPlane")?!0:t&&!!t.isExpanded):v(e,"bpmn:Participant")?!!Z(e).processRef:!0}function Yt(e){if(!(!v(e,"bpmn:Participant")&&!v(e,"bpmn:Lane"))){var t=Ve(e).isHorizontal;return t===void 0?!0:t}}function iS(e){return e&&Z(e).isInterrupting!==!1}function cn(e){return e&&!!Z(e).triggeredByEvent}function lo(e,t){var n=Z(e).eventDefinitions;return Vi(n,function(i){return v(i,t)})}function rS(e){return lo(e,"bpmn:ErrorEventDefinition")}function oS(e){return lo(e,"bpmn:EscalationEventDefinition")}function aS(e){return lo(e,"bpmn:CompensateEventDefinition")}var Ir={width:90,height:20},am=15;function nr(e){return v(e,"bpmn:Event")||v(e,"bpmn:Gateway")||v(e,"bpmn:DataStoreReference")||v(e,"bpmn:DataObjectReference")||v(e,"bpmn:DataInput")||v(e,"bpmn:DataOutput")||v(e,"bpmn:SequenceFlow")||v(e,"bpmn:MessageFlow")||v(e,"bpmn:Group")}function Ts(e){return Me(e.label)}function sS(e){var t=e.length/2-1,n=e[Math.floor(t)],i=e[Math.ceil(t+.01)],r=cS(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-=am:a+=am,{x:a,y:s}}function cS(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 pl(e){return e.waypoints?sS(e.waypoints):v(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 uS(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=pl(t),i=Ir),O({x:n.x-i.width/2,y:n.y-i.height/2},i)}function sm(e){if(v(e,"bpmn:FlowElement")||v(e,"bpmn:Participant")||v(e,"bpmn:Lane")||v(e,"bpmn:SequenceFlow")||v(e,"bpmn:MessageFlow")||v(e,"bpmn:DataInput")||v(e,"bpmn:DataOutput"))return"name";if(v(e,"bpmn:TextAnnotation"))return"text";if(v(e,"bpmn:Group"))return"categoryValueRef"}function lS(e){var t=e.categoryValueRef;return t&&t.value||""}function jn(e){var t=e.businessObject,n=sm(t);if(n)return n==="categoryValueRef"?lS(t):t[n]||""}function pS(e,t){var n=e.businessObject,i=sm(n);if(i)if(i==="categoryValueRef"){if(!n[i])return e;n[i].value=t}else n[i]=t;return e}function fS(e){return Me(e)&&nr(e.labelTarget)}var po=7;function cm(e){let t=[];return k(e.incoming,n=>{v(n,"bpmn:Association")&&v(n.source,"bpmn:TextAnnotation")&&t.push({annotation:n.source,association:n})}),k(e.outgoing,n=>{v(n,"bpmn:Association")&&v(n.target,"bpmn:TextAnnotation")&&t.push({annotation:n.target,association:n})}),t}function na(e){const t=new Map;return k(rl(e),n=>{k(cm(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 fl="hsl(225, 10%, 15%)",dS="white";function hi(e,t){return Vi(e.eventDefinitions,function(n){return n.$type===t})}function hS(e){return e.$type==="bpmn:IntermediateThrowEvent"||e.$type==="bpmn:EndEvent"}function mS(e){var t=e.dataObjectRef;return e.isCollection||t&&t.isCollection}function Ie(e,t,n){var i=Ve(e);return n||i.get("color:background-color")||i.get("bioc:fill")||t||dS}function te(e,t,n){var i=Ve(e);return n||i.get("color:border-color")||i.get("bioc:stroke")||t||fl}function ia(e,t,n,i){var r=Ve(e),o=r.get("label");return i||o&&o.get("color:color")||t||te(e,n)}function um(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 dl(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 gS(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 yS(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 ra(e,t={}){return{width:Gn(e,t),height:An(e,t)}}function Gn(e,t={}){return En(t,"width")?t.width:e.width}function An(e,t={}){return En(t,"height")?t.height:e.height}var vS=new ui,_S=10,Ms=3,bS=1.5,ks=10,xS=4,fo=.95,wS=1,ES=.25;function Nr(e,t,n,i,r,o,a){Pi.call(this,t,a);var s=e&&e.defaultFillColor,c=e&&e.defaultStrokeColor,u=e&&e.defaultLabelColor;function l(P){return n.computeStyle(P,{strokeLinecap:"round",strokeLinejoin:"round",stroke:fl,strokeWidth:2,fill:"white"})}function p(P){return n.computeStyle(P,["no-fill"],{strokeLinecap:"round",strokeLinejoin:"round",stroke:fl,strokeWidth:2})}function f(P,_){var{ref:y={x:0,y:0},scale:D=1,element:N,parentGfx:W=r._svg}=_,ae=me("marker",{id:P,viewBox:"0 0 20 20",refX:y.x,refY:y.y,markerWidth:20*D,markerHeight:20*D,orient:"auto"});Re(ae,N);var Pe=et(":scope > defs",W);Pe||(Pe=me("defs"),Re(W,Pe)),Re(Pe,ae)}function d(P,_,y,D){var N=vS.nextPrefixed("marker-");return h(P,N,_,y,D),"url(#"+N+")"}function h(P,_,y,D,N){if(y==="sequenceflow-end"){var W=me("path",{d:"M 1 5 L 11 10 L 1 15 Z",...l({fill:N,stroke:N,strokeWidth:1})});f(_,{element:W,ref:{x:11,y:10},scale:.5,parentGfx:P})}if(y==="messageflow-start"){var ae=me("circle",{cx:6,cy:6,r:3.5,...l({fill:D,stroke:N,strokeWidth:1,strokeDasharray:[1e4,1]})});f(_,{element:ae,ref:{x:6,y:6},parentGfx:P})}if(y==="messageflow-end"){var Pe=me("path",{d:"m 1 5 l 0 -3 l 7 3 l -7 3 z",...l({fill:D,stroke:N,strokeWidth:1,strokeDasharray:[1e4,1]})});f(_,{element:Pe,ref:{x:8.5,y:5},parentGfx:P})}if(y==="association-start"){var Ue=me("path",{d:"M 11 5 L 1 10 L 11 15",...p({fill:"none",stroke:N,strokeWidth:1.5,strokeDasharray:[1e4,1]})});f(_,{element:Ue,ref:{x:1,y:10},scale:.5,parentGfx:P})}if(y==="association-end"){var ft=me("path",{d:"M 1 5 L 11 10 L 1 15",...p({fill:"none",stroke:N,strokeWidth:1.5,strokeDasharray:[1e4,1]})});f(_,{element:ft,ref:{x:11,y:10},scale:.5,parentGfx:P})}if(y==="conditional-flow-marker"){var tt=me("path",{d:"M 0 10 L 8 6 L 16 10 L 8 14 Z",...l({fill:D,stroke:N})});f(_,{element:tt,ref:{x:-1,y:10},scale:.5,parentGfx:P})}if(y==="conditional-default-flow-marker"){var It=me("path",{d:"M 6 4 L 10 16",...l({stroke:N,fill:"none"})});f(_,{element:It,ref:{x:0,y:10},scale:.5,parentGfx:P})}}function m(P,_,y,D,N={}){Gt(D)&&(N=D,D=0),D=D||0,N=l(N);var W=_/2,ae=y/2,Pe=me("circle",{cx:W,cy:ae,r:Math.round((_+y)/4-D),...N});return Re(P,Pe),Pe}function g(P,_,y,D,N,W){Gt(N)&&(W=N,N=0),N=N||0,W=l(W);var ae=me("rect",{x:N,y:N,width:_-N*2,height:y-N*2,rx:D,ry:D,...W});return Re(P,ae),ae}function R(P,_,y,D){var N=_/2,W=y/2,ae=[{x:N,y:0},{x:_,y:W},{x:N,y},{x:0,y:W}],Pe=ae.map(function(ft){return ft.x+","+ft.y}).join(" ");D=l(D);var Ue=me("polygon",{...D,points:Pe});return Re(P,Ue),Ue}function w(P,_,y,D){y=p(y);var N=Ko(_,y,D);return Re(P,N),N}function b(P,_,y){return w(P,_,y,5)}function x(P,_,y){y=p(y);var D=me("path",{...y,d:_});return Re(P,D),D}function E(P,_,y,D){return x(_,y,O({"data-marker":P},D))}function T(P){return Lt[P]}function L(P){return function(_,y,D){return T(P)(_,y,D)}}var A={"bpmn:MessageEventDefinition":function(P,_,y={},D){var N=i.getScaledPath("EVENT_MESSAGE",{xScaleFactor:.9,yScaleFactor:.9,containerWidth:y.width||_.width,containerHeight:y.height||_.height,position:{mx:.235,my:.315}}),W=D?te(_,c,y.stroke):Ie(_,s,y.fill),ae=D?Ie(_,s,y.fill):te(_,c,y.stroke),Pe=x(P,N,{fill:W,stroke:ae,strokeWidth:1});return Pe},"bpmn:TimerEventDefinition":function(P,_,y={}){var D=y.width||_.width,N=y.height||_.height,W=y.width?1:2,ae=m(P,D,N,.2*N,{fill:Ie(_,s,y.fill),stroke:te(_,c,y.stroke),strokeWidth:W}),Pe=i.getScaledPath("EVENT_TIMER_WH",{xScaleFactor:.75,yScaleFactor:.75,containerWidth:D,containerHeight:N,position:{mx:.5,my:.5}});x(P,Pe,{stroke:te(_,c,y.stroke),strokeWidth:W});for(var Ue=0;Ue<12;Ue++){var ft=i.getScaledPath("EVENT_TIMER_LINE",{xScaleFactor:.75,yScaleFactor:.75,containerWidth:D,containerHeight:N,position:{mx:.5,my:.5}}),tt=D/2,It=N/2;x(P,ft,{strokeWidth:1,stroke:te(_,c,y.stroke),transform:"rotate("+Ue*30+","+It+","+tt+")"})}return ae},"bpmn:EscalationEventDefinition":function(P,_,y={},D){var N=i.getScaledPath("EVENT_ESCALATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:y.width||_.width,containerHeight:y.height||_.height,position:{mx:.5,my:.2}}),W=D?te(_,c,y.stroke):Ie(_,s,y.fill);return x(P,N,{fill:W,stroke:te(_,c,y.stroke),strokeWidth:1})},"bpmn:ConditionalEventDefinition":function(P,_,y={}){var D=i.getScaledPath("EVENT_CONDITIONAL",{xScaleFactor:1,yScaleFactor:1,containerWidth:y.width||_.width,containerHeight:y.height||_.height,position:{mx:.5,my:.222}});return x(P,D,{fill:Ie(_,s,y.fill),stroke:te(_,c,y.stroke),strokeWidth:1})},"bpmn:LinkEventDefinition":function(P,_,y={},D){var N=i.getScaledPath("EVENT_LINK",{xScaleFactor:1,yScaleFactor:1,containerWidth:_.width,containerHeight:_.height,position:{mx:.57,my:.263}}),W=D?te(_,c,y.stroke):Ie(_,s,y.fill);return x(P,N,{fill:W,stroke:te(_,c,y.stroke),strokeWidth:1})},"bpmn:ErrorEventDefinition":function(P,_,y={},D){var N=i.getScaledPath("EVENT_ERROR",{xScaleFactor:1.1,yScaleFactor:1.1,containerWidth:y.width||_.width,containerHeight:y.height||_.height,position:{mx:.2,my:.722}}),W=D?te(_,c,y.stroke):Ie(_,s,y.fill);return x(P,N,{fill:W,stroke:te(_,c,y.stroke),strokeWidth:1})},"bpmn:CancelEventDefinition":function(P,_,y={},D){var N=i.getScaledPath("EVENT_CANCEL_45",{xScaleFactor:1,yScaleFactor:1,containerWidth:_.width,containerHeight:_.height,position:{mx:.638,my:-.055}}),W=D?te(_,c,y.stroke):"none",ae=x(P,N,{fill:W,stroke:te(_,c,y.stroke),strokeWidth:1});return Jh(ae,45),ae},"bpmn:CompensateEventDefinition":function(P,_,y={},D){var N=i.getScaledPath("EVENT_COMPENSATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:y.width||_.width,containerHeight:y.height||_.height,position:{mx:.22,my:.5}}),W=D?te(_,c,y.stroke):Ie(_,s,y.fill);return x(P,N,{fill:W,stroke:te(_,c,y.stroke),strokeWidth:1})},"bpmn:SignalEventDefinition":function(P,_,y={},D){var N=i.getScaledPath("EVENT_SIGNAL",{xScaleFactor:.9,yScaleFactor:.9,containerWidth:y.width||_.width,containerHeight:y.height||_.height,position:{mx:.5,my:.2}}),W=D?te(_,c,y.stroke):Ie(_,s,y.fill);return x(P,N,{strokeWidth:1,fill:W,stroke:te(_,c,y.stroke)})},"bpmn:MultipleEventDefinition":function(P,_,y={},D){var N=i.getScaledPath("EVENT_MULTIPLE",{xScaleFactor:1.1,yScaleFactor:1.1,containerWidth:y.width||_.width,containerHeight:y.height||_.height,position:{mx:.211,my:.36}}),W=D?te(_,c,y.stroke):Ie(_,s,y.fill);return x(P,N,{fill:W,stroke:te(_,c,y.stroke),strokeWidth:1})},"bpmn:ParallelMultipleEventDefinition":function(P,_,y={}){var D=i.getScaledPath("EVENT_PARALLEL_MULTIPLE",{xScaleFactor:1.2,yScaleFactor:1.2,containerWidth:y.width||_.width,containerHeight:y.height||_.height,position:{mx:.458,my:.194}});return x(P,D,{fill:Ie(_,s,y.fill),stroke:te(_,c,y.stroke),strokeWidth:1})},"bpmn:TerminateEventDefinition":function(P,_,y={}){var D=m(P,_.width,_.height,8,{fill:te(_,c,y.stroke),stroke:te(_,c,y.stroke),strokeWidth:4});return D}};function F(P,_,y={},D){var N=Z(P),W=hS(N),ae=D||P;return N.get("eventDefinitions")&&N.get("eventDefinitions").length>1?N.get("parallelMultiple")?A["bpmn:ParallelMultipleEventDefinition"](_,ae,y,W):A["bpmn:MultipleEventDefinition"](_,ae,y,W):hi(N,"bpmn:MessageEventDefinition")?A["bpmn:MessageEventDefinition"](_,ae,y,W):hi(N,"bpmn:TimerEventDefinition")?A["bpmn:TimerEventDefinition"](_,ae,y,W):hi(N,"bpmn:ConditionalEventDefinition")?A["bpmn:ConditionalEventDefinition"](_,ae,y,W):hi(N,"bpmn:SignalEventDefinition")?A["bpmn:SignalEventDefinition"](_,ae,y,W):hi(N,"bpmn:EscalationEventDefinition")?A["bpmn:EscalationEventDefinition"](_,ae,y,W):hi(N,"bpmn:LinkEventDefinition")?A["bpmn:LinkEventDefinition"](_,ae,y,W):hi(N,"bpmn:ErrorEventDefinition")?A["bpmn:ErrorEventDefinition"](_,ae,y,W):hi(N,"bpmn:CancelEventDefinition")?A["bpmn:CancelEventDefinition"](_,ae,y,W):hi(N,"bpmn:CompensateEventDefinition")?A["bpmn:CompensateEventDefinition"](_,ae,y,W):hi(N,"bpmn:TerminateEventDefinition")?A["bpmn:TerminateEventDefinition"](_,ae,y,W):null}var z={ParticipantMultiplicityMarker:function(P,_,y={}){var D=Gn(_,y),N=An(_,y),W=i.getScaledPath("MARKER_PARALLEL",{xScaleFactor:1,yScaleFactor:1,containerWidth:D,containerHeight:N,position:{mx:(D/2-6)/D,my:(N-15)/N}});E("participant-multiplicity",P,W,{strokeWidth:2,fill:Ie(_,s,y.fill),stroke:te(_,c,y.stroke)})},SubProcessMarker:function(P,_,y={}){var D=g(P,14,14,0,{strokeWidth:1,fill:Ie(_,s,y.fill),stroke:te(_,c,y.stroke)});Qt(D,_.width/2-7.5,_.height-20);var N=i.getScaledPath("MARKER_SUB_PROCESS",{xScaleFactor:1.5,yScaleFactor:1.5,containerWidth:_.width,containerHeight:_.height,position:{mx:(_.width/2-7.5)/_.width,my:(_.height-20)/_.height}});E("sub-process",P,N,{fill:Ie(_,s,y.fill),stroke:te(_,c,y.stroke)})},ParallelMarker:function(P,_,y){var D=Gn(_,y),N=An(_,y),W=i.getScaledPath("MARKER_PARALLEL",{xScaleFactor:1,yScaleFactor:1,containerWidth:D,containerHeight:N,position:{mx:(D/2+y.parallel)/D,my:(N-20)/N}});E("parallel",P,W,{fill:Ie(_,s,y.fill),stroke:te(_,c,y.stroke)})},SequentialMarker:function(P,_,y){var D=i.getScaledPath("MARKER_SEQUENTIAL",{xScaleFactor:1,yScaleFactor:1,containerWidth:_.width,containerHeight:_.height,position:{mx:(_.width/2+y.seq)/_.width,my:(_.height-19)/_.height}});E("sequential",P,D,{fill:Ie(_,s,y.fill),stroke:te(_,c,y.stroke)})},CompensationMarker:function(P,_,y){var D=i.getScaledPath("MARKER_COMPENSATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:_.width,containerHeight:_.height,position:{mx:(_.width/2+y.compensation)/_.width,my:(_.height-13)/_.height}});E("compensation",P,D,{strokeWidth:1,fill:Ie(_,s,y.fill),stroke:te(_,c,y.stroke)})},LoopMarker:function(P,_,y){var D=Gn(_,y),N=An(_,y),W=i.getScaledPath("MARKER_LOOP",{xScaleFactor:1,yScaleFactor:1,containerWidth:D,containerHeight:N,position:{mx:(D/2+y.loop)/D,my:(N-7)/N}});E("loop",P,W,{strokeWidth:1.5,fill:"none",stroke:te(_,c,y.stroke),strokeMiterlimit:.5})},AdhocMarker:function(P,_,y){var D=Gn(_,y),N=An(_,y),W=i.getScaledPath("MARKER_ADHOC",{xScaleFactor:1,yScaleFactor:1,containerWidth:D,containerHeight:N,position:{mx:(D/2+y.adhoc)/D,my:(N-15)/N}});E("adhoc",P,W,{strokeWidth:1,fill:te(_,c,y.stroke),stroke:te(_,c,y.stroke)})}};function B(P,_,y,D){z[P](_,y,D)}function G(P,_,y=[],D={}){D={fill:D.fill,stroke:D.stroke,width:Gn(_,D),height:An(_,D)};var N=Z(_),W=y.includes("SubProcessMarker");W?D={...D,seq:-21,parallel:-22,compensation:-25,loop:-18,adhoc:10}:D={...D,seq:-5,parallel:-6,compensation:-7,loop:0,adhoc:-8},N.get("isForCompensation")&&y.push("CompensationMarker"),v(N,"bpmn:AdHocSubProcess")&&(y.push("AdhocMarker"),W||O(D,{compensation:D.compensation-18}));var ae=N.get("loopCharacteristics"),Pe=ae&&ae.get("isSequential");ae&&(O(D,{compensation:D.compensation-18}),y.includes("AdhocMarker")&&O(D,{seq:-23,loop:-18,parallel:-24}),Pe===void 0&&y.push("LoopMarker"),Pe===!1&&y.push("ParallelMarker"),Pe===!0&&y.push("SequentialMarker")),y.includes("CompensationMarker")&&y.length===1&&O(D,{compensation:-8}),k(y,function(Ue){B(Ue,P,_,D)})}function fe(P,_,y={}){y=O({size:{width:100}},y);var D=o.createText(_||"",y);return je(D).add("djs-label"),Re(P,D),D}function Fe(P,_,y,D={}){var N=Z(_),W=ra({x:_.x,y:_.y,width:_.width,height:_.height},D);return fe(P,N.name,{align:y,box:W,padding:7,style:{fill:ia(_,u,c,D.stroke)}})}function lt(P,_,y={}){var D={width:_.width,height:_.height,x:_.width/2+_.x,y:_.height/2+_.y};return fe(P,jn(_),{box:D,style:O({},o.getExternalStyle(),{fill:ia(_,u,c,y.stroke)})})}function q(P,_,y,D={}){var N=Yt(y),W=fe(P,_,{box:{height:30,width:N?An(y,D):Gn(y,D)},align:"center-middle",style:{fill:ia(y,u,c,D.stroke)}});if(N){var ae=-1*An(y,D);Cs(W,0,-ae,270)}}function de(P,_,y={}){var{width:D,height:N}=ra(_,y);return g(P,D,N,ks,{...y,fill:Ie(_,s,y.fill),fillOpacity:fo,stroke:te(_,c,y.stroke)})}function he(P,_,y={}){var D=Z(_),N=Ie(_,s,y.fill),W=te(_,c,y.stroke);return(D.get("associationDirection")==="One"||D.get("associationDirection")==="Both")&&(y.markerEnd=d(P,"association-end",N,W)),D.get("associationDirection")==="Both"&&(y.markerStart=d(P,"association-start",N,W)),y=Ge(y,["markerStart","markerEnd"]),b(P,_.waypoints,{...y,stroke:W,strokeDasharray:"0, 5"})}function ce(P,_,y={}){var D=Ie(_,s,y.fill),N=te(_,c,y.stroke),W=i.getScaledPath("DATA_OBJECT_PATH",{xScaleFactor:1,yScaleFactor:1,containerWidth:_.width,containerHeight:_.height,position:{mx:.474,my:.296}}),ae=x(P,W,{fill:D,fillOpacity:fo,stroke:N}),Pe=Z(_);if(mS(Pe)){var Ue=i.getScaledPath("DATA_OBJECT_COLLECTION_PATH",{xScaleFactor:1,yScaleFactor:1,containerWidth:_.width,containerHeight:_.height,position:{mx:.33,my:(_.height-18)/_.height}});x(P,Ue,{strokeWidth:2,fill:D,stroke:N})}return ae}function ue(P,_,y={}){return m(P,_.width,_.height,{fillOpacity:fo,...y,fill:Ie(_,s,y.fill),stroke:te(_,c,y.stroke)})}function ee(P,_,y={}){return R(P,_.width,_.height,{fill:Ie(_,s,y.fill),fillOpacity:fo,stroke:te(_,c,y.stroke)})}function H(P,_,y={}){var D=g(P,Gn(_,y),An(_,y),0,{fill:Ie(_,s,y.fill),fillOpacity:y.fillOpacity||fo,stroke:te(_,c,y.stroke),strokeWidth:1.5}),N=Z(_);if(v(N,"bpmn:Lane")){var W=N.get("name");q(P,W,_,y)}return D}function $(P,_,y={}){var D=de(P,_,y),N=$e(_);if(cn(_)&&(re(D,{strokeDasharray:"0, 5.5",strokeWidth:2.5}),!N)){var W=Z(_).flowElements||[],ae=W.filter(Pe=>v(Pe,"bpmn:StartEvent"));ae.length===1&&U(ae[0],P,y,_)}return Fe(P,_,N?"center-top":"center-middle",y),N?G(P,_,void 0,y):G(P,_,["SubProcessMarker"],y),D}function U(P,_,y,D){var N=22,W={fill:Ie(D,s,y.fill),stroke:te(D,c,y.stroke),width:N,height:N},ae=Z(P).isInterrupting,Pe=ae?0:3,Ue=ae?1:1.2,ft=20,tt=(N-ft)/2,It="translate("+tt+","+tt+")";m(_,ft,ft,{fill:W.fill,stroke:W.stroke,strokeWidth:Ue,strokeDasharray:Pe,transform:It}),F(P,_,W,D)}function ke(P,_,y={}){var D=de(P,_,y);return Fe(P,_,"center-middle",y),G(P,_,void 0,y),D}var Lt=this.handlers={"bpmn:AdHocSubProcess":function(P,_,y={}){return $e(_)?y=Ge(y,["fill","stroke","width","height"]):y=Ge(y,["fill","stroke"]),$(P,_,y)},"bpmn:Association":function(P,_,y={}){return y=Ge(y,["fill","stroke"]),he(P,_,y)},"bpmn:BoundaryEvent":function(P,_,y={}){var{renderIcon:D=!0}=y;y=Ge(y,["fill","stroke"]);var N=Z(_),W=N.get("cancelActivity");y={strokeWidth:1.5,fill:Ie(_,s,y.fill),fillOpacity:wS,stroke:te(_,c,y.stroke)},W||(y.strokeDasharray="6");var ae=ue(P,_,y);return m(P,_.width,_.height,Ms,{...y,fill:"none"}),D&&F(_,P,y),ae},"bpmn:BusinessRuleTask":function(P,_,y={}){y=Ge(y,["fill","stroke"]);var D=ke(P,_,y),N=i.getScaledPath("TASK_TYPE_BUSINESS_RULE_MAIN",{abspos:{x:8,y:8}}),W=x(P,N);re(W,{fill:Ie(_,s,y.fill),stroke:te(_,c,y.stroke),strokeWidth:1});var ae=i.getScaledPath("TASK_TYPE_BUSINESS_RULE_HEADER",{abspos:{x:8,y:8}}),Pe=x(P,ae);return re(Pe,{fill:te(_,c,y.stroke),stroke:te(_,c,y.stroke),strokeWidth:1}),D},"bpmn:CallActivity":function(P,_,y={}){return y=Ge(y,["fill","stroke"]),$(P,_,{strokeWidth:5,...y})},"bpmn:ComplexGateway":function(P,_,y={}){y=Ge(y,["fill","stroke"]);var D=ee(P,_,y),N=i.getScaledPath("GATEWAY_COMPLEX",{xScaleFactor:.5,yScaleFactor:.5,containerWidth:_.width,containerHeight:_.height,position:{mx:.46,my:.26}});return x(P,N,{fill:te(_,c,y.stroke),stroke:te(_,c,y.stroke),strokeWidth:1}),D},"bpmn:DataInput":function(P,_,y={}){y=Ge(y,["fill","stroke"]);var D=i.getRawPath("DATA_ARROW"),N=ce(P,_,y);return x(P,D,{fill:"none",stroke:te(_,c,y.stroke),strokeWidth:1}),N},"bpmn:DataInputAssociation":function(P,_,y={}){return y=Ge(y,["fill","stroke"]),he(P,_,{...y,markerEnd:d(P,"association-end",Ie(_,s,y.fill),te(_,c,y.stroke))})},"bpmn:DataObject":function(P,_,y={}){return y=Ge(y,["fill","stroke"]),ce(P,_,y)},"bpmn:DataObjectReference":L("bpmn:DataObject"),"bpmn:DataOutput":function(P,_,y={}){y=Ge(y,["fill","stroke"]);var D=i.getRawPath("DATA_ARROW"),N=ce(P,_,y);return x(P,D,{strokeWidth:1,fill:te(_,c,y.stroke),stroke:te(_,c,y.stroke)}),N},"bpmn:DataOutputAssociation":function(P,_,y={}){return y=Ge(y,["fill","stroke"]),he(P,_,{...y,markerEnd:d(P,"association-end",Ie(_,s,y.fill),te(_,c,y.stroke))})},"bpmn:DataStoreReference":function(P,_,y={}){y=Ge(y,["fill","stroke"]);var D=i.getScaledPath("DATA_STORE",{xScaleFactor:1,yScaleFactor:1,containerWidth:_.width,containerHeight:_.height,position:{mx:0,my:.133}});return x(P,D,{fill:Ie(_,s,y.fill),fillOpacity:fo,stroke:te(_,c,y.stroke),strokeWidth:2})},"bpmn:EndEvent":function(P,_,y={}){var{renderIcon:D=!0}=y;y=Ge(y,["fill","stroke"]);var N=ue(P,_,{...y,strokeWidth:4});return D&&F(_,P,y),N},"bpmn:EventBasedGateway":function(P,_,y={}){y=Ge(y,["fill","stroke"]);var D=Z(_),N=ee(P,_,y);m(P,_.width,_.height,_.height*.2,{fill:Ie(_,"none",y.fill),stroke:te(_,c,y.stroke),strokeWidth:1});var W=D.get("eventGatewayType"),ae=!!D.get("instantiate");function Pe(){var ft=i.getScaledPath("GATEWAY_EVENT_BASED",{xScaleFactor:.18,yScaleFactor:.18,containerWidth:_.width,containerHeight:_.height,position:{mx:.36,my:.44}});x(P,ft,{fill:"none",stroke:te(_,c,y.stroke),strokeWidth:2})}if(W==="Parallel"){var Ue=i.getScaledPath("GATEWAY_PARALLEL",{xScaleFactor:.4,yScaleFactor:.4,containerWidth:_.width,containerHeight:_.height,position:{mx:.474,my:.296}});x(P,Ue,{fill:"none",stroke:te(_,c,y.stroke),strokeWidth:1})}else W==="Exclusive"&&(ae||m(P,_.width,_.height,_.height*.26,{fill:"none",stroke:te(_,c,y.stroke),strokeWidth:1}),Pe());return N},"bpmn:ExclusiveGateway":function(P,_,y={}){y=Ge(y,["fill","stroke"]);var D=ee(P,_,y),N=i.getScaledPath("GATEWAY_EXCLUSIVE",{xScaleFactor:.4,yScaleFactor:.4,containerWidth:_.width,containerHeight:_.height,position:{mx:.32,my:.3}}),W=Ve(_);return W.get("isMarkerVisible")&&x(P,N,{fill:te(_,c,y.stroke),stroke:te(_,c,y.stroke),strokeWidth:1}),D},"bpmn:Gateway":function(P,_,y={}){return y=Ge(y,["fill","stroke"]),ee(P,_,y)},"bpmn:Group":function(P,_,y={}){return y=Ge(y,["fill","stroke","width","height"]),g(P,_.width,_.height,ks,{stroke:te(_,c,y.stroke),strokeWidth:1.5,strokeDasharray:"10, 6, 0, 6",fill:"none",pointerEvents:"none",width:Gn(_,y),height:An(_,y)})},"bpmn:InclusiveGateway":function(P,_,y={}){y=Ge(y,["fill","stroke"]);var D=ee(P,_,y);return m(P,_.width,_.height,_.height*.24,{fill:Ie(_,s,y.fill),stroke:te(_,c,y.stroke),strokeWidth:2.5}),D},"bpmn:IntermediateEvent":function(P,_,y={}){var{renderIcon:D=!0}=y;y=Ge(y,["fill","stroke"]);var N=ue(P,_,{...y,strokeWidth:1.5});return m(P,_.width,_.height,Ms,{fill:"none",stroke:te(_,c,y.stroke),strokeWidth:1.5}),D&&F(_,P,y),N},"bpmn:IntermediateCatchEvent":L("bpmn:IntermediateEvent"),"bpmn:IntermediateThrowEvent":L("bpmn:IntermediateEvent"),"bpmn:Lane":function(P,_,y={}){return y=Ge(y,["fill","stroke","width","height"]),H(P,_,{...y,fillOpacity:ES})},"bpmn:ManualTask":function(P,_,y={}){y=Ge(y,["fill","stroke"]);var D=ke(P,_,y),N=i.getScaledPath("TASK_TYPE_MANUAL",{abspos:{x:17,y:15}});return x(P,N,{fill:Ie(_,s,y.fill),stroke:te(_,c,y.stroke),strokeWidth:.5}),D},"bpmn:MessageFlow":function(P,_,y={}){y=Ge(y,["fill","stroke"]);var D=Z(_),N=Ve(_),W=Ie(_,s,y.fill),ae=te(_,c,y.stroke),Pe=b(P,_.waypoints,{markerEnd:d(P,"messageflow-end",W,ae),markerStart:d(P,"messageflow-start",W,ae),stroke:ae,strokeDasharray:"10, 11",strokeWidth:1.5});if(D.get("messageRef")){var Ue=Pe.getPointAtLength(Pe.getTotalLength()/2),ft=i.getScaledPath("MESSAGE_FLOW_MARKER",{abspos:{x:Ue.x,y:Ue.y}}),tt={strokeWidth:1};N.get("messageVisibleKind")==="initiating"?(tt.fill=W,tt.stroke=ae):(tt.fill=ae,tt.stroke=W);var It=x(P,ft,tt),un=D.get("messageRef"),ln=un.get("name"),at=fe(P,ln,{align:"center-top",fitBox:!0,style:{fill:ae}}),Nt=It.getBBox(),pn=at.getBBox(),jo=Ue.x-pn.width/2,fn=Ue.y+Nt.height/2+_S;Cs(at,jo,fn,0)}return Pe},"bpmn:ParallelGateway":function(P,_,y={}){y=Ge(y,["fill","stroke"]);var D=ee(P,_,y),N=i.getScaledPath("GATEWAY_PARALLEL",{xScaleFactor:.6,yScaleFactor:.6,containerWidth:_.width,containerHeight:_.height,position:{mx:.46,my:.2}});return x(P,N,{fill:te(_,c,y.stroke),stroke:te(_,c,y.stroke),strokeWidth:1}),D},"bpmn:Participant":function(P,_,y={}){y=Ge(y,["fill","stroke","width","height"]);var D=H(P,_,y),N=$e(_),W=Yt(_),ae=Z(_),Pe=ae.get("name");if(N){var Ue=W?[{x:30,y:0},{x:30,y:An(_,y)}]:[{x:0,y:30},{x:Gn(_,y),y:30}];w(P,Ue,{stroke:te(_,c,y.stroke),strokeWidth:bS}),q(P,Pe,_,y)}else{var ft=ra(_,y);W||(ft.height=Gn(_,y),ft.width=An(_,y));var tt=fe(P,Pe,{box:ft,align:"center-middle",style:{fill:ia(_,u,c,y.stroke)}});if(!W){var It=-1*An(_,y);Cs(tt,0,-It,270)}}return ae.get("participantMultiplicity")&&B("ParticipantMultiplicityMarker",P,_,y),D},"bpmn:ReceiveTask":function(P,_,y={}){y=Ge(y,["fill","stroke"]);var D=Z(_),N=ke(P,_,y),W;return D.get("instantiate")?(m(P,28,28,20*.22,{fill:Ie(_,s,y.fill),stroke:te(_,c,y.stroke),strokeWidth:1}),W=i.getScaledPath("TASK_TYPE_INSTANTIATING_SEND",{abspos:{x:7.77,y:9.52}})):W=i.getScaledPath("TASK_TYPE_SEND",{xScaleFactor:.9,yScaleFactor:.9,containerWidth:21,containerHeight:14,position:{mx:.3,my:.4}}),x(P,W,{fill:Ie(_,s,y.fill),stroke:te(_,c,y.stroke),strokeWidth:1}),N},"bpmn:ScriptTask":function(P,_,y={}){y=Ge(y,["fill","stroke"]);var D=ke(P,_,y),N=i.getScaledPath("TASK_TYPE_SCRIPT",{abspos:{x:15,y:20}});return x(P,N,{fill:Ie(_,s,y.fill),stroke:te(_,c,y.stroke),strokeWidth:1}),D},"bpmn:SendTask":function(P,_,y={}){y=Ge(y,["fill","stroke"]);var D=ke(P,_,y),N=i.getScaledPath("TASK_TYPE_SEND",{xScaleFactor:1,yScaleFactor:1,containerWidth:21,containerHeight:14,position:{mx:.285,my:.357}});return x(P,N,{fill:te(_,c,y.stroke),stroke:Ie(_,s,y.fill),strokeWidth:1}),D},"bpmn:SequenceFlow":function(P,_,y={}){y=Ge(y,["fill","stroke"]);var D=Ie(_,s,y.fill),N=te(_,c,y.stroke),W=b(P,_.waypoints,{markerEnd:d(P,"sequenceflow-end",D,N),stroke:N}),ae=Z(_),{source:Pe}=_;if(Pe){var Ue=Z(Pe);ae.get("conditionExpression")&&v(Ue,"bpmn:Activity")&&re(W,{markerStart:d(P,"conditional-flow-marker",D,N)}),Ue.get("default")&&(v(Ue,"bpmn:Gateway")||v(Ue,"bpmn:Activity"))&&Ue.get("default")===ae&&re(W,{markerStart:d(P,"conditional-default-flow-marker",D,N)})}return W},"bpmn:ServiceTask":function(P,_,y={}){y=Ge(y,["fill","stroke"]);var D=ke(P,_,y);m(P,10,10,{fill:Ie(_,s,y.fill),stroke:"none",transform:"translate(6, 6)"});var N=i.getScaledPath("TASK_TYPE_SERVICE",{abspos:{x:12,y:18}});x(P,N,{fill:Ie(_,s,y.fill),stroke:te(_,c,y.stroke),strokeWidth:1}),m(P,10,10,{fill:Ie(_,s,y.fill),stroke:"none",transform:"translate(11, 10)"});var W=i.getScaledPath("TASK_TYPE_SERVICE",{abspos:{x:17,y:22}});return x(P,W,{fill:Ie(_,s,y.fill),stroke:te(_,c,y.stroke),strokeWidth:1}),D},"bpmn:StartEvent":function(P,_,y={}){var{renderIcon:D=!0}=y;y=Ge(y,["fill","stroke"]);var N=Z(_);N.get("isInterrupting")||(y={...y,strokeDasharray:"6"});var W=ue(P,_,y);return D&&F(_,P,y),W},"bpmn:SubProcess":function(P,_,y={}){return $e(_)?y=Ge(y,["fill","stroke","width","height"]):y=Ge(y,["fill","stroke"]),$(P,_,y)},"bpmn:Task":function(P,_,y={}){return y=Ge(y,["fill","stroke"]),ke(P,_,y)},"bpmn:TextAnnotation":function(P,_,y={}){y=Ge(y,["fill","stroke"]);var{width:D,height:N}=ra(_,y),W=g(P,D,N,0,0,{fill:"none",stroke:"none"}),ae=i.getScaledPath("TEXT_ANNOTATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:D,containerHeight:N,position:{mx:0,my:0}});x(P,ae,{stroke:te(_,c,y.stroke)});var Pe=Z(_),Ue=Pe.get("text")||"";return fe(P,Ue,{align:"left-top",box:ra(_,y),padding:po,style:{fill:ia(_,u,c,y.stroke)}}),W},"bpmn:Transaction":function(P,_,y={}){$e(_)?y=Ge(y,["fill","stroke","width","height"]):y=Ge(y,["fill","stroke"]);var D=$(P,_,{strokeWidth:1.5,...y}),N=n.style(["no-fill","no-events"],{stroke:te(_,c,y.stroke),strokeWidth:1.5}),W=$e(_);return W||(y={}),g(P,Gn(_,y),An(_,y),ks-Ms,Ms,N),D},"bpmn:UserTask":function(P,_,y={}){y=Ge(y,["fill","stroke"]);var D=ke(P,_,y),N=15,W=12,ae=i.getScaledPath("TASK_TYPE_USER_1",{abspos:{x:N,y:W}});x(P,ae,{fill:Ie(_,s,y.fill),stroke:te(_,c,y.stroke),strokeWidth:.5});var Pe=i.getScaledPath("TASK_TYPE_USER_2",{abspos:{x:N,y:W}});x(P,Pe,{fill:Ie(_,s,y.fill),stroke:te(_,c,y.stroke),strokeWidth:.5});var Ue=i.getScaledPath("TASK_TYPE_USER_3",{abspos:{x:N,y:W}});return x(P,Ue,{fill:te(_,c,y.stroke),stroke:te(_,c,y.stroke),strokeWidth:.5}),D},label:function(P,_,y={}){return lt(P,_,y)}};this._drawPath=x,this._renderer=T}ie(Nr,Pi),Nr.$inject=["config.bpmnRenderer","eventBus","styles","pathMap","canvas","textRenderer"],Nr.prototype.canRender=function(e){return v(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 Me(e)?dl(e,xS):v(e,"bpmn:Event")?um(e):v(e,"bpmn:Activity")?dl(e,ks):v(e,"bpmn:Gateway")?gS(e):yS(e)};function Ge(e,t=[]){return t.reduce((n,i)=>(e[i]&&(n[i]=e[i]),n),{})}var SS=0,RS={width:150,height:50};function CS(e){var t=e.split("-");return{horizontal:t[0]||"center",vertical:t[1]||"top"}}function PS(e){return Gt(e)?O({top:0,left:0,right:0,bottom:0},e):{top:e,left:e,right:e,bottom:e}}var hl=null;function AS(){return hl||(hl=document.createElement("canvas").getContext("2d")),hl}function TS(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(lm(e.fontSize)||"12px"),t.push(e.fontFamily||"sans-serif"),t.join(" ")}function lm(e){if(e!=null)return typeof e=="number"||/^-?\d+(\.\d+)?$/.test(e)?e+"px":e}function MS(e,t){var n=AS();if(!n)return{width:0,height:0};n.font=TS(t),"letterSpacing"in n&&(n.letterSpacing=lm(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 kS(e,t,n){for(var i=e.shift(),r=i,o;;){if(o=MS(r,n),o.width=r?o.width:0,r===" "||r===""||o.width<Math.round(t)||r.length<2)return DS(e,r,i,o);r=LS(r,o.width,t)}}function DS(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 pm="­";function OS(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===pm)&&r.pop();break}var a=r[r.length-1];return a&&a===pm&&(r[r.length-1]="-"),r.join("")}function LS(e,t,n){var i=Math.max(e.length*(n/t),1),r=OS(e,i);return r||(r=e.slice(0,Math.max(Math.round(i-1),1))),r}function Ds(e){this._config=O({},{size:RS,padding:SS,style:{},align:"center-top"},e||{})}Ds.prototype.createText=function(e,t){return this.layoutText(e,t).element},Ds.prototype.getDimensions=function(e,t){return this.layoutText(e,t).dimensions},Ds.prototype.layoutText=function(e,t){for(var n=O({},this._config.size,t.box),i=O({},this._config.style,t.style),r=CS(t.align||this._config.align),o=PS(t.padding!==void 0?t.padding:this._config.padding),a=t.fitBox||!1,s=IS(i),c=e.split(/\u00AD?\r?\n/),u=[],l=n.width-o.left-o.right;c.length;)u.push(kS(c,l,i));r.vertical==="middle"&&(o.top=o.bottom=0);var p=Sn(u,function(g,R,w){return g+(s||R.height)},0)+o.top+o.bottom,f=Sn(u,function(g,R,w){return R.width>g?R.width:g},0),d=o.top;r.vertical==="middle"&&(d+=(n.height-p)/2),d-=(s||u[0].height)/4;var h=me("text");re(h,i),k(u,function(g){var R;switch(d+=s||g.height,r.horizontal){case"left":R=o.left;break;case"right":R=(a?f:l)-o.right-g.width;break;default:R=Math.max(((a?f:l)-g.width)/2+o.left,0)}var w=me("tspan");re(w,{x:R,y:d}),w.textContent=g.text,Re(h,w)});var m={width:f,height:p};return{dimensions:m,element:h}};function IS(e){if("fontSize"in e&&"lineHeight"in e)return e.lineHeight*parseInt(e.fontSize,10)}var NS=12,BS=1.2,$S=40;function fm(e){var t=O({fontFamily:"Arial, sans-serif",fontSize:NS,fontWeight:"normal",lineHeight:BS},e&&e.defaultStyle||{}),n=parseInt(t.fontSize,10)-1,i=O({},t,{fontSize:n},e&&e.externalStyle||{}),r=new Ds({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:po});return{x:a.x,y:a.y,width:a.width,height:Math.max($S,Math.round(c.height))}},this.getDimensions=function(a,s){return r.getDimensions(a,s||{})};function o(a,s,c){return r.getDimensions(a,O({box:s},c))}this.createText=function(a,s){return r.createText(a,s||{})},this.getDefaultStyle=function(){return t},this.getExternalStyle=function(){return i}}fm.$inject=["config.textRenderer"];function jS(){this.pathMap={EVENT_MESSAGE:{d:"m {mx},{my} l 0,{e.y1} l {e.x1},0 l 0,-{e.y1} z l {e.x0},{e.y0} l {e.x0},-{e.y0}",height:36,width:36,heightElements:[6,14],widthElements:[10.5,21]},EVENT_SIGNAL:{d:"M {mx},{my} l {e.x0},{e.y0} l -{e.x1},0 Z",height:36,width:36,heightElements:[18],widthElements:[10,20]},EVENT_ESCALATION:{d:"M {mx},{my} l {e.x0},{e.y0} l -{e.x0},-{e.y1} l -{e.x0},{e.y1} Z",height:36,width:36,heightElements:[20,7],widthElements:[8]},EVENT_CONDITIONAL:{d:"M {e.x0},{e.y0} l {e.x1},0 l 0,{e.y2} l -{e.x1},0 Z M {e.x2},{e.y3} l {e.x0},0 M {e.x2},{e.y4} l {e.x0},0 M {e.x2},{e.y5} l {e.x0},0 M {e.x2},{e.y6} l {e.x0},0 M {e.x2},{e.y7} l {e.x0},0 M {e.x2},{e.y8} l {e.x0},0 ",height:36,width:36,heightElements:[8.5,14.5,18,11.5,14.5,17.5,20.5,23.5,26.5],widthElements:[10.5,14.5,12.5]},EVENT_LINK:{d:"m {mx},{my} 0,{e.y0} -{e.x1},0 0,{e.y1} {e.x1},0 0,{e.y0} {e.x0},-{e.y2} -{e.x0},-{e.y2} z",height:36,width:36,heightElements:[4.4375,6.75,7.8125],widthElements:[9.84375,13.5]},EVENT_ERROR:{d:"m {mx},{my} {e.x0},-{e.y0} {e.x1},-{e.y1} {e.x2},{e.y2} {e.x3},-{e.y3} -{e.x4},{e.y4} -{e.x5},-{e.y5} z",height:36,width:36,heightElements:[.023,8.737,8.151,16.564,10.591,8.714],widthElements:[.085,6.672,6.97,4.273,5.337,6.636]},EVENT_CANCEL_45:{d:"m {mx},{my} -{e.x1},0 0,{e.x0} {e.x1},0 0,{e.y1} {e.x0},0 0,-{e.y1} {e.x1},0 0,-{e.y0} -{e.x1},0 0,-{e.y1} -{e.x0},0 z",height:36,width:36,heightElements:[4.75,8.5],widthElements:[4.75,8.5]},EVENT_COMPENSATION:{d:"m {mx},{my} {e.x0},-{e.y0} 0,{e.y1} z m {e.x1},-{e.y2} {e.x2},-{e.y3} 0,{e.y1} -{e.x2},-{e.y3} z",height:36,width:36,heightElements:[6.5,13,.4,6.1],widthElements:[9,9.3,8.7]},EVENT_TIMER_WH:{d:"M {mx},{my} l {e.x0},-{e.y0} m -{e.x0},{e.y0} l {e.x1},{e.y1} ",height:36,width:36,heightElements:[10,2],widthElements:[3,7]},EVENT_TIMER_LINE:{d:"M {mx},{my} m {e.x0},{e.y0} l -{e.x1},{e.y1} ",height:36,width:36,heightElements:[10,3],widthElements:[0,0]},EVENT_MULTIPLE:{d:"m {mx},{my} {e.x1},-{e.y0} {e.x1},{e.y0} -{e.x0},{e.y1} -{e.x2},0 z",height:36,width:36,heightElements:[6.28099,12.56199],widthElements:[3.1405,9.42149,12.56198]},EVENT_PARALLEL_MULTIPLE:{d:"m {mx},{my} {e.x0},0 0,{e.y1} {e.x1},0 0,{e.y0} -{e.x1},0 0,{e.y1} -{e.x0},0 0,-{e.y1} -{e.x1},0 0,-{e.y0} {e.x1},0 z",height:36,width:36,heightElements:[2.56228,7.68683],widthElements:[2.56228,7.68683]},GATEWAY_EXCLUSIVE:{d:"m {mx},{my} {e.x0},{e.y0} {e.x1},{e.y0} {e.x2},0 {e.x4},{e.y2} {e.x4},{e.y1} {e.x2},0 {e.x1},{e.y3} {e.x0},{e.y3} {e.x3},0 {e.x5},{e.y1} {e.x5},{e.y2} {e.x3},0 z",height:17.5,width:17.5,heightElements:[8.5,6.5312,-6.5312,-8.5],widthElements:[6.5,-6.5,3,-3,5,-5]},GATEWAY_PARALLEL:{d:"m {mx},{my} 0,{e.y1} -{e.x1},0 0,{e.y0} {e.x1},0 0,{e.y1} {e.x0},0 0,-{e.y1} {e.x1},0 0,-{e.y0} -{e.x1},0 0,-{e.y1} -{e.x0},0 z",height:30,width:30,heightElements:[5,12.5],widthElements:[5,12.5]},GATEWAY_EVENT_BASED:{d:"m {mx},{my} {e.x0},{e.y0} {e.x0},{e.y1} {e.x1},{e.y2} {e.x2},0 z",height:11,width:11,heightElements:[-6,6,12,-12],widthElements:[9,-3,-12]},GATEWAY_COMPLEX:{d:"m {mx},{my} 0,{e.y0} -{e.x0},-{e.y1} -{e.x1},{e.y2} {e.x0},{e.y1} -{e.x2},0 0,{e.y3} {e.x2},0 -{e.x0},{e.y1} l {e.x1},{e.y2} {e.x0},-{e.y1} 0,{e.y0} {e.x3},0 0,-{e.y0} {e.x0},{e.y1} {e.x1},-{e.y2} -{e.x0},-{e.y1} {e.x2},0 0,-{e.y3} -{e.x2},0 {e.x0},-{e.y1} -{e.x1},-{e.y2} -{e.x0},{e.y1} 0,-{e.y0} -{e.x3},0 z",height:17.125,width:17.125,heightElements:[4.875,3.4375,2.125,3],widthElements:[3.4375,2.125,4.875,3]},DATA_OBJECT_PATH:{d:"m 0,0 {e.x1},0 {e.x0},{e.y0} 0,{e.y1} -{e.x2},0 0,-{e.y2} {e.x1},0 0,{e.y0} {e.x0},0",height:61,width:51,heightElements:[10,50,60],widthElements:[10,40,50,60]},DATA_OBJECT_COLLECTION_PATH:{d:"m{mx},{my} m 3,2 l 0,10 m 3,-10 l 0,10 m 3,-10 l 0,10",height:10,width:10,heightElements:[],widthElements:[]},DATA_ARROW:{d:"m 5,9 9,0 0,-3 5,5 -5,5 0,-3 -9,0 z",height:61,width:51,heightElements:[],widthElements:[]},DATA_STORE:{d:"m {mx},{my} l 0,{e.y2} c {e.x0},{e.y1} {e.x1},{e.y1} {e.x2},0 l 0,-{e.y2} c -{e.x0},-{e.y1} -{e.x1},-{e.y1} -{e.x2},0c {e.x0},{e.y1} {e.x1},{e.y1} {e.x2},0 m -{e.x2},{e.y0}c {e.x0},{e.y1} {e.x1},{e.y1} {e.x2},0m -{e.x2},{e.y0}c {e.x0},{e.y1} {e.x1},{e.y1} {e.x2},0",height:61,width:61,heightElements:[7,10,45],widthElements:[2,58,60]},TEXT_ANNOTATION:{d:"m {mx}, {my} m 10,0 l -10,0 l 0,{e.y0} l 10,0",height:30,width:10,heightElements:[30],widthElements:[10]},MARKER_SUB_PROCESS:{d:"m{mx},{my} m 7,2 l 0,10 m -5,-5 l 10,0",height:10,width:10,heightElements:[],widthElements:[]},MARKER_PARALLEL:{d:"m{mx},{my} m 3,2 l 0,10 m 3,-10 l 0,10 m 3,-10 l 0,10",height:10,width:10,heightElements:[],widthElements:[]},MARKER_SEQUENTIAL:{d:"m{mx},{my} m 0,3 l 10,0 m -10,3 l 10,0 m -10,3 l 10,0",height:10,width:10,heightElements:[],widthElements:[]},MARKER_COMPENSATION:{d:"m {mx},{my} 7,-5 0,10 z m 7.1,-0.3 6.9,-4.7 0,10 -6.9,-4.7 z",height:10,width:21,heightElements:[],widthElements:[]},MARKER_LOOP:{d:"m {mx},{my} c 3.526979,0 6.386161,-2.829858 6.386161,-6.320661 0,-3.490806 -2.859182,-6.320661 -6.386161,-6.320661 -3.526978,0 -6.38616,2.829855 -6.38616,6.320661 0,1.745402 0.714797,3.325567 1.870463,4.469381 0.577834,0.571908 1.265885,1.034728 2.029916,1.35457 l -0.718163,-3.909793 m 0.718163,3.909793 -3.885211,0.802902",height:13.9,width:13.7,heightElements:[],widthElements:[]},MARKER_ADHOC:{d:"m {mx},{my} m 0.84461,2.64411 c 1.05533,-1.23780996 2.64337,-2.07882 4.29653,-1.97997996 2.05163,0.0805 3.85579,1.15803 5.76082,1.79107 1.06385,0.34139996 2.24454,0.1438 3.18759,-0.43767 0.61743,-0.33642 1.2775,-0.64078 1.7542,-1.17511 0,0.56023 0,1.12046 0,1.6807 -0.98706,0.96237996 -2.29792,1.62393996 -3.6918,1.66181996 -1.24459,0.0927 -2.46671,-0.2491 -3.59505,-0.74812 -1.35789,-0.55965 -2.75133,-1.33436996 -4.27027,-1.18121996 -1.37741,0.14601 -2.41842,1.13685996 -3.44288,1.96782996 z",height:4,width:15,heightElements:[],widthElements:[]},TASK_TYPE_SEND:{d:"m {mx},{my} l 0,{e.y1} l {e.x1},0 l 0,-{e.y1} z l {e.x0},{e.y0} l {e.x0},-{e.y0}",height:14,width:21,heightElements:[6,14],widthElements:[10.5,21]},TASK_TYPE_SCRIPT:{d:"m {mx},{my} c 9.966553,-6.27276 -8.000926,-7.91932 2.968968,-14.938 l -8.802728,0 c -10.969894,7.01868 6.997585,8.66524 -2.968967,14.938 z m -7,-12 l 5,0 m -4.5,3 l 4.5,0 m -3,3 l 5,0m -4,3 l 5,0",height:15,width:12.6,heightElements:[6,14],widthElements:[10.5,21]},TASK_TYPE_USER_1:{d:"m {mx},{my} c 0.909,-0.845 1.594,-2.049 1.594,-3.385 0,-2.554 -1.805,-4.62199999 -4.357,-4.62199999 -2.55199998,0 -4.28799998,2.06799999 -4.28799998,4.62199999 0,1.348 0.974,2.562 1.89599998,3.405 -0.52899998,0.187 -5.669,2.097 -5.794,4.7560005 v 6.718 h 17 v -6.718 c 0,-2.2980005 -5.5279996,-4.5950005 -6.0509996,-4.7760005 zm -8,6 l 0,5.5 m 11,0 l 0,-5"},TASK_TYPE_USER_2:{d:"m {mx},{my} m 2.162,1.009 c 0,2.4470005 -2.158,4.4310005 -4.821,4.4310005 -2.66499998,0 -4.822,-1.981 -4.822,-4.4310005 "},TASK_TYPE_USER_3:{d:"m {mx},{my} m -6.9,-3.80 c 0,0 2.25099998,-2.358 4.27399998,-1.177 2.024,1.181 4.221,1.537 4.124,0.965 -0.098,-0.57 -0.117,-3.79099999 -4.191,-4.13599999 -3.57499998,0.001 -4.20799998,3.36699999 -4.20699998,4.34799999 z"},TASK_TYPE_MANUAL:{d:"m {mx},{my} c 0.234,-0.01 5.604,0.008 8.029,0.004 0.808,0 1.271,-0.172 1.417,-0.752 0.227,-0.898 -0.334,-1.314 -1.338,-1.316 -2.467,-0.01 -7.886,-0.004 -8.108,-0.004 -0.014,-0.079 0.016,-0.533 0,-0.61 0.195,-0.042 8.507,0.006 9.616,0.002 0.877,-0.007 1.35,-0.438 1.353,-1.208 0.003,-0.768 -0.479,-1.09 -1.35,-1.091 -2.968,-0.002 -9.619,-0.013 -9.619,-0.013 v -0.591 c 0,0 5.052,-0.016 7.225,-0.016 0.888,-0.002 1.354,-0.416 1.351,-1.193 -0.006,-0.761 -0.492,-1.196 -1.361,-1.196 -3.473,-0.005 -10.86,-0.003 -11.0829995,-0.003 -0.022,-0.047 -0.045,-0.094 -0.069,-0.139 0.3939995,-0.319 2.0409995,-1.626 2.4149995,-2.017 0.469,-0.4870005 0.519,-1.1650005 0.162,-1.6040005 -0.414,-0.511 -0.973,-0.5 -1.48,-0.236 -1.4609995,0.764 -6.5999995,3.6430005 -7.7329995,4.2710005 -0.9,0.499 -1.516,1.253 -1.882,2.19 -0.37000002,0.95 -0.17,2.01 -0.166,2.979 0.004,0.718 -0.27300002,1.345 -0.055,2.063 0.629,2.087 2.425,3.312 4.859,3.318 4.6179995,0.014 9.2379995,-0.139 13.8569995,-0.158 0.755,-0.004 1.171,-0.301 1.182,-1.033 0.012,-0.754 -0.423,-0.969 -1.183,-0.973 -1.778,-0.01 -5.824,-0.004 -6.04,-0.004 10e-4,-0.084 0.003,-0.586 10e-4,-0.67 z"},TASK_TYPE_INSTANTIATING_SEND:{d:"m {mx},{my} l 0,8.4 l 12.6,0 l 0,-8.4 z l 6.3,3.6 l 6.3,-3.6"},TASK_TYPE_SERVICE:{d:"m {mx},{my} v -1.71335 c 0.352326,-0.0705 0.703932,-0.17838 1.047628,-0.32133 0.344416,-0.14465 0.665822,-0.32133 0.966377,-0.52145 l 1.19431,1.18005 1.567487,-1.57688 -1.195028,-1.18014 c 0.403376,-0.61394 0.683079,-1.29908 0.825447,-2.01824 l 1.622133,-0.01 v -2.2196 l -1.636514,0.01 c -0.07333,-0.35153 -0.178319,-0.70024 -0.323564,-1.04372 -0.145244,-0.34406 -0.321407,-0.6644 -0.522735,-0.96217 l 1.131035,-1.13631 -1.583305,-1.56293 -1.129598,1.13589 c -0.614052,-0.40108 -1.302883,-0.68093 -2.022633,-0.82247 l 0.0093,-1.61852 h -2.241173 l 0.0042,1.63124 c -0.353763,0.0736 -0.705369,0.17977 -1.049785,0.32371 -0.344415,0.14437 -0.665102,0.32092 -0.9635006,0.52046 l -1.1698628,-1.15823 -1.5667691,1.5792 1.1684265,1.15669 c -0.4026573,0.61283 -0.68308,1.29797 -0.8247287,2.01713 l -1.6588041,0.003 v 2.22174 l 1.6724648,-0.006 c 0.073327,0.35077 0.1797598,0.70243 0.3242851,1.04472 0.1452428,0.34448 0.3214064,0.6644 0.5227339,0.96066 l -1.1993431,1.19723 1.5840256,1.56011 1.1964668,-1.19348 c 0.6140517,0.40346 1.3028827,0.68232 2.0233517,0.82331 l 7.19e-4,1.69892 h 2.226848 z m 0.221462,-3.9957 c -1.788948,0.7502 -3.8576,-0.0928 -4.6097055,-1.87438 -0.7521065,-1.78321 0.090598,-3.84627 1.8802645,-4.59604 1.78823,-0.74936 3.856881,0.0929 4.608987,1.87437 0.752106,1.78165 -0.0906,3.84612 -1.879546,4.59605 z"},TASK_TYPE_SERVICE_FILL:{d:"m {mx},{my} c -1.788948,0.7502 -3.8576,-0.0928 -4.6097055,-1.87438 -0.7521065,-1.78321 0.090598,-3.84627 1.8802645,-4.59604 1.78823,-0.74936 3.856881,0.0929 4.608987,1.87437 0.752106,1.78165 -0.0906,3.84612 -1.879546,4.59605 z"},TASK_TYPE_BUSINESS_RULE_HEADER:{d:"m {mx},{my} 0,4 20,0 0,-4 z"},TASK_TYPE_BUSINESS_RULE_MAIN:{d:"m {mx},{my} 0,12 20,0 0,-12 zm 0,8 l 20,0 m -13,-4 l 0,8"},MESSAGE_FLOW_MARKER:{d:"m {mx},{my} m -10.5 ,-7 l 0,14 l 21,0 l 0,-14 z l 10.5,6 l 10.5,-6"}},this.getRawPath=function(t){return this.pathMap[t].d},this.getScaledPath=function(t,n){var i=this.pathMap[t],r,o;n.abspos?(r=n.abspos.x,o=n.abspos.y):(r=n.containerWidth*n.position.mx,o=n.containerHeight*n.position.my);var a={};if(n.position){for(var s=n.containerHeight/i.height*n.yScaleFactor,c=n.containerWidth/i.width*n.xScaleFactor,u=0;u<i.heightElements.length;u++)a["y"+u]=i.heightElements[u]*s;for(var l=0;l<i.widthElements.length;l++)a["x"+l]=i.widthElements[l]*c}var p=VS(i.d,{mx:r,my:o,e:a});return p}}var FS=/\{([^{}]+)\}/g,HS=/(?:(?:^|\.)(.+?)(?=\[|\.|$|\()|\[('|")(.+?)\2\])(\(\))?/g;function zS(e,t,n){var i=n;return t.replace(HS,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 VS(e,t){return String(e).replace(FS,function(n,i){return zS(n,i,t)})}const GS={__init__:["bpmnRenderer"],bpmnRenderer:["type",Nr],textRenderer:["type",fm],pathMap:["type",jS]};function WS(e,t){return t=t||{},e.replace(/{([^}]+)}/g,function(n,i){return t[i]||"{"+i+"}"})}const oa={translate:["value",WS]};function Os(e,t,n){return O({id:e.id,type:e.$type,businessObject:e,di:t},n)}function US(e,t,n){var i=e.waypoint;return!i||i.length<2?[be(t),be(n)]:i.map(function(r){return{x:r.x,y:r.y}})}function dm(e,t,n){return new Error(`element ${sn(t)} referenced by ${sn(e)}#${n} not yet drawn`)}function ki(e,t,n,i,r){this._eventBus=e,this._canvas=t,this._elementFactory=n,this._elementRegistry=i,this._textRenderer=r}ki.$inject=["eventBus","canvas","elementFactory","elementRegistry","textRenderer"],ki.prototype.add=function(e,t,n){var i,r,o;if(v(t,"bpmndi:BPMNPlane")){var a=v(e,"bpmn:SubProcess")?{id:e.id+"_plane"}:{};i=this._elementFactory.createRoot(Os(e,t,a)),this._canvas.addRootElement(i)}else if(v(t,"bpmndi:BPMNShape")){var s=!$e(e,t),c=qS(e);r=n&&(n.hidden||n.collapsed);var u=t.bounds;i=this._elementFactory.createShape(Os(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})),v(e,"bpmn:BoundaryEvent")&&this._attachBoundary(e,i),v(e,"bpmn:Lane")&&(o=0),v(e,"bpmn:DataStoreReference")&&(YS(n,be(u))||(n=this._canvas.findRoot(n))),this._canvas.addShape(i,n,o)}else if(v(t,"bpmndi:BPMNEdge")){var l=this._getSource(e),p=this._getTarget(e);r=n&&(n.hidden||n.collapsed),i=this._elementFactory.createConnection(Os(e,t,{hidden:r,source:l,target:p,waypoints:US(t,l,p)})),v(e,"bpmn:DataAssociation")&&(n=this._canvas.findRoot(n)),this._canvas.addConnection(i,n,o)}else throw new Error(`unknown di ${sn(t)} for element ${sn(e)}`);return nr(e)&&jn(i)&&this.addLabel(e,t,i),this._eventBus.fire("bpmnElement.added",{element:i}),i},ki.prototype._attachBoundary=function(e,t){var n=e.attachedToRef;if(!n)throw new Error(`missing ${sn(e)}#attachedToRef`);var i=this._elementRegistry.get(n.id),r=i&&i.attachers;if(!i)throw dm(e,n,"attachedToRef");t.host=i,r||(i.attachers=r=[]),r.indexOf(t)===-1&&r.push(t)},ki.prototype.addLabel=function(e,t,n){var i,r,o;return i=uS(t,n),r=jn(n),r&&(i=this._textRenderer.getExternalLabelBounds(i,r)),o=this._elementFactory.createLabel(Os(e,t,{id:e.id+"_label",labelTarget:n,type:"label",hidden:n.hidden||!jn(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)},ki.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?dm(e,i,t+"Ref"):new Error(`${sn(e)}#${t} Ref not specified`)},ki.prototype._getSource=function(e){return this._getConnectedElement(e,"source")},ki.prototype._getTarget=function(e){return this._getConnectedElement(e,"target")},ki.prototype._getElement=function(e){return this._elementRegistry.get(e.id)};function YS(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 qS(e){return v(e,"bpmn:Group")}const hm={__depends__:[GS,{__depends__:[oa],bpmnImporter:["type",ki]}]};function aa(e){return{x:e.x+e.width/2,y:e.y+e.height/2}}function ii(e,t){return{x:e.x-t.x,y:e.y-t.y}}function ml(e){return Math.log(e)/Math.log(10)}var KS=1e3;function X(e){this._eventBus=e}X.$inject=["eventBus"];function XS(e,t){return function(n){return e.call(t||null,n.context,n.command,n)}}X.prototype.on=function(e,t,n,i,r,o){if((Wt(t)||we(t))&&(o=r,r=i,i=n,n=t,t=null),Wt(n)&&(o=r,r=i,i=n,n=KS),Gt(r)&&(o=r,r=!1),!Wt(i))throw new Error("handlerFn must be a function");_e(e)||(e=[e]);var a=this._eventBus;k(e,function(s){var c=["commandStack",s,t].filter(function(u){return u}).join(".");a.on(c,n,r?XS(i,o):i,o)})},X.prototype.canExecute=Di("canExecute"),X.prototype.preExecute=Di("preExecute"),X.prototype.preExecuted=Di("preExecuted"),X.prototype.execute=Di("execute"),X.prototype.executed=Di("executed"),X.prototype.postExecute=Di("postExecute"),X.prototype.postExecuted=Di("postExecuted"),X.prototype.revert=Di("revert"),X.prototype.reverted=Di("reverted");function Di(e){return function(n,i,r,o,a){(Wt(n)||we(n))&&(a=o,o=r,r=i,i=n,n=null),this.on(n,e,i,r,o,a)}}var gl=["top","bottom","left","right"],Ls=10;function yl(e,t){X.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(Ts(r)&&!it(r)){var o=JS(r);o&&i(r,o)}}function i(r,o){var a=be(r),s=r.label,c=be(s);if(s.parent){var u=ye(r),l;switch(o){case"top":l={x:a.x,y:u.top-Ls-s.height/2};break;case"left":l={x:u.left-Ls-s.width/2,y:a.y};break;case"bottom":l={x:a.x,y:u.bottom+Ls+s.height/2};break;case"right":l={x:u.right+Ls+s.width/2,y:a.y};break}var p=ii(l,c);t.moveShape(s,p)}}}ie(yl,X),yl.$inject=["eventBus","modeling"];function ZS(e){var t=e.host,n=be(e),i=Zt(n,t),r;i.indexOf("-")>=0?r=i.split("-"):r=[i];var o=gl.filter(function(a){return r.indexOf(a)===-1});return o}function QS(e){var t=be(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 mm(t,i)});return n}function JS(e){var t=be(e.label),n=be(e),i=mm(n,t);if(eR(i)){var r=QS(e);if(e.host){var o=ZS(e);r=r.concat(o)}var a=gl.filter(function(s){return r.indexOf(s)===-1});return a.indexOf(i)!==-1?Zt(e.label,e)!=="intersect"?void 0:i:a[0]}}function mm(e,t){return Zt(t,e,5)}function eR(e){return gl.indexOf(e)!==-1}function vl(e){X.call(this,e),this.preExecute("shape.append",function(t){var n=t.source,i=t.shape;t.position||(v(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)}ie(vl,X),vl.$inject=["eventBus"];var tR=1500;function _l(e,t,n){e.invoke(X,this),this.preExecute("elements.delete",tR,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=Oe(r,u=>v(u,"bpmn:Participant")||v(u,"bpmn:SubProcess"));if(!o.length)return[];var a=n.getRootElement(),s=new Set(a.children.filter(u=>v(u,"bpmn:Artifact"))),c=new Set;return k(o,u=>{const l=new Set(Zr(ao(Array.from(s),At(u))));c=c.union(l),s=s.difference(l)}),Array.from(c)}}ie(_l,X),_l.$inject=["injector","eventBus","canvas"];function bl(e,t){e.invoke(X,this),this.postExecute("shape.move",function(n){var i=n.newParent,r=n.shape,o=Oe(r.incoming.concat(r.outgoing),function(a){return v(a,"bpmn:Association")});k(o,function(a){t.moveConnection(a,{x:0,y:0},i)})},!0)}ie(bl,X),bl.$inject=["injector","modeling"];function ho(e,t){for(wn(t)&&(t=[t]);e=e.parent;)if(De(e,t))return e;return null}function gm(e,t){var n=ho(e,"bpmn:Process");if(n)return!0;var i=["bpmn:Participant","bpmn:Lane"];if(n=ho(e,i),n)return Yt(n);if(De(e,i))return Yt(e);var r;for(r=Z(e);r&&!v(r,"bpmn:Process");r=r.$parent);if(!t)return!0;var o=t.find(function(a){var s=Z(a);return s&&s.get("processRef")===r});return o?Yt(o):!0}var ym=500;function Is(e,t){t.invoke(X,this),this._bpmnReplace=e;var n=this;this.postExecuted("elements.create",ym,function(i){var r=i.elements;r=r.filter(function(o){var a=o.host;return vm(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",ym,function(i){var r=i.shapes,o=i.newHost;if(r.length===1){var a=r[0];vm(a,o)&&(i.shapes=[n._replaceShape(a,o)])}},!0)}Is.$inject=["bpmnReplace","injector"],ie(Is,X),Is.prototype._replaceShape=function(e,t){var n=nR(e),i={type:"bpmn:BoundaryEvent",host:t};return n&&(i.eventDefinitionType=n.$type),this._bpmnReplace.replaceElement(e,i,{layoutConnection:!1})};function nR(e){var t=Z(e),n=t.eventDefinitions;return n&&n[0]}function vm(e,t){return!Me(e)&&De(e,["bpmn:IntermediateThrowEvent","bpmn:IntermediateCatchEvent"])&&!!t}function xl(e,t){X.call(this,e);function n(i){return Oe(i.attachers,function(r){return v(r,"bpmn:BoundaryEvent")})}this.postExecute("connection.create",function(i){var r=i.context.source,o=i.context.target,a=n(o);v(r,"bpmn:EventBasedGateway")&&v(o,"bpmn:ReceiveTask")&&a.length>0&&t.removeElements(a)}),this.postExecute("connection.reconnect",function(i){var r=i.context.oldSource,o=i.context.newSource;v(r,"bpmn:Gateway")&&v(o,"bpmn:EventBasedGateway")&&k(o.outgoing,function(a){var s=a.target,c=n(s);v(s,"bpmn:ReceiveTask")&&c.length>0&&t.removeElements(c)})})}xl.$inject=["eventBus","modeling"],ie(xl,X);function _m(e){return e.create("bpmn:Category")}function iR(e){return e.create("bpmn:CategoryValue")}function bm(e,t){var n=t.get("categoryValueRef");return n||(n=t.categoryValueRef=iR(e)),n.$parent||(n.$parent=_m(e)),n}function rR(e,t,n){return St(t.get("categoryValue"),e),e.$parent=t,St(n.get("rootElements"),t),t.$parent=n,e}function oR(e){var t=e.$parent;return t&&(wt(t.get("categoryValue"),e),e.$parent=null),e}function aR(e){var t=e.$parent;return t&&(wt(t.get("rootElements"),e),e.$parent=null),e}var sR=500;function wl(e,t,n){n.invoke(X,this);function i(c){return t.filter(function(u){return v(u,"bpmn:Group")&&!u.labelTarget}).map(Z).filter(function(u){return u!==c})}function r(c,u){return i(u).some(function(l){return l.get("categoryValueRef")===c})}function o(c,u){return i(u).some(function(l){var p=l.get("categoryValueRef");return p&&p.$parent===c})}function a(c,u){c&&u&&rR(c,u,e.getDefinitions())}function s(c,u,l){u&&!o(u,l)&&aR(u),c&&!r(c,l)&&oR(c)}this.executed(["shape.create","label.create"],function(c){var u=c.labelTarget||c.shape;!v(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;!v(u,"bpmn:Group")||u.labelTarget||s(c.categoryValue,c.category,Z(u))},!0),this.executed(["shape.move","shape.resize"],sR,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,Z(u))},!0),this.executed("group.updateRefs",function(c){xm(c).forEach(function(u){a(u.categoryValue,u.category)})},!0),this.reverted("group.updateRefs",function(c){xm(c).forEach(function(u){s(u.categoryValue,u.category,Z(u.groupShape))})},!0),this.executed("shape.delete",function(c){var u=c.shape;!v(u,"bpmn:Group")||u.labelTarget||s(c.categoryValue,c.category,Z(u))},!0),this.reverted("shape.delete",function(c){var u=c.shape;!v(u,"bpmn:Group")||u.labelTarget||a(c.categoryValue,c.category)},!0)}wl.$inject=["bpmnjs","elementRegistry","injector"],ie(wl,X);function xm(e){var t;return((t=e.updates)==null?void 0:t.groups)||[]}function El(e,t,n){X.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 R=g.source,w=g.target;mo(R)&&sa(w)&&l(w)}function r(g){const R=g.connection,w=g.source,b=g.target;mo(w)&&Ns(b)&&(u(b),f(w,[R]))}function o(g){const R=g.newTarget,w=g.oldSource,b=g.oldTarget;if(b!==R){const x=w;sa(b)&&l(b),mo(x)&&Ns(R)&&u(R)}}function a(g){const{element:R}=g;sa(R)?(p(R),d(R)):Ns(R)&&h(R)}function s(g){const{newData:R,oldShape:w}=g;if(mo(g.oldShape)&&R.eventDefinitionType!=="bpmn:CompensateEventDefinition"||R.type!=="bpmn:BoundaryEvent"){const b=w.outgoing.find(({target:x})=>sa(x));b&&b.target&&(g._connectionTarget=b.target)}else if(!mo(g.oldShape)&&R.eventDefinitionType==="bpmn:CompensateEventDefinition"&&R.type==="bpmn:BoundaryEvent"){const b=w.outgoing.find(({target:x})=>Ns(x));b&&b.target&&(g._connectionTarget=b.target),m(w)}}function c(g){const{_connectionTarget:R,newShape:w}=g;R&&t.connect(w,R)}function u(g){t.updateProperties(g,{isForCompensation:!0})}function l(g){t.updateProperties(g,{isForCompensation:void 0})}function p(g){for(const R of g.incoming)n.canConnect(R.source,g)||t.removeConnection(R);for(const R of g.outgoing)n.canConnect(g,R.target)||t.removeConnection(R)}function f(g,R){g.outgoing.filter(x=>v(x,"bpmn:Association")).filter(x=>sa(x.target)&&!R.includes(x)).forEach(x=>t.removeConnection(x))}function d(g){const R=g.attachers.slice();R.length&&t.removeElements(R)}function h(g){const R=g.incoming.filter(w=>mo(w.source));t.removeElements(R)}function m(g){const R=g.outgoing.filter(w=>v(w,"bpmn:SequenceFlow"));t.removeElements(R)}}ie(El,X),El.$inject=["eventBus","modeling","bpmnRules"];function sa(e){const t=Z(e);return t&&t.get("isForCompensation")}function mo(e){return e&&v(e,"bpmn:BoundaryEvent")&&lo(e,"bpmn:CompensateEventDefinition")}function Ns(e){return e&&v(e,"bpmn:Activity")&&!cn(e)}function Sl(e){e.invoke(X,this),this.preExecute("shape.create",1500,function(t){var n=t.context,i=n.parent,r=n.shape;v(i,"bpmn:Lane")&&!v(r,"bpmn:Lane")&&(n.parent=ho(i,"bpmn:Participant"))})}Sl.$inject=["injector"],ie(Sl,X);function Rl(e,t){X.call(this,e),this.preExecute("shape.create",function(n){var a;var i=n.context,r=i.shape;if(v(r,"bpmn:DataObjectReference")&&r.type!=="label"){var o=t.create("bpmn:DataObject");o.isCollection=((a=r.businessObject.dataObjectRef)==null?void 0:a.isCollection)||!1,r.businessObject.dataObjectRef=o}})}Rl.$inject=["eventBus","bpmnFactory"],ie(Rl,X);var Cl=20,Pl=20,wm=30,Bs=2e3;function Al(e,t,n){X.call(this,t),t.on(["create.start","shape.move.start"],Bs,function(r){var o=r.context,a=o.shape,s=e.getRootElement();if(!(!v(a,"bpmn:Participant")||!v(s,"bpmn:Process")||!s.children.length)){var c=s.children.filter(function(p){return!v(p,"bpmn:Group")&&!Me(p)&&!it(p)});if(c.length){var u=At(c),l=cR(a,u);O(a,l),o.createConstraints=uR(a,u)}}}),t.on("create.start",Bs,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}v(a,"bpmn:Participant")&&v(s,"bpmn:Process")&&(t.on("element.hover",Bs,u),t.once("create.cleanup",function(){t.off("element.hover",u)}))});function i(){var r=e.getRootElement();return v(r,"bpmn:Collaboration")?r:n.makeCollaboration()}this.preExecute("elements.create",Bs,function(r){var o=r.elements,a=r.parent,s=lR(o),c;s&&v(a,"bpmn:Process")&&(r.parent=i(),c=r.hints=r.hints||{},c.participant=s,c.process=a,c.processRef=Z(s).get("processRef"))},!0),this.preExecute("shape.create",function(r){var o=r.parent,a=r.shape;v(a,"bpmn:Participant")&&v(o,"bpmn:Process")&&(r.parent=i(),r.process=o,r.processRef=Z(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)&&Z(s).set("processRef",Z(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)&&Z(c).set("processRef",s)},!0),this.postExecute("shape.create",function(r){var o=r.hints||{},a=r.process||r.hints.process,s=r.shape,c=o.participant;if(a){var u=a.children.slice();c?s===c&&n.moveElements(u,{x:0,y:0},c):n.moveElements(u,{x:0,y:0},s)}},!0)}Al.$inject=["canvas","eventBus","modeling"],ie(Al,X);function cR(e,t){t={width:t.width+Cl*2+wm,height:t.height+Pl*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 uR(e,t){return t=ye(t),{bottom:t.top+e.height/2-Pl,left:t.right-e.width/2+Cl,top:t.bottom-e.height/2+Pl,right:t.left+e.width/2-Cl-wm}}function lR(e){return st(e,function(t){return v(t,"bpmn:Participant")})}var Em="__targetRef_placeholder";function Tl(e,t){X.call(this,e),this.executed(["connection.create","connection.delete","connection.move","connection.reconnect"],Sm(o)),this.reverted(["connection.create","connection.delete","connection.move","connection.reconnect"],Sm(o));function n(a,s,c){var u=a.get("dataInputAssociations");return st(u,function(l){return l!==c&&l.targetRef===s})}function i(a,s){var c=a.get("properties"),u=st(c,function(l){return l.name===Em});return!u&&s&&(u=t.create("bpmn:Property",{name:Em}),St(c,u)),u}function r(a,s){var c=i(a);c&&(n(a,c,s)||wt(a.get("properties"),c))}function o(a){var s=a.context,c=s.connection,u=c.businessObject,l=c.target,p=l&&l.businessObject,f=s.newTarget,d=f&&f.businessObject,h=s.oldTarget||s.target,m=h&&h.businessObject,g=c.businessObject,R;m&&m!==p&&r(m,u),d&&d!==p&&r(d,u),p?(R=i(p,!0),g.targetRef=R):g.targetRef=null}}Tl.$inject=["eventBus","bpmnFactory"],ie(Tl,X);function Sm(e){return function(t){var n=t.context,i=n.connection;if(v(i,"bpmn:DataInputAssociation"))return e(t)}}function $s(e){this._bpmnUpdater=e}$s.$inject=["bpmnUpdater"],$s.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),[]},$s.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 Ml(e,t,n,i){X.call(this,i),t.registerHandler("dataStore.updateContainment",$s);function r(){return n.filter(function(s){return v(s,"bpmn:Participant")&&Z(s).processRef})[0]}function o(s){return s.children.filter(function(c){return v(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:Ve(s),newSemanticParent:l.processRef||l,newDiParent:Ve(c)})}}this.preExecute("shape.create",function(s){var c=s.context,u=c.shape;v(u,"bpmn:DataStoreReference")&&u.type!=="label"&&(c.hints||(c.hints={}),c.hints.autoResize=!1)}),this.preExecute("elements.move",function(s){var c=s.context,u=c.shapes,l=u.filter(function(p){return v(p,"bpmn:DataStoreReference")});l.length&&(c.hints||(c.hints={}),c.hints.autoResize=u.filter(function(p){return!v(p,"bpmn:DataStoreReference")}))}),this.postExecute("shape.create",function(s){var c=s.context,u=c.shape,l=u.parent;v(u,"bpmn:DataStoreReference")&&u.type!=="label"&&v(l,"bpmn:Collaboration")&&a(u)}),this.postExecute("shape.move",function(s){var c=s.context,u=c.shape,l=c.oldParent,p=u.parent;if(!v(l,"bpmn:Collaboration")&&v(u,"bpmn:DataStoreReference")&&u.type!=="label"&&v(p,"bpmn:Collaboration")){var f=v(l,"bpmn:Participant")?l:fR(l,"bpmn:Participant");a(u,f)}}),this.postExecute("shape.delete",function(s){var c=s.context,u=c.shape,l=e.getRootElement();De(u,["bpmn:Participant","bpmn:SubProcess"])&&v(l,"bpmn:Collaboration")&&o(l).filter(function(p){return pR(p,u)}).forEach(function(p){a(p)})}),this.postExecute("canvas.updateRoot",function(s){var c=s.context,u=c.oldRoot,l=c.newRoot,p=o(u);p.forEach(function(f){v(l,"bpmn:Process")&&a(f,l)})})}Ml.$inject=["canvas","commandStack","elementRegistry","eventBus"],ie(Ml,X);function pR(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 fR(e,t){for(;e.parent;){if(v(e.parent,t))return e.parent;e=e.parent}}var js=Math.max,Fs=Math.min,dR=20;function Rm(e,t){return{top:e.top-t.top,right:e.right-t.right,bottom:e.bottom-t.bottom,left:e.left-t.left}}function hR(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 mR(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 Hs(e,t,n){var i=t[e],r=n.min&&n.min[e],o=n.max&&n.max[e];return we(r)&&(i=(/top|left/.test(e)?Fs:js)(i,r)),we(o)&&(i=(/top|left/.test(e)?js:Fs)(i,o)),i}function gR(e,t){if(!t)return e;var n=ye(e);return Es({top:Hs("top",n,t),right:Hs("right",n,t),bottom:Hs("bottom",n,t),left:Hs("left",n,t)})}function yR(e,t,n,i){var r=ye(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?ye(i):o,s={top:Fs(o.top,a.top),left:Fs(o.left,a.left),bottom:js(o.bottom,a.bottom),right:js(o.right,a.right)};return Es(s)}function ca(e,t){return typeof e<"u"?e:dR}function vR(e,t){var n,i,r,o;return typeof t=="object"?(n=ca(t.left),i=ca(t.right),r=ca(t.top),o=ca(t.bottom)):n=i=r=o=ca(t),{x:e.x-n,y:e.y-r,width:e.width+n+i,height:e.height+r+o}}function _R(e){return!(e.waypoints||e.type==="label")}function Cm(e,t){var n;if(e.length===void 0?n=Oe(e.children,_R):n=e,n.length)return vR(At(n),t)}var ir=Math.abs;function bR(e,t){return Rm(ye(t),ye(e))}var xR=["bpmn:Participant","bpmn:Process","bpmn:SubProcess"],Wn=30;function zs(e,t){return t=t||[],e.children.filter(function(n){v(n,"bpmn:Lane")&&(zs(n,t),t.push(n))}),t}function rr(e){return e.children.filter(function(t){return v(t,"bpmn:Lane")})}function Un(e){return ho(e,xR)||e}function wR(e,t){var n=Un(e),i=v(n,"bpmn:Process")?[]:[n],r=zs(n,i),o=ye(e),a=ye(t),s=bR(e,t),c=[],u=Yt(e);return r.forEach(function(l){if(l!==e){var p=u?0:s.top,f=u?s.right:0,d=u?0:s.bottom,h=u?s.left:0,m=ye(l);s.top&&(ir(m.bottom-o.top)<10&&(d=a.top-m.bottom),ir(m.top-o.top)<5&&(p=a.top-m.top)),s.left&&(ir(m.right-o.left)<10&&(f=a.left-m.right),ir(m.left-o.left)<5&&(h=a.left-m.left)),s.bottom&&(ir(m.top-o.bottom)<10&&(p=a.bottom-m.top),ir(m.bottom-o.bottom)<5&&(d=a.bottom-m.bottom)),s.right&&(ir(m.left-o.right)<10&&(h=a.right-m.left),ir(m.right-o.right)<5&&(f=a.right-m.right)),(p||f||d||h)&&c.push({shape:l,newBounds:mR(l,{top:p,right:f,bottom:d,left:h})})}}),c}var ER=500;function kl(e,t){X.call(this,e);function n(i,r){var o=Yt(i),a=rr(r),s=[],c=[],u=[],l=[];if(Or(a,function(g){return o?g.y>i.y?c.push(g):s.push(g):g.x>i.x?l.push(g):u.push(g),g.children}),!!a.length){var p;o?c.length&&s.length?p=i.height/2:p=i.height:l.length&&u.length?p=i.width/2:p=i.width;var f,d,h,m;s.length&&(f=t.calculateAdjustments(s,"y",p,i.y-10),t.makeSpace(f.movingShapes,f.resizingShapes,{x:0,y:p},"s")),c.length&&(d=t.calculateAdjustments(c,"y",-p,i.y+i.height+10),t.makeSpace(d.movingShapes,d.resizingShapes,{x:0,y:-p},"n")),u.length&&(h=t.calculateAdjustments(u,"x",p,i.x-10),t.makeSpace(h.movingShapes,h.resizingShapes,{x:p,y:0},"e")),l.length&&(m=t.calculateAdjustments(l,"x",-p,i.x+i.width+10),t.makeSpace(m.movingShapes,m.resizingShapes,{x:-p,y:0},"w"))}}this.postExecuted("shape.delete",ER,function(i){var r=i.context,o=r.hints,a=r.shape,s=r.oldParent;v(a,"bpmn:Lane")&&(o&&o.nested||n(a,s))})}kl.$inject=["eventBus","spaceTool"],ie(kl,X);var Pm=500;function Vs(e,t){t.invoke(X,this),this._bpmnReplace=e;var n=this;this.postExecuted("elements.create",Pm,function(i){var r=i.elements;r.filter(function(o){var a=o.host;return Am(o,a)}).map(function(o){return r.indexOf(o)}).forEach(function(o){i.elements[o]=n._replaceShape(r[o])})},!0),this.preExecute("elements.move",Pm,function(i){var r=i.shapes,o=i.newHost;r.forEach(function(a,s){var c=a.host;Am(a,RR(r,c)?c:o)&&(r[s]=n._replaceShape(a))})},!0)}Vs.$inject=["bpmnReplace","injector"],ie(Vs,X),Vs.prototype._replaceShape=function(e){var t=SR(e),n;return t?n={type:"bpmn:IntermediateCatchEvent",eventDefinitionType:t.$type}:n={type:"bpmn:IntermediateThrowEvent"},this._bpmnReplace.replaceElement(e,n,{layoutConnection:!1})};function SR(e){var t=Z(e),n=t.eventDefinitions;return n&&n[0]}function Am(e,t){return!Me(e)&&v(e,"bpmn:BoundaryEvent")&&!t}function RR(e,t){return e.indexOf(t)!==-1}var Gs=Math.round,CR=Math.max;function PR(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 AR(e){var t=[];return e.forEach(function(n,i){t.push([i===0?"M":"L",n.x,n.y])}),t}var Tm=10;function TR(e,t){var n,i;for(n=0;i=e[n];n++)if(Qo(i,t)<=Tm)return{point:e[n],bendpoint:!0,index:n};return null}function MR(e,t){var n=Lh(PR(t,Tm),AR(e)),i=n[0],r=n[n.length-1],o;return i?i!==r?i.segment2!==r.segment2?(o=CR(i.segment2,r.segment2)-1,{point:e[o],bendpoint:!0,index:o}):{point:{x:Gs(i.x+r.x)/2,y:Gs(i.y+r.y)/2},index:i.segment2}:{point:{x:Gs(i.x),y:Gs(i.y)},index:i.segment2}:null}function Dl(e,t){return TR(e,t)||MR(e,t)}function Ol(e,t,n){X.call(this,e);function i(r,o,a){var s=o.waypoints,c,u,l,p,f,d,h,m=r.outgoing.slice(),g=r.incoming.slice(),R;we(a.width)?R=be(a):R=a;var w=Dl(s,R);if(w){if(c=s.slice(0,w.index),u=s.slice(w.index+(w.bendpoint?1:0)),!c.length||!u.length)return;l=w.bendpoint?s[w.index]:R,(c.length===1||!Mm(r,c[c.length-1]))&&c.push(km(l)),(u.length===1||!Mm(r,u[0]))&&u.unshift(km(l))}p=o.source,f=o.target,t.canConnect(p,r,o)&&(n.reconnectEnd(o,r,c||R),d=o),t.canConnect(r,f,o)&&(d?h=n.connect(r,f,{type:o.type,waypoints:u}):(n.reconnectStart(o,r,u||R),h=o));var b=[].concat(d&&Oe(g,function(x){return x.source===d.source})||[],h&&Oe(m,function(x){return x.target===h.target})||[]);b.length&&n.removeElements(b)}this.preExecute("elements.move",function(r){var o=r.newParent,a=r.shapes,s=r.delta,c=a[0];if(!(!c||!o)){o&&o.waypoints&&(r.newParent=o=o.parent);var u=be(c),l={x:u.x+s.x,y:u.y+s.y},p=st(o.children,function(f){var d=t.canInsert(a,f);return d&&Dl(f.waypoints,l)});p&&(r.targetFlow=p,r.position=l)}},!0),this.postExecuted("elements.move",function(r){var o=r.shapes,a=r.targetFlow,s=r.position;a&&i(o[0],a,s)},!0),this.preExecute("shape.create",function(r){var o=r.parent,a=r.shape;t.canInsert(a,o)&&(r.targetFlow=o,r.parent=o.parent)},!0),this.postExecuted("shape.create",function(r){var o=r.shape,a=r.targetFlow,s=r.position;a&&i(o,a,s)},!0)}ie(Ol,X),Ol.$inject=["eventBus","bpmnRules","modeling"];function Mm(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 km(e){return O({},e)}function Ll(e,t){X.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)&&go(r)){var c=[];v(o,"bpmn:EventBasedGateway")?c=a.incoming.filter(u=>u!==r&&go(u)):c=a.incoming.filter(u=>u!==r&&go(u)&&v(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(v(r,"bpmn:EventBasedGateway")){var o=r.outgoing.filter(go).reduce(function(a,s){return a.includes(s.target)?a:a.concat(s.target)},[]);o.forEach(function(a){a.incoming.filter(go).forEach(function(s){const c=a.incoming.filter(go).filter(function(u){return u.source===r});(s.source!==r||c.length>1)&&t.removeConnection(s)})})}})}Ll.$inject=["eventBus","modeling"],ie(Ll,X);function go(e){return v(e,"bpmn:SequenceFlow")}var Ws=1500,Dm=2e3;function Om(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"],Ws,function(i){var r=i.context,o=r.shape||i.shape,a=i.hover;v(a,"bpmn:Lane")&&!De(o,["bpmn:Lane","bpmn:Participant"])&&(i.hover=Un(a),i.hoverGfx=e.getGraphics(i.hover));var s=n.getRootElement();a&&a!==s&&(o.labelTarget||De(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"],Ws,function(i){var r=i.hover;v(r,"bpmn:Lane")&&(i.hover=Un(r)||r,i.hoverGfx=e.getGraphics(i.hover))}),t.on(["bendpoint.move.hover"],Ws,function(i){var r=i.context,o=i.hover,a=r.type;v(o,"bpmn:Lane")&&/reconnect/.test(a)&&(i.hover=Un(o)||o,i.hoverGfx=e.getGraphics(i.hover))}),t.on(["connect.start"],Ws,function(i){var r=i.context,o=r.start;v(o,"bpmn:Lane")&&(r.start=Un(o)||o)}),t.on("shape.move.start",Dm,function(i){var r=i.shape;v(r,"bpmn:Lane")&&(i.shape=Un(r)||r)}),t.on("spaceTool.move",Dm,function(i){var r=i.hover;r&&v(r,"bpmn:Lane")&&(i.hover=Un(r))})}Om.$inject=["elementRegistry","eventBus","canvas"];var Lm=770;function Il(e,t,n,i){n.invoke(X,this);function r(s,c){var u=Z(s),l=c.categoryValue||u.categoryValueRef;l||(l=bm(e,u));var p=c.category||l.$parent||_m(e);u.categoryValueRef=l,l.$parent=p,c.categoryValue=l,c.category=p}function o(s,c){var u=Z(s),l=c.categoryValue||u.categoryValueRef,p=c.category||l&&l.$parent;l&&(c.categoryValue=l,c.category=p,u.categoryValueRef=null)}this.execute("label.create",function(s){var c=s.context,u=c.labelTarget;v(u,"bpmn:Group")&&r(u,c)}),this.revert("label.create",function(s){var c=s.context,u=c.labelTarget;v(u,"bpmn:Group")&&o(u,c)}),this.execute("shape.delete",function(s){var c=s.context,u=c.shape,l=Z(u);if(!(!v(u,"bpmn:Group")||u.labelTarget)){var p=c.categoryValue=l.categoryValueRef;p&&(c.category=p.$parent,l.categoryValueRef=null)}}),this.reverted("shape.delete",function(s){var c=s.context,u=c.shape;if(!(!v(u,"bpmn:Group")||u.labelTarget)){var l=c.category,p=c.categoryValue,f=Z(u);p&&(f.categoryValueRef=p,p.$parent=l)}}),this.execute("shape.create",function(s){var c=s.context,u=c.shape,l=c.hints||{};!v(u,"bpmn:Group")||u.labelTarget||l.createElementsBehavior===!1&&!Z(u).categoryValueRef&&!c.categoryValue||r(u,c)}),this.reverted("shape.create",function(s){var c=s.context,u=c.shape,l=c.hints||{};!v(u,"bpmn:Group")||u.labelTarget||l.createElementsBehavior===!1&&!Z(u).categoryValueRef&&!c.categoryValue||o(u,c)}),this.executed(["shape.move","shape.resize"],function(s){var c=s.context,u=c.shape;!v(u,"bpmn:Group")||u.labelTarget||Z(u).categoryValueRef||r(u,c)}),this.reverted(["shape.move","shape.resize"],function(s){var c=s.context,u=c.shape;!v(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",Lm,function(s){var c=s.descriptor,u=s.element;if(!(!v(u,"bpmn:Group")||u.labelTarget)){var l=Z(u);if(l.categoryValueRef){var p=l.categoryValueRef;c.categoryValue=a(p,!0),p.$parent&&(c.category=a(p.$parent,!0))}}}),t.on("copyPaste.pasteElement",Lm,function(s){var c=s.descriptor,u=c.businessObject,l=c.categoryValue,p=c.category;l&&(l=u.categoryValueRef=a(l)),p&&(l.$parent=a(p)),delete c.category,delete c.categoryValue})}Il.$inject=["bpmnFactory","eventBus","injector","moddleCopy"],ie(Il,X);function Nl(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 Im(e){function t(i,r,o){var a={x:o.x,y:o.y-50},s={x:o.x-50,y:o.y},c=Nl(i,r,o,a),u=Nl(i,r,o,s),l;c&&u?Nm(c,o)>Nm(u,o)?l=u:l=c:l=c||u,i.original=l}function n(i){var r=i.waypoints;t(r[0],r[1],be(i.source)),t(r[r.length-1],r[r.length-2],be(i.target))}e.on("bpmnElement.added",function(i){var r=i.element;r.waypoints&&n(r)})}Im.$inject=["eventBus"];function Nm(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function Bl(e){X.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=Z(i),o=Ve(i);if(De(r,t)){var a=o.get("isHorizontal");a===void 0&&(a=!0),o.set("isHorizontal",a)}})}Bl.$inject=["eventBus"],ie(Bl,X);function Bm(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}function $m(e){return Math.atan((e[1].y-e[0].y)/(e[1].x-e[0].x))}function kR(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 DR(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 $l(e,t){var n=t[0],i=t[1],r={x:i.x-n.x,y:i.y-n.y},o=DR([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 jm(e,t){var n=$l(e,t),i={x:n.x-e.x,y:n.y-e.y};return Bm(i)}function ua(e,t){return Bm({x:e.x-t.x,y:e.y-t.y})}var Fm=Math.sqrt,Hm=Math.min,OR=Math.max,zm=Math.abs;function Vm(e){return Math.pow(e,2)}function la(e,t){return Fm(Vm(e.x-t.x)+Vm(e.y-t.y))}function LR(e,t){var n=0,i,r,o,a,s,c,u,l,p,f,d;for(n=0;n<t.length-1;n++){if(i=t[n],r=t[n+1],Wm(i,r)?u=[i]:(o=la(e,i),a=la(e,r),c=Hm(o,a),u=IR(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:Wm(i,u[0])?n:n+1}),u.length===2&&(s=BR(u[0],u[1]),l={type:"segment",position:s,segmentIndex:n,relativeLocation:la(i,s)/la(i,r)}),p=la(l.position,e),(!d||f>p)&&(d=l,f=p)}return d}function IR(e,t,n,i){var r=t.x-e.x,o=t.y-e.y,a=n.x-e.x,s=n.y-e.y,c=r*r+o*o,u=r*a+o*s,l=a*a+s*s-i*i,p=u/c,f=l/c,d=p*p-f;if(d<0&&d>-1e-6&&(d=0),d<0)return[];var h=Fm(d),m=-p+h,g=-p-h,R={x:e.x-r*m,y:e.y-o*m};if(d===0)return[R];var w={x:e.x-r*g,y:e.y-o*g};return[R,w].filter(function(b){return NR(b,e,t)})}function NR(e,t,n){return Gm(e.x,t.x,n.x)&&Gm(e.y,t.y,n.y)}function Gm(e,t,n){return e>=Hm(t,n)-Us&&e<=OR(t,n)+Us}function BR(e,t){return{x:(e.x+t.x)/2,y:(e.y+t.y)/2}}var Us=.1;function Wm(e,t){return zm(e.x-t.x)<=Us&&zm(e.y-t.y)<=Us}function $R(e,t,n,i){var r=n.segmentIndex,o=t.length-e.length;if(i.segmentMove){var a=i.segmentMove.segmentStartIndex,s=i.segmentMove.newSegmentStartIndex;return r===a?s:r>=s?r+o<s?s:r+o:r}if(i.bendpointMove){var c=i.bendpointMove.insert,u=i.bendpointMove.bendpointIndex,l;if(o===0)return r;if(r>=u&&(l=c?r+1:r-1),r<u&&(l=r,c&&n.type!=="bendpoint"&&u-1===r)){var p=Ym(t,u);p<n.relativeLocation&&l++}return l}return o===0?r:i.connectionStart&&r===0?0:i.connectionEnd&&r===e.length-2?t.length-2:Math.floor((t.length-2)/2)}function Um(e,t,n,i){var r=0,o=0,a={point:e,delta:{x:0,y:0}},s=LR(e,n),c=s.segmentIndex,u=$R(n,t,s,i);if(u<0||u>t.length-2||u===null)return a;var l=qm(n,c),p=qm(t,u),f=s.position,d=FR(l,f),h=jR(l,p);if(s.type==="bendpoint"){var m=t.length-n.length,g=s.bendpointIndex,R=n[g];if(t.indexOf(R)!==-1)return a;if(m===0){var w=t[g];return r=w.x-s.position.x,o=w.y-s.position.y,{delta:{x:r,y:o},point:{x:e.x+r,y:e.y+o}}}m<0&&g!==0&&g<n.length-1&&(d=Ym(n,g))}var b={x:(p[1].x-p[0].x)*d+p[0].x,y:(p[1].y-p[0].y)*d+p[0].y},x=kR({x:e.x-f.x,y:e.y-f.y},h);return r=b.x+x.x-e.x,o=b.y+x.y-e.y,{point:Ti(b),delta:Ti({x:r,y:o})}}function Ym(e,t){var n=ua(e[t-1],e[t]),i=ua(e[t],e[t+1]),r=n/(n+i);return r}function jR(e,t){var n=$m(e),i=$m(t);return i-n}function qm(e,t){return[e[t],e[t+1]]}function FR(e,t){var n=ua(e[0],e[1]),i=ua(e[0],t);return n===0?0:i/n}function HR(e,t,n,i){var r=be(e);return Um(r,t,n,i).delta}function pa(e,t,n){var i=aa(t),r=aa(n),o=ii(e,i),a={x:o.x*(n.width/t.width),y:o.y*(n.height/t.height)};return Ti({x:r.x+a.x,y:r.y+a.y})}function Km(e,t,n){var i=aa(e),r=aa(t),o=aa(n),a=ii(e,i),s=ii(i,r),c=zR(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 Ti({x:l.x+a.x-e.x,y:l.y+a.y-e.y})}function zR(e,t,n){var i=ye(t),r=ye(n);if(VR(i,r))return null;var o=Zt(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=Zt(n,s),c!==o?null:a}function VR(e,t){return GR(e,t)||WR(e,t)}function GR(e,t){return e.right!==t.right&&e.left!==t.left}function WR(e,t){return e.top!==t.top&&e.bottom!==t.bottom}var Xm="name",Zm="text";function jl(e,t,n,i){X.call(this,e),this.postExecute("element.updateProperties",r),this.postExecute("element.updateModdleProperties",a=>{Z(a.context.element)===a.context.moddleElement&&r(a)});function r(a){var s=a.context,c=s.element,u=s.properties;if(Xm in u&&t.updateLabel(c,u[Xm]),Zm in u&&v(c,"bpmn:TextAnnotation")){var l=i.getTextAnnotationBounds({x:c.x,y:c.y,width:c.width,height:c.height},u[Zm]||"");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;Me(u)||!nr(u)||jn(u)&&t.updateLabel(u,jn(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=O({},s.hints),p=s.newWaypoints||c.waypoints,f=s.oldWaypoints;return typeof l.startChanged>"u"&&(l.startChanged=!!l.connectionStart),typeof l.endChanged>"u"&&(l.endChanged=!!l.connectionEnd),HR(u,p,f,l)}this.postExecute(["connection.layout","connection.updateWaypoints"],function(a){var s=a.context,c=s.hints||{};if(c.labelBehavior!==!1){var u=s.connection,l=u.label,p;!l||!l.parent||(p=o(a),t.moveShape(l,p))}}),this.postExecute(["shape.replace"],function(a){var s=a.context,c=s.newShape,u=s.oldShape,l=Z(c);l&&nr(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(!(!Me(c)||u.autoResize)){var l=s.newBounds,p=i.getDimensions(jn(c)||"",{box:l,style:i.getExternalStyle()}),f=Math.ceil(p.height),d=l.y!==c.y,h=c.y+c.height;s.newBounds={width:l.width,height:f,x:l.x,y:d?h-f:l.y}}}),this.postExecute("shape.resize",function(a){var s=a.context,c=s.shape,u=s.newBounds,l=s.oldBounds;if(Ts(c)){var p=c.label,f=be(p),d=qR(l),h=YR(f,d),m=UR(h,l,u);t.moveShape(p,m)}})}ie(jl,X),jl.$inject=["eventBus","modeling","bpmnFactory","textRenderer"];function UR(e,t,n){var i=pa(e,t,n);return Ti(ii(i,e))}function YR(e,t){if(t.length){var n=KR(e,t);return $l(e,n)}}function qR(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 KR(e,t){var n=t.map(function(r){return{line:r,distance:jm(e,r)}}),i=oi(n,"distance");return i[0].line}function XR(e,t,n,i){return Um(e,t,n,i).point}function Fl(e,t){X.call(this,e);function n(i,r){var o=i.context,a=o.connection,s=O({},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),XR(r,c,u,s)}this.postExecute(["connection.layout","connection.updateWaypoints"],function(i){var r=i.context,o=r.connection,a=o.outgoing,s=o.incoming;s.forEach(function(c){var u=c.waypoints[c.waypoints.length-1],l=n(i,u),p=[].concat(c.waypoints.slice(0,-1),[l]);t.updateWaypoints(c,p)}),a.forEach(function(c){var u=c.waypoints[0],l=n(i,u),p=[].concat([l],c.waypoints.slice(1));t.updateWaypoints(c,p)})}),this.postExecute(["connection.move"],function(i){var r=i.context,o=r.connection,a=o.outgoing,s=o.incoming,c=r.delta;s.forEach(function(u){var l=u.waypoints[u.waypoints.length-1],p={x:l.x+c.x,y:l.y+c.y},f=[].concat(u.waypoints.slice(0,-1),[p]);t.updateWaypoints(u,f)}),a.forEach(function(u){var l=u.waypoints[0],p={x:l.x+c.x,y:l.y+c.y},f=[].concat([p],u.waypoints.slice(1));t.updateWaypoints(u,f)})})}ie(Fl,X),Fl.$inject=["eventBus","modeling"];function Ys(e,t,n){var i=Ks(e),r=Jm(i,t),o=i[0];return r.length?r[r.length-1]:pa(o.original||o,n,t)}function qs(e,t,n){var i=Ks(e),r=Jm(i,t),o=i[i.length-1];return r.length?r[0]:pa(o.original||o,n,t)}function Hl(e,t,n){var i=Ks(e),r=Qm(t,n),o=i[0];return pa(o.original||o,r,t)}function zl(e,t,n){var i=Ks(e),r=Qm(t,n),o=i[i.length-1];return pa(o.original||o,r,t)}function Qm(e,t){return{x:e.x-t.x,y:e.y-t.y,width:e.width,height:e.height}}function Ks(e){var t=e.waypoints;if(!t.length)throw new Error("connection#"+e.id+": no waypoints");return t}function Jm(e,t){var n=rn(e,QR);return Oe(n,function(i){return ZR(i,t)})}function ZR(e,t){return Zt(t,e,1)==="intersect"}function QR(e){return e.original||e}function Vl(e,t){X.call(this,e),this.postExecute("shape.replace",function(n){var i=n.oldShape,r=n.newShape;if(JR(i,r)){var o=eC(i);o.incoming.forEach(function(a){var s=qs(a,r,i);t.reconnectEnd(a,r,s)}),o.outgoing.forEach(function(a){var s=Ys(a,r,i);t.reconnectStart(a,r,s)})}},!0)}Vl.$inject=["eventBus","modeling"],ie(Vl,X);function JR(e,t){return v(e,"bpmn:Participant")&&$e(e)&&v(t,"bpmn:Participant")&&!$e(t)}function eC(e){var t=Xo([e]),n=[],i=[];return t.forEach(function(r){r!==e&&(r.incoming.forEach(function(o){v(o,"bpmn:MessageFlow")&&n.push(o)}),r.outgoing.forEach(function(o){v(o,"bpmn:MessageFlow")&&i.push(o)}))},[]),{incoming:n,outgoing:i}}const tC=["bpmn:MessageEventDefinition","bpmn:TimerEventDefinition","bpmn:EscalationEventDefinition","bpmn:ConditionalEventDefinition","bpmn:SignalEventDefinition"];function eg(e){const t=Z(e);if(!v(t,"bpmn:BoundaryEvent")&&!(v(t,"bpmn:StartEvent")&&cn(t.$parent)))return!1;const n=t.get("eventDefinitions");return!n||!n.length?!1:tC.some(i=>v(n[0],i))}function tg(e){return v(e,"bpmn:BoundaryEvent")?"cancelActivity":"isInterrupting"}function Gl(e,t){e.invoke(X,this),this.postExecuted("shape.replace",function(n){const i=n.context.oldShape,r=n.context.newShape,o=n.context.hints;if(!eg(r))return;const a=tg(r);if(o.targetElement&&o.targetElement[a]!==void 0)return;const c=Z(i).get(a),u=Z(r).get(a);c!==u&&t.updateProperties(r,{[a]:c})})}Gl.$inject=["injector","modeling"],ie(Gl,X);function Wl(e,t){X.call(this,e),this.preExecute("shape.resize",function(n){var i=n.shape,r=Ve(i),o=r&&r.get("label"),a=o&&o.get("bounds");a&&t.updateModdleProperties(i,o,{bounds:void 0})},!0)}ie(Wl,X),Wl.$inject=["eventBus","modeling"];function Ul(e,t,n){X.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(!(!v(o,"bpmn:SequenceFlow")||!v(a,"bpmn:SequenceFlow"))&&t.canConnect(o.source,a.target,o)){var s=nC(o.waypoints,a.waypoints);n.reconnectEnd(o,a.target,s)}}})}ie(Ul,X),Ul.$inject=["eventBus","bpmnRules","modeling"];function yo(e){return e.original||e}function nC(e,t){var n=Nl(yo(e[e.length-2]),yo(e[e.length-1]),yo(t[1]),yo(t[0]));return n?[].concat(e.slice(0,e.length-1),[n],t.slice(1)):[yo(e[0]),yo(t[t.length-1])]}function Yl(e,t){X.call(this,e),this.preExecute("shape.delete",function(n){var i=n.shape,r=i.parent;v(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)}Yl.$inject=["eventBus","modeling"],ie(Yl,X);function ql(e,t,n,i){X.call(this,e);var r=i.get("dragging",!1);function o(c){var u=c.source,l=c.target,p=c.parent;if(p){var f,d;v(c,"bpmn:SequenceFlow")&&(n.canConnectSequenceFlow(u,l)||(d=!0),n.canConnectMessageFlow(u,l)&&(f="bpmn:MessageFlow")),v(c,"bpmn:MessageFlow")&&(n.canConnectMessageFlow(u,l)||(d=!0),n.canConnectSequenceFlow(u,l)&&(f="bpmn:SequenceFlow")),d&&t.removeConnection(c),f&&t.connect(u,l,{type:f,waypoints:c.waypoints.slice()})}}function a(c){var u=c.context,l=u.connection,p=u.newSource||l.source,f=u.newTarget||l.target,d,h;d=n.canConnect(p,f),!(!d||d.type===l.type)&&(h=t.connect(p,f,{type:d.type,associationDirection:d.associationDirection,waypoints:l.waypoints.slice()}),l.parent&&t.removeConnection(l),u.connection=h,r&&s(l,h))}function s(c,u){var l=r.context(),p=l&&l.payload.previousSelection,f;!p||!p.length||(f=p.indexOf(c),f!==-1&&p.splice(f,1,u))}this.postExecuted("elements.move",function(c){var u=c.closure,l=u.allConnections;k(l,o)},!0),this.preExecute("connection.reconnect",a),this.postExecuted("element.updateProperties",function(c){var u=c.context,l=u.properties,p=u.element,f=p.businessObject,d;l.default&&(d=st(p.outgoing,Jr({id:p.businessObject.default.id})),d&&t.updateProperties(d,{conditionExpression:void 0})),l.conditionExpression&&f.sourceRef.default===f&&t.updateProperties(p.source,{default:void 0})})}ie(ql,X),ql.$inject=["eventBus","modeling","bpmnRules","injector"];function Xs(e,t,n,i,r,o){i.invoke(X,this),this._bpmnReplace=e,this._elementRegistry=n,this._selection=o,this.postExecuted(["elements.create"],500,function(a){var s=a.context,c=s.parent,u=s.elements,l=Sn(u,function(p,f){var d=t.canReplace([f],f.host||f.parent||c);return d?p.concat(d.replacements):p},[]);l.length&&this._replaceElements(u,l)},this),this.postExecuted(["elements.move"],500,function(a){var s=a.context,c=s.newParent,u=s.newHost,l=[];k(s.closure.topLevel,function(f){cn(f)?l=l.concat(f.children):l=l.concat(f)}),l.length===1&&u&&(c=u);var p=t.canReplace(l,c);p&&this._replaceElements(l,p.replacements,u)},this),this.postExecute(["shape.replace"],1500,function(a){var s=a.context,c=s.oldShape,u=s.newShape,l=c.attachers,p;l&&l.length&&(p=t.canReplace(l,u),this._replaceElements(l,p.replacements))},this),this.postExecuted(["shape.replace"],1500,function(a){var s=a.context,c=s.oldShape,u=s.newShape;r.unclaimId(c.businessObject.id,c.businessObject),r.updateProperties(u,{id:c.id})})}ie(Xs,X),Xs.prototype._replaceElements=function(e,t){var n=this._elementRegistry,i=this._bpmnReplace,r=this._selection;k(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)},Xs.$inject=["bpmnReplace","bpmnRules","elementRegistry","injector","modeling","selection"];var iC=1500,rC={width:140,height:120},Kl={width:300,height:60},Xl={width:60,height:300},Zs={width:300,height:150},Qs={width:150,height:300},ng={width:140,height:120},ig={width:100,height:40};function rg(e){e.on("resize.start",iC,function(t){var n=t.context,i=n.shape,r=n.direction,o=n.balanced;(v(i,"bpmn:Lane")||v(i,"bpmn:Participant"))&&(n.resizeConstraints=uC(i,r,o)),v(i,"bpmn:SubProcess")&&$e(i)&&(n.minDimensions=ng),v(i,"bpmn:TextAnnotation")&&(n.minDimensions=ig)})}rg.$inject=["eventBus"];var or=Math.abs,oC=Math.min,aC=Math.max;function og(e,t,n,i){var r=e[t];e[t]=r===void 0?n:i(n,r)}function vo(e,t,n){return og(e,t,n,oC)}function _o(e,t,n){return og(e,t,n,aC)}var sC={top:20,left:50,right:20,bottom:20},cC={top:50,left:20,right:20,bottom:20};function uC(e,t,n){var i=Un(e),r=!0,o=!0,a=zs(i,[i]),s=ye(e),c={},u={},l=Yt(e),p=l?Kl:Xl;/n/.test(t)?u.top=s.bottom-p.height:/e/.test(t)?u.right=s.left+p.width:/s/.test(t)?u.bottom=s.top+p.height:/w/.test(t)&&(u.left=s.right-p.width),a.forEach(function(h){var m=ye(h);l?(m.top<s.top-10&&(r=!1),m.bottom>s.bottom+10&&(o=!1)):(m.left<s.left-10&&(r=!1),m.right>s.right+10&&(o=!1)),/n/.test(t)&&(n&&or(s.top-m.bottom)<10&&_o(c,"top",m.top+p.height),or(s.top-m.top)<5&&vo(u,"top",m.bottom-p.height)),/e/.test(t)&&(n&&or(s.right-m.left)<10&&vo(c,"right",m.right-p.width),or(s.right-m.right)<5&&_o(u,"right",m.left+p.width)),/s/.test(t)&&(n&&or(s.bottom-m.top)<10&&vo(c,"bottom",m.bottom-p.height),or(s.bottom-m.bottom)<5&&_o(u,"bottom",m.top+p.height)),/w/.test(t)&&(n&&or(s.left-m.right)<10&&_o(c,"left",m.left+p.width),or(s.left-m.left)<5&&vo(u,"left",m.right-p.width))});var f=i.children.filter(function(h){return!h.hidden&&!h.waypoints&&(v(h,"bpmn:FlowElement")||v(h,"bpmn:Artifact"))}),d=l?sC:cC;return f.forEach(function(h){var m=ye(h);/n/.test(t)&&(!l||r)&&vo(u,"top",m.top-d.top),/e/.test(t)&&(l||o)&&_o(u,"right",m.right+d.right),/s/.test(t)&&(!l||o)&&_o(u,"bottom",m.bottom+d.bottom),/w/.test(t)&&(l||r)&&vo(u,"left",m.left-d.left)}),{min:u,max:c}}function ag(e){!e||typeof e.stopPropagation!="function"||e.stopPropagation()}function bo(e){return e.originalEvent||e.srcEvent}function Zl(e){ag(e),ag(bo(e))}function Br(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 sg(){return/mac/i.test(navigator.platform)}function cg(e,t){return(bo(e)||e).button===t}function ar(e){return cg(e,0)}function lC(e){return cg(e,1)}function fa(e){var t=bo(e)||e;return ar(e)?sg()?t.metaKey:t.ctrlKey:!1}function Js(e){var t=bo(e)||e;return ar(e)&&t.shiftKey}var ug=1001;function lg(e,t){e.on("resize.start",ug+500,function(n){var i=n.context,r=i.shape;(v(r,"bpmn:Lane")||v(r,"bpmn:Participant"))&&(i.balanced=!fa(n))}),e.on("resize.end",ug,function(n){var i=n.context,r=i.shape,o=i.canExecute,a=i.newBounds;if(v(r,"bpmn:Lane")||v(r,"bpmn:Participant"))return o&&(a=jh(a),t.resizeLane(r,a,i.balanced)),!1})}lg.$inject=["eventBus","modeling"];var pC=500;function Ql(e,t,n,i,r){n.invoke(X,this);function o(l){return De(l,["bpmn:ReceiveTask","bpmn:SendTask"])||fC(l,["bpmn:ErrorEventDefinition","bpmn:EscalationEventDefinition","bpmn:MessageEventDefinition","bpmn:SignalEventDefinition"])}function a(l){var p=e.getDefinitions(),f=p.get("rootElements");return!!st(f,Jr({id:l.id}))}function s(l){if(v(l,"bpmn:ErrorEventDefinition"))return"errorRef";if(v(l,"bpmn:EscalationEventDefinition"))return"escalationRef";if(v(l,"bpmn:MessageEventDefinition"))return"messageRef";if(v(l,"bpmn:SignalEventDefinition"))return"signalRef"}function c(l){if(De(l,["bpmn:ReceiveTask","bpmn:SendTask"]))return l.get("messageRef");var p=l.get("eventDefinitions"),f=p[0];return f.get(s(f))}function u(l,p){if(De(l,["bpmn:ReceiveTask","bpmn:SendTask"]))return l.set("messageRef",p);var f=l.get("eventDefinitions"),d=f[0];return d.set(s(d),p)}this.executed(["shape.create","element.updateProperties","element.updateModdleProperties"],function(l){var p=l.shape||l.element;if(o(p)){var f=Z(p),d=c(f),h;d&&!a(d)&&(h=e.getDefinitions().get("rootElements"),St(h,d),l.addedRootElement=d)}},!0),this.reverted(["shape.create","element.updateProperties","element.updateModdleProperties"],function(l){var p=l.addedRootElement;if(p){var f=e.getDefinitions().get("rootElements");wt(f,p)}},!0),t.on("copyPaste.copyElement",function(l){var p=l.descriptor,f=l.element;if(!(f.labelTarget||!o(f))){var d=Z(f),h=c(d);h&&(p.referencedRootElement=h)}}),t.on("copyPaste.pasteElement",pC,function(l){var p=l.descriptor,f=p.businessObject,d=p.referencedRootElement;d&&(a(d)||(d=i.copyElement(d,r.create(d.$type))),u(f,d),delete p.referencedRootElement)})}Ql.$inject=["bpmnjs","eventBus","injector","moddleCopy","bpmnFactory"],ie(Ql,X);function fC(e,t){return _e(t)||(t=[t]),Vi(t,function(n){return lo(e,n)})}var pg=Math.max;function fg(e){e.on("spaceTool.getMinDimensions",function(t){var n=t.shapes,i=t.axis,r=t.start,o={};return k(n,function(a){var s=a.id;v(a,"bpmn:Participant")&&(o[s]=hC(a,i,r)),v(a,"bpmn:Lane")&&(o[s]=Yt(a)?Kl:Xl),v(a,"bpmn:SubProcess")&&$e(a)&&(o[s]=ng),v(a,"bpmn:TextAnnotation")&&(o[s]=ig),v(a,"bpmn:Group")&&(o[s]=rC)}),o})}fg.$inject=["eventBus"];function dC(e){return e==="x"}function hC(e,t,n){var i=Yt(e);if(!yC(e))return i?Zs:Qs;var r=dC(t),o={};return r?i?o=Zs:o={width:gC(e,n,r),height:Qs.height}:i?o={width:Zs.width,height:mC(e,n,r)}:o=Qs,o}function mC(e,t,n){var i;return i=vC(e,t,n),pg(Zs.height,i)}function gC(e,t,n){var i;return i=_C(e,t,n),pg(Qs.width,i)}function yC(e){return!!rr(e).length}function vC(e,t,n){var i=rr(e),r;return r=Jl(i,t,n),e.height-r.height+Kl.height}function _C(e,t,n){var i=rr(e),r;return r=Jl(i,t,n),e.width-r.width+Xl.width}function Jl(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=rr(r),o.length?Jl(o,t,n):r}var dg="_plane";function hg(e){var t=e.id;return bC(t)}function mi(e){var t=e.id;return v(e,"bpmn:SubProcess")?mg(t):t}function $r(e){return mg(e)}function ec(e){var t=Ve(e);return v(t,"bpmndi:BPMNPlane")}function mg(e){return e+dg}function bC(e){return e.replace(new RegExp(dg+"$"),"")}var gg=400,xC=600,yg={x:180,y:160};function Oi(e,t,n,i,r,o,a){X.call(this,t),this._canvas=e,this._eventBus=t,this._modeling=n,this._elementFactory=i,this._bpmnFactory=r,this._bpmnjs=o,this._elementRegistry=a;var s=this;function c(p){return v(p,"bpmn:SubProcess")&&!$e(p)}function u(p){var f=p.shape,d=p.newRootElement,h=Z(f);d=s._addDiagram(d||h),p.newRootElement=e.addRootElement(d)}function l(p){var f=p.shape,d=Z(f);s._removeDiagram(d);var h=p.newRootElement=a.get(mi(d));e.removeRootElement(h)}this.executed("shape.create",function(p){var f=p.shape;c(f)&&u(p)},!0),this.postExecuted("elements.create",function(p){var f=p.elements;k(f,function(d){if(c(d)){var h=a.get(mi(d));if(!(!h||!d.children||!d.children.length)){var m=vg(d);s._showRecursively(m),s._moveChildrenToShape(m,h)}}})},!0),this.reverted("shape.create",function(p){var f=p.shape;c(f)&&l(p)},!0),this.preExecute("shape.delete",function(p){var f=p.shape;!v(f,"bpmn:SubProcess")||!$e(f)||k(na([f]),d=>{n.removeShape(d.annotation)})},!0),this.preExecuted("shape.delete",function(p){var f=p.shape;if(c(f)){var d=a.get(mi(f));d&&n.removeElements(d.children.slice())}},!0),this.executed("shape.delete",function(p){var f=p.shape;c(f)&&l(p)},!0),this.reverted("shape.delete",function(p){var f=p.shape;c(f)&&u(p)},!0),this.preExecuted("shape.replace",function(p){var f=p.oldShape,d=p.newShape;!c(f)||!c(d)||(p.oldRoot=e.removeRootElement(mi(f)))},!0),this.postExecuted("shape.replace",function(p){var f=p.newShape,d=p.oldRoot,h=e.findRoot(mi(f));if(!(!d||!h)){var m=d.children;n.moveElements(m,{x:0,y:0},h)}},!0),this.executed("element.updateProperties",function(p){var f=p.element;if(v(f,"bpmn:SubProcess")){var d=p.properties,h=p.oldProperties,m=h.id,g=d.id;if(m!==g){if(ec(f)){a.updateId(f,$r(g)),a.updateId(m,g);return}var R=a.get($r(m));R&&a.updateId($r(m),$r(g))}}},!0),this.reverted("element.updateProperties",function(p){var f=p.element;if(v(f,"bpmn:SubProcess")){var d=p.properties,h=p.oldProperties,m=h.id,g=d.id;if(m!==g){if(ec(f)){a.updateId(f,$r(m)),a.updateId(g,m);return}var R=a.get($r(g));R&&a.updateId(R,$r(m))}}},!0),t.on("element.changed",function(p){var f=p.element;if(ec(f)){var d=f,h=a.get(hg(d));!h||h===d||t.fire("element.changed",{element:h})}}),this.executed("shape.toggleCollapse",gg,function(p){var f=p.shape;v(f,"bpmn:SubProcess")&&($e(f)?l(p):(u(p),s._showRecursively(f.children)))},!0),this.reverted("shape.toggleCollapse",gg,function(p){var f=p.shape;v(f,"bpmn:SubProcess")&&($e(f)?l(p):(u(p),s._showRecursively(f.children)))},!0),this.postExecuted("shape.toggleCollapse",xC,function(p){var f=p.shape;if(v(f,"bpmn:SubProcess")){var d=p.newRootElement;if(d)if($e(f))s._moveChildrenToShape(d.children.slice(),f),k(na(f.children),m=>{n.moveShape(m.annotation,{x:0,y:0},f.parent),k(m.associations,g=>{n.moveConnection(g,{x:0,y:0},f.parent)})});else{s._disconnectSharedAnnotations(f);var h=vg(f);s._moveChildrenToShape(h,d)}}},!0),t.on("copyPaste.createTree",function(p){var f=p.element,d=p.children;if(c(f)){var h=mi(f),m=a.get(h);m&&d.push.apply(d,m.children)}}),t.on("copyPaste.copyElement",function(p){var f=p.descriptor,d=p.element,h=p.elements,m=d.parent,g=v(Ve(m),"bpmndi:BPMNPlane");if(g){var R=hg(m),w=st(h,function(b){return b.id===R});w&&(f.parent=w.id)}}),t.on("copyPaste.pasteElement",function(p){var f=p.descriptor;f.parent&&(c(f.parent)||f.parent.hidden)&&(f.hidden=!0)})}ie(Oi,X),Oi.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=At(i),o;if(!t.x)o={x:yg.x-r.x,y:yg.y-r.y};else{var a=be(t),s=be(r);o={x:a.x-s.x,y:a.y-s.y}}n.moveElements(e,o,t,{autoResize:!1})}},Oi.prototype._disconnectSharedAnnotations=function(e){var t=this._modeling,n=new Set(cm(e).map(i=>i.annotation));n.size&&k(na(e.children),i=>{n.has(i.annotation)&&k(i.associations,r=>{t.removeConnection(r)})})},Oi.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},Oi.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},Oi.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:mi(e),type:e.$type,di:i,businessObject:e,collapsed:!0});return o},Oi.prototype._removeDiagram=function(e){var t=this._bpmnjs,n=t.getDefinitions().diagrams,i=st(n,function(r){return r.plane.bpmnElement.id===e.id});return n.splice(n.indexOf(i),1),i},Oi.$inject=["canvas","eventBus","modeling","elementFactory","bpmnFactory","bpmnjs","elementRegistry"];function wC(e){var t=[];return k(na(e),n=>{t.push(n.annotation),t.push.apply(t,n.associations)}),t}function vg(e){return e.children.slice().concat(wC(e.children)).concat(EC(e))}function EC(e){return rl(e.children||[]).reduce(function(t,n){return n.label&&n.label.parent!==e&&t.push(n.label),t},[])}function ep(e,t){e.invoke(X,this),this.postExecuted("shape.replace",function(n){var i=n.context.oldShape,r=n.context.newShape;if(!(!v(r,"bpmn:SubProcess")||v(r,"bpmn:AdHocSubProcess")||!(v(i,"bpmn:Task")||v(i,"bpmn:CallActivity"))||!$e(r))){var o=SC(r);t.createShape({type:"bpmn:StartEvent"},o,r)}})}ep.$inject=["injector","modeling"],ie(ep,X);function SC(e){return{x:e.x+e.width/6,y:e.y+e.height/2}}function tp(e,t){X.call(this,e),this.preExecute("connection.create",function(n){const{target:i}=n;v(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&&v(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(!(!v(r,"bpmn:TextAnnotation")||o.autoResize)){var a=i.newBounds,s=t.getTextAnnotationBounds(a,jn(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}}})}ie(tp,X),tp.$inject=["eventBus","textRenderer"];function np(e,t){X.call(this,e),this.postExecuted("shape.toggleCollapse",1500,function(n){var i=n.shape;if($e(i))return;var r=Xo(i);r.forEach(function(a){var s=a.incoming.slice(),c=a.outgoing.slice();k(s,function(u){o(u,!0)}),k(c,function(u){o(u,!1)})});function o(a,s){r.indexOf(a.source)!==-1&&r.indexOf(a.target)!==-1||v(a,"bpmn:Association")&&(v(a.source,"bpmn:TextAnnotation")||v(a.target,"bpmn:TextAnnotation"))||(s?t.reconnectEnd(a,i,be(i)):t.reconnectStart(a,i,be(i)))}},!0)}ie(np,X),np.$inject=["eventBus","modeling"];var ip=500;function rp(e,t,n){X.call(this,e);function i(a){a.length&&a.forEach(function(s){s.type==="label"&&!s.businessObject.name&&(s.hidden=!0)})}function r(a,s){var c=a.children,u=s,l,p;return l=RC(c).concat([a]),p=Cm(l),p?(u.width=Math.max(p.width,u.width),u.height=Math.max(p.height,u.height),u.x=p.x+(p.width-u.width)/2,u.y=p.y+(p.height-u.height)/2):(u.x=a.x+(a.width-u.width)/2,u.y=a.y+(a.height-u.height)/2),u}function o(a,s){return{x:a.x+(a.width-s.width)/2,y:a.y+(a.height-s.height)/2,width:s.width,height:s.height}}this.executed(["shape.toggleCollapse"],ip,function(a){var s=a.context,c=s.shape;v(c,"bpmn:SubProcess")&&(c.collapsed?Ve(c).isExpanded=!1:(i(c.children),Ve(c).isExpanded=!0))}),this.reverted(["shape.toggleCollapse"],ip,function(a){var s=a.context,c=s.shape;c.collapsed?Ve(c).isExpanded=!1:Ve(c).isExpanded=!0}),this.postExecuted(["shape.toggleCollapse"],ip,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"})})}ie(rp,X),rp.$inject=["eventBus","elementFactory","modeling"];function RC(e){return e.filter(function(t){return!t.hidden})}function op(e,t,n,i){t.invoke(X,this),this.preExecute("shape.delete",function(r){var o=r.context,a=o.shape,s=a.businessObject;Me(a)||(v(a,"bpmn:Participant")&&$e(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;v(r,"bpmn:Collaboration")&&n.ids.unclaim(o.id)})}ie(op,X),op.$inject=["canvas","injector","moddle","modeling"];function ap(e,t){X.call(this,e),this.preExecute("connection.delete",function(n){var i=n.context,r=i.connection,o=r.source;CC(r,o)&&t.updateProperties(o,{default:null})})}ie(ap,X),ap.$inject=["eventBus","modeling"];function CC(e,t){if(!v(e,"bpmn:SequenceFlow"))return!1;var n=Z(t),i=Z(e);return n.get("default")===i}var PC=500,AC=5e3,_g=["shape.create","shape.delete","shape.move","shape.resize"],bg=[..._g,"spaceTool","lane.add","lane.resize","lane.split","elements.create","elements.delete","elements.move"];function sp(e,t){X.call(this,e);var n;function i(){return n=n||new TC,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(bg,AC,function(){i()}),this.postExecuted(bg,PC,function(){o()}),this.preExecute(_g,function(a){var s=a.context,c=s.shape,u=r();!c||c.labelTarget||(v(c,"bpmn:Lane")&&u.addLane(c),v(c,"bpmn:FlowNode")&&u.addFlowNode(c))})}sp.$inject=["eventBus","modeling"],ie(sp,X);function TC(){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 MC=500,kC=5e3,xg=["connection.create","connection.delete","connection.layout","connection.move","connection.reconnect","connection.updateWaypoints","shape.create","shape.delete","shape.move","shape.resize"],wg=[...xg,"elements.create","elements.delete","elements.move","label.create","spaceTool"];function cp(e,t){X.call(this,e);var n;function i(){return n=n||new DC,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(wg,kC,function(){i()}),this.postExecuted(wg,MC,function(){o()}),this.preExecute(xg,function(a){var s=a.context.connection||a.context.shape,c=r();!s||s.labelTarget||(v(s,"bpmn:FlowElement")&&c.addFlowElement(s),v(s,"bpmn:Group")&&c.addGroup(s))}),this.preExecute("label.create",function(a){var s=a.context.labelTarget;v(s,"bpmn:Group")&&r().addGroup(s)})}cp.$inject=["eventBus","modeling"],ie(cp,X);function DC(){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 up(e,t){X.call(this,e),this.postExecuted("elements.create",function(n){const i=n.context,r=i.elements;for(const o of r)OC(o)&&!IC(o)&&t.updateProperties(o,{isForCompensation:void 0})})}ie(up,X),up.$inject=["eventBus","modeling"];function OC(e){const t=Z(e);return t&&t.isForCompensation}function LC(e){return e&&v(e,"bpmn:BoundaryEvent")&&lo(e,"bpmn:CompensateEventDefinition")}function IC(e){return e.incoming.filter(n=>LC(n.source)).length>0}const NC={__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",yl],appendBehavior:["type",vl],associationBehavior:["type",bl],attachEventBehavior:["type",Is],artifactBehavior:["type",_l],boundaryEventBehavior:["type",xl],categoryRootElementReferenceBehavior:["type",wl],compensateBoundaryEventBehaviour:["type",El],createBehavior:["type",Sl],createDataObjectBehavior:["type",Rl],createParticipantBehavior:["type",Al],dataInputAssociationBehavior:["type",Tl],dataStoreBehavior:["type",Ml],deleteLaneBehavior:["type",kl],detachEventBehavior:["type",Vs],dropOnFlowBehavior:["type",Ol],eventBasedGatewayBehavior:["type",Ll],fixHoverBehavior:["type",Om],groupBehavior:["type",Il],importDockingFix:["type",Im],isHorizontalFix:["type",Bl],labelBehavior:["type",jl],layoutConnectionBehavior:["type",Fl],messageFlowBehavior:["type",Vl],nonInterruptingBehavior:["type",Gl],removeElementBehavior:["type",Ul],removeEmbeddedLabelBoundsBehavior:["type",Wl],removeParticipantBehavior:["type",Yl],replaceConnectionBehavior:["type",ql],replaceElementBehaviour:["type",Xs],resizeBehavior:["type",rg],resizeLaneBehavior:["type",lg],rootElementReferenceBehavior:["type",Ql],spaceToolBehavior:["type",fg],subProcessPlaneBehavior:["type",Oi],subProcessStartEventBehavior:["type",ep],textAnnotationBehavior:["type",tp],toggleCollapseConnectionBehaviour:["type",np],toggleElementCollapseBehaviour:["type",rp],unclaimIdBehavior:["type",op],unsetDefaultFlowBehavior:["type",ap],updateFlowNodeRefsBehavior:["type",sp],updateCategoryValueRefsBehavior:["type",cp],setCompensationActivityAfterPasteBehavior:["type",up]};function lp(e){this._commandStack=e.get("commandStack",!1)}lp.$inject=["injector"],lp.prototype.allowed=function(e,t){var n=!0,i=this._commandStack;return i&&(n=i.canExecute(e,t)),n===void 0?!0:n};const gi={__init__:["rules"],rules:["type",lp]};function Yn(e){X.call(this,e),this.init()}Yn.$inject=["eventBus"],ie(Yn,X),Yn.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)})},Yn.prototype.init=function(){};function Eg(e,t){var n=Zt(e,t,-15);return n!=="intersect"?n:null}function Jt(e){Yn.call(this,e)}ie(Jt,Yn),Jt.$inject=["eventBus"],Jt.prototype.init=function(){this.addRule("connection.start",function(e){var t=e.source;return BC(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 nc(t,n)}finally{r&&(n.parent=null)}}),this.addRule("connection.reconnect",function(e){var t=e.connection,n=e.source,i=e.target;return nc(n,i,t)}),this.addRule("connection.updateWaypoints",function(e){return{type:e.connection.type}}),this.addRule("shape.resize",function(e){var t=e.shape,n=e.newBounds,i=e.direction;return Ng(t,n,i)}),this.addRule("elements.create",function(e){var t=e.elements,n=e.position,i=e.target;return it(i)&&!ic(t,i)?!1:Rr(t,function(r){return it(r)?nc(r.source,r.target,r):r.host?da(r,r.host,null,n):hp(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 Mg(a)&&!n.includes(a.host)})?!1:da(n,t,null,i)||Lg(n,t,i)||Ig(n,t)||ic(n,t)}),this.addRule("shape.create",function(e){return hp(e.shape,e.target,e.source,e.position)}),this.addRule("shape.attach",function(e){return da(e.shape,e.target,null,e.position)}),this.addRule("element.copy",function(e){var t=e.element,n=e.elements;return Hg(n,t)})},Jt.prototype.canConnectMessageFlow=jg,Jt.prototype.canConnectSequenceFlow=Fg,Jt.prototype.canConnectDataAssociation=mp,Jt.prototype.canConnectAssociation=Bg,Jt.prototype.canConnectCompensationAssociation=$g,Jt.prototype.canMove=Ig,Jt.prototype.canAttach=da,Jt.prototype.canReplace=Lg,Jt.prototype.canDrop=xo,Jt.prototype.canInsert=ic,Jt.prototype.canCreate=hp,Jt.prototype.canConnect=nc,Jt.prototype.canResize=Ng,Jt.prototype.canCopy=Hg;function BC(e){return pp(e)?null:De(e,["bpmn:FlowNode","bpmn:InteractionNode","bpmn:DataObjectReference","bpmn:DataStoreReference","bpmn:Group","bpmn:TextAnnotation"])}function pp(e){return!e||Me(e)}function Sg(e){do{if(v(e,"bpmn:Process"))return Z(e);if(v(e,"bpmn:Participant"))return Z(e).processRef||Z(e)}while(e=e.parent)}function fp(e){return v(e,"bpmn:TextAnnotation")}function dp(e){return v(e,"bpmn:Group")&&!e.labelTarget}function Rg(e){return v(e,"bpmn:BoundaryEvent")&&yi(e,"bpmn:CompensateEventDefinition")}function tc(e){return Z(e).isForCompensation}function $C(e,t){var n=Sg(e),i=Sg(t);return n===i}function jC(e){return v(e,"bpmn:InteractionNode")&&!v(e,"bpmn:BoundaryEvent")&&(!v(e,"bpmn:Event")||v(e,"bpmn:ThrowEvent")&&Ag(e,"bpmn:MessageEventDefinition"))}function FC(e){return v(e,"bpmn:InteractionNode")&&!tc(e)&&(!v(e,"bpmn:Event")||v(e,"bpmn:CatchEvent")&&Ag(e,"bpmn:MessageEventDefinition"))&&!(v(e,"bpmn:BoundaryEvent")&&!yi(e,"bpmn:MessageEventDefinition"))}function Cg(e){for(var t=e;t=t.parent;){if(v(t,"bpmn:FlowElementsContainer"))return Z(t);if(v(t,"bpmn:Participant"))return Z(t).processRef}return null}function Pg(e,t){var n=Cg(e),i=Cg(t);return n===i}function yi(e,t){var n=Z(e);return!!st(n.eventDefinitions||[],function(i){return v(i,t)})}function Ag(e,t){var n=Z(e);return(n.eventDefinitions||[]).every(function(i){return v(i,t)})}function HC(e){return v(e,"bpmn:FlowNode")&&!v(e,"bpmn:EndEvent")&&!cn(e)&&!(v(e,"bpmn:IntermediateThrowEvent")&&yi(e,"bpmn:LinkEventDefinition"))&&!Rg(e)&&!tc(e)}function zC(e){return v(e,"bpmn:FlowNode")&&!v(e,"bpmn:StartEvent")&&!v(e,"bpmn:BoundaryEvent")&&!cn(e)&&!(v(e,"bpmn:IntermediateCatchEvent")&&yi(e,"bpmn:LinkEventDefinition"))&&!tc(e)}function VC(e){return v(e,"bpmn:ReceiveTask")||v(e,"bpmn:IntermediateCatchEvent")&&(yi(e,"bpmn:MessageEventDefinition")||yi(e,"bpmn:TimerEventDefinition")||yi(e,"bpmn:ConditionalEventDefinition")||yi(e,"bpmn:SignalEventDefinition"))}function GC(e){for(var t=[];e;)e=e.parent,e&&t.push(e);return t}function Tg(e,t){var n=GC(t);return n.indexOf(e)!==-1}function nc(e,t,n){if(pp(e)||pp(t))return null;if(!v(n,"bpmn:DataAssociation")){if(jg(e,t))return{type:"bpmn:MessageFlow"};if(Fg(e,t))return{type:"bpmn:SequenceFlow"}}var i=mp(e,t);return i||($g(e,t)?{type:"bpmn:Association",associationDirection:"One"}:Bg(e,t)?{type:"bpmn:Association",associationDirection:"None"}:!1)}function xo(e,t){return Me(e)||dp(e)?!0:v(t,"bpmn:Participant")&&!$e(t)?!1:v(e,"bpmn:Participant")?v(t,"bpmn:Process")||v(t,"bpmn:Collaboration"):De(e,["bpmn:DataInput","bpmn:DataOutput"])&&e.parent?t===e.parent:v(e,"bpmn:Lane")?v(t,"bpmn:Participant")||v(t,"bpmn:Lane"):v(e,"bpmn:BoundaryEvent")&&!WC(e)?!1:v(e,"bpmn:FlowElement")&&!v(e,"bpmn:DataStoreReference")?v(t,"bpmn:FlowElementsContainer")?$e(t):De(t,["bpmn:Participant","bpmn:Lane"]):v(e,"bpmn:DataStoreReference")&&v(t,"bpmn:Collaboration")?Vi(Z(t).get("participants"),function(n){return!!n.get("processRef")}):De(e,["bpmn:Artifact","bpmn:DataAssociation","bpmn:DataStoreReference"])?De(t,["bpmn:Collaboration","bpmn:Lane","bpmn:Participant","bpmn:Process","bpmn:SubProcess"]):v(e,"bpmn:MessageFlow")?v(t,"bpmn:Collaboration")||e.source.parent==t||e.target.parent==t:!1}function WC(e){return Z(e).cancelActivity&&(kg(e)||Dg(e))}function Mg(e){return!Me(e)&&v(e,"bpmn:BoundaryEvent")}function UC(e){return v(e,"bpmn:Lane")}function YC(e){return Mg(e)||v(e,"bpmn:IntermediateThrowEvent")&&kg(e)?!0:v(e,"bpmn:IntermediateCatchEvent")&&Dg(e)}function kg(e){var t=Z(e);return t&&!(t.eventDefinitions&&t.eventDefinitions.length)}function Dg(e){return Og(e,["bpmn:MessageEventDefinition","bpmn:TimerEventDefinition","bpmn:SignalEventDefinition","bpmn:ConditionalEventDefinition"])}function Og(e,t){return t.some(function(n){return yi(e,n)})}function qC(e){return v(e,"bpmn:ReceiveTask")&&st(e.incoming,function(t){return v(t.source,"bpmn:EventBasedGateway")})}function da(e,t,n,i){if(Array.isArray(e)||(e=[e]),e.length!==1)return!1;var r=e[0];return Me(r)||!YC(r)||cn(t)||!v(t,"bpmn:Activity")||tc(t)||i&&!Eg(i,t)||qC(t)?!1:"attach"}function Lg(e,t,n){if(!t)return!1;var i={replacements:[]};return k(e,function(r){cn(t)||v(r,"bpmn:StartEvent")&&r.type!=="label"&&xo(r,t)&&(iS(r)||i.replacements.push({oldElementId:r.id,newElementType:"bpmn:StartEvent"}),(rS(r)||oS(r)||aS(r))&&i.replacements.push({oldElementId:r.id,newElementType:"bpmn:StartEvent"}),Og(r,["bpmn:MessageEventDefinition","bpmn:TimerEventDefinition","bpmn:SignalEventDefinition","bpmn:ConditionalEventDefinition"])&&v(t,"bpmn:SubProcess")&&i.replacements.push({oldElementId:r.id,newElementType:"bpmn:StartEvent"})),v(t,"bpmn:Transaction")||yi(r,"bpmn:CancelEventDefinition")&&r.type!=="label"&&(v(r,"bpmn:EndEvent")&&xo(r,t)&&i.replacements.push({oldElementId:r.id,newElementType:"bpmn:EndEvent"}),v(r,"bpmn:BoundaryEvent")&&da(r,t,null,n)&&i.replacements.push({oldElementId:r.id,newElementType:"bpmn:BoundaryEvent"}))}),i.replacements.length?i:!1}function Ig(e,t){return Vi(e,UC)?!1:t===void 0?!0:t===null?!1:e.every(function(n){return xo(n,t)})}function hp(e,t,n,i){return t?Me(e)||dp(e)?!0:xo(e,t)||ic(e,t):!1}function Ng(e,t,n){return v(e,"bpmn:SubProcess")?$e(e)&&(!t||t.width>=100&&t.height>=80):v(e,"bpmn:Lane")||v(e,"bpmn:Participant")?!0:fp(e)?n?n==="e"||n==="w":!0:dp(e)?!0:Me(e)?n?n==="e"||n==="w":!0:!1}function KC(e,t){var n=fp(e),i=fp(t);return(n||i)&&n!==i}function Bg(e,t){return Tg(t,e)||Tg(e,t)?!1:KC(e,t)?!0:!!mp(e,t)}function $g(e,t){return Pg(e,t)&&Rg(e)&&v(t,"bpmn:Activity")&&!ZC(t,e)&&!cn(t)}function jg(e,t){return Vg(e)&&!Vg(t)?!1:jC(e)&&FC(t)&&!$C(e,t)}function Fg(e,t){return HC(e)&&zC(t)&&Pg(e,t)&&!(v(e,"bpmn:EventBasedGateway")&&!VC(t))}function mp(e,t){return De(e,["bpmn:DataObjectReference","bpmn:DataStoreReference"])&&De(t,["bpmn:Activity","bpmn:ThrowEvent"])?{type:"bpmn:DataInputAssociation"}:De(t,["bpmn:DataObjectReference","bpmn:DataStoreReference"])&&De(e,["bpmn:Activity","bpmn:CatchEvent"])?{type:"bpmn:DataOutputAssociation"}:!1}function ic(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:De(t,["bpmn:SequenceFlow","bpmn:MessageFlow"])&&!Me(t)&&v(e,"bpmn:FlowNode")&&!v(e,"bpmn:BoundaryEvent")&&xo(e,t.parent)}function gp(e,t){return e&&t&&e.indexOf(t)!==-1}function Hg(e,t){return Me(t)?!0:!(v(t,"bpmn:Lane")&&!gp(e,t.parent)||v(t,"bpmn:MessageFlow")&&!XC(e,t))}function XC(e,t){var n=zg(t.source),i=zg(t.target);return gp(e,n)&&gp(e,i)}function zg(e){for(;e;e=e.parent)if(v(e,"bpmn:Participant"))return e;return null}function Vg(e){return ho(e,"bpmn:Process")||ho(e,"bpmn:Collaboration")}function ZC(e,t){return e.attachers.includes(t)}const QC={__depends__:[gi],__init__:["bpmnRules"],bpmnRules:["type",Jt]};var JC=2e3;function Gg(e,t){e.on("saveXML.start",JC,n);function n(){var i=t.getRootElements();k(i,function(r){var o=Ve(r),a,s;a=Xo([r]),a=Oe(a,function(c){return c!==r&&!c.labelTarget}),s=rn(a,Ve),o.set("planeElement",s)})}}Gg.$inject=["eventBus","canvas"];const eP={__init__:["bpmnDiOrdering"],bpmnDiOrdering:["type",Gg]};function rc(e){X.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)})}rc.prototype.getOrdering=function(e,t){return null},ie(rc,X);function yp(e,t){rc.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=st(n,function(c){return De(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&&!De(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||v(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=Uf(s.children,function(p){return!a.labelTarget&&p.labelTarget?!1:c.level<r(p).level});return l!==-1&&u!==-1&&u<l&&(l-=1),{index:l,parent:s}}}yp.$inject=["eventBus","canvas"],ie(yp,rc);const tP={__init__:["bpmnOrderingProvider"],bpmnOrderingProvider:["type",yp]};function ha(){}ha.prototype.get=function(){return this._data},ha.prototype.set=function(e){this._data=e},ha.prototype.clear=function(){var e=this._data;return delete this._data,e},ha.prototype.isEmpty=function(){return!this._data};const nP={clipboard:["type",ha]};var Wg=1500;function Ug(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",Wg,function(s){o(s)})}),(function(){var a,s;t.on("element.hover",function(c){a=c.gfx,s=c.element}),t.on("element.hover",Wg,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=Br(a),c=document.elementFromPoint(s.x,s.y),iP(c)}}Ug.$inject=["elementRegistry","eventBus","injector"];function iP(e){return kr(e,"svg, .djs-element",!0)}const rP={__init__:["hoverFix"],hoverFix:["type",Ug]};function oP(e){return!0}function oc(e){return ar(e)||lC(e)}var Yg=500;function qg(e,t,n){var i=this;function r(A,F,z){if(!s(A,F)){var B,G,fe;z?G=t.getGraphics(z):(B=F.delegateTarget||F.target,B&&(G=B,z=t.get(G))),!(!G||!z)&&(fe=e.fire(A,{element:z,gfx:G,originalEvent:F}),fe===!1&&(F.stopPropagation(),F.preventDefault()))}}var o={};function a(A){return o[A]}function s(A,F){var z=u[A]||ar;return!z(F)}var c={click:"element.click",contextmenu:"element.contextmenu",dblclick:"element.dblclick",mousedown:"element.mousedown",mousemove:"element.mousemove",mouseover:"element.hover",mouseout:"element.out",mouseup:"element.mouseup"},u={"element.contextmenu":oP,"element.mousedown":oc,"element.mouseup":oc,"element.click":oc,"element.dblclick":oc};function l(A,F,z){var B=c[A];if(!B)throw new Error("unmapped DOM event name <"+A+">");return r(B,F,z)}var p="svg, .djs-element";function f(A,F,z,B){var G=o[z]=function(fe){r(z,fe)};B&&(u[z]=B),G.$delegate=Cn.bind(A,p,F,G)}function d(A,F,z){var B=a(z);B&&Cn.unbind(A,F,B.$delegate)}function h(A){k(c,function(F,z){f(A,z,F)})}function m(A){k(c,function(F,z){d(A,z,F)})}e.on("canvas.destroy",function(A){m(A.svg)}),e.on("canvas.init",function(A){h(A.svg)}),e.on(["shape.added","connection.added"],function(A){var F=A.element,z=A.gfx;e.fire("interactionEvents.createHit",{element:F,gfx:z})}),e.on(["shape.changed","connection.changed"],Yg,function(A){var F=A.element,z=A.gfx;e.fire("interactionEvents.updateHit",{element:F,gfx:z})}),e.on("interactionEvents.createHit",Yg,function(A){var F=A.element,z=A.gfx;i.createDefaultHit(F,z)}),e.on("interactionEvents.updateHit",function(A){var F=A.element,z=A.gfx;i.updateDefaultHit(F,z)});var g=E("djs-hit djs-hit-stroke"),R=E("djs-hit djs-hit-click-stroke"),w=E("djs-hit djs-hit-all"),b=E("djs-hit djs-hit-no-move"),x={all:w,"click-stroke":R,stroke:g,"no-move":b};function E(A,F){return F=O({stroke:"white",strokeWidth:15},F||{}),n.cls(A,["no-fill","no-border"],F)}function T(A,F){var z=x[F];if(!z)throw new Error("invalid hit type <"+F+">");return re(A,z),A}function L(A,F){Re(A,F)}this.removeHits=function(A){var F=gs(".djs-hit",A);k(F,Ft)},this.createDefaultHit=function(A,F){var z=A.waypoints,B=A.isFrame,G;return z?this.createWaypointsHit(F,z):(G=B?"stroke":"all",this.createBoxHit(F,G,{width:A.width,height:A.height}))},this.createWaypointsHit=function(A,F){var z=Ko(F);return T(z,"stroke"),L(A,z),z},this.createBoxHit=function(A,F,z){z=O({x:0,y:0},z);var B=me("rect");return T(B,F),re(B,z),L(A,B),B},this.updateDefaultHit=function(A,F){var z=et(".djs-hit",F);if(z)return A.waypoints?il(z,A.waypoints):re(z,{width:A.width,height:A.height}),z},this.fire=r,this.triggerMouseEvent=l,this.mouseHandler=a,this.registerEvent=f,this.unregisterEvent=d}qg.$inject=["eventBus","elementRegistry","styles"];const ac={__init__:["interactionEvents"],interactionEvents:["type",qg]};function wo(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)})}wo.$inject=["eventBus","canvas"],wo.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()})}},wo.prototype.get=function(){return Array.from(this._selectedElements)},wo.prototype.isSelected=function(e){return this._selectedElements.has(e)},wo.prototype.select=function(e,t){var n=this.get();_e(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?k(e,o=>{this._selectedElements.add(o)}):this._selectedElements=new Set(e),this._eventBus.fire("selection.changed",{oldSelection:n,newSelection:this.get()})};var Kg="hover",Xg="selected";function Zg(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,Kg)}),t.on("element.out",function(r){i(r.element,Kg)}),t.on("selection.changed",function(r){function o(u){i(u,Xg)}function a(u){n(u,Xg)}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)})}Zg.$inject=["canvas","eventBus"];function Qg(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;_e(u)?t.select(u):t.select(s.filter(aP))}}),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=st(o,function(c){return a.id===c.id});s||t.select(a)}),e.on("element.click",function(r){if(ar(r)){var o=r.element;o===n.getRootElement()&&(o=null);var a=t.isSelected(o),s=t.get().length>1,c=Js(r);if(a&&s)return c?t.deselect(o):t.select(o);a?t.deselect(o):t.select(o,c)}})}Qg.$inject=["eventBus","selection","canvas","elementRegistry"];function aP(e){return!e.hidden}const qn={__init__:["selectionVisuals","selectionBehavior"],__depends__:[ac],selection:["type",wo],selectionVisuals:["type",Zg],selectionBehavior:["type",Qg]};var sP=/^djs-cursor-.*$/;function sc(e){var t=mt(document.body);t.removeMatching(sP),e&&t.add("djs-cursor-"+e)}function Jg(){sc(null)}var cP=5e3;function ey(e,t){t=t||"element.click";function n(){return!1}return e.once(t,cP,n),function(){e.off(t,n)}}var uP=["c","C"],lP=["v","V"],pP=["d","D"],fP=["x","X"],dP=["y","Y"],ty=["z","Z"];function hP(e){return e.ctrlKey||e.metaKey||e.shiftKey||e.altKey}function Tn(e){return e.altKey?!1:e.ctrlKey||e.metaKey}function Ht(e,t){return e=_e(e)?e:[e],e.indexOf(t.key)!==-1||e.indexOf(t.code)!==-1}function vp(e){return e.shiftKey}function mP(e){return Tn(e)&&Ht(uP,e)}function gP(e){return Tn(e)&&Ht(lP,e)}function yP(e){return Tn(e)&&Ht(pP,e)}function vP(e){return Tn(e)&&Ht(fP,e)}function _P(e){return Tn(e)&&!vp(e)&&Ht(ty,e)}function bP(e){return Tn(e)&&(Ht(dP,e)||Ht(ty,e)&&vp(e))}var Eo=Math.round,ny="djs-drag-active";function jr(e){e.preventDefault()}function xP(e){return typeof TouchEvent<"u"&&e instanceof TouchEvent}function wP(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}function iy(e,t,n,i){var r={threshold:5,trapClick:!0},o;function a(b){var x=t.viewbox(),E=t._container.getBoundingClientRect();return{x:x.x+(b.x-E.left)/x.scale,y:x.y+(b.y-E.top)/x.scale}}function s(b,x){x=x||o;var E=e.createEvent(O({},x.payload,x.data,{isTouch:x.isTouch}));return e.fire("drag."+b,E)===!1?!1:e.fire(x.prefix+"."+b,E)}function c(b){var x=b.filter(function(E){return i.get(E.id)});x.length&&n.select(x)}function u(b,x){var E=o.payload,T=o.displacement,L=o.globalStart,A=Br(b),F=ii(A,L),z=o.localStart,B=a(A),G=ii(B,z);if(!o.active&&(x||wP(F)>o.threshold)){if(O(E,{x:Eo(z.x+T.x),y:Eo(z.y+T.y),dx:0,dy:0},{originalEvent:b}),s("start")===!1)return g();o.active=!0,o.keepSelection||(E.previousSelection=n.get(),n.select(null)),o.cursor&&sc(o.cursor),t.addMarker(t.getRootElement(),ny)}Zl(b),o.active&&(O(E,{x:Eo(B.x+T.x),y:Eo(B.y+T.y),dx:Eo(G.x),dy:Eo(G.y)},{originalEvent:b}),s("move"))}function l(b){var x,E=!0;o.active&&(b&&(o.payload.originalEvent=b,Zl(b)),E=s("end")),E===!1&&s("rejected"),x=R(E!==!0),s("ended",x)}function p(b){Ht("Escape",b)&&(jr(b),g())}function f(b){var x;o.active&&(x=ey(e),setTimeout(x,400),jr(b)),l(b)}function d(b){u(b)}function h(b){var x=o.payload;x.hoverGfx=b.gfx,x.hover=b.element,s("hover")}function m(b){s("out");var x=o.payload;x.hoverGfx=null,x.hover=null}function g(b){var x;if(o){var E=o.active;E&&s("cancel"),x=R(b),E&&s("canceled",x)}}function R(b){var x,E;s("cleanup"),Jg(),o.trapClick?E=f:E=l,Se.unbind(document,"mousemove",u),Se.unbind(document,"dragstart",jr),Se.unbind(document,"selectstart",jr),Se.unbind(document,"mousedown",E,!0),Se.unbind(document,"mouseup",E,!0),Se.unbind(document,"keyup",p),Se.unbind(document,"touchstart",d,!0),Se.unbind(document,"touchcancel",g,!0),Se.unbind(document,"touchmove",u,!0),Se.unbind(document,"touchend",l,!0),e.off("element.hover",h),e.off("element.out",m),t.removeMarker(t.getRootElement(),ny);var T=o.payload.previousSelection;return b!==!1&&T&&!n.get().length&&c(T),x=o,o=null,x}function w(b,x,E,T){o&&g(!1),typeof x=="string"&&(T=E,E=x,x=null),T=O({},r,T||{});var L=T.data||{},A,F,z,B,G;if(T.trapClick?B=f:B=l,b?(A=bo(b)||b,F=Br(b),Zl(b),A.type==="dragstart"&&jr(A)):(A=null,F={x:0,y:0}),z=a(F),x||(x=z),G=xP(A),o=O({prefix:E,data:L,payload:{},globalStart:F,displacement:ii(x,z),localStart:z,isTouch:G},T),T.manual||(G?(Se.bind(document,"touchstart",d,!0),Se.bind(document,"touchcancel",g,!0),Se.bind(document,"touchmove",u,!0),Se.bind(document,"touchend",l,!0)):(Se.bind(document,"mousemove",u),Se.bind(document,"dragstart",jr),Se.bind(document,"selectstart",jr),Se.bind(document,"mousedown",B,!0),Se.bind(document,"mouseup",B,!0)),Se.bind(document,"keyup",p),e.on("element.hover",h),e.on("element.out",m)),s("init")===!1)return g(),!1;T.autoActivate&&u(b,!0)}e.on("diagram.destroy",g),this.init=w,this.move=u,this.hover=h,this.out=m,this.end=l,this.cancel=g,this.context=function(){return o},this.setOptions=function(b){O(r,b)}}iy.$inject=["eventBus","canvas","selection","elementRegistry"];const Li={__depends__:[rP,qn],dragging:["type",iy]};function So(e){this._counter=0,this._prefix=(e?e+"-":"")+Math.floor(Math.random()*1e9)+"-"}So.prototype.next=function(){return this._prefix+ ++this._counter};const EP=new So("ps");var SP=["marker-start","marker-mid","marker-end"],RP=["circle","ellipse","line","path","polygon","polyline","path","rect"];function sr(e,t,n,i){this._elementRegistry=e,this._canvas=n,this._styles=i}sr.$inject=["elementRegistry","eventBus","canvas","styles"],sr.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")},sr.prototype.getGfx=function(e){return this._elementRegistry.getGraphics(e)},sr.prototype.addDragger=function(e,t,n,i="djs-dragger"){n=n||this.getGfx(e);var r=gh(n);return this._cloneMarkers(Lr(r),i),re(r,this._styles.cls(i,[])),Re(t,r),re(r,"data-preview-support-element-id",e.id),r},sr.prototype.addFrame=function(e,t){var n=me("rect",{class:"djs-resize-overlay",width:e.width,height:e.height,x:e.x,y:e.y});return Re(t,n),re(n,"data-preview-support-element-id",e.id),n},sr.prototype._cloneMarkers=function(e,t="djs-dragger",n=e){var i=this;e.childNodes&&e.childNodes.forEach(r=>{i._cloneMarkers(r,t,n)}),TP(e)&&SP.forEach(function(r){if(re(e,r)){var o=CP(e,r,i._canvas.getContainer());o&&i._cloneMarker(n,e,o,r,t)}})},sr.prototype._cloneMarker=function(e,t,n,i,r="djs-dragger"){var o=[n.id,r,EP.next()].join("-"),a=et("marker#"+n.id,e);e=e||this._canvas._svg;var s=a||gh(n);s.id=o,je(s).add(r);var c=et(":scope > defs",e);c||(c=me("defs"),Re(e,c)),Re(c,s);var u=AP(s.id);re(t,i,u)};function CP(e,t,n){var i=PP(re(e,t));return et("marker#"+i,n||document)}function PP(e){return e.match(/url\(['"]?#([^'"]*)['"]?\)/)[1]}function AP(e){return"url(#"+e+")"}function TP(e){return RP.indexOf(e.nodeName)!==-1}const Ro={__init__:["previewSupport"],previewSupport:["type",sr]};var MP="drop-ok",ry="drop-not-ok",oy="attach-ok",ay="new-parent",sy="create",kP=2e3;function cy(e,t,n,i,r){function o(c,u,l,p,f){if(!u)return!1;c=Oe(c,function(w){var b=w.labelTarget;return!w.parent&&!(Me(w)&&c.indexOf(b)!==-1)});var d=st(c,function(w){return!it(w)}),h=!1,m=!1,g=!1;ly(c)&&(h=r.allowed("shape.attach",{position:l,shape:d,target:u})),h||(ly(c)?g=r.allowed("shape.create",{position:l,shape:d,source:p,target:u}):g=r.allowed("elements.create",{elements:c,position:l,target:u}));var R=f.connectionTarget;return g||h?(d&&p&&(m=r.allowed("connection.create",{source:R===p?d:p,target:R===p?p:d,hints:{targetParent:u,targetAttach:h}})),{attach:h,connect:m}):g===null||h===null?null:!1}function a(c,u){[oy,MP,ry,ay].forEach(function(l){l===u?e.addMarker(c,l):e.removeMarker(c,l)})}n.on(["create.move","create.hover"],function(c){var u=c.context,l=u.elements,p=c.hover,f=u.source,d=u.hints||{};if(!p){u.canExecute=!1,u.target=null;return}uy(c);var h={x:c.x,y:c.y},m=u.canExecute=p&&o(l,p,h,f,d);p&&m!==null&&(u.target=p,m&&m.attach?a(p,oy):a(p,m?ay:ry))}),n.on(["create.end","create.out","create.cleanup"],function(c){var u=c.hover;u&&a(u,null)}),n.on("create.end",function(c){var u=c.context,l=u.source,p=u.shape,f=u.elements,d=u.target,h=u.canExecute,m=h&&h.attach,g=h&&h.connect,R=u.hints||{};if(h===!1||!d)return!1;uy(c);var w={x:c.x,y:c.y};g?p=i.appendShape(l,p,w,d,{attach:m,connection:g===!0?{}:g,connectionTarget:R.connectionTarget}):(f=i.createElements(f,w,d,O({},R,{attach:m})),p=st(f,function(b){return!it(b)})),O(u,{elements:f,shape:p}),O(c,{elements:f,shape:p})});function s(){var c=t.context();c&&c.prefix===sy&&t.cancel()}n.on("create.init",function(){n.on("elements.changed",s),n.once(["create.cancel","create.end"],kP,function(){n.off("elements.changed",s)})}),this.start=function(c,u,l){_e(u)||(u=[u]);var p=st(u,function(h){return!it(h)});if(p){l=O({elements:u,hints:{},shape:p},l||{}),k(u,function(h){we(h.x)||(h.x=0),we(h.y)||(h.y=0)});var f=Oe(u,function(h){return!h.hidden}),d=At(f);k(u,function(h){it(h)&&(h.waypoints=rn(h.waypoints,function(m){return{x:m.x-d.x-d.width/2,y:m.y-d.y-d.height/2}})),O(h,{x:h.x-d.x-d.width/2,y:h.y-d.y-d.height/2})}),t.init(c,sy,{cursor:"grabbing",autoActivate:!0,data:{shape:p,elements:u,context:l}})}}}cy.$inject=["canvas","dragging","eventBus","modeling","rules"];function uy(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 ly(e){return e&&e.length===1&&!it(e[0])}var DP=750;function py(e,t,n,i,r){function o(a){var s=me("g");re(s,r.cls("djs-drag-group",["no-events"]));var c=me("g");return a.forEach(function(u){var l;u.hidden||(u.waypoints?(l=n._createContainer("connection",c),n.drawConnection(Lr(l),u)):(l=n._createContainer("shape",c),n.drawShape(Lr(l),u),Qt(l,u.x,u.y)),i.addDragger(u,s,l))}),s}t.on("create.move",DP,function(a){var s=a.hover,c=a.context,u=c.elements,l=c.dragGroup;l||(l=c.dragGroup=o(u));var p;s?(l.parentNode||(p=e.getActiveLayer(),Re(p,l)),Qt(l,a.x,a.y)):Ft(l)}),t.on("create.cleanup",function(a){var s=a.context,c=s.dragGroup;c&&Ft(c)})}py.$inject=["canvas","eventBus","graphicsFactory","previewSupport","styles"];const cc={__depends__:[Li,Ro,gi,qn],__init__:["create","createPreview"],create:["type",cy],createPreview:["type",py]};function _p(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)})}_p.$inject=["eventBus"],_p.prototype.getLastMoveEvent=function(){return this._lastMoveEvent||OP(0,0)};function OP(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 ma={__init__:["mouse"],mouse:["type",_p]};var fy=2e3;function Mn(e,t,n,i,r,o,a,s){this._canvas=e,this._create=t,this._elementFactory=i,this._eventBus=r,this._modeling=o,this._mouse=a,this._rules=s,r.on("copyPaste.copyElement",function(c){var u=c.descriptor,l=c.element,p=c.elementsSet;u.priority=1,u.id=l.id,p.has(l.parent)&&(u.parent=l.parent.id),LP(l)&&(u.priority=2,u.host=l.host.id),it(l)&&(u.priority=3,u.source=l.source.id,u.target=l.target.id,u.waypoints=IP(l)),Me(l)&&(u.priority=4,u.labelTarget=l.labelTarget.id),k(["x","y","width","height"],function(f){we(l[f])&&(u[f]=l[f])}),u.hidden=l.hidden,u.collapsed=l.collapsed}),r.on("copyPaste.elementsCopied",fy,function(c){var u;((u=c.hints)==null?void 0:u.clip)!==!1&&n.set(c.tree)}),r.on("copyPaste.pasteElements",fy,function(c){c.tree||(c.tree=n.get())}),r.on("copyPaste.pasteElements",function(c){var u=c.hints;O(u,{createElementsBehavior:!1})})}Mn.$inject=["canvas","create","clipboard","elementFactory","eventBus","modeling","mouse","rules"],Mn.prototype.copy=function(e,t={}){var n,i;return _e(e)||(e=e?[e]:[]),n=this._eventBus.fire("copyPaste.canCopyElements",{elements:e}),n===!1?i={}:i=this.createTree(_e(n)?n:e),this._eventBus.fire("copyPaste.elementsCopied",{elements:e,tree:i,hints:t}),i},Mn.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})}}},Mn.prototype.duplicate=function(e,t={}){var n=this.copy(e,{clip:!1});return this.paste({...t,tree:n})},Mn.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},Mn.prototype._getElementIdsFromTree=function(e){var t={};return k(e,function(n){k(n,function(i){i.id&&(t[i.id]=!0)})}),t},Mn.prototype._paste=function(e,t,n,i){k(e,function(o){we(o.x)||(o.x=0),we(o.y)||(o.y=0)});var r=At(e);return k(e,function(o){it(o)&&(o.waypoints=rn(o.waypoints,function(a){return{x:a.x-r.x-r.width/2,y:a.y-r.y-r.height/2}})),O(o,{x:o.x-r.x-r.width/2,y:o.y-r.y-r.height/2})}),this._modeling.createElements(e,n,t,O({},i))},Mn.prototype._createElements=function(e){var t=this,n=this._eventBus,i={},r=[];return k(e,function(o,a){o=oi(o,"priority"),k(o,function(s){var c=O({},ai(s,["priority"]));i[s.parent]?c.parent=i[s.parent]:delete c.parent,n.fire("copyPaste.pasteElement",{cache:i,descriptor:c});var u;if(it(c)){c.source=i[s.source],c.target=i[s.target],u=i[s.id]=t.createConnection(c),r.push(u);return}if(Me(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},Mn.prototype.createConnection=function(e){var t=this._elementFactory.createConnection(ai(e,["id"]));return t},Mn.prototype.createLabel=function(e){var t=this._elementFactory.createLabel(ai(e,["id"]));return t},Mn.prototype.createShape=function(e){var t=this._elementFactory.createShape(ai(e,["id"]));return t},Mn.prototype.hasRelations=function(e,t,n){return n||(n=new Set(t)),!(it(e)&&(!n.has(e.source)||!n.has(e.target))||Me(e)&&!n.has(e.labelTarget))},Mn.prototype.createTree=function(e){var t=this._rules,n=this,i={},r=[],o=new Map,a=bs(e);function s(p,f){return t.allowed("element.copy",{element:p,elements:f})}function c(p,f){var d=o.get(p);if(!d){var h={element:p,depth:f};r.push(h),o.set(p,h);return}if(d.depth<f){r=u(d,r);var m={element:d.element,depth:f};r.push(m),o.set(p,m)}}function u(p,f){var d=f.indexOf(p);return d!==-1&&f.splice(d,1),f}Or(a,function(p,f,d){if(Me(p))return;k(p.labels,function(g){c(g,d)});function h(g){g&&g.length&&k(g,function(R){k(R.labels,function(w){c(w,d)}),c(R,d)})}k([p.attachers,p.incoming,p.outgoing],h),c(p,d);var m=[];return p.children&&(m=p.children.slice()),n._eventBus.fire("copyPaste.createTree",{element:p,children:m}),m}),e=rn(r,function(p){return p.element});var l=new Set(e);return r=rn(r,function(p){return p.descriptor={},n._eventBus.fire("copyPaste.copyElement",{descriptor:p.descriptor,element:p.element,elements:e,elementsSet:l}),p}),r=oi(r,function(p){return p.descriptor.priority}),e=rn(r,function(p){return p.element}),k(r,function(p){var f=p.depth;if(!n.hasRelations(p.element,e,l)){hy(p.element,e),l.delete(p.element);return}if(!s(p.element,e)){hy(p.element,e),l.delete(p.element);return}i[f]||(i[f]=[]),i[f].push(p.descriptor)}),i};function LP(e){return!!e.host}function IP(e){return rn(e.waypoints,function(t){return t=dy(t),t.original&&(t.original=dy(t.original)),t})}function dy(e){return O({},e)}function hy(e,t){var n=t.indexOf(e);return n===-1?t:t.splice(n,1)}const NP={__depends__:[nP,cc,ma,gi],__init__:["copyPaste"],copyPaste:["type",Mn]};function bp(e,t,n){_e(n)||(n=[n]),k(n,function(i){Sr(e[i])||(t[i]=e[i])})}var xp=750;function my(e,t,n){function i(c,u){var l=e.create(c.$type);return n.copyElement(c,l,null,u)}t.on("copyPaste.copyElement",xp,function(c){var u=c.descriptor,l=c.element,p=Z(l);if(Me(l))return u;var f=u.businessObject=i(p,!0),d=u.di=i(Ve(l),!0);d.bpmnElement=f,bp(f,u,"name"),bp(d,u,"isExpanded"),p.default&&(u.default=p.default.id)});var r="-bpmn-js-refs";function o(c){return c[r]=c[r]||{}}function a(c,u){c[r]=u}function s(c,u,l){var p=Z(c);return c.default&&(l[c.default]={element:p,property:"default"}),c.host&&(Z(c).attachedToRef=Z(u[c.host])),ai(l,Sn(l,function(f,d,h){var m=d.element,g=d.property;return h===c.id&&(m.set(g,p),f.push(c.id)),f},[]))}t.on("copyPaste.pasteElement",function(c){var u=c.cache,l=c.descriptor,p=l.businessObject,f=l.di;if(Me(l)){l.businessObject=Z(u[l.labelTarget]),l.di=Ve(u[l.labelTarget]);return}p=l.businessObject=i(p),f=l.di=i(f),f.bpmnElement=p,bp(l,p,["isExpanded","name"]),l.type=p.$type}),t.on("copyPaste.copyElement",xp,function(c){var u=c.descriptor,l=c.element;if(v(l,"bpmn:Participant")){var p=Z(l);p.processRef&&(u.processRef=i(p.processRef,!0))}}),t.on("copyPaste.pasteElement",function(c){var u=c.descriptor,l=u.processRef;l&&(u.processRef=i(l))}),t.on("copyPaste.createTree",function(c){var u=c.element,l=c.children;v(u,"bpmn:SubProcess")&&k(na(l),p=>{l.push(p.annotation)})}),t.on("copyPaste.pasteElement",xp,function(c){var u=c.cache,l=c.descriptor;a(u,s(l,u,o(u)))})}my.$inject=["bpmnFactory","eventBus","moddleCopy"];const BP=["artifacts","dataInputAssociations","dataOutputAssociations","default","flowElements","lanes","incoming","outgoing","categoryValue"],$P=["errorRef","escalationRef","messageRef","signalRef","dataObjectRef"];function ga(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 oi(r,o=>o==="extensionElements")}),e.on("moddleCopy.canCopyProperty",i=>{const{parent:r,property:o,propertyName:a}=i,s=Gt(r)&&r.$descriptor;if(a&&$P.includes(a))return o;if(a&&BP.includes(a)||a&&s&&!st(s.properties,Jr({name:a})))return!1}),e.on("moddleCopy.canSetCopiedProperty",i=>{const{property:r}=i;if(v(r,"bpmn:ExtensionElements")&&(!r.values||!r.values.length))return!1})}ga.$inject=["eventBus","bpmnFactory","moddle"],ga.prototype.copyElement=function(e,t,n,i=!1){n&&!_e(n)&&(n=[n]),n=n||wp(e.$descriptor);const r=this._eventBus.fire("moddleCopy.canCopyProperties",{propertyNames:n,sourceElement:e,targetElement:t,clone:i});return r===!1||(_e(r)&&(n=r),k(n,o=>{let a;En(e,o)&&(a=e.get(o));const s=this.copyProperty(a,t,o,i);!$t(s)||this._eventBus.fire("moddleCopy.canSetCopiedProperty",{parent:t,property:s,propertyName:o})===!1||t.set(o,s)})),t},ga.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 Gt(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):_e(e)?Sn(e,(a,s)=>{const c=this.copyProperty(s,t,n,i);return c?a.concat(c):a},[]):Gt(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},ga.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 wp(e,t){return Sn(e.properties,(n,i)=>t&&i.default?n:n.concat(i.name),[])}const gy={__depends__:[NP],__init__:["bpmnCopyPaste","moddleCopy"],bpmnCopyPaste:["type",my],moddleCopy:["type",ga]};var yy=Math.round;function Ep(e,t){this._modeling=e,this._eventBus=t}Ep.$inject=["modeling","eventBus"],Ep.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=yy(s+o/2),l=yy(c+a/2),p=i.replaceShape(e,O({},t,{x:u,y:l,width:o,height:a}),n);return r.fire("replace.end",{element:e,newElement:p,hints:n}),p};function vy(e,t){t.on("replace.end",500,function(n){const{newElement:i,hints:r={}}=n;r.select!==!1&&e.select(i)})}vy.$inject=["selection","eventBus"];const jP={__init__:["replace","replaceSelectionBehavior"],replaceSelectionBehavior:["type",vy],replace:["type",Ep]};function FP(e,t,n){_e(n)||(n=[n]),k(n,function(i){Sr(e[i])||(t[i]=e[i])})}var HP=["cancelActivity","instantiate","eventGatewayType","triggeredByEvent","isInterrupting"];function zP(e,t){var n=e&&En(e,"collapsed")?e.collapsed:!$e(e),i;return t&&(En(t,"collapsed")||En(t,"isExpanded"))?i=En(t,"collapsed")?t.collapsed:!t.isExpanded:i=n,n!==i}function _y(e,t,n,i,r,o){function a(s,c,u){u=u||{};var l=c.type,p=s.businessObject;if(uc(p)&&(l==="bpmn:SubProcess"||l==="bpmn:AdHocSubProcess")&&zP(s,c))return i.toggleCollapse(s),s;var f=e.create(l),d={type:l,businessObject:f};d.di={},l==="bpmn:ExclusiveGateway"&&(d.di.isMarkerVisible=!0),FP(s.di,d.di,["fill","stroke","background-color","border-color","color"]);var h=wp(p.$descriptor),m=wp(f.$descriptor,!0),g=VP(h,m);O(f,ni(c,HP));var R=Oe(g,function(x){return x==="eventDefinitions"?by(s,c.eventDefinitionType):x==="loopCharacteristics"?!cn(f):En(f,x)||x==="processRef"&&c.isExpanded===!1||x==="triggeredByEvent"?!1:x==="isForCompensation"?!cn(f):!0});if(f=n.copyElement(p,f,R),c.eventDefinitionType&&(by(f,c.eventDefinitionType)||(d.eventDefinitionType=c.eventDefinitionType,d.eventDefinitionAttrs=c.eventDefinitionAttrs)),v(p,"bpmn:Activity")){if(uc(p))d.isExpanded=$e(s);else if(c&&En(c,"isExpanded")){d.isExpanded=c.isExpanded;var w=t.getDefaultSize(f,{isExpanded:d.isExpanded});d.width=w.width,d.height=w.height,d.x=s.x-(d.width-s.width)/2,d.y=s.y-(d.height-s.height)/2}$e(s)&&!v(p,"bpmn:Task")&&d.isExpanded&&(d.width=s.width,d.height=s.height)}if(uc(p)&&!uc(f)&&(u.moveChildren=!1),v(p,"bpmn:Participant")){c.isExpanded===!0?f.processRef=e.create("bpmn:Process"):u.moveChildren=!1;var b=Yt(s);Ve(s).isHorizontal||(Ve(d).isHorizontal=b),d.width=b?s.width:t.getDefaultSize(d).width,d.height=b?t.getDefaultSize(d).height:s.height}return o.allowed("shape.resize",{shape:f})||(d.height=t.getDefaultSize(d).height,d.width=t.getDefaultSize(d).width),f.name=p.name,De(p,["bpmn:ExclusiveGateway","bpmn:InclusiveGateway","bpmn:Activity"])&&De(f,["bpmn:ExclusiveGateway","bpmn:InclusiveGateway","bpmn:Activity"])&&(f.default=p.default),c.host&&!v(p,"bpmn:BoundaryEvent")&&v(f,"bpmn:BoundaryEvent")&&(d.host=c.host),(d.type==="bpmn:DataStoreReference"||d.type==="bpmn:DataObjectReference")&&(d.x=s.x+(s.width-d.width)/2),r.replaceElement(s,d,{...u,targetElement:c})}this.replaceElement=a}_y.$inject=["bpmnFactory","elementFactory","moddleCopy","modeling","replace","rules"];function uc(e){return v(e,"bpmn:SubProcess")}function by(e,t){var n=Z(e);return t&&n.get("eventDefinitions").some(function(i){return v(i,t)})}function VP(e,t){return e.filter(function(n){return t.includes(n)})}const xy={__depends__:[gy,jP,qn],bpmnReplace:["type",_y]};var GP=250;function Fr(e){this._eventBus=e,this._tools=[],this._active=null}Fr.$inject=["eventBus"],Fr.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)},Fr.prototype.isActive=function(e){return e&&this._active===e},Fr.prototype.length=function(e){return this._tools.length},Fr.prototype.setActive=function(e){var t=this._eventBus;this._active!==e&&(this._active=e,t.fire("tool-manager.update",{tool:e}))},Fr.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),k(t,function(r){i.push(r+".ended"),i.push(r+".canceled")}),n.on(i,GP,function(r){this._active&&(WP(r)||this.setActive(null))},this)};function WP(e){var t=e.originalEvent&&e.originalEvent.target;return t&&kr(t,'.group[data-group="tools"]')}const lc={__depends__:[Li],__init__:["toolManager"],toolManager:["type",Fr]};function UP(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 YP(e,t){var n=[],i=new Set(e);k(t,function(o){i.add(o)});var r=new Set;return i.forEach(function(o){var a=o.incoming,s=o.outgoing;k(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 qP(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 Sp=Math.abs,KP=Math.round,Ii={x:"width",y:"height"},wy="crosshair",cr={n:"top",w:"left",s:"bottom",e:"right"},XP=1500,pc={n:"s",w:"e",s:"n",e:"w"},fc=20;function Kn(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",XP,function(c){var u=c.context,l=u.initialized;l||(l=u.initialized=s.init(c,u)),l&&Sy(c)}),n.on("spaceTool.end",function(c){var u=c.context,l=u.axis,p=u.direction,f=u.movingShapes,d=u.resizingShapes,h=u.start;if(u.initialized){Sy(c);var m={x:0,y:0};m[l]=KP(c["d"+l]),s.makeSpace(f,d,m,p,h),n.once("spaceTool.ended",function(g){s.activateSelection(g.originalEvent,!0,!0)})}})}Kn.$inject=["canvas","dragging","eventBus","modeling","rules","toolManager","mouse"],Kn.prototype.activateSelection=function(e,t,n){this._dragging.init(e,"spaceTool.selection",{autoActivate:t,cursor:wy,data:{context:{reactivate:n}},trapClick:!1})},Kn.prototype.activateMakeSpace=function(e){this._dragging.init(e,"spaceTool",{autoActivate:!0,cursor:wy,data:{context:{}}})},Kn.prototype.makeSpace=function(e,t,n,i,r){return this._modeling.createSpace(e,t,n,i,r)},Kn.prototype.init=function(e,t){var n=Sp(e.dx)>Sp(e.dy)?"x":"y",i=e["d"+n],r=e[n]-i;if(Sp(i)<5)return!1;i<0&&(i*=-1),fa(e)&&(i*=-1);var o=UP(n,i),a=this._canvas.getRootElement();!Js(e)&&e.hover&&(a=e.hover);var s=[...Xo(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=ZP(c,n,o,r,u);return O(t,c,{axis:n,direction:o,spaceToolConstraints:l,start:r}),sc("resize-"+(n==="x"?"ew":"ns")),!0},Kn.prototype.calculateAdjustments=function(e,t,n,i){var r=this._rules,o=[],a=[],s=new Set,c=new Set,u=[],l=[];function p(d){s.has(d)||(s.add(d),o.push(d));var h=d.label;h&&!s.has(h)&&(s.add(h),o.push(h))}function f(d){c.has(d)||(c.add(d),a.push(d))}return k(e,function(d){if(!(!d.parent||Me(d))){if(it(d)){l.push(d);return}var h=d[t],m=h+d[Ii[t]];if(QP(d)&&(n>0&&be(d)[t]>i||n<0&&be(d)[t]<i)){u.push(d);return}if(n>0&&h>i||n<0&&m<i){p(d);return}if(h<i&&m>i&&r.allowed("shape.resize",{shape:d})){f(d);return}}}),k(o,function(d){var h=d.attachers;h&&k(h,function(m){p(m)})}),k(u,function(d){var h=d.host;(s.has(h)||c.has(h))&&p(d)}),k(l,function(d){var h=d.source,m=d.target,g=d.label;(s.has(h)||c.has(h))&&(s.has(m)||c.has(m))&&g&&p(g)}),{movingShapes:o,resizingShapes:a}},Kn.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateSelection(e,!!e)},Kn.prototype.isActive=function(){var e=this._dragging.context();return e?/^spaceTool/.test(e.prefix):!1};function Ey(e){return{top:e.top-fc,right:e.right+fc,bottom:e.bottom+fc,left:e.left-fc}}function Sy(e){var t=e.context,n=t.spaceToolConstraints;if(n){var i,r;we(n.left)&&(i=Math.max(e.x,n.left),e.dx=e.dx+i-e.x,e.x=i),we(n.right)&&(i=Math.min(e.x,n.right),e.dx=e.dx+i-e.x,e.x=i),we(n.top)&&(r=Math.max(e.y,n.top),e.dy=e.dy+r-e.y,e.y=r),we(n.bottom)&&(r=Math.min(e.y,n.bottom),e.dy=e.dy+r-e.y,e.y=r)}}function ZP(e,t,n,i,r){var o=e.movingShapes,a=e.resizingShapes;if(a.length){var s={},c,u,l=new Set(o),p=new Set(a);return k(a,function(f){var d=f.attachers,h=f.children,m=ye(f),g=Oe(h,function(G){return!it(G)&&!Me(G)&&!l.has(G)&&!p.has(G)}),R=Oe(h,function(G){return!it(G)&&!Me(G)&&l.has(G)}),w,b,x,E=[],T=[],L,A,F,z;g.length&&(b=Ey(ye(At(g))),w=i-m[cr[n]]+b[cr[n]],n==="n"?s.bottom=u=we(u)?Math.min(u,w):w:n==="w"?s.right=u=we(u)?Math.min(u,w):w:n==="s"?s.top=c=we(c)?Math.max(c,w):w:n==="e"&&(s.left=c=we(c)?Math.max(c,w):w)),R.length&&(x=Ey(ye(At(R))),w=i-x[cr[pc[n]]]+m[cr[pc[n]]],n==="n"?s.bottom=u=we(u)?Math.min(u,w):w:n==="w"?s.right=u=we(u)?Math.min(u,w):w:n==="s"?s.top=c=we(c)?Math.max(c,w):w:n==="e"&&(s.left=c=we(c)?Math.max(c,w):w)),d&&d.length&&(d.forEach(function(G){l.has(G)?E.push(G):T.push(G)}),E.length&&(L=ye(At(E.map(be))),A=m[cr[pc[n]]]-(L[cr[pc[n]]]-i)),T.length&&(F=ye(At(T.map(be))),z=F[cr[n]]-(m[cr[n]]-i)),n==="n"?(w=Math.min(A||1/0,z||1/0),s.bottom=u=we(u)?Math.min(u,w):w):n==="w"?(w=Math.min(A||1/0,z||1/0),s.right=u=we(u)?Math.min(u,w):w):n==="s"?(w=Math.max(A||-1/0,z||-1/0),s.top=c=we(c)?Math.max(c,w):w):n==="e"&&(w=Math.max(A||-1/0,z||-1/0),s.left=c=we(c)?Math.max(c,w):w));var B=r&&r[f.id];B&&(n==="n"?(w=i+f[Ii[t]]-B[Ii[t]],s.bottom=u=we(u)?Math.min(u,w):w):n==="w"?(w=i+f[Ii[t]]-B[Ii[t]],s.right=u=we(u)?Math.min(u,w):w):n==="s"?(w=i-f[Ii[t]]+B[Ii[t]],s.top=c=we(c)?Math.max(c,w):w):n==="e"&&(w=i-f[Ii[t]]+B[Ii[t]],s.left=c=we(c)?Math.max(c,w):w))}),s}}function QP(e){return!!e.host}var Rp="djs-dragging",Ry="djs-resizing",JP=250,dc=Math.max;function Cy(e,t,n,i,r){function o(a,s){k(a,function(c){r.addDragger(c,s),n.addMarker(c,Rp)})}e.on("spaceTool.selection.start",function(a){var s=n.getLayer("space"),c=a.context,u={x:"M 0,-10000 L 0,10000",y:"M -10000,0 L 10000,0"},l=me("g");re(l,i.cls("djs-crosshair-group",["no-events"])),Re(s,l);var p=me("path");re(p,"d",u.x),je(p).add("djs-crosshair"),Re(l,p);var f=me("path");re(f,"d",u.y),je(f).add("djs-crosshair"),Re(l,f),c.crosshairGroup=l}),e.on("spaceTool.selection.move",function(a){var s=a.context.crosshairGroup;Qt(s,a.x,a.y)}),e.on("spaceTool.selection.cleanup",function(a){var s=a.context,c=s.crosshairGroup;c&&Ft(c)}),e.on("spaceTool.move",JP,function(a){var s=a.context,c=s.line,u=s.axis,l=s.movingShapes,p=s.resizingShapes;if(s.initialized){if(!s.dragGroup){var f=n.getLayer("space");c=me("path"),re(c,"d","M0,0 L0,0"),je(c).add("djs-crosshair"),Re(f,c),s.line=c;var d=me("g");re(d,i.cls("djs-drag-group",["no-events"])),Re(n.getActiveLayer(),d),o(l,d);var h=new Set(l);k(p,function(T){h.add(T)});var m=new Set,g=s.movingConnections=[];h.forEach(function(T){k(T.outgoing,function(L){m.has(L)||!it(L)||!h.has(L.target)||(m.add(L),g.push(L))})}),o(g,d),s.dragGroup=d}if(!s.frameGroup){var R=me("g");re(R,i.cls("djs-frame-group",["no-events"])),Re(n.getActiveLayer(),R);var w=[];k(p,function(T){var L=r.addFrame(T,R),A=L.getBBox();w.push({element:L,initialBounds:A}),n.addMarker(T,Ry)}),s.frameGroup=R,s.frames=w}var b={x:"M"+a.x+", -10000 L"+a.x+", 10000",y:"M -10000, "+a.y+" L 10000, "+a.y};re(c,{d:b[u]});var x={x:"y",y:"x"},E={x:a.dx,y:a.dy};E[x[s.axis]]=0,Qt(s.dragGroup,E.x,E.y),k(s.frames,function(T){var L=T.element,A=T.initialBounds,F,z;s.direction==="e"?re(L,{width:dc(A.width+E.x,5)}):(F=dc(A.width-E.x,5),re(L,{width:F,x:A.x+A.width-F})),s.direction==="s"?re(L,{height:dc(A.height+E.y,5)}):(z=dc(A.height-E.y,5),re(L,{height:z,y:A.y+A.height-z}))})}}),e.on("spaceTool.cleanup",function(a){var s=a.context,c=s.movingShapes,u=s.movingConnections,l=s.resizingShapes,p=s.line,f=s.dragGroup,d=s.frameGroup;k(c,function(h){n.removeMarker(h,Rp)}),k(u,function(h){n.removeMarker(h,Rp)}),f&&(Ft(p),Ft(f)),k(l,function(h){n.removeMarker(h,Ry)}),d&&Ft(d)})}Cy.$inject=["eventBus","elementRegistry","canvas","styles","previewSupport"];const eA={__init__:["spaceToolPreview"],__depends__:[Li,gi,lc,Ro,ma],spaceTool:["type",Kn],spaceToolPreview:["type",Cy]};function hc(e,t){e.invoke(Kn,this),this._canvas=t}hc.$inject=["injector","canvas"],ie(hc,Kn),hc.prototype.calculateAdjustments=function(e,t,n,i){var r=this._canvas.getRootElement(),o=e[0]===r?null:e[0],a=[];o&&(a=Zr(ao(r.children.filter(u=>v(u,"bpmn:Artifact")),At(o))));const s=[...e,...a];var c=Kn.prototype.calculateAdjustments.call(this,s,t,n,i);return c.resizingShapes=c.resizingShapes.filter(function(u){return!(v(u,"bpmn:TextAnnotation")||tA(u)&&(t==="y"&&Yt(u)||t==="x"&&!Yt(u)))}),c};function tA(e){return v(e,"bpmn:Participant")&&!Z(e).processRef}const Py={__depends__:[eA],spaceTool:["type",hc]};function vt(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)}vt.$inject=["eventBus","injector"],vt.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()},vt.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},vt.prototype.clear=function(e){this._stack.length=0,this._stackIdx=-1,e!==!1&&this._fire("changed",{trigger:"clear"})},vt.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()}},vt.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()}},vt.prototype.register=function(e,t){this._setHandler(e,t)},vt.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)},vt.prototype.canUndo=function(){return!!this._getUndoAction()},vt.prototype.canRedo=function(){return!!this._getRedoAction()},vt.prototype._getRedoAction=function(){return this._stack[this._stackIdx+1]},vt.prototype._getUndoAction=function(){return this._stack[this._stackIdx]},vt.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)})},vt.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},vt.prototype._createId=function(){return this._uid++},vt.prototype._atomicDo=function(e){const t=this._currentExecution;t.atomic=!0;try{e()}finally{t.atomic=!1}},vt.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()},vt.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)},vt.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:Yf("id",i.reverse())}),i.length=0,this._fire("changed",{trigger:t}),e.trigger=null)},vt.prototype._markDirty=function(e){const t=this._currentExecution;e&&(e=_e(e)?e:[e],t.dirty=t.dirty.concat(e))},vt.prototype._executedAction=function(e,t){const n=++this._stackIdx;t||this._stack.splice(n,this._stack.length,e)},vt.prototype._revertedAction=function(e){this._stackIdx--},vt.prototype._getHandler=function(e){return this._handlerMap[e]},vt.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 nA={commandStack:["type",vt]};function ur(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 iA=250,Ay=1400;function Cp(e,t,n){X.call(this,t);var i=e.get("movePreview",!1);t.on("shape.move.start",Ay,function(r){var o=r.context,a=o.shapes,s=o.validatedShapes;o.shapes=Ty(a),o.validatedShapes=Ty(s)}),i&&t.on("shape.move.start",iA,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",Ay,function(r){var o=r.context,a=o.closure,s=a.enclosedElements,c=[];k(s,function(u){k(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;ur(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=ol(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&&(St(s.labels,a,c),a.labelTarget=s)})}ie(Cp,X),Cp.$inject=["injector","eventBus","modeling"];function Ty(e){var t=new Set(e);return Oe(e,function(n){return!t.has(n.labelTarget)})}const rA={__init__:["labelSupport"],labelSupport:["type",Cp]};var oA=251,My=1401,ky="attach-ok";function Pp(e,t,n,i,r){X.call(this,t);var o=e.get("movePreview",!1);t.on("shape.move.start",My,function(a){var s=a.context,c=s.shapes,u=s.validatedShapes;s.shapes=aA(c),s.validatedShapes=sA(u)}),o&&t.on("shape.move.start",oA,function(a){var s=a.context,c=s.shapes,u=Ap(c);k(u,function(l){o.makeDraggable(s,l,!0),k(l.labels,function(p){o.makeDraggable(s,p,!0)})})}),o&&t.on("shape.move.start",function(a){var s=a.context,c=s.shapes;if(c.length===1){var u=c[0],l=u.host;l&&(n.addMarker(l,ky),t.once(["shape.move.out","shape.move.cleanup"],function(){n.removeMarker(l,ky)}))}}),this.preExecuted("elements.move",My,function(a){var s=a.context,c=s.closure,u=s.shapes,l=Ap(u);k(l,function(p){c.add(p,c.topLevel[p.host.id])})}),this.postExecuted("elements.move",function(a){var s=a.context,c=s.shapes,u=s.newHost,l;u&&c.length!==1||(u?l=c:l=Oe(c,function(p){var f=p.host;return cA(p)&&!uA(c,f)}),k(l,function(p){r.updateAttachment(p,u)}))}),this.postExecuted("elements.move",function(a){var s=a.context.shapes;k(s,function(c){k(c.attachers,function(u){k(u.outgoing.slice(),function(l){var p=i.allowed("connection.reconnect",{connection:l,source:l.source,target:l.target});p||r.removeConnection(l)}),k(u.incoming.slice(),function(l){var p=i.allowed("connection.reconnect",{connection:l,source:l.source,target:l.target});p||r.removeConnection(l)})})})}),this.postExecute("shape.create",function(a){var s=a.context,c=s.shape,u=s.host;u&&r.updateAttachment(c,u)}),this.postExecute("shape.replace",function(a){var s=a.context,c=s.oldShape,u=s.newShape;ur(c.attachers,function(l){var p=i.allowed("elements.move",{target:u,shapes:[l]});p==="attach"?r.updateAttachment(l,u):r.removeShape(l)}),u.attachers.length&&k(u.attachers,function(l){var p=Km(l,c,u);r.moveShape(l,p,l.parent)})}),this.postExecute("shape.resize",function(a){var s=a.context,c=s.shape,u=s.oldBounds,l=s.newBounds,p=c.attachers,f=s.hints||{};f.attachSupport!==!1&&k(p,function(d){var h=Km(d,u,l);r.moveShape(d,h,d.parent),k(d.labels,function(m){r.moveShape(m,h,m.parent)})})}),this.preExecute("shape.delete",function(a){var s=a.context.shape;ur(s.attachers,function(c){r.removeShape(c)}),s.host&&r.updateAttachment(s,null)})}ie(Pp,X),Pp.$inject=["injector","eventBus","canvas","rules","modeling"];function Ap(e){return Eu(rn(e,function(t){return t.attachers||[]}))}function aA(e){var t=Ap(e);return Xx("id",e,t)}function sA(e){var t=Qr(e,"id");return Oe(e,function(n){for(;n;){if(n.host&&t[n.host.id])return!1;n=n.parent}return!0})}function cA(e){return!!e.host}function uA(e,t){return e.indexOf(t)!==-1}const lA={__depends__:[gi],__init__:["attachSupport"],attachSupport:["type",Pp]};function Dy(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(Sh(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)})}Dy.$inject=["eventBus","canvas","elementRegistry","graphicsFactory"];const Tp={__init__:["changeSupport"],changeSupport:["type",Dy]};function Xn(e){this._model=e}Xn.$inject=["moddle"],Xn.prototype._needsId=function(e){return De(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"])},Xn.prototype._ensureId=function(e){if(e.id){this._model.ids.claim(e.id,e);return}var t;v(e,"bpmn:Activity")?t="Activity":v(e,"bpmn:Event")?t="Event":v(e,"bpmn:Gateway")?t="Gateway":De(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))},Xn.prototype.create=function(e,t){var n=this._model.create(e,t||{});return this._ensureId(n),n},Xn.prototype.createDiLabel=function(){return this.create("bpmndi:BPMNLabel",{bounds:this.createDiBounds()})},Xn.prototype.createDiShape=function(e,t){return this.create("bpmndi:BPMNShape",O({bpmnElement:e,bounds:this.createDiBounds()},t))},Xn.prototype.createDiBounds=function(e){return this.create("dc:Bounds",e)},Xn.prototype.createDiWaypoints=function(e){var t=this;return rn(e,function(n){return t.createDiWaypoint(n)})},Xn.prototype.createDiWaypoint=function(e){return this.create("dc:Point",ni(e,["x","y"]))},Xn.prototype.createDiEdge=function(e,t){return this.create("bpmndi:BPMNEdge",O({bpmnElement:e,waypoint:this.createDiWaypoints([])},t))},Xn.prototype.createDiPlane=function(e,t){return this.create("bpmndi:BPMNPlane",O({bpmnElement:e},t))};function kn(e,t,n){X.call(this,e),this._bpmnFactory=t;var i=this;function r(d){var h=d.context,m=h.hints||{},g;!h.cropped&&m.createElementsBehavior!==!1&&(g=h.connection,g.waypoints=n.getCroppedWaypoints(g),h.cropped=!0)}this.executed(["connection.layout","connection.create"],r),this.reverted(["connection.layout"],function(d){delete d.context.cropped});function o(d){var h=d.context;i.updateParent(h.shape||h.connection,h.oldParent)}function a(d){var h=d.context,m=h.shape||h.connection,g=h.parent||h.newParent;i.updateParent(m,g)}this.executed(["shape.move","shape.create","shape.delete","connection.create","connection.move","connection.delete"],Dn(o)),this.reverted(["shape.move","shape.create","shape.delete","connection.create","connection.move","connection.delete"],Dn(a));function s(d){var h=d.context,m=h.oldRoot,g=m.children;k(g,function(R){v(R,"bpmn:BaseElement")&&i.updateParent(R)})}this.executed(["canvas.updateRoot"],s),this.reverted(["canvas.updateRoot"],s);function c(d){var h=d.context.shape;v(h,"bpmn:BaseElement")&&i.updateBounds(h)}this.executed(["shape.move","shape.create","shape.resize"],Dn(function(d){d.context.shape.type!=="label"&&c(d)})),this.reverted(["shape.move","shape.create","shape.resize"],Dn(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"],Dn(u)),this.reverted(["connection.create","connection.move","connection.delete","connection.reconnect"],Dn(u));function l(d){i.updateConnectionWaypoints(d.context.connection)}this.executed(["connection.layout","connection.move","connection.updateWaypoints"],Dn(l)),this.reverted(["connection.layout","connection.move","connection.updateWaypoints"],Dn(l)),this.executed("connection.reconnect",Dn(function(d){var h=d.context,m=h.connection,g=h.oldSource,R=h.newSource,w=Z(m),b=Z(g),x=Z(R);w.conditionExpression&&!De(x,["bpmn:Activity","bpmn:ExclusiveGateway","bpmn:InclusiveGateway"])&&(h.oldConditionExpression=w.conditionExpression,delete w.conditionExpression),g!==R&&b.default===w&&(h.oldDefault=b.default,delete b.default)})),this.reverted("connection.reconnect",Dn(function(d){var h=d.context,m=h.connection,g=h.oldSource,R=h.newSource,w=Z(m),b=Z(g),x=Z(R);h.oldConditionExpression&&(w.conditionExpression=h.oldConditionExpression),h.oldDefault&&(b.default=h.oldDefault,delete x.default)}));function p(d){i.updateAttachment(d.context)}this.executed(["element.updateAttachment"],Dn(p)),this.reverted(["element.updateAttachment"],Dn(p)),this.executed("element.updateLabel",Dn(f)),this.reverted("element.updateLabel",Dn(f));function f(d){const{element:h}=d.context,m=jn(h),g=Ve(h),R=g&&g.get("label");nr(h)||ec(h)||(m&&!R?g.set("label",t.create("bpmndi:BPMNLabel")):!m&&R&&g.set("label",void 0))}}ie(kn,X),kn.$inject=["eventBus","bpmnFactory","connectionDocking"],kn.prototype.updateAttachment=function(e){var t=e.shape,n=t.businessObject,i=t.host;n.attachedToRef=i&&i.businessObject},kn.prototype.updateParent=function(e,t){if(!Me(e)&&!(v(e,"bpmn:DataStoreReference")&&e.parent&&v(e.parent,"bpmn:Collaboration"))){var n=e.parent,i=e.businessObject,r=Ve(e),o=n&&n.businessObject,a=Ve(n);v(e,"bpmn:FlowNode")&&this.updateFlowNodeRefs(i,o,t&&t.businessObject),v(e,"bpmn:DataOutputAssociation")&&(e.source?o=e.source.businessObject:o=null),v(e,"bpmn:DataInputAssociation")&&(e.target?o=e.target.businessObject:o=null),this.updateSemanticParent(i,o),v(e,"bpmn:DataObjectReference")&&i.dataObjectRef&&this.updateSemanticParent(i.dataObjectRef,o),this.updateDiParent(r,a)}},kn.prototype.updateBounds=function(e){var t=Ve(e),n=fA(e);if(n){var i=ii(n,t.get("bounds"));O(n,{x:e.x+i.x,y:e.y+i.y})}var r=Me(e)?this._getLabel(t):t,o=r.bounds;o||(o=this._bpmnFactory.createDiBounds(),r.set("bounds",o)),O(o,{x:e.x,y:e.y,width:e.width,height:e.height})},kn.prototype.updateFlowNodeRefs=function(e,t,n){if(n!==t){var i,r;v(n,"bpmn:Lane")&&(i=n.get("flowNodeRef"),wt(i,e)),v(t,"bpmn:Lane")&&(r=t.get("flowNodeRef"),St(r,e))}},kn.prototype.updateDiConnection=function(e,t,n){var i=Ve(e),r=Ve(t),o=Ve(n);i.sourceElement&&i.sourceElement.bpmnElement!==Z(t)&&(i.sourceElement=t&&r),i.targetElement&&i.targetElement.bpmnElement!==Z(n)&&(i.targetElement=n&&o)},kn.prototype.updateDiParent=function(e,t){if(t&&!v(t,"bpmndi:BPMNPlane")&&(t=t.$parent),e.$parent!==t){var n=(t||e.$parent).get("planeElement");t?(n.push(e),e.$parent=t):(wt(n,e),e.$parent=null)}};function pA(e){for(;e&&!v(e,"bpmn:Definitions");)e=e.$parent;return e}kn.prototype.getLaneSet=function(e){var t,n;return v(e,"bpmn:Lane")?(t=e.childLaneSet,t||(t=this._bpmnFactory.create("bpmn:LaneSet"),e.childLaneSet=t,t.$parent=e),t):(v(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)},kn.prototype.updateSemanticParent=function(e,t,n){var i;if(e.$parent!==t&&!((v(e,"bpmn:DataInput")||v(e,"bpmn:DataOutput"))&&(v(t,"bpmn:Participant")&&"processRef"in t&&(t=t.processRef),"ioSpecification"in t&&t.ioSpecification===e.$parent))){if(v(e,"bpmn:Lane"))t&&(t=this.getLaneSet(t)),i="lanes";else if(v(e,"bpmn:FlowElement")){if(t){if(v(t,"bpmn:Participant"))t=t.processRef;else if(v(t,"bpmn:Lane"))do t=t.$parent.$parent;while(v(t,"bpmn:Lane"))}i="flowElements"}else if(v(e,"bpmn:Artifact")){for(;t&&!v(t,"bpmn:Process")&&!v(t,"bpmn:SubProcess")&&!v(t,"bpmn:Collaboration");)if(v(t,"bpmn:Participant")){t=t.processRef;break}else t=t.$parent;i="artifacts"}else if(v(e,"bpmn:MessageFlow"))i="messageFlows";else if(v(e,"bpmn:Participant")){i="participants";var r=e.processRef,o;r&&(o=pA(e.$parent||t),e.$parent&&(wt(o.get("rootElements"),r),r.$parent=null),t&&(St(o.get("rootElements"),r),r.$parent=o))}else v(e,"bpmn:DataOutputAssociation")?i="dataOutputAssociations":v(e,"bpmn:DataInputAssociation")&&(i="dataInputAssociations");if(!i)throw new Error(`no parent for <${e.id}> in <${t.id}>`);var a;if(e.$parent&&(a=e.$parent.get(i),wt(a,e)),t?(a=t.get(i),a.push(e),e.$parent=t):e.$parent=null,n){var s=n.get(i);wt(a,e),t&&(s||(s=[],t.set(i,s)),s.push(e))}}},kn.prototype.updateConnectionWaypoints=function(e){var t=Ve(e);t.set("waypoint",this._bpmnFactory.createDiWaypoints(e.waypoints))},kn.prototype.updateConnection=function(e){var t=e.connection,n=Z(t),i=t.source,r=Z(i),o=t.target,a=Z(t.target),s;if(v(n,"bpmn:DataAssociation"))v(n,"bpmn:DataInputAssociation")?(n.get("sourceRef")[0]=r,s=e.parent||e.newParent||a,this.updateSemanticParent(n,a,s)):v(n,"bpmn:DataOutputAssociation")&&(s=e.parent||e.newParent||r,this.updateSemanticParent(n,r,s),n.targetRef=a);else{var c=v(n,"bpmn:SequenceFlow");n.sourceRef!==r&&(c&&(wt(n.sourceRef&&n.sourceRef.get("outgoing"),n),r&&r.get("outgoing")&&r.get("outgoing").push(n)),n.sourceRef=r),n.targetRef!==a&&(c&&(wt(n.targetRef&&n.targetRef.get("incoming"),n),a&&a.get("incoming")&&a.get("incoming").push(n)),n.targetRef=a)}this.updateConnectionWaypoints(t),this.updateDiConnection(t,i,o)},kn.prototype._getLabel=function(e){return e.label||(e.label=this._bpmnFactory.createDiLabel()),e.label};function Dn(e){return function(t){var n=t.context,i=n.shape||n.connection||n.element;v(i,"bpmn:BaseElement")&&e(t)}}function fA(e){if(v(e,"bpmn:Activity")){var t=Ve(e);if(t){var n=t.get("label");if(n)return n.get("bounds")}}}function lr(e,t){Mi.call(this),this._bpmnFactory=e,this._moddle=t}ie(lr,Mi),lr.$inject=["bpmnFactory","moddle"],lr.prototype._baseCreate=Mi.prototype.create,lr.prototype.create=function(e,t){if(e==="label"){var n=t.di||this._bpmnFactory.createDiLabel();return this._baseCreate(e,O({type:"label",di:n},Ir,t))}return this.createElement(e,t)},lr.prototype.createElement=function(e,t){t=O({},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(!hA(r)){var o=O({},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)}v(i,"bpmn:Group")&&(t=O({isFrame:!0},t)),t=dA(i,t,["processRef","isInterrupting","associationDirection","isForCompensation"]),t.isExpanded&&(t=Mp(r,t,"isExpanded")),De(i,["bpmn:Lane","bpmn:Participant"])&&(t=Mp(r,t,"isHorizontal")),v(i,"bpmn:SubProcess")&&(t.collapsed=!$e(i,r)),v(i,"bpmn:ExclusiveGateway")&&(En(r,"isMarkerVisible")?r.isMarkerVisible===void 0&&(r.isMarkerVisible=!1):r.isMarkerVisible=!0),$t(t.triggeredByEvent)&&(i.triggeredByEvent=t.triggeredByEvent,delete t.triggeredByEvent),$t(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=O({id:i.id},n,t,{businessObject:i,di:r}),this._baseCreate(e,t)},lr.prototype.getDefaultSize=function(e,t){var n=Z(e);if(t=t||Ve(e),v(n,"bpmn:SubProcess"))return $e(n,t)?{width:350,height:200}:{width:100,height:80};if(v(n,"bpmn:Task"))return{width:100,height:80};if(v(n,"bpmn:Gateway"))return{width:50,height:50};if(v(n,"bpmn:Event"))return{width:36,height:36};if(v(n,"bpmn:Participant")){var i=t.isHorizontal===void 0||t.isHorizontal===!0;return $e(n,t)?i?{width:600,height:250}:{width:250,height:600}:i?{width:400,height:60}:{width:60,height:400}}return v(n,"bpmn:Lane")?{width:400,height:100}:v(n,"bpmn:DataObjectReference")?{width:36,height:50}:v(n,"bpmn:DataStoreReference")?{width:50,height:50}:v(n,"bpmn:TextAnnotation")?{width:100,height:40}:v(n,"bpmn:Group")?{width:300,height:300}:{width:100,height:80}},lr.prototype.createParticipantShape=function(e){return Gt(e)||(e={isExpanded:e}),e=O({type:"bpmn:Participant"},e||{}),e.isExpanded!==!1&&(e.processRef=this._bpmnFactory.create("bpmn:Process")),this.createShape(e)};function dA(e,t,n){return k(n,function(i){t=Mp(e,t,i)}),t}function Mp(e,t,n){return t[n]===void 0?t:(e[n]=t[n],ai(t,[n]))}function hA(e){return De(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;k(n,function(r){var o={x:0,y:0};$t(i.left)?o.x=i.left-r.x:$t(i.right)?o.x=i.right-r.width-r.x:$t(i.center)?o.x=i.center-Math.round(r.width/2)-r.x:$t(i.top)?o.y=i.top-r.y:$t(i.bottom)?o.y=i.bottom-r.height-r.y:$t(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 gc(e){this._modeling=e}gc.$inject=["modeling"],gc.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},gc.prototype.postExecute=function(e){var t=e.hints||{};mA(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 mA(e,t){return Vi(e.outgoing,function(n){return n.target===t})}function yc(e,t){this._canvas=e,this._layouter=t}yc.$inject=["canvas","layouter"],yc.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},yc.prototype.revert=function(e){var t=e.connection;return this._canvas.removeConnection(t),t.source=null,t.target=null,t};var vc=Math.round;function kp(e){this._modeling=e}kp.$inject=["modeling"],kp.prototype.preExecute=function(e){var t=e.elements,n=e.parent,i=e.parentIndex,r=e.position,o=e.hints,a=this._modeling;k(t,function(p){we(p.x)||(p.x=0),we(p.y)||(p.y=0)});var s=Oe(t,function(p){return!p.hidden}),c=At(s);k(t,function(p){it(p)&&(p.waypoints=rn(p.waypoints,function(f){return{x:vc(f.x-c.x-c.width/2+r.x),y:vc(f.y-c.y-c.height/2+r.y)}})),O(p,{x:vc(p.x-c.x-c.width/2+r.x),y:vc(p.y-c.y-c.height/2+r.y)})});var u=new Set(bs(t)),l={};k(t,function(p){if(it(p)){l[p.id]=we(i)?a.createConnection(l[p.source.id],l[p.target.id],i,p,p.parent||n,o):a.createConnection(l[p.source.id],l[p.target.id],p,p.parent||n,o);return}var f=O({},o);u.has(p)||(f.autoResize=!1),Me(p)&&(f=ai(f,["attach"])),l[p.id]=we(i)?a.createShape(p,ni(p,["x","y","width","height"]),p.parent||n,i,f):a.createShape(p,ni(p,["x","y","width","height"]),p.parent||n,f)}),e.elements=Zr(l)};var Oy=Math.round;function pr(e){this._canvas=e}pr.$inject=["canvas"],pr.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?O(t,n):O(t,{x:n.x-Oy(t.width/2),y:n.y-Oy(t.height/2)}),this._canvas.addShape(t,i,r),t},pr.prototype.revert=function(e){var t=e.shape;return this._canvas.removeShape(t),t};function ya(e){pr.call(this,e)}ie(ya,pr),ya.$inject=["canvas"];var gA=pr.prototype.execute;ya.prototype.execute=function(e){var t=e.shape;return vA(t),t.labelTarget=e.labelTarget,gA.call(this,e)};var yA=pr.prototype.revert;ya.prototype.revert=function(e){return e.shape.labelTarget=null,yA.call(this,e)};function vA(e){["width","height"].forEach(function(t){typeof e[t]>"u"&&(e[t]=0)})}function va(e,t){this._canvas=e,this._modeling=t}va.$inject=["canvas","modeling"],va.prototype.preExecute=function(e){var t=this._modeling,n=e.connection;ur(n.incoming,function(i){t.removeConnection(i,{nested:!0})}),ur(n.outgoing,function(i){t.removeConnection(i,{nested:!0})})},va.prototype.execute=function(e){var t=e.connection,n=t.parent;return e.parent=n,e.parentIndex=ol(n.children,t),e.source=t.source,e.target=t.target,this._canvas.removeConnection(t),t.source=null,t.target=null,t},va.prototype.revert=function(e){var t=e.connection,n=e.parent,i=e.parentIndex;return t.source=e.source,t.target=e.target,St(n.children,t,i),this._canvas.addConnection(t,n),t};function Dp(e,t){this._modeling=e,this._elementRegistry=t}Dp.$inject=["modeling","elementRegistry"],Dp.prototype.postExecute=function(e){var t=this._modeling,n=this._elementRegistry,i=e.elements;k(i,function(r){n.get(r.id)&&(r.waypoints?t.removeConnection(r):t.removeShape(r))})};function _a(e,t){this._canvas=e,this._modeling=t}_a.$inject=["canvas","modeling"],_a.prototype.preExecute=function(e){var t=this._modeling,n=e.shape;ur(n.incoming,function(i){t.removeConnection(i,{nested:!0})}),ur(n.outgoing,function(i){t.removeConnection(i,{nested:!0})}),ur(n.children,function(i){it(i)?t.removeConnection(i,{nested:!0}):t.removeShape(i,{nested:!0})})},_a.prototype.execute=function(e){var t=this._canvas,n=e.shape,i=n.parent;return e.oldParent=i,e.oldParentIndex=ol(i.children,n),t.removeShape(n),n},_a.prototype.revert=function(e){var t=this._canvas,n=e.shape,i=e.oldParent,r=e.oldParentIndex;return St(i.children,n,r),t.addShape(n,i),n};function _c(e){this._modeling=e}_c.$inject=["modeling"];var Ly={x:"y",y:"x"};_c.prototype.preExecute=function(e){var t=this._modeling,n=e.groups,i=e.axis,r=e.dimension;function o(g,R){g.range.min=Math.min(R[i],g.range.min),g.range.max=Math.max(R[i]+R[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,R){var w={y:0};w[i]=g-a(R),w[i]&&(w[Ly[i]]=0,t.moveElements([R],w,R.parent))}var l=n[0],p=s(n),f=n[p],d,h,m=0;k(n,function(g,R){var w,b,x;if(g.elements.length<2){R&&R!==n.length-1&&(o(g,g.elements[0]),m+=c(g.range));return}w=oi(g.elements,i),b=w[0],R===p&&(b=w[s(w)]),x=a(b),g.range=null,k(w,function(E){if(u(x,E),g.range===null){g.range={min:E[i],max:E[i]+E[r]};return}o(g,E)}),R&&R!==n.length-1&&(m+=c(g.range))}),h=Math.abs(f.range.min-l.range.max),d=Math.round((h-m)/(n.length-1)),!(d<n.length-1)&&k(n,function(g,R){var w={},b;g===l||g===f||(b=n[R-1],g.range.max=0,k(g.elements,function(x,E){w[Ly[i]]=0,w[i]=b.range.max-x[i]+d,g.range.min!==x[i]&&(w[i]+=x[i]-g.range.min),w[i]&&t.moveElements([x],w,x.parent),g.range.max=Math.max(x[i]+x[r],E?g.range.max:0)}))})},_c.prototype.postExecute=function(e){};function bc(e,t){this._layouter=e,this._canvas=t}bc.$inject=["layouter","canvas"],bc.prototype.execute=function(e){var t=e.connection,n=t.waypoints;return O(e,{oldWaypoints:n}),t.waypoints=this._layouter.layoutConnection(t,e.hints),t},bc.prototype.revert=function(e){var t=e.connection;return t.waypoints=e.oldWaypoints,t};function Op(){}Op.prototype.execute=function(e){var t=e.connection,n=e.delta,i=e.newParent||t.parent,r=e.newParentIndex,o=t.parent;return e.oldParent=o,e.oldParentIndex=wt(o.children,t),St(i.children,t,r),t.parent=i,k(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},Op.prototype.revert=function(e){var t=e.connection,n=t.parent,i=e.oldParent,r=e.oldParentIndex,o=e.delta;return wt(n.children,t),St(i.children,t,r),t.parent=i,k(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 Lp(){this.allShapes={},this.allConnections={},this.enclosedElements={},this.enclosedConnections={},this.topLevel={}}Lp.prototype.add=function(e,t){return this.addAll([e],t)},Lp.prototype.addAll=function(e,t){var n=qE(e,!!t,this);return O(this,n),this};function ba(e){this._modeling=e}ba.prototype.moveRecursive=function(e,t,n){return e?this.moveClosure(this.getClosure(e),t,n):[]},ba.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),k(a,function(p){o.moveShape(p,t,u[p.id]&&!l&&n,{recurse:!1,layout:!1})}),k(s,function(p){var f=!!a[p.source.id],d=!!a[p.target.id];c[p.id]&&f&&d?o.moveConnection(p,t,u[p.id]&&!l&&n):o.layoutConnection(p,{connectionStart:f&&Hl(p,p.source,t),connectionEnd:d&&zl(p,p.target,t)})})},ba.prototype.getClosure=function(e){return new Lp().addAll(e,!0)};function xc(e){this._helper=new ba(e)}xc.$inject=["modeling"],xc.prototype.preExecute=function(e){e.closure=this._helper.getClosure(e.shapes)},xc.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 ba(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=ni(t,["x","y","width","height"]),e.oldParent=o,e.oldParentIndex=wt(o.children,t),St(i.children,t,r),O(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&&(k(t.incoming,function(o){r.layoutConnection(o,{connectionEnd:zl(o,t,n)})}),k(t.outgoing,function(o){r.layoutConnection(o,{connectionStart:Hl(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 St(n.children,t,i),O(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 xa(e){this._modeling=e}xa.$inject=["modeling"],xa.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 _e(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},xa.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||Iy(_e(r)?r[0]:r)),i&&(!n||o.docking==="target")&&(a.connectionEnd=a.connectionEnd||Iy(_e(r)?r[r.length-1]:r)),o.newWaypoints&&(a.waypoints=o.newWaypoints),this._modeling.layoutConnection(t,a))},xa.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 Iy(e){return e.original||e}function Ni(e,t){this._modeling=e,this._rules=t}Ni.$inject=["modeling","rules"],Ni.prototype.preExecute=function(e){var t=this,n=this._modeling,i=this._rules,r=e.oldShape,o=e.newData,a=e.hints||{},s;function c(h,m,g){return i.allowed("connection.reconnect",{connection:g,source:h,target:m})}var u={x:o.x,y:o.y},l={x:r.x,y:r.y,width:r.width,height:r.height};s=e.newShape=e.newShape||t.createShape(o,u,r.parent,a),r.host&&n.updateAttachment(s,r.host);var p;a.moveChildren!==!1&&(p=r.children.slice(),n.moveElements(p,{x:0,y:0},s,a));var f=r.incoming.slice(),d=r.outgoing.slice();k(f,function(h){var m=h.source,g=c(m,s,h);g&&t.reconnectEnd(h,s,qs(h,s,l),a)}),k(d,function(h){var m=h.target,g=c(s,m,h);g&&t.reconnectStart(h,s,Ys(h,s,l),a)})},Ni.prototype.postExecute=function(e){var t=e.oldShape;this._modeling.removeShape(t)},Ni.prototype.execute=function(e){},Ni.prototype.revert=function(e){},Ni.prototype.createShape=function(e,t,n,i){return this._modeling.createShape(e,t,n,i)},Ni.prototype.reconnectStart=function(e,t,n,i){this._modeling.reconnectStart(e,t,n,i)},Ni.prototype.reconnectEnd=function(e,t,n,i){this._modeling.reconnectEnd(e,t,n,i)};function wa(e){this._modeling=e}wa.$inject=["modeling"],wa.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},O(t,{width:n.width,height:n.height,x:n.x,y:n.y}),t},wa.prototype.postExecute=function(e){var t=this._modeling,n=e.shape,i=e.oldBounds,r=e.hints||{};r.layout!==!1&&(k(n.incoming,function(o){t.layoutConnection(o,{connectionEnd:qs(o,n,i)})}),k(n.outgoing,function(o){t.layoutConnection(o,{connectionStart:Ys(o,n,i)})}))},wa.prototype.revert=function(e){var t=e.shape,n=e.oldBounds;return O(t,{width:n.width,height:n.height,x:n.x,y:n.y}),t};function fr(e){this._modeling=e}fr.$inject=["modeling"],fr.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),k(r,function(s){a[s.id]=bA(s)}),this.resizeShapes(r,t,n),this.updateConnectionWaypoints(YP(i,r),t,n,o,i,r,a)},fr.prototype.execute=function(){},fr.prototype.revert=function(){},fr.prototype.moveShapes=function(e,t){var n=this;k(e,function(i){n._modeling.moveShape(i,t,null,{autoResize:!1,layout:!1,recurse:!1})})},fr.prototype.resizeShapes=function(e,t,n){var i=this;k(e,function(r){var o=qP(r,n,t);i._modeling.resizeShape(r,o,null,{attachSupport:!1,autoResize:!1,layout:!1})})},fr.prototype.updateConnectionWaypoints=function(e,t,n,i,r,o,a){var s=this,c=new Set(r),u=new Set(o);k(e,function(l){var p=l.source,f=l.target,d=_A(l),h=By(n),m={},g=c.has(p)||u.has(p),R=c.has(f)||u.has(f);g&&R?(d=rn(d,function(w){return $y(w,i,n)&&(w[h]=w[h]+t[h]),w.original&&$y(w.original,i,n)&&(w.original[h]=w.original[h]+t[h]),w}),s._modeling.updateWaypoints(l,d,{labelBehavior:!1})):(g||R)&&(c.has(p)?m.connectionStart=Hl(l,p,t):c.has(f)?m.connectionEnd=zl(l,f,t):u.has(p)?m.connectionStart=Ys(l,p,a[p.id]):u.has(f)&&(m.connectionEnd=qs(l,f,a[f.id])),s._modeling.layoutConnection(l,m))})};function Ny(e){return O({},e)}function _A(e){return rn(e.waypoints,function(t){return t=Ny(t),t.original&&(t.original=Ny(t.original)),t})}function By(e){switch(e){case"n":return"y";case"w":return"x";case"s":return"y";case"e":return"x"}}function $y(e,t,n){var i=By(n);if(/e|s/.test(n))return e[i]>t;if(/n|w/.test(n))return e[i]<t}function bA(e){return{x:e.x,y:e.y,height:e.height,width:e.width}}function wc(e){this._modeling=e}wc.$inject=["modeling"],wc.prototype.execute=function(e){var t=e.shape,n=t.children;e.oldChildrenVisibility=jy(n),t.collapsed=!t.collapsed;var i=Fy(n,t.collapsed);return[t].concat(i)},wc.prototype.revert=function(e){var t=e.shape,n=e.oldChildrenVisibility,i=t.children,r=Hy(i,n);return t.collapsed=!t.collapsed,[t].concat(r)};function jy(e){var t={};return k(e,function(n){t[n.id]=n.hidden,n.children&&(t=O({},t,jy(n.children)))}),t}function Fy(e,t){var n=[];return k(e,function(i){i.hidden=t,n=n.concat(i),i.children&&(n=n.concat(Fy(i.children,i.collapsed||t)))}),n}function Hy(e,t){var n=[];return k(e,function(i){i.hidden=t[i.id],n=n.concat(i),i.children&&(n=n.concat(Hy(i.children,t)))}),n}function Ec(e){this._modeling=e}Ec.$inject=["modeling"],Ec.prototype.execute=function(e){var t=e.shape,n=e.newHost,i=t.host;return e.oldHost=i,e.attacherIdx=zy(i,t),Vy(n,t),t.host=n,t},Ec.prototype.revert=function(e){var t=e.shape,n=e.newHost,i=e.oldHost,r=e.attacherIdx;return t.host=i,zy(n,t),Vy(i,t,r),t};function zy(e,t){return wt(e&&e.attachers,t)}function Vy(e,t,n){if(e){var i=e.attachers;i||(e.attachers=i=[]),St(i,t,n)}}function Ip(){}Ip.prototype.execute=function(e){var t=e.connection,n=e.newWaypoints;return e.oldWaypoints=t.waypoints,t.waypoints=n,t},Ip.prototype.revert=function(e){var t=e.connection,n=e.oldWaypoints;return t.waypoints=n,t};function rt(e,t,n){this._eventBus=e,this._elementFactory=t,this._commandStack=n;var i=this;e.on("diagram.init",function(){i.registerHandlers(n)})}rt.$inject=["eventBus","elementFactory","commandStack"],rt.prototype.getHandlers=function(){return{"shape.append":gc,"shape.create":pr,"shape.delete":_a,"shape.move":Hr,"shape.resize":wa,"shape.replace":Ni,"shape.toggleCollapse":wc,spaceTool:fr,"label.create":ya,"connection.create":yc,"connection.delete":va,"connection.move":Op,"connection.layout":bc,"connection.updateWaypoints":Ip,"connection.reconnect":xa,"elements.create":kp,"elements.move":xc,"elements.delete":Dp,"elements.distribute":_c,"elements.align":mc,"element.updateAttachment":Ec}},rt.prototype.registerHandlers=function(e){k(this.getHandlers(),function(t,n){e.registerHandler(n,t)})},rt.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)},rt.prototype.updateAttachment=function(e,t){var n={shape:e,newHost:t};this._commandStack.execute("element.updateAttachment",n)},rt.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)},rt.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)},rt.prototype.layoutConnection=function(e,t){var n={connection:e,hints:t||{}};this._commandStack.execute("connection.layout",n)},rt.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},rt.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},rt.prototype.createElements=function(e,t,n,i,r){_e(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},rt.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},rt.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},rt.prototype.removeElements=function(e){var t={elements:e};this._commandStack.execute("elements.delete",t)},rt.prototype.distributeElements=function(e,t,n){var i={groups:e,axis:t,dimension:n};this._commandStack.execute("elements.distribute",i)},rt.prototype.removeShape=function(e,t){var n={shape:e,hints:t||{}};this._commandStack.execute("shape.delete",n)},rt.prototype.removeConnection=function(e,t){var n={connection:e,hints:t||{}};this._commandStack.execute("connection.delete",n)},rt.prototype.replaceShape=function(e,t,n){var i={oldShape:e,newData:t,hints:n||{}};return this._commandStack.execute("shape.replace",i),i.newShape},rt.prototype.alignElements=function(e,t){var n={elements:e,alignment:t};this._commandStack.execute("elements.align",n)},rt.prototype.resizeShape=function(e,t,n,i){var r={shape:e,newBounds:t,minBounds:n,hints:i};this._commandStack.execute("shape.resize",r)},rt.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)},rt.prototype.updateWaypoints=function(e,t,n){var i={connection:e,newWaypoints:t,hints:n||{}};this._commandStack.execute("connection.updateWaypoints",i)},rt.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)},rt.prototype.reconnectStart=function(e,t,n,i){i||(i={}),this.reconnect(e,t,e.target,n,O(i,{docking:"source"}))},rt.prototype.reconnectEnd=function(e,t,n,i){i||(i={}),this.reconnect(e,e.source,t,n,O(i,{docking:"target"}))},rt.prototype.connect=function(e,t,n,i){return this.createConnection(e,t,n||{},e.parent,i)},rt.prototype._create=function(e,t){return O1(t)?t:this._elementFactory.create(e,t)},rt.prototype.toggleCollapse=function(e,t){var n={shape:e,hints:t||{}};this._commandStack.execute("shape.toggleCollapse",n)};function Ea(e){this._elementRegistry=e}Ea.$inject=["elementRegistry"],Ea.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||xA(n,Ka(i));return Gy(n,i),e.oldProperties=o,e.changed=r,r},Ea.prototype.revert=function(e){var t=e.oldProperties,n=e.moddleElement,i=e.changed;return Gy(n,t),i},Ea.prototype._getVisualReferences=function(e){var t=this._elementRegistry;return v(e,"bpmn:DataObject")?wA(e,t):[]};function xA(e,t){return Sn(t,function(n,i){return n[i]=e.get(i),n},{})}function Gy(e,t){k(t,function(n,i){e.set(i,n)})}function wA(e,t){return t.filter(function(n){return v(n,"bpmn:DataObjectReference")&&Z(n).dataObjectRef===e})}var Sa="default",Bi="id",Wy="di",EA={width:0,height:0};function Ra(e,t,n,i){this._elementRegistry=e,this._moddle=t,this._modeling=n,this._textRenderer=i}Ra.$inject=["elementRegistry","moddle","modeling","textRenderer"],Ra.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=AA(e.properties),s=e.oldProperties||SA(t,a);return Uy(a,o)&&(r.unclaim(o[Bi]),i.updateId(t,a[Bi]),r.claim(a[Bi],o)),Sa in a&&(a[Sa]&&n.push(i.get(a[Sa].id)),o[Sa]&&n.push(i.get(o[Sa].id))),Yy(t,a),e.oldProperties=s,e.changed=n,n},Ra.prototype.postExecute=function(e){var t=e.element,n=t.label,i=n&&Z(n).name;if(i){var r=this._textRenderer.getExternalLabelBounds(n,i);this._modeling.resizeShape(n,r,EA)}},Ra.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 Yy(t,i),Uy(n,r)&&(a.unclaim(n[Bi]),o.updateId(t,i[Bi]),a.claim(i[Bi],r)),e.changed};function Uy(e,t){return Bi in e&&e[Bi]!==t[Bi]}function SA(e,t){var n=Ka(t),i=e.businessObject,r=Ve(e);return Sn(n,function(o,a){return a!==Wy?o[a]=i.get(a):o[a]=RA(r,Ka(t.di)),o},{})}function RA(e,t){return Sn(t,function(n,i){return n[i]=e&&e.get(i),n},{})}function Yy(e,t){var n=e.businessObject,i=Ve(e);k(t,function(r,o){o!==Wy?n.set(o,r):i&&CA(i,r)})}function CA(e,t){k(t,function(n,i){e.set(i,n)})}var PA=["default"];function AA(e){var t=O({},e);return PA.forEach(function(n){n in e&&(t[n]=Z(t[n]))}),t}function Sc(e,t){this._canvas=e,this._modeling=t}Sc.$inject=["canvas","modeling"],Sc.prototype.execute=function(e){var t=this._canvas,n=e.newRoot,i=n.businessObject,r=t.getRootElement(),o=r.businessObject,a=o.$parent,s=Ve(r);return t.setRootElement(n),t.removeRootElement(r),St(a.rootElements,i),i.$parent=a,wt(a.rootElements,o),o.$parent=null,r.di=null,s.bpmnElement=i,n.di=s,e.oldRoot=r,[]},Sc.prototype.revert=function(e){var t=this._canvas,n=e.newRoot,i=n.businessObject,r=e.oldRoot,o=r.businessObject,a=i.$parent,s=Ve(n);return t.setRootElement(r),t.removeRootElement(n),wt(a.rootElements,i),i.$parent=null,St(a.rootElements,o),o.$parent=a,n.di=null,s.bpmnElement=o,r.di=s,[]};function Np(e,t){this._modeling=e,this._spaceTool=t}Np.$inject=["modeling","spaceTool"],Np.prototype.preExecute=function(e){var t=this._spaceTool,n=this._modeling,i=e.shape,r=e.location,o=Un(i),a=o===i,s=a?i:i.parent,c=rr(s),u=Yt(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+Wn,y:i.y,width:i.width-Wn,height:i.height}:{x:i.x,y:i.y+Wn,width:i.width,height:i.height-Wn};n.createShape({type:"bpmn:Lane",isHorizontal:u},l,s)}var p=[];Or(o,function(x){return p.push(x),x.label&&p.push(x.label),x===i?[]:Oe(x.children,function(E){return E!==i})});var f,d,h,m,g;r==="top"?(f=-120,d=i.y,h=d+10,m="n",g="y"):r==="left"?(f=-120,d=i.x,h=d+10,m="w",g="x"):r==="bottom"?(f=120,d=i.y+i.height,h=d-10,m="s",g="y"):r==="right"&&(f=120,d=i.x+i.width,h=d-10,m="e",g="x");var R=t.calculateAdjustments(p,g,f,h),w=u?{x:0,y:f}:{x:f,y:0};t.makeSpace(R.movingShapes,R.resizingShapes,w,m,h);var b=u?{x:i.x+(a?Wn:0),y:d-(r==="top"?120:0),width:i.width-(a?Wn:0),height:120}:{x:d-(r==="left"?120:0),y:i.y+(a?Wn:0),width:120,height:i.height-(a?Wn:0)};e.newLane=n.createShape({type:"bpmn:Lane",isHorizontal:u},b,s)};function Bp(e){this._modeling=e}Bp.$inject=["modeling"],Bp.prototype.preExecute=function(e){var t=this._modeling,n=e.shape,i=e.count,r=rr(n),o=r.length;if(o>i)throw new Error(`more than <${i}> child lanes`);var a=Yt(n),s=a?n.height:n.width,c=Math.round(s/i),u,l,p,f;for(f=0;f<i;f++)f===i-1?u=s-c*f:u=c,l=a?{x:n.x+Wn,y:n.y+f*c,width:n.width-Wn,height:u}:{x:n.x+f*c,y:n.y+Wn,width:u,height:n.height-Wn},f<o?t.resizeShape(r[f],l):(p={type:"bpmn:Lane",isHorizontal:a},t.createShape(p,l,n))};function Ca(e,t){this._modeling=e,this._spaceTool=t}Ca.$inject=["modeling","spaceTool"],Ca.prototype.preExecute=function(e){var t=e.shape,n=e.newBounds,i=e.balanced;i!==!1?this.resizeBalanced(t,n):this.resizeSpace(t,n)},Ca.prototype.resizeBalanced=function(e,t){var n=this._modeling,i=wR(e,t);n.resizeShape(e,t),i.forEach(function(r){n.resizeShape(r.shape,r.newBounds)})},Ca.prototype.resizeSpace=function(e,t){var n=this._spaceTool,i=ye(e),r=ye(t),o=Rm(r,i),a=Un(e),s=[],c=[];Or(a,function(h){return s.push(h),(v(h,"bpmn:Lane")||v(h,"bpmn:Participant"))&&c.push(h),h.children});var u,l,p,f,d;(o.bottom||o.top)&&(u=o.bottom||o.top,l=e.y+(o.bottom?e.height:0)+(o.bottom?-10:10),p=o.bottom?"s":"n",f=o.top>0||o.bottom<0?-u:u,d=n.calculateAdjustments(s,"y",f,l),n.makeSpace(d.movingShapes,d.resizingShapes,{x:0,y:u},p)),(o.left||o.right)&&(u=o.right||o.left,l=e.x+(o.right?e.width:0)+(o.right?-10:100),p=o.right?"e":"w",f=o.left>0||o.right<0?-u:u,d=n.calculateAdjustments(c,"x",f,l),n.makeSpace(d.movingShapes,d.resizingShapes,{x:u,y:0},p))};var Pa="flowNodeRef",$p="lanes";function Rc(){}Rc.prototype._computeUpdates=function(e,t){var n=[],i=[],r={},o=[];function a(l,p){var f=ye(p),d={x:l.x+l.width/2,y:l.y+l.height/2};return d.x>f.left&&d.x<f.right&&d.y>f.top&&d.y<f.bottom}function s(l){n.indexOf(l)===-1&&(o.push(l),n.push(l))}function c(l){var p=Un(l);return r[p.id]||(r[p.id]=zs(p)),r[p.id]}function u(l){if(!l.parent)return[];var p=c(l);return p.filter(function(f){return a(l,f)}).map(function(f){return f.businessObject})}return t.forEach(function(l){var p=Un(l);if(!(!p||n.indexOf(p)!==-1)){var f=p.children.filter(function(d){return v(d,"bpmn:FlowNode")});f.forEach(s),n.push(p)}}),e.forEach(s),o.forEach(function(l){var p=l.businessObject,f=p.get($p),d=f.slice(),h=u(l);i.push({flowNode:p,remove:d,add:h})}),t.forEach(function(l){var p=l.businessObject;l.parent||p.get(Pa).forEach(function(f){i.push({flowNode:f,remove:[p],add:[]})})}),i},Rc.prototype.execute=function(e){var t=e.updates;return t||(t=e.updates=this._computeUpdates(e.flowNodeShapes,e.laneShapes)),t.forEach(function(n){var i=n.flowNode,r=i.get($p);n.remove.forEach(function(o){wt(r,o),wt(o.get(Pa),i)}),n.add.forEach(function(o){St(r,o),St(o.get(Pa),i)})}),[]},Rc.prototype.revert=function(e){var t=e.updates;return t.forEach(function(n){var i=n.flowNode,r=i.get($p);n.add.forEach(function(o){wt(r,o),wt(o.get(Pa),i)}),n.remove.forEach(function(o){St(r,o),St(o.get(Pa),i)})}),[]};var jp="categoryValueRef";function Aa(e,t){this._bpmnFactory=e,this._elementRegistry=t}Aa.$inject=["bpmnFactory","elementRegistry"],Aa.prototype._computeUpdates=function(e,t){var n=this._elementRegistry,i=this._bpmnFactory,r=new Map,o=[],a=new Map;function s(w,b,x){if(b){var E=a.get(w);E||(E={},a.set(w,E)),!(x&&E.present)&&(!x&&E.past||(x?E.present={categoryValue:b,root:Fp(w)}:E.past={categoryValue:b}))}}function c(w){r.set(w,Z(w))}function u(){n.filter(function(w){return v(w,"bpmn:FlowElement")&&!Me(w)&&w.parent}).forEach(c)}function l(w){var b=Z(w),x=b.get("categoryValueRef");return x||(x=bm(i,b),o.push(TA(w,x))),x}function p(w){return w.reduce(function(b,x){var E=Fp(x),T=b.get(E);return T||(T=[],b.set(E,T)),T.push(x),b},new Map)}e=Array.from(e||[]);var f=p(e);t.length&&u(),e.forEach(c),n.filter(function(w){return v(w,"bpmn:Group")&&!Me(w)&&w.parent}).forEach(function(w){var b=Z(w).get("categoryValueRef");if(!b){var x=Fp(w),E=f.get(x)||[],T=ao(E,w),L=Object.keys(T).length>0;L&&(b=l(w))}s(w,b,!0)}),t.forEach(function(w){s(w.groupShape,w.categoryValue,!1)}),o.length&&u();var d=Array.from(r.keys()),h=Array.from(a.values()).reduce(function(w,b){return b.present&&w.add(b.present.categoryValue),b.past&&w.add(b.past.categoryValue),w},new Set),m=new Map,g=p(d);a.forEach(function(w,b){var x=w.present;if(x){var E=g.get(x.root)||[],T=ao(E,b);E.forEach(function(L){if(T[L.id]){var A=m.get(L);A||(A=new Set,m.set(L,A)),A.add(x.categoryValue)}})}});var R=d.reduce(function(w,b){var x=r.get(b),E=x.get(jp),T=new Set(E),L=m.get(b)||new Set,A=Array.from(L).filter(function(z){return!T.has(z)}),F=E.filter(function(z){return h.has(z)&&!L.has(z)});return(A.length||F.length)&&w.push({businessObject:x,categoryValuesToAdd:A,categoryValuesToRemove:F}),w},[]);return{flowElements:R,groups:o}},Aa.prototype.execute=function(e){var t=e.updates;return t||(t=e.updates=this._computeUpdates(e.affectedFlowElements,e.affectedGroupEntries)),MA(t.groups),DA(t.flowElements),[]},Aa.prototype.revert=function(e){var t=e.updates;return OA(t.flowElements),kA(t.groups),[]};function TA(e,t){return{groupShape:e,categoryValue:t,category:t.$parent}}function MA(e){e.forEach(function(t){Z(t.groupShape).categoryValueRef=t.categoryValue,t.categoryValue.$parent=t.category})}function kA(e){e.forEach(function(t){Z(t.groupShape).categoryValueRef=null})}function DA(e){e.forEach(function(t){var n=t.businessObject,i=n.get(jp);t.categoryValuesToRemove.forEach(function(r){wt(i,r)}),t.categoryValuesToAdd.forEach(function(r){St(i,r,!0)})})}function OA(e){e.forEach(function(t){var n=t.businessObject,i=n.get(jp);t.categoryValuesToAdd.forEach(function(r){wt(i,r)}),t.categoryValuesToRemove.forEach(function(r){St(i,r,!0)})})}function Fp(e){for(;e.parent;)e=e.parent;return e}function Cc(e){this._moddle=e}Cc.$inject=["moddle"],Cc.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),[]},Cc.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 LA={fill:void 0,stroke:void 0};function Hp(e){this._commandStack=e,this._normalizeColor=function(t){if(t){if(wn(t)){var n=IA(t);if(n)return n}throw new Error(`invalid color value: ${t}`)}}}Hp.$inject=["commandStack"],Hp.prototype.postExecute=function(e){var t=e.elements,n=e.colors||LA,i=this,r={};"fill"in n&&O(r,{"background-color":this._normalizeColor(n.fill)}),"stroke"in n&&O(r,{"border-color":this._normalizeColor(n.stroke)}),k(t,function(o){var a=it(o)?ni(r,["border-color"]):r,s=Ve(o);if(NA(a),Me(o)){if(!s||!v(s.label,"bpmndi:BPMNLabel"))return;i._commandStack.execute("element.updateModdleProperties",{element:o,moddleElement:s.label,properties:{color:r["border-color"]}})}else{if(!De(s,["bpmndi:BPMNEdge","bpmndi:BPMNShape"]))return;i._commandStack.execute("element.updateProperties",{element:o,properties:{di:a}})}})};function IA(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 NA(e){"border-color"in e&&(e.stroke=e["border-color"]),"background-color"in e&&(e.fill=e["background-color"])}var BA={width:0,height:0};function qy(e,t,n){function i(c,u){var l=c.label||c,p=c.labelTarget||c;return pS(l,u),[l,p]}function r(c){var u=c.element,l=u.businessObject,p=c.newLabel;if(!Me(u)&&nr(u)&&!Ts(u)&&!Ky(p)){var f=7,d=pl(u);d={x:d.x,y:d.y+f},e.createLabel(u,d,{id:l.id+"_label",businessObject:l,di:u.di})}}function o(c){return c.oldLabel=jn(c.element),i(c.element,c.newLabel)}function a(c){return i(c.element,c.oldLabel)}function s(c){var u=c.element,l=u.label||u,p=c.newLabel,f=c.newBounds,d=c.hints||{};if(!(!Me(l)&&!v(l,"bpmn:TextAnnotation"))){if(Me(l)&&Ky(p)){d.removeShape!==!1&&e.removeShape(l,{unsetLabel:!1});return}var h=jn(u);typeof f>"u"&&(f=t.getExternalLabelBounds(l,h)),f&&e.resizeShape(l,f,BA)}}this.preExecute=r,this.execute=o,this.revert=a,this.postExecute=s}qy.$inject=["modeling","textRenderer","bpmnFactory"];function Ky(e){return!e||!e.trim()}function en(e,t,n,i){rt.call(this,e,t,n),this._bpmnRules=i}ie(en,rt),en.$inject=["eventBus","elementFactory","commandStack","bpmnRules"],en.prototype.getHandlers=function(){var e=rt.prototype.getHandlers.call(this);return e["element.updateModdleProperties"]=Ea,e["element.updateProperties"]=Ra,e["canvas.updateRoot"]=Sc,e["lane.add"]=Np,e["lane.resize"]=Ca,e["lane.split"]=Bp,e["lane.updateRefs"]=Rc,e["group.updateRefs"]=Aa,e["id.updateClaim"]=Cc,e["element.setColor"]=Hp,e["element.updateLabel"]=qy,e},en.prototype.updateLabel=function(e,t,n,i){this._commandStack.execute("element.updateLabel",{element:e,newLabel:t,newBounds:n,hints:i||{}})},en.prototype.connect=function(e,t,n,i){var r=this._bpmnRules;if(n||(n=r.canConnect(e,t)),!!n)return this.createConnection(e,t,n,e.parent,i)},en.prototype.updateModdleProperties=function(e,t,n){this._commandStack.execute("element.updateModdleProperties",{element:e,moddleElement:t,properties:n})},en.prototype.updateProperties=function(e,t){this._commandStack.execute("element.updateProperties",{element:e,properties:t})},en.prototype.resizeLane=function(e,t,n){this._commandStack.execute("lane.resize",{shape:e,newBounds:t,balanced:n})},en.prototype.addLane=function(e,t){var n={shape:e,location:t};return this._commandStack.execute("lane.add",n),n.newLane},en.prototype.splitLane=function(e,t){this._commandStack.execute("lane.split",{shape:e,count:t})},en.prototype.makeCollaboration=function(){var e=this._create("root",{type:"bpmn:Collaboration"}),t={newRoot:e};return this._commandStack.execute("canvas.updateRoot",t),e},en.prototype.makeProcess=function(){var e=this._create("root",{type:"bpmn:Process"}),t={newRoot:e};return this._commandStack.execute("canvas.updateRoot",t),e},en.prototype.updateLaneRefs=function(e,t){this._commandStack.execute("lane.updateRefs",{flowNodeShapes:e,laneShapes:t})},en.prototype.updateCategoryValueRefs=function(e,t){this._commandStack.execute("group.updateRefs",{affectedFlowElements:e,affectedGroupEntries:t})},en.prototype.claimId=function(e,t){this._commandStack.execute("id.updateClaim",{id:e,element:t,claiming:!0})},en.prototype.unclaimId=function(e,t){this._commandStack.execute("id.updateClaim",{id:e,element:t})},en.prototype.setColor=function(e,t){e.length||(e=[e]),this._commandStack.execute("element.setColor",{elements:e,colors:t})};function Xy(){}Xy.prototype.layoutConnection=function(e,t){return t=t||{},[t.connectionStart||be(t.source||e.source),t.connectionEnd||be(t.target||e.target)]};var Pc=20,$A=5,Ac=Math.round,Zy=20,jA={"h:h":20,"v:v":20,"h:v":-10,"v:h":-10};function FA(e,t){return!{t:/top/,r:/right/,b:/bottom/,l:/left/,h:/./,v:/./}[t].test(e)}function HA(e,t){return{t:/top/,r:/right/,b:/bottom/,l:/left/,h:/left|right/,v:/top|bottom/}[e].test(t)}function Qy(e,t,n){var i=Zt(t,e,$A),r=n.split(":")[0],o=Ac((t.x-e.x)/2+e.x),a=Ac((t.y-e.y)/2+e.y),s,c,u=HA(r,i),l=/h|r|l/.test(r),p=!1,f=!1;return u?(s=l?{x:o,y:e.y}:{x:e.x,y:a},c=l?"h:h":"v:v"):(p=FA(i,r),c=l?"h:v":"v:h",p?l?(f=a===e.y,s={x:e.x+Pc*(/l/.test(r)?-1:1),y:f?a+Pc:a}):(f=o===e.x,s={x:f?o+Pc:o,y:e.y+Pc*(/t/.test(r)?-1:1)}):s={x:o,y:a}),{waypoints:zp(e,s,c).concat(s),directions:c,turnNextDirections:f}}function zA(e,t,n){return Qy(e,t,n)}function VA(e,t,n){var i=Qy(t,e,Jy(n));return{waypoints:i.waypoints.slice().reverse(),directions:Jy(i.directions),turnNextDirections:i.turnNextDirections}}function GA(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=zp(e.waypoints[e.waypoints.length-1],t.waypoints[0],r);return{waypoints:o,directions:r}}function Jy(e){return e.split(":").reverse().join(":")}function WA(e,t,n){var i=Ac((t.x-e.x)/2+e.x),r=Ac((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 zp(e,t,n){if(n=n||"h:h",!eT(n))throw new Error("unknown directions: <"+n+">: must be specified as <start>:<end> with start/end in { h,v,t,r,b,l }");if(tv(n)){var i=zA(e,t,n),r=VA(e,t,n),o=GA(i,r);return[].concat(i.waypoints,o.waypoints,r.waypoints)}return WA(e,t,n)}function UA(e,t,n){var i=zp(e,t,n);return i.unshift(e),i.push(t),iv(i)}function YA(e,t,n,i,r){var o=r&&r.preferredLayouts||[],a=qx(o,"straight")[0]||"h:h",s=jA[a]||0,c=Zt(e,t,s),u=JA(c,a);n=n||be(e),i=i||be(t);var l=u.split(":"),p=nv(n,e,l[0],tT(c)),f=nv(i,t,l[1],c);return UA(p,f,u)}function qA(e,t,n,i,r,o){_e(n)&&(r=n,o=i,n=be(e),i=be(t)),o=O({preferredLayouts:[]},o),r=r||[];var a=o.preferredLayouts,s=a.indexOf("straight")!==-1,c;return c=s&&XA(e,t,n,i,o),c||(c=o.connectionEnd&&QA(t,e,i,r),c)||(c=o.connectionStart&&ZA(e,t,n,r),c)?c:!o.connectionStart&&!o.connectionEnd&&r&&r.length?r:YA(e,t,n,i,o)}function KA(e,t,n){return e>=t&&e<=n}function ev(e,t,n){var i={x:"width",y:"height"};return KA(t[e],n[e],n[e]+n[i[e]])}function XA(e,t,n,i,r){var o={},a,s;return s=Zt(e,t),/^(top|bottom|left|right)$/.test(s)?(/top|bottom/.test(s)&&(a="x"),/left|right/.test(s)&&(a="y"),r.preserveDocking==="target"?ev(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:ev(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 ZA(e,t,n,i){return Vp(e,t,n,i)}function QA(e,t,n,i){var r=i.slice().reverse();return r=Vp(e,t,n,r),r?r.reverse():null}function Vp(e,t,n,i){function r(l){return l.length<3?!0:l.length>4?!1:!!st(l,function(p,f){var d=l[f-1];return d&&Qo(p,d)<3})}function o(l,p,f){var d=Ai(p,l);switch(d){case"v":return{x:f.x,y:l.y};case"h":return{x:l.x,y:f.y}}return{x:l.x,y:l.y}}function a(l,p,f){var d;for(d=l.length-2;d!==0;d--)if(Ch(l[d],p,Zy)||Ch(l[d],f,Zy))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=Vp(e,t,n,u)),c&&Ai(c)?null:c}function JA(e,t){if(tv(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 eT(e){return e&&/^h|v|t|r|b|l:h|v|t|r|b|l$/.test(e)}function tv(e){return e&&/t|r|b|l/.test(e)}function tT(e){return{top:"bottom",bottom:"top",left:"right",right:"left","top-left":"bottom-right","bottom-right":"top-left","top-right":"bottom-left","bottom-left":"top-right"}[e]}function nv(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 iv(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 nT=-10,iT=40,rT={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},oT={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},Gp={top:"bottom","top-right":"bottom-left","top-left":"bottom-right",right:"left",bottom:"top","bottom-right":"top-left","bottom-left":"top-right",left:"right"},Ta={top:"t",right:"r",bottom:"b",left:"l"};function Tc(e){this._elementRegistry=e}ie(Tc,Xy),Tc.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=rv(r&&r[0],n)),a||(a=rv(r&&r[r.length-1],i)),(v(e,"bpmn:Association")||v(e,"bpmn:DataAssociation"))&&r&&!ov(n,i))return[].concat([o],r.slice(1,-1),[a]);var l=gm(n,s)?rT:oT;return v(e,"bpmn:MessageFlow")?c=sT(n,i,l):(v(e,"bpmn:SequenceFlow")||ov(n,i))&&(n===i?c={preferredLayouts:dT(n,e,l)}:v(n,"bpmn:BoundaryEvent")?c={preferredLayouts:hT(n,i,a,l)}:Ma(n)||Ma(i)?c={preferredLayouts:l.subProcess,preserveDocking:uT(n)}:v(n,"bpmn:Gateway")?c={preferredLayouts:l.fromGateway}:v(i,"bpmn:Gateway")?c={preferredLayouts:l.toGateway}:c={preferredLayouts:l.default}),c&&(c=O(c,t),u=iv(qA(n,i,o,a,r,c))),u||[o,a]};function aT(e){var t=e.host;return Zt(be(e),t,nT)}function sT(e,t,n){return{preferredLayouts:n.messageFlow,preserveDocking:cT(e,t)}}function cT(e,t){return v(t,"bpmn:Participant")?"source":v(e,"bpmn:Participant")?"target":Ma(t)?"source":Ma(e)||v(t,"bpmn:Event")?"target":v(e,"bpmn:Event")?"source":null}function uT(e){return Ma(e)?"target":"source"}function rv(e,t){return e?e.original||e:be(t)}function ov(e,t){return v(t,"bpmn:Activity")&&v(e,"bpmn:BoundaryEvent")&&t.businessObject.isForCompensation}function Ma(e){return v(e,"bpmn:SubProcess")&&$e(e)}function zr(e,t){return e===t}function lT(e,t){return t.indexOf(e)!==-1}function Co(e){var t=/right|left/.exec(e);return t&&t[0]}function Po(e){var t=/top|bottom/.exec(e);return t&&t[0]}function av(e,t){return Gp[e]===t}function pT(e,t){var n=Co(e),i=Gp[n];return t.indexOf(i)!==-1}function fT(e,t){var n=Po(e),i=Gp[n];return t.indexOf(i)!==-1}function sv(e){return e==="right"||e==="left"}function dT(e,t,n){var i=t.waypoints,r=i&&i.length&&Zt(i[0],e);return r==="top"?n.loop.fromTop:r==="right"?n.loop.fromRight:r==="left"?n.loop.fromLeft:n.loop.fromBottom}function hT(e,t,n,i){var r=be(e),o=be(t),a=aT(e),s,c,u=zr(e.host,t),l=lT(a,["top","right","bottom","left"]),p=Zt(o,r,{x:e.width/2+t.width/2,y:e.height/2+t.height/2});return u?mT(a,l,e,t,n,i):(s=gT(a,p,l,i.isHorizontal),c=yT(a,p,l,i.isHorizontal),[s+":"+c])}function mT(e,t,n,i,r,o){var a=t?e:o.isHorizontal?Po(e):Co(e),s=Ta[a],c;return t?sv(e)?c=cv("y",n,i,r)?"h":o.boundaryLoop.alternateHorizontalSide:c=cv("x",n,i,r)?"v":o.boundaryLoop.alternateVerticalSide:c=o.boundaryLoop.default,[s+":"+c]}function cv(e,t,n,i){var r=iT;return!(Wp(e,i,n,r)||Wp(e,i,{x:n.x+n.width,y:n.y+n.height},r)||Wp(e,i,be(t),r))}function Wp(e,t,n,i){return Math.abs(t[e]-n[e])<i}function gT(e,t,n,i){if(n)return Ta[e];var r=Po(e),o=Co(e),a=Po(t),s=Co(t);if(i){if(zr(r,a)||av(o,s))return Ta[r]}else if(zr(o,s)||av(r,a))return Ta[o];return Ta[i?o:r]}function yT(e,t,n,i){if(n)return sv(e)?pT(e,t)||zr(e,t)?"h":"v":fT(e,t)||zr(e,t)?"v":"h";var r=Po(e),o=Co(e),a=Po(t),s=Co(t);return a&&!s?"v":s&&!a?"h":i?zr(r,a)?"h":"v":zr(o,s)?"v":"h"}Tc.$inject=["elementRegistry"];function uv(e){return O({original:e.point.original||e.point},e.actual)}function dr(e,t){this._elementRegistry=e,this._graphicsFactory=t}dr.$inject=["elementRegistry","graphicsFactory"],dr.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(uv(i)),o.push(uv(r)),o},dr.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}},dr.prototype._getIntersection=function(e,t,n){var i=this._getShapePath(e),r=this._getConnectionPath(t);return Jo(i,r,n)},dr.prototype._getConnectionPath=function(e){return this._graphicsFactory.getConnectionPath(e)},dr.prototype._getShapePath=function(e){return this._graphicsFactory.getShapePath(e)},dr.prototype._getGfx=function(e){return this._elementRegistry.getGraphics(e)};const Up={__init__:["modeling","bpmnUpdater"],__depends__:[NC,QC,eP,tP,xy,nA,rA,lA,qn,Tp,Py],bpmnFactory:["type",Xn],bpmnUpdater:["type",kn],elementFactory:["type",lr],modeling:["type",en],layouter:["type",Tc],connectionDocking:["type",dr]};var vT=10,lv=50,_T=250;function Yp(e,t,n,i){for(var r;r=bT(e,n,t);)n=i(t,n,r);return n}function qp(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 bT(e,t,n){var i={x:t.x-n.width/2,y:t.y-n.height/2,width:n.width,height:n.height},r=wT(e);return st(r,function(o){if(o===n)return!1;var a=Zt(o,i,vT);return a==="intersect"})}function xT(e,t){t||(t={});function n(h){return h.source===e?1:-1}var i=t.defaultDistance||lv,r=t.direction||"e",o=t.filter,a=t.getWeight||n,s=t.maxDistance||_T,c=t.reference||"start";o||(o=RT);function u(h,m){return r==="n"?c==="start"?ye(h).top-ye(m).bottom:c==="center"?ye(h).top-be(m).y:ye(h).top-ye(m).top:r==="w"?c==="start"?ye(h).left-ye(m).right:c==="center"?ye(h).left-be(m).x:ye(h).left-ye(m).left:r==="s"?c==="start"?ye(m).top-ye(h).bottom:c==="center"?be(m).y-ye(h).bottom:ye(m).bottom-ye(h).bottom:c==="start"?ye(m).left-ye(h).right:c==="center"?be(m).x-ye(h).right:ye(m).right-ye(h).right}var l=e.incoming.filter(o).map(function(h){var m=a(h),g=m<0?u(h.source,e):u(e,h.source);return{id:h.source.id,distance:g,weight:m}}),p=e.outgoing.filter(o).map(function(h){var m=a(h),g=m>0?u(e,h.target):u(h.target,e);return{id:h.target.id,distance:g,weight:m}}),f=l.concat(p).reduce(function(h,m){return h[m.id+"__weight_"+m.weight]=m,h},{}),d=Sn(f,function(h,m){var g=m.distance,R=m.weight;return g<0||g>s||(h[String(g)]||(h[String(g)]=0),h[String(g)]+=1*R,(!h.distance||h[h.distance]<h[String(g)])&&(h.distance=g)),h},{});return d.distance||i}function wT(e){var t=Kp(e);return e.host&&(t=t.concat(Kp(e.host))),e.attachers&&(t=t.concat(e.attachers.reduce(function(n,i){return n.concat(Kp(i))},[]))),t}function Kp(e){return ST(e).concat(ET(e))}function ET(e){return e.incoming.map(function(t){return t.source})}function ST(e){return e.outgoing.map(function(t){return t.target})}function RT(){return!0}var CT=100;function pv(e,t,n){e.on("autoPlace",CT,function(i){var r=i.shape,o=i.source;return PT(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}}pv.$inject=["eventBus","modeling","canvas"];function PT(e,t,n){n||(n={});var i=n.defaultDistance||lv,r=be(e),o=ye(e);return{x:o.right+i+t.width/2,y:r.y}}function fv(e,t){e.on("autoPlace.end",500,function(n){t.select(n.shape)})}fv.$inject=["eventBus","selection"];const AT={__init__:["autoPlaceSelectionBehavior"],autoPlace:["type",pv],autoPlaceSelectionBehavior:["type",fv]};function dv(e,t,n){var i=gm(e,n);if(v(t,"bpmn:TextAnnotation"))return MT(e,t,i);if(De(t,["bpmn:DataObjectReference","bpmn:DataStoreReference"]))return kT(e,t,i);if(v(t,"bpmn:FlowNode"))return TT(e,t,i)}function TT(e,t,n){var i=ye(e),r=be(e),o=n?{directionHint:"e",minDistance:80,baseOrientation:"left",boundaryOrientation:"top",start:"top",end:"bottom"}:{directionHint:"s",minDistance:90,baseOrientation:"top",boundaryOrientation:"left",start:"left",end:"right"},a=xT(e,{filter:function(d){return v(d,"bpmn:SequenceFlow")},direction:o.directionHint}),s=30,c=o.minDistance,u=o.baseOrientation;v(e,"bpmn:BoundaryEvent")&&(u=Zt(e,e.host,-25),u.indexOf(o.boundaryOrientation)!==-1&&(s*=-1));var l=n?{x:i.right+a+t.width/2,y:r.y+hv(u,c,o)}:{x:r.x+hv(u,c,o),y:i.bottom+a+t.height/2},p={margin:s,minDistance:c},f=n?{y:p}:{x:p};return Yp(e,t,l,qp(f))}function hv(e,t,n){return e.includes(n.start)?-1*t:e.includes(n.end)?t:0}function MT(e,t,n){var i=ye(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};it(e)&&(r=be(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 Yp(e,t,r,qp(a))}function kT(e,t,n){var i=ye(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 Yp(e,t,r,qp(a))}function mv(e,t){e.on("autoPlace",function(n){var i=n.shape,r=n.source;return dv(r,i,t)})}mv.$inject=["eventBus","elementRegistry"];const Mc={__depends__:[AT],__init__:["bpmnAutoPlace"],bpmnAutoPlace:["type",mv]},gv=[hm,oa,Up,Mc];function DT(e={}){md(globalThis,e.dom);const t=document.createElement("div");return document.body.appendChild(t),new uo({container:t,moddleExtensions:e.moddleExtensions??ns,additionalModules:[...gv,...e.additionalModules??[]]})}var OT=new So("ov"),LT=500;function qt(e,t,n,i){this._eventBus=t,this._canvas=n,this._elementRegistry=i,this._ids=OT,this._overlayDefaults=O({show:null,scale:!0},e&&e.defaults),this._overlays={},this._overlayContainers=[],this._overlayRoot=IT(n.getContainer()),this._init()}qt.$inject=["config.overlays","eventBus","canvas","elementRegistry"],qt.prototype.get=function(e){if(wn(e)&&(e={id:e}),wn(e.element)&&(e.element=this._elementRegistry.get(e.element)),e.element){var t=this._getOverlayContainer(e.element,!0);return t?e.type?Oe(t.overlays,Jr({type:e.type})):t.overlays.slice():[]}else return e.type?Oe(this._overlays,Jr({type:e.type})):e.id?this._overlays[e.id]:null},qt.prototype.add=function(e,t,n){if(Gt(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=O({},this._overlayDefaults,n,{id:i,type:t,element:e,html:n.html}),this._addOverlay(n),i},qt.prototype.remove=function(e){var t=this.get(e)||[];_e(t)||(t=[t]);var n=this;k(t,function(i){var r=n._getOverlayContainer(i.element,!0);if(i&&(li(i.html),li(i.htmlContainer),delete i.htmlContainer,delete i.element,delete n._overlays[i.id]),r){var o=r.overlays.indexOf(i);o!==-1&&r.overlays.splice(o,1)}})},qt.prototype.isShown=function(){return this._overlayRoot.style.display!=="none"},qt.prototype.show=function(){kc(this._overlayRoot)},qt.prototype.hide=function(){kc(this._overlayRoot,!1)},qt.prototype.clear=function(){this._overlays={},this._overlayContainers=[],hs(this._overlayRoot)},qt.prototype._updateOverlayContainer=function(e){var t=e.element,n=e.html,i=t.x,r=t.y;if(t.waypoints){var o=At(t);i=o.x,r=o.y}yv(n,i,r),an(e.html,"data-container-id",t.id)},qt.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=At(i).width:a=i.width,r=t.right*-1+a}if(t.bottom!==void 0){var s;i.waypoints?s=At(i).height:s=i.height,o=t.bottom*-1+s}yv(n,r||0,o||0),this._updateOverlayVisibilty(e,this._canvas.viewbox())},qt.prototype._createOverlayContainer=function(e){var t=ut('<div class="djs-overlays" />');mn(t,{position:"absolute"}),this._overlayRoot.appendChild(t);var n={html:t,element:e,overlays:[]};return this._updateOverlayContainer(n),this._overlayContainers.push(n),n},qt.prototype._updateRoot=function(e){var t=e.scale||1,n="matrix("+[t,0,0,t,-1*e.x*t,-1*e.y*t].join(",")+")";vv(this._overlayRoot,n)},qt.prototype._getOverlayContainer=function(e,t){var n=st(this._overlayContainers,function(i){return i.element===e});return!n&&!t?this._createOverlayContainer(e):n},qt.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)),wn(i)&&(i=ut(i)),o=this._getOverlayContainer(n),r=ut('<div class="djs-overlay" data-overlay-id="'+t+'">'),mn(r,{position:"absolute"}),r.appendChild(i),e.type&&mt(r).add("djs-overlay-"+e.type);var a=this._canvas.findRoot(n),s=this._canvas.getRootElement();kc(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())},qt.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&&($t(r)&&r>t.scale||$t(o)&&o<t.scale))&&(c=!1),kc(a,c),this._updateOverlayScale(e,t)},qt.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),$t(i)&&t.scale<i&&(a=(1/t.scale||1)*i),$t(r)&&t.scale>r&&(a=(1/t.scale||1)*r)),$t(a)&&(s="scale("+a+","+a+")"),vv(o,s)},qt.prototype._updateOverlaysVisibilty=function(e){var t=this;k(this._overlays,function(n){t._updateOverlayVisibilty(n,e)})},qt.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});k(o,function(c){t.remove(c.id)});var a=t._getOverlayContainer(r);if(a){li(a.html);var s=t._overlayContainers.indexOf(a);s!==-1&&t._overlayContainers.splice(s,1)}}),e.on("element.changed",LT,function(i){var r=i.element,o=t._getOverlayContainer(r,!0);o&&(k(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&&mt(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 IT(e){var t=ut('<div class="djs-overlay-container" />');return mn(t,{position:"absolute",width:0,height:0}),e.insertBefore(t,e.firstChild),t}function yv(e,t,n){mn(e,{left:t+"px",top:n+"px"})}function kc(e,t){e.style.display=t===!1?"none":""}function vv(e,t){e.style["transform-origin"]="top left",["","-ms-","-webkit-"].forEach(function(n){e.style[n+"transform"]=t})}const Dc={__init__:["overlays"],overlays:["type",qt]};function Xp(e,t){t.invoke(X,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)})}ie(Xp,X),Xp.$inject=["canvas","injector"];const NT={__init__:["rootElementsBehavior"],rootElementsBehavior:["type",Xp]};function ka(e){return CSS.escape(e)}var BT={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"};function _v(e){return e=""+e,e&&e.replace(/[&<>"']/g,function(t){return BT[t]})}var $T="bjs-breadcrumbs-shown";function bv(e,t,n){var i=ut('<ul class="bjs-breadcrumbs"></ul>'),r=n.getContainer(),o=mt(r);r.appendChild(i);var a=[];e.on("element.changed",function(c){var u=c.element,l=Z(u),p=st(a,function(f){return f===l});p&&s()});function s(c){c&&(a=jT(c));var u=a.flatMap(function(p){var f=n.findRoot(mi(p))||n.findRoot(p.id);if(!f&&v(p,"bpmn:Process")){var d=t.find(function(g){var R=Z(g);return R&&R.get("processRef")===p});f=d&&n.findRoot(d.id)}if(!f)return[];var h=_v(p.name||p.id),m=ut('<li><span class="bjs-crumb"><a title="'+h+'">'+h+"</a></span></li>");return m.addEventListener("click",function(){n.setRootElement(f)}),m});i.innerHTML="";var l=u.length>1;o.toggle($T,l),u.forEach(function(p){i.appendChild(p)})}e.on("root.set",function(c){s(c.element)})}bv.$inject=["eventBus","elementRegistry","canvas"];function jT(e){for(var t=Z(e),n=[],i=t;i;i=i.$parent)(v(i,"bpmn:SubProcess")||v(i,"bpmn:Process"))&&n.push(i);return n.reverse()}function xv(e,t){var n=null,i=new FT;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,!(!v(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})}xv.$inject=["eventBus","canvas"];function FT(){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 wv={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;v(a,"bpmn:SubProcess")&&!o.isExpanded&&n.push(a),zT(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=HT(e),i={x:n.x-wv.x,y:n.y-wv.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=Ev(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 Ev(e){return v(e,"bpmndi:BPMNDiagram")?e:Ev(e.$parent)}function HT(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=ye(n.bounds);t.top=Math.min(i.top,t.top),t.left=Math.min(i.left,t.left)}}),Es(t)}function zT(e,t){var n=e.$parent;return!(!v(n,"bpmn:SubProcess")||n===t.bpmnElement||De(e,["bpmn:DataInputAssociation","bpmn:DataOutputAssociation"]))}var Oc=250,VT='<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>',GT="bjs-drilldown-empty";function hr(e,t,n,i,r){X.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",Oc,function(a){var s=a.shape;o._canDrillDown(s)?o._addOverlay(s):o._removeOverlay(s)},!0),this.reverted("shape.toggleCollapse",Oc,function(a){var s=a.shape;o._canDrillDown(s)?o._addOverlay(s):o._removeOverlay(s)},!0),this.executed(["shape.create","shape.move","shape.delete"],Oc,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"],Oc,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)})})}ie(hr,X),hr.prototype._updateDrilldownOverlay=function(e){var t=this._canvas;if(e){var n=t.findRoot(e);n&&this._updateOverlayVisibility(n)}},hr.prototype._canDrillDown=function(e){var t=this._canvas;return v(e,"bpmn:SubProcess")&&t.findRoot(mi(e))},hr.prototype._updateOverlayVisibility=function(e){var t=this._overlays,n=Z(e),i=t.get({element:n.id,type:"drilldown"})[0];if(i){var r=n&&n.get("flowElements")&&n.get("flowElements").length;mt(i.html).toggle(GT,!r)}},hr.prototype._addOverlay=function(e){var t=this._canvas,n=this._overlays,i=Z(e),r=n.get({element:e,type:"drilldown"});r.length&&this._removeOverlay(e);var o=ut('<button type="button" class="bjs-drilldown">'+VT+"</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(mi(e)))}),n.add(e,"drilldown",{position:{bottom:-7,right:-8},html:o}),this._updateOverlayVisibility(e)},hr.prototype._removeOverlay=function(e){var t=this._overlays;t.remove({element:e,type:"drilldown"})},hr.$inject=["canvas","eventBus","elementRegistry","overlays","translate"];const WT={__depends__:[Dc,Tp,NT],__init__:["drilldownBreadcrumbs","drilldownOverlayBehavior","drilldownCentering","subprocessCompatibility"],drilldownBreadcrumbs:["type",bv],drilldownCentering:["type",xv],drilldownOverlayBehavior:["type",hr],subprocessCompatibility:["type",Vr]};function mr(e){yt.call(this,e)}ie(mr,yt),mr.prototype._modules=[hm,WT,Dc,qn,oa],mr.prototype._moddleExtensions={};var Lc="keyboard.keydown",UT="keyboard.keyup",YT=1e3,Sv="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 gn(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(Sv));var i=e&&e.bind!==!1;t.on("canvas.init",function(r){n._target=r.svg,i&&n.bind(),n._fire("init")})}gn.$inject=["config.keyboard","eventBus"],gn.prototype._keydownHandler=function(e){this._keyHandler(e,Lc)},gn.prototype._keyupHandler=function(e){this._keyHandler(e,UT)},gn.prototype._keyHandler=function(e,t){var n;if(!this._isEventIgnored(e)){var i={keyEvent:e};n=this._eventBus.fire(t||Lc,i),n&&e.preventDefault()}},gn.prototype._isEventIgnored=function(e){return!1},gn.prototype.bind=function(e){e&&console.error("unsupported argument <node>",new Error(Sv)),this.unbind(),e=this._node=this._target,Se.bind(e,"keydown",this._keydownHandler),Se.bind(e,"keyup",this._keyupHandler),this._fire("bind")},gn.prototype.getBinding=function(){return this._node},gn.prototype.unbind=function(){var e=this._node;e&&(this._fire("unbind"),Se.unbind(e,"keydown",this._keydownHandler),Se.unbind(e,"keyup",this._keyupHandler)),this._node=null},gn.prototype._fire=function(e){this._eventBus.fire("keyboard."+e,{node:this._node})},gn.prototype.addListener=function(e,t,n){Wt(e)&&(n=t,t=e,e=YT),this._eventBus.on(n||Lc,e,t)},gn.prototype.removeListener=function(e,t){this._eventBus.off(t||Lc,e)},gn.prototype.hasModifier=hP,gn.prototype.isCmd=Tn,gn.prototype.isShift=vp,gn.prototype.isKey=Ht;var qT=500;function Ao(e,t){var n=this;e.on("editorActions.init",qT,function(i){var r=i.editorActions;n.registerBindings(t,r)})}Ao.$inject=["eventBus","keyboard"],Ao.prototype.registerBindings=function(e,t){function n(i,r){t.isRegistered(i)&&e.addListener(r)}n("undo",function(i){var r=i.keyEvent;if(_P(r))return t.trigger("undo"),!0}),n("redo",function(i){var r=i.keyEvent;if(bP(r))return t.trigger("redo"),!0}),n("copy",function(i){var r=i.keyEvent;if(mP(r))return t.trigger("copy"),!0}),n("paste",function(i){var r=i.keyEvent;if(gP(r))return t.trigger("paste"),!0}),n("duplicate",function(i){var r=i.keyEvent;if(yP(r))return t.trigger("duplicate"),!0}),n("cut",function(i){var r=i.keyEvent;if(vP(r))return t.trigger("cut"),!0}),n("stepZoom",function(i){var r=i.keyEvent;if(Ht(["+","Add","="],r)&&Tn(r))return t.trigger("stepZoom",{value:1}),!0}),n("stepZoom",function(i){var r=i.keyEvent;if(Ht(["-","Subtract"],r)&&Tn(r))return t.trigger("stepZoom",{value:-1}),!0}),n("zoom",function(i){var r=i.keyEvent;if(Ht("0",r)&&Tn(r))return t.trigger("zoom",{value:1}),!0}),n("removeSelection",function(i){var r=i.keyEvent;if(Ht(["Backspace","Delete","Del"],r))return t.trigger("removeSelection"),!0})};const Zp={__init__:["keyboard","keyboardBindings"],keyboard:["type",gn],keyboardBindings:["type",Ao]};var KT={moveSpeed:50,moveSpeedAccelerated:200};function Rv(e,t,n){var i=this;this._config=O({},KT,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})}}Rv.$inject=["config.keyboardMove","keyboard","canvas"];const Cv={__depends__:[Zp],__init__:["keyboardMove"],keyboardMove:["type",Rv]};var XT=15;function Pv(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=Br(s),p=ii(l,c);if(!n.dragging&&ZT(p)>XT&&(n.dragging=!0,u===0&&ey(e),sc("grab")),n.dragging){var f=n.last||n.start;p=ii(l,f),t.scroll({dx:p.x,dy:p.y}),n.last=l}s.preventDefault()}function o(s){Se.unbind(document,"mousemove",r),Se.unbind(document,"mouseup",o),n=null,Jg()}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:Br(s)},Se.bind(document,"mousemove",r),Se.bind(document,"mouseup",o),!0}}this.isActive=function(){return!!n}}Pv.$inject=["eventBus","canvas"];function ZT(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}const Av={__init__:["moveCanvas"],moveCanvas:["type",Pv]};function Tv(e,t){var n=ml(e.min),i=ml(e.max),r=Math.abs(n)+Math.abs(i);return r/t}function QT(e,t){return Math.max(e.min,Math.min(e.max,t))}var JT=Math.sign||function(e){return e>=0?1:-1},Qp={min:.2,max:4},Mv=10,eM=.1,tM=.75;function vi(e,t,n){e=e||{},this._enabled=!1,this._canvas=n,this._container=n._container,this._handleWheel=vn(this._handleWheel,this),this._totalDelta=0,this._scale=e.scale||tM;var i=this;t.on("canvas.mouseover",function(){i._init(e.enabled!==!1)}),t.on("canvas.mouseout",function(){i._init(!1)})}vi.$inject=["config.zoomScroll","eventBus","canvas"],vi.prototype.scroll=function(t){this._canvas.scroll(t)},vi.prototype.reset=function(){this._canvas.zoom("fit-viewport")},vi.prototype.zoom=function(t,n){var i=Tv(Qp,Mv*2);this._totalDelta+=t,Math.abs(this._totalDelta)>eM&&(this._zoom(t,n,i),this._totalDelta=0)},vi.prototype._handleWheel=function(t){if(this._enabled){var n=this._container;t.preventDefault();var i=t.ctrlKey||sg()&&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))*JT(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)}},vi.prototype.stepZoom=function(t,n){var i=Tv(Qp,Mv);this._zoom(t,n,i)},vi.prototype._zoom=function(e,t,n){var i=this._canvas,r=e>0?1:-1,o=ml(i.zoom()),a=Math.round(o/n)*n;a+=n*r;var s=Math.pow(10,a);i.zoom(QT(Qp,s),t)},vi.prototype.toggle=function(t){var n=this._container,i=this._handleWheel,r=this._enabled;return typeof t>"u"&&(t=!r),r!==t&&Se[t?"bind":"unbind"](n,"wheel",i,!1),this._enabled=t,t},vi.prototype._init=function(e){this.toggle(e)};const kv={__init__:["zoomScroll"],zoomScroll:["type",vi]};function Da(e){mr.call(this,e)}ie(Da,mr),Da.prototype._navigationModules=[Cv,Av,kv],Da.prototype._modules=[].concat(mr.prototype._modules,Da.prototype._navigationModules);function Jp(e){return e&&e[e.length-1]}function Dv(e){return e.y}function Ov(e){return e.x}var nM={left:Ov,center:Ov,right:function(e){return e.x+e.width},top:Dv,middle:Dv,bottom:function(e){return e.y+e.height}};function To(e,t){this._modeling=e,this._rules=t}To.$inject=["modeling","rules"],To.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}},To.prototype._isType=function(e,t){return t.indexOf(e)!==-1},To.prototype._alignmentPosition=function(e,t){var n=this._getOrientationDetails(e),i=n.axis,r=n.dimension,o={},a={},s=!1,c,u,l;function p(f,d){return Math.round((f[i]+d[i]+d[r])/2)}if(this._isType(e,["left","top"]))o[e]=t[0][i];else if(this._isType(e,["right","bottom"]))l=Jp(t),o[e]=l[i]+l[r];else if(this._isType(e,["center","middle"])){if(k(t,function(f){var d=f[i]+Math.round(f[r]/2);a[d]?a[d].elements.push(f):a[d]={elements:[f],center:d}}),c=oi(a,function(f){return f.elements.length>1&&(s=!0),f.elements.length}),s)return o[e]=Jp(c).center,o;u=t[0],t=oi(t,function(f){return f[i]+f[r]}),l=Jp(t),o[e]=p(u,l)}return o},To.prototype.trigger=function(e,t){var n=this._modeling,i,r=Oe(e,function(c){return!(c.waypoints||c.host||c.labelTarget)});if(i=this._rules.allowed("elements.align",{elements:r}),_e(i)&&(r=i),!(r.length<2||!i)){var o=nM[t],a=oi(r,o),s=this._alignmentPosition(t,a);n.alignElements(a,s)}};const iM={__init__:["alignElements"],alignElements:["type",To]},rM=new So;function Mo(e){this._scheduled={},e.on("diagram.destroy",()=>{Object.keys(this._scheduled).forEach(t=>{this.cancel(t)})})}Mo.$inject=["eventBus"],Mo.prototype.schedule=function(e,t=rM.next()){this.cancel(t);const n=this._schedule(e,t);return this._scheduled[t]=n,n.promise},Mo.prototype._schedule=function(e,t){const n=oM();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}},Mo.prototype.cancel=function(e){const t=this._scheduled[e];t&&(this._cancel(t),this._scheduled[e]=null)},Mo.prototype._cancel=function(e){clearTimeout(e.executionId)};function oM(){const e={};return e.promise=new Promise((t,n)=>{e.resolve=t,e.reject=n}),e}const aM={scheduler:["type",Mo]};var sM="djs-element-hidden",Ic=".entry",cM=1e3,Lv=8,uM=300;function Mt(e,t,n,i){this._canvas=e,this._elementRegistry=t,this._eventBus=n,this._scheduler=i,this._current=null,this._init()}Mt.$inject=["canvas","elementRegistry","eventBus","scheduler"],Mt.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=_e(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=_e(i.target)?i.target:[i.target];r.includes(n)&&e._updateVisibility()}}),this._container=this._createContainer()},Mt.prototype._createContainer=function(){var e=ut('<div class="djs-context-pad-parent"></div>');return this._canvas.getContainer().appendChild(e),e},Mt.prototype.registerProvider=function(e,t){t||(t=e,e=cM),this._eventBus.on("contextPad.getProviders",e,function(n){n.providers.push(t)})},Mt.prototype.getEntries=function(e){var t=this._getProviders(),n=_e(e)?"getMultiElementContextPadEntries":"getContextPadEntries",i={};return k(t,function(r){if(Wt(r[n])){var o=r[n](e);Wt(o)?i=o(i):k(o,function(a,s){i[s]=a})}}),i},Mt.prototype.trigger=function(e,t,n){var i=this,r,o,a=t.delegateTarget||t.target;if(!a)return t.preventDefault();if(r=an(a,"data-action"),o=t.originalEvent||t,e==="mouseover"){this._timeout=setTimeout(function(){i._mouseout=i.triggerEntry(r,"hover",o,n)},uM);return}else if(e==="mouseout"){clearTimeout(this._timeout),this._mouseout&&(this._mouseout(),this._mouseout=null);return}return this.triggerEntry(r,e,o,n)},Mt.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(Wt(s)){if(t==="click")return s(n,r,i)}else if(s[t])return s[t](n,r,i);n.preventDefault()}}}},Mt.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))}},Mt.prototype._getProviders=function(){var e=this._eventBus.createEvent({type:"contextPad.getProviders",providers:[]});return this._eventBus.fire(e),e.providers},Mt.prototype._updateAndOpen=function(e){var t=this.getEntries(e),n=this._createHtml(e),i;k(t,function(r,o){var a=r.group||"default",s=ut(r.html||'<div class="entry" draggable="true"></div>'),c;an(s,"data-action",o),c=et("[data-group="+ka(a)+"]",n),c||(c=ut('<div class="group"></div>'),an(c,"data-group",a),n.appendChild(c)),c.appendChild(s),r.className&&lM(s,r.className),r.title&&an(s,"title",r.title),r.imageUrl&&(i=ut("<img>"),an(i,"src",r.imageUrl),i.style.width="100%",i.style.height="100%",s.appendChild(i))}),mt(n).add("open"),this._current={entries:t,html:n,target:e},this._updatePosition(),this._updateVisibility(),this._eventBus.fire("contextPad.open",{current:this._current})},Mt.prototype._createHtml=function(e){var t=this,n=ut('<div class="djs-context-pad"></div>');return Cn.bind(n,Ic,"click",function(i){t.trigger("click",i)}),Cn.bind(n,Ic,"dragstart",function(i){t.trigger("dragstart",i)}),Cn.bind(n,Ic,"mouseover",function(i){t.trigger("mouseover",i)}),Cn.bind(n,Ic,"mouseout",function(i){t.trigger("mouseout",i)}),Se.bind(n,"mousedown",function(i){i.stopPropagation()}),this._container.appendChild(n),this._eventBus.fire("contextPad.create",{target:e,pad:n}),n},Mt.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()&&fM(this._current.target,e)?t=this._current.html:t=this._createHtml(e),{html:t}},Mt.prototype.close=function(){this.isOpen()&&(clearTimeout(this._timeout),this._container.innerHTML="",this._eventBus.fire("contextPad.close",{current:this._current}),this._current=null)},Mt.prototype.isOpen=function(e){var t=this._current;if(!t)return!1;if(!e)return!0;var n=t.target;return _e(e)!==_e(n)?!1:_e(e)?e.length===n.length&&Rr(e,function(i){return n.includes(i)}):n===e},Mt.prototype.isShown=function(){return this.isOpen()&&mt(this._current.html).has("open")},Mt.prototype.show=function(){this.isOpen()&&(mt(this._current.html).add("open"),this._updatePosition(),this._eventBus.fire("contextPad.show",{current:this._current}))},Mt.prototype.hide=function(){this.isOpen()&&(mt(this._current.html).remove("open"),this._eventBus.fire("contextPad.hide",{current:this._current}))},Mt.prototype._getPosition=function(e){if(!_e(e)&&it(e)){var t=this._canvas.viewbox(),n=pM(e),i=n.x*t.scale-t.x*t.scale,r=n.y*t.scale-t.y*t.scale;return{left:i+Lv*this._canvas.zoom(),top:r}}var o=this._canvas.getContainer(),a=o.getBoundingClientRect(),s=this._getTargetBounds(e);return{left:s.right-a.left+Lv*this._canvas.zoom(),top:s.top-a.top}},Mt.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")},Mt.prototype._updateVisibility=function(){const e=()=>{if(this.isOpen()){var t=this,n=this._current.target,i=_e(n)?n:[n],r=i.some(function(o){return t._canvas.hasMarker(o,sM)});r?t.hide():t.show()}};this._scheduler.schedule(e,"ContextPad#_updateVisibility")},Mt.prototype._getTargetBounds=function(e){var t=this,n=_e(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 lM(e,t){var n=mt(e);t=_e(t)?t:t.split(/\s+/g),t.forEach(function(i){n.add(i)})}function pM(e){return e.waypoints[e.waypoints.length-1]}function fM(e,t){return e=_e(e)?e:[e],t=_e(t)?t:[t],e.length===t.length&&Rr(e,function(n){return t.includes(n)})}const Iv={__depends__:[ac,aM,Dc],contextPad:["type",Mt]};var Nc,_t,Nv,gr,Bv,$v,jv,ef,Bc,Oa,Fv,tf,nf,rf,$c={},jc=[],dM=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,Fc=Array.isArray;function $i(e,t){for(var n in t)e[n]=t[n];return e}function of(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function Hv(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?Nc.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 Hc(e,a,i,r,null)}function Hc(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??++Nv,__i:-1,__u:0};return r==null&&_t.vnode!=null&&_t.vnode(o),o}function zc(e){return e.children}function Vc(e,t){this.props=e,this.context=t}function Gr(e,t){if(t==null)return e.__?Gr(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"?Gr(e):null}function hM(e){if(e.__P&&e.__d){var t=e.__v,n=t.__e,i=[],r=[],o=$i({},t);o.__v=t.__v+1,_t.vnode&&_t.vnode(o),af(e.__P,o,t,e.__n,e.__P.namespaceURI,32&t.__u?[n]:null,i,n??Gr(t),!!(32&t.__u),r),o.__v=t.__v,o.__.__k[o.__i]=o,Kv(i,o,r),t.__e=t.__=null,o.__e!=n&&zv(o)}}function zv(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}),zv(e)}function Vv(e){(!e.__d&&(e.__d=!0)&&gr.push(e)&&!Gc.__r++||Bv!=_t.debounceRendering)&&((Bv=_t.debounceRendering)||$v)(Gc)}function Gc(){try{for(var e,t=1;gr.length;)gr.length>t&&gr.sort(jv),e=gr.shift(),t=gr.length,hM(e)}finally{gr.length=Gc.__r=0}}function Gv(e,t,n,i,r,o,a,s,c,u,l){var p,f,d,h,m,g,R=i&&i.__k||jc,w=t.length;for(c=mM(n,t,R,c,w),p=0;p<w;p++)(d=n.__k[p])!=null&&(f=d.__i!=-1&&R[d.__i]||$c,d.__i=p,g=af(e,d,f,r,o,a,s,c,u,l),h=d.__e,d.ref&&f.ref!=d.ref&&(f.ref&&sf(f.ref,null,d),l.push(d.ref,d.__c||h,d)),m==null&&h!=null&&(m=h),4&d.__u?(c=Wv(d,c,e),f.__e&&(f.__e=null)):typeof d.type=="function"&&g!==void 0?c=g:h&&(c=h.nextSibling),d.__u&=-7);return n.__e=m,c}function mM(e,t,n,i,r){var o,a,s,c,u,l=n.length,p=l,f=0;for(e.__k=new Array(r),o=0;o<r;o++)(a=t[o])!=null&&typeof a!="boolean"&&typeof a!="function"?(typeof a=="string"||typeof a=="number"||typeof a=="bigint"||a.constructor==String?a=e.__k[o]=Hc(null,a,null,null,null):Fc(a)?a=e.__k[o]=Hc(zc,{children:a},null,null,null):a.constructor===void 0&&a.__b>0?a=e.__k[o]=Hc(a.type,a.props,a.key,a.ref?a.ref:null,a.__v):e.__k[o]=a,c=o+f,a.__=e,a.__b=e.__b+1,s=null,(u=a.__i=gM(a,n,c,p))!=-1&&(p--,(s=n[u])&&(s.__u|=2)),s==null||s.__v==null?(u==-1&&(r>l?f--:r<l&&f++),typeof a.type!="function"&&(a.__u|=4)):u!=c&&(u==c-1?f--:u==c+1?f++:(u>c?f--:f++,a.__u|=4))):e.__k[o]=null;if(p)for(o=0;o<l;o++)(s=n[o])!=null&&(2&s.__u)==0&&(s.__e==i&&(i=Gr(s)),Zv(s,s));return i}function Wv(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=Wv(i[r],t,n));return t}e.__e!=t&&(t&&e.type&&!t.parentNode&&(t=Gr(e)),t=n.insertBefore(e.__e,t||null));do t=t&&t.nextSibling;while(t!=null&&t.nodeType==8);return t}function gM(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 Uv(e,t,n){t[0]=="-"?e.setProperty(t,n??""):e[t]=n==null?"":typeof n!="number"||dM.test(t)?n:n+"px"}function Wc(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||Uv(e.style,t,"");if(n)for(t in n)i&&n[t]==i[t]||Uv(e.style,t,n[t])}else if(t[0]=="o"&&t[1]=="n")o=t!=(t=t.replace(Fv,"$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[Oa]=i[Oa]:(n[Oa]=tf,e.addEventListener(t,o?rf:nf,o)):e.removeEventListener(t,o?rf:nf,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 Yv(e){return function(t){if(this.l){var n=this.l[t.type+e];if(t[Bc]==null)t[Bc]=tf++;else if(t[Bc]<n[Oa])return;return n(_t.event?_t.event(t):t)}}}function af(e,t,n,i,r,o,a,s,c,u){var l,p,f,d,h,m,g,R,w,b,x,E,T,L,A,F,z=t.type;if(t.constructor!==void 0)return null;128&n.__u&&(c=!!(32&n.__u),o=[s=t.__e=n.__e]),(l=_t.__b)&&l(t);e:if(typeof z=="function"){p=a.length;try{if(w=t.props,b=z.prototype&&z.prototype.render,x=(l=z.contextType)&&i[l.__c],E=l?x?x.props.value:l.__:i,n.__c?R=(f=t.__c=n.__c).__=f.__E:(b?t.__c=f=new z(w,E):(t.__c=f=new Vc(w,E),f.constructor=z,f.render=vM),x&&x.sub(f),f.state||(f.state={}),f.__n=i,d=f.__d=!0,f.__h=[],f._sb=[]),b&&f.__s==null&&(f.__s=f.state),b&&z.getDerivedStateFromProps!=null&&(f.__s==f.state&&(f.__s=$i({},f.__s)),$i(f.__s,z.getDerivedStateFromProps(w,f.__s))),h=f.props,m=f.state,f.__v=t,d)b&&z.getDerivedStateFromProps==null&&f.componentWillMount!=null&&f.componentWillMount(),b&&f.componentDidMount!=null&&f.__h.push(f.componentDidMount);else{if(b&&z.getDerivedStateFromProps==null&&w!==h&&f.componentWillReceiveProps!=null&&f.componentWillReceiveProps(w,E),t.__v==n.__v||!f.__e&&f.shouldComponentUpdate!=null&&f.shouldComponentUpdate(w,f.__s,E)===!1){t.__v!=n.__v&&(f.props=w,f.state=f.__s,f.__d=!1),t.__e=n.__e,t.__k=n.__k,t.__k.some(function(B){B&&(B.__=t)}),jc.push.apply(f.__h,f._sb),f._sb=[],f.__h.length&&a.push(f),s=Gr(n);break e}f.componentWillUpdate!=null&&f.componentWillUpdate(w,f.__s,E),b&&f.componentDidUpdate!=null&&f.__h.push(function(){f.componentDidUpdate(h,m,g)})}if(f.context=E,f.props=w,f.__P=e,f.__e=!1,T=_t.__r,L=0,b)f.state=f.__s,f.__d=!1,T&&T(t),l=f.render(f.props,f.state,f.context),jc.push.apply(f.__h,f._sb),f._sb=[];else do f.__d=!1,T&&T(t),l=f.render(f.props,f.state,f.context),f.state=f.__s;while(f.__d&&++L<25);f.state=f.__s,f.getChildContext!=null&&(i=$i($i({},i),f.getChildContext())),b&&!d&&f.getSnapshotBeforeUpdate!=null&&(g=f.getSnapshotBeforeUpdate(h,m)),A=l!=null&&l.type===zc&&l.key==null?Xv(l.props.children):l,s=Gv(e,Fc(A)?A:[A],t,n,i,r,o,a,s,c,u),f.base=t.__e,t.__u&=-161,f.__h.length&&a.push(f),R&&(f.__E=f.__=null)}catch(B){if(a.length=p,t.__v=null,c||o!=null){if(B.then){for(t.__u|=c?160:128;s&&s.nodeType==8&&s.nextSibling;)s=s.nextSibling;o!=null&&(o[o.indexOf(s)]=null),t.__e=s}else if(o!=null)for(F=o.length;F--;)of(o[F])}else t.__e=n.__e;t.__k==null&&(t.__k=n.__k||[]),B.then||qv(t),_t.__e(B,t,n)}}else o==null&&t.__v==n.__v?(t.__k=n.__k,t.__e=n.__e):s=t.__e=yM(n.__e,t,n,i,r,o,a,c,u);return(l=_t.diffed)&&l(t),128&t.__u?void 0:s}function qv(e){e&&(e.__c&&(e.__c.__e=!0),e.__k&&e.__k.some(qv))}function Kv(e,t,n){for(var i=0;i<n.length;i++)sf(n[i],n[++i],n[++i]);_t.__c&&_t.__c(t,e),e.some(function(r){try{e=r.__h,r.__h=[],e.some(function(o){o.call(r)})}catch(o){_t.__e(o,r.__v)}})}function Xv(e){return typeof e!="object"||e==null||e.__b>0?e:Fc(e)?e.map(Xv):e.constructor!==void 0?null:$i({},e)}function yM(e,t,n,i,r,o,a,s,c){var u,l,p,f,d,h,m,g=n.props||$c,R=t.props,w=t.type;if(w=="svg"?r="http://www.w3.org/2000/svg":w=="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==!!w&&(w?d.localName==w:d.nodeType==3)){e=d,o[u]=null;break}}if(e==null){if(w==null)return document.createTextNode(R);e=document.createElementNS(r,w,R.is&&R),s&&(_t.__m&&_t.__m(t,o),s=!1),o=null}if(w==null)g===R||s&&e.data==R||(e.data=R);else{if(o=w=="textarea"&&R.defaultValue!=null?null:o&&Nc.call(e.childNodes),!s&&o!=null)for(g={},u=0;u<e.attributes.length;u++)g[(d=e.attributes[u]).name]=d.value;for(u in g)d=g[u],u=="dangerouslySetInnerHTML"?p=d:u=="children"||u in R||u=="value"&&"defaultValue"in R||u=="checked"&&"defaultChecked"in R||Wc(e,u,null,d,r);for(u in R)d=R[u],u=="children"?f=d:u=="dangerouslySetInnerHTML"?l=d:u=="value"?h=d:u=="checked"?m=d:s&&typeof d!="function"||g[u]===d||Wc(e,u,d,g[u],r);if(l)s||p&&(l.__html==p.__html||l.__html==e.innerHTML)||(e.innerHTML=l.__html),t.__k=[];else if(p&&(e.innerHTML=""),Gv(t.type=="template"?e.content:e,Fc(f)?f:[f],t,n,i,w=="foreignObject"?"http://www.w3.org/1999/xhtml":r,o,a,o?o[0]:n.__k&&Gr(n,0),s,c),o!=null)for(u=o.length;u--;)of(o[u]);s&&w!="textarea"||(u="value",w=="progress"&&h==null?e.removeAttribute("value"):h!=null&&(h!==e[u]||w=="progress"&&!h||w=="option"&&h!=g[u])&&Wc(e,u,h,g[u],r),u="checked",m!=null&&m!=e[u]&&Wc(e,u,m,g[u],r))}return e}function sf(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){_t.__e(r,n)}}function Zv(e,t,n){var i,r;if(_t.unmount&&_t.unmount(e),(i=e.ref)&&(i.current&&i.current!=e.__e||sf(i,null,t)),(i=e.__c)!=null){if(i.componentWillUnmount)try{i.componentWillUnmount()}catch(o){_t.__e(o,t)}i.base=i.__P=i.__n=null}if(i=e.__k)for(r=0;r<i.length;r++)i[r]&&Zv(i[r],t,n||typeof e.type!="function");n||of(e.__e),e.__c=e.__=e.__e=void 0}function vM(e,t,n){return this.constructor(e,n)}function Qv(e,t,n){var i,r,o,a;t==document&&(t=document.documentElement),_t.__&&_t.__(e,t),r=(i=!1)?null:t.__k,o=[],a=[],af(t,e=t.__k=Hv(zc,null,[e]),r||$c,$c,t.namespaceURI,r?null:t.firstChild?Nc.call(t.childNodes):null,o,r?r.__e:t.firstChild,i,a),Kv(o,e,a),e.props.children=null}Nc=jc.slice,_t={__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}},Nv=0,Vc.prototype.setState=function(e,t){var n;n=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=$i({},this.state),typeof e=="function"&&(e=e($i({},n),this.props)),e&&$i(n,e),e!=null&&this.__v&&(t&&this._sb.push(t),Vv(this))},Vc.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),Vv(this))},Vc.prototype.render=zc,gr=[],$v=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,jv=function(e,t){return e.__v.__b-t.__v.__b},Gc.__r=0,ef=Math.random().toString(8),Bc="__d"+ef,Oa="__a"+ef,Fv=/(PointerCapture)$|Capture$/i,tf=0,nf=Yv(!1),rf=Yv(!0);var Jv=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,Jv(e,s,n,["",null])),i.push(r),s[0]?t[0]|=2:(t[o-2]=0,t[o]=r)):i.push(s)}return i},e_=new Map;function _M(e){var t=e_.get(this);return t||(t=new Map,e_.set(this,t)),(t=Jv(this,t.get(e)||(t.set(e,t=(function(n){for(var i,r,o=1,a="",s="",c=[0],u=function(f){o===1&&(f||(a=a.replace(/^\s*\n\s*|\s*\n\s*$/g,"")))?c.push(0,f,a):o===3&&(f||a)?(c.push(3,f,a),o=2):o===2&&a==="..."&&f?c.push(4,f,0):o===2&&a&&!f?c.push(5,0,!0,a):o>=5&&((a||!f&&o===5)&&(c.push(o,0,a,r),o=6),f&&(c.push(o,f,0,r),o=6)),a=""},l=0;l<n.length;l++){l&&(o===1&&u(),u(l));for(var p=0;p<n[l].length;p++)i=n[l][p],o===1?i==="<"?(u(),c=[c],o=3):a+=i:o===4?a==="--"&&i===">"?(o=1,a=""):a=i+a[0]:s?i===s?s="":a+=i:i==='"'||i==="'"?s=i:i===">"?(u(),o=1):o&&(i==="="?(o=5,r=a,a=""):i==="/"&&(o<5||n[l][p+1]===">")?(u(),o===3&&(c=c[0]),o=c,(c=c[0]).push(2,0,o),o=0):i===" "||i===" "||i===`
11
+ `||i==="\r"?(u(),o=2):a+=i),o===3&&a==="!--"&&(o=4,c=c[0])}return u(),c})(e)),t),arguments,[])).length>1?t:t[0]}var ot=_M.bind(Hv),ko,kt,cf,t_,La=0,n_=[],zt=_t,i_=zt.__b,r_=zt.__r,o_=zt.diffed,a_=zt.__c,s_=zt.unmount,c_=zt.__;function Uc(e,t){zt.__h&&zt.__h(kt,e,La||t),La=0;var n=kt.__H||(kt.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({}),n.__[e]}function uf(e){return La=1,bM(l_,e)}function bM(e,t,n){var i=Uc(ko++,2);if(i.t=e,!i.__c&&(i.__=[l_(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=kt,!kt.__f)){var r=function(s,c,u){if(!i.__c.__H)return!0;var l=!1,p=i.__c.props!==s;if(i.__c.__H.__.some(function(d){if(d.__N){l=!0;var h=d.__[0];d.__=d.__N,d.__N=void 0,h!==d.__[0]&&(p=!0)}}),o){var f=o.call(this,s,c,u);return l?f||p:f}return!l||p};kt.__f=!0;var o=kt.shouldComponentUpdate,a=kt.componentWillUpdate;kt.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)},kt.shouldComponentUpdate=r}return i.__N||i.__}function Yc(e,t){var n=Uc(ko++,3);!zt.__s&&ff(n.__H,t)&&(n.__=e,n.u=t,kt.__H.__h.push(n))}function lf(e,t){var n=Uc(ko++,4);!zt.__s&&ff(n.__H,t)&&(n.__=e,n.u=t,kt.__h.push(n))}function qc(e){return La=5,ji(function(){return{current:e}},[])}function ji(e,t){var n=Uc(ko++,7);return ff(n.__H,t)&&(n.__=e(),n.__H=t,n.__h=e),n.__}function Ia(e,t){return La=8,ji(function(){return e},t)}function xM(){for(var e;e=n_.shift();){var t=e.__H;if(e.__P&&t)try{t.__h.some(Kc),t.__h.some(pf),t.__h=[]}catch(n){t.__h=[],zt.__e(n,e.__v)}}}zt.__b=function(e){kt=null,i_&&i_(e)},zt.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),c_&&c_(e,t)},zt.__r=function(e){r_&&r_(e),ko=0;var t=(kt=e.__c).__H;t&&(cf===kt?(t.__h=[],kt.__h=[],t.__.some(function(n){n.__N&&(n.__=n.__N),n.u=n.__N=void 0})):(t.__h.some(Kc),t.__h.some(pf),t.__h=[],ko=0)),cf=kt},zt.diffed=function(e){o_&&o_(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(n_.push(t)!==1&&t_===zt.requestAnimationFrame||((t_=zt.requestAnimationFrame)||wM)(xM)),t.__H.__.some(function(n){n.u&&(n.__H=n.u,n.u=void 0)})),cf=kt=null},zt.__c=function(e,t){t.some(function(n){try{n.__h.some(Kc),n.__h=n.__h.filter(function(i){return!i.__||pf(i)})}catch(i){t.some(function(r){r.__h&&(r.__h=[])}),t=[],zt.__e(i,n.__v)}}),a_&&a_(e,t)},zt.unmount=function(e){s_&&s_(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.some(function(i){try{Kc(i)}catch(r){t=r}}),n.__H=void 0,t&&zt.__e(t,n.__v))};var u_=typeof requestAnimationFrame=="function";function wM(e){var t,n=function(){clearTimeout(i),u_&&cancelAnimationFrame(t),setTimeout(e)},i=setTimeout(n,35);u_&&(t=requestAnimationFrame(n))}function Kc(e){var t=kt,n=e.__c;typeof n=="function"&&(e.__c=void 0,n()),kt=t}function pf(e){var t=kt;e.__c=e.__(),kt=t}function ff(e,t){return!e||e.length!==t.length||t.some(function(n,i){return n!==e[i]})}function l_(e,t){return typeof t=="function"?t(e):t}function EM(e){const{navigationStack:t,setNavigationStack:n}=e,i=ji(()=>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 ot`
12
12
  <div class="djs-popup-breadcrumbs">
13
13
  ${r&&ot`
14
14
  <button
@@ -41,7 +41,7 @@
41
41
  </span>
42
42
  `}
43
43
  </div>
44
- `}function l_(e){var t,n,i="";if(typeof e=="string"||typeof e=="number")i+=e;else if(typeof e=="object")if(Array.isArray(e)){var r=e.length;for(t=0;t<r;t++)e[t]&&(n=l_(e[t]))&&(i&&(i+=" "),i+=n)}else for(n in e)e[n]&&(i&&(i+=" "),i+=n);return i}function Zc(){for(var e,t,n=0,i="",r=arguments.length;n<r;n++)(e=arguments[n])&&(t=l_(e))&&(i&&(i+=" "),i+=t);return i}function EM(e){const{headerEntries:t,onSelect:n,selectedEntry:i,setSelectedEntry:r,title:o}=e,a=ji(()=>SM(t),[t]),s=u=>u.action&&!u.disabled,c=(u,l)=>{if(s(l))return n(u,l)};return ot`
44
+ `}function p_(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=p_(e[t]))&&(i&&(i+=" "),i+=n)}else for(n in e)e[n]&&(i&&(i+=" "),i+=n);return i}function Xc(){for(var e,t,n=0,i="",r=arguments.length;n<r;n++)(e=arguments[n])&&(t=p_(e))&&(i&&(i+=" "),i+=t);return i}function SM(e){const{headerEntries:t,onSelect:n,selectedEntry:i,setSelectedEntry:r,title:o}=e,a=ji(()=>RM(t),[t]),s=u=>u.action&&!u.disabled,c=(u,l)=>{if(s(l))return n(u,l)};return ot`
45
45
  <div class="djs-popup-header">
46
46
  <h3 class="djs-popup-title" title=${o}>${o}</h3>
47
47
  ${a.map(u=>ot`
@@ -50,7 +50,7 @@
50
50
  ${u.entries.map(l=>ot`
51
51
  <li key=${l.id}>
52
52
  <${s(l)?"button":"span"}
53
- class=${RM(l,l===i)}
53
+ class=${CM(l,l===i)}
54
54
  onClick=${p=>c(p,l)}
55
55
  title=${l.title||l.label}
56
56
  data-id=${l.id}
@@ -70,11 +70,11 @@
70
70
  </ul>
71
71
  `)}
72
72
  </div>
73
- `}function SM(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 RM(e,t){return Zc("entry",e.className,e.active?"active":"",e.disabled?"disabled":"",t?"selected":"")}function p_(e,t){return`${e}-entry-${t.id}`}function CM(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 ot`
73
+ `}function RM(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 CM(e,t){return Xc("entry",e.className,e.active?"active":"",e.disabled?"disabled":"",t?"selected":"")}function f_(e,t){return`${e}-entry-${t.id}`}function PM(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 ot`
74
74
  <li
75
- class=${Zc("entry",{selected:i,disabled:n.disabled})}
75
+ class=${Xc("entry",{selected:i,disabled:n.disabled})}
76
76
  data-id=${n.id}
77
- id=${p_(t,n)}
77
+ id=${f_(t,n)}
78
78
  role="option"
79
79
  aria-selected=${i||void 0}
80
80
  aria-haspopup=${n.entries?"true":void 0}
@@ -88,7 +88,7 @@
88
88
  >
89
89
  <div class="djs-popup-entry-content">
90
90
  <span
91
- class=${Zc("djs-popup-entry-name",n.className)}
91
+ class=${Xc("djs-popup-entry-name",n.className)}
92
92
  >
93
93
  ${n.imageUrl&&ot`<img class="djs-popup-entry-icon" src=${n.imageUrl} alt="" />`||n.imageHtml&&ot`<div class="djs-popup-entry-icon" dangerouslySetInnerHTML=${{__html:n.imageHtml}} />`}
94
94
 
@@ -131,7 +131,7 @@
131
131
  </div>
132
132
  `}
133
133
  </li>
134
- `}function PM(e){const{selectedEntry:t,setSelectedEntry:n,groupedEntries:i,keyboardSelection:r,idPrefix:o,id:a,ariaLabel:s,tabIndex:c,ariaActivedescendant:u,...l}=e,p=Kc();lf(()=>{if(!r||!r.current)return;const m=p.current;if(!m)return;const g=m.querySelector(".selected");g&&AM(g)},[t]);const f=()=>{r.current=!1},d=m=>{r.current||n(m)},h=()=>{r.current||n(null)};return ot`
134
+ `}function AM(e){const{selectedEntry:t,setSelectedEntry:n,groupedEntries:i,keyboardSelection:r,idPrefix:o,id:a,ariaLabel:s,tabIndex:c,ariaActivedescendant:u,...l}=e,p=qc();lf(()=>{if(!r||!r.current)return;const m=p.current;if(!m)return;const g=m.querySelector(".selected");g&&TM(g)},[t]);const f=()=>{r.current=!1},d=m=>{r.current||n(m)},h=()=>{r.current||n(null)};return ot`
135
135
  <div
136
136
  class="djs-popup-results"
137
137
  ref=${p}
@@ -144,7 +144,7 @@
144
144
  >
145
145
  ${i.map(m=>ot`
146
146
  ${m.name&&ot`
147
- <div key=${m.id} id=${f_(o,m)} class="entry-header" title=${m.name}>
147
+ <div key=${m.id} id=${d_(o,m)} class="entry-header" title=${m.name}>
148
148
  ${m.name}
149
149
  </div>
150
150
  `}
@@ -152,10 +152,10 @@
152
152
  class="djs-popup-group"
153
153
  data-group=${m.id}
154
154
  role="group"
155
- aria-labelledby=${m.name?f_(o,m):void 0}
155
+ aria-labelledby=${m.name?d_(o,m):void 0}
156
156
  >
157
157
  ${m.entries.map(g=>ot`
158
- <${CM}
158
+ <${PM}
159
159
  key=${g.id}
160
160
  idPrefix=${o}
161
161
  entry=${g}
@@ -168,10 +168,10 @@
168
168
  </ul>
169
169
  `)}
170
170
  </div>
171
- `}function f_(e,t){return`${e}-group-${t.id}`}function AM(e){typeof e.scrollIntoViewIfNeeded=="function"?e.scrollIntoViewIfNeeded():e.scrollIntoView({scrollMode:"if-needed",block:"nearest"})}const TM=new So("djs-popup");function MM(e){const{onClose:t,onSelect:n,className:i,headerEntries:r,position:o,title:a,width:s,scale:c,search:u,emptyPlaceholder:l,searchFn:p,entries:f,onOpened:d,onClosed:h}=e,[m,g]=uf([]);qc(()=>{g([])},[f]);const[R,w]=uf(""),b=R.trim().length>0,x=ji(()=>OM(f),[f]),E=ji(()=>$t(u)?x.length>5:!1,[u,x]),T=ji(()=>{const F=m.length?m[m.length-1].entries:f;return E?b?p(x.filter(({searchable:$})=>$!==!1),R,{keys:["label","search","description"]}).map(({item:$})=>$):F.filter(({rank:$=0})=>$>=0):F},[E,b,x,R,p,m,f]),L=ji(()=>b?T.length?[{id:"default",entries:T}]:[]:LM(T),[T,b]),[A,j]=uf(T[0]),H=Kc(null),N=Kc(!1),G=ji(()=>TM.next(),[]),fe=`${G}-results`,Fe=A&&p_(G,A);qc(()=>{const F=H.current;F&&T.includes(F)?j(F):j(T[0]),H.current=null},[T]);const lt=Ia(F=>{const $=DM(L);let ke=$.indexOf(A)+F;ke<0&&(ke=$.length-1),ke>=$.length&&(ke=0),N.current=!0,j($[ke])},[L,A]),Y=Ia(F=>{F>0&&A&&A.entries&&(N.current=!0,g($=>[...$,A])),F<0&&m.length>0&&(N.current=!0,H.current=m[m.length+F],g($=>$.slice(0,F)))},[A,m]),de=Ia((F,$,U)=>{if(!(!$||$.disabled))return $.entries?(F.preventDefault(),Y(1)):n(F,$,U)},[n,Y]),he=Ia(F=>{if(F.key==="Enter"&&A){const $=F.target;return!!kr($,"a, button",!0)||A.disabled?void 0:de(F,A)}if(F.key==="Backspace"){const $=F.target;if(!(qu($,"input")&&$.value!==""))return Y(-1),F.preventDefault()}if(F.key==="ArrowUp")return lt(-1),F.preventDefault();if(F.key==="ArrowDown")return lt(1),F.preventDefault();if(F.key==="ArrowRight")return Y(1),F.preventDefault();if(F.key==="ArrowLeft")return Y(-1),F.preventDefault()},[A,lt,Y,de]),se=Ia(F=>{qu(F.target,"input")&&w(()=>F.target.value)},[w]);qc(()=>(d(),()=>{h()}),[]);const ce=!b&&m.length>0,ee=(a||r.length>0)&&!ce;return ot`
172
- <${d_}
171
+ `}function d_(e,t){return`${e}-group-${t.id}`}function TM(e){typeof e.scrollIntoViewIfNeeded=="function"?e.scrollIntoViewIfNeeded():e.scrollIntoView({scrollMode:"if-needed",block:"nearest"})}const MM=new So("djs-popup");function kM(e){const{onClose:t,onSelect:n,className:i,headerEntries:r,position:o,title:a,width:s,scale:c,search:u,emptyPlaceholder:l,searchFn:p,entries:f,onOpened:d,onClosed:h}=e,[m,g]=uf([]);Yc(()=>{g([])},[f]);const[R,w]=uf(""),b=R.trim().length>0,x=ji(()=>LM(f),[f]),E=ji(()=>$t(u)?x.length>5:!1,[u,x]),T=ji(()=>{const H=m.length?m[m.length-1].entries:f;return E?b?p(x.filter(({searchable:$})=>$!==!1),R,{keys:["label","search","description"]}).map(({item:$})=>$):H.filter(({rank:$=0})=>$>=0):H},[E,b,x,R,p,m,f]),L=ji(()=>b?T.length?[{id:"default",entries:T}]:[]:IM(T),[T,b]),[A,F]=uf(T[0]),z=qc(null),B=qc(!1),G=ji(()=>MM.next(),[]),fe=`${G}-results`,Fe=A&&f_(G,A);Yc(()=>{const H=z.current;H&&T.includes(H)?F(H):F(T[0]),z.current=null},[T]);const lt=Ia(H=>{const $=OM(L);let ke=$.indexOf(A)+H;ke<0&&(ke=$.length-1),ke>=$.length&&(ke=0),B.current=!0,F($[ke])},[L,A]),q=Ia(H=>{H>0&&A&&A.entries&&(B.current=!0,g($=>[...$,A])),H<0&&m.length>0&&(B.current=!0,z.current=m[m.length+H],g($=>$.slice(0,H)))},[A,m]),de=Ia((H,$,U)=>{if(!(!$||$.disabled))return $.entries?(H.preventDefault(),q(1)):n(H,$,U)},[n,q]),he=Ia(H=>{if(H.key==="Enter"&&A){const $=H.target;return!!kr($,"a, button",!0)||A.disabled?void 0:de(H,A)}if(H.key==="Backspace"){const $=H.target;if(!(qu($,"input")&&$.value!==""))return q(-1),H.preventDefault()}if(H.key==="ArrowUp")return lt(-1),H.preventDefault();if(H.key==="ArrowDown")return lt(1),H.preventDefault();if(H.key==="ArrowRight")return q(1),H.preventDefault();if(H.key==="ArrowLeft")return q(-1),H.preventDefault()},[A,lt,q,de]),ce=Ia(H=>{qu(H.target,"input")&&w(()=>H.target.value)},[w]);Yc(()=>(d(),()=>{h()}),[]);const ue=!b&&m.length>0,ee=(a||r.length>0)&&!ue;return ot`
172
+ <${h_}
173
173
  onClose=${t}
174
- onKeyup=${se}
174
+ onKeyup=${ce}
175
175
  onKeydown=${he}
176
176
  className=${i}
177
177
  position=${o}
@@ -180,16 +180,16 @@
180
180
  navigationStack=${m}
181
181
  >
182
182
  ${ee&&ot`
183
- <${EM}
183
+ <${SM}
184
184
  headerEntries=${r}
185
185
  onSelect=${n}
186
186
  selectedEntry=${A}
187
- setSelectedEntry=${j}
187
+ setSelectedEntry=${F}
188
188
  title=${a}
189
189
  />
190
190
  `}
191
- ${ce&&ot`
192
- <${wM}
191
+ ${ue&&ot`
192
+ <${EM}
193
193
  navigationStack=${m}
194
194
  setNavigationStack=${g}
195
195
  />
@@ -221,11 +221,11 @@
221
221
  </div>
222
222
  `}
223
223
 
224
- <${PM}
224
+ <${AM}
225
225
  groupedEntries=${L}
226
226
  selectedEntry=${A}
227
- setSelectedEntry=${j}
228
- keyboardSelection=${N}
227
+ setSelectedEntry=${F}
228
+ keyboardSelection=${B}
229
229
  onAction=${de}
230
230
  idPrefix=${G}
231
231
  id=${fe}
@@ -239,7 +239,7 @@
239
239
  <a
240
240
  class="djs-popup-footer-docs"
241
241
  href=${A.documentationRef}
242
- onClick=${F=>F.stopPropagation()}
242
+ onClick=${H=>H.stopPropagation()}
243
243
  aria-label=${A.label?`Open entry documentation for ${A.label}`:"Open entry documentation"}
244
244
  target="_blank"
245
245
  rel="noopener"
@@ -257,11 +257,11 @@
257
257
  ${l&&T.length===0&&ot`
258
258
  <div class="djs-popup-no-results">${Wt(l)?l(R):l}</div>
259
259
  `}
260
- </${d_}>
261
- `}function d_(e){const{onClose:t,onKeydown:n,onKeyup:i,className:r,children:o,navigationStack:a,position:s}=e,c=Kc();return lf(()=>{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]),lf(()=>{const u=c.current;if(!u)return;(u.querySelector("input")||u.querySelector('[role="listbox"]')||u).focus()},[a]),qc(()=>{const u=p=>{if(p.key==="Escape")return p.preventDefault(),t()},l=p=>{if(!kr(p.target,".djs-popup",!0))return t()};return document.documentElement.addEventListener("keydown",u),document.body.addEventListener("click",l,!0),()=>{document.documentElement.removeEventListener("keydown",u),document.body.removeEventListener("click",l,!0)}},[]),ot`
260
+ </${h_}>
261
+ `}function h_(e){const{onClose:t,onKeydown:n,onKeyup:i,className:r,children:o,navigationStack:a,position:s}=e,c=qc();return lf(()=>{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]),lf(()=>{const u=c.current;if(!u)return;(u.querySelector("input")||u.querySelector('[role="listbox"]')||u).focus()},[a]),Yc(()=>{const u=p=>{if(p.key==="Escape")return p.preventDefault(),t()},l=p=>{if(!kr(p.target,".djs-popup",!0))return t()};return document.documentElement.addEventListener("keydown",u),document.body.addEventListener("click",l,!0),()=>{document.documentElement.removeEventListener("keydown",u),document.body.removeEventListener("click",l,!0)}},[]),ot`
262
262
  <div
263
- class=${Zc("djs-popup",r)}
264
- style=${kM(e)}
263
+ class=${Xc("djs-popup",r)}
264
+ style=${DM(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 kM(e){const{width:t}=e,n=typeof t=="number"?`${t}px`:t;return{transform:`scale(${e.scale})`,width:$t(t)?n:void 0,maxWidth:$t(t)?"unset":void 0,"transform-origin":"top left"}}function DM(e){const t=[];return e.forEach(n=>{n.entries.forEach(i=>{t.push(i)})}),t}function OM(e){const t=[];function n(i){i.forEach(r=>{if(r.entries){n(r.entries);return}t.push(r)})}return n(e),t}function LM(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 IM="data-id",h_=["contextPad.close","canvas.viewbox.changing","commandStack.changed"],NM=1e3;function bt(e,t,n,i){this._eventBus=t,this._canvas=n,this._search=i,this._current=null;var r=$t(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()})}bt.$inject=["config.popupMenu","eventBus","canvas","search"],bt.prototype._render=function(){const{position:e,providerId:t,entries:n,headerEntries:i,emptyPlaceholder:r,options:o}=this._current,a=m_(n),s=Object.entries(i).map(([f,d])=>({id:f,...d})),c=e&&(f=>this._ensureVisible(f,e)),u=this._updateScale(this._current.container);Zv(ot`
273
- <${MM}
272
+ `}function DM(e){const{width:t}=e,n=typeof t=="number"?`${t}px`:t;return{transform:`scale(${e.scale})`,width:$t(t)?n:void 0,maxWidth:$t(t)?"unset":void 0,"transform-origin":"top left"}}function OM(e){const t=[];return e.forEach(n=>{n.entries.forEach(i=>{t.push(i)})}),t}function LM(e){const t=[];function n(i){i.forEach(r=>{if(r.entries){n(r.entries);return}t.push(r)})}return n(e),t}function IM(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 NM="data-id",m_=["contextPad.close","canvas.viewbox.changing","commandStack.changed"],BM=1e3;function bt(e,t,n,i){this._eventBus=t,this._canvas=n,this._search=i,this._current=null;var r=$t(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()})}bt.$inject=["config.popupMenu","eventBus","canvas","search"],bt.prototype._render=function(){const{position:e,providerId:t,entries:n,headerEntries:i,emptyPlaceholder:r,options:o}=this._current,a=g_(n),s=Object.entries(i).map(([f,d])=>({id:f,...d})),c=e&&(f=>this._ensureVisible(f,e)),u=this._updateScale(this._current.container);Qv(ot`
273
+ <${kM}
274
274
  onClose=${f=>this.close(f)}
275
275
  onSelect=${(f,d,h)=>this.trigger(f,d,h)}
276
276
  position=${c}
@@ -284,7 +284,7 @@
284
284
  searchFn=${this._search}
285
285
  ...${{...o}}
286
286
  />
287
- `,this._current.container)},bt.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()},bt.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()},bt.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)}},bt.prototype.close=function(){this.isOpen()&&(this._emit("close"),this.reset(),this._canvas.restoreFocus(),this._current=null)},bt.prototype.reset=function(){const e=this._current.container;Zv(null,e),li(e)},bt.prototype._emit=function(e,t){this._eventBus.fire(`popupMenu.${e}`,t)},bt.prototype._onOpened=function(){this._emit("opened")},bt.prototype._onClosed=function(){this._emit("closed")},bt.prototype._createContainer=function(e){var t=this._canvas,n=t.getContainer();const i=ut(`<div class="djs-popup-parent djs-scrollable" data-popup=${e.provider}></div>`);return n.appendChild(i),i},bt.prototype._bindAutoClose=function(){this._eventBus.once(h_,this.close,this)},bt.prototype._unbindAutoClose=function(){this._eventBus.off(h_,this.close,this)},bt.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),$t(n)&&e<n&&(r=n),$t(i)&&e>i&&(r=i)),r},bt.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}},bt.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},bt.prototype.registerProvider=function(e,t,n){n||(n=t,t=NM),this._eventBus.on("popupMenu.getProviders."+e,t,function(i){i.providers.push(n)})},bt.prototype._getProviders=function(e){var t=this._eventBus.createEvent({type:"popupMenu.getProviders."+e,providers:[]});return this._eventBus.fire(t),t.providers},bt.prototype._getEntries=function(e,t){var n={};return M(t,function(i){if(!i.getPopupMenuEntries){M(i.getEntries(e),function(o){var a=o.id;if(!a)throw new Error("entry ID is missing");n[a]=ai(o,["id"])});return}var r=i.getPopupMenuEntries(e);Wt(r)?n=r(n):M(r,function(o,a){n[a]=o})}),n},bt.prototype._getHeaderEntries=function(e,t){var n={};return M(t,function(i){if(!i.getPopupMenuHeaderEntries){if(!i.getHeaderEntries)return;M(i.getHeaderEntries(e),function(o){var a=o.id;if(!a)throw new Error("entry ID is missing");n[a]=ai(o,["id"])});return}var r=i.getPopupMenuHeaderEntries(e);Wt(r)?n=r(n):M(r,function(o,a){n[a]=o})}),n},bt.prototype._getEmptyPlaceholder=function(e){const t=e.find(n=>Wt(n.getEmptyPlaceholder));return t&&t.getEmptyPlaceholder()},bt.prototype.isOpen=function(){return!!this._current},bt.prototype.trigger=function(e,t,n="click"){if(e.preventDefault(),!t){let r=kr(e.delegateTarget||e.target,".entry",!0),o=an(r,IM);t={id:o,...this._getEntry(o)}}const i=t.action;if(this._emit("trigger",{entry:t,event:e})!==!1){if(Wt(i)){if(n==="click")return i(e,t)}else if(i[n])return i[n](e,t)}},bt.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 m_(e,t=[]){return Object.entries(e).map(([n,i])=>{const r={id:n,...i};return r.entries?r.entries=m_(r.entries,[...t,...g_(r.search)]):t.length&&(r.search=[...t,...g_(r.search)]),r})}function g_(e){return e?_e(e)?e:[e]:[]}function BM(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=$M(o,r,i);return a?{item:o,tokens:a}:[]}).sort(jM(i))}function $M(e,t,n){const{matchedWords:i,tokens:r}=n.reduce((o,a)=>{const s=e[a],{tokens:c,matchedWords:u}=_e(s)?s.reduce((l,p)=>{const{tokens:f,matchedWords:d}=x_(p,t);return{tokens:[...l.tokens,f],matchedWords:{...l.matchedWords,...d}}},{matchedWords:{},tokens:[]}):x_(s,t);return{tokens:{...o.tokens,[a]:c},matchedWords:{...o.matchedWords,...u}}},{matchedWords:{},tokens:{}});return Object.keys(i).length!==t.length?null:r}function jM(e){return(t,n)=>{let i=0,r=1;for(const o of e){const a=FM(t.tokens[o],n.tokens[o]);if(a!==0){i+=a*r,r*=y_;continue}const s=HM(t.item[o],n.item[o]);if(s!==0){i+=s*r,r*=y_;continue}}return i}}function FM(e,t){return v_(t)-v_(e)}const y_=.5,Do={FULL:131.9,START_FULL_WORD:8,START_WORD_PART:7.87,WORD_START:2.19,WORD_PART:1,NO_MATCH:-.07};function v_(e){const t=e.reduce((s,c)=>s+__(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 __(e){if(_e(e))return Math.max(...e.map(__));const t=Math.log(e.value.length);return e.match?(e.start?e.end?Do.FULL:e.wordEnd?Do.START_FULL_WORD:Do.START_WORD_PART:e.wordStart?Do.WORD_START:Do.WORD_PART)*t:Do.NO_MATCH*t}function b_(e=""){return _e(e)?e.join(", "):e}function HM(e,t){return b_(e).localeCompare(b_(t))}function x_(e,t){var u;if(!e)return{tokens:[],matchedWords:{}};const n=[],i={},r=t.map(zM),o=[`(?<all>${r.join("\\s+")})`,...r].join("|"),a=new RegExp(o,"ig");let s,c=0;for(;s=a.exec(e);){const[l]=s,p=s.index,f=s.index+l.length,d=p===0,h=f===e.length,m=!!((u=s.groups)!=null&&u.all),g=d||/\s/.test(e.charAt(p-1)),R=h||/\s/.test(e.charAt(f));s.index>c&&n.push({value:e.slice(c,s.index),index:c}),n.push({value:l,index:s.index,match:!0,wordStart:g,wordEnd:R,start:d,end:h,all:m});const w=m?t:[l];for(const b of w)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 zM(e){return e.replace(/[/\-\\^$*+?.()|[\]{}]/g,"\\$&")}const w_={search:["value",BM]},df={__depends__:[w_],__init__:["popupMenu"],popupMenu:["type",bt]};var E_={align:`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 2000 2000">
287
+ `,this._current.container)},bt.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()},bt.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()},bt.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)}},bt.prototype.close=function(){this.isOpen()&&(this._emit("close"),this.reset(),this._canvas.restoreFocus(),this._current=null)},bt.prototype.reset=function(){const e=this._current.container;Qv(null,e),li(e)},bt.prototype._emit=function(e,t){this._eventBus.fire(`popupMenu.${e}`,t)},bt.prototype._onOpened=function(){this._emit("opened")},bt.prototype._onClosed=function(){this._emit("closed")},bt.prototype._createContainer=function(e){var t=this._canvas,n=t.getContainer();const i=ut(`<div class="djs-popup-parent djs-scrollable" data-popup=${e.provider}></div>`);return n.appendChild(i),i},bt.prototype._bindAutoClose=function(){this._eventBus.once(m_,this.close,this)},bt.prototype._unbindAutoClose=function(){this._eventBus.off(m_,this.close,this)},bt.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),$t(n)&&e<n&&(r=n),$t(i)&&e>i&&(r=i)),r},bt.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}},bt.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},bt.prototype.registerProvider=function(e,t,n){n||(n=t,t=BM),this._eventBus.on("popupMenu.getProviders."+e,t,function(i){i.providers.push(n)})},bt.prototype._getProviders=function(e){var t=this._eventBus.createEvent({type:"popupMenu.getProviders."+e,providers:[]});return this._eventBus.fire(t),t.providers},bt.prototype._getEntries=function(e,t){var n={};return k(t,function(i){if(!i.getPopupMenuEntries){k(i.getEntries(e),function(o){var a=o.id;if(!a)throw new Error("entry ID is missing");n[a]=ai(o,["id"])});return}var r=i.getPopupMenuEntries(e);Wt(r)?n=r(n):k(r,function(o,a){n[a]=o})}),n},bt.prototype._getHeaderEntries=function(e,t){var n={};return k(t,function(i){if(!i.getPopupMenuHeaderEntries){if(!i.getHeaderEntries)return;k(i.getHeaderEntries(e),function(o){var a=o.id;if(!a)throw new Error("entry ID is missing");n[a]=ai(o,["id"])});return}var r=i.getPopupMenuHeaderEntries(e);Wt(r)?n=r(n):k(r,function(o,a){n[a]=o})}),n},bt.prototype._getEmptyPlaceholder=function(e){const t=e.find(n=>Wt(n.getEmptyPlaceholder));return t&&t.getEmptyPlaceholder()},bt.prototype.isOpen=function(){return!!this._current},bt.prototype.trigger=function(e,t,n="click"){if(e.preventDefault(),!t){let r=kr(e.delegateTarget||e.target,".entry",!0),o=an(r,NM);t={id:o,...this._getEntry(o)}}const i=t.action;if(this._emit("trigger",{entry:t,event:e})!==!1){if(Wt(i)){if(n==="click")return i(e,t)}else if(i[n])return i[n](e,t)}},bt.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 g_(e,t=[]){return Object.entries(e).map(([n,i])=>{const r={id:n,...i};return r.entries?r.entries=g_(r.entries,[...t,...y_(r.search)]):t.length&&(r.search=[...t,...y_(r.search)]),r})}function y_(e){return e?_e(e)?e:[e]:[]}function $M(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=jM(o,r,i);return a?{item:o,tokens:a}:[]}).sort(FM(i))}function jM(e,t,n){const{matchedWords:i,tokens:r}=n.reduce((o,a)=>{const s=e[a],{tokens:c,matchedWords:u}=_e(s)?s.reduce((l,p)=>{const{tokens:f,matchedWords:d}=w_(p,t);return{tokens:[...l.tokens,f],matchedWords:{...l.matchedWords,...d}}},{matchedWords:{},tokens:[]}):w_(s,t);return{tokens:{...o.tokens,[a]:c},matchedWords:{...o.matchedWords,...u}}},{matchedWords:{},tokens:{}});return Object.keys(i).length!==t.length?null:r}function FM(e){return(t,n)=>{let i=0,r=1;for(const o of e){const a=HM(t.tokens[o],n.tokens[o]);if(a!==0){i+=a*r,r*=v_;continue}const s=zM(t.item[o],n.item[o]);if(s!==0){i+=s*r,r*=v_;continue}}return i}}function HM(e,t){return __(t)-__(e)}const v_=.5,Do={FULL:131.9,START_FULL_WORD:8,START_WORD_PART:7.87,WORD_START:2.19,WORD_PART:1,NO_MATCH:-.07};function __(e){const t=e.reduce((s,c)=>s+b_(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 b_(e){if(_e(e))return Math.max(...e.map(b_));const t=Math.log(e.value.length);return e.match?(e.start?e.end?Do.FULL:e.wordEnd?Do.START_FULL_WORD:Do.START_WORD_PART:e.wordStart?Do.WORD_START:Do.WORD_PART)*t:Do.NO_MATCH*t}function x_(e=""){return _e(e)?e.join(", "):e}function zM(e,t){return x_(e).localeCompare(x_(t))}function w_(e,t){var u;if(!e)return{tokens:[],matchedWords:{}};const n=[],i={},r=t.map(VM),o=[`(?<all>${r.join("\\s+")})`,...r].join("|"),a=new RegExp(o,"ig");let s,c=0;for(;s=a.exec(e);){const[l]=s,p=s.index,f=s.index+l.length,d=p===0,h=f===e.length,m=!!((u=s.groups)!=null&&u.all),g=d||/\s/.test(e.charAt(p-1)),R=h||/\s/.test(e.charAt(f));s.index>c&&n.push({value:e.slice(c,s.index),index:c}),n.push({value:l,index:s.index,match:!0,wordStart:g,wordEnd:R,start:d,end:h,all:m});const w=m?t:[l];for(const b of w)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 VM(e){return e.replace(/[/\-\\^$*+?.()|[\]{}]/g,"\\$&")}const E_={search:["value",$M]},df={__depends__:[E_],__init__:["popupMenu"],popupMenu:["type",bt]};var S_={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>`},VM=900;function Oo(e,t,n,i){e.registerProvider(VM,this),this._contextPad=e,this._popupMenu=t,this._translate=n,this._canvas=i}Oo.$inject=["contextPad","popupMenu","translate","canvas"],Oo.prototype.getMultiElementContextPadEntries=function(e){var t={};return this._isAllowed(e)&&O(t,this._getEntries(e)),t},Oo.prototype._isAllowed=function(e){return!this._popupMenu.isEmpty(e,"align-elements")},Oo.prototype._getEntries=function(){var e=this;return{"align-elements":{group:"align-elements",title:e._translate("Align elements"),html:`<div class="entry">${E_.align}</div>`,action:{click:function(t,n){var i=e._getMenuPosition(n);O(i,{cursor:{x:t.x,y:t.y}}),e._popupMenu.open(n,"align-elements",i)}}}}},Oo.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 GM=["left","center","right","top","middle","bottom"];function Na(e,t,n,i){this._alignElements=t,this._translate=n,this._popupMenu=e,this._rules=i,e.registerProvider("align-elements",this)}Na.$inject=["popupMenu","alignElements","translate","rules"],Na.prototype.getPopupMenuEntries=function(e){var t={};return this._isAllowed(e)&&O(t,this._getEntries(e)),t},Na.prototype._isAllowed=function(e){return this._rules.allowed("elements.align",{elements:e})},Na.prototype._getEntries=function(e){var t=this._alignElements,n=this._translate,i=this._popupMenu,r={};return M(GM,function(o){r["align-elements-"+o]={group:"align",title:n("Align elements "+o),className:"bjs-align-elements-menu-entry",imageHtml:E_[o],action:function(){t.trigger(e,o),i.close()}}}),r};function Qc(e){Yn.call(this,e)}Qc.$inject=["eventBus"],ie(Qc,Yn),Qc.prototype.init=function(){this.addRule("elements.align",function(e){var t=e.elements,n=Oe(t,function(i){return!(i.waypoints||i.host||i.labelTarget)});return n=xs(n),n.length<2?!1:n})};const WM={__depends__:[nM,Lv,df],__init__:["alignElementsContextPadProvider","alignElementsMenuProvider","bpmnAlignElements"],alignElementsContextPadProvider:["type",Oo],alignElementsMenuProvider:["type",Na],bpmnAlignElements:["type",Qc]};function Fi(e,t,n,i){X.call(this,e),this._elementRegistry=t,this._modeling=n,this._rules=i;var r=this;this.postExecuted(["shape.create"],function(o){var a=o.context,s=a.hints||{},c=a.shape,u=a.parent||a.newParent;s.autoResize!==!1&&r._expand([c],u)}),this.postExecuted(["elements.move"],function(o){var a=o.context,s=Eu(Zr(a.closure.topLevel)),c=a.hints,u=c?c.autoResize:!0;if(u!==!1){var l=Qr(s,function(p){return p.parent.id});M(l,function(p,f){_e(u)&&(p=p.filter(function(d){return st(u,Jr({id:d.id}))})),r._expand(p,f)})}}),this.postExecuted(["shape.toggleCollapse"],function(o){var a=o.context,s=a.hints,c=a.shape;s&&s.autoResize===!1||c.collapsed||r._expand(c.children||[],c)}),this.postExecuted(["shape.resize"],function(o){var a=o.context,s=a.hints,c=a.shape,u=c.parent;s&&s.autoResize===!1||u&&r._expand([c],u)})}Fi.$inject=["eventBus","elementRegistry","modeling","rules"],ie(Fi,X),Fi.prototype._getOptimalBounds=function(e,t){var n=this.getOffset(t),i=this.getPadding(t),r=ye(At(e)),o=ye(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),Ss(O({},o,a))},Fi.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(UM(i,t)){var r=YM(ni(t,["x","y","width","height"]),i);this.resize(t,i,{autoResize:r});var o=t.parent;o&&this._expand([t],o)}}},Fi.prototype.getOffset=function(e){return{top:60,bottom:60,left:100,right:100}},Fi.prototype.getPadding=function(e){return{top:2,bottom:2,left:15,right:15}},Fi.prototype.resize=function(e,t,n){this._modeling.resizeShape(e,t,null,n)};function UM(e,t){return e.x!==t.x||e.y!==t.y||e.width!==t.width||e.height!==t.height}function YM(e,t){var n="";return e=ye(e),t=ye(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 Jc(e){e.invoke(Fi,this)}Jc.$inject=["injector"],ie(Jc,Fi),Jc.prototype.resize=function(e,t,n){v(e,"bpmn:Participant")?this._modeling.resizeLane(e,t,null,n):this._modeling.resizeShape(e,t,null,n)};function Ba(e){Yn.call(this,e);var t=this;this.addRule("element.autoResize",function(n){return t.canResize(n.elements,n.target)})}Ba.$inject=["eventBus"],ie(Ba,Yn),Ba.prototype.canResize=function(e,t){return!1};function eu(e,t){Ba.call(this,e),this._modeling=t}ie(eu,Ba),eu.$inject=["eventBus","modeling"],eu.prototype.canResize=function(e,t){if(v(t.di,"bpmndi:BPMNPlane")||!v(t,"bpmn:Participant")&&!v(t,"bpmn:Lane")&&!v(t,"bpmn:SubProcess"))return!1;var n=!0;return M(e,function(i){if(v(i,"bpmn:Lane")||Me(i)){n=!1;return}}),n};const qM={__init__:["bpmnAutoResize","bpmnAutoResizeProvider"],bpmnAutoResize:["type",Jc],bpmnAutoResizeProvider:["type",eu]};function Lo(e,t,n){this._canvas=n,this._opts=O({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()})}Lo.$inject=["config.autoScroll","eventBus","canvas"],Lo.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++)KM(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 KM(e,t,n){return t<e&&e<n}Lo.prototype.stopScroll=function(){clearTimeout(this._scrolling)},Lo.prototype.setOptions=function(e){this._opts=O({},this._opts,e)},Lo.prototype._toBorderPoint=function(e){var t=this._canvas._container.getBoundingClientRect(),n=Br(e.originalEvent);return{x:n.x-t.left,y:n.y-t.top}};const XM={__depends__:[Li],__init__:["autoScroll"],autoScroll:["type",Lo]};var S_="djs-bendpoint",R_="djs-segment-dragger";function ZM(e,t){var n=Br(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 hf(e,t,n){var i=ZM(e,n),r=Dl(t,i);return r}function mf(e,t){var n=me("g");je(n).add(S_),Re(e,n);var i=me("circle");re(i,{cx:0,cy:0,r:4}),je(i).add("djs-visual"),Re(n,i);var r=me("circle");return re(r,{cx:0,cy:0,r:10}),je(r).add("djs-hit"),Re(n,r),t&&je(n).add(t),n}function QM(e,t,n,i){var r=me("g");Re(e,r);var o=18,a=6,s=11,c=e2(t,n,i),u=a+s,l=me("rect");re(l,{x:-o/2,y:-a/2,width:o,height:a}),je(l).add("djs-visual"),Re(r,l);var p=me("rect");return re(p,{x:-c/2,y:-u/2,width:c,height:u}),je(p).add("djs-hit"),Re(r,p),Qh(r,i==="v"?90:0),r}function C_(e,t,n){var i=me("g"),r=sl(t,n),o=Ai(t,n);return Re(e,i),QM(i,t,n,o),je(i).add(R_),je(i).add(o==="h"?"horizontal":"vertical"),Qt(i,r.x,r.y),i}function gf(e){return Math.abs(Math.round(e*2/3))}function JM(e,t){var n=t2(e,t);return $l(e,n)}function e2(e,t,n){var i=t.x-e.x,r=t.y-e.y;return gf(n==="h"?i:r)}function t2(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=$m(e,[a,s]);c<i&&(i=c,r=o)}return[n[r],n[r+1]]}function P_(e,t,n,i,r){function o(b,x,E){var T=b.index,L=b.point,A,j,H,N,G,fe;return T<=0||b.bendpoint?!1:(A=x[T-1],j=x[T],H=sl(A,j),N=Ai(A,j),G=Math.abs(L.x-H.x),fe=Math.abs(L.y-H.y),N&&G<=E&&fe<=E)}function a(b,x){var E=b.waypoints,T,L,A,j;return x.index<=0||x.bendpoint||(T={start:E[x.index-1],end:E[x.index]},L=Ai(T.start,T.end),!L)?null:(L==="h"?A=T.end.x-T.start.x:A=T.end.y-T.start.y,j=gf(A)/2,j)}function s(b,x){var E=x.waypoints,T=hf(t,E,b),L;if(T){L=a(x,T);var A;if(o(T,E,L)?A=r.start(b,x,T.index):A=i.start(b,x,T.index,!T.bendpoint),A!==!1)return!0}}function c(b,x,E){Se.bind(b,x,function(T){n.triggerMouseEvent(x,T,E),T.stopPropagation()})}function u(b,x){var E=t.getLayer("overlays"),T=et('.djs-bendpoints[data-element-id="'+ka(b.id)+'"]',E);return!T&&x&&(T=me("g"),re(T,{"data-element-id":b.id}),je(T).add("djs-bendpoints"),Re(E,T),c(T,"mousedown",b),c(T,"click",b),c(T,"dblclick",b)),T}function l(b,x){return et('.djs-segment-dragger[data-segment-idx="'+b+'"]',x)}function p(b,x){x.waypoints.forEach(function(E,T){var L=mf(b);Re(b,L),Qt(L,E.x,E.y)}),mf(b,"floating")}function f(b,x){for(var E=x.waypoints,T,L,A,j=1;j<E.length;j++)T=E[j-1],L=E[j],Ai(T,L)&&(A=C_(b,T,L),re(A,{"data-segment-idx":j}),c(A,"mousemove",x))}function d(b){M(ys("."+S_,b),function(x){Ft(x)})}function h(b){M(ys("."+R_,b),function(x){Ft(x)})}function m(b){var x=u(b);return x||(x=u(b,!0),p(x,b),f(x,b)),x}function g(b){var x=u(b);x&&(h(x),d(x),f(x,b),p(x,b))}function R(b,x){var E=et(".floating",b),T=x.point;E&&(Qt(E,T.x,T.y),je(E).add("positioned"))}function w(b,x,E){var T=l(x.index,b),L=E[x.index-1],A=E[x.index],j=x.point,H=sl(L,A),N=Ai(L,A),G,fe;T&&(G=n2(T),fe={x:j.x-H.x,y:j.y-H.y},N==="v"&&(fe={x:fe.y,y:fe.x}),Qt(G,fe.x,fe.y))}e.on("connection.changed",function(b){g(b.element)}),e.on("connection.remove",function(b){var x=u(b.element);x&&Ft(x)}),e.on("element.marker.update",function(b){var x=b.element,E;x.waypoints&&(E=m(x),b.add?je(E).add(b.marker):je(E).remove(b.marker))}),e.on("element.mousemove",function(b){var x=b.element,E=x.waypoints,T,L;if(E){if(T=u(x,!0),L=hf(t,E,b.originalEvent),!L)return;R(T,L),L.bendpoint||w(T,L,E)}}),e.on("element.mousedown",function(b){if(ar(b)){var x=b.originalEvent,E=b.element;if(E.waypoints)return s(x,E)}}),e.on("selection.changed",function(b){var x=b.newSelection,E=x[0];E&&E.waypoints&&m(E)}),e.on("element.hover",function(b){var x=b.element;x.waypoints&&m(x)}),e.on("element.out",function(b){var x=b.element;if(x.waypoints){var E=u(x);if(E){var T=et(".floating",E);T&&je(T).remove("positioned")}}}),e.on("element.updateId",function(b){var x=b.element,E=b.newId;if(x.waypoints){var T=u(x);T&&re(T,{"data-element-id":E})}}),this.addHandles=m,this.updateHandles=g,this.getBendpointsContainer=u,this.getSegmentDragger=l}P_.$inject=["eventBus","canvas","interactionEvents","bendpointMove","connectionSegmentMove"];function n2(e){return et(".djs-visual",e)}var A_=Math.round,Wr="reconnectStart",Ur="reconnectEnd",$a="updateWaypoints";function yf(e,t,n,i,r,o){this._injector=e,this.start=function(a,s,c,u){var l=n.getGraphics(s),p=s.source,f=s.target,d=s.waypoints,h;!u&&c===0?h=Wr:!u&&c===d.length-1?h=Ur:h=$a;var m=h===$a?"connection.updateWaypoints":"connection.reconnect",g=r.allowed(m,{connection:s,source:p,target:f});if(g===!1&&(g=r.allowed(m,{connection:s,source:f,target:p})),g!==!1)return i.init(a,"bendpoint.move",{data:{connection:s,connectionGfx:l,context:{allowed:g,bendpointIndex:c,connection:s,source:p,target:f,insert:u,type:h}}})},t.on("bendpoint.move.hover",function(a){var s=a.context,c=s.connection,u=c.source,l=c.target,p=a.hover,f=s.type;s.hover=p;var d;if(p){var h=f===$a?"connection.updateWaypoints":"connection.reconnect";if(d=s.allowed=r.allowed(h,{connection:c,source:f===Wr?p:u,target:f===Ur?p:l}),d){s.source=f===Wr?p:u,s.target=f===Ur?p:l;return}d===!1&&(d=s.allowed=r.allowed(h,{connection:c,source:f===Ur?p:l,target:f===Wr?p:u})),d&&(s.source=f===Ur?p:l,s.target=f===Wr?p:u)}}),t.on(["bendpoint.move.out","bendpoint.move.cleanup"],function(a){var s=a.context,c=s.type;s.hover=null,s.source=null,s.target=null,c!==$a&&(s.allowed=!1)}),t.on("bendpoint.move.end",function(a){var s=a.context,c=s.allowed,u=s.bendpointIndex,l=s.connection,p=s.insert,f=l.waypoints.slice(),d=s.source,h=s.target,m=s.type,g=s.hints||{},R={x:A_(a.x),y:A_(a.y)};if(!c)return!1;m===$a?(p?f.splice(u,0,R):f[u]=R,g.bendpointMove={insert:p,bendpointIndex:u},f=this.cropWaypoints(l,f),o.updateWaypoints(l,_1(f),g)):(m===Wr?(g.docking="source",tu(s)&&(g.docking="target",g.newWaypoints=f.reverse())):m===Ur&&(g.docking="target",tu(s)&&(g.docking="source",g.newWaypoints=f.reverse())),o.reconnect(l,d,h,R,g))},this)}yf.$inject=["injector","eventBus","canvas","dragging","rules","modeling"],yf.prototype.cropWaypoints=function(e,t){var n=this._injector.get("connectionDocking",!1);if(!n)return t;var i=e.waypoints;return e.waypoints=t,e.waypoints=n.getCroppedWaypoints(e),t=e.waypoints,e.waypoints=i,t};function tu(e){var t=e.hover,n=e.source,i=e.target,r=e.type;if(r===Wr)return t&&i&&t===i&&n!==i;if(r===Ur)return t&&n&&t===n&&n!==i}var i2="reconnectStart",r2="reconnectEnd",T_="updateWaypoints",ja="connect-ok",nu="connect-not-ok",M_="connect-hover",k_="djs-updating",D_="djs-dragging",O_=1100;function L_(e,t,n,i){this._injector=t;var r=t.get("connectionPreview",!1);n.on("bendpoint.move.start",function(o){var a=o.context,s=a.bendpointIndex,c=a.connection,u=a.insert,l=c.waypoints,p=l.slice();a.waypoints=l,u&&p.splice(s,0,{x:o.x,y:o.y}),c.waypoints=p;var f=a.draggerGfx=mf(i.getLayer("overlays"));je(f).add("djs-dragging"),i.addMarker(c,D_),i.addMarker(c,k_)}),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,M_),u===T_)return;s?(i.removeMarker(c,nu),i.addMarker(c,ja)):s===!1&&(i.removeMarker(c,ja),i.addMarker(c,nu))}}),n.on(["bendpoint.move.out","bendpoint.move.cleanup"],O_,function(o){var a=o.context,s=a.hover,c=a.target;s&&(i.removeMarker(s,M_),i.removeMarker(s,c?ja:nu))}),n.on("bendpoint.move.move",function(o){var a=o.context,s=a.allowed,c=a.bendpointIndex,u=a.draggerGfx,l=a.hover,p=a.type,f=a.connection,d=f.source,h=f.target,m=f.waypoints.slice(),g={x:o.x,y:o.y},R=a.hints||{},w={};r&&(R.connectionStart&&(w.connectionStart=R.connectionStart),R.connectionEnd&&(w.connectionEnd=R.connectionEnd),p===i2?tu(a)?(w.connectionEnd=w.connectionEnd||g,w.source=h,w.target=l||d,m=m.reverse()):(w.connectionStart=w.connectionStart||g,w.source=l||d,w.target=h):p===r2?tu(a)?(w.connectionStart=w.connectionStart||g,w.source=l||h,w.target=d,m=m.reverse()):(w.connectionEnd=w.connectionEnd||g,w.source=d,w.target=l||h):(w.noCropping=!0,w.noLayout=!0,m[c]=g),p===T_&&(m=e.cropWaypoints(f,m)),w.waypoints=m,r.drawPreview(a,s,w)),Qt(u,o.x,o.y)},this),n.on(["bendpoint.move.end","bendpoint.move.cancel"],O_,function(o){var a=o.context,s=a.connection,c=a.draggerGfx,u=a.hover,l=a.target,p=a.waypoints;s.waypoints=p,Ft(c),i.removeMarker(s,k_),i.removeMarker(s,D_),u&&(i.removeMarker(u,ja),i.removeMarker(u,l?ja:nu)),r&&r.cleanUp(a)})}L_.$inject=["bendpointMove","injector","eventBus","canvas"];var I_="connect-hover",N_="djs-updating";function B_(e,t,n){return vf(e,t,e[t]+n)}function vf(e,t,n){return{x:t==="x"?n:e.x,y:t==="y"?n:e.y}}function o2(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 vf(t,i,s)}function $_(e){return e==="x"?"y":"x"}function j_(e,t,n){var i,r;return e.original?e.original:(i=be(t),r=$_(n),vf(e,r,i[r]))}function F_(e,t,n,i,r,o){var a=e.get("connectionDocking",!1);this.start=function(p,f,d){var h,m=n.getGraphics(f),g=d-1,R=d,w=f.waypoints,b=w[g],x=w[R],E=hf(n,w,p),T,L,A;if(T=Ai(b,x),!!T)return L=T==="v"?"x":"y",g===0&&(b=j_(b,f.source,L)),R===w.length-1&&(x=j_(x,f.target,L)),E?A=E.point:A={x:(b.x+x.x)/2,y:(b.y+x.y)/2},h={connection:f,segmentStartIndex:g,segmentEndIndex:R,segmentStart:b,segmentEnd:x,axis:L,dragPosition:A},i.init(p,A,"connectionSegment.move",{cursor:L==="x"?"resize-ew":"resize-ns",data:{connection:f,connectionGfx:m,context:h}})};function s(p,f){if(!a)return f;var d=p.waypoints,h;return p.waypoints=f,h=a.getCroppedWaypoints(p),p.waypoints=d,h}function c(p){r.update("connection",p.connection,p.connectionGfx)}function u(p,f,d){var h=p.newWaypoints,m=p.segmentStartIndex+f,g=h[m],R=p.segmentEndIndex+f,w=h[R],b=$_(p.axis),x=o2(d,g,w,b);Qt(p.draggerGfx,x.x,x.y)}function l(p,f){var d=0,h=p.filter(function(m,g){return al(p[g-1],p[g+1],m)?(d=g<=f?d-1:d,!1):!0});return{waypoints:h,segmentOffset:d}}t.on("connectionSegment.move.start",function(p){var f=p.context,d=p.connection,h=n.getLayer("overlays");f.originalWaypoints=d.waypoints.slice(),f.draggerGfx=C_(h,f.segmentStart,f.segmentEnd),je(f.draggerGfx).add("djs-dragging"),n.addMarker(d,N_)}),t.on("connectionSegment.move.move",function(p){var f=p.context,d=f.connection,h=f.segmentStartIndex,m=f.segmentEndIndex,g=f.segmentStart,R=f.segmentEnd,w=f.axis,b=f.originalWaypoints.slice(),x=B_(g,w,p["d"+w]),E=B_(R,w,p["d"+w]),T=b.length,L=0;b[h]=x,b[m]=E;var A,j;h<2&&(A=Zt(d.source,x),h===1?A==="intersect"&&(b.shift(),b[0]=x,L--):A!=="intersect"&&(b.unshift(g),L++)),m>T-3&&(j=Zt(d.target,E),m===T-2?j==="intersect"&&(b.pop(),b[b.length-1]=E):j!=="intersect"&&b.push(R)),f.newWaypoints=d.waypoints=s(d,b),u(f,L,p),f.newSegmentStartIndex=h+L,c(p)}),t.on("connectionSegment.move.hover",function(p){p.context.hover=p.hover,n.addMarker(p.hover,I_)}),t.on(["connectionSegment.move.out","connectionSegment.move.cleanup"],function(p){var f=p.context.hover;f&&n.removeMarker(f,I_)}),t.on("connectionSegment.move.cleanup",function(p){var f=p.context,d=f.connection;f.draggerGfx&&Ft(f.draggerGfx),n.removeMarker(d,N_)}),t.on(["connectionSegment.move.cancel","connectionSegment.move.end"],function(p){var f=p.context,d=f.connection;d.waypoints=f.originalWaypoints,c(p)}),t.on("connectionSegment.move.end",function(p){var f=p.context,d=f.connection,h=f.newWaypoints,m=f.newSegmentStartIndex;h=h.map(function(E){return{original:E.original,x:Math.round(E.x),y:Math.round(E.y)}});var g=l(h,m),R=g.waypoints,w=s(d,R),b=g.segmentOffset,x={segmentMove:{segmentStartIndex:f.segmentStartIndex,newSegmentStartIndex:m+b}};o.updateWaypoints(d,w,x)})}F_.$inject=["injector","eventBus","canvas","dragging","graphicsFactory","modeling"];var a2=Math.abs,H_=Math.round;function s2(e,t,n){n=n===void 0?10:n;var i,r;for(i=0;i<t.length;i++)if(r=t[i],a2(r-e)<=n)return r}function z_(e){return{x:e.x,y:e.y}}function V_(e){return{x:e.x+e.width,y:e.y+e.height}}function Zn(e,t){return!e||isNaN(e.x)||isNaN(e.y)?t:{x:H_(e.x+e.width/2),y:H_(e.y+e.height/2)}}function Io(e,t){var n=e.snapped;return n?typeof t=="string"?n[t]:n.x&&n.y:!1}function Dt(e,t,n){if(typeof t!="string")throw new Error("axis must be in [x, y]");if(typeof n!="number"&&n!==!1)throw new Error("value must be Number or false");var i,r=e[t],o=e.snapped=e.snapped||{};return n===!1?o[t]=!1:(o[t]=!0,i=n-r,e[t]+=i,e["d"+t]+=i),r}function G_(e){return e.children||[]}var c2=Math.abs,W_=Math.round,_f=10;function U_(e){function t(o,a){if(_e(o)){for(var s=o.length;s--;)if(c2(o[s]-a)<=_f)return o[s]}else{o=+o;var c=a%o;if(c<_f)return a-c;if(c>o-_f)return a-c+o}return a}function n(o,a){if(o.waypoints)return JM(a,o);if(o.width)return{x:W_(o.width/2+o.x),y:W_(o.height/2+o.y)}}function i(o){var a=o.context,s=a.snapPoints,c=a.connection,u=c.waypoints,l=a.segmentStart,p=a.segmentStartIndex,f=a.segmentEnd,d=a.segmentEndIndex,h=a.axis;if(s)return s;var m=[u[p-1],l,f,u[d+1]];return p<2&&m.unshift(n(c.source,o)),d>u.length-3&&m.unshift(n(c.target,o)),a.snapPoints=s={horizontal:[],vertical:[]},M(m,function(g){g&&(g=g.original||g,h==="y"&&s.horizontal.push(g.y),h==="x"&&s.vertical.push(g.x))}),s}e.on("connectionSegment.move.move",1500,function(o){var a=i(o),s=o.x,c=o.y,u,l;if(a){u=t(a.vertical,s),l=t(a.horizontal,c);var p=s-u,f=c-l;O(o,{dx:o.dx-p,dy:o.dy-f,x:u,y:l}),(p||a.vertical.indexOf(s)!==-1)&&Dt(o,"x",u),(f||a.horizontal.indexOf(c)!==-1)&&Dt(o,"y",l)}});function r(o){var a=o.snapPoints,s=o.connection.waypoints,c=o.bendpointIndex;if(a)return a;var u=[s[c-1],s[c+1]];return o.snapPoints=a={horizontal:[],vertical:[]},M(u,function(l){l&&(l=l.original||l,a.horizontal.push(l.y),a.vertical.push(l.x))}),a}e.on(["connect.hover","connect.move","connect.end"],1500,function(o){var a=o.context,s=a.hover,c=s&&n(s,o);!it(s)||!c||!c.x||!c.y||(Dt(o,"x",c.x),Dt(o,"y",c.y))}),e.on(["bendpoint.move.move","bendpoint.move.end"],1500,function(o){var a=o.context,s=r(a),c=a.hover,u=c&&n(c,o),l=o.x,p=o.y,f,d;if(s){f=t(u?s.vertical.concat([u.x]):s.vertical,l),d=t(u?s.horizontal.concat([u.y]):s.horizontal,p);var h=l-f,m=p-d;O(o,{dx:o.dx-h,dy:o.dy-m,x:o.x-h,y:o.y-m}),(h||s.vertical.indexOf(l)!==-1)&&Dt(o,"x",f),(m||s.horizontal.indexOf(p)!==-1)&&Dt(o,"y",d)}})}U_.$inject=["eventBus"];const u2={__depends__:[Li,gi],__init__:["bendpoints","bendpointSnapping","bendpointMovePreview"],bendpoints:["type",P_],bendpointMove:["type",yf],bendpointMovePreview:["type",L_],connectionSegmentMove:["type",F_],bendpointSnapping:["type",U_]};function Y_(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),!Xr(l)){if(l!==!1){s.source=c,s.target=u;return}l=s.canExecute=o(c,u),!Xr(l)&&l!==!1&&(s.source=u,s.target=c)}}),e.on(["connect.out","connect.cleanup"],function(a){var s=a.context;s.hover=null,s.source=null,s.target=null,s.canExecute=!1}),e.on("connect.end",function(a){var s=a.context,c=s.canExecute,u=s.connectionStart,l={x:a.x,y:a.y},p=s.source,f=s.target;if(!c)return!1;var d=null,h={connectionStart:bf(s)?l:u,connectionEnd:bf(s)?u:l};Gt(c)&&(d=c),s.connection=n.connect(p,f,d,h)}),this.start=function(a,s,c,u){Gt(c)||(u=c,c=be(s)),t.init(a,"connect",{autoActivate:u,data:{shape:s,context:{start:s,connectionStart:c}}})}}Y_.$inject=["eventBus","dragging","modeling","rules"];function bf(e){var t=e.hover,n=e.source,i=e.target;return t&&n&&t===n&&n!==i}var l2=1100,p2=900,q_="connect-ok",K_="connect-not-ok";function X_(e,t,n){var i=e.get("connectionPreview",!1);i&&t.on("connect.move",function(r){var o=r.context,a=o.canExecute,s=o.hover,c=o.source,u=o.start,l=o.startPosition,p=o.target,f=o.connectionStart||l,d=o.connectionEnd||{x:r.x,y:r.y},h=f,m=d;bf(o)&&(h=d,m=f),i.drawPreview(o,a,{source:c||u,target:p||s,connectionStart:h,connectionEnd:m})}),t.on("connect.hover",p2,function(r){var o=r.context,a=r.hover,s=o.canExecute;s!==null&&n.addMarker(a,s?q_:K_)}),t.on(["connect.out","connect.cleanup"],l2,function(r){var o=r.hover;o&&(n.removeMarker(o,q_),n.removeMarker(o,K_))}),i&&t.on("connect.cleanup",function(r){i.cleanUp(r.context)})}X_.$inject=["injector","eventBus","canvas"];const xf={__depends__:[qn,gi,Li],__init__:["connectPreview"],connect:["type",Y_],connectPreview:["type",X_]};var f2="djs-dragger";function Hi(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)}Hi.$inject=["injector","canvas","graphicsFactory","elementFactory"],Hi.prototype.drawPreview=function(e,t,n){n=n||{};var i=e.connectionPreviewGfx,r=e.getConnection,o=n.source,a=n.target,s=n.waypoints,c=n.connectionStart,u=n.connectionEnd,l=n.noLayout,p=n.noCropping,f=n.noNoop,d,h=this;if(i||(i=e.connectionPreviewGfx=this.createConnectionPreviewGfx()),vs(i),r||(r=e.getConnection=d2(function(m,g,R){return h.getConnection(m,g,R)})),t&&(d=r(t,o,a)),!d){!f&&this.drawNoopPreview(i,n);return}d.waypoints=s||[],this._layouter&&!l&&(d.waypoints=this._layouter.layoutConnection(d,{source:o,target:a,connectionStart:c,connectionEnd:u,waypoints:n.waypoints||d.waypoints})),(!d.waypoints||!d.waypoints.length)&&(d.waypoints=[o?be(o):c,a?be(a):u]),this._connectionDocking&&(o||a)&&!p&&(d.waypoints=this._connectionDocking.getCroppedWaypoints(d,o,a)),this._graphicsFactory.drawConnection(i,d,{stroke:"var(--element-dragger-color)"})},Hi.prototype.drawNoopPreview=function(e,t){var n=t.source,i=t.target,r=t.connectionStart||be(n),o=t.connectionEnd||be(i),a=this.cropWaypoints(r,o,n,i),s=this.createNoopConnection(a[0],a[1]);Re(e,s)},Hi.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&&Jo(o,s,!0)||e,t=i&&Jo(a,s,!1)||t,[e,t]},Hi.prototype.cleanUp=function(e){e&&e.connectionPreviewGfx&&Ft(e.connectionPreviewGfx)},Hi.prototype.getConnection=function(e){var t=h2(e);return this._elementFactory.createConnection(t)},Hi.prototype.createConnectionPreviewGfx=function(){var e=me("g");return re(e,{pointerEvents:"none"}),je(e).add(f2),Re(this._canvas.getActiveLayer(),e),e},Hi.prototype.createNoopConnection=function(e,t){return Ko([e,t],{stroke:"#333",strokeDasharray:[1],strokeWidth:2,"pointer-events":"none"})};function d2(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 h2(e){return Gt(e)?e:{}}const m2={__init__:["connectionPreview"],connectionPreview:["type",Hi]},iu="complex-preview";class Z_{constructor(t,n,i){this._canvas=t,this._graphicsFactory=n,this._previewSupport=i,this._markers=[]}create(t){this.cleanUp();const{created:n=[],moved:i=[],removed:r=[],resized:o=[]}=t,a=this._canvas.getLayer(iu);n.filter(s=>!g2(s)).forEach(s=>{let c;it(s)?(c=this._graphicsFactory._createContainer("connection",me("g")),this._graphicsFactory.drawConnection(Lr(c),s)):(c=this._graphicsFactory._createContainer("shape",me("g")),this._graphicsFactory.drawShape(Lr(c),s),Qt(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);it(s)?Qt(u,c.x,c.y):Qt(u,s.x+c.x,s.y+c.y)}),r.forEach(s=>{this._previewSupport.addDragger(s,a,void 0,"djs-dragging"),this._canvas.addMarker(s,"djs-element-hidden"),this._markers.push([s,"djs-element-hidden"])}),o.forEach(({shape:s,bounds:c})=>{this._canvas.addMarker(s,"djs-hidden"),this._markers.push([s,"djs-hidden"]),this._previewSupport.addDragger(s,a,void 0,"djs-dragging");const u=this._graphicsFactory._createContainer("shape",me("g"));this._graphicsFactory.drawShape(Lr(u),s,{width:c.width,height:c.height}),Qt(u,c.x,c.y),this._previewSupport.addDragger(s,a,u)})}cleanUp(){vs(this._canvas.getLayer(iu)),this._markers.forEach(([t,n])=>this._canvas.removeMarker(t,n)),this._markers=[]}show(){this._canvas.showLayer(iu)}hide(){this._canvas.hideLayer(iu)}}Z_.$inject=["canvas","graphicsFactory","previewSupport"];function g2(e){return e.hidden}const y2={__depends__:[Ro],__init__:["complexPreview"],complexPreview:["type",Z_]},Q_=Math.round;function ru(e,t,n,i,r,o){this._complexPreview=e,this._connectionDocking=t,this._elementFactory=n,this._eventBus=i,this._layouter=r,this._rules=o}ru.prototype.create=function(e,t,n){const i=this._complexPreview,r=this._connectionDocking,o=this._elementFactory,a=this._eventBus,s=this._layouter,c=this._rules,u=o.createShape(O({type:t},n)),l=a.fire("autoPlace",{source:e,shape:u});if(!l)return;O(u,{x:l.x-Q_(u.width/2),y:l.y-Q_(u.height/2)});const p=c.allowed("connection.create",{source:e,target:u,hints:{targetParent:e.parent}});let f=null;p&&(f=o.createConnection(p),f.waypoints=s.layoutConnection(f,{source:e,target:u}),f.waypoints=r.getCroppedWaypoints(f,e,u)),i.create({created:[u,f].filter(d=>!Xr(d))})},ru.prototype.cleanUp=function(){this._complexPreview.cleanUp()},ru.$inject=["complexPreview","connectionDocking","elementFactory","eventBus","layouter","rules"];const v2={__depends__:[kc,y2,Up],__init__:["appendPreview"],appendPreview:["type",ru]};var J_=Math.min,eb=Math.max;function wf(e){e.preventDefault()}function Fa(e){e.stopPropagation()}function _2(e){return e.nodeType===Node.TEXT_NODE}function b2(e){return[].slice.call(e)}function ri(e){this.container=e.container,this.parent=ut('<div class="djs-direct-editing-parent"><div class="djs-direct-editing-content" contenteditable="true"></div></div>'),this.content=et("[contenteditable]",this.parent),this.keyHandler=e.keyHandler||function(){},this.resizeHandler=e.resizeHandler||function(){},this.focusoutHandler=e.focusoutHandler||function(){},this.autoResize=vn(this.autoResize,this),this.handlePaste=vn(this.handlePaste,this)}ri.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=ni(t,["width","height","maxWidth","maxHeight","minWidth","minHeight","left","top","backgroundColor","position","overflow","border","wordWrap","textAlign","outline","transform"]);O(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=ni(t,["fontFamily","fontSize","fontWeight","lineHeight","padding","paddingTop","paddingRight","paddingBottom","paddingLeft"]);return O(a.style,{boxSizing:"border-box",width:"100%",outline:"none",wordWrap:"break-word"},u),i.centerVertically&&O(a.style,{position:"absolute",top:"50%",transform:"translate(0, -50%)"},u),a.innerText=n,Se.bind(a,"keydown",this.keyHandler),Se.bind(a,"mousedown",Fa),Se.bind(a,"paste",r.handlePaste),Se.bind(a,"focusout",this.focusoutHandler),i.autoResize&&Se.bind(a,"input",this.autoResize),i.resizable&&this.resizable(t),s.appendChild(o),this.setSelection(a.lastChild,a.lastChild&&a.lastChild.length),o},ri.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)}},ri.prototype.insertText=function(e){e=x2(e);var t=document.execCommand("insertText",!1,e);t||this._insertTextIE(e)},ri.prototype._insertTextIE=function(e){var t=this.getSelection(),n=t.startContainer,i=t.endContainer,r=t.startOffset,o=t.endOffset,a=t.commonAncestorContainer,s=b2(a.childNodes),c,u;if(_2(a)){var l=n.textContent;n.textContent=l.substring(0,r)+e+l.substring(o),c=n,u=r+e.length}else if(n===this.content&&i===this.content){var p=document.createTextNode(e);this.content.insertBefore(p,s[r]),c=p,u=p.textContent.length}else{var f=s.indexOf(n),d=s.indexOf(i);s.forEach(function(h,m){m===f?h.textContent=n.textContent.substring(0,r)+e+i.textContent.substring(o):m>f&&m<=d&&li(h)}),c=n,u=r+e.length}c&&u!==void 0&&setTimeout(function(){self.setSelection(c,u)})},ri.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})}},ri.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=ut('<div class="djs-direct-editing-resize-handle"></div>');var s,c,u,l,p=function(h){wf(h),Fa(h),s=h.clientX,c=h.clientY;var m=t.getBoundingClientRect();u=m.width,l=m.height,Se.bind(document,"mousemove",f),Se.bind(document,"mouseup",d)},f=function(h){wf(h),Fa(h);var m=J_(eb(u+h.clientX-s,i),o),g=J_(eb(l+h.clientY-c,r),a);t.style.width=m+"px",t.style.height=g+"px",e.resizeHandler({width:u,height:l,dx:h.clientX-s,dy:h.clientY-c})},d=function(h){wf(h),Fa(h),Se.unbind(document,"mousemove",f,!1),Se.unbind(document,"mouseup",d,!1)};Se.bind(n,"mousedown",p)}O(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)},ri.prototype.destroy=function(){var e=this.parent,t=this.content,n=this.resizeHandle;t.innerText="",e.removeAttribute("style"),t.removeAttribute("style"),Se.unbind(t,"keydown",this.keyHandler),Se.unbind(t,"mousedown",Fa),Se.unbind(t,"input",this.autoResize),Se.unbind(t,"paste",this.handlePaste),Se.unbind(t,"focusout",this.focusoutHandler),n&&(n.removeAttribute("style"),li(n)),li(e)},ri.prototype.getValue=function(){return this.content.innerText.trim()},ri.prototype.getSelection=function(){var e=window.getSelection(),t=e.getRangeAt(0);return t},ri.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 x2(e){return e.replace(/\r\n|\r|\n/g,`
316
- `)}function On(e,t){this._eventBus=e,this._canvas=t,this._providers=[],this._textbox=new ri({container:t.getContainer(),keyHandler:vn(this._handleKey,this),resizeHandler:vn(this._handleResize,this),focusoutHandler:vn(this._handleFocusout,this)}),e.on(["diagram.clear","diagram.destroy"],()=>this._cleanup())}On.$inject=["eventBus","canvas"],On.prototype.registerProvider=function(e){this._providers.push(e)},On.prototype.isActive=function(e){return!!(this._active&&(!e||this._active.element===e))},On.prototype.cancel=function(){this._active&&(this._fire("cancel"),this.close())},On.prototype._fire=function(e,t){this._eventBus.fire("directEditing."+e,t||{active:this._active})},On.prototype.close=function(){this._fire("deactivate"),this._cleanup(),this._canvas.restoreFocus&&this._canvas.restoreFocus()},On.prototype._cleanup=function(){this._active&&(this._textbox.destroy(),this._active=null,this.resizable=void 0)},On.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()}},On.prototype.getValue=function(){return this._textbox.getValue()},On.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()},On.prototype._handleResize=function(e){this._fire("resize",e)},On.prototype._handleFocusout=function(e){e.relatedTarget&&this._textbox.parent.contains(e.relatedTarget)||this.complete()},On.prototype.activate=function(e){if(this.isActive()&&this.cancel(),this._eventBus.fire("directEditing.activate.allowed",{element:e})===!1)return!1;var t,n=st(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 tb={__depends__:[sc],__init__:["directEditing"],directEditing:["type",On]};function w2(e){return function(t){var n=t.target,i=Z(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===$e(e);return!o||!a||!s||!c}}const E2={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 q(e,t={}){var n=E2[e];if(!n)throw new Error("unknown popup entry <"+e+">");return{...n,actionName:"replace-with-"+e,...t}}var S2=[q("none-start-event",{actionName:"replace-with-none-start"}),q("none-intermediate-throwing"),q("none-end-event",{actionName:"replace-with-none-end"}),q("message-start"),q("timer-start"),q("conditional-start"),q("signal-start")],R2=[q("none-start-event",{actionName:"replace-with-none-start"}),q("none-intermediate-throwing"),q("none-end-event",{actionName:"replace-with-none-end"})],C2=[q("none-start-event",{actionName:"replace-with-none-start"}),q("none-intermediate-throwing",{actionName:"replace-with-none-intermediate-throw"}),q("none-end-event",{actionName:"replace-with-none-end"}),q("message-intermediate-catch"),q("message-intermediate-throw"),q("timer-intermediate-catch"),q("escalation-intermediate-throw"),q("conditional-intermediate-catch"),q("link-intermediate-catch"),q("link-intermediate-throw"),q("compensation-intermediate-throw"),q("signal-intermediate-catch"),q("signal-intermediate-throw")],P2=[q("none-start-event",{actionName:"replace-with-none-start"}),q("none-intermediate-throwing",{actionName:"replace-with-none-intermediate-throw"}),q("none-end-event",{actionName:"replace-with-none-end"}),q("message-end"),q("escalation-end"),q("error-end"),q("cancel-end"),q("compensation-end"),q("signal-end"),q("terminate-end")],A2=[q("exclusive-gateway"),q("parallel-gateway"),q("inclusive-gateway"),q("complex-gateway"),q("event-based-gateway")],T2=[q("transaction"),q("event-subprocess"),q("expanded-ad-hoc-subprocess",{actionName:"replace-with-ad-hoc-subprocess",label:"Ad-hoc sub-process"}),q("collapsed-subprocess")],M2=[q("expanded-subprocess",{actionName:"replace-with-subprocess",label:"Sub-process"}),q("transaction"),q("event-subprocess"),q("collapsed-ad-hoc-subprocess")],nb=[q("transaction"),q("expanded-subprocess",{actionName:"replace-with-subprocess",label:"Sub-process"}),q("expanded-ad-hoc-subprocess",{actionName:"replace-with-ad-hoc-subprocess",label:"Ad-hoc sub-process"}),q("event-subprocess")],k2=nb,ib=[q("task"),q("user-task"),q("service-task"),q("send-task"),q("receive-task"),q("manual-task"),q("rule-task"),q("script-task"),q("call-activity"),q("collapsed-subprocess"),q("expanded-subprocess"),q("collapsed-ad-hoc-subprocess"),q("expanded-ad-hoc-subprocess",{actionName:"replace-with-ad-hoc-subprocess"})],D2=[q("data-store-reference")],O2=[q("data-object-reference")],L2=[q("message-boundary"),q("timer-boundary"),q("escalation-boundary"),q("conditional-boundary"),q("error-boundary"),q("cancel-boundary"),q("signal-boundary"),q("compensation-boundary"),q("non-interrupting-message-boundary"),q("non-interrupting-timer-boundary"),q("non-interrupting-escalation-boundary"),q("non-interrupting-conditional-boundary"),q("non-interrupting-signal-boundary")],I2=[q("message-start"),q("timer-start"),q("conditional-start"),q("signal-start"),q("error-start"),q("escalation-start"),q("compensation-start"),q("non-interrupting-message-start"),q("non-interrupting-timer-start"),q("non-interrupting-conditional-start"),q("non-interrupting-signal-start"),q("non-interrupting-escalation-start")],N2=[{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"}],B2=[q("expanded-pool"),q("collapsed-pool",{label:function(e){var t="Empty pool/participant";return e.children&&e.children.length&&(t+=" (removes content)"),t}})],$2={"bpmn:MessageEventDefinition":[q("message-start"),q("message-intermediate-catch"),q("message-intermediate-throw"),q("message-end")],"bpmn:TimerEventDefinition":[q("timer-start"),q("timer-intermediate-catch")],"bpmn:ConditionalEventDefinition":[q("conditional-start"),q("conditional-intermediate-catch")],"bpmn:SignalEventDefinition":[q("signal-start"),q("signal-intermediate-catch"),q("signal-intermediate-throw"),q("signal-end")],"bpmn:ErrorEventDefinition":[q("error-start"),q("error-end")],"bpmn:EscalationEventDefinition":[q("escalation-start"),q("escalation-intermediate-throw"),q("escalation-end")],"bpmn:CompensateEventDefinition":[q("compensation-start"),q("compensation-intermediate-throw"),q("compensation-end")]};const rb={"start-event-non-interrupting":`
315
+ </svg>`},GM=900;function Oo(e,t,n,i){e.registerProvider(GM,this),this._contextPad=e,this._popupMenu=t,this._translate=n,this._canvas=i}Oo.$inject=["contextPad","popupMenu","translate","canvas"],Oo.prototype.getMultiElementContextPadEntries=function(e){var t={};return this._isAllowed(e)&&O(t,this._getEntries(e)),t},Oo.prototype._isAllowed=function(e){return!this._popupMenu.isEmpty(e,"align-elements")},Oo.prototype._getEntries=function(){var e=this;return{"align-elements":{group:"align-elements",title:e._translate("Align elements"),html:`<div class="entry">${S_.align}</div>`,action:{click:function(t,n){var i=e._getMenuPosition(n);O(i,{cursor:{x:t.x,y:t.y}}),e._popupMenu.open(n,"align-elements",i)}}}}},Oo.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 WM=["left","center","right","top","middle","bottom"];function Na(e,t,n,i){this._alignElements=t,this._translate=n,this._popupMenu=e,this._rules=i,e.registerProvider("align-elements",this)}Na.$inject=["popupMenu","alignElements","translate","rules"],Na.prototype.getPopupMenuEntries=function(e){var t={};return this._isAllowed(e)&&O(t,this._getEntries(e)),t},Na.prototype._isAllowed=function(e){return this._rules.allowed("elements.align",{elements:e})},Na.prototype._getEntries=function(e){var t=this._alignElements,n=this._translate,i=this._popupMenu,r={};return k(WM,function(o){r["align-elements-"+o]={group:"align",title:n("Align elements "+o),className:"bjs-align-elements-menu-entry",imageHtml:S_[o],action:function(){t.trigger(e,o),i.close()}}}),r};function Zc(e){Yn.call(this,e)}Zc.$inject=["eventBus"],ie(Zc,Yn),Zc.prototype.init=function(){this.addRule("elements.align",function(e){var t=e.elements,n=Oe(t,function(i){return!(i.waypoints||i.host||i.labelTarget)});return n=bs(n),n.length<2?!1:n})};const UM={__depends__:[iM,Iv,df],__init__:["alignElementsContextPadProvider","alignElementsMenuProvider","bpmnAlignElements"],alignElementsContextPadProvider:["type",Oo],alignElementsMenuProvider:["type",Na],bpmnAlignElements:["type",Zc]};function Fi(e,t,n,i){X.call(this,e),this._elementRegistry=t,this._modeling=n,this._rules=i;var r=this;this.postExecuted(["shape.create"],function(o){var a=o.context,s=a.hints||{},c=a.shape,u=a.parent||a.newParent;s.autoResize!==!1&&r._expand([c],u)}),this.postExecuted(["elements.move"],function(o){var a=o.context,s=Eu(Zr(a.closure.topLevel)),c=a.hints,u=c?c.autoResize:!0;if(u!==!1){var l=Qr(s,function(p){return p.parent.id});k(l,function(p,f){_e(u)&&(p=p.filter(function(d){return st(u,Jr({id:d.id}))})),r._expand(p,f)})}}),this.postExecuted(["shape.toggleCollapse"],function(o){var a=o.context,s=a.hints,c=a.shape;s&&s.autoResize===!1||c.collapsed||r._expand(c.children||[],c)}),this.postExecuted(["shape.resize"],function(o){var a=o.context,s=a.hints,c=a.shape,u=c.parent;s&&s.autoResize===!1||u&&r._expand([c],u)})}Fi.$inject=["eventBus","elementRegistry","modeling","rules"],ie(Fi,X),Fi.prototype._getOptimalBounds=function(e,t){var n=this.getOffset(t),i=this.getPadding(t),r=ye(At(e)),o=ye(t),a={};return r.top-o.top<i.top&&(a.top=r.top-n.top),r.left-o.left<i.left&&(a.left=r.left-n.left),o.right-r.right<i.right&&(a.right=r.right+n.right),o.bottom-r.bottom<i.bottom&&(a.bottom=r.bottom+n.bottom),Es(O({},o,a))},Fi.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(YM(i,t)){var r=qM(ni(t,["x","y","width","height"]),i);this.resize(t,i,{autoResize:r});var o=t.parent;o&&this._expand([t],o)}}},Fi.prototype.getOffset=function(e){return{top:60,bottom:60,left:100,right:100}},Fi.prototype.getPadding=function(e){return{top:2,bottom:2,left:15,right:15}},Fi.prototype.resize=function(e,t,n){this._modeling.resizeShape(e,t,null,n)};function YM(e,t){return e.x!==t.x||e.y!==t.y||e.width!==t.width||e.height!==t.height}function qM(e,t){var n="";return e=ye(e),t=ye(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 Qc(e){e.invoke(Fi,this)}Qc.$inject=["injector"],ie(Qc,Fi),Qc.prototype.resize=function(e,t,n){v(e,"bpmn:Participant")?this._modeling.resizeLane(e,t,null,n):this._modeling.resizeShape(e,t,null,n)};function Ba(e){Yn.call(this,e);var t=this;this.addRule("element.autoResize",function(n){return t.canResize(n.elements,n.target)})}Ba.$inject=["eventBus"],ie(Ba,Yn),Ba.prototype.canResize=function(e,t){return!1};function Jc(e,t){Ba.call(this,e),this._modeling=t}ie(Jc,Ba),Jc.$inject=["eventBus","modeling"],Jc.prototype.canResize=function(e,t){if(v(t.di,"bpmndi:BPMNPlane")||!v(t,"bpmn:Participant")&&!v(t,"bpmn:Lane")&&!v(t,"bpmn:SubProcess"))return!1;var n=!0;return k(e,function(i){if(v(i,"bpmn:Lane")||Me(i)){n=!1;return}}),n};const KM={__init__:["bpmnAutoResize","bpmnAutoResizeProvider"],bpmnAutoResize:["type",Qc],bpmnAutoResizeProvider:["type",Jc]};function Lo(e,t,n){this._canvas=n,this._opts=O({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()})}Lo.$inject=["config.autoScroll","eventBus","canvas"],Lo.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++)XM(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 XM(e,t,n){return t<e&&e<n}Lo.prototype.stopScroll=function(){clearTimeout(this._scrolling)},Lo.prototype.setOptions=function(e){this._opts=O({},this._opts,e)},Lo.prototype._toBorderPoint=function(e){var t=this._canvas._container.getBoundingClientRect(),n=Br(e.originalEvent);return{x:n.x-t.left,y:n.y-t.top}};const ZM={__depends__:[Li],__init__:["autoScroll"],autoScroll:["type",Lo]};var R_="djs-bendpoint",C_="djs-segment-dragger";function QM(e,t){var n=Br(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 hf(e,t,n){var i=QM(e,n),r=Dl(t,i);return r}function mf(e,t){var n=me("g");je(n).add(R_),Re(e,n);var i=me("circle");re(i,{cx:0,cy:0,r:4}),je(i).add("djs-visual"),Re(n,i);var r=me("circle");return re(r,{cx:0,cy:0,r:10}),je(r).add("djs-hit"),Re(n,r),t&&je(n).add(t),n}function JM(e,t,n,i){var r=me("g");Re(e,r);var o=18,a=6,s=11,c=t2(t,n,i),u=a+s,l=me("rect");re(l,{x:-o/2,y:-a/2,width:o,height:a}),je(l).add("djs-visual"),Re(r,l);var p=me("rect");return re(p,{x:-c/2,y:-u/2,width:c,height:u}),je(p).add("djs-hit"),Re(r,p),Jh(r,i==="v"?90:0),r}function P_(e,t,n){var i=me("g"),r=sl(t,n),o=Ai(t,n);return Re(e,i),JM(i,t,n,o),je(i).add(C_),je(i).add(o==="h"?"horizontal":"vertical"),Qt(i,r.x,r.y),i}function gf(e){return Math.abs(Math.round(e*2/3))}function e2(e,t){var n=n2(e,t);return $l(e,n)}function t2(e,t,n){var i=t.x-e.x,r=t.y-e.y;return gf(n==="h"?i:r)}function n2(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=jm(e,[a,s]);c<i&&(i=c,r=o)}return[n[r],n[r+1]]}function A_(e,t,n,i,r){function o(b,x,E){var T=b.index,L=b.point,A,F,z,B,G,fe;return T<=0||b.bendpoint?!1:(A=x[T-1],F=x[T],z=sl(A,F),B=Ai(A,F),G=Math.abs(L.x-z.x),fe=Math.abs(L.y-z.y),B&&G<=E&&fe<=E)}function a(b,x){var E=b.waypoints,T,L,A,F;return x.index<=0||x.bendpoint||(T={start:E[x.index-1],end:E[x.index]},L=Ai(T.start,T.end),!L)?null:(L==="h"?A=T.end.x-T.start.x:A=T.end.y-T.start.y,F=gf(A)/2,F)}function s(b,x){var E=x.waypoints,T=hf(t,E,b),L;if(T){L=a(x,T);var A;if(o(T,E,L)?A=r.start(b,x,T.index):A=i.start(b,x,T.index,!T.bendpoint),A!==!1)return!0}}function c(b,x,E){Se.bind(b,x,function(T){n.triggerMouseEvent(x,T,E),T.stopPropagation()})}function u(b,x){var E=t.getLayer("overlays"),T=et('.djs-bendpoints[data-element-id="'+ka(b.id)+'"]',E);return!T&&x&&(T=me("g"),re(T,{"data-element-id":b.id}),je(T).add("djs-bendpoints"),Re(E,T),c(T,"mousedown",b),c(T,"click",b),c(T,"dblclick",b)),T}function l(b,x){return et('.djs-segment-dragger[data-segment-idx="'+b+'"]',x)}function p(b,x){x.waypoints.forEach(function(E,T){var L=mf(b);Re(b,L),Qt(L,E.x,E.y)}),mf(b,"floating")}function f(b,x){for(var E=x.waypoints,T,L,A,F=1;F<E.length;F++)T=E[F-1],L=E[F],Ai(T,L)&&(A=P_(b,T,L),re(A,{"data-segment-idx":F}),c(A,"mousemove",x))}function d(b){k(gs("."+R_,b),function(x){Ft(x)})}function h(b){k(gs("."+C_,b),function(x){Ft(x)})}function m(b){var x=u(b);return x||(x=u(b,!0),p(x,b),f(x,b)),x}function g(b){var x=u(b);x&&(h(x),d(x),f(x,b),p(x,b))}function R(b,x){var E=et(".floating",b),T=x.point;E&&(Qt(E,T.x,T.y),je(E).add("positioned"))}function w(b,x,E){var T=l(x.index,b),L=E[x.index-1],A=E[x.index],F=x.point,z=sl(L,A),B=Ai(L,A),G,fe;T&&(G=i2(T),fe={x:F.x-z.x,y:F.y-z.y},B==="v"&&(fe={x:fe.y,y:fe.x}),Qt(G,fe.x,fe.y))}e.on("connection.changed",function(b){g(b.element)}),e.on("connection.remove",function(b){var x=u(b.element);x&&Ft(x)}),e.on("element.marker.update",function(b){var x=b.element,E;x.waypoints&&(E=m(x),b.add?je(E).add(b.marker):je(E).remove(b.marker))}),e.on("element.mousemove",function(b){var x=b.element,E=x.waypoints,T,L;if(E){if(T=u(x,!0),L=hf(t,E,b.originalEvent),!L)return;R(T,L),L.bendpoint||w(T,L,E)}}),e.on("element.mousedown",function(b){if(ar(b)){var x=b.originalEvent,E=b.element;if(E.waypoints)return s(x,E)}}),e.on("selection.changed",function(b){var x=b.newSelection,E=x[0];E&&E.waypoints&&m(E)}),e.on("element.hover",function(b){var x=b.element;x.waypoints&&m(x)}),e.on("element.out",function(b){var x=b.element;if(x.waypoints){var E=u(x);if(E){var T=et(".floating",E);T&&je(T).remove("positioned")}}}),e.on("element.updateId",function(b){var x=b.element,E=b.newId;if(x.waypoints){var T=u(x);T&&re(T,{"data-element-id":E})}}),this.addHandles=m,this.updateHandles=g,this.getBendpointsContainer=u,this.getSegmentDragger=l}A_.$inject=["eventBus","canvas","interactionEvents","bendpointMove","connectionSegmentMove"];function i2(e){return et(".djs-visual",e)}var T_=Math.round,Wr="reconnectStart",Ur="reconnectEnd",$a="updateWaypoints";function yf(e,t,n,i,r,o){this._injector=e,this.start=function(a,s,c,u){var l=n.getGraphics(s),p=s.source,f=s.target,d=s.waypoints,h;!u&&c===0?h=Wr:!u&&c===d.length-1?h=Ur:h=$a;var m=h===$a?"connection.updateWaypoints":"connection.reconnect",g=r.allowed(m,{connection:s,source:p,target:f});if(g===!1&&(g=r.allowed(m,{connection:s,source:f,target:p})),g!==!1)return i.init(a,"bendpoint.move",{data:{connection:s,connectionGfx:l,context:{allowed:g,bendpointIndex:c,connection:s,source:p,target:f,insert:u,type:h}}})},t.on("bendpoint.move.hover",function(a){var s=a.context,c=s.connection,u=c.source,l=c.target,p=a.hover,f=s.type;s.hover=p;var d;if(p){var h=f===$a?"connection.updateWaypoints":"connection.reconnect";if(d=s.allowed=r.allowed(h,{connection:c,source:f===Wr?p:u,target:f===Ur?p:l}),d){s.source=f===Wr?p:u,s.target=f===Ur?p:l;return}d===!1&&(d=s.allowed=r.allowed(h,{connection:c,source:f===Ur?p:l,target:f===Wr?p:u})),d&&(s.source=f===Ur?p:l,s.target=f===Wr?p:u)}}),t.on(["bendpoint.move.out","bendpoint.move.cleanup"],function(a){var s=a.context,c=s.type;s.hover=null,s.source=null,s.target=null,c!==$a&&(s.allowed=!1)}),t.on("bendpoint.move.end",function(a){var s=a.context,c=s.allowed,u=s.bendpointIndex,l=s.connection,p=s.insert,f=l.waypoints.slice(),d=s.source,h=s.target,m=s.type,g=s.hints||{},R={x:T_(a.x),y:T_(a.y)};if(!c)return!1;m===$a?(p?f.splice(u,0,R):f[u]=R,g.bendpointMove={insert:p,bendpointIndex:u},f=this.cropWaypoints(l,f),o.updateWaypoints(l,b1(f),g)):(m===Wr?(g.docking="source",eu(s)&&(g.docking="target",g.newWaypoints=f.reverse())):m===Ur&&(g.docking="target",eu(s)&&(g.docking="source",g.newWaypoints=f.reverse())),o.reconnect(l,d,h,R,g))},this)}yf.$inject=["injector","eventBus","canvas","dragging","rules","modeling"],yf.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 eu(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 r2="reconnectStart",o2="reconnectEnd",M_="updateWaypoints",ja="connect-ok",tu="connect-not-ok",k_="connect-hover",D_="djs-updating",O_="djs-dragging",L_=1100;function I_(e,t,n,i){this._injector=t;var r=t.get("connectionPreview",!1);n.on("bendpoint.move.start",function(o){var a=o.context,s=a.bendpointIndex,c=a.connection,u=a.insert,l=c.waypoints,p=l.slice();a.waypoints=l,u&&p.splice(s,0,{x:o.x,y:o.y}),c.waypoints=p;var f=a.draggerGfx=mf(i.getLayer("overlays"));je(f).add("djs-dragging"),i.addMarker(c,O_),i.addMarker(c,D_)}),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,k_),u===M_)return;s?(i.removeMarker(c,tu),i.addMarker(c,ja)):s===!1&&(i.removeMarker(c,ja),i.addMarker(c,tu))}}),n.on(["bendpoint.move.out","bendpoint.move.cleanup"],L_,function(o){var a=o.context,s=a.hover,c=a.target;s&&(i.removeMarker(s,k_),i.removeMarker(s,c?ja:tu))}),n.on("bendpoint.move.move",function(o){var a=o.context,s=a.allowed,c=a.bendpointIndex,u=a.draggerGfx,l=a.hover,p=a.type,f=a.connection,d=f.source,h=f.target,m=f.waypoints.slice(),g={x:o.x,y:o.y},R=a.hints||{},w={};r&&(R.connectionStart&&(w.connectionStart=R.connectionStart),R.connectionEnd&&(w.connectionEnd=R.connectionEnd),p===r2?eu(a)?(w.connectionEnd=w.connectionEnd||g,w.source=h,w.target=l||d,m=m.reverse()):(w.connectionStart=w.connectionStart||g,w.source=l||d,w.target=h):p===o2?eu(a)?(w.connectionStart=w.connectionStart||g,w.source=l||h,w.target=d,m=m.reverse()):(w.connectionEnd=w.connectionEnd||g,w.source=d,w.target=l||h):(w.noCropping=!0,w.noLayout=!0,m[c]=g),p===M_&&(m=e.cropWaypoints(f,m)),w.waypoints=m,r.drawPreview(a,s,w)),Qt(u,o.x,o.y)},this),n.on(["bendpoint.move.end","bendpoint.move.cancel"],L_,function(o){var a=o.context,s=a.connection,c=a.draggerGfx,u=a.hover,l=a.target,p=a.waypoints;s.waypoints=p,Ft(c),i.removeMarker(s,D_),i.removeMarker(s,O_),u&&(i.removeMarker(u,ja),i.removeMarker(u,l?ja:tu)),r&&r.cleanUp(a)})}I_.$inject=["bendpointMove","injector","eventBus","canvas"];var N_="connect-hover",B_="djs-updating";function $_(e,t,n){return vf(e,t,e[t]+n)}function vf(e,t,n){return{x:t==="x"?n:e.x,y:t==="y"?n:e.y}}function a2(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 vf(t,i,s)}function j_(e){return e==="x"?"y":"x"}function F_(e,t,n){var i,r;return e.original?e.original:(i=be(t),r=j_(n),vf(e,r,i[r]))}function H_(e,t,n,i,r,o){var a=e.get("connectionDocking",!1);this.start=function(p,f,d){var h,m=n.getGraphics(f),g=d-1,R=d,w=f.waypoints,b=w[g],x=w[R],E=hf(n,w,p),T,L,A;if(T=Ai(b,x),!!T)return L=T==="v"?"x":"y",g===0&&(b=F_(b,f.source,L)),R===w.length-1&&(x=F_(x,f.target,L)),E?A=E.point:A={x:(b.x+x.x)/2,y:(b.y+x.y)/2},h={connection:f,segmentStartIndex:g,segmentEndIndex:R,segmentStart:b,segmentEnd:x,axis:L,dragPosition:A},i.init(p,A,"connectionSegment.move",{cursor:L==="x"?"resize-ew":"resize-ns",data:{connection:f,connectionGfx:m,context:h}})};function s(p,f){if(!a)return f;var d=p.waypoints,h;return p.waypoints=f,h=a.getCroppedWaypoints(p),p.waypoints=d,h}function c(p){r.update("connection",p.connection,p.connectionGfx)}function u(p,f,d){var h=p.newWaypoints,m=p.segmentStartIndex+f,g=h[m],R=p.segmentEndIndex+f,w=h[R],b=j_(p.axis),x=a2(d,g,w,b);Qt(p.draggerGfx,x.x,x.y)}function l(p,f){var d=0,h=p.filter(function(m,g){return al(p[g-1],p[g+1],m)?(d=g<=f?d-1:d,!1):!0});return{waypoints:h,segmentOffset:d}}t.on("connectionSegment.move.start",function(p){var f=p.context,d=p.connection,h=n.getLayer("overlays");f.originalWaypoints=d.waypoints.slice(),f.draggerGfx=P_(h,f.segmentStart,f.segmentEnd),je(f.draggerGfx).add("djs-dragging"),n.addMarker(d,B_)}),t.on("connectionSegment.move.move",function(p){var f=p.context,d=f.connection,h=f.segmentStartIndex,m=f.segmentEndIndex,g=f.segmentStart,R=f.segmentEnd,w=f.axis,b=f.originalWaypoints.slice(),x=$_(g,w,p["d"+w]),E=$_(R,w,p["d"+w]),T=b.length,L=0;b[h]=x,b[m]=E;var A,F;h<2&&(A=Zt(d.source,x),h===1?A==="intersect"&&(b.shift(),b[0]=x,L--):A!=="intersect"&&(b.unshift(g),L++)),m>T-3&&(F=Zt(d.target,E),m===T-2?F==="intersect"&&(b.pop(),b[b.length-1]=E):F!=="intersect"&&b.push(R)),f.newWaypoints=d.waypoints=s(d,b),u(f,L,p),f.newSegmentStartIndex=h+L,c(p)}),t.on("connectionSegment.move.hover",function(p){p.context.hover=p.hover,n.addMarker(p.hover,N_)}),t.on(["connectionSegment.move.out","connectionSegment.move.cleanup"],function(p){var f=p.context.hover;f&&n.removeMarker(f,N_)}),t.on("connectionSegment.move.cleanup",function(p){var f=p.context,d=f.connection;f.draggerGfx&&Ft(f.draggerGfx),n.removeMarker(d,B_)}),t.on(["connectionSegment.move.cancel","connectionSegment.move.end"],function(p){var f=p.context,d=f.connection;d.waypoints=f.originalWaypoints,c(p)}),t.on("connectionSegment.move.end",function(p){var f=p.context,d=f.connection,h=f.newWaypoints,m=f.newSegmentStartIndex;h=h.map(function(E){return{original:E.original,x:Math.round(E.x),y:Math.round(E.y)}});var g=l(h,m),R=g.waypoints,w=s(d,R),b=g.segmentOffset,x={segmentMove:{segmentStartIndex:f.segmentStartIndex,newSegmentStartIndex:m+b}};o.updateWaypoints(d,w,x)})}H_.$inject=["injector","eventBus","canvas","dragging","graphicsFactory","modeling"];var s2=Math.abs,z_=Math.round;function c2(e,t,n){n=n===void 0?10:n;var i,r;for(i=0;i<t.length;i++)if(r=t[i],s2(r-e)<=n)return r}function V_(e){return{x:e.x,y:e.y}}function G_(e){return{x:e.x+e.width,y:e.y+e.height}}function Zn(e,t){return!e||isNaN(e.x)||isNaN(e.y)?t:{x:z_(e.x+e.width/2),y:z_(e.y+e.height/2)}}function Io(e,t){var n=e.snapped;return n?typeof t=="string"?n[t]:n.x&&n.y:!1}function Dt(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 W_(e){return e.children||[]}var u2=Math.abs,U_=Math.round,_f=10;function Y_(e){function t(o,a){if(_e(o)){for(var s=o.length;s--;)if(u2(o[s]-a)<=_f)return o[s]}else{o=+o;var c=a%o;if(c<_f)return a-c;if(c>o-_f)return a-c+o}return a}function n(o,a){if(o.waypoints)return e2(a,o);if(o.width)return{x:U_(o.width/2+o.x),y:U_(o.height/2+o.y)}}function i(o){var a=o.context,s=a.snapPoints,c=a.connection,u=c.waypoints,l=a.segmentStart,p=a.segmentStartIndex,f=a.segmentEnd,d=a.segmentEndIndex,h=a.axis;if(s)return s;var m=[u[p-1],l,f,u[d+1]];return p<2&&m.unshift(n(c.source,o)),d>u.length-3&&m.unshift(n(c.target,o)),a.snapPoints=s={horizontal:[],vertical:[]},k(m,function(g){g&&(g=g.original||g,h==="y"&&s.horizontal.push(g.y),h==="x"&&s.vertical.push(g.x))}),s}e.on("connectionSegment.move.move",1500,function(o){var a=i(o),s=o.x,c=o.y,u,l;if(a){u=t(a.vertical,s),l=t(a.horizontal,c);var p=s-u,f=c-l;O(o,{dx:o.dx-p,dy:o.dy-f,x:u,y:l}),(p||a.vertical.indexOf(s)!==-1)&&Dt(o,"x",u),(f||a.horizontal.indexOf(c)!==-1)&&Dt(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:[]},k(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);!it(s)||!c||!c.x||!c.y||(Dt(o,"x",c.x),Dt(o,"y",c.y))}),e.on(["bendpoint.move.move","bendpoint.move.end"],1500,function(o){var a=o.context,s=r(a),c=a.hover,u=c&&n(c,o),l=o.x,p=o.y,f,d;if(s){f=t(u?s.vertical.concat([u.x]):s.vertical,l),d=t(u?s.horizontal.concat([u.y]):s.horizontal,p);var h=l-f,m=p-d;O(o,{dx:o.dx-h,dy:o.dy-m,x:o.x-h,y:o.y-m}),(h||s.vertical.indexOf(l)!==-1)&&Dt(o,"x",f),(m||s.horizontal.indexOf(p)!==-1)&&Dt(o,"y",d)}})}Y_.$inject=["eventBus"];const l2={__depends__:[Li,gi],__init__:["bendpoints","bendpointSnapping","bendpointMovePreview"],bendpoints:["type",A_],bendpointMove:["type",yf],bendpointMovePreview:["type",I_],connectionSegmentMove:["type",H_],bendpointSnapping:["type",Y_]};function q_(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),!Xr(l)){if(l!==!1){s.source=c,s.target=u;return}l=s.canExecute=o(c,u),!Xr(l)&&l!==!1&&(s.source=u,s.target=c)}}),e.on(["connect.out","connect.cleanup"],function(a){var s=a.context;s.hover=null,s.source=null,s.target=null,s.canExecute=!1}),e.on("connect.end",function(a){var s=a.context,c=s.canExecute,u=s.connectionStart,l={x:a.x,y:a.y},p=s.source,f=s.target;if(!c)return!1;var d=null,h={connectionStart:bf(s)?l:u,connectionEnd:bf(s)?u:l};Gt(c)&&(d=c),s.connection=n.connect(p,f,d,h)}),this.start=function(a,s,c,u){Gt(c)||(u=c,c=be(s)),t.init(a,"connect",{autoActivate:u,data:{shape:s,context:{start:s,connectionStart:c}}})}}q_.$inject=["eventBus","dragging","modeling","rules"];function bf(e){var t=e.hover,n=e.source,i=e.target;return t&&n&&t===n&&n!==i}var p2=1100,f2=900,K_="connect-ok",X_="connect-not-ok";function Z_(e,t,n){var i=e.get("connectionPreview",!1);i&&t.on("connect.move",function(r){var o=r.context,a=o.canExecute,s=o.hover,c=o.source,u=o.start,l=o.startPosition,p=o.target,f=o.connectionStart||l,d=o.connectionEnd||{x:r.x,y:r.y},h=f,m=d;bf(o)&&(h=d,m=f),i.drawPreview(o,a,{source:c||u,target:p||s,connectionStart:h,connectionEnd:m})}),t.on("connect.hover",f2,function(r){var o=r.context,a=r.hover,s=o.canExecute;s!==null&&n.addMarker(a,s?K_:X_)}),t.on(["connect.out","connect.cleanup"],p2,function(r){var o=r.hover;o&&(n.removeMarker(o,K_),n.removeMarker(o,X_))}),i&&t.on("connect.cleanup",function(r){i.cleanUp(r.context)})}Z_.$inject=["injector","eventBus","canvas"];const xf={__depends__:[qn,gi,Li],__init__:["connectPreview"],connect:["type",q_],connectPreview:["type",Z_]};var d2="djs-dragger";function Hi(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)}Hi.$inject=["injector","canvas","graphicsFactory","elementFactory"],Hi.prototype.drawPreview=function(e,t,n){n=n||{};var i=e.connectionPreviewGfx,r=e.getConnection,o=n.source,a=n.target,s=n.waypoints,c=n.connectionStart,u=n.connectionEnd,l=n.noLayout,p=n.noCropping,f=n.noNoop,d,h=this;if(i||(i=e.connectionPreviewGfx=this.createConnectionPreviewGfx()),ys(i),r||(r=e.getConnection=h2(function(m,g,R){return h.getConnection(m,g,R)})),t&&(d=r(t,o,a)),!d){!f&&this.drawNoopPreview(i,n);return}d.waypoints=s||[],this._layouter&&!l&&(d.waypoints=this._layouter.layoutConnection(d,{source:o,target:a,connectionStart:c,connectionEnd:u,waypoints:n.waypoints||d.waypoints})),(!d.waypoints||!d.waypoints.length)&&(d.waypoints=[o?be(o):c,a?be(a):u]),this._connectionDocking&&(o||a)&&!p&&(d.waypoints=this._connectionDocking.getCroppedWaypoints(d,o,a)),this._graphicsFactory.drawConnection(i,d,{stroke:"var(--element-dragger-color)"})},Hi.prototype.drawNoopPreview=function(e,t){var n=t.source,i=t.target,r=t.connectionStart||be(n),o=t.connectionEnd||be(i),a=this.cropWaypoints(r,o,n,i),s=this.createNoopConnection(a[0],a[1]);Re(e,s)},Hi.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&&Jo(o,s,!0)||e,t=i&&Jo(a,s,!1)||t,[e,t]},Hi.prototype.cleanUp=function(e){e&&e.connectionPreviewGfx&&Ft(e.connectionPreviewGfx)},Hi.prototype.getConnection=function(e){var t=m2(e);return this._elementFactory.createConnection(t)},Hi.prototype.createConnectionPreviewGfx=function(){var e=me("g");return re(e,{pointerEvents:"none"}),je(e).add(d2),Re(this._canvas.getActiveLayer(),e),e},Hi.prototype.createNoopConnection=function(e,t){return Ko([e,t],{stroke:"#333",strokeDasharray:[1],strokeWidth:2,"pointer-events":"none"})};function h2(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 m2(e){return Gt(e)?e:{}}const g2={__init__:["connectionPreview"],connectionPreview:["type",Hi]},nu="complex-preview";class Q_{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(nu);n.filter(s=>!y2(s)).forEach(s=>{let c;it(s)?(c=this._graphicsFactory._createContainer("connection",me("g")),this._graphicsFactory.drawConnection(Lr(c),s)):(c=this._graphicsFactory._createContainer("shape",me("g")),this._graphicsFactory.drawShape(Lr(c),s),Qt(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);it(s)?Qt(u,c.x,c.y):Qt(u,s.x+c.x,s.y+c.y)}),r.forEach(s=>{this._previewSupport.addDragger(s,a,void 0,"djs-dragging"),this._canvas.addMarker(s,"djs-element-hidden"),this._markers.push([s,"djs-element-hidden"])}),o.forEach(({shape:s,bounds:c})=>{this._canvas.addMarker(s,"djs-hidden"),this._markers.push([s,"djs-hidden"]),this._previewSupport.addDragger(s,a,void 0,"djs-dragging");const u=this._graphicsFactory._createContainer("shape",me("g"));this._graphicsFactory.drawShape(Lr(u),s,{width:c.width,height:c.height}),Qt(u,c.x,c.y),this._previewSupport.addDragger(s,a,u)})}cleanUp(){ys(this._canvas.getLayer(nu)),this._markers.forEach(([t,n])=>this._canvas.removeMarker(t,n)),this._markers=[]}show(){this._canvas.showLayer(nu)}hide(){this._canvas.hideLayer(nu)}}Q_.$inject=["canvas","graphicsFactory","previewSupport"];function y2(e){return e.hidden}const v2={__depends__:[Ro],__init__:["complexPreview"],complexPreview:["type",Q_]},J_=Math.round;function iu(e,t,n,i,r,o){this._complexPreview=e,this._connectionDocking=t,this._elementFactory=n,this._eventBus=i,this._layouter=r,this._rules=o}iu.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(O({type:t},n)),l=a.fire("autoPlace",{source:e,shape:u});if(!l)return;O(u,{x:l.x-J_(u.width/2),y:l.y-J_(u.height/2)});const p=c.allowed("connection.create",{source:e,target:u,hints:{targetParent:e.parent}});let f=null;p&&(f=o.createConnection(p),f.waypoints=s.layoutConnection(f,{source:e,target:u}),f.waypoints=r.getCroppedWaypoints(f,e,u)),i.create({created:[u,f].filter(d=>!Xr(d))})},iu.prototype.cleanUp=function(){this._complexPreview.cleanUp()},iu.$inject=["complexPreview","connectionDocking","elementFactory","eventBus","layouter","rules"];const _2={__depends__:[Mc,v2,Up],__init__:["appendPreview"],appendPreview:["type",iu]};var eb=Math.min,tb=Math.max;function wf(e){e.preventDefault()}function Fa(e){e.stopPropagation()}function b2(e){return e.nodeType===Node.TEXT_NODE}function x2(e){return[].slice.call(e)}function ri(e){this.container=e.container,this.parent=ut('<div class="djs-direct-editing-parent"><div class="djs-direct-editing-content" contenteditable="true"></div></div>'),this.content=et("[contenteditable]",this.parent),this.keyHandler=e.keyHandler||function(){},this.resizeHandler=e.resizeHandler||function(){},this.focusoutHandler=e.focusoutHandler||function(){},this.autoResize=vn(this.autoResize,this),this.handlePaste=vn(this.handlePaste,this)}ri.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=ni(t,["width","height","maxWidth","maxHeight","minWidth","minHeight","left","top","backgroundColor","position","overflow","border","wordWrap","textAlign","outline","transform"]);O(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=ni(t,["fontFamily","fontSize","fontWeight","lineHeight","padding","paddingTop","paddingRight","paddingBottom","paddingLeft"]);return O(a.style,{boxSizing:"border-box",width:"100%",outline:"none",wordWrap:"break-word"},u),i.centerVertically&&O(a.style,{position:"absolute",top:"50%",transform:"translate(0, -50%)"},u),a.innerText=n,Se.bind(a,"keydown",this.keyHandler),Se.bind(a,"mousedown",Fa),Se.bind(a,"paste",r.handlePaste),Se.bind(a,"focusout",this.focusoutHandler),i.autoResize&&Se.bind(a,"input",this.autoResize),i.resizable&&this.resizable(t),s.appendChild(o),this.setSelection(a.lastChild,a.lastChild&&a.lastChild.length),o},ri.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)}},ri.prototype.insertText=function(e){e=w2(e);var t=document.execCommand("insertText",!1,e);t||this._insertTextIE(e)},ri.prototype._insertTextIE=function(e){var t=this.getSelection(),n=t.startContainer,i=t.endContainer,r=t.startOffset,o=t.endOffset,a=t.commonAncestorContainer,s=x2(a.childNodes),c,u;if(b2(a)){var l=n.textContent;n.textContent=l.substring(0,r)+e+l.substring(o),c=n,u=r+e.length}else if(n===this.content&&i===this.content){var p=document.createTextNode(e);this.content.insertBefore(p,s[r]),c=p,u=p.textContent.length}else{var f=s.indexOf(n),d=s.indexOf(i);s.forEach(function(h,m){m===f?h.textContent=n.textContent.substring(0,r)+e+i.textContent.substring(o):m>f&&m<=d&&li(h)}),c=n,u=r+e.length}c&&u!==void 0&&setTimeout(function(){self.setSelection(c,u)})},ri.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})}},ri.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=ut('<div class="djs-direct-editing-resize-handle"></div>');var s,c,u,l,p=function(h){wf(h),Fa(h),s=h.clientX,c=h.clientY;var m=t.getBoundingClientRect();u=m.width,l=m.height,Se.bind(document,"mousemove",f),Se.bind(document,"mouseup",d)},f=function(h){wf(h),Fa(h);var m=eb(tb(u+h.clientX-s,i),o),g=eb(tb(l+h.clientY-c,r),a);t.style.width=m+"px",t.style.height=g+"px",e.resizeHandler({width:u,height:l,dx:h.clientX-s,dy:h.clientY-c})},d=function(h){wf(h),Fa(h),Se.unbind(document,"mousemove",f,!1),Se.unbind(document,"mouseup",d,!1)};Se.bind(n,"mousedown",p)}O(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)},ri.prototype.destroy=function(){var e=this.parent,t=this.content,n=this.resizeHandle;t.innerText="",e.removeAttribute("style"),t.removeAttribute("style"),Se.unbind(t,"keydown",this.keyHandler),Se.unbind(t,"mousedown",Fa),Se.unbind(t,"input",this.autoResize),Se.unbind(t,"paste",this.handlePaste),Se.unbind(t,"focusout",this.focusoutHandler),n&&(n.removeAttribute("style"),li(n)),li(e)},ri.prototype.getValue=function(){return this.content.innerText.trim()},ri.prototype.getSelection=function(){var e=window.getSelection(),t=e.getRangeAt(0);return t},ri.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 w2(e){return e.replace(/\r\n|\r|\n/g,`
316
+ `)}function On(e,t){this._eventBus=e,this._canvas=t,this._providers=[],this._textbox=new ri({container:t.getContainer(),keyHandler:vn(this._handleKey,this),resizeHandler:vn(this._handleResize,this),focusoutHandler:vn(this._handleFocusout,this)}),e.on(["diagram.clear","diagram.destroy"],()=>this._cleanup())}On.$inject=["eventBus","canvas"],On.prototype.registerProvider=function(e){this._providers.push(e)},On.prototype.isActive=function(e){return!!(this._active&&(!e||this._active.element===e))},On.prototype.cancel=function(){this._active&&(this._fire("cancel"),this.close())},On.prototype._fire=function(e,t){this._eventBus.fire("directEditing."+e,t||{active:this._active})},On.prototype.close=function(){this._fire("deactivate"),this._cleanup(),this._canvas.restoreFocus&&this._canvas.restoreFocus()},On.prototype._cleanup=function(){this._active&&(this._textbox.destroy(),this._active=null,this.resizable=void 0)},On.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()}},On.prototype.getValue=function(){return this._textbox.getValue()},On.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()},On.prototype._handleResize=function(e){this._fire("resize",e)},On.prototype._handleFocusout=function(e){e.relatedTarget&&this._textbox.parent.contains(e.relatedTarget)||this.complete()},On.prototype.activate=function(e){if(this.isActive()&&this.cancel(),this._eventBus.fire("directEditing.activate.allowed",{element:e})===!1)return!1;var t,n=st(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 nb={__depends__:[ac],__init__:["directEditing"],directEditing:["type",On]};function E2(e){return function(t){var n=t.target,i=Z(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===$e(e);return!o||!a||!s||!c}}const S2={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 K(e,t={}){var n=S2[e];if(!n)throw new Error("unknown popup entry <"+e+">");return{...n,actionName:"replace-with-"+e,...t}}var R2=[K("none-start-event",{actionName:"replace-with-none-start"}),K("none-intermediate-throwing"),K("none-end-event",{actionName:"replace-with-none-end"}),K("message-start"),K("timer-start"),K("conditional-start"),K("signal-start")],C2=[K("none-start-event",{actionName:"replace-with-none-start"}),K("none-intermediate-throwing"),K("none-end-event",{actionName:"replace-with-none-end"})],P2=[K("none-start-event",{actionName:"replace-with-none-start"}),K("none-intermediate-throwing",{actionName:"replace-with-none-intermediate-throw"}),K("none-end-event",{actionName:"replace-with-none-end"}),K("message-intermediate-catch"),K("message-intermediate-throw"),K("timer-intermediate-catch"),K("escalation-intermediate-throw"),K("conditional-intermediate-catch"),K("link-intermediate-catch"),K("link-intermediate-throw"),K("compensation-intermediate-throw"),K("signal-intermediate-catch"),K("signal-intermediate-throw")],A2=[K("none-start-event",{actionName:"replace-with-none-start"}),K("none-intermediate-throwing",{actionName:"replace-with-none-intermediate-throw"}),K("none-end-event",{actionName:"replace-with-none-end"}),K("message-end"),K("escalation-end"),K("error-end"),K("cancel-end"),K("compensation-end"),K("signal-end"),K("terminate-end")],T2=[K("exclusive-gateway"),K("parallel-gateway"),K("inclusive-gateway"),K("complex-gateway"),K("event-based-gateway")],M2=[K("transaction"),K("event-subprocess"),K("expanded-ad-hoc-subprocess",{actionName:"replace-with-ad-hoc-subprocess",label:"Ad-hoc sub-process"}),K("collapsed-subprocess")],k2=[K("expanded-subprocess",{actionName:"replace-with-subprocess",label:"Sub-process"}),K("transaction"),K("event-subprocess"),K("collapsed-ad-hoc-subprocess")],ib=[K("transaction"),K("expanded-subprocess",{actionName:"replace-with-subprocess",label:"Sub-process"}),K("expanded-ad-hoc-subprocess",{actionName:"replace-with-ad-hoc-subprocess",label:"Ad-hoc sub-process"}),K("event-subprocess")],D2=ib,rb=[K("task"),K("user-task"),K("service-task"),K("send-task"),K("receive-task"),K("manual-task"),K("rule-task"),K("script-task"),K("call-activity"),K("collapsed-subprocess"),K("expanded-subprocess"),K("collapsed-ad-hoc-subprocess"),K("expanded-ad-hoc-subprocess",{actionName:"replace-with-ad-hoc-subprocess"})],O2=[K("data-store-reference")],L2=[K("data-object-reference")],I2=[K("message-boundary"),K("timer-boundary"),K("escalation-boundary"),K("conditional-boundary"),K("error-boundary"),K("cancel-boundary"),K("signal-boundary"),K("compensation-boundary"),K("non-interrupting-message-boundary"),K("non-interrupting-timer-boundary"),K("non-interrupting-escalation-boundary"),K("non-interrupting-conditional-boundary"),K("non-interrupting-signal-boundary")],N2=[K("message-start"),K("timer-start"),K("conditional-start"),K("signal-start"),K("error-start"),K("escalation-start"),K("compensation-start"),K("non-interrupting-message-start"),K("non-interrupting-timer-start"),K("non-interrupting-conditional-start"),K("non-interrupting-signal-start"),K("non-interrupting-escalation-start")],B2=[{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"}],$2=[K("expanded-pool"),K("collapsed-pool",{label:function(e){var t="Empty pool/participant";return e.children&&e.children.length&&(t+=" (removes content)"),t}})],j2={"bpmn:MessageEventDefinition":[K("message-start"),K("message-intermediate-catch"),K("message-intermediate-throw"),K("message-end")],"bpmn:TimerEventDefinition":[K("timer-start"),K("timer-intermediate-catch")],"bpmn:ConditionalEventDefinition":[K("conditional-start"),K("conditional-intermediate-catch")],"bpmn:SignalEventDefinition":[K("signal-start"),K("signal-intermediate-catch"),K("signal-intermediate-throw"),K("signal-end")],"bpmn:ErrorEventDefinition":[K("error-start"),K("error-end")],"bpmn:EscalationEventDefinition":[K("escalation-start"),K("escalation-intermediate-throw"),K("escalation-end")],"bpmn:CompensateEventDefinition":[K("compensation-start"),K("compensation-intermediate-throw"),K("compensation-end")]};const ob={"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 Qn(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()}Qn.$inject=["bpmnFactory","popupMenu","modeling","moddle","bpmnReplace","rules","translate","moddleCopy"],Qn.prototype._register=function(){this._popupMenu.registerProvider("bpmn-replace",this)},Qn.prototype.getPopupMenuEntries=function(e){var s;var t=e.businessObject,n=this._rules,i=[],r,o=[];if(_e(e)||!n.allowed("shape.replace",{element:e}))return{};var a=w2(e);return v(t,"bpmn:DataObjectReference")?this._createEntries(e,D2):v(t,"bpmn:DataStoreReference")&&!v(e.parent,"bpmn:Collaboration")?this._createEntries(e,O2):(v(t,"bpmn:Event")&&!v(t,"bpmn:BoundaryEvent")&&(r=(s=t.get("eventDefinitions")[0])==null?void 0:s.$type,i=$2[r]||[],!cn(t.$parent)&&v(t.$parent,"bpmn:SubProcess")&&(i=Oe(i,function(c){return c.target.type!=="bpmn:StartEvent"}))),v(t,"bpmn:StartEvent")&&!v(t.$parent,"bpmn:SubProcess")?(o=Oe(S2.concat(i),a),this._createEntries(e,o)):v(t,"bpmn:Participant")?(o=Oe(B2,function(c){return $e(e)!==c.target.isExpanded}),this._createEntries(e,o)):v(t,"bpmn:StartEvent")&&cn(t.$parent)?(o=Oe(I2.concat(i),function(c){var u=c.target,l=u.isInterrupting!==!1,p=t.isInterrupting===l;return a(c)||!a(c)&&!p}),this._createEntries(e,o)):v(t,"bpmn:StartEvent")&&!cn(t.$parent)&&v(t.$parent,"bpmn:SubProcess")?(o=Oe(R2.concat(i),a),this._createEntries(e,o)):v(t,"bpmn:EndEvent")?(o=Oe(P2.concat(i),function(c){var u=c.target;return u.eventDefinitionType=="bpmn:CancelEventDefinition"&&!v(t.$parent,"bpmn:Transaction")?!1:a(c)}),this._createEntries(e,o)):v(t,"bpmn:BoundaryEvent")?(o=Oe(L2,function(c){var u=c.target;if(u.eventDefinitionType=="bpmn:CancelEventDefinition"&&!v(t.attachedToRef,"bpmn:Transaction"))return!1;var l=u.cancelActivity!==!1,p=t.cancelActivity==l;return a(c)||!a(c)&&!p}),this._createEntries(e,o)):v(t,"bpmn:IntermediateCatchEvent")||v(t,"bpmn:IntermediateThrowEvent")?(o=Oe(C2.concat(i),a),this._createEntries(e,o)):v(t,"bpmn:Gateway")?(o=Oe(A2,a),this._createEntries(e,o)):v(t,"bpmn:Transaction")?(o=Oe(nb,a),this._createEntries(e,o)):cn(t)&&$e(e)?(o=Oe(k2,a),this._createEntries(e,o)):v(t,"bpmn:AdHocSubProcess")&&$e(e)?(o=Oe(M2,a),this._createEntries(e,o)):v(t,"bpmn:SubProcess")&&$e(e)?(o=Oe(T2,a),this._createEntries(e,o)):v(t,"bpmn:SubProcess")&&!$e(e)?(o=Oe(ib,function(c){var u=c.target.type===e.type,l=c.target.isExpanded===!0;return u===l}),this._createEntries(e,o)):v(t,"bpmn:SequenceFlow")?this._createSequenceFlowEntries(e,N2):v(t,"bpmn:FlowNode")?(o=Oe(ib,a),this._createEntries(e,o)):{})},Qn.prototype.getPopupMenuHeaderEntries=function(e){var t={};return v(e,"bpmn:Activity")&&!cn(e)&&(t={...t,...this._getLoopCharacteristicsHeaderEntries(e)}),v(e,"bpmn:DataObjectReference")&&(t={...t,...this._getCollectionHeaderEntries(e)}),v(e,"bpmn:Participant")&&(t={...t,...this._getParticipantMultiplicityHeaderEntries(e)}),Jm(e)&&(t={...t,...this._getNonInterruptingHeaderEntries(e)}),t},Qn.prototype._createEntries=function(e,t){var n={},i=this;return M(t,function(r){n[r.actionName]=i._createEntry(r,e)}),n},Qn.prototype._createSequenceFlowEntries=function(e,t){var n=Z(e),i={},r=this._modeling,o=this._moddle,a=this;return M(t,function(s){switch(s.actionName){case"replace-with-default-flow":n.sourceRef.default!==n&&(v(n.sourceRef,"bpmn:ExclusiveGateway")||v(n.sourceRef,"bpmn:InclusiveGateway")||v(n.sourceRef,"bpmn:ComplexGateway")||v(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&&v(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:v(n.sourceRef,"bpmn:Activity")&&n.conditionExpression&&(i={...i,[s.actionName]:a._createEntry(s,e,function(){r.updateProperties(e,{conditionExpression:void 0})})}),(v(n.sourceRef,"bpmn:ExclusiveGateway")||v(n.sourceRef,"bpmn:InclusiveGateway")||v(n.sourceRef,"bpmn:ComplexGateway")||v(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},Qn.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}},Qn.prototype._getLoopCharacteristicsHeaderEntries=function(e){var t=this,n=this._translate;function i(u,l){if(l.active){t._modeling.updateProperties(e,{loopCharacteristics:void 0});return}var p=e.businessObject.get("loopCharacteristics");p&&v(p,l.options.loopCharacteristics)?t._modeling.updateModdleProperties(e,p,{isSequential:l.options.isSequential}):(p=t._moddle.create(l.options.loopCharacteristics,{isSequential:l.options.isSequential}),t._modeling.updateProperties(e,{loopCharacteristics:p}))}var r=Z(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"}}}},Qn.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}}},Qn.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}}},Qn.prototype._getNonInterruptingHeaderEntries=function(e){const t=this._translate,n=Z(e),i=this,r=eg(e),o=v(e,"bpmn:BoundaryEvent")?rb["intermediate-event-non-interrupting"]:rb["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 j2={__depends__:[df,by,kc],__init__:["replaceMenuProvider"],replaceMenuProvider:["type",Qn]};function Ha(e,t,n,i,r,o,a,s,c,u,l,p,f){e=e||{},i.registerProvider(this),this._contextPad=i,this._modeling=r,this._elementFactory=o,this._connect=a,this._create=s,this._popupMenu=c,this._canvas=u,this._rules=l,this._translate=p,this._eventBus=n,this._appendPreview=f,e.autoPlace!==!1&&(this._autoPlace=t.get("autoPlace",!1)),n.on("create.end",250,function(d){var h=d.context,m=h.shape;if(!(!fa(d)||!i.isOpen(m))){var g=i.getEntries(m);g.replace&&g.replace.action.click(d,m)}}),n.on("contextPad.close",function(){f.cleanUp()})}Ha.$inject=["config.contextPad","injector","eventBus","contextPad","modeling","elementFactory","connect","create","popupMenu","canvas","rules","translate","appendPreview"],Ha.prototype.getMultiElementContextPadEntries=function(e){var t=this._modeling,n={};return this._isDeleteAllowed(e)&&O(n,{delete:{group:"edit",className:"bpmn-icon-trash",title:this._translate("Delete"),action:{click:function(i,r){t.removeElements(r.slice())}}}}),n},Ha.prototype._isDeleteAllowed=function(e){var t=this._rules.allowed("elements.delete",{elements:e});return _e(t)?Rr(e,n=>t.includes(n)):t},Ha.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])&&O(l,h()),l;var p=e.businessObject;function f(b,x){r.start(b,x)}function d(b,x){n.removeElements([x])}function h(){return{delete:{group:"edit",className:"bpmn-icon-trash",title:c("Delete"),action:{click:d}}}}function m(b){var x=5,E=t.getPad(b).html,T=E.getBoundingClientRect(),L={x:T.left,y:T.bottom+x};return L}function g(b,x,E,T){function L(H,N){var G=i.createShape(O({type:b},T));o.start(H,G,{source:N})}var A=s?function(H,N){var G=i.createShape(O({type:b},T));s.append(N,G)}:L,j=s?function(H,N){return u.create(N,b,T),()=>{u.cleanUp()}}:null;return{group:"model",className:x,title:E,action:{dragstart:L,click:A,hover:j}}}function R(b){return function(x,E){n.splitLane(E,b),t.open(E,!0)}}if(De(p,["bpmn:Lane","bpmn:Participant"])&&$e(e)){var w=rr(e);O(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")}}}}),w.length<2&&((Yt(e)?e.height>=120:e.width>=120)&&O(l,{"lane-divide-two":{group:"lane-divide",className:"bpmn-icon-lane-divide-two",title:c("Divide into two lanes"),action:{click:R(2)}}}),(Yt(e)?e.height>=180:e.width>=180)&&O(l,{"lane-divide-three":{group:"lane-divide",className:"bpmn-icon-lane-divide-three",title:c("Divide into three lanes"),action:{click:R(3)}}})),O(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 v(p,"bpmn:FlowNode")&&(v(p,"bpmn:EventBasedGateway")?O(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"})}):ob(p,"bpmn:BoundaryEvent","bpmn:CompensateEventDefinition")?O(l,{"append.compensation-activity":g("bpmn:Task","bpmn-icon-task",c("Append compensation activity"),{isForCompensation:!0})}):!v(p,"bpmn:EndEvent")&&!p.isForCompensation&&!ob(p,"bpmn:IntermediateThrowEvent","bpmn:LinkEventDefinition")&&!cn(p)&&O(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")||O(l,{replace:{group:"edit",className:"bpmn-icon-screw-wrench",title:c("Change element"),action:{click:function(b,x){var E=O(m(x),{cursor:{x:b.x,y:b.y}});a.open(x,"bpmn-replace",E,{title:c("Change element"),width:"var(--bpmn-replace-popup-width, 300px)",search:!0})}}}}),v(p,"bpmn:SequenceFlow")&&O(l,{"append.text-annotation":g("bpmn:TextAnnotation","bpmn-icon-text-annotation",c("Add text annotation"))}),v(p,"bpmn:MessageFlow")&&O(l,{"append.text-annotation":g("bpmn:TextAnnotation","bpmn-icon-text-annotation",c("Add text annotation"))}),De(p,["bpmn:FlowNode","bpmn:InteractionNode","bpmn:DataObjectReference","bpmn:DataStoreReference"])&&O(l,{"append.text-annotation":g("bpmn:TextAnnotation","bpmn-icon-text-annotation",c("Add text annotation")),connect:{group:"connect",className:"bpmn-icon-connection-multi",title:c("Connect to other element"),action:{click:f,dragstart:f}}}),v(p,"bpmn:TextAnnotation")&&O(l,{connect:{group:"connect",className:"bpmn-icon-connection-multi",title:c("Connect using association"),action:{click:f,dragstart:f}}}),De(p,["bpmn:DataObjectReference","bpmn:DataStoreReference"])&&O(l,{connect:{group:"connect",className:"bpmn-icon-connection-multi",title:c("Connect using data input association"),action:{click:f,dragstart:f}}}),v(p,"bpmn:Group")&&O(l,{"append.text-annotation":g("bpmn:TextAnnotation","bpmn-icon-text-annotation",c("Add text annotation"))}),this._isDeleteAllowed([e])&&O(l,h()),l};function ob(e,t,n){var i=e.$instanceOf(t),r=!1,o=e.eventDefinitions||[];return M(o,function(a){a.$type===n&&(r=!0)}),i&&r}const F2={__depends__:[v2,tb,Lv,qn,xf,uc,j2],__init__:["contextPadProvider"],contextPadProvider:["type",Ha]};var H2={horizontal:["x","width"],vertical:["y","height"]},ab=5;function zi(e,t){this._modeling=e,this._filters=[],this.registerFilter(function(n){var i=t.allowed("elements.distribute",{elements:n});return _e(i)?i:i?n:[]})}zi.$inject=["modeling","rules"],zi.prototype.registerFilter=function(e){if(typeof e!="function")throw new Error("the filter has to be a function");this._filters.push(e)},zi.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},zi.prototype._filterElements=function(e){var t=this._filters,n=this._axis,i=this._dimension,r=[].concat(e);return t.length?(M(t,function(o){r=o(r,n,i)}),r):e},zi.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=oi(e,i);return M(o,function(a,s){var c=n._findRange(a,i,r),u,l=t[t.length-1];l&&n._hasIntersection(l.range,c)?t[t.length-1].elements.push(a):(u={range:c,elements:[a]},t.push(u))}),t},zi.prototype._setOrientation=function(e){var t=H2[e];this._axis=t[0],this._dimension=t[1]},zi.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)},zi.prototype._findRange=function(e){var t=e[this._axis],n=e[this._dimension];return{min:t+ab,max:t+n-ab}};const z2={__init__:["distributeElements"],distributeElements:["type",zi]};function ou(e){Yn.call(this,e)}ou.$inject=["eventBus"],ie(ou,Yn),ou.prototype.init=function(){this.addRule("elements.distribute",function(e){var t=e.elements;return t=Oe(t,function(n){var i=De(n,["bpmn:Association","bpmn:BoundaryEvent","bpmn:DataInputAssociation","bpmn:DataOutputAssociation","bpmn:Lane","bpmn:MessageFlow","bpmn:SequenceFlow","bpmn:TextAnnotation"]);return!(n.labelTarget||i)}),t=xs(t),t.length<3?!1:t})};var sb={horizontal:`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1800 1800">
327
+ </svg>`};function Qn(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()}Qn.$inject=["bpmnFactory","popupMenu","modeling","moddle","bpmnReplace","rules","translate","moddleCopy"],Qn.prototype._register=function(){this._popupMenu.registerProvider("bpmn-replace",this)},Qn.prototype.getPopupMenuEntries=function(e){var s;var t=e.businessObject,n=this._rules,i=[],r,o=[];if(_e(e)||!n.allowed("shape.replace",{element:e}))return{};var a=E2(e);return v(t,"bpmn:DataObjectReference")?this._createEntries(e,O2):v(t,"bpmn:DataStoreReference")&&!v(e.parent,"bpmn:Collaboration")?this._createEntries(e,L2):(v(t,"bpmn:Event")&&!v(t,"bpmn:BoundaryEvent")&&(r=(s=t.get("eventDefinitions")[0])==null?void 0:s.$type,i=j2[r]||[],!cn(t.$parent)&&v(t.$parent,"bpmn:SubProcess")&&(i=Oe(i,function(c){return c.target.type!=="bpmn:StartEvent"}))),v(t,"bpmn:StartEvent")&&!v(t.$parent,"bpmn:SubProcess")?(o=Oe(R2.concat(i),a),this._createEntries(e,o)):v(t,"bpmn:Participant")?(o=Oe($2,function(c){return $e(e)!==c.target.isExpanded}),this._createEntries(e,o)):v(t,"bpmn:StartEvent")&&cn(t.$parent)?(o=Oe(N2.concat(i),function(c){var u=c.target,l=u.isInterrupting!==!1,p=t.isInterrupting===l;return a(c)||!a(c)&&!p}),this._createEntries(e,o)):v(t,"bpmn:StartEvent")&&!cn(t.$parent)&&v(t.$parent,"bpmn:SubProcess")?(o=Oe(C2.concat(i),a),this._createEntries(e,o)):v(t,"bpmn:EndEvent")?(o=Oe(A2.concat(i),function(c){var u=c.target;return u.eventDefinitionType=="bpmn:CancelEventDefinition"&&!v(t.$parent,"bpmn:Transaction")?!1:a(c)}),this._createEntries(e,o)):v(t,"bpmn:BoundaryEvent")?(o=Oe(I2,function(c){var u=c.target;if(u.eventDefinitionType=="bpmn:CancelEventDefinition"&&!v(t.attachedToRef,"bpmn:Transaction"))return!1;var l=u.cancelActivity!==!1,p=t.cancelActivity==l;return a(c)||!a(c)&&!p}),this._createEntries(e,o)):v(t,"bpmn:IntermediateCatchEvent")||v(t,"bpmn:IntermediateThrowEvent")?(o=Oe(P2.concat(i),a),this._createEntries(e,o)):v(t,"bpmn:Gateway")?(o=Oe(T2,a),this._createEntries(e,o)):v(t,"bpmn:Transaction")?(o=Oe(ib,a),this._createEntries(e,o)):cn(t)&&$e(e)?(o=Oe(D2,a),this._createEntries(e,o)):v(t,"bpmn:AdHocSubProcess")&&$e(e)?(o=Oe(k2,a),this._createEntries(e,o)):v(t,"bpmn:SubProcess")&&$e(e)?(o=Oe(M2,a),this._createEntries(e,o)):v(t,"bpmn:SubProcess")&&!$e(e)?(o=Oe(rb,function(c){var u=c.target.type===e.type,l=c.target.isExpanded===!0;return u===l}),this._createEntries(e,o)):v(t,"bpmn:SequenceFlow")?this._createSequenceFlowEntries(e,B2):v(t,"bpmn:FlowNode")?(o=Oe(rb,a),this._createEntries(e,o)):{})},Qn.prototype.getPopupMenuHeaderEntries=function(e){var t={};return v(e,"bpmn:Activity")&&!cn(e)&&(t={...t,...this._getLoopCharacteristicsHeaderEntries(e)}),v(e,"bpmn:DataObjectReference")&&(t={...t,...this._getCollectionHeaderEntries(e)}),v(e,"bpmn:Participant")&&(t={...t,...this._getParticipantMultiplicityHeaderEntries(e)}),eg(e)&&(t={...t,...this._getNonInterruptingHeaderEntries(e)}),t},Qn.prototype._createEntries=function(e,t){var n={},i=this;return k(t,function(r){n[r.actionName]=i._createEntry(r,e)}),n},Qn.prototype._createSequenceFlowEntries=function(e,t){var n=Z(e),i={},r=this._modeling,o=this._moddle,a=this;return k(t,function(s){switch(s.actionName){case"replace-with-default-flow":n.sourceRef.default!==n&&(v(n.sourceRef,"bpmn:ExclusiveGateway")||v(n.sourceRef,"bpmn:InclusiveGateway")||v(n.sourceRef,"bpmn:ComplexGateway")||v(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&&v(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:v(n.sourceRef,"bpmn:Activity")&&n.conditionExpression&&(i={...i,[s.actionName]:a._createEntry(s,e,function(){r.updateProperties(e,{conditionExpression:void 0})})}),(v(n.sourceRef,"bpmn:ExclusiveGateway")||v(n.sourceRef,"bpmn:InclusiveGateway")||v(n.sourceRef,"bpmn:ComplexGateway")||v(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},Qn.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}},Qn.prototype._getLoopCharacteristicsHeaderEntries=function(e){var t=this,n=this._translate;function i(u,l){if(l.active){t._modeling.updateProperties(e,{loopCharacteristics:void 0});return}var p=e.businessObject.get("loopCharacteristics");p&&v(p,l.options.loopCharacteristics)?t._modeling.updateModdleProperties(e,p,{isSequential:l.options.isSequential}):(p=t._moddle.create(l.options.loopCharacteristics,{isSequential:l.options.isSequential}),t._modeling.updateProperties(e,{loopCharacteristics:p}))}var r=Z(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"}}}},Qn.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}}},Qn.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}}},Qn.prototype._getNonInterruptingHeaderEntries=function(e){const t=this._translate,n=Z(e),i=this,r=tg(e),o=v(e,"bpmn:BoundaryEvent")?ob["intermediate-event-non-interrupting"]:ob["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 F2={__depends__:[df,xy,Mc],__init__:["replaceMenuProvider"],replaceMenuProvider:["type",Qn]};function Ha(e,t,n,i,r,o,a,s,c,u,l,p,f){e=e||{},i.registerProvider(this),this._contextPad=i,this._modeling=r,this._elementFactory=o,this._connect=a,this._create=s,this._popupMenu=c,this._canvas=u,this._rules=l,this._translate=p,this._eventBus=n,this._appendPreview=f,e.autoPlace!==!1&&(this._autoPlace=t.get("autoPlace",!1)),n.on("create.end",250,function(d){var h=d.context,m=h.shape;if(!(!fa(d)||!i.isOpen(m))){var g=i.getEntries(m);g.replace&&g.replace.action.click(d,m)}}),n.on("contextPad.close",function(){f.cleanUp()})}Ha.$inject=["config.contextPad","injector","eventBus","contextPad","modeling","elementFactory","connect","create","popupMenu","canvas","rules","translate","appendPreview"],Ha.prototype.getMultiElementContextPadEntries=function(e){var t=this._modeling,n={};return this._isDeleteAllowed(e)&&O(n,{delete:{group:"edit",className:"bpmn-icon-trash",title:this._translate("Delete"),action:{click:function(i,r){t.removeElements(r.slice())}}}}),n},Ha.prototype._isDeleteAllowed=function(e){var t=this._rules.allowed("elements.delete",{elements:e});return _e(t)?Rr(e,n=>t.includes(n)):t},Ha.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])&&O(l,h()),l;var p=e.businessObject;function f(b,x){r.start(b,x)}function d(b,x){n.removeElements([x])}function h(){return{delete:{group:"edit",className:"bpmn-icon-trash",title:c("Delete"),action:{click:d}}}}function m(b){var x=5,E=t.getPad(b).html,T=E.getBoundingClientRect(),L={x:T.left,y:T.bottom+x};return L}function g(b,x,E,T){function L(z,B){var G=i.createShape(O({type:b},T));o.start(z,G,{source:B})}var A=s?function(z,B){var G=i.createShape(O({type:b},T));s.append(B,G)}:L,F=s?function(z,B){return u.create(B,b,T),()=>{u.cleanUp()}}:null;return{group:"model",className:x,title:E,action:{dragstart:L,click:A,hover:F}}}function R(b){return function(x,E){n.splitLane(E,b),t.open(E,!0)}}if(De(p,["bpmn:Lane","bpmn:Participant"])&&$e(e)){var w=rr(e);O(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")}}}}),w.length<2&&((Yt(e)?e.height>=120:e.width>=120)&&O(l,{"lane-divide-two":{group:"lane-divide",className:"bpmn-icon-lane-divide-two",title:c("Divide into two lanes"),action:{click:R(2)}}}),(Yt(e)?e.height>=180:e.width>=180)&&O(l,{"lane-divide-three":{group:"lane-divide",className:"bpmn-icon-lane-divide-three",title:c("Divide into three lanes"),action:{click:R(3)}}})),O(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 v(p,"bpmn:FlowNode")&&(v(p,"bpmn:EventBasedGateway")?O(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"})}):ab(p,"bpmn:BoundaryEvent","bpmn:CompensateEventDefinition")?O(l,{"append.compensation-activity":g("bpmn:Task","bpmn-icon-task",c("Append compensation activity"),{isForCompensation:!0})}):!v(p,"bpmn:EndEvent")&&!p.isForCompensation&&!ab(p,"bpmn:IntermediateThrowEvent","bpmn:LinkEventDefinition")&&!cn(p)&&O(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")||O(l,{replace:{group:"edit",className:"bpmn-icon-screw-wrench",title:c("Change element"),action:{click:function(b,x){var E=O(m(x),{cursor:{x:b.x,y:b.y}});a.open(x,"bpmn-replace",E,{title:c("Change element"),width:"var(--bpmn-replace-popup-width, 300px)",search:!0})}}}}),v(p,"bpmn:SequenceFlow")&&O(l,{"append.text-annotation":g("bpmn:TextAnnotation","bpmn-icon-text-annotation",c("Add text annotation"))}),v(p,"bpmn:MessageFlow")&&O(l,{"append.text-annotation":g("bpmn:TextAnnotation","bpmn-icon-text-annotation",c("Add text annotation"))}),De(p,["bpmn:FlowNode","bpmn:InteractionNode","bpmn:DataObjectReference","bpmn:DataStoreReference"])&&O(l,{"append.text-annotation":g("bpmn:TextAnnotation","bpmn-icon-text-annotation",c("Add text annotation")),connect:{group:"connect",className:"bpmn-icon-connection-multi",title:c("Connect to other element"),action:{click:f,dragstart:f}}}),v(p,"bpmn:TextAnnotation")&&O(l,{connect:{group:"connect",className:"bpmn-icon-connection-multi",title:c("Connect using association"),action:{click:f,dragstart:f}}}),De(p,["bpmn:DataObjectReference","bpmn:DataStoreReference"])&&O(l,{connect:{group:"connect",className:"bpmn-icon-connection-multi",title:c("Connect using data input association"),action:{click:f,dragstart:f}}}),v(p,"bpmn:Group")&&O(l,{"append.text-annotation":g("bpmn:TextAnnotation","bpmn-icon-text-annotation",c("Add text annotation"))}),this._isDeleteAllowed([e])&&O(l,h()),l};function ab(e,t,n){var i=e.$instanceOf(t),r=!1,o=e.eventDefinitions||[];return k(o,function(a){a.$type===n&&(r=!0)}),i&&r}const H2={__depends__:[_2,nb,Iv,qn,xf,cc,F2],__init__:["contextPadProvider"],contextPadProvider:["type",Ha]};var z2={horizontal:["x","width"],vertical:["y","height"]},sb=5;function zi(e,t){this._modeling=e,this._filters=[],this.registerFilter(function(n){var i=t.allowed("elements.distribute",{elements:n});return _e(i)?i:i?n:[]})}zi.$inject=["modeling","rules"],zi.prototype.registerFilter=function(e){if(typeof e!="function")throw new Error("the filter has to be a function");this._filters.push(e)},zi.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},zi.prototype._filterElements=function(e){var t=this._filters,n=this._axis,i=this._dimension,r=[].concat(e);return t.length?(k(t,function(o){r=o(r,n,i)}),r):e},zi.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=oi(e,i);return k(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},zi.prototype._setOrientation=function(e){var t=z2[e];this._axis=t[0],this._dimension=t[1]},zi.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)},zi.prototype._findRange=function(e){var t=e[this._axis],n=e[this._dimension];return{min:t+sb,max:t+n-sb}};const V2={__init__:["distributeElements"],distributeElements:["type",zi]};function ru(e){Yn.call(this,e)}ru.$inject=["eventBus"],ie(ru,Yn),ru.prototype.init=function(){this.addRule("elements.distribute",function(e){var t=e.elements;return t=Oe(t,function(n){var i=De(n,["bpmn:Association","bpmn:BoundaryEvent","bpmn:DataInputAssociation","bpmn:DataOutputAssociation","bpmn:Lane","bpmn:MessageFlow","bpmn:SequenceFlow","bpmn:TextAnnotation"]);return!(n.labelTarget||i)}),t=bs(t),t.length<3?!1:t})};var cb={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>`},V2=900;function za(e,t,n,i){this._distributeElements=t,this._translate=n,this._popupMenu=e,this._rules=i,e.registerProvider("align-elements",V2,this)}za.$inject=["popupMenu","distributeElements","translate","rules"],za.prototype.getPopupMenuEntries=function(e){var t={};return this._isAllowed(e)&&O(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:sb.horizontal,action:function(o,a){t.trigger(e,"horizontal"),i.close()}},"distribute-elements-vertical":{group:"distribute",title:n("Distribute elements vertically"),imageHtml:sb.vertical,action:function(o,a){t.trigger(e,"vertical"),i.close()}}};return r};const G2={__depends__:[df,z2],__init__:["bpmnDistributeElements","distributeElementsMenuProvider"],bpmnDistributeElements:["type",ou],distributeElementsMenuProvider:["type",za]};var cb="is not a registered action",W2="is already registered";function Jn(e,t){this._eventBus=e,this._actions={};var n=this;e.on("diagram.init",function(){n._registerDefaultActions(t),e.fire("editorActions.init",{editorActions:n})})}Jn.$inject=["eventBus","injector"],Jn.prototype._registerDefaultActions=function(e){var t=e.get("commandStack",!1),n=e.get("modeling",!1),i=e.get("selection",!1),r=e.get("zoomScroll",!1),o=e.get("copyPaste",!1),a=e.get("canvas",!1),s=e.get("rules",!1),c=e.get("keyboardMove",!1),u=e.get("keyboardMoveSelection",!1);t&&(this.register("undo",function(){t.undo()}),this.register("redo",function(){t.redo()})),o&&i&&this.register("copy",function(){var l=i.get();if(l.length)return o.copy(l)}),o&&i&&this.register("duplicate",function(){var l=i.get();if(l.length)return o.duplicate(l)}),o&&this.register("paste",function(){o.paste()}),o&&i&&s&&this.register("cut",function(){var l=i.get();if(l.length){var p=s.allowed("elements.delete",{elements:l});if(p!==!1){var f=_e(p)?p:l;return o.cut(f.slice())}}}),r&&this.register("stepZoom",function(l){r.stepZoom(l.value)}),a&&this.register("zoom",function(l){a.zoom(l.value)}),n&&i&&s&&this.register("removeSelection",function(){var l=i.get();if(l.length){var p=s.allowed("elements.delete",{elements:l}),f;p!==!1&&(_e(p)?f=p:f=l,f.length&&n.removeElements(f.slice()))}}),c&&this.register("moveCanvas",function(l){c.moveCanvas(l)}),u&&this.register("moveSelection",function(l){u.moveSelection(l.direction,l.accelerated)})},Jn.prototype.trigger=function(e,t){if(!this._actions[e])throw Ef(e,cb);var n=this._eventBus.fire("editorActions.allowed",{action:e,opts:t});if(n!==!1)return this._actions[e](t)},Jn.prototype.register=function(e,t){var n=this;if(typeof e=="string")return this._registerAction(e,t);M(e,function(i,r){n._registerAction(r,i)})},Jn.prototype._registerAction=function(e,t){if(this.isRegistered(e))throw Ef(e,W2);this._actions[e]=t},Jn.prototype.unregister=function(e){if(!this.isRegistered(e))throw Ef(e,cb);this._actions[e]=void 0},Jn.prototype.getActions=function(){return Object.keys(this._actions)},Jn.prototype.isRegistered=function(e){return!!this._actions[e]};function Ef(e,t){return new Error(e+" "+t)}const U2={__init__:["editorActions"],editorActions:["type",Jn]};function au(e){e.invoke(Jn,this)}ie(au,Jn),au.$inject=["injector"],au.prototype._registerDefaultActions=function(e){Jn.prototype._registerDefaultActions.call(this,e);var t=e.get("canvas",!1),n=e.get("elementRegistry",!1),i=e.get("selection",!1),r=e.get("spaceTool",!1),o=e.get("lassoTool",!1),a=e.get("handTool",!1),s=e.get("globalConnect",!1),c=e.get("distributeElements",!1),u=e.get("alignElements",!1),l=e.get("directEditing",!1),p=e.get("searchPad",!1),f=e.get("modeling",!1),d=e.get("contextPad",!1);t&&n&&i&&this._registerAction("selectElements",function(){var h=t.getRootElement(),m=n.filter(function(g){return g!==h});return i.select(m),m}),r&&this._registerAction("spaceTool",function(){r.toggle()}),o&&this._registerAction("lassoTool",function(){o.toggle()}),a&&this._registerAction("handTool",function(){a.toggle()}),s&&this._registerAction("globalConnectTool",function(){s.toggle()}),i&&c&&this._registerAction("distributeElements",function(h){var m=i.get(),g=h.type;m.length&&c.trigger(m,g)}),i&&u&&this._registerAction("alignElements",function(h){var m=i.get(),g=[],R=h.type;m.length&&(g=Oe(m,function(w){return!v(w,"bpmn:Lane")}),u.trigger(g,R))}),i&&f&&this._registerAction("setColor",function(h){var m=i.get();m.length&&f.setColor(m,h)}),i&&l&&this._registerAction("directEditing",function(){var h=i.get();h.length&&l.activate(h[0])}),p&&this._registerAction("find",function(){p.toggle()}),t&&f&&this._registerAction("moveToOrigin",function(){var h=t.getRootElement(),m,g;v(h,"bpmn:Collaboration")?g=n.filter(function(R){return v(R.parent,"bpmn:Collaboration")}):g=n.filter(function(R){return R!==h&&!v(R.parent,"bpmn:SubProcess")}),m=At(g),f.moveElements(g,{x:-m.x,y:-m.y},h)}),i&&d&&this._registerAction("replaceElement",function(h){d.triggerEntry("replace","click",h)})};const Y2={__depends__:[U2],editorActions:["type",au]};function ub(e){e.on(["create.init","shape.move.init"],function(t){var n=t.context,i=t.shape;De(i,["bpmn:Participant","bpmn:SubProcess","bpmn:TextAnnotation"])&&(n.gridSnappingContext||(n.gridSnappingContext={}),n.gridSnappingContext.snapLocation="top-left")})}ub.$inject=["eventBus"];function Yr(e,t){X.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;wn(a)?r.newBounds=n.snapComplex(c,a):r.newBounds=n.snapSimple(s,c)}})}Yr.$inject=["eventBus","gridSnapping","modeling"],ie(Yr,X),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),O(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),O(e,o),e};var q2=2e3;function lb(e,t){e.on(["spaceTool.move","spaceTool.end"],q2,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)}})}lb.$inject=["eventBus","gridSnapping"];const K2={__init__:["gridSnappingResizeBehavior","gridSnappingSpaceToolBehavior"],gridSnappingResizeBehavior:["type",Yr],gridSnappingSpaceToolBehavior:["type",lb]};var su=10;function Sf(e,t,n){return n||(n="round"),Math[n](e/t)*t}var X2=1200,Z2=800;function yr(e,t,n){var i=!n||n.active!==!1;this._eventBus=t;var r=this;t.on("diagram.init",Z2,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"],X2,function(o){var a=o.originalEvent;if(!(!r.active||a&&Tn(a))){var s=o.context,c=s.gridSnappingContext;c||(c=s.gridSnappingContext={}),["x","y"].forEach(function(u){var l={},p=J2(o,u,e);p&&(l.offset=p);var f=Q2(o,u);f&&O(l,f),Io(o,u)||r.snapEvent(o,u,l)})}})}yr.prototype.snapEvent=function(e,t,n){var i=this.snapValue(e[t],n);Dt(e,t,i)},yr.prototype.getGridSpacing=function(){return su},yr.prototype.snapValue=function(e,t){var n=0;t&&t.offset&&(n=t.offset),e+=n,e=Sf(e,su);var i,r;return t&&t.min&&(i=t.min,we(i)&&(i=Sf(i+n,su,"ceil"),e=Math.max(e,i))),t&&t.max&&(r=t.max,we(r)&&(r=Sf(r+n,su,"floor"),e=Math.min(e,r))),e-=n,e},yr.prototype.isActive=function(){return this.active},yr.prototype.setActive=function(e){this.active=e,this._eventBus.fire("gridSnapping.toggle",{active:e})},yr.prototype.toggleActive=function(){this.setActive(!this.active)},yr.$inject=["elementRegistry","eventBus","config.gridSnapping"];function Q2(e,t){var n=e.context,i=n.createConstraints,r=n.resizeConstraints||{},o=n.gridSnappingContext,a=o.snapConstraints;if(a&&a[t])return a[t];a||(a=o.snapConstraints={}),a[t]||(a[t]={});var s=n.direction;i&&(cu(t)?(a.x.min=i.left,a.x.max=i.right):(a.y.min=i.top,a.y.max=i.bottom));var c=r.min,u=r.max;return c&&(cu(t)?fb(s)?a.x.max=c.left:a.x.min=c.right:pb(s)?a.y.max=c.top:a.y.min=c.bottom),u&&(cu(t)?fb(s)?a.x.min=u.left:a.x.max=u.right:pb(s)?a.y.min=u.top:a.y.max=u.bottom),a[t]}function J2(e,t,n){var i=e.context,r=e.shape,o=i.gridSnappingContext,a=o.snapLocation,s=o.snapOffset;return s&&we(s[t])||(s||(s=o.snapOffset={}),we(s[t])||(s[t]=0),!r)||(n.get(r.id)||(cu(t)?s[t]+=r[t]+r.width/2:s[t]+=r[t]+r.height/2),!a)||(t==="x"?/left/.test(a)?s[t]-=r.width/2:/right/.test(a)&&(s[t]+=r.width/2):/top/.test(a)?s[t]-=r.height/2:/bottom/.test(a)&&(s[t]+=r.height/2)),s[t]}function cu(e){return e==="x"}function pb(e){return e.indexOf("n")!==-1}function fb(e){return e.indexOf("w")!==-1}const ek={__depends__:[K2],__init__:["gridSnapping"],gridSnapping:["type",yr]};var tk=2e3;function db(e,t,n){e.on("autoPlace",tk,function(i){var r=i.source,o=be(r),a=i.shape,s=fv(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],v(a,"bpmn:TextAnnotation")&&(nk(c)?u.offset=-a.width/2:u.offset=-a.height/2),s[c]=t.snapValue(s[c],u))}),s})}db.$inject=["eventBus","gridSnapping","elementRegistry"];function nk(e){return e==="x"}var ik=1750;function hb(e,t,n){t.on(["create.start","shape.move.start"],ik,function(i){var r=i.context,o=r.shape,a=e.getRootElement();if(!(!v(o,"bpmn:Participant")||!v(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}))}})}hb.$inject=["canvas","eventBus","gridSnapping"];var rk=3e3;function uu(e,t,n){X.call(this,e),this._gridSnapping=t;var i=this;this.postExecuted(["connection.create","connection.layout"],rk,function(r){var o=r.context,a=o.connection,s=o.hints||{},c=a.waypoints;s.connectionStart||s.connectionEnd||s.createElementsBehavior===!1||ok(c)&&n.updateWaypoints(a,i.snapMiddleSegments(c))})}uu.$inject=["eventBus","gridSnapping","modeling"],ie(uu,X),uu.prototype.snapMiddleSegments=function(e){var t=this._gridSnapping,n;e=e.slice();for(var i=1;i<e.length-2;i++)n=ck(t,e[i],e[i+1]),e[i]=n[0],e[i+1]=n[1];return e};function ok(e){return e.length>3}function ak(e){return e==="h"}function sk(e){return e==="v"}function ck(e,t,n){var i=Ai(t,n),r={};return ak(i)&&(r.y=e.snapValue(t.y)),sk(i)&&(r.x=e.snapValue(t.x)),("x"in r||"y"in r)&&(t=O({},t,r),n=O({},n,r)),[t,n]}const uk={__depends__:[ek,{__init__:["gridSnappingAutoPlaceBehavior","gridSnappingParticipantBehavior","gridSnappingLayoutConnectionBehavior"],gridSnappingAutoPlaceBehavior:["type",db],gridSnappingParticipantBehavior:["type",hb],gridSnappingLayoutConnectionBehavior:["type",uu]}],__init__:["bpmnGridSnapping"],bpmnGridSnapping:["type",ub]};var lk=30,mb=30;function Va(e,t){this._interactionEvents=t;var n=this;e.on(["interactionEvents.createHit","interactionEvents.updateHit"],function(i){var r=i.element,o=i.gfx;if(v(r,"bpmn:Lane"))return n._createParticipantHit(r,o);if(v(r,"bpmn:Participant"))return $e(r)?n._createParticipantHit(r,o):n._createDefaultHit(r,o);if(v(r,"bpmn:SubProcess"))return $e(r)?n._createSubProcessHit(r,o):n._createDefaultHit(r,o)})}Va.$inject=["eventBus","interactionEvents"],Va.prototype._createDefaultHit=function(e,t){return this._interactionEvents.removeHits(t),this._interactionEvents.createDefaultHit(e,t),!0},Va.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=Yt(e)?{width:lk,height:e.height}:{width:e.width,height:mb};return this._interactionEvents.createBoxHit(t,"all",n),!0},Va.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:mb}),!0};const pk={__init__:["bpmnInteractionEvents"],bpmnInteractionEvents:["type",Va]};function lu(e){e.invoke(Ao,this)}ie(lu,Ao),lu.$inject=["injector"],lu.prototype.registerBindings=function(e,t){Ao.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 fk={__depends__:[Zp],__init__:["keyboardBindings"],keyboardBindings:["type",lu]};var dk={moveSpeed:1,moveSpeedAccelerated:10},hk=1500,gb="left",yb="up",vb="right",_b="down",mk={ArrowLeft:gb,Left:gb,ArrowUp:yb,Up:yb,ArrowRight:vb,Right:vb,ArrowDown:_b,Down:_b},gk={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 bb(e,t,n,i,r){var o=this;this._config=O({},dk,e||{}),t.addListener(hk,function(a){var s=a.keyEvent,c=mk[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=gk[a](u),p=i.allowed("elements.move",{shapes:c,hints:{keyboardMove:!0}});p&&n.moveElements(c,l)}}}bb.$inject=["config.keyboardMoveSelection","keyboard","modeling","rules","selection"];const yk={__depends__:[Zp,qn],__init__:["keyboardMoveSelection"],keyboardMoveSelection:["type",bb]};var xb=10;function Ga(e,t,n,i){this._dragging=i,this._rules=t;var r=this;function o(c,u){var l=c.shape,p=c.direction,f=c.resizeConstraints,d;c.delta=u,d=dR(l,p,u),c.newBounds=mR(d,f),c.canExecute=r.canResize(c)}function a(c){var u=c.resizeConstraints,l=c.minBounds;u===void 0&&(l===void 0&&(l=r.computeMinResizeBox(c)),c.resizeConstraints={min:ye(l)})}function s(c){var u=c.shape,l=c.canExecute,p=c.newBounds;if(l){if(p=$h(p),!vk(u,p))return;n.resizeShape(u,p)}}e.on("resize.start",function(c){a(c.context)}),e.on("resize.move",function(c){var u={x:c.dx,y:c.dy};o(c.context,u)}),e.on("resize.end",function(c){s(c.context)})}Ga.prototype.canResize=function(e){var t=this._rules,n=ni(e,["newBounds","shape","delta","direction"]);return t.allowed("shape.resize",n)},Ga.prototype.activate=function(e,t,n){var i=this._dragging,r,o;if(typeof n=="string"&&(n={direction:n}),r=O({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,wb(t,o),"resize",{autoActivate:!0,cursor:_k(o),data:{shape:t,context:r}})},Ga.prototype.computeMinResizeBox=function(e){var t=e.shape,n=e.direction,i,r;return i=e.minDimensions||{width:xb,height:xb},r=Rm(t,e.childrenBoxPadding),gR(n,t,i,r)},Ga.$inject=["eventBus","rules","modeling","dragging"];function vk(e,t){return e.x!==t.x||e.y!==t.y||e.width!==t.width||e.height!==t.height}function wb(e,t){var n=be(e),i=ye(e),r={x:n.x,y:n.y};return t.indexOf("n")!==-1?r.y=i.top:t.indexOf("s")!==-1&&(r.y=i.bottom),t.indexOf("e")!==-1?r.x=i.right:t.indexOf("w")!==-1&&(r.x=i.left),r}function _k(e){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 Eb="djs-resizing",Sb="resize-not-ok",bk=500;function Rb(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,Eb)),s.width>5&&re(c,{x:s.x,width:s.width}),s.height>5&&re(c,{y:s.y,height:s.height}),o.canExecute?je(c).remove(Sb):je(c).add(Sb)}function r(o){var a=o.shape,s=o.frame;s&&Ft(o.frame),t.removeMarker(a,Eb)}e.on("resize.move",bk,function(o){i(o.context)}),e.on("resize.cleanup",function(o){r(o.context)})}Rb.$inject=["eventBus","canvas","previewSupport"];var pu=-6,fu=8,du=20,Wa="djs-resizer",xk=["n","w","s","e","nw","ne","se","sw"];function vr(e,t,n,i){this._resize=i,this._canvas=t;var r=this;e.on("selection.changed",function(o){var a=o.newSelection;r.removeResizers(),a.length===1&&M(a,vn(r.addResizer,r))}),e.on("shape.changed",function(o){var a=o.element;n.isSelected(a)&&(r.removeResizers(),r.addResizer(a))})}vr.prototype.makeDraggable=function(e,t,n){var i=this._resize;function r(o){ar(o)&&i.activate(o,e,n)}Se.bind(t,"mousedown",r),Se.bind(t,"touchstart",r)},vr.prototype._createResizer=function(e,t,n,i){var r=this._getResizersParent(),o=wk(i),a=me("g");je(a).add(Wa),je(a).add(Wa+"-"+e.id),je(a).add(Wa+"-"+i),Re(r,a);var s=me("rect");re(s,{x:-fu/2+o.x,y:-fu/2+o.y,width:fu,height:fu}),je(s).add(Wa+"-visual"),Re(a,s);var c=me("rect");return re(c,{x:-du/2+o.x,y:-du/2+o.y,width:du,height:du}),je(c).add(Wa+"-hit"),Re(a,c),Ps(a,t,n),a},vr.prototype.createResizer=function(e,t){var n=wb(e,t),i=this._createResizer(e,n.x,n.y,t);this.makeDraggable(e,i,t)},vr.prototype.addResizer=function(e){var t=this;it(e)||M(xk,function(n){t._resize.canResize({shape:e,direction:n})&&t.createResizer(e,n)})},vr.prototype.removeResizers=function(){var e=this._getResizersParent();vs(e)},vr.prototype._getResizersParent=function(){return this._canvas.getLayer("resizers")},vr.$inject=["eventBus","canvas","selection","resize"];function wk(e){var t={x:0,y:0};return e.indexOf("e")!==-1?t.x=-pu:e.indexOf("w")!==-1&&(t.x=pu),e.indexOf("s")!==-1?t.y=-pu:e.indexOf("n")!==-1&&(t.y=pu),t}const Cb={__depends__:[gi,Li,Ro],__init__:["resize","resizePreview","resizeHandles"],resize:["type",Ga],resizePreview:["type",Rb],resizeHandles:["type",vr]};var Ek=2e3;function Ua(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"],Ek,function(c){i.isActive(c.element)&&i.cancel()}),e.on(["commandStack.changed"],function(c){i.isActive()&&i.cancel()}),e.on("directEditing.activate",function(c){o.removeResizers()}),e.on("create.end",500,function(c){var u=c.context,l=u.shape,p=c.context.canExecute,f=c.isTouch;f||p&&(u.hints&&u.hints.createElementsBehavior===!1||s(l))}),e.on("autoPlace.end",500,function(c){s(c.shape)});function s(c,u){(u||De(c,["bpmn:Activity","bpmn:Event","bpmn:TextAnnotation","bpmn:Participant"]))&&i.activate(c)}}Ua.$inject=["eventBus","bpmnFactory","canvas","directEditing","modeling","resizeHandles","textRenderer"],Ua.prototype.activate=function(e){var t=jn(e);if(t!==void 0){var n={text:t},i=this.getEditingBBox(e);O(n,i);var r={},o=n.style||{};return O(o,{backgroundColor:null,border:null}),(De(e,["bpmn:Task","bpmn:Participant","bpmn:Lane","bpmn:CallActivity"])||Pb(e))&&O(r,{centerVertically:!0}),nr(e)&&(O(r,{resizable:!0,autoResize:!0}),O(o,{backgroundColor:"#ffffff",border:"1px solid #ccc"})),v(e,"bpmn:TextAnnotation")&&(O(r,{resizable:!0,autoResize:!0}),O(o,{backgroundColor:"#ffffff",border:"1px solid #ccc"})),O(n,{options:r,style:o}),n}},Ua.prototype.getEditingBBox=function(e){var t=this._canvas,n=e.label||e,i=t.getAbsoluteBBox(n),r={x:i.x+i.width/2,y:i.y+i.height/2},o={x:i.x,y:i.y},a=t.zoom(),s=this._textRenderer.getDefaultStyle(),c=this._textRenderer.getExternalStyle(),u=c.fontSize*a,l=c.lineHeight,p=s.fontSize*a,f=s.lineHeight,d={fontFamily:this._textRenderer.getDefaultStyle().fontFamily,fontWeight:this._textRenderer.getDefaultStyle().fontWeight};if(v(e,"bpmn:Lane")||Ck(e)){var h=Yt(e),m=h?{width:i.height,height:30*a,x:i.x-i.height/2+15*a,y:r.y-30*a/2}:{width:i.width,height:30*a};O(o,m),O(d,{fontSize:p+"px",lineHeight:f,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px",transform:h?"rotate(-90deg)":null})}if(Rk(e)){var g=Yt(e),R=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};O(o,R),O(d,{fontSize:p+"px",lineHeight:f,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px",transform:g?null:"rotate(-90deg)"})}(De(e,["bpmn:Task","bpmn:CallActivity"])||Pb(e))&&(O(o,{width:i.width,height:i.height}),O(d,{fontSize:p+"px",lineHeight:f,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px"})),Sk(e)&&(O(o,{width:i.width,x:i.x}),O(d,{fontSize:p+"px",lineHeight:f,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px"}));var w=1,b=i.width+2*w;if(n.labelTarget&&(O(o,{width:b,height:i.height+2*w,x:i.x-w,y:i.y-w}),O(d,{fontSize:u+"px",lineHeight:l})),nr(n)&&!Ms(n)&&!Me(n)){var x=pl(e),E=t.getAbsoluteBBox({x:x.x,y:x.y,width:0,height:0}),T=u,L=Ir.width*a+2*w;O(o,{width:L,height:T+2*w,x:E.x-L/2,y:E.y-T/2-w}),O(d,{fontSize:u+"px",lineHeight:l})}return v(e,"bpmn:TextAnnotation")&&(O(o,{width:i.width+2*w,height:i.height+2*w,x:i.x-w,y:i.y-w,minWidth:30*a,minHeight:10*a}),O(d,{textAlign:"left",paddingTop:po*a+"px",paddingBottom:po*a+"px",paddingLeft:po*a+"px",paddingRight:po*a+"px",fontSize:p+"px",lineHeight:f})),{bounds:o,style:d}},Ua.prototype.update=function(e,t,n,i){var r,o;v(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}),Pk(t)&&(t=null),this._modeling.updateLabel(e,t,r)};function Pb(e){return v(e,"bpmn:SubProcess")&&!$e(e)}function Sk(e){return v(e,"bpmn:SubProcess")&&$e(e)}function Rk(e){return v(e,"bpmn:Participant")&&!$e(e)}function Ck(e){return v(e,"bpmn:Participant")&&$e(e)}function Pk(e){return!e||!e.trim()}var Ab="djs-element-hidden",Tb="djs-label-hidden";function Mb(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,v(o,"bpmn:TextAnnotation")){a=t.getAbsoluteBBox(o),s=me("g");var l=n.getScaledPath("TEXT_ANNOTATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:o.width,containerHeight:o.height,position:{mx:0,my:0}}),p=i.path=me("path");re(p,{d:l,strokeWidth:2,stroke:Ak(o)}),Re(s,p),Re(r,s),Qt(s,o.x,o.y)}v(o,"bpmn:TextAnnotation")||o.labelTarget?t.addMarker(o,Ab):(v(o,"bpmn:Task")||v(o,"bpmn:CallActivity")||v(o,"bpmn:SubProcess")||v(o,"bpmn:Participant")||v(o,"bpmn:Lane"))&&t.addMarker(o,Tb)}),e.on("directEditing.resize",function(c){if(v(o,"bpmn:TextAnnotation")){var u=c.height,l=c.dy,p=Math.max(o.height/a.height*(u+l),0),f=n.getScaledPath("TEXT_ANNOTATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:o.width,containerHeight:p,position:{mx:0,my:0}});re(i.path,{d:f})}}),e.on(["directEditing.complete","directEditing.cancel"],function(c){var u=c.active;u&&(t.removeMarker(u.element.label||u.element,Ab),t.removeMarker(o,Tb)),o=void 0,a=void 0,s&&(Ft(s),s=void 0)})}Mb.$inject=["eventBus","canvas","pathMap"];function Ak(e,t){var n=Ve(e);return n.get("stroke")||t||"black"}const Tk={__depends__:[Tp,Cb,tb],__init__:["labelEditingProvider","labelEditingPreview"],labelEditingProvider:["type",Ua],labelEditingPreview:["type",Mb]};var Mk=500,kk=1e3;function _i(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){m1(o)||i.createOutline(o)}e.on("element.hover",function(o){r(o.element)}),e.on("selection.changed",function(o){M(o.newSelection,r)}),e.on(["shape.changed","connection.changed"],Mk,function(o){var a=o.element,s=o.gfx,c=et(".djs-outline",s);c&&i.updateOutline(a,c)})}_i.prototype.createOutline=function(e){var t=this._elementRegistry.getGraphics(e);if(!t)throw new Error("cannot create outline for non-rendered element");var n=et(".djs-outline",t);return n||(n=this.getOutline(e)||this._createOutlineGfx(),Re(t,n),this.updateOutline(e,n)),n},_i.prototype._createOutlineGfx=function(){var e=me("rect");return re(e,O({x:0,y:0,rx:4,width:100,height:100},this._outlineStyle)),e},_i.prototype.updateOutline=function(e,t){e.waypoints?this.updateConnectionOutline(t,e):this.updateShapeOutline(t,e)},_i.prototype.updateShapeOutline=function(e,t){var n=!1,i=this._getProviders();i.length&&M(i,function(r){n=n||r.updateOutline(t,e)}),n||re(e,{x:-this._outlineOffset,y:-this._outlineOffset,width:t.width+this._outlineOffset*2,height:t.height+this._outlineOffset*2})},_i.prototype.updateConnectionOutline=function(e,t){var n=At(t);re(e,{x:n.x-this._outlineOffset,y:n.y-this._outlineOffset,width:n.width+this._outlineOffset*2,height:n.height+this._outlineOffset*2})},_i.prototype.registerProvider=function(e,t){t||(t=e,e=kk),this._eventBus.on("outline.getProviders",e,function(n){n.providers.push(t)})},_i.prototype._getProviders=function(){var e=this._eventBus.createEvent({type:"outline.getProviders",providers:[]});return this._eventBus.fire(e),e.providers},_i.prototype.getOutline=function(e){var t,n=this._getProviders();return M(n,function(i){Wt(i.getOutline)&&(t=t||i.getOutline(e))}),t},_i.$inject=["eventBus","styles","elementRegistry"];var hu=6;function Rf(e,t,n){this._canvas=t;var i=this;e.on("element.changed",function(r){n.isSelected(r.element)&&i._updateMultiSelectionOutline(n.get())}),e.on("selection.changed",function(r){var o=r.newSelection;i._updateMultiSelectionOutline(o)})}Rf.prototype._updateMultiSelectionOutline=function(e){var t=this._canvas.getLayer("selectionOutline");vs(t);var n=e.length>1,i=this._canvas.getContainer();if(je(i)[n?"add":"remove"]("djs-multi-select"),!!n){var r=Dk(At(e)),o=me("rect");re(o,O({rx:3},r)),je(o).add("djs-selection-outline"),Re(t,o)}},Rf.$inject=["eventBus","canvas","selection"];function Dk(e){return{x:e.x-hu,y:e.y-hu,width:e.width+hu*2,height:e.height+hu*2}}const Cf={__depends__:[qn],__init__:["outline","multiSelectionOutline"],outline:["type",_i],multiSelectionOutline:["type",Rf]},kb=["bpmn:Event","bpmn:SequenceFlow","bpmn:Gateway"],Db={class:"bjs-label-link",stroke:"var(--element-selected-outline-secondary-stroke-color)",strokeDasharray:"5, 5"},Ok=15,mu=2;function Ob(e,t,n,i,r){const o=t.getLayer("overlays");e.on(["selection.changed","shape.changed"],function(){s()}),e.on("selection.changed",function({newSelection:p}){var d;const f=p.filter(h=>De(h,kb));if(f.length===1){const h=f[0];Me(h)?a(h,h.labelTarget):(d=h.labels)!=null&&d.length&&a(h.labels[0],h)}if(f.length===2){const h=f.find(Me),m=f.find(g=>{var R;return(R=g.labels)==null?void 0:R.includes(h)});h&&m&&a(h,m)}}),e.on("shape.changed",function({element:p}){var f;!De(p,kb)||!l(p)||(Me(p)?a(p,p.labelTarget):(f=p.labels)!=null&&f.length&&a(p.labels[0],p))});function a(p,f){const d=Ko([be(f),be(p)],Db),h=d.getAttribute("d"),g=r.isSelected(p)?c(p):u(p),R=Jo(g,h);if(!R)return;const b=r.isSelected(f)?c(f):u(f),x=Jo(b,h)||be(f);ua(x,R)<Ok||(il(d,[x,R]),Re(o,d))}function s(){ys(`.${Db.class}`,o).forEach(Ft)}function c(p){const f=i.getOutline(p);if(!f)return u(p);if(f.x){const d={x:p.x+_r(f,"x")-mu,y:p.y+_r(f,"y")-mu,width:_r(f,"width")+mu*2,height:_r(f,"height")+mu*2};return dl(d,_r(f,"rx"))}if(f.cx){const d=_r(f,"r"),h={x:p.x+_r(f,"cx")-d,y:p.y+_r(f,"cy")-d,width:d*2,height:d*2};return cm(h)}}function u(p){return n.getShapePath(p)}function l(p){return r.isSelected(p)}}Ob.$inject=["eventBus","canvas","graphicsFactory","outline","selection"];function _r(e,t){return parseFloat(re(e,t)||0)}const Lk={__depends__:[qn,Cf],__init__:["labelLink"],labelLink:["type",Ob]};var Ik=new So("tt");function Nk(e){var t=ut('<div class="djs-tooltip-container" />');return mn(t,{position:"absolute",width:"0",height:"0"}),e.insertBefore(t,e.firstChild),t}function Bk(e,t,n){mn(e,{left:t+"px",top:n+"px"})}function Pf(e,t){e.style.display=t===!1?"none":""}var Lb="djs-tooltip",Af="."+Lb;function bn(e,t){this._eventBus=e,this._canvas=t,this._ids=Ik,this._tooltipDefaults={show:{minZoom:.7,maxZoom:5}},this._tooltips={},this._tooltipRoot=Nk(t.getContainer());var n=this;Cn.bind(this._tooltipRoot,Af,"mousedown",function(i){i.stopPropagation()}),Cn.bind(this._tooltipRoot,Af,"mouseover",function(i){n.trigger("mouseover",i)}),Cn.bind(this._tooltipRoot,Af,"mouseout",function(i){n.trigger("mouseout",i)}),this._init()}bn.$inject=["eventBus","canvas"],bn.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=O({},this._tooltipDefaults,e,{id:t}),this._addTooltip(e),e.timeout&&this.setTimeout(e),t},bn.prototype.trigger=function(e,t){var n=t.delegateTarget||t.target,i=this.get(an(n,"data-tooltip-id"));i&&(e==="mouseover"&&i.timeout&&this.clearTimeout(i),e==="mouseout"&&i.timeout&&(i.timeout=1e3,this.setTimeout(i)))},bn.prototype.get=function(e){return typeof e!="string"&&(e=e.id),this._tooltips[e]},bn.prototype.clearTimeout=function(e){if(e=this.get(e),!!e){var t=e.removeTimer;t&&(clearTimeout(t),e.removeTimer=null)}},bn.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)}},bn.prototype.remove=function(e){var t=this.get(e);t&&(li(t.html),li(t.htmlContainer),delete t.htmlContainer,delete this._tooltips[t.id])},bn.prototype.show=function(){Pf(this._tooltipRoot)},bn.prototype.hide=function(){Pf(this._tooltipRoot,!1)},bn.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},bn.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)),wn(n)&&(n=ut(n)),i=ut('<div data-tooltip-id="'+t+'" class="'+Lb+'">'),mn(i,{position:"absolute"}),i.appendChild(n),e.type&&mt(i).add("djs-tooltip-"+e.type),e.className&&mt(i).add(e.className),e.htmlContainer=i,r.appendChild(i),this._tooltips[t]=e,this._updateTooltip(e)},bn.prototype._updateTooltip=function(e){var t=e.position,n=e.htmlContainer;Bk(n,t.x,t.y)},bn.prototype._updateTooltipVisibilty=function(e){M(this._tooltips,function(t){var n=t.show,i=t.htmlContainer,r=!0;n&&((n.minZoom>e.scale||n.maxZoom<e.scale)&&(r=!1),Pf(i,r))})},bn.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 $k={__init__:["tooltips"],tooltips:["type",bn]};var jk="flow elements must be children of pools/participants",Fk="Data object must be placed within a pool/participant.";function Ib(e,t,n){function i(r,o,a){t.add({position:{x:r.x+5,y:r.y+5},type:"error",timeout:2e3,html:"<div>"+o+"</div>"})}e.on(["shape.move.rejected","create.rejected"],function(r){var o=r.context,a=o.shape,s=o.target;v(s,"bpmn:Collaboration")&&(v(a,"bpmn:FlowNode")?i(r,n(jk)):v(a,"bpmn:DataObjectReference")&&i(r,n(Fk)))})}Ib.$inject=["eventBus","tooltips","translate"];const Hk={__depends__:[$k],__init__:["modelingFeedback"],modelingFeedback:["type",Ib]};var zk=500,Vk=1250,Gk=1500,gu=Math.round;function Wk(e){return{x:e.x+gu(e.width/2),y:e.y+gu(e.height/2)}}function Nb(e,t,n,i,r){function o(s,c,u,l){return r.allowed("elements.move",{shapes:s,delta:c,position:u,target:l})}e.on("shape.move.start",Gk,function(s){var c=s.context,u=s.shape,l=i.get().slice();l.indexOf(u)===-1&&(l=[u]),l=Uk(l),O(c,{shapes:l,validatedShapes:l,shape:u})}),e.on("shape.move.start",Vk,function(s){var c=s.context,u=c.validatedShapes,l;if(l=c.canExecute=o(u),!l)return!1}),e.on("shape.move.move",zk,function(s){var c=s.context,u=c.validatedShapes,l=s.hover,p={x:s.dx,y:s.dy},f={x:s.x,y:s.y},d;if(d=o(u,p,f,l),c.delta=p,c.canExecute=d,d===null){c.target=null;return}c.target=l}),e.on("shape.move.end",function(s){var c=s.context,u=c.delta,l=c.canExecute,p=l==="attach",f=c.shapes;if(l===!1)return!1;u.x=gu(u.x),u.y=gu(u.y),!(u.x===0&&u.y===0)&&n.moveElements(f,u,c.target,{primaryShape:c.shape,attach:p})}),e.on("element.mousedown",function(s){if(ar(s)){var c=bo(s);if(!c)throw new Error("must supply DOM mousedown event");return a(c,s.element)}});function a(s,c,u,l){if(Gt(u)&&(l=u,u=!1),!(c.waypoints||!c.parent)&&!je(s.target).has("djs-hit-no-move")){var p=Wk(c),f=t.init(s,p,"shape.move",{cursor:"grabbing",autoActivate:u,data:{shape:c,context:l||{}}});if(f!==!1)return!0}}this.start=a}Nb.$inject=["eventBus","dragging","modeling","selection","rules"];function Uk(e){var t=Qr(e,"id");return Oe(e,function(n){for(;n=n.parent;)if(t[n.id])return!1;return!0})}var Bb=499,Tf="djs-dragging",$b="drop-ok",jb="drop-not-ok",Fb="new-parent",Hb="attach-ok";function zb(e,t,n,i){function r(c){var u=o(c),l=Yk(u);return l}function o(c){var u=Xo(c),l=u.flatMap(d=>(d.incoming||[]).concat(d.outgoing||[])),p=u.concat(l),f=[...new Set(p)];return f}function a(c,u){[Hb,$b,jb,Fb].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,Tf),c.allDraggedElements?c.allDraggedElements.push(u):c.allDraggedElements=[u]}e.on("shape.move.start",Bb,function(c){var u=c.context,l=u.shapes,p=u.allDraggedElements,f=r(l);if(!u.dragGroup){var d=me("g");re(d,n.cls("djs-drag-group",["no-events"]));var h=t.getActiveLayer();Re(h,d),u.dragGroup=d}f.forEach(function(m){i.addDragger(m,u.dragGroup)}),p?p=Eu([p,o(l)]):p=o(l),M(p,function(m){t.addMarker(m,Tf)}),u.allDraggedElements=p,u.differentParents=qk(l)}),e.on("shape.move.move",Bb,function(c){var u=c.context,l=u.dragGroup,p=u.target,f=u.shape.parent,d=u.canExecute;p&&(d==="attach"?a(p,Hb):u.canExecute&&f&&p.id!==f.id?a(p,Fb):a(p,u.canExecute?$b:jb)),Qt(l,c.dx,c.dy)}),e.on(["shape.move.out","shape.move.cleanup"],function(c){var u=c.context,l=u.target;l&&a(l,null)}),e.on("shape.move.cleanup",function(c){var u=c.context,l=u.allDraggedElements,p=u.dragGroup;M(l,function(f){t.removeMarker(f,Tf)}),p&&Ft(p)}),this.makeDraggable=s}zb.$inject=["eventBus","canvas","styles","previewSupport"];function Yk(e){var t=new Set;e.forEach(function(i){t.add(i.id)});var n=Oe(e,function(i){return it(i)?t.has(i.source.id)&&t.has(i.target.id):!0});return n}function qk(e){return qx(Qr(e,function(t){return t.parent&&t.parent.id}))!==1}const Kk={__depends__:[sc,qn,Cf,gi,Li,Ro],__init__:["move","movePreview"],move:["type",Nb],movePreview:["type",zb]};var Vb=".djs-palette-toggle",Gb=".entry",Xk=Vb+", "+Gb,Mf="djs-palette-",Zk="shown",kf="open",Wb="two-column",Qk=1e3;function Ot(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()})}Ot.$inject=["eventBus","canvas"],Ot.prototype.registerProvider=function(e,t){t||(t=e,e=Qk),this._eventBus.on("palette.getProviders",e,function(n){n.providers.push(t)}),this._rebuild()},Ot.prototype.getEntries=function(){var e=this._getProviders();return e.reduce(eD,{})},Ot.prototype._rebuild=function(){if(this._diagramInitialized){var e=this._getProviders();e.length&&(this._container||this._init(),this._update())}},Ot.prototype._init=function(){var e=this,t=this._eventBus,n=this._getParentContainer(),i=this._container=ut(Ot.HTML_MARKUP);n.appendChild(i),mt(n).add(Mf+Zk),Cn.bind(i,Xk,"click",function(r){var o=r.delegateTarget;if(qu(o,Vb))return e.toggle();e.trigger("click",r)}),Se.bind(i,"mousedown",function(r){r.stopPropagation()}),Cn.bind(i,Gb,"dragstart",function(r){e.trigger("dragstart",r)}),t.on("canvas.resized",this._layoutChanged,this),t.fire("palette.create",{container:i})},Ot.prototype._getProviders=function(e){var t=this._eventBus.createEvent({type:"palette.getProviders",providers:[]});return this._eventBus.fire(t),t.providers},Ot.prototype._toggleState=function(e){e=e||{};var t=this._getParentContainer(),n=this._container,i=this._eventBus,r,o=mt(n),a=mt(t);"twoColumn"in e?r=e.twoColumn:r=this._needsCollapse(t.clientHeight,this._entries||{}),o.toggle(Wb,r),a.toggle(Mf+Wb,r),"open"in e&&(o.toggle(kf,e.open),a.toggle(Mf+kf,e.open)),i.fire("palette.changed",{twoColumn:r,open:this.isOpen()})},Ot.prototype._update=function(){var e=et(".djs-palette-entries",this._container),t=this._entries=this.getEntries();ms(e),M(t,function(n,i){var r=n.group||"default",o=et("[data-group="+ka(r)+"]",e);o||(o=ut('<div class="group"></div>'),an(o,"data-group",r),e.appendChild(o));var a=n.html||(n.separator?'<hr class="separator" />':'<div class="entry" draggable="true"></div>'),s=ut(a);if(o.appendChild(s),!n.separator&&(an(s,"data-action",i),n.title&&an(s,"title",n.title),n.className&&Jk(s,n.className),n.imageUrl)){var c=ut("<img>");an(c,"src",n.imageUrl),s.appendChild(c)}}),this.open()},Ot.prototype.trigger=function(e,t,n){var i,r,o=t.delegateTarget||t.target;return o?(i=an(o,"data-action"),r=t.originalEvent||t,this.triggerEntry(i,e,r,n)):t.preventDefault()},Ot.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(Wt(a)){if(t==="click")return a(n,i)}else if(a[t])return a[t](n,i);n.preventDefault()}},Ot.prototype._layoutChanged=function(){this._toggleState({})},Ot.prototype._needsCollapse=function(e,t){var n=50,i=Object.keys(t).length*46;return e<i+n},Ot.prototype.close=function(){this._toggleState({open:!1,twoColumn:!1})},Ot.prototype.open=function(){this._toggleState({open:!0})},Ot.prototype.toggle=function(){this.isOpen()?this.close():this.open()},Ot.prototype.isActiveTool=function(e){return e&&this._activeTool===e},Ot.prototype.updateToolHighlight=function(e){var t,n;this._toolsContainer||(t=et(".djs-palette-entries",this._container),this._toolsContainer=et("[data-group=tools]",t)),n=this._toolsContainer,M(n.children,function(i){var r=i.getAttribute("data-action");if(r){var o=mt(i);r=r.replace("-tool",""),o.contains("entry")&&r===e?o.add("highlighted-entry"):o.remove("highlighted-entry")}})},Ot.prototype.isOpen=function(){return mt(this._container).has(kf)},Ot.prototype._getParentContainer=function(){return this._canvas.getContainer()},Ot.HTML_MARKUP='<div class="djs-palette"><div class="djs-palette-entries"></div><div class="djs-palette-toggle"></div></div>';function Jk(e,t){var n=mt(e),i=_e(t)?t:t.split(/\s+/g);i.forEach(function(r){n.add(r)})}function eD(e,t){var n=t.getPaletteEntries();return Wt(n)?n(e):(M(n,function(i,r){e[r]=i}),e)}const tD={__init__:["palette"],palette:["type",Ot]};var Ub="crosshair",Yb="selected",nD="djs-dragging-active-lasso";function br(e,t,n,i,r,o,a){this._selection=r,this._dragging=n,this._mouse=a;var s=this,c={create:function(p){var f=t.getActiveLayer(),d=p.frame=me("rect");re(d,{class:"djs-lasso-overlay",width:1,height:1,x:0,y:0}),Re(f,d),u(!0),this.update(p)},update:function(p){var f=p.frame,d=p.bbox;f&&d&&re(f,{x:d.x,y:d.y,width:d.width,height:d.height});var h=p.marked,m=p.lastMarked;if(h&&m){for(const g of m)h.has(g)||t.removeMarker(g,Yb);for(const g of h)m.has(g)||t.addMarker(g,Yb)}},remove:function(p){this.update(p),p.frame&&Ft(p.frame),u(!1)}};function u(p){je(t.getContainer()).toggle(nD,p)}function l(p){var f=i.getAll();return new Set(Zr(ao(f,p)))}o.registerTool("lasso",{tool:"lasso.selection",dragging:"lasso"}),e.on("lasso.selection.end",function(p){var f=p.originalEvent.target;!p.hover&&!(f instanceof SVGElement)||e.once("lasso.selection.ended",function(){s.activateLasso(p.originalEvent,!0)})}),e.on("lasso.end",0,function(p){var f=p.context;s._select(Array.from(f.marked))}),e.on("lasso.start",function(p){var f=p.context;f.bbox=qb(p),f.add=ec(p),f.lastMarked=new Set(r.get()),f.add?f.marked=f.lastMarked:f.marked=new Set,f.initialMarked=f.marked,c.create(f)}),e.on("lasso.move",function(p){var f=p.context,d=f.bbox=qb(p),h=l(d),m=f.initialMarked.union(h);f.lastMarked=f.marked,f.marked=m,c.update(f)}),e.on("lasso.cleanup",function(p){var f=p.context;f.lastMarked=f.marked,f.marked=new Set(r.get()),c.remove(p.context)}),e.on("element.mousedown",1500,function(p){if(ec(p))return s.activateLasso(p.originalEvent),!0})}br.$inject=["eventBus","canvas","dragging","elementRegistry","selection","toolManager","mouse"],br.prototype.activateLasso=function(e,t){this._dragging.init(e,"lasso",{autoActivate:t,cursor:Ub,data:{context:{}},keepSelection:!0})},br.prototype.activateSelection=function(e,t){this._dragging.init(e,"lasso.selection",{trapClick:!1,autoActivate:t,cursor:Ub,data:{context:{}},keepSelection:!0})},br.prototype._select=function(e){this._selection.select(e)},br.prototype.select=function(e,t,n=[]){var i=Zr(ao(e,t));this._select([...n,...i])},br.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateSelection(e,!!e)},br.prototype.isActive=function(){var e=this._dragging.context();return e&&/^lasso/.test(e.prefix)};function qb(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 iD={__depends__:[pc,ma],__init__:["lassoTool"],lassoTool:["type",br]};var Df=1500,Kb="grab";function No(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",Df,function(c){if(fa(c))return a.activateMove(c.originalEvent,!0),!1}),s&&s.addListener(Df,function(c){if(!(!Xb(c.keyEvent)||a.isActive())){var u=a._mouse.getLastMoveEvent();a.activateMove(u,!!u)}},"keyboard.keydown"),s&&s.addListener(Df,function(c){!Xb(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!fa(c)&&l&&e.once("hand.move.ended",function(p){a.activateHand(p.originalEvent,!0,!0)}),!1})}No.$inject=["eventBus","canvas","dragging","injector","toolManager","mouse"],No.prototype.activateMove=function(e,t,n){typeof t=="object"&&(n=t,t=!1),this._dragging.init(e,"hand.move",{autoActivate:t,cursor:Kb,data:{context:n||{}}})},No.prototype.activateHand=function(e,t,n){this._dragging.init(e,"hand",{trapClick:!1,autoActivate:t,cursor:Kb,data:{context:{reactivate:n}}})},No.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateHand(e,!!e)},No.prototype.isActive=function(){var e=this._dragging.context();return e?/^(hand|hand\.move)$/.test(e.prefix):!1};function Xb(e){return Ht("Space",e)}const rD={__depends__:[pc,ma],__init__:["handTool"],handTool:["type",No]};var Zb="connect-ok",Qb="connect-not-ok";function Bo(e,t,n,i,r,o,a){var s=this;this._dragging=t,this._rules=o,this._mouse=a,r.registerTool("global-connect",{tool:"global-connect",dragging:"global-connect.drag"}),e.on("global-connect.hover",function(c){var u=c.context,l=c.hover,p=u.canStartConnect=s.canStartConnect(l);p!==null&&(u.startTarget=l,i.addMarker(l,p?Zb:Qb))}),e.on(["global-connect.out","global-connect.cleanup"],function(c){var u=c.context.startTarget,l=c.context.canStartConnect;u&&i.removeMarker(u,l?Zb:Qb)}),e.on(["global-connect.ended"],function(c){var u=c.context,l=u.startTarget,p={x:c.x,y:c.y},f=s.canStartConnect(l);if(f)return e.once("element.out",function(){e.once(["connect.ended","connect.canceled"],function(){e.fire("global-connect.drag.ended")}),n.start(null,l,p)}),!1})}Bo.$inject=["eventBus","dragging","connect","canvas","toolManager","rules","mouse"],Bo.prototype.start=function(e,t){this._dragging.init(e,"global-connect",{autoActivate:t,trapClick:!1,data:{context:{}}})},Bo.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();return this.start(e,!!e)},Bo.prototype.isActive=function(){var e=this._dragging.context();return e&&/^global-connect/.test(e.prefix)},Bo.prototype.canStartConnect=function(e){return this._rules.allowed("connection.start",{source:e})};const oD={__depends__:[xf,gi,Li,pc,ma],globalConnect:["type",Bo]};function Of(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)}Of.$inject=["palette","create","elementFactory","spaceTool","lassoTool","handTool","globalConnect","translate"],Of.prototype.getPaletteEntries=function(){var e={},t=this._create,n=this._elementFactory,i=this._spaceTool,r=this._lassoTool,o=this._handTool,a=this._globalConnect,s=this._translate;function c(p,f,d,h,m){function g(R){var w=n.createShape(O({type:p},m));t.start(R,w)}return{group:f,className:d,title:h,action:{dragstart:g,click:g}}}function u(p){var f=n.createShape({type:"bpmn:SubProcess",x:0,y:0,isExpanded:!0}),d=n.createShape({type:"bpmn:StartEvent",x:40,y:82,parent:f});t.start(p,[f,d],{hints:{autoSelect:[f]}})}function l(p){t.start(p,n.createParticipantShape())}return O(e,{"hand-tool":{group:"tools",className:"bpmn-icon-hand-tool",title:s("Activate hand tool"),action:{click:function(p){o.activateHand(p)}}},"lasso-tool":{group:"tools",className:"bpmn-icon-lasso-tool",title:s("Activate lasso tool"),action:{click:function(p){r.activateSelection(p)}}},"space-tool":{group:"tools",className:"bpmn-icon-space-tool",title:s("Activate create/remove space tool"),action:{click:function(p){i.activateSelection(p)}}},"global-connect-tool":{group:"tools",className:"bpmn-icon-connection-multi",title:s("Activate global connect tool"),action:{click:function(p){a.start(p)}}},"tool-separator":{group:"tools",separator:!0},"create.start-event":c("bpmn:StartEvent","event","bpmn-icon-start-event-none",s("Create start event")),"create.intermediate-event":c("bpmn:IntermediateThrowEvent","event","bpmn-icon-intermediate-event-none",s("Create intermediate/boundary event")),"create.end-event":c("bpmn:EndEvent","event","bpmn-icon-end-event-none",s("Create end event")),"create.exclusive-gateway":c("bpmn:ExclusiveGateway","gateway","bpmn-icon-gateway-none",s("Create gateway")),"create.task":c("bpmn:Task","activity","bpmn-icon-task",s("Create task")),"create.data-object":c("bpmn:DataObjectReference","data-object","bpmn-icon-data-object",s("Create data object reference")),"create.data-store":c("bpmn:DataStoreReference","data-store","bpmn-icon-data-store",s("Create data store reference")),"create.subprocess-expanded":{group:"activity",className:"bpmn-icon-subprocess-expanded",title:s("Create expanded sub-process"),action:{dragstart:u,click:u}},"create.participant-expanded":{group:"collaboration",className:"bpmn-icon-participant",title:s("Create pool/participant"),action:{dragstart:l,click:l}},"create.group":c("bpmn:Group","artifact","bpmn-icon-group",s("Create group"))}),e};const aD={__depends__:[tD,uc,Cy,iD,rD,oD,oa],__init__:["paletteProvider"],paletteProvider:["type",Of]};var sD=250;function Lf(e,t,n,i,r){X.call(this,e);function o(s){var c=s.canExecute.replacements;M(c,function(u){var l=u.oldElementId,p={type:u.newElementType};if(!s.visualReplacements[l]){var f=t.get(l);O(p,{x:f.x,y:f.y});var d=n.createShape(p);i.addShape(d,f.parent);var h=et('[data-element-id="'+ka(f.id)+'"]',s.dragGroup);h&&re(h,{display:"none"});var m=r.addDragger(d,s.dragGroup);s.visualReplacements[l]=m,i.removeShape(d)}})}function a(s){var c=s.visualReplacements;M(c,function(u,l){var p=et('[data-element-id="'+ka(l)+'"]',s.dragGroup);p&&re(p,{display:"inline"}),u.remove(),c[l]&&delete c[l]})}e.on("shape.move.move",sD,function(s){var c=s.context,u=c.canExecute;c.visualReplacements||(c.visualReplacements={}),u&&u.replacements?o(c):a(c)})}Lf.$inject=["eventBus","elementRegistry","elementFactory","canvas","previewSupport"],ie(Lf,X);const cD={__depends__:[Ro],__init__:["bpmnReplacePreview"],bpmnReplacePreview:["type",Lf]};var uD=1250,If=40,lD=20,pD=10,Jb=20,ex=["x","y"],fD=Math.abs;function tx(e){e.on(["connect.hover","connect.move","connect.end"],uD,function(t){var n=t.context,i=n.canExecute,r=n.start,o=n.hover,a=n.source,s=n.target;t.originalEvent&&Tn(t.originalEvent)||(n.initialConnectionStart||(n.initialConnectionStart=n.connectionStart),i&&o&&dD(t,o,yD(o)),o&&gD(i,["bpmn:Association","bpmn:DataInputAssociation","bpmn:DataOutputAssociation","bpmn:SequenceFlow"])?(n.connectionStart=Zn(r),De(o,["bpmn:Event","bpmn:Gateway"])&&nx(t,Zn(o)),De(o,["bpmn:Task","bpmn:SubProcess"])&&hD(t,o),v(a,"bpmn:BoundaryEvent")&&s===a.host&&mD(t)):ix(i,"bpmn:MessageFlow")?(v(r,"bpmn:Event")&&(n.connectionStart=Zn(r)),v(o,"bpmn:Event")&&nx(t,Zn(o))):n.connectionStart=n.initialConnectionStart)})}tx.$inject=["eventBus"];function dD(e,t,n){ex.forEach(function(i){var r=rx(i,t);e[i]<t[i]+n?Dt(e,i,t[i]+n):e[i]>t[i]+r-n&&Dt(e,i,t[i]+r-n)})}function hD(e,t){var n=Zn(t);ex.forEach(function(i){vD(e,t,i)&&Dt(e,i,n[i])})}function mD(e){var t=e.context,n=t.source,i=t.target;if(!_D(t)){var r=Zn(n),o=Zt(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;fD(c-r[s])<If&&(c>r[s]?u=r[s]+If:u=r[s]-If,Dt(e,s,u))})}}function nx(e,t){Dt(e,"x",t.x),Dt(e,"y",t.y)}function ix(e,t){return e&&e.type===t}function gD(e,t){return Vi(t,function(n){return ix(e,n)})}function rx(e,t){return e==="x"?t.width:t.height}function yD(e){return v(e,"bpmn:Task")?pD:lD}function vD(e,t,n){return e[n]>t[n]+Jb&&e[n]<t[n]+rx(n,t)-Jb}function _D(e){var t=e.hover,n=e.source;return t&&n&&t===n}function xr(){this._targets={},this._snapOrigins={},this._snapLocations=[],this._defaultSnaps={}}xr.prototype.getSnapOrigin=function(e){return this._snapOrigins[e]},xr.prototype.setSnapOrigin=function(e,t){this._snapOrigins[e]=t,this._snapLocations.indexOf(e)===-1&&this._snapLocations.push(e)},xr.prototype.addDefaultSnap=function(e,t){var n=this._defaultSnaps[e];n||(n=this._defaultSnaps[e]=[]),n.push(t)},xr.prototype.getSnapLocations=function(){return this._snapLocations},xr.prototype.setSnapLocations=function(e){this._snapLocations=e},xr.prototype.pointsForTarget=function(e){var t=e.id||e,n=this._targets[t];return n||(n=this._targets[t]=new yu,n.initDefaults(this._defaultSnaps)),n};function yu(){this._snapValues={}}yu.prototype.add=function(e,t){var n=this._snapValues[e];n||(n=this._snapValues[e]={x:[],y:[]}),n.x.indexOf(t.x)===-1&&n.x.push(t.x),n.y.indexOf(t.y)===-1&&n.y.push(t.y)},yu.prototype.snap=function(e,t,n,i){var r=this._snapValues[t];return r&&s2(e[n],r[n],i)},yu.prototype.initDefaults=function(e){var t=this;M(e||{},function(n,i){M(n,function(r){t.add(i,r)})})};var bD=1250;function bi(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&&Tn(r.originalEvent))&&!(Io(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()})}bi.$inject=["elementRegistry","eventBus","snapping"],bi.prototype.initSnap=function(e){var t=this._elementRegistry,n=e.context,i=n.shape,r=n.snapContext;r||(r=n.snapContext=new xr);var o;t.get(i.id)?o=Zn(i,e):o={x:e.x+Zn(i).x,y:e.y+Zn(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}),Me(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},bi.prototype.addSnapTargetPoints=function(e,t,n){var i=this.getSnapTargets(t,n);return M(i,function(r){if(Me(r)){Me(t)&&e.add("mid",Zn(r));return}if(it(r)){if(r.waypoints.length<3)return;var o=r.waypoints.slice(1,-1);M(o,function(a){e.add("mid",a)});return}e.add("mid",Zn(r))}),!we(t.x)||!we(t.y)||this._elementRegistry.get(t.id)&&e.add("mid",Zn(t)),e},bi.prototype.getSnapTargets=function(e,t){return G_(t).filter(function(n){return!xD(n)})};function xD(e){return!!e.hidden}var ox=1500;function $o(e,t){t.invoke(bi,this),e.on(["create.move","create.end"],ox,RD),e.on(["create.move","create.end","shape.move.move","shape.move.end"],ox,function(n){var i=n.context,r=i.canExecute,o=i.target,a=r&&(r==="attach"||r.attach);a&&!Io(n)&&wD(n,o)})}ie($o,bi),$o.$inject=["eventBus","injector"],$o.prototype.initSnap=function(e){var t=bi.prototype.initSnap.call(this,e),n=e.shape,i=!!this._elementRegistry.get(n.id);return M(n.outgoing,function(r){var o=r.waypoints[0];o=o.original||o,t.setSnapOrigin(r.id+"-docking",sx(o,i,e))}),M(n.incoming,function(r){var o=r.waypoints[r.waypoints.length-1];o=o.original||o,t.setSnapOrigin(r.id+"-docking",sx(o,i,e))}),v(n,"bpmn:Participant")&&t.setSnapLocations(["top-left","bottom-right","mid"]),t},$o.prototype.addSnapTargetPoints=function(e,t,n){bi.prototype.addSnapTargetPoints.call(this,e,t,n);var i=this.getSnapTargets(t,n);M(i,function(o){(SD(o)||ED([t,o],"bpmn:TextAnnotation"))&&(e.add("top-left",z_(o)),e.add("bottom-right",V_(o)))});var r=this._elementRegistry;return M(t.incoming,function(o){if(r.get(t.id)){ax(i,o.source)||e.add("mid",be(o.source));var a=o.waypoints[0];e.add(o.id+"-docking",a.original||a)}}),M(t.outgoing,function(o){if(r.get(t.id)){ax(i,o.target)||e.add("mid",be(o.target));var a=o.waypoints[o.waypoints.length-1];e.add(o.id+"-docking",a.original||a)}}),v(n,"bpmn:SequenceFlow")&&(e=this.addSnapTargetPoints(e,t,n.parent)),e},$o.prototype.getSnapTargets=function(e,t){return bi.prototype.getSnapTargets.call(this,e,t).filter(function(n){return!v(n,"bpmn:Lane")})};function wD(e,t){var n=ye(t),i=wg(e,t),r=e.context,o=r.shape,a;o.parent?a={x:0,y:0}:a=be(o),/top/.test(i)?Dt(e,"y",n.top-a.y):/bottom/.test(i)&&Dt(e,"y",n.bottom-a.y),/left/.test(i)?Dt(e,"x",n.left-a.x):/right/.test(i)&&Dt(e,"x",n.right-a.x)}function ED(e,t){return e.every(function(n){return v(n,t)})}function SD(e){return v(e,"bpmn:SubProcess")&&$e(e)?!0:v(e,"bpmn:Participant")}function RD(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)&&Dt(e,"x",e.x),(i&&i>=e.y||o&&o<=e.y)&&Dt(e,"y",e.y)}}function ax(e,t){return e.indexOf(t)!==-1}function sx(e,t,n){return t?{x:e.x-n.x,y:e.y-n.y}:{x:e.x,y:e.y}}var CD=1250;function Ya(e,t){var n=this;e.on(["resize.start"],function(i){n.initSnap(i)}),e.on(["resize.move","resize.end"],CD,function(i){var r=i.context,o=r.shape,a=o.parent,s=r.direction,c=r.snapContext;if(!(i.originalEvent&&Tn(i.originalEvent))&&!Io(i)){var u=c.pointsForTarget(a);u.initialized||(u=n.addSnapTargetPoints(u,o,a,s),u.initialized=!0),TD(s)&&Dt(i,"x",i.x),MD(s)&&Dt(i,"y",i.y),t.snap(i,u)}}),e.on(["resize.cleanup"],function(){t.hide()})}Ya.prototype.initSnap=function(e){var t=e.context,n=t.shape,i=t.direction,r=t.snapContext;r||(r=t.snapContext=new xr);var o=cx(n,i);return r.setSnapOrigin("corner",{x:o.x-e.x,y:o.y-e.y}),r},Ya.prototype.addSnapTargetPoints=function(e,t,n,i){var r=this.getSnapTargets(t,n);return M(r,function(o){e.add("corner",V_(o)),e.add("corner",z_(o))}),e.add("corner",cx(t,i)),e},Ya.$inject=["eventBus","snapping"],Ya.prototype.getSnapTargets=function(e,t){return G_(t).filter(function(n){return!PD(n,e)&&!it(n)&&!AD(n)&&!Me(n)})};function cx(e,t){var n=be(e),i=ye(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 PD(e,t){return e.host===t}function AD(e){return!!e.hidden}function TD(e){return e==="n"||e==="s"}function MD(e){return e==="e"||e==="w"}var kD=7,DD=1e3;function wr(e){this._canvas=e,this._asyncHide=Ru(vn(this.hide,this),DD)}wr.$inject=["canvas"],wr.prototype.snap=function(e,t){var n=e.context,i=n.snapContext,r=i.getSnapLocations(),o={x:Io(e,"x"),y:Io(e,"y")};M(r,function(a){var s=i.getSnapOrigin(a),c={x:e.x+s.x,y:e.y+s.y};if(M(["x","y"],function(u){var l;o[u]||(l=t.snap(c,a,u,kD),l!==void 0&&(o[u]={value:l,originValue:l-s[u]}))}),o.x&&o.y)return!1}),this.showSnapLine("vertical",o.x&&o.x.value),this.showSnapLine("horizontal",o.y&&o.y.value),M(["x","y"],function(a){var s=o[a];Gt(s)&&Dt(e,a,s.originValue)})},wr.prototype._createLine=function(e){var t=this._canvas.getLayer("snap"),n=me("path");return re(n,{d:"M0,0 L0,0"}),je(n).add("djs-snap-line"),Re(t,n),{update:function(i){we(i)?e==="horizontal"?re(n,{d:"M-100000,"+i+" L+100000,"+i,display:""}):re(n,{d:"M "+i+",-100000 L "+i+", +100000",display:""}):re(n,{display:"none"})}}},wr.prototype._createSnapLines=function(){this._snapLines={horizontal:this._createLine("horizontal"),vertical:this._createLine("vertical")}},wr.prototype.showSnapLine=function(e,t){var n=this.getSnapLine(e);n&&n.update(t),this._asyncHide()},wr.prototype.getSnapLine=function(e){return this._snapLines||this._createSnapLines(),this._snapLines[e]},wr.prototype.hide=function(){M(this._snapLines,function(e){e.update()})};const OD={__depends__:[{__init__:["createMoveSnapping","resizeSnapping","snapping"],createMoveSnapping:["type",bi],resizeSnapping:["type",Ya],snapping:["type",wr]}],__init__:["connectSnapping","createMoveSnapping"],connectSnapping:["type",tx],createMoveSnapping:["type",$o]};var ux=300;function Ce(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=et(Ce.INPUT_SELECTOR,this._container),this._resultsContainer=et(Ce.RESULTS_CONTAINER_SELECTOR,this._container),this._canvas.getContainer().appendChild(this._container),t.on(["canvas.destroy","diagram.destroy","drag.init","elements.changed"],this.close,this)}Ce.$inject=["canvas","eventBus","selection","translate"],Ce.prototype._bindEvents=function(){var e=this;function t(n,i,r,o){e._eventMaps.push({el:n,type:r,listener:Cn.bind(n,i,r,o)})}t(document,"html","click",function(n){e.close(!1)}),t(this._container,Ce.INPUT_SELECTOR,"click",function(n){n.stopPropagation(),n.delegateTarget.focus()}),t(this._container,Ce.RESULT_SELECTOR,"mouseover",function(n){n.stopPropagation(),e._scrollToNode(n.delegateTarget),e._preselect(n.delegateTarget)}),t(this._container,Ce.RESULT_SELECTOR,"click",function(n){n.stopPropagation(),e._select(n.delegateTarget)}),t(this._container,Ce.INPUT_SELECTOR,"keydown",function(n){Ht("ArrowUp",n)&&n.preventDefault(),Ht("ArrowDown",n)&&n.preventDefault()}),t(this._container,Ce.INPUT_SELECTOR,"keyup",function(n){if(Ht("Escape",n))return e.close();if(Ht("Enter",n)){var i=e._getCurrentResult();return i?e._select(i):e.close(!1)}if(Ht("ArrowUp",n))return e._scrollToDirection(!0);if(Ht("ArrowDown",n))return e._scrollToDirection();Ht(["ArrowLeft","ArrowRight"],n)||e._search(n.delegateTarget.value)})},Ce.prototype._unbindEvents=function(){this._eventMaps.forEach(function(e){Cn.unbind(e.el,e.type,e.listener)})},Ce.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=et(Ce.RESULT_SELECTOR,this._resultsContainer);this._scrollToNode(i),this._preselect(i)}},Ce.prototype._scrollToDirection=function(e){var t=this._getCurrentResult();if(t){var n=e?t.previousElementSibling:t.nextElementSibling;n&&(this._scrollToNode(n),this._preselect(n))}},Ce.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)}},Ce.prototype._clearResults=function(){ms(this._resultsContainer),this._results={},this._eventBus.fire("searchPad.cleared")},Ce.prototype._getCurrentResult=function(){return et(Ce.RESULT_SELECTED_SELECTOR,this._resultsContainer)},Ce.prototype._createResultNode=function(e,t){var n=ut(Ce.RESULT_HTML);return e.primaryTokens.length>0&&lx(n,e.primaryTokens,Ce.RESULT_PRIMARY_HTML),lx(n,e.secondaryTokens,Ce.RESULT_SECONDARY_HTML),an(n,Ce.RESULT_ID_ATTRIBUTE,t),this._resultsContainer.appendChild(n),n},Ce.prototype.registerProvider=function(e){this._searchProvider=e},Ce.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,mt(this._canvas.getContainer()).add("djs-search-open"),mt(this._container).add("open"),this._searchInput.focus(),this._eventBus.fire("searchPad.opened"))},Ce.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,mt(this._canvas.getContainer()).remove("djs-search-open"),mt(this._container).remove("open"),this._clearResults(),this._searchInput.value="",this._searchInput.blur(),this._eventBus.fire("searchPad.closed"),this._canvas.restoreFocus())},Ce.prototype.toggle=function(){this.isOpen()?this.close():this.open()},Ce.prototype.isOpen=function(){return this._open},Ce.prototype._preselect=function(e){var t=this._getCurrentResult();if(e!==t){t&&mt(t).remove(Ce.RESULT_SELECTED_CLASS);var n=an(e,Ce.RESULT_ID_ATTRIBUTE),i=this._results[n].element;mt(e).add(Ce.RESULT_SELECTED_CLASS),this._canvas.scrollToElement(i,{top:ux}),this._selection.select(i),this._eventBus.fire("searchPad.preselected",i)}},Ce.prototype._select=function(e){var t=an(e,Ce.RESULT_ID_ATTRIBUTE),n=this._results[t].element;this._cachedSelection=null,this._cachedViewbox=null,this.close(!1),this._canvas.scrollToElement(n,{top:ux}),this._selection.select(n),this._eventBus.fire("searchPad.selected",n)},Ce.prototype._getBoxHtml=function(){const e=ut(Ce.BOX_HTML),t=et(Ce.INPUT_SELECTOR,e);return t&&t.setAttribute("aria-label",this._translate("Search in diagram")),e};function lx(e,t,n){var i=LD(t),r=ut(n);r.innerHTML=i,e.appendChild(r)}function LD(e){var t="";return e.forEach(function(n){var i=vv(n.value||n.matched||n.normal),r=n.match||n.matched;r?t+='<b class="'+Ce.RESULT_HIGHLIGHT_CLASS+'">'+i+"</b>":t+=i}),t!==""?t:null}Ce.CONTAINER_SELECTOR=".djs-search-container",Ce.INPUT_SELECTOR=".djs-search-input input",Ce.RESULTS_CONTAINER_SELECTOR=".djs-search-results",Ce.RESULT_SELECTOR=".djs-search-result",Ce.RESULT_SELECTED_CLASS="djs-search-result-selected",Ce.RESULT_SELECTED_SELECTOR="."+Ce.RESULT_SELECTED_CLASS,Ce.RESULT_ID_ATTRIBUTE="data-result-id",Ce.RESULT_HIGHLIGHT_CLASS="djs-search-highlight",Ce.BOX_HTML=`<div class="djs-search-container djs-scrollable">
335
+ </svg>`},G2=900;function za(e,t,n,i){this._distributeElements=t,this._translate=n,this._popupMenu=e,this._rules=i,e.registerProvider("align-elements",G2,this)}za.$inject=["popupMenu","distributeElements","translate","rules"],za.prototype.getPopupMenuEntries=function(e){var t={};return this._isAllowed(e)&&O(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:cb.horizontal,action:function(o,a){t.trigger(e,"horizontal"),i.close()}},"distribute-elements-vertical":{group:"distribute",title:n("Distribute elements vertically"),imageHtml:cb.vertical,action:function(o,a){t.trigger(e,"vertical"),i.close()}}};return r};const W2={__depends__:[df,V2],__init__:["bpmnDistributeElements","distributeElementsMenuProvider"],bpmnDistributeElements:["type",ru],distributeElementsMenuProvider:["type",za]};var ub="is not a registered action",U2="is already registered";function Jn(e,t){this._eventBus=e,this._actions={};var n=this;e.on("diagram.init",function(){n._registerDefaultActions(t),e.fire("editorActions.init",{editorActions:n})})}Jn.$inject=["eventBus","injector"],Jn.prototype._registerDefaultActions=function(e){var t=e.get("commandStack",!1),n=e.get("modeling",!1),i=e.get("selection",!1),r=e.get("zoomScroll",!1),o=e.get("copyPaste",!1),a=e.get("canvas",!1),s=e.get("rules",!1),c=e.get("keyboardMove",!1),u=e.get("keyboardMoveSelection",!1);t&&(this.register("undo",function(){t.undo()}),this.register("redo",function(){t.redo()})),o&&i&&this.register("copy",function(){var l=i.get();if(l.length)return o.copy(l)}),o&&i&&this.register("duplicate",function(){var l=i.get();if(l.length)return o.duplicate(l)}),o&&this.register("paste",function(){o.paste()}),o&&i&&s&&this.register("cut",function(){var l=i.get();if(l.length){var p=s.allowed("elements.delete",{elements:l});if(p!==!1){var f=_e(p)?p:l;return o.cut(f.slice())}}}),r&&this.register("stepZoom",function(l){r.stepZoom(l.value)}),a&&this.register("zoom",function(l){a.zoom(l.value)}),n&&i&&s&&this.register("removeSelection",function(){var l=i.get();if(l.length){var p=s.allowed("elements.delete",{elements:l}),f;p!==!1&&(_e(p)?f=p:f=l,f.length&&n.removeElements(f.slice()))}}),c&&this.register("moveCanvas",function(l){c.moveCanvas(l)}),u&&this.register("moveSelection",function(l){u.moveSelection(l.direction,l.accelerated)})},Jn.prototype.trigger=function(e,t){if(!this._actions[e])throw Ef(e,ub);var n=this._eventBus.fire("editorActions.allowed",{action:e,opts:t});if(n!==!1)return this._actions[e](t)},Jn.prototype.register=function(e,t){var n=this;if(typeof e=="string")return this._registerAction(e,t);k(e,function(i,r){n._registerAction(r,i)})},Jn.prototype._registerAction=function(e,t){if(this.isRegistered(e))throw Ef(e,U2);this._actions[e]=t},Jn.prototype.unregister=function(e){if(!this.isRegistered(e))throw Ef(e,ub);this._actions[e]=void 0},Jn.prototype.getActions=function(){return Object.keys(this._actions)},Jn.prototype.isRegistered=function(e){return!!this._actions[e]};function Ef(e,t){return new Error(e+" "+t)}const Y2={__init__:["editorActions"],editorActions:["type",Jn]};function ou(e){e.invoke(Jn,this)}ie(ou,Jn),ou.$inject=["injector"],ou.prototype._registerDefaultActions=function(e){Jn.prototype._registerDefaultActions.call(this,e);var t=e.get("canvas",!1),n=e.get("elementRegistry",!1),i=e.get("selection",!1),r=e.get("spaceTool",!1),o=e.get("lassoTool",!1),a=e.get("handTool",!1),s=e.get("globalConnect",!1),c=e.get("distributeElements",!1),u=e.get("alignElements",!1),l=e.get("directEditing",!1),p=e.get("searchPad",!1),f=e.get("modeling",!1),d=e.get("contextPad",!1);t&&n&&i&&this._registerAction("selectElements",function(){var h=t.getRootElement(),m=n.filter(function(g){return g!==h});return i.select(m),m}),r&&this._registerAction("spaceTool",function(){r.toggle()}),o&&this._registerAction("lassoTool",function(){o.toggle()}),a&&this._registerAction("handTool",function(){a.toggle()}),s&&this._registerAction("globalConnectTool",function(){s.toggle()}),i&&c&&this._registerAction("distributeElements",function(h){var m=i.get(),g=h.type;m.length&&c.trigger(m,g)}),i&&u&&this._registerAction("alignElements",function(h){var m=i.get(),g=[],R=h.type;m.length&&(g=Oe(m,function(w){return!v(w,"bpmn:Lane")}),u.trigger(g,R))}),i&&f&&this._registerAction("setColor",function(h){var m=i.get();m.length&&f.setColor(m,h)}),i&&l&&this._registerAction("directEditing",function(){var h=i.get();h.length&&l.activate(h[0])}),p&&this._registerAction("find",function(){p.toggle()}),t&&f&&this._registerAction("moveToOrigin",function(){var h=t.getRootElement(),m,g;v(h,"bpmn:Collaboration")?g=n.filter(function(R){return v(R.parent,"bpmn:Collaboration")}):g=n.filter(function(R){return R!==h&&!v(R.parent,"bpmn:SubProcess")}),m=At(g),f.moveElements(g,{x:-m.x,y:-m.y},h)}),i&&d&&this._registerAction("replaceElement",function(h){d.triggerEntry("replace","click",h)})};const q2={__depends__:[Y2],editorActions:["type",ou]};function lb(e){e.on(["create.init","shape.move.init"],function(t){var n=t.context,i=t.shape;De(i,["bpmn:Participant","bpmn:SubProcess","bpmn:TextAnnotation"])&&(n.gridSnappingContext||(n.gridSnappingContext={}),n.gridSnappingContext.snapLocation="top-left")})}lb.$inject=["eventBus"];function Yr(e,t){X.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;wn(a)?r.newBounds=n.snapComplex(c,a):r.newBounds=n.snapSimple(s,c)}})}Yr.$inject=["eventBus","gridSnapping","modeling"],ie(Yr,X),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),O(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),O(e,o),e};var K2=2e3;function pb(e,t){e.on(["spaceTool.move","spaceTool.end"],K2,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)}})}pb.$inject=["eventBus","gridSnapping"];const X2={__init__:["gridSnappingResizeBehavior","gridSnappingSpaceToolBehavior"],gridSnappingResizeBehavior:["type",Yr],gridSnappingSpaceToolBehavior:["type",pb]};var au=10;function Sf(e,t,n){return n||(n="round"),Math[n](e/t)*t}var Z2=1200,Q2=800;function yr(e,t,n){var i=!n||n.active!==!1;this._eventBus=t;var r=this;t.on("diagram.init",Q2,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"],Z2,function(o){var a=o.originalEvent;if(!(!r.active||a&&Tn(a))){var s=o.context,c=s.gridSnappingContext;c||(c=s.gridSnappingContext={}),["x","y"].forEach(function(u){var l={},p=ek(o,u,e);p&&(l.offset=p);var f=J2(o,u);f&&O(l,f),Io(o,u)||r.snapEvent(o,u,l)})}})}yr.prototype.snapEvent=function(e,t,n){var i=this.snapValue(e[t],n);Dt(e,t,i)},yr.prototype.getGridSpacing=function(){return au},yr.prototype.snapValue=function(e,t){var n=0;t&&t.offset&&(n=t.offset),e+=n,e=Sf(e,au);var i,r;return t&&t.min&&(i=t.min,we(i)&&(i=Sf(i+n,au,"ceil"),e=Math.max(e,i))),t&&t.max&&(r=t.max,we(r)&&(r=Sf(r+n,au,"floor"),e=Math.min(e,r))),e-=n,e},yr.prototype.isActive=function(){return this.active},yr.prototype.setActive=function(e){this.active=e,this._eventBus.fire("gridSnapping.toggle",{active:e})},yr.prototype.toggleActive=function(){this.setActive(!this.active)},yr.$inject=["elementRegistry","eventBus","config.gridSnapping"];function J2(e,t){var n=e.context,i=n.createConstraints,r=n.resizeConstraints||{},o=n.gridSnappingContext,a=o.snapConstraints;if(a&&a[t])return a[t];a||(a=o.snapConstraints={}),a[t]||(a[t]={});var s=n.direction;i&&(su(t)?(a.x.min=i.left,a.x.max=i.right):(a.y.min=i.top,a.y.max=i.bottom));var c=r.min,u=r.max;return c&&(su(t)?db(s)?a.x.max=c.left:a.x.min=c.right:fb(s)?a.y.max=c.top:a.y.min=c.bottom),u&&(su(t)?db(s)?a.x.min=u.left:a.x.max=u.right:fb(s)?a.y.min=u.top:a.y.max=u.bottom),a[t]}function ek(e,t,n){var i=e.context,r=e.shape,o=i.gridSnappingContext,a=o.snapLocation,s=o.snapOffset;return s&&we(s[t])||(s||(s=o.snapOffset={}),we(s[t])||(s[t]=0),!r)||(n.get(r.id)||(su(t)?s[t]+=r[t]+r.width/2:s[t]+=r[t]+r.height/2),!a)||(t==="x"?/left/.test(a)?s[t]-=r.width/2:/right/.test(a)&&(s[t]+=r.width/2):/top/.test(a)?s[t]-=r.height/2:/bottom/.test(a)&&(s[t]+=r.height/2)),s[t]}function su(e){return e==="x"}function fb(e){return e.indexOf("n")!==-1}function db(e){return e.indexOf("w")!==-1}const tk={__depends__:[X2],__init__:["gridSnapping"],gridSnapping:["type",yr]};var nk=2e3;function hb(e,t,n){e.on("autoPlace",nk,function(i){var r=i.source,o=be(r),a=i.shape,s=dv(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],v(a,"bpmn:TextAnnotation")&&(ik(c)?u.offset=-a.width/2:u.offset=-a.height/2),s[c]=t.snapValue(s[c],u))}),s})}hb.$inject=["eventBus","gridSnapping","elementRegistry"];function ik(e){return e==="x"}var rk=1750;function mb(e,t,n){t.on(["create.start","shape.move.start"],rk,function(i){var r=i.context,o=r.shape,a=e.getRootElement();if(!(!v(o,"bpmn:Participant")||!v(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}))}})}mb.$inject=["canvas","eventBus","gridSnapping"];var ok=3e3;function cu(e,t,n){X.call(this,e),this._gridSnapping=t;var i=this;this.postExecuted(["connection.create","connection.layout"],ok,function(r){var o=r.context,a=o.connection,s=o.hints||{},c=a.waypoints;s.connectionStart||s.connectionEnd||s.createElementsBehavior===!1||ak(c)&&n.updateWaypoints(a,i.snapMiddleSegments(c))})}cu.$inject=["eventBus","gridSnapping","modeling"],ie(cu,X),cu.prototype.snapMiddleSegments=function(e){var t=this._gridSnapping,n;e=e.slice();for(var i=1;i<e.length-2;i++)n=uk(t,e[i],e[i+1]),e[i]=n[0],e[i+1]=n[1];return e};function ak(e){return e.length>3}function sk(e){return e==="h"}function ck(e){return e==="v"}function uk(e,t,n){var i=Ai(t,n),r={};return sk(i)&&(r.y=e.snapValue(t.y)),ck(i)&&(r.x=e.snapValue(t.x)),("x"in r||"y"in r)&&(t=O({},t,r),n=O({},n,r)),[t,n]}const lk={__depends__:[tk,{__init__:["gridSnappingAutoPlaceBehavior","gridSnappingParticipantBehavior","gridSnappingLayoutConnectionBehavior"],gridSnappingAutoPlaceBehavior:["type",hb],gridSnappingParticipantBehavior:["type",mb],gridSnappingLayoutConnectionBehavior:["type",cu]}],__init__:["bpmnGridSnapping"],bpmnGridSnapping:["type",lb]};var pk=30,gb=30;function Va(e,t){this._interactionEvents=t;var n=this;e.on(["interactionEvents.createHit","interactionEvents.updateHit"],function(i){var r=i.element,o=i.gfx;if(v(r,"bpmn:Lane"))return n._createParticipantHit(r,o);if(v(r,"bpmn:Participant"))return $e(r)?n._createParticipantHit(r,o):n._createDefaultHit(r,o);if(v(r,"bpmn:SubProcess"))return $e(r)?n._createSubProcessHit(r,o):n._createDefaultHit(r,o)})}Va.$inject=["eventBus","interactionEvents"],Va.prototype._createDefaultHit=function(e,t){return this._interactionEvents.removeHits(t),this._interactionEvents.createDefaultHit(e,t),!0},Va.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=Yt(e)?{width:pk,height:e.height}:{width:e.width,height:gb};return this._interactionEvents.createBoxHit(t,"all",n),!0},Va.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:gb}),!0};const fk={__init__:["bpmnInteractionEvents"],bpmnInteractionEvents:["type",Va]};function uu(e){e.invoke(Ao,this)}ie(uu,Ao),uu.$inject=["injector"],uu.prototype.registerBindings=function(e,t){Ao.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 dk={__depends__:[Zp],__init__:["keyboardBindings"],keyboardBindings:["type",uu]};var hk={moveSpeed:1,moveSpeedAccelerated:10},mk=1500,yb="left",vb="up",_b="right",bb="down",gk={ArrowLeft:yb,Left:yb,ArrowUp:vb,Up:vb,ArrowRight:_b,Right:_b,ArrowDown:bb,Down:bb},yk={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 xb(e,t,n,i,r){var o=this;this._config=O({},hk,e||{}),t.addListener(mk,function(a){var s=a.keyEvent,c=gk[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=yk[a](u),p=i.allowed("elements.move",{shapes:c,hints:{keyboardMove:!0}});p&&n.moveElements(c,l)}}}xb.$inject=["config.keyboardMoveSelection","keyboard","modeling","rules","selection"];const vk={__depends__:[Zp,qn],__init__:["keyboardMoveSelection"],keyboardMoveSelection:["type",xb]};var wb=10;function Ga(e,t,n,i){this._dragging=i,this._rules=t;var r=this;function o(c,u){var l=c.shape,p=c.direction,f=c.resizeConstraints,d;c.delta=u,d=hR(l,p,u),c.newBounds=gR(d,f),c.canExecute=r.canResize(c)}function a(c){var u=c.resizeConstraints,l=c.minBounds;u===void 0&&(l===void 0&&(l=r.computeMinResizeBox(c)),c.resizeConstraints={min:ye(l)})}function s(c){var u=c.shape,l=c.canExecute,p=c.newBounds;if(l){if(p=jh(p),!_k(u,p))return;n.resizeShape(u,p)}}e.on("resize.start",function(c){a(c.context)}),e.on("resize.move",function(c){var u={x:c.dx,y:c.dy};o(c.context,u)}),e.on("resize.end",function(c){s(c.context)})}Ga.prototype.canResize=function(e){var t=this._rules,n=ni(e,["newBounds","shape","delta","direction"]);return t.allowed("shape.resize",n)},Ga.prototype.activate=function(e,t,n){var i=this._dragging,r,o;if(typeof n=="string"&&(n={direction:n}),r=O({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,Eb(t,o),"resize",{autoActivate:!0,cursor:bk(o),data:{shape:t,context:r}})},Ga.prototype.computeMinResizeBox=function(e){var t=e.shape,n=e.direction,i,r;return i=e.minDimensions||{width:wb,height:wb},r=Cm(t,e.childrenBoxPadding),yR(n,t,i,r)},Ga.$inject=["eventBus","rules","modeling","dragging"];function _k(e,t){return e.x!==t.x||e.y!==t.y||e.width!==t.width||e.height!==t.height}function Eb(e,t){var n=be(e),i=ye(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 bk(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 Sb="djs-resizing",Rb="resize-not-ok",xk=500;function Cb(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,Sb)),s.width>5&&re(c,{x:s.x,width:s.width}),s.height>5&&re(c,{y:s.y,height:s.height}),o.canExecute?je(c).remove(Rb):je(c).add(Rb)}function r(o){var a=o.shape,s=o.frame;s&&Ft(o.frame),t.removeMarker(a,Sb)}e.on("resize.move",xk,function(o){i(o.context)}),e.on("resize.cleanup",function(o){r(o.context)})}Cb.$inject=["eventBus","canvas","previewSupport"];var lu=-6,pu=8,fu=20,Wa="djs-resizer",wk=["n","w","s","e","nw","ne","se","sw"];function vr(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&&k(a,vn(r.addResizer,r))}),e.on("shape.changed",function(o){var a=o.element;n.isSelected(a)&&(r.removeResizers(),r.addResizer(a))})}vr.prototype.makeDraggable=function(e,t,n){var i=this._resize;function r(o){ar(o)&&i.activate(o,e,n)}Se.bind(t,"mousedown",r),Se.bind(t,"touchstart",r)},vr.prototype._createResizer=function(e,t,n,i){var r=this._getResizersParent(),o=Ek(i),a=me("g");je(a).add(Wa),je(a).add(Wa+"-"+e.id),je(a).add(Wa+"-"+i),Re(r,a);var s=me("rect");re(s,{x:-pu/2+o.x,y:-pu/2+o.y,width:pu,height:pu}),je(s).add(Wa+"-visual"),Re(a,s);var c=me("rect");return re(c,{x:-fu/2+o.x,y:-fu/2+o.y,width:fu,height:fu}),je(c).add(Wa+"-hit"),Re(a,c),Cs(a,t,n),a},vr.prototype.createResizer=function(e,t){var n=Eb(e,t),i=this._createResizer(e,n.x,n.y,t);this.makeDraggable(e,i,t)},vr.prototype.addResizer=function(e){var t=this;it(e)||k(wk,function(n){t._resize.canResize({shape:e,direction:n})&&t.createResizer(e,n)})},vr.prototype.removeResizers=function(){var e=this._getResizersParent();ys(e)},vr.prototype._getResizersParent=function(){return this._canvas.getLayer("resizers")},vr.$inject=["eventBus","canvas","selection","resize"];function Ek(e){var t={x:0,y:0};return e.indexOf("e")!==-1?t.x=-lu:e.indexOf("w")!==-1&&(t.x=lu),e.indexOf("s")!==-1?t.y=-lu:e.indexOf("n")!==-1&&(t.y=lu),t}const Pb={__depends__:[gi,Li,Ro],__init__:["resize","resizePreview","resizeHandles"],resize:["type",Ga],resizePreview:["type",Cb],resizeHandles:["type",vr]};var Sk=2e3;function Ua(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"],Sk,function(c){i.isActive(c.element)&&i.cancel()}),e.on(["commandStack.changed"],function(c){i.isActive()&&i.cancel()}),e.on("directEditing.activate",function(c){o.removeResizers()}),e.on("create.end",500,function(c){var u=c.context,l=u.shape,p=c.context.canExecute,f=c.isTouch;f||p&&(u.hints&&u.hints.createElementsBehavior===!1||s(l))}),e.on("autoPlace.end",500,function(c){s(c.shape)});function s(c,u){(u||De(c,["bpmn:Activity","bpmn:Event","bpmn:TextAnnotation","bpmn:Participant"]))&&i.activate(c)}}Ua.$inject=["eventBus","bpmnFactory","canvas","directEditing","modeling","resizeHandles","textRenderer"],Ua.prototype.activate=function(e){var t=jn(e);if(t!==void 0){var n={text:t},i=this.getEditingBBox(e);O(n,i);var r={},o=n.style||{};return O(o,{backgroundColor:null,border:null}),(De(e,["bpmn:Task","bpmn:Participant","bpmn:Lane","bpmn:CallActivity"])||Ab(e))&&O(r,{centerVertically:!0}),nr(e)&&(O(r,{resizable:!0,autoResize:!0}),O(o,{backgroundColor:"#ffffff",border:"1px solid #ccc"})),v(e,"bpmn:TextAnnotation")&&(O(r,{resizable:!0,autoResize:!0}),O(o,{backgroundColor:"#ffffff",border:"1px solid #ccc"})),O(n,{options:r,style:o}),n}},Ua.prototype.getEditingBBox=function(e){var t=this._canvas,n=e.label||e,i=t.getAbsoluteBBox(n),r={x:i.x+i.width/2,y:i.y+i.height/2},o={x:i.x,y:i.y},a=t.zoom(),s=this._textRenderer.getDefaultStyle(),c=this._textRenderer.getExternalStyle(),u=c.fontSize*a,l=c.lineHeight,p=s.fontSize*a,f=s.lineHeight,d={fontFamily:this._textRenderer.getDefaultStyle().fontFamily,fontWeight:this._textRenderer.getDefaultStyle().fontWeight};if(v(e,"bpmn:Lane")||Pk(e)){var h=Yt(e),m=h?{width:i.height,height:30*a,x:i.x-i.height/2+15*a,y:r.y-30*a/2}:{width:i.width,height:30*a};O(o,m),O(d,{fontSize:p+"px",lineHeight:f,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px",transform:h?"rotate(-90deg)":null})}if(Ck(e)){var g=Yt(e),R=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};O(o,R),O(d,{fontSize:p+"px",lineHeight:f,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px",transform:g?null:"rotate(-90deg)"})}(De(e,["bpmn:Task","bpmn:CallActivity"])||Ab(e))&&(O(o,{width:i.width,height:i.height}),O(d,{fontSize:p+"px",lineHeight:f,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px"})),Rk(e)&&(O(o,{width:i.width,x:i.x}),O(d,{fontSize:p+"px",lineHeight:f,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px"}));var w=1,b=i.width+2*w;if(n.labelTarget&&(O(o,{width:b,height:i.height+2*w,x:i.x-w,y:i.y-w}),O(d,{fontSize:u+"px",lineHeight:l})),nr(n)&&!Ts(n)&&!Me(n)){var x=pl(e),E=t.getAbsoluteBBox({x:x.x,y:x.y,width:0,height:0}),T=u,L=Ir.width*a+2*w;O(o,{width:L,height:T+2*w,x:E.x-L/2,y:E.y-T/2-w}),O(d,{fontSize:u+"px",lineHeight:l})}return v(e,"bpmn:TextAnnotation")&&(O(o,{width:i.width+2*w,height:i.height+2*w,x:i.x-w,y:i.y-w,minWidth:30*a,minHeight:10*a}),O(d,{textAlign:"left",paddingTop:po*a+"px",paddingBottom:po*a+"px",paddingLeft:po*a+"px",paddingRight:po*a+"px",fontSize:p+"px",lineHeight:f})),{bounds:o,style:d}},Ua.prototype.update=function(e,t,n,i){var r,o;v(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}),Ak(t)&&(t=null),this._modeling.updateLabel(e,t,r)};function Ab(e){return v(e,"bpmn:SubProcess")&&!$e(e)}function Rk(e){return v(e,"bpmn:SubProcess")&&$e(e)}function Ck(e){return v(e,"bpmn:Participant")&&!$e(e)}function Pk(e){return v(e,"bpmn:Participant")&&$e(e)}function Ak(e){return!e||!e.trim()}var Tb="djs-element-hidden",Mb="djs-label-hidden";function kb(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,v(o,"bpmn:TextAnnotation")){a=t.getAbsoluteBBox(o),s=me("g");var l=n.getScaledPath("TEXT_ANNOTATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:o.width,containerHeight:o.height,position:{mx:0,my:0}}),p=i.path=me("path");re(p,{d:l,strokeWidth:2,stroke:Tk(o)}),Re(s,p),Re(r,s),Qt(s,o.x,o.y)}v(o,"bpmn:TextAnnotation")||o.labelTarget?t.addMarker(o,Tb):(v(o,"bpmn:Task")||v(o,"bpmn:CallActivity")||v(o,"bpmn:SubProcess")||v(o,"bpmn:Participant")||v(o,"bpmn:Lane"))&&t.addMarker(o,Mb)}),e.on("directEditing.resize",function(c){if(v(o,"bpmn:TextAnnotation")){var u=c.height,l=c.dy,p=Math.max(o.height/a.height*(u+l),0),f=n.getScaledPath("TEXT_ANNOTATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:o.width,containerHeight:p,position:{mx:0,my:0}});re(i.path,{d:f})}}),e.on(["directEditing.complete","directEditing.cancel"],function(c){var u=c.active;u&&(t.removeMarker(u.element.label||u.element,Tb),t.removeMarker(o,Mb)),o=void 0,a=void 0,s&&(Ft(s),s=void 0)})}kb.$inject=["eventBus","canvas","pathMap"];function Tk(e,t){var n=Ve(e);return n.get("stroke")||t||"black"}const Mk={__depends__:[Tp,Pb,nb],__init__:["labelEditingProvider","labelEditingPreview"],labelEditingProvider:["type",Ua],labelEditingPreview:["type",kb]};var kk=500,Dk=1e3;function _i(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){g1(o)||i.createOutline(o)}e.on("element.hover",function(o){r(o.element)}),e.on("selection.changed",function(o){k(o.newSelection,r)}),e.on(["shape.changed","connection.changed"],kk,function(o){var a=o.element,s=o.gfx,c=et(".djs-outline",s);c&&i.updateOutline(a,c)})}_i.prototype.createOutline=function(e){var t=this._elementRegistry.getGraphics(e);if(!t)throw new Error("cannot create outline for non-rendered element");var n=et(".djs-outline",t);return n||(n=this.getOutline(e)||this._createOutlineGfx(),Re(t,n),this.updateOutline(e,n)),n},_i.prototype._createOutlineGfx=function(){var e=me("rect");return re(e,O({x:0,y:0,rx:4,width:100,height:100},this._outlineStyle)),e},_i.prototype.updateOutline=function(e,t){e.waypoints?this.updateConnectionOutline(t,e):this.updateShapeOutline(t,e)},_i.prototype.updateShapeOutline=function(e,t){var n=!1,i=this._getProviders();i.length&&k(i,function(r){n=n||r.updateOutline(t,e)}),n||re(e,{x:-this._outlineOffset,y:-this._outlineOffset,width:t.width+this._outlineOffset*2,height:t.height+this._outlineOffset*2})},_i.prototype.updateConnectionOutline=function(e,t){var n=At(t);re(e,{x:n.x-this._outlineOffset,y:n.y-this._outlineOffset,width:n.width+this._outlineOffset*2,height:n.height+this._outlineOffset*2})},_i.prototype.registerProvider=function(e,t){t||(t=e,e=Dk),this._eventBus.on("outline.getProviders",e,function(n){n.providers.push(t)})},_i.prototype._getProviders=function(){var e=this._eventBus.createEvent({type:"outline.getProviders",providers:[]});return this._eventBus.fire(e),e.providers},_i.prototype.getOutline=function(e){var t,n=this._getProviders();return k(n,function(i){Wt(i.getOutline)&&(t=t||i.getOutline(e))}),t},_i.$inject=["eventBus","styles","elementRegistry"];var du=6;function Rf(e,t,n){this._canvas=t;var i=this;e.on("element.changed",function(r){n.isSelected(r.element)&&i._updateMultiSelectionOutline(n.get())}),e.on("selection.changed",function(r){var o=r.newSelection;i._updateMultiSelectionOutline(o)})}Rf.prototype._updateMultiSelectionOutline=function(e){var t=this._canvas.getLayer("selectionOutline");ys(t);var n=e.length>1,i=this._canvas.getContainer();if(je(i)[n?"add":"remove"]("djs-multi-select"),!!n){var r=Ok(At(e)),o=me("rect");re(o,O({rx:3},r)),je(o).add("djs-selection-outline"),Re(t,o)}},Rf.$inject=["eventBus","canvas","selection"];function Ok(e){return{x:e.x-du,y:e.y-du,width:e.width+du*2,height:e.height+du*2}}const Cf={__depends__:[qn],__init__:["outline","multiSelectionOutline"],outline:["type",_i],multiSelectionOutline:["type",Rf]},Db=["bpmn:Event","bpmn:SequenceFlow","bpmn:Gateway"],Ob={class:"bjs-label-link",stroke:"var(--element-selected-outline-secondary-stroke-color)",strokeDasharray:"5, 5"},Lk=15,hu=2;function Lb(e,t,n,i,r){const o=t.getLayer("overlays");e.on(["selection.changed","shape.changed"],function(){s()}),e.on("selection.changed",function({newSelection:p}){var d;const f=p.filter(h=>De(h,Db));if(f.length===1){const h=f[0];Me(h)?a(h,h.labelTarget):(d=h.labels)!=null&&d.length&&a(h.labels[0],h)}if(f.length===2){const h=f.find(Me),m=f.find(g=>{var R;return(R=g.labels)==null?void 0:R.includes(h)});h&&m&&a(h,m)}}),e.on("shape.changed",function({element:p}){var f;!De(p,Db)||!l(p)||(Me(p)?a(p,p.labelTarget):(f=p.labels)!=null&&f.length&&a(p.labels[0],p))});function a(p,f){const d=Ko([be(f),be(p)],Ob),h=d.getAttribute("d"),g=r.isSelected(p)?c(p):u(p),R=Jo(g,h);if(!R)return;const b=r.isSelected(f)?c(f):u(f),x=Jo(b,h)||be(f);ua(x,R)<Lk||(il(d,[x,R]),Re(o,d))}function s(){gs(`.${Ob.class}`,o).forEach(Ft)}function c(p){const f=i.getOutline(p);if(!f)return u(p);if(f.x){const d={x:p.x+_r(f,"x")-hu,y:p.y+_r(f,"y")-hu,width:_r(f,"width")+hu*2,height:_r(f,"height")+hu*2};return dl(d,_r(f,"rx"))}if(f.cx){const d=_r(f,"r"),h={x:p.x+_r(f,"cx")-d,y:p.y+_r(f,"cy")-d,width:d*2,height:d*2};return um(h)}}function u(p){return n.getShapePath(p)}function l(p){return r.isSelected(p)}}Lb.$inject=["eventBus","canvas","graphicsFactory","outline","selection"];function _r(e,t){return parseFloat(re(e,t)||0)}const Ik={__depends__:[qn,Cf],__init__:["labelLink"],labelLink:["type",Lb]};var Nk=new So("tt");function Bk(e){var t=ut('<div class="djs-tooltip-container" />');return mn(t,{position:"absolute",width:"0",height:"0"}),e.insertBefore(t,e.firstChild),t}function $k(e,t,n){mn(e,{left:t+"px",top:n+"px"})}function Pf(e,t){e.style.display=t===!1?"none":""}var Ib="djs-tooltip",Af="."+Ib;function bn(e,t){this._eventBus=e,this._canvas=t,this._ids=Nk,this._tooltipDefaults={show:{minZoom:.7,maxZoom:5}},this._tooltips={},this._tooltipRoot=Bk(t.getContainer());var n=this;Cn.bind(this._tooltipRoot,Af,"mousedown",function(i){i.stopPropagation()}),Cn.bind(this._tooltipRoot,Af,"mouseover",function(i){n.trigger("mouseover",i)}),Cn.bind(this._tooltipRoot,Af,"mouseout",function(i){n.trigger("mouseout",i)}),this._init()}bn.$inject=["eventBus","canvas"],bn.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=O({},this._tooltipDefaults,e,{id:t}),this._addTooltip(e),e.timeout&&this.setTimeout(e),t},bn.prototype.trigger=function(e,t){var n=t.delegateTarget||t.target,i=this.get(an(n,"data-tooltip-id"));i&&(e==="mouseover"&&i.timeout&&this.clearTimeout(i),e==="mouseout"&&i.timeout&&(i.timeout=1e3,this.setTimeout(i)))},bn.prototype.get=function(e){return typeof e!="string"&&(e=e.id),this._tooltips[e]},bn.prototype.clearTimeout=function(e){if(e=this.get(e),!!e){var t=e.removeTimer;t&&(clearTimeout(t),e.removeTimer=null)}},bn.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)}},bn.prototype.remove=function(e){var t=this.get(e);t&&(li(t.html),li(t.htmlContainer),delete t.htmlContainer,delete this._tooltips[t.id])},bn.prototype.show=function(){Pf(this._tooltipRoot)},bn.prototype.hide=function(){Pf(this._tooltipRoot,!1)},bn.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},bn.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)),wn(n)&&(n=ut(n)),i=ut('<div data-tooltip-id="'+t+'" class="'+Ib+'">'),mn(i,{position:"absolute"}),i.appendChild(n),e.type&&mt(i).add("djs-tooltip-"+e.type),e.className&&mt(i).add(e.className),e.htmlContainer=i,r.appendChild(i),this._tooltips[t]=e,this._updateTooltip(e)},bn.prototype._updateTooltip=function(e){var t=e.position,n=e.htmlContainer;$k(n,t.x,t.y)},bn.prototype._updateTooltipVisibilty=function(e){k(this._tooltips,function(t){var n=t.show,i=t.htmlContainer,r=!0;n&&((n.minZoom>e.scale||n.maxZoom<e.scale)&&(r=!1),Pf(i,r))})},bn.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 jk={__init__:["tooltips"],tooltips:["type",bn]};var Fk="flow elements must be children of pools/participants",Hk="Data object must be placed within a pool/participant.";function Nb(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;v(s,"bpmn:Collaboration")&&(v(a,"bpmn:FlowNode")?i(r,n(Fk)):v(a,"bpmn:DataObjectReference")&&i(r,n(Hk)))})}Nb.$inject=["eventBus","tooltips","translate"];const zk={__depends__:[jk],__init__:["modelingFeedback"],modelingFeedback:["type",Nb]};var Vk=500,Gk=1250,Wk=1500,mu=Math.round;function Uk(e){return{x:e.x+mu(e.width/2),y:e.y+mu(e.height/2)}}function Bb(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",Wk,function(s){var c=s.context,u=s.shape,l=i.get().slice();l.indexOf(u)===-1&&(l=[u]),l=Yk(l),O(c,{shapes:l,validatedShapes:l,shape:u})}),e.on("shape.move.start",Gk,function(s){var c=s.context,u=c.validatedShapes,l;if(l=c.canExecute=o(u),!l)return!1}),e.on("shape.move.move",Vk,function(s){var c=s.context,u=c.validatedShapes,l=s.hover,p={x:s.dx,y:s.dy},f={x:s.x,y:s.y},d;if(d=o(u,p,f,l),c.delta=p,c.canExecute=d,d===null){c.target=null;return}c.target=l}),e.on("shape.move.end",function(s){var c=s.context,u=c.delta,l=c.canExecute,p=l==="attach",f=c.shapes;if(l===!1)return!1;u.x=mu(u.x),u.y=mu(u.y),!(u.x===0&&u.y===0)&&n.moveElements(f,u,c.target,{primaryShape:c.shape,attach:p})}),e.on("element.mousedown",function(s){if(ar(s)){var c=bo(s);if(!c)throw new Error("must supply DOM mousedown event");return a(c,s.element)}});function a(s,c,u,l){if(Gt(u)&&(l=u,u=!1),!(c.waypoints||!c.parent)&&!je(s.target).has("djs-hit-no-move")){var p=Uk(c),f=t.init(s,p,"shape.move",{cursor:"grabbing",autoActivate:u,data:{shape:c,context:l||{}}});if(f!==!1)return!0}}this.start=a}Bb.$inject=["eventBus","dragging","modeling","selection","rules"];function Yk(e){var t=Qr(e,"id");return Oe(e,function(n){for(;n=n.parent;)if(t[n.id])return!1;return!0})}var $b=499,Tf="djs-dragging",jb="drop-ok",Fb="drop-not-ok",Hb="new-parent",zb="attach-ok";function Vb(e,t,n,i){function r(c){var u=o(c),l=qk(u);return l}function o(c){var u=Xo(c),l=u.flatMap(d=>(d.incoming||[]).concat(d.outgoing||[])),p=u.concat(l),f=[...new Set(p)];return f}function a(c,u){[zb,jb,Fb,Hb].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,Tf),c.allDraggedElements?c.allDraggedElements.push(u):c.allDraggedElements=[u]}e.on("shape.move.start",$b,function(c){var u=c.context,l=u.shapes,p=u.allDraggedElements,f=r(l);if(!u.dragGroup){var d=me("g");re(d,n.cls("djs-drag-group",["no-events"]));var h=t.getActiveLayer();Re(h,d),u.dragGroup=d}f.forEach(function(m){i.addDragger(m,u.dragGroup)}),p?p=Eu([p,o(l)]):p=o(l),k(p,function(m){t.addMarker(m,Tf)}),u.allDraggedElements=p,u.differentParents=Kk(l)}),e.on("shape.move.move",$b,function(c){var u=c.context,l=u.dragGroup,p=u.target,f=u.shape.parent,d=u.canExecute;p&&(d==="attach"?a(p,zb):u.canExecute&&f&&p.id!==f.id?a(p,Hb):a(p,u.canExecute?jb:Fb)),Qt(l,c.dx,c.dy)}),e.on(["shape.move.out","shape.move.cleanup"],function(c){var u=c.context,l=u.target;l&&a(l,null)}),e.on("shape.move.cleanup",function(c){var u=c.context,l=u.allDraggedElements,p=u.dragGroup;k(l,function(f){t.removeMarker(f,Tf)}),p&&Ft(p)}),this.makeDraggable=s}Vb.$inject=["eventBus","canvas","styles","previewSupport"];function qk(e){var t=new Set;e.forEach(function(i){t.add(i.id)});var n=Oe(e,function(i){return it(i)?t.has(i.source.id)&&t.has(i.target.id):!0});return n}function Kk(e){return Kx(Qr(e,function(t){return t.parent&&t.parent.id}))!==1}const Xk={__depends__:[ac,qn,Cf,gi,Li,Ro],__init__:["move","movePreview"],move:["type",Bb],movePreview:["type",Vb]};var Gb=".djs-palette-toggle",Wb=".entry",Zk=Gb+", "+Wb,Mf="djs-palette-",Qk="shown",kf="open",Ub="two-column",Jk=1e3;function Ot(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()})}Ot.$inject=["eventBus","canvas"],Ot.prototype.registerProvider=function(e,t){t||(t=e,e=Jk),this._eventBus.on("palette.getProviders",e,function(n){n.providers.push(t)}),this._rebuild()},Ot.prototype.getEntries=function(){var e=this._getProviders();return e.reduce(tD,{})},Ot.prototype._rebuild=function(){if(this._diagramInitialized){var e=this._getProviders();e.length&&(this._container||this._init(),this._update())}},Ot.prototype._init=function(){var e=this,t=this._eventBus,n=this._getParentContainer(),i=this._container=ut(Ot.HTML_MARKUP);n.appendChild(i),mt(n).add(Mf+Qk),Cn.bind(i,Zk,"click",function(r){var o=r.delegateTarget;if(qu(o,Gb))return e.toggle();e.trigger("click",r)}),Se.bind(i,"mousedown",function(r){r.stopPropagation()}),Cn.bind(i,Wb,"dragstart",function(r){e.trigger("dragstart",r)}),t.on("canvas.resized",this._layoutChanged,this),t.fire("palette.create",{container:i})},Ot.prototype._getProviders=function(e){var t=this._eventBus.createEvent({type:"palette.getProviders",providers:[]});return this._eventBus.fire(t),t.providers},Ot.prototype._toggleState=function(e){e=e||{};var t=this._getParentContainer(),n=this._container,i=this._eventBus,r,o=mt(n),a=mt(t);"twoColumn"in e?r=e.twoColumn:r=this._needsCollapse(t.clientHeight,this._entries||{}),o.toggle(Ub,r),a.toggle(Mf+Ub,r),"open"in e&&(o.toggle(kf,e.open),a.toggle(Mf+kf,e.open)),i.fire("palette.changed",{twoColumn:r,open:this.isOpen()})},Ot.prototype._update=function(){var e=et(".djs-palette-entries",this._container),t=this._entries=this.getEntries();hs(e),k(t,function(n,i){var r=n.group||"default",o=et("[data-group="+ka(r)+"]",e);o||(o=ut('<div class="group"></div>'),an(o,"data-group",r),e.appendChild(o));var a=n.html||(n.separator?'<hr class="separator" />':'<div class="entry" draggable="true"></div>'),s=ut(a);if(o.appendChild(s),!n.separator&&(an(s,"data-action",i),n.title&&an(s,"title",n.title),n.className&&eD(s,n.className),n.imageUrl)){var c=ut("<img>");an(c,"src",n.imageUrl),s.appendChild(c)}}),this.open()},Ot.prototype.trigger=function(e,t,n){var i,r,o=t.delegateTarget||t.target;return o?(i=an(o,"data-action"),r=t.originalEvent||t,this.triggerEntry(i,e,r,n)):t.preventDefault()},Ot.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(Wt(a)){if(t==="click")return a(n,i)}else if(a[t])return a[t](n,i);n.preventDefault()}},Ot.prototype._layoutChanged=function(){this._toggleState({})},Ot.prototype._needsCollapse=function(e,t){var n=50,i=Object.keys(t).length*46;return e<i+n},Ot.prototype.close=function(){this._toggleState({open:!1,twoColumn:!1})},Ot.prototype.open=function(){this._toggleState({open:!0})},Ot.prototype.toggle=function(){this.isOpen()?this.close():this.open()},Ot.prototype.isActiveTool=function(e){return e&&this._activeTool===e},Ot.prototype.updateToolHighlight=function(e){var t,n;this._toolsContainer||(t=et(".djs-palette-entries",this._container),this._toolsContainer=et("[data-group=tools]",t)),n=this._toolsContainer,k(n.children,function(i){var r=i.getAttribute("data-action");if(r){var o=mt(i);r=r.replace("-tool",""),o.contains("entry")&&r===e?o.add("highlighted-entry"):o.remove("highlighted-entry")}})},Ot.prototype.isOpen=function(){return mt(this._container).has(kf)},Ot.prototype._getParentContainer=function(){return this._canvas.getContainer()},Ot.HTML_MARKUP='<div class="djs-palette"><div class="djs-palette-entries"></div><div class="djs-palette-toggle"></div></div>';function eD(e,t){var n=mt(e),i=_e(t)?t:t.split(/\s+/g);i.forEach(function(r){n.add(r)})}function tD(e,t){var n=t.getPaletteEntries();return Wt(n)?n(e):(k(n,function(i,r){e[r]=i}),e)}const nD={__init__:["palette"],palette:["type",Ot]};var Yb="crosshair",qb="selected",iD="djs-dragging-active-lasso";function br(e,t,n,i,r,o,a){this._selection=r,this._dragging=n,this._mouse=a;var s=this,c={create:function(p){var f=t.getActiveLayer(),d=p.frame=me("rect");re(d,{class:"djs-lasso-overlay",width:1,height:1,x:0,y:0}),Re(f,d),u(!0),this.update(p)},update:function(p){var f=p.frame,d=p.bbox;f&&d&&re(f,{x:d.x,y:d.y,width:d.width,height:d.height});var h=p.marked,m=p.lastMarked;if(h&&m){for(const g of m)h.has(g)||t.removeMarker(g,qb);for(const g of h)m.has(g)||t.addMarker(g,qb)}},remove:function(p){this.update(p),p.frame&&Ft(p.frame),u(!1)}};function u(p){je(t.getContainer()).toggle(iD,p)}function l(p){var f=i.getAll();return new Set(Zr(ao(f,p)))}o.registerTool("lasso",{tool:"lasso.selection",dragging:"lasso"}),e.on("lasso.selection.end",function(p){var f=p.originalEvent.target;!p.hover&&!(f instanceof SVGElement)||e.once("lasso.selection.ended",function(){s.activateLasso(p.originalEvent,!0)})}),e.on("lasso.end",0,function(p){var f=p.context;s._select(Array.from(f.marked))}),e.on("lasso.start",function(p){var f=p.context;f.bbox=Kb(p),f.add=Js(p),f.lastMarked=new Set(r.get()),f.add?f.marked=f.lastMarked:f.marked=new Set,f.initialMarked=f.marked,c.create(f)}),e.on("lasso.move",function(p){var f=p.context,d=f.bbox=Kb(p),h=l(d),m=f.initialMarked.union(h);f.lastMarked=f.marked,f.marked=m,c.update(f)}),e.on("lasso.cleanup",function(p){var f=p.context;f.lastMarked=f.marked,f.marked=new Set(r.get()),c.remove(p.context)}),e.on("element.mousedown",1500,function(p){if(Js(p))return s.activateLasso(p.originalEvent),!0})}br.$inject=["eventBus","canvas","dragging","elementRegistry","selection","toolManager","mouse"],br.prototype.activateLasso=function(e,t){this._dragging.init(e,"lasso",{autoActivate:t,cursor:Yb,data:{context:{}},keepSelection:!0})},br.prototype.activateSelection=function(e,t){this._dragging.init(e,"lasso.selection",{trapClick:!1,autoActivate:t,cursor:Yb,data:{context:{}},keepSelection:!0})},br.prototype._select=function(e){this._selection.select(e)},br.prototype.select=function(e,t,n=[]){var i=Zr(ao(e,t));this._select([...n,...i])},br.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateSelection(e,!!e)},br.prototype.isActive=function(){var e=this._dragging.context();return e&&/^lasso/.test(e.prefix)};function Kb(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 rD={__depends__:[lc,ma],__init__:["lassoTool"],lassoTool:["type",br]};var Df=1500,Xb="grab";function No(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",Df,function(c){if(fa(c))return a.activateMove(c.originalEvent,!0),!1}),s&&s.addListener(Df,function(c){if(!(!Zb(c.keyEvent)||a.isActive())){var u=a._mouse.getLastMoveEvent();a.activateMove(u,!!u)}},"keyboard.keydown"),s&&s.addListener(Df,function(c){!Zb(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!fa(c)&&l&&e.once("hand.move.ended",function(p){a.activateHand(p.originalEvent,!0,!0)}),!1})}No.$inject=["eventBus","canvas","dragging","injector","toolManager","mouse"],No.prototype.activateMove=function(e,t,n){typeof t=="object"&&(n=t,t=!1),this._dragging.init(e,"hand.move",{autoActivate:t,cursor:Xb,data:{context:n||{}}})},No.prototype.activateHand=function(e,t,n){this._dragging.init(e,"hand",{trapClick:!1,autoActivate:t,cursor:Xb,data:{context:{reactivate:n}}})},No.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateHand(e,!!e)},No.prototype.isActive=function(){var e=this._dragging.context();return e?/^(hand|hand\.move)$/.test(e.prefix):!1};function Zb(e){return Ht("Space",e)}const oD={__depends__:[lc,ma],__init__:["handTool"],handTool:["type",No]};var Qb="connect-ok",Jb="connect-not-ok";function Bo(e,t,n,i,r,o,a){var s=this;this._dragging=t,this._rules=o,this._mouse=a,r.registerTool("global-connect",{tool:"global-connect",dragging:"global-connect.drag"}),e.on("global-connect.hover",function(c){var u=c.context,l=c.hover,p=u.canStartConnect=s.canStartConnect(l);p!==null&&(u.startTarget=l,i.addMarker(l,p?Qb:Jb))}),e.on(["global-connect.out","global-connect.cleanup"],function(c){var u=c.context.startTarget,l=c.context.canStartConnect;u&&i.removeMarker(u,l?Qb:Jb)}),e.on(["global-connect.ended"],function(c){var u=c.context,l=u.startTarget,p={x:c.x,y:c.y},f=s.canStartConnect(l);if(f)return e.once("element.out",function(){e.once(["connect.ended","connect.canceled"],function(){e.fire("global-connect.drag.ended")}),n.start(null,l,p)}),!1})}Bo.$inject=["eventBus","dragging","connect","canvas","toolManager","rules","mouse"],Bo.prototype.start=function(e,t){this._dragging.init(e,"global-connect",{autoActivate:t,trapClick:!1,data:{context:{}}})},Bo.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();return this.start(e,!!e)},Bo.prototype.isActive=function(){var e=this._dragging.context();return e&&/^global-connect/.test(e.prefix)},Bo.prototype.canStartConnect=function(e){return this._rules.allowed("connection.start",{source:e})};const aD={__depends__:[xf,gi,Li,lc,ma],globalConnect:["type",Bo]};function Of(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)}Of.$inject=["palette","create","elementFactory","spaceTool","lassoTool","handTool","globalConnect","translate"],Of.prototype.getPaletteEntries=function(){var e={},t=this._create,n=this._elementFactory,i=this._spaceTool,r=this._lassoTool,o=this._handTool,a=this._globalConnect,s=this._translate;function c(p,f,d,h,m){function g(R){var w=n.createShape(O({type:p},m));t.start(R,w)}return{group:f,className:d,title:h,action:{dragstart:g,click:g}}}function u(p){var f=n.createShape({type:"bpmn:SubProcess",x:0,y:0,isExpanded:!0}),d=n.createShape({type:"bpmn:StartEvent",x:40,y:82,parent:f});t.start(p,[f,d],{hints:{autoSelect:[f]}})}function l(p){t.start(p,n.createParticipantShape())}return O(e,{"hand-tool":{group:"tools",className:"bpmn-icon-hand-tool",title:s("Activate hand tool"),action:{click:function(p){o.activateHand(p)}}},"lasso-tool":{group:"tools",className:"bpmn-icon-lasso-tool",title:s("Activate lasso tool"),action:{click:function(p){r.activateSelection(p)}}},"space-tool":{group:"tools",className:"bpmn-icon-space-tool",title:s("Activate create/remove space tool"),action:{click:function(p){i.activateSelection(p)}}},"global-connect-tool":{group:"tools",className:"bpmn-icon-connection-multi",title:s("Activate global connect tool"),action:{click:function(p){a.start(p)}}},"tool-separator":{group:"tools",separator:!0},"create.start-event":c("bpmn:StartEvent","event","bpmn-icon-start-event-none",s("Create start event")),"create.intermediate-event":c("bpmn:IntermediateThrowEvent","event","bpmn-icon-intermediate-event-none",s("Create intermediate/boundary event")),"create.end-event":c("bpmn:EndEvent","event","bpmn-icon-end-event-none",s("Create end event")),"create.exclusive-gateway":c("bpmn:ExclusiveGateway","gateway","bpmn-icon-gateway-none",s("Create gateway")),"create.task":c("bpmn:Task","activity","bpmn-icon-task",s("Create task")),"create.data-object":c("bpmn:DataObjectReference","data-object","bpmn-icon-data-object",s("Create data object reference")),"create.data-store":c("bpmn:DataStoreReference","data-store","bpmn-icon-data-store",s("Create data store reference")),"create.subprocess-expanded":{group:"activity",className:"bpmn-icon-subprocess-expanded",title:s("Create expanded sub-process"),action:{dragstart:u,click:u}},"create.participant-expanded":{group:"collaboration",className:"bpmn-icon-participant",title:s("Create pool/participant"),action:{dragstart:l,click:l}},"create.group":c("bpmn:Group","artifact","bpmn-icon-group",s("Create group"))}),e};const sD={__depends__:[nD,cc,Py,rD,oD,aD,oa],__init__:["paletteProvider"],paletteProvider:["type",Of]};var cD=250;function Lf(e,t,n,i,r){X.call(this,e);function o(s){var c=s.canExecute.replacements;k(c,function(u){var l=u.oldElementId,p={type:u.newElementType};if(!s.visualReplacements[l]){var f=t.get(l);O(p,{x:f.x,y:f.y});var d=n.createShape(p);i.addShape(d,f.parent);var h=et('[data-element-id="'+ka(f.id)+'"]',s.dragGroup);h&&re(h,{display:"none"});var m=r.addDragger(d,s.dragGroup);s.visualReplacements[l]=m,i.removeShape(d)}})}function a(s){var c=s.visualReplacements;k(c,function(u,l){var p=et('[data-element-id="'+ka(l)+'"]',s.dragGroup);p&&re(p,{display:"inline"}),u.remove(),c[l]&&delete c[l]})}e.on("shape.move.move",cD,function(s){var c=s.context,u=c.canExecute;c.visualReplacements||(c.visualReplacements={}),u&&u.replacements?o(c):a(c)})}Lf.$inject=["eventBus","elementRegistry","elementFactory","canvas","previewSupport"],ie(Lf,X);const uD={__depends__:[Ro],__init__:["bpmnReplacePreview"],bpmnReplacePreview:["type",Lf]};var lD=1250,If=40,pD=20,fD=10,ex=20,tx=["x","y"],dD=Math.abs;function nx(e){e.on(["connect.hover","connect.move","connect.end"],lD,function(t){var n=t.context,i=n.canExecute,r=n.start,o=n.hover,a=n.source,s=n.target;t.originalEvent&&Tn(t.originalEvent)||(n.initialConnectionStart||(n.initialConnectionStart=n.connectionStart),i&&o&&hD(t,o,vD(o)),o&&yD(i,["bpmn:Association","bpmn:DataInputAssociation","bpmn:DataOutputAssociation","bpmn:SequenceFlow"])?(n.connectionStart=Zn(r),De(o,["bpmn:Event","bpmn:Gateway"])&&ix(t,Zn(o)),De(o,["bpmn:Task","bpmn:SubProcess"])&&mD(t,o),v(a,"bpmn:BoundaryEvent")&&s===a.host&&gD(t)):rx(i,"bpmn:MessageFlow")?(v(r,"bpmn:Event")&&(n.connectionStart=Zn(r)),v(o,"bpmn:Event")&&ix(t,Zn(o))):n.connectionStart=n.initialConnectionStart)})}nx.$inject=["eventBus"];function hD(e,t,n){tx.forEach(function(i){var r=ox(i,t);e[i]<t[i]+n?Dt(e,i,t[i]+n):e[i]>t[i]+r-n&&Dt(e,i,t[i]+r-n)})}function mD(e,t){var n=Zn(t);tx.forEach(function(i){_D(e,t,i)&&Dt(e,i,n[i])})}function gD(e){var t=e.context,n=t.source,i=t.target;if(!bD(t)){var r=Zn(n),o=Zt(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;dD(c-r[s])<If&&(c>r[s]?u=r[s]+If:u=r[s]-If,Dt(e,s,u))})}}function ix(e,t){Dt(e,"x",t.x),Dt(e,"y",t.y)}function rx(e,t){return e&&e.type===t}function yD(e,t){return Vi(t,function(n){return rx(e,n)})}function ox(e,t){return e==="x"?t.width:t.height}function vD(e){return v(e,"bpmn:Task")?fD:pD}function _D(e,t,n){return e[n]>t[n]+ex&&e[n]<t[n]+ox(n,t)-ex}function bD(e){var t=e.hover,n=e.source;return t&&n&&t===n}function xr(){this._targets={},this._snapOrigins={},this._snapLocations=[],this._defaultSnaps={}}xr.prototype.getSnapOrigin=function(e){return this._snapOrigins[e]},xr.prototype.setSnapOrigin=function(e,t){this._snapOrigins[e]=t,this._snapLocations.indexOf(e)===-1&&this._snapLocations.push(e)},xr.prototype.addDefaultSnap=function(e,t){var n=this._defaultSnaps[e];n||(n=this._defaultSnaps[e]=[]),n.push(t)},xr.prototype.getSnapLocations=function(){return this._snapLocations},xr.prototype.setSnapLocations=function(e){this._snapLocations=e},xr.prototype.pointsForTarget=function(e){var t=e.id||e,n=this._targets[t];return n||(n=this._targets[t]=new gu,n.initDefaults(this._defaultSnaps)),n};function gu(){this._snapValues={}}gu.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)},gu.prototype.snap=function(e,t,n,i){var r=this._snapValues[t];return r&&c2(e[n],r[n],i)},gu.prototype.initDefaults=function(e){var t=this;k(e||{},function(n,i){k(n,function(r){t.add(i,r)})})};var xD=1250;function bi(e,t,n){var i=this;this._elementRegistry=e,t.on(["create.start","shape.move.start"],function(r){i.initSnap(r)}),t.on(["create.move","create.end","shape.move.move","shape.move.end"],xD,function(r){var o=r.context,a=o.shape,s=o.snapContext,c=o.target;if(!(r.originalEvent&&Tn(r.originalEvent))&&!(Io(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()})}bi.$inject=["elementRegistry","eventBus","snapping"],bi.prototype.initSnap=function(e){var t=this._elementRegistry,n=e.context,i=n.shape,r=n.snapContext;r||(r=n.snapContext=new xr);var o;t.get(i.id)?o=Zn(i,e):o={x:e.x+Zn(i).x,y:e.y+Zn(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}),Me(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},bi.prototype.addSnapTargetPoints=function(e,t,n){var i=this.getSnapTargets(t,n);return k(i,function(r){if(Me(r)){Me(t)&&e.add("mid",Zn(r));return}if(it(r)){if(r.waypoints.length<3)return;var o=r.waypoints.slice(1,-1);k(o,function(a){e.add("mid",a)});return}e.add("mid",Zn(r))}),!we(t.x)||!we(t.y)||this._elementRegistry.get(t.id)&&e.add("mid",Zn(t)),e},bi.prototype.getSnapTargets=function(e,t){return W_(t).filter(function(n){return!wD(n)})};function wD(e){return!!e.hidden}var ax=1500;function $o(e,t){t.invoke(bi,this),e.on(["create.move","create.end"],ax,CD),e.on(["create.move","create.end","shape.move.move","shape.move.end"],ax,function(n){var i=n.context,r=i.canExecute,o=i.target,a=r&&(r==="attach"||r.attach);a&&!Io(n)&&ED(n,o)})}ie($o,bi),$o.$inject=["eventBus","injector"],$o.prototype.initSnap=function(e){var t=bi.prototype.initSnap.call(this,e),n=e.shape,i=!!this._elementRegistry.get(n.id);return k(n.outgoing,function(r){var o=r.waypoints[0];o=o.original||o,t.setSnapOrigin(r.id+"-docking",cx(o,i,e))}),k(n.incoming,function(r){var o=r.waypoints[r.waypoints.length-1];o=o.original||o,t.setSnapOrigin(r.id+"-docking",cx(o,i,e))}),v(n,"bpmn:Participant")&&t.setSnapLocations(["top-left","bottom-right","mid"]),t},$o.prototype.addSnapTargetPoints=function(e,t,n){bi.prototype.addSnapTargetPoints.call(this,e,t,n);var i=this.getSnapTargets(t,n);k(i,function(o){(RD(o)||SD([t,o],"bpmn:TextAnnotation"))&&(e.add("top-left",V_(o)),e.add("bottom-right",G_(o)))});var r=this._elementRegistry;return k(t.incoming,function(o){if(r.get(t.id)){sx(i,o.source)||e.add("mid",be(o.source));var a=o.waypoints[0];e.add(o.id+"-docking",a.original||a)}}),k(t.outgoing,function(o){if(r.get(t.id)){sx(i,o.target)||e.add("mid",be(o.target));var a=o.waypoints[o.waypoints.length-1];e.add(o.id+"-docking",a.original||a)}}),v(n,"bpmn:SequenceFlow")&&(e=this.addSnapTargetPoints(e,t,n.parent)),e},$o.prototype.getSnapTargets=function(e,t){return bi.prototype.getSnapTargets.call(this,e,t).filter(function(n){return!v(n,"bpmn:Lane")})};function ED(e,t){var n=ye(t),i=Eg(e,t),r=e.context,o=r.shape,a;o.parent?a={x:0,y:0}:a=be(o),/top/.test(i)?Dt(e,"y",n.top-a.y):/bottom/.test(i)&&Dt(e,"y",n.bottom-a.y),/left/.test(i)?Dt(e,"x",n.left-a.x):/right/.test(i)&&Dt(e,"x",n.right-a.x)}function SD(e,t){return e.every(function(n){return v(n,t)})}function RD(e){return v(e,"bpmn:SubProcess")&&$e(e)?!0:v(e,"bpmn:Participant")}function CD(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)&&Dt(e,"x",e.x),(i&&i>=e.y||o&&o<=e.y)&&Dt(e,"y",e.y)}}function sx(e,t){return e.indexOf(t)!==-1}function cx(e,t,n){return t?{x:e.x-n.x,y:e.y-n.y}:{x:e.x,y:e.y}}var PD=1250;function Ya(e,t){var n=this;e.on(["resize.start"],function(i){n.initSnap(i)}),e.on(["resize.move","resize.end"],PD,function(i){var r=i.context,o=r.shape,a=o.parent,s=r.direction,c=r.snapContext;if(!(i.originalEvent&&Tn(i.originalEvent))&&!Io(i)){var u=c.pointsForTarget(a);u.initialized||(u=n.addSnapTargetPoints(u,o,a,s),u.initialized=!0),MD(s)&&Dt(i,"x",i.x),kD(s)&&Dt(i,"y",i.y),t.snap(i,u)}}),e.on(["resize.cleanup"],function(){t.hide()})}Ya.prototype.initSnap=function(e){var t=e.context,n=t.shape,i=t.direction,r=t.snapContext;r||(r=t.snapContext=new xr);var o=ux(n,i);return r.setSnapOrigin("corner",{x:o.x-e.x,y:o.y-e.y}),r},Ya.prototype.addSnapTargetPoints=function(e,t,n,i){var r=this.getSnapTargets(t,n);return k(r,function(o){e.add("corner",G_(o)),e.add("corner",V_(o))}),e.add("corner",ux(t,i)),e},Ya.$inject=["eventBus","snapping"],Ya.prototype.getSnapTargets=function(e,t){return W_(t).filter(function(n){return!AD(n,e)&&!it(n)&&!TD(n)&&!Me(n)})};function ux(e,t){var n=be(e),i=ye(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 AD(e,t){return e.host===t}function TD(e){return!!e.hidden}function MD(e){return e==="n"||e==="s"}function kD(e){return e==="e"||e==="w"}var DD=7,OD=1e3;function wr(e){this._canvas=e,this._asyncHide=Ru(vn(this.hide,this),OD)}wr.$inject=["canvas"],wr.prototype.snap=function(e,t){var n=e.context,i=n.snapContext,r=i.getSnapLocations(),o={x:Io(e,"x"),y:Io(e,"y")};k(r,function(a){var s=i.getSnapOrigin(a),c={x:e.x+s.x,y:e.y+s.y};if(k(["x","y"],function(u){var l;o[u]||(l=t.snap(c,a,u,DD),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),k(["x","y"],function(a){var s=o[a];Gt(s)&&Dt(e,a,s.originValue)})},wr.prototype._createLine=function(e){var t=this._canvas.getLayer("snap"),n=me("path");return re(n,{d:"M0,0 L0,0"}),je(n).add("djs-snap-line"),Re(t,n),{update:function(i){we(i)?e==="horizontal"?re(n,{d:"M-100000,"+i+" L+100000,"+i,display:""}):re(n,{d:"M "+i+",-100000 L "+i+", +100000",display:""}):re(n,{display:"none"})}}},wr.prototype._createSnapLines=function(){this._snapLines={horizontal:this._createLine("horizontal"),vertical:this._createLine("vertical")}},wr.prototype.showSnapLine=function(e,t){var n=this.getSnapLine(e);n&&n.update(t),this._asyncHide()},wr.prototype.getSnapLine=function(e){return this._snapLines||this._createSnapLines(),this._snapLines[e]},wr.prototype.hide=function(){k(this._snapLines,function(e){e.update()})};const LD={__depends__:[{__init__:["createMoveSnapping","resizeSnapping","snapping"],createMoveSnapping:["type",bi],resizeSnapping:["type",Ya],snapping:["type",wr]}],__init__:["connectSnapping","createMoveSnapping"],connectSnapping:["type",nx],createMoveSnapping:["type",$o]};var lx=300;function Ce(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=et(Ce.INPUT_SELECTOR,this._container),this._resultsContainer=et(Ce.RESULTS_CONTAINER_SELECTOR,this._container),this._canvas.getContainer().appendChild(this._container),t.on(["canvas.destroy","diagram.destroy","drag.init","elements.changed"],this.close,this)}Ce.$inject=["canvas","eventBus","selection","translate"],Ce.prototype._bindEvents=function(){var e=this;function t(n,i,r,o){e._eventMaps.push({el:n,type:r,listener:Cn.bind(n,i,r,o)})}t(document,"html","click",function(n){e.close(!1)}),t(this._container,Ce.INPUT_SELECTOR,"click",function(n){n.stopPropagation(),n.delegateTarget.focus()}),t(this._container,Ce.RESULT_SELECTOR,"mouseover",function(n){n.stopPropagation(),e._scrollToNode(n.delegateTarget),e._preselect(n.delegateTarget)}),t(this._container,Ce.RESULT_SELECTOR,"click",function(n){n.stopPropagation(),e._select(n.delegateTarget)}),t(this._container,Ce.INPUT_SELECTOR,"keydown",function(n){Ht("ArrowUp",n)&&n.preventDefault(),Ht("ArrowDown",n)&&n.preventDefault()}),t(this._container,Ce.INPUT_SELECTOR,"keyup",function(n){if(Ht("Escape",n))return e.close();if(Ht("Enter",n)){var i=e._getCurrentResult();return i?e._select(i):e.close(!1)}if(Ht("ArrowUp",n))return e._scrollToDirection(!0);if(Ht("ArrowDown",n))return e._scrollToDirection();Ht(["ArrowLeft","ArrowRight"],n)||e._search(n.delegateTarget.value)})},Ce.prototype._unbindEvents=function(){this._eventMaps.forEach(function(e){Cn.unbind(e.el,e.type,e.listener)})},Ce.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=et(Ce.RESULT_SELECTOR,this._resultsContainer);this._scrollToNode(i),this._preselect(i)}},Ce.prototype._scrollToDirection=function(e){var t=this._getCurrentResult();if(t){var n=e?t.previousElementSibling:t.nextElementSibling;n&&(this._scrollToNode(n),this._preselect(n))}},Ce.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)}},Ce.prototype._clearResults=function(){hs(this._resultsContainer),this._results={},this._eventBus.fire("searchPad.cleared")},Ce.prototype._getCurrentResult=function(){return et(Ce.RESULT_SELECTED_SELECTOR,this._resultsContainer)},Ce.prototype._createResultNode=function(e,t){var n=ut(Ce.RESULT_HTML);return e.primaryTokens.length>0&&px(n,e.primaryTokens,Ce.RESULT_PRIMARY_HTML),px(n,e.secondaryTokens,Ce.RESULT_SECONDARY_HTML),an(n,Ce.RESULT_ID_ATTRIBUTE,t),this._resultsContainer.appendChild(n),n},Ce.prototype.registerProvider=function(e){this._searchProvider=e},Ce.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,mt(this._canvas.getContainer()).add("djs-search-open"),mt(this._container).add("open"),this._searchInput.focus(),this._eventBus.fire("searchPad.opened"))},Ce.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,mt(this._canvas.getContainer()).remove("djs-search-open"),mt(this._container).remove("open"),this._clearResults(),this._searchInput.value="",this._searchInput.blur(),this._eventBus.fire("searchPad.closed"),this._canvas.restoreFocus())},Ce.prototype.toggle=function(){this.isOpen()?this.close():this.open()},Ce.prototype.isOpen=function(){return this._open},Ce.prototype._preselect=function(e){var t=this._getCurrentResult();if(e!==t){t&&mt(t).remove(Ce.RESULT_SELECTED_CLASS);var n=an(e,Ce.RESULT_ID_ATTRIBUTE),i=this._results[n].element;mt(e).add(Ce.RESULT_SELECTED_CLASS),this._canvas.scrollToElement(i,{top:lx}),this._selection.select(i),this._eventBus.fire("searchPad.preselected",i)}},Ce.prototype._select=function(e){var t=an(e,Ce.RESULT_ID_ATTRIBUTE),n=this._results[t].element;this._cachedSelection=null,this._cachedViewbox=null,this.close(!1),this._canvas.scrollToElement(n,{top:lx}),this._selection.select(n),this._eventBus.fire("searchPad.selected",n)},Ce.prototype._getBoxHtml=function(){const e=ut(Ce.BOX_HTML),t=et(Ce.INPUT_SELECTOR,e);return t&&t.setAttribute("aria-label",this._translate("Search in diagram")),e};function px(e,t,n){var i=ID(t),r=ut(n);r.innerHTML=i,e.appendChild(r)}function ID(e){var t="";return e.forEach(function(n){var i=_v(n.value||n.matched||n.normal),r=n.match||n.matched;r?t+='<b class="'+Ce.RESULT_HIGHLIGHT_CLASS+'">'+i+"</b>":t+=i}),t!==""?t:null}Ce.CONTAINER_SELECTOR=".djs-search-container",Ce.INPUT_SELECTOR=".djs-search-input input",Ce.RESULTS_CONTAINER_SELECTOR=".djs-search-results",Ce.RESULT_SELECTOR=".djs-search-result",Ce.RESULT_SELECTED_CLASS="djs-search-result-selected",Ce.RESULT_SELECTED_SELECTOR="."+Ce.RESULT_SELECTED_CLASS,Ce.RESULT_ID_ATTRIBUTE="data-result-id",Ce.RESULT_HIGHLIGHT_CLASS="djs-search-highlight",Ce.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>`,Ce.RESULT_HTML='<div class="djs-search-result"></div>',Ce.RESULT_PRIMARY_HTML='<div class="djs-search-result-primary"></div>',Ce.RESULT_SECONDARY_HTML='<p class="djs-search-result-secondary"></p>';const ID={__depends__:[oa,Oc,qn],searchPad:["type",Ce]};function Nf(e,t,n,i){this._elementRegistry=e,this._canvas=n,this._search=i,t.registerProvider(this)}Nf.$inject=["elementRegistry","searchPad","canvas","search"],Nf.prototype.find=function(e){var t=this._canvas.getRootElements(),n=this._elementRegistry.filter(function(i){return!Me(i)&&!t.includes(i)});return this._search(n.map(i=>({element:i,label:jn(i),id:i.id})),e,{keys:["label","id"]}).map(ND)};function ND(e){const{item:{element:t},tokens:n}=e;return{element:t,primaryTokens:n.label,secondaryTokens:n.id}}const BD={__depends__:[ID,w_],__init__:["bpmnSearch"],bpmnSearch:["type",Nf]},$D="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",jD="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",FD={width:36,height:50},HD={width:50,height:50};function px(e,t,n){return me("path",{d:e,strokeWidth:2,transform:`translate(${t.x}, ${t.y})`,...n})}const ei=5;function vu(e,t){this._styles=t,e.registerProvider(this)}vu.$inject=["outline","styles"],vu.prototype.getOutline=function(e){const t=this._styles.cls("djs-outline",["no-fill"]);var n;if(pS(e))return n=me("rect"),re(n,O({x:-ei,y:-ei,rx:4,width:e.width+ei*2,height:e.height+ei*2},t)),n;if(!Me(e))return v(e,"bpmn:Gateway")?(n=me("rect"),O(n.style,{"transform-box":"fill-box",transform:"rotate(45deg)","transform-origin":"center"}),re(n,O({x:2,y:2,rx:4,width:e.width-4,height:e.height-4},t))):De(e,["bpmn:Task","bpmn:SubProcess","bpmn:Group","bpmn:CallActivity"])?(n=me("rect"),re(n,O({x:-ei,y:-ei,rx:14,width:e.width+ei*2,height:e.height+ei*2},t))):v(e,"bpmn:EndEvent")?(n=me("circle"),re(n,O({cx:e.width/2,cy:e.height/2,r:e.width/2+ei+1},t))):v(e,"bpmn:Event")?(n=me("circle"),re(n,O({cx:e.width/2,cy:e.height/2,r:e.width/2+ei},t))):v(e,"bpmn:DataObjectReference")&&fx(e,"bpmn:DataObjectReference")?n=px($D,{x:-6,y:-6},t):v(e,"bpmn:DataStoreReference")&&fx(e,"bpmn:DataStoreReference")&&(n=px(jD,{x:-6,y:-6},t)),n},vu.prototype.updateOutline=function(e,t){if(!Me(e))return De(e,["bpmn:SubProcess","bpmn:Group"])?(re(t,{width:e.width+ei*2,height:e.height+ei*2}),!0):!!De(e,["bpmn:Event","bpmn:Gateway","bpmn:DataStoreReference","bpmn:DataObjectReference"])};function fx(e,t){var n;return t==="bpmn:DataObjectReference"?n=FD:t==="bpmn:DataStoreReference"&&(n=HD),e.width===n.width&&e.height===n.height}const zD={__depends__:[Cf],__init__:["outlineProvider"],outlineProvider:["type",vu]};var VD='<?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 xi(e){uo.call(this,e)}ie(xi,uo),xi.Viewer=mr,xi.NavigatedViewer=Da,xi.prototype.createDiagram=function(){return this.importXML(VD)},xi.prototype._interactionModules=[Rv,Pv,Mv],xi.prototype._modelingModules=[WM,kc,XM,qM,u2,xf,m2,F2,my,uc,G2,Y2,uk,pk,fk,yk,Tk,Lk,Up,Hk,Kk,aD,cD,Cb,OD,BD,zD],xi.prototype._modules=[].concat(mr.prototype._modules,xi.prototype._interactionModules,xi.prototype._modelingModules);const GD=((e,t)=>{const n=e.__vccOpts||e;for(const[i,r]of t)n[i]=r;return n})(Ct.defineComponent({__name:"BpmnModelerView",props:{xml:{}},emits:["ready","imported","import-error"],setup(e,{expose:t,emit:n}){const i=e,r=n,o=Ct.ref();let a;async function s(u){if(!a)throw new Error("modeler not mounted");try{const{warnings:l}=await a.importXML(u),p=ju(l);return r("imported",p),{warnings:p}}catch(l){throw r("import-error",l),l}}async function c(){if(!a)throw new Error("modeler not mounted");const{xml:u}=await a.saveXML({format:!0});return u??""}return Ct.onMounted(async()=>{a=new xi({container:o.value,moddleExtensions:is}),i.xml&&await s(i.xml),r("ready")}),Ct.watch(()=>i.xml,u=>{u&&a&&s(u)}),Ct.onBeforeUnmount(()=>{a==null||a.destroy(),a=void 0}),t({importXml:s,saveXml:c,getModeler:()=>a}),(u,l)=>(Ct.openBlock(),Ct.createElementBlock("div",{ref_key:"container",ref:o,class:"bpmn-modeler-view"},null,512))}}),[["__scopeId","data-v-a9b41c97"]]);Q.APPLY_BPMN_OPS_SCHEMA=Gx,Q.BPMN_MODDLE_EXTENSIONS=is,Q.BWL_MODDLE_SCHEMA=Ff,Q.BWL_NS=jf,Q.BWL_PREFIX=bu,Q.BWL_SIDES=xu,Q.BpmnModelerView=GD,Q.EDITOR=lE,Q.FLOW_LABEL_INDENT=bd,Q.HEADLESS_BPMN_MODULES=mv,Q.HEADLESS_TEXT_METRICS=no,Q.I18N_NS=ww,Q.I18N_PREFIX=pd,Q.LABEL_FORK_MARGIN=Hu,Q.MVP_FLOW_NODE_TYPES=wi,Q.SYMBOLIC_OP_KINDS=Vf,Q.SYMBOLIC_OP_SCHEMA=Gf,Q.UNDO_EPISODE_COMMAND=wu,Q.applyBpmnOpBatch=ch,Q.applyBpmnOps=rh,Q.approximateTextWidth=io,Q.auditBpmnGeometry=Td,Q.auditBpmnGeometryXml=Gw,Q.auditGeometry=qi,Q.auditTargetsOf=Ci,Q.axisSegmentsOf=hn,Q.blackBoxNameRect=Fu,Q.buildBpmnOpBatch=uE,Q.buildRegistryIndex=kd,Q.containerBoundarySegments=Wo,Q.createBpmnEditorController=pE,Q.createBpmnModdle=fd,Q.createHeadlessBpmnModeler=kT,Q.crossedShapesOf=zn,Q.crossingCost=Ri,Q.describeProcess=sh,Q.describeProcessXml=cE,Q.edgeCrossCount=cs,Q.edgeCrossingPairsOf=Vu,Q.executeAsUndoEpisode=zf,Q.forwardThreePointCandidates=Gu,Q.geometryFindingKey=Yi,Q.installHeadlessBpmnDom=hd,Q.isMvpFlowNodeType=$f,Q.labelRectsOf=Uo,Q.lineCrossesLabel=Si,Q.lineThroughLabel=wd,Q.lineThroughShapeLabel=Pd,Q.loadBpmnXml=$u,Q.lowerOps=ih,Q.oppositeOverlapCount=Lw,Q.oppositeOverlapOf=_d,Q.planBackEdgeBoundaryClearance=Vd,Q.planCrossPoolRoute=jd,Q.planEdgeRepair=Nd,Q.planLabelLineClearance=qd,Q.planLabelPlacement=Yd,Q.planMiddleSegmentShifts=Ld,Q.planOppositeOverlapRepair=Wd,Q.planSegmentDetours=Od,Q.planShapeLabelClearance=Zd,Q.repairIntroducedBoundaryHugging=Gd,Q.repairIntroducedCrossings=Bd,Q.repairIntroducedLabelLines=Kd,Q.repairIntroducedOppositeOverlaps=Ud,Q.repairIntroducedShapeLabelLines=Qd,Q.repairIntroducedSharedSegmentLabels=Xd,Q.rerouteIntroducedCrossPoolEdges=Fd,Q.resolverServicesOf=nh,Q.saveBpmnXml=Ew,Q.sceneCrossingCost=Sd,Q.sceneFromDefinitions=Ad,Q.sceneFromRegistry=Ut,Q.sharedSegmentUnderLabel=ss,Q.sharedSpansOf=as,Q.unreadableOverlapCount=Tr,Q.unreadableOverlapOf=os,Q.validateOps=th,Q.warningMessages=ju,Object.defineProperty(Q,Symbol.toStringTag,{value:"Module"})}));
343
+ </div>`,Ce.RESULT_HTML='<div class="djs-search-result"></div>',Ce.RESULT_PRIMARY_HTML='<div class="djs-search-result-primary"></div>',Ce.RESULT_SECONDARY_HTML='<p class="djs-search-result-secondary"></p>';const ND={__depends__:[oa,Dc,qn],searchPad:["type",Ce]};function Nf(e,t,n,i){this._elementRegistry=e,this._canvas=n,this._search=i,t.registerProvider(this)}Nf.$inject=["elementRegistry","searchPad","canvas","search"],Nf.prototype.find=function(e){var t=this._canvas.getRootElements(),n=this._elementRegistry.filter(function(i){return!Me(i)&&!t.includes(i)});return this._search(n.map(i=>({element:i,label:jn(i),id:i.id})),e,{keys:["label","id"]}).map(BD)};function BD(e){const{item:{element:t},tokens:n}=e;return{element:t,primaryTokens:n.label,secondaryTokens:n.id}}const $D={__depends__:[ND,E_],__init__:["bpmnSearch"],bpmnSearch:["type",Nf]},jD="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",FD="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",HD={width:36,height:50},zD={width:50,height:50};function fx(e,t,n){return me("path",{d:e,strokeWidth:2,transform:`translate(${t.x}, ${t.y})`,...n})}const ei=5;function yu(e,t){this._styles=t,e.registerProvider(this)}yu.$inject=["outline","styles"],yu.prototype.getOutline=function(e){const t=this._styles.cls("djs-outline",["no-fill"]);var n;if(fS(e))return n=me("rect"),re(n,O({x:-ei,y:-ei,rx:4,width:e.width+ei*2,height:e.height+ei*2},t)),n;if(!Me(e))return v(e,"bpmn:Gateway")?(n=me("rect"),O(n.style,{"transform-box":"fill-box",transform:"rotate(45deg)","transform-origin":"center"}),re(n,O({x:2,y:2,rx:4,width:e.width-4,height:e.height-4},t))):De(e,["bpmn:Task","bpmn:SubProcess","bpmn:Group","bpmn:CallActivity"])?(n=me("rect"),re(n,O({x:-ei,y:-ei,rx:14,width:e.width+ei*2,height:e.height+ei*2},t))):v(e,"bpmn:EndEvent")?(n=me("circle"),re(n,O({cx:e.width/2,cy:e.height/2,r:e.width/2+ei+1},t))):v(e,"bpmn:Event")?(n=me("circle"),re(n,O({cx:e.width/2,cy:e.height/2,r:e.width/2+ei},t))):v(e,"bpmn:DataObjectReference")&&dx(e,"bpmn:DataObjectReference")?n=fx(jD,{x:-6,y:-6},t):v(e,"bpmn:DataStoreReference")&&dx(e,"bpmn:DataStoreReference")&&(n=fx(FD,{x:-6,y:-6},t)),n},yu.prototype.updateOutline=function(e,t){if(!Me(e))return De(e,["bpmn:SubProcess","bpmn:Group"])?(re(t,{width:e.width+ei*2,height:e.height+ei*2}),!0):!!De(e,["bpmn:Event","bpmn:Gateway","bpmn:DataStoreReference","bpmn:DataObjectReference"])};function dx(e,t){var n;return t==="bpmn:DataObjectReference"?n=HD:t==="bpmn:DataStoreReference"&&(n=zD),e.width===n.width&&e.height===n.height}const VD={__depends__:[Cf],__init__:["outlineProvider"],outlineProvider:["type",yu]};var GD='<?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 xi(e){uo.call(this,e)}ie(xi,uo),xi.Viewer=mr,xi.NavigatedViewer=Da,xi.prototype.createDiagram=function(){return this.importXML(GD)},xi.prototype._interactionModules=[Cv,Av,kv],xi.prototype._modelingModules=[UM,Mc,ZM,KM,l2,xf,g2,H2,gy,cc,W2,q2,lk,fk,dk,vk,Mk,Ik,Up,zk,Xk,sD,uD,Pb,LD,$D,VD],xi.prototype._modules=[].concat(mr.prototype._modules,xi.prototype._interactionModules,xi.prototype._modelingModules);const WD=((e,t)=>{const n=e.__vccOpts||e;for(const[i,r]of t)n[i]=r;return n})(Ct.defineComponent({__name:"BpmnModelerView",props:{xml:{}},emits:["ready","imported","import-error"],setup(e,{expose:t,emit:n}){const i=e,r=n,o=Ct.ref();let a;async function s(u){if(!a)throw new Error("modeler not mounted");try{const{warnings:l}=await a.importXML(u),p=ju(l);return r("imported",p),{warnings:p}}catch(l){throw r("import-error",l),l}}async function c(){if(!a)throw new Error("modeler not mounted");const{xml:u}=await a.saveXML({format:!0});return u??""}return Ct.onMounted(async()=>{a=new xi({container:o.value,moddleExtensions:ns}),i.xml&&await s(i.xml),r("ready")}),Ct.watch(()=>i.xml,u=>{u&&a&&s(u)}),Ct.onBeforeUnmount(()=>{a==null||a.destroy(),a=void 0}),t({importXml:s,saveXml:c,getModeler:()=>a}),(u,l)=>(Ct.openBlock(),Ct.createElementBlock("div",{ref_key:"container",ref:o,class:"bpmn-modeler-view"},null,512))}}),[["__scopeId","data-v-a9b41c97"]]);Q.APPLY_BPMN_OPS_SCHEMA=Wx,Q.BPMN_MODDLE_EXTENSIONS=ns,Q.BWL_MODDLE_SCHEMA=Hf,Q.BWL_NS=Ff,Q.BWL_PREFIX=bu,Q.BWL_SIDES=xu,Q.BpmnModelerView=WD,Q.EDITOR=pE,Q.FLOW_LABEL_INDENT=xd,Q.HEADLESS_BPMN_MODULES=gv,Q.HEADLESS_TEXT_METRICS=no,Q.I18N_NS=Ew,Q.I18N_PREFIX=fd,Q.LABEL_FORK_MARGIN=Hu,Q.MVP_FLOW_NODE_TYPES=wi,Q.SYMBOLIC_OP_KINDS=Gf,Q.SYMBOLIC_OP_SCHEMA=Wf,Q.UNDO_EPISODE_COMMAND=wu,Q.applyBpmnOpBatch=uh,Q.applyBpmnOps=oh,Q.approximateTextWidth=io,Q.auditBpmnGeometry=Md,Q.auditBpmnGeometryXml=Ww,Q.auditGeometry=qi,Q.auditTargetsOf=Ci,Q.axisSegmentsOf=hn,Q.blackBoxNameRect=Fu,Q.buildBpmnOpBatch=lE,Q.buildRegistryIndex=Dd,Q.containerBoundarySegments=Wo,Q.createBpmnEditorController=fE,Q.createBpmnModdle=dd,Q.createHeadlessBpmnModeler=DT,Q.crossedShapesOf=zn,Q.crossingCost=Ri,Q.describeProcess=ch,Q.describeProcessXml=uE,Q.edgeCrossCount=ss,Q.edgeCrossingPairsOf=Vu,Q.executeAsUndoEpisode=Vf,Q.forwardThreePointCandidates=Gu,Q.geometryFindingKey=Yi,Q.installHeadlessBpmnDom=md,Q.isMvpFlowNodeType=jf,Q.labelRectsOf=Uo,Q.lineCrossesLabel=Si,Q.lineThroughLabel=Ed,Q.lineThroughShapeLabel=Ad,Q.loadBpmnXml=$u,Q.lowerOps=rh,Q.oppositeOverlapCount=Iw,Q.oppositeOverlapOf=bd,Q.planBackEdgeBoundaryClearance=Gd,Q.planCrossPoolRoute=Fd,Q.planEdgeRepair=Bd,Q.planLabelLineClearance=Kd,Q.planLabelPlacement=qd,Q.planMiddleSegmentShifts=Id,Q.planOppositeOverlapRepair=Ud,Q.planSegmentDetours=Ld,Q.planShapeLabelClearance=Qd,Q.repairIntroducedBoundaryHugging=Wd,Q.repairIntroducedCrossings=$d,Q.repairIntroducedLabelLines=Xd,Q.repairIntroducedOppositeOverlaps=Yd,Q.repairIntroducedShapeLabelLines=Jd,Q.repairIntroducedSharedSegmentLabels=Zd,Q.rerouteIntroducedCrossPoolEdges=Hd,Q.resolverServicesOf=ih,Q.saveBpmnXml=Sw,Q.sceneCrossingCost=Rd,Q.sceneFromDefinitions=Td,Q.sceneFromRegistry=Ut,Q.sharedSegmentUnderLabel=as,Q.sharedSpansOf=os,Q.unreadableOverlapCount=Tr,Q.unreadableOverlapOf=rs,Q.validateOps=nh,Q.warningMessages=ju,Object.defineProperty(Q,Symbol.toStringTag,{value:"Module"})}));