@g1cloud/bpmn-modeler-next 5.0.0-alpha.13 → 5.0.0-alpha.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bpmn-modeler.js +3743 -3709
- package/dist/bpmn-modeler.umd.cjs +44 -44
- package/package.json +1 -1
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
(function(Q,_t){typeof exports=="object"&&typeof module<"u"?_t(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],_t):(Q=typeof globalThis<"u"?globalThis:Q||self,_t(Q.BpmnModeler={},Q.Vue))})(this,(function(Q,_t){"use strict";var hD=Object.defineProperty;var mD=(Q,_t,gi)=>_t in Q?hD(Q,_t,{enumerable:!0,configurable:!0,writable:!0,value:gi}):Q[_t]=gi;var Hr=(Q,_t,gi)=>mD(Q,typeof _t!="symbol"?_t+"":_t,gi);const gi=["startEvent","endEvent","userTask","serviceTask","task","sendTask","receiveTask","exclusiveGateway","parallelGateway"];function Sf(e){return gi.includes(e)}const Rf="http://g1project.net/spec/bpmn/bwl/1.0",cu="bwl",uu=["top-left","top","top-right","right","bottom-right","bottom","bottom-left","left"],Cf={name:"bwl-hints",uri:Rf,prefix:cu,xml:{tagAlias:"lowerCase"},types:[{name:"Placement",superClass:["Element"],properties:[{name:"anchor",isAttr:!0,type:"String"},{name:"side",isAttr:!0,type:"String"},{name:"offset",isAttr:!0,type:"Real"}]},{name:"Members",superClass:["Element"],properties:[{name:"refs",isAttr:!0,type:"String"}]},{name:"BandHint",extends:["bpmn:FlowNode"],properties:[{name:"band",isAttr:!0,type:"Integer"}]},{name:"PoolOrderHint",extends:["bpmn:Participant"],properties:[{name:"poolOrder",isAttr:!0,type:"Integer"}]}]},lu="bwl.undoEpisode",Pf=new WeakSet;function Zb(e){Pf.has(e)||(e.register(lu,{preExecute(t){try{t.run()}catch(n){t.error=n}}}),Pf.add(e))}function Af(e,t){Zb(e);const n={run:t};if(e.execute(lu,n),n.error!==void 0)throw e.canUndo()&&e.undo(),n.error}const Tf=["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"],Qb={description:"생략 = 보존, null = 제거.",anyOf:[{type:"string"},{type:"null"}]},Jb={type:"object",description:"레인. 배열 선언 순서 = 풀 내 상→하 순서.",properties:{id:{type:"string"},name:{type:"string"}},required:["id"],additionalProperties:!1},e0={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},t0={type:"object",description:"플로우 노드. 좌표는 지정하지 않는다 — 배치는 resolver 가 결정한다.",properties:{id:{type:"string"},type:{type:"string",enum:[...gi]},name:{type:"string"},participant:{type:"string",description:"소속 풀 id(협업 문서)."},lane:{type:"string",description:"소속 레인 id(풀 정의에 선언된 것)."}},required:["id","type"],additionalProperties:!1},n0={type:"object",description:"분기 조건 — 게이트웨이가 아닌 플로우에 붙인다. MVP 는 label 만.",properties:{label:{type:"string"}},required:["label"],additionalProperties:!1},i0={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},r0={type:"object",description:"메시지 플로우(풀 경계를 넘는 연결 — 노드 또는 블랙박스 풀 자체가 끝점).",properties:{id:{type:"string"},source:{type:"string"},target:{type:"string"},name:{type:"string"}},required:["id","source","target"],additionalProperties:!1},o0={type:"object",properties:{id:{type:"string"},name:{type:"string"}},required:["id"],additionalProperties:!1},a0={type:"object",description:"데이터 입출력 연관. 방향 = source→target(태스크→스토어 = 쓰기, 스토어→태스크 = 읽기).",properties:{id:{type:"string"},source:{type:"string"},target:{type:"string"}},required:["source","target"],additionalProperties:!1},s0={type:"object",properties:{id:{type:"string"},text:{type:"string"}},required:["id","text"],additionalProperties:!1},c0={type:"object",description:"연관선(주석 ↔ 요소).",properties:{id:{type:"string"},source:{type:"string"},target:{type:"string"}},required:["source","target"],additionalProperties:!1},u0={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},l0={type:"object",description:"주석 방위 힌트 — 앵커 요소 기준 상대 배치. 있으면 결정적 배치, 없으면 휴리스틱.",properties:{anchor:{type:"string",description:"기준 요소 id."},side:{type:"string",enum:[...uu]},offset:{type:"number"}},required:["anchor","side"],additionalProperties:!1};function Yt(e,t){return{type:"object",description:t.description,properties:{kind:{const:e},...t.properties},required:["kind",...t.required??[]],additionalProperties:!1}}const p0={"participant.add":Yt("participant.add",{description:"풀 추가. order = 풀 세로 순서 힌트(생략 시 op 순서가 곧 배치 순서).",properties:{participant:{$ref:"#/$defs/irParticipant"},order:{type:"integer"}},required:["participant"]}),"participant.update":Yt("participant.update",{description:"풀 이름/레인 갱신. lanes 는 전체 재선언(생략 = 보존) — 기존 레인을 유지하려면 함께 다시 나열한다.",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"},lanes:{type:"array",items:{$ref:"#/$defs/irLane"}}},required:["id"]}),"node.add":Yt("node.add",{description:'플로우 노드 추가. band = 가로 밴드 순번 힌트(주 흐름 0, 갈래 1, 2…) — 위/아래가 아니라 "주 흐름에서 몇 번째 갈래"다. 행 배치(어느 갈래가 위/아래인지)는 호스트가 정한다(대칭·메시지 방향). 레인이 있으면 그 레인 안의 밴드다 — 한 레인 안에서 게이트웨이 출구를 갈라 놓을 때 쓴다. 컨테이너(풀·레인)는 밴드 수만큼 자란다.',properties:{node:{$ref:"#/$defs/irNode"},band:{type:"integer"}},required:["node"]}),"node.update":Yt("node.update",{description:"노드 이름/레인/타입 갱신. lane = 레인 재배정(이동), type = 태스크·이벤트 타입 전환.",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"},lane:{type:"string"},type:{type:"string",enum:[...gi]}},required:["id"]}),"sequenceFlow.add":Yt("sequenceFlow.add",{description:"시퀀스 플로우 추가. 분기 조건은 게이트웨이가 아닌 플로우의 condition 에 싣는다.",properties:{flow:{$ref:"#/$defs/irSequenceFlow"}},required:["flow"]}),"sequenceFlow.update":Yt("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":Yt("messageFlow.add",{description:"메시지 플로우 추가(풀 경계를 넘는 연결).",properties:{flow:{$ref:"#/$defs/irMessageFlow"}},required:["flow"]}),"messageFlow.update":Yt("messageFlow.update",{description:"메시지 플로우 이름 갱신.",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"}},required:["id"]}),"dataStore.add":Yt("dataStore.add",{description:"데이터 스토어 추가(+ 입출력 연관 동반 가능).",properties:{dataStore:{$ref:"#/$defs/irDataStore"},associations:{type:"array",items:{$ref:"#/$defs/irDataAssociation"}}},required:["dataStore"]}),"dataStore.update":Yt("dataStore.update",{description:"데이터 스토어 이름 갱신.",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"}},required:["id"]}),"dataAssociation.add":Yt("dataAssociation.add",{description:"기존 노드 ↔ 기존 데이터 스토어의 입출력 연관 추가.",properties:{association:{$ref:"#/$defs/irDataAssociation"}},required:["association"]}),"association.add":Yt("association.add",{description:"주석 ↔ 요소 연관 추가(한쪽 끝은 주석). 주석 신설과 함께면 annotation.add 의 association 을 쓰고, 이 op 는 추가 연관(한 주석에 여러 연관)용.",properties:{association:{$ref:"#/$defs/irAssociation"}},required:["association"]}),"annotation.add":Yt("annotation.add",{description:"텍스트 주석 추가. association 으로 대상 요소와 연결하고, placement 로 방위를 지정하면 결정적 배치된다.",properties:{annotation:{$ref:"#/$defs/irTextAnnotation"},association:{$ref:"#/$defs/irAssociation"},placement:{$ref:"#/$defs/bwlPlacement"}},required:["annotation"]}),"annotation.update":Yt("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":Yt("group.add",{description:"그룹 추가 — 바운즈는 members 의 bbox 로 산출되므로 좌표를 지정하지 않는다.",properties:{group:{$ref:"#/$defs/irGroup"}},required:["group"]}),"group.update":Yt("group.update",{description:"그룹 이름/멤버 갱신. members 는 전체 재선언(생략 = 보존).",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"},members:{type:"array",items:{type:"string"}}},required:["id"]}),"element.remove":Yt("element.remove",{description:"요소 제거(카테고리 무관). 부착된 연결선은 함께 제거된다.",properties:{id:{type:"string"}},required:["id"]})},Mf={anyOf:Tf.map(e=>p0[e])},f0={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:Jb,irParticipant:e0,irNode:t0,irFlowCondition:n0,irSequenceFlow:i0,irMessageFlow:r0,irDataStore:o0,irDataAssociation:a0,irTextAnnotation:s0,irAssociation:c0,irGroup:u0,bwlPlacement:l0,nullableString:Qb,symbolicOp:Mf}};function pu(e){return Array.prototype.concat.apply([],e)}const To=Object.prototype.toString,d0=Object.prototype.hasOwnProperty;function vr(e){return e===void 0}function At(e){return e!==void 0}function zr(e){return e==null}function pe(e){return To.call(e)==="[object Array]"}function It(e){return To.call(e)==="[object Object]"}function he(e){return To.call(e)==="[object Number]"}function Lt(e){const t=To.call(e);return t==="[object Function]"||t==="[object AsyncFunction]"||t==="[object GeneratorFunction]"||t==="[object AsyncGeneratorFunction]"||t==="[object Proxy]"}function hn(e){return To.call(e)==="[object String]"}function h0(e){if(!pe(e))throw new Error("must supply array")}function mn(e,t){return!zr(e)&&d0.call(e,t)}function Ke(e,t){const n=Ha(t);let i;return M(e,function(r,o){if(n(r,o))return i=r,!1}),i}function kf(e,t){const n=Ha(t);let i=pe(e)?-1:void 0;return M(e,function(r,o){if(n(r,o))return i=o,!1}),i}function Re(e,t){const n=Ha(t);let i=[];return M(e,function(r,o){n(r,o)&&i.push(r)}),i}function M(e,t){let n,i;if(vr(e))return;const r=pe(e)?_0:y0;for(let o in e)if(mn(e,o)&&(n=e[o],i=t(n,r(o)),i===!1))return n}function m0(e,t){if(vr(e))return[];h0(e);const n=Ha(t);return e.filter(function(i,r){return!n(i,r)})}function gn(e,t,n){return M(e,function(i,r){n=t(n,i,r)}),n}function yr(e,t){return!!gn(e,function(n,i,r){return n&&t(i,r)},!0)}function Li(e,t){return!!Ke(e,t)}function Kt(e,t){let n=[];return M(e,function(i,r){n.push(t(i,r))}),n}function Fa(e){return e&&Object.keys(e)||[]}function g0(e){return Fa(e).length}function Vr(e){return Kt(e,t=>t)}function Gr(e,t,n={}){return t=fu(t),M(e,function(i){let r=t(i)||"_",o=n[r];o||(o=n[r]=[]),o.push(i)}),n}function Df(e,...t){e=fu(e);let n={};return M(t,r=>Gr(r,e,n)),Kt(n,function(r,o){return r[0]})}const v0=Df;function Jn(e,t){t=fu(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)}),Kt(n,i=>i.v)}function Wr(e){return function(t){return yr(e,function(n,i){return t[i]===n})}}function fu(e){return Lt(e)?e:t=>t[e]}function Ha(e){return Lt(e)?e:t=>t===e}function y0(e){return e}function _0(e){return Number(e)}function du(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 pn(e,t){return e.bind(t)}function D(e,...t){return Object.assign(e,...t)}function b0(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];At(a)&&zr(s)&&(s=i[r]=isNaN(+a)?{}:[]),vr(a)?vr(n)?delete i[r]:i[r]=n:i=s}),e}function qn(e,t){let n={},i=Object(e);return M(t,function(r){r in i&&(n[r]=e[r])}),n}function ei(e,t){let n={},i=Object(e);return M(i,function(r,o){t.indexOf(o)===-1&&(n[o]=r)}),n}function hu(){}hu.prototype.get=function(e){return this.$model.properties.get(this,e)},hu.prototype.set=function(e,t){this.$model.properties.set(this,e,t)};function Of(e,t){this.model=e,this.properties=t}Of.prototype.createType=function(e){var t=this.model,n=this.properties,i=Object.create(hu.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,pn(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 x0=D(Object.create(null),{String:!0,Boolean:!0,Integer:!0,Real:!0,Element:!0}),If=D(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 mu(e,t){var n=If[e];return n?n(t):t}function gu(e){return!!x0[e]}function Lf(e){return!!If[e]}function Xt(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 Pn(e){this.ns=e,this.name=e.name,this.allTypes=[],this.allTypesByName=Object.create(null),this.properties=[],this.propertiesByName=Object.create(null)}Pn.prototype.build=function(){return qn(this,["ns","name","allTypes","allTypesByName","properties","propertiesByName","bodyProperty","idProperty"])},Pn.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)},Pn.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},Pn.prototype.redefineProperty=function(e,t,n){var i=e.ns.prefix,r=t.split("#"),o=Xt(r[0],i),a=Xt(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},Pn.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},Pn.prototype.removeNamedProperty=function(e){var t=e.ns,n=this.propertiesByName;delete n[t.name],delete n[t.localName]},Pn.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},Pn.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},Pn.prototype.assertNotTrait=function(e){if((e.extends||[]).length)throw new Error(`cannot create <${e.name}> extending <${e.extends}>`)},Pn.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")},Pn.prototype.hasProperty=function(e){return this.propertiesByName[e]},Pn.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,pn(function(o){o=D({},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 Ni(e,t){this.packageMap=Object.create(null),this.typeMap=Object.create(null),this.packages=[],this.properties=t,M(e,pn(this.registerPackage,this))}Ni.prototype.getPackage=function(e){return this.packageMap[e]},Ni.prototype.getPackages=function(){return this.packages},Ni.prototype.registerPackage=function(e){e=D({},e);var t=this.packageMap;Nf(t,e,"prefix"),Nf(t,e,"uri"),M(e.types,pn(function(n){this.registerType(n,e)},this)),t[e.uri]=t[e.prefix]=e,this.packages.push(e)},Ni.prototype.registerType=function(e,t){e=D({},e,{superClass:(e.superClass||[]).slice(),extends:(e.extends||[]).slice(),properties:(e.properties||[]).slice(),meta:D({},e.meta||{})});var n=Xt(e.name,t.prefix),i=n.name,r=Object.create(null);M(e.properties,pn(function(o){var a=Xt(o.name,n.prefix),s=a.name;gu(o.type)||(o.type=Xt(o.type,a.prefix).name),D(o,{ns:a,name:s}),r[s]=o},this)),D(e,{ns:n,name:i,propertiesByName:r}),M(e.extends,pn(function(o){var a=Xt(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},Ni.prototype.mapTypes=function(e,t,n){var i=gu(e.name)?{name:e.name}:this.typeMap[e.name],r=this;function o(c,u){var l=Xt(c,gu(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)},Ni.prototype.getEffectiveDescriptor=function(e){var t=Xt(e),n=new Pn(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},Ni.prototype.definePackage=function(e,t){this.properties.define(e,"$pkg",{value:t})};function Nf(e,t,n){var i=t[n];if(i in e)throw new Error("package with "+n+" <"+i+"> already defined")}function _r(e){this.model=e}_r.prototype.set=function(e,t,n){if(!hn(t)||!t.length)throw new TypeError("property name must be a non-empty string");var i=this.getProperty(e,t),r=i&&i.name;E0(n)?i?delete e[r]:delete e.$attrs[vu(t)]:i?r in e?e[r]=n:Bf(e,i,n):e.$attrs[vu(t)]=n},_r.prototype.get=function(e,t){var n=this.getProperty(e,t);if(!n)return e.$attrs[vu(t)];var i=n.name;return!e[i]&&n.isMany&&Bf(e,n,[]),e[i]},_r.prototype.define=function(e,t,n){if(!n.writable){var i=n.value;n=D({},n,{get:function(){return i}}),delete n.value}Object.defineProperty(e,t,n)},_r.prototype.defineDescriptor=function(e,t){this.define(e,"$descriptor",{value:t})},_r.prototype.defineModel=function(e,t){this.define(e,"$model",{value:t})},_r.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 Bf(e,t,n){Object.defineProperty(e,t.name,{enumerable:!t.isReference,writable:!0,value:n,configurable:!0})}function vu(e){return e.replace(/^:/,"")}function On(e,t={}){this.properties=new _r(this),this.factory=new Of(this,this.properties),this.registry=new Ni(e,this.properties),this.typeCache=Object.create(null),this.config=t}On.prototype.create=function(e,t){var n=this.getType(e);if(!n)throw new Error("unknown type <"+e+">");return new n(t)},On.prototype.getType=function(e){var t=this.typeCache,n=hn(e)?e:e.ns.name,i=t[n];return i||(e=this.registry.getEffectiveDescriptor(n),i=t[n]=this.factory.createType(e)),i},On.prototype.createAny=function(e,t,n){var i=Xt(e),r={$type:e,$instanceOf:function(a){return a===this.$type},get:function(a){return this[a]},set:function(a,s){b0(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){It(a)&&a.value!==void 0?r[a.name]=a.value:r[s]=a}),r},On.prototype.getPackage=function(e){return this.registry.getPackage(e)},On.prototype.getPackages=function(){return this.registry.getPackages()},On.prototype.getElementDescriptor=function(e){return e.$descriptor},On.prototype.hasType=function(e,t){t===void 0&&(t=e,e=this);var n=e.$model.getElementDescriptor(e);return t in n.allTypesByName},On.prototype.getPropertyDescriptor=function(e,t){return this.getElementDescriptor(e).propertiesByName[t]},On.prototype.getTypeDescriptor=function(e){return this.registry.typeMap[e]};var $f=String.fromCharCode,w0=Object.prototype.hasOwnProperty,S0=/&#(\d+);|&#x([0-9a-f]+);|&(\w+);/ig,Mo={amp:"&",apos:"'",gt:">",lt:"<",quot:'"'};Object.keys(Mo).forEach(function(e){Mo[e.toUpperCase()]=Mo[e]});function R0(e,t,n,i){return i?w0.call(Mo,i)?Mo[i]:"&"+i+";":$f(t||parseInt(n,16))}function br(e){return e.length>3&&e.indexOf("&")!==-1?e.replace(S0,R0):e}var jf="non-whitespace outside of root node";function Bi(e){return new Error(e)}function C0(e){return"missing namespace for prefix <"+e+">"}function za(e){return{get:e,enumerable:!0}}function P0(e){var t=Object.create(null),n;for(n in e)t[n]=e[n];return t}var Ff=Symbol("nameCache");function yu(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[yu(i)]=n;return t}function Va(){return{line:0,column:0}}function T0(e){throw e}function Hf(e){if(!this)return new Hf(e);var t=e&&e.proxy,n,i,r,o,a=T0,s,c,u,l,p=Va,f=!1,d=!1,h="",m=!1,g=!1,S=null,E=!1,b,x,w,T;function I(L){L instanceof Error||(L=Bi(L)),S=L,a(L,p)}function P(L){s&&(L instanceof Error||(L=Bi(L)),s(L,p))}this.on=function(L,H){if(typeof H!="function")throw Bi("required args <name, cb>");switch(L){case"openTag":i=H;break;case"text":n=H;break;case"closeTag":r=H;break;case"error":a=H;break;case"warn":s=H;break;case"cdata":o=H;break;case"attention":l=H;break;case"question":u=H;break;case"comment":c=H;break;default:throw Bi("unsupported event: "+L)}return this},this.ns=function(L){if(typeof L>"u"&&(L={}),typeof L!="object")throw Bi("required args <nsMap={}>");var H=Object.create(null),oe;for(oe in L)H[oe]=L[oe];return g=!0,T=H,this};function j(){b=g?[]:null,x=g?A0(T):null,w=[],p=Va,E=!1,S=null,d=!1,h=""}this.parse=function(L){if(typeof L!="string")throw Bi("required args <xml=string>");if(f)throw Bi("parse during stream; call end() first");return j(),F(L),p=Va,E=!1,S},this.write=function(L){if(typeof L!="string")throw Bi("required args <xml=string>");return f||(j(),f=!0),S||(h=F(h+L,!0)||""),this},this.end=function(){return f||j(),f=!1,S||F(h),h="",p=Va,E=!1,S},this.stop=function(){E=!0};function F(L,H=!1){var oe=null,Te=null,ot,Y=0,re=!1,le=!1,ae=0,se=0,Z,$,N,V,we,vt,C,_,v,k="",O=0,z;function ie(We,Ot){var $t=We.indexOf(":");if($t===-1)return We;var tn=x[We.substring(0,$t)];return tn?Ot===tn?We.substr($t+1):tn+We.substr($t):(P(C0(We.substring(0,$t))),null)}function _e(){if(z!==null)return z;var We,Ot,$t=g&&x.xmlns,tn=g&&m?[]:null,Xe=O,Ct=k,nn=Ct.length,Fr,ln,Un,kn,Pt,Zn={},Na=new Set,Dn,Le,je;e:for(;Xe<nn;Xe++)if(Dn=!1,Le=Ct.charCodeAt(Xe),!(Le===32||Le<14&&Le>8)){for((Le<65||Le>122||Le>90&&Le<97)&&Le!==95&&Le!==58&&(P("illegal first char attribute name"),Dn=!0),je=Xe+1;je<nn;je++)if(Le=Ct.charCodeAt(je),!(Le>96&&Le<123||Le>64&&Le<91||Le>47&&Le<59||Le===46||Le===45||Le===95)){if(Le===32||Le<14&&Le>8){P("missing attribute value"),Xe=je;continue e}if(Le===61)break;P("illegal attribute name char"),Dn=!0}if(Pt=Ct.substring(Xe,je),Pt==="xmlns:xmlns"&&(P("illegal declaration of xmlns"),Dn=!0),Le=Ct.charCodeAt(je+1),Le===34)je=Ct.indexOf('"',Xe=je+2),je===-1&&(je=Ct.indexOf("'",Xe),je!==-1&&(P("attribute value quote missmatch"),Dn=!0));else if(Le===39)je=Ct.indexOf("'",Xe=je+2),je===-1&&(je=Ct.indexOf('"',Xe),je!==-1&&(P("attribute value quote missmatch"),Dn=!0));else for(P("missing attribute value quotes"),Dn=!0,je=je+1;je<nn&&(Le=Ct.charCodeAt(je+1),!(Le===32||Le<14&&Le>8));je++);for(je===-1&&(P("missing closing quotes"),je=nn,Dn=!0),Dn||(Un=Ct.substring(Xe,je)),Xe=je;je+1<nn&&(Le=Ct.charCodeAt(je+1),!(Le===32||Le<14&&Le>8));je++)Xe===je&&(P("illegal character after attribute end"),Dn=!0);if(Xe=je+1,Dn)continue e;if(Na.has(Pt)){P("attribute <"+Pt+"> already defined");continue}if(Na.add(Pt),!g){Zn[Pt]=Un;continue}if(m){if(ln=Pt==="xmlns"?"xmlns":Pt.charCodeAt(0)===120&&Pt.substr(0,6)==="xmlns:"?Pt.substr(6):null,ln!==null){if(We=br(Un),Ot=yu(ln),kn=T[We],!kn){if(ln==="xmlns"||Ot in x&&x[Ot]!==We)do kn="ns"+Y++;while(typeof x[kn]<"u");else kn=ln;T[We]=kn}x[ln]!==kn&&(Fr||(x=P0(x),Fr=!0),x[ln]=kn,ln==="xmlns"&&(x[yu(kn)]=We,$t=kn),x[Ot]=We),Zn[Pt]=Un;continue}tn.push(Pt,Un);continue}Pt=ie(Pt,$t),Pt!==null&&(Zn[Pt]=Un)}if(m)for(Xe=0,nn=tn.length;Xe<nn;Xe++)Pt=ie(tn[Xe++],$t),Un=tn[Xe],Pt!==null&&(Zn[Pt]=Un);return z=Zn}function Oe(){for(var We=/(\r\n|\r|\n)/g,Ot=0,$t=0,tn=0,Xe=se,Ct,nn;ae>=tn&&(Ct=We.exec(L),!(!Ct||(Xe=Ct[0].length+Ct.index,Xe>ae)));)Ot+=1,tn=Xe;return ae==-1?($t=Xe,nn=L.substring(se)):se===0?nn=L.substring(se,ae):($t=ae-tn,nn=se==-1?L.substring(ae):L.substring(ae,se+1)),{data:nn,line:Ot,column:$t}}for(p=Oe,t&&(v=Object.create({},{name:za(function(){return C}),originalName:za(function(){return _}),attrs:za(_e),ns:za(function(){return x})}));se!==-1;){if(L.charCodeAt(se)===60?ae=se:ae=L.indexOf("<",se),ae===-1){if(H)return L.substring(se);if(w.length)return I("unexpected end of file");if(!d)return I("missing start tag");se<L.length&&L.substring(se).trim()&&P(jf);return}if(d||(d=!0),se!==ae){if(w.length){if(n&&(n(L.substring(se,ae),br,p),E))return}else if(L.substring(se,ae).trim()&&(P(jf),E))return}if(V=L.charCodeAt(ae+1),V===33){if(N=L.charCodeAt(ae+2),N===91&&L.substr(ae+3,6)==="CDATA["){if(se=L.indexOf("]]>",ae),se===-1)return H?L.substring(ae):I("unclosed cdata");if(o&&(o(L.substring(ae+9,se),p),E))return;se+=3;continue}if(N===45&&L.charCodeAt(ae+3)===45){if(se=L.indexOf("-->",ae),se===-1)return H?L.substring(ae):I("unclosed comment");if(c&&(c(L.substring(ae+4,se),br,p),E))return;se+=3;continue}}if(V===63){if(se=L.indexOf("?>",ae),se===-1)return H?L.substring(ae):I("unclosed question");if(u&&(u(L.substring(ae,se+2),p),E))return;se+=2;continue}for(Z=ae+1;;Z++){if(we=L.charCodeAt(Z),isNaN(we))return H?L.substring(ae):(se=-1,I("unclosed tag"));if(we===34)N=L.indexOf('"',Z+1),Z=N!==-1?N:Z;else if(we===39)N=L.indexOf("'",Z+1),Z=N!==-1?N:Z;else if(we===62){se=Z;break}}if(V===33){if(l&&(l(L.substring(ae,se+1),br,p),E))return;se+=1;continue}if(z={},V===47){if(re=!1,le=!0,!w.length)return I("missing open tag");if(Z=C=w.pop(),N=ae+2+Z.length,L.substring(ae+2,N)!==Z)return I("closing tag mismatch");for(;N<se;N++)if(V=L.charCodeAt(N),!(V===32||V>8&&V<14))return I("close tag")}else{if(L.charCodeAt(se-1)===47?(Z=C=L.substring(ae+1,se-1),re=!0,le=!0):(Z=C=L.substring(ae+1,se),re=!0,le=!1),!(V>96&&V<123||V>64&&V<91||V===95||V===58))return I("illegal first char nodeName");for(N=1,$=Z.length;N<$;N++)if(V=Z.charCodeAt(N),!(V>96&&V<123||V>64&&V<91||V>47&&V<59||V===45||V===95||V==46)){if(V===32||V<14&&V>8){C=Z.substring(0,N),z=null;break}return I("invalid nodeName")}le||w.push(C)}if(g){ot=x,re&&(le||b.push(ot),z===null&&(m=Z.indexOf("xmlns",N)!==-1)&&(O=N,k=Z,_e(),m=!1)),_=C,Te!==x&&(oe=x[Ff],oe===void 0&&(oe=x[Ff]=Object.create(null)),Te=x);var ft=oe[C];if(ft!==void 0)C=ft;else{if(V=C.indexOf(":"),V!==-1){if(vt=x[C.substring(0,V)],!vt)return I("missing namespace on <"+_+">");C=C.substr(V+1)}else vt=x.xmlns;vt&&(C=vt+":"+C),oe[_]=C}}if(re&&(O=N,k=Z,i&&(t?i(v,br,le,p):i(C,_e,br,le,p),E)))return;if(le){if(r&&(r(t?v:C,br,re,p),E))return;g&&(re?x=ot:x=b.pop())}se+=1}}}function zf(e){return e.xml&&e.xml.tagAlias==="lowerCase"}var _u={xsi:"http://www.w3.org/2001/XMLSchema-instance",xml:"http://www.w3.org/XML/1998/namespace"},Vf="property";function Gf(e){return e.xml&&e.xml.serialize}function M0(e){const t=Gf(e);return t!==Vf&&(t||null)}function k0(e){return e.charAt(0).toUpperCase()+e.slice(1)}function Wf(e,t){return zf(t)?e.prefix+":"+k0(e.localName):e.name}function D0(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 O0(e,t,n){const i=Xt(e,t.xmlns),r=`${t[i.prefix]||i.prefix}:${i.localName}`,o=Xt(r);var a=n.getPackage(o.prefix);return D0(o,a)}function $i(e){return new Error(e)}function vi(e){return e.$descriptor}function I0(e){D(this,e),this.elementsById={},this.references=[],this.warnings=[],this.addReference=function(t){this.references.push(t)},this.addElement=function(t){if(!t)throw $i("expected element");var n=this.elementsById,i=vi(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 $i("duplicate ID <"+o+">");n[o]=t}},this.addWarning=function(t){this.warnings.push(t)}}function ko(){}ko.prototype.handleEnd=function(){},ko.prototype.handleText=function(){},ko.prototype.handleNode=function(){};function bu(){}bu.prototype=Object.create(ko.prototype),bu.prototype.handleNode=function(){return this};function Ur(){}Ur.prototype=Object.create(ko.prototype),Ur.prototype.handleText=function(e){this.body=(this.body||"")+e};function Do(e,t){this.property=e,this.context=t}Do.prototype=Object.create(Ur.prototype),Do.prototype.handleNode=function(e){if(this.element)throw $i("expected no sub nodes");return this.element=this.createReference(e),this},Do.prototype.handleEnd=function(){this.element.id=this.body},Do.prototype.createReference=function(e){return{property:this.property.ns.name,id:""}};function xu(e,t){this.element=t,this.propertyDesc=e}xu.prototype=Object.create(Ur.prototype),xu.prototype.handleEnd=function(){var e=this.body||"",t=this.element,n=this.propertyDesc;e=mu(n.type,e),n.isMany?t.get(n.name).push(e):t.set(n.name,e)};function Ga(){}Ga.prototype=Object.create(Ur.prototype),Ga.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 an(e,t,n){this.model=e,this.type=e.getType(t),this.context=n}an.prototype=Object.create(Ga.prototype),an.prototype.addReference=function(e){this.context.addReference(e)},an.prototype.handleText=function(e){var t=this.element,n=vi(t),i=n.bodyProperty;if(!i)throw $i("unexpected body text <"+e+">");Ur.prototype.handleText.call(this,e)},an.prototype.handleEnd=function(){var e=this.body,t=this.element,n=vi(t),i=n.bodyProperty;i&&e!==void 0&&(e=mu(i.type,e),t.set(i.name,e))},an.prototype.createElement=function(e){var t=e.attributes,n=this.type,i=vi(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=mu(l.type,c):u==="xmlns"?u=":"+u:(s=Xt(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},an.prototype.getPropertyForNode=function(e){var t=e.name,n=Xt(t),i=this.type,r=this.model,o=vi(i),a=n.name,s=o.propertiesByName[a];if(s&&!s.isAttr){const u=M0(s);if(u){const l=e.attributes[u];if(l){const p=O0(l,e.ns,r),f=r.getType(p);return D({},s,{effectiveType:vi(f).name})}}return s}var c=r.getPackage(n.prefix);if(c){const u=Wf(n,c),l=r.getType(u);if(s=Ke(o.properties,function(p){return!p.isVirtual&&!p.isReference&&!p.isAttribute&&l.hasType(p.type)}),s)return D({},s,{effectiveType:vi(l).name})}else if(s=Ke(o.properties,function(u){return!u.isReference&&!u.isAttribute&&u.type==="Element"}),s)return s;throw $i("unrecognized element <"+n.name+">")},an.prototype.toString=function(){return"ElementDescriptor["+vi(this.type).name+"]"},an.prototype.valueHandler=function(e,t){return new xu(e,t)},an.prototype.referenceHandler=function(e){return new Do(e,this.context)},an.prototype.handler=function(e){return e==="Element"?new qr(this.model,e,this.context):new an(this.model,e,this.context)},an.prototype.handleChild=function(e){var t,n,i,r;if(t=this.getPropertyForNode(e),i=this.element,n=t.effectiveType||t.type,Lf(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?(D(o,{element:i}),this.context.addReference(o)):o.$parent=i),r};function Eu(e,t,n){an.call(this,e,t,n)}Eu.prototype=Object.create(an.prototype),Eu.prototype.createElement=function(e){var t=e.name,n=Xt(t),i=this.model,r=this.type,o=i.getPackage(n.prefix),a=o&&Wf(n,o)||t;if(!r.hasType(a))throw $i("unexpected element <"+e.originalName+">");return an.prototype.createElement.call(this,e)};function qr(e,t,n){this.model=e,this.context=n}qr.prototype=Object.create(Ga.prototype),qr.prototype.createElement=function(e){var t=e.name,n=Xt(t),i=n.prefix,r=e.ns[i+"$uri"],o=e.attributes;return this.model.createAny(t,r,o)},qr.prototype.handleChild=function(e){var t=new qr(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},qr.prototype.handleEnd=function(){this.body&&(this.element.$body=this.body)};function wu(e){e instanceof On&&(e={model:e}),D(this,{lax:!1},e)}wu.prototype.fromXML=function(e,t,n){var i=t.rootHandler;t instanceof an?(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 I0(D({},t,{rootHandler:i})),s=new Hf({proxy:!0}),c=L0();i.context=a,c.push(i);function u(w,T,I){var P=T(),j=P.line,F=P.column,L=P.data;L.charAt(0)==="<"&&L.indexOf(" ")!==-1&&(L=L.slice(0,L.indexOf(" "))+">");var H="unparsable content "+(L?L+" ":"")+`detected
|
|
1
|
+
(function(Q,xt){typeof exports=="object"&&typeof module<"u"?xt(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],xt):(Q=typeof globalThis<"u"?globalThis:Q||self,xt(Q.BpmnModeler={},Q.Vue))})(this,(function(Q,xt){"use strict";var hD=Object.defineProperty;var mD=(Q,xt,yi)=>xt in Q?hD(Q,xt,{enumerable:!0,configurable:!0,writable:!0,value:yi}):Q[xt]=yi;var zr=(Q,xt,yi)=>mD(Q,typeof xt!="symbol"?xt+"":xt,yi);const yi=["startEvent","endEvent","userTask","serviceTask","task","sendTask","receiveTask","exclusiveGateway","parallelGateway"];function Rf(e){return yi.includes(e)}const Cf="http://g1project.net/spec/bpmn/bwl/1.0",cu="bwl",uu=["top-left","top","top-right","right","bottom-right","bottom","bottom-left","left"],Pf={name:"bwl-hints",uri:Cf,prefix:cu,xml:{tagAlias:"lowerCase"},types:[{name:"Placement",superClass:["Element"],properties:[{name:"anchor",isAttr:!0,type:"String"},{name:"side",isAttr:!0,type:"String"},{name:"offset",isAttr:!0,type:"Real"}]},{name:"Members",superClass:["Element"],properties:[{name:"refs",isAttr:!0,type:"String"}]},{name:"BandHint",extends:["bpmn:FlowNode"],properties:[{name:"band",isAttr:!0,type:"Integer"}]},{name:"PoolOrderHint",extends:["bpmn:Participant"],properties:[{name:"poolOrder",isAttr:!0,type:"Integer"}]}]},lu="bwl.undoEpisode",Af=new WeakSet;function Zb(e){Af.has(e)||(e.register(lu,{preExecute(t){try{t.run()}catch(n){t.error=n}}}),Af.add(e))}function Tf(e,t){Zb(e);const n={run:t};if(e.execute(lu,n),n.error!==void 0)throw e.canUndo()&&e.undo(),n.error}const Mf=["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"],Qb={description:"생략 = 보존, null = 제거.",anyOf:[{type:"string"},{type:"null"}]},Jb={type:"object",description:"레인. 배열 선언 순서 = 풀 내 상→하 순서.",properties:{id:{type:"string"},name:{type:"string"}},required:["id"],additionalProperties:!1},ex={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},tx={type:"object",description:"플로우 노드. 좌표는 지정하지 않는다 — 배치는 resolver 가 결정한다.",properties:{id:{type:"string"},type:{type:"string",enum:[...yi]},name:{type:"string"},participant:{type:"string",description:"소속 풀 id(협업 문서)."},lane:{type:"string",description:"소속 레인 id(풀 정의에 선언된 것)."}},required:["id","type"],additionalProperties:!1},nx={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},rx={type:"object",description:"메시지 플로우(풀 경계를 넘는 연결 — 노드 또는 블랙박스 풀 자체가 끝점).",properties:{id:{type:"string"},source:{type:"string"},target:{type:"string"},name:{type:"string"}},required:["id","source","target"],additionalProperties:!1},ox={type:"object",properties:{id:{type:"string"},name:{type:"string"}},required:["id"],additionalProperties:!1},ax={type:"object",description:"데이터 입출력 연관. 방향 = source→target(태스크→스토어 = 쓰기, 스토어→태스크 = 읽기).",properties:{id:{type:"string"},source:{type:"string"},target:{type:"string"}},required:["source","target"],additionalProperties:!1},sx={type:"object",properties:{id:{type:"string"},text:{type:"string"}},required:["id","text"],additionalProperties:!1},cx={type:"object",description:"연관선(주석 ↔ 요소).",properties:{id:{type:"string"},source:{type:"string"},target:{type:"string"}},required:["source","target"],additionalProperties:!1},ux={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},lx={type:"object",description:"주석 방위 힌트 — 앵커 요소 기준 상대 배치. 있으면 결정적 배치, 없으면 휴리스틱.",properties:{anchor:{type:"string",description:"기준 요소 id."},side:{type:"string",enum:[...uu]},offset:{type:"number"}},required:["anchor","side"],additionalProperties:!1};function Xt(e,t){return{type:"object",description:t.description,properties:{kind:{const:e},...t.properties},required:["kind",...t.required??[]],additionalProperties:!1}}const px={"participant.add":Xt("participant.add",{description:"풀 추가. order = 풀 세로 순서 힌트(생략 시 op 순서가 곧 배치 순서).",properties:{participant:{$ref:"#/$defs/irParticipant"},order:{type:"integer"}},required:["participant"]}),"participant.update":Xt("participant.update",{description:"풀 이름/레인 갱신. lanes 는 전체 재선언(생략 = 보존) — 기존 레인을 유지하려면 함께 다시 나열한다.",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"},lanes:{type:"array",items:{$ref:"#/$defs/irLane"}}},required:["id"]}),"node.add":Xt("node.add",{description:'플로우 노드 추가. band = 가로 밴드 순번 힌트(주 흐름 0, 갈래 1, 2…) — 위/아래가 아니라 "주 흐름에서 몇 번째 갈래"다. 행 배치(어느 갈래가 위/아래인지)는 호스트가 정한다(대칭·메시지 방향). 레인이 있으면 그 레인 안의 밴드다 — 한 레인 안에서 게이트웨이 출구를 갈라 놓을 때 쓴다. 컨테이너(풀·레인)는 밴드 수만큼 자란다.',properties:{node:{$ref:"#/$defs/irNode"},band:{type:"integer"}},required:["node"]}),"node.update":Xt("node.update",{description:"노드 이름/레인/타입 갱신. lane = 레인 재배정(이동), type = 태스크·이벤트 타입 전환.",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"},lane:{type:"string"},type:{type:"string",enum:[...yi]}},required:["id"]}),"sequenceFlow.add":Xt("sequenceFlow.add",{description:"시퀀스 플로우 추가. 분기 조건은 게이트웨이가 아닌 플로우의 condition 에 싣는다.",properties:{flow:{$ref:"#/$defs/irSequenceFlow"}},required:["flow"]}),"sequenceFlow.update":Xt("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":Xt("messageFlow.add",{description:"메시지 플로우 추가(풀 경계를 넘는 연결).",properties:{flow:{$ref:"#/$defs/irMessageFlow"}},required:["flow"]}),"messageFlow.update":Xt("messageFlow.update",{description:"메시지 플로우 이름 갱신.",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"}},required:["id"]}),"dataStore.add":Xt("dataStore.add",{description:"데이터 스토어 추가(+ 입출력 연관 동반 가능).",properties:{dataStore:{$ref:"#/$defs/irDataStore"},associations:{type:"array",items:{$ref:"#/$defs/irDataAssociation"}}},required:["dataStore"]}),"dataStore.update":Xt("dataStore.update",{description:"데이터 스토어 이름 갱신.",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"}},required:["id"]}),"dataAssociation.add":Xt("dataAssociation.add",{description:"기존 노드 ↔ 기존 데이터 스토어의 입출력 연관 추가.",properties:{association:{$ref:"#/$defs/irDataAssociation"}},required:["association"]}),"association.add":Xt("association.add",{description:"주석 ↔ 요소 연관 추가(한쪽 끝은 주석). 주석 신설과 함께면 annotation.add 의 association 을 쓰고, 이 op 는 추가 연관(한 주석에 여러 연관)용.",properties:{association:{$ref:"#/$defs/irAssociation"}},required:["association"]}),"annotation.add":Xt("annotation.add",{description:"텍스트 주석 추가. association 으로 대상 요소와 연결하고, placement 로 방위를 지정하면 결정적 배치된다.",properties:{annotation:{$ref:"#/$defs/irTextAnnotation"},association:{$ref:"#/$defs/irAssociation"},placement:{$ref:"#/$defs/bwlPlacement"}},required:["annotation"]}),"annotation.update":Xt("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":Xt("group.add",{description:"그룹 추가 — 바운즈는 members 의 bbox 로 산출되므로 좌표를 지정하지 않는다.",properties:{group:{$ref:"#/$defs/irGroup"}},required:["group"]}),"group.update":Xt("group.update",{description:"그룹 이름/멤버 갱신. members 는 전체 재선언(생략 = 보존).",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"},members:{type:"array",items:{type:"string"}}},required:["id"]}),"element.remove":Xt("element.remove",{description:"요소 제거(카테고리 무관). 부착된 연결선은 함께 제거된다.",properties:{id:{type:"string"}},required:["id"]})},kf={anyOf:Mf.map(e=>px[e])},fx={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:Jb,irParticipant:ex,irNode:tx,irFlowCondition:nx,irSequenceFlow:ix,irMessageFlow:rx,irDataStore:ox,irDataAssociation:ax,irTextAnnotation:sx,irAssociation:cx,irGroup:ux,bwlPlacement:lx,nullableString:Qb,symbolicOp:kf}};function pu(e){return Array.prototype.concat.apply([],e)}const Mo=Object.prototype.toString,dx=Object.prototype.hasOwnProperty;function vr(e){return e===void 0}function Mt(e){return e!==void 0}function Vr(e){return e==null}function pe(e){return Mo.call(e)==="[object Array]"}function Nt(e){return Mo.call(e)==="[object Object]"}function me(e){return Mo.call(e)==="[object Number]"}function Bt(e){const t=Mo.call(e);return t==="[object Function]"||t==="[object AsyncFunction]"||t==="[object GeneratorFunction]"||t==="[object AsyncGeneratorFunction]"||t==="[object Proxy]"}function gn(e){return Mo.call(e)==="[object String]"}function hx(e){if(!pe(e))throw new Error("must supply array")}function vn(e,t){return!Vr(e)&&dx.call(e,t)}function et(e,t){const n=Ha(t);let i;return M(e,function(r,o){if(n(r,o))return i=r,!1}),i}function Df(e,t){const n=Ha(t);let i=pe(e)?-1:void 0;return M(e,function(r,o){if(n(r,o))return i=o,!1}),i}function Ae(e,t){const n=Ha(t);let i=[];return M(e,function(r,o){n(r,o)&&i.push(r)}),i}function M(e,t){let n,i;if(vr(e))return;const r=pe(e)?_x:yx;for(let o in e)if(vn(e,o)&&(n=e[o],i=t(n,r(o)),i===!1))return n}function mx(e,t){if(vr(e))return[];hx(e);const n=Ha(t);return e.filter(function(i,r){return!n(i,r)})}function yn(e,t,n){return M(e,function(i,r){n=t(n,i,r)}),n}function yr(e,t){return!!yn(e,function(n,i,r){return n&&t(i,r)},!0)}function Ni(e,t){return!!et(e,t)}function Zt(e,t){let n=[];return M(e,function(i,r){n.push(t(i,r))}),n}function Fa(e){return e&&Object.keys(e)||[]}function gx(e){return Fa(e).length}function Gr(e){return Zt(e,t=>t)}function Wr(e,t,n={}){return t=fu(t),M(e,function(i){let r=t(i)||"_",o=n[r];o||(o=n[r]=[]),o.push(i)}),n}function Of(e,...t){e=fu(e);let n={};return M(t,r=>Wr(r,e,n)),Zt(n,function(r,o){return r[0]})}const vx=Of;function ei(e,t){t=fu(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)}),Zt(n,i=>i.v)}function Ur(e){return function(t){return yr(e,function(n,i){return t[i]===n})}}function fu(e){return Bt(e)?e:t=>t[e]}function Ha(e){return Bt(e)?e:t=>t===e}function yx(e){return e}function _x(e){return Number(e)}function du(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 dn(e,t){return e.bind(t)}function D(e,...t){return Object.assign(e,...t)}function bx(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];Mt(a)&&Vr(s)&&(s=i[r]=isNaN(+a)?{}:[]),vr(a)?vr(n)?delete i[r]:i[r]=n:i=s}),e}function Xn(e,t){let n={},i=Object(e);return M(t,function(r){r in i&&(n[r]=e[r])}),n}function ti(e,t){let n={},i=Object(e);return M(i,function(r,o){t.indexOf(o)===-1&&(n[o]=r)}),n}function hu(){}hu.prototype.get=function(e){return this.$model.properties.get(this,e)},hu.prototype.set=function(e,t){this.$model.properties.set(this,e,t)};function If(e,t){this.model=e,this.properties=t}If.prototype.createType=function(e){var t=this.model,n=this.properties,i=Object.create(hu.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,dn(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 xx=D(Object.create(null),{String:!0,Boolean:!0,Integer:!0,Real:!0,Element:!0}),Lf=D(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 mu(e,t){var n=Lf[e];return n?n(t):t}function gu(e){return!!xx[e]}function Nf(e){return!!Lf[e]}function Qt(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 An(e){this.ns=e,this.name=e.name,this.allTypes=[],this.allTypesByName=Object.create(null),this.properties=[],this.propertiesByName=Object.create(null)}An.prototype.build=function(){return Xn(this,["ns","name","allTypes","allTypesByName","properties","propertiesByName","bodyProperty","idProperty"])},An.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)},An.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},An.prototype.redefineProperty=function(e,t,n){var i=e.ns.prefix,r=t.split("#"),o=Qt(r[0],i),a=Qt(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},An.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},An.prototype.removeNamedProperty=function(e){var t=e.ns,n=this.propertiesByName;delete n[t.name],delete n[t.localName]},An.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},An.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},An.prototype.assertNotTrait=function(e){if((e.extends||[]).length)throw new Error(`cannot create <${e.name}> extending <${e.extends}>`)},An.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")},An.prototype.hasProperty=function(e){return this.propertiesByName[e]},An.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,dn(function(o){o=D({},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 Bi(e,t){this.packageMap=Object.create(null),this.typeMap=Object.create(null),this.packages=[],this.properties=t,M(e,dn(this.registerPackage,this))}Bi.prototype.getPackage=function(e){return this.packageMap[e]},Bi.prototype.getPackages=function(){return this.packages},Bi.prototype.registerPackage=function(e){e=D({},e);var t=this.packageMap;Bf(t,e,"prefix"),Bf(t,e,"uri"),M(e.types,dn(function(n){this.registerType(n,e)},this)),t[e.uri]=t[e.prefix]=e,this.packages.push(e)},Bi.prototype.registerType=function(e,t){e=D({},e,{superClass:(e.superClass||[]).slice(),extends:(e.extends||[]).slice(),properties:(e.properties||[]).slice(),meta:D({},e.meta||{})});var n=Qt(e.name,t.prefix),i=n.name,r=Object.create(null);M(e.properties,dn(function(o){var a=Qt(o.name,n.prefix),s=a.name;gu(o.type)||(o.type=Qt(o.type,a.prefix).name),D(o,{ns:a,name:s}),r[s]=o},this)),D(e,{ns:n,name:i,propertiesByName:r}),M(e.extends,dn(function(o){var a=Qt(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},Bi.prototype.mapTypes=function(e,t,n){var i=gu(e.name)?{name:e.name}:this.typeMap[e.name],r=this;function o(c,u){var l=Qt(c,gu(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)},Bi.prototype.getEffectiveDescriptor=function(e){var t=Qt(e),n=new An(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},Bi.prototype.definePackage=function(e,t){this.properties.define(e,"$pkg",{value:t})};function Bf(e,t,n){var i=t[n];if(i in e)throw new Error("package with "+n+" <"+i+"> already defined")}function _r(e){this.model=e}_r.prototype.set=function(e,t,n){if(!gn(t)||!t.length)throw new TypeError("property name must be a non-empty string");var i=this.getProperty(e,t),r=i&&i.name;Ex(n)?i?delete e[r]:delete e.$attrs[vu(t)]:i?r in e?e[r]=n:$f(e,i,n):e.$attrs[vu(t)]=n},_r.prototype.get=function(e,t){var n=this.getProperty(e,t);if(!n)return e.$attrs[vu(t)];var i=n.name;return!e[i]&&n.isMany&&$f(e,n,[]),e[i]},_r.prototype.define=function(e,t,n){if(!n.writable){var i=n.value;n=D({},n,{get:function(){return i}}),delete n.value}Object.defineProperty(e,t,n)},_r.prototype.defineDescriptor=function(e,t){this.define(e,"$descriptor",{value:t})},_r.prototype.defineModel=function(e,t){this.define(e,"$model",{value:t})},_r.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 Ex(e){return typeof e>"u"}function $f(e,t,n){Object.defineProperty(e,t.name,{enumerable:!t.isReference,writable:!0,value:n,configurable:!0})}function vu(e){return e.replace(/^:/,"")}function Ln(e,t={}){this.properties=new _r(this),this.factory=new If(this,this.properties),this.registry=new Bi(e,this.properties),this.typeCache=Object.create(null),this.config=t}Ln.prototype.create=function(e,t){var n=this.getType(e);if(!n)throw new Error("unknown type <"+e+">");return new n(t)},Ln.prototype.getType=function(e){var t=this.typeCache,n=gn(e)?e:e.ns.name,i=t[n];return i||(e=this.registry.getEffectiveDescriptor(n),i=t[n]=this.factory.createType(e)),i},Ln.prototype.createAny=function(e,t,n){var i=Qt(e),r={$type:e,$instanceOf:function(a){return a===this.$type},get:function(a){return this[a]},set:function(a,s){bx(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){Nt(a)&&a.value!==void 0?r[a.name]=a.value:r[s]=a}),r},Ln.prototype.getPackage=function(e){return this.registry.getPackage(e)},Ln.prototype.getPackages=function(){return this.registry.getPackages()},Ln.prototype.getElementDescriptor=function(e){return e.$descriptor},Ln.prototype.hasType=function(e,t){t===void 0&&(t=e,e=this);var n=e.$model.getElementDescriptor(e);return t in n.allTypesByName},Ln.prototype.getPropertyDescriptor=function(e,t){return this.getElementDescriptor(e).propertiesByName[t]},Ln.prototype.getTypeDescriptor=function(e){return this.registry.typeMap[e]};var jf=String.fromCharCode,wx=Object.prototype.hasOwnProperty,Sx=/&#(\d+);|&#x([0-9a-f]+);|&(\w+);/ig,ko={amp:"&",apos:"'",gt:">",lt:"<",quot:'"'};Object.keys(ko).forEach(function(e){ko[e.toUpperCase()]=ko[e]});function Rx(e,t,n,i){return i?wx.call(ko,i)?ko[i]:"&"+i+";":jf(t||parseInt(n,16))}function br(e){return e.length>3&&e.indexOf("&")!==-1?e.replace(Sx,Rx):e}var Ff="non-whitespace outside of root node";function $i(e){return new Error(e)}function Cx(e){return"missing namespace for prefix <"+e+">"}function za(e){return{get:e,enumerable:!0}}function Px(e){var t=Object.create(null),n;for(n in e)t[n]=e[n];return t}var Hf=Symbol("nameCache");function yu(e){return e+"$uri"}function Ax(e){var t=Object.create(null),n,i;for(n in e)i=e[n],t[i]=i,t[yu(i)]=n;return t}function Va(){return{line:0,column:0}}function Tx(e){throw e}function zf(e){if(!this)return new zf(e);var t=e&&e.proxy,n,i,r,o,a=Tx,s,c,u,l,p=Va,f=!1,d=!1,h="",m=!1,g=!1,S=null,E=!1,b,x,w,T;function I(L){L instanceof Error||(L=$i(L)),S=L,a(L,p)}function P(L){s&&(L instanceof Error||(L=$i(L)),s(L,p))}this.on=function(L,H){if(typeof H!="function")throw $i("required args <name, cb>");switch(L){case"openTag":i=H;break;case"text":n=H;break;case"closeTag":r=H;break;case"error":a=H;break;case"warn":s=H;break;case"cdata":o=H;break;case"attention":l=H;break;case"question":u=H;break;case"comment":c=H;break;default:throw $i("unsupported event: "+L)}return this},this.ns=function(L){if(typeof L>"u"&&(L={}),typeof L!="object")throw $i("required args <nsMap={}>");var H=Object.create(null),oe;for(oe in L)H[oe]=L[oe];return g=!0,T=H,this};function j(){b=g?[]:null,x=g?Ax(T):null,w=[],p=Va,E=!1,S=null,d=!1,h=""}this.parse=function(L){if(typeof L!="string")throw $i("required args <xml=string>");if(f)throw $i("parse during stream; call end() first");return j(),F(L),p=Va,E=!1,S},this.write=function(L){if(typeof L!="string")throw $i("required args <xml=string>");return f||(j(),f=!0),S||(h=F(h+L,!0)||""),this},this.end=function(){return f||j(),f=!1,S||F(h),h="",p=Va,E=!1,S},this.stop=function(){E=!0};function F(L,H=!1){var oe=null,De=null,ct,Y=0,re=!1,le=!1,ae=0,se=0,Z,$,N,V,Re,bt,C,_,v,k="",O=0,z;function ie(Ye,Lt){var Ft=Ye.indexOf(":");if(Ft===-1)return Ye;var rn=x[Ye.substring(0,Ft)];return rn?Lt===rn?Ye.substr(Ft+1):rn+Ye.substr(Ft):(P(Cx(Ye.substring(0,Ft))),null)}function be(){if(z!==null)return z;var Ye,Lt,Ft=g&&x.xmlns,rn=g&&m?[]:null,tt=O,At=k,on=At.length,Fr,fn,Kn,Dn,Tt,Jn={},Ba=new Set,On,$e,Ge;e:for(;tt<on;tt++)if(On=!1,$e=At.charCodeAt(tt),!($e===32||$e<14&&$e>8)){for(($e<65||$e>122||$e>90&&$e<97)&&$e!==95&&$e!==58&&(P("illegal first char attribute name"),On=!0),Ge=tt+1;Ge<on;Ge++)if($e=At.charCodeAt(Ge),!($e>96&&$e<123||$e>64&&$e<91||$e>47&&$e<59||$e===46||$e===45||$e===95)){if($e===32||$e<14&&$e>8){P("missing attribute value"),tt=Ge;continue e}if($e===61)break;P("illegal attribute name char"),On=!0}if(Tt=At.substring(tt,Ge),Tt==="xmlns:xmlns"&&(P("illegal declaration of xmlns"),On=!0),$e=At.charCodeAt(Ge+1),$e===34)Ge=At.indexOf('"',tt=Ge+2),Ge===-1&&(Ge=At.indexOf("'",tt),Ge!==-1&&(P("attribute value quote missmatch"),On=!0));else if($e===39)Ge=At.indexOf("'",tt=Ge+2),Ge===-1&&(Ge=At.indexOf('"',tt),Ge!==-1&&(P("attribute value quote missmatch"),On=!0));else for(P("missing attribute value quotes"),On=!0,Ge=Ge+1;Ge<on&&($e=At.charCodeAt(Ge+1),!($e===32||$e<14&&$e>8));Ge++);for(Ge===-1&&(P("missing closing quotes"),Ge=on,On=!0),On||(Kn=At.substring(tt,Ge)),tt=Ge;Ge+1<on&&($e=At.charCodeAt(Ge+1),!($e===32||$e<14&&$e>8));Ge++)tt===Ge&&(P("illegal character after attribute end"),On=!0);if(tt=Ge+1,On)continue e;if(Ba.has(Tt)){P("attribute <"+Tt+"> already defined");continue}if(Ba.add(Tt),!g){Jn[Tt]=Kn;continue}if(m){if(fn=Tt==="xmlns"?"xmlns":Tt.charCodeAt(0)===120&&Tt.substr(0,6)==="xmlns:"?Tt.substr(6):null,fn!==null){if(Ye=br(Kn),Lt=yu(fn),Dn=T[Ye],!Dn){if(fn==="xmlns"||Lt in x&&x[Lt]!==Ye)do Dn="ns"+Y++;while(typeof x[Dn]<"u");else Dn=fn;T[Ye]=Dn}x[fn]!==Dn&&(Fr||(x=Px(x),Fr=!0),x[fn]=Dn,fn==="xmlns"&&(x[yu(Dn)]=Ye,Ft=Dn),x[Lt]=Ye),Jn[Tt]=Kn;continue}rn.push(Tt,Kn);continue}Tt=ie(Tt,Ft),Tt!==null&&(Jn[Tt]=Kn)}if(m)for(tt=0,on=rn.length;tt<on;tt++)Tt=ie(rn[tt++],Ft),Kn=rn[tt],Tt!==null&&(Jn[Tt]=Kn);return z=Jn}function Ne(){for(var Ye=/(\r\n|\r|\n)/g,Lt=0,Ft=0,rn=0,tt=se,At,on;ae>=rn&&(At=Ye.exec(L),!(!At||(tt=At[0].length+At.index,tt>ae)));)Lt+=1,rn=tt;return ae==-1?(Ft=tt,on=L.substring(se)):se===0?on=L.substring(se,ae):(Ft=ae-rn,on=se==-1?L.substring(ae):L.substring(ae,se+1)),{data:on,line:Lt,column:Ft}}for(p=Ne,t&&(v=Object.create({},{name:za(function(){return C}),originalName:za(function(){return _}),attrs:za(be),ns:za(function(){return x})}));se!==-1;){if(L.charCodeAt(se)===60?ae=se:ae=L.indexOf("<",se),ae===-1){if(H)return L.substring(se);if(w.length)return I("unexpected end of file");if(!d)return I("missing start tag");se<L.length&&L.substring(se).trim()&&P(Ff);return}if(d||(d=!0),se!==ae){if(w.length){if(n&&(n(L.substring(se,ae),br,p),E))return}else if(L.substring(se,ae).trim()&&(P(Ff),E))return}if(V=L.charCodeAt(ae+1),V===33){if(N=L.charCodeAt(ae+2),N===91&&L.substr(ae+3,6)==="CDATA["){if(se=L.indexOf("]]>",ae),se===-1)return H?L.substring(ae):I("unclosed cdata");if(o&&(o(L.substring(ae+9,se),p),E))return;se+=3;continue}if(N===45&&L.charCodeAt(ae+3)===45){if(se=L.indexOf("-->",ae),se===-1)return H?L.substring(ae):I("unclosed comment");if(c&&(c(L.substring(ae+4,se),br,p),E))return;se+=3;continue}}if(V===63){if(se=L.indexOf("?>",ae),se===-1)return H?L.substring(ae):I("unclosed question");if(u&&(u(L.substring(ae,se+2),p),E))return;se+=2;continue}for(Z=ae+1;;Z++){if(Re=L.charCodeAt(Z),isNaN(Re))return H?L.substring(ae):(se=-1,I("unclosed tag"));if(Re===34)N=L.indexOf('"',Z+1),Z=N!==-1?N:Z;else if(Re===39)N=L.indexOf("'",Z+1),Z=N!==-1?N:Z;else if(Re===62){se=Z;break}}if(V===33){if(l&&(l(L.substring(ae,se+1),br,p),E))return;se+=1;continue}if(z={},V===47){if(re=!1,le=!0,!w.length)return I("missing open tag");if(Z=C=w.pop(),N=ae+2+Z.length,L.substring(ae+2,N)!==Z)return I("closing tag mismatch");for(;N<se;N++)if(V=L.charCodeAt(N),!(V===32||V>8&&V<14))return I("close tag")}else{if(L.charCodeAt(se-1)===47?(Z=C=L.substring(ae+1,se-1),re=!0,le=!0):(Z=C=L.substring(ae+1,se),re=!0,le=!1),!(V>96&&V<123||V>64&&V<91||V===95||V===58))return I("illegal first char nodeName");for(N=1,$=Z.length;N<$;N++)if(V=Z.charCodeAt(N),!(V>96&&V<123||V>64&&V<91||V>47&&V<59||V===45||V===95||V==46)){if(V===32||V<14&&V>8){C=Z.substring(0,N),z=null;break}return I("invalid nodeName")}le||w.push(C)}if(g){ct=x,re&&(le||b.push(ct),z===null&&(m=Z.indexOf("xmlns",N)!==-1)&&(O=N,k=Z,be(),m=!1)),_=C,De!==x&&(oe=x[Hf],oe===void 0&&(oe=x[Hf]=Object.create(null)),De=x);var mt=oe[C];if(mt!==void 0)C=mt;else{if(V=C.indexOf(":"),V!==-1){if(bt=x[C.substring(0,V)],!bt)return I("missing namespace on <"+_+">");C=C.substr(V+1)}else bt=x.xmlns;bt&&(C=bt+":"+C),oe[_]=C}}if(re&&(O=N,k=Z,i&&(t?i(v,br,le,p):i(C,be,br,le,p),E)))return;if(le){if(r&&(r(t?v:C,br,re,p),E))return;g&&(re?x=ct:x=b.pop())}se+=1}}}function Vf(e){return e.xml&&e.xml.tagAlias==="lowerCase"}var _u={xsi:"http://www.w3.org/2001/XMLSchema-instance",xml:"http://www.w3.org/XML/1998/namespace"},Gf="property";function Wf(e){return e.xml&&e.xml.serialize}function Mx(e){const t=Wf(e);return t!==Gf&&(t||null)}function kx(e){return e.charAt(0).toUpperCase()+e.slice(1)}function Uf(e,t){return Vf(t)?e.prefix+":"+kx(e.localName):e.name}function Dx(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 Ox(e,t,n){const i=Qt(e,t.xmlns),r=`${t[i.prefix]||i.prefix}:${i.localName}`,o=Qt(r);var a=n.getPackage(o.prefix);return Dx(o,a)}function ji(e){return new Error(e)}function _i(e){return e.$descriptor}function Ix(e){D(this,e),this.elementsById={},this.references=[],this.warnings=[],this.addReference=function(t){this.references.push(t)},this.addElement=function(t){if(!t)throw ji("expected element");var n=this.elementsById,i=_i(t),r=i.idProperty,o;if(r&&(o=t.get(r.name),o)){if(!/^([a-z][\w-.]*:)?[a-z_][\w-.]*$/i.test(o))throw new Error("illegal ID <"+o+">");if(n[o])throw ji("duplicate ID <"+o+">");n[o]=t}},this.addWarning=function(t){this.warnings.push(t)}}function Do(){}Do.prototype.handleEnd=function(){},Do.prototype.handleText=function(){},Do.prototype.handleNode=function(){};function bu(){}bu.prototype=Object.create(Do.prototype),bu.prototype.handleNode=function(){return this};function qr(){}qr.prototype=Object.create(Do.prototype),qr.prototype.handleText=function(e){this.body=(this.body||"")+e};function Oo(e,t){this.property=e,this.context=t}Oo.prototype=Object.create(qr.prototype),Oo.prototype.handleNode=function(e){if(this.element)throw ji("expected no sub nodes");return this.element=this.createReference(e),this},Oo.prototype.handleEnd=function(){this.element.id=this.body},Oo.prototype.createReference=function(e){return{property:this.property.ns.name,id:""}};function xu(e,t){this.element=t,this.propertyDesc=e}xu.prototype=Object.create(qr.prototype),xu.prototype.handleEnd=function(){var e=this.body||"",t=this.element,n=this.propertyDesc;e=mu(n.type,e),n.isMany?t.get(n.name).push(e):t.set(n.name,e)};function Ga(){}Ga.prototype=Object.create(qr.prototype),Ga.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 cn(e,t,n){this.model=e,this.type=e.getType(t),this.context=n}cn.prototype=Object.create(Ga.prototype),cn.prototype.addReference=function(e){this.context.addReference(e)},cn.prototype.handleText=function(e){var t=this.element,n=_i(t),i=n.bodyProperty;if(!i)throw ji("unexpected body text <"+e+">");qr.prototype.handleText.call(this,e)},cn.prototype.handleEnd=function(){var e=this.body,t=this.element,n=_i(t),i=n.bodyProperty;i&&e!==void 0&&(e=mu(i.type,e),t.set(i.name,e))},cn.prototype.createElement=function(e){var t=e.attributes,n=this.type,i=_i(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=mu(l.type,c):u==="xmlns"?u=":"+u:(s=Qt(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},cn.prototype.getPropertyForNode=function(e){var t=e.name,n=Qt(t),i=this.type,r=this.model,o=_i(i),a=n.name,s=o.propertiesByName[a];if(s&&!s.isAttr){const u=Mx(s);if(u){const l=e.attributes[u];if(l){const p=Ox(l,e.ns,r),f=r.getType(p);return D({},s,{effectiveType:_i(f).name})}}return s}var c=r.getPackage(n.prefix);if(c){const u=Uf(n,c),l=r.getType(u);if(s=et(o.properties,function(p){return!p.isVirtual&&!p.isReference&&!p.isAttribute&&l.hasType(p.type)}),s)return D({},s,{effectiveType:_i(l).name})}else if(s=et(o.properties,function(u){return!u.isReference&&!u.isAttribute&&u.type==="Element"}),s)return s;throw ji("unrecognized element <"+n.name+">")},cn.prototype.toString=function(){return"ElementDescriptor["+_i(this.type).name+"]"},cn.prototype.valueHandler=function(e,t){return new xu(e,t)},cn.prototype.referenceHandler=function(e){return new Oo(e,this.context)},cn.prototype.handler=function(e){return e==="Element"?new Yr(this.model,e,this.context):new cn(this.model,e,this.context)},cn.prototype.handleChild=function(e){var t,n,i,r;if(t=this.getPropertyForNode(e),i=this.element,n=t.effectiveType||t.type,Nf(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?(D(o,{element:i}),this.context.addReference(o)):o.$parent=i),r};function Eu(e,t,n){cn.call(this,e,t,n)}Eu.prototype=Object.create(cn.prototype),Eu.prototype.createElement=function(e){var t=e.name,n=Qt(t),i=this.model,r=this.type,o=i.getPackage(n.prefix),a=o&&Uf(n,o)||t;if(!r.hasType(a))throw ji("unexpected element <"+e.originalName+">");return cn.prototype.createElement.call(this,e)};function Yr(e,t,n){this.model=e,this.context=n}Yr.prototype=Object.create(Ga.prototype),Yr.prototype.createElement=function(e){var t=e.name,n=Qt(t),i=n.prefix,r=e.ns[i+"$uri"],o=e.attributes;return this.model.createAny(t,r,o)},Yr.prototype.handleChild=function(e){var t=new Yr(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},Yr.prototype.handleEnd=function(){this.body&&(this.element.$body=this.body)};function wu(e){e instanceof Ln&&(e={model:e}),D(this,{lax:!1},e)}wu.prototype.fromXML=function(e,t,n){var i=t.rootHandler;t instanceof cn?(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 Ix(D({},t,{rootHandler:i})),s=new zf({proxy:!0}),c=Lx();i.context=a,c.push(i);function u(w,T,I){var P=T(),j=P.line,F=P.column,L=P.data;L.charAt(0)==="<"&&L.indexOf(" ")!==-1&&(L=L.slice(0,L.indexOf(" "))+">");var H="unparsable content "+(L?L+" ":"")+`detected
|
|
2
2
|
line: `+j+`
|
|
3
3
|
column: `+F+`
|
|
4
|
-
nested error: `+w.message;if(I)return a.addWarning({message:H,error:w}),!0;throw
|
|
5
|
-
`,
|
|
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 Q0(e){e=D({format:!1,preamble:!0},e||{});function t(n,i){var r=i||new X0,o=new Z0(r,e.format);e.preamble&&o.append(N0);var a=new it,s=n.$model;if(a.getNamespaces().mapDefaultPrefixes(J0(s)),a.build(n).serializeTo(o),!i)return r.value}return{toXML:t}}function J0(e){const t=e.config&&e.config.nsMap||{},n={};for(const i in _u)n[i]=_u[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 Ua(e,t){On.call(this,e,t)}Ua.prototype=Object.create(On.prototype),Ua.prototype.fromXML=function(e,t,n){hn(t)||(n=t,t="bpmn:Definitions");var i=new wu(D({model:this,lax:!0},n)),r=i.handler(t);return i.fromXML(e,r)},Ua.prototype.toXML=function(e,t){var n=new Q0(t);return new Promise(function(i,r){try{var o=n.toXML(e);return i({xml:o})}catch(a){return r(a)}})};var ex="BPMN20",tx="http://www.omg.org/spec/BPMN/20100524/MODEL",nx="bpmn",ix=[],rx=[{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"}]}],ox=[{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"}]}],ax={tagAlias:"lowerCase",typePrefix:"t"},sx={name:ex,uri:tx,prefix:nx,associations:ix,types:rx,enumerations:ox,xml:ax},cx="BPMNDI",ux="http://www.omg.org/spec/BPMN/20100524/DI",lx="bpmndi",px=[{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"]}],fx=[{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"}]}],dx=[],hx={name:cx,uri:ux,prefix:lx,types:px,enumerations:fx,associations:dx},mx="DC",gx="http://www.omg.org/spec/DD/20100524/DC",vx="dc",yx=[{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}]}],_x=[],bx={name:mx,uri:gx,prefix:vx,types:yx,associations:_x},xx="DI",Ex="http://www.omg.org/spec/DD/20100524/DI",wx="di",Sx=[{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"}]}],Rx=[],Cx={tagAlias:"lowerCase"},Px={name:xx,uri:Ex,prefix:wx,types:Sx,associations:Rx,xml:Cx},Ax="bpmn.io colors for BPMN",Tx="http://bpmn.io/schema/bpmn/biocolor/1.0",Mx="bioc",kx=[{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"}]}],Dx=[],Ox=[],Ix={name:Ax,uri:Tx,prefix:Mx,types:kx,enumerations:Dx,associations:Ox},Lx="BPMN in Color",Nx="http://www.omg.org/spec/BPMN/non-normative/color/1.0",Bx="color",$x=[{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"}]}],jx=[],Fx=[],Hx={name:Lx,uri:Nx,prefix:Bx,types:$x,enumerations:jx,associations:Fx};const zx={bpmn:sx,bpmndi:hx,dc:bx,di:Px,bioc:Ix,color:Hx};function Xf(e,t){const n=D({},zx,e);return new Ua(n,t)}const Vx={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"}},Gx="http://www.omg.org/spec/BPMN/non-normative/extensions/i18n/1.0",Zf="i18n",qa={[Zf]:Vx,[cu]:Cf};function Qf(){return Xf(qa)}const Jf=Qf();async function Cu(e){const{rootElement:t,warnings:n}=await Jf.fromXML(e,"bpmn:Definitions");return{definitions:t,warnings:n}}async function Wx(e){const{xml:t}=await Jf.toXML(e,{format:!0});return t}function Pu(e){return e.map(t=>typeof t=="string"?t:t.message??String(t))}const Ya=new Set(["bpmn:Participant","bpmn:Lane","bpmn:Group","bpmn:SubProcess","bpmn:AdHocSubProcess","bpmn:Transaction"]),Ux=1,qx=2;function ji(e){switch(e.kind){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}`}}const ed=20,td=1;function yi(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 Ka(e,t){let n=null;const i=e.type!==t.type;for(const r of yi(e))for(const o of yi(t)){if(r.axis!==o.axis||Math.abs(r.at-o.at)>td)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>=ed&&(!n||s>n.length)&&(n={axis:r.axis,length:s,kind:a})}return n}function nd(e,t){const n=Ka(e,t);return n&&n.kind==="opposite"?{axis:n.axis,length:n.length}:null}function Yx(e,t){let n=0;for(const i of t)i.id!==e.id&&nd(e,i)&&n++;return n}function Au(e,t){let n=0;for(const i of t)i.id!==e.id&&Ka(e,i)&&n++;return n}const Tu=15,id=20;function Kx(e,t){const n=t.axis==="v"?[e.x,e.x+e.width]:[e.y,e.y+e.height];if(t.at<n[0]-id||t.at>n[1]+id)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 Mu=20;function Xa(e,t){const n=[];for(const i of t){if(i.axis!==e.axis||Math.abs(i.at-e.at)>td)continue;const r=Math.max(e.lo,i.lo),o=Math.min(e.hi,i.hi);o-r<ed||n.push([r-Mu,o+Mu])}return n}function Za(e,t){const n=e.label;if(!n)return null;let i=null;for(const r of yi(e)){const o=Kx(n,r);if(o){for(const a of t)if(a.id!==e.id&&!(i&&a.id>=i.other)){for(const[s,c]of Xa(r,yi(a)))if(Math.min(c,o[1])>Math.max(s,o[0])){i={other:a.id,axis:r.axis};break}}}}return i}const Xx=1,Zx=(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 Qx(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 Jx(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 eE=(e,t)=>e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height;function Fi(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(Qx(e.waypoints[o],e.waypoints[o+1],r,qx)){i.push(r);break}}return i}function tE(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 rd=(e,t)=>e.endpoints.some(n=>t.endpoints.includes(n));function Qa(e,t){let n=0;for(const i of t){if(i.id===e.id||rd(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++)tE(e.waypoints[o],e.waypoints[o+1],i.waypoints[a],i.waypoints[a+1])&&(r=!0);r&&n++}return n}function Oo(e,t){let n=0;for(const i of t)i.id===e.id||rd(e,i)||Qa(e,[i])>0&&(n+=i.type===e.type?2:1);return n}function od(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++)Qa(n[i],[n[r]])>0&&(t+=n[i].type===n[r].type?2:1);return t}function ku(e){const t=[],n=e.edges;for(let i=0;i<n.length;i++)for(let r=i+1;r<n.length;r++)if(Qa(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]}`))}const Yr=e=>e.shapes.filter(t=>!t.container);function nE(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 Hi(e){const t=[],n=e.shapes.filter(o=>!o.container);for(const o of e.edges)for(const a of Fi(o,n))t.push({kind:"edge-crosses-shape",edge:o.id,shape:a.id});const i=n.filter(o=>!o.attached);for(let o=0;o<i.length;o++)for(let a=o+1;a<i.length;a++){const s=i[o],c=i[a];if(!Jx(s,c,Ux))continue;const u=s.id<c.id?[s.id,c.id]:[c.id,s.id];t.push({kind:"shape-overlap",shapes:u,identical:eE(s,c)})}for(let o=0;o<e.edges.length;o++)for(let a=o+1;a<e.edges.length;a++){const s=e.edges[o],c=e.edges[a],u=Ka(s,c);if(!u)continue;const l=s.id<c.id?[s.id,c.id]:[c.id,s.id];t.push({kind:u.kind==="opposite"?"edge-overlap-opposite":"edge-overlap-mixed",edges:l,axis:u.axis,length:Math.round(u.length)})}for(const o of e.edges){if(!o.label)continue;const a=Za(o,e.edges);a&&t.push({kind:"label-on-shared-segment",edge:o.id,other:a.other,axis:a.axis})}const r=new Map(e.shapes.map(o=>[o.id,o]));for(const o of n){const a=o.parent??nE(o,e,r);if(!a)continue;const s=r.get(a);!s||!s.container||Zx(s,o,Xx)||t.push({kind:"shape-outside-container",shape:o.id,container:s.id})}return t.sort((o,a)=>ji(o).localeCompare(ji(a)))}const Nt=e=>typeof e=="object"&&e!==null?e:void 0,Zt=e=>typeof e=="number"?e:0,Er=e=>{const t=Nt(e);return typeof(t==null?void 0:t.id)=="string"?t.id:void 0};function iE(e){const t=Nt(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=Er(o);a&&n.push(a)}}return n}function rE(e,t){const n=Nt(e.$parent);if(!n)return;const i=typeof n.$type=="string"?n.$type:"";if(i==="bpmn:Process"){const r=Er(n);return r?t.get(r):void 0}if(Ya.has(i)&&i!=="bpmn:Lane"&&i!=="bpmn:Group")return Er(n)}function ad(e){var o,a,s,c;const t=[],n=[],i=((o=Nt(e))==null?void 0:o.diagrams)??[],r=new Map;for(const u of((a=Nt(e))==null?void 0:a.rootElements)??[]){const l=Nt(u);if((l==null?void 0:l.$type)==="bpmn:Collaboration")for(const p of l.participants??[]){const f=Nt(p),d=Er(f),h=Er(f==null?void 0:f.processRef);d&&h&&r.set(h,d)}}for(const u of i){const l=Nt((s=Nt(u))==null?void 0:s.plane),p=(l==null?void 0:l.planeElement)??[];for(const f of p){const d=Nt(f);if(!d)continue;const h=Nt(d.bpmnElement),m=typeof(h==null?void 0:h.id)=="string"?h.id:void 0;if(!m)continue;const g=typeof(h==null?void 0:h.$type)=="string"?h.$type:"",S=Nt(d.bounds);if(S){const b=d.isExpanded===!1;t.push({id:m,type:g,x:Zt(S.x),y:Zt(S.y),width:Zt(S.width),height:Zt(S.height),container:Ya.has(g)&&!b,attached:(h==null?void 0:h.attachedToRef)!==void 0,...h?{parent:rE(h,r)}:{}});continue}const E=d.waypoint;if(Array.isArray(E)){const b=Nt((c=Nt(d.label))==null?void 0:c.bounds);n.push({id:m,type:g,waypoints:E.map(x=>{var w,T;return{x:Zt((w=Nt(x))==null?void 0:w.x),y:Zt((T=Nt(x))==null?void 0:T.y)}}),endpoints:iE(h),...b?{label:{x:Zt(b.x),y:Zt(b.y),width:Zt(b.width),height:Zt(b.height)}}:{}})}}}return{shapes:t,edges:n}}function sd(e){return Hi(ad(e))}async function oE(e){const{definitions:t,warnings:n}=await Cu(e);return{findings:sd(t),warnings:n}}function Yn(e){const t=[],n=[];for(const i of e.getAll()){const r=i;if(r.type==="label"||r.labelTarget)continue;const o=typeof r.type=="string"?r.type:"";if(o==="bpmn:Definitions"||o.startsWith("bpmndi:"))continue;const a=r.waypoints;if(a){const p=Nt(r.label);n.push({id:r.id,type:o,waypoints:a.map(f=>({x:Zt(f.x),y:Zt(f.y)})),endpoints:[Er(r.source),Er(r.target)].filter(f=>!!f),...p&&typeof p.x=="number"?{label:{x:p.x,y:Zt(p.y),width:Zt(p.width),height:Zt(p.height)}}:{}});continue}if(typeof r.x!="number"||typeof r.y!="number")continue;const s=Nt(r.businessObject);let c=Nt(r.parent);for(;c&&c.type==="bpmn:Lane";)c=Nt(c.parent);const u=typeof(c==null?void 0:c.type)=="string"?c.type:"",l=c&&Ya.has(u)&&u!=="bpmn:Group"&&typeof c.id=="string"?c.id:void 0;t.push({id:r.id,type:o,x:r.x,y:r.y,width:Zt(r.width),height:Zt(r.height),container:Ya.has(o)&&r.collapsed!==!0,attached:(s==null?void 0:s.attachedToRef)!==void 0,...l!==void 0?{parent:l}:{}})}return{shapes:t,edges:n}}const aE={"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 sE(e,t){const n=aE[e];return n||(e==="label"||e.startsWith("bpmndi:")?"other":e.startsWith("bpmn:")&&!("waypoints"in t&&t.waypoints)?"flowNode":"other")}function cd(e){let t=e.parent;for(;t;){if(t.type==="bpmn:Participant")return t.id;t=t.parent}}function ud(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 sE(i.type,i)},lanesOf:n=>t().filter(i=>i.type==="bpmn:Lane"&&cd(i)===n).sort((i,r)=>i.y-r.y).map(i=>i.id),participantOf:n=>{const i=e.get(n);return i?cd(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 ld=20,cE=4,sn=(e,t)=>Math.abs(e-t)<.5;function pd(e,t,n,i=ld){if(sn(e.y,t.y)&&!sn(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(sn(e.x,t.x)&&!sn(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 fd(e,t,n=ld){if(e.length!==4)return null;const[i,r,o,a]=e;if(sn(i.y,r.y)&&sn(r.x,o.x)&&sn(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(sn(i.x,r.x)&&sn(r.y,o.y)&&sn(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 dd(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 hd=30,uE=[0,-25,25,-40,40];function lE(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+hd:s-hd,u=a?i.y+i.height:i.y,l=n.x+n.width/2,p=i.x+i.width/2;return uE.map(f=>[{x:l,y:s},{x:l,y:c},{x:p+f,y:c},{x:p+f,y:u}])}const pE=(e,t,n)=>[...e.slice(0,t+1),...n,...e.slice(t+1)],Ja=(e,t,n)=>Fi({...e,waypoints:t},n).length;function md(e,t,n,i){let r=[...e.waypoints],o=Ja(e,r,t);if(o===0)return null;let a=!1;for(const p of dd(e,t))if(Ja(e,p,t)===0)return p;const s=(i??[]).filter(p=>p.id!==e.id).flatMap(yi),c=p=>yi({...e,waypoints:p}).some(f=>Xa(f,s).length>0),u=lE(e,t).filter(p=>Ja(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<cE&&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)||Fi({...e,waypoints:[h,m]},[g]).length===0)continue;const S=pd(h,m,g),E=S?S.map(x=>pE(r,d,x)):fd(r,g)??[];if(!E.length)continue;const b=[...E].sort((x,w)=>Number(l(w))-Number(l(x)));for(const x of b){const w=Ja(e,x,t);if(w<o){r=x,o=w,f=!0,a=!0;break}}if(f)break}}if(!f)break}return a&&o===0?r:null}function gd(e,t){const{elementRegistry:n}=e,i=e.modeling,r=Yn(n),o=Yr(r),a=Hi(r).filter(c=>c.kind==="edge-crosses-shape"&&!t.has(ji(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=md(u,o,f,r.edges);d&&i.updateWaypoints(l,d)}}const fE=10;function vd(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 yd(e,t){if(e.waypoints.length<2||e.endpoints.length!==2)return null;const n=t.shapes.filter(H=>H.type==="bpmn:Participant"&&H.container),i=t.shapes.find(H=>H.id===e.endpoints[0]),r=t.shapes.find(H=>H.id===e.endpoints[1]);if(!i||!r)return null;const o=vd(i,n),a=vd(r,n);if(!o||!a||o.id===a.id)return null;const s=a.y>o.y,c=s?o:a,u=s?a:o,l=n.filter(H=>H.id!==o.id&&H.id!==a.id&&H.y>=c.y+c.height&&H.y+H.height<=u.y).sort((H,oe)=>H.y-oe.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,S=e.waypoints[0],E=e.waypoints[e.waypoints.length-1],b=Yr(t),x=t.edges.filter(H=>H.id!==e.id),w=Oo(e,x),T=Fi(e,b).length;if(w===0&&T===0)return null;const I=Math.min(...l.map(H=>H.x)),P=Math.max(...l.map(H=>H.x+H.width)),j=(S.x+E.x)/2,F=H=>H.filter((oe,Te)=>Te===0||!(sn(oe.x,H[Te-1].x)&&sn(oe.y,H[Te-1].y)));let L;for(let H=I;H<=P;H+=fE){const oe=F([S,{x:S.x,y:m},{x:H,y:m},{x:H,y:g},{x:E.x,y:g},E]),Te={...e,waypoints:oe};if(Fi(Te,b).length>0)continue;const ot=Oo(Te,x),Y=Math.abs(H-j);(!L||ot<L.cross||ot===L.cross&&Y<L.detour)&&(L={pts:oe,cross:ot,detour:Y})}return L&&(T>0?L.cross<=w:L.cross<w)?L.pts:null}function _d(e,t){const{elementRegistry:n}=e,i=e.modeling,r=Yn(n);for(const o of r.edges){if(o.type!=="bpmn:MessageFlow"||t.has(o.id))continue;const a=Yn(n),s=a.edges.find(l=>l.id===o.id);if(!s)continue;const c=yd(s,a);if(!c)continue;const u=n.get(o.id);u&&i.updateWaypoints(u,c)}}const Du=[25,-25,40,-40],bd=35;function dE(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-bd:n.y+n.height+bd,p=[];for(const f of[0,...Du]){if(Math.abs(f)>=i.width/2-5)continue;const d=o+f;p.push({pts:[{x:n.x,y:r},{x:d,y:r},{x:d,y:c}],cost:Math.abs(f)});for(const h of[0,...Du]){if(Math.abs(h)>=n.width/2-5)continue;const m=a+h;p.push({pts:[{x:m,y:u},{x:m,y:l},{x:d,y:l},{x:d,y:c}],cost:Math.abs(f)+Math.abs(h)})}}return p}function hE(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=sn(n[0].x,n[1].x)&&!sn(n[0].y,n[1].y),s=sn(n[n.length-1].x,n[n.length-2].x)&&!sn(n[n.length-1].y,n[n.length-2].y);for(const c of Du){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 xd(e,t){const n=new Map(t.shapes.map(l=>[l.id,l])),i=Yr(t),r=t.edges.filter(l=>l.id!==e.id),o=Au(e,r);if(o===0)return null;const a=Oo(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=[...dE(e,n),...hE(e,n)];for(const{pts:l,cost:p}of u){const f={...e,waypoints:l};if(Fi(f,i).length>0)continue;const d=Au(f,r),h=Oo(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 Ed(e,t,n){const{elementRegistry:i}=e,r=e.modeling,o=Yn(i),a=Hi(o).filter(l=>(l.kind==="edge-overlap-opposite"||l.kind==="edge-overlap-mixed")&&!t.has(ji(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=Yn(i),f=p.edges.find(m=>m.id===l);if(!f)continue;const d=xd(f,p);if(!d)continue;const h=i.get(l);h&&r.updateWaypoints(h,d)}}const mE=10,gE=(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 wd(e,t){const n=e.label;if(!n)return null;const i=t.edges.filter(a=>a.id!==e.id);if(!Za(e,i))return null;const r=Yr(t),o=i.flatMap(yi);for(const a of yi(e)){let s=[[a.lo,a.hi]];for(const[d,h]of Xa(a,o))s=s.flatMap(([m,g])=>{const S=[];return d>m&&S.push([m,Math.min(g,d)]),h<g&&S.push([Math.max(m,h),g]),S.filter(([E,b])=>b>E)});const c=a.axis==="h"?n.width:n.height,u=s.find(([d,h])=>h-d>=c+mE*2);if(!u)continue;const l=(u[0]+u[1])/2,p=a.axis==="h"?{x:l,y:a.at-Tu}:{x:a.at+Tu,y:l},f={x:p.x-n.width/2,y:p.y-n.height/2,width:n.width,height:n.height};if(!Za({...e,label:f},i)&&!r.some(d=>!e.endpoints.includes(d.id)&&gE(f,d)))return f}return null}function Sd(e,t,n){const{elementRegistry:i}=e,r=e.modeling,o=Yn(i),a=Hi(o).filter(s=>s.kind==="label-on-shared-segment"&&!t.has(ji(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=wd(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})}}const vE=/^[\p{L}_][\p{L}\p{N}_.\-]*$/u,Rd=new Set(["sequenceFlow","messageFlow","dataAssociation","association"]),Cd={"participant.add":[{path:"participant",shape:["id"]},{path:"participant.lanes[]",shape:["id"],optional:!0}],"participant.update":[{path:"id",shape:null},{path:"lanes[]",shape:["id"],optional:!0}],"node.add":[{path:"node",shape:["id","type"]}],"node.update":[{path:"id",shape:null}],"sequenceFlow.add":[{path:"flow",shape:["id","source","target"]}],"sequenceFlow.update":[{path:"id",shape:null}],"messageFlow.add":[{path:"flow",shape:["id","source","target"]}],"messageFlow.update":[{path:"id",shape:null}],"dataStore.add":[{path:"dataStore",shape:["id"]},{path:"associations[]",shape:["source","target"],optional:!0}],"dataStore.update":[{path:"id",shape:null}],"dataAssociation.add":[{path:"association",shape:["source","target"]}],"association.add":[{path:"association",shape:["source","target"]}],"annotation.add":[{path:"annotation",shape:["id","text"]},{path:"association",shape:["source","target"],optional:!0},{path:"placement",shape:["anchor","side"],optional:!0}],"annotation.update":[{path:"id",shape:null},{path:"placement",shape:["anchor","side"],optional:!0}],"group.add":[{path:"group",shape:["id"]},{path:"group.members[]",shape:null,optional:!0}],"group.update":[{path:"id",shape:null},{path:"members[]",shape:null,optional:!0}],"element.remove":[{path:"id",shape:null}]},es=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),Ou=e=>typeof e=="string"&&e!=="";function yE(e){const t=[];function n(i,r,o,a){if(a===null){Ou(o)||t.push({kind:"payload-invalid",opIndex:i,field:r});return}if(!es(o)){t.push({kind:"payload-invalid",opIndex:i,field:r});return}for(const s of a)Ou(o[s])||t.push({kind:"payload-invalid",opIndex:i,field:`${r}.${s}`})}return e.forEach((i,r)=>{if(!es(i)||!Ou(i.kind)||!(i.kind in Cd)){t.push({kind:"payload-invalid",opIndex:r,field:"kind"});return}for(const o of Cd[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(!es(u))break;u=u[p]}if(!es(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 Pd(e,t){const n=yE(e);if(n.length>0)return n;const i=[],r=new Map,o=new Map;function a(f,d,h){if(!vE.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:S,name:E,condition:b}=f.flow,x=u(d,g,"source",["flowNode"]),w=u(d,S,"target",["flowNode"]);x&&w&&c(g)!==c(S)&&i.push({kind:"flow-cross-pool",opIndex:d,id:m}),E!==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:S}=f.flow,E=u(d,g,"source",["flowNode","participant"]),b=u(d,S,"target",["flowNode","participant"]);if(E&&b){const x=c(g),w=c(S);x!==void 0&&x===w&&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(E=>E===f.dataStore.id).length!==1){i.push({kind:"data-association-ends",opIndex:d,source:m.source,target:m.target});continue}const S=m.source===f.dataStore.id?m.target:m.source;u(d,S,"dataAssociation",["flowNode"])}break}case"dataAssociation.add":{const{source:m,target:g}=f.association,S=u(d,m,"source"),E=u(d,g,"target");if(S&&E){const b=new Set([S,E]);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:S}=f.association,E=u(d,g,"source"),b=u(d,S,"target");E&&b&&E!=="annotation"&&b!=="annotation"&&i.push({kind:"association-detached",opIndex:d,annotation:m??`${g}->${S}`});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 S=m===f.annotation.id?g:m;u(d,S,"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&&Rd.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(E=>E.id);for(const E of m)g.includes(E)||i.push({kind:"lane-shrink-unsupported",opIndex:d,participant:f.id,lane:E});for(const E of g)t.categoryOf(E)!==void 0&&!m.includes(E)&&i.push({kind:"id-duplicate",opIndex:d,id:E});const S=g.filter(E=>m.includes(E));S.length===m.length&&S.some((E,b)=>E!==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,S=t.endpointsOf(f.id),E=f.source??(S==null?void 0:S.source),b=f.target??(S==null?void 0:S.target);m&&g&&E!==void 0&&b!==void 0&&new Set([c(E),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&&Rd.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}}const Kr={cjkEm:.865,upperEm:.68,lowerEm:.5,digitEm:.556,spaceEm:.278,otherEm:.35,ascentEm:.9,descentEm:.25},_E=/[ᄀ-ᇿ -〿-ヿ㐀-鿿가--⦆]/;function bE(e){const t=Kr;return _E.test(e)?t.cjkEm:e===" "?t.spaceEm:e>="0"&&e<="9"?t.digitEm:e>="A"&&e<="Z"?t.upperEm:e>="a"&&e<="z"?t.lowerEm:t.otherEm}function Io(e,t){let n=0;for(const i of e)n+=t*bE(i);return n}function Ad(e=globalThis,{textMeasurement:t="approximate"}={}){if(!(e!=null&&e.SVGElement))throw new Error("installHeadlessBpmnDom: DOM 전역이 없다 — jsdom window 를 전역에 올린 뒤 호출할 것");t==="approximate"&&xE(e),EE(e),wE(e),SE(e)}function xE(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*Kr.ascentEm,fontBoundingBoxDescent:o*Kr.descentEm,actualBoundingBoxAscent:o*Kr.ascentEm,actualBoundingBoxDescent:o*Kr.descentEm}}};t.getContext=()=>n}function EE(e){if(e.SVGMatrix)return;class t{constructor(){Hr(this,"a",1);Hr(this,"b",0);Hr(this,"c",0);Hr(this,"d",1);Hr(this,"e",0);Hr(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 wE(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 SE(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}})}function Td(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 ts(e){return`bpmn:${e[0].toUpperCase()}${e.slice(1)}`}const Md={"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 Vt(e,t){return e.filter(n=>n.kind===t)}function kd(e,t){var Ub,qb,Yb,Kb,Xb;const{modeling:n,bpmnFactory:i,elementFactory:r,elementRegistry:o,canvas:a,autoPlace:s,bpmnReplace:c}=t,u=()=>a.getRootElement(),l=R=>o.get(R),p=R=>{const A=l(R);if(!A)throw new Error(`하강 참조 해소 실패: ${R}`);return A},f=R=>{let A=R.parent;for(;A;){if(A.type==="bpmn:Participant")return A;A=A.parent}},d=Vt(e,"participant.add"),h=Vt(e,"node.add"),m=Vt(e,"sequenceFlow.add"),g=Vt(e,"messageFlow.add"),S=Vt(e,"dataStore.add"),E=Vt(e,"dataAssociation.add"),b=Vt(e,"annotation.add"),x=Vt(e,"group.add"),w=new Map(h.map(R=>[R.node.id,R])),T=(R,A,B)=>{var dt;const X=R.businessObject,K=(((dt=X.extensionElements)==null?void 0:dt.values)??[]).filter(be=>be.$type!==A),U=B?[...K,i.create(A,B)]:K;if(!U.length){X.extensionElements&&n.updateProperties(R,{extensionElements:void 0});return}const ee=i.create("bpmn:ExtensionElements",{values:U});U.forEach(be=>{be.$parent=ee}),n.updateProperties(R,{extensionElements:ee})},I=R=>({anchor:R.anchor,side:R.side,...R.offset!==void 0?{offset:R.offset}:{}});for(const R of Vt(e,"element.remove")){const A=l(R.id);A&&n.removeElements([A])}const P=R=>o.filter(A=>{var B;return A.type==="bpmn:Lane"&&((B=f(A))==null?void 0:B.id)===R}).sort((A,B)=>A.y-B.y);for(const R of Vt(e,"participant.update")){const A=p(R.id);if(R.name!==void 0&&n.updateProperties(A,{name:R.name??void 0}),!R.lanes)continue;const B=P(R.id);if(!B.length){n.splitLane(A,R.lanes.length),P(R.id).forEach((K,U)=>{const ee=R.lanes[U];ee&&n.updateProperties(K,{id:ee.id,name:ee.name})});continue}const X=new Set(B.map(K=>K.id));R.lanes.forEach((K,U)=>{if(X.has(K.id)){n.updateProperties(p(K.id),{name:K.name});return}const ee=U===0?n.addLane(P(R.id)[0],"top"):n.addLane(p(R.lanes[U-1].id),"bottom");n.updateProperties(ee,{id:K.id,name:K.name})})}const j=150,F=80,L=90,H=180,oe=new Set;for(const R of d){oe.add(`pool:${R.participant.id}`);for(const A of R.participant.lanes??[])oe.add(A.id)}const Te=new Map;for(const R of h){const A=R.node.lane??`pool:${R.node.participant??""}`;let B=Te.get(A);B||Te.set(A,B=new Set([0])),R.band!==void 0&&B.add(R.band)}const ot=new Map;for(const[R,A]of Te){if(!oe.has(R))continue;const B=[...A].sort((U,ee)=>U-ee),X=B.map((U,ee)=>ee===0?0:ee%2===1?Math.ceil(ee/2):-(ee/2)),K=Math.min(...X);ot.set(R,new Map(B.map((U,ee)=>[U,X[ee]-K])))}const Y=R=>{var A;return(((A=Te.get(R))==null?void 0:A.size)??0)>1},re=R=>R.band??(R.node.lane||!Y(`pool:${R.node.participant??""}`)?void 0:0),le=new Map,ae=R=>le.get(R.node.id)??re(R),se=(R,A)=>{var B;return((B=ot.get(R))==null?void 0:B.get(A))??A},Z=new Map;for(const[R,A]of Te){let B=0;for(const X of A)B=Math.max(B,se(R,X));Z.set(R,B)}const $=R=>H+j*R,N=d.map((R,A)=>({op:R,declared:A}));N.sort((R,A)=>{const B=R.op.order??Number.POSITIVE_INFINITY,X=A.op.order??Number.POSITIVE_INFINITY;return B!==X?B-X:R.declared-A.declared});let V=80;for(const R of o.getAll())R.parent===u()&&"height"in R&&typeof R.y=="number"&&(V=Math.max(V,R.y+R.height+60));for(const{op:R}of N){const A=R.participant,B=h.filter(Ht=>Ht.node.participant===A.id).length,X=((Ub=A.lanes)==null?void 0:Ub.length)??0,K=Math.max(1200,B*160+300),U=(A.lanes??[]).map(Ht=>$(Z.get(Ht.id)??0)),ee=U.reduce((Ht,Ze)=>Ht+Ze,0);X&&ee<300&&(U[X-1]+=300-ee);const dt=Math.max(300,j*((Z.get(`pool:${A.id}`)??0)+1)),be=A.blackBox||B+X===0?120:X?Math.max(300,ee):dt,Ie=r.createShape({type:"bpmn:Participant",businessObject:i.create("bpmn:Participant",{id:A.id,name:A.name,...R.order!==void 0?{"bwl:poolOrder":R.order}:{},...A.blackBox?{}:{processRef:i.create("bpmn:Process")}}),width:K,height:be,isExpanded:!0}),lt=n.createShape(Ie,{x:100+K/2,y:V+be/2},u()),rn=A.lanes??[];if(rn.length&&n.splitLane(lt,rn.length),rn.length){const Ht=o.filter(Ze=>{var yt;return Ze.type==="bpmn:Lane"&&((yt=f(Ze))==null?void 0:yt.id)===A.id}).sort((Ze,yt)=>Ze.y-yt.y);if(Ht.forEach((Ze,yt)=>{const Cn=rn[yt];Cn&&n.updateProperties(Ze,{id:Cn.id,name:Cn.name})}),U.some(Ze=>Ze!==lt.height/X)){let Ze=lt.y;Ht.forEach((yt,Cn)=>{const Qn=U[Cn];n.resizeShape(yt,{x:yt.x,y:Ze,width:yt.width,height:Qn}),Ze+=Qn})}}V=lt.y+lt.height+60}const we=R=>{var X;const A=w.get(R);if(A)return A.node.participant??"";const B=l(R);return B?B.type==="bpmn:Participant"?B.id:((X=f(B))==null?void 0:X.id)??"":""},vt=new Map,C=R=>{let A=vt.get(R);return A||vt.set(R,A={nodes:[],flows:[]}),A};for(const R of h)C(R.node.participant??"").nodes.push(R);for(const R of m)C(we(R.flow.source)).flows.push(R);const _=R=>{var A;return i.create("bpmn:SequenceFlow",{id:R.id,name:R.name??((A=R.condition)==null?void 0:A.label)})},v=(R,A)=>r.createShape({type:ts(R.type),businessObject:i.create(ts(R.type),{id:R.id,name:R.name,...A!==void 0?{"bwl:band":A}:{}})}),k=[...N.map(({op:R})=>R.participant.id).filter(R=>vt.has(R)),...[...vt.keys()].filter(R=>!d.some(A=>A.participant.id===R))],O=R=>R.endsWith("Gateway");for(const R of k){const A=vt.get(R),B=R?p(R):void 0,X=B?B.x+150:250;let K=B?B.y+80:120;const U=(Me,ze,Fe)=>{const et=u().children.filter(ht=>!("waypoints"in ht&&ht.waypoints)&&ht.id!==ze&&typeof ht.y=="number"&&ht.y>=Me);et.length&&n.moveElements(et,{x:0,y:Fe})},ee=(Me,ze)=>{if(Me){const He=p(Me),Je=$(ze);if(He.height>=Je)return;const ge=Je-He.height,Ne=f(He),Ve=Ne?Ne.y+Ne.height:He.y+He.height;n.resizeLane(He,{x:He.x,y:He.y,width:He.width,height:Je},!1),U(Ve,Ne==null?void 0:Ne.id,ge);return}if(!B)return;const Fe=j*(ze+1);if(B.height>=Fe)return;const et=Fe-B.height,ht=B.y+B.height;n.resizeShape(B,{x:B.x,y:B.y,width:B.width,height:Fe}),U(ht,B.id,et)},dt=(Me,ze,Fe)=>{if(Me){const et=p(Me);return et.y+Math.min(et.height/2,L)+se(Me,ze??0)*j}return ze!==void 0&&B?B.y+F+se(`pool:${R}`,ze)*j:Fe},be=(Me,ze,Fe)=>{if(Me){const et=p(Me);return et.y+Math.min(et.height/2,L)+ze*j}return B?B.y+F+ze*j:Fe},Ie=Me=>Me.participant?p(Me.participant):u(),lt=30,rn=(Me,ze,Fe,et)=>{const ht=Fe-ze.width/2,He=et-ze.height/2;return(Me.children??[]).find(Je=>!("waypoints"in Je&&Je.waypoints)&&Je.type!=="bpmn:Lane"&&Je.type!=="label"&&typeof Je.x=="number"&&ht<Je.x+Je.width+lt&&ht+ze.width+lt>Je.x&&He<Je.y+Je.height&&He+ze.height>Je.y)},Ht=(Me,ze,Fe,et,ht,He)=>{const Je=Fe!==void 0||et!==void 0,ge=se(Fe??`pool:${R}`,et??0);if(Je)for(let Be=0;Be<4;Be++){const mt=be(Fe,ge+Be,He);if(!rn(Me,ze,ht,mt))return ee(Fe,ge+Be),{x:ht,y:mt}}const Ne=dt(Fe,et,He);Je&&ee(Fe,ge);let Ve=ht;for(let Be=0;Be<64;Be++){const mt=rn(Me,ze,Ve,Ne);if(!mt)break;Ve=mt.x+mt.width+130+ze.width/2}return{x:Ve,y:Ne}},Ze=new Set(A.flows.map(Me=>Me.flow.target)),yt=new Map;for(const Me of A.nodes){if(Ze.has(Me.node.id))continue;const ze=v(Me.node,Me.band),Fe=re(Me),et=Me.node.lane?`${Me.node.lane}|${Fe??""}`:Fe!==void 0?`band:${Fe}`:"",ht=Ie(Me.node),He=Ht(ht,ze,Me.node.lane,Fe,yt.get(et)??X,K);n.createShape(ze,He,ht),yt.set(et,He.x+ze.width+130),!Me.node.lane&&Fe===void 0&&(K+=160)}const Cn=new Set,Qn=new Map,zt=new Map,jt=new Map;if(R&&oe.has(`pool:${R}`)){const Me=new Map;for(const ge of A.flows)Me.set(ge.flow.target,(Me.get(ge.flow.target)??0)+1);const ze=ge=>dt(ge.node.lane,ae(ge),Number.NaN),Fe=new Set,et=ge=>{var Be;const Ne=(Be=w.get(ge))==null?void 0:Be.node.participant;if(Ne)return l(Ne);const Ve=l(ge);if(Ve)return Ve.type==="bpmn:Participant"?Ve:f(Ve)},ht=ge=>{const Ne=[],Ve=new Set([ge]),Be=[ge];for(;Be.length;){const mt=Be.shift(),tt=w.get(mt);tt&&Ne.push(tt);for(const Se of A.flows)Se.flow.source!==mt||Ve.has(Se.flow.target)||(Me.get(Se.flow.target)??0)!==1||(Ve.add(Se.flow.target),Be.push(Se.flow.target))}return Ne},He=ge=>{if(!B)return;const Ne=new Set(ge.map(mt=>mt.node.id));let Ve=!1,Be=!1;for(const mt of g){if(!Ne.has(mt.flow.source))continue;const tt=et(mt.flow.target);!tt||tt.id===B.id||(tt.y<B.y?Ve=!0:Be=!0)}return Ve&&!Be?"up":Be&&!Ve?"down":void 0};for(const ge of A.nodes){if(!O(ge.node.type))continue;const Ne=dt(ge.node.lane,re(ge),Number.NaN);if(Number.isNaN(Ne))continue;const Ve=[];for(const Se of A.flows){if(Se.flow.source!==ge.node.id)continue;const $e=w.get(Se.flow.target);if(!$e||$e.node.lane!==ge.node.lane||(Me.get($e.node.id)??0)!==1)continue;const nt=re($e);if(nt===void 0)continue;const on=dt($e.node.lane,nt,Number.NaN);if(Number.isNaN(on))continue;const au=ht($e.node.id),su=He(au);su&&Ve.push({subtree:au,band:nt,row:on,dir:su})}if(!Ve.some(Se=>Se.dir==="up")||!Ve.some(Se=>Se.dir==="down")||!Ve.some(Se=>Se.dir==="up"&&Ve.some($e=>$e.dir==="down"&&$e.row<Se.row)))continue;const mt=[...Ve].sort((Se,$e)=>Se.row-$e.row);[...Ve.filter(Se=>Se.dir==="up"),...Ve.filter(Se=>Se.dir==="down")].sort((Se,$e)=>Se.dir===$e.dir?Se.row-$e.row:Se.dir==="up"?-1:1).forEach((Se,$e)=>{const nt=mt[$e].band;if(nt!==Se.band){Fe.add(ge.node.id);for(const on of Se.subtree)re(on)===Se.band&&le.set(on.node.id,nt)}})}for(const ge of A.nodes){if(!O(ge.node.type))continue;const Ne=ze(ge);if(Number.isNaN(Ne)||b.some(Se=>{var $e,nt;return((($e=Se.placement)==null?void 0:$e.anchor)??(Se.association?Se.association.source===Se.annotation.id?Se.association.target:Se.association.source:void 0))===ge.node.id&&((nt=Se.placement)==null?void 0:nt.side.startsWith("bottom"))}))continue;let Be,mt=!1,tt;for(const Se of A.flows){if(Se.flow.source!==ge.node.id)continue;const $e=w.get(Se.flow.target);if(!$e||!$e.node.lane&&re($e)===void 0)continue;const nt=ze($e);Number.isNaN(nt)||(Math.abs(nt-Ne)<.5&&(mt=!0),nt>Ne?!Be||nt>Be.row?Be={id:$e.node.id,row:nt,count:1}:nt===Be.row&&Be.count++:nt<Ne&&$e.node.lane===ge.node.lane&&(!tt||nt>tt.row?tt={op:$e,row:nt,count:1}:nt===tt.row&&tt.count++))}Be&&Be.count===1&&(Me.get(Be.id)??0)===1&&!Fe.has(ge.node.id)&&Cn.add(Be.id),!mt&&tt&&tt.count===1&&(Me.get(tt.op.node.id)??0)===1&&Qn.set(tt.op.node.id,{lane:ge.node.lane,band:ae(ge)})}const Je=new Map;for(const ge of g)Je.set(ge.flow.target,[...Je.get(ge.flow.target)??[],ge]);for(const ge of A.nodes){const Ne=Je.get(ge.node.id);if(!Ne||Ne.length!==1||!Me.get(ge.node.id)||!ge.node.lane&&re(ge)===void 0)continue;const Ve=(qb=w.get(Ne[0].flow.source))==null?void 0:qb.node.participant,Be=Ve?l(Ve):void 0;if(!Be||!B||Be.id===B.id)continue;const mt=ge.node.lane??`pool:${R}`,tt=ot.get(mt);if(!tt)continue;const Se=tt.get(0)??0,$e=(tt.get(ae(ge)??0)??Se)-Se;if($e===0)continue;const nt=Be.y<B.y;if(nt&&$e<0||!nt&&$e>0)continue;let on;for(const[au,su]of tt){const ja=su-Se;(nt&&ja<0&&(!on||ja<on.row)||!nt&&ja>0&&(!on||ja>on.row))&&(on={band:au,row:ja})}on&&zt.set(ge.node.id,{lane:ge.node.lane,band:on.band})}}const $a=new Set;let gr=0;for(;gr++<A.nodes.length+2;){for(let Fe=0;Fe<A.nodes.length+A.flows.length+2;Fe++){let et=!1;for(const ht of A.flows){const He=ht.flow;if($a.has(He.id))continue;const Je=l(He.source);if(!Je)continue;const ge=l(He.target),Ne=w.get(He.target);if(!ge&&Ne){const Ve=v(Ne.node,Ne.band),Be=ae(Ne);if(Ne.node.lane||Be!==void 0){const mt=Ie(Ne.node),tt=Je,Se=tt.x+(jt.get(He.source)??0)+tt.width+130,$e=Qn.get(He.target)??zt.get(He.target),nt=Ht(mt,Ve,$e?$e.lane:Ne.node.lane,$e?$e.band:Be,Cn.has(He.target)?tt.x+tt.width/2:Se,Number.NaN),on=n.createShape(Ve,nt,mt);Cn.has(He.target)&&jt.set(He.target,Se-(on.x+on.width/2)),n.connect(Je,on,{type:"bpmn:SequenceFlow",businessObject:_(He)})}else s.append(Je,Ve,{connection:{type:"bpmn:SequenceFlow",businessObject:_(He)}})}else if(ge)n.connect(Je,ge,{type:"bpmn:SequenceFlow",businessObject:_(He)});else continue;$a.add(He.id),et=!0}if(!et)break}const Me=A.nodes.filter(Fe=>!l(Fe.node.id));if(!Me.length)break;const ze=Me[0];{const Fe=v(ze.node,ze.band),et=Ie(ze.node),ht=re(ze);n.createShape(Fe,Ht(et,Fe,ze.node.lane,ht,X,K),et),!ze.node.lane&&ht===void 0&&(K+=160)}}}const z=40,ie=(R,A=()=>!0)=>{const B=l(R);if(!B)return[];const X=[B],K=new Set([R]);for(let U=0;U<X.length;U++){const ee=X[U].id;for(const dt of m){const be=dt.flow.target;if(dt.flow.source!==ee||K.has(be)||!w.has(be))continue;K.add(be);const Ie=l(be);Ie&&A(Ie)&&X.push(Ie)}}return X};for(const R of Vt(e,"sequenceFlow.update")){if(R.target===void 0)continue;const A=w.get(R.target);if(!A)continue;const B=l(R.target),X=l(R.id);if(!B||!X)continue;const K=R.source!==void 0?l(R.source):X.source,U=X.target;if(!K||!U||U.id===B.id)continue;const ee=ie(R.target),dt=new Set(ee.map(Ze=>Ze.id)),be=Math.min(...ee.map(Ze=>Ze.x)),Ie=Math.max(...ee.map(Ze=>Ze.x+Ze.width)),lt=K.x+K.width,rn=Ie-be+z*2-(U.x-lt);if(rn>0){const Ze=f(B),yt=(Ze==null?void 0:Ze.children)??[],Cn=jt=>jt.type==="bpmn:Lane",Qn=yt.filter(jt=>!("waypoints"in jt&&jt.waypoints)&&!Cn(jt)&&!dt.has(jt.id)&&jt.x>=U.x),zt=Ze?[Ze,...yt.filter(jt=>Cn(jt))]:[];Qn.length&&n.createSpace(Qn,zt,{x:rn,y:0},"e",U.x-1)}const Ht=A.node.lane||A.band!==void 0?B.y+B.height/2:K.y+K.height/2;n.moveElements(ee,{x:lt+z-be,y:Ht-(B.y+B.height/2)})}const _e=(R,A)=>{const B=A.target===R,X=p(A.source),K=p(A.target),U=B?"bpmn:DataOutputAssociation":"bpmn:DataInputAssociation";n.connect(X,K,A.id?{type:U,businessObject:i.create(U,{id:A.id})}:{type:U})};for(const R of S){const A=R.associations??[],B=A.map(U=>U.source===R.dataStore.id?U.target:U.source).map(l).find(Boolean),X=B?f(B)??u():u(),K=B?{x:B.x+B.width/2,y:B.y+B.height+110}:{x:200,y:V+60};n.createShape({type:"bpmn:DataStoreReference",businessObject:i.create("bpmn:DataStoreReference",{id:R.dataStore.id,name:R.dataStore.name})},K,X);for(const U of A)_e(R.dataStore.id,U)}for(const R of E){const B=p(R.association.target).type==="bpmn:DataStoreReference"?R.association.target:R.association.source;_e(B,R.association)}for(const R of g){const A=R.flow;n.connect(p(A.source),p(A.target),{type:"bpmn:MessageFlow",businessObject:i.create("bpmn:MessageFlow",{id:A.id,name:A.name})})}const Oe=100,ft=30,We=4,Ot=R=>!("waypoints"in R&&R.waypoints)&&R.type!=="bpmn:Lane"&&R.type!=="label"&&typeof R.x=="number",$t=()=>{const R=Yn(o);return{bad:Hi(R).filter(A=>A.kind==="edge-crosses-shape"||A.kind==="edge-overlap-opposite"||A.kind==="edge-overlap-mixed").length,crossings:od(R),straight:R.edges.filter(A=>A.type==="bpmn:MessageFlow"&&A.waypoints.length===2).length}},tn=R=>{const A=Yn(o),B=A.edges.find(X=>X.id===R);return!!B&&Fi(B,Yr(A)).length>0},Xe=(R,A,B)=>{const X=new Set(R.map(Ie=>Ie.id)),K=(A.children??[]).filter(Ot).filter(Ie=>!X.has(Ie.id));if(R.some(Ie=>K.some(lt=>Ie.x+B<lt.x+lt.width+ft&&Ie.x+B+Ie.width+ft>lt.x&&Ie.y<lt.y+lt.height&&Ie.y+Ie.height>lt.y)))return null;const ee=A.width;n.moveElements(R,{x:B,y:0});const be=Math.max(...R.map(Ie=>Ie.x+Ie.width))+150-(A.x+A.width);return be>0&&n.resizeShape(A,{x:A.x,y:A.y,width:A.width+be,height:A.height}),()=>{n.moveElements(R,{x:-B,y:0}),be>0&&n.resizeShape(A,{x:A.x,y:A.y,width:ee,height:A.height})}},Ct=(R,A)=>A.bad>R.bad||A.crossings>R.crossings&&A.straight<=R.straight,nn=(R,A,B,X=()=>!0)=>{const K=$t(),U=Xe(R,A,B);if(!U)return!1;const ee=$t();return Ct(K,ee)||!X()?(U(),!1):!0},Fr=R=>{var B;const A=(B=w.get(R))==null?void 0:B.node.participant;return!!A&&oe.has(`pool:${A}`)},ln=new Map;for(const R of g){if(!Fr(R.flow.target))continue;const A=ln.get(R.flow.target)??[];A.push(R),ln.set(R.flow.target,A)}const Un=[...ln.keys()],kn=new Set(m.map(R=>R.flow.target)),Pt=R=>N.findIndex(({op:A})=>A.participant.id===R);Un.sort((R,A)=>{var K,U;const B=kn.has(R)?1:0,X=kn.has(A)?1:0;return B!==X?B-X:Pt((K=w.get(R))==null?void 0:K.node.participant)-Pt((U=w.get(A))==null?void 0:U.node.participant)});const Zn=R=>R.x+R.width/2,Na=R=>{let A;for(const B of ln.get(R)??[]){const X=l(B.flow.source);if(!X)continue;const K=Zn(X);(!A||K>A.cx)&&(A={op:B,cx:K})}return A==null?void 0:A.op},Dn=R=>{const A=Na(R),B=l(R),X=A?l(A.flow.source):void 0;return B&&X?Zn(X)-Zn(B):void 0},Le=R=>{const A=Dn(R);return A!==void 0&&Math.abs(A)<Oe},je=R=>{const A=Na(R);if(!A)return null;const B=l(R),X=l(A.flow.source);if(!B||!X)return null;const K=Zn(X)-Zn(B);if(K>=Oe){const U=p(w.get(R).node.participant);return{subtree:ie(R,ee=>ee.x>=B.x),pool:U,dx:K}}if(-K>=Oe&&Fr(A.flow.source)){const U=p(w.get(A.flow.source).node.participant);return{subtree:ie(A.flow.source,ee=>ee.x>=X.x&&!Le(ee.id)),pool:U,dx:-K}}return null},Hb=()=>Un.map(R=>({id:R,plan:je(R)})).filter(R=>!!R.plan).sort((R,A)=>Math.min(...R.plan.subtree.map(B=>B.x))-Math.min(...A.plan.subtree.map(B=>B.x))).map(R=>R.id);for(let R=0;R<3;R++){const A=$t(),B=[];for(const K of Hb()){const U=je(K);if(!U)continue;const ee=Xe(U.subtree,U.pool,U.dx);ee&&B.push(ee)}if(!B.length)break;if(!Ct(A,$t()))continue;for(const K of B.reverse())K();let X=!1;for(const K of Hb()){const U=je(K);U&&nn(U.subtree,U.pool,U.dx)&&(X=!0)}if(!X)break}for(const R of Un.flatMap(A=>ln.get(A)??[])){if(!tn(R.flow.id))continue;const A=l(R.flow.target);if(!A)continue;const B=p(w.get(R.flow.target).node.participant),X=ie(R.flow.target,U=>U.x>=A.x),K=A.width+130;for(let U=1;U<=We&&!nn(X,B,K*U,()=>!tn(R.flow.id));U++);}let zb=0;for(const R of x){const A=(R.group.members??[]).map(l).filter(U=>!!U),B=40;let X;if(A.length){const U=Math.min(...A.map(Ie=>Ie.x))-B,ee=Math.min(...A.map(Ie=>Ie.y))-B,dt=Math.max(...A.map(Ie=>Ie.x+Ie.width))+B,be=Math.max(...A.map(Ie=>Ie.y+Ie.height))+B;X={x:U,y:ee,width:dt-U,height:be-ee}}else X={x:300+zb*350,y:40,width:300,height:200},zb++;const K=n.createShape({type:"bpmn:Group",businessObject:i.create("bpmn:Group",{id:R.group.id}),width:X.width,height:X.height},{x:X.x+X.width/2,y:X.y+X.height/2},u());R.group.name&&n.updateLabel(K,R.group.name),(Yb=R.group.members)!=null&&Yb.length&&T(K,"bwl:Members",{refs:R.group.members.join(" ")})}const Vb=R=>{const A=R.waypoints;if(A!=null&&A.length){const X=A[Math.floor((A.length-1)/2)];return{x:X.x,y:X.y,width:0,height:0}}const B=R;return{x:B.x,y:B.y,width:B.width,height:B.height}};let Ba=0;const Gb=12,Wb=14,pD=15,fD=300,dD=R=>{const A=R.split(`
|
|
7
|
-
`),B=Math.max(...A.map(U=>Io(U,Gb))),X=Math.max(100,Math.min(fD,Math.ceil(B)+Wb)),K=A.reduce((U,ee)=>U+Math.max(1,Math.ceil((Io(ee,Gb)+Wb)/X)),0);return{width:X,height:Math.max(30,K*pD+10)}},Rn=10;for(const R of b){const A=R.association,B=((Kb=R.placement)==null?void 0:Kb.anchor)??(A?A.source===R.annotation.id?A.target:A.source:void 0),X=B?l(B):void 0,K=X?Vb(X):void 0,U=dD(R.annotation.text??"");let ee;if(K&&R.placement){const[lt,rn]=Md[R.placement.side],Ht=R.placement.offset??50;ee={x:K.x+K.width/2+lt*(K.width/2+U.width/2+Ht),y:K.y+K.height/2+rn*(K.height/2+U.height/2+Ht)}}else K?(ee={x:K.x+K.width/2+180+Ba%3*260,y:K.y-110-Ba%2*95},Ba++):(ee={x:300+Ba*260,y:60},Ba++);const dt=X?f(X)??u():u(),be=dt;if(K&&typeof be.x=="number"&&typeof be.width=="number"&&be.type==="bpmn:Participant"){const lt=be.x+Rn+U.width/2,rn=be.x+be.width-Rn-U.width/2,Ht=be.y+Rn+U.height/2,Ze=be.y+be.height-Rn-U.height/2,yt={x:Math.min(rn,Math.max(lt,ee.x)),y:Math.min(Ze,Math.max(Ht,ee.y))};(yt.x!==ee.x||yt.y!==ee.y)&&(ee=Math.abs(yt.x-(K.x+K.width/2))<(K.width+U.width)/2+Rn&&Math.abs(yt.y-(K.y+K.height/2))<(K.height+U.height)/2+Rn?{x:K.x+K.width+Rn+U.width/2,y:yt.y}:yt);const Cn=(be.children??[]).filter(zt=>!("waypoints"in zt&&zt.waypoints)&&zt.type!=="bpmn:Lane"&&zt.type!=="label"&&typeof zt.x=="number"),Qn=zt=>Cn.some(jt=>zt.x-U.width/2<jt.x+jt.width+Rn&&zt.x+U.width/2+Rn>jt.x&&zt.y-U.height/2<jt.y+jt.height+Rn&&zt.y+U.height/2+Rn>jt.y);if(Qn(ee)){const zt=(K.width+U.width)/2+Rn,$a=[{x:ee.x+zt,y:ee.y},{x:ee.x-zt,y:ee.y},{x:ee.x,y:ee.y-U.height-Rn},{x:ee.x,y:ee.y+U.height+Rn}].filter(gr=>gr.x-U.width/2>=be.x&&gr.x+U.width/2<=be.x+be.width&&gr.y-U.height/2>=be.y&&gr.y+U.height/2<=be.y+be.height).find(gr=>!Qn(gr));$a&&(ee=$a)}}const Ie=n.createShape({type:"bpmn:TextAnnotation",width:U.width,height:U.height,businessObject:i.create("bpmn:TextAnnotation",{id:R.annotation.id,text:R.annotation.text})},ee,dt);if(A){const lt=rn=>rn===R.annotation.id?Ie:p(rn);n.connect(lt(A.source),lt(A.target),A.id?{type:"bpmn:Association",businessObject:i.create("bpmn:Association",{id:A.id})}:{type:"bpmn:Association"})}R.placement&&T(Ie,"bwl:Placement",I(R.placement))}for(const R of Vt(e,"association.add")){const A=R.association;n.connect(p(A.source),p(A.target),A.id?{type:"bpmn:Association",businessObject:i.create("bpmn:Association",{id:A.id})}:{type:"bpmn:Association"})}for(const R of Vt(e,"node.update")){let A=p(R.id);if(R.type&&ts(R.type)!==A.type&&(A=c.replaceElement(A,{type:ts(R.type)})),R.name!==void 0&&n.updateProperties(A,{name:R.name??void 0}),R.lane){const B=p(R.lane),X=B.y+B.height/2-(A.y+A.height/2);X!==0&&n.moveElements([A],{x:0,y:X})}}for(const R of Vt(e,"sequenceFlow.update")){const A=p(R.id);if(R.source!==void 0||R.target!==void 0){const B=A,X=R.source!==void 0?p(R.source):B.source,K=R.target!==void 0?p(R.target):B.target,U=ee=>({x:ee.x+ee.width/2,y:ee.y+ee.height/2});n.reconnect(B,X,K,[U(X),U(K)])}R.name!==void 0&&n.updateProperties(A,{name:R.name??void 0}),R.condition!==void 0&&n.updateProperties(A,{name:((Xb=R.condition)==null?void 0:Xb.label)??void 0})}for(const R of Vt(e,"messageFlow.update"))R.name!==void 0&&n.updateProperties(p(R.id),{name:R.name??void 0});for(const R of Vt(e,"dataStore.update"))R.name!==void 0&&n.updateProperties(p(R.id),{name:R.name??void 0});for(const R of Vt(e,"annotation.update")){const A=p(R.id);if(R.text!==void 0&&n.updateProperties(A,{text:R.text}),R.placement===null)T(A,"bwl:Placement",null);else if(R.placement){const B=Vb(p(R.placement.anchor)),[X,K]=Md[R.placement.side],U=R.placement.offset??50,ee=B.x+B.width/2+X*(B.width/2+A.width/2+U),dt=B.y+B.height/2+K*(B.height/2+A.height/2+U);n.moveElements([A],{x:ee-(A.x+A.width/2),y:dt-(A.y+A.height/2)}),T(A,"bwl:Placement",I(R.placement))}}for(const R of Vt(e,"group.update")){const A=p(R.id);if(R.name!==void 0&&n.updateLabel(A,R.name??""),R.members){const B=R.members.map(l).filter(X=>!!X);if(B.length){const K=Math.min(...B.map(be=>be.x))-40,U=Math.min(...B.map(be=>be.y))-40,ee=Math.max(...B.map(be=>be.x+be.width))+40,dt=Math.max(...B.map(be=>be.y+be.height))+40;n.resizeShape(A,{x:K,y:U,width:ee-K,height:dt-U})}T(A,"bwl:Members",{refs:R.members.join(" ")})}}}function Dd(e,t,n=kd){const i=Td(e),r=Pd(t,ud(i.elementRegistry)),o={edgeCrossings:{before:0,after:0}};if(r.length)return{ok:!1,issues:r,findings:[],stats:o};const a=Yn(i.elementRegistry),s=new Set(Hi(a).map(ji)),c=new Set(a.edges.map(d=>d.id)),u=ku(a).length,l=e.get("commandStack");try{Af(l,()=>{n(t,i),_d(i,c),gd(i,s),Ed(i,s,c),Sd(i,s,c)})}catch(d){return{ok:!1,issues:[{kind:"lower-failed",message:d instanceof Error?d.message:String(d)}],findings:[],stats:o}}const p=Yn(i.elementRegistry),f=Hi(p).filter(d=>!s.has(ji(d)));return{ok:!0,issues:[],findings:f,stats:{edgeCrossings:{before:u,after:ku(p).length}}}}function RE(e){const t=e.slice(e.indexOf(":")+1);return t.charAt(0).toLowerCase()+t.slice(1)}function CE(e,t){return typeof e.get=="function"?e.get(t):e[t]}function Od(e,t){const n=CE(e,t);return typeof n=="number"&&Number.isFinite(n)?n:void 0}function Id(e,t){var i;return(((i=e.extensionElements)==null?void 0:i.values)??[]).find(r=>(r==null?void 0:r.$type)===t)}function PE(e){return typeof e=="string"&&uu.includes(e)}function ni(e){if(typeof e=="string")return e;const t=e==null?void 0:e.id;return typeof t=="string"?t:void 0}function Ld(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=[],S=new Set,E=new Set,b=Y=>{Y&&S.add(Y)},x=Y=>{S.add(Y),E.add(Y)},w=Y=>{const re=Id(Y,"bwl:Placement");if(!re)return;const le=typeof re.anchor=="string"?re.anchor:void 0;if(!le||!PE(re.side))return;const ae=typeof re.offset=="number"?re.offset:void 0;m.push({owner:Y.id,anchor:le,side:re.side,...ae!==void 0?{offset:ae}:{}})},T=Y=>{const re=Id(Y,"bwl:Members"),le=typeof(re==null?void 0:re.refs)=="string"?re.refs.split(/\s+/).filter(Boolean):[];le.length&&g.push({owner:Y.id,refs:le})},I=Y=>{var re;for(const le of Y)switch(b(le.id),le.$type){case"bpmn:TextAnnotation":x(le.id),s.push({id:le.id,text:typeof le.text=="string"?le.text:""}),w(le);break;case"bpmn:Association":d.push({id:le.id,type:le.$type,source:ni(le.sourceRef),target:ni(le.targetRef)});break;case"bpmn:Group":{x(le.id);const ae=(re=le.categoryValueRef)==null?void 0:re.value;c.push({id:le.id,...typeof ae=="string"&&ae?{name:ae}:{}}),T(le);break}default:u.push({id:le.id,type:le.$type,reason:"type-outside-mvp"})}},P=(Y,re)=>{const le=Y.flowElements??[],ae=(Y.laneSets??[]).flatMap(Z=>Z.lanes??[]),se=new Map;for(const Z of ae){b(Z.id);for(const $ of Z.flowNodeRef??[]){const N=ni($);N&&se.set(N,Z.id)}}for(const Z of le){if(b(Z.id),Z.$type==="bpmn:SequenceFlow"){p.push({id:Z.id,source:ni(Z.sourceRef),target:ni(Z.targetRef),...typeof Z.name=="string"&&Z.name?{name:Z.name}:{}});continue}if(Z.$type==="bpmn:DataStoreReference"){x(Z.id),a.push({id:Z.id,...Z.name?{name:Z.name}:{}});continue}const $=RE(Z.$type);if(!Sf($)){u.push({id:Z.id,type:Z.$type,reason:"type-outside-mvp"});continue}x(Z.id),o.push({id:Z.id,type:$,...Z.name?{name:Z.name}:{},...re?{participant:re}:{},...se.has(Z.id)?{lane:se.get(Z.id)}:{}});const N=Od(Z,"bwl:band");N!==void 0&&(l.bands[Z.id]=N);for(const V of Z.dataOutputAssociations??[])b(V.id),h.push({id:V.id,type:V.$type,source:Z.id,target:ni(V.targetRef)});for(const V of Z.dataInputAssociations??[])b(V.id),h.push({id:V.id,type:V.$type,source:ni((V.sourceRef??[])[0]),target:Z.id})}I(Y.artifacts??[])};if(n){const Y=new Set;for(const re of n.participants??[]){x(re.id);const le=ni(re.processRef);le&&Y.add(le);const ae=le?i.get(le):void 0,se=((ae==null?void 0:ae.laneSets)??[]).flatMap(V=>V.lanes??[]),Z=se.map(V=>({id:V.id,...V.name?{name:V.name}:{}}));for(const V of Z)x(V.id);const $=!ae||(ae.flowElements??[]).length===0&&se.length===0&&(ae.artifacts??[]).length===0;r.push({id:re.id,...re.name?{name:re.name}:{},...$?{blackBox:!0}:{},...Z.length?{lanes:Z}:{}});const N=Od(re,"bwl:poolOrder");N!==void 0&&(l.poolOrders[re.id]=N),ae&&P(ae,re.id)}for(const re of n.messageFlows??[])b(re.id),f.push({id:re.id,source:ni(re.sourceRef),target:ni(re.targetRef),...typeof re.name=="string"&&re.name?{name:re.name}:{}});I(n.artifacts??[]);for(const[re,le]of i)!Y.has(re)&&(le.flowElements??[]).length>0&&u.push({id:re,type:le.$type,reason:"unreachable-process"})}else for(const Y of i.values())P(Y);const j=[],F=[],L=[],H=[],oe=(Y,re)=>!!Y&&!!re&&E.has(Y)&&E.has(re);for(const Y of p){if(!oe(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}:{}}),E.add(Y.id)}for(const Y of f){if(!oe(Y.source,Y.target)){u.push({id:Y.id,type:"bpmn:MessageFlow",reason:"endpoint-outside-mvp"});continue}F.push({id:Y.id,source:Y.source,target:Y.target,...Y.name?{name:Y.name}:{}}),E.add(Y.id)}for(const Y of h){if(!oe(Y.source,Y.target)){u.push({id:Y.id??"",type:Y.type,reason:"endpoint-outside-mvp"});continue}H.push({...Y.id?{id:Y.id}:{},source:Y.source,target:Y.target}),Y.id&&E.add(Y.id)}for(const Y of d){if(!oe(Y.source,Y.target)){u.push({id:Y.id??"",type:Y.type,reason:"endpoint-outside-mvp"});continue}L.push({...Y.id?{id:Y.id}:{},source:Y.source,target:Y.target})}const Te=new Map(c.map(Y=>[Y.id,Y]));for(const{owner:Y,refs:re}of g){const le=re.filter(se=>S.has(se)),ae=Te.get(Y);ae&&le.length&&(ae.members=le)}for(const Y of m)S.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,...F.length?{messageFlows:F}:{},...a.length?{dataStores:a}:{},...H.length?{dataAssociations:H}:{},...s.length?{annotations:s}:{},...L.length?{associations:L}:{},...c.length?{groups:c}:{}},hints:l,omitted:u}}async function AE(e){const{definitions:t,warnings:n}=await Cu(e);return{...Ld(t),warnings:n}}function TE(e,t,n,i={}){return{documentId:e,baseVersion:t,ops:[...n],origin:i.origin??"agent",clientOpId:(i.mkClientOpId??(()=>crypto.randomUUID()))()}}async function Nd(e,t,{currentVersion:n}){if(t.baseVersion!==n)return{status:"conflict",baseVersion:t.baseVersion,currentVersion:n};const i=Dd(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 ME=Symbol("bpmn-editor");function kE(){const e=_t.ref(!1),t=_t.ref(!0),n=_t.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 Nd(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:Pu(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 te(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 Iu={exports:{}},Bd;function OE(){if(Bd)return Iu.exports;Bd=1;var e=Iu.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},Iu.exports}var IE=OE(),LE=DE(IE);function ii(e){if(!(this instanceof ii))return new ii(e);e=e||[128,36,1],this._seed=e.length?LE.rack(e[0],e[1],e[2]):e}ii.prototype.next=function(e){return this._seed(e||!0)},ii.prototype.nextPrefixed=function(e,t){var n;do n=e+this.next(!0);while(this.assigned(n));return this.claim(n,t),n},ii.prototype.claim=function(e,t){this._seed.set(e,t||!0)},ii.prototype.assigned=function(e){return this._seed.get(e)||!1},ii.prototype.unclaim=function(e){delete this._seed.hats[e]},ii.prototype.clear=function(){var e=this._seed.hats,t;for(t in e)this.unclaim(t)};const Tt={legend:[1,"<fieldset>","</fieldset>"],tr:[2,"<table><tbody>","</tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],_default:[0,"",""]};Tt.td=Tt.th=[3,"<table><tbody><tr>","</tr></tbody></table>"],Tt.option=Tt.optgroup=[1,'<select multiple="multiple">',"</select>"],Tt.thead=Tt.tbody=Tt.colgroup=Tt.caption=Tt.tfoot=[1,"<table>","</table>"],Tt.polyline=Tt.ellipse=Tt.polygon=Tt.circle=Tt.text=Tt.line=Tt.path=Tt.rect=Tt.g=[1,'<svg xmlns="http://www.w3.org/2000/svg" version="1.1">',"</svg>"];function Qe(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(Tt,i)?Tt[i]:Tt._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 NE(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 cn(e,...t){const n=e.style;return M(t,function(i){i&&M(i,function(r,o){n[o]=r})}),e}function Qt(e,t,n){return arguments.length==2?e.getAttribute(t):n===null?e.removeAttribute(t):(e.setAttribute(t,n),e)}const BE=Object.prototype.toString;function rt(e){return new zi(e)}function zi(e){if(!e||!e.nodeType)throw new Error("A DOM element reference is required");this.el=e,this.list=e.classList}zi.prototype.add=function(e){return this.list.add(e),this},zi.prototype.remove=function(e){return BE.call(e)=="[object RegExp]"?this.removeMatching(e):(this.list.remove(e),this)},zi.prototype.removeMatching=function(e){const t=this.array();for(let n=0;n<t.length;n++)e.test(t[n])&&this.remove(t[n]);return this},zi.prototype.toggle=function(e,t){return typeof t<"u"?t!==this.list.toggle(e,t)&&this.list.toggle(e):this.list.toggle(e),this},zi.prototype.array=function(){return Array.from(this.list)},zi.prototype.has=zi.prototype.contains=function(e){return this.list.contains(e)};function ns(e){for(var t;t=e.firstChild;)e.removeChild(t);return e}function wr(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 is={},$d;function jE(){if($d)return is;$d=1;var e,t,n;function i(){e=window.addEventListener?"addEventListener":"attachEvent",t=window.removeEventListener?"removeEventListener":"detachEvent",n=e!=="addEventListener"?"on":""}return is.bind=function(r,o,a,s){return e||i(),r[e](n+o,a,s||!1),a},is.unbind=function(r,o,a,s){return t||i(),r[t](n+o,a,s||!1),a},is}var jd=jE(),FE=$E(jd),me=NE({__proto__:null,default:FE},[jd]),Fd=["focus","blur"];function HE(e,t,n,i,r){return Fd.indexOf(n)!==-1&&(r=!0),me.bind(e,n,function(o){var a=o.target||o.srcElement;o.delegateTarget=wr(a,t,!0),o.delegateTarget&&i.call(e,o)},r)}function zE(e,t,n,i){return Fd.indexOf(t)!==-1&&(i=!0),me.unbind(e,t,n,i)}var vn={bind:HE,unbind:zE};function Lu(e,t){return e&&typeof e.matches=="function"&&e.matches(t)||!1}function Ge(e,t){return t=t||document,t.querySelector(e)}function rs(e,t){return t=t||document,t.querySelectorAll(e)}function ri(e){e.parentNode&&e.parentNode.removeChild(e)}function VE(e,t){if(e.ownerDocument!==t.ownerDocument)try{return t.ownerDocument.importNode(e,!0)}catch{}return e}function GE(e,t){return t.appendChild(VE(e,t))}function ve(e,t){return GE(t,e),e}var Nu=2,Hd={"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":Nu,"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":Nu,"text-anchor":1,"text-decoration":1,"text-rendering":1,"unicode-bidi":1,visibility:1,"word-spacing":1,"writing-mode":1};function WE(e,t){return Hd[t]?e.style[t]:e.getAttributeNS(null,t)}function zd(e,t,n){var i=t.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase(),r=Hd[i];r?(r===Nu&&typeof n=="number"&&(n=String(n)+"px"),e.style[i]=n):e.setAttributeNS(null,t,n)}function UE(e,t){var n=Object.keys(t),i,r;for(i=0,r;r=n[i];i++)zd(e,r,t[r])}function ne(e,t,n){if(typeof t=="string")if(n!==void 0)zd(e,t,n);else return WE(e,t);else UE(e,t);return e}const qE=Object.prototype.toString;function Ae(e){return new Vi(e)}function Vi(e){if(!e||!e.nodeType)throw new Error("A DOM element reference is required");this.el=e,this.list=e.classList}Vi.prototype.add=function(e){return this.list.add(e),this},Vi.prototype.remove=function(e){return qE.call(e)=="[object RegExp]"?this.removeMatching(e):(this.list.remove(e),this)},Vi.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},Vi.prototype.toggle=function(e,t){return typeof t<"u"?t!==this.list.toggle(e,t)&&this.list.toggle(e):this.list.toggle(e),this},Vi.prototype.array=function(){return Array.from(this.list)},Vi.prototype.has=Vi.prototype.contains=function(e){return this.list.contains(e)};function os(e){for(var t;t=e.firstChild;)e.removeChild(t);return e}function Vd(e){return e.cloneNode(!0)}var Bu={svg:"http://www.w3.org/2000/svg"},Gd='<svg xmlns="'+Bu.svg+'"';function YE(e){var t=!1;e.substring(0,4)==="<svg"?e.indexOf(Bu.svg)===-1&&(e=Gd+e.substring(4)):(e=Gd+">"+e+"</svg>",t=!0);var n=KE(e);if(!t)return n;for(var i=document.createDocumentFragment(),r=n.firstChild;r.firstChild;)i.appendChild(r.firstChild);return i}function KE(e){var t;return t=new DOMParser,t.async=!1,t.parseFromString(e,"text/xml")}function ce(e,t){var n;return e=e.trim(),e.charAt(0)==="<"?(n=YE(e).firstChild,n=document.importNode(n,!0)):n=document.createElementNS(Bu.svg,e),t&&ne(n,t),n}var $u=null;function Wd(){return $u===null&&($u=ce("svg")),$u}function Ud(e,t){var n,i,r=Object.keys(t);for(n=0;i=r[n];n++)e[i]=t[i];return e}function XE(e,t,n,i,r,o){var a=Wd().createSVGMatrix();switch(arguments.length){case 0:return a;case 1:return Ud(a,e);case 6:return Ud(a,{a:e,b:t,c:n,d:i,e:r,f:o})}}function Lo(e){return Wd().createSVGTransform()}var qd=/([&<>]{1})/g,ZE=/([&<>\n\r"]{1})/g,QE={"&":"&","<":"<",">":">",'"':"'"};function ju(e,t){function n(i,r){return QE[r]||r}return e.replace(t,n)}function Yd(e,t){var n,i,r,o,a;switch(e.nodeType){case 3:t.push(ju(e.textContent,qd));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,'="',ju(o.value,ZE),'"');if(e.hasChildNodes()){for(t.push(">"),a=e.childNodes,n=0,i=a.length;n<i;++n)Yd(a.item(n),t);t.push("</",e.tagName,">")}else t.push("/>");break;case 8:t.push("<!--",ju(e.nodeValue,qd),"-->");break;case 4:t.push("<![CDATA[",e.nodeValue,"]]>");break;default:throw new Error("unable to handle node "+e.nodeType)}return t}function JE(e){for(var t=e.firstChild,n=[];t;)Yd(t,n),t=t.nextSibling;return n.join("")}function Kd(e,t){return JE(e)}function Mt(e){var t=e.parentNode;return t&&t.removeChild(e),e}function ew(e,t){return t instanceof SVGMatrix?e.createSVGTransformFromMatrix(t):t}function tw(e,t){var n,i;for(e.clear(),n=0;i=t[n];n++)e.appendItem(ew(e,i))}function No(e,t){var n=e.transform.baseVal;return t&&(Array.isArray(t)||(t=[t]),tw(n,t)),n.consolidate()}const nw=/^class[ {]/;function iw(e){return nw.test(e.toString())}function Fu(e){return Array.isArray(e)}function Hu(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function as(...e){e.length===1&&Fu(e[0])&&(e=e[0]),e=[...e];const t=e.pop();return t.$inject=e,t}const rw=/constructor\s*[^(]*\(\s*([^)]*)\)/m,ow=/^(?:async\s+)?(?:function\s*[^(]*)?(?:\(\s*([^)]*)\)|(\w+))/m,aw=/\/\*([^*]*)\*\//m;function sw(e){if(typeof e!="function")throw new Error(`Cannot annotate "${e}". Expected a function!`);const t=e.toString().match(iw(e)?rw:ow);if(!t)return[];const n=t[1]||t[2];return n&&n.split(",").map(i=>{const r=i.match(aw);return(r&&r[1]||i).trim()})||[]}function Xd(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 w=b.split(".");let T=c(w.shift());for(;w.length;)T=T[w.shift()];return T}if(Hu(o,b))return o[b];if(Hu(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(Fu(b))b=as(b.slice());else throw s(`Cannot invoke "${b}". Expected a function!`);const T=(b.$inject||sw(b)).map(I=>Hu(x,I)?x[I]:c(I));return{fn:b,dependencies:T}}function l(b){const{fn:x,dependencies:w}=u(b),T=Function.prototype.bind.call(x,null,...w);return new T}function p(b,x,w){const{fn:T,dependencies:I}=u(b,w);return T.apply(x,I)}function f(b){return as(x=>b.get(x))}function d(b,x){if(x&&x.length){const w=Object.create(null),T=Object.create(null),I=[],P=[],j=[];let F,L,H,oe;for(let Te in r)F=r[Te],x.indexOf(Te)!==-1&&(F[2]==="private"?(L=I.indexOf(F[3]),L===-1?(H=F[3].createChild([],x),oe=f(H),I.push(F[3]),P.push(H),j.push(oe),w[Te]=[oe,Te,"private",H]):w[Te]=[j[L],Te,"private",P[L]]):w[Te]=[F[2],F[1]],T[Te]=!0),(F[2]==="factory"||F[2]==="type")&&F[1].$scope&&x.forEach(ot=>{F[1].$scope.indexOf(ot)!==-1&&(w[Te]=[F[2],F[1]],T[ot]=!0)});x.forEach(Te=>{if(!T[Te])throw new Error('No provider for "'+Te+'". Cannot use provider from the parent!')}),b.unshift(w)}return new Xd(b,a)}const h={factory:p,type:l,value:function(b){return b}};function m(b,x){const w=b.__init__||[];return function(){w.forEach(T=>{typeof T=="string"?x.get(T):x.invoke(T)})}}function g(b){const x=b.__exports__;if(x){const w=b.__modules__,T=Object.keys(b).reduce((L,H)=>(H!=="__exports__"&&H!=="__modules__"&&H!=="__init__"&&H!=="__depends__"&&(L[H]=b[H]),L),Object.create(null)),I=(w||[]).concat(T),P=d(I),j=as(function(L){return P.get(L)});x.forEach(function(L){r[L]=[j,L,"private",P]});const F=(b.__init__||[]).slice();return F.unshift(function(){P.init()}),b=Object.assign({},b,{__init__:F}),m(b,P)}return Object.keys(b).forEach(function(w){if(w==="__init__"||w==="__depends__")return;const T=b[w];if(T[2]==="private"){r[w]=T;return}const I=T[0],P=T[1];r[w]=[h[I],cw(I,P),I]}),m(b,a)}function S(b,x){return b.indexOf(x)!==-1||(b=(x.__depends__||[]).reduce(S,b),b.indexOf(x)!==-1)?b:b.concat(x)}function E(b){const x=b.reduce(S,[]).map(g);let w=!1;return function(){w||(w=!0,x.forEach(T=>T()))}}this.get=c,this.invoke=p,this.instantiate=l,this.createChild=d,this.init=E(e)}function cw(e,t){return e!=="value"&&Fu(t)&&(t=as(t.slice())),t}var uw=1e3;function _i(e,t){var n=this;t=t||uw,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)})}_i.prototype.canRender=function(e){},_i.prototype.drawShape=function(e,t){},_i.prototype.drawConnection=function(e,t){},_i.prototype.getShapePath=function(e){},_i.prototype.getConnectionPath=function(e){};function Sr(e){return e.flat().join(",").replace(/,?([A-Za-z]),?/g,"$1")}function lw(e){return["M",e.x,e.y]}function zu(e){return["L",e.x,e.y]}function pw(e,t,n){return["C",e.x,e.y,t.x,t.y,n.x,n.y]}function fw(e,t){const n=e.length,i=[lw(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(zu(a));continue}const c=Math.min(t,Vu(a.x-o.x,a.y-o.y),Vu(s.x-a.x,s.y-a.y));if(!c){i.push(zu(a));continue}const u=ss(a,o,c),l=ss(a,o,c*.5),p=ss(a,s,c),f=ss(a,s,c*.5);i.push(zu(u)),i.push(pw(l,f,p))}return i}function ss(e,t,n){const i=t.x-e.x,r=t.y-e.y,o=Vu(i,r),a=n/o;return{x:e.x+i*a,y:e.y+r*a}}function Vu(e,t){return Math.sqrt(Math.pow(e,2)+Math.pow(t,2))}function Bo(e,t,n){he(t)&&(n=t,t=null),t||(t={});const i=ce("path",t);return he(n)&&(i.dataset.cornerRadius=String(n)),Gu(i,e)}function Gu(e,t){const n=parseInt(e.dataset.cornerRadius,10)||0;return ne(e,{d:Sr(fw(t,n))}),e}function cs(e){var t=new Set(e);return Re(e,function(n){for(var i=n.parent;i;){if(t.has(i))return!1;i=i.parent}return!0})}function Rr(e,t,n){n=n||0,pe(e)||(e=[e]),M(e,function(i,r){var o=t(i,r,n);pe(o)&&o.length&&Rr(o,t,n+1)})}function Wu(e,t,n){var i=new Set,r=new Set;return Rr(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 $o(e,t){return Wu(e)}function dw(e,t,n){vr(t)&&(t=!0),It(t)&&(n=t,t=!0),n=n||{};var i=jo(n.allShapes),r=jo(n.allConnections),o=jo(n.enclosedElements),a=jo(n.enclosedConnections),s=jo(n.topLevel,t&&Gr(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 Rr(e,u),{allShapes:i,allConnections:r,topLevel:s,enclosedConnections:a,enclosedElements:o}}function bt(e,t){t=!!t,pe(e)||(e=[e]);var n,i,r,o;return M(e,function(a){var s=a;a.waypoints&&!t&&(s=bt(a.waypoints,!0));var c=s.x,u=s.y,l=s.height||0,p=s.width||0;(c<n||n===void 0)&&(n=c),(u<i||i===void 0)&&(i=u),(c+p>r||r===void 0)&&(r=c+p),(u+l>o||o===void 0)&&(o=u+l)}),{x:n,y:i,height:o-i,width:r-n}}function Xr(e,t){var n={};return M(e,function(i){var r=i;r.waypoints&&(r=bt(r)),!he(t.y)&&r.x>t.x&&(n[i.id]=i),!he(t.x)&&r.y>t.y&&(n[i.id]=i),r.x>t.x&&r.y>t.y&&(he(t.width)&&he(t.height)&&r.width+r.x<t.width+t.x&&r.height+r.y<t.height+t.y||!he(t.width)||!he(t.height))&&(n[i.id]=i)}),n}function Zd(e){return"waypoints"in e?"connection":"x"in e?"shape":"root"}function Qd(e){return!!(e&&e.isFrame)}function jo(e,t){return D({},e||{},t||{})}var hw=1;function Gi(e,t){_i.call(this,e,hw),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})}te(Gi,_i),Gi.prototype.canRender=function(){return!0},Gi.prototype.drawShape=function(t,n,i){var r=ce("rect");return ne(r,{x:0,y:0,width:n.width||0,height:n.height||0}),Qd(n)?ne(r,D({},this.FRAME_STYLE,i||{})):ne(r,D({},this.SHAPE_STYLE,i||{})),ve(t,r),r},Gi.prototype.drawConnection=function(t,n,i){var r=Bo(n.waypoints,D({},this.CONNECTION_STYLE,i||{}));return ve(t,r),r},Gi.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 Sr(a)},Gi.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 Sr(o)},Gi.$inject=["eventBus","styles"];function mw(){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 D(o,{class:n})},this.style=function(n,i){!pe(n)&&!i&&(i=n,n=[]);var r=gn(n,function(o,a){return D(o,e[a]||{})},{});return i?D(r,i):r},this.computeStyle=function(n,i,r){return pe(i)||(r=i,i=[]),t.style(i||[],D({},r,n||{}))}}const gw={__init__:["defaultRenderer"],defaultRenderer:["type",Gi],styles:["type",mw]};function pt(e,t){if(!e||!t)return-1;var n=e.indexOf(t);return n!==-1&&e.splice(n,1),n}function gt(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 Uu(e,t){return!e||!t?-1:e.indexOf(t)}function Fo(e,t){return!e||!t?-1:Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function qu(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=Fo(e,t);return Math.abs(r/o)<=i}var vw=2;function bi(e,t){var n=Array.from(arguments).flat();const i={x:"v",y:"h"};for(const[r,o]of Object.entries(i))if(yw(r,n))return o;return!1}function yw(e,t){const n=t[0];return yr(t,function(i){return Math.abs(n[e]-i[e])<=vw})}function Jd(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 Yu(e,t){return{x:Math.round(e.x+(t.x-e.x)/2),y:Math.round(e.y+(t.y-e.y)/2)}}var _w=/,?([a-z]),?/gi,eh=parseFloat,xt=Math,Wi=xt.PI,oi=xt.min,ai=xt.max,th=xt.pow,Ui=xt.abs,bw=/([a-z])[\s,]*((-?\d*\.?\d*(?:e[-+]?\d+)?[\s]*,?[\s]*)+)/ig,xw=/(-?\d*\.?\d*(?:e[-+]?\d+)?)[\s]*,?[\s]*/ig,nh=Array.isArray||function(e){return e instanceof Array};function Ew(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function ww(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 Sw(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 Ew(r,i)?(ww(o,i),r[i]):(o.length>=1e3&&delete r[o.shift()],o.push(i),r[i]=e(...arguments),r[i])}return t}function Rw(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(bw,function(i,r,o){var a=[],s=r.toLowerCase();for(o.replace(xw,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=Xu,n}function Cw(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 Pw(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 Ku(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 Xu(){return this.join(",").replace(_w,"$1")}function Aw(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=Xu,t}function ih(e,t,n,i,r,o,a,s,c){var u=1-c,l=th(u,3),p=th(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:us(h),y:us(m)}}function rh(e){var t=Iw(...e);return Ku(t.x0,t.y0,t.x1-t.x0,t.y1-t.y0)}function qi(e,t,n){return t>=e.x&&t<=e.x+e.width&&n>=e.y&&n<=e.y+e.height}function Tw(e,t){return e=Ku(e),t=Ku(t),qi(t,e.x,e.y)||qi(t,e.x2,e.y)||qi(t,e.x,e.y2)||qi(t,e.x2,e.y2)||qi(e,t.x,t.y)||qi(e,t.x2,t.y)||qi(e,t.x,t.y2)||qi(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 oh(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 ah(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=oh(m,e,n,r,a),S=oh(m,t,i,o,s),E=g*g+S*S;d+=f[h]*xt.sqrt(E)}return u*d}function Mw(e,t,n,i,r,o,a,s){if(!(ai(e,n)<oi(r,a)||oi(e,n)>ai(r,a)||ai(t,i)<oi(o,s)||oi(t,i)>ai(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=us(c/l),f=us(u/l),d=+p.toFixed(2),h=+f.toFixed(2);if(!(d<+oi(e,n).toFixed(2)||d>+ai(e,n).toFixed(2)||d<+oi(r,a).toFixed(2)||d>+ai(r,a).toFixed(2)||h<+oi(t,i).toFixed(2)||h>+ai(t,i).toFixed(2)||h<+oi(o,s).toFixed(2)||h>+ai(o,s).toFixed(2)))return{x:p,y:f}}}}function us(e){return Math.round(e*1e11)/1e11}function kw(e,t,n){var i=rh(e),r=rh(t);if(!Tw(i,r))return[];var o=ah(...e),a=ah(...t),s=ch(e)?1:~~(o/5)||1,c=ch(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=ih(...e,d/s);u[d]={x:m.x,y:m.y,t:d/s}}for(d=0;d<c+1;d++)m=ih(...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],S=u[d+1],E=l[h],b=l[h+1],x=Ui(S.x-g.x)<.01?"y":"x",w=Ui(b.x-E.x)<.01?"y":"x",T=Mw(g.x,g.y,S.x,S.y,E.x,E.y,b.x,b.y),I;if(T){if(I=T.x.toFixed(9)+"#"+T.y.toFixed(9),p[I])continue;p[I]=!0;var P=g.t+Ui((T[x]-g[x])/(S[x]-g[x]))*(S.t-g.t),j=E.t+Ui((T[w]-E[w])/(b[w]-E[w]))*(b.t-E.t);P>=0&&P<=1&&j>=0&&j<=1&&f.push({x:T.x,y:T.y,t1:P,t2:j})}}return f}function sh(e,t,n){e=ph(e),t=ph(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 S=0,E=t.length;S<E;S++){var b=t[S];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=kw(p,f);{for(var w=0,T=x.length;w<T;w++)x[w].segment1=h,x[w].segment2=S,x[w].bez1=p,x[w].bez2=f;d=d.concat(x)}}}}}return d}function Dw(e){return nh(e)&&nh(e[0])}function Ow(e){if(Cw(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=Xu,t}function ch(e){return e[0]===e[2]&&e[1]===e[3]&&e[4]===e[6]&&e[5]===e[7]}function ls(e,t,n,i){return[e,t,n,i,n,i]}function uh(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 lh(e,t,n,i,r,o,a,s,c,u){var l=Wi*120/180,p=Wi/180*(+r||0),f=[],d,h=Sw(function(C,_,v){var k=C*xt.cos(v)-_*xt.sin(v),O=C*xt.sin(v)+_*xt.cos(v);return{x:k,y:O}});if(u)I=u[0],P=u[1],w=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,S=m*m/(n*n)+g*g/(i*i);S>1&&(S=xt.sqrt(S),n=S*n,i=S*i);var E=n*n,b=i*i,x=(o==a?-1:1)*xt.sqrt(Ui((E*b-E*g*g-b*m*m)/(E*g*g+b*m*m))),w=x*n*g/i+(e+s)/2,T=x*-i*m/n+(t+c)/2,I=xt.asin(((t-T)/i).toFixed(9)),P=xt.asin(((c-T)/i).toFixed(9));I=e<w?Wi-I:I,P=s<w?Wi-P:P,I<0&&(I=Wi*2+I),P<0&&(P=Wi*2+P),a&&I>P&&(I=I-Wi*2),!a&&P>I&&(P=P-Wi*2)}var j=P-I;if(Ui(j)>l){var F=P,L=s,H=c;P=I+l*(a&&P>I?1:-1),s=w+n*xt.cos(P),c=T+i*xt.sin(P),f=lh(s,c,n,i,r,0,a,L,H,[P,F,w,T])}j=P-I;var oe=xt.cos(I),Te=xt.sin(I),ot=xt.cos(P),Y=xt.sin(P),re=xt.tan(j/4),le=4/3*n*re,ae=4/3*i*re,se=[e,t],Z=[e+le*Te,t-ae*oe],$=[s+le*Y,c-ae*ot],N=[s,c];if(Z[0]=2*se[0]-Z[0],Z[1]=2*se[1]-Z[1],u)return[Z,$,N].concat(f);f=[Z,$,N].concat(f).join().split(",");for(var V=[],we=0,vt=f.length;we<vt;we++)V[we]=we%2?h(f[we-1],f[we],p).y:h(f[we],f[we+1],p).x;return V}function Iw(e,t,n,i,r,o,a,s){for(var c=[],u=[[],[]],l,p,f,d,h,m,g,S,E=0;E<2;++E){if(E==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),Ui(l)<1e-12){if(Ui(p)<1e-12)continue;d=-f/p,0<d&&d<1&&c.push(d);continue}g=p*p-4*f*l,S=xt.sqrt(g),!(g<0)&&(h=(-p+S)/(2*l),0<h&&h<1&&c.push(h),m=(-p-S)/(2*l),0<m&&m<1&&c.push(m))}for(var b=c.length,x=b,w;b--;)d=c[b],w=1-d,u[0][b]=w*w*w*e+3*w*w*d*n+3*w*d*d*r+d*d*d*a,u[1][b]=w*w*w*t+3*w*w*d*i+3*w*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:oi(...u[0]),y0:oi(...u[1]),x1:ai(...u[0]),y1:ai(...u[1])}}function ph(e){if(Dw(e)||(e=Rw(e)),Pw(e))return e;for(var t=Aw(Ow(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",...lh(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",...uh(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",...uh(d.x,d.y,f[1],f[2],f[3],f[4])];break;case"L":f=["C",...ls(d.x,d.y,f[1],f[2])];break;case"H":f=["C",...ls(d.x,d.y,f[1],d.y)];break;case"V":f=["C",...ls(d.x,d.y,d.x,f[1])];break;case"Z":f=["C",...ls(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=eh(l[p-4])||n.x,n.by=eh(l[p-3])||n.y}return t}function Ue(e){return It(e)&&mn(e,"waypoints")}function xe(e){return It(e)&&mn(e,"labelTarget")}function Lw(e){return It(e)&&zr(e.parent)}function fh(e){return{x:Math.round(e.x),y:Math.round(e.y),width:Math.round(e.width),height:Math.round(e.height)}}function xi(e){return{x:Math.round(e.x),y:Math.round(e.y)}}function ue(e){return{top:e.y,right:e.x+(e.width||0),bottom:e.y+(e.height||0),left:e.x}}function ps(e){return{x:e.left,y:e.top,width:e.right-e.left,height:e.bottom-e.top}}function Nw(e){return xi({x:e.x+(e.width||0)/2,y:e.y+(e.height||0)/2})}function Bw(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=Fw(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 fe(e){return Ue(e)?Bw(e):Nw(e)}function Gt(e,t,n){n=n||0,It(n)||(n={x:n,y:n});var i=ue(e),r=ue(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 Ho(e,t,n){var i=$w(e,t);return i.length===1||i.length===2&&Fo(i[0],i[1])<1?xi(i[0]):i.length>1?(i=Jn(i,function(r){var o=Math.floor(r.t2*100)||1;return o=100-o,o=(o<10?"0":"")+o,r.segment2+"#"+o}),xi(i[n?0:i.length-1])):null}function $w(e,t){return sh(e,t)}function jw(e){e=e.slice();for(var t=0,n,i,r;e[t];)n=e[t],i=e[t-1],r=e[t+1],Fo(n,r)===0||qu(i,r,n)?e.splice(t,1):t++;return e}function Fw(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function fs(e,t){return Math.round(e*t)/t}function dh(e){return he(e)?e+"px":e}function Hw(e){for(;e.parent;)e=e.parent;return e}function zw(e){e=D({},{width:"100%",height:"100%"},e);const t=e.container||document.body,n=document.createElement("div");return n.setAttribute("class","djs-container djs-parent"),cn(n,{position:"relative",overflow:"hidden",width:dh(e.width),height:dh(e.height)}),t.appendChild(n),n}function hh(e,t,n){const i=ce("g");Ae(i).add(t);const r=n!==void 0?n:e.childNodes.length-1;return e.insertBefore(i,e.childNodes[r]||null),i}const Vw="base",mh=0,Gw=1,Ww={shape:["x","y","width","height"],connection:["waypoints"]};function de(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||{})}de.$inject=["config.canvas","eventBus","graphicsFactory","elementRegistry"],de.prototype._init=function(e){const t=this._eventBus,n=this._container=zw(e),i=this._svg=ce("svg");ne(i,{width:"100%",height:"100%"}),Qt(i,"tabindex",0),e.autoFocus&&t.on("element.hover",()=>{this.restoreFocus()}),t.on("element.mousedown",500,o=>{this.focus()}),i.addEventListener("focusin",()=>{this._setFocused(!0)}),i.addEventListener("focusout",()=>{this._setFocused(!1)}),i.addEventListener("mouseover",()=>{this._eventBus.fire("canvas.mouseover")}),i.addEventListener("mouseout",()=>{this._eventBus.fire("canvas.mouseout")}),ve(n,i);const r=this._viewport=hh(i,"viewport");e.deferUpdate&&(this._viewboxChanged=du(this._viewboxChanged,300)),this._restoreFocus=du(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)},de.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},de.prototype._setFocused=function(e){e!=this._focused&&(this._focused=e,this._eventBus.fire("canvas.focus.changed",{focused:e}))},de.prototype._clear=function(){this._elementRegistry.getAll().forEach(t=>{const n=Zd(t);n==="root"?this.removeRootElement(t):this._removeElement(t,n)}),this._planes=[],this._rootElement=null,delete this._cachedViewbox},de.prototype.focus=function(){this._svg.focus({preventScroll:!0}),this._setFocused(!0)},de.prototype.restoreFocus=function(){this._restoreFocus()},de.prototype._restoreFocus=function(){document.activeElement===document.body&&this.focus()},de.prototype.isFocused=function(){return this._focused},de.prototype.getDefaultLayer=function(){return this.getLayer(Vw,mh)},de.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},de.prototype._getChildIndex=function(e){return gn(this._layers,function(t,n){return n.visible&&e>=n.index&&t++,t},0)},de.prototype._createLayer=function(e,t){typeof t>"u"&&(t=Gw);const n=this._getChildIndex(t);return{group:hh(this._viewport,"layer-"+e,n),index:t,visible:!0}},de.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},de.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&&(Mt(n),t.visible=!1),n},de.prototype._removeLayer=function(e){const t=this._layers[e];t&&(delete this._layers[e],Mt(t.group))},de.prototype.getActiveLayer=function(){const e=this._findPlaneForRoot(this.getRootElement());return e?e.layer:null},de.prototype.findRoot=function(e){const t=this._resolveElements(e);let n;for(const i of t){const r=this._findPlaneForRoot(Hw(i));if(!r||n&&r.rootElement!==n)return;n=r.rootElement}return n},de.prototype.getRootElements=function(){return this._planes.map(function(e){return e.rootElement})},de.prototype._findPlaneForRoot=function(e){return Ke(this._planes,function(t){return t.rootElement===e})},de.prototype._resolveElement=function(e){return typeof e=="string"?this._elementRegistry.get(e):e},de.prototype._resolveElements=function(e){return pe(e)||(e=[e]),e.map(t=>this._resolveElement(t)).filter(Boolean)},de.prototype.getContainer=function(){return this._container},de.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),Ae(r).add(t)):(e.markers.delete(t),Ae(r).remove(t)))}),this._eventBus.fire("element.marker.update",{element:e,gfx:i.gfx,marker:t,add:!!n}))},de.prototype.addMarker=function(e,t){this._updateMarker(e,t,!0)},de.prototype.removeMarker=function(e,t){this._updateMarker(e,t,!1)},de.prototype.hasMarker=function(e,t){return e=this._resolveElement(e),e.markers?e.markers.has(t):!1},de.prototype.toggleMarker=function(e,t){this.hasMarker(e,t)?this.removeMarker(e,t):this.addMarker(e,t)},de.prototype.getRootElement=function(){const e=this._rootElement;return e||this._planes.length?e:this.setRootElement(this.addRootElement(null))},de.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,mh);return this.hideLayer(n),this._addRoot(e,i),this._planes.push({rootElement:e,layer:i}),e},de.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},de.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},de.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)},de.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})},de.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})},de.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=Ww[e];if(!yr(n,function(r){return typeof t[r]<"u"}))throw new Error("must supply { "+n.join(", ")+" } with "+e)},de.prototype._setParent=function(e,t,n){gt(t.children,e,n),e.parent=t},de.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},de.prototype.addShape=function(e,t,n){return this._addElement("shape",e,t,n)},de.prototype.addConnection=function(e,t,n){return this._addElement("connection",e,t,n)},de.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),pt(e.parent&&e.parent.children,e),e.parent=null,r.fire(t+".removed",{element:e}),n.remove(e),e},de.prototype.removeShape=function(e){return this._removeElement(e,"shape")},de.prototype.removeConnection=function(e){return this._removeElement(e,"connection")},de.prototype.getGraphics=function(e,t){return this._elementRegistry.getGraphics(e,t)},de.prototype._changeViewbox=function(e){this._eventBus.fire("canvas.viewbox.changing"),e.apply(this),this._cachedViewbox=null,this._viewboxChanged()},de.prototype._viewboxChanged=function(){this._eventBus.fire("canvas.viewbox.changed",{viewbox:this.viewbox()})},de.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);No(t,l)});else return o=this._rootElement?this.getActiveLayer():null,i=o&&o.getBBox()||{},a=No(t),r=a?a.matrix:XE(),s=fs(r.a,1e3),c=fs(-r.e||0,1e3),u=fs(-r.f||0,1e3),e=this._cachedViewbox={x:c?c/s:0,y:u?u/s:0,width:n.width/s,height:n.height/s,scale:s,inner:{width:i.width||0,height:i.height||0,x:i.x||0,y:i.y||0},outer:n},e;return e},de.prototype.scroll=function(e){const t=this._viewport;let n=t.getCTM();return e&&this._changeViewbox(function(){e=D({dx:0,dy:0},e||{}),n=this._svg.createSVGMatrix().translate(e.dx,e.dy).multiply(n),gh(t,n)}),{x:n.e,y:n.f}},de.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=bt(o),s=ue(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=ue(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),S=Math.min(0,s.top-f.top);l=h||m,p=g||S}this.scroll({dx:-l*u,dy:-p*u})},de.prototype.zoom=function(e,t){if(!e)return this.viewbox(e).scale;if(e==="fit-viewport")return this._fitViewport(t);let n,i;return this._changeViewbox(function(){typeof t!="object"&&(n=this.viewbox().outer,t={x:n.width/2,y:n.height/2}),i=this._setZoom(e,t)}),fs(i.a,1e3)};function gh(e,t){const n="matrix("+t.a+","+t.b+","+t.c+","+t.d+","+t.e+","+t.f+")";e.setAttribute("transform",n)}de.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},de.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=D(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),gh(this._viewport,l),l},de.prototype.getSize=function(){return{width:this._container.clientWidth,height:this._container.clientHeight}},de.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}},de.prototype.resized=function(){delete this._cachedViewbox,this._eventBus.fire("canvas.resized")};var Zr="data-element-id";function An(e){this._elements={},this._eventBus=e}An.$inject=["eventBus"],An.prototype.add=function(e,t,n){var i=e.id;this._validateId(i),ne(t,Zr,i),n&&ne(n,Zr,i),this._elements[i]={element:e,gfx:t,secondaryGfx:n}},An.prototype.remove=function(e){var t=this._elements,n=e.id||e,i=n&&t[n];i&&(ne(i.gfx,Zr,""),i.secondaryGfx&&ne(i.secondaryGfx,Zr,""),delete t[n])},An.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)},An.prototype.updateGraphics=function(e,t,n){var i=e.id||e,r=this._elements[i];return n?r.secondaryGfx=t:r.gfx=t,t&&ne(t,Zr,i),t},An.prototype.get=function(e){var t;typeof e=="string"?t=e:t=e&&ne(e,Zr);var n=this._elements[t];return n&&n.element},An.prototype.filter=function(e){var t=[];return this.forEach(function(n,i){e(n,i)&&t.push(n)}),t},An.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}},An.prototype.getAll=function(){return this.filter(function(e){return e})},An.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)})},An.prototype.getGraphics=function(e,t){var n=e.id||e,i=this._elements[n];return i&&(t?i.secondaryGfx:i.gfx)},An.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 Uw(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 qw(e){return e.__refs_collection===!0}function Yw(e,t){return Object.prototype.hasOwnProperty.call(e,t.name||t)}function vh(e,t,n){var i=Uw(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 Kw(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 In(e,t){if(!(this instanceof In))return new In(e,t);e.inverse=t,t.inverse=e,this.props={},this.props[e.name]=e,this.props[t.name]=t}In.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):Kw(this,t,e)},In.prototype.ensureRefsCollection=function(e,t){var n=e[t.name];return qw(n)||vh(this,t,e),n},In.prototype.ensureBound=function(e,t){Yw(e,t)||this.bind(e,t)},In.prototype.unset=function(e,t,n){e&&(this.ensureBound(e,t),t.collection?this.ensureRefsCollection(e,t).remove(n):e[t.name]=void 0)},In.prototype.set=function(e,t,n){e&&(this.ensureBound(e,t),t.collection?this.ensureRefsCollection(e,t).add(n):e[t.name]=n)};var Zu=new In({name:"children",enumerable:!0,collection:!0},{name:"parent"}),yh=new In({name:"labels",enumerable:!0,collection:!0},{name:"labelTarget"}),_h=new In({name:"attachers",collection:!0},{name:"host"}),bh=new In({name:"outgoing",collection:!0},{name:"source"}),xh=new In({name:"incoming",collection:!0},{name:"target"});function Qr(){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)}}),Zu.bind(this,"parent"),yh.bind(this,"labels"),bh.bind(this,"outgoing"),xh.bind(this,"incoming")}function zo(){Qr.call(this),Zu.bind(this,"children"),_h.bind(this,"host"),_h.bind(this,"attachers")}te(zo,Qr);function Eh(){Qr.call(this),Zu.bind(this,"children")}te(Eh,zo);function wh(){zo.call(this),yh.bind(this,"labelTarget")}te(wh,zo);function Sh(){Qr.call(this),bh.bind(this,"source"),xh.bind(this,"target")}te(Sh,Qr);var Xw={connection:Sh,shape:zo,label:wh,root:Eh};function Zw(e,t){var n=Xw[e];if(!n)throw new Error("unknown type: <"+e+">");return D(new n,t)}function Qw(e){return e instanceof Qr}function Ei(){this._uid=12}Ei.prototype.createRoot=function(e){return this.create("root",e)},Ei.prototype.createLabel=function(e){return this.create("label",e)},Ei.prototype.createShape=function(e){return this.create("shape",e)},Ei.prototype.createConnection=function(e){return this.create("connection",e)},Ei.prototype.create=function(e,t){return t=D({},t||{}),t.id||(t.id=e+"_"+this._uid++),Zw(e,t)};var ds="__fn",Rh=1e3,Jw=Array.prototype.slice;function yn(){this._listeners={},this.on("diagram.destroy",1,this._destroy,this)}yn.prototype.on=function(e,t,n,i){if(e=pe(e)?e:[e],Lt(t)&&(i=n,n=t,t=Rh),!he(t))throw new Error("priority must be a number");var r=n;i&&(r=pn(n,i),r[ds]=n[ds]||n);var o=this;e.forEach(function(a){o._addListener(a,{priority:t,callback:r,next:null})})},yn.prototype.once=function(e,t,n,i){var r=this;if(Lt(t)&&(i=n,n=t,t=Rh),!he(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[ds]=n,this.on(e,t,o)},yn.prototype.off=function(e,t){e=pe(e)?e:[e];var n=this;e.forEach(function(i){n._removeListener(i,t)})},yn.prototype.createEvent=function(e){var t=new Vo;return t.init(e),t},yn.prototype.fire=function(e,t){var n,i,r,o;if(o=Jw.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 Vo?n=t:n=this.createEvent(t),o[0]=n;var a=n.type;e!==a&&(n.type=e);try{r=this._invokeListeners(n,o,i)}finally{e!==a&&(n.type=a)}return r===void 0&&n.defaultPrevented&&(r=!1),r}},yn.prototype.handleError=function(e){return this.fire("error",{error:e})===!1},yn.prototype._destroy=function(){this._listeners={}},yn.prototype._invokeListeners=function(e,t,n){for(var i;n&&!e.cancelBubble;)i=this._invokeListener(e,t,n),n=n.next;return i},yn.prototype._invokeListener=function(e,t,n){var i;if(n.callback.__isTomb)return i;try{i=e1(n.callback,t),i!==void 0&&(e.returnValue=i,e.stopPropagation()),i===!1&&e.preventDefault()}catch(r){if(!this.handleError(r))throw console.error("unhandled error in event listener",r),r}return i},yn.prototype._addListener=function(e,t){var n=this._getListeners(e),i;if(!n){this._setListeners(e,t);return}for(;n;){if(n.priority<t.priority){t.next=n,i?i.next=t:this._setListeners(e,t);return}i=n,n=n.next}i.next=t},yn.prototype._getListeners=function(e){return this._listeners[e]},yn.prototype._setListeners=function(e,t){this._listeners[e]=t},yn.prototype._removeListener=function(e,t){var n=this._getListeners(e),i,r,o;if(!t){this._setListeners(e,null);return}for(;n;)i=n.next,o=n.callback,(o===t||o[ds]===t)&&(r?r.next=i:this._setListeners(e,i)),r=n,n=i};function Vo(){}Vo.prototype.stopPropagation=function(){this.cancelBubble=!0},Vo.prototype.preventDefault=function(){this.defaultPrevented=!0},Vo.prototype.init=function(e){D(this,e||{})};function e1(e,t){return e.apply(null,t)}function Cr(e){return e.childNodes[0]}function t1(e){return e.parentNode.childNodes[1]}function hs(e,t,n,i,r){var o=Lo();o.setTranslate(t,n);var a=Lo();a.setRotate(i||0,0,0);var s=Lo();s.setScale(1,1),No(e,[o,a,s])}function Wt(e,t,n){var i=Lo();i.setTranslate(t,n),No(e,i)}function Ch(e,t){var n=Lo();n.setRotate(t,0,0),No(e,n)}function Tn(e,t){this._eventBus=e,this._elementRegistry=t}Tn.$inject=["eventBus","elementRegistry"],Tn.prototype._getChildrenContainer=function(e){var t=this._elementRegistry.getGraphics(e),n;return e.parent?(n=t1(t),n||(n=ce("g"),Ae(n).add("djs-children"),ve(t.parentNode,n))):n=t,n},Tn.prototype._clear=function(e){var t=Cr(e);return ns(t),t},Tn.prototype._createContainer=function(e,t,n,i){var r=ce("g");Ae(r).add("djs-group"),typeof n<"u"?n1(r,t,t.childNodes[n]):ve(t,r);var o=ce("g");Ae(o).add("djs-element"),Ae(o).add("djs-"+e),i&&Ae(o).add("djs-frame"),ve(r,o);var a=ce("g");return Ae(a).add("djs-visual"),ve(o,a),o},Tn.prototype.create=function(e,t,n){var i=this._getChildrenContainer(t.parent);return this._createContainer(e,i,n,Qd(t))},Tn.prototype.updateContainments=function(e){var t=this,n=this._elementRegistry,i;i=gn(e,function(r,o){return o.parent&&(r[o.parent.id]=o.parent),r},{}),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)})}})},Tn.prototype.drawShape=function(e,t,n={}){var i=this._eventBus;return i.fire("render.shape",{gfx:e,element:t,attrs:n})},Tn.prototype.getShapePath=function(e){var t=this._eventBus;return t.fire("render.getShapePath",e)},Tn.prototype.drawConnection=function(e,t,n={}){var i=this._eventBus;return i.fire("render.connection",{gfx:e,element:t,attrs:n})},Tn.prototype.getConnectionPath=function(e){var t=this._eventBus;return t.fire("render.getConnectionPath",e)},Tn.prototype.update=function(e,t,n){if(t.parent){var i=this._clear(n);if(e==="shape")this.drawShape(i,t),Wt(n,t.x,t.y);else if(e==="connection")this.drawConnection(i,t);else throw new Error("unknown type: "+e);t.hidden?ne(n,"display","none"):ne(n,"display","block")}},Tn.prototype.remove=function(e){var t=this._elementRegistry.getGraphics(e);Mt(t.parentNode)};function n1(e,t,n){var i=n||t.firstChild;e!==i&&t.insertBefore(e,i)}const i1={__depends__:[gw],__init__:["canvas"],canvas:["type",de],elementRegistry:["type",An],elementFactory:["type",Ei],eventBus:["type",yn],graphicsFactory:["type",Tn]};function r1(e){var t=new Xd(e);return t.init(),t}function o1(e){e=e||{};var t={config:["value",e]},n=[t,i1].concat(e.modules||[]);return r1(n)}function Yi(e,t){this._injector=t||o1(e),this.get("eventBus").fire("diagram.init")}Yi.prototype.get=function(e,t){return this._injector.get(e,t)},Yi.prototype.invoke=function(e,t,n){return this._injector.invoke(e,t,n)},Yi.prototype.destroy=function(){this.get("eventBus").fire("diagram.destroy")},Yi.prototype.clear=function(){this.get("eventBus").fire("diagram.clear")};function Jt(e){return e?"<"+e.$type+(e.id?' id="'+e.id:"")+'" />':"<null>"}function fn(e,t){return e.$instanceOf(t)}function a1(e){return Ke(e.rootElements,function(t){return fn(t,"bpmn:Process")||fn(t,"bpmn:Collaboration")})}function s1(e){var t={},n=[],i={};function r($,N){return function(V){$(V,N)}}function o($){t[$.id]=$}function a($){return t[$.id]}function s($,N){var V=$.gfx;if(V)throw new Error(`already rendered ${Jt($)}`);return e.element($,i[$.id],N)}function c($,N){return e.root($,i[$.id],N)}function u($,N){try{var V=i[$.id]&&s($,N);return o($),V}catch(we){l(we.message,{element:$,error:we}),console.error(`failed to import ${Jt($)}`,we)}}function l($,N){e.error($,N)}var p=this.registerDi=function(N){var V=N.bpmnElement;V?i[V.id]?l(`multiple DI elements defined for ${Jt(V)}`,{element:V}):i[V.id]=N:l(`no bpmnElement referenced in ${Jt(N)}`,{element:N})};function f($){d($.plane)}function d($){p($),M($.planeElement,h)}function h($){p($)}this.handleDefinitions=function(N,V){var we=N.diagrams;if(V&&we.indexOf(V)===-1)throw new Error("diagram not part of <bpmn:Definitions />");if(!V&&we&&we.length&&(V=we[0]),!V)throw new Error("no diagram to display");i={},f(V);var vt=V.plane;if(!vt)throw new Error(`no plane for ${Jt(V)}`);var C=vt.bpmnElement;if(!C)if(C=a1(N),C)l(`correcting missing bpmnElement on ${Jt(vt)} to ${Jt(C)}`),vt.bpmnElement=C,p(vt);else throw new Error("no process or collaboration to display");var _=c(C,vt);if(fn(C,"bpmn:Process")||fn(C,"bpmn:SubProcess"))g(C,_);else if(fn(C,"bpmn:Collaboration"))se(C,_),S(N.rootElements,_);else throw new Error(`unsupported bpmnElement for ${Jt(vt)}: ${Jt(C)}`);m(n)};var m=this.handleDeferred=function(){for(var N;n.length;)N=n.shift(),N()};function g($,N){re($,N),j($.ioSpecification,N),P($.artifacts,N),o($)}function S($,N){var V=Re($,function(we){return!a(we)&&fn(we,"bpmn:Process")&&we.laneSets});V.forEach(r(g,N))}function E($,N){u($,N)}function b($,N){M($,r(E,N))}function x($,N){u($,N)}function w($,N){u($,N)}function T($,N){u($,N)}function I($,N){u($,N)}function P($,N){M($,function(V){fn(V,"bpmn:Association")?n.push(function(){I(V,N)}):I(V,N)})}function j($,N){$&&(M($.dataInputs,r(w,N)),M($.dataOutputs,r(T,N)))}var F=this.handleSubProcess=function(N,V){re(N,V),P(N.artifacts,V)};function L($,N){var V=u($,N);fn($,"bpmn:SubProcess")&&F($,V||N),fn($,"bpmn:Activity")&&j($.ioSpecification,N),n.push(function(){M($.dataInputAssociations,r(x,N)),M($.dataOutputAssociations,r(x,N))})}function H($,N){u($,N)}function oe($,N){u($,N)}function Te($,N){n.push(function(){var V=u($,N);$.childLaneSet&&ot($.childLaneSet,V||N),Z($)})}function ot($,N){M($.lanes,r(Te,N))}function Y($,N){M($,r(ot,N))}function re($,N){le($.flowElements,N),$.laneSets&&Y($.laneSets,N)}function le($,N){M($,function(V){fn(V,"bpmn:SequenceFlow")?n.push(function(){H(V,N)}):fn(V,"bpmn:BoundaryEvent")?n.unshift(function(){L(V,N)}):fn(V,"bpmn:FlowNode")?L(V,N):fn(V,"bpmn:DataObject")||(fn(V,"bpmn:DataStoreReference")||fn(V,"bpmn:DataObjectReference")?oe(V,N):l(`unrecognized flowElement ${Jt(V)} in context ${Jt(N&&N.businessObject)}`,{element:V,context:N}))})}function ae($,N){var V=u($,N),we=$.processRef;we&&g(we,V||N)}function se($,N){M($.participants,r(ae,N)),n.push(function(){b($.messageFlows,N)}),P($.artifacts,N)}function Z($){M($.flowNodeRef,function(N){var V=N.get("lanes");V&&V.push($)})}}function y(e,t){var n=q(e);return n&&typeof n.$instanceOf=="function"&&n.$instanceOf(t)}function Ee(e,t){return Li(t,function(n){return y(e,n)})}function q(e){return e&&e.businessObject||e}function ke(e){return e&&e.di}function c1(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,S){return i.add(m,g,S)},error:function(m,g){s.push({message:m,context:g})}},f=new s1(p);l=l||u.diagrams&&u.diagrams[0];var d=u1(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 u1(e,t){if(!(!t||!t.plane)){var n=t.plane.bpmnElement,i=n;!y(n,"bpmn:Process")&&!y(n,"bpmn:Collaboration")&&(i=l1(n));var r;y(i,"bpmn:Collaboration")?r=i:r=Ke(e.rootElements,function(u){if(y(u,"bpmn:Collaboration"))return Ke(u.participants,function(l){return l.processRef===i})});var o=[i];r&&(o=Kt(r.participants,function(u){return u.processRef}),o.push(r));var a=Ph(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 Ph(e){var t=[];return M(e,function(n){n&&(t.push(n),t=t.concat(Ph(n.flowElements)))}),t}function l1(e){for(var t=e;t;){if(y(t,"bpmn:Process"))return t;t=t.$parent}}var p1='<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>',Ah=p1,Th={verticalAlign:"middle"},Mh={color:"#404040"},f1={zIndex:"1001",position:"fixed",top:"0",left:"0",right:"0",bottom:"0"},d1={width:"100%",height:"100%",background:"rgba(40,40,40,0.2)"},h1={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"},m1='<div class="bjs-powered-by-lightbox"><div class="backdrop"></div><div class="notice"><a href="https://bpmn.io" target="_blank" rel="noopener" class="link">'+Ah+'</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>',si;function g1(){si=Qe(m1),cn(si,f1),cn(Ge("svg",si),Th),cn(Ge(".backdrop",si),d1),cn(Ge(".notice",si),h1),cn(Ge(".link",si),Mh,{margin:"15px 20px 15px 10px",alignSelf:"center"})}function v1(){si||(g1(),vn.bind(si,".backdrop","click",function(e){document.body.removeChild(si)})),document.body.appendChild(si)}const ms=5,kh="djs-outline-hidden";function at(e){e=D({},_1,e),this._moddle=this._createModdle(e),this._container=this._createContainer(e),this._init(this._container,this._moddle,e),x1(this._container)}te(at,Yi),at.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||[]),gs(s,o),s=y1(s),this._emit("import.done",{error:s,warnings:s.warnings}),s}},at.prototype.importDefinitions=async function(t,n){return this._setDefinitions(t),{warnings:(await this.open(n)).warnings}},at.prototype.open=async function(t){const n=this._definitions;let i=t;if(!n){const o=new Error("no XML imported");throw gs(o,[]),o}if(typeof t=="string"&&(i=b1(n,t),!i)){const o=new Error("BPMNDiagram <"+t+"> not found");throw gs(o,[]),o}try{this.clear()}catch(o){throw gs(o,[]),o}const{warnings:r}=await c1(this,n,i);return{warnings:r}},at.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},at.prototype.saveSVG=async function(){this._emit("saveSVG.start");let t,n;try{const i=this.get("canvas"),r=i.getActiveLayer(),o=Ge(":scope > defs",i._svg),a=Kd(r),s=o?"<defs>"+Kd(o)+"</defs>":"",c=i.getContainer();rt(c).add(kh);let u;try{u=r.getBBox()}finally{rt(c).remove(kh)}const l=u.x-ms,p=u.y-ms,f=u.width+ms*2,d=u.height+ms*2;t=`<?xml version="1.0" encoding="utf-8"?>
|
|
4
|
+
nested error: `+w.message;if(I)return a.addWarning({message:H,error:w}),!0;throw ji(H)}function l(w,T){return u(w,T,!0)}function p(){var w=a.elementsById,T=a.references,I,P;for(I=0;P=T[I];I++){var j=P.element,F=w[P.id],L=_i(j).propertiesByName[P.property];if(F||a.addWarning({message:"unresolved reference <"+P.id+">",element:P.element,property:P.property,value:P.id}),L.isMany){var H=j.get(L.name),oe=H.indexOf(P);oe===-1&&(oe=H.length),F?H[oe]=F:H.splice(oe,1)}else j.set(L.name,F)}}function f(){c.pop().handleEnd()}var d=/^<\?xml /i,h=/ encoding="([^"]+)"/i,m=/^utf-8$/i;function g(w){if(d.test(w)){var T=h.exec(w),I=T&&T[1];!I||m.test(I)||a.addWarning({message:"unsupported document encoding <"+I+">, falling back to UTF-8"})}}function S(w,T){var I=c.peek();try{c.push(I.handleNode(w))}catch(P){u(P,T,o)&&c.push(new bu)}}function E(w,T){try{c.peek().handleText(w)}catch(I){l(I,T)}}function b(w,T){w.trim()&&E(w,T)}var x=r.getPackages().reduce(function(w,T){return w[T.uri]=T.prefix,w},Object.entries(_u).reduce(function(w,[T,I]){return w[I]=T,w},r.config&&r.config.nsMap||{}));return s.ns(x).on("openTag",function(w,T,I,P){var j=w.attrs||{},F=Object.keys(j).reduce(function(H,oe){var De=T(j[oe]);return H[oe]=De,H},{}),L={name:w.name,originalName:w.originalName,attributes:F,ns:w.ns};S(L,P)}).on("question",g).on("closeTag",f).on("cdata",E).on("text",function(w,T,I){b(T(w),I)}).on("error",u).on("warn",l),new Promise(function(w,T){var I;try{s.parse(e),p()}catch(H){I=H}var P=i.element;!I&&!P&&(I=ji("failed to parse document as <"+i.type.$descriptor.name+">"));var j=a.warnings,F=a.references,L=a.elementsById;return I?(I.warnings=j,T(I)):w({rootElement:P,elementsById:L,references:F,warnings:j})})},wu.prototype.handler=function(e){return new Eu(this.model,e)};function Lx(){var e=[];return Object.defineProperty(e,"peek",{value:function(){return this[this.length-1]}}),e}var Nx=`<?xml version="1.0" encoding="UTF-8"?>
|
|
5
|
+
`,Bx=/<|>|'|"|&|\n\r|\n/g,qf=/<|>|&/g;function ni(e){this.prefixMap={},this.uriMap={},this.used={},this.wellknown=[],this.custom=[],this.parent=e,this.defaultPrefixMap=e&&e.defaultPrefixMap||{}}ni.prototype.mapDefaultPrefixes=function(e){this.defaultPrefixMap=e},ni.prototype.defaultUriByPrefix=function(e){return this.defaultPrefixMap[e]},ni.prototype.byUri=function(e){return this.uriMap[e]||this.parent&&this.parent.byUri(e)},ni.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)},ni.prototype.uriByPrefix=function(e){return this.prefixMap[e||"xmlns"]||this.parent&&this.parent.uriByPrefix(e)},ni.prototype.mapPrefix=function(e,t){this.prefixMap[e||"xmlns"]=t},ni.prototype.getNSKey=function(e){return e.prefix!==void 0?e.uri+"|"+e.prefix:e.uri},ni.prototype.logUsed=function(e){var t=e.uri,n=this.getNSKey(e);this.used[n]=this.byUri(t),this.parent&&this.parent.logUsed(e)},ni.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 $x(e){return e.charAt(0).toLowerCase()+e.slice(1)}function jx(e,t){return Vf(t)?$x(e):e}function Yf(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})}function Kf(e){return gn(e)?e:(e.prefix?e.prefix+":":"")+e.localName}function Fx(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 Hx(e,t){return t.isGeneric?D({localName:t.ns.localName},e):D({localName:jx(t.ns.localName,t.$pkg)},e)}function zx(e,t){return D({localName:t.ns.localName},e)}function Vx(e){var t=e.$descriptor;return Ae(t.properties,function(n){var i=n.name;if(n.isVirtual||!vn(e,i))return!1;var r=e[i];return r===n.default||r===null?!1:n.isMany?r.length:!0})}var Gx={"\n":"#10","\n\r":"#10",'"':"#34","'":"#39","<":"#60",">":"#62","&":"#38"},Wx={"<":"lt",">":"gt","&":"amp"};function Xf(e,t,n){return e=gn(e)?e:""+e,e.replace(t,function(i){return"&"+n[i]+";"})}function Ux(e){return Xf(e,Bx,Gx)}function qx(e){return Xf(e,qf,Wx)}function Yx(e){return Ae(e,function(t){return t.isAttr})}function Kx(e){return Ae(e,function(t){return!t.isAttr})}function Su(e){this.tagName=e}Su.prototype.build=function(e){return this.element=e,this},Su.prototype.serializeTo=function(e){e.appendIndent().append("<"+this.tagName+">"+this.element.id+"</"+this.tagName+">").appendNewLine()};function xr(){}xr.prototype.serializeValue=xr.prototype.serializeTo=function(e){e.append(this.escape?qx(this.value):this.value)},xr.prototype.build=function(e,t){return this.value=t,e.type==="String"&&t.search(qf)!==-1&&(this.escape=!0),this};function Ru(e){this.tagName=e}Yf(Ru,xr),Ru.prototype.serializeTo=function(e){e.appendIndent().append("<"+this.tagName+">"),this.serializeValue(e),e.append("</"+this.tagName+">").appendNewLine()};function at(e,t){this.body=[],this.attrs=[],this.parent=e,this.propertyDescriptor=t}at.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=Vx(e),this.parseAttributes(Yx(r)),this.parseContainments(Kx(r))),this.parseGenericAttributes(e,i),this},at.prototype.nsTagName=function(e){var t=this.logNamespaceUsed(e.ns);return Hx(t,e)},at.prototype.nsPropertyTagName=function(e){var t=this.logNamespaceUsed(e.ns);return zx(t,e)},at.prototype.isLocalNs=function(e){return e.uri===this.ns.uri},at.prototype.nsAttributeName=function(e){var t;if(gn(e)?t=Qt(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}:D({localName:t.localName},n)},at.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}))},at.prototype.parseGenericContainments=function(e){var t=e.$body;t&&this.body.push(new xr().build({type:"String"},t));var n=e.$children;n&&M(n,i=>{this.body.push(new at(this).build(i))})},at.prototype.parseNsAttribute=function(e,t,n){var i=e.$model,r=Qt(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)}},at.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},at.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)}})},at.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 xr().build(r,o[0]));else if(Nf(r.type))M(o,function(u){n.push(new Ru(t.addTagName(t.nsPropertyTagName(r))).build(r,u))});else if(a)M(o,function(u){n.push(new Su(t.addTagName(t.nsPropertyTagName(r))).build(u))});else{var c=Wf(r);M(o,function(u){var l;c?c===Gf?l=new at(t,r):l=new Wa(t,r,c):l=new at(t),n.push(l.build(u))})}})},at.prototype.getNamespaces=function(e){var t=this.namespaces,n=this.parent,i;return t||(i=n&&n.getNamespaces(),e||!i?this.namespaces=t=new ni(i):t=i),t},at.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},at.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},at.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)})},at.prototype.addTagName=function(e){var t=this.logNamespaceUsed(e);return this.getNamespaces().logUsed(t),Kf(e)},at.prototype.addAttribute=function(e,t){var n=this.attrs;gn(t)&&(t=Ux(t));var i=Df(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)},at.prototype.serializeAttributes=function(e){var t=this.attrs,n=this.namespaces;n&&(t=Fx(n).concat(t)),M(t,function(i){e.append(" ").append(Kf(i.name)).append('="').append(i.value).append('"')})},at.prototype.serializeTo=function(e){var t=this.body[0],n=t&&t.constructor!==xr;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 Wa(e,t,n){at.call(this,e,t),this.serialization=n}Yf(Wa,at),Wa.prototype.parseNsAttributes=function(e){var t=at.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},Wa.prototype.isLocalNs=function(e){return e.uri===(this.typeNs||this.ns).uri};function Xx(){this.value="",this.write=function(e){this.value+=e}}function Zx(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 Qx(e){e=D({format:!1,preamble:!0},e||{});function t(n,i){var r=i||new Xx,o=new Zx(r,e.format);e.preamble&&o.append(Nx);var a=new at,s=n.$model;if(a.getNamespaces().mapDefaultPrefixes(Jx(s)),a.build(n).serializeTo(o),!i)return r.value}return{toXML:t}}function Jx(e){const t=e.config&&e.config.nsMap||{},n={};for(const i in _u)n[i]=_u[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 Ua(e,t){Ln.call(this,e,t)}Ua.prototype=Object.create(Ln.prototype),Ua.prototype.fromXML=function(e,t,n){gn(t)||(n=t,t="bpmn:Definitions");var i=new wu(D({model:this,lax:!0},n)),r=i.handler(t);return i.fromXML(e,r)},Ua.prototype.toXML=function(e,t){var n=new Qx(t);return new Promise(function(i,r){try{var o=n.toXML(e);return i({xml:o})}catch(a){return r(a)}})};var e0="BPMN20",t0="http://www.omg.org/spec/BPMN/20100524/MODEL",n0="bpmn",i0=[],r0=[{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"}]}],o0=[{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"}]}],a0={tagAlias:"lowerCase",typePrefix:"t"},s0={name:e0,uri:t0,prefix:n0,associations:i0,types:r0,enumerations:o0,xml:a0},c0="BPMNDI",u0="http://www.omg.org/spec/BPMN/20100524/DI",l0="bpmndi",p0=[{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"]}],f0=[{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"}]}],d0=[],h0={name:c0,uri:u0,prefix:l0,types:p0,enumerations:f0,associations:d0},m0="DC",g0="http://www.omg.org/spec/DD/20100524/DC",v0="dc",y0=[{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}]}],_0=[],b0={name:m0,uri:g0,prefix:v0,types:y0,associations:_0},x0="DI",E0="http://www.omg.org/spec/DD/20100524/DI",w0="di",S0=[{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"}]}],R0=[],C0={tagAlias:"lowerCase"},P0={name:x0,uri:E0,prefix:w0,types:S0,associations:R0,xml:C0},A0="bpmn.io colors for BPMN",T0="http://bpmn.io/schema/bpmn/biocolor/1.0",M0="bioc",k0=[{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"}]}],D0=[],O0=[],I0={name:A0,uri:T0,prefix:M0,types:k0,enumerations:D0,associations:O0},L0="BPMN in Color",N0="http://www.omg.org/spec/BPMN/non-normative/color/1.0",B0="color",$0=[{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"}]}],j0=[],F0=[],H0={name:L0,uri:N0,prefix:B0,types:$0,enumerations:j0,associations:F0};const z0={bpmn:s0,bpmndi:h0,dc:b0,di:P0,bioc:I0,color:H0};function Zf(e,t){const n=D({},z0,e);return new Ua(n,t)}const V0={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"}},G0="http://www.omg.org/spec/BPMN/non-normative/extensions/i18n/1.0",Qf="i18n",qa={[Qf]:V0,[cu]:Pf};function Jf(){return Zf(qa)}const ed=Jf();async function Cu(e){const{rootElement:t,warnings:n}=await ed.fromXML(e,"bpmn:Definitions");return{definitions:t,warnings:n}}async function W0(e){const{xml:t}=await ed.toXML(e,{format:!0});return t}function Pu(e){return e.map(t=>typeof t=="string"?t:t.message??String(t))}const Ya=new Set(["bpmn:Participant","bpmn:Lane","bpmn:Group","bpmn:SubProcess","bpmn:AdHocSubProcess","bpmn:Transaction"]),U0=1,q0=2;function Fi(e){switch(e.kind){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}`}}const td=20,nd=1;function ii(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 Ka(e,t){let n=null;const i=e.type!==t.type;for(const r of ii(e))for(const o of ii(t)){if(r.axis!==o.axis||Math.abs(r.at-o.at)>nd)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>=td&&(!n||s>n.length)&&(n={axis:r.axis,length:s,kind:a})}return n}function id(e,t){const n=Ka(e,t);return n&&n.kind==="opposite"?{axis:n.axis,length:n.length}:null}function Y0(e,t){let n=0;for(const i of t)i.id!==e.id&&id(e,i)&&n++;return n}function Au(e,t){let n=0;for(const i of t)i.id!==e.id&&Ka(e,i)&&n++;return n}const Tu=15,rd=20;function K0(e,t){const n=t.axis==="v"?[e.x,e.x+e.width]:[e.y,e.y+e.height];if(t.at<n[0]-rd||t.at>n[1]+rd)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 Mu=20;function Xa(e,t){const n=[];for(const i of t){if(i.axis!==e.axis||Math.abs(i.at-e.at)>nd)continue;const r=Math.max(e.lo,i.lo),o=Math.min(e.hi,i.hi);o-r<td||n.push([r-Mu,o+Mu])}return n}function Za(e,t){const n=e.label;if(!n)return null;let i=null;for(const r of ii(e)){const o=K0(n,r);if(o){for(const a of t)if(a.id!==e.id&&!(i&&a.id>=i.other)){for(const[s,c]of Xa(r,ii(a)))if(Math.min(c,o[1])>Math.max(s,o[0])){i={other:a.id,axis:r.axis};break}}}}return i}const X0=1,Z0=(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 Q0(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 J0(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 eE=(e,t)=>e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height;function Hi(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(Q0(e.waypoints[o],e.waypoints[o+1],r,q0)){i.push(r);break}}return i}function tE(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 od=(e,t)=>e.endpoints.some(n=>t.endpoints.includes(n));function Qa(e,t){let n=0;for(const i of t){if(i.id===e.id||od(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++)tE(e.waypoints[o],e.waypoints[o+1],i.waypoints[a],i.waypoints[a+1])&&(r=!0);r&&n++}return n}function Io(e,t){let n=0;for(const i of t)i.id===e.id||od(e,i)||Qa(e,[i])>0&&(n+=i.type===e.type?2:1);return n}function ad(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++)Qa(n[i],[n[r]])>0&&(t+=n[i].type===n[r].type?2:1);return t}function ku(e){const t=[],n=e.edges;for(let i=0;i<n.length;i++)for(let r=i+1;r<n.length;r++)if(Qa(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]}`))}const Kr=e=>e.shapes.filter(t=>!t.container);function nE(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 zi(e){const t=[],n=e.shapes.filter(o=>!o.container);for(const o of e.edges)for(const a of Hi(o,n))t.push({kind:"edge-crosses-shape",edge:o.id,shape:a.id});const i=n.filter(o=>!o.attached);for(let o=0;o<i.length;o++)for(let a=o+1;a<i.length;a++){const s=i[o],c=i[a];if(!J0(s,c,U0))continue;const u=s.id<c.id?[s.id,c.id]:[c.id,s.id];t.push({kind:"shape-overlap",shapes:u,identical:eE(s,c)})}for(let o=0;o<e.edges.length;o++)for(let a=o+1;a<e.edges.length;a++){const s=e.edges[o],c=e.edges[a],u=Ka(s,c);if(!u)continue;const l=s.id<c.id?[s.id,c.id]:[c.id,s.id];t.push({kind:u.kind==="opposite"?"edge-overlap-opposite":"edge-overlap-mixed",edges:l,axis:u.axis,length:Math.round(u.length)})}for(const o of e.edges){if(!o.label)continue;const a=Za(o,e.edges);a&&t.push({kind:"label-on-shared-segment",edge:o.id,other:a.other,axis:a.axis})}const r=new Map(e.shapes.map(o=>[o.id,o]));for(const o of n){const a=o.parent??nE(o,e,r);if(!a)continue;const s=r.get(a);!s||!s.container||Z0(s,o,X0)||t.push({kind:"shape-outside-container",shape:o.id,container:s.id})}return t.sort((o,a)=>Fi(o).localeCompare(Fi(a)))}const $t=e=>typeof e=="object"&&e!==null?e:void 0,Jt=e=>typeof e=="number"?e:0,Er=e=>{const t=$t(e);return typeof(t==null?void 0:t.id)=="string"?t.id:void 0};function iE(e){const t=$t(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=Er(o);a&&n.push(a)}}return n}function rE(e,t){const n=$t(e.$parent);if(!n)return;const i=typeof n.$type=="string"?n.$type:"";if(i==="bpmn:Process"){const r=Er(n);return r?t.get(r):void 0}if(Ya.has(i)&&i!=="bpmn:Lane"&&i!=="bpmn:Group")return Er(n)}function sd(e){var o,a,s,c;const t=[],n=[],i=((o=$t(e))==null?void 0:o.diagrams)??[],r=new Map;for(const u of((a=$t(e))==null?void 0:a.rootElements)??[]){const l=$t(u);if((l==null?void 0:l.$type)==="bpmn:Collaboration")for(const p of l.participants??[]){const f=$t(p),d=Er(f),h=Er(f==null?void 0:f.processRef);d&&h&&r.set(h,d)}}for(const u of i){const l=$t((s=$t(u))==null?void 0:s.plane),p=(l==null?void 0:l.planeElement)??[];for(const f of p){const d=$t(f);if(!d)continue;const h=$t(d.bpmnElement),m=typeof(h==null?void 0:h.id)=="string"?h.id:void 0;if(!m)continue;const g=typeof(h==null?void 0:h.$type)=="string"?h.$type:"",S=$t(d.bounds);if(S){const b=d.isExpanded===!1;t.push({id:m,type:g,x:Jt(S.x),y:Jt(S.y),width:Jt(S.width),height:Jt(S.height),container:Ya.has(g)&&!b,attached:(h==null?void 0:h.attachedToRef)!==void 0,...h?{parent:rE(h,r)}:{}});continue}const E=d.waypoint;if(Array.isArray(E)){const b=$t((c=$t(d.label))==null?void 0:c.bounds);n.push({id:m,type:g,waypoints:E.map(x=>{var w,T;return{x:Jt((w=$t(x))==null?void 0:w.x),y:Jt((T=$t(x))==null?void 0:T.y)}}),endpoints:iE(h),...b?{label:{x:Jt(b.x),y:Jt(b.y),width:Jt(b.width),height:Jt(b.height)}}:{}})}}}return{shapes:t,edges:n}}function cd(e){return zi(sd(e))}async function oE(e){const{definitions:t,warnings:n}=await Cu(e);return{findings:cd(t),warnings:n}}function Nn(e){const t=[],n=[];for(const i of e.getAll()){const r=i;if(r.type==="label"||r.labelTarget)continue;const o=typeof r.type=="string"?r.type:"";if(o==="bpmn:Definitions"||o.startsWith("bpmndi:"))continue;const a=r.waypoints;if(a){const p=$t(r.label);n.push({id:r.id,type:o,waypoints:a.map(f=>({x:Jt(f.x),y:Jt(f.y)})),endpoints:[Er(r.source),Er(r.target)].filter(f=>!!f),...p&&typeof p.x=="number"?{label:{x:p.x,y:Jt(p.y),width:Jt(p.width),height:Jt(p.height)}}:{}});continue}if(typeof r.x!="number"||typeof r.y!="number")continue;const s=$t(r.businessObject);let c=$t(r.parent);for(;c&&c.type==="bpmn:Lane";)c=$t(c.parent);const u=typeof(c==null?void 0:c.type)=="string"?c.type:"",l=c&&Ya.has(u)&&u!=="bpmn:Group"&&typeof c.id=="string"?c.id:void 0;t.push({id:r.id,type:o,x:r.x,y:r.y,width:Jt(r.width),height:Jt(r.height),container:Ya.has(o)&&r.collapsed!==!0,attached:(s==null?void 0:s.attachedToRef)!==void 0,...l!==void 0?{parent:l}:{}})}return{shapes:t,edges:n}}const aE={"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 sE(e,t){const n=aE[e];return n||(e==="label"||e.startsWith("bpmndi:")?"other":e.startsWith("bpmn:")&&!("waypoints"in t&&t.waypoints)?"flowNode":"other")}function ud(e){let t=e.parent;for(;t;){if(t.type==="bpmn:Participant")return t.id;t=t.parent}}function ld(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 sE(i.type,i)},lanesOf:n=>t().filter(i=>i.type==="bpmn:Lane"&&ud(i)===n).sort((i,r)=>i.y-r.y).map(i=>i.id),participantOf:n=>{const i=e.get(n);return i?ud(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 pd=20,cE=4,un=(e,t)=>Math.abs(e-t)<.5;function fd(e,t,n,i=pd){if(un(e.y,t.y)&&!un(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(un(e.x,t.x)&&!un(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 dd(e,t,n=pd){if(e.length!==4)return null;const[i,r,o,a]=e;if(un(i.y,r.y)&&un(r.x,o.x)&&un(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(un(i.x,r.x)&&un(r.y,o.y)&&un(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 hd(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 md=30,uE=[0,-25,25,-40,40];function lE(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+md:s-md,u=a?i.y+i.height:i.y,l=n.x+n.width/2,p=i.x+i.width/2;return uE.map(f=>[{x:l,y:s},{x:l,y:c},{x:p+f,y:c},{x:p+f,y:u}])}const pE=(e,t,n)=>[...e.slice(0,t+1),...n,...e.slice(t+1)],Ja=(e,t,n)=>Hi({...e,waypoints:t},n).length;function gd(e,t,n,i){let r=[...e.waypoints],o=Ja(e,r,t);if(o===0)return null;let a=!1;for(const p of hd(e,t))if(Ja(e,p,t)===0)return p;const s=(i??[]).filter(p=>p.id!==e.id).flatMap(ii),c=p=>ii({...e,waypoints:p}).some(f=>Xa(f,s).length>0),u=lE(e,t).filter(p=>Ja(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<cE&&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)||Hi({...e,waypoints:[h,m]},[g]).length===0)continue;const S=fd(h,m,g),E=S?S.map(x=>pE(r,d,x)):dd(r,g)??[];if(!E.length)continue;const b=[...E].sort((x,w)=>Number(l(w))-Number(l(x)));for(const x of b){const w=Ja(e,x,t);if(w<o){r=x,o=w,f=!0,a=!0;break}}if(f)break}}if(!f)break}return a&&o===0?r:null}function vd(e,t){const{elementRegistry:n}=e,i=e.modeling,r=Nn(n),o=Kr(r),a=zi(r).filter(c=>c.kind==="edge-crosses-shape"&&!t.has(Fi(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=gd(u,o,f,r.edges);d&&i.updateWaypoints(l,d)}}const fE=10;function yd(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 _d(e,t){if(e.waypoints.length<2||e.endpoints.length!==2)return null;const n=t.shapes.filter(H=>H.type==="bpmn:Participant"&&H.container),i=t.shapes.find(H=>H.id===e.endpoints[0]),r=t.shapes.find(H=>H.id===e.endpoints[1]);if(!i||!r)return null;const o=yd(i,n),a=yd(r,n);if(!o||!a||o.id===a.id)return null;const s=a.y>o.y,c=s?o:a,u=s?a:o,l=n.filter(H=>H.id!==o.id&&H.id!==a.id&&H.y>=c.y+c.height&&H.y+H.height<=u.y).sort((H,oe)=>H.y-oe.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,S=e.waypoints[0],E=e.waypoints[e.waypoints.length-1],b=Kr(t),x=t.edges.filter(H=>H.id!==e.id),w=Io(e,x),T=Hi(e,b).length;if(w===0&&T===0)return null;const I=Math.min(...l.map(H=>H.x)),P=Math.max(...l.map(H=>H.x+H.width)),j=(S.x+E.x)/2,F=H=>H.filter((oe,De)=>De===0||!(un(oe.x,H[De-1].x)&&un(oe.y,H[De-1].y)));let L;for(let H=I;H<=P;H+=fE){const oe=F([S,{x:S.x,y:m},{x:H,y:m},{x:H,y:g},{x:E.x,y:g},E]),De={...e,waypoints:oe};if(Hi(De,b).length>0)continue;const ct=Io(De,x),Y=Math.abs(H-j);(!L||ct<L.cross||ct===L.cross&&Y<L.detour)&&(L={pts:oe,cross:ct,detour:Y})}return L&&(T>0?L.cross<=w:L.cross<w)?L.pts:null}function bd(e,t){const{elementRegistry:n}=e,i=e.modeling,r=Nn(n);for(const o of r.edges){if(o.type!=="bpmn:MessageFlow"||t.has(o.id))continue;const a=Nn(n),s=a.edges.find(l=>l.id===o.id);if(!s)continue;const c=_d(s,a);if(!c)continue;const u=n.get(o.id);u&&i.updateWaypoints(u,c)}}const Du=[25,-25,40,-40],xd=35;function dE(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-xd:n.y+n.height+xd,p=[];for(const f of[0,...Du]){if(Math.abs(f)>=i.width/2-5)continue;const d=o+f;p.push({pts:[{x:n.x,y:r},{x:d,y:r},{x:d,y:c}],cost:Math.abs(f)});for(const h of[0,...Du]){if(Math.abs(h)>=n.width/2-5)continue;const m=a+h;p.push({pts:[{x:m,y:u},{x:m,y:l},{x:d,y:l},{x:d,y:c}],cost:Math.abs(f)+Math.abs(h)})}}return p}function hE(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=un(n[0].x,n[1].x)&&!un(n[0].y,n[1].y),s=un(n[n.length-1].x,n[n.length-2].x)&&!un(n[n.length-1].y,n[n.length-2].y);for(const c of Du){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 Ed(e,t){const n=new Map(t.shapes.map(l=>[l.id,l])),i=Kr(t),r=t.edges.filter(l=>l.id!==e.id),o=Au(e,r);if(o===0)return null;const a=Io(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=[...dE(e,n),...hE(e,n)];for(const{pts:l,cost:p}of u){const f={...e,waypoints:l};if(Hi(f,i).length>0)continue;const d=Au(f,r),h=Io(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 wd(e,t,n){const{elementRegistry:i}=e,r=e.modeling,o=Nn(i),a=zi(o).filter(l=>(l.kind==="edge-overlap-opposite"||l.kind==="edge-overlap-mixed")&&!t.has(Fi(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=Nn(i),f=p.edges.find(m=>m.id===l);if(!f)continue;const d=Ed(f,p);if(!d)continue;const h=i.get(l);h&&r.updateWaypoints(h,d)}}const mE=10,gE=(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 Sd(e,t){const n=e.label;if(!n)return null;const i=t.edges.filter(a=>a.id!==e.id);if(!Za(e,i))return null;const r=Kr(t),o=i.flatMap(ii);for(const a of ii(e)){let s=[[a.lo,a.hi]];for(const[d,h]of Xa(a,o))s=s.flatMap(([m,g])=>{const S=[];return d>m&&S.push([m,Math.min(g,d)]),h<g&&S.push([Math.max(m,h),g]),S.filter(([E,b])=>b>E)});const c=a.axis==="h"?n.width:n.height,u=s.find(([d,h])=>h-d>=c+mE*2);if(!u)continue;const l=(u[0]+u[1])/2,p=a.axis==="h"?{x:l,y:a.at-Tu}:{x:a.at+Tu,y:l},f={x:p.x-n.width/2,y:p.y-n.height/2,width:n.width,height:n.height};if(!Za({...e,label:f},i)&&!r.some(d=>!e.endpoints.includes(d.id)&&gE(f,d)))return f}return null}function Rd(e,t,n){const{elementRegistry:i}=e,r=e.modeling,o=Nn(i),a=zi(o).filter(s=>s.kind==="label-on-shared-segment"&&!t.has(Fi(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=Sd(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})}}const vE=/^[\p{L}_][\p{L}\p{N}_.\-]*$/u,Cd=new Set(["sequenceFlow","messageFlow","dataAssociation","association"]),Pd={"participant.add":[{path:"participant",shape:["id"]},{path:"participant.lanes[]",shape:["id"],optional:!0}],"participant.update":[{path:"id",shape:null},{path:"lanes[]",shape:["id"],optional:!0}],"node.add":[{path:"node",shape:["id","type"]}],"node.update":[{path:"id",shape:null}],"sequenceFlow.add":[{path:"flow",shape:["id","source","target"]}],"sequenceFlow.update":[{path:"id",shape:null}],"messageFlow.add":[{path:"flow",shape:["id","source","target"]}],"messageFlow.update":[{path:"id",shape:null}],"dataStore.add":[{path:"dataStore",shape:["id"]},{path:"associations[]",shape:["source","target"],optional:!0}],"dataStore.update":[{path:"id",shape:null}],"dataAssociation.add":[{path:"association",shape:["source","target"]}],"association.add":[{path:"association",shape:["source","target"]}],"annotation.add":[{path:"annotation",shape:["id","text"]},{path:"association",shape:["source","target"],optional:!0},{path:"placement",shape:["anchor","side"],optional:!0}],"annotation.update":[{path:"id",shape:null},{path:"placement",shape:["anchor","side"],optional:!0}],"group.add":[{path:"group",shape:["id"]},{path:"group.members[]",shape:null,optional:!0}],"group.update":[{path:"id",shape:null},{path:"members[]",shape:null,optional:!0}],"element.remove":[{path:"id",shape:null}]},es=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),Ou=e=>typeof e=="string"&&e!=="";function yE(e){const t=[];function n(i,r,o,a){if(a===null){Ou(o)||t.push({kind:"payload-invalid",opIndex:i,field:r});return}if(!es(o)){t.push({kind:"payload-invalid",opIndex:i,field:r});return}for(const s of a)Ou(o[s])||t.push({kind:"payload-invalid",opIndex:i,field:`${r}.${s}`})}return e.forEach((i,r)=>{if(!es(i)||!Ou(i.kind)||!(i.kind in Pd)){t.push({kind:"payload-invalid",opIndex:r,field:"kind"});return}for(const o of Pd[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(!es(u))break;u=u[p]}if(!es(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 Ad(e,t){const n=yE(e);if(n.length>0)return n;const i=[],r=new Map,o=new Map;function a(f,d,h){if(!vE.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:S,name:E,condition:b}=f.flow,x=u(d,g,"source",["flowNode"]),w=u(d,S,"target",["flowNode"]);x&&w&&c(g)!==c(S)&&i.push({kind:"flow-cross-pool",opIndex:d,id:m}),E!==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:S}=f.flow,E=u(d,g,"source",["flowNode","participant"]),b=u(d,S,"target",["flowNode","participant"]);if(E&&b){const x=c(g),w=c(S);x!==void 0&&x===w&&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(E=>E===f.dataStore.id).length!==1){i.push({kind:"data-association-ends",opIndex:d,source:m.source,target:m.target});continue}const S=m.source===f.dataStore.id?m.target:m.source;u(d,S,"dataAssociation",["flowNode"])}break}case"dataAssociation.add":{const{source:m,target:g}=f.association,S=u(d,m,"source"),E=u(d,g,"target");if(S&&E){const b=new Set([S,E]);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:S}=f.association,E=u(d,g,"source"),b=u(d,S,"target");E&&b&&E!=="annotation"&&b!=="annotation"&&i.push({kind:"association-detached",opIndex:d,annotation:m??`${g}->${S}`});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 S=m===f.annotation.id?g:m;u(d,S,"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&&Cd.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(E=>E.id);for(const E of m)g.includes(E)||i.push({kind:"lane-shrink-unsupported",opIndex:d,participant:f.id,lane:E});for(const E of g)t.categoryOf(E)!==void 0&&!m.includes(E)&&i.push({kind:"id-duplicate",opIndex:d,id:E});const S=g.filter(E=>m.includes(E));S.length===m.length&&S.some((E,b)=>E!==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,S=t.endpointsOf(f.id),E=f.source??(S==null?void 0:S.source),b=f.target??(S==null?void 0:S.target);m&&g&&E!==void 0&&b!==void 0&&new Set([c(E),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&&Cd.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}}const Xr={cjkEm:.865,upperEm:.68,lowerEm:.5,digitEm:.556,spaceEm:.278,otherEm:.35,ascentEm:.9,descentEm:.25},_E=/[ᄀ-ᇿ -〿-ヿ㐀-鿿가--⦆]/;function bE(e){const t=Xr;return _E.test(e)?t.cjkEm:e===" "?t.spaceEm:e>="0"&&e<="9"?t.digitEm:e>="A"&&e<="Z"?t.upperEm:e>="a"&&e<="z"?t.lowerEm:t.otherEm}function Lo(e,t){let n=0;for(const i of e)n+=t*bE(i);return n}function Td(e=globalThis,{textMeasurement:t="approximate"}={}){if(!(e!=null&&e.SVGElement))throw new Error("installHeadlessBpmnDom: DOM 전역이 없다 — jsdom window 를 전역에 올린 뒤 호출할 것");t==="approximate"&&xE(e),EE(e),wE(e),SE(e)}function xE(e){var i;const t=(i=e.HTMLCanvasElement)==null?void 0:i.prototype;if(!t||t.__headlessTextMeasurement)return;t.__headlessTextMeasurement=!0;const n={font:"12px sans-serif",letterSpacing:"0px",measureText(r){var a;const o=Number.parseFloat(((a=String(n.font).match(/(\d+(?:\.\d+)?)px/))==null?void 0:a[1])??"12");return{width:Lo(r,o),fontBoundingBoxAscent:o*Xr.ascentEm,fontBoundingBoxDescent:o*Xr.descentEm,actualBoundingBoxAscent:o*Xr.ascentEm,actualBoundingBoxDescent:o*Xr.descentEm}}};t.getContext=()=>n}function EE(e){if(e.SVGMatrix)return;class t{constructor(){zr(this,"a",1);zr(this,"b",0);zr(this,"c",0);zr(this,"d",1);zr(this,"e",0);zr(this,"f",0)}static of(i,r,o,a,s,c){return Object.assign(new t,{a:i,b:r,c:o,d:a,e:s,f:c})}multiply(i){return t.of(this.a*i.a+this.c*i.b,this.b*i.a+this.d*i.b,this.a*i.c+this.c*i.d,this.b*i.c+this.d*i.d,this.a*i.e+this.c*i.f+this.e,this.b*i.e+this.d*i.f+this.f)}translate(i,r){return this.multiply(t.of(1,0,0,1,i,r))}scale(i,r=i){return this.multiply(t.of(i,0,0,r,0,0))}inverse(){const i=this.a*this.d-this.b*this.c;return t.of(this.d/i,-this.b/i,-this.c/i,this.a/i,(this.c*this.f-this.d*this.e)/i,(this.b*this.e-this.a*this.f)/i)}}e.SVGMatrix=t}function wE(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 SE(e){const t=e.SVGElement.prototype;if(!t.getCTM){const n=()=>new e.SVGMatrix;t.getCTM=n,t.getScreenCTM=n}t.getBBox||(t.getBBox=function(){const n=String(this.textContent??"");return{x:0,y:0,width:Lo(n,12),height:14}})}function Md(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 ts(e){return`bpmn:${e[0].toUpperCase()}${e.slice(1)}`}const Iu={"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 Vt(e,t){return e.filter(n=>n.kind===t)}function kd(e,t){var Ub,qb,Yb,Kb,Xb;const{modeling:n,bpmnFactory:i,elementFactory:r,elementRegistry:o,canvas:a,autoPlace:s,bpmnReplace:c}=t,u=()=>a.getRootElement(),l=R=>o.get(R),p=R=>{const A=l(R);if(!A)throw new Error(`하강 참조 해소 실패: ${R}`);return A},f=R=>{let A=R.parent;for(;A;){if(A.type==="bpmn:Participant")return A;A=A.parent}},d=Vt(e,"participant.add"),h=Vt(e,"node.add"),m=Vt(e,"sequenceFlow.add"),g=Vt(e,"messageFlow.add"),S=Vt(e,"dataStore.add"),E=Vt(e,"dataAssociation.add"),b=Vt(e,"annotation.add"),x=Vt(e,"group.add"),w=new Map(h.map(R=>[R.node.id,R])),T=(R,A,B)=>{var gt;const X=R.businessObject,K=(((gt=X.extensionElements)==null?void 0:gt.values)??[]).filter(he=>he.$type!==A),G=B?[...K,i.create(A,B)]:K;if(!G.length){X.extensionElements&&n.updateProperties(R,{extensionElements:void 0});return}const ee=i.create("bpmn:ExtensionElements",{values:G});G.forEach(he=>{he.$parent=ee}),n.updateProperties(R,{extensionElements:ee})},I=R=>({anchor:R.anchor,side:R.side,...R.offset!==void 0?{offset:R.offset}:{}});for(const R of Vt(e,"element.remove")){const A=l(R.id);A&&n.removeElements([A])}const P=R=>o.filter(A=>{var B;return A.type==="bpmn:Lane"&&((B=f(A))==null?void 0:B.id)===R}).sort((A,B)=>A.y-B.y);for(const R of Vt(e,"participant.update")){const A=p(R.id);if(R.name!==void 0&&n.updateProperties(A,{name:R.name??void 0}),!R.lanes)continue;const B=P(R.id);if(!B.length){n.splitLane(A,R.lanes.length),P(R.id).forEach((K,G)=>{const ee=R.lanes[G];ee&&n.updateProperties(K,{id:ee.id,name:ee.name})});continue}const X=new Set(B.map(K=>K.id));R.lanes.forEach((K,G)=>{if(X.has(K.id)){n.updateProperties(p(K.id),{name:K.name});return}const ee=G===0?n.addLane(P(R.id)[0],"top"):n.addLane(p(R.lanes[G-1].id),"bottom");n.updateProperties(ee,{id:K.id,name:K.name})})}const j=150,F=80,L=90,H=180,oe=new Set;for(const R of d){oe.add(`pool:${R.participant.id}`);for(const A of R.participant.lanes??[])oe.add(A.id)}const De=new Map;for(const R of h){const A=R.node.lane??`pool:${R.node.participant??""}`;let B=De.get(A);B||De.set(A,B=new Set([0])),R.band!==void 0&&B.add(R.band)}const ct=new Map;for(const[R,A]of De){if(!oe.has(R))continue;const B=[...A].sort((G,ee)=>G-ee),X=B.map((G,ee)=>ee===0?0:ee%2===1?Math.ceil(ee/2):-(ee/2)),K=Math.min(...X);ct.set(R,new Map(B.map((G,ee)=>[G,X[ee]-K])))}const Y=R=>{var A;return(((A=De.get(R))==null?void 0:A.size)??0)>1},re=R=>R.band??(R.node.lane||!Y(`pool:${R.node.participant??""}`)?void 0:0),le=new Map,ae=R=>le.get(R.node.id)??re(R),se=(R,A)=>{var B;return((B=ct.get(R))==null?void 0:B.get(A))??A},Z=new Map;for(const[R,A]of De){let B=0;for(const X of A)B=Math.max(B,se(R,X));Z.set(R,B)}const $=R=>H+j*R,N=d.map((R,A)=>({op:R,declared:A}));N.sort((R,A)=>{const B=R.op.order??Number.POSITIVE_INFINITY,X=A.op.order??Number.POSITIVE_INFINITY;return B!==X?B-X:R.declared-A.declared});let V=80;for(const R of o.getAll())R.parent===u()&&"height"in R&&typeof R.y=="number"&&(V=Math.max(V,R.y+R.height+60));for(const{op:R}of N){const A=R.participant,B=h.filter(zt=>zt.node.participant===A.id).length,X=((Ub=A.lanes)==null?void 0:Ub.length)??0,K=Math.max(1200,B*160+300),G=(A.lanes??[]).map(zt=>$(Z.get(zt.id)??0)),ee=G.reduce((zt,Je)=>zt+Je,0);X&&ee<300&&(G[X-1]+=300-ee);const gt=Math.max(300,j*((Z.get(`pool:${A.id}`)??0)+1)),he=A.blackBox||B+X===0?120:X?Math.max(300,ee):gt,Be=r.createShape({type:"bpmn:Participant",businessObject:i.create("bpmn:Participant",{id:A.id,name:A.name,...R.order!==void 0?{"bwl:poolOrder":R.order}:{},...A.blackBox?{}:{processRef:i.create("bpmn:Process")}}),width:K,height:he,isExpanded:!0}),ut=n.createShape(Be,{x:100+K/2,y:V+he/2},u()),an=A.lanes??[];if(an.length&&n.splitLane(ut,an.length),an.length){const zt=o.filter(Je=>{var Kt;return Je.type==="bpmn:Lane"&&((Kt=f(Je))==null?void 0:Kt.id)===A.id}).sort((Je,Kt)=>Je.y-Kt.y);if(zt.forEach((Je,Kt)=>{const Pn=an[Kt];Pn&&n.updateProperties(Je,{id:Pn.id,name:Pn.name})}),G.some(Je=>Je!==ut.height/X)){let Je=ut.y;zt.forEach((Kt,Pn)=>{const In=G[Pn];n.resizeShape(Kt,{x:Kt.x,y:Je,width:Kt.width,height:In}),Je+=In})}}V=ut.y+ut.height+60}const Re=R=>{var X;const A=w.get(R);if(A)return A.node.participant??"";const B=l(R);return B?B.type==="bpmn:Participant"?B.id:((X=f(B))==null?void 0:X.id)??"":""},bt=new Map,C=R=>{let A=bt.get(R);return A||bt.set(R,A={nodes:[],flows:[]}),A};for(const R of h)C(R.node.participant??"").nodes.push(R);for(const R of m)C(Re(R.flow.source)).flows.push(R);const _=R=>{var A;return i.create("bpmn:SequenceFlow",{id:R.id,name:R.name??((A=R.condition)==null?void 0:A.label)})},v=(R,A)=>r.createShape({type:ts(R.type),businessObject:i.create(ts(R.type),{id:R.id,name:R.name,...A!==void 0?{"bwl:band":A}:{}})}),k=[...N.map(({op:R})=>R.participant.id).filter(R=>bt.has(R)),...[...bt.keys()].filter(R=>!d.some(A=>A.participant.id===R))],O=R=>R.endsWith("Gateway");for(const R of k){const A=bt.get(R),B=R?p(R):void 0,X=B?B.x+150:250;let K=B?B.y+80:120;const G=(we,Ce,xe)=>{const Fe=u().children.filter(Ke=>!("waypoints"in Ke&&Ke.waypoints)&&Ke.id!==Ce&&typeof Ke.y=="number"&&Ke.y>=we);Fe.length&&n.moveElements(Fe,{x:0,y:xe})},ee=(we,Ce)=>{if(we){const je=p(we),We=$(Ce);if(je.height>=We)return;const ge=We-je.height,He=f(je),Ue=He?He.y+He.height:je.y+je.height;n.resizeLane(je,{x:je.x,y:je.y,width:je.width,height:We},!1),G(Ue,He==null?void 0:He.id,ge);return}if(!B)return;const xe=j*(Ce+1);if(B.height>=xe)return;const Fe=xe-B.height,Ke=B.y+B.height;n.resizeShape(B,{x:B.x,y:B.y,width:B.width,height:xe}),G(Ke,B.id,Fe)},gt=(we,Ce,xe)=>{if(we){const Fe=p(we);return Fe.y+Math.min(Fe.height/2,L)+se(we,Ce??0)*j}return Ce!==void 0&&B?B.y+F+se(`pool:${R}`,Ce)*j:xe},he=(we,Ce,xe)=>{if(we){const Fe=p(we);return Fe.y+Math.min(Fe.height/2,L)+Ce*j}return B?B.y+F+Ce*j:xe},Be=we=>we.participant?p(we.participant):u(),ut=30,an=(we,Ce,xe,Fe)=>{const Ke=xe-Ce.width/2,je=Fe-Ce.height/2;return(we.children??[]).find(We=>!("waypoints"in We&&We.waypoints)&&We.type!=="bpmn:Lane"&&We.type!=="label"&&typeof We.x=="number"&&Ke<We.x+We.width+ut&&Ke+Ce.width+ut>We.x&&je<We.y+We.height&&je+Ce.height>We.y)},zt=(we,Ce,xe,Fe,Ke,je)=>{const We=xe!==void 0||Fe!==void 0,ge=se(xe??`pool:${R}`,Fe??0);if(We)for(let ze=0;ze<4;ze++){const yt=he(xe,ge+ze,je);if(!an(we,Ce,Ke,yt))return ee(xe,ge+ze),{x:Ke,y:yt}}const He=gt(xe,Fe,je);We&&ee(xe,ge);let Ue=Ke;for(let ze=0;ze<64;ze++){const yt=an(we,Ce,Ue,He);if(!yt)break;Ue=yt.x+yt.width+130+Ce.width/2}return{x:Ue,y:He}},Je=new Set(A.flows.map(we=>we.flow.target)),Kt=new Map;for(const we of A.nodes){if(Je.has(we.node.id))continue;const Ce=v(we.node,we.band),xe=re(we),Fe=we.node.lane?`${we.node.lane}|${xe??""}`:xe!==void 0?`band:${xe}`:"",Ke=Be(we.node),je=zt(Ke,Ce,we.node.lane,xe,Kt.get(Fe)??X,K);n.createShape(Ce,je,Ke),Kt.set(Fe,je.x+Ce.width+130),!we.node.lane&&xe===void 0&&(K+=160)}const Pn=new Set,In=new Map,Hr=new Map,Oe=new Map;if(R&&oe.has(`pool:${R}`)){const we=new Map;for(const ge of A.flows)we.set(ge.flow.target,(we.get(ge.flow.target)??0)+1);const Ce=ge=>gt(ge.node.lane,ae(ge),Number.NaN),xe=new Set,Fe=ge=>{var ze;const He=(ze=w.get(ge))==null?void 0:ze.node.participant;if(He)return l(He);const Ue=l(ge);if(Ue)return Ue.type==="bpmn:Participant"?Ue:f(Ue)},Ke=ge=>{const He=[],Ue=new Set([ge]),ze=[ge];for(;ze.length;){const yt=ze.shift(),rt=w.get(yt);rt&&He.push(rt);for(const Pe of A.flows)Pe.flow.source!==yt||Ue.has(Pe.flow.target)||(we.get(Pe.flow.target)??0)!==1||(Ue.add(Pe.flow.target),ze.push(Pe.flow.target))}return He},je=ge=>{if(!B)return;const He=new Set(ge.map(yt=>yt.node.id));let Ue=!1,ze=!1;for(const yt of g){if(!He.has(yt.flow.source))continue;const rt=Fe(yt.flow.target);!rt||rt.id===B.id||(rt.y<B.y?Ue=!0:ze=!0)}return Ue&&!ze?"up":ze&&!Ue?"down":void 0};for(const ge of A.nodes){if(!O(ge.node.type))continue;const He=gt(ge.node.lane,re(ge),Number.NaN);if(Number.isNaN(He))continue;const Ue=[];for(const Pe of A.flows){if(Pe.flow.source!==ge.node.id)continue;const Ve=w.get(Pe.flow.target);if(!Ve||Ve.node.lane!==ge.node.lane||(we.get(Ve.node.id)??0)!==1)continue;const ot=re(Ve);if(ot===void 0)continue;const sn=gt(Ve.node.lane,ot,Number.NaN);if(Number.isNaN(sn))continue;const au=Ke(Ve.node.id),su=je(au);su&&Ue.push({subtree:au,band:ot,row:sn,dir:su})}if(!Ue.some(Pe=>Pe.dir==="up")||!Ue.some(Pe=>Pe.dir==="down")||!Ue.some(Pe=>Pe.dir==="up"&&Ue.some(Ve=>Ve.dir==="down"&&Ve.row<Pe.row)))continue;const yt=[...Ue].sort((Pe,Ve)=>Pe.row-Ve.row);[...Ue.filter(Pe=>Pe.dir==="up"),...Ue.filter(Pe=>Pe.dir==="down")].sort((Pe,Ve)=>Pe.dir===Ve.dir?Pe.row-Ve.row:Pe.dir==="up"?-1:1).forEach((Pe,Ve)=>{const ot=yt[Ve].band;if(ot!==Pe.band){xe.add(ge.node.id);for(const sn of Pe.subtree)re(sn)===Pe.band&&le.set(sn.node.id,ot)}})}for(const ge of A.nodes){if(!O(ge.node.type))continue;const He=Ce(ge);if(Number.isNaN(He)||b.some(Pe=>{var Ve,ot;return(((Ve=Pe.placement)==null?void 0:Ve.anchor)??(Pe.association?Pe.association.source===Pe.annotation.id?Pe.association.target:Pe.association.source:void 0))===ge.node.id&&((ot=Pe.placement)==null?void 0:ot.side.startsWith("bottom"))}))continue;let ze,yt=!1,rt;for(const Pe of A.flows){if(Pe.flow.source!==ge.node.id)continue;const Ve=w.get(Pe.flow.target);if(!Ve||!Ve.node.lane&&re(Ve)===void 0)continue;const ot=Ce(Ve);Number.isNaN(ot)||(Math.abs(ot-He)<.5&&(yt=!0),ot>He?!ze||ot>ze.row?ze={id:Ve.node.id,row:ot,count:1}:ot===ze.row&&ze.count++:ot<He&&Ve.node.lane===ge.node.lane&&(!rt||ot>rt.row?rt={op:Ve,row:ot,count:1}:ot===rt.row&&rt.count++))}ze&&ze.count===1&&(we.get(ze.id)??0)===1&&!xe.has(ge.node.id)&&Pn.add(ze.id),!yt&&rt&&rt.count===1&&(we.get(rt.op.node.id)??0)===1&&In.set(rt.op.node.id,{lane:ge.node.lane,band:ae(ge)})}const We=new Map;for(const ge of g)We.set(ge.flow.target,[...We.get(ge.flow.target)??[],ge]);for(const ge of A.nodes){const He=We.get(ge.node.id);if(!He||He.length!==1||!we.get(ge.node.id)||!ge.node.lane&&re(ge)===void 0)continue;const Ue=(qb=w.get(He[0].flow.source))==null?void 0:qb.node.participant,ze=Ue?l(Ue):void 0;if(!ze||!B||ze.id===B.id)continue;const yt=ge.node.lane??`pool:${R}`,rt=ct.get(yt);if(!rt)continue;const Pe=rt.get(0)??0,Ve=(rt.get(ae(ge)??0)??Pe)-Pe;if(Ve===0)continue;const ot=ze.y<B.y;if(ot&&Ve<0||!ot&&Ve>0)continue;let sn;for(const[au,su]of rt){const ja=su-Pe;(ot&&ja<0&&(!sn||ja<sn.row)||!ot&&ja>0&&(!sn||ja>sn.row))&&(sn={band:au,row:ja})}sn&&Hr.set(ge.node.id,{lane:ge.node.lane,band:sn.band})}}const vt=new Set;let it=0;for(;it++<A.nodes.length+2;){for(let xe=0;xe<A.nodes.length+A.flows.length+2;xe++){let Fe=!1;for(const Ke of A.flows){const je=Ke.flow;if(vt.has(je.id))continue;const We=l(je.source);if(!We)continue;const ge=l(je.target),He=w.get(je.target);if(!ge&&He){const Ue=v(He.node,He.band),ze=ae(He);if(He.node.lane||ze!==void 0){const yt=Be(He.node),rt=We,Pe=rt.x+(Oe.get(je.source)??0)+rt.width+130,Ve=In.get(je.target)??Hr.get(je.target),ot=zt(yt,Ue,Ve?Ve.lane:He.node.lane,Ve?Ve.band:ze,Pn.has(je.target)?rt.x+rt.width/2:Pe,Number.NaN),sn=n.createShape(Ue,ot,yt);Pn.has(je.target)&&Oe.set(je.target,Pe-(sn.x+sn.width/2)),n.connect(We,sn,{type:"bpmn:SequenceFlow",businessObject:_(je)})}else s.append(We,Ue,{connection:{type:"bpmn:SequenceFlow",businessObject:_(je)}})}else if(ge)n.connect(We,ge,{type:"bpmn:SequenceFlow",businessObject:_(je)});else continue;vt.add(je.id),Fe=!0}if(!Fe)break}const we=A.nodes.filter(xe=>!l(xe.node.id));if(!we.length)break;const Ce=we[0];{const xe=v(Ce.node,Ce.band),Fe=Be(Ce.node),Ke=re(Ce);n.createShape(xe,zt(Fe,xe,Ce.node.lane,Ke,X,K),Fe),!Ce.node.lane&&Ke===void 0&&(K+=160)}}}const z=40,ie=(R,A=()=>!0)=>{const B=l(R);if(!B)return[];const X=[B],K=new Set([R]);for(let G=0;G<X.length;G++){const ee=X[G].id;for(const gt of m){const he=gt.flow.target;if(gt.flow.source!==ee||K.has(he)||!w.has(he))continue;K.add(he);const Be=l(he);Be&&A(Be)&&X.push(Be)}}return X};for(const R of Vt(e,"sequenceFlow.update")){if(R.target===void 0)continue;const A=w.get(R.target);if(!A)continue;const B=l(R.target),X=l(R.id);if(!B||!X)continue;const K=R.source!==void 0?l(R.source):X.source,G=X.target;if(!K||!G||G.id===B.id)continue;const ee=ie(R.target),gt=new Set(ee.map(Je=>Je.id)),he=Math.min(...ee.map(Je=>Je.x)),Be=Math.max(...ee.map(Je=>Je.x+Je.width)),ut=K.x+K.width,an=Be-he+z*2-(G.x-ut);if(an>0){const Je=f(B),Kt=(Je==null?void 0:Je.children)??[],Pn=Oe=>Oe.type==="bpmn:Lane",In=Kt.filter(Oe=>!("waypoints"in Oe&&Oe.waypoints)&&!Pn(Oe)&&!gt.has(Oe.id)&&Oe.x>=G.x),Hr=Je?[Je,...Kt.filter(Oe=>Pn(Oe))]:[];In.length&&n.createSpace(In,Hr,{x:an,y:0},"e",G.x-1)}const zt=A.node.lane||A.band!==void 0?B.y+B.height/2:K.y+K.height/2;n.moveElements(ee,{x:ut+z-he,y:zt-(B.y+B.height/2)})}const be=(R,A)=>{const B=A.target===R,X=p(A.source),K=p(A.target),G=B?"bpmn:DataOutputAssociation":"bpmn:DataInputAssociation";n.connect(X,K,A.id?{type:G,businessObject:i.create(G,{id:A.id})}:{type:G})};for(const R of S){const A=R.associations??[],B=A.map(G=>G.source===R.dataStore.id?G.target:G.source).map(l).find(Boolean),X=B?f(B)??u():u(),K=B?{x:B.x+B.width/2,y:B.y+B.height+110}:{x:200,y:V+60};n.createShape({type:"bpmn:DataStoreReference",businessObject:i.create("bpmn:DataStoreReference",{id:R.dataStore.id,name:R.dataStore.name})},K,X);for(const G of A)be(R.dataStore.id,G)}for(const R of E){const B=p(R.association.target).type==="bpmn:DataStoreReference"?R.association.target:R.association.source;be(B,R.association)}for(const R of g){const A=R.flow;n.connect(p(A.source),p(A.target),{type:"bpmn:MessageFlow",businessObject:i.create("bpmn:MessageFlow",{id:A.id,name:A.name})})}const Ne=100,mt=30,Ye=4,Lt=R=>!("waypoints"in R&&R.waypoints)&&R.type!=="bpmn:Lane"&&R.type!=="label"&&typeof R.x=="number",Ft=()=>{const R=Nn(o);return{bad:zi(R).filter(A=>A.kind==="edge-crosses-shape"||A.kind==="edge-overlap-opposite"||A.kind==="edge-overlap-mixed").length,crossings:ad(R),straight:R.edges.filter(A=>A.type==="bpmn:MessageFlow"&&A.waypoints.length===2).length}},rn=R=>{const A=Nn(o),B=A.edges.find(X=>X.id===R);return!!B&&Hi(B,Kr(A)).length>0},tt=(R,A,B)=>{const X=new Set(R.map(Be=>Be.id)),K=(A.children??[]).filter(Lt).filter(Be=>!X.has(Be.id));if(R.some(Be=>K.some(ut=>Be.x+B<ut.x+ut.width+mt&&Be.x+B+Be.width+mt>ut.x&&Be.y<ut.y+ut.height&&Be.y+Be.height>ut.y)))return null;const ee=A.width;n.moveElements(R,{x:B,y:0});const he=Math.max(...R.map(Be=>Be.x+Be.width))+150-(A.x+A.width);return he>0&&n.resizeShape(A,{x:A.x,y:A.y,width:A.width+he,height:A.height}),()=>{n.moveElements(R,{x:-B,y:0}),he>0&&n.resizeShape(A,{x:A.x,y:A.y,width:ee,height:A.height})}},At=(R,A)=>A.bad>R.bad||A.crossings>R.crossings&&A.straight<=R.straight,on=(R,A,B,X=()=>!0)=>{const K=Ft(),G=tt(R,A,B);if(!G)return!1;const ee=Ft();return At(K,ee)||!X()?(G(),!1):!0},Fr=R=>{var B;const A=(B=w.get(R))==null?void 0:B.node.participant;return!!A&&oe.has(`pool:${A}`)},fn=new Map;for(const R of g){if(!Fr(R.flow.target))continue;const A=fn.get(R.flow.target)??[];A.push(R),fn.set(R.flow.target,A)}const Kn=[...fn.keys()],Dn=new Set(m.map(R=>R.flow.target)),Tt=R=>N.findIndex(({op:A})=>A.participant.id===R);Kn.sort((R,A)=>{var K,G;const B=Dn.has(R)?1:0,X=Dn.has(A)?1:0;return B!==X?B-X:Tt((K=w.get(R))==null?void 0:K.node.participant)-Tt((G=w.get(A))==null?void 0:G.node.participant)});const Jn=R=>R.x+R.width/2,Ba=R=>{let A;for(const B of fn.get(R)??[]){const X=l(B.flow.source);if(!X)continue;const K=Jn(X);(!A||K>A.cx)&&(A={op:B,cx:K})}return A==null?void 0:A.op},On=R=>{const A=Ba(R),B=l(R),X=A?l(A.flow.source):void 0;return B&&X?Jn(X)-Jn(B):void 0},$e=R=>{const A=On(R);return A!==void 0&&Math.abs(A)<Ne},Ge=R=>{const A=Ba(R);if(!A)return null;const B=l(R),X=l(A.flow.source);if(!B||!X)return null;const K=Jn(X)-Jn(B);if(K>=Ne){const G=p(w.get(R).node.participant);return{subtree:ie(R,ee=>ee.x>=B.x),pool:G,dx:K}}if(-K>=Ne&&Fr(A.flow.source)){const G=p(w.get(A.flow.source).node.participant);return{subtree:ie(A.flow.source,ee=>ee.x>=X.x&&!$e(ee.id)),pool:G,dx:-K}}return null},Hb=()=>Kn.map(R=>({id:R,plan:Ge(R)})).filter(R=>!!R.plan).sort((R,A)=>Math.min(...R.plan.subtree.map(B=>B.x))-Math.min(...A.plan.subtree.map(B=>B.x))).map(R=>R.id);for(let R=0;R<3;R++){const A=Ft(),B=[];for(const K of Hb()){const G=Ge(K);if(!G)continue;const ee=tt(G.subtree,G.pool,G.dx);ee&&B.push(ee)}if(!B.length)break;if(!At(A,Ft()))continue;for(const K of B.reverse())K();let X=!1;for(const K of Hb()){const G=Ge(K);G&&on(G.subtree,G.pool,G.dx)&&(X=!0)}if(!X)break}for(const R of Kn.flatMap(A=>fn.get(A)??[])){if(!rn(R.flow.id))continue;const A=l(R.flow.target);if(!A)continue;const B=p(w.get(R.flow.target).node.participant),X=ie(R.flow.target,G=>G.x>=A.x),K=A.width+130;for(let G=1;G<=Ye&&!on(X,B,K*G,()=>!rn(R.flow.id));G++);}let zb=0;for(const R of x){const A=(R.group.members??[]).map(l).filter(G=>!!G),B=40;let X;if(A.length){const G=Math.min(...A.map(Be=>Be.x))-B,ee=Math.min(...A.map(Be=>Be.y))-B,gt=Math.max(...A.map(Be=>Be.x+Be.width))+B,he=Math.max(...A.map(Be=>Be.y+Be.height))+B;X={x:G,y:ee,width:gt-G,height:he-ee}}else X={x:300+zb*350,y:40,width:300,height:200},zb++;const K=n.createShape({type:"bpmn:Group",businessObject:i.create("bpmn:Group",{id:R.group.id}),width:X.width,height:X.height},{x:X.x+X.width/2,y:X.y+X.height/2},u());R.group.name&&n.updateLabel(K,R.group.name),(Yb=R.group.members)!=null&&Yb.length&&T(K,"bwl:Members",{refs:R.group.members.join(" ")})}const Vb=R=>{const A=R.waypoints;if(A!=null&&A.length){const X=A[Math.floor((A.length-1)/2)];return{x:X.x,y:X.y,width:0,height:0}}const B=R;return{x:B.x,y:B.y,width:B.width,height:B.height}};let $a=0;const Gb=12,Wb=14,pD=15,fD=300,dD=R=>{const A=R.split(`
|
|
7
|
+
`),B=Math.max(...A.map(G=>Lo(G,Gb))),X=Math.max(100,Math.min(fD,Math.ceil(B)+Wb)),K=A.reduce((G,ee)=>G+Math.max(1,Math.ceil((Lo(ee,Gb)+Wb)/X)),0);return{width:X,height:Math.max(30,K*pD+10)}},Yt=10;for(const R of b){const A=R.association,B=((Kb=R.placement)==null?void 0:Kb.anchor)??(A?A.source===R.annotation.id?A.target:A.source:void 0),X=B?l(B):void 0,K=X?Vb(X):void 0,G=dD(R.annotation.text??"");let ee;if(K&&R.placement){const[ut,an]=Iu[R.placement.side],zt=R.placement.offset??50;ee={x:K.x+K.width/2+ut*(K.width/2+G.width/2+zt),y:K.y+K.height/2+an*(K.height/2+G.height/2+zt)}}else K?(ee={x:K.x+K.width/2+180+$a%3*260,y:K.y-110-$a%2*95},$a++):(ee={x:300+$a*260,y:60},$a++);const gt=X?f(X)??u():u(),he=gt;if(K&&typeof he.x=="number"&&typeof he.width=="number"&&he.type==="bpmn:Participant"){const ut=(Oe,vt)=>{const[it,we]=Iu[Oe];let Ce={x:K.x+K.width/2+it*(K.width/2+G.width/2+vt),y:K.y+K.height/2+we*(K.height/2+G.height/2+vt)};const xe=he.x+Yt+G.width/2,Fe=he.x+he.width-Yt-G.width/2,Ke=he.y+Yt+G.height/2,je=he.y+he.height-Yt-G.height/2,We={x:Math.min(Fe,Math.max(xe,Ce.x)),y:Math.min(je,Math.max(Ke,Ce.y))};return(We.x!==Ce.x||We.y!==Ce.y)&&(Ce=Math.abs(We.x-(K.x+K.width/2))<(K.width+G.width)/2+Yt&&Math.abs(We.y-(K.y+K.height/2))<(K.height+G.height)/2+Yt?{x:K.x+K.width+Yt+G.width/2,y:We.y}:We),Ce},an=(he.children??[]).filter(Oe=>!("waypoints"in Oe&&Oe.waypoints)&&Oe.type!=="bpmn:Lane"&&Oe.type!=="label"&&typeof Oe.x=="number"),zt=Nn(o).edges.flatMap(ii),Je=Oe=>({x0:Oe.x-G.width/2-Yt,x1:Oe.x+G.width/2+Yt,y0:Oe.y-G.height/2-Yt,y1:Oe.y+G.height/2+Yt}),Kt=Oe=>{const vt=Je(Oe);return an.some(it=>vt.x0<it.x+it.width&&vt.x1>it.x&&vt.y0<it.y+it.height&&vt.y1>it.y)},Pn=Oe=>{const vt=Je(Oe);return zt.some(it=>it.axis==="h"?it.at>vt.y0&&it.at<vt.y1&&it.lo<vt.x1&&it.hi>vt.x0:it.at>vt.x0&&it.at<vt.x1&&it.lo<vt.y1&&it.hi>vt.y0)},In=Oe=>Kt(Oe)||Pn(Oe),Hr=Oe=>Oe.x-G.width/2>=he.x&&Oe.x+G.width/2<=he.x+he.width&&Oe.y-G.height/2>=he.y&&Oe.y+G.height/2<=he.y+he.height;if(R.placement){const Oe=xe=>xe.startsWith("top")?xe.replace(/^top/,"bottom"):xe.replace(/^bottom/,"top"),vt=xe=>xe.endsWith("left")?xe.replace(/left$/,"right"):xe.replace(/right$/,"left"),it=R.placement.side,we=[it,Oe(it),vt(it),Oe(vt(it)),"top","bottom","right","left","top-right","top-left","bottom-right","bottom-left"],Ce=R.placement.offset??50;if(ee=ut(it,Ce),In(ee)){const xe=new Set;for(const Fe of we){if(xe.has(Fe))continue;xe.add(Fe);const Ke=ut(Fe,Ce);if(Hr(Ke)&&!In(Ke)){ee=Ke;break}}}}else{const Oe=he.x+Yt+G.width/2,vt=he.x+he.width-Yt-G.width/2,it=he.y+Yt+G.height/2,we=he.y+he.height-Yt-G.height/2;if(ee={x:Math.min(vt,Math.max(Oe,ee.x)),y:Math.min(we,Math.max(it,ee.y))},In(ee)){const Ce=(K.width+G.width)/2+Yt,Fe=[{x:ee.x+Ce,y:ee.y},{x:ee.x-Ce,y:ee.y},{x:ee.x,y:ee.y-G.height-Yt},{x:ee.x,y:ee.y+G.height+Yt}].filter(Hr).find(Ke=>!In(Ke));Fe&&(ee=Fe)}}}const Be=n.createShape({type:"bpmn:TextAnnotation",width:G.width,height:G.height,businessObject:i.create("bpmn:TextAnnotation",{id:R.annotation.id,text:R.annotation.text})},ee,gt);if(A){const ut=an=>an===R.annotation.id?Be:p(an);n.connect(ut(A.source),ut(A.target),A.id?{type:"bpmn:Association",businessObject:i.create("bpmn:Association",{id:A.id})}:{type:"bpmn:Association"})}R.placement&&T(Be,"bwl:Placement",I(R.placement))}for(const R of Vt(e,"association.add")){const A=R.association;n.connect(p(A.source),p(A.target),A.id?{type:"bpmn:Association",businessObject:i.create("bpmn:Association",{id:A.id})}:{type:"bpmn:Association"})}for(const R of Vt(e,"node.update")){let A=p(R.id);if(R.type&&ts(R.type)!==A.type&&(A=c.replaceElement(A,{type:ts(R.type)})),R.name!==void 0&&n.updateProperties(A,{name:R.name??void 0}),R.lane){const B=p(R.lane),X=B.y+B.height/2-(A.y+A.height/2);X!==0&&n.moveElements([A],{x:0,y:X})}}for(const R of Vt(e,"sequenceFlow.update")){const A=p(R.id);if(R.source!==void 0||R.target!==void 0){const B=A,X=R.source!==void 0?p(R.source):B.source,K=R.target!==void 0?p(R.target):B.target,G=ee=>({x:ee.x+ee.width/2,y:ee.y+ee.height/2});n.reconnect(B,X,K,[G(X),G(K)])}R.name!==void 0&&n.updateProperties(A,{name:R.name??void 0}),R.condition!==void 0&&n.updateProperties(A,{name:((Xb=R.condition)==null?void 0:Xb.label)??void 0})}for(const R of Vt(e,"messageFlow.update"))R.name!==void 0&&n.updateProperties(p(R.id),{name:R.name??void 0});for(const R of Vt(e,"dataStore.update"))R.name!==void 0&&n.updateProperties(p(R.id),{name:R.name??void 0});for(const R of Vt(e,"annotation.update")){const A=p(R.id);if(R.text!==void 0&&n.updateProperties(A,{text:R.text}),R.placement===null)T(A,"bwl:Placement",null);else if(R.placement){const B=Vb(p(R.placement.anchor)),[X,K]=Iu[R.placement.side],G=R.placement.offset??50,ee=B.x+B.width/2+X*(B.width/2+A.width/2+G),gt=B.y+B.height/2+K*(B.height/2+A.height/2+G);n.moveElements([A],{x:ee-(A.x+A.width/2),y:gt-(A.y+A.height/2)}),T(A,"bwl:Placement",I(R.placement))}}for(const R of Vt(e,"group.update")){const A=p(R.id);if(R.name!==void 0&&n.updateLabel(A,R.name??""),R.members){const B=R.members.map(l).filter(X=>!!X);if(B.length){const K=Math.min(...B.map(he=>he.x))-40,G=Math.min(...B.map(he=>he.y))-40,ee=Math.max(...B.map(he=>he.x+he.width))+40,gt=Math.max(...B.map(he=>he.y+he.height))+40;n.resizeShape(A,{x:K,y:G,width:ee-K,height:gt-G})}T(A,"bwl:Members",{refs:R.members.join(" ")})}}}function Dd(e,t,n=kd){const i=Md(e),r=Ad(t,ld(i.elementRegistry)),o={edgeCrossings:{before:0,after:0}};if(r.length)return{ok:!1,issues:r,findings:[],stats:o};const a=Nn(i.elementRegistry),s=new Set(zi(a).map(Fi)),c=new Set(a.edges.map(d=>d.id)),u=ku(a).length,l=e.get("commandStack");try{Tf(l,()=>{n(t,i),bd(i,c),vd(i,s),wd(i,s,c),Rd(i,s,c)})}catch(d){return{ok:!1,issues:[{kind:"lower-failed",message:d instanceof Error?d.message:String(d)}],findings:[],stats:o}}const p=Nn(i.elementRegistry),f=zi(p).filter(d=>!s.has(Fi(d)));return{ok:!0,issues:[],findings:f,stats:{edgeCrossings:{before:u,after:ku(p).length}}}}function RE(e){const t=e.slice(e.indexOf(":")+1);return t.charAt(0).toLowerCase()+t.slice(1)}function CE(e,t){return typeof e.get=="function"?e.get(t):e[t]}function Od(e,t){const n=CE(e,t);return typeof n=="number"&&Number.isFinite(n)?n:void 0}function Id(e,t){var i;return(((i=e.extensionElements)==null?void 0:i.values)??[]).find(r=>(r==null?void 0:r.$type)===t)}function PE(e){return typeof e=="string"&&uu.includes(e)}function ri(e){if(typeof e=="string")return e;const t=e==null?void 0:e.id;return typeof t=="string"?t:void 0}function Ld(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=[],S=new Set,E=new Set,b=Y=>{Y&&S.add(Y)},x=Y=>{S.add(Y),E.add(Y)},w=Y=>{const re=Id(Y,"bwl:Placement");if(!re)return;const le=typeof re.anchor=="string"?re.anchor:void 0;if(!le||!PE(re.side))return;const ae=typeof re.offset=="number"?re.offset:void 0;m.push({owner:Y.id,anchor:le,side:re.side,...ae!==void 0?{offset:ae}:{}})},T=Y=>{const re=Id(Y,"bwl:Members"),le=typeof(re==null?void 0:re.refs)=="string"?re.refs.split(/\s+/).filter(Boolean):[];le.length&&g.push({owner:Y.id,refs:le})},I=Y=>{var re;for(const le of Y)switch(b(le.id),le.$type){case"bpmn:TextAnnotation":x(le.id),s.push({id:le.id,text:typeof le.text=="string"?le.text:""}),w(le);break;case"bpmn:Association":d.push({id:le.id,type:le.$type,source:ri(le.sourceRef),target:ri(le.targetRef)});break;case"bpmn:Group":{x(le.id);const ae=(re=le.categoryValueRef)==null?void 0:re.value;c.push({id:le.id,...typeof ae=="string"&&ae?{name:ae}:{}}),T(le);break}default:u.push({id:le.id,type:le.$type,reason:"type-outside-mvp"})}},P=(Y,re)=>{const le=Y.flowElements??[],ae=(Y.laneSets??[]).flatMap(Z=>Z.lanes??[]),se=new Map;for(const Z of ae){b(Z.id);for(const $ of Z.flowNodeRef??[]){const N=ri($);N&&se.set(N,Z.id)}}for(const Z of le){if(b(Z.id),Z.$type==="bpmn:SequenceFlow"){p.push({id:Z.id,source:ri(Z.sourceRef),target:ri(Z.targetRef),...typeof Z.name=="string"&&Z.name?{name:Z.name}:{}});continue}if(Z.$type==="bpmn:DataStoreReference"){x(Z.id),a.push({id:Z.id,...Z.name?{name:Z.name}:{}});continue}const $=RE(Z.$type);if(!Rf($)){u.push({id:Z.id,type:Z.$type,reason:"type-outside-mvp"});continue}x(Z.id),o.push({id:Z.id,type:$,...Z.name?{name:Z.name}:{},...re?{participant:re}:{},...se.has(Z.id)?{lane:se.get(Z.id)}:{}});const N=Od(Z,"bwl:band");N!==void 0&&(l.bands[Z.id]=N);for(const V of Z.dataOutputAssociations??[])b(V.id),h.push({id:V.id,type:V.$type,source:Z.id,target:ri(V.targetRef)});for(const V of Z.dataInputAssociations??[])b(V.id),h.push({id:V.id,type:V.$type,source:ri((V.sourceRef??[])[0]),target:Z.id})}I(Y.artifacts??[])};if(n){const Y=new Set;for(const re of n.participants??[]){x(re.id);const le=ri(re.processRef);le&&Y.add(le);const ae=le?i.get(le):void 0,se=((ae==null?void 0:ae.laneSets)??[]).flatMap(V=>V.lanes??[]),Z=se.map(V=>({id:V.id,...V.name?{name:V.name}:{}}));for(const V of Z)x(V.id);const $=!ae||(ae.flowElements??[]).length===0&&se.length===0&&(ae.artifacts??[]).length===0;r.push({id:re.id,...re.name?{name:re.name}:{},...$?{blackBox:!0}:{},...Z.length?{lanes:Z}:{}});const N=Od(re,"bwl:poolOrder");N!==void 0&&(l.poolOrders[re.id]=N),ae&&P(ae,re.id)}for(const re of n.messageFlows??[])b(re.id),f.push({id:re.id,source:ri(re.sourceRef),target:ri(re.targetRef),...typeof re.name=="string"&&re.name?{name:re.name}:{}});I(n.artifacts??[]);for(const[re,le]of i)!Y.has(re)&&(le.flowElements??[]).length>0&&u.push({id:re,type:le.$type,reason:"unreachable-process"})}else for(const Y of i.values())P(Y);const j=[],F=[],L=[],H=[],oe=(Y,re)=>!!Y&&!!re&&E.has(Y)&&E.has(re);for(const Y of p){if(!oe(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}:{}}),E.add(Y.id)}for(const Y of f){if(!oe(Y.source,Y.target)){u.push({id:Y.id,type:"bpmn:MessageFlow",reason:"endpoint-outside-mvp"});continue}F.push({id:Y.id,source:Y.source,target:Y.target,...Y.name?{name:Y.name}:{}}),E.add(Y.id)}for(const Y of h){if(!oe(Y.source,Y.target)){u.push({id:Y.id??"",type:Y.type,reason:"endpoint-outside-mvp"});continue}H.push({...Y.id?{id:Y.id}:{},source:Y.source,target:Y.target}),Y.id&&E.add(Y.id)}for(const Y of d){if(!oe(Y.source,Y.target)){u.push({id:Y.id??"",type:Y.type,reason:"endpoint-outside-mvp"});continue}L.push({...Y.id?{id:Y.id}:{},source:Y.source,target:Y.target})}const De=new Map(c.map(Y=>[Y.id,Y]));for(const{owner:Y,refs:re}of g){const le=re.filter(se=>S.has(se)),ae=De.get(Y);ae&&le.length&&(ae.members=le)}for(const Y of m)S.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,...F.length?{messageFlows:F}:{},...a.length?{dataStores:a}:{},...H.length?{dataAssociations:H}:{},...s.length?{annotations:s}:{},...L.length?{associations:L}:{},...c.length?{groups:c}:{}},hints:l,omitted:u}}async function AE(e){const{definitions:t,warnings:n}=await Cu(e);return{...Ld(t),warnings:n}}function TE(e,t,n,i={}){return{documentId:e,baseVersion:t,ops:[...n],origin:i.origin??"agent",clientOpId:(i.mkClientOpId??(()=>crypto.randomUUID()))()}}async function Nd(e,t,{currentVersion:n}){if(t.baseVersion!==n)return{status:"conflict",baseVersion:t.baseVersion,currentVersion:n};const i=Dd(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 ME=Symbol("bpmn-editor");function kE(){const e=xt.ref(!1),t=xt.ref(!0),n=xt.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 Nd(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:Pu(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 te(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 Lu={exports:{}},Bd;function OE(){if(Bd)return Lu.exports;Bd=1;var e=Lu.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},Lu.exports}var IE=OE(),LE=DE(IE);function oi(e){if(!(this instanceof oi))return new oi(e);e=e||[128,36,1],this._seed=e.length?LE.rack(e[0],e[1],e[2]):e}oi.prototype.next=function(e){return this._seed(e||!0)},oi.prototype.nextPrefixed=function(e,t){var n;do n=e+this.next(!0);while(this.assigned(n));return this.claim(n,t),n},oi.prototype.claim=function(e,t){this._seed.set(e,t||!0)},oi.prototype.assigned=function(e){return this._seed.get(e)||!1},oi.prototype.unclaim=function(e){delete this._seed.hats[e]},oi.prototype.clear=function(){var e=this._seed.hats,t;for(t in e)this.unclaim(t)};const kt={legend:[1,"<fieldset>","</fieldset>"],tr:[2,"<table><tbody>","</tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],_default:[0,"",""]};kt.td=kt.th=[3,"<table><tbody><tr>","</tr></tbody></table>"],kt.option=kt.optgroup=[1,'<select multiple="multiple">',"</select>"],kt.thead=kt.tbody=kt.colgroup=kt.caption=kt.tfoot=[1,"<table>","</table>"],kt.polyline=kt.ellipse=kt.polygon=kt.circle=kt.text=kt.line=kt.path=kt.rect=kt.g=[1,'<svg xmlns="http://www.w3.org/2000/svg" version="1.1">',"</svg>"];function nt(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(kt,i)?kt[i]:kt._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 NE(e,t){return t.forEach(function(n){n&&typeof n!="string"&&!Array.isArray(n)&&Object.keys(n).forEach(function(i){if(i!=="default"&&!(i in e)){var r=Object.getOwnPropertyDescriptor(n,i);Object.defineProperty(e,i,r.get?r:{enumerable:!0,get:function(){return n[i]}})}})}),Object.freeze(e)}function ln(e,...t){const n=e.style;return M(t,function(i){i&&M(i,function(r,o){n[o]=r})}),e}function en(e,t,n){return arguments.length==2?e.getAttribute(t):n===null?e.removeAttribute(t):(e.setAttribute(t,n),e)}const BE=Object.prototype.toString;function st(e){return new Vi(e)}function Vi(e){if(!e||!e.nodeType)throw new Error("A DOM element reference is required");this.el=e,this.list=e.classList}Vi.prototype.add=function(e){return this.list.add(e),this},Vi.prototype.remove=function(e){return BE.call(e)=="[object RegExp]"?this.removeMatching(e):(this.list.remove(e),this)},Vi.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},Vi.prototype.toggle=function(e,t){return typeof t<"u"?t!==this.list.toggle(e,t)&&this.list.toggle(e):this.list.toggle(e),this},Vi.prototype.array=function(){return Array.from(this.list)},Vi.prototype.has=Vi.prototype.contains=function(e){return this.list.contains(e)};function ns(e){for(var t;t=e.firstChild;)e.removeChild(t);return e}function wr(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 is={},$d;function jE(){if($d)return is;$d=1;var e,t,n;function i(){e=window.addEventListener?"addEventListener":"attachEvent",t=window.removeEventListener?"removeEventListener":"detachEvent",n=e!=="addEventListener"?"on":""}return is.bind=function(r,o,a,s){return e||i(),r[e](n+o,a,s||!1),a},is.unbind=function(r,o,a,s){return t||i(),r[t](n+o,a,s||!1),a},is}var jd=jE(),FE=$E(jd),ve=NE({__proto__:null,default:FE},[jd]),Fd=["focus","blur"];function HE(e,t,n,i,r){return Fd.indexOf(n)!==-1&&(r=!0),ve.bind(e,n,function(o){var a=o.target||o.srcElement;o.delegateTarget=wr(a,t,!0),o.delegateTarget&&i.call(e,o)},r)}function zE(e,t,n,i){return Fd.indexOf(t)!==-1&&(i=!0),ve.unbind(e,t,n,i)}var _n={bind:HE,unbind:zE};function Nu(e,t){return e&&typeof e.matches=="function"&&e.matches(t)||!1}function qe(e,t){return t=t||document,t.querySelector(e)}function rs(e,t){return t=t||document,t.querySelectorAll(e)}function ai(e){e.parentNode&&e.parentNode.removeChild(e)}function VE(e,t){if(e.ownerDocument!==t.ownerDocument)try{return t.ownerDocument.importNode(e,!0)}catch{}return e}function GE(e,t){return t.appendChild(VE(e,t))}function ye(e,t){return GE(t,e),e}var Bu=2,Hd={"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":Bu,"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":Bu,"text-anchor":1,"text-decoration":1,"text-rendering":1,"unicode-bidi":1,visibility:1,"word-spacing":1,"writing-mode":1};function WE(e,t){return Hd[t]?e.style[t]:e.getAttributeNS(null,t)}function zd(e,t,n){var i=t.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase(),r=Hd[i];r?(r===Bu&&typeof n=="number"&&(n=String(n)+"px"),e.style[i]=n):e.setAttributeNS(null,t,n)}function UE(e,t){var n=Object.keys(t),i,r;for(i=0,r;r=n[i];i++)zd(e,r,t[r])}function ne(e,t,n){if(typeof t=="string")if(n!==void 0)zd(e,t,n);else return WE(e,t);else UE(e,t);return e}const qE=Object.prototype.toString;function ke(e){return new Gi(e)}function Gi(e){if(!e||!e.nodeType)throw new Error("A DOM element reference is required");this.el=e,this.list=e.classList}Gi.prototype.add=function(e){return this.list.add(e),this},Gi.prototype.remove=function(e){return qE.call(e)=="[object RegExp]"?this.removeMatching(e):(this.list.remove(e),this)},Gi.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},Gi.prototype.toggle=function(e,t){return typeof t<"u"?t!==this.list.toggle(e,t)&&this.list.toggle(e):this.list.toggle(e),this},Gi.prototype.array=function(){return Array.from(this.list)},Gi.prototype.has=Gi.prototype.contains=function(e){return this.list.contains(e)};function os(e){for(var t;t=e.firstChild;)e.removeChild(t);return e}function Vd(e){return e.cloneNode(!0)}var $u={svg:"http://www.w3.org/2000/svg"},Gd='<svg xmlns="'+$u.svg+'"';function YE(e){var t=!1;e.substring(0,4)==="<svg"?e.indexOf($u.svg)===-1&&(e=Gd+e.substring(4)):(e=Gd+">"+e+"</svg>",t=!0);var n=KE(e);if(!t)return n;for(var i=document.createDocumentFragment(),r=n.firstChild;r.firstChild;)i.appendChild(r.firstChild);return i}function KE(e){var t;return t=new DOMParser,t.async=!1,t.parseFromString(e,"text/xml")}function ce(e,t){var n;return e=e.trim(),e.charAt(0)==="<"?(n=YE(e).firstChild,n=document.importNode(n,!0)):n=document.createElementNS($u.svg,e),t&&ne(n,t),n}var ju=null;function Wd(){return ju===null&&(ju=ce("svg")),ju}function Ud(e,t){var n,i,r=Object.keys(t);for(n=0;i=r[n];n++)e[i]=t[i];return e}function XE(e,t,n,i,r,o){var a=Wd().createSVGMatrix();switch(arguments.length){case 0:return a;case 1:return Ud(a,e);case 6:return Ud(a,{a:e,b:t,c:n,d:i,e:r,f:o})}}function No(e){return Wd().createSVGTransform()}var qd=/([&<>]{1})/g,ZE=/([&<>\n\r"]{1})/g,QE={"&":"&","<":"<",">":">",'"':"'"};function Fu(e,t){function n(i,r){return QE[r]||r}return e.replace(t,n)}function Yd(e,t){var n,i,r,o,a;switch(e.nodeType){case 3:t.push(Fu(e.textContent,qd));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,'="',Fu(o.value,ZE),'"');if(e.hasChildNodes()){for(t.push(">"),a=e.childNodes,n=0,i=a.length;n<i;++n)Yd(a.item(n),t);t.push("</",e.tagName,">")}else t.push("/>");break;case 8:t.push("<!--",Fu(e.nodeValue,qd),"-->");break;case 4:t.push("<![CDATA[",e.nodeValue,"]]>");break;default:throw new Error("unable to handle node "+e.nodeType)}return t}function JE(e){for(var t=e.firstChild,n=[];t;)Yd(t,n),t=t.nextSibling;return n.join("")}function Kd(e,t){return JE(e)}function Dt(e){var t=e.parentNode;return t&&t.removeChild(e),e}function ew(e,t){return t instanceof SVGMatrix?e.createSVGTransformFromMatrix(t):t}function tw(e,t){var n,i;for(e.clear(),n=0;i=t[n];n++)e.appendItem(ew(e,i))}function Bo(e,t){var n=e.transform.baseVal;return t&&(Array.isArray(t)||(t=[t]),tw(n,t)),n.consolidate()}const nw=/^class[ {]/;function iw(e){return nw.test(e.toString())}function Hu(e){return Array.isArray(e)}function zu(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function as(...e){e.length===1&&Hu(e[0])&&(e=e[0]),e=[...e];const t=e.pop();return t.$inject=e,t}const rw=/constructor\s*[^(]*\(\s*([^)]*)\)/m,ow=/^(?:async\s+)?(?:function\s*[^(]*)?(?:\(\s*([^)]*)\)|(\w+))/m,aw=/\/\*([^*]*)\*\//m;function sw(e){if(typeof e!="function")throw new Error(`Cannot annotate "${e}". Expected a function!`);const t=e.toString().match(iw(e)?rw:ow);if(!t)return[];const n=t[1]||t[2];return n&&n.split(",").map(i=>{const r=i.match(aw);return(r&&r[1]||i).trim()})||[]}function Xd(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 w=b.split(".");let T=c(w.shift());for(;w.length;)T=T[w.shift()];return T}if(zu(o,b))return o[b];if(zu(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(Hu(b))b=as(b.slice());else throw s(`Cannot invoke "${b}". Expected a function!`);const T=(b.$inject||sw(b)).map(I=>zu(x,I)?x[I]:c(I));return{fn:b,dependencies:T}}function l(b){const{fn:x,dependencies:w}=u(b),T=Function.prototype.bind.call(x,null,...w);return new T}function p(b,x,w){const{fn:T,dependencies:I}=u(b,w);return T.apply(x,I)}function f(b){return as(x=>b.get(x))}function d(b,x){if(x&&x.length){const w=Object.create(null),T=Object.create(null),I=[],P=[],j=[];let F,L,H,oe;for(let De in r)F=r[De],x.indexOf(De)!==-1&&(F[2]==="private"?(L=I.indexOf(F[3]),L===-1?(H=F[3].createChild([],x),oe=f(H),I.push(F[3]),P.push(H),j.push(oe),w[De]=[oe,De,"private",H]):w[De]=[j[L],De,"private",P[L]]):w[De]=[F[2],F[1]],T[De]=!0),(F[2]==="factory"||F[2]==="type")&&F[1].$scope&&x.forEach(ct=>{F[1].$scope.indexOf(ct)!==-1&&(w[De]=[F[2],F[1]],T[ct]=!0)});x.forEach(De=>{if(!T[De])throw new Error('No provider for "'+De+'". Cannot use provider from the parent!')}),b.unshift(w)}return new Xd(b,a)}const h={factory:p,type:l,value:function(b){return b}};function m(b,x){const w=b.__init__||[];return function(){w.forEach(T=>{typeof T=="string"?x.get(T):x.invoke(T)})}}function g(b){const x=b.__exports__;if(x){const w=b.__modules__,T=Object.keys(b).reduce((L,H)=>(H!=="__exports__"&&H!=="__modules__"&&H!=="__init__"&&H!=="__depends__"&&(L[H]=b[H]),L),Object.create(null)),I=(w||[]).concat(T),P=d(I),j=as(function(L){return P.get(L)});x.forEach(function(L){r[L]=[j,L,"private",P]});const F=(b.__init__||[]).slice();return F.unshift(function(){P.init()}),b=Object.assign({},b,{__init__:F}),m(b,P)}return Object.keys(b).forEach(function(w){if(w==="__init__"||w==="__depends__")return;const T=b[w];if(T[2]==="private"){r[w]=T;return}const I=T[0],P=T[1];r[w]=[h[I],cw(I,P),I]}),m(b,a)}function S(b,x){return b.indexOf(x)!==-1||(b=(x.__depends__||[]).reduce(S,b),b.indexOf(x)!==-1)?b:b.concat(x)}function E(b){const x=b.reduce(S,[]).map(g);let w=!1;return function(){w||(w=!0,x.forEach(T=>T()))}}this.get=c,this.invoke=p,this.instantiate=l,this.createChild=d,this.init=E(e)}function cw(e,t){return e!=="value"&&Hu(t)&&(t=as(t.slice())),t}var uw=1e3;function bi(e,t){var n=this;t=t||uw,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)})}bi.prototype.canRender=function(e){},bi.prototype.drawShape=function(e,t){},bi.prototype.drawConnection=function(e,t){},bi.prototype.getShapePath=function(e){},bi.prototype.getConnectionPath=function(e){};function Sr(e){return e.flat().join(",").replace(/,?([A-Za-z]),?/g,"$1")}function lw(e){return["M",e.x,e.y]}function Vu(e){return["L",e.x,e.y]}function pw(e,t,n){return["C",e.x,e.y,t.x,t.y,n.x,n.y]}function fw(e,t){const n=e.length,i=[lw(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(Vu(a));continue}const c=Math.min(t,Gu(a.x-o.x,a.y-o.y),Gu(s.x-a.x,s.y-a.y));if(!c){i.push(Vu(a));continue}const u=ss(a,o,c),l=ss(a,o,c*.5),p=ss(a,s,c),f=ss(a,s,c*.5);i.push(Vu(u)),i.push(pw(l,f,p))}return i}function ss(e,t,n){const i=t.x-e.x,r=t.y-e.y,o=Gu(i,r),a=n/o;return{x:e.x+i*a,y:e.y+r*a}}function Gu(e,t){return Math.sqrt(Math.pow(e,2)+Math.pow(t,2))}function $o(e,t,n){me(t)&&(n=t,t=null),t||(t={});const i=ce("path",t);return me(n)&&(i.dataset.cornerRadius=String(n)),Wu(i,e)}function Wu(e,t){const n=parseInt(e.dataset.cornerRadius,10)||0;return ne(e,{d:Sr(fw(t,n))}),e}function cs(e){var t=new Set(e);return Ae(e,function(n){for(var i=n.parent;i;){if(t.has(i))return!1;i=i.parent}return!0})}function Rr(e,t,n){n=n||0,pe(e)||(e=[e]),M(e,function(i,r){var o=t(i,r,n);pe(o)&&o.length&&Rr(o,t,n+1)})}function Uu(e,t,n){var i=new Set,r=new Set;return Rr(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 jo(e,t){return Uu(e)}function dw(e,t,n){vr(t)&&(t=!0),Nt(t)&&(n=t,t=!0),n=n||{};var i=Fo(n.allShapes),r=Fo(n.allConnections),o=Fo(n.enclosedElements),a=Fo(n.enclosedConnections),s=Fo(n.topLevel,t&&Wr(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 Rr(e,u),{allShapes:i,allConnections:r,topLevel:s,enclosedConnections:a,enclosedElements:o}}function Et(e,t){t=!!t,pe(e)||(e=[e]);var n,i,r,o;return M(e,function(a){var s=a;a.waypoints&&!t&&(s=Et(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 Zr(e,t){var n={};return M(e,function(i){var r=i;r.waypoints&&(r=Et(r)),!me(t.y)&&r.x>t.x&&(n[i.id]=i),!me(t.x)&&r.y>t.y&&(n[i.id]=i),r.x>t.x&&r.y>t.y&&(me(t.width)&&me(t.height)&&r.width+r.x<t.width+t.x&&r.height+r.y<t.height+t.y||!me(t.width)||!me(t.height))&&(n[i.id]=i)}),n}function Zd(e){return"waypoints"in e?"connection":"x"in e?"shape":"root"}function Qd(e){return!!(e&&e.isFrame)}function Fo(e,t){return D({},e||{},t||{})}var hw=1;function Wi(e,t){bi.call(this,e,hw),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})}te(Wi,bi),Wi.prototype.canRender=function(){return!0},Wi.prototype.drawShape=function(t,n,i){var r=ce("rect");return ne(r,{x:0,y:0,width:n.width||0,height:n.height||0}),Qd(n)?ne(r,D({},this.FRAME_STYLE,i||{})):ne(r,D({},this.SHAPE_STYLE,i||{})),ye(t,r),r},Wi.prototype.drawConnection=function(t,n,i){var r=$o(n.waypoints,D({},this.CONNECTION_STYLE,i||{}));return ye(t,r),r},Wi.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 Sr(a)},Wi.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 Sr(o)},Wi.$inject=["eventBus","styles"];function mw(){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 D(o,{class:n})},this.style=function(n,i){!pe(n)&&!i&&(i=n,n=[]);var r=yn(n,function(o,a){return D(o,e[a]||{})},{});return i?D(r,i):r},this.computeStyle=function(n,i,r){return pe(i)||(r=i,i=[]),t.style(i||[],D({},r,n||{}))}}const gw={__init__:["defaultRenderer"],defaultRenderer:["type",Wi],styles:["type",mw]};function ht(e,t){if(!e||!t)return-1;var n=e.indexOf(t);return n!==-1&&e.splice(n,1),n}function _t(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 qu(e,t){return!e||!t?-1:e.indexOf(t)}function Ho(e,t){return!e||!t?-1:Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function Yu(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=Ho(e,t);return Math.abs(r/o)<=i}var vw=2;function xi(e,t){var n=Array.from(arguments).flat();const i={x:"v",y:"h"};for(const[r,o]of Object.entries(i))if(yw(r,n))return o;return!1}function yw(e,t){const n=t[0];return yr(t,function(i){return Math.abs(n[e]-i[e])<=vw})}function Jd(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 Ku(e,t){return{x:Math.round(e.x+(t.x-e.x)/2),y:Math.round(e.y+(t.y-e.y)/2)}}var _w=/,?([a-z]),?/gi,eh=parseFloat,wt=Math,Ui=wt.PI,si=wt.min,ci=wt.max,th=wt.pow,qi=wt.abs,bw=/([a-z])[\s,]*((-?\d*\.?\d*(?:e[-+]?\d+)?[\s]*,?[\s]*)+)/ig,xw=/(-?\d*\.?\d*(?:e[-+]?\d+)?)[\s]*,?[\s]*/ig,nh=Array.isArray||function(e){return e instanceof Array};function Ew(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function ww(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 Sw(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 Ew(r,i)?(ww(o,i),r[i]):(o.length>=1e3&&delete r[o.shift()],o.push(i),r[i]=e(...arguments),r[i])}return t}function Rw(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(bw,function(i,r,o){var a=[],s=r.toLowerCase();for(o.replace(xw,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=Zu,n}function Cw(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 Pw(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 Xu(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 Zu(){return this.join(",").replace(_w,"$1")}function Aw(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=Zu,t}function ih(e,t,n,i,r,o,a,s,c){var u=1-c,l=th(u,3),p=th(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:us(h),y:us(m)}}function rh(e){var t=Iw(...e);return Xu(t.x0,t.y0,t.x1-t.x0,t.y1-t.y0)}function Yi(e,t,n){return t>=e.x&&t<=e.x+e.width&&n>=e.y&&n<=e.y+e.height}function Tw(e,t){return e=Xu(e),t=Xu(t),Yi(t,e.x,e.y)||Yi(t,e.x2,e.y)||Yi(t,e.x,e.y2)||Yi(t,e.x2,e.y2)||Yi(e,t.x,t.y)||Yi(e,t.x2,t.y)||Yi(e,t.x,t.y2)||Yi(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 oh(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 ah(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=oh(m,e,n,r,a),S=oh(m,t,i,o,s),E=g*g+S*S;d+=f[h]*wt.sqrt(E)}return u*d}function Mw(e,t,n,i,r,o,a,s){if(!(ci(e,n)<si(r,a)||si(e,n)>ci(r,a)||ci(t,i)<si(o,s)||si(t,i)>ci(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=us(c/l),f=us(u/l),d=+p.toFixed(2),h=+f.toFixed(2);if(!(d<+si(e,n).toFixed(2)||d>+ci(e,n).toFixed(2)||d<+si(r,a).toFixed(2)||d>+ci(r,a).toFixed(2)||h<+si(t,i).toFixed(2)||h>+ci(t,i).toFixed(2)||h<+si(o,s).toFixed(2)||h>+ci(o,s).toFixed(2)))return{x:p,y:f}}}}function us(e){return Math.round(e*1e11)/1e11}function kw(e,t,n){var i=rh(e),r=rh(t);if(!Tw(i,r))return[];var o=ah(...e),a=ah(...t),s=ch(e)?1:~~(o/5)||1,c=ch(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=ih(...e,d/s);u[d]={x:m.x,y:m.y,t:d/s}}for(d=0;d<c+1;d++)m=ih(...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],S=u[d+1],E=l[h],b=l[h+1],x=qi(S.x-g.x)<.01?"y":"x",w=qi(b.x-E.x)<.01?"y":"x",T=Mw(g.x,g.y,S.x,S.y,E.x,E.y,b.x,b.y),I;if(T){if(I=T.x.toFixed(9)+"#"+T.y.toFixed(9),p[I])continue;p[I]=!0;var P=g.t+qi((T[x]-g[x])/(S[x]-g[x]))*(S.t-g.t),j=E.t+qi((T[w]-E[w])/(b[w]-E[w]))*(b.t-E.t);P>=0&&P<=1&&j>=0&&j<=1&&f.push({x:T.x,y:T.y,t1:P,t2:j})}}return f}function sh(e,t,n){e=ph(e),t=ph(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 S=0,E=t.length;S<E;S++){var b=t[S];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=kw(p,f);{for(var w=0,T=x.length;w<T;w++)x[w].segment1=h,x[w].segment2=S,x[w].bez1=p,x[w].bez2=f;d=d.concat(x)}}}}}return d}function Dw(e){return nh(e)&&nh(e[0])}function Ow(e){if(Cw(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=Zu,t}function ch(e){return e[0]===e[2]&&e[1]===e[3]&&e[4]===e[6]&&e[5]===e[7]}function ls(e,t,n,i){return[e,t,n,i,n,i]}function uh(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 lh(e,t,n,i,r,o,a,s,c,u){var l=Ui*120/180,p=Ui/180*(+r||0),f=[],d,h=Sw(function(C,_,v){var k=C*wt.cos(v)-_*wt.sin(v),O=C*wt.sin(v)+_*wt.cos(v);return{x:k,y:O}});if(u)I=u[0],P=u[1],w=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,S=m*m/(n*n)+g*g/(i*i);S>1&&(S=wt.sqrt(S),n=S*n,i=S*i);var E=n*n,b=i*i,x=(o==a?-1:1)*wt.sqrt(qi((E*b-E*g*g-b*m*m)/(E*g*g+b*m*m))),w=x*n*g/i+(e+s)/2,T=x*-i*m/n+(t+c)/2,I=wt.asin(((t-T)/i).toFixed(9)),P=wt.asin(((c-T)/i).toFixed(9));I=e<w?Ui-I:I,P=s<w?Ui-P:P,I<0&&(I=Ui*2+I),P<0&&(P=Ui*2+P),a&&I>P&&(I=I-Ui*2),!a&&P>I&&(P=P-Ui*2)}var j=P-I;if(qi(j)>l){var F=P,L=s,H=c;P=I+l*(a&&P>I?1:-1),s=w+n*wt.cos(P),c=T+i*wt.sin(P),f=lh(s,c,n,i,r,0,a,L,H,[P,F,w,T])}j=P-I;var oe=wt.cos(I),De=wt.sin(I),ct=wt.cos(P),Y=wt.sin(P),re=wt.tan(j/4),le=4/3*n*re,ae=4/3*i*re,se=[e,t],Z=[e+le*De,t-ae*oe],$=[s+le*Y,c-ae*ct],N=[s,c];if(Z[0]=2*se[0]-Z[0],Z[1]=2*se[1]-Z[1],u)return[Z,$,N].concat(f);f=[Z,$,N].concat(f).join().split(",");for(var V=[],Re=0,bt=f.length;Re<bt;Re++)V[Re]=Re%2?h(f[Re-1],f[Re],p).y:h(f[Re],f[Re+1],p).x;return V}function Iw(e,t,n,i,r,o,a,s){for(var c=[],u=[[],[]],l,p,f,d,h,m,g,S,E=0;E<2;++E){if(E==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),qi(l)<1e-12){if(qi(p)<1e-12)continue;d=-f/p,0<d&&d<1&&c.push(d);continue}g=p*p-4*f*l,S=wt.sqrt(g),!(g<0)&&(h=(-p+S)/(2*l),0<h&&h<1&&c.push(h),m=(-p-S)/(2*l),0<m&&m<1&&c.push(m))}for(var b=c.length,x=b,w;b--;)d=c[b],w=1-d,u[0][b]=w*w*w*e+3*w*w*d*n+3*w*d*d*r+d*d*d*a,u[1][b]=w*w*w*t+3*w*w*d*i+3*w*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:si(...u[0]),y0:si(...u[1]),x1:ci(...u[0]),y1:ci(...u[1])}}function ph(e){if(Dw(e)||(e=Rw(e)),Pw(e))return e;for(var t=Aw(Ow(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",...lh(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",...uh(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",...uh(d.x,d.y,f[1],f[2],f[3],f[4])];break;case"L":f=["C",...ls(d.x,d.y,f[1],f[2])];break;case"H":f=["C",...ls(d.x,d.y,f[1],d.y)];break;case"V":f=["C",...ls(d.x,d.y,d.x,f[1])];break;case"Z":f=["C",...ls(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=eh(l[p-4])||n.x,n.by=eh(l[p-3])||n.y}return t}function Xe(e){return Nt(e)&&vn(e,"waypoints")}function Ee(e){return Nt(e)&&vn(e,"labelTarget")}function Lw(e){return Nt(e)&&Vr(e.parent)}function fh(e){return{x:Math.round(e.x),y:Math.round(e.y),width:Math.round(e.width),height:Math.round(e.height)}}function Ei(e){return{x:Math.round(e.x),y:Math.round(e.y)}}function ue(e){return{top:e.y,right:e.x+(e.width||0),bottom:e.y+(e.height||0),left:e.x}}function ps(e){return{x:e.left,y:e.top,width:e.right-e.left,height:e.bottom-e.top}}function Nw(e){return Ei({x:e.x+(e.width||0)/2,y:e.y+(e.height||0)/2})}function Bw(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=Fw(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 fe(e){return Xe(e)?Bw(e):Nw(e)}function Gt(e,t,n){n=n||0,Nt(n)||(n={x:n,y:n});var i=ue(e),r=ue(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 zo(e,t,n){var i=$w(e,t);return i.length===1||i.length===2&&Ho(i[0],i[1])<1?Ei(i[0]):i.length>1?(i=ei(i,function(r){var o=Math.floor(r.t2*100)||1;return o=100-o,o=(o<10?"0":"")+o,r.segment2+"#"+o}),Ei(i[n?0:i.length-1])):null}function $w(e,t){return sh(e,t)}function jw(e){e=e.slice();for(var t=0,n,i,r;e[t];)n=e[t],i=e[t-1],r=e[t+1],Ho(n,r)===0||Yu(i,r,n)?e.splice(t,1):t++;return e}function Fw(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function fs(e,t){return Math.round(e*t)/t}function dh(e){return me(e)?e+"px":e}function Hw(e){for(;e.parent;)e=e.parent;return e}function zw(e){e=D({},{width:"100%",height:"100%"},e);const t=e.container||document.body,n=document.createElement("div");return n.setAttribute("class","djs-container djs-parent"),ln(n,{position:"relative",overflow:"hidden",width:dh(e.width),height:dh(e.height)}),t.appendChild(n),n}function hh(e,t,n){const i=ce("g");ke(i).add(t);const r=n!==void 0?n:e.childNodes.length-1;return e.insertBefore(i,e.childNodes[r]||null),i}const Vw="base",mh=0,Gw=1,Ww={shape:["x","y","width","height"],connection:["waypoints"]};function de(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||{})}de.$inject=["config.canvas","eventBus","graphicsFactory","elementRegistry"],de.prototype._init=function(e){const t=this._eventBus,n=this._container=zw(e),i=this._svg=ce("svg");ne(i,{width:"100%",height:"100%"}),en(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")}),ye(n,i);const r=this._viewport=hh(i,"viewport");e.deferUpdate&&(this._viewboxChanged=du(this._viewboxChanged,300)),this._restoreFocus=du(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)},de.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},de.prototype._setFocused=function(e){e!=this._focused&&(this._focused=e,this._eventBus.fire("canvas.focus.changed",{focused:e}))},de.prototype._clear=function(){this._elementRegistry.getAll().forEach(t=>{const n=Zd(t);n==="root"?this.removeRootElement(t):this._removeElement(t,n)}),this._planes=[],this._rootElement=null,delete this._cachedViewbox},de.prototype.focus=function(){this._svg.focus({preventScroll:!0}),this._setFocused(!0)},de.prototype.restoreFocus=function(){this._restoreFocus()},de.prototype._restoreFocus=function(){document.activeElement===document.body&&this.focus()},de.prototype.isFocused=function(){return this._focused},de.prototype.getDefaultLayer=function(){return this.getLayer(Vw,mh)},de.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},de.prototype._getChildIndex=function(e){return yn(this._layers,function(t,n){return n.visible&&e>=n.index&&t++,t},0)},de.prototype._createLayer=function(e,t){typeof t>"u"&&(t=Gw);const n=this._getChildIndex(t);return{group:hh(this._viewport,"layer-"+e,n),index:t,visible:!0}},de.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},de.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&&(Dt(n),t.visible=!1),n},de.prototype._removeLayer=function(e){const t=this._layers[e];t&&(delete this._layers[e],Dt(t.group))},de.prototype.getActiveLayer=function(){const e=this._findPlaneForRoot(this.getRootElement());return e?e.layer:null},de.prototype.findRoot=function(e){const t=this._resolveElements(e);let n;for(const i of t){const r=this._findPlaneForRoot(Hw(i));if(!r||n&&r.rootElement!==n)return;n=r.rootElement}return n},de.prototype.getRootElements=function(){return this._planes.map(function(e){return e.rootElement})},de.prototype._findPlaneForRoot=function(e){return et(this._planes,function(t){return t.rootElement===e})},de.prototype._resolveElement=function(e){return typeof e=="string"?this._elementRegistry.get(e):e},de.prototype._resolveElements=function(e){return pe(e)||(e=[e]),e.map(t=>this._resolveElement(t)).filter(Boolean)},de.prototype.getContainer=function(){return this._container},de.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),ke(r).add(t)):(e.markers.delete(t),ke(r).remove(t)))}),this._eventBus.fire("element.marker.update",{element:e,gfx:i.gfx,marker:t,add:!!n}))},de.prototype.addMarker=function(e,t){this._updateMarker(e,t,!0)},de.prototype.removeMarker=function(e,t){this._updateMarker(e,t,!1)},de.prototype.hasMarker=function(e,t){return e=this._resolveElement(e),e.markers?e.markers.has(t):!1},de.prototype.toggleMarker=function(e,t){this.hasMarker(e,t)?this.removeMarker(e,t):this.addMarker(e,t)},de.prototype.getRootElement=function(){const e=this._rootElement;return e||this._planes.length?e:this.setRootElement(this.addRootElement(null))},de.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,mh);return this.hideLayer(n),this._addRoot(e,i),this._planes.push({rootElement:e,layer:i}),e},de.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},de.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},de.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)},de.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})},de.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})},de.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=Ww[e];if(!yr(n,function(r){return typeof t[r]<"u"}))throw new Error("must supply { "+n.join(", ")+" } with "+e)},de.prototype._setParent=function(e,t,n){_t(t.children,e,n),e.parent=t},de.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},de.prototype.addShape=function(e,t,n){return this._addElement("shape",e,t,n)},de.prototype.addConnection=function(e,t,n){return this._addElement("connection",e,t,n)},de.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),ht(e.parent&&e.parent.children,e),e.parent=null,r.fire(t+".removed",{element:e}),n.remove(e),e},de.prototype.removeShape=function(e){return this._removeElement(e,"shape")},de.prototype.removeConnection=function(e){return this._removeElement(e,"connection")},de.prototype.getGraphics=function(e,t){return this._elementRegistry.getGraphics(e,t)},de.prototype._changeViewbox=function(e){this._eventBus.fire("canvas.viewbox.changing"),e.apply(this),this._cachedViewbox=null,this._viewboxChanged()},de.prototype._viewboxChanged=function(){this._eventBus.fire("canvas.viewbox.changed",{viewbox:this.viewbox()})},de.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);Bo(t,l)});else return o=this._rootElement?this.getActiveLayer():null,i=o&&o.getBBox()||{},a=Bo(t),r=a?a.matrix:XE(),s=fs(r.a,1e3),c=fs(-r.e||0,1e3),u=fs(-r.f||0,1e3),e=this._cachedViewbox={x:c?c/s:0,y:u?u/s:0,width:n.width/s,height:n.height/s,scale:s,inner:{width:i.width||0,height:i.height||0,x:i.x||0,y:i.y||0},outer:n},e;return e},de.prototype.scroll=function(e){const t=this._viewport;let n=t.getCTM();return e&&this._changeViewbox(function(){e=D({dx:0,dy:0},e||{}),n=this._svg.createSVGMatrix().translate(e.dx,e.dy).multiply(n),gh(t,n)}),{x:n.e,y:n.f}},de.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=Et(o),s=ue(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=ue(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),S=Math.min(0,s.top-f.top);l=h||m,p=g||S}this.scroll({dx:-l*u,dy:-p*u})},de.prototype.zoom=function(e,t){if(!e)return this.viewbox(e).scale;if(e==="fit-viewport")return this._fitViewport(t);let n,i;return this._changeViewbox(function(){typeof t!="object"&&(n=this.viewbox().outer,t={x:n.width/2,y:n.height/2}),i=this._setZoom(e,t)}),fs(i.a,1e3)};function gh(e,t){const n="matrix("+t.a+","+t.b+","+t.c+","+t.d+","+t.e+","+t.f+")";e.setAttribute("transform",n)}de.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},de.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=D(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),gh(this._viewport,l),l},de.prototype.getSize=function(){return{width:this._container.clientWidth,height:this._container.clientHeight}},de.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}},de.prototype.resized=function(){delete this._cachedViewbox,this._eventBus.fire("canvas.resized")};var Qr="data-element-id";function Tn(e){this._elements={},this._eventBus=e}Tn.$inject=["eventBus"],Tn.prototype.add=function(e,t,n){var i=e.id;this._validateId(i),ne(t,Qr,i),n&&ne(n,Qr,i),this._elements[i]={element:e,gfx:t,secondaryGfx:n}},Tn.prototype.remove=function(e){var t=this._elements,n=e.id||e,i=n&&t[n];i&&(ne(i.gfx,Qr,""),i.secondaryGfx&&ne(i.secondaryGfx,Qr,""),delete t[n])},Tn.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)},Tn.prototype.updateGraphics=function(e,t,n){var i=e.id||e,r=this._elements[i];return n?r.secondaryGfx=t:r.gfx=t,t&&ne(t,Qr,i),t},Tn.prototype.get=function(e){var t;typeof e=="string"?t=e:t=e&&ne(e,Qr);var n=this._elements[t];return n&&n.element},Tn.prototype.filter=function(e){var t=[];return this.forEach(function(n,i){e(n,i)&&t.push(n)}),t},Tn.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}},Tn.prototype.getAll=function(){return this.filter(function(e){return e})},Tn.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)})},Tn.prototype.getGraphics=function(e,t){var n=e.id||e,i=this._elements[n];return i&&(t?i.secondaryGfx:i.gfx)},Tn.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 Uw(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 qw(e){return e.__refs_collection===!0}function Yw(e,t){return Object.prototype.hasOwnProperty.call(e,t.name||t)}function vh(e,t,n){var i=Uw(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 Kw(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 Bn(e,t){if(!(this instanceof Bn))return new Bn(e,t);e.inverse=t,t.inverse=e,this.props={},this.props[e.name]=e,this.props[t.name]=t}Bn.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):Kw(this,t,e)},Bn.prototype.ensureRefsCollection=function(e,t){var n=e[t.name];return qw(n)||vh(this,t,e),n},Bn.prototype.ensureBound=function(e,t){Yw(e,t)||this.bind(e,t)},Bn.prototype.unset=function(e,t,n){e&&(this.ensureBound(e,t),t.collection?this.ensureRefsCollection(e,t).remove(n):e[t.name]=void 0)},Bn.prototype.set=function(e,t,n){e&&(this.ensureBound(e,t),t.collection?this.ensureRefsCollection(e,t).add(n):e[t.name]=n)};var Qu=new Bn({name:"children",enumerable:!0,collection:!0},{name:"parent"}),yh=new Bn({name:"labels",enumerable:!0,collection:!0},{name:"labelTarget"}),_h=new Bn({name:"attachers",collection:!0},{name:"host"}),bh=new Bn({name:"outgoing",collection:!0},{name:"source"}),xh=new Bn({name:"incoming",collection:!0},{name:"target"});function Jr(){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)}}),Qu.bind(this,"parent"),yh.bind(this,"labels"),bh.bind(this,"outgoing"),xh.bind(this,"incoming")}function Vo(){Jr.call(this),Qu.bind(this,"children"),_h.bind(this,"host"),_h.bind(this,"attachers")}te(Vo,Jr);function Eh(){Jr.call(this),Qu.bind(this,"children")}te(Eh,Vo);function wh(){Vo.call(this),yh.bind(this,"labelTarget")}te(wh,Vo);function Sh(){Jr.call(this),bh.bind(this,"source"),xh.bind(this,"target")}te(Sh,Jr);var Xw={connection:Sh,shape:Vo,label:wh,root:Eh};function Zw(e,t){var n=Xw[e];if(!n)throw new Error("unknown type: <"+e+">");return D(new n,t)}function Qw(e){return e instanceof Jr}function wi(){this._uid=12}wi.prototype.createRoot=function(e){return this.create("root",e)},wi.prototype.createLabel=function(e){return this.create("label",e)},wi.prototype.createShape=function(e){return this.create("shape",e)},wi.prototype.createConnection=function(e){return this.create("connection",e)},wi.prototype.create=function(e,t){return t=D({},t||{}),t.id||(t.id=e+"_"+this._uid++),Zw(e,t)};var ds="__fn",Rh=1e3,Jw=Array.prototype.slice;function bn(){this._listeners={},this.on("diagram.destroy",1,this._destroy,this)}bn.prototype.on=function(e,t,n,i){if(e=pe(e)?e:[e],Bt(t)&&(i=n,n=t,t=Rh),!me(t))throw new Error("priority must be a number");var r=n;i&&(r=dn(n,i),r[ds]=n[ds]||n);var o=this;e.forEach(function(a){o._addListener(a,{priority:t,callback:r,next:null})})},bn.prototype.once=function(e,t,n,i){var r=this;if(Bt(t)&&(i=n,n=t,t=Rh),!me(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[ds]=n,this.on(e,t,o)},bn.prototype.off=function(e,t){e=pe(e)?e:[e];var n=this;e.forEach(function(i){n._removeListener(i,t)})},bn.prototype.createEvent=function(e){var t=new Go;return t.init(e),t},bn.prototype.fire=function(e,t){var n,i,r,o;if(o=Jw.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 Go?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}},bn.prototype.handleError=function(e){return this.fire("error",{error:e})===!1},bn.prototype._destroy=function(){this._listeners={}},bn.prototype._invokeListeners=function(e,t,n){for(var i;n&&!e.cancelBubble;)i=this._invokeListener(e,t,n),n=n.next;return i},bn.prototype._invokeListener=function(e,t,n){var i;if(n.callback.__isTomb)return i;try{i=e1(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},bn.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},bn.prototype._getListeners=function(e){return this._listeners[e]},bn.prototype._setListeners=function(e,t){this._listeners[e]=t},bn.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[ds]===t)&&(r?r.next=i:this._setListeners(e,i)),r=n,n=i};function Go(){}Go.prototype.stopPropagation=function(){this.cancelBubble=!0},Go.prototype.preventDefault=function(){this.defaultPrevented=!0},Go.prototype.init=function(e){D(this,e||{})};function e1(e,t){return e.apply(null,t)}function Cr(e){return e.childNodes[0]}function t1(e){return e.parentNode.childNodes[1]}function hs(e,t,n,i,r){var o=No();o.setTranslate(t,n);var a=No();a.setRotate(i||0,0,0);var s=No();s.setScale(1,1),Bo(e,[o,a,s])}function Wt(e,t,n){var i=No();i.setTranslate(t,n),Bo(e,i)}function Ch(e,t){var n=No();n.setRotate(t,0,0),Bo(e,n)}function Mn(e,t){this._eventBus=e,this._elementRegistry=t}Mn.$inject=["eventBus","elementRegistry"],Mn.prototype._getChildrenContainer=function(e){var t=this._elementRegistry.getGraphics(e),n;return e.parent?(n=t1(t),n||(n=ce("g"),ke(n).add("djs-children"),ye(t.parentNode,n))):n=t,n},Mn.prototype._clear=function(e){var t=Cr(e);return ns(t),t},Mn.prototype._createContainer=function(e,t,n,i){var r=ce("g");ke(r).add("djs-group"),typeof n<"u"?n1(r,t,t.childNodes[n]):ye(t,r);var o=ce("g");ke(o).add("djs-element"),ke(o).add("djs-"+e),i&&ke(o).add("djs-frame"),ye(r,o);var a=ce("g");return ke(a).add("djs-visual"),ye(o,a),o},Mn.prototype.create=function(e,t,n){var i=this._getChildrenContainer(t.parent);return this._createContainer(e,i,n,Qd(t))},Mn.prototype.updateContainments=function(e){var t=this,n=this._elementRegistry,i;i=yn(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)})}})},Mn.prototype.drawShape=function(e,t,n={}){var i=this._eventBus;return i.fire("render.shape",{gfx:e,element:t,attrs:n})},Mn.prototype.getShapePath=function(e){var t=this._eventBus;return t.fire("render.getShapePath",e)},Mn.prototype.drawConnection=function(e,t,n={}){var i=this._eventBus;return i.fire("render.connection",{gfx:e,element:t,attrs:n})},Mn.prototype.getConnectionPath=function(e){var t=this._eventBus;return t.fire("render.getConnectionPath",e)},Mn.prototype.update=function(e,t,n){if(t.parent){var i=this._clear(n);if(e==="shape")this.drawShape(i,t),Wt(n,t.x,t.y);else if(e==="connection")this.drawConnection(i,t);else throw new Error("unknown type: "+e);t.hidden?ne(n,"display","none"):ne(n,"display","block")}},Mn.prototype.remove=function(e){var t=this._elementRegistry.getGraphics(e);Dt(t.parentNode)};function n1(e,t,n){var i=n||t.firstChild;e!==i&&t.insertBefore(e,i)}const i1={__depends__:[gw],__init__:["canvas"],canvas:["type",de],elementRegistry:["type",Tn],elementFactory:["type",wi],eventBus:["type",bn],graphicsFactory:["type",Mn]};function r1(e){var t=new Xd(e);return t.init(),t}function o1(e){e=e||{};var t={config:["value",e]},n=[t,i1].concat(e.modules||[]);return r1(n)}function Ki(e,t){this._injector=t||o1(e),this.get("eventBus").fire("diagram.init")}Ki.prototype.get=function(e,t){return this._injector.get(e,t)},Ki.prototype.invoke=function(e,t,n){return this._injector.invoke(e,t,n)},Ki.prototype.destroy=function(){this.get("eventBus").fire("diagram.destroy")},Ki.prototype.clear=function(){this.get("eventBus").fire("diagram.clear")};function tn(e){return e?"<"+e.$type+(e.id?' id="'+e.id:"")+'" />':"<null>"}function hn(e,t){return e.$instanceOf(t)}function a1(e){return et(e.rootElements,function(t){return hn(t,"bpmn:Process")||hn(t,"bpmn:Collaboration")})}function s1(e){var t={},n=[],i={};function r($,N){return function(V){$(V,N)}}function o($){t[$.id]=$}function a($){return t[$.id]}function s($,N){var V=$.gfx;if(V)throw new Error(`already rendered ${tn($)}`);return e.element($,i[$.id],N)}function c($,N){return e.root($,i[$.id],N)}function u($,N){try{var V=i[$.id]&&s($,N);return o($),V}catch(Re){l(Re.message,{element:$,error:Re}),console.error(`failed to import ${tn($)}`,Re)}}function l($,N){e.error($,N)}var p=this.registerDi=function(N){var V=N.bpmnElement;V?i[V.id]?l(`multiple DI elements defined for ${tn(V)}`,{element:V}):i[V.id]=N:l(`no bpmnElement referenced in ${tn(N)}`,{element:N})};function f($){d($.plane)}function d($){p($),M($.planeElement,h)}function h($){p($)}this.handleDefinitions=function(N,V){var Re=N.diagrams;if(V&&Re.indexOf(V)===-1)throw new Error("diagram not part of <bpmn:Definitions />");if(!V&&Re&&Re.length&&(V=Re[0]),!V)throw new Error("no diagram to display");i={},f(V);var bt=V.plane;if(!bt)throw new Error(`no plane for ${tn(V)}`);var C=bt.bpmnElement;if(!C)if(C=a1(N),C)l(`correcting missing bpmnElement on ${tn(bt)} to ${tn(C)}`),bt.bpmnElement=C,p(bt);else throw new Error("no process or collaboration to display");var _=c(C,bt);if(hn(C,"bpmn:Process")||hn(C,"bpmn:SubProcess"))g(C,_);else if(hn(C,"bpmn:Collaboration"))se(C,_),S(N.rootElements,_);else throw new Error(`unsupported bpmnElement for ${tn(bt)}: ${tn(C)}`);m(n)};var m=this.handleDeferred=function(){for(var N;n.length;)N=n.shift(),N()};function g($,N){re($,N),j($.ioSpecification,N),P($.artifacts,N),o($)}function S($,N){var V=Ae($,function(Re){return!a(Re)&&hn(Re,"bpmn:Process")&&Re.laneSets});V.forEach(r(g,N))}function E($,N){u($,N)}function b($,N){M($,r(E,N))}function x($,N){u($,N)}function w($,N){u($,N)}function T($,N){u($,N)}function I($,N){u($,N)}function P($,N){M($,function(V){hn(V,"bpmn:Association")?n.push(function(){I(V,N)}):I(V,N)})}function j($,N){$&&(M($.dataInputs,r(w,N)),M($.dataOutputs,r(T,N)))}var F=this.handleSubProcess=function(N,V){re(N,V),P(N.artifacts,V)};function L($,N){var V=u($,N);hn($,"bpmn:SubProcess")&&F($,V||N),hn($,"bpmn:Activity")&&j($.ioSpecification,N),n.push(function(){M($.dataInputAssociations,r(x,N)),M($.dataOutputAssociations,r(x,N))})}function H($,N){u($,N)}function oe($,N){u($,N)}function De($,N){n.push(function(){var V=u($,N);$.childLaneSet&&ct($.childLaneSet,V||N),Z($)})}function ct($,N){M($.lanes,r(De,N))}function Y($,N){M($,r(ct,N))}function re($,N){le($.flowElements,N),$.laneSets&&Y($.laneSets,N)}function le($,N){M($,function(V){hn(V,"bpmn:SequenceFlow")?n.push(function(){H(V,N)}):hn(V,"bpmn:BoundaryEvent")?n.unshift(function(){L(V,N)}):hn(V,"bpmn:FlowNode")?L(V,N):hn(V,"bpmn:DataObject")||(hn(V,"bpmn:DataStoreReference")||hn(V,"bpmn:DataObjectReference")?oe(V,N):l(`unrecognized flowElement ${tn(V)} in context ${tn(N&&N.businessObject)}`,{element:V,context:N}))})}function ae($,N){var V=u($,N),Re=$.processRef;Re&&g(Re,V||N)}function se($,N){M($.participants,r(ae,N)),n.push(function(){b($.messageFlows,N)}),P($.artifacts,N)}function Z($){M($.flowNodeRef,function(N){var V=N.get("lanes");V&&V.push($)})}}function y(e,t){var n=q(e);return n&&typeof n.$instanceOf=="function"&&n.$instanceOf(t)}function Se(e,t){return Ni(t,function(n){return y(e,n)})}function q(e){return e&&e.businessObject||e}function Ie(e){return e&&e.di}function c1(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,S){return i.add(m,g,S)},error:function(m,g){s.push({message:m,context:g})}},f=new s1(p);l=l||u.diagrams&&u.diagrams[0];var d=u1(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 u1(e,t){if(!(!t||!t.plane)){var n=t.plane.bpmnElement,i=n;!y(n,"bpmn:Process")&&!y(n,"bpmn:Collaboration")&&(i=l1(n));var r;y(i,"bpmn:Collaboration")?r=i:r=et(e.rootElements,function(u){if(y(u,"bpmn:Collaboration"))return et(u.participants,function(l){return l.processRef===i})});var o=[i];r&&(o=Zt(r.participants,function(u){return u.processRef}),o.push(r));var a=Ph(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 Ph(e){var t=[];return M(e,function(n){n&&(t.push(n),t=t.concat(Ph(n.flowElements)))}),t}function l1(e){for(var t=e;t;){if(y(t,"bpmn:Process"))return t;t=t.$parent}}var p1='<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>',Ah=p1,Th={verticalAlign:"middle"},Mh={color:"#404040"},f1={zIndex:"1001",position:"fixed",top:"0",left:"0",right:"0",bottom:"0"},d1={width:"100%",height:"100%",background:"rgba(40,40,40,0.2)"},h1={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"},m1='<div class="bjs-powered-by-lightbox"><div class="backdrop"></div><div class="notice"><a href="https://bpmn.io" target="_blank" rel="noopener" class="link">'+Ah+'</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>',ui;function g1(){ui=nt(m1),ln(ui,f1),ln(qe("svg",ui),Th),ln(qe(".backdrop",ui),d1),ln(qe(".notice",ui),h1),ln(qe(".link",ui),Mh,{margin:"15px 20px 15px 10px",alignSelf:"center"})}function v1(){ui||(g1(),_n.bind(ui,".backdrop","click",function(e){document.body.removeChild(ui)})),document.body.appendChild(ui)}const ms=5,kh="djs-outline-hidden";function lt(e){e=D({},_1,e),this._moddle=this._createModdle(e),this._container=this._createContainer(e),this._init(this._container,this._moddle,e),x1(this._container)}te(lt,Ki),lt.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||[]),gs(s,o),s=y1(s),this._emit("import.done",{error:s,warnings:s.warnings}),s}},lt.prototype.importDefinitions=async function(t,n){return this._setDefinitions(t),{warnings:(await this.open(n)).warnings}},lt.prototype.open=async function(t){const n=this._definitions;let i=t;if(!n){const o=new Error("no XML imported");throw gs(o,[]),o}if(typeof t=="string"&&(i=b1(n,t),!i)){const o=new Error("BPMNDiagram <"+t+"> not found");throw gs(o,[]),o}try{this.clear()}catch(o){throw gs(o,[]),o}const{warnings:r}=await c1(this,n,i);return{warnings:r}},lt.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},lt.prototype.saveSVG=async function(){this._emit("saveSVG.start");let t,n;try{const i=this.get("canvas"),r=i.getActiveLayer(),o=qe(":scope > defs",i._svg),a=Kd(r),s=o?"<defs>"+Kd(o)+"</defs>":"",c=i.getContainer();st(c).add(kh);let u;try{u=r.getBBox()}finally{st(c).remove(kh)}const l=u.x-ms,p=u.y-ms,f=u.width+ms*2,d=u.height+ms*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}},at.prototype._setDefinitions=function(e){this._definitions=e},at.prototype.getModules=function(){return this._modules},at.prototype.clear=function(){this.getDefinitions()&&Yi.prototype.clear.call(this)},at.prototype.destroy=function(){Yi.prototype.destroy.call(this),ri(this._container)},at.prototype.on=function(e,t,n,i){return this.get("eventBus").on(e,t,n,i)},at.prototype.off=function(e,t){this.get("eventBus").off(e,t)},at.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=Ge(e)),e.appendChild(this._container),this._emit("attach",{}),this.get("canvas").resized()},at.prototype.getDefinitions=function(){return this._definitions},at.prototype.detach=function(){const e=this._container,t=e.parentNode;t&&(this._emit("detach",{}),t.removeChild(e))},at.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=D(ei(n,["additionalModules"]),{canvas:D({},n.canvas,{container:e}),modules:a});Yi.call(this,s),n&&n.container&&this.attachTo(n.container)},at.prototype._emit=function(e,t){return this.get("eventBus").fire(e,t)},at.prototype._createContainer=function(e){const t=Qe('<div class="bjs-container"></div>');return cn(t,{width:Dh(e.width),height:Dh(e.height),position:e.position}),t},at.prototype._createModdle=function(e){const t=D({},this._moddleExtensions,e.moddleExtensions);return new Xf(t)},at.prototype._modules=[];function gs(e,t){return e.warnings=t,e}function y1(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 _1={width:"100%",height:"100%",position:"relative"};function Dh(e){return e+(he(e)?"px":"")}function b1(e,t){return t&&Ke(e.diagrams,function(n){return n.id===t})||null}function x1(e){const n='<a href="http://bpmn.io" target="_blank" class="bjs-powered-by" title="Powered by bpmn.io" >'+Ah+"</a>",i=Qe(n);cn(Ge("svg",i),Th),cn(i,Mh,{position:"absolute",bottom:"15px",right:"15px",zIndex:"100"}),e.appendChild(i),me.bind(i,"click",function(r){v1(),r.preventDefault()})}function Jr(e){at.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)}te(Jr,at),Jr.prototype._createModdle=function(e){var t=at.prototype._createModdle.call(this,e);return t.ids=new ii([32,36,1]),t},Jr.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 Pe(e,t){return y(e,"bpmn:CallActivity")?!1:y(e,"bpmn:SubProcess")?(t=t||ke(e),t&&y(t,"bpmndi:BPMNPlane")?!0:t&&!!t.isExpanded):y(e,"bpmn:Participant")?!!q(e).processRef:!0}function Bt(e){if(!(!y(e,"bpmn:Participant")&&!y(e,"bpmn:Lane"))){var t=ke(e).isHorizontal;return t===void 0?!0:t}}function E1(e){return e&&q(e).isInterrupting!==!1}function en(e){return e&&!!q(e).triggeredByEvent}function eo(e,t){var n=q(e).eventDefinitions;return Li(n,function(i){return y(i,t)})}function w1(e){return eo(e,"bpmn:ErrorEventDefinition")}function S1(e){return eo(e,"bpmn:EscalationEventDefinition")}function R1(e){return eo(e,"bpmn:CompensateEventDefinition")}var Pr={width:90,height:20},Oh=15;function Ki(e){return y(e,"bpmn:Event")||y(e,"bpmn:Gateway")||y(e,"bpmn:DataStoreReference")||y(e,"bpmn:DataObjectReference")||y(e,"bpmn:DataInput")||y(e,"bpmn:DataOutput")||y(e,"bpmn:SequenceFlow")||y(e,"bpmn:MessageFlow")||y(e,"bpmn:Group")}function vs(e){return xe(e.label)}function C1(e){var t=e.length/2-1,n=e[Math.floor(t)],i=e[Math.ceil(t+.01)],r=P1(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-=Oh:a+=Oh,{x:a,y:s}}function P1(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 Qu(e){return e.waypoints?C1(e.waypoints):y(e,"bpmn:Group")?{x:e.x+e.width/2,y:e.y+Pr.height/2}:{x:e.x+e.width/2,y:e.y+e.height+Pr.height/2}}function A1(e,t){var n,i,r,o=e.label;return o&&o.bounds?(r=o.bounds,i={width:Math.max(Pr.width,r.width),height:r.height},n={x:r.x+r.width/2,y:r.y+r.height/2}):(n=Qu(t),i=Pr),D({x:n.x-i.width/2,y:n.y-i.height/2},i)}function Ih(e){if(y(e,"bpmn:FlowElement")||y(e,"bpmn:Participant")||y(e,"bpmn:Lane")||y(e,"bpmn:SequenceFlow")||y(e,"bpmn:MessageFlow")||y(e,"bpmn:DataInput")||y(e,"bpmn:DataOutput"))return"name";if(y(e,"bpmn:TextAnnotation"))return"text";if(y(e,"bpmn:Group"))return"categoryValueRef"}function T1(e){var t=e.categoryValueRef;return t&&t.value||""}function Mn(e){var t=e.businessObject,n=Ih(t);if(n)return n==="categoryValueRef"?T1(t):t[n]||""}function M1(e,t){var n=e.businessObject,i=Ih(n);if(i)if(i==="categoryValueRef"){if(!n[i])return e;n[i].value=t}else n[i]=t;return e}function k1(e){return xe(e)&&Ki(e.labelTarget)}var to=7;function Lh(e){let t=[];return M(e.incoming,n=>{y(n,"bpmn:Association")&&y(n.source,"bpmn:TextAnnotation")&&t.push({annotation:n.source,association:n})}),M(e.outgoing,n=>{y(n,"bpmn:Association")&&y(n.target,"bpmn:TextAnnotation")&&t.push({annotation:n.target,association:n})}),t}function Go(e){const t=new Map;return M(Wu(e),n=>{M(Lh(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 Ju="hsl(225, 10%, 15%)",D1="white";function ci(e,t){return Li(e.eventDefinitions,function(n){return n.$type===t})}function O1(e){return e.$type==="bpmn:IntermediateThrowEvent"||e.$type==="bpmn:EndEvent"}function I1(e){var t=e.dataObjectRef;return e.isCollection||t&&t.isCollection}function Ce(e,t,n){var i=ke(e);return n||i.get("color:background-color")||i.get("bioc:fill")||t||D1}function J(e,t,n){var i=ke(e);return n||i.get("color:border-color")||i.get("bioc:stroke")||t||Ju}function Wo(e,t,n,i){var r=ke(e),o=r.get("label");return i||o&&o.get("color:color")||t||J(e,n)}function Nh(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 Sr(r)}function el(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 Sr(a)}function L1(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 Sr(s)}function N1(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 Sr(o)}function Uo(e,t={}){return{width:Ln(e,t),height:_n(e,t)}}function Ln(e,t={}){return mn(t,"width")?t.width:e.width}function _n(e,t={}){return mn(t,"height")?t.height:e.height}var B1=new ii,$1=10,ys=3,j1=1.5,_s=10,F1=4,no=.95,H1=1,z1=.25;function Ar(e,t,n,i,r,o,a){_i.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:Ju,strokeWidth:2,fill:"white"})}function p(C){return n.computeStyle(C,["no-fill"],{strokeLinecap:"round",strokeLinejoin:"round",stroke:Ju,strokeWidth:2})}function f(C,_){var{ref:v={x:0,y:0},scale:k=1,element:O,parentGfx:z=r._svg}=_,ie=ce("marker",{id:C,viewBox:"0 0 20 20",refX:v.x,refY:v.y,markerWidth:20*k,markerHeight:20*k,orient:"auto"});ve(ie,O);var _e=Ge(":scope > defs",z);_e||(_e=ce("defs"),ve(z,_e)),ve(_e,ie)}function d(C,_,v,k){var O=B1.nextPrefixed("marker-");return h(C,O,_,v,k),"url(#"+O+")"}function h(C,_,v,k,O){if(v==="sequenceflow-end"){var z=ce("path",{d:"M 1 5 L 11 10 L 1 15 Z",...l({fill:O,stroke:O,strokeWidth:1})});f(_,{element:z,ref:{x:11,y:10},scale:.5,parentGfx:C})}if(v==="messageflow-start"){var ie=ce("circle",{cx:6,cy:6,r:3.5,...l({fill:k,stroke:O,strokeWidth:1,strokeDasharray:[1e4,1]})});f(_,{element:ie,ref:{x:6,y:6},parentGfx:C})}if(v==="messageflow-end"){var _e=ce("path",{d:"m 1 5 l 0 -3 l 7 3 l -7 3 z",...l({fill:k,stroke:O,strokeWidth:1,strokeDasharray:[1e4,1]})});f(_,{element:_e,ref:{x:8.5,y:5},parentGfx:C})}if(v==="association-start"){var Oe=ce("path",{d:"M 11 5 L 1 10 L 11 15",...p({fill:"none",stroke:O,strokeWidth:1.5,strokeDasharray:[1e4,1]})});f(_,{element:Oe,ref:{x:1,y:10},scale:.5,parentGfx:C})}if(v==="association-end"){var ft=ce("path",{d:"M 1 5 L 11 10 L 1 15",...p({fill:"none",stroke:O,strokeWidth:1.5,strokeDasharray:[1e4,1]})});f(_,{element:ft,ref:{x:11,y:10},scale:.5,parentGfx:C})}if(v==="conditional-flow-marker"){var We=ce("path",{d:"M 0 10 L 8 6 L 16 10 L 8 14 Z",...l({fill:k,stroke:O})});f(_,{element:We,ref:{x:-1,y:10},scale:.5,parentGfx:C})}if(v==="conditional-default-flow-marker"){var Ot=ce("path",{d:"M 6 4 L 10 16",...l({stroke:O,fill:"none"})});f(_,{element:Ot,ref:{x:0,y:10},scale:.5,parentGfx:C})}}function m(C,_,v,k,O={}){It(k)&&(O=k,k=0),k=k||0,O=l(O);var z=_/2,ie=v/2,_e=ce("circle",{cx:z,cy:ie,r:Math.round((_+v)/4-k),...O});return ve(C,_e),_e}function g(C,_,v,k,O,z){It(O)&&(z=O,O=0),O=O||0,z=l(z);var ie=ce("rect",{x:O,y:O,width:_-O*2,height:v-O*2,rx:k,ry:k,...z});return ve(C,ie),ie}function S(C,_,v,k){var O=_/2,z=v/2,ie=[{x:O,y:0},{x:_,y:z},{x:O,y:v},{x:0,y:z}],_e=ie.map(function(ft){return ft.x+","+ft.y}).join(" ");k=l(k);var Oe=ce("polygon",{...k,points:_e});return ve(C,Oe),Oe}function E(C,_,v,k){v=p(v);var O=Bo(_,v,k);return ve(C,O),O}function b(C,_,v){return E(C,_,v,5)}function x(C,_,v){v=p(v);var k=ce("path",{...v,d:_});return ve(C,k),k}function w(C,_,v,k){return x(_,v,D({"data-marker":C},k))}function T(C){return vt[C]}function I(C){return function(_,v,k){return T(C)(_,v,k)}}var P={"bpmn:MessageEventDefinition":function(C,_,v={},k){var O=i.getScaledPath("EVENT_MESSAGE",{xScaleFactor:.9,yScaleFactor:.9,containerWidth:v.width||_.width,containerHeight:v.height||_.height,position:{mx:.235,my:.315}}),z=k?J(_,c,v.stroke):Ce(_,s,v.fill),ie=k?Ce(_,s,v.fill):J(_,c,v.stroke),_e=x(C,O,{fill:z,stroke:ie,strokeWidth:1});return _e},"bpmn:TimerEventDefinition":function(C,_,v={}){var k=v.width||_.width,O=v.height||_.height,z=v.width?1:2,ie=m(C,k,O,.2*O,{fill:Ce(_,s,v.fill),stroke:J(_,c,v.stroke),strokeWidth:z}),_e=i.getScaledPath("EVENT_TIMER_WH",{xScaleFactor:.75,yScaleFactor:.75,containerWidth:k,containerHeight:O,position:{mx:.5,my:.5}});x(C,_e,{stroke:J(_,c,v.stroke),strokeWidth:z});for(var Oe=0;Oe<12;Oe++){var ft=i.getScaledPath("EVENT_TIMER_LINE",{xScaleFactor:.75,yScaleFactor:.75,containerWidth:k,containerHeight:O,position:{mx:.5,my:.5}}),We=k/2,Ot=O/2;x(C,ft,{strokeWidth:1,stroke:J(_,c,v.stroke),transform:"rotate("+Oe*30+","+Ot+","+We+")"})}return ie},"bpmn:EscalationEventDefinition":function(C,_,v={},k){var O=i.getScaledPath("EVENT_ESCALATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:v.width||_.width,containerHeight:v.height||_.height,position:{mx:.5,my:.2}}),z=k?J(_,c,v.stroke):Ce(_,s,v.fill);return x(C,O,{fill:z,stroke:J(_,c,v.stroke),strokeWidth:1})},"bpmn:ConditionalEventDefinition":function(C,_,v={}){var k=i.getScaledPath("EVENT_CONDITIONAL",{xScaleFactor:1,yScaleFactor:1,containerWidth:v.width||_.width,containerHeight:v.height||_.height,position:{mx:.5,my:.222}});return x(C,k,{fill:Ce(_,s,v.fill),stroke:J(_,c,v.stroke),strokeWidth:1})},"bpmn:LinkEventDefinition":function(C,_,v={},k){var O=i.getScaledPath("EVENT_LINK",{xScaleFactor:1,yScaleFactor:1,containerWidth:_.width,containerHeight:_.height,position:{mx:.57,my:.263}}),z=k?J(_,c,v.stroke):Ce(_,s,v.fill);return x(C,O,{fill:z,stroke:J(_,c,v.stroke),strokeWidth:1})},"bpmn:ErrorEventDefinition":function(C,_,v={},k){var O=i.getScaledPath("EVENT_ERROR",{xScaleFactor:1.1,yScaleFactor:1.1,containerWidth:v.width||_.width,containerHeight:v.height||_.height,position:{mx:.2,my:.722}}),z=k?J(_,c,v.stroke):Ce(_,s,v.fill);return x(C,O,{fill:z,stroke:J(_,c,v.stroke),strokeWidth:1})},"bpmn:CancelEventDefinition":function(C,_,v={},k){var O=i.getScaledPath("EVENT_CANCEL_45",{xScaleFactor:1,yScaleFactor:1,containerWidth:_.width,containerHeight:_.height,position:{mx:.638,my:-.055}}),z=k?J(_,c,v.stroke):"none",ie=x(C,O,{fill:z,stroke:J(_,c,v.stroke),strokeWidth:1});return Ch(ie,45),ie},"bpmn:CompensateEventDefinition":function(C,_,v={},k){var O=i.getScaledPath("EVENT_COMPENSATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:v.width||_.width,containerHeight:v.height||_.height,position:{mx:.22,my:.5}}),z=k?J(_,c,v.stroke):Ce(_,s,v.fill);return x(C,O,{fill:z,stroke:J(_,c,v.stroke),strokeWidth:1})},"bpmn:SignalEventDefinition":function(C,_,v={},k){var O=i.getScaledPath("EVENT_SIGNAL",{xScaleFactor:.9,yScaleFactor:.9,containerWidth:v.width||_.width,containerHeight:v.height||_.height,position:{mx:.5,my:.2}}),z=k?J(_,c,v.stroke):Ce(_,s,v.fill);return x(C,O,{strokeWidth:1,fill:z,stroke:J(_,c,v.stroke)})},"bpmn:MultipleEventDefinition":function(C,_,v={},k){var O=i.getScaledPath("EVENT_MULTIPLE",{xScaleFactor:1.1,yScaleFactor:1.1,containerWidth:v.width||_.width,containerHeight:v.height||_.height,position:{mx:.211,my:.36}}),z=k?J(_,c,v.stroke):Ce(_,s,v.fill);return x(C,O,{fill:z,stroke:J(_,c,v.stroke),strokeWidth:1})},"bpmn:ParallelMultipleEventDefinition":function(C,_,v={}){var k=i.getScaledPath("EVENT_PARALLEL_MULTIPLE",{xScaleFactor:1.2,yScaleFactor:1.2,containerWidth:v.width||_.width,containerHeight:v.height||_.height,position:{mx:.458,my:.194}});return x(C,k,{fill:Ce(_,s,v.fill),stroke:J(_,c,v.stroke),strokeWidth:1})},"bpmn:TerminateEventDefinition":function(C,_,v={}){var k=m(C,_.width,_.height,8,{fill:J(_,c,v.stroke),stroke:J(_,c,v.stroke),strokeWidth:4});return k}};function j(C,_,v={},k){var O=q(C),z=O1(O),ie=k||C;return O.get("eventDefinitions")&&O.get("eventDefinitions").length>1?O.get("parallelMultiple")?P["bpmn:ParallelMultipleEventDefinition"](_,ie,v,z):P["bpmn:MultipleEventDefinition"](_,ie,v,z):ci(O,"bpmn:MessageEventDefinition")?P["bpmn:MessageEventDefinition"](_,ie,v,z):ci(O,"bpmn:TimerEventDefinition")?P["bpmn:TimerEventDefinition"](_,ie,v,z):ci(O,"bpmn:ConditionalEventDefinition")?P["bpmn:ConditionalEventDefinition"](_,ie,v,z):ci(O,"bpmn:SignalEventDefinition")?P["bpmn:SignalEventDefinition"](_,ie,v,z):ci(O,"bpmn:EscalationEventDefinition")?P["bpmn:EscalationEventDefinition"](_,ie,v,z):ci(O,"bpmn:LinkEventDefinition")?P["bpmn:LinkEventDefinition"](_,ie,v,z):ci(O,"bpmn:ErrorEventDefinition")?P["bpmn:ErrorEventDefinition"](_,ie,v,z):ci(O,"bpmn:CancelEventDefinition")?P["bpmn:CancelEventDefinition"](_,ie,v,z):ci(O,"bpmn:CompensateEventDefinition")?P["bpmn:CompensateEventDefinition"](_,ie,v,z):ci(O,"bpmn:TerminateEventDefinition")?P["bpmn:TerminateEventDefinition"](_,ie,v,z):null}var F={ParticipantMultiplicityMarker:function(C,_,v={}){var k=Ln(_,v),O=_n(_,v),z=i.getScaledPath("MARKER_PARALLEL",{xScaleFactor:1,yScaleFactor:1,containerWidth:k,containerHeight:O,position:{mx:(k/2-6)/k,my:(O-15)/O}});w("participant-multiplicity",C,z,{strokeWidth:2,fill:Ce(_,s,v.fill),stroke:J(_,c,v.stroke)})},SubProcessMarker:function(C,_,v={}){var k=g(C,14,14,0,{strokeWidth:1,fill:Ce(_,s,v.fill),stroke:J(_,c,v.stroke)});Wt(k,_.width/2-7.5,_.height-20);var O=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}});w("sub-process",C,O,{fill:Ce(_,s,v.fill),stroke:J(_,c,v.stroke)})},ParallelMarker:function(C,_,v){var k=Ln(_,v),O=_n(_,v),z=i.getScaledPath("MARKER_PARALLEL",{xScaleFactor:1,yScaleFactor:1,containerWidth:k,containerHeight:O,position:{mx:(k/2+v.parallel)/k,my:(O-20)/O}});w("parallel",C,z,{fill:Ce(_,s,v.fill),stroke:J(_,c,v.stroke)})},SequentialMarker:function(C,_,v){var k=i.getScaledPath("MARKER_SEQUENTIAL",{xScaleFactor:1,yScaleFactor:1,containerWidth:_.width,containerHeight:_.height,position:{mx:(_.width/2+v.seq)/_.width,my:(_.height-19)/_.height}});w("sequential",C,k,{fill:Ce(_,s,v.fill),stroke:J(_,c,v.stroke)})},CompensationMarker:function(C,_,v){var k=i.getScaledPath("MARKER_COMPENSATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:_.width,containerHeight:_.height,position:{mx:(_.width/2+v.compensation)/_.width,my:(_.height-13)/_.height}});w("compensation",C,k,{strokeWidth:1,fill:Ce(_,s,v.fill),stroke:J(_,c,v.stroke)})},LoopMarker:function(C,_,v){var k=Ln(_,v),O=_n(_,v),z=i.getScaledPath("MARKER_LOOP",{xScaleFactor:1,yScaleFactor:1,containerWidth:k,containerHeight:O,position:{mx:(k/2+v.loop)/k,my:(O-7)/O}});w("loop",C,z,{strokeWidth:1.5,fill:"none",stroke:J(_,c,v.stroke),strokeMiterlimit:.5})},AdhocMarker:function(C,_,v){var k=Ln(_,v),O=_n(_,v),z=i.getScaledPath("MARKER_ADHOC",{xScaleFactor:1,yScaleFactor:1,containerWidth:k,containerHeight:O,position:{mx:(k/2+v.adhoc)/k,my:(O-15)/O}});w("adhoc",C,z,{strokeWidth:1,fill:J(_,c,v.stroke),stroke:J(_,c,v.stroke)})}};function L(C,_,v,k){F[C](_,v,k)}function H(C,_,v=[],k={}){k={fill:k.fill,stroke:k.stroke,width:Ln(_,k),height:_n(_,k)};var O=q(_),z=v.includes("SubProcessMarker");z?k={...k,seq:-21,parallel:-22,compensation:-25,loop:-18,adhoc:10}:k={...k,seq:-5,parallel:-6,compensation:-7,loop:0,adhoc:-8},O.get("isForCompensation")&&v.push("CompensationMarker"),y(O,"bpmn:AdHocSubProcess")&&(v.push("AdhocMarker"),z||D(k,{compensation:k.compensation-18}));var ie=O.get("loopCharacteristics"),_e=ie&&ie.get("isSequential");ie&&(D(k,{compensation:k.compensation-18}),v.includes("AdhocMarker")&&D(k,{seq:-23,loop:-18,parallel:-24}),_e===void 0&&v.push("LoopMarker"),_e===!1&&v.push("ParallelMarker"),_e===!0&&v.push("SequentialMarker")),v.includes("CompensationMarker")&&v.length===1&&D(k,{compensation:-8}),M(v,function(Oe){L(Oe,C,_,k)})}function oe(C,_,v={}){v=D({size:{width:100}},v);var k=o.createText(_||"",v);return Ae(k).add("djs-label"),ve(C,k),k}function Te(C,_,v,k={}){var O=q(_),z=Uo({x:_.x,y:_.y,width:_.width,height:_.height},k);return oe(C,O.name,{align:v,box:z,padding:7,style:{fill:Wo(_,u,c,k.stroke)}})}function ot(C,_,v={}){var k={width:_.width,height:_.height,x:_.width/2+_.x,y:_.height/2+_.y};return oe(C,Mn(_),{box:k,style:D({},o.getExternalStyle(),{fill:Wo(_,u,c,v.stroke)})})}function Y(C,_,v,k={}){var O=Bt(v),z=oe(C,_,{box:{height:30,width:O?_n(v,k):Ln(v,k)},align:"center-middle",style:{fill:Wo(v,u,c,k.stroke)}});if(O){var ie=-1*_n(v,k);hs(z,0,-ie,270)}}function re(C,_,v={}){var{width:k,height:O}=Uo(_,v);return g(C,k,O,_s,{...v,fill:Ce(_,s,v.fill),fillOpacity:no,stroke:J(_,c,v.stroke)})}function le(C,_,v={}){var k=q(_),O=Ce(_,s,v.fill),z=J(_,c,v.stroke);return(k.get("associationDirection")==="One"||k.get("associationDirection")==="Both")&&(v.markerEnd=d(C,"association-end",O,z)),k.get("associationDirection")==="Both"&&(v.markerStart=d(C,"association-start",O,z)),v=De(v,["markerStart","markerEnd"]),b(C,_.waypoints,{...v,stroke:z,strokeDasharray:"0, 5"})}function ae(C,_,v={}){var k=Ce(_,s,v.fill),O=J(_,c,v.stroke),z=i.getScaledPath("DATA_OBJECT_PATH",{xScaleFactor:1,yScaleFactor:1,containerWidth:_.width,containerHeight:_.height,position:{mx:.474,my:.296}}),ie=x(C,z,{fill:k,fillOpacity:no,stroke:O}),_e=q(_);if(I1(_e)){var Oe=i.getScaledPath("DATA_OBJECT_COLLECTION_PATH",{xScaleFactor:1,yScaleFactor:1,containerWidth:_.width,containerHeight:_.height,position:{mx:.33,my:(_.height-18)/_.height}});x(C,Oe,{strokeWidth:2,fill:k,stroke:O})}return ie}function se(C,_,v={}){return m(C,_.width,_.height,{fillOpacity:no,...v,fill:Ce(_,s,v.fill),stroke:J(_,c,v.stroke)})}function Z(C,_,v={}){return S(C,_.width,_.height,{fill:Ce(_,s,v.fill),fillOpacity:no,stroke:J(_,c,v.stroke)})}function $(C,_,v={}){var k=g(C,Ln(_,v),_n(_,v),0,{fill:Ce(_,s,v.fill),fillOpacity:v.fillOpacity||no,stroke:J(_,c,v.stroke),strokeWidth:1.5}),O=q(_);if(y(O,"bpmn:Lane")){var z=O.get("name");Y(C,z,_,v)}return k}function N(C,_,v={}){var k=re(C,_,v),O=Pe(_);if(en(_)&&(ne(k,{strokeDasharray:"0, 5.5",strokeWidth:2.5}),!O)){var z=q(_).flowElements||[],ie=z.filter(_e=>y(_e,"bpmn:StartEvent"));ie.length===1&&V(ie[0],C,v,_)}return Te(C,_,O?"center-top":"center-middle",v),O?H(C,_,void 0,v):H(C,_,["SubProcessMarker"],v),k}function V(C,_,v,k){var O=22,z={fill:Ce(k,s,v.fill),stroke:J(k,c,v.stroke),width:O,height:O},ie=q(C).isInterrupting,_e=ie?0:3,Oe=ie?1:1.2,ft=20,We=(O-ft)/2,Ot="translate("+We+","+We+")";m(_,ft,ft,{fill:z.fill,stroke:z.stroke,strokeWidth:Oe,strokeDasharray:_e,transform:Ot}),j(C,_,z,k)}function we(C,_,v={}){var k=re(C,_,v);return Te(C,_,"center-middle",v),H(C,_,void 0,v),k}var vt=this.handlers={"bpmn:AdHocSubProcess":function(C,_,v={}){return Pe(_)?v=De(v,["fill","stroke","width","height"]):v=De(v,["fill","stroke"]),N(C,_,v)},"bpmn:Association":function(C,_,v={}){return v=De(v,["fill","stroke"]),le(C,_,v)},"bpmn:BoundaryEvent":function(C,_,v={}){var{renderIcon:k=!0}=v;v=De(v,["fill","stroke"]);var O=q(_),z=O.get("cancelActivity");v={strokeWidth:1.5,fill:Ce(_,s,v.fill),fillOpacity:H1,stroke:J(_,c,v.stroke)},z||(v.strokeDasharray="6");var ie=se(C,_,v);return m(C,_.width,_.height,ys,{...v,fill:"none"}),k&&j(_,C,v),ie},"bpmn:BusinessRuleTask":function(C,_,v={}){v=De(v,["fill","stroke"]);var k=we(C,_,v),O=i.getScaledPath("TASK_TYPE_BUSINESS_RULE_MAIN",{abspos:{x:8,y:8}}),z=x(C,O);ne(z,{fill:Ce(_,s,v.fill),stroke:J(_,c,v.stroke),strokeWidth:1});var ie=i.getScaledPath("TASK_TYPE_BUSINESS_RULE_HEADER",{abspos:{x:8,y:8}}),_e=x(C,ie);return ne(_e,{fill:J(_,c,v.stroke),stroke:J(_,c,v.stroke),strokeWidth:1}),k},"bpmn:CallActivity":function(C,_,v={}){return v=De(v,["fill","stroke"]),N(C,_,{strokeWidth:5,...v})},"bpmn:ComplexGateway":function(C,_,v={}){v=De(v,["fill","stroke"]);var k=Z(C,_,v),O=i.getScaledPath("GATEWAY_COMPLEX",{xScaleFactor:.5,yScaleFactor:.5,containerWidth:_.width,containerHeight:_.height,position:{mx:.46,my:.26}});return x(C,O,{fill:J(_,c,v.stroke),stroke:J(_,c,v.stroke),strokeWidth:1}),k},"bpmn:DataInput":function(C,_,v={}){v=De(v,["fill","stroke"]);var k=i.getRawPath("DATA_ARROW"),O=ae(C,_,v);return x(C,k,{fill:"none",stroke:J(_,c,v.stroke),strokeWidth:1}),O},"bpmn:DataInputAssociation":function(C,_,v={}){return v=De(v,["fill","stroke"]),le(C,_,{...v,markerEnd:d(C,"association-end",Ce(_,s,v.fill),J(_,c,v.stroke))})},"bpmn:DataObject":function(C,_,v={}){return v=De(v,["fill","stroke"]),ae(C,_,v)},"bpmn:DataObjectReference":I("bpmn:DataObject"),"bpmn:DataOutput":function(C,_,v={}){v=De(v,["fill","stroke"]);var k=i.getRawPath("DATA_ARROW"),O=ae(C,_,v);return x(C,k,{strokeWidth:1,fill:J(_,c,v.stroke),stroke:J(_,c,v.stroke)}),O},"bpmn:DataOutputAssociation":function(C,_,v={}){return v=De(v,["fill","stroke"]),le(C,_,{...v,markerEnd:d(C,"association-end",Ce(_,s,v.fill),J(_,c,v.stroke))})},"bpmn:DataStoreReference":function(C,_,v={}){v=De(v,["fill","stroke"]);var k=i.getScaledPath("DATA_STORE",{xScaleFactor:1,yScaleFactor:1,containerWidth:_.width,containerHeight:_.height,position:{mx:0,my:.133}});return x(C,k,{fill:Ce(_,s,v.fill),fillOpacity:no,stroke:J(_,c,v.stroke),strokeWidth:2})},"bpmn:EndEvent":function(C,_,v={}){var{renderIcon:k=!0}=v;v=De(v,["fill","stroke"]);var O=se(C,_,{...v,strokeWidth:4});return k&&j(_,C,v),O},"bpmn:EventBasedGateway":function(C,_,v={}){v=De(v,["fill","stroke"]);var k=q(_),O=Z(C,_,v);m(C,_.width,_.height,_.height*.2,{fill:Ce(_,"none",v.fill),stroke:J(_,c,v.stroke),strokeWidth:1});var z=k.get("eventGatewayType"),ie=!!k.get("instantiate");function _e(){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:J(_,c,v.stroke),strokeWidth:2})}if(z==="Parallel"){var Oe=i.getScaledPath("GATEWAY_PARALLEL",{xScaleFactor:.4,yScaleFactor:.4,containerWidth:_.width,containerHeight:_.height,position:{mx:.474,my:.296}});x(C,Oe,{fill:"none",stroke:J(_,c,v.stroke),strokeWidth:1})}else z==="Exclusive"&&(ie||m(C,_.width,_.height,_.height*.26,{fill:"none",stroke:J(_,c,v.stroke),strokeWidth:1}),_e());return O},"bpmn:ExclusiveGateway":function(C,_,v={}){v=De(v,["fill","stroke"]);var k=Z(C,_,v),O=i.getScaledPath("GATEWAY_EXCLUSIVE",{xScaleFactor:.4,yScaleFactor:.4,containerWidth:_.width,containerHeight:_.height,position:{mx:.32,my:.3}}),z=ke(_);return z.get("isMarkerVisible")&&x(C,O,{fill:J(_,c,v.stroke),stroke:J(_,c,v.stroke),strokeWidth:1}),k},"bpmn:Gateway":function(C,_,v={}){return v=De(v,["fill","stroke"]),Z(C,_,v)},"bpmn:Group":function(C,_,v={}){return v=De(v,["fill","stroke","width","height"]),g(C,_.width,_.height,_s,{stroke:J(_,c,v.stroke),strokeWidth:1.5,strokeDasharray:"10, 6, 0, 6",fill:"none",pointerEvents:"none",width:Ln(_,v),height:_n(_,v)})},"bpmn:InclusiveGateway":function(C,_,v={}){v=De(v,["fill","stroke"]);var k=Z(C,_,v);return m(C,_.width,_.height,_.height*.24,{fill:Ce(_,s,v.fill),stroke:J(_,c,v.stroke),strokeWidth:2.5}),k},"bpmn:IntermediateEvent":function(C,_,v={}){var{renderIcon:k=!0}=v;v=De(v,["fill","stroke"]);var O=se(C,_,{...v,strokeWidth:1.5});return m(C,_.width,_.height,ys,{fill:"none",stroke:J(_,c,v.stroke),strokeWidth:1.5}),k&&j(_,C,v),O},"bpmn:IntermediateCatchEvent":I("bpmn:IntermediateEvent"),"bpmn:IntermediateThrowEvent":I("bpmn:IntermediateEvent"),"bpmn:Lane":function(C,_,v={}){return v=De(v,["fill","stroke","width","height"]),$(C,_,{...v,fillOpacity:z1})},"bpmn:ManualTask":function(C,_,v={}){v=De(v,["fill","stroke"]);var k=we(C,_,v),O=i.getScaledPath("TASK_TYPE_MANUAL",{abspos:{x:17,y:15}});return x(C,O,{fill:Ce(_,s,v.fill),stroke:J(_,c,v.stroke),strokeWidth:.5}),k},"bpmn:MessageFlow":function(C,_,v={}){v=De(v,["fill","stroke"]);var k=q(_),O=ke(_),z=Ce(_,s,v.fill),ie=J(_,c,v.stroke),_e=b(C,_.waypoints,{markerEnd:d(C,"messageflow-end",z,ie),markerStart:d(C,"messageflow-start",z,ie),stroke:ie,strokeDasharray:"10, 11",strokeWidth:1.5});if(k.get("messageRef")){var Oe=_e.getPointAtLength(_e.getTotalLength()/2),ft=i.getScaledPath("MESSAGE_FLOW_MARKER",{abspos:{x:Oe.x,y:Oe.y}}),We={strokeWidth:1};O.get("messageVisibleKind")==="initiating"?(We.fill=z,We.stroke=ie):(We.fill=ie,We.stroke=z);var Ot=x(C,ft,We),$t=k.get("messageRef"),tn=$t.get("name"),Xe=oe(C,tn,{align:"center-top",fitBox:!0,style:{fill:ie}}),Ct=Ot.getBBox(),nn=Xe.getBBox(),Fr=Oe.x-nn.width/2,ln=Oe.y+Ct.height/2+$1;hs(Xe,Fr,ln,0)}return _e},"bpmn:ParallelGateway":function(C,_,v={}){v=De(v,["fill","stroke"]);var k=Z(C,_,v),O=i.getScaledPath("GATEWAY_PARALLEL",{xScaleFactor:.6,yScaleFactor:.6,containerWidth:_.width,containerHeight:_.height,position:{mx:.46,my:.2}});return x(C,O,{fill:J(_,c,v.stroke),stroke:J(_,c,v.stroke),strokeWidth:1}),k},"bpmn:Participant":function(C,_,v={}){v=De(v,["fill","stroke","width","height"]);var k=$(C,_,v),O=Pe(_),z=Bt(_),ie=q(_),_e=ie.get("name");if(O){var Oe=z?[{x:30,y:0},{x:30,y:_n(_,v)}]:[{x:0,y:30},{x:Ln(_,v),y:30}];E(C,Oe,{stroke:J(_,c,v.stroke),strokeWidth:j1}),Y(C,_e,_,v)}else{var ft=Uo(_,v);z||(ft.height=Ln(_,v),ft.width=_n(_,v));var We=oe(C,_e,{box:ft,align:"center-middle",style:{fill:Wo(_,u,c,v.stroke)}});if(!z){var Ot=-1*_n(_,v);hs(We,0,-Ot,270)}}return ie.get("participantMultiplicity")&&L("ParticipantMultiplicityMarker",C,_,v),k},"bpmn:ReceiveTask":function(C,_,v={}){v=De(v,["fill","stroke"]);var k=q(_),O=we(C,_,v),z;return k.get("instantiate")?(m(C,28,28,20*.22,{fill:Ce(_,s,v.fill),stroke:J(_,c,v.stroke),strokeWidth:1}),z=i.getScaledPath("TASK_TYPE_INSTANTIATING_SEND",{abspos:{x:7.77,y:9.52}})):z=i.getScaledPath("TASK_TYPE_SEND",{xScaleFactor:.9,yScaleFactor:.9,containerWidth:21,containerHeight:14,position:{mx:.3,my:.4}}),x(C,z,{fill:Ce(_,s,v.fill),stroke:J(_,c,v.stroke),strokeWidth:1}),O},"bpmn:ScriptTask":function(C,_,v={}){v=De(v,["fill","stroke"]);var k=we(C,_,v),O=i.getScaledPath("TASK_TYPE_SCRIPT",{abspos:{x:15,y:20}});return x(C,O,{fill:Ce(_,s,v.fill),stroke:J(_,c,v.stroke),strokeWidth:1}),k},"bpmn:SendTask":function(C,_,v={}){v=De(v,["fill","stroke"]);var k=we(C,_,v),O=i.getScaledPath("TASK_TYPE_SEND",{xScaleFactor:1,yScaleFactor:1,containerWidth:21,containerHeight:14,position:{mx:.285,my:.357}});return x(C,O,{fill:J(_,c,v.stroke),stroke:Ce(_,s,v.fill),strokeWidth:1}),k},"bpmn:SequenceFlow":function(C,_,v={}){v=De(v,["fill","stroke"]);var k=Ce(_,s,v.fill),O=J(_,c,v.stroke),z=b(C,_.waypoints,{markerEnd:d(C,"sequenceflow-end",k,O),stroke:O}),ie=q(_),{source:_e}=_;if(_e){var Oe=q(_e);ie.get("conditionExpression")&&y(Oe,"bpmn:Activity")&&ne(z,{markerStart:d(C,"conditional-flow-marker",k,O)}),Oe.get("default")&&(y(Oe,"bpmn:Gateway")||y(Oe,"bpmn:Activity"))&&Oe.get("default")===ie&&ne(z,{markerStart:d(C,"conditional-default-flow-marker",k,O)})}return z},"bpmn:ServiceTask":function(C,_,v={}){v=De(v,["fill","stroke"]);var k=we(C,_,v);m(C,10,10,{fill:Ce(_,s,v.fill),stroke:"none",transform:"translate(6, 6)"});var O=i.getScaledPath("TASK_TYPE_SERVICE",{abspos:{x:12,y:18}});x(C,O,{fill:Ce(_,s,v.fill),stroke:J(_,c,v.stroke),strokeWidth:1}),m(C,10,10,{fill:Ce(_,s,v.fill),stroke:"none",transform:"translate(11, 10)"});var z=i.getScaledPath("TASK_TYPE_SERVICE",{abspos:{x:17,y:22}});return x(C,z,{fill:Ce(_,s,v.fill),stroke:J(_,c,v.stroke),strokeWidth:1}),k},"bpmn:StartEvent":function(C,_,v={}){var{renderIcon:k=!0}=v;v=De(v,["fill","stroke"]);var O=q(_);O.get("isInterrupting")||(v={...v,strokeDasharray:"6"});var z=se(C,_,v);return k&&j(_,C,v),z},"bpmn:SubProcess":function(C,_,v={}){return Pe(_)?v=De(v,["fill","stroke","width","height"]):v=De(v,["fill","stroke"]),N(C,_,v)},"bpmn:Task":function(C,_,v={}){return v=De(v,["fill","stroke"]),we(C,_,v)},"bpmn:TextAnnotation":function(C,_,v={}){v=De(v,["fill","stroke"]);var{width:k,height:O}=Uo(_,v),z=g(C,k,O,0,0,{fill:"none",stroke:"none"}),ie=i.getScaledPath("TEXT_ANNOTATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:k,containerHeight:O,position:{mx:0,my:0}});x(C,ie,{stroke:J(_,c,v.stroke)});var _e=q(_),Oe=_e.get("text")||"";return oe(C,Oe,{align:"left-top",box:Uo(_,v),padding:to,style:{fill:Wo(_,u,c,v.stroke)}}),z},"bpmn:Transaction":function(C,_,v={}){Pe(_)?v=De(v,["fill","stroke","width","height"]):v=De(v,["fill","stroke"]);var k=N(C,_,{strokeWidth:1.5,...v}),O=n.style(["no-fill","no-events"],{stroke:J(_,c,v.stroke),strokeWidth:1.5}),z=Pe(_);return z||(v={}),g(C,Ln(_,v),_n(_,v),_s-ys,ys,O),k},"bpmn:UserTask":function(C,_,v={}){v=De(v,["fill","stroke"]);var k=we(C,_,v),O=15,z=12,ie=i.getScaledPath("TASK_TYPE_USER_1",{abspos:{x:O,y:z}});x(C,ie,{fill:Ce(_,s,v.fill),stroke:J(_,c,v.stroke),strokeWidth:.5});var _e=i.getScaledPath("TASK_TYPE_USER_2",{abspos:{x:O,y:z}});x(C,_e,{fill:Ce(_,s,v.fill),stroke:J(_,c,v.stroke),strokeWidth:.5});var Oe=i.getScaledPath("TASK_TYPE_USER_3",{abspos:{x:O,y:z}});return x(C,Oe,{fill:J(_,c,v.stroke),stroke:J(_,c,v.stroke),strokeWidth:.5}),k},label:function(C,_,v={}){return ot(C,_,v)}};this._drawPath=x,this._renderer=T}te(Ar,_i),Ar.$inject=["config.bpmnRenderer","eventBus","styles","pathMap","canvas","textRenderer"],Ar.prototype.canRender=function(e){return y(e,"bpmn:BaseElement")},Ar.prototype.drawShape=function(e,t,n={}){var{type:i}=t,r=this._renderer(i);return r(e,t,n)},Ar.prototype.drawConnection=function(e,t,n={}){var{type:i}=t,r=this._renderer(i);return r(e,t,n)},Ar.prototype.getShapePath=function(e){return xe(e)?el(e,F1):y(e,"bpmn:Event")?Nh(e):y(e,"bpmn:Activity")?el(e,_s):y(e,"bpmn:Gateway")?L1(e):N1(e)};function De(e,t=[]){return t.reduce((n,i)=>(e[i]&&(n[i]=e[i]),n),{})}var V1=0,G1={width:150,height:50};function W1(e){var t=e.split("-");return{horizontal:t[0]||"center",vertical:t[1]||"top"}}function U1(e){return It(e)?D({top:0,left:0,right:0,bottom:0},e):{top:e,left:e,right:e,bottom:e}}var tl=null;function q1(){return tl||(tl=document.createElement("canvas").getContext("2d")),tl}function Y1(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(Bh(e.fontSize)||"12px"),t.push(e.fontFamily||"sans-serif"),t.join(" ")}function Bh(e){if(e!=null)return typeof e=="number"||/^-?\d+(\.\d+)?$/.test(e)?e+"px":e}function K1(e,t){var n=q1();if(!n)return{width:0,height:0};n.font=Y1(t),"letterSpacing"in n&&(n.letterSpacing=Bh(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 X1(e,t,n){for(var i=e.shift(),r=i,o;;){if(o=K1(r,n),o.width=r?o.width:0,r===" "||r===""||o.width<Math.round(t)||r.length<2)return Z1(e,r,i,o);r=J1(r,o.width,t)}}function Z1(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 $h="";function Q1(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===$h)&&r.pop();break}var a=r[r.length-1];return a&&a===$h&&(r[r.length-1]="-"),r.join("")}function J1(e,t,n){var i=Math.max(e.length*(n/t),1),r=Q1(e,i);return r||(r=e.slice(0,Math.max(Math.round(i-1),1))),r}function bs(e){this._config=D({},{size:G1,padding:V1,style:{},align:"center-top"},e||{})}bs.prototype.createText=function(e,t){return this.layoutText(e,t).element},bs.prototype.getDimensions=function(e,t){return this.layoutText(e,t).dimensions},bs.prototype.layoutText=function(e,t){for(var n=D({},this._config.size,t.box),i=D({},this._config.style,t.style),r=W1(t.align||this._config.align),o=U1(t.padding!==void 0?t.padding:this._config.padding),a=t.fitBox||!1,s=eS(i),c=e.split(/\u00AD?\r?\n/),u=[],l=n.width-o.left-o.right;c.length;)u.push(X1(c,l,i));r.vertical==="middle"&&(o.top=o.bottom=0);var p=gn(u,function(g,S,E){return g+(s||S.height)},0)+o.top+o.bottom,f=gn(u,function(g,S,E){return S.width>g?S.width:g},0),d=o.top;r.vertical==="middle"&&(d+=(n.height-p)/2),d-=(s||u[0].height)/4;var h=ce("text");ne(h,i),M(u,function(g){var S;switch(d+=s||g.height,r.horizontal){case"left":S=o.left;break;case"right":S=(a?f:l)-o.right-g.width;break;default:S=Math.max(((a?f:l)-g.width)/2+o.left,0)}var E=ce("tspan");ne(E,{x:S,y:d}),E.textContent=g.text,ve(h,E)});var m={width:f,height:p};return{dimensions:m,element:h}};function eS(e){if("fontSize"in e&&"lineHeight"in e)return e.lineHeight*parseInt(e.fontSize,10)}var tS=12,nS=1.2,iS=40;function jh(e){var t=D({fontFamily:"Arial, sans-serif",fontSize:tS,fontWeight:"normal",lineHeight:nS},e&&e.defaultStyle||{}),n=parseInt(t.fontSize,10)-1,i=D({},t,{fontSize:n},e&&e.externalStyle||{}),r=new bs({style:t});this.getExternalLabelBounds=function(a,s){var c={width:Math.max(a.width,Pr.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:to});return{x:a.x,y:a.y,width:a.width,height:Math.max(iS,Math.round(c.height))}},this.getDimensions=function(a,s){return r.getDimensions(a,s||{})};function o(a,s,c){return r.getDimensions(a,D({box:s},c))}this.createText=function(a,s){return r.createText(a,s||{})},this.getDefaultStyle=function(){return t},this.getExternalStyle=function(){return i}}jh.$inject=["config.textRenderer"];function rS(){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=cS(i.d,{mx:r,my:o,e:a});return p}}var oS=/\{([^{}]+)\}/g,aS=/(?:(?:^|\.)(.+?)(?=\[|\.|$|\()|\[('|")(.+?)\2\])(\(\))?/g;function sS(e,t,n){var i=n;return t.replace(aS,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 cS(e,t){return String(e).replace(oS,function(n,i){return sS(n,i,t)})}const uS={__init__:["bpmnRenderer"],bpmnRenderer:["type",Ar],textRenderer:["type",jh],pathMap:["type",rS]};function lS(e,t){return t=t||{},e.replace(/{([^}]+)}/g,function(n,i){return t[i]||"{"+i+"}"})}const qo={translate:["value",lS]};function xs(e,t,n){return D({id:e.id,type:e.$type,businessObject:e,di:t},n)}function pS(e,t,n){var i=e.waypoint;return!i||i.length<2?[fe(t),fe(n)]:i.map(function(r){return{x:r.x,y:r.y}})}function Fh(e,t,n){return new Error(`element ${Jt(t)} referenced by ${Jt(e)}#${n} not yet drawn`)}function wi(e,t,n,i,r){this._eventBus=e,this._canvas=t,this._elementFactory=n,this._elementRegistry=i,this._textRenderer=r}wi.$inject=["eventBus","canvas","elementFactory","elementRegistry","textRenderer"],wi.prototype.add=function(e,t,n){var i,r,o;if(y(t,"bpmndi:BPMNPlane")){var a=y(e,"bpmn:SubProcess")?{id:e.id+"_plane"}:{};i=this._elementFactory.createRoot(xs(e,t,a)),this._canvas.addRootElement(i)}else if(y(t,"bpmndi:BPMNShape")){var s=!Pe(e,t),c=dS(e);r=n&&(n.hidden||n.collapsed);var u=t.bounds;i=this._elementFactory.createShape(xs(e,t,{collapsed:s,hidden:r,x:Math.round(u.x),y:Math.round(u.y),width:Math.round(u.width),height:Math.round(u.height),isFrame:c})),y(e,"bpmn:BoundaryEvent")&&this._attachBoundary(e,i),y(e,"bpmn:Lane")&&(o=0),y(e,"bpmn:DataStoreReference")&&(fS(n,fe(u))||(n=this._canvas.findRoot(n))),this._canvas.addShape(i,n,o)}else if(y(t,"bpmndi:BPMNEdge")){var l=this._getSource(e),p=this._getTarget(e);r=n&&(n.hidden||n.collapsed),i=this._elementFactory.createConnection(xs(e,t,{hidden:r,source:l,target:p,waypoints:pS(t,l,p)})),y(e,"bpmn:DataAssociation")&&(n=this._canvas.findRoot(n)),this._canvas.addConnection(i,n,o)}else throw new Error(`unknown di ${Jt(t)} for element ${Jt(e)}`);return Ki(e)&&Mn(i)&&this.addLabel(e,t,i),this._eventBus.fire("bpmnElement.added",{element:i}),i},wi.prototype._attachBoundary=function(e,t){var n=e.attachedToRef;if(!n)throw new Error(`missing ${Jt(e)}#attachedToRef`);var i=this._elementRegistry.get(n.id),r=i&&i.attachers;if(!i)throw Fh(e,n,"attachedToRef");t.host=i,r||(i.attachers=r=[]),r.indexOf(t)===-1&&r.push(t)},wi.prototype.addLabel=function(e,t,n){var i,r,o;return i=A1(t,n),r=Mn(n),r&&(i=this._textRenderer.getExternalLabelBounds(i,r)),o=this._elementFactory.createLabel(xs(e,t,{id:e.id+"_label",labelTarget:n,type:"label",hidden:n.hidden||!Mn(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)},wi.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?Fh(e,i,t+"Ref"):new Error(`${Jt(e)}#${t} Ref not specified`)},wi.prototype._getSource=function(e){return this._getConnectedElement(e,"source")},wi.prototype._getTarget=function(e){return this._getConnectedElement(e,"target")},wi.prototype._getElement=function(e){return this._elementRegistry.get(e.id)};function fS(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 dS(e){return y(e,"bpmn:Group")}const Hh={__depends__:[uS,{__depends__:[qo],bpmnImporter:["type",wi]}]};function Yo(e){return{x:e.x+e.width/2,y:e.y+e.height/2}}function Kn(e,t){return{x:e.x-t.x,y:e.y-t.y}}function nl(e){return Math.log(e)/Math.log(10)}var hS=1e3;function W(e){this._eventBus=e}W.$inject=["eventBus"];function mS(e,t){return function(n){return e.call(t||null,n.context,n.command,n)}}W.prototype.on=function(e,t,n,i,r,o){if((Lt(t)||he(t))&&(o=r,r=i,i=n,n=t,t=null),Lt(n)&&(o=r,r=i,i=n,n=hS),It(r)&&(o=r,r=!1),!Lt(i))throw new Error("handlerFn must be a function");pe(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?mS(i,o):i,o)})},W.prototype.canExecute=Si("canExecute"),W.prototype.preExecute=Si("preExecute"),W.prototype.preExecuted=Si("preExecuted"),W.prototype.execute=Si("execute"),W.prototype.executed=Si("executed"),W.prototype.postExecute=Si("postExecute"),W.prototype.postExecuted=Si("postExecuted"),W.prototype.revert=Si("revert"),W.prototype.reverted=Si("reverted");function Si(e){return function(n,i,r,o,a){(Lt(n)||he(n))&&(a=o,o=r,r=i,i=n,n=null),this.on(n,e,i,r,o,a)}}var il=["top","bottom","left","right"],Es=10;function rl(e,t){W.call(this,e),this.postExecuted(["connection.create","connection.layout","connection.updateWaypoints"],function(r){var o=r.context,a=o.connection,s=a.source,c=a.target,u=o.hints||{};u.createElementsBehavior!==!1&&(n(s),n(c))}),this.postExecuted(["label.create"],function(r){var o=r.context,a=o.shape,s=o.hints||{};s.createElementsBehavior!==!1&&n(a.labelTarget)}),this.postExecuted(["elements.create"],function(r){var o=r.context,a=o.elements,s=o.hints||{};s.createElementsBehavior!==!1&&a.forEach(function(c){n(c)})});function n(r){if(vs(r)&&!Ue(r)){var o=yS(r);o&&i(r,o)}}function i(r,o){var a=fe(r),s=r.label,c=fe(s);if(s.parent){var u=ue(r),l;switch(o){case"top":l={x:a.x,y:u.top-Es-s.height/2};break;case"left":l={x:u.left-Es-s.width/2,y:a.y};break;case"bottom":l={x:a.x,y:u.bottom+Es+s.height/2};break;case"right":l={x:u.right+Es+s.width/2,y:a.y};break}var p=Kn(l,c);t.moveShape(s,p)}}}te(rl,W),rl.$inject=["eventBus","modeling"];function gS(e){var t=e.host,n=fe(e),i=Gt(n,t),r;i.indexOf("-")>=0?r=i.split("-"):r=[i];var o=il.filter(function(a){return r.indexOf(a)===-1});return o}function vS(e){var t=fe(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 zh(t,i)});return n}function yS(e){var t=fe(e.label),n=fe(e),i=zh(n,t);if(_S(i)){var r=vS(e);if(e.host){var o=gS(e);r=r.concat(o)}var a=il.filter(function(s){return r.indexOf(s)===-1});return a.indexOf(i)!==-1?Gt(e.label,e)!=="intersect"?void 0:i:a[0]}}function zh(e,t){return Gt(t,e,5)}function _S(e){return il.indexOf(e)!==-1}function ol(e){W.call(this,e),this.preExecute("shape.append",function(t){var n=t.source,i=t.shape;t.position||(y(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)}te(ol,W),ol.$inject=["eventBus"];var bS=1500;function al(e,t,n){e.invoke(W,this),this.preExecute("elements.delete",bS,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=Re(r,u=>y(u,"bpmn:Participant")||y(u,"bpmn:SubProcess"));if(!o.length)return[];var a=n.getRootElement(),s=new Set(a.children.filter(u=>y(u,"bpmn:Artifact"))),c=new Set;return M(o,u=>{const l=new Set(Vr(Xr(Array.from(s),bt(u))));c=c.union(l),s=s.difference(l)}),Array.from(c)}}te(al,W),al.$inject=["injector","eventBus","canvas"];function sl(e,t){e.invoke(W,this),this.postExecute("shape.move",function(n){var i=n.newParent,r=n.shape,o=Re(r.incoming.concat(r.outgoing),function(a){return y(a,"bpmn:Association")});M(o,function(a){t.moveConnection(a,{x:0,y:0},i)})},!0)}te(sl,W),sl.$inject=["injector","modeling"];function io(e,t){for(hn(t)&&(t=[t]);e=e.parent;)if(Ee(e,t))return e;return null}function Vh(e,t){var n=io(e,"bpmn:Process");if(n)return!0;var i=["bpmn:Participant","bpmn:Lane"];if(n=io(e,i),n)return Bt(n);if(Ee(e,i))return Bt(e);var r;for(r=q(e);r&&!y(r,"bpmn:Process");r=r.$parent);if(!t)return!0;var o=t.find(function(a){var s=q(a);return s&&s.get("processRef")===r});return o?Bt(o):!0}var Gh=500;function ws(e,t){t.invoke(W,this),this._bpmnReplace=e;var n=this;this.postExecuted("elements.create",Gh,function(i){var r=i.elements;r=r.filter(function(o){var a=o.host;return Wh(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",Gh,function(i){var r=i.shapes,o=i.newHost;if(r.length===1){var a=r[0];Wh(a,o)&&(i.shapes=[n._replaceShape(a,o)])}},!0)}ws.$inject=["bpmnReplace","injector"],te(ws,W),ws.prototype._replaceShape=function(e,t){var n=xS(e),i={type:"bpmn:BoundaryEvent",host:t};return n&&(i.eventDefinitionType=n.$type),this._bpmnReplace.replaceElement(e,i,{layoutConnection:!1})};function xS(e){var t=q(e),n=t.eventDefinitions;return n&&n[0]}function Wh(e,t){return!xe(e)&&Ee(e,["bpmn:IntermediateThrowEvent","bpmn:IntermediateCatchEvent"])&&!!t}function cl(e,t){W.call(this,e);function n(i){return Re(i.attachers,function(r){return y(r,"bpmn:BoundaryEvent")})}this.postExecute("connection.create",function(i){var r=i.context.source,o=i.context.target,a=n(o);y(r,"bpmn:EventBasedGateway")&&y(o,"bpmn:ReceiveTask")&&a.length>0&&t.removeElements(a)}),this.postExecute("connection.reconnect",function(i){var r=i.context.oldSource,o=i.context.newSource;y(r,"bpmn:Gateway")&&y(o,"bpmn:EventBasedGateway")&&M(o.outgoing,function(a){var s=a.target,c=n(s);y(s,"bpmn:ReceiveTask")&&c.length>0&&t.removeElements(c)})})}cl.$inject=["eventBus","modeling"],te(cl,W);function Uh(e){return e.create("bpmn:Category")}function ES(e){return e.create("bpmn:CategoryValue")}function qh(e,t){var n=t.get("categoryValueRef");return n||(n=t.categoryValueRef=ES(e)),n.$parent||(n.$parent=Uh(e)),n}function wS(e,t,n){return gt(t.get("categoryValue"),e),e.$parent=t,gt(n.get("rootElements"),t),t.$parent=n,e}function SS(e){var t=e.$parent;return t&&(pt(t.get("categoryValue"),e),e.$parent=null),e}function RS(e){var t=e.$parent;return t&&(pt(t.get("rootElements"),e),e.$parent=null),e}var CS=500;function ul(e,t,n){n.invoke(W,this);function i(c){return t.filter(function(u){return y(u,"bpmn:Group")&&!u.labelTarget}).map(q).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&&wS(c,u,e.getDefinitions())}function s(c,u,l){u&&!o(u,l)&&RS(u),c&&!r(c,l)&&SS(c)}this.executed(["shape.create","label.create"],function(c){var u=c.labelTarget||c.shape;!y(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;!y(u,"bpmn:Group")||u.labelTarget||s(c.categoryValue,c.category,q(u))},!0),this.executed(["shape.move","shape.resize"],CS,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,q(u))},!0),this.executed("group.updateRefs",function(c){Yh(c).forEach(function(u){a(u.categoryValue,u.category)})},!0),this.reverted("group.updateRefs",function(c){Yh(c).forEach(function(u){s(u.categoryValue,u.category,q(u.groupShape))})},!0),this.executed("shape.delete",function(c){var u=c.shape;!y(u,"bpmn:Group")||u.labelTarget||s(c.categoryValue,c.category,q(u))},!0),this.reverted("shape.delete",function(c){var u=c.shape;!y(u,"bpmn:Group")||u.labelTarget||a(c.categoryValue,c.category)},!0)}ul.$inject=["bpmnjs","elementRegistry","injector"],te(ul,W);function Yh(e){var t;return((t=e.updates)==null?void 0:t.groups)||[]}function ll(e,t,n){W.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 S=g.source,E=g.target;ro(S)&&Ko(E)&&l(E)}function r(g){const S=g.connection,E=g.source,b=g.target;ro(E)&&Ss(b)&&(u(b),f(E,[S]))}function o(g){const S=g.newTarget,E=g.oldSource,b=g.oldTarget;if(b!==S){const x=E;Ko(b)&&l(b),ro(x)&&Ss(S)&&u(S)}}function a(g){const{element:S}=g;Ko(S)?(p(S),d(S)):Ss(S)&&h(S)}function s(g){const{newData:S,oldShape:E}=g;if(ro(g.oldShape)&&S.eventDefinitionType!=="bpmn:CompensateEventDefinition"||S.type!=="bpmn:BoundaryEvent"){const b=E.outgoing.find(({target:x})=>Ko(x));b&&b.target&&(g._connectionTarget=b.target)}else if(!ro(g.oldShape)&&S.eventDefinitionType==="bpmn:CompensateEventDefinition"&&S.type==="bpmn:BoundaryEvent"){const b=E.outgoing.find(({target:x})=>Ss(x));b&&b.target&&(g._connectionTarget=b.target),m(E)}}function c(g){const{_connectionTarget:S,newShape:E}=g;S&&t.connect(E,S)}function u(g){t.updateProperties(g,{isForCompensation:!0})}function l(g){t.updateProperties(g,{isForCompensation:void 0})}function p(g){for(const S of g.incoming)n.canConnect(S.source,g)||t.removeConnection(S);for(const S of g.outgoing)n.canConnect(g,S.target)||t.removeConnection(S)}function f(g,S){g.outgoing.filter(x=>y(x,"bpmn:Association")).filter(x=>Ko(x.target)&&!S.includes(x)).forEach(x=>t.removeConnection(x))}function d(g){const S=g.attachers.slice();S.length&&t.removeElements(S)}function h(g){const S=g.incoming.filter(E=>ro(E.source));t.removeElements(S)}function m(g){const S=g.outgoing.filter(E=>y(E,"bpmn:SequenceFlow"));t.removeElements(S)}}te(ll,W),ll.$inject=["eventBus","modeling","bpmnRules"];function Ko(e){const t=q(e);return t&&t.get("isForCompensation")}function ro(e){return e&&y(e,"bpmn:BoundaryEvent")&&eo(e,"bpmn:CompensateEventDefinition")}function Ss(e){return e&&y(e,"bpmn:Activity")&&!en(e)}function pl(e){e.invoke(W,this),this.preExecute("shape.create",1500,function(t){var n=t.context,i=n.parent,r=n.shape;y(i,"bpmn:Lane")&&!y(r,"bpmn:Lane")&&(n.parent=io(i,"bpmn:Participant"))})}pl.$inject=["injector"],te(pl,W);function fl(e,t){W.call(this,e),this.preExecute("shape.create",function(n){var a;var i=n.context,r=i.shape;if(y(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}})}fl.$inject=["eventBus","bpmnFactory"],te(fl,W);var dl=20,hl=20,Kh=30,Rs=2e3;function ml(e,t,n){W.call(this,t),t.on(["create.start","shape.move.start"],Rs,function(r){var o=r.context,a=o.shape,s=e.getRootElement();if(!(!y(a,"bpmn:Participant")||!y(s,"bpmn:Process")||!s.children.length)){var c=s.children.filter(function(p){return!y(p,"bpmn:Group")&&!xe(p)&&!Ue(p)});if(c.length){var u=bt(c),l=PS(a,u);D(a,l),o.createConstraints=AS(a,u)}}}),t.on("create.start",Rs,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}y(a,"bpmn:Participant")&&y(s,"bpmn:Process")&&(t.on("element.hover",Rs,u),t.once("create.cleanup",function(){t.off("element.hover",u)}))});function i(){var r=e.getRootElement();return y(r,"bpmn:Collaboration")?r:n.makeCollaboration()}this.preExecute("elements.create",Rs,function(r){var o=r.elements,a=r.parent,s=TS(o),c;s&&y(a,"bpmn:Process")&&(r.parent=i(),c=r.hints=r.hints||{},c.participant=s,c.process=a,c.processRef=q(s).get("processRef"))},!0),this.preExecute("shape.create",function(r){var o=r.parent,a=r.shape;y(a,"bpmn:Participant")&&y(o,"bpmn:Process")&&(r.parent=i(),r.process=o,r.processRef=q(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)&&q(s).set("processRef",q(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)&&q(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)}ml.$inject=["canvas","eventBus","modeling"],te(ml,W);function PS(e,t){t={width:t.width+dl*2+Kh,height:t.height+hl*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 AS(e,t){return t=ue(t),{bottom:t.top+e.height/2-hl,left:t.right-e.width/2+dl,top:t.bottom-e.height/2+hl,right:t.left+e.width/2-dl-Kh}}function TS(e){return Ke(e,function(t){return y(t,"bpmn:Participant")})}var Xh="__targetRef_placeholder";function gl(e,t){W.call(this,e),this.executed(["connection.create","connection.delete","connection.move","connection.reconnect"],Zh(o)),this.reverted(["connection.create","connection.delete","connection.move","connection.reconnect"],Zh(o));function n(a,s,c){var u=a.get("dataInputAssociations");return Ke(u,function(l){return l!==c&&l.targetRef===s})}function i(a,s){var c=a.get("properties"),u=Ke(c,function(l){return l.name===Xh});return!u&&s&&(u=t.create("bpmn:Property",{name:Xh}),gt(c,u)),u}function r(a,s){var c=i(a);c&&(n(a,c,s)||pt(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,S;m&&m!==p&&r(m,u),d&&d!==p&&r(d,u),p?(S=i(p,!0),g.targetRef=S):g.targetRef=null}}gl.$inject=["eventBus","bpmnFactory"],te(gl,W);function Zh(e){return function(t){var n=t.context,i=n.connection;if(y(i,"bpmn:DataInputAssociation"))return e(t)}}function Cs(e){this._bpmnUpdater=e}Cs.$inject=["bpmnUpdater"],Cs.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),[]},Cs.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 vl(e,t,n,i){W.call(this,i),t.registerHandler("dataStore.updateContainment",Cs);function r(){return n.filter(function(s){return y(s,"bpmn:Participant")&&q(s).processRef})[0]}function o(s){return s.children.filter(function(c){return y(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:ke(s),newSemanticParent:l.processRef||l,newDiParent:ke(c)})}}this.preExecute("shape.create",function(s){var c=s.context,u=c.shape;y(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 y(p,"bpmn:DataStoreReference")});l.length&&(c.hints||(c.hints={}),c.hints.autoResize=u.filter(function(p){return!y(p,"bpmn:DataStoreReference")}))}),this.postExecute("shape.create",function(s){var c=s.context,u=c.shape,l=u.parent;y(u,"bpmn:DataStoreReference")&&u.type!=="label"&&y(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(!y(l,"bpmn:Collaboration")&&y(u,"bpmn:DataStoreReference")&&u.type!=="label"&&y(p,"bpmn:Collaboration")){var f=y(l,"bpmn:Participant")?l:kS(l,"bpmn:Participant");a(u,f)}}),this.postExecute("shape.delete",function(s){var c=s.context,u=c.shape,l=e.getRootElement();Ee(u,["bpmn:Participant","bpmn:SubProcess"])&&y(l,"bpmn:Collaboration")&&o(l).filter(function(p){return MS(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){y(l,"bpmn:Process")&&a(f,l)})})}vl.$inject=["canvas","commandStack","elementRegistry","eventBus"],te(vl,W);function MS(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 kS(e,t){for(;e.parent;){if(y(e.parent,t))return e.parent;e=e.parent}}var Ps=Math.max,As=Math.min,DS=20;function Qh(e,t){return{top:e.top-t.top,right:e.right-t.right,bottom:e.bottom-t.bottom,left:e.left-t.left}}function OS(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 IS(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 Ts(e,t,n){var i=t[e],r=n.min&&n.min[e],o=n.max&&n.max[e];return he(r)&&(i=(/top|left/.test(e)?As:Ps)(i,r)),he(o)&&(i=(/top|left/.test(e)?Ps:As)(i,o)),i}function LS(e,t){if(!t)return e;var n=ue(e);return ps({top:Ts("top",n,t),right:Ts("right",n,t),bottom:Ts("bottom",n,t),left:Ts("left",n,t)})}function NS(e,t,n,i){var r=ue(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?ue(i):o,s={top:As(o.top,a.top),left:As(o.left,a.left),bottom:Ps(o.bottom,a.bottom),right:Ps(o.right,a.right)};return ps(s)}function Xo(e,t){return typeof e<"u"?e:DS}function BS(e,t){var n,i,r,o;return typeof t=="object"?(n=Xo(t.left),i=Xo(t.right),r=Xo(t.top),o=Xo(t.bottom)):n=i=r=o=Xo(t),{x:e.x-n,y:e.y-r,width:e.width+n+i,height:e.height+r+o}}function $S(e){return!(e.waypoints||e.type==="label")}function Jh(e,t){var n;if(e.length===void 0?n=Re(e.children,$S):n=e,n.length)return BS(bt(n),t)}var Xi=Math.abs;function jS(e,t){return Qh(ue(t),ue(e))}var FS=["bpmn:Participant","bpmn:Process","bpmn:SubProcess"],Nn=30;function Ms(e,t){return t=t||[],e.children.filter(function(n){y(n,"bpmn:Lane")&&(Ms(n,t),t.push(n))}),t}function Zi(e){return e.children.filter(function(t){return y(t,"bpmn:Lane")})}function Bn(e){return io(e,FS)||e}function HS(e,t){var n=Bn(e),i=y(n,"bpmn:Process")?[]:[n],r=Ms(n,i),o=ue(e),a=ue(t),s=jS(e,t),c=[],u=Bt(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=ue(l);s.top&&(Xi(m.bottom-o.top)<10&&(d=a.top-m.bottom),Xi(m.top-o.top)<5&&(p=a.top-m.top)),s.left&&(Xi(m.right-o.left)<10&&(f=a.left-m.right),Xi(m.left-o.left)<5&&(h=a.left-m.left)),s.bottom&&(Xi(m.top-o.bottom)<10&&(p=a.bottom-m.top),Xi(m.bottom-o.bottom)<5&&(d=a.bottom-m.bottom)),s.right&&(Xi(m.left-o.right)<10&&(h=a.right-m.left),Xi(m.right-o.right)<5&&(f=a.right-m.right)),(p||f||d||h)&&c.push({shape:l,newBounds:IS(l,{top:p,right:f,bottom:d,left:h})})}}),c}var zS=500;function yl(e,t){W.call(this,e);function n(i,r){var o=Bt(i),a=Zi(r),s=[],c=[],u=[],l=[];if(Rr(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",zS,function(i){var r=i.context,o=r.hints,a=r.shape,s=r.oldParent;y(a,"bpmn:Lane")&&(o&&o.nested||n(a,s))})}yl.$inject=["eventBus","spaceTool"],te(yl,W);var em=500;function ks(e,t){t.invoke(W,this),this._bpmnReplace=e;var n=this;this.postExecuted("elements.create",em,function(i){var r=i.elements;r.filter(function(o){var a=o.host;return tm(o,a)}).map(function(o){return r.indexOf(o)}).forEach(function(o){i.elements[o]=n._replaceShape(r[o])})},!0),this.preExecute("elements.move",em,function(i){var r=i.shapes,o=i.newHost;r.forEach(function(a,s){var c=a.host;tm(a,GS(r,c)?c:o)&&(r[s]=n._replaceShape(a))})},!0)}ks.$inject=["bpmnReplace","injector"],te(ks,W),ks.prototype._replaceShape=function(e){var t=VS(e),n;return t?n={type:"bpmn:IntermediateCatchEvent",eventDefinitionType:t.$type}:n={type:"bpmn:IntermediateThrowEvent"},this._bpmnReplace.replaceElement(e,n,{layoutConnection:!1})};function VS(e){var t=q(e),n=t.eventDefinitions;return n&&n[0]}function tm(e,t){return!xe(e)&&y(e,"bpmn:BoundaryEvent")&&!t}function GS(e,t){return e.indexOf(t)!==-1}var Ds=Math.round,WS=Math.max;function US(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 qS(e){var t=[];return e.forEach(function(n,i){t.push([i===0?"M":"L",n.x,n.y])}),t}var nm=10;function YS(e,t){var n,i;for(n=0;i=e[n];n++)if(Fo(i,t)<=nm)return{point:e[n],bendpoint:!0,index:n};return null}function KS(e,t){var n=sh(US(t,nm),qS(e)),i=n[0],r=n[n.length-1],o;return i?i!==r?i.segment2!==r.segment2?(o=WS(i.segment2,r.segment2)-1,{point:e[o],bendpoint:!0,index:o}):{point:{x:Ds(i.x+r.x)/2,y:Ds(i.y+r.y)/2},index:i.segment2}:{point:{x:Ds(i.x),y:Ds(i.y)},index:i.segment2}:null}function _l(e,t){return YS(e,t)||KS(e,t)}function bl(e,t,n){W.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(),S;he(a.width)?S=fe(a):S=a;var E=_l(s,S);if(E){if(c=s.slice(0,E.index),u=s.slice(E.index+(E.bendpoint?1:0)),!c.length||!u.length)return;l=E.bendpoint?s[E.index]:S,(c.length===1||!im(r,c[c.length-1]))&&c.push(rm(l)),(u.length===1||!im(r,u[0]))&&u.unshift(rm(l))}p=o.source,f=o.target,t.canConnect(p,r,o)&&(n.reconnectEnd(o,r,c||S),d=o),t.canConnect(r,f,o)&&(d?h=n.connect(r,f,{type:o.type,waypoints:u}):(n.reconnectStart(o,r,u||S),h=o));var b=[].concat(d&&Re(g,function(x){return x.source===d.source})||[],h&&Re(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=fe(c),l={x:u.x+s.x,y:u.y+s.y},p=Ke(o.children,function(f){var d=t.canInsert(a,f);return d&&_l(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)}te(bl,W),bl.$inject=["eventBus","bpmnRules","modeling"];function im(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 rm(e){return D({},e)}function xl(e,t){W.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)&&oo(r)){var c=[];y(o,"bpmn:EventBasedGateway")?c=a.incoming.filter(u=>u!==r&&oo(u)):c=a.incoming.filter(u=>u!==r&&oo(u)&&y(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(y(r,"bpmn:EventBasedGateway")){var o=r.outgoing.filter(oo).reduce(function(a,s){return a.includes(s.target)?a:a.concat(s.target)},[]);o.forEach(function(a){a.incoming.filter(oo).forEach(function(s){const c=a.incoming.filter(oo).filter(function(u){return u.source===r});(s.source!==r||c.length>1)&&t.removeConnection(s)})})}})}xl.$inject=["eventBus","modeling"],te(xl,W);function oo(e){return y(e,"bpmn:SequenceFlow")}var Os=1500,om=2e3;function am(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"],Os,function(i){var r=i.context,o=r.shape||i.shape,a=i.hover;y(a,"bpmn:Lane")&&!Ee(o,["bpmn:Lane","bpmn:Participant"])&&(i.hover=Bn(a),i.hoverGfx=e.getGraphics(i.hover));var s=n.getRootElement();a&&a!==s&&(o.labelTarget||Ee(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"],Os,function(i){var r=i.hover;y(r,"bpmn:Lane")&&(i.hover=Bn(r)||r,i.hoverGfx=e.getGraphics(i.hover))}),t.on(["bendpoint.move.hover"],Os,function(i){var r=i.context,o=i.hover,a=r.type;y(o,"bpmn:Lane")&&/reconnect/.test(a)&&(i.hover=Bn(o)||o,i.hoverGfx=e.getGraphics(i.hover))}),t.on(["connect.start"],Os,function(i){var r=i.context,o=r.start;y(o,"bpmn:Lane")&&(r.start=Bn(o)||o)}),t.on("shape.move.start",om,function(i){var r=i.shape;y(r,"bpmn:Lane")&&(i.shape=Bn(r)||r)}),t.on("spaceTool.move",om,function(i){var r=i.hover;r&&y(r,"bpmn:Lane")&&(i.hover=Bn(r))})}am.$inject=["elementRegistry","eventBus","canvas"];var sm=770;function El(e,t,n,i){n.invoke(W,this);function r(s,c){var u=q(s),l=c.categoryValue||u.categoryValueRef;l||(l=qh(e,u));var p=c.category||l.$parent||Uh(e);u.categoryValueRef=l,l.$parent=p,c.categoryValue=l,c.category=p}function o(s,c){var u=q(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;y(u,"bpmn:Group")&&r(u,c)}),this.revert("label.create",function(s){var c=s.context,u=c.labelTarget;y(u,"bpmn:Group")&&o(u,c)}),this.execute("shape.delete",function(s){var c=s.context,u=c.shape,l=q(u);if(!(!y(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(!(!y(u,"bpmn:Group")||u.labelTarget)){var l=c.category,p=c.categoryValue,f=q(u);p&&(f.categoryValueRef=p,p.$parent=l)}}),this.execute("shape.create",function(s){var c=s.context,u=c.shape,l=c.hints||{};!y(u,"bpmn:Group")||u.labelTarget||l.createElementsBehavior===!1&&!q(u).categoryValueRef&&!c.categoryValue||r(u,c)}),this.reverted("shape.create",function(s){var c=s.context,u=c.shape,l=c.hints||{};!y(u,"bpmn:Group")||u.labelTarget||l.createElementsBehavior===!1&&!q(u).categoryValueRef&&!c.categoryValue||o(u,c)}),this.executed(["shape.move","shape.resize"],function(s){var c=s.context,u=c.shape;!y(u,"bpmn:Group")||u.labelTarget||q(u).categoryValueRef||r(u,c)}),this.reverted(["shape.move","shape.resize"],function(s){var c=s.context,u=c.shape;!y(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",sm,function(s){var c=s.descriptor,u=s.element;if(!(!y(u,"bpmn:Group")||u.labelTarget)){var l=q(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",sm,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})}El.$inject=["bpmnFactory","eventBus","injector","moddleCopy"],te(El,W);function wl(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 cm(e){function t(i,r,o){var a={x:o.x,y:o.y-50},s={x:o.x-50,y:o.y},c=wl(i,r,o,a),u=wl(i,r,o,s),l;c&&u?um(c,o)>um(u,o)?l=u:l=c:l=c||u,i.original=l}function n(i){var r=i.waypoints;t(r[0],r[1],fe(i.source)),t(r[r.length-1],r[r.length-2],fe(i.target))}e.on("bpmnElement.added",function(i){var r=i.element;r.waypoints&&n(r)})}cm.$inject=["eventBus"];function um(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function Sl(e){W.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=q(i),o=ke(i);if(Ee(r,t)){var a=o.get("isHorizontal");a===void 0&&(a=!0),o.set("isHorizontal",a)}})}Sl.$inject=["eventBus"],te(Sl,W);function lm(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}function pm(e){return Math.atan((e[1].y-e[0].y)/(e[1].x-e[0].x))}function XS(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 ZS(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 Rl(e,t){var n=t[0],i=t[1],r={x:i.x-n.x,y:i.y-n.y},o=ZS([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 fm(e,t){var n=Rl(e,t),i={x:n.x-e.x,y:n.y-e.y};return lm(i)}function Zo(e,t){return lm({x:e.x-t.x,y:e.y-t.y})}var dm=Math.sqrt,hm=Math.min,QS=Math.max,mm=Math.abs;function gm(e){return Math.pow(e,2)}function Qo(e,t){return dm(gm(e.x-t.x)+gm(e.y-t.y))}function JS(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],ym(i,r)?u=[i]:(o=Qo(e,i),a=Qo(e,r),c=hm(o,a),u=eR(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:ym(i,u[0])?n:n+1}),u.length===2&&(s=nR(u[0],u[1]),l={type:"segment",position:s,segmentIndex:n,relativeLocation:Qo(i,s)/Qo(i,r)}),p=Qo(l.position,e),(!d||f>p)&&(d=l,f=p)}return d}function eR(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=dm(d),m=-p+h,g=-p-h,S={x:e.x-r*m,y:e.y-o*m};if(d===0)return[S];var E={x:e.x-r*g,y:e.y-o*g};return[S,E].filter(function(b){return tR(b,e,t)})}function tR(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>=hm(t,n)-Is&&e<=QS(t,n)+Is}function nR(e,t){return{x:(e.x+t.x)/2,y:(e.y+t.y)/2}}var Is=.1;function ym(e,t){return mm(e.x-t.x)<=Is&&mm(e.y-t.y)<=Is}function iR(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=bm(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 _m(e,t,n,i){var r=0,o=0,a={point:e,delta:{x:0,y:0}},s=JS(e,n),c=s.segmentIndex,u=iR(n,t,s,i);if(u<0||u>t.length-2||u===null)return a;var l=xm(n,c),p=xm(t,u),f=s.position,d=oR(l,f),h=rR(l,p);if(s.type==="bendpoint"){var m=t.length-n.length,g=s.bendpointIndex,S=n[g];if(t.indexOf(S)!==-1)return a;if(m===0){var E=t[g];return r=E.x-s.position.x,o=E.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=bm(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=XS({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:xi(b),delta:xi({x:r,y:o})}}function bm(e,t){var n=Zo(e[t-1],e[t]),i=Zo(e[t],e[t+1]),r=n/(n+i);return r}function rR(e,t){var n=pm(e),i=pm(t);return i-n}function xm(e,t){return[e[t],e[t+1]]}function oR(e,t){var n=Zo(e[0],e[1]),i=Zo(e[0],t);return n===0?0:i/n}function aR(e,t,n,i){var r=fe(e);return _m(r,t,n,i).delta}function Jo(e,t,n){var i=Yo(t),r=Yo(n),o=Kn(e,i),a={x:o.x*(n.width/t.width),y:o.y*(n.height/t.height)};return xi({x:r.x+a.x,y:r.y+a.y})}function Em(e,t,n){var i=Yo(e),r=Yo(t),o=Yo(n),a=Kn(e,i),s=Kn(i,r),c=sR(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 xi({x:l.x+a.x-e.x,y:l.y+a.y-e.y})}function sR(e,t,n){var i=ue(t),r=ue(n);if(cR(i,r))return null;var o=Gt(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=Gt(n,s),c!==o?null:a}function cR(e,t){return uR(e,t)||lR(e,t)}function uR(e,t){return e.right!==t.right&&e.left!==t.left}function lR(e,t){return e.top!==t.top&&e.bottom!==t.bottom}var wm="name",Sm="text";function Cl(e,t,n,i){W.call(this,e),this.postExecute("element.updateProperties",r),this.postExecute("element.updateModdleProperties",a=>{q(a.context.element)===a.context.moddleElement&&r(a)});function r(a){var s=a.context,c=s.element,u=s.properties;if(wm in u&&t.updateLabel(c,u[wm]),Sm in u&&y(c,"bpmn:TextAnnotation")){var l=i.getTextAnnotationBounds({x:c.x,y:c.y,width:c.width,height:c.height},u[Sm]||"");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;xe(u)||!Ki(u)||Mn(u)&&t.updateLabel(u,Mn(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=D({},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),aR(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=q(c);l&&Ki(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(!(!xe(c)||u.autoResize)){var l=s.newBounds,p=i.getDimensions(Mn(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(vs(c)){var p=c.label,f=fe(p),d=dR(l),h=fR(f,d),m=pR(h,l,u);t.moveShape(p,m)}})}te(Cl,W),Cl.$inject=["eventBus","modeling","bpmnFactory","textRenderer"];function pR(e,t,n){var i=Jo(e,t,n);return xi(Kn(i,e))}function fR(e,t){if(t.length){var n=hR(e,t);return Rl(e,n)}}function dR(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 hR(e,t){var n=t.map(function(r){return{line:r,distance:fm(e,r)}}),i=Jn(n,"distance");return i[0].line}function mR(e,t,n,i){return _m(e,t,n,i).point}function Pl(e,t){W.call(this,e);function n(i,r){var o=i.context,a=o.connection,s=D({},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),mR(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)})})}te(Pl,W),Pl.$inject=["eventBus","modeling"];function Ls(e,t,n){var i=Bs(e),r=Cm(i,t),o=i[0];return r.length?r[r.length-1]:Jo(o.original||o,n,t)}function Ns(e,t,n){var i=Bs(e),r=Cm(i,t),o=i[i.length-1];return r.length?r[0]:Jo(o.original||o,n,t)}function Al(e,t,n){var i=Bs(e),r=Rm(t,n),o=i[0];return Jo(o.original||o,r,t)}function Tl(e,t,n){var i=Bs(e),r=Rm(t,n),o=i[i.length-1];return Jo(o.original||o,r,t)}function Rm(e,t){return{x:e.x-t.x,y:e.y-t.y,width:e.width,height:e.height}}function Bs(e){var t=e.waypoints;if(!t.length)throw new Error("connection#"+e.id+": no waypoints");return t}function Cm(e,t){var n=Kt(e,vR);return Re(n,function(i){return gR(i,t)})}function gR(e,t){return Gt(t,e,1)==="intersect"}function vR(e){return e.original||e}function Ml(e,t){W.call(this,e),this.postExecute("shape.replace",function(n){var i=n.oldShape,r=n.newShape;if(yR(i,r)){var o=_R(i);o.incoming.forEach(function(a){var s=Ns(a,r,i);t.reconnectEnd(a,r,s)}),o.outgoing.forEach(function(a){var s=Ls(a,r,i);t.reconnectStart(a,r,s)})}},!0)}Ml.$inject=["eventBus","modeling"],te(Ml,W);function yR(e,t){return y(e,"bpmn:Participant")&&Pe(e)&&y(t,"bpmn:Participant")&&!Pe(t)}function _R(e){var t=$o([e]),n=[],i=[];return t.forEach(function(r){r!==e&&(r.incoming.forEach(function(o){y(o,"bpmn:MessageFlow")&&n.push(o)}),r.outgoing.forEach(function(o){y(o,"bpmn:MessageFlow")&&i.push(o)}))},[]),{incoming:n,outgoing:i}}const bR=["bpmn:MessageEventDefinition","bpmn:TimerEventDefinition","bpmn:EscalationEventDefinition","bpmn:ConditionalEventDefinition","bpmn:SignalEventDefinition"];function Pm(e){const t=q(e);if(!y(t,"bpmn:BoundaryEvent")&&!(y(t,"bpmn:StartEvent")&&en(t.$parent)))return!1;const n=t.get("eventDefinitions");return!n||!n.length?!1:bR.some(i=>y(n[0],i))}function Am(e){return y(e,"bpmn:BoundaryEvent")?"cancelActivity":"isInterrupting"}function kl(e,t){e.invoke(W,this),this.postExecuted("shape.replace",function(n){const i=n.context.oldShape,r=n.context.newShape,o=n.context.hints;if(!Pm(r))return;const a=Am(r);if(o.targetElement&&o.targetElement[a]!==void 0)return;const c=q(i).get(a),u=q(r).get(a);c!==u&&t.updateProperties(r,{[a]:c})})}kl.$inject=["injector","modeling"],te(kl,W);function Dl(e,t){W.call(this,e),this.preExecute("shape.resize",function(n){var i=n.shape,r=ke(i),o=r&&r.get("label"),a=o&&o.get("bounds");a&&t.updateModdleProperties(i,o,{bounds:void 0})},!0)}te(Dl,W),Dl.$inject=["eventBus","modeling"];function Ol(e,t,n){W.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(!(!y(o,"bpmn:SequenceFlow")||!y(a,"bpmn:SequenceFlow"))&&t.canConnect(o.source,a.target,o)){var s=xR(o.waypoints,a.waypoints);n.reconnectEnd(o,a.target,s)}}})}te(Ol,W),Ol.$inject=["eventBus","bpmnRules","modeling"];function ao(e){return e.original||e}function xR(e,t){var n=wl(ao(e[e.length-2]),ao(e[e.length-1]),ao(t[1]),ao(t[0]));return n?[].concat(e.slice(0,e.length-1),[n],t.slice(1)):[ao(e[0]),ao(t[t.length-1])]}function Il(e,t){W.call(this,e),this.preExecute("shape.delete",function(n){var i=n.shape,r=i.parent;y(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)}Il.$inject=["eventBus","modeling"],te(Il,W);function Ll(e,t,n,i){W.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;y(c,"bpmn:SequenceFlow")&&(n.canConnectSequenceFlow(u,l)||(d=!0),n.canConnectMessageFlow(u,l)&&(f="bpmn:MessageFlow")),y(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=Ke(p.outgoing,Wr({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})})}te(Ll,W),Ll.$inject=["eventBus","modeling","bpmnRules","injector"];function $s(e,t,n,i,r,o){i.invoke(W,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=gn(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){en(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})})}te($s,W),$s.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)},$s.$inject=["bpmnReplace","bpmnRules","elementRegistry","injector","modeling","selection"];var ER=1500,wR={width:140,height:120},Nl={width:300,height:60},Bl={width:60,height:300},js={width:300,height:150},Fs={width:150,height:300},Tm={width:140,height:120},Mm={width:100,height:40};function km(e){e.on("resize.start",ER,function(t){var n=t.context,i=n.shape,r=n.direction,o=n.balanced;(y(i,"bpmn:Lane")||y(i,"bpmn:Participant"))&&(n.resizeConstraints=AR(i,r,o)),y(i,"bpmn:SubProcess")&&Pe(i)&&(n.minDimensions=Tm),y(i,"bpmn:TextAnnotation")&&(n.minDimensions=Mm)})}km.$inject=["eventBus"];var Qi=Math.abs,SR=Math.min,RR=Math.max;function Dm(e,t,n,i){var r=e[t];e[t]=r===void 0?n:i(n,r)}function so(e,t,n){return Dm(e,t,n,SR)}function co(e,t,n){return Dm(e,t,n,RR)}var CR={top:20,left:50,right:20,bottom:20},PR={top:50,left:20,right:20,bottom:20};function AR(e,t,n){var i=Bn(e),r=!0,o=!0,a=Ms(i,[i]),s=ue(e),c={},u={},l=Bt(e),p=l?Nl:Bl;/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=ue(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&&Qi(s.top-m.bottom)<10&&co(c,"top",m.top+p.height),Qi(s.top-m.top)<5&&so(u,"top",m.bottom-p.height)),/e/.test(t)&&(n&&Qi(s.right-m.left)<10&&so(c,"right",m.right-p.width),Qi(s.right-m.right)<5&&co(u,"right",m.left+p.width)),/s/.test(t)&&(n&&Qi(s.bottom-m.top)<10&&so(c,"bottom",m.bottom-p.height),Qi(s.bottom-m.bottom)<5&&co(u,"bottom",m.top+p.height)),/w/.test(t)&&(n&&Qi(s.left-m.right)<10&&co(c,"left",m.left+p.width),Qi(s.left-m.left)<5&&so(u,"left",m.right-p.width))});var f=i.children.filter(function(h){return!h.hidden&&!h.waypoints&&(y(h,"bpmn:FlowElement")||y(h,"bpmn:Artifact"))}),d=l?CR:PR;return f.forEach(function(h){var m=ue(h);/n/.test(t)&&(!l||r)&&so(u,"top",m.top-d.top),/e/.test(t)&&(l||o)&&co(u,"right",m.right+d.right),/s/.test(t)&&(!l||o)&&co(u,"bottom",m.bottom+d.bottom),/w/.test(t)&&(l||r)&&so(u,"left",m.left-d.left)}),{min:u,max:c}}function Om(e){!e||typeof e.stopPropagation!="function"||e.stopPropagation()}function uo(e){return e.originalEvent||e.srcEvent}function $l(e){Om(e),Om(uo(e))}function Tr(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 Im(){return/mac/i.test(navigator.platform)}function Lm(e,t){return(uo(e)||e).button===t}function Ji(e){return Lm(e,0)}function TR(e){return Lm(e,1)}function ea(e){var t=uo(e)||e;return Ji(e)?Im()?t.metaKey:t.ctrlKey:!1}function Hs(e){var t=uo(e)||e;return Ji(e)&&t.shiftKey}var Nm=1001;function Bm(e,t){e.on("resize.start",Nm+500,function(n){var i=n.context,r=i.shape;(y(r,"bpmn:Lane")||y(r,"bpmn:Participant"))&&(i.balanced=!ea(n))}),e.on("resize.end",Nm,function(n){var i=n.context,r=i.shape,o=i.canExecute,a=i.newBounds;if(y(r,"bpmn:Lane")||y(r,"bpmn:Participant"))return o&&(a=fh(a),t.resizeLane(r,a,i.balanced)),!1})}Bm.$inject=["eventBus","modeling"];var MR=500;function jl(e,t,n,i,r){n.invoke(W,this);function o(l){return Ee(l,["bpmn:ReceiveTask","bpmn:SendTask"])||kR(l,["bpmn:ErrorEventDefinition","bpmn:EscalationEventDefinition","bpmn:MessageEventDefinition","bpmn:SignalEventDefinition"])}function a(l){var p=e.getDefinitions(),f=p.get("rootElements");return!!Ke(f,Wr({id:l.id}))}function s(l){if(y(l,"bpmn:ErrorEventDefinition"))return"errorRef";if(y(l,"bpmn:EscalationEventDefinition"))return"escalationRef";if(y(l,"bpmn:MessageEventDefinition"))return"messageRef";if(y(l,"bpmn:SignalEventDefinition"))return"signalRef"}function c(l){if(Ee(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(Ee(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=q(p),d=c(f),h;d&&!a(d)&&(h=e.getDefinitions().get("rootElements"),gt(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");pt(f,p)}},!0),t.on("copyPaste.copyElement",function(l){var p=l.descriptor,f=l.element;if(!(f.labelTarget||!o(f))){var d=q(f),h=c(d);h&&(p.referencedRootElement=h)}}),t.on("copyPaste.pasteElement",MR,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)})}jl.$inject=["bpmnjs","eventBus","injector","moddleCopy","bpmnFactory"],te(jl,W);function kR(e,t){return pe(t)||(t=[t]),Li(t,function(n){return eo(e,n)})}var $m=Math.max;function jm(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;y(a,"bpmn:Participant")&&(o[s]=OR(a,i,r)),y(a,"bpmn:Lane")&&(o[s]=Bt(a)?Nl:Bl),y(a,"bpmn:SubProcess")&&Pe(a)&&(o[s]=Tm),y(a,"bpmn:TextAnnotation")&&(o[s]=Mm),y(a,"bpmn:Group")&&(o[s]=wR)}),o})}jm.$inject=["eventBus"];function DR(e){return e==="x"}function OR(e,t,n){var i=Bt(e);if(!NR(e))return i?js:Fs;var r=DR(t),o={};return r?i?o=js:o={width:LR(e,n,r),height:Fs.height}:i?o={width:js.width,height:IR(e,n,r)}:o=Fs,o}function IR(e,t,n){var i;return i=BR(e,t,n),$m(js.height,i)}function LR(e,t,n){var i;return i=$R(e,t,n),$m(Fs.width,i)}function NR(e){return!!Zi(e).length}function BR(e,t,n){var i=Zi(e),r;return r=Fl(i,t,n),e.height-r.height+Nl.height}function $R(e,t,n){var i=Zi(e),r;return r=Fl(i,t,n),e.width-r.width+Bl.width}function Fl(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=Zi(r),o.length?Fl(o,t,n):r}var Fm="_plane";function Hm(e){var t=e.id;return jR(t)}function ui(e){var t=e.id;return y(e,"bpmn:SubProcess")?zm(t):t}function Mr(e){return zm(e)}function zs(e){var t=ke(e);return y(t,"bpmndi:BPMNPlane")}function zm(e){return e+Fm}function jR(e){return e.replace(new RegExp(Fm+"$"),"")}var Vm=400,FR=600,Gm={x:180,y:160};function Ri(e,t,n,i,r,o,a){W.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 y(p,"bpmn:SubProcess")&&!Pe(p)}function u(p){var f=p.shape,d=p.newRootElement,h=q(f);d=s._addDiagram(d||h),p.newRootElement=e.addRootElement(d)}function l(p){var f=p.shape,d=q(f);s._removeDiagram(d);var h=p.newRootElement=a.get(ui(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(ui(d));if(!(!h||!d.children||!d.children.length)){var m=Wm(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;!y(f,"bpmn:SubProcess")||!Pe(f)||M(Go([f]),d=>{n.removeShape(d.annotation)})},!0),this.preExecuted("shape.delete",function(p){var f=p.shape;if(c(f)){var d=a.get(ui(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(ui(f)))},!0),this.postExecuted("shape.replace",function(p){var f=p.newShape,d=p.oldRoot,h=e.findRoot(ui(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(y(f,"bpmn:SubProcess")){var d=p.properties,h=p.oldProperties,m=h.id,g=d.id;if(m!==g){if(zs(f)){a.updateId(f,Mr(g)),a.updateId(m,g);return}var S=a.get(Mr(m));S&&a.updateId(Mr(m),Mr(g))}}},!0),this.reverted("element.updateProperties",function(p){var f=p.element;if(y(f,"bpmn:SubProcess")){var d=p.properties,h=p.oldProperties,m=h.id,g=d.id;if(m!==g){if(zs(f)){a.updateId(f,Mr(m)),a.updateId(g,m);return}var S=a.get(Mr(g));S&&a.updateId(S,Mr(m))}}},!0),t.on("element.changed",function(p){var f=p.element;if(zs(f)){var d=f,h=a.get(Hm(d));!h||h===d||t.fire("element.changed",{element:h})}}),this.executed("shape.toggleCollapse",Vm,function(p){var f=p.shape;y(f,"bpmn:SubProcess")&&(Pe(f)?l(p):(u(p),s._showRecursively(f.children)))},!0),this.reverted("shape.toggleCollapse",Vm,function(p){var f=p.shape;y(f,"bpmn:SubProcess")&&(Pe(f)?l(p):(u(p),s._showRecursively(f.children)))},!0),this.postExecuted("shape.toggleCollapse",FR,function(p){var f=p.shape;if(y(f,"bpmn:SubProcess")){var d=p.newRootElement;if(d)if(Pe(f))s._moveChildrenToShape(d.children.slice(),f),M(Go(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=Wm(f);s._moveChildrenToShape(h,d)}}},!0),t.on("copyPaste.createTree",function(p){var f=p.element,d=p.children;if(c(f)){var h=ui(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=y(ke(m),"bpmndi:BPMNPlane");if(g){var S=Hm(m),E=Ke(h,function(b){return b.id===S});E&&(f.parent=E.id)}}),t.on("copyPaste.pasteElement",function(p){var f=p.descriptor;f.parent&&(c(f.parent)||f.parent.hidden)&&(f.hidden=!0)})}te(Ri,W),Ri.prototype._moveChildrenToShape=function(e,t){var n=this._modeling;if(e.length){var i=e.filter(function(c){return!c.hidden});if(!i.length){n.moveElements(e,{x:0,y:0},t,{autoResize:!1});return}var r=bt(i),o;if(!t.x)o={x:Gm.x-r.x,y:Gm.y-r.y};else{var a=fe(t),s=fe(r);o={x:a.x-s.x,y:a.y-s.y}}n.moveElements(e,o,t,{autoResize:!1})}},Ri.prototype._disconnectSharedAnnotations=function(e){var t=this._modeling,n=new Set(Lh(e).map(i=>i.annotation));n.size&&M(Go(e.children),i=>{n.has(i.annotation)&&M(i.associations,r=>{t.removeConnection(r)})})},Ri.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},Ri.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},Ri.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:ui(e),type:e.$type,di:i,businessObject:e,collapsed:!0});return o},Ri.prototype._removeDiagram=function(e){var t=this._bpmnjs,n=t.getDefinitions().diagrams,i=Ke(n,function(r){return r.plane.bpmnElement.id===e.id});return n.splice(n.indexOf(i),1),i},Ri.$inject=["canvas","eventBus","modeling","elementFactory","bpmnFactory","bpmnjs","elementRegistry"];function HR(e){var t=[];return M(Go(e),n=>{t.push(n.annotation),t.push.apply(t,n.associations)}),t}function Wm(e){return e.children.slice().concat(HR(e.children)).concat(zR(e))}function zR(e){return Wu(e.children||[]).reduce(function(t,n){return n.label&&n.label.parent!==e&&t.push(n.label),t},[])}function Hl(e,t){e.invoke(W,this),this.postExecuted("shape.replace",function(n){var i=n.context.oldShape,r=n.context.newShape;if(!(!y(r,"bpmn:SubProcess")||y(r,"bpmn:AdHocSubProcess")||!(y(i,"bpmn:Task")||y(i,"bpmn:CallActivity"))||!Pe(r))){var o=VR(r);t.createShape({type:"bpmn:StartEvent"},o,r)}})}Hl.$inject=["injector","modeling"],te(Hl,W);function VR(e){return{x:e.x+e.width/6,y:e.y+e.height/2}}function zl(e,t){W.call(this,e),this.preExecute("connection.create",function(n){const{target:i}=n;y(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&&y(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(!(!y(r,"bpmn:TextAnnotation")||o.autoResize)){var a=i.newBounds,s=t.getTextAnnotationBounds(a,Mn(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}}})}te(zl,W),zl.$inject=["eventBus","textRenderer"];function Vl(e,t){W.call(this,e),this.postExecuted("shape.toggleCollapse",1500,function(n){var i=n.shape;if(Pe(i))return;var r=$o(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||y(a,"bpmn:Association")&&(y(a.source,"bpmn:TextAnnotation")||y(a.target,"bpmn:TextAnnotation"))||(s?t.reconnectEnd(a,i,fe(i)):t.reconnectStart(a,i,fe(i)))}},!0)}te(Vl,W),Vl.$inject=["eventBus","modeling"];var Gl=500;function Wl(e,t,n){W.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=GR(c).concat([a]),p=Jh(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"],Gl,function(a){var s=a.context,c=s.shape;y(c,"bpmn:SubProcess")&&(c.collapsed?ke(c).isExpanded=!1:(i(c.children),ke(c).isExpanded=!0))}),this.reverted(["shape.toggleCollapse"],Gl,function(a){var s=a.context,c=s.shape;c.collapsed?ke(c).isExpanded=!1:ke(c).isExpanded=!0}),this.postExecuted(["shape.toggleCollapse"],Gl,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"})})}te(Wl,W),Wl.$inject=["eventBus","elementFactory","modeling"];function GR(e){return e.filter(function(t){return!t.hidden})}function Ul(e,t,n,i){t.invoke(W,this),this.preExecute("shape.delete",function(r){var o=r.context,a=o.shape,s=a.businessObject;xe(a)||(y(a,"bpmn:Participant")&&Pe(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;y(r,"bpmn:Collaboration")&&n.ids.unclaim(o.id)})}te(Ul,W),Ul.$inject=["canvas","injector","moddle","modeling"];function ql(e,t){W.call(this,e),this.preExecute("connection.delete",function(n){var i=n.context,r=i.connection,o=r.source;WR(r,o)&&t.updateProperties(o,{default:null})})}te(ql,W),ql.$inject=["eventBus","modeling"];function WR(e,t){if(!y(e,"bpmn:SequenceFlow"))return!1;var n=q(t),i=q(e);return n.get("default")===i}var UR=500,qR=5e3,Um=["shape.create","shape.delete","shape.move","shape.resize"],qm=[...Um,"spaceTool","lane.add","lane.resize","lane.split","elements.create","elements.delete","elements.move"];function Yl(e,t){W.call(this,e);var n;function i(){return n=n||new YR,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(qm,qR,function(){i()}),this.postExecuted(qm,UR,function(){o()}),this.preExecute(Um,function(a){var s=a.context,c=s.shape,u=r();!c||c.labelTarget||(y(c,"bpmn:Lane")&&u.addLane(c),y(c,"bpmn:FlowNode")&&u.addFlowNode(c))})}Yl.$inject=["eventBus","modeling"],te(Yl,W);function YR(){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 KR=500,XR=5e3,Ym=["connection.create","connection.delete","connection.layout","connection.move","connection.reconnect","connection.updateWaypoints","shape.create","shape.delete","shape.move","shape.resize"],Km=[...Ym,"elements.create","elements.delete","elements.move","label.create","spaceTool"];function Kl(e,t){W.call(this,e);var n;function i(){return n=n||new ZR,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(Km,XR,function(){i()}),this.postExecuted(Km,KR,function(){o()}),this.preExecute(Ym,function(a){var s=a.context.connection||a.context.shape,c=r();!s||s.labelTarget||(y(s,"bpmn:FlowElement")&&c.addFlowElement(s),y(s,"bpmn:Group")&&c.addGroup(s))}),this.preExecute("label.create",function(a){var s=a.context.labelTarget;y(s,"bpmn:Group")&&r().addGroup(s)})}Kl.$inject=["eventBus","modeling"],te(Kl,W);function ZR(){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 Xl(e,t){W.call(this,e),this.postExecuted("elements.create",function(n){const i=n.context,r=i.elements;for(const o of r)QR(o)&&!eC(o)&&t.updateProperties(o,{isForCompensation:void 0})})}te(Xl,W),Xl.$inject=["eventBus","modeling"];function QR(e){const t=q(e);return t&&t.isForCompensation}function JR(e){return e&&y(e,"bpmn:BoundaryEvent")&&eo(e,"bpmn:CompensateEventDefinition")}function eC(e){return e.incoming.filter(n=>JR(n.source)).length>0}const tC={__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",rl],appendBehavior:["type",ol],associationBehavior:["type",sl],attachEventBehavior:["type",ws],artifactBehavior:["type",al],boundaryEventBehavior:["type",cl],categoryRootElementReferenceBehavior:["type",ul],compensateBoundaryEventBehaviour:["type",ll],createBehavior:["type",pl],createDataObjectBehavior:["type",fl],createParticipantBehavior:["type",ml],dataInputAssociationBehavior:["type",gl],dataStoreBehavior:["type",vl],deleteLaneBehavior:["type",yl],detachEventBehavior:["type",ks],dropOnFlowBehavior:["type",bl],eventBasedGatewayBehavior:["type",xl],fixHoverBehavior:["type",am],groupBehavior:["type",El],importDockingFix:["type",cm],isHorizontalFix:["type",Sl],labelBehavior:["type",Cl],layoutConnectionBehavior:["type",Pl],messageFlowBehavior:["type",Ml],nonInterruptingBehavior:["type",kl],removeElementBehavior:["type",Ol],removeEmbeddedLabelBoundsBehavior:["type",Dl],removeParticipantBehavior:["type",Il],replaceConnectionBehavior:["type",Ll],replaceElementBehaviour:["type",$s],resizeBehavior:["type",km],resizeLaneBehavior:["type",Bm],rootElementReferenceBehavior:["type",jl],spaceToolBehavior:["type",jm],subProcessPlaneBehavior:["type",Ri],subProcessStartEventBehavior:["type",Hl],textAnnotationBehavior:["type",zl],toggleCollapseConnectionBehaviour:["type",Vl],toggleElementCollapseBehaviour:["type",Wl],unclaimIdBehavior:["type",Ul],unsetDefaultFlowBehavior:["type",ql],updateFlowNodeRefsBehavior:["type",Yl],updateCategoryValueRefsBehavior:["type",Kl],setCompensationActivityAfterPasteBehavior:["type",Xl]};function Zl(e){this._commandStack=e.get("commandStack",!1)}Zl.$inject=["injector"],Zl.prototype.allowed=function(e,t){var n=!0,i=this._commandStack;return i&&(n=i.canExecute(e,t)),n===void 0?!0:n};const li={__init__:["rules"],rules:["type",Zl]};function $n(e){W.call(this,e),this.init()}$n.$inject=["eventBus"],te($n,W),$n.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)})},$n.prototype.init=function(){};function Xm(e,t){var n=Gt(e,t,-15);return n!=="intersect"?n:null}function Ut(e){$n.call(this,e)}te(Ut,$n),Ut.$inject=["eventBus"],Ut.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 Gs(t,n)}finally{r&&(n.parent=null)}}),this.addRule("connection.reconnect",function(e){var t=e.connection,n=e.source,i=e.target;return Gs(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 ug(t,n,i)}),this.addRule("elements.create",function(e){var t=e.elements,n=e.position,i=e.target;return Ue(i)&&!Ws(t,i)?!1:yr(t,function(r){return Ue(r)?Gs(r.source,r.target,r):r.host?ta(r,r.host,null,n):tp(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 ig(a)&&!n.includes(a.host)})?!1:ta(n,t,null,i)||sg(n,t,i)||cg(n,t)||Ws(n,t)}),this.addRule("shape.create",function(e){return tp(e.shape,e.target,e.source,e.position)}),this.addRule("shape.attach",function(e){return ta(e.shape,e.target,null,e.position)}),this.addRule("element.copy",function(e){var t=e.element,n=e.elements;return hg(n,t)})},Ut.prototype.canConnectMessageFlow=fg,Ut.prototype.canConnectSequenceFlow=dg,Ut.prototype.canConnectDataAssociation=np,Ut.prototype.canConnectAssociation=lg,Ut.prototype.canConnectCompensationAssociation=pg,Ut.prototype.canMove=cg,Ut.prototype.canAttach=ta,Ut.prototype.canReplace=sg,Ut.prototype.canDrop=lo,Ut.prototype.canInsert=Ws,Ut.prototype.canCreate=tp,Ut.prototype.canConnect=Gs,Ut.prototype.canResize=ug,Ut.prototype.canCopy=hg;function nC(e){return Ql(e)?null:Ee(e,["bpmn:FlowNode","bpmn:InteractionNode","bpmn:DataObjectReference","bpmn:DataStoreReference","bpmn:Group","bpmn:TextAnnotation"])}function Ql(e){return!e||xe(e)}function Zm(e){do{if(y(e,"bpmn:Process"))return q(e);if(y(e,"bpmn:Participant"))return q(e).processRef||q(e)}while(e=e.parent)}function Jl(e){return y(e,"bpmn:TextAnnotation")}function ep(e){return y(e,"bpmn:Group")&&!e.labelTarget}function Qm(e){return y(e,"bpmn:BoundaryEvent")&&pi(e,"bpmn:CompensateEventDefinition")}function Vs(e){return q(e).isForCompensation}function iC(e,t){var n=Zm(e),i=Zm(t);return n===i}function rC(e){return y(e,"bpmn:InteractionNode")&&!y(e,"bpmn:BoundaryEvent")&&(!y(e,"bpmn:Event")||y(e,"bpmn:ThrowEvent")&&tg(e,"bpmn:MessageEventDefinition"))}function oC(e){return y(e,"bpmn:InteractionNode")&&!Vs(e)&&(!y(e,"bpmn:Event")||y(e,"bpmn:CatchEvent")&&tg(e,"bpmn:MessageEventDefinition"))&&!(y(e,"bpmn:BoundaryEvent")&&!pi(e,"bpmn:MessageEventDefinition"))}function Jm(e){for(var t=e;t=t.parent;){if(y(t,"bpmn:FlowElementsContainer"))return q(t);if(y(t,"bpmn:Participant"))return q(t).processRef}return null}function eg(e,t){var n=Jm(e),i=Jm(t);return n===i}function pi(e,t){var n=q(e);return!!Ke(n.eventDefinitions||[],function(i){return y(i,t)})}function tg(e,t){var n=q(e);return(n.eventDefinitions||[]).every(function(i){return y(i,t)})}function aC(e){return y(e,"bpmn:FlowNode")&&!y(e,"bpmn:EndEvent")&&!en(e)&&!(y(e,"bpmn:IntermediateThrowEvent")&&pi(e,"bpmn:LinkEventDefinition"))&&!Qm(e)&&!Vs(e)}function sC(e){return y(e,"bpmn:FlowNode")&&!y(e,"bpmn:StartEvent")&&!y(e,"bpmn:BoundaryEvent")&&!en(e)&&!(y(e,"bpmn:IntermediateCatchEvent")&&pi(e,"bpmn:LinkEventDefinition"))&&!Vs(e)}function cC(e){return y(e,"bpmn:ReceiveTask")||y(e,"bpmn:IntermediateCatchEvent")&&(pi(e,"bpmn:MessageEventDefinition")||pi(e,"bpmn:TimerEventDefinition")||pi(e,"bpmn:ConditionalEventDefinition")||pi(e,"bpmn:SignalEventDefinition"))}function uC(e){for(var t=[];e;)e=e.parent,e&&t.push(e);return t}function ng(e,t){var n=uC(t);return n.indexOf(e)!==-1}function Gs(e,t,n){if(Ql(e)||Ql(t))return null;if(!y(n,"bpmn:DataAssociation")){if(fg(e,t))return{type:"bpmn:MessageFlow"};if(dg(e,t))return{type:"bpmn:SequenceFlow"}}var i=np(e,t);return i||(pg(e,t)?{type:"bpmn:Association",associationDirection:"One"}:lg(e,t)?{type:"bpmn:Association",associationDirection:"None"}:!1)}function lo(e,t){return xe(e)||ep(e)?!0:y(t,"bpmn:Participant")&&!Pe(t)?!1:y(e,"bpmn:Participant")?y(t,"bpmn:Process")||y(t,"bpmn:Collaboration"):Ee(e,["bpmn:DataInput","bpmn:DataOutput"])&&e.parent?t===e.parent:y(e,"bpmn:Lane")?y(t,"bpmn:Participant")||y(t,"bpmn:Lane"):y(e,"bpmn:BoundaryEvent")&&!lC(e)?!1:y(e,"bpmn:FlowElement")&&!y(e,"bpmn:DataStoreReference")?y(t,"bpmn:FlowElementsContainer")?Pe(t):Ee(t,["bpmn:Participant","bpmn:Lane"]):y(e,"bpmn:DataStoreReference")&&y(t,"bpmn:Collaboration")?Li(q(t).get("participants"),function(n){return!!n.get("processRef")}):Ee(e,["bpmn:Artifact","bpmn:DataAssociation","bpmn:DataStoreReference"])?Ee(t,["bpmn:Collaboration","bpmn:Lane","bpmn:Participant","bpmn:Process","bpmn:SubProcess"]):y(e,"bpmn:MessageFlow")?y(t,"bpmn:Collaboration")||e.source.parent==t||e.target.parent==t:!1}function lC(e){return q(e).cancelActivity&&(rg(e)||og(e))}function ig(e){return!xe(e)&&y(e,"bpmn:BoundaryEvent")}function pC(e){return y(e,"bpmn:Lane")}function fC(e){return ig(e)||y(e,"bpmn:IntermediateThrowEvent")&&rg(e)?!0:y(e,"bpmn:IntermediateCatchEvent")&&og(e)}function rg(e){var t=q(e);return t&&!(t.eventDefinitions&&t.eventDefinitions.length)}function og(e){return ag(e,["bpmn:MessageEventDefinition","bpmn:TimerEventDefinition","bpmn:SignalEventDefinition","bpmn:ConditionalEventDefinition"])}function ag(e,t){return t.some(function(n){return pi(e,n)})}function dC(e){return y(e,"bpmn:ReceiveTask")&&Ke(e.incoming,function(t){return y(t.source,"bpmn:EventBasedGateway")})}function ta(e,t,n,i){if(Array.isArray(e)||(e=[e]),e.length!==1)return!1;var r=e[0];return xe(r)||!fC(r)||en(t)||!y(t,"bpmn:Activity")||Vs(t)||i&&!Xm(i,t)||dC(t)?!1:"attach"}function sg(e,t,n){if(!t)return!1;var i={replacements:[]};return M(e,function(r){en(t)||y(r,"bpmn:StartEvent")&&r.type!=="label"&&lo(r,t)&&(E1(r)||i.replacements.push({oldElementId:r.id,newElementType:"bpmn:StartEvent"}),(w1(r)||S1(r)||R1(r))&&i.replacements.push({oldElementId:r.id,newElementType:"bpmn:StartEvent"}),ag(r,["bpmn:MessageEventDefinition","bpmn:TimerEventDefinition","bpmn:SignalEventDefinition","bpmn:ConditionalEventDefinition"])&&y(t,"bpmn:SubProcess")&&i.replacements.push({oldElementId:r.id,newElementType:"bpmn:StartEvent"})),y(t,"bpmn:Transaction")||pi(r,"bpmn:CancelEventDefinition")&&r.type!=="label"&&(y(r,"bpmn:EndEvent")&&lo(r,t)&&i.replacements.push({oldElementId:r.id,newElementType:"bpmn:EndEvent"}),y(r,"bpmn:BoundaryEvent")&&ta(r,t,null,n)&&i.replacements.push({oldElementId:r.id,newElementType:"bpmn:BoundaryEvent"}))}),i.replacements.length?i:!1}function cg(e,t){return Li(e,pC)?!1:t===void 0?!0:t===null?!1:e.every(function(n){return lo(n,t)})}function tp(e,t,n,i){return t?xe(e)||ep(e)?!0:lo(e,t)||Ws(e,t):!1}function ug(e,t,n){return y(e,"bpmn:SubProcess")?Pe(e)&&(!t||t.width>=100&&t.height>=80):y(e,"bpmn:Lane")||y(e,"bpmn:Participant")?!0:Jl(e)?n?n==="e"||n==="w":!0:ep(e)?!0:xe(e)?n?n==="e"||n==="w":!0:!1}function hC(e,t){var n=Jl(e),i=Jl(t);return(n||i)&&n!==i}function lg(e,t){return ng(t,e)||ng(e,t)?!1:hC(e,t)?!0:!!np(e,t)}function pg(e,t){return eg(e,t)&&Qm(e)&&y(t,"bpmn:Activity")&&!gC(t,e)&&!en(t)}function fg(e,t){return gg(e)&&!gg(t)?!1:rC(e)&&oC(t)&&!iC(e,t)}function dg(e,t){return aC(e)&&sC(t)&&eg(e,t)&&!(y(e,"bpmn:EventBasedGateway")&&!cC(t))}function np(e,t){return Ee(e,["bpmn:DataObjectReference","bpmn:DataStoreReference"])&&Ee(t,["bpmn:Activity","bpmn:ThrowEvent"])?{type:"bpmn:DataInputAssociation"}:Ee(t,["bpmn:DataObjectReference","bpmn:DataStoreReference"])&&Ee(e,["bpmn:Activity","bpmn:CatchEvent"])?{type:"bpmn:DataOutputAssociation"}:!1}function Ws(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:Ee(t,["bpmn:SequenceFlow","bpmn:MessageFlow"])&&!xe(t)&&y(e,"bpmn:FlowNode")&&!y(e,"bpmn:BoundaryEvent")&&lo(e,t.parent)}function ip(e,t){return e&&t&&e.indexOf(t)!==-1}function hg(e,t){return xe(t)?!0:!(y(t,"bpmn:Lane")&&!ip(e,t.parent)||y(t,"bpmn:MessageFlow")&&!mC(e,t))}function mC(e,t){var n=mg(t.source),i=mg(t.target);return ip(e,n)&&ip(e,i)}function mg(e){for(;e;e=e.parent)if(y(e,"bpmn:Participant"))return e;return null}function gg(e){return io(e,"bpmn:Process")||io(e,"bpmn:Collaboration")}function gC(e,t){return e.attachers.includes(t)}const vC={__depends__:[li],__init__:["bpmnRules"],bpmnRules:["type",Ut]};var yC=2e3;function vg(e,t){e.on("saveXML.start",yC,n);function n(){var i=t.getRootElements();M(i,function(r){var o=ke(r),a,s;a=$o([r]),a=Re(a,function(c){return c!==r&&!c.labelTarget}),s=Kt(a,ke),o.set("planeElement",s)})}}vg.$inject=["eventBus","canvas"];const _C={__init__:["bpmnDiOrdering"],bpmnDiOrdering:["type",vg]};function Us(e){W.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)})}Us.prototype.getOrdering=function(e,t){return null},te(Us,W);function rp(e,t){Us.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=Ke(n,function(c){return Ee(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&&!Ee(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||y(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=kf(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}}}rp.$inject=["eventBus","canvas"],te(rp,Us);const bC={__init__:["bpmnOrderingProvider"],bpmnOrderingProvider:["type",rp]};function na(){}na.prototype.get=function(){return this._data},na.prototype.set=function(e){this._data=e},na.prototype.clear=function(){var e=this._data;return delete this._data,e},na.prototype.isEmpty=function(){return!this._data};const xC={clipboard:["type",na]};var yg=1500;function _g(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",yg,function(s){o(s)})}),(function(){var a,s;t.on("element.hover",function(c){a=c.gfx,s=c.element}),t.on("element.hover",yg,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=Tr(a),c=document.elementFromPoint(s.x,s.y),EC(c)}}_g.$inject=["elementRegistry","eventBus","injector"];function EC(e){return wr(e,"svg, .djs-element",!0)}const wC={__init__:["hoverFix"],hoverFix:["type",_g]};function SC(e){return!0}function qs(e){return Ji(e)||TR(e)}var bg=500;function xg(e,t,n){var i=this;function r(P,j,F){if(!s(P,j)){var L,H,oe;F?H=t.getGraphics(F):(L=j.delegateTarget||j.target,L&&(H=L,F=t.get(H))),!(!H||!F)&&(oe=e.fire(P,{element:F,gfx:H,originalEvent:j}),oe===!1&&(j.stopPropagation(),j.preventDefault()))}}var o={};function a(P){return o[P]}function s(P,j){var F=u[P]||Ji;return!F(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":SC,"element.mousedown":qs,"element.mouseup":qs,"element.click":qs,"element.dblclick":qs};function l(P,j,F){var L=c[P];if(!L)throw new Error("unmapped DOM event name <"+P+">");return r(L,j,F)}var p="svg, .djs-element";function f(P,j,F,L){var H=o[F]=function(oe){r(F,oe)};L&&(u[F]=L),H.$delegate=vn.bind(P,p,j,H)}function d(P,j,F){var L=a(F);L&&vn.unbind(P,j,L.$delegate)}function h(P){M(c,function(j,F){f(P,F,j)})}function m(P){M(c,function(j,F){d(P,F,j)})}e.on("canvas.destroy",function(P){m(P.svg)}),e.on("canvas.init",function(P){h(P.svg)}),e.on(["shape.added","connection.added"],function(P){var j=P.element,F=P.gfx;e.fire("interactionEvents.createHit",{element:j,gfx:F})}),e.on(["shape.changed","connection.changed"],bg,function(P){var j=P.element,F=P.gfx;e.fire("interactionEvents.updateHit",{element:j,gfx:F})}),e.on("interactionEvents.createHit",bg,function(P){var j=P.element,F=P.gfx;i.createDefaultHit(j,F)}),e.on("interactionEvents.updateHit",function(P){var j=P.element,F=P.gfx;i.updateDefaultHit(j,F)});var g=w("djs-hit djs-hit-stroke"),S=w("djs-hit djs-hit-click-stroke"),E=w("djs-hit djs-hit-all"),b=w("djs-hit djs-hit-no-move"),x={all:E,"click-stroke":S,stroke:g,"no-move":b};function w(P,j){return j=D({stroke:"white",strokeWidth:15},j||{}),n.cls(P,["no-fill","no-border"],j)}function T(P,j){var F=x[j];if(!F)throw new Error("invalid hit type <"+j+">");return ne(P,F),P}function I(P,j){ve(P,j)}this.removeHits=function(P){var j=rs(".djs-hit",P);M(j,Mt)},this.createDefaultHit=function(P,j){var F=P.waypoints,L=P.isFrame,H;return F?this.createWaypointsHit(j,F):(H=L?"stroke":"all",this.createBoxHit(j,H,{width:P.width,height:P.height}))},this.createWaypointsHit=function(P,j){var F=Bo(j);return T(F,"stroke"),I(P,F),F},this.createBoxHit=function(P,j,F){F=D({x:0,y:0},F);var L=ce("rect");return T(L,j),ne(L,F),I(P,L),L},this.updateDefaultHit=function(P,j){var F=Ge(".djs-hit",j);if(F)return P.waypoints?Gu(F,P.waypoints):ne(F,{width:P.width,height:P.height}),F},this.fire=r,this.triggerMouseEvent=l,this.mouseHandler=a,this.registerEvent=f,this.unregisterEvent=d}xg.$inject=["eventBus","elementRegistry","styles"];const Ys={__init__:["interactionEvents"],interactionEvents:["type",xg]};function po(e,t){this._eventBus=e,this._canvas=t,this._selectedElements=new Set;var n=this;e.on(["shape.remove","connection.remove"],function(i){var r=i.element;n.deselect(r)}),e.on(["diagram.clear","root.set"],function(i){n.select(null)})}po.$inject=["eventBus","canvas"],po.prototype.deselect=function(e){if(this._selectedElements.has(e)){var t=this.get();this._selectedElements.delete(e),this._eventBus.fire("selection.changed",{oldSelection:t,newSelection:this.get()})}},po.prototype.get=function(){return Array.from(this._selectedElements)},po.prototype.isSelected=function(e){return this._selectedElements.has(e)},po.prototype.select=function(e,t){var n=this.get();pe(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 Eg="hover",wg="selected";function Sg(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,Eg)}),t.on("element.out",function(r){i(r.element,Eg)}),t.on("selection.changed",function(r){function o(u){i(u,wg)}function a(u){n(u,wg)}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)})}Sg.$inject=["canvas","eventBus"];function Rg(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;pe(u)?t.select(u):t.select(s.filter(RC))}}),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=Ke(o,function(c){return a.id===c.id});s||t.select(a)}),e.on("element.click",function(r){if(Ji(r)){var o=r.element;o===n.getRootElement()&&(o=null);var a=t.isSelected(o),s=t.get().length>1,c=Hs(r);if(a&&s)return c?t.deselect(o):t.select(o);a?t.deselect(o):t.select(o,c)}})}Rg.$inject=["eventBus","selection","canvas","elementRegistry"];function RC(e){return!e.hidden}const jn={__init__:["selectionVisuals","selectionBehavior"],__depends__:[Ys],selection:["type",po],selectionVisuals:["type",Sg],selectionBehavior:["type",Rg]};var CC=/^djs-cursor-.*$/;function Ks(e){var t=rt(document.body);t.removeMatching(CC),e&&t.add("djs-cursor-"+e)}function Cg(){Ks(null)}var PC=5e3;function Pg(e,t){t=t||"element.click";function n(){return!1}return e.once(t,PC,n),function(){e.off(t,n)}}var AC=["c","C"],TC=["v","V"],MC=["d","D"],kC=["x","X"],DC=["y","Y"],Ag=["z","Z"];function OC(e){return e.ctrlKey||e.metaKey||e.shiftKey||e.altKey}function bn(e){return e.altKey?!1:e.ctrlKey||e.metaKey}function kt(e,t){return e=pe(e)?e:[e],e.indexOf(t.key)!==-1||e.indexOf(t.code)!==-1}function op(e){return e.shiftKey}function IC(e){return bn(e)&&kt(AC,e)}function LC(e){return bn(e)&&kt(TC,e)}function NC(e){return bn(e)&&kt(MC,e)}function BC(e){return bn(e)&&kt(kC,e)}function $C(e){return bn(e)&&!op(e)&&kt(Ag,e)}function jC(e){return bn(e)&&(kt(DC,e)||kt(Ag,e)&&op(e))}var fo=Math.round,Tg="djs-drag-active";function kr(e){e.preventDefault()}function FC(e){return typeof TouchEvent<"u"&&e instanceof TouchEvent}function HC(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}function Mg(e,t,n,i){var r={threshold:5,trapClick:!0},o;function a(b){var x=t.viewbox(),w=t._container.getBoundingClientRect();return{x:x.x+(b.x-w.left)/x.scale,y:x.y+(b.y-w.top)/x.scale}}function s(b,x){x=x||o;var w=e.createEvent(D({},x.payload,x.data,{isTouch:x.isTouch}));return e.fire("drag."+b,w)===!1?!1:e.fire(x.prefix+"."+b,w)}function c(b){var x=b.filter(function(w){return i.get(w.id)});x.length&&n.select(x)}function u(b,x){var w=o.payload,T=o.displacement,I=o.globalStart,P=Tr(b),j=Kn(P,I),F=o.localStart,L=a(P),H=Kn(L,F);if(!o.active&&(x||HC(j)>o.threshold)){if(D(w,{x:fo(F.x+T.x),y:fo(F.y+T.y),dx:0,dy:0},{originalEvent:b}),s("start")===!1)return g();o.active=!0,o.keepSelection||(w.previousSelection=n.get(),n.select(null)),o.cursor&&Ks(o.cursor),t.addMarker(t.getRootElement(),Tg)}$l(b),o.active&&(D(w,{x:fo(L.x+T.x),y:fo(L.y+T.y),dx:fo(H.x),dy:fo(H.y)},{originalEvent:b}),s("move"))}function l(b){var x,w=!0;o.active&&(b&&(o.payload.originalEvent=b,$l(b)),w=s("end")),w===!1&&s("rejected"),x=S(w!==!0),s("ended",x)}function p(b){kt("Escape",b)&&(kr(b),g())}function f(b){var x;o.active&&(x=Pg(e),setTimeout(x,400),kr(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 w=o.active;w&&s("cancel"),x=S(b),w&&s("canceled",x)}}function S(b){var x,w;s("cleanup"),Cg(),o.trapClick?w=f:w=l,me.unbind(document,"mousemove",u),me.unbind(document,"dragstart",kr),me.unbind(document,"selectstart",kr),me.unbind(document,"mousedown",w,!0),me.unbind(document,"mouseup",w,!0),me.unbind(document,"keyup",p),me.unbind(document,"touchstart",d,!0),me.unbind(document,"touchcancel",g,!0),me.unbind(document,"touchmove",u,!0),me.unbind(document,"touchend",l,!0),e.off("element.hover",h),e.off("element.out",m),t.removeMarker(t.getRootElement(),Tg);var T=o.payload.previousSelection;return b!==!1&&T&&!n.get().length&&c(T),x=o,o=null,x}function E(b,x,w,T){o&&g(!1),typeof x=="string"&&(T=w,w=x,x=null),T=D({},r,T||{});var I=T.data||{},P,j,F,L,H;if(T.trapClick?L=f:L=l,b?(P=uo(b)||b,j=Tr(b),$l(b),P.type==="dragstart"&&kr(P)):(P=null,j={x:0,y:0}),F=a(j),x||(x=F),H=FC(P),o=D({prefix:w,data:I,payload:{},globalStart:j,displacement:Kn(x,F),localStart:F,isTouch:H},T),T.manual||(H?(me.bind(document,"touchstart",d,!0),me.bind(document,"touchcancel",g,!0),me.bind(document,"touchmove",u,!0),me.bind(document,"touchend",l,!0)):(me.bind(document,"mousemove",u),me.bind(document,"dragstart",kr),me.bind(document,"selectstart",kr),me.bind(document,"mousedown",L,!0),me.bind(document,"mouseup",L,!0)),me.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=E,this.move=u,this.hover=h,this.out=m,this.end=l,this.cancel=g,this.context=function(){return o},this.setOptions=function(b){D(r,b)}}Mg.$inject=["eventBus","canvas","selection","elementRegistry"];const Ci={__depends__:[wC,jn],dragging:["type",Mg]};function ho(e){this._counter=0,this._prefix=(e?e+"-":"")+Math.floor(Math.random()*1e9)+"-"}ho.prototype.next=function(){return this._prefix+ ++this._counter};const zC=new ho("ps");var VC=["marker-start","marker-mid","marker-end"],GC=["circle","ellipse","line","path","polygon","polyline","path","rect"];function er(e,t,n,i){this._elementRegistry=e,this._canvas=n,this._styles=i}er.$inject=["elementRegistry","eventBus","canvas","styles"],er.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")},er.prototype.getGfx=function(e){return this._elementRegistry.getGraphics(e)},er.prototype.addDragger=function(e,t,n,i="djs-dragger"){n=n||this.getGfx(e);var r=Vd(n);return this._cloneMarkers(Cr(r),i),ne(r,this._styles.cls(i,[])),ve(t,r),ne(r,"data-preview-support-element-id",e.id),r},er.prototype.addFrame=function(e,t){var n=ce("rect",{class:"djs-resize-overlay",width:e.width,height:e.height,x:e.x,y:e.y});return ve(t,n),ne(n,"data-preview-support-element-id",e.id),n},er.prototype._cloneMarkers=function(e,t="djs-dragger",n=e){var i=this;e.childNodes&&e.childNodes.forEach(r=>{i._cloneMarkers(r,t,n)}),YC(e)&&VC.forEach(function(r){if(ne(e,r)){var o=WC(e,r,i._canvas.getContainer());o&&i._cloneMarker(n,e,o,r,t)}})},er.prototype._cloneMarker=function(e,t,n,i,r="djs-dragger"){var o=[n.id,r,zC.next()].join("-"),a=Ge("marker#"+n.id,e);e=e||this._canvas._svg;var s=a||Vd(n);s.id=o,Ae(s).add(r);var c=Ge(":scope > defs",e);c||(c=ce("defs"),ve(e,c)),ve(c,s);var u=qC(s.id);ne(t,i,u)};function WC(e,t,n){var i=UC(ne(e,t));return Ge("marker#"+i,n||document)}function UC(e){return e.match(/url\(['"]?#([^'"]*)['"]?\)/)[1]}function qC(e){return"url(#"+e+")"}function YC(e){return GC.indexOf(e.nodeName)!==-1}const mo={__init__:["previewSupport"],previewSupport:["type",er]};var KC="drop-ok",kg="drop-not-ok",Dg="attach-ok",Og="new-parent",Ig="create",XC=2e3;function Lg(e,t,n,i,r){function o(c,u,l,p,f){if(!u)return!1;c=Re(c,function(E){var b=E.labelTarget;return!E.parent&&!(xe(E)&&c.indexOf(b)!==-1)});var d=Ke(c,function(E){return!Ue(E)}),h=!1,m=!1,g=!1;Bg(c)&&(h=r.allowed("shape.attach",{position:l,shape:d,target:u})),h||(Bg(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 S=f.connectionTarget;return g||h?(d&&p&&(m=r.allowed("connection.create",{source:S===p?d:p,target:S===p?p:d,hints:{targetParent:u,targetAttach:h}})),{attach:h,connect:m}):g===null||h===null?null:!1}function a(c,u){[Dg,KC,kg,Og].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}Ng(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,Dg):a(p,m?Og:kg))}),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,S=u.hints||{};if(h===!1||!d)return!1;Ng(c);var E={x:c.x,y:c.y};g?p=i.appendShape(l,p,E,d,{attach:m,connection:g===!0?{}:g,connectionTarget:S.connectionTarget}):(f=i.createElements(f,E,d,D({},S,{attach:m})),p=Ke(f,function(b){return!Ue(b)})),D(u,{elements:f,shape:p}),D(c,{elements:f,shape:p})});function s(){var c=t.context();c&&c.prefix===Ig&&t.cancel()}n.on("create.init",function(){n.on("elements.changed",s),n.once(["create.cancel","create.end"],XC,function(){n.off("elements.changed",s)})}),this.start=function(c,u,l){pe(u)||(u=[u]);var p=Ke(u,function(h){return!Ue(h)});if(p){l=D({elements:u,hints:{},shape:p},l||{}),M(u,function(h){he(h.x)||(h.x=0),he(h.y)||(h.y=0)});var f=Re(u,function(h){return!h.hidden}),d=bt(f);M(u,function(h){Ue(h)&&(h.waypoints=Kt(h.waypoints,function(m){return{x:m.x-d.x-d.width/2,y:m.y-d.y-d.height/2}})),D(h,{x:h.x-d.x-d.width/2,y:h.y-d.y-d.height/2})}),t.init(c,Ig,{cursor:"grabbing",autoActivate:!0,data:{shape:p,elements:u,context:l}})}}}Lg.$inject=["canvas","dragging","eventBus","modeling","rules"];function Ng(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 Bg(e){return e&&e.length===1&&!Ue(e[0])}var ZC=750;function $g(e,t,n,i,r){function o(a){var s=ce("g");ne(s,r.cls("djs-drag-group",["no-events"]));var c=ce("g");return a.forEach(function(u){var l;u.hidden||(u.waypoints?(l=n._createContainer("connection",c),n.drawConnection(Cr(l),u)):(l=n._createContainer("shape",c),n.drawShape(Cr(l),u),Wt(l,u.x,u.y)),i.addDragger(u,s,l))}),s}t.on("create.move",ZC,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(),ve(p,l)),Wt(l,a.x,a.y)):Mt(l)}),t.on("create.cleanup",function(a){var s=a.context,c=s.dragGroup;c&&Mt(c)})}$g.$inject=["canvas","eventBus","graphicsFactory","previewSupport","styles"];const Xs={__depends__:[Ci,mo,li,jn],__init__:["create","createPreview"],create:["type",Lg],createPreview:["type",$g]};function ap(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)})}ap.$inject=["eventBus"],ap.prototype.getLastMoveEvent=function(){return this._lastMoveEvent||QC(0,0)};function QC(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 ia={__init__:["mouse"],mouse:["type",ap]};var jg=2e3;function xn(e,t,n,i,r,o,a,s){this._canvas=e,this._create=t,this._elementFactory=i,this._eventBus=r,this._modeling=o,this._mouse=a,this._rules=s,r.on("copyPaste.copyElement",function(c){var 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),JC(l)&&(u.priority=2,u.host=l.host.id),Ue(l)&&(u.priority=3,u.source=l.source.id,u.target=l.target.id,u.waypoints=eP(l)),xe(l)&&(u.priority=4,u.labelTarget=l.labelTarget.id),M(["x","y","width","height"],function(f){he(l[f])&&(u[f]=l[f])}),u.hidden=l.hidden,u.collapsed=l.collapsed}),r.on("copyPaste.elementsCopied",jg,function(c){var u;((u=c.hints)==null?void 0:u.clip)!==!1&&n.set(c.tree)}),r.on("copyPaste.pasteElements",jg,function(c){c.tree||(c.tree=n.get())}),r.on("copyPaste.pasteElements",function(c){var u=c.hints;D(u,{createElementsBehavior:!1})})}xn.$inject=["canvas","create","clipboard","elementFactory","eventBus","modeling","mouse","rules"],xn.prototype.copy=function(e,t={}){var n,i;return pe(e)||(e=e?[e]:[]),n=this._eventBus.fire("copyPaste.canCopyElements",{elements:e}),n===!1?i={}:i=this.createTree(pe(n)?n:e),this._eventBus.fire("copyPaste.elementsCopied",{elements:e,tree:i,hints:t}),i},xn.prototype.paste=function(e={}){var t=this._eventBus.createEvent({type:"copyPaste.pasteElements",hints:{},...e}),n=this._eventBus.fire(t);if(n!==!1){var i=t.tree;if(i){var r=t.hints,o=this._createElements(i);if(t.element&&t.point)return this._paste(o,t.element,t.point,r);this._create.start(this._mouse.getLastMoveEvent(),o,{hints:r})}}},xn.prototype.duplicate=function(e,t={}){var n=this.copy(e,{clip:!1});return this.paste({...t,tree:n})},xn.prototype.cut=function(e){var t=this.copy(e),n=this._getElementIdsFromTree(t),i=e.filter(function(r){return n[r.id]});return i.length>0&&this._modeling.removeElements(i),t},xn.prototype._getElementIdsFromTree=function(e){var t={};return M(e,function(n){M(n,function(i){i.id&&(t[i.id]=!0)})}),t},xn.prototype._paste=function(e,t,n,i){M(e,function(o){he(o.x)||(o.x=0),he(o.y)||(o.y=0)});var r=bt(e);return M(e,function(o){Ue(o)&&(o.waypoints=Kt(o.waypoints,function(a){return{x:a.x-r.x-r.width/2,y:a.y-r.y-r.height/2}})),D(o,{x:o.x-r.x-r.width/2,y:o.y-r.y-r.height/2})}),this._modeling.createElements(e,n,t,D({},i))},xn.prototype._createElements=function(e){var t=this,n=this._eventBus,i={},r=[];return M(e,function(o,a){o=Jn(o,"priority"),M(o,function(s){var c=D({},ei(s,["priority"]));i[s.parent]?c.parent=i[s.parent]:delete c.parent,n.fire("copyPaste.pasteElement",{cache:i,descriptor:c});var u;if(Ue(c)){c.source=i[s.source],c.target=i[s.target],u=i[s.id]=t.createConnection(c),r.push(u);return}if(xe(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},xn.prototype.createConnection=function(e){var t=this._elementFactory.createConnection(ei(e,["id"]));return t},xn.prototype.createLabel=function(e){var t=this._elementFactory.createLabel(ei(e,["id"]));return t},xn.prototype.createShape=function(e){var t=this._elementFactory.createShape(ei(e,["id"]));return t},xn.prototype.hasRelations=function(e,t,n){return n||(n=new Set(t)),!(Ue(e)&&(!n.has(e.source)||!n.has(e.target))||xe(e)&&!n.has(e.labelTarget))},xn.prototype.createTree=function(e){var t=this._rules,n=this,i={},r=[],o=new Map,a=cs(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}Rr(a,function(p,f,d){if(xe(p))return;M(p.labels,function(g){c(g,d)});function h(g){g&&g.length&&M(g,function(S){M(S.labels,function(E){c(E,d)}),c(S,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=Kt(r,function(p){return p.element});var l=new Set(e);return r=Kt(r,function(p){return p.descriptor={},n._eventBus.fire("copyPaste.copyElement",{descriptor:p.descriptor,element:p.element,elements:e,elementsSet:l}),p}),r=Jn(r,function(p){return p.descriptor.priority}),e=Kt(r,function(p){return p.element}),M(r,function(p){var f=p.depth;if(!n.hasRelations(p.element,e,l)){Hg(p.element,e),l.delete(p.element);return}if(!s(p.element,e)){Hg(p.element,e),l.delete(p.element);return}i[f]||(i[f]=[]),i[f].push(p.descriptor)}),i};function JC(e){return!!e.host}function eP(e){return Kt(e.waypoints,function(t){return t=Fg(t),t.original&&(t.original=Fg(t.original)),t})}function Fg(e){return D({},e)}function Hg(e,t){var n=t.indexOf(e);return n===-1?t:t.splice(n,1)}const tP={__depends__:[xC,Xs,ia,li],__init__:["copyPaste"],copyPaste:["type",xn]};function sp(e,t,n){pe(n)||(n=[n]),M(n,function(i){vr(e[i])||(t[i]=e[i])})}var cp=750;function zg(e,t,n){function i(c,u){var l=e.create(c.$type);return n.copyElement(c,l,null,u)}t.on("copyPaste.copyElement",cp,function(c){var u=c.descriptor,l=c.element,p=q(l);if(xe(l))return u;var f=u.businessObject=i(p,!0),d=u.di=i(ke(l),!0);d.bpmnElement=f,sp(f,u,"name"),sp(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=q(c);return c.default&&(l[c.default]={element:p,property:"default"}),c.host&&(q(c).attachedToRef=q(u[c.host])),ei(l,gn(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(xe(l)){l.businessObject=q(u[l.labelTarget]),l.di=ke(u[l.labelTarget]);return}p=l.businessObject=i(p),f=l.di=i(f),f.bpmnElement=p,sp(l,p,["isExpanded","name"]),l.type=p.$type}),t.on("copyPaste.copyElement",cp,function(c){var u=c.descriptor,l=c.element;if(y(l,"bpmn:Participant")){var p=q(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;y(u,"bpmn:SubProcess")&&M(Go(l),p=>{l.push(p.annotation)})}),t.on("copyPaste.pasteElement",cp,function(c){var u=c.cache,l=c.descriptor;a(u,s(l,u,o(u)))})}zg.$inject=["bpmnFactory","eventBus","moddleCopy"];const nP=["artifacts","dataInputAssociations","dataOutputAssociations","default","flowElements","lanes","incoming","outgoing","categoryValue"],iP=["errorRef","escalationRef","messageRef","signalRef","dataObjectRef"];function ra(e,t,n){this._bpmnFactory=t,this._eventBus=e,this._moddle=n,e.on("moddleCopy.canCopyProperties",i=>{const{propertyNames:r}=i;if(!(!r||!r.length))return Jn(r,o=>o==="extensionElements")}),e.on("moddleCopy.canCopyProperty",i=>{const{parent:r,property:o,propertyName:a}=i,s=It(r)&&r.$descriptor;if(a&&iP.includes(a))return o;if(a&&nP.includes(a)||a&&s&&!Ke(s.properties,Wr({name:a})))return!1}),e.on("moddleCopy.canSetCopiedProperty",i=>{const{property:r}=i;if(y(r,"bpmn:ExtensionElements")&&(!r.values||!r.values.length))return!1})}ra.$inject=["eventBus","bpmnFactory","moddle"],ra.prototype.copyElement=function(e,t,n,i=!1){n&&!pe(n)&&(n=[n]),n=n||up(e.$descriptor);const r=this._eventBus.fire("moddleCopy.canCopyProperties",{propertyNames:n,sourceElement:e,targetElement:t,clone:i});return r===!1||(pe(r)&&(n=r),M(n,o=>{let a;mn(e,o)&&(a=e.get(o));const s=this.copyProperty(a,t,o,i);!At(s)||this._eventBus.fire("moddleCopy.canSetCopiedProperty",{parent:t,property:s,propertyName:o})===!1||t.set(o,s)})),t},ra.prototype.copyProperty=function(e,t,n,i=!1){let r=this._eventBus.fire("moddleCopy.canCopyProperty",{parent:t,property:e,propertyName:n,clone:i});if(r===!1)return;if(r)return It(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):pe(e)?gn(e,(a,s)=>{const c=this.copyProperty(s,t,n,i);return c?a.concat(c):a},[]):It(e)&&e.$type?this._moddle.getElementDescriptor(e).isGeneric?void 0:(r=this._bpmnFactory.create(e.$type),r.$parent=t,r=this.copyElement(e,r,null,i),r):e},ra.prototype._copyId=function(e,t,n=!1){if(n)return e;if(!this._moddle.ids.assigned(e))return this._moddle.ids.claim(e,t),e};function up(e,t){return gn(e.properties,(n,i)=>t&&i.default?n:n.concat(i.name),[])}const Vg={__depends__:[tP],__init__:["bpmnCopyPaste","moddleCopy"],bpmnCopyPaste:["type",zg],moddleCopy:["type",ra]};var Gg=Math.round;function lp(e,t){this._modeling=e,this._eventBus=t}lp.$inject=["modeling","eventBus"],lp.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=Gg(s+o/2),l=Gg(c+a/2),p=i.replaceShape(e,D({},t,{x:u,y:l,width:o,height:a}),n);return r.fire("replace.end",{element:e,newElement:p,hints:n}),p};function Wg(e,t){t.on("replace.end",500,function(n){const{newElement:i,hints:r={}}=n;r.select!==!1&&e.select(i)})}Wg.$inject=["selection","eventBus"];const rP={__init__:["replace","replaceSelectionBehavior"],replaceSelectionBehavior:["type",Wg],replace:["type",lp]};function oP(e,t,n){pe(n)||(n=[n]),M(n,function(i){vr(e[i])||(t[i]=e[i])})}var aP=["cancelActivity","instantiate","eventGatewayType","triggeredByEvent","isInterrupting"];function sP(e,t){var n=e&&mn(e,"collapsed")?e.collapsed:!Pe(e),i;return t&&(mn(t,"collapsed")||mn(t,"isExpanded"))?i=mn(t,"collapsed")?t.collapsed:!t.isExpanded:i=n,n!==i}function Ug(e,t,n,i,r,o){function a(s,c,u){u=u||{};var l=c.type,p=s.businessObject;if(Zs(p)&&(l==="bpmn:SubProcess"||l==="bpmn:AdHocSubProcess")&&sP(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),oP(s.di,d.di,["fill","stroke","background-color","border-color","color"]);var h=up(p.$descriptor),m=up(f.$descriptor,!0),g=cP(h,m);D(f,qn(c,aP));var S=Re(g,function(x){return x==="eventDefinitions"?qg(s,c.eventDefinitionType):x==="loopCharacteristics"?!en(f):mn(f,x)||x==="processRef"&&c.isExpanded===!1||x==="triggeredByEvent"?!1:x==="isForCompensation"?!en(f):!0});if(f=n.copyElement(p,f,S),c.eventDefinitionType&&(qg(f,c.eventDefinitionType)||(d.eventDefinitionType=c.eventDefinitionType,d.eventDefinitionAttrs=c.eventDefinitionAttrs)),y(p,"bpmn:Activity")){if(Zs(p))d.isExpanded=Pe(s);else if(c&&mn(c,"isExpanded")){d.isExpanded=c.isExpanded;var E=t.getDefaultSize(f,{isExpanded:d.isExpanded});d.width=E.width,d.height=E.height,d.x=s.x-(d.width-s.width)/2,d.y=s.y-(d.height-s.height)/2}Pe(s)&&!y(p,"bpmn:Task")&&d.isExpanded&&(d.width=s.width,d.height=s.height)}if(Zs(p)&&!Zs(f)&&(u.moveChildren=!1),y(p,"bpmn:Participant")){c.isExpanded===!0?f.processRef=e.create("bpmn:Process"):u.moveChildren=!1;var b=Bt(s);ke(s).isHorizontal||(ke(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,Ee(p,["bpmn:ExclusiveGateway","bpmn:InclusiveGateway","bpmn:Activity"])&&Ee(f,["bpmn:ExclusiveGateway","bpmn:InclusiveGateway","bpmn:Activity"])&&(f.default=p.default),c.host&&!y(p,"bpmn:BoundaryEvent")&&y(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}Ug.$inject=["bpmnFactory","elementFactory","moddleCopy","modeling","replace","rules"];function Zs(e){return y(e,"bpmn:SubProcess")}function qg(e,t){var n=q(e);return t&&n.get("eventDefinitions").some(function(i){return y(i,t)})}function cP(e,t){return e.filter(function(n){return t.includes(n)})}const Yg={__depends__:[Vg,rP,jn],bpmnReplace:["type",Ug]};var uP=250;function Dr(e){this._eventBus=e,this._tools=[],this._active=null}Dr.$inject=["eventBus"],Dr.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)},Dr.prototype.isActive=function(e){return e&&this._active===e},Dr.prototype.length=function(e){return this._tools.length},Dr.prototype.setActive=function(e){var t=this._eventBus;this._active!==e&&(this._active=e,t.fire("tool-manager.update",{tool:e}))},Dr.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,uP,function(r){this._active&&(lP(r)||this.setActive(null))},this)};function lP(e){var t=e.originalEvent&&e.originalEvent.target;return t&&wr(t,'.group[data-group="tools"]')}const Qs={__depends__:[Ci],__init__:["toolManager"],toolManager:["type",Dr]};function pP(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 fP(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 dP(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 pp=Math.abs,hP=Math.round,Pi={x:"width",y:"height"},Kg="crosshair",tr={n:"top",w:"left",s:"bottom",e:"right"},mP=1500,Js={n:"s",w:"e",s:"n",e:"w"},ec=20;function Fn(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",mP,function(c){var u=c.context,l=u.initialized;l||(l=u.initialized=s.init(c,u)),l&&Zg(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){Zg(c);var m={x:0,y:0};m[l]=hP(c["d"+l]),s.makeSpace(f,d,m,p,h),n.once("spaceTool.ended",function(g){s.activateSelection(g.originalEvent,!0,!0)})}})}Fn.$inject=["canvas","dragging","eventBus","modeling","rules","toolManager","mouse"],Fn.prototype.activateSelection=function(e,t,n){this._dragging.init(e,"spaceTool.selection",{autoActivate:t,cursor:Kg,data:{context:{reactivate:n}},trapClick:!1})},Fn.prototype.activateMakeSpace=function(e){this._dragging.init(e,"spaceTool",{autoActivate:!0,cursor:Kg,data:{context:{}}})},Fn.prototype.makeSpace=function(e,t,n,i,r){return this._modeling.createSpace(e,t,n,i,r)},Fn.prototype.init=function(e,t){var n=pp(e.dx)>pp(e.dy)?"x":"y",i=e["d"+n],r=e[n]-i;if(pp(i)<5)return!1;i<0&&(i*=-1),ea(e)&&(i*=-1);var o=pP(n,i),a=this._canvas.getRootElement();!Hs(e)&&e.hover&&(a=e.hover);var s=[...$o(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=gP(c,n,o,r,u);return D(t,c,{axis:n,direction:o,spaceToolConstraints:l,start:r}),Ks("resize-"+(n==="x"?"ew":"ns")),!0},Fn.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||xe(d))){if(Ue(d)){l.push(d);return}var h=d[t],m=h+d[Pi[t]];if(vP(d)&&(n>0&&fe(d)[t]>i||n<0&&fe(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}},Fn.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateSelection(e,!!e)},Fn.prototype.isActive=function(){var e=this._dragging.context();return e?/^spaceTool/.test(e.prefix):!1};function Xg(e){return{top:e.top-ec,right:e.right+ec,bottom:e.bottom+ec,left:e.left-ec}}function Zg(e){var t=e.context,n=t.spaceToolConstraints;if(n){var i,r;he(n.left)&&(i=Math.max(e.x,n.left),e.dx=e.dx+i-e.x,e.x=i),he(n.right)&&(i=Math.min(e.x,n.right),e.dx=e.dx+i-e.x,e.x=i),he(n.top)&&(r=Math.max(e.y,n.top),e.dy=e.dy+r-e.y,e.y=r),he(n.bottom)&&(r=Math.min(e.y,n.bottom),e.dy=e.dy+r-e.y,e.y=r)}}function gP(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=ue(f),g=Re(h,function(H){return!Ue(H)&&!xe(H)&&!l.has(H)&&!p.has(H)}),S=Re(h,function(H){return!Ue(H)&&!xe(H)&&l.has(H)}),E,b,x,w=[],T=[],I,P,j,F;g.length&&(b=Xg(ue(bt(g))),E=i-m[tr[n]]+b[tr[n]],n==="n"?s.bottom=u=he(u)?Math.min(u,E):E:n==="w"?s.right=u=he(u)?Math.min(u,E):E:n==="s"?s.top=c=he(c)?Math.max(c,E):E:n==="e"&&(s.left=c=he(c)?Math.max(c,E):E)),S.length&&(x=Xg(ue(bt(S))),E=i-x[tr[Js[n]]]+m[tr[Js[n]]],n==="n"?s.bottom=u=he(u)?Math.min(u,E):E:n==="w"?s.right=u=he(u)?Math.min(u,E):E:n==="s"?s.top=c=he(c)?Math.max(c,E):E:n==="e"&&(s.left=c=he(c)?Math.max(c,E):E)),d&&d.length&&(d.forEach(function(H){l.has(H)?w.push(H):T.push(H)}),w.length&&(I=ue(bt(w.map(fe))),P=m[tr[Js[n]]]-(I[tr[Js[n]]]-i)),T.length&&(j=ue(bt(T.map(fe))),F=j[tr[n]]-(m[tr[n]]-i)),n==="n"?(E=Math.min(P||1/0,F||1/0),s.bottom=u=he(u)?Math.min(u,E):E):n==="w"?(E=Math.min(P||1/0,F||1/0),s.right=u=he(u)?Math.min(u,E):E):n==="s"?(E=Math.max(P||-1/0,F||-1/0),s.top=c=he(c)?Math.max(c,E):E):n==="e"&&(E=Math.max(P||-1/0,F||-1/0),s.left=c=he(c)?Math.max(c,E):E));var L=r&&r[f.id];L&&(n==="n"?(E=i+f[Pi[t]]-L[Pi[t]],s.bottom=u=he(u)?Math.min(u,E):E):n==="w"?(E=i+f[Pi[t]]-L[Pi[t]],s.right=u=he(u)?Math.min(u,E):E):n==="s"?(E=i-f[Pi[t]]+L[Pi[t]],s.top=c=he(c)?Math.max(c,E):E):n==="e"&&(E=i-f[Pi[t]]+L[Pi[t]],s.left=c=he(c)?Math.max(c,E):E))}),s}}function vP(e){return!!e.host}var fp="djs-dragging",Qg="djs-resizing",yP=250,tc=Math.max;function Jg(e,t,n,i,r){function o(a,s){M(a,function(c){r.addDragger(c,s),n.addMarker(c,fp)})}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=ce("g");ne(l,i.cls("djs-crosshair-group",["no-events"])),ve(s,l);var p=ce("path");ne(p,"d",u.x),Ae(p).add("djs-crosshair"),ve(l,p);var f=ce("path");ne(f,"d",u.y),Ae(f).add("djs-crosshair"),ve(l,f),c.crosshairGroup=l}),e.on("spaceTool.selection.move",function(a){var s=a.context.crosshairGroup;Wt(s,a.x,a.y)}),e.on("spaceTool.selection.cleanup",function(a){var s=a.context,c=s.crosshairGroup;c&&Mt(c)}),e.on("spaceTool.move",yP,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=ce("path"),ne(c,"d","M0,0 L0,0"),Ae(c).add("djs-crosshair"),ve(f,c),s.line=c;var d=ce("g");ne(d,i.cls("djs-drag-group",["no-events"])),ve(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(I){m.has(I)||!Ue(I)||!h.has(I.target)||(m.add(I),g.push(I))})}),o(g,d),s.dragGroup=d}if(!s.frameGroup){var S=ce("g");ne(S,i.cls("djs-frame-group",["no-events"])),ve(n.getActiveLayer(),S);var E=[];M(p,function(T){var I=r.addFrame(T,S),P=I.getBBox();E.push({element:I,initialBounds:P}),n.addMarker(T,Qg)}),s.frameGroup=S,s.frames=E}var b={x:"M"+a.x+", -10000 L"+a.x+", 10000",y:"M -10000, "+a.y+" L 10000, "+a.y};ne(c,{d:b[u]});var x={x:"y",y:"x"},w={x:a.dx,y:a.dy};w[x[s.axis]]=0,Wt(s.dragGroup,w.x,w.y),M(s.frames,function(T){var I=T.element,P=T.initialBounds,j,F;s.direction==="e"?ne(I,{width:tc(P.width+w.x,5)}):(j=tc(P.width-w.x,5),ne(I,{width:j,x:P.x+P.width-j})),s.direction==="s"?ne(I,{height:tc(P.height+w.y,5)}):(F=tc(P.height-w.y,5),ne(I,{height:F,y:P.y+P.height-F}))})}}),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,fp)}),M(u,function(h){n.removeMarker(h,fp)}),f&&(Mt(p),Mt(f)),M(l,function(h){n.removeMarker(h,Qg)}),d&&Mt(d)})}Jg.$inject=["eventBus","elementRegistry","canvas","styles","previewSupport"];const _P={__init__:["spaceToolPreview"],__depends__:[Ci,li,Qs,mo,ia],spaceTool:["type",Fn],spaceToolPreview:["type",Jg]};function nc(e,t){e.invoke(Fn,this),this._canvas=t}nc.$inject=["injector","canvas"],te(nc,Fn),nc.prototype.calculateAdjustments=function(e,t,n,i){var r=this._canvas.getRootElement(),o=e[0]===r?null:e[0],a=[];o&&(a=Vr(Xr(r.children.filter(u=>y(u,"bpmn:Artifact")),bt(o))));const s=[...e,...a];var c=Fn.prototype.calculateAdjustments.call(this,s,t,n,i);return c.resizingShapes=c.resizingShapes.filter(function(u){return!(y(u,"bpmn:TextAnnotation")||bP(u)&&(t==="y"&&Bt(u)||t==="x"&&!Bt(u)))}),c};function bP(e){return y(e,"bpmn:Participant")&&!q(e).processRef}const ev={__depends__:[_P],spaceTool:["type",nc]};function st(e,t){this._handlerMap={},this._stack=[],this._stackIdx=-1,this._currentExecution={actions:[],dirty:[],trigger:null},this._injector=t,this._eventBus=e,this._uid=1,e.on(["diagram.destroy","diagram.clear"],function(){this.clear(!1)},this)}st.$inject=["eventBus","injector"],st.prototype.execute=function(e,t){if(!e)throw new Error("command required");this._currentExecution.trigger="execute";const n={command:e,context:t};this._pushAction(n),this._internalExecute(n),this._popAction()},st.prototype.canExecute=function(e,t){const n={command:e,context:t},i=this._getHandler(e);let r=this._fire(e,"canExecute",n);if(r===void 0){if(!i)return!1;i.canExecute&&(r=i.canExecute(t))}return r},st.prototype.clear=function(e){this._stack.length=0,this._stackIdx=-1,e!==!1&&this._fire("changed",{trigger:"clear"})},st.prototype.undo=function(){let e=this._getUndoAction(),t;if(e){for(this._currentExecution.trigger="undo",this._pushAction(e);e&&(this._internalUndo(e),t=this._getUndoAction(),!(!t||t.id!==e.id));)e=t;this._popAction()}},st.prototype.redo=function(){let e=this._getRedoAction(),t;if(e){for(this._currentExecution.trigger="redo",this._pushAction(e);e&&(this._internalExecute(e,!0),t=this._getRedoAction(),!(!t||t.id!==e.id));)e=t;this._popAction()}},st.prototype.register=function(e,t){this._setHandler(e,t)},st.prototype.registerHandler=function(e,t){if(!e||!t)throw new Error("command and handlerCls must be defined");const n=this._injector.instantiate(t);this.register(e,n)},st.prototype.canUndo=function(){return!!this._getUndoAction()},st.prototype.canRedo=function(){return!!this._getRedoAction()},st.prototype._getRedoAction=function(){return this._stack[this._stackIdx+1]},st.prototype._getUndoAction=function(){return this._stack[this._stackIdx]},st.prototype._internalUndo=function(e){const t=e.command,n=e.context,i=this._getHandler(t);this._atomicDo(()=>{this._fire(t,"revert",e),i.revert&&this._markDirty(i.revert(n)),this._revertedAction(e),this._fire(t,"reverted",e)})},st.prototype._fire=function(e,t,n){arguments.length<3&&(n=t,t=null);const i=t?[e+"."+t,t]:[e];let r;n=this._eventBus.createEvent(n);for(const o of i)if(r=this._eventBus.fire("commandStack."+o,n),n.cancelBubble)break;return r},st.prototype._createId=function(){return this._uid++},st.prototype._atomicDo=function(e){const t=this._currentExecution;t.atomic=!0;try{e()}finally{t.atomic=!1}},st.prototype._internalExecute=function(e,t){const n=e.command,i=e.context,r=this._getHandler(n);if(!r)throw new Error("no command handler registered for <"+n+">");this._pushAction(e),t||(this._fire(n,"preExecute",e),r.preExecute&&r.preExecute(i),this._fire(n,"preExecuted",e)),this._atomicDo(()=>{this._fire(n,"execute",e),r.execute&&this._markDirty(r.execute(i)),this._executedAction(e,t),this._fire(n,"executed",e)}),t||(this._fire(n,"postExecute",e),r.postExecute&&r.postExecute(i),this._fire(n,"postExecuted",e)),this._popAction()},st.prototype._pushAction=function(e){const t=this._currentExecution,n=t.actions,i=n[0];if(t.atomic)throw new Error("illegal invocation in <execute> or <revert> phase (action: "+e.command+")");e.id||(e.id=i&&i.id||this._createId()),n.push(e)},st.prototype._popAction=function(){const e=this._currentExecution,t=e.trigger,n=e.actions,i=e.dirty;n.pop(),n.length||(this._eventBus.fire("elements.changed",{elements:Df("id",i.reverse())}),i.length=0,this._fire("changed",{trigger:t}),e.trigger=null)},st.prototype._markDirty=function(e){const t=this._currentExecution;e&&(e=pe(e)?e:[e],t.dirty=t.dirty.concat(e))},st.prototype._executedAction=function(e,t){const n=++this._stackIdx;t||this._stack.splice(n,this._stack.length,e)},st.prototype._revertedAction=function(e){this._stackIdx--},st.prototype._getHandler=function(e){return this._handlerMap[e]},st.prototype._setHandler=function(e,t){if(!e||!t)throw new Error("command and handler required");if(this._handlerMap[e])throw new Error("overriding handler for command <"+e+">");this._handlerMap[e]=t};const xP={commandStack:["type",st]};function nr(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 EP=250,tv=1400;function dp(e,t,n){W.call(this,t);var i=e.get("movePreview",!1);t.on("shape.move.start",tv,function(r){var o=r.context,a=o.shapes,s=o.validatedShapes;o.shapes=nv(a),o.validatedShapes=nv(s)}),i&&t.on("shape.move.start",EP,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",tv,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;nr(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=Uu(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&&(gt(s.labels,a,c),a.labelTarget=s)})}te(dp,W),dp.$inject=["injector","eventBus","modeling"];function nv(e){var t=new Set(e);return Re(e,function(n){return!t.has(n.labelTarget)})}const wP={__init__:["labelSupport"],labelSupport:["type",dp]};var SP=251,iv=1401,rv="attach-ok";function hp(e,t,n,i,r){W.call(this,t);var o=e.get("movePreview",!1);t.on("shape.move.start",iv,function(a){var s=a.context,c=s.shapes,u=s.validatedShapes;s.shapes=RP(c),s.validatedShapes=CP(u)}),o&&t.on("shape.move.start",SP,function(a){var s=a.context,c=s.shapes,u=mp(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,rv),t.once(["shape.move.out","shape.move.cleanup"],function(){n.removeMarker(l,rv)}))}}),this.preExecuted("elements.move",iv,function(a){var s=a.context,c=s.closure,u=s.shapes,l=mp(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=Re(c,function(p){var f=p.host;return PP(p)&&!AP(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;nr(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=Em(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=Em(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;nr(s.attachers,function(c){r.removeShape(c)}),s.host&&r.updateAttachment(s,null)})}te(hp,W),hp.$inject=["injector","eventBus","canvas","rules","modeling"];function mp(e){return pu(Kt(e,function(t){return t.attachers||[]}))}function RP(e){var t=mp(e);return v0("id",e,t)}function CP(e){var t=Gr(e,"id");return Re(e,function(n){for(;n;){if(n.host&&t[n.host.id])return!1;n=n.parent}return!0})}function PP(e){return!!e.host}function AP(e,t){return e.indexOf(t)!==-1}const TP={__depends__:[li],__init__:["attachSupport"],attachSupport:["type",hp]};function ov(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(Zd(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)})}ov.$inject=["eventBus","canvas","elementRegistry","graphicsFactory"];const gp={__init__:["changeSupport"],changeSupport:["type",ov]};function Hn(e){this._model=e}Hn.$inject=["moddle"],Hn.prototype._needsId=function(e){return Ee(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"])},Hn.prototype._ensureId=function(e){if(e.id){this._model.ids.claim(e.id,e);return}var t;y(e,"bpmn:Activity")?t="Activity":y(e,"bpmn:Event")?t="Event":y(e,"bpmn:Gateway")?t="Gateway":Ee(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))},Hn.prototype.create=function(e,t){var n=this._model.create(e,t||{});return this._ensureId(n),n},Hn.prototype.createDiLabel=function(){return this.create("bpmndi:BPMNLabel",{bounds:this.createDiBounds()})},Hn.prototype.createDiShape=function(e,t){return this.create("bpmndi:BPMNShape",D({bpmnElement:e,bounds:this.createDiBounds()},t))},Hn.prototype.createDiBounds=function(e){return this.create("dc:Bounds",e)},Hn.prototype.createDiWaypoints=function(e){var t=this;return Kt(e,function(n){return t.createDiWaypoint(n)})},Hn.prototype.createDiWaypoint=function(e){return this.create("dc:Point",qn(e,["x","y"]))},Hn.prototype.createDiEdge=function(e,t){return this.create("bpmndi:BPMNEdge",D({bpmnElement:e,waypoint:this.createDiWaypoints([])},t))},Hn.prototype.createDiPlane=function(e,t){return this.create("bpmndi:BPMNPlane",D({bpmnElement:e},t))};function En(e,t,n){W.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"],wn(o)),this.reverted(["shape.move","shape.create","shape.delete","connection.create","connection.move","connection.delete"],wn(a));function s(d){var h=d.context,m=h.oldRoot,g=m.children;M(g,function(S){y(S,"bpmn:BaseElement")&&i.updateParent(S)})}this.executed(["canvas.updateRoot"],s),this.reverted(["canvas.updateRoot"],s);function c(d){var h=d.context.shape;y(h,"bpmn:BaseElement")&&i.updateBounds(h)}this.executed(["shape.move","shape.create","shape.resize"],wn(function(d){d.context.shape.type!=="label"&&c(d)})),this.reverted(["shape.move","shape.create","shape.resize"],wn(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"],wn(u)),this.reverted(["connection.create","connection.move","connection.delete","connection.reconnect"],wn(u));function l(d){i.updateConnectionWaypoints(d.context.connection)}this.executed(["connection.layout","connection.move","connection.updateWaypoints"],wn(l)),this.reverted(["connection.layout","connection.move","connection.updateWaypoints"],wn(l)),this.executed("connection.reconnect",wn(function(d){var h=d.context,m=h.connection,g=h.oldSource,S=h.newSource,E=q(m),b=q(g),x=q(S);E.conditionExpression&&!Ee(x,["bpmn:Activity","bpmn:ExclusiveGateway","bpmn:InclusiveGateway"])&&(h.oldConditionExpression=E.conditionExpression,delete E.conditionExpression),g!==S&&b.default===E&&(h.oldDefault=b.default,delete b.default)})),this.reverted("connection.reconnect",wn(function(d){var h=d.context,m=h.connection,g=h.oldSource,S=h.newSource,E=q(m),b=q(g),x=q(S);h.oldConditionExpression&&(E.conditionExpression=h.oldConditionExpression),h.oldDefault&&(b.default=h.oldDefault,delete x.default)}));function p(d){i.updateAttachment(d.context)}this.executed(["element.updateAttachment"],wn(p)),this.reverted(["element.updateAttachment"],wn(p)),this.executed("element.updateLabel",wn(f)),this.reverted("element.updateLabel",wn(f));function f(d){const{element:h}=d.context,m=Mn(h),g=ke(h),S=g&&g.get("label");Ki(h)||zs(h)||(m&&!S?g.set("label",t.create("bpmndi:BPMNLabel")):!m&&S&&g.set("label",void 0))}}te(En,W),En.$inject=["eventBus","bpmnFactory","connectionDocking"],En.prototype.updateAttachment=function(e){var t=e.shape,n=t.businessObject,i=t.host;n.attachedToRef=i&&i.businessObject},En.prototype.updateParent=function(e,t){if(!xe(e)&&!(y(e,"bpmn:DataStoreReference")&&e.parent&&y(e.parent,"bpmn:Collaboration"))){var n=e.parent,i=e.businessObject,r=ke(e),o=n&&n.businessObject,a=ke(n);y(e,"bpmn:FlowNode")&&this.updateFlowNodeRefs(i,o,t&&t.businessObject),y(e,"bpmn:DataOutputAssociation")&&(e.source?o=e.source.businessObject:o=null),y(e,"bpmn:DataInputAssociation")&&(e.target?o=e.target.businessObject:o=null),this.updateSemanticParent(i,o),y(e,"bpmn:DataObjectReference")&&i.dataObjectRef&&this.updateSemanticParent(i.dataObjectRef,o),this.updateDiParent(r,a)}},En.prototype.updateBounds=function(e){var t=ke(e),n=kP(e);if(n){var i=Kn(n,t.get("bounds"));D(n,{x:e.x+i.x,y:e.y+i.y})}var r=xe(e)?this._getLabel(t):t,o=r.bounds;o||(o=this._bpmnFactory.createDiBounds(),r.set("bounds",o)),D(o,{x:e.x,y:e.y,width:e.width,height:e.height})},En.prototype.updateFlowNodeRefs=function(e,t,n){if(n!==t){var i,r;y(n,"bpmn:Lane")&&(i=n.get("flowNodeRef"),pt(i,e)),y(t,"bpmn:Lane")&&(r=t.get("flowNodeRef"),gt(r,e))}},En.prototype.updateDiConnection=function(e,t,n){var i=ke(e),r=ke(t),o=ke(n);i.sourceElement&&i.sourceElement.bpmnElement!==q(t)&&(i.sourceElement=t&&r),i.targetElement&&i.targetElement.bpmnElement!==q(n)&&(i.targetElement=n&&o)},En.prototype.updateDiParent=function(e,t){if(t&&!y(t,"bpmndi:BPMNPlane")&&(t=t.$parent),e.$parent!==t){var n=(t||e.$parent).get("planeElement");t?(n.push(e),e.$parent=t):(pt(n,e),e.$parent=null)}};function MP(e){for(;e&&!y(e,"bpmn:Definitions");)e=e.$parent;return e}En.prototype.getLaneSet=function(e){var t,n;return y(e,"bpmn:Lane")?(t=e.childLaneSet,t||(t=this._bpmnFactory.create("bpmn:LaneSet"),e.childLaneSet=t,t.$parent=e),t):(y(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)},En.prototype.updateSemanticParent=function(e,t,n){var i;if(e.$parent!==t&&!((y(e,"bpmn:DataInput")||y(e,"bpmn:DataOutput"))&&(y(t,"bpmn:Participant")&&"processRef"in t&&(t=t.processRef),"ioSpecification"in t&&t.ioSpecification===e.$parent))){if(y(e,"bpmn:Lane"))t&&(t=this.getLaneSet(t)),i="lanes";else if(y(e,"bpmn:FlowElement")){if(t){if(y(t,"bpmn:Participant"))t=t.processRef;else if(y(t,"bpmn:Lane"))do t=t.$parent.$parent;while(y(t,"bpmn:Lane"))}i="flowElements"}else if(y(e,"bpmn:Artifact")){for(;t&&!y(t,"bpmn:Process")&&!y(t,"bpmn:SubProcess")&&!y(t,"bpmn:Collaboration");)if(y(t,"bpmn:Participant")){t=t.processRef;break}else t=t.$parent;i="artifacts"}else if(y(e,"bpmn:MessageFlow"))i="messageFlows";else if(y(e,"bpmn:Participant")){i="participants";var r=e.processRef,o;r&&(o=MP(e.$parent||t),e.$parent&&(pt(o.get("rootElements"),r),r.$parent=null),t&&(gt(o.get("rootElements"),r),r.$parent=o))}else y(e,"bpmn:DataOutputAssociation")?i="dataOutputAssociations":y(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),pt(a,e)),t?(a=t.get(i),a.push(e),e.$parent=t):e.$parent=null,n){var s=n.get(i);pt(a,e),t&&(s||(s=[],t.set(i,s)),s.push(e))}}},En.prototype.updateConnectionWaypoints=function(e){var t=ke(e);t.set("waypoint",this._bpmnFactory.createDiWaypoints(e.waypoints))},En.prototype.updateConnection=function(e){var t=e.connection,n=q(t),i=t.source,r=q(i),o=t.target,a=q(t.target),s;if(y(n,"bpmn:DataAssociation"))y(n,"bpmn:DataInputAssociation")?(n.get("sourceRef")[0]=r,s=e.parent||e.newParent||a,this.updateSemanticParent(n,a,s)):y(n,"bpmn:DataOutputAssociation")&&(s=e.parent||e.newParent||r,this.updateSemanticParent(n,r,s),n.targetRef=a);else{var c=y(n,"bpmn:SequenceFlow");n.sourceRef!==r&&(c&&(pt(n.sourceRef&&n.sourceRef.get("outgoing"),n),r&&r.get("outgoing")&&r.get("outgoing").push(n)),n.sourceRef=r),n.targetRef!==a&&(c&&(pt(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)},En.prototype._getLabel=function(e){return e.label||(e.label=this._bpmnFactory.createDiLabel()),e.label};function wn(e){return function(t){var n=t.context,i=n.shape||n.connection||n.element;y(i,"bpmn:BaseElement")&&e(t)}}function kP(e){if(y(e,"bpmn:Activity")){var t=ke(e);if(t){var n=t.get("label");if(n)return n.get("bounds")}}}function ir(e,t){Ei.call(this),this._bpmnFactory=e,this._moddle=t}te(ir,Ei),ir.$inject=["bpmnFactory","moddle"],ir.prototype._baseCreate=Ei.prototype.create,ir.prototype.create=function(e,t){if(e==="label"){var n=t.di||this._bpmnFactory.createDiLabel();return this._baseCreate(e,D({type:"label",di:n},Pr,t))}return this.createElement(e,t)},ir.prototype.createElement=function(e,t){t=D({},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(!OP(r)){var o=D({},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)}y(i,"bpmn:Group")&&(t=D({isFrame:!0},t)),t=DP(i,t,["processRef","isInterrupting","associationDirection","isForCompensation"]),t.isExpanded&&(t=vp(r,t,"isExpanded")),Ee(i,["bpmn:Lane","bpmn:Participant"])&&(t=vp(r,t,"isHorizontal")),y(i,"bpmn:SubProcess")&&(t.collapsed=!Pe(i,r)),y(i,"bpmn:ExclusiveGateway")&&(mn(r,"isMarkerVisible")?r.isMarkerVisible===void 0&&(r.isMarkerVisible=!1):r.isMarkerVisible=!0),At(t.triggeredByEvent)&&(i.triggeredByEvent=t.triggeredByEvent,delete t.triggeredByEvent),At(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=D({id:i.id},n,t,{businessObject:i,di:r}),this._baseCreate(e,t)},ir.prototype.getDefaultSize=function(e,t){var n=q(e);if(t=t||ke(e),y(n,"bpmn:SubProcess"))return Pe(n,t)?{width:350,height:200}:{width:100,height:80};if(y(n,"bpmn:Task"))return{width:100,height:80};if(y(n,"bpmn:Gateway"))return{width:50,height:50};if(y(n,"bpmn:Event"))return{width:36,height:36};if(y(n,"bpmn:Participant")){var i=t.isHorizontal===void 0||t.isHorizontal===!0;return Pe(n,t)?i?{width:600,height:250}:{width:250,height:600}:i?{width:400,height:60}:{width:60,height:400}}return y(n,"bpmn:Lane")?{width:400,height:100}:y(n,"bpmn:DataObjectReference")?{width:36,height:50}:y(n,"bpmn:DataStoreReference")?{width:50,height:50}:y(n,"bpmn:TextAnnotation")?{width:100,height:40}:y(n,"bpmn:Group")?{width:300,height:300}:{width:100,height:80}},ir.prototype.createParticipantShape=function(e){return It(e)||(e={isExpanded:e}),e=D({type:"bpmn:Participant"},e||{}),e.isExpanded!==!1&&(e.processRef=this._bpmnFactory.create("bpmn:Process")),this.createShape(e)};function DP(e,t,n){return M(n,function(i){t=vp(e,t,i)}),t}function vp(e,t,n){return t[n]===void 0?t:(e[n]=t[n],ei(t,[n]))}function OP(e){return Ee(e,["bpmndi:BPMNShape","bpmndi:BPMNEdge","bpmndi:BPMNDiagram","bpmndi:BPMNPlane"])}function ic(e,t){this._modeling=e,this._canvas=t}ic.$inject=["modeling","canvas"],ic.prototype.preExecute=function(e){var t=this._modeling,n=e.elements,i=e.alignment;M(n,function(r){var o={x:0,y:0};At(i.left)?o.x=i.left-r.x:At(i.right)?o.x=i.right-r.width-r.x:At(i.center)?o.x=i.center-Math.round(r.width/2)-r.x:At(i.top)?o.y=i.top-r.y:At(i.bottom)?o.y=i.bottom-r.height-r.y:At(i.middle)&&(o.y=i.middle-Math.round(r.height/2)-r.y),t.moveElements([r],o,r.parent)})},ic.prototype.postExecute=function(e){};function rc(e){this._modeling=e}rc.$inject=["modeling"],rc.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},rc.prototype.postExecute=function(e){var t=e.hints||{};IP(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 IP(e,t){return Li(e.outgoing,function(n){return n.target===t})}function oc(e,t){this._canvas=e,this._layouter=t}oc.$inject=["canvas","layouter"],oc.prototype.execute=function(e){var t=e.connection,n=e.source,i=e.target,r=e.parent,o=e.parentIndex,a=e.hints;if(!n||!i)throw new Error("source and target required");if(!r)throw new Error("parent required");return t.source=n,t.target=i,t.waypoints||(t.waypoints=this._layouter.layoutConnection(t,a)),this._canvas.addConnection(t,r,o),t},oc.prototype.revert=function(e){var t=e.connection;return this._canvas.removeConnection(t),t.source=null,t.target=null,t};var ac=Math.round;function yp(e){this._modeling=e}yp.$inject=["modeling"],yp.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){he(p.x)||(p.x=0),he(p.y)||(p.y=0)});var s=Re(t,function(p){return!p.hidden}),c=bt(s);M(t,function(p){Ue(p)&&(p.waypoints=Kt(p.waypoints,function(f){return{x:ac(f.x-c.x-c.width/2+r.x),y:ac(f.y-c.y-c.height/2+r.y)}})),D(p,{x:ac(p.x-c.x-c.width/2+r.x),y:ac(p.y-c.y-c.height/2+r.y)})});var u=new Set(cs(t)),l={};M(t,function(p){if(Ue(p)){l[p.id]=he(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=D({},o);u.has(p)||(f.autoResize=!1),xe(p)&&(f=ei(f,["attach"])),l[p.id]=he(i)?a.createShape(p,qn(p,["x","y","width","height"]),p.parent||n,i,f):a.createShape(p,qn(p,["x","y","width","height"]),p.parent||n,f)}),e.elements=Vr(l)};var av=Math.round;function rr(e){this._canvas=e}rr.$inject=["canvas"],rr.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?D(t,n):D(t,{x:n.x-av(t.width/2),y:n.y-av(t.height/2)}),this._canvas.addShape(t,i,r),t},rr.prototype.revert=function(e){var t=e.shape;return this._canvas.removeShape(t),t};function oa(e){rr.call(this,e)}te(oa,rr),oa.$inject=["canvas"];var LP=rr.prototype.execute;oa.prototype.execute=function(e){var t=e.shape;return BP(t),t.labelTarget=e.labelTarget,LP.call(this,e)};var NP=rr.prototype.revert;oa.prototype.revert=function(e){return e.shape.labelTarget=null,NP.call(this,e)};function BP(e){["width","height"].forEach(function(t){typeof e[t]>"u"&&(e[t]=0)})}function aa(e,t){this._canvas=e,this._modeling=t}aa.$inject=["canvas","modeling"],aa.prototype.preExecute=function(e){var t=this._modeling,n=e.connection;nr(n.incoming,function(i){t.removeConnection(i,{nested:!0})}),nr(n.outgoing,function(i){t.removeConnection(i,{nested:!0})})},aa.prototype.execute=function(e){var t=e.connection,n=t.parent;return e.parent=n,e.parentIndex=Uu(n.children,t),e.source=t.source,e.target=t.target,this._canvas.removeConnection(t),t.source=null,t.target=null,t},aa.prototype.revert=function(e){var t=e.connection,n=e.parent,i=e.parentIndex;return t.source=e.source,t.target=e.target,gt(n.children,t,i),this._canvas.addConnection(t,n),t};function _p(e,t){this._modeling=e,this._elementRegistry=t}_p.$inject=["modeling","elementRegistry"],_p.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 sa(e,t){this._canvas=e,this._modeling=t}sa.$inject=["canvas","modeling"],sa.prototype.preExecute=function(e){var t=this._modeling,n=e.shape;nr(n.incoming,function(i){t.removeConnection(i,{nested:!0})}),nr(n.outgoing,function(i){t.removeConnection(i,{nested:!0})}),nr(n.children,function(i){Ue(i)?t.removeConnection(i,{nested:!0}):t.removeShape(i,{nested:!0})})},sa.prototype.execute=function(e){var t=this._canvas,n=e.shape,i=n.parent;return e.oldParent=i,e.oldParentIndex=Uu(i.children,n),t.removeShape(n),n},sa.prototype.revert=function(e){var t=this._canvas,n=e.shape,i=e.oldParent,r=e.oldParentIndex;return gt(i.children,n,r),t.addShape(n,i),n};function sc(e){this._modeling=e}sc.$inject=["modeling"];var sv={x:"y",y:"x"};sc.prototype.preExecute=function(e){var t=this._modeling,n=e.groups,i=e.axis,r=e.dimension;function o(g,S){g.range.min=Math.min(S[i],g.range.min),g.range.max=Math.max(S[i]+S[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,S){var E={y:0};E[i]=g-a(S),E[i]&&(E[sv[i]]=0,t.moveElements([S],E,S.parent))}var l=n[0],p=s(n),f=n[p],d,h,m=0;M(n,function(g,S){var E,b,x;if(g.elements.length<2){S&&S!==n.length-1&&(o(g,g.elements[0]),m+=c(g.range));return}E=Jn(g.elements,i),b=E[0],S===p&&(b=E[s(E)]),x=a(b),g.range=null,M(E,function(w){if(u(x,w),g.range===null){g.range={min:w[i],max:w[i]+w[r]};return}o(g,w)}),S&&S!==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,S){var E={},b;g===l||g===f||(b=n[S-1],g.range.max=0,M(g.elements,function(x,w){E[sv[i]]=0,E[i]=b.range.max-x[i]+d,g.range.min!==x[i]&&(E[i]+=x[i]-g.range.min),E[i]&&t.moveElements([x],E,x.parent),g.range.max=Math.max(x[i]+x[r],w?g.range.max:0)}))})},sc.prototype.postExecute=function(e){};function cc(e,t){this._layouter=e,this._canvas=t}cc.$inject=["layouter","canvas"],cc.prototype.execute=function(e){var t=e.connection,n=t.waypoints;return D(e,{oldWaypoints:n}),t.waypoints=this._layouter.layoutConnection(t,e.hints),t},cc.prototype.revert=function(e){var t=e.connection;return t.waypoints=e.oldWaypoints,t};function bp(){}bp.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=pt(o.children,t),gt(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},bp.prototype.revert=function(e){var t=e.connection,n=t.parent,i=e.oldParent,r=e.oldParentIndex,o=e.delta;return pt(n.children,t),gt(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 xp(){this.allShapes={},this.allConnections={},this.enclosedElements={},this.enclosedConnections={},this.topLevel={}}xp.prototype.add=function(e,t){return this.addAll([e],t)},xp.prototype.addAll=function(e,t){var n=dw(e,!!t,this);return D(this,n),this};function ca(e){this._modeling=e}ca.prototype.moveRecursive=function(e,t,n){return e?this.moveClosure(this.getClosure(e),t,n):[]},ca.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&&Al(p,p.source,t),connectionEnd:d&&Tl(p,p.target,t)})})},ca.prototype.getClosure=function(e){return new xp().addAll(e,!0)};function uc(e){this._helper=new ca(e)}uc.$inject=["modeling"],uc.prototype.preExecute=function(e){e.closure=this._helper.getClosure(e.shapes)},uc.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 Or(e){this._modeling=e,this._helper=new ca(e)}Or.$inject=["modeling"],Or.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=qn(t,["x","y","width","height"]),e.oldParent=o,e.oldParentIndex=pt(o.children,t),gt(i.children,t,r),D(t,{parent:i,x:t.x+n.x,y:t.y+n.y}),t},Or.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:Tl(o,t,n)})}),M(t.outgoing,function(o){r.layoutConnection(o,{connectionStart:Al(o,t,n)})})),i.recurse!==!1&&this.moveChildren(e)},Or.prototype.revert=function(e){var t=e.shape,n=e.oldParent,i=e.oldParentIndex,r=e.delta;return gt(n.children,t,i),D(t,{parent:n,x:t.x-r.x,y:t.y-r.y}),t},Or.prototype.moveChildren=function(e){var t=e.delta,n=e.shape;this._helper.moveRecursive(n.children,t,null)},Or.prototype.getNewParent=function(e){return e.newParent||e.shape.parent};function ua(e){this._modeling=e}ua.$inject=["modeling"],ua.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 pe(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},ua.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||cv(pe(r)?r[0]:r)),i&&(!n||o.docking==="target")&&(a.connectionEnd=a.connectionEnd||cv(pe(r)?r[r.length-1]:r)),o.newWaypoints&&(a.waypoints=o.newWaypoints),this._modeling.layoutConnection(t,a))},ua.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 cv(e){return e.original||e}function Ai(e,t){this._modeling=e,this._rules=t}Ai.$inject=["modeling","rules"],Ai.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,Ns(h,s,l),a)}),M(d,function(h){var m=h.target,g=c(s,m,h);g&&t.reconnectStart(h,s,Ls(h,s,l),a)})},Ai.prototype.postExecute=function(e){var t=e.oldShape;this._modeling.removeShape(t)},Ai.prototype.execute=function(e){},Ai.prototype.revert=function(e){},Ai.prototype.createShape=function(e,t,n,i){return this._modeling.createShape(e,t,n,i)},Ai.prototype.reconnectStart=function(e,t,n,i){this._modeling.reconnectStart(e,t,n,i)},Ai.prototype.reconnectEnd=function(e,t,n,i){this._modeling.reconnectEnd(e,t,n,i)};function la(e){this._modeling=e}la.$inject=["modeling"],la.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},D(t,{width:n.width,height:n.height,x:n.x,y:n.y}),t},la.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:Ns(o,n,i)})}),M(n.outgoing,function(o){t.layoutConnection(o,{connectionStart:Ls(o,n,i)})}))},la.prototype.revert=function(e){var t=e.shape,n=e.oldBounds;return D(t,{width:n.width,height:n.height,x:n.x,y:n.y}),t};function or(e){this._modeling=e}or.$inject=["modeling"],or.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]=jP(s)}),this.resizeShapes(r,t,n),this.updateConnectionWaypoints(fP(i,r),t,n,o,i,r,a)},or.prototype.execute=function(){},or.prototype.revert=function(){},or.prototype.moveShapes=function(e,t){var n=this;M(e,function(i){n._modeling.moveShape(i,t,null,{autoResize:!1,layout:!1,recurse:!1})})},or.prototype.resizeShapes=function(e,t,n){var i=this;M(e,function(r){var o=dP(r,n,t);i._modeling.resizeShape(r,o,null,{attachSupport:!1,autoResize:!1,layout:!1})})},or.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=$P(l),h=lv(n),m={},g=c.has(p)||u.has(p),S=c.has(f)||u.has(f);g&&S?(d=Kt(d,function(E){return pv(E,i,n)&&(E[h]=E[h]+t[h]),E.original&&pv(E.original,i,n)&&(E.original[h]=E.original[h]+t[h]),E}),s._modeling.updateWaypoints(l,d,{labelBehavior:!1})):(g||S)&&(c.has(p)?m.connectionStart=Al(l,p,t):c.has(f)?m.connectionEnd=Tl(l,f,t):u.has(p)?m.connectionStart=Ls(l,p,a[p.id]):u.has(f)&&(m.connectionEnd=Ns(l,f,a[f.id])),s._modeling.layoutConnection(l,m))})};function uv(e){return D({},e)}function $P(e){return Kt(e.waypoints,function(t){return t=uv(t),t.original&&(t.original=uv(t.original)),t})}function lv(e){switch(e){case"n":return"y";case"w":return"x";case"s":return"y";case"e":return"x"}}function pv(e,t,n){var i=lv(n);if(/e|s/.test(n))return e[i]>t;if(/n|w/.test(n))return e[i]<t}function jP(e){return{x:e.x,y:e.y,height:e.height,width:e.width}}function lc(e){this._modeling=e}lc.$inject=["modeling"],lc.prototype.execute=function(e){var t=e.shape,n=t.children;e.oldChildrenVisibility=fv(n),t.collapsed=!t.collapsed;var i=dv(n,t.collapsed);return[t].concat(i)},lc.prototype.revert=function(e){var t=e.shape,n=e.oldChildrenVisibility,i=t.children,r=hv(i,n);return t.collapsed=!t.collapsed,[t].concat(r)};function fv(e){var t={};return M(e,function(n){t[n.id]=n.hidden,n.children&&(t=D({},t,fv(n.children)))}),t}function dv(e,t){var n=[];return M(e,function(i){i.hidden=t,n=n.concat(i),i.children&&(n=n.concat(dv(i.children,i.collapsed||t)))}),n}function hv(e,t){var n=[];return M(e,function(i){i.hidden=t[i.id],n=n.concat(i),i.children&&(n=n.concat(hv(i.children,t)))}),n}function pc(e){this._modeling=e}pc.$inject=["modeling"],pc.prototype.execute=function(e){var t=e.shape,n=e.newHost,i=t.host;return e.oldHost=i,e.attacherIdx=mv(i,t),gv(n,t),t.host=n,t},pc.prototype.revert=function(e){var t=e.shape,n=e.newHost,i=e.oldHost,r=e.attacherIdx;return t.host=i,mv(n,t),gv(i,t,r),t};function mv(e,t){return pt(e&&e.attachers,t)}function gv(e,t,n){if(e){var i=e.attachers;i||(e.attachers=i=[]),gt(i,t,n)}}function Ep(){}Ep.prototype.execute=function(e){var t=e.connection,n=e.newWaypoints;return e.oldWaypoints=t.waypoints,t.waypoints=n,t},Ep.prototype.revert=function(e){var t=e.connection,n=e.oldWaypoints;return t.waypoints=n,t};function qe(e,t,n){this._eventBus=e,this._elementFactory=t,this._commandStack=n;var i=this;e.on("diagram.init",function(){i.registerHandlers(n)})}qe.$inject=["eventBus","elementFactory","commandStack"],qe.prototype.getHandlers=function(){return{"shape.append":rc,"shape.create":rr,"shape.delete":sa,"shape.move":Or,"shape.resize":la,"shape.replace":Ai,"shape.toggleCollapse":lc,spaceTool:or,"label.create":oa,"connection.create":oc,"connection.delete":aa,"connection.move":bp,"connection.layout":cc,"connection.updateWaypoints":Ep,"connection.reconnect":ua,"elements.create":yp,"elements.move":uc,"elements.delete":_p,"elements.distribute":sc,"elements.align":ic,"element.updateAttachment":pc}},qe.prototype.registerHandlers=function(e){M(this.getHandlers(),function(t,n){e.registerHandler(n,t)})},qe.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)},qe.prototype.updateAttachment=function(e,t){var n={shape:e,newHost:t};this._commandStack.execute("element.updateAttachment",n)},qe.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)},qe.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)},qe.prototype.layoutConnection=function(e,t){var n={connection:e,hints:t||{}};this._commandStack.execute("connection.layout",n)},qe.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},qe.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},qe.prototype.createElements=function(e,t,n,i,r){pe(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},qe.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},qe.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},qe.prototype.removeElements=function(e){var t={elements:e};this._commandStack.execute("elements.delete",t)},qe.prototype.distributeElements=function(e,t,n){var i={groups:e,axis:t,dimension:n};this._commandStack.execute("elements.distribute",i)},qe.prototype.removeShape=function(e,t){var n={shape:e,hints:t||{}};this._commandStack.execute("shape.delete",n)},qe.prototype.removeConnection=function(e,t){var n={connection:e,hints:t||{}};this._commandStack.execute("connection.delete",n)},qe.prototype.replaceShape=function(e,t,n){var i={oldShape:e,newData:t,hints:n||{}};return this._commandStack.execute("shape.replace",i),i.newShape},qe.prototype.alignElements=function(e,t){var n={elements:e,alignment:t};this._commandStack.execute("elements.align",n)},qe.prototype.resizeShape=function(e,t,n,i){var r={shape:e,newBounds:t,minBounds:n,hints:i};this._commandStack.execute("shape.resize",r)},qe.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)},qe.prototype.updateWaypoints=function(e,t,n){var i={connection:e,newWaypoints:t,hints:n||{}};this._commandStack.execute("connection.updateWaypoints",i)},qe.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)},qe.prototype.reconnectStart=function(e,t,n,i){i||(i={}),this.reconnect(e,t,e.target,n,D(i,{docking:"source"}))},qe.prototype.reconnectEnd=function(e,t,n,i){i||(i={}),this.reconnect(e,e.source,t,n,D(i,{docking:"target"}))},qe.prototype.connect=function(e,t,n,i){return this.createConnection(e,t,n||{},e.parent,i)},qe.prototype._create=function(e,t){return Qw(t)?t:this._elementFactory.create(e,t)},qe.prototype.toggleCollapse=function(e,t){var n={shape:e,hints:t||{}};this._commandStack.execute("shape.toggleCollapse",n)};function pa(e){this._elementRegistry=e}pa.$inject=["elementRegistry"],pa.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||FP(n,Fa(i));return vv(n,i),e.oldProperties=o,e.changed=r,r},pa.prototype.revert=function(e){var t=e.oldProperties,n=e.moddleElement,i=e.changed;return vv(n,t),i},pa.prototype._getVisualReferences=function(e){var t=this._elementRegistry;return y(e,"bpmn:DataObject")?HP(e,t):[]};function FP(e,t){return gn(t,function(n,i){return n[i]=e.get(i),n},{})}function vv(e,t){M(t,function(n,i){e.set(i,n)})}function HP(e,t){return t.filter(function(n){return y(n,"bpmn:DataObjectReference")&&q(n).dataObjectRef===e})}var fa="default",Ti="id",yv="di",zP={width:0,height:0};function da(e,t,n,i){this._elementRegistry=e,this._moddle=t,this._modeling=n,this._textRenderer=i}da.$inject=["elementRegistry","moddle","modeling","textRenderer"],da.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=qP(e.properties),s=e.oldProperties||VP(t,a);return _v(a,o)&&(r.unclaim(o[Ti]),i.updateId(t,a[Ti]),r.claim(a[Ti],o)),fa in a&&(a[fa]&&n.push(i.get(a[fa].id)),o[fa]&&n.push(i.get(o[fa].id))),bv(t,a),e.oldProperties=s,e.changed=n,n},da.prototype.postExecute=function(e){var t=e.element,n=t.label,i=n&&q(n).name;if(i){var r=this._textRenderer.getExternalLabelBounds(n,i);this._modeling.resizeShape(n,r,zP)}},da.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 bv(t,i),_v(n,r)&&(a.unclaim(n[Ti]),o.updateId(t,i[Ti]),a.claim(i[Ti],r)),e.changed};function _v(e,t){return Ti in e&&e[Ti]!==t[Ti]}function VP(e,t){var n=Fa(t),i=e.businessObject,r=ke(e);return gn(n,function(o,a){return a!==yv?o[a]=i.get(a):o[a]=GP(r,Fa(t.di)),o},{})}function GP(e,t){return gn(t,function(n,i){return n[i]=e&&e.get(i),n},{})}function bv(e,t){var n=e.businessObject,i=ke(e);M(t,function(r,o){o!==yv?n.set(o,r):i&&WP(i,r)})}function WP(e,t){M(t,function(n,i){e.set(i,n)})}var UP=["default"];function qP(e){var t=D({},e);return UP.forEach(function(n){n in e&&(t[n]=q(t[n]))}),t}function fc(e,t){this._canvas=e,this._modeling=t}fc.$inject=["canvas","modeling"],fc.prototype.execute=function(e){var t=this._canvas,n=e.newRoot,i=n.businessObject,r=t.getRootElement(),o=r.businessObject,a=o.$parent,s=ke(r);return t.setRootElement(n),t.removeRootElement(r),gt(a.rootElements,i),i.$parent=a,pt(a.rootElements,o),o.$parent=null,r.di=null,s.bpmnElement=i,n.di=s,e.oldRoot=r,[]},fc.prototype.revert=function(e){var t=this._canvas,n=e.newRoot,i=n.businessObject,r=e.oldRoot,o=r.businessObject,a=i.$parent,s=ke(n);return t.setRootElement(r),t.removeRootElement(n),pt(a.rootElements,i),i.$parent=null,gt(a.rootElements,o),o.$parent=a,n.di=null,s.bpmnElement=o,r.di=s,[]};function wp(e,t){this._modeling=e,this._spaceTool=t}wp.$inject=["modeling","spaceTool"],wp.prototype.preExecute=function(e){var t=this._spaceTool,n=this._modeling,i=e.shape,r=e.location,o=Bn(i),a=o===i,s=a?i:i.parent,c=Zi(s),u=Bt(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+Nn,y:i.y,width:i.width-Nn,height:i.height}:{x:i.x,y:i.y+Nn,width:i.width,height:i.height-Nn};n.createShape({type:"bpmn:Lane",isHorizontal:u},l,s)}var p=[];Rr(o,function(x){return p.push(x),x.label&&p.push(x.label),x===i?[]:Re(x.children,function(w){return w!==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 S=t.calculateAdjustments(p,g,f,h),E=u?{x:0,y:f}:{x:f,y:0};t.makeSpace(S.movingShapes,S.resizingShapes,E,m,h);var b=u?{x:i.x+(a?Nn:0),y:d-(r==="top"?120:0),width:i.width-(a?Nn:0),height:120}:{x:d-(r==="left"?120:0),y:i.y+(a?Nn:0),width:120,height:i.height-(a?Nn:0)};e.newLane=n.createShape({type:"bpmn:Lane",isHorizontal:u},b,s)};function Sp(e){this._modeling=e}Sp.$inject=["modeling"],Sp.prototype.preExecute=function(e){var t=this._modeling,n=e.shape,i=e.count,r=Zi(n),o=r.length;if(o>i)throw new Error(`more than <${i}> child lanes`);var a=Bt(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+Nn,y:n.y+f*c,width:n.width-Nn,height:u}:{x:n.x+f*c,y:n.y+Nn,width:u,height:n.height-Nn},f<o?t.resizeShape(r[f],l):(p={type:"bpmn:Lane",isHorizontal:a},t.createShape(p,l,n))};function ha(e,t){this._modeling=e,this._spaceTool=t}ha.$inject=["modeling","spaceTool"],ha.prototype.preExecute=function(e){var t=e.shape,n=e.newBounds,i=e.balanced;i!==!1?this.resizeBalanced(t,n):this.resizeSpace(t,n)},ha.prototype.resizeBalanced=function(e,t){var n=this._modeling,i=HS(e,t);n.resizeShape(e,t),i.forEach(function(r){n.resizeShape(r.shape,r.newBounds)})},ha.prototype.resizeSpace=function(e,t){var n=this._spaceTool,i=ue(e),r=ue(t),o=Qh(r,i),a=Bn(e),s=[],c=[];Rr(a,function(h){return s.push(h),(y(h,"bpmn:Lane")||y(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 ma="flowNodeRef",Rp="lanes";function dc(){}dc.prototype._computeUpdates=function(e,t){var n=[],i=[],r={},o=[];function a(l,p){var f=ue(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=Bn(l);return r[p.id]||(r[p.id]=Ms(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=Bn(l);if(!(!p||n.indexOf(p)!==-1)){var f=p.children.filter(function(d){return y(d,"bpmn:FlowNode")});f.forEach(s),n.push(p)}}),e.forEach(s),o.forEach(function(l){var p=l.businessObject,f=p.get(Rp),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(ma).forEach(function(f){i.push({flowNode:f,remove:[p],add:[]})})}),i},dc.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(Rp);n.remove.forEach(function(o){pt(r,o),pt(o.get(ma),i)}),n.add.forEach(function(o){gt(r,o),gt(o.get(ma),i)})}),[]},dc.prototype.revert=function(e){var t=e.updates;return t.forEach(function(n){var i=n.flowNode,r=i.get(Rp);n.add.forEach(function(o){pt(r,o),pt(o.get(ma),i)}),n.remove.forEach(function(o){gt(r,o),gt(o.get(ma),i)})}),[]};var Cp="categoryValueRef";function ga(e,t){this._bpmnFactory=e,this._elementRegistry=t}ga.$inject=["bpmnFactory","elementRegistry"],ga.prototype._computeUpdates=function(e,t){var n=this._elementRegistry,i=this._bpmnFactory,r=new Map,o=[],a=new Map;function s(E,b,x){if(b){var w=a.get(E);w||(w={},a.set(E,w)),!(x&&w.present)&&(!x&&w.past||(x?w.present={categoryValue:b,root:Pp(E)}:w.past={categoryValue:b}))}}function c(E){r.set(E,q(E))}function u(){n.filter(function(E){return y(E,"bpmn:FlowElement")&&!xe(E)&&E.parent}).forEach(c)}function l(E){var b=q(E),x=b.get("categoryValueRef");return x||(x=qh(i,b),o.push(YP(E,x))),x}function p(E){return E.reduce(function(b,x){var w=Pp(x),T=b.get(w);return T||(T=[],b.set(w,T)),T.push(x),b},new Map)}e=Array.from(e||[]);var f=p(e);t.length&&u(),e.forEach(c),n.filter(function(E){return y(E,"bpmn:Group")&&!xe(E)&&E.parent}).forEach(function(E){var b=q(E).get("categoryValueRef");if(!b){var x=Pp(E),w=f.get(x)||[],T=Xr(w,E),I=Object.keys(T).length>0;I&&(b=l(E))}s(E,b,!0)}),t.forEach(function(E){s(E.groupShape,E.categoryValue,!1)}),o.length&&u();var d=Array.from(r.keys()),h=Array.from(a.values()).reduce(function(E,b){return b.present&&E.add(b.present.categoryValue),b.past&&E.add(b.past.categoryValue),E},new Set),m=new Map,g=p(d);a.forEach(function(E,b){var x=E.present;if(x){var w=g.get(x.root)||[],T=Xr(w,b);w.forEach(function(I){if(T[I.id]){var P=m.get(I);P||(P=new Set,m.set(I,P)),P.add(x.categoryValue)}})}});var S=d.reduce(function(E,b){var x=r.get(b),w=x.get(Cp),T=new Set(w),I=m.get(b)||new Set,P=Array.from(I).filter(function(F){return!T.has(F)}),j=w.filter(function(F){return h.has(F)&&!I.has(F)});return(P.length||j.length)&&E.push({businessObject:x,categoryValuesToAdd:P,categoryValuesToRemove:j}),E},[]);return{flowElements:S,groups:o}},ga.prototype.execute=function(e){var t=e.updates;return t||(t=e.updates=this._computeUpdates(e.affectedFlowElements,e.affectedGroupEntries)),KP(t.groups),ZP(t.flowElements),[]},ga.prototype.revert=function(e){var t=e.updates;return QP(t.flowElements),XP(t.groups),[]};function YP(e,t){return{groupShape:e,categoryValue:t,category:t.$parent}}function KP(e){e.forEach(function(t){q(t.groupShape).categoryValueRef=t.categoryValue,t.categoryValue.$parent=t.category})}function XP(e){e.forEach(function(t){q(t.groupShape).categoryValueRef=null})}function ZP(e){e.forEach(function(t){var n=t.businessObject,i=n.get(Cp);t.categoryValuesToRemove.forEach(function(r){pt(i,r)}),t.categoryValuesToAdd.forEach(function(r){gt(i,r,!0)})})}function QP(e){e.forEach(function(t){var n=t.businessObject,i=n.get(Cp);t.categoryValuesToAdd.forEach(function(r){pt(i,r)}),t.categoryValuesToRemove.forEach(function(r){gt(i,r,!0)})})}function Pp(e){for(;e.parent;)e=e.parent;return e}function hc(e){this._moddle=e}hc.$inject=["moddle"],hc.prototype.execute=function(e){var t=this._moddle.ids,n=e.id,i=e.element,r=e.claiming;return r?t.claim(n,i):t.unclaim(n),[]},hc.prototype.revert=function(e){var t=this._moddle.ids,n=e.id,i=e.element,r=e.claiming;return r?t.unclaim(n):t.claim(n,i),[]};var JP={fill:void 0,stroke:void 0};function Ap(e){this._commandStack=e,this._normalizeColor=function(t){if(t){if(hn(t)){var n=eA(t);if(n)return n}throw new Error(`invalid color value: ${t}`)}}}Ap.$inject=["commandStack"],Ap.prototype.postExecute=function(e){var t=e.elements,n=e.colors||JP,i=this,r={};"fill"in n&&D(r,{"background-color":this._normalizeColor(n.fill)}),"stroke"in n&&D(r,{"border-color":this._normalizeColor(n.stroke)}),M(t,function(o){var a=Ue(o)?qn(r,["border-color"]):r,s=ke(o);if(tA(a),xe(o)){if(!s||!y(s.label,"bpmndi:BPMNLabel"))return;i._commandStack.execute("element.updateModdleProperties",{element:o,moddleElement:s.label,properties:{color:r["border-color"]}})}else{if(!Ee(s,["bpmndi:BPMNEdge","bpmndi:BPMNShape"]))return;i._commandStack.execute("element.updateProperties",{element:o,properties:{di:a}})}})};function eA(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 tA(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 xv(e,t,n){function i(c,u){var l=c.label||c,p=c.labelTarget||c;return M1(l,u),[l,p]}function r(c){var u=c.element,l=u.businessObject,p=c.newLabel;if(!xe(u)&&Ki(u)&&!vs(u)&&!Ev(p)){var f=7,d=Qu(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=Mn(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(!(!xe(l)&&!y(l,"bpmn:TextAnnotation"))){if(xe(l)&&Ev(p)){d.removeShape!==!1&&e.removeShape(l,{unsetLabel:!1});return}var h=Mn(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}xv.$inject=["modeling","textRenderer","bpmnFactory"];function Ev(e){return!e||!e.trim()}function qt(e,t,n,i){qe.call(this,e,t,n),this._bpmnRules=i}te(qt,qe),qt.$inject=["eventBus","elementFactory","commandStack","bpmnRules"],qt.prototype.getHandlers=function(){var e=qe.prototype.getHandlers.call(this);return e["element.updateModdleProperties"]=pa,e["element.updateProperties"]=da,e["canvas.updateRoot"]=fc,e["lane.add"]=wp,e["lane.resize"]=ha,e["lane.split"]=Sp,e["lane.updateRefs"]=dc,e["group.updateRefs"]=ga,e["id.updateClaim"]=hc,e["element.setColor"]=Ap,e["element.updateLabel"]=xv,e},qt.prototype.updateLabel=function(e,t,n,i){this._commandStack.execute("element.updateLabel",{element:e,newLabel:t,newBounds:n,hints:i||{}})},qt.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)},qt.prototype.updateModdleProperties=function(e,t,n){this._commandStack.execute("element.updateModdleProperties",{element:e,moddleElement:t,properties:n})},qt.prototype.updateProperties=function(e,t){this._commandStack.execute("element.updateProperties",{element:e,properties:t})},qt.prototype.resizeLane=function(e,t,n){this._commandStack.execute("lane.resize",{shape:e,newBounds:t,balanced:n})},qt.prototype.addLane=function(e,t){var n={shape:e,location:t};return this._commandStack.execute("lane.add",n),n.newLane},qt.prototype.splitLane=function(e,t){this._commandStack.execute("lane.split",{shape:e,count:t})},qt.prototype.makeCollaboration=function(){var e=this._create("root",{type:"bpmn:Collaboration"}),t={newRoot:e};return this._commandStack.execute("canvas.updateRoot",t),e},qt.prototype.makeProcess=function(){var e=this._create("root",{type:"bpmn:Process"}),t={newRoot:e};return this._commandStack.execute("canvas.updateRoot",t),e},qt.prototype.updateLaneRefs=function(e,t){this._commandStack.execute("lane.updateRefs",{flowNodeShapes:e,laneShapes:t})},qt.prototype.updateCategoryValueRefs=function(e,t){this._commandStack.execute("group.updateRefs",{affectedFlowElements:e,affectedGroupEntries:t})},qt.prototype.claimId=function(e,t){this._commandStack.execute("id.updateClaim",{id:e,element:t,claiming:!0})},qt.prototype.unclaimId=function(e,t){this._commandStack.execute("id.updateClaim",{id:e,element:t})},qt.prototype.setColor=function(e,t){e.length||(e=[e]),this._commandStack.execute("element.setColor",{elements:e,colors:t})};function wv(){}wv.prototype.layoutConnection=function(e,t){return t=t||{},[t.connectionStart||fe(t.source||e.source),t.connectionEnd||fe(t.target||e.target)]};var mc=20,iA=5,gc=Math.round,Sv=20,rA={"h:h":20,"v:v":20,"h:v":-10,"v:h":-10};function oA(e,t){return!{t:/top/,r:/right/,b:/bottom/,l:/left/,h:/./,v:/./}[t].test(e)}function aA(e,t){return{t:/top/,r:/right/,b:/bottom/,l:/left/,h:/left|right/,v:/top|bottom/}[e].test(t)}function Rv(e,t,n){var i=Gt(t,e,iA),r=n.split(":")[0],o=gc((t.x-e.x)/2+e.x),a=gc((t.y-e.y)/2+e.y),s,c,u=aA(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=oA(i,r),c=l?"h:v":"v:h",p?l?(f=a===e.y,s={x:e.x+mc*(/l/.test(r)?-1:1),y:f?a+mc:a}):(f=o===e.x,s={x:f?o+mc:o,y:e.y+mc*(/t/.test(r)?-1:1)}):s={x:o,y:a}),{waypoints:Tp(e,s,c).concat(s),directions:c,turnNextDirections:f}}function sA(e,t,n){return Rv(e,t,n)}function cA(e,t,n){var i=Rv(t,e,Cv(n));return{waypoints:i.waypoints.slice().reverse(),directions:Cv(i.directions),turnNextDirections:i.turnNextDirections}}function uA(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=Tp(e.waypoints[e.waypoints.length-1],t.waypoints[0],r);return{waypoints:o,directions:r}}function Cv(e){return e.split(":").reverse().join(":")}function lA(e,t,n){var i=gc((t.x-e.x)/2+e.x),r=gc((t.y-e.y)/2+e.y);if(n==="h:v")return[{x:t.x,y:e.y}];if(n==="v:h")return[{x:e.x,y:t.y}];if(n==="h:h")return[{x:i,y:e.y},{x:i,y:t.y}];if(n==="v:v")return[{x:e.x,y:r},{x:t.x,y:r}];throw new Error("invalid directions: can only handle varians of [hv]:[hv]")}function Tp(e,t,n){if(n=n||"h:h",!_A(n))throw new Error("unknown directions: <"+n+">: must be specified as <start>:<end> with start/end in { h,v,t,r,b,l }");if(Av(n)){var i=sA(e,t,n),r=cA(e,t,n),o=uA(i,r);return[].concat(i.waypoints,o.waypoints,r.waypoints)}return lA(e,t,n)}function pA(e,t,n){var i=Tp(e,t,n);return i.unshift(e),i.push(t),Mv(i)}function fA(e,t,n,i,r){var o=r&&r.preferredLayouts||[],a=m0(o,"straight")[0]||"h:h",s=rA[a]||0,c=Gt(e,t,s),u=yA(c,a);n=n||fe(e),i=i||fe(t);var l=u.split(":"),p=Tv(n,e,l[0],bA(c)),f=Tv(i,t,l[1],c);return pA(p,f,u)}function dA(e,t,n,i,r,o){pe(n)&&(r=n,o=i,n=fe(e),i=fe(t)),o=D({preferredLayouts:[]},o),r=r||[];var a=o.preferredLayouts,s=a.indexOf("straight")!==-1,c;return c=s&&mA(e,t,n,i,o),c||(c=o.connectionEnd&&vA(t,e,i,r),c)||(c=o.connectionStart&&gA(e,t,n,r),c)?c:!o.connectionStart&&!o.connectionEnd&&r&&r.length?r:fA(e,t,n,i,o)}function hA(e,t,n){return e>=t&&e<=n}function Pv(e,t,n){var i={x:"width",y:"height"};return hA(t[e],n[e],n[e]+n[i[e]])}function mA(e,t,n,i,r){var o={},a,s;return s=Gt(e,t),/^(top|bottom|left|right)$/.test(s)?(/top|bottom/.test(s)&&(a="x"),/left|right/.test(s)&&(a="y"),r.preserveDocking==="target"?Pv(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:Pv(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 gA(e,t,n,i){return Mp(e,t,n,i)}function vA(e,t,n,i){var r=i.slice().reverse();return r=Mp(e,t,n,r),r?r.reverse():null}function Mp(e,t,n,i){function r(l){return l.length<3?!0:l.length>4?!1:!!Ke(l,function(p,f){var d=l[f-1];return d&&Fo(p,d)<3})}function o(l,p,f){var d=bi(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(Jd(l[d],p,Sv)||Jd(l[d],f,Sv))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=Mp(e,t,n,u)),c&&bi(c)?null:c}function yA(e,t){if(Av(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 _A(e){return e&&/^h|v|t|r|b|l:h|v|t|r|b|l$/.test(e)}function Av(e){return e&&/t|r|b|l/.test(e)}function bA(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 Mv(e){return e.reduce(function(t,n,i){var r=t[t.length-1],o=e[i+1];return qu(r,o,n,0)||t.push(n),t},[])}var xA=-10,EA=40,wA={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},SA={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},kp={top:"bottom","top-right":"bottom-left","top-left":"bottom-right",right:"left",bottom:"top","bottom-right":"top-left","bottom-left":"top-right",left:"right"},va={top:"t",right:"r",bottom:"b",left:"l"};function vc(e){this._elementRegistry=e}te(vc,wv),vc.prototype.layoutConnection=function(e,t){t||(t={});var n=t.source||e.source,i=t.target||e.target,r=t.waypoints||e.waypoints,o=t.connectionStart,a=t.connectionEnd,s=this._elementRegistry,c,u;if(o||(o=kv(r&&r[0],n)),a||(a=kv(r&&r[r.length-1],i)),(y(e,"bpmn:Association")||y(e,"bpmn:DataAssociation"))&&r&&!Dv(n,i))return[].concat([o],r.slice(1,-1),[a]);var l=Vh(n,s)?wA:SA;return y(e,"bpmn:MessageFlow")?c=CA(n,i,l):(y(e,"bpmn:SequenceFlow")||Dv(n,i))&&(n===i?c={preferredLayouts:DA(n,e,l)}:y(n,"bpmn:BoundaryEvent")?c={preferredLayouts:OA(n,i,a,l)}:ya(n)||ya(i)?c={preferredLayouts:l.subProcess,preserveDocking:AA(n)}:y(n,"bpmn:Gateway")?c={preferredLayouts:l.fromGateway}:y(i,"bpmn:Gateway")?c={preferredLayouts:l.toGateway}:c={preferredLayouts:l.default}),c&&(c=D(c,t),u=Mv(dA(n,i,o,a,r,c))),u||[o,a]};function RA(e){var t=e.host;return Gt(fe(e),t,xA)}function CA(e,t,n){return{preferredLayouts:n.messageFlow,preserveDocking:PA(e,t)}}function PA(e,t){return y(t,"bpmn:Participant")?"source":y(e,"bpmn:Participant")?"target":ya(t)?"source":ya(e)||y(t,"bpmn:Event")?"target":y(e,"bpmn:Event")?"source":null}function AA(e){return ya(e)?"target":"source"}function kv(e,t){return e?e.original||e:fe(t)}function Dv(e,t){return y(t,"bpmn:Activity")&&y(e,"bpmn:BoundaryEvent")&&t.businessObject.isForCompensation}function ya(e){return y(e,"bpmn:SubProcess")&&Pe(e)}function Ir(e,t){return e===t}function TA(e,t){return t.indexOf(e)!==-1}function go(e){var t=/right|left/.exec(e);return t&&t[0]}function vo(e){var t=/top|bottom/.exec(e);return t&&t[0]}function Ov(e,t){return kp[e]===t}function MA(e,t){var n=go(e),i=kp[n];return t.indexOf(i)!==-1}function kA(e,t){var n=vo(e),i=kp[n];return t.indexOf(i)!==-1}function Iv(e){return e==="right"||e==="left"}function DA(e,t,n){var i=t.waypoints,r=i&&i.length&&Gt(i[0],e);return r==="top"?n.loop.fromTop:r==="right"?n.loop.fromRight:r==="left"?n.loop.fromLeft:n.loop.fromBottom}function OA(e,t,n,i){var r=fe(e),o=fe(t),a=RA(e),s,c,u=Ir(e.host,t),l=TA(a,["top","right","bottom","left"]),p=Gt(o,r,{x:e.width/2+t.width/2,y:e.height/2+t.height/2});return u?IA(a,l,e,t,n,i):(s=LA(a,p,l,i.isHorizontal),c=NA(a,p,l,i.isHorizontal),[s+":"+c])}function IA(e,t,n,i,r,o){var a=t?e:o.isHorizontal?vo(e):go(e),s=va[a],c;return t?Iv(e)?c=Lv("y",n,i,r)?"h":o.boundaryLoop.alternateHorizontalSide:c=Lv("x",n,i,r)?"v":o.boundaryLoop.alternateVerticalSide:c=o.boundaryLoop.default,[s+":"+c]}function Lv(e,t,n,i){var r=EA;return!(Dp(e,i,n,r)||Dp(e,i,{x:n.x+n.width,y:n.y+n.height},r)||Dp(e,i,fe(t),r))}function Dp(e,t,n,i){return Math.abs(t[e]-n[e])<i}function LA(e,t,n,i){if(n)return va[e];var r=vo(e),o=go(e),a=vo(t),s=go(t);if(i){if(Ir(r,a)||Ov(o,s))return va[r]}else if(Ir(o,s)||Ov(r,a))return va[o];return va[i?o:r]}function NA(e,t,n,i){if(n)return Iv(e)?MA(e,t)||Ir(e,t)?"h":"v":kA(e,t)||Ir(e,t)?"v":"h";var r=vo(e),o=go(e),a=vo(t),s=go(t);return a&&!s?"v":s&&!a?"h":i?Ir(r,a)?"h":"v":Ir(o,s)?"v":"h"}vc.$inject=["elementRegistry"];function Nv(e){return D({original:e.point.original||e.point},e.actual)}function ar(e,t){this._elementRegistry=e,this._graphicsFactory=t}ar.$inject=["elementRegistry","graphicsFactory"],ar.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(Nv(i)),o.push(Nv(r)),o},ar.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}},ar.prototype._getIntersection=function(e,t,n){var i=this._getShapePath(e),r=this._getConnectionPath(t);return Ho(i,r,n)},ar.prototype._getConnectionPath=function(e){return this._graphicsFactory.getConnectionPath(e)},ar.prototype._getShapePath=function(e){return this._graphicsFactory.getShapePath(e)},ar.prototype._getGfx=function(e){return this._elementRegistry.getGraphics(e)};const Op={__init__:["modeling","bpmnUpdater"],__depends__:[tC,vC,_C,bC,Yg,xP,wP,TP,jn,gp,ev],bpmnFactory:["type",Hn],bpmnUpdater:["type",En],elementFactory:["type",ir],modeling:["type",qt],layouter:["type",vc],connectionDocking:["type",ar]};var BA=10,Bv=50,$A=250;function Ip(e,t,n,i){for(var r;r=jA(e,n,t);)n=i(t,n,r);return n}function Lp(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 jA(e,t,n){var i={x:t.x-n.width/2,y:t.y-n.height/2,width:n.width,height:n.height},r=HA(e);return Ke(r,function(o){if(o===n)return!1;var a=Gt(o,i,BA);return a==="intersect"})}function FA(e,t){t||(t={});function n(h){return h.source===e?1:-1}var i=t.defaultDistance||Bv,r=t.direction||"e",o=t.filter,a=t.getWeight||n,s=t.maxDistance||$A,c=t.reference||"start";o||(o=GA);function u(h,m){return r==="n"?c==="start"?ue(h).top-ue(m).bottom:c==="center"?ue(h).top-fe(m).y:ue(h).top-ue(m).top:r==="w"?c==="start"?ue(h).left-ue(m).right:c==="center"?ue(h).left-fe(m).x:ue(h).left-ue(m).left:r==="s"?c==="start"?ue(m).top-ue(h).bottom:c==="center"?fe(m).y-ue(h).bottom:ue(m).bottom-ue(h).bottom:c==="start"?ue(m).left-ue(h).right:c==="center"?fe(m).x-ue(h).right:ue(m).right-ue(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=gn(f,function(h,m){var g=m.distance,S=m.weight;return g<0||g>s||(h[String(g)]||(h[String(g)]=0),h[String(g)]+=1*S,(!h.distance||h[h.distance]<h[String(g)])&&(h.distance=g)),h},{});return d.distance||i}function HA(e){var t=Np(e);return e.host&&(t=t.concat(Np(e.host))),e.attachers&&(t=t.concat(e.attachers.reduce(function(n,i){return n.concat(Np(i))},[]))),t}function Np(e){return VA(e).concat(zA(e))}function zA(e){return e.incoming.map(function(t){return t.source})}function VA(e){return e.outgoing.map(function(t){return t.target})}function GA(){return!0}var WA=100;function $v(e,t,n){e.on("autoPlace",WA,function(i){var r=i.shape,o=i.source;return UA(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}}$v.$inject=["eventBus","modeling","canvas"];function UA(e,t,n){n||(n={});var i=n.defaultDistance||Bv,r=fe(e),o=ue(e);return{x:o.right+i+t.width/2,y:r.y}}function jv(e,t){e.on("autoPlace.end",500,function(n){t.select(n.shape)})}jv.$inject=["eventBus","selection"];const qA={__init__:["autoPlaceSelectionBehavior"],autoPlace:["type",$v],autoPlaceSelectionBehavior:["type",jv]};function Fv(e,t,n){var i=Vh(e,n);if(y(t,"bpmn:TextAnnotation"))return KA(e,t,i);if(Ee(t,["bpmn:DataObjectReference","bpmn:DataStoreReference"]))return XA(e,t,i);if(y(t,"bpmn:FlowNode"))return YA(e,t,i)}function YA(e,t,n){var i=ue(e),r=fe(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=FA(e,{filter:function(d){return y(d,"bpmn:SequenceFlow")},direction:o.directionHint}),s=30,c=o.minDistance,u=o.baseOrientation;y(e,"bpmn:BoundaryEvent")&&(u=Gt(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 Ip(e,t,l,Lp(f))}function Hv(e,t,n){return e.includes(n.start)?-1*t:e.includes(n.end)?t:0}function KA(e,t,n){var i=ue(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};Ue(e)&&(r=fe(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 Ip(e,t,r,Lp(a))}function XA(e,t,n){var i=ue(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 Ip(e,t,r,Lp(a))}function zv(e,t){e.on("autoPlace",function(n){var i=n.shape,r=n.source;return Fv(r,i,t)})}zv.$inject=["eventBus","elementRegistry"];const yc={__depends__:[qA],__init__:["bpmnAutoPlace"],bpmnAutoPlace:["type",zv]},Vv=[Hh,qo,Op,yc];function ZA(e={}){Ad(globalThis,e.dom);const t=document.createElement("div");return document.body.appendChild(t),new Jr({container:t,moddleExtensions:e.moddleExtensions??qa,additionalModules:[...Vv,...e.additionalModules??[]]})}var QA=new ho("ov"),JA=500;function Ft(e,t,n,i){this._eventBus=t,this._canvas=n,this._elementRegistry=i,this._ids=QA,this._overlayDefaults=D({show:null,scale:!0},e&&e.defaults),this._overlays={},this._overlayContainers=[],this._overlayRoot=eT(n.getContainer()),this._init()}Ft.$inject=["config.overlays","eventBus","canvas","elementRegistry"],Ft.prototype.get=function(e){if(hn(e)&&(e={id:e}),hn(e.element)&&(e.element=this._elementRegistry.get(e.element)),e.element){var t=this._getOverlayContainer(e.element,!0);return t?e.type?Re(t.overlays,Wr({type:e.type})):t.overlays.slice():[]}else return e.type?Re(this._overlays,Wr({type:e.type})):e.id?this._overlays[e.id]:null},Ft.prototype.add=function(e,t,n){if(It(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=D({},this._overlayDefaults,n,{id:i,type:t,element:e,html:n.html}),this._addOverlay(n),i},Ft.prototype.remove=function(e){var t=this.get(e)||[];pe(t)||(t=[t]);var n=this;M(t,function(i){var r=n._getOverlayContainer(i.element,!0);if(i&&(ri(i.html),ri(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)}})},Ft.prototype.isShown=function(){return this._overlayRoot.style.display!=="none"},Ft.prototype.show=function(){_c(this._overlayRoot)},Ft.prototype.hide=function(){_c(this._overlayRoot,!1)},Ft.prototype.clear=function(){this._overlays={},this._overlayContainers=[],ns(this._overlayRoot)},Ft.prototype._updateOverlayContainer=function(e){var t=e.element,n=e.html,i=t.x,r=t.y;if(t.waypoints){var o=bt(t);i=o.x,r=o.y}Gv(n,i,r),Qt(e.html,"data-container-id",t.id)},Ft.prototype._updateOverlay=function(e){var t=e.position,n=e.htmlContainer,i=e.element,r=t.left,o=t.top;if(t.right!==void 0){var a;i.waypoints?a=bt(i).width:a=i.width,r=t.right*-1+a}if(t.bottom!==void 0){var s;i.waypoints?s=bt(i).height:s=i.height,o=t.bottom*-1+s}Gv(n,r||0,o||0),this._updateOverlayVisibilty(e,this._canvas.viewbox())},Ft.prototype._createOverlayContainer=function(e){var t=Qe('<div class="djs-overlays" />');cn(t,{position:"absolute"}),this._overlayRoot.appendChild(t);var n={html:t,element:e,overlays:[]};return this._updateOverlayContainer(n),this._overlayContainers.push(n),n},Ft.prototype._updateRoot=function(e){var t=e.scale||1,n="matrix("+[t,0,0,t,-1*e.x*t,-1*e.y*t].join(",")+")";Wv(this._overlayRoot,n)},Ft.prototype._getOverlayContainer=function(e,t){var n=Ke(this._overlayContainers,function(i){return i.element===e});return!n&&!t?this._createOverlayContainer(e):n},Ft.prototype._addOverlay=function(e){var t=e.id,n=e.element,i=e.html,r,o;i.get&&i.constructor.prototype.jquery&&(i=i.get(0)),hn(i)&&(i=Qe(i)),o=this._getOverlayContainer(n),r=Qe('<div class="djs-overlay" data-overlay-id="'+t+'">'),cn(r,{position:"absolute"}),r.appendChild(i),e.type&&rt(r).add("djs-overlay-"+e.type);var a=this._canvas.findRoot(n),s=this._canvas.getRootElement();_c(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())},Ft.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&&(At(r)&&r>t.scale||At(o)&&o<t.scale))&&(c=!1),_c(a,c),this._updateOverlayScale(e,t)},Ft.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),At(i)&&t.scale<i&&(a=(1/t.scale||1)*i),At(r)&&t.scale>r&&(a=(1/t.scale||1)*r)),At(a)&&(s="scale("+a+","+a+")"),Wv(o,s)},Ft.prototype._updateOverlaysVisibilty=function(e){var t=this;M(this._overlays,function(n){t._updateOverlayVisibilty(n,e)})},Ft.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){ri(a.html);var s=t._overlayContainers.indexOf(a);s!==-1&&t._overlayContainers.splice(s,1)}}),e.on("element.changed",JA,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&&rt(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 eT(e){var t=Qe('<div class="djs-overlay-container" />');return cn(t,{position:"absolute",width:0,height:0}),e.insertBefore(t,e.firstChild),t}function Gv(e,t,n){cn(e,{left:t+"px",top:n+"px"})}function _c(e,t){e.style.display=t===!1?"none":""}function Wv(e,t){e.style["transform-origin"]="top left",["","-ms-","-webkit-"].forEach(function(n){e.style[n+"transform"]=t})}const bc={__init__:["overlays"],overlays:["type",Ft]};function Bp(e,t){t.invoke(W,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)})}te(Bp,W),Bp.$inject=["canvas","injector"];const tT={__init__:["rootElementsBehavior"],rootElementsBehavior:["type",Bp]};function _a(e){return CSS.escape(e)}var nT={"&":"&","<":"<",">":">",'"':""","'":"'"};function Uv(e){return e=""+e,e&&e.replace(/[&<>"']/g,function(t){return nT[t]})}var iT="bjs-breadcrumbs-shown";function qv(e,t,n){var i=Qe('<ul class="bjs-breadcrumbs"></ul>'),r=n.getContainer(),o=rt(r);r.appendChild(i);var a=[];e.on("element.changed",function(c){var u=c.element,l=q(u),p=Ke(a,function(f){return f===l});p&&s()});function s(c){c&&(a=rT(c));var u=a.flatMap(function(p){var f=n.findRoot(ui(p))||n.findRoot(p.id);if(!f&&y(p,"bpmn:Process")){var d=t.find(function(g){var S=q(g);return S&&S.get("processRef")===p});f=d&&n.findRoot(d.id)}if(!f)return[];var h=Uv(p.name||p.id),m=Qe('<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(iT,l),u.forEach(function(p){i.appendChild(p)})}e.on("root.set",function(c){s(c.element)})}qv.$inject=["eventBus","elementRegistry","canvas"];function rT(e){for(var t=q(e),n=[],i=t;i;i=i.$parent)(y(i,"bpmn:SubProcess")||y(i,"bpmn:Process"))&&n.push(i);return n.reverse()}function Yv(e,t){var n=null,i=new oT;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,!(!y(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})}Yv.$inject=["eventBus","canvas"];function oT(){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 Kv={x:180,y:160};function Lr(e,t){this._eventBus=e,this._moddle=t;var n=this;e.on("import.render.start",1500,function(i,r){n._handleImport(r.definitions)})}Lr.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)})}},Lr.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;y(a,"bpmn:SubProcess")&&!o.isExpanded&&n.push(a),sT(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},Lr.prototype._movePlaneElementsToOrigin=function(e){var t=e.get("planeElement"),n=aT(e),i={x:n.x-Kv.x,y:n.y-Kv.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)})},Lr.prototype._moveToDiPlane=function(e,t){var n=Xv(e),i=n.plane.get("planeElement");i.splice(i.indexOf(e),1),t.get("planeElement").push(e)},Lr.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},Lr.$inject=["eventBus","moddle"];function Xv(e){return y(e,"bpmndi:BPMNDiagram")?e:Xv(e.$parent)}function aT(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=ue(n.bounds);t.top=Math.min(i.top,t.top),t.left=Math.min(i.left,t.left)}}),ps(t)}function sT(e,t){var n=e.$parent;return!(!y(n,"bpmn:SubProcess")||n===t.bpmnElement||Ee(e,["bpmn:DataInputAssociation","bpmn:DataOutputAssociation"]))}var xc=250,cT='<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>',uT="bjs-drilldown-empty";function sr(e,t,n,i,r){W.call(this,t),this._canvas=e,this._eventBus=t,this._elementRegistry=n,this._overlays=i,this._translate=r;var o=this;this.executed("shape.toggleCollapse",xc,function(a){var s=a.shape;o._canDrillDown(s)?o._addOverlay(s):o._removeOverlay(s)},!0),this.reverted("shape.toggleCollapse",xc,function(a){var s=a.shape;o._canDrillDown(s)?o._addOverlay(s):o._removeOverlay(s)},!0),this.executed(["shape.create","shape.move","shape.delete"],xc,function(a){var s=a.oldParent,c=a.newParent||a.parent,u=a.shape;o._canDrillDown(u)&&o._addOverlay(u),o._updateDrilldownOverlay(s),o._updateDrilldownOverlay(c),o._updateDrilldownOverlay(u)},!0),this.reverted(["shape.create","shape.move","shape.delete"],xc,function(a){var s=a.oldParent,c=a.newParent||a.parent,u=a.shape;o._canDrillDown(u)&&o._addOverlay(u),o._updateDrilldownOverlay(s),o._updateDrilldownOverlay(c),o._updateDrilldownOverlay(u)},!0),t.on("import.render.complete",function(){n.filter(function(a){return o._canDrillDown(a)}).map(function(a){o._addOverlay(a)})})}te(sr,W),sr.prototype._updateDrilldownOverlay=function(e){var t=this._canvas;if(e){var n=t.findRoot(e);n&&this._updateOverlayVisibility(n)}},sr.prototype._canDrillDown=function(e){var t=this._canvas;return y(e,"bpmn:SubProcess")&&t.findRoot(ui(e))},sr.prototype._updateOverlayVisibility=function(e){var t=this._overlays,n=q(e),i=t.get({element:n.id,type:"drilldown"})[0];if(i){var r=n&&n.get("flowElements")&&n.get("flowElements").length;rt(i.html).toggle(uT,!r)}},sr.prototype._addOverlay=function(e){var t=this._canvas,n=this._overlays,i=q(e),r=n.get({element:e,type:"drilldown"});r.length&&this._removeOverlay(e);var o=Qe('<button type="button" class="bjs-drilldown">'+cT+"</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(ui(e)))}),n.add(e,"drilldown",{position:{bottom:-7,right:-8},html:o}),this._updateOverlayVisibility(e)},sr.prototype._removeOverlay=function(e){var t=this._overlays;t.remove({element:e,type:"drilldown"})},sr.$inject=["canvas","eventBus","elementRegistry","overlays","translate"];const lT={__depends__:[bc,gp,tT],__init__:["drilldownBreadcrumbs","drilldownOverlayBehavior","drilldownCentering","subprocessCompatibility"],drilldownBreadcrumbs:["type",qv],drilldownCentering:["type",Yv],drilldownOverlayBehavior:["type",sr],subprocessCompatibility:["type",Lr]};function cr(e){at.call(this,e)}te(cr,at),cr.prototype._modules=[Hh,lT,bc,jn,qo],cr.prototype._moddleExtensions={};var Ec="keyboard.keydown",pT="keyboard.keyup",fT=1e3,Zv="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 un(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(Zv));var i=e&&e.bind!==!1;t.on("canvas.init",function(r){n._target=r.svg,i&&n.bind(),n._fire("init")})}un.$inject=["config.keyboard","eventBus"],un.prototype._keydownHandler=function(e){this._keyHandler(e,Ec)},un.prototype._keyupHandler=function(e){this._keyHandler(e,pT)},un.prototype._keyHandler=function(e,t){var n;if(!this._isEventIgnored(e)){var i={keyEvent:e};n=this._eventBus.fire(t||Ec,i),n&&e.preventDefault()}},un.prototype._isEventIgnored=function(e){return!1},un.prototype.bind=function(e){e&&console.error("unsupported argument <node>",new Error(Zv)),this.unbind(),e=this._node=this._target,me.bind(e,"keydown",this._keydownHandler),me.bind(e,"keyup",this._keyupHandler),this._fire("bind")},un.prototype.getBinding=function(){return this._node},un.prototype.unbind=function(){var e=this._node;e&&(this._fire("unbind"),me.unbind(e,"keydown",this._keydownHandler),me.unbind(e,"keyup",this._keyupHandler)),this._node=null},un.prototype._fire=function(e){this._eventBus.fire("keyboard."+e,{node:this._node})},un.prototype.addListener=function(e,t,n){Lt(e)&&(n=t,t=e,e=fT),this._eventBus.on(n||Ec,e,t)},un.prototype.removeListener=function(e,t){this._eventBus.off(t||Ec,e)},un.prototype.hasModifier=OC,un.prototype.isCmd=bn,un.prototype.isShift=op,un.prototype.isKey=kt;var dT=500;function yo(e,t){var n=this;e.on("editorActions.init",dT,function(i){var r=i.editorActions;n.registerBindings(t,r)})}yo.$inject=["eventBus","keyboard"],yo.prototype.registerBindings=function(e,t){function n(i,r){t.isRegistered(i)&&e.addListener(r)}n("undo",function(i){var r=i.keyEvent;if($C(r))return t.trigger("undo"),!0}),n("redo",function(i){var r=i.keyEvent;if(jC(r))return t.trigger("redo"),!0}),n("copy",function(i){var r=i.keyEvent;if(IC(r))return t.trigger("copy"),!0}),n("paste",function(i){var r=i.keyEvent;if(LC(r))return t.trigger("paste"),!0}),n("duplicate",function(i){var r=i.keyEvent;if(NC(r))return t.trigger("duplicate"),!0}),n("cut",function(i){var r=i.keyEvent;if(BC(r))return t.trigger("cut"),!0}),n("stepZoom",function(i){var r=i.keyEvent;if(kt(["+","Add","="],r)&&bn(r))return t.trigger("stepZoom",{value:1}),!0}),n("stepZoom",function(i){var r=i.keyEvent;if(kt(["-","Subtract"],r)&&bn(r))return t.trigger("stepZoom",{value:-1}),!0}),n("zoom",function(i){var r=i.keyEvent;if(kt("0",r)&&bn(r))return t.trigger("zoom",{value:1}),!0}),n("removeSelection",function(i){var r=i.keyEvent;if(kt(["Backspace","Delete","Del"],r))return t.trigger("removeSelection"),!0})};const $p={__init__:["keyboard","keyboardBindings"],keyboard:["type",un],keyboardBindings:["type",yo]};var hT={moveSpeed:50,moveSpeedAccelerated:200};function Qv(e,t,n){var i=this;this._config=D({},hT,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})}}Qv.$inject=["config.keyboardMove","keyboard","canvas"];const Jv={__depends__:[$p],__init__:["keyboardMove"],keyboardMove:["type",Qv]};var mT=15;function ey(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=Tr(s),p=Kn(l,c);if(!n.dragging&&gT(p)>mT&&(n.dragging=!0,u===0&&Pg(e),Ks("grab")),n.dragging){var f=n.last||n.start;p=Kn(l,f),t.scroll({dx:p.x,dy:p.y}),n.last=l}s.preventDefault()}function o(s){me.unbind(document,"mousemove",r),me.unbind(document,"mouseup",o),n=null,Cg()}function a(s){if(!wr(s.target,".djs-draggable")){var c=s.button;if(!(c>=2||s.ctrlKey||s.shiftKey||s.altKey))return n={button:c,start:Tr(s)},me.bind(document,"mousemove",r),me.bind(document,"mouseup",o),!0}}this.isActive=function(){return!!n}}ey.$inject=["eventBus","canvas"];function gT(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}const ty={__init__:["moveCanvas"],moveCanvas:["type",ey]};function ny(e,t){var n=nl(e.min),i=nl(e.max),r=Math.abs(n)+Math.abs(i);return r/t}function vT(e,t){return Math.max(e.min,Math.min(e.max,t))}var yT=Math.sign||function(e){return e>=0?1:-1},jp={min:.2,max:4},iy=10,_T=.1,bT=.75;function fi(e,t,n){e=e||{},this._enabled=!1,this._canvas=n,this._container=n._container,this._handleWheel=pn(this._handleWheel,this),this._totalDelta=0,this._scale=e.scale||bT;var i=this;t.on("canvas.mouseover",function(){i._init(e.enabled!==!1)}),t.on("canvas.mouseout",function(){i._init(!1)})}fi.$inject=["config.zoomScroll","eventBus","canvas"],fi.prototype.scroll=function(t){this._canvas.scroll(t)},fi.prototype.reset=function(){this._canvas.zoom("fit-viewport")},fi.prototype.zoom=function(t,n){var i=ny(jp,iy*2);this._totalDelta+=t,Math.abs(this._totalDelta)>_T&&(this._zoom(t,n,i),this._totalDelta=0)},fi.prototype._handleWheel=function(t){if(this._enabled){var n=this._container;t.preventDefault();var i=t.ctrlKey||Im()&&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))*yT(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)}},fi.prototype.stepZoom=function(t,n){var i=ny(jp,iy);this._zoom(t,n,i)},fi.prototype._zoom=function(e,t,n){var i=this._canvas,r=e>0?1:-1,o=nl(i.zoom()),a=Math.round(o/n)*n;a+=n*r;var s=Math.pow(10,a);i.zoom(vT(jp,s),t)},fi.prototype.toggle=function(t){var n=this._container,i=this._handleWheel,r=this._enabled;return typeof t>"u"&&(t=!r),r!==t&&me[t?"bind":"unbind"](n,"wheel",i,!1),this._enabled=t,t},fi.prototype._init=function(e){this.toggle(e)};const ry={__init__:["zoomScroll"],zoomScroll:["type",fi]};function ba(e){cr.call(this,e)}te(ba,cr),ba.prototype._navigationModules=[Jv,ty,ry],ba.prototype._modules=[].concat(cr.prototype._modules,ba.prototype._navigationModules);function Fp(e){return e&&e[e.length-1]}function oy(e){return e.y}function ay(e){return e.x}var xT={left:ay,center:ay,right:function(e){return e.x+e.width},top:oy,middle:oy,bottom:function(e){return e.y+e.height}};function _o(e,t){this._modeling=e,this._rules=t}_o.$inject=["modeling","rules"],_o.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}},_o.prototype._isType=function(e,t){return t.indexOf(e)!==-1},_o.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=Fp(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=Jn(a,function(f){return f.elements.length>1&&(s=!0),f.elements.length}),s)return o[e]=Fp(c).center,o;u=t[0],t=Jn(t,function(f){return f[i]+f[r]}),l=Fp(t),o[e]=p(u,l)}return o},_o.prototype.trigger=function(e,t){var n=this._modeling,i,r=Re(e,function(c){return!(c.waypoints||c.host||c.labelTarget)});if(i=this._rules.allowed("elements.align",{elements:r}),pe(i)&&(r=i),!(r.length<2||!i)){var o=xT[t],a=Jn(r,o),s=this._alignmentPosition(t,a);n.alignElements(a,s)}};const ET={__init__:["alignElements"],alignElements:["type",_o]},wT=new ho;function bo(e){this._scheduled={},e.on("diagram.destroy",()=>{Object.keys(this._scheduled).forEach(t=>{this.cancel(t)})})}bo.$inject=["eventBus"],bo.prototype.schedule=function(e,t=wT.next()){this.cancel(t);const n=this._schedule(e,t);return this._scheduled[t]=n,n.promise},bo.prototype._schedule=function(e,t){const n=ST();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}},bo.prototype.cancel=function(e){const t=this._scheduled[e];t&&(this._cancel(t),this._scheduled[e]=null)},bo.prototype._cancel=function(e){clearTimeout(e.executionId)};function ST(){const e={};return e.promise=new Promise((t,n)=>{e.resolve=t,e.reject=n}),e}const RT={scheduler:["type",bo]};var CT="djs-element-hidden",wc=".entry",PT=1e3,sy=8,AT=300;function Et(e,t,n,i){this._canvas=e,this._elementRegistry=t,this._eventBus=n,this._scheduler=i,this._current=null,this._init()}Et.$inject=["canvas","elementRegistry","eventBus","scheduler"],Et.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=pe(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=pe(i.target)?i.target:[i.target];r.includes(n)&&e._updateVisibility()}}),this._container=this._createContainer()},Et.prototype._createContainer=function(){var e=Qe('<div class="djs-context-pad-parent"></div>');return this._canvas.getContainer().appendChild(e),e},Et.prototype.registerProvider=function(e,t){t||(t=e,e=PT),this._eventBus.on("contextPad.getProviders",e,function(n){n.providers.push(t)})},Et.prototype.getEntries=function(e){var t=this._getProviders(),n=pe(e)?"getMultiElementContextPadEntries":"getContextPadEntries",i={};return M(t,function(r){if(Lt(r[n])){var o=r[n](e);Lt(o)?i=o(i):M(o,function(a,s){i[s]=a})}}),i},Et.prototype.trigger=function(e,t,n){var i=this,r,o,a=t.delegateTarget||t.target;if(!a)return t.preventDefault();if(r=Qt(a,"data-action"),o=t.originalEvent||t,e==="mouseover"){this._timeout=setTimeout(function(){i._mouseout=i.triggerEntry(r,"hover",o,n)},AT);return}else if(e==="mouseout"){clearTimeout(this._timeout),this._mouseout&&(this._mouseout(),this._mouseout=null);return}return this.triggerEntry(r,e,o,n)},Et.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(Lt(s)){if(t==="click")return s(n,r,i)}else if(s[t])return s[t](n,r,i);n.preventDefault()}}}},Et.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))}},Et.prototype._getProviders=function(){var e=this._eventBus.createEvent({type:"contextPad.getProviders",providers:[]});return this._eventBus.fire(e),e.providers},Et.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=Qe(r.html||'<div class="entry" draggable="true"></div>'),c;Qt(s,"data-action",o),c=Ge("[data-group="+_a(a)+"]",n),c||(c=Qe('<div class="group"></div>'),Qt(c,"data-group",a),n.appendChild(c)),c.appendChild(s),r.className&&TT(s,r.className),r.title&&Qt(s,"title",r.title),r.imageUrl&&(i=Qe("<img>"),Qt(i,"src",r.imageUrl),i.style.width="100%",i.style.height="100%",s.appendChild(i))}),rt(n).add("open"),this._current={entries:t,html:n,target:e},this._updatePosition(),this._updateVisibility(),this._eventBus.fire("contextPad.open",{current:this._current})},Et.prototype._createHtml=function(e){var t=this,n=Qe('<div class="djs-context-pad"></div>');return vn.bind(n,wc,"click",function(i){t.trigger("click",i)}),vn.bind(n,wc,"dragstart",function(i){t.trigger("dragstart",i)}),vn.bind(n,wc,"mouseover",function(i){t.trigger("mouseover",i)}),vn.bind(n,wc,"mouseout",function(i){t.trigger("mouseout",i)}),me.bind(n,"mousedown",function(i){i.stopPropagation()}),this._container.appendChild(n),this._eventBus.fire("contextPad.create",{target:e,pad:n}),n},Et.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()&&kT(this._current.target,e)?t=this._current.html:t=this._createHtml(e),{html:t}},Et.prototype.close=function(){this.isOpen()&&(clearTimeout(this._timeout),this._container.innerHTML="",this._eventBus.fire("contextPad.close",{current:this._current}),this._current=null)},Et.prototype.isOpen=function(e){var t=this._current;if(!t)return!1;if(!e)return!0;var n=t.target;return pe(e)!==pe(n)?!1:pe(e)?e.length===n.length&&yr(e,function(i){return n.includes(i)}):n===e},Et.prototype.isShown=function(){return this.isOpen()&&rt(this._current.html).has("open")},Et.prototype.show=function(){this.isOpen()&&(rt(this._current.html).add("open"),this._updatePosition(),this._eventBus.fire("contextPad.show",{current:this._current}))},Et.prototype.hide=function(){this.isOpen()&&(rt(this._current.html).remove("open"),this._eventBus.fire("contextPad.hide",{current:this._current}))},Et.prototype._getPosition=function(e){if(!pe(e)&&Ue(e)){var t=this._canvas.viewbox(),n=MT(e),i=n.x*t.scale-t.x*t.scale,r=n.y*t.scale-t.y*t.scale;return{left:i+sy*this._canvas.zoom(),top:r}}var o=this._canvas.getContainer(),a=o.getBoundingClientRect(),s=this._getTargetBounds(e);return{left:s.right-a.left+sy*this._canvas.zoom(),top:s.top-a.top}},Et.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")},Et.prototype._updateVisibility=function(){const e=()=>{if(this.isOpen()){var t=this,n=this._current.target,i=pe(n)?n:[n],r=i.some(function(o){return t._canvas.hasMarker(o,CT)});r?t.hide():t.show()}};this._scheduler.schedule(e,"ContextPad#_updateVisibility")},Et.prototype._getTargetBounds=function(e){var t=this,n=pe(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 TT(e,t){var n=rt(e);t=pe(t)?t:t.split(/\s+/g),t.forEach(function(i){n.add(i)})}function MT(e){return e.waypoints[e.waypoints.length-1]}function kT(e,t){return e=pe(e)?e:[e],t=pe(t)?t:[t],e.length===t.length&&yr(e,function(n){return t.includes(n)})}const cy={__depends__:[Ys,RT,bc],contextPad:["type",Et]};var Sc,ct,uy,ur,ly,py,fy,Hp,Rc,xa,dy,zp,Vp,Gp,Cc={},Pc=[],DT=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,Ac=Array.isArray;function Mi(e,t){for(var n in t)e[n]=t[n];return e}function Wp(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function hy(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?Sc.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 Tc(e,a,i,r,null)}function Tc(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??++uy,__i:-1,__u:0};return r==null&&ct.vnode!=null&&ct.vnode(o),o}function Mc(e){return e.children}function kc(e,t){this.props=e,this.context=t}function Nr(e,t){if(t==null)return e.__?Nr(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"?Nr(e):null}function OT(e){if(e.__P&&e.__d){var t=e.__v,n=t.__e,i=[],r=[],o=Mi({},t);o.__v=t.__v+1,ct.vnode&&ct.vnode(o),Up(e.__P,o,t,e.__n,e.__P.namespaceURI,32&t.__u?[n]:null,i,n??Nr(t),!!(32&t.__u),r),o.__v=t.__v,o.__.__k[o.__i]=o,Ey(i,o,r),t.__e=t.__=null,o.__e!=n&&my(o)}}function my(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}),my(e)}function gy(e){(!e.__d&&(e.__d=!0)&&ur.push(e)&&!Dc.__r++||ly!=ct.debounceRendering)&&((ly=ct.debounceRendering)||py)(Dc)}function Dc(){try{for(var e,t=1;ur.length;)ur.length>t&&ur.sort(fy),e=ur.shift(),t=ur.length,OT(e)}finally{ur.length=Dc.__r=0}}function vy(e,t,n,i,r,o,a,s,c,u,l){var p,f,d,h,m,g,S=i&&i.__k||Pc,E=t.length;for(c=IT(n,t,S,c,E),p=0;p<E;p++)(d=n.__k[p])!=null&&(f=d.__i!=-1&&S[d.__i]||Cc,d.__i=p,g=Up(e,d,f,r,o,a,s,c,u,l),h=d.__e,d.ref&&f.ref!=d.ref&&(f.ref&&qp(f.ref,null,d),l.push(d.ref,d.__c||h,d)),m==null&&h!=null&&(m=h),4&d.__u?(c=yy(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 IT(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]=Tc(null,a,null,null,null):Ac(a)?a=e.__k[o]=Tc(Mc,{children:a},null,null,null):a.constructor===void 0&&a.__b>0?a=e.__k[o]=Tc(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=LT(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=Nr(s)),Sy(s,s));return i}function yy(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=yy(i[r],t,n));return t}e.__e!=t&&(t&&e.type&&!t.parentNode&&(t=Nr(e)),t=n.insertBefore(e.__e,t||null));do t=t&&t.nextSibling;while(t!=null&&t.nodeType==8);return t}function LT(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 _y(e,t,n){t[0]=="-"?e.setProperty(t,n??""):e[t]=n==null?"":typeof n!="number"||DT.test(t)?n:n+"px"}function Oc(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||_y(e.style,t,"");if(n)for(t in n)i&&n[t]==i[t]||_y(e.style,t,n[t])}else if(t[0]=="o"&&t[1]=="n")o=t!=(t=t.replace(dy,"$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[xa]=i[xa]:(n[xa]=zp,e.addEventListener(t,o?Gp:Vp,o)):e.removeEventListener(t,o?Gp:Vp,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 by(e){return function(t){if(this.l){var n=this.l[t.type+e];if(t[Rc]==null)t[Rc]=zp++;else if(t[Rc]<n[xa])return;return n(ct.event?ct.event(t):t)}}}function Up(e,t,n,i,r,o,a,s,c,u){var l,p,f,d,h,m,g,S,E,b,x,w,T,I,P,j,F=t.type;if(t.constructor!==void 0)return null;128&n.__u&&(c=!!(32&n.__u),o=[s=t.__e=n.__e]),(l=ct.__b)&&l(t);e:if(typeof F=="function"){p=a.length;try{if(E=t.props,b=F.prototype&&F.prototype.render,x=(l=F.contextType)&&i[l.__c],w=l?x?x.props.value:l.__:i,n.__c?S=(f=t.__c=n.__c).__=f.__E:(b?t.__c=f=new F(E,w):(t.__c=f=new kc(E,w),f.constructor=F,f.render=BT),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&&F.getDerivedStateFromProps!=null&&(f.__s==f.state&&(f.__s=Mi({},f.__s)),Mi(f.__s,F.getDerivedStateFromProps(E,f.__s))),h=f.props,m=f.state,f.__v=t,d)b&&F.getDerivedStateFromProps==null&&f.componentWillMount!=null&&f.componentWillMount(),b&&f.componentDidMount!=null&&f.__h.push(f.componentDidMount);else{if(b&&F.getDerivedStateFromProps==null&&E!==h&&f.componentWillReceiveProps!=null&&f.componentWillReceiveProps(E,w),t.__v==n.__v||!f.__e&&f.shouldComponentUpdate!=null&&f.shouldComponentUpdate(E,f.__s,w)===!1){t.__v!=n.__v&&(f.props=E,f.state=f.__s,f.__d=!1),t.__e=n.__e,t.__k=n.__k,t.__k.some(function(L){L&&(L.__=t)}),Pc.push.apply(f.__h,f._sb),f._sb=[],f.__h.length&&a.push(f),s=Nr(n);break e}f.componentWillUpdate!=null&&f.componentWillUpdate(E,f.__s,w),b&&f.componentDidUpdate!=null&&f.__h.push(function(){f.componentDidUpdate(h,m,g)})}if(f.context=w,f.props=E,f.__P=e,f.__e=!1,T=ct.__r,I=0,b)f.state=f.__s,f.__d=!1,T&&T(t),l=f.render(f.props,f.state,f.context),Pc.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&&++I<25);f.state=f.__s,f.getChildContext!=null&&(i=Mi(Mi({},i),f.getChildContext())),b&&!d&&f.getSnapshotBeforeUpdate!=null&&(g=f.getSnapshotBeforeUpdate(h,m)),P=l!=null&&l.type===Mc&&l.key==null?wy(l.props.children):l,s=vy(e,Ac(P)?P:[P],t,n,i,r,o,a,s,c,u),f.base=t.__e,t.__u&=-161,f.__h.length&&a.push(f),S&&(f.__E=f.__=null)}catch(L){if(a.length=p,t.__v=null,c||o!=null){if(L.then){for(t.__u|=c?160:128;s&&s.nodeType==8&&s.nextSibling;)s=s.nextSibling;o!=null&&(o[o.indexOf(s)]=null),t.__e=s}else if(o!=null)for(j=o.length;j--;)Wp(o[j])}else t.__e=n.__e;t.__k==null&&(t.__k=n.__k||[]),L.then||xy(t),ct.__e(L,t,n)}}else o==null&&t.__v==n.__v?(t.__k=n.__k,t.__e=n.__e):s=t.__e=NT(n.__e,t,n,i,r,o,a,c,u);return(l=ct.diffed)&&l(t),128&t.__u?void 0:s}function xy(e){e&&(e.__c&&(e.__c.__e=!0),e.__k&&e.__k.some(xy))}function Ey(e,t,n){for(var i=0;i<n.length;i++)qp(n[i],n[++i],n[++i]);ct.__c&&ct.__c(t,e),e.some(function(r){try{e=r.__h,r.__h=[],e.some(function(o){o.call(r)})}catch(o){ct.__e(o,r.__v)}})}function wy(e){return typeof e!="object"||e==null||e.__b>0?e:Ac(e)?e.map(wy):e.constructor!==void 0?null:Mi({},e)}function NT(e,t,n,i,r,o,a,s,c){var u,l,p,f,d,h,m,g=n.props||Cc,S=t.props,E=t.type;if(E=="svg"?r="http://www.w3.org/2000/svg":E=="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==!!E&&(E?d.localName==E:d.nodeType==3)){e=d,o[u]=null;break}}if(e==null){if(E==null)return document.createTextNode(S);e=document.createElementNS(r,E,S.is&&S),s&&(ct.__m&&ct.__m(t,o),s=!1),o=null}if(E==null)g===S||s&&e.data==S||(e.data=S);else{if(o=E=="textarea"&&S.defaultValue!=null?null:o&&Sc.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 S||u=="value"&&"defaultValue"in S||u=="checked"&&"defaultChecked"in S||Oc(e,u,null,d,r);for(u in S)d=S[u],u=="children"?f=d:u=="dangerouslySetInnerHTML"?l=d:u=="value"?h=d:u=="checked"?m=d:s&&typeof d!="function"||g[u]===d||Oc(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=""),vy(t.type=="template"?e.content:e,Ac(f)?f:[f],t,n,i,E=="foreignObject"?"http://www.w3.org/1999/xhtml":r,o,a,o?o[0]:n.__k&&Nr(n,0),s,c),o!=null)for(u=o.length;u--;)Wp(o[u]);s&&E!="textarea"||(u="value",E=="progress"&&h==null?e.removeAttribute("value"):h!=null&&(h!==e[u]||E=="progress"&&!h||E=="option"&&h!=g[u])&&Oc(e,u,h,g[u],r),u="checked",m!=null&&m!=e[u]&&Oc(e,u,m,g[u],r))}return e}function qp(e,t,n){try{if(typeof e=="function"){var i=typeof e.__u=="function";i&&e.__u(),i&&t==null||(e.__u=e(t))}else e.current=t}catch(r){ct.__e(r,n)}}function Sy(e,t,n){var i,r;if(ct.unmount&&ct.unmount(e),(i=e.ref)&&(i.current&&i.current!=e.__e||qp(i,null,t)),(i=e.__c)!=null){if(i.componentWillUnmount)try{i.componentWillUnmount()}catch(o){ct.__e(o,t)}i.base=i.__P=i.__n=null}if(i=e.__k)for(r=0;r<i.length;r++)i[r]&&Sy(i[r],t,n||typeof e.type!="function");n||Wp(e.__e),e.__c=e.__=e.__e=void 0}function BT(e,t,n){return this.constructor(e,n)}function Ry(e,t,n){var i,r,o,a;t==document&&(t=document.documentElement),ct.__&&ct.__(e,t),r=(i=!1)?null:t.__k,o=[],a=[],Up(t,e=t.__k=hy(Mc,null,[e]),r||Cc,Cc,t.namespaceURI,r?null:t.firstChild?Sc.call(t.childNodes):null,o,r?r.__e:t.firstChild,i,a),Ey(o,e,a),e.props.children=null}Sc=Pc.slice,ct={__e:function(e,t,n,i){for(var r,o,a;t=t.__;)if((r=t.__c)&&!r.__)try{if((o=r.constructor)&&o.getDerivedStateFromError!=null&&(r.setState(o.getDerivedStateFromError(e)),a=r.__d),r.componentDidCatch!=null&&(r.componentDidCatch(e,i||{}),a=r.__d),a)return r.__E=r}catch(s){e=s}throw e}},uy=0,kc.prototype.setState=function(e,t){var n;n=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=Mi({},this.state),typeof e=="function"&&(e=e(Mi({},n),this.props)),e&&Mi(n,e),e!=null&&this.__v&&(t&&this._sb.push(t),gy(this))},kc.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),gy(this))},kc.prototype.render=Mc,ur=[],py=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,fy=function(e,t){return e.__v.__b-t.__v.__b},Dc.__r=0,Hp=Math.random().toString(8),Rc="__d"+Hp,xa="__a"+Hp,dy=/(PointerCapture)$|Capture$/i,zp=0,Vp=by(!1),Gp=by(!0);var Cy=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,Cy(e,s,n,["",null])),i.push(r),s[0]?t[0]|=2:(t[o-2]=0,t[o]=r)):i.push(s)}return i},Py=new Map;function $T(e){var t=Py.get(this);return t||(t=new Map,Py.set(this,t)),(t=Cy(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
|
|
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}},lt.prototype._setDefinitions=function(e){this._definitions=e},lt.prototype.getModules=function(){return this._modules},lt.prototype.clear=function(){this.getDefinitions()&&Ki.prototype.clear.call(this)},lt.prototype.destroy=function(){Ki.prototype.destroy.call(this),ai(this._container)},lt.prototype.on=function(e,t,n,i){return this.get("eventBus").on(e,t,n,i)},lt.prototype.off=function(e,t){this.get("eventBus").off(e,t)},lt.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=qe(e)),e.appendChild(this._container),this._emit("attach",{}),this.get("canvas").resized()},lt.prototype.getDefinitions=function(){return this._definitions},lt.prototype.detach=function(){const e=this._container,t=e.parentNode;t&&(this._emit("detach",{}),t.removeChild(e))},lt.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=D(ti(n,["additionalModules"]),{canvas:D({},n.canvas,{container:e}),modules:a});Ki.call(this,s),n&&n.container&&this.attachTo(n.container)},lt.prototype._emit=function(e,t){return this.get("eventBus").fire(e,t)},lt.prototype._createContainer=function(e){const t=nt('<div class="bjs-container"></div>');return ln(t,{width:Dh(e.width),height:Dh(e.height),position:e.position}),t},lt.prototype._createModdle=function(e){const t=D({},this._moddleExtensions,e.moddleExtensions);return new Zf(t)},lt.prototype._modules=[];function gs(e,t){return e.warnings=t,e}function y1(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 _1={width:"100%",height:"100%",position:"relative"};function Dh(e){return e+(me(e)?"px":"")}function b1(e,t){return t&&et(e.diagrams,function(n){return n.id===t})||null}function x1(e){const n='<a href="http://bpmn.io" target="_blank" class="bjs-powered-by" title="Powered by bpmn.io" >'+Ah+"</a>",i=nt(n);ln(qe("svg",i),Th),ln(i,Mh,{position:"absolute",bottom:"15px",right:"15px",zIndex:"100"}),e.appendChild(i),ve.bind(i,"click",function(r){v1(),r.preventDefault()})}function eo(e){lt.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)}te(eo,lt),eo.prototype._createModdle=function(e){var t=lt.prototype._createModdle.call(this,e);return t.ids=new oi([32,36,1]),t},eo.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 Me(e,t){return y(e,"bpmn:CallActivity")?!1:y(e,"bpmn:SubProcess")?(t=t||Ie(e),t&&y(t,"bpmndi:BPMNPlane")?!0:t&&!!t.isExpanded):y(e,"bpmn:Participant")?!!q(e).processRef:!0}function jt(e){if(!(!y(e,"bpmn:Participant")&&!y(e,"bpmn:Lane"))){var t=Ie(e).isHorizontal;return t===void 0?!0:t}}function E1(e){return e&&q(e).isInterrupting!==!1}function nn(e){return e&&!!q(e).triggeredByEvent}function to(e,t){var n=q(e).eventDefinitions;return Ni(n,function(i){return y(i,t)})}function w1(e){return to(e,"bpmn:ErrorEventDefinition")}function S1(e){return to(e,"bpmn:EscalationEventDefinition")}function R1(e){return to(e,"bpmn:CompensateEventDefinition")}var Pr={width:90,height:20},Oh=15;function Xi(e){return y(e,"bpmn:Event")||y(e,"bpmn:Gateway")||y(e,"bpmn:DataStoreReference")||y(e,"bpmn:DataObjectReference")||y(e,"bpmn:DataInput")||y(e,"bpmn:DataOutput")||y(e,"bpmn:SequenceFlow")||y(e,"bpmn:MessageFlow")||y(e,"bpmn:Group")}function vs(e){return Ee(e.label)}function C1(e){var t=e.length/2-1,n=e[Math.floor(t)],i=e[Math.ceil(t+.01)],r=P1(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-=Oh:a+=Oh,{x:a,y:s}}function P1(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 Ju(e){return e.waypoints?C1(e.waypoints):y(e,"bpmn:Group")?{x:e.x+e.width/2,y:e.y+Pr.height/2}:{x:e.x+e.width/2,y:e.y+e.height+Pr.height/2}}function A1(e,t){var n,i,r,o=e.label;return o&&o.bounds?(r=o.bounds,i={width:Math.max(Pr.width,r.width),height:r.height},n={x:r.x+r.width/2,y:r.y+r.height/2}):(n=Ju(t),i=Pr),D({x:n.x-i.width/2,y:n.y-i.height/2},i)}function Ih(e){if(y(e,"bpmn:FlowElement")||y(e,"bpmn:Participant")||y(e,"bpmn:Lane")||y(e,"bpmn:SequenceFlow")||y(e,"bpmn:MessageFlow")||y(e,"bpmn:DataInput")||y(e,"bpmn:DataOutput"))return"name";if(y(e,"bpmn:TextAnnotation"))return"text";if(y(e,"bpmn:Group"))return"categoryValueRef"}function T1(e){var t=e.categoryValueRef;return t&&t.value||""}function kn(e){var t=e.businessObject,n=Ih(t);if(n)return n==="categoryValueRef"?T1(t):t[n]||""}function M1(e,t){var n=e.businessObject,i=Ih(n);if(i)if(i==="categoryValueRef"){if(!n[i])return e;n[i].value=t}else n[i]=t;return e}function k1(e){return Ee(e)&&Xi(e.labelTarget)}var no=7;function Lh(e){let t=[];return M(e.incoming,n=>{y(n,"bpmn:Association")&&y(n.source,"bpmn:TextAnnotation")&&t.push({annotation:n.source,association:n})}),M(e.outgoing,n=>{y(n,"bpmn:Association")&&y(n.target,"bpmn:TextAnnotation")&&t.push({annotation:n.target,association:n})}),t}function Wo(e){const t=new Map;return M(Uu(e),n=>{M(Lh(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 el="hsl(225, 10%, 15%)",D1="white";function li(e,t){return Ni(e.eventDefinitions,function(n){return n.$type===t})}function O1(e){return e.$type==="bpmn:IntermediateThrowEvent"||e.$type==="bpmn:EndEvent"}function I1(e){var t=e.dataObjectRef;return e.isCollection||t&&t.isCollection}function Te(e,t,n){var i=Ie(e);return n||i.get("color:background-color")||i.get("bioc:fill")||t||D1}function J(e,t,n){var i=Ie(e);return n||i.get("color:border-color")||i.get("bioc:stroke")||t||el}function Uo(e,t,n,i){var r=Ie(e),o=r.get("label");return i||o&&o.get("color:color")||t||J(e,n)}function Nh(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 Sr(r)}function tl(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 Sr(a)}function L1(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 Sr(s)}function N1(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 Sr(o)}function qo(e,t={}){return{width:$n(e,t),height:xn(e,t)}}function $n(e,t={}){return vn(t,"width")?t.width:e.width}function xn(e,t={}){return vn(t,"height")?t.height:e.height}var B1=new oi,$1=10,ys=3,j1=1.5,_s=10,F1=4,io=.95,H1=1,z1=.25;function Ar(e,t,n,i,r,o,a){bi.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:el,strokeWidth:2,fill:"white"})}function p(C){return n.computeStyle(C,["no-fill"],{strokeLinecap:"round",strokeLinejoin:"round",stroke:el,strokeWidth:2})}function f(C,_){var{ref:v={x:0,y:0},scale:k=1,element:O,parentGfx:z=r._svg}=_,ie=ce("marker",{id:C,viewBox:"0 0 20 20",refX:v.x,refY:v.y,markerWidth:20*k,markerHeight:20*k,orient:"auto"});ye(ie,O);var be=qe(":scope > defs",z);be||(be=ce("defs"),ye(z,be)),ye(be,ie)}function d(C,_,v,k){var O=B1.nextPrefixed("marker-");return h(C,O,_,v,k),"url(#"+O+")"}function h(C,_,v,k,O){if(v==="sequenceflow-end"){var z=ce("path",{d:"M 1 5 L 11 10 L 1 15 Z",...l({fill:O,stroke:O,strokeWidth:1})});f(_,{element:z,ref:{x:11,y:10},scale:.5,parentGfx:C})}if(v==="messageflow-start"){var ie=ce("circle",{cx:6,cy:6,r:3.5,...l({fill:k,stroke:O,strokeWidth:1,strokeDasharray:[1e4,1]})});f(_,{element:ie,ref:{x:6,y:6},parentGfx:C})}if(v==="messageflow-end"){var be=ce("path",{d:"m 1 5 l 0 -3 l 7 3 l -7 3 z",...l({fill:k,stroke:O,strokeWidth:1,strokeDasharray:[1e4,1]})});f(_,{element:be,ref:{x:8.5,y:5},parentGfx:C})}if(v==="association-start"){var Ne=ce("path",{d:"M 11 5 L 1 10 L 11 15",...p({fill:"none",stroke:O,strokeWidth:1.5,strokeDasharray:[1e4,1]})});f(_,{element:Ne,ref:{x:1,y:10},scale:.5,parentGfx:C})}if(v==="association-end"){var mt=ce("path",{d:"M 1 5 L 11 10 L 1 15",...p({fill:"none",stroke:O,strokeWidth:1.5,strokeDasharray:[1e4,1]})});f(_,{element:mt,ref:{x:11,y:10},scale:.5,parentGfx:C})}if(v==="conditional-flow-marker"){var Ye=ce("path",{d:"M 0 10 L 8 6 L 16 10 L 8 14 Z",...l({fill:k,stroke:O})});f(_,{element:Ye,ref:{x:-1,y:10},scale:.5,parentGfx:C})}if(v==="conditional-default-flow-marker"){var Lt=ce("path",{d:"M 6 4 L 10 16",...l({stroke:O,fill:"none"})});f(_,{element:Lt,ref:{x:0,y:10},scale:.5,parentGfx:C})}}function m(C,_,v,k,O={}){Nt(k)&&(O=k,k=0),k=k||0,O=l(O);var z=_/2,ie=v/2,be=ce("circle",{cx:z,cy:ie,r:Math.round((_+v)/4-k),...O});return ye(C,be),be}function g(C,_,v,k,O,z){Nt(O)&&(z=O,O=0),O=O||0,z=l(z);var ie=ce("rect",{x:O,y:O,width:_-O*2,height:v-O*2,rx:k,ry:k,...z});return ye(C,ie),ie}function S(C,_,v,k){var O=_/2,z=v/2,ie=[{x:O,y:0},{x:_,y:z},{x:O,y:v},{x:0,y:z}],be=ie.map(function(mt){return mt.x+","+mt.y}).join(" ");k=l(k);var Ne=ce("polygon",{...k,points:be});return ye(C,Ne),Ne}function E(C,_,v,k){v=p(v);var O=$o(_,v,k);return ye(C,O),O}function b(C,_,v){return E(C,_,v,5)}function x(C,_,v){v=p(v);var k=ce("path",{...v,d:_});return ye(C,k),k}function w(C,_,v,k){return x(_,v,D({"data-marker":C},k))}function T(C){return bt[C]}function I(C){return function(_,v,k){return T(C)(_,v,k)}}var P={"bpmn:MessageEventDefinition":function(C,_,v={},k){var O=i.getScaledPath("EVENT_MESSAGE",{xScaleFactor:.9,yScaleFactor:.9,containerWidth:v.width||_.width,containerHeight:v.height||_.height,position:{mx:.235,my:.315}}),z=k?J(_,c,v.stroke):Te(_,s,v.fill),ie=k?Te(_,s,v.fill):J(_,c,v.stroke),be=x(C,O,{fill:z,stroke:ie,strokeWidth:1});return be},"bpmn:TimerEventDefinition":function(C,_,v={}){var k=v.width||_.width,O=v.height||_.height,z=v.width?1:2,ie=m(C,k,O,.2*O,{fill:Te(_,s,v.fill),stroke:J(_,c,v.stroke),strokeWidth:z}),be=i.getScaledPath("EVENT_TIMER_WH",{xScaleFactor:.75,yScaleFactor:.75,containerWidth:k,containerHeight:O,position:{mx:.5,my:.5}});x(C,be,{stroke:J(_,c,v.stroke),strokeWidth:z});for(var Ne=0;Ne<12;Ne++){var mt=i.getScaledPath("EVENT_TIMER_LINE",{xScaleFactor:.75,yScaleFactor:.75,containerWidth:k,containerHeight:O,position:{mx:.5,my:.5}}),Ye=k/2,Lt=O/2;x(C,mt,{strokeWidth:1,stroke:J(_,c,v.stroke),transform:"rotate("+Ne*30+","+Lt+","+Ye+")"})}return ie},"bpmn:EscalationEventDefinition":function(C,_,v={},k){var O=i.getScaledPath("EVENT_ESCALATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:v.width||_.width,containerHeight:v.height||_.height,position:{mx:.5,my:.2}}),z=k?J(_,c,v.stroke):Te(_,s,v.fill);return x(C,O,{fill:z,stroke:J(_,c,v.stroke),strokeWidth:1})},"bpmn:ConditionalEventDefinition":function(C,_,v={}){var k=i.getScaledPath("EVENT_CONDITIONAL",{xScaleFactor:1,yScaleFactor:1,containerWidth:v.width||_.width,containerHeight:v.height||_.height,position:{mx:.5,my:.222}});return x(C,k,{fill:Te(_,s,v.fill),stroke:J(_,c,v.stroke),strokeWidth:1})},"bpmn:LinkEventDefinition":function(C,_,v={},k){var O=i.getScaledPath("EVENT_LINK",{xScaleFactor:1,yScaleFactor:1,containerWidth:_.width,containerHeight:_.height,position:{mx:.57,my:.263}}),z=k?J(_,c,v.stroke):Te(_,s,v.fill);return x(C,O,{fill:z,stroke:J(_,c,v.stroke),strokeWidth:1})},"bpmn:ErrorEventDefinition":function(C,_,v={},k){var O=i.getScaledPath("EVENT_ERROR",{xScaleFactor:1.1,yScaleFactor:1.1,containerWidth:v.width||_.width,containerHeight:v.height||_.height,position:{mx:.2,my:.722}}),z=k?J(_,c,v.stroke):Te(_,s,v.fill);return x(C,O,{fill:z,stroke:J(_,c,v.stroke),strokeWidth:1})},"bpmn:CancelEventDefinition":function(C,_,v={},k){var O=i.getScaledPath("EVENT_CANCEL_45",{xScaleFactor:1,yScaleFactor:1,containerWidth:_.width,containerHeight:_.height,position:{mx:.638,my:-.055}}),z=k?J(_,c,v.stroke):"none",ie=x(C,O,{fill:z,stroke:J(_,c,v.stroke),strokeWidth:1});return Ch(ie,45),ie},"bpmn:CompensateEventDefinition":function(C,_,v={},k){var O=i.getScaledPath("EVENT_COMPENSATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:v.width||_.width,containerHeight:v.height||_.height,position:{mx:.22,my:.5}}),z=k?J(_,c,v.stroke):Te(_,s,v.fill);return x(C,O,{fill:z,stroke:J(_,c,v.stroke),strokeWidth:1})},"bpmn:SignalEventDefinition":function(C,_,v={},k){var O=i.getScaledPath("EVENT_SIGNAL",{xScaleFactor:.9,yScaleFactor:.9,containerWidth:v.width||_.width,containerHeight:v.height||_.height,position:{mx:.5,my:.2}}),z=k?J(_,c,v.stroke):Te(_,s,v.fill);return x(C,O,{strokeWidth:1,fill:z,stroke:J(_,c,v.stroke)})},"bpmn:MultipleEventDefinition":function(C,_,v={},k){var O=i.getScaledPath("EVENT_MULTIPLE",{xScaleFactor:1.1,yScaleFactor:1.1,containerWidth:v.width||_.width,containerHeight:v.height||_.height,position:{mx:.211,my:.36}}),z=k?J(_,c,v.stroke):Te(_,s,v.fill);return x(C,O,{fill:z,stroke:J(_,c,v.stroke),strokeWidth:1})},"bpmn:ParallelMultipleEventDefinition":function(C,_,v={}){var k=i.getScaledPath("EVENT_PARALLEL_MULTIPLE",{xScaleFactor:1.2,yScaleFactor:1.2,containerWidth:v.width||_.width,containerHeight:v.height||_.height,position:{mx:.458,my:.194}});return x(C,k,{fill:Te(_,s,v.fill),stroke:J(_,c,v.stroke),strokeWidth:1})},"bpmn:TerminateEventDefinition":function(C,_,v={}){var k=m(C,_.width,_.height,8,{fill:J(_,c,v.stroke),stroke:J(_,c,v.stroke),strokeWidth:4});return k}};function j(C,_,v={},k){var O=q(C),z=O1(O),ie=k||C;return O.get("eventDefinitions")&&O.get("eventDefinitions").length>1?O.get("parallelMultiple")?P["bpmn:ParallelMultipleEventDefinition"](_,ie,v,z):P["bpmn:MultipleEventDefinition"](_,ie,v,z):li(O,"bpmn:MessageEventDefinition")?P["bpmn:MessageEventDefinition"](_,ie,v,z):li(O,"bpmn:TimerEventDefinition")?P["bpmn:TimerEventDefinition"](_,ie,v,z):li(O,"bpmn:ConditionalEventDefinition")?P["bpmn:ConditionalEventDefinition"](_,ie,v,z):li(O,"bpmn:SignalEventDefinition")?P["bpmn:SignalEventDefinition"](_,ie,v,z):li(O,"bpmn:EscalationEventDefinition")?P["bpmn:EscalationEventDefinition"](_,ie,v,z):li(O,"bpmn:LinkEventDefinition")?P["bpmn:LinkEventDefinition"](_,ie,v,z):li(O,"bpmn:ErrorEventDefinition")?P["bpmn:ErrorEventDefinition"](_,ie,v,z):li(O,"bpmn:CancelEventDefinition")?P["bpmn:CancelEventDefinition"](_,ie,v,z):li(O,"bpmn:CompensateEventDefinition")?P["bpmn:CompensateEventDefinition"](_,ie,v,z):li(O,"bpmn:TerminateEventDefinition")?P["bpmn:TerminateEventDefinition"](_,ie,v,z):null}var F={ParticipantMultiplicityMarker:function(C,_,v={}){var k=$n(_,v),O=xn(_,v),z=i.getScaledPath("MARKER_PARALLEL",{xScaleFactor:1,yScaleFactor:1,containerWidth:k,containerHeight:O,position:{mx:(k/2-6)/k,my:(O-15)/O}});w("participant-multiplicity",C,z,{strokeWidth:2,fill:Te(_,s,v.fill),stroke:J(_,c,v.stroke)})},SubProcessMarker:function(C,_,v={}){var k=g(C,14,14,0,{strokeWidth:1,fill:Te(_,s,v.fill),stroke:J(_,c,v.stroke)});Wt(k,_.width/2-7.5,_.height-20);var O=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}});w("sub-process",C,O,{fill:Te(_,s,v.fill),stroke:J(_,c,v.stroke)})},ParallelMarker:function(C,_,v){var k=$n(_,v),O=xn(_,v),z=i.getScaledPath("MARKER_PARALLEL",{xScaleFactor:1,yScaleFactor:1,containerWidth:k,containerHeight:O,position:{mx:(k/2+v.parallel)/k,my:(O-20)/O}});w("parallel",C,z,{fill:Te(_,s,v.fill),stroke:J(_,c,v.stroke)})},SequentialMarker:function(C,_,v){var k=i.getScaledPath("MARKER_SEQUENTIAL",{xScaleFactor:1,yScaleFactor:1,containerWidth:_.width,containerHeight:_.height,position:{mx:(_.width/2+v.seq)/_.width,my:(_.height-19)/_.height}});w("sequential",C,k,{fill:Te(_,s,v.fill),stroke:J(_,c,v.stroke)})},CompensationMarker:function(C,_,v){var k=i.getScaledPath("MARKER_COMPENSATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:_.width,containerHeight:_.height,position:{mx:(_.width/2+v.compensation)/_.width,my:(_.height-13)/_.height}});w("compensation",C,k,{strokeWidth:1,fill:Te(_,s,v.fill),stroke:J(_,c,v.stroke)})},LoopMarker:function(C,_,v){var k=$n(_,v),O=xn(_,v),z=i.getScaledPath("MARKER_LOOP",{xScaleFactor:1,yScaleFactor:1,containerWidth:k,containerHeight:O,position:{mx:(k/2+v.loop)/k,my:(O-7)/O}});w("loop",C,z,{strokeWidth:1.5,fill:"none",stroke:J(_,c,v.stroke),strokeMiterlimit:.5})},AdhocMarker:function(C,_,v){var k=$n(_,v),O=xn(_,v),z=i.getScaledPath("MARKER_ADHOC",{xScaleFactor:1,yScaleFactor:1,containerWidth:k,containerHeight:O,position:{mx:(k/2+v.adhoc)/k,my:(O-15)/O}});w("adhoc",C,z,{strokeWidth:1,fill:J(_,c,v.stroke),stroke:J(_,c,v.stroke)})}};function L(C,_,v,k){F[C](_,v,k)}function H(C,_,v=[],k={}){k={fill:k.fill,stroke:k.stroke,width:$n(_,k),height:xn(_,k)};var O=q(_),z=v.includes("SubProcessMarker");z?k={...k,seq:-21,parallel:-22,compensation:-25,loop:-18,adhoc:10}:k={...k,seq:-5,parallel:-6,compensation:-7,loop:0,adhoc:-8},O.get("isForCompensation")&&v.push("CompensationMarker"),y(O,"bpmn:AdHocSubProcess")&&(v.push("AdhocMarker"),z||D(k,{compensation:k.compensation-18}));var ie=O.get("loopCharacteristics"),be=ie&&ie.get("isSequential");ie&&(D(k,{compensation:k.compensation-18}),v.includes("AdhocMarker")&&D(k,{seq:-23,loop:-18,parallel:-24}),be===void 0&&v.push("LoopMarker"),be===!1&&v.push("ParallelMarker"),be===!0&&v.push("SequentialMarker")),v.includes("CompensationMarker")&&v.length===1&&D(k,{compensation:-8}),M(v,function(Ne){L(Ne,C,_,k)})}function oe(C,_,v={}){v=D({size:{width:100}},v);var k=o.createText(_||"",v);return ke(k).add("djs-label"),ye(C,k),k}function De(C,_,v,k={}){var O=q(_),z=qo({x:_.x,y:_.y,width:_.width,height:_.height},k);return oe(C,O.name,{align:v,box:z,padding:7,style:{fill:Uo(_,u,c,k.stroke)}})}function ct(C,_,v={}){var k={width:_.width,height:_.height,x:_.width/2+_.x,y:_.height/2+_.y};return oe(C,kn(_),{box:k,style:D({},o.getExternalStyle(),{fill:Uo(_,u,c,v.stroke)})})}function Y(C,_,v,k={}){var O=jt(v),z=oe(C,_,{box:{height:30,width:O?xn(v,k):$n(v,k)},align:"center-middle",style:{fill:Uo(v,u,c,k.stroke)}});if(O){var ie=-1*xn(v,k);hs(z,0,-ie,270)}}function re(C,_,v={}){var{width:k,height:O}=qo(_,v);return g(C,k,O,_s,{...v,fill:Te(_,s,v.fill),fillOpacity:io,stroke:J(_,c,v.stroke)})}function le(C,_,v={}){var k=q(_),O=Te(_,s,v.fill),z=J(_,c,v.stroke);return(k.get("associationDirection")==="One"||k.get("associationDirection")==="Both")&&(v.markerEnd=d(C,"association-end",O,z)),k.get("associationDirection")==="Both"&&(v.markerStart=d(C,"association-start",O,z)),v=Le(v,["markerStart","markerEnd"]),b(C,_.waypoints,{...v,stroke:z,strokeDasharray:"0, 5"})}function ae(C,_,v={}){var k=Te(_,s,v.fill),O=J(_,c,v.stroke),z=i.getScaledPath("DATA_OBJECT_PATH",{xScaleFactor:1,yScaleFactor:1,containerWidth:_.width,containerHeight:_.height,position:{mx:.474,my:.296}}),ie=x(C,z,{fill:k,fillOpacity:io,stroke:O}),be=q(_);if(I1(be)){var Ne=i.getScaledPath("DATA_OBJECT_COLLECTION_PATH",{xScaleFactor:1,yScaleFactor:1,containerWidth:_.width,containerHeight:_.height,position:{mx:.33,my:(_.height-18)/_.height}});x(C,Ne,{strokeWidth:2,fill:k,stroke:O})}return ie}function se(C,_,v={}){return m(C,_.width,_.height,{fillOpacity:io,...v,fill:Te(_,s,v.fill),stroke:J(_,c,v.stroke)})}function Z(C,_,v={}){return S(C,_.width,_.height,{fill:Te(_,s,v.fill),fillOpacity:io,stroke:J(_,c,v.stroke)})}function $(C,_,v={}){var k=g(C,$n(_,v),xn(_,v),0,{fill:Te(_,s,v.fill),fillOpacity:v.fillOpacity||io,stroke:J(_,c,v.stroke),strokeWidth:1.5}),O=q(_);if(y(O,"bpmn:Lane")){var z=O.get("name");Y(C,z,_,v)}return k}function N(C,_,v={}){var k=re(C,_,v),O=Me(_);if(nn(_)&&(ne(k,{strokeDasharray:"0, 5.5",strokeWidth:2.5}),!O)){var z=q(_).flowElements||[],ie=z.filter(be=>y(be,"bpmn:StartEvent"));ie.length===1&&V(ie[0],C,v,_)}return De(C,_,O?"center-top":"center-middle",v),O?H(C,_,void 0,v):H(C,_,["SubProcessMarker"],v),k}function V(C,_,v,k){var O=22,z={fill:Te(k,s,v.fill),stroke:J(k,c,v.stroke),width:O,height:O},ie=q(C).isInterrupting,be=ie?0:3,Ne=ie?1:1.2,mt=20,Ye=(O-mt)/2,Lt="translate("+Ye+","+Ye+")";m(_,mt,mt,{fill:z.fill,stroke:z.stroke,strokeWidth:Ne,strokeDasharray:be,transform:Lt}),j(C,_,z,k)}function Re(C,_,v={}){var k=re(C,_,v);return De(C,_,"center-middle",v),H(C,_,void 0,v),k}var bt=this.handlers={"bpmn:AdHocSubProcess":function(C,_,v={}){return Me(_)?v=Le(v,["fill","stroke","width","height"]):v=Le(v,["fill","stroke"]),N(C,_,v)},"bpmn:Association":function(C,_,v={}){return v=Le(v,["fill","stroke"]),le(C,_,v)},"bpmn:BoundaryEvent":function(C,_,v={}){var{renderIcon:k=!0}=v;v=Le(v,["fill","stroke"]);var O=q(_),z=O.get("cancelActivity");v={strokeWidth:1.5,fill:Te(_,s,v.fill),fillOpacity:H1,stroke:J(_,c,v.stroke)},z||(v.strokeDasharray="6");var ie=se(C,_,v);return m(C,_.width,_.height,ys,{...v,fill:"none"}),k&&j(_,C,v),ie},"bpmn:BusinessRuleTask":function(C,_,v={}){v=Le(v,["fill","stroke"]);var k=Re(C,_,v),O=i.getScaledPath("TASK_TYPE_BUSINESS_RULE_MAIN",{abspos:{x:8,y:8}}),z=x(C,O);ne(z,{fill:Te(_,s,v.fill),stroke:J(_,c,v.stroke),strokeWidth:1});var ie=i.getScaledPath("TASK_TYPE_BUSINESS_RULE_HEADER",{abspos:{x:8,y:8}}),be=x(C,ie);return ne(be,{fill:J(_,c,v.stroke),stroke:J(_,c,v.stroke),strokeWidth:1}),k},"bpmn:CallActivity":function(C,_,v={}){return v=Le(v,["fill","stroke"]),N(C,_,{strokeWidth:5,...v})},"bpmn:ComplexGateway":function(C,_,v={}){v=Le(v,["fill","stroke"]);var k=Z(C,_,v),O=i.getScaledPath("GATEWAY_COMPLEX",{xScaleFactor:.5,yScaleFactor:.5,containerWidth:_.width,containerHeight:_.height,position:{mx:.46,my:.26}});return x(C,O,{fill:J(_,c,v.stroke),stroke:J(_,c,v.stroke),strokeWidth:1}),k},"bpmn:DataInput":function(C,_,v={}){v=Le(v,["fill","stroke"]);var k=i.getRawPath("DATA_ARROW"),O=ae(C,_,v);return x(C,k,{fill:"none",stroke:J(_,c,v.stroke),strokeWidth:1}),O},"bpmn:DataInputAssociation":function(C,_,v={}){return v=Le(v,["fill","stroke"]),le(C,_,{...v,markerEnd:d(C,"association-end",Te(_,s,v.fill),J(_,c,v.stroke))})},"bpmn:DataObject":function(C,_,v={}){return v=Le(v,["fill","stroke"]),ae(C,_,v)},"bpmn:DataObjectReference":I("bpmn:DataObject"),"bpmn:DataOutput":function(C,_,v={}){v=Le(v,["fill","stroke"]);var k=i.getRawPath("DATA_ARROW"),O=ae(C,_,v);return x(C,k,{strokeWidth:1,fill:J(_,c,v.stroke),stroke:J(_,c,v.stroke)}),O},"bpmn:DataOutputAssociation":function(C,_,v={}){return v=Le(v,["fill","stroke"]),le(C,_,{...v,markerEnd:d(C,"association-end",Te(_,s,v.fill),J(_,c,v.stroke))})},"bpmn:DataStoreReference":function(C,_,v={}){v=Le(v,["fill","stroke"]);var k=i.getScaledPath("DATA_STORE",{xScaleFactor:1,yScaleFactor:1,containerWidth:_.width,containerHeight:_.height,position:{mx:0,my:.133}});return x(C,k,{fill:Te(_,s,v.fill),fillOpacity:io,stroke:J(_,c,v.stroke),strokeWidth:2})},"bpmn:EndEvent":function(C,_,v={}){var{renderIcon:k=!0}=v;v=Le(v,["fill","stroke"]);var O=se(C,_,{...v,strokeWidth:4});return k&&j(_,C,v),O},"bpmn:EventBasedGateway":function(C,_,v={}){v=Le(v,["fill","stroke"]);var k=q(_),O=Z(C,_,v);m(C,_.width,_.height,_.height*.2,{fill:Te(_,"none",v.fill),stroke:J(_,c,v.stroke),strokeWidth:1});var z=k.get("eventGatewayType"),ie=!!k.get("instantiate");function be(){var mt=i.getScaledPath("GATEWAY_EVENT_BASED",{xScaleFactor:.18,yScaleFactor:.18,containerWidth:_.width,containerHeight:_.height,position:{mx:.36,my:.44}});x(C,mt,{fill:"none",stroke:J(_,c,v.stroke),strokeWidth:2})}if(z==="Parallel"){var Ne=i.getScaledPath("GATEWAY_PARALLEL",{xScaleFactor:.4,yScaleFactor:.4,containerWidth:_.width,containerHeight:_.height,position:{mx:.474,my:.296}});x(C,Ne,{fill:"none",stroke:J(_,c,v.stroke),strokeWidth:1})}else z==="Exclusive"&&(ie||m(C,_.width,_.height,_.height*.26,{fill:"none",stroke:J(_,c,v.stroke),strokeWidth:1}),be());return O},"bpmn:ExclusiveGateway":function(C,_,v={}){v=Le(v,["fill","stroke"]);var k=Z(C,_,v),O=i.getScaledPath("GATEWAY_EXCLUSIVE",{xScaleFactor:.4,yScaleFactor:.4,containerWidth:_.width,containerHeight:_.height,position:{mx:.32,my:.3}}),z=Ie(_);return z.get("isMarkerVisible")&&x(C,O,{fill:J(_,c,v.stroke),stroke:J(_,c,v.stroke),strokeWidth:1}),k},"bpmn:Gateway":function(C,_,v={}){return v=Le(v,["fill","stroke"]),Z(C,_,v)},"bpmn:Group":function(C,_,v={}){return v=Le(v,["fill","stroke","width","height"]),g(C,_.width,_.height,_s,{stroke:J(_,c,v.stroke),strokeWidth:1.5,strokeDasharray:"10, 6, 0, 6",fill:"none",pointerEvents:"none",width:$n(_,v),height:xn(_,v)})},"bpmn:InclusiveGateway":function(C,_,v={}){v=Le(v,["fill","stroke"]);var k=Z(C,_,v);return m(C,_.width,_.height,_.height*.24,{fill:Te(_,s,v.fill),stroke:J(_,c,v.stroke),strokeWidth:2.5}),k},"bpmn:IntermediateEvent":function(C,_,v={}){var{renderIcon:k=!0}=v;v=Le(v,["fill","stroke"]);var O=se(C,_,{...v,strokeWidth:1.5});return m(C,_.width,_.height,ys,{fill:"none",stroke:J(_,c,v.stroke),strokeWidth:1.5}),k&&j(_,C,v),O},"bpmn:IntermediateCatchEvent":I("bpmn:IntermediateEvent"),"bpmn:IntermediateThrowEvent":I("bpmn:IntermediateEvent"),"bpmn:Lane":function(C,_,v={}){return v=Le(v,["fill","stroke","width","height"]),$(C,_,{...v,fillOpacity:z1})},"bpmn:ManualTask":function(C,_,v={}){v=Le(v,["fill","stroke"]);var k=Re(C,_,v),O=i.getScaledPath("TASK_TYPE_MANUAL",{abspos:{x:17,y:15}});return x(C,O,{fill:Te(_,s,v.fill),stroke:J(_,c,v.stroke),strokeWidth:.5}),k},"bpmn:MessageFlow":function(C,_,v={}){v=Le(v,["fill","stroke"]);var k=q(_),O=Ie(_),z=Te(_,s,v.fill),ie=J(_,c,v.stroke),be=b(C,_.waypoints,{markerEnd:d(C,"messageflow-end",z,ie),markerStart:d(C,"messageflow-start",z,ie),stroke:ie,strokeDasharray:"10, 11",strokeWidth:1.5});if(k.get("messageRef")){var Ne=be.getPointAtLength(be.getTotalLength()/2),mt=i.getScaledPath("MESSAGE_FLOW_MARKER",{abspos:{x:Ne.x,y:Ne.y}}),Ye={strokeWidth:1};O.get("messageVisibleKind")==="initiating"?(Ye.fill=z,Ye.stroke=ie):(Ye.fill=ie,Ye.stroke=z);var Lt=x(C,mt,Ye),Ft=k.get("messageRef"),rn=Ft.get("name"),tt=oe(C,rn,{align:"center-top",fitBox:!0,style:{fill:ie}}),At=Lt.getBBox(),on=tt.getBBox(),Fr=Ne.x-on.width/2,fn=Ne.y+At.height/2+$1;hs(tt,Fr,fn,0)}return be},"bpmn:ParallelGateway":function(C,_,v={}){v=Le(v,["fill","stroke"]);var k=Z(C,_,v),O=i.getScaledPath("GATEWAY_PARALLEL",{xScaleFactor:.6,yScaleFactor:.6,containerWidth:_.width,containerHeight:_.height,position:{mx:.46,my:.2}});return x(C,O,{fill:J(_,c,v.stroke),stroke:J(_,c,v.stroke),strokeWidth:1}),k},"bpmn:Participant":function(C,_,v={}){v=Le(v,["fill","stroke","width","height"]);var k=$(C,_,v),O=Me(_),z=jt(_),ie=q(_),be=ie.get("name");if(O){var Ne=z?[{x:30,y:0},{x:30,y:xn(_,v)}]:[{x:0,y:30},{x:$n(_,v),y:30}];E(C,Ne,{stroke:J(_,c,v.stroke),strokeWidth:j1}),Y(C,be,_,v)}else{var mt=qo(_,v);z||(mt.height=$n(_,v),mt.width=xn(_,v));var Ye=oe(C,be,{box:mt,align:"center-middle",style:{fill:Uo(_,u,c,v.stroke)}});if(!z){var Lt=-1*xn(_,v);hs(Ye,0,-Lt,270)}}return ie.get("participantMultiplicity")&&L("ParticipantMultiplicityMarker",C,_,v),k},"bpmn:ReceiveTask":function(C,_,v={}){v=Le(v,["fill","stroke"]);var k=q(_),O=Re(C,_,v),z;return k.get("instantiate")?(m(C,28,28,20*.22,{fill:Te(_,s,v.fill),stroke:J(_,c,v.stroke),strokeWidth:1}),z=i.getScaledPath("TASK_TYPE_INSTANTIATING_SEND",{abspos:{x:7.77,y:9.52}})):z=i.getScaledPath("TASK_TYPE_SEND",{xScaleFactor:.9,yScaleFactor:.9,containerWidth:21,containerHeight:14,position:{mx:.3,my:.4}}),x(C,z,{fill:Te(_,s,v.fill),stroke:J(_,c,v.stroke),strokeWidth:1}),O},"bpmn:ScriptTask":function(C,_,v={}){v=Le(v,["fill","stroke"]);var k=Re(C,_,v),O=i.getScaledPath("TASK_TYPE_SCRIPT",{abspos:{x:15,y:20}});return x(C,O,{fill:Te(_,s,v.fill),stroke:J(_,c,v.stroke),strokeWidth:1}),k},"bpmn:SendTask":function(C,_,v={}){v=Le(v,["fill","stroke"]);var k=Re(C,_,v),O=i.getScaledPath("TASK_TYPE_SEND",{xScaleFactor:1,yScaleFactor:1,containerWidth:21,containerHeight:14,position:{mx:.285,my:.357}});return x(C,O,{fill:J(_,c,v.stroke),stroke:Te(_,s,v.fill),strokeWidth:1}),k},"bpmn:SequenceFlow":function(C,_,v={}){v=Le(v,["fill","stroke"]);var k=Te(_,s,v.fill),O=J(_,c,v.stroke),z=b(C,_.waypoints,{markerEnd:d(C,"sequenceflow-end",k,O),stroke:O}),ie=q(_),{source:be}=_;if(be){var Ne=q(be);ie.get("conditionExpression")&&y(Ne,"bpmn:Activity")&&ne(z,{markerStart:d(C,"conditional-flow-marker",k,O)}),Ne.get("default")&&(y(Ne,"bpmn:Gateway")||y(Ne,"bpmn:Activity"))&&Ne.get("default")===ie&&ne(z,{markerStart:d(C,"conditional-default-flow-marker",k,O)})}return z},"bpmn:ServiceTask":function(C,_,v={}){v=Le(v,["fill","stroke"]);var k=Re(C,_,v);m(C,10,10,{fill:Te(_,s,v.fill),stroke:"none",transform:"translate(6, 6)"});var O=i.getScaledPath("TASK_TYPE_SERVICE",{abspos:{x:12,y:18}});x(C,O,{fill:Te(_,s,v.fill),stroke:J(_,c,v.stroke),strokeWidth:1}),m(C,10,10,{fill:Te(_,s,v.fill),stroke:"none",transform:"translate(11, 10)"});var z=i.getScaledPath("TASK_TYPE_SERVICE",{abspos:{x:17,y:22}});return x(C,z,{fill:Te(_,s,v.fill),stroke:J(_,c,v.stroke),strokeWidth:1}),k},"bpmn:StartEvent":function(C,_,v={}){var{renderIcon:k=!0}=v;v=Le(v,["fill","stroke"]);var O=q(_);O.get("isInterrupting")||(v={...v,strokeDasharray:"6"});var z=se(C,_,v);return k&&j(_,C,v),z},"bpmn:SubProcess":function(C,_,v={}){return Me(_)?v=Le(v,["fill","stroke","width","height"]):v=Le(v,["fill","stroke"]),N(C,_,v)},"bpmn:Task":function(C,_,v={}){return v=Le(v,["fill","stroke"]),Re(C,_,v)},"bpmn:TextAnnotation":function(C,_,v={}){v=Le(v,["fill","stroke"]);var{width:k,height:O}=qo(_,v),z=g(C,k,O,0,0,{fill:"none",stroke:"none"}),ie=i.getScaledPath("TEXT_ANNOTATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:k,containerHeight:O,position:{mx:0,my:0}});x(C,ie,{stroke:J(_,c,v.stroke)});var be=q(_),Ne=be.get("text")||"";return oe(C,Ne,{align:"left-top",box:qo(_,v),padding:no,style:{fill:Uo(_,u,c,v.stroke)}}),z},"bpmn:Transaction":function(C,_,v={}){Me(_)?v=Le(v,["fill","stroke","width","height"]):v=Le(v,["fill","stroke"]);var k=N(C,_,{strokeWidth:1.5,...v}),O=n.style(["no-fill","no-events"],{stroke:J(_,c,v.stroke),strokeWidth:1.5}),z=Me(_);return z||(v={}),g(C,$n(_,v),xn(_,v),_s-ys,ys,O),k},"bpmn:UserTask":function(C,_,v={}){v=Le(v,["fill","stroke"]);var k=Re(C,_,v),O=15,z=12,ie=i.getScaledPath("TASK_TYPE_USER_1",{abspos:{x:O,y:z}});x(C,ie,{fill:Te(_,s,v.fill),stroke:J(_,c,v.stroke),strokeWidth:.5});var be=i.getScaledPath("TASK_TYPE_USER_2",{abspos:{x:O,y:z}});x(C,be,{fill:Te(_,s,v.fill),stroke:J(_,c,v.stroke),strokeWidth:.5});var Ne=i.getScaledPath("TASK_TYPE_USER_3",{abspos:{x:O,y:z}});return x(C,Ne,{fill:J(_,c,v.stroke),stroke:J(_,c,v.stroke),strokeWidth:.5}),k},label:function(C,_,v={}){return ct(C,_,v)}};this._drawPath=x,this._renderer=T}te(Ar,bi),Ar.$inject=["config.bpmnRenderer","eventBus","styles","pathMap","canvas","textRenderer"],Ar.prototype.canRender=function(e){return y(e,"bpmn:BaseElement")},Ar.prototype.drawShape=function(e,t,n={}){var{type:i}=t,r=this._renderer(i);return r(e,t,n)},Ar.prototype.drawConnection=function(e,t,n={}){var{type:i}=t,r=this._renderer(i);return r(e,t,n)},Ar.prototype.getShapePath=function(e){return Ee(e)?tl(e,F1):y(e,"bpmn:Event")?Nh(e):y(e,"bpmn:Activity")?tl(e,_s):y(e,"bpmn:Gateway")?L1(e):N1(e)};function Le(e,t=[]){return t.reduce((n,i)=>(e[i]&&(n[i]=e[i]),n),{})}var V1=0,G1={width:150,height:50};function W1(e){var t=e.split("-");return{horizontal:t[0]||"center",vertical:t[1]||"top"}}function U1(e){return Nt(e)?D({top:0,left:0,right:0,bottom:0},e):{top:e,left:e,right:e,bottom:e}}var nl=null;function q1(){return nl||(nl=document.createElement("canvas").getContext("2d")),nl}function Y1(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(Bh(e.fontSize)||"12px"),t.push(e.fontFamily||"sans-serif"),t.join(" ")}function Bh(e){if(e!=null)return typeof e=="number"||/^-?\d+(\.\d+)?$/.test(e)?e+"px":e}function K1(e,t){var n=q1();if(!n)return{width:0,height:0};n.font=Y1(t),"letterSpacing"in n&&(n.letterSpacing=Bh(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 X1(e,t,n){for(var i=e.shift(),r=i,o;;){if(o=K1(r,n),o.width=r?o.width:0,r===" "||r===""||o.width<Math.round(t)||r.length<2)return Z1(e,r,i,o);r=J1(r,o.width,t)}}function Z1(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 $h="";function Q1(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===$h)&&r.pop();break}var a=r[r.length-1];return a&&a===$h&&(r[r.length-1]="-"),r.join("")}function J1(e,t,n){var i=Math.max(e.length*(n/t),1),r=Q1(e,i);return r||(r=e.slice(0,Math.max(Math.round(i-1),1))),r}function bs(e){this._config=D({},{size:G1,padding:V1,style:{},align:"center-top"},e||{})}bs.prototype.createText=function(e,t){return this.layoutText(e,t).element},bs.prototype.getDimensions=function(e,t){return this.layoutText(e,t).dimensions},bs.prototype.layoutText=function(e,t){for(var n=D({},this._config.size,t.box),i=D({},this._config.style,t.style),r=W1(t.align||this._config.align),o=U1(t.padding!==void 0?t.padding:this._config.padding),a=t.fitBox||!1,s=eS(i),c=e.split(/\u00AD?\r?\n/),u=[],l=n.width-o.left-o.right;c.length;)u.push(X1(c,l,i));r.vertical==="middle"&&(o.top=o.bottom=0);var p=yn(u,function(g,S,E){return g+(s||S.height)},0)+o.top+o.bottom,f=yn(u,function(g,S,E){return S.width>g?S.width:g},0),d=o.top;r.vertical==="middle"&&(d+=(n.height-p)/2),d-=(s||u[0].height)/4;var h=ce("text");ne(h,i),M(u,function(g){var S;switch(d+=s||g.height,r.horizontal){case"left":S=o.left;break;case"right":S=(a?f:l)-o.right-g.width;break;default:S=Math.max(((a?f:l)-g.width)/2+o.left,0)}var E=ce("tspan");ne(E,{x:S,y:d}),E.textContent=g.text,ye(h,E)});var m={width:f,height:p};return{dimensions:m,element:h}};function eS(e){if("fontSize"in e&&"lineHeight"in e)return e.lineHeight*parseInt(e.fontSize,10)}var tS=12,nS=1.2,iS=40;function jh(e){var t=D({fontFamily:"Arial, sans-serif",fontSize:tS,fontWeight:"normal",lineHeight:nS},e&&e.defaultStyle||{}),n=parseInt(t.fontSize,10)-1,i=D({},t,{fontSize:n},e&&e.externalStyle||{}),r=new bs({style:t});this.getExternalLabelBounds=function(a,s){var c={width:Math.max(a.width,Pr.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:no});return{x:a.x,y:a.y,width:a.width,height:Math.max(iS,Math.round(c.height))}},this.getDimensions=function(a,s){return r.getDimensions(a,s||{})};function o(a,s,c){return r.getDimensions(a,D({box:s},c))}this.createText=function(a,s){return r.createText(a,s||{})},this.getDefaultStyle=function(){return t},this.getExternalStyle=function(){return i}}jh.$inject=["config.textRenderer"];function rS(){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=cS(i.d,{mx:r,my:o,e:a});return p}}var oS=/\{([^{}]+)\}/g,aS=/(?:(?:^|\.)(.+?)(?=\[|\.|$|\()|\[('|")(.+?)\2\])(\(\))?/g;function sS(e,t,n){var i=n;return t.replace(aS,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 cS(e,t){return String(e).replace(oS,function(n,i){return sS(n,i,t)})}const uS={__init__:["bpmnRenderer"],bpmnRenderer:["type",Ar],textRenderer:["type",jh],pathMap:["type",rS]};function lS(e,t){return t=t||{},e.replace(/{([^}]+)}/g,function(n,i){return t[i]||"{"+i+"}"})}const Yo={translate:["value",lS]};function xs(e,t,n){return D({id:e.id,type:e.$type,businessObject:e,di:t},n)}function pS(e,t,n){var i=e.waypoint;return!i||i.length<2?[fe(t),fe(n)]:i.map(function(r){return{x:r.x,y:r.y}})}function Fh(e,t,n){return new Error(`element ${tn(t)} referenced by ${tn(e)}#${n} not yet drawn`)}function Si(e,t,n,i,r){this._eventBus=e,this._canvas=t,this._elementFactory=n,this._elementRegistry=i,this._textRenderer=r}Si.$inject=["eventBus","canvas","elementFactory","elementRegistry","textRenderer"],Si.prototype.add=function(e,t,n){var i,r,o;if(y(t,"bpmndi:BPMNPlane")){var a=y(e,"bpmn:SubProcess")?{id:e.id+"_plane"}:{};i=this._elementFactory.createRoot(xs(e,t,a)),this._canvas.addRootElement(i)}else if(y(t,"bpmndi:BPMNShape")){var s=!Me(e,t),c=dS(e);r=n&&(n.hidden||n.collapsed);var u=t.bounds;i=this._elementFactory.createShape(xs(e,t,{collapsed:s,hidden:r,x:Math.round(u.x),y:Math.round(u.y),width:Math.round(u.width),height:Math.round(u.height),isFrame:c})),y(e,"bpmn:BoundaryEvent")&&this._attachBoundary(e,i),y(e,"bpmn:Lane")&&(o=0),y(e,"bpmn:DataStoreReference")&&(fS(n,fe(u))||(n=this._canvas.findRoot(n))),this._canvas.addShape(i,n,o)}else if(y(t,"bpmndi:BPMNEdge")){var l=this._getSource(e),p=this._getTarget(e);r=n&&(n.hidden||n.collapsed),i=this._elementFactory.createConnection(xs(e,t,{hidden:r,source:l,target:p,waypoints:pS(t,l,p)})),y(e,"bpmn:DataAssociation")&&(n=this._canvas.findRoot(n)),this._canvas.addConnection(i,n,o)}else throw new Error(`unknown di ${tn(t)} for element ${tn(e)}`);return Xi(e)&&kn(i)&&this.addLabel(e,t,i),this._eventBus.fire("bpmnElement.added",{element:i}),i},Si.prototype._attachBoundary=function(e,t){var n=e.attachedToRef;if(!n)throw new Error(`missing ${tn(e)}#attachedToRef`);var i=this._elementRegistry.get(n.id),r=i&&i.attachers;if(!i)throw Fh(e,n,"attachedToRef");t.host=i,r||(i.attachers=r=[]),r.indexOf(t)===-1&&r.push(t)},Si.prototype.addLabel=function(e,t,n){var i,r,o;return i=A1(t,n),r=kn(n),r&&(i=this._textRenderer.getExternalLabelBounds(i,r)),o=this._elementFactory.createLabel(xs(e,t,{id:e.id+"_label",labelTarget:n,type:"label",hidden:n.hidden||!kn(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)},Si.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?Fh(e,i,t+"Ref"):new Error(`${tn(e)}#${t} Ref not specified`)},Si.prototype._getSource=function(e){return this._getConnectedElement(e,"source")},Si.prototype._getTarget=function(e){return this._getConnectedElement(e,"target")},Si.prototype._getElement=function(e){return this._elementRegistry.get(e.id)};function fS(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 dS(e){return y(e,"bpmn:Group")}const Hh={__depends__:[uS,{__depends__:[Yo],bpmnImporter:["type",Si]}]};function Ko(e){return{x:e.x+e.width/2,y:e.y+e.height/2}}function Zn(e,t){return{x:e.x-t.x,y:e.y-t.y}}function il(e){return Math.log(e)/Math.log(10)}var hS=1e3;function U(e){this._eventBus=e}U.$inject=["eventBus"];function mS(e,t){return function(n){return e.call(t||null,n.context,n.command,n)}}U.prototype.on=function(e,t,n,i,r,o){if((Bt(t)||me(t))&&(o=r,r=i,i=n,n=t,t=null),Bt(n)&&(o=r,r=i,i=n,n=hS),Nt(r)&&(o=r,r=!1),!Bt(i))throw new Error("handlerFn must be a function");pe(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?mS(i,o):i,o)})},U.prototype.canExecute=Ri("canExecute"),U.prototype.preExecute=Ri("preExecute"),U.prototype.preExecuted=Ri("preExecuted"),U.prototype.execute=Ri("execute"),U.prototype.executed=Ri("executed"),U.prototype.postExecute=Ri("postExecute"),U.prototype.postExecuted=Ri("postExecuted"),U.prototype.revert=Ri("revert"),U.prototype.reverted=Ri("reverted");function Ri(e){return function(n,i,r,o,a){(Bt(n)||me(n))&&(a=o,o=r,r=i,i=n,n=null),this.on(n,e,i,r,o,a)}}var rl=["top","bottom","left","right"],Es=10;function ol(e,t){U.call(this,e),this.postExecuted(["connection.create","connection.layout","connection.updateWaypoints"],function(r){var o=r.context,a=o.connection,s=a.source,c=a.target,u=o.hints||{};u.createElementsBehavior!==!1&&(n(s),n(c))}),this.postExecuted(["label.create"],function(r){var o=r.context,a=o.shape,s=o.hints||{};s.createElementsBehavior!==!1&&n(a.labelTarget)}),this.postExecuted(["elements.create"],function(r){var o=r.context,a=o.elements,s=o.hints||{};s.createElementsBehavior!==!1&&a.forEach(function(c){n(c)})});function n(r){if(vs(r)&&!Xe(r)){var o=yS(r);o&&i(r,o)}}function i(r,o){var a=fe(r),s=r.label,c=fe(s);if(s.parent){var u=ue(r),l;switch(o){case"top":l={x:a.x,y:u.top-Es-s.height/2};break;case"left":l={x:u.left-Es-s.width/2,y:a.y};break;case"bottom":l={x:a.x,y:u.bottom+Es+s.height/2};break;case"right":l={x:u.right+Es+s.width/2,y:a.y};break}var p=Zn(l,c);t.moveShape(s,p)}}}te(ol,U),ol.$inject=["eventBus","modeling"];function gS(e){var t=e.host,n=fe(e),i=Gt(n,t),r;i.indexOf("-")>=0?r=i.split("-"):r=[i];var o=rl.filter(function(a){return r.indexOf(a)===-1});return o}function vS(e){var t=fe(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 zh(t,i)});return n}function yS(e){var t=fe(e.label),n=fe(e),i=zh(n,t);if(_S(i)){var r=vS(e);if(e.host){var o=gS(e);r=r.concat(o)}var a=rl.filter(function(s){return r.indexOf(s)===-1});return a.indexOf(i)!==-1?Gt(e.label,e)!=="intersect"?void 0:i:a[0]}}function zh(e,t){return Gt(t,e,5)}function _S(e){return rl.indexOf(e)!==-1}function al(e){U.call(this,e),this.preExecute("shape.append",function(t){var n=t.source,i=t.shape;t.position||(y(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)}te(al,U),al.$inject=["eventBus"];var bS=1500;function sl(e,t,n){e.invoke(U,this),this.preExecute("elements.delete",bS,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=Ae(r,u=>y(u,"bpmn:Participant")||y(u,"bpmn:SubProcess"));if(!o.length)return[];var a=n.getRootElement(),s=new Set(a.children.filter(u=>y(u,"bpmn:Artifact"))),c=new Set;return M(o,u=>{const l=new Set(Gr(Zr(Array.from(s),Et(u))));c=c.union(l),s=s.difference(l)}),Array.from(c)}}te(sl,U),sl.$inject=["injector","eventBus","canvas"];function cl(e,t){e.invoke(U,this),this.postExecute("shape.move",function(n){var i=n.newParent,r=n.shape,o=Ae(r.incoming.concat(r.outgoing),function(a){return y(a,"bpmn:Association")});M(o,function(a){t.moveConnection(a,{x:0,y:0},i)})},!0)}te(cl,U),cl.$inject=["injector","modeling"];function ro(e,t){for(gn(t)&&(t=[t]);e=e.parent;)if(Se(e,t))return e;return null}function Vh(e,t){var n=ro(e,"bpmn:Process");if(n)return!0;var i=["bpmn:Participant","bpmn:Lane"];if(n=ro(e,i),n)return jt(n);if(Se(e,i))return jt(e);var r;for(r=q(e);r&&!y(r,"bpmn:Process");r=r.$parent);if(!t)return!0;var o=t.find(function(a){var s=q(a);return s&&s.get("processRef")===r});return o?jt(o):!0}var Gh=500;function ws(e,t){t.invoke(U,this),this._bpmnReplace=e;var n=this;this.postExecuted("elements.create",Gh,function(i){var r=i.elements;r=r.filter(function(o){var a=o.host;return Wh(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",Gh,function(i){var r=i.shapes,o=i.newHost;if(r.length===1){var a=r[0];Wh(a,o)&&(i.shapes=[n._replaceShape(a,o)])}},!0)}ws.$inject=["bpmnReplace","injector"],te(ws,U),ws.prototype._replaceShape=function(e,t){var n=xS(e),i={type:"bpmn:BoundaryEvent",host:t};return n&&(i.eventDefinitionType=n.$type),this._bpmnReplace.replaceElement(e,i,{layoutConnection:!1})};function xS(e){var t=q(e),n=t.eventDefinitions;return n&&n[0]}function Wh(e,t){return!Ee(e)&&Se(e,["bpmn:IntermediateThrowEvent","bpmn:IntermediateCatchEvent"])&&!!t}function ul(e,t){U.call(this,e);function n(i){return Ae(i.attachers,function(r){return y(r,"bpmn:BoundaryEvent")})}this.postExecute("connection.create",function(i){var r=i.context.source,o=i.context.target,a=n(o);y(r,"bpmn:EventBasedGateway")&&y(o,"bpmn:ReceiveTask")&&a.length>0&&t.removeElements(a)}),this.postExecute("connection.reconnect",function(i){var r=i.context.oldSource,o=i.context.newSource;y(r,"bpmn:Gateway")&&y(o,"bpmn:EventBasedGateway")&&M(o.outgoing,function(a){var s=a.target,c=n(s);y(s,"bpmn:ReceiveTask")&&c.length>0&&t.removeElements(c)})})}ul.$inject=["eventBus","modeling"],te(ul,U);function Uh(e){return e.create("bpmn:Category")}function ES(e){return e.create("bpmn:CategoryValue")}function qh(e,t){var n=t.get("categoryValueRef");return n||(n=t.categoryValueRef=ES(e)),n.$parent||(n.$parent=Uh(e)),n}function wS(e,t,n){return _t(t.get("categoryValue"),e),e.$parent=t,_t(n.get("rootElements"),t),t.$parent=n,e}function SS(e){var t=e.$parent;return t&&(ht(t.get("categoryValue"),e),e.$parent=null),e}function RS(e){var t=e.$parent;return t&&(ht(t.get("rootElements"),e),e.$parent=null),e}var CS=500;function ll(e,t,n){n.invoke(U,this);function i(c){return t.filter(function(u){return y(u,"bpmn:Group")&&!u.labelTarget}).map(q).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&&wS(c,u,e.getDefinitions())}function s(c,u,l){u&&!o(u,l)&&RS(u),c&&!r(c,l)&&SS(c)}this.executed(["shape.create","label.create"],function(c){var u=c.labelTarget||c.shape;!y(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;!y(u,"bpmn:Group")||u.labelTarget||s(c.categoryValue,c.category,q(u))},!0),this.executed(["shape.move","shape.resize"],CS,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,q(u))},!0),this.executed("group.updateRefs",function(c){Yh(c).forEach(function(u){a(u.categoryValue,u.category)})},!0),this.reverted("group.updateRefs",function(c){Yh(c).forEach(function(u){s(u.categoryValue,u.category,q(u.groupShape))})},!0),this.executed("shape.delete",function(c){var u=c.shape;!y(u,"bpmn:Group")||u.labelTarget||s(c.categoryValue,c.category,q(u))},!0),this.reverted("shape.delete",function(c){var u=c.shape;!y(u,"bpmn:Group")||u.labelTarget||a(c.categoryValue,c.category)},!0)}ll.$inject=["bpmnjs","elementRegistry","injector"],te(ll,U);function Yh(e){var t;return((t=e.updates)==null?void 0:t.groups)||[]}function pl(e,t,n){U.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 S=g.source,E=g.target;oo(S)&&Xo(E)&&l(E)}function r(g){const S=g.connection,E=g.source,b=g.target;oo(E)&&Ss(b)&&(u(b),f(E,[S]))}function o(g){const S=g.newTarget,E=g.oldSource,b=g.oldTarget;if(b!==S){const x=E;Xo(b)&&l(b),oo(x)&&Ss(S)&&u(S)}}function a(g){const{element:S}=g;Xo(S)?(p(S),d(S)):Ss(S)&&h(S)}function s(g){const{newData:S,oldShape:E}=g;if(oo(g.oldShape)&&S.eventDefinitionType!=="bpmn:CompensateEventDefinition"||S.type!=="bpmn:BoundaryEvent"){const b=E.outgoing.find(({target:x})=>Xo(x));b&&b.target&&(g._connectionTarget=b.target)}else if(!oo(g.oldShape)&&S.eventDefinitionType==="bpmn:CompensateEventDefinition"&&S.type==="bpmn:BoundaryEvent"){const b=E.outgoing.find(({target:x})=>Ss(x));b&&b.target&&(g._connectionTarget=b.target),m(E)}}function c(g){const{_connectionTarget:S,newShape:E}=g;S&&t.connect(E,S)}function u(g){t.updateProperties(g,{isForCompensation:!0})}function l(g){t.updateProperties(g,{isForCompensation:void 0})}function p(g){for(const S of g.incoming)n.canConnect(S.source,g)||t.removeConnection(S);for(const S of g.outgoing)n.canConnect(g,S.target)||t.removeConnection(S)}function f(g,S){g.outgoing.filter(x=>y(x,"bpmn:Association")).filter(x=>Xo(x.target)&&!S.includes(x)).forEach(x=>t.removeConnection(x))}function d(g){const S=g.attachers.slice();S.length&&t.removeElements(S)}function h(g){const S=g.incoming.filter(E=>oo(E.source));t.removeElements(S)}function m(g){const S=g.outgoing.filter(E=>y(E,"bpmn:SequenceFlow"));t.removeElements(S)}}te(pl,U),pl.$inject=["eventBus","modeling","bpmnRules"];function Xo(e){const t=q(e);return t&&t.get("isForCompensation")}function oo(e){return e&&y(e,"bpmn:BoundaryEvent")&&to(e,"bpmn:CompensateEventDefinition")}function Ss(e){return e&&y(e,"bpmn:Activity")&&!nn(e)}function fl(e){e.invoke(U,this),this.preExecute("shape.create",1500,function(t){var n=t.context,i=n.parent,r=n.shape;y(i,"bpmn:Lane")&&!y(r,"bpmn:Lane")&&(n.parent=ro(i,"bpmn:Participant"))})}fl.$inject=["injector"],te(fl,U);function dl(e,t){U.call(this,e),this.preExecute("shape.create",function(n){var a;var i=n.context,r=i.shape;if(y(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}})}dl.$inject=["eventBus","bpmnFactory"],te(dl,U);var hl=20,ml=20,Kh=30,Rs=2e3;function gl(e,t,n){U.call(this,t),t.on(["create.start","shape.move.start"],Rs,function(r){var o=r.context,a=o.shape,s=e.getRootElement();if(!(!y(a,"bpmn:Participant")||!y(s,"bpmn:Process")||!s.children.length)){var c=s.children.filter(function(p){return!y(p,"bpmn:Group")&&!Ee(p)&&!Xe(p)});if(c.length){var u=Et(c),l=PS(a,u);D(a,l),o.createConstraints=AS(a,u)}}}),t.on("create.start",Rs,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}y(a,"bpmn:Participant")&&y(s,"bpmn:Process")&&(t.on("element.hover",Rs,u),t.once("create.cleanup",function(){t.off("element.hover",u)}))});function i(){var r=e.getRootElement();return y(r,"bpmn:Collaboration")?r:n.makeCollaboration()}this.preExecute("elements.create",Rs,function(r){var o=r.elements,a=r.parent,s=TS(o),c;s&&y(a,"bpmn:Process")&&(r.parent=i(),c=r.hints=r.hints||{},c.participant=s,c.process=a,c.processRef=q(s).get("processRef"))},!0),this.preExecute("shape.create",function(r){var o=r.parent,a=r.shape;y(a,"bpmn:Participant")&&y(o,"bpmn:Process")&&(r.parent=i(),r.process=o,r.processRef=q(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)&&q(s).set("processRef",q(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)&&q(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)}gl.$inject=["canvas","eventBus","modeling"],te(gl,U);function PS(e,t){t={width:t.width+hl*2+Kh,height:t.height+ml*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 AS(e,t){return t=ue(t),{bottom:t.top+e.height/2-ml,left:t.right-e.width/2+hl,top:t.bottom-e.height/2+ml,right:t.left+e.width/2-hl-Kh}}function TS(e){return et(e,function(t){return y(t,"bpmn:Participant")})}var Xh="__targetRef_placeholder";function vl(e,t){U.call(this,e),this.executed(["connection.create","connection.delete","connection.move","connection.reconnect"],Zh(o)),this.reverted(["connection.create","connection.delete","connection.move","connection.reconnect"],Zh(o));function n(a,s,c){var u=a.get("dataInputAssociations");return et(u,function(l){return l!==c&&l.targetRef===s})}function i(a,s){var c=a.get("properties"),u=et(c,function(l){return l.name===Xh});return!u&&s&&(u=t.create("bpmn:Property",{name:Xh}),_t(c,u)),u}function r(a,s){var c=i(a);c&&(n(a,c,s)||ht(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,S;m&&m!==p&&r(m,u),d&&d!==p&&r(d,u),p?(S=i(p,!0),g.targetRef=S):g.targetRef=null}}vl.$inject=["eventBus","bpmnFactory"],te(vl,U);function Zh(e){return function(t){var n=t.context,i=n.connection;if(y(i,"bpmn:DataInputAssociation"))return e(t)}}function Cs(e){this._bpmnUpdater=e}Cs.$inject=["bpmnUpdater"],Cs.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),[]},Cs.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 yl(e,t,n,i){U.call(this,i),t.registerHandler("dataStore.updateContainment",Cs);function r(){return n.filter(function(s){return y(s,"bpmn:Participant")&&q(s).processRef})[0]}function o(s){return s.children.filter(function(c){return y(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:Ie(s),newSemanticParent:l.processRef||l,newDiParent:Ie(c)})}}this.preExecute("shape.create",function(s){var c=s.context,u=c.shape;y(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 y(p,"bpmn:DataStoreReference")});l.length&&(c.hints||(c.hints={}),c.hints.autoResize=u.filter(function(p){return!y(p,"bpmn:DataStoreReference")}))}),this.postExecute("shape.create",function(s){var c=s.context,u=c.shape,l=u.parent;y(u,"bpmn:DataStoreReference")&&u.type!=="label"&&y(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(!y(l,"bpmn:Collaboration")&&y(u,"bpmn:DataStoreReference")&&u.type!=="label"&&y(p,"bpmn:Collaboration")){var f=y(l,"bpmn:Participant")?l:kS(l,"bpmn:Participant");a(u,f)}}),this.postExecute("shape.delete",function(s){var c=s.context,u=c.shape,l=e.getRootElement();Se(u,["bpmn:Participant","bpmn:SubProcess"])&&y(l,"bpmn:Collaboration")&&o(l).filter(function(p){return MS(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){y(l,"bpmn:Process")&&a(f,l)})})}yl.$inject=["canvas","commandStack","elementRegistry","eventBus"],te(yl,U);function MS(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 kS(e,t){for(;e.parent;){if(y(e.parent,t))return e.parent;e=e.parent}}var Ps=Math.max,As=Math.min,DS=20;function Qh(e,t){return{top:e.top-t.top,right:e.right-t.right,bottom:e.bottom-t.bottom,left:e.left-t.left}}function OS(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 IS(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 Ts(e,t,n){var i=t[e],r=n.min&&n.min[e],o=n.max&&n.max[e];return me(r)&&(i=(/top|left/.test(e)?As:Ps)(i,r)),me(o)&&(i=(/top|left/.test(e)?Ps:As)(i,o)),i}function LS(e,t){if(!t)return e;var n=ue(e);return ps({top:Ts("top",n,t),right:Ts("right",n,t),bottom:Ts("bottom",n,t),left:Ts("left",n,t)})}function NS(e,t,n,i){var r=ue(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?ue(i):o,s={top:As(o.top,a.top),left:As(o.left,a.left),bottom:Ps(o.bottom,a.bottom),right:Ps(o.right,a.right)};return ps(s)}function Zo(e,t){return typeof e<"u"?e:DS}function BS(e,t){var n,i,r,o;return typeof t=="object"?(n=Zo(t.left),i=Zo(t.right),r=Zo(t.top),o=Zo(t.bottom)):n=i=r=o=Zo(t),{x:e.x-n,y:e.y-r,width:e.width+n+i,height:e.height+r+o}}function $S(e){return!(e.waypoints||e.type==="label")}function Jh(e,t){var n;if(e.length===void 0?n=Ae(e.children,$S):n=e,n.length)return BS(Et(n),t)}var Zi=Math.abs;function jS(e,t){return Qh(ue(t),ue(e))}var FS=["bpmn:Participant","bpmn:Process","bpmn:SubProcess"],jn=30;function Ms(e,t){return t=t||[],e.children.filter(function(n){y(n,"bpmn:Lane")&&(Ms(n,t),t.push(n))}),t}function Qi(e){return e.children.filter(function(t){return y(t,"bpmn:Lane")})}function Fn(e){return ro(e,FS)||e}function HS(e,t){var n=Fn(e),i=y(n,"bpmn:Process")?[]:[n],r=Ms(n,i),o=ue(e),a=ue(t),s=jS(e,t),c=[],u=jt(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=ue(l);s.top&&(Zi(m.bottom-o.top)<10&&(d=a.top-m.bottom),Zi(m.top-o.top)<5&&(p=a.top-m.top)),s.left&&(Zi(m.right-o.left)<10&&(f=a.left-m.right),Zi(m.left-o.left)<5&&(h=a.left-m.left)),s.bottom&&(Zi(m.top-o.bottom)<10&&(p=a.bottom-m.top),Zi(m.bottom-o.bottom)<5&&(d=a.bottom-m.bottom)),s.right&&(Zi(m.left-o.right)<10&&(h=a.right-m.left),Zi(m.right-o.right)<5&&(f=a.right-m.right)),(p||f||d||h)&&c.push({shape:l,newBounds:IS(l,{top:p,right:f,bottom:d,left:h})})}}),c}var zS=500;function _l(e,t){U.call(this,e);function n(i,r){var o=jt(i),a=Qi(r),s=[],c=[],u=[],l=[];if(Rr(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",zS,function(i){var r=i.context,o=r.hints,a=r.shape,s=r.oldParent;y(a,"bpmn:Lane")&&(o&&o.nested||n(a,s))})}_l.$inject=["eventBus","spaceTool"],te(_l,U);var em=500;function ks(e,t){t.invoke(U,this),this._bpmnReplace=e;var n=this;this.postExecuted("elements.create",em,function(i){var r=i.elements;r.filter(function(o){var a=o.host;return tm(o,a)}).map(function(o){return r.indexOf(o)}).forEach(function(o){i.elements[o]=n._replaceShape(r[o])})},!0),this.preExecute("elements.move",em,function(i){var r=i.shapes,o=i.newHost;r.forEach(function(a,s){var c=a.host;tm(a,GS(r,c)?c:o)&&(r[s]=n._replaceShape(a))})},!0)}ks.$inject=["bpmnReplace","injector"],te(ks,U),ks.prototype._replaceShape=function(e){var t=VS(e),n;return t?n={type:"bpmn:IntermediateCatchEvent",eventDefinitionType:t.$type}:n={type:"bpmn:IntermediateThrowEvent"},this._bpmnReplace.replaceElement(e,n,{layoutConnection:!1})};function VS(e){var t=q(e),n=t.eventDefinitions;return n&&n[0]}function tm(e,t){return!Ee(e)&&y(e,"bpmn:BoundaryEvent")&&!t}function GS(e,t){return e.indexOf(t)!==-1}var Ds=Math.round,WS=Math.max;function US(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 qS(e){var t=[];return e.forEach(function(n,i){t.push([i===0?"M":"L",n.x,n.y])}),t}var nm=10;function YS(e,t){var n,i;for(n=0;i=e[n];n++)if(Ho(i,t)<=nm)return{point:e[n],bendpoint:!0,index:n};return null}function KS(e,t){var n=sh(US(t,nm),qS(e)),i=n[0],r=n[n.length-1],o;return i?i!==r?i.segment2!==r.segment2?(o=WS(i.segment2,r.segment2)-1,{point:e[o],bendpoint:!0,index:o}):{point:{x:Ds(i.x+r.x)/2,y:Ds(i.y+r.y)/2},index:i.segment2}:{point:{x:Ds(i.x),y:Ds(i.y)},index:i.segment2}:null}function bl(e,t){return YS(e,t)||KS(e,t)}function xl(e,t,n){U.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(),S;me(a.width)?S=fe(a):S=a;var E=bl(s,S);if(E){if(c=s.slice(0,E.index),u=s.slice(E.index+(E.bendpoint?1:0)),!c.length||!u.length)return;l=E.bendpoint?s[E.index]:S,(c.length===1||!im(r,c[c.length-1]))&&c.push(rm(l)),(u.length===1||!im(r,u[0]))&&u.unshift(rm(l))}p=o.source,f=o.target,t.canConnect(p,r,o)&&(n.reconnectEnd(o,r,c||S),d=o),t.canConnect(r,f,o)&&(d?h=n.connect(r,f,{type:o.type,waypoints:u}):(n.reconnectStart(o,r,u||S),h=o));var b=[].concat(d&&Ae(g,function(x){return x.source===d.source})||[],h&&Ae(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=fe(c),l={x:u.x+s.x,y:u.y+s.y},p=et(o.children,function(f){var d=t.canInsert(a,f);return d&&bl(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)}te(xl,U),xl.$inject=["eventBus","bpmnRules","modeling"];function im(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 rm(e){return D({},e)}function El(e,t){U.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)&&ao(r)){var c=[];y(o,"bpmn:EventBasedGateway")?c=a.incoming.filter(u=>u!==r&&ao(u)):c=a.incoming.filter(u=>u!==r&&ao(u)&&y(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(y(r,"bpmn:EventBasedGateway")){var o=r.outgoing.filter(ao).reduce(function(a,s){return a.includes(s.target)?a:a.concat(s.target)},[]);o.forEach(function(a){a.incoming.filter(ao).forEach(function(s){const c=a.incoming.filter(ao).filter(function(u){return u.source===r});(s.source!==r||c.length>1)&&t.removeConnection(s)})})}})}El.$inject=["eventBus","modeling"],te(El,U);function ao(e){return y(e,"bpmn:SequenceFlow")}var Os=1500,om=2e3;function am(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"],Os,function(i){var r=i.context,o=r.shape||i.shape,a=i.hover;y(a,"bpmn:Lane")&&!Se(o,["bpmn:Lane","bpmn:Participant"])&&(i.hover=Fn(a),i.hoverGfx=e.getGraphics(i.hover));var s=n.getRootElement();a&&a!==s&&(o.labelTarget||Se(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"],Os,function(i){var r=i.hover;y(r,"bpmn:Lane")&&(i.hover=Fn(r)||r,i.hoverGfx=e.getGraphics(i.hover))}),t.on(["bendpoint.move.hover"],Os,function(i){var r=i.context,o=i.hover,a=r.type;y(o,"bpmn:Lane")&&/reconnect/.test(a)&&(i.hover=Fn(o)||o,i.hoverGfx=e.getGraphics(i.hover))}),t.on(["connect.start"],Os,function(i){var r=i.context,o=r.start;y(o,"bpmn:Lane")&&(r.start=Fn(o)||o)}),t.on("shape.move.start",om,function(i){var r=i.shape;y(r,"bpmn:Lane")&&(i.shape=Fn(r)||r)}),t.on("spaceTool.move",om,function(i){var r=i.hover;r&&y(r,"bpmn:Lane")&&(i.hover=Fn(r))})}am.$inject=["elementRegistry","eventBus","canvas"];var sm=770;function wl(e,t,n,i){n.invoke(U,this);function r(s,c){var u=q(s),l=c.categoryValue||u.categoryValueRef;l||(l=qh(e,u));var p=c.category||l.$parent||Uh(e);u.categoryValueRef=l,l.$parent=p,c.categoryValue=l,c.category=p}function o(s,c){var u=q(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;y(u,"bpmn:Group")&&r(u,c)}),this.revert("label.create",function(s){var c=s.context,u=c.labelTarget;y(u,"bpmn:Group")&&o(u,c)}),this.execute("shape.delete",function(s){var c=s.context,u=c.shape,l=q(u);if(!(!y(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(!(!y(u,"bpmn:Group")||u.labelTarget)){var l=c.category,p=c.categoryValue,f=q(u);p&&(f.categoryValueRef=p,p.$parent=l)}}),this.execute("shape.create",function(s){var c=s.context,u=c.shape,l=c.hints||{};!y(u,"bpmn:Group")||u.labelTarget||l.createElementsBehavior===!1&&!q(u).categoryValueRef&&!c.categoryValue||r(u,c)}),this.reverted("shape.create",function(s){var c=s.context,u=c.shape,l=c.hints||{};!y(u,"bpmn:Group")||u.labelTarget||l.createElementsBehavior===!1&&!q(u).categoryValueRef&&!c.categoryValue||o(u,c)}),this.executed(["shape.move","shape.resize"],function(s){var c=s.context,u=c.shape;!y(u,"bpmn:Group")||u.labelTarget||q(u).categoryValueRef||r(u,c)}),this.reverted(["shape.move","shape.resize"],function(s){var c=s.context,u=c.shape;!y(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",sm,function(s){var c=s.descriptor,u=s.element;if(!(!y(u,"bpmn:Group")||u.labelTarget)){var l=q(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",sm,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})}wl.$inject=["bpmnFactory","eventBus","injector","moddleCopy"],te(wl,U);function Sl(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 cm(e){function t(i,r,o){var a={x:o.x,y:o.y-50},s={x:o.x-50,y:o.y},c=Sl(i,r,o,a),u=Sl(i,r,o,s),l;c&&u?um(c,o)>um(u,o)?l=u:l=c:l=c||u,i.original=l}function n(i){var r=i.waypoints;t(r[0],r[1],fe(i.source)),t(r[r.length-1],r[r.length-2],fe(i.target))}e.on("bpmnElement.added",function(i){var r=i.element;r.waypoints&&n(r)})}cm.$inject=["eventBus"];function um(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function Rl(e){U.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=q(i),o=Ie(i);if(Se(r,t)){var a=o.get("isHorizontal");a===void 0&&(a=!0),o.set("isHorizontal",a)}})}Rl.$inject=["eventBus"],te(Rl,U);function lm(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}function pm(e){return Math.atan((e[1].y-e[0].y)/(e[1].x-e[0].x))}function XS(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 ZS(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 Cl(e,t){var n=t[0],i=t[1],r={x:i.x-n.x,y:i.y-n.y},o=ZS([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 fm(e,t){var n=Cl(e,t),i={x:n.x-e.x,y:n.y-e.y};return lm(i)}function Qo(e,t){return lm({x:e.x-t.x,y:e.y-t.y})}var dm=Math.sqrt,hm=Math.min,QS=Math.max,mm=Math.abs;function gm(e){return Math.pow(e,2)}function Jo(e,t){return dm(gm(e.x-t.x)+gm(e.y-t.y))}function JS(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],ym(i,r)?u=[i]:(o=Jo(e,i),a=Jo(e,r),c=hm(o,a),u=eR(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:ym(i,u[0])?n:n+1}),u.length===2&&(s=nR(u[0],u[1]),l={type:"segment",position:s,segmentIndex:n,relativeLocation:Jo(i,s)/Jo(i,r)}),p=Jo(l.position,e),(!d||f>p)&&(d=l,f=p)}return d}function eR(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=dm(d),m=-p+h,g=-p-h,S={x:e.x-r*m,y:e.y-o*m};if(d===0)return[S];var E={x:e.x-r*g,y:e.y-o*g};return[S,E].filter(function(b){return tR(b,e,t)})}function tR(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>=hm(t,n)-Is&&e<=QS(t,n)+Is}function nR(e,t){return{x:(e.x+t.x)/2,y:(e.y+t.y)/2}}var Is=.1;function ym(e,t){return mm(e.x-t.x)<=Is&&mm(e.y-t.y)<=Is}function iR(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=bm(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 _m(e,t,n,i){var r=0,o=0,a={point:e,delta:{x:0,y:0}},s=JS(e,n),c=s.segmentIndex,u=iR(n,t,s,i);if(u<0||u>t.length-2||u===null)return a;var l=xm(n,c),p=xm(t,u),f=s.position,d=oR(l,f),h=rR(l,p);if(s.type==="bendpoint"){var m=t.length-n.length,g=s.bendpointIndex,S=n[g];if(t.indexOf(S)!==-1)return a;if(m===0){var E=t[g];return r=E.x-s.position.x,o=E.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=bm(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=XS({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:Ei(b),delta:Ei({x:r,y:o})}}function bm(e,t){var n=Qo(e[t-1],e[t]),i=Qo(e[t],e[t+1]),r=n/(n+i);return r}function rR(e,t){var n=pm(e),i=pm(t);return i-n}function xm(e,t){return[e[t],e[t+1]]}function oR(e,t){var n=Qo(e[0],e[1]),i=Qo(e[0],t);return n===0?0:i/n}function aR(e,t,n,i){var r=fe(e);return _m(r,t,n,i).delta}function ea(e,t,n){var i=Ko(t),r=Ko(n),o=Zn(e,i),a={x:o.x*(n.width/t.width),y:o.y*(n.height/t.height)};return Ei({x:r.x+a.x,y:r.y+a.y})}function Em(e,t,n){var i=Ko(e),r=Ko(t),o=Ko(n),a=Zn(e,i),s=Zn(i,r),c=sR(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 Ei({x:l.x+a.x-e.x,y:l.y+a.y-e.y})}function sR(e,t,n){var i=ue(t),r=ue(n);if(cR(i,r))return null;var o=Gt(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=Gt(n,s),c!==o?null:a}function cR(e,t){return uR(e,t)||lR(e,t)}function uR(e,t){return e.right!==t.right&&e.left!==t.left}function lR(e,t){return e.top!==t.top&&e.bottom!==t.bottom}var wm="name",Sm="text";function Pl(e,t,n,i){U.call(this,e),this.postExecute("element.updateProperties",r),this.postExecute("element.updateModdleProperties",a=>{q(a.context.element)===a.context.moddleElement&&r(a)});function r(a){var s=a.context,c=s.element,u=s.properties;if(wm in u&&t.updateLabel(c,u[wm]),Sm in u&&y(c,"bpmn:TextAnnotation")){var l=i.getTextAnnotationBounds({x:c.x,y:c.y,width:c.width,height:c.height},u[Sm]||"");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;Ee(u)||!Xi(u)||kn(u)&&t.updateLabel(u,kn(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=D({},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),aR(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=q(c);l&&Xi(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(!(!Ee(c)||u.autoResize)){var l=s.newBounds,p=i.getDimensions(kn(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(vs(c)){var p=c.label,f=fe(p),d=dR(l),h=fR(f,d),m=pR(h,l,u);t.moveShape(p,m)}})}te(Pl,U),Pl.$inject=["eventBus","modeling","bpmnFactory","textRenderer"];function pR(e,t,n){var i=ea(e,t,n);return Ei(Zn(i,e))}function fR(e,t){if(t.length){var n=hR(e,t);return Cl(e,n)}}function dR(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 hR(e,t){var n=t.map(function(r){return{line:r,distance:fm(e,r)}}),i=ei(n,"distance");return i[0].line}function mR(e,t,n,i){return _m(e,t,n,i).point}function Al(e,t){U.call(this,e);function n(i,r){var o=i.context,a=o.connection,s=D({},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),mR(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)})})}te(Al,U),Al.$inject=["eventBus","modeling"];function Ls(e,t,n){var i=Bs(e),r=Cm(i,t),o=i[0];return r.length?r[r.length-1]:ea(o.original||o,n,t)}function Ns(e,t,n){var i=Bs(e),r=Cm(i,t),o=i[i.length-1];return r.length?r[0]:ea(o.original||o,n,t)}function Tl(e,t,n){var i=Bs(e),r=Rm(t,n),o=i[0];return ea(o.original||o,r,t)}function Ml(e,t,n){var i=Bs(e),r=Rm(t,n),o=i[i.length-1];return ea(o.original||o,r,t)}function Rm(e,t){return{x:e.x-t.x,y:e.y-t.y,width:e.width,height:e.height}}function Bs(e){var t=e.waypoints;if(!t.length)throw new Error("connection#"+e.id+": no waypoints");return t}function Cm(e,t){var n=Zt(e,vR);return Ae(n,function(i){return gR(i,t)})}function gR(e,t){return Gt(t,e,1)==="intersect"}function vR(e){return e.original||e}function kl(e,t){U.call(this,e),this.postExecute("shape.replace",function(n){var i=n.oldShape,r=n.newShape;if(yR(i,r)){var o=_R(i);o.incoming.forEach(function(a){var s=Ns(a,r,i);t.reconnectEnd(a,r,s)}),o.outgoing.forEach(function(a){var s=Ls(a,r,i);t.reconnectStart(a,r,s)})}},!0)}kl.$inject=["eventBus","modeling"],te(kl,U);function yR(e,t){return y(e,"bpmn:Participant")&&Me(e)&&y(t,"bpmn:Participant")&&!Me(t)}function _R(e){var t=jo([e]),n=[],i=[];return t.forEach(function(r){r!==e&&(r.incoming.forEach(function(o){y(o,"bpmn:MessageFlow")&&n.push(o)}),r.outgoing.forEach(function(o){y(o,"bpmn:MessageFlow")&&i.push(o)}))},[]),{incoming:n,outgoing:i}}const bR=["bpmn:MessageEventDefinition","bpmn:TimerEventDefinition","bpmn:EscalationEventDefinition","bpmn:ConditionalEventDefinition","bpmn:SignalEventDefinition"];function Pm(e){const t=q(e);if(!y(t,"bpmn:BoundaryEvent")&&!(y(t,"bpmn:StartEvent")&&nn(t.$parent)))return!1;const n=t.get("eventDefinitions");return!n||!n.length?!1:bR.some(i=>y(n[0],i))}function Am(e){return y(e,"bpmn:BoundaryEvent")?"cancelActivity":"isInterrupting"}function Dl(e,t){e.invoke(U,this),this.postExecuted("shape.replace",function(n){const i=n.context.oldShape,r=n.context.newShape,o=n.context.hints;if(!Pm(r))return;const a=Am(r);if(o.targetElement&&o.targetElement[a]!==void 0)return;const c=q(i).get(a),u=q(r).get(a);c!==u&&t.updateProperties(r,{[a]:c})})}Dl.$inject=["injector","modeling"],te(Dl,U);function Ol(e,t){U.call(this,e),this.preExecute("shape.resize",function(n){var i=n.shape,r=Ie(i),o=r&&r.get("label"),a=o&&o.get("bounds");a&&t.updateModdleProperties(i,o,{bounds:void 0})},!0)}te(Ol,U),Ol.$inject=["eventBus","modeling"];function Il(e,t,n){U.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(!(!y(o,"bpmn:SequenceFlow")||!y(a,"bpmn:SequenceFlow"))&&t.canConnect(o.source,a.target,o)){var s=xR(o.waypoints,a.waypoints);n.reconnectEnd(o,a.target,s)}}})}te(Il,U),Il.$inject=["eventBus","bpmnRules","modeling"];function so(e){return e.original||e}function xR(e,t){var n=Sl(so(e[e.length-2]),so(e[e.length-1]),so(t[1]),so(t[0]));return n?[].concat(e.slice(0,e.length-1),[n],t.slice(1)):[so(e[0]),so(t[t.length-1])]}function Ll(e,t){U.call(this,e),this.preExecute("shape.delete",function(n){var i=n.shape,r=i.parent;y(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)}Ll.$inject=["eventBus","modeling"],te(Ll,U);function Nl(e,t,n,i){U.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;y(c,"bpmn:SequenceFlow")&&(n.canConnectSequenceFlow(u,l)||(d=!0),n.canConnectMessageFlow(u,l)&&(f="bpmn:MessageFlow")),y(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=et(p.outgoing,Ur({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})})}te(Nl,U),Nl.$inject=["eventBus","modeling","bpmnRules","injector"];function $s(e,t,n,i,r,o){i.invoke(U,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=yn(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){nn(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})})}te($s,U),$s.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)},$s.$inject=["bpmnReplace","bpmnRules","elementRegistry","injector","modeling","selection"];var ER=1500,wR={width:140,height:120},Bl={width:300,height:60},$l={width:60,height:300},js={width:300,height:150},Fs={width:150,height:300},Tm={width:140,height:120},Mm={width:100,height:40};function km(e){e.on("resize.start",ER,function(t){var n=t.context,i=n.shape,r=n.direction,o=n.balanced;(y(i,"bpmn:Lane")||y(i,"bpmn:Participant"))&&(n.resizeConstraints=AR(i,r,o)),y(i,"bpmn:SubProcess")&&Me(i)&&(n.minDimensions=Tm),y(i,"bpmn:TextAnnotation")&&(n.minDimensions=Mm)})}km.$inject=["eventBus"];var Ji=Math.abs,SR=Math.min,RR=Math.max;function Dm(e,t,n,i){var r=e[t];e[t]=r===void 0?n:i(n,r)}function co(e,t,n){return Dm(e,t,n,SR)}function uo(e,t,n){return Dm(e,t,n,RR)}var CR={top:20,left:50,right:20,bottom:20},PR={top:50,left:20,right:20,bottom:20};function AR(e,t,n){var i=Fn(e),r=!0,o=!0,a=Ms(i,[i]),s=ue(e),c={},u={},l=jt(e),p=l?Bl:$l;/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=ue(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&&Ji(s.top-m.bottom)<10&&uo(c,"top",m.top+p.height),Ji(s.top-m.top)<5&&co(u,"top",m.bottom-p.height)),/e/.test(t)&&(n&&Ji(s.right-m.left)<10&&co(c,"right",m.right-p.width),Ji(s.right-m.right)<5&&uo(u,"right",m.left+p.width)),/s/.test(t)&&(n&&Ji(s.bottom-m.top)<10&&co(c,"bottom",m.bottom-p.height),Ji(s.bottom-m.bottom)<5&&uo(u,"bottom",m.top+p.height)),/w/.test(t)&&(n&&Ji(s.left-m.right)<10&&uo(c,"left",m.left+p.width),Ji(s.left-m.left)<5&&co(u,"left",m.right-p.width))});var f=i.children.filter(function(h){return!h.hidden&&!h.waypoints&&(y(h,"bpmn:FlowElement")||y(h,"bpmn:Artifact"))}),d=l?CR:PR;return f.forEach(function(h){var m=ue(h);/n/.test(t)&&(!l||r)&&co(u,"top",m.top-d.top),/e/.test(t)&&(l||o)&&uo(u,"right",m.right+d.right),/s/.test(t)&&(!l||o)&&uo(u,"bottom",m.bottom+d.bottom),/w/.test(t)&&(l||r)&&co(u,"left",m.left-d.left)}),{min:u,max:c}}function Om(e){!e||typeof e.stopPropagation!="function"||e.stopPropagation()}function lo(e){return e.originalEvent||e.srcEvent}function jl(e){Om(e),Om(lo(e))}function Tr(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 Im(){return/mac/i.test(navigator.platform)}function Lm(e,t){return(lo(e)||e).button===t}function er(e){return Lm(e,0)}function TR(e){return Lm(e,1)}function ta(e){var t=lo(e)||e;return er(e)?Im()?t.metaKey:t.ctrlKey:!1}function Hs(e){var t=lo(e)||e;return er(e)&&t.shiftKey}var Nm=1001;function Bm(e,t){e.on("resize.start",Nm+500,function(n){var i=n.context,r=i.shape;(y(r,"bpmn:Lane")||y(r,"bpmn:Participant"))&&(i.balanced=!ta(n))}),e.on("resize.end",Nm,function(n){var i=n.context,r=i.shape,o=i.canExecute,a=i.newBounds;if(y(r,"bpmn:Lane")||y(r,"bpmn:Participant"))return o&&(a=fh(a),t.resizeLane(r,a,i.balanced)),!1})}Bm.$inject=["eventBus","modeling"];var MR=500;function Fl(e,t,n,i,r){n.invoke(U,this);function o(l){return Se(l,["bpmn:ReceiveTask","bpmn:SendTask"])||kR(l,["bpmn:ErrorEventDefinition","bpmn:EscalationEventDefinition","bpmn:MessageEventDefinition","bpmn:SignalEventDefinition"])}function a(l){var p=e.getDefinitions(),f=p.get("rootElements");return!!et(f,Ur({id:l.id}))}function s(l){if(y(l,"bpmn:ErrorEventDefinition"))return"errorRef";if(y(l,"bpmn:EscalationEventDefinition"))return"escalationRef";if(y(l,"bpmn:MessageEventDefinition"))return"messageRef";if(y(l,"bpmn:SignalEventDefinition"))return"signalRef"}function c(l){if(Se(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(Se(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=q(p),d=c(f),h;d&&!a(d)&&(h=e.getDefinitions().get("rootElements"),_t(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");ht(f,p)}},!0),t.on("copyPaste.copyElement",function(l){var p=l.descriptor,f=l.element;if(!(f.labelTarget||!o(f))){var d=q(f),h=c(d);h&&(p.referencedRootElement=h)}}),t.on("copyPaste.pasteElement",MR,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)})}Fl.$inject=["bpmnjs","eventBus","injector","moddleCopy","bpmnFactory"],te(Fl,U);function kR(e,t){return pe(t)||(t=[t]),Ni(t,function(n){return to(e,n)})}var $m=Math.max;function jm(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;y(a,"bpmn:Participant")&&(o[s]=OR(a,i,r)),y(a,"bpmn:Lane")&&(o[s]=jt(a)?Bl:$l),y(a,"bpmn:SubProcess")&&Me(a)&&(o[s]=Tm),y(a,"bpmn:TextAnnotation")&&(o[s]=Mm),y(a,"bpmn:Group")&&(o[s]=wR)}),o})}jm.$inject=["eventBus"];function DR(e){return e==="x"}function OR(e,t,n){var i=jt(e);if(!NR(e))return i?js:Fs;var r=DR(t),o={};return r?i?o=js:o={width:LR(e,n,r),height:Fs.height}:i?o={width:js.width,height:IR(e,n,r)}:o=Fs,o}function IR(e,t,n){var i;return i=BR(e,t,n),$m(js.height,i)}function LR(e,t,n){var i;return i=$R(e,t,n),$m(Fs.width,i)}function NR(e){return!!Qi(e).length}function BR(e,t,n){var i=Qi(e),r;return r=Hl(i,t,n),e.height-r.height+Bl.height}function $R(e,t,n){var i=Qi(e),r;return r=Hl(i,t,n),e.width-r.width+$l.width}function Hl(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=Qi(r),o.length?Hl(o,t,n):r}var Fm="_plane";function Hm(e){var t=e.id;return jR(t)}function pi(e){var t=e.id;return y(e,"bpmn:SubProcess")?zm(t):t}function Mr(e){return zm(e)}function zs(e){var t=Ie(e);return y(t,"bpmndi:BPMNPlane")}function zm(e){return e+Fm}function jR(e){return e.replace(new RegExp(Fm+"$"),"")}var Vm=400,FR=600,Gm={x:180,y:160};function Ci(e,t,n,i,r,o,a){U.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 y(p,"bpmn:SubProcess")&&!Me(p)}function u(p){var f=p.shape,d=p.newRootElement,h=q(f);d=s._addDiagram(d||h),p.newRootElement=e.addRootElement(d)}function l(p){var f=p.shape,d=q(f);s._removeDiagram(d);var h=p.newRootElement=a.get(pi(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(pi(d));if(!(!h||!d.children||!d.children.length)){var m=Wm(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;!y(f,"bpmn:SubProcess")||!Me(f)||M(Wo([f]),d=>{n.removeShape(d.annotation)})},!0),this.preExecuted("shape.delete",function(p){var f=p.shape;if(c(f)){var d=a.get(pi(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(pi(f)))},!0),this.postExecuted("shape.replace",function(p){var f=p.newShape,d=p.oldRoot,h=e.findRoot(pi(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(y(f,"bpmn:SubProcess")){var d=p.properties,h=p.oldProperties,m=h.id,g=d.id;if(m!==g){if(zs(f)){a.updateId(f,Mr(g)),a.updateId(m,g);return}var S=a.get(Mr(m));S&&a.updateId(Mr(m),Mr(g))}}},!0),this.reverted("element.updateProperties",function(p){var f=p.element;if(y(f,"bpmn:SubProcess")){var d=p.properties,h=p.oldProperties,m=h.id,g=d.id;if(m!==g){if(zs(f)){a.updateId(f,Mr(m)),a.updateId(g,m);return}var S=a.get(Mr(g));S&&a.updateId(S,Mr(m))}}},!0),t.on("element.changed",function(p){var f=p.element;if(zs(f)){var d=f,h=a.get(Hm(d));!h||h===d||t.fire("element.changed",{element:h})}}),this.executed("shape.toggleCollapse",Vm,function(p){var f=p.shape;y(f,"bpmn:SubProcess")&&(Me(f)?l(p):(u(p),s._showRecursively(f.children)))},!0),this.reverted("shape.toggleCollapse",Vm,function(p){var f=p.shape;y(f,"bpmn:SubProcess")&&(Me(f)?l(p):(u(p),s._showRecursively(f.children)))},!0),this.postExecuted("shape.toggleCollapse",FR,function(p){var f=p.shape;if(y(f,"bpmn:SubProcess")){var d=p.newRootElement;if(d)if(Me(f))s._moveChildrenToShape(d.children.slice(),f),M(Wo(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=Wm(f);s._moveChildrenToShape(h,d)}}},!0),t.on("copyPaste.createTree",function(p){var f=p.element,d=p.children;if(c(f)){var h=pi(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=y(Ie(m),"bpmndi:BPMNPlane");if(g){var S=Hm(m),E=et(h,function(b){return b.id===S});E&&(f.parent=E.id)}}),t.on("copyPaste.pasteElement",function(p){var f=p.descriptor;f.parent&&(c(f.parent)||f.parent.hidden)&&(f.hidden=!0)})}te(Ci,U),Ci.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=Et(i),o;if(!t.x)o={x:Gm.x-r.x,y:Gm.y-r.y};else{var a=fe(t),s=fe(r);o={x:a.x-s.x,y:a.y-s.y}}n.moveElements(e,o,t,{autoResize:!1})}},Ci.prototype._disconnectSharedAnnotations=function(e){var t=this._modeling,n=new Set(Lh(e).map(i=>i.annotation));n.size&&M(Wo(e.children),i=>{n.has(i.annotation)&&M(i.associations,r=>{t.removeConnection(r)})})},Ci.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},Ci.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},Ci.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:pi(e),type:e.$type,di:i,businessObject:e,collapsed:!0});return o},Ci.prototype._removeDiagram=function(e){var t=this._bpmnjs,n=t.getDefinitions().diagrams,i=et(n,function(r){return r.plane.bpmnElement.id===e.id});return n.splice(n.indexOf(i),1),i},Ci.$inject=["canvas","eventBus","modeling","elementFactory","bpmnFactory","bpmnjs","elementRegistry"];function HR(e){var t=[];return M(Wo(e),n=>{t.push(n.annotation),t.push.apply(t,n.associations)}),t}function Wm(e){return e.children.slice().concat(HR(e.children)).concat(zR(e))}function zR(e){return Uu(e.children||[]).reduce(function(t,n){return n.label&&n.label.parent!==e&&t.push(n.label),t},[])}function zl(e,t){e.invoke(U,this),this.postExecuted("shape.replace",function(n){var i=n.context.oldShape,r=n.context.newShape;if(!(!y(r,"bpmn:SubProcess")||y(r,"bpmn:AdHocSubProcess")||!(y(i,"bpmn:Task")||y(i,"bpmn:CallActivity"))||!Me(r))){var o=VR(r);t.createShape({type:"bpmn:StartEvent"},o,r)}})}zl.$inject=["injector","modeling"],te(zl,U);function VR(e){return{x:e.x+e.width/6,y:e.y+e.height/2}}function Vl(e,t){U.call(this,e),this.preExecute("connection.create",function(n){const{target:i}=n;y(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&&y(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(!(!y(r,"bpmn:TextAnnotation")||o.autoResize)){var a=i.newBounds,s=t.getTextAnnotationBounds(a,kn(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}}})}te(Vl,U),Vl.$inject=["eventBus","textRenderer"];function Gl(e,t){U.call(this,e),this.postExecuted("shape.toggleCollapse",1500,function(n){var i=n.shape;if(Me(i))return;var r=jo(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||y(a,"bpmn:Association")&&(y(a.source,"bpmn:TextAnnotation")||y(a.target,"bpmn:TextAnnotation"))||(s?t.reconnectEnd(a,i,fe(i)):t.reconnectStart(a,i,fe(i)))}},!0)}te(Gl,U),Gl.$inject=["eventBus","modeling"];var Wl=500;function Ul(e,t,n){U.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=GR(c).concat([a]),p=Jh(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"],Wl,function(a){var s=a.context,c=s.shape;y(c,"bpmn:SubProcess")&&(c.collapsed?Ie(c).isExpanded=!1:(i(c.children),Ie(c).isExpanded=!0))}),this.reverted(["shape.toggleCollapse"],Wl,function(a){var s=a.context,c=s.shape;c.collapsed?Ie(c).isExpanded=!1:Ie(c).isExpanded=!0}),this.postExecuted(["shape.toggleCollapse"],Wl,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"})})}te(Ul,U),Ul.$inject=["eventBus","elementFactory","modeling"];function GR(e){return e.filter(function(t){return!t.hidden})}function ql(e,t,n,i){t.invoke(U,this),this.preExecute("shape.delete",function(r){var o=r.context,a=o.shape,s=a.businessObject;Ee(a)||(y(a,"bpmn:Participant")&&Me(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;y(r,"bpmn:Collaboration")&&n.ids.unclaim(o.id)})}te(ql,U),ql.$inject=["canvas","injector","moddle","modeling"];function Yl(e,t){U.call(this,e),this.preExecute("connection.delete",function(n){var i=n.context,r=i.connection,o=r.source;WR(r,o)&&t.updateProperties(o,{default:null})})}te(Yl,U),Yl.$inject=["eventBus","modeling"];function WR(e,t){if(!y(e,"bpmn:SequenceFlow"))return!1;var n=q(t),i=q(e);return n.get("default")===i}var UR=500,qR=5e3,Um=["shape.create","shape.delete","shape.move","shape.resize"],qm=[...Um,"spaceTool","lane.add","lane.resize","lane.split","elements.create","elements.delete","elements.move"];function Kl(e,t){U.call(this,e);var n;function i(){return n=n||new YR,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(qm,qR,function(){i()}),this.postExecuted(qm,UR,function(){o()}),this.preExecute(Um,function(a){var s=a.context,c=s.shape,u=r();!c||c.labelTarget||(y(c,"bpmn:Lane")&&u.addLane(c),y(c,"bpmn:FlowNode")&&u.addFlowNode(c))})}Kl.$inject=["eventBus","modeling"],te(Kl,U);function YR(){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 KR=500,XR=5e3,Ym=["connection.create","connection.delete","connection.layout","connection.move","connection.reconnect","connection.updateWaypoints","shape.create","shape.delete","shape.move","shape.resize"],Km=[...Ym,"elements.create","elements.delete","elements.move","label.create","spaceTool"];function Xl(e,t){U.call(this,e);var n;function i(){return n=n||new ZR,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(Km,XR,function(){i()}),this.postExecuted(Km,KR,function(){o()}),this.preExecute(Ym,function(a){var s=a.context.connection||a.context.shape,c=r();!s||s.labelTarget||(y(s,"bpmn:FlowElement")&&c.addFlowElement(s),y(s,"bpmn:Group")&&c.addGroup(s))}),this.preExecute("label.create",function(a){var s=a.context.labelTarget;y(s,"bpmn:Group")&&r().addGroup(s)})}Xl.$inject=["eventBus","modeling"],te(Xl,U);function ZR(){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 Zl(e,t){U.call(this,e),this.postExecuted("elements.create",function(n){const i=n.context,r=i.elements;for(const o of r)QR(o)&&!eC(o)&&t.updateProperties(o,{isForCompensation:void 0})})}te(Zl,U),Zl.$inject=["eventBus","modeling"];function QR(e){const t=q(e);return t&&t.isForCompensation}function JR(e){return e&&y(e,"bpmn:BoundaryEvent")&&to(e,"bpmn:CompensateEventDefinition")}function eC(e){return e.incoming.filter(n=>JR(n.source)).length>0}const tC={__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",ol],appendBehavior:["type",al],associationBehavior:["type",cl],attachEventBehavior:["type",ws],artifactBehavior:["type",sl],boundaryEventBehavior:["type",ul],categoryRootElementReferenceBehavior:["type",ll],compensateBoundaryEventBehaviour:["type",pl],createBehavior:["type",fl],createDataObjectBehavior:["type",dl],createParticipantBehavior:["type",gl],dataInputAssociationBehavior:["type",vl],dataStoreBehavior:["type",yl],deleteLaneBehavior:["type",_l],detachEventBehavior:["type",ks],dropOnFlowBehavior:["type",xl],eventBasedGatewayBehavior:["type",El],fixHoverBehavior:["type",am],groupBehavior:["type",wl],importDockingFix:["type",cm],isHorizontalFix:["type",Rl],labelBehavior:["type",Pl],layoutConnectionBehavior:["type",Al],messageFlowBehavior:["type",kl],nonInterruptingBehavior:["type",Dl],removeElementBehavior:["type",Il],removeEmbeddedLabelBoundsBehavior:["type",Ol],removeParticipantBehavior:["type",Ll],replaceConnectionBehavior:["type",Nl],replaceElementBehaviour:["type",$s],resizeBehavior:["type",km],resizeLaneBehavior:["type",Bm],rootElementReferenceBehavior:["type",Fl],spaceToolBehavior:["type",jm],subProcessPlaneBehavior:["type",Ci],subProcessStartEventBehavior:["type",zl],textAnnotationBehavior:["type",Vl],toggleCollapseConnectionBehaviour:["type",Gl],toggleElementCollapseBehaviour:["type",Ul],unclaimIdBehavior:["type",ql],unsetDefaultFlowBehavior:["type",Yl],updateFlowNodeRefsBehavior:["type",Kl],updateCategoryValueRefsBehavior:["type",Xl],setCompensationActivityAfterPasteBehavior:["type",Zl]};function Ql(e){this._commandStack=e.get("commandStack",!1)}Ql.$inject=["injector"],Ql.prototype.allowed=function(e,t){var n=!0,i=this._commandStack;return i&&(n=i.canExecute(e,t)),n===void 0?!0:n};const fi={__init__:["rules"],rules:["type",Ql]};function Hn(e){U.call(this,e),this.init()}Hn.$inject=["eventBus"],te(Hn,U),Hn.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)})},Hn.prototype.init=function(){};function Xm(e,t){var n=Gt(e,t,-15);return n!=="intersect"?n:null}function Ut(e){Hn.call(this,e)}te(Ut,Hn),Ut.$inject=["eventBus"],Ut.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 Gs(t,n)}finally{r&&(n.parent=null)}}),this.addRule("connection.reconnect",function(e){var t=e.connection,n=e.source,i=e.target;return Gs(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 ug(t,n,i)}),this.addRule("elements.create",function(e){var t=e.elements,n=e.position,i=e.target;return Xe(i)&&!Ws(t,i)?!1:yr(t,function(r){return Xe(r)?Gs(r.source,r.target,r):r.host?na(r,r.host,null,n):np(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 ig(a)&&!n.includes(a.host)})?!1:na(n,t,null,i)||sg(n,t,i)||cg(n,t)||Ws(n,t)}),this.addRule("shape.create",function(e){return np(e.shape,e.target,e.source,e.position)}),this.addRule("shape.attach",function(e){return na(e.shape,e.target,null,e.position)}),this.addRule("element.copy",function(e){var t=e.element,n=e.elements;return hg(n,t)})},Ut.prototype.canConnectMessageFlow=fg,Ut.prototype.canConnectSequenceFlow=dg,Ut.prototype.canConnectDataAssociation=ip,Ut.prototype.canConnectAssociation=lg,Ut.prototype.canConnectCompensationAssociation=pg,Ut.prototype.canMove=cg,Ut.prototype.canAttach=na,Ut.prototype.canReplace=sg,Ut.prototype.canDrop=po,Ut.prototype.canInsert=Ws,Ut.prototype.canCreate=np,Ut.prototype.canConnect=Gs,Ut.prototype.canResize=ug,Ut.prototype.canCopy=hg;function nC(e){return Jl(e)?null:Se(e,["bpmn:FlowNode","bpmn:InteractionNode","bpmn:DataObjectReference","bpmn:DataStoreReference","bpmn:Group","bpmn:TextAnnotation"])}function Jl(e){return!e||Ee(e)}function Zm(e){do{if(y(e,"bpmn:Process"))return q(e);if(y(e,"bpmn:Participant"))return q(e).processRef||q(e)}while(e=e.parent)}function ep(e){return y(e,"bpmn:TextAnnotation")}function tp(e){return y(e,"bpmn:Group")&&!e.labelTarget}function Qm(e){return y(e,"bpmn:BoundaryEvent")&&di(e,"bpmn:CompensateEventDefinition")}function Vs(e){return q(e).isForCompensation}function iC(e,t){var n=Zm(e),i=Zm(t);return n===i}function rC(e){return y(e,"bpmn:InteractionNode")&&!y(e,"bpmn:BoundaryEvent")&&(!y(e,"bpmn:Event")||y(e,"bpmn:ThrowEvent")&&tg(e,"bpmn:MessageEventDefinition"))}function oC(e){return y(e,"bpmn:InteractionNode")&&!Vs(e)&&(!y(e,"bpmn:Event")||y(e,"bpmn:CatchEvent")&&tg(e,"bpmn:MessageEventDefinition"))&&!(y(e,"bpmn:BoundaryEvent")&&!di(e,"bpmn:MessageEventDefinition"))}function Jm(e){for(var t=e;t=t.parent;){if(y(t,"bpmn:FlowElementsContainer"))return q(t);if(y(t,"bpmn:Participant"))return q(t).processRef}return null}function eg(e,t){var n=Jm(e),i=Jm(t);return n===i}function di(e,t){var n=q(e);return!!et(n.eventDefinitions||[],function(i){return y(i,t)})}function tg(e,t){var n=q(e);return(n.eventDefinitions||[]).every(function(i){return y(i,t)})}function aC(e){return y(e,"bpmn:FlowNode")&&!y(e,"bpmn:EndEvent")&&!nn(e)&&!(y(e,"bpmn:IntermediateThrowEvent")&&di(e,"bpmn:LinkEventDefinition"))&&!Qm(e)&&!Vs(e)}function sC(e){return y(e,"bpmn:FlowNode")&&!y(e,"bpmn:StartEvent")&&!y(e,"bpmn:BoundaryEvent")&&!nn(e)&&!(y(e,"bpmn:IntermediateCatchEvent")&&di(e,"bpmn:LinkEventDefinition"))&&!Vs(e)}function cC(e){return y(e,"bpmn:ReceiveTask")||y(e,"bpmn:IntermediateCatchEvent")&&(di(e,"bpmn:MessageEventDefinition")||di(e,"bpmn:TimerEventDefinition")||di(e,"bpmn:ConditionalEventDefinition")||di(e,"bpmn:SignalEventDefinition"))}function uC(e){for(var t=[];e;)e=e.parent,e&&t.push(e);return t}function ng(e,t){var n=uC(t);return n.indexOf(e)!==-1}function Gs(e,t,n){if(Jl(e)||Jl(t))return null;if(!y(n,"bpmn:DataAssociation")){if(fg(e,t))return{type:"bpmn:MessageFlow"};if(dg(e,t))return{type:"bpmn:SequenceFlow"}}var i=ip(e,t);return i||(pg(e,t)?{type:"bpmn:Association",associationDirection:"One"}:lg(e,t)?{type:"bpmn:Association",associationDirection:"None"}:!1)}function po(e,t){return Ee(e)||tp(e)?!0:y(t,"bpmn:Participant")&&!Me(t)?!1:y(e,"bpmn:Participant")?y(t,"bpmn:Process")||y(t,"bpmn:Collaboration"):Se(e,["bpmn:DataInput","bpmn:DataOutput"])&&e.parent?t===e.parent:y(e,"bpmn:Lane")?y(t,"bpmn:Participant")||y(t,"bpmn:Lane"):y(e,"bpmn:BoundaryEvent")&&!lC(e)?!1:y(e,"bpmn:FlowElement")&&!y(e,"bpmn:DataStoreReference")?y(t,"bpmn:FlowElementsContainer")?Me(t):Se(t,["bpmn:Participant","bpmn:Lane"]):y(e,"bpmn:DataStoreReference")&&y(t,"bpmn:Collaboration")?Ni(q(t).get("participants"),function(n){return!!n.get("processRef")}):Se(e,["bpmn:Artifact","bpmn:DataAssociation","bpmn:DataStoreReference"])?Se(t,["bpmn:Collaboration","bpmn:Lane","bpmn:Participant","bpmn:Process","bpmn:SubProcess"]):y(e,"bpmn:MessageFlow")?y(t,"bpmn:Collaboration")||e.source.parent==t||e.target.parent==t:!1}function lC(e){return q(e).cancelActivity&&(rg(e)||og(e))}function ig(e){return!Ee(e)&&y(e,"bpmn:BoundaryEvent")}function pC(e){return y(e,"bpmn:Lane")}function fC(e){return ig(e)||y(e,"bpmn:IntermediateThrowEvent")&&rg(e)?!0:y(e,"bpmn:IntermediateCatchEvent")&&og(e)}function rg(e){var t=q(e);return t&&!(t.eventDefinitions&&t.eventDefinitions.length)}function og(e){return ag(e,["bpmn:MessageEventDefinition","bpmn:TimerEventDefinition","bpmn:SignalEventDefinition","bpmn:ConditionalEventDefinition"])}function ag(e,t){return t.some(function(n){return di(e,n)})}function dC(e){return y(e,"bpmn:ReceiveTask")&&et(e.incoming,function(t){return y(t.source,"bpmn:EventBasedGateway")})}function na(e,t,n,i){if(Array.isArray(e)||(e=[e]),e.length!==1)return!1;var r=e[0];return Ee(r)||!fC(r)||nn(t)||!y(t,"bpmn:Activity")||Vs(t)||i&&!Xm(i,t)||dC(t)?!1:"attach"}function sg(e,t,n){if(!t)return!1;var i={replacements:[]};return M(e,function(r){nn(t)||y(r,"bpmn:StartEvent")&&r.type!=="label"&&po(r,t)&&(E1(r)||i.replacements.push({oldElementId:r.id,newElementType:"bpmn:StartEvent"}),(w1(r)||S1(r)||R1(r))&&i.replacements.push({oldElementId:r.id,newElementType:"bpmn:StartEvent"}),ag(r,["bpmn:MessageEventDefinition","bpmn:TimerEventDefinition","bpmn:SignalEventDefinition","bpmn:ConditionalEventDefinition"])&&y(t,"bpmn:SubProcess")&&i.replacements.push({oldElementId:r.id,newElementType:"bpmn:StartEvent"})),y(t,"bpmn:Transaction")||di(r,"bpmn:CancelEventDefinition")&&r.type!=="label"&&(y(r,"bpmn:EndEvent")&&po(r,t)&&i.replacements.push({oldElementId:r.id,newElementType:"bpmn:EndEvent"}),y(r,"bpmn:BoundaryEvent")&&na(r,t,null,n)&&i.replacements.push({oldElementId:r.id,newElementType:"bpmn:BoundaryEvent"}))}),i.replacements.length?i:!1}function cg(e,t){return Ni(e,pC)?!1:t===void 0?!0:t===null?!1:e.every(function(n){return po(n,t)})}function np(e,t,n,i){return t?Ee(e)||tp(e)?!0:po(e,t)||Ws(e,t):!1}function ug(e,t,n){return y(e,"bpmn:SubProcess")?Me(e)&&(!t||t.width>=100&&t.height>=80):y(e,"bpmn:Lane")||y(e,"bpmn:Participant")?!0:ep(e)?n?n==="e"||n==="w":!0:tp(e)?!0:Ee(e)?n?n==="e"||n==="w":!0:!1}function hC(e,t){var n=ep(e),i=ep(t);return(n||i)&&n!==i}function lg(e,t){return ng(t,e)||ng(e,t)?!1:hC(e,t)?!0:!!ip(e,t)}function pg(e,t){return eg(e,t)&&Qm(e)&&y(t,"bpmn:Activity")&&!gC(t,e)&&!nn(t)}function fg(e,t){return gg(e)&&!gg(t)?!1:rC(e)&&oC(t)&&!iC(e,t)}function dg(e,t){return aC(e)&&sC(t)&&eg(e,t)&&!(y(e,"bpmn:EventBasedGateway")&&!cC(t))}function ip(e,t){return Se(e,["bpmn:DataObjectReference","bpmn:DataStoreReference"])&&Se(t,["bpmn:Activity","bpmn:ThrowEvent"])?{type:"bpmn:DataInputAssociation"}:Se(t,["bpmn:DataObjectReference","bpmn:DataStoreReference"])&&Se(e,["bpmn:Activity","bpmn:CatchEvent"])?{type:"bpmn:DataOutputAssociation"}:!1}function Ws(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:Se(t,["bpmn:SequenceFlow","bpmn:MessageFlow"])&&!Ee(t)&&y(e,"bpmn:FlowNode")&&!y(e,"bpmn:BoundaryEvent")&&po(e,t.parent)}function rp(e,t){return e&&t&&e.indexOf(t)!==-1}function hg(e,t){return Ee(t)?!0:!(y(t,"bpmn:Lane")&&!rp(e,t.parent)||y(t,"bpmn:MessageFlow")&&!mC(e,t))}function mC(e,t){var n=mg(t.source),i=mg(t.target);return rp(e,n)&&rp(e,i)}function mg(e){for(;e;e=e.parent)if(y(e,"bpmn:Participant"))return e;return null}function gg(e){return ro(e,"bpmn:Process")||ro(e,"bpmn:Collaboration")}function gC(e,t){return e.attachers.includes(t)}const vC={__depends__:[fi],__init__:["bpmnRules"],bpmnRules:["type",Ut]};var yC=2e3;function vg(e,t){e.on("saveXML.start",yC,n);function n(){var i=t.getRootElements();M(i,function(r){var o=Ie(r),a,s;a=jo([r]),a=Ae(a,function(c){return c!==r&&!c.labelTarget}),s=Zt(a,Ie),o.set("planeElement",s)})}}vg.$inject=["eventBus","canvas"];const _C={__init__:["bpmnDiOrdering"],bpmnDiOrdering:["type",vg]};function Us(e){U.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)})}Us.prototype.getOrdering=function(e,t){return null},te(Us,U);function op(e,t){Us.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=et(n,function(c){return Se(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&&!Se(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||y(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=Df(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}}}op.$inject=["eventBus","canvas"],te(op,Us);const bC={__init__:["bpmnOrderingProvider"],bpmnOrderingProvider:["type",op]};function ia(){}ia.prototype.get=function(){return this._data},ia.prototype.set=function(e){this._data=e},ia.prototype.clear=function(){var e=this._data;return delete this._data,e},ia.prototype.isEmpty=function(){return!this._data};const xC={clipboard:["type",ia]};var yg=1500;function _g(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",yg,function(s){o(s)})}),(function(){var a,s;t.on("element.hover",function(c){a=c.gfx,s=c.element}),t.on("element.hover",yg,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=Tr(a),c=document.elementFromPoint(s.x,s.y),EC(c)}}_g.$inject=["elementRegistry","eventBus","injector"];function EC(e){return wr(e,"svg, .djs-element",!0)}const wC={__init__:["hoverFix"],hoverFix:["type",_g]};function SC(e){return!0}function qs(e){return er(e)||TR(e)}var bg=500;function xg(e,t,n){var i=this;function r(P,j,F){if(!s(P,j)){var L,H,oe;F?H=t.getGraphics(F):(L=j.delegateTarget||j.target,L&&(H=L,F=t.get(H))),!(!H||!F)&&(oe=e.fire(P,{element:F,gfx:H,originalEvent:j}),oe===!1&&(j.stopPropagation(),j.preventDefault()))}}var o={};function a(P){return o[P]}function s(P,j){var F=u[P]||er;return!F(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":SC,"element.mousedown":qs,"element.mouseup":qs,"element.click":qs,"element.dblclick":qs};function l(P,j,F){var L=c[P];if(!L)throw new Error("unmapped DOM event name <"+P+">");return r(L,j,F)}var p="svg, .djs-element";function f(P,j,F,L){var H=o[F]=function(oe){r(F,oe)};L&&(u[F]=L),H.$delegate=_n.bind(P,p,j,H)}function d(P,j,F){var L=a(F);L&&_n.unbind(P,j,L.$delegate)}function h(P){M(c,function(j,F){f(P,F,j)})}function m(P){M(c,function(j,F){d(P,F,j)})}e.on("canvas.destroy",function(P){m(P.svg)}),e.on("canvas.init",function(P){h(P.svg)}),e.on(["shape.added","connection.added"],function(P){var j=P.element,F=P.gfx;e.fire("interactionEvents.createHit",{element:j,gfx:F})}),e.on(["shape.changed","connection.changed"],bg,function(P){var j=P.element,F=P.gfx;e.fire("interactionEvents.updateHit",{element:j,gfx:F})}),e.on("interactionEvents.createHit",bg,function(P){var j=P.element,F=P.gfx;i.createDefaultHit(j,F)}),e.on("interactionEvents.updateHit",function(P){var j=P.element,F=P.gfx;i.updateDefaultHit(j,F)});var g=w("djs-hit djs-hit-stroke"),S=w("djs-hit djs-hit-click-stroke"),E=w("djs-hit djs-hit-all"),b=w("djs-hit djs-hit-no-move"),x={all:E,"click-stroke":S,stroke:g,"no-move":b};function w(P,j){return j=D({stroke:"white",strokeWidth:15},j||{}),n.cls(P,["no-fill","no-border"],j)}function T(P,j){var F=x[j];if(!F)throw new Error("invalid hit type <"+j+">");return ne(P,F),P}function I(P,j){ye(P,j)}this.removeHits=function(P){var j=rs(".djs-hit",P);M(j,Dt)},this.createDefaultHit=function(P,j){var F=P.waypoints,L=P.isFrame,H;return F?this.createWaypointsHit(j,F):(H=L?"stroke":"all",this.createBoxHit(j,H,{width:P.width,height:P.height}))},this.createWaypointsHit=function(P,j){var F=$o(j);return T(F,"stroke"),I(P,F),F},this.createBoxHit=function(P,j,F){F=D({x:0,y:0},F);var L=ce("rect");return T(L,j),ne(L,F),I(P,L),L},this.updateDefaultHit=function(P,j){var F=qe(".djs-hit",j);if(F)return P.waypoints?Wu(F,P.waypoints):ne(F,{width:P.width,height:P.height}),F},this.fire=r,this.triggerMouseEvent=l,this.mouseHandler=a,this.registerEvent=f,this.unregisterEvent=d}xg.$inject=["eventBus","elementRegistry","styles"];const Ys={__init__:["interactionEvents"],interactionEvents:["type",xg]};function fo(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)})}fo.$inject=["eventBus","canvas"],fo.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()})}},fo.prototype.get=function(){return Array.from(this._selectedElements)},fo.prototype.isSelected=function(e){return this._selectedElements.has(e)},fo.prototype.select=function(e,t){var n=this.get();pe(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 Eg="hover",wg="selected";function Sg(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,Eg)}),t.on("element.out",function(r){i(r.element,Eg)}),t.on("selection.changed",function(r){function o(u){i(u,wg)}function a(u){n(u,wg)}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)})}Sg.$inject=["canvas","eventBus"];function Rg(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;pe(u)?t.select(u):t.select(s.filter(RC))}}),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=et(o,function(c){return a.id===c.id});s||t.select(a)}),e.on("element.click",function(r){if(er(r)){var o=r.element;o===n.getRootElement()&&(o=null);var a=t.isSelected(o),s=t.get().length>1,c=Hs(r);if(a&&s)return c?t.deselect(o):t.select(o);a?t.deselect(o):t.select(o,c)}})}Rg.$inject=["eventBus","selection","canvas","elementRegistry"];function RC(e){return!e.hidden}const zn={__init__:["selectionVisuals","selectionBehavior"],__depends__:[Ys],selection:["type",fo],selectionVisuals:["type",Sg],selectionBehavior:["type",Rg]};var CC=/^djs-cursor-.*$/;function Ks(e){var t=st(document.body);t.removeMatching(CC),e&&t.add("djs-cursor-"+e)}function Cg(){Ks(null)}var PC=5e3;function Pg(e,t){t=t||"element.click";function n(){return!1}return e.once(t,PC,n),function(){e.off(t,n)}}var AC=["c","C"],TC=["v","V"],MC=["d","D"],kC=["x","X"],DC=["y","Y"],Ag=["z","Z"];function OC(e){return e.ctrlKey||e.metaKey||e.shiftKey||e.altKey}function En(e){return e.altKey?!1:e.ctrlKey||e.metaKey}function Ot(e,t){return e=pe(e)?e:[e],e.indexOf(t.key)!==-1||e.indexOf(t.code)!==-1}function ap(e){return e.shiftKey}function IC(e){return En(e)&&Ot(AC,e)}function LC(e){return En(e)&&Ot(TC,e)}function NC(e){return En(e)&&Ot(MC,e)}function BC(e){return En(e)&&Ot(kC,e)}function $C(e){return En(e)&&!ap(e)&&Ot(Ag,e)}function jC(e){return En(e)&&(Ot(DC,e)||Ot(Ag,e)&&ap(e))}var ho=Math.round,Tg="djs-drag-active";function kr(e){e.preventDefault()}function FC(e){return typeof TouchEvent<"u"&&e instanceof TouchEvent}function HC(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}function Mg(e,t,n,i){var r={threshold:5,trapClick:!0},o;function a(b){var x=t.viewbox(),w=t._container.getBoundingClientRect();return{x:x.x+(b.x-w.left)/x.scale,y:x.y+(b.y-w.top)/x.scale}}function s(b,x){x=x||o;var w=e.createEvent(D({},x.payload,x.data,{isTouch:x.isTouch}));return e.fire("drag."+b,w)===!1?!1:e.fire(x.prefix+"."+b,w)}function c(b){var x=b.filter(function(w){return i.get(w.id)});x.length&&n.select(x)}function u(b,x){var w=o.payload,T=o.displacement,I=o.globalStart,P=Tr(b),j=Zn(P,I),F=o.localStart,L=a(P),H=Zn(L,F);if(!o.active&&(x||HC(j)>o.threshold)){if(D(w,{x:ho(F.x+T.x),y:ho(F.y+T.y),dx:0,dy:0},{originalEvent:b}),s("start")===!1)return g();o.active=!0,o.keepSelection||(w.previousSelection=n.get(),n.select(null)),o.cursor&&Ks(o.cursor),t.addMarker(t.getRootElement(),Tg)}jl(b),o.active&&(D(w,{x:ho(L.x+T.x),y:ho(L.y+T.y),dx:ho(H.x),dy:ho(H.y)},{originalEvent:b}),s("move"))}function l(b){var x,w=!0;o.active&&(b&&(o.payload.originalEvent=b,jl(b)),w=s("end")),w===!1&&s("rejected"),x=S(w!==!0),s("ended",x)}function p(b){Ot("Escape",b)&&(kr(b),g())}function f(b){var x;o.active&&(x=Pg(e),setTimeout(x,400),kr(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 w=o.active;w&&s("cancel"),x=S(b),w&&s("canceled",x)}}function S(b){var x,w;s("cleanup"),Cg(),o.trapClick?w=f:w=l,ve.unbind(document,"mousemove",u),ve.unbind(document,"dragstart",kr),ve.unbind(document,"selectstart",kr),ve.unbind(document,"mousedown",w,!0),ve.unbind(document,"mouseup",w,!0),ve.unbind(document,"keyup",p),ve.unbind(document,"touchstart",d,!0),ve.unbind(document,"touchcancel",g,!0),ve.unbind(document,"touchmove",u,!0),ve.unbind(document,"touchend",l,!0),e.off("element.hover",h),e.off("element.out",m),t.removeMarker(t.getRootElement(),Tg);var T=o.payload.previousSelection;return b!==!1&&T&&!n.get().length&&c(T),x=o,o=null,x}function E(b,x,w,T){o&&g(!1),typeof x=="string"&&(T=w,w=x,x=null),T=D({},r,T||{});var I=T.data||{},P,j,F,L,H;if(T.trapClick?L=f:L=l,b?(P=lo(b)||b,j=Tr(b),jl(b),P.type==="dragstart"&&kr(P)):(P=null,j={x:0,y:0}),F=a(j),x||(x=F),H=FC(P),o=D({prefix:w,data:I,payload:{},globalStart:j,displacement:Zn(x,F),localStart:F,isTouch:H},T),T.manual||(H?(ve.bind(document,"touchstart",d,!0),ve.bind(document,"touchcancel",g,!0),ve.bind(document,"touchmove",u,!0),ve.bind(document,"touchend",l,!0)):(ve.bind(document,"mousemove",u),ve.bind(document,"dragstart",kr),ve.bind(document,"selectstart",kr),ve.bind(document,"mousedown",L,!0),ve.bind(document,"mouseup",L,!0)),ve.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=E,this.move=u,this.hover=h,this.out=m,this.end=l,this.cancel=g,this.context=function(){return o},this.setOptions=function(b){D(r,b)}}Mg.$inject=["eventBus","canvas","selection","elementRegistry"];const Pi={__depends__:[wC,zn],dragging:["type",Mg]};function mo(e){this._counter=0,this._prefix=(e?e+"-":"")+Math.floor(Math.random()*1e9)+"-"}mo.prototype.next=function(){return this._prefix+ ++this._counter};const zC=new mo("ps");var VC=["marker-start","marker-mid","marker-end"],GC=["circle","ellipse","line","path","polygon","polyline","path","rect"];function tr(e,t,n,i){this._elementRegistry=e,this._canvas=n,this._styles=i}tr.$inject=["elementRegistry","eventBus","canvas","styles"],tr.prototype.cleanUp=function(){console.warn("PreviewSupport#cleanUp is deprecated and will be removed in future versions. You do not need to manually clean up previews anymore. cf. https://github.com/bpmn-io/diagram-js/pull/906")},tr.prototype.getGfx=function(e){return this._elementRegistry.getGraphics(e)},tr.prototype.addDragger=function(e,t,n,i="djs-dragger"){n=n||this.getGfx(e);var r=Vd(n);return this._cloneMarkers(Cr(r),i),ne(r,this._styles.cls(i,[])),ye(t,r),ne(r,"data-preview-support-element-id",e.id),r},tr.prototype.addFrame=function(e,t){var n=ce("rect",{class:"djs-resize-overlay",width:e.width,height:e.height,x:e.x,y:e.y});return ye(t,n),ne(n,"data-preview-support-element-id",e.id),n},tr.prototype._cloneMarkers=function(e,t="djs-dragger",n=e){var i=this;e.childNodes&&e.childNodes.forEach(r=>{i._cloneMarkers(r,t,n)}),YC(e)&&VC.forEach(function(r){if(ne(e,r)){var o=WC(e,r,i._canvas.getContainer());o&&i._cloneMarker(n,e,o,r,t)}})},tr.prototype._cloneMarker=function(e,t,n,i,r="djs-dragger"){var o=[n.id,r,zC.next()].join("-"),a=qe("marker#"+n.id,e);e=e||this._canvas._svg;var s=a||Vd(n);s.id=o,ke(s).add(r);var c=qe(":scope > defs",e);c||(c=ce("defs"),ye(e,c)),ye(c,s);var u=qC(s.id);ne(t,i,u)};function WC(e,t,n){var i=UC(ne(e,t));return qe("marker#"+i,n||document)}function UC(e){return e.match(/url\(['"]?#([^'"]*)['"]?\)/)[1]}function qC(e){return"url(#"+e+")"}function YC(e){return GC.indexOf(e.nodeName)!==-1}const go={__init__:["previewSupport"],previewSupport:["type",tr]};var KC="drop-ok",kg="drop-not-ok",Dg="attach-ok",Og="new-parent",Ig="create",XC=2e3;function Lg(e,t,n,i,r){function o(c,u,l,p,f){if(!u)return!1;c=Ae(c,function(E){var b=E.labelTarget;return!E.parent&&!(Ee(E)&&c.indexOf(b)!==-1)});var d=et(c,function(E){return!Xe(E)}),h=!1,m=!1,g=!1;Bg(c)&&(h=r.allowed("shape.attach",{position:l,shape:d,target:u})),h||(Bg(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 S=f.connectionTarget;return g||h?(d&&p&&(m=r.allowed("connection.create",{source:S===p?d:p,target:S===p?p:d,hints:{targetParent:u,targetAttach:h}})),{attach:h,connect:m}):g===null||h===null?null:!1}function a(c,u){[Dg,KC,kg,Og].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}Ng(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,Dg):a(p,m?Og:kg))}),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,S=u.hints||{};if(h===!1||!d)return!1;Ng(c);var E={x:c.x,y:c.y};g?p=i.appendShape(l,p,E,d,{attach:m,connection:g===!0?{}:g,connectionTarget:S.connectionTarget}):(f=i.createElements(f,E,d,D({},S,{attach:m})),p=et(f,function(b){return!Xe(b)})),D(u,{elements:f,shape:p}),D(c,{elements:f,shape:p})});function s(){var c=t.context();c&&c.prefix===Ig&&t.cancel()}n.on("create.init",function(){n.on("elements.changed",s),n.once(["create.cancel","create.end"],XC,function(){n.off("elements.changed",s)})}),this.start=function(c,u,l){pe(u)||(u=[u]);var p=et(u,function(h){return!Xe(h)});if(p){l=D({elements:u,hints:{},shape:p},l||{}),M(u,function(h){me(h.x)||(h.x=0),me(h.y)||(h.y=0)});var f=Ae(u,function(h){return!h.hidden}),d=Et(f);M(u,function(h){Xe(h)&&(h.waypoints=Zt(h.waypoints,function(m){return{x:m.x-d.x-d.width/2,y:m.y-d.y-d.height/2}})),D(h,{x:h.x-d.x-d.width/2,y:h.y-d.y-d.height/2})}),t.init(c,Ig,{cursor:"grabbing",autoActivate:!0,data:{shape:p,elements:u,context:l}})}}}Lg.$inject=["canvas","dragging","eventBus","modeling","rules"];function Ng(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 Bg(e){return e&&e.length===1&&!Xe(e[0])}var ZC=750;function $g(e,t,n,i,r){function o(a){var s=ce("g");ne(s,r.cls("djs-drag-group",["no-events"]));var c=ce("g");return a.forEach(function(u){var l;u.hidden||(u.waypoints?(l=n._createContainer("connection",c),n.drawConnection(Cr(l),u)):(l=n._createContainer("shape",c),n.drawShape(Cr(l),u),Wt(l,u.x,u.y)),i.addDragger(u,s,l))}),s}t.on("create.move",ZC,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(),ye(p,l)),Wt(l,a.x,a.y)):Dt(l)}),t.on("create.cleanup",function(a){var s=a.context,c=s.dragGroup;c&&Dt(c)})}$g.$inject=["canvas","eventBus","graphicsFactory","previewSupport","styles"];const Xs={__depends__:[Pi,go,fi,zn],__init__:["create","createPreview"],create:["type",Lg],createPreview:["type",$g]};function sp(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)})}sp.$inject=["eventBus"],sp.prototype.getLastMoveEvent=function(){return this._lastMoveEvent||QC(0,0)};function QC(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 ra={__init__:["mouse"],mouse:["type",sp]};var jg=2e3;function wn(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),JC(l)&&(u.priority=2,u.host=l.host.id),Xe(l)&&(u.priority=3,u.source=l.source.id,u.target=l.target.id,u.waypoints=eP(l)),Ee(l)&&(u.priority=4,u.labelTarget=l.labelTarget.id),M(["x","y","width","height"],function(f){me(l[f])&&(u[f]=l[f])}),u.hidden=l.hidden,u.collapsed=l.collapsed}),r.on("copyPaste.elementsCopied",jg,function(c){var u;((u=c.hints)==null?void 0:u.clip)!==!1&&n.set(c.tree)}),r.on("copyPaste.pasteElements",jg,function(c){c.tree||(c.tree=n.get())}),r.on("copyPaste.pasteElements",function(c){var u=c.hints;D(u,{createElementsBehavior:!1})})}wn.$inject=["canvas","create","clipboard","elementFactory","eventBus","modeling","mouse","rules"],wn.prototype.copy=function(e,t={}){var n,i;return pe(e)||(e=e?[e]:[]),n=this._eventBus.fire("copyPaste.canCopyElements",{elements:e}),n===!1?i={}:i=this.createTree(pe(n)?n:e),this._eventBus.fire("copyPaste.elementsCopied",{elements:e,tree:i,hints:t}),i},wn.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})}}},wn.prototype.duplicate=function(e,t={}){var n=this.copy(e,{clip:!1});return this.paste({...t,tree:n})},wn.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},wn.prototype._getElementIdsFromTree=function(e){var t={};return M(e,function(n){M(n,function(i){i.id&&(t[i.id]=!0)})}),t},wn.prototype._paste=function(e,t,n,i){M(e,function(o){me(o.x)||(o.x=0),me(o.y)||(o.y=0)});var r=Et(e);return M(e,function(o){Xe(o)&&(o.waypoints=Zt(o.waypoints,function(a){return{x:a.x-r.x-r.width/2,y:a.y-r.y-r.height/2}})),D(o,{x:o.x-r.x-r.width/2,y:o.y-r.y-r.height/2})}),this._modeling.createElements(e,n,t,D({},i))},wn.prototype._createElements=function(e){var t=this,n=this._eventBus,i={},r=[];return M(e,function(o,a){o=ei(o,"priority"),M(o,function(s){var c=D({},ti(s,["priority"]));i[s.parent]?c.parent=i[s.parent]:delete c.parent,n.fire("copyPaste.pasteElement",{cache:i,descriptor:c});var u;if(Xe(c)){c.source=i[s.source],c.target=i[s.target],u=i[s.id]=t.createConnection(c),r.push(u);return}if(Ee(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},wn.prototype.createConnection=function(e){var t=this._elementFactory.createConnection(ti(e,["id"]));return t},wn.prototype.createLabel=function(e){var t=this._elementFactory.createLabel(ti(e,["id"]));return t},wn.prototype.createShape=function(e){var t=this._elementFactory.createShape(ti(e,["id"]));return t},wn.prototype.hasRelations=function(e,t,n){return n||(n=new Set(t)),!(Xe(e)&&(!n.has(e.source)||!n.has(e.target))||Ee(e)&&!n.has(e.labelTarget))},wn.prototype.createTree=function(e){var t=this._rules,n=this,i={},r=[],o=new Map,a=cs(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}Rr(a,function(p,f,d){if(Ee(p))return;M(p.labels,function(g){c(g,d)});function h(g){g&&g.length&&M(g,function(S){M(S.labels,function(E){c(E,d)}),c(S,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=Zt(r,function(p){return p.element});var l=new Set(e);return r=Zt(r,function(p){return p.descriptor={},n._eventBus.fire("copyPaste.copyElement",{descriptor:p.descriptor,element:p.element,elements:e,elementsSet:l}),p}),r=ei(r,function(p){return p.descriptor.priority}),e=Zt(r,function(p){return p.element}),M(r,function(p){var f=p.depth;if(!n.hasRelations(p.element,e,l)){Hg(p.element,e),l.delete(p.element);return}if(!s(p.element,e)){Hg(p.element,e),l.delete(p.element);return}i[f]||(i[f]=[]),i[f].push(p.descriptor)}),i};function JC(e){return!!e.host}function eP(e){return Zt(e.waypoints,function(t){return t=Fg(t),t.original&&(t.original=Fg(t.original)),t})}function Fg(e){return D({},e)}function Hg(e,t){var n=t.indexOf(e);return n===-1?t:t.splice(n,1)}const tP={__depends__:[xC,Xs,ra,fi],__init__:["copyPaste"],copyPaste:["type",wn]};function cp(e,t,n){pe(n)||(n=[n]),M(n,function(i){vr(e[i])||(t[i]=e[i])})}var up=750;function zg(e,t,n){function i(c,u){var l=e.create(c.$type);return n.copyElement(c,l,null,u)}t.on("copyPaste.copyElement",up,function(c){var u=c.descriptor,l=c.element,p=q(l);if(Ee(l))return u;var f=u.businessObject=i(p,!0),d=u.di=i(Ie(l),!0);d.bpmnElement=f,cp(f,u,"name"),cp(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=q(c);return c.default&&(l[c.default]={element:p,property:"default"}),c.host&&(q(c).attachedToRef=q(u[c.host])),ti(l,yn(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(Ee(l)){l.businessObject=q(u[l.labelTarget]),l.di=Ie(u[l.labelTarget]);return}p=l.businessObject=i(p),f=l.di=i(f),f.bpmnElement=p,cp(l,p,["isExpanded","name"]),l.type=p.$type}),t.on("copyPaste.copyElement",up,function(c){var u=c.descriptor,l=c.element;if(y(l,"bpmn:Participant")){var p=q(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;y(u,"bpmn:SubProcess")&&M(Wo(l),p=>{l.push(p.annotation)})}),t.on("copyPaste.pasteElement",up,function(c){var u=c.cache,l=c.descriptor;a(u,s(l,u,o(u)))})}zg.$inject=["bpmnFactory","eventBus","moddleCopy"];const nP=["artifacts","dataInputAssociations","dataOutputAssociations","default","flowElements","lanes","incoming","outgoing","categoryValue"],iP=["errorRef","escalationRef","messageRef","signalRef","dataObjectRef"];function oa(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 ei(r,o=>o==="extensionElements")}),e.on("moddleCopy.canCopyProperty",i=>{const{parent:r,property:o,propertyName:a}=i,s=Nt(r)&&r.$descriptor;if(a&&iP.includes(a))return o;if(a&&nP.includes(a)||a&&s&&!et(s.properties,Ur({name:a})))return!1}),e.on("moddleCopy.canSetCopiedProperty",i=>{const{property:r}=i;if(y(r,"bpmn:ExtensionElements")&&(!r.values||!r.values.length))return!1})}oa.$inject=["eventBus","bpmnFactory","moddle"],oa.prototype.copyElement=function(e,t,n,i=!1){n&&!pe(n)&&(n=[n]),n=n||lp(e.$descriptor);const r=this._eventBus.fire("moddleCopy.canCopyProperties",{propertyNames:n,sourceElement:e,targetElement:t,clone:i});return r===!1||(pe(r)&&(n=r),M(n,o=>{let a;vn(e,o)&&(a=e.get(o));const s=this.copyProperty(a,t,o,i);!Mt(s)||this._eventBus.fire("moddleCopy.canSetCopiedProperty",{parent:t,property:s,propertyName:o})===!1||t.set(o,s)})),t},oa.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 Nt(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):pe(e)?yn(e,(a,s)=>{const c=this.copyProperty(s,t,n,i);return c?a.concat(c):a},[]):Nt(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},oa.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 lp(e,t){return yn(e.properties,(n,i)=>t&&i.default?n:n.concat(i.name),[])}const Vg={__depends__:[tP],__init__:["bpmnCopyPaste","moddleCopy"],bpmnCopyPaste:["type",zg],moddleCopy:["type",oa]};var Gg=Math.round;function pp(e,t){this._modeling=e,this._eventBus=t}pp.$inject=["modeling","eventBus"],pp.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=Gg(s+o/2),l=Gg(c+a/2),p=i.replaceShape(e,D({},t,{x:u,y:l,width:o,height:a}),n);return r.fire("replace.end",{element:e,newElement:p,hints:n}),p};function Wg(e,t){t.on("replace.end",500,function(n){const{newElement:i,hints:r={}}=n;r.select!==!1&&e.select(i)})}Wg.$inject=["selection","eventBus"];const rP={__init__:["replace","replaceSelectionBehavior"],replaceSelectionBehavior:["type",Wg],replace:["type",pp]};function oP(e,t,n){pe(n)||(n=[n]),M(n,function(i){vr(e[i])||(t[i]=e[i])})}var aP=["cancelActivity","instantiate","eventGatewayType","triggeredByEvent","isInterrupting"];function sP(e,t){var n=e&&vn(e,"collapsed")?e.collapsed:!Me(e),i;return t&&(vn(t,"collapsed")||vn(t,"isExpanded"))?i=vn(t,"collapsed")?t.collapsed:!t.isExpanded:i=n,n!==i}function Ug(e,t,n,i,r,o){function a(s,c,u){u=u||{};var l=c.type,p=s.businessObject;if(Zs(p)&&(l==="bpmn:SubProcess"||l==="bpmn:AdHocSubProcess")&&sP(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),oP(s.di,d.di,["fill","stroke","background-color","border-color","color"]);var h=lp(p.$descriptor),m=lp(f.$descriptor,!0),g=cP(h,m);D(f,Xn(c,aP));var S=Ae(g,function(x){return x==="eventDefinitions"?qg(s,c.eventDefinitionType):x==="loopCharacteristics"?!nn(f):vn(f,x)||x==="processRef"&&c.isExpanded===!1||x==="triggeredByEvent"?!1:x==="isForCompensation"?!nn(f):!0});if(f=n.copyElement(p,f,S),c.eventDefinitionType&&(qg(f,c.eventDefinitionType)||(d.eventDefinitionType=c.eventDefinitionType,d.eventDefinitionAttrs=c.eventDefinitionAttrs)),y(p,"bpmn:Activity")){if(Zs(p))d.isExpanded=Me(s);else if(c&&vn(c,"isExpanded")){d.isExpanded=c.isExpanded;var E=t.getDefaultSize(f,{isExpanded:d.isExpanded});d.width=E.width,d.height=E.height,d.x=s.x-(d.width-s.width)/2,d.y=s.y-(d.height-s.height)/2}Me(s)&&!y(p,"bpmn:Task")&&d.isExpanded&&(d.width=s.width,d.height=s.height)}if(Zs(p)&&!Zs(f)&&(u.moveChildren=!1),y(p,"bpmn:Participant")){c.isExpanded===!0?f.processRef=e.create("bpmn:Process"):u.moveChildren=!1;var b=jt(s);Ie(s).isHorizontal||(Ie(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,Se(p,["bpmn:ExclusiveGateway","bpmn:InclusiveGateway","bpmn:Activity"])&&Se(f,["bpmn:ExclusiveGateway","bpmn:InclusiveGateway","bpmn:Activity"])&&(f.default=p.default),c.host&&!y(p,"bpmn:BoundaryEvent")&&y(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}Ug.$inject=["bpmnFactory","elementFactory","moddleCopy","modeling","replace","rules"];function Zs(e){return y(e,"bpmn:SubProcess")}function qg(e,t){var n=q(e);return t&&n.get("eventDefinitions").some(function(i){return y(i,t)})}function cP(e,t){return e.filter(function(n){return t.includes(n)})}const Yg={__depends__:[Vg,rP,zn],bpmnReplace:["type",Ug]};var uP=250;function Dr(e){this._eventBus=e,this._tools=[],this._active=null}Dr.$inject=["eventBus"],Dr.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)},Dr.prototype.isActive=function(e){return e&&this._active===e},Dr.prototype.length=function(e){return this._tools.length},Dr.prototype.setActive=function(e){var t=this._eventBus;this._active!==e&&(this._active=e,t.fire("tool-manager.update",{tool:e}))},Dr.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,uP,function(r){this._active&&(lP(r)||this.setActive(null))},this)};function lP(e){var t=e.originalEvent&&e.originalEvent.target;return t&&wr(t,'.group[data-group="tools"]')}const Qs={__depends__:[Pi],__init__:["toolManager"],toolManager:["type",Dr]};function pP(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 fP(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 dP(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 fp=Math.abs,hP=Math.round,Ai={x:"width",y:"height"},Kg="crosshair",nr={n:"top",w:"left",s:"bottom",e:"right"},mP=1500,Js={n:"s",w:"e",s:"n",e:"w"},ec=20;function Vn(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",mP,function(c){var u=c.context,l=u.initialized;l||(l=u.initialized=s.init(c,u)),l&&Zg(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){Zg(c);var m={x:0,y:0};m[l]=hP(c["d"+l]),s.makeSpace(f,d,m,p,h),n.once("spaceTool.ended",function(g){s.activateSelection(g.originalEvent,!0,!0)})}})}Vn.$inject=["canvas","dragging","eventBus","modeling","rules","toolManager","mouse"],Vn.prototype.activateSelection=function(e,t,n){this._dragging.init(e,"spaceTool.selection",{autoActivate:t,cursor:Kg,data:{context:{reactivate:n}},trapClick:!1})},Vn.prototype.activateMakeSpace=function(e){this._dragging.init(e,"spaceTool",{autoActivate:!0,cursor:Kg,data:{context:{}}})},Vn.prototype.makeSpace=function(e,t,n,i,r){return this._modeling.createSpace(e,t,n,i,r)},Vn.prototype.init=function(e,t){var n=fp(e.dx)>fp(e.dy)?"x":"y",i=e["d"+n],r=e[n]-i;if(fp(i)<5)return!1;i<0&&(i*=-1),ta(e)&&(i*=-1);var o=pP(n,i),a=this._canvas.getRootElement();!Hs(e)&&e.hover&&(a=e.hover);var s=[...jo(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=gP(c,n,o,r,u);return D(t,c,{axis:n,direction:o,spaceToolConstraints:l,start:r}),Ks("resize-"+(n==="x"?"ew":"ns")),!0},Vn.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||Ee(d))){if(Xe(d)){l.push(d);return}var h=d[t],m=h+d[Ai[t]];if(vP(d)&&(n>0&&fe(d)[t]>i||n<0&&fe(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}},Vn.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateSelection(e,!!e)},Vn.prototype.isActive=function(){var e=this._dragging.context();return e?/^spaceTool/.test(e.prefix):!1};function Xg(e){return{top:e.top-ec,right:e.right+ec,bottom:e.bottom+ec,left:e.left-ec}}function Zg(e){var t=e.context,n=t.spaceToolConstraints;if(n){var i,r;me(n.left)&&(i=Math.max(e.x,n.left),e.dx=e.dx+i-e.x,e.x=i),me(n.right)&&(i=Math.min(e.x,n.right),e.dx=e.dx+i-e.x,e.x=i),me(n.top)&&(r=Math.max(e.y,n.top),e.dy=e.dy+r-e.y,e.y=r),me(n.bottom)&&(r=Math.min(e.y,n.bottom),e.dy=e.dy+r-e.y,e.y=r)}}function gP(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=ue(f),g=Ae(h,function(H){return!Xe(H)&&!Ee(H)&&!l.has(H)&&!p.has(H)}),S=Ae(h,function(H){return!Xe(H)&&!Ee(H)&&l.has(H)}),E,b,x,w=[],T=[],I,P,j,F;g.length&&(b=Xg(ue(Et(g))),E=i-m[nr[n]]+b[nr[n]],n==="n"?s.bottom=u=me(u)?Math.min(u,E):E:n==="w"?s.right=u=me(u)?Math.min(u,E):E:n==="s"?s.top=c=me(c)?Math.max(c,E):E:n==="e"&&(s.left=c=me(c)?Math.max(c,E):E)),S.length&&(x=Xg(ue(Et(S))),E=i-x[nr[Js[n]]]+m[nr[Js[n]]],n==="n"?s.bottom=u=me(u)?Math.min(u,E):E:n==="w"?s.right=u=me(u)?Math.min(u,E):E:n==="s"?s.top=c=me(c)?Math.max(c,E):E:n==="e"&&(s.left=c=me(c)?Math.max(c,E):E)),d&&d.length&&(d.forEach(function(H){l.has(H)?w.push(H):T.push(H)}),w.length&&(I=ue(Et(w.map(fe))),P=m[nr[Js[n]]]-(I[nr[Js[n]]]-i)),T.length&&(j=ue(Et(T.map(fe))),F=j[nr[n]]-(m[nr[n]]-i)),n==="n"?(E=Math.min(P||1/0,F||1/0),s.bottom=u=me(u)?Math.min(u,E):E):n==="w"?(E=Math.min(P||1/0,F||1/0),s.right=u=me(u)?Math.min(u,E):E):n==="s"?(E=Math.max(P||-1/0,F||-1/0),s.top=c=me(c)?Math.max(c,E):E):n==="e"&&(E=Math.max(P||-1/0,F||-1/0),s.left=c=me(c)?Math.max(c,E):E));var L=r&&r[f.id];L&&(n==="n"?(E=i+f[Ai[t]]-L[Ai[t]],s.bottom=u=me(u)?Math.min(u,E):E):n==="w"?(E=i+f[Ai[t]]-L[Ai[t]],s.right=u=me(u)?Math.min(u,E):E):n==="s"?(E=i-f[Ai[t]]+L[Ai[t]],s.top=c=me(c)?Math.max(c,E):E):n==="e"&&(E=i-f[Ai[t]]+L[Ai[t]],s.left=c=me(c)?Math.max(c,E):E))}),s}}function vP(e){return!!e.host}var dp="djs-dragging",Qg="djs-resizing",yP=250,tc=Math.max;function Jg(e,t,n,i,r){function o(a,s){M(a,function(c){r.addDragger(c,s),n.addMarker(c,dp)})}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=ce("g");ne(l,i.cls("djs-crosshair-group",["no-events"])),ye(s,l);var p=ce("path");ne(p,"d",u.x),ke(p).add("djs-crosshair"),ye(l,p);var f=ce("path");ne(f,"d",u.y),ke(f).add("djs-crosshair"),ye(l,f),c.crosshairGroup=l}),e.on("spaceTool.selection.move",function(a){var s=a.context.crosshairGroup;Wt(s,a.x,a.y)}),e.on("spaceTool.selection.cleanup",function(a){var s=a.context,c=s.crosshairGroup;c&&Dt(c)}),e.on("spaceTool.move",yP,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=ce("path"),ne(c,"d","M0,0 L0,0"),ke(c).add("djs-crosshair"),ye(f,c),s.line=c;var d=ce("g");ne(d,i.cls("djs-drag-group",["no-events"])),ye(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(I){m.has(I)||!Xe(I)||!h.has(I.target)||(m.add(I),g.push(I))})}),o(g,d),s.dragGroup=d}if(!s.frameGroup){var S=ce("g");ne(S,i.cls("djs-frame-group",["no-events"])),ye(n.getActiveLayer(),S);var E=[];M(p,function(T){var I=r.addFrame(T,S),P=I.getBBox();E.push({element:I,initialBounds:P}),n.addMarker(T,Qg)}),s.frameGroup=S,s.frames=E}var b={x:"M"+a.x+", -10000 L"+a.x+", 10000",y:"M -10000, "+a.y+" L 10000, "+a.y};ne(c,{d:b[u]});var x={x:"y",y:"x"},w={x:a.dx,y:a.dy};w[x[s.axis]]=0,Wt(s.dragGroup,w.x,w.y),M(s.frames,function(T){var I=T.element,P=T.initialBounds,j,F;s.direction==="e"?ne(I,{width:tc(P.width+w.x,5)}):(j=tc(P.width-w.x,5),ne(I,{width:j,x:P.x+P.width-j})),s.direction==="s"?ne(I,{height:tc(P.height+w.y,5)}):(F=tc(P.height-w.y,5),ne(I,{height:F,y:P.y+P.height-F}))})}}),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,dp)}),M(u,function(h){n.removeMarker(h,dp)}),f&&(Dt(p),Dt(f)),M(l,function(h){n.removeMarker(h,Qg)}),d&&Dt(d)})}Jg.$inject=["eventBus","elementRegistry","canvas","styles","previewSupport"];const _P={__init__:["spaceToolPreview"],__depends__:[Pi,fi,Qs,go,ra],spaceTool:["type",Vn],spaceToolPreview:["type",Jg]};function nc(e,t){e.invoke(Vn,this),this._canvas=t}nc.$inject=["injector","canvas"],te(nc,Vn),nc.prototype.calculateAdjustments=function(e,t,n,i){var r=this._canvas.getRootElement(),o=e[0]===r?null:e[0],a=[];o&&(a=Gr(Zr(r.children.filter(u=>y(u,"bpmn:Artifact")),Et(o))));const s=[...e,...a];var c=Vn.prototype.calculateAdjustments.call(this,s,t,n,i);return c.resizingShapes=c.resizingShapes.filter(function(u){return!(y(u,"bpmn:TextAnnotation")||bP(u)&&(t==="y"&&jt(u)||t==="x"&&!jt(u)))}),c};function bP(e){return y(e,"bpmn:Participant")&&!q(e).processRef}const ev={__depends__:[_P],spaceTool:["type",nc]};function pt(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)}pt.$inject=["eventBus","injector"],pt.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()},pt.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},pt.prototype.clear=function(e){this._stack.length=0,this._stackIdx=-1,e!==!1&&this._fire("changed",{trigger:"clear"})},pt.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()}},pt.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()}},pt.prototype.register=function(e,t){this._setHandler(e,t)},pt.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)},pt.prototype.canUndo=function(){return!!this._getUndoAction()},pt.prototype.canRedo=function(){return!!this._getRedoAction()},pt.prototype._getRedoAction=function(){return this._stack[this._stackIdx+1]},pt.prototype._getUndoAction=function(){return this._stack[this._stackIdx]},pt.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)})},pt.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},pt.prototype._createId=function(){return this._uid++},pt.prototype._atomicDo=function(e){const t=this._currentExecution;t.atomic=!0;try{e()}finally{t.atomic=!1}},pt.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()},pt.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)},pt.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:Of("id",i.reverse())}),i.length=0,this._fire("changed",{trigger:t}),e.trigger=null)},pt.prototype._markDirty=function(e){const t=this._currentExecution;e&&(e=pe(e)?e:[e],t.dirty=t.dirty.concat(e))},pt.prototype._executedAction=function(e,t){const n=++this._stackIdx;t||this._stack.splice(n,this._stack.length,e)},pt.prototype._revertedAction=function(e){this._stackIdx--},pt.prototype._getHandler=function(e){return this._handlerMap[e]},pt.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 xP={commandStack:["type",pt]};function ir(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 EP=250,tv=1400;function hp(e,t,n){U.call(this,t);var i=e.get("movePreview",!1);t.on("shape.move.start",tv,function(r){var o=r.context,a=o.shapes,s=o.validatedShapes;o.shapes=nv(a),o.validatedShapes=nv(s)}),i&&t.on("shape.move.start",EP,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",tv,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;ir(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=qu(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&&(_t(s.labels,a,c),a.labelTarget=s)})}te(hp,U),hp.$inject=["injector","eventBus","modeling"];function nv(e){var t=new Set(e);return Ae(e,function(n){return!t.has(n.labelTarget)})}const wP={__init__:["labelSupport"],labelSupport:["type",hp]};var SP=251,iv=1401,rv="attach-ok";function mp(e,t,n,i,r){U.call(this,t);var o=e.get("movePreview",!1);t.on("shape.move.start",iv,function(a){var s=a.context,c=s.shapes,u=s.validatedShapes;s.shapes=RP(c),s.validatedShapes=CP(u)}),o&&t.on("shape.move.start",SP,function(a){var s=a.context,c=s.shapes,u=gp(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,rv),t.once(["shape.move.out","shape.move.cleanup"],function(){n.removeMarker(l,rv)}))}}),this.preExecuted("elements.move",iv,function(a){var s=a.context,c=s.closure,u=s.shapes,l=gp(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=Ae(c,function(p){var f=p.host;return PP(p)&&!AP(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;ir(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=Em(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=Em(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;ir(s.attachers,function(c){r.removeShape(c)}),s.host&&r.updateAttachment(s,null)})}te(mp,U),mp.$inject=["injector","eventBus","canvas","rules","modeling"];function gp(e){return pu(Zt(e,function(t){return t.attachers||[]}))}function RP(e){var t=gp(e);return vx("id",e,t)}function CP(e){var t=Wr(e,"id");return Ae(e,function(n){for(;n;){if(n.host&&t[n.host.id])return!1;n=n.parent}return!0})}function PP(e){return!!e.host}function AP(e,t){return e.indexOf(t)!==-1}const TP={__depends__:[fi],__init__:["attachSupport"],attachSupport:["type",mp]};function ov(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(Zd(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)})}ov.$inject=["eventBus","canvas","elementRegistry","graphicsFactory"];const vp={__init__:["changeSupport"],changeSupport:["type",ov]};function Gn(e){this._model=e}Gn.$inject=["moddle"],Gn.prototype._needsId=function(e){return Se(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"])},Gn.prototype._ensureId=function(e){if(e.id){this._model.ids.claim(e.id,e);return}var t;y(e,"bpmn:Activity")?t="Activity":y(e,"bpmn:Event")?t="Event":y(e,"bpmn:Gateway")?t="Gateway":Se(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))},Gn.prototype.create=function(e,t){var n=this._model.create(e,t||{});return this._ensureId(n),n},Gn.prototype.createDiLabel=function(){return this.create("bpmndi:BPMNLabel",{bounds:this.createDiBounds()})},Gn.prototype.createDiShape=function(e,t){return this.create("bpmndi:BPMNShape",D({bpmnElement:e,bounds:this.createDiBounds()},t))},Gn.prototype.createDiBounds=function(e){return this.create("dc:Bounds",e)},Gn.prototype.createDiWaypoints=function(e){var t=this;return Zt(e,function(n){return t.createDiWaypoint(n)})},Gn.prototype.createDiWaypoint=function(e){return this.create("dc:Point",Xn(e,["x","y"]))},Gn.prototype.createDiEdge=function(e,t){return this.create("bpmndi:BPMNEdge",D({bpmnElement:e,waypoint:this.createDiWaypoints([])},t))},Gn.prototype.createDiPlane=function(e,t){return this.create("bpmndi:BPMNPlane",D({bpmnElement:e},t))};function Sn(e,t,n){U.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"],Rn(o)),this.reverted(["shape.move","shape.create","shape.delete","connection.create","connection.move","connection.delete"],Rn(a));function s(d){var h=d.context,m=h.oldRoot,g=m.children;M(g,function(S){y(S,"bpmn:BaseElement")&&i.updateParent(S)})}this.executed(["canvas.updateRoot"],s),this.reverted(["canvas.updateRoot"],s);function c(d){var h=d.context.shape;y(h,"bpmn:BaseElement")&&i.updateBounds(h)}this.executed(["shape.move","shape.create","shape.resize"],Rn(function(d){d.context.shape.type!=="label"&&c(d)})),this.reverted(["shape.move","shape.create","shape.resize"],Rn(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"],Rn(u)),this.reverted(["connection.create","connection.move","connection.delete","connection.reconnect"],Rn(u));function l(d){i.updateConnectionWaypoints(d.context.connection)}this.executed(["connection.layout","connection.move","connection.updateWaypoints"],Rn(l)),this.reverted(["connection.layout","connection.move","connection.updateWaypoints"],Rn(l)),this.executed("connection.reconnect",Rn(function(d){var h=d.context,m=h.connection,g=h.oldSource,S=h.newSource,E=q(m),b=q(g),x=q(S);E.conditionExpression&&!Se(x,["bpmn:Activity","bpmn:ExclusiveGateway","bpmn:InclusiveGateway"])&&(h.oldConditionExpression=E.conditionExpression,delete E.conditionExpression),g!==S&&b.default===E&&(h.oldDefault=b.default,delete b.default)})),this.reverted("connection.reconnect",Rn(function(d){var h=d.context,m=h.connection,g=h.oldSource,S=h.newSource,E=q(m),b=q(g),x=q(S);h.oldConditionExpression&&(E.conditionExpression=h.oldConditionExpression),h.oldDefault&&(b.default=h.oldDefault,delete x.default)}));function p(d){i.updateAttachment(d.context)}this.executed(["element.updateAttachment"],Rn(p)),this.reverted(["element.updateAttachment"],Rn(p)),this.executed("element.updateLabel",Rn(f)),this.reverted("element.updateLabel",Rn(f));function f(d){const{element:h}=d.context,m=kn(h),g=Ie(h),S=g&&g.get("label");Xi(h)||zs(h)||(m&&!S?g.set("label",t.create("bpmndi:BPMNLabel")):!m&&S&&g.set("label",void 0))}}te(Sn,U),Sn.$inject=["eventBus","bpmnFactory","connectionDocking"],Sn.prototype.updateAttachment=function(e){var t=e.shape,n=t.businessObject,i=t.host;n.attachedToRef=i&&i.businessObject},Sn.prototype.updateParent=function(e,t){if(!Ee(e)&&!(y(e,"bpmn:DataStoreReference")&&e.parent&&y(e.parent,"bpmn:Collaboration"))){var n=e.parent,i=e.businessObject,r=Ie(e),o=n&&n.businessObject,a=Ie(n);y(e,"bpmn:FlowNode")&&this.updateFlowNodeRefs(i,o,t&&t.businessObject),y(e,"bpmn:DataOutputAssociation")&&(e.source?o=e.source.businessObject:o=null),y(e,"bpmn:DataInputAssociation")&&(e.target?o=e.target.businessObject:o=null),this.updateSemanticParent(i,o),y(e,"bpmn:DataObjectReference")&&i.dataObjectRef&&this.updateSemanticParent(i.dataObjectRef,o),this.updateDiParent(r,a)}},Sn.prototype.updateBounds=function(e){var t=Ie(e),n=kP(e);if(n){var i=Zn(n,t.get("bounds"));D(n,{x:e.x+i.x,y:e.y+i.y})}var r=Ee(e)?this._getLabel(t):t,o=r.bounds;o||(o=this._bpmnFactory.createDiBounds(),r.set("bounds",o)),D(o,{x:e.x,y:e.y,width:e.width,height:e.height})},Sn.prototype.updateFlowNodeRefs=function(e,t,n){if(n!==t){var i,r;y(n,"bpmn:Lane")&&(i=n.get("flowNodeRef"),ht(i,e)),y(t,"bpmn:Lane")&&(r=t.get("flowNodeRef"),_t(r,e))}},Sn.prototype.updateDiConnection=function(e,t,n){var i=Ie(e),r=Ie(t),o=Ie(n);i.sourceElement&&i.sourceElement.bpmnElement!==q(t)&&(i.sourceElement=t&&r),i.targetElement&&i.targetElement.bpmnElement!==q(n)&&(i.targetElement=n&&o)},Sn.prototype.updateDiParent=function(e,t){if(t&&!y(t,"bpmndi:BPMNPlane")&&(t=t.$parent),e.$parent!==t){var n=(t||e.$parent).get("planeElement");t?(n.push(e),e.$parent=t):(ht(n,e),e.$parent=null)}};function MP(e){for(;e&&!y(e,"bpmn:Definitions");)e=e.$parent;return e}Sn.prototype.getLaneSet=function(e){var t,n;return y(e,"bpmn:Lane")?(t=e.childLaneSet,t||(t=this._bpmnFactory.create("bpmn:LaneSet"),e.childLaneSet=t,t.$parent=e),t):(y(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)},Sn.prototype.updateSemanticParent=function(e,t,n){var i;if(e.$parent!==t&&!((y(e,"bpmn:DataInput")||y(e,"bpmn:DataOutput"))&&(y(t,"bpmn:Participant")&&"processRef"in t&&(t=t.processRef),"ioSpecification"in t&&t.ioSpecification===e.$parent))){if(y(e,"bpmn:Lane"))t&&(t=this.getLaneSet(t)),i="lanes";else if(y(e,"bpmn:FlowElement")){if(t){if(y(t,"bpmn:Participant"))t=t.processRef;else if(y(t,"bpmn:Lane"))do t=t.$parent.$parent;while(y(t,"bpmn:Lane"))}i="flowElements"}else if(y(e,"bpmn:Artifact")){for(;t&&!y(t,"bpmn:Process")&&!y(t,"bpmn:SubProcess")&&!y(t,"bpmn:Collaboration");)if(y(t,"bpmn:Participant")){t=t.processRef;break}else t=t.$parent;i="artifacts"}else if(y(e,"bpmn:MessageFlow"))i="messageFlows";else if(y(e,"bpmn:Participant")){i="participants";var r=e.processRef,o;r&&(o=MP(e.$parent||t),e.$parent&&(ht(o.get("rootElements"),r),r.$parent=null),t&&(_t(o.get("rootElements"),r),r.$parent=o))}else y(e,"bpmn:DataOutputAssociation")?i="dataOutputAssociations":y(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),ht(a,e)),t?(a=t.get(i),a.push(e),e.$parent=t):e.$parent=null,n){var s=n.get(i);ht(a,e),t&&(s||(s=[],t.set(i,s)),s.push(e))}}},Sn.prototype.updateConnectionWaypoints=function(e){var t=Ie(e);t.set("waypoint",this._bpmnFactory.createDiWaypoints(e.waypoints))},Sn.prototype.updateConnection=function(e){var t=e.connection,n=q(t),i=t.source,r=q(i),o=t.target,a=q(t.target),s;if(y(n,"bpmn:DataAssociation"))y(n,"bpmn:DataInputAssociation")?(n.get("sourceRef")[0]=r,s=e.parent||e.newParent||a,this.updateSemanticParent(n,a,s)):y(n,"bpmn:DataOutputAssociation")&&(s=e.parent||e.newParent||r,this.updateSemanticParent(n,r,s),n.targetRef=a);else{var c=y(n,"bpmn:SequenceFlow");n.sourceRef!==r&&(c&&(ht(n.sourceRef&&n.sourceRef.get("outgoing"),n),r&&r.get("outgoing")&&r.get("outgoing").push(n)),n.sourceRef=r),n.targetRef!==a&&(c&&(ht(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)},Sn.prototype._getLabel=function(e){return e.label||(e.label=this._bpmnFactory.createDiLabel()),e.label};function Rn(e){return function(t){var n=t.context,i=n.shape||n.connection||n.element;y(i,"bpmn:BaseElement")&&e(t)}}function kP(e){if(y(e,"bpmn:Activity")){var t=Ie(e);if(t){var n=t.get("label");if(n)return n.get("bounds")}}}function rr(e,t){wi.call(this),this._bpmnFactory=e,this._moddle=t}te(rr,wi),rr.$inject=["bpmnFactory","moddle"],rr.prototype._baseCreate=wi.prototype.create,rr.prototype.create=function(e,t){if(e==="label"){var n=t.di||this._bpmnFactory.createDiLabel();return this._baseCreate(e,D({type:"label",di:n},Pr,t))}return this.createElement(e,t)},rr.prototype.createElement=function(e,t){t=D({},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(!OP(r)){var o=D({},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)}y(i,"bpmn:Group")&&(t=D({isFrame:!0},t)),t=DP(i,t,["processRef","isInterrupting","associationDirection","isForCompensation"]),t.isExpanded&&(t=yp(r,t,"isExpanded")),Se(i,["bpmn:Lane","bpmn:Participant"])&&(t=yp(r,t,"isHorizontal")),y(i,"bpmn:SubProcess")&&(t.collapsed=!Me(i,r)),y(i,"bpmn:ExclusiveGateway")&&(vn(r,"isMarkerVisible")?r.isMarkerVisible===void 0&&(r.isMarkerVisible=!1):r.isMarkerVisible=!0),Mt(t.triggeredByEvent)&&(i.triggeredByEvent=t.triggeredByEvent,delete t.triggeredByEvent),Mt(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=D({id:i.id},n,t,{businessObject:i,di:r}),this._baseCreate(e,t)},rr.prototype.getDefaultSize=function(e,t){var n=q(e);if(t=t||Ie(e),y(n,"bpmn:SubProcess"))return Me(n,t)?{width:350,height:200}:{width:100,height:80};if(y(n,"bpmn:Task"))return{width:100,height:80};if(y(n,"bpmn:Gateway"))return{width:50,height:50};if(y(n,"bpmn:Event"))return{width:36,height:36};if(y(n,"bpmn:Participant")){var i=t.isHorizontal===void 0||t.isHorizontal===!0;return Me(n,t)?i?{width:600,height:250}:{width:250,height:600}:i?{width:400,height:60}:{width:60,height:400}}return y(n,"bpmn:Lane")?{width:400,height:100}:y(n,"bpmn:DataObjectReference")?{width:36,height:50}:y(n,"bpmn:DataStoreReference")?{width:50,height:50}:y(n,"bpmn:TextAnnotation")?{width:100,height:40}:y(n,"bpmn:Group")?{width:300,height:300}:{width:100,height:80}},rr.prototype.createParticipantShape=function(e){return Nt(e)||(e={isExpanded:e}),e=D({type:"bpmn:Participant"},e||{}),e.isExpanded!==!1&&(e.processRef=this._bpmnFactory.create("bpmn:Process")),this.createShape(e)};function DP(e,t,n){return M(n,function(i){t=yp(e,t,i)}),t}function yp(e,t,n){return t[n]===void 0?t:(e[n]=t[n],ti(t,[n]))}function OP(e){return Se(e,["bpmndi:BPMNShape","bpmndi:BPMNEdge","bpmndi:BPMNDiagram","bpmndi:BPMNPlane"])}function ic(e,t){this._modeling=e,this._canvas=t}ic.$inject=["modeling","canvas"],ic.prototype.preExecute=function(e){var t=this._modeling,n=e.elements,i=e.alignment;M(n,function(r){var o={x:0,y:0};Mt(i.left)?o.x=i.left-r.x:Mt(i.right)?o.x=i.right-r.width-r.x:Mt(i.center)?o.x=i.center-Math.round(r.width/2)-r.x:Mt(i.top)?o.y=i.top-r.y:Mt(i.bottom)?o.y=i.bottom-r.height-r.y:Mt(i.middle)&&(o.y=i.middle-Math.round(r.height/2)-r.y),t.moveElements([r],o,r.parent)})},ic.prototype.postExecute=function(e){};function rc(e){this._modeling=e}rc.$inject=["modeling"],rc.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},rc.prototype.postExecute=function(e){var t=e.hints||{};IP(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 IP(e,t){return Ni(e.outgoing,function(n){return n.target===t})}function oc(e,t){this._canvas=e,this._layouter=t}oc.$inject=["canvas","layouter"],oc.prototype.execute=function(e){var t=e.connection,n=e.source,i=e.target,r=e.parent,o=e.parentIndex,a=e.hints;if(!n||!i)throw new Error("source and target required");if(!r)throw new Error("parent required");return t.source=n,t.target=i,t.waypoints||(t.waypoints=this._layouter.layoutConnection(t,a)),this._canvas.addConnection(t,r,o),t},oc.prototype.revert=function(e){var t=e.connection;return this._canvas.removeConnection(t),t.source=null,t.target=null,t};var ac=Math.round;function _p(e){this._modeling=e}_p.$inject=["modeling"],_p.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){me(p.x)||(p.x=0),me(p.y)||(p.y=0)});var s=Ae(t,function(p){return!p.hidden}),c=Et(s);M(t,function(p){Xe(p)&&(p.waypoints=Zt(p.waypoints,function(f){return{x:ac(f.x-c.x-c.width/2+r.x),y:ac(f.y-c.y-c.height/2+r.y)}})),D(p,{x:ac(p.x-c.x-c.width/2+r.x),y:ac(p.y-c.y-c.height/2+r.y)})});var u=new Set(cs(t)),l={};M(t,function(p){if(Xe(p)){l[p.id]=me(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=D({},o);u.has(p)||(f.autoResize=!1),Ee(p)&&(f=ti(f,["attach"])),l[p.id]=me(i)?a.createShape(p,Xn(p,["x","y","width","height"]),p.parent||n,i,f):a.createShape(p,Xn(p,["x","y","width","height"]),p.parent||n,f)}),e.elements=Gr(l)};var av=Math.round;function or(e){this._canvas=e}or.$inject=["canvas"],or.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?D(t,n):D(t,{x:n.x-av(t.width/2),y:n.y-av(t.height/2)}),this._canvas.addShape(t,i,r),t},or.prototype.revert=function(e){var t=e.shape;return this._canvas.removeShape(t),t};function aa(e){or.call(this,e)}te(aa,or),aa.$inject=["canvas"];var LP=or.prototype.execute;aa.prototype.execute=function(e){var t=e.shape;return BP(t),t.labelTarget=e.labelTarget,LP.call(this,e)};var NP=or.prototype.revert;aa.prototype.revert=function(e){return e.shape.labelTarget=null,NP.call(this,e)};function BP(e){["width","height"].forEach(function(t){typeof e[t]>"u"&&(e[t]=0)})}function sa(e,t){this._canvas=e,this._modeling=t}sa.$inject=["canvas","modeling"],sa.prototype.preExecute=function(e){var t=this._modeling,n=e.connection;ir(n.incoming,function(i){t.removeConnection(i,{nested:!0})}),ir(n.outgoing,function(i){t.removeConnection(i,{nested:!0})})},sa.prototype.execute=function(e){var t=e.connection,n=t.parent;return e.parent=n,e.parentIndex=qu(n.children,t),e.source=t.source,e.target=t.target,this._canvas.removeConnection(t),t.source=null,t.target=null,t},sa.prototype.revert=function(e){var t=e.connection,n=e.parent,i=e.parentIndex;return t.source=e.source,t.target=e.target,_t(n.children,t,i),this._canvas.addConnection(t,n),t};function bp(e,t){this._modeling=e,this._elementRegistry=t}bp.$inject=["modeling","elementRegistry"],bp.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 ca(e,t){this._canvas=e,this._modeling=t}ca.$inject=["canvas","modeling"],ca.prototype.preExecute=function(e){var t=this._modeling,n=e.shape;ir(n.incoming,function(i){t.removeConnection(i,{nested:!0})}),ir(n.outgoing,function(i){t.removeConnection(i,{nested:!0})}),ir(n.children,function(i){Xe(i)?t.removeConnection(i,{nested:!0}):t.removeShape(i,{nested:!0})})},ca.prototype.execute=function(e){var t=this._canvas,n=e.shape,i=n.parent;return e.oldParent=i,e.oldParentIndex=qu(i.children,n),t.removeShape(n),n},ca.prototype.revert=function(e){var t=this._canvas,n=e.shape,i=e.oldParent,r=e.oldParentIndex;return _t(i.children,n,r),t.addShape(n,i),n};function sc(e){this._modeling=e}sc.$inject=["modeling"];var sv={x:"y",y:"x"};sc.prototype.preExecute=function(e){var t=this._modeling,n=e.groups,i=e.axis,r=e.dimension;function o(g,S){g.range.min=Math.min(S[i],g.range.min),g.range.max=Math.max(S[i]+S[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,S){var E={y:0};E[i]=g-a(S),E[i]&&(E[sv[i]]=0,t.moveElements([S],E,S.parent))}var l=n[0],p=s(n),f=n[p],d,h,m=0;M(n,function(g,S){var E,b,x;if(g.elements.length<2){S&&S!==n.length-1&&(o(g,g.elements[0]),m+=c(g.range));return}E=ei(g.elements,i),b=E[0],S===p&&(b=E[s(E)]),x=a(b),g.range=null,M(E,function(w){if(u(x,w),g.range===null){g.range={min:w[i],max:w[i]+w[r]};return}o(g,w)}),S&&S!==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,S){var E={},b;g===l||g===f||(b=n[S-1],g.range.max=0,M(g.elements,function(x,w){E[sv[i]]=0,E[i]=b.range.max-x[i]+d,g.range.min!==x[i]&&(E[i]+=x[i]-g.range.min),E[i]&&t.moveElements([x],E,x.parent),g.range.max=Math.max(x[i]+x[r],w?g.range.max:0)}))})},sc.prototype.postExecute=function(e){};function cc(e,t){this._layouter=e,this._canvas=t}cc.$inject=["layouter","canvas"],cc.prototype.execute=function(e){var t=e.connection,n=t.waypoints;return D(e,{oldWaypoints:n}),t.waypoints=this._layouter.layoutConnection(t,e.hints),t},cc.prototype.revert=function(e){var t=e.connection;return t.waypoints=e.oldWaypoints,t};function xp(){}xp.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=ht(o.children,t),_t(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},xp.prototype.revert=function(e){var t=e.connection,n=t.parent,i=e.oldParent,r=e.oldParentIndex,o=e.delta;return ht(n.children,t),_t(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 Ep(){this.allShapes={},this.allConnections={},this.enclosedElements={},this.enclosedConnections={},this.topLevel={}}Ep.prototype.add=function(e,t){return this.addAll([e],t)},Ep.prototype.addAll=function(e,t){var n=dw(e,!!t,this);return D(this,n),this};function ua(e){this._modeling=e}ua.prototype.moveRecursive=function(e,t,n){return e?this.moveClosure(this.getClosure(e),t,n):[]},ua.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&&Tl(p,p.source,t),connectionEnd:d&&Ml(p,p.target,t)})})},ua.prototype.getClosure=function(e){return new Ep().addAll(e,!0)};function uc(e){this._helper=new ua(e)}uc.$inject=["modeling"],uc.prototype.preExecute=function(e){e.closure=this._helper.getClosure(e.shapes)},uc.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 Or(e){this._modeling=e,this._helper=new ua(e)}Or.$inject=["modeling"],Or.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=Xn(t,["x","y","width","height"]),e.oldParent=o,e.oldParentIndex=ht(o.children,t),_t(i.children,t,r),D(t,{parent:i,x:t.x+n.x,y:t.y+n.y}),t},Or.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:Ml(o,t,n)})}),M(t.outgoing,function(o){r.layoutConnection(o,{connectionStart:Tl(o,t,n)})})),i.recurse!==!1&&this.moveChildren(e)},Or.prototype.revert=function(e){var t=e.shape,n=e.oldParent,i=e.oldParentIndex,r=e.delta;return _t(n.children,t,i),D(t,{parent:n,x:t.x-r.x,y:t.y-r.y}),t},Or.prototype.moveChildren=function(e){var t=e.delta,n=e.shape;this._helper.moveRecursive(n.children,t,null)},Or.prototype.getNewParent=function(e){return e.newParent||e.shape.parent};function la(e){this._modeling=e}la.$inject=["modeling"],la.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 pe(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},la.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||cv(pe(r)?r[0]:r)),i&&(!n||o.docking==="target")&&(a.connectionEnd=a.connectionEnd||cv(pe(r)?r[r.length-1]:r)),o.newWaypoints&&(a.waypoints=o.newWaypoints),this._modeling.layoutConnection(t,a))},la.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 cv(e){return e.original||e}function Ti(e,t){this._modeling=e,this._rules=t}Ti.$inject=["modeling","rules"],Ti.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,Ns(h,s,l),a)}),M(d,function(h){var m=h.target,g=c(s,m,h);g&&t.reconnectStart(h,s,Ls(h,s,l),a)})},Ti.prototype.postExecute=function(e){var t=e.oldShape;this._modeling.removeShape(t)},Ti.prototype.execute=function(e){},Ti.prototype.revert=function(e){},Ti.prototype.createShape=function(e,t,n,i){return this._modeling.createShape(e,t,n,i)},Ti.prototype.reconnectStart=function(e,t,n,i){this._modeling.reconnectStart(e,t,n,i)},Ti.prototype.reconnectEnd=function(e,t,n,i){this._modeling.reconnectEnd(e,t,n,i)};function pa(e){this._modeling=e}pa.$inject=["modeling"],pa.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},D(t,{width:n.width,height:n.height,x:n.x,y:n.y}),t},pa.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:Ns(o,n,i)})}),M(n.outgoing,function(o){t.layoutConnection(o,{connectionStart:Ls(o,n,i)})}))},pa.prototype.revert=function(e){var t=e.shape,n=e.oldBounds;return D(t,{width:n.width,height:n.height,x:n.x,y:n.y}),t};function ar(e){this._modeling=e}ar.$inject=["modeling"],ar.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]=jP(s)}),this.resizeShapes(r,t,n),this.updateConnectionWaypoints(fP(i,r),t,n,o,i,r,a)},ar.prototype.execute=function(){},ar.prototype.revert=function(){},ar.prototype.moveShapes=function(e,t){var n=this;M(e,function(i){n._modeling.moveShape(i,t,null,{autoResize:!1,layout:!1,recurse:!1})})},ar.prototype.resizeShapes=function(e,t,n){var i=this;M(e,function(r){var o=dP(r,n,t);i._modeling.resizeShape(r,o,null,{attachSupport:!1,autoResize:!1,layout:!1})})},ar.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=$P(l),h=lv(n),m={},g=c.has(p)||u.has(p),S=c.has(f)||u.has(f);g&&S?(d=Zt(d,function(E){return pv(E,i,n)&&(E[h]=E[h]+t[h]),E.original&&pv(E.original,i,n)&&(E.original[h]=E.original[h]+t[h]),E}),s._modeling.updateWaypoints(l,d,{labelBehavior:!1})):(g||S)&&(c.has(p)?m.connectionStart=Tl(l,p,t):c.has(f)?m.connectionEnd=Ml(l,f,t):u.has(p)?m.connectionStart=Ls(l,p,a[p.id]):u.has(f)&&(m.connectionEnd=Ns(l,f,a[f.id])),s._modeling.layoutConnection(l,m))})};function uv(e){return D({},e)}function $P(e){return Zt(e.waypoints,function(t){return t=uv(t),t.original&&(t.original=uv(t.original)),t})}function lv(e){switch(e){case"n":return"y";case"w":return"x";case"s":return"y";case"e":return"x"}}function pv(e,t,n){var i=lv(n);if(/e|s/.test(n))return e[i]>t;if(/n|w/.test(n))return e[i]<t}function jP(e){return{x:e.x,y:e.y,height:e.height,width:e.width}}function lc(e){this._modeling=e}lc.$inject=["modeling"],lc.prototype.execute=function(e){var t=e.shape,n=t.children;e.oldChildrenVisibility=fv(n),t.collapsed=!t.collapsed;var i=dv(n,t.collapsed);return[t].concat(i)},lc.prototype.revert=function(e){var t=e.shape,n=e.oldChildrenVisibility,i=t.children,r=hv(i,n);return t.collapsed=!t.collapsed,[t].concat(r)};function fv(e){var t={};return M(e,function(n){t[n.id]=n.hidden,n.children&&(t=D({},t,fv(n.children)))}),t}function dv(e,t){var n=[];return M(e,function(i){i.hidden=t,n=n.concat(i),i.children&&(n=n.concat(dv(i.children,i.collapsed||t)))}),n}function hv(e,t){var n=[];return M(e,function(i){i.hidden=t[i.id],n=n.concat(i),i.children&&(n=n.concat(hv(i.children,t)))}),n}function pc(e){this._modeling=e}pc.$inject=["modeling"],pc.prototype.execute=function(e){var t=e.shape,n=e.newHost,i=t.host;return e.oldHost=i,e.attacherIdx=mv(i,t),gv(n,t),t.host=n,t},pc.prototype.revert=function(e){var t=e.shape,n=e.newHost,i=e.oldHost,r=e.attacherIdx;return t.host=i,mv(n,t),gv(i,t,r),t};function mv(e,t){return ht(e&&e.attachers,t)}function gv(e,t,n){if(e){var i=e.attachers;i||(e.attachers=i=[]),_t(i,t,n)}}function wp(){}wp.prototype.execute=function(e){var t=e.connection,n=e.newWaypoints;return e.oldWaypoints=t.waypoints,t.waypoints=n,t},wp.prototype.revert=function(e){var t=e.connection,n=e.oldWaypoints;return t.waypoints=n,t};function Ze(e,t,n){this._eventBus=e,this._elementFactory=t,this._commandStack=n;var i=this;e.on("diagram.init",function(){i.registerHandlers(n)})}Ze.$inject=["eventBus","elementFactory","commandStack"],Ze.prototype.getHandlers=function(){return{"shape.append":rc,"shape.create":or,"shape.delete":ca,"shape.move":Or,"shape.resize":pa,"shape.replace":Ti,"shape.toggleCollapse":lc,spaceTool:ar,"label.create":aa,"connection.create":oc,"connection.delete":sa,"connection.move":xp,"connection.layout":cc,"connection.updateWaypoints":wp,"connection.reconnect":la,"elements.create":_p,"elements.move":uc,"elements.delete":bp,"elements.distribute":sc,"elements.align":ic,"element.updateAttachment":pc}},Ze.prototype.registerHandlers=function(e){M(this.getHandlers(),function(t,n){e.registerHandler(n,t)})},Ze.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)},Ze.prototype.updateAttachment=function(e,t){var n={shape:e,newHost:t};this._commandStack.execute("element.updateAttachment",n)},Ze.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)},Ze.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)},Ze.prototype.layoutConnection=function(e,t){var n={connection:e,hints:t||{}};this._commandStack.execute("connection.layout",n)},Ze.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},Ze.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},Ze.prototype.createElements=function(e,t,n,i,r){pe(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},Ze.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},Ze.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},Ze.prototype.removeElements=function(e){var t={elements:e};this._commandStack.execute("elements.delete",t)},Ze.prototype.distributeElements=function(e,t,n){var i={groups:e,axis:t,dimension:n};this._commandStack.execute("elements.distribute",i)},Ze.prototype.removeShape=function(e,t){var n={shape:e,hints:t||{}};this._commandStack.execute("shape.delete",n)},Ze.prototype.removeConnection=function(e,t){var n={connection:e,hints:t||{}};this._commandStack.execute("connection.delete",n)},Ze.prototype.replaceShape=function(e,t,n){var i={oldShape:e,newData:t,hints:n||{}};return this._commandStack.execute("shape.replace",i),i.newShape},Ze.prototype.alignElements=function(e,t){var n={elements:e,alignment:t};this._commandStack.execute("elements.align",n)},Ze.prototype.resizeShape=function(e,t,n,i){var r={shape:e,newBounds:t,minBounds:n,hints:i};this._commandStack.execute("shape.resize",r)},Ze.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)},Ze.prototype.updateWaypoints=function(e,t,n){var i={connection:e,newWaypoints:t,hints:n||{}};this._commandStack.execute("connection.updateWaypoints",i)},Ze.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)},Ze.prototype.reconnectStart=function(e,t,n,i){i||(i={}),this.reconnect(e,t,e.target,n,D(i,{docking:"source"}))},Ze.prototype.reconnectEnd=function(e,t,n,i){i||(i={}),this.reconnect(e,e.source,t,n,D(i,{docking:"target"}))},Ze.prototype.connect=function(e,t,n,i){return this.createConnection(e,t,n||{},e.parent,i)},Ze.prototype._create=function(e,t){return Qw(t)?t:this._elementFactory.create(e,t)},Ze.prototype.toggleCollapse=function(e,t){var n={shape:e,hints:t||{}};this._commandStack.execute("shape.toggleCollapse",n)};function fa(e){this._elementRegistry=e}fa.$inject=["elementRegistry"],fa.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||FP(n,Fa(i));return vv(n,i),e.oldProperties=o,e.changed=r,r},fa.prototype.revert=function(e){var t=e.oldProperties,n=e.moddleElement,i=e.changed;return vv(n,t),i},fa.prototype._getVisualReferences=function(e){var t=this._elementRegistry;return y(e,"bpmn:DataObject")?HP(e,t):[]};function FP(e,t){return yn(t,function(n,i){return n[i]=e.get(i),n},{})}function vv(e,t){M(t,function(n,i){e.set(i,n)})}function HP(e,t){return t.filter(function(n){return y(n,"bpmn:DataObjectReference")&&q(n).dataObjectRef===e})}var da="default",Mi="id",yv="di",zP={width:0,height:0};function ha(e,t,n,i){this._elementRegistry=e,this._moddle=t,this._modeling=n,this._textRenderer=i}ha.$inject=["elementRegistry","moddle","modeling","textRenderer"],ha.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=qP(e.properties),s=e.oldProperties||VP(t,a);return _v(a,o)&&(r.unclaim(o[Mi]),i.updateId(t,a[Mi]),r.claim(a[Mi],o)),da in a&&(a[da]&&n.push(i.get(a[da].id)),o[da]&&n.push(i.get(o[da].id))),bv(t,a),e.oldProperties=s,e.changed=n,n},ha.prototype.postExecute=function(e){var t=e.element,n=t.label,i=n&&q(n).name;if(i){var r=this._textRenderer.getExternalLabelBounds(n,i);this._modeling.resizeShape(n,r,zP)}},ha.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 bv(t,i),_v(n,r)&&(a.unclaim(n[Mi]),o.updateId(t,i[Mi]),a.claim(i[Mi],r)),e.changed};function _v(e,t){return Mi in e&&e[Mi]!==t[Mi]}function VP(e,t){var n=Fa(t),i=e.businessObject,r=Ie(e);return yn(n,function(o,a){return a!==yv?o[a]=i.get(a):o[a]=GP(r,Fa(t.di)),o},{})}function GP(e,t){return yn(t,function(n,i){return n[i]=e&&e.get(i),n},{})}function bv(e,t){var n=e.businessObject,i=Ie(e);M(t,function(r,o){o!==yv?n.set(o,r):i&&WP(i,r)})}function WP(e,t){M(t,function(n,i){e.set(i,n)})}var UP=["default"];function qP(e){var t=D({},e);return UP.forEach(function(n){n in e&&(t[n]=q(t[n]))}),t}function fc(e,t){this._canvas=e,this._modeling=t}fc.$inject=["canvas","modeling"],fc.prototype.execute=function(e){var t=this._canvas,n=e.newRoot,i=n.businessObject,r=t.getRootElement(),o=r.businessObject,a=o.$parent,s=Ie(r);return t.setRootElement(n),t.removeRootElement(r),_t(a.rootElements,i),i.$parent=a,ht(a.rootElements,o),o.$parent=null,r.di=null,s.bpmnElement=i,n.di=s,e.oldRoot=r,[]},fc.prototype.revert=function(e){var t=this._canvas,n=e.newRoot,i=n.businessObject,r=e.oldRoot,o=r.businessObject,a=i.$parent,s=Ie(n);return t.setRootElement(r),t.removeRootElement(n),ht(a.rootElements,i),i.$parent=null,_t(a.rootElements,o),o.$parent=a,n.di=null,s.bpmnElement=o,r.di=s,[]};function Sp(e,t){this._modeling=e,this._spaceTool=t}Sp.$inject=["modeling","spaceTool"],Sp.prototype.preExecute=function(e){var t=this._spaceTool,n=this._modeling,i=e.shape,r=e.location,o=Fn(i),a=o===i,s=a?i:i.parent,c=Qi(s),u=jt(i);if(u?r==="left"?r="top":r==="right"&&(r="bottom"):r==="top"?r="left":r==="bottom"&&(r="right"),!c.length){var l=u?{x:i.x+jn,y:i.y,width:i.width-jn,height:i.height}:{x:i.x,y:i.y+jn,width:i.width,height:i.height-jn};n.createShape({type:"bpmn:Lane",isHorizontal:u},l,s)}var p=[];Rr(o,function(x){return p.push(x),x.label&&p.push(x.label),x===i?[]:Ae(x.children,function(w){return w!==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 S=t.calculateAdjustments(p,g,f,h),E=u?{x:0,y:f}:{x:f,y:0};t.makeSpace(S.movingShapes,S.resizingShapes,E,m,h);var b=u?{x:i.x+(a?jn:0),y:d-(r==="top"?120:0),width:i.width-(a?jn:0),height:120}:{x:d-(r==="left"?120:0),y:i.y+(a?jn:0),width:120,height:i.height-(a?jn:0)};e.newLane=n.createShape({type:"bpmn:Lane",isHorizontal:u},b,s)};function Rp(e){this._modeling=e}Rp.$inject=["modeling"],Rp.prototype.preExecute=function(e){var t=this._modeling,n=e.shape,i=e.count,r=Qi(n),o=r.length;if(o>i)throw new Error(`more than <${i}> child lanes`);var a=jt(n),s=a?n.height:n.width,c=Math.round(s/i),u,l,p,f;for(f=0;f<i;f++)f===i-1?u=s-c*f:u=c,l=a?{x:n.x+jn,y:n.y+f*c,width:n.width-jn,height:u}:{x:n.x+f*c,y:n.y+jn,width:u,height:n.height-jn},f<o?t.resizeShape(r[f],l):(p={type:"bpmn:Lane",isHorizontal:a},t.createShape(p,l,n))};function ma(e,t){this._modeling=e,this._spaceTool=t}ma.$inject=["modeling","spaceTool"],ma.prototype.preExecute=function(e){var t=e.shape,n=e.newBounds,i=e.balanced;i!==!1?this.resizeBalanced(t,n):this.resizeSpace(t,n)},ma.prototype.resizeBalanced=function(e,t){var n=this._modeling,i=HS(e,t);n.resizeShape(e,t),i.forEach(function(r){n.resizeShape(r.shape,r.newBounds)})},ma.prototype.resizeSpace=function(e,t){var n=this._spaceTool,i=ue(e),r=ue(t),o=Qh(r,i),a=Fn(e),s=[],c=[];Rr(a,function(h){return s.push(h),(y(h,"bpmn:Lane")||y(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 ga="flowNodeRef",Cp="lanes";function dc(){}dc.prototype._computeUpdates=function(e,t){var n=[],i=[],r={},o=[];function a(l,p){var f=ue(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=Fn(l);return r[p.id]||(r[p.id]=Ms(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=Fn(l);if(!(!p||n.indexOf(p)!==-1)){var f=p.children.filter(function(d){return y(d,"bpmn:FlowNode")});f.forEach(s),n.push(p)}}),e.forEach(s),o.forEach(function(l){var p=l.businessObject,f=p.get(Cp),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(ga).forEach(function(f){i.push({flowNode:f,remove:[p],add:[]})})}),i},dc.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(Cp);n.remove.forEach(function(o){ht(r,o),ht(o.get(ga),i)}),n.add.forEach(function(o){_t(r,o),_t(o.get(ga),i)})}),[]},dc.prototype.revert=function(e){var t=e.updates;return t.forEach(function(n){var i=n.flowNode,r=i.get(Cp);n.add.forEach(function(o){ht(r,o),ht(o.get(ga),i)}),n.remove.forEach(function(o){_t(r,o),_t(o.get(ga),i)})}),[]};var Pp="categoryValueRef";function va(e,t){this._bpmnFactory=e,this._elementRegistry=t}va.$inject=["bpmnFactory","elementRegistry"],va.prototype._computeUpdates=function(e,t){var n=this._elementRegistry,i=this._bpmnFactory,r=new Map,o=[],a=new Map;function s(E,b,x){if(b){var w=a.get(E);w||(w={},a.set(E,w)),!(x&&w.present)&&(!x&&w.past||(x?w.present={categoryValue:b,root:Ap(E)}:w.past={categoryValue:b}))}}function c(E){r.set(E,q(E))}function u(){n.filter(function(E){return y(E,"bpmn:FlowElement")&&!Ee(E)&&E.parent}).forEach(c)}function l(E){var b=q(E),x=b.get("categoryValueRef");return x||(x=qh(i,b),o.push(YP(E,x))),x}function p(E){return E.reduce(function(b,x){var w=Ap(x),T=b.get(w);return T||(T=[],b.set(w,T)),T.push(x),b},new Map)}e=Array.from(e||[]);var f=p(e);t.length&&u(),e.forEach(c),n.filter(function(E){return y(E,"bpmn:Group")&&!Ee(E)&&E.parent}).forEach(function(E){var b=q(E).get("categoryValueRef");if(!b){var x=Ap(E),w=f.get(x)||[],T=Zr(w,E),I=Object.keys(T).length>0;I&&(b=l(E))}s(E,b,!0)}),t.forEach(function(E){s(E.groupShape,E.categoryValue,!1)}),o.length&&u();var d=Array.from(r.keys()),h=Array.from(a.values()).reduce(function(E,b){return b.present&&E.add(b.present.categoryValue),b.past&&E.add(b.past.categoryValue),E},new Set),m=new Map,g=p(d);a.forEach(function(E,b){var x=E.present;if(x){var w=g.get(x.root)||[],T=Zr(w,b);w.forEach(function(I){if(T[I.id]){var P=m.get(I);P||(P=new Set,m.set(I,P)),P.add(x.categoryValue)}})}});var S=d.reduce(function(E,b){var x=r.get(b),w=x.get(Pp),T=new Set(w),I=m.get(b)||new Set,P=Array.from(I).filter(function(F){return!T.has(F)}),j=w.filter(function(F){return h.has(F)&&!I.has(F)});return(P.length||j.length)&&E.push({businessObject:x,categoryValuesToAdd:P,categoryValuesToRemove:j}),E},[]);return{flowElements:S,groups:o}},va.prototype.execute=function(e){var t=e.updates;return t||(t=e.updates=this._computeUpdates(e.affectedFlowElements,e.affectedGroupEntries)),KP(t.groups),ZP(t.flowElements),[]},va.prototype.revert=function(e){var t=e.updates;return QP(t.flowElements),XP(t.groups),[]};function YP(e,t){return{groupShape:e,categoryValue:t,category:t.$parent}}function KP(e){e.forEach(function(t){q(t.groupShape).categoryValueRef=t.categoryValue,t.categoryValue.$parent=t.category})}function XP(e){e.forEach(function(t){q(t.groupShape).categoryValueRef=null})}function ZP(e){e.forEach(function(t){var n=t.businessObject,i=n.get(Pp);t.categoryValuesToRemove.forEach(function(r){ht(i,r)}),t.categoryValuesToAdd.forEach(function(r){_t(i,r,!0)})})}function QP(e){e.forEach(function(t){var n=t.businessObject,i=n.get(Pp);t.categoryValuesToAdd.forEach(function(r){ht(i,r)}),t.categoryValuesToRemove.forEach(function(r){_t(i,r,!0)})})}function Ap(e){for(;e.parent;)e=e.parent;return e}function hc(e){this._moddle=e}hc.$inject=["moddle"],hc.prototype.execute=function(e){var t=this._moddle.ids,n=e.id,i=e.element,r=e.claiming;return r?t.claim(n,i):t.unclaim(n),[]},hc.prototype.revert=function(e){var t=this._moddle.ids,n=e.id,i=e.element,r=e.claiming;return r?t.unclaim(n):t.claim(n,i),[]};var JP={fill:void 0,stroke:void 0};function Tp(e){this._commandStack=e,this._normalizeColor=function(t){if(t){if(gn(t)){var n=eA(t);if(n)return n}throw new Error(`invalid color value: ${t}`)}}}Tp.$inject=["commandStack"],Tp.prototype.postExecute=function(e){var t=e.elements,n=e.colors||JP,i=this,r={};"fill"in n&&D(r,{"background-color":this._normalizeColor(n.fill)}),"stroke"in n&&D(r,{"border-color":this._normalizeColor(n.stroke)}),M(t,function(o){var a=Xe(o)?Xn(r,["border-color"]):r,s=Ie(o);if(tA(a),Ee(o)){if(!s||!y(s.label,"bpmndi:BPMNLabel"))return;i._commandStack.execute("element.updateModdleProperties",{element:o,moddleElement:s.label,properties:{color:r["border-color"]}})}else{if(!Se(s,["bpmndi:BPMNEdge","bpmndi:BPMNShape"]))return;i._commandStack.execute("element.updateProperties",{element:o,properties:{di:a}})}})};function eA(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 tA(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 xv(e,t,n){function i(c,u){var l=c.label||c,p=c.labelTarget||c;return M1(l,u),[l,p]}function r(c){var u=c.element,l=u.businessObject,p=c.newLabel;if(!Ee(u)&&Xi(u)&&!vs(u)&&!Ev(p)){var f=7,d=Ju(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=kn(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(!(!Ee(l)&&!y(l,"bpmn:TextAnnotation"))){if(Ee(l)&&Ev(p)){d.removeShape!==!1&&e.removeShape(l,{unsetLabel:!1});return}var h=kn(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}xv.$inject=["modeling","textRenderer","bpmnFactory"];function Ev(e){return!e||!e.trim()}function qt(e,t,n,i){Ze.call(this,e,t,n),this._bpmnRules=i}te(qt,Ze),qt.$inject=["eventBus","elementFactory","commandStack","bpmnRules"],qt.prototype.getHandlers=function(){var e=Ze.prototype.getHandlers.call(this);return e["element.updateModdleProperties"]=fa,e["element.updateProperties"]=ha,e["canvas.updateRoot"]=fc,e["lane.add"]=Sp,e["lane.resize"]=ma,e["lane.split"]=Rp,e["lane.updateRefs"]=dc,e["group.updateRefs"]=va,e["id.updateClaim"]=hc,e["element.setColor"]=Tp,e["element.updateLabel"]=xv,e},qt.prototype.updateLabel=function(e,t,n,i){this._commandStack.execute("element.updateLabel",{element:e,newLabel:t,newBounds:n,hints:i||{}})},qt.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)},qt.prototype.updateModdleProperties=function(e,t,n){this._commandStack.execute("element.updateModdleProperties",{element:e,moddleElement:t,properties:n})},qt.prototype.updateProperties=function(e,t){this._commandStack.execute("element.updateProperties",{element:e,properties:t})},qt.prototype.resizeLane=function(e,t,n){this._commandStack.execute("lane.resize",{shape:e,newBounds:t,balanced:n})},qt.prototype.addLane=function(e,t){var n={shape:e,location:t};return this._commandStack.execute("lane.add",n),n.newLane},qt.prototype.splitLane=function(e,t){this._commandStack.execute("lane.split",{shape:e,count:t})},qt.prototype.makeCollaboration=function(){var e=this._create("root",{type:"bpmn:Collaboration"}),t={newRoot:e};return this._commandStack.execute("canvas.updateRoot",t),e},qt.prototype.makeProcess=function(){var e=this._create("root",{type:"bpmn:Process"}),t={newRoot:e};return this._commandStack.execute("canvas.updateRoot",t),e},qt.prototype.updateLaneRefs=function(e,t){this._commandStack.execute("lane.updateRefs",{flowNodeShapes:e,laneShapes:t})},qt.prototype.updateCategoryValueRefs=function(e,t){this._commandStack.execute("group.updateRefs",{affectedFlowElements:e,affectedGroupEntries:t})},qt.prototype.claimId=function(e,t){this._commandStack.execute("id.updateClaim",{id:e,element:t,claiming:!0})},qt.prototype.unclaimId=function(e,t){this._commandStack.execute("id.updateClaim",{id:e,element:t})},qt.prototype.setColor=function(e,t){e.length||(e=[e]),this._commandStack.execute("element.setColor",{elements:e,colors:t})};function wv(){}wv.prototype.layoutConnection=function(e,t){return t=t||{},[t.connectionStart||fe(t.source||e.source),t.connectionEnd||fe(t.target||e.target)]};var mc=20,iA=5,gc=Math.round,Sv=20,rA={"h:h":20,"v:v":20,"h:v":-10,"v:h":-10};function oA(e,t){return!{t:/top/,r:/right/,b:/bottom/,l:/left/,h:/./,v:/./}[t].test(e)}function aA(e,t){return{t:/top/,r:/right/,b:/bottom/,l:/left/,h:/left|right/,v:/top|bottom/}[e].test(t)}function Rv(e,t,n){var i=Gt(t,e,iA),r=n.split(":")[0],o=gc((t.x-e.x)/2+e.x),a=gc((t.y-e.y)/2+e.y),s,c,u=aA(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=oA(i,r),c=l?"h:v":"v:h",p?l?(f=a===e.y,s={x:e.x+mc*(/l/.test(r)?-1:1),y:f?a+mc:a}):(f=o===e.x,s={x:f?o+mc:o,y:e.y+mc*(/t/.test(r)?-1:1)}):s={x:o,y:a}),{waypoints:Mp(e,s,c).concat(s),directions:c,turnNextDirections:f}}function sA(e,t,n){return Rv(e,t,n)}function cA(e,t,n){var i=Rv(t,e,Cv(n));return{waypoints:i.waypoints.slice().reverse(),directions:Cv(i.directions),turnNextDirections:i.turnNextDirections}}function uA(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=Mp(e.waypoints[e.waypoints.length-1],t.waypoints[0],r);return{waypoints:o,directions:r}}function Cv(e){return e.split(":").reverse().join(":")}function lA(e,t,n){var i=gc((t.x-e.x)/2+e.x),r=gc((t.y-e.y)/2+e.y);if(n==="h:v")return[{x:t.x,y:e.y}];if(n==="v:h")return[{x:e.x,y:t.y}];if(n==="h:h")return[{x:i,y:e.y},{x:i,y:t.y}];if(n==="v:v")return[{x:e.x,y:r},{x:t.x,y:r}];throw new Error("invalid directions: can only handle varians of [hv]:[hv]")}function Mp(e,t,n){if(n=n||"h:h",!_A(n))throw new Error("unknown directions: <"+n+">: must be specified as <start>:<end> with start/end in { h,v,t,r,b,l }");if(Av(n)){var i=sA(e,t,n),r=cA(e,t,n),o=uA(i,r);return[].concat(i.waypoints,o.waypoints,r.waypoints)}return lA(e,t,n)}function pA(e,t,n){var i=Mp(e,t,n);return i.unshift(e),i.push(t),Mv(i)}function fA(e,t,n,i,r){var o=r&&r.preferredLayouts||[],a=mx(o,"straight")[0]||"h:h",s=rA[a]||0,c=Gt(e,t,s),u=yA(c,a);n=n||fe(e),i=i||fe(t);var l=u.split(":"),p=Tv(n,e,l[0],bA(c)),f=Tv(i,t,l[1],c);return pA(p,f,u)}function dA(e,t,n,i,r,o){pe(n)&&(r=n,o=i,n=fe(e),i=fe(t)),o=D({preferredLayouts:[]},o),r=r||[];var a=o.preferredLayouts,s=a.indexOf("straight")!==-1,c;return c=s&&mA(e,t,n,i,o),c||(c=o.connectionEnd&&vA(t,e,i,r),c)||(c=o.connectionStart&&gA(e,t,n,r),c)?c:!o.connectionStart&&!o.connectionEnd&&r&&r.length?r:fA(e,t,n,i,o)}function hA(e,t,n){return e>=t&&e<=n}function Pv(e,t,n){var i={x:"width",y:"height"};return hA(t[e],n[e],n[e]+n[i[e]])}function mA(e,t,n,i,r){var o={},a,s;return s=Gt(e,t),/^(top|bottom|left|right)$/.test(s)?(/top|bottom/.test(s)&&(a="x"),/left|right/.test(s)&&(a="y"),r.preserveDocking==="target"?Pv(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:Pv(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 gA(e,t,n,i){return kp(e,t,n,i)}function vA(e,t,n,i){var r=i.slice().reverse();return r=kp(e,t,n,r),r?r.reverse():null}function kp(e,t,n,i){function r(l){return l.length<3?!0:l.length>4?!1:!!et(l,function(p,f){var d=l[f-1];return d&&Ho(p,d)<3})}function o(l,p,f){var d=xi(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(Jd(l[d],p,Sv)||Jd(l[d],f,Sv))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=kp(e,t,n,u)),c&&xi(c)?null:c}function yA(e,t){if(Av(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 _A(e){return e&&/^h|v|t|r|b|l:h|v|t|r|b|l$/.test(e)}function Av(e){return e&&/t|r|b|l/.test(e)}function bA(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 Mv(e){return e.reduce(function(t,n,i){var r=t[t.length-1],o=e[i+1];return Yu(r,o,n,0)||t.push(n),t},[])}var xA=-10,EA=40,wA={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},SA={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},Dp={top:"bottom","top-right":"bottom-left","top-left":"bottom-right",right:"left",bottom:"top","bottom-right":"top-left","bottom-left":"top-right",left:"right"},ya={top:"t",right:"r",bottom:"b",left:"l"};function vc(e){this._elementRegistry=e}te(vc,wv),vc.prototype.layoutConnection=function(e,t){t||(t={});var n=t.source||e.source,i=t.target||e.target,r=t.waypoints||e.waypoints,o=t.connectionStart,a=t.connectionEnd,s=this._elementRegistry,c,u;if(o||(o=kv(r&&r[0],n)),a||(a=kv(r&&r[r.length-1],i)),(y(e,"bpmn:Association")||y(e,"bpmn:DataAssociation"))&&r&&!Dv(n,i))return[].concat([o],r.slice(1,-1),[a]);var l=Vh(n,s)?wA:SA;return y(e,"bpmn:MessageFlow")?c=CA(n,i,l):(y(e,"bpmn:SequenceFlow")||Dv(n,i))&&(n===i?c={preferredLayouts:DA(n,e,l)}:y(n,"bpmn:BoundaryEvent")?c={preferredLayouts:OA(n,i,a,l)}:_a(n)||_a(i)?c={preferredLayouts:l.subProcess,preserveDocking:AA(n)}:y(n,"bpmn:Gateway")?c={preferredLayouts:l.fromGateway}:y(i,"bpmn:Gateway")?c={preferredLayouts:l.toGateway}:c={preferredLayouts:l.default}),c&&(c=D(c,t),u=Mv(dA(n,i,o,a,r,c))),u||[o,a]};function RA(e){var t=e.host;return Gt(fe(e),t,xA)}function CA(e,t,n){return{preferredLayouts:n.messageFlow,preserveDocking:PA(e,t)}}function PA(e,t){return y(t,"bpmn:Participant")?"source":y(e,"bpmn:Participant")?"target":_a(t)?"source":_a(e)||y(t,"bpmn:Event")?"target":y(e,"bpmn:Event")?"source":null}function AA(e){return _a(e)?"target":"source"}function kv(e,t){return e?e.original||e:fe(t)}function Dv(e,t){return y(t,"bpmn:Activity")&&y(e,"bpmn:BoundaryEvent")&&t.businessObject.isForCompensation}function _a(e){return y(e,"bpmn:SubProcess")&&Me(e)}function Ir(e,t){return e===t}function TA(e,t){return t.indexOf(e)!==-1}function vo(e){var t=/right|left/.exec(e);return t&&t[0]}function yo(e){var t=/top|bottom/.exec(e);return t&&t[0]}function Ov(e,t){return Dp[e]===t}function MA(e,t){var n=vo(e),i=Dp[n];return t.indexOf(i)!==-1}function kA(e,t){var n=yo(e),i=Dp[n];return t.indexOf(i)!==-1}function Iv(e){return e==="right"||e==="left"}function DA(e,t,n){var i=t.waypoints,r=i&&i.length&&Gt(i[0],e);return r==="top"?n.loop.fromTop:r==="right"?n.loop.fromRight:r==="left"?n.loop.fromLeft:n.loop.fromBottom}function OA(e,t,n,i){var r=fe(e),o=fe(t),a=RA(e),s,c,u=Ir(e.host,t),l=TA(a,["top","right","bottom","left"]),p=Gt(o,r,{x:e.width/2+t.width/2,y:e.height/2+t.height/2});return u?IA(a,l,e,t,n,i):(s=LA(a,p,l,i.isHorizontal),c=NA(a,p,l,i.isHorizontal),[s+":"+c])}function IA(e,t,n,i,r,o){var a=t?e:o.isHorizontal?yo(e):vo(e),s=ya[a],c;return t?Iv(e)?c=Lv("y",n,i,r)?"h":o.boundaryLoop.alternateHorizontalSide:c=Lv("x",n,i,r)?"v":o.boundaryLoop.alternateVerticalSide:c=o.boundaryLoop.default,[s+":"+c]}function Lv(e,t,n,i){var r=EA;return!(Op(e,i,n,r)||Op(e,i,{x:n.x+n.width,y:n.y+n.height},r)||Op(e,i,fe(t),r))}function Op(e,t,n,i){return Math.abs(t[e]-n[e])<i}function LA(e,t,n,i){if(n)return ya[e];var r=yo(e),o=vo(e),a=yo(t),s=vo(t);if(i){if(Ir(r,a)||Ov(o,s))return ya[r]}else if(Ir(o,s)||Ov(r,a))return ya[o];return ya[i?o:r]}function NA(e,t,n,i){if(n)return Iv(e)?MA(e,t)||Ir(e,t)?"h":"v":kA(e,t)||Ir(e,t)?"v":"h";var r=yo(e),o=vo(e),a=yo(t),s=vo(t);return a&&!s?"v":s&&!a?"h":i?Ir(r,a)?"h":"v":Ir(o,s)?"v":"h"}vc.$inject=["elementRegistry"];function Nv(e){return D({original:e.point.original||e.point},e.actual)}function sr(e,t){this._elementRegistry=e,this._graphicsFactory=t}sr.$inject=["elementRegistry","graphicsFactory"],sr.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(Nv(i)),o.push(Nv(r)),o},sr.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}},sr.prototype._getIntersection=function(e,t,n){var i=this._getShapePath(e),r=this._getConnectionPath(t);return zo(i,r,n)},sr.prototype._getConnectionPath=function(e){return this._graphicsFactory.getConnectionPath(e)},sr.prototype._getShapePath=function(e){return this._graphicsFactory.getShapePath(e)},sr.prototype._getGfx=function(e){return this._elementRegistry.getGraphics(e)};const Ip={__init__:["modeling","bpmnUpdater"],__depends__:[tC,vC,_C,bC,Yg,xP,wP,TP,zn,vp,ev],bpmnFactory:["type",Gn],bpmnUpdater:["type",Sn],elementFactory:["type",rr],modeling:["type",qt],layouter:["type",vc],connectionDocking:["type",sr]};var BA=10,Bv=50,$A=250;function Lp(e,t,n,i){for(var r;r=jA(e,n,t);)n=i(t,n,r);return n}function Np(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 jA(e,t,n){var i={x:t.x-n.width/2,y:t.y-n.height/2,width:n.width,height:n.height},r=HA(e);return et(r,function(o){if(o===n)return!1;var a=Gt(o,i,BA);return a==="intersect"})}function FA(e,t){t||(t={});function n(h){return h.source===e?1:-1}var i=t.defaultDistance||Bv,r=t.direction||"e",o=t.filter,a=t.getWeight||n,s=t.maxDistance||$A,c=t.reference||"start";o||(o=GA);function u(h,m){return r==="n"?c==="start"?ue(h).top-ue(m).bottom:c==="center"?ue(h).top-fe(m).y:ue(h).top-ue(m).top:r==="w"?c==="start"?ue(h).left-ue(m).right:c==="center"?ue(h).left-fe(m).x:ue(h).left-ue(m).left:r==="s"?c==="start"?ue(m).top-ue(h).bottom:c==="center"?fe(m).y-ue(h).bottom:ue(m).bottom-ue(h).bottom:c==="start"?ue(m).left-ue(h).right:c==="center"?fe(m).x-ue(h).right:ue(m).right-ue(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=yn(f,function(h,m){var g=m.distance,S=m.weight;return g<0||g>s||(h[String(g)]||(h[String(g)]=0),h[String(g)]+=1*S,(!h.distance||h[h.distance]<h[String(g)])&&(h.distance=g)),h},{});return d.distance||i}function HA(e){var t=Bp(e);return e.host&&(t=t.concat(Bp(e.host))),e.attachers&&(t=t.concat(e.attachers.reduce(function(n,i){return n.concat(Bp(i))},[]))),t}function Bp(e){return VA(e).concat(zA(e))}function zA(e){return e.incoming.map(function(t){return t.source})}function VA(e){return e.outgoing.map(function(t){return t.target})}function GA(){return!0}var WA=100;function $v(e,t,n){e.on("autoPlace",WA,function(i){var r=i.shape,o=i.source;return UA(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}}$v.$inject=["eventBus","modeling","canvas"];function UA(e,t,n){n||(n={});var i=n.defaultDistance||Bv,r=fe(e),o=ue(e);return{x:o.right+i+t.width/2,y:r.y}}function jv(e,t){e.on("autoPlace.end",500,function(n){t.select(n.shape)})}jv.$inject=["eventBus","selection"];const qA={__init__:["autoPlaceSelectionBehavior"],autoPlace:["type",$v],autoPlaceSelectionBehavior:["type",jv]};function Fv(e,t,n){var i=Vh(e,n);if(y(t,"bpmn:TextAnnotation"))return KA(e,t,i);if(Se(t,["bpmn:DataObjectReference","bpmn:DataStoreReference"]))return XA(e,t,i);if(y(t,"bpmn:FlowNode"))return YA(e,t,i)}function YA(e,t,n){var i=ue(e),r=fe(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=FA(e,{filter:function(d){return y(d,"bpmn:SequenceFlow")},direction:o.directionHint}),s=30,c=o.minDistance,u=o.baseOrientation;y(e,"bpmn:BoundaryEvent")&&(u=Gt(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 Lp(e,t,l,Np(f))}function Hv(e,t,n){return e.includes(n.start)?-1*t:e.includes(n.end)?t:0}function KA(e,t,n){var i=ue(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};Xe(e)&&(r=fe(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 Lp(e,t,r,Np(a))}function XA(e,t,n){var i=ue(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 Lp(e,t,r,Np(a))}function zv(e,t){e.on("autoPlace",function(n){var i=n.shape,r=n.source;return Fv(r,i,t)})}zv.$inject=["eventBus","elementRegistry"];const yc={__depends__:[qA],__init__:["bpmnAutoPlace"],bpmnAutoPlace:["type",zv]},Vv=[Hh,Yo,Ip,yc];function ZA(e={}){Td(globalThis,e.dom);const t=document.createElement("div");return document.body.appendChild(t),new eo({container:t,moddleExtensions:e.moddleExtensions??qa,additionalModules:[...Vv,...e.additionalModules??[]]})}var QA=new mo("ov"),JA=500;function Ht(e,t,n,i){this._eventBus=t,this._canvas=n,this._elementRegistry=i,this._ids=QA,this._overlayDefaults=D({show:null,scale:!0},e&&e.defaults),this._overlays={},this._overlayContainers=[],this._overlayRoot=eT(n.getContainer()),this._init()}Ht.$inject=["config.overlays","eventBus","canvas","elementRegistry"],Ht.prototype.get=function(e){if(gn(e)&&(e={id:e}),gn(e.element)&&(e.element=this._elementRegistry.get(e.element)),e.element){var t=this._getOverlayContainer(e.element,!0);return t?e.type?Ae(t.overlays,Ur({type:e.type})):t.overlays.slice():[]}else return e.type?Ae(this._overlays,Ur({type:e.type})):e.id?this._overlays[e.id]:null},Ht.prototype.add=function(e,t,n){if(Nt(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=D({},this._overlayDefaults,n,{id:i,type:t,element:e,html:n.html}),this._addOverlay(n),i},Ht.prototype.remove=function(e){var t=this.get(e)||[];pe(t)||(t=[t]);var n=this;M(t,function(i){var r=n._getOverlayContainer(i.element,!0);if(i&&(ai(i.html),ai(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)}})},Ht.prototype.isShown=function(){return this._overlayRoot.style.display!=="none"},Ht.prototype.show=function(){_c(this._overlayRoot)},Ht.prototype.hide=function(){_c(this._overlayRoot,!1)},Ht.prototype.clear=function(){this._overlays={},this._overlayContainers=[],ns(this._overlayRoot)},Ht.prototype._updateOverlayContainer=function(e){var t=e.element,n=e.html,i=t.x,r=t.y;if(t.waypoints){var o=Et(t);i=o.x,r=o.y}Gv(n,i,r),en(e.html,"data-container-id",t.id)},Ht.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=Et(i).width:a=i.width,r=t.right*-1+a}if(t.bottom!==void 0){var s;i.waypoints?s=Et(i).height:s=i.height,o=t.bottom*-1+s}Gv(n,r||0,o||0),this._updateOverlayVisibilty(e,this._canvas.viewbox())},Ht.prototype._createOverlayContainer=function(e){var t=nt('<div class="djs-overlays" />');ln(t,{position:"absolute"}),this._overlayRoot.appendChild(t);var n={html:t,element:e,overlays:[]};return this._updateOverlayContainer(n),this._overlayContainers.push(n),n},Ht.prototype._updateRoot=function(e){var t=e.scale||1,n="matrix("+[t,0,0,t,-1*e.x*t,-1*e.y*t].join(",")+")";Wv(this._overlayRoot,n)},Ht.prototype._getOverlayContainer=function(e,t){var n=et(this._overlayContainers,function(i){return i.element===e});return!n&&!t?this._createOverlayContainer(e):n},Ht.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)),gn(i)&&(i=nt(i)),o=this._getOverlayContainer(n),r=nt('<div class="djs-overlay" data-overlay-id="'+t+'">'),ln(r,{position:"absolute"}),r.appendChild(i),e.type&&st(r).add("djs-overlay-"+e.type);var a=this._canvas.findRoot(n),s=this._canvas.getRootElement();_c(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())},Ht.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&&(Mt(r)&&r>t.scale||Mt(o)&&o<t.scale))&&(c=!1),_c(a,c),this._updateOverlayScale(e,t)},Ht.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),Mt(i)&&t.scale<i&&(a=(1/t.scale||1)*i),Mt(r)&&t.scale>r&&(a=(1/t.scale||1)*r)),Mt(a)&&(s="scale("+a+","+a+")"),Wv(o,s)},Ht.prototype._updateOverlaysVisibilty=function(e){var t=this;M(this._overlays,function(n){t._updateOverlayVisibilty(n,e)})},Ht.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){ai(a.html);var s=t._overlayContainers.indexOf(a);s!==-1&&t._overlayContainers.splice(s,1)}}),e.on("element.changed",JA,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&&st(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 eT(e){var t=nt('<div class="djs-overlay-container" />');return ln(t,{position:"absolute",width:0,height:0}),e.insertBefore(t,e.firstChild),t}function Gv(e,t,n){ln(e,{left:t+"px",top:n+"px"})}function _c(e,t){e.style.display=t===!1?"none":""}function Wv(e,t){e.style["transform-origin"]="top left",["","-ms-","-webkit-"].forEach(function(n){e.style[n+"transform"]=t})}const bc={__init__:["overlays"],overlays:["type",Ht]};function $p(e,t){t.invoke(U,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)})}te($p,U),$p.$inject=["canvas","injector"];const tT={__init__:["rootElementsBehavior"],rootElementsBehavior:["type",$p]};function ba(e){return CSS.escape(e)}var nT={"&":"&","<":"<",">":">",'"':""","'":"'"};function Uv(e){return e=""+e,e&&e.replace(/[&<>"']/g,function(t){return nT[t]})}var iT="bjs-breadcrumbs-shown";function qv(e,t,n){var i=nt('<ul class="bjs-breadcrumbs"></ul>'),r=n.getContainer(),o=st(r);r.appendChild(i);var a=[];e.on("element.changed",function(c){var u=c.element,l=q(u),p=et(a,function(f){return f===l});p&&s()});function s(c){c&&(a=rT(c));var u=a.flatMap(function(p){var f=n.findRoot(pi(p))||n.findRoot(p.id);if(!f&&y(p,"bpmn:Process")){var d=t.find(function(g){var S=q(g);return S&&S.get("processRef")===p});f=d&&n.findRoot(d.id)}if(!f)return[];var h=Uv(p.name||p.id),m=nt('<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(iT,l),u.forEach(function(p){i.appendChild(p)})}e.on("root.set",function(c){s(c.element)})}qv.$inject=["eventBus","elementRegistry","canvas"];function rT(e){for(var t=q(e),n=[],i=t;i;i=i.$parent)(y(i,"bpmn:SubProcess")||y(i,"bpmn:Process"))&&n.push(i);return n.reverse()}function Yv(e,t){var n=null,i=new oT;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,!(!y(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})}Yv.$inject=["eventBus","canvas"];function oT(){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 Kv={x:180,y:160};function Lr(e,t){this._eventBus=e,this._moddle=t;var n=this;e.on("import.render.start",1500,function(i,r){n._handleImport(r.definitions)})}Lr.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)})}},Lr.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;y(a,"bpmn:SubProcess")&&!o.isExpanded&&n.push(a),sT(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},Lr.prototype._movePlaneElementsToOrigin=function(e){var t=e.get("planeElement"),n=aT(e),i={x:n.x-Kv.x,y:n.y-Kv.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)})},Lr.prototype._moveToDiPlane=function(e,t){var n=Xv(e),i=n.plane.get("planeElement");i.splice(i.indexOf(e),1),t.get("planeElement").push(e)},Lr.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},Lr.$inject=["eventBus","moddle"];function Xv(e){return y(e,"bpmndi:BPMNDiagram")?e:Xv(e.$parent)}function aT(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=ue(n.bounds);t.top=Math.min(i.top,t.top),t.left=Math.min(i.left,t.left)}}),ps(t)}function sT(e,t){var n=e.$parent;return!(!y(n,"bpmn:SubProcess")||n===t.bpmnElement||Se(e,["bpmn:DataInputAssociation","bpmn:DataOutputAssociation"]))}var xc=250,cT='<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>',uT="bjs-drilldown-empty";function cr(e,t,n,i,r){U.call(this,t),this._canvas=e,this._eventBus=t,this._elementRegistry=n,this._overlays=i,this._translate=r;var o=this;this.executed("shape.toggleCollapse",xc,function(a){var s=a.shape;o._canDrillDown(s)?o._addOverlay(s):o._removeOverlay(s)},!0),this.reverted("shape.toggleCollapse",xc,function(a){var s=a.shape;o._canDrillDown(s)?o._addOverlay(s):o._removeOverlay(s)},!0),this.executed(["shape.create","shape.move","shape.delete"],xc,function(a){var s=a.oldParent,c=a.newParent||a.parent,u=a.shape;o._canDrillDown(u)&&o._addOverlay(u),o._updateDrilldownOverlay(s),o._updateDrilldownOverlay(c),o._updateDrilldownOverlay(u)},!0),this.reverted(["shape.create","shape.move","shape.delete"],xc,function(a){var s=a.oldParent,c=a.newParent||a.parent,u=a.shape;o._canDrillDown(u)&&o._addOverlay(u),o._updateDrilldownOverlay(s),o._updateDrilldownOverlay(c),o._updateDrilldownOverlay(u)},!0),t.on("import.render.complete",function(){n.filter(function(a){return o._canDrillDown(a)}).map(function(a){o._addOverlay(a)})})}te(cr,U),cr.prototype._updateDrilldownOverlay=function(e){var t=this._canvas;if(e){var n=t.findRoot(e);n&&this._updateOverlayVisibility(n)}},cr.prototype._canDrillDown=function(e){var t=this._canvas;return y(e,"bpmn:SubProcess")&&t.findRoot(pi(e))},cr.prototype._updateOverlayVisibility=function(e){var t=this._overlays,n=q(e),i=t.get({element:n.id,type:"drilldown"})[0];if(i){var r=n&&n.get("flowElements")&&n.get("flowElements").length;st(i.html).toggle(uT,!r)}},cr.prototype._addOverlay=function(e){var t=this._canvas,n=this._overlays,i=q(e),r=n.get({element:e,type:"drilldown"});r.length&&this._removeOverlay(e);var o=nt('<button type="button" class="bjs-drilldown">'+cT+"</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(pi(e)))}),n.add(e,"drilldown",{position:{bottom:-7,right:-8},html:o}),this._updateOverlayVisibility(e)},cr.prototype._removeOverlay=function(e){var t=this._overlays;t.remove({element:e,type:"drilldown"})},cr.$inject=["canvas","eventBus","elementRegistry","overlays","translate"];const lT={__depends__:[bc,vp,tT],__init__:["drilldownBreadcrumbs","drilldownOverlayBehavior","drilldownCentering","subprocessCompatibility"],drilldownBreadcrumbs:["type",qv],drilldownCentering:["type",Yv],drilldownOverlayBehavior:["type",cr],subprocessCompatibility:["type",Lr]};function ur(e){lt.call(this,e)}te(ur,lt),ur.prototype._modules=[Hh,lT,bc,zn,Yo],ur.prototype._moddleExtensions={};var Ec="keyboard.keydown",pT="keyboard.keyup",fT=1e3,Zv="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 pn(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(Zv));var i=e&&e.bind!==!1;t.on("canvas.init",function(r){n._target=r.svg,i&&n.bind(),n._fire("init")})}pn.$inject=["config.keyboard","eventBus"],pn.prototype._keydownHandler=function(e){this._keyHandler(e,Ec)},pn.prototype._keyupHandler=function(e){this._keyHandler(e,pT)},pn.prototype._keyHandler=function(e,t){var n;if(!this._isEventIgnored(e)){var i={keyEvent:e};n=this._eventBus.fire(t||Ec,i),n&&e.preventDefault()}},pn.prototype._isEventIgnored=function(e){return!1},pn.prototype.bind=function(e){e&&console.error("unsupported argument <node>",new Error(Zv)),this.unbind(),e=this._node=this._target,ve.bind(e,"keydown",this._keydownHandler),ve.bind(e,"keyup",this._keyupHandler),this._fire("bind")},pn.prototype.getBinding=function(){return this._node},pn.prototype.unbind=function(){var e=this._node;e&&(this._fire("unbind"),ve.unbind(e,"keydown",this._keydownHandler),ve.unbind(e,"keyup",this._keyupHandler)),this._node=null},pn.prototype._fire=function(e){this._eventBus.fire("keyboard."+e,{node:this._node})},pn.prototype.addListener=function(e,t,n){Bt(e)&&(n=t,t=e,e=fT),this._eventBus.on(n||Ec,e,t)},pn.prototype.removeListener=function(e,t){this._eventBus.off(t||Ec,e)},pn.prototype.hasModifier=OC,pn.prototype.isCmd=En,pn.prototype.isShift=ap,pn.prototype.isKey=Ot;var dT=500;function _o(e,t){var n=this;e.on("editorActions.init",dT,function(i){var r=i.editorActions;n.registerBindings(t,r)})}_o.$inject=["eventBus","keyboard"],_o.prototype.registerBindings=function(e,t){function n(i,r){t.isRegistered(i)&&e.addListener(r)}n("undo",function(i){var r=i.keyEvent;if($C(r))return t.trigger("undo"),!0}),n("redo",function(i){var r=i.keyEvent;if(jC(r))return t.trigger("redo"),!0}),n("copy",function(i){var r=i.keyEvent;if(IC(r))return t.trigger("copy"),!0}),n("paste",function(i){var r=i.keyEvent;if(LC(r))return t.trigger("paste"),!0}),n("duplicate",function(i){var r=i.keyEvent;if(NC(r))return t.trigger("duplicate"),!0}),n("cut",function(i){var r=i.keyEvent;if(BC(r))return t.trigger("cut"),!0}),n("stepZoom",function(i){var r=i.keyEvent;if(Ot(["+","Add","="],r)&&En(r))return t.trigger("stepZoom",{value:1}),!0}),n("stepZoom",function(i){var r=i.keyEvent;if(Ot(["-","Subtract"],r)&&En(r))return t.trigger("stepZoom",{value:-1}),!0}),n("zoom",function(i){var r=i.keyEvent;if(Ot("0",r)&&En(r))return t.trigger("zoom",{value:1}),!0}),n("removeSelection",function(i){var r=i.keyEvent;if(Ot(["Backspace","Delete","Del"],r))return t.trigger("removeSelection"),!0})};const jp={__init__:["keyboard","keyboardBindings"],keyboard:["type",pn],keyboardBindings:["type",_o]};var hT={moveSpeed:50,moveSpeedAccelerated:200};function Qv(e,t,n){var i=this;this._config=D({},hT,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})}}Qv.$inject=["config.keyboardMove","keyboard","canvas"];const Jv={__depends__:[jp],__init__:["keyboardMove"],keyboardMove:["type",Qv]};var mT=15;function ey(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=Tr(s),p=Zn(l,c);if(!n.dragging&&gT(p)>mT&&(n.dragging=!0,u===0&&Pg(e),Ks("grab")),n.dragging){var f=n.last||n.start;p=Zn(l,f),t.scroll({dx:p.x,dy:p.y}),n.last=l}s.preventDefault()}function o(s){ve.unbind(document,"mousemove",r),ve.unbind(document,"mouseup",o),n=null,Cg()}function a(s){if(!wr(s.target,".djs-draggable")){var c=s.button;if(!(c>=2||s.ctrlKey||s.shiftKey||s.altKey))return n={button:c,start:Tr(s)},ve.bind(document,"mousemove",r),ve.bind(document,"mouseup",o),!0}}this.isActive=function(){return!!n}}ey.$inject=["eventBus","canvas"];function gT(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}const ty={__init__:["moveCanvas"],moveCanvas:["type",ey]};function ny(e,t){var n=il(e.min),i=il(e.max),r=Math.abs(n)+Math.abs(i);return r/t}function vT(e,t){return Math.max(e.min,Math.min(e.max,t))}var yT=Math.sign||function(e){return e>=0?1:-1},Fp={min:.2,max:4},iy=10,_T=.1,bT=.75;function hi(e,t,n){e=e||{},this._enabled=!1,this._canvas=n,this._container=n._container,this._handleWheel=dn(this._handleWheel,this),this._totalDelta=0,this._scale=e.scale||bT;var i=this;t.on("canvas.mouseover",function(){i._init(e.enabled!==!1)}),t.on("canvas.mouseout",function(){i._init(!1)})}hi.$inject=["config.zoomScroll","eventBus","canvas"],hi.prototype.scroll=function(t){this._canvas.scroll(t)},hi.prototype.reset=function(){this._canvas.zoom("fit-viewport")},hi.prototype.zoom=function(t,n){var i=ny(Fp,iy*2);this._totalDelta+=t,Math.abs(this._totalDelta)>_T&&(this._zoom(t,n,i),this._totalDelta=0)},hi.prototype._handleWheel=function(t){if(this._enabled){var n=this._container;t.preventDefault();var i=t.ctrlKey||Im()&&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))*yT(t.deltaY)*o,this.zoom(a,c)}else r?a={dx:o*t.deltaY,dy:0}:a={dx:o*t.deltaX,dy:o*t.deltaY},this.scroll(a)}},hi.prototype.stepZoom=function(t,n){var i=ny(Fp,iy);this._zoom(t,n,i)},hi.prototype._zoom=function(e,t,n){var i=this._canvas,r=e>0?1:-1,o=il(i.zoom()),a=Math.round(o/n)*n;a+=n*r;var s=Math.pow(10,a);i.zoom(vT(Fp,s),t)},hi.prototype.toggle=function(t){var n=this._container,i=this._handleWheel,r=this._enabled;return typeof t>"u"&&(t=!r),r!==t&&ve[t?"bind":"unbind"](n,"wheel",i,!1),this._enabled=t,t},hi.prototype._init=function(e){this.toggle(e)};const ry={__init__:["zoomScroll"],zoomScroll:["type",hi]};function xa(e){ur.call(this,e)}te(xa,ur),xa.prototype._navigationModules=[Jv,ty,ry],xa.prototype._modules=[].concat(ur.prototype._modules,xa.prototype._navigationModules);function Hp(e){return e&&e[e.length-1]}function oy(e){return e.y}function ay(e){return e.x}var xT={left:ay,center:ay,right:function(e){return e.x+e.width},top:oy,middle:oy,bottom:function(e){return e.y+e.height}};function bo(e,t){this._modeling=e,this._rules=t}bo.$inject=["modeling","rules"],bo.prototype._getOrientationDetails=function(e){var t=["top","bottom","middle"],n="x",i="width";return t.indexOf(e)!==-1&&(n="y",i="height"),{axis:n,dimension:i}},bo.prototype._isType=function(e,t){return t.indexOf(e)!==-1},bo.prototype._alignmentPosition=function(e,t){var n=this._getOrientationDetails(e),i=n.axis,r=n.dimension,o={},a={},s=!1,c,u,l;function 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=Hp(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=ei(a,function(f){return f.elements.length>1&&(s=!0),f.elements.length}),s)return o[e]=Hp(c).center,o;u=t[0],t=ei(t,function(f){return f[i]+f[r]}),l=Hp(t),o[e]=p(u,l)}return o},bo.prototype.trigger=function(e,t){var n=this._modeling,i,r=Ae(e,function(c){return!(c.waypoints||c.host||c.labelTarget)});if(i=this._rules.allowed("elements.align",{elements:r}),pe(i)&&(r=i),!(r.length<2||!i)){var o=xT[t],a=ei(r,o),s=this._alignmentPosition(t,a);n.alignElements(a,s)}};const ET={__init__:["alignElements"],alignElements:["type",bo]},wT=new mo;function xo(e){this._scheduled={},e.on("diagram.destroy",()=>{Object.keys(this._scheduled).forEach(t=>{this.cancel(t)})})}xo.$inject=["eventBus"],xo.prototype.schedule=function(e,t=wT.next()){this.cancel(t);const n=this._schedule(e,t);return this._scheduled[t]=n,n.promise},xo.prototype._schedule=function(e,t){const n=ST();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}},xo.prototype.cancel=function(e){const t=this._scheduled[e];t&&(this._cancel(t),this._scheduled[e]=null)},xo.prototype._cancel=function(e){clearTimeout(e.executionId)};function ST(){const e={};return e.promise=new Promise((t,n)=>{e.resolve=t,e.reject=n}),e}const RT={scheduler:["type",xo]};var CT="djs-element-hidden",wc=".entry",PT=1e3,sy=8,AT=300;function St(e,t,n,i){this._canvas=e,this._elementRegistry=t,this._eventBus=n,this._scheduler=i,this._current=null,this._init()}St.$inject=["canvas","elementRegistry","eventBus","scheduler"],St.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=pe(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=pe(i.target)?i.target:[i.target];r.includes(n)&&e._updateVisibility()}}),this._container=this._createContainer()},St.prototype._createContainer=function(){var e=nt('<div class="djs-context-pad-parent"></div>');return this._canvas.getContainer().appendChild(e),e},St.prototype.registerProvider=function(e,t){t||(t=e,e=PT),this._eventBus.on("contextPad.getProviders",e,function(n){n.providers.push(t)})},St.prototype.getEntries=function(e){var t=this._getProviders(),n=pe(e)?"getMultiElementContextPadEntries":"getContextPadEntries",i={};return M(t,function(r){if(Bt(r[n])){var o=r[n](e);Bt(o)?i=o(i):M(o,function(a,s){i[s]=a})}}),i},St.prototype.trigger=function(e,t,n){var i=this,r,o,a=t.delegateTarget||t.target;if(!a)return t.preventDefault();if(r=en(a,"data-action"),o=t.originalEvent||t,e==="mouseover"){this._timeout=setTimeout(function(){i._mouseout=i.triggerEntry(r,"hover",o,n)},AT);return}else if(e==="mouseout"){clearTimeout(this._timeout),this._mouseout&&(this._mouseout(),this._mouseout=null);return}return this.triggerEntry(r,e,o,n)},St.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(Bt(s)){if(t==="click")return s(n,r,i)}else if(s[t])return s[t](n,r,i);n.preventDefault()}}}},St.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))}},St.prototype._getProviders=function(){var e=this._eventBus.createEvent({type:"contextPad.getProviders",providers:[]});return this._eventBus.fire(e),e.providers},St.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=nt(r.html||'<div class="entry" draggable="true"></div>'),c;en(s,"data-action",o),c=qe("[data-group="+ba(a)+"]",n),c||(c=nt('<div class="group"></div>'),en(c,"data-group",a),n.appendChild(c)),c.appendChild(s),r.className&&TT(s,r.className),r.title&&en(s,"title",r.title),r.imageUrl&&(i=nt("<img>"),en(i,"src",r.imageUrl),i.style.width="100%",i.style.height="100%",s.appendChild(i))}),st(n).add("open"),this._current={entries:t,html:n,target:e},this._updatePosition(),this._updateVisibility(),this._eventBus.fire("contextPad.open",{current:this._current})},St.prototype._createHtml=function(e){var t=this,n=nt('<div class="djs-context-pad"></div>');return _n.bind(n,wc,"click",function(i){t.trigger("click",i)}),_n.bind(n,wc,"dragstart",function(i){t.trigger("dragstart",i)}),_n.bind(n,wc,"mouseover",function(i){t.trigger("mouseover",i)}),_n.bind(n,wc,"mouseout",function(i){t.trigger("mouseout",i)}),ve.bind(n,"mousedown",function(i){i.stopPropagation()}),this._container.appendChild(n),this._eventBus.fire("contextPad.create",{target:e,pad:n}),n},St.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()&&kT(this._current.target,e)?t=this._current.html:t=this._createHtml(e),{html:t}},St.prototype.close=function(){this.isOpen()&&(clearTimeout(this._timeout),this._container.innerHTML="",this._eventBus.fire("contextPad.close",{current:this._current}),this._current=null)},St.prototype.isOpen=function(e){var t=this._current;if(!t)return!1;if(!e)return!0;var n=t.target;return pe(e)!==pe(n)?!1:pe(e)?e.length===n.length&&yr(e,function(i){return n.includes(i)}):n===e},St.prototype.isShown=function(){return this.isOpen()&&st(this._current.html).has("open")},St.prototype.show=function(){this.isOpen()&&(st(this._current.html).add("open"),this._updatePosition(),this._eventBus.fire("contextPad.show",{current:this._current}))},St.prototype.hide=function(){this.isOpen()&&(st(this._current.html).remove("open"),this._eventBus.fire("contextPad.hide",{current:this._current}))},St.prototype._getPosition=function(e){if(!pe(e)&&Xe(e)){var t=this._canvas.viewbox(),n=MT(e),i=n.x*t.scale-t.x*t.scale,r=n.y*t.scale-t.y*t.scale;return{left:i+sy*this._canvas.zoom(),top:r}}var o=this._canvas.getContainer(),a=o.getBoundingClientRect(),s=this._getTargetBounds(e);return{left:s.right-a.left+sy*this._canvas.zoom(),top:s.top-a.top}},St.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")},St.prototype._updateVisibility=function(){const e=()=>{if(this.isOpen()){var t=this,n=this._current.target,i=pe(n)?n:[n],r=i.some(function(o){return t._canvas.hasMarker(o,CT)});r?t.hide():t.show()}};this._scheduler.schedule(e,"ContextPad#_updateVisibility")},St.prototype._getTargetBounds=function(e){var t=this,n=pe(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 TT(e,t){var n=st(e);t=pe(t)?t:t.split(/\s+/g),t.forEach(function(i){n.add(i)})}function MT(e){return e.waypoints[e.waypoints.length-1]}function kT(e,t){return e=pe(e)?e:[e],t=pe(t)?t:[t],e.length===t.length&&yr(e,function(n){return t.includes(n)})}const cy={__depends__:[Ys,RT,bc],contextPad:["type",St]};var Sc,ft,uy,lr,ly,py,fy,zp,Rc,Ea,dy,Vp,Gp,Wp,Cc={},Pc=[],DT=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,Ac=Array.isArray;function ki(e,t){for(var n in t)e[n]=t[n];return e}function Up(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function hy(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?Sc.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 Tc(e,a,i,r,null)}function Tc(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??++uy,__i:-1,__u:0};return r==null&&ft.vnode!=null&&ft.vnode(o),o}function Mc(e){return e.children}function kc(e,t){this.props=e,this.context=t}function Nr(e,t){if(t==null)return e.__?Nr(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"?Nr(e):null}function OT(e){if(e.__P&&e.__d){var t=e.__v,n=t.__e,i=[],r=[],o=ki({},t);o.__v=t.__v+1,ft.vnode&&ft.vnode(o),qp(e.__P,o,t,e.__n,e.__P.namespaceURI,32&t.__u?[n]:null,i,n??Nr(t),!!(32&t.__u),r),o.__v=t.__v,o.__.__k[o.__i]=o,Ey(i,o,r),t.__e=t.__=null,o.__e!=n&&my(o)}}function my(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}),my(e)}function gy(e){(!e.__d&&(e.__d=!0)&&lr.push(e)&&!Dc.__r++||ly!=ft.debounceRendering)&&((ly=ft.debounceRendering)||py)(Dc)}function Dc(){try{for(var e,t=1;lr.length;)lr.length>t&&lr.sort(fy),e=lr.shift(),t=lr.length,OT(e)}finally{lr.length=Dc.__r=0}}function vy(e,t,n,i,r,o,a,s,c,u,l){var p,f,d,h,m,g,S=i&&i.__k||Pc,E=t.length;for(c=IT(n,t,S,c,E),p=0;p<E;p++)(d=n.__k[p])!=null&&(f=d.__i!=-1&&S[d.__i]||Cc,d.__i=p,g=qp(e,d,f,r,o,a,s,c,u,l),h=d.__e,d.ref&&f.ref!=d.ref&&(f.ref&&Yp(f.ref,null,d),l.push(d.ref,d.__c||h,d)),m==null&&h!=null&&(m=h),4&d.__u?(c=yy(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 IT(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]=Tc(null,a,null,null,null):Ac(a)?a=e.__k[o]=Tc(Mc,{children:a},null,null,null):a.constructor===void 0&&a.__b>0?a=e.__k[o]=Tc(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=LT(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=Nr(s)),Sy(s,s));return i}function yy(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=yy(i[r],t,n));return t}e.__e!=t&&(t&&e.type&&!t.parentNode&&(t=Nr(e)),t=n.insertBefore(e.__e,t||null));do t=t&&t.nextSibling;while(t!=null&&t.nodeType==8);return t}function LT(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 _y(e,t,n){t[0]=="-"?e.setProperty(t,n??""):e[t]=n==null?"":typeof n!="number"||DT.test(t)?n:n+"px"}function Oc(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||_y(e.style,t,"");if(n)for(t in n)i&&n[t]==i[t]||_y(e.style,t,n[t])}else if(t[0]=="o"&&t[1]=="n")o=t!=(t=t.replace(dy,"$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[Ea]=i[Ea]:(n[Ea]=Vp,e.addEventListener(t,o?Wp:Gp,o)):e.removeEventListener(t,o?Wp:Gp,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 by(e){return function(t){if(this.l){var n=this.l[t.type+e];if(t[Rc]==null)t[Rc]=Vp++;else if(t[Rc]<n[Ea])return;return n(ft.event?ft.event(t):t)}}}function qp(e,t,n,i,r,o,a,s,c,u){var l,p,f,d,h,m,g,S,E,b,x,w,T,I,P,j,F=t.type;if(t.constructor!==void 0)return null;128&n.__u&&(c=!!(32&n.__u),o=[s=t.__e=n.__e]),(l=ft.__b)&&l(t);e:if(typeof F=="function"){p=a.length;try{if(E=t.props,b=F.prototype&&F.prototype.render,x=(l=F.contextType)&&i[l.__c],w=l?x?x.props.value:l.__:i,n.__c?S=(f=t.__c=n.__c).__=f.__E:(b?t.__c=f=new F(E,w):(t.__c=f=new kc(E,w),f.constructor=F,f.render=BT),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&&F.getDerivedStateFromProps!=null&&(f.__s==f.state&&(f.__s=ki({},f.__s)),ki(f.__s,F.getDerivedStateFromProps(E,f.__s))),h=f.props,m=f.state,f.__v=t,d)b&&F.getDerivedStateFromProps==null&&f.componentWillMount!=null&&f.componentWillMount(),b&&f.componentDidMount!=null&&f.__h.push(f.componentDidMount);else{if(b&&F.getDerivedStateFromProps==null&&E!==h&&f.componentWillReceiveProps!=null&&f.componentWillReceiveProps(E,w),t.__v==n.__v||!f.__e&&f.shouldComponentUpdate!=null&&f.shouldComponentUpdate(E,f.__s,w)===!1){t.__v!=n.__v&&(f.props=E,f.state=f.__s,f.__d=!1),t.__e=n.__e,t.__k=n.__k,t.__k.some(function(L){L&&(L.__=t)}),Pc.push.apply(f.__h,f._sb),f._sb=[],f.__h.length&&a.push(f),s=Nr(n);break e}f.componentWillUpdate!=null&&f.componentWillUpdate(E,f.__s,w),b&&f.componentDidUpdate!=null&&f.__h.push(function(){f.componentDidUpdate(h,m,g)})}if(f.context=w,f.props=E,f.__P=e,f.__e=!1,T=ft.__r,I=0,b)f.state=f.__s,f.__d=!1,T&&T(t),l=f.render(f.props,f.state,f.context),Pc.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&&++I<25);f.state=f.__s,f.getChildContext!=null&&(i=ki(ki({},i),f.getChildContext())),b&&!d&&f.getSnapshotBeforeUpdate!=null&&(g=f.getSnapshotBeforeUpdate(h,m)),P=l!=null&&l.type===Mc&&l.key==null?wy(l.props.children):l,s=vy(e,Ac(P)?P:[P],t,n,i,r,o,a,s,c,u),f.base=t.__e,t.__u&=-161,f.__h.length&&a.push(f),S&&(f.__E=f.__=null)}catch(L){if(a.length=p,t.__v=null,c||o!=null){if(L.then){for(t.__u|=c?160:128;s&&s.nodeType==8&&s.nextSibling;)s=s.nextSibling;o!=null&&(o[o.indexOf(s)]=null),t.__e=s}else if(o!=null)for(j=o.length;j--;)Up(o[j])}else t.__e=n.__e;t.__k==null&&(t.__k=n.__k||[]),L.then||xy(t),ft.__e(L,t,n)}}else o==null&&t.__v==n.__v?(t.__k=n.__k,t.__e=n.__e):s=t.__e=NT(n.__e,t,n,i,r,o,a,c,u);return(l=ft.diffed)&&l(t),128&t.__u?void 0:s}function xy(e){e&&(e.__c&&(e.__c.__e=!0),e.__k&&e.__k.some(xy))}function Ey(e,t,n){for(var i=0;i<n.length;i++)Yp(n[i],n[++i],n[++i]);ft.__c&&ft.__c(t,e),e.some(function(r){try{e=r.__h,r.__h=[],e.some(function(o){o.call(r)})}catch(o){ft.__e(o,r.__v)}})}function wy(e){return typeof e!="object"||e==null||e.__b>0?e:Ac(e)?e.map(wy):e.constructor!==void 0?null:ki({},e)}function NT(e,t,n,i,r,o,a,s,c){var u,l,p,f,d,h,m,g=n.props||Cc,S=t.props,E=t.type;if(E=="svg"?r="http://www.w3.org/2000/svg":E=="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==!!E&&(E?d.localName==E:d.nodeType==3)){e=d,o[u]=null;break}}if(e==null){if(E==null)return document.createTextNode(S);e=document.createElementNS(r,E,S.is&&S),s&&(ft.__m&&ft.__m(t,o),s=!1),o=null}if(E==null)g===S||s&&e.data==S||(e.data=S);else{if(o=E=="textarea"&&S.defaultValue!=null?null:o&&Sc.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 S||u=="value"&&"defaultValue"in S||u=="checked"&&"defaultChecked"in S||Oc(e,u,null,d,r);for(u in S)d=S[u],u=="children"?f=d:u=="dangerouslySetInnerHTML"?l=d:u=="value"?h=d:u=="checked"?m=d:s&&typeof d!="function"||g[u]===d||Oc(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=""),vy(t.type=="template"?e.content:e,Ac(f)?f:[f],t,n,i,E=="foreignObject"?"http://www.w3.org/1999/xhtml":r,o,a,o?o[0]:n.__k&&Nr(n,0),s,c),o!=null)for(u=o.length;u--;)Up(o[u]);s&&E!="textarea"||(u="value",E=="progress"&&h==null?e.removeAttribute("value"):h!=null&&(h!==e[u]||E=="progress"&&!h||E=="option"&&h!=g[u])&&Oc(e,u,h,g[u],r),u="checked",m!=null&&m!=e[u]&&Oc(e,u,m,g[u],r))}return e}function Yp(e,t,n){try{if(typeof e=="function"){var i=typeof e.__u=="function";i&&e.__u(),i&&t==null||(e.__u=e(t))}else e.current=t}catch(r){ft.__e(r,n)}}function Sy(e,t,n){var i,r;if(ft.unmount&&ft.unmount(e),(i=e.ref)&&(i.current&&i.current!=e.__e||Yp(i,null,t)),(i=e.__c)!=null){if(i.componentWillUnmount)try{i.componentWillUnmount()}catch(o){ft.__e(o,t)}i.base=i.__P=i.__n=null}if(i=e.__k)for(r=0;r<i.length;r++)i[r]&&Sy(i[r],t,n||typeof e.type!="function");n||Up(e.__e),e.__c=e.__=e.__e=void 0}function BT(e,t,n){return this.constructor(e,n)}function Ry(e,t,n){var i,r,o,a;t==document&&(t=document.documentElement),ft.__&&ft.__(e,t),r=(i=!1)?null:t.__k,o=[],a=[],qp(t,e=t.__k=hy(Mc,null,[e]),r||Cc,Cc,t.namespaceURI,r?null:t.firstChild?Sc.call(t.childNodes):null,o,r?r.__e:t.firstChild,i,a),Ey(o,e,a),e.props.children=null}Sc=Pc.slice,ft={__e:function(e,t,n,i){for(var r,o,a;t=t.__;)if((r=t.__c)&&!r.__)try{if((o=r.constructor)&&o.getDerivedStateFromError!=null&&(r.setState(o.getDerivedStateFromError(e)),a=r.__d),r.componentDidCatch!=null&&(r.componentDidCatch(e,i||{}),a=r.__d),a)return r.__E=r}catch(s){e=s}throw e}},uy=0,kc.prototype.setState=function(e,t){var n;n=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=ki({},this.state),typeof e=="function"&&(e=e(ki({},n),this.props)),e&&ki(n,e),e!=null&&this.__v&&(t&&this._sb.push(t),gy(this))},kc.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),gy(this))},kc.prototype.render=Mc,lr=[],py=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,fy=function(e,t){return e.__v.__b-t.__v.__b},Dc.__r=0,zp=Math.random().toString(8),Rc="__d"+zp,Ea="__a"+zp,dy=/(PointerCapture)$|Capture$/i,Vp=0,Gp=by(!1),Wp=by(!0);var Cy=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,Cy(e,s,n,["",null])),i.push(r),s[0]?t[0]|=2:(t[o-2]=0,t[o]=r)):i.push(s)}return i},Py=new Map;function $T(e){var t=Py.get(this);return t||(t=new Map,Py.set(this,t)),(t=Cy(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 Qe=$T.bind(hy),Eo,Rt,Kp,Ay,wa=0,Ty=[],It=ft,My=It.__b,ky=It.__r,Dy=It.diffed,Oy=It.__c,Iy=It.unmount,Ly=It.__;function Ic(e,t){It.__h&&It.__h(Rt,e,wa||t),wa=0;var n=Rt.__H||(Rt.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({}),n.__[e]}function Xp(e){return wa=1,jT(By,e)}function jT(e,t,n){var i=Ic(Eo++,2);if(i.t=e,!i.__c&&(i.__=[By(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=Rt,!Rt.__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};Rt.__f=!0;var o=Rt.shouldComponentUpdate,a=Rt.componentWillUpdate;Rt.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)},Rt.shouldComponentUpdate=r}return i.__N||i.__}function Lc(e,t){var n=Ic(Eo++,3);!It.__s&&Jp(n.__H,t)&&(n.__=e,n.u=t,Rt.__H.__h.push(n))}function Zp(e,t){var n=Ic(Eo++,4);!It.__s&&Jp(n.__H,t)&&(n.__=e,n.u=t,Rt.__h.push(n))}function Nc(e){return wa=5,Di(function(){return{current:e}},[])}function Di(e,t){var n=Ic(Eo++,7);return Jp(n.__H,t)&&(n.__=e(),n.__H=t,n.__h=e),n.__}function Sa(e,t){return wa=8,Di(function(){return e},t)}function FT(){for(var e;e=Ty.shift();){var t=e.__H;if(e.__P&&t)try{t.__h.some(Bc),t.__h.some(Qp),t.__h=[]}catch(n){t.__h=[],It.__e(n,e.__v)}}}It.__b=function(e){Rt=null,My&&My(e)},It.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),Ly&&Ly(e,t)},It.__r=function(e){ky&&ky(e),Eo=0;var t=(Rt=e.__c).__H;t&&(Kp===Rt?(t.__h=[],Rt.__h=[],t.__.some(function(n){n.__N&&(n.__=n.__N),n.u=n.__N=void 0})):(t.__h.some(Bc),t.__h.some(Qp),t.__h=[],Eo=0)),Kp=Rt},It.diffed=function(e){Dy&&Dy(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(Ty.push(t)!==1&&Ay===It.requestAnimationFrame||((Ay=It.requestAnimationFrame)||HT)(FT)),t.__H.__.some(function(n){n.u&&(n.__H=n.u,n.u=void 0)})),Kp=Rt=null},It.__c=function(e,t){t.some(function(n){try{n.__h.some(Bc),n.__h=n.__h.filter(function(i){return!i.__||Qp(i)})}catch(i){t.some(function(r){r.__h&&(r.__h=[])}),t=[],It.__e(i,n.__v)}}),Oy&&Oy(e,t)},It.unmount=function(e){Iy&&Iy(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.some(function(i){try{Bc(i)}catch(r){t=r}}),n.__H=void 0,t&&It.__e(t,n.__v))};var Ny=typeof requestAnimationFrame=="function";function HT(e){var t,n=function(){clearTimeout(i),Ny&&cancelAnimationFrame(t),setTimeout(e)},i=setTimeout(n,35);Ny&&(t=requestAnimationFrame(n))}function Bc(e){var t=Rt,n=e.__c;typeof n=="function"&&(e.__c=void 0,n()),Rt=t}function Qp(e){var t=Rt;e.__c=e.__(),Rt=t}function Jp(e,t){return!e||e.length!==t.length||t.some(function(n,i){return n!==e[i]})}function By(e,t){return typeof t=="function"?t(e):t}function zT(e){const{navigationStack:t,setNavigationStack:n}=e,i=Di(()=>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 Qe`
|
|
12
12
|
<div class="djs-popup-breadcrumbs">
|
|
13
|
-
${r&&
|
|
13
|
+
${r&&Qe`
|
|
14
14
|
<button
|
|
15
15
|
type="button"
|
|
16
16
|
class="djs-popup-breadcrumbs-item djs-popup-breadcrumbs-item--back"
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
</svg>
|
|
24
24
|
</button>
|
|
25
25
|
`}
|
|
26
|
-
${i.map((a,s)=>
|
|
26
|
+
${i.map((a,s)=>Qe`
|
|
27
27
|
<button
|
|
28
28
|
key=${s}
|
|
29
29
|
type="button"
|
|
@@ -35,19 +35,19 @@
|
|
|
35
35
|
</button>
|
|
36
36
|
<span class="djs-popup-breadcrumbs-item--separator" aria-hidden="true"></span>
|
|
37
37
|
`)}
|
|
38
|
-
${o&&
|
|
38
|
+
${o&&Qe`
|
|
39
39
|
<span class="djs-popup-breadcrumbs-item djs-popup-breadcrumbs-item--current" title=${o}>
|
|
40
40
|
${o}
|
|
41
41
|
</span>
|
|
42
42
|
`}
|
|
43
43
|
</div>
|
|
44
|
-
`}function $y(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=$y(e[t]))&&(i&&(i+=" "),i+=n)}else for(n in e)e[n]&&(i&&(i+=" "),i+=n);return i}function $c(){for(var e,t,n=0,i="",r=arguments.length;n<r;n++)(e=arguments[n])&&(t=$y(e))&&(i&&(i+=" "),i+=t);return i}function VT(e){const{headerEntries:t,onSelect:n,selectedEntry:i,setSelectedEntry:r,title:o}=e,a=
|
|
44
|
+
`}function $y(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=$y(e[t]))&&(i&&(i+=" "),i+=n)}else for(n in e)e[n]&&(i&&(i+=" "),i+=n);return i}function $c(){for(var e,t,n=0,i="",r=arguments.length;n<r;n++)(e=arguments[n])&&(t=$y(e))&&(i&&(i+=" "),i+=t);return i}function VT(e){const{headerEntries:t,onSelect:n,selectedEntry:i,setSelectedEntry:r,title:o}=e,a=Di(()=>GT(t),[t]),s=u=>u.action&&!u.disabled,c=(u,l)=>{if(s(l))return n(u,l)};return Qe`
|
|
45
45
|
<div class="djs-popup-header">
|
|
46
46
|
<h3 class="djs-popup-title" title=${o}>${o}</h3>
|
|
47
|
-
${a.map(u=>
|
|
47
|
+
${a.map(u=>Qe`
|
|
48
48
|
<ul key=${u.id} class="djs-popup-header-group" data-header-group=${u.id}>
|
|
49
49
|
|
|
50
|
-
${u.entries.map(l=>
|
|
50
|
+
${u.entries.map(l=>Qe`
|
|
51
51
|
<li key=${l.id}>
|
|
52
52
|
<${s(l)?"button":"span"}
|
|
53
53
|
class=${WT(l,l===i)}
|
|
@@ -60,8 +60,8 @@
|
|
|
60
60
|
onFocus=${()=>s(l)&&r(l)}
|
|
61
61
|
onBlur=${()=>s(l)&&r(null)}
|
|
62
62
|
>
|
|
63
|
-
${l.imageUrl&&
|
|
64
|
-
${l.label?
|
|
63
|
+
${l.imageUrl&&Qe`<img class="djs-popup-entry-icon" src=${l.imageUrl} alt="" />`||l.imageHtml&&Qe`<div class="djs-popup-entry-icon" dangerouslySetInnerHTML=${{__html:l.imageHtml}} />`}
|
|
64
|
+
${l.label?Qe`
|
|
65
65
|
<span class="djs-popup-label">${l.label}</span>
|
|
66
66
|
`:null}
|
|
67
67
|
</${l.action?"button":"span"}>
|
|
@@ -70,7 +70,7 @@
|
|
|
70
70
|
</ul>
|
|
71
71
|
`)}
|
|
72
72
|
</div>
|
|
73
|
-
`}function GT(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 WT(e,t){return $c("entry",e.className,e.active?"active":"",e.disabled?"disabled":"",t?"selected":"")}function jy(e,t){return`${e}-entry-${t.id}`}function UT(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
|
|
73
|
+
`}function GT(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 WT(e,t){return $c("entry",e.className,e.active?"active":"",e.disabled?"disabled":"",t?"selected":"")}function jy(e,t){return`${e}-entry-${t.id}`}function UT(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 Qe`
|
|
74
74
|
<li
|
|
75
75
|
class=${$c("entry",{selected:i,disabled:n.disabled})}
|
|
76
76
|
data-id=${n.id}
|
|
@@ -90,15 +90,15 @@
|
|
|
90
90
|
<span
|
|
91
91
|
class=${$c("djs-popup-entry-name",n.className)}
|
|
92
92
|
>
|
|
93
|
-
${n.imageUrl&&
|
|
93
|
+
${n.imageUrl&&Qe`<img class="djs-popup-entry-icon" src=${n.imageUrl} alt="" />`||n.imageHtml&&Qe`<div class="djs-popup-entry-icon" dangerouslySetInnerHTML=${{__html:n.imageHtml}} />`}
|
|
94
94
|
|
|
95
|
-
${n.label?
|
|
95
|
+
${n.label?Qe`
|
|
96
96
|
<span class="djs-popup-label">
|
|
97
97
|
${n.label}
|
|
98
98
|
</span>
|
|
99
99
|
`:null}
|
|
100
100
|
|
|
101
|
-
${n.documentationRef&&
|
|
101
|
+
${n.documentationRef&&Qe`
|
|
102
102
|
<a
|
|
103
103
|
class="djs-popup-entry-docs"
|
|
104
104
|
href=${n.documentationRef}
|
|
@@ -115,7 +115,7 @@
|
|
|
115
115
|
</a>
|
|
116
116
|
`}
|
|
117
117
|
</span>
|
|
118
|
-
${n.description&&
|
|
118
|
+
${n.description&&Qe`
|
|
119
119
|
<span
|
|
120
120
|
class="djs-popup-entry-description"
|
|
121
121
|
>
|
|
@@ -123,7 +123,7 @@
|
|
|
123
123
|
</span>
|
|
124
124
|
`}
|
|
125
125
|
</div>
|
|
126
|
-
${n.entries&&
|
|
126
|
+
${n.entries&&Qe`
|
|
127
127
|
<div class="djs-popup-entry-chevron" aria-hidden="true">
|
|
128
128
|
<svg width="12" height="12" viewBox="0 0 12 12" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
129
129
|
<path fill-rule="evenodd" clip-rule="evenodd" d="M3.96967 1.46967C4.26256 1.17678 4.73744 1.17678 5.03033 1.46967L9.03033 5.46967C9.32322 5.76256 9.32322 6.23744 9.03033 6.53033L5.03033 10.5303C4.73744 10.8232 4.26256 10.8232 3.96967 10.5303C3.67678 10.2374 3.67678 9.76256 3.96967 9.46967L7.43934 6L3.96967 2.53033C3.67678 2.23744 3.67678 1.76256 3.96967 1.46967Z" fill="currentColor"/>
|
|
@@ -131,7 +131,7 @@
|
|
|
131
131
|
</div>
|
|
132
132
|
`}
|
|
133
133
|
</li>
|
|
134
|
-
`}function qT(e){const{selectedEntry:t,setSelectedEntry:n,groupedEntries:i,keyboardSelection:r,idPrefix:o,id:a,ariaLabel:s,tabIndex:c,ariaActivedescendant:u,...l}=e,p=Nc();
|
|
134
|
+
`}function qT(e){const{selectedEntry:t,setSelectedEntry:n,groupedEntries:i,keyboardSelection:r,idPrefix:o,id:a,ariaLabel:s,tabIndex:c,ariaActivedescendant:u,...l}=e,p=Nc();Zp(()=>{if(!r||!r.current)return;const m=p.current;if(!m)return;const g=m.querySelector(".selected");g&&YT(g)},[t]);const f=()=>{r.current=!1},d=m=>{r.current||n(m)},h=()=>{r.current||n(null)};return Qe`
|
|
135
135
|
<div
|
|
136
136
|
class="djs-popup-results"
|
|
137
137
|
ref=${p}
|
|
@@ -142,8 +142,8 @@
|
|
|
142
142
|
aria-activedescendant=${u}
|
|
143
143
|
onMouseMove=${f}
|
|
144
144
|
>
|
|
145
|
-
${i.map(m=>
|
|
146
|
-
${m.name&&
|
|
145
|
+
${i.map(m=>Qe`
|
|
146
|
+
${m.name&&Qe`
|
|
147
147
|
<div key=${m.id} id=${Fy(o,m)} class="entry-header" title=${m.name}>
|
|
148
148
|
${m.name}
|
|
149
149
|
</div>
|
|
@@ -154,7 +154,7 @@
|
|
|
154
154
|
role="group"
|
|
155
155
|
aria-labelledby=${m.name?Fy(o,m):void 0}
|
|
156
156
|
>
|
|
157
|
-
${m.entries.map(g=>
|
|
157
|
+
${m.entries.map(g=>Qe`
|
|
158
158
|
<${UT}
|
|
159
159
|
key=${g.id}
|
|
160
160
|
idPrefix=${o}
|
|
@@ -168,7 +168,7 @@
|
|
|
168
168
|
</ul>
|
|
169
169
|
`)}
|
|
170
170
|
</div>
|
|
171
|
-
`}function Fy(e,t){return`${e}-group-${t.id}`}function YT(e){typeof e.scrollIntoViewIfNeeded=="function"?e.scrollIntoViewIfNeeded():e.scrollIntoView({scrollMode:"if-needed",block:"nearest"})}const KT=new
|
|
171
|
+
`}function Fy(e,t){return`${e}-group-${t.id}`}function YT(e){typeof e.scrollIntoViewIfNeeded=="function"?e.scrollIntoViewIfNeeded():e.scrollIntoView({scrollMode:"if-needed",block:"nearest"})}const KT=new mo("djs-popup");function XT(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]=Xp([]);Lc(()=>{g([])},[f]);const[S,E]=Xp(""),b=S.trim().length>0,x=Di(()=>JT(f),[f]),w=Di(()=>Mt(u)?x.length>5:!1,[u,x]),T=Di(()=>{const $=m.length?m[m.length-1].entries:f;return w?b?p(x.filter(({searchable:N})=>N!==!1),S,{keys:["label","search","description"]}).map(({item:N})=>N):$.filter(({rank:N=0})=>N>=0):$},[w,b,x,S,p,m,f]),I=Di(()=>b?T.length?[{id:"default",entries:T}]:[]:eM(T),[T,b]),[P,j]=Xp(T[0]),F=Nc(null),L=Nc(!1),H=Di(()=>KT.next(),[]),oe=`${H}-results`,De=P&&jy(H,P);Lc(()=>{const $=F.current;$&&T.includes($)?j($):j(T[0]),F.current=null},[T]);const ct=Sa($=>{const N=QT(I);let Re=N.indexOf(P)+$;Re<0&&(Re=N.length-1),Re>=N.length&&(Re=0),L.current=!0,j(N[Re])},[I,P]),Y=Sa($=>{$>0&&P&&P.entries&&(L.current=!0,g(N=>[...N,P])),$<0&&m.length>0&&(L.current=!0,F.current=m[m.length+$],g(N=>N.slice(0,$)))},[P,m]),re=Sa(($,N,V)=>{if(!(!N||N.disabled))return N.entries?($.preventDefault(),Y(1)):n($,N,V)},[n,Y]),le=Sa($=>{if($.key==="Enter"&&P){const N=$.target;return!!wr(N,"a, button",!0)||P.disabled?void 0:re($,P)}if($.key==="Backspace"){const N=$.target;if(!(Nu(N,"input")&&N.value!==""))return Y(-1),$.preventDefault()}if($.key==="ArrowUp")return ct(-1),$.preventDefault();if($.key==="ArrowDown")return ct(1),$.preventDefault();if($.key==="ArrowRight")return Y(1),$.preventDefault();if($.key==="ArrowLeft")return Y(-1),$.preventDefault()},[P,ct,Y,re]),ae=Sa($=>{Nu($.target,"input")&&E(()=>$.target.value)},[E]);Lc(()=>(d(),()=>{h()}),[]);const se=!b&&m.length>0,Z=(a||r.length>0)&&!se;return Qe`
|
|
172
172
|
<${Hy}
|
|
173
173
|
onClose=${t}
|
|
174
174
|
onKeyup=${ae}
|
|
@@ -179,7 +179,7 @@
|
|
|
179
179
|
scale=${c}
|
|
180
180
|
navigationStack=${m}
|
|
181
181
|
>
|
|
182
|
-
${Z&&
|
|
182
|
+
${Z&&Qe`
|
|
183
183
|
<${VT}
|
|
184
184
|
headerEntries=${r}
|
|
185
185
|
onSelect=${n}
|
|
@@ -188,16 +188,16 @@
|
|
|
188
188
|
title=${a}
|
|
189
189
|
/>
|
|
190
190
|
`}
|
|
191
|
-
${se&&
|
|
191
|
+
${se&&Qe`
|
|
192
192
|
<${zT}
|
|
193
193
|
navigationStack=${m}
|
|
194
194
|
setNavigationStack=${g}
|
|
195
195
|
/>
|
|
196
196
|
`}
|
|
197
|
-
${f.length>0&&
|
|
197
|
+
${f.length>0&&Qe`
|
|
198
198
|
<div class="djs-popup-body">
|
|
199
199
|
|
|
200
|
-
${w&&
|
|
200
|
+
${w&&Qe`
|
|
201
201
|
<div class="djs-popup-search">
|
|
202
202
|
<svg class="djs-popup-search-icon" width="14" height="14" viewBox="0 0 14 14" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
203
203
|
<path fill-rule="evenodd" clip-rule="evenodd" d="M9.0325 8.5H9.625L13.3675 12.25L12.25 13.3675L8.5 9.625V9.0325L8.2975 8.8225C7.4425 9.5575 6.3325 10 5.125 10C2.4325 10 0.25 7.8175 0.25 5.125C0.25 2.4325 2.4325 0.25 5.125 0.25C7.8175 0.25 10 2.4325 10 5.125C10 6.3325 9.5575 7.4425 8.8225 8.2975L9.0325 8.5ZM1.75 5.125C1.75 6.9925 3.2575 8.5 5.125 8.5C6.9925 8.5 8.5 6.9925 8.5 5.125C8.5 3.2575 6.9925 1.75 5.125 1.75C3.2575 1.75 1.75 3.2575 1.75 5.125Z" fill="#22242A"/>
|
|
@@ -209,13 +209,13 @@
|
|
|
209
209
|
aria-label="${a||"Search"}"
|
|
210
210
|
aria-expanded="true"
|
|
211
211
|
aria-controls=${oe}
|
|
212
|
-
aria-activedescendant=${
|
|
212
|
+
aria-activedescendant=${De||void 0}
|
|
213
213
|
aria-autocomplete="list"
|
|
214
214
|
/>
|
|
215
215
|
</div>
|
|
216
216
|
`}
|
|
217
217
|
|
|
218
|
-
${b&&
|
|
218
|
+
${b&&Qe`
|
|
219
219
|
<div class="djs-popup-search-count" aria-live="polite">
|
|
220
220
|
${T.length} ${T.length===1?"result":"results"} found
|
|
221
221
|
</div>
|
|
@@ -231,10 +231,10 @@
|
|
|
231
231
|
id=${oe}
|
|
232
232
|
ariaLabel=${a||"Results"}
|
|
233
233
|
tabIndex=${w?-1:0}
|
|
234
|
-
ariaActivedescendant=${w?void 0:
|
|
234
|
+
ariaActivedescendant=${w?void 0:De||void 0}
|
|
235
235
|
/>
|
|
236
236
|
|
|
237
|
-
${P&&P.documentationRef&&
|
|
237
|
+
${P&&P.documentationRef&&Qe`
|
|
238
238
|
<div class="djs-popup-footer">
|
|
239
239
|
<a
|
|
240
240
|
class="djs-popup-footer-docs"
|
|
@@ -254,11 +254,11 @@
|
|
|
254
254
|
`}
|
|
255
255
|
</div>
|
|
256
256
|
`}
|
|
257
|
-
${l&&T.length===0&&
|
|
258
|
-
<div class="djs-popup-no-results">${
|
|
257
|
+
${l&&T.length===0&&Qe`
|
|
258
|
+
<div class="djs-popup-no-results">${Bt(l)?l(S):l}</div>
|
|
259
259
|
`}
|
|
260
260
|
</${Hy}>
|
|
261
|
-
`}function Hy(e){const{onClose:t,onKeydown:n,onKeyup:i,className:r,children:o,navigationStack:a,position:s}=e,c=Nc();return
|
|
261
|
+
`}function Hy(e){const{onClose:t,onKeydown:n,onKeyup:i,className:r,children:o,navigationStack:a,position:s}=e,c=Nc();return Zp(()=>{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]),Zp(()=>{const u=c.current;if(!u)return;(u.querySelector("input")||u.querySelector('[role="listbox"]')||u).focus()},[a]),Lc(()=>{const u=p=>{if(p.key==="Escape")return p.preventDefault(),t()},l=p=>{if(!wr(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)}},[]),Qe`
|
|
262
262
|
<div
|
|
263
263
|
class=${$c("djs-popup",r)}
|
|
264
264
|
style=${ZT(e)}
|
|
@@ -269,7 +269,7 @@
|
|
|
269
269
|
>
|
|
270
270
|
${o}
|
|
271
271
|
</div>
|
|
272
|
-
`}function ZT(e){const{width:t}=e,n=typeof t=="number"?`${t}px`:t;return{transform:`scale(${e.scale})`,width:
|
|
272
|
+
`}function ZT(e){const{width:t}=e,n=typeof t=="number"?`${t}px`:t;return{transform:`scale(${e.scale})`,width:Mt(t)?n:void 0,maxWidth:Mt(t)?"unset":void 0,"transform-origin":"top left"}}function QT(e){const t=[];return e.forEach(n=>{n.entries.forEach(i=>{t.push(i)})}),t}function JT(e){const t=[];function n(i){i.forEach(r=>{if(r.entries){n(r.entries);return}t.push(r)})}return n(e),t}function eM(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 tM="data-id",zy=["contextPad.close","canvas.viewbox.changing","commandStack.changed"],nM=1e3;function dt(e,t,n,i){this._eventBus=t,this._canvas=n,this._search=i,this._current=null;var r=Mt(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()})}dt.$inject=["config.popupMenu","eventBus","canvas","search"],dt.prototype._render=function(){const{position:e,providerId:t,entries:n,headerEntries:i,emptyPlaceholder:r,options:o}=this._current,a=Vy(n),s=Object.entries(i).map(([f,d])=>({id:f,...d})),c=e&&(f=>this._ensureVisible(f,e)),u=this._updateScale(this._current.container);Ry(Qe`
|
|
273
273
|
<${XT}
|
|
274
274
|
onClose=${f=>this.close(f)}
|
|
275
275
|
onSelect=${(f,d,h)=>this.trigger(f,d,h)}
|
|
@@ -284,7 +284,7 @@
|
|
|
284
284
|
searchFn=${this._search}
|
|
285
285
|
...${{...o}}
|
|
286
286
|
/>
|
|
287
|
-
`,this._current.container)},
|
|
287
|
+
`,this._current.container)},dt.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()},dt.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()},dt.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)}},dt.prototype.close=function(){this.isOpen()&&(this._emit("close"),this.reset(),this._canvas.restoreFocus(),this._current=null)},dt.prototype.reset=function(){const e=this._current.container;Ry(null,e),ai(e)},dt.prototype._emit=function(e,t){this._eventBus.fire(`popupMenu.${e}`,t)},dt.prototype._onOpened=function(){this._emit("opened")},dt.prototype._onClosed=function(){this._emit("closed")},dt.prototype._createContainer=function(e){var t=this._canvas,n=t.getContainer();const i=nt(`<div class="djs-popup-parent djs-scrollable" data-popup=${e.provider}></div>`);return n.appendChild(i),i},dt.prototype._bindAutoClose=function(){this._eventBus.once(zy,this.close,this)},dt.prototype._unbindAutoClose=function(){this._eventBus.off(zy,this.close,this)},dt.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),Mt(n)&&e<n&&(r=n),Mt(i)&&e>i&&(r=i)),r},dt.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}},dt.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},dt.prototype.registerProvider=function(e,t,n){n||(n=t,t=nM),this._eventBus.on("popupMenu.getProviders."+e,t,function(i){i.providers.push(n)})},dt.prototype._getProviders=function(e){var t=this._eventBus.createEvent({type:"popupMenu.getProviders."+e,providers:[]});return this._eventBus.fire(t),t.providers},dt.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]=ti(o,["id"])});return}var r=i.getPopupMenuEntries(e);Bt(r)?n=r(n):M(r,function(o,a){n[a]=o})}),n},dt.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]=ti(o,["id"])});return}var r=i.getPopupMenuHeaderEntries(e);Bt(r)?n=r(n):M(r,function(o,a){n[a]=o})}),n},dt.prototype._getEmptyPlaceholder=function(e){const t=e.find(n=>Bt(n.getEmptyPlaceholder));return t&&t.getEmptyPlaceholder()},dt.prototype.isOpen=function(){return!!this._current},dt.prototype.trigger=function(e,t,n="click"){if(e.preventDefault(),!t){let r=wr(e.delegateTarget||e.target,".entry",!0),o=en(r,tM);t={id:o,...this._getEntry(o)}}const i=t.action;if(this._emit("trigger",{entry:t,event:e})!==!1){if(Bt(i)){if(n==="click")return i(e,t)}else if(i[n])return i[n](e,t)}},dt.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 Vy(e,t=[]){return Object.entries(e).map(([n,i])=>{const r={id:n,...i};return r.entries?r.entries=Vy(r.entries,[...t,...Gy(r.search)]):t.length&&(r.search=[...t,...Gy(r.search)]),r})}function Gy(e){return e?pe(e)?e:[e]:[]}function iM(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=rM(o,r,i);return a?{item:o,tokens:a}:[]}).sort(oM(i))}function rM(e,t,n){const{matchedWords:i,tokens:r}=n.reduce((o,a)=>{const s=e[a],{tokens:c,matchedWords:u}=pe(s)?s.reduce((l,p)=>{const{tokens:f,matchedWords:d}=Ky(p,t);return{tokens:[...l.tokens,f],matchedWords:{...l.matchedWords,...d}}},{matchedWords:{},tokens:[]}):Ky(s,t);return{tokens:{...o.tokens,[a]:c},matchedWords:{...o.matchedWords,...u}}},{matchedWords:{},tokens:{}});return Object.keys(i).length!==t.length?null:r}function oM(e){return(t,n)=>{let i=0,r=1;for(const o of e){const a=aM(t.tokens[o],n.tokens[o]);if(a!==0){i+=a*r,r*=Wy;continue}const s=sM(t.item[o],n.item[o]);if(s!==0){i+=s*r,r*=Wy;continue}}return i}}function aM(e,t){return Uy(t)-Uy(e)}const Wy=.5,wo={FULL:131.9,START_FULL_WORD:8,START_WORD_PART:7.87,WORD_START:2.19,WORD_PART:1,NO_MATCH:-.07};function Uy(e){const t=e.reduce((s,c)=>s+qy(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 qy(e){if(pe(e))return Math.max(...e.map(qy));const t=Math.log(e.value.length);return e.match?(e.start?e.end?wo.FULL:e.wordEnd?wo.START_FULL_WORD:wo.START_WORD_PART:e.wordStart?wo.WORD_START:wo.WORD_PART)*t:wo.NO_MATCH*t}function Yy(e=""){return pe(e)?e.join(", "):e}function sM(e,t){return Yy(e).localeCompare(Yy(t))}function Ky(e,t){var u;if(!e)return{tokens:[],matchedWords:{}};const n=[],i={},r=t.map(cM),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)),S=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:S,start:d,end:h,all:m});const E=m?t:[l];for(const b of E)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 cM(e){return e.replace(/[/\-\\^$*+?.()|[\]{}]/g,"\\$&")}const Xy={search:["value",iM]},ef={__depends__:[Xy],__init__:["popupMenu"],popupMenu:["type",dt]};var Zy={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>`},uM=900;function wo(e,t,n,i){e.registerProvider(uM,this),this._contextPad=e,this._popupMenu=t,this._translate=n,this._canvas=i}wo.$inject=["contextPad","popupMenu","translate","canvas"],wo.prototype.getMultiElementContextPadEntries=function(e){var t={};return this._isAllowed(e)&&D(t,this._getEntries(e)),t},wo.prototype._isAllowed=function(e){return!this._popupMenu.isEmpty(e,"align-elements")},wo.prototype._getEntries=function(){var e=this;return{"align-elements":{group:"align-elements",title:e._translate("Align elements"),html:`<div class="entry">${Zy.align}</div>`,action:{click:function(t,n){var i=e._getMenuPosition(n);D(i,{cursor:{x:t.x,y:t.y}}),e._popupMenu.open(n,"align-elements",i)}}}}},wo.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 lM=["left","center","right","top","middle","bottom"];function Sa(e,t,n,i){this._alignElements=t,this._translate=n,this._popupMenu=e,this._rules=i,e.registerProvider("align-elements",this)}Sa.$inject=["popupMenu","alignElements","translate","rules"],Sa.prototype.getPopupMenuEntries=function(e){var t={};return this._isAllowed(e)&&D(t,this._getEntries(e)),t},Sa.prototype._isAllowed=function(e){return this._rules.allowed("elements.align",{elements:e})},Sa.prototype._getEntries=function(e){var t=this._alignElements,n=this._translate,i=this._popupMenu,r={};return M(lM,function(o){r["align-elements-"+o]={group:"align",title:n("Align elements "+o),className:"bjs-align-elements-menu-entry",imageHtml:Zy[o],action:function(){t.trigger(e,o),i.close()}}}),r};function jc(e){$n.call(this,e)}jc.$inject=["eventBus"],te(jc,$n),jc.prototype.init=function(){this.addRule("elements.align",function(e){var t=e.elements,n=Re(t,function(i){return!(i.waypoints||i.host||i.labelTarget)});return n=cs(n),n.length<2?!1:n})};const pM={__depends__:[ET,cy,Jp],__init__:["alignElementsContextPadProvider","alignElementsMenuProvider","bpmnAlignElements"],alignElementsContextPadProvider:["type",wo],alignElementsMenuProvider:["type",Sa],bpmnAlignElements:["type",jc]};function Di(e,t,n,i){W.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=pu(Vr(a.closure.topLevel)),c=a.hints,u=c?c.autoResize:!0;if(u!==!1){var l=Gr(s,function(p){return p.parent.id});M(l,function(p,f){pe(u)&&(p=p.filter(function(d){return Ke(u,Wr({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)})}Di.$inject=["eventBus","elementRegistry","modeling","rules"],te(Di,W),Di.prototype._getOptimalBounds=function(e,t){var n=this.getOffset(t),i=this.getPadding(t),r=ue(bt(e)),o=ue(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),ps(D({},o,a))},Di.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(fM(i,t)){var r=dM(qn(t,["x","y","width","height"]),i);this.resize(t,i,{autoResize:r});var o=t.parent;o&&this._expand([t],o)}}},Di.prototype.getOffset=function(e){return{top:60,bottom:60,left:100,right:100}},Di.prototype.getPadding=function(e){return{top:2,bottom:2,left:15,right:15}},Di.prototype.resize=function(e,t,n){this._modeling.resizeShape(e,t,null,n)};function fM(e,t){return e.x!==t.x||e.y!==t.y||e.width!==t.width||e.height!==t.height}function dM(e,t){var n="";return e=ue(e),t=ue(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 Fc(e){e.invoke(Di,this)}Fc.$inject=["injector"],te(Fc,Di),Fc.prototype.resize=function(e,t,n){y(e,"bpmn:Participant")?this._modeling.resizeLane(e,t,null,n):this._modeling.resizeShape(e,t,null,n)};function Ra(e){$n.call(this,e);var t=this;this.addRule("element.autoResize",function(n){return t.canResize(n.elements,n.target)})}Ra.$inject=["eventBus"],te(Ra,$n),Ra.prototype.canResize=function(e,t){return!1};function Hc(e,t){Ra.call(this,e),this._modeling=t}te(Hc,Ra),Hc.$inject=["eventBus","modeling"],Hc.prototype.canResize=function(e,t){if(y(t.di,"bpmndi:BPMNPlane")||!y(t,"bpmn:Participant")&&!y(t,"bpmn:Lane")&&!y(t,"bpmn:SubProcess"))return!1;var n=!0;return M(e,function(i){if(y(i,"bpmn:Lane")||xe(i)){n=!1;return}}),n};const hM={__init__:["bpmnAutoResize","bpmnAutoResizeProvider"],bpmnAutoResize:["type",Fc],bpmnAutoResizeProvider:["type",Hc]};function So(e,t,n){this._canvas=n,this._opts=D({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()})}So.$inject=["config.autoScroll","eventBus","canvas"],So.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++)mM(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 mM(e,t,n){return t<e&&e<n}So.prototype.stopScroll=function(){clearTimeout(this._scrolling)},So.prototype.setOptions=function(e){this._opts=D({},this._opts,e)},So.prototype._toBorderPoint=function(e){var t=this._canvas._container.getBoundingClientRect(),n=Tr(e.originalEvent);return{x:n.x-t.left,y:n.y-t.top}};const gM={__depends__:[Ci],__init__:["autoScroll"],autoScroll:["type",So]};var Qy="djs-bendpoint",Jy="djs-segment-dragger";function vM(e,t){var n=Tr(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 ef(e,t,n){var i=vM(e,n),r=_l(t,i);return r}function tf(e,t){var n=ce("g");Ae(n).add(Qy),ve(e,n);var i=ce("circle");ne(i,{cx:0,cy:0,r:4}),Ae(i).add("djs-visual"),ve(n,i);var r=ce("circle");return ne(r,{cx:0,cy:0,r:10}),Ae(r).add("djs-hit"),ve(n,r),t&&Ae(n).add(t),n}function yM(e,t,n,i){var r=ce("g");ve(e,r);var o=18,a=6,s=11,c=bM(t,n,i),u=a+s,l=ce("rect");ne(l,{x:-o/2,y:-a/2,width:o,height:a}),Ae(l).add("djs-visual"),ve(r,l);var p=ce("rect");return ne(p,{x:-c/2,y:-u/2,width:c,height:u}),Ae(p).add("djs-hit"),ve(r,p),Ch(r,i==="v"?90:0),r}function e_(e,t,n){var i=ce("g"),r=Yu(t,n),o=bi(t,n);return ve(e,i),yM(i,t,n,o),Ae(i).add(Jy),Ae(i).add(o==="h"?"horizontal":"vertical"),Wt(i,r.x,r.y),i}function nf(e){return Math.abs(Math.round(e*2/3))}function _M(e,t){var n=xM(e,t);return Rl(e,n)}function bM(e,t,n){var i=t.x-e.x,r=t.y-e.y;return nf(n==="h"?i:r)}function xM(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=fm(e,[a,s]);c<i&&(i=c,r=o)}return[n[r],n[r+1]]}function t_(e,t,n,i,r){function o(b,x,w){var T=b.index,I=b.point,P,j,F,L,H,oe;return T<=0||b.bendpoint?!1:(P=x[T-1],j=x[T],F=Yu(P,j),L=bi(P,j),H=Math.abs(I.x-F.x),oe=Math.abs(I.y-F.y),L&&H<=w&&oe<=w)}function a(b,x){var w=b.waypoints,T,I,P,j;return x.index<=0||x.bendpoint||(T={start:w[x.index-1],end:w[x.index]},I=bi(T.start,T.end),!I)?null:(I==="h"?P=T.end.x-T.start.x:P=T.end.y-T.start.y,j=nf(P)/2,j)}function s(b,x){var w=x.waypoints,T=ef(t,w,b),I;if(T){I=a(x,T);var P;if(o(T,w,I)?P=r.start(b,x,T.index):P=i.start(b,x,T.index,!T.bendpoint),P!==!1)return!0}}function c(b,x,w){me.bind(b,x,function(T){n.triggerMouseEvent(x,T,w),T.stopPropagation()})}function u(b,x){var w=t.getLayer("overlays"),T=Ge('.djs-bendpoints[data-element-id="'+_a(b.id)+'"]',w);return!T&&x&&(T=ce("g"),ne(T,{"data-element-id":b.id}),Ae(T).add("djs-bendpoints"),ve(w,T),c(T,"mousedown",b),c(T,"click",b),c(T,"dblclick",b)),T}function l(b,x){return Ge('.djs-segment-dragger[data-segment-idx="'+b+'"]',x)}function p(b,x){x.waypoints.forEach(function(w,T){var I=tf(b);ve(b,I),Wt(I,w.x,w.y)}),tf(b,"floating")}function f(b,x){for(var w=x.waypoints,T,I,P,j=1;j<w.length;j++)T=w[j-1],I=w[j],bi(T,I)&&(P=e_(b,T,I),ne(P,{"data-segment-idx":j}),c(P,"mousemove",x))}function d(b){M(rs("."+Qy,b),function(x){Mt(x)})}function h(b){M(rs("."+Jy,b),function(x){Mt(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 S(b,x){var w=Ge(".floating",b),T=x.point;w&&(Wt(w,T.x,T.y),Ae(w).add("positioned"))}function E(b,x,w){var T=l(x.index,b),I=w[x.index-1],P=w[x.index],j=x.point,F=Yu(I,P),L=bi(I,P),H,oe;T&&(H=EM(T),oe={x:j.x-F.x,y:j.y-F.y},L==="v"&&(oe={x:oe.y,y:oe.x}),Wt(H,oe.x,oe.y))}e.on("connection.changed",function(b){g(b.element)}),e.on("connection.remove",function(b){var x=u(b.element);x&&Mt(x)}),e.on("element.marker.update",function(b){var x=b.element,w;x.waypoints&&(w=m(x),b.add?Ae(w).add(b.marker):Ae(w).remove(b.marker))}),e.on("element.mousemove",function(b){var x=b.element,w=x.waypoints,T,I;if(w){if(T=u(x,!0),I=ef(t,w,b.originalEvent),!I)return;S(T,I),I.bendpoint||E(T,I,w)}}),e.on("element.mousedown",function(b){if(Ji(b)){var x=b.originalEvent,w=b.element;if(w.waypoints)return s(x,w)}}),e.on("selection.changed",function(b){var x=b.newSelection,w=x[0];w&&w.waypoints&&m(w)}),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 w=u(x);if(w){var T=Ge(".floating",w);T&&Ae(T).remove("positioned")}}}),e.on("element.updateId",function(b){var x=b.element,w=b.newId;if(x.waypoints){var T=u(x);T&&ne(T,{"data-element-id":w})}}),this.addHandles=m,this.updateHandles=g,this.getBendpointsContainer=u,this.getSegmentDragger=l}t_.$inject=["eventBus","canvas","interactionEvents","bendpointMove","connectionSegmentMove"];function EM(e){return Ge(".djs-visual",e)}var n_=Math.round,Br="reconnectStart",$r="reconnectEnd",Ca="updateWaypoints";function rf(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=Br:!u&&c===d.length-1?h=$r:h=Ca;var m=h===Ca?"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===Ca?"connection.updateWaypoints":"connection.reconnect";if(d=s.allowed=r.allowed(h,{connection:c,source:f===Br?p:u,target:f===$r?p:l}),d){s.source=f===Br?p:u,s.target=f===$r?p:l;return}d===!1&&(d=s.allowed=r.allowed(h,{connection:c,source:f===$r?p:l,target:f===Br?p:u})),d&&(s.source=f===$r?p:l,s.target=f===Br?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!==Ca&&(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||{},S={x:n_(a.x),y:n_(a.y)};if(!c)return!1;m===Ca?(p?f.splice(u,0,S):f[u]=S,g.bendpointMove={insert:p,bendpointIndex:u},f=this.cropWaypoints(l,f),o.updateWaypoints(l,jw(f),g)):(m===Br?(g.docking="source",zc(s)&&(g.docking="target",g.newWaypoints=f.reverse())):m===$r&&(g.docking="target",zc(s)&&(g.docking="source",g.newWaypoints=f.reverse())),o.reconnect(l,d,h,S,g))},this)}rf.$inject=["injector","eventBus","canvas","dragging","rules","modeling"],rf.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 zc(e){var t=e.hover,n=e.source,i=e.target,r=e.type;if(r===Br)return t&&i&&t===i&&n!==i;if(r===$r)return t&&n&&t===n&&n!==i}var wM="reconnectStart",SM="reconnectEnd",i_="updateWaypoints",Pa="connect-ok",Vc="connect-not-ok",r_="connect-hover",o_="djs-updating",a_="djs-dragging",s_=1100;function c_(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=tf(i.getLayer("overlays"));Ae(f).add("djs-dragging"),i.addMarker(c,a_),i.addMarker(c,o_)}),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,r_),u===i_)return;s?(i.removeMarker(c,Vc),i.addMarker(c,Pa)):s===!1&&(i.removeMarker(c,Pa),i.addMarker(c,Vc))}}),n.on(["bendpoint.move.out","bendpoint.move.cleanup"],s_,function(o){var a=o.context,s=a.hover,c=a.target;s&&(i.removeMarker(s,r_),i.removeMarker(s,c?Pa:Vc))}),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},S=a.hints||{},E={};r&&(S.connectionStart&&(E.connectionStart=S.connectionStart),S.connectionEnd&&(E.connectionEnd=S.connectionEnd),p===wM?zc(a)?(E.connectionEnd=E.connectionEnd||g,E.source=h,E.target=l||d,m=m.reverse()):(E.connectionStart=E.connectionStart||g,E.source=l||d,E.target=h):p===SM?zc(a)?(E.connectionStart=E.connectionStart||g,E.source=l||h,E.target=d,m=m.reverse()):(E.connectionEnd=E.connectionEnd||g,E.source=d,E.target=l||h):(E.noCropping=!0,E.noLayout=!0,m[c]=g),p===i_&&(m=e.cropWaypoints(f,m)),E.waypoints=m,r.drawPreview(a,s,E)),Wt(u,o.x,o.y)},this),n.on(["bendpoint.move.end","bendpoint.move.cancel"],s_,function(o){var a=o.context,s=a.connection,c=a.draggerGfx,u=a.hover,l=a.target,p=a.waypoints;s.waypoints=p,Mt(c),i.removeMarker(s,o_),i.removeMarker(s,a_),u&&(i.removeMarker(u,Pa),i.removeMarker(u,l?Pa:Vc)),r&&r.cleanUp(a)})}c_.$inject=["bendpointMove","injector","eventBus","canvas"];var u_="connect-hover",l_="djs-updating";function p_(e,t,n){return of(e,t,e[t]+n)}function of(e,t,n){return{x:t==="x"?n:e.x,y:t==="y"?n:e.y}}function RM(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 of(t,i,s)}function f_(e){return e==="x"?"y":"x"}function d_(e,t,n){var i,r;return e.original?e.original:(i=fe(t),r=f_(n),of(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,S=d,E=f.waypoints,b=E[g],x=E[S],w=ef(n,E,p),T,I,P;if(T=bi(b,x),!!T)return I=T==="v"?"x":"y",g===0&&(b=d_(b,f.source,I)),S===E.length-1&&(x=d_(x,f.target,I)),w?P=w.point:P={x:(b.x+x.x)/2,y:(b.y+x.y)/2},h={connection:f,segmentStartIndex:g,segmentEndIndex:S,segmentStart:b,segmentEnd:x,axis:I,dragPosition:P},i.init(p,P,"connectionSegment.move",{cursor:I==="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],S=p.segmentEndIndex+f,E=h[S],b=f_(p.axis),x=RM(d,g,E,b);Wt(p.draggerGfx,x.x,x.y)}function l(p,f){var d=0,h=p.filter(function(m,g){return qu(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=e_(h,f.segmentStart,f.segmentEnd),Ae(f.draggerGfx).add("djs-dragging"),n.addMarker(d,l_)}),t.on("connectionSegment.move.move",function(p){var f=p.context,d=f.connection,h=f.segmentStartIndex,m=f.segmentEndIndex,g=f.segmentStart,S=f.segmentEnd,E=f.axis,b=f.originalWaypoints.slice(),x=p_(g,E,p["d"+E]),w=p_(S,E,p["d"+E]),T=b.length,I=0;b[h]=x,b[m]=w;var P,j;h<2&&(P=Gt(d.source,x),h===1?P==="intersect"&&(b.shift(),b[0]=x,I--):P!=="intersect"&&(b.unshift(g),I++)),m>T-3&&(j=Gt(d.target,w),m===T-2?j==="intersect"&&(b.pop(),b[b.length-1]=w):j!=="intersect"&&b.push(S)),f.newWaypoints=d.waypoints=s(d,b),u(f,I,p),f.newSegmentStartIndex=h+I,c(p)}),t.on("connectionSegment.move.hover",function(p){p.context.hover=p.hover,n.addMarker(p.hover,u_)}),t.on(["connectionSegment.move.out","connectionSegment.move.cleanup"],function(p){var f=p.context.hover;f&&n.removeMarker(f,u_)}),t.on("connectionSegment.move.cleanup",function(p){var f=p.context,d=f.connection;f.draggerGfx&&Mt(f.draggerGfx),n.removeMarker(d,l_)}),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(w){return{original:w.original,x:Math.round(w.x),y:Math.round(w.y)}});var g=l(h,m),S=g.waypoints,E=s(d,S),b=g.segmentOffset,x={segmentMove:{segmentStartIndex:f.segmentStartIndex,newSegmentStartIndex:m+b}};o.updateWaypoints(d,E,x)})}h_.$inject=["injector","eventBus","canvas","dragging","graphicsFactory","modeling"];var CM=Math.abs,m_=Math.round;function PM(e,t,n){n=n===void 0?10:n;var i,r;for(i=0;i<t.length;i++)if(r=t[i],CM(r-e)<=n)return r}function g_(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:m_(e.x+e.width/2),y:m_(e.y+e.height/2)}}function Ro(e,t){var n=e.snapped;return n?typeof t=="string"?n[t]:n.x&&n.y:!1}function St(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 y_(e){return e.children||[]}var AM=Math.abs,__=Math.round,af=10;function b_(e){function t(o,a){if(pe(o)){for(var s=o.length;s--;)if(AM(o[s]-a)<=af)return o[s]}else{o=+o;var c=a%o;if(c<af)return a-c;if(c>o-af)return a-c+o}return a}function n(o,a){if(o.waypoints)return _M(a,o);if(o.width)return{x:__(o.width/2+o.x),y:__(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;D(o,{dx:o.dx-p,dy:o.dy-f,x:u,y:l}),(p||a.vertical.indexOf(s)!==-1)&&St(o,"x",u),(f||a.horizontal.indexOf(c)!==-1)&&St(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);!Ue(s)||!c||!c.x||!c.y||(St(o,"x",c.x),St(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;D(o,{dx:o.dx-h,dy:o.dy-m,x:o.x-h,y:o.y-m}),(h||s.vertical.indexOf(l)!==-1)&&St(o,"x",f),(m||s.horizontal.indexOf(p)!==-1)&&St(o,"y",d)}})}b_.$inject=["eventBus"];const TM={__depends__:[Ci,li],__init__:["bendpoints","bendpointSnapping","bendpointMovePreview"],bendpoints:["type",t_],bendpointMove:["type",rf],bendpointMovePreview:["type",c_],connectionSegmentMove:["type",h_],bendpointSnapping:["type",b_]};function x_(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),!zr(l)){if(l!==!1){s.source=c,s.target=u;return}l=s.canExecute=o(c,u),!zr(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:sf(s)?l:u,connectionEnd:sf(s)?u:l};It(c)&&(d=c),s.connection=n.connect(p,f,d,h)}),this.start=function(a,s,c,u){It(c)||(u=c,c=fe(s)),t.init(a,"connect",{autoActivate:u,data:{shape:s,context:{start:s,connectionStart:c}}})}}x_.$inject=["eventBus","dragging","modeling","rules"];function sf(e){var t=e.hover,n=e.source,i=e.target;return t&&n&&t===n&&n!==i}var MM=1100,kM=900,E_="connect-ok",w_="connect-not-ok";function S_(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;sf(o)&&(h=d,m=f),i.drawPreview(o,a,{source:c||u,target:p||s,connectionStart:h,connectionEnd:m})}),t.on("connect.hover",kM,function(r){var o=r.context,a=r.hover,s=o.canExecute;s!==null&&n.addMarker(a,s?E_:w_)}),t.on(["connect.out","connect.cleanup"],MM,function(r){var o=r.hover;o&&(n.removeMarker(o,E_),n.removeMarker(o,w_))}),i&&t.on("connect.cleanup",function(r){i.cleanUp(r.context)})}S_.$inject=["injector","eventBus","canvas"];const cf={__depends__:[jn,li,Ci],__init__:["connectPreview"],connect:["type",x_],connectPreview:["type",S_]};var DM="djs-dragger";function Oi(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)}Oi.$inject=["injector","canvas","graphicsFactory","elementFactory"],Oi.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()),os(i),r||(r=e.getConnection=OM(function(m,g,S){return h.getConnection(m,g,S)})),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?fe(o):c,a?fe(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)"})},Oi.prototype.drawNoopPreview=function(e,t){var n=t.source,i=t.target,r=t.connectionStart||fe(n),o=t.connectionEnd||fe(i),a=this.cropWaypoints(r,o,n,i),s=this.createNoopConnection(a[0],a[1]);ve(e,s)},Oi.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&&Ho(o,s,!0)||e,t=i&&Ho(a,s,!1)||t,[e,t]},Oi.prototype.cleanUp=function(e){e&&e.connectionPreviewGfx&&Mt(e.connectionPreviewGfx)},Oi.prototype.getConnection=function(e){var t=IM(e);return this._elementFactory.createConnection(t)},Oi.prototype.createConnectionPreviewGfx=function(){var e=ce("g");return ne(e,{pointerEvents:"none"}),Ae(e).add(DM),ve(this._canvas.getActiveLayer(),e),e},Oi.prototype.createNoopConnection=function(e,t){return Bo([e,t],{stroke:"#333",strokeDasharray:[1],strokeWidth:2,"pointer-events":"none"})};function OM(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 IM(e){return It(e)?e:{}}const LM={__init__:["connectionPreview"],connectionPreview:["type",Oi]},Gc="complex-preview";class R_{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(Gc);n.filter(s=>!NM(s)).forEach(s=>{let c;Ue(s)?(c=this._graphicsFactory._createContainer("connection",ce("g")),this._graphicsFactory.drawConnection(Cr(c),s)):(c=this._graphicsFactory._createContainer("shape",ce("g")),this._graphicsFactory.drawShape(Cr(c),s),Wt(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);Ue(s)?Wt(u,c.x,c.y):Wt(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",ce("g"));this._graphicsFactory.drawShape(Cr(u),s,{width:c.width,height:c.height}),Wt(u,c.x,c.y),this._previewSupport.addDragger(s,a,u)})}cleanUp(){os(this._canvas.getLayer(Gc)),this._markers.forEach(([t,n])=>this._canvas.removeMarker(t,n)),this._markers=[]}show(){this._canvas.showLayer(Gc)}hide(){this._canvas.hideLayer(Gc)}}R_.$inject=["canvas","graphicsFactory","previewSupport"];function NM(e){return e.hidden}const BM={__depends__:[mo],__init__:["complexPreview"],complexPreview:["type",R_]},C_=Math.round;function Wc(e,t,n,i,r,o){this._complexPreview=e,this._connectionDocking=t,this._elementFactory=n,this._eventBus=i,this._layouter=r,this._rules=o}Wc.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(D({type:t},n)),l=a.fire("autoPlace",{source:e,shape:u});if(!l)return;D(u,{x:l.x-C_(u.width/2),y:l.y-C_(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=>!zr(d))})},Wc.prototype.cleanUp=function(){this._complexPreview.cleanUp()},Wc.$inject=["complexPreview","connectionDocking","elementFactory","eventBus","layouter","rules"];const $M={__depends__:[yc,BM,Op],__init__:["appendPreview"],appendPreview:["type",Wc]};var P_=Math.min,A_=Math.max;function uf(e){e.preventDefault()}function Aa(e){e.stopPropagation()}function jM(e){return e.nodeType===Node.TEXT_NODE}function FM(e){return[].slice.call(e)}function Xn(e){this.container=e.container,this.parent=Qe('<div class="djs-direct-editing-parent"><div class="djs-direct-editing-content" contenteditable="true"></div></div>'),this.content=Ge("[contenteditable]",this.parent),this.keyHandler=e.keyHandler||function(){},this.resizeHandler=e.resizeHandler||function(){},this.focusoutHandler=e.focusoutHandler||function(){},this.autoResize=pn(this.autoResize,this),this.handlePaste=pn(this.handlePaste,this)}Xn.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=qn(t,["width","height","maxWidth","maxHeight","minWidth","minHeight","left","top","backgroundColor","position","overflow","border","wordWrap","textAlign","outline","transform"]);D(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=qn(t,["fontFamily","fontSize","fontWeight","lineHeight","padding","paddingTop","paddingRight","paddingBottom","paddingLeft"]);return D(a.style,{boxSizing:"border-box",width:"100%",outline:"none",wordWrap:"break-word"},u),i.centerVertically&&D(a.style,{position:"absolute",top:"50%",transform:"translate(0, -50%)"},u),a.innerText=n,me.bind(a,"keydown",this.keyHandler),me.bind(a,"mousedown",Aa),me.bind(a,"paste",r.handlePaste),me.bind(a,"focusout",this.focusoutHandler),i.autoResize&&me.bind(a,"input",this.autoResize),i.resizable&&this.resizable(t),s.appendChild(o),this.setSelection(a.lastChild,a.lastChild&&a.lastChild.length),o},Xn.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)}},Xn.prototype.insertText=function(e){e=HM(e);var t=document.execCommand("insertText",!1,e);t||this._insertTextIE(e)},Xn.prototype._insertTextIE=function(e){var t=this.getSelection(),n=t.startContainer,i=t.endContainer,r=t.startOffset,o=t.endOffset,a=t.commonAncestorContainer,s=FM(a.childNodes),c,u;if(jM(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&&ri(h)}),c=n,u=r+e.length}c&&u!==void 0&&setTimeout(function(){self.setSelection(c,u)})},Xn.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})}},Xn.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=Qe('<div class="djs-direct-editing-resize-handle"></div>');var s,c,u,l,p=function(h){uf(h),Aa(h),s=h.clientX,c=h.clientY;var m=t.getBoundingClientRect();u=m.width,l=m.height,me.bind(document,"mousemove",f),me.bind(document,"mouseup",d)},f=function(h){uf(h),Aa(h);var m=P_(A_(u+h.clientX-s,i),o),g=P_(A_(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){uf(h),Aa(h),me.unbind(document,"mousemove",f,!1),me.unbind(document,"mouseup",d,!1)};me.bind(n,"mousedown",p)}D(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)},Xn.prototype.destroy=function(){var e=this.parent,t=this.content,n=this.resizeHandle;t.innerText="",e.removeAttribute("style"),t.removeAttribute("style"),me.unbind(t,"keydown",this.keyHandler),me.unbind(t,"mousedown",Aa),me.unbind(t,"input",this.autoResize),me.unbind(t,"paste",this.handlePaste),me.unbind(t,"focusout",this.focusoutHandler),n&&(n.removeAttribute("style"),ri(n)),ri(e)},Xn.prototype.getValue=function(){return this.content.innerText.trim()},Xn.prototype.getSelection=function(){var e=window.getSelection(),t=e.getRangeAt(0);return t},Xn.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 HM(e){return e.replace(/\r\n|\r|\n/g,`
|
|
316
|
-
`)}function Sn(e,t){this._eventBus=e,this._canvas=t,this._providers=[],this._textbox=new Xn({container:t.getContainer(),keyHandler:pn(this._handleKey,this),resizeHandler:pn(this._handleResize,this),focusoutHandler:pn(this._handleFocusout,this)}),e.on(["diagram.clear","diagram.destroy"],()=>this._cleanup())}Sn.$inject=["eventBus","canvas"],Sn.prototype.registerProvider=function(e){this._providers.push(e)},Sn.prototype.isActive=function(e){return!!(this._active&&(!e||this._active.element===e))},Sn.prototype.cancel=function(){this._active&&(this._fire("cancel"),this.close())},Sn.prototype._fire=function(e,t){this._eventBus.fire("directEditing."+e,t||{active:this._active})},Sn.prototype.close=function(){this._fire("deactivate"),this._cleanup(),this._canvas.restoreFocus&&this._canvas.restoreFocus()},Sn.prototype._cleanup=function(){this._active&&(this._textbox.destroy(),this._active=null,this.resizable=void 0)},Sn.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()}},Sn.prototype.getValue=function(){return this._textbox.getValue()},Sn.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()},Sn.prototype._handleResize=function(e){this._fire("resize",e)},Sn.prototype._handleFocusout=function(e){e.relatedTarget&&this._textbox.parent.contains(e.relatedTarget)||this.complete()},Sn.prototype.activate=function(e){if(this.isActive()&&this.cancel(),this._eventBus.fire("directEditing.activate.allowed",{element:e})===!1)return!1;var t,n=Ke(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 T_={__depends__:[Ys],__init__:["directEditing"],directEditing:["type",Sn]};function zM(e){return function(t){var n=t.target,i=q(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===Pe(e);return!o||!a||!s||!c}}const VM={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 G(e,t={}){var n=VM[e];if(!n)throw new Error("unknown popup entry <"+e+">");return{...n,actionName:"replace-with-"+e,...t}}var GM=[G("none-start-event",{actionName:"replace-with-none-start"}),G("none-intermediate-throwing"),G("none-end-event",{actionName:"replace-with-none-end"}),G("message-start"),G("timer-start"),G("conditional-start"),G("signal-start")],WM=[G("none-start-event",{actionName:"replace-with-none-start"}),G("none-intermediate-throwing"),G("none-end-event",{actionName:"replace-with-none-end"})],UM=[G("none-start-event",{actionName:"replace-with-none-start"}),G("none-intermediate-throwing",{actionName:"replace-with-none-intermediate-throw"}),G("none-end-event",{actionName:"replace-with-none-end"}),G("message-intermediate-catch"),G("message-intermediate-throw"),G("timer-intermediate-catch"),G("escalation-intermediate-throw"),G("conditional-intermediate-catch"),G("link-intermediate-catch"),G("link-intermediate-throw"),G("compensation-intermediate-throw"),G("signal-intermediate-catch"),G("signal-intermediate-throw")],qM=[G("none-start-event",{actionName:"replace-with-none-start"}),G("none-intermediate-throwing",{actionName:"replace-with-none-intermediate-throw"}),G("none-end-event",{actionName:"replace-with-none-end"}),G("message-end"),G("escalation-end"),G("error-end"),G("cancel-end"),G("compensation-end"),G("signal-end"),G("terminate-end")],YM=[G("exclusive-gateway"),G("parallel-gateway"),G("inclusive-gateway"),G("complex-gateway"),G("event-based-gateway")],KM=[G("transaction"),G("event-subprocess"),G("expanded-ad-hoc-subprocess",{actionName:"replace-with-ad-hoc-subprocess",label:"Ad-hoc sub-process"}),G("collapsed-subprocess")],XM=[G("expanded-subprocess",{actionName:"replace-with-subprocess",label:"Sub-process"}),G("transaction"),G("event-subprocess"),G("collapsed-ad-hoc-subprocess")],M_=[G("transaction"),G("expanded-subprocess",{actionName:"replace-with-subprocess",label:"Sub-process"}),G("expanded-ad-hoc-subprocess",{actionName:"replace-with-ad-hoc-subprocess",label:"Ad-hoc sub-process"}),G("event-subprocess")],ZM=M_,k_=[G("task"),G("user-task"),G("service-task"),G("send-task"),G("receive-task"),G("manual-task"),G("rule-task"),G("script-task"),G("call-activity"),G("collapsed-subprocess"),G("expanded-subprocess"),G("collapsed-ad-hoc-subprocess"),G("expanded-ad-hoc-subprocess",{actionName:"replace-with-ad-hoc-subprocess"})],QM=[G("data-store-reference")],JM=[G("data-object-reference")],e2=[G("message-boundary"),G("timer-boundary"),G("escalation-boundary"),G("conditional-boundary"),G("error-boundary"),G("cancel-boundary"),G("signal-boundary"),G("compensation-boundary"),G("non-interrupting-message-boundary"),G("non-interrupting-timer-boundary"),G("non-interrupting-escalation-boundary"),G("non-interrupting-conditional-boundary"),G("non-interrupting-signal-boundary")],t2=[G("message-start"),G("timer-start"),G("conditional-start"),G("signal-start"),G("error-start"),G("escalation-start"),G("compensation-start"),G("non-interrupting-message-start"),G("non-interrupting-timer-start"),G("non-interrupting-conditional-start"),G("non-interrupting-signal-start"),G("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"}],i2=[G("expanded-pool"),G("collapsed-pool",{label:function(e){var t="Empty pool/participant";return e.children&&e.children.length&&(t+=" (removes content)"),t}})],r2={"bpmn:MessageEventDefinition":[G("message-start"),G("message-intermediate-catch"),G("message-intermediate-throw"),G("message-end")],"bpmn:TimerEventDefinition":[G("timer-start"),G("timer-intermediate-catch")],"bpmn:ConditionalEventDefinition":[G("conditional-start"),G("conditional-intermediate-catch")],"bpmn:SignalEventDefinition":[G("signal-start"),G("signal-intermediate-catch"),G("signal-intermediate-throw"),G("signal-end")],"bpmn:ErrorEventDefinition":[G("error-start"),G("error-end")],"bpmn:EscalationEventDefinition":[G("escalation-start"),G("escalation-intermediate-throw"),G("escalation-end")],"bpmn:CompensateEventDefinition":[G("compensation-start"),G("compensation-intermediate-throw"),G("compensation-end")]};const D_={"start-event-non-interrupting":`
|
|
315
|
+
</svg>`},uM=900;function So(e,t,n,i){e.registerProvider(uM,this),this._contextPad=e,this._popupMenu=t,this._translate=n,this._canvas=i}So.$inject=["contextPad","popupMenu","translate","canvas"],So.prototype.getMultiElementContextPadEntries=function(e){var t={};return this._isAllowed(e)&&D(t,this._getEntries(e)),t},So.prototype._isAllowed=function(e){return!this._popupMenu.isEmpty(e,"align-elements")},So.prototype._getEntries=function(){var e=this;return{"align-elements":{group:"align-elements",title:e._translate("Align elements"),html:`<div class="entry">${Zy.align}</div>`,action:{click:function(t,n){var i=e._getMenuPosition(n);D(i,{cursor:{x:t.x,y:t.y}}),e._popupMenu.open(n,"align-elements",i)}}}}},So.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 lM=["left","center","right","top","middle","bottom"];function Ra(e,t,n,i){this._alignElements=t,this._translate=n,this._popupMenu=e,this._rules=i,e.registerProvider("align-elements",this)}Ra.$inject=["popupMenu","alignElements","translate","rules"],Ra.prototype.getPopupMenuEntries=function(e){var t={};return this._isAllowed(e)&&D(t,this._getEntries(e)),t},Ra.prototype._isAllowed=function(e){return this._rules.allowed("elements.align",{elements:e})},Ra.prototype._getEntries=function(e){var t=this._alignElements,n=this._translate,i=this._popupMenu,r={};return M(lM,function(o){r["align-elements-"+o]={group:"align",title:n("Align elements "+o),className:"bjs-align-elements-menu-entry",imageHtml:Zy[o],action:function(){t.trigger(e,o),i.close()}}}),r};function jc(e){Hn.call(this,e)}jc.$inject=["eventBus"],te(jc,Hn),jc.prototype.init=function(){this.addRule("elements.align",function(e){var t=e.elements,n=Ae(t,function(i){return!(i.waypoints||i.host||i.labelTarget)});return n=cs(n),n.length<2?!1:n})};const pM={__depends__:[ET,cy,ef],__init__:["alignElementsContextPadProvider","alignElementsMenuProvider","bpmnAlignElements"],alignElementsContextPadProvider:["type",So],alignElementsMenuProvider:["type",Ra],bpmnAlignElements:["type",jc]};function Oi(e,t,n,i){U.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=pu(Gr(a.closure.topLevel)),c=a.hints,u=c?c.autoResize:!0;if(u!==!1){var l=Wr(s,function(p){return p.parent.id});M(l,function(p,f){pe(u)&&(p=p.filter(function(d){return et(u,Ur({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)})}Oi.$inject=["eventBus","elementRegistry","modeling","rules"],te(Oi,U),Oi.prototype._getOptimalBounds=function(e,t){var n=this.getOffset(t),i=this.getPadding(t),r=ue(Et(e)),o=ue(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),ps(D({},o,a))},Oi.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(fM(i,t)){var r=dM(Xn(t,["x","y","width","height"]),i);this.resize(t,i,{autoResize:r});var o=t.parent;o&&this._expand([t],o)}}},Oi.prototype.getOffset=function(e){return{top:60,bottom:60,left:100,right:100}},Oi.prototype.getPadding=function(e){return{top:2,bottom:2,left:15,right:15}},Oi.prototype.resize=function(e,t,n){this._modeling.resizeShape(e,t,null,n)};function fM(e,t){return e.x!==t.x||e.y!==t.y||e.width!==t.width||e.height!==t.height}function dM(e,t){var n="";return e=ue(e),t=ue(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 Fc(e){e.invoke(Oi,this)}Fc.$inject=["injector"],te(Fc,Oi),Fc.prototype.resize=function(e,t,n){y(e,"bpmn:Participant")?this._modeling.resizeLane(e,t,null,n):this._modeling.resizeShape(e,t,null,n)};function Ca(e){Hn.call(this,e);var t=this;this.addRule("element.autoResize",function(n){return t.canResize(n.elements,n.target)})}Ca.$inject=["eventBus"],te(Ca,Hn),Ca.prototype.canResize=function(e,t){return!1};function Hc(e,t){Ca.call(this,e),this._modeling=t}te(Hc,Ca),Hc.$inject=["eventBus","modeling"],Hc.prototype.canResize=function(e,t){if(y(t.di,"bpmndi:BPMNPlane")||!y(t,"bpmn:Participant")&&!y(t,"bpmn:Lane")&&!y(t,"bpmn:SubProcess"))return!1;var n=!0;return M(e,function(i){if(y(i,"bpmn:Lane")||Ee(i)){n=!1;return}}),n};const hM={__init__:["bpmnAutoResize","bpmnAutoResizeProvider"],bpmnAutoResize:["type",Fc],bpmnAutoResizeProvider:["type",Hc]};function Ro(e,t,n){this._canvas=n,this._opts=D({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()})}Ro.$inject=["config.autoScroll","eventBus","canvas"],Ro.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++)mM(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 mM(e,t,n){return t<e&&e<n}Ro.prototype.stopScroll=function(){clearTimeout(this._scrolling)},Ro.prototype.setOptions=function(e){this._opts=D({},this._opts,e)},Ro.prototype._toBorderPoint=function(e){var t=this._canvas._container.getBoundingClientRect(),n=Tr(e.originalEvent);return{x:n.x-t.left,y:n.y-t.top}};const gM={__depends__:[Pi],__init__:["autoScroll"],autoScroll:["type",Ro]};var Qy="djs-bendpoint",Jy="djs-segment-dragger";function vM(e,t){var n=Tr(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 tf(e,t,n){var i=vM(e,n),r=bl(t,i);return r}function nf(e,t){var n=ce("g");ke(n).add(Qy),ye(e,n);var i=ce("circle");ne(i,{cx:0,cy:0,r:4}),ke(i).add("djs-visual"),ye(n,i);var r=ce("circle");return ne(r,{cx:0,cy:0,r:10}),ke(r).add("djs-hit"),ye(n,r),t&&ke(n).add(t),n}function yM(e,t,n,i){var r=ce("g");ye(e,r);var o=18,a=6,s=11,c=bM(t,n,i),u=a+s,l=ce("rect");ne(l,{x:-o/2,y:-a/2,width:o,height:a}),ke(l).add("djs-visual"),ye(r,l);var p=ce("rect");return ne(p,{x:-c/2,y:-u/2,width:c,height:u}),ke(p).add("djs-hit"),ye(r,p),Ch(r,i==="v"?90:0),r}function e_(e,t,n){var i=ce("g"),r=Ku(t,n),o=xi(t,n);return ye(e,i),yM(i,t,n,o),ke(i).add(Jy),ke(i).add(o==="h"?"horizontal":"vertical"),Wt(i,r.x,r.y),i}function rf(e){return Math.abs(Math.round(e*2/3))}function _M(e,t){var n=xM(e,t);return Cl(e,n)}function bM(e,t,n){var i=t.x-e.x,r=t.y-e.y;return rf(n==="h"?i:r)}function xM(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=fm(e,[a,s]);c<i&&(i=c,r=o)}return[n[r],n[r+1]]}function t_(e,t,n,i,r){function o(b,x,w){var T=b.index,I=b.point,P,j,F,L,H,oe;return T<=0||b.bendpoint?!1:(P=x[T-1],j=x[T],F=Ku(P,j),L=xi(P,j),H=Math.abs(I.x-F.x),oe=Math.abs(I.y-F.y),L&&H<=w&&oe<=w)}function a(b,x){var w=b.waypoints,T,I,P,j;return x.index<=0||x.bendpoint||(T={start:w[x.index-1],end:w[x.index]},I=xi(T.start,T.end),!I)?null:(I==="h"?P=T.end.x-T.start.x:P=T.end.y-T.start.y,j=rf(P)/2,j)}function s(b,x){var w=x.waypoints,T=tf(t,w,b),I;if(T){I=a(x,T);var P;if(o(T,w,I)?P=r.start(b,x,T.index):P=i.start(b,x,T.index,!T.bendpoint),P!==!1)return!0}}function c(b,x,w){ve.bind(b,x,function(T){n.triggerMouseEvent(x,T,w),T.stopPropagation()})}function u(b,x){var w=t.getLayer("overlays"),T=qe('.djs-bendpoints[data-element-id="'+ba(b.id)+'"]',w);return!T&&x&&(T=ce("g"),ne(T,{"data-element-id":b.id}),ke(T).add("djs-bendpoints"),ye(w,T),c(T,"mousedown",b),c(T,"click",b),c(T,"dblclick",b)),T}function l(b,x){return qe('.djs-segment-dragger[data-segment-idx="'+b+'"]',x)}function p(b,x){x.waypoints.forEach(function(w,T){var I=nf(b);ye(b,I),Wt(I,w.x,w.y)}),nf(b,"floating")}function f(b,x){for(var w=x.waypoints,T,I,P,j=1;j<w.length;j++)T=w[j-1],I=w[j],xi(T,I)&&(P=e_(b,T,I),ne(P,{"data-segment-idx":j}),c(P,"mousemove",x))}function d(b){M(rs("."+Qy,b),function(x){Dt(x)})}function h(b){M(rs("."+Jy,b),function(x){Dt(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 S(b,x){var w=qe(".floating",b),T=x.point;w&&(Wt(w,T.x,T.y),ke(w).add("positioned"))}function E(b,x,w){var T=l(x.index,b),I=w[x.index-1],P=w[x.index],j=x.point,F=Ku(I,P),L=xi(I,P),H,oe;T&&(H=EM(T),oe={x:j.x-F.x,y:j.y-F.y},L==="v"&&(oe={x:oe.y,y:oe.x}),Wt(H,oe.x,oe.y))}e.on("connection.changed",function(b){g(b.element)}),e.on("connection.remove",function(b){var x=u(b.element);x&&Dt(x)}),e.on("element.marker.update",function(b){var x=b.element,w;x.waypoints&&(w=m(x),b.add?ke(w).add(b.marker):ke(w).remove(b.marker))}),e.on("element.mousemove",function(b){var x=b.element,w=x.waypoints,T,I;if(w){if(T=u(x,!0),I=tf(t,w,b.originalEvent),!I)return;S(T,I),I.bendpoint||E(T,I,w)}}),e.on("element.mousedown",function(b){if(er(b)){var x=b.originalEvent,w=b.element;if(w.waypoints)return s(x,w)}}),e.on("selection.changed",function(b){var x=b.newSelection,w=x[0];w&&w.waypoints&&m(w)}),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 w=u(x);if(w){var T=qe(".floating",w);T&&ke(T).remove("positioned")}}}),e.on("element.updateId",function(b){var x=b.element,w=b.newId;if(x.waypoints){var T=u(x);T&&ne(T,{"data-element-id":w})}}),this.addHandles=m,this.updateHandles=g,this.getBendpointsContainer=u,this.getSegmentDragger=l}t_.$inject=["eventBus","canvas","interactionEvents","bendpointMove","connectionSegmentMove"];function EM(e){return qe(".djs-visual",e)}var n_=Math.round,Br="reconnectStart",$r="reconnectEnd",Pa="updateWaypoints";function of(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=Br:!u&&c===d.length-1?h=$r:h=Pa;var m=h===Pa?"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===Pa?"connection.updateWaypoints":"connection.reconnect";if(d=s.allowed=r.allowed(h,{connection:c,source:f===Br?p:u,target:f===$r?p:l}),d){s.source=f===Br?p:u,s.target=f===$r?p:l;return}d===!1&&(d=s.allowed=r.allowed(h,{connection:c,source:f===$r?p:l,target:f===Br?p:u})),d&&(s.source=f===$r?p:l,s.target=f===Br?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!==Pa&&(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||{},S={x:n_(a.x),y:n_(a.y)};if(!c)return!1;m===Pa?(p?f.splice(u,0,S):f[u]=S,g.bendpointMove={insert:p,bendpointIndex:u},f=this.cropWaypoints(l,f),o.updateWaypoints(l,jw(f),g)):(m===Br?(g.docking="source",zc(s)&&(g.docking="target",g.newWaypoints=f.reverse())):m===$r&&(g.docking="target",zc(s)&&(g.docking="source",g.newWaypoints=f.reverse())),o.reconnect(l,d,h,S,g))},this)}of.$inject=["injector","eventBus","canvas","dragging","rules","modeling"],of.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 zc(e){var t=e.hover,n=e.source,i=e.target,r=e.type;if(r===Br)return t&&i&&t===i&&n!==i;if(r===$r)return t&&n&&t===n&&n!==i}var wM="reconnectStart",SM="reconnectEnd",i_="updateWaypoints",Aa="connect-ok",Vc="connect-not-ok",r_="connect-hover",o_="djs-updating",a_="djs-dragging",s_=1100;function c_(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=nf(i.getLayer("overlays"));ke(f).add("djs-dragging"),i.addMarker(c,a_),i.addMarker(c,o_)}),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,r_),u===i_)return;s?(i.removeMarker(c,Vc),i.addMarker(c,Aa)):s===!1&&(i.removeMarker(c,Aa),i.addMarker(c,Vc))}}),n.on(["bendpoint.move.out","bendpoint.move.cleanup"],s_,function(o){var a=o.context,s=a.hover,c=a.target;s&&(i.removeMarker(s,r_),i.removeMarker(s,c?Aa:Vc))}),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},S=a.hints||{},E={};r&&(S.connectionStart&&(E.connectionStart=S.connectionStart),S.connectionEnd&&(E.connectionEnd=S.connectionEnd),p===wM?zc(a)?(E.connectionEnd=E.connectionEnd||g,E.source=h,E.target=l||d,m=m.reverse()):(E.connectionStart=E.connectionStart||g,E.source=l||d,E.target=h):p===SM?zc(a)?(E.connectionStart=E.connectionStart||g,E.source=l||h,E.target=d,m=m.reverse()):(E.connectionEnd=E.connectionEnd||g,E.source=d,E.target=l||h):(E.noCropping=!0,E.noLayout=!0,m[c]=g),p===i_&&(m=e.cropWaypoints(f,m)),E.waypoints=m,r.drawPreview(a,s,E)),Wt(u,o.x,o.y)},this),n.on(["bendpoint.move.end","bendpoint.move.cancel"],s_,function(o){var a=o.context,s=a.connection,c=a.draggerGfx,u=a.hover,l=a.target,p=a.waypoints;s.waypoints=p,Dt(c),i.removeMarker(s,o_),i.removeMarker(s,a_),u&&(i.removeMarker(u,Aa),i.removeMarker(u,l?Aa:Vc)),r&&r.cleanUp(a)})}c_.$inject=["bendpointMove","injector","eventBus","canvas"];var u_="connect-hover",l_="djs-updating";function p_(e,t,n){return af(e,t,e[t]+n)}function af(e,t,n){return{x:t==="x"?n:e.x,y:t==="y"?n:e.y}}function RM(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 af(t,i,s)}function f_(e){return e==="x"?"y":"x"}function d_(e,t,n){var i,r;return e.original?e.original:(i=fe(t),r=f_(n),af(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,S=d,E=f.waypoints,b=E[g],x=E[S],w=tf(n,E,p),T,I,P;if(T=xi(b,x),!!T)return I=T==="v"?"x":"y",g===0&&(b=d_(b,f.source,I)),S===E.length-1&&(x=d_(x,f.target,I)),w?P=w.point:P={x:(b.x+x.x)/2,y:(b.y+x.y)/2},h={connection:f,segmentStartIndex:g,segmentEndIndex:S,segmentStart:b,segmentEnd:x,axis:I,dragPosition:P},i.init(p,P,"connectionSegment.move",{cursor:I==="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],S=p.segmentEndIndex+f,E=h[S],b=f_(p.axis),x=RM(d,g,E,b);Wt(p.draggerGfx,x.x,x.y)}function l(p,f){var d=0,h=p.filter(function(m,g){return Yu(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=e_(h,f.segmentStart,f.segmentEnd),ke(f.draggerGfx).add("djs-dragging"),n.addMarker(d,l_)}),t.on("connectionSegment.move.move",function(p){var f=p.context,d=f.connection,h=f.segmentStartIndex,m=f.segmentEndIndex,g=f.segmentStart,S=f.segmentEnd,E=f.axis,b=f.originalWaypoints.slice(),x=p_(g,E,p["d"+E]),w=p_(S,E,p["d"+E]),T=b.length,I=0;b[h]=x,b[m]=w;var P,j;h<2&&(P=Gt(d.source,x),h===1?P==="intersect"&&(b.shift(),b[0]=x,I--):P!=="intersect"&&(b.unshift(g),I++)),m>T-3&&(j=Gt(d.target,w),m===T-2?j==="intersect"&&(b.pop(),b[b.length-1]=w):j!=="intersect"&&b.push(S)),f.newWaypoints=d.waypoints=s(d,b),u(f,I,p),f.newSegmentStartIndex=h+I,c(p)}),t.on("connectionSegment.move.hover",function(p){p.context.hover=p.hover,n.addMarker(p.hover,u_)}),t.on(["connectionSegment.move.out","connectionSegment.move.cleanup"],function(p){var f=p.context.hover;f&&n.removeMarker(f,u_)}),t.on("connectionSegment.move.cleanup",function(p){var f=p.context,d=f.connection;f.draggerGfx&&Dt(f.draggerGfx),n.removeMarker(d,l_)}),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(w){return{original:w.original,x:Math.round(w.x),y:Math.round(w.y)}});var g=l(h,m),S=g.waypoints,E=s(d,S),b=g.segmentOffset,x={segmentMove:{segmentStartIndex:f.segmentStartIndex,newSegmentStartIndex:m+b}};o.updateWaypoints(d,E,x)})}h_.$inject=["injector","eventBus","canvas","dragging","graphicsFactory","modeling"];var CM=Math.abs,m_=Math.round;function PM(e,t,n){n=n===void 0?10:n;var i,r;for(i=0;i<t.length;i++)if(r=t[i],CM(r-e)<=n)return r}function g_(e){return{x:e.x,y:e.y}}function v_(e){return{x:e.x+e.width,y:e.y+e.height}}function Wn(e,t){return!e||isNaN(e.x)||isNaN(e.y)?t:{x:m_(e.x+e.width/2),y:m_(e.y+e.height/2)}}function Co(e,t){var n=e.snapped;return n?typeof t=="string"?n[t]:n.x&&n.y:!1}function Ct(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 y_(e){return e.children||[]}var AM=Math.abs,__=Math.round,sf=10;function b_(e){function t(o,a){if(pe(o)){for(var s=o.length;s--;)if(AM(o[s]-a)<=sf)return o[s]}else{o=+o;var c=a%o;if(c<sf)return a-c;if(c>o-sf)return a-c+o}return a}function n(o,a){if(o.waypoints)return _M(a,o);if(o.width)return{x:__(o.width/2+o.x),y:__(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;D(o,{dx:o.dx-p,dy:o.dy-f,x:u,y:l}),(p||a.vertical.indexOf(s)!==-1)&&Ct(o,"x",u),(f||a.horizontal.indexOf(c)!==-1)&&Ct(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);!Xe(s)||!c||!c.x||!c.y||(Ct(o,"x",c.x),Ct(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;D(o,{dx:o.dx-h,dy:o.dy-m,x:o.x-h,y:o.y-m}),(h||s.vertical.indexOf(l)!==-1)&&Ct(o,"x",f),(m||s.horizontal.indexOf(p)!==-1)&&Ct(o,"y",d)}})}b_.$inject=["eventBus"];const TM={__depends__:[Pi,fi],__init__:["bendpoints","bendpointSnapping","bendpointMovePreview"],bendpoints:["type",t_],bendpointMove:["type",of],bendpointMovePreview:["type",c_],connectionSegmentMove:["type",h_],bendpointSnapping:["type",b_]};function x_(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),!Vr(l)){if(l!==!1){s.source=c,s.target=u;return}l=s.canExecute=o(c,u),!Vr(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:cf(s)?l:u,connectionEnd:cf(s)?u:l};Nt(c)&&(d=c),s.connection=n.connect(p,f,d,h)}),this.start=function(a,s,c,u){Nt(c)||(u=c,c=fe(s)),t.init(a,"connect",{autoActivate:u,data:{shape:s,context:{start:s,connectionStart:c}}})}}x_.$inject=["eventBus","dragging","modeling","rules"];function cf(e){var t=e.hover,n=e.source,i=e.target;return t&&n&&t===n&&n!==i}var MM=1100,kM=900,E_="connect-ok",w_="connect-not-ok";function S_(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;cf(o)&&(h=d,m=f),i.drawPreview(o,a,{source:c||u,target:p||s,connectionStart:h,connectionEnd:m})}),t.on("connect.hover",kM,function(r){var o=r.context,a=r.hover,s=o.canExecute;s!==null&&n.addMarker(a,s?E_:w_)}),t.on(["connect.out","connect.cleanup"],MM,function(r){var o=r.hover;o&&(n.removeMarker(o,E_),n.removeMarker(o,w_))}),i&&t.on("connect.cleanup",function(r){i.cleanUp(r.context)})}S_.$inject=["injector","eventBus","canvas"];const uf={__depends__:[zn,fi,Pi],__init__:["connectPreview"],connect:["type",x_],connectPreview:["type",S_]};var DM="djs-dragger";function Ii(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)}Ii.$inject=["injector","canvas","graphicsFactory","elementFactory"],Ii.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()),os(i),r||(r=e.getConnection=OM(function(m,g,S){return h.getConnection(m,g,S)})),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?fe(o):c,a?fe(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)"})},Ii.prototype.drawNoopPreview=function(e,t){var n=t.source,i=t.target,r=t.connectionStart||fe(n),o=t.connectionEnd||fe(i),a=this.cropWaypoints(r,o,n,i),s=this.createNoopConnection(a[0],a[1]);ye(e,s)},Ii.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&&zo(o,s,!0)||e,t=i&&zo(a,s,!1)||t,[e,t]},Ii.prototype.cleanUp=function(e){e&&e.connectionPreviewGfx&&Dt(e.connectionPreviewGfx)},Ii.prototype.getConnection=function(e){var t=IM(e);return this._elementFactory.createConnection(t)},Ii.prototype.createConnectionPreviewGfx=function(){var e=ce("g");return ne(e,{pointerEvents:"none"}),ke(e).add(DM),ye(this._canvas.getActiveLayer(),e),e},Ii.prototype.createNoopConnection=function(e,t){return $o([e,t],{stroke:"#333",strokeDasharray:[1],strokeWidth:2,"pointer-events":"none"})};function OM(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 IM(e){return Nt(e)?e:{}}const LM={__init__:["connectionPreview"],connectionPreview:["type",Ii]},Gc="complex-preview";class R_{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(Gc);n.filter(s=>!NM(s)).forEach(s=>{let c;Xe(s)?(c=this._graphicsFactory._createContainer("connection",ce("g")),this._graphicsFactory.drawConnection(Cr(c),s)):(c=this._graphicsFactory._createContainer("shape",ce("g")),this._graphicsFactory.drawShape(Cr(c),s),Wt(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);Xe(s)?Wt(u,c.x,c.y):Wt(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",ce("g"));this._graphicsFactory.drawShape(Cr(u),s,{width:c.width,height:c.height}),Wt(u,c.x,c.y),this._previewSupport.addDragger(s,a,u)})}cleanUp(){os(this._canvas.getLayer(Gc)),this._markers.forEach(([t,n])=>this._canvas.removeMarker(t,n)),this._markers=[]}show(){this._canvas.showLayer(Gc)}hide(){this._canvas.hideLayer(Gc)}}R_.$inject=["canvas","graphicsFactory","previewSupport"];function NM(e){return e.hidden}const BM={__depends__:[go],__init__:["complexPreview"],complexPreview:["type",R_]},C_=Math.round;function Wc(e,t,n,i,r,o){this._complexPreview=e,this._connectionDocking=t,this._elementFactory=n,this._eventBus=i,this._layouter=r,this._rules=o}Wc.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(D({type:t},n)),l=a.fire("autoPlace",{source:e,shape:u});if(!l)return;D(u,{x:l.x-C_(u.width/2),y:l.y-C_(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=>!Vr(d))})},Wc.prototype.cleanUp=function(){this._complexPreview.cleanUp()},Wc.$inject=["complexPreview","connectionDocking","elementFactory","eventBus","layouter","rules"];const $M={__depends__:[yc,BM,Ip],__init__:["appendPreview"],appendPreview:["type",Wc]};var P_=Math.min,A_=Math.max;function lf(e){e.preventDefault()}function Ta(e){e.stopPropagation()}function jM(e){return e.nodeType===Node.TEXT_NODE}function FM(e){return[].slice.call(e)}function Qn(e){this.container=e.container,this.parent=nt('<div class="djs-direct-editing-parent"><div class="djs-direct-editing-content" contenteditable="true"></div></div>'),this.content=qe("[contenteditable]",this.parent),this.keyHandler=e.keyHandler||function(){},this.resizeHandler=e.resizeHandler||function(){},this.focusoutHandler=e.focusoutHandler||function(){},this.autoResize=dn(this.autoResize,this),this.handlePaste=dn(this.handlePaste,this)}Qn.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=Xn(t,["width","height","maxWidth","maxHeight","minWidth","minHeight","left","top","backgroundColor","position","overflow","border","wordWrap","textAlign","outline","transform"]);D(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=Xn(t,["fontFamily","fontSize","fontWeight","lineHeight","padding","paddingTop","paddingRight","paddingBottom","paddingLeft"]);return D(a.style,{boxSizing:"border-box",width:"100%",outline:"none",wordWrap:"break-word"},u),i.centerVertically&&D(a.style,{position:"absolute",top:"50%",transform:"translate(0, -50%)"},u),a.innerText=n,ve.bind(a,"keydown",this.keyHandler),ve.bind(a,"mousedown",Ta),ve.bind(a,"paste",r.handlePaste),ve.bind(a,"focusout",this.focusoutHandler),i.autoResize&&ve.bind(a,"input",this.autoResize),i.resizable&&this.resizable(t),s.appendChild(o),this.setSelection(a.lastChild,a.lastChild&&a.lastChild.length),o},Qn.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)}},Qn.prototype.insertText=function(e){e=HM(e);var t=document.execCommand("insertText",!1,e);t||this._insertTextIE(e)},Qn.prototype._insertTextIE=function(e){var t=this.getSelection(),n=t.startContainer,i=t.endContainer,r=t.startOffset,o=t.endOffset,a=t.commonAncestorContainer,s=FM(a.childNodes),c,u;if(jM(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&&ai(h)}),c=n,u=r+e.length}c&&u!==void 0&&setTimeout(function(){self.setSelection(c,u)})},Qn.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})}},Qn.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=nt('<div class="djs-direct-editing-resize-handle"></div>');var s,c,u,l,p=function(h){lf(h),Ta(h),s=h.clientX,c=h.clientY;var m=t.getBoundingClientRect();u=m.width,l=m.height,ve.bind(document,"mousemove",f),ve.bind(document,"mouseup",d)},f=function(h){lf(h),Ta(h);var m=P_(A_(u+h.clientX-s,i),o),g=P_(A_(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){lf(h),Ta(h),ve.unbind(document,"mousemove",f,!1),ve.unbind(document,"mouseup",d,!1)};ve.bind(n,"mousedown",p)}D(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)},Qn.prototype.destroy=function(){var e=this.parent,t=this.content,n=this.resizeHandle;t.innerText="",e.removeAttribute("style"),t.removeAttribute("style"),ve.unbind(t,"keydown",this.keyHandler),ve.unbind(t,"mousedown",Ta),ve.unbind(t,"input",this.autoResize),ve.unbind(t,"paste",this.handlePaste),ve.unbind(t,"focusout",this.focusoutHandler),n&&(n.removeAttribute("style"),ai(n)),ai(e)},Qn.prototype.getValue=function(){return this.content.innerText.trim()},Qn.prototype.getSelection=function(){var e=window.getSelection(),t=e.getRangeAt(0);return t},Qn.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 HM(e){return e.replace(/\r\n|\r|\n/g,`
|
|
316
|
+
`)}function Cn(e,t){this._eventBus=e,this._canvas=t,this._providers=[],this._textbox=new Qn({container:t.getContainer(),keyHandler:dn(this._handleKey,this),resizeHandler:dn(this._handleResize,this),focusoutHandler:dn(this._handleFocusout,this)}),e.on(["diagram.clear","diagram.destroy"],()=>this._cleanup())}Cn.$inject=["eventBus","canvas"],Cn.prototype.registerProvider=function(e){this._providers.push(e)},Cn.prototype.isActive=function(e){return!!(this._active&&(!e||this._active.element===e))},Cn.prototype.cancel=function(){this._active&&(this._fire("cancel"),this.close())},Cn.prototype._fire=function(e,t){this._eventBus.fire("directEditing."+e,t||{active:this._active})},Cn.prototype.close=function(){this._fire("deactivate"),this._cleanup(),this._canvas.restoreFocus&&this._canvas.restoreFocus()},Cn.prototype._cleanup=function(){this._active&&(this._textbox.destroy(),this._active=null,this.resizable=void 0)},Cn.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()}},Cn.prototype.getValue=function(){return this._textbox.getValue()},Cn.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()},Cn.prototype._handleResize=function(e){this._fire("resize",e)},Cn.prototype._handleFocusout=function(e){e.relatedTarget&&this._textbox.parent.contains(e.relatedTarget)||this.complete()},Cn.prototype.activate=function(e){if(this.isActive()&&this.cancel(),this._eventBus.fire("directEditing.activate.allowed",{element:e})===!1)return!1;var t,n=et(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 T_={__depends__:[Ys],__init__:["directEditing"],directEditing:["type",Cn]};function zM(e){return function(t){var n=t.target,i=q(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===Me(e);return!o||!a||!s||!c}}const VM={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 W(e,t={}){var n=VM[e];if(!n)throw new Error("unknown popup entry <"+e+">");return{...n,actionName:"replace-with-"+e,...t}}var GM=[W("none-start-event",{actionName:"replace-with-none-start"}),W("none-intermediate-throwing"),W("none-end-event",{actionName:"replace-with-none-end"}),W("message-start"),W("timer-start"),W("conditional-start"),W("signal-start")],WM=[W("none-start-event",{actionName:"replace-with-none-start"}),W("none-intermediate-throwing"),W("none-end-event",{actionName:"replace-with-none-end"})],UM=[W("none-start-event",{actionName:"replace-with-none-start"}),W("none-intermediate-throwing",{actionName:"replace-with-none-intermediate-throw"}),W("none-end-event",{actionName:"replace-with-none-end"}),W("message-intermediate-catch"),W("message-intermediate-throw"),W("timer-intermediate-catch"),W("escalation-intermediate-throw"),W("conditional-intermediate-catch"),W("link-intermediate-catch"),W("link-intermediate-throw"),W("compensation-intermediate-throw"),W("signal-intermediate-catch"),W("signal-intermediate-throw")],qM=[W("none-start-event",{actionName:"replace-with-none-start"}),W("none-intermediate-throwing",{actionName:"replace-with-none-intermediate-throw"}),W("none-end-event",{actionName:"replace-with-none-end"}),W("message-end"),W("escalation-end"),W("error-end"),W("cancel-end"),W("compensation-end"),W("signal-end"),W("terminate-end")],YM=[W("exclusive-gateway"),W("parallel-gateway"),W("inclusive-gateway"),W("complex-gateway"),W("event-based-gateway")],KM=[W("transaction"),W("event-subprocess"),W("expanded-ad-hoc-subprocess",{actionName:"replace-with-ad-hoc-subprocess",label:"Ad-hoc sub-process"}),W("collapsed-subprocess")],XM=[W("expanded-subprocess",{actionName:"replace-with-subprocess",label:"Sub-process"}),W("transaction"),W("event-subprocess"),W("collapsed-ad-hoc-subprocess")],M_=[W("transaction"),W("expanded-subprocess",{actionName:"replace-with-subprocess",label:"Sub-process"}),W("expanded-ad-hoc-subprocess",{actionName:"replace-with-ad-hoc-subprocess",label:"Ad-hoc sub-process"}),W("event-subprocess")],ZM=M_,k_=[W("task"),W("user-task"),W("service-task"),W("send-task"),W("receive-task"),W("manual-task"),W("rule-task"),W("script-task"),W("call-activity"),W("collapsed-subprocess"),W("expanded-subprocess"),W("collapsed-ad-hoc-subprocess"),W("expanded-ad-hoc-subprocess",{actionName:"replace-with-ad-hoc-subprocess"})],QM=[W("data-store-reference")],JM=[W("data-object-reference")],e2=[W("message-boundary"),W("timer-boundary"),W("escalation-boundary"),W("conditional-boundary"),W("error-boundary"),W("cancel-boundary"),W("signal-boundary"),W("compensation-boundary"),W("non-interrupting-message-boundary"),W("non-interrupting-timer-boundary"),W("non-interrupting-escalation-boundary"),W("non-interrupting-conditional-boundary"),W("non-interrupting-signal-boundary")],t2=[W("message-start"),W("timer-start"),W("conditional-start"),W("signal-start"),W("error-start"),W("escalation-start"),W("compensation-start"),W("non-interrupting-message-start"),W("non-interrupting-timer-start"),W("non-interrupting-conditional-start"),W("non-interrupting-signal-start"),W("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"}],i2=[W("expanded-pool"),W("collapsed-pool",{label:function(e){var t="Empty pool/participant";return e.children&&e.children.length&&(t+=" (removes content)"),t}})],r2={"bpmn:MessageEventDefinition":[W("message-start"),W("message-intermediate-catch"),W("message-intermediate-throw"),W("message-end")],"bpmn:TimerEventDefinition":[W("timer-start"),W("timer-intermediate-catch")],"bpmn:ConditionalEventDefinition":[W("conditional-start"),W("conditional-intermediate-catch")],"bpmn:SignalEventDefinition":[W("signal-start"),W("signal-intermediate-catch"),W("signal-intermediate-throw"),W("signal-end")],"bpmn:ErrorEventDefinition":[W("error-start"),W("error-end")],"bpmn:EscalationEventDefinition":[W("escalation-start"),W("escalation-intermediate-throw"),W("escalation-end")],"bpmn:CompensateEventDefinition":[W("compensation-start"),W("compensation-intermediate-throw"),W("compensation-end")]};const D_={"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 Vn(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()}Vn.$inject=["bpmnFactory","popupMenu","modeling","moddle","bpmnReplace","rules","translate","moddleCopy"],Vn.prototype._register=function(){this._popupMenu.registerProvider("bpmn-replace",this)},Vn.prototype.getPopupMenuEntries=function(e){var s;var t=e.businessObject,n=this._rules,i=[],r,o=[];if(pe(e)||!n.allowed("shape.replace",{element:e}))return{};var a=zM(e);return y(t,"bpmn:DataObjectReference")?this._createEntries(e,QM):y(t,"bpmn:DataStoreReference")&&!y(e.parent,"bpmn:Collaboration")?this._createEntries(e,JM):(y(t,"bpmn:Event")&&!y(t,"bpmn:BoundaryEvent")&&(r=(s=t.get("eventDefinitions")[0])==null?void 0:s.$type,i=r2[r]||[],!en(t.$parent)&&y(t.$parent,"bpmn:SubProcess")&&(i=Re(i,function(c){return c.target.type!=="bpmn:StartEvent"}))),y(t,"bpmn:StartEvent")&&!y(t.$parent,"bpmn:SubProcess")?(o=Re(GM.concat(i),a),this._createEntries(e,o)):y(t,"bpmn:Participant")?(o=Re(i2,function(c){return Pe(e)!==c.target.isExpanded}),this._createEntries(e,o)):y(t,"bpmn:StartEvent")&&en(t.$parent)?(o=Re(t2.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)):y(t,"bpmn:StartEvent")&&!en(t.$parent)&&y(t.$parent,"bpmn:SubProcess")?(o=Re(WM.concat(i),a),this._createEntries(e,o)):y(t,"bpmn:EndEvent")?(o=Re(qM.concat(i),function(c){var u=c.target;return u.eventDefinitionType=="bpmn:CancelEventDefinition"&&!y(t.$parent,"bpmn:Transaction")?!1:a(c)}),this._createEntries(e,o)):y(t,"bpmn:BoundaryEvent")?(o=Re(e2,function(c){var u=c.target;if(u.eventDefinitionType=="bpmn:CancelEventDefinition"&&!y(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)):y(t,"bpmn:IntermediateCatchEvent")||y(t,"bpmn:IntermediateThrowEvent")?(o=Re(UM.concat(i),a),this._createEntries(e,o)):y(t,"bpmn:Gateway")?(o=Re(YM,a),this._createEntries(e,o)):y(t,"bpmn:Transaction")?(o=Re(M_,a),this._createEntries(e,o)):en(t)&&Pe(e)?(o=Re(ZM,a),this._createEntries(e,o)):y(t,"bpmn:AdHocSubProcess")&&Pe(e)?(o=Re(XM,a),this._createEntries(e,o)):y(t,"bpmn:SubProcess")&&Pe(e)?(o=Re(KM,a),this._createEntries(e,o)):y(t,"bpmn:SubProcess")&&!Pe(e)?(o=Re(k_,function(c){var u=c.target.type===e.type,l=c.target.isExpanded===!0;return u===l}),this._createEntries(e,o)):y(t,"bpmn:SequenceFlow")?this._createSequenceFlowEntries(e,n2):y(t,"bpmn:FlowNode")?(o=Re(k_,a),this._createEntries(e,o)):{})},Vn.prototype.getPopupMenuHeaderEntries=function(e){var t={};return y(e,"bpmn:Activity")&&!en(e)&&(t={...t,...this._getLoopCharacteristicsHeaderEntries(e)}),y(e,"bpmn:DataObjectReference")&&(t={...t,...this._getCollectionHeaderEntries(e)}),y(e,"bpmn:Participant")&&(t={...t,...this._getParticipantMultiplicityHeaderEntries(e)}),Pm(e)&&(t={...t,...this._getNonInterruptingHeaderEntries(e)}),t},Vn.prototype._createEntries=function(e,t){var n={},i=this;return M(t,function(r){n[r.actionName]=i._createEntry(r,e)}),n},Vn.prototype._createSequenceFlowEntries=function(e,t){var n=q(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&&(y(n.sourceRef,"bpmn:ExclusiveGateway")||y(n.sourceRef,"bpmn:InclusiveGateway")||y(n.sourceRef,"bpmn:ComplexGateway")||y(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&&y(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:y(n.sourceRef,"bpmn:Activity")&&n.conditionExpression&&(i={...i,[s.actionName]:a._createEntry(s,e,function(){r.updateProperties(e,{conditionExpression:void 0})})}),(y(n.sourceRef,"bpmn:ExclusiveGateway")||y(n.sourceRef,"bpmn:InclusiveGateway")||y(n.sourceRef,"bpmn:ComplexGateway")||y(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},Vn.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}},Vn.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&&y(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=q(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"}}}},Vn.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}}},Vn.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}}},Vn.prototype._getNonInterruptingHeaderEntries=function(e){const t=this._translate,n=q(e),i=this,r=Am(e),o=y(e,"bpmn:BoundaryEvent")?D_["intermediate-event-non-interrupting"]:D_["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 o2={__depends__:[Jp,Yg,yc],__init__:["replaceMenuProvider"],replaceMenuProvider:["type",Vn]};function Ta(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(!(!ea(d)||!i.isOpen(m))){var g=i.getEntries(m);g.replace&&g.replace.action.click(d,m)}}),n.on("contextPad.close",function(){f.cleanUp()})}Ta.$inject=["config.contextPad","injector","eventBus","contextPad","modeling","elementFactory","connect","create","popupMenu","canvas","rules","translate","appendPreview"],Ta.prototype.getMultiElementContextPadEntries=function(e){var t=this._modeling,n={};return this._isDeleteAllowed(e)&&D(n,{delete:{group:"edit",className:"bpmn-icon-trash",title:this._translate("Delete"),action:{click:function(i,r){t.removeElements(r.slice())}}}}),n},Ta.prototype._isDeleteAllowed=function(e){var t=this._rules.allowed("elements.delete",{elements:e});return pe(t)?yr(e,n=>t.includes(n)):t},Ta.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])&&D(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,w=t.getPad(b).html,T=w.getBoundingClientRect(),I={x:T.left,y:T.bottom+x};return I}function g(b,x,w,T){function I(F,L){var H=i.createShape(D({type:b},T));o.start(F,H,{source:L})}var P=s?function(F,L){var H=i.createShape(D({type:b},T));s.append(L,H)}:I,j=s?function(F,L){return u.create(L,b,T),()=>{u.cleanUp()}}:null;return{group:"model",className:x,title:w,action:{dragstart:I,click:P,hover:j}}}function S(b){return function(x,w){n.splitLane(w,b),t.open(w,!0)}}if(Ee(p,["bpmn:Lane","bpmn:Participant"])&&Pe(e)){var E=Zi(e);D(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")}}}}),E.length<2&&((Bt(e)?e.height>=120:e.width>=120)&&D(l,{"lane-divide-two":{group:"lane-divide",className:"bpmn-icon-lane-divide-two",title:c("Divide into two lanes"),action:{click:S(2)}}}),(Bt(e)?e.height>=180:e.width>=180)&&D(l,{"lane-divide-three":{group:"lane-divide",className:"bpmn-icon-lane-divide-three",title:c("Divide into three lanes"),action:{click:S(3)}}})),D(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 y(p,"bpmn:FlowNode")&&(y(p,"bpmn:EventBasedGateway")?D(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"})}):O_(p,"bpmn:BoundaryEvent","bpmn:CompensateEventDefinition")?D(l,{"append.compensation-activity":g("bpmn:Task","bpmn-icon-task",c("Append compensation activity"),{isForCompensation:!0})}):!y(p,"bpmn:EndEvent")&&!p.isForCompensation&&!O_(p,"bpmn:IntermediateThrowEvent","bpmn:LinkEventDefinition")&&!en(p)&&D(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")||D(l,{replace:{group:"edit",className:"bpmn-icon-screw-wrench",title:c("Change element"),action:{click:function(b,x){var w=D(m(x),{cursor:{x:b.x,y:b.y}});a.open(x,"bpmn-replace",w,{title:c("Change element"),width:"var(--bpmn-replace-popup-width, 300px)",search:!0})}}}}),y(p,"bpmn:SequenceFlow")&&D(l,{"append.text-annotation":g("bpmn:TextAnnotation","bpmn-icon-text-annotation",c("Add text annotation"))}),y(p,"bpmn:MessageFlow")&&D(l,{"append.text-annotation":g("bpmn:TextAnnotation","bpmn-icon-text-annotation",c("Add text annotation"))}),Ee(p,["bpmn:FlowNode","bpmn:InteractionNode","bpmn:DataObjectReference","bpmn:DataStoreReference"])&&D(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}}}),y(p,"bpmn:TextAnnotation")&&D(l,{connect:{group:"connect",className:"bpmn-icon-connection-multi",title:c("Connect using association"),action:{click:f,dragstart:f}}}),Ee(p,["bpmn:DataObjectReference","bpmn:DataStoreReference"])&&D(l,{connect:{group:"connect",className:"bpmn-icon-connection-multi",title:c("Connect using data input association"),action:{click:f,dragstart:f}}}),y(p,"bpmn:Group")&&D(l,{"append.text-annotation":g("bpmn:TextAnnotation","bpmn-icon-text-annotation",c("Add text annotation"))}),this._isDeleteAllowed([e])&&D(l,h()),l};function O_(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 a2={__depends__:[$M,T_,cy,jn,cf,Xs,o2],__init__:["contextPadProvider"],contextPadProvider:["type",Ta]};var s2={horizontal:["x","width"],vertical:["y","height"]},I_=5;function Ii(e,t){this._modeling=e,this._filters=[],this.registerFilter(function(n){var i=t.allowed("elements.distribute",{elements:n});return pe(i)?i:i?n:[]})}Ii.$inject=["modeling","rules"],Ii.prototype.registerFilter=function(e){if(typeof e!="function")throw new Error("the filter has to be a function");this._filters.push(e)},Ii.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},Ii.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},Ii.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=Jn(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},Ii.prototype._setOrientation=function(e){var t=s2[e];this._axis=t[0],this._dimension=t[1]},Ii.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)},Ii.prototype._findRange=function(e){var t=e[this._axis],n=e[this._dimension];return{min:t+I_,max:t+n-I_}};const c2={__init__:["distributeElements"],distributeElements:["type",Ii]};function Uc(e){$n.call(this,e)}Uc.$inject=["eventBus"],te(Uc,$n),Uc.prototype.init=function(){this.addRule("elements.distribute",function(e){var t=e.elements;return t=Re(t,function(n){var i=Ee(n,["bpmn:Association","bpmn:BoundaryEvent","bpmn:DataInputAssociation","bpmn:DataOutputAssociation","bpmn:Lane","bpmn:MessageFlow","bpmn:SequenceFlow","bpmn:TextAnnotation"]);return!(n.labelTarget||i)}),t=cs(t),t.length<3?!1:t})};var L_={horizontal:`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1800 1800">
|
|
327
|
+
</svg>`};function Un(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()}Un.$inject=["bpmnFactory","popupMenu","modeling","moddle","bpmnReplace","rules","translate","moddleCopy"],Un.prototype._register=function(){this._popupMenu.registerProvider("bpmn-replace",this)},Un.prototype.getPopupMenuEntries=function(e){var s;var t=e.businessObject,n=this._rules,i=[],r,o=[];if(pe(e)||!n.allowed("shape.replace",{element:e}))return{};var a=zM(e);return y(t,"bpmn:DataObjectReference")?this._createEntries(e,QM):y(t,"bpmn:DataStoreReference")&&!y(e.parent,"bpmn:Collaboration")?this._createEntries(e,JM):(y(t,"bpmn:Event")&&!y(t,"bpmn:BoundaryEvent")&&(r=(s=t.get("eventDefinitions")[0])==null?void 0:s.$type,i=r2[r]||[],!nn(t.$parent)&&y(t.$parent,"bpmn:SubProcess")&&(i=Ae(i,function(c){return c.target.type!=="bpmn:StartEvent"}))),y(t,"bpmn:StartEvent")&&!y(t.$parent,"bpmn:SubProcess")?(o=Ae(GM.concat(i),a),this._createEntries(e,o)):y(t,"bpmn:Participant")?(o=Ae(i2,function(c){return Me(e)!==c.target.isExpanded}),this._createEntries(e,o)):y(t,"bpmn:StartEvent")&&nn(t.$parent)?(o=Ae(t2.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)):y(t,"bpmn:StartEvent")&&!nn(t.$parent)&&y(t.$parent,"bpmn:SubProcess")?(o=Ae(WM.concat(i),a),this._createEntries(e,o)):y(t,"bpmn:EndEvent")?(o=Ae(qM.concat(i),function(c){var u=c.target;return u.eventDefinitionType=="bpmn:CancelEventDefinition"&&!y(t.$parent,"bpmn:Transaction")?!1:a(c)}),this._createEntries(e,o)):y(t,"bpmn:BoundaryEvent")?(o=Ae(e2,function(c){var u=c.target;if(u.eventDefinitionType=="bpmn:CancelEventDefinition"&&!y(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)):y(t,"bpmn:IntermediateCatchEvent")||y(t,"bpmn:IntermediateThrowEvent")?(o=Ae(UM.concat(i),a),this._createEntries(e,o)):y(t,"bpmn:Gateway")?(o=Ae(YM,a),this._createEntries(e,o)):y(t,"bpmn:Transaction")?(o=Ae(M_,a),this._createEntries(e,o)):nn(t)&&Me(e)?(o=Ae(ZM,a),this._createEntries(e,o)):y(t,"bpmn:AdHocSubProcess")&&Me(e)?(o=Ae(XM,a),this._createEntries(e,o)):y(t,"bpmn:SubProcess")&&Me(e)?(o=Ae(KM,a),this._createEntries(e,o)):y(t,"bpmn:SubProcess")&&!Me(e)?(o=Ae(k_,function(c){var u=c.target.type===e.type,l=c.target.isExpanded===!0;return u===l}),this._createEntries(e,o)):y(t,"bpmn:SequenceFlow")?this._createSequenceFlowEntries(e,n2):y(t,"bpmn:FlowNode")?(o=Ae(k_,a),this._createEntries(e,o)):{})},Un.prototype.getPopupMenuHeaderEntries=function(e){var t={};return y(e,"bpmn:Activity")&&!nn(e)&&(t={...t,...this._getLoopCharacteristicsHeaderEntries(e)}),y(e,"bpmn:DataObjectReference")&&(t={...t,...this._getCollectionHeaderEntries(e)}),y(e,"bpmn:Participant")&&(t={...t,...this._getParticipantMultiplicityHeaderEntries(e)}),Pm(e)&&(t={...t,...this._getNonInterruptingHeaderEntries(e)}),t},Un.prototype._createEntries=function(e,t){var n={},i=this;return M(t,function(r){n[r.actionName]=i._createEntry(r,e)}),n},Un.prototype._createSequenceFlowEntries=function(e,t){var n=q(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&&(y(n.sourceRef,"bpmn:ExclusiveGateway")||y(n.sourceRef,"bpmn:InclusiveGateway")||y(n.sourceRef,"bpmn:ComplexGateway")||y(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&&y(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:y(n.sourceRef,"bpmn:Activity")&&n.conditionExpression&&(i={...i,[s.actionName]:a._createEntry(s,e,function(){r.updateProperties(e,{conditionExpression:void 0})})}),(y(n.sourceRef,"bpmn:ExclusiveGateway")||y(n.sourceRef,"bpmn:InclusiveGateway")||y(n.sourceRef,"bpmn:ComplexGateway")||y(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},Un.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}},Un.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&&y(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=q(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"}}}},Un.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}}},Un.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}}},Un.prototype._getNonInterruptingHeaderEntries=function(e){const t=this._translate,n=q(e),i=this,r=Am(e),o=y(e,"bpmn:BoundaryEvent")?D_["intermediate-event-non-interrupting"]:D_["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 o2={__depends__:[ef,Yg,yc],__init__:["replaceMenuProvider"],replaceMenuProvider:["type",Un]};function Ma(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(!(!ta(d)||!i.isOpen(m))){var g=i.getEntries(m);g.replace&&g.replace.action.click(d,m)}}),n.on("contextPad.close",function(){f.cleanUp()})}Ma.$inject=["config.contextPad","injector","eventBus","contextPad","modeling","elementFactory","connect","create","popupMenu","canvas","rules","translate","appendPreview"],Ma.prototype.getMultiElementContextPadEntries=function(e){var t=this._modeling,n={};return this._isDeleteAllowed(e)&&D(n,{delete:{group:"edit",className:"bpmn-icon-trash",title:this._translate("Delete"),action:{click:function(i,r){t.removeElements(r.slice())}}}}),n},Ma.prototype._isDeleteAllowed=function(e){var t=this._rules.allowed("elements.delete",{elements:e});return pe(t)?yr(e,n=>t.includes(n)):t},Ma.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])&&D(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,w=t.getPad(b).html,T=w.getBoundingClientRect(),I={x:T.left,y:T.bottom+x};return I}function g(b,x,w,T){function I(F,L){var H=i.createShape(D({type:b},T));o.start(F,H,{source:L})}var P=s?function(F,L){var H=i.createShape(D({type:b},T));s.append(L,H)}:I,j=s?function(F,L){return u.create(L,b,T),()=>{u.cleanUp()}}:null;return{group:"model",className:x,title:w,action:{dragstart:I,click:P,hover:j}}}function S(b){return function(x,w){n.splitLane(w,b),t.open(w,!0)}}if(Se(p,["bpmn:Lane","bpmn:Participant"])&&Me(e)){var E=Qi(e);D(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")}}}}),E.length<2&&((jt(e)?e.height>=120:e.width>=120)&&D(l,{"lane-divide-two":{group:"lane-divide",className:"bpmn-icon-lane-divide-two",title:c("Divide into two lanes"),action:{click:S(2)}}}),(jt(e)?e.height>=180:e.width>=180)&&D(l,{"lane-divide-three":{group:"lane-divide",className:"bpmn-icon-lane-divide-three",title:c("Divide into three lanes"),action:{click:S(3)}}})),D(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 y(p,"bpmn:FlowNode")&&(y(p,"bpmn:EventBasedGateway")?D(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"})}):O_(p,"bpmn:BoundaryEvent","bpmn:CompensateEventDefinition")?D(l,{"append.compensation-activity":g("bpmn:Task","bpmn-icon-task",c("Append compensation activity"),{isForCompensation:!0})}):!y(p,"bpmn:EndEvent")&&!p.isForCompensation&&!O_(p,"bpmn:IntermediateThrowEvent","bpmn:LinkEventDefinition")&&!nn(p)&&D(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")||D(l,{replace:{group:"edit",className:"bpmn-icon-screw-wrench",title:c("Change element"),action:{click:function(b,x){var w=D(m(x),{cursor:{x:b.x,y:b.y}});a.open(x,"bpmn-replace",w,{title:c("Change element"),width:"var(--bpmn-replace-popup-width, 300px)",search:!0})}}}}),y(p,"bpmn:SequenceFlow")&&D(l,{"append.text-annotation":g("bpmn:TextAnnotation","bpmn-icon-text-annotation",c("Add text annotation"))}),y(p,"bpmn:MessageFlow")&&D(l,{"append.text-annotation":g("bpmn:TextAnnotation","bpmn-icon-text-annotation",c("Add text annotation"))}),Se(p,["bpmn:FlowNode","bpmn:InteractionNode","bpmn:DataObjectReference","bpmn:DataStoreReference"])&&D(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}}}),y(p,"bpmn:TextAnnotation")&&D(l,{connect:{group:"connect",className:"bpmn-icon-connection-multi",title:c("Connect using association"),action:{click:f,dragstart:f}}}),Se(p,["bpmn:DataObjectReference","bpmn:DataStoreReference"])&&D(l,{connect:{group:"connect",className:"bpmn-icon-connection-multi",title:c("Connect using data input association"),action:{click:f,dragstart:f}}}),y(p,"bpmn:Group")&&D(l,{"append.text-annotation":g("bpmn:TextAnnotation","bpmn-icon-text-annotation",c("Add text annotation"))}),this._isDeleteAllowed([e])&&D(l,h()),l};function O_(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 a2={__depends__:[$M,T_,cy,zn,uf,Xs,o2],__init__:["contextPadProvider"],contextPadProvider:["type",Ma]};var s2={horizontal:["x","width"],vertical:["y","height"]},I_=5;function Li(e,t){this._modeling=e,this._filters=[],this.registerFilter(function(n){var i=t.allowed("elements.distribute",{elements:n});return pe(i)?i:i?n:[]})}Li.$inject=["modeling","rules"],Li.prototype.registerFilter=function(e){if(typeof e!="function")throw new Error("the filter has to be a function");this._filters.push(e)},Li.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},Li.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},Li.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=ei(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},Li.prototype._setOrientation=function(e){var t=s2[e];this._axis=t[0],this._dimension=t[1]},Li.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)},Li.prototype._findRange=function(e){var t=e[this._axis],n=e[this._dimension];return{min:t+I_,max:t+n-I_}};const c2={__init__:["distributeElements"],distributeElements:["type",Li]};function Uc(e){Hn.call(this,e)}Uc.$inject=["eventBus"],te(Uc,Hn),Uc.prototype.init=function(){this.addRule("elements.distribute",function(e){var t=e.elements;return t=Ae(t,function(n){var i=Se(n,["bpmn:Association","bpmn:BoundaryEvent","bpmn:DataInputAssociation","bpmn:DataOutputAssociation","bpmn:Lane","bpmn:MessageFlow","bpmn:SequenceFlow","bpmn:TextAnnotation"]);return!(n.labelTarget||i)}),t=cs(t),t.length<3?!1:t})};var L_={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>`},u2=900;function Ma(e,t,n,i){this._distributeElements=t,this._translate=n,this._popupMenu=e,this._rules=i,e.registerProvider("align-elements",u2,this)}Ma.$inject=["popupMenu","distributeElements","translate","rules"],Ma.prototype.getPopupMenuEntries=function(e){var t={};return this._isAllowed(e)&&D(t,this._getEntries(e)),t},Ma.prototype._isAllowed=function(e){return this._rules.allowed("elements.distribute",{elements:e})},Ma.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:L_.horizontal,action:function(o,a){t.trigger(e,"horizontal"),i.close()}},"distribute-elements-vertical":{group:"distribute",title:n("Distribute elements vertically"),imageHtml:L_.vertical,action:function(o,a){t.trigger(e,"vertical"),i.close()}}};return r};const l2={__depends__:[Jp,c2],__init__:["bpmnDistributeElements","distributeElementsMenuProvider"],bpmnDistributeElements:["type",Uc],distributeElementsMenuProvider:["type",Ma]};var N_="is not a registered action",p2="is already registered";function Gn(e,t){this._eventBus=e,this._actions={};var n=this;e.on("diagram.init",function(){n._registerDefaultActions(t),e.fire("editorActions.init",{editorActions:n})})}Gn.$inject=["eventBus","injector"],Gn.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=pe(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&&(pe(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)})},Gn.prototype.trigger=function(e,t){if(!this._actions[e])throw lf(e,N_);var n=this._eventBus.fire("editorActions.allowed",{action:e,opts:t});if(n!==!1)return this._actions[e](t)},Gn.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)})},Gn.prototype._registerAction=function(e,t){if(this.isRegistered(e))throw lf(e,p2);this._actions[e]=t},Gn.prototype.unregister=function(e){if(!this.isRegistered(e))throw lf(e,N_);this._actions[e]=void 0},Gn.prototype.getActions=function(){return Object.keys(this._actions)},Gn.prototype.isRegistered=function(e){return!!this._actions[e]};function lf(e,t){return new Error(e+" "+t)}const f2={__init__:["editorActions"],editorActions:["type",Gn]};function qc(e){e.invoke(Gn,this)}te(qc,Gn),qc.$inject=["injector"],qc.prototype._registerDefaultActions=function(e){Gn.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=[],S=h.type;m.length&&(g=Re(m,function(E){return!y(E,"bpmn:Lane")}),u.trigger(g,S))}),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;y(h,"bpmn:Collaboration")?g=n.filter(function(S){return y(S.parent,"bpmn:Collaboration")}):g=n.filter(function(S){return S!==h&&!y(S.parent,"bpmn:SubProcess")}),m=bt(g),f.moveElements(g,{x:-m.x,y:-m.y},h)}),i&&d&&this._registerAction("replaceElement",function(h){d.triggerEntry("replace","click",h)})};const d2={__depends__:[f2],editorActions:["type",qc]};function B_(e){e.on(["create.init","shape.move.init"],function(t){var n=t.context,i=t.shape;Ee(i,["bpmn:Participant","bpmn:SubProcess","bpmn:TextAnnotation"])&&(n.gridSnappingContext||(n.gridSnappingContext={}),n.gridSnappingContext.snapLocation="top-left")})}B_.$inject=["eventBus"];function jr(e,t){W.call(this,e),this._gridSnapping=t;var n=this;this.preExecute("shape.resize",function(i){var r=i.context,o=r.hints||{},a=o.autoResize;if(a){var s=r.shape,c=r.newBounds;hn(a)?r.newBounds=n.snapComplex(c,a):r.newBounds=n.snapSimple(s,c)}})}jr.$inject=["eventBus","gridSnapping","modeling"],te(jr,W),jr.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},jr.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},jr.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),D(e,o),e},jr.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),D(e,o),e};var h2=2e3;function $_(e,t){e.on(["spaceTool.move","spaceTool.end"],h2,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)}})}$_.$inject=["eventBus","gridSnapping"];const m2={__init__:["gridSnappingResizeBehavior","gridSnappingSpaceToolBehavior"],gridSnappingResizeBehavior:["type",jr],gridSnappingSpaceToolBehavior:["type",$_]};var Yc=10;function pf(e,t,n){return n||(n="round"),Math[n](e/t)*t}var g2=1200,v2=800;function lr(e,t,n){var i=!n||n.active!==!1;this._eventBus=t;var r=this;t.on("diagram.init",v2,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"],g2,function(o){var a=o.originalEvent;if(!(!r.active||a&&bn(a))){var s=o.context,c=s.gridSnappingContext;c||(c=s.gridSnappingContext={}),["x","y"].forEach(function(u){var l={},p=_2(o,u,e);p&&(l.offset=p);var f=y2(o,u);f&&D(l,f),Ro(o,u)||r.snapEvent(o,u,l)})}})}lr.prototype.snapEvent=function(e,t,n){var i=this.snapValue(e[t],n);St(e,t,i)},lr.prototype.getGridSpacing=function(){return Yc},lr.prototype.snapValue=function(e,t){var n=0;t&&t.offset&&(n=t.offset),e+=n,e=pf(e,Yc);var i,r;return t&&t.min&&(i=t.min,he(i)&&(i=pf(i+n,Yc,"ceil"),e=Math.max(e,i))),t&&t.max&&(r=t.max,he(r)&&(r=pf(r+n,Yc,"floor"),e=Math.min(e,r))),e-=n,e},lr.prototype.isActive=function(){return this.active},lr.prototype.setActive=function(e){this.active=e,this._eventBus.fire("gridSnapping.toggle",{active:e})},lr.prototype.toggleActive=function(){this.setActive(!this.active)},lr.$inject=["elementRegistry","eventBus","config.gridSnapping"];function y2(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&&(Kc(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&&(Kc(t)?F_(s)?a.x.max=c.left:a.x.min=c.right:j_(s)?a.y.max=c.top:a.y.min=c.bottom),u&&(Kc(t)?F_(s)?a.x.min=u.left:a.x.max=u.right:j_(s)?a.y.min=u.top:a.y.max=u.bottom),a[t]}function _2(e,t,n){var i=e.context,r=e.shape,o=i.gridSnappingContext,a=o.snapLocation,s=o.snapOffset;return s&&he(s[t])||(s||(s=o.snapOffset={}),he(s[t])||(s[t]=0),!r)||(n.get(r.id)||(Kc(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 Kc(e){return e==="x"}function j_(e){return e.indexOf("n")!==-1}function F_(e){return e.indexOf("w")!==-1}const b2={__depends__:[m2],__init__:["gridSnapping"],gridSnapping:["type",lr]};var x2=2e3;function H_(e,t,n){e.on("autoPlace",x2,function(i){var r=i.source,o=fe(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],y(a,"bpmn:TextAnnotation")&&(E2(c)?u.offset=-a.width/2:u.offset=-a.height/2),s[c]=t.snapValue(s[c],u))}),s})}H_.$inject=["eventBus","gridSnapping","elementRegistry"];function E2(e){return e==="x"}var w2=1750;function z_(e,t,n){t.on(["create.start","shape.move.start"],w2,function(i){var r=i.context,o=r.shape,a=e.getRootElement();if(!(!y(o,"bpmn:Participant")||!y(a,"bpmn:Process")||!a.children.length)){var s=r.createConstraints;s&&(o.width=n.snapValue(o.width,{min:o.width}),o.height=n.snapValue(o.height,{min:o.height}))}})}z_.$inject=["canvas","eventBus","gridSnapping"];var S2=3e3;function Xc(e,t,n){W.call(this,e),this._gridSnapping=t;var i=this;this.postExecuted(["connection.create","connection.layout"],S2,function(r){var o=r.context,a=o.connection,s=o.hints||{},c=a.waypoints;s.connectionStart||s.connectionEnd||s.createElementsBehavior===!1||R2(c)&&n.updateWaypoints(a,i.snapMiddleSegments(c))})}Xc.$inject=["eventBus","gridSnapping","modeling"],te(Xc,W),Xc.prototype.snapMiddleSegments=function(e){var t=this._gridSnapping,n;e=e.slice();for(var i=1;i<e.length-2;i++)n=A2(t,e[i],e[i+1]),e[i]=n[0],e[i+1]=n[1];return e};function R2(e){return e.length>3}function C2(e){return e==="h"}function P2(e){return e==="v"}function A2(e,t,n){var i=bi(t,n),r={};return C2(i)&&(r.y=e.snapValue(t.y)),P2(i)&&(r.x=e.snapValue(t.x)),("x"in r||"y"in r)&&(t=D({},t,r),n=D({},n,r)),[t,n]}const T2={__depends__:[b2,{__init__:["gridSnappingAutoPlaceBehavior","gridSnappingParticipantBehavior","gridSnappingLayoutConnectionBehavior"],gridSnappingAutoPlaceBehavior:["type",H_],gridSnappingParticipantBehavior:["type",z_],gridSnappingLayoutConnectionBehavior:["type",Xc]}],__init__:["bpmnGridSnapping"],bpmnGridSnapping:["type",B_]};var M2=30,V_=30;function ka(e,t){this._interactionEvents=t;var n=this;e.on(["interactionEvents.createHit","interactionEvents.updateHit"],function(i){var r=i.element,o=i.gfx;if(y(r,"bpmn:Lane"))return n._createParticipantHit(r,o);if(y(r,"bpmn:Participant"))return Pe(r)?n._createParticipantHit(r,o):n._createDefaultHit(r,o);if(y(r,"bpmn:SubProcess"))return Pe(r)?n._createSubProcessHit(r,o):n._createDefaultHit(r,o)})}ka.$inject=["eventBus","interactionEvents"],ka.prototype._createDefaultHit=function(e,t){return this._interactionEvents.removeHits(t),this._interactionEvents.createDefaultHit(e,t),!0},ka.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=Bt(e)?{width:M2,height:e.height}:{width:e.width,height:V_};return this._interactionEvents.createBoxHit(t,"all",n),!0},ka.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:V_}),!0};const k2={__init__:["bpmnInteractionEvents"],bpmnInteractionEvents:["type",ka]};function Zc(e){e.invoke(yo,this)}te(Zc,yo),Zc.$inject=["injector"],Zc.prototype.registerBindings=function(e,t){yo.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 D2={__depends__:[$p],__init__:["keyboardBindings"],keyboardBindings:["type",Zc]};var O2={moveSpeed:1,moveSpeedAccelerated:10},I2=1500,G_="left",W_="up",U_="right",q_="down",L2={ArrowLeft:G_,Left:G_,ArrowUp:W_,Up:W_,ArrowRight:U_,Right:U_,ArrowDown:q_,Down:q_},N2={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 Y_(e,t,n,i,r){var o=this;this._config=D({},O2,e||{}),t.addListener(I2,function(a){var s=a.keyEvent,c=L2[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=N2[a](u),p=i.allowed("elements.move",{shapes:c,hints:{keyboardMove:!0}});p&&n.moveElements(c,l)}}}Y_.$inject=["config.keyboardMoveSelection","keyboard","modeling","rules","selection"];const B2={__depends__:[$p,jn],__init__:["keyboardMoveSelection"],keyboardMoveSelection:["type",Y_]};var K_=10;function Da(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=OS(l,p,u),c.newBounds=LS(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:ue(l)})}function s(c){var u=c.shape,l=c.canExecute,p=c.newBounds;if(l){if(p=fh(p),!$2(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)})}Da.prototype.canResize=function(e){var t=this._rules,n=qn(e,["newBounds","shape","delta","direction"]);return t.allowed("shape.resize",n)},Da.prototype.activate=function(e,t,n){var i=this._dragging,r,o;if(typeof n=="string"&&(n={direction:n}),r=D({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,X_(t,o),"resize",{autoActivate:!0,cursor:j2(o),data:{shape:t,context:r}})},Da.prototype.computeMinResizeBox=function(e){var t=e.shape,n=e.direction,i,r;return i=e.minDimensions||{width:K_,height:K_},r=Jh(t,e.childrenBoxPadding),NS(n,t,i,r)},Da.$inject=["eventBus","rules","modeling","dragging"];function $2(e,t){return e.x!==t.x||e.y!==t.y||e.width!==t.width||e.height!==t.height}function X_(e,t){var n=fe(e),i=ue(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 j2(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 Z_="djs-resizing",Q_="resize-not-ok",F2=500;function J_(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,Z_)),s.width>5&&ne(c,{x:s.x,width:s.width}),s.height>5&&ne(c,{y:s.y,height:s.height}),o.canExecute?Ae(c).remove(Q_):Ae(c).add(Q_)}function r(o){var a=o.shape,s=o.frame;s&&Mt(o.frame),t.removeMarker(a,Z_)}e.on("resize.move",F2,function(o){i(o.context)}),e.on("resize.cleanup",function(o){r(o.context)})}J_.$inject=["eventBus","canvas","previewSupport"];var Qc=-6,Jc=8,eu=20,Oa="djs-resizer",H2=["n","w","s","e","nw","ne","se","sw"];function pr(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,pn(r.addResizer,r))}),e.on("shape.changed",function(o){var a=o.element;n.isSelected(a)&&(r.removeResizers(),r.addResizer(a))})}pr.prototype.makeDraggable=function(e,t,n){var i=this._resize;function r(o){Ji(o)&&i.activate(o,e,n)}me.bind(t,"mousedown",r),me.bind(t,"touchstart",r)},pr.prototype._createResizer=function(e,t,n,i){var r=this._getResizersParent(),o=z2(i),a=ce("g");Ae(a).add(Oa),Ae(a).add(Oa+"-"+e.id),Ae(a).add(Oa+"-"+i),ve(r,a);var s=ce("rect");ne(s,{x:-Jc/2+o.x,y:-Jc/2+o.y,width:Jc,height:Jc}),Ae(s).add(Oa+"-visual"),ve(a,s);var c=ce("rect");return ne(c,{x:-eu/2+o.x,y:-eu/2+o.y,width:eu,height:eu}),Ae(c).add(Oa+"-hit"),ve(a,c),hs(a,t,n),a},pr.prototype.createResizer=function(e,t){var n=X_(e,t),i=this._createResizer(e,n.x,n.y,t);this.makeDraggable(e,i,t)},pr.prototype.addResizer=function(e){var t=this;Ue(e)||M(H2,function(n){t._resize.canResize({shape:e,direction:n})&&t.createResizer(e,n)})},pr.prototype.removeResizers=function(){var e=this._getResizersParent();os(e)},pr.prototype._getResizersParent=function(){return this._canvas.getLayer("resizers")},pr.$inject=["eventBus","canvas","selection","resize"];function z2(e){var t={x:0,y:0};return e.indexOf("e")!==-1?t.x=-Qc:e.indexOf("w")!==-1&&(t.x=Qc),e.indexOf("s")!==-1?t.y=-Qc:e.indexOf("n")!==-1&&(t.y=Qc),t}const eb={__depends__:[li,Ci,mo],__init__:["resize","resizePreview","resizeHandles"],resize:["type",Da],resizePreview:["type",J_],resizeHandles:["type",pr]};var V2=2e3;function Ia(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"],V2,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||Ee(c,["bpmn:Activity","bpmn:Event","bpmn:TextAnnotation","bpmn:Participant"]))&&i.activate(c)}}Ia.$inject=["eventBus","bpmnFactory","canvas","directEditing","modeling","resizeHandles","textRenderer"],Ia.prototype.activate=function(e){var t=Mn(e);if(t!==void 0){var n={text:t},i=this.getEditingBBox(e);D(n,i);var r={},o=n.style||{};return D(o,{backgroundColor:null,border:null}),(Ee(e,["bpmn:Task","bpmn:Participant","bpmn:Lane","bpmn:CallActivity"])||tb(e))&&D(r,{centerVertically:!0}),Ki(e)&&(D(r,{resizable:!0,autoResize:!0}),D(o,{backgroundColor:"#ffffff",border:"1px solid #ccc"})),y(e,"bpmn:TextAnnotation")&&(D(r,{resizable:!0,autoResize:!0}),D(o,{backgroundColor:"#ffffff",border:"1px solid #ccc"})),D(n,{options:r,style:o}),n}},Ia.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(y(e,"bpmn:Lane")||U2(e)){var h=Bt(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};D(o,m),D(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(W2(e)){var g=Bt(e),S=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};D(o,S),D(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)"})}(Ee(e,["bpmn:Task","bpmn:CallActivity"])||tb(e))&&(D(o,{width:i.width,height:i.height}),D(d,{fontSize:p+"px",lineHeight:f,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px"})),G2(e)&&(D(o,{width:i.width,x:i.x}),D(d,{fontSize:p+"px",lineHeight:f,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px"}));var E=1,b=i.width+2*E;if(n.labelTarget&&(D(o,{width:b,height:i.height+2*E,x:i.x-E,y:i.y-E}),D(d,{fontSize:u+"px",lineHeight:l})),Ki(n)&&!vs(n)&&!xe(n)){var x=Qu(e),w=t.getAbsoluteBBox({x:x.x,y:x.y,width:0,height:0}),T=u,I=Pr.width*a+2*E;D(o,{width:I,height:T+2*E,x:w.x-I/2,y:w.y-T/2-E}),D(d,{fontSize:u+"px",lineHeight:l})}return y(e,"bpmn:TextAnnotation")&&(D(o,{width:i.width+2*E,height:i.height+2*E,x:i.x-E,y:i.y-E,minWidth:30*a,minHeight:10*a}),D(d,{textAlign:"left",paddingTop:to*a+"px",paddingBottom:to*a+"px",paddingLeft:to*a+"px",paddingRight:to*a+"px",fontSize:p+"px",lineHeight:f})),{bounds:o,style:d}},Ia.prototype.update=function(e,t,n,i){var r,o;y(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}),q2(t)&&(t=null),this._modeling.updateLabel(e,t,r)};function tb(e){return y(e,"bpmn:SubProcess")&&!Pe(e)}function G2(e){return y(e,"bpmn:SubProcess")&&Pe(e)}function W2(e){return y(e,"bpmn:Participant")&&!Pe(e)}function U2(e){return y(e,"bpmn:Participant")&&Pe(e)}function q2(e){return!e||!e.trim()}var nb="djs-element-hidden",ib="djs-label-hidden";function rb(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,y(o,"bpmn:TextAnnotation")){a=t.getAbsoluteBBox(o),s=ce("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=ce("path");ne(p,{d:l,strokeWidth:2,stroke:Y2(o)}),ve(s,p),ve(r,s),Wt(s,o.x,o.y)}y(o,"bpmn:TextAnnotation")||o.labelTarget?t.addMarker(o,nb):(y(o,"bpmn:Task")||y(o,"bpmn:CallActivity")||y(o,"bpmn:SubProcess")||y(o,"bpmn:Participant")||y(o,"bpmn:Lane"))&&t.addMarker(o,ib)}),e.on("directEditing.resize",function(c){if(y(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}});ne(i.path,{d:f})}}),e.on(["directEditing.complete","directEditing.cancel"],function(c){var u=c.active;u&&(t.removeMarker(u.element.label||u.element,nb),t.removeMarker(o,ib)),o=void 0,a=void 0,s&&(Mt(s),s=void 0)})}rb.$inject=["eventBus","canvas","pathMap"];function Y2(e,t){var n=ke(e);return n.get("stroke")||t||"black"}const K2={__depends__:[gp,eb,T_],__init__:["labelEditingProvider","labelEditingPreview"],labelEditingProvider:["type",Ia],labelEditingPreview:["type",rb]};var X2=500,Z2=1e3;function di(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){Lw(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"],X2,function(o){var a=o.element,s=o.gfx,c=Ge(".djs-outline",s);c&&i.updateOutline(a,c)})}di.prototype.createOutline=function(e){var t=this._elementRegistry.getGraphics(e);if(!t)throw new Error("cannot create outline for non-rendered element");var n=Ge(".djs-outline",t);return n||(n=this.getOutline(e)||this._createOutlineGfx(),ve(t,n),this.updateOutline(e,n)),n},di.prototype._createOutlineGfx=function(){var e=ce("rect");return ne(e,D({x:0,y:0,rx:4,width:100,height:100},this._outlineStyle)),e},di.prototype.updateOutline=function(e,t){e.waypoints?this.updateConnectionOutline(t,e):this.updateShapeOutline(t,e)},di.prototype.updateShapeOutline=function(e,t){var n=!1,i=this._getProviders();i.length&&M(i,function(r){n=n||r.updateOutline(t,e)}),n||ne(e,{x:-this._outlineOffset,y:-this._outlineOffset,width:t.width+this._outlineOffset*2,height:t.height+this._outlineOffset*2})},di.prototype.updateConnectionOutline=function(e,t){var n=bt(t);ne(e,{x:n.x-this._outlineOffset,y:n.y-this._outlineOffset,width:n.width+this._outlineOffset*2,height:n.height+this._outlineOffset*2})},di.prototype.registerProvider=function(e,t){t||(t=e,e=Z2),this._eventBus.on("outline.getProviders",e,function(n){n.providers.push(t)})},di.prototype._getProviders=function(){var e=this._eventBus.createEvent({type:"outline.getProviders",providers:[]});return this._eventBus.fire(e),e.providers},di.prototype.getOutline=function(e){var t,n=this._getProviders();return M(n,function(i){Lt(i.getOutline)&&(t=t||i.getOutline(e))}),t},di.$inject=["eventBus","styles","elementRegistry"];var tu=6;function ff(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)})}ff.prototype._updateMultiSelectionOutline=function(e){var t=this._canvas.getLayer("selectionOutline");os(t);var n=e.length>1,i=this._canvas.getContainer();if(Ae(i)[n?"add":"remove"]("djs-multi-select"),!!n){var r=Q2(bt(e)),o=ce("rect");ne(o,D({rx:3},r)),Ae(o).add("djs-selection-outline"),ve(t,o)}},ff.$inject=["eventBus","canvas","selection"];function Q2(e){return{x:e.x-tu,y:e.y-tu,width:e.width+tu*2,height:e.height+tu*2}}const df={__depends__:[jn],__init__:["outline","multiSelectionOutline"],outline:["type",di],multiSelectionOutline:["type",ff]},ob=["bpmn:Event","bpmn:SequenceFlow","bpmn:Gateway"],ab={class:"bjs-label-link",stroke:"var(--element-selected-outline-secondary-stroke-color)",strokeDasharray:"5, 5"},J2=15,nu=2;function sb(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=>Ee(h,ob));if(f.length===1){const h=f[0];xe(h)?a(h,h.labelTarget):(d=h.labels)!=null&&d.length&&a(h.labels[0],h)}if(f.length===2){const h=f.find(xe),m=f.find(g=>{var S;return(S=g.labels)==null?void 0:S.includes(h)});h&&m&&a(h,m)}}),e.on("shape.changed",function({element:p}){var f;!Ee(p,ob)||!l(p)||(xe(p)?a(p,p.labelTarget):(f=p.labels)!=null&&f.length&&a(p.labels[0],p))});function a(p,f){const d=Bo([fe(f),fe(p)],ab),h=d.getAttribute("d"),g=r.isSelected(p)?c(p):u(p),S=Ho(g,h);if(!S)return;const b=r.isSelected(f)?c(f):u(f),x=Ho(b,h)||fe(f);Zo(x,S)<J2||(Gu(d,[x,S]),ve(o,d))}function s(){rs(`.${ab.class}`,o).forEach(Mt)}function c(p){const f=i.getOutline(p);if(!f)return u(p);if(f.x){const d={x:p.x+fr(f,"x")-nu,y:p.y+fr(f,"y")-nu,width:fr(f,"width")+nu*2,height:fr(f,"height")+nu*2};return el(d,fr(f,"rx"))}if(f.cx){const d=fr(f,"r"),h={x:p.x+fr(f,"cx")-d,y:p.y+fr(f,"cy")-d,width:d*2,height:d*2};return Nh(h)}}function u(p){return n.getShapePath(p)}function l(p){return r.isSelected(p)}}sb.$inject=["eventBus","canvas","graphicsFactory","outline","selection"];function fr(e,t){return parseFloat(ne(e,t)||0)}const ek={__depends__:[jn,df],__init__:["labelLink"],labelLink:["type",sb]};var tk=new ho("tt");function nk(e){var t=Qe('<div class="djs-tooltip-container" />');return cn(t,{position:"absolute",width:"0",height:"0"}),e.insertBefore(t,e.firstChild),t}function ik(e,t,n){cn(e,{left:t+"px",top:n+"px"})}function hf(e,t){e.style.display=t===!1?"none":""}var cb="djs-tooltip",mf="."+cb;function dn(e,t){this._eventBus=e,this._canvas=t,this._ids=tk,this._tooltipDefaults={show:{minZoom:.7,maxZoom:5}},this._tooltips={},this._tooltipRoot=nk(t.getContainer());var n=this;vn.bind(this._tooltipRoot,mf,"mousedown",function(i){i.stopPropagation()}),vn.bind(this._tooltipRoot,mf,"mouseover",function(i){n.trigger("mouseover",i)}),vn.bind(this._tooltipRoot,mf,"mouseout",function(i){n.trigger("mouseout",i)}),this._init()}dn.$inject=["eventBus","canvas"],dn.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=D({},this._tooltipDefaults,e,{id:t}),this._addTooltip(e),e.timeout&&this.setTimeout(e),t},dn.prototype.trigger=function(e,t){var n=t.delegateTarget||t.target,i=this.get(Qt(n,"data-tooltip-id"));i&&(e==="mouseover"&&i.timeout&&this.clearTimeout(i),e==="mouseout"&&i.timeout&&(i.timeout=1e3,this.setTimeout(i)))},dn.prototype.get=function(e){return typeof e!="string"&&(e=e.id),this._tooltips[e]},dn.prototype.clearTimeout=function(e){if(e=this.get(e),!!e){var t=e.removeTimer;t&&(clearTimeout(t),e.removeTimer=null)}},dn.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)}},dn.prototype.remove=function(e){var t=this.get(e);t&&(ri(t.html),ri(t.htmlContainer),delete t.htmlContainer,delete this._tooltips[t.id])},dn.prototype.show=function(){hf(this._tooltipRoot)},dn.prototype.hide=function(){hf(this._tooltipRoot,!1)},dn.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},dn.prototype._addTooltip=function(e){var t=e.id,n=e.html,i,r=this._tooltipRoot;n.get&&n.constructor.prototype.jquery&&(n=n.get(0)),hn(n)&&(n=Qe(n)),i=Qe('<div data-tooltip-id="'+t+'" class="'+cb+'">'),cn(i,{position:"absolute"}),i.appendChild(n),e.type&&rt(i).add("djs-tooltip-"+e.type),e.className&&rt(i).add(e.className),e.htmlContainer=i,r.appendChild(i),this._tooltips[t]=e,this._updateTooltip(e)},dn.prototype._updateTooltip=function(e){var t=e.position,n=e.htmlContainer;ik(n,t.x,t.y)},dn.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),hf(i,r))})},dn.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 rk={__init__:["tooltips"],tooltips:["type",dn]};var ok="flow elements must be children of pools/participants",ak="Data object must be placed within a pool/participant.";function ub(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;y(s,"bpmn:Collaboration")&&(y(a,"bpmn:FlowNode")?i(r,n(ok)):y(a,"bpmn:DataObjectReference")&&i(r,n(ak)))})}ub.$inject=["eventBus","tooltips","translate"];const sk={__depends__:[rk],__init__:["modelingFeedback"],modelingFeedback:["type",ub]};var ck=500,uk=1250,lk=1500,iu=Math.round;function pk(e){return{x:e.x+iu(e.width/2),y:e.y+iu(e.height/2)}}function lb(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",lk,function(s){var c=s.context,u=s.shape,l=i.get().slice();l.indexOf(u)===-1&&(l=[u]),l=fk(l),D(c,{shapes:l,validatedShapes:l,shape:u})}),e.on("shape.move.start",uk,function(s){var c=s.context,u=c.validatedShapes,l;if(l=c.canExecute=o(u),!l)return!1}),e.on("shape.move.move",ck,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=iu(u.x),u.y=iu(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(Ji(s)){var c=uo(s);if(!c)throw new Error("must supply DOM mousedown event");return a(c,s.element)}});function a(s,c,u,l){if(It(u)&&(l=u,u=!1),!(c.waypoints||!c.parent)&&!Ae(s.target).has("djs-hit-no-move")){var p=pk(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}lb.$inject=["eventBus","dragging","modeling","selection","rules"];function fk(e){var t=Gr(e,"id");return Re(e,function(n){for(;n=n.parent;)if(t[n.id])return!1;return!0})}var pb=499,gf="djs-dragging",fb="drop-ok",db="drop-not-ok",hb="new-parent",mb="attach-ok";function gb(e,t,n,i){function r(c){var u=o(c),l=dk(u);return l}function o(c){var u=$o(c),l=u.flatMap(d=>(d.incoming||[]).concat(d.outgoing||[])),p=u.concat(l),f=[...new Set(p)];return f}function a(c,u){[mb,fb,db,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,gf),c.allDraggedElements?c.allDraggedElements.push(u):c.allDraggedElements=[u]}e.on("shape.move.start",pb,function(c){var u=c.context,l=u.shapes,p=u.allDraggedElements,f=r(l);if(!u.dragGroup){var d=ce("g");ne(d,n.cls("djs-drag-group",["no-events"]));var h=t.getActiveLayer();ve(h,d),u.dragGroup=d}f.forEach(function(m){i.addDragger(m,u.dragGroup)}),p?p=pu([p,o(l)]):p=o(l),M(p,function(m){t.addMarker(m,gf)}),u.allDraggedElements=p,u.differentParents=hk(l)}),e.on("shape.move.move",pb,function(c){var u=c.context,l=u.dragGroup,p=u.target,f=u.shape.parent,d=u.canExecute;p&&(d==="attach"?a(p,mb):u.canExecute&&f&&p.id!==f.id?a(p,hb):a(p,u.canExecute?fb:db)),Wt(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,gf)}),p&&Mt(p)}),this.makeDraggable=s}gb.$inject=["eventBus","canvas","styles","previewSupport"];function dk(e){var t=new Set;e.forEach(function(i){t.add(i.id)});var n=Re(e,function(i){return Ue(i)?t.has(i.source.id)&&t.has(i.target.id):!0});return n}function hk(e){return g0(Gr(e,function(t){return t.parent&&t.parent.id}))!==1}const mk={__depends__:[Ys,jn,df,li,Ci,mo],__init__:["move","movePreview"],move:["type",lb],movePreview:["type",gb]};var vb=".djs-palette-toggle",yb=".entry",gk=vb+", "+yb,vf="djs-palette-",vk="shown",yf="open",_b="two-column",yk=1e3;function Rt(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()})}Rt.$inject=["eventBus","canvas"],Rt.prototype.registerProvider=function(e,t){t||(t=e,e=yk),this._eventBus.on("palette.getProviders",e,function(n){n.providers.push(t)}),this._rebuild()},Rt.prototype.getEntries=function(){var e=this._getProviders();return e.reduce(bk,{})},Rt.prototype._rebuild=function(){if(this._diagramInitialized){var e=this._getProviders();e.length&&(this._container||this._init(),this._update())}},Rt.prototype._init=function(){var e=this,t=this._eventBus,n=this._getParentContainer(),i=this._container=Qe(Rt.HTML_MARKUP);n.appendChild(i),rt(n).add(vf+vk),vn.bind(i,gk,"click",function(r){var o=r.delegateTarget;if(Lu(o,vb))return e.toggle();e.trigger("click",r)}),me.bind(i,"mousedown",function(r){r.stopPropagation()}),vn.bind(i,yb,"dragstart",function(r){e.trigger("dragstart",r)}),t.on("canvas.resized",this._layoutChanged,this),t.fire("palette.create",{container:i})},Rt.prototype._getProviders=function(e){var t=this._eventBus.createEvent({type:"palette.getProviders",providers:[]});return this._eventBus.fire(t),t.providers},Rt.prototype._toggleState=function(e){e=e||{};var t=this._getParentContainer(),n=this._container,i=this._eventBus,r,o=rt(n),a=rt(t);"twoColumn"in e?r=e.twoColumn:r=this._needsCollapse(t.clientHeight,this._entries||{}),o.toggle(_b,r),a.toggle(vf+_b,r),"open"in e&&(o.toggle(yf,e.open),a.toggle(vf+yf,e.open)),i.fire("palette.changed",{twoColumn:r,open:this.isOpen()})},Rt.prototype._update=function(){var e=Ge(".djs-palette-entries",this._container),t=this._entries=this.getEntries();ns(e),M(t,function(n,i){var r=n.group||"default",o=Ge("[data-group="+_a(r)+"]",e);o||(o=Qe('<div class="group"></div>'),Qt(o,"data-group",r),e.appendChild(o));var a=n.html||(n.separator?'<hr class="separator" />':'<div class="entry" draggable="true"></div>'),s=Qe(a);if(o.appendChild(s),!n.separator&&(Qt(s,"data-action",i),n.title&&Qt(s,"title",n.title),n.className&&_k(s,n.className),n.imageUrl)){var c=Qe("<img>");Qt(c,"src",n.imageUrl),s.appendChild(c)}}),this.open()},Rt.prototype.trigger=function(e,t,n){var i,r,o=t.delegateTarget||t.target;return o?(i=Qt(o,"data-action"),r=t.originalEvent||t,this.triggerEntry(i,e,r,n)):t.preventDefault()},Rt.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(Lt(a)){if(t==="click")return a(n,i)}else if(a[t])return a[t](n,i);n.preventDefault()}},Rt.prototype._layoutChanged=function(){this._toggleState({})},Rt.prototype._needsCollapse=function(e,t){var n=50,i=Object.keys(t).length*46;return e<i+n},Rt.prototype.close=function(){this._toggleState({open:!1,twoColumn:!1})},Rt.prototype.open=function(){this._toggleState({open:!0})},Rt.prototype.toggle=function(){this.isOpen()?this.close():this.open()},Rt.prototype.isActiveTool=function(e){return e&&this._activeTool===e},Rt.prototype.updateToolHighlight=function(e){var t,n;this._toolsContainer||(t=Ge(".djs-palette-entries",this._container),this._toolsContainer=Ge("[data-group=tools]",t)),n=this._toolsContainer,M(n.children,function(i){var r=i.getAttribute("data-action");if(r){var o=rt(i);r=r.replace("-tool",""),o.contains("entry")&&r===e?o.add("highlighted-entry"):o.remove("highlighted-entry")}})},Rt.prototype.isOpen=function(){return rt(this._container).has(yf)},Rt.prototype._getParentContainer=function(){return this._canvas.getContainer()},Rt.HTML_MARKUP='<div class="djs-palette"><div class="djs-palette-entries"></div><div class="djs-palette-toggle"></div></div>';function _k(e,t){var n=rt(e),i=pe(t)?t:t.split(/\s+/g);i.forEach(function(r){n.add(r)})}function bk(e,t){var n=t.getPaletteEntries();return Lt(n)?n(e):(M(n,function(i,r){e[r]=i}),e)}const xk={__init__:["palette"],palette:["type",Rt]};var bb="crosshair",xb="selected",Ek="djs-dragging-active-lasso";function dr(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=ce("rect");ne(d,{class:"djs-lasso-overlay",width:1,height:1,x:0,y:0}),ve(f,d),u(!0),this.update(p)},update:function(p){var f=p.frame,d=p.bbox;f&&d&&ne(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,xb);for(const g of h)m.has(g)||t.addMarker(g,xb)}},remove:function(p){this.update(p),p.frame&&Mt(p.frame),u(!1)}};function u(p){Ae(t.getContainer()).toggle(Ek,p)}function l(p){var f=i.getAll();return new Set(Vr(Xr(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=Eb(p),f.add=Hs(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=Eb(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(Hs(p))return s.activateLasso(p.originalEvent),!0})}dr.$inject=["eventBus","canvas","dragging","elementRegistry","selection","toolManager","mouse"],dr.prototype.activateLasso=function(e,t){this._dragging.init(e,"lasso",{autoActivate:t,cursor:bb,data:{context:{}},keepSelection:!0})},dr.prototype.activateSelection=function(e,t){this._dragging.init(e,"lasso.selection",{trapClick:!1,autoActivate:t,cursor:bb,data:{context:{}},keepSelection:!0})},dr.prototype._select=function(e){this._selection.select(e)},dr.prototype.select=function(e,t,n=[]){var i=Vr(Xr(e,t));this._select([...n,...i])},dr.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateSelection(e,!!e)},dr.prototype.isActive=function(){var e=this._dragging.context();return e&&/^lasso/.test(e.prefix)};function Eb(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 wk={__depends__:[Qs,ia],__init__:["lassoTool"],lassoTool:["type",dr]};var _f=1500,wb="grab";function Co(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",_f,function(c){if(ea(c))return a.activateMove(c.originalEvent,!0),!1}),s&&s.addListener(_f,function(c){if(!(!Sb(c.keyEvent)||a.isActive())){var u=a._mouse.getLastMoveEvent();a.activateMove(u,!!u)}},"keyboard.keydown"),s&&s.addListener(_f,function(c){!Sb(c.keyEvent)||!a.isActive()||a.toggle()},"keyboard.keyup"),e.on("hand.end",function(c){var u=c.originalEvent.target;if(!c.hover&&!(u instanceof SVGElement))return!1;e.once("hand.ended",function(){a.activateMove(c.originalEvent,{reactivate:!0})})}),e.on("hand.move.move",function(c){var u=t.viewbox().scale;t.scroll({dx:c.dx*u,dy:c.dy*u})}),e.on("hand.move.end",function(c){var u=c.context,l=u.reactivate;return!ea(c)&&l&&e.once("hand.move.ended",function(p){a.activateHand(p.originalEvent,!0,!0)}),!1})}Co.$inject=["eventBus","canvas","dragging","injector","toolManager","mouse"],Co.prototype.activateMove=function(e,t,n){typeof t=="object"&&(n=t,t=!1),this._dragging.init(e,"hand.move",{autoActivate:t,cursor:wb,data:{context:n||{}}})},Co.prototype.activateHand=function(e,t,n){this._dragging.init(e,"hand",{trapClick:!1,autoActivate:t,cursor:wb,data:{context:{reactivate:n}}})},Co.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateHand(e,!!e)},Co.prototype.isActive=function(){var e=this._dragging.context();return e?/^(hand|hand\.move)$/.test(e.prefix):!1};function Sb(e){return kt("Space",e)}const Sk={__depends__:[Qs,ia],__init__:["handTool"],handTool:["type",Co]};var Rb="connect-ok",Cb="connect-not-ok";function Po(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?Rb:Cb))}),e.on(["global-connect.out","global-connect.cleanup"],function(c){var u=c.context.startTarget,l=c.context.canStartConnect;u&&i.removeMarker(u,l?Rb:Cb)}),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})}Po.$inject=["eventBus","dragging","connect","canvas","toolManager","rules","mouse"],Po.prototype.start=function(e,t){this._dragging.init(e,"global-connect",{autoActivate:t,trapClick:!1,data:{context:{}}})},Po.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();return this.start(e,!!e)},Po.prototype.isActive=function(){var e=this._dragging.context();return e&&/^global-connect/.test(e.prefix)},Po.prototype.canStartConnect=function(e){return this._rules.allowed("connection.start",{source:e})};const Rk={__depends__:[cf,li,Ci,Qs,ia],globalConnect:["type",Po]};function bf(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)}bf.$inject=["palette","create","elementFactory","spaceTool","lassoTool","handTool","globalConnect","translate"],bf.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(S){var E=n.createShape(D({type:p},m));t.start(S,E)}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 D(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 Ck={__depends__:[xk,Xs,ev,wk,Sk,Rk,qo],__init__:["paletteProvider"],paletteProvider:["type",bf]};var Pk=250;function xf(e,t,n,i,r){W.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);D(p,{x:f.x,y:f.y});var d=n.createShape(p);i.addShape(d,f.parent);var h=Ge('[data-element-id="'+_a(f.id)+'"]',s.dragGroup);h&&ne(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=Ge('[data-element-id="'+_a(l)+'"]',s.dragGroup);p&&ne(p,{display:"inline"}),u.remove(),c[l]&&delete c[l]})}e.on("shape.move.move",Pk,function(s){var c=s.context,u=c.canExecute;c.visualReplacements||(c.visualReplacements={}),u&&u.replacements?o(c):a(c)})}xf.$inject=["eventBus","elementRegistry","elementFactory","canvas","previewSupport"],te(xf,W);const Ak={__depends__:[mo],__init__:["bpmnReplacePreview"],bpmnReplacePreview:["type",xf]};var Tk=1250,Ef=40,Mk=20,kk=10,Pb=20,Ab=["x","y"],Dk=Math.abs;function Tb(e){e.on(["connect.hover","connect.move","connect.end"],Tk,function(t){var n=t.context,i=n.canExecute,r=n.start,o=n.hover,a=n.source,s=n.target;t.originalEvent&&bn(t.originalEvent)||(n.initialConnectionStart||(n.initialConnectionStart=n.connectionStart),i&&o&&Ok(t,o,Bk(o)),o&&Nk(i,["bpmn:Association","bpmn:DataInputAssociation","bpmn:DataOutputAssociation","bpmn:SequenceFlow"])?(n.connectionStart=zn(r),Ee(o,["bpmn:Event","bpmn:Gateway"])&&Mb(t,zn(o)),Ee(o,["bpmn:Task","bpmn:SubProcess"])&&Ik(t,o),y(a,"bpmn:BoundaryEvent")&&s===a.host&&Lk(t)):kb(i,"bpmn:MessageFlow")?(y(r,"bpmn:Event")&&(n.connectionStart=zn(r)),y(o,"bpmn:Event")&&Mb(t,zn(o))):n.connectionStart=n.initialConnectionStart)})}Tb.$inject=["eventBus"];function Ok(e,t,n){Ab.forEach(function(i){var r=Db(i,t);e[i]<t[i]+n?St(e,i,t[i]+n):e[i]>t[i]+r-n&&St(e,i,t[i]+r-n)})}function Ik(e,t){var n=zn(t);Ab.forEach(function(i){$k(e,t,i)&&St(e,i,n[i])})}function Lk(e){var t=e.context,n=t.source,i=t.target;if(!jk(t)){var r=zn(n),o=Gt(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;Dk(c-r[s])<Ef&&(c>r[s]?u=r[s]+Ef:u=r[s]-Ef,St(e,s,u))})}}function Mb(e,t){St(e,"x",t.x),St(e,"y",t.y)}function kb(e,t){return e&&e.type===t}function Nk(e,t){return Li(t,function(n){return kb(e,n)})}function Db(e,t){return e==="x"?t.width:t.height}function Bk(e){return y(e,"bpmn:Task")?kk:Mk}function $k(e,t,n){return e[n]>t[n]+Pb&&e[n]<t[n]+Db(n,t)-Pb}function jk(e){var t=e.hover,n=e.source;return t&&n&&t===n}function hr(){this._targets={},this._snapOrigins={},this._snapLocations=[],this._defaultSnaps={}}hr.prototype.getSnapOrigin=function(e){return this._snapOrigins[e]},hr.prototype.setSnapOrigin=function(e,t){this._snapOrigins[e]=t,this._snapLocations.indexOf(e)===-1&&this._snapLocations.push(e)},hr.prototype.addDefaultSnap=function(e,t){var n=this._defaultSnaps[e];n||(n=this._defaultSnaps[e]=[]),n.push(t)},hr.prototype.getSnapLocations=function(){return this._snapLocations},hr.prototype.setSnapLocations=function(e){this._snapLocations=e},hr.prototype.pointsForTarget=function(e){var t=e.id||e,n=this._targets[t];return n||(n=this._targets[t]=new ru,n.initDefaults(this._defaultSnaps)),n};function ru(){this._snapValues={}}ru.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)},ru.prototype.snap=function(e,t,n,i){var r=this._snapValues[t];return r&&PM(e[n],r[n],i)},ru.prototype.initDefaults=function(e){var t=this;M(e||{},function(n,i){M(n,function(r){t.add(i,r)})})};var Fk=1250;function hi(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"],Fk,function(r){var o=r.context,a=o.shape,s=o.snapContext,c=o.target;if(!(r.originalEvent&&bn(r.originalEvent))&&!(Ro(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()})}hi.$inject=["elementRegistry","eventBus","snapping"],hi.prototype.initSnap=function(e){var t=this._elementRegistry,n=e.context,i=n.shape,r=n.snapContext;r||(r=n.snapContext=new hr);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}),xe(i)||(r.setSnapOrigin("top-left",{x:a.x-e.x,y:a.y-e.y}),r.setSnapOrigin("bottom-right",{x:s.x-e.x,y:s.y-e.y})),r},hi.prototype.addSnapTargetPoints=function(e,t,n){var i=this.getSnapTargets(t,n);return M(i,function(r){if(xe(r)){xe(t)&&e.add("mid",zn(r));return}if(Ue(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))}),!he(t.x)||!he(t.y)||this._elementRegistry.get(t.id)&&e.add("mid",zn(t)),e},hi.prototype.getSnapTargets=function(e,t){return y_(t).filter(function(n){return!Hk(n)})};function Hk(e){return!!e.hidden}var Ob=1500;function Ao(e,t){t.invoke(hi,this),e.on(["create.move","create.end"],Ob,Wk),e.on(["create.move","create.end","shape.move.move","shape.move.end"],Ob,function(n){var i=n.context,r=i.canExecute,o=i.target,a=r&&(r==="attach"||r.attach);a&&!Ro(n)&&zk(n,o)})}te(Ao,hi),Ao.$inject=["eventBus","injector"],Ao.prototype.initSnap=function(e){var t=hi.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",Lb(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",Lb(o,i,e))}),y(n,"bpmn:Participant")&&t.setSnapLocations(["top-left","bottom-right","mid"]),t},Ao.prototype.addSnapTargetPoints=function(e,t,n){hi.prototype.addSnapTargetPoints.call(this,e,t,n);var i=this.getSnapTargets(t,n);M(i,function(o){(Gk(o)||Vk([t,o],"bpmn:TextAnnotation"))&&(e.add("top-left",g_(o)),e.add("bottom-right",v_(o)))});var r=this._elementRegistry;return M(t.incoming,function(o){if(r.get(t.id)){Ib(i,o.source)||e.add("mid",fe(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)){Ib(i,o.target)||e.add("mid",fe(o.target));var a=o.waypoints[o.waypoints.length-1];e.add(o.id+"-docking",a.original||a)}}),y(n,"bpmn:SequenceFlow")&&(e=this.addSnapTargetPoints(e,t,n.parent)),e},Ao.prototype.getSnapTargets=function(e,t){return hi.prototype.getSnapTargets.call(this,e,t).filter(function(n){return!y(n,"bpmn:Lane")})};function zk(e,t){var n=ue(t),i=Xm(e,t),r=e.context,o=r.shape,a;o.parent?a={x:0,y:0}:a=fe(o),/top/.test(i)?St(e,"y",n.top-a.y):/bottom/.test(i)&&St(e,"y",n.bottom-a.y),/left/.test(i)?St(e,"x",n.left-a.x):/right/.test(i)&&St(e,"x",n.right-a.x)}function Vk(e,t){return e.every(function(n){return y(n,t)})}function Gk(e){return y(e,"bpmn:SubProcess")&&Pe(e)?!0:y(e,"bpmn:Participant")}function Wk(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)&&St(e,"x",e.x),(i&&i>=e.y||o&&o<=e.y)&&St(e,"y",e.y)}}function Ib(e,t){return e.indexOf(t)!==-1}function Lb(e,t,n){return t?{x:e.x-n.x,y:e.y-n.y}:{x:e.x,y:e.y}}var Uk=1250;function La(e,t){var n=this;e.on(["resize.start"],function(i){n.initSnap(i)}),e.on(["resize.move","resize.end"],Uk,function(i){var r=i.context,o=r.shape,a=o.parent,s=r.direction,c=r.snapContext;if(!(i.originalEvent&&bn(i.originalEvent))&&!Ro(i)){var u=c.pointsForTarget(a);u.initialized||(u=n.addSnapTargetPoints(u,o,a,s),u.initialized=!0),Kk(s)&&St(i,"x",i.x),Xk(s)&&St(i,"y",i.y),t.snap(i,u)}}),e.on(["resize.cleanup"],function(){t.hide()})}La.prototype.initSnap=function(e){var t=e.context,n=t.shape,i=t.direction,r=t.snapContext;r||(r=t.snapContext=new hr);var o=Nb(n,i);return r.setSnapOrigin("corner",{x:o.x-e.x,y:o.y-e.y}),r},La.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",g_(o))}),e.add("corner",Nb(t,i)),e},La.$inject=["eventBus","snapping"],La.prototype.getSnapTargets=function(e,t){return y_(t).filter(function(n){return!qk(n,e)&&!Ue(n)&&!Yk(n)&&!xe(n)})};function Nb(e,t){var n=fe(e),i=ue(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 qk(e,t){return e.host===t}function Yk(e){return!!e.hidden}function Kk(e){return e==="n"||e==="s"}function Xk(e){return e==="e"||e==="w"}var Zk=7,Qk=1e3;function mr(e){this._canvas=e,this._asyncHide=du(pn(this.hide,this),Qk)}mr.$inject=["canvas"],mr.prototype.snap=function(e,t){var n=e.context,i=n.snapContext,r=i.getSnapLocations(),o={x:Ro(e,"x"),y:Ro(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,Zk),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];It(s)&&St(e,a,s.originValue)})},mr.prototype._createLine=function(e){var t=this._canvas.getLayer("snap"),n=ce("path");return ne(n,{d:"M0,0 L0,0"}),Ae(n).add("djs-snap-line"),ve(t,n),{update:function(i){he(i)?e==="horizontal"?ne(n,{d:"M-100000,"+i+" L+100000,"+i,display:""}):ne(n,{d:"M "+i+",-100000 L "+i+", +100000",display:""}):ne(n,{display:"none"})}}},mr.prototype._createSnapLines=function(){this._snapLines={horizontal:this._createLine("horizontal"),vertical:this._createLine("vertical")}},mr.prototype.showSnapLine=function(e,t){var n=this.getSnapLine(e);n&&n.update(t),this._asyncHide()},mr.prototype.getSnapLine=function(e){return this._snapLines||this._createSnapLines(),this._snapLines[e]},mr.prototype.hide=function(){M(this._snapLines,function(e){e.update()})};const Jk={__depends__:[{__init__:["createMoveSnapping","resizeSnapping","snapping"],createMoveSnapping:["type",hi],resizeSnapping:["type",La],snapping:["type",mr]}],__init__:["connectSnapping","createMoveSnapping"],connectSnapping:["type",Tb],createMoveSnapping:["type",Ao]};var Bb=300;function ye(e,t,n,i){this._open=!1,this._results={},this._eventMaps=[],this._cachedRootElement=null,this._cachedSelection=null,this._cachedViewbox=null,this._canvas=e,this._eventBus=t,this._selection=n,this._translate=i,this._container=this._getBoxHtml(),this._searchInput=Ge(ye.INPUT_SELECTOR,this._container),this._resultsContainer=Ge(ye.RESULTS_CONTAINER_SELECTOR,this._container),this._canvas.getContainer().appendChild(this._container),t.on(["canvas.destroy","diagram.destroy","drag.init","elements.changed"],this.close,this)}ye.$inject=["canvas","eventBus","selection","translate"],ye.prototype._bindEvents=function(){var e=this;function t(n,i,r,o){e._eventMaps.push({el:n,type:r,listener:vn.bind(n,i,r,o)})}t(document,"html","click",function(n){e.close(!1)}),t(this._container,ye.INPUT_SELECTOR,"click",function(n){n.stopPropagation(),n.delegateTarget.focus()}),t(this._container,ye.RESULT_SELECTOR,"mouseover",function(n){n.stopPropagation(),e._scrollToNode(n.delegateTarget),e._preselect(n.delegateTarget)}),t(this._container,ye.RESULT_SELECTOR,"click",function(n){n.stopPropagation(),e._select(n.delegateTarget)}),t(this._container,ye.INPUT_SELECTOR,"keydown",function(n){kt("ArrowUp",n)&&n.preventDefault(),kt("ArrowDown",n)&&n.preventDefault()}),t(this._container,ye.INPUT_SELECTOR,"keyup",function(n){if(kt("Escape",n))return e.close();if(kt("Enter",n)){var i=e._getCurrentResult();return i?e._select(i):e.close(!1)}if(kt("ArrowUp",n))return e._scrollToDirection(!0);if(kt("ArrowDown",n))return e._scrollToDirection();kt(["ArrowLeft","ArrowRight"],n)||e._search(n.delegateTarget.value)})},ye.prototype._unbindEvents=function(){this._eventMaps.forEach(function(e){vn.unbind(e.el,e.type,e.listener)})},ye.prototype._search=function(e){var t=this;if(this._clearResults(),!!e.trim()){var n=this._searchProvider.find(e);if(n=n.filter(function(r){return!t._canvas.getRootElements().includes(r.element)}),!n.length){this._selection.select(null);return}n.forEach(function(r){var o=r.element.id,a=t._createResultNode(r,o);t._results[o]={element:r.element,node:a}});var i=Ge(ye.RESULT_SELECTOR,this._resultsContainer);this._scrollToNode(i),this._preselect(i)}},ye.prototype._scrollToDirection=function(e){var t=this._getCurrentResult();if(t){var n=e?t.previousElementSibling:t.nextElementSibling;n&&(this._scrollToNode(n),this._preselect(n))}},ye.prototype._scrollToNode=function(e){if(!(!e||e===this._getCurrentResult())){var t=e.offsetTop,n=this._resultsContainer.scrollTop,i=t-this._resultsContainer.clientHeight+e.clientHeight;t<n?this._resultsContainer.scrollTop=t:n<i&&(this._resultsContainer.scrollTop=i)}},ye.prototype._clearResults=function(){ns(this._resultsContainer),this._results={},this._eventBus.fire("searchPad.cleared")},ye.prototype._getCurrentResult=function(){return Ge(ye.RESULT_SELECTED_SELECTOR,this._resultsContainer)},ye.prototype._createResultNode=function(e,t){var n=Qe(ye.RESULT_HTML);return e.primaryTokens.length>0&&$b(n,e.primaryTokens,ye.RESULT_PRIMARY_HTML),$b(n,e.secondaryTokens,ye.RESULT_SECONDARY_HTML),Qt(n,ye.RESULT_ID_ATTRIBUTE,t),this._resultsContainer.appendChild(n),n},ye.prototype.registerProvider=function(e){this._searchProvider=e},ye.prototype.open=function(){if(!this._searchProvider)throw new Error("no search provider registered");this.isOpen()||(this._cachedRootElement=this._canvas.getRootElement(),this._cachedSelection=this._selection.get(),this._cachedViewbox=this._canvas.viewbox(),this._selection.select(null),this._bindEvents(),this._open=!0,rt(this._canvas.getContainer()).add("djs-search-open"),rt(this._container).add("open"),this._searchInput.focus(),this._eventBus.fire("searchPad.opened"))},ye.prototype.close=function(e=!0){this.isOpen()&&(e&&(this._cachedRootElement&&this._canvas.setRootElement(this._cachedRootElement),this._cachedSelection&&this._selection.select(this._cachedSelection),this._cachedViewbox&&this._canvas.viewbox(this._cachedViewbox),this._eventBus.fire("searchPad.restored")),this._cachedRootElement=null,this._cachedSelection=null,this._cachedViewbox=null,this._unbindEvents(),this._open=!1,rt(this._canvas.getContainer()).remove("djs-search-open"),rt(this._container).remove("open"),this._clearResults(),this._searchInput.value="",this._searchInput.blur(),this._eventBus.fire("searchPad.closed"),this._canvas.restoreFocus())},ye.prototype.toggle=function(){this.isOpen()?this.close():this.open()},ye.prototype.isOpen=function(){return this._open},ye.prototype._preselect=function(e){var t=this._getCurrentResult();if(e!==t){t&&rt(t).remove(ye.RESULT_SELECTED_CLASS);var n=Qt(e,ye.RESULT_ID_ATTRIBUTE),i=this._results[n].element;rt(e).add(ye.RESULT_SELECTED_CLASS),this._canvas.scrollToElement(i,{top:Bb}),this._selection.select(i),this._eventBus.fire("searchPad.preselected",i)}},ye.prototype._select=function(e){var t=Qt(e,ye.RESULT_ID_ATTRIBUTE),n=this._results[t].element;this._cachedSelection=null,this._cachedViewbox=null,this.close(!1),this._canvas.scrollToElement(n,{top:Bb}),this._selection.select(n),this._eventBus.fire("searchPad.selected",n)},ye.prototype._getBoxHtml=function(){const e=Qe(ye.BOX_HTML),t=Ge(ye.INPUT_SELECTOR,e);return t&&t.setAttribute("aria-label",this._translate("Search in diagram")),e};function $b(e,t,n){var i=eD(t),r=Qe(n);r.innerHTML=i,e.appendChild(r)}function eD(e){var t="";return e.forEach(function(n){var i=Uv(n.value||n.matched||n.normal),r=n.match||n.matched;r?t+='<b class="'+ye.RESULT_HIGHLIGHT_CLASS+'">'+i+"</b>":t+=i}),t!==""?t:null}ye.CONTAINER_SELECTOR=".djs-search-container",ye.INPUT_SELECTOR=".djs-search-input input",ye.RESULTS_CONTAINER_SELECTOR=".djs-search-results",ye.RESULT_SELECTOR=".djs-search-result",ye.RESULT_SELECTED_CLASS="djs-search-result-selected",ye.RESULT_SELECTED_SELECTOR="."+ye.RESULT_SELECTED_CLASS,ye.RESULT_ID_ATTRIBUTE="data-result-id",ye.RESULT_HIGHLIGHT_CLASS="djs-search-highlight",ye.BOX_HTML=`<div class="djs-search-container djs-scrollable">
|
|
335
|
+
</svg>`},u2=900;function ka(e,t,n,i){this._distributeElements=t,this._translate=n,this._popupMenu=e,this._rules=i,e.registerProvider("align-elements",u2,this)}ka.$inject=["popupMenu","distributeElements","translate","rules"],ka.prototype.getPopupMenuEntries=function(e){var t={};return this._isAllowed(e)&&D(t,this._getEntries(e)),t},ka.prototype._isAllowed=function(e){return this._rules.allowed("elements.distribute",{elements:e})},ka.prototype._getEntries=function(e){var t=this._distributeElements,n=this._translate,i=this._popupMenu,r={"distribute-elements-horizontal":{group:"distribute",title:n("Distribute elements horizontally"),className:"bjs-align-elements-menu-entry",imageHtml:L_.horizontal,action:function(o,a){t.trigger(e,"horizontal"),i.close()}},"distribute-elements-vertical":{group:"distribute",title:n("Distribute elements vertically"),imageHtml:L_.vertical,action:function(o,a){t.trigger(e,"vertical"),i.close()}}};return r};const l2={__depends__:[ef,c2],__init__:["bpmnDistributeElements","distributeElementsMenuProvider"],bpmnDistributeElements:["type",Uc],distributeElementsMenuProvider:["type",ka]};var N_="is not a registered action",p2="is already registered";function qn(e,t){this._eventBus=e,this._actions={};var n=this;e.on("diagram.init",function(){n._registerDefaultActions(t),e.fire("editorActions.init",{editorActions:n})})}qn.$inject=["eventBus","injector"],qn.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=pe(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&&(pe(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)})},qn.prototype.trigger=function(e,t){if(!this._actions[e])throw pf(e,N_);var n=this._eventBus.fire("editorActions.allowed",{action:e,opts:t});if(n!==!1)return this._actions[e](t)},qn.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)})},qn.prototype._registerAction=function(e,t){if(this.isRegistered(e))throw pf(e,p2);this._actions[e]=t},qn.prototype.unregister=function(e){if(!this.isRegistered(e))throw pf(e,N_);this._actions[e]=void 0},qn.prototype.getActions=function(){return Object.keys(this._actions)},qn.prototype.isRegistered=function(e){return!!this._actions[e]};function pf(e,t){return new Error(e+" "+t)}const f2={__init__:["editorActions"],editorActions:["type",qn]};function qc(e){e.invoke(qn,this)}te(qc,qn),qc.$inject=["injector"],qc.prototype._registerDefaultActions=function(e){qn.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=[],S=h.type;m.length&&(g=Ae(m,function(E){return!y(E,"bpmn:Lane")}),u.trigger(g,S))}),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;y(h,"bpmn:Collaboration")?g=n.filter(function(S){return y(S.parent,"bpmn:Collaboration")}):g=n.filter(function(S){return S!==h&&!y(S.parent,"bpmn:SubProcess")}),m=Et(g),f.moveElements(g,{x:-m.x,y:-m.y},h)}),i&&d&&this._registerAction("replaceElement",function(h){d.triggerEntry("replace","click",h)})};const d2={__depends__:[f2],editorActions:["type",qc]};function B_(e){e.on(["create.init","shape.move.init"],function(t){var n=t.context,i=t.shape;Se(i,["bpmn:Participant","bpmn:SubProcess","bpmn:TextAnnotation"])&&(n.gridSnappingContext||(n.gridSnappingContext={}),n.gridSnappingContext.snapLocation="top-left")})}B_.$inject=["eventBus"];function jr(e,t){U.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;gn(a)?r.newBounds=n.snapComplex(c,a):r.newBounds=n.snapSimple(s,c)}})}jr.$inject=["eventBus","gridSnapping","modeling"],te(jr,U),jr.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},jr.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},jr.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),D(e,o),e},jr.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),D(e,o),e};var h2=2e3;function $_(e,t){e.on(["spaceTool.move","spaceTool.end"],h2,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)}})}$_.$inject=["eventBus","gridSnapping"];const m2={__init__:["gridSnappingResizeBehavior","gridSnappingSpaceToolBehavior"],gridSnappingResizeBehavior:["type",jr],gridSnappingSpaceToolBehavior:["type",$_]};var Yc=10;function ff(e,t,n){return n||(n="round"),Math[n](e/t)*t}var g2=1200,v2=800;function pr(e,t,n){var i=!n||n.active!==!1;this._eventBus=t;var r=this;t.on("diagram.init",v2,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"],g2,function(o){var a=o.originalEvent;if(!(!r.active||a&&En(a))){var s=o.context,c=s.gridSnappingContext;c||(c=s.gridSnappingContext={}),["x","y"].forEach(function(u){var l={},p=_2(o,u,e);p&&(l.offset=p);var f=y2(o,u);f&&D(l,f),Co(o,u)||r.snapEvent(o,u,l)})}})}pr.prototype.snapEvent=function(e,t,n){var i=this.snapValue(e[t],n);Ct(e,t,i)},pr.prototype.getGridSpacing=function(){return Yc},pr.prototype.snapValue=function(e,t){var n=0;t&&t.offset&&(n=t.offset),e+=n,e=ff(e,Yc);var i,r;return t&&t.min&&(i=t.min,me(i)&&(i=ff(i+n,Yc,"ceil"),e=Math.max(e,i))),t&&t.max&&(r=t.max,me(r)&&(r=ff(r+n,Yc,"floor"),e=Math.min(e,r))),e-=n,e},pr.prototype.isActive=function(){return this.active},pr.prototype.setActive=function(e){this.active=e,this._eventBus.fire("gridSnapping.toggle",{active:e})},pr.prototype.toggleActive=function(){this.setActive(!this.active)},pr.$inject=["elementRegistry","eventBus","config.gridSnapping"];function y2(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&&(Kc(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&&(Kc(t)?F_(s)?a.x.max=c.left:a.x.min=c.right:j_(s)?a.y.max=c.top:a.y.min=c.bottom),u&&(Kc(t)?F_(s)?a.x.min=u.left:a.x.max=u.right:j_(s)?a.y.min=u.top:a.y.max=u.bottom),a[t]}function _2(e,t,n){var i=e.context,r=e.shape,o=i.gridSnappingContext,a=o.snapLocation,s=o.snapOffset;return s&&me(s[t])||(s||(s=o.snapOffset={}),me(s[t])||(s[t]=0),!r)||(n.get(r.id)||(Kc(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 Kc(e){return e==="x"}function j_(e){return e.indexOf("n")!==-1}function F_(e){return e.indexOf("w")!==-1}const b2={__depends__:[m2],__init__:["gridSnapping"],gridSnapping:["type",pr]};var x2=2e3;function H_(e,t,n){e.on("autoPlace",x2,function(i){var r=i.source,o=fe(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],y(a,"bpmn:TextAnnotation")&&(E2(c)?u.offset=-a.width/2:u.offset=-a.height/2),s[c]=t.snapValue(s[c],u))}),s})}H_.$inject=["eventBus","gridSnapping","elementRegistry"];function E2(e){return e==="x"}var w2=1750;function z_(e,t,n){t.on(["create.start","shape.move.start"],w2,function(i){var r=i.context,o=r.shape,a=e.getRootElement();if(!(!y(o,"bpmn:Participant")||!y(a,"bpmn:Process")||!a.children.length)){var s=r.createConstraints;s&&(o.width=n.snapValue(o.width,{min:o.width}),o.height=n.snapValue(o.height,{min:o.height}))}})}z_.$inject=["canvas","eventBus","gridSnapping"];var S2=3e3;function Xc(e,t,n){U.call(this,e),this._gridSnapping=t;var i=this;this.postExecuted(["connection.create","connection.layout"],S2,function(r){var o=r.context,a=o.connection,s=o.hints||{},c=a.waypoints;s.connectionStart||s.connectionEnd||s.createElementsBehavior===!1||R2(c)&&n.updateWaypoints(a,i.snapMiddleSegments(c))})}Xc.$inject=["eventBus","gridSnapping","modeling"],te(Xc,U),Xc.prototype.snapMiddleSegments=function(e){var t=this._gridSnapping,n;e=e.slice();for(var i=1;i<e.length-2;i++)n=A2(t,e[i],e[i+1]),e[i]=n[0],e[i+1]=n[1];return e};function R2(e){return e.length>3}function C2(e){return e==="h"}function P2(e){return e==="v"}function A2(e,t,n){var i=xi(t,n),r={};return C2(i)&&(r.y=e.snapValue(t.y)),P2(i)&&(r.x=e.snapValue(t.x)),("x"in r||"y"in r)&&(t=D({},t,r),n=D({},n,r)),[t,n]}const T2={__depends__:[b2,{__init__:["gridSnappingAutoPlaceBehavior","gridSnappingParticipantBehavior","gridSnappingLayoutConnectionBehavior"],gridSnappingAutoPlaceBehavior:["type",H_],gridSnappingParticipantBehavior:["type",z_],gridSnappingLayoutConnectionBehavior:["type",Xc]}],__init__:["bpmnGridSnapping"],bpmnGridSnapping:["type",B_]};var M2=30,V_=30;function Da(e,t){this._interactionEvents=t;var n=this;e.on(["interactionEvents.createHit","interactionEvents.updateHit"],function(i){var r=i.element,o=i.gfx;if(y(r,"bpmn:Lane"))return n._createParticipantHit(r,o);if(y(r,"bpmn:Participant"))return Me(r)?n._createParticipantHit(r,o):n._createDefaultHit(r,o);if(y(r,"bpmn:SubProcess"))return Me(r)?n._createSubProcessHit(r,o):n._createDefaultHit(r,o)})}Da.$inject=["eventBus","interactionEvents"],Da.prototype._createDefaultHit=function(e,t){return this._interactionEvents.removeHits(t),this._interactionEvents.createDefaultHit(e,t),!0},Da.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=jt(e)?{width:M2,height:e.height}:{width:e.width,height:V_};return this._interactionEvents.createBoxHit(t,"all",n),!0},Da.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:V_}),!0};const k2={__init__:["bpmnInteractionEvents"],bpmnInteractionEvents:["type",Da]};function Zc(e){e.invoke(_o,this)}te(Zc,_o),Zc.$inject=["injector"],Zc.prototype.registerBindings=function(e,t){_o.prototype.registerBindings.call(this,e,t);function n(i,r){t.isRegistered(i)&&e.addListener(r)}n("selectElements",function(i){var r=i.keyEvent;if(e.isKey(["a","A"],r)&&e.isCmd(r))return t.trigger("selectElements"),!0}),n("find",function(i){var r=i.keyEvent;if(e.isKey(["f","F"],r)&&e.isCmd(r))return t.trigger("find"),!0}),n("spaceTool",function(i){var r=i.keyEvent;if(!e.hasModifier(r)&&e.isKey(["s","S"],r))return t.trigger("spaceTool"),!0}),n("lassoTool",function(i){var r=i.keyEvent;if(!e.hasModifier(r)&&e.isKey(["l","L"],r))return t.trigger("lassoTool"),!0}),n("handTool",function(i){var r=i.keyEvent;if(!e.hasModifier(r)&&e.isKey(["h","H"],r))return t.trigger("handTool"),!0}),n("globalConnectTool",function(i){var r=i.keyEvent;if(!e.hasModifier(r)&&e.isKey(["c","C"],r))return t.trigger("globalConnectTool"),!0}),n("directEditing",function(i){var r=i.keyEvent;if(!e.hasModifier(r)&&e.isKey(["e","E"],r))return t.trigger("directEditing"),!0}),n("replaceElement",function(i){var r=i.keyEvent;if(!e.hasModifier(r)&&e.isKey(["r","R"],r))return t.trigger("replaceElement",r),!0})};const D2={__depends__:[jp],__init__:["keyboardBindings"],keyboardBindings:["type",Zc]};var O2={moveSpeed:1,moveSpeedAccelerated:10},I2=1500,G_="left",W_="up",U_="right",q_="down",L2={ArrowLeft:G_,Left:G_,ArrowUp:W_,Up:W_,ArrowRight:U_,Right:U_,ArrowDown:q_,Down:q_},N2={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 Y_(e,t,n,i,r){var o=this;this._config=D({},O2,e||{}),t.addListener(I2,function(a){var s=a.keyEvent,c=L2[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=N2[a](u),p=i.allowed("elements.move",{shapes:c,hints:{keyboardMove:!0}});p&&n.moveElements(c,l)}}}Y_.$inject=["config.keyboardMoveSelection","keyboard","modeling","rules","selection"];const B2={__depends__:[jp,zn],__init__:["keyboardMoveSelection"],keyboardMoveSelection:["type",Y_]};var K_=10;function Oa(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=OS(l,p,u),c.newBounds=LS(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:ue(l)})}function s(c){var u=c.shape,l=c.canExecute,p=c.newBounds;if(l){if(p=fh(p),!$2(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)})}Oa.prototype.canResize=function(e){var t=this._rules,n=Xn(e,["newBounds","shape","delta","direction"]);return t.allowed("shape.resize",n)},Oa.prototype.activate=function(e,t,n){var i=this._dragging,r,o;if(typeof n=="string"&&(n={direction:n}),r=D({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,X_(t,o),"resize",{autoActivate:!0,cursor:j2(o),data:{shape:t,context:r}})},Oa.prototype.computeMinResizeBox=function(e){var t=e.shape,n=e.direction,i,r;return i=e.minDimensions||{width:K_,height:K_},r=Jh(t,e.childrenBoxPadding),NS(n,t,i,r)},Oa.$inject=["eventBus","rules","modeling","dragging"];function $2(e,t){return e.x!==t.x||e.y!==t.y||e.width!==t.width||e.height!==t.height}function X_(e,t){var n=fe(e),i=ue(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 j2(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 Z_="djs-resizing",Q_="resize-not-ok",F2=500;function J_(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,Z_)),s.width>5&&ne(c,{x:s.x,width:s.width}),s.height>5&&ne(c,{y:s.y,height:s.height}),o.canExecute?ke(c).remove(Q_):ke(c).add(Q_)}function r(o){var a=o.shape,s=o.frame;s&&Dt(o.frame),t.removeMarker(a,Z_)}e.on("resize.move",F2,function(o){i(o.context)}),e.on("resize.cleanup",function(o){r(o.context)})}J_.$inject=["eventBus","canvas","previewSupport"];var Qc=-6,Jc=8,eu=20,Ia="djs-resizer",H2=["n","w","s","e","nw","ne","se","sw"];function fr(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,dn(r.addResizer,r))}),e.on("shape.changed",function(o){var a=o.element;n.isSelected(a)&&(r.removeResizers(),r.addResizer(a))})}fr.prototype.makeDraggable=function(e,t,n){var i=this._resize;function r(o){er(o)&&i.activate(o,e,n)}ve.bind(t,"mousedown",r),ve.bind(t,"touchstart",r)},fr.prototype._createResizer=function(e,t,n,i){var r=this._getResizersParent(),o=z2(i),a=ce("g");ke(a).add(Ia),ke(a).add(Ia+"-"+e.id),ke(a).add(Ia+"-"+i),ye(r,a);var s=ce("rect");ne(s,{x:-Jc/2+o.x,y:-Jc/2+o.y,width:Jc,height:Jc}),ke(s).add(Ia+"-visual"),ye(a,s);var c=ce("rect");return ne(c,{x:-eu/2+o.x,y:-eu/2+o.y,width:eu,height:eu}),ke(c).add(Ia+"-hit"),ye(a,c),hs(a,t,n),a},fr.prototype.createResizer=function(e,t){var n=X_(e,t),i=this._createResizer(e,n.x,n.y,t);this.makeDraggable(e,i,t)},fr.prototype.addResizer=function(e){var t=this;Xe(e)||M(H2,function(n){t._resize.canResize({shape:e,direction:n})&&t.createResizer(e,n)})},fr.prototype.removeResizers=function(){var e=this._getResizersParent();os(e)},fr.prototype._getResizersParent=function(){return this._canvas.getLayer("resizers")},fr.$inject=["eventBus","canvas","selection","resize"];function z2(e){var t={x:0,y:0};return e.indexOf("e")!==-1?t.x=-Qc:e.indexOf("w")!==-1&&(t.x=Qc),e.indexOf("s")!==-1?t.y=-Qc:e.indexOf("n")!==-1&&(t.y=Qc),t}const eb={__depends__:[fi,Pi,go],__init__:["resize","resizePreview","resizeHandles"],resize:["type",Oa],resizePreview:["type",J_],resizeHandles:["type",fr]};var V2=2e3;function La(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"],V2,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||Se(c,["bpmn:Activity","bpmn:Event","bpmn:TextAnnotation","bpmn:Participant"]))&&i.activate(c)}}La.$inject=["eventBus","bpmnFactory","canvas","directEditing","modeling","resizeHandles","textRenderer"],La.prototype.activate=function(e){var t=kn(e);if(t!==void 0){var n={text:t},i=this.getEditingBBox(e);D(n,i);var r={},o=n.style||{};return D(o,{backgroundColor:null,border:null}),(Se(e,["bpmn:Task","bpmn:Participant","bpmn:Lane","bpmn:CallActivity"])||tb(e))&&D(r,{centerVertically:!0}),Xi(e)&&(D(r,{resizable:!0,autoResize:!0}),D(o,{backgroundColor:"#ffffff",border:"1px solid #ccc"})),y(e,"bpmn:TextAnnotation")&&(D(r,{resizable:!0,autoResize:!0}),D(o,{backgroundColor:"#ffffff",border:"1px solid #ccc"})),D(n,{options:r,style:o}),n}},La.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(y(e,"bpmn:Lane")||U2(e)){var h=jt(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};D(o,m),D(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(W2(e)){var g=jt(e),S=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};D(o,S),D(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)"})}(Se(e,["bpmn:Task","bpmn:CallActivity"])||tb(e))&&(D(o,{width:i.width,height:i.height}),D(d,{fontSize:p+"px",lineHeight:f,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px"})),G2(e)&&(D(o,{width:i.width,x:i.x}),D(d,{fontSize:p+"px",lineHeight:f,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px"}));var E=1,b=i.width+2*E;if(n.labelTarget&&(D(o,{width:b,height:i.height+2*E,x:i.x-E,y:i.y-E}),D(d,{fontSize:u+"px",lineHeight:l})),Xi(n)&&!vs(n)&&!Ee(n)){var x=Ju(e),w=t.getAbsoluteBBox({x:x.x,y:x.y,width:0,height:0}),T=u,I=Pr.width*a+2*E;D(o,{width:I,height:T+2*E,x:w.x-I/2,y:w.y-T/2-E}),D(d,{fontSize:u+"px",lineHeight:l})}return y(e,"bpmn:TextAnnotation")&&(D(o,{width:i.width+2*E,height:i.height+2*E,x:i.x-E,y:i.y-E,minWidth:30*a,minHeight:10*a}),D(d,{textAlign:"left",paddingTop:no*a+"px",paddingBottom:no*a+"px",paddingLeft:no*a+"px",paddingRight:no*a+"px",fontSize:p+"px",lineHeight:f})),{bounds:o,style:d}},La.prototype.update=function(e,t,n,i){var r,o;y(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}),q2(t)&&(t=null),this._modeling.updateLabel(e,t,r)};function tb(e){return y(e,"bpmn:SubProcess")&&!Me(e)}function G2(e){return y(e,"bpmn:SubProcess")&&Me(e)}function W2(e){return y(e,"bpmn:Participant")&&!Me(e)}function U2(e){return y(e,"bpmn:Participant")&&Me(e)}function q2(e){return!e||!e.trim()}var nb="djs-element-hidden",ib="djs-label-hidden";function rb(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,y(o,"bpmn:TextAnnotation")){a=t.getAbsoluteBBox(o),s=ce("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=ce("path");ne(p,{d:l,strokeWidth:2,stroke:Y2(o)}),ye(s,p),ye(r,s),Wt(s,o.x,o.y)}y(o,"bpmn:TextAnnotation")||o.labelTarget?t.addMarker(o,nb):(y(o,"bpmn:Task")||y(o,"bpmn:CallActivity")||y(o,"bpmn:SubProcess")||y(o,"bpmn:Participant")||y(o,"bpmn:Lane"))&&t.addMarker(o,ib)}),e.on("directEditing.resize",function(c){if(y(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}});ne(i.path,{d:f})}}),e.on(["directEditing.complete","directEditing.cancel"],function(c){var u=c.active;u&&(t.removeMarker(u.element.label||u.element,nb),t.removeMarker(o,ib)),o=void 0,a=void 0,s&&(Dt(s),s=void 0)})}rb.$inject=["eventBus","canvas","pathMap"];function Y2(e,t){var n=Ie(e);return n.get("stroke")||t||"black"}const K2={__depends__:[vp,eb,T_],__init__:["labelEditingProvider","labelEditingPreview"],labelEditingProvider:["type",La],labelEditingPreview:["type",rb]};var X2=500,Z2=1e3;function mi(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){Lw(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"],X2,function(o){var a=o.element,s=o.gfx,c=qe(".djs-outline",s);c&&i.updateOutline(a,c)})}mi.prototype.createOutline=function(e){var t=this._elementRegistry.getGraphics(e);if(!t)throw new Error("cannot create outline for non-rendered element");var n=qe(".djs-outline",t);return n||(n=this.getOutline(e)||this._createOutlineGfx(),ye(t,n),this.updateOutline(e,n)),n},mi.prototype._createOutlineGfx=function(){var e=ce("rect");return ne(e,D({x:0,y:0,rx:4,width:100,height:100},this._outlineStyle)),e},mi.prototype.updateOutline=function(e,t){e.waypoints?this.updateConnectionOutline(t,e):this.updateShapeOutline(t,e)},mi.prototype.updateShapeOutline=function(e,t){var n=!1,i=this._getProviders();i.length&&M(i,function(r){n=n||r.updateOutline(t,e)}),n||ne(e,{x:-this._outlineOffset,y:-this._outlineOffset,width:t.width+this._outlineOffset*2,height:t.height+this._outlineOffset*2})},mi.prototype.updateConnectionOutline=function(e,t){var n=Et(t);ne(e,{x:n.x-this._outlineOffset,y:n.y-this._outlineOffset,width:n.width+this._outlineOffset*2,height:n.height+this._outlineOffset*2})},mi.prototype.registerProvider=function(e,t){t||(t=e,e=Z2),this._eventBus.on("outline.getProviders",e,function(n){n.providers.push(t)})},mi.prototype._getProviders=function(){var e=this._eventBus.createEvent({type:"outline.getProviders",providers:[]});return this._eventBus.fire(e),e.providers},mi.prototype.getOutline=function(e){var t,n=this._getProviders();return M(n,function(i){Bt(i.getOutline)&&(t=t||i.getOutline(e))}),t},mi.$inject=["eventBus","styles","elementRegistry"];var tu=6;function df(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)})}df.prototype._updateMultiSelectionOutline=function(e){var t=this._canvas.getLayer("selectionOutline");os(t);var n=e.length>1,i=this._canvas.getContainer();if(ke(i)[n?"add":"remove"]("djs-multi-select"),!!n){var r=Q2(Et(e)),o=ce("rect");ne(o,D({rx:3},r)),ke(o).add("djs-selection-outline"),ye(t,o)}},df.$inject=["eventBus","canvas","selection"];function Q2(e){return{x:e.x-tu,y:e.y-tu,width:e.width+tu*2,height:e.height+tu*2}}const hf={__depends__:[zn],__init__:["outline","multiSelectionOutline"],outline:["type",mi],multiSelectionOutline:["type",df]},ob=["bpmn:Event","bpmn:SequenceFlow","bpmn:Gateway"],ab={class:"bjs-label-link",stroke:"var(--element-selected-outline-secondary-stroke-color)",strokeDasharray:"5, 5"},J2=15,nu=2;function sb(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=>Se(h,ob));if(f.length===1){const h=f[0];Ee(h)?a(h,h.labelTarget):(d=h.labels)!=null&&d.length&&a(h.labels[0],h)}if(f.length===2){const h=f.find(Ee),m=f.find(g=>{var S;return(S=g.labels)==null?void 0:S.includes(h)});h&&m&&a(h,m)}}),e.on("shape.changed",function({element:p}){var f;!Se(p,ob)||!l(p)||(Ee(p)?a(p,p.labelTarget):(f=p.labels)!=null&&f.length&&a(p.labels[0],p))});function a(p,f){const d=$o([fe(f),fe(p)],ab),h=d.getAttribute("d"),g=r.isSelected(p)?c(p):u(p),S=zo(g,h);if(!S)return;const b=r.isSelected(f)?c(f):u(f),x=zo(b,h)||fe(f);Qo(x,S)<J2||(Wu(d,[x,S]),ye(o,d))}function s(){rs(`.${ab.class}`,o).forEach(Dt)}function c(p){const f=i.getOutline(p);if(!f)return u(p);if(f.x){const d={x:p.x+dr(f,"x")-nu,y:p.y+dr(f,"y")-nu,width:dr(f,"width")+nu*2,height:dr(f,"height")+nu*2};return tl(d,dr(f,"rx"))}if(f.cx){const d=dr(f,"r"),h={x:p.x+dr(f,"cx")-d,y:p.y+dr(f,"cy")-d,width:d*2,height:d*2};return Nh(h)}}function u(p){return n.getShapePath(p)}function l(p){return r.isSelected(p)}}sb.$inject=["eventBus","canvas","graphicsFactory","outline","selection"];function dr(e,t){return parseFloat(ne(e,t)||0)}const ek={__depends__:[zn,hf],__init__:["labelLink"],labelLink:["type",sb]};var tk=new mo("tt");function nk(e){var t=nt('<div class="djs-tooltip-container" />');return ln(t,{position:"absolute",width:"0",height:"0"}),e.insertBefore(t,e.firstChild),t}function ik(e,t,n){ln(e,{left:t+"px",top:n+"px"})}function mf(e,t){e.style.display=t===!1?"none":""}var cb="djs-tooltip",gf="."+cb;function mn(e,t){this._eventBus=e,this._canvas=t,this._ids=tk,this._tooltipDefaults={show:{minZoom:.7,maxZoom:5}},this._tooltips={},this._tooltipRoot=nk(t.getContainer());var n=this;_n.bind(this._tooltipRoot,gf,"mousedown",function(i){i.stopPropagation()}),_n.bind(this._tooltipRoot,gf,"mouseover",function(i){n.trigger("mouseover",i)}),_n.bind(this._tooltipRoot,gf,"mouseout",function(i){n.trigger("mouseout",i)}),this._init()}mn.$inject=["eventBus","canvas"],mn.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=D({},this._tooltipDefaults,e,{id:t}),this._addTooltip(e),e.timeout&&this.setTimeout(e),t},mn.prototype.trigger=function(e,t){var n=t.delegateTarget||t.target,i=this.get(en(n,"data-tooltip-id"));i&&(e==="mouseover"&&i.timeout&&this.clearTimeout(i),e==="mouseout"&&i.timeout&&(i.timeout=1e3,this.setTimeout(i)))},mn.prototype.get=function(e){return typeof e!="string"&&(e=e.id),this._tooltips[e]},mn.prototype.clearTimeout=function(e){if(e=this.get(e),!!e){var t=e.removeTimer;t&&(clearTimeout(t),e.removeTimer=null)}},mn.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)}},mn.prototype.remove=function(e){var t=this.get(e);t&&(ai(t.html),ai(t.htmlContainer),delete t.htmlContainer,delete this._tooltips[t.id])},mn.prototype.show=function(){mf(this._tooltipRoot)},mn.prototype.hide=function(){mf(this._tooltipRoot,!1)},mn.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},mn.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)),gn(n)&&(n=nt(n)),i=nt('<div data-tooltip-id="'+t+'" class="'+cb+'">'),ln(i,{position:"absolute"}),i.appendChild(n),e.type&&st(i).add("djs-tooltip-"+e.type),e.className&&st(i).add(e.className),e.htmlContainer=i,r.appendChild(i),this._tooltips[t]=e,this._updateTooltip(e)},mn.prototype._updateTooltip=function(e){var t=e.position,n=e.htmlContainer;ik(n,t.x,t.y)},mn.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),mf(i,r))})},mn.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 rk={__init__:["tooltips"],tooltips:["type",mn]};var ok="flow elements must be children of pools/participants",ak="Data object must be placed within a pool/participant.";function ub(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;y(s,"bpmn:Collaboration")&&(y(a,"bpmn:FlowNode")?i(r,n(ok)):y(a,"bpmn:DataObjectReference")&&i(r,n(ak)))})}ub.$inject=["eventBus","tooltips","translate"];const sk={__depends__:[rk],__init__:["modelingFeedback"],modelingFeedback:["type",ub]};var ck=500,uk=1250,lk=1500,iu=Math.round;function pk(e){return{x:e.x+iu(e.width/2),y:e.y+iu(e.height/2)}}function lb(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",lk,function(s){var c=s.context,u=s.shape,l=i.get().slice();l.indexOf(u)===-1&&(l=[u]),l=fk(l),D(c,{shapes:l,validatedShapes:l,shape:u})}),e.on("shape.move.start",uk,function(s){var c=s.context,u=c.validatedShapes,l;if(l=c.canExecute=o(u),!l)return!1}),e.on("shape.move.move",ck,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=iu(u.x),u.y=iu(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(er(s)){var c=lo(s);if(!c)throw new Error("must supply DOM mousedown event");return a(c,s.element)}});function a(s,c,u,l){if(Nt(u)&&(l=u,u=!1),!(c.waypoints||!c.parent)&&!ke(s.target).has("djs-hit-no-move")){var p=pk(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}lb.$inject=["eventBus","dragging","modeling","selection","rules"];function fk(e){var t=Wr(e,"id");return Ae(e,function(n){for(;n=n.parent;)if(t[n.id])return!1;return!0})}var pb=499,vf="djs-dragging",fb="drop-ok",db="drop-not-ok",hb="new-parent",mb="attach-ok";function gb(e,t,n,i){function r(c){var u=o(c),l=dk(u);return l}function o(c){var u=jo(c),l=u.flatMap(d=>(d.incoming||[]).concat(d.outgoing||[])),p=u.concat(l),f=[...new Set(p)];return f}function a(c,u){[mb,fb,db,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,vf),c.allDraggedElements?c.allDraggedElements.push(u):c.allDraggedElements=[u]}e.on("shape.move.start",pb,function(c){var u=c.context,l=u.shapes,p=u.allDraggedElements,f=r(l);if(!u.dragGroup){var d=ce("g");ne(d,n.cls("djs-drag-group",["no-events"]));var h=t.getActiveLayer();ye(h,d),u.dragGroup=d}f.forEach(function(m){i.addDragger(m,u.dragGroup)}),p?p=pu([p,o(l)]):p=o(l),M(p,function(m){t.addMarker(m,vf)}),u.allDraggedElements=p,u.differentParents=hk(l)}),e.on("shape.move.move",pb,function(c){var u=c.context,l=u.dragGroup,p=u.target,f=u.shape.parent,d=u.canExecute;p&&(d==="attach"?a(p,mb):u.canExecute&&f&&p.id!==f.id?a(p,hb):a(p,u.canExecute?fb:db)),Wt(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,vf)}),p&&Dt(p)}),this.makeDraggable=s}gb.$inject=["eventBus","canvas","styles","previewSupport"];function dk(e){var t=new Set;e.forEach(function(i){t.add(i.id)});var n=Ae(e,function(i){return Xe(i)?t.has(i.source.id)&&t.has(i.target.id):!0});return n}function hk(e){return gx(Wr(e,function(t){return t.parent&&t.parent.id}))!==1}const mk={__depends__:[Ys,zn,hf,fi,Pi,go],__init__:["move","movePreview"],move:["type",lb],movePreview:["type",gb]};var vb=".djs-palette-toggle",yb=".entry",gk=vb+", "+yb,yf="djs-palette-",vk="shown",_f="open",_b="two-column",yk=1e3;function Pt(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()})}Pt.$inject=["eventBus","canvas"],Pt.prototype.registerProvider=function(e,t){t||(t=e,e=yk),this._eventBus.on("palette.getProviders",e,function(n){n.providers.push(t)}),this._rebuild()},Pt.prototype.getEntries=function(){var e=this._getProviders();return e.reduce(bk,{})},Pt.prototype._rebuild=function(){if(this._diagramInitialized){var e=this._getProviders();e.length&&(this._container||this._init(),this._update())}},Pt.prototype._init=function(){var e=this,t=this._eventBus,n=this._getParentContainer(),i=this._container=nt(Pt.HTML_MARKUP);n.appendChild(i),st(n).add(yf+vk),_n.bind(i,gk,"click",function(r){var o=r.delegateTarget;if(Nu(o,vb))return e.toggle();e.trigger("click",r)}),ve.bind(i,"mousedown",function(r){r.stopPropagation()}),_n.bind(i,yb,"dragstart",function(r){e.trigger("dragstart",r)}),t.on("canvas.resized",this._layoutChanged,this),t.fire("palette.create",{container:i})},Pt.prototype._getProviders=function(e){var t=this._eventBus.createEvent({type:"palette.getProviders",providers:[]});return this._eventBus.fire(t),t.providers},Pt.prototype._toggleState=function(e){e=e||{};var t=this._getParentContainer(),n=this._container,i=this._eventBus,r,o=st(n),a=st(t);"twoColumn"in e?r=e.twoColumn:r=this._needsCollapse(t.clientHeight,this._entries||{}),o.toggle(_b,r),a.toggle(yf+_b,r),"open"in e&&(o.toggle(_f,e.open),a.toggle(yf+_f,e.open)),i.fire("palette.changed",{twoColumn:r,open:this.isOpen()})},Pt.prototype._update=function(){var e=qe(".djs-palette-entries",this._container),t=this._entries=this.getEntries();ns(e),M(t,function(n,i){var r=n.group||"default",o=qe("[data-group="+ba(r)+"]",e);o||(o=nt('<div class="group"></div>'),en(o,"data-group",r),e.appendChild(o));var a=n.html||(n.separator?'<hr class="separator" />':'<div class="entry" draggable="true"></div>'),s=nt(a);if(o.appendChild(s),!n.separator&&(en(s,"data-action",i),n.title&&en(s,"title",n.title),n.className&&_k(s,n.className),n.imageUrl)){var c=nt("<img>");en(c,"src",n.imageUrl),s.appendChild(c)}}),this.open()},Pt.prototype.trigger=function(e,t,n){var i,r,o=t.delegateTarget||t.target;return o?(i=en(o,"data-action"),r=t.originalEvent||t,this.triggerEntry(i,e,r,n)):t.preventDefault()},Pt.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(Bt(a)){if(t==="click")return a(n,i)}else if(a[t])return a[t](n,i);n.preventDefault()}},Pt.prototype._layoutChanged=function(){this._toggleState({})},Pt.prototype._needsCollapse=function(e,t){var n=50,i=Object.keys(t).length*46;return e<i+n},Pt.prototype.close=function(){this._toggleState({open:!1,twoColumn:!1})},Pt.prototype.open=function(){this._toggleState({open:!0})},Pt.prototype.toggle=function(){this.isOpen()?this.close():this.open()},Pt.prototype.isActiveTool=function(e){return e&&this._activeTool===e},Pt.prototype.updateToolHighlight=function(e){var t,n;this._toolsContainer||(t=qe(".djs-palette-entries",this._container),this._toolsContainer=qe("[data-group=tools]",t)),n=this._toolsContainer,M(n.children,function(i){var r=i.getAttribute("data-action");if(r){var o=st(i);r=r.replace("-tool",""),o.contains("entry")&&r===e?o.add("highlighted-entry"):o.remove("highlighted-entry")}})},Pt.prototype.isOpen=function(){return st(this._container).has(_f)},Pt.prototype._getParentContainer=function(){return this._canvas.getContainer()},Pt.HTML_MARKUP='<div class="djs-palette"><div class="djs-palette-entries"></div><div class="djs-palette-toggle"></div></div>';function _k(e,t){var n=st(e),i=pe(t)?t:t.split(/\s+/g);i.forEach(function(r){n.add(r)})}function bk(e,t){var n=t.getPaletteEntries();return Bt(n)?n(e):(M(n,function(i,r){e[r]=i}),e)}const xk={__init__:["palette"],palette:["type",Pt]};var bb="crosshair",xb="selected",Ek="djs-dragging-active-lasso";function hr(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=ce("rect");ne(d,{class:"djs-lasso-overlay",width:1,height:1,x:0,y:0}),ye(f,d),u(!0),this.update(p)},update:function(p){var f=p.frame,d=p.bbox;f&&d&&ne(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,xb);for(const g of h)m.has(g)||t.addMarker(g,xb)}},remove:function(p){this.update(p),p.frame&&Dt(p.frame),u(!1)}};function u(p){ke(t.getContainer()).toggle(Ek,p)}function l(p){var f=i.getAll();return new Set(Gr(Zr(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=Eb(p),f.add=Hs(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=Eb(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(Hs(p))return s.activateLasso(p.originalEvent),!0})}hr.$inject=["eventBus","canvas","dragging","elementRegistry","selection","toolManager","mouse"],hr.prototype.activateLasso=function(e,t){this._dragging.init(e,"lasso",{autoActivate:t,cursor:bb,data:{context:{}},keepSelection:!0})},hr.prototype.activateSelection=function(e,t){this._dragging.init(e,"lasso.selection",{trapClick:!1,autoActivate:t,cursor:bb,data:{context:{}},keepSelection:!0})},hr.prototype._select=function(e){this._selection.select(e)},hr.prototype.select=function(e,t,n=[]){var i=Gr(Zr(e,t));this._select([...n,...i])},hr.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateSelection(e,!!e)},hr.prototype.isActive=function(){var e=this._dragging.context();return e&&/^lasso/.test(e.prefix)};function Eb(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 wk={__depends__:[Qs,ra],__init__:["lassoTool"],lassoTool:["type",hr]};var bf=1500,wb="grab";function Po(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",bf,function(c){if(ta(c))return a.activateMove(c.originalEvent,!0),!1}),s&&s.addListener(bf,function(c){if(!(!Sb(c.keyEvent)||a.isActive())){var u=a._mouse.getLastMoveEvent();a.activateMove(u,!!u)}},"keyboard.keydown"),s&&s.addListener(bf,function(c){!Sb(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!ta(c)&&l&&e.once("hand.move.ended",function(p){a.activateHand(p.originalEvent,!0,!0)}),!1})}Po.$inject=["eventBus","canvas","dragging","injector","toolManager","mouse"],Po.prototype.activateMove=function(e,t,n){typeof t=="object"&&(n=t,t=!1),this._dragging.init(e,"hand.move",{autoActivate:t,cursor:wb,data:{context:n||{}}})},Po.prototype.activateHand=function(e,t,n){this._dragging.init(e,"hand",{trapClick:!1,autoActivate:t,cursor:wb,data:{context:{reactivate:n}}})},Po.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateHand(e,!!e)},Po.prototype.isActive=function(){var e=this._dragging.context();return e?/^(hand|hand\.move)$/.test(e.prefix):!1};function Sb(e){return Ot("Space",e)}const Sk={__depends__:[Qs,ra],__init__:["handTool"],handTool:["type",Po]};var Rb="connect-ok",Cb="connect-not-ok";function Ao(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?Rb:Cb))}),e.on(["global-connect.out","global-connect.cleanup"],function(c){var u=c.context.startTarget,l=c.context.canStartConnect;u&&i.removeMarker(u,l?Rb:Cb)}),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})}Ao.$inject=["eventBus","dragging","connect","canvas","toolManager","rules","mouse"],Ao.prototype.start=function(e,t){this._dragging.init(e,"global-connect",{autoActivate:t,trapClick:!1,data:{context:{}}})},Ao.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();return this.start(e,!!e)},Ao.prototype.isActive=function(){var e=this._dragging.context();return e&&/^global-connect/.test(e.prefix)},Ao.prototype.canStartConnect=function(e){return this._rules.allowed("connection.start",{source:e})};const Rk={__depends__:[uf,fi,Pi,Qs,ra],globalConnect:["type",Ao]};function xf(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)}xf.$inject=["palette","create","elementFactory","spaceTool","lassoTool","handTool","globalConnect","translate"],xf.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(S){var E=n.createShape(D({type:p},m));t.start(S,E)}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 D(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 Ck={__depends__:[xk,Xs,ev,wk,Sk,Rk,Yo],__init__:["paletteProvider"],paletteProvider:["type",xf]};var Pk=250;function Ef(e,t,n,i,r){U.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);D(p,{x:f.x,y:f.y});var d=n.createShape(p);i.addShape(d,f.parent);var h=qe('[data-element-id="'+ba(f.id)+'"]',s.dragGroup);h&&ne(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=qe('[data-element-id="'+ba(l)+'"]',s.dragGroup);p&&ne(p,{display:"inline"}),u.remove(),c[l]&&delete c[l]})}e.on("shape.move.move",Pk,function(s){var c=s.context,u=c.canExecute;c.visualReplacements||(c.visualReplacements={}),u&&u.replacements?o(c):a(c)})}Ef.$inject=["eventBus","elementRegistry","elementFactory","canvas","previewSupport"],te(Ef,U);const Ak={__depends__:[go],__init__:["bpmnReplacePreview"],bpmnReplacePreview:["type",Ef]};var Tk=1250,wf=40,Mk=20,kk=10,Pb=20,Ab=["x","y"],Dk=Math.abs;function Tb(e){e.on(["connect.hover","connect.move","connect.end"],Tk,function(t){var n=t.context,i=n.canExecute,r=n.start,o=n.hover,a=n.source,s=n.target;t.originalEvent&&En(t.originalEvent)||(n.initialConnectionStart||(n.initialConnectionStart=n.connectionStart),i&&o&&Ok(t,o,Bk(o)),o&&Nk(i,["bpmn:Association","bpmn:DataInputAssociation","bpmn:DataOutputAssociation","bpmn:SequenceFlow"])?(n.connectionStart=Wn(r),Se(o,["bpmn:Event","bpmn:Gateway"])&&Mb(t,Wn(o)),Se(o,["bpmn:Task","bpmn:SubProcess"])&&Ik(t,o),y(a,"bpmn:BoundaryEvent")&&s===a.host&&Lk(t)):kb(i,"bpmn:MessageFlow")?(y(r,"bpmn:Event")&&(n.connectionStart=Wn(r)),y(o,"bpmn:Event")&&Mb(t,Wn(o))):n.connectionStart=n.initialConnectionStart)})}Tb.$inject=["eventBus"];function Ok(e,t,n){Ab.forEach(function(i){var r=Db(i,t);e[i]<t[i]+n?Ct(e,i,t[i]+n):e[i]>t[i]+r-n&&Ct(e,i,t[i]+r-n)})}function Ik(e,t){var n=Wn(t);Ab.forEach(function(i){$k(e,t,i)&&Ct(e,i,n[i])})}function Lk(e){var t=e.context,n=t.source,i=t.target;if(!jk(t)){var r=Wn(n),o=Gt(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;Dk(c-r[s])<wf&&(c>r[s]?u=r[s]+wf:u=r[s]-wf,Ct(e,s,u))})}}function Mb(e,t){Ct(e,"x",t.x),Ct(e,"y",t.y)}function kb(e,t){return e&&e.type===t}function Nk(e,t){return Ni(t,function(n){return kb(e,n)})}function Db(e,t){return e==="x"?t.width:t.height}function Bk(e){return y(e,"bpmn:Task")?kk:Mk}function $k(e,t,n){return e[n]>t[n]+Pb&&e[n]<t[n]+Db(n,t)-Pb}function jk(e){var t=e.hover,n=e.source;return t&&n&&t===n}function mr(){this._targets={},this._snapOrigins={},this._snapLocations=[],this._defaultSnaps={}}mr.prototype.getSnapOrigin=function(e){return this._snapOrigins[e]},mr.prototype.setSnapOrigin=function(e,t){this._snapOrigins[e]=t,this._snapLocations.indexOf(e)===-1&&this._snapLocations.push(e)},mr.prototype.addDefaultSnap=function(e,t){var n=this._defaultSnaps[e];n||(n=this._defaultSnaps[e]=[]),n.push(t)},mr.prototype.getSnapLocations=function(){return this._snapLocations},mr.prototype.setSnapLocations=function(e){this._snapLocations=e},mr.prototype.pointsForTarget=function(e){var t=e.id||e,n=this._targets[t];return n||(n=this._targets[t]=new ru,n.initDefaults(this._defaultSnaps)),n};function ru(){this._snapValues={}}ru.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)},ru.prototype.snap=function(e,t,n,i){var r=this._snapValues[t];return r&&PM(e[n],r[n],i)},ru.prototype.initDefaults=function(e){var t=this;M(e||{},function(n,i){M(n,function(r){t.add(i,r)})})};var Fk=1250;function gi(e,t,n){var i=this;this._elementRegistry=e,t.on(["create.start","shape.move.start"],function(r){i.initSnap(r)}),t.on(["create.move","create.end","shape.move.move","shape.move.end"],Fk,function(r){var o=r.context,a=o.shape,s=o.snapContext,c=o.target;if(!(r.originalEvent&&En(r.originalEvent))&&!(Co(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()})}gi.$inject=["elementRegistry","eventBus","snapping"],gi.prototype.initSnap=function(e){var t=this._elementRegistry,n=e.context,i=n.shape,r=n.snapContext;r||(r=n.snapContext=new mr);var o;t.get(i.id)?o=Wn(i,e):o={x:e.x+Wn(i).x,y:e.y+Wn(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}),Ee(i)||(r.setSnapOrigin("top-left",{x:a.x-e.x,y:a.y-e.y}),r.setSnapOrigin("bottom-right",{x:s.x-e.x,y:s.y-e.y})),r},gi.prototype.addSnapTargetPoints=function(e,t,n){var i=this.getSnapTargets(t,n);return M(i,function(r){if(Ee(r)){Ee(t)&&e.add("mid",Wn(r));return}if(Xe(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",Wn(r))}),!me(t.x)||!me(t.y)||this._elementRegistry.get(t.id)&&e.add("mid",Wn(t)),e},gi.prototype.getSnapTargets=function(e,t){return y_(t).filter(function(n){return!Hk(n)})};function Hk(e){return!!e.hidden}var Ob=1500;function To(e,t){t.invoke(gi,this),e.on(["create.move","create.end"],Ob,Wk),e.on(["create.move","create.end","shape.move.move","shape.move.end"],Ob,function(n){var i=n.context,r=i.canExecute,o=i.target,a=r&&(r==="attach"||r.attach);a&&!Co(n)&&zk(n,o)})}te(To,gi),To.$inject=["eventBus","injector"],To.prototype.initSnap=function(e){var t=gi.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",Lb(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",Lb(o,i,e))}),y(n,"bpmn:Participant")&&t.setSnapLocations(["top-left","bottom-right","mid"]),t},To.prototype.addSnapTargetPoints=function(e,t,n){gi.prototype.addSnapTargetPoints.call(this,e,t,n);var i=this.getSnapTargets(t,n);M(i,function(o){(Gk(o)||Vk([t,o],"bpmn:TextAnnotation"))&&(e.add("top-left",g_(o)),e.add("bottom-right",v_(o)))});var r=this._elementRegistry;return M(t.incoming,function(o){if(r.get(t.id)){Ib(i,o.source)||e.add("mid",fe(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)){Ib(i,o.target)||e.add("mid",fe(o.target));var a=o.waypoints[o.waypoints.length-1];e.add(o.id+"-docking",a.original||a)}}),y(n,"bpmn:SequenceFlow")&&(e=this.addSnapTargetPoints(e,t,n.parent)),e},To.prototype.getSnapTargets=function(e,t){return gi.prototype.getSnapTargets.call(this,e,t).filter(function(n){return!y(n,"bpmn:Lane")})};function zk(e,t){var n=ue(t),i=Xm(e,t),r=e.context,o=r.shape,a;o.parent?a={x:0,y:0}:a=fe(o),/top/.test(i)?Ct(e,"y",n.top-a.y):/bottom/.test(i)&&Ct(e,"y",n.bottom-a.y),/left/.test(i)?Ct(e,"x",n.left-a.x):/right/.test(i)&&Ct(e,"x",n.right-a.x)}function Vk(e,t){return e.every(function(n){return y(n,t)})}function Gk(e){return y(e,"bpmn:SubProcess")&&Me(e)?!0:y(e,"bpmn:Participant")}function Wk(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)&&Ct(e,"x",e.x),(i&&i>=e.y||o&&o<=e.y)&&Ct(e,"y",e.y)}}function Ib(e,t){return e.indexOf(t)!==-1}function Lb(e,t,n){return t?{x:e.x-n.x,y:e.y-n.y}:{x:e.x,y:e.y}}var Uk=1250;function Na(e,t){var n=this;e.on(["resize.start"],function(i){n.initSnap(i)}),e.on(["resize.move","resize.end"],Uk,function(i){var r=i.context,o=r.shape,a=o.parent,s=r.direction,c=r.snapContext;if(!(i.originalEvent&&En(i.originalEvent))&&!Co(i)){var u=c.pointsForTarget(a);u.initialized||(u=n.addSnapTargetPoints(u,o,a,s),u.initialized=!0),Kk(s)&&Ct(i,"x",i.x),Xk(s)&&Ct(i,"y",i.y),t.snap(i,u)}}),e.on(["resize.cleanup"],function(){t.hide()})}Na.prototype.initSnap=function(e){var t=e.context,n=t.shape,i=t.direction,r=t.snapContext;r||(r=t.snapContext=new mr);var o=Nb(n,i);return r.setSnapOrigin("corner",{x:o.x-e.x,y:o.y-e.y}),r},Na.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",g_(o))}),e.add("corner",Nb(t,i)),e},Na.$inject=["eventBus","snapping"],Na.prototype.getSnapTargets=function(e,t){return y_(t).filter(function(n){return!qk(n,e)&&!Xe(n)&&!Yk(n)&&!Ee(n)})};function Nb(e,t){var n=fe(e),i=ue(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 qk(e,t){return e.host===t}function Yk(e){return!!e.hidden}function Kk(e){return e==="n"||e==="s"}function Xk(e){return e==="e"||e==="w"}var Zk=7,Qk=1e3;function gr(e){this._canvas=e,this._asyncHide=du(dn(this.hide,this),Qk)}gr.$inject=["canvas"],gr.prototype.snap=function(e,t){var n=e.context,i=n.snapContext,r=i.getSnapLocations(),o={x:Co(e,"x"),y:Co(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,Zk),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];Nt(s)&&Ct(e,a,s.originValue)})},gr.prototype._createLine=function(e){var t=this._canvas.getLayer("snap"),n=ce("path");return ne(n,{d:"M0,0 L0,0"}),ke(n).add("djs-snap-line"),ye(t,n),{update:function(i){me(i)?e==="horizontal"?ne(n,{d:"M-100000,"+i+" L+100000,"+i,display:""}):ne(n,{d:"M "+i+",-100000 L "+i+", +100000",display:""}):ne(n,{display:"none"})}}},gr.prototype._createSnapLines=function(){this._snapLines={horizontal:this._createLine("horizontal"),vertical:this._createLine("vertical")}},gr.prototype.showSnapLine=function(e,t){var n=this.getSnapLine(e);n&&n.update(t),this._asyncHide()},gr.prototype.getSnapLine=function(e){return this._snapLines||this._createSnapLines(),this._snapLines[e]},gr.prototype.hide=function(){M(this._snapLines,function(e){e.update()})};const Jk={__depends__:[{__init__:["createMoveSnapping","resizeSnapping","snapping"],createMoveSnapping:["type",gi],resizeSnapping:["type",Na],snapping:["type",gr]}],__init__:["connectSnapping","createMoveSnapping"],connectSnapping:["type",Tb],createMoveSnapping:["type",To]};var Bb=300;function _e(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=qe(_e.INPUT_SELECTOR,this._container),this._resultsContainer=qe(_e.RESULTS_CONTAINER_SELECTOR,this._container),this._canvas.getContainer().appendChild(this._container),t.on(["canvas.destroy","diagram.destroy","drag.init","elements.changed"],this.close,this)}_e.$inject=["canvas","eventBus","selection","translate"],_e.prototype._bindEvents=function(){var e=this;function t(n,i,r,o){e._eventMaps.push({el:n,type:r,listener:_n.bind(n,i,r,o)})}t(document,"html","click",function(n){e.close(!1)}),t(this._container,_e.INPUT_SELECTOR,"click",function(n){n.stopPropagation(),n.delegateTarget.focus()}),t(this._container,_e.RESULT_SELECTOR,"mouseover",function(n){n.stopPropagation(),e._scrollToNode(n.delegateTarget),e._preselect(n.delegateTarget)}),t(this._container,_e.RESULT_SELECTOR,"click",function(n){n.stopPropagation(),e._select(n.delegateTarget)}),t(this._container,_e.INPUT_SELECTOR,"keydown",function(n){Ot("ArrowUp",n)&&n.preventDefault(),Ot("ArrowDown",n)&&n.preventDefault()}),t(this._container,_e.INPUT_SELECTOR,"keyup",function(n){if(Ot("Escape",n))return e.close();if(Ot("Enter",n)){var i=e._getCurrentResult();return i?e._select(i):e.close(!1)}if(Ot("ArrowUp",n))return e._scrollToDirection(!0);if(Ot("ArrowDown",n))return e._scrollToDirection();Ot(["ArrowLeft","ArrowRight"],n)||e._search(n.delegateTarget.value)})},_e.prototype._unbindEvents=function(){this._eventMaps.forEach(function(e){_n.unbind(e.el,e.type,e.listener)})},_e.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=qe(_e.RESULT_SELECTOR,this._resultsContainer);this._scrollToNode(i),this._preselect(i)}},_e.prototype._scrollToDirection=function(e){var t=this._getCurrentResult();if(t){var n=e?t.previousElementSibling:t.nextElementSibling;n&&(this._scrollToNode(n),this._preselect(n))}},_e.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)}},_e.prototype._clearResults=function(){ns(this._resultsContainer),this._results={},this._eventBus.fire("searchPad.cleared")},_e.prototype._getCurrentResult=function(){return qe(_e.RESULT_SELECTED_SELECTOR,this._resultsContainer)},_e.prototype._createResultNode=function(e,t){var n=nt(_e.RESULT_HTML);return e.primaryTokens.length>0&&$b(n,e.primaryTokens,_e.RESULT_PRIMARY_HTML),$b(n,e.secondaryTokens,_e.RESULT_SECONDARY_HTML),en(n,_e.RESULT_ID_ATTRIBUTE,t),this._resultsContainer.appendChild(n),n},_e.prototype.registerProvider=function(e){this._searchProvider=e},_e.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,st(this._canvas.getContainer()).add("djs-search-open"),st(this._container).add("open"),this._searchInput.focus(),this._eventBus.fire("searchPad.opened"))},_e.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,st(this._canvas.getContainer()).remove("djs-search-open"),st(this._container).remove("open"),this._clearResults(),this._searchInput.value="",this._searchInput.blur(),this._eventBus.fire("searchPad.closed"),this._canvas.restoreFocus())},_e.prototype.toggle=function(){this.isOpen()?this.close():this.open()},_e.prototype.isOpen=function(){return this._open},_e.prototype._preselect=function(e){var t=this._getCurrentResult();if(e!==t){t&&st(t).remove(_e.RESULT_SELECTED_CLASS);var n=en(e,_e.RESULT_ID_ATTRIBUTE),i=this._results[n].element;st(e).add(_e.RESULT_SELECTED_CLASS),this._canvas.scrollToElement(i,{top:Bb}),this._selection.select(i),this._eventBus.fire("searchPad.preselected",i)}},_e.prototype._select=function(e){var t=en(e,_e.RESULT_ID_ATTRIBUTE),n=this._results[t].element;this._cachedSelection=null,this._cachedViewbox=null,this.close(!1),this._canvas.scrollToElement(n,{top:Bb}),this._selection.select(n),this._eventBus.fire("searchPad.selected",n)},_e.prototype._getBoxHtml=function(){const e=nt(_e.BOX_HTML),t=qe(_e.INPUT_SELECTOR,e);return t&&t.setAttribute("aria-label",this._translate("Search in diagram")),e};function $b(e,t,n){var i=eD(t),r=nt(n);r.innerHTML=i,e.appendChild(r)}function eD(e){var t="";return e.forEach(function(n){var i=Uv(n.value||n.matched||n.normal),r=n.match||n.matched;r?t+='<b class="'+_e.RESULT_HIGHLIGHT_CLASS+'">'+i+"</b>":t+=i}),t!==""?t:null}_e.CONTAINER_SELECTOR=".djs-search-container",_e.INPUT_SELECTOR=".djs-search-input input",_e.RESULTS_CONTAINER_SELECTOR=".djs-search-results",_e.RESULT_SELECTOR=".djs-search-result",_e.RESULT_SELECTED_CLASS="djs-search-result-selected",_e.RESULT_SELECTED_SELECTOR="."+_e.RESULT_SELECTED_CLASS,_e.RESULT_ID_ATTRIBUTE="data-result-id",_e.RESULT_HIGHLIGHT_CLASS="djs-search-highlight",_e.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>`,
|
|
343
|
+
</div>`,_e.RESULT_HTML='<div class="djs-search-result"></div>',_e.RESULT_PRIMARY_HTML='<div class="djs-search-result-primary"></div>',_e.RESULT_SECONDARY_HTML='<p class="djs-search-result-secondary"></p>';const tD={__depends__:[Yo,bc,zn],searchPad:["type",_e]};function Sf(e,t,n,i){this._elementRegistry=e,this._canvas=n,this._search=i,t.registerProvider(this)}Sf.$inject=["elementRegistry","searchPad","canvas","search"],Sf.prototype.find=function(e){var t=this._canvas.getRootElements(),n=this._elementRegistry.filter(function(i){return!Ee(i)&&!t.includes(i)});return this._search(n.map(i=>({element:i,label:kn(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 iD={__depends__:[tD,Xy],__init__:["bpmnSearch"],bpmnSearch:["type",Sf]},rD="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",oD="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",aD={width:36,height:50},sD={width:50,height:50};function jb(e,t,n){return ce("path",{d:e,strokeWidth:2,transform:`translate(${t.x}, ${t.y})`,...n})}const Yn=5;function ou(e,t){this._styles=t,e.registerProvider(this)}ou.$inject=["outline","styles"],ou.prototype.getOutline=function(e){const t=this._styles.cls("djs-outline",["no-fill"]);var n;if(k1(e))return n=ce("rect"),ne(n,D({x:-Yn,y:-Yn,rx:4,width:e.width+Yn*2,height:e.height+Yn*2},t)),n;if(!Ee(e))return y(e,"bpmn:Gateway")?(n=ce("rect"),D(n.style,{"transform-box":"fill-box",transform:"rotate(45deg)","transform-origin":"center"}),ne(n,D({x:2,y:2,rx:4,width:e.width-4,height:e.height-4},t))):Se(e,["bpmn:Task","bpmn:SubProcess","bpmn:Group","bpmn:CallActivity"])?(n=ce("rect"),ne(n,D({x:-Yn,y:-Yn,rx:14,width:e.width+Yn*2,height:e.height+Yn*2},t))):y(e,"bpmn:EndEvent")?(n=ce("circle"),ne(n,D({cx:e.width/2,cy:e.height/2,r:e.width/2+Yn+1},t))):y(e,"bpmn:Event")?(n=ce("circle"),ne(n,D({cx:e.width/2,cy:e.height/2,r:e.width/2+Yn},t))):y(e,"bpmn:DataObjectReference")&&Fb(e,"bpmn:DataObjectReference")?n=jb(rD,{x:-6,y:-6},t):y(e,"bpmn:DataStoreReference")&&Fb(e,"bpmn:DataStoreReference")&&(n=jb(oD,{x:-6,y:-6},t)),n},ou.prototype.updateOutline=function(e,t){if(!Ee(e))return Se(e,["bpmn:SubProcess","bpmn:Group"])?(ne(t,{width:e.width+Yn*2,height:e.height+Yn*2}),!0):!!Se(e,["bpmn:Event","bpmn:Gateway","bpmn:DataStoreReference","bpmn:DataObjectReference"])};function Fb(e,t){var n;return t==="bpmn:DataObjectReference"?n=aD:t==="bpmn:DataStoreReference"&&(n=sD),e.width===n.width&&e.height===n.height}const cD={__depends__:[hf],__init__:["outlineProvider"],outlineProvider:["type",ou]};var uD='<?xml version="1.0" encoding="UTF-8"?><bpmn:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" targetNamespace="http://bpmn.io/schema/bpmn" id="Definitions_1"><bpmn:process id="Process_1" isExecutable="false"><bpmn:startEvent id="StartEvent_1"/></bpmn:process><bpmndi:BPMNDiagram id="BPMNDiagram_1"><bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="Process_1"><bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="StartEvent_1"><dc:Bounds height="36.0" width="36.0" x="173.0" y="102.0"/></bpmndi:BPMNShape></bpmndi:BPMNPlane></bpmndi:BPMNDiagram></bpmn:definitions>';function vi(e){eo.call(this,e)}te(vi,eo),vi.Viewer=ur,vi.NavigatedViewer=xa,vi.prototype.createDiagram=function(){return this.importXML(uD)},vi.prototype._interactionModules=[Jv,ty,ry],vi.prototype._modelingModules=[pM,yc,gM,hM,TM,uf,LM,a2,Vg,Xs,l2,d2,T2,k2,D2,B2,K2,ek,Ip,sk,mk,Ck,Ak,eb,Jk,iD,cD],vi.prototype._modules=[].concat(ur.prototype._modules,vi.prototype._interactionModules,vi.prototype._modelingModules);const lD=((e,t)=>{const n=e.__vccOpts||e;for(const[i,r]of t)n[i]=r;return n})(xt.defineComponent({__name:"BpmnModelerView",props:{xml:{}},emits:["ready","imported","import-error"],setup(e,{expose:t,emit:n}){const i=e,r=n,o=xt.ref();let a;async function s(u){if(!a)throw new Error("modeler not mounted");try{const{warnings:l}=await a.importXML(u),p=Pu(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 xt.onMounted(async()=>{a=new vi({container:o.value,moddleExtensions:qa}),i.xml&&await s(i.xml),r("ready")}),xt.watch(()=>i.xml,u=>{u&&a&&s(u)}),xt.onBeforeUnmount(()=>{a==null||a.destroy(),a=void 0}),t({importXml:s,saveXml:c,getModeler:()=>a}),(u,l)=>(xt.openBlock(),xt.createElementBlock("div",{ref_key:"container",ref:o,class:"bpmn-modeler-view"},null,512))}}),[["__scopeId","data-v-a9b41c97"]]);Q.APPLY_BPMN_OPS_SCHEMA=fx,Q.BPMN_MODDLE_EXTENSIONS=qa,Q.BWL_MODDLE_SCHEMA=Pf,Q.BWL_NS=Cf,Q.BWL_PREFIX=cu,Q.BWL_SIDES=uu,Q.BpmnModelerView=lD,Q.EDITOR=ME,Q.FLOW_LABEL_INDENT=Tu,Q.HEADLESS_BPMN_MODULES=Vv,Q.HEADLESS_TEXT_METRICS=Xr,Q.I18N_NS=G0,Q.I18N_PREFIX=Qf,Q.LABEL_FORK_MARGIN=Mu,Q.MVP_FLOW_NODE_TYPES=yi,Q.SYMBOLIC_OP_KINDS=Mf,Q.SYMBOLIC_OP_SCHEMA=kf,Q.UNDO_EPISODE_COMMAND=lu,Q.applyBpmnOpBatch=Nd,Q.applyBpmnOps=Dd,Q.approximateTextWidth=Lo,Q.auditBpmnGeometry=cd,Q.auditBpmnGeometryXml=oE,Q.auditGeometry=zi,Q.auditTargetsOf=Kr,Q.axisSegmentsOf=ii,Q.buildBpmnOpBatch=TE,Q.buildRegistryIndex=ld,Q.createBpmnEditorController=kE,Q.createBpmnModdle=Jf,Q.createHeadlessBpmnModeler=ZA,Q.crossedShapesOf=Hi,Q.crossingCost=Io,Q.describeProcess=Ld,Q.describeProcessXml=AE,Q.edgeCrossCount=Qa,Q.edgeCrossingPairsOf=ku,Q.executeAsUndoEpisode=Tf,Q.forwardThreePointCandidates=hd,Q.geometryFindingKey=Fi,Q.installHeadlessBpmnDom=Td,Q.isMvpFlowNodeType=Rf,Q.loadBpmnXml=Cu,Q.lowerOps=kd,Q.oppositeOverlapCount=Y0,Q.oppositeOverlapOf=id,Q.planCrossPoolRoute=_d,Q.planEdgeRepair=gd,Q.planLabelPlacement=Sd,Q.planMiddleSegmentShifts=dd,Q.planOppositeOverlapRepair=Ed,Q.planSegmentDetours=fd,Q.repairIntroducedCrossings=vd,Q.repairIntroducedOppositeOverlaps=wd,Q.repairIntroducedSharedSegmentLabels=Rd,Q.rerouteIntroducedCrossPoolEdges=bd,Q.resolverServicesOf=Md,Q.saveBpmnXml=W0,Q.sceneCrossingCost=ad,Q.sceneFromDefinitions=sd,Q.sceneFromRegistry=Nn,Q.sharedSegmentUnderLabel=Za,Q.sharedSpansOf=Xa,Q.unreadableOverlapCount=Au,Q.unreadableOverlapOf=Ka,Q.validateOps=Ad,Q.warningMessages=Pu,Object.defineProperty(Q,Symbol.toStringTag,{value:"Module"})}));
|