@g1cloud/bpmn-modeler-next 5.0.0-alpha.37 → 5.0.0-alpha.38
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/agent/resolver/lower.d.ts +43 -0
- package/dist/bpmn-modeler.js +7259 -7171
- package/dist/bpmn-modeler.umd.cjs +76 -76
- package/package.json +2 -1
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
(function(ie,kt){typeof exports=="object"&&typeof module<"u"?kt(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],kt):(ie=typeof globalThis<"u"?globalThis:ie||self,kt(ie.BpmnModeler={},ie.Vue))})(this,(function(ie,kt){"use strict";var wD=Object.defineProperty;var ED=(ie,kt,Ri)=>kt in ie?wD(ie,kt,{enumerable:!0,configurable:!0,writable:!0,value:Ri}):ie[kt]=Ri;var eo=(ie,kt,Ri)=>ED(ie,typeof kt!="symbol"?kt+"":kt,Ri);const Ri=["startEvent","endEvent","userTask","serviceTask","task","sendTask","receiveTask","exclusiveGateway","parallelGateway"];function Uf(e){return Ri.includes(e)}const qf="http://g1project.net/spec/bpmn/bwl/1.0",Ru="bwl",Cu=["top-left","top","top-right","right","bottom-right","bottom","bottom-left","left"],Yf={name:"bwl-hints",uri:qf,prefix:Ru,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"}]}]},Pu="bwl.undoEpisode",Kf=new WeakSet;function Qx(e){Kf.has(e)||(e.register(Pu,{preExecute(t){try{t.run()}catch(n){t.error=n}}}),Kf.add(e))}function Xf(e,t){Qx(e);const n={run:t};if(e.execute(Pu,n),n.error!==void 0)throw e.canUndo()&&e.undo(),n.error}const Zf=["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"],Jx={description:"생략 = 보존, null = 제거.",anyOf:[{type:"string"},{type:"null"}]},e0={type:"object",description:"레인. 배열 선언 순서 = 풀 내 상→하 순서.",properties:{id:{type:"string"},name:{type:"string"}},required:["id"],additionalProperties:!1},t0={type:"object",description:"풀(participant). 레인은 여기 선언하고 노드가 lane 인자로 배정된다 — 별도 레인 op 없음.",properties:{id:{type:"string",description:"문서 내 유일, XML NCName(공백 없이 문자/밑줄로 시작)."},name:{type:"string"},blackBox:{type:"boolean",description:"true = 내부 프로세스 없는 블랙박스 풀."},lanes:{type:"array",items:{$ref:"#/$defs/irLane"}}},required:["id"],additionalProperties:!1},n0={type:"object",description:"플로우 노드. 좌표는 지정하지 않는다 — 배치는 resolver 가 결정한다.",properties:{id:{type:"string"},type:{type:"string",enum:[...Ri]},name:{type:"string"},participant:{type:"string",description:"소속 풀 id(협업 문서)."},lane:{type:"string",description:"소속 레인 id(풀 정의에 선언된 것)."}},required:["id","type"],additionalProperties:!1},i0={type:"object",description:"분기 조건 — 게이트웨이가 아닌 플로우에 붙인다. MVP 는 label 만.",properties:{label:{type:"string"}},required:["label"],additionalProperties:!1},r0={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},o0={type:"object",description:"메시지 플로우(풀 경계를 넘는 연결 — 노드 또는 블랙박스 풀 자체가 끝점).",properties:{id:{type:"string"},source:{type:"string"},target:{type:"string"},name:{type:"string"}},required:["id","source","target"],additionalProperties:!1},a0={type:"object",properties:{id:{type:"string"},name:{type:"string"}},required:["id"],additionalProperties:!1},s0={type:"object",description:"데이터 입출력 연관. 방향 = source→target(태스크→스토어 = 쓰기, 스토어→태스크 = 읽기).",properties:{id:{type:"string"},source:{type:"string"},target:{type:"string"}},required:["source","target"],additionalProperties:!1},c0={type:"object",properties:{id:{type:"string"},text:{type:"string"}},required:["id","text"],additionalProperties:!1},u0={type:"object",description:"연관선(주석 ↔ 요소).",properties:{id:{type:"string"},source:{type:"string"},target:{type:"string"}},required:["source","target"],additionalProperties:!1},l0={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},p0={type:"object",description:"주석 방위 힌트 — 앵커 요소 기준 상대 배치. 있으면 결정적 배치, 없으면 휴리스틱.",properties:{anchor:{type:"string",description:"기준 요소 id."},side:{type:"string",enum:[...Cu]},offset:{type:"number",description:"앵커 가장자리 → 주석 가장자리 간격(px). 생략 시 50."}},required:["anchor","side"],additionalProperties:!1};function sn(e,t){return{type:"object",description:t.description,properties:{kind:{const:e},...t.properties},required:["kind",...t.required??[]],additionalProperties:!1}}const f0={"participant.add":sn("participant.add",{description:"풀 추가. order = 풀 세로 순서 힌트 — **작을수록 위**(생략 시 op 순서가 곧 배치 순서). 값은 상대 순서만 쓰므로 1,2,3… 연속이든 10,20,30 간격이든 같다.",properties:{participant:{$ref:"#/$defs/irParticipant"},order:{type:"integer"}},required:["participant"]}),"participant.update":sn("participant.update",{description:"풀 이름/레인 갱신. lanes 는 전체 재선언(생략 = 보존) — 기존 레인을 유지하려면 함께 다시 나열한다.",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"},lanes:{type:"array",items:{$ref:"#/$defs/irLane"}}},required:["id"]}),"node.add":sn("node.add",{description:'플로우 노드 추가. band = 가로 밴드 순번 힌트(주 흐름 0, 갈래 1, 2…) — 위/아래가 아니라 "주 흐름에서 몇 번째 갈래"다. 행 배치(어느 갈래가 위/아래인지)는 호스트가 정한다(대칭·메시지 방향). 레인이 있으면 그 레인 안의 밴드다 — 한 레인 안에서 게이트웨이 출구를 갈라 놓을 때 쓴다. 컨테이너(풀·레인)는 밴드 수만큼 자란다.',properties:{node:{$ref:"#/$defs/irNode"},band:{type:"integer",description:"0 이상 정수(음수는 payload-invalid 로 거부)."}},required:["node"]}),"node.update":sn("node.update",{description:"노드 이름/레인/타입 갱신. lane = 레인 재배정(이동), type = 태스크·이벤트 타입 전환.",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"},lane:{type:"string"},type:{type:"string",enum:[...Ri]}},required:["id"]}),"sequenceFlow.add":sn("sequenceFlow.add",{description:"시퀀스 플로우 추가. 분기 조건은 게이트웨이가 아닌 플로우의 condition 에 싣는다.",properties:{flow:{$ref:"#/$defs/irSequenceFlow"}},required:["flow"]}),"sequenceFlow.update":sn("sequenceFlow.update",{description:"시퀀스 플로우 이름/조건/끝점 갱신. condition: null = 조건 제거. source/target = 끝점 재배선 — 중간 삽입은 기존 플로우를 지우지 말고 이것으로 한쪽 끝을 옮긴 뒤 새 플로우를 추가한다.",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"},condition:{description:"생략 = 보존, null = 제거.",anyOf:[{$ref:"#/$defs/irFlowCondition"},{type:"null"}]},source:{description:"새 출발 노드 id(생략 = 보존). 같은 배치에서 추가한 노드도 지목할 수 있다.",type:"string"},target:{description:"새 도착 노드 id(생략 = 보존). 같은 배치에서 추가한 노드도 지목할 수 있다.",type:"string"}},required:["id"]}),"messageFlow.add":sn("messageFlow.add",{description:"메시지 플로우 추가(풀 경계를 넘는 연결).",properties:{flow:{$ref:"#/$defs/irMessageFlow"}},required:["flow"]}),"messageFlow.update":sn("messageFlow.update",{description:"메시지 플로우 이름 갱신.",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"}},required:["id"]}),"dataStore.add":sn("dataStore.add",{description:"데이터 스토어 추가(+ 입출력 연관 동반 가능).",properties:{dataStore:{$ref:"#/$defs/irDataStore"},associations:{type:"array",items:{$ref:"#/$defs/irDataAssociation"}}},required:["dataStore"]}),"dataStore.update":sn("dataStore.update",{description:"데이터 스토어 이름 갱신.",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"}},required:["id"]}),"dataAssociation.add":sn("dataAssociation.add",{description:"기존 노드 ↔ 기존 데이터 스토어의 입출력 연관 추가.",properties:{association:{$ref:"#/$defs/irDataAssociation"}},required:["association"]}),"association.add":sn("association.add",{description:"주석 ↔ 요소 연관 추가(한쪽 끝은 주석). 주석 신설과 함께면 annotation.add 의 association 을 쓰고, 이 op 는 추가 연관(한 주석에 여러 연관)용.",properties:{association:{$ref:"#/$defs/irAssociation"}},required:["association"]}),"annotation.add":sn("annotation.add",{description:"텍스트 주석 추가. association 으로 대상 요소와 연결하고, placement 로 방위를 지정하면 결정적 배치된다.",properties:{annotation:{$ref:"#/$defs/irTextAnnotation"},association:{$ref:"#/$defs/irAssociation"},placement:{$ref:"#/$defs/bwlPlacement"}},required:["annotation"]}),"annotation.update":sn("annotation.update",{description:"주석 본문/방위 힌트 갱신. placement: null = 힌트 제거(휴리스틱 복귀). 주석 삭제는 element.remove.",properties:{id:{type:"string"},text:{type:"string"},placement:{description:"생략 = 보존, null = 힌트 제거.",anyOf:[{$ref:"#/$defs/bwlPlacement"},{type:"null"}]}},required:["id"]}),"group.add":sn("group.add",{description:"그룹 추가 — 바운즈는 members 의 bbox 로 산출되므로 좌표를 지정하지 않는다.",properties:{group:{$ref:"#/$defs/irGroup"}},required:["group"]}),"group.update":sn("group.update",{description:"그룹 이름/멤버 갱신. members 는 전체 재선언(생략 = 보존).",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"},members:{type:"array",items:{type:"string"}}},required:["id"]}),"element.remove":sn("element.remove",{description:"요소 제거(카테고리 무관). 부착된 연결선은 함께 제거된다.",properties:{id:{type:"string"}},required:["id"]})},Qf={anyOf:Zf.map(e=>f0[e])},d0={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:e0,irParticipant:t0,irNode:n0,irFlowCondition:i0,irSequenceFlow:r0,irMessageFlow:o0,irDataStore:a0,irDataAssociation:s0,irTextAnnotation:c0,irAssociation:u0,irGroup:l0,bwlPlacement:p0,nullableString:Jx,symbolicOp:Qf}};function Au(e){return Array.prototype.concat.apply([],e)}const Vo=Object.prototype.toString,h0=Object.prototype.hasOwnProperty;function Cr(e){return e===void 0}function Ft(e){return e!==void 0}function to(e){return e==null}function Ce(e){return Vo.call(e)==="[object Array]"}function Ut(e){return Vo.call(e)==="[object Object]"}function ke(e){return Vo.call(e)==="[object Number]"}function qt(e){const t=Vo.call(e);return t==="[object Function]"||t==="[object AsyncFunction]"||t==="[object GeneratorFunction]"||t==="[object AsyncGeneratorFunction]"||t==="[object Proxy]"}function En(e){return Vo.call(e)==="[object String]"}function m0(e){if(!Ce(e))throw new Error("must supply array")}function Sn(e,t){return!to(e)&&h0.call(e,t)}function ft(e,t){const n=es(t);let i;return k(e,function(r,o){if(n(r,o))return i=r,!1}),i}function Jf(e,t){const n=es(t);let i=Ce(e)?-1:void 0;return k(e,function(r,o){if(n(r,o))return i=o,!1}),i}function He(e,t){const n=es(t);let i=[];return k(e,function(r,o){n(r,o)&&i.push(r)}),i}function k(e,t){let n,i;if(Cr(e))return;const r=Ce(e)?b0:_0;for(let o in e)if(Sn(e,o)&&(n=e[o],i=t(n,r(o)),i===!1))return n}function g0(e,t){if(Cr(e))return[];m0(e);const n=es(t);return e.filter(function(i,r){return!n(i,r)})}function Rn(e,t,n){return k(e,function(i,r){n=t(n,i,r)}),n}function Pr(e,t){return!!Rn(e,function(n,i,r){return n&&t(i,r)},!0)}function Ui(e,t){return!!ft(e,t)}function cn(e,t){let n=[];return k(e,function(i,r){n.push(t(i,r))}),n}function Ja(e){return e&&Object.keys(e)||[]}function y0(e){return Ja(e).length}function no(e){return cn(e,t=>t)}function io(e,t,n={}){return t=Tu(t),k(e,function(i){let r=t(i)||"_",o=n[r];o||(o=n[r]=[]),o.push(i)}),n}function ed(e,...t){e=Tu(e);let n={};return k(t,r=>io(r,e,n)),cn(n,function(r,o){return r[0]})}const v0=ed;function ai(e,t){t=Tu(t);let n=[];return k(e,function(i,r){let o=t(i,r),a={d:o,v:i};for(var s=0;s<n.length;s++){let{d:c}=n[s];if(o<c){n.splice(s,0,a);return}}n.push(a)}),cn(n,i=>i.v)}function ro(e){return function(t){return Pr(e,function(n,i){return t[i]===n})}}function Tu(e){return qt(e)?e:t=>t[e]}function es(e){return qt(e)?e:t=>t===e}function _0(e){return e}function b0(e){return Number(e)}function Mu(e,t){let n,i,r,o;function a(f){let p=Date.now(),d=f?0:o+t-p;if(d>0)return s(d);e.apply(r,i),c()}function s(f){n=setTimeout(a,f)}function c(){n&&clearTimeout(n),n=o=i=r=void 0}function u(){n&&a(!0),c()}function l(...f){o=Date.now(),i=f,r=this,n||s(t)}return l.flush=u,l.cancel=c,l}function bn(e,t){return e.bind(t)}function N(e,...t){return Object.assign(e,...t)}function x0(e,t,n){let i=e;return k(t,function(r,o){if(typeof r!="number"&&typeof r!="string")throw new Error("illegal key type: "+typeof r+". Key should be of type number or string.");if(r==="constructor")throw new Error("illegal key: constructor");if(r==="__proto__")throw new Error("illegal key: __proto__");let a=t[o+1],s=i[r];Ft(a)&&to(s)&&(s=i[r]=isNaN(+a)?{}:[]),Cr(a)?Cr(n)?delete i[r]:i[r]=n:i=s}),e}function ii(e,t){let n={},i=Object(e);return k(t,function(r){r in i&&(n[r]=e[r])}),n}function si(e,t){let n={},i=Object(e);return k(i,function(r,o){t.indexOf(o)===-1&&(n[o]=r)}),n}function ku(){}ku.prototype.get=function(e){return this.$model.properties.get(this,e)},ku.prototype.set=function(e,t){this.$model.properties.set(this,e,t)};function td(e,t){this.model=e,this.properties=t}td.prototype.createType=function(e){var t=this.model,n=this.properties,i=Object.create(ku.prototype);k(e.properties,function(a){!a.isMany&&a.default!==void 0&&(i[a.name]=a.default)}),n.defineModel(i,t),n.defineDescriptor(i,e);var r=e.ns.name;function o(a){n.define(this,"$type",{value:r,enumerable:!0}),n.define(this,"$attrs",{value:{}}),n.define(this,"$parent",{writable:!0}),k(a,bn(function(s,c){this.set(c,s)},this))}return o.prototype=i,o.hasType=i.$instanceOf=this.model.hasType,n.defineModel(o,t),n.defineDescriptor(o,e),o};var w0=N(Object.create(null),{String:!0,Boolean:!0,Integer:!0,Real:!0,Element:!0}),nd=N(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 Ou(e,t){var n=nd[e];return n?n(t):t}function Du(e){return!!w0[e]}function id(e){return!!nd[e]}function un(e,t){var n=e.split(/:/),i,r;if(n.length===1)i=e,r=t;else if(n.length===2)i=n[1],r=n[0];else throw new Error("expected <prefix:localName> or <localName>, got "+e);return e=(r?r+":":"")+i,{name:e,prefix:r,localName:i}}function In(e){this.ns=e,this.name=e.name,this.allTypes=[],this.allTypesByName=Object.create(null),this.properties=[],this.propertiesByName=Object.create(null)}In.prototype.build=function(){return ii(this,["ns","name","allTypes","allTypesByName","properties","propertiesByName","bodyProperty","idProperty"])},In.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)},In.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},In.prototype.redefineProperty=function(e,t,n){var i=e.ns.prefix,r=t.split("#"),o=un(r[0],i),a=un(r[1],o.prefix).name,s=this.propertiesByName[a];if(s)this.replaceProperty(s,e,n);else throw new Error("refined property <"+a+"> not found");delete e.redefines},In.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},In.prototype.removeNamedProperty=function(e){var t=e.ns,n=this.propertiesByName;delete n[t.name],delete n[t.localName]},In.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},In.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},In.prototype.assertNotTrait=function(e){if((e.extends||[]).length)throw new Error(`cannot create <${e.name}> extending <${e.extends}>`)},In.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")},In.prototype.hasProperty=function(e){return this.propertiesByName[e]},In.prototype.addTrait=function(e,t){t&&this.assertNotTrait(e);var n=this.allTypesByName,i=this.allTypes,r=e.name;r in n||(k(e.properties,bn(function(o){o=N({},o,{name:o.ns.localName,inherited:t}),Object.defineProperty(o,"definedBy",{value:e});var a=o.replaces,s=o.redefines;a||s?this.redefineProperty(o,a||s,a):(o.isBody&&this.setBodyProperty(o),o.isId&&this.setIdProperty(o),this.addProperty(o))},this)),i.push(e),n[r]=e)};function qi(e,t){this.packageMap=Object.create(null),this.typeMap=Object.create(null),this.packages=[],this.properties=t,k(e,bn(this.registerPackage,this))}qi.prototype.getPackage=function(e){return this.packageMap[e]},qi.prototype.getPackages=function(){return this.packages},qi.prototype.registerPackage=function(e){e=N({},e);var t=this.packageMap;rd(t,e,"prefix"),rd(t,e,"uri"),k(e.types,bn(function(n){this.registerType(n,e)},this)),t[e.uri]=t[e.prefix]=e,this.packages.push(e)},qi.prototype.registerType=function(e,t){e=N({},e,{superClass:(e.superClass||[]).slice(),extends:(e.extends||[]).slice(),properties:(e.properties||[]).slice(),meta:N({},e.meta||{})});var n=un(e.name,t.prefix),i=n.name,r=Object.create(null);k(e.properties,bn(function(o){var a=un(o.name,n.prefix),s=a.name;Du(o.type)||(o.type=un(o.type,a.prefix).name),N(o,{ns:a,name:s}),r[s]=o},this)),N(e,{ns:n,name:i,propertiesByName:r}),k(e.extends,bn(function(o){var a=un(o,n.prefix),s=this.typeMap[a.name];s.traits=s.traits||[],s.traits.push(i)},this)),this.definePackage(e,t),this.typeMap[i]=e},qi.prototype.mapTypes=function(e,t,n){var i=Du(e.name)?{name:e.name}:this.typeMap[e.name],r=this;function o(c,u){var l=un(c,Du(c)?"":e.prefix);r.mapTypes(l,t,u)}function a(c){return o(c,!0)}function s(c){return o(c,!1)}if(!i)throw new Error("unknown type <"+e.name+">");k(i.superClass,n?a:s),t(i,!n),k(i.traits,a)},qi.prototype.getEffectiveDescriptor=function(e){var t=un(e),n=new In(t);this.mapTypes(t,function(r,o){n.addTrait(r,o)});var i=n.build();return this.definePackage(i,i.allTypes[i.allTypes.length-1].$pkg),i},qi.prototype.definePackage=function(e,t){this.properties.define(e,"$pkg",{value:t})};function rd(e,t,n){var i=t[n];if(i in e)throw new Error("package with "+n+" <"+i+"> already defined")}function Ar(e){this.model=e}Ar.prototype.set=function(e,t,n){if(!En(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[Lu(t)]:i?r in e?e[r]=n:od(e,i,n):e.$attrs[Lu(t)]=n},Ar.prototype.get=function(e,t){var n=this.getProperty(e,t);if(!n)return e.$attrs[Lu(t)];var i=n.name;return!e[i]&&n.isMany&&od(e,n,[]),e[i]},Ar.prototype.define=function(e,t,n){if(!n.writable){var i=n.value;n=N({},n,{get:function(){return i}}),delete n.value}Object.defineProperty(e,t,n)},Ar.prototype.defineDescriptor=function(e,t){this.define(e,"$descriptor",{value:t})},Ar.prototype.defineModel=function(e,t){this.define(e,"$model",{value:t})},Ar.prototype.getProperty=function(e,t){var n=this.model,i=n.getPropertyDescriptor(e,t);if(i)return i;if(t.includes(":"))return null;const r=n.config.strict;if(typeof r<"u"){const o=new TypeError(`unknown property <${t}> on <${e.$type}>`);if(r)throw o;typeof console<"u"&&console.warn(o)}return null};function E0(e){return typeof e>"u"}function od(e,t,n){Object.defineProperty(e,t.name,{enumerable:!t.isReference,writable:!0,value:n,configurable:!0})}function Lu(e){return e.replace(/^:/,"")}function Fn(e,t={}){this.properties=new Ar(this),this.factory=new td(this,this.properties),this.registry=new qi(e,this.properties),this.typeCache=Object.create(null),this.config=t}Fn.prototype.create=function(e,t){var n=this.getType(e);if(!n)throw new Error("unknown type <"+e+">");return new n(t)},Fn.prototype.getType=function(e){var t=this.typeCache,n=En(e)?e:e.ns.name,i=t[n];return i||(e=this.registry.getEffectiveDescriptor(n),i=t[n]=this.factory.createType(e)),i},Fn.prototype.createAny=function(e,t,n){var i=un(e),r={$type:e,$instanceOf:function(a){return a===this.$type},get:function(a){return this[a]},set:function(a,s){x0(this,[a],s)}},o={name:e,isGeneric:!0,ns:{prefix:i.prefix,localName:i.localName,uri:t}};return this.properties.defineDescriptor(r,o),this.properties.defineModel(r,this),this.properties.define(r,"get",{enumerable:!1,writable:!0}),this.properties.define(r,"set",{enumerable:!1,writable:!0}),this.properties.define(r,"$parent",{enumerable:!1,writable:!0}),this.properties.define(r,"$instanceOf",{enumerable:!1,writable:!0}),k(n,function(a,s){Ut(a)&&a.value!==void 0?r[a.name]=a.value:r[s]=a}),r},Fn.prototype.getPackage=function(e){return this.registry.getPackage(e)},Fn.prototype.getPackages=function(){return this.registry.getPackages()},Fn.prototype.getElementDescriptor=function(e){return e.$descriptor},Fn.prototype.hasType=function(e,t){t===void 0&&(t=e,e=this);var n=e.$model.getElementDescriptor(e);return t in n.allTypesByName},Fn.prototype.getPropertyDescriptor=function(e,t){return this.getElementDescriptor(e).propertiesByName[t]},Fn.prototype.getTypeDescriptor=function(e){return this.registry.typeMap[e]};var ad=String.fromCharCode,S0=Object.prototype.hasOwnProperty,R0=/&#(\d+);|&#x([0-9a-f]+);|&(\w+);/ig,Wo={amp:"&",apos:"'",gt:">",lt:"<",quot:'"'};Object.keys(Wo).forEach(function(e){Wo[e.toUpperCase()]=Wo[e]});function C0(e,t,n,i){return i?S0.call(Wo,i)?Wo[i]:"&"+i+";":ad(t||parseInt(n,16))}function Tr(e){return e.length>3&&e.indexOf("&")!==-1?e.replace(R0,C0):e}var sd="non-whitespace outside of root node";function Yi(e){return new Error(e)}function P0(e){return"missing namespace for prefix <"+e+">"}function ts(e){return{get:e,enumerable:!0}}function A0(e){var t=Object.create(null),n;for(n in e)t[n]=e[n];return t}var cd=Symbol("nameCache");function Iu(e){return e+"$uri"}function T0(e){var t=Object.create(null),n,i;for(n in e)i=e[n],t[i]=i,t[Iu(i)]=n;return t}function ns(){return{line:0,column:0}}function M0(e){throw e}function ud(e){if(!this)return new ud(e);var t=e&&e.proxy,n,i,r,o,a=M0,s,c,u,l,f=ns,p=!1,d=!1,h="",m=!1,g=!1,S=null,E=!1,x,w,C,T;function B($){$ instanceof Error||($=Yi($)),S=$,a($,f)}function M($){s&&($ instanceof Error||($=Yi($)),s($,f))}this.on=function($,V){if(typeof V!="function")throw Yi("required args <name, cb>");switch($){case"openTag":i=V;break;case"text":n=V;break;case"closeTag":r=V;break;case"error":a=V;break;case"warn":s=V;break;case"cdata":o=V;break;case"attention":l=V;break;case"question":u=V;break;case"comment":c=V;break;default:throw Yi("unsupported event: "+$)}return this},this.ns=function($){if(typeof $>"u"&&($={}),typeof $!="object")throw Yi("required args <nsMap={}>");var V=Object.create(null),he;for(he in $)V[he]=$[he];return g=!0,T=V,this};function z(){x=g?[]:null,w=g?T0(T):null,C=[],f=ns,E=!1,S=null,d=!1,h=""}this.parse=function($){if(typeof $!="string")throw Yi("required args <xml=string>");if(p)throw Yi("parse during stream; call end() first");return z(),G($),f=ns,E=!1,S},this.write=function($){if(typeof $!="string")throw Yi("required args <xml=string>");return p||(z(),p=!0),S||(h=G(h+$,!0)||""),this},this.end=function(){return p||z(),p=!1,S||G(h),h="",f=ns,E=!1,S},this.stop=function(){E=!0};function G($,V=!1){var he=null,nt=null,gt,J=0,le=!1,Ee=!1,pe=0,ge=0,re,H,F,Y,Ne,Kt,P,_,y,D="",j=0,U;function ue(it,Wt){var on=it.indexOf(":");if(on===-1)return it;var yn=w[it.substring(0,on)];return yn?Wt===yn?it.substr(on+1):yn+it.substr(on):(M(P0(it.substring(0,on))),null)}function Be(){if(U!==null)return U;var it,Wt,on=g&&w.xmlns,yn=g&&m?[]:null,dt=j,Mt=D,Qt=Mt.length,Kr,ei,Si,jn,xt,ti={},Xr=new Set,vn,tt,ot;e:for(;dt<Qt;dt++)if(vn=!1,tt=Mt.charCodeAt(dt),!(tt===32||tt<14&&tt>8)){for((tt<65||tt>122||tt>90&&tt<97)&&tt!==95&&tt!==58&&(M("illegal first char attribute name"),vn=!0),ot=dt+1;ot<Qt;ot++)if(tt=Mt.charCodeAt(ot),!(tt>96&&tt<123||tt>64&&tt<91||tt>47&&tt<59||tt===46||tt===45||tt===95)){if(tt===32||tt<14&&tt>8){M("missing attribute value"),dt=ot;continue e}if(tt===61)break;M("illegal attribute name char"),vn=!0}if(xt=Mt.substring(dt,ot),xt==="xmlns:xmlns"&&(M("illegal declaration of xmlns"),vn=!0),tt=Mt.charCodeAt(ot+1),tt===34)ot=Mt.indexOf('"',dt=ot+2),ot===-1&&(ot=Mt.indexOf("'",dt),ot!==-1&&(M("attribute value quote missmatch"),vn=!0));else if(tt===39)ot=Mt.indexOf("'",dt=ot+2),ot===-1&&(ot=Mt.indexOf('"',dt),ot!==-1&&(M("attribute value quote missmatch"),vn=!0));else for(M("missing attribute value quotes"),vn=!0,ot=ot+1;ot<Qt&&(tt=Mt.charCodeAt(ot+1),!(tt===32||tt<14&&tt>8));ot++);for(ot===-1&&(M("missing closing quotes"),ot=Qt,vn=!0),vn||(Si=Mt.substring(dt,ot)),dt=ot;ot+1<Qt&&(tt=Mt.charCodeAt(ot+1),!(tt===32||tt<14&&tt>8));ot++)dt===ot&&(M("illegal character after attribute end"),vn=!0);if(dt=ot+1,vn)continue e;if(Xr.has(xt)){M("attribute <"+xt+"> already defined");continue}if(Xr.add(xt),!g){ti[xt]=Si;continue}if(m){if(ei=xt==="xmlns"?"xmlns":xt.charCodeAt(0)===120&&xt.substr(0,6)==="xmlns:"?xt.substr(6):null,ei!==null){if(it=Tr(Si),Wt=Iu(ei),jn=T[it],!jn){if(ei==="xmlns"||Wt in w&&w[Wt]!==it)do jn="ns"+J++;while(typeof w[jn]<"u");else jn=ei;T[it]=jn}w[ei]!==jn&&(Kr||(w=A0(w),Kr=!0),w[ei]=jn,ei==="xmlns"&&(w[Iu(jn)]=it,on=jn),w[Wt]=it),ti[xt]=Si;continue}yn.push(xt,Si);continue}xt=ue(xt,on),xt!==null&&(ti[xt]=Si)}if(m)for(dt=0,Qt=yn.length;dt<Qt;dt++)xt=ue(yn[dt++],on),Si=yn[dt],xt!==null&&(ti[xt]=Si);return U=ti}function et(){for(var it=/(\r\n|\r|\n)/g,Wt=0,on=0,yn=0,dt=ge,Mt,Qt;pe>=yn&&(Mt=it.exec($),!(!Mt||(dt=Mt[0].length+Mt.index,dt>pe)));)Wt+=1,yn=dt;return pe==-1?(on=dt,Qt=$.substring(ge)):ge===0?Qt=$.substring(ge,pe):(on=pe-yn,Qt=ge==-1?$.substring(pe):$.substring(pe,ge+1)),{data:Qt,line:Wt,column:on}}for(f=et,t&&(y=Object.create({},{name:ts(function(){return P}),originalName:ts(function(){return _}),attrs:ts(Be),ns:ts(function(){return w})}));ge!==-1;){if($.charCodeAt(ge)===60?pe=ge:pe=$.indexOf("<",ge),pe===-1){if(V)return $.substring(ge);if(C.length)return B("unexpected end of file");if(!d)return B("missing start tag");ge<$.length&&$.substring(ge).trim()&&M(sd);return}if(d||(d=!0),ge!==pe){if(C.length){if(n&&(n($.substring(ge,pe),Tr,f),E))return}else if($.substring(ge,pe).trim()&&(M(sd),E))return}if(Y=$.charCodeAt(pe+1),Y===33){if(F=$.charCodeAt(pe+2),F===91&&$.substr(pe+3,6)==="CDATA["){if(ge=$.indexOf("]]>",pe),ge===-1)return V?$.substring(pe):B("unclosed cdata");if(o&&(o($.substring(pe+9,ge),f),E))return;ge+=3;continue}if(F===45&&$.charCodeAt(pe+3)===45){if(ge=$.indexOf("-->",pe),ge===-1)return V?$.substring(pe):B("unclosed comment");if(c&&(c($.substring(pe+4,ge),Tr,f),E))return;ge+=3;continue}}if(Y===63){if(ge=$.indexOf("?>",pe),ge===-1)return V?$.substring(pe):B("unclosed question");if(u&&(u($.substring(pe,ge+2),f),E))return;ge+=2;continue}for(re=pe+1;;re++){if(Ne=$.charCodeAt(re),isNaN(Ne))return V?$.substring(pe):(ge=-1,B("unclosed tag"));if(Ne===34)F=$.indexOf('"',re+1),re=F!==-1?F:re;else if(Ne===39)F=$.indexOf("'",re+1),re=F!==-1?F:re;else if(Ne===62){ge=re;break}}if(Y===33){if(l&&(l($.substring(pe,ge+1),Tr,f),E))return;ge+=1;continue}if(U={},Y===47){if(le=!1,Ee=!0,!C.length)return B("missing open tag");if(re=P=C.pop(),F=pe+2+re.length,$.substring(pe+2,F)!==re)return B("closing tag mismatch");for(;F<ge;F++)if(Y=$.charCodeAt(F),!(Y===32||Y>8&&Y<14))return B("close tag")}else{if($.charCodeAt(ge-1)===47?(re=P=$.substring(pe+1,ge-1),le=!0,Ee=!0):(re=P=$.substring(pe+1,ge),le=!0,Ee=!1),!(Y>96&&Y<123||Y>64&&Y<91||Y===95||Y===58))return B("illegal first char nodeName");for(F=1,H=re.length;F<H;F++)if(Y=re.charCodeAt(F),!(Y>96&&Y<123||Y>64&&Y<91||Y>47&&Y<59||Y===45||Y===95||Y==46)){if(Y===32||Y<14&&Y>8){P=re.substring(0,F),U=null;break}return B("invalid nodeName")}Ee||C.push(P)}if(g){gt=w,le&&(Ee||x.push(gt),U===null&&(m=re.indexOf("xmlns",F)!==-1)&&(j=F,D=re,Be(),m=!1)),_=P,nt!==w&&(he=w[cd],he===void 0&&(he=w[cd]=Object.create(null)),nt=w);var At=he[P];if(At!==void 0)P=At;else{if(Y=P.indexOf(":"),Y!==-1){if(Kt=w[P.substring(0,Y)],!Kt)return B("missing namespace on <"+_+">");P=P.substr(Y+1)}else Kt=w.xmlns;Kt&&(P=Kt+":"+P),he[_]=P}}if(le&&(j=F,D=re,i&&(t?i(y,Tr,Ee,f):i(P,Be,Tr,Ee,f),E)))return;if(Ee){if(r&&(r(t?y:P,Tr,le,f),E))return;g&&(le?w=gt:w=x.pop())}ge+=1}}}function ld(e){return e.xml&&e.xml.tagAlias==="lowerCase"}var Nu={xsi:"http://www.w3.org/2001/XMLSchema-instance",xml:"http://www.w3.org/XML/1998/namespace"},pd="property";function fd(e){return e.xml&&e.xml.serialize}function k0(e){const t=fd(e);return t!==pd&&(t||null)}function O0(e){return e.charAt(0).toUpperCase()+e.slice(1)}function dd(e,t){return ld(t)?e.prefix+":"+O0(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 L0(e,t,n){const i=un(e,t.xmlns),r=`${t[i.prefix]||i.prefix}:${i.localName}`,o=un(r);var a=n.getPackage(o.prefix);return D0(o,a)}function Ki(e){return new Error(e)}function Ci(e){return e.$descriptor}function I0(e){N(this,e),this.elementsById={},this.references=[],this.warnings=[],this.addReference=function(t){this.references.push(t)},this.addElement=function(t){if(!t)throw Ki("expected element");var n=this.elementsById,i=Ci(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 Ki("duplicate ID <"+o+">");n[o]=t}},this.addWarning=function(t){this.warnings.push(t)}}function Uo(){}Uo.prototype.handleEnd=function(){},Uo.prototype.handleText=function(){},Uo.prototype.handleNode=function(){};function Bu(){}Bu.prototype=Object.create(Uo.prototype),Bu.prototype.handleNode=function(){return this};function oo(){}oo.prototype=Object.create(Uo.prototype),oo.prototype.handleText=function(e){this.body=(this.body||"")+e};function qo(e,t){this.property=e,this.context=t}qo.prototype=Object.create(oo.prototype),qo.prototype.handleNode=function(e){if(this.element)throw Ki("expected no sub nodes");return this.element=this.createReference(e),this},qo.prototype.handleEnd=function(){this.element.id=this.body},qo.prototype.createReference=function(e){return{property:this.property.ns.name,id:""}};function $u(e,t){this.element=t,this.propertyDesc=e}$u.prototype=Object.create(oo.prototype),$u.prototype.handleEnd=function(){var e=this.body||"",t=this.element,n=this.propertyDesc;e=Ou(n.type,e),n.isMany?t.get(n.name).push(e):t.set(n.name,e)};function is(){}is.prototype=Object.create(oo.prototype),is.prototype.handleNode=function(e){var t=this,n=this.element;return n?t=this.handleChild(e):(n=this.element=this.createElement(e),this.context.addElement(n)),t};function dn(e,t,n){this.model=e,this.type=e.getType(t),this.context=n}dn.prototype=Object.create(is.prototype),dn.prototype.addReference=function(e){this.context.addReference(e)},dn.prototype.handleText=function(e){var t=this.element,n=Ci(t),i=n.bodyProperty;if(!i)throw Ki("unexpected body text <"+e+">");oo.prototype.handleText.call(this,e)},dn.prototype.handleEnd=function(){var e=this.body,t=this.element,n=Ci(t),i=n.bodyProperty;i&&e!==void 0&&(e=Ou(i.type,e),t.set(i.name,e))},dn.prototype.createElement=function(e){var t=e.attributes,n=this.type,i=Ci(n),r=this.context,o=new n({}),a=this.model,s;return k(t,function(c,u){var l=i.propertiesByName[u],f;l&&l.isReference?l.isMany?(f=c.split(" "),k(f,function(p){r.addReference({element:o,property:l.ns.name,id:p})})):r.addReference({element:o,property:l.ns.name,id:c}):(l?c=Ou(l.type,c):u==="xmlns"?u=":"+u:(s=un(u,i.ns.prefix),a.getPackage(s.prefix)&&r.addWarning({message:"unknown attribute <"+u+">",element:o,property:u,value:c})),o.set(u,c))}),o},dn.prototype.getPropertyForNode=function(e){var t=e.name,n=un(t),i=this.type,r=this.model,o=Ci(i),a=n.name,s=o.propertiesByName[a];if(s&&!s.isAttr){const u=k0(s);if(u){const l=e.attributes[u];if(l){const f=L0(l,e.ns,r),p=r.getType(f);return N({},s,{effectiveType:Ci(p).name})}}return s}var c=r.getPackage(n.prefix);if(c){const u=dd(n,c),l=r.getType(u);if(s=ft(o.properties,function(f){return!f.isVirtual&&!f.isReference&&!f.isAttribute&&l.hasType(f.type)}),s)return N({},s,{effectiveType:Ci(l).name})}else if(s=ft(o.properties,function(u){return!u.isReference&&!u.isAttribute&&u.type==="Element"}),s)return s;throw Ki("unrecognized element <"+n.name+">")},dn.prototype.toString=function(){return"ElementDescriptor["+Ci(this.type).name+"]"},dn.prototype.valueHandler=function(e,t){return new $u(e,t)},dn.prototype.referenceHandler=function(e){return new qo(e,this.context)},dn.prototype.handler=function(e){return e==="Element"?new ao(this.model,e,this.context):new dn(this.model,e,this.context)},dn.prototype.handleChild=function(e){var t,n,i,r;if(t=this.getPropertyForNode(e),i=this.element,n=t.effectiveType||t.type,id(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?(N(o,{element:i}),this.context.addReference(o)):o.$parent=i),r};function ju(e,t,n){dn.call(this,e,t,n)}ju.prototype=Object.create(dn.prototype),ju.prototype.createElement=function(e){var t=e.name,n=un(t),i=this.model,r=this.type,o=i.getPackage(n.prefix),a=o&&dd(n,o)||t;if(!r.hasType(a))throw Ki("unexpected element <"+e.originalName+">");return dn.prototype.createElement.call(this,e)};function ao(e,t,n){this.model=e,this.context=n}ao.prototype=Object.create(is.prototype),ao.prototype.createElement=function(e){var t=e.name,n=un(t),i=n.prefix,r=e.ns[i+"$uri"],o=e.attributes;return this.model.createAny(t,r,o)},ao.prototype.handleChild=function(e){var t=new ao(this.model,"Element",this.context).handleNode(e),n=this.element,i=t.element,r;return i!==void 0&&(r=n.$children=n.$children||[],r.push(i),i.$parent=n),t},ao.prototype.handleEnd=function(){this.body&&(this.element.$body=this.body)};function Fu(e){e instanceof Fn&&(e={model:e}),N(this,{lax:!1},e)}Fu.prototype.fromXML=function(e,t,n){var i=t.rootHandler;t instanceof dn?(i=t,t={}):typeof t=="string"?(i=this.handler(t),t={}):typeof i=="string"&&(i=this.handler(i));var r=this.model,o=this.lax,a=new I0(N({},t,{rootHandler:i})),s=new ud({proxy:!0}),c=N0();i.context=a,c.push(i);function u(C,T,B){var M=T(),z=M.line,G=M.column,$=M.data;$.charAt(0)==="<"&&$.indexOf(" ")!==-1&&($=$.slice(0,$.indexOf(" "))+">");var V="unparsable content "+($?$+" ":"")+`detected
|
|
2
|
-
line: `+
|
|
3
|
-
column: `+
|
|
4
|
-
nested error: `+C.message;if(
|
|
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 J0(e){e=N({format:!1,preamble:!0},e||{});function t(n,i){var r=i||new Z0,o=new Q0(r,e.format);e.preamble&&o.append(B0);var a=new vt,s=n.$model;if(a.getNamespaces().mapDefaultPrefixes(ew(s)),a.build(n).serializeTo(o),!i)return r.value}return{toXML:t}}function ew(e){const t=e.config&&e.config.nsMap||{},n={};for(const i in Nu)n[i]=Nu[i];for(const i in t){const r=t[i];n[r]=i}for(const i of e.getPackages())n[i.prefix]=i.uri;return n}function os(e,t){Fn.call(this,e,t)}os.prototype=Object.create(Fn.prototype),os.prototype.fromXML=function(e,t,n){En(t)||(n=t,t="bpmn:Definitions");var i=new Fu(N({model:this,lax:!0},n)),r=i.handler(t);return i.fromXML(e,r)},os.prototype.toXML=function(e,t){var n=new J0(t);return new Promise(function(i,r){try{var o=n.toXML(e);return i({xml:o})}catch(a){return r(a)}})};var tw="BPMN20",nw="http://www.omg.org/spec/BPMN/20100524/MODEL",iw="bpmn",rw=[],ow=[{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"}]}],aw=[{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"}]}],sw={tagAlias:"lowerCase",typePrefix:"t"},cw={name:tw,uri:nw,prefix:iw,associations:rw,types:ow,enumerations:aw,xml:sw},uw="BPMNDI",lw="http://www.omg.org/spec/BPMN/20100524/DI",pw="bpmndi",fw=[{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"]}],dw=[{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"}]}],hw=[],mw={name:uw,uri:lw,prefix:pw,types:fw,enumerations:dw,associations:hw},gw="DC",yw="http://www.omg.org/spec/DD/20100524/DC",vw="dc",_w=[{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}]}],bw=[],xw={name:gw,uri:yw,prefix:vw,types:_w,associations:bw},ww="DI",Ew="http://www.omg.org/spec/DD/20100524/DI",Sw="di",Rw=[{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"}]}],Cw=[],Pw={tagAlias:"lowerCase"},Aw={name:ww,uri:Ew,prefix:Sw,types:Rw,associations:Cw,xml:Pw},Tw="bpmn.io colors for BPMN",Mw="http://bpmn.io/schema/bpmn/biocolor/1.0",kw="bioc",Ow=[{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"}]}],Dw=[],Lw=[],Iw={name:Tw,uri:Mw,prefix:kw,types:Ow,enumerations:Dw,associations:Lw},Nw="BPMN in Color",Bw="http://www.omg.org/spec/BPMN/non-normative/color/1.0",$w="color",jw=[{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"}]}],Fw=[],Hw=[],zw={name:Nw,uri:Bw,prefix:$w,types:jw,enumerations:Fw,associations:Hw};const Gw={bpmn:cw,bpmndi:mw,dc:xw,di:Aw,bioc:Iw,color:zw};function vd(e,t){const n=N({},Gw,e);return new os(n,t)}const Vw={name:"bpmn-i18n",uri:"http://www.omg.org/spec/BPMN/non-normative/extensions/i18n/1.0",prefix:"i18n",types:[{name:"Translation",superClass:["Element"],properties:[{name:"id",isAttr:!0,isId:!0,type:"String"},{name:"body",isBody:!0,type:"String"},{name:"target",isAttr:!0,type:"String",default:"@name"},{name:"textFormat",isAttr:"true",type:"String",default:"text/plain"}]}],enumerations:[],associations:[],xml:{tagAlias:"lowerCase",typePrefix:"t"}},Ww="http://www.omg.org/spec/BPMN/non-normative/extensions/i18n/1.0",_d="i18n",as={[_d]:Vw,[Ru]:Yf};function bd(){return vd(as)}const xd=bd();async function Gu(e){const{rootElement:t,warnings:n}=await xd.fromXML(e,"bpmn:Definitions");return{definitions:t,warnings:n}}async function Uw(e){const{xml:t}=await xd.toXML(e,{format:!0});return t}function Vu(e){return e.map(t=>typeof t=="string"?t:t.message??String(t))}const so={cjkEm:.865,upperEm:.68,lowerEm:.5,digitEm:.556,spaceEm:.278,otherEm:.35,ascentEm:.9,descentEm:.25},qw=/[ᄀ-ᇿ -〿-ヿ㐀-鿿가--⦆]/;function Yw(e){const t=so;return qw.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 co(e,t){let n=0;for(const i of e)n+=t*Yw(i);return n}function wd(e=globalThis,{textMeasurement:t="approximate"}={}){if(!(e!=null&&e.SVGElement))throw new Error("installHeadlessBpmnDom: DOM 전역이 없다 — jsdom window 를 전역에 올린 뒤 호출할 것");t==="approximate"&&Kw(e),Xw(e),Zw(e),Qw(e)}function Kw(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:co(r,o),fontBoundingBoxAscent:o*so.ascentEm,fontBoundingBoxDescent:o*so.descentEm,actualBoundingBoxAscent:o*so.ascentEm,actualBoundingBoxDescent:o*so.descentEm}}};t.getContext=()=>n}function Xw(e){if(e.SVGMatrix)return;class t{constructor(){eo(this,"a",1);eo(this,"b",0);eo(this,"c",0);eo(this,"d",1);eo(this,"e",0);eo(this,"f",0)}static of(i,r,o,a,s,c){return Object.assign(new t,{a:i,b:r,c:o,d:a,e:s,f:c})}multiply(i){return t.of(this.a*i.a+this.c*i.b,this.b*i.a+this.d*i.b,this.a*i.c+this.c*i.d,this.b*i.c+this.d*i.d,this.a*i.e+this.c*i.f+this.e,this.b*i.e+this.d*i.f+this.f)}translate(i,r){return this.multiply(t.of(1,0,0,1,i,r))}scale(i,r=i){return this.multiply(t.of(i,0,0,r,0,0))}inverse(){const i=this.a*this.d-this.b*this.c;return t.of(this.d/i,-this.b/i,-this.c/i,this.a/i,(this.c*this.f-this.d*this.e)/i,(this.b*this.e-this.a*this.f)/i)}}e.SVGMatrix=t}function Zw(e){var o;const t=()=>{const a=new e.SVGMatrix;return{type:0,matrix:a,setTranslate(s,c){a.e=s,a.f=c},setScale(s,c){a.a=s,a.d=c},setRotate(s,c=0,u=0){const l=s*Math.PI/180,f=Math.cos(l),p=Math.sin(l);a.a=f,a.b=p,a.c=-p,a.d=f,a.e=c-f*c+p*u,a.f=u-p*c-f*u},setMatrix(s){Object.assign(a,s)}}},n=a=>{const s=t();return Object.assign(s.matrix,a),s},i=(o=e.SVGSVGElement)==null?void 0:o.prototype;i&&!i.createSVGTransform&&(i.createSVGTransform=t,i.createSVGTransformFromMatrix=n,i.createSVGMatrix=()=>new e.SVGMatrix,i.createSVGPoint=()=>({x:0,y:0,matrixTransform:()=>({x:0,y:0})}));const r=e.SVGElement.prototype;Object.getOwnPropertyDescriptor(r,"transform")||Object.defineProperty(r,"transform",{configurable:!0,get(){if(!this.__headlessTransformList){const a=[];this.__headlessTransformList={baseVal:{get numberOfItems(){return a.length},clear:()=>{a.length=0},appendItem:s=>(a.push(s),s),getItem:s=>a[s],createSVGTransformFromMatrix:n,consolidate:()=>a[a.length-1]??null}}}return this.__headlessTransformList}})}function Qw(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:co(n,12),height:14}})}const ss=new Set(["bpmn:Participant","bpmn:Lane","bpmn:Group","bpmn:SubProcess","bpmn:AdHocSubProcess","bpmn:Transaction"]),Jw=1,eE=2;function Xi(e){switch(e.kind){case"label-over-line":return`L|${e.edge}|${e.line}`;case"edge-crosses-shape":return`x|${e.edge}|${e.shape}`;case"shape-overlap":return`o|${e.shapes[0]}|${e.shapes[1]}`;case"shape-outside-container":return`c|${e.shape}|${e.container}`;case"edge-overlap-opposite":return`p|${e.edges[0]}|${e.edges[1]}`;case"edge-overlap-mixed":return`m|${e.edges[0]}|${e.edges[1]}`;case"label-on-shared-segment":return`l|${e.edge}|${e.other}`;case"annotation-over-label":return`a|${e.annotation}|${e.label}`;case"group-overlap-unintended":return`g|${e.groups[0]}|${e.groups[1]}`;case"group-on-container-boundary":return`gb|${e.group}|${e.container}|${e.side}`;case"group-on-group-boundary":return`gg|${e.groups[0]}|${e.groups[1]}|${e.axis}`;case"pool-name-over-label":return`pn|${e.pool}|${e.label}`}}const Ed=20,Sd=5,Rd=3,Cd=12,tE=Cd*1.2;function Wu(e,t){const n=t.split(/\r?\n/),i=Math.max(...n.map(o=>co(o,Cd))),r=n.length*tE;return{x:e.x+e.width/2-i/2,y:e.y+e.height/2-r/2,width:i,height:r}}const Pd=1;function hn(e){const t=[];for(let n=0;n+1<e.waypoints.length;n++){const i=e.waypoints[n],r=e.waypoints[n+1];Math.abs(i.y-r.y)<.5&&Math.abs(i.x-r.x)>=.5?t.push({axis:"h",at:i.y,lo:Math.min(i.x,r.x),hi:Math.max(i.x,r.x),dir:r.x>i.x?1:-1}):Math.abs(i.x-r.x)<.5&&Math.abs(i.y-r.y)>=.5&&t.push({axis:"v",at:i.x,lo:Math.min(i.y,r.y),hi:Math.max(i.y,r.y),dir:r.y>i.y?1:-1})}return t}function cs(e,t){let n=null;const i=e.type!==t.type;for(const r of hn(e))for(const o of hn(t)){if(r.axis!==o.axis||Math.abs(r.at-o.at)>Pd)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 Ad(e,t){const n=cs(e,t);return n&&n.kind==="opposite"?{axis:n.axis,length:n.length}:null}function nE(e,t){let n=0;for(const i of t)i.id!==e.id&&Ad(e,i)&&n++;return n}function Pi(e,t){let n=0;for(const i of t)i.id!==e.id&&cs(e,i)&&n++;return n}const Td=15,Md=20;function iE(e,t){const n=t.axis==="v"?[e.x,e.x+e.width]:[e.y,e.y+e.height];if(t.at<n[0]-Md||t.at>n[1]+Md)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 Uu=20;function us(e,t){const n=[];for(const i of t){if(i.axis!==e.axis||Math.abs(i.at-e.at)>Pd)continue;const r=Math.max(e.lo,i.lo),o=Math.min(e.hi,i.hi);o-r<Ed||n.push([r-Uu,o+Uu])}return n}function ls(e,t){const n=e.label;if(!n)return null;let i=null;for(const r of hn(e)){const o=iE(n,r);if(o){for(const a of t)if(a.id!==e.id&&!(i&&a.id>=i.other)){for(const[s,c]of us(r,hn(a)))if(Math.min(c,o[1])>Math.max(s,o[0])){i={other:a.id,axis:r.axis};break}}}}return i}const rE=1,oE=(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 aE(e,t,n,i){const r=n.x+i,o=n.y+i,a=n.x+n.width-i,s=n.y+n.height-i;if(a<=r||s<=o)return!1;const c=t.x-e.x,u=t.y-e.y;let l=0,f=1;const p=(d,h)=>{if(h===0)return d<=0;const m=d/h;if(h>0){if(m>f)return!1;m>l&&(l=m)}else{if(m<l)return!1;m<f&&(f=m)}return!0};return p(r-e.x,c)&&p(e.x-a,-c)&&p(o-e.y,u)&&p(e.y-s,-u)&&f>l}function qu(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 sE=(e,t)=>e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height,uo=1;function Ai(e,t){const n=e.x+uo,i=e.x+e.width-uo,r=e.y+uo,o=e.y+e.height-uo;return t.axis==="h"?t.at>r&&t.at<o&&t.lo<i&&t.hi>n:t.at>n&&t.at<i&&t.lo<o&&t.hi>r}function Yo(e){return[{axis:"h",at:e.y,lo:e.x,hi:e.x+e.width,dir:1},{axis:"h",at:e.y+e.height,lo:e.x,hi:e.x+e.width,dir:1},{axis:"v",at:e.x,lo:e.y,hi:e.y+e.height,dir:1},{axis:"v",at:e.x+e.width,lo:e.y,hi:e.y+e.height,dir:1}]}function kd(e,t){const n=e.label;if(!n)return null;if(hn(e).some(i=>Ai(n,i)))return e.id;for(const i of[...t.edges].filter(r=>r.id!==e.id).sort((r,o)=>r.id.localeCompare(o.id)))if(hn(i).some(r=>Ai(n,r)))return i.id;for(const i of t.shapes.filter(r=>r.container).sort((r,o)=>r.id.localeCompare(o.id)))if(Yo(i).some(r=>Ai(n,r)))return i.id;return null}function Hn(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(aE(e.waypoints[o],e.waypoints[o+1],r,eE)){i.push(r);break}}return i}function cE(e,t,n,i){const r=(u,l,f)=>(l.x-u.x)*(f.y-u.y)-(l.y-u.y)*(f.x-u.x),o=r(n,i,e),a=r(n,i,t),s=r(e,t,n),c=r(e,t,i);return o*a<0&&s*c<0}const Od=(e,t)=>e.endpoints.some(n=>t.endpoints.includes(n));function ps(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++)cE(e.waypoints[o],e.waypoints[o+1],i.waypoints[a],i.waypoints[a+1])&&(r=!0);r&&n++}return n}function Ti(e,t){let n=0;for(const i of t)i.id===e.id||Od(e,i)||ps(e,[i])>0&&(n+=i.type===e.type?2:1);return n}function Dd(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++)ps(n[i],[n[r]])>0&&(t+=n[i].type===n[r].type?2:1);return t}function Yu(e){const t=[],n=e.edges;for(let i=0;i<n.length;i++)for(let r=i+1;r<n.length;r++)if(ps(n[i],[n[r]])>0){const o=n[i].id,a=n[r].id;t.push(o<a?[o,a]:[a,o])}return t.sort((i,r)=>`${i[0]}|${i[1]}`.localeCompare(`${r[0]}|${r[1]}`))}function Ld(e){var n;const t=(n=_t(e==null?void 0:e.extensionElements))==null?void 0:n.values;if(Array.isArray(t))for(const i of t){const r=_t(i);if((r==null?void 0:r.$type)!=="bwl:Members"||typeof r.refs!="string")continue;const o=r.refs.split(/\s+/).filter(Boolean);return o.length?o:void 0}}const Id=e=>e?{members:e}:{},ui=e=>e.shapes.filter(t=>!t.container);function uE(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 Nd(e,t){const n=e.label;if(!n)return null;for(const i of[...t.edges].sort((r,o)=>r.id.localeCompare(o.id)))if(hn(i).some(r=>Ai(n,r)))return i.id;for(const i of[...t.shapes].filter(r=>r.container).sort((r,o)=>r.id.localeCompare(o.id)))if(Yo(i).some(r=>Ai(n,r)))return i.id;return null}function Ko(e){const t=[];for(const n of e.shapes)n.label&&t.push({owner:n.id,rect:n.label});for(const n of e.edges)n.label&&t.push({owner:n.id,rect:n.label});return t}function Zi(e){const t=[],n=e.shapes.filter(p=>!p.container);for(const p of e.edges)for(const d of Hn(p,n))t.push({kind:"edge-crosses-shape",edge:p.id,shape:d.id});const i=n.filter(p=>!p.attached);for(let p=0;p<i.length;p++)for(let d=p+1;d<i.length;d++){const h=i[p],m=i[d];if(!qu(h,m,Jw))continue;const g=h.id<m.id?[h.id,m.id]:[m.id,h.id];t.push({kind:"shape-overlap",shapes:g,identical:sE(h,m)})}const r=e.shapes.filter(p=>p.type==="bpmn:Group"&&Array.isArray(p.members)&&p.members.length>0);for(let p=0;p<r.length;p++)for(let d=p+1;d<r.length;d++){const h=r[p],m=r[d],g=Math.min(h.x+h.width,m.x+m.width)-Math.max(h.x,m.x),S=Math.min(h.y+h.height,m.y+m.height)-Math.max(h.y,m.y);if(g<=Sd||S<=Sd)continue;const E=new Set(m.members);h.members.some(x=>E.has(x))||t.push({kind:"group-overlap-unintended",groups:h.id<m.id?[h.id,m.id]:[m.id,h.id]})}const o=e.shapes.filter(p=>p.container&&p.type!=="bpmn:Group"&&p.type!=="bpmn:Lane");for(const p of e.shapes.filter(d=>d.type==="bpmn:Group"))for(const d of o){const h=p.x<d.x+d.width&&d.x<p.x+p.width,m=p.y<d.y+d.height&&d.y<p.y+p.height,g=[["top",p.y,d.y,h],["bottom",p.y+p.height,d.y+d.height,h],["left",p.x,d.x,m],["right",p.x+p.width,d.x+d.width,m]];for(const[S,E,x,w]of g)w&&Math.abs(E-x)<=Rd&&t.push({kind:"group-on-container-boundary",group:p.id,container:d.id,side:S})}const a=e.shapes.filter(p=>p.type==="bpmn:Group");for(let p=0;p<a.length;p++)for(let d=p+1;d<a.length;d++){const h=a[p],m=a[d],g=h.x<m.x+m.width&&m.x<h.x+h.width,S=h.y<m.y+m.height&&m.y<h.y+h.height,E=[["x",h.x+h.width,m.x,S],["x",m.x+m.width,h.x,S],["y",h.y+h.height,m.y,g],["y",m.y+m.height,h.y,g]];for(const[x,w,C,T]of E)if(T&&Math.abs(w-C)<=Rd){t.push({kind:"group-on-group-boundary",groups:h.id<m.id?[h.id,m.id]:[m.id,h.id],axis:x});break}}for(let p=0;p<e.edges.length;p++)for(let d=p+1;d<e.edges.length;d++){const h=e.edges[p],m=e.edges[d],g=cs(h,m);if(!g)continue;const S=h.id<m.id?[h.id,m.id]:[m.id,h.id];t.push({kind:g.kind==="opposite"?"edge-overlap-opposite":"edge-overlap-mixed",edges:S,axis:g.axis,length:Math.round(g.length)})}for(const p of e.edges){if(!p.label)continue;const d=ls(p,e.edges);d&&t.push({kind:"label-on-shared-segment",edge:p.id,other:d.other,axis:d.axis})}for(const p of e.edges){if(!p.label)continue;const d=kd(p,e);d&&t.push({kind:"label-over-line",edge:p.id,line:d})}const s=new Set(n.map(p=>p.id)),c=e.shapes.filter(p=>p.type==="bpmn:Participant"&&p.label);for(const p of[...n,...c.filter(d=>!s.has(d.id))]){if(!p.label)continue;const d=Nd(p,e);d&&t.push({kind:"label-over-line",edge:p.id,line:d})}const u=new Set(e.shapes.filter(p=>p.type==="bpmn:TextAnnotation").map(p=>p.id));for(const p of c)for(const{owner:d,rect:h}of Ko(e))d===p.id||u.has(d)||qu(p.label,h,uo)&&t.push({kind:"pool-name-over-label",pool:p.id,label:d});const l=Ko(e);for(const p of n)if(p.type==="bpmn:TextAnnotation")for(const{owner:d,rect:h}of l)d!==p.id&&qu(p,h,uo)&&t.push({kind:"annotation-over-label",annotation:p.id,label:d});const f=new Map(e.shapes.map(p=>[p.id,p]));for(const p of n){const d=p.parent??uE(p,e,f);if(!d)continue;const h=f.get(d);!h||!h.container||oE(h,p,rE)||t.push({kind:"shape-outside-container",shape:p.id,container:h.id})}return t.sort((p,d)=>Xi(p).localeCompare(Xi(d)))}const _t=e=>typeof e=="object"&&e!==null?e:void 0,Ct=e=>typeof e=="number"?e:0,kr=e=>{const t=_t(e);return typeof(t==null?void 0:t.id)=="string"?t.id:void 0};function lE(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=kr(o);a&&n.push(a)}}return n}function pE(e,t){const n=_t(e.$parent);if(!n)return;const i=typeof n.$type=="string"?n.$type:"";if(i==="bpmn:Process"){const r=kr(n);return r?t.get(r):void 0}if(ss.has(i)&&i!=="bpmn:Lane"&&i!=="bpmn:Group")return kr(n)}function Bd(e){var a,s,c,u,l;const t=[],n=[],i=((a=_t(e))==null?void 0:a.diagrams)??[],r=new Map,o=new Set;for(const f of((s=_t(e))==null?void 0:s.rootElements)??[]){const p=_t(f);if((p==null?void 0:p.$type)==="bpmn:Collaboration")for(const d of p.participants??[]){const h=_t(d),m=kr(h),g=kr(h==null?void 0:h.processRef);m&&g?r.set(g,m):m&&o.add(m)}}for(const f of i){const p=_t((c=_t(f))==null?void 0:c.plane),d=(p==null?void 0:p.planeElement)??[];for(const h of d){const m=_t(h);if(!m)continue;const g=_t(m.bpmnElement),S=typeof(g==null?void 0:g.id)=="string"?g.id:void 0;if(!S)continue;const E=typeof(g==null?void 0:g.$type)=="string"?g.$type:"",x=_t(m.bounds);if(x){const C=m.isExpanded===!1&&E!=="bpmn:Participant",T=_t((u=_t(m.label))==null?void 0:u.bounds),B={id:S,type:E,x:Ct(x.x),y:Ct(x.y),width:Ct(x.width),height:Ct(x.height),container:ss.has(E)&&!C,attached:(g==null?void 0:g.attachedToRef)!==void 0,...g?{parent:pE(g,r)}:{},...T?{label:{x:Ct(T.x),y:Ct(T.y),width:Ct(T.width),height:Ct(T.height)}}:{},...E==="bpmn:Group"?Id(Ld(g)):{}},M=m.isHorizontal!==!1,z=typeof(g==null?void 0:g.name)=="string"?g.name:"";o.has(S)&&M&&z&&(B.label=Wu(B,z)),t.push(B);continue}const w=m.waypoint;if(Array.isArray(w)){const C=_t((l=_t(m.label))==null?void 0:l.bounds);n.push({id:S,type:E,waypoints:w.map(T=>{var B,M;return{x:Ct((B=_t(T))==null?void 0:B.x),y:Ct((M=_t(T))==null?void 0:M.y)}}),endpoints:lE(g),...C?{label:{x:Ct(C.x),y:Ct(C.y),width:Ct(C.width),height:Ct(C.height)}}:{}})}}}return{shapes:t,edges:n}}function $d(e){return Zi(Bd(e))}async function fE(e){const{definitions:t,warnings:n}=await Gu(e);return{findings:$d(t),warnings:n}}function Ot(e){var i;const t=[],n=[];for(const r of e.getAll()){const o=r;if(o.type==="label"||o.labelTarget)continue;const a=typeof o.type=="string"?o.type:"";if(a==="bpmn:Definitions"||a.startsWith("bpmndi:"))continue;const s=o.waypoints;if(s){const m=_t(o.label);n.push({id:o.id,type:a,waypoints:s.map(g=>({x:Ct(g.x),y:Ct(g.y)})),endpoints:[kr(o.source),kr(o.target)].filter(g=>!!g),...m&&typeof m.x=="number"?{label:{x:m.x,y:Ct(m.y),width:Ct(m.width),height:Ct(m.height)}}:{}});continue}if(typeof o.x!="number"||typeof o.y!="number")continue;const c=_t(o.businessObject),u=_t(o.label);let l=_t(o.parent);for(;l&&l.type==="bpmn:Lane";)l=_t(l.parent);const f=typeof(l==null?void 0:l.type)=="string"?l.type:"",p=l&&ss.has(f)&&f!=="bpmn:Group"&&typeof l.id=="string"?l.id:void 0,d={id:o.id,type:a,x:o.x,y:o.y,width:Ct(o.width),height:Ct(o.height),container:ss.has(a)&&(a==="bpmn:Participant"||o.collapsed!==!0),attached:(c==null?void 0:c.attachedToRef)!==void 0,...p!==void 0?{parent:p}:{},...u&&typeof u.x=="number"?{label:{x:u.x,y:Ct(u.y),width:Ct(u.width),height:Ct(u.height)}}:{},...a==="bpmn:Group"?Id(Ld(c)):{}},h=typeof(c==null?void 0:c.name)=="string"?c.name:"";a==="bpmn:Participant"&&!(c!=null&&c.processRef)&&h&&((i=_t(o.di))==null?void 0:i.isHorizontal)!==!1&&(d.label=Wu(d,h)),t.push(d)}return{shapes:t,edges:n}}const dE={"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 hE(e,t){const n=dE[e];return n||(e==="label"||e.startsWith("bpmndi:")?"other":e.startsWith("bpmn:")&&!("waypoints"in t&&t.waypoints)?"flowNode":"other")}function jd(e){let t=e.parent;for(;t;){if(t.type==="bpmn:Participant")return t.id;t=t.parent}}function Fd(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 hE(i.type,i)},lanesOf:n=>t().filter(i=>i.type==="bpmn:Lane"&&jd(i)===n).sort((i,r)=>i.y-r.y).map(i=>i.id),participantOf:n=>{const i=e.get(n);return i?jd(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 Hd=20,mE=4,Dt=(e,t)=>Math.abs(e-t)<.5;function zd(e,t,n,i=Hd){if(Dt(e.y,t.y)&&!Dt(e.x,t.x)){const r=Math.min(e.x,t.x),o=Math.max(e.x,t.x);if(!(r<n.x-i&&n.x+n.width+i<o))return null;const a=e.x<t.x?n.x-i:n.x+n.width+i,s=e.x<t.x?n.x+n.width+i:n.x-i,c=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(Dt(e.x,t.x)&&!Dt(e.y,t.y)){const r=Math.min(e.y,t.y),o=Math.max(e.y,t.y);if(!(r<n.y-i&&n.y+n.height+i<o))return null;const a=e.y<t.y?n.y-i:n.y+n.height+i,s=e.y<t.y?n.y+n.height+i:n.y-i,c=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 Gd(e,t,n=Hd){if(e.length!==4)return null;const[i,r,o,a]=e;if(Dt(i.y,r.y)&&Dt(r.x,o.x)&&Dt(o.y,a.y)){const s=c=>[i,{x:c,y:i.y},{x:c,y:a.y},a];return[s(t.x-n),s(t.x+t.width+n)]}if(Dt(i.x,r.x)&&Dt(r.y,o.y)&&Dt(o.x,a.x)){const s=c=>[i,{x:i.x,y:c},{x:a.x,y:c},a];return[s(t.y-n),s(t.y+t.height+n)]}return null}function Ku(e,t){if(e.endpoints.length!==2)return[];const n=t.find(f=>f.id===e.endpoints[0]),i=t.find(f=>f.id===e.endpoints[1]);if(!n||!i)return[];if(i.x<=n.x+n.width)return[];const r=n.y+n.height/2,o=i.y+i.height/2;if(r>=i.y&&r<=i.y+i.height)return[];const a=i.x+i.width/2,s=n.x+n.width/2,c=r>o,u=[{x:n.x+n.width,y:r},{x:a,y:r},{x:a,y:c?i.y+i.height:i.y}],l=[{x:s,y:c?n.y:n.y+n.height},{x:s,y:o},{x:i.x,y:o}];return[u,l]}const Vd=30,gE=[0,-25,25,-40,40];function yE(e,t){if(e.type!=="bpmn:MessageFlow"||e.endpoints.length!==2)return[];const n=t.find(p=>p.id===e.endpoints[0]),i=t.find(p=>p.id===e.endpoints[1]);if(!n||!i)return[];const r=n.y+n.height/2,o=i.y+i.height/2;if(i.y<n.y+n.height&&i.y+i.height>n.y)return[];const a=o<r,s=a?n.y+n.height:n.y,c=a?s+Vd:s-Vd,u=a?i.y+i.height:i.y,l=n.x+n.width/2,f=i.x+i.width/2;return gE.map(p=>[{x:l,y:s},{x:l,y:c},{x:f+p,y:c},{x:f+p,y:u}])}const vE=(e,t,n)=>[...e.slice(0,t+1),...n,...e.slice(t+1)],fs=(e,t,n)=>Hn({...e,waypoints:t},n).length;function Wd(e,t,n,i){let r=[...e.waypoints],o=fs(e,r,t);if(o===0)return null;let a=!1;for(const f of Ku(e,t))if(fs(e,f,t)===0)return f;const s=(i??[]).filter(f=>f.id!==e.id).flatMap(hn),c=f=>hn({...e,waypoints:f}).some(p=>us(p,s).length>0),u=yE(e,t).filter(f=>fs(e,f,t)===0);if(u.length)return u.find(f=>!c(f))??u[0];const l=f=>!n||f.every(p=>p.x>=n.x&&p.x<=n.x+n.width&&p.y>=n.y&&p.y<=n.y+n.height);for(let f=0;f<mE&&o>0;f++){let p=!1;for(let d=0;d+1<r.length&&!p;d++){const h=r[d],m=r[d+1];for(const g of t){if(e.endpoints.includes(g.id)||Hn({...e,waypoints:[h,m]},[g]).length===0)continue;const S=zd(h,m,g),E=S?S.map(w=>vE(r,d,w)):Gd(r,g)??[];if(!E.length)continue;const x=[...E].sort((w,C)=>Number(l(C))-Number(l(w)));for(const w of x){const C=fs(e,w,t);if(C<o){r=w,o=C,p=!0,a=!0;break}}if(p)break}}if(!p)break}return a&&o===0?r:null}function Ud(e,t){const{elementRegistry:n}=e,i=e.modeling,r=Ot(n),o=ui(r),a=Zi(r).filter(c=>c.kind==="edge-crosses-shape"&&!t.has(Xi(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 f=l.parent,p=f&&typeof f.x=="number"&&typeof f.width=="number"?{x:f.x,y:f.y,width:f.width,height:f.height}:void 0,d=Wd(u,o,p,r.edges);if(!d)continue;const h=r.edges.filter(S=>S.id!==c),m=Pi(u,h);Pi({...u,waypoints:d},h)>m||i.updateWaypoints(l,d)}}const _E=10;function qd(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(V=>V.type==="bpmn:Participant"&&V.container),i=t.shapes.find(V=>V.id===e.endpoints[0]),r=t.shapes.find(V=>V.id===e.endpoints[1]);if(!i||!r)return null;const o=qd(i,n),a=qd(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(V=>V.id!==o.id&&V.id!==a.id&&V.y>=c.y+c.height&&V.y+V.height<=u.y).sort((V,he)=>V.y-he.y);if(!l.length)return null;const f=l[0],p=l[l.length-1],d=(c.y+c.height+f.y)/2,h=(p.y+p.height+u.y)/2,m=s?d:h,g=s?h:d,S=e.waypoints[0],E=e.waypoints[e.waypoints.length-1],x=ui(t),w=t.edges.filter(V=>V.id!==e.id),C=Ti(e,w),T=Hn(e,x).length;if(C===0&&T===0||T===0&&e.waypoints.length===2)return null;const B=Math.min(...l.map(V=>V.x)),M=Math.max(...l.map(V=>V.x+V.width)),z=(S.x+E.x)/2,G=V=>V.filter((he,nt)=>nt===0||!(Dt(he.x,V[nt-1].x)&&Dt(he.y,V[nt-1].y)));let $;for(let V=B;V<=M;V+=_E){const he=G([S,{x:S.x,y:m},{x:V,y:m},{x:V,y:g},{x:E.x,y:g},E]),nt={...e,waypoints:he};if(Hn(nt,x).length>0)continue;const gt=Ti(nt,w),J=Math.abs(V-z);(!$||gt<$.cross||gt===$.cross&&J<$.detour)&&($={pts:he,cross:gt,detour:J})}return $&&(T>0?$.cross<=C:$.cross<C)?$.pts:null}function Kd(e,t){const{elementRegistry:n}=e,i=e.modeling,r=Ot(n);for(const o of r.edges){if(o.type!=="bpmn:MessageFlow"||t.has(o.id))continue;const a=Ot(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 lo=[25,-25,40,-40],ds=35;function Xd(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-ds:n.y+n.height+ds,f=[];for(const E of[0,...lo]){if(Math.abs(E)>=i.width/2-5)continue;const x=o+E;f.push({pts:[{x:n.x,y:r},{x,y:r},{x,y:c}],cost:Math.abs(E)});for(const w of[0,...lo]){if(Math.abs(w)>=n.width/2-5)continue;const C=a+w;f.push({pts:[{x:C,y:u},{x:C,y:l},{x,y:l},{x,y:c}],cost:Math.abs(E)+Math.abs(w)})}}const p=50,d=i.y+i.height/2,h=s?n.y+n.height:n.y;for(const E of[0,...lo]){if(Math.abs(E)>=n.width/2-5)continue;const x=a+E;f.push({pts:[{x,y:h},{x,y:d},{x:i.x+i.width,y:d}],cost:p+Math.abs(E)})}const m=60,g=s?i.y+i.height:i.y,S=s?i.y+i.height+ds:i.y-ds;for(const E of[0,...lo]){if(Math.abs(E)>=i.width/2-5)continue;const x=o+E;for(const w of[0,...lo]){if(Math.abs(w)>=n.width/2-5)continue;const C=a+w;f.push({pts:[{x:C,y:h},{x:C,y:S},{x,y:S},{x,y:g}],cost:m+Math.abs(E)+Math.abs(w)})}}return f}const hs=30;function Zd(e,t){for(let n=1;n<e.length-2;n++){const i=e[n],r=e[n+1],o=Dt(i.y,r.y)&&!Dt(i.x,r.x),a=Dt(i.x,r.x)&&!Dt(i.y,r.y);if(!(!o&&!a))for(const s of t)if(o){const c=Math.min(i.x,r.x);if(Math.max(i.x,r.x)<=s.x||c>=s.x+s.width)continue;if(Math.abs(i.y-s.y)<hs||Math.abs(i.y-(s.y+s.height))<hs)return!0}else{const c=Math.min(i.y,r.y);if(Math.max(i.y,r.y)<=s.y||c>=s.y+s.height)continue;if(Math.abs(i.x-s.x)<hs||Math.abs(i.x-(s.x+s.width))<hs)return!0}}return!1}const ms=40;function bE(e,t,n){let i=0;for(const r of t){if(r.container||n.includes(r.id))continue;const o=r.x-ms,a=r.x+r.width+ms,s=r.y-ms,c=r.y+r.height+ms;for(let u=1;u<e.length-2;u++){const l=e[u],f=e[u+1],p={x:Math.min(l.x,f.x),y:Math.min(l.y,f.y)},d={x:Math.max(l.x,f.x),y:Math.max(l.y,f.y)};if(p.x<a&&d.x>o&&p.y<c&&d.y>s){i++;break}}}return i}function Qd(e,t){if(e.type!=="bpmn:SequenceFlow")return null;const n=t.shapes.filter(E=>E.container),i=new Map(t.shapes.map(E=>[E.id,E])),r=ui(t),o=t.edges.filter(E=>E.id!==e.id),a=Pi(e,o),s=Ti(e,o),c=E=>bE(E,t.shapes,e.endpoints)+(Zd(E,n)?1:0),u=c(e.waypoints),l=E=>{if(!E)return;const x=E.x+E.width/2,w=E.y+E.height/2;return n.find(C=>C.type==="bpmn:Lane"&&x>=C.x&&x<=C.x+C.width&&w>=C.y&&w<=C.y+C.height)},f=l(i.get(e.endpoints[0]??"")),p=l(i.get(e.endpoints[1]??"")),d=!!f&&!!p&&f.id!==p.id,h=E=>{if(!d||!p)return!1;for(let x=1;x<E.length-2;x++){const w=E[x],C=E[x+1];if(Dt(w.y,C.y)&&!Dt(w.x,C.x)&&w.y>p.y&&w.y<p.y+p.height)return!0}return!1},m=h(e.waypoints);if(!Zd(e.waypoints,n)&&!(d&&!m))return null;const g=E=>E.reduce((x,w,C)=>C?x+Math.abs(w.x-E[C-1].x)+Math.abs(w.y-E[C-1].y):0,0);let S;for(const{pts:E,cost:x}of Xd(e,i)){const w={...e,waypoints:E};if(Hn(w,r).length>0||Pi(w,o)>a||Ti(w,o)>s)continue;const C=c(E),T=h(E);if(!(T&&!m)&&C>=u)continue;const M=T?0:1,z=g(E);(!S||M<S.lane||M===S.lane&&(C<S.sc||C===S.sc&&(x<S.cost||x===S.cost&&z<S.len)))&&(S={pts:E,sc:C,lane:M,cost:x,len:z})}return(S==null?void 0:S.pts)??null}function xE(e,t){const{elementRegistry:n}=e,i=e.modeling,r=Ot(n).edges.filter(o=>!t.has(o.id)&&o.waypoints.length>=4).map(o=>o.id).sort();for(const o of r){const a=Ot(n),s=a.edges.find(d=>d.id===o);if(!s||s.waypoints.length<4)continue;const c=ui(a),u=a.edges.filter(d=>d.id!==o),l=Hn(s,c).length,f=Pi(s,u),p=Ti(s,u);for(const d of Ku(s,a.shapes)){if(d.length>=s.waypoints.length)continue;const h={...s,waypoints:d};if(Hn(h,c).length>l||Pi(h,u)>f||Ti(h,u)>p)continue;const m=n.get(o);m&&i.updateWaypoints(m,d);break}}}function Jd(e,t){const{elementRegistry:n}=e,i=e.modeling,r=Ot(n).edges.filter(o=>o.type==="bpmn:SequenceFlow"&&!t.has(o.id)).map(o=>o.id).sort();for(const o of r){const a=Ot(n),s=a.edges.find(l=>l.id===o);if(!s)continue;const c=Qd(s,a);if(!c)continue;const u=n.get(o);u&&i.updateWaypoints(u,c)}}function wE(e,t){const n=e.waypoints;if(n.length<3)return[];const i=[],r=t.get(e.endpoints[0]??""),o=t.get(e.endpoints[1]??""),a=Dt(n[0].x,n[1].x)&&!Dt(n[0].y,n[1].y),s=Dt(n[n.length-1].x,n[n.length-2].x)&&!Dt(n[n.length-1].y,n[n.length-2].y);for(const c of lo){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 eh(e,t){const n=new Map(t.shapes.map(l=>[l.id,l])),i=ui(t),r=t.edges.filter(l=>l.id!==e.id),o=Pi(e,r);if(o===0)return null;const a=Ti(e,r);let s;const c=l=>l.reduce((f,p,d)=>d?f+Math.abs(p.x-l[d-1].x)+Math.abs(p.y-l[d-1].y):0,0),u=[...Xd(e,n),...wE(e,n)];for(const{pts:l,cost:f}of u){const p={...e,waypoints:l};if(Hn(p,i).length>0)continue;const d=Pi(p,r),h=Ti(p,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&&(f<s.cost||f===s.cost&&m<s.len)))&&(s={pts:l,opposite:d,cross:h,cost:f,len:m})}return(s==null?void 0:s.pts)??null}function th(e,t,n){const{elementRegistry:i}=e,r=e.modeling,o=Ot(i),a=Zi(o).filter(l=>(l.kind==="edge-overlap-opposite"||l.kind==="edge-overlap-mixed")&&!t.has(Xi(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 f of l.edges)n.has(f)||s.add(f);const c=l=>{var f;return((f=o.edges.find(p=>p.id===l))==null?void 0:f.type)??""},u=[...s].sort((l,f)=>{const p=c(l)==="bpmn:SequenceFlow"?0:1,d=c(f)==="bpmn:SequenceFlow"?0:1;return p!==d?p-d:l.localeCompare(f)});for(const l of u){const f=Ot(i),p=f.edges.find(m=>m.id===l);if(!p)continue;const d=eh(p,f);if(!d)continue;const h=i.get(l);h&&r.updateWaypoints(h,d)}}const EE=10,SE=(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 nh(e,t){const n=e.label;if(!n)return null;const i=t.edges.filter(a=>a.id!==e.id);if(!ls(e,i))return null;const r=ui(t),o=i.flatMap(hn);for(const a of hn(e)){let s=[[a.lo,a.hi]];for(const[d,h]of us(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,x])=>x>E)});const c=a.axis==="h"?n.width:n.height,u=s.find(([d,h])=>h-d>=c+EE*2);if(!u)continue;const l=(u[0]+u[1])/2,f=a.axis==="h"?{x:l,y:a.at-Td}:{x:a.at+Cn+n.width/2,y:l},p={x:f.x-n.width/2,y:f.y-n.height/2,width:n.width,height:n.height};if(!ls({...e,label:p},i)&&!r.some(d=>!e.endpoints.includes(d.id)&&SE(p,d)))return p}return null}const Cn=8;function ih(e,t){const n=e.label;if(!n)return null;const i=hn(e);if(!i.length)return null;const r=n.x+n.width/2,o=n.y+n.height/2,a=p=>{const d=p.axis==="h"?r:o,h=p.axis==="h"?o-p.at:r-p.at,m=d<p.lo?p.lo-d:d>p.hi?d-p.hi:0;return Math.hypot(h,m)},s=i.reduce((p,d)=>a(d)<a(p)?d:p,i[0]),c=[...i,...t.edges.filter(p=>p.id!==e.id).flatMap(hn),...t.shapes.filter(p=>p.container).flatMap(Yo)],u=p=>!c.some(d=>Ai(p,d));if(u(n))return null;const l=(s.axis==="v"?n.height:n.width)+Cn,f=[0,-l,l,-2*l,2*l];if(s.axis==="v")for(const p of[s.at+Cn,s.at-Cn-n.width])for(const d of f){const h=n.y+d;if(h<s.lo||h+n.height>s.hi)continue;const m={...n,x:p,y:h};if(u(m))return m}else for(const p of[s.at-Cn-n.height,s.at+Cn])for(const d of f){const h=n.x+d;if(h<s.lo||h+n.width>s.hi)continue;const m={...n,x:h,y:p};if(u(m))return m}return null}function rh(e,t){const{elementRegistry:n}=e,i=e.modeling,r=Ot(n);for(const o of r.edges){if(!o.label||t.has(o.id))continue;const a=ih(o,r);if(!a)continue;const s=n.get(o.id),c=s==null?void 0:s.label;c&&i.moveElements([c],{x:a.x-c.x,y:a.y-c.y})}}function oh(e,t,n){const{elementRegistry:i}=e,r=e.modeling,o=Ot(i),a=Zi(o).filter(s=>s.kind==="label-on-shared-segment"&&!t.has(Xi(s)));for(const s of a){if(s.kind!=="label-on-shared-segment"||n.has(s.edge))continue;const c=o.edges.find(p=>p.id===s.edge);if(!c)continue;const u=nh(c,o);if(!u)continue;const l=i.get(s.edge),f=l==null?void 0:l.label;f&&r.moveElements([f],{x:u.x-f.x,y:u.y-f.y})}}function ah(e,t){const n=e.label;if(!n)return null;const i=[...t.edges.flatMap(hn),...t.shapes.filter(p=>p.container).flatMap(Yo)],r=i.filter(p=>Ai(n,p));if(!r.length)return null;const o=t.shapes.filter(p=>!p.container&&p.id!==e.id),a=Ko(t).filter(p=>p.owner!==e.id).map(p=>p.rect),s=(p,d)=>p.x<d.x+d.width&&d.x<p.x+p.width&&p.y<d.y+d.height&&d.y<p.y+p.height,c=p=>!i.some(d=>Ai(p,d))&&!o.some(d=>s(p,d))&&!a.some(d=>s(p,d)),u=[];for(const p of r)p.axis==="h"?u.push({...n,y:p.at-Cn-n.height},{...n,y:p.at+Cn}):u.push({...n,x:p.at-Cn-n.width},{...n,x:p.at+Cn});const l=e.x+e.width/2,f=e.y+e.height/2;return u.push({...n,x:l-n.width/2,y:e.y+e.height+Cn},{...n,x:l-n.width/2,y:e.y-Cn-n.height},{...n,x:e.x+e.width+Cn,y:f-n.height/2},{...n,x:e.x-Cn-n.width,y:f-n.height/2}),u.find(c)??null}function sh(e,t){const{elementRegistry:n}=e,i=e.modeling,r=Ot(n);for(const o of r.shapes){if(o.container||!o.label||t.has(o.id))continue;const a=ah(o,Ot(n));if(!a)continue;const s=n.get(o.id),c=s==null?void 0:s.label;c&&i.moveElements([c],{x:a.x-c.x,y:a.y-c.y})}}const RE=/^[\p{L}_][\p{L}\p{N}_.\-]*$/u,ch=new Set(["sequenceFlow","messageFlow","dataAssociation","association"]),uh={"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}]},gs=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),Xu=e=>typeof e=="string"&&e!=="";function CE(e){const t=[];function n(i,r,o,a){if(a===null){Xu(o)||t.push({kind:"payload-invalid",opIndex:i,field:r});return}if(!gs(o)){t.push({kind:"payload-invalid",opIndex:i,field:r});return}for(const s of a)Xu(o[s])||t.push({kind:"payload-invalid",opIndex:i,field:`${r}.${s}`})}return e.forEach((i,r)=>{if(!gs(i)||!Xu(i.kind)||!(i.kind in uh)){t.push({kind:"payload-invalid",opIndex:r,field:"kind"});return}for(const o of uh[i.kind]){const a=o.path.endsWith("[]"),s=a?o.path.slice(0,-2):o.path,c=s.split(".");let u=i;for(const f of c.slice(0,-1)){if(!gs(u))break;u=u[f]}if(!gs(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((f,p)=>n(r,`${s}[${p}]`,f,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 lh(e,t){const n=CE(e);if(n.length>0)return n;const i=[],r=new Map,o=new Map;function a(p,d,h){if(!RE.test(d)){i.push({kind:"id-invalid",opIndex:p,id:d});return}if(t.categoryOf(d)!==void 0||r.has(d)){i.push({kind:"id-duplicate",opIndex:p,id:d});return}r.set(d,{...h,opIndex:p})}e.forEach((p,d)=>{var h;switch(p.kind){case"participant.add":a(d,p.participant.id,{category:"participant",lanes:(p.participant.lanes??[]).map(m=>m.id)});for(const m of p.participant.lanes??[])a(d,m.id,{category:"lane"});break;case"node.add":a(d,p.node.id,{category:"flowNode",participant:p.node.participant});break;case"sequenceFlow.add":a(d,p.flow.id,{category:"sequenceFlow"});break;case"messageFlow.add":a(d,p.flow.id,{category:"messageFlow"});break;case"dataStore.add":a(d,p.dataStore.id,{category:"dataStore"});for(const m of p.associations??[])m.id&&a(d,m.id,{category:"dataAssociation"});break;case"dataAssociation.add":p.association.id&&a(d,p.association.id,{category:"dataAssociation"});break;case"association.add":p.association.id&&a(d,p.association.id,{category:"association"});break;case"annotation.add":a(d,p.annotation.id,{category:"annotation"}),(h=p.association)!=null&&h.id&&a(d,p.association.id,{category:"association"});break;case"group.add":a(d,p.group.id,{category:"group"});break;case"participant.update":if(p.lanes){o.set(p.id,p.lanes.map(m=>m.id));for(const m of p.lanes)t.categoryOf(m.id)===void 0&&a(d,m.id,{category:"lane"})}break}});const s=p=>{var d;return((d=r.get(p))==null?void 0:d.category)??t.categoryOf(p)},c=p=>{const d=r.get(p);return d?d.category==="participant"?p:d.participant:t.categoryOf(p)==="participant"?p:t.participantOf(p)};function u(p,d,h,m){const g=s(d);if(g===void 0){i.push({kind:"ref-missing",opIndex:p,ref:d,role:h});return}if(m&&!m.includes(g)){i.push({kind:"ref-category",opIndex:p,ref:d,role:h,expected:m.join("|"),actual:g});return}return g}const l=t.isCollaboration()||e.some(p=>p.kind==="participant.add");return e.forEach((p,d)=>{var h;switch(p.kind){case"participant.add":break;case"node.add":{const{participant:m,lane:g}=p.node;if(m===void 0){(l||g!==void 0)&&i.push({kind:"participant-required",opIndex:d,id:p.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:x}=p.flow,w=u(d,g,"source",["flowNode"]),C=u(d,S,"target",["flowNode"]);w&&C&&c(g)!==c(S)&&i.push({kind:"flow-cross-pool",opIndex:d,id:m}),E!==void 0&&x!==void 0&&i.push({kind:"condition-name-conflict",opIndex:d,id:m});break}case"messageFlow.add":{const{id:m,source:g,target:S}=p.flow,E=u(d,g,"source",["flowNode","participant"]),x=u(d,S,"target",["flowNode","participant"]);if(E&&x){const w=c(g),C=c(S);w!==void 0&&w===C&&i.push({kind:"message-flow-same-pool",opIndex:d,id:m})}break}case"dataStore.add":{for(const m of p.associations??[]){if([m.source,m.target].filter(E=>E===p.dataStore.id).length!==1){i.push({kind:"data-association-ends",opIndex:d,source:m.source,target:m.target});continue}const S=m.source===p.dataStore.id?m.target:m.source;u(d,S,"dataAssociation",["flowNode"])}break}case"dataAssociation.add":{const{source:m,target:g}=p.association,S=u(d,m,"source"),E=u(d,g,"target");if(S&&E){const x=new Set([S,E]);x.has("dataStore")&&x.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}=p.association,E=u(d,g,"source"),x=u(d,S,"target");E&&x&&E!=="annotation"&&x!=="annotation"&&i.push({kind:"association-detached",opIndex:d,annotation:m??`${g}->${S}`});break}case"annotation.add":{if(p.association){const{source:m,target:g}=p.association;if(m!==p.annotation.id&&g!==p.annotation.id)i.push({kind:"association-detached",opIndex:d,annotation:p.annotation.id});else{const S=m===p.annotation.id?g:m;u(d,S,"association")}}p.placement&&u(d,p.placement.anchor,"anchor");break}case"group.add":{for(const m of p.group.members??[]){const g=u(d,m,"member");g&&ch.has(g)&&i.push({kind:"ref-category",opIndex:d,ref:m,role:"member",expected:"shape",actual:g})}break}case"participant.update":{if(f(d,p.id,"participant")===void 0)break;if(p.lanes){const m=t.lanesOf(p.id),g=p.lanes.map(E=>E.id);for(const E of m)g.includes(E)||i.push({kind:"lane-shrink-unsupported",opIndex:d,participant:p.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,x)=>E!==m[x])&&i.push({kind:"lane-reorder-unsupported",opIndex:d,participant:p.id})}break}case"node.update":{if(f(d,p.id,"flowNode")===void 0)break;if(p.lane!==void 0){const m=t.participantOf(p.id);(m?o.get(m)??t.lanesOf(m):[]).includes(p.lane)||i.push({kind:"lane-unknown",opIndex:d,lane:p.lane,participant:m??""})}break}case"sequenceFlow.update":{if(f(d,p.id,"sequenceFlow")===void 0)break;if(p.name!==void 0&&p.condition!==void 0&&i.push({kind:"condition-name-conflict",opIndex:d,id:p.id}),p.source!==void 0||p.target!==void 0){const m=p.source===void 0||u(d,p.source,"source",["flowNode"])!==void 0,g=p.target===void 0||u(d,p.target,"target",["flowNode"])!==void 0,S=t.endpointsOf(p.id),E=p.source??(S==null?void 0:S.source),x=p.target??(S==null?void 0:S.target);m&&g&&E!==void 0&&x!==void 0&&new Set([c(E),c(x),c(p.id)]).size>1&&i.push({kind:"flow-cross-pool",opIndex:d,id:p.id})}break}case"messageFlow.update":f(d,p.id,"messageFlow");break;case"dataStore.update":f(d,p.id,"dataStore");break;case"annotation.update":{if(f(d,p.id,"annotation")===void 0)break;p.placement&&u(d,p.placement.anchor,"anchor");break}case"group.update":{if(f(d,p.id,"group")===void 0)break;for(const m of p.members??[]){const g=u(d,m,"member");g&&ch.has(g)&&i.push({kind:"ref-category",opIndex:d,ref:m,role:"member",expected:"shape",actual:g})}break}case"element.remove":{f(d,p.id)==="lane"&&i.push({kind:"ref-category",opIndex:d,ref:p.id,role:"target",expected:"removable",actual:"lane"});break}}}),i;function f(p,d,h){if(r.has(d)){i.push({kind:"target-added-in-batch",opIndex:p,id:d});return}const m=t.categoryOf(d);if(m===void 0){i.push({kind:"ref-missing",opIndex:p,ref:d,role:"target"});return}if(h&&m!==h){i.push({kind:"ref-category",opIndex:p,ref:d,role:"target",expected:h,actual:m});return}return m}}function ph(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 ys(e){return`bpmn:${e[0].toUpperCase()}${e.slice(1)}`}const Zu={"top-left":[-1,-1],top:[0,-1],"top-right":[1,-1],right:[1,0],"bottom-right":[1,1],bottom:[0,1],"bottom-left":[-1,1],left:[-1,0]};function Xt(e,t){return e.filter(n=>n.kind===t)}function fh(e,t){var Ix,Nx,Bx,$x,jx,Fx,Hx,zx,Gx,Vx,Wx,Ux,qx,Yx,Kx,Xx;const{modeling:n,bpmnFactory:i,elementFactory:r,elementRegistry:o,canvas:a,autoPlace:s,bpmnReplace:c}=t,u=()=>a.getRootElement(),l=b=>o.get(b),f=b=>{const R=l(b);if(!R)throw new Error(`하강 참조 해소 실패: ${b}`);return R},p=b=>{let R=b.parent;for(;R;){if(R.type==="bpmn:Participant")return R;R=R.parent}},d=new Map;for(const b of o.filter(R=>!("waypoints"in R&&R.waypoints)&&R.type!=="bpmn:Lane"&&R.type!=="label"&&typeof R.x=="number"))d.set(b.id,{x:b.x,y:b.y});const h=Xt(e,"participant.add"),m=Xt(e,"node.add"),g=Xt(e,"sequenceFlow.add"),S=Xt(e,"messageFlow.add"),E=Xt(e,"dataStore.add"),x=Xt(e,"dataAssociation.add"),w=Xt(e,"annotation.add"),C=Xt(e,"group.add"),T=new Map(m.map(b=>[b.node.id,b])),B=(b,R,A)=>{var W;const I=b.businessObject,L=(((W=I.extensionElements)==null?void 0:W.values)??[]).filter(K=>K.$type!==R),O=A?[...L,i.create(R,A)]:L;if(!O.length){I.extensionElements&&n.updateProperties(b,{extensionElements:void 0});return}const q=i.create("bpmn:ExtensionElements",{values:O});O.forEach(K=>{K.$parent=q}),n.updateProperties(b,{extensionElements:q})},M=b=>({anchor:b.anchor,side:b.side,...b.offset!==void 0?{offset:b.offset}:{}});for(const b of Xt(e,"element.remove")){const R=l(b.id);R&&n.removeElements([R])}const z=b=>o.filter(R=>{var A;return R.type==="bpmn:Lane"&&((A=p(R))==null?void 0:A.id)===b}).sort((R,A)=>R.y-A.y);for(const b of Xt(e,"participant.update")){const R=f(b.id);if(b.name!==void 0&&n.updateProperties(R,{name:b.name??void 0}),!b.lanes)continue;const A=z(b.id);if(!A.length){n.splitLane(R,b.lanes.length),z(b.id).forEach((L,O)=>{const q=b.lanes[O];q&&n.updateProperties(L,{id:q.id,name:q.name})});continue}const I=new Set(A.map(L=>L.id));b.lanes.forEach((L,O)=>{if(I.has(L.id)){n.updateProperties(f(L.id),{name:L.name});return}const q=O===0?n.addLane(z(b.id)[0],"top"):n.addLane(f(b.lanes[O-1].id),"bottom");n.updateProperties(q,{id:L.id,name:L.name})})}const G=150,$=130,V=80,he=90,nt=180,gt=new Set;for(const b of h){gt.add(`pool:${b.participant.id}`);for(const R of b.participant.lanes??[])gt.add(R.id)}const J=new Map;for(const b of m){const R=b.node.lane??`pool:${b.node.participant??""}`;let A=J.get(R);A||J.set(R,A=new Set([0])),b.band!==void 0&&A.add(b.band)}const le=new Map;for(const[b,R]of J){if(!gt.has(b))continue;const A=[...R].sort((O,q)=>O-q),I=A.map((O,q)=>q===0?0:q%2===1?Math.ceil(q/2):-(q/2)),L=Math.min(...I);le.set(b,new Map(A.map((O,q)=>[O,I[q]-L])))}{const b=new Map;for(const R of h)(R.participant.lanes??[]).forEach((A,I)=>b.set(A.id,I));for(const[R,A]of le){if(!b.has(R)||A.size<2)continue;const I=b.get(R),L=A.get(0)??0,O=new Set;for(const de of m){if(de.node.lane!==R||(de.band??0)!==0||!de.node.type.endsWith("Gateway"))continue;const Re={in:new Set,out:new Set,cross:new Set};for(const me of g){const ve=me.flow.source===de.node.id;if(!ve&&me.flow.target!==de.node.id)continue;const ht=T.get(ve?me.flow.target:me.flow.source);if(!ht||ht.node.participant!==de.node.participant||!ht.node.lane)continue;let Te,Ye=!1;if(ht.node.lane!==R){const rt=b.get(ht.node.lane);if(rt===void 0)continue;Te=rt>I?"down":"up",Ye=!0}else{const rt=A.get(ht.band??0)??L;Te=rt>L?"down":rt<L?"up":void 0}Te&&(Re[ve?"out":"in"].add(Te),Ye&&Re.cross.add(Te))}for(const me of["up","down"])Re.in.has(me)&&Re.out.has(me)&&Re.cross.has(me)&&O.add(me)}if(O.size!==1)continue;const[q]=O,W=Math.max(...A.values()),K=q==="down"?W:0;if(L===K)continue;const _e=[...A.entries()].filter(([de])=>de!==0).sort((de,Re)=>de[1]-Re[1]),je=[...Array(W+1).keys()].filter(de=>de!==K),Ie=new Map([[0,K]]);_e.forEach(([de],Re)=>Ie.set(de,je[Re])),le.set(R,Ie)}}const Ee=b=>{var R;return(((R=J.get(b))==null?void 0:R.size)??0)>1},pe=b=>b.band??(b.node.lane||!Ee(`pool:${b.node.participant??""}`)?void 0:0),ge=new Map,re=b=>ge.get(b.node.id)??pe(b),H=new Set,F=new Set;{const b=new Map;for(const I of g)b.set(I.flow.target,(b.get(I.flow.target)??0)+1);const R=I=>{const L=[],O=new Set([I]),q=[I];for(;q.length;){const W=q.shift();L.push(W);for(const K of g)K.flow.source!==W||O.has(K.flow.target)||(b.get(K.flow.target)??0)!==1||(O.add(K.flow.target),q.push(K.flow.target))}return L},A=(I,L)=>{var O;return((O=le.get(I))==null?void 0:O.get(L))??L};for(const I of m){if(!I.node.type.endsWith("Gateway"))continue;const L=I.node.lane??`pool:${I.node.participant??""}`,O=le.get(L);if(!O||O.size<2)continue;const q=re(I);if(q===void 0||A(L,q)!==A(L,0))continue;const W=A(L,q),K=g.filter(me=>me.flow.source===I.node.id).map(me=>T.get(me.flow.target)).filter(me=>!!me&&(me.node.lane??`pool:${me.node.participant??""}`)===L),_e=K.filter(me=>{const ve=re(me);return ve!==void 0&&A(L,ve)===W&&(b.get(me.node.id)??0)===1}),je=K.some(me=>{const ve=re(me);return ve!==void 0&&A(L,ve)>W});if(_e.length!==1||!je)continue;const Ie=new Set(K.flatMap(me=>R(me.node.id)));if(!g.some(me=>me.flow.target===I.node.id&&Ie.has(me.flow.source)))continue;const Re=new Map;for(const[me,ve]of O)Re.set(me,ve+1);Re.set(-1,0),le.set(L,Re);for(const me of R(_e[0].node.id))T.has(me)&&(ge.set(me,-1),F.add(me));H.add(I.node.id)}}const Y=(b,R)=>{var A;return((A=le.get(b))==null?void 0:A.get(R))??R},Ne=new Map;for(const[b,R]of J){let A=0;for(const I of R)A=Math.max(A,Y(b,I));Ne.set(b,A)}const Kt=b=>nt+G*b,P=h.map((b,R)=>({op:b,declared:R}));P.sort((b,R)=>{const A=b.op.order??Number.POSITIVE_INFINITY,I=R.op.order??Number.POSITIVE_INFINITY;return A!==I?A-I:b.declared-R.declared});let _=80;for(const b of o.getAll())b.parent===u()&&"height"in b&&typeof b.y=="number"&&(_=Math.max(_,b.y+b.height+60));for(const{op:b}of P){const R=b.participant,A=m.filter(de=>de.node.participant===R.id).length,I=((Ix=R.lanes)==null?void 0:Ix.length)??0,L=Math.max(1200,A*160+300),O=(R.lanes??[]).map(de=>Kt(Ne.get(de.id)??0)),q=O.reduce((de,Re)=>de+Re,0);I&&q<300&&(O[I-1]+=300-q);const W=Math.max(300,G*((Ne.get(`pool:${R.id}`)??0)+1)),K=R.blackBox||A+I===0?120:I?Math.max(300,q):W,_e=r.createShape({type:"bpmn:Participant",businessObject:i.create("bpmn:Participant",{id:R.id,name:R.name,...b.order!==void 0?{"bwl:poolOrder":b.order}:{},...R.blackBox?{}:{processRef:i.create("bpmn:Process")}}),width:L,height:K,isExpanded:!0}),je=n.createShape(_e,{x:100+L/2,y:_+K/2},u()),Ie=R.lanes??[];if(Ie.length&&n.splitLane(je,Ie.length),Ie.length){const de=o.filter(Re=>{var me;return Re.type==="bpmn:Lane"&&((me=p(Re))==null?void 0:me.id)===R.id}).sort((Re,me)=>Re.y-me.y);if(de.forEach((Re,me)=>{const ve=Ie[me];ve&&n.updateProperties(Re,{id:ve.id,name:ve.name})}),O.some(Re=>Re!==je.height/I)){let Re=je.y;de.forEach((me,ve)=>{const ht=O[ve];n.resizeShape(me,{x:me.x,y:Re,width:me.width,height:ht}),Re+=ht})}}_=je.y+je.height+60}const y=b=>{var I;const R=T.get(b);if(R)return R.node.participant??"";const A=l(b);return A?A.type==="bpmn:Participant"?A.id:((I=p(A))==null?void 0:I.id)??"":""},D=new Map,j=b=>{let R=D.get(b);return R||D.set(b,R={nodes:[],flows:[]}),R};for(const b of m)j(b.node.participant??"").nodes.push(b);for(const b of g)j(y(b.flow.source)).flows.push(b);const U=b=>{var R;return i.create("bpmn:SequenceFlow",{id:b.id,name:b.name??((R=b.condition)==null?void 0:R.label)})},ue=(b,R)=>r.createShape({type:ys(b.type),businessObject:i.create(ys(b.type),{id:b.id,name:b.name,...R!==void 0?{"bwl:band":R}:{}})}),Be=[...P.map(({op:b})=>b.participant.id).filter(b=>D.has(b)),...[...D.keys()].filter(b=>!h.some(R=>R.participant.id===b))],et=b=>b.endsWith("Gateway");for(const b of Be){const R=D.get(b),A=b?f(b):void 0,I=A?A.x+150:250;let L=A?A.y+80:120;const O=(xe,Ge,Ue)=>{const qe=u().children.filter(ne=>!("waypoints"in ne&&ne.waypoints)&&ne.id!==Ge&&typeof ne.y=="number"&&ne.y>=xe);qe.length&&n.moveElements(qe,{x:0,y:Ue})},q=(xe,Ge)=>{if(xe){const ae=f(xe),X=Kt(Ge);if(ae.height>=X)return;const Ke=X-ae.height,te=p(ae),Se=te?te.y+te.height:ae.y+ae.height;n.resizeLane(ae,{x:ae.x,y:ae.y,width:ae.width,height:X},!1),O(Se,te==null?void 0:te.id,Ke);return}if(!A)return;const Ue=G*(Ge+1);if(A.height>=Ue)return;const qe=Ue-A.height,ne=A.y+A.height;n.resizeShape(A,{x:A.x,y:A.y,width:A.width,height:Ue}),O(ne,A.id,qe)},W=(xe,Ge,Ue)=>{if(xe){const qe=f(xe);return qe.y+Math.min(qe.height/2,he)+Y(xe,Ge??0)*G}return Ge!==void 0&&A?A.y+V+Y(`pool:${b}`,Ge)*G:Ue},K=(xe,Ge,Ue)=>{if(xe){const qe=f(xe);return qe.y+Math.min(qe.height/2,he)+Ge*G}return A?A.y+V+Ge*G:Ue},_e=xe=>xe.participant?f(xe.participant):u(),je=30,Ie=(xe,Ge,Ue,qe)=>{const ne=Ue-Ge.width/2,ae=qe-Ge.height/2;return(xe.children??[]).find(X=>!("waypoints"in X&&X.waypoints)&&X.type!=="bpmn:Lane"&&X.type!=="label"&&typeof X.x=="number"&&ne<X.x+X.width+je&&ne+Ge.width+je>X.x&&ae<X.y+X.height&&ae+Ge.height>X.y)},de=(xe,Ge,Ue,qe,ne,ae)=>{const X=Ue!==void 0||qe!==void 0,Ke=Y(Ue??`pool:${b}`,qe??0);if(X)for(let fe=0;fe<4;fe++){const we=K(Ue,Ke+fe,ae);if(!Ie(xe,Ge,ne,we))return q(Ue,Ke+fe),{x:ne,y:we}}const te=W(Ue,qe,ae);X&&q(Ue,Ke);let Se=ne;for(let fe=0;fe<64;fe++){const we=Ie(xe,Ge,Se,te);if(!we)break;Se=we.x+we.width+$+Ge.width/2}return{x:Se,y:te}},Re=new Set(R.flows.map(xe=>xe.flow.target)),me=new Map;for(const xe of R.nodes){if(Re.has(xe.node.id))continue;const Ge=ue(xe.node,xe.band),Ue=pe(xe),qe=xe.node.lane?`${xe.node.lane}|${Ue??""}`:Ue!==void 0?`band:${Ue}`:"",ne=_e(xe.node),ae=de(ne,Ge,xe.node.lane,Ue,me.get(qe)??I,L);n.createShape(Ge,ae,ne),me.set(qe,ae.x+Ge.width+$),!xe.node.lane&&Ue===void 0&&(L+=160)}const ve=new Set,ht=new Map,Te=new Map,Ye=new Map;if(b&>.has(`pool:${b}`)){const xe=new Map;for(const te of R.flows)xe.set(te.flow.target,(xe.get(te.flow.target)??0)+1);const Ge=te=>W(te.node.lane,re(te),Number.NaN),Ue=new Set,qe=te=>{var we;const Se=(we=T.get(te))==null?void 0:we.node.participant;if(Se)return l(Se);const fe=l(te);if(fe)return fe.type==="bpmn:Participant"?fe:p(fe)},ne=te=>{const Se=[],fe=new Set([te]),we=[te];for(;we.length;){const ct=we.shift(),Xe=T.get(ct);Xe&&Se.push(Xe);for(const Me of R.flows)Me.flow.source!==ct||fe.has(Me.flow.target)||(xe.get(Me.flow.target)??0)!==1||(fe.add(Me.flow.target),we.push(Me.flow.target))}return Se},ae=te=>{if(!A)return;const Se=new Set(te.map(ct=>ct.node.id));let fe=!1,we=!1;for(const ct of S){if(!Se.has(ct.flow.source))continue;const Xe=qe(ct.flow.target);!Xe||Xe.id===A.id||(Xe.y<A.y?fe=!0:we=!0)}return fe&&!we?"up":we&&!fe?"down":void 0};for(const te of R.nodes){if(!et(te.node.type))continue;const Se=W(te.node.lane,pe(te),Number.NaN);if(Number.isNaN(Se))continue;const fe=[];for(const Me of R.flows){if(Me.flow.source!==te.node.id)continue;const Ze=T.get(Me.flow.target);if(!Ze||Ze.node.lane!==te.node.lane||(xe.get(Ze.node.id)??0)!==1)continue;const at=pe(Ze);if(at===void 0)continue;const _n=W(Ze.node.lane,at,Number.NaN);if(Number.isNaN(_n))continue;const Jr=ne(Ze.node.id),Jt=ae(Jr);Jt&&fe.push({subtree:Jr,band:at,row:_n,dir:Jt})}if(!fe.some(Me=>Me.dir==="up")||!fe.some(Me=>Me.dir==="down")||!fe.some(Me=>Me.dir==="up"&&fe.some(Ze=>Ze.dir==="down"&&Ze.row<Me.row)))continue;const ct=[...fe].sort((Me,Ze)=>Me.row-Ze.row);[...fe.filter(Me=>Me.dir==="up"),...fe.filter(Me=>Me.dir==="down")].sort((Me,Ze)=>Me.dir===Ze.dir?Me.row-Ze.row:Me.dir==="up"?-1:1).forEach((Me,Ze)=>{const at=ct[Ze].band;if(at!==Me.band){Ue.add(te.node.id);for(const _n of Me.subtree)pe(_n)===Me.band&&ge.set(_n.node.id,at)}})}const X=te=>{if(!A)return;const Se=new Set(te.map(ct=>ct.node.id));let fe=!1,we=!1;for(const ct of S){if(!Se.has(ct.flow.target))continue;const Xe=qe(ct.flow.source);!Xe||Xe.id===A.id||(Xe.y<A.y?fe=!0:we=!0)}return fe&&!we?"up":we&&!fe?"down":void 0};for(const te of R.nodes){if(!et(te.node.type))continue;const Se=te.node.lane??`pool:${b}`,fe=le.get(Se);if(!fe||fe.size<2)continue;const we=fe.get(0);if(we===void 0)continue;const ct=Math.max(...fe.values()),Xe=we===ct&&we!==0?"down":void 0;if(!Xe)continue;const Me=[];for(const Jt of R.flows){if(Jt.flow.source!==te.node.id)continue;const ni=T.get(Jt.flow.target);if(!ni||ni.node.lane!==te.node.lane||(xe.get(ni.node.id)??0)!==1)continue;const Zx=re(ni);Zx!==void 0&&Me.push({t:ni,subtree:ne(ni.node.id),band:Zx})}const Ze=Me.find(Jt=>(fe.get(Jt.band)??Jt.band)===we);if(!Ze||X(Ze.subtree)===Xe||ae(Ze.subtree)===Xe)continue;const at=Me.find(Jt=>Jt!==Ze&&X(Jt.subtree)===Xe);if(!at)continue;const _n=Ze.band,Jr=at.band;for(const Jt of Ze.subtree)re(Jt)===_n&&ge.set(Jt.node.id,Jr);for(const Jt of at.subtree)re(Jt)===Jr&&ge.set(Jt.node.id,_n);Ue.add(te.node.id)}for(const te of R.nodes){if(!et(te.node.type))continue;const Se=Ge(te);if(Number.isNaN(Se)||w.some(Me=>{var Ze,at;return(((Ze=Me.placement)==null?void 0:Ze.anchor)??(Me.association?Me.association.source===Me.annotation.id?Me.association.target:Me.association.source:void 0))===te.node.id&&((at=Me.placement)==null?void 0:at.side.startsWith("bottom"))}))continue;let we,ct=!1,Xe;for(const Me of R.flows){if(Me.flow.source!==te.node.id)continue;const Ze=T.get(Me.flow.target);if(!Ze||!Ze.node.lane&&pe(Ze)===void 0)continue;const at=Ge(Ze);Number.isNaN(at)||(Math.abs(at-Se)<.5&&(ct=!0),at>Se?!we||at>we.row?we={id:Ze.node.id,row:at,count:1}:at===we.row&&we.count++:at<Se&&Ze.node.lane===te.node.lane&&(!Xe||at>Xe.row?Xe={op:Ze,row:at,count:1}:at===Xe.row&&Xe.count++))}we&&we.count===1&&(xe.get(we.id)??0)===1&&!Ue.has(te.node.id)&&ve.add(we.id),!ct&&Xe&&Xe.count===1&&(xe.get(Xe.op.node.id)??0)===1&&!H.has(te.node.id)&&ht.set(Xe.op.node.id,{lane:te.node.lane,band:re(te)})}const Ke=new Map;for(const te of S)Ke.set(te.flow.target,[...Ke.get(te.flow.target)??[],te]);for(const te of R.nodes){const Se=Ke.get(te.node.id);if(!Se||Se.length!==1||!xe.get(te.node.id)||!te.node.lane&&pe(te)===void 0||F.has(te.node.id))continue;const fe=(Nx=T.get(Se[0].flow.source))==null?void 0:Nx.node.participant,we=fe?l(fe):void 0;if(!we||!A||we.id===A.id)continue;const ct=te.node.lane??`pool:${b}`,Xe=le.get(ct);if(!Xe)continue;const Me=Xe.get(0)??0,Ze=(Xe.get(re(te)??0)??Me)-Me;if(Ze===0)continue;const at=we.y<A.y;if(at&&Ze<0||!at&&Ze>0)continue;let _n;for(const[Jr,Jt]of Xe){const ni=Jt-Me;(at&&ni<0&&(!_n||ni<_n.row)||!at&&ni>0&&(!_n||ni>_n.row))&&(_n={band:Jr,row:ni})}_n&&Te.set(te.node.id,{lane:te.node.lane,band:_n.band})}}const rt=new Set;let yt=0;for(;yt++<R.nodes.length+2;){for(let Ue=0;Ue<R.nodes.length+R.flows.length+2;Ue++){let qe=!1;for(const ne of R.flows){const ae=ne.flow;if(rt.has(ae.id))continue;const X=l(ae.source);if(!X)continue;const Ke=l(ae.target),te=T.get(ae.target);if(!Ke&&te){const Se=ue(te.node,te.band),fe=re(te);if(te.node.lane||fe!==void 0){const we=_e(te.node),ct=X,Xe=ct.x+(Ye.get(ae.source)??0)+ct.width+$,Me=ht.get(ae.target)??Te.get(ae.target),Ze=de(we,Se,Me?Me.lane:te.node.lane,Me?Me.band:fe,ve.has(ae.target)?ct.x+ct.width/2:Xe,Number.NaN),at=n.createShape(Se,Ze,we);ve.has(ae.target)&&Ye.set(ae.target,Xe-(at.x+at.width/2)),n.connect(X,at,{type:"bpmn:SequenceFlow",businessObject:U(ae)})}else s.append(X,Se,{connection:{type:"bpmn:SequenceFlow",businessObject:U(ae)}})}else if(Ke)n.connect(X,Ke,{type:"bpmn:SequenceFlow",businessObject:U(ae)});else continue;rt.add(ae.id),qe=!0}if(!qe)break}const xe=R.nodes.filter(Ue=>!l(Ue.node.id));if(!xe.length)break;const Ge=xe[0];{const Ue=ue(Ge.node,Ge.band),qe=_e(Ge.node),ne=pe(Ge);n.createShape(Ue,de(qe,Ue,Ge.node.lane,ne,I,L),qe),!Ge.node.lane&&ne===void 0&&(L+=160)}}}const At=40,it=(b,R=()=>!0)=>{const A=l(b);if(!A)return[];const I=[A],L=new Set([b]);for(let O=0;O<I.length;O++){const q=I[O].id;for(const W of g){const K=W.flow.target;if(W.flow.source!==q||L.has(K)||!T.has(K))continue;L.add(K);const _e=l(K);_e&&R(_e)&&I.push(_e)}}return I},Wt=(b,R=()=>!0)=>{const A=l(b);if(!A)return[];const I=[A],L=new Set([b]);for(let O=0;O<I.length;O++){const q=I[O].id;for(const W of g){const K=W.flow.source;if(W.flow.target!==q||L.has(K)||!T.has(K))continue;L.add(K);const _e=l(K);_e&&R(_e)&&I.push(_e)}}return I};for(const b of Xt(e,"sequenceFlow.update")){if(b.target===void 0)continue;const R=T.get(b.target);if(!R)continue;const A=l(b.target),I=l(b.id);if(!A||!I)continue;const L=b.source!==void 0?l(b.source):I.source,O=I.target;if(!L||!O||O.id===A.id)continue;const q=it(b.target),W=new Set(q.map(Re=>Re.id)),K=Math.min(...q.map(Re=>Re.x)),_e=Math.max(...q.map(Re=>Re.x+Re.width)),je=L.x+L.width,Ie=_e-K+At*2-(O.x-je);if(Ie>0){const Re=p(A),me=(Re==null?void 0:Re.children)??[],ve=Ye=>Ye.type==="bpmn:Lane",ht=me.filter(Ye=>!("waypoints"in Ye&&Ye.waypoints)&&!ve(Ye)&&!W.has(Ye.id)&&Ye.x>=O.x),Te=Re?[Re,...me.filter(Ye=>ve(Ye))]:[];ht.length&&n.createSpace(ht,Te,{x:Ie,y:0},"e",O.x-1)}const de=R.node.lane||R.band!==void 0?A.y+A.height/2:L.y+L.height/2;n.moveElements(q,{x:je+At-K,y:de-(A.y+A.height/2)})}const on=(b,R)=>{const A=R.target===b,I=f(R.source),L=f(R.target),O=A?"bpmn:DataOutputAssociation":"bpmn:DataInputAssociation";n.connect(I,L,R.id?{type:O,businessObject:i.create(O,{id:R.id})}:{type:O})},yn=100,dt=b=>{for(const R of h){if(!R.participant.blackBox)continue;const A=l(R.participant.id);if(!A)continue;const I=[];for(const O of S){const q=O.flow.source===R.participant.id?O.flow.target:O.flow.target===R.participant.id?O.flow.source:void 0,W=q?l(q):void 0;W&&typeof W.x=="number"&&W.type!=="bpmn:Participant"&&I.push(W)}if(!I.length)continue;const L=Math.max(...I.map(O=>O.x+O.width/2))+yn;if(L>A.x+A.width&&n.resizeShape(A,{x:A.x,y:A.y,width:L-A.x,height:A.height}),!!b)for(const O of S){const q=l(O.flow.id),W=O.flow.source===R.participant.id?O.flow.target:O.flow.target===R.participant.id?O.flow.source:void 0,K=W?l(W):void 0;if(!q||!K||K.type==="bpmn:Participant")continue;const _e=K.x+K.width/2;if(_e<A.x+10||_e>A.x+A.width-10)continue;const je=A.y>K.y,Ie=je?K.y+K.height:K.y,de=je?A.y:A.y+A.height,Re=O.flow.source===R.participant.id?[{x:_e,y:de},{x:_e,y:Ie}]:[{x:_e,y:Ie},{x:_e,y:de}],me=Ot(o),ve={...me.edges.find(ht=>ht.id===O.flow.id),waypoints:Re};Hn(ve,ui(me)).length||n.updateWaypoints(q,Re)}}};dt(!1);for(const b of S){const R=b.flow;n.connect(f(R.source),f(R.target),{type:"bpmn:MessageFlow",businessObject:i.create("bpmn:MessageFlow",{id:R.id,name:R.name})})}const Mt=20,Qt=30,Kr=4,ei=2,Si=[10,30,80],jn=b=>!("waypoints"in b&&b.waypoints)&&b.type!=="bpmn:Lane"&&b.type!=="label"&&typeof b.x=="number",xt=()=>{const b=Ot(o);return{bad:Zi(b).filter(R=>R.kind==="edge-crosses-shape"||R.kind==="edge-overlap-opposite"||R.kind==="edge-overlap-mixed").length,crossings:Dd(b),straight:b.edges.filter(R=>R.type==="bpmn:MessageFlow"&&R.waypoints.length===2).length}},ti=b=>{const R=Ot(o),A=R.edges.find(I=>I.id===b);return A?Hn(A,ui(R)).length:0},Xr=b=>ti(b)>0,vn=b=>Ot(o).edges.filter(R=>R.type==="bpmn:MessageFlow"&&R.id!==b&&R.waypoints.length===2).length,tt=(b,R)=>{const A=new Set(b.flatMap(O=>O.subtree.map(q=>q.id)));for(const O of b){const q=(O.pool.children??[]).filter(jn).filter(K=>!A.has(K.id));if(O.subtree.some(K=>q.some(_e=>K.x+R<_e.x+_e.width+Qt&&K.x+R+K.width+Qt>_e.x&&K.y<_e.y+_e.height&&K.y+K.height>_e.y)))return null}const I=b.map(O=>O.pool.width);n.moveElements(b.flatMap(O=>O.subtree),{x:R,y:0});const L=b.map(O=>{const W=Math.max(...O.subtree.map(K=>K.x+K.width))+150-(O.pool.x+O.pool.width);return W>0&&n.resizeShape(O.pool,{x:O.pool.x,y:O.pool.y,width:O.pool.width+W,height:O.pool.height}),W});return()=>{n.moveElements(b.flatMap(O=>O.subtree),{x:-R,y:0}),b.forEach((O,q)=>{L[q]>0&&n.resizeShape(O.pool,{x:O.pool.x,y:O.pool.y,width:I[q],height:O.pool.height})})}},ot=(b,R,A)=>tt([{subtree:b,pool:R}],A),wx=(b,R)=>R.bad>b.bad||R.crossings>b.crossings&&R.straight<=b.straight&&R.bad>=b.bad,wu=(b,R)=>wx(b,R)||R.straight<b.straight,Eu=(b,R,A=()=>!0,I=wx)=>{const L=xt(),O=tt(b,R);if(!O)return!1;const q=xt();return I(L,q)||!A()?(O(),!1):!0},Ex=(b,R,A,I=()=>!0)=>Eu([{subtree:b,pool:R}],A,I),Zr=b=>{var R;return!!((R=T.get(b))!=null&&R.node.participant)},Za=new Map;for(const b of S){if(!Zr(b.flow.target))continue;const R=Za.get(b.flow.target)??[];R.push(b),Za.set(b.flow.target,R)}const zf=[...Za.keys()],Sx=new Set(g.map(b=>b.flow.target)),Rx=b=>P.findIndex(({op:R})=>R.participant.id===b);zf.sort((b,R)=>{var L,O;const A=Sx.has(b)?1:0,I=Sx.has(R)?1:0;return A!==I?A-I:Rx((L=T.get(b))==null?void 0:L.node.participant)-Rx((O=T.get(R))==null?void 0:O.node.participant)});const Qr=b=>b.x+b.width/2,dD=b=>{const R=new Map;for(const L of o.getAll()){const O=L;if(!O.waypoints||!O.source||!O.target)continue;(R.get(O.source.id)??R.set(O.source.id,[]).get(O.source.id)).push(O.target.id)}const A=new Set([b]),I=[b];for(let L=0;L<I.length;L++)for(const O of R.get(I[L])??[])A.has(O)||(A.add(O),I.push(O));return A},hD=(b,R)=>{const A=dD(R);let I;for(const L of o.getAll()){const O=L;if(O.type!=="bpmn:MessageFlow"||!O.source||!O.target||O.target.id!==b||A.has(O.source.id))continue;const q=O.source;if(typeof q.x!="number"||q.type==="bpmn:Participant")continue;const W=Qr(q);(I===void 0||W>I)&&(I=W)}return I},Gf=(b,R)=>{const A=l(b.flow.source);if(A)return A.type==="bpmn:Participant"?hD(A.id,R):Qr(A)},Cx=b=>{let R;for(const A of Za.get(b)??[]){const I=Gf(A,b);I!==void 0&&(!R||I>R.cx)&&(R={op:A,cx:I})}return R==null?void 0:R.op},mD=b=>{const R=Cx(b),A=l(b),I=R?Gf(R,b):void 0;return A&&I!==void 0?I-Qr(A):void 0},gD=b=>{const R=mD(b);return R!==void 0&&Math.abs(R)<Mt},Px=(b,R,A,I,L)=>{var O;for(let q=!0;q;){q=!1;for(const W of S){if(W.flow.id===A)continue;const K=R.has(W.flow.source),_e=R.has(W.flow.target);if(K===_e||I(K?W.flow.source:W.flow.target))continue;const je=K?W.flow.target:W.flow.source;if(L(je)||!Zr(je))continue;const Ie=l(W.flow.id);if(!(Ie!=null&&Ie.waypoints)||Ie.waypoints.length!==2)continue;const de=l(je),Re=(O=T.get(je))==null?void 0:O.node.participant;if(!de||!Re)continue;const me=it(je,ve=>ve.x>=de.x).filter(ve=>!R.has(ve.id));if(!(!me.length||me.some(ve=>L(ve.id)))){for(const ve of me)R.add(ve.id);b.set(Re,[...b.get(Re)??[],...me]),q=!0}}}return[...b].map(([q,W])=>({subtree:W,pool:f(q)}))},Ax=(b,R,A,I,L)=>Px(new Map([[R,[...b]]]),new Set(b.map(O=>O.id)),I,O=>O===A,O=>O===L),Vf=b=>{const R=Cx(b);if(!R)return null;const A=l(b),I=l(R.flow.source),L=Gf(R,b);if(!A||!I||L===void 0)return null;const O=L-Qr(A);if(O>=Mt){const q=T.get(b).node.participant,W=it(b,K=>K.x>=A.x);return{groups:Ax(W,q,b,R.flow.id,R.flow.source),dx:O}}if(-O>=Mt&&Zr(R.flow.source)){const q=T.get(R.flow.source).node.participant,W=it(R.flow.source,K=>K.x>=I.x&&!gD(K.id));return{groups:Ax(W,q,R.flow.source,R.flow.id,b),dx:-O}}return null},Tx=()=>zf.map(b=>({id:b,plan:Vf(b)})).filter(b=>!!b.plan).sort((b,R)=>Math.min(...b.plan.groups.flatMap(A=>A.subtree.map(I=>I.x)))-Math.min(...R.plan.groups.flatMap(A=>A.subtree.map(I=>I.x)))).map(b=>b.id);for(let b=0;b<3;b++){const R=xt(),A=[];for(const L of Tx()){const O=Vf(L);if(!O)continue;const q=tt(O.groups,O.dx);q&&A.push(q)}if(!A.length)break;if(!wu(R,xt()))continue;for(const L of A.reverse())L();let I=!1;for(const L of Tx()){const O=Vf(L);O&&Eu(O.groups,O.dx,()=>!0,wu)&&(I=!0)}if(!I)break}for(const b of zf.flatMap(R=>Za.get(R)??[])){if(!Xr(b.flow.id))continue;const R=l(b.flow.target);if(!R)continue;const A=f(T.get(b.flow.target).node.participant),I=it(b.flow.target,W=>W.x>=R.x),L=R.width+$,O=ti(b.flow.id),q=vn(b.flow.id);for(let W=1;W<=Kr;W++){const K=()=>ti(b.flow.id)<O&&vn(b.flow.id)>=q;if(Ex(I,A,L*W,K))break}}for(const b of S){if(!Xr(b.flow.id))continue;const R=l(b.flow.source),A=l(b.flow.target);if(!R||!A||R.type==="bpmn:Participant"||A.type==="bpmn:Participant")continue;const I=R.x+R.width/2;if(Math.abs(I-(A.x+A.width/2))>15)continue;const[L,O]=R.y<A.y?[R.y+R.height,A.y]:[A.y+A.height,R.y],q=[...T.values()].map(W=>l(W.node.id)).filter(W=>!!W&&W.id!==R.id&&W.id!==A.id).filter(W=>W.x<=I&&I<=W.x+W.width&&W.y+W.height>L&&W.y<O).sort((W,K)=>W.x-K.x);for(const W of q){const K=(Bx=T.get(W.id))==null?void 0:Bx.node.participant,_e=K?l(K):void 0;if(!_e)continue;const je=[...T.values()].filter(rt=>rt.node.participant===K).map(rt=>rt.node.id),Ie=rt=>rt.map(yt=>l(yt)).filter(yt=>!!yt),Re=[Wt(W.id,rt=>{var yt;return((yt=T.get(rt.id))==null?void 0:yt.node.participant)===K}),Ie(je)].filter(rt=>rt.length),me=W.width+$,ve=ti(b.flow.id),ht=vn(b.flow.id),Te=()=>ti(b.flow.id)<ve&&vn(b.flow.id)>=ht;let Ye=!1;for(const rt of Re){for(let yt=1;yt<=Kr;yt++)if(Ex(rt,_e,me*yt,Te)){Ye=!0;break}if(Ye)break}if(!Xr(b.flow.id))break}}for(const b of S){if(!Xr(b.flow.id))continue;const R=l(b.flow.id);if((($x=R==null?void 0:R.waypoints)==null?void 0:$x.length)!==2)continue;const A=l(b.flow.source),I=l(b.flow.target);if(!A||!I||A.type==="bpmn:Participant"||I.type==="bpmn:Participant"||!Zr(b.flow.source)||!Zr(b.flow.target)||Math.abs(Qr(A)-Qr(I))>ei)continue;const L=Qr(A),O=R.waypoints.map(ve=>ve.y),[q,W]=[Math.min(...O),Math.max(...O)],K=ui(Ot(o)).filter(ve=>ve.id!==A.id&&ve.id!==I.id&&ve.x<L&&L<ve.x+ve.width&&q<ve.y+ve.height&&ve.y<W);if(!K.length)continue;const _e=(jx=T.get(b.flow.source))==null?void 0:jx.node.participant,je=(Fx=T.get(b.flow.target))==null?void 0:Fx.node.participant;if(!_e||!je)continue;const Ie=new Map;for(const[ve,ht,Te]of[[b.flow.source,A,_e],[b.flow.target,I,je]]){const Ye=Ie.get(Te)??[],rt=it(ve,yt=>yt.x>=ht.x).filter(yt=>!Ye.some(xe=>xe.id===yt.id));Ie.set(Te,[...Ye,...rt])}const de=new Set([...Ie.values()].flat().map(ve=>ve.id)),Re=Px(Ie,de,b.flow.id,ve=>ve===b.flow.source||ve===b.flow.target,()=>!1),me=Math.max(...K.map(ve=>ve.x+ve.width));for(const ve of Si){const ht=me+ve-L;if(ht<=0)continue;if(Eu(Re,ht,()=>{var Ye,rt;return ti(b.flow.id)===0&&((rt=(Ye=l(b.flow.id))==null?void 0:Ye.waypoints)==null?void 0:rt.length)===2},wu))break}}{const b=A=>A.y+A.height/2,R=[];for(const A of T.keys()){if(!Zr(A))continue;const I=g.filter(q=>q.flow.target===A);if(I.length!==1)continue;const L=l(I[0].flow.source),O=l(A);!L||!O||!T.has(L.id)||Math.abs(b(L)-b(O))>1||O.x-(L.x+L.width)<=$+1||R.push({id:A,pred:L,node:O})}R.sort((A,I)=>A.node.x-I.node.x);for(const{id:A}of R){const I=T.get(A),L=l(A),O=l(g.find(de=>de.flow.target===A).flow.source);if(!L||!O)continue;const q=L.x-(O.x+O.width);if(q<=$+1)continue;const W=f(I.node.participant),K=it(A,de=>de.x>=L.x),_e=xt(),je=ot(K,W,-(q-$));if(!je)continue;const Ie=xt();(Ie.bad>_e.bad||Ie.crossings>=_e.crossings||Ie.straight<_e.straight)&&je()}}dt(!0);for(const b of E){const R=b.associations??[],A=R.map(O=>O.source===b.dataStore.id?O.target:O.source).map(l).find(Boolean),I=A?p(A)??u():u(),L=A?{x:A.x+A.width/2,y:A.y+A.height+110}:{x:200,y:_+60};n.createShape({type:"bpmn:DataStoreReference",businessObject:i.create("bpmn:DataStoreReference",{id:b.dataStore.id,name:b.dataStore.name})},L,I);for(const O of R)on(b.dataStore.id,O)}for(const b of x){const A=f(b.association.target).type==="bpmn:DataStoreReference"?b.association.target:b.association.source;on(A,b.association)}let Mx=0;const Su=10,yD=(b,R)=>{for(const A of R.map(I=>p(I)).filter(I=>!!I)){const I=Su,L=A.y,O=A.y+A.height,q=A.x,W=A.x+A.width;if(Math.abs(b.y-L)<I){const K=L+I-b.y;b.y+=K,b.height-=K}if(Math.abs(b.y+b.height-O)<I&&(b.height=O-I-b.y),Math.abs(b.x-q)<I){const K=q+I-b.x;b.x+=K,b.width-=K}Math.abs(b.x+b.width-W)<I&&(b.width=W-I-b.x)}},vD=(b,R)=>{const A=Su,I=30,L=o.filter(O=>O.type==="bpmn:Group"&&O.id!==R);for(const O of L){const q=O.x,W=O.x+O.width,K=O.y,_e=O.y+O.height,je=b.y<_e&&K<b.y+b.height,Ie=b.x<W&&q<b.x+b.width;if(je){if(Math.abs(b.x-W)<A){const de=Math.min(W+A-b.x,I);de>0&&b.width-de>0&&(b.x+=de,b.width-=de)}if(Math.abs(b.x+b.width-q)<A){const de=Math.min(b.x+b.width-(q-A),I);de>0&&b.width-de>0&&(b.width-=de)}}if(Ie){if(Math.abs(b.y-_e)<A){const de=Math.min(_e+A-b.y,I);de>0&&b.height-de>0&&(b.y+=de,b.height-=de)}if(Math.abs(b.y+b.height-K)<A){const de=Math.min(b.y+b.height-(K-A),I);de>0&&b.height-de>0&&(b.height-=de)}}}},Wf=(b,R)=>{const I=Math.min(...b.map(K=>K.x))-40,L=Math.min(...b.map(K=>K.y))-40,O=Math.max(...b.map(K=>K.x+K.width))+40,q=Math.max(...b.map(K=>K.y+K.height))+40,W={x:I,y:L,width:O-I,height:q-L};return yD(W,b),vD(W,R),W};for(const b of C){const R=(b.group.members??[]).map(l).filter(L=>!!L);let A;R.length?A=Wf(R,b.group.id):(A={x:300+Mx*350,y:40,width:300,height:200},Mx++);const I=n.createShape({type:"bpmn:Group",businessObject:i.create("bpmn:Group",{id:b.group.id}),width:A.width,height:A.height},{x:A.x+A.width/2,y:A.y+A.height/2},u());b.group.name&&n.updateLabel(I,b.group.name),(Hx=b.group.members)!=null&&Hx.length&&B(I,"bwl:Members",{refs:b.group.members.join(" ")})}{const b=o.filter(L=>!!L.waypoints),R=new Map,A=(L,O)=>{!L||!O||(R.has(L)||R.set(L,new Set),R.get(L).add(O))};for(const L of b){const O=(zx=L.source)==null?void 0:zx.id,q=(Gx=L.target)==null?void 0:Gx.id;A(O,q),((Vx=L.type)!=null&&Vx.includes("DataOutputAssociation")||(Wx=L.type)!=null&&Wx.includes("DataInputAssociation")||L.type==="bpmn:Association")&&A(q,O)}const I=o.filter(L=>L.type==="bpmn:Group");for(const L of I){const q=(((Ux=L.businessObject.extensionElements)==null?void 0:Ux.values)??[]).find(Te=>Te.$type==="bwl:Members"),W=((q==null?void 0:q.refs)??"").split(" ").filter(Boolean);if(!W.length)continue;const K=new Set(W),_e=[...W];for(;_e.length;){const Te=_e.shift();for(const Ye of R.get(Te)??[])K.has(Ye)||(K.add(Ye),_e.push(Ye))}const je=L.x,Ie=L.x+L.width,de=L.y,Re=L.y+L.height,me=Te=>g.filter(Ye=>Ye.flow.target===Te).length,ve=Te=>{var rt;const Ye=((rt=l(Te))==null?void 0:rt.type)??"";if(Ye==="bpmn:StartEvent"&&me(Te)===0)return!1;if(Ye.endsWith("Gateway")){const yt=g.filter(xe=>xe.flow.target===Te).map(xe=>xe.flow.source);if(yt.length&&yt.every(xe=>{var Ge;return((Ge=l(xe))==null?void 0:Ge.type)==="bpmn:StartEvent"&&me(xe)===0}))return!1}return!0},ht=o.filter(Te=>jn(Te)).filter(Te=>Te.type!=="bpmn:Group"&&Te.type!=="bpmn:Participant"&&Te.type!=="bpmn:TextAnnotation"&&!K.has(Te.id)&&Zr(Te.id)&&ve(Te.id)&&Te.x<Ie&&Te.x+Te.width>je&&Te.y<Re&&Te.y+Te.height>de);if(ht.length)for(const Te of[-1,1]){const Ye=ht.filter(X=>(X.x+X.width-je<=Ie-X.x?-1:1)===Te);if(!Ye.length)continue;const rt=[];for(const X of Ye){const Ke=rt.find(te=>te.some(Se=>X.y<Se.y+Se.height&&X.y+X.height>Se.y));Ke?Ke.push(X):rt.push([X])}const yt=new Map;for(const X of rt){let Ke=Te<0?je-Su:Ie+Su;for(const te of[...X].sort((Se,fe)=>Te<0?fe.x-Se.x:Se.x-fe.x)){const Se=Te<0?Math.min(te.x,Ke-te.width):Math.max(te.x,Ke);Ke=Te<0?Se-Qt:Se+te.width+Qt,Se!==te.x&&Math.sign(Se-te.x)===Te&&yt.set(te.id,Se-te.x)}}const xe=new Map,Ge=X=>xe.get(X)===X||!xe.get(X)?X:Ge(xe.get(X));for(const X of Ye)xe.set(X.id,X.id);for(const X of S){const Ke=yt.has(X.flow.source)?X.flow.source:void 0,te=yt.has(X.flow.target)?X.flow.target:void 0;if(!Ke||!te)continue;const Se=l(X.flow.id);((qx=Se==null?void 0:Se.waypoints)==null?void 0:qx.length)===2&&xe.set(Ge(Ke),Ge(te))}const Ue=new Map;for(const X of Ye){if(!yt.has(X.id))continue;const Ke=Ge(X.id);Ue.set(Ke,[...Ue.get(Ke)??[],X])}const qe=[...Ue.values()].sort((X,Ke)=>Te<0?Math.min(...X.map(te=>te.x))-Math.min(...Ke.map(te=>te.x)):Math.max(...Ke.map(te=>te.x))-Math.max(...X.map(te=>te.x))),ne=[];let ae=!0;for(const X of qe){const Ke=X.map(fe=>yt.get(fe.id)??0).reduce((fe,we)=>Math.abs(we)>Math.abs(fe)?we:fe,0),te=new Map;let Se=!0;for(const fe of X){const we=p(fe);if(!we){Se=!1;break}te.has(we.id)||te.set(we.id,{subtree:[],pool:we}),te.get(we.id).subtree.push(fe)}Se&&Eu([...te.values()],Ke,()=>!0,wu)?ne.push({shapes:X,dx:Ke}):ae=!1}if(!ae)for(const X of ne.reverse())n.moveElements(X.shapes,{x:-X.dx,y:0})}}}{const b=new Set([...C.map(R=>R.group.id),...Xt(e,"group.update").map(R=>R.id)]);for(const R of o.filter(A=>A.type==="bpmn:Group")){if(b.has(R.id))continue;const I=(((Yx=R.businessObject.extensionElements)==null?void 0:Yx.values)??[]).find(W=>W.$type==="bwl:Members"),L=((I==null?void 0:I.refs)??"").split(" ").filter(Boolean).map(l).filter(W=>!!W);!L.length||!L.some(W=>{const K=d.get(W.id);return!K||K.x!==W.x||K.y!==W.y})||!L.some(W=>W.x<R.x||W.y<R.y||W.x+W.width>R.x+R.width||W.y+W.height>R.y+R.height)||n.resizeShape(R,Wf(L,R.id))}}const kx=b=>{const R=b.waypoints;if(R!=null&&R.length){const I=R[Math.floor((R.length-1)/2)];return{x:I.x,y:I.y,width:0,height:0}}const A=b;return{x:A.x,y:A.y,width:A.width,height:A.height}},Ox=(b,R,A,I)=>{const L=R,O=(ne,ae)=>{const[X,Ke]=Zu[ne];let te={x:b.x+b.width/2+X*(b.width/2+L.width/2+ae),y:b.y+b.height/2+Ke*(b.height/2+L.height/2+ae)};const Se=A.x+an+L.width/2,fe=A.x+A.width-an-L.width/2,we=A.y+an+L.height/2,ct=A.y+A.height-an-L.height/2,Xe={x:Math.min(fe,Math.max(Se,te.x)),y:Math.min(ct,Math.max(we,te.y))};return(Xe.x!==te.x||Xe.y!==te.y)&&(te=Math.abs(Xe.x-(b.x+b.width/2))<(b.width+L.width)/2+an&&Math.abs(Xe.y-(b.y+b.height/2))<(b.height+L.height)/2+an?{x:b.x+b.width+an+L.width/2,y:Xe.y}:Xe),te},q=(A.children??[]).filter(ne=>!("waypoints"in ne&&ne.waypoints)&&ne.type!=="bpmn:Lane"&&ne.type!=="label"&&typeof ne.x=="number"&&ne.id!==I.selfId),W=Ot(o),K=ne=>{var X,Ke;if(!I.selfId)return!1;const ae=o.get(ne);return!!ae&&(((X=ae.source)==null?void 0:X.id)===I.selfId||((Ke=ae.target)==null?void 0:Ke.id)===I.selfId)},_e=W.edges.filter(ne=>!K(ne.id)).flatMap(hn),je=Ko(W).filter(ne=>ne.owner!==I.selfId).map(ne=>ne.rect),Ie=ne=>({x0:ne.x-L.width/2-an,x1:ne.x+L.width/2+an,y0:ne.y-L.height/2-an,y1:ne.y+L.height/2+an}),de=ne=>{const ae=Ie(ne);return q.some(X=>ae.x0<X.x+X.width&&ae.x1>X.x&&ae.y0<X.y+X.height&&ae.y1>X.y)},Re=ne=>{const ae=Ie(ne);return _e.some(X=>X.axis==="h"?X.at>ae.y0&&X.at<ae.y1&&X.lo<ae.x1&&X.hi>ae.x0:X.at>ae.x0&&X.at<ae.x1&&X.lo<ae.y1&&X.hi>ae.y0)},me=ne=>{const ae=Ie(ne);return je.some(X=>ae.x0<X.x+X.width&&ae.x1>X.x&&ae.y0<X.y+X.height&&ae.y1>X.y)},ve=W.shapes.filter(ne=>ne.type==="bpmn:Group").flatMap(ne=>[{axis:"h",at:ne.y,lo:ne.x,hi:ne.x+ne.width},{axis:"h",at:ne.y+ne.height,lo:ne.x,hi:ne.x+ne.width},{axis:"v",at:ne.x,lo:ne.y,hi:ne.y+ne.height},{axis:"v",at:ne.x+ne.width,lo:ne.y,hi:ne.y+ne.height}]),ht=ne=>{const ae=Ie(ne);return ve.some(X=>X.axis==="h"?X.at>ae.y0&&X.at<ae.y1&&X.lo<ae.x1&&X.hi>ae.x0:X.at>ae.x0&&X.at<ae.x1&&X.lo<ae.y1&&X.hi>ae.y0)},Te=ne=>de(ne)||Re(ne)||me(ne)||ht(ne),Ye=ne=>ne.x-L.width/2>=A.x&&ne.x+L.width/2<=A.x+A.width&&ne.y-L.height/2>=A.y&&ne.y+L.height/2<=A.y+A.height;if(I.placement){const ne=fe=>fe.startsWith("top")?fe.replace(/^top/,"bottom"):fe.replace(/^bottom/,"top"),ae=fe=>fe.endsWith("left")?fe.replace(/left$/,"right"):fe.replace(/right$/,"left"),X=I.placement.side,Ke=[X,ne(X),ae(X),ne(ae(X)),"top","bottom","left","right","top-left","top-right","bottom-left","bottom-right"],te=I.placement.offset??50;let Se=O(X,te);if(Te(Se)){const fe=new Set;for(const we of Ke){if(fe.has(we))continue;fe.add(we);const ct=O(we,te);if(Ye(ct)&&!Te(ct)){Se=ct;break}}}return Se}const rt=I.from,yt=A.x+an+L.width/2,xe=A.x+A.width-an-L.width/2,Ge=A.y+an+L.height/2,Ue=A.y+A.height-an-L.height/2;let qe={x:Math.min(xe,Math.max(yt,rt.x)),y:Math.min(Ue,Math.max(Ge,rt.y))};if(Te(qe)){const ne=(b.width+L.width)/2+an,X=[{x:qe.x+ne,y:qe.y},{x:qe.x-ne,y:qe.y},{x:qe.x,y:qe.y-L.height-an},{x:qe.x,y:qe.y+L.height+an}].filter(Ye).find(Ke=>!Te(Ke));X&&(qe=X)}return qe};let Qa=0;const Dx=12,Lx=14,_D=15,bD=300,xD=b=>{const R=b.split(`
|
|
7
|
-
`),A=Math.max(...R.map(O=>co(O,Dx))),I=Math.max(100,Math.min(bD,Math.ceil(A)+Lx)),L=R.reduce((O,q)=>O+Math.max(1,Math.ceil((co(q,Dx)+Lx)/I)),0);return{width:I,height:Math.max(30,L*_D+10)}},an=10;for(const b of w){const R=b.association,A=((Kx=b.placement)==null?void 0:Kx.anchor)??(R?R.source===b.annotation.id?R.target:R.source:void 0),I=A?l(A):void 0,L=I?kx(I):void 0,O=xD(b.annotation.text??"");let q;if(L&&b.placement){const[je,Ie]=Zu[b.placement.side],de=b.placement.offset??50;q={x:L.x+L.width/2+je*(L.width/2+O.width/2+de),y:L.y+L.height/2+Ie*(L.height/2+O.height/2+de)}}else L?(q={x:L.x+L.width/2+180+Qa%3*260,y:L.y-110-Qa%2*95},Qa++):(q={x:300+Qa*260,y:60},Qa++);const W=I?p(I)??u():u(),K=W;L&&typeof K.x=="number"&&typeof K.width=="number"&&K.type==="bpmn:Participant"&&(q=Ox(L,O,K,b.placement?{placement:b.placement}:{from:q}));const _e=n.createShape({type:"bpmn:TextAnnotation",width:O.width,height:O.height,businessObject:i.create("bpmn:TextAnnotation",{id:b.annotation.id,text:b.annotation.text})},q,W);if(R){const je=Ie=>Ie===b.annotation.id?_e:f(Ie);n.connect(je(R.source),je(R.target),R.id?{type:"bpmn:Association",businessObject:i.create("bpmn:Association",{id:R.id})}:{type:"bpmn:Association"})}b.placement&&B(_e,"bwl:Placement",M(b.placement))}for(const b of Xt(e,"association.add")){const R=b.association;n.connect(f(R.source),f(R.target),R.id?{type:"bpmn:Association",businessObject:i.create("bpmn:Association",{id:R.id})}:{type:"bpmn:Association"})}for(const b of Xt(e,"node.update")){let R=f(b.id);if(b.type&&ys(b.type)!==R.type&&(R=c.replaceElement(R,{type:ys(b.type)})),b.name!==void 0&&n.updateProperties(R,{name:b.name??void 0}),b.lane){const A=f(b.lane),I=A.y+A.height/2-(R.y+R.height/2);I!==0&&n.moveElements([R],{x:0,y:I})}}for(const b of Xt(e,"sequenceFlow.update")){const R=f(b.id);if(b.source!==void 0||b.target!==void 0){const A=R,I=b.source!==void 0?f(b.source):A.source,L=b.target!==void 0?f(b.target):A.target,O=q=>({x:q.x+q.width/2,y:q.y+q.height/2});n.reconnect(A,I,L,[O(I),O(L)])}b.name!==void 0&&n.updateProperties(R,{name:b.name??void 0}),b.condition!==void 0&&n.updateProperties(R,{name:((Xx=b.condition)==null?void 0:Xx.label)??void 0})}for(const b of Xt(e,"messageFlow.update"))b.name!==void 0&&n.updateProperties(f(b.id),{name:b.name??void 0});for(const b of Xt(e,"dataStore.update"))b.name!==void 0&&n.updateProperties(f(b.id),{name:b.name??void 0});for(const b of Xt(e,"annotation.update")){const R=f(b.id);if(b.text!==void 0&&n.updateProperties(R,{text:b.text}),b.placement===null)B(R,"bwl:Placement",null);else if(b.placement){const A=f(b.placement.anchor),I=kx(A),L=p(A)??u(),O=typeof L.x=="number"&&typeof L.width=="number"&&L.type==="bpmn:Participant",[q,W]=Zu[b.placement.side],K=b.placement.offset??50,_e={x:I.x+I.width/2+q*(I.width/2+R.width/2+K),y:I.y+I.height/2+W*(I.height/2+R.height/2+K)},je=O?Ox(I,{width:R.width,height:R.height},L,{placement:b.placement,selfId:b.id}):_e;n.moveElements([R],{x:je.x-(R.x+R.width/2),y:je.y-(R.y+R.height/2)}),B(R,"bwl:Placement",M(b.placement))}}for(const b of Xt(e,"group.update")){const R=f(b.id);if(b.name!==void 0&&n.updateLabel(R,b.name??""),b.members){const A=b.members.map(l).filter(I=>!!I);A.length&&n.resizeShape(R,Wf(A,b.id)),B(R,"bwl:Members",{refs:b.members.join(" ")})}}}function dh(e,t,n=fh){const i=ph(e),r=lh(t,Fd(i.elementRegistry)),o={edgeCrossings:{before:0,after:0,pairs:[]}};if(r.length)return{ok:!1,issues:r,findings:[],stats:o};const a=Ot(i.elementRegistry),s=new Set(Zi(a).map(Xi)),c=new Set(a.edges.map(m=>m.id)),u=new Set(a.shapes.map(m=>m.id)),l=Yu(a).length,f=e.get("commandStack");try{Xf(f,()=>{n(t,i),Kd(i,c),Ud(i,s),th(i,s,c),Jd(i,c),xE(i,c),oh(i,s,c),rh(i,c),sh(i,u)})}catch(m){return{ok:!1,issues:[{kind:"lower-failed",message:m instanceof Error?m.message:String(m)}],findings:[],stats:o}}const p=Ot(i.elementRegistry),d=Zi(p).filter(m=>!s.has(Xi(m))),h=Yu(p);return{ok:!0,issues:[],findings:d,stats:{edgeCrossings:{before:l,after:h.length,pairs:h}}}}function PE(e){const t=e.slice(e.indexOf(":")+1);return t.charAt(0).toLowerCase()+t.slice(1)}function AE(e,t){return typeof e.get=="function"?e.get(t):e[t]}function hh(e,t){const n=AE(e,t);return typeof n=="number"&&Number.isFinite(n)?n:void 0}function mh(e,t){var i;return(((i=e.extensionElements)==null?void 0:i.values)??[]).find(r=>(r==null?void 0:r.$type)===t)}function TE(e){return typeof e=="string"&&Cu.includes(e)}function li(e){if(typeof e=="string")return e;const t=e==null?void 0:e.id;return typeof t=="string"?t:void 0}function gh(e){const t=e.rootElements??[],n=t.find(J=>J.$type==="bpmn:Collaboration"),i=new Map(t.filter(J=>J.$type==="bpmn:Process").map(J=>[J.id,J])),r=[],o=[],a=[],s=[],c=[],u=[],l={poolOrders:{},bands:{},placements:{}},f=[],p=[],d=[],h=[],m=[],g=[],S=new Set,E=new Set,x=J=>{J&&S.add(J)},w=J=>{S.add(J),E.add(J)},C=J=>{const le=mh(J,"bwl:Placement");if(!le)return;const Ee=typeof le.anchor=="string"?le.anchor:void 0;if(!Ee||!TE(le.side))return;const pe=typeof le.offset=="number"?le.offset:void 0;m.push({owner:J.id,anchor:Ee,side:le.side,...pe!==void 0?{offset:pe}:{}})},T=J=>{const le=mh(J,"bwl:Members"),Ee=typeof(le==null?void 0:le.refs)=="string"?le.refs.split(/\s+/).filter(Boolean):[];Ee.length&&g.push({owner:J.id,refs:Ee})},B=J=>{var le;for(const Ee of J)switch(x(Ee.id),Ee.$type){case"bpmn:TextAnnotation":w(Ee.id),s.push({id:Ee.id,text:typeof Ee.text=="string"?Ee.text:""}),C(Ee);break;case"bpmn:Association":d.push({id:Ee.id,type:Ee.$type,source:li(Ee.sourceRef),target:li(Ee.targetRef)});break;case"bpmn:Group":{w(Ee.id);const pe=(le=Ee.categoryValueRef)==null?void 0:le.value;c.push({id:Ee.id,...typeof pe=="string"&&pe?{name:pe}:{}}),T(Ee);break}default:u.push({id:Ee.id,type:Ee.$type,reason:"type-outside-mvp"})}},M=(J,le)=>{const Ee=J.flowElements??[],pe=(J.laneSets??[]).flatMap(re=>re.lanes??[]),ge=new Map;for(const re of pe){x(re.id);for(const H of re.flowNodeRef??[]){const F=li(H);F&&ge.set(F,re.id)}}for(const re of Ee){if(x(re.id),re.$type==="bpmn:SequenceFlow"){f.push({id:re.id,source:li(re.sourceRef),target:li(re.targetRef),...typeof re.name=="string"&&re.name?{name:re.name}:{}});continue}if(re.$type==="bpmn:DataStoreReference"){w(re.id),a.push({id:re.id,...re.name?{name:re.name}:{}});continue}const H=PE(re.$type);if(!Uf(H)){u.push({id:re.id,type:re.$type,reason:"type-outside-mvp"});continue}w(re.id),o.push({id:re.id,type:H,...re.name?{name:re.name}:{},...le?{participant:le}:{},...ge.has(re.id)?{lane:ge.get(re.id)}:{}});const F=hh(re,"bwl:band");F!==void 0&&(l.bands[re.id]=F);for(const Y of re.dataOutputAssociations??[])x(Y.id),h.push({id:Y.id,type:Y.$type,source:re.id,target:li(Y.targetRef)});for(const Y of re.dataInputAssociations??[])x(Y.id),h.push({id:Y.id,type:Y.$type,source:li((Y.sourceRef??[])[0]),target:re.id})}B(J.artifacts??[])};if(n){const J=new Set;for(const le of n.participants??[]){w(le.id);const Ee=li(le.processRef);Ee&&J.add(Ee);const pe=Ee?i.get(Ee):void 0,ge=((pe==null?void 0:pe.laneSets)??[]).flatMap(Y=>Y.lanes??[]),re=ge.map(Y=>({id:Y.id,...Y.name?{name:Y.name}:{}}));for(const Y of re)w(Y.id);const H=!pe||(pe.flowElements??[]).length===0&&ge.length===0&&(pe.artifacts??[]).length===0;r.push({id:le.id,...le.name?{name:le.name}:{},...H?{blackBox:!0}:{},...re.length?{lanes:re}:{}});const F=hh(le,"bwl:poolOrder");F!==void 0&&(l.poolOrders[le.id]=F),pe&&M(pe,le.id)}for(const le of n.messageFlows??[])x(le.id),p.push({id:le.id,source:li(le.sourceRef),target:li(le.targetRef),...typeof le.name=="string"&&le.name?{name:le.name}:{}});B(n.artifacts??[]);for(const[le,Ee]of i)!J.has(le)&&(Ee.flowElements??[]).length>0&&u.push({id:le,type:Ee.$type,reason:"unreachable-process"})}else for(const J of i.values())M(J);const z=[],G=[],$=[],V=[],he=(J,le)=>!!J&&!!le&&E.has(J)&&E.has(le);for(const J of f){if(!he(J.source,J.target)){u.push({id:J.id,type:"bpmn:SequenceFlow",reason:"endpoint-outside-mvp"});continue}z.push({id:J.id,source:J.source,target:J.target,...J.name?{name:J.name}:{}}),E.add(J.id)}for(const J of p){if(!he(J.source,J.target)){u.push({id:J.id,type:"bpmn:MessageFlow",reason:"endpoint-outside-mvp"});continue}G.push({id:J.id,source:J.source,target:J.target,...J.name?{name:J.name}:{}}),E.add(J.id)}for(const J of h){if(!he(J.source,J.target)){u.push({id:J.id??"",type:J.type,reason:"endpoint-outside-mvp"});continue}V.push({...J.id?{id:J.id}:{},source:J.source,target:J.target}),J.id&&E.add(J.id)}for(const J of d){if(!he(J.source,J.target)){u.push({id:J.id??"",type:J.type,reason:"endpoint-outside-mvp"});continue}$.push({...J.id?{id:J.id}:{},source:J.source,target:J.target})}const nt=new Map(c.map(J=>[J.id,J]));for(const{owner:J,refs:le}of g){const Ee=le.filter(ge=>S.has(ge)),pe=nt.get(J);pe&&Ee.length&&(pe.members=Ee)}for(const J of m)S.has(J.anchor)&&(l.placements[J.owner]={anchor:J.anchor,side:J.side,...J.offset!==void 0?{offset:J.offset}:{}});return{definition:{...r.length?{participants:r}:{},nodes:o,sequenceFlows:z,...G.length?{messageFlows:G}:{},...a.length?{dataStores:a}:{},...V.length?{dataAssociations:V}:{},...s.length?{annotations:s}:{},...$.length?{associations:$}:{},...c.length?{groups:c}:{}},hints:l,omitted:u}}async function ME(e){const{definitions:t,warnings:n}=await Gu(e);return{...gh(t),warnings:n}}function kE(e,t,n,i={}){return{documentId:e,baseVersion:t,ops:[...n],origin:i.origin??"agent",clientOpId:(i.mkClientOpId??(()=>crypto.randomUUID()))()}}async function yh(e,t,{currentVersion:n}){if(t.baseVersion!==n)return{status:"conflict",baseVersion:t.baseVersion,currentVersion:n};const i=dh(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 OE=Symbol("bpmn-editor");function DE(){const e=kt.ref(!1),t=kt.ref(!0),n=kt.ref(!1);let i,r;const o=()=>{e.value=!0};function a(u,l){u.get("canvas").getContainer().style.pointerEvents=l?"":"none";const f=u.get("keyboard");l?(r&&f.bind(r),r=void 0):r||(r=f.getBinding(),f.unbind())}function s(){if(!i)throw new Error("modeler not attached — 뷰 @ready 후 attach() 필요");return i}function c(){return i==null?void 0:i.get("commandStack")}return{dirty:e,editable:t,agentBusy:n,attach(u){i&&this.detach(),i=u,i.get("eventBus").on("commandStack.changed",o),t.value||a(i,!1)},detach(){i==null||i.get("eventBus").off("commandStack.changed",o),i&&!t.value&&a(i,!0),r=void 0,i=void 0},setEditable(u){t.value=u,i&&a(i,u)},async applyAgentBatch(u,l){const f=s();n.value=!0;try{const p=await yh(f,u,{currentVersion:l});return p.status==="applied"&&(e.value=!1),p}finally{n.value=!1}},async importXml(u){const{warnings:l}=await s().importXML(u);return e.value=!1,{warnings:Vu(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 se(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}function LE(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Qu={exports:{}},vh;function IE(){if(vh)return Qu.exports;vh=1;var e=Qu.exports=function(t,n){if(n||(n=16),t===void 0&&(t=128),t<=0)return"0";for(var i=Math.log(Math.pow(2,t))/Math.log(n),r=2;i===1/0;r*=2)i=Math.log(Math.pow(2,t/r))/Math.log(n)*r;for(var o=i-Math.floor(i),a="",r=0;r<Math.floor(i);r++){var s=Math.floor(Math.random()*n).toString(n);a=s+a}if(o){var c=Math.pow(n,o),s=Math.floor(Math.random()*c).toString(n);a=s+a}var 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},Qu.exports}var NE=IE(),BE=LE(NE);function pi(e){if(!(this instanceof pi))return new pi(e);e=e||[128,36,1],this._seed=e.length?BE.rack(e[0],e[1],e[2]):e}pi.prototype.next=function(e){return this._seed(e||!0)},pi.prototype.nextPrefixed=function(e,t){var n;do n=e+this.next(!0);while(this.assigned(n));return this.claim(n,t),n},pi.prototype.claim=function(e,t){this._seed.set(e,t||!0)},pi.prototype.assigned=function(e){return this._seed.get(e)||!1},pi.prototype.unclaim=function(e){delete this._seed.hats[e]},pi.prototype.clear=function(){var e=this._seed.hats,t;for(t in e)this.unclaim(t)};const Ht={legend:[1,"<fieldset>","</fieldset>"],tr:[2,"<table><tbody>","</tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],_default:[0,"",""]};Ht.td=Ht.th=[3,"<table><tbody><tr>","</tr></tbody></table>"],Ht.option=Ht.optgroup=[1,'<select multiple="multiple">',"</select>"],Ht.thead=Ht.tbody=Ht.colgroup=Ht.caption=Ht.tfoot=[1,"<table>","</table>"],Ht.polyline=Ht.ellipse=Ht.polygon=Ht.circle=Ht.text=Ht.line=Ht.path=Ht.rect=Ht.g=[1,'<svg xmlns="http://www.w3.org/2000/svg" version="1.1">',"</svg>"];function mt(e,t=globalThis.document){var u;if(typeof e!="string")throw new TypeError("String expected");const n=/^<!--(.*?)-->$/s.exec(e);if(n)return t.createComment(n[1]);const i=(u=/<([\w:]+)/.exec(e))==null?void 0:u[1];if(!i)return t.createTextNode(e);if(e=e.trim(),i==="body"){const l=t.createElement("html");l.innerHTML=e;const{lastChild:f}=l;return f.remove(),f}let[r,o,a]=Object.hasOwn(Ht,i)?Ht[i]:Ht._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 $E(e,t){return t.forEach(function(n){n&&typeof n!="string"&&!Array.isArray(n)&&Object.keys(n).forEach(function(i){if(i!=="default"&&!(i in e)){var r=Object.getOwnPropertyDescriptor(n,i);Object.defineProperty(e,i,r.get?r:{enumerable:!0,get:function(){return n[i]}})}})}),Object.freeze(e)}function mn(e,...t){const n=e.style;return k(t,function(i){i&&k(i,function(r,o){n[o]=r})}),e}function ln(e,t,n){return arguments.length==2?e.getAttribute(t):n===null?e.removeAttribute(t):(e.setAttribute(t,n),e)}const jE=Object.prototype.toString;function bt(e){return new Qi(e)}function Qi(e){if(!e||!e.nodeType)throw new Error("A DOM element reference is required");this.el=e,this.list=e.classList}Qi.prototype.add=function(e){return this.list.add(e),this},Qi.prototype.remove=function(e){return jE.call(e)=="[object RegExp]"?this.removeMatching(e):(this.list.remove(e),this)},Qi.prototype.removeMatching=function(e){const t=this.array();for(let n=0;n<t.length;n++)e.test(t[n])&&this.remove(t[n]);return this},Qi.prototype.toggle=function(e,t){return typeof t<"u"?t!==this.list.toggle(e,t)&&this.list.toggle(e):this.list.toggle(e),this},Qi.prototype.array=function(){return Array.from(this.list)},Qi.prototype.has=Qi.prototype.contains=function(e){return this.list.contains(e)};function vs(e){for(var t;t=e.firstChild;)e.removeChild(t);return e}function Or(e,t,n){var i=n?e:e.parentNode;return i&&typeof i.closest=="function"&&i.closest(t)||null}function FE(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var _s={},_h;function HE(){if(_h)return _s;_h=1;var e,t,n;function i(){e=window.addEventListener?"addEventListener":"attachEvent",t=window.removeEventListener?"removeEventListener":"detachEvent",n=e!=="addEventListener"?"on":""}return _s.bind=function(r,o,a,s){return e||i(),r[e](n+o,a,s||!1),a},_s.unbind=function(r,o,a,s){return t||i(),r[t](n+o,a,s||!1),a},_s}var bh=HE(),zE=FE(bh),Oe=$E({__proto__:null,default:zE},[bh]),xh=["focus","blur"];function GE(e,t,n,i,r){return xh.indexOf(n)!==-1&&(r=!0),Oe.bind(e,n,function(o){var a=o.target||o.srcElement;o.delegateTarget=Or(a,t,!0),o.delegateTarget&&i.call(e,o)},r)}function VE(e,t,n,i){return xh.indexOf(t)!==-1&&(i=!0),Oe.unbind(e,t,n,i)}var Pn={bind:GE,unbind:VE};function Ju(e,t){return e&&typeof e.matches=="function"&&e.matches(t)||!1}function st(e,t){return t=t||document,t.querySelector(e)}function bs(e,t){return t=t||document,t.querySelectorAll(e)}function fi(e){e.parentNode&&e.parentNode.removeChild(e)}function WE(e,t){if(e.ownerDocument!==t.ownerDocument)try{return t.ownerDocument.importNode(e,!0)}catch{}return e}function UE(e,t){return t.appendChild(WE(e,t))}function De(e,t){return UE(t,e),e}var el=2,wh={"alignment-baseline":1,"baseline-shift":1,clip:1,"clip-path":1,"clip-rule":1,color:1,"color-interpolation":1,"color-interpolation-filters":1,"color-profile":1,"color-rendering":1,cursor:1,direction:1,display:1,"dominant-baseline":1,"enable-background":1,fill:1,"fill-opacity":1,"fill-rule":1,filter:1,"flood-color":1,"flood-opacity":1,font:1,"font-family":1,"font-size":el,"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":el,"text-anchor":1,"text-decoration":1,"text-rendering":1,"unicode-bidi":1,visibility:1,"word-spacing":1,"writing-mode":1};function qE(e,t){return wh[t]?e.style[t]:e.getAttributeNS(null,t)}function Eh(e,t,n){var i=t.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase(),r=wh[i];r?(r===el&&typeof n=="number"&&(n=String(n)+"px"),e.style[i]=n):e.setAttributeNS(null,t,n)}function YE(e,t){var n=Object.keys(t),i,r;for(i=0,r;r=n[i];i++)Eh(e,r,t[r])}function ce(e,t,n){if(typeof t=="string")if(n!==void 0)Eh(e,t,n);else return qE(e,t);else YE(e,t);return e}const KE=Object.prototype.toString;function We(e){return new Ji(e)}function Ji(e){if(!e||!e.nodeType)throw new Error("A DOM element reference is required");this.el=e,this.list=e.classList}Ji.prototype.add=function(e){return this.list.add(e),this},Ji.prototype.remove=function(e){return KE.call(e)=="[object RegExp]"?this.removeMatching(e):(this.list.remove(e),this)},Ji.prototype.removeMatching=function(e){const t=this.array();for(let n=0;n<t.length;n++)e.test(t[n])&&this.remove(t[n]);return this},Ji.prototype.toggle=function(e,t){return typeof t<"u"?t!==this.list.toggle(e,t)&&this.list.toggle(e):this.list.toggle(e),this},Ji.prototype.array=function(){return Array.from(this.list)},Ji.prototype.has=Ji.prototype.contains=function(e){return this.list.contains(e)};function xs(e){for(var t;t=e.firstChild;)e.removeChild(t);return e}function Sh(e){return e.cloneNode(!0)}var tl={svg:"http://www.w3.org/2000/svg"},Rh='<svg xmlns="'+tl.svg+'"';function XE(e){var t=!1;e.substring(0,4)==="<svg"?e.indexOf(tl.svg)===-1&&(e=Rh+e.substring(4)):(e=Rh+">"+e+"</svg>",t=!0);var n=ZE(e);if(!t)return n;for(var i=document.createDocumentFragment(),r=n.firstChild;r.firstChild;)i.appendChild(r.firstChild);return i}function ZE(e){var t;return t=new DOMParser,t.async=!1,t.parseFromString(e,"text/xml")}function ye(e,t){var n;return e=e.trim(),e.charAt(0)==="<"?(n=XE(e).firstChild,n=document.importNode(n,!0)):n=document.createElementNS(tl.svg,e),t&&ce(n,t),n}var nl=null;function Ch(){return nl===null&&(nl=ye("svg")),nl}function Ph(e,t){var n,i,r=Object.keys(t);for(n=0;i=r[n];n++)e[i]=t[i];return e}function QE(e,t,n,i,r,o){var a=Ch().createSVGMatrix();switch(arguments.length){case 0:return a;case 1:return Ph(a,e);case 6:return Ph(a,{a:e,b:t,c:n,d:i,e:r,f:o})}}function Xo(e){return Ch().createSVGTransform()}var Ah=/([&<>]{1})/g,JE=/([&<>\n\r"]{1})/g,e1={"&":"&","<":"<",">":">",'"':"'"};function il(e,t){function n(i,r){return e1[r]||r}return e.replace(t,n)}function Th(e,t){var n,i,r,o,a;switch(e.nodeType){case 3:t.push(il(e.textContent,Ah));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,'="',il(o.value,JE),'"');if(e.hasChildNodes()){for(t.push(">"),a=e.childNodes,n=0,i=a.length;n<i;++n)Th(a.item(n),t);t.push("</",e.tagName,">")}else t.push("/>");break;case 8:t.push("<!--",il(e.nodeValue,Ah),"-->");break;case 4:t.push("<![CDATA[",e.nodeValue,"]]>");break;default:throw new Error("unable to handle node "+e.nodeType)}return t}function t1(e){for(var t=e.firstChild,n=[];t;)Th(t,n),t=t.nextSibling;return n.join("")}function Mh(e,t){return t1(e)}function zt(e){var t=e.parentNode;return t&&t.removeChild(e),e}function n1(e,t){return t instanceof SVGMatrix?e.createSVGTransformFromMatrix(t):t}function i1(e,t){var n,i;for(e.clear(),n=0;i=t[n];n++)e.appendItem(n1(e,i))}function Zo(e,t){var n=e.transform.baseVal;return t&&(Array.isArray(t)||(t=[t]),i1(n,t)),n.consolidate()}const r1=/^class[ {]/;function o1(e){return r1.test(e.toString())}function rl(e){return Array.isArray(e)}function ol(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function ws(...e){e.length===1&&rl(e[0])&&(e=e[0]),e=[...e];const t=e.pop();return t.$inject=e,t}const a1=/constructor\s*[^(]*\(\s*([^)]*)\)/m,s1=/^(?:async\s+)?(?:function\s*[^(]*)?(?:\(\s*([^)]*)\)|(\w+))/m,c1=/\/\*([^*]*)\*\//m;function u1(e){if(typeof e!="function")throw new Error(`Cannot annotate "${e}". Expected a function!`);const t=e.toString().match(o1(e)?a1:s1);if(!t)return[];const n=t[1]||t[2];return n&&n.split(",").map(i=>{const r=i.match(c1);return(r&&r[1]||i).trim()})||[]}function kh(e,t){const n=t||{get:function(x,w){if(i.push(x),w===!1)return null;throw s(`No provider for "${x}"!`)}},i=[],r=this._providers=Object.create(n._providers||null),o=this._instances=Object.create(null),a=o.injector=this,s=function(x){const w=i.join(" -> ");return i.length=0,new Error(w?`${x} (Resolving: ${w})`:x)};function c(x,w){if(!r[x]&&x.includes(".")){const C=x.split(".");let T=c(C.shift());for(;C.length;)T=T[C.shift()];return T}if(ol(o,x))return o[x];if(ol(r,x)){if(i.indexOf(x)!==-1)throw i.push(x),s("Cannot resolve circular dependency!");return i.push(x),o[x]=r[x][0](r[x][1]),i.pop(),o[x]}return n.get(x,w)}function u(x,w){if(typeof w>"u"&&(w={}),typeof x!="function")if(rl(x))x=ws(x.slice());else throw s(`Cannot invoke "${x}". Expected a function!`);const T=(x.$inject||u1(x)).map(B=>ol(w,B)?w[B]:c(B));return{fn:x,dependencies:T}}function l(x){const{fn:w,dependencies:C}=u(x),T=Function.prototype.bind.call(w,null,...C);return new T}function f(x,w,C){const{fn:T,dependencies:B}=u(x,C);return T.apply(w,B)}function p(x){return ws(w=>x.get(w))}function d(x,w){if(w&&w.length){const C=Object.create(null),T=Object.create(null),B=[],M=[],z=[];let G,$,V,he;for(let nt in r)G=r[nt],w.indexOf(nt)!==-1&&(G[2]==="private"?($=B.indexOf(G[3]),$===-1?(V=G[3].createChild([],w),he=p(V),B.push(G[3]),M.push(V),z.push(he),C[nt]=[he,nt,"private",V]):C[nt]=[z[$],nt,"private",M[$]]):C[nt]=[G[2],G[1]],T[nt]=!0),(G[2]==="factory"||G[2]==="type")&&G[1].$scope&&w.forEach(gt=>{G[1].$scope.indexOf(gt)!==-1&&(C[nt]=[G[2],G[1]],T[gt]=!0)});w.forEach(nt=>{if(!T[nt])throw new Error('No provider for "'+nt+'". Cannot use provider from the parent!')}),x.unshift(C)}return new kh(x,a)}const h={factory:f,type:l,value:function(x){return x}};function m(x,w){const C=x.__init__||[];return function(){C.forEach(T=>{typeof T=="string"?w.get(T):w.invoke(T)})}}function g(x){const w=x.__exports__;if(w){const C=x.__modules__,T=Object.keys(x).reduce(($,V)=>(V!=="__exports__"&&V!=="__modules__"&&V!=="__init__"&&V!=="__depends__"&&($[V]=x[V]),$),Object.create(null)),B=(C||[]).concat(T),M=d(B),z=ws(function($){return M.get($)});w.forEach(function($){r[$]=[z,$,"private",M]});const G=(x.__init__||[]).slice();return G.unshift(function(){M.init()}),x=Object.assign({},x,{__init__:G}),m(x,M)}return Object.keys(x).forEach(function(C){if(C==="__init__"||C==="__depends__")return;const T=x[C];if(T[2]==="private"){r[C]=T;return}const B=T[0],M=T[1];r[C]=[h[B],l1(B,M),B]}),m(x,a)}function S(x,w){return x.indexOf(w)!==-1||(x=(w.__depends__||[]).reduce(S,x),x.indexOf(w)!==-1)?x:x.concat(w)}function E(x){const w=x.reduce(S,[]).map(g);let C=!1;return function(){C||(C=!0,w.forEach(T=>T()))}}this.get=c,this.invoke=f,this.instantiate=l,this.createChild=d,this.init=E(e)}function l1(e,t){return e!=="value"&&rl(t)&&(t=ws(t.slice())),t}var p1=1e3;function Mi(e,t){var n=this;t=t||p1,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)})}Mi.prototype.canRender=function(e){},Mi.prototype.drawShape=function(e,t){},Mi.prototype.drawConnection=function(e,t){},Mi.prototype.getShapePath=function(e){},Mi.prototype.getConnectionPath=function(e){};function Dr(e){return e.flat().join(",").replace(/,?([A-Za-z]),?/g,"$1")}function f1(e){return["M",e.x,e.y]}function al(e){return["L",e.x,e.y]}function d1(e,t,n){return["C",e.x,e.y,t.x,t.y,n.x,n.y]}function h1(e,t){const n=e.length,i=[f1(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(al(a));continue}const c=Math.min(t,sl(a.x-o.x,a.y-o.y),sl(s.x-a.x,s.y-a.y));if(!c){i.push(al(a));continue}const u=Es(a,o,c),l=Es(a,o,c*.5),f=Es(a,s,c),p=Es(a,s,c*.5);i.push(al(u)),i.push(d1(l,p,f))}return i}function Es(e,t,n){const i=t.x-e.x,r=t.y-e.y,o=sl(i,r),a=n/o;return{x:e.x+i*a,y:e.y+r*a}}function sl(e,t){return Math.sqrt(Math.pow(e,2)+Math.pow(t,2))}function Qo(e,t,n){ke(t)&&(n=t,t=null),t||(t={});const i=ye("path",t);return ke(n)&&(i.dataset.cornerRadius=String(n)),cl(i,e)}function cl(e,t){const n=parseInt(e.dataset.cornerRadius,10)||0;return ce(e,{d:Dr(h1(t,n))}),e}function Ss(e){var t=new Set(e);return He(e,function(n){for(var i=n.parent;i;){if(t.has(i))return!1;i=i.parent}return!0})}function Lr(e,t,n){n=n||0,Ce(e)||(e=[e]),k(e,function(i,r){var o=t(i,r,n);Ce(o)&&o.length&&Lr(o,t,n+1)})}function ul(e,t,n){var i=new Set,r=new Set;return Lr(e,function(o,a,s){i.add(o);var c=o.children;if(c&&!r.has(c))return r.add(c),c}),Array.from(i)}function Jo(e,t){return ul(e)}function m1(e,t,n){Cr(t)&&(t=!0),Ut(t)&&(n=t,t=!0),n=n||{};var i=ea(n.allShapes),r=ea(n.allConnections),o=ea(n.enclosedElements),a=ea(n.enclosedConnections),s=ea(n.topLevel,t&&io(e,function(l){return l.id}));function c(l){s[l.source.id]&&s[l.target.id]&&(s[l.id]=[l]),i[l.source.id]&&i[l.target.id]&&(a[l.id]=o[l.id]=l),r[l.id]=l}function u(l){if(o[l.id]=l,l.waypoints)a[l.id]=r[l.id]=l;else return i[l.id]=l,k(l.incoming,c),k(l.outgoing,c),l.children}return Lr(e,u),{allShapes:i,allConnections:r,topLevel:s,enclosedConnections:a,enclosedElements:o}}function Lt(e,t){t=!!t,Ce(e)||(e=[e]);var n,i,r,o;return k(e,function(a){var s=a;a.waypoints&&!t&&(s=Lt(a.waypoints,!0));var c=s.x,u=s.y,l=s.height||0,f=s.width||0;(c<n||n===void 0)&&(n=c),(u<i||i===void 0)&&(i=u),(c+f>r||r===void 0)&&(r=c+f),(u+l>o||o===void 0)&&(o=u+l)}),{x:n,y:i,height:o-i,width:r-n}}function po(e,t){var n={};return k(e,function(i){var r=i;r.waypoints&&(r=Lt(r)),!ke(t.y)&&r.x>t.x&&(n[i.id]=i),!ke(t.x)&&r.y>t.y&&(n[i.id]=i),r.x>t.x&&r.y>t.y&&(ke(t.width)&&ke(t.height)&&r.width+r.x<t.width+t.x&&r.height+r.y<t.height+t.y||!ke(t.width)||!ke(t.height))&&(n[i.id]=i)}),n}function Oh(e){return"waypoints"in e?"connection":"x"in e?"shape":"root"}function Dh(e){return!!(e&&e.isFrame)}function ea(e,t){return N({},e||{},t||{})}var g1=1;function er(e,t){Mi.call(this,e,g1),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})}se(er,Mi),er.prototype.canRender=function(){return!0},er.prototype.drawShape=function(t,n,i){var r=ye("rect");return ce(r,{x:0,y:0,width:n.width||0,height:n.height||0}),Dh(n)?ce(r,N({},this.FRAME_STYLE,i||{})):ce(r,N({},this.SHAPE_STYLE,i||{})),De(t,r),r},er.prototype.drawConnection=function(t,n,i){var r=Qo(n.waypoints,N({},this.CONNECTION_STYLE,i||{}));return De(t,r),r},er.prototype.getShapePath=function(t){var n=t.x,i=t.y,r=t.width,o=t.height,a=[["M",n,i],["l",r,0],["l",0,o],["l",-r,0],["z"]];return Dr(a)},er.prototype.getConnectionPath=function(t){var n=t.waypoints,i,r,o=[];for(i=0;r=n[i];i++)r=r.original||r,o.push([i===0?"M":"L",r.x,r.y]);return Dr(o)},er.$inject=["eventBus","styles"];function y1(){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 N(o,{class:n})},this.style=function(n,i){!Ce(n)&&!i&&(i=n,n=[]);var r=Rn(n,function(o,a){return N(o,e[a]||{})},{});return i?N(r,i):r},this.computeStyle=function(n,i,r){return Ce(i)||(r=i,i=[]),t.style(i||[],N({},r,n||{}))}}const v1={__init__:["defaultRenderer"],defaultRenderer:["type",er],styles:["type",y1]};function Pt(e,t){if(!e||!t)return-1;var n=e.indexOf(t);return n!==-1&&e.splice(n,1),n}function Tt(e,t,n){if(!(!e||!t)){typeof n!="number"&&(n=-1);var i=e.indexOf(t);if(i!==-1){if(i===n)return;if(n!==-1)e.splice(i,1);else return}n!==-1?e.splice(n,0,t):e.push(t)}}function ll(e,t){return!e||!t?-1:e.indexOf(t)}function ta(e,t){return!e||!t?-1:Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function pl(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=ta(e,t);return Math.abs(r/o)<=i}var _1=2;function ki(e,t){var n=Array.from(arguments).flat();const i={x:"v",y:"h"};for(const[r,o]of Object.entries(i))if(b1(r,n))return o;return!1}function b1(e,t){const n=t[0];return Pr(t,function(i){return Math.abs(n[e]-i[e])<=_1})}function Lh(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 fl(e,t){return{x:Math.round(e.x+(t.x-e.x)/2),y:Math.round(e.y+(t.y-e.y)/2)}}var x1=/,?([a-z]),?/gi,Ih=parseFloat,It=Math,tr=It.PI,di=It.min,hi=It.max,Nh=It.pow,nr=It.abs,w1=/([a-z])[\s,]*((-?\d*\.?\d*(?:e[-+]?\d+)?[\s]*,?[\s]*)+)/ig,E1=/(-?\d*\.?\d*(?:e[-+]?\d+)?)[\s]*,?[\s]*/ig,Bh=Array.isArray||function(e){return e instanceof Array};function S1(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function R1(e,t){for(var n=0,i=e.length;n<i;n++)if(e[n]===t)return e.push(e.splice(n,1)[0])}function C1(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 S1(r,i)?(R1(o,i),r[i]):(o.length>=1e3&&delete r[o.shift()],o.push(i),r[i]=e(...arguments),r[i])}return t}function P1(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(w1,function(i,r,o){var a=[],s=r.toLowerCase();for(o.replace(E1,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=hl,n}function A1(e){for(var t=0,n=e.length;t<n;t++){var i=e[t][0];if(typeof i=="string"&&i!==i.toUpperCase())return!1}return!0}function T1(e){for(var t=0,n=e.length;t<n;t++){var i=e[t][0];if(i!=="M"&&i!=="C")return!1}return!0}function dl(e,t,n,i){return arguments.length===1&&(t=e.y,n=e.width,i=e.height,e=e.x),{x:e,y:t,width:n,height:i,x2:e+n,y2:t+i}}function hl(){return this.join(",").replace(x1,"$1")}function M1(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=hl,t}function $h(e,t,n,i,r,o,a,s,c){var u=1-c,l=Nh(u,3),f=Nh(u,2),p=c*c,d=p*c,h=l*e+f*3*c*n+u*3*c*c*r+d*a,m=l*t+f*3*c*i+u*3*c*c*o+d*s;return{x:Rs(h),y:Rs(m)}}function jh(e){var t=N1(...e);return dl(t.x0,t.y0,t.x1-t.x0,t.y1-t.y0)}function ir(e,t,n){return t>=e.x&&t<=e.x+e.width&&n>=e.y&&n<=e.y+e.height}function k1(e,t){return e=dl(e),t=dl(t),ir(t,e.x,e.y)||ir(t,e.x2,e.y)||ir(t,e.x,e.y2)||ir(t,e.x2,e.y2)||ir(e,t.x,t.y)||ir(e,t.x2,t.y)||ir(e,t.x,t.y2)||ir(e,t.x2,t.y2)||(e.x<t.x2&&e.x>t.x||t.x<e.x2&&t.x>e.x)&&(e.y<t.y2&&e.y>t.y||t.y<e.y2&&t.y>e.y)}function Fh(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 Hh(e,t,n,i,r,o,a,s,c){c==null&&(c=1),c=c>1?1:c<0?0:c;for(var u=c/2,l=12,f=[-.1252,.1252,-.3678,.3678,-.5873,.5873,-.7699,.7699,-.9041,.9041,-.9816,.9816],p=[.2491,.2491,.2335,.2335,.2032,.2032,.1601,.1601,.1069,.1069,.0472,.0472],d=0,h=0;h<l;h++){var m=u*f[h]+u,g=Fh(m,e,n,r,a),S=Fh(m,t,i,o,s),E=g*g+S*S;d+=p[h]*It.sqrt(E)}return u*d}function O1(e,t,n,i,r,o,a,s){if(!(hi(e,n)<di(r,a)||di(e,n)>hi(r,a)||hi(t,i)<di(o,s)||di(t,i)>hi(o,s))){var c=(e*i-t*n)*(r-a)-(e-n)*(r*s-o*a),u=(e*i-t*n)*(o-s)-(t-i)*(r*s-o*a),l=(e-n)*(o-s)-(t-i)*(r-a);if(l){var f=Rs(c/l),p=Rs(u/l),d=+f.toFixed(2),h=+p.toFixed(2);if(!(d<+di(e,n).toFixed(2)||d>+hi(e,n).toFixed(2)||d<+di(r,a).toFixed(2)||d>+hi(r,a).toFixed(2)||h<+di(t,i).toFixed(2)||h>+hi(t,i).toFixed(2)||h<+di(o,s).toFixed(2)||h>+hi(o,s).toFixed(2)))return{x:f,y:p}}}}function Rs(e){return Math.round(e*1e11)/1e11}function D1(e,t,n){var i=jh(e),r=jh(t);if(!k1(i,r))return[];var o=Hh(...e),a=Hh(...t),s=Gh(e)?1:~~(o/5)||1,c=Gh(t)?1:~~(a/5)||1,u=new Array(s+1),l=new Array(c+1),f={},p=[],d,h;for(d=0;d<s+1;d++){var m=$h(...e,d/s);u[d]={x:m.x,y:m.y,t:d/s}}for(d=0;d<c+1;d++)m=$h(...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],x=l[h+1],w=nr(S.x-g.x)<.01?"y":"x",C=nr(x.x-E.x)<.01?"y":"x",T=O1(g.x,g.y,S.x,S.y,E.x,E.y,x.x,x.y),B;if(T){if(B=T.x.toFixed(9)+"#"+T.y.toFixed(9),f[B])continue;f[B]=!0;var M=g.t+nr((T[w]-g[w])/(S[w]-g[w]))*(S.t-g.t),z=E.t+nr((T[C]-E[C])/(x[C]-E[C]))*(x.t-E.t);M>=0&&M<=1&&z>=0&&z<=1&&p.push({x:T.x,y:T.y,t1:M,t2:z})}}return p}function zh(e,t,n){e=Uh(e),t=Uh(t);for(var i,r,o,a,s,c,u,l,f,p,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"?(f=[i,r,...g.slice(1)],i=f[6],r=f[7]):(f=[i,r,i,r,s,c,s,c],i=s,r=c);for(var S=0,E=t.length;S<E;S++){var x=t[S];if(x[0]=="M")o=u=x[1],a=l=x[2];else{x[0]=="C"?(p=[o,a,...x.slice(1)],o=p[6],a=p[7]):(p=[o,a,o,a,u,l,u,l],o=u,a=l);var w=D1(f,p);{for(var C=0,T=w.length;C<T;C++)w[C].segment1=h,w[C].segment2=S,w[C].bez1=f,w[C].bez2=p;d=d.concat(w)}}}}}return d}function L1(e){return Bh(e)&&Bh(e[0])}function I1(e){if(A1(e))return e;var t=new Array(e.length),n=0,i=0,r=0,o=0,a=0,s;e[0][0]=="M"&&(n=+e[0][1],i=+e[0][2],r=n,o=i,a++,t[0]=["M",n,i]);for(var c,u,l=a,f=e.length;l<f;l++){if(u=e[l],s=u[0],t[l]=c=new Array(u.length),s!=s.toUpperCase())switch(c[0]=s.toUpperCase(),c[0]){case"A":c[1]=u[1],c[2]=u[2],c[3]=u[3],c[4]=u[4],c[5]=u[5],c[6]=+u[6]+n,c[7]=+u[7]+i;break;case"V":c[1]=+u[1]+i;break;case"H":c[1]=+u[1]+n;break;case"M":r=+u[1]+n,o=+u[2]+i;default:for(var p=1,d=u.length;p<d;p++)c[p]=+u[p]+(p%2?n:i)}else for(var 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=hl,t}function Gh(e){return e[0]===e[2]&&e[1]===e[3]&&e[4]===e[6]&&e[5]===e[7]}function Cs(e,t,n,i){return[e,t,n,i,n,i]}function Vh(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 Wh(e,t,n,i,r,o,a,s,c,u){var l=tr*120/180,f=tr/180*(+r||0),p=[],d,h=C1(function(P,_,y){var D=P*It.cos(y)-_*It.sin(y),j=P*It.sin(y)+_*It.cos(y);return{x:D,y:j}});if(u)B=u[0],M=u[1],C=u[2],T=u[3];else{d=h(e,t,-f),e=d.x,t=d.y,d=h(s,c,-f),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=It.sqrt(S),n=S*n,i=S*i);var E=n*n,x=i*i,w=(o==a?-1:1)*It.sqrt(nr((E*x-E*g*g-x*m*m)/(E*g*g+x*m*m))),C=w*n*g/i+(e+s)/2,T=w*-i*m/n+(t+c)/2,B=It.asin(((t-T)/i).toFixed(9)),M=It.asin(((c-T)/i).toFixed(9));B=e<C?tr-B:B,M=s<C?tr-M:M,B<0&&(B=tr*2+B),M<0&&(M=tr*2+M),a&&B>M&&(B=B-tr*2),!a&&M>B&&(M=M-tr*2)}var z=M-B;if(nr(z)>l){var G=M,$=s,V=c;M=B+l*(a&&M>B?1:-1),s=C+n*It.cos(M),c=T+i*It.sin(M),p=Wh(s,c,n,i,r,0,a,$,V,[M,G,C,T])}z=M-B;var he=It.cos(B),nt=It.sin(B),gt=It.cos(M),J=It.sin(M),le=It.tan(z/4),Ee=4/3*n*le,pe=4/3*i*le,ge=[e,t],re=[e+Ee*nt,t-pe*he],H=[s+Ee*J,c-pe*gt],F=[s,c];if(re[0]=2*ge[0]-re[0],re[1]=2*ge[1]-re[1],u)return[re,H,F].concat(p);p=[re,H,F].concat(p).join().split(",");for(var Y=[],Ne=0,Kt=p.length;Ne<Kt;Ne++)Y[Ne]=Ne%2?h(p[Ne-1],p[Ne],f).y:h(p[Ne],p[Ne+1],f).x;return Y}function N1(e,t,n,i,r,o,a,s){for(var c=[],u=[[],[]],l,f,p,d,h,m,g,S,E=0;E<2;++E){if(E==0?(f=6*e-12*n+6*r,l=-3*e+9*n-9*r+3*a,p=3*n-3*e):(f=6*t-12*i+6*o,l=-3*t+9*i-9*o+3*s,p=3*i-3*t),nr(l)<1e-12){if(nr(f)<1e-12)continue;d=-p/f,0<d&&d<1&&c.push(d);continue}g=f*f-4*p*l,S=It.sqrt(g),!(g<0)&&(h=(-f+S)/(2*l),0<h&&h<1&&c.push(h),m=(-f-S)/(2*l),0<m&&m<1&&c.push(m))}for(var x=c.length,w=x,C;x--;)d=c[x],C=1-d,u[0][x]=C*C*C*e+3*C*C*d*n+3*C*d*d*r+d*d*d*a,u[1][x]=C*C*C*t+3*C*C*d*i+3*C*d*d*o+d*d*d*s;return u[0][w]=e,u[1][w]=t,u[0][w+1]=a,u[1][w+1]=s,u[0].length=u[1].length=w+2,{x0:di(...u[0]),y0:di(...u[1]),x1:hi(...u[0]),y1:hi(...u[1])}}function Uh(e){if(L1(e)||(e=P1(e)),T1(e))return e;for(var t=M1(I1(e)),n={x:0,y:0,bx:0,by:0,X:0,Y:0,qx:null,qy:null},i=function(p,d,h){var m,g;if(!p)return["C",d.x,d.y,d.x,d.y,d.x,d.y];switch(!(p[0]in{T:1,Q:1})&&(d.qx=d.qy=null),p[0]){case"M":d.X=p[1],d.Y=p[2];break;case"A":p=["C",...Wh(d.x,d.y,...p.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),p=["C",m,g,...p.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),p=["C",...Vh(d.x,d.y,d.qx,d.qy,p[1],p[2])];break;case"Q":d.qx=p[1],d.qy=p[2],p=["C",...Vh(d.x,d.y,p[1],p[2],p[3],p[4])];break;case"L":p=["C",...Cs(d.x,d.y,p[1],p[2])];break;case"H":p=["C",...Cs(d.x,d.y,p[1],d.y)];break;case"V":p=["C",...Cs(d.x,d.y,d.x,p[1])];break;case"Z":p=["C",...Cs(d.x,d.y,d.X,d.Y)];break}return p},r=function(p,d){if(p[d].length>7){p[d].shift();for(var h=p[d];h.length;)o[d]="A",p.splice(d++,0,["C",...h.splice(0,6)]);p.splice(d,1),u=t.length}},o=[],a="",s="",c=0,u=t.length;c<u;c++){t[c]&&(a=t[c][0]),a!="C"&&(o[c]=a,c&&(s=o[c-1])),t[c]=i(t[c],n,s),o[c]!="A"&&a=="C"&&(o[c]="C"),r(t,c);var l=t[c],f=l.length;n.x=l[f-2],n.y=l[f-1],n.bx=Ih(l[f-4])||n.x,n.by=Ih(l[f-3])||n.y}return t}function ut(e){return Ut(e)&&Sn(e,"waypoints")}function $e(e){return Ut(e)&&Sn(e,"labelTarget")}function B1(e){return Ut(e)&&to(e.parent)}function qh(e){return{x:Math.round(e.x),y:Math.round(e.y),width:Math.round(e.width),height:Math.round(e.height)}}function Oi(e){return{x:Math.round(e.x),y:Math.round(e.y)}}function be(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 $1(e){return Oi({x:e.x+(e.width||0)/2,y:e.y+(e.height||0)/2})}function j1(e){for(var t=e.waypoints,n=t.reduce(function(u,l,f){var p=t[f-1];if(p){var d=u[u.length-1],h=d&&d.endLength||0,m=z1(p,l);u.push({start:p,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 Pe(e){return ut(e)?j1(e):$1(e)}function en(e,t,n){n=n||0,Ut(n)||(n={x:n,y:n});var i=be(e),r=be(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 na(e,t,n){var i=F1(e,t);return i.length===1||i.length===2&&ta(i[0],i[1])<1?Oi(i[0]):i.length>1?(i=ai(i,function(r){var o=Math.floor(r.t2*100)||1;return o=100-o,o=(o<10?"0":"")+o,r.segment2+"#"+o}),Oi(i[n?0:i.length-1])):null}function F1(e,t){return zh(e,t)}function H1(e){e=e.slice();for(var t=0,n,i,r;e[t];)n=e[t],i=e[t-1],r=e[t+1],ta(n,r)===0||pl(i,r,n)?e.splice(t,1):t++;return e}function z1(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function As(e,t){return Math.round(e*t)/t}function Yh(e){return ke(e)?e+"px":e}function G1(e){for(;e.parent;)e=e.parent;return e}function V1(e){e=N({},{width:"100%",height:"100%"},e);const t=e.container||document.body,n=document.createElement("div");return n.setAttribute("class","djs-container djs-parent"),mn(n,{position:"relative",overflow:"hidden",width:Yh(e.width),height:Yh(e.height)}),t.appendChild(n),n}function Kh(e,t,n){const i=ye("g");We(i).add(t);const r=n!==void 0?n:e.childNodes.length-1;return e.insertBefore(i,e.childNodes[r]||null),i}const W1="base",Xh=0,U1=1,q1={shape:["x","y","width","height"],connection:["waypoints"]};function Ae(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||{})}Ae.$inject=["config.canvas","eventBus","graphicsFactory","elementRegistry"],Ae.prototype._init=function(e){const t=this._eventBus,n=this._container=V1(e),i=this._svg=ye("svg");ce(i,{width:"100%",height:"100%"}),ln(i,"tabindex",0),e.autoFocus&&t.on("element.hover",()=>{this.restoreFocus()}),t.on("element.mousedown",500,o=>{this.focus()}),i.addEventListener("focusin",()=>{this._setFocused(!0)}),i.addEventListener("focusout",()=>{this._setFocused(!1)}),i.addEventListener("mouseover",()=>{this._eventBus.fire("canvas.mouseover")}),i.addEventListener("mouseout",()=>{this._eventBus.fire("canvas.mouseout")}),De(n,i);const r=this._viewport=Kh(i,"viewport");e.deferUpdate&&(this._viewboxChanged=Mu(this._viewboxChanged,300)),this._restoreFocus=Mu(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)},Ae.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},Ae.prototype._setFocused=function(e){e!=this._focused&&(this._focused=e,this._eventBus.fire("canvas.focus.changed",{focused:e}))},Ae.prototype._clear=function(){this._elementRegistry.getAll().forEach(t=>{const n=Oh(t);n==="root"?this.removeRootElement(t):this._removeElement(t,n)}),this._planes=[],this._rootElement=null,delete this._cachedViewbox},Ae.prototype.focus=function(){this._svg.focus({preventScroll:!0}),this._setFocused(!0)},Ae.prototype.restoreFocus=function(){this._restoreFocus()},Ae.prototype._restoreFocus=function(){document.activeElement===document.body&&this.focus()},Ae.prototype.isFocused=function(){return this._focused},Ae.prototype.getDefaultLayer=function(){return this.getLayer(W1,Xh)},Ae.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},Ae.prototype._getChildIndex=function(e){return Rn(this._layers,function(t,n){return n.visible&&e>=n.index&&t++,t},0)},Ae.prototype._createLayer=function(e,t){typeof t>"u"&&(t=U1);const n=this._getChildIndex(t);return{group:Kh(this._viewport,"layer-"+e,n),index:t,visible:!0}},Ae.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},Ae.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&&(zt(n),t.visible=!1),n},Ae.prototype._removeLayer=function(e){const t=this._layers[e];t&&(delete this._layers[e],zt(t.group))},Ae.prototype.getActiveLayer=function(){const e=this._findPlaneForRoot(this.getRootElement());return e?e.layer:null},Ae.prototype.findRoot=function(e){const t=this._resolveElements(e);let n;for(const i of t){const r=this._findPlaneForRoot(G1(i));if(!r||n&&r.rootElement!==n)return;n=r.rootElement}return n},Ae.prototype.getRootElements=function(){return this._planes.map(function(e){return e.rootElement})},Ae.prototype._findPlaneForRoot=function(e){return ft(this._planes,function(t){return t.rootElement===e})},Ae.prototype._resolveElement=function(e){return typeof e=="string"?this._elementRegistry.get(e):e},Ae.prototype._resolveElements=function(e){return Ce(e)||(e=[e]),e.map(t=>this._resolveElement(t)).filter(Boolean)},Ae.prototype.getContainer=function(){return this._container},Ae.prototype._updateMarker=function(e,t,n){let i;e=this._resolveElement(e),e.markers=e.markers||new Set,i=this._elementRegistry._elements[e.id],i&&(k([i.gfx,i.secondaryGfx],function(r){r&&(n?(e.markers.add(t),We(r).add(t)):(e.markers.delete(t),We(r).remove(t)))}),this._eventBus.fire("element.marker.update",{element:e,gfx:i.gfx,marker:t,add:!!n}))},Ae.prototype.addMarker=function(e,t){this._updateMarker(e,t,!0)},Ae.prototype.removeMarker=function(e,t){this._updateMarker(e,t,!1)},Ae.prototype.hasMarker=function(e,t){return e=this._resolveElement(e),e.markers?e.markers.has(t):!1},Ae.prototype.toggleMarker=function(e,t){this.hasMarker(e,t)?this.removeMarker(e,t):this.addMarker(e,t)},Ae.prototype.getRootElement=function(){const e=this._rootElement;return e||this._planes.length?e:this.setRootElement(this.addRootElement(null))},Ae.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,Xh);return this.hideLayer(n),this._addRoot(e,i),this._planes.push({rootElement:e,layer:i}),e},Ae.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},Ae.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},Ae.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)},Ae.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})},Ae.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})},Ae.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=q1[e];if(!Pr(n,function(r){return typeof t[r]<"u"}))throw new Error("must supply { "+n.join(", ")+" } with "+e)},Ae.prototype._setParent=function(e,t,n){Tt(t.children,e,n),e.parent=t},Ae.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},Ae.prototype.addShape=function(e,t,n){return this._addElement("shape",e,t,n)},Ae.prototype.addConnection=function(e,t,n){return this._addElement("connection",e,t,n)},Ae.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},Ae.prototype.removeShape=function(e){return this._removeElement(e,"shape")},Ae.prototype.removeConnection=function(e){return this._removeElement(e,"connection")},Ae.prototype.getGraphics=function(e,t){return this._elementRegistry.getGraphics(e,t)},Ae.prototype._changeViewbox=function(e){this._eventBus.fire("canvas.viewbox.changing"),e.apply(this),this._cachedViewbox=null,this._viewboxChanged()},Ae.prototype._viewboxChanged=function(){this._eventBus.fire("canvas.viewbox.changed",{viewbox:this.viewbox()})},Ae.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);Zo(t,l)});else return o=this._rootElement?this.getActiveLayer():null,i=o&&o.getBBox()||{},a=Zo(t),r=a?a.matrix:QE(),s=As(r.a,1e3),c=As(-r.e||0,1e3),u=As(-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},Ae.prototype.scroll=function(e){const t=this._viewport;let n=t.getCTM();return e&&this._changeViewbox(function(){e=N({dx:0,dy:0},e||{}),n=this._svg.createSVGMatrix().translate(e.dx,e.dy).multiply(n),Zh(t,n)}),{x:n.e,y:n.f}},Ae.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=Lt(o),s=be(a),c=this.viewbox(),u=this.zoom();let l,f;c.y+=t.top/u,c.x+=t.left/u,c.width-=(t.right+t.left)/u,c.height-=(t.bottom+t.top)/u;const p=be(c);if(!(a.width<c.width&&a.height<c.height))l=a.x-c.x,f=a.y-c.y;else{const h=Math.max(0,s.right-p.right),m=Math.min(0,s.left-p.left),g=Math.max(0,s.bottom-p.bottom),S=Math.min(0,s.top-p.top);l=h||m,f=g||S}this.scroll({dx:-l*u,dy:-f*u})},Ae.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)}),As(i.a,1e3)};function Zh(e,t){const n="matrix("+t.a+","+t.b+","+t.c+","+t.d+","+t.e+","+t.f+")";e.setAttribute("transform",n)}Ae.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},Ae.prototype._setZoom=function(e,t){const n=this._svg,i=this._viewport,r=n.createSVGMatrix(),o=n.createSVGPoint();let a,s,c,u,l;c=i.getCTM();const f=c.a;return t?(a=N(o,t),s=a.matrixTransform(c.inverse()),u=r.translate(s.x,s.y).scale(1/f*e).translate(-s.x,-s.y),l=c.multiply(u)):l=r.scale(e),Zh(this._viewport,l),l},Ae.prototype.getSize=function(){return{width:this._container.clientWidth,height:this._container.clientHeight}},Ae.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}},Ae.prototype.resized=function(){delete this._cachedViewbox,this._eventBus.fire("canvas.resized")};var fo="data-element-id";function Nn(e){this._elements={},this._eventBus=e}Nn.$inject=["eventBus"],Nn.prototype.add=function(e,t,n){var i=e.id;this._validateId(i),ce(t,fo,i),n&&ce(n,fo,i),this._elements[i]={element:e,gfx:t,secondaryGfx:n}},Nn.prototype.remove=function(e){var t=this._elements,n=e.id||e,i=n&&t[n];i&&(ce(i.gfx,fo,""),i.secondaryGfx&&ce(i.secondaryGfx,fo,""),delete t[n])},Nn.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)},Nn.prototype.updateGraphics=function(e,t,n){var i=e.id||e,r=this._elements[i];return n?r.secondaryGfx=t:r.gfx=t,t&&ce(t,fo,i),t},Nn.prototype.get=function(e){var t;typeof e=="string"?t=e:t=e&&ce(e,fo);var n=this._elements[t];return n&&n.element},Nn.prototype.filter=function(e){var t=[];return this.forEach(function(n,i){e(n,i)&&t.push(n)}),t},Nn.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}},Nn.prototype.getAll=function(){return this.filter(function(e){return e})},Nn.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)})},Nn.prototype.getGraphics=function(e,t){var n=e.id||e,i=this._elements[n];return i&&(t?i.secondaryGfx:i.gfx)},Nn.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 Y1(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 K1(e){return e.__refs_collection===!0}function X1(e,t){return Object.prototype.hasOwnProperty.call(e,t.name||t)}function Qh(e,t,n){var i=Y1(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 Z1(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 zn(e,t){if(!(this instanceof zn))return new zn(e,t);e.inverse=t,t.inverse=e,this.props={},this.props[e.name]=e,this.props[t.name]=t}zn.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?Qh(this,t,e):Z1(this,t,e)},zn.prototype.ensureRefsCollection=function(e,t){var n=e[t.name];return K1(n)||Qh(this,t,e),n},zn.prototype.ensureBound=function(e,t){X1(e,t)||this.bind(e,t)},zn.prototype.unset=function(e,t,n){e&&(this.ensureBound(e,t),t.collection?this.ensureRefsCollection(e,t).remove(n):e[t.name]=void 0)},zn.prototype.set=function(e,t,n){e&&(this.ensureBound(e,t),t.collection?this.ensureRefsCollection(e,t).add(n):e[t.name]=n)};var ml=new zn({name:"children",enumerable:!0,collection:!0},{name:"parent"}),Jh=new zn({name:"labels",enumerable:!0,collection:!0},{name:"labelTarget"}),em=new zn({name:"attachers",collection:!0},{name:"host"}),tm=new zn({name:"outgoing",collection:!0},{name:"source"}),nm=new zn({name:"incoming",collection:!0},{name:"target"});function ho(){Object.defineProperty(this,"businessObject",{writable:!0}),Object.defineProperty(this,"label",{get:function(){return this.labels[0]},set:function(e){var t=this.label,n=this.labels;!e&&t?n.remove(t):n.add(e,0)}}),ml.bind(this,"parent"),Jh.bind(this,"labels"),tm.bind(this,"outgoing"),nm.bind(this,"incoming")}function ia(){ho.call(this),ml.bind(this,"children"),em.bind(this,"host"),em.bind(this,"attachers")}se(ia,ho);function im(){ho.call(this),ml.bind(this,"children")}se(im,ia);function rm(){ia.call(this),Jh.bind(this,"labelTarget")}se(rm,ia);function om(){ho.call(this),tm.bind(this,"source"),nm.bind(this,"target")}se(om,ho);var Q1={connection:om,shape:ia,label:rm,root:im};function J1(e,t){var n=Q1[e];if(!n)throw new Error("unknown type: <"+e+">");return N(new n,t)}function eS(e){return e instanceof ho}function Di(){this._uid=12}Di.prototype.createRoot=function(e){return this.create("root",e)},Di.prototype.createLabel=function(e){return this.create("label",e)},Di.prototype.createShape=function(e){return this.create("shape",e)},Di.prototype.createConnection=function(e){return this.create("connection",e)},Di.prototype.create=function(e,t){return t=N({},t||{}),t.id||(t.id=e+"_"+this._uid++),J1(e,t)};var Ts="__fn",am=1e3,tS=Array.prototype.slice;function An(){this._listeners={},this.on("diagram.destroy",1,this._destroy,this)}An.prototype.on=function(e,t,n,i){if(e=Ce(e)?e:[e],qt(t)&&(i=n,n=t,t=am),!ke(t))throw new Error("priority must be a number");var r=n;i&&(r=bn(n,i),r[Ts]=n[Ts]||n);var o=this;e.forEach(function(a){o._addListener(a,{priority:t,callback:r,next:null})})},An.prototype.once=function(e,t,n,i){var r=this;if(qt(t)&&(i=n,n=t,t=am),!ke(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[Ts]=n,this.on(e,t,o)},An.prototype.off=function(e,t){e=Ce(e)?e:[e];var n=this;e.forEach(function(i){n._removeListener(i,t)})},An.prototype.createEvent=function(e){var t=new ra;return t.init(e),t},An.prototype.fire=function(e,t){var n,i,r,o;if(o=tS.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 ra?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}},An.prototype.handleError=function(e){return this.fire("error",{error:e})===!1},An.prototype._destroy=function(){this._listeners={}},An.prototype._invokeListeners=function(e,t,n){for(var i;n&&!e.cancelBubble;)i=this._invokeListener(e,t,n),n=n.next;return i},An.prototype._invokeListener=function(e,t,n){var i;if(n.callback.__isTomb)return i;try{i=nS(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},An.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},An.prototype._getListeners=function(e){return this._listeners[e]},An.prototype._setListeners=function(e,t){this._listeners[e]=t},An.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[Ts]===t)&&(r?r.next=i:this._setListeners(e,i)),r=n,n=i};function ra(){}ra.prototype.stopPropagation=function(){this.cancelBubble=!0},ra.prototype.preventDefault=function(){this.defaultPrevented=!0},ra.prototype.init=function(e){N(this,e||{})};function nS(e,t){return e.apply(null,t)}function Ir(e){return e.childNodes[0]}function iS(e){return e.parentNode.childNodes[1]}function Ms(e,t,n,i,r){var o=Xo();o.setTranslate(t,n);var a=Xo();a.setRotate(i||0,0,0);var s=Xo();s.setScale(1,1),Zo(e,[o,a,s])}function tn(e,t,n){var i=Xo();i.setTranslate(t,n),Zo(e,i)}function sm(e,t){var n=Xo();n.setRotate(t,0,0),Zo(e,n)}function Bn(e,t){this._eventBus=e,this._elementRegistry=t}Bn.$inject=["eventBus","elementRegistry"],Bn.prototype._getChildrenContainer=function(e){var t=this._elementRegistry.getGraphics(e),n;return e.parent?(n=iS(t),n||(n=ye("g"),We(n).add("djs-children"),De(t.parentNode,n))):n=t,n},Bn.prototype._clear=function(e){var t=Ir(e);return vs(t),t},Bn.prototype._createContainer=function(e,t,n,i){var r=ye("g");We(r).add("djs-group"),typeof n<"u"?rS(r,t,t.childNodes[n]):De(t,r);var o=ye("g");We(o).add("djs-element"),We(o).add("djs-"+e),i&&We(o).add("djs-frame"),De(r,o);var a=ye("g");return We(a).add("djs-visual"),De(o,a),o},Bn.prototype.create=function(e,t,n){var i=this._getChildrenContainer(t.parent);return this._createContainer(e,i,n,Dh(t))},Bn.prototype.updateContainments=function(e){var t=this,n=this._elementRegistry,i;i=Rn(e,function(r,o){return o.parent&&(r[o.parent.id]=o.parent),r},{}),k(i,function(r){var o=r.children;if(o){var a=t._getChildrenContainer(r),s=a.firstChild;k(o,function(c){var u=n.getGraphics(c).parentNode;u===s?s=s.nextSibling:a.insertBefore(u,s)})}})},Bn.prototype.drawShape=function(e,t,n={}){var i=this._eventBus;return i.fire("render.shape",{gfx:e,element:t,attrs:n})},Bn.prototype.getShapePath=function(e){var t=this._eventBus;return t.fire("render.getShapePath",e)},Bn.prototype.drawConnection=function(e,t,n={}){var i=this._eventBus;return i.fire("render.connection",{gfx:e,element:t,attrs:n})},Bn.prototype.getConnectionPath=function(e){var t=this._eventBus;return t.fire("render.getConnectionPath",e)},Bn.prototype.update=function(e,t,n){if(t.parent){var i=this._clear(n);if(e==="shape")this.drawShape(i,t),tn(n,t.x,t.y);else if(e==="connection")this.drawConnection(i,t);else throw new Error("unknown type: "+e);t.hidden?ce(n,"display","none"):ce(n,"display","block")}},Bn.prototype.remove=function(e){var t=this._elementRegistry.getGraphics(e);zt(t.parentNode)};function rS(e,t,n){var i=n||t.firstChild;e!==i&&t.insertBefore(e,i)}const oS={__depends__:[v1],__init__:["canvas"],canvas:["type",Ae],elementRegistry:["type",Nn],elementFactory:["type",Di],eventBus:["type",An],graphicsFactory:["type",Bn]};function aS(e){var t=new kh(e);return t.init(),t}function sS(e){e=e||{};var t={config:["value",e]},n=[t,oS].concat(e.modules||[]);return aS(n)}function rr(e,t){this._injector=t||sS(e),this.get("eventBus").fire("diagram.init")}rr.prototype.get=function(e,t){return this._injector.get(e,t)},rr.prototype.invoke=function(e,t,n){return this._injector.invoke(e,t,n)},rr.prototype.destroy=function(){this.get("eventBus").fire("diagram.destroy")},rr.prototype.clear=function(){this.get("eventBus").fire("diagram.clear")};function pn(e){return e?"<"+e.$type+(e.id?' id="'+e.id:"")+'" />':"<null>"}function xn(e,t){return e.$instanceOf(t)}function cS(e){return ft(e.rootElements,function(t){return xn(t,"bpmn:Process")||xn(t,"bpmn:Collaboration")})}function uS(e){var t={},n=[],i={};function r(H,F){return function(Y){H(Y,F)}}function o(H){t[H.id]=H}function a(H){return t[H.id]}function s(H,F){var Y=H.gfx;if(Y)throw new Error(`already rendered ${pn(H)}`);return e.element(H,i[H.id],F)}function c(H,F){return e.root(H,i[H.id],F)}function u(H,F){try{var Y=i[H.id]&&s(H,F);return o(H),Y}catch(Ne){l(Ne.message,{element:H,error:Ne}),console.error(`failed to import ${pn(H)}`,Ne)}}function l(H,F){e.error(H,F)}var f=this.registerDi=function(F){var Y=F.bpmnElement;Y?i[Y.id]?l(`multiple DI elements defined for ${pn(Y)}`,{element:Y}):i[Y.id]=F:l(`no bpmnElement referenced in ${pn(F)}`,{element:F})};function p(H){d(H.plane)}function d(H){f(H),k(H.planeElement,h)}function h(H){f(H)}this.handleDefinitions=function(F,Y){var Ne=F.diagrams;if(Y&&Ne.indexOf(Y)===-1)throw new Error("diagram not part of <bpmn:Definitions />");if(!Y&&Ne&&Ne.length&&(Y=Ne[0]),!Y)throw new Error("no diagram to display");i={},p(Y);var Kt=Y.plane;if(!Kt)throw new Error(`no plane for ${pn(Y)}`);var P=Kt.bpmnElement;if(!P)if(P=cS(F),P)l(`correcting missing bpmnElement on ${pn(Kt)} to ${pn(P)}`),Kt.bpmnElement=P,f(Kt);else throw new Error("no process or collaboration to display");var _=c(P,Kt);if(xn(P,"bpmn:Process")||xn(P,"bpmn:SubProcess"))g(P,_);else if(xn(P,"bpmn:Collaboration"))ge(P,_),S(F.rootElements,_);else throw new Error(`unsupported bpmnElement for ${pn(Kt)}: ${pn(P)}`);m(n)};var m=this.handleDeferred=function(){for(var F;n.length;)F=n.shift(),F()};function g(H,F){le(H,F),z(H.ioSpecification,F),M(H.artifacts,F),o(H)}function S(H,F){var Y=He(H,function(Ne){return!a(Ne)&&xn(Ne,"bpmn:Process")&&Ne.laneSets});Y.forEach(r(g,F))}function E(H,F){u(H,F)}function x(H,F){k(H,r(E,F))}function w(H,F){u(H,F)}function C(H,F){u(H,F)}function T(H,F){u(H,F)}function B(H,F){u(H,F)}function M(H,F){k(H,function(Y){xn(Y,"bpmn:Association")?n.push(function(){B(Y,F)}):B(Y,F)})}function z(H,F){H&&(k(H.dataInputs,r(C,F)),k(H.dataOutputs,r(T,F)))}var G=this.handleSubProcess=function(F,Y){le(F,Y),M(F.artifacts,Y)};function $(H,F){var Y=u(H,F);xn(H,"bpmn:SubProcess")&&G(H,Y||F),xn(H,"bpmn:Activity")&&z(H.ioSpecification,F),n.push(function(){k(H.dataInputAssociations,r(w,F)),k(H.dataOutputAssociations,r(w,F))})}function V(H,F){u(H,F)}function he(H,F){u(H,F)}function nt(H,F){n.push(function(){var Y=u(H,F);H.childLaneSet&>(H.childLaneSet,Y||F),re(H)})}function gt(H,F){k(H.lanes,r(nt,F))}function J(H,F){k(H,r(gt,F))}function le(H,F){Ee(H.flowElements,F),H.laneSets&&J(H.laneSets,F)}function Ee(H,F){k(H,function(Y){xn(Y,"bpmn:SequenceFlow")?n.push(function(){V(Y,F)}):xn(Y,"bpmn:BoundaryEvent")?n.unshift(function(){$(Y,F)}):xn(Y,"bpmn:FlowNode")?$(Y,F):xn(Y,"bpmn:DataObject")||(xn(Y,"bpmn:DataStoreReference")||xn(Y,"bpmn:DataObjectReference")?he(Y,F):l(`unrecognized flowElement ${pn(Y)} in context ${pn(F&&F.businessObject)}`,{element:Y,context:F}))})}function pe(H,F){var Y=u(H,F),Ne=H.processRef;Ne&&g(Ne,Y||F)}function ge(H,F){k(H.participants,r(pe,F)),n.push(function(){x(H.messageFlows,F)}),M(H.artifacts,F)}function re(H){k(H.flowNodeRef,function(F){var Y=F.get("lanes");Y&&Y.push(H)})}}function v(e,t){var n=ee(e);return n&&typeof n.$instanceOf=="function"&&n.$instanceOf(t)}function Fe(e,t){return Ui(t,function(n){return v(e,n)})}function ee(e){return e&&e.businessObject||e}function Qe(e){return e&&e.di}function lS(e,t,n){var i,r,o,a,s=[];function c(u,l){var f={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})}},p=new uS(f);l=l||u.diagrams&&u.diagrams[0];var d=pS(u,l);if(!d)throw new Error("no diagram to display");k(d,function(m){p.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(f){return f.warnings=s,l(f)}})}function pS(e,t){if(!(!t||!t.plane)){var n=t.plane.bpmnElement,i=n;!v(n,"bpmn:Process")&&!v(n,"bpmn:Collaboration")&&(i=fS(n));var r;v(i,"bpmn:Collaboration")?r=i:r=ft(e.rootElements,function(u){if(v(u,"bpmn:Collaboration"))return ft(u.participants,function(l){return l.processRef===i})});var o=[i];r&&(o=cn(r.participants,function(u){return u.processRef}),o.push(r));var a=cm(o),s=[t],c=[n];return k(e.diagrams,function(u){if(u.plane){var l=u.plane.bpmnElement;a.indexOf(l)!==-1&&c.indexOf(l)===-1&&(s.push(u),c.push(l))}}),s}}function cm(e){var t=[];return k(e,function(n){n&&(t.push(n),t=t.concat(cm(n.flowElements)))}),t}function fS(e){for(var t=e;t;){if(v(t,"bpmn:Process"))return t;t=t.$parent}}var dS='<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>',um=dS,lm={verticalAlign:"middle"},pm={color:"#404040"},hS={zIndex:"1001",position:"fixed",top:"0",left:"0",right:"0",bottom:"0"},mS={width:"100%",height:"100%",background:"rgba(40,40,40,0.2)"},gS={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"},yS='<div class="bjs-powered-by-lightbox"><div class="backdrop"></div><div class="notice"><a href="https://bpmn.io" target="_blank" rel="noopener" class="link">'+um+'</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>',mi;function vS(){mi=mt(yS),mn(mi,hS),mn(st("svg",mi),lm),mn(st(".backdrop",mi),mS),mn(st(".notice",mi),gS),mn(st(".link",mi),pm,{margin:"15px 20px 15px 10px",alignSelf:"center"})}function _S(){mi||(vS(),Pn.bind(mi,".backdrop","click",function(e){document.body.removeChild(mi)})),document.body.appendChild(mi)}const ks=5,fm="djs-outline-hidden";function wt(e){e=N({},xS,e),this._moddle=this._createModdle(e),this._container=this._createContainer(e),this._init(this._container,this._moddle,e),ES(this._container)}se(wt,rr),wt.prototype.importXML=async function(t,n){const i=this;function r(a){return i.get("eventBus").createEvent(a)}let o=[];try{t=this._emit("import.parse.start",{xml:t})||t;let a;try{a=await this._moddle.fromXML(t,"bpmn:Definitions")}catch(p){throw this._emit("import.parse.complete",{error:p}),p}let s=a.rootElement;const c=a.references,u=a.warnings,l=a.elementsById;o=o.concat(u),s=this._emit("import.parse.complete",r({error:null,definitions:s,elementsById:l,references:c,warnings:o}))||s;const f=await this.importDefinitions(s,n);return o=o.concat(f.warnings),this._emit("import.done",{error:null,warnings:o}),{warnings:o}}catch(a){let s=a;throw o=o.concat(s.warnings||[]),Os(s,o),s=bS(s),this._emit("import.done",{error:s,warnings:s.warnings}),s}},wt.prototype.importDefinitions=async function(t,n){return this._setDefinitions(t),{warnings:(await this.open(n)).warnings}},wt.prototype.open=async function(t){const n=this._definitions;let i=t;if(!n){const o=new Error("no XML imported");throw Os(o,[]),o}if(typeof t=="string"&&(i=wS(n,t),!i)){const o=new Error("BPMNDiagram <"+t+"> not found");throw Os(o,[]),o}try{this.clear()}catch(o){throw Os(o,[]),o}const{warnings:r}=await lS(this,n,i);return{warnings:r}},wt.prototype.saveXML=async function(t){t=t||{};let n=this._definitions,i,r;try{if(!n)throw new Error("no definitions loaded");n=this._emit("saveXML.start",{definitions:n})||n,r=(await this._moddle.toXML(n,t)).xml,r=this._emit("saveXML.serialized",{xml:r})||r}catch(a){i=a}const o=i?{error:i}:{xml:r};if(this._emit("saveXML.done",o),i)throw i;return o},wt.prototype.saveSVG=async function(){this._emit("saveSVG.start");let t,n;try{const i=this.get("canvas"),r=i.getActiveLayer(),o=st(":scope > defs",i._svg),a=Mh(r),s=o?"<defs>"+Mh(o)+"</defs>":"",c=i.getContainer();bt(c).add(fm);let u;try{u=r.getBBox()}finally{bt(c).remove(fm)}const l=u.x-ks,f=u.y-ks,p=u.width+ks*2,d=u.height+ks*2;t=`<?xml version="1.0" encoding="utf-8"?>
|
|
1
|
+
(function(ie,Ot){typeof exports=="object"&&typeof module<"u"?Ot(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],Ot):(ie=typeof globalThis<"u"?globalThis:ie||self,Ot(ie.BpmnModeler={},ie.Vue))})(this,(function(ie,Ot){"use strict";var CD=Object.defineProperty;var PD=(ie,Ot,Ri)=>Ot in ie?CD(ie,Ot,{enumerable:!0,configurable:!0,writable:!0,value:Ri}):ie[Ot]=Ri;var eo=(ie,Ot,Ri)=>PD(ie,typeof Ot!="symbol"?Ot+"":Ot,Ri);const Ri=["startEvent","endEvent","userTask","serviceTask","task","sendTask","receiveTask","exclusiveGateway","parallelGateway"];function Yf(e){return Ri.includes(e)}const Kf="http://g1project.net/spec/bpmn/bwl/1.0",Cu="bwl",Pu=["top-left","top","top-right","right","bottom-right","bottom","bottom-left","left"],Xf={name:"bwl-hints",uri:Kf,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"}]}]},Au="bwl.undoEpisode",Zf=new WeakSet;function e0(e){Zf.has(e)||(e.register(Au,{preExecute(t){try{t.run()}catch(n){t.error=n}}}),Zf.add(e))}function Qf(e,t){e0(e);const n={run:t};if(e.execute(Au,n),n.error!==void 0)throw e.canUndo()&&e.undo(),n.error}const Jf=["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"],t0={description:"생략 = 보존, null = 제거.",anyOf:[{type:"string"},{type:"null"}]},n0={type:"object",description:"레인. 배열 선언 순서 = 풀 내 상→하 순서.",properties:{id:{type:"string"},name:{type:"string"}},required:["id"],additionalProperties:!1},i0={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},r0={type:"object",description:"플로우 노드. 좌표는 지정하지 않는다 — 배치는 resolver 가 결정한다.",properties:{id:{type:"string"},type:{type:"string",enum:[...Ri]},name:{type:"string"},participant:{type:"string",description:"소속 풀 id(협업 문서)."},lane:{type:"string",description:"소속 레인 id(풀 정의에 선언된 것)."}},required:["id","type"],additionalProperties:!1},o0={type:"object",description:"분기 조건 — 게이트웨이가 아닌 플로우에 붙인다. MVP 는 label 만.",properties:{label:{type:"string"}},required:["label"],additionalProperties:!1},a0={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},s0={type:"object",description:"메시지 플로우(풀 경계를 넘는 연결 — 노드 또는 블랙박스 풀 자체가 끝점).",properties:{id:{type:"string"},source:{type:"string"},target:{type:"string"},name:{type:"string"}},required:["id","source","target"],additionalProperties:!1},c0={type:"object",properties:{id:{type:"string"},name:{type:"string"}},required:["id"],additionalProperties:!1},u0={type:"object",description:"데이터 입출력 연관. 방향 = source→target(태스크→스토어 = 쓰기, 스토어→태스크 = 읽기).",properties:{id:{type:"string"},source:{type:"string"},target:{type:"string"}},required:["source","target"],additionalProperties:!1},l0={type:"object",properties:{id:{type:"string"},text:{type:"string"}},required:["id","text"],additionalProperties:!1},p0={type:"object",description:"연관선(주석 ↔ 요소).",properties:{id:{type:"string"},source:{type:"string"},target:{type:"string"}},required:["source","target"],additionalProperties:!1},f0={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},d0={type:"object",description:"주석 방위 힌트 — 앵커 요소 기준 상대 배치. 있으면 결정적 배치, 없으면 휴리스틱.",properties:{anchor:{type:"string",description:"기준 요소 id."},side:{type:"string",enum:[...Pu]},offset:{type:"number",description:"앵커 가장자리 → 주석 가장자리 간격(px). 생략 시 50."}},required:["anchor","side"],additionalProperties:!1};function sn(e,t){return{type:"object",description:t.description,properties:{kind:{const:e},...t.properties},required:["kind",...t.required??[]],additionalProperties:!1}}const h0={"participant.add":sn("participant.add",{description:"풀 추가. order = 풀 세로 순서 힌트 — **작을수록 위**(생략 시 op 순서가 곧 배치 순서). 값은 상대 순서만 쓰므로 1,2,3… 연속이든 10,20,30 간격이든 같다.",properties:{participant:{$ref:"#/$defs/irParticipant"},order:{type:"integer"}},required:["participant"]}),"participant.update":sn("participant.update",{description:"풀 이름/레인 갱신. lanes 는 전체 재선언(생략 = 보존) — 기존 레인을 유지하려면 함께 다시 나열한다.",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"},lanes:{type:"array",items:{$ref:"#/$defs/irLane"}}},required:["id"]}),"node.add":sn("node.add",{description:'플로우 노드 추가. band = 가로 밴드 순번 힌트(주 흐름 0, 갈래 1, 2…) — 위/아래가 아니라 "주 흐름에서 몇 번째 갈래"다. 행 배치(어느 갈래가 위/아래인지)는 호스트가 정한다(대칭·메시지 방향). 레인이 있으면 그 레인 안의 밴드다 — 한 레인 안에서 게이트웨이 출구를 갈라 놓을 때 쓴다. 컨테이너(풀·레인)는 밴드 수만큼 자란다.',properties:{node:{$ref:"#/$defs/irNode"},band:{type:"integer",description:"0 이상 정수(음수는 payload-invalid 로 거부)."}},required:["node"]}),"node.update":sn("node.update",{description:"노드 이름/레인/타입 갱신. lane = 레인 재배정(이동), type = 태스크·이벤트 타입 전환.",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"},lane:{type:"string"},type:{type:"string",enum:[...Ri]}},required:["id"]}),"sequenceFlow.add":sn("sequenceFlow.add",{description:"시퀀스 플로우 추가. 분기 조건은 게이트웨이가 아닌 플로우의 condition 에 싣는다.",properties:{flow:{$ref:"#/$defs/irSequenceFlow"}},required:["flow"]}),"sequenceFlow.update":sn("sequenceFlow.update",{description:"시퀀스 플로우 이름/조건/끝점 갱신. condition: null = 조건 제거. source/target = 끝점 재배선 — 중간 삽입은 기존 플로우를 지우지 말고 이것으로 한쪽 끝을 옮긴 뒤 새 플로우를 추가한다.",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"},condition:{description:"생략 = 보존, null = 제거.",anyOf:[{$ref:"#/$defs/irFlowCondition"},{type:"null"}]},source:{description:"새 출발 노드 id(생략 = 보존). 같은 배치에서 추가한 노드도 지목할 수 있다.",type:"string"},target:{description:"새 도착 노드 id(생략 = 보존). 같은 배치에서 추가한 노드도 지목할 수 있다.",type:"string"}},required:["id"]}),"messageFlow.add":sn("messageFlow.add",{description:"메시지 플로우 추가(풀 경계를 넘는 연결).",properties:{flow:{$ref:"#/$defs/irMessageFlow"}},required:["flow"]}),"messageFlow.update":sn("messageFlow.update",{description:"메시지 플로우 이름 갱신.",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"}},required:["id"]}),"dataStore.add":sn("dataStore.add",{description:"데이터 스토어 추가(+ 입출력 연관 동반 가능).",properties:{dataStore:{$ref:"#/$defs/irDataStore"},associations:{type:"array",items:{$ref:"#/$defs/irDataAssociation"}}},required:["dataStore"]}),"dataStore.update":sn("dataStore.update",{description:"데이터 스토어 이름 갱신.",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"}},required:["id"]}),"dataAssociation.add":sn("dataAssociation.add",{description:"기존 노드 ↔ 기존 데이터 스토어의 입출력 연관 추가.",properties:{association:{$ref:"#/$defs/irDataAssociation"}},required:["association"]}),"association.add":sn("association.add",{description:"주석 ↔ 요소 연관 추가(한쪽 끝은 주석). 주석 신설과 함께면 annotation.add 의 association 을 쓰고, 이 op 는 추가 연관(한 주석에 여러 연관)용.",properties:{association:{$ref:"#/$defs/irAssociation"}},required:["association"]}),"annotation.add":sn("annotation.add",{description:"텍스트 주석 추가. association 으로 대상 요소와 연결하고, placement 로 방위를 지정하면 결정적 배치된다.",properties:{annotation:{$ref:"#/$defs/irTextAnnotation"},association:{$ref:"#/$defs/irAssociation"},placement:{$ref:"#/$defs/bwlPlacement"}},required:["annotation"]}),"annotation.update":sn("annotation.update",{description:"주석 본문/방위 힌트 갱신. placement: null = 힌트 제거(휴리스틱 복귀). 주석 삭제는 element.remove.",properties:{id:{type:"string"},text:{type:"string"},placement:{description:"생략 = 보존, null = 힌트 제거.",anyOf:[{$ref:"#/$defs/bwlPlacement"},{type:"null"}]}},required:["id"]}),"group.add":sn("group.add",{description:"그룹 추가 — 바운즈는 members 의 bbox 로 산출되므로 좌표를 지정하지 않는다.",properties:{group:{$ref:"#/$defs/irGroup"}},required:["group"]}),"group.update":sn("group.update",{description:"그룹 이름/멤버 갱신. members 는 전체 재선언(생략 = 보존).",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"},members:{type:"array",items:{type:"string"}}},required:["id"]}),"element.remove":sn("element.remove",{description:"요소 제거(카테고리 무관). 부착된 연결선은 함께 제거된다.",properties:{id:{type:"string"}},required:["id"]})},ed={anyOf:Jf.map(e=>h0[e])},m0={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:n0,irParticipant:i0,irNode:r0,irFlowCondition:o0,irSequenceFlow:a0,irMessageFlow:s0,irDataStore:c0,irDataAssociation:u0,irTextAnnotation:l0,irAssociation:p0,irGroup:f0,bwlPlacement:d0,nullableString:t0,symbolicOp:ed}};function Tu(e){return Array.prototype.concat.apply([],e)}const Vo=Object.prototype.toString,g0=Object.prototype.hasOwnProperty;function Cr(e){return e===void 0}function Ft(e){return e!==void 0}function to(e){return e==null}function xe(e){return Vo.call(e)==="[object Array]"}function Ut(e){return Vo.call(e)==="[object Object]"}function Ce(e){return Vo.call(e)==="[object Number]"}function qt(e){const t=Vo.call(e);return t==="[object Function]"||t==="[object AsyncFunction]"||t==="[object GeneratorFunction]"||t==="[object AsyncGeneratorFunction]"||t==="[object Proxy]"}function En(e){return Vo.call(e)==="[object String]"}function y0(e){if(!xe(e))throw new Error("must supply array")}function Sn(e,t){return!to(e)&&g0.call(e,t)}function lt(e,t){const n=es(t);let i;return D(e,function(r,o){if(n(r,o))return i=r,!1}),i}function td(e,t){const n=es(t);let i=xe(e)?-1:void 0;return D(e,function(r,o){if(n(r,o))return i=o,!1}),i}function $e(e,t){const n=es(t);let i=[];return D(e,function(r,o){n(r,o)&&i.push(r)}),i}function D(e,t){let n,i;if(Cr(e))return;const r=xe(e)?w0:x0;for(let o in e)if(Sn(e,o)&&(n=e[o],i=t(n,r(o)),i===!1))return n}function v0(e,t){if(Cr(e))return[];y0(e);const n=es(t);return e.filter(function(i,r){return!n(i,r)})}function Rn(e,t,n){return D(e,function(i,r){n=t(n,i,r)}),n}function Pr(e,t){return!!Rn(e,function(n,i,r){return n&&t(i,r)},!0)}function Yi(e,t){return!!lt(e,t)}function cn(e,t){let n=[];return D(e,function(i,r){n.push(t(i,r))}),n}function Ja(e){return e&&Object.keys(e)||[]}function _0(e){return Ja(e).length}function no(e){return cn(e,t=>t)}function io(e,t,n={}){return t=Mu(t),D(e,function(i){let r=t(i)||"_",o=n[r];o||(o=n[r]=[]),o.push(i)}),n}function nd(e,...t){e=Mu(e);let n={};return D(t,r=>io(r,e,n)),cn(n,function(r,o){return r[0]})}const b0=nd;function ai(e,t){t=Mu(t);let n=[];return D(e,function(i,r){let o=t(i,r),a={d:o,v:i};for(var s=0;s<n.length;s++){let{d:c}=n[s];if(o<c){n.splice(s,0,a);return}}n.push(a)}),cn(n,i=>i.v)}function ro(e){return function(t){return Pr(e,function(n,i){return t[i]===n})}}function Mu(e){return qt(e)?e:t=>t[e]}function es(e){return qt(e)?e:t=>t===e}function x0(e){return e}function w0(e){return Number(e)}function ku(e,t){let n,i,r,o;function a(f){let p=Date.now(),d=f?0:o+t-p;if(d>0)return s(d);e.apply(r,i),c()}function s(f){n=setTimeout(a,f)}function c(){n&&clearTimeout(n),n=o=i=r=void 0}function u(){n&&a(!0),c()}function l(...f){o=Date.now(),i=f,r=this,n||s(t)}return l.flush=u,l.cancel=c,l}function bn(e,t){return e.bind(t)}function j(e,...t){return Object.assign(e,...t)}function E0(e,t,n){let i=e;return D(t,function(r,o){if(typeof r!="number"&&typeof r!="string")throw new Error("illegal key type: "+typeof r+". Key should be of type number or string.");if(r==="constructor")throw new Error("illegal key: constructor");if(r==="__proto__")throw new Error("illegal key: __proto__");let a=t[o+1],s=i[r];Ft(a)&&to(s)&&(s=i[r]=isNaN(+a)?{}:[]),Cr(a)?Cr(n)?delete i[r]:i[r]=n:i=s}),e}function ii(e,t){let n={},i=Object(e);return D(t,function(r){r in i&&(n[r]=e[r])}),n}function si(e,t){let n={},i=Object(e);return D(i,function(r,o){t.indexOf(o)===-1&&(n[o]=r)}),n}function Ou(){}Ou.prototype.get=function(e){return this.$model.properties.get(this,e)},Ou.prototype.set=function(e,t){this.$model.properties.set(this,e,t)};function id(e,t){this.model=e,this.properties=t}id.prototype.createType=function(e){var t=this.model,n=this.properties,i=Object.create(Ou.prototype);D(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}),D(a,bn(function(s,c){this.set(c,s)},this))}return o.prototype=i,o.hasType=i.$instanceOf=this.model.hasType,n.defineModel(o,t),n.defineDescriptor(o,e),o};var S0=j(Object.create(null),{String:!0,Boolean:!0,Integer:!0,Real:!0,Element:!0}),rd=j(Object.create(null),{String:function(e){return e},Boolean:function(e){return e==="true"},Integer:function(e){return parseInt(e,10)},Real:function(e){return parseFloat(e)}});function Du(e,t){var n=rd[e];return n?n(t):t}function Lu(e){return!!S0[e]}function od(e){return!!rd[e]}function un(e,t){var n=e.split(/:/),i,r;if(n.length===1)i=e,r=t;else if(n.length===2)i=n[1],r=n[0];else throw new Error("expected <prefix:localName> or <localName>, got "+e);return e=(r?r+":":"")+i,{name:e,prefix:r,localName:i}}function In(e){this.ns=e,this.name=e.name,this.allTypes=[],this.allTypesByName=Object.create(null),this.properties=[],this.propertiesByName=Object.create(null)}In.prototype.build=function(){return ii(this,["ns","name","allTypes","allTypesByName","properties","propertiesByName","bodyProperty","idProperty"])},In.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)},In.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},In.prototype.redefineProperty=function(e,t,n){var i=e.ns.prefix,r=t.split("#"),o=un(r[0],i),a=un(r[1],o.prefix).name,s=this.propertiesByName[a];if(s)this.replaceProperty(s,e,n);else throw new Error("refined property <"+a+"> not found");delete e.redefines},In.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},In.prototype.removeNamedProperty=function(e){var t=e.ns,n=this.propertiesByName;delete n[t.name],delete n[t.localName]},In.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},In.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},In.prototype.assertNotTrait=function(e){if((e.extends||[]).length)throw new Error(`cannot create <${e.name}> extending <${e.extends}>`)},In.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")},In.prototype.hasProperty=function(e){return this.propertiesByName[e]},In.prototype.addTrait=function(e,t){t&&this.assertNotTrait(e);var n=this.allTypesByName,i=this.allTypes,r=e.name;r in n||(D(e.properties,bn(function(o){o=j({},o,{name:o.ns.localName,inherited:t}),Object.defineProperty(o,"definedBy",{value:e});var a=o.replaces,s=o.redefines;a||s?this.redefineProperty(o,a||s,a):(o.isBody&&this.setBodyProperty(o),o.isId&&this.setIdProperty(o),this.addProperty(o))},this)),i.push(e),n[r]=e)};function Ki(e,t){this.packageMap=Object.create(null),this.typeMap=Object.create(null),this.packages=[],this.properties=t,D(e,bn(this.registerPackage,this))}Ki.prototype.getPackage=function(e){return this.packageMap[e]},Ki.prototype.getPackages=function(){return this.packages},Ki.prototype.registerPackage=function(e){e=j({},e);var t=this.packageMap;ad(t,e,"prefix"),ad(t,e,"uri"),D(e.types,bn(function(n){this.registerType(n,e)},this)),t[e.uri]=t[e.prefix]=e,this.packages.push(e)},Ki.prototype.registerType=function(e,t){e=j({},e,{superClass:(e.superClass||[]).slice(),extends:(e.extends||[]).slice(),properties:(e.properties||[]).slice(),meta:j({},e.meta||{})});var n=un(e.name,t.prefix),i=n.name,r=Object.create(null);D(e.properties,bn(function(o){var a=un(o.name,n.prefix),s=a.name;Lu(o.type)||(o.type=un(o.type,a.prefix).name),j(o,{ns:a,name:s}),r[s]=o},this)),j(e,{ns:n,name:i,propertiesByName:r}),D(e.extends,bn(function(o){var a=un(o,n.prefix),s=this.typeMap[a.name];s.traits=s.traits||[],s.traits.push(i)},this)),this.definePackage(e,t),this.typeMap[i]=e},Ki.prototype.mapTypes=function(e,t,n){var i=Lu(e.name)?{name:e.name}:this.typeMap[e.name],r=this;function o(c,u){var l=un(c,Lu(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+">");D(i.superClass,n?a:s),t(i,!n),D(i.traits,a)},Ki.prototype.getEffectiveDescriptor=function(e){var t=un(e),n=new In(t);this.mapTypes(t,function(r,o){n.addTrait(r,o)});var i=n.build();return this.definePackage(i,i.allTypes[i.allTypes.length-1].$pkg),i},Ki.prototype.definePackage=function(e,t){this.properties.define(e,"$pkg",{value:t})};function ad(e,t,n){var i=t[n];if(i in e)throw new Error("package with "+n+" <"+i+"> already defined")}function Ar(e){this.model=e}Ar.prototype.set=function(e,t,n){if(!En(t)||!t.length)throw new TypeError("property name must be a non-empty string");var i=this.getProperty(e,t),r=i&&i.name;R0(n)?i?delete e[r]:delete e.$attrs[Iu(t)]:i?r in e?e[r]=n:sd(e,i,n):e.$attrs[Iu(t)]=n},Ar.prototype.get=function(e,t){var n=this.getProperty(e,t);if(!n)return e.$attrs[Iu(t)];var i=n.name;return!e[i]&&n.isMany&&sd(e,n,[]),e[i]},Ar.prototype.define=function(e,t,n){if(!n.writable){var i=n.value;n=j({},n,{get:function(){return i}}),delete n.value}Object.defineProperty(e,t,n)},Ar.prototype.defineDescriptor=function(e,t){this.define(e,"$descriptor",{value:t})},Ar.prototype.defineModel=function(e,t){this.define(e,"$model",{value:t})},Ar.prototype.getProperty=function(e,t){var n=this.model,i=n.getPropertyDescriptor(e,t);if(i)return i;if(t.includes(":"))return null;const r=n.config.strict;if(typeof r<"u"){const o=new TypeError(`unknown property <${t}> on <${e.$type}>`);if(r)throw o;typeof console<"u"&&console.warn(o)}return null};function R0(e){return typeof e>"u"}function sd(e,t,n){Object.defineProperty(e,t.name,{enumerable:!t.isReference,writable:!0,value:n,configurable:!0})}function Iu(e){return e.replace(/^:/,"")}function Fn(e,t={}){this.properties=new Ar(this),this.factory=new id(this,this.properties),this.registry=new Ki(e,this.properties),this.typeCache=Object.create(null),this.config=t}Fn.prototype.create=function(e,t){var n=this.getType(e);if(!n)throw new Error("unknown type <"+e+">");return new n(t)},Fn.prototype.getType=function(e){var t=this.typeCache,n=En(e)?e:e.ns.name,i=t[n];return i||(e=this.registry.getEffectiveDescriptor(n),i=t[n]=this.factory.createType(e)),i},Fn.prototype.createAny=function(e,t,n){var i=un(e),r={$type:e,$instanceOf:function(a){return a===this.$type},get:function(a){return this[a]},set:function(a,s){E0(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}),D(n,function(a,s){Ut(a)&&a.value!==void 0?r[a.name]=a.value:r[s]=a}),r},Fn.prototype.getPackage=function(e){return this.registry.getPackage(e)},Fn.prototype.getPackages=function(){return this.registry.getPackages()},Fn.prototype.getElementDescriptor=function(e){return e.$descriptor},Fn.prototype.hasType=function(e,t){t===void 0&&(t=e,e=this);var n=e.$model.getElementDescriptor(e);return t in n.allTypesByName},Fn.prototype.getPropertyDescriptor=function(e,t){return this.getElementDescriptor(e).propertiesByName[t]},Fn.prototype.getTypeDescriptor=function(e){return this.registry.typeMap[e]};var cd=String.fromCharCode,C0=Object.prototype.hasOwnProperty,P0=/&#(\d+);|&#x([0-9a-f]+);|&(\w+);/ig,Wo={amp:"&",apos:"'",gt:">",lt:"<",quot:'"'};Object.keys(Wo).forEach(function(e){Wo[e.toUpperCase()]=Wo[e]});function A0(e,t,n,i){return i?C0.call(Wo,i)?Wo[i]:"&"+i+";":cd(t||parseInt(n,16))}function Tr(e){return e.length>3&&e.indexOf("&")!==-1?e.replace(P0,A0):e}var ud="non-whitespace outside of root node";function Xi(e){return new Error(e)}function T0(e){return"missing namespace for prefix <"+e+">"}function ts(e){return{get:e,enumerable:!0}}function M0(e){var t=Object.create(null),n;for(n in e)t[n]=e[n];return t}var ld=Symbol("nameCache");function Nu(e){return e+"$uri"}function k0(e){var t=Object.create(null),n,i;for(n in e)i=e[n],t[i]=i,t[Nu(i)]=n;return t}function ns(){return{line:0,column:0}}function O0(e){throw e}function pd(e){if(!this)return new pd(e);var t=e&&e.proxy,n,i,r,o,a=O0,s,c,u,l,f=ns,p=!1,d=!1,h="",m=!1,g=!1,S=null,E=!1,x,w,C,P;function L(O){O instanceof Error||(O=Xi(O)),S=O,a(O,f)}function T(O){s&&(O instanceof Error||(O=Xi(O)),s(O,f))}this.on=function(O,$){if(typeof $!="function")throw Xi("required args <name, cb>");switch(O){case"openTag":i=$;break;case"text":n=$;break;case"closeTag":r=$;break;case"error":a=$;break;case"warn":s=$;break;case"cdata":o=$;break;case"attention":l=$;break;case"question":u=$;break;case"comment":c=$;break;default:throw Xi("unsupported event: "+O)}return this},this.ns=function(O){if(typeof O>"u"&&(O={}),typeof O!="object")throw Xi("required args <nsMap={}>");var $=Object.create(null),ne;for(ne in O)$[ne]=O[ne];return g=!0,P=$,this};function B(){x=g?[]:null,w=g?k0(P):null,C=[],f=ns,E=!1,S=null,d=!1,h=""}this.parse=function(O){if(typeof O!="string")throw Xi("required args <xml=string>");if(p)throw Xi("parse during stream; call end() first");return B(),k(O),f=ns,E=!1,S},this.write=function(O){if(typeof O!="string")throw Xi("required args <xml=string>");return p||(B(),p=!0),S||(h=k(h+O,!0)||""),this},this.end=function(){return p||B(),p=!1,S||k(h),h="",f=ns,E=!1,S},this.stop=function(){E=!0};function k(O,$=!1){var ne=null,le=null,je,W=0,re=!1,pe=!1,oe=0,fe=0,ee,V,G,K,De,Kt,A,_,y,I="",H=0,U;function ue(Je,Wt){var an=Je.indexOf(":");if(an===-1)return Je;var yn=w[Je.substring(0,an)];return yn?Wt===yn?Je.substr(an+1):yn+Je.substr(an):(T(T0(Je.substring(0,an))),null)}function Le(){if(U!==null)return U;var Je,Wt,an=g&&w.xmlns,yn=g&&m?[]:null,pt=H,kt=I,Qt=kt.length,Kr,ei,Si,jn,_t,ti={},Xr=new Set,vn,Ze,nt;e:for(;pt<Qt;pt++)if(vn=!1,Ze=kt.charCodeAt(pt),!(Ze===32||Ze<14&&Ze>8)){for((Ze<65||Ze>122||Ze>90&&Ze<97)&&Ze!==95&&Ze!==58&&(T("illegal first char attribute name"),vn=!0),nt=pt+1;nt<Qt;nt++)if(Ze=kt.charCodeAt(nt),!(Ze>96&&Ze<123||Ze>64&&Ze<91||Ze>47&&Ze<59||Ze===46||Ze===45||Ze===95)){if(Ze===32||Ze<14&&Ze>8){T("missing attribute value"),pt=nt;continue e}if(Ze===61)break;T("illegal attribute name char"),vn=!0}if(_t=kt.substring(pt,nt),_t==="xmlns:xmlns"&&(T("illegal declaration of xmlns"),vn=!0),Ze=kt.charCodeAt(nt+1),Ze===34)nt=kt.indexOf('"',pt=nt+2),nt===-1&&(nt=kt.indexOf("'",pt),nt!==-1&&(T("attribute value quote missmatch"),vn=!0));else if(Ze===39)nt=kt.indexOf("'",pt=nt+2),nt===-1&&(nt=kt.indexOf('"',pt),nt!==-1&&(T("attribute value quote missmatch"),vn=!0));else for(T("missing attribute value quotes"),vn=!0,nt=nt+1;nt<Qt&&(Ze=kt.charCodeAt(nt+1),!(Ze===32||Ze<14&&Ze>8));nt++);for(nt===-1&&(T("missing closing quotes"),nt=Qt,vn=!0),vn||(Si=kt.substring(pt,nt)),pt=nt;nt+1<Qt&&(Ze=kt.charCodeAt(nt+1),!(Ze===32||Ze<14&&Ze>8));nt++)pt===nt&&(T("illegal character after attribute end"),vn=!0);if(pt=nt+1,vn)continue e;if(Xr.has(_t)){T("attribute <"+_t+"> already defined");continue}if(Xr.add(_t),!g){ti[_t]=Si;continue}if(m){if(ei=_t==="xmlns"?"xmlns":_t.charCodeAt(0)===120&&_t.substr(0,6)==="xmlns:"?_t.substr(6):null,ei!==null){if(Je=Tr(Si),Wt=Nu(ei),jn=P[Je],!jn){if(ei==="xmlns"||Wt in w&&w[Wt]!==Je)do jn="ns"+W++;while(typeof w[jn]<"u");else jn=ei;P[Je]=jn}w[ei]!==jn&&(Kr||(w=M0(w),Kr=!0),w[ei]=jn,ei==="xmlns"&&(w[Nu(jn)]=Je,an=jn),w[Wt]=Je),ti[_t]=Si;continue}yn.push(_t,Si);continue}_t=ue(_t,an),_t!==null&&(ti[_t]=Si)}if(m)for(pt=0,Qt=yn.length;pt<Qt;pt++)_t=ue(yn[pt++],an),Si=yn[pt],_t!==null&&(ti[_t]=Si);return U=ti}function Xe(){for(var Je=/(\r\n|\r|\n)/g,Wt=0,an=0,yn=0,pt=fe,kt,Qt;oe>=yn&&(kt=Je.exec(O),!(!kt||(pt=kt[0].length+kt.index,pt>oe)));)Wt+=1,yn=pt;return oe==-1?(an=pt,Qt=O.substring(fe)):fe===0?Qt=O.substring(fe,oe):(an=oe-yn,Qt=fe==-1?O.substring(oe):O.substring(oe,fe+1)),{data:Qt,line:Wt,column:an}}for(f=Xe,t&&(y=Object.create({},{name:ts(function(){return A}),originalName:ts(function(){return _}),attrs:ts(Le),ns:ts(function(){return w})}));fe!==-1;){if(O.charCodeAt(fe)===60?oe=fe:oe=O.indexOf("<",fe),oe===-1){if($)return O.substring(fe);if(C.length)return L("unexpected end of file");if(!d)return L("missing start tag");fe<O.length&&O.substring(fe).trim()&&T(ud);return}if(d||(d=!0),fe!==oe){if(C.length){if(n&&(n(O.substring(fe,oe),Tr,f),E))return}else if(O.substring(fe,oe).trim()&&(T(ud),E))return}if(K=O.charCodeAt(oe+1),K===33){if(G=O.charCodeAt(oe+2),G===91&&O.substr(oe+3,6)==="CDATA["){if(fe=O.indexOf("]]>",oe),fe===-1)return $?O.substring(oe):L("unclosed cdata");if(o&&(o(O.substring(oe+9,fe),f),E))return;fe+=3;continue}if(G===45&&O.charCodeAt(oe+3)===45){if(fe=O.indexOf("-->",oe),fe===-1)return $?O.substring(oe):L("unclosed comment");if(c&&(c(O.substring(oe+4,fe),Tr,f),E))return;fe+=3;continue}}if(K===63){if(fe=O.indexOf("?>",oe),fe===-1)return $?O.substring(oe):L("unclosed question");if(u&&(u(O.substring(oe,fe+2),f),E))return;fe+=2;continue}for(ee=oe+1;;ee++){if(De=O.charCodeAt(ee),isNaN(De))return $?O.substring(oe):(fe=-1,L("unclosed tag"));if(De===34)G=O.indexOf('"',ee+1),ee=G!==-1?G:ee;else if(De===39)G=O.indexOf("'",ee+1),ee=G!==-1?G:ee;else if(De===62){fe=ee;break}}if(K===33){if(l&&(l(O.substring(oe,fe+1),Tr,f),E))return;fe+=1;continue}if(U={},K===47){if(re=!1,pe=!0,!C.length)return L("missing open tag");if(ee=A=C.pop(),G=oe+2+ee.length,O.substring(oe+2,G)!==ee)return L("closing tag mismatch");for(;G<fe;G++)if(K=O.charCodeAt(G),!(K===32||K>8&&K<14))return L("close tag")}else{if(O.charCodeAt(fe-1)===47?(ee=A=O.substring(oe+1,fe-1),re=!0,pe=!0):(ee=A=O.substring(oe+1,fe),re=!0,pe=!1),!(K>96&&K<123||K>64&&K<91||K===95||K===58))return L("illegal first char nodeName");for(G=1,V=ee.length;G<V;G++)if(K=ee.charCodeAt(G),!(K>96&&K<123||K>64&&K<91||K>47&&K<59||K===45||K===95||K==46)){if(K===32||K<14&&K>8){A=ee.substring(0,G),U=null;break}return L("invalid nodeName")}pe||C.push(A)}if(g){je=w,re&&(pe||x.push(je),U===null&&(m=ee.indexOf("xmlns",G)!==-1)&&(H=G,I=ee,Le(),m=!1)),_=A,le!==w&&(ne=w[ld],ne===void 0&&(ne=w[ld]=Object.create(null)),le=w);var At=ne[A];if(At!==void 0)A=At;else{if(K=A.indexOf(":"),K!==-1){if(Kt=w[A.substring(0,K)],!Kt)return L("missing namespace on <"+_+">");A=A.substr(K+1)}else Kt=w.xmlns;Kt&&(A=Kt+":"+A),ne[_]=A}}if(re&&(H=G,I=ee,i&&(t?i(y,Tr,pe,f):i(A,Le,Tr,pe,f),E)))return;if(pe){if(r&&(r(t?y:A,Tr,re,f),E))return;g&&(re?w=je:w=x.pop())}fe+=1}}}function fd(e){return e.xml&&e.xml.tagAlias==="lowerCase"}var Bu={xsi:"http://www.w3.org/2001/XMLSchema-instance",xml:"http://www.w3.org/XML/1998/namespace"},dd="property";function hd(e){return e.xml&&e.xml.serialize}function D0(e){const t=hd(e);return t!==dd&&(t||null)}function L0(e){return e.charAt(0).toUpperCase()+e.slice(1)}function md(e,t){return fd(t)?e.prefix+":"+L0(e.localName):e.name}function I0(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 N0(e,t,n){const i=un(e,t.xmlns),r=`${t[i.prefix]||i.prefix}:${i.localName}`,o=un(r);var a=n.getPackage(o.prefix);return I0(o,a)}function Zi(e){return new Error(e)}function Ci(e){return e.$descriptor}function B0(e){j(this,e),this.elementsById={},this.references=[],this.warnings=[],this.addReference=function(t){this.references.push(t)},this.addElement=function(t){if(!t)throw Zi("expected element");var n=this.elementsById,i=Ci(t),r=i.idProperty,o;if(r&&(o=t.get(r.name),o)){if(!/^([a-z][\w-.]*:)?[a-z_][\w-.]*$/i.test(o))throw new Error("illegal ID <"+o+">");if(n[o])throw Zi("duplicate ID <"+o+">");n[o]=t}},this.addWarning=function(t){this.warnings.push(t)}}function Uo(){}Uo.prototype.handleEnd=function(){},Uo.prototype.handleText=function(){},Uo.prototype.handleNode=function(){};function $u(){}$u.prototype=Object.create(Uo.prototype),$u.prototype.handleNode=function(){return this};function oo(){}oo.prototype=Object.create(Uo.prototype),oo.prototype.handleText=function(e){this.body=(this.body||"")+e};function qo(e,t){this.property=e,this.context=t}qo.prototype=Object.create(oo.prototype),qo.prototype.handleNode=function(e){if(this.element)throw Zi("expected no sub nodes");return this.element=this.createReference(e),this},qo.prototype.handleEnd=function(){this.element.id=this.body},qo.prototype.createReference=function(e){return{property:this.property.ns.name,id:""}};function ju(e,t){this.element=t,this.propertyDesc=e}ju.prototype=Object.create(oo.prototype),ju.prototype.handleEnd=function(){var e=this.body||"",t=this.element,n=this.propertyDesc;e=Du(n.type,e),n.isMany?t.get(n.name).push(e):t.set(n.name,e)};function is(){}is.prototype=Object.create(oo.prototype),is.prototype.handleNode=function(e){var t=this,n=this.element;return n?t=this.handleChild(e):(n=this.element=this.createElement(e),this.context.addElement(n)),t};function dn(e,t,n){this.model=e,this.type=e.getType(t),this.context=n}dn.prototype=Object.create(is.prototype),dn.prototype.addReference=function(e){this.context.addReference(e)},dn.prototype.handleText=function(e){var t=this.element,n=Ci(t),i=n.bodyProperty;if(!i)throw Zi("unexpected body text <"+e+">");oo.prototype.handleText.call(this,e)},dn.prototype.handleEnd=function(){var e=this.body,t=this.element,n=Ci(t),i=n.bodyProperty;i&&e!==void 0&&(e=Du(i.type,e),t.set(i.name,e))},dn.prototype.createElement=function(e){var t=e.attributes,n=this.type,i=Ci(n),r=this.context,o=new n({}),a=this.model,s;return D(t,function(c,u){var l=i.propertiesByName[u],f;l&&l.isReference?l.isMany?(f=c.split(" "),D(f,function(p){r.addReference({element:o,property:l.ns.name,id:p})})):r.addReference({element:o,property:l.ns.name,id:c}):(l?c=Du(l.type,c):u==="xmlns"?u=":"+u:(s=un(u,i.ns.prefix),a.getPackage(s.prefix)&&r.addWarning({message:"unknown attribute <"+u+">",element:o,property:u,value:c})),o.set(u,c))}),o},dn.prototype.getPropertyForNode=function(e){var t=e.name,n=un(t),i=this.type,r=this.model,o=Ci(i),a=n.name,s=o.propertiesByName[a];if(s&&!s.isAttr){const u=D0(s);if(u){const l=e.attributes[u];if(l){const f=N0(l,e.ns,r),p=r.getType(f);return j({},s,{effectiveType:Ci(p).name})}}return s}var c=r.getPackage(n.prefix);if(c){const u=md(n,c),l=r.getType(u);if(s=lt(o.properties,function(f){return!f.isVirtual&&!f.isReference&&!f.isAttribute&&l.hasType(f.type)}),s)return j({},s,{effectiveType:Ci(l).name})}else if(s=lt(o.properties,function(u){return!u.isReference&&!u.isAttribute&&u.type==="Element"}),s)return s;throw Zi("unrecognized element <"+n.name+">")},dn.prototype.toString=function(){return"ElementDescriptor["+Ci(this.type).name+"]"},dn.prototype.valueHandler=function(e,t){return new ju(e,t)},dn.prototype.referenceHandler=function(e){return new qo(e,this.context)},dn.prototype.handler=function(e){return e==="Element"?new ao(this.model,e,this.context):new dn(this.model,e,this.context)},dn.prototype.handleChild=function(e){var t,n,i,r;if(t=this.getPropertyForNode(e),i=this.element,n=t.effectiveType||t.type,od(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?(j(o,{element:i}),this.context.addReference(o)):o.$parent=i),r};function Fu(e,t,n){dn.call(this,e,t,n)}Fu.prototype=Object.create(dn.prototype),Fu.prototype.createElement=function(e){var t=e.name,n=un(t),i=this.model,r=this.type,o=i.getPackage(n.prefix),a=o&&md(n,o)||t;if(!r.hasType(a))throw Zi("unexpected element <"+e.originalName+">");return dn.prototype.createElement.call(this,e)};function ao(e,t,n){this.model=e,this.context=n}ao.prototype=Object.create(is.prototype),ao.prototype.createElement=function(e){var t=e.name,n=un(t),i=n.prefix,r=e.ns[i+"$uri"],o=e.attributes;return this.model.createAny(t,r,o)},ao.prototype.handleChild=function(e){var t=new ao(this.model,"Element",this.context).handleNode(e),n=this.element,i=t.element,r;return i!==void 0&&(r=n.$children=n.$children||[],r.push(i),i.$parent=n),t},ao.prototype.handleEnd=function(){this.body&&(this.element.$body=this.body)};function Hu(e){e instanceof Fn&&(e={model:e}),j(this,{lax:!1},e)}Hu.prototype.fromXML=function(e,t,n){var i=t.rootHandler;t instanceof dn?(i=t,t={}):typeof t=="string"?(i=this.handler(t),t={}):typeof i=="string"&&(i=this.handler(i));var r=this.model,o=this.lax,a=new B0(j({},t,{rootHandler:i})),s=new pd({proxy:!0}),c=$0();i.context=a,c.push(i);function u(C,P,L){var T=P(),B=T.line,k=T.column,O=T.data;O.charAt(0)==="<"&&O.indexOf(" ")!==-1&&(O=O.slice(0,O.indexOf(" "))+">");var $="unparsable content "+(O?O+" ":"")+`detected
|
|
2
|
+
line: `+B+`
|
|
3
|
+
column: `+k+`
|
|
4
|
+
nested error: `+C.message;if(L)return a.addWarning({message:$,error:C}),!0;throw Zi($)}function l(C,P){return u(C,P,!0)}function f(){var C=a.elementsById,P=a.references,L,T;for(L=0;T=P[L];L++){var B=T.element,k=C[T.id],O=Ci(B).propertiesByName[T.property];if(k||a.addWarning({message:"unresolved reference <"+T.id+">",element:T.element,property:T.property,value:T.id}),O.isMany){var $=B.get(O.name),ne=$.indexOf(T);ne===-1&&(ne=$.length),k?$[ne]=k:$.splice(ne,1)}else B.set(O.name,k)}}function p(){c.pop().handleEnd()}var d=/^<\?xml /i,h=/ encoding="([^"]+)"/i,m=/^utf-8$/i;function g(C){if(d.test(C)){var P=h.exec(C),L=P&&P[1];!L||m.test(L)||a.addWarning({message:"unsupported document encoding <"+L+">, falling back to UTF-8"})}}function S(C,P){var L=c.peek();try{c.push(L.handleNode(C))}catch(T){u(T,P,o)&&c.push(new $u)}}function E(C,P){try{c.peek().handleText(C)}catch(L){l(L,P)}}function x(C,P){C.trim()&&E(C,P)}var w=r.getPackages().reduce(function(C,P){return C[P.uri]=P.prefix,C},Object.entries(Bu).reduce(function(C,[P,L]){return C[L]=P,C},r.config&&r.config.nsMap||{}));return s.ns(w).on("openTag",function(C,P,L,T){var B=C.attrs||{},k=Object.keys(B).reduce(function($,ne){var le=P(B[ne]);return $[ne]=le,$},{}),O={name:C.name,originalName:C.originalName,attributes:k,ns:C.ns};S(O,T)}).on("question",g).on("closeTag",p).on("cdata",E).on("text",function(C,P,L){x(P(C),L)}).on("error",u).on("warn",l),new Promise(function(C,P){var L;try{s.parse(e),f()}catch($){L=$}var T=i.element;!L&&!T&&(L=Zi("failed to parse document as <"+i.type.$descriptor.name+">"));var B=a.warnings,k=a.references,O=a.elementsById;return L?(L.warnings=B,P(L)):C({rootElement:T,elementsById:O,references:k,warnings:B})})},Hu.prototype.handler=function(e){return new Fu(this.model,e)};function $0(){var e=[];return Object.defineProperty(e,"peek",{value:function(){return this[this.length-1]}}),e}var j0=`<?xml version="1.0" encoding="UTF-8"?>
|
|
5
|
+
`,F0=/<|>|'|"|&|\n\r|\n/g,gd=/<|>|&/g;function ci(e){this.prefixMap={},this.uriMap={},this.used={},this.wellknown=[],this.custom=[],this.parent=e,this.defaultPrefixMap=e&&e.defaultPrefixMap||{}}ci.prototype.mapDefaultPrefixes=function(e){this.defaultPrefixMap=e},ci.prototype.defaultUriByPrefix=function(e){return this.defaultPrefixMap[e]},ci.prototype.byUri=function(e){return this.uriMap[e]||this.parent&&this.parent.byUri(e)},ci.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)},ci.prototype.uriByPrefix=function(e){return this.prefixMap[e||"xmlns"]||this.parent&&this.parent.uriByPrefix(e)},ci.prototype.mapPrefix=function(e,t){this.prefixMap[e||"xmlns"]=t},ci.prototype.getNSKey=function(e){return e.prefix!==void 0?e.uri+"|"+e.prefix:e.uri},ci.prototype.logUsed=function(e){var t=e.uri,n=this.getNSKey(e);this.used[n]=this.byUri(t),this.parent&&this.parent.logUsed(e)},ci.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 H0(e){return e.charAt(0).toLowerCase()+e.slice(1)}function z0(e,t){return fd(t)?H0(e):e}function yd(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})}function vd(e){return En(e)?e:(e.prefix?e.prefix+":":"")+e.localName}function G0(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 V0(e,t){return t.isGeneric?j({localName:t.ns.localName},e):j({localName:z0(t.ns.localName,t.$pkg)},e)}function W0(e,t){return j({localName:t.ns.localName},e)}function U0(e){var t=e.$descriptor;return $e(t.properties,function(n){var i=n.name;if(n.isVirtual||!Sn(e,i))return!1;var r=e[i];return r===n.default||r===null?!1:n.isMany?r.length:!0})}var q0={"\n":"#10","\n\r":"#10",'"':"#34","'":"#39","<":"#60",">":"#62","&":"#38"},Y0={"<":"lt",">":"gt","&":"amp"};function _d(e,t,n){return e=En(e)?e:""+e,e.replace(t,function(i){return"&"+n[i]+";"})}function K0(e){return _d(e,F0,q0)}function X0(e){return _d(e,gd,Y0)}function Z0(e){return $e(e,function(t){return t.isAttr})}function Q0(e){return $e(e,function(t){return!t.isAttr})}function zu(e){this.tagName=e}zu.prototype.build=function(e){return this.element=e,this},zu.prototype.serializeTo=function(e){e.appendIndent().append("<"+this.tagName+">"+this.element.id+"</"+this.tagName+">").appendNewLine()};function Mr(){}Mr.prototype.serializeValue=Mr.prototype.serializeTo=function(e){e.append(this.escape?X0(this.value):this.value)},Mr.prototype.build=function(e,t){return this.value=t,e.type==="String"&&t.search(gd)!==-1&&(this.escape=!0),this};function Gu(e){this.tagName=e}yd(Gu,Mr),Gu.prototype.serializeTo=function(e){e.appendIndent().append("<"+this.tagName+">"),this.serializeValue(e),e.append("</"+this.tagName+">").appendNewLine()};function gt(e,t){this.body=[],this.attrs=[],this.parent=e,this.propertyDescriptor=t}gt.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=U0(e),this.parseAttributes(Z0(r)),this.parseContainments(Q0(r))),this.parseGenericAttributes(e,i),this},gt.prototype.nsTagName=function(e){var t=this.logNamespaceUsed(e.ns);return V0(t,e)},gt.prototype.nsPropertyTagName=function(e){var t=this.logNamespaceUsed(e.ns);return W0(t,e)},gt.prototype.isLocalNs=function(e){return e.uri===this.ns.uri},gt.prototype.nsAttributeName=function(e){var t;if(En(e)?t=un(e):t=e.ns,e.inherited)return{localName:t.localName};var n=this.logNamespaceUsed(t);return this.getNamespaces().logUsed(n),this.isLocalNs(n)?{localName:t.localName}:j({localName:t.localName},n)},gt.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}))},gt.prototype.parseGenericContainments=function(e){var t=e.$body;t&&this.body.push(new Mr().build({type:"String"},t));var n=e.$children;n&&D(n,i=>{this.body.push(new gt(this).build(i))})},gt.prototype.parseNsAttribute=function(e,t,n){var i=e.$model,r=un(t),o;if(r.prefix==="xmlns"&&(o={prefix:r.localName,uri:n}),!r.prefix&&r.localName==="xmlns"&&(o={uri:n}),!o)return{name:t,value:n};if(i&&i.getPackage(n))this.logNamespace(o,!0,!0);else{var a=this.logNamespaceUsed(o,!0);this.getNamespaces().logUsed(a)}},gt.prototype.parseNsAttributes=function(e){var t=this,n=e.$attrs,i=[];return D(n,function(r,o){var a=t.parseNsAttribute(e,o,r);a&&i.push(a)}),i},gt.prototype.parseGenericAttributes=function(e,t){var n=this;D(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)}})},gt.prototype.parseContainments=function(e){var t=this,n=this.body,i=this.element;D(e,function(r){var o=i.get(r.name),a=r.isReference,s=r.isMany;if(s||(o=[o]),r.isBody)n.push(new Mr().build(r,o[0]));else if(od(r.type))D(o,function(u){n.push(new Gu(t.addTagName(t.nsPropertyTagName(r))).build(r,u))});else if(a)D(o,function(u){n.push(new zu(t.addTagName(t.nsPropertyTagName(r))).build(u))});else{var c=hd(r);D(o,function(u){var l;c?c===dd?l=new gt(t,r):l=new rs(t,r,c):l=new gt(t),n.push(l.build(u))})}})},gt.prototype.getNamespaces=function(e){var t=this.namespaces,n=this.parent,i;return t||(i=n&&n.getNamespaces(),e||!i?this.namespaces=t=new ci(i):t=i),t},gt.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},gt.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},gt.prototype.parseAttributes=function(e){var t=this,n=this.element;D(e,function(i){var r=n.get(i.name);if(i.isReference)if(!i.isMany)r=r.id;else{var o=[];D(r,function(a){o.push(a.id)}),r=o.join(" ")}t.addAttribute(t.nsAttributeName(i),r)})},gt.prototype.addTagName=function(e){var t=this.logNamespaceUsed(e);return this.getNamespaces().logUsed(t),vd(e)},gt.prototype.addAttribute=function(e,t){var n=this.attrs;En(t)&&(t=K0(t));var i=td(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)},gt.prototype.serializeAttributes=function(e){var t=this.attrs,n=this.namespaces;n&&(t=G0(n).concat(t)),D(t,function(i){e.append(" ").append(vd(i.name)).append('="').append(i.value).append('"')})},gt.prototype.serializeTo=function(e){var t=this.body[0],n=t&&t.constructor!==Mr;e.appendIndent().append("<"+this.tagName),this.serializeAttributes(e),e.append(t?">":" />"),t&&(n&&e.appendNewLine().indent(),D(this.body,function(i){i.serializeTo(e)}),n&&e.unindent().appendIndent(),e.append("</"+this.tagName+">")),e.appendNewLine()};function rs(e,t,n){gt.call(this,e,t),this.serialization=n}yd(rs,gt),rs.prototype.parseNsAttributes=function(e){var t=gt.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},rs.prototype.isLocalNs=function(e){return e.uri===(this.typeNs||this.ns).uri};function J0(){this.value="",this.write=function(e){this.value+=e}}function ew(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 tw(e){e=j({format:!1,preamble:!0},e||{});function t(n,i){var r=i||new J0,o=new ew(r,e.format);e.preamble&&o.append(j0);var a=new gt,s=n.$model;if(a.getNamespaces().mapDefaultPrefixes(nw(s)),a.build(n).serializeTo(o),!i)return r.value}return{toXML:t}}function nw(e){const t=e.config&&e.config.nsMap||{},n={};for(const i in Bu)n[i]=Bu[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 os(e,t){Fn.call(this,e,t)}os.prototype=Object.create(Fn.prototype),os.prototype.fromXML=function(e,t,n){En(t)||(n=t,t="bpmn:Definitions");var i=new Hu(j({model:this,lax:!0},n)),r=i.handler(t);return i.fromXML(e,r)},os.prototype.toXML=function(e,t){var n=new tw(t);return new Promise(function(i,r){try{var o=n.toXML(e);return i({xml:o})}catch(a){return r(a)}})};var iw="BPMN20",rw="http://www.omg.org/spec/BPMN/20100524/MODEL",ow="bpmn",aw=[],sw=[{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"}]}],cw=[{name:"ProcessType",literalValues:[{name:"None"},{name:"Public"},{name:"Private"}]},{name:"GatewayDirection",literalValues:[{name:"Unspecified"},{name:"Converging"},{name:"Diverging"},{name:"Mixed"}]},{name:"EventBasedGatewayType",literalValues:[{name:"Parallel"},{name:"Exclusive"}]},{name:"RelationshipDirection",literalValues:[{name:"None"},{name:"Forward"},{name:"Backward"},{name:"Both"}]},{name:"ItemKind",literalValues:[{name:"Physical"},{name:"Information"}]},{name:"ChoreographyLoopType",literalValues:[{name:"None"},{name:"Standard"},{name:"MultiInstanceSequential"},{name:"MultiInstanceParallel"}]},{name:"AssociationDirection",literalValues:[{name:"None"},{name:"One"},{name:"Both"}]},{name:"MultiInstanceBehavior",literalValues:[{name:"None"},{name:"One"},{name:"All"},{name:"Complex"}]},{name:"AdHocOrdering",literalValues:[{name:"Parallel"},{name:"Sequential"}]}],uw={tagAlias:"lowerCase",typePrefix:"t"},lw={name:iw,uri:rw,prefix:ow,associations:aw,types:sw,enumerations:cw,xml:uw},pw="BPMNDI",fw="http://www.omg.org/spec/BPMN/20100524/DI",dw="bpmndi",hw=[{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"]}],mw=[{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"}]}],gw=[],yw={name:pw,uri:fw,prefix:dw,types:hw,enumerations:mw,associations:gw},vw="DC",_w="http://www.omg.org/spec/DD/20100524/DC",bw="dc",xw=[{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}]}],ww=[],Ew={name:vw,uri:_w,prefix:bw,types:xw,associations:ww},Sw="DI",Rw="http://www.omg.org/spec/DD/20100524/DI",Cw="di",Pw=[{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"}]}],Aw=[],Tw={tagAlias:"lowerCase"},Mw={name:Sw,uri:Rw,prefix:Cw,types:Pw,associations:Aw,xml:Tw},kw="bpmn.io colors for BPMN",Ow="http://bpmn.io/schema/bpmn/biocolor/1.0",Dw="bioc",Lw=[{name:"ColoredShape",extends:["bpmndi:BPMNShape"],properties:[{name:"stroke",isAttr:!0,type:"String"},{name:"fill",isAttr:!0,type:"String"}]},{name:"ColoredEdge",extends:["bpmndi:BPMNEdge"],properties:[{name:"stroke",isAttr:!0,type:"String"},{name:"fill",isAttr:!0,type:"String"}]}],Iw=[],Nw=[],Bw={name:kw,uri:Ow,prefix:Dw,types:Lw,enumerations:Iw,associations:Nw},$w="BPMN in Color",jw="http://www.omg.org/spec/BPMN/non-normative/color/1.0",Fw="color",Hw=[{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"}]}],zw=[],Gw=[],Vw={name:$w,uri:jw,prefix:Fw,types:Hw,enumerations:zw,associations:Gw};const Ww={bpmn:lw,bpmndi:yw,dc:Ew,di:Mw,bioc:Bw,color:Vw};function bd(e,t){const n=j({},Ww,e);return new os(n,t)}const Uw={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"}},qw="http://www.omg.org/spec/BPMN/non-normative/extensions/i18n/1.0",xd="i18n",as={[xd]:Uw,[Cu]:Xf};function wd(){return bd(as)}const Ed=wd();async function Vu(e){const{rootElement:t,warnings:n}=await Ed.fromXML(e,"bpmn:Definitions");return{definitions:t,warnings:n}}async function Yw(e){const{xml:t}=await Ed.toXML(e,{format:!0});return t}function Wu(e){return e.map(t=>typeof t=="string"?t:t.message??String(t))}const so={cjkEm:.865,upperEm:.68,lowerEm:.5,digitEm:.556,spaceEm:.278,otherEm:.35,ascentEm:.9,descentEm:.25},Kw=/[ᄀ-ᇿ -〿-ヿ㐀-鿿가--⦆]/;function Xw(e){const t=so;return Kw.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 co(e,t){let n=0;for(const i of e)n+=t*Xw(i);return n}function Sd(e=globalThis,{textMeasurement:t="approximate"}={}){if(!(e!=null&&e.SVGElement))throw new Error("installHeadlessBpmnDom: DOM 전역이 없다 — jsdom window 를 전역에 올린 뒤 호출할 것");t==="approximate"&&Zw(e),Qw(e),Jw(e),eE(e)}function Zw(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:co(r,o),fontBoundingBoxAscent:o*so.ascentEm,fontBoundingBoxDescent:o*so.descentEm,actualBoundingBoxAscent:o*so.ascentEm,actualBoundingBoxDescent:o*so.descentEm}}};t.getContext=()=>n}function Qw(e){if(e.SVGMatrix)return;class t{constructor(){eo(this,"a",1);eo(this,"b",0);eo(this,"c",0);eo(this,"d",1);eo(this,"e",0);eo(this,"f",0)}static of(i,r,o,a,s,c){return Object.assign(new t,{a:i,b:r,c:o,d:a,e:s,f:c})}multiply(i){return t.of(this.a*i.a+this.c*i.b,this.b*i.a+this.d*i.b,this.a*i.c+this.c*i.d,this.b*i.c+this.d*i.d,this.a*i.e+this.c*i.f+this.e,this.b*i.e+this.d*i.f+this.f)}translate(i,r){return this.multiply(t.of(1,0,0,1,i,r))}scale(i,r=i){return this.multiply(t.of(i,0,0,r,0,0))}inverse(){const i=this.a*this.d-this.b*this.c;return t.of(this.d/i,-this.b/i,-this.c/i,this.a/i,(this.c*this.f-this.d*this.e)/i,(this.b*this.e-this.a*this.f)/i)}}e.SVGMatrix=t}function Jw(e){var o;const t=()=>{const a=new e.SVGMatrix;return{type:0,matrix:a,setTranslate(s,c){a.e=s,a.f=c},setScale(s,c){a.a=s,a.d=c},setRotate(s,c=0,u=0){const l=s*Math.PI/180,f=Math.cos(l),p=Math.sin(l);a.a=f,a.b=p,a.c=-p,a.d=f,a.e=c-f*c+p*u,a.f=u-p*c-f*u},setMatrix(s){Object.assign(a,s)}}},n=a=>{const s=t();return Object.assign(s.matrix,a),s},i=(o=e.SVGSVGElement)==null?void 0:o.prototype;i&&!i.createSVGTransform&&(i.createSVGTransform=t,i.createSVGTransformFromMatrix=n,i.createSVGMatrix=()=>new e.SVGMatrix,i.createSVGPoint=()=>({x:0,y:0,matrixTransform:()=>({x:0,y:0})}));const r=e.SVGElement.prototype;Object.getOwnPropertyDescriptor(r,"transform")||Object.defineProperty(r,"transform",{configurable:!0,get(){if(!this.__headlessTransformList){const a=[];this.__headlessTransformList={baseVal:{get numberOfItems(){return a.length},clear:()=>{a.length=0},appendItem:s=>(a.push(s),s),getItem:s=>a[s],createSVGTransformFromMatrix:n,consolidate:()=>a[a.length-1]??null}}}return this.__headlessTransformList}})}function eE(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:co(n,12),height:14}})}const ss=new Set(["bpmn:Participant","bpmn:Lane","bpmn:Group","bpmn:SubProcess","bpmn:AdHocSubProcess","bpmn:Transaction"]),tE=1,nE=2;function Pi(e){switch(e.kind){case"label-over-line":return`L|${e.edge}|${e.line}`;case"edge-crosses-shape":return`x|${e.edge}|${e.shape}`;case"shape-overlap":return`o|${e.shapes[0]}|${e.shapes[1]}`;case"shape-outside-container":return`c|${e.shape}|${e.container}`;case"edge-overlap-opposite":return`p|${e.edges[0]}|${e.edges[1]}`;case"edge-overlap-mixed":return`m|${e.edges[0]}|${e.edges[1]}`;case"label-on-shared-segment":return`l|${e.edge}|${e.other}`;case"annotation-over-label":return`a|${e.annotation}|${e.label}`;case"group-overlap-unintended":return`g|${e.groups[0]}|${e.groups[1]}`;case"group-on-container-boundary":return`gb|${e.group}|${e.container}|${e.side}`;case"group-on-group-boundary":return`gg|${e.groups[0]}|${e.groups[1]}|${e.axis}`;case"pool-name-over-label":return`pn|${e.pool}|${e.label}`}}const Rd=20,Cd=5,Pd=3,Ad=12,iE=Ad*1.2;function Uu(e,t){const n=t.split(/\r?\n/),i=Math.max(...n.map(o=>co(o,Ad))),r=n.length*iE;return{x:e.x+e.width/2-i/2,y:e.y+e.height/2-r/2,width:i,height:r}}const Td=1;function hn(e){const t=[];for(let n=0;n+1<e.waypoints.length;n++){const i=e.waypoints[n],r=e.waypoints[n+1];Math.abs(i.y-r.y)<.5&&Math.abs(i.x-r.x)>=.5?t.push({axis:"h",at:i.y,lo:Math.min(i.x,r.x),hi:Math.max(i.x,r.x),dir:r.x>i.x?1:-1}):Math.abs(i.x-r.x)<.5&&Math.abs(i.y-r.y)>=.5&&t.push({axis:"v",at:i.x,lo:Math.min(i.y,r.y),hi:Math.max(i.y,r.y),dir:r.y>i.y?1:-1})}return t}function cs(e,t){let n=null;const i=e.type!==t.type;for(const r of hn(e))for(const o of hn(t)){if(r.axis!==o.axis||Math.abs(r.at-o.at)>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>=Rd&&(!n||s>n.length)&&(n={axis:r.axis,length:s,kind:a})}return n}function Md(e,t){const n=cs(e,t);return n&&n.kind==="opposite"?{axis:n.axis,length:n.length}:null}function rE(e,t){let n=0;for(const i of t)i.id!==e.id&&Md(e,i)&&n++;return n}function Ai(e,t){let n=0;for(const i of t)i.id!==e.id&&cs(e,i)&&n++;return n}const kd=15,Od=20;function oE(e,t){const n=t.axis==="v"?[e.x,e.x+e.width]:[e.y,e.y+e.height];if(t.at<n[0]-Od||t.at>n[1]+Od)return null;const i=t.axis==="v"?[e.y,e.y+e.height]:[e.x,e.x+e.width],r=Math.max(i[0],t.lo),o=Math.min(i[1],t.hi);return o>r?[r,o]:null}const qu=20;function us(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<Rd||n.push([r-qu,o+qu])}return n}function ls(e,t){const n=e.label;if(!n)return null;let i=null;for(const r of hn(e)){const o=oE(n,r);if(o){for(const a of t)if(a.id!==e.id&&!(i&&a.id>=i.other)){for(const[s,c]of us(r,hn(a)))if(Math.min(c,o[1])>Math.max(s,o[0])){i={other:a.id,axis:r.axis};break}}}}return i}const aE=1,sE=(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 cE(e,t,n,i){const r=n.x+i,o=n.y+i,a=n.x+n.width-i,s=n.y+n.height-i;if(a<=r||s<=o)return!1;const c=t.x-e.x,u=t.y-e.y;let l=0,f=1;const p=(d,h)=>{if(h===0)return d<=0;const m=d/h;if(h>0){if(m>f)return!1;m>l&&(l=m)}else{if(m<l)return!1;m<f&&(f=m)}return!0};return p(r-e.x,c)&&p(e.x-a,-c)&&p(o-e.y,u)&&p(e.y-s,-u)&&f>l}function Yu(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 uE=(e,t)=>e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height,uo=1;function Ti(e,t){const n=e.x+uo,i=e.x+e.width-uo,r=e.y+uo,o=e.y+e.height-uo;return t.axis==="h"?t.at>r&&t.at<o&&t.lo<i&&t.hi>n:t.at>n&&t.at<i&&t.lo<o&&t.hi>r}function Yo(e){return[{axis:"h",at:e.y,lo:e.x,hi:e.x+e.width,dir:1},{axis:"h",at:e.y+e.height,lo:e.x,hi:e.x+e.width,dir:1},{axis:"v",at:e.x,lo:e.y,hi:e.y+e.height,dir:1},{axis:"v",at:e.x+e.width,lo:e.y,hi:e.y+e.height,dir:1}]}function Dd(e,t){const n=e.label;if(!n)return null;if(hn(e).some(i=>Ti(n,i)))return e.id;for(const i of[...t.edges].filter(r=>r.id!==e.id).sort((r,o)=>r.id.localeCompare(o.id)))if(hn(i).some(r=>Ti(n,r)))return i.id;for(const i of t.shapes.filter(r=>r.container).sort((r,o)=>r.id.localeCompare(o.id)))if(Yo(i).some(r=>Ti(n,r)))return i.id;return null}function Hn(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(cE(e.waypoints[o],e.waypoints[o+1],r,nE)){i.push(r);break}}return i}function lE(e,t,n,i){const r=(u,l,f)=>(l.x-u.x)*(f.y-u.y)-(l.y-u.y)*(f.x-u.x),o=r(n,i,e),a=r(n,i,t),s=r(e,t,n),c=r(e,t,i);return o*a<0&&s*c<0}const Ld=(e,t)=>e.endpoints.some(n=>t.endpoints.includes(n));function ps(e,t){let n=0;for(const i of t){if(i.id===e.id||Ld(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++)lE(e.waypoints[o],e.waypoints[o+1],i.waypoints[a],i.waypoints[a+1])&&(r=!0);r&&n++}return n}function Mi(e,t){let n=0;for(const i of t)i.id===e.id||Ld(e,i)||ps(e,[i])>0&&(n+=i.type===e.type?2:1);return n}function Id(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++)ps(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(ps(n[i],[n[r]])>0){const o=n[i].id,a=n[r].id;t.push(o<a?[o,a]:[a,o])}return t.sort((i,r)=>`${i[0]}|${i[1]}`.localeCompare(`${r[0]}|${r[1]}`))}function Nd(e){var n;const t=(n=yt(e==null?void 0:e.extensionElements))==null?void 0:n.values;if(Array.isArray(t))for(const i of t){const r=yt(i);if((r==null?void 0:r.$type)!=="bwl:Members"||typeof r.refs!="string")continue;const o=r.refs.split(/\s+/).filter(Boolean);return o.length?o:void 0}}const Bd=e=>e?{members:e}:{},ui=e=>e.shapes.filter(t=>!t.container);function pE(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 $d(e,t){const n=e.label;if(!n)return null;for(const i of[...t.edges].sort((r,o)=>r.id.localeCompare(o.id)))if(hn(i).some(r=>Ti(n,r)))return i.id;for(const i of[...t.shapes].filter(r=>r.container).sort((r,o)=>r.id.localeCompare(o.id)))if(Yo(i).some(r=>Ti(n,r)))return i.id;return null}function Ko(e){const t=[];for(const n of e.shapes)n.label&&t.push({owner:n.id,rect:n.label});for(const n of e.edges)n.label&&t.push({owner:n.id,rect:n.label});return t}function ki(e){const t=[],n=e.shapes.filter(p=>!p.container);for(const p of e.edges)for(const d of Hn(p,n))t.push({kind:"edge-crosses-shape",edge:p.id,shape:d.id});const i=n.filter(p=>!p.attached);for(let p=0;p<i.length;p++)for(let d=p+1;d<i.length;d++){const h=i[p],m=i[d];if(!Yu(h,m,tE))continue;const g=h.id<m.id?[h.id,m.id]:[m.id,h.id];t.push({kind:"shape-overlap",shapes:g,identical:uE(h,m)})}const r=e.shapes.filter(p=>p.type==="bpmn:Group"&&Array.isArray(p.members)&&p.members.length>0);for(let p=0;p<r.length;p++)for(let d=p+1;d<r.length;d++){const h=r[p],m=r[d],g=Math.min(h.x+h.width,m.x+m.width)-Math.max(h.x,m.x),S=Math.min(h.y+h.height,m.y+m.height)-Math.max(h.y,m.y);if(g<=Cd||S<=Cd)continue;const E=new Set(m.members);h.members.some(x=>E.has(x))||t.push({kind:"group-overlap-unintended",groups:h.id<m.id?[h.id,m.id]:[m.id,h.id]})}const o=e.shapes.filter(p=>p.container&&p.type!=="bpmn:Group"&&p.type!=="bpmn:Lane");for(const p of e.shapes.filter(d=>d.type==="bpmn:Group"))for(const d of o){const h=p.x<d.x+d.width&&d.x<p.x+p.width,m=p.y<d.y+d.height&&d.y<p.y+p.height,g=[["top",p.y,d.y,h],["bottom",p.y+p.height,d.y+d.height,h],["left",p.x,d.x,m],["right",p.x+p.width,d.x+d.width,m]];for(const[S,E,x,w]of g)w&&Math.abs(E-x)<=Pd&&t.push({kind:"group-on-container-boundary",group:p.id,container:d.id,side:S})}const a=e.shapes.filter(p=>p.type==="bpmn:Group");for(let p=0;p<a.length;p++)for(let d=p+1;d<a.length;d++){const h=a[p],m=a[d],g=h.x<m.x+m.width&&m.x<h.x+h.width,S=h.y<m.y+m.height&&m.y<h.y+h.height,E=[["x",h.x+h.width,m.x,S],["x",m.x+m.width,h.x,S],["y",h.y+h.height,m.y,g],["y",m.y+m.height,h.y,g]];for(const[x,w,C,P]of E)if(P&&Math.abs(w-C)<=Pd){t.push({kind:"group-on-group-boundary",groups:h.id<m.id?[h.id,m.id]:[m.id,h.id],axis:x});break}}for(let p=0;p<e.edges.length;p++)for(let d=p+1;d<e.edges.length;d++){const h=e.edges[p],m=e.edges[d],g=cs(h,m);if(!g)continue;const S=h.id<m.id?[h.id,m.id]:[m.id,h.id];t.push({kind:g.kind==="opposite"?"edge-overlap-opposite":"edge-overlap-mixed",edges:S,axis:g.axis,length:Math.round(g.length)})}for(const p of e.edges){if(!p.label)continue;const d=ls(p,e.edges);d&&t.push({kind:"label-on-shared-segment",edge:p.id,other:d.other,axis:d.axis})}for(const p of e.edges){if(!p.label)continue;const d=Dd(p,e);d&&t.push({kind:"label-over-line",edge:p.id,line:d})}const s=new Set(n.map(p=>p.id)),c=e.shapes.filter(p=>p.type==="bpmn:Participant"&&p.label);for(const p of[...n,...c.filter(d=>!s.has(d.id))]){if(!p.label)continue;const d=$d(p,e);d&&t.push({kind:"label-over-line",edge:p.id,line:d})}const u=new Set(e.shapes.filter(p=>p.type==="bpmn:TextAnnotation").map(p=>p.id));for(const p of c)for(const{owner:d,rect:h}of Ko(e))d===p.id||u.has(d)||Yu(p.label,h,uo)&&t.push({kind:"pool-name-over-label",pool:p.id,label:d});const l=Ko(e);for(const p of n)if(p.type==="bpmn:TextAnnotation")for(const{owner:d,rect:h}of l)d!==p.id&&Yu(p,h,uo)&&t.push({kind:"annotation-over-label",annotation:p.id,label:d});const f=new Map(e.shapes.map(p=>[p.id,p]));for(const p of n){const d=p.parent??pE(p,e,f);if(!d)continue;const h=f.get(d);!h||!h.container||sE(h,p,aE)||t.push({kind:"shape-outside-container",shape:p.id,container:h.id})}return t.sort((p,d)=>Pi(p).localeCompare(Pi(d)))}const yt=e=>typeof e=="object"&&e!==null?e:void 0,Ct=e=>typeof e=="number"?e:0,kr=e=>{const t=yt(e);return typeof(t==null?void 0:t.id)=="string"?t.id:void 0};function fE(e){const t=yt(e);if(!t)return[];const n=[];for(const i of["sourceRef","targetRef"]){const r=t[i];for(const o of Array.isArray(r)?r:[r]){const a=kr(o);a&&n.push(a)}}return n}function dE(e,t){const n=yt(e.$parent);if(!n)return;const i=typeof n.$type=="string"?n.$type:"";if(i==="bpmn:Process"){const r=kr(n);return r?t.get(r):void 0}if(ss.has(i)&&i!=="bpmn:Lane"&&i!=="bpmn:Group")return kr(n)}function jd(e){var a,s,c,u,l;const t=[],n=[],i=((a=yt(e))==null?void 0:a.diagrams)??[],r=new Map,o=new Set;for(const f of((s=yt(e))==null?void 0:s.rootElements)??[]){const p=yt(f);if((p==null?void 0:p.$type)==="bpmn:Collaboration")for(const d of p.participants??[]){const h=yt(d),m=kr(h),g=kr(h==null?void 0:h.processRef);m&&g?r.set(g,m):m&&o.add(m)}}for(const f of i){const p=yt((c=yt(f))==null?void 0:c.plane),d=(p==null?void 0:p.planeElement)??[];for(const h of d){const m=yt(h);if(!m)continue;const g=yt(m.bpmnElement),S=typeof(g==null?void 0:g.id)=="string"?g.id:void 0;if(!S)continue;const E=typeof(g==null?void 0:g.$type)=="string"?g.$type:"",x=yt(m.bounds);if(x){const C=m.isExpanded===!1&&E!=="bpmn:Participant",P=yt((u=yt(m.label))==null?void 0:u.bounds),L={id:S,type:E,x:Ct(x.x),y:Ct(x.y),width:Ct(x.width),height:Ct(x.height),container:ss.has(E)&&!C,attached:(g==null?void 0:g.attachedToRef)!==void 0,...g?{parent:dE(g,r)}:{},...P?{label:{x:Ct(P.x),y:Ct(P.y),width:Ct(P.width),height:Ct(P.height)}}:{},...E==="bpmn:Group"?Bd(Nd(g)):{}},T=m.isHorizontal!==!1,B=typeof(g==null?void 0:g.name)=="string"?g.name:"";o.has(S)&&T&&B&&(L.label=Uu(L,B)),t.push(L);continue}const w=m.waypoint;if(Array.isArray(w)){const C=yt((l=yt(m.label))==null?void 0:l.bounds);n.push({id:S,type:E,waypoints:w.map(P=>{var L,T;return{x:Ct((L=yt(P))==null?void 0:L.x),y:Ct((T=yt(P))==null?void 0:T.y)}}),endpoints:fE(g),...C?{label:{x:Ct(C.x),y:Ct(C.y),width:Ct(C.width),height:Ct(C.height)}}:{}})}}}return{shapes:t,edges:n}}function Fd(e){return ki(jd(e))}async function hE(e){const{definitions:t,warnings:n}=await Vu(e);return{findings:Fd(t),warnings:n}}function Tt(e){var i;const t=[],n=[];for(const r of e.getAll()){const o=r;if(o.type==="label"||o.labelTarget)continue;const a=typeof o.type=="string"?o.type:"";if(a==="bpmn:Definitions"||a.startsWith("bpmndi:"))continue;const s=o.waypoints;if(s){const m=yt(o.label);n.push({id:o.id,type:a,waypoints:s.map(g=>({x:Ct(g.x),y:Ct(g.y)})),endpoints:[kr(o.source),kr(o.target)].filter(g=>!!g),...m&&typeof m.x=="number"?{label:{x:m.x,y:Ct(m.y),width:Ct(m.width),height:Ct(m.height)}}:{}});continue}if(typeof o.x!="number"||typeof o.y!="number")continue;const c=yt(o.businessObject),u=yt(o.label);let l=yt(o.parent);for(;l&&l.type==="bpmn:Lane";)l=yt(l.parent);const f=typeof(l==null?void 0:l.type)=="string"?l.type:"",p=l&&ss.has(f)&&f!=="bpmn:Group"&&typeof l.id=="string"?l.id:void 0,d={id:o.id,type:a,x:o.x,y:o.y,width:Ct(o.width),height:Ct(o.height),container:ss.has(a)&&(a==="bpmn:Participant"||o.collapsed!==!0),attached:(c==null?void 0:c.attachedToRef)!==void 0,...p!==void 0?{parent:p}:{},...u&&typeof u.x=="number"?{label:{x:u.x,y:Ct(u.y),width:Ct(u.width),height:Ct(u.height)}}:{},...a==="bpmn:Group"?Bd(Nd(c)):{}},h=typeof(c==null?void 0:c.name)=="string"?c.name:"";a==="bpmn:Participant"&&!(c!=null&&c.processRef)&&h&&((i=yt(o.di))==null?void 0:i.isHorizontal)!==!1&&(d.label=Uu(d,h)),t.push(d)}return{shapes:t,edges:n}}const mE={"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 gE(e,t){const n=mE[e];return n||(e==="label"||e.startsWith("bpmndi:")?"other":e.startsWith("bpmn:")&&!("waypoints"in t&&t.waypoints)?"flowNode":"other")}function Hd(e){let t=e.parent;for(;t;){if(t.type==="bpmn:Participant")return t.id;t=t.parent}}function zd(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 gE(i.type,i)},lanesOf:n=>t().filter(i=>i.type==="bpmn:Lane"&&Hd(i)===n).sort((i,r)=>i.y-r.y).map(i=>i.id),participantOf:n=>{const i=e.get(n);return i?Hd(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 Gd=20,yE=4,Dt=(e,t)=>Math.abs(e-t)<.5;function Vd(e,t,n,i=Gd){if(Dt(e.y,t.y)&&!Dt(e.x,t.x)){const r=Math.min(e.x,t.x),o=Math.max(e.x,t.x);if(!(r<n.x-i&&n.x+n.width+i<o))return null;const a=e.x<t.x?n.x-i:n.x+n.width+i,s=e.x<t.x?n.x+n.width+i:n.x-i,c=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(Dt(e.x,t.x)&&!Dt(e.y,t.y)){const r=Math.min(e.y,t.y),o=Math.max(e.y,t.y);if(!(r<n.y-i&&n.y+n.height+i<o))return null;const a=e.y<t.y?n.y-i:n.y+n.height+i,s=e.y<t.y?n.y+n.height+i:n.y-i,c=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 Wd(e,t,n=Gd){if(e.length!==4)return null;const[i,r,o,a]=e;if(Dt(i.y,r.y)&&Dt(r.x,o.x)&&Dt(o.y,a.y)){const s=c=>[i,{x:c,y:i.y},{x:c,y:a.y},a];return[s(t.x-n),s(t.x+t.width+n)]}if(Dt(i.x,r.x)&&Dt(r.y,o.y)&&Dt(o.x,a.x)){const s=c=>[i,{x:i.x,y:c},{x:a.x,y:c},a];return[s(t.y-n),s(t.y+t.height+n)]}return null}function Xu(e,t){if(e.endpoints.length!==2)return[];const n=t.find(f=>f.id===e.endpoints[0]),i=t.find(f=>f.id===e.endpoints[1]);if(!n||!i)return[];if(i.x<=n.x+n.width)return[];const r=n.y+n.height/2,o=i.y+i.height/2;if(r>=i.y&&r<=i.y+i.height)return[];const a=i.x+i.width/2,s=n.x+n.width/2,c=r>o,u=[{x:n.x+n.width,y:r},{x:a,y:r},{x:a,y:c?i.y+i.height:i.y}],l=[{x:s,y:c?n.y:n.y+n.height},{x:s,y:o},{x:i.x,y:o}];return[u,l]}const Ud=30,vE=[0,-25,25,-40,40];function _E(e,t){if(e.type!=="bpmn:MessageFlow"||e.endpoints.length!==2)return[];const n=t.find(p=>p.id===e.endpoints[0]),i=t.find(p=>p.id===e.endpoints[1]);if(!n||!i)return[];const r=n.y+n.height/2,o=i.y+i.height/2;if(i.y<n.y+n.height&&i.y+i.height>n.y)return[];const a=o<r,s=a?n.y+n.height:n.y,c=a?s+Ud:s-Ud,u=a?i.y+i.height:i.y,l=n.x+n.width/2,f=i.x+i.width/2;return vE.map(p=>[{x:l,y:s},{x:l,y:c},{x:f+p,y:c},{x:f+p,y:u}])}const bE=(e,t,n)=>[...e.slice(0,t+1),...n,...e.slice(t+1)],fs=(e,t,n)=>Hn({...e,waypoints:t},n).length;function qd(e,t,n,i){let r=[...e.waypoints],o=fs(e,r,t);if(o===0)return null;let a=!1;for(const f of Xu(e,t))if(fs(e,f,t)===0)return f;const s=(i??[]).filter(f=>f.id!==e.id).flatMap(hn),c=f=>hn({...e,waypoints:f}).some(p=>us(p,s).length>0),u=_E(e,t).filter(f=>fs(e,f,t)===0);if(u.length)return u.find(f=>!c(f))??u[0];const l=f=>!n||f.every(p=>p.x>=n.x&&p.x<=n.x+n.width&&p.y>=n.y&&p.y<=n.y+n.height);for(let f=0;f<yE&&o>0;f++){let p=!1;for(let d=0;d+1<r.length&&!p;d++){const h=r[d],m=r[d+1];for(const g of t){if(e.endpoints.includes(g.id)||Hn({...e,waypoints:[h,m]},[g]).length===0)continue;const S=Vd(h,m,g),E=S?S.map(w=>bE(r,d,w)):Wd(r,g)??[];if(!E.length)continue;const x=[...E].sort((w,C)=>Number(l(C))-Number(l(w)));for(const w of x){const C=fs(e,w,t);if(C<o){r=w,o=C,p=!0,a=!0;break}}if(p)break}}if(!p)break}return a&&o===0?r:null}function Yd(e,t){const{elementRegistry:n}=e,i=e.modeling,r=Tt(n),o=ui(r),a=ki(r).filter(c=>c.kind==="edge-crosses-shape"&&!t.has(Pi(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 f=l.parent,p=f&&typeof f.x=="number"&&typeof f.width=="number"?{x:f.x,y:f.y,width:f.width,height:f.height}:void 0,d=qd(u,o,p,r.edges);if(!d)continue;const h=r.edges.filter(S=>S.id!==c),m=Ai(u,h);Ai({...u,waypoints:d},h)>m||i.updateWaypoints(l,d)}}const xE=10;function Kd(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 Xd(e,t){if(e.waypoints.length<2||e.endpoints.length!==2)return null;const n=t.shapes.filter($=>$.type==="bpmn:Participant"&&$.container),i=t.shapes.find($=>$.id===e.endpoints[0]),r=t.shapes.find($=>$.id===e.endpoints[1]);if(!i||!r)return null;const o=Kd(i,n),a=Kd(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($=>$.id!==o.id&&$.id!==a.id&&$.y>=c.y+c.height&&$.y+$.height<=u.y).sort(($,ne)=>$.y-ne.y);if(!l.length)return null;const f=l[0],p=l[l.length-1],d=(c.y+c.height+f.y)/2,h=(p.y+p.height+u.y)/2,m=s?d:h,g=s?h:d,S=e.waypoints[0],E=e.waypoints[e.waypoints.length-1],x=ui(t),w=t.edges.filter($=>$.id!==e.id),C=Mi(e,w),P=Hn(e,x).length;if(C===0&&P===0||P===0&&e.waypoints.length===2)return null;const L=Math.min(...l.map($=>$.x)),T=Math.max(...l.map($=>$.x+$.width)),B=(S.x+E.x)/2,k=$=>$.filter((ne,le)=>le===0||!(Dt(ne.x,$[le-1].x)&&Dt(ne.y,$[le-1].y)));let O;for(let $=L;$<=T;$+=xE){const ne=k([S,{x:S.x,y:m},{x:$,y:m},{x:$,y:g},{x:E.x,y:g},E]),le={...e,waypoints:ne};if(Hn(le,x).length>0)continue;const je=Mi(le,w),W=Math.abs($-B);(!O||je<O.cross||je===O.cross&&W<O.detour)&&(O={pts:ne,cross:je,detour:W})}return O&&(P>0?O.cross<=C:O.cross<C)?O.pts:null}function Zd(e,t){const{elementRegistry:n}=e,i=e.modeling,r=Tt(n);for(const o of r.edges){if(o.type!=="bpmn:MessageFlow"||t.has(o.id))continue;const a=Tt(n),s=a.edges.find(l=>l.id===o.id);if(!s)continue;const c=Xd(s,a);if(!c)continue;const u=n.get(o.id);u&&i.updateWaypoints(u,c)}}const lo=[25,-25,40,-40],ds=35;function Qd(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-ds:n.y+n.height+ds,f=[];for(const E of[0,...lo]){if(Math.abs(E)>=i.width/2-5)continue;const x=o+E;f.push({pts:[{x:n.x,y:r},{x,y:r},{x,y:c}],cost:Math.abs(E)});for(const w of[0,...lo]){if(Math.abs(w)>=n.width/2-5)continue;const C=a+w;f.push({pts:[{x:C,y:u},{x:C,y:l},{x,y:l},{x,y:c}],cost:Math.abs(E)+Math.abs(w)})}}const p=50,d=i.y+i.height/2,h=s?n.y+n.height:n.y;for(const E of[0,...lo]){if(Math.abs(E)>=n.width/2-5)continue;const x=a+E;f.push({pts:[{x,y:h},{x,y:d},{x:i.x+i.width,y:d}],cost:p+Math.abs(E)})}const m=60,g=s?i.y+i.height:i.y,S=s?i.y+i.height+ds:i.y-ds;for(const E of[0,...lo]){if(Math.abs(E)>=i.width/2-5)continue;const x=o+E;for(const w of[0,...lo]){if(Math.abs(w)>=n.width/2-5)continue;const C=a+w;f.push({pts:[{x:C,y:h},{x:C,y:S},{x,y:S},{x,y:g}],cost:m+Math.abs(E)+Math.abs(w)})}}return f}const hs=30;function Jd(e,t){for(let n=1;n<e.length-2;n++){const i=e[n],r=e[n+1],o=Dt(i.y,r.y)&&!Dt(i.x,r.x),a=Dt(i.x,r.x)&&!Dt(i.y,r.y);if(!(!o&&!a))for(const s of t)if(o){const c=Math.min(i.x,r.x);if(Math.max(i.x,r.x)<=s.x||c>=s.x+s.width)continue;if(Math.abs(i.y-s.y)<hs||Math.abs(i.y-(s.y+s.height))<hs)return!0}else{const c=Math.min(i.y,r.y);if(Math.max(i.y,r.y)<=s.y||c>=s.y+s.height)continue;if(Math.abs(i.x-s.x)<hs||Math.abs(i.x-(s.x+s.width))<hs)return!0}}return!1}const ms=40;function wE(e,t,n){let i=0;for(const r of t){if(r.container||n.includes(r.id))continue;const o=r.x-ms,a=r.x+r.width+ms,s=r.y-ms,c=r.y+r.height+ms;for(let u=1;u<e.length-2;u++){const l=e[u],f=e[u+1],p={x:Math.min(l.x,f.x),y:Math.min(l.y,f.y)},d={x:Math.max(l.x,f.x),y:Math.max(l.y,f.y)};if(p.x<a&&d.x>o&&p.y<c&&d.y>s){i++;break}}}return i}function eh(e,t){if(e.type!=="bpmn:SequenceFlow")return null;const n=t.shapes.filter(P=>P.container),i=new Map(t.shapes.map(P=>[P.id,P])),r=ui(t),o=t.edges.filter(P=>P.id!==e.id),a=Ai(e,o),s=Mi(e,o),c=P=>wE(P,t.shapes,e.endpoints)+(Jd(P,n)?1:0),u=c(e.waypoints),l=P=>{if(!P)return;const L=P.x+P.width/2,T=P.y+P.height/2;return n.find(B=>B.type==="bpmn:Lane"&&L>=B.x&&L<=B.x+B.width&&T>=B.y&&T<=B.y+B.height)},f=l(i.get(e.endpoints[0]??"")),p=l(i.get(e.endpoints[1]??"")),d=!!f&&!!p&&f.id!==p.id,h=P=>{if(!d||!p)return!1;for(let L=1;L<P.length-2;L++){const T=P[L],B=P[L+1];if(Dt(T.y,B.y)&&!Dt(T.x,B.x)&&T.y>p.y&&T.y<p.y+p.height)return!0}return!1},m=h(e.waypoints),S=(P=>{if(!P)return;const L=P.x+P.width/2,T=P.y+P.height/2;return n.filter(B=>B.type==="bpmn:Participant"&&L>=B.x&&L<=B.x+B.width&&T>=B.y&&T<=B.y+B.height).sort((B,k)=>B.width*B.height-k.width*k.height)[0]})(i.get(e.endpoints[0]??"")),E=P=>{if(!S)return 0;let L=0;for(let T=1;T<P.length-1;T++){const B=P[T];(B.x<S.x||B.x>S.x+S.width||B.y<S.y||B.y>S.y+S.height)&&L++}return L},x=E(e.waypoints);if(!Jd(e.waypoints,n)&&!(d&&!m)&&x===0)return null;const w=P=>P.reduce((L,T,B)=>B?L+Math.abs(T.x-P[B-1].x)+Math.abs(T.y-P[B-1].y):0,0);let C;for(const{pts:P,cost:L}of Qd(e,i)){const T={...e,waypoints:P};if(Hn(T,r).length>0)continue;const B=Ai(T,o);if(B>a)continue;const k=E(P);if(k>x)continue;const O=k<x&&B===0;if(!O&&Mi(T,o)>s)continue;const $=c(P),ne=h(P);if(!O&&!(ne&&!m)&&$>=u)continue;const je=ne?0:1,W=w(P);(!C||k<C.out||k===C.out&&(je<C.lane||je===C.lane&&(B<C.opp||B===C.opp&&($<C.sc||$===C.sc&&(L<C.cost||L===C.cost&&W<C.len)))))&&(C={pts:P,out:k,sc:$,lane:je,opp:B,cost:L,len:W})}return(C==null?void 0:C.pts)??null}function EE(e,t){const{elementRegistry:n}=e,i=e.modeling,r=Tt(n).edges.filter(o=>!t.has(o.id)&&o.waypoints.length>=4).map(o=>o.id).sort();for(const o of r){const a=Tt(n),s=a.edges.find(d=>d.id===o);if(!s||s.waypoints.length<4)continue;const c=ui(a),u=a.edges.filter(d=>d.id!==o),l=Hn(s,c).length,f=Ai(s,u),p=Mi(s,u);for(const d of Xu(s,a.shapes)){if(d.length>=s.waypoints.length)continue;const h={...s,waypoints:d};if(Hn(h,c).length>l||Ai(h,u)>f||Mi(h,u)>p)continue;const m=n.get(o);m&&i.updateWaypoints(m,d);break}}}function th(e,t){const{elementRegistry:n}=e,i=e.modeling,r=Tt(n).edges.filter(o=>o.type==="bpmn:SequenceFlow"&&!t.has(o.id)).map(o=>o.id).sort();for(const o of r){const a=Tt(n),s=a.edges.find(l=>l.id===o);if(!s)continue;const c=eh(s,a);if(!c)continue;const u=n.get(o);u&&i.updateWaypoints(u,c)}}function SE(e,t){const n=e.waypoints;if(n.length<3)return[];const i=[],r=t.get(e.endpoints[0]??""),o=t.get(e.endpoints[1]??""),a=Dt(n[0].x,n[1].x)&&!Dt(n[0].y,n[1].y),s=Dt(n[n.length-1].x,n[n.length-2].x)&&!Dt(n[n.length-1].y,n[n.length-2].y);for(const c of lo){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 nh(e,t){const n=new Map(t.shapes.map(l=>[l.id,l])),i=ui(t),r=t.edges.filter(l=>l.id!==e.id),o=Ai(e,r);if(o===0)return null;const a=Mi(e,r);let s;const c=l=>l.reduce((f,p,d)=>d?f+Math.abs(p.x-l[d-1].x)+Math.abs(p.y-l[d-1].y):0,0),u=[...Qd(e,n),...SE(e,n)];for(const{pts:l,cost:f}of u){const p={...e,waypoints:l};if(Hn(p,i).length>0)continue;const d=Ai(p,r),h=Mi(p,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&&(f<s.cost||f===s.cost&&m<s.len)))&&(s={pts:l,opposite:d,cross:h,cost:f,len:m})}return(s==null?void 0:s.pts)??null}function ih(e,t,n){const{elementRegistry:i}=e,r=e.modeling,o=Tt(i),a=ki(o).filter(l=>(l.kind==="edge-overlap-opposite"||l.kind==="edge-overlap-mixed")&&!t.has(Pi(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 f of l.edges)n.has(f)||s.add(f);const c=l=>{var f;return((f=o.edges.find(p=>p.id===l))==null?void 0:f.type)??""},u=[...s].sort((l,f)=>{const p=c(l)==="bpmn:SequenceFlow"?0:1,d=c(f)==="bpmn:SequenceFlow"?0:1;return p!==d?p-d:l.localeCompare(f)});for(const l of u){const f=Tt(i),p=f.edges.find(m=>m.id===l);if(!p)continue;const d=nh(p,f);if(!d)continue;const h=i.get(l);h&&r.updateWaypoints(h,d)}}const RE=10,CE=(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 rh(e,t){const n=e.label;if(!n)return null;const i=t.edges.filter(a=>a.id!==e.id);if(!ls(e,i))return null;const r=ui(t),o=i.flatMap(hn);for(const a of hn(e)){let s=[[a.lo,a.hi]];for(const[d,h]of us(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,x])=>x>E)});const c=a.axis==="h"?n.width:n.height,u=s.find(([d,h])=>h-d>=c+RE*2);if(!u)continue;const l=(u[0]+u[1])/2,f=a.axis==="h"?{x:l,y:a.at-kd}:{x:a.at+Cn+n.width/2,y:l},p={x:f.x-n.width/2,y:f.y-n.height/2,width:n.width,height:n.height};if(!ls({...e,label:p},i)&&!r.some(d=>!e.endpoints.includes(d.id)&&CE(p,d)))return p}return null}const Cn=8;function oh(e,t){const n=e.label;if(!n)return null;const i=hn(e);if(!i.length)return null;const r=n.x+n.width/2,o=n.y+n.height/2,a=p=>{const d=p.axis==="h"?r:o,h=p.axis==="h"?o-p.at:r-p.at,m=d<p.lo?p.lo-d:d>p.hi?d-p.hi:0;return Math.hypot(h,m)},s=i.reduce((p,d)=>a(d)<a(p)?d:p,i[0]),c=[...i,...t.edges.filter(p=>p.id!==e.id).flatMap(hn),...t.shapes.filter(p=>p.container).flatMap(Yo)],u=p=>!c.some(d=>Ti(p,d));if(u(n))return null;const l=(s.axis==="v"?n.height:n.width)+Cn,f=[0,-l,l,-2*l,2*l];if(s.axis==="v")for(const p of[s.at+Cn,s.at-Cn-n.width])for(const d of f){const h=n.y+d;if(h<s.lo||h+n.height>s.hi)continue;const m={...n,x:p,y:h};if(u(m))return m}else for(const p of[s.at-Cn-n.height,s.at+Cn])for(const d of f){const h=n.x+d;if(h<s.lo||h+n.width>s.hi)continue;const m={...n,x:h,y:p};if(u(m))return m}return null}function ah(e,t){const{elementRegistry:n}=e,i=e.modeling,r=Tt(n);for(const o of r.edges){if(!o.label||t.has(o.id))continue;const a=oh(o,r);if(!a)continue;const s=n.get(o.id),c=s==null?void 0:s.label;c&&i.moveElements([c],{x:a.x-c.x,y:a.y-c.y})}}function sh(e,t,n){const{elementRegistry:i}=e,r=e.modeling,o=Tt(i),a=ki(o).filter(s=>s.kind==="label-on-shared-segment"&&!t.has(Pi(s)));for(const s of a){if(s.kind!=="label-on-shared-segment"||n.has(s.edge))continue;const c=o.edges.find(p=>p.id===s.edge);if(!c)continue;const u=rh(c,o);if(!u)continue;const l=i.get(s.edge),f=l==null?void 0:l.label;f&&r.moveElements([f],{x:u.x-f.x,y:u.y-f.y})}}function ch(e,t){const n=e.label;if(!n)return null;const i=[...t.edges.flatMap(hn),...t.shapes.filter(p=>p.container).flatMap(Yo)],r=i.filter(p=>Ti(n,p));if(!r.length)return null;const o=t.shapes.filter(p=>!p.container&&p.id!==e.id),a=Ko(t).filter(p=>p.owner!==e.id).map(p=>p.rect),s=(p,d)=>p.x<d.x+d.width&&d.x<p.x+p.width&&p.y<d.y+d.height&&d.y<p.y+p.height,c=p=>!i.some(d=>Ti(p,d))&&!o.some(d=>s(p,d))&&!a.some(d=>s(p,d)),u=[];for(const p of r)p.axis==="h"?u.push({...n,y:p.at-Cn-n.height},{...n,y:p.at+Cn}):u.push({...n,x:p.at-Cn-n.width},{...n,x:p.at+Cn});const l=e.x+e.width/2,f=e.y+e.height/2;return u.push({...n,x:l-n.width/2,y:e.y+e.height+Cn},{...n,x:l-n.width/2,y:e.y-Cn-n.height},{...n,x:e.x+e.width+Cn,y:f-n.height/2},{...n,x:e.x-Cn-n.width,y:f-n.height/2}),u.find(c)??null}function uh(e,t){const{elementRegistry:n}=e,i=e.modeling,r=Tt(n);for(const o of r.shapes){if(o.container||!o.label||t.has(o.id))continue;const a=ch(o,Tt(n));if(!a)continue;const s=n.get(o.id),c=s==null?void 0:s.label;c&&i.moveElements([c],{x:a.x-c.x,y:a.y-c.y})}}const PE=/^[\p{L}_][\p{L}\p{N}_.\-]*$/u,lh=new Set(["sequenceFlow","messageFlow","dataAssociation","association"]),ph={"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}]},gs=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),Zu=e=>typeof e=="string"&&e!=="";function AE(e){const t=[];function n(i,r,o,a){if(a===null){Zu(o)||t.push({kind:"payload-invalid",opIndex:i,field:r});return}if(!gs(o)){t.push({kind:"payload-invalid",opIndex:i,field:r});return}for(const s of a)Zu(o[s])||t.push({kind:"payload-invalid",opIndex:i,field:`${r}.${s}`})}return e.forEach((i,r)=>{if(!gs(i)||!Zu(i.kind)||!(i.kind in ph)){t.push({kind:"payload-invalid",opIndex:r,field:"kind"});return}for(const o of ph[i.kind]){const a=o.path.endsWith("[]"),s=a?o.path.slice(0,-2):o.path,c=s.split(".");let u=i;for(const f of c.slice(0,-1)){if(!gs(u))break;u=u[f]}if(!gs(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((f,p)=>n(r,`${s}[${p}]`,f,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 fh(e,t){const n=AE(e);if(n.length>0)return n;const i=[],r=new Map,o=new Map;function a(p,d,h){if(!PE.test(d)){i.push({kind:"id-invalid",opIndex:p,id:d});return}if(t.categoryOf(d)!==void 0||r.has(d)){i.push({kind:"id-duplicate",opIndex:p,id:d});return}r.set(d,{...h,opIndex:p})}e.forEach((p,d)=>{var h;switch(p.kind){case"participant.add":a(d,p.participant.id,{category:"participant",lanes:(p.participant.lanes??[]).map(m=>m.id)});for(const m of p.participant.lanes??[])a(d,m.id,{category:"lane"});break;case"node.add":a(d,p.node.id,{category:"flowNode",participant:p.node.participant});break;case"sequenceFlow.add":a(d,p.flow.id,{category:"sequenceFlow"});break;case"messageFlow.add":a(d,p.flow.id,{category:"messageFlow"});break;case"dataStore.add":a(d,p.dataStore.id,{category:"dataStore"});for(const m of p.associations??[])m.id&&a(d,m.id,{category:"dataAssociation"});break;case"dataAssociation.add":p.association.id&&a(d,p.association.id,{category:"dataAssociation"});break;case"association.add":p.association.id&&a(d,p.association.id,{category:"association"});break;case"annotation.add":a(d,p.annotation.id,{category:"annotation"}),(h=p.association)!=null&&h.id&&a(d,p.association.id,{category:"association"});break;case"group.add":a(d,p.group.id,{category:"group"});break;case"participant.update":if(p.lanes){o.set(p.id,p.lanes.map(m=>m.id));for(const m of p.lanes)t.categoryOf(m.id)===void 0&&a(d,m.id,{category:"lane"})}break}});const s=p=>{var d;return((d=r.get(p))==null?void 0:d.category)??t.categoryOf(p)},c=p=>{const d=r.get(p);return d?d.category==="participant"?p:d.participant:t.categoryOf(p)==="participant"?p:t.participantOf(p)};function u(p,d,h,m){const g=s(d);if(g===void 0){i.push({kind:"ref-missing",opIndex:p,ref:d,role:h});return}if(m&&!m.includes(g)){i.push({kind:"ref-category",opIndex:p,ref:d,role:h,expected:m.join("|"),actual:g});return}return g}const l=t.isCollaboration()||e.some(p=>p.kind==="participant.add");return e.forEach((p,d)=>{var h;switch(p.kind){case"participant.add":break;case"node.add":{const{participant:m,lane:g}=p.node;if(m===void 0){(l||g!==void 0)&&i.push({kind:"participant-required",opIndex:d,id:p.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:x}=p.flow,w=u(d,g,"source",["flowNode"]),C=u(d,S,"target",["flowNode"]);w&&C&&c(g)!==c(S)&&i.push({kind:"flow-cross-pool",opIndex:d,id:m}),E!==void 0&&x!==void 0&&i.push({kind:"condition-name-conflict",opIndex:d,id:m});break}case"messageFlow.add":{const{id:m,source:g,target:S}=p.flow,E=u(d,g,"source",["flowNode","participant"]),x=u(d,S,"target",["flowNode","participant"]);if(E&&x){const w=c(g),C=c(S);w!==void 0&&w===C&&i.push({kind:"message-flow-same-pool",opIndex:d,id:m})}break}case"dataStore.add":{for(const m of p.associations??[]){if([m.source,m.target].filter(E=>E===p.dataStore.id).length!==1){i.push({kind:"data-association-ends",opIndex:d,source:m.source,target:m.target});continue}const S=m.source===p.dataStore.id?m.target:m.source;u(d,S,"dataAssociation",["flowNode"])}break}case"dataAssociation.add":{const{source:m,target:g}=p.association,S=u(d,m,"source"),E=u(d,g,"target");if(S&&E){const x=new Set([S,E]);x.has("dataStore")&&x.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}=p.association,E=u(d,g,"source"),x=u(d,S,"target");E&&x&&E!=="annotation"&&x!=="annotation"&&i.push({kind:"association-detached",opIndex:d,annotation:m??`${g}->${S}`});break}case"annotation.add":{if(p.association){const{source:m,target:g}=p.association;if(m!==p.annotation.id&&g!==p.annotation.id)i.push({kind:"association-detached",opIndex:d,annotation:p.annotation.id});else{const S=m===p.annotation.id?g:m;u(d,S,"association")}}p.placement&&u(d,p.placement.anchor,"anchor");break}case"group.add":{for(const m of p.group.members??[]){const g=u(d,m,"member");g&&lh.has(g)&&i.push({kind:"ref-category",opIndex:d,ref:m,role:"member",expected:"shape",actual:g})}break}case"participant.update":{if(f(d,p.id,"participant")===void 0)break;if(p.lanes){const m=t.lanesOf(p.id),g=p.lanes.map(E=>E.id);for(const E of m)g.includes(E)||i.push({kind:"lane-shrink-unsupported",opIndex:d,participant:p.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,x)=>E!==m[x])&&i.push({kind:"lane-reorder-unsupported",opIndex:d,participant:p.id})}break}case"node.update":{if(f(d,p.id,"flowNode")===void 0)break;if(p.lane!==void 0){const m=t.participantOf(p.id);(m?o.get(m)??t.lanesOf(m):[]).includes(p.lane)||i.push({kind:"lane-unknown",opIndex:d,lane:p.lane,participant:m??""})}break}case"sequenceFlow.update":{if(f(d,p.id,"sequenceFlow")===void 0)break;if(p.name!==void 0&&p.condition!==void 0&&i.push({kind:"condition-name-conflict",opIndex:d,id:p.id}),p.source!==void 0||p.target!==void 0){const m=p.source===void 0||u(d,p.source,"source",["flowNode"])!==void 0,g=p.target===void 0||u(d,p.target,"target",["flowNode"])!==void 0,S=t.endpointsOf(p.id),E=p.source??(S==null?void 0:S.source),x=p.target??(S==null?void 0:S.target);m&&g&&E!==void 0&&x!==void 0&&new Set([c(E),c(x),c(p.id)]).size>1&&i.push({kind:"flow-cross-pool",opIndex:d,id:p.id})}break}case"messageFlow.update":f(d,p.id,"messageFlow");break;case"dataStore.update":f(d,p.id,"dataStore");break;case"annotation.update":{if(f(d,p.id,"annotation")===void 0)break;p.placement&&u(d,p.placement.anchor,"anchor");break}case"group.update":{if(f(d,p.id,"group")===void 0)break;for(const m of p.members??[]){const g=u(d,m,"member");g&&lh.has(g)&&i.push({kind:"ref-category",opIndex:d,ref:m,role:"member",expected:"shape",actual:g})}break}case"element.remove":{f(d,p.id)==="lane"&&i.push({kind:"ref-category",opIndex:d,ref:p.id,role:"target",expected:"removable",actual:"lane"});break}}}),i;function f(p,d,h){if(r.has(d)){i.push({kind:"target-added-in-batch",opIndex:p,id:d});return}const m=t.categoryOf(d);if(m===void 0){i.push({kind:"ref-missing",opIndex:p,ref:d,role:"target"});return}if(h&&m!==h){i.push({kind:"ref-category",opIndex:p,ref:d,role:"target",expected:h,actual:m});return}return m}}function dh(e){return{modeling:e.get("modeling"),bpmnFactory:e.get("bpmnFactory"),elementFactory:e.get("elementFactory"),elementRegistry:e.get("elementRegistry"),canvas:e.get("canvas"),autoPlace:e.get("autoPlace"),bpmnReplace:e.get("bpmnReplace")}}function ys(e){return`bpmn:${e[0].toUpperCase()}${e.slice(1)}`}const vs={"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]},en=10,hh=40,TE=10;function Qu(e,t,n,i,r){const o=n,a=(k,O)=>{const[$,ne]=vs[k];let le={x:t.x+t.width/2+$*(t.width/2+o.width/2+O),y:t.y+t.height/2+ne*(t.height/2+o.height/2+O)};const je=i.x+en+o.width/2,W=i.x+i.width-en-o.width/2,re=i.y+en+o.height/2,pe=i.y+i.height-en-o.height/2,oe={x:Math.min(W,Math.max(je,le.x)),y:Math.min(pe,Math.max(re,le.y))};return(oe.x!==le.x||oe.y!==le.y)&&(le=Math.abs(oe.x-(t.x+t.width/2))<(t.width+o.width)/2+en&&Math.abs(oe.y-(t.y+t.height/2))<(t.height+o.height)/2+en?{x:t.x+t.width+en+o.width/2,y:oe.y}:oe),le},s=(i.children??[]).filter(k=>!("waypoints"in k&&k.waypoints)&&k.type!=="bpmn:Lane"&&k.type!=="label"&&typeof k.x=="number"&&k.id!==r.selfId),c=Tt(e),u=k=>{var $,ne;if(!r.selfId)return!1;const O=e.get(k);return!!O&&((($=O.source)==null?void 0:$.id)===r.selfId||((ne=O.target)==null?void 0:ne.id)===r.selfId)},l=c.edges.filter(k=>!u(k.id)).flatMap(hn),f=Ko(c).filter(k=>k.owner!==r.selfId).map(k=>k.rect),p=k=>({x0:k.x-o.width/2-en,x1:k.x+o.width/2+en,y0:k.y-o.height/2-en,y1:k.y+o.height/2+en}),d=k=>{const O=p(k);return s.some($=>O.x0<$.x+$.width&&O.x1>$.x&&O.y0<$.y+$.height&&O.y1>$.y)},h=k=>{const O=p(k);return l.some($=>$.axis==="h"?$.at>O.y0&&$.at<O.y1&&$.lo<O.x1&&$.hi>O.x0:$.at>O.x0&&$.at<O.x1&&$.lo<O.y1&&$.hi>O.y0)},m=k=>{const O=p(k);return f.some($=>O.x0<$.x+$.width&&O.x1>$.x&&O.y0<$.y+$.height&&O.y1>$.y)},g=c.shapes.filter(k=>k.type==="bpmn:Group").flatMap(k=>[{axis:"h",at:k.y,lo:k.x,hi:k.x+k.width},{axis:"h",at:k.y+k.height,lo:k.x,hi:k.x+k.width},{axis:"v",at:k.x,lo:k.y,hi:k.y+k.height},{axis:"v",at:k.x+k.width,lo:k.y,hi:k.y+k.height}]),S=k=>{const O=p(k);return g.some($=>$.axis==="h"?$.at>O.y0&&$.at<O.y1&&$.lo<O.x1&&$.hi>O.x0:$.at>O.x0&&$.at<O.x1&&$.lo<O.y1&&$.hi>O.y0)},E=k=>d(k)||h(k)||m(k)||S(k),x=k=>k.x-o.width/2>=i.x&&k.x+o.width/2<=i.x+i.width&&k.y-o.height/2>=i.y&&k.y+o.height/2<=i.y+i.height;if(r.placement){const k=W=>W.startsWith("top")?W.replace(/^top/,"bottom"):W.replace(/^bottom/,"top"),O=W=>W.endsWith("left")?W.replace(/left$/,"right"):W.replace(/right$/,"left"),$=r.placement.side,ne=[$,k($),O($),k(O($)),"top","bottom","left","right","top-left","top-right","bottom-left","bottom-right"],le=r.placement.offset??50;let je=a($,le);if(E(je)){const W=new Set;for(const re of ne){if(W.has(re))continue;W.add(re);const pe=a(re,le);if(x(pe)&&!E(pe)){je=pe;break}}}return je}const w=r.from,C=i.x+en+o.width/2,P=i.x+i.width-en-o.width/2,L=i.y+en+o.height/2,T=i.y+i.height-en-o.height/2;let B={x:Math.min(P,Math.max(C,w.x)),y:Math.min(T,Math.max(L,w.y))};if(E(B)){const k=(t.width+o.width)/2+en,$=[{x:B.x+k,y:B.y},{x:B.x-k,y:B.y},{x:B.x,y:B.y-o.height-en},{x:B.x,y:B.y+o.height+en}].filter(x).find(ne=>!E(ne));$&&(B=$)}return B}function Xt(e,t){return e.filter(n=>n.kind===t)}function mh(e,t){var Bx,$x,jx,Fx,Hx,zx,Gx,Vx,Wx,Ux,qx,Yx,Kx,Xx,Zx,Qx;const{modeling:n,bpmnFactory:i,elementFactory:r,elementRegistry:o,canvas:a,autoPlace:s,bpmnReplace:c}=t,u=()=>a.getRootElement(),l=b=>o.get(b),f=b=>{const R=l(b);if(!R)throw new Error(`하강 참조 해소 실패: ${b}`);return R},p=b=>{let R=b.parent;for(;R;){if(R.type==="bpmn:Participant")return R;R=R.parent}},d=new Map;for(const b of o.filter(R=>!("waypoints"in R&&R.waypoints)&&R.type!=="bpmn:Lane"&&R.type!=="label"&&typeof R.x=="number"))d.set(b.id,{x:b.x,y:b.y});const h=Xt(e,"participant.add"),m=Xt(e,"node.add"),g=Xt(e,"sequenceFlow.add"),S=Xt(e,"messageFlow.add"),E=Xt(e,"dataStore.add"),x=Xt(e,"dataAssociation.add"),w=Xt(e,"annotation.add"),C=Xt(e,"group.add"),P=new Map(m.map(b=>[b.node.id,b])),L=(b,R,M)=>{var Y;const F=b.businessObject,z=(((Y=F.extensionElements)==null?void 0:Y.values)??[]).filter(X=>X.$type!==R),N=M?[...z,i.create(R,M)]:z;if(!N.length){F.extensionElements&&n.updateProperties(b,{extensionElements:void 0});return}const q=i.create("bpmn:ExtensionElements",{values:N});N.forEach(X=>{X.$parent=q}),n.updateProperties(b,{extensionElements:q})},T=b=>({anchor:b.anchor,side:b.side,...b.offset!==void 0?{offset:b.offset}:{}});for(const b of Xt(e,"element.remove")){const R=l(b.id);R&&n.removeElements([R])}const B=b=>o.filter(R=>{var M;return R.type==="bpmn:Lane"&&((M=p(R))==null?void 0:M.id)===b}).sort((R,M)=>R.y-M.y);for(const b of Xt(e,"participant.update")){const R=f(b.id);if(b.name!==void 0&&n.updateProperties(R,{name:b.name??void 0}),!b.lanes)continue;const M=B(b.id);if(!M.length){n.splitLane(R,b.lanes.length),B(b.id).forEach((z,N)=>{const q=b.lanes[N];q&&n.updateProperties(z,{id:q.id,name:q.name})});continue}const F=new Set(M.map(z=>z.id));b.lanes.forEach((z,N)=>{if(F.has(z.id)){n.updateProperties(f(z.id),{name:z.name});return}const q=N===0?n.addLane(B(b.id)[0],"top"):n.addLane(f(b.lanes[N-1].id),"bottom");n.updateProperties(q,{id:z.id,name:z.name})})}const k=150,O=130,$=80,ne=90,le=180,je=new Set;for(const b of h){je.add(`pool:${b.participant.id}`);for(const R of b.participant.lanes??[])je.add(R.id)}const W=new Map;for(const b of m){const R=b.node.lane??`pool:${b.node.participant??""}`;let M=W.get(R);M||W.set(R,M=new Set([0])),b.band!==void 0&&M.add(b.band)}const re=new Map;for(const[b,R]of W){if(!je.has(b))continue;const M=[...R].sort((N,q)=>N-q),F=M.map((N,q)=>q===0?0:q%2===1?Math.ceil(q/2):-(q/2)),z=Math.min(...F);re.set(b,new Map(M.map((N,q)=>[N,F[q]-z])))}{const b=new Map;for(const R of h)(R.participant.lanes??[]).forEach((M,F)=>b.set(M.id,F));for(const[R,M]of re){if(!b.has(R)||M.size<2)continue;const F=b.get(R),z=M.get(0)??0,N=new Set;for(const he of m){if(he.node.lane!==R||(he.band??0)!==0||!he.node.type.endsWith("Gateway"))continue;const Re={in:new Set,out:new Set,cross:new Set};for(const me of g){const ye=me.flow.source===he.node.id;if(!ye&&me.flow.target!==he.node.id)continue;const mt=P.get(ye?me.flow.target:me.flow.source);if(!mt||mt.node.participant!==he.node.participant||!mt.node.lane)continue;let Ie,et=!1;if(mt.node.lane!==R){const ot=b.get(mt.node.lane);if(ot===void 0)continue;Ie=ot>F?"down":"up",et=!0}else{const ot=M.get(mt.band??0)??z;Ie=ot>z?"down":ot<z?"up":void 0}Ie&&(Re[ye?"out":"in"].add(Ie),et&&Re.cross.add(Ie))}for(const me of["up","down"])Re.in.has(me)&&Re.out.has(me)&&Re.cross.has(me)&&N.add(me)}if(N.size!==1)continue;const[q]=N,Y=Math.max(...M.values()),X=q==="down"?Y:0;if(z===X)continue;const _e=[...M.entries()].filter(([he])=>he!==0).sort((he,Re)=>he[1]-Re[1]),Fe=[...Array(Y+1).keys()].filter(he=>he!==X),He=new Map([[0,X]]);_e.forEach(([he],Re)=>He.set(he,Fe[Re])),re.set(R,He)}}const pe=b=>{var R;return(((R=W.get(b))==null?void 0:R.size)??0)>1},oe=b=>b.band??(b.node.lane||!pe(`pool:${b.node.participant??""}`)?void 0:0),fe=new Map,ee=b=>fe.get(b.node.id)??oe(b),V=new Set,G=new Set;{const b=new Map;for(const F of g)b.set(F.flow.target,(b.get(F.flow.target)??0)+1);const R=F=>{const z=[],N=new Set([F]),q=[F];for(;q.length;){const Y=q.shift();z.push(Y);for(const X of g)X.flow.source!==Y||N.has(X.flow.target)||(b.get(X.flow.target)??0)!==1||(N.add(X.flow.target),q.push(X.flow.target))}return z},M=(F,z)=>{var N;return((N=re.get(F))==null?void 0:N.get(z))??z};for(const F of m){if(!F.node.type.endsWith("Gateway"))continue;const z=F.node.lane??`pool:${F.node.participant??""}`,N=re.get(z);if(!N||N.size<2)continue;const q=ee(F);if(q===void 0||M(z,q)!==M(z,0))continue;const Y=M(z,q),X=g.filter(me=>me.flow.source===F.node.id).map(me=>P.get(me.flow.target)).filter(me=>!!me&&(me.node.lane??`pool:${me.node.participant??""}`)===z),_e=X.filter(me=>{const ye=ee(me);return ye!==void 0&&M(z,ye)===Y&&(b.get(me.node.id)??0)===1}),Fe=X.some(me=>{const ye=ee(me);return ye!==void 0&&M(z,ye)>Y});if(_e.length!==1||!Fe)continue;const He=new Set(X.flatMap(me=>R(me.node.id)));if(!g.some(me=>me.flow.target===F.node.id&&He.has(me.flow.source)))continue;const Re=new Map;for(const[me,ye]of N)Re.set(me,ye+1);Re.set(-1,0),re.set(z,Re);for(const me of R(_e[0].node.id))P.has(me)&&(fe.set(me,-1),G.add(me));V.add(F.node.id)}}const K=(b,R)=>{var M;return((M=re.get(b))==null?void 0:M.get(R))??R},De=new Map;for(const[b,R]of W){let M=0;for(const F of R)M=Math.max(M,K(b,F));De.set(b,M)}const Kt=b=>le+k*b,A=h.map((b,R)=>({op:b,declared:R}));A.sort((b,R)=>{const M=b.op.order??Number.POSITIVE_INFINITY,F=R.op.order??Number.POSITIVE_INFINITY;return M!==F?M-F:b.declared-R.declared});let _=80;for(const b of o.getAll())b.parent===u()&&"height"in b&&typeof b.y=="number"&&(_=Math.max(_,b.y+b.height+60));for(const{op:b}of A){const R=b.participant,M=m.filter(he=>he.node.participant===R.id).length,F=((Bx=R.lanes)==null?void 0:Bx.length)??0,z=Math.max(1200,M*160+300),N=(R.lanes??[]).map(he=>Kt(De.get(he.id)??0)),q=N.reduce((he,Re)=>he+Re,0);F&&q<300&&(N[F-1]+=300-q);const Y=Math.max(300,k*((De.get(`pool:${R.id}`)??0)+1)),X=R.blackBox||M+F===0?120:F?Math.max(300,q):Y,_e=r.createShape({type:"bpmn:Participant",businessObject:i.create("bpmn:Participant",{id:R.id,name:R.name,...b.order!==void 0?{"bwl:poolOrder":b.order}:{},...R.blackBox?{}:{processRef:i.create("bpmn:Process")}}),width:z,height:X,isExpanded:!0}),Fe=n.createShape(_e,{x:100+z/2,y:_+X/2},u()),He=R.lanes??[];if(He.length&&n.splitLane(Fe,He.length),He.length){const he=o.filter(Re=>{var me;return Re.type==="bpmn:Lane"&&((me=p(Re))==null?void 0:me.id)===R.id}).sort((Re,me)=>Re.y-me.y);if(he.forEach((Re,me)=>{const ye=He[me];ye&&n.updateProperties(Re,{id:ye.id,name:ye.name})}),N.some(Re=>Re!==Fe.height/F)){let Re=Fe.y;he.forEach((me,ye)=>{const mt=N[ye];n.resizeShape(me,{x:me.x,y:Re,width:me.width,height:mt}),Re+=mt})}}_=Fe.y+Fe.height+60}const y=b=>{var F;const R=P.get(b);if(R)return R.node.participant??"";const M=l(b);return M?M.type==="bpmn:Participant"?M.id:((F=p(M))==null?void 0:F.id)??"":""},I=new Map,H=b=>{let R=I.get(b);return R||I.set(b,R={nodes:[],flows:[]}),R};for(const b of m)H(b.node.participant??"").nodes.push(b);for(const b of g)H(y(b.flow.source)).flows.push(b);const U=b=>{var R;return i.create("bpmn:SequenceFlow",{id:b.id,name:b.name??((R=b.condition)==null?void 0:R.label)})},ue=(b,R)=>r.createShape({type:ys(b.type),businessObject:i.create(ys(b.type),{id:b.id,name:b.name,...R!==void 0?{"bwl:band":R}:{}})}),Le=[...A.map(({op:b})=>b.participant.id).filter(b=>I.has(b)),...[...I.keys()].filter(b=>!h.some(R=>R.participant.id===b))],Xe=b=>b.endsWith("Gateway");for(const b of Le){const R=I.get(b),M=b?f(b):void 0,F=M?M.x+150:250;let z=M?M.y+80:120;const N=(be,We,Ue)=>{const ft=u().children.filter(ht=>!("waypoints"in ht&&ht.waypoints)&&ht.id!==We&&typeof ht.y=="number"&&ht.y>=be);ft.length&&n.moveElements(ft,{x:0,y:Ue})},q=(be,We)=>{if(be){const Qe=f(be),de=Kt(We);if(Qe.height>=de)return;const at=de-Qe.height,te=p(Qe),Me=te?te.y+te.height:Qe.y+Qe.height;n.resizeLane(Qe,{x:Qe.x,y:Qe.y,width:Qe.width,height:de},!1),N(Me,te==null?void 0:te.id,at);return}if(!M)return;const Ue=k*(We+1);if(M.height>=Ue)return;const ft=Ue-M.height,ht=M.y+M.height;n.resizeShape(M,{x:M.x,y:M.y,width:M.width,height:Ue}),N(ht,M.id,ft)},Y=(be,We,Ue)=>{if(be){const ft=f(be);return ft.y+Math.min(ft.height/2,ne)+K(be,We??0)*k}return We!==void 0&&M?M.y+$+K(`pool:${b}`,We)*k:Ue},X=(be,We,Ue)=>{if(be){const ft=f(be);return ft.y+Math.min(ft.height/2,ne)+We*k}return M?M.y+$+We*k:Ue},_e=be=>be.participant?f(be.participant):u(),Fe=30,He=(be,We,Ue,ft)=>{const ht=Ue-We.width/2,Qe=ft-We.height/2;return(be.children??[]).find(de=>!("waypoints"in de&&de.waypoints)&&de.type!=="bpmn:Lane"&&de.type!=="label"&&typeof de.x=="number"&&ht<de.x+de.width+Fe&&ht+We.width+Fe>de.x&&Qe<de.y+de.height&&Qe+We.height>de.y)},he=(be,We,Ue,ft,ht,Qe)=>{const de=Ue!==void 0||ft!==void 0,at=K(Ue??`pool:${b}`,ft??0);if(de)for(let Se=0;Se<4;Se++){const Pe=X(Ue,at+Se,Qe);if(!He(be,We,ht,Pe))return q(Ue,at+Se),{x:ht,y:Pe}}const te=Y(Ue,ft,Qe);de&&q(Ue,at);let Me=ht;for(let Se=0;Se<64;Se++){const Pe=He(be,We,Me,te);if(!Pe)break;Me=Pe.x+Pe.width+O+We.width/2}return{x:Me,y:te}},Re=new Set(R.flows.map(be=>be.flow.target)),me=new Map;for(const be of R.nodes){if(Re.has(be.node.id))continue;const We=ue(be.node,be.band),Ue=oe(be),ft=be.node.lane?`${be.node.lane}|${Ue??""}`:Ue!==void 0?`band:${Ue}`:"",ht=_e(be.node),Qe=he(ht,We,be.node.lane,Ue,me.get(ft)??F,z);n.createShape(We,Qe,ht),me.set(ft,Qe.x+We.width+O),!be.node.lane&&Ue===void 0&&(z+=160)}const ye=new Set,mt=new Map,Ie=new Map,et=new Map;if(b&&je.has(`pool:${b}`)){const be=new Map;for(const te of R.flows)be.set(te.flow.target,(be.get(te.flow.target)??0)+1);const We=te=>Y(te.node.lane,ee(te),Number.NaN),Ue=new Set,ft=te=>{var Pe;const Me=(Pe=P.get(te))==null?void 0:Pe.node.participant;if(Me)return l(Me);const Se=l(te);if(Se)return Se.type==="bpmn:Participant"?Se:p(Se)},ht=te=>{const Me=[],Se=new Set([te]),Pe=[te];for(;Pe.length;){const bt=Pe.shift(),tt=P.get(bt);tt&&Me.push(tt);for(const Ae of R.flows)Ae.flow.source!==bt||Se.has(Ae.flow.target)||(be.get(Ae.flow.target)??0)!==1||(Se.add(Ae.flow.target),Pe.push(Ae.flow.target))}return Me},Qe=te=>{if(!M)return;const Me=new Set(te.map(bt=>bt.node.id));let Se=!1,Pe=!1;for(const bt of S){if(!Me.has(bt.flow.source))continue;const tt=ft(bt.flow.target);!tt||tt.id===M.id||(tt.y<M.y?Se=!0:Pe=!0)}return Se&&!Pe?"up":Pe&&!Se?"down":void 0};for(const te of R.nodes){if(!Xe(te.node.type))continue;const Me=Y(te.node.lane,oe(te),Number.NaN);if(Number.isNaN(Me))continue;const Se=[];for(const Ae of R.flows){if(Ae.flow.source!==te.node.id)continue;const qe=P.get(Ae.flow.target);if(!qe||qe.node.lane!==te.node.lane||(be.get(qe.node.id)??0)!==1)continue;const it=oe(qe);if(it===void 0)continue;const _n=Y(qe.node.lane,it,Number.NaN);if(Number.isNaN(_n))continue;const Jr=ht(qe.node.id),Jt=Qe(Jr);Jt&&Se.push({subtree:Jr,band:it,row:_n,dir:Jt})}if(!Se.some(Ae=>Ae.dir==="up")||!Se.some(Ae=>Ae.dir==="down")||!Se.some(Ae=>Ae.dir==="up"&&Se.some(qe=>qe.dir==="down"&&qe.row<Ae.row)))continue;const bt=[...Se].sort((Ae,qe)=>Ae.row-qe.row);[...Se.filter(Ae=>Ae.dir==="up"),...Se.filter(Ae=>Ae.dir==="down")].sort((Ae,qe)=>Ae.dir===qe.dir?Ae.row-qe.row:Ae.dir==="up"?-1:1).forEach((Ae,qe)=>{const it=bt[qe].band;if(it!==Ae.band){Ue.add(te.node.id);for(const _n of Ae.subtree)oe(_n)===Ae.band&&fe.set(_n.node.id,it)}})}const de=te=>{if(!M)return;const Me=new Set(te.map(bt=>bt.node.id));let Se=!1,Pe=!1;for(const bt of S){if(!Me.has(bt.flow.target))continue;const tt=ft(bt.flow.source);!tt||tt.id===M.id||(tt.y<M.y?Se=!0:Pe=!0)}return Se&&!Pe?"up":Pe&&!Se?"down":void 0};for(const te of R.nodes){if(!Xe(te.node.type))continue;const Me=te.node.lane??`pool:${b}`,Se=re.get(Me);if(!Se||Se.size<2)continue;const Pe=Se.get(0);if(Pe===void 0)continue;const bt=Math.max(...Se.values()),tt=Pe===bt&&Pe!==0?"down":void 0;if(!tt)continue;const Ae=[];for(const Jt of R.flows){if(Jt.flow.source!==te.node.id)continue;const ni=P.get(Jt.flow.target);if(!ni||ni.node.lane!==te.node.lane||(be.get(ni.node.id)??0)!==1)continue;const Jx=ee(ni);Jx!==void 0&&Ae.push({t:ni,subtree:ht(ni.node.id),band:Jx})}const qe=Ae.find(Jt=>(Se.get(Jt.band)??Jt.band)===Pe);if(!qe||de(qe.subtree)===tt||Qe(qe.subtree)===tt)continue;const it=Ae.find(Jt=>Jt!==qe&&de(Jt.subtree)===tt);if(!it)continue;const _n=qe.band,Jr=it.band;for(const Jt of qe.subtree)ee(Jt)===_n&&fe.set(Jt.node.id,Jr);for(const Jt of it.subtree)ee(Jt)===Jr&&fe.set(Jt.node.id,_n);Ue.add(te.node.id)}for(const te of R.nodes){if(!Xe(te.node.type))continue;const Me=We(te);if(Number.isNaN(Me)||w.some(Ae=>{var qe,it;return(((qe=Ae.placement)==null?void 0:qe.anchor)??(Ae.association?Ae.association.source===Ae.annotation.id?Ae.association.target:Ae.association.source:void 0))===te.node.id&&((it=Ae.placement)==null?void 0:it.side.startsWith("bottom"))}))continue;let Pe,bt=!1,tt;for(const Ae of R.flows){if(Ae.flow.source!==te.node.id)continue;const qe=P.get(Ae.flow.target);if(!qe||!qe.node.lane&&oe(qe)===void 0)continue;const it=We(qe);Number.isNaN(it)||(Math.abs(it-Me)<.5&&(bt=!0),it>Me?!Pe||it>Pe.row?Pe={id:qe.node.id,row:it,count:1}:it===Pe.row&&Pe.count++:it<Me&&qe.node.lane===te.node.lane&&(!tt||it>tt.row?tt={op:qe,row:it,count:1}:it===tt.row&&tt.count++))}Pe&&Pe.count===1&&(be.get(Pe.id)??0)===1&&!Ue.has(te.node.id)&&ye.add(Pe.id),!bt&&tt&&tt.count===1&&(be.get(tt.op.node.id)??0)===1&&!V.has(te.node.id)&&mt.set(tt.op.node.id,{lane:te.node.lane,band:ee(te)})}const at=new Map;for(const te of S)at.set(te.flow.target,[...at.get(te.flow.target)??[],te]);for(const te of R.nodes){const Me=at.get(te.node.id);if(!Me||Me.length!==1||!be.get(te.node.id)||!te.node.lane&&oe(te)===void 0||G.has(te.node.id))continue;const Se=($x=P.get(Me[0].flow.source))==null?void 0:$x.node.participant,Pe=Se?l(Se):void 0;if(!Pe||!M||Pe.id===M.id)continue;const bt=te.node.lane??`pool:${b}`,tt=re.get(bt);if(!tt)continue;const Ae=tt.get(0)??0,qe=(tt.get(ee(te)??0)??Ae)-Ae;if(qe===0)continue;const it=Pe.y<M.y;if(it&&qe<0||!it&&qe>0)continue;let _n;for(const[Jr,Jt]of tt){const ni=Jt-Ae;(it&&ni<0&&(!_n||ni<_n.row)||!it&&ni>0&&(!_n||ni>_n.row))&&(_n={band:Jr,row:ni})}_n&&Ie.set(te.node.id,{lane:te.node.lane,band:_n.band})}}const ot=new Set;let Rt=0;for(;Rt++<R.nodes.length+2;){for(let Ue=0;Ue<R.nodes.length+R.flows.length+2;Ue++){let ft=!1;for(const ht of R.flows){const Qe=ht.flow;if(ot.has(Qe.id))continue;const de=l(Qe.source);if(!de)continue;const at=l(Qe.target),te=P.get(Qe.target);if(!at&&te){const Me=ue(te.node,te.band),Se=ee(te);if(te.node.lane||Se!==void 0){const Pe=_e(te.node),bt=de,tt=bt.x+(et.get(Qe.source)??0)+bt.width+O,Ae=mt.get(Qe.target)??Ie.get(Qe.target),qe=he(Pe,Me,Ae?Ae.lane:te.node.lane,Ae?Ae.band:Se,ye.has(Qe.target)?bt.x+bt.width/2:tt,Number.NaN),it=n.createShape(Me,qe,Pe);ye.has(Qe.target)&&et.set(Qe.target,tt-(it.x+it.width/2)),n.connect(de,it,{type:"bpmn:SequenceFlow",businessObject:U(Qe)})}else s.append(de,Me,{connection:{type:"bpmn:SequenceFlow",businessObject:U(Qe)}})}else if(at)n.connect(de,at,{type:"bpmn:SequenceFlow",businessObject:U(Qe)});else continue;ot.add(Qe.id),ft=!0}if(!ft)break}const be=R.nodes.filter(Ue=>!l(Ue.node.id));if(!be.length)break;const We=be[0];{const Ue=ue(We.node,We.band),ft=_e(We.node),ht=oe(We);n.createShape(Ue,he(ft,Ue,We.node.lane,ht,F,z),ft),!We.node.lane&&ht===void 0&&(z+=160)}}}const At=40,Je=(b,R=()=>!0)=>{const M=l(b);if(!M)return[];const F=[M],z=new Set([b]);for(let N=0;N<F.length;N++){const q=F[N].id;for(const Y of g){const X=Y.flow.target;if(Y.flow.source!==q||z.has(X)||!P.has(X))continue;z.add(X);const _e=l(X);_e&&R(_e)&&F.push(_e)}}return F},Wt=(b,R=()=>!0)=>{const M=l(b);if(!M)return[];const F=[M],z=new Set([b]);for(let N=0;N<F.length;N++){const q=F[N].id;for(const Y of g){const X=Y.flow.source;if(Y.flow.target!==q||z.has(X)||!P.has(X))continue;z.add(X);const _e=l(X);_e&&R(_e)&&F.push(_e)}}return F};for(const b of Xt(e,"sequenceFlow.update")){if(b.target===void 0)continue;const R=P.get(b.target);if(!R)continue;const M=l(b.target),F=l(b.id);if(!M||!F)continue;const z=b.source!==void 0?l(b.source):F.source,N=F.target;if(!z||!N||N.id===M.id)continue;const q=Je(b.target),Y=new Set(q.map(Re=>Re.id)),X=Math.min(...q.map(Re=>Re.x)),_e=Math.max(...q.map(Re=>Re.x+Re.width)),Fe=z.x+z.width,He=_e-X+At*2-(N.x-Fe);if(He>0){const Re=p(M),me=(Re==null?void 0:Re.children)??[],ye=et=>et.type==="bpmn:Lane",mt=me.filter(et=>!("waypoints"in et&&et.waypoints)&&!ye(et)&&!Y.has(et.id)&&et.x>=N.x),Ie=Re?[Re,...me.filter(et=>ye(et))]:[];mt.length&&n.createSpace(mt,Ie,{x:He,y:0},"e",N.x-1)}const he=R.node.lane||R.band!==void 0?M.y+M.height/2:z.y+z.height/2;n.moveElements(q,{x:Fe+At-X,y:he-(M.y+M.height/2)})}const an=(b,R)=>{const M=R.target===b,F=f(R.source),z=f(R.target),N=M?"bpmn:DataOutputAssociation":"bpmn:DataInputAssociation";n.connect(F,z,R.id?{type:N,businessObject:i.create(N,{id:R.id})}:{type:N})},yn=100,pt=b=>{for(const R of h){if(!R.participant.blackBox)continue;const M=l(R.participant.id);if(!M)continue;const F=[];for(const N of S){const q=N.flow.source===R.participant.id?N.flow.target:N.flow.target===R.participant.id?N.flow.source:void 0,Y=q?l(q):void 0;Y&&typeof Y.x=="number"&&Y.type!=="bpmn:Participant"&&F.push(Y)}if(!F.length)continue;const z=Math.max(...F.map(N=>N.x+N.width/2))+yn;if(z>M.x+M.width&&n.resizeShape(M,{x:M.x,y:M.y,width:z-M.x,height:M.height}),!!b)for(const N of S){const q=l(N.flow.id),Y=N.flow.source===R.participant.id?N.flow.target:N.flow.target===R.participant.id?N.flow.source:void 0,X=Y?l(Y):void 0;if(!q||!X||X.type==="bpmn:Participant")continue;const _e=X.x+X.width/2;if(_e<M.x+10||_e>M.x+M.width-10)continue;const Fe=M.y>X.y,He=Fe?X.y+X.height:X.y,he=Fe?M.y:M.y+M.height,Re=N.flow.source===R.participant.id?[{x:_e,y:he},{x:_e,y:He}]:[{x:_e,y:He},{x:_e,y:he}],me=Tt(o),ye={...me.edges.find(mt=>mt.id===N.flow.id),waypoints:Re};Hn(ye,ui(me)).length||n.updateWaypoints(q,Re)}}};pt(!1);for(const b of S){const R=b.flow;n.connect(f(R.source),f(R.target),{type:"bpmn:MessageFlow",businessObject:i.create("bpmn:MessageFlow",{id:R.id,name:R.name})})}const kt=20,Qt=30,Kr=4,ei=2,Si=[10,30,80],jn=b=>!("waypoints"in b&&b.waypoints)&&b.type!=="bpmn:Lane"&&b.type!=="label"&&typeof b.x=="number",_t=()=>{const b=Tt(o);return{bad:ki(b).filter(R=>R.kind==="edge-crosses-shape"||R.kind==="edge-overlap-opposite"||R.kind==="edge-overlap-mixed").length,crossings:Id(b),straight:b.edges.filter(R=>R.type==="bpmn:MessageFlow"&&R.waypoints.length===2).length}},ti=b=>{const R=Tt(o),M=R.edges.find(F=>F.id===b);return M?Hn(M,ui(R)).length:0},Xr=b=>ti(b)>0,vn=b=>Tt(o).edges.filter(R=>R.type==="bpmn:MessageFlow"&&R.id!==b&&R.waypoints.length===2).length,Ze=(b,R)=>{const M=new Set(b.flatMap(N=>N.subtree.map(q=>q.id)));for(const N of b){const q=(N.pool.children??[]).filter(jn).filter(X=>!M.has(X.id));if(N.subtree.some(X=>q.some(_e=>X.x+R<_e.x+_e.width+Qt&&X.x+R+X.width+Qt>_e.x&&X.y<_e.y+_e.height&&X.y+X.height>_e.y)))return null}const F=b.map(N=>N.pool.width);n.moveElements(b.flatMap(N=>N.subtree),{x:R,y:0});const z=b.map(N=>{const Y=Math.max(...N.subtree.map(X=>X.x+X.width))+150-(N.pool.x+N.pool.width);return Y>0&&n.resizeShape(N.pool,{x:N.pool.x,y:N.pool.y,width:N.pool.width+Y,height:N.pool.height}),Y});return()=>{n.moveElements(b.flatMap(N=>N.subtree),{x:-R,y:0}),b.forEach((N,q)=>{z[q]>0&&n.resizeShape(N.pool,{x:N.pool.x,y:N.pool.y,width:F[q],height:N.pool.height})})}},nt=(b,R,M)=>Ze([{subtree:b,pool:R}],M),Rx=(b,R)=>R.bad>b.bad||R.crossings>b.crossings&&R.straight<=b.straight&&R.bad>=b.bad,Eu=(b,R)=>Rx(b,R)||R.straight<b.straight,Su=(b,R,M=()=>!0,F=Rx)=>{const z=_t(),N=Ze(b,R);if(!N)return!1;const q=_t();return F(z,q)||!M()?(N(),!1):!0},Cx=(b,R,M,F=()=>!0)=>Su([{subtree:b,pool:R}],M,F),Zr=b=>{var R;return!!((R=P.get(b))!=null&&R.node.participant)},Za=new Map;for(const b of S){if(!Zr(b.flow.target))continue;const R=Za.get(b.flow.target)??[];R.push(b),Za.set(b.flow.target,R)}const Vf=[...Za.keys()],Px=new Set(g.map(b=>b.flow.target)),Ax=b=>A.findIndex(({op:R})=>R.participant.id===b);Vf.sort((b,R)=>{var z,N;const M=Px.has(b)?1:0,F=Px.has(R)?1:0;return M!==F?M-F:Ax((z=P.get(b))==null?void 0:z.node.participant)-Ax((N=P.get(R))==null?void 0:N.node.participant)});const Qr=b=>b.x+b.width/2,yD=b=>{const R=new Map;for(const z of o.getAll()){const N=z;if(!N.waypoints||!N.source||!N.target)continue;(R.get(N.source.id)??R.set(N.source.id,[]).get(N.source.id)).push(N.target.id)}const M=new Set([b]),F=[b];for(let z=0;z<F.length;z++)for(const N of R.get(F[z])??[])M.has(N)||(M.add(N),F.push(N));return M},vD=(b,R)=>{const M=yD(R);let F;for(const z of o.getAll()){const N=z;if(N.type!=="bpmn:MessageFlow"||!N.source||!N.target||N.target.id!==b||M.has(N.source.id))continue;const q=N.source;if(typeof q.x!="number"||q.type==="bpmn:Participant")continue;const Y=Qr(q);(F===void 0||Y>F)&&(F=Y)}return F},Wf=(b,R)=>{const M=l(b.flow.source);if(M)return M.type==="bpmn:Participant"?vD(M.id,R):Qr(M)},Tx=b=>{let R;for(const M of Za.get(b)??[]){const F=Wf(M,b);F!==void 0&&(!R||F>R.cx)&&(R={op:M,cx:F})}return R==null?void 0:R.op},_D=b=>{const R=Tx(b),M=l(b),F=R?Wf(R,b):void 0;return M&&F!==void 0?F-Qr(M):void 0},bD=b=>{const R=_D(b);return R!==void 0&&Math.abs(R)<kt},Mx=(b,R,M,F,z)=>{var N;for(let q=!0;q;){q=!1;for(const Y of S){if(Y.flow.id===M)continue;const X=R.has(Y.flow.source),_e=R.has(Y.flow.target);if(X===_e||F(X?Y.flow.source:Y.flow.target))continue;const Fe=X?Y.flow.target:Y.flow.source;if(z(Fe)||!Zr(Fe))continue;const He=l(Y.flow.id);if(!(He!=null&&He.waypoints)||He.waypoints.length!==2)continue;const he=l(Fe),Re=(N=P.get(Fe))==null?void 0:N.node.participant;if(!he||!Re)continue;const me=Je(Fe,ye=>ye.x>=he.x).filter(ye=>!R.has(ye.id));if(!(!me.length||me.some(ye=>z(ye.id)))){for(const ye of me)R.add(ye.id);b.set(Re,[...b.get(Re)??[],...me]),q=!0}}}return[...b].map(([q,Y])=>({subtree:Y,pool:f(q)}))},kx=(b,R,M,F,z)=>Mx(new Map([[R,[...b]]]),new Set(b.map(N=>N.id)),F,N=>N===M,N=>N===z),Uf=b=>{const R=Tx(b);if(!R)return null;const M=l(b),F=l(R.flow.source),z=Wf(R,b);if(!M||!F||z===void 0)return null;const N=z-Qr(M);if(N>=kt){const q=P.get(b).node.participant,Y=Je(b,X=>X.x>=M.x);return{groups:kx(Y,q,b,R.flow.id,R.flow.source),dx:N}}if(-N>=kt&&Zr(R.flow.source)){const q=P.get(R.flow.source).node.participant,Y=Je(R.flow.source,X=>X.x>=F.x&&!bD(X.id));return{groups:kx(Y,q,R.flow.source,R.flow.id,b),dx:-N}}return null},Ox=()=>Vf.map(b=>({id:b,plan:Uf(b)})).filter(b=>!!b.plan).sort((b,R)=>Math.min(...b.plan.groups.flatMap(M=>M.subtree.map(F=>F.x)))-Math.min(...R.plan.groups.flatMap(M=>M.subtree.map(F=>F.x)))).map(b=>b.id);for(let b=0;b<3;b++){const R=_t(),M=[];for(const z of Ox()){const N=Uf(z);if(!N)continue;const q=Ze(N.groups,N.dx);q&&M.push(q)}if(!M.length)break;if(!Eu(R,_t()))continue;for(const z of M.reverse())z();let F=!1;for(const z of Ox()){const N=Uf(z);N&&Su(N.groups,N.dx,()=>!0,Eu)&&(F=!0)}if(!F)break}for(const b of Vf.flatMap(R=>Za.get(R)??[])){if(!Xr(b.flow.id))continue;const R=l(b.flow.target);if(!R)continue;const M=f(P.get(b.flow.target).node.participant),F=Je(b.flow.target,Y=>Y.x>=R.x),z=R.width+O,N=ti(b.flow.id),q=vn(b.flow.id);for(let Y=1;Y<=Kr;Y++){const X=()=>ti(b.flow.id)<N&&vn(b.flow.id)>=q;if(Cx(F,M,z*Y,X))break}}for(const b of S){if(!Xr(b.flow.id))continue;const R=l(b.flow.source),M=l(b.flow.target);if(!R||!M||R.type==="bpmn:Participant"||M.type==="bpmn:Participant")continue;const F=R.x+R.width/2;if(Math.abs(F-(M.x+M.width/2))>15)continue;const[z,N]=R.y<M.y?[R.y+R.height,M.y]:[M.y+M.height,R.y],q=[...P.values()].map(Y=>l(Y.node.id)).filter(Y=>!!Y&&Y.id!==R.id&&Y.id!==M.id).filter(Y=>Y.x<=F&&F<=Y.x+Y.width&&Y.y+Y.height>z&&Y.y<N).sort((Y,X)=>Y.x-X.x);for(const Y of q){const X=(jx=P.get(Y.id))==null?void 0:jx.node.participant,_e=X?l(X):void 0;if(!_e)continue;const Fe=[...P.values()].filter(ot=>ot.node.participant===X).map(ot=>ot.node.id),He=ot=>ot.map(Rt=>l(Rt)).filter(Rt=>!!Rt),Re=[Wt(Y.id,ot=>{var Rt;return((Rt=P.get(ot.id))==null?void 0:Rt.node.participant)===X}),He(Fe)].filter(ot=>ot.length),me=Y.width+O,ye=ti(b.flow.id),mt=vn(b.flow.id),Ie=()=>ti(b.flow.id)<ye&&vn(b.flow.id)>=mt;let et=!1;for(const ot of Re){for(let Rt=1;Rt<=Kr;Rt++)if(Cx(ot,_e,me*Rt,Ie)){et=!0;break}if(et)break}if(!Xr(b.flow.id))break}}for(const b of S){if(!Xr(b.flow.id))continue;const R=l(b.flow.id);if(((Fx=R==null?void 0:R.waypoints)==null?void 0:Fx.length)!==2)continue;const M=l(b.flow.source),F=l(b.flow.target);if(!M||!F||M.type==="bpmn:Participant"||F.type==="bpmn:Participant"||!Zr(b.flow.source)||!Zr(b.flow.target)||Math.abs(Qr(M)-Qr(F))>ei)continue;const z=Qr(M),N=R.waypoints.map(ye=>ye.y),[q,Y]=[Math.min(...N),Math.max(...N)],X=ui(Tt(o)).filter(ye=>ye.id!==M.id&&ye.id!==F.id&&ye.x<z&&z<ye.x+ye.width&&q<ye.y+ye.height&&ye.y<Y);if(!X.length)continue;const _e=(Hx=P.get(b.flow.source))==null?void 0:Hx.node.participant,Fe=(zx=P.get(b.flow.target))==null?void 0:zx.node.participant;if(!_e||!Fe)continue;const He=new Map;for(const[ye,mt,Ie]of[[b.flow.source,M,_e],[b.flow.target,F,Fe]]){const et=He.get(Ie)??[],ot=Je(ye,Rt=>Rt.x>=mt.x).filter(Rt=>!et.some(be=>be.id===Rt.id));He.set(Ie,[...et,...ot])}const he=new Set([...He.values()].flat().map(ye=>ye.id)),Re=Mx(He,he,b.flow.id,ye=>ye===b.flow.source||ye===b.flow.target,()=>!1),me=Math.max(...X.map(ye=>ye.x+ye.width));for(const ye of Si){const mt=me+ye-z;if(mt<=0)continue;if(Su(Re,mt,()=>{var et,ot;return ti(b.flow.id)===0&&((ot=(et=l(b.flow.id))==null?void 0:et.waypoints)==null?void 0:ot.length)===2},Eu))break}}{const b=M=>M.y+M.height/2,R=[];for(const M of P.keys()){if(!Zr(M))continue;const F=g.filter(q=>q.flow.target===M);if(F.length!==1)continue;const z=l(F[0].flow.source),N=l(M);!z||!N||!P.has(z.id)||Math.abs(b(z)-b(N))>1||N.x-(z.x+z.width)<=O+1||R.push({id:M,pred:z,node:N})}R.sort((M,F)=>M.node.x-F.node.x);for(const{id:M}of R){const F=P.get(M),z=l(M),N=l(g.find(he=>he.flow.target===M).flow.source);if(!z||!N)continue;const q=z.x-(N.x+N.width);if(q<=O+1)continue;const Y=f(F.node.participant),X=Je(M,he=>he.x>=z.x),_e=_t(),Fe=nt(X,Y,-(q-O));if(!Fe)continue;const He=_t();(He.bad>_e.bad||He.crossings>=_e.crossings||He.straight<_e.straight)&&Fe()}}pt(!0);for(const b of E){const R=b.associations??[],M=R.map(N=>N.source===b.dataStore.id?N.target:N.source).map(l).find(Boolean),F=M?p(M)??u():u(),z=M?{x:M.x+M.width/2,y:M.y+M.height+110}:{x:200,y:_+60};n.createShape({type:"bpmn:DataStoreReference",businessObject:i.create("bpmn:DataStoreReference",{id:b.dataStore.id,name:b.dataStore.name})},z,F);for(const N of R)an(b.dataStore.id,N)}for(const b of x){const M=f(b.association.target).type==="bpmn:DataStoreReference"?b.association.target:b.association.source;an(M,b.association)}let Dx=0;const Ru=10,xD=(b,R)=>{for(const M of R.map(F=>p(F)).filter(F=>!!F)){const F=Ru,z=M.y,N=M.y+M.height,q=M.x,Y=M.x+M.width;if(Math.abs(b.y-z)<F){const X=z+F-b.y;b.y+=X,b.height-=X}if(Math.abs(b.y+b.height-N)<F&&(b.height=N-F-b.y),Math.abs(b.x-q)<F){const X=q+F-b.x;b.x+=X,b.width-=X}Math.abs(b.x+b.width-Y)<F&&(b.width=Y-F-b.x)}},wD=(b,R)=>{const M=Ru,F=30,z=o.filter(N=>N.type==="bpmn:Group"&&N.id!==R);for(const N of z){const q=N.x,Y=N.x+N.width,X=N.y,_e=N.y+N.height,Fe=b.y<_e&&X<b.y+b.height,He=b.x<Y&&q<b.x+b.width;if(Fe){if(Math.abs(b.x-Y)<M){const he=Math.min(Y+M-b.x,F);he>0&&b.width-he>0&&(b.x+=he,b.width-=he)}if(Math.abs(b.x+b.width-q)<M){const he=Math.min(b.x+b.width-(q-M),F);he>0&&b.width-he>0&&(b.width-=he)}}if(He){if(Math.abs(b.y-_e)<M){const he=Math.min(_e+M-b.y,F);he>0&&b.height-he>0&&(b.y+=he,b.height-=he)}if(Math.abs(b.y+b.height-X)<M){const he=Math.min(b.y+b.height-(X-M),F);he>0&&b.height-he>0&&(b.height-=he)}}}},qf=(b,R)=>{const F=Math.min(...b.map(X=>X.x))-40,z=Math.min(...b.map(X=>X.y))-40,N=Math.max(...b.map(X=>X.x+X.width))+40,q=Math.max(...b.map(X=>X.y+X.height))+40,Y={x:F,y:z,width:N-F,height:q-z};return xD(Y,b),wD(Y,R),Y};for(const b of C){const R=(b.group.members??[]).map(l).filter(z=>!!z);let M;R.length?M=qf(R,b.group.id):(M={x:300+Dx*350,y:40,width:300,height:200},Dx++);const F=n.createShape({type:"bpmn:Group",businessObject:i.create("bpmn:Group",{id:b.group.id}),width:M.width,height:M.height},{x:M.x+M.width/2,y:M.y+M.height/2},u());b.group.name&&n.updateLabel(F,b.group.name),(Gx=b.group.members)!=null&&Gx.length&&L(F,"bwl:Members",{refs:b.group.members.join(" ")})}{const b=o.filter(z=>!!z.waypoints),R=new Map,M=(z,N)=>{!z||!N||(R.has(z)||R.set(z,new Set),R.get(z).add(N))};for(const z of b){const N=(Vx=z.source)==null?void 0:Vx.id,q=(Wx=z.target)==null?void 0:Wx.id;M(N,q),((Ux=z.type)!=null&&Ux.includes("DataOutputAssociation")||(qx=z.type)!=null&&qx.includes("DataInputAssociation")||z.type==="bpmn:Association")&&M(q,N)}const F=o.filter(z=>z.type==="bpmn:Group");for(const z of F){const q=(((Yx=z.businessObject.extensionElements)==null?void 0:Yx.values)??[]).find(Ie=>Ie.$type==="bwl:Members"),Y=((q==null?void 0:q.refs)??"").split(" ").filter(Boolean);if(!Y.length)continue;const X=new Set(Y),_e=[...Y];for(;_e.length;){const Ie=_e.shift();for(const et of R.get(Ie)??[])X.has(et)||(X.add(et),_e.push(et))}const Fe=z.x,He=z.x+z.width,he=z.y,Re=z.y+z.height,me=Ie=>g.filter(et=>et.flow.target===Ie).length,ye=Ie=>{var ot;const et=((ot=l(Ie))==null?void 0:ot.type)??"";if(et==="bpmn:StartEvent"&&me(Ie)===0)return!1;if(et.endsWith("Gateway")){const Rt=g.filter(be=>be.flow.target===Ie).map(be=>be.flow.source);if(Rt.length&&Rt.every(be=>{var We;return((We=l(be))==null?void 0:We.type)==="bpmn:StartEvent"&&me(be)===0}))return!1}return!0},mt=o.filter(Ie=>jn(Ie)).filter(Ie=>Ie.type!=="bpmn:Group"&&Ie.type!=="bpmn:Participant"&&Ie.type!=="bpmn:TextAnnotation"&&!X.has(Ie.id)&&Zr(Ie.id)&&ye(Ie.id)&&Ie.x<He&&Ie.x+Ie.width>Fe&&Ie.y<Re&&Ie.y+Ie.height>he);if(mt.length)for(const Ie of[-1,1]){const et=mt.filter(de=>(de.x+de.width-Fe<=He-de.x?-1:1)===Ie);if(!et.length)continue;const ot=[];for(const de of et){const at=ot.find(te=>te.some(Me=>de.y<Me.y+Me.height&&de.y+de.height>Me.y));at?at.push(de):ot.push([de])}const Rt=new Map;for(const de of ot){let at=Ie<0?Fe-Ru:He+Ru;for(const te of[...de].sort((Me,Se)=>Ie<0?Se.x-Me.x:Me.x-Se.x)){const Me=Ie<0?Math.min(te.x,at-te.width):Math.max(te.x,at);at=Ie<0?Me-Qt:Me+te.width+Qt,Me!==te.x&&Math.sign(Me-te.x)===Ie&&Rt.set(te.id,Me-te.x)}}const be=new Map,We=de=>be.get(de)===de||!be.get(de)?de:We(be.get(de));for(const de of et)be.set(de.id,de.id);for(const de of S){const at=Rt.has(de.flow.source)?de.flow.source:void 0,te=Rt.has(de.flow.target)?de.flow.target:void 0;if(!at||!te)continue;const Me=l(de.flow.id);((Kx=Me==null?void 0:Me.waypoints)==null?void 0:Kx.length)===2&&be.set(We(at),We(te))}const Ue=new Map;for(const de of et){if(!Rt.has(de.id))continue;const at=We(de.id);Ue.set(at,[...Ue.get(at)??[],de])}const ft=[...Ue.values()].sort((de,at)=>Ie<0?Math.min(...de.map(te=>te.x))-Math.min(...at.map(te=>te.x)):Math.max(...at.map(te=>te.x))-Math.max(...de.map(te=>te.x))),ht=[];let Qe=!0;for(const de of ft){const at=de.map(Se=>Rt.get(Se.id)??0).reduce((Se,Pe)=>Math.abs(Pe)>Math.abs(Se)?Pe:Se,0),te=new Map;let Me=!0;for(const Se of de){const Pe=p(Se);if(!Pe){Me=!1;break}te.has(Pe.id)||te.set(Pe.id,{subtree:[],pool:Pe}),te.get(Pe.id).subtree.push(Se)}Me&&Su([...te.values()],at,()=>!0,Eu)?ht.push({shapes:de,dx:at}):Qe=!1}if(!Qe)for(const de of ht.reverse())n.moveElements(de.shapes,{x:-de.dx,y:0})}}}{const b=new Set([...C.map(R=>R.group.id),...Xt(e,"group.update").map(R=>R.id)]);for(const R of o.filter(M=>M.type==="bpmn:Group")){if(b.has(R.id))continue;const F=(((Xx=R.businessObject.extensionElements)==null?void 0:Xx.values)??[]).find(Y=>Y.$type==="bwl:Members"),z=((F==null?void 0:F.refs)??"").split(" ").filter(Boolean).map(l).filter(Y=>!!Y);!z.length||!z.some(Y=>{const X=d.get(Y.id);return!X||X.x!==Y.x||X.y!==Y.y})||!z.some(Y=>Y.x<R.x||Y.y<R.y||Y.x+Y.width>R.x+R.width||Y.y+Y.height>R.y+R.height)||n.resizeShape(R,qf(z,R.id))}}const Lx=b=>{const R=b.waypoints;if(R!=null&&R.length){const F=R[Math.floor((R.length-1)/2)];return{x:F.x,y:F.y,width:0,height:0}}const M=b;return{x:M.x,y:M.y,width:M.width,height:M.height}};let Qa=0;const Ix=12,Nx=14,ED=15,SD=300,RD=b=>{const R=b.split(`
|
|
7
|
+
`),M=Math.max(...R.map(N=>co(N,Ix))),F=Math.max(100,Math.min(SD,Math.ceil(M)+Nx)),z=R.reduce((N,q)=>N+Math.max(1,Math.ceil((co(q,Ix)+Nx)/F)),0);return{width:F,height:Math.max(30,z*ED+10)}};for(const b of w){const R=b.association,M=((Zx=b.placement)==null?void 0:Zx.anchor)??(R?R.source===b.annotation.id?R.target:R.source:void 0),F=M?l(M):void 0,z=F?Lx(F):void 0,N=RD(b.annotation.text??"");let q;if(z&&b.placement){const[Fe,He]=vs[b.placement.side],he=b.placement.offset??50;q={x:z.x+z.width/2+Fe*(z.width/2+N.width/2+he),y:z.y+z.height/2+He*(z.height/2+N.height/2+he)}}else z?(q={x:z.x+z.width/2+180+Qa%3*260,y:z.y-110-Qa%2*95},Qa++):(q={x:300+Qa*260,y:60},Qa++);const Y=F?p(F)??u():u(),X=Y;z&&typeof X.x=="number"&&typeof X.width=="number"&&X.type==="bpmn:Participant"&&(q=Qu(o,z,N,X,b.placement?{placement:b.placement}:{from:q}));const _e=n.createShape({type:"bpmn:TextAnnotation",width:N.width,height:N.height,businessObject:i.create("bpmn:TextAnnotation",{id:b.annotation.id,text:b.annotation.text})},q,Y);if(R){const Fe=He=>He===b.annotation.id?_e:f(He);n.connect(Fe(R.source),Fe(R.target),R.id?{type:"bpmn:Association",businessObject:i.create("bpmn:Association",{id:R.id})}:{type:"bpmn:Association"})}b.placement&&L(_e,"bwl:Placement",T(b.placement))}for(const b of Xt(e,"association.add")){const R=b.association;n.connect(f(R.source),f(R.target),R.id?{type:"bpmn:Association",businessObject:i.create("bpmn:Association",{id:R.id})}:{type:"bpmn:Association"})}for(const b of Xt(e,"node.update")){let R=f(b.id);if(b.type&&ys(b.type)!==R.type&&(R=c.replaceElement(R,{type:ys(b.type)})),b.name!==void 0&&n.updateProperties(R,{name:b.name??void 0}),b.lane){const M=f(b.lane),F=M.y+M.height/2-(R.y+R.height/2);F!==0&&n.moveElements([R],{x:0,y:F})}}for(const b of Xt(e,"sequenceFlow.update")){const R=f(b.id);if(b.source!==void 0||b.target!==void 0){const M=R,F=b.source!==void 0?f(b.source):M.source,z=b.target!==void 0?f(b.target):M.target,N=q=>({x:q.x+q.width/2,y:q.y+q.height/2});n.reconnect(M,F,z,[N(F),N(z)])}b.name!==void 0&&n.updateProperties(R,{name:b.name??void 0}),b.condition!==void 0&&n.updateProperties(R,{name:((Qx=b.condition)==null?void 0:Qx.label)??void 0})}for(const b of Xt(e,"messageFlow.update"))b.name!==void 0&&n.updateProperties(f(b.id),{name:b.name??void 0});for(const b of Xt(e,"dataStore.update"))b.name!==void 0&&n.updateProperties(f(b.id),{name:b.name??void 0});for(const b of Xt(e,"annotation.update")){const R=f(b.id);if(b.text!==void 0&&n.updateProperties(R,{text:b.text}),b.placement===null)L(R,"bwl:Placement",null);else if(b.placement){const M=f(b.placement.anchor),F=Lx(M),z=p(M)??u(),N=typeof z.x=="number"&&typeof z.width=="number"&&z.type==="bpmn:Participant",[q,Y]=vs[b.placement.side],X=b.placement.offset??50,_e={x:F.x+F.width/2+q*(F.width/2+R.width/2+X),y:F.y+F.height/2+Y*(F.height/2+R.height/2+X)},Fe=N?Qu(o,F,{width:R.width,height:R.height},z,{placement:b.placement,selfId:b.id}):_e;n.moveElements([R],{x:Fe.x-(R.x+R.width/2),y:Fe.y-(R.y+R.height/2)}),L(R,"bwl:Placement",T(b.placement))}}for(const b of Xt(e,"group.update")){const R=f(b.id);if(b.name!==void 0&&n.updateLabel(R,b.name??""),b.members){const M=b.members.map(l).filter(F=>!!F);M.length&&n.resizeShape(R,qf(M,b.id)),L(R,"bwl:Members",{refs:b.members.join(" ")})}}}function Ju(e){switch(e.kind){case"annotation-over-label":return[e.annotation];case"edge-crosses-shape":return[e.shape];case"shape-outside-container":return[e.shape];case"shape-overlap":return e.shapes;default:return[]}}function ME(e,t,n){var l,f;const{elementRegistry:i}=e,r=e.modeling,o=p=>ki(p).filter(d=>!t.has(Pi(d))),a=p=>{var d;return((d=i.get(p))==null?void 0:d.type)==="bpmn:TextAnnotation"},s=Tt(i),c=o(s),u=[...new Set(c.flatMap(Ju))].filter(p=>n.has(p)&&a(p));if(u.length)for(const p of u){const d=i.get(p);if(!d||typeof d.x!="number"||typeof d.width!="number")continue;let h=d.parent,m;for(;h;){if(h.type==="bpmn:Participant"){m=h;break}h=h.parent}if(!m){const le=d.x+d.width/2,je=d.y+d.height/2;m=i.getAll().find(W=>{if(W.type!=="bpmn:Participant")return!1;const re=W;return typeof re.x=="number"&&typeof re.width=="number"&&le>=re.x&&le<=re.x+re.width&&je>=re.y&&je<=re.y+re.height})}if(!m||typeof m.x!="number"||typeof m.width!="number")continue;const S=(((l=d.businessObject.extensionElements)==null?void 0:l.values)??[]).find(le=>le.$type==="bwl:Placement"),E=[...d.incoming??[],...d.outgoing??[]].find(le=>le.type==="bpmn:Association"),x=(S!=null&&S.anchor?i.get(S.anchor):void 0)??(E?((f=E.source)==null?void 0:f.id)===p?E.target:E.source:void 0);if(!x)continue;const w=x.waypoints,C=w!=null&&w.length?{x:w[Math.floor((w.length-1)/2)].x,y:w[Math.floor((w.length-1)/2)].y,width:0,height:0}:{x:x.x,y:x.y,width:x.width,height:x.height},P={width:d.width,height:d.height},L={x:d.x+d.width/2,y:d.y+d.height/2},T=S==null?void 0:S.side,B=[];T&&T in vs&&B.push(Qu(i,C,P,m,{placement:{side:T,offset:(S==null?void 0:S.offset)??null},selfId:p}));for(const[le,je]of[[-1,0],[1,0],[0,-1],[0,1]])for(let W=1;W<=TE;W++)B.push({x:L.x+le*hh*W,y:L.y+je*hh*W});const k={...s,edges:s.edges.filter(le=>le.id!==(E==null?void 0:E.id))},O=o(k),$=O.filter(le=>Ju(le).includes(p)).length;if(!$)continue;let ne;for(const le of B){const je=le.x-L.x,W=le.y-L.y;if(!je&&!W||le.x-P.width/2<m.x||le.x+P.width/2>m.x+m.width||le.y-P.height/2<m.y||le.y+P.height/2>m.y+m.height)continue;const re={...k,shapes:k.shapes.map(ee=>ee.id===p?{...ee,x:ee.x+je,y:ee.y+W}:ee)},pe=o(re),oe=pe.filter(ee=>Ju(ee).includes(p)).length;if(oe>=$||pe.length>O.length)continue;const fe=Math.abs(je)+Math.abs(W);if((!ne||oe<ne.mine||oe===ne.mine&&(pe.length<ne.all||pe.length===ne.all&&fe<ne.dist))&&(ne={x:le.x,y:le.y,mine:oe,all:pe.length,dist:fe}),ne.mine===0&&ne.all<O.length)break}ne&&r.moveElements([d],{x:ne.x-L.x,y:ne.y-L.y})}}function gh(e,t,n=mh){const i=dh(e),r=fh(t,zd(i.elementRegistry)),o={edgeCrossings:{before:0,after:0,pairs:[]}};if(r.length)return{ok:!1,issues:r,findings:[],stats:o};const a=Tt(i.elementRegistry),s=new Set(ki(a).map(Pi)),c=new Set(a.edges.map(m=>m.id)),u=new Set(a.shapes.map(m=>m.id)),l=Ku(a).length,f=e.get("commandStack");try{Qf(f,()=>{n(t,i),Zd(i,c),Yd(i,s),ih(i,s,c),th(i,c),EE(i,c),sh(i,s,c),ah(i,c),uh(i,u),ME(i,s,u)})}catch(m){return{ok:!1,issues:[{kind:"lower-failed",message:m instanceof Error?m.message:String(m)}],findings:[],stats:o}}const p=Tt(i.elementRegistry),d=ki(p).filter(m=>!s.has(Pi(m))),h=Ku(p);return{ok:!0,issues:[],findings:d,stats:{edgeCrossings:{before:l,after:h.length,pairs:h}}}}function kE(e){const t=e.slice(e.indexOf(":")+1);return t.charAt(0).toLowerCase()+t.slice(1)}function OE(e,t){return typeof e.get=="function"?e.get(t):e[t]}function yh(e,t){const n=OE(e,t);return typeof n=="number"&&Number.isFinite(n)?n:void 0}function vh(e,t){var i;return(((i=e.extensionElements)==null?void 0:i.values)??[]).find(r=>(r==null?void 0:r.$type)===t)}function DE(e){return typeof e=="string"&&Pu.includes(e)}function li(e){if(typeof e=="string")return e;const t=e==null?void 0:e.id;return typeof t=="string"?t:void 0}function _h(e){const t=e.rootElements??[],n=t.find(W=>W.$type==="bpmn:Collaboration"),i=new Map(t.filter(W=>W.$type==="bpmn:Process").map(W=>[W.id,W])),r=[],o=[],a=[],s=[],c=[],u=[],l={poolOrders:{},bands:{},placements:{}},f=[],p=[],d=[],h=[],m=[],g=[],S=new Set,E=new Set,x=W=>{W&&S.add(W)},w=W=>{S.add(W),E.add(W)},C=W=>{const re=vh(W,"bwl:Placement");if(!re)return;const pe=typeof re.anchor=="string"?re.anchor:void 0;if(!pe||!DE(re.side))return;const oe=typeof re.offset=="number"?re.offset:void 0;m.push({owner:W.id,anchor:pe,side:re.side,...oe!==void 0?{offset:oe}:{}})},P=W=>{const re=vh(W,"bwl:Members"),pe=typeof(re==null?void 0:re.refs)=="string"?re.refs.split(/\s+/).filter(Boolean):[];pe.length&&g.push({owner:W.id,refs:pe})},L=W=>{var re;for(const pe of W)switch(x(pe.id),pe.$type){case"bpmn:TextAnnotation":w(pe.id),s.push({id:pe.id,text:typeof pe.text=="string"?pe.text:""}),C(pe);break;case"bpmn:Association":d.push({id:pe.id,type:pe.$type,source:li(pe.sourceRef),target:li(pe.targetRef)});break;case"bpmn:Group":{w(pe.id);const oe=(re=pe.categoryValueRef)==null?void 0:re.value;c.push({id:pe.id,...typeof oe=="string"&&oe?{name:oe}:{}}),P(pe);break}default:u.push({id:pe.id,type:pe.$type,reason:"type-outside-mvp"})}},T=(W,re)=>{const pe=W.flowElements??[],oe=(W.laneSets??[]).flatMap(ee=>ee.lanes??[]),fe=new Map;for(const ee of oe){x(ee.id);for(const V of ee.flowNodeRef??[]){const G=li(V);G&&fe.set(G,ee.id)}}for(const ee of pe){if(x(ee.id),ee.$type==="bpmn:SequenceFlow"){f.push({id:ee.id,source:li(ee.sourceRef),target:li(ee.targetRef),...typeof ee.name=="string"&&ee.name?{name:ee.name}:{}});continue}if(ee.$type==="bpmn:DataStoreReference"){w(ee.id),a.push({id:ee.id,...ee.name?{name:ee.name}:{}});continue}const V=kE(ee.$type);if(!Yf(V)){u.push({id:ee.id,type:ee.$type,reason:"type-outside-mvp"});continue}w(ee.id),o.push({id:ee.id,type:V,...ee.name?{name:ee.name}:{},...re?{participant:re}:{},...fe.has(ee.id)?{lane:fe.get(ee.id)}:{}});const G=yh(ee,"bwl:band");G!==void 0&&(l.bands[ee.id]=G);for(const K of ee.dataOutputAssociations??[])x(K.id),h.push({id:K.id,type:K.$type,source:ee.id,target:li(K.targetRef)});for(const K of ee.dataInputAssociations??[])x(K.id),h.push({id:K.id,type:K.$type,source:li((K.sourceRef??[])[0]),target:ee.id})}L(W.artifacts??[])};if(n){const W=new Set;for(const re of n.participants??[]){w(re.id);const pe=li(re.processRef);pe&&W.add(pe);const oe=pe?i.get(pe):void 0,fe=((oe==null?void 0:oe.laneSets)??[]).flatMap(K=>K.lanes??[]),ee=fe.map(K=>({id:K.id,...K.name?{name:K.name}:{}}));for(const K of ee)w(K.id);const V=!oe||(oe.flowElements??[]).length===0&&fe.length===0&&(oe.artifacts??[]).length===0;r.push({id:re.id,...re.name?{name:re.name}:{},...V?{blackBox:!0}:{},...ee.length?{lanes:ee}:{}});const G=yh(re,"bwl:poolOrder");G!==void 0&&(l.poolOrders[re.id]=G),oe&&T(oe,re.id)}for(const re of n.messageFlows??[])x(re.id),p.push({id:re.id,source:li(re.sourceRef),target:li(re.targetRef),...typeof re.name=="string"&&re.name?{name:re.name}:{}});L(n.artifacts??[]);for(const[re,pe]of i)!W.has(re)&&(pe.flowElements??[]).length>0&&u.push({id:re,type:pe.$type,reason:"unreachable-process"})}else for(const W of i.values())T(W);const B=[],k=[],O=[],$=[],ne=(W,re)=>!!W&&!!re&&E.has(W)&&E.has(re);for(const W of f){if(!ne(W.source,W.target)){u.push({id:W.id,type:"bpmn:SequenceFlow",reason:"endpoint-outside-mvp"});continue}B.push({id:W.id,source:W.source,target:W.target,...W.name?{name:W.name}:{}}),E.add(W.id)}for(const W of p){if(!ne(W.source,W.target)){u.push({id:W.id,type:"bpmn:MessageFlow",reason:"endpoint-outside-mvp"});continue}k.push({id:W.id,source:W.source,target:W.target,...W.name?{name:W.name}:{}}),E.add(W.id)}for(const W of h){if(!ne(W.source,W.target)){u.push({id:W.id??"",type:W.type,reason:"endpoint-outside-mvp"});continue}$.push({...W.id?{id:W.id}:{},source:W.source,target:W.target}),W.id&&E.add(W.id)}for(const W of d){if(!ne(W.source,W.target)){u.push({id:W.id??"",type:W.type,reason:"endpoint-outside-mvp"});continue}O.push({...W.id?{id:W.id}:{},source:W.source,target:W.target})}const le=new Map(c.map(W=>[W.id,W]));for(const{owner:W,refs:re}of g){const pe=re.filter(fe=>S.has(fe)),oe=le.get(W);oe&&pe.length&&(oe.members=pe)}for(const W of m)S.has(W.anchor)&&(l.placements[W.owner]={anchor:W.anchor,side:W.side,...W.offset!==void 0?{offset:W.offset}:{}});return{definition:{...r.length?{participants:r}:{},nodes:o,sequenceFlows:B,...k.length?{messageFlows:k}:{},...a.length?{dataStores:a}:{},...$.length?{dataAssociations:$}:{},...s.length?{annotations:s}:{},...O.length?{associations:O}:{},...c.length?{groups:c}:{}},hints:l,omitted:u}}async function LE(e){const{definitions:t,warnings:n}=await Vu(e);return{..._h(t),warnings:n}}function IE(e,t,n,i={}){return{documentId:e,baseVersion:t,ops:[...n],origin:i.origin??"agent",clientOpId:(i.mkClientOpId??(()=>crypto.randomUUID()))()}}async function bh(e,t,{currentVersion:n}){if(t.baseVersion!==n)return{status:"conflict",baseVersion:t.baseVersion,currentVersion:n};const i=gh(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 NE=Symbol("bpmn-editor");function BE(){const e=Ot.ref(!1),t=Ot.ref(!0),n=Ot.ref(!1);let i,r;const o=()=>{e.value=!0};function a(u,l){u.get("canvas").getContainer().style.pointerEvents=l?"":"none";const f=u.get("keyboard");l?(r&&f.bind(r),r=void 0):r||(r=f.getBinding(),f.unbind())}function s(){if(!i)throw new Error("modeler not attached — 뷰 @ready 후 attach() 필요");return i}function c(){return i==null?void 0:i.get("commandStack")}return{dirty:e,editable:t,agentBusy:n,attach(u){i&&this.detach(),i=u,i.get("eventBus").on("commandStack.changed",o),t.value||a(i,!1)},detach(){i==null||i.get("eventBus").off("commandStack.changed",o),i&&!t.value&&a(i,!0),r=void 0,i=void 0},setEditable(u){t.value=u,i&&a(i,u)},async applyAgentBatch(u,l){const f=s();n.value=!0;try{const p=await bh(f,u,{currentVersion:l});return p.status==="applied"&&(e.value=!1),p}finally{n.value=!1}},async importXml(u){const{warnings:l}=await s().importXML(u);return e.value=!1,{warnings:Wu(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 se(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}function $E(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var el={exports:{}},xh;function jE(){if(xh)return el.exports;xh=1;var e=el.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},el.exports}var FE=jE(),HE=$E(FE);function pi(e){if(!(this instanceof pi))return new pi(e);e=e||[128,36,1],this._seed=e.length?HE.rack(e[0],e[1],e[2]):e}pi.prototype.next=function(e){return this._seed(e||!0)},pi.prototype.nextPrefixed=function(e,t){var n;do n=e+this.next(!0);while(this.assigned(n));return this.claim(n,t),n},pi.prototype.claim=function(e,t){this._seed.set(e,t||!0)},pi.prototype.assigned=function(e){return this._seed.get(e)||!1},pi.prototype.unclaim=function(e){delete this._seed.hats[e]},pi.prototype.clear=function(){var e=this._seed.hats,t;for(t in e)this.unclaim(t)};const Ht={legend:[1,"<fieldset>","</fieldset>"],tr:[2,"<table><tbody>","</tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],_default:[0,"",""]};Ht.td=Ht.th=[3,"<table><tbody><tr>","</tr></tbody></table>"],Ht.option=Ht.optgroup=[1,'<select multiple="multiple">',"</select>"],Ht.thead=Ht.tbody=Ht.colgroup=Ht.caption=Ht.tfoot=[1,"<table>","</table>"],Ht.polyline=Ht.ellipse=Ht.polygon=Ht.circle=Ht.text=Ht.line=Ht.path=Ht.rect=Ht.g=[1,'<svg xmlns="http://www.w3.org/2000/svg" version="1.1">',"</svg>"];function dt(e,t=globalThis.document){var u;if(typeof e!="string")throw new TypeError("String expected");const n=/^<!--(.*?)-->$/s.exec(e);if(n)return t.createComment(n[1]);const i=(u=/<([\w:]+)/.exec(e))==null?void 0:u[1];if(!i)return t.createTextNode(e);if(e=e.trim(),i==="body"){const l=t.createElement("html");l.innerHTML=e;const{lastChild:f}=l;return f.remove(),f}let[r,o,a]=Object.hasOwn(Ht,i)?Ht[i]:Ht._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 zE(e,t){return t.forEach(function(n){n&&typeof n!="string"&&!Array.isArray(n)&&Object.keys(n).forEach(function(i){if(i!=="default"&&!(i in e)){var r=Object.getOwnPropertyDescriptor(n,i);Object.defineProperty(e,i,r.get?r:{enumerable:!0,get:function(){return n[i]}})}})}),Object.freeze(e)}function mn(e,...t){const n=e.style;return D(t,function(i){i&&D(i,function(r,o){n[o]=r})}),e}function ln(e,t,n){return arguments.length==2?e.getAttribute(t):n===null?e.removeAttribute(t):(e.setAttribute(t,n),e)}const GE=Object.prototype.toString;function vt(e){return new Qi(e)}function Qi(e){if(!e||!e.nodeType)throw new Error("A DOM element reference is required");this.el=e,this.list=e.classList}Qi.prototype.add=function(e){return this.list.add(e),this},Qi.prototype.remove=function(e){return GE.call(e)=="[object RegExp]"?this.removeMatching(e):(this.list.remove(e),this)},Qi.prototype.removeMatching=function(e){const t=this.array();for(let n=0;n<t.length;n++)e.test(t[n])&&this.remove(t[n]);return this},Qi.prototype.toggle=function(e,t){return typeof t<"u"?t!==this.list.toggle(e,t)&&this.list.toggle(e):this.list.toggle(e),this},Qi.prototype.array=function(){return Array.from(this.list)},Qi.prototype.has=Qi.prototype.contains=function(e){return this.list.contains(e)};function _s(e){for(var t;t=e.firstChild;)e.removeChild(t);return e}function Or(e,t,n){var i=n?e:e.parentNode;return i&&typeof i.closest=="function"&&i.closest(t)||null}function VE(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var bs={},wh;function WE(){if(wh)return bs;wh=1;var e,t,n;function i(){e=window.addEventListener?"addEventListener":"attachEvent",t=window.removeEventListener?"removeEventListener":"detachEvent",n=e!=="addEventListener"?"on":""}return bs.bind=function(r,o,a,s){return e||i(),r[e](n+o,a,s||!1),a},bs.unbind=function(r,o,a,s){return t||i(),r[t](n+o,a,s||!1),a},bs}var Eh=WE(),UE=VE(Eh),Te=zE({__proto__:null,default:UE},[Eh]),Sh=["focus","blur"];function qE(e,t,n,i,r){return Sh.indexOf(n)!==-1&&(r=!0),Te.bind(e,n,function(o){var a=o.target||o.srcElement;o.delegateTarget=Or(a,t,!0),o.delegateTarget&&i.call(e,o)},r)}function YE(e,t,n,i){return Sh.indexOf(t)!==-1&&(i=!0),Te.unbind(e,t,n,i)}var Pn={bind:qE,unbind:YE};function tl(e,t){return e&&typeof e.matches=="function"&&e.matches(t)||!1}function rt(e,t){return t=t||document,t.querySelector(e)}function xs(e,t){return t=t||document,t.querySelectorAll(e)}function fi(e){e.parentNode&&e.parentNode.removeChild(e)}function KE(e,t){if(e.ownerDocument!==t.ownerDocument)try{return t.ownerDocument.importNode(e,!0)}catch{}return e}function XE(e,t){return t.appendChild(KE(e,t))}function ke(e,t){return XE(t,e),e}var nl=2,Rh={"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":nl,"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":nl,"text-anchor":1,"text-decoration":1,"text-rendering":1,"unicode-bidi":1,visibility:1,"word-spacing":1,"writing-mode":1};function ZE(e,t){return Rh[t]?e.style[t]:e.getAttributeNS(null,t)}function Ch(e,t,n){var i=t.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase(),r=Rh[i];r?(r===nl&&typeof n=="number"&&(n=String(n)+"px"),e.style[i]=n):e.setAttributeNS(null,t,n)}function QE(e,t){var n=Object.keys(t),i,r;for(i=0,r;r=n[i];i++)Ch(e,r,t[r])}function ce(e,t,n){if(typeof t=="string")if(n!==void 0)Ch(e,t,n);else return ZE(e,t);else QE(e,t);return e}const JE=Object.prototype.toString;function Ve(e){return new Ji(e)}function Ji(e){if(!e||!e.nodeType)throw new Error("A DOM element reference is required");this.el=e,this.list=e.classList}Ji.prototype.add=function(e){return this.list.add(e),this},Ji.prototype.remove=function(e){return JE.call(e)=="[object RegExp]"?this.removeMatching(e):(this.list.remove(e),this)},Ji.prototype.removeMatching=function(e){const t=this.array();for(let n=0;n<t.length;n++)e.test(t[n])&&this.remove(t[n]);return this},Ji.prototype.toggle=function(e,t){return typeof t<"u"?t!==this.list.toggle(e,t)&&this.list.toggle(e):this.list.toggle(e),this},Ji.prototype.array=function(){return Array.from(this.list)},Ji.prototype.has=Ji.prototype.contains=function(e){return this.list.contains(e)};function ws(e){for(var t;t=e.firstChild;)e.removeChild(t);return e}function Ph(e){return e.cloneNode(!0)}var il={svg:"http://www.w3.org/2000/svg"},Ah='<svg xmlns="'+il.svg+'"';function e1(e){var t=!1;e.substring(0,4)==="<svg"?e.indexOf(il.svg)===-1&&(e=Ah+e.substring(4)):(e=Ah+">"+e+"</svg>",t=!0);var n=t1(e);if(!t)return n;for(var i=document.createDocumentFragment(),r=n.firstChild;r.firstChild;)i.appendChild(r.firstChild);return i}function t1(e){var t;return t=new DOMParser,t.async=!1,t.parseFromString(e,"text/xml")}function ge(e,t){var n;return e=e.trim(),e.charAt(0)==="<"?(n=e1(e).firstChild,n=document.importNode(n,!0)):n=document.createElementNS(il.svg,e),t&&ce(n,t),n}var rl=null;function Th(){return rl===null&&(rl=ge("svg")),rl}function Mh(e,t){var n,i,r=Object.keys(t);for(n=0;i=r[n];n++)e[i]=t[i];return e}function n1(e,t,n,i,r,o){var a=Th().createSVGMatrix();switch(arguments.length){case 0:return a;case 1:return Mh(a,e);case 6:return Mh(a,{a:e,b:t,c:n,d:i,e:r,f:o})}}function Xo(e){return Th().createSVGTransform()}var kh=/([&<>]{1})/g,i1=/([&<>\n\r"]{1})/g,r1={"&":"&","<":"<",">":">",'"':"'"};function ol(e,t){function n(i,r){return r1[r]||r}return e.replace(t,n)}function Oh(e,t){var n,i,r,o,a;switch(e.nodeType){case 3:t.push(ol(e.textContent,kh));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,'="',ol(o.value,i1),'"');if(e.hasChildNodes()){for(t.push(">"),a=e.childNodes,n=0,i=a.length;n<i;++n)Oh(a.item(n),t);t.push("</",e.tagName,">")}else t.push("/>");break;case 8:t.push("<!--",ol(e.nodeValue,kh),"-->");break;case 4:t.push("<![CDATA[",e.nodeValue,"]]>");break;default:throw new Error("unable to handle node "+e.nodeType)}return t}function o1(e){for(var t=e.firstChild,n=[];t;)Oh(t,n),t=t.nextSibling;return n.join("")}function Dh(e,t){return o1(e)}function zt(e){var t=e.parentNode;return t&&t.removeChild(e),e}function a1(e,t){return t instanceof SVGMatrix?e.createSVGTransformFromMatrix(t):t}function s1(e,t){var n,i;for(e.clear(),n=0;i=t[n];n++)e.appendItem(a1(e,i))}function Zo(e,t){var n=e.transform.baseVal;return t&&(Array.isArray(t)||(t=[t]),s1(n,t)),n.consolidate()}const c1=/^class[ {]/;function u1(e){return c1.test(e.toString())}function al(e){return Array.isArray(e)}function sl(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function Es(...e){e.length===1&&al(e[0])&&(e=e[0]),e=[...e];const t=e.pop();return t.$inject=e,t}const l1=/constructor\s*[^(]*\(\s*([^)]*)\)/m,p1=/^(?:async\s+)?(?:function\s*[^(]*)?(?:\(\s*([^)]*)\)|(\w+))/m,f1=/\/\*([^*]*)\*\//m;function d1(e){if(typeof e!="function")throw new Error(`Cannot annotate "${e}". Expected a function!`);const t=e.toString().match(u1(e)?l1:p1);if(!t)return[];const n=t[1]||t[2];return n&&n.split(",").map(i=>{const r=i.match(f1);return(r&&r[1]||i).trim()})||[]}function Lh(e,t){const n=t||{get:function(x,w){if(i.push(x),w===!1)return null;throw s(`No provider for "${x}"!`)}},i=[],r=this._providers=Object.create(n._providers||null),o=this._instances=Object.create(null),a=o.injector=this,s=function(x){const w=i.join(" -> ");return i.length=0,new Error(w?`${x} (Resolving: ${w})`:x)};function c(x,w){if(!r[x]&&x.includes(".")){const C=x.split(".");let P=c(C.shift());for(;C.length;)P=P[C.shift()];return P}if(sl(o,x))return o[x];if(sl(r,x)){if(i.indexOf(x)!==-1)throw i.push(x),s("Cannot resolve circular dependency!");return i.push(x),o[x]=r[x][0](r[x][1]),i.pop(),o[x]}return n.get(x,w)}function u(x,w){if(typeof w>"u"&&(w={}),typeof x!="function")if(al(x))x=Es(x.slice());else throw s(`Cannot invoke "${x}". Expected a function!`);const P=(x.$inject||d1(x)).map(L=>sl(w,L)?w[L]:c(L));return{fn:x,dependencies:P}}function l(x){const{fn:w,dependencies:C}=u(x),P=Function.prototype.bind.call(w,null,...C);return new P}function f(x,w,C){const{fn:P,dependencies:L}=u(x,C);return P.apply(w,L)}function p(x){return Es(w=>x.get(w))}function d(x,w){if(w&&w.length){const C=Object.create(null),P=Object.create(null),L=[],T=[],B=[];let k,O,$,ne;for(let le in r)k=r[le],w.indexOf(le)!==-1&&(k[2]==="private"?(O=L.indexOf(k[3]),O===-1?($=k[3].createChild([],w),ne=p($),L.push(k[3]),T.push($),B.push(ne),C[le]=[ne,le,"private",$]):C[le]=[B[O],le,"private",T[O]]):C[le]=[k[2],k[1]],P[le]=!0),(k[2]==="factory"||k[2]==="type")&&k[1].$scope&&w.forEach(je=>{k[1].$scope.indexOf(je)!==-1&&(C[le]=[k[2],k[1]],P[je]=!0)});w.forEach(le=>{if(!P[le])throw new Error('No provider for "'+le+'". Cannot use provider from the parent!')}),x.unshift(C)}return new Lh(x,a)}const h={factory:f,type:l,value:function(x){return x}};function m(x,w){const C=x.__init__||[];return function(){C.forEach(P=>{typeof P=="string"?w.get(P):w.invoke(P)})}}function g(x){const w=x.__exports__;if(w){const C=x.__modules__,P=Object.keys(x).reduce((O,$)=>($!=="__exports__"&&$!=="__modules__"&&$!=="__init__"&&$!=="__depends__"&&(O[$]=x[$]),O),Object.create(null)),L=(C||[]).concat(P),T=d(L),B=Es(function(O){return T.get(O)});w.forEach(function(O){r[O]=[B,O,"private",T]});const k=(x.__init__||[]).slice();return k.unshift(function(){T.init()}),x=Object.assign({},x,{__init__:k}),m(x,T)}return Object.keys(x).forEach(function(C){if(C==="__init__"||C==="__depends__")return;const P=x[C];if(P[2]==="private"){r[C]=P;return}const L=P[0],T=P[1];r[C]=[h[L],h1(L,T),L]}),m(x,a)}function S(x,w){return x.indexOf(w)!==-1||(x=(w.__depends__||[]).reduce(S,x),x.indexOf(w)!==-1)?x:x.concat(w)}function E(x){const w=x.reduce(S,[]).map(g);let C=!1;return function(){C||(C=!0,w.forEach(P=>P()))}}this.get=c,this.invoke=f,this.instantiate=l,this.createChild=d,this.init=E(e)}function h1(e,t){return e!=="value"&&al(t)&&(t=Es(t.slice())),t}var m1=1e3;function Oi(e,t){var n=this;t=t||m1,e.on(["render.shape","render.connection"],t,function(i,r){var o=i.type,a=r.element,s=r.gfx,c=r.attrs;if(n.canRender(a))return o==="render.shape"?n.drawShape(s,a,c):n.drawConnection(s,a,c)}),e.on(["render.getShapePath","render.getConnectionPath"],t,function(i,r){if(n.canRender(r))return i.type==="render.getShapePath"?n.getShapePath(r):n.getConnectionPath(r)})}Oi.prototype.canRender=function(e){},Oi.prototype.drawShape=function(e,t){},Oi.prototype.drawConnection=function(e,t){},Oi.prototype.getShapePath=function(e){},Oi.prototype.getConnectionPath=function(e){};function Dr(e){return e.flat().join(",").replace(/,?([A-Za-z]),?/g,"$1")}function g1(e){return["M",e.x,e.y]}function cl(e){return["L",e.x,e.y]}function y1(e,t,n){return["C",e.x,e.y,t.x,t.y,n.x,n.y]}function v1(e,t){const n=e.length,i=[g1(e[0])];for(let r=1;r<n;r++){const o=e[r-1],a=e[r],s=e[r+1];if(!s||!t){i.push(cl(a));continue}const c=Math.min(t,ul(a.x-o.x,a.y-o.y),ul(s.x-a.x,s.y-a.y));if(!c){i.push(cl(a));continue}const u=Ss(a,o,c),l=Ss(a,o,c*.5),f=Ss(a,s,c),p=Ss(a,s,c*.5);i.push(cl(u)),i.push(y1(l,p,f))}return i}function Ss(e,t,n){const i=t.x-e.x,r=t.y-e.y,o=ul(i,r),a=n/o;return{x:e.x+i*a,y:e.y+r*a}}function ul(e,t){return Math.sqrt(Math.pow(e,2)+Math.pow(t,2))}function Qo(e,t,n){Ce(t)&&(n=t,t=null),t||(t={});const i=ge("path",t);return Ce(n)&&(i.dataset.cornerRadius=String(n)),ll(i,e)}function ll(e,t){const n=parseInt(e.dataset.cornerRadius,10)||0;return ce(e,{d:Dr(v1(t,n))}),e}function Rs(e){var t=new Set(e);return $e(e,function(n){for(var i=n.parent;i;){if(t.has(i))return!1;i=i.parent}return!0})}function Lr(e,t,n){n=n||0,xe(e)||(e=[e]),D(e,function(i,r){var o=t(i,r,n);xe(o)&&o.length&&Lr(o,t,n+1)})}function pl(e,t,n){var i=new Set,r=new Set;return Lr(e,function(o,a,s){i.add(o);var c=o.children;if(c&&!r.has(c))return r.add(c),c}),Array.from(i)}function Jo(e,t){return pl(e)}function _1(e,t,n){Cr(t)&&(t=!0),Ut(t)&&(n=t,t=!0),n=n||{};var i=ea(n.allShapes),r=ea(n.allConnections),o=ea(n.enclosedElements),a=ea(n.enclosedConnections),s=ea(n.topLevel,t&&io(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,D(l.incoming,c),D(l.outgoing,c),l.children}return Lr(e,u),{allShapes:i,allConnections:r,topLevel:s,enclosedConnections:a,enclosedElements:o}}function Lt(e,t){t=!!t,xe(e)||(e=[e]);var n,i,r,o;return D(e,function(a){var s=a;a.waypoints&&!t&&(s=Lt(a.waypoints,!0));var c=s.x,u=s.y,l=s.height||0,f=s.width||0;(c<n||n===void 0)&&(n=c),(u<i||i===void 0)&&(i=u),(c+f>r||r===void 0)&&(r=c+f),(u+l>o||o===void 0)&&(o=u+l)}),{x:n,y:i,height:o-i,width:r-n}}function po(e,t){var n={};return D(e,function(i){var r=i;r.waypoints&&(r=Lt(r)),!Ce(t.y)&&r.x>t.x&&(n[i.id]=i),!Ce(t.x)&&r.y>t.y&&(n[i.id]=i),r.x>t.x&&r.y>t.y&&(Ce(t.width)&&Ce(t.height)&&r.width+r.x<t.width+t.x&&r.height+r.y<t.height+t.y||!Ce(t.width)||!Ce(t.height))&&(n[i.id]=i)}),n}function Ih(e){return"waypoints"in e?"connection":"x"in e?"shape":"root"}function Nh(e){return!!(e&&e.isFrame)}function ea(e,t){return j({},e||{},t||{})}var b1=1;function er(e,t){Oi.call(this,e,b1),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})}se(er,Oi),er.prototype.canRender=function(){return!0},er.prototype.drawShape=function(t,n,i){var r=ge("rect");return ce(r,{x:0,y:0,width:n.width||0,height:n.height||0}),Nh(n)?ce(r,j({},this.FRAME_STYLE,i||{})):ce(r,j({},this.SHAPE_STYLE,i||{})),ke(t,r),r},er.prototype.drawConnection=function(t,n,i){var r=Qo(n.waypoints,j({},this.CONNECTION_STYLE,i||{}));return ke(t,r),r},er.prototype.getShapePath=function(t){var n=t.x,i=t.y,r=t.width,o=t.height,a=[["M",n,i],["l",r,0],["l",0,o],["l",-r,0],["z"]];return Dr(a)},er.prototype.getConnectionPath=function(t){var n=t.waypoints,i,r,o=[];for(i=0;r=n[i];i++)r=r.original||r,o.push([i===0?"M":"L",r.x,r.y]);return Dr(o)},er.$inject=["eventBus","styles"];function x1(){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 j(o,{class:n})},this.style=function(n,i){!xe(n)&&!i&&(i=n,n=[]);var r=Rn(n,function(o,a){return j(o,e[a]||{})},{});return i?j(r,i):r},this.computeStyle=function(n,i,r){return xe(i)||(r=i,i=[]),t.style(i||[],j({},r,n||{}))}}const w1={__init__:["defaultRenderer"],defaultRenderer:["type",er],styles:["type",x1]};function Pt(e,t){if(!e||!t)return-1;var n=e.indexOf(t);return n!==-1&&e.splice(n,1),n}function Mt(e,t,n){if(!(!e||!t)){typeof n!="number"&&(n=-1);var i=e.indexOf(t);if(i!==-1){if(i===n)return;if(n!==-1)e.splice(i,1);else return}n!==-1?e.splice(n,0,t):e.push(t)}}function fl(e,t){return!e||!t?-1:e.indexOf(t)}function ta(e,t){return!e||!t?-1:Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function dl(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=ta(e,t);return Math.abs(r/o)<=i}var E1=2;function Di(e,t){var n=Array.from(arguments).flat();const i={x:"v",y:"h"};for(const[r,o]of Object.entries(i))if(S1(r,n))return o;return!1}function S1(e,t){const n=t[0];return Pr(t,function(i){return Math.abs(n[e]-i[e])<=E1})}function Bh(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 hl(e,t){return{x:Math.round(e.x+(t.x-e.x)/2),y:Math.round(e.y+(t.y-e.y)/2)}}var R1=/,?([a-z]),?/gi,$h=parseFloat,It=Math,tr=It.PI,di=It.min,hi=It.max,jh=It.pow,nr=It.abs,C1=/([a-z])[\s,]*((-?\d*\.?\d*(?:e[-+]?\d+)?[\s]*,?[\s]*)+)/ig,P1=/(-?\d*\.?\d*(?:e[-+]?\d+)?)[\s]*,?[\s]*/ig,Fh=Array.isArray||function(e){return e instanceof Array};function A1(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function T1(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 M1(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 A1(r,i)?(T1(o,i),r[i]):(o.length>=1e3&&delete r[o.shift()],o.push(i),r[i]=e(...arguments),r[i])}return t}function k1(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(C1,function(i,r,o){var a=[],s=r.toLowerCase();for(o.replace(P1,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=gl,n}function O1(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 D1(e){for(var t=0,n=e.length;t<n;t++){var i=e[t][0];if(i!=="M"&&i!=="C")return!1}return!0}function ml(e,t,n,i){return arguments.length===1&&(t=e.y,n=e.width,i=e.height,e=e.x),{x:e,y:t,width:n,height:i,x2:e+n,y2:t+i}}function gl(){return this.join(",").replace(R1,"$1")}function L1(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=gl,t}function Hh(e,t,n,i,r,o,a,s,c){var u=1-c,l=jh(u,3),f=jh(u,2),p=c*c,d=p*c,h=l*e+f*3*c*n+u*3*c*c*r+d*a,m=l*t+f*3*c*i+u*3*c*c*o+d*s;return{x:Cs(h),y:Cs(m)}}function zh(e){var t=F1(...e);return ml(t.x0,t.y0,t.x1-t.x0,t.y1-t.y0)}function ir(e,t,n){return t>=e.x&&t<=e.x+e.width&&n>=e.y&&n<=e.y+e.height}function I1(e,t){return e=ml(e),t=ml(t),ir(t,e.x,e.y)||ir(t,e.x2,e.y)||ir(t,e.x,e.y2)||ir(t,e.x2,e.y2)||ir(e,t.x,t.y)||ir(e,t.x2,t.y)||ir(e,t.x,t.y2)||ir(e,t.x2,t.y2)||(e.x<t.x2&&e.x>t.x||t.x<e.x2&&t.x>e.x)&&(e.y<t.y2&&e.y>t.y||t.y<e.y2&&t.y>e.y)}function Gh(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 Vh(e,t,n,i,r,o,a,s,c){c==null&&(c=1),c=c>1?1:c<0?0:c;for(var u=c/2,l=12,f=[-.1252,.1252,-.3678,.3678,-.5873,.5873,-.7699,.7699,-.9041,.9041,-.9816,.9816],p=[.2491,.2491,.2335,.2335,.2032,.2032,.1601,.1601,.1069,.1069,.0472,.0472],d=0,h=0;h<l;h++){var m=u*f[h]+u,g=Gh(m,e,n,r,a),S=Gh(m,t,i,o,s),E=g*g+S*S;d+=p[h]*It.sqrt(E)}return u*d}function N1(e,t,n,i,r,o,a,s){if(!(hi(e,n)<di(r,a)||di(e,n)>hi(r,a)||hi(t,i)<di(o,s)||di(t,i)>hi(o,s))){var c=(e*i-t*n)*(r-a)-(e-n)*(r*s-o*a),u=(e*i-t*n)*(o-s)-(t-i)*(r*s-o*a),l=(e-n)*(o-s)-(t-i)*(r-a);if(l){var f=Cs(c/l),p=Cs(u/l),d=+f.toFixed(2),h=+p.toFixed(2);if(!(d<+di(e,n).toFixed(2)||d>+hi(e,n).toFixed(2)||d<+di(r,a).toFixed(2)||d>+hi(r,a).toFixed(2)||h<+di(t,i).toFixed(2)||h>+hi(t,i).toFixed(2)||h<+di(o,s).toFixed(2)||h>+hi(o,s).toFixed(2)))return{x:f,y:p}}}}function Cs(e){return Math.round(e*1e11)/1e11}function B1(e,t,n){var i=zh(e),r=zh(t);if(!I1(i,r))return[];var o=Vh(...e),a=Vh(...t),s=Uh(e)?1:~~(o/5)||1,c=Uh(t)?1:~~(a/5)||1,u=new Array(s+1),l=new Array(c+1),f={},p=[],d,h;for(d=0;d<s+1;d++){var m=Hh(...e,d/s);u[d]={x:m.x,y:m.y,t:d/s}}for(d=0;d<c+1;d++)m=Hh(...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],x=l[h+1],w=nr(S.x-g.x)<.01?"y":"x",C=nr(x.x-E.x)<.01?"y":"x",P=N1(g.x,g.y,S.x,S.y,E.x,E.y,x.x,x.y),L;if(P){if(L=P.x.toFixed(9)+"#"+P.y.toFixed(9),f[L])continue;f[L]=!0;var T=g.t+nr((P[w]-g[w])/(S[w]-g[w]))*(S.t-g.t),B=E.t+nr((P[C]-E[C])/(x[C]-E[C]))*(x.t-E.t);T>=0&&T<=1&&B>=0&&B<=1&&p.push({x:P.x,y:P.y,t1:T,t2:B})}}return p}function Wh(e,t,n){e=Kh(e),t=Kh(t);for(var i,r,o,a,s,c,u,l,f,p,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"?(f=[i,r,...g.slice(1)],i=f[6],r=f[7]):(f=[i,r,i,r,s,c,s,c],i=s,r=c);for(var S=0,E=t.length;S<E;S++){var x=t[S];if(x[0]=="M")o=u=x[1],a=l=x[2];else{x[0]=="C"?(p=[o,a,...x.slice(1)],o=p[6],a=p[7]):(p=[o,a,o,a,u,l,u,l],o=u,a=l);var w=B1(f,p);{for(var C=0,P=w.length;C<P;C++)w[C].segment1=h,w[C].segment2=S,w[C].bez1=f,w[C].bez2=p;d=d.concat(w)}}}}}return d}function $1(e){return Fh(e)&&Fh(e[0])}function j1(e){if(O1(e))return e;var t=new Array(e.length),n=0,i=0,r=0,o=0,a=0,s;e[0][0]=="M"&&(n=+e[0][1],i=+e[0][2],r=n,o=i,a++,t[0]=["M",n,i]);for(var c,u,l=a,f=e.length;l<f;l++){if(u=e[l],s=u[0],t[l]=c=new Array(u.length),s!=s.toUpperCase())switch(c[0]=s.toUpperCase(),c[0]){case"A":c[1]=u[1],c[2]=u[2],c[3]=u[3],c[4]=u[4],c[5]=u[5],c[6]=+u[6]+n,c[7]=+u[7]+i;break;case"V":c[1]=+u[1]+i;break;case"H":c[1]=+u[1]+n;break;case"M":r=+u[1]+n,o=+u[2]+i;default:for(var p=1,d=u.length;p<d;p++)c[p]=+u[p]+(p%2?n:i)}else for(var 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=gl,t}function Uh(e){return e[0]===e[2]&&e[1]===e[3]&&e[4]===e[6]&&e[5]===e[7]}function Ps(e,t,n,i){return[e,t,n,i,n,i]}function qh(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 Yh(e,t,n,i,r,o,a,s,c,u){var l=tr*120/180,f=tr/180*(+r||0),p=[],d,h=M1(function(A,_,y){var I=A*It.cos(y)-_*It.sin(y),H=A*It.sin(y)+_*It.cos(y);return{x:I,y:H}});if(u)L=u[0],T=u[1],C=u[2],P=u[3];else{d=h(e,t,-f),e=d.x,t=d.y,d=h(s,c,-f),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=It.sqrt(S),n=S*n,i=S*i);var E=n*n,x=i*i,w=(o==a?-1:1)*It.sqrt(nr((E*x-E*g*g-x*m*m)/(E*g*g+x*m*m))),C=w*n*g/i+(e+s)/2,P=w*-i*m/n+(t+c)/2,L=It.asin(((t-P)/i).toFixed(9)),T=It.asin(((c-P)/i).toFixed(9));L=e<C?tr-L:L,T=s<C?tr-T:T,L<0&&(L=tr*2+L),T<0&&(T=tr*2+T),a&&L>T&&(L=L-tr*2),!a&&T>L&&(T=T-tr*2)}var B=T-L;if(nr(B)>l){var k=T,O=s,$=c;T=L+l*(a&&T>L?1:-1),s=C+n*It.cos(T),c=P+i*It.sin(T),p=Yh(s,c,n,i,r,0,a,O,$,[T,k,C,P])}B=T-L;var ne=It.cos(L),le=It.sin(L),je=It.cos(T),W=It.sin(T),re=It.tan(B/4),pe=4/3*n*re,oe=4/3*i*re,fe=[e,t],ee=[e+pe*le,t-oe*ne],V=[s+pe*W,c-oe*je],G=[s,c];if(ee[0]=2*fe[0]-ee[0],ee[1]=2*fe[1]-ee[1],u)return[ee,V,G].concat(p);p=[ee,V,G].concat(p).join().split(",");for(var K=[],De=0,Kt=p.length;De<Kt;De++)K[De]=De%2?h(p[De-1],p[De],f).y:h(p[De],p[De+1],f).x;return K}function F1(e,t,n,i,r,o,a,s){for(var c=[],u=[[],[]],l,f,p,d,h,m,g,S,E=0;E<2;++E){if(E==0?(f=6*e-12*n+6*r,l=-3*e+9*n-9*r+3*a,p=3*n-3*e):(f=6*t-12*i+6*o,l=-3*t+9*i-9*o+3*s,p=3*i-3*t),nr(l)<1e-12){if(nr(f)<1e-12)continue;d=-p/f,0<d&&d<1&&c.push(d);continue}g=f*f-4*p*l,S=It.sqrt(g),!(g<0)&&(h=(-f+S)/(2*l),0<h&&h<1&&c.push(h),m=(-f-S)/(2*l),0<m&&m<1&&c.push(m))}for(var x=c.length,w=x,C;x--;)d=c[x],C=1-d,u[0][x]=C*C*C*e+3*C*C*d*n+3*C*d*d*r+d*d*d*a,u[1][x]=C*C*C*t+3*C*C*d*i+3*C*d*d*o+d*d*d*s;return u[0][w]=e,u[1][w]=t,u[0][w+1]=a,u[1][w+1]=s,u[0].length=u[1].length=w+2,{x0:di(...u[0]),y0:di(...u[1]),x1:hi(...u[0]),y1:hi(...u[1])}}function Kh(e){if($1(e)||(e=k1(e)),D1(e))return e;for(var t=L1(j1(e)),n={x:0,y:0,bx:0,by:0,X:0,Y:0,qx:null,qy:null},i=function(p,d,h){var m,g;if(!p)return["C",d.x,d.y,d.x,d.y,d.x,d.y];switch(!(p[0]in{T:1,Q:1})&&(d.qx=d.qy=null),p[0]){case"M":d.X=p[1],d.Y=p[2];break;case"A":p=["C",...Yh(d.x,d.y,...p.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),p=["C",m,g,...p.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),p=["C",...qh(d.x,d.y,d.qx,d.qy,p[1],p[2])];break;case"Q":d.qx=p[1],d.qy=p[2],p=["C",...qh(d.x,d.y,p[1],p[2],p[3],p[4])];break;case"L":p=["C",...Ps(d.x,d.y,p[1],p[2])];break;case"H":p=["C",...Ps(d.x,d.y,p[1],d.y)];break;case"V":p=["C",...Ps(d.x,d.y,d.x,p[1])];break;case"Z":p=["C",...Ps(d.x,d.y,d.X,d.Y)];break}return p},r=function(p,d){if(p[d].length>7){p[d].shift();for(var h=p[d];h.length;)o[d]="A",p.splice(d++,0,["C",...h.splice(0,6)]);p.splice(d,1),u=t.length}},o=[],a="",s="",c=0,u=t.length;c<u;c++){t[c]&&(a=t[c][0]),a!="C"&&(o[c]=a,c&&(s=o[c-1])),t[c]=i(t[c],n,s),o[c]!="A"&&a=="C"&&(o[c]="C"),r(t,c);var l=t[c],f=l.length;n.x=l[f-2],n.y=l[f-1],n.bx=$h(l[f-4])||n.x,n.by=$h(l[f-3])||n.y}return t}function st(e){return Ut(e)&&Sn(e,"waypoints")}function Ne(e){return Ut(e)&&Sn(e,"labelTarget")}function H1(e){return Ut(e)&&to(e.parent)}function Xh(e){return{x:Math.round(e.x),y:Math.round(e.y),width:Math.round(e.width),height:Math.round(e.height)}}function Li(e){return{x:Math.round(e.x),y:Math.round(e.y)}}function ve(e){return{top:e.y,right:e.x+(e.width||0),bottom:e.y+(e.height||0),left:e.x}}function As(e){return{x:e.left,y:e.top,width:e.right-e.left,height:e.bottom-e.top}}function z1(e){return Li({x:e.x+(e.width||0)/2,y:e.y+(e.height||0)/2})}function G1(e){for(var t=e.waypoints,n=t.reduce(function(u,l,f){var p=t[f-1];if(p){var d=u[u.length-1],h=d&&d.endLength||0,m=U1(p,l);u.push({start:p,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 we(e){return st(e)?G1(e):z1(e)}function tn(e,t,n){n=n||0,Ut(n)||(n={x:n,y:n});var i=ve(e),r=ve(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 na(e,t,n){var i=V1(e,t);return i.length===1||i.length===2&&ta(i[0],i[1])<1?Li(i[0]):i.length>1?(i=ai(i,function(r){var o=Math.floor(r.t2*100)||1;return o=100-o,o=(o<10?"0":"")+o,r.segment2+"#"+o}),Li(i[n?0:i.length-1])):null}function V1(e,t){return Wh(e,t)}function W1(e){e=e.slice();for(var t=0,n,i,r;e[t];)n=e[t],i=e[t-1],r=e[t+1],ta(n,r)===0||dl(i,r,n)?e.splice(t,1):t++;return e}function U1(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function Ts(e,t){return Math.round(e*t)/t}function Zh(e){return Ce(e)?e+"px":e}function q1(e){for(;e.parent;)e=e.parent;return e}function Y1(e){e=j({},{width:"100%",height:"100%"},e);const t=e.container||document.body,n=document.createElement("div");return n.setAttribute("class","djs-container djs-parent"),mn(n,{position:"relative",overflow:"hidden",width:Zh(e.width),height:Zh(e.height)}),t.appendChild(n),n}function Qh(e,t,n){const i=ge("g");Ve(i).add(t);const r=n!==void 0?n:e.childNodes.length-1;return e.insertBefore(i,e.childNodes[r]||null),i}const K1="base",Jh=0,X1=1,Z1={shape:["x","y","width","height"],connection:["waypoints"]};function Ee(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||{})}Ee.$inject=["config.canvas","eventBus","graphicsFactory","elementRegistry"],Ee.prototype._init=function(e){const t=this._eventBus,n=this._container=Y1(e),i=this._svg=ge("svg");ce(i,{width:"100%",height:"100%"}),ln(i,"tabindex",0),e.autoFocus&&t.on("element.hover",()=>{this.restoreFocus()}),t.on("element.mousedown",500,o=>{this.focus()}),i.addEventListener("focusin",()=>{this._setFocused(!0)}),i.addEventListener("focusout",()=>{this._setFocused(!1)}),i.addEventListener("mouseover",()=>{this._eventBus.fire("canvas.mouseover")}),i.addEventListener("mouseout",()=>{this._eventBus.fire("canvas.mouseout")}),ke(n,i);const r=this._viewport=Qh(i,"viewport");e.deferUpdate&&(this._viewboxChanged=ku(this._viewboxChanged,300)),this._restoreFocus=ku(this._restoreFocus,0),t.on("diagram.init",()=>{t.fire("canvas.init",{svg:i,viewport:r})}),t.on(["shape.added","connection.added","shape.removed","connection.removed","elements.changed","root.set"],()=>{delete this._cachedViewbox}),t.on("diagram.destroy",500,this._destroy,this),t.on("diagram.clear",500,this._clear,this)},Ee.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},Ee.prototype._setFocused=function(e){e!=this._focused&&(this._focused=e,this._eventBus.fire("canvas.focus.changed",{focused:e}))},Ee.prototype._clear=function(){this._elementRegistry.getAll().forEach(t=>{const n=Ih(t);n==="root"?this.removeRootElement(t):this._removeElement(t,n)}),this._planes=[],this._rootElement=null,delete this._cachedViewbox},Ee.prototype.focus=function(){this._svg.focus({preventScroll:!0}),this._setFocused(!0)},Ee.prototype.restoreFocus=function(){this._restoreFocus()},Ee.prototype._restoreFocus=function(){document.activeElement===document.body&&this.focus()},Ee.prototype.isFocused=function(){return this._focused},Ee.prototype.getDefaultLayer=function(){return this.getLayer(K1,Jh)},Ee.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},Ee.prototype._getChildIndex=function(e){return Rn(this._layers,function(t,n){return n.visible&&e>=n.index&&t++,t},0)},Ee.prototype._createLayer=function(e,t){typeof t>"u"&&(t=X1);const n=this._getChildIndex(t);return{group:Qh(this._viewport,"layer-"+e,n),index:t,visible:!0}},Ee.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},Ee.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&&(zt(n),t.visible=!1),n},Ee.prototype._removeLayer=function(e){const t=this._layers[e];t&&(delete this._layers[e],zt(t.group))},Ee.prototype.getActiveLayer=function(){const e=this._findPlaneForRoot(this.getRootElement());return e?e.layer:null},Ee.prototype.findRoot=function(e){const t=this._resolveElements(e);let n;for(const i of t){const r=this._findPlaneForRoot(q1(i));if(!r||n&&r.rootElement!==n)return;n=r.rootElement}return n},Ee.prototype.getRootElements=function(){return this._planes.map(function(e){return e.rootElement})},Ee.prototype._findPlaneForRoot=function(e){return lt(this._planes,function(t){return t.rootElement===e})},Ee.prototype._resolveElement=function(e){return typeof e=="string"?this._elementRegistry.get(e):e},Ee.prototype._resolveElements=function(e){return xe(e)||(e=[e]),e.map(t=>this._resolveElement(t)).filter(Boolean)},Ee.prototype.getContainer=function(){return this._container},Ee.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&&(D([i.gfx,i.secondaryGfx],function(r){r&&(n?(e.markers.add(t),Ve(r).add(t)):(e.markers.delete(t),Ve(r).remove(t)))}),this._eventBus.fire("element.marker.update",{element:e,gfx:i.gfx,marker:t,add:!!n}))},Ee.prototype.addMarker=function(e,t){this._updateMarker(e,t,!0)},Ee.prototype.removeMarker=function(e,t){this._updateMarker(e,t,!1)},Ee.prototype.hasMarker=function(e,t){return e=this._resolveElement(e),e.markers?e.markers.has(t):!1},Ee.prototype.toggleMarker=function(e,t){this.hasMarker(e,t)?this.removeMarker(e,t):this.addMarker(e,t)},Ee.prototype.getRootElement=function(){const e=this._rootElement;return e||this._planes.length?e:this.setRootElement(this.addRootElement(null))},Ee.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,Jh);return this.hideLayer(n),this._addRoot(e,i),this._planes.push({rootElement:e,layer:i}),e},Ee.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},Ee.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},Ee.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)},Ee.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})},Ee.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})},Ee.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=Z1[e];if(!Pr(n,function(r){return typeof t[r]<"u"}))throw new Error("must supply { "+n.join(", ")+" } with "+e)},Ee.prototype._setParent=function(e,t,n){Mt(t.children,e,n),e.parent=t},Ee.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},Ee.prototype.addShape=function(e,t,n){return this._addElement("shape",e,t,n)},Ee.prototype.addConnection=function(e,t,n){return this._addElement("connection",e,t,n)},Ee.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},Ee.prototype.removeShape=function(e){return this._removeElement(e,"shape")},Ee.prototype.removeConnection=function(e){return this._removeElement(e,"connection")},Ee.prototype.getGraphics=function(e,t){return this._elementRegistry.getGraphics(e,t)},Ee.prototype._changeViewbox=function(e){this._eventBus.fire("canvas.viewbox.changing"),e.apply(this),this._cachedViewbox=null,this._viewboxChanged()},Ee.prototype._viewboxChanged=function(){this._eventBus.fire("canvas.viewbox.changed",{viewbox:this.viewbox()})},Ee.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);Zo(t,l)});else return o=this._rootElement?this.getActiveLayer():null,i=o&&o.getBBox()||{},a=Zo(t),r=a?a.matrix:n1(),s=Ts(r.a,1e3),c=Ts(-r.e||0,1e3),u=Ts(-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},Ee.prototype.scroll=function(e){const t=this._viewport;let n=t.getCTM();return e&&this._changeViewbox(function(){e=j({dx:0,dy:0},e||{}),n=this._svg.createSVGMatrix().translate(e.dx,e.dy).multiply(n),em(t,n)}),{x:n.e,y:n.f}},Ee.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=Lt(o),s=ve(a),c=this.viewbox(),u=this.zoom();let l,f;c.y+=t.top/u,c.x+=t.left/u,c.width-=(t.right+t.left)/u,c.height-=(t.bottom+t.top)/u;const p=ve(c);if(!(a.width<c.width&&a.height<c.height))l=a.x-c.x,f=a.y-c.y;else{const h=Math.max(0,s.right-p.right),m=Math.min(0,s.left-p.left),g=Math.max(0,s.bottom-p.bottom),S=Math.min(0,s.top-p.top);l=h||m,f=g||S}this.scroll({dx:-l*u,dy:-f*u})},Ee.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)}),Ts(i.a,1e3)};function em(e,t){const n="matrix("+t.a+","+t.b+","+t.c+","+t.d+","+t.e+","+t.f+")";e.setAttribute("transform",n)}Ee.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},Ee.prototype._setZoom=function(e,t){const n=this._svg,i=this._viewport,r=n.createSVGMatrix(),o=n.createSVGPoint();let a,s,c,u,l;c=i.getCTM();const f=c.a;return t?(a=j(o,t),s=a.matrixTransform(c.inverse()),u=r.translate(s.x,s.y).scale(1/f*e).translate(-s.x,-s.y),l=c.multiply(u)):l=r.scale(e),em(this._viewport,l),l},Ee.prototype.getSize=function(){return{width:this._container.clientWidth,height:this._container.clientHeight}},Ee.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}},Ee.prototype.resized=function(){delete this._cachedViewbox,this._eventBus.fire("canvas.resized")};var fo="data-element-id";function Nn(e){this._elements={},this._eventBus=e}Nn.$inject=["eventBus"],Nn.prototype.add=function(e,t,n){var i=e.id;this._validateId(i),ce(t,fo,i),n&&ce(n,fo,i),this._elements[i]={element:e,gfx:t,secondaryGfx:n}},Nn.prototype.remove=function(e){var t=this._elements,n=e.id||e,i=n&&t[n];i&&(ce(i.gfx,fo,""),i.secondaryGfx&&ce(i.secondaryGfx,fo,""),delete t[n])},Nn.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)},Nn.prototype.updateGraphics=function(e,t,n){var i=e.id||e,r=this._elements[i];return n?r.secondaryGfx=t:r.gfx=t,t&&ce(t,fo,i),t},Nn.prototype.get=function(e){var t;typeof e=="string"?t=e:t=e&&ce(e,fo);var n=this._elements[t];return n&&n.element},Nn.prototype.filter=function(e){var t=[];return this.forEach(function(n,i){e(n,i)&&t.push(n)}),t},Nn.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}},Nn.prototype.getAll=function(){return this.filter(function(e){return e})},Nn.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)})},Nn.prototype.getGraphics=function(e,t){var n=e.id||e,i=this._elements[n];return i&&(t?i.secondaryGfx:i.gfx)},Nn.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 Q1(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 J1(e){return e.__refs_collection===!0}function eS(e,t){return Object.prototype.hasOwnProperty.call(e,t.name||t)}function tm(e,t,n){var i=Q1(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 tS(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 zn(e,t){if(!(this instanceof zn))return new zn(e,t);e.inverse=t,t.inverse=e,this.props={},this.props[e.name]=e,this.props[t.name]=t}zn.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?tm(this,t,e):tS(this,t,e)},zn.prototype.ensureRefsCollection=function(e,t){var n=e[t.name];return J1(n)||tm(this,t,e),n},zn.prototype.ensureBound=function(e,t){eS(e,t)||this.bind(e,t)},zn.prototype.unset=function(e,t,n){e&&(this.ensureBound(e,t),t.collection?this.ensureRefsCollection(e,t).remove(n):e[t.name]=void 0)},zn.prototype.set=function(e,t,n){e&&(this.ensureBound(e,t),t.collection?this.ensureRefsCollection(e,t).add(n):e[t.name]=n)};var yl=new zn({name:"children",enumerable:!0,collection:!0},{name:"parent"}),nm=new zn({name:"labels",enumerable:!0,collection:!0},{name:"labelTarget"}),im=new zn({name:"attachers",collection:!0},{name:"host"}),rm=new zn({name:"outgoing",collection:!0},{name:"source"}),om=new zn({name:"incoming",collection:!0},{name:"target"});function ho(){Object.defineProperty(this,"businessObject",{writable:!0}),Object.defineProperty(this,"label",{get:function(){return this.labels[0]},set:function(e){var t=this.label,n=this.labels;!e&&t?n.remove(t):n.add(e,0)}}),yl.bind(this,"parent"),nm.bind(this,"labels"),rm.bind(this,"outgoing"),om.bind(this,"incoming")}function ia(){ho.call(this),yl.bind(this,"children"),im.bind(this,"host"),im.bind(this,"attachers")}se(ia,ho);function am(){ho.call(this),yl.bind(this,"children")}se(am,ia);function sm(){ia.call(this),nm.bind(this,"labelTarget")}se(sm,ia);function cm(){ho.call(this),rm.bind(this,"source"),om.bind(this,"target")}se(cm,ho);var nS={connection:cm,shape:ia,label:sm,root:am};function iS(e,t){var n=nS[e];if(!n)throw new Error("unknown type: <"+e+">");return j(new n,t)}function rS(e){return e instanceof ho}function Ii(){this._uid=12}Ii.prototype.createRoot=function(e){return this.create("root",e)},Ii.prototype.createLabel=function(e){return this.create("label",e)},Ii.prototype.createShape=function(e){return this.create("shape",e)},Ii.prototype.createConnection=function(e){return this.create("connection",e)},Ii.prototype.create=function(e,t){return t=j({},t||{}),t.id||(t.id=e+"_"+this._uid++),iS(e,t)};var Ms="__fn",um=1e3,oS=Array.prototype.slice;function An(){this._listeners={},this.on("diagram.destroy",1,this._destroy,this)}An.prototype.on=function(e,t,n,i){if(e=xe(e)?e:[e],qt(t)&&(i=n,n=t,t=um),!Ce(t))throw new Error("priority must be a number");var r=n;i&&(r=bn(n,i),r[Ms]=n[Ms]||n);var o=this;e.forEach(function(a){o._addListener(a,{priority:t,callback:r,next:null})})},An.prototype.once=function(e,t,n,i){var r=this;if(qt(t)&&(i=n,n=t,t=um),!Ce(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[Ms]=n,this.on(e,t,o)},An.prototype.off=function(e,t){e=xe(e)?e:[e];var n=this;e.forEach(function(i){n._removeListener(i,t)})},An.prototype.createEvent=function(e){var t=new ra;return t.init(e),t},An.prototype.fire=function(e,t){var n,i,r,o;if(o=oS.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 ra?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}},An.prototype.handleError=function(e){return this.fire("error",{error:e})===!1},An.prototype._destroy=function(){this._listeners={}},An.prototype._invokeListeners=function(e,t,n){for(var i;n&&!e.cancelBubble;)i=this._invokeListener(e,t,n),n=n.next;return i},An.prototype._invokeListener=function(e,t,n){var i;if(n.callback.__isTomb)return i;try{i=aS(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},An.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},An.prototype._getListeners=function(e){return this._listeners[e]},An.prototype._setListeners=function(e,t){this._listeners[e]=t},An.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[Ms]===t)&&(r?r.next=i:this._setListeners(e,i)),r=n,n=i};function ra(){}ra.prototype.stopPropagation=function(){this.cancelBubble=!0},ra.prototype.preventDefault=function(){this.defaultPrevented=!0},ra.prototype.init=function(e){j(this,e||{})};function aS(e,t){return e.apply(null,t)}function Ir(e){return e.childNodes[0]}function sS(e){return e.parentNode.childNodes[1]}function ks(e,t,n,i,r){var o=Xo();o.setTranslate(t,n);var a=Xo();a.setRotate(i||0,0,0);var s=Xo();s.setScale(1,1),Zo(e,[o,a,s])}function nn(e,t,n){var i=Xo();i.setTranslate(t,n),Zo(e,i)}function lm(e,t){var n=Xo();n.setRotate(t,0,0),Zo(e,n)}function Bn(e,t){this._eventBus=e,this._elementRegistry=t}Bn.$inject=["eventBus","elementRegistry"],Bn.prototype._getChildrenContainer=function(e){var t=this._elementRegistry.getGraphics(e),n;return e.parent?(n=sS(t),n||(n=ge("g"),Ve(n).add("djs-children"),ke(t.parentNode,n))):n=t,n},Bn.prototype._clear=function(e){var t=Ir(e);return _s(t),t},Bn.prototype._createContainer=function(e,t,n,i){var r=ge("g");Ve(r).add("djs-group"),typeof n<"u"?cS(r,t,t.childNodes[n]):ke(t,r);var o=ge("g");Ve(o).add("djs-element"),Ve(o).add("djs-"+e),i&&Ve(o).add("djs-frame"),ke(r,o);var a=ge("g");return Ve(a).add("djs-visual"),ke(o,a),o},Bn.prototype.create=function(e,t,n){var i=this._getChildrenContainer(t.parent);return this._createContainer(e,i,n,Nh(t))},Bn.prototype.updateContainments=function(e){var t=this,n=this._elementRegistry,i;i=Rn(e,function(r,o){return o.parent&&(r[o.parent.id]=o.parent),r},{}),D(i,function(r){var o=r.children;if(o){var a=t._getChildrenContainer(r),s=a.firstChild;D(o,function(c){var u=n.getGraphics(c).parentNode;u===s?s=s.nextSibling:a.insertBefore(u,s)})}})},Bn.prototype.drawShape=function(e,t,n={}){var i=this._eventBus;return i.fire("render.shape",{gfx:e,element:t,attrs:n})},Bn.prototype.getShapePath=function(e){var t=this._eventBus;return t.fire("render.getShapePath",e)},Bn.prototype.drawConnection=function(e,t,n={}){var i=this._eventBus;return i.fire("render.connection",{gfx:e,element:t,attrs:n})},Bn.prototype.getConnectionPath=function(e){var t=this._eventBus;return t.fire("render.getConnectionPath",e)},Bn.prototype.update=function(e,t,n){if(t.parent){var i=this._clear(n);if(e==="shape")this.drawShape(i,t),nn(n,t.x,t.y);else if(e==="connection")this.drawConnection(i,t);else throw new Error("unknown type: "+e);t.hidden?ce(n,"display","none"):ce(n,"display","block")}},Bn.prototype.remove=function(e){var t=this._elementRegistry.getGraphics(e);zt(t.parentNode)};function cS(e,t,n){var i=n||t.firstChild;e!==i&&t.insertBefore(e,i)}const uS={__depends__:[w1],__init__:["canvas"],canvas:["type",Ee],elementRegistry:["type",Nn],elementFactory:["type",Ii],eventBus:["type",An],graphicsFactory:["type",Bn]};function lS(e){var t=new Lh(e);return t.init(),t}function pS(e){e=e||{};var t={config:["value",e]},n=[t,uS].concat(e.modules||[]);return lS(n)}function rr(e,t){this._injector=t||pS(e),this.get("eventBus").fire("diagram.init")}rr.prototype.get=function(e,t){return this._injector.get(e,t)},rr.prototype.invoke=function(e,t,n){return this._injector.invoke(e,t,n)},rr.prototype.destroy=function(){this.get("eventBus").fire("diagram.destroy")},rr.prototype.clear=function(){this.get("eventBus").fire("diagram.clear")};function pn(e){return e?"<"+e.$type+(e.id?' id="'+e.id:"")+'" />':"<null>"}function xn(e,t){return e.$instanceOf(t)}function fS(e){return lt(e.rootElements,function(t){return xn(t,"bpmn:Process")||xn(t,"bpmn:Collaboration")})}function dS(e){var t={},n=[],i={};function r(V,G){return function(K){V(K,G)}}function o(V){t[V.id]=V}function a(V){return t[V.id]}function s(V,G){var K=V.gfx;if(K)throw new Error(`already rendered ${pn(V)}`);return e.element(V,i[V.id],G)}function c(V,G){return e.root(V,i[V.id],G)}function u(V,G){try{var K=i[V.id]&&s(V,G);return o(V),K}catch(De){l(De.message,{element:V,error:De}),console.error(`failed to import ${pn(V)}`,De)}}function l(V,G){e.error(V,G)}var f=this.registerDi=function(G){var K=G.bpmnElement;K?i[K.id]?l(`multiple DI elements defined for ${pn(K)}`,{element:K}):i[K.id]=G:l(`no bpmnElement referenced in ${pn(G)}`,{element:G})};function p(V){d(V.plane)}function d(V){f(V),D(V.planeElement,h)}function h(V){f(V)}this.handleDefinitions=function(G,K){var De=G.diagrams;if(K&&De.indexOf(K)===-1)throw new Error("diagram not part of <bpmn:Definitions />");if(!K&&De&&De.length&&(K=De[0]),!K)throw new Error("no diagram to display");i={},p(K);var Kt=K.plane;if(!Kt)throw new Error(`no plane for ${pn(K)}`);var A=Kt.bpmnElement;if(!A)if(A=fS(G),A)l(`correcting missing bpmnElement on ${pn(Kt)} to ${pn(A)}`),Kt.bpmnElement=A,f(Kt);else throw new Error("no process or collaboration to display");var _=c(A,Kt);if(xn(A,"bpmn:Process")||xn(A,"bpmn:SubProcess"))g(A,_);else if(xn(A,"bpmn:Collaboration"))fe(A,_),S(G.rootElements,_);else throw new Error(`unsupported bpmnElement for ${pn(Kt)}: ${pn(A)}`);m(n)};var m=this.handleDeferred=function(){for(var G;n.length;)G=n.shift(),G()};function g(V,G){re(V,G),B(V.ioSpecification,G),T(V.artifacts,G),o(V)}function S(V,G){var K=$e(V,function(De){return!a(De)&&xn(De,"bpmn:Process")&&De.laneSets});K.forEach(r(g,G))}function E(V,G){u(V,G)}function x(V,G){D(V,r(E,G))}function w(V,G){u(V,G)}function C(V,G){u(V,G)}function P(V,G){u(V,G)}function L(V,G){u(V,G)}function T(V,G){D(V,function(K){xn(K,"bpmn:Association")?n.push(function(){L(K,G)}):L(K,G)})}function B(V,G){V&&(D(V.dataInputs,r(C,G)),D(V.dataOutputs,r(P,G)))}var k=this.handleSubProcess=function(G,K){re(G,K),T(G.artifacts,K)};function O(V,G){var K=u(V,G);xn(V,"bpmn:SubProcess")&&k(V,K||G),xn(V,"bpmn:Activity")&&B(V.ioSpecification,G),n.push(function(){D(V.dataInputAssociations,r(w,G)),D(V.dataOutputAssociations,r(w,G))})}function $(V,G){u(V,G)}function ne(V,G){u(V,G)}function le(V,G){n.push(function(){var K=u(V,G);V.childLaneSet&&je(V.childLaneSet,K||G),ee(V)})}function je(V,G){D(V.lanes,r(le,G))}function W(V,G){D(V,r(je,G))}function re(V,G){pe(V.flowElements,G),V.laneSets&&W(V.laneSets,G)}function pe(V,G){D(V,function(K){xn(K,"bpmn:SequenceFlow")?n.push(function(){$(K,G)}):xn(K,"bpmn:BoundaryEvent")?n.unshift(function(){O(K,G)}):xn(K,"bpmn:FlowNode")?O(K,G):xn(K,"bpmn:DataObject")||(xn(K,"bpmn:DataStoreReference")||xn(K,"bpmn:DataObjectReference")?ne(K,G):l(`unrecognized flowElement ${pn(K)} in context ${pn(G&&G.businessObject)}`,{element:K,context:G}))})}function oe(V,G){var K=u(V,G),De=V.processRef;De&&g(De,K||G)}function fe(V,G){D(V.participants,r(oe,G)),n.push(function(){x(V.messageFlows,G)}),T(V.artifacts,G)}function ee(V){D(V.flowNodeRef,function(G){var K=G.get("lanes");K&&K.push(V)})}}function v(e,t){var n=J(e);return n&&typeof n.$instanceOf=="function"&&n.$instanceOf(t)}function Be(e,t){return Yi(t,function(n){return v(e,n)})}function J(e){return e&&e.businessObject||e}function Ye(e){return e&&e.di}function hS(e,t,n){var i,r,o,a,s=[];function c(u,l){var f={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})}},p=new dS(f);l=l||u.diagrams&&u.diagrams[0];var d=mS(u,l);if(!d)throw new Error("no diagram to display");D(d,function(m){p.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(f){return f.warnings=s,l(f)}})}function mS(e,t){if(!(!t||!t.plane)){var n=t.plane.bpmnElement,i=n;!v(n,"bpmn:Process")&&!v(n,"bpmn:Collaboration")&&(i=gS(n));var r;v(i,"bpmn:Collaboration")?r=i:r=lt(e.rootElements,function(u){if(v(u,"bpmn:Collaboration"))return lt(u.participants,function(l){return l.processRef===i})});var o=[i];r&&(o=cn(r.participants,function(u){return u.processRef}),o.push(r));var a=pm(o),s=[t],c=[n];return D(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 pm(e){var t=[];return D(e,function(n){n&&(t.push(n),t=t.concat(pm(n.flowElements)))}),t}function gS(e){for(var t=e;t;){if(v(t,"bpmn:Process"))return t;t=t.$parent}}var yS='<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>',fm=yS,dm={verticalAlign:"middle"},hm={color:"#404040"},vS={zIndex:"1001",position:"fixed",top:"0",left:"0",right:"0",bottom:"0"},_S={width:"100%",height:"100%",background:"rgba(40,40,40,0.2)"},bS={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"},xS='<div class="bjs-powered-by-lightbox"><div class="backdrop"></div><div class="notice"><a href="https://bpmn.io" target="_blank" rel="noopener" class="link">'+fm+'</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>',mi;function wS(){mi=dt(xS),mn(mi,vS),mn(rt("svg",mi),dm),mn(rt(".backdrop",mi),_S),mn(rt(".notice",mi),bS),mn(rt(".link",mi),hm,{margin:"15px 20px 15px 10px",alignSelf:"center"})}function ES(){mi||(wS(),Pn.bind(mi,".backdrop","click",function(e){document.body.removeChild(mi)})),document.body.appendChild(mi)}const Os=5,mm="djs-outline-hidden";function xt(e){e=j({},RS,e),this._moddle=this._createModdle(e),this._container=this._createContainer(e),this._init(this._container,this._moddle,e),PS(this._container)}se(xt,rr),xt.prototype.importXML=async function(t,n){const i=this;function r(a){return i.get("eventBus").createEvent(a)}let o=[];try{t=this._emit("import.parse.start",{xml:t})||t;let a;try{a=await this._moddle.fromXML(t,"bpmn:Definitions")}catch(p){throw this._emit("import.parse.complete",{error:p}),p}let s=a.rootElement;const c=a.references,u=a.warnings,l=a.elementsById;o=o.concat(u),s=this._emit("import.parse.complete",r({error:null,definitions:s,elementsById:l,references:c,warnings:o}))||s;const f=await this.importDefinitions(s,n);return o=o.concat(f.warnings),this._emit("import.done",{error:null,warnings:o}),{warnings:o}}catch(a){let s=a;throw o=o.concat(s.warnings||[]),Ds(s,o),s=SS(s),this._emit("import.done",{error:s,warnings:s.warnings}),s}},xt.prototype.importDefinitions=async function(t,n){return this._setDefinitions(t),{warnings:(await this.open(n)).warnings}},xt.prototype.open=async function(t){const n=this._definitions;let i=t;if(!n){const o=new Error("no XML imported");throw Ds(o,[]),o}if(typeof t=="string"&&(i=CS(n,t),!i)){const o=new Error("BPMNDiagram <"+t+"> not found");throw Ds(o,[]),o}try{this.clear()}catch(o){throw Ds(o,[]),o}const{warnings:r}=await hS(this,n,i);return{warnings:r}},xt.prototype.saveXML=async function(t){t=t||{};let n=this._definitions,i,r;try{if(!n)throw new Error("no definitions loaded");n=this._emit("saveXML.start",{definitions:n})||n,r=(await this._moddle.toXML(n,t)).xml,r=this._emit("saveXML.serialized",{xml:r})||r}catch(a){i=a}const o=i?{error:i}:{xml:r};if(this._emit("saveXML.done",o),i)throw i;return o},xt.prototype.saveSVG=async function(){this._emit("saveSVG.start");let t,n;try{const i=this.get("canvas"),r=i.getActiveLayer(),o=rt(":scope > defs",i._svg),a=Dh(r),s=o?"<defs>"+Dh(o)+"</defs>":"",c=i.getContainer();vt(c).add(mm);let u;try{u=r.getBBox()}finally{vt(c).remove(mm)}const l=u.x-Os,f=u.y-Os,p=u.width+Os*2,d=u.height+Os*2;t=`<?xml version="1.0" encoding="utf-8"?>
|
|
8
8
|
<!-- created with bpmn-js / http://bpmn.io -->
|
|
9
9
|
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
|
|
10
|
-
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="`+p+'" height="'+d+'" viewBox="'+l+" "+f+" "+p+" "+d+'" version="1.1">'+s+a+"</svg>"}catch(i){n=i}if(this._emit("saveSVG.done",{error:n,svg:t}),n)throw n;return{svg:t}},wt.prototype._setDefinitions=function(e){this._definitions=e},wt.prototype.getModules=function(){return this._modules},wt.prototype.clear=function(){this.getDefinitions()&&rr.prototype.clear.call(this)},wt.prototype.destroy=function(){rr.prototype.destroy.call(this),fi(this._container)},wt.prototype.on=function(e,t,n,i){return this.get("eventBus").on(e,t,n,i)},wt.prototype.off=function(e,t){this.get("eventBus").off(e,t)},wt.prototype.attachTo=function(e){if(!e)throw new Error("parentNode required");this.detach(),e.get&&e.constructor.prototype.jquery&&(e=e.get(0)),typeof e=="string"&&(e=st(e)),e.appendChild(this._container),this._emit("attach",{}),this.get("canvas").resized()},wt.prototype.getDefinitions=function(){return this._definitions},wt.prototype.detach=function(){const e=this._container,t=e.parentNode;t&&(this._emit("detach",{}),t.removeChild(e))},wt.prototype._init=function(e,t,n){const i=n.modules||this.getModules(n),r=n.additionalModules||[],o=[{bpmnjs:["value",this],moddle:["value",t]}],a=[].concat(o,i,r),s=N(si(n,["additionalModules"]),{canvas:N({},n.canvas,{container:e}),modules:a});rr.call(this,s),n&&n.container&&this.attachTo(n.container)},wt.prototype._emit=function(e,t){return this.get("eventBus").fire(e,t)},wt.prototype._createContainer=function(e){const t=mt('<div class="bjs-container"></div>');return mn(t,{width:dm(e.width),height:dm(e.height),position:e.position}),t},wt.prototype._createModdle=function(e){const t=N({},this._moddleExtensions,e.moddleExtensions);return new vd(t)},wt.prototype._modules=[];function Os(e,t){return e.warnings=t,e}function bS(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 xS={width:"100%",height:"100%",position:"relative"};function dm(e){return e+(ke(e)?"px":"")}function wS(e,t){return t&&ft(e.diagrams,function(n){return n.id===t})||null}function ES(e){const n='<a href="http://bpmn.io" target="_blank" class="bjs-powered-by" title="Powered by bpmn.io" >'+um+"</a>",i=mt(n);mn(st("svg",i),lm),mn(i,pm,{position:"absolute",bottom:"15px",right:"15px",zIndex:"100"}),e.appendChild(i),Oe.bind(i,"click",function(r){_S(),r.preventDefault()})}function mo(e){wt.call(this,e),this.on("import.parse.complete",function(t){t.error||this._collectIds(t.definitions,t.elementsById)},this),this.on("diagram.destroy",function(){this.get("moddle").ids.clear()},this)}se(mo,wt),mo.prototype._createModdle=function(e){var t=wt.prototype._createModdle.call(this,e);return t.ids=new pi([32,36,1]),t},mo.prototype._collectIds=function(e,t){var n=e.$model,i=n.ids,r;i.clear();for(r in t)i.claim(r,t[r])};function Ve(e,t){return v(e,"bpmn:CallActivity")?!1:v(e,"bpmn:SubProcess")?(t=t||Qe(e),t&&v(t,"bpmndi:BPMNPlane")?!0:t&&!!t.isExpanded):v(e,"bpmn:Participant")?!!ee(e).processRef:!0}function Yt(e){if(!(!v(e,"bpmn:Participant")&&!v(e,"bpmn:Lane"))){var t=Qe(e).isHorizontal;return t===void 0?!0:t}}function SS(e){return e&&ee(e).isInterrupting!==!1}function fn(e){return e&&!!ee(e).triggeredByEvent}function go(e,t){var n=ee(e).eventDefinitions;return Ui(n,function(i){return v(i,t)})}function RS(e){return go(e,"bpmn:ErrorEventDefinition")}function CS(e){return go(e,"bpmn:EscalationEventDefinition")}function PS(e){return go(e,"bpmn:CompensateEventDefinition")}var Nr={width:90,height:20},hm=15;function or(e){return v(e,"bpmn:Event")||v(e,"bpmn:Gateway")||v(e,"bpmn:DataStoreReference")||v(e,"bpmn:DataObjectReference")||v(e,"bpmn:DataInput")||v(e,"bpmn:DataOutput")||v(e,"bpmn:SequenceFlow")||v(e,"bpmn:MessageFlow")||v(e,"bpmn:Group")}function Ds(e){return $e(e.label)}function AS(e){var t=e.length/2-1,n=e[Math.floor(t)],i=e[Math.ceil(t+.01)],r=TS(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-=hm:a+=hm,{x:a,y:s}}function TS(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 gl(e){return e.waypoints?AS(e.waypoints):v(e,"bpmn:Group")?{x:e.x+e.width/2,y:e.y+Nr.height/2}:{x:e.x+e.width/2,y:e.y+e.height+Nr.height/2}}function MS(e,t){var n,i,r,o=e.label;return o&&o.bounds?(r=o.bounds,i={width:Math.max(Nr.width,r.width),height:r.height},n={x:r.x+r.width/2,y:r.y+r.height/2}):(n=gl(t),i=Nr),N({x:n.x-i.width/2,y:n.y-i.height/2},i)}function mm(e){if(v(e,"bpmn:FlowElement")||v(e,"bpmn:Participant")||v(e,"bpmn:Lane")||v(e,"bpmn:SequenceFlow")||v(e,"bpmn:MessageFlow")||v(e,"bpmn:DataInput")||v(e,"bpmn:DataOutput"))return"name";if(v(e,"bpmn:TextAnnotation"))return"text";if(v(e,"bpmn:Group"))return"categoryValueRef"}function kS(e){var t=e.categoryValueRef;return t&&t.value||""}function $n(e){var t=e.businessObject,n=mm(t);if(n)return n==="categoryValueRef"?kS(t):t[n]||""}function OS(e,t){var n=e.businessObject,i=mm(n);if(i)if(i==="categoryValueRef"){if(!n[i])return e;n[i].value=t}else n[i]=t;return e}function DS(e){return $e(e)&&or(e.labelTarget)}var yo=7;function gm(e){let t=[];return k(e.incoming,n=>{v(n,"bpmn:Association")&&v(n.source,"bpmn:TextAnnotation")&&t.push({annotation:n.source,association:n})}),k(e.outgoing,n=>{v(n,"bpmn:Association")&&v(n.target,"bpmn:TextAnnotation")&&t.push({annotation:n.target,association:n})}),t}function oa(e){const t=new Map;return k(ul(e),n=>{k(gm(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 yl="hsl(225, 10%, 15%)",LS="white";function gi(e,t){return Ui(e.eventDefinitions,function(n){return n.$type===t})}function IS(e){return e.$type==="bpmn:IntermediateThrowEvent"||e.$type==="bpmn:EndEvent"}function NS(e){var t=e.dataObjectRef;return e.isCollection||t&&t.isCollection}function ze(e,t,n){var i=Qe(e);return n||i.get("color:background-color")||i.get("bioc:fill")||t||LS}function oe(e,t,n){var i=Qe(e);return n||i.get("color:border-color")||i.get("bioc:stroke")||t||yl}function aa(e,t,n,i){var r=Qe(e),o=r.get("label");return i||o&&o.get("color:color")||t||oe(e,n)}function ym(e){var t=e.x+e.width/2,n=e.y+e.height/2,i=e.width/2,r=[["M",t,n],["m",0,-i],["a",i,i,0,1,1,0,2*i],["a",i,i,0,1,1,0,-2*i],["z"]];return Dr(r)}function vl(e,t){var n=e.x,i=e.y,r=e.width,o=e.height,a=[["M",n+t,i],["l",r-t*2,0],["a",t,t,0,0,1,t,t],["l",0,o-t*2],["a",t,t,0,0,1,-t,t],["l",t*2-r,0],["a",t,t,0,0,1,-t,-t],["l",0,t*2-o],["a",t,t,0,0,1,t,-t],["z"]];return Dr(a)}function BS(e){var t=e.width,n=e.height,i=e.x,r=e.y,o=t/2,a=n/2,s=[["M",i+o,r],["l",o,a],["l",-o,a],["l",-o,-a],["z"]];return Dr(s)}function $S(e){var t=e.x,n=e.y,i=e.width,r=e.height,o=[["M",t,n],["l",i,0],["l",0,r],["l",-i,0],["z"]];return Dr(o)}function sa(e,t={}){return{width:Gn(e,t),height:Tn(e,t)}}function Gn(e,t={}){return Sn(t,"width")?t.width:e.width}function Tn(e,t={}){return Sn(t,"height")?t.height:e.height}var jS=new pi,FS=10,Ls=3,HS=1.5,Is=10,zS=4,vo=.95,GS=1,VS=.25;function Br(e,t,n,i,r,o,a){Mi.call(this,t,a);var s=e&&e.defaultFillColor,c=e&&e.defaultStrokeColor,u=e&&e.defaultLabelColor;function l(P){return n.computeStyle(P,{strokeLinecap:"round",strokeLinejoin:"round",stroke:yl,strokeWidth:2,fill:"white"})}function f(P){return n.computeStyle(P,["no-fill"],{strokeLinecap:"round",strokeLinejoin:"round",stroke:yl,strokeWidth:2})}function p(P,_){var{ref:y={x:0,y:0},scale:D=1,element:j,parentGfx:U=r._svg}=_,ue=ye("marker",{id:P,viewBox:"0 0 20 20",refX:y.x,refY:y.y,markerWidth:20*D,markerHeight:20*D,orient:"auto"});De(ue,j);var Be=st(":scope > defs",U);Be||(Be=ye("defs"),De(U,Be)),De(Be,ue)}function d(P,_,y,D){var j=jS.nextPrefixed("marker-");return h(P,j,_,y,D),"url(#"+j+")"}function h(P,_,y,D,j){if(y==="sequenceflow-end"){var U=ye("path",{d:"M 1 5 L 11 10 L 1 15 Z",...l({fill:j,stroke:j,strokeWidth:1})});p(_,{element:U,ref:{x:11,y:10},scale:.5,parentGfx:P})}if(y==="messageflow-start"){var ue=ye("circle",{cx:6,cy:6,r:3.5,...l({fill:D,stroke:j,strokeWidth:1,strokeDasharray:[1e4,1]})});p(_,{element:ue,ref:{x:6,y:6},parentGfx:P})}if(y==="messageflow-end"){var Be=ye("path",{d:"m 1 5 l 0 -3 l 7 3 l -7 3 z",...l({fill:D,stroke:j,strokeWidth:1,strokeDasharray:[1e4,1]})});p(_,{element:Be,ref:{x:8.5,y:5},parentGfx:P})}if(y==="association-start"){var et=ye("path",{d:"M 11 5 L 1 10 L 11 15",...f({fill:"none",stroke:j,strokeWidth:1.5,strokeDasharray:[1e4,1]})});p(_,{element:et,ref:{x:1,y:10},scale:.5,parentGfx:P})}if(y==="association-end"){var At=ye("path",{d:"M 1 5 L 11 10 L 1 15",...f({fill:"none",stroke:j,strokeWidth:1.5,strokeDasharray:[1e4,1]})});p(_,{element:At,ref:{x:11,y:10},scale:.5,parentGfx:P})}if(y==="conditional-flow-marker"){var it=ye("path",{d:"M 0 10 L 8 6 L 16 10 L 8 14 Z",...l({fill:D,stroke:j})});p(_,{element:it,ref:{x:-1,y:10},scale:.5,parentGfx:P})}if(y==="conditional-default-flow-marker"){var Wt=ye("path",{d:"M 6 4 L 10 16",...l({stroke:j,fill:"none"})});p(_,{element:Wt,ref:{x:0,y:10},scale:.5,parentGfx:P})}}function m(P,_,y,D,j={}){Ut(D)&&(j=D,D=0),D=D||0,j=l(j);var U=_/2,ue=y/2,Be=ye("circle",{cx:U,cy:ue,r:Math.round((_+y)/4-D),...j});return De(P,Be),Be}function g(P,_,y,D,j,U){Ut(j)&&(U=j,j=0),j=j||0,U=l(U);var ue=ye("rect",{x:j,y:j,width:_-j*2,height:y-j*2,rx:D,ry:D,...U});return De(P,ue),ue}function S(P,_,y,D){var j=_/2,U=y/2,ue=[{x:j,y:0},{x:_,y:U},{x:j,y},{x:0,y:U}],Be=ue.map(function(At){return At.x+","+At.y}).join(" ");D=l(D);var et=ye("polygon",{...D,points:Be});return De(P,et),et}function E(P,_,y,D){y=f(y);var j=Qo(_,y,D);return De(P,j),j}function x(P,_,y){return E(P,_,y,5)}function w(P,_,y){y=f(y);var D=ye("path",{...y,d:_});return De(P,D),D}function C(P,_,y,D){return w(_,y,N({"data-marker":P},D))}function T(P){return Kt[P]}function B(P){return function(_,y,D){return T(P)(_,y,D)}}var M={"bpmn:MessageEventDefinition":function(P,_,y={},D){var j=i.getScaledPath("EVENT_MESSAGE",{xScaleFactor:.9,yScaleFactor:.9,containerWidth:y.width||_.width,containerHeight:y.height||_.height,position:{mx:.235,my:.315}}),U=D?oe(_,c,y.stroke):ze(_,s,y.fill),ue=D?ze(_,s,y.fill):oe(_,c,y.stroke),Be=w(P,j,{fill:U,stroke:ue,strokeWidth:1});return Be},"bpmn:TimerEventDefinition":function(P,_,y={}){var D=y.width||_.width,j=y.height||_.height,U=y.width?1:2,ue=m(P,D,j,.2*j,{fill:ze(_,s,y.fill),stroke:oe(_,c,y.stroke),strokeWidth:U}),Be=i.getScaledPath("EVENT_TIMER_WH",{xScaleFactor:.75,yScaleFactor:.75,containerWidth:D,containerHeight:j,position:{mx:.5,my:.5}});w(P,Be,{stroke:oe(_,c,y.stroke),strokeWidth:U});for(var et=0;et<12;et++){var At=i.getScaledPath("EVENT_TIMER_LINE",{xScaleFactor:.75,yScaleFactor:.75,containerWidth:D,containerHeight:j,position:{mx:.5,my:.5}}),it=D/2,Wt=j/2;w(P,At,{strokeWidth:1,stroke:oe(_,c,y.stroke),transform:"rotate("+et*30+","+Wt+","+it+")"})}return ue},"bpmn:EscalationEventDefinition":function(P,_,y={},D){var j=i.getScaledPath("EVENT_ESCALATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:y.width||_.width,containerHeight:y.height||_.height,position:{mx:.5,my:.2}}),U=D?oe(_,c,y.stroke):ze(_,s,y.fill);return w(P,j,{fill:U,stroke:oe(_,c,y.stroke),strokeWidth:1})},"bpmn:ConditionalEventDefinition":function(P,_,y={}){var D=i.getScaledPath("EVENT_CONDITIONAL",{xScaleFactor:1,yScaleFactor:1,containerWidth:y.width||_.width,containerHeight:y.height||_.height,position:{mx:.5,my:.222}});return w(P,D,{fill:ze(_,s,y.fill),stroke:oe(_,c,y.stroke),strokeWidth:1})},"bpmn:LinkEventDefinition":function(P,_,y={},D){var j=i.getScaledPath("EVENT_LINK",{xScaleFactor:1,yScaleFactor:1,containerWidth:_.width,containerHeight:_.height,position:{mx:.57,my:.263}}),U=D?oe(_,c,y.stroke):ze(_,s,y.fill);return w(P,j,{fill:U,stroke:oe(_,c,y.stroke),strokeWidth:1})},"bpmn:ErrorEventDefinition":function(P,_,y={},D){var j=i.getScaledPath("EVENT_ERROR",{xScaleFactor:1.1,yScaleFactor:1.1,containerWidth:y.width||_.width,containerHeight:y.height||_.height,position:{mx:.2,my:.722}}),U=D?oe(_,c,y.stroke):ze(_,s,y.fill);return w(P,j,{fill:U,stroke:oe(_,c,y.stroke),strokeWidth:1})},"bpmn:CancelEventDefinition":function(P,_,y={},D){var j=i.getScaledPath("EVENT_CANCEL_45",{xScaleFactor:1,yScaleFactor:1,containerWidth:_.width,containerHeight:_.height,position:{mx:.638,my:-.055}}),U=D?oe(_,c,y.stroke):"none",ue=w(P,j,{fill:U,stroke:oe(_,c,y.stroke),strokeWidth:1});return sm(ue,45),ue},"bpmn:CompensateEventDefinition":function(P,_,y={},D){var j=i.getScaledPath("EVENT_COMPENSATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:y.width||_.width,containerHeight:y.height||_.height,position:{mx:.22,my:.5}}),U=D?oe(_,c,y.stroke):ze(_,s,y.fill);return w(P,j,{fill:U,stroke:oe(_,c,y.stroke),strokeWidth:1})},"bpmn:SignalEventDefinition":function(P,_,y={},D){var j=i.getScaledPath("EVENT_SIGNAL",{xScaleFactor:.9,yScaleFactor:.9,containerWidth:y.width||_.width,containerHeight:y.height||_.height,position:{mx:.5,my:.2}}),U=D?oe(_,c,y.stroke):ze(_,s,y.fill);return w(P,j,{strokeWidth:1,fill:U,stroke:oe(_,c,y.stroke)})},"bpmn:MultipleEventDefinition":function(P,_,y={},D){var j=i.getScaledPath("EVENT_MULTIPLE",{xScaleFactor:1.1,yScaleFactor:1.1,containerWidth:y.width||_.width,containerHeight:y.height||_.height,position:{mx:.211,my:.36}}),U=D?oe(_,c,y.stroke):ze(_,s,y.fill);return w(P,j,{fill:U,stroke:oe(_,c,y.stroke),strokeWidth:1})},"bpmn:ParallelMultipleEventDefinition":function(P,_,y={}){var D=i.getScaledPath("EVENT_PARALLEL_MULTIPLE",{xScaleFactor:1.2,yScaleFactor:1.2,containerWidth:y.width||_.width,containerHeight:y.height||_.height,position:{mx:.458,my:.194}});return w(P,D,{fill:ze(_,s,y.fill),stroke:oe(_,c,y.stroke),strokeWidth:1})},"bpmn:TerminateEventDefinition":function(P,_,y={}){var D=m(P,_.width,_.height,8,{fill:oe(_,c,y.stroke),stroke:oe(_,c,y.stroke),strokeWidth:4});return D}};function z(P,_,y={},D){var j=ee(P),U=IS(j),ue=D||P;return j.get("eventDefinitions")&&j.get("eventDefinitions").length>1?j.get("parallelMultiple")?M["bpmn:ParallelMultipleEventDefinition"](_,ue,y,U):M["bpmn:MultipleEventDefinition"](_,ue,y,U):gi(j,"bpmn:MessageEventDefinition")?M["bpmn:MessageEventDefinition"](_,ue,y,U):gi(j,"bpmn:TimerEventDefinition")?M["bpmn:TimerEventDefinition"](_,ue,y,U):gi(j,"bpmn:ConditionalEventDefinition")?M["bpmn:ConditionalEventDefinition"](_,ue,y,U):gi(j,"bpmn:SignalEventDefinition")?M["bpmn:SignalEventDefinition"](_,ue,y,U):gi(j,"bpmn:EscalationEventDefinition")?M["bpmn:EscalationEventDefinition"](_,ue,y,U):gi(j,"bpmn:LinkEventDefinition")?M["bpmn:LinkEventDefinition"](_,ue,y,U):gi(j,"bpmn:ErrorEventDefinition")?M["bpmn:ErrorEventDefinition"](_,ue,y,U):gi(j,"bpmn:CancelEventDefinition")?M["bpmn:CancelEventDefinition"](_,ue,y,U):gi(j,"bpmn:CompensateEventDefinition")?M["bpmn:CompensateEventDefinition"](_,ue,y,U):gi(j,"bpmn:TerminateEventDefinition")?M["bpmn:TerminateEventDefinition"](_,ue,y,U):null}var G={ParticipantMultiplicityMarker:function(P,_,y={}){var D=Gn(_,y),j=Tn(_,y),U=i.getScaledPath("MARKER_PARALLEL",{xScaleFactor:1,yScaleFactor:1,containerWidth:D,containerHeight:j,position:{mx:(D/2-6)/D,my:(j-15)/j}});C("participant-multiplicity",P,U,{strokeWidth:2,fill:ze(_,s,y.fill),stroke:oe(_,c,y.stroke)})},SubProcessMarker:function(P,_,y={}){var D=g(P,14,14,0,{strokeWidth:1,fill:ze(_,s,y.fill),stroke:oe(_,c,y.stroke)});tn(D,_.width/2-7.5,_.height-20);var j=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}});C("sub-process",P,j,{fill:ze(_,s,y.fill),stroke:oe(_,c,y.stroke)})},ParallelMarker:function(P,_,y){var D=Gn(_,y),j=Tn(_,y),U=i.getScaledPath("MARKER_PARALLEL",{xScaleFactor:1,yScaleFactor:1,containerWidth:D,containerHeight:j,position:{mx:(D/2+y.parallel)/D,my:(j-20)/j}});C("parallel",P,U,{fill:ze(_,s,y.fill),stroke:oe(_,c,y.stroke)})},SequentialMarker:function(P,_,y){var D=i.getScaledPath("MARKER_SEQUENTIAL",{xScaleFactor:1,yScaleFactor:1,containerWidth:_.width,containerHeight:_.height,position:{mx:(_.width/2+y.seq)/_.width,my:(_.height-19)/_.height}});C("sequential",P,D,{fill:ze(_,s,y.fill),stroke:oe(_,c,y.stroke)})},CompensationMarker:function(P,_,y){var D=i.getScaledPath("MARKER_COMPENSATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:_.width,containerHeight:_.height,position:{mx:(_.width/2+y.compensation)/_.width,my:(_.height-13)/_.height}});C("compensation",P,D,{strokeWidth:1,fill:ze(_,s,y.fill),stroke:oe(_,c,y.stroke)})},LoopMarker:function(P,_,y){var D=Gn(_,y),j=Tn(_,y),U=i.getScaledPath("MARKER_LOOP",{xScaleFactor:1,yScaleFactor:1,containerWidth:D,containerHeight:j,position:{mx:(D/2+y.loop)/D,my:(j-7)/j}});C("loop",P,U,{strokeWidth:1.5,fill:"none",stroke:oe(_,c,y.stroke),strokeMiterlimit:.5})},AdhocMarker:function(P,_,y){var D=Gn(_,y),j=Tn(_,y),U=i.getScaledPath("MARKER_ADHOC",{xScaleFactor:1,yScaleFactor:1,containerWidth:D,containerHeight:j,position:{mx:(D/2+y.adhoc)/D,my:(j-15)/j}});C("adhoc",P,U,{strokeWidth:1,fill:oe(_,c,y.stroke),stroke:oe(_,c,y.stroke)})}};function $(P,_,y,D){G[P](_,y,D)}function V(P,_,y=[],D={}){D={fill:D.fill,stroke:D.stroke,width:Gn(_,D),height:Tn(_,D)};var j=ee(_),U=y.includes("SubProcessMarker");U?D={...D,seq:-21,parallel:-22,compensation:-25,loop:-18,adhoc:10}:D={...D,seq:-5,parallel:-6,compensation:-7,loop:0,adhoc:-8},j.get("isForCompensation")&&y.push("CompensationMarker"),v(j,"bpmn:AdHocSubProcess")&&(y.push("AdhocMarker"),U||N(D,{compensation:D.compensation-18}));var ue=j.get("loopCharacteristics"),Be=ue&&ue.get("isSequential");ue&&(N(D,{compensation:D.compensation-18}),y.includes("AdhocMarker")&&N(D,{seq:-23,loop:-18,parallel:-24}),Be===void 0&&y.push("LoopMarker"),Be===!1&&y.push("ParallelMarker"),Be===!0&&y.push("SequentialMarker")),y.includes("CompensationMarker")&&y.length===1&&N(D,{compensation:-8}),k(y,function(et){$(et,P,_,D)})}function he(P,_,y={}){y=N({size:{width:100}},y);var D=o.createText(_||"",y);return We(D).add("djs-label"),De(P,D),D}function nt(P,_,y,D={}){var j=ee(_),U=sa({x:_.x,y:_.y,width:_.width,height:_.height},D);return he(P,j.name,{align:y,box:U,padding:7,style:{fill:aa(_,u,c,D.stroke)}})}function gt(P,_,y={}){var D={width:_.width,height:_.height,x:_.width/2+_.x,y:_.height/2+_.y};return he(P,$n(_),{box:D,style:N({},o.getExternalStyle(),{fill:aa(_,u,c,y.stroke)})})}function J(P,_,y,D={}){var j=Yt(y),U=he(P,_,{box:{height:30,width:j?Tn(y,D):Gn(y,D)},align:"center-middle",style:{fill:aa(y,u,c,D.stroke)}});if(j){var ue=-1*Tn(y,D);Ms(U,0,-ue,270)}}function le(P,_,y={}){var{width:D,height:j}=sa(_,y);return g(P,D,j,Is,{...y,fill:ze(_,s,y.fill),fillOpacity:vo,stroke:oe(_,c,y.stroke)})}function Ee(P,_,y={}){var D=ee(_),j=ze(_,s,y.fill),U=oe(_,c,y.stroke);return(D.get("associationDirection")==="One"||D.get("associationDirection")==="Both")&&(y.markerEnd=d(P,"association-end",j,U)),D.get("associationDirection")==="Both"&&(y.markerStart=d(P,"association-start",j,U)),y=Je(y,["markerStart","markerEnd"]),x(P,_.waypoints,{...y,stroke:U,strokeDasharray:"0, 5"})}function pe(P,_,y={}){var D=ze(_,s,y.fill),j=oe(_,c,y.stroke),U=i.getScaledPath("DATA_OBJECT_PATH",{xScaleFactor:1,yScaleFactor:1,containerWidth:_.width,containerHeight:_.height,position:{mx:.474,my:.296}}),ue=w(P,U,{fill:D,fillOpacity:vo,stroke:j}),Be=ee(_);if(NS(Be)){var et=i.getScaledPath("DATA_OBJECT_COLLECTION_PATH",{xScaleFactor:1,yScaleFactor:1,containerWidth:_.width,containerHeight:_.height,position:{mx:.33,my:(_.height-18)/_.height}});w(P,et,{strokeWidth:2,fill:D,stroke:j})}return ue}function ge(P,_,y={}){return m(P,_.width,_.height,{fillOpacity:vo,...y,fill:ze(_,s,y.fill),stroke:oe(_,c,y.stroke)})}function re(P,_,y={}){return S(P,_.width,_.height,{fill:ze(_,s,y.fill),fillOpacity:vo,stroke:oe(_,c,y.stroke)})}function H(P,_,y={}){var D=g(P,Gn(_,y),Tn(_,y),0,{fill:ze(_,s,y.fill),fillOpacity:y.fillOpacity||vo,stroke:oe(_,c,y.stroke),strokeWidth:1.5}),j=ee(_);if(v(j,"bpmn:Lane")){var U=j.get("name");J(P,U,_,y)}return D}function F(P,_,y={}){var D=le(P,_,y),j=Ve(_);if(fn(_)&&(ce(D,{strokeDasharray:"0, 5.5",strokeWidth:2.5}),!j)){var U=ee(_).flowElements||[],ue=U.filter(Be=>v(Be,"bpmn:StartEvent"));ue.length===1&&Y(ue[0],P,y,_)}return nt(P,_,j?"center-top":"center-middle",y),j?V(P,_,void 0,y):V(P,_,["SubProcessMarker"],y),D}function Y(P,_,y,D){var j=22,U={fill:ze(D,s,y.fill),stroke:oe(D,c,y.stroke),width:j,height:j},ue=ee(P).isInterrupting,Be=ue?0:3,et=ue?1:1.2,At=20,it=(j-At)/2,Wt="translate("+it+","+it+")";m(_,At,At,{fill:U.fill,stroke:U.stroke,strokeWidth:et,strokeDasharray:Be,transform:Wt}),z(P,_,U,D)}function Ne(P,_,y={}){var D=le(P,_,y);return nt(P,_,"center-middle",y),V(P,_,void 0,y),D}var Kt=this.handlers={"bpmn:AdHocSubProcess":function(P,_,y={}){return Ve(_)?y=Je(y,["fill","stroke","width","height"]):y=Je(y,["fill","stroke"]),F(P,_,y)},"bpmn:Association":function(P,_,y={}){return y=Je(y,["fill","stroke"]),Ee(P,_,y)},"bpmn:BoundaryEvent":function(P,_,y={}){var{renderIcon:D=!0}=y;y=Je(y,["fill","stroke"]);var j=ee(_),U=j.get("cancelActivity");y={strokeWidth:1.5,fill:ze(_,s,y.fill),fillOpacity:GS,stroke:oe(_,c,y.stroke)},U||(y.strokeDasharray="6");var ue=ge(P,_,y);return m(P,_.width,_.height,Ls,{...y,fill:"none"}),D&&z(_,P,y),ue},"bpmn:BusinessRuleTask":function(P,_,y={}){y=Je(y,["fill","stroke"]);var D=Ne(P,_,y),j=i.getScaledPath("TASK_TYPE_BUSINESS_RULE_MAIN",{abspos:{x:8,y:8}}),U=w(P,j);ce(U,{fill:ze(_,s,y.fill),stroke:oe(_,c,y.stroke),strokeWidth:1});var ue=i.getScaledPath("TASK_TYPE_BUSINESS_RULE_HEADER",{abspos:{x:8,y:8}}),Be=w(P,ue);return ce(Be,{fill:oe(_,c,y.stroke),stroke:oe(_,c,y.stroke),strokeWidth:1}),D},"bpmn:CallActivity":function(P,_,y={}){return y=Je(y,["fill","stroke"]),F(P,_,{strokeWidth:5,...y})},"bpmn:ComplexGateway":function(P,_,y={}){y=Je(y,["fill","stroke"]);var D=re(P,_,y),j=i.getScaledPath("GATEWAY_COMPLEX",{xScaleFactor:.5,yScaleFactor:.5,containerWidth:_.width,containerHeight:_.height,position:{mx:.46,my:.26}});return w(P,j,{fill:oe(_,c,y.stroke),stroke:oe(_,c,y.stroke),strokeWidth:1}),D},"bpmn:DataInput":function(P,_,y={}){y=Je(y,["fill","stroke"]);var D=i.getRawPath("DATA_ARROW"),j=pe(P,_,y);return w(P,D,{fill:"none",stroke:oe(_,c,y.stroke),strokeWidth:1}),j},"bpmn:DataInputAssociation":function(P,_,y={}){return y=Je(y,["fill","stroke"]),Ee(P,_,{...y,markerEnd:d(P,"association-end",ze(_,s,y.fill),oe(_,c,y.stroke))})},"bpmn:DataObject":function(P,_,y={}){return y=Je(y,["fill","stroke"]),pe(P,_,y)},"bpmn:DataObjectReference":B("bpmn:DataObject"),"bpmn:DataOutput":function(P,_,y={}){y=Je(y,["fill","stroke"]);var D=i.getRawPath("DATA_ARROW"),j=pe(P,_,y);return w(P,D,{strokeWidth:1,fill:oe(_,c,y.stroke),stroke:oe(_,c,y.stroke)}),j},"bpmn:DataOutputAssociation":function(P,_,y={}){return y=Je(y,["fill","stroke"]),Ee(P,_,{...y,markerEnd:d(P,"association-end",ze(_,s,y.fill),oe(_,c,y.stroke))})},"bpmn:DataStoreReference":function(P,_,y={}){y=Je(y,["fill","stroke"]);var D=i.getScaledPath("DATA_STORE",{xScaleFactor:1,yScaleFactor:1,containerWidth:_.width,containerHeight:_.height,position:{mx:0,my:.133}});return w(P,D,{fill:ze(_,s,y.fill),fillOpacity:vo,stroke:oe(_,c,y.stroke),strokeWidth:2})},"bpmn:EndEvent":function(P,_,y={}){var{renderIcon:D=!0}=y;y=Je(y,["fill","stroke"]);var j=ge(P,_,{...y,strokeWidth:4});return D&&z(_,P,y),j},"bpmn:EventBasedGateway":function(P,_,y={}){y=Je(y,["fill","stroke"]);var D=ee(_),j=re(P,_,y);m(P,_.width,_.height,_.height*.2,{fill:ze(_,"none",y.fill),stroke:oe(_,c,y.stroke),strokeWidth:1});var U=D.get("eventGatewayType"),ue=!!D.get("instantiate");function Be(){var At=i.getScaledPath("GATEWAY_EVENT_BASED",{xScaleFactor:.18,yScaleFactor:.18,containerWidth:_.width,containerHeight:_.height,position:{mx:.36,my:.44}});w(P,At,{fill:"none",stroke:oe(_,c,y.stroke),strokeWidth:2})}if(U==="Parallel"){var et=i.getScaledPath("GATEWAY_PARALLEL",{xScaleFactor:.4,yScaleFactor:.4,containerWidth:_.width,containerHeight:_.height,position:{mx:.474,my:.296}});w(P,et,{fill:"none",stroke:oe(_,c,y.stroke),strokeWidth:1})}else U==="Exclusive"&&(ue||m(P,_.width,_.height,_.height*.26,{fill:"none",stroke:oe(_,c,y.stroke),strokeWidth:1}),Be());return j},"bpmn:ExclusiveGateway":function(P,_,y={}){y=Je(y,["fill","stroke"]);var D=re(P,_,y),j=i.getScaledPath("GATEWAY_EXCLUSIVE",{xScaleFactor:.4,yScaleFactor:.4,containerWidth:_.width,containerHeight:_.height,position:{mx:.32,my:.3}}),U=Qe(_);return U.get("isMarkerVisible")&&w(P,j,{fill:oe(_,c,y.stroke),stroke:oe(_,c,y.stroke),strokeWidth:1}),D},"bpmn:Gateway":function(P,_,y={}){return y=Je(y,["fill","stroke"]),re(P,_,y)},"bpmn:Group":function(P,_,y={}){return y=Je(y,["fill","stroke","width","height"]),g(P,_.width,_.height,Is,{stroke:oe(_,c,y.stroke),strokeWidth:1.5,strokeDasharray:"10, 6, 0, 6",fill:"none",pointerEvents:"none",width:Gn(_,y),height:Tn(_,y)})},"bpmn:InclusiveGateway":function(P,_,y={}){y=Je(y,["fill","stroke"]);var D=re(P,_,y);return m(P,_.width,_.height,_.height*.24,{fill:ze(_,s,y.fill),stroke:oe(_,c,y.stroke),strokeWidth:2.5}),D},"bpmn:IntermediateEvent":function(P,_,y={}){var{renderIcon:D=!0}=y;y=Je(y,["fill","stroke"]);var j=ge(P,_,{...y,strokeWidth:1.5});return m(P,_.width,_.height,Ls,{fill:"none",stroke:oe(_,c,y.stroke),strokeWidth:1.5}),D&&z(_,P,y),j},"bpmn:IntermediateCatchEvent":B("bpmn:IntermediateEvent"),"bpmn:IntermediateThrowEvent":B("bpmn:IntermediateEvent"),"bpmn:Lane":function(P,_,y={}){return y=Je(y,["fill","stroke","width","height"]),H(P,_,{...y,fillOpacity:VS})},"bpmn:ManualTask":function(P,_,y={}){y=Je(y,["fill","stroke"]);var D=Ne(P,_,y),j=i.getScaledPath("TASK_TYPE_MANUAL",{abspos:{x:17,y:15}});return w(P,j,{fill:ze(_,s,y.fill),stroke:oe(_,c,y.stroke),strokeWidth:.5}),D},"bpmn:MessageFlow":function(P,_,y={}){y=Je(y,["fill","stroke"]);var D=ee(_),j=Qe(_),U=ze(_,s,y.fill),ue=oe(_,c,y.stroke),Be=x(P,_.waypoints,{markerEnd:d(P,"messageflow-end",U,ue),markerStart:d(P,"messageflow-start",U,ue),stroke:ue,strokeDasharray:"10, 11",strokeWidth:1.5});if(D.get("messageRef")){var et=Be.getPointAtLength(Be.getTotalLength()/2),At=i.getScaledPath("MESSAGE_FLOW_MARKER",{abspos:{x:et.x,y:et.y}}),it={strokeWidth:1};j.get("messageVisibleKind")==="initiating"?(it.fill=U,it.stroke=ue):(it.fill=ue,it.stroke=U);var Wt=w(P,At,it),on=D.get("messageRef"),yn=on.get("name"),dt=he(P,yn,{align:"center-top",fitBox:!0,style:{fill:ue}}),Mt=Wt.getBBox(),Qt=dt.getBBox(),Kr=et.x-Qt.width/2,ei=et.y+Mt.height/2+FS;Ms(dt,Kr,ei,0)}return Be},"bpmn:ParallelGateway":function(P,_,y={}){y=Je(y,["fill","stroke"]);var D=re(P,_,y),j=i.getScaledPath("GATEWAY_PARALLEL",{xScaleFactor:.6,yScaleFactor:.6,containerWidth:_.width,containerHeight:_.height,position:{mx:.46,my:.2}});return w(P,j,{fill:oe(_,c,y.stroke),stroke:oe(_,c,y.stroke),strokeWidth:1}),D},"bpmn:Participant":function(P,_,y={}){y=Je(y,["fill","stroke","width","height"]);var D=H(P,_,y),j=Ve(_),U=Yt(_),ue=ee(_),Be=ue.get("name");if(j){var et=U?[{x:30,y:0},{x:30,y:Tn(_,y)}]:[{x:0,y:30},{x:Gn(_,y),y:30}];E(P,et,{stroke:oe(_,c,y.stroke),strokeWidth:HS}),J(P,Be,_,y)}else{var At=sa(_,y);U||(At.height=Gn(_,y),At.width=Tn(_,y));var it=he(P,Be,{box:At,align:"center-middle",style:{fill:aa(_,u,c,y.stroke)}});if(!U){var Wt=-1*Tn(_,y);Ms(it,0,-Wt,270)}}return ue.get("participantMultiplicity")&&$("ParticipantMultiplicityMarker",P,_,y),D},"bpmn:ReceiveTask":function(P,_,y={}){y=Je(y,["fill","stroke"]);var D=ee(_),j=Ne(P,_,y),U;return D.get("instantiate")?(m(P,28,28,20*.22,{fill:ze(_,s,y.fill),stroke:oe(_,c,y.stroke),strokeWidth:1}),U=i.getScaledPath("TASK_TYPE_INSTANTIATING_SEND",{abspos:{x:7.77,y:9.52}})):U=i.getScaledPath("TASK_TYPE_SEND",{xScaleFactor:.9,yScaleFactor:.9,containerWidth:21,containerHeight:14,position:{mx:.3,my:.4}}),w(P,U,{fill:ze(_,s,y.fill),stroke:oe(_,c,y.stroke),strokeWidth:1}),j},"bpmn:ScriptTask":function(P,_,y={}){y=Je(y,["fill","stroke"]);var D=Ne(P,_,y),j=i.getScaledPath("TASK_TYPE_SCRIPT",{abspos:{x:15,y:20}});return w(P,j,{fill:ze(_,s,y.fill),stroke:oe(_,c,y.stroke),strokeWidth:1}),D},"bpmn:SendTask":function(P,_,y={}){y=Je(y,["fill","stroke"]);var D=Ne(P,_,y),j=i.getScaledPath("TASK_TYPE_SEND",{xScaleFactor:1,yScaleFactor:1,containerWidth:21,containerHeight:14,position:{mx:.285,my:.357}});return w(P,j,{fill:oe(_,c,y.stroke),stroke:ze(_,s,y.fill),strokeWidth:1}),D},"bpmn:SequenceFlow":function(P,_,y={}){y=Je(y,["fill","stroke"]);var D=ze(_,s,y.fill),j=oe(_,c,y.stroke),U=x(P,_.waypoints,{markerEnd:d(P,"sequenceflow-end",D,j),stroke:j}),ue=ee(_),{source:Be}=_;if(Be){var et=ee(Be);ue.get("conditionExpression")&&v(et,"bpmn:Activity")&&ce(U,{markerStart:d(P,"conditional-flow-marker",D,j)}),et.get("default")&&(v(et,"bpmn:Gateway")||v(et,"bpmn:Activity"))&&et.get("default")===ue&&ce(U,{markerStart:d(P,"conditional-default-flow-marker",D,j)})}return U},"bpmn:ServiceTask":function(P,_,y={}){y=Je(y,["fill","stroke"]);var D=Ne(P,_,y);m(P,10,10,{fill:ze(_,s,y.fill),stroke:"none",transform:"translate(6, 6)"});var j=i.getScaledPath("TASK_TYPE_SERVICE",{abspos:{x:12,y:18}});w(P,j,{fill:ze(_,s,y.fill),stroke:oe(_,c,y.stroke),strokeWidth:1}),m(P,10,10,{fill:ze(_,s,y.fill),stroke:"none",transform:"translate(11, 10)"});var U=i.getScaledPath("TASK_TYPE_SERVICE",{abspos:{x:17,y:22}});return w(P,U,{fill:ze(_,s,y.fill),stroke:oe(_,c,y.stroke),strokeWidth:1}),D},"bpmn:StartEvent":function(P,_,y={}){var{renderIcon:D=!0}=y;y=Je(y,["fill","stroke"]);var j=ee(_);j.get("isInterrupting")||(y={...y,strokeDasharray:"6"});var U=ge(P,_,y);return D&&z(_,P,y),U},"bpmn:SubProcess":function(P,_,y={}){return Ve(_)?y=Je(y,["fill","stroke","width","height"]):y=Je(y,["fill","stroke"]),F(P,_,y)},"bpmn:Task":function(P,_,y={}){return y=Je(y,["fill","stroke"]),Ne(P,_,y)},"bpmn:TextAnnotation":function(P,_,y={}){y=Je(y,["fill","stroke"]);var{width:D,height:j}=sa(_,y),U=g(P,D,j,0,0,{fill:"none",stroke:"none"}),ue=i.getScaledPath("TEXT_ANNOTATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:D,containerHeight:j,position:{mx:0,my:0}});w(P,ue,{stroke:oe(_,c,y.stroke)});var Be=ee(_),et=Be.get("text")||"";return he(P,et,{align:"left-top",box:sa(_,y),padding:yo,style:{fill:aa(_,u,c,y.stroke)}}),U},"bpmn:Transaction":function(P,_,y={}){Ve(_)?y=Je(y,["fill","stroke","width","height"]):y=Je(y,["fill","stroke"]);var D=F(P,_,{strokeWidth:1.5,...y}),j=n.style(["no-fill","no-events"],{stroke:oe(_,c,y.stroke),strokeWidth:1.5}),U=Ve(_);return U||(y={}),g(P,Gn(_,y),Tn(_,y),Is-Ls,Ls,j),D},"bpmn:UserTask":function(P,_,y={}){y=Je(y,["fill","stroke"]);var D=Ne(P,_,y),j=15,U=12,ue=i.getScaledPath("TASK_TYPE_USER_1",{abspos:{x:j,y:U}});w(P,ue,{fill:ze(_,s,y.fill),stroke:oe(_,c,y.stroke),strokeWidth:.5});var Be=i.getScaledPath("TASK_TYPE_USER_2",{abspos:{x:j,y:U}});w(P,Be,{fill:ze(_,s,y.fill),stroke:oe(_,c,y.stroke),strokeWidth:.5});var et=i.getScaledPath("TASK_TYPE_USER_3",{abspos:{x:j,y:U}});return w(P,et,{fill:oe(_,c,y.stroke),stroke:oe(_,c,y.stroke),strokeWidth:.5}),D},label:function(P,_,y={}){return gt(P,_,y)}};this._drawPath=w,this._renderer=T}se(Br,Mi),Br.$inject=["config.bpmnRenderer","eventBus","styles","pathMap","canvas","textRenderer"],Br.prototype.canRender=function(e){return v(e,"bpmn:BaseElement")},Br.prototype.drawShape=function(e,t,n={}){var{type:i}=t,r=this._renderer(i);return r(e,t,n)},Br.prototype.drawConnection=function(e,t,n={}){var{type:i}=t,r=this._renderer(i);return r(e,t,n)},Br.prototype.getShapePath=function(e){return $e(e)?vl(e,zS):v(e,"bpmn:Event")?ym(e):v(e,"bpmn:Activity")?vl(e,Is):v(e,"bpmn:Gateway")?BS(e):$S(e)};function Je(e,t=[]){return t.reduce((n,i)=>(e[i]&&(n[i]=e[i]),n),{})}var WS=0,US={width:150,height:50};function qS(e){var t=e.split("-");return{horizontal:t[0]||"center",vertical:t[1]||"top"}}function YS(e){return Ut(e)?N({top:0,left:0,right:0,bottom:0},e):{top:e,left:e,right:e,bottom:e}}var _l=null;function KS(){return _l||(_l=document.createElement("canvas").getContext("2d")),_l}function XS(e){var t=[];return e.fontStyle&&t.push(e.fontStyle),e.fontVariant&&t.push(e.fontVariant),e.fontWeight&&t.push(e.fontWeight),e.fontStretch&&t.push(e.fontStretch),t.push(vm(e.fontSize)||"12px"),t.push(e.fontFamily||"sans-serif"),t.join(" ")}function vm(e){if(e!=null)return typeof e=="number"||/^-?\d+(\.\d+)?$/.test(e)?e+"px":e}function ZS(e,t){var n=KS();if(!n)return{width:0,height:0};n.font=XS(t),"letterSpacing"in n&&(n.letterSpacing=vm(t.letterSpacing)||"0px");var i=e==="",r=i?"dummy":e.replace(/\s+$/,""),o=n.measureText(r);return{width:i?0:o.width,height:"fontBoundingBoxAscent"in o?o.fontBoundingBoxAscent+o.fontBoundingBoxDescent:o.actualBoundingBoxAscent+o.actualBoundingBoxDescent}}function QS(e,t,n){for(var i=e.shift(),r=i,o;;){if(o=ZS(r,n),o.width=r?o.width:0,r===" "||r===""||o.width<Math.round(t)||r.length<2)return JS(e,r,i,o);r=tR(r,o.width,t)}}function JS(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 _m="";function eR(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===_m)&&r.pop();break}var a=r[r.length-1];return a&&a===_m&&(r[r.length-1]="-"),r.join("")}function tR(e,t,n){var i=Math.max(e.length*(n/t),1),r=eR(e,i);return r||(r=e.slice(0,Math.max(Math.round(i-1),1))),r}function Ns(e){this._config=N({},{size:US,padding:WS,style:{},align:"center-top"},e||{})}Ns.prototype.createText=function(e,t){return this.layoutText(e,t).element},Ns.prototype.getDimensions=function(e,t){return this.layoutText(e,t).dimensions},Ns.prototype.layoutText=function(e,t){for(var n=N({},this._config.size,t.box),i=N({},this._config.style,t.style),r=qS(t.align||this._config.align),o=YS(t.padding!==void 0?t.padding:this._config.padding),a=t.fitBox||!1,s=nR(i),c=e.split(/\u00AD?\r?\n/),u=[],l=n.width-o.left-o.right;c.length;)u.push(QS(c,l,i));r.vertical==="middle"&&(o.top=o.bottom=0);var f=Rn(u,function(g,S,E){return g+(s||S.height)},0)+o.top+o.bottom,p=Rn(u,function(g,S,E){return S.width>g?S.width:g},0),d=o.top;r.vertical==="middle"&&(d+=(n.height-f)/2),d-=(s||u[0].height)/4;var h=ye("text");ce(h,i),k(u,function(g){var S;switch(d+=s||g.height,r.horizontal){case"left":S=o.left;break;case"right":S=(a?p:l)-o.right-g.width;break;default:S=Math.max(((a?p:l)-g.width)/2+o.left,0)}var E=ye("tspan");ce(E,{x:S,y:d}),E.textContent=g.text,De(h,E)});var m={width:p,height:f};return{dimensions:m,element:h}};function nR(e){if("fontSize"in e&&"lineHeight"in e)return e.lineHeight*parseInt(e.fontSize,10)}var iR=12,rR=1.2,oR=40;function bm(e){var t=N({fontFamily:"Arial, sans-serif",fontSize:iR,fontWeight:"normal",lineHeight:rR},e&&e.defaultStyle||{}),n=parseInt(t.fontSize,10)-1,i=N({},t,{fontSize:n},e&&e.externalStyle||{}),r=new Ns({style:t});this.getExternalLabelBounds=function(a,s){var c={width:Math.max(a.width,Nr.width),height:30},u=o(s,c,{style:i});return{x:Math.round(a.x+a.width/2-u.width/2),y:a.y,width:Math.ceil(u.width),height:Math.ceil(u.height)}},this.getTextAnnotationBounds=function(a,s){var c=o(s,a,{style:t,align:"left-top",padding:yo});return{x:a.x,y:a.y,width:a.width,height:Math.max(oR,Math.round(c.height))}},this.getDimensions=function(a,s){return r.getDimensions(a,s||{})};function o(a,s,c){return r.getDimensions(a,N({box:s},c))}this.createText=function(a,s){return r.createText(a,s||{})},this.getDefaultStyle=function(){return t},this.getExternalStyle=function(){return i}}bm.$inject=["config.textRenderer"];function aR(){this.pathMap={EVENT_MESSAGE:{d:"m {mx},{my} l 0,{e.y1} l {e.x1},0 l 0,-{e.y1} z l {e.x0},{e.y0} l {e.x0},-{e.y0}",height:36,width:36,heightElements:[6,14],widthElements:[10.5,21]},EVENT_SIGNAL:{d:"M {mx},{my} l {e.x0},{e.y0} l -{e.x1},0 Z",height:36,width:36,heightElements:[18],widthElements:[10,20]},EVENT_ESCALATION:{d:"M {mx},{my} l {e.x0},{e.y0} l -{e.x0},-{e.y1} l -{e.x0},{e.y1} Z",height:36,width:36,heightElements:[20,7],widthElements:[8]},EVENT_CONDITIONAL:{d:"M {e.x0},{e.y0} l {e.x1},0 l 0,{e.y2} l -{e.x1},0 Z M {e.x2},{e.y3} l {e.x0},0 M {e.x2},{e.y4} l {e.x0},0 M {e.x2},{e.y5} l {e.x0},0 M {e.x2},{e.y6} l {e.x0},0 M {e.x2},{e.y7} l {e.x0},0 M {e.x2},{e.y8} l {e.x0},0 ",height:36,width:36,heightElements:[8.5,14.5,18,11.5,14.5,17.5,20.5,23.5,26.5],widthElements:[10.5,14.5,12.5]},EVENT_LINK:{d:"m {mx},{my} 0,{e.y0} -{e.x1},0 0,{e.y1} {e.x1},0 0,{e.y0} {e.x0},-{e.y2} -{e.x0},-{e.y2} z",height:36,width:36,heightElements:[4.4375,6.75,7.8125],widthElements:[9.84375,13.5]},EVENT_ERROR:{d:"m {mx},{my} {e.x0},-{e.y0} {e.x1},-{e.y1} {e.x2},{e.y2} {e.x3},-{e.y3} -{e.x4},{e.y4} -{e.x5},-{e.y5} z",height:36,width:36,heightElements:[.023,8.737,8.151,16.564,10.591,8.714],widthElements:[.085,6.672,6.97,4.273,5.337,6.636]},EVENT_CANCEL_45:{d:"m {mx},{my} -{e.x1},0 0,{e.x0} {e.x1},0 0,{e.y1} {e.x0},0 0,-{e.y1} {e.x1},0 0,-{e.y0} -{e.x1},0 0,-{e.y1} -{e.x0},0 z",height:36,width:36,heightElements:[4.75,8.5],widthElements:[4.75,8.5]},EVENT_COMPENSATION:{d:"m {mx},{my} {e.x0},-{e.y0} 0,{e.y1} z m {e.x1},-{e.y2} {e.x2},-{e.y3} 0,{e.y1} -{e.x2},-{e.y3} z",height:36,width:36,heightElements:[6.5,13,.4,6.1],widthElements:[9,9.3,8.7]},EVENT_TIMER_WH:{d:"M {mx},{my} l {e.x0},-{e.y0} m -{e.x0},{e.y0} l {e.x1},{e.y1} ",height:36,width:36,heightElements:[10,2],widthElements:[3,7]},EVENT_TIMER_LINE:{d:"M {mx},{my} m {e.x0},{e.y0} l -{e.x1},{e.y1} ",height:36,width:36,heightElements:[10,3],widthElements:[0,0]},EVENT_MULTIPLE:{d:"m {mx},{my} {e.x1},-{e.y0} {e.x1},{e.y0} -{e.x0},{e.y1} -{e.x2},0 z",height:36,width:36,heightElements:[6.28099,12.56199],widthElements:[3.1405,9.42149,12.56198]},EVENT_PARALLEL_MULTIPLE:{d:"m {mx},{my} {e.x0},0 0,{e.y1} {e.x1},0 0,{e.y0} -{e.x1},0 0,{e.y1} -{e.x0},0 0,-{e.y1} -{e.x1},0 0,-{e.y0} {e.x1},0 z",height:36,width:36,heightElements:[2.56228,7.68683],widthElements:[2.56228,7.68683]},GATEWAY_EXCLUSIVE:{d:"m {mx},{my} {e.x0},{e.y0} {e.x1},{e.y0} {e.x2},0 {e.x4},{e.y2} {e.x4},{e.y1} {e.x2},0 {e.x1},{e.y3} {e.x0},{e.y3} {e.x3},0 {e.x5},{e.y1} {e.x5},{e.y2} {e.x3},0 z",height:17.5,width:17.5,heightElements:[8.5,6.5312,-6.5312,-8.5],widthElements:[6.5,-6.5,3,-3,5,-5]},GATEWAY_PARALLEL:{d:"m {mx},{my} 0,{e.y1} -{e.x1},0 0,{e.y0} {e.x1},0 0,{e.y1} {e.x0},0 0,-{e.y1} {e.x1},0 0,-{e.y0} -{e.x1},0 0,-{e.y1} -{e.x0},0 z",height:30,width:30,heightElements:[5,12.5],widthElements:[5,12.5]},GATEWAY_EVENT_BASED:{d:"m {mx},{my} {e.x0},{e.y0} {e.x0},{e.y1} {e.x1},{e.y2} {e.x2},0 z",height:11,width:11,heightElements:[-6,6,12,-12],widthElements:[9,-3,-12]},GATEWAY_COMPLEX:{d:"m {mx},{my} 0,{e.y0} -{e.x0},-{e.y1} -{e.x1},{e.y2} {e.x0},{e.y1} -{e.x2},0 0,{e.y3} {e.x2},0 -{e.x0},{e.y1} l {e.x1},{e.y2} {e.x0},-{e.y1} 0,{e.y0} {e.x3},0 0,-{e.y0} {e.x0},{e.y1} {e.x1},-{e.y2} -{e.x0},-{e.y1} {e.x2},0 0,-{e.y3} -{e.x2},0 {e.x0},-{e.y1} -{e.x1},-{e.y2} -{e.x0},{e.y1} 0,-{e.y0} -{e.x3},0 z",height:17.125,width:17.125,heightElements:[4.875,3.4375,2.125,3],widthElements:[3.4375,2.125,4.875,3]},DATA_OBJECT_PATH:{d:"m 0,0 {e.x1},0 {e.x0},{e.y0} 0,{e.y1} -{e.x2},0 0,-{e.y2} {e.x1},0 0,{e.y0} {e.x0},0",height:61,width:51,heightElements:[10,50,60],widthElements:[10,40,50,60]},DATA_OBJECT_COLLECTION_PATH:{d:"m{mx},{my} m 3,2 l 0,10 m 3,-10 l 0,10 m 3,-10 l 0,10",height:10,width:10,heightElements:[],widthElements:[]},DATA_ARROW:{d:"m 5,9 9,0 0,-3 5,5 -5,5 0,-3 -9,0 z",height:61,width:51,heightElements:[],widthElements:[]},DATA_STORE:{d:"m {mx},{my} l 0,{e.y2} c {e.x0},{e.y1} {e.x1},{e.y1} {e.x2},0 l 0,-{e.y2} c -{e.x0},-{e.y1} -{e.x1},-{e.y1} -{e.x2},0c {e.x0},{e.y1} {e.x1},{e.y1} {e.x2},0 m -{e.x2},{e.y0}c {e.x0},{e.y1} {e.x1},{e.y1} {e.x2},0m -{e.x2},{e.y0}c {e.x0},{e.y1} {e.x1},{e.y1} {e.x2},0",height:61,width:61,heightElements:[7,10,45],widthElements:[2,58,60]},TEXT_ANNOTATION:{d:"m {mx}, {my} m 10,0 l -10,0 l 0,{e.y0} l 10,0",height:30,width:10,heightElements:[30],widthElements:[10]},MARKER_SUB_PROCESS:{d:"m{mx},{my} m 7,2 l 0,10 m -5,-5 l 10,0",height:10,width:10,heightElements:[],widthElements:[]},MARKER_PARALLEL:{d:"m{mx},{my} m 3,2 l 0,10 m 3,-10 l 0,10 m 3,-10 l 0,10",height:10,width:10,heightElements:[],widthElements:[]},MARKER_SEQUENTIAL:{d:"m{mx},{my} m 0,3 l 10,0 m -10,3 l 10,0 m -10,3 l 10,0",height:10,width:10,heightElements:[],widthElements:[]},MARKER_COMPENSATION:{d:"m {mx},{my} 7,-5 0,10 z m 7.1,-0.3 6.9,-4.7 0,10 -6.9,-4.7 z",height:10,width:21,heightElements:[],widthElements:[]},MARKER_LOOP:{d:"m {mx},{my} c 3.526979,0 6.386161,-2.829858 6.386161,-6.320661 0,-3.490806 -2.859182,-6.320661 -6.386161,-6.320661 -3.526978,0 -6.38616,2.829855 -6.38616,6.320661 0,1.745402 0.714797,3.325567 1.870463,4.469381 0.577834,0.571908 1.265885,1.034728 2.029916,1.35457 l -0.718163,-3.909793 m 0.718163,3.909793 -3.885211,0.802902",height:13.9,width:13.7,heightElements:[],widthElements:[]},MARKER_ADHOC:{d:"m {mx},{my} m 0.84461,2.64411 c 1.05533,-1.23780996 2.64337,-2.07882 4.29653,-1.97997996 2.05163,0.0805 3.85579,1.15803 5.76082,1.79107 1.06385,0.34139996 2.24454,0.1438 3.18759,-0.43767 0.61743,-0.33642 1.2775,-0.64078 1.7542,-1.17511 0,0.56023 0,1.12046 0,1.6807 -0.98706,0.96237996 -2.29792,1.62393996 -3.6918,1.66181996 -1.24459,0.0927 -2.46671,-0.2491 -3.59505,-0.74812 -1.35789,-0.55965 -2.75133,-1.33436996 -4.27027,-1.18121996 -1.37741,0.14601 -2.41842,1.13685996 -3.44288,1.96782996 z",height:4,width:15,heightElements:[],widthElements:[]},TASK_TYPE_SEND:{d:"m {mx},{my} l 0,{e.y1} l {e.x1},0 l 0,-{e.y1} z l {e.x0},{e.y0} l {e.x0},-{e.y0}",height:14,width:21,heightElements:[6,14],widthElements:[10.5,21]},TASK_TYPE_SCRIPT:{d:"m {mx},{my} c 9.966553,-6.27276 -8.000926,-7.91932 2.968968,-14.938 l -8.802728,0 c -10.969894,7.01868 6.997585,8.66524 -2.968967,14.938 z m -7,-12 l 5,0 m -4.5,3 l 4.5,0 m -3,3 l 5,0m -4,3 l 5,0",height:15,width:12.6,heightElements:[6,14],widthElements:[10.5,21]},TASK_TYPE_USER_1:{d:"m {mx},{my} c 0.909,-0.845 1.594,-2.049 1.594,-3.385 0,-2.554 -1.805,-4.62199999 -4.357,-4.62199999 -2.55199998,0 -4.28799998,2.06799999 -4.28799998,4.62199999 0,1.348 0.974,2.562 1.89599998,3.405 -0.52899998,0.187 -5.669,2.097 -5.794,4.7560005 v 6.718 h 17 v -6.718 c 0,-2.2980005 -5.5279996,-4.5950005 -6.0509996,-4.7760005 zm -8,6 l 0,5.5 m 11,0 l 0,-5"},TASK_TYPE_USER_2:{d:"m {mx},{my} m 2.162,1.009 c 0,2.4470005 -2.158,4.4310005 -4.821,4.4310005 -2.66499998,0 -4.822,-1.981 -4.822,-4.4310005 "},TASK_TYPE_USER_3:{d:"m {mx},{my} m -6.9,-3.80 c 0,0 2.25099998,-2.358 4.27399998,-1.177 2.024,1.181 4.221,1.537 4.124,0.965 -0.098,-0.57 -0.117,-3.79099999 -4.191,-4.13599999 -3.57499998,0.001 -4.20799998,3.36699999 -4.20699998,4.34799999 z"},TASK_TYPE_MANUAL:{d:"m {mx},{my} c 0.234,-0.01 5.604,0.008 8.029,0.004 0.808,0 1.271,-0.172 1.417,-0.752 0.227,-0.898 -0.334,-1.314 -1.338,-1.316 -2.467,-0.01 -7.886,-0.004 -8.108,-0.004 -0.014,-0.079 0.016,-0.533 0,-0.61 0.195,-0.042 8.507,0.006 9.616,0.002 0.877,-0.007 1.35,-0.438 1.353,-1.208 0.003,-0.768 -0.479,-1.09 -1.35,-1.091 -2.968,-0.002 -9.619,-0.013 -9.619,-0.013 v -0.591 c 0,0 5.052,-0.016 7.225,-0.016 0.888,-0.002 1.354,-0.416 1.351,-1.193 -0.006,-0.761 -0.492,-1.196 -1.361,-1.196 -3.473,-0.005 -10.86,-0.003 -11.0829995,-0.003 -0.022,-0.047 -0.045,-0.094 -0.069,-0.139 0.3939995,-0.319 2.0409995,-1.626 2.4149995,-2.017 0.469,-0.4870005 0.519,-1.1650005 0.162,-1.6040005 -0.414,-0.511 -0.973,-0.5 -1.48,-0.236 -1.4609995,0.764 -6.5999995,3.6430005 -7.7329995,4.2710005 -0.9,0.499 -1.516,1.253 -1.882,2.19 -0.37000002,0.95 -0.17,2.01 -0.166,2.979 0.004,0.718 -0.27300002,1.345 -0.055,2.063 0.629,2.087 2.425,3.312 4.859,3.318 4.6179995,0.014 9.2379995,-0.139 13.8569995,-0.158 0.755,-0.004 1.171,-0.301 1.182,-1.033 0.012,-0.754 -0.423,-0.969 -1.183,-0.973 -1.778,-0.01 -5.824,-0.004 -6.04,-0.004 10e-4,-0.084 0.003,-0.586 10e-4,-0.67 z"},TASK_TYPE_INSTANTIATING_SEND:{d:"m {mx},{my} l 0,8.4 l 12.6,0 l 0,-8.4 z l 6.3,3.6 l 6.3,-3.6"},TASK_TYPE_SERVICE:{d:"m {mx},{my} v -1.71335 c 0.352326,-0.0705 0.703932,-0.17838 1.047628,-0.32133 0.344416,-0.14465 0.665822,-0.32133 0.966377,-0.52145 l 1.19431,1.18005 1.567487,-1.57688 -1.195028,-1.18014 c 0.403376,-0.61394 0.683079,-1.29908 0.825447,-2.01824 l 1.622133,-0.01 v -2.2196 l -1.636514,0.01 c -0.07333,-0.35153 -0.178319,-0.70024 -0.323564,-1.04372 -0.145244,-0.34406 -0.321407,-0.6644 -0.522735,-0.96217 l 1.131035,-1.13631 -1.583305,-1.56293 -1.129598,1.13589 c -0.614052,-0.40108 -1.302883,-0.68093 -2.022633,-0.82247 l 0.0093,-1.61852 h -2.241173 l 0.0042,1.63124 c -0.353763,0.0736 -0.705369,0.17977 -1.049785,0.32371 -0.344415,0.14437 -0.665102,0.32092 -0.9635006,0.52046 l -1.1698628,-1.15823 -1.5667691,1.5792 1.1684265,1.15669 c -0.4026573,0.61283 -0.68308,1.29797 -0.8247287,2.01713 l -1.6588041,0.003 v 2.22174 l 1.6724648,-0.006 c 0.073327,0.35077 0.1797598,0.70243 0.3242851,1.04472 0.1452428,0.34448 0.3214064,0.6644 0.5227339,0.96066 l -1.1993431,1.19723 1.5840256,1.56011 1.1964668,-1.19348 c 0.6140517,0.40346 1.3028827,0.68232 2.0233517,0.82331 l 7.19e-4,1.69892 h 2.226848 z m 0.221462,-3.9957 c -1.788948,0.7502 -3.8576,-0.0928 -4.6097055,-1.87438 -0.7521065,-1.78321 0.090598,-3.84627 1.8802645,-4.59604 1.78823,-0.74936 3.856881,0.0929 4.608987,1.87437 0.752106,1.78165 -0.0906,3.84612 -1.879546,4.59605 z"},TASK_TYPE_SERVICE_FILL:{d:"m {mx},{my} c -1.788948,0.7502 -3.8576,-0.0928 -4.6097055,-1.87438 -0.7521065,-1.78321 0.090598,-3.84627 1.8802645,-4.59604 1.78823,-0.74936 3.856881,0.0929 4.608987,1.87437 0.752106,1.78165 -0.0906,3.84612 -1.879546,4.59605 z"},TASK_TYPE_BUSINESS_RULE_HEADER:{d:"m {mx},{my} 0,4 20,0 0,-4 z"},TASK_TYPE_BUSINESS_RULE_MAIN:{d:"m {mx},{my} 0,12 20,0 0,-12 zm 0,8 l 20,0 m -13,-4 l 0,8"},MESSAGE_FLOW_MARKER:{d:"m {mx},{my} m -10.5 ,-7 l 0,14 l 21,0 l 0,-14 z l 10.5,6 l 10.5,-6"}},this.getRawPath=function(t){return this.pathMap[t].d},this.getScaledPath=function(t,n){var i=this.pathMap[t],r,o;n.abspos?(r=n.abspos.x,o=n.abspos.y):(r=n.containerWidth*n.position.mx,o=n.containerHeight*n.position.my);var a={};if(n.position){for(var s=n.containerHeight/i.height*n.yScaleFactor,c=n.containerWidth/i.width*n.xScaleFactor,u=0;u<i.heightElements.length;u++)a["y"+u]=i.heightElements[u]*s;for(var l=0;l<i.widthElements.length;l++)a["x"+l]=i.widthElements[l]*c}var f=lR(i.d,{mx:r,my:o,e:a});return f}}var sR=/\{([^{}]+)\}/g,cR=/(?:(?:^|\.)(.+?)(?=\[|\.|$|\()|\[('|")(.+?)\2\])(\(\))?/g;function uR(e,t,n){var i=n;return t.replace(cR,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 lR(e,t){return String(e).replace(sR,function(n,i){return uR(n,i,t)})}const pR={__init__:["bpmnRenderer"],bpmnRenderer:["type",Br],textRenderer:["type",bm],pathMap:["type",aR]};function fR(e,t){return t=t||{},e.replace(/{([^}]+)}/g,function(n,i){return t[i]||"{"+i+"}"})}const ca={translate:["value",fR]};function Bs(e,t,n){return N({id:e.id,type:e.$type,businessObject:e,di:t},n)}function dR(e,t,n){var i=e.waypoint;return!i||i.length<2?[Pe(t),Pe(n)]:i.map(function(r){return{x:r.x,y:r.y}})}function xm(e,t,n){return new Error(`element ${pn(t)} referenced by ${pn(e)}#${n} not yet drawn`)}function Li(e,t,n,i,r){this._eventBus=e,this._canvas=t,this._elementFactory=n,this._elementRegistry=i,this._textRenderer=r}Li.$inject=["eventBus","canvas","elementFactory","elementRegistry","textRenderer"],Li.prototype.add=function(e,t,n){var i,r,o;if(v(t,"bpmndi:BPMNPlane")){var a=v(e,"bpmn:SubProcess")?{id:e.id+"_plane"}:{};i=this._elementFactory.createRoot(Bs(e,t,a)),this._canvas.addRootElement(i)}else if(v(t,"bpmndi:BPMNShape")){var s=!Ve(e,t),c=mR(e);r=n&&(n.hidden||n.collapsed);var u=t.bounds;i=this._elementFactory.createShape(Bs(e,t,{collapsed:s,hidden:r,x:Math.round(u.x),y:Math.round(u.y),width:Math.round(u.width),height:Math.round(u.height),isFrame:c})),v(e,"bpmn:BoundaryEvent")&&this._attachBoundary(e,i),v(e,"bpmn:Lane")&&(o=0),v(e,"bpmn:DataStoreReference")&&(hR(n,Pe(u))||(n=this._canvas.findRoot(n))),this._canvas.addShape(i,n,o)}else if(v(t,"bpmndi:BPMNEdge")){var l=this._getSource(e),f=this._getTarget(e);r=n&&(n.hidden||n.collapsed),i=this._elementFactory.createConnection(Bs(e,t,{hidden:r,source:l,target:f,waypoints:dR(t,l,f)})),v(e,"bpmn:DataAssociation")&&(n=this._canvas.findRoot(n)),this._canvas.addConnection(i,n,o)}else throw new Error(`unknown di ${pn(t)} for element ${pn(e)}`);return or(e)&&$n(i)&&this.addLabel(e,t,i),this._eventBus.fire("bpmnElement.added",{element:i}),i},Li.prototype._attachBoundary=function(e,t){var n=e.attachedToRef;if(!n)throw new Error(`missing ${pn(e)}#attachedToRef`);var i=this._elementRegistry.get(n.id),r=i&&i.attachers;if(!i)throw xm(e,n,"attachedToRef");t.host=i,r||(i.attachers=r=[]),r.indexOf(t)===-1&&r.push(t)},Li.prototype.addLabel=function(e,t,n){var i,r,o;return i=MS(t,n),r=$n(n),r&&(i=this._textRenderer.getExternalLabelBounds(i,r)),o=this._elementFactory.createLabel(Bs(e,t,{id:e.id+"_label",labelTarget:n,type:"label",hidden:n.hidden||!$n(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)},Li.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?xm(e,i,t+"Ref"):new Error(`${pn(e)}#${t} Ref not specified`)},Li.prototype._getSource=function(e){return this._getConnectedElement(e,"source")},Li.prototype._getTarget=function(e){return this._getConnectedElement(e,"target")},Li.prototype._getElement=function(e){return this._elementRegistry.get(e.id)};function hR(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 mR(e){return v(e,"bpmn:Group")}const wm={__depends__:[pR,{__depends__:[ca],bpmnImporter:["type",Li]}]};function ua(e){return{x:e.x+e.width/2,y:e.y+e.height/2}}function ri(e,t){return{x:e.x-t.x,y:e.y-t.y}}function bl(e){return Math.log(e)/Math.log(10)}var gR=1e3;function Q(e){this._eventBus=e}Q.$inject=["eventBus"];function yR(e,t){return function(n){return e.call(t||null,n.context,n.command,n)}}Q.prototype.on=function(e,t,n,i,r,o){if((qt(t)||ke(t))&&(o=r,r=i,i=n,n=t,t=null),qt(n)&&(o=r,r=i,i=n,n=gR),Ut(r)&&(o=r,r=!1),!qt(i))throw new Error("handlerFn must be a function");Ce(e)||(e=[e]);var a=this._eventBus;k(e,function(s){var c=["commandStack",s,t].filter(function(u){return u}).join(".");a.on(c,n,r?yR(i,o):i,o)})},Q.prototype.canExecute=Ii("canExecute"),Q.prototype.preExecute=Ii("preExecute"),Q.prototype.preExecuted=Ii("preExecuted"),Q.prototype.execute=Ii("execute"),Q.prototype.executed=Ii("executed"),Q.prototype.postExecute=Ii("postExecute"),Q.prototype.postExecuted=Ii("postExecuted"),Q.prototype.revert=Ii("revert"),Q.prototype.reverted=Ii("reverted");function Ii(e){return function(n,i,r,o,a){(qt(n)||ke(n))&&(a=o,o=r,r=i,i=n,n=null),this.on(n,e,i,r,o,a)}}var xl=["top","bottom","left","right"],$s=10;function wl(e,t){Q.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(Ds(r)&&!ut(r)){var o=bR(r);o&&i(r,o)}}function i(r,o){var a=Pe(r),s=r.label,c=Pe(s);if(s.parent){var u=be(r),l;switch(o){case"top":l={x:a.x,y:u.top-$s-s.height/2};break;case"left":l={x:u.left-$s-s.width/2,y:a.y};break;case"bottom":l={x:a.x,y:u.bottom+$s+s.height/2};break;case"right":l={x:u.right+$s+s.width/2,y:a.y};break}var f=ri(l,c);t.moveShape(s,f)}}}se(wl,Q),wl.$inject=["eventBus","modeling"];function vR(e){var t=e.host,n=Pe(e),i=en(n,t),r;i.indexOf("-")>=0?r=i.split("-"):r=[i];var o=xl.filter(function(a){return r.indexOf(a)===-1});return o}function _R(e){var t=Pe(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 Em(t,i)});return n}function bR(e){var t=Pe(e.label),n=Pe(e),i=Em(n,t);if(xR(i)){var r=_R(e);if(e.host){var o=vR(e);r=r.concat(o)}var a=xl.filter(function(s){return r.indexOf(s)===-1});return a.indexOf(i)!==-1?en(e.label,e)!=="intersect"?void 0:i:a[0]}}function Em(e,t){return en(t,e,5)}function xR(e){return xl.indexOf(e)!==-1}function El(e){Q.call(this,e),this.preExecute("shape.append",function(t){var n=t.source,i=t.shape;t.position||(v(i,"bpmn:TextAnnotation")?t.position={x:n.x+n.width/2+75,y:n.y-50-i.height/2}:t.position={x:n.x+n.width+80+i.width/2,y:n.y+n.height/2})},!0)}se(El,Q),El.$inject=["eventBus"];var wR=1500;function Sl(e,t,n){e.invoke(Q,this),this.preExecute("elements.delete",wR,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=He(r,u=>v(u,"bpmn:Participant")||v(u,"bpmn:SubProcess"));if(!o.length)return[];var a=n.getRootElement(),s=new Set(a.children.filter(u=>v(u,"bpmn:Artifact"))),c=new Set;return k(o,u=>{const l=new Set(no(po(Array.from(s),Lt(u))));c=c.union(l),s=s.difference(l)}),Array.from(c)}}se(Sl,Q),Sl.$inject=["injector","eventBus","canvas"];function Rl(e,t){e.invoke(Q,this),this.postExecute("shape.move",function(n){var i=n.newParent,r=n.shape,o=He(r.incoming.concat(r.outgoing),function(a){return v(a,"bpmn:Association")});k(o,function(a){t.moveConnection(a,{x:0,y:0},i)})},!0)}se(Rl,Q),Rl.$inject=["injector","modeling"];function _o(e,t){for(En(t)&&(t=[t]);e=e.parent;)if(Fe(e,t))return e;return null}function Sm(e,t){var n=_o(e,"bpmn:Process");if(n)return!0;var i=["bpmn:Participant","bpmn:Lane"];if(n=_o(e,i),n)return Yt(n);if(Fe(e,i))return Yt(e);var r;for(r=ee(e);r&&!v(r,"bpmn:Process");r=r.$parent);if(!t)return!0;var o=t.find(function(a){var s=ee(a);return s&&s.get("processRef")===r});return o?Yt(o):!0}var Rm=500;function js(e,t){t.invoke(Q,this),this._bpmnReplace=e;var n=this;this.postExecuted("elements.create",Rm,function(i){var r=i.elements;r=r.filter(function(o){var a=o.host;return Cm(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",Rm,function(i){var r=i.shapes,o=i.newHost;if(r.length===1){var a=r[0];Cm(a,o)&&(i.shapes=[n._replaceShape(a,o)])}},!0)}js.$inject=["bpmnReplace","injector"],se(js,Q),js.prototype._replaceShape=function(e,t){var n=ER(e),i={type:"bpmn:BoundaryEvent",host:t};return n&&(i.eventDefinitionType=n.$type),this._bpmnReplace.replaceElement(e,i,{layoutConnection:!1})};function ER(e){var t=ee(e),n=t.eventDefinitions;return n&&n[0]}function Cm(e,t){return!$e(e)&&Fe(e,["bpmn:IntermediateThrowEvent","bpmn:IntermediateCatchEvent"])&&!!t}function Cl(e,t){Q.call(this,e);function n(i){return He(i.attachers,function(r){return v(r,"bpmn:BoundaryEvent")})}this.postExecute("connection.create",function(i){var r=i.context.source,o=i.context.target,a=n(o);v(r,"bpmn:EventBasedGateway")&&v(o,"bpmn:ReceiveTask")&&a.length>0&&t.removeElements(a)}),this.postExecute("connection.reconnect",function(i){var r=i.context.oldSource,o=i.context.newSource;v(r,"bpmn:Gateway")&&v(o,"bpmn:EventBasedGateway")&&k(o.outgoing,function(a){var s=a.target,c=n(s);v(s,"bpmn:ReceiveTask")&&c.length>0&&t.removeElements(c)})})}Cl.$inject=["eventBus","modeling"],se(Cl,Q);function Pm(e){return e.create("bpmn:Category")}function SR(e){return e.create("bpmn:CategoryValue")}function Am(e,t){var n=t.get("categoryValueRef");return n||(n=t.categoryValueRef=SR(e)),n.$parent||(n.$parent=Pm(e)),n}function RR(e,t,n){return Tt(t.get("categoryValue"),e),e.$parent=t,Tt(n.get("rootElements"),t),t.$parent=n,e}function CR(e){var t=e.$parent;return t&&(Pt(t.get("categoryValue"),e),e.$parent=null),e}function PR(e){var t=e.$parent;return t&&(Pt(t.get("rootElements"),e),e.$parent=null),e}var AR=500;function Pl(e,t,n){n.invoke(Q,this);function i(c){return t.filter(function(u){return v(u,"bpmn:Group")&&!u.labelTarget}).map(ee).filter(function(u){return u!==c})}function r(c,u){return i(u).some(function(l){return l.get("categoryValueRef")===c})}function o(c,u){return i(u).some(function(l){var f=l.get("categoryValueRef");return f&&f.$parent===c})}function a(c,u){c&&u&&RR(c,u,e.getDefinitions())}function s(c,u,l){u&&!o(u,l)&&PR(u),c&&!r(c,l)&&CR(c)}this.executed(["shape.create","label.create"],function(c){var u=c.labelTarget||c.shape;!v(u,"bpmn:Group")||u.labelTarget||a(c.categoryValue,c.category)},!0),this.reverted(["shape.create","label.create"],function(c){var u=c.labelTarget||c.shape;!v(u,"bpmn:Group")||u.labelTarget||s(c.categoryValue,c.category,ee(u))},!0),this.executed(["shape.move","shape.resize"],AR,function(c){a(c.categoryValue,c.category)},!0),this.reverted(["shape.move","shape.resize"],function(c){var u=c.shape;c.categoryValue&&s(c.categoryValue,c.category,ee(u))},!0),this.executed("group.updateRefs",function(c){Tm(c).forEach(function(u){a(u.categoryValue,u.category)})},!0),this.reverted("group.updateRefs",function(c){Tm(c).forEach(function(u){s(u.categoryValue,u.category,ee(u.groupShape))})},!0),this.executed("shape.delete",function(c){var u=c.shape;!v(u,"bpmn:Group")||u.labelTarget||s(c.categoryValue,c.category,ee(u))},!0),this.reverted("shape.delete",function(c){var u=c.shape;!v(u,"bpmn:Group")||u.labelTarget||a(c.categoryValue,c.category)},!0)}Pl.$inject=["bpmnjs","elementRegistry","injector"],se(Pl,Q);function Tm(e){var t;return((t=e.updates)==null?void 0:t.groups)||[]}function Al(e,t,n){Q.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;bo(S)&&la(E)&&l(E)}function r(g){const S=g.connection,E=g.source,x=g.target;bo(E)&&Fs(x)&&(u(x),p(E,[S]))}function o(g){const S=g.newTarget,E=g.oldSource,x=g.oldTarget;if(x!==S){const w=E;la(x)&&l(x),bo(w)&&Fs(S)&&u(S)}}function a(g){const{element:S}=g;la(S)?(f(S),d(S)):Fs(S)&&h(S)}function s(g){const{newData:S,oldShape:E}=g;if(bo(g.oldShape)&&S.eventDefinitionType!=="bpmn:CompensateEventDefinition"||S.type!=="bpmn:BoundaryEvent"){const x=E.outgoing.find(({target:w})=>la(w));x&&x.target&&(g._connectionTarget=x.target)}else if(!bo(g.oldShape)&&S.eventDefinitionType==="bpmn:CompensateEventDefinition"&&S.type==="bpmn:BoundaryEvent"){const x=E.outgoing.find(({target:w})=>Fs(w));x&&x.target&&(g._connectionTarget=x.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 f(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 p(g,S){g.outgoing.filter(w=>v(w,"bpmn:Association")).filter(w=>la(w.target)&&!S.includes(w)).forEach(w=>t.removeConnection(w))}function d(g){const S=g.attachers.slice();S.length&&t.removeElements(S)}function h(g){const S=g.incoming.filter(E=>bo(E.source));t.removeElements(S)}function m(g){const S=g.outgoing.filter(E=>v(E,"bpmn:SequenceFlow"));t.removeElements(S)}}se(Al,Q),Al.$inject=["eventBus","modeling","bpmnRules"];function la(e){const t=ee(e);return t&&t.get("isForCompensation")}function bo(e){return e&&v(e,"bpmn:BoundaryEvent")&&go(e,"bpmn:CompensateEventDefinition")}function Fs(e){return e&&v(e,"bpmn:Activity")&&!fn(e)}function Tl(e){e.invoke(Q,this),this.preExecute("shape.create",1500,function(t){var n=t.context,i=n.parent,r=n.shape;v(i,"bpmn:Lane")&&!v(r,"bpmn:Lane")&&(n.parent=_o(i,"bpmn:Participant"))})}Tl.$inject=["injector"],se(Tl,Q);function Ml(e,t){Q.call(this,e),this.preExecute("shape.create",function(n){var a;var i=n.context,r=i.shape;if(v(r,"bpmn:DataObjectReference")&&r.type!=="label"){var o=t.create("bpmn:DataObject");o.isCollection=((a=r.businessObject.dataObjectRef)==null?void 0:a.isCollection)||!1,r.businessObject.dataObjectRef=o}})}Ml.$inject=["eventBus","bpmnFactory"],se(Ml,Q);var kl=20,Ol=20,Mm=30,Hs=2e3;function Dl(e,t,n){Q.call(this,t),t.on(["create.start","shape.move.start"],Hs,function(r){var o=r.context,a=o.shape,s=e.getRootElement();if(!(!v(a,"bpmn:Participant")||!v(s,"bpmn:Process")||!s.children.length)){var c=s.children.filter(function(f){return!v(f,"bpmn:Group")&&!$e(f)&&!ut(f)});if(c.length){var u=Lt(c),l=TR(a,u);N(a,l),o.createConstraints=MR(a,u)}}}),t.on("create.start",Hs,function(r){var o=r.context,a=o.shape,s=e.getRootElement(),c=e.getGraphics(s);function u(l){l.element=s,l.gfx=c}v(a,"bpmn:Participant")&&v(s,"bpmn:Process")&&(t.on("element.hover",Hs,u),t.once("create.cleanup",function(){t.off("element.hover",u)}))});function i(){var r=e.getRootElement();return v(r,"bpmn:Collaboration")?r:n.makeCollaboration()}this.preExecute("elements.create",Hs,function(r){var o=r.elements,a=r.parent,s=kR(o),c;s&&v(a,"bpmn:Process")&&(r.parent=i(),c=r.hints=r.hints||{},c.participant=s,c.process=a,c.processRef=ee(s).get("processRef"))},!0),this.preExecute("shape.create",function(r){var o=r.parent,a=r.shape;v(a,"bpmn:Participant")&&v(o,"bpmn:Process")&&(r.parent=i(),r.process=o,r.processRef=ee(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)&&ee(s).set("processRef",ee(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)&&ee(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)}Dl.$inject=["canvas","eventBus","modeling"],se(Dl,Q);function TR(e,t){t={width:t.width+kl*2+Mm,height:t.height+Ol*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 MR(e,t){return t=be(t),{bottom:t.top+e.height/2-Ol,left:t.right-e.width/2+kl,top:t.bottom-e.height/2+Ol,right:t.left+e.width/2-kl-Mm}}function kR(e){return ft(e,function(t){return v(t,"bpmn:Participant")})}var km="__targetRef_placeholder";function Ll(e,t){Q.call(this,e),this.executed(["connection.create","connection.delete","connection.move","connection.reconnect"],Om(o)),this.reverted(["connection.create","connection.delete","connection.move","connection.reconnect"],Om(o));function n(a,s,c){var u=a.get("dataInputAssociations");return ft(u,function(l){return l!==c&&l.targetRef===s})}function i(a,s){var c=a.get("properties"),u=ft(c,function(l){return l.name===km});return!u&&s&&(u=t.create("bpmn:Property",{name:km}),Tt(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,f=l&&l.businessObject,p=s.newTarget,d=p&&p.businessObject,h=s.oldTarget||s.target,m=h&&h.businessObject,g=c.businessObject,S;m&&m!==f&&r(m,u),d&&d!==f&&r(d,u),f?(S=i(f,!0),g.targetRef=S):g.targetRef=null}}Ll.$inject=["eventBus","bpmnFactory"],se(Ll,Q);function Om(e){return function(t){var n=t.context,i=n.connection;if(v(i,"bpmn:DataInputAssociation"))return e(t)}}function zs(e){this._bpmnUpdater=e}zs.$inject=["bpmnUpdater"],zs.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),[]},zs.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 Il(e,t,n,i){Q.call(this,i),t.registerHandler("dataStore.updateContainment",zs);function r(){return n.filter(function(s){return v(s,"bpmn:Participant")&&ee(s).processRef})[0]}function o(s){return s.children.filter(function(c){return v(c,"bpmn:DataStoreReference")&&!c.labelTarget})}function a(s,c){var u=s.businessObject||s;if(c=c||r(),c){var l=c.businessObject||c;t.execute("dataStore.updateContainment",{dataStoreBo:u,dataStoreDi:Qe(s),newSemanticParent:l.processRef||l,newDiParent:Qe(c)})}}this.preExecute("shape.create",function(s){var c=s.context,u=c.shape;v(u,"bpmn:DataStoreReference")&&u.type!=="label"&&(c.hints||(c.hints={}),c.hints.autoResize=!1)}),this.preExecute("elements.move",function(s){var c=s.context,u=c.shapes,l=u.filter(function(f){return v(f,"bpmn:DataStoreReference")});l.length&&(c.hints||(c.hints={}),c.hints.autoResize=u.filter(function(f){return!v(f,"bpmn:DataStoreReference")}))}),this.postExecute("shape.create",function(s){var c=s.context,u=c.shape,l=u.parent;v(u,"bpmn:DataStoreReference")&&u.type!=="label"&&v(l,"bpmn:Collaboration")&&a(u)}),this.postExecute("shape.move",function(s){var c=s.context,u=c.shape,l=c.oldParent,f=u.parent;if(!v(l,"bpmn:Collaboration")&&v(u,"bpmn:DataStoreReference")&&u.type!=="label"&&v(f,"bpmn:Collaboration")){var p=v(l,"bpmn:Participant")?l:DR(l,"bpmn:Participant");a(u,p)}}),this.postExecute("shape.delete",function(s){var c=s.context,u=c.shape,l=e.getRootElement();Fe(u,["bpmn:Participant","bpmn:SubProcess"])&&v(l,"bpmn:Collaboration")&&o(l).filter(function(f){return OR(f,u)}).forEach(function(f){a(f)})}),this.postExecute("canvas.updateRoot",function(s){var c=s.context,u=c.oldRoot,l=c.newRoot,f=o(u);f.forEach(function(p){v(l,"bpmn:Process")&&a(p,l)})})}Il.$inject=["canvas","commandStack","elementRegistry","eventBus"],se(Il,Q);function OR(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 DR(e,t){for(;e.parent;){if(v(e.parent,t))return e.parent;e=e.parent}}var Gs=Math.max,Vs=Math.min,LR=20;function Dm(e,t){return{top:e.top-t.top,right:e.right-t.right,bottom:e.bottom-t.bottom,left:e.left-t.left}}function IR(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 NR(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 Ws(e,t,n){var i=t[e],r=n.min&&n.min[e],o=n.max&&n.max[e];return ke(r)&&(i=(/top|left/.test(e)?Vs:Gs)(i,r)),ke(o)&&(i=(/top|left/.test(e)?Gs:Vs)(i,o)),i}function BR(e,t){if(!t)return e;var n=be(e);return Ps({top:Ws("top",n,t),right:Ws("right",n,t),bottom:Ws("bottom",n,t),left:Ws("left",n,t)})}function $R(e,t,n,i){var r=be(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?be(i):o,s={top:Vs(o.top,a.top),left:Vs(o.left,a.left),bottom:Gs(o.bottom,a.bottom),right:Gs(o.right,a.right)};return Ps(s)}function pa(e,t){return typeof e<"u"?e:LR}function jR(e,t){var n,i,r,o;return typeof t=="object"?(n=pa(t.left),i=pa(t.right),r=pa(t.top),o=pa(t.bottom)):n=i=r=o=pa(t),{x:e.x-n,y:e.y-r,width:e.width+n+i,height:e.height+r+o}}function FR(e){return!(e.waypoints||e.type==="label")}function Lm(e,t){var n;if(e.length===void 0?n=He(e.children,FR):n=e,n.length)return jR(Lt(n),t)}var ar=Math.abs;function HR(e,t){return Dm(be(t),be(e))}var zR=["bpmn:Participant","bpmn:Process","bpmn:SubProcess"],Vn=30;function Us(e,t){return t=t||[],e.children.filter(function(n){v(n,"bpmn:Lane")&&(Us(n,t),t.push(n))}),t}function sr(e){return e.children.filter(function(t){return v(t,"bpmn:Lane")})}function Wn(e){return _o(e,zR)||e}function GR(e,t){var n=Wn(e),i=v(n,"bpmn:Process")?[]:[n],r=Us(n,i),o=be(e),a=be(t),s=HR(e,t),c=[],u=Yt(e);return r.forEach(function(l){if(l!==e){var f=u?0:s.top,p=u?s.right:0,d=u?0:s.bottom,h=u?s.left:0,m=be(l);s.top&&(ar(m.bottom-o.top)<10&&(d=a.top-m.bottom),ar(m.top-o.top)<5&&(f=a.top-m.top)),s.left&&(ar(m.right-o.left)<10&&(p=a.left-m.right),ar(m.left-o.left)<5&&(h=a.left-m.left)),s.bottom&&(ar(m.top-o.bottom)<10&&(f=a.bottom-m.top),ar(m.bottom-o.bottom)<5&&(d=a.bottom-m.bottom)),s.right&&(ar(m.left-o.right)<10&&(h=a.right-m.left),ar(m.right-o.right)<5&&(p=a.right-m.right)),(f||p||d||h)&&c.push({shape:l,newBounds:NR(l,{top:f,right:p,bottom:d,left:h})})}}),c}var VR=500;function Nl(e,t){Q.call(this,e);function n(i,r){var o=Yt(i),a=sr(r),s=[],c=[],u=[],l=[];if(Lr(a,function(g){return o?g.y>i.y?c.push(g):s.push(g):g.x>i.x?l.push(g):u.push(g),g.children}),!!a.length){var f;o?c.length&&s.length?f=i.height/2:f=i.height:l.length&&u.length?f=i.width/2:f=i.width;var p,d,h,m;s.length&&(p=t.calculateAdjustments(s,"y",f,i.y-10),t.makeSpace(p.movingShapes,p.resizingShapes,{x:0,y:f},"s")),c.length&&(d=t.calculateAdjustments(c,"y",-f,i.y+i.height+10),t.makeSpace(d.movingShapes,d.resizingShapes,{x:0,y:-f},"n")),u.length&&(h=t.calculateAdjustments(u,"x",f,i.x-10),t.makeSpace(h.movingShapes,h.resizingShapes,{x:f,y:0},"e")),l.length&&(m=t.calculateAdjustments(l,"x",-f,i.x+i.width+10),t.makeSpace(m.movingShapes,m.resizingShapes,{x:-f,y:0},"w"))}}this.postExecuted("shape.delete",VR,function(i){var r=i.context,o=r.hints,a=r.shape,s=r.oldParent;v(a,"bpmn:Lane")&&(o&&o.nested||n(a,s))})}Nl.$inject=["eventBus","spaceTool"],se(Nl,Q);var Im=500;function qs(e,t){t.invoke(Q,this),this._bpmnReplace=e;var n=this;this.postExecuted("elements.create",Im,function(i){var r=i.elements;r.filter(function(o){var a=o.host;return Nm(o,a)}).map(function(o){return r.indexOf(o)}).forEach(function(o){i.elements[o]=n._replaceShape(r[o])})},!0),this.preExecute("elements.move",Im,function(i){var r=i.shapes,o=i.newHost;r.forEach(function(a,s){var c=a.host;Nm(a,UR(r,c)?c:o)&&(r[s]=n._replaceShape(a))})},!0)}qs.$inject=["bpmnReplace","injector"],se(qs,Q),qs.prototype._replaceShape=function(e){var t=WR(e),n;return t?n={type:"bpmn:IntermediateCatchEvent",eventDefinitionType:t.$type}:n={type:"bpmn:IntermediateThrowEvent"},this._bpmnReplace.replaceElement(e,n,{layoutConnection:!1})};function WR(e){var t=ee(e),n=t.eventDefinitions;return n&&n[0]}function Nm(e,t){return!$e(e)&&v(e,"bpmn:BoundaryEvent")&&!t}function UR(e,t){return e.indexOf(t)!==-1}var Ys=Math.round,qR=Math.max;function YR(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 KR(e){var t=[];return e.forEach(function(n,i){t.push([i===0?"M":"L",n.x,n.y])}),t}var Bm=10;function XR(e,t){var n,i;for(n=0;i=e[n];n++)if(ta(i,t)<=Bm)return{point:e[n],bendpoint:!0,index:n};return null}function ZR(e,t){var n=zh(YR(t,Bm),KR(e)),i=n[0],r=n[n.length-1],o;return i?i!==r?i.segment2!==r.segment2?(o=qR(i.segment2,r.segment2)-1,{point:e[o],bendpoint:!0,index:o}):{point:{x:Ys(i.x+r.x)/2,y:Ys(i.y+r.y)/2},index:i.segment2}:{point:{x:Ys(i.x),y:Ys(i.y)},index:i.segment2}:null}function Bl(e,t){return XR(e,t)||ZR(e,t)}function $l(e,t,n){Q.call(this,e);function i(r,o,a){var s=o.waypoints,c,u,l,f,p,d,h,m=r.outgoing.slice(),g=r.incoming.slice(),S;ke(a.width)?S=Pe(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||!$m(r,c[c.length-1]))&&c.push(jm(l)),(u.length===1||!$m(r,u[0]))&&u.unshift(jm(l))}f=o.source,p=o.target,t.canConnect(f,r,o)&&(n.reconnectEnd(o,r,c||S),d=o),t.canConnect(r,p,o)&&(d?h=n.connect(r,p,{type:o.type,waypoints:u}):(n.reconnectStart(o,r,u||S),h=o));var x=[].concat(d&&He(g,function(w){return w.source===d.source})||[],h&&He(m,function(w){return w.target===h.target})||[]);x.length&&n.removeElements(x)}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=Pe(c),l={x:u.x+s.x,y:u.y+s.y},f=ft(o.children,function(p){var d=t.canInsert(a,p);return d&&Bl(p.waypoints,l)});f&&(r.targetFlow=f,r.position=l)}},!0),this.postExecuted("elements.move",function(r){var o=r.shapes,a=r.targetFlow,s=r.position;a&&i(o[0],a,s)},!0),this.preExecute("shape.create",function(r){var o=r.parent,a=r.shape;t.canInsert(a,o)&&(r.targetFlow=o,r.parent=o.parent)},!0),this.postExecuted("shape.create",function(r){var o=r.shape,a=r.targetFlow,s=r.position;a&&i(o,a,s)},!0)}se($l,Q),$l.$inject=["eventBus","bpmnRules","modeling"];function $m(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 jm(e){return N({},e)}function jl(e,t){Q.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)&&xo(r)){var c=[];v(o,"bpmn:EventBasedGateway")?c=a.incoming.filter(u=>u!==r&&xo(u)):c=a.incoming.filter(u=>u!==r&&xo(u)&&v(u.source,"bpmn:EventBasedGateway")),c.forEach(function(u){t.removeConnection(u)})}}),this.preExecuted("shape.replace",function(n){var i=n.context,r=i.newShape;if(v(r,"bpmn:EventBasedGateway")){var o=r.outgoing.filter(xo).reduce(function(a,s){return a.includes(s.target)?a:a.concat(s.target)},[]);o.forEach(function(a){a.incoming.filter(xo).forEach(function(s){const c=a.incoming.filter(xo).filter(function(u){return u.source===r});(s.source!==r||c.length>1)&&t.removeConnection(s)})})}})}jl.$inject=["eventBus","modeling"],se(jl,Q);function xo(e){return v(e,"bpmn:SequenceFlow")}var Ks=1500,Fm=2e3;function Hm(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"],Ks,function(i){var r=i.context,o=r.shape||i.shape,a=i.hover;v(a,"bpmn:Lane")&&!Fe(o,["bpmn:Lane","bpmn:Participant"])&&(i.hover=Wn(a),i.hoverGfx=e.getGraphics(i.hover));var s=n.getRootElement();a&&a!==s&&(o.labelTarget||Fe(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"],Ks,function(i){var r=i.hover;v(r,"bpmn:Lane")&&(i.hover=Wn(r)||r,i.hoverGfx=e.getGraphics(i.hover))}),t.on(["bendpoint.move.hover"],Ks,function(i){var r=i.context,o=i.hover,a=r.type;v(o,"bpmn:Lane")&&/reconnect/.test(a)&&(i.hover=Wn(o)||o,i.hoverGfx=e.getGraphics(i.hover))}),t.on(["connect.start"],Ks,function(i){var r=i.context,o=r.start;v(o,"bpmn:Lane")&&(r.start=Wn(o)||o)}),t.on("shape.move.start",Fm,function(i){var r=i.shape;v(r,"bpmn:Lane")&&(i.shape=Wn(r)||r)}),t.on("spaceTool.move",Fm,function(i){var r=i.hover;r&&v(r,"bpmn:Lane")&&(i.hover=Wn(r))})}Hm.$inject=["elementRegistry","eventBus","canvas"];var zm=770;function Fl(e,t,n,i){n.invoke(Q,this);function r(s,c){var u=ee(s),l=c.categoryValue||u.categoryValueRef;l||(l=Am(e,u));var f=c.category||l.$parent||Pm(e);u.categoryValueRef=l,l.$parent=f,c.categoryValue=l,c.category=f}function o(s,c){var u=ee(s),l=c.categoryValue||u.categoryValueRef,f=c.category||l&&l.$parent;l&&(c.categoryValue=l,c.category=f,u.categoryValueRef=null)}this.execute("label.create",function(s){var c=s.context,u=c.labelTarget;v(u,"bpmn:Group")&&r(u,c)}),this.revert("label.create",function(s){var c=s.context,u=c.labelTarget;v(u,"bpmn:Group")&&o(u,c)}),this.execute("shape.delete",function(s){var c=s.context,u=c.shape,l=ee(u);if(!(!v(u,"bpmn:Group")||u.labelTarget)){var f=c.categoryValue=l.categoryValueRef;f&&(c.category=f.$parent,l.categoryValueRef=null)}}),this.reverted("shape.delete",function(s){var c=s.context,u=c.shape;if(!(!v(u,"bpmn:Group")||u.labelTarget)){var l=c.category,f=c.categoryValue,p=ee(u);f&&(p.categoryValueRef=f,f.$parent=l)}}),this.execute("shape.create",function(s){var c=s.context,u=c.shape,l=c.hints||{};!v(u,"bpmn:Group")||u.labelTarget||l.createElementsBehavior===!1&&!ee(u).categoryValueRef&&!c.categoryValue||r(u,c)}),this.reverted("shape.create",function(s){var c=s.context,u=c.shape,l=c.hints||{};!v(u,"bpmn:Group")||u.labelTarget||l.createElementsBehavior===!1&&!ee(u).categoryValueRef&&!c.categoryValue||o(u,c)}),this.executed(["shape.move","shape.resize"],function(s){var c=s.context,u=c.shape;!v(u,"bpmn:Group")||u.labelTarget||ee(u).categoryValueRef||r(u,c)}),this.reverted(["shape.move","shape.resize"],function(s){var c=s.context,u=c.shape;!v(u,"bpmn:Group")||u.labelTarget||!c.categoryValue||o(u,c)});function a(s,c){var u=e.create(s.$type);return i.copyElement(s,u,null,c)}t.on("copyPaste.copyElement",zm,function(s){var c=s.descriptor,u=s.element;if(!(!v(u,"bpmn:Group")||u.labelTarget)){var l=ee(u);if(l.categoryValueRef){var f=l.categoryValueRef;c.categoryValue=a(f,!0),f.$parent&&(c.category=a(f.$parent,!0))}}}),t.on("copyPaste.pasteElement",zm,function(s){var c=s.descriptor,u=c.businessObject,l=c.categoryValue,f=c.category;l&&(l=u.categoryValueRef=a(l)),f&&(l.$parent=a(f)),delete c.category,delete c.categoryValue})}Fl.$inject=["bpmnFactory","eventBus","injector","moddleCopy"],se(Fl,Q);function Hl(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 Gm(e){function t(i,r,o){var a={x:o.x,y:o.y-50},s={x:o.x-50,y:o.y},c=Hl(i,r,o,a),u=Hl(i,r,o,s),l;c&&u?Vm(c,o)>Vm(u,o)?l=u:l=c:l=c||u,i.original=l}function n(i){var r=i.waypoints;t(r[0],r[1],Pe(i.source)),t(r[r.length-1],r[r.length-2],Pe(i.target))}e.on("bpmnElement.added",function(i){var r=i.element;r.waypoints&&n(r)})}Gm.$inject=["eventBus"];function Vm(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function zl(e){Q.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=ee(i),o=Qe(i);if(Fe(r,t)){var a=o.get("isHorizontal");a===void 0&&(a=!0),o.set("isHorizontal",a)}})}zl.$inject=["eventBus"],se(zl,Q);function Wm(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}function Um(e){return Math.atan((e[1].y-e[0].y)/(e[1].x-e[0].x))}function QR(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 JR(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 Gl(e,t){var n=t[0],i=t[1],r={x:i.x-n.x,y:i.y-n.y},o=JR([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 qm(e,t){var n=Gl(e,t),i={x:n.x-e.x,y:n.y-e.y};return Wm(i)}function fa(e,t){return Wm({x:e.x-t.x,y:e.y-t.y})}var Ym=Math.sqrt,Km=Math.min,eC=Math.max,Xm=Math.abs;function Zm(e){return Math.pow(e,2)}function da(e,t){return Ym(Zm(e.x-t.x)+Zm(e.y-t.y))}function tC(e,t){var n=0,i,r,o,a,s,c,u,l,f,p,d;for(n=0;n<t.length-1;n++){if(i=t[n],r=t[n+1],Jm(i,r)?u=[i]:(o=da(e,i),a=da(e,r),c=Km(o,a),u=nC(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:Jm(i,u[0])?n:n+1}),u.length===2&&(s=rC(u[0],u[1]),l={type:"segment",position:s,segmentIndex:n,relativeLocation:da(i,s)/da(i,r)}),f=da(l.position,e),(!d||p>f)&&(d=l,p=f)}return d}function nC(e,t,n,i){var r=t.x-e.x,o=t.y-e.y,a=n.x-e.x,s=n.y-e.y,c=r*r+o*o,u=r*a+o*s,l=a*a+s*s-i*i,f=u/c,p=l/c,d=f*f-p;if(d<0&&d>-1e-6&&(d=0),d<0)return[];var h=Ym(d),m=-f+h,g=-f-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(x){return iC(x,e,t)})}function iC(e,t,n){return Qm(e.x,t.x,n.x)&&Qm(e.y,t.y,n.y)}function Qm(e,t,n){return e>=Km(t,n)-Xs&&e<=eC(t,n)+Xs}function rC(e,t){return{x:(e.x+t.x)/2,y:(e.y+t.y)/2}}var Xs=.1;function Jm(e,t){return Xm(e.x-t.x)<=Xs&&Xm(e.y-t.y)<=Xs}function oC(e,t,n,i){var r=n.segmentIndex,o=t.length-e.length;if(i.segmentMove){var a=i.segmentMove.segmentStartIndex,s=i.segmentMove.newSegmentStartIndex;return r===a?s:r>=s?r+o<s?s:r+o:r}if(i.bendpointMove){var c=i.bendpointMove.insert,u=i.bendpointMove.bendpointIndex,l;if(o===0)return r;if(r>=u&&(l=c?r+1:r-1),r<u&&(l=r,c&&n.type!=="bendpoint"&&u-1===r)){var f=tg(t,u);f<n.relativeLocation&&l++}return l}return o===0?r:i.connectionStart&&r===0?0:i.connectionEnd&&r===e.length-2?t.length-2:Math.floor((t.length-2)/2)}function eg(e,t,n,i){var r=0,o=0,a={point:e,delta:{x:0,y:0}},s=tC(e,n),c=s.segmentIndex,u=oC(n,t,s,i);if(u<0||u>t.length-2||u===null)return a;var l=ng(n,c),f=ng(t,u),p=s.position,d=sC(l,p),h=aC(l,f);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=tg(n,g))}var x={x:(f[1].x-f[0].x)*d+f[0].x,y:(f[1].y-f[0].y)*d+f[0].y},w=QR({x:e.x-p.x,y:e.y-p.y},h);return r=x.x+w.x-e.x,o=x.y+w.y-e.y,{point:Oi(x),delta:Oi({x:r,y:o})}}function tg(e,t){var n=fa(e[t-1],e[t]),i=fa(e[t],e[t+1]),r=n/(n+i);return r}function aC(e,t){var n=Um(e),i=Um(t);return i-n}function ng(e,t){return[e[t],e[t+1]]}function sC(e,t){var n=fa(e[0],e[1]),i=fa(e[0],t);return n===0?0:i/n}function cC(e,t,n,i){var r=Pe(e);return eg(r,t,n,i).delta}function ha(e,t,n){var i=ua(t),r=ua(n),o=ri(e,i),a={x:o.x*(n.width/t.width),y:o.y*(n.height/t.height)};return Oi({x:r.x+a.x,y:r.y+a.y})}function ig(e,t,n){var i=ua(e),r=ua(t),o=ua(n),a=ri(e,i),s=ri(i,r),c=uC(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 Oi({x:l.x+a.x-e.x,y:l.y+a.y-e.y})}function uC(e,t,n){var i=be(t),r=be(n);if(lC(i,r))return null;var o=en(t,e),a,s,c;if(o==="top")a={x:0,y:r.bottom-i.bottom};else if(o==="bottom")a={x:0,y:r.top-i.top};else if(o==="right")a={x:r.left-i.left,y:0};else if(o==="left")a={x:r.right-i.right,y:0};else return null;return s={x:e.x+a.x,y:e.y+a.y},c=en(n,s),c!==o?null:a}function lC(e,t){return pC(e,t)||fC(e,t)}function pC(e,t){return e.right!==t.right&&e.left!==t.left}function fC(e,t){return e.top!==t.top&&e.bottom!==t.bottom}var rg="name",og="text";function Vl(e,t,n,i){Q.call(this,e),this.postExecute("element.updateProperties",r),this.postExecute("element.updateModdleProperties",a=>{ee(a.context.element)===a.context.moddleElement&&r(a)});function r(a){var s=a.context,c=s.element,u=s.properties;if(rg in u&&t.updateLabel(c,u[rg]),og in u&&v(c,"bpmn:TextAnnotation")){var l=i.getTextAnnotationBounds({x:c.x,y:c.y,width:c.width,height:c.height},u[og]||"");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;$e(u)||!or(u)||$n(u)&&t.updateLabel(u,$n(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=N({},s.hints),f=s.newWaypoints||c.waypoints,p=s.oldWaypoints;return typeof l.startChanged>"u"&&(l.startChanged=!!l.connectionStart),typeof l.endChanged>"u"&&(l.endChanged=!!l.connectionEnd),cC(u,f,p,l)}this.postExecute(["connection.layout","connection.updateWaypoints"],function(a){var s=a.context,c=s.hints||{};if(c.labelBehavior!==!1){var u=s.connection,l=u.label,f;!l||!l.parent||(f=o(a),t.moveShape(l,f))}}),this.postExecute(["shape.replace"],function(a){var s=a.context,c=s.newShape,u=s.oldShape,l=ee(c);l&&or(l)&&u.label&&c.label&&(c.label.x=u.label.x,c.label.y=u.label.y)}),this.preExecute("shape.resize",function(a){var s=a.context,c=s.shape,u=s.hints||{};if(!(!$e(c)||u.autoResize)){var l=s.newBounds,f=i.getDimensions($n(c)||"",{box:l,style:i.getExternalStyle()}),p=Math.ceil(f.height),d=l.y!==c.y,h=c.y+c.height;s.newBounds={width:l.width,height:p,x:l.x,y:d?h-p:l.y}}}),this.postExecute("shape.resize",function(a){var s=a.context,c=s.shape,u=s.newBounds,l=s.oldBounds;if(Ds(c)){var f=c.label,p=Pe(f),d=mC(l),h=hC(p,d),m=dC(h,l,u);t.moveShape(f,m)}})}se(Vl,Q),Vl.$inject=["eventBus","modeling","bpmnFactory","textRenderer"];function dC(e,t,n){var i=ha(e,t,n);return Oi(ri(i,e))}function hC(e,t){if(t.length){var n=gC(e,t);return Gl(e,n)}}function mC(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 gC(e,t){var n=t.map(function(r){return{line:r,distance:qm(e,r)}}),i=ai(n,"distance");return i[0].line}function yC(e,t,n,i){return eg(e,t,n,i).point}function Wl(e,t){Q.call(this,e);function n(i,r){var o=i.context,a=o.connection,s=N({},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),yC(r,c,u,s)}this.postExecute(["connection.layout","connection.updateWaypoints"],function(i){var r=i.context,o=r.connection,a=o.outgoing,s=o.incoming;s.forEach(function(c){var u=c.waypoints[c.waypoints.length-1],l=n(i,u),f=[].concat(c.waypoints.slice(0,-1),[l]);t.updateWaypoints(c,f)}),a.forEach(function(c){var u=c.waypoints[0],l=n(i,u),f=[].concat([l],c.waypoints.slice(1));t.updateWaypoints(c,f)})}),this.postExecute(["connection.move"],function(i){var r=i.context,o=r.connection,a=o.outgoing,s=o.incoming,c=r.delta;s.forEach(function(u){var l=u.waypoints[u.waypoints.length-1],f={x:l.x+c.x,y:l.y+c.y},p=[].concat(u.waypoints.slice(0,-1),[f]);t.updateWaypoints(u,p)}),a.forEach(function(u){var l=u.waypoints[0],f={x:l.x+c.x,y:l.y+c.y},p=[].concat([f],u.waypoints.slice(1));t.updateWaypoints(u,p)})})}se(Wl,Q),Wl.$inject=["eventBus","modeling"];function Zs(e,t,n){var i=Js(e),r=sg(i,t),o=i[0];return r.length?r[r.length-1]:ha(o.original||o,n,t)}function Qs(e,t,n){var i=Js(e),r=sg(i,t),o=i[i.length-1];return r.length?r[0]:ha(o.original||o,n,t)}function Ul(e,t,n){var i=Js(e),r=ag(t,n),o=i[0];return ha(o.original||o,r,t)}function ql(e,t,n){var i=Js(e),r=ag(t,n),o=i[i.length-1];return ha(o.original||o,r,t)}function ag(e,t){return{x:e.x-t.x,y:e.y-t.y,width:e.width,height:e.height}}function Js(e){var t=e.waypoints;if(!t.length)throw new Error("connection#"+e.id+": no waypoints");return t}function sg(e,t){var n=cn(e,_C);return He(n,function(i){return vC(i,t)})}function vC(e,t){return en(t,e,1)==="intersect"}function _C(e){return e.original||e}function Yl(e,t){Q.call(this,e),this.postExecute("shape.replace",function(n){var i=n.oldShape,r=n.newShape;if(bC(i,r)){var o=xC(i);o.incoming.forEach(function(a){var s=Qs(a,r,i);t.reconnectEnd(a,r,s)}),o.outgoing.forEach(function(a){var s=Zs(a,r,i);t.reconnectStart(a,r,s)})}},!0)}Yl.$inject=["eventBus","modeling"],se(Yl,Q);function bC(e,t){return v(e,"bpmn:Participant")&&Ve(e)&&v(t,"bpmn:Participant")&&!Ve(t)}function xC(e){var t=Jo([e]),n=[],i=[];return t.forEach(function(r){r!==e&&(r.incoming.forEach(function(o){v(o,"bpmn:MessageFlow")&&n.push(o)}),r.outgoing.forEach(function(o){v(o,"bpmn:MessageFlow")&&i.push(o)}))},[]),{incoming:n,outgoing:i}}const wC=["bpmn:MessageEventDefinition","bpmn:TimerEventDefinition","bpmn:EscalationEventDefinition","bpmn:ConditionalEventDefinition","bpmn:SignalEventDefinition"];function cg(e){const t=ee(e);if(!v(t,"bpmn:BoundaryEvent")&&!(v(t,"bpmn:StartEvent")&&fn(t.$parent)))return!1;const n=t.get("eventDefinitions");return!n||!n.length?!1:wC.some(i=>v(n[0],i))}function ug(e){return v(e,"bpmn:BoundaryEvent")?"cancelActivity":"isInterrupting"}function Kl(e,t){e.invoke(Q,this),this.postExecuted("shape.replace",function(n){const i=n.context.oldShape,r=n.context.newShape,o=n.context.hints;if(!cg(r))return;const a=ug(r);if(o.targetElement&&o.targetElement[a]!==void 0)return;const c=ee(i).get(a),u=ee(r).get(a);c!==u&&t.updateProperties(r,{[a]:c})})}Kl.$inject=["injector","modeling"],se(Kl,Q);function Xl(e,t){Q.call(this,e),this.preExecute("shape.resize",function(n){var i=n.shape,r=Qe(i),o=r&&r.get("label"),a=o&&o.get("bounds");a&&t.updateModdleProperties(i,o,{bounds:void 0})},!0)}se(Xl,Q),Xl.$inject=["eventBus","modeling"];function Zl(e,t,n){Q.call(this,e),this.preExecute("shape.delete",function(i){var r=i.context.shape;if(!(r.incoming.length!==1||r.outgoing.length!==1)){var o=r.incoming[0],a=r.outgoing[0];if(!(!v(o,"bpmn:SequenceFlow")||!v(a,"bpmn:SequenceFlow"))&&t.canConnect(o.source,a.target,o)){var s=EC(o.waypoints,a.waypoints);n.reconnectEnd(o,a.target,s)}}})}se(Zl,Q),Zl.$inject=["eventBus","bpmnRules","modeling"];function wo(e){return e.original||e}function EC(e,t){var n=Hl(wo(e[e.length-2]),wo(e[e.length-1]),wo(t[1]),wo(t[0]));return n?[].concat(e.slice(0,e.length-1),[n],t.slice(1)):[wo(e[0]),wo(t[t.length-1])]}function Ql(e,t){Q.call(this,e),this.preExecute("shape.delete",function(n){var i=n.shape,r=i.parent;v(i,"bpmn:Participant")&&(n.collaborationRoot=r)},!0),this.postExecute("shape.delete",function(n){var i=n.collaborationRoot;if(i&&!i.businessObject.participants.length){var r=t.makeProcess(),o=i.children.slice();t.moveElements(o,{x:0,y:0},r)}},!0)}Ql.$inject=["eventBus","modeling"],se(Ql,Q);function Jl(e,t,n,i){Q.call(this,e);var r=i.get("dragging",!1);function o(c){var u=c.source,l=c.target,f=c.parent;if(f){var p,d;v(c,"bpmn:SequenceFlow")&&(n.canConnectSequenceFlow(u,l)||(d=!0),n.canConnectMessageFlow(u,l)&&(p="bpmn:MessageFlow")),v(c,"bpmn:MessageFlow")&&(n.canConnectMessageFlow(u,l)||(d=!0),n.canConnectSequenceFlow(u,l)&&(p="bpmn:SequenceFlow")),d&&t.removeConnection(c),p&&t.connect(u,l,{type:p,waypoints:c.waypoints.slice()})}}function a(c){var u=c.context,l=u.connection,f=u.newSource||l.source,p=u.newTarget||l.target,d,h;d=n.canConnect(f,p),!(!d||d.type===l.type)&&(h=t.connect(f,p,{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(),f=l&&l.payload.previousSelection,p;!f||!f.length||(p=f.indexOf(c),p!==-1&&f.splice(p,1,u))}this.postExecuted("elements.move",function(c){var u=c.closure,l=u.allConnections;k(l,o)},!0),this.preExecute("connection.reconnect",a),this.postExecuted("element.updateProperties",function(c){var u=c.context,l=u.properties,f=u.element,p=f.businessObject,d;l.default&&(d=ft(f.outgoing,ro({id:f.businessObject.default.id})),d&&t.updateProperties(d,{conditionExpression:void 0})),l.conditionExpression&&p.sourceRef.default===p&&t.updateProperties(f.source,{default:void 0})})}se(Jl,Q),Jl.$inject=["eventBus","modeling","bpmnRules","injector"];function ec(e,t,n,i,r,o){i.invoke(Q,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=Rn(u,function(f,p){var d=t.canReplace([p],p.host||p.parent||c);return d?f.concat(d.replacements):f},[]);l.length&&this._replaceElements(u,l)},this),this.postExecuted(["elements.move"],500,function(a){var s=a.context,c=s.newParent,u=s.newHost,l=[];k(s.closure.topLevel,function(p){fn(p)?l=l.concat(p.children):l=l.concat(p)}),l.length===1&&u&&(c=u);var f=t.canReplace(l,c);f&&this._replaceElements(l,f.replacements,u)},this),this.postExecute(["shape.replace"],1500,function(a){var s=a.context,c=s.oldShape,u=s.newShape,l=c.attachers,f;l&&l.length&&(f=t.canReplace(l,u),this._replaceElements(l,f.replacements))},this),this.postExecuted(["shape.replace"],1500,function(a){var s=a.context,c=s.oldShape,u=s.newShape;r.unclaimId(c.businessObject.id,c.businessObject),r.updateProperties(u,{id:c.id})})}se(ec,Q),ec.prototype._replaceElements=function(e,t){var n=this._elementRegistry,i=this._bpmnReplace,r=this._selection;k(t,function(o){var a={type:o.newElementType},s=n.get(o.oldElementId),c=e.indexOf(s);e[c]=i.replaceElement(s,a,{select:!1})}),t&&r.select(e)},ec.$inject=["bpmnReplace","bpmnRules","elementRegistry","injector","modeling","selection"];var SC=1500,RC={width:140,height:120},ep={width:300,height:60},tp={width:60,height:300},tc={width:300,height:150},nc={width:150,height:300},lg={width:140,height:120},pg={width:100,height:40};function fg(e){e.on("resize.start",SC,function(t){var n=t.context,i=n.shape,r=n.direction,o=n.balanced;(v(i,"bpmn:Lane")||v(i,"bpmn:Participant"))&&(n.resizeConstraints=MC(i,r,o)),v(i,"bpmn:SubProcess")&&Ve(i)&&(n.minDimensions=lg),v(i,"bpmn:TextAnnotation")&&(n.minDimensions=pg)})}fg.$inject=["eventBus"];var cr=Math.abs,CC=Math.min,PC=Math.max;function dg(e,t,n,i){var r=e[t];e[t]=r===void 0?n:i(n,r)}function Eo(e,t,n){return dg(e,t,n,CC)}function So(e,t,n){return dg(e,t,n,PC)}var AC={top:20,left:50,right:20,bottom:20},TC={top:50,left:20,right:20,bottom:20};function MC(e,t,n){var i=Wn(e),r=!0,o=!0,a=Us(i,[i]),s=be(e),c={},u={},l=Yt(e),f=l?ep:tp;/n/.test(t)?u.top=s.bottom-f.height:/e/.test(t)?u.right=s.left+f.width:/s/.test(t)?u.bottom=s.top+f.height:/w/.test(t)&&(u.left=s.right-f.width),a.forEach(function(h){var m=be(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&&cr(s.top-m.bottom)<10&&So(c,"top",m.top+f.height),cr(s.top-m.top)<5&&Eo(u,"top",m.bottom-f.height)),/e/.test(t)&&(n&&cr(s.right-m.left)<10&&Eo(c,"right",m.right-f.width),cr(s.right-m.right)<5&&So(u,"right",m.left+f.width)),/s/.test(t)&&(n&&cr(s.bottom-m.top)<10&&Eo(c,"bottom",m.bottom-f.height),cr(s.bottom-m.bottom)<5&&So(u,"bottom",m.top+f.height)),/w/.test(t)&&(n&&cr(s.left-m.right)<10&&So(c,"left",m.left+f.width),cr(s.left-m.left)<5&&Eo(u,"left",m.right-f.width))});var p=i.children.filter(function(h){return!h.hidden&&!h.waypoints&&(v(h,"bpmn:FlowElement")||v(h,"bpmn:Artifact"))}),d=l?AC:TC;return p.forEach(function(h){var m=be(h);/n/.test(t)&&(!l||r)&&Eo(u,"top",m.top-d.top),/e/.test(t)&&(l||o)&&So(u,"right",m.right+d.right),/s/.test(t)&&(!l||o)&&So(u,"bottom",m.bottom+d.bottom),/w/.test(t)&&(l||r)&&Eo(u,"left",m.left-d.left)}),{min:u,max:c}}function hg(e){!e||typeof e.stopPropagation!="function"||e.stopPropagation()}function Ro(e){return e.originalEvent||e.srcEvent}function np(e){hg(e),hg(Ro(e))}function $r(e){return e.pointers&&e.pointers.length&&(e=e.pointers[0]),e.touches&&e.touches.length&&(e=e.touches[0]),e?{x:e.clientX,y:e.clientY}:null}function mg(){return/mac/i.test(navigator.platform)}function gg(e,t){return(Ro(e)||e).button===t}function ur(e){return gg(e,0)}function kC(e){return gg(e,1)}function ma(e){var t=Ro(e)||e;return ur(e)?mg()?t.metaKey:t.ctrlKey:!1}function ic(e){var t=Ro(e)||e;return ur(e)&&t.shiftKey}var yg=1001;function vg(e,t){e.on("resize.start",yg+500,function(n){var i=n.context,r=i.shape;(v(r,"bpmn:Lane")||v(r,"bpmn:Participant"))&&(i.balanced=!ma(n))}),e.on("resize.end",yg,function(n){var i=n.context,r=i.shape,o=i.canExecute,a=i.newBounds;if(v(r,"bpmn:Lane")||v(r,"bpmn:Participant"))return o&&(a=qh(a),t.resizeLane(r,a,i.balanced)),!1})}vg.$inject=["eventBus","modeling"];var OC=500;function ip(e,t,n,i,r){n.invoke(Q,this);function o(l){return Fe(l,["bpmn:ReceiveTask","bpmn:SendTask"])||DC(l,["bpmn:ErrorEventDefinition","bpmn:EscalationEventDefinition","bpmn:MessageEventDefinition","bpmn:SignalEventDefinition"])}function a(l){var f=e.getDefinitions(),p=f.get("rootElements");return!!ft(p,ro({id:l.id}))}function s(l){if(v(l,"bpmn:ErrorEventDefinition"))return"errorRef";if(v(l,"bpmn:EscalationEventDefinition"))return"escalationRef";if(v(l,"bpmn:MessageEventDefinition"))return"messageRef";if(v(l,"bpmn:SignalEventDefinition"))return"signalRef"}function c(l){if(Fe(l,["bpmn:ReceiveTask","bpmn:SendTask"]))return l.get("messageRef");var f=l.get("eventDefinitions"),p=f[0];return p.get(s(p))}function u(l,f){if(Fe(l,["bpmn:ReceiveTask","bpmn:SendTask"]))return l.set("messageRef",f);var p=l.get("eventDefinitions"),d=p[0];return d.set(s(d),f)}this.executed(["shape.create","element.updateProperties","element.updateModdleProperties"],function(l){var f=l.shape||l.element;if(o(f)){var p=ee(f),d=c(p),h;d&&!a(d)&&(h=e.getDefinitions().get("rootElements"),Tt(h,d),l.addedRootElement=d)}},!0),this.reverted(["shape.create","element.updateProperties","element.updateModdleProperties"],function(l){var f=l.addedRootElement;if(f){var p=e.getDefinitions().get("rootElements");Pt(p,f)}},!0),t.on("copyPaste.copyElement",function(l){var f=l.descriptor,p=l.element;if(!(p.labelTarget||!o(p))){var d=ee(p),h=c(d);h&&(f.referencedRootElement=h)}}),t.on("copyPaste.pasteElement",OC,function(l){var f=l.descriptor,p=f.businessObject,d=f.referencedRootElement;d&&(a(d)||(d=i.copyElement(d,r.create(d.$type))),u(p,d),delete f.referencedRootElement)})}ip.$inject=["bpmnjs","eventBus","injector","moddleCopy","bpmnFactory"],se(ip,Q);function DC(e,t){return Ce(t)||(t=[t]),Ui(t,function(n){return go(e,n)})}var _g=Math.max;function bg(e){e.on("spaceTool.getMinDimensions",function(t){var n=t.shapes,i=t.axis,r=t.start,o={};return k(n,function(a){var s=a.id;v(a,"bpmn:Participant")&&(o[s]=IC(a,i,r)),v(a,"bpmn:Lane")&&(o[s]=Yt(a)?ep:tp),v(a,"bpmn:SubProcess")&&Ve(a)&&(o[s]=lg),v(a,"bpmn:TextAnnotation")&&(o[s]=pg),v(a,"bpmn:Group")&&(o[s]=RC)}),o})}bg.$inject=["eventBus"];function LC(e){return e==="x"}function IC(e,t,n){var i=Yt(e);if(!$C(e))return i?tc:nc;var r=LC(t),o={};return r?i?o=tc:o={width:BC(e,n,r),height:nc.height}:i?o={width:tc.width,height:NC(e,n,r)}:o=nc,o}function NC(e,t,n){var i;return i=jC(e,t,n),_g(tc.height,i)}function BC(e,t,n){var i;return i=FC(e,t,n),_g(nc.width,i)}function $C(e){return!!sr(e).length}function jC(e,t,n){var i=sr(e),r;return r=rp(i,t,n),e.height-r.height+ep.height}function FC(e,t,n){var i=sr(e),r;return r=rp(i,t,n),e.width-r.width+tp.width}function rp(e,t,n){var i,r,o;for(i=0;i<e.length;i++)if(r=e[i],!n&&t>=r.y&&t<=r.y+r.height||n&&t>=r.x&&t<=r.x+r.width)return o=sr(r),o.length?rp(o,t,n):r}var xg="_plane";function wg(e){var t=e.id;return HC(t)}function yi(e){var t=e.id;return v(e,"bpmn:SubProcess")?Eg(t):t}function jr(e){return Eg(e)}function rc(e){var t=Qe(e);return v(t,"bpmndi:BPMNPlane")}function Eg(e){return e+xg}function HC(e){return e.replace(new RegExp(xg+"$"),"")}var Sg=400,zC=600,Rg={x:180,y:160};function Ni(e,t,n,i,r,o,a){Q.call(this,t),this._canvas=e,this._eventBus=t,this._modeling=n,this._elementFactory=i,this._bpmnFactory=r,this._bpmnjs=o,this._elementRegistry=a;var s=this;function c(f){return v(f,"bpmn:SubProcess")&&!Ve(f)}function u(f){var p=f.shape,d=f.newRootElement,h=ee(p);d=s._addDiagram(d||h),f.newRootElement=e.addRootElement(d)}function l(f){var p=f.shape,d=ee(p);s._removeDiagram(d);var h=f.newRootElement=a.get(yi(d));e.removeRootElement(h)}this.executed("shape.create",function(f){var p=f.shape;c(p)&&u(f)},!0),this.postExecuted("elements.create",function(f){var p=f.elements;k(p,function(d){if(c(d)){var h=a.get(yi(d));if(!(!h||!d.children||!d.children.length)){var m=Cg(d);s._showRecursively(m),s._moveChildrenToShape(m,h)}}})},!0),this.reverted("shape.create",function(f){var p=f.shape;c(p)&&l(f)},!0),this.preExecute("shape.delete",function(f){var p=f.shape;!v(p,"bpmn:SubProcess")||!Ve(p)||k(oa([p]),d=>{n.removeShape(d.annotation)})},!0),this.preExecuted("shape.delete",function(f){var p=f.shape;if(c(p)){var d=a.get(yi(p));d&&n.removeElements(d.children.slice())}},!0),this.executed("shape.delete",function(f){var p=f.shape;c(p)&&l(f)},!0),this.reverted("shape.delete",function(f){var p=f.shape;c(p)&&u(f)},!0),this.preExecuted("shape.replace",function(f){var p=f.oldShape,d=f.newShape;!c(p)||!c(d)||(f.oldRoot=e.removeRootElement(yi(p)))},!0),this.postExecuted("shape.replace",function(f){var p=f.newShape,d=f.oldRoot,h=e.findRoot(yi(p));if(!(!d||!h)){var m=d.children;n.moveElements(m,{x:0,y:0},h)}},!0),this.executed("element.updateProperties",function(f){var p=f.element;if(v(p,"bpmn:SubProcess")){var d=f.properties,h=f.oldProperties,m=h.id,g=d.id;if(m!==g){if(rc(p)){a.updateId(p,jr(g)),a.updateId(m,g);return}var S=a.get(jr(m));S&&a.updateId(jr(m),jr(g))}}},!0),this.reverted("element.updateProperties",function(f){var p=f.element;if(v(p,"bpmn:SubProcess")){var d=f.properties,h=f.oldProperties,m=h.id,g=d.id;if(m!==g){if(rc(p)){a.updateId(p,jr(m)),a.updateId(g,m);return}var S=a.get(jr(g));S&&a.updateId(S,jr(m))}}},!0),t.on("element.changed",function(f){var p=f.element;if(rc(p)){var d=p,h=a.get(wg(d));!h||h===d||t.fire("element.changed",{element:h})}}),this.executed("shape.toggleCollapse",Sg,function(f){var p=f.shape;v(p,"bpmn:SubProcess")&&(Ve(p)?l(f):(u(f),s._showRecursively(p.children)))},!0),this.reverted("shape.toggleCollapse",Sg,function(f){var p=f.shape;v(p,"bpmn:SubProcess")&&(Ve(p)?l(f):(u(f),s._showRecursively(p.children)))},!0),this.postExecuted("shape.toggleCollapse",zC,function(f){var p=f.shape;if(v(p,"bpmn:SubProcess")){var d=f.newRootElement;if(d)if(Ve(p))s._moveChildrenToShape(d.children.slice(),p),k(oa(p.children),m=>{n.moveShape(m.annotation,{x:0,y:0},p.parent),k(m.associations,g=>{n.moveConnection(g,{x:0,y:0},p.parent)})});else{s._disconnectSharedAnnotations(p);var h=Cg(p);s._moveChildrenToShape(h,d)}}},!0),t.on("copyPaste.createTree",function(f){var p=f.element,d=f.children;if(c(p)){var h=yi(p),m=a.get(h);m&&d.push.apply(d,m.children)}}),t.on("copyPaste.copyElement",function(f){var p=f.descriptor,d=f.element,h=f.elements,m=d.parent,g=v(Qe(m),"bpmndi:BPMNPlane");if(g){var S=wg(m),E=ft(h,function(x){return x.id===S});E&&(p.parent=E.id)}}),t.on("copyPaste.pasteElement",function(f){var p=f.descriptor;p.parent&&(c(p.parent)||p.parent.hidden)&&(p.hidden=!0)})}se(Ni,Q),Ni.prototype._moveChildrenToShape=function(e,t){var n=this._modeling;if(e.length){var i=e.filter(function(c){return!c.hidden});if(!i.length){n.moveElements(e,{x:0,y:0},t,{autoResize:!1});return}var r=Lt(i),o;if(!t.x)o={x:Rg.x-r.x,y:Rg.y-r.y};else{var a=Pe(t),s=Pe(r);o={x:a.x-s.x,y:a.y-s.y}}n.moveElements(e,o,t,{autoResize:!1})}},Ni.prototype._disconnectSharedAnnotations=function(e){var t=this._modeling,n=new Set(gm(e).map(i=>i.annotation));n.size&&k(oa(e.children),i=>{n.has(i.annotation)&&k(i.associations,r=>{t.removeConnection(r)})})},Ni.prototype._showRecursively=function(e,t){var n=this,i=[];return e.forEach(function(r){r.hidden=!!t,i=i.concat(r),r.children&&(i=i.concat(n._showRecursively(r.children,r.collapsed||t)))}),i},Ni.prototype._addDiagram=function(e){var t=this._bpmnjs,n=t.getDefinitions().diagrams;return e.businessObject||(e=this._createNewDiagram(e)),n.push(e.di.$parent),e},Ni.prototype._createNewDiagram=function(e){var t=this._bpmnFactory,n=this._elementFactory,i=t.create("bpmndi:BPMNPlane",{bpmnElement:e}),r=t.create("bpmndi:BPMNDiagram",{plane:i});i.$parent=r;var o=n.createRoot({id:yi(e),type:e.$type,di:i,businessObject:e,collapsed:!0});return o},Ni.prototype._removeDiagram=function(e){var t=this._bpmnjs,n=t.getDefinitions().diagrams,i=ft(n,function(r){return r.plane.bpmnElement.id===e.id});return n.splice(n.indexOf(i),1),i},Ni.$inject=["canvas","eventBus","modeling","elementFactory","bpmnFactory","bpmnjs","elementRegistry"];function GC(e){var t=[];return k(oa(e),n=>{t.push(n.annotation),t.push.apply(t,n.associations)}),t}function Cg(e){return e.children.slice().concat(GC(e.children)).concat(VC(e))}function VC(e){return ul(e.children||[]).reduce(function(t,n){return n.label&&n.label.parent!==e&&t.push(n.label),t},[])}function op(e,t){e.invoke(Q,this),this.postExecuted("shape.replace",function(n){var i=n.context.oldShape,r=n.context.newShape;if(!(!v(r,"bpmn:SubProcess")||v(r,"bpmn:AdHocSubProcess")||!(v(i,"bpmn:Task")||v(i,"bpmn:CallActivity"))||!Ve(r))){var o=WC(r);t.createShape({type:"bpmn:StartEvent"},o,r)}})}op.$inject=["injector","modeling"],se(op,Q);function WC(e){return{x:e.x+e.width/6,y:e.y+e.height/2}}function ap(e,t){Q.call(this,e),this.preExecute("connection.create",function(n){const{target:i}=n;v(i,"bpmn:TextAnnotation")&&(n.parent=i.parent)},!0),this.preExecute(["shape.create","shape.resize","elements.move"],function(n){const i=n.shapes||[n.shape];i.length===1&&v(i[0],"bpmn:TextAnnotation")&&(n.hints=n.hints||{},n.hints.autoResize=!1)},!0),this.preExecute("shape.resize",function(n){var i=n.context,r=i.shape,o=i.hints||{};if(!(!v(r,"bpmn:TextAnnotation")||o.autoResize)){var a=i.newBounds,s=t.getTextAnnotationBounds(a,$n(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}}})}se(ap,Q),ap.$inject=["eventBus","textRenderer"];function sp(e,t){Q.call(this,e),this.postExecuted("shape.toggleCollapse",1500,function(n){var i=n.shape;if(Ve(i))return;var r=Jo(i);r.forEach(function(a){var s=a.incoming.slice(),c=a.outgoing.slice();k(s,function(u){o(u,!0)}),k(c,function(u){o(u,!1)})});function o(a,s){r.indexOf(a.source)!==-1&&r.indexOf(a.target)!==-1||v(a,"bpmn:Association")&&(v(a.source,"bpmn:TextAnnotation")||v(a.target,"bpmn:TextAnnotation"))||(s?t.reconnectEnd(a,i,Pe(i)):t.reconnectStart(a,i,Pe(i)))}},!0)}se(sp,Q),sp.$inject=["eventBus","modeling"];var cp=500;function up(e,t,n){Q.call(this,e);function i(a){a.length&&a.forEach(function(s){s.type==="label"&&!s.businessObject.name&&(s.hidden=!0)})}function r(a,s){var c=a.children,u=s,l,f;return l=UC(c).concat([a]),f=Lm(l),f?(u.width=Math.max(f.width,u.width),u.height=Math.max(f.height,u.height),u.x=f.x+(f.width-u.width)/2,u.y=f.y+(f.height-u.height)/2):(u.x=a.x+(a.width-u.width)/2,u.y=a.y+(a.height-u.height)/2),u}function o(a,s){return{x:a.x+(a.width-s.width)/2,y:a.y+(a.height-s.height)/2,width:s.width,height:s.height}}this.executed(["shape.toggleCollapse"],cp,function(a){var s=a.context,c=s.shape;v(c,"bpmn:SubProcess")&&(c.collapsed?Qe(c).isExpanded=!1:(i(c.children),Qe(c).isExpanded=!0))}),this.reverted(["shape.toggleCollapse"],cp,function(a){var s=a.context,c=s.shape;c.collapsed?Qe(c).isExpanded=!1:Qe(c).isExpanded=!0}),this.postExecuted(["shape.toggleCollapse"],cp,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"})})}se(up,Q),up.$inject=["eventBus","elementFactory","modeling"];function UC(e){return e.filter(function(t){return!t.hidden})}function lp(e,t,n,i){t.invoke(Q,this),this.preExecute("shape.delete",function(r){var o=r.context,a=o.shape,s=a.businessObject;$e(a)||(v(a,"bpmn:Participant")&&Ve(a)&&n.ids.unclaim(s.processRef.id),i.unclaimId(s.id,s))}),this.preExecute("connection.delete",function(r){var o=r.context,a=o.connection,s=a.businessObject;i.unclaimId(s.id,s)}),this.preExecute("canvas.updateRoot",function(){var r=e.getRootElement(),o=r.businessObject;v(r,"bpmn:Collaboration")&&n.ids.unclaim(o.id)})}se(lp,Q),lp.$inject=["canvas","injector","moddle","modeling"];function pp(e,t){Q.call(this,e),this.preExecute("connection.delete",function(n){var i=n.context,r=i.connection,o=r.source;qC(r,o)&&t.updateProperties(o,{default:null})})}se(pp,Q),pp.$inject=["eventBus","modeling"];function qC(e,t){if(!v(e,"bpmn:SequenceFlow"))return!1;var n=ee(t),i=ee(e);return n.get("default")===i}var YC=500,KC=5e3,Pg=["shape.create","shape.delete","shape.move","shape.resize"],Ag=[...Pg,"spaceTool","lane.add","lane.resize","lane.split","elements.create","elements.delete","elements.move"];function fp(e,t){Q.call(this,e);var n;function i(){return n=n||new XC,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(Ag,KC,function(){i()}),this.postExecuted(Ag,YC,function(){o()}),this.preExecute(Pg,function(a){var s=a.context,c=s.shape,u=r();!c||c.labelTarget||(v(c,"bpmn:Lane")&&u.addLane(c),v(c,"bpmn:FlowNode")&&u.addFlowNode(c))})}fp.$inject=["eventBus","modeling"],se(fp,Q);function XC(){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 ZC=500,QC=5e3,Tg=["connection.create","connection.delete","connection.layout","connection.move","connection.reconnect","connection.updateWaypoints","shape.create","shape.delete","shape.move","shape.resize"],Mg=[...Tg,"elements.create","elements.delete","elements.move","label.create","spaceTool"];function dp(e,t){Q.call(this,e);var n;function i(){return n=n||new JC,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(Mg,QC,function(){i()}),this.postExecuted(Mg,ZC,function(){o()}),this.preExecute(Tg,function(a){var s=a.context.connection||a.context.shape,c=r();!s||s.labelTarget||(v(s,"bpmn:FlowElement")&&c.addFlowElement(s),v(s,"bpmn:Group")&&c.addGroup(s))}),this.preExecute("label.create",function(a){var s=a.context.labelTarget;v(s,"bpmn:Group")&&r().addGroup(s)})}dp.$inject=["eventBus","modeling"],se(dp,Q);function JC(){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 hp(e,t){Q.call(this,e),this.postExecuted("elements.create",function(n){const i=n.context,r=i.elements;for(const o of r)eP(o)&&!nP(o)&&t.updateProperties(o,{isForCompensation:void 0})})}se(hp,Q),hp.$inject=["eventBus","modeling"];function eP(e){const t=ee(e);return t&&t.isForCompensation}function tP(e){return e&&v(e,"bpmn:BoundaryEvent")&&go(e,"bpmn:CompensateEventDefinition")}function nP(e){return e.incoming.filter(n=>tP(n.source)).length>0}const iP={__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",wl],appendBehavior:["type",El],associationBehavior:["type",Rl],attachEventBehavior:["type",js],artifactBehavior:["type",Sl],boundaryEventBehavior:["type",Cl],categoryRootElementReferenceBehavior:["type",Pl],compensateBoundaryEventBehaviour:["type",Al],createBehavior:["type",Tl],createDataObjectBehavior:["type",Ml],createParticipantBehavior:["type",Dl],dataInputAssociationBehavior:["type",Ll],dataStoreBehavior:["type",Il],deleteLaneBehavior:["type",Nl],detachEventBehavior:["type",qs],dropOnFlowBehavior:["type",$l],eventBasedGatewayBehavior:["type",jl],fixHoverBehavior:["type",Hm],groupBehavior:["type",Fl],importDockingFix:["type",Gm],isHorizontalFix:["type",zl],labelBehavior:["type",Vl],layoutConnectionBehavior:["type",Wl],messageFlowBehavior:["type",Yl],nonInterruptingBehavior:["type",Kl],removeElementBehavior:["type",Zl],removeEmbeddedLabelBoundsBehavior:["type",Xl],removeParticipantBehavior:["type",Ql],replaceConnectionBehavior:["type",Jl],replaceElementBehaviour:["type",ec],resizeBehavior:["type",fg],resizeLaneBehavior:["type",vg],rootElementReferenceBehavior:["type",ip],spaceToolBehavior:["type",bg],subProcessPlaneBehavior:["type",Ni],subProcessStartEventBehavior:["type",op],textAnnotationBehavior:["type",ap],toggleCollapseConnectionBehaviour:["type",sp],toggleElementCollapseBehaviour:["type",up],unclaimIdBehavior:["type",lp],unsetDefaultFlowBehavior:["type",pp],updateFlowNodeRefsBehavior:["type",fp],updateCategoryValueRefsBehavior:["type",dp],setCompensationActivityAfterPasteBehavior:["type",hp]};function mp(e){this._commandStack=e.get("commandStack",!1)}mp.$inject=["injector"],mp.prototype.allowed=function(e,t){var n=!0,i=this._commandStack;return i&&(n=i.canExecute(e,t)),n===void 0?!0:n};const vi={__init__:["rules"],rules:["type",mp]};function Un(e){Q.call(this,e),this.init()}Un.$inject=["eventBus"],se(Un,Q),Un.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)})},Un.prototype.init=function(){};function kg(e,t){var n=en(e,t,-15);return n!=="intersect"?n:null}function nn(e){Un.call(this,e)}se(nn,Un),nn.$inject=["eventBus"],nn.prototype.init=function(){this.addRule("connection.start",function(e){var t=e.source;return rP(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 ac(t,n)}finally{r&&(n.parent=null)}}),this.addRule("connection.reconnect",function(e){var t=e.connection,n=e.source,i=e.target;return ac(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 Vg(t,n,i)}),this.addRule("elements.create",function(e){var t=e.elements,n=e.position,i=e.target;return ut(i)&&!sc(t,i)?!1:Pr(t,function(r){return ut(r)?ac(r.source,r.target,r):r.host?ga(r,r.host,null,n):_p(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 $g(a)&&!n.includes(a.host)})?!1:ga(n,t,null,i)||zg(n,t,i)||Gg(n,t)||sc(n,t)}),this.addRule("shape.create",function(e){return _p(e.shape,e.target,e.source,e.position)}),this.addRule("shape.attach",function(e){return ga(e.shape,e.target,null,e.position)}),this.addRule("element.copy",function(e){var t=e.element,n=e.elements;return Kg(n,t)})},nn.prototype.canConnectMessageFlow=qg,nn.prototype.canConnectSequenceFlow=Yg,nn.prototype.canConnectDataAssociation=bp,nn.prototype.canConnectAssociation=Wg,nn.prototype.canConnectCompensationAssociation=Ug,nn.prototype.canMove=Gg,nn.prototype.canAttach=ga,nn.prototype.canReplace=zg,nn.prototype.canDrop=Co,nn.prototype.canInsert=sc,nn.prototype.canCreate=_p,nn.prototype.canConnect=ac,nn.prototype.canResize=Vg,nn.prototype.canCopy=Kg;function rP(e){return gp(e)?null:Fe(e,["bpmn:FlowNode","bpmn:InteractionNode","bpmn:DataObjectReference","bpmn:DataStoreReference","bpmn:Group","bpmn:TextAnnotation"])}function gp(e){return!e||$e(e)}function Og(e){do{if(v(e,"bpmn:Process"))return ee(e);if(v(e,"bpmn:Participant"))return ee(e).processRef||ee(e)}while(e=e.parent)}function yp(e){return v(e,"bpmn:TextAnnotation")}function vp(e){return v(e,"bpmn:Group")&&!e.labelTarget}function Dg(e){return v(e,"bpmn:BoundaryEvent")&&_i(e,"bpmn:CompensateEventDefinition")}function oc(e){return ee(e).isForCompensation}function oP(e,t){var n=Og(e),i=Og(t);return n===i}function aP(e){return v(e,"bpmn:InteractionNode")&&!v(e,"bpmn:BoundaryEvent")&&(!v(e,"bpmn:Event")||v(e,"bpmn:ThrowEvent")&&Ng(e,"bpmn:MessageEventDefinition"))}function sP(e){return v(e,"bpmn:InteractionNode")&&!oc(e)&&(!v(e,"bpmn:Event")||v(e,"bpmn:CatchEvent")&&Ng(e,"bpmn:MessageEventDefinition"))&&!(v(e,"bpmn:BoundaryEvent")&&!_i(e,"bpmn:MessageEventDefinition"))}function Lg(e){for(var t=e;t=t.parent;){if(v(t,"bpmn:FlowElementsContainer"))return ee(t);if(v(t,"bpmn:Participant"))return ee(t).processRef}return null}function Ig(e,t){var n=Lg(e),i=Lg(t);return n===i}function _i(e,t){var n=ee(e);return!!ft(n.eventDefinitions||[],function(i){return v(i,t)})}function Ng(e,t){var n=ee(e);return(n.eventDefinitions||[]).every(function(i){return v(i,t)})}function cP(e){return v(e,"bpmn:FlowNode")&&!v(e,"bpmn:EndEvent")&&!fn(e)&&!(v(e,"bpmn:IntermediateThrowEvent")&&_i(e,"bpmn:LinkEventDefinition"))&&!Dg(e)&&!oc(e)}function uP(e){return v(e,"bpmn:FlowNode")&&!v(e,"bpmn:StartEvent")&&!v(e,"bpmn:BoundaryEvent")&&!fn(e)&&!(v(e,"bpmn:IntermediateCatchEvent")&&_i(e,"bpmn:LinkEventDefinition"))&&!oc(e)}function lP(e){return v(e,"bpmn:ReceiveTask")||v(e,"bpmn:IntermediateCatchEvent")&&(_i(e,"bpmn:MessageEventDefinition")||_i(e,"bpmn:TimerEventDefinition")||_i(e,"bpmn:ConditionalEventDefinition")||_i(e,"bpmn:SignalEventDefinition"))}function pP(e){for(var t=[];e;)e=e.parent,e&&t.push(e);return t}function Bg(e,t){var n=pP(t);return n.indexOf(e)!==-1}function ac(e,t,n){if(gp(e)||gp(t))return null;if(!v(n,"bpmn:DataAssociation")){if(qg(e,t))return{type:"bpmn:MessageFlow"};if(Yg(e,t))return{type:"bpmn:SequenceFlow"}}var i=bp(e,t);return i||(Ug(e,t)?{type:"bpmn:Association",associationDirection:"One"}:Wg(e,t)?{type:"bpmn:Association",associationDirection:"None"}:!1)}function Co(e,t){return $e(e)||vp(e)?!0:v(t,"bpmn:Participant")&&!Ve(t)?!1:v(e,"bpmn:Participant")?v(t,"bpmn:Process")||v(t,"bpmn:Collaboration"):Fe(e,["bpmn:DataInput","bpmn:DataOutput"])&&e.parent?t===e.parent:v(e,"bpmn:Lane")?v(t,"bpmn:Participant")||v(t,"bpmn:Lane"):v(e,"bpmn:BoundaryEvent")&&!fP(e)?!1:v(e,"bpmn:FlowElement")&&!v(e,"bpmn:DataStoreReference")?v(t,"bpmn:FlowElementsContainer")?Ve(t):Fe(t,["bpmn:Participant","bpmn:Lane"]):v(e,"bpmn:DataStoreReference")&&v(t,"bpmn:Collaboration")?Ui(ee(t).get("participants"),function(n){return!!n.get("processRef")}):Fe(e,["bpmn:Artifact","bpmn:DataAssociation","bpmn:DataStoreReference"])?Fe(t,["bpmn:Collaboration","bpmn:Lane","bpmn:Participant","bpmn:Process","bpmn:SubProcess"]):v(e,"bpmn:MessageFlow")?v(t,"bpmn:Collaboration")||e.source.parent==t||e.target.parent==t:!1}function fP(e){return ee(e).cancelActivity&&(jg(e)||Fg(e))}function $g(e){return!$e(e)&&v(e,"bpmn:BoundaryEvent")}function dP(e){return v(e,"bpmn:Lane")}function hP(e){return $g(e)||v(e,"bpmn:IntermediateThrowEvent")&&jg(e)?!0:v(e,"bpmn:IntermediateCatchEvent")&&Fg(e)}function jg(e){var t=ee(e);return t&&!(t.eventDefinitions&&t.eventDefinitions.length)}function Fg(e){return Hg(e,["bpmn:MessageEventDefinition","bpmn:TimerEventDefinition","bpmn:SignalEventDefinition","bpmn:ConditionalEventDefinition"])}function Hg(e,t){return t.some(function(n){return _i(e,n)})}function mP(e){return v(e,"bpmn:ReceiveTask")&&ft(e.incoming,function(t){return v(t.source,"bpmn:EventBasedGateway")})}function ga(e,t,n,i){if(Array.isArray(e)||(e=[e]),e.length!==1)return!1;var r=e[0];return $e(r)||!hP(r)||fn(t)||!v(t,"bpmn:Activity")||oc(t)||i&&!kg(i,t)||mP(t)?!1:"attach"}function zg(e,t,n){if(!t)return!1;var i={replacements:[]};return k(e,function(r){fn(t)||v(r,"bpmn:StartEvent")&&r.type!=="label"&&Co(r,t)&&(SS(r)||i.replacements.push({oldElementId:r.id,newElementType:"bpmn:StartEvent"}),(RS(r)||CS(r)||PS(r))&&i.replacements.push({oldElementId:r.id,newElementType:"bpmn:StartEvent"}),Hg(r,["bpmn:MessageEventDefinition","bpmn:TimerEventDefinition","bpmn:SignalEventDefinition","bpmn:ConditionalEventDefinition"])&&v(t,"bpmn:SubProcess")&&i.replacements.push({oldElementId:r.id,newElementType:"bpmn:StartEvent"})),v(t,"bpmn:Transaction")||_i(r,"bpmn:CancelEventDefinition")&&r.type!=="label"&&(v(r,"bpmn:EndEvent")&&Co(r,t)&&i.replacements.push({oldElementId:r.id,newElementType:"bpmn:EndEvent"}),v(r,"bpmn:BoundaryEvent")&&ga(r,t,null,n)&&i.replacements.push({oldElementId:r.id,newElementType:"bpmn:BoundaryEvent"}))}),i.replacements.length?i:!1}function Gg(e,t){return Ui(e,dP)?!1:t===void 0?!0:t===null?!1:e.every(function(n){return Co(n,t)})}function _p(e,t,n,i){return t?$e(e)||vp(e)?!0:Co(e,t)||sc(e,t):!1}function Vg(e,t,n){return v(e,"bpmn:SubProcess")?Ve(e)&&(!t||t.width>=100&&t.height>=80):v(e,"bpmn:Lane")||v(e,"bpmn:Participant")?!0:yp(e)?n?n==="e"||n==="w":!0:vp(e)?!0:$e(e)?n?n==="e"||n==="w":!0:!1}function gP(e,t){var n=yp(e),i=yp(t);return(n||i)&&n!==i}function Wg(e,t){return Bg(t,e)||Bg(e,t)?!1:gP(e,t)?!0:!!bp(e,t)}function Ug(e,t){return Ig(e,t)&&Dg(e)&&v(t,"bpmn:Activity")&&!vP(t,e)&&!fn(t)}function qg(e,t){return Zg(e)&&!Zg(t)?!1:aP(e)&&sP(t)&&!oP(e,t)}function Yg(e,t){return cP(e)&&uP(t)&&Ig(e,t)&&!(v(e,"bpmn:EventBasedGateway")&&!lP(t))}function bp(e,t){return Fe(e,["bpmn:DataObjectReference","bpmn:DataStoreReference"])&&Fe(t,["bpmn:Activity","bpmn:ThrowEvent"])?{type:"bpmn:DataInputAssociation"}:Fe(t,["bpmn:DataObjectReference","bpmn:DataStoreReference"])&&Fe(e,["bpmn:Activity","bpmn:CatchEvent"])?{type:"bpmn:DataOutputAssociation"}:!1}function sc(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:Fe(t,["bpmn:SequenceFlow","bpmn:MessageFlow"])&&!$e(t)&&v(e,"bpmn:FlowNode")&&!v(e,"bpmn:BoundaryEvent")&&Co(e,t.parent)}function xp(e,t){return e&&t&&e.indexOf(t)!==-1}function Kg(e,t){return $e(t)?!0:!(v(t,"bpmn:Lane")&&!xp(e,t.parent)||v(t,"bpmn:MessageFlow")&&!yP(e,t))}function yP(e,t){var n=Xg(t.source),i=Xg(t.target);return xp(e,n)&&xp(e,i)}function Xg(e){for(;e;e=e.parent)if(v(e,"bpmn:Participant"))return e;return null}function Zg(e){return _o(e,"bpmn:Process")||_o(e,"bpmn:Collaboration")}function vP(e,t){return e.attachers.includes(t)}const _P={__depends__:[vi],__init__:["bpmnRules"],bpmnRules:["type",nn]};var bP=2e3;function Qg(e,t){e.on("saveXML.start",bP,n);function n(){var i=t.getRootElements();k(i,function(r){var o=Qe(r),a,s;a=Jo([r]),a=He(a,function(c){return c!==r&&!c.labelTarget}),s=cn(a,Qe),o.set("planeElement",s)})}}Qg.$inject=["eventBus","canvas"];const xP={__init__:["bpmnDiOrdering"],bpmnDiOrdering:["type",Qg]};function cc(e){Q.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)})}cc.prototype.getOrdering=function(e,t){return null},se(cc,Q);function wp(e,t){cc.call(this,e);var n=[{type:"bpmn:SubProcess",order:{level:6}},{type:"bpmn:SequenceFlow",order:{level:9,containers:["bpmn:Participant","bpmn:FlowElementsContainer"]}},{type:"bpmn:DataAssociation",order:{level:9,containers:["bpmn:Collaboration","bpmn:FlowElementsContainer"]}},{type:"bpmn:TextAnnotation",order:{level:9}},{type:"bpmn:MessageFlow",order:{level:9,containers:["bpmn:Collaboration"]}},{type:"bpmn:Association",order:{level:6,containers:["bpmn:Participant","bpmn:FlowElementsContainer","bpmn:Collaboration"]}},{type:"bpmn:BoundaryEvent",order:{level:8}},{type:"bpmn:Group",order:{level:10,containers:["bpmn:Collaboration","bpmn:FlowElementsContainer"]}},{type:"bpmn:FlowElement",order:{level:5}},{type:"bpmn:Participant",order:{level:-2}},{type:"bpmn:Lane",order:{level:-1}}];function i(a){if(a.labelTarget)return{level:10};var s=ft(n,function(c){return Fe(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&&!Fe(u,c);)u=u.parent;if(!u)throw new Error(`no parent for <${a.id}> in <${s&&s.id}>`);return u}this.getOrdering=function(a,s){if(a.labelTarget||v(a,"bpmn:TextAnnotation"))return{parent:t.findRoot(s)||t.getRootElement(),index:-1};var c=r(a);c.containers&&(s=o(a,s,c.containers));var u=s.children.indexOf(a),l=Jf(s.children,function(f){return!a.labelTarget&&f.labelTarget?!1:c.level<r(f).level});return l!==-1&&u!==-1&&u<l&&(l-=1),{index:l,parent:s}}}wp.$inject=["eventBus","canvas"],se(wp,cc);const wP={__init__:["bpmnOrderingProvider"],bpmnOrderingProvider:["type",wp]};function ya(){}ya.prototype.get=function(){return this._data},ya.prototype.set=function(e){this._data=e},ya.prototype.clear=function(){var e=this._data;return delete this._data,e},ya.prototype.isEmpty=function(){return!this._data};const EP={clipboard:["type",ya]};var Jg=1500;function ey(e,t,n){var i=this,r=n.get("dragging",!1);function o(a){if(!a.hover){var s=a.originalEvent,c=i._findTargetGfx(s),u=c&&e.get(c);c&&u&&(a.stopPropagation(),r.hover({element:u,gfx:c}),r.move(s))}}r&&t.on("drag.start",function(a){t.once("drag.move",Jg,function(s){o(s)})}),(function(){var a,s;t.on("element.hover",function(c){a=c.gfx,s=c.element}),t.on("element.hover",Jg,function(c){s&&t.fire("element.out",{element:s,gfx:a})}),t.on("element.out",function(){a=null,s=null})})(),this._findTargetGfx=function(a){var s,c;if(a instanceof MouseEvent)return s=$r(a),c=document.elementFromPoint(s.x,s.y),SP(c)}}ey.$inject=["elementRegistry","eventBus","injector"];function SP(e){return Or(e,"svg, .djs-element",!0)}const RP={__init__:["hoverFix"],hoverFix:["type",ey]};function CP(e){return!0}function uc(e){return ur(e)||kC(e)}var ty=500;function ny(e,t,n){var i=this;function r(M,z,G){if(!s(M,z)){var $,V,he;G?V=t.getGraphics(G):($=z.delegateTarget||z.target,$&&(V=$,G=t.get(V))),!(!V||!G)&&(he=e.fire(M,{element:G,gfx:V,originalEvent:z}),he===!1&&(z.stopPropagation(),z.preventDefault()))}}var o={};function a(M){return o[M]}function s(M,z){var G=u[M]||ur;return!G(z)}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":CP,"element.mousedown":uc,"element.mouseup":uc,"element.click":uc,"element.dblclick":uc};function l(M,z,G){var $=c[M];if(!$)throw new Error("unmapped DOM event name <"+M+">");return r($,z,G)}var f="svg, .djs-element";function p(M,z,G,$){var V=o[G]=function(he){r(G,he)};$&&(u[G]=$),V.$delegate=Pn.bind(M,f,z,V)}function d(M,z,G){var $=a(G);$&&Pn.unbind(M,z,$.$delegate)}function h(M){k(c,function(z,G){p(M,G,z)})}function m(M){k(c,function(z,G){d(M,G,z)})}e.on("canvas.destroy",function(M){m(M.svg)}),e.on("canvas.init",function(M){h(M.svg)}),e.on(["shape.added","connection.added"],function(M){var z=M.element,G=M.gfx;e.fire("interactionEvents.createHit",{element:z,gfx:G})}),e.on(["shape.changed","connection.changed"],ty,function(M){var z=M.element,G=M.gfx;e.fire("interactionEvents.updateHit",{element:z,gfx:G})}),e.on("interactionEvents.createHit",ty,function(M){var z=M.element,G=M.gfx;i.createDefaultHit(z,G)}),e.on("interactionEvents.updateHit",function(M){var z=M.element,G=M.gfx;i.updateDefaultHit(z,G)});var g=C("djs-hit djs-hit-stroke"),S=C("djs-hit djs-hit-click-stroke"),E=C("djs-hit djs-hit-all"),x=C("djs-hit djs-hit-no-move"),w={all:E,"click-stroke":S,stroke:g,"no-move":x};function C(M,z){return z=N({stroke:"white",strokeWidth:15},z||{}),n.cls(M,["no-fill","no-border"],z)}function T(M,z){var G=w[z];if(!G)throw new Error("invalid hit type <"+z+">");return ce(M,G),M}function B(M,z){De(M,z)}this.removeHits=function(M){var z=bs(".djs-hit",M);k(z,zt)},this.createDefaultHit=function(M,z){var G=M.waypoints,$=M.isFrame,V;return G?this.createWaypointsHit(z,G):(V=$?"stroke":"all",this.createBoxHit(z,V,{width:M.width,height:M.height}))},this.createWaypointsHit=function(M,z){var G=Qo(z);return T(G,"stroke"),B(M,G),G},this.createBoxHit=function(M,z,G){G=N({x:0,y:0},G);var $=ye("rect");return T($,z),ce($,G),B(M,$),$},this.updateDefaultHit=function(M,z){var G=st(".djs-hit",z);if(G)return M.waypoints?cl(G,M.waypoints):ce(G,{width:M.width,height:M.height}),G},this.fire=r,this.triggerMouseEvent=l,this.mouseHandler=a,this.registerEvent=p,this.unregisterEvent=d}ny.$inject=["eventBus","elementRegistry","styles"];const lc={__init__:["interactionEvents"],interactionEvents:["type",ny]};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();Ce(e)||(e=e?[e]:[]);var i=this._canvas,r=i.getRootElement();e=e.filter(function(o){var a=i.findRoot(o);return r===a}),t?k(e,o=>{this._selectedElements.add(o)}):this._selectedElements=new Set(e),this._eventBus.fire("selection.changed",{oldSelection:n,newSelection:this.get()})};var iy="hover",ry="selected";function oy(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,iy)}),t.on("element.out",function(r){i(r.element,iy)}),t.on("selection.changed",function(r){function o(u){i(u,ry)}function a(u){n(u,ry)}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)})}oy.$inject=["canvas","eventBus"];function ay(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;Ce(u)?t.select(u):t.select(s.filter(PP))}}),e.on("connect.end",500,function(r){var o=r.context,a=o.connection;a&&t.select(a)}),e.on("shape.move.end",500,function(r){var o=r.previousSelection||[],a=i.get(r.context.shape.id),s=ft(o,function(c){return a.id===c.id});s||t.select(a)}),e.on("element.click",function(r){if(ur(r)){var o=r.element;o===n.getRootElement()&&(o=null);var a=t.isSelected(o),s=t.get().length>1,c=ic(r);if(a&&s)return c?t.deselect(o):t.select(o);a?t.deselect(o):t.select(o,c)}})}ay.$inject=["eventBus","selection","canvas","elementRegistry"];function PP(e){return!e.hidden}const qn={__init__:["selectionVisuals","selectionBehavior"],__depends__:[lc],selection:["type",Po],selectionVisuals:["type",oy],selectionBehavior:["type",ay]};var AP=/^djs-cursor-.*$/;function pc(e){var t=bt(document.body);t.removeMatching(AP),e&&t.add("djs-cursor-"+e)}function sy(){pc(null)}var TP=5e3;function cy(e,t){t=t||"element.click";function n(){return!1}return e.once(t,TP,n),function(){e.off(t,n)}}var MP=["c","C"],kP=["v","V"],OP=["d","D"],DP=["x","X"],LP=["y","Y"],uy=["z","Z"];function IP(e){return e.ctrlKey||e.metaKey||e.shiftKey||e.altKey}function Mn(e){return e.altKey?!1:e.ctrlKey||e.metaKey}function Gt(e,t){return e=Ce(e)?e:[e],e.indexOf(t.key)!==-1||e.indexOf(t.code)!==-1}function Ep(e){return e.shiftKey}function NP(e){return Mn(e)&&Gt(MP,e)}function BP(e){return Mn(e)&&Gt(kP,e)}function $P(e){return Mn(e)&&Gt(OP,e)}function jP(e){return Mn(e)&&Gt(DP,e)}function FP(e){return Mn(e)&&!Ep(e)&&Gt(uy,e)}function HP(e){return Mn(e)&&(Gt(LP,e)||Gt(uy,e)&&Ep(e))}var Ao=Math.round,ly="djs-drag-active";function Fr(e){e.preventDefault()}function zP(e){return typeof TouchEvent<"u"&&e instanceof TouchEvent}function GP(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}function py(e,t,n,i){var r={threshold:5,trapClick:!0},o;function a(x){var w=t.viewbox(),C=t._container.getBoundingClientRect();return{x:w.x+(x.x-C.left)/w.scale,y:w.y+(x.y-C.top)/w.scale}}function s(x,w){w=w||o;var C=e.createEvent(N({},w.payload,w.data,{isTouch:w.isTouch}));return e.fire("drag."+x,C)===!1?!1:e.fire(w.prefix+"."+x,C)}function c(x){var w=x.filter(function(C){return i.get(C.id)});w.length&&n.select(w)}function u(x,w){var C=o.payload,T=o.displacement,B=o.globalStart,M=$r(x),z=ri(M,B),G=o.localStart,$=a(M),V=ri($,G);if(!o.active&&(w||GP(z)>o.threshold)){if(N(C,{x:Ao(G.x+T.x),y:Ao(G.y+T.y),dx:0,dy:0},{originalEvent:x}),s("start")===!1)return g();o.active=!0,o.keepSelection||(C.previousSelection=n.get(),n.select(null)),o.cursor&&pc(o.cursor),t.addMarker(t.getRootElement(),ly)}np(x),o.active&&(N(C,{x:Ao($.x+T.x),y:Ao($.y+T.y),dx:Ao(V.x),dy:Ao(V.y)},{originalEvent:x}),s("move"))}function l(x){var w,C=!0;o.active&&(x&&(o.payload.originalEvent=x,np(x)),C=s("end")),C===!1&&s("rejected"),w=S(C!==!0),s("ended",w)}function f(x){Gt("Escape",x)&&(Fr(x),g())}function p(x){var w;o.active&&(w=cy(e),setTimeout(w,400),Fr(x)),l(x)}function d(x){u(x)}function h(x){var w=o.payload;w.hoverGfx=x.gfx,w.hover=x.element,s("hover")}function m(x){s("out");var w=o.payload;w.hoverGfx=null,w.hover=null}function g(x){var w;if(o){var C=o.active;C&&s("cancel"),w=S(x),C&&s("canceled",w)}}function S(x){var w,C;s("cleanup"),sy(),o.trapClick?C=p:C=l,Oe.unbind(document,"mousemove",u),Oe.unbind(document,"dragstart",Fr),Oe.unbind(document,"selectstart",Fr),Oe.unbind(document,"mousedown",C,!0),Oe.unbind(document,"mouseup",C,!0),Oe.unbind(document,"keyup",f),Oe.unbind(document,"touchstart",d,!0),Oe.unbind(document,"touchcancel",g,!0),Oe.unbind(document,"touchmove",u,!0),Oe.unbind(document,"touchend",l,!0),e.off("element.hover",h),e.off("element.out",m),t.removeMarker(t.getRootElement(),ly);var T=o.payload.previousSelection;return x!==!1&&T&&!n.get().length&&c(T),w=o,o=null,w}function E(x,w,C,T){o&&g(!1),typeof w=="string"&&(T=C,C=w,w=null),T=N({},r,T||{});var B=T.data||{},M,z,G,$,V;if(T.trapClick?$=p:$=l,x?(M=Ro(x)||x,z=$r(x),np(x),M.type==="dragstart"&&Fr(M)):(M=null,z={x:0,y:0}),G=a(z),w||(w=G),V=zP(M),o=N({prefix:C,data:B,payload:{},globalStart:z,displacement:ri(w,G),localStart:G,isTouch:V},T),T.manual||(V?(Oe.bind(document,"touchstart",d,!0),Oe.bind(document,"touchcancel",g,!0),Oe.bind(document,"touchmove",u,!0),Oe.bind(document,"touchend",l,!0)):(Oe.bind(document,"mousemove",u),Oe.bind(document,"dragstart",Fr),Oe.bind(document,"selectstart",Fr),Oe.bind(document,"mousedown",$,!0),Oe.bind(document,"mouseup",$,!0)),Oe.bind(document,"keyup",f),e.on("element.hover",h),e.on("element.out",m)),s("init")===!1)return g(),!1;T.autoActivate&&u(x,!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(x){N(r,x)}}py.$inject=["eventBus","canvas","selection","elementRegistry"];const Bi={__depends__:[RP,qn],dragging:["type",py]};function To(e){this._counter=0,this._prefix=(e?e+"-":"")+Math.floor(Math.random()*1e9)+"-"}To.prototype.next=function(){return this._prefix+ ++this._counter};const VP=new To("ps");var WP=["marker-start","marker-mid","marker-end"],UP=["circle","ellipse","line","path","polygon","polyline","path","rect"];function lr(e,t,n,i){this._elementRegistry=e,this._canvas=n,this._styles=i}lr.$inject=["elementRegistry","eventBus","canvas","styles"],lr.prototype.cleanUp=function(){console.warn("PreviewSupport#cleanUp is deprecated and will be removed in future versions. You do not need to manually clean up previews anymore. cf. https://github.com/bpmn-io/diagram-js/pull/906")},lr.prototype.getGfx=function(e){return this._elementRegistry.getGraphics(e)},lr.prototype.addDragger=function(e,t,n,i="djs-dragger"){n=n||this.getGfx(e);var r=Sh(n);return this._cloneMarkers(Ir(r),i),ce(r,this._styles.cls(i,[])),De(t,r),ce(r,"data-preview-support-element-id",e.id),r},lr.prototype.addFrame=function(e,t){var n=ye("rect",{class:"djs-resize-overlay",width:e.width,height:e.height,x:e.x,y:e.y});return De(t,n),ce(n,"data-preview-support-element-id",e.id),n},lr.prototype._cloneMarkers=function(e,t="djs-dragger",n=e){var i=this;e.childNodes&&e.childNodes.forEach(r=>{i._cloneMarkers(r,t,n)}),XP(e)&&WP.forEach(function(r){if(ce(e,r)){var o=qP(e,r,i._canvas.getContainer());o&&i._cloneMarker(n,e,o,r,t)}})},lr.prototype._cloneMarker=function(e,t,n,i,r="djs-dragger"){var o=[n.id,r,VP.next()].join("-"),a=st("marker#"+n.id,e);e=e||this._canvas._svg;var s=a||Sh(n);s.id=o,We(s).add(r);var c=st(":scope > defs",e);c||(c=ye("defs"),De(e,c)),De(c,s);var u=KP(s.id);ce(t,i,u)};function qP(e,t,n){var i=YP(ce(e,t));return st("marker#"+i,n||document)}function YP(e){return e.match(/url\(['"]?#([^'"]*)['"]?\)/)[1]}function KP(e){return"url(#"+e+")"}function XP(e){return UP.indexOf(e.nodeName)!==-1}const Mo={__init__:["previewSupport"],previewSupport:["type",lr]};var ZP="drop-ok",fy="drop-not-ok",dy="attach-ok",hy="new-parent",my="create",QP=2e3;function gy(e,t,n,i,r){function o(c,u,l,f,p){if(!u)return!1;c=He(c,function(E){var x=E.labelTarget;return!E.parent&&!($e(E)&&c.indexOf(x)!==-1)});var d=ft(c,function(E){return!ut(E)}),h=!1,m=!1,g=!1;vy(c)&&(h=r.allowed("shape.attach",{position:l,shape:d,target:u})),h||(vy(c)?g=r.allowed("shape.create",{position:l,shape:d,source:f,target:u}):g=r.allowed("elements.create",{elements:c,position:l,target:u}));var S=p.connectionTarget;return g||h?(d&&f&&(m=r.allowed("connection.create",{source:S===f?d:f,target:S===f?f:d,hints:{targetParent:u,targetAttach:h}})),{attach:h,connect:m}):g===null||h===null?null:!1}function a(c,u){[dy,ZP,fy,hy].forEach(function(l){l===u?e.addMarker(c,l):e.removeMarker(c,l)})}n.on(["create.move","create.hover"],function(c){var u=c.context,l=u.elements,f=c.hover,p=u.source,d=u.hints||{};if(!f){u.canExecute=!1,u.target=null;return}yy(c);var h={x:c.x,y:c.y},m=u.canExecute=f&&o(l,f,h,p,d);f&&m!==null&&(u.target=f,m&&m.attach?a(f,dy):a(f,m?hy:fy))}),n.on(["create.end","create.out","create.cleanup"],function(c){var u=c.hover;u&&a(u,null)}),n.on("create.end",function(c){var u=c.context,l=u.source,f=u.shape,p=u.elements,d=u.target,h=u.canExecute,m=h&&h.attach,g=h&&h.connect,S=u.hints||{};if(h===!1||!d)return!1;yy(c);var E={x:c.x,y:c.y};g?f=i.appendShape(l,f,E,d,{attach:m,connection:g===!0?{}:g,connectionTarget:S.connectionTarget}):(p=i.createElements(p,E,d,N({},S,{attach:m})),f=ft(p,function(x){return!ut(x)})),N(u,{elements:p,shape:f}),N(c,{elements:p,shape:f})});function s(){var c=t.context();c&&c.prefix===my&&t.cancel()}n.on("create.init",function(){n.on("elements.changed",s),n.once(["create.cancel","create.end"],QP,function(){n.off("elements.changed",s)})}),this.start=function(c,u,l){Ce(u)||(u=[u]);var f=ft(u,function(h){return!ut(h)});if(f){l=N({elements:u,hints:{},shape:f},l||{}),k(u,function(h){ke(h.x)||(h.x=0),ke(h.y)||(h.y=0)});var p=He(u,function(h){return!h.hidden}),d=Lt(p);k(u,function(h){ut(h)&&(h.waypoints=cn(h.waypoints,function(m){return{x:m.x-d.x-d.width/2,y:m.y-d.y-d.height/2}})),N(h,{x:h.x-d.x-d.width/2,y:h.y-d.y-d.height/2})}),t.init(c,my,{cursor:"grabbing",autoActivate:!0,data:{shape:f,elements:u,context:l}})}}}gy.$inject=["canvas","dragging","eventBus","modeling","rules"];function yy(e){var t=e.context,n=t.createConstraints;n&&(n.left&&(e.x=Math.max(e.x,n.left)),n.right&&(e.x=Math.min(e.x,n.right)),n.top&&(e.y=Math.max(e.y,n.top)),n.bottom&&(e.y=Math.min(e.y,n.bottom)))}function vy(e){return e&&e.length===1&&!ut(e[0])}var JP=750;function _y(e,t,n,i,r){function o(a){var s=ye("g");ce(s,r.cls("djs-drag-group",["no-events"]));var c=ye("g");return a.forEach(function(u){var l;u.hidden||(u.waypoints?(l=n._createContainer("connection",c),n.drawConnection(Ir(l),u)):(l=n._createContainer("shape",c),n.drawShape(Ir(l),u),tn(l,u.x,u.y)),i.addDragger(u,s,l))}),s}t.on("create.move",JP,function(a){var s=a.hover,c=a.context,u=c.elements,l=c.dragGroup;l||(l=c.dragGroup=o(u));var f;s?(l.parentNode||(f=e.getActiveLayer(),De(f,l)),tn(l,a.x,a.y)):zt(l)}),t.on("create.cleanup",function(a){var s=a.context,c=s.dragGroup;c&&zt(c)})}_y.$inject=["canvas","eventBus","graphicsFactory","previewSupport","styles"];const fc={__depends__:[Bi,Mo,vi,qn],__init__:["create","createPreview"],create:["type",gy],createPreview:["type",_y]};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||eA(0,0)};function eA(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 va={__init__:["mouse"],mouse:["type",Sp]};var by=2e3;function kn(e,t,n,i,r,o,a,s){this._canvas=e,this._create=t,this._elementFactory=i,this._eventBus=r,this._modeling=o,this._mouse=a,this._rules=s,r.on("copyPaste.copyElement",function(c){var u=c.descriptor,l=c.element,f=c.elementsSet;u.priority=1,u.id=l.id,f.has(l.parent)&&(u.parent=l.parent.id),tA(l)&&(u.priority=2,u.host=l.host.id),ut(l)&&(u.priority=3,u.source=l.source.id,u.target=l.target.id,u.waypoints=nA(l)),$e(l)&&(u.priority=4,u.labelTarget=l.labelTarget.id),k(["x","y","width","height"],function(p){ke(l[p])&&(u[p]=l[p])}),u.hidden=l.hidden,u.collapsed=l.collapsed}),r.on("copyPaste.elementsCopied",by,function(c){var u;((u=c.hints)==null?void 0:u.clip)!==!1&&n.set(c.tree)}),r.on("copyPaste.pasteElements",by,function(c){c.tree||(c.tree=n.get())}),r.on("copyPaste.pasteElements",function(c){var u=c.hints;N(u,{createElementsBehavior:!1})})}kn.$inject=["canvas","create","clipboard","elementFactory","eventBus","modeling","mouse","rules"],kn.prototype.copy=function(e,t={}){var n,i;return Ce(e)||(e=e?[e]:[]),n=this._eventBus.fire("copyPaste.canCopyElements",{elements:e}),n===!1?i={}:i=this.createTree(Ce(n)?n:e),this._eventBus.fire("copyPaste.elementsCopied",{elements:e,tree:i,hints:t}),i},kn.prototype.paste=function(e={}){var t=this._eventBus.createEvent({type:"copyPaste.pasteElements",hints:{},...e}),n=this._eventBus.fire(t);if(n!==!1){var i=t.tree;if(i){var r=t.hints,o=this._createElements(i);if(t.element&&t.point)return this._paste(o,t.element,t.point,r);this._create.start(this._mouse.getLastMoveEvent(),o,{hints:r})}}},kn.prototype.duplicate=function(e,t={}){var n=this.copy(e,{clip:!1});return this.paste({...t,tree:n})},kn.prototype.cut=function(e){var t=this.copy(e),n=this._getElementIdsFromTree(t),i=e.filter(function(r){return n[r.id]});return i.length>0&&this._modeling.removeElements(i),t},kn.prototype._getElementIdsFromTree=function(e){var t={};return k(e,function(n){k(n,function(i){i.id&&(t[i.id]=!0)})}),t},kn.prototype._paste=function(e,t,n,i){k(e,function(o){ke(o.x)||(o.x=0),ke(o.y)||(o.y=0)});var r=Lt(e);return k(e,function(o){ut(o)&&(o.waypoints=cn(o.waypoints,function(a){return{x:a.x-r.x-r.width/2,y:a.y-r.y-r.height/2}})),N(o,{x:o.x-r.x-r.width/2,y:o.y-r.y-r.height/2})}),this._modeling.createElements(e,n,t,N({},i))},kn.prototype._createElements=function(e){var t=this,n=this._eventBus,i={},r=[];return k(e,function(o,a){o=ai(o,"priority"),k(o,function(s){var c=N({},si(s,["priority"]));i[s.parent]?c.parent=i[s.parent]:delete c.parent,n.fire("copyPaste.pasteElement",{cache:i,descriptor:c});var u;if(ut(c)){c.source=i[s.source],c.target=i[s.target],u=i[s.id]=t.createConnection(c),r.push(u);return}if($e(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},kn.prototype.createConnection=function(e){var t=this._elementFactory.createConnection(si(e,["id"]));return t},kn.prototype.createLabel=function(e){var t=this._elementFactory.createLabel(si(e,["id"]));return t},kn.prototype.createShape=function(e){var t=this._elementFactory.createShape(si(e,["id"]));return t},kn.prototype.hasRelations=function(e,t,n){return n||(n=new Set(t)),!(ut(e)&&(!n.has(e.source)||!n.has(e.target))||$e(e)&&!n.has(e.labelTarget))},kn.prototype.createTree=function(e){var t=this._rules,n=this,i={},r=[],o=new Map,a=Ss(e);function s(f,p){return t.allowed("element.copy",{element:f,elements:p})}function c(f,p){var d=o.get(f);if(!d){var h={element:f,depth:p};r.push(h),o.set(f,h);return}if(d.depth<p){r=u(d,r);var m={element:d.element,depth:p};r.push(m),o.set(f,m)}}function u(f,p){var d=p.indexOf(f);return d!==-1&&p.splice(d,1),p}Lr(a,function(f,p,d){if($e(f))return;k(f.labels,function(g){c(g,d)});function h(g){g&&g.length&&k(g,function(S){k(S.labels,function(E){c(E,d)}),c(S,d)})}k([f.attachers,f.incoming,f.outgoing],h),c(f,d);var m=[];return f.children&&(m=f.children.slice()),n._eventBus.fire("copyPaste.createTree",{element:f,children:m}),m}),e=cn(r,function(f){return f.element});var l=new Set(e);return r=cn(r,function(f){return f.descriptor={},n._eventBus.fire("copyPaste.copyElement",{descriptor:f.descriptor,element:f.element,elements:e,elementsSet:l}),f}),r=ai(r,function(f){return f.descriptor.priority}),e=cn(r,function(f){return f.element}),k(r,function(f){var p=f.depth;if(!n.hasRelations(f.element,e,l)){wy(f.element,e),l.delete(f.element);return}if(!s(f.element,e)){wy(f.element,e),l.delete(f.element);return}i[p]||(i[p]=[]),i[p].push(f.descriptor)}),i};function tA(e){return!!e.host}function nA(e){return cn(e.waypoints,function(t){return t=xy(t),t.original&&(t.original=xy(t.original)),t})}function xy(e){return N({},e)}function wy(e,t){var n=t.indexOf(e);return n===-1?t:t.splice(n,1)}const iA={__depends__:[EP,fc,va,vi],__init__:["copyPaste"],copyPaste:["type",kn]};function Rp(e,t,n){Ce(n)||(n=[n]),k(n,function(i){Cr(e[i])||(t[i]=e[i])})}var Cp=750;function Ey(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,f=ee(l);if($e(l))return u;var p=u.businessObject=i(f,!0),d=u.di=i(Qe(l),!0);d.bpmnElement=p,Rp(p,u,"name"),Rp(d,u,"isExpanded"),f.default&&(u.default=f.default.id)});var r="-bpmn-js-refs";function o(c){return c[r]=c[r]||{}}function a(c,u){c[r]=u}function s(c,u,l){var f=ee(c);return c.default&&(l[c.default]={element:f,property:"default"}),c.host&&(ee(c).attachedToRef=ee(u[c.host])),si(l,Rn(l,function(p,d,h){var m=d.element,g=d.property;return h===c.id&&(m.set(g,f),p.push(c.id)),p},[]))}t.on("copyPaste.pasteElement",function(c){var u=c.cache,l=c.descriptor,f=l.businessObject,p=l.di;if($e(l)){l.businessObject=ee(u[l.labelTarget]),l.di=Qe(u[l.labelTarget]);return}f=l.businessObject=i(f),p=l.di=i(p),p.bpmnElement=f,Rp(l,f,["isExpanded","name"]),l.type=f.$type}),t.on("copyPaste.copyElement",Cp,function(c){var u=c.descriptor,l=c.element;if(v(l,"bpmn:Participant")){var f=ee(l);f.processRef&&(u.processRef=i(f.processRef,!0))}}),t.on("copyPaste.pasteElement",function(c){var u=c.descriptor,l=u.processRef;l&&(u.processRef=i(l))}),t.on("copyPaste.createTree",function(c){var u=c.element,l=c.children;v(u,"bpmn:SubProcess")&&k(oa(l),f=>{l.push(f.annotation)})}),t.on("copyPaste.pasteElement",Cp,function(c){var u=c.cache,l=c.descriptor;a(u,s(l,u,o(u)))})}Ey.$inject=["bpmnFactory","eventBus","moddleCopy"];const rA=["artifacts","dataInputAssociations","dataOutputAssociations","default","flowElements","lanes","incoming","outgoing","categoryValue"],oA=["errorRef","escalationRef","messageRef","signalRef","dataObjectRef"];function _a(e,t,n){this._bpmnFactory=t,this._eventBus=e,this._moddle=n,e.on("moddleCopy.canCopyProperties",i=>{const{propertyNames:r}=i;if(!(!r||!r.length))return ai(r,o=>o==="extensionElements")}),e.on("moddleCopy.canCopyProperty",i=>{const{parent:r,property:o,propertyName:a}=i,s=Ut(r)&&r.$descriptor;if(a&&oA.includes(a))return o;if(a&&rA.includes(a)||a&&s&&!ft(s.properties,ro({name:a})))return!1}),e.on("moddleCopy.canSetCopiedProperty",i=>{const{property:r}=i;if(v(r,"bpmn:ExtensionElements")&&(!r.values||!r.values.length))return!1})}_a.$inject=["eventBus","bpmnFactory","moddle"],_a.prototype.copyElement=function(e,t,n,i=!1){n&&!Ce(n)&&(n=[n]),n=n||Pp(e.$descriptor);const r=this._eventBus.fire("moddleCopy.canCopyProperties",{propertyNames:n,sourceElement:e,targetElement:t,clone:i});return r===!1||(Ce(r)&&(n=r),k(n,o=>{let a;Sn(e,o)&&(a=e.get(o));const s=this.copyProperty(a,t,o,i);!Ft(s)||this._eventBus.fire("moddleCopy.canSetCopiedProperty",{parent:t,property:s,propertyName:o})===!1||t.set(o,s)})),t},_a.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 Ut(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):Ce(e)?Rn(e,(a,s)=>{const c=this.copyProperty(s,t,n,i);return c?a.concat(c):a},[]):Ut(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},_a.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 Pp(e,t){return Rn(e.properties,(n,i)=>t&&i.default?n:n.concat(i.name),[])}const Sy={__depends__:[iA],__init__:["bpmnCopyPaste","moddleCopy"],bpmnCopyPaste:["type",Ey],moddleCopy:["type",_a]};var Ry=Math.round;function Ap(e,t){this._modeling=e,this._eventBus=t}Ap.$inject=["modeling","eventBus"],Ap.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=Ry(s+o/2),l=Ry(c+a/2),f=i.replaceShape(e,N({},t,{x:u,y:l,width:o,height:a}),n);return r.fire("replace.end",{element:e,newElement:f,hints:n}),f};function Cy(e,t){t.on("replace.end",500,function(n){const{newElement:i,hints:r={}}=n;r.select!==!1&&e.select(i)})}Cy.$inject=["selection","eventBus"];const aA={__init__:["replace","replaceSelectionBehavior"],replaceSelectionBehavior:["type",Cy],replace:["type",Ap]};function sA(e,t,n){Ce(n)||(n=[n]),k(n,function(i){Cr(e[i])||(t[i]=e[i])})}var cA=["cancelActivity","instantiate","eventGatewayType","triggeredByEvent","isInterrupting"];function uA(e,t){var n=e&&Sn(e,"collapsed")?e.collapsed:!Ve(e),i;return t&&(Sn(t,"collapsed")||Sn(t,"isExpanded"))?i=Sn(t,"collapsed")?t.collapsed:!t.isExpanded:i=n,n!==i}function Py(e,t,n,i,r,o){function a(s,c,u){u=u||{};var l=c.type,f=s.businessObject;if(dc(f)&&(l==="bpmn:SubProcess"||l==="bpmn:AdHocSubProcess")&&uA(s,c))return i.toggleCollapse(s),s;var p=e.create(l),d={type:l,businessObject:p};d.di={},l==="bpmn:ExclusiveGateway"&&(d.di.isMarkerVisible=!0),sA(s.di,d.di,["fill","stroke","background-color","border-color","color"]);var h=Pp(f.$descriptor),m=Pp(p.$descriptor,!0),g=lA(h,m);N(p,ii(c,cA));var S=He(g,function(w){return w==="eventDefinitions"?Ay(s,c.eventDefinitionType):w==="loopCharacteristics"?!fn(p):Sn(p,w)||w==="processRef"&&c.isExpanded===!1||w==="triggeredByEvent"?!1:w==="isForCompensation"?!fn(p):!0});if(p=n.copyElement(f,p,S),c.eventDefinitionType&&(Ay(p,c.eventDefinitionType)||(d.eventDefinitionType=c.eventDefinitionType,d.eventDefinitionAttrs=c.eventDefinitionAttrs)),v(f,"bpmn:Activity")){if(dc(f))d.isExpanded=Ve(s);else if(c&&Sn(c,"isExpanded")){d.isExpanded=c.isExpanded;var E=t.getDefaultSize(p,{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}Ve(s)&&!v(f,"bpmn:Task")&&d.isExpanded&&(d.width=s.width,d.height=s.height)}if(dc(f)&&!dc(p)&&(u.moveChildren=!1),v(f,"bpmn:Participant")){c.isExpanded===!0?p.processRef=e.create("bpmn:Process"):u.moveChildren=!1;var x=Yt(s);Qe(s).isHorizontal||(Qe(d).isHorizontal=x),d.width=x?s.width:t.getDefaultSize(d).width,d.height=x?t.getDefaultSize(d).height:s.height}return o.allowed("shape.resize",{shape:p})||(d.height=t.getDefaultSize(d).height,d.width=t.getDefaultSize(d).width),p.name=f.name,Fe(f,["bpmn:ExclusiveGateway","bpmn:InclusiveGateway","bpmn:Activity"])&&Fe(p,["bpmn:ExclusiveGateway","bpmn:InclusiveGateway","bpmn:Activity"])&&(p.default=f.default),c.host&&!v(f,"bpmn:BoundaryEvent")&&v(p,"bpmn:BoundaryEvent")&&(d.host=c.host),(d.type==="bpmn:DataStoreReference"||d.type==="bpmn:DataObjectReference")&&(d.x=s.x+(s.width-d.width)/2),r.replaceElement(s,d,{...u,targetElement:c})}this.replaceElement=a}Py.$inject=["bpmnFactory","elementFactory","moddleCopy","modeling","replace","rules"];function dc(e){return v(e,"bpmn:SubProcess")}function Ay(e,t){var n=ee(e);return t&&n.get("eventDefinitions").some(function(i){return v(i,t)})}function lA(e,t){return e.filter(function(n){return t.includes(n)})}const Ty={__depends__:[Sy,aA,qn],bpmnReplace:["type",Py]};var pA=250;function Hr(e){this._eventBus=e,this._tools=[],this._active=null}Hr.$inject=["eventBus"],Hr.prototype.registerTool=function(e,t){var n=this._tools;if(!t)throw new Error(`A tool has to be registered with it's "events"`);n.push(e),this.bindEvents(e,t)},Hr.prototype.isActive=function(e){return e&&this._active===e},Hr.prototype.length=function(e){return this._tools.length},Hr.prototype.setActive=function(e){var t=this._eventBus;this._active!==e&&(this._active=e,t.fire("tool-manager.update",{tool:e}))},Hr.prototype.bindEvents=function(e,t){var n=this._eventBus,i=[];n.on(t.tool+".init",function(r){var o=r.context;if(!o.reactivate&&this.isActive(e)){this.setActive(null);return}this.setActive(e)},this),k(t,function(r){i.push(r+".ended"),i.push(r+".canceled")}),n.on(i,pA,function(r){this._active&&(fA(r)||this.setActive(null))},this)};function fA(e){var t=e.originalEvent&&e.originalEvent.target;return t&&Or(t,'.group[data-group="tools"]')}const hc={__depends__:[Bi],__init__:["toolManager"],toolManager:["type",Hr]};function dA(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 hA(e,t){var n=[],i=new Set(e);k(t,function(o){i.add(o)});var r=new Set;return i.forEach(function(o){var a=o.incoming,s=o.outgoing;k(a.concat(s),function(c){var u=c.source,l=c.target;(i.has(u)||i.has(l))&&(r.has(c)||(r.add(c),n.push(c)))})}),n}function mA(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 Tp=Math.abs,gA=Math.round,$i={x:"width",y:"height"},My="crosshair",pr={n:"top",w:"left",s:"bottom",e:"right"},yA=1500,mc={n:"s",w:"e",s:"n",e:"w"},gc=20;function Yn(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",yA,function(c){var u=c.context,l=u.initialized;l||(l=u.initialized=s.init(c,u)),l&&Oy(c)}),n.on("spaceTool.end",function(c){var u=c.context,l=u.axis,f=u.direction,p=u.movingShapes,d=u.resizingShapes,h=u.start;if(u.initialized){Oy(c);var m={x:0,y:0};m[l]=gA(c["d"+l]),s.makeSpace(p,d,m,f,h),n.once("spaceTool.ended",function(g){s.activateSelection(g.originalEvent,!0,!0)})}})}Yn.$inject=["canvas","dragging","eventBus","modeling","rules","toolManager","mouse"],Yn.prototype.activateSelection=function(e,t,n){this._dragging.init(e,"spaceTool.selection",{autoActivate:t,cursor:My,data:{context:{reactivate:n}},trapClick:!1})},Yn.prototype.activateMakeSpace=function(e){this._dragging.init(e,"spaceTool",{autoActivate:!0,cursor:My,data:{context:{}}})},Yn.prototype.makeSpace=function(e,t,n,i,r){return this._modeling.createSpace(e,t,n,i,r)},Yn.prototype.init=function(e,t){var n=Tp(e.dx)>Tp(e.dy)?"x":"y",i=e["d"+n],r=e[n]-i;if(Tp(i)<5)return!1;i<0&&(i*=-1),ma(e)&&(i*=-1);var o=dA(n,i),a=this._canvas.getRootElement();!ic(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=vA(c,n,o,r,u);return N(t,c,{axis:n,direction:o,spaceToolConstraints:l,start:r}),pc("resize-"+(n==="x"?"ew":"ns")),!0},Yn.prototype.calculateAdjustments=function(e,t,n,i){var r=this._rules,o=[],a=[],s=new Set,c=new Set,u=[],l=[];function f(d){s.has(d)||(s.add(d),o.push(d));var h=d.label;h&&!s.has(h)&&(s.add(h),o.push(h))}function p(d){c.has(d)||(c.add(d),a.push(d))}return k(e,function(d){if(!(!d.parent||$e(d))){if(ut(d)){l.push(d);return}var h=d[t],m=h+d[$i[t]];if(_A(d)&&(n>0&&Pe(d)[t]>i||n<0&&Pe(d)[t]<i)){u.push(d);return}if(n>0&&h>i||n<0&&m<i){f(d);return}if(h<i&&m>i&&r.allowed("shape.resize",{shape:d})){p(d);return}}}),k(o,function(d){var h=d.attachers;h&&k(h,function(m){f(m)})}),k(u,function(d){var h=d.host;(s.has(h)||c.has(h))&&f(d)}),k(l,function(d){var h=d.source,m=d.target,g=d.label;(s.has(h)||c.has(h))&&(s.has(m)||c.has(m))&&g&&f(g)}),{movingShapes:o,resizingShapes:a}},Yn.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateSelection(e,!!e)},Yn.prototype.isActive=function(){var e=this._dragging.context();return e?/^spaceTool/.test(e.prefix):!1};function ky(e){return{top:e.top-gc,right:e.right+gc,bottom:e.bottom+gc,left:e.left-gc}}function Oy(e){var t=e.context,n=t.spaceToolConstraints;if(n){var i,r;ke(n.left)&&(i=Math.max(e.x,n.left),e.dx=e.dx+i-e.x,e.x=i),ke(n.right)&&(i=Math.min(e.x,n.right),e.dx=e.dx+i-e.x,e.x=i),ke(n.top)&&(r=Math.max(e.y,n.top),e.dy=e.dy+r-e.y,e.y=r),ke(n.bottom)&&(r=Math.min(e.y,n.bottom),e.dy=e.dy+r-e.y,e.y=r)}}function vA(e,t,n,i,r){var o=e.movingShapes,a=e.resizingShapes;if(a.length){var s={},c,u,l=new Set(o),f=new Set(a);return k(a,function(p){var d=p.attachers,h=p.children,m=be(p),g=He(h,function(V){return!ut(V)&&!$e(V)&&!l.has(V)&&!f.has(V)}),S=He(h,function(V){return!ut(V)&&!$e(V)&&l.has(V)}),E,x,w,C=[],T=[],B,M,z,G;g.length&&(x=ky(be(Lt(g))),E=i-m[pr[n]]+x[pr[n]],n==="n"?s.bottom=u=ke(u)?Math.min(u,E):E:n==="w"?s.right=u=ke(u)?Math.min(u,E):E:n==="s"?s.top=c=ke(c)?Math.max(c,E):E:n==="e"&&(s.left=c=ke(c)?Math.max(c,E):E)),S.length&&(w=ky(be(Lt(S))),E=i-w[pr[mc[n]]]+m[pr[mc[n]]],n==="n"?s.bottom=u=ke(u)?Math.min(u,E):E:n==="w"?s.right=u=ke(u)?Math.min(u,E):E:n==="s"?s.top=c=ke(c)?Math.max(c,E):E:n==="e"&&(s.left=c=ke(c)?Math.max(c,E):E)),d&&d.length&&(d.forEach(function(V){l.has(V)?C.push(V):T.push(V)}),C.length&&(B=be(Lt(C.map(Pe))),M=m[pr[mc[n]]]-(B[pr[mc[n]]]-i)),T.length&&(z=be(Lt(T.map(Pe))),G=z[pr[n]]-(m[pr[n]]-i)),n==="n"?(E=Math.min(M||1/0,G||1/0),s.bottom=u=ke(u)?Math.min(u,E):E):n==="w"?(E=Math.min(M||1/0,G||1/0),s.right=u=ke(u)?Math.min(u,E):E):n==="s"?(E=Math.max(M||-1/0,G||-1/0),s.top=c=ke(c)?Math.max(c,E):E):n==="e"&&(E=Math.max(M||-1/0,G||-1/0),s.left=c=ke(c)?Math.max(c,E):E));var $=r&&r[p.id];$&&(n==="n"?(E=i+p[$i[t]]-$[$i[t]],s.bottom=u=ke(u)?Math.min(u,E):E):n==="w"?(E=i+p[$i[t]]-$[$i[t]],s.right=u=ke(u)?Math.min(u,E):E):n==="s"?(E=i-p[$i[t]]+$[$i[t]],s.top=c=ke(c)?Math.max(c,E):E):n==="e"&&(E=i-p[$i[t]]+$[$i[t]],s.left=c=ke(c)?Math.max(c,E):E))}),s}}function _A(e){return!!e.host}var Mp="djs-dragging",Dy="djs-resizing",bA=250,yc=Math.max;function Ly(e,t,n,i,r){function o(a,s){k(a,function(c){r.addDragger(c,s),n.addMarker(c,Mp)})}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=ye("g");ce(l,i.cls("djs-crosshair-group",["no-events"])),De(s,l);var f=ye("path");ce(f,"d",u.x),We(f).add("djs-crosshair"),De(l,f);var p=ye("path");ce(p,"d",u.y),We(p).add("djs-crosshair"),De(l,p),c.crosshairGroup=l}),e.on("spaceTool.selection.move",function(a){var s=a.context.crosshairGroup;tn(s,a.x,a.y)}),e.on("spaceTool.selection.cleanup",function(a){var s=a.context,c=s.crosshairGroup;c&&zt(c)}),e.on("spaceTool.move",bA,function(a){var s=a.context,c=s.line,u=s.axis,l=s.movingShapes,f=s.resizingShapes;if(s.initialized){if(!s.dragGroup){var p=n.getLayer("space");c=ye("path"),ce(c,"d","M0,0 L0,0"),We(c).add("djs-crosshair"),De(p,c),s.line=c;var d=ye("g");ce(d,i.cls("djs-drag-group",["no-events"])),De(n.getActiveLayer(),d),o(l,d);var h=new Set(l);k(f,function(T){h.add(T)});var m=new Set,g=s.movingConnections=[];h.forEach(function(T){k(T.outgoing,function(B){m.has(B)||!ut(B)||!h.has(B.target)||(m.add(B),g.push(B))})}),o(g,d),s.dragGroup=d}if(!s.frameGroup){var S=ye("g");ce(S,i.cls("djs-frame-group",["no-events"])),De(n.getActiveLayer(),S);var E=[];k(f,function(T){var B=r.addFrame(T,S),M=B.getBBox();E.push({element:B,initialBounds:M}),n.addMarker(T,Dy)}),s.frameGroup=S,s.frames=E}var x={x:"M"+a.x+", -10000 L"+a.x+", 10000",y:"M -10000, "+a.y+" L 10000, "+a.y};ce(c,{d:x[u]});var w={x:"y",y:"x"},C={x:a.dx,y:a.dy};C[w[s.axis]]=0,tn(s.dragGroup,C.x,C.y),k(s.frames,function(T){var B=T.element,M=T.initialBounds,z,G;s.direction==="e"?ce(B,{width:yc(M.width+C.x,5)}):(z=yc(M.width-C.x,5),ce(B,{width:z,x:M.x+M.width-z})),s.direction==="s"?ce(B,{height:yc(M.height+C.y,5)}):(G=yc(M.height-C.y,5),ce(B,{height:G,y:M.y+M.height-G}))})}}),e.on("spaceTool.cleanup",function(a){var s=a.context,c=s.movingShapes,u=s.movingConnections,l=s.resizingShapes,f=s.line,p=s.dragGroup,d=s.frameGroup;k(c,function(h){n.removeMarker(h,Mp)}),k(u,function(h){n.removeMarker(h,Mp)}),p&&(zt(f),zt(p)),k(l,function(h){n.removeMarker(h,Dy)}),d&&zt(d)})}Ly.$inject=["eventBus","elementRegistry","canvas","styles","previewSupport"];const xA={__init__:["spaceToolPreview"],__depends__:[Bi,vi,hc,Mo,va],spaceTool:["type",Yn],spaceToolPreview:["type",Ly]};function vc(e,t){e.invoke(Yn,this),this._canvas=t}vc.$inject=["injector","canvas"],se(vc,Yn),vc.prototype.calculateAdjustments=function(e,t,n,i){var r=this._canvas.getRootElement(),o=e[0]===r?null:e[0],a=[];o&&(a=no(po(r.children.filter(u=>v(u,"bpmn:Artifact")),Lt(o))));const s=[...e,...a];var c=Yn.prototype.calculateAdjustments.call(this,s,t,n,i);return c.resizingShapes=c.resizingShapes.filter(function(u){return!(v(u,"bpmn:TextAnnotation")||wA(u)&&(t==="y"&&Yt(u)||t==="x"&&!Yt(u)))}),c};function wA(e){return v(e,"bpmn:Participant")&&!ee(e).processRef}const Iy={__depends__:[xA],spaceTool:["type",vc]};function Et(e,t){this._handlerMap={},this._stack=[],this._stackIdx=-1,this._currentExecution={actions:[],dirty:[],trigger:null},this._injector=t,this._eventBus=e,this._uid=1,e.on(["diagram.destroy","diagram.clear"],function(){this.clear(!1)},this)}Et.$inject=["eventBus","injector"],Et.prototype.execute=function(e,t){if(!e)throw new Error("command required");this._currentExecution.trigger="execute";const n={command:e,context:t};this._pushAction(n),this._internalExecute(n),this._popAction()},Et.prototype.canExecute=function(e,t){const n={command:e,context:t},i=this._getHandler(e);let r=this._fire(e,"canExecute",n);if(r===void 0){if(!i)return!1;i.canExecute&&(r=i.canExecute(t))}return r},Et.prototype.clear=function(e){this._stack.length=0,this._stackIdx=-1,e!==!1&&this._fire("changed",{trigger:"clear"})},Et.prototype.undo=function(){let e=this._getUndoAction(),t;if(e){for(this._currentExecution.trigger="undo",this._pushAction(e);e&&(this._internalUndo(e),t=this._getUndoAction(),!(!t||t.id!==e.id));)e=t;this._popAction()}},Et.prototype.redo=function(){let e=this._getRedoAction(),t;if(e){for(this._currentExecution.trigger="redo",this._pushAction(e);e&&(this._internalExecute(e,!0),t=this._getRedoAction(),!(!t||t.id!==e.id));)e=t;this._popAction()}},Et.prototype.register=function(e,t){this._setHandler(e,t)},Et.prototype.registerHandler=function(e,t){if(!e||!t)throw new Error("command and handlerCls must be defined");const n=this._injector.instantiate(t);this.register(e,n)},Et.prototype.canUndo=function(){return!!this._getUndoAction()},Et.prototype.canRedo=function(){return!!this._getRedoAction()},Et.prototype._getRedoAction=function(){return this._stack[this._stackIdx+1]},Et.prototype._getUndoAction=function(){return this._stack[this._stackIdx]},Et.prototype._internalUndo=function(e){const t=e.command,n=e.context,i=this._getHandler(t);this._atomicDo(()=>{this._fire(t,"revert",e),i.revert&&this._markDirty(i.revert(n)),this._revertedAction(e),this._fire(t,"reverted",e)})},Et.prototype._fire=function(e,t,n){arguments.length<3&&(n=t,t=null);const i=t?[e+"."+t,t]:[e];let r;n=this._eventBus.createEvent(n);for(const o of i)if(r=this._eventBus.fire("commandStack."+o,n),n.cancelBubble)break;return r},Et.prototype._createId=function(){return this._uid++},Et.prototype._atomicDo=function(e){const t=this._currentExecution;t.atomic=!0;try{e()}finally{t.atomic=!1}},Et.prototype._internalExecute=function(e,t){const n=e.command,i=e.context,r=this._getHandler(n);if(!r)throw new Error("no command handler registered for <"+n+">");this._pushAction(e),t||(this._fire(n,"preExecute",e),r.preExecute&&r.preExecute(i),this._fire(n,"preExecuted",e)),this._atomicDo(()=>{this._fire(n,"execute",e),r.execute&&this._markDirty(r.execute(i)),this._executedAction(e,t),this._fire(n,"executed",e)}),t||(this._fire(n,"postExecute",e),r.postExecute&&r.postExecute(i),this._fire(n,"postExecuted",e)),this._popAction()},Et.prototype._pushAction=function(e){const t=this._currentExecution,n=t.actions,i=n[0];if(t.atomic)throw new Error("illegal invocation in <execute> or <revert> phase (action: "+e.command+")");e.id||(e.id=i&&i.id||this._createId()),n.push(e)},Et.prototype._popAction=function(){const e=this._currentExecution,t=e.trigger,n=e.actions,i=e.dirty;n.pop(),n.length||(this._eventBus.fire("elements.changed",{elements:ed("id",i.reverse())}),i.length=0,this._fire("changed",{trigger:t}),e.trigger=null)},Et.prototype._markDirty=function(e){const t=this._currentExecution;e&&(e=Ce(e)?e:[e],t.dirty=t.dirty.concat(e))},Et.prototype._executedAction=function(e,t){const n=++this._stackIdx;t||this._stack.splice(n,this._stack.length,e)},Et.prototype._revertedAction=function(e){this._stackIdx--},Et.prototype._getHandler=function(e){return this._handlerMap[e]},Et.prototype._setHandler=function(e,t){if(!e||!t)throw new Error("command and handler required");if(this._handlerMap[e])throw new Error("overriding handler for command <"+e+">");this._handlerMap[e]=t};const EA={commandStack:["type",Et]};function fr(e,t){if(typeof t!="function")throw new Error("removeFn iterator must be a function");if(!e)return[];for(var n;n=e[0];)t(n);return e}var SA=250,Ny=1400;function kp(e,t,n){Q.call(this,t);var i=e.get("movePreview",!1);t.on("shape.move.start",Ny,function(r){var o=r.context,a=o.shapes,s=o.validatedShapes;o.shapes=By(a),o.validatedShapes=By(s)}),i&&t.on("shape.move.start",SA,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",Ny,function(r){var o=r.context,a=o.closure,s=a.enclosedElements,c=[];k(s,function(u){k(u.labels,function(l){s[l.id]||c.push(l)})}),a.addAll(c)}),this.preExecute(["connection.delete","shape.delete"],function(r){var o=r.context,a=o.connection||o.shape;fr(a.labels,function(s){n.removeShape(s,{nested:!0})})}),this.execute("shape.delete",function(r){var o=r.context,a=o.shape,s=a.labelTarget;s&&(o.labelTargetIndex=ll(s.labels,a),o.labelTarget=s,a.labelTarget=null)}),this.revert("shape.delete",function(r){var o=r.context,a=o.shape,s=o.labelTarget,c=o.labelTargetIndex;s&&(Tt(s.labels,a,c),a.labelTarget=s)})}se(kp,Q),kp.$inject=["injector","eventBus","modeling"];function By(e){var t=new Set(e);return He(e,function(n){return!t.has(n.labelTarget)})}const RA={__init__:["labelSupport"],labelSupport:["type",kp]};var CA=251,$y=1401,jy="attach-ok";function Op(e,t,n,i,r){Q.call(this,t);var o=e.get("movePreview",!1);t.on("shape.move.start",$y,function(a){var s=a.context,c=s.shapes,u=s.validatedShapes;s.shapes=PA(c),s.validatedShapes=AA(u)}),o&&t.on("shape.move.start",CA,function(a){var s=a.context,c=s.shapes,u=Dp(c);k(u,function(l){o.makeDraggable(s,l,!0),k(l.labels,function(f){o.makeDraggable(s,f,!0)})})}),o&&t.on("shape.move.start",function(a){var s=a.context,c=s.shapes;if(c.length===1){var u=c[0],l=u.host;l&&(n.addMarker(l,jy),t.once(["shape.move.out","shape.move.cleanup"],function(){n.removeMarker(l,jy)}))}}),this.preExecuted("elements.move",$y,function(a){var s=a.context,c=s.closure,u=s.shapes,l=Dp(u);k(l,function(f){c.add(f,c.topLevel[f.host.id])})}),this.postExecuted("elements.move",function(a){var s=a.context,c=s.shapes,u=s.newHost,l;u&&c.length!==1||(u?l=c:l=He(c,function(f){var p=f.host;return TA(f)&&!MA(c,p)}),k(l,function(f){r.updateAttachment(f,u)}))}),this.postExecuted("elements.move",function(a){var s=a.context.shapes;k(s,function(c){k(c.attachers,function(u){k(u.outgoing.slice(),function(l){var f=i.allowed("connection.reconnect",{connection:l,source:l.source,target:l.target});f||r.removeConnection(l)}),k(u.incoming.slice(),function(l){var f=i.allowed("connection.reconnect",{connection:l,source:l.source,target:l.target});f||r.removeConnection(l)})})})}),this.postExecute("shape.create",function(a){var s=a.context,c=s.shape,u=s.host;u&&r.updateAttachment(c,u)}),this.postExecute("shape.replace",function(a){var s=a.context,c=s.oldShape,u=s.newShape;fr(c.attachers,function(l){var f=i.allowed("elements.move",{target:u,shapes:[l]});f==="attach"?r.updateAttachment(l,u):r.removeShape(l)}),u.attachers.length&&k(u.attachers,function(l){var f=ig(l,c,u);r.moveShape(l,f,l.parent)})}),this.postExecute("shape.resize",function(a){var s=a.context,c=s.shape,u=s.oldBounds,l=s.newBounds,f=c.attachers,p=s.hints||{};p.attachSupport!==!1&&k(f,function(d){var h=ig(d,u,l);r.moveShape(d,h,d.parent),k(d.labels,function(m){r.moveShape(m,h,m.parent)})})}),this.preExecute("shape.delete",function(a){var s=a.context.shape;fr(s.attachers,function(c){r.removeShape(c)}),s.host&&r.updateAttachment(s,null)})}se(Op,Q),Op.$inject=["injector","eventBus","canvas","rules","modeling"];function Dp(e){return Au(cn(e,function(t){return t.attachers||[]}))}function PA(e){var t=Dp(e);return v0("id",e,t)}function AA(e){var t=io(e,"id");return He(e,function(n){for(;n;){if(n.host&&t[n.host.id])return!1;n=n.parent}return!0})}function TA(e){return!!e.host}function MA(e,t){return e.indexOf(t)!==-1}const kA={__depends__:[vi],__init__:["attachSupport"],attachSupport:["type",Op]};function Fy(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(Oh(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)})}Fy.$inject=["eventBus","canvas","elementRegistry","graphicsFactory"];const Lp={__init__:["changeSupport"],changeSupport:["type",Fy]};function Kn(e){this._model=e}Kn.$inject=["moddle"],Kn.prototype._needsId=function(e){return Fe(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"])},Kn.prototype._ensureId=function(e){if(e.id){this._model.ids.claim(e.id,e);return}var t;v(e,"bpmn:Activity")?t="Activity":v(e,"bpmn:Event")?t="Event":v(e,"bpmn:Gateway")?t="Gateway":Fe(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))},Kn.prototype.create=function(e,t){var n=this._model.create(e,t||{});return this._ensureId(n),n},Kn.prototype.createDiLabel=function(){return this.create("bpmndi:BPMNLabel",{bounds:this.createDiBounds()})},Kn.prototype.createDiShape=function(e,t){return this.create("bpmndi:BPMNShape",N({bpmnElement:e,bounds:this.createDiBounds()},t))},Kn.prototype.createDiBounds=function(e){return this.create("dc:Bounds",e)},Kn.prototype.createDiWaypoints=function(e){var t=this;return cn(e,function(n){return t.createDiWaypoint(n)})},Kn.prototype.createDiWaypoint=function(e){return this.create("dc:Point",ii(e,["x","y"]))},Kn.prototype.createDiEdge=function(e,t){return this.create("bpmndi:BPMNEdge",N({bpmnElement:e,waypoint:this.createDiWaypoints([])},t))},Kn.prototype.createDiPlane=function(e,t){return this.create("bpmndi:BPMNPlane",N({bpmnElement:e},t))};function On(e,t,n){Q.call(this,e),this._bpmnFactory=t;var i=this;function r(d){var h=d.context,m=h.hints||{},g;!h.cropped&&m.createElementsBehavior!==!1&&(g=h.connection,g.waypoints=n.getCroppedWaypoints(g),h.cropped=!0)}this.executed(["connection.layout","connection.create"],r),this.reverted(["connection.layout"],function(d){delete d.context.cropped});function o(d){var h=d.context;i.updateParent(h.shape||h.connection,h.oldParent)}function a(d){var h=d.context,m=h.shape||h.connection,g=h.parent||h.newParent;i.updateParent(m,g)}this.executed(["shape.move","shape.create","shape.delete","connection.create","connection.move","connection.delete"],Dn(o)),this.reverted(["shape.move","shape.create","shape.delete","connection.create","connection.move","connection.delete"],Dn(a));function s(d){var h=d.context,m=h.oldRoot,g=m.children;k(g,function(S){v(S,"bpmn:BaseElement")&&i.updateParent(S)})}this.executed(["canvas.updateRoot"],s),this.reverted(["canvas.updateRoot"],s);function c(d){var h=d.context.shape;v(h,"bpmn:BaseElement")&&i.updateBounds(h)}this.executed(["shape.move","shape.create","shape.resize"],Dn(function(d){d.context.shape.type!=="label"&&c(d)})),this.reverted(["shape.move","shape.create","shape.resize"],Dn(function(d){d.context.shape.type!=="label"&&c(d)})),e.on("shape.changed",function(d){d.element.type==="label"&&c({context:{shape:d.element}})});function u(d){i.updateConnection(d.context)}this.executed(["connection.create","connection.move","connection.delete","connection.reconnect"],Dn(u)),this.reverted(["connection.create","connection.move","connection.delete","connection.reconnect"],Dn(u));function l(d){i.updateConnectionWaypoints(d.context.connection)}this.executed(["connection.layout","connection.move","connection.updateWaypoints"],Dn(l)),this.reverted(["connection.layout","connection.move","connection.updateWaypoints"],Dn(l)),this.executed("connection.reconnect",Dn(function(d){var h=d.context,m=h.connection,g=h.oldSource,S=h.newSource,E=ee(m),x=ee(g),w=ee(S);E.conditionExpression&&!Fe(w,["bpmn:Activity","bpmn:ExclusiveGateway","bpmn:InclusiveGateway"])&&(h.oldConditionExpression=E.conditionExpression,delete E.conditionExpression),g!==S&&x.default===E&&(h.oldDefault=x.default,delete x.default)})),this.reverted("connection.reconnect",Dn(function(d){var h=d.context,m=h.connection,g=h.oldSource,S=h.newSource,E=ee(m),x=ee(g),w=ee(S);h.oldConditionExpression&&(E.conditionExpression=h.oldConditionExpression),h.oldDefault&&(x.default=h.oldDefault,delete w.default)}));function f(d){i.updateAttachment(d.context)}this.executed(["element.updateAttachment"],Dn(f)),this.reverted(["element.updateAttachment"],Dn(f)),this.executed("element.updateLabel",Dn(p)),this.reverted("element.updateLabel",Dn(p));function p(d){const{element:h}=d.context,m=$n(h),g=Qe(h),S=g&&g.get("label");or(h)||rc(h)||(m&&!S?g.set("label",t.create("bpmndi:BPMNLabel")):!m&&S&&g.set("label",void 0))}}se(On,Q),On.$inject=["eventBus","bpmnFactory","connectionDocking"],On.prototype.updateAttachment=function(e){var t=e.shape,n=t.businessObject,i=t.host;n.attachedToRef=i&&i.businessObject},On.prototype.updateParent=function(e,t){if(!$e(e)&&!(v(e,"bpmn:DataStoreReference")&&e.parent&&v(e.parent,"bpmn:Collaboration"))){var n=e.parent,i=e.businessObject,r=Qe(e),o=n&&n.businessObject,a=Qe(n);v(e,"bpmn:FlowNode")&&this.updateFlowNodeRefs(i,o,t&&t.businessObject),v(e,"bpmn:DataOutputAssociation")&&(e.source?o=e.source.businessObject:o=null),v(e,"bpmn:DataInputAssociation")&&(e.target?o=e.target.businessObject:o=null),this.updateSemanticParent(i,o),v(e,"bpmn:DataObjectReference")&&i.dataObjectRef&&this.updateSemanticParent(i.dataObjectRef,o),this.updateDiParent(r,a)}},On.prototype.updateBounds=function(e){var t=Qe(e),n=DA(e);if(n){var i=ri(n,t.get("bounds"));N(n,{x:e.x+i.x,y:e.y+i.y})}var r=$e(e)?this._getLabel(t):t,o=r.bounds;o||(o=this._bpmnFactory.createDiBounds(),r.set("bounds",o)),N(o,{x:e.x,y:e.y,width:e.width,height:e.height})},On.prototype.updateFlowNodeRefs=function(e,t,n){if(n!==t){var i,r;v(n,"bpmn:Lane")&&(i=n.get("flowNodeRef"),Pt(i,e)),v(t,"bpmn:Lane")&&(r=t.get("flowNodeRef"),Tt(r,e))}},On.prototype.updateDiConnection=function(e,t,n){var i=Qe(e),r=Qe(t),o=Qe(n);i.sourceElement&&i.sourceElement.bpmnElement!==ee(t)&&(i.sourceElement=t&&r),i.targetElement&&i.targetElement.bpmnElement!==ee(n)&&(i.targetElement=n&&o)},On.prototype.updateDiParent=function(e,t){if(t&&!v(t,"bpmndi:BPMNPlane")&&(t=t.$parent),e.$parent!==t){var n=(t||e.$parent).get("planeElement");t?(n.push(e),e.$parent=t):(Pt(n,e),e.$parent=null)}};function OA(e){for(;e&&!v(e,"bpmn:Definitions");)e=e.$parent;return e}On.prototype.getLaneSet=function(e){var t,n;return v(e,"bpmn:Lane")?(t=e.childLaneSet,t||(t=this._bpmnFactory.create("bpmn:LaneSet"),e.childLaneSet=t,t.$parent=e),t):(v(e,"bpmn:Participant")&&(e=e.processRef),n=e.get("laneSets"),t=n[0],t||(t=this._bpmnFactory.create("bpmn:LaneSet"),t.$parent=e,n.push(t)),t)},On.prototype.updateSemanticParent=function(e,t,n){var i;if(e.$parent!==t&&!((v(e,"bpmn:DataInput")||v(e,"bpmn:DataOutput"))&&(v(t,"bpmn:Participant")&&"processRef"in t&&(t=t.processRef),"ioSpecification"in t&&t.ioSpecification===e.$parent))){if(v(e,"bpmn:Lane"))t&&(t=this.getLaneSet(t)),i="lanes";else if(v(e,"bpmn:FlowElement")){if(t){if(v(t,"bpmn:Participant"))t=t.processRef;else if(v(t,"bpmn:Lane"))do t=t.$parent.$parent;while(v(t,"bpmn:Lane"))}i="flowElements"}else if(v(e,"bpmn:Artifact")){for(;t&&!v(t,"bpmn:Process")&&!v(t,"bpmn:SubProcess")&&!v(t,"bpmn:Collaboration");)if(v(t,"bpmn:Participant")){t=t.processRef;break}else t=t.$parent;i="artifacts"}else if(v(e,"bpmn:MessageFlow"))i="messageFlows";else if(v(e,"bpmn:Participant")){i="participants";var r=e.processRef,o;r&&(o=OA(e.$parent||t),e.$parent&&(Pt(o.get("rootElements"),r),r.$parent=null),t&&(Tt(o.get("rootElements"),r),r.$parent=o))}else v(e,"bpmn:DataOutputAssociation")?i="dataOutputAssociations":v(e,"bpmn:DataInputAssociation")&&(i="dataInputAssociations");if(!i)throw new Error(`no parent for <${e.id}> in <${t.id}>`);var a;if(e.$parent&&(a=e.$parent.get(i),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))}}},On.prototype.updateConnectionWaypoints=function(e){var t=Qe(e);t.set("waypoint",this._bpmnFactory.createDiWaypoints(e.waypoints))},On.prototype.updateConnection=function(e){var t=e.connection,n=ee(t),i=t.source,r=ee(i),o=t.target,a=ee(t.target),s;if(v(n,"bpmn:DataAssociation"))v(n,"bpmn:DataInputAssociation")?(n.get("sourceRef")[0]=r,s=e.parent||e.newParent||a,this.updateSemanticParent(n,a,s)):v(n,"bpmn:DataOutputAssociation")&&(s=e.parent||e.newParent||r,this.updateSemanticParent(n,r,s),n.targetRef=a);else{var c=v(n,"bpmn:SequenceFlow");n.sourceRef!==r&&(c&&(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)},On.prototype._getLabel=function(e){return e.label||(e.label=this._bpmnFactory.createDiLabel()),e.label};function Dn(e){return function(t){var n=t.context,i=n.shape||n.connection||n.element;v(i,"bpmn:BaseElement")&&e(t)}}function DA(e){if(v(e,"bpmn:Activity")){var t=Qe(e);if(t){var n=t.get("label");if(n)return n.get("bounds")}}}function dr(e,t){Di.call(this),this._bpmnFactory=e,this._moddle=t}se(dr,Di),dr.$inject=["bpmnFactory","moddle"],dr.prototype._baseCreate=Di.prototype.create,dr.prototype.create=function(e,t){if(e==="label"){var n=t.di||this._bpmnFactory.createDiLabel();return this._baseCreate(e,N({type:"label",di:n},Nr,t))}return this.createElement(e,t)},dr.prototype.createElement=function(e,t){t=N({},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(!IA(r)){var o=N({},r||{},{id:i.id+"_di"});e==="root"?r=this._bpmnFactory.createDiPlane(i,o):e==="connection"?r=this._bpmnFactory.createDiEdge(i,o):r=this._bpmnFactory.createDiShape(i,o)}v(i,"bpmn:Group")&&(t=N({isFrame:!0},t)),t=LA(i,t,["processRef","isInterrupting","associationDirection","isForCompensation"]),t.isExpanded&&(t=Ip(r,t,"isExpanded")),Fe(i,["bpmn:Lane","bpmn:Participant"])&&(t=Ip(r,t,"isHorizontal")),v(i,"bpmn:SubProcess")&&(t.collapsed=!Ve(i,r)),v(i,"bpmn:ExclusiveGateway")&&(Sn(r,"isMarkerVisible")?r.isMarkerVisible===void 0&&(r.isMarkerVisible=!1):r.isMarkerVisible=!0),Ft(t.triggeredByEvent)&&(i.triggeredByEvent=t.triggeredByEvent,delete t.triggeredByEvent),Ft(t.cancelActivity)&&(i.cancelActivity=t.cancelActivity,delete t.cancelActivity);var a,s;return t.eventDefinitionType&&(a=i.get("eventDefinitions")||[],s=this._bpmnFactory.create(t.eventDefinitionType,t.eventDefinitionAttrs),t.eventDefinitionType==="bpmn:ConditionalEventDefinition"&&(s.condition=this._bpmnFactory.create("bpmn:FormalExpression")),a.push(s),s.$parent=i,i.eventDefinitions=a,delete t.eventDefinitionType),n=this.getDefaultSize(i,r),t=N({id:i.id},n,t,{businessObject:i,di:r}),this._baseCreate(e,t)},dr.prototype.getDefaultSize=function(e,t){var n=ee(e);if(t=t||Qe(e),v(n,"bpmn:SubProcess"))return Ve(n,t)?{width:350,height:200}:{width:100,height:80};if(v(n,"bpmn:Task"))return{width:100,height:80};if(v(n,"bpmn:Gateway"))return{width:50,height:50};if(v(n,"bpmn:Event"))return{width:36,height:36};if(v(n,"bpmn:Participant")){var i=t.isHorizontal===void 0||t.isHorizontal===!0;return Ve(n,t)?i?{width:600,height:250}:{width:250,height:600}:i?{width:400,height:60}:{width:60,height:400}}return v(n,"bpmn:Lane")?{width:400,height:100}:v(n,"bpmn:DataObjectReference")?{width:36,height:50}:v(n,"bpmn:DataStoreReference")?{width:50,height:50}:v(n,"bpmn:TextAnnotation")?{width:100,height:40}:v(n,"bpmn:Group")?{width:300,height:300}:{width:100,height:80}},dr.prototype.createParticipantShape=function(e){return Ut(e)||(e={isExpanded:e}),e=N({type:"bpmn:Participant"},e||{}),e.isExpanded!==!1&&(e.processRef=this._bpmnFactory.create("bpmn:Process")),this.createShape(e)};function LA(e,t,n){return k(n,function(i){t=Ip(e,t,i)}),t}function Ip(e,t,n){return t[n]===void 0?t:(e[n]=t[n],si(t,[n]))}function IA(e){return Fe(e,["bpmndi:BPMNShape","bpmndi:BPMNEdge","bpmndi:BPMNDiagram","bpmndi:BPMNPlane"])}function _c(e,t){this._modeling=e,this._canvas=t}_c.$inject=["modeling","canvas"],_c.prototype.preExecute=function(e){var t=this._modeling,n=e.elements,i=e.alignment;k(n,function(r){var o={x:0,y:0};Ft(i.left)?o.x=i.left-r.x:Ft(i.right)?o.x=i.right-r.width-r.x:Ft(i.center)?o.x=i.center-Math.round(r.width/2)-r.x:Ft(i.top)?o.y=i.top-r.y:Ft(i.bottom)?o.y=i.bottom-r.height-r.y:Ft(i.middle)&&(o.y=i.middle-Math.round(r.height/2)-r.y),t.moveElements([r],o,r.parent)})},_c.prototype.postExecute=function(e){};function bc(e){this._modeling=e}bc.$inject=["modeling"],bc.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},bc.prototype.postExecute=function(e){var t=e.hints||{};NA(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 NA(e,t){return Ui(e.outgoing,function(n){return n.target===t})}function xc(e,t){this._canvas=e,this._layouter=t}xc.$inject=["canvas","layouter"],xc.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},xc.prototype.revert=function(e){var t=e.connection;return this._canvas.removeConnection(t),t.source=null,t.target=null,t};var wc=Math.round;function Np(e){this._modeling=e}Np.$inject=["modeling"],Np.prototype.preExecute=function(e){var t=e.elements,n=e.parent,i=e.parentIndex,r=e.position,o=e.hints,a=this._modeling;k(t,function(f){ke(f.x)||(f.x=0),ke(f.y)||(f.y=0)});var s=He(t,function(f){return!f.hidden}),c=Lt(s);k(t,function(f){ut(f)&&(f.waypoints=cn(f.waypoints,function(p){return{x:wc(p.x-c.x-c.width/2+r.x),y:wc(p.y-c.y-c.height/2+r.y)}})),N(f,{x:wc(f.x-c.x-c.width/2+r.x),y:wc(f.y-c.y-c.height/2+r.y)})});var u=new Set(Ss(t)),l={};k(t,function(f){if(ut(f)){l[f.id]=ke(i)?a.createConnection(l[f.source.id],l[f.target.id],i,f,f.parent||n,o):a.createConnection(l[f.source.id],l[f.target.id],f,f.parent||n,o);return}var p=N({},o);u.has(f)||(p.autoResize=!1),$e(f)&&(p=si(p,["attach"])),l[f.id]=ke(i)?a.createShape(f,ii(f,["x","y","width","height"]),f.parent||n,i,p):a.createShape(f,ii(f,["x","y","width","height"]),f.parent||n,p)}),e.elements=no(l)};var Hy=Math.round;function hr(e){this._canvas=e}hr.$inject=["canvas"],hr.prototype.execute=function(e){var t=e.shape,n=e.position,i=e.parent,r=e.parentIndex;if(!i)throw new Error("parent required");if(!n)throw new Error("position required");return n.width!==void 0?N(t,n):N(t,{x:n.x-Hy(t.width/2),y:n.y-Hy(t.height/2)}),this._canvas.addShape(t,i,r),t},hr.prototype.revert=function(e){var t=e.shape;return this._canvas.removeShape(t),t};function ba(e){hr.call(this,e)}se(ba,hr),ba.$inject=["canvas"];var BA=hr.prototype.execute;ba.prototype.execute=function(e){var t=e.shape;return jA(t),t.labelTarget=e.labelTarget,BA.call(this,e)};var $A=hr.prototype.revert;ba.prototype.revert=function(e){return e.shape.labelTarget=null,$A.call(this,e)};function jA(e){["width","height"].forEach(function(t){typeof e[t]>"u"&&(e[t]=0)})}function xa(e,t){this._canvas=e,this._modeling=t}xa.$inject=["canvas","modeling"],xa.prototype.preExecute=function(e){var t=this._modeling,n=e.connection;fr(n.incoming,function(i){t.removeConnection(i,{nested:!0})}),fr(n.outgoing,function(i){t.removeConnection(i,{nested:!0})})},xa.prototype.execute=function(e){var t=e.connection,n=t.parent;return e.parent=n,e.parentIndex=ll(n.children,t),e.source=t.source,e.target=t.target,this._canvas.removeConnection(t),t.source=null,t.target=null,t},xa.prototype.revert=function(e){var t=e.connection,n=e.parent,i=e.parentIndex;return t.source=e.source,t.target=e.target,Tt(n.children,t,i),this._canvas.addConnection(t,n),t};function 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;k(i,function(r){n.get(r.id)&&(r.waypoints?t.removeConnection(r):t.removeShape(r))})};function wa(e,t){this._canvas=e,this._modeling=t}wa.$inject=["canvas","modeling"],wa.prototype.preExecute=function(e){var t=this._modeling,n=e.shape;fr(n.incoming,function(i){t.removeConnection(i,{nested:!0})}),fr(n.outgoing,function(i){t.removeConnection(i,{nested:!0})}),fr(n.children,function(i){ut(i)?t.removeConnection(i,{nested:!0}):t.removeShape(i,{nested:!0})})},wa.prototype.execute=function(e){var t=this._canvas,n=e.shape,i=n.parent;return e.oldParent=i,e.oldParentIndex=ll(i.children,n),t.removeShape(n),n},wa.prototype.revert=function(e){var t=this._canvas,n=e.shape,i=e.oldParent,r=e.oldParentIndex;return Tt(i.children,n,r),t.addShape(n,i),n};function Ec(e){this._modeling=e}Ec.$inject=["modeling"];var zy={x:"y",y:"x"};Ec.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[zy[i]]=0,t.moveElements([S],E,S.parent))}var l=n[0],f=s(n),p=n[f],d,h,m=0;k(n,function(g,S){var E,x,w;if(g.elements.length<2){S&&S!==n.length-1&&(o(g,g.elements[0]),m+=c(g.range));return}E=ai(g.elements,i),x=E[0],S===f&&(x=E[s(E)]),w=a(x),g.range=null,k(E,function(C){if(u(w,C),g.range===null){g.range={min:C[i],max:C[i]+C[r]};return}o(g,C)}),S&&S!==n.length-1&&(m+=c(g.range))}),h=Math.abs(p.range.min-l.range.max),d=Math.round((h-m)/(n.length-1)),!(d<n.length-1)&&k(n,function(g,S){var E={},x;g===l||g===p||(x=n[S-1],g.range.max=0,k(g.elements,function(w,C){E[zy[i]]=0,E[i]=x.range.max-w[i]+d,g.range.min!==w[i]&&(E[i]+=w[i]-g.range.min),E[i]&&t.moveElements([w],E,w.parent),g.range.max=Math.max(w[i]+w[r],C?g.range.max:0)}))})},Ec.prototype.postExecute=function(e){};function Sc(e,t){this._layouter=e,this._canvas=t}Sc.$inject=["layouter","canvas"],Sc.prototype.execute=function(e){var t=e.connection,n=t.waypoints;return N(e,{oldWaypoints:n}),t.waypoints=this._layouter.layoutConnection(t,e.hints),t},Sc.prototype.revert=function(e){var t=e.connection;return t.waypoints=e.oldWaypoints,t};function $p(){}$p.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),Tt(i.children,t,r),t.parent=i,k(t.waypoints,function(a){a.x+=n.x,a.y+=n.y,a.original&&(a.original.x+=n.x,a.original.y+=n.y)}),t},$p.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),Tt(i.children,t,r),t.parent=i,k(t.waypoints,function(a){a.x-=o.x,a.y-=o.y,a.original&&(a.original.x-=o.x,a.original.y-=o.y)}),t};function jp(){this.allShapes={},this.allConnections={},this.enclosedElements={},this.enclosedConnections={},this.topLevel={}}jp.prototype.add=function(e,t){return this.addAll([e],t)},jp.prototype.addAll=function(e,t){var n=m1(e,!!t,this);return N(this,n),this};function Ea(e){this._modeling=e}Ea.prototype.moveRecursive=function(e,t,n){return e?this.moveClosure(this.getClosure(e),t,n):[]},Ea.prototype.moveClosure=function(e,t,n,i,r){var o=this._modeling,a=e.allShapes,s=e.allConnections,c=e.enclosedConnections,u=e.topLevel,l=!1;r&&r.parent===n&&(l=!0),k(a,function(f){o.moveShape(f,t,u[f.id]&&!l&&n,{recurse:!1,layout:!1})}),k(s,function(f){var p=!!a[f.source.id],d=!!a[f.target.id];c[f.id]&&p&&d?o.moveConnection(f,t,u[f.id]&&!l&&n):o.layoutConnection(f,{connectionStart:p&&Ul(f,f.source,t),connectionEnd:d&&ql(f,f.target,t)})})},Ea.prototype.getClosure=function(e){return new jp().addAll(e,!0)};function Rc(e){this._helper=new Ea(e)}Rc.$inject=["modeling"],Rc.prototype.preExecute=function(e){e.closure=this._helper.getClosure(e.shapes)},Rc.prototype.postExecute=function(e){var t=e.hints,n;t&&t.primaryShape&&(n=t.primaryShape,t.oldParent=n.parent),this._helper.moveClosure(e.closure,e.delta,e.newParent,e.newHost,n)};function zr(e){this._modeling=e,this._helper=new Ea(e)}zr.$inject=["modeling"],zr.prototype.execute=function(e){var t=e.shape,n=e.delta,i=e.newParent||t.parent,r=e.newParentIndex,o=t.parent;return e.oldBounds=ii(t,["x","y","width","height"]),e.oldParent=o,e.oldParentIndex=Pt(o.children,t),Tt(i.children,t,r),N(t,{parent:i,x:t.x+n.x,y:t.y+n.y}),t},zr.prototype.postExecute=function(e){var t=e.shape,n=e.delta,i=e.hints,r=this._modeling;i.layout!==!1&&(k(t.incoming,function(o){r.layoutConnection(o,{connectionEnd:ql(o,t,n)})}),k(t.outgoing,function(o){r.layoutConnection(o,{connectionStart:Ul(o,t,n)})})),i.recurse!==!1&&this.moveChildren(e)},zr.prototype.revert=function(e){var t=e.shape,n=e.oldParent,i=e.oldParentIndex,r=e.delta;return Tt(n.children,t,i),N(t,{parent:n,x:t.x-r.x,y:t.y-r.y}),t},zr.prototype.moveChildren=function(e){var t=e.delta,n=e.shape;this._helper.moveRecursive(n.children,t,null)},zr.prototype.getNewParent=function(e){return e.newParent||e.shape.parent};function Sa(e){this._modeling=e}Sa.$inject=["modeling"],Sa.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 Ce(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},Sa.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||Gy(Ce(r)?r[0]:r)),i&&(!n||o.docking==="target")&&(a.connectionEnd=a.connectionEnd||Gy(Ce(r)?r[r.length-1]:r)),o.newWaypoints&&(a.waypoints=o.newWaypoints),this._modeling.layoutConnection(t,a))},Sa.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 Gy(e){return e.original||e}function ji(e,t){this._modeling=e,this._rules=t}ji.$inject=["modeling","rules"],ji.prototype.preExecute=function(e){var t=this,n=this._modeling,i=this._rules,r=e.oldShape,o=e.newData,a=e.hints||{},s;function c(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 f;a.moveChildren!==!1&&(f=r.children.slice(),n.moveElements(f,{x:0,y:0},s,a));var p=r.incoming.slice(),d=r.outgoing.slice();k(p,function(h){var m=h.source,g=c(m,s,h);g&&t.reconnectEnd(h,s,Qs(h,s,l),a)}),k(d,function(h){var m=h.target,g=c(s,m,h);g&&t.reconnectStart(h,s,Zs(h,s,l),a)})},ji.prototype.postExecute=function(e){var t=e.oldShape;this._modeling.removeShape(t)},ji.prototype.execute=function(e){},ji.prototype.revert=function(e){},ji.prototype.createShape=function(e,t,n,i){return this._modeling.createShape(e,t,n,i)},ji.prototype.reconnectStart=function(e,t,n,i){this._modeling.reconnectStart(e,t,n,i)},ji.prototype.reconnectEnd=function(e,t,n,i){this._modeling.reconnectEnd(e,t,n,i)};function Ra(e){this._modeling=e}Ra.$inject=["modeling"],Ra.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},N(t,{width:n.width,height:n.height,x:n.x,y:n.y}),t},Ra.prototype.postExecute=function(e){var t=this._modeling,n=e.shape,i=e.oldBounds,r=e.hints||{};r.layout!==!1&&(k(n.incoming,function(o){t.layoutConnection(o,{connectionEnd:Qs(o,n,i)})}),k(n.outgoing,function(o){t.layoutConnection(o,{connectionStart:Zs(o,n,i)})}))},Ra.prototype.revert=function(e){var t=e.shape,n=e.oldBounds;return N(t,{width:n.width,height:n.height,x:n.x,y:n.y}),t};function mr(e){this._modeling=e}mr.$inject=["modeling"],mr.prototype.preExecute=function(e){var t=e.delta,n=e.direction,i=e.movingShapes,r=e.resizingShapes,o=e.start,a={};this.moveShapes(i,t),k(r,function(s){a[s.id]=HA(s)}),this.resizeShapes(r,t,n),this.updateConnectionWaypoints(hA(i,r),t,n,o,i,r,a)},mr.prototype.execute=function(){},mr.prototype.revert=function(){},mr.prototype.moveShapes=function(e,t){var n=this;k(e,function(i){n._modeling.moveShape(i,t,null,{autoResize:!1,layout:!1,recurse:!1})})},mr.prototype.resizeShapes=function(e,t,n){var i=this;k(e,function(r){var o=mA(r,n,t);i._modeling.resizeShape(r,o,null,{attachSupport:!1,autoResize:!1,layout:!1})})},mr.prototype.updateConnectionWaypoints=function(e,t,n,i,r,o,a){var s=this,c=new Set(r),u=new Set(o);k(e,function(l){var f=l.source,p=l.target,d=FA(l),h=Wy(n),m={},g=c.has(f)||u.has(f),S=c.has(p)||u.has(p);g&&S?(d=cn(d,function(E){return Uy(E,i,n)&&(E[h]=E[h]+t[h]),E.original&&Uy(E.original,i,n)&&(E.original[h]=E.original[h]+t[h]),E}),s._modeling.updateWaypoints(l,d,{labelBehavior:!1})):(g||S)&&(c.has(f)?m.connectionStart=Ul(l,f,t):c.has(p)?m.connectionEnd=ql(l,p,t):u.has(f)?m.connectionStart=Zs(l,f,a[f.id]):u.has(p)&&(m.connectionEnd=Qs(l,p,a[p.id])),s._modeling.layoutConnection(l,m))})};function Vy(e){return N({},e)}function FA(e){return cn(e.waypoints,function(t){return t=Vy(t),t.original&&(t.original=Vy(t.original)),t})}function Wy(e){switch(e){case"n":return"y";case"w":return"x";case"s":return"y";case"e":return"x"}}function Uy(e,t,n){var i=Wy(n);if(/e|s/.test(n))return e[i]>t;if(/n|w/.test(n))return e[i]<t}function HA(e){return{x:e.x,y:e.y,height:e.height,width:e.width}}function Cc(e){this._modeling=e}Cc.$inject=["modeling"],Cc.prototype.execute=function(e){var t=e.shape,n=t.children;e.oldChildrenVisibility=qy(n),t.collapsed=!t.collapsed;var i=Yy(n,t.collapsed);return[t].concat(i)},Cc.prototype.revert=function(e){var t=e.shape,n=e.oldChildrenVisibility,i=t.children,r=Ky(i,n);return t.collapsed=!t.collapsed,[t].concat(r)};function qy(e){var t={};return k(e,function(n){t[n.id]=n.hidden,n.children&&(t=N({},t,qy(n.children)))}),t}function Yy(e,t){var n=[];return k(e,function(i){i.hidden=t,n=n.concat(i),i.children&&(n=n.concat(Yy(i.children,i.collapsed||t)))}),n}function Ky(e,t){var n=[];return k(e,function(i){i.hidden=t[i.id],n=n.concat(i),i.children&&(n=n.concat(Ky(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=Xy(i,t),Zy(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,Xy(n,t),Zy(i,t,r),t};function Xy(e,t){return Pt(e&&e.attachers,t)}function Zy(e,t,n){if(e){var i=e.attachers;i||(e.attachers=i=[]),Tt(i,t,n)}}function Fp(){}Fp.prototype.execute=function(e){var t=e.connection,n=e.newWaypoints;return e.oldWaypoints=t.waypoints,t.waypoints=n,t},Fp.prototype.revert=function(e){var t=e.connection,n=e.oldWaypoints;return t.waypoints=n,t};function lt(e,t,n){this._eventBus=e,this._elementFactory=t,this._commandStack=n;var i=this;e.on("diagram.init",function(){i.registerHandlers(n)})}lt.$inject=["eventBus","elementFactory","commandStack"],lt.prototype.getHandlers=function(){return{"shape.append":bc,"shape.create":hr,"shape.delete":wa,"shape.move":zr,"shape.resize":Ra,"shape.replace":ji,"shape.toggleCollapse":Cc,spaceTool:mr,"label.create":ba,"connection.create":xc,"connection.delete":xa,"connection.move":$p,"connection.layout":Sc,"connection.updateWaypoints":Fp,"connection.reconnect":Sa,"elements.create":Np,"elements.move":Rc,"elements.delete":Bp,"elements.distribute":Ec,"elements.align":_c,"element.updateAttachment":Pc}},lt.prototype.registerHandlers=function(e){k(this.getHandlers(),function(t,n){e.registerHandler(n,t)})},lt.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)},lt.prototype.updateAttachment=function(e,t){var n={shape:e,newHost:t};this._commandStack.execute("element.updateAttachment",n)},lt.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)},lt.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)},lt.prototype.layoutConnection=function(e,t){var n={connection:e,hints:t||{}};this._commandStack.execute("connection.layout",n)},lt.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},lt.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},lt.prototype.createElements=function(e,t,n,i,r){Ce(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},lt.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},lt.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},lt.prototype.removeElements=function(e){var t={elements:e};this._commandStack.execute("elements.delete",t)},lt.prototype.distributeElements=function(e,t,n){var i={groups:e,axis:t,dimension:n};this._commandStack.execute("elements.distribute",i)},lt.prototype.removeShape=function(e,t){var n={shape:e,hints:t||{}};this._commandStack.execute("shape.delete",n)},lt.prototype.removeConnection=function(e,t){var n={connection:e,hints:t||{}};this._commandStack.execute("connection.delete",n)},lt.prototype.replaceShape=function(e,t,n){var i={oldShape:e,newData:t,hints:n||{}};return this._commandStack.execute("shape.replace",i),i.newShape},lt.prototype.alignElements=function(e,t){var n={elements:e,alignment:t};this._commandStack.execute("elements.align",n)},lt.prototype.resizeShape=function(e,t,n,i){var r={shape:e,newBounds:t,minBounds:n,hints:i};this._commandStack.execute("shape.resize",r)},lt.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)},lt.prototype.updateWaypoints=function(e,t,n){var i={connection:e,newWaypoints:t,hints:n||{}};this._commandStack.execute("connection.updateWaypoints",i)},lt.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)},lt.prototype.reconnectStart=function(e,t,n,i){i||(i={}),this.reconnect(e,t,e.target,n,N(i,{docking:"source"}))},lt.prototype.reconnectEnd=function(e,t,n,i){i||(i={}),this.reconnect(e,e.source,t,n,N(i,{docking:"target"}))},lt.prototype.connect=function(e,t,n,i){return this.createConnection(e,t,n||{},e.parent,i)},lt.prototype._create=function(e,t){return eS(t)?t:this._elementFactory.create(e,t)},lt.prototype.toggleCollapse=function(e,t){var n={shape:e,hints:t||{}};this._commandStack.execute("shape.toggleCollapse",n)};function Ca(e){this._elementRegistry=e}Ca.$inject=["elementRegistry"],Ca.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||zA(n,Ja(i));return Qy(n,i),e.oldProperties=o,e.changed=r,r},Ca.prototype.revert=function(e){var t=e.oldProperties,n=e.moddleElement,i=e.changed;return Qy(n,t),i},Ca.prototype._getVisualReferences=function(e){var t=this._elementRegistry;return v(e,"bpmn:DataObject")?GA(e,t):[]};function zA(e,t){return Rn(t,function(n,i){return n[i]=e.get(i),n},{})}function Qy(e,t){k(t,function(n,i){e.set(i,n)})}function GA(e,t){return t.filter(function(n){return v(n,"bpmn:DataObjectReference")&&ee(n).dataObjectRef===e})}var Pa="default",Fi="id",Jy="di",VA={width:0,height:0};function Aa(e,t,n,i){this._elementRegistry=e,this._moddle=t,this._modeling=n,this._textRenderer=i}Aa.$inject=["elementRegistry","moddle","modeling","textRenderer"],Aa.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=KA(e.properties),s=e.oldProperties||WA(t,a);return ev(a,o)&&(r.unclaim(o[Fi]),i.updateId(t,a[Fi]),r.claim(a[Fi],o)),Pa in a&&(a[Pa]&&n.push(i.get(a[Pa].id)),o[Pa]&&n.push(i.get(o[Pa].id))),tv(t,a),e.oldProperties=s,e.changed=n,n},Aa.prototype.postExecute=function(e){var t=e.element,n=t.label,i=n&&ee(n).name;if(i){var r=this._textRenderer.getExternalLabelBounds(n,i);this._modeling.resizeShape(n,r,VA)}},Aa.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 tv(t,i),ev(n,r)&&(a.unclaim(n[Fi]),o.updateId(t,i[Fi]),a.claim(i[Fi],r)),e.changed};function ev(e,t){return Fi in e&&e[Fi]!==t[Fi]}function WA(e,t){var n=Ja(t),i=e.businessObject,r=Qe(e);return Rn(n,function(o,a){return a!==Jy?o[a]=i.get(a):o[a]=UA(r,Ja(t.di)),o},{})}function UA(e,t){return Rn(t,function(n,i){return n[i]=e&&e.get(i),n},{})}function tv(e,t){var n=e.businessObject,i=Qe(e);k(t,function(r,o){o!==Jy?n.set(o,r):i&&qA(i,r)})}function qA(e,t){k(t,function(n,i){e.set(i,n)})}var YA=["default"];function KA(e){var t=N({},e);return YA.forEach(function(n){n in e&&(t[n]=ee(t[n]))}),t}function Ac(e,t){this._canvas=e,this._modeling=t}Ac.$inject=["canvas","modeling"],Ac.prototype.execute=function(e){var t=this._canvas,n=e.newRoot,i=n.businessObject,r=t.getRootElement(),o=r.businessObject,a=o.$parent,s=Qe(r);return t.setRootElement(n),t.removeRootElement(r),Tt(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,[]},Ac.prototype.revert=function(e){var t=this._canvas,n=e.newRoot,i=n.businessObject,r=e.oldRoot,o=r.businessObject,a=i.$parent,s=Qe(n);return t.setRootElement(r),t.removeRootElement(n),Pt(a.rootElements,i),i.$parent=null,Tt(a.rootElements,o),o.$parent=a,n.di=null,s.bpmnElement=o,r.di=s,[]};function Hp(e,t){this._modeling=e,this._spaceTool=t}Hp.$inject=["modeling","spaceTool"],Hp.prototype.preExecute=function(e){var t=this._spaceTool,n=this._modeling,i=e.shape,r=e.location,o=Wn(i),a=o===i,s=a?i:i.parent,c=sr(s),u=Yt(i);if(u?r==="left"?r="top":r==="right"&&(r="bottom"):r==="top"?r="left":r==="bottom"&&(r="right"),!c.length){var l=u?{x:i.x+Vn,y:i.y,width:i.width-Vn,height:i.height}:{x:i.x,y:i.y+Vn,width:i.width,height:i.height-Vn};n.createShape({type:"bpmn:Lane",isHorizontal:u},l,s)}var f=[];Lr(o,function(w){return f.push(w),w.label&&f.push(w.label),w===i?[]:He(w.children,function(C){return C!==i})});var p,d,h,m,g;r==="top"?(p=-120,d=i.y,h=d+10,m="n",g="y"):r==="left"?(p=-120,d=i.x,h=d+10,m="w",g="x"):r==="bottom"?(p=120,d=i.y+i.height,h=d-10,m="s",g="y"):r==="right"&&(p=120,d=i.x+i.width,h=d-10,m="e",g="x");var S=t.calculateAdjustments(f,g,p,h),E=u?{x:0,y:p}:{x:p,y:0};t.makeSpace(S.movingShapes,S.resizingShapes,E,m,h);var x=u?{x:i.x+(a?Vn:0),y:d-(r==="top"?120:0),width:i.width-(a?Vn:0),height:120}:{x:d-(r==="left"?120:0),y:i.y+(a?Vn:0),width:120,height:i.height-(a?Vn:0)};e.newLane=n.createShape({type:"bpmn:Lane",isHorizontal:u},x,s)};function zp(e){this._modeling=e}zp.$inject=["modeling"],zp.prototype.preExecute=function(e){var t=this._modeling,n=e.shape,i=e.count,r=sr(n),o=r.length;if(o>i)throw new Error(`more than <${i}> child lanes`);var a=Yt(n),s=a?n.height:n.width,c=Math.round(s/i),u,l,f,p;for(p=0;p<i;p++)p===i-1?u=s-c*p:u=c,l=a?{x:n.x+Vn,y:n.y+p*c,width:n.width-Vn,height:u}:{x:n.x+p*c,y:n.y+Vn,width:u,height:n.height-Vn},p<o?t.resizeShape(r[p],l):(f={type:"bpmn:Lane",isHorizontal:a},t.createShape(f,l,n))};function Ta(e,t){this._modeling=e,this._spaceTool=t}Ta.$inject=["modeling","spaceTool"],Ta.prototype.preExecute=function(e){var t=e.shape,n=e.newBounds,i=e.balanced;i!==!1?this.resizeBalanced(t,n):this.resizeSpace(t,n)},Ta.prototype.resizeBalanced=function(e,t){var n=this._modeling,i=GR(e,t);n.resizeShape(e,t),i.forEach(function(r){n.resizeShape(r.shape,r.newBounds)})},Ta.prototype.resizeSpace=function(e,t){var n=this._spaceTool,i=be(e),r=be(t),o=Dm(r,i),a=Wn(e),s=[],c=[];Lr(a,function(h){return s.push(h),(v(h,"bpmn:Lane")||v(h,"bpmn:Participant"))&&c.push(h),h.children});var u,l,f,p,d;(o.bottom||o.top)&&(u=o.bottom||o.top,l=e.y+(o.bottom?e.height:0)+(o.bottom?-10:10),f=o.bottom?"s":"n",p=o.top>0||o.bottom<0?-u:u,d=n.calculateAdjustments(s,"y",p,l),n.makeSpace(d.movingShapes,d.resizingShapes,{x:0,y:u},f)),(o.left||o.right)&&(u=o.right||o.left,l=e.x+(o.right?e.width:0)+(o.right?-10:100),f=o.right?"e":"w",p=o.left>0||o.right<0?-u:u,d=n.calculateAdjustments(c,"x",p,l),n.makeSpace(d.movingShapes,d.resizingShapes,{x:u,y:0},f))};var Ma="flowNodeRef",Gp="lanes";function Tc(){}Tc.prototype._computeUpdates=function(e,t){var n=[],i=[],r={},o=[];function a(l,f){var p=be(f),d={x:l.x+l.width/2,y:l.y+l.height/2};return d.x>p.left&&d.x<p.right&&d.y>p.top&&d.y<p.bottom}function s(l){n.indexOf(l)===-1&&(o.push(l),n.push(l))}function c(l){var f=Wn(l);return r[f.id]||(r[f.id]=Us(f)),r[f.id]}function u(l){if(!l.parent)return[];var f=c(l);return f.filter(function(p){return a(l,p)}).map(function(p){return p.businessObject})}return t.forEach(function(l){var f=Wn(l);if(!(!f||n.indexOf(f)!==-1)){var p=f.children.filter(function(d){return v(d,"bpmn:FlowNode")});p.forEach(s),n.push(f)}}),e.forEach(s),o.forEach(function(l){var f=l.businessObject,p=f.get(Gp),d=p.slice(),h=u(l);i.push({flowNode:f,remove:d,add:h})}),t.forEach(function(l){var f=l.businessObject;l.parent||f.get(Ma).forEach(function(p){i.push({flowNode:p,remove:[f],add:[]})})}),i},Tc.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(Gp);n.remove.forEach(function(o){Pt(r,o),Pt(o.get(Ma),i)}),n.add.forEach(function(o){Tt(r,o),Tt(o.get(Ma),i)})}),[]},Tc.prototype.revert=function(e){var t=e.updates;return t.forEach(function(n){var i=n.flowNode,r=i.get(Gp);n.add.forEach(function(o){Pt(r,o),Pt(o.get(Ma),i)}),n.remove.forEach(function(o){Tt(r,o),Tt(o.get(Ma),i)})}),[]};var Vp="categoryValueRef";function ka(e,t){this._bpmnFactory=e,this._elementRegistry=t}ka.$inject=["bpmnFactory","elementRegistry"],ka.prototype._computeUpdates=function(e,t){var n=this._elementRegistry,i=this._bpmnFactory,r=new Map,o=[],a=new Map;function s(E,x,w){if(x){var C=a.get(E);C||(C={},a.set(E,C)),!(w&&C.present)&&(!w&&C.past||(w?C.present={categoryValue:x,root:Wp(E)}:C.past={categoryValue:x}))}}function c(E){r.set(E,ee(E))}function u(){n.filter(function(E){return v(E,"bpmn:FlowElement")&&!$e(E)&&E.parent}).forEach(c)}function l(E){var x=ee(E),w=x.get("categoryValueRef");return w||(w=Am(i,x),o.push(XA(E,w))),w}function f(E){return E.reduce(function(x,w){var C=Wp(w),T=x.get(C);return T||(T=[],x.set(C,T)),T.push(w),x},new Map)}e=Array.from(e||[]);var p=f(e);t.length&&u(),e.forEach(c),n.filter(function(E){return v(E,"bpmn:Group")&&!$e(E)&&E.parent}).forEach(function(E){var x=ee(E).get("categoryValueRef");if(!x){var w=Wp(E),C=p.get(w)||[],T=po(C,E),B=Object.keys(T).length>0;B&&(x=l(E))}s(E,x,!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,x){return x.present&&E.add(x.present.categoryValue),x.past&&E.add(x.past.categoryValue),E},new Set),m=new Map,g=f(d);a.forEach(function(E,x){var w=E.present;if(w){var C=g.get(w.root)||[],T=po(C,x);C.forEach(function(B){if(T[B.id]){var M=m.get(B);M||(M=new Set,m.set(B,M)),M.add(w.categoryValue)}})}});var S=d.reduce(function(E,x){var w=r.get(x),C=w.get(Vp),T=new Set(C),B=m.get(x)||new Set,M=Array.from(B).filter(function(G){return!T.has(G)}),z=C.filter(function(G){return h.has(G)&&!B.has(G)});return(M.length||z.length)&&E.push({businessObject:w,categoryValuesToAdd:M,categoryValuesToRemove:z}),E},[]);return{flowElements:S,groups:o}},ka.prototype.execute=function(e){var t=e.updates;return t||(t=e.updates=this._computeUpdates(e.affectedFlowElements,e.affectedGroupEntries)),ZA(t.groups),JA(t.flowElements),[]},ka.prototype.revert=function(e){var t=e.updates;return eT(t.flowElements),QA(t.groups),[]};function XA(e,t){return{groupShape:e,categoryValue:t,category:t.$parent}}function ZA(e){e.forEach(function(t){ee(t.groupShape).categoryValueRef=t.categoryValue,t.categoryValue.$parent=t.category})}function QA(e){e.forEach(function(t){ee(t.groupShape).categoryValueRef=null})}function JA(e){e.forEach(function(t){var n=t.businessObject,i=n.get(Vp);t.categoryValuesToRemove.forEach(function(r){Pt(i,r)}),t.categoryValuesToAdd.forEach(function(r){Tt(i,r,!0)})})}function eT(e){e.forEach(function(t){var n=t.businessObject,i=n.get(Vp);t.categoryValuesToAdd.forEach(function(r){Pt(i,r)}),t.categoryValuesToRemove.forEach(function(r){Tt(i,r,!0)})})}function Wp(e){for(;e.parent;)e=e.parent;return e}function Mc(e){this._moddle=e}Mc.$inject=["moddle"],Mc.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),[]},Mc.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 tT={fill:void 0,stroke:void 0};function Up(e){this._commandStack=e,this._normalizeColor=function(t){if(t){if(En(t)){var n=nT(t);if(n)return n}throw new Error(`invalid color value: ${t}`)}}}Up.$inject=["commandStack"],Up.prototype.postExecute=function(e){var t=e.elements,n=e.colors||tT,i=this,r={};"fill"in n&&N(r,{"background-color":this._normalizeColor(n.fill)}),"stroke"in n&&N(r,{"border-color":this._normalizeColor(n.stroke)}),k(t,function(o){var a=ut(o)?ii(r,["border-color"]):r,s=Qe(o);if(iT(a),$e(o)){if(!s||!v(s.label,"bpmndi:BPMNLabel"))return;i._commandStack.execute("element.updateModdleProperties",{element:o,moddleElement:s.label,properties:{color:r["border-color"]}})}else{if(!Fe(s,["bpmndi:BPMNEdge","bpmndi:BPMNShape"]))return;i._commandStack.execute("element.updateProperties",{element:o,properties:{di:a}})}})};function nT(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 iT(e){"border-color"in e&&(e.stroke=e["border-color"]),"background-color"in e&&(e.fill=e["background-color"])}var rT={width:0,height:0};function nv(e,t,n){function i(c,u){var l=c.label||c,f=c.labelTarget||c;return OS(l,u),[l,f]}function r(c){var u=c.element,l=u.businessObject,f=c.newLabel;if(!$e(u)&&or(u)&&!Ds(u)&&!iv(f)){var p=7,d=gl(u);d={x:d.x,y:d.y+p},e.createLabel(u,d,{id:l.id+"_label",businessObject:l,di:u.di})}}function o(c){return c.oldLabel=$n(c.element),i(c.element,c.newLabel)}function a(c){return i(c.element,c.oldLabel)}function s(c){var u=c.element,l=u.label||u,f=c.newLabel,p=c.newBounds,d=c.hints||{};if(!(!$e(l)&&!v(l,"bpmn:TextAnnotation"))){if($e(l)&&iv(f)){d.removeShape!==!1&&e.removeShape(l,{unsetLabel:!1});return}var h=$n(u);typeof p>"u"&&(p=t.getExternalLabelBounds(l,h)),p&&e.resizeShape(l,p,rT)}}this.preExecute=r,this.execute=o,this.revert=a,this.postExecute=s}nv.$inject=["modeling","textRenderer","bpmnFactory"];function iv(e){return!e||!e.trim()}function rn(e,t,n,i){lt.call(this,e,t,n),this._bpmnRules=i}se(rn,lt),rn.$inject=["eventBus","elementFactory","commandStack","bpmnRules"],rn.prototype.getHandlers=function(){var e=lt.prototype.getHandlers.call(this);return e["element.updateModdleProperties"]=Ca,e["element.updateProperties"]=Aa,e["canvas.updateRoot"]=Ac,e["lane.add"]=Hp,e["lane.resize"]=Ta,e["lane.split"]=zp,e["lane.updateRefs"]=Tc,e["group.updateRefs"]=ka,e["id.updateClaim"]=Mc,e["element.setColor"]=Up,e["element.updateLabel"]=nv,e},rn.prototype.updateLabel=function(e,t,n,i){this._commandStack.execute("element.updateLabel",{element:e,newLabel:t,newBounds:n,hints:i||{}})},rn.prototype.connect=function(e,t,n,i){var r=this._bpmnRules;if(n||(n=r.canConnect(e,t)),!!n)return this.createConnection(e,t,n,e.parent,i)},rn.prototype.updateModdleProperties=function(e,t,n){this._commandStack.execute("element.updateModdleProperties",{element:e,moddleElement:t,properties:n})},rn.prototype.updateProperties=function(e,t){this._commandStack.execute("element.updateProperties",{element:e,properties:t})},rn.prototype.resizeLane=function(e,t,n){this._commandStack.execute("lane.resize",{shape:e,newBounds:t,balanced:n})},rn.prototype.addLane=function(e,t){var n={shape:e,location:t};return this._commandStack.execute("lane.add",n),n.newLane},rn.prototype.splitLane=function(e,t){this._commandStack.execute("lane.split",{shape:e,count:t})},rn.prototype.makeCollaboration=function(){var e=this._create("root",{type:"bpmn:Collaboration"}),t={newRoot:e};return this._commandStack.execute("canvas.updateRoot",t),e},rn.prototype.makeProcess=function(){var e=this._create("root",{type:"bpmn:Process"}),t={newRoot:e};return this._commandStack.execute("canvas.updateRoot",t),e},rn.prototype.updateLaneRefs=function(e,t){this._commandStack.execute("lane.updateRefs",{flowNodeShapes:e,laneShapes:t})},rn.prototype.updateCategoryValueRefs=function(e,t){this._commandStack.execute("group.updateRefs",{affectedFlowElements:e,affectedGroupEntries:t})},rn.prototype.claimId=function(e,t){this._commandStack.execute("id.updateClaim",{id:e,element:t,claiming:!0})},rn.prototype.unclaimId=function(e,t){this._commandStack.execute("id.updateClaim",{id:e,element:t})},rn.prototype.setColor=function(e,t){e.length||(e=[e]),this._commandStack.execute("element.setColor",{elements:e,colors:t})};function rv(){}rv.prototype.layoutConnection=function(e,t){return t=t||{},[t.connectionStart||Pe(t.source||e.source),t.connectionEnd||Pe(t.target||e.target)]};var kc=20,oT=5,Oc=Math.round,ov=20,aT={"h:h":20,"v:v":20,"h:v":-10,"v:h":-10};function sT(e,t){return!{t:/top/,r:/right/,b:/bottom/,l:/left/,h:/./,v:/./}[t].test(e)}function cT(e,t){return{t:/top/,r:/right/,b:/bottom/,l:/left/,h:/left|right/,v:/top|bottom/}[e].test(t)}function av(e,t,n){var i=en(t,e,oT),r=n.split(":")[0],o=Oc((t.x-e.x)/2+e.x),a=Oc((t.y-e.y)/2+e.y),s,c,u=cT(r,i),l=/h|r|l/.test(r),f=!1,p=!1;return u?(s=l?{x:o,y:e.y}:{x:e.x,y:a},c=l?"h:h":"v:v"):(f=sT(i,r),c=l?"h:v":"v:h",f?l?(p=a===e.y,s={x:e.x+kc*(/l/.test(r)?-1:1),y:p?a+kc:a}):(p=o===e.x,s={x:p?o+kc:o,y:e.y+kc*(/t/.test(r)?-1:1)}):s={x:o,y:a}),{waypoints:qp(e,s,c).concat(s),directions:c,turnNextDirections:p}}function uT(e,t,n){return av(e,t,n)}function lT(e,t,n){var i=av(t,e,sv(n));return{waypoints:i.waypoints.slice().reverse(),directions:sv(i.directions),turnNextDirections:i.turnNextDirections}}function pT(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=qp(e.waypoints[e.waypoints.length-1],t.waypoints[0],r);return{waypoints:o,directions:r}}function sv(e){return e.split(":").reverse().join(":")}function fT(e,t,n){var i=Oc((t.x-e.x)/2+e.x),r=Oc((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 qp(e,t,n){if(n=n||"h:h",!xT(n))throw new Error("unknown directions: <"+n+">: must be specified as <start>:<end> with start/end in { h,v,t,r,b,l }");if(uv(n)){var i=uT(e,t,n),r=lT(e,t,n),o=pT(i,r);return[].concat(i.waypoints,o.waypoints,r.waypoints)}return fT(e,t,n)}function dT(e,t,n){var i=qp(e,t,n);return i.unshift(e),i.push(t),pv(i)}function hT(e,t,n,i,r){var o=r&&r.preferredLayouts||[],a=g0(o,"straight")[0]||"h:h",s=aT[a]||0,c=en(e,t,s),u=bT(c,a);n=n||Pe(e),i=i||Pe(t);var l=u.split(":"),f=lv(n,e,l[0],wT(c)),p=lv(i,t,l[1],c);return dT(f,p,u)}function mT(e,t,n,i,r,o){Ce(n)&&(r=n,o=i,n=Pe(e),i=Pe(t)),o=N({preferredLayouts:[]},o),r=r||[];var a=o.preferredLayouts,s=a.indexOf("straight")!==-1,c;return c=s&&yT(e,t,n,i,o),c||(c=o.connectionEnd&&_T(t,e,i,r),c)||(c=o.connectionStart&&vT(e,t,n,r),c)?c:!o.connectionStart&&!o.connectionEnd&&r&&r.length?r:hT(e,t,n,i,o)}function gT(e,t,n){return e>=t&&e<=n}function cv(e,t,n){var i={x:"width",y:"height"};return gT(t[e],n[e],n[e]+n[i[e]])}function yT(e,t,n,i,r){var o={},a,s;return s=en(e,t),/^(top|bottom|left|right)$/.test(s)?(/top|bottom/.test(s)&&(a="x"),/left|right/.test(s)&&(a="y"),r.preserveDocking==="target"?cv(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:cv(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 vT(e,t,n,i){return Yp(e,t,n,i)}function _T(e,t,n,i){var r=i.slice().reverse();return r=Yp(e,t,n,r),r?r.reverse():null}function Yp(e,t,n,i){function r(l){return l.length<3?!0:l.length>4?!1:!!ft(l,function(f,p){var d=l[p-1];return d&&ta(f,d)<3})}function o(l,f,p){var d=ki(f,l);switch(d){case"v":return{x:p.x,y:l.y};case"h":return{x:l.x,y:p.y}}return{x:l.x,y:l.y}}function a(l,f,p){var d;for(d=l.length-2;d!==0;d--)if(Lh(l[d],f,ov)||Lh(l[d],p,ov))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=Yp(e,t,n,u)),c&&ki(c)?null:c}function bT(e,t){if(uv(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 xT(e){return e&&/^h|v|t|r|b|l:h|v|t|r|b|l$/.test(e)}function uv(e){return e&&/t|r|b|l/.test(e)}function wT(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 lv(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 pv(e){return e.reduce(function(t,n,i){var r=t[t.length-1],o=e[i+1];return pl(r,o,n,0)||t.push(n),t},[])}var ET=-10,ST=40,RT={default:["h:h"],fromGateway:["v:h"],toGateway:["h:v"],loop:{fromTop:["t:r"],fromRight:["r:b"],fromLeft:["l:t"],fromBottom:["b:l"]},boundaryLoop:{alternateHorizontalSide:"b",alternateVerticalSide:"l",default:"v"},messageFlow:["straight","v:v"],subProcess:["straight","h:h"],isHorizontal:!0},CT={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"},Oa={top:"t",right:"r",bottom:"b",left:"l"};function Dc(e){this._elementRegistry=e}se(Dc,rv),Dc.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=fv(r&&r[0],n)),a||(a=fv(r&&r[r.length-1],i)),(v(e,"bpmn:Association")||v(e,"bpmn:DataAssociation"))&&r&&!dv(n,i))return[].concat([o],r.slice(1,-1),[a]);var l=Sm(n,s)?RT:CT;return v(e,"bpmn:MessageFlow")?c=AT(n,i,l):(v(e,"bpmn:SequenceFlow")||dv(n,i))&&(n===i?c={preferredLayouts:LT(n,e,l)}:v(n,"bpmn:BoundaryEvent")?c={preferredLayouts:IT(n,i,a,l)}:Da(n)||Da(i)?c={preferredLayouts:l.subProcess,preserveDocking:MT(n)}:v(n,"bpmn:Gateway")?c={preferredLayouts:l.fromGateway}:v(i,"bpmn:Gateway")?c={preferredLayouts:l.toGateway}:c={preferredLayouts:l.default}),c&&(c=N(c,t),u=pv(mT(n,i,o,a,r,c))),u||[o,a]};function PT(e){var t=e.host;return en(Pe(e),t,ET)}function AT(e,t,n){return{preferredLayouts:n.messageFlow,preserveDocking:TT(e,t)}}function TT(e,t){return v(t,"bpmn:Participant")?"source":v(e,"bpmn:Participant")?"target":Da(t)?"source":Da(e)||v(t,"bpmn:Event")?"target":v(e,"bpmn:Event")?"source":null}function MT(e){return Da(e)?"target":"source"}function fv(e,t){return e?e.original||e:Pe(t)}function dv(e,t){return v(t,"bpmn:Activity")&&v(e,"bpmn:BoundaryEvent")&&t.businessObject.isForCompensation}function Da(e){return v(e,"bpmn:SubProcess")&&Ve(e)}function Gr(e,t){return e===t}function kT(e,t){return t.indexOf(e)!==-1}function ko(e){var t=/right|left/.exec(e);return t&&t[0]}function Oo(e){var t=/top|bottom/.exec(e);return t&&t[0]}function hv(e,t){return Kp[e]===t}function OT(e,t){var n=ko(e),i=Kp[n];return t.indexOf(i)!==-1}function DT(e,t){var n=Oo(e),i=Kp[n];return t.indexOf(i)!==-1}function mv(e){return e==="right"||e==="left"}function LT(e,t,n){var i=t.waypoints,r=i&&i.length&&en(i[0],e);return r==="top"?n.loop.fromTop:r==="right"?n.loop.fromRight:r==="left"?n.loop.fromLeft:n.loop.fromBottom}function IT(e,t,n,i){var r=Pe(e),o=Pe(t),a=PT(e),s,c,u=Gr(e.host,t),l=kT(a,["top","right","bottom","left"]),f=en(o,r,{x:e.width/2+t.width/2,y:e.height/2+t.height/2});return u?NT(a,l,e,t,n,i):(s=BT(a,f,l,i.isHorizontal),c=$T(a,f,l,i.isHorizontal),[s+":"+c])}function NT(e,t,n,i,r,o){var a=t?e:o.isHorizontal?Oo(e):ko(e),s=Oa[a],c;return t?mv(e)?c=gv("y",n,i,r)?"h":o.boundaryLoop.alternateHorizontalSide:c=gv("x",n,i,r)?"v":o.boundaryLoop.alternateVerticalSide:c=o.boundaryLoop.default,[s+":"+c]}function gv(e,t,n,i){var r=ST;return!(Xp(e,i,n,r)||Xp(e,i,{x:n.x+n.width,y:n.y+n.height},r)||Xp(e,i,Pe(t),r))}function Xp(e,t,n,i){return Math.abs(t[e]-n[e])<i}function BT(e,t,n,i){if(n)return Oa[e];var r=Oo(e),o=ko(e),a=Oo(t),s=ko(t);if(i){if(Gr(r,a)||hv(o,s))return Oa[r]}else if(Gr(o,s)||hv(r,a))return Oa[o];return Oa[i?o:r]}function $T(e,t,n,i){if(n)return mv(e)?OT(e,t)||Gr(e,t)?"h":"v":DT(e,t)||Gr(e,t)?"v":"h";var r=Oo(e),o=ko(e),a=Oo(t),s=ko(t);return a&&!s?"v":s&&!a?"h":i?Gr(r,a)?"h":"v":Gr(o,s)?"v":"h"}Dc.$inject=["elementRegistry"];function yv(e){return N({original:e.point.original||e.point},e.actual)}function gr(e,t){this._elementRegistry=e,this._graphicsFactory=t}gr.$inject=["elementRegistry","graphicsFactory"],gr.prototype.getCroppedWaypoints=function(e,t,n){t=t||e.source,n=n||e.target;var i=this.getDockingPoint(e,t,!0),r=this.getDockingPoint(e,n),o=e.waypoints.slice(i.idx+1,r.idx);return o.unshift(yv(i)),o.push(yv(r)),o},gr.prototype.getDockingPoint=function(e,t,n){var i=e.waypoints,r,o,a;return r=n?0:i.length-1,o=i[r],a=this._getIntersection(t,e,n),{point:o,actual:a||o,idx:r}},gr.prototype._getIntersection=function(e,t,n){var i=this._getShapePath(e),r=this._getConnectionPath(t);return na(i,r,n)},gr.prototype._getConnectionPath=function(e){return this._graphicsFactory.getConnectionPath(e)},gr.prototype._getShapePath=function(e){return this._graphicsFactory.getShapePath(e)},gr.prototype._getGfx=function(e){return this._elementRegistry.getGraphics(e)};const Zp={__init__:["modeling","bpmnUpdater"],__depends__:[iP,_P,xP,wP,Ty,EA,RA,kA,qn,Lp,Iy],bpmnFactory:["type",Kn],bpmnUpdater:["type",On],elementFactory:["type",dr],modeling:["type",rn],layouter:["type",Dc],connectionDocking:["type",gr]};var jT=10,vv=50,FT=250;function Qp(e,t,n,i){for(var r;r=HT(e,n,t);)n=i(t,n,r);return n}function Jp(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 HT(e,t,n){var i={x:t.x-n.width/2,y:t.y-n.height/2,width:n.width,height:n.height},r=GT(e);return ft(r,function(o){if(o===n)return!1;var a=en(o,i,jT);return a==="intersect"})}function zT(e,t){t||(t={});function n(h){return h.source===e?1:-1}var i=t.defaultDistance||vv,r=t.direction||"e",o=t.filter,a=t.getWeight||n,s=t.maxDistance||FT,c=t.reference||"start";o||(o=UT);function u(h,m){return r==="n"?c==="start"?be(h).top-be(m).bottom:c==="center"?be(h).top-Pe(m).y:be(h).top-be(m).top:r==="w"?c==="start"?be(h).left-be(m).right:c==="center"?be(h).left-Pe(m).x:be(h).left-be(m).left:r==="s"?c==="start"?be(m).top-be(h).bottom:c==="center"?Pe(m).y-be(h).bottom:be(m).bottom-be(h).bottom:c==="start"?be(m).left-be(h).right:c==="center"?Pe(m).x-be(h).right:be(m).right-be(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}}),f=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}}),p=l.concat(f).reduce(function(h,m){return h[m.id+"__weight_"+m.weight]=m,h},{}),d=Rn(p,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 GT(e){var t=ef(e);return e.host&&(t=t.concat(ef(e.host))),e.attachers&&(t=t.concat(e.attachers.reduce(function(n,i){return n.concat(ef(i))},[]))),t}function ef(e){return WT(e).concat(VT(e))}function VT(e){return e.incoming.map(function(t){return t.source})}function WT(e){return e.outgoing.map(function(t){return t.target})}function UT(){return!0}var qT=100;function _v(e,t,n){e.on("autoPlace",qT,function(i){var r=i.shape,o=i.source;return YT(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 YT(e,t,n){n||(n={});var i=n.defaultDistance||vv,r=Pe(e),o=be(e);return{x:o.right+i+t.width/2,y:r.y}}function bv(e,t){e.on("autoPlace.end",500,function(n){t.select(n.shape)})}bv.$inject=["eventBus","selection"];const KT={__init__:["autoPlaceSelectionBehavior"],autoPlace:["type",_v],autoPlaceSelectionBehavior:["type",bv]};function xv(e,t,n){var i=Sm(e,n);if(v(t,"bpmn:TextAnnotation"))return ZT(e,t,i);if(Fe(t,["bpmn:DataObjectReference","bpmn:DataStoreReference"]))return QT(e,t,i);if(v(t,"bpmn:FlowNode"))return XT(e,t,i)}function XT(e,t,n){var i=be(e),r=Pe(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=zT(e,{filter:function(d){return v(d,"bpmn:SequenceFlow")},direction:o.directionHint}),s=30,c=o.minDistance,u=o.baseOrientation;v(e,"bpmn:BoundaryEvent")&&(u=en(e,e.host,-25),u.indexOf(o.boundaryOrientation)!==-1&&(s*=-1));var l=n?{x:i.right+a+t.width/2,y:r.y+wv(u,c,o)}:{x:r.x+wv(u,c,o),y:i.bottom+a+t.height/2},f={margin:s,minDistance:c},p=n?{y:f}:{x:f};return Qp(e,t,l,Jp(p))}function wv(e,t,n){return e.includes(n.start)?-1*t:e.includes(n.end)?t:0}function ZT(e,t,n){var i=be(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};ut(e)&&(r=Pe(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 Qp(e,t,r,Jp(a))}function QT(e,t,n){var i=be(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 Qp(e,t,r,Jp(a))}function Ev(e,t){e.on("autoPlace",function(n){var i=n.shape,r=n.source;return xv(r,i,t)})}Ev.$inject=["eventBus","elementRegistry"];const Lc={__depends__:[KT],__init__:["bpmnAutoPlace"],bpmnAutoPlace:["type",Ev]},Sv=[wm,ca,Zp,Lc];function JT(e={}){wd(globalThis,e.dom);const t=document.createElement("div");return document.body.appendChild(t),new mo({container:t,moddleExtensions:e.moddleExtensions??as,additionalModules:[...Sv,...e.additionalModules??[]]})}var eM=new To("ov"),tM=500;function Zt(e,t,n,i){this._eventBus=t,this._canvas=n,this._elementRegistry=i,this._ids=eM,this._overlayDefaults=N({show:null,scale:!0},e&&e.defaults),this._overlays={},this._overlayContainers=[],this._overlayRoot=nM(n.getContainer()),this._init()}Zt.$inject=["config.overlays","eventBus","canvas","elementRegistry"],Zt.prototype.get=function(e){if(En(e)&&(e={id:e}),En(e.element)&&(e.element=this._elementRegistry.get(e.element)),e.element){var t=this._getOverlayContainer(e.element,!0);return t?e.type?He(t.overlays,ro({type:e.type})):t.overlays.slice():[]}else return e.type?He(this._overlays,ro({type:e.type})):e.id?this._overlays[e.id]:null},Zt.prototype.add=function(e,t,n){if(Ut(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=N({},this._overlayDefaults,n,{id:i,type:t,element:e,html:n.html}),this._addOverlay(n),i},Zt.prototype.remove=function(e){var t=this.get(e)||[];Ce(t)||(t=[t]);var n=this;k(t,function(i){var r=n._getOverlayContainer(i.element,!0);if(i&&(fi(i.html),fi(i.htmlContainer),delete i.htmlContainer,delete i.element,delete n._overlays[i.id]),r){var o=r.overlays.indexOf(i);o!==-1&&r.overlays.splice(o,1)}})},Zt.prototype.isShown=function(){return this._overlayRoot.style.display!=="none"},Zt.prototype.show=function(){Ic(this._overlayRoot)},Zt.prototype.hide=function(){Ic(this._overlayRoot,!1)},Zt.prototype.clear=function(){this._overlays={},this._overlayContainers=[],vs(this._overlayRoot)},Zt.prototype._updateOverlayContainer=function(e){var t=e.element,n=e.html,i=t.x,r=t.y;if(t.waypoints){var o=Lt(t);i=o.x,r=o.y}Rv(n,i,r),ln(e.html,"data-container-id",t.id)},Zt.prototype._updateOverlay=function(e){var t=e.position,n=e.htmlContainer,i=e.element,r=t.left,o=t.top;if(t.right!==void 0){var a;i.waypoints?a=Lt(i).width:a=i.width,r=t.right*-1+a}if(t.bottom!==void 0){var s;i.waypoints?s=Lt(i).height:s=i.height,o=t.bottom*-1+s}Rv(n,r||0,o||0),this._updateOverlayVisibilty(e,this._canvas.viewbox())},Zt.prototype._createOverlayContainer=function(e){var t=mt('<div class="djs-overlays" />');mn(t,{position:"absolute"}),this._overlayRoot.appendChild(t);var n={html:t,element:e,overlays:[]};return this._updateOverlayContainer(n),this._overlayContainers.push(n),n},Zt.prototype._updateRoot=function(e){var t=e.scale||1,n="matrix("+[t,0,0,t,-1*e.x*t,-1*e.y*t].join(",")+")";Cv(this._overlayRoot,n)},Zt.prototype._getOverlayContainer=function(e,t){var n=ft(this._overlayContainers,function(i){return i.element===e});return!n&&!t?this._createOverlayContainer(e):n},Zt.prototype._addOverlay=function(e){var t=e.id,n=e.element,i=e.html,r,o;i.get&&i.constructor.prototype.jquery&&(i=i.get(0)),En(i)&&(i=mt(i)),o=this._getOverlayContainer(n),r=mt('<div class="djs-overlay" data-overlay-id="'+t+'">'),mn(r,{position:"absolute"}),r.appendChild(i),e.type&&bt(r).add("djs-overlay-"+e.type);var a=this._canvas.findRoot(n),s=this._canvas.getRootElement();Ic(r,a===s),e.htmlContainer=r,o.overlays.push(e),o.html.appendChild(r),this._overlays[t]=e,this._updateOverlay(e),this._updateOverlayVisibilty(e,this._canvas.viewbox())},Zt.prototype._updateOverlayVisibilty=function(e,t){var n=e.show,i=this._canvas.findRoot(e.element),r=n&&n.minZoom,o=n&&n.maxZoom,a=e.htmlContainer,s=this._canvas.getRootElement(),c=!0;(i!==s||n&&(Ft(r)&&r>t.scale||Ft(o)&&o<t.scale))&&(c=!1),Ic(a,c),this._updateOverlayScale(e,t)},Zt.prototype._updateOverlayScale=function(e,t){var n=e.scale,i,r,o=e.htmlContainer,a,s="";n!==!0&&(n===!1?(i=1,r=1):(i=n.min,r=n.max),Ft(i)&&t.scale<i&&(a=(1/t.scale||1)*i),Ft(r)&&t.scale>r&&(a=(1/t.scale||1)*r)),Ft(a)&&(s="scale("+a+","+a+")"),Cv(o,s)},Zt.prototype._updateOverlaysVisibilty=function(e){var t=this;k(this._overlays,function(n){t._updateOverlayVisibilty(n,e)})},Zt.prototype._init=function(){var e=this._eventBus,t=this;function n(i){t._updateRoot(i),t._updateOverlaysVisibilty(i),t.show()}e.on("canvas.viewbox.changing",function(i){t.hide()}),e.on("canvas.viewbox.changed",function(i){n(i.viewbox)}),e.on(["shape.remove","connection.remove"],function(i){var r=i.element,o=t.get({element:r});k(o,function(c){t.remove(c.id)});var a=t._getOverlayContainer(r);if(a){fi(a.html);var s=t._overlayContainers.indexOf(a);s!==-1&&t._overlayContainers.splice(s,1)}}),e.on("element.changed",tM,function(i){var r=i.element,o=t._getOverlayContainer(r,!0);o&&(k(o.overlays,function(a){t._updateOverlay(a)}),t._updateOverlayContainer(o))}),e.on("element.marker.update",function(i){var r=t._getOverlayContainer(i.element,!0);r&&bt(r.html)[i.add?"add":"remove"](i.marker)}),e.on("root.set",function(){t._updateOverlaysVisibilty(t._canvas.viewbox())}),e.on("diagram.clear",this.clear,this)};function nM(e){var t=mt('<div class="djs-overlay-container" />');return mn(t,{position:"absolute",width:0,height:0}),e.insertBefore(t,e.firstChild),t}function Rv(e,t,n){mn(e,{left:t+"px",top:n+"px"})}function Ic(e,t){e.style.display=t===!1?"none":""}function Cv(e,t){e.style["transform-origin"]="top left",["","-ms-","-webkit-"].forEach(function(n){e.style[n+"transform"]=t})}const Nc={__init__:["overlays"],overlays:["type",Zt]};function tf(e,t){t.invoke(Q,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)})}se(tf,Q),tf.$inject=["canvas","injector"];const iM={__init__:["rootElementsBehavior"],rootElementsBehavior:["type",tf]};function La(e){return CSS.escape(e)}var rM={"&":"&","<":"<",">":">",'"':""","'":"'"};function Pv(e){return e=""+e,e&&e.replace(/[&<>"']/g,function(t){return rM[t]})}var oM="bjs-breadcrumbs-shown";function Av(e,t,n){var i=mt('<ul class="bjs-breadcrumbs"></ul>'),r=n.getContainer(),o=bt(r);r.appendChild(i);var a=[];e.on("element.changed",function(c){var u=c.element,l=ee(u),f=ft(a,function(p){return p===l});f&&s()});function s(c){c&&(a=aM(c));var u=a.flatMap(function(f){var p=n.findRoot(yi(f))||n.findRoot(f.id);if(!p&&v(f,"bpmn:Process")){var d=t.find(function(g){var S=ee(g);return S&&S.get("processRef")===f});p=d&&n.findRoot(d.id)}if(!p)return[];var h=Pv(f.name||f.id),m=mt('<li><span class="bjs-crumb"><a title="'+h+'">'+h+"</a></span></li>");return m.addEventListener("click",function(){n.setRootElement(p)}),m});i.innerHTML="";var l=u.length>1;o.toggle(oM,l),u.forEach(function(f){i.appendChild(f)})}e.on("root.set",function(c){s(c.element)})}Av.$inject=["eventBus","elementRegistry","canvas"];function aM(e){for(var t=ee(e),n=[],i=t;i;i=i.$parent)(v(i,"bpmn:SubProcess")||v(i,"bpmn:Process"))&&n.push(i);return n.reverse()}function Tv(e,t){var n=null,i=new sM;e.on("root.set",function(r){var o=r.element,a=t.viewbox(),s=i.get(o);if(i.set(n,{x:a.x,y:a.y,zoom:a.scale}),n=o,!(!v(o,"bpmn:SubProcess")&&!s)){s=s||{x:0,y:0,zoom:1};var c=(a.x-s.x)*a.scale,u=(a.y-s.y)*a.scale;(c!==0||u!==0)&&t.scroll({dx:c,dy:u}),s.zoom!==a.scale&&t.zoom(s.zoom,{x:0,y:0})}}),e.on("diagram.clear",function(){i.clear(),n=null})}Tv.$inject=["eventBus","canvas"];function sM(){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 Mv={x:180,y:160};function Vr(e,t){this._eventBus=e,this._moddle=t;var n=this;e.on("import.render.start",1500,function(i,r){n._handleImport(r.definitions)})}Vr.prototype._handleImport=function(e){if(e.diagrams){var t=this;this._definitions=e,this._processToDiagramMap={},e.diagrams.forEach(function(i){!i.plane||!i.plane.bpmnElement||(t._processToDiagramMap[i.plane.bpmnElement.id]=i)});var n=e.diagrams.filter(i=>i.plane).flatMap(i=>t._createNewDiagrams(i.plane));n.forEach(function(i){t._movePlaneElementsToOrigin(i.plane)})}},Vr.prototype._createNewDiagrams=function(e){var t=this,n=[],i=[];e.get("planeElement").forEach(function(o){var a=o.bpmnElement;if(a){var s=a.$parent;v(a,"bpmn:SubProcess")&&!o.isExpanded&&n.push(a),uM(a,e)&&i.push({diElement:o,parent:s})}});var r=[];return n.forEach(function(o){if(!t._processToDiagramMap[o.id]){var a=t._createDiagram(o);t._processToDiagramMap[o.id]=a,r.push(a)}}),i.forEach(function(o){for(var a=o.diElement,s=o.parent;s&&n.indexOf(s)===-1;)s=s.$parent;if(s){var c=t._processToDiagramMap[s.id];t._moveToDiPlane(a,c.plane)}}),r},Vr.prototype._movePlaneElementsToOrigin=function(e){var t=e.get("planeElement"),n=cM(e),i={x:n.x-Mv.x,y:n.y-Mv.y};t.forEach(function(r){r.waypoint?r.waypoint.forEach(function(o){o.x=o.x-i.x,o.y=o.y-i.y}):r.bounds&&(r.bounds.x=r.bounds.x-i.x,r.bounds.y=r.bounds.y-i.y)})},Vr.prototype._moveToDiPlane=function(e,t){var n=kv(e),i=n.plane.get("planeElement");i.splice(i.indexOf(e),1),t.get("planeElement").push(e)},Vr.prototype._createDiagram=function(e){var t=this._moddle.create("bpmndi:BPMNPlane",{bpmnElement:e}),n=this._moddle.create("bpmndi:BPMNDiagram",{plane:t});return t.$parent=n,t.bpmnElement=e,n.$parent=this._definitions,this._definitions.diagrams.push(n),n},Vr.$inject=["eventBus","moddle"];function kv(e){return v(e,"bpmndi:BPMNDiagram")?e:kv(e.$parent)}function cM(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=be(n.bounds);t.top=Math.min(i.top,t.top),t.left=Math.min(i.left,t.left)}}),Ps(t)}function uM(e,t){var n=e.$parent;return!(!v(n,"bpmn:SubProcess")||n===t.bpmnElement||Fe(e,["bpmn:DataInputAssociation","bpmn:DataOutputAssociation"]))}var Bc=250,lM='<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>',pM="bjs-drilldown-empty";function yr(e,t,n,i,r){Q.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",Bc,function(a){var s=a.shape;o._canDrillDown(s)?o._addOverlay(s):o._removeOverlay(s)},!0),this.reverted("shape.toggleCollapse",Bc,function(a){var s=a.shape;o._canDrillDown(s)?o._addOverlay(s):o._removeOverlay(s)},!0),this.executed(["shape.create","shape.move","shape.delete"],Bc,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"],Bc,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)})})}se(yr,Q),yr.prototype._updateDrilldownOverlay=function(e){var t=this._canvas;if(e){var n=t.findRoot(e);n&&this._updateOverlayVisibility(n)}},yr.prototype._canDrillDown=function(e){var t=this._canvas;return v(e,"bpmn:SubProcess")&&t.findRoot(yi(e))},yr.prototype._updateOverlayVisibility=function(e){var t=this._overlays,n=ee(e),i=t.get({element:n.id,type:"drilldown"})[0];if(i){var r=n&&n.get("flowElements")&&n.get("flowElements").length;bt(i.html).toggle(pM,!r)}},yr.prototype._addOverlay=function(e){var t=this._canvas,n=this._overlays,i=ee(e),r=n.get({element:e,type:"drilldown"});r.length&&this._removeOverlay(e);var o=mt('<button type="button" class="bjs-drilldown">'+lM+"</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(yi(e)))}),n.add(e,"drilldown",{position:{bottom:-7,right:-8},html:o}),this._updateOverlayVisibility(e)},yr.prototype._removeOverlay=function(e){var t=this._overlays;t.remove({element:e,type:"drilldown"})},yr.$inject=["canvas","eventBus","elementRegistry","overlays","translate"];const fM={__depends__:[Nc,Lp,iM],__init__:["drilldownBreadcrumbs","drilldownOverlayBehavior","drilldownCentering","subprocessCompatibility"],drilldownBreadcrumbs:["type",Av],drilldownCentering:["type",Tv],drilldownOverlayBehavior:["type",yr],subprocessCompatibility:["type",Vr]};function vr(e){wt.call(this,e)}se(vr,wt),vr.prototype._modules=[wm,fM,Nc,qn,ca],vr.prototype._moddleExtensions={};var $c="keyboard.keydown",dM="keyboard.keyup",hM=1e3,Ov="Keyboard binding is now implicit; explicit binding to an element got removed. For more information, see https://github.com/bpmn-io/diagram-js/issues/661";function gn(e,t){var n=this;this._config=e=e||{},this._eventBus=t,this._keydownHandler=this._keydownHandler.bind(this),this._keyupHandler=this._keyupHandler.bind(this),t.on("diagram.destroy",function(){n._fire("destroy"),n.unbind()}),e.bindTo&&console.error("unsupported configuration <keyboard.bindTo>",new Error(Ov));var i=e&&e.bind!==!1;t.on("canvas.init",function(r){n._target=r.svg,i&&n.bind(),n._fire("init")})}gn.$inject=["config.keyboard","eventBus"],gn.prototype._keydownHandler=function(e){this._keyHandler(e,$c)},gn.prototype._keyupHandler=function(e){this._keyHandler(e,dM)},gn.prototype._keyHandler=function(e,t){var n;if(!this._isEventIgnored(e)){var i={keyEvent:e};n=this._eventBus.fire(t||$c,i),n&&e.preventDefault()}},gn.prototype._isEventIgnored=function(e){return!1},gn.prototype.bind=function(e){e&&console.error("unsupported argument <node>",new Error(Ov)),this.unbind(),e=this._node=this._target,Oe.bind(e,"keydown",this._keydownHandler),Oe.bind(e,"keyup",this._keyupHandler),this._fire("bind")},gn.prototype.getBinding=function(){return this._node},gn.prototype.unbind=function(){var e=this._node;e&&(this._fire("unbind"),Oe.unbind(e,"keydown",this._keydownHandler),Oe.unbind(e,"keyup",this._keyupHandler)),this._node=null},gn.prototype._fire=function(e){this._eventBus.fire("keyboard."+e,{node:this._node})},gn.prototype.addListener=function(e,t,n){qt(e)&&(n=t,t=e,e=hM),this._eventBus.on(n||$c,e,t)},gn.prototype.removeListener=function(e,t){this._eventBus.off(t||$c,e)},gn.prototype.hasModifier=IP,gn.prototype.isCmd=Mn,gn.prototype.isShift=Ep,gn.prototype.isKey=Gt;var mM=500;function Do(e,t){var n=this;e.on("editorActions.init",mM,function(i){var r=i.editorActions;n.registerBindings(t,r)})}Do.$inject=["eventBus","keyboard"],Do.prototype.registerBindings=function(e,t){function n(i,r){t.isRegistered(i)&&e.addListener(r)}n("undo",function(i){var r=i.keyEvent;if(FP(r))return t.trigger("undo"),!0}),n("redo",function(i){var r=i.keyEvent;if(HP(r))return t.trigger("redo"),!0}),n("copy",function(i){var r=i.keyEvent;if(NP(r))return t.trigger("copy"),!0}),n("paste",function(i){var r=i.keyEvent;if(BP(r))return t.trigger("paste"),!0}),n("duplicate",function(i){var r=i.keyEvent;if($P(r))return t.trigger("duplicate"),!0}),n("cut",function(i){var r=i.keyEvent;if(jP(r))return t.trigger("cut"),!0}),n("stepZoom",function(i){var r=i.keyEvent;if(Gt(["+","Add","="],r)&&Mn(r))return t.trigger("stepZoom",{value:1}),!0}),n("stepZoom",function(i){var r=i.keyEvent;if(Gt(["-","Subtract"],r)&&Mn(r))return t.trigger("stepZoom",{value:-1}),!0}),n("zoom",function(i){var r=i.keyEvent;if(Gt("0",r)&&Mn(r))return t.trigger("zoom",{value:1}),!0}),n("removeSelection",function(i){var r=i.keyEvent;if(Gt(["Backspace","Delete","Del"],r))return t.trigger("removeSelection"),!0})};const nf={__init__:["keyboard","keyboardBindings"],keyboard:["type",gn],keyboardBindings:["type",Do]};var gM={moveSpeed:50,moveSpeedAccelerated:200};function Dv(e,t,n){var i=this;this._config=N({},gM,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})}}Dv.$inject=["config.keyboardMove","keyboard","canvas"];const Lv={__depends__:[nf],__init__:["keyboardMove"],keyboardMove:["type",Dv]};var yM=15;function Iv(e,t){var n;function i(s){return a(s.originalEvent)}e.on("canvas.focus.changed",function(s){s.focused?e.on("element.mousedown",500,i):e.off("element.mousedown",i)});function r(s){var c=n.start,u=n.button,l=$r(s),f=ri(l,c);if(!n.dragging&&vM(f)>yM&&(n.dragging=!0,u===0&&cy(e),pc("grab")),n.dragging){var p=n.last||n.start;f=ri(l,p),t.scroll({dx:f.x,dy:f.y}),n.last=l}s.preventDefault()}function o(s){Oe.unbind(document,"mousemove",r),Oe.unbind(document,"mouseup",o),n=null,sy()}function a(s){if(!Or(s.target,".djs-draggable")){var c=s.button;if(!(c>=2||s.ctrlKey||s.shiftKey||s.altKey))return n={button:c,start:$r(s)},Oe.bind(document,"mousemove",r),Oe.bind(document,"mouseup",o),!0}}this.isActive=function(){return!!n}}Iv.$inject=["eventBus","canvas"];function vM(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}const Nv={__init__:["moveCanvas"],moveCanvas:["type",Iv]};function Bv(e,t){var n=bl(e.min),i=bl(e.max),r=Math.abs(n)+Math.abs(i);return r/t}function _M(e,t){return Math.max(e.min,Math.min(e.max,t))}var bM=Math.sign||function(e){return e>=0?1:-1},rf={min:.2,max:4},$v=10,xM=.1,wM=.75;function bi(e,t,n){e=e||{},this._enabled=!1,this._canvas=n,this._container=n._container,this._handleWheel=bn(this._handleWheel,this),this._totalDelta=0,this._scale=e.scale||wM;var i=this;t.on("canvas.mouseover",function(){i._init(e.enabled!==!1)}),t.on("canvas.mouseout",function(){i._init(!1)})}bi.$inject=["config.zoomScroll","eventBus","canvas"],bi.prototype.scroll=function(t){this._canvas.scroll(t)},bi.prototype.reset=function(){this._canvas.zoom("fit-viewport")},bi.prototype.zoom=function(t,n){var i=Bv(rf,$v*2);this._totalDelta+=t,Math.abs(this._totalDelta)>xM&&(this._zoom(t,n,i),this._totalDelta=0)},bi.prototype._handleWheel=function(t){if(this._enabled){var n=this._container;t.preventDefault();var i=t.ctrlKey||mg()&&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))*bM(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)}},bi.prototype.stepZoom=function(t,n){var i=Bv(rf,$v);this._zoom(t,n,i)},bi.prototype._zoom=function(e,t,n){var i=this._canvas,r=e>0?1:-1,o=bl(i.zoom()),a=Math.round(o/n)*n;a+=n*r;var s=Math.pow(10,a);i.zoom(_M(rf,s),t)},bi.prototype.toggle=function(t){var n=this._container,i=this._handleWheel,r=this._enabled;return typeof t>"u"&&(t=!r),r!==t&&Oe[t?"bind":"unbind"](n,"wheel",i,!1),this._enabled=t,t},bi.prototype._init=function(e){this.toggle(e)};const jv={__init__:["zoomScroll"],zoomScroll:["type",bi]};function Ia(e){vr.call(this,e)}se(Ia,vr),Ia.prototype._navigationModules=[Lv,Nv,jv],Ia.prototype._modules=[].concat(vr.prototype._modules,Ia.prototype._navigationModules);function of(e){return e&&e[e.length-1]}function Fv(e){return e.y}function Hv(e){return e.x}var EM={left:Hv,center:Hv,right:function(e){return e.x+e.width},top:Fv,middle:Fv,bottom:function(e){return e.y+e.height}};function Lo(e,t){this._modeling=e,this._rules=t}Lo.$inject=["modeling","rules"],Lo.prototype._getOrientationDetails=function(e){var t=["top","bottom","middle"],n="x",i="width";return t.indexOf(e)!==-1&&(n="y",i="height"),{axis:n,dimension:i}},Lo.prototype._isType=function(e,t){return t.indexOf(e)!==-1},Lo.prototype._alignmentPosition=function(e,t){var n=this._getOrientationDetails(e),i=n.axis,r=n.dimension,o={},a={},s=!1,c,u,l;function f(p,d){return Math.round((p[i]+d[i]+d[r])/2)}if(this._isType(e,["left","top"]))o[e]=t[0][i];else if(this._isType(e,["right","bottom"]))l=of(t),o[e]=l[i]+l[r];else if(this._isType(e,["center","middle"])){if(k(t,function(p){var d=p[i]+Math.round(p[r]/2);a[d]?a[d].elements.push(p):a[d]={elements:[p],center:d}}),c=ai(a,function(p){return p.elements.length>1&&(s=!0),p.elements.length}),s)return o[e]=of(c).center,o;u=t[0],t=ai(t,function(p){return p[i]+p[r]}),l=of(t),o[e]=f(u,l)}return o},Lo.prototype.trigger=function(e,t){var n=this._modeling,i,r=He(e,function(c){return!(c.waypoints||c.host||c.labelTarget)});if(i=this._rules.allowed("elements.align",{elements:r}),Ce(i)&&(r=i),!(r.length<2||!i)){var o=EM[t],a=ai(r,o),s=this._alignmentPosition(t,a);n.alignElements(a,s)}};const SM={__init__:["alignElements"],alignElements:["type",Lo]},RM=new To;function Io(e){this._scheduled={},e.on("diagram.destroy",()=>{Object.keys(this._scheduled).forEach(t=>{this.cancel(t)})})}Io.$inject=["eventBus"],Io.prototype.schedule=function(e,t=RM.next()){this.cancel(t);const n=this._schedule(e,t);return this._scheduled[t]=n,n.promise},Io.prototype._schedule=function(e,t){const n=CM();return{executionId:setTimeout(()=>{try{this._scheduled[t]=null;try{n.resolve(e())}catch(r){n.reject(r)}}catch(r){console.error("Scheduler#_schedule execution failed",r)}}),promise:n.promise}},Io.prototype.cancel=function(e){const t=this._scheduled[e];t&&(this._cancel(t),this._scheduled[e]=null)},Io.prototype._cancel=function(e){clearTimeout(e.executionId)};function CM(){const e={};return e.promise=new Promise((t,n)=>{e.resolve=t,e.reject=n}),e}const PM={scheduler:["type",Io]};var AM="djs-element-hidden",jc=".entry",TM=1e3,zv=8,MM=300;function Nt(e,t,n,i){this._canvas=e,this._elementRegistry=t,this._eventBus=n,this._scheduler=i,this._current=null,this._init()}Nt.$inject=["canvas","elementRegistry","eventBus","scheduler"],Nt.prototype._init=function(){var e=this;this._eventBus.on("selection.changed",function(t){var n=t.newSelection,i=n.length?n.length===1?n[0]:n:null;i?e.open(i,!0):e.close()}),this._eventBus.on("elements.changed",function(t){var n=t.elements,i=e._current;if(i){var r=i.target,o=Ce(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=Ce(i.target)?i.target:[i.target];r.includes(n)&&e._updateVisibility()}}),this._container=this._createContainer()},Nt.prototype._createContainer=function(){var e=mt('<div class="djs-context-pad-parent"></div>');return this._canvas.getContainer().appendChild(e),e},Nt.prototype.registerProvider=function(e,t){t||(t=e,e=TM),this._eventBus.on("contextPad.getProviders",e,function(n){n.providers.push(t)})},Nt.prototype.getEntries=function(e){var t=this._getProviders(),n=Ce(e)?"getMultiElementContextPadEntries":"getContextPadEntries",i={};return k(t,function(r){if(qt(r[n])){var o=r[n](e);qt(o)?i=o(i):k(o,function(a,s){i[s]=a})}}),i},Nt.prototype.trigger=function(e,t,n){var i=this,r,o,a=t.delegateTarget||t.target;if(!a)return t.preventDefault();if(r=ln(a,"data-action"),o=t.originalEvent||t,e==="mouseover"){this._timeout=setTimeout(function(){i._mouseout=i.triggerEntry(r,"hover",o,n)},MM);return}else if(e==="mouseout"){clearTimeout(this._timeout),this._mouseout&&(this._mouseout(),this._mouseout=null);return}return this.triggerEntry(r,e,o,n)},Nt.prototype.triggerEntry=function(e,t,n,i){if(this.isShown()){var r=this._current.target,o=this._current.entries,a=o[e];if(a){var s=a.action;if(this._eventBus.fire("contextPad.trigger",{entry:a,event:n})!==!1){if(qt(s)){if(t==="click")return s(n,r,i)}else if(s[t])return s[t](n,r,i);n.preventDefault()}}}},Nt.prototype.open=function(e,t){if(!(!t&&this.isOpen(e))){var n=this._eventBus.fire("contextPad.open.allowed",{target:e});n!==!1&&(this.close(),this._updateAndOpen(e))}},Nt.prototype._getProviders=function(){var e=this._eventBus.createEvent({type:"contextPad.getProviders",providers:[]});return this._eventBus.fire(e),e.providers},Nt.prototype._updateAndOpen=function(e){var t=this.getEntries(e),n=this._createHtml(e),i;k(t,function(r,o){var a=r.group||"default",s=mt(r.html||'<div class="entry" draggable="true"></div>'),c;ln(s,"data-action",o),c=st("[data-group="+La(a)+"]",n),c||(c=mt('<div class="group"></div>'),ln(c,"data-group",a),n.appendChild(c)),c.appendChild(s),r.className&&kM(s,r.className),r.title&&ln(s,"title",r.title),r.imageUrl&&(i=mt("<img>"),ln(i,"src",r.imageUrl),i.style.width="100%",i.style.height="100%",s.appendChild(i))}),bt(n).add("open"),this._current={entries:t,html:n,target:e},this._updatePosition(),this._updateVisibility(),this._eventBus.fire("contextPad.open",{current:this._current})},Nt.prototype._createHtml=function(e){var t=this,n=mt('<div class="djs-context-pad"></div>');return Pn.bind(n,jc,"click",function(i){t.trigger("click",i)}),Pn.bind(n,jc,"dragstart",function(i){t.trigger("dragstart",i)}),Pn.bind(n,jc,"mouseover",function(i){t.trigger("mouseover",i)}),Pn.bind(n,jc,"mouseout",function(i){t.trigger("mouseout",i)}),Oe.bind(n,"mousedown",function(i){i.stopPropagation()}),this._container.appendChild(n),this._eventBus.fire("contextPad.create",{target:e,pad:n}),n},Nt.prototype.getPad=function(e){console.warn(new Error("ContextPad#getPad is deprecated and will be removed in future library versions, cf. https://github.com/bpmn-io/diagram-js/pull/888"));let t;return this.isOpen()&&DM(this._current.target,e)?t=this._current.html:t=this._createHtml(e),{html:t}},Nt.prototype.close=function(){this.isOpen()&&(clearTimeout(this._timeout),this._container.innerHTML="",this._eventBus.fire("contextPad.close",{current:this._current}),this._current=null)},Nt.prototype.isOpen=function(e){var t=this._current;if(!t)return!1;if(!e)return!0;var n=t.target;return Ce(e)!==Ce(n)?!1:Ce(e)?e.length===n.length&&Pr(e,function(i){return n.includes(i)}):n===e},Nt.prototype.isShown=function(){return this.isOpen()&&bt(this._current.html).has("open")},Nt.prototype.show=function(){this.isOpen()&&(bt(this._current.html).add("open"),this._updatePosition(),this._eventBus.fire("contextPad.show",{current:this._current}))},Nt.prototype.hide=function(){this.isOpen()&&(bt(this._current.html).remove("open"),this._eventBus.fire("contextPad.hide",{current:this._current}))},Nt.prototype._getPosition=function(e){if(!Ce(e)&&ut(e)){var t=this._canvas.viewbox(),n=OM(e),i=n.x*t.scale-t.x*t.scale,r=n.y*t.scale-t.y*t.scale;return{left:i+zv*this._canvas.zoom(),top:r}}var o=this._canvas.getContainer(),a=o.getBoundingClientRect(),s=this._getTargetBounds(e);return{left:s.right-a.left+zv*this._canvas.zoom(),top:s.top-a.top}},Nt.prototype._updatePosition=function(){const e=()=>{if(this.isOpen()){var t=this._current.html,n=this._getPosition(this._current.target);"x"in n&&"y"in n?(t.style.left=n.x+"px",t.style.top=n.y+"px"):["top","right","bottom","left"].forEach(function(i){i in n&&(t.style[i]=n[i]+"px")})}};this._scheduler.schedule(e,"ContextPad#_updatePosition")},Nt.prototype._updateVisibility=function(){const e=()=>{if(this.isOpen()){var t=this,n=this._current.target,i=Ce(n)?n:[n],r=i.some(function(o){return t._canvas.hasMarker(o,AM)});r?t.hide():t.show()}};this._scheduler.schedule(e,"ContextPad#_updateVisibility")},Nt.prototype._getTargetBounds=function(e){var t=this,n=Ce(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 kM(e,t){var n=bt(e);t=Ce(t)?t:t.split(/\s+/g),t.forEach(function(i){n.add(i)})}function OM(e){return e.waypoints[e.waypoints.length-1]}function DM(e,t){return e=Ce(e)?e:[e],t=Ce(t)?t:[t],e.length===t.length&&Pr(e,function(n){return t.includes(n)})}const Gv={__depends__:[lc,PM,Nc],contextPad:["type",Nt]};var Fc,St,Vv,_r,Wv,Uv,qv,af,Hc,Na,Yv,sf,cf,uf,zc={},Gc=[],LM=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,Vc=Array.isArray;function Hi(e,t){for(var n in t)e[n]=t[n];return e}function lf(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function Kv(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?Fc.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 Wc(e,a,i,r,null)}function Wc(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??++Vv,__i:-1,__u:0};return r==null&&St.vnode!=null&&St.vnode(o),o}function Uc(e){return e.children}function qc(e,t){this.props=e,this.context=t}function Wr(e,t){if(t==null)return e.__?Wr(e.__,e.__i+1):null;for(var n;t<e.__k.length;t++)if((n=e.__k[t])!=null&&n.__e!=null)return n.__e;return typeof e.type=="function"?Wr(e):null}function IM(e){if(e.__P&&e.__d){var t=e.__v,n=t.__e,i=[],r=[],o=Hi({},t);o.__v=t.__v+1,St.vnode&&St.vnode(o),pf(e.__P,o,t,e.__n,e.__P.namespaceURI,32&t.__u?[n]:null,i,n??Wr(t),!!(32&t.__u),r),o.__v=t.__v,o.__.__k[o.__i]=o,i_(i,o,r),t.__e=t.__=null,o.__e!=n&&Xv(o)}}function Xv(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}),Xv(e)}function Zv(e){(!e.__d&&(e.__d=!0)&&_r.push(e)&&!Yc.__r++||Wv!=St.debounceRendering)&&((Wv=St.debounceRendering)||Uv)(Yc)}function Yc(){try{for(var e,t=1;_r.length;)_r.length>t&&_r.sort(qv),e=_r.shift(),t=_r.length,IM(e)}finally{_r.length=Yc.__r=0}}function Qv(e,t,n,i,r,o,a,s,c,u,l){var f,p,d,h,m,g,S=i&&i.__k||Gc,E=t.length;for(c=NM(n,t,S,c,E),f=0;f<E;f++)(d=n.__k[f])!=null&&(p=d.__i!=-1&&S[d.__i]||zc,d.__i=f,g=pf(e,d,p,r,o,a,s,c,u,l),h=d.__e,d.ref&&p.ref!=d.ref&&(p.ref&&ff(p.ref,null,d),l.push(d.ref,d.__c||h,d)),m==null&&h!=null&&(m=h),4&d.__u?(c=Jv(d,c,e),p.__e&&(p.__e=null)):typeof d.type=="function"&&g!==void 0?c=g:h&&(c=h.nextSibling),d.__u&=-7);return n.__e=m,c}function NM(e,t,n,i,r){var o,a,s,c,u,l=n.length,f=l,p=0;for(e.__k=new Array(r),o=0;o<r;o++)(a=t[o])!=null&&typeof a!="boolean"&&typeof a!="function"?(typeof a=="string"||typeof a=="number"||typeof a=="bigint"||a.constructor==String?a=e.__k[o]=Wc(null,a,null,null,null):Vc(a)?a=e.__k[o]=Wc(Uc,{children:a},null,null,null):a.constructor===void 0&&a.__b>0?a=e.__k[o]=Wc(a.type,a.props,a.key,a.ref?a.ref:null,a.__v):e.__k[o]=a,c=o+p,a.__=e,a.__b=e.__b+1,s=null,(u=a.__i=BM(a,n,c,f))!=-1&&(f--,(s=n[u])&&(s.__u|=2)),s==null||s.__v==null?(u==-1&&(r>l?p--:r<l&&p++),typeof a.type!="function"&&(a.__u|=4)):u!=c&&(u==c-1?p--:u==c+1?p++:(u>c?p--:p++,a.__u|=4))):e.__k[o]=null;if(f)for(o=0;o<l;o++)(s=n[o])!=null&&(2&s.__u)==0&&(s.__e==i&&(i=Wr(s)),o_(s,s));return i}function Jv(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=Jv(i[r],t,n));return t}e.__e!=t&&(t&&e.type&&!t.parentNode&&(t=Wr(e)),t=n.insertBefore(e.__e,t||null));do t=t&&t.nextSibling;while(t!=null&&t.nodeType==8);return t}function BM(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 e_(e,t,n){t[0]=="-"?e.setProperty(t,n??""):e[t]=n==null?"":typeof n!="number"||LM.test(t)?n:n+"px"}function Kc(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||e_(e.style,t,"");if(n)for(t in n)i&&n[t]==i[t]||e_(e.style,t,n[t])}else if(t[0]=="o"&&t[1]=="n")o=t!=(t=t.replace(Yv,"$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[Na]=i[Na]:(n[Na]=sf,e.addEventListener(t,o?uf:cf,o)):e.removeEventListener(t,o?uf:cf,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 t_(e){return function(t){if(this.l){var n=this.l[t.type+e];if(t[Hc]==null)t[Hc]=sf++;else if(t[Hc]<n[Na])return;return n(St.event?St.event(t):t)}}}function pf(e,t,n,i,r,o,a,s,c,u){var l,f,p,d,h,m,g,S,E,x,w,C,T,B,M,z,G=t.type;if(t.constructor!==void 0)return null;128&n.__u&&(c=!!(32&n.__u),o=[s=t.__e=n.__e]),(l=St.__b)&&l(t);e:if(typeof G=="function"){f=a.length;try{if(E=t.props,x=G.prototype&&G.prototype.render,w=(l=G.contextType)&&i[l.__c],C=l?w?w.props.value:l.__:i,n.__c?S=(p=t.__c=n.__c).__=p.__E:(x?t.__c=p=new G(E,C):(t.__c=p=new qc(E,C),p.constructor=G,p.render=jM),w&&w.sub(p),p.state||(p.state={}),p.__n=i,d=p.__d=!0,p.__h=[],p._sb=[]),x&&p.__s==null&&(p.__s=p.state),x&&G.getDerivedStateFromProps!=null&&(p.__s==p.state&&(p.__s=Hi({},p.__s)),Hi(p.__s,G.getDerivedStateFromProps(E,p.__s))),h=p.props,m=p.state,p.__v=t,d)x&&G.getDerivedStateFromProps==null&&p.componentWillMount!=null&&p.componentWillMount(),x&&p.componentDidMount!=null&&p.__h.push(p.componentDidMount);else{if(x&&G.getDerivedStateFromProps==null&&E!==h&&p.componentWillReceiveProps!=null&&p.componentWillReceiveProps(E,C),t.__v==n.__v||!p.__e&&p.shouldComponentUpdate!=null&&p.shouldComponentUpdate(E,p.__s,C)===!1){t.__v!=n.__v&&(p.props=E,p.state=p.__s,p.__d=!1),t.__e=n.__e,t.__k=n.__k,t.__k.some(function($){$&&($.__=t)}),Gc.push.apply(p.__h,p._sb),p._sb=[],p.__h.length&&a.push(p),s=Wr(n);break e}p.componentWillUpdate!=null&&p.componentWillUpdate(E,p.__s,C),x&&p.componentDidUpdate!=null&&p.__h.push(function(){p.componentDidUpdate(h,m,g)})}if(p.context=C,p.props=E,p.__P=e,p.__e=!1,T=St.__r,B=0,x)p.state=p.__s,p.__d=!1,T&&T(t),l=p.render(p.props,p.state,p.context),Gc.push.apply(p.__h,p._sb),p._sb=[];else do p.__d=!1,T&&T(t),l=p.render(p.props,p.state,p.context),p.state=p.__s;while(p.__d&&++B<25);p.state=p.__s,p.getChildContext!=null&&(i=Hi(Hi({},i),p.getChildContext())),x&&!d&&p.getSnapshotBeforeUpdate!=null&&(g=p.getSnapshotBeforeUpdate(h,m)),M=l!=null&&l.type===Uc&&l.key==null?r_(l.props.children):l,s=Qv(e,Vc(M)?M:[M],t,n,i,r,o,a,s,c,u),p.base=t.__e,t.__u&=-161,p.__h.length&&a.push(p),S&&(p.__E=p.__=null)}catch($){if(a.length=f,t.__v=null,c||o!=null){if($.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(z=o.length;z--;)lf(o[z])}else t.__e=n.__e;t.__k==null&&(t.__k=n.__k||[]),$.then||n_(t),St.__e($,t,n)}}else o==null&&t.__v==n.__v?(t.__k=n.__k,t.__e=n.__e):s=t.__e=$M(n.__e,t,n,i,r,o,a,c,u);return(l=St.diffed)&&l(t),128&t.__u?void 0:s}function n_(e){e&&(e.__c&&(e.__c.__e=!0),e.__k&&e.__k.some(n_))}function i_(e,t,n){for(var i=0;i<n.length;i++)ff(n[i],n[++i],n[++i]);St.__c&&St.__c(t,e),e.some(function(r){try{e=r.__h,r.__h=[],e.some(function(o){o.call(r)})}catch(o){St.__e(o,r.__v)}})}function r_(e){return typeof e!="object"||e==null||e.__b>0?e:Vc(e)?e.map(r_):e.constructor!==void 0?null:Hi({},e)}function $M(e,t,n,i,r,o,a,s,c){var u,l,f,p,d,h,m,g=n.props||zc,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&&(St.__m&&St.__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&&Fc.call(e.childNodes),!s&&o!=null)for(g={},u=0;u<e.attributes.length;u++)g[(d=e.attributes[u]).name]=d.value;for(u in g)d=g[u],u=="dangerouslySetInnerHTML"?f=d:u=="children"||u in S||u=="value"&&"defaultValue"in S||u=="checked"&&"defaultChecked"in S||Kc(e,u,null,d,r);for(u in S)d=S[u],u=="children"?p=d:u=="dangerouslySetInnerHTML"?l=d:u=="value"?h=d:u=="checked"?m=d:s&&typeof d!="function"||g[u]===d||Kc(e,u,d,g[u],r);if(l)s||f&&(l.__html==f.__html||l.__html==e.innerHTML)||(e.innerHTML=l.__html),t.__k=[];else if(f&&(e.innerHTML=""),Qv(t.type=="template"?e.content:e,Vc(p)?p:[p],t,n,i,E=="foreignObject"?"http://www.w3.org/1999/xhtml":r,o,a,o?o[0]:n.__k&&Wr(n,0),s,c),o!=null)for(u=o.length;u--;)lf(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])&&Kc(e,u,h,g[u],r),u="checked",m!=null&&m!=e[u]&&Kc(e,u,m,g[u],r))}return e}function ff(e,t,n){try{if(typeof e=="function"){var i=typeof e.__u=="function";i&&e.__u(),i&&t==null||(e.__u=e(t))}else e.current=t}catch(r){St.__e(r,n)}}function o_(e,t,n){var i,r;if(St.unmount&&St.unmount(e),(i=e.ref)&&(i.current&&i.current!=e.__e||ff(i,null,t)),(i=e.__c)!=null){if(i.componentWillUnmount)try{i.componentWillUnmount()}catch(o){St.__e(o,t)}i.base=i.__P=i.__n=null}if(i=e.__k)for(r=0;r<i.length;r++)i[r]&&o_(i[r],t,n||typeof e.type!="function");n||lf(e.__e),e.__c=e.__=e.__e=void 0}function jM(e,t,n){return this.constructor(e,n)}function a_(e,t,n){var i,r,o,a;t==document&&(t=document.documentElement),St.__&&St.__(e,t),r=(i=!1)?null:t.__k,o=[],a=[],pf(t,e=t.__k=Kv(Uc,null,[e]),r||zc,zc,t.namespaceURI,r?null:t.firstChild?Fc.call(t.childNodes):null,o,r?r.__e:t.firstChild,i,a),i_(o,e,a),e.props.children=null}Fc=Gc.slice,St={__e:function(e,t,n,i){for(var r,o,a;t=t.__;)if((r=t.__c)&&!r.__)try{if((o=r.constructor)&&o.getDerivedStateFromError!=null&&(r.setState(o.getDerivedStateFromError(e)),a=r.__d),r.componentDidCatch!=null&&(r.componentDidCatch(e,i||{}),a=r.__d),a)return r.__E=r}catch(s){e=s}throw e}},Vv=0,qc.prototype.setState=function(e,t){var n;n=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=Hi({},this.state),typeof e=="function"&&(e=e(Hi({},n),this.props)),e&&Hi(n,e),e!=null&&this.__v&&(t&&this._sb.push(t),Zv(this))},qc.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),Zv(this))},qc.prototype.render=Uc,_r=[],Uv=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,qv=function(e,t){return e.__v.__b-t.__v.__b},Yc.__r=0,af=Math.random().toString(8),Hc="__d"+af,Na="__a"+af,Yv=/(PointerCapture)$|Capture$/i,sf=0,cf=t_(!1),uf=t_(!0);var s_=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,s_(e,s,n,["",null])),i.push(r),s[0]?t[0]|=2:(t[o-2]=0,t[o]=r)):i.push(s)}return i},c_=new Map;function FM(e){var t=c_.get(this);return t||(t=new Map,c_.set(this,t)),(t=s_(this,t.get(e)||(t.set(e,t=(function(n){for(var i,r,o=1,a="",s="",c=[0],u=function(p){o===1&&(p||(a=a.replace(/^\s*\n\s*|\s*\n\s*$/g,"")))?c.push(0,p,a):o===3&&(p||a)?(c.push(3,p,a),o=2):o===2&&a==="..."&&p?c.push(4,p,0):o===2&&a&&!p?c.push(5,0,!0,a):o>=5&&((a||!p&&o===5)&&(c.push(o,0,a,r),o=6),p&&(c.push(o,p,0,r),o=6)),a=""},l=0;l<n.length;l++){l&&(o===1&&u(),u(l));for(var f=0;f<n[l].length;f++)i=n[l][f],o===1?i==="<"?(u(),c=[c],o=3):a+=i:o===4?a==="--"&&i===">"?(o=1,a=""):a=i+a[0]:s?i===s?s="":a+=i:i==='"'||i==="'"?s=i:i===">"?(u(),o=1):o&&(i==="="?(o=5,r=a,a=""):i==="/"&&(o<5||n[l][f+1]===">")?(u(),o===3&&(c=c[0]),o=c,(c=c[0]).push(2,0,o),o=0):i===" "||i===" "||i===`
|
|
11
|
-
`||i==="\r"?(u(),o=2):a+=i),o===3&&a==="!--"&&(o=4,c=c[0])}return u(),c})(e)),t),arguments,[])).length>1?t:t[0]}var
|
|
10
|
+
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="`+p+'" height="'+d+'" viewBox="'+l+" "+f+" "+p+" "+d+'" version="1.1">'+s+a+"</svg>"}catch(i){n=i}if(this._emit("saveSVG.done",{error:n,svg:t}),n)throw n;return{svg:t}},xt.prototype._setDefinitions=function(e){this._definitions=e},xt.prototype.getModules=function(){return this._modules},xt.prototype.clear=function(){this.getDefinitions()&&rr.prototype.clear.call(this)},xt.prototype.destroy=function(){rr.prototype.destroy.call(this),fi(this._container)},xt.prototype.on=function(e,t,n,i){return this.get("eventBus").on(e,t,n,i)},xt.prototype.off=function(e,t){this.get("eventBus").off(e,t)},xt.prototype.attachTo=function(e){if(!e)throw new Error("parentNode required");this.detach(),e.get&&e.constructor.prototype.jquery&&(e=e.get(0)),typeof e=="string"&&(e=rt(e)),e.appendChild(this._container),this._emit("attach",{}),this.get("canvas").resized()},xt.prototype.getDefinitions=function(){return this._definitions},xt.prototype.detach=function(){const e=this._container,t=e.parentNode;t&&(this._emit("detach",{}),t.removeChild(e))},xt.prototype._init=function(e,t,n){const i=n.modules||this.getModules(n),r=n.additionalModules||[],o=[{bpmnjs:["value",this],moddle:["value",t]}],a=[].concat(o,i,r),s=j(si(n,["additionalModules"]),{canvas:j({},n.canvas,{container:e}),modules:a});rr.call(this,s),n&&n.container&&this.attachTo(n.container)},xt.prototype._emit=function(e,t){return this.get("eventBus").fire(e,t)},xt.prototype._createContainer=function(e){const t=dt('<div class="bjs-container"></div>');return mn(t,{width:gm(e.width),height:gm(e.height),position:e.position}),t},xt.prototype._createModdle=function(e){const t=j({},this._moddleExtensions,e.moddleExtensions);return new bd(t)},xt.prototype._modules=[];function Ds(e,t){return e.warnings=t,e}function SS(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 RS={width:"100%",height:"100%",position:"relative"};function gm(e){return e+(Ce(e)?"px":"")}function CS(e,t){return t&<(e.diagrams,function(n){return n.id===t})||null}function PS(e){const n='<a href="http://bpmn.io" target="_blank" class="bjs-powered-by" title="Powered by bpmn.io" >'+fm+"</a>",i=dt(n);mn(rt("svg",i),dm),mn(i,hm,{position:"absolute",bottom:"15px",right:"15px",zIndex:"100"}),e.appendChild(i),Te.bind(i,"click",function(r){ES(),r.preventDefault()})}function mo(e){xt.call(this,e),this.on("import.parse.complete",function(t){t.error||this._collectIds(t.definitions,t.elementsById)},this),this.on("diagram.destroy",function(){this.get("moddle").ids.clear()},this)}se(mo,xt),mo.prototype._createModdle=function(e){var t=xt.prototype._createModdle.call(this,e);return t.ids=new pi([32,36,1]),t},mo.prototype._collectIds=function(e,t){var n=e.$model,i=n.ids,r;i.clear();for(r in t)i.claim(r,t[r])};function Ge(e,t){return v(e,"bpmn:CallActivity")?!1:v(e,"bpmn:SubProcess")?(t=t||Ye(e),t&&v(t,"bpmndi:BPMNPlane")?!0:t&&!!t.isExpanded):v(e,"bpmn:Participant")?!!J(e).processRef:!0}function Yt(e){if(!(!v(e,"bpmn:Participant")&&!v(e,"bpmn:Lane"))){var t=Ye(e).isHorizontal;return t===void 0?!0:t}}function AS(e){return e&&J(e).isInterrupting!==!1}function fn(e){return e&&!!J(e).triggeredByEvent}function go(e,t){var n=J(e).eventDefinitions;return Yi(n,function(i){return v(i,t)})}function TS(e){return go(e,"bpmn:ErrorEventDefinition")}function MS(e){return go(e,"bpmn:EscalationEventDefinition")}function kS(e){return go(e,"bpmn:CompensateEventDefinition")}var Nr={width:90,height:20},ym=15;function or(e){return v(e,"bpmn:Event")||v(e,"bpmn:Gateway")||v(e,"bpmn:DataStoreReference")||v(e,"bpmn:DataObjectReference")||v(e,"bpmn:DataInput")||v(e,"bpmn:DataOutput")||v(e,"bpmn:SequenceFlow")||v(e,"bpmn:MessageFlow")||v(e,"bpmn:Group")}function Ls(e){return Ne(e.label)}function OS(e){var t=e.length/2-1,n=e[Math.floor(t)],i=e[Math.ceil(t+.01)],r=DS(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-=ym:a+=ym,{x:a,y:s}}function DS(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 vl(e){return e.waypoints?OS(e.waypoints):v(e,"bpmn:Group")?{x:e.x+e.width/2,y:e.y+Nr.height/2}:{x:e.x+e.width/2,y:e.y+e.height+Nr.height/2}}function LS(e,t){var n,i,r,o=e.label;return o&&o.bounds?(r=o.bounds,i={width:Math.max(Nr.width,r.width),height:r.height},n={x:r.x+r.width/2,y:r.y+r.height/2}):(n=vl(t),i=Nr),j({x:n.x-i.width/2,y:n.y-i.height/2},i)}function vm(e){if(v(e,"bpmn:FlowElement")||v(e,"bpmn:Participant")||v(e,"bpmn:Lane")||v(e,"bpmn:SequenceFlow")||v(e,"bpmn:MessageFlow")||v(e,"bpmn:DataInput")||v(e,"bpmn:DataOutput"))return"name";if(v(e,"bpmn:TextAnnotation"))return"text";if(v(e,"bpmn:Group"))return"categoryValueRef"}function IS(e){var t=e.categoryValueRef;return t&&t.value||""}function $n(e){var t=e.businessObject,n=vm(t);if(n)return n==="categoryValueRef"?IS(t):t[n]||""}function NS(e,t){var n=e.businessObject,i=vm(n);if(i)if(i==="categoryValueRef"){if(!n[i])return e;n[i].value=t}else n[i]=t;return e}function BS(e){return Ne(e)&&or(e.labelTarget)}var yo=7;function _m(e){let t=[];return D(e.incoming,n=>{v(n,"bpmn:Association")&&v(n.source,"bpmn:TextAnnotation")&&t.push({annotation:n.source,association:n})}),D(e.outgoing,n=>{v(n,"bpmn:Association")&&v(n.target,"bpmn:TextAnnotation")&&t.push({annotation:n.target,association:n})}),t}function oa(e){const t=new Map;return D(pl(e),n=>{D(_m(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 _l="hsl(225, 10%, 15%)",$S="white";function gi(e,t){return Yi(e.eventDefinitions,function(n){return n.$type===t})}function jS(e){return e.$type==="bpmn:IntermediateThrowEvent"||e.$type==="bpmn:EndEvent"}function FS(e){var t=e.dataObjectRef;return e.isCollection||t&&t.isCollection}function ze(e,t,n){var i=Ye(e);return n||i.get("color:background-color")||i.get("bioc:fill")||t||$S}function ae(e,t,n){var i=Ye(e);return n||i.get("color:border-color")||i.get("bioc:stroke")||t||_l}function aa(e,t,n,i){var r=Ye(e),o=r.get("label");return i||o&&o.get("color:color")||t||ae(e,n)}function bm(e){var t=e.x+e.width/2,n=e.y+e.height/2,i=e.width/2,r=[["M",t,n],["m",0,-i],["a",i,i,0,1,1,0,2*i],["a",i,i,0,1,1,0,-2*i],["z"]];return Dr(r)}function bl(e,t){var n=e.x,i=e.y,r=e.width,o=e.height,a=[["M",n+t,i],["l",r-t*2,0],["a",t,t,0,0,1,t,t],["l",0,o-t*2],["a",t,t,0,0,1,-t,t],["l",t*2-r,0],["a",t,t,0,0,1,-t,-t],["l",0,t*2-o],["a",t,t,0,0,1,t,-t],["z"]];return Dr(a)}function HS(e){var t=e.width,n=e.height,i=e.x,r=e.y,o=t/2,a=n/2,s=[["M",i+o,r],["l",o,a],["l",-o,a],["l",-o,-a],["z"]];return Dr(s)}function zS(e){var t=e.x,n=e.y,i=e.width,r=e.height,o=[["M",t,n],["l",i,0],["l",0,r],["l",-i,0],["z"]];return Dr(o)}function sa(e,t={}){return{width:Gn(e,t),height:Tn(e,t)}}function Gn(e,t={}){return Sn(t,"width")?t.width:e.width}function Tn(e,t={}){return Sn(t,"height")?t.height:e.height}var GS=new pi,VS=10,Is=3,WS=1.5,Ns=10,US=4,vo=.95,qS=1,YS=.25;function Br(e,t,n,i,r,o,a){Oi.call(this,t,a);var s=e&&e.defaultFillColor,c=e&&e.defaultStrokeColor,u=e&&e.defaultLabelColor;function l(A){return n.computeStyle(A,{strokeLinecap:"round",strokeLinejoin:"round",stroke:_l,strokeWidth:2,fill:"white"})}function f(A){return n.computeStyle(A,["no-fill"],{strokeLinecap:"round",strokeLinejoin:"round",stroke:_l,strokeWidth:2})}function p(A,_){var{ref:y={x:0,y:0},scale:I=1,element:H,parentGfx:U=r._svg}=_,ue=ge("marker",{id:A,viewBox:"0 0 20 20",refX:y.x,refY:y.y,markerWidth:20*I,markerHeight:20*I,orient:"auto"});ke(ue,H);var Le=rt(":scope > defs",U);Le||(Le=ge("defs"),ke(U,Le)),ke(Le,ue)}function d(A,_,y,I){var H=GS.nextPrefixed("marker-");return h(A,H,_,y,I),"url(#"+H+")"}function h(A,_,y,I,H){if(y==="sequenceflow-end"){var U=ge("path",{d:"M 1 5 L 11 10 L 1 15 Z",...l({fill:H,stroke:H,strokeWidth:1})});p(_,{element:U,ref:{x:11,y:10},scale:.5,parentGfx:A})}if(y==="messageflow-start"){var ue=ge("circle",{cx:6,cy:6,r:3.5,...l({fill:I,stroke:H,strokeWidth:1,strokeDasharray:[1e4,1]})});p(_,{element:ue,ref:{x:6,y:6},parentGfx:A})}if(y==="messageflow-end"){var Le=ge("path",{d:"m 1 5 l 0 -3 l 7 3 l -7 3 z",...l({fill:I,stroke:H,strokeWidth:1,strokeDasharray:[1e4,1]})});p(_,{element:Le,ref:{x:8.5,y:5},parentGfx:A})}if(y==="association-start"){var Xe=ge("path",{d:"M 11 5 L 1 10 L 11 15",...f({fill:"none",stroke:H,strokeWidth:1.5,strokeDasharray:[1e4,1]})});p(_,{element:Xe,ref:{x:1,y:10},scale:.5,parentGfx:A})}if(y==="association-end"){var At=ge("path",{d:"M 1 5 L 11 10 L 1 15",...f({fill:"none",stroke:H,strokeWidth:1.5,strokeDasharray:[1e4,1]})});p(_,{element:At,ref:{x:11,y:10},scale:.5,parentGfx:A})}if(y==="conditional-flow-marker"){var Je=ge("path",{d:"M 0 10 L 8 6 L 16 10 L 8 14 Z",...l({fill:I,stroke:H})});p(_,{element:Je,ref:{x:-1,y:10},scale:.5,parentGfx:A})}if(y==="conditional-default-flow-marker"){var Wt=ge("path",{d:"M 6 4 L 10 16",...l({stroke:H,fill:"none"})});p(_,{element:Wt,ref:{x:0,y:10},scale:.5,parentGfx:A})}}function m(A,_,y,I,H={}){Ut(I)&&(H=I,I=0),I=I||0,H=l(H);var U=_/2,ue=y/2,Le=ge("circle",{cx:U,cy:ue,r:Math.round((_+y)/4-I),...H});return ke(A,Le),Le}function g(A,_,y,I,H,U){Ut(H)&&(U=H,H=0),H=H||0,U=l(U);var ue=ge("rect",{x:H,y:H,width:_-H*2,height:y-H*2,rx:I,ry:I,...U});return ke(A,ue),ue}function S(A,_,y,I){var H=_/2,U=y/2,ue=[{x:H,y:0},{x:_,y:U},{x:H,y},{x:0,y:U}],Le=ue.map(function(At){return At.x+","+At.y}).join(" ");I=l(I);var Xe=ge("polygon",{...I,points:Le});return ke(A,Xe),Xe}function E(A,_,y,I){y=f(y);var H=Qo(_,y,I);return ke(A,H),H}function x(A,_,y){return E(A,_,y,5)}function w(A,_,y){y=f(y);var I=ge("path",{...y,d:_});return ke(A,I),I}function C(A,_,y,I){return w(_,y,j({"data-marker":A},I))}function P(A){return Kt[A]}function L(A){return function(_,y,I){return P(A)(_,y,I)}}var T={"bpmn:MessageEventDefinition":function(A,_,y={},I){var H=i.getScaledPath("EVENT_MESSAGE",{xScaleFactor:.9,yScaleFactor:.9,containerWidth:y.width||_.width,containerHeight:y.height||_.height,position:{mx:.235,my:.315}}),U=I?ae(_,c,y.stroke):ze(_,s,y.fill),ue=I?ze(_,s,y.fill):ae(_,c,y.stroke),Le=w(A,H,{fill:U,stroke:ue,strokeWidth:1});return Le},"bpmn:TimerEventDefinition":function(A,_,y={}){var I=y.width||_.width,H=y.height||_.height,U=y.width?1:2,ue=m(A,I,H,.2*H,{fill:ze(_,s,y.fill),stroke:ae(_,c,y.stroke),strokeWidth:U}),Le=i.getScaledPath("EVENT_TIMER_WH",{xScaleFactor:.75,yScaleFactor:.75,containerWidth:I,containerHeight:H,position:{mx:.5,my:.5}});w(A,Le,{stroke:ae(_,c,y.stroke),strokeWidth:U});for(var Xe=0;Xe<12;Xe++){var At=i.getScaledPath("EVENT_TIMER_LINE",{xScaleFactor:.75,yScaleFactor:.75,containerWidth:I,containerHeight:H,position:{mx:.5,my:.5}}),Je=I/2,Wt=H/2;w(A,At,{strokeWidth:1,stroke:ae(_,c,y.stroke),transform:"rotate("+Xe*30+","+Wt+","+Je+")"})}return ue},"bpmn:EscalationEventDefinition":function(A,_,y={},I){var H=i.getScaledPath("EVENT_ESCALATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:y.width||_.width,containerHeight:y.height||_.height,position:{mx:.5,my:.2}}),U=I?ae(_,c,y.stroke):ze(_,s,y.fill);return w(A,H,{fill:U,stroke:ae(_,c,y.stroke),strokeWidth:1})},"bpmn:ConditionalEventDefinition":function(A,_,y={}){var I=i.getScaledPath("EVENT_CONDITIONAL",{xScaleFactor:1,yScaleFactor:1,containerWidth:y.width||_.width,containerHeight:y.height||_.height,position:{mx:.5,my:.222}});return w(A,I,{fill:ze(_,s,y.fill),stroke:ae(_,c,y.stroke),strokeWidth:1})},"bpmn:LinkEventDefinition":function(A,_,y={},I){var H=i.getScaledPath("EVENT_LINK",{xScaleFactor:1,yScaleFactor:1,containerWidth:_.width,containerHeight:_.height,position:{mx:.57,my:.263}}),U=I?ae(_,c,y.stroke):ze(_,s,y.fill);return w(A,H,{fill:U,stroke:ae(_,c,y.stroke),strokeWidth:1})},"bpmn:ErrorEventDefinition":function(A,_,y={},I){var H=i.getScaledPath("EVENT_ERROR",{xScaleFactor:1.1,yScaleFactor:1.1,containerWidth:y.width||_.width,containerHeight:y.height||_.height,position:{mx:.2,my:.722}}),U=I?ae(_,c,y.stroke):ze(_,s,y.fill);return w(A,H,{fill:U,stroke:ae(_,c,y.stroke),strokeWidth:1})},"bpmn:CancelEventDefinition":function(A,_,y={},I){var H=i.getScaledPath("EVENT_CANCEL_45",{xScaleFactor:1,yScaleFactor:1,containerWidth:_.width,containerHeight:_.height,position:{mx:.638,my:-.055}}),U=I?ae(_,c,y.stroke):"none",ue=w(A,H,{fill:U,stroke:ae(_,c,y.stroke),strokeWidth:1});return lm(ue,45),ue},"bpmn:CompensateEventDefinition":function(A,_,y={},I){var H=i.getScaledPath("EVENT_COMPENSATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:y.width||_.width,containerHeight:y.height||_.height,position:{mx:.22,my:.5}}),U=I?ae(_,c,y.stroke):ze(_,s,y.fill);return w(A,H,{fill:U,stroke:ae(_,c,y.stroke),strokeWidth:1})},"bpmn:SignalEventDefinition":function(A,_,y={},I){var H=i.getScaledPath("EVENT_SIGNAL",{xScaleFactor:.9,yScaleFactor:.9,containerWidth:y.width||_.width,containerHeight:y.height||_.height,position:{mx:.5,my:.2}}),U=I?ae(_,c,y.stroke):ze(_,s,y.fill);return w(A,H,{strokeWidth:1,fill:U,stroke:ae(_,c,y.stroke)})},"bpmn:MultipleEventDefinition":function(A,_,y={},I){var H=i.getScaledPath("EVENT_MULTIPLE",{xScaleFactor:1.1,yScaleFactor:1.1,containerWidth:y.width||_.width,containerHeight:y.height||_.height,position:{mx:.211,my:.36}}),U=I?ae(_,c,y.stroke):ze(_,s,y.fill);return w(A,H,{fill:U,stroke:ae(_,c,y.stroke),strokeWidth:1})},"bpmn:ParallelMultipleEventDefinition":function(A,_,y={}){var I=i.getScaledPath("EVENT_PARALLEL_MULTIPLE",{xScaleFactor:1.2,yScaleFactor:1.2,containerWidth:y.width||_.width,containerHeight:y.height||_.height,position:{mx:.458,my:.194}});return w(A,I,{fill:ze(_,s,y.fill),stroke:ae(_,c,y.stroke),strokeWidth:1})},"bpmn:TerminateEventDefinition":function(A,_,y={}){var I=m(A,_.width,_.height,8,{fill:ae(_,c,y.stroke),stroke:ae(_,c,y.stroke),strokeWidth:4});return I}};function B(A,_,y={},I){var H=J(A),U=jS(H),ue=I||A;return H.get("eventDefinitions")&&H.get("eventDefinitions").length>1?H.get("parallelMultiple")?T["bpmn:ParallelMultipleEventDefinition"](_,ue,y,U):T["bpmn:MultipleEventDefinition"](_,ue,y,U):gi(H,"bpmn:MessageEventDefinition")?T["bpmn:MessageEventDefinition"](_,ue,y,U):gi(H,"bpmn:TimerEventDefinition")?T["bpmn:TimerEventDefinition"](_,ue,y,U):gi(H,"bpmn:ConditionalEventDefinition")?T["bpmn:ConditionalEventDefinition"](_,ue,y,U):gi(H,"bpmn:SignalEventDefinition")?T["bpmn:SignalEventDefinition"](_,ue,y,U):gi(H,"bpmn:EscalationEventDefinition")?T["bpmn:EscalationEventDefinition"](_,ue,y,U):gi(H,"bpmn:LinkEventDefinition")?T["bpmn:LinkEventDefinition"](_,ue,y,U):gi(H,"bpmn:ErrorEventDefinition")?T["bpmn:ErrorEventDefinition"](_,ue,y,U):gi(H,"bpmn:CancelEventDefinition")?T["bpmn:CancelEventDefinition"](_,ue,y,U):gi(H,"bpmn:CompensateEventDefinition")?T["bpmn:CompensateEventDefinition"](_,ue,y,U):gi(H,"bpmn:TerminateEventDefinition")?T["bpmn:TerminateEventDefinition"](_,ue,y,U):null}var k={ParticipantMultiplicityMarker:function(A,_,y={}){var I=Gn(_,y),H=Tn(_,y),U=i.getScaledPath("MARKER_PARALLEL",{xScaleFactor:1,yScaleFactor:1,containerWidth:I,containerHeight:H,position:{mx:(I/2-6)/I,my:(H-15)/H}});C("participant-multiplicity",A,U,{strokeWidth:2,fill:ze(_,s,y.fill),stroke:ae(_,c,y.stroke)})},SubProcessMarker:function(A,_,y={}){var I=g(A,14,14,0,{strokeWidth:1,fill:ze(_,s,y.fill),stroke:ae(_,c,y.stroke)});nn(I,_.width/2-7.5,_.height-20);var H=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}});C("sub-process",A,H,{fill:ze(_,s,y.fill),stroke:ae(_,c,y.stroke)})},ParallelMarker:function(A,_,y){var I=Gn(_,y),H=Tn(_,y),U=i.getScaledPath("MARKER_PARALLEL",{xScaleFactor:1,yScaleFactor:1,containerWidth:I,containerHeight:H,position:{mx:(I/2+y.parallel)/I,my:(H-20)/H}});C("parallel",A,U,{fill:ze(_,s,y.fill),stroke:ae(_,c,y.stroke)})},SequentialMarker:function(A,_,y){var I=i.getScaledPath("MARKER_SEQUENTIAL",{xScaleFactor:1,yScaleFactor:1,containerWidth:_.width,containerHeight:_.height,position:{mx:(_.width/2+y.seq)/_.width,my:(_.height-19)/_.height}});C("sequential",A,I,{fill:ze(_,s,y.fill),stroke:ae(_,c,y.stroke)})},CompensationMarker:function(A,_,y){var I=i.getScaledPath("MARKER_COMPENSATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:_.width,containerHeight:_.height,position:{mx:(_.width/2+y.compensation)/_.width,my:(_.height-13)/_.height}});C("compensation",A,I,{strokeWidth:1,fill:ze(_,s,y.fill),stroke:ae(_,c,y.stroke)})},LoopMarker:function(A,_,y){var I=Gn(_,y),H=Tn(_,y),U=i.getScaledPath("MARKER_LOOP",{xScaleFactor:1,yScaleFactor:1,containerWidth:I,containerHeight:H,position:{mx:(I/2+y.loop)/I,my:(H-7)/H}});C("loop",A,U,{strokeWidth:1.5,fill:"none",stroke:ae(_,c,y.stroke),strokeMiterlimit:.5})},AdhocMarker:function(A,_,y){var I=Gn(_,y),H=Tn(_,y),U=i.getScaledPath("MARKER_ADHOC",{xScaleFactor:1,yScaleFactor:1,containerWidth:I,containerHeight:H,position:{mx:(I/2+y.adhoc)/I,my:(H-15)/H}});C("adhoc",A,U,{strokeWidth:1,fill:ae(_,c,y.stroke),stroke:ae(_,c,y.stroke)})}};function O(A,_,y,I){k[A](_,y,I)}function $(A,_,y=[],I={}){I={fill:I.fill,stroke:I.stroke,width:Gn(_,I),height:Tn(_,I)};var H=J(_),U=y.includes("SubProcessMarker");U?I={...I,seq:-21,parallel:-22,compensation:-25,loop:-18,adhoc:10}:I={...I,seq:-5,parallel:-6,compensation:-7,loop:0,adhoc:-8},H.get("isForCompensation")&&y.push("CompensationMarker"),v(H,"bpmn:AdHocSubProcess")&&(y.push("AdhocMarker"),U||j(I,{compensation:I.compensation-18}));var ue=H.get("loopCharacteristics"),Le=ue&&ue.get("isSequential");ue&&(j(I,{compensation:I.compensation-18}),y.includes("AdhocMarker")&&j(I,{seq:-23,loop:-18,parallel:-24}),Le===void 0&&y.push("LoopMarker"),Le===!1&&y.push("ParallelMarker"),Le===!0&&y.push("SequentialMarker")),y.includes("CompensationMarker")&&y.length===1&&j(I,{compensation:-8}),D(y,function(Xe){O(Xe,A,_,I)})}function ne(A,_,y={}){y=j({size:{width:100}},y);var I=o.createText(_||"",y);return Ve(I).add("djs-label"),ke(A,I),I}function le(A,_,y,I={}){var H=J(_),U=sa({x:_.x,y:_.y,width:_.width,height:_.height},I);return ne(A,H.name,{align:y,box:U,padding:7,style:{fill:aa(_,u,c,I.stroke)}})}function je(A,_,y={}){var I={width:_.width,height:_.height,x:_.width/2+_.x,y:_.height/2+_.y};return ne(A,$n(_),{box:I,style:j({},o.getExternalStyle(),{fill:aa(_,u,c,y.stroke)})})}function W(A,_,y,I={}){var H=Yt(y),U=ne(A,_,{box:{height:30,width:H?Tn(y,I):Gn(y,I)},align:"center-middle",style:{fill:aa(y,u,c,I.stroke)}});if(H){var ue=-1*Tn(y,I);ks(U,0,-ue,270)}}function re(A,_,y={}){var{width:I,height:H}=sa(_,y);return g(A,I,H,Ns,{...y,fill:ze(_,s,y.fill),fillOpacity:vo,stroke:ae(_,c,y.stroke)})}function pe(A,_,y={}){var I=J(_),H=ze(_,s,y.fill),U=ae(_,c,y.stroke);return(I.get("associationDirection")==="One"||I.get("associationDirection")==="Both")&&(y.markerEnd=d(A,"association-end",H,U)),I.get("associationDirection")==="Both"&&(y.markerStart=d(A,"association-start",H,U)),y=Ke(y,["markerStart","markerEnd"]),x(A,_.waypoints,{...y,stroke:U,strokeDasharray:"0, 5"})}function oe(A,_,y={}){var I=ze(_,s,y.fill),H=ae(_,c,y.stroke),U=i.getScaledPath("DATA_OBJECT_PATH",{xScaleFactor:1,yScaleFactor:1,containerWidth:_.width,containerHeight:_.height,position:{mx:.474,my:.296}}),ue=w(A,U,{fill:I,fillOpacity:vo,stroke:H}),Le=J(_);if(FS(Le)){var Xe=i.getScaledPath("DATA_OBJECT_COLLECTION_PATH",{xScaleFactor:1,yScaleFactor:1,containerWidth:_.width,containerHeight:_.height,position:{mx:.33,my:(_.height-18)/_.height}});w(A,Xe,{strokeWidth:2,fill:I,stroke:H})}return ue}function fe(A,_,y={}){return m(A,_.width,_.height,{fillOpacity:vo,...y,fill:ze(_,s,y.fill),stroke:ae(_,c,y.stroke)})}function ee(A,_,y={}){return S(A,_.width,_.height,{fill:ze(_,s,y.fill),fillOpacity:vo,stroke:ae(_,c,y.stroke)})}function V(A,_,y={}){var I=g(A,Gn(_,y),Tn(_,y),0,{fill:ze(_,s,y.fill),fillOpacity:y.fillOpacity||vo,stroke:ae(_,c,y.stroke),strokeWidth:1.5}),H=J(_);if(v(H,"bpmn:Lane")){var U=H.get("name");W(A,U,_,y)}return I}function G(A,_,y={}){var I=re(A,_,y),H=Ge(_);if(fn(_)&&(ce(I,{strokeDasharray:"0, 5.5",strokeWidth:2.5}),!H)){var U=J(_).flowElements||[],ue=U.filter(Le=>v(Le,"bpmn:StartEvent"));ue.length===1&&K(ue[0],A,y,_)}return le(A,_,H?"center-top":"center-middle",y),H?$(A,_,void 0,y):$(A,_,["SubProcessMarker"],y),I}function K(A,_,y,I){var H=22,U={fill:ze(I,s,y.fill),stroke:ae(I,c,y.stroke),width:H,height:H},ue=J(A).isInterrupting,Le=ue?0:3,Xe=ue?1:1.2,At=20,Je=(H-At)/2,Wt="translate("+Je+","+Je+")";m(_,At,At,{fill:U.fill,stroke:U.stroke,strokeWidth:Xe,strokeDasharray:Le,transform:Wt}),B(A,_,U,I)}function De(A,_,y={}){var I=re(A,_,y);return le(A,_,"center-middle",y),$(A,_,void 0,y),I}var Kt=this.handlers={"bpmn:AdHocSubProcess":function(A,_,y={}){return Ge(_)?y=Ke(y,["fill","stroke","width","height"]):y=Ke(y,["fill","stroke"]),G(A,_,y)},"bpmn:Association":function(A,_,y={}){return y=Ke(y,["fill","stroke"]),pe(A,_,y)},"bpmn:BoundaryEvent":function(A,_,y={}){var{renderIcon:I=!0}=y;y=Ke(y,["fill","stroke"]);var H=J(_),U=H.get("cancelActivity");y={strokeWidth:1.5,fill:ze(_,s,y.fill),fillOpacity:qS,stroke:ae(_,c,y.stroke)},U||(y.strokeDasharray="6");var ue=fe(A,_,y);return m(A,_.width,_.height,Is,{...y,fill:"none"}),I&&B(_,A,y),ue},"bpmn:BusinessRuleTask":function(A,_,y={}){y=Ke(y,["fill","stroke"]);var I=De(A,_,y),H=i.getScaledPath("TASK_TYPE_BUSINESS_RULE_MAIN",{abspos:{x:8,y:8}}),U=w(A,H);ce(U,{fill:ze(_,s,y.fill),stroke:ae(_,c,y.stroke),strokeWidth:1});var ue=i.getScaledPath("TASK_TYPE_BUSINESS_RULE_HEADER",{abspos:{x:8,y:8}}),Le=w(A,ue);return ce(Le,{fill:ae(_,c,y.stroke),stroke:ae(_,c,y.stroke),strokeWidth:1}),I},"bpmn:CallActivity":function(A,_,y={}){return y=Ke(y,["fill","stroke"]),G(A,_,{strokeWidth:5,...y})},"bpmn:ComplexGateway":function(A,_,y={}){y=Ke(y,["fill","stroke"]);var I=ee(A,_,y),H=i.getScaledPath("GATEWAY_COMPLEX",{xScaleFactor:.5,yScaleFactor:.5,containerWidth:_.width,containerHeight:_.height,position:{mx:.46,my:.26}});return w(A,H,{fill:ae(_,c,y.stroke),stroke:ae(_,c,y.stroke),strokeWidth:1}),I},"bpmn:DataInput":function(A,_,y={}){y=Ke(y,["fill","stroke"]);var I=i.getRawPath("DATA_ARROW"),H=oe(A,_,y);return w(A,I,{fill:"none",stroke:ae(_,c,y.stroke),strokeWidth:1}),H},"bpmn:DataInputAssociation":function(A,_,y={}){return y=Ke(y,["fill","stroke"]),pe(A,_,{...y,markerEnd:d(A,"association-end",ze(_,s,y.fill),ae(_,c,y.stroke))})},"bpmn:DataObject":function(A,_,y={}){return y=Ke(y,["fill","stroke"]),oe(A,_,y)},"bpmn:DataObjectReference":L("bpmn:DataObject"),"bpmn:DataOutput":function(A,_,y={}){y=Ke(y,["fill","stroke"]);var I=i.getRawPath("DATA_ARROW"),H=oe(A,_,y);return w(A,I,{strokeWidth:1,fill:ae(_,c,y.stroke),stroke:ae(_,c,y.stroke)}),H},"bpmn:DataOutputAssociation":function(A,_,y={}){return y=Ke(y,["fill","stroke"]),pe(A,_,{...y,markerEnd:d(A,"association-end",ze(_,s,y.fill),ae(_,c,y.stroke))})},"bpmn:DataStoreReference":function(A,_,y={}){y=Ke(y,["fill","stroke"]);var I=i.getScaledPath("DATA_STORE",{xScaleFactor:1,yScaleFactor:1,containerWidth:_.width,containerHeight:_.height,position:{mx:0,my:.133}});return w(A,I,{fill:ze(_,s,y.fill),fillOpacity:vo,stroke:ae(_,c,y.stroke),strokeWidth:2})},"bpmn:EndEvent":function(A,_,y={}){var{renderIcon:I=!0}=y;y=Ke(y,["fill","stroke"]);var H=fe(A,_,{...y,strokeWidth:4});return I&&B(_,A,y),H},"bpmn:EventBasedGateway":function(A,_,y={}){y=Ke(y,["fill","stroke"]);var I=J(_),H=ee(A,_,y);m(A,_.width,_.height,_.height*.2,{fill:ze(_,"none",y.fill),stroke:ae(_,c,y.stroke),strokeWidth:1});var U=I.get("eventGatewayType"),ue=!!I.get("instantiate");function Le(){var At=i.getScaledPath("GATEWAY_EVENT_BASED",{xScaleFactor:.18,yScaleFactor:.18,containerWidth:_.width,containerHeight:_.height,position:{mx:.36,my:.44}});w(A,At,{fill:"none",stroke:ae(_,c,y.stroke),strokeWidth:2})}if(U==="Parallel"){var Xe=i.getScaledPath("GATEWAY_PARALLEL",{xScaleFactor:.4,yScaleFactor:.4,containerWidth:_.width,containerHeight:_.height,position:{mx:.474,my:.296}});w(A,Xe,{fill:"none",stroke:ae(_,c,y.stroke),strokeWidth:1})}else U==="Exclusive"&&(ue||m(A,_.width,_.height,_.height*.26,{fill:"none",stroke:ae(_,c,y.stroke),strokeWidth:1}),Le());return H},"bpmn:ExclusiveGateway":function(A,_,y={}){y=Ke(y,["fill","stroke"]);var I=ee(A,_,y),H=i.getScaledPath("GATEWAY_EXCLUSIVE",{xScaleFactor:.4,yScaleFactor:.4,containerWidth:_.width,containerHeight:_.height,position:{mx:.32,my:.3}}),U=Ye(_);return U.get("isMarkerVisible")&&w(A,H,{fill:ae(_,c,y.stroke),stroke:ae(_,c,y.stroke),strokeWidth:1}),I},"bpmn:Gateway":function(A,_,y={}){return y=Ke(y,["fill","stroke"]),ee(A,_,y)},"bpmn:Group":function(A,_,y={}){return y=Ke(y,["fill","stroke","width","height"]),g(A,_.width,_.height,Ns,{stroke:ae(_,c,y.stroke),strokeWidth:1.5,strokeDasharray:"10, 6, 0, 6",fill:"none",pointerEvents:"none",width:Gn(_,y),height:Tn(_,y)})},"bpmn:InclusiveGateway":function(A,_,y={}){y=Ke(y,["fill","stroke"]);var I=ee(A,_,y);return m(A,_.width,_.height,_.height*.24,{fill:ze(_,s,y.fill),stroke:ae(_,c,y.stroke),strokeWidth:2.5}),I},"bpmn:IntermediateEvent":function(A,_,y={}){var{renderIcon:I=!0}=y;y=Ke(y,["fill","stroke"]);var H=fe(A,_,{...y,strokeWidth:1.5});return m(A,_.width,_.height,Is,{fill:"none",stroke:ae(_,c,y.stroke),strokeWidth:1.5}),I&&B(_,A,y),H},"bpmn:IntermediateCatchEvent":L("bpmn:IntermediateEvent"),"bpmn:IntermediateThrowEvent":L("bpmn:IntermediateEvent"),"bpmn:Lane":function(A,_,y={}){return y=Ke(y,["fill","stroke","width","height"]),V(A,_,{...y,fillOpacity:YS})},"bpmn:ManualTask":function(A,_,y={}){y=Ke(y,["fill","stroke"]);var I=De(A,_,y),H=i.getScaledPath("TASK_TYPE_MANUAL",{abspos:{x:17,y:15}});return w(A,H,{fill:ze(_,s,y.fill),stroke:ae(_,c,y.stroke),strokeWidth:.5}),I},"bpmn:MessageFlow":function(A,_,y={}){y=Ke(y,["fill","stroke"]);var I=J(_),H=Ye(_),U=ze(_,s,y.fill),ue=ae(_,c,y.stroke),Le=x(A,_.waypoints,{markerEnd:d(A,"messageflow-end",U,ue),markerStart:d(A,"messageflow-start",U,ue),stroke:ue,strokeDasharray:"10, 11",strokeWidth:1.5});if(I.get("messageRef")){var Xe=Le.getPointAtLength(Le.getTotalLength()/2),At=i.getScaledPath("MESSAGE_FLOW_MARKER",{abspos:{x:Xe.x,y:Xe.y}}),Je={strokeWidth:1};H.get("messageVisibleKind")==="initiating"?(Je.fill=U,Je.stroke=ue):(Je.fill=ue,Je.stroke=U);var Wt=w(A,At,Je),an=I.get("messageRef"),yn=an.get("name"),pt=ne(A,yn,{align:"center-top",fitBox:!0,style:{fill:ue}}),kt=Wt.getBBox(),Qt=pt.getBBox(),Kr=Xe.x-Qt.width/2,ei=Xe.y+kt.height/2+VS;ks(pt,Kr,ei,0)}return Le},"bpmn:ParallelGateway":function(A,_,y={}){y=Ke(y,["fill","stroke"]);var I=ee(A,_,y),H=i.getScaledPath("GATEWAY_PARALLEL",{xScaleFactor:.6,yScaleFactor:.6,containerWidth:_.width,containerHeight:_.height,position:{mx:.46,my:.2}});return w(A,H,{fill:ae(_,c,y.stroke),stroke:ae(_,c,y.stroke),strokeWidth:1}),I},"bpmn:Participant":function(A,_,y={}){y=Ke(y,["fill","stroke","width","height"]);var I=V(A,_,y),H=Ge(_),U=Yt(_),ue=J(_),Le=ue.get("name");if(H){var Xe=U?[{x:30,y:0},{x:30,y:Tn(_,y)}]:[{x:0,y:30},{x:Gn(_,y),y:30}];E(A,Xe,{stroke:ae(_,c,y.stroke),strokeWidth:WS}),W(A,Le,_,y)}else{var At=sa(_,y);U||(At.height=Gn(_,y),At.width=Tn(_,y));var Je=ne(A,Le,{box:At,align:"center-middle",style:{fill:aa(_,u,c,y.stroke)}});if(!U){var Wt=-1*Tn(_,y);ks(Je,0,-Wt,270)}}return ue.get("participantMultiplicity")&&O("ParticipantMultiplicityMarker",A,_,y),I},"bpmn:ReceiveTask":function(A,_,y={}){y=Ke(y,["fill","stroke"]);var I=J(_),H=De(A,_,y),U;return I.get("instantiate")?(m(A,28,28,20*.22,{fill:ze(_,s,y.fill),stroke:ae(_,c,y.stroke),strokeWidth:1}),U=i.getScaledPath("TASK_TYPE_INSTANTIATING_SEND",{abspos:{x:7.77,y:9.52}})):U=i.getScaledPath("TASK_TYPE_SEND",{xScaleFactor:.9,yScaleFactor:.9,containerWidth:21,containerHeight:14,position:{mx:.3,my:.4}}),w(A,U,{fill:ze(_,s,y.fill),stroke:ae(_,c,y.stroke),strokeWidth:1}),H},"bpmn:ScriptTask":function(A,_,y={}){y=Ke(y,["fill","stroke"]);var I=De(A,_,y),H=i.getScaledPath("TASK_TYPE_SCRIPT",{abspos:{x:15,y:20}});return w(A,H,{fill:ze(_,s,y.fill),stroke:ae(_,c,y.stroke),strokeWidth:1}),I},"bpmn:SendTask":function(A,_,y={}){y=Ke(y,["fill","stroke"]);var I=De(A,_,y),H=i.getScaledPath("TASK_TYPE_SEND",{xScaleFactor:1,yScaleFactor:1,containerWidth:21,containerHeight:14,position:{mx:.285,my:.357}});return w(A,H,{fill:ae(_,c,y.stroke),stroke:ze(_,s,y.fill),strokeWidth:1}),I},"bpmn:SequenceFlow":function(A,_,y={}){y=Ke(y,["fill","stroke"]);var I=ze(_,s,y.fill),H=ae(_,c,y.stroke),U=x(A,_.waypoints,{markerEnd:d(A,"sequenceflow-end",I,H),stroke:H}),ue=J(_),{source:Le}=_;if(Le){var Xe=J(Le);ue.get("conditionExpression")&&v(Xe,"bpmn:Activity")&&ce(U,{markerStart:d(A,"conditional-flow-marker",I,H)}),Xe.get("default")&&(v(Xe,"bpmn:Gateway")||v(Xe,"bpmn:Activity"))&&Xe.get("default")===ue&&ce(U,{markerStart:d(A,"conditional-default-flow-marker",I,H)})}return U},"bpmn:ServiceTask":function(A,_,y={}){y=Ke(y,["fill","stroke"]);var I=De(A,_,y);m(A,10,10,{fill:ze(_,s,y.fill),stroke:"none",transform:"translate(6, 6)"});var H=i.getScaledPath("TASK_TYPE_SERVICE",{abspos:{x:12,y:18}});w(A,H,{fill:ze(_,s,y.fill),stroke:ae(_,c,y.stroke),strokeWidth:1}),m(A,10,10,{fill:ze(_,s,y.fill),stroke:"none",transform:"translate(11, 10)"});var U=i.getScaledPath("TASK_TYPE_SERVICE",{abspos:{x:17,y:22}});return w(A,U,{fill:ze(_,s,y.fill),stroke:ae(_,c,y.stroke),strokeWidth:1}),I},"bpmn:StartEvent":function(A,_,y={}){var{renderIcon:I=!0}=y;y=Ke(y,["fill","stroke"]);var H=J(_);H.get("isInterrupting")||(y={...y,strokeDasharray:"6"});var U=fe(A,_,y);return I&&B(_,A,y),U},"bpmn:SubProcess":function(A,_,y={}){return Ge(_)?y=Ke(y,["fill","stroke","width","height"]):y=Ke(y,["fill","stroke"]),G(A,_,y)},"bpmn:Task":function(A,_,y={}){return y=Ke(y,["fill","stroke"]),De(A,_,y)},"bpmn:TextAnnotation":function(A,_,y={}){y=Ke(y,["fill","stroke"]);var{width:I,height:H}=sa(_,y),U=g(A,I,H,0,0,{fill:"none",stroke:"none"}),ue=i.getScaledPath("TEXT_ANNOTATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:I,containerHeight:H,position:{mx:0,my:0}});w(A,ue,{stroke:ae(_,c,y.stroke)});var Le=J(_),Xe=Le.get("text")||"";return ne(A,Xe,{align:"left-top",box:sa(_,y),padding:yo,style:{fill:aa(_,u,c,y.stroke)}}),U},"bpmn:Transaction":function(A,_,y={}){Ge(_)?y=Ke(y,["fill","stroke","width","height"]):y=Ke(y,["fill","stroke"]);var I=G(A,_,{strokeWidth:1.5,...y}),H=n.style(["no-fill","no-events"],{stroke:ae(_,c,y.stroke),strokeWidth:1.5}),U=Ge(_);return U||(y={}),g(A,Gn(_,y),Tn(_,y),Ns-Is,Is,H),I},"bpmn:UserTask":function(A,_,y={}){y=Ke(y,["fill","stroke"]);var I=De(A,_,y),H=15,U=12,ue=i.getScaledPath("TASK_TYPE_USER_1",{abspos:{x:H,y:U}});w(A,ue,{fill:ze(_,s,y.fill),stroke:ae(_,c,y.stroke),strokeWidth:.5});var Le=i.getScaledPath("TASK_TYPE_USER_2",{abspos:{x:H,y:U}});w(A,Le,{fill:ze(_,s,y.fill),stroke:ae(_,c,y.stroke),strokeWidth:.5});var Xe=i.getScaledPath("TASK_TYPE_USER_3",{abspos:{x:H,y:U}});return w(A,Xe,{fill:ae(_,c,y.stroke),stroke:ae(_,c,y.stroke),strokeWidth:.5}),I},label:function(A,_,y={}){return je(A,_,y)}};this._drawPath=w,this._renderer=P}se(Br,Oi),Br.$inject=["config.bpmnRenderer","eventBus","styles","pathMap","canvas","textRenderer"],Br.prototype.canRender=function(e){return v(e,"bpmn:BaseElement")},Br.prototype.drawShape=function(e,t,n={}){var{type:i}=t,r=this._renderer(i);return r(e,t,n)},Br.prototype.drawConnection=function(e,t,n={}){var{type:i}=t,r=this._renderer(i);return r(e,t,n)},Br.prototype.getShapePath=function(e){return Ne(e)?bl(e,US):v(e,"bpmn:Event")?bm(e):v(e,"bpmn:Activity")?bl(e,Ns):v(e,"bpmn:Gateway")?HS(e):zS(e)};function Ke(e,t=[]){return t.reduce((n,i)=>(e[i]&&(n[i]=e[i]),n),{})}var KS=0,XS={width:150,height:50};function ZS(e){var t=e.split("-");return{horizontal:t[0]||"center",vertical:t[1]||"top"}}function QS(e){return Ut(e)?j({top:0,left:0,right:0,bottom:0},e):{top:e,left:e,right:e,bottom:e}}var xl=null;function JS(){return xl||(xl=document.createElement("canvas").getContext("2d")),xl}function eR(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(xm(e.fontSize)||"12px"),t.push(e.fontFamily||"sans-serif"),t.join(" ")}function xm(e){if(e!=null)return typeof e=="number"||/^-?\d+(\.\d+)?$/.test(e)?e+"px":e}function tR(e,t){var n=JS();if(!n)return{width:0,height:0};n.font=eR(t),"letterSpacing"in n&&(n.letterSpacing=xm(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 nR(e,t,n){for(var i=e.shift(),r=i,o;;){if(o=tR(r,n),o.width=r?o.width:0,r===" "||r===""||o.width<Math.round(t)||r.length<2)return iR(e,r,i,o);r=oR(r,o.width,t)}}function iR(e,t,n,i){if(t.length<n.length){var r=n.slice(t.length).trim();e.unshift(r)}return{width:i.width,height:i.height,text:t}}var wm="";function rR(e,t){var n=e.split(/(\s|-|\u00AD)/g),i,r=[],o=0;if(n.length>1)for(;i=n.shift();)if(i.length+o<t)r.push(i),o+=i.length;else{(i==="-"||i===wm)&&r.pop();break}var a=r[r.length-1];return a&&a===wm&&(r[r.length-1]="-"),r.join("")}function oR(e,t,n){var i=Math.max(e.length*(n/t),1),r=rR(e,i);return r||(r=e.slice(0,Math.max(Math.round(i-1),1))),r}function Bs(e){this._config=j({},{size:XS,padding:KS,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=j({},this._config.size,t.box),i=j({},this._config.style,t.style),r=ZS(t.align||this._config.align),o=QS(t.padding!==void 0?t.padding:this._config.padding),a=t.fitBox||!1,s=aR(i),c=e.split(/\u00AD?\r?\n/),u=[],l=n.width-o.left-o.right;c.length;)u.push(nR(c,l,i));r.vertical==="middle"&&(o.top=o.bottom=0);var f=Rn(u,function(g,S,E){return g+(s||S.height)},0)+o.top+o.bottom,p=Rn(u,function(g,S,E){return S.width>g?S.width:g},0),d=o.top;r.vertical==="middle"&&(d+=(n.height-f)/2),d-=(s||u[0].height)/4;var h=ge("text");ce(h,i),D(u,function(g){var S;switch(d+=s||g.height,r.horizontal){case"left":S=o.left;break;case"right":S=(a?p:l)-o.right-g.width;break;default:S=Math.max(((a?p:l)-g.width)/2+o.left,0)}var E=ge("tspan");ce(E,{x:S,y:d}),E.textContent=g.text,ke(h,E)});var m={width:p,height:f};return{dimensions:m,element:h}};function aR(e){if("fontSize"in e&&"lineHeight"in e)return e.lineHeight*parseInt(e.fontSize,10)}var sR=12,cR=1.2,uR=40;function Em(e){var t=j({fontFamily:"Arial, sans-serif",fontSize:sR,fontWeight:"normal",lineHeight:cR},e&&e.defaultStyle||{}),n=parseInt(t.fontSize,10)-1,i=j({},t,{fontSize:n},e&&e.externalStyle||{}),r=new Bs({style:t});this.getExternalLabelBounds=function(a,s){var c={width:Math.max(a.width,Nr.width),height:30},u=o(s,c,{style:i});return{x:Math.round(a.x+a.width/2-u.width/2),y:a.y,width:Math.ceil(u.width),height:Math.ceil(u.height)}},this.getTextAnnotationBounds=function(a,s){var c=o(s,a,{style:t,align:"left-top",padding:yo});return{x:a.x,y:a.y,width:a.width,height:Math.max(uR,Math.round(c.height))}},this.getDimensions=function(a,s){return r.getDimensions(a,s||{})};function o(a,s,c){return r.getDimensions(a,j({box:s},c))}this.createText=function(a,s){return r.createText(a,s||{})},this.getDefaultStyle=function(){return t},this.getExternalStyle=function(){return i}}Em.$inject=["config.textRenderer"];function lR(){this.pathMap={EVENT_MESSAGE:{d:"m {mx},{my} l 0,{e.y1} l {e.x1},0 l 0,-{e.y1} z l {e.x0},{e.y0} l {e.x0},-{e.y0}",height:36,width:36,heightElements:[6,14],widthElements:[10.5,21]},EVENT_SIGNAL:{d:"M {mx},{my} l {e.x0},{e.y0} l -{e.x1},0 Z",height:36,width:36,heightElements:[18],widthElements:[10,20]},EVENT_ESCALATION:{d:"M {mx},{my} l {e.x0},{e.y0} l -{e.x0},-{e.y1} l -{e.x0},{e.y1} Z",height:36,width:36,heightElements:[20,7],widthElements:[8]},EVENT_CONDITIONAL:{d:"M {e.x0},{e.y0} l {e.x1},0 l 0,{e.y2} l -{e.x1},0 Z M {e.x2},{e.y3} l {e.x0},0 M {e.x2},{e.y4} l {e.x0},0 M {e.x2},{e.y5} l {e.x0},0 M {e.x2},{e.y6} l {e.x0},0 M {e.x2},{e.y7} l {e.x0},0 M {e.x2},{e.y8} l {e.x0},0 ",height:36,width:36,heightElements:[8.5,14.5,18,11.5,14.5,17.5,20.5,23.5,26.5],widthElements:[10.5,14.5,12.5]},EVENT_LINK:{d:"m {mx},{my} 0,{e.y0} -{e.x1},0 0,{e.y1} {e.x1},0 0,{e.y0} {e.x0},-{e.y2} -{e.x0},-{e.y2} z",height:36,width:36,heightElements:[4.4375,6.75,7.8125],widthElements:[9.84375,13.5]},EVENT_ERROR:{d:"m {mx},{my} {e.x0},-{e.y0} {e.x1},-{e.y1} {e.x2},{e.y2} {e.x3},-{e.y3} -{e.x4},{e.y4} -{e.x5},-{e.y5} z",height:36,width:36,heightElements:[.023,8.737,8.151,16.564,10.591,8.714],widthElements:[.085,6.672,6.97,4.273,5.337,6.636]},EVENT_CANCEL_45:{d:"m {mx},{my} -{e.x1},0 0,{e.x0} {e.x1},0 0,{e.y1} {e.x0},0 0,-{e.y1} {e.x1},0 0,-{e.y0} -{e.x1},0 0,-{e.y1} -{e.x0},0 z",height:36,width:36,heightElements:[4.75,8.5],widthElements:[4.75,8.5]},EVENT_COMPENSATION:{d:"m {mx},{my} {e.x0},-{e.y0} 0,{e.y1} z m {e.x1},-{e.y2} {e.x2},-{e.y3} 0,{e.y1} -{e.x2},-{e.y3} z",height:36,width:36,heightElements:[6.5,13,.4,6.1],widthElements:[9,9.3,8.7]},EVENT_TIMER_WH:{d:"M {mx},{my} l {e.x0},-{e.y0} m -{e.x0},{e.y0} l {e.x1},{e.y1} ",height:36,width:36,heightElements:[10,2],widthElements:[3,7]},EVENT_TIMER_LINE:{d:"M {mx},{my} m {e.x0},{e.y0} l -{e.x1},{e.y1} ",height:36,width:36,heightElements:[10,3],widthElements:[0,0]},EVENT_MULTIPLE:{d:"m {mx},{my} {e.x1},-{e.y0} {e.x1},{e.y0} -{e.x0},{e.y1} -{e.x2},0 z",height:36,width:36,heightElements:[6.28099,12.56199],widthElements:[3.1405,9.42149,12.56198]},EVENT_PARALLEL_MULTIPLE:{d:"m {mx},{my} {e.x0},0 0,{e.y1} {e.x1},0 0,{e.y0} -{e.x1},0 0,{e.y1} -{e.x0},0 0,-{e.y1} -{e.x1},0 0,-{e.y0} {e.x1},0 z",height:36,width:36,heightElements:[2.56228,7.68683],widthElements:[2.56228,7.68683]},GATEWAY_EXCLUSIVE:{d:"m {mx},{my} {e.x0},{e.y0} {e.x1},{e.y0} {e.x2},0 {e.x4},{e.y2} {e.x4},{e.y1} {e.x2},0 {e.x1},{e.y3} {e.x0},{e.y3} {e.x3},0 {e.x5},{e.y1} {e.x5},{e.y2} {e.x3},0 z",height:17.5,width:17.5,heightElements:[8.5,6.5312,-6.5312,-8.5],widthElements:[6.5,-6.5,3,-3,5,-5]},GATEWAY_PARALLEL:{d:"m {mx},{my} 0,{e.y1} -{e.x1},0 0,{e.y0} {e.x1},0 0,{e.y1} {e.x0},0 0,-{e.y1} {e.x1},0 0,-{e.y0} -{e.x1},0 0,-{e.y1} -{e.x0},0 z",height:30,width:30,heightElements:[5,12.5],widthElements:[5,12.5]},GATEWAY_EVENT_BASED:{d:"m {mx},{my} {e.x0},{e.y0} {e.x0},{e.y1} {e.x1},{e.y2} {e.x2},0 z",height:11,width:11,heightElements:[-6,6,12,-12],widthElements:[9,-3,-12]},GATEWAY_COMPLEX:{d:"m {mx},{my} 0,{e.y0} -{e.x0},-{e.y1} -{e.x1},{e.y2} {e.x0},{e.y1} -{e.x2},0 0,{e.y3} {e.x2},0 -{e.x0},{e.y1} l {e.x1},{e.y2} {e.x0},-{e.y1} 0,{e.y0} {e.x3},0 0,-{e.y0} {e.x0},{e.y1} {e.x1},-{e.y2} -{e.x0},-{e.y1} {e.x2},0 0,-{e.y3} -{e.x2},0 {e.x0},-{e.y1} -{e.x1},-{e.y2} -{e.x0},{e.y1} 0,-{e.y0} -{e.x3},0 z",height:17.125,width:17.125,heightElements:[4.875,3.4375,2.125,3],widthElements:[3.4375,2.125,4.875,3]},DATA_OBJECT_PATH:{d:"m 0,0 {e.x1},0 {e.x0},{e.y0} 0,{e.y1} -{e.x2},0 0,-{e.y2} {e.x1},0 0,{e.y0} {e.x0},0",height:61,width:51,heightElements:[10,50,60],widthElements:[10,40,50,60]},DATA_OBJECT_COLLECTION_PATH:{d:"m{mx},{my} m 3,2 l 0,10 m 3,-10 l 0,10 m 3,-10 l 0,10",height:10,width:10,heightElements:[],widthElements:[]},DATA_ARROW:{d:"m 5,9 9,0 0,-3 5,5 -5,5 0,-3 -9,0 z",height:61,width:51,heightElements:[],widthElements:[]},DATA_STORE:{d:"m {mx},{my} l 0,{e.y2} c {e.x0},{e.y1} {e.x1},{e.y1} {e.x2},0 l 0,-{e.y2} c -{e.x0},-{e.y1} -{e.x1},-{e.y1} -{e.x2},0c {e.x0},{e.y1} {e.x1},{e.y1} {e.x2},0 m -{e.x2},{e.y0}c {e.x0},{e.y1} {e.x1},{e.y1} {e.x2},0m -{e.x2},{e.y0}c {e.x0},{e.y1} {e.x1},{e.y1} {e.x2},0",height:61,width:61,heightElements:[7,10,45],widthElements:[2,58,60]},TEXT_ANNOTATION:{d:"m {mx}, {my} m 10,0 l -10,0 l 0,{e.y0} l 10,0",height:30,width:10,heightElements:[30],widthElements:[10]},MARKER_SUB_PROCESS:{d:"m{mx},{my} m 7,2 l 0,10 m -5,-5 l 10,0",height:10,width:10,heightElements:[],widthElements:[]},MARKER_PARALLEL:{d:"m{mx},{my} m 3,2 l 0,10 m 3,-10 l 0,10 m 3,-10 l 0,10",height:10,width:10,heightElements:[],widthElements:[]},MARKER_SEQUENTIAL:{d:"m{mx},{my} m 0,3 l 10,0 m -10,3 l 10,0 m -10,3 l 10,0",height:10,width:10,heightElements:[],widthElements:[]},MARKER_COMPENSATION:{d:"m {mx},{my} 7,-5 0,10 z m 7.1,-0.3 6.9,-4.7 0,10 -6.9,-4.7 z",height:10,width:21,heightElements:[],widthElements:[]},MARKER_LOOP:{d:"m {mx},{my} c 3.526979,0 6.386161,-2.829858 6.386161,-6.320661 0,-3.490806 -2.859182,-6.320661 -6.386161,-6.320661 -3.526978,0 -6.38616,2.829855 -6.38616,6.320661 0,1.745402 0.714797,3.325567 1.870463,4.469381 0.577834,0.571908 1.265885,1.034728 2.029916,1.35457 l -0.718163,-3.909793 m 0.718163,3.909793 -3.885211,0.802902",height:13.9,width:13.7,heightElements:[],widthElements:[]},MARKER_ADHOC:{d:"m {mx},{my} m 0.84461,2.64411 c 1.05533,-1.23780996 2.64337,-2.07882 4.29653,-1.97997996 2.05163,0.0805 3.85579,1.15803 5.76082,1.79107 1.06385,0.34139996 2.24454,0.1438 3.18759,-0.43767 0.61743,-0.33642 1.2775,-0.64078 1.7542,-1.17511 0,0.56023 0,1.12046 0,1.6807 -0.98706,0.96237996 -2.29792,1.62393996 -3.6918,1.66181996 -1.24459,0.0927 -2.46671,-0.2491 -3.59505,-0.74812 -1.35789,-0.55965 -2.75133,-1.33436996 -4.27027,-1.18121996 -1.37741,0.14601 -2.41842,1.13685996 -3.44288,1.96782996 z",height:4,width:15,heightElements:[],widthElements:[]},TASK_TYPE_SEND:{d:"m {mx},{my} l 0,{e.y1} l {e.x1},0 l 0,-{e.y1} z l {e.x0},{e.y0} l {e.x0},-{e.y0}",height:14,width:21,heightElements:[6,14],widthElements:[10.5,21]},TASK_TYPE_SCRIPT:{d:"m {mx},{my} c 9.966553,-6.27276 -8.000926,-7.91932 2.968968,-14.938 l -8.802728,0 c -10.969894,7.01868 6.997585,8.66524 -2.968967,14.938 z m -7,-12 l 5,0 m -4.5,3 l 4.5,0 m -3,3 l 5,0m -4,3 l 5,0",height:15,width:12.6,heightElements:[6,14],widthElements:[10.5,21]},TASK_TYPE_USER_1:{d:"m {mx},{my} c 0.909,-0.845 1.594,-2.049 1.594,-3.385 0,-2.554 -1.805,-4.62199999 -4.357,-4.62199999 -2.55199998,0 -4.28799998,2.06799999 -4.28799998,4.62199999 0,1.348 0.974,2.562 1.89599998,3.405 -0.52899998,0.187 -5.669,2.097 -5.794,4.7560005 v 6.718 h 17 v -6.718 c 0,-2.2980005 -5.5279996,-4.5950005 -6.0509996,-4.7760005 zm -8,6 l 0,5.5 m 11,0 l 0,-5"},TASK_TYPE_USER_2:{d:"m {mx},{my} m 2.162,1.009 c 0,2.4470005 -2.158,4.4310005 -4.821,4.4310005 -2.66499998,0 -4.822,-1.981 -4.822,-4.4310005 "},TASK_TYPE_USER_3:{d:"m {mx},{my} m -6.9,-3.80 c 0,0 2.25099998,-2.358 4.27399998,-1.177 2.024,1.181 4.221,1.537 4.124,0.965 -0.098,-0.57 -0.117,-3.79099999 -4.191,-4.13599999 -3.57499998,0.001 -4.20799998,3.36699999 -4.20699998,4.34799999 z"},TASK_TYPE_MANUAL:{d:"m {mx},{my} c 0.234,-0.01 5.604,0.008 8.029,0.004 0.808,0 1.271,-0.172 1.417,-0.752 0.227,-0.898 -0.334,-1.314 -1.338,-1.316 -2.467,-0.01 -7.886,-0.004 -8.108,-0.004 -0.014,-0.079 0.016,-0.533 0,-0.61 0.195,-0.042 8.507,0.006 9.616,0.002 0.877,-0.007 1.35,-0.438 1.353,-1.208 0.003,-0.768 -0.479,-1.09 -1.35,-1.091 -2.968,-0.002 -9.619,-0.013 -9.619,-0.013 v -0.591 c 0,0 5.052,-0.016 7.225,-0.016 0.888,-0.002 1.354,-0.416 1.351,-1.193 -0.006,-0.761 -0.492,-1.196 -1.361,-1.196 -3.473,-0.005 -10.86,-0.003 -11.0829995,-0.003 -0.022,-0.047 -0.045,-0.094 -0.069,-0.139 0.3939995,-0.319 2.0409995,-1.626 2.4149995,-2.017 0.469,-0.4870005 0.519,-1.1650005 0.162,-1.6040005 -0.414,-0.511 -0.973,-0.5 -1.48,-0.236 -1.4609995,0.764 -6.5999995,3.6430005 -7.7329995,4.2710005 -0.9,0.499 -1.516,1.253 -1.882,2.19 -0.37000002,0.95 -0.17,2.01 -0.166,2.979 0.004,0.718 -0.27300002,1.345 -0.055,2.063 0.629,2.087 2.425,3.312 4.859,3.318 4.6179995,0.014 9.2379995,-0.139 13.8569995,-0.158 0.755,-0.004 1.171,-0.301 1.182,-1.033 0.012,-0.754 -0.423,-0.969 -1.183,-0.973 -1.778,-0.01 -5.824,-0.004 -6.04,-0.004 10e-4,-0.084 0.003,-0.586 10e-4,-0.67 z"},TASK_TYPE_INSTANTIATING_SEND:{d:"m {mx},{my} l 0,8.4 l 12.6,0 l 0,-8.4 z l 6.3,3.6 l 6.3,-3.6"},TASK_TYPE_SERVICE:{d:"m {mx},{my} v -1.71335 c 0.352326,-0.0705 0.703932,-0.17838 1.047628,-0.32133 0.344416,-0.14465 0.665822,-0.32133 0.966377,-0.52145 l 1.19431,1.18005 1.567487,-1.57688 -1.195028,-1.18014 c 0.403376,-0.61394 0.683079,-1.29908 0.825447,-2.01824 l 1.622133,-0.01 v -2.2196 l -1.636514,0.01 c -0.07333,-0.35153 -0.178319,-0.70024 -0.323564,-1.04372 -0.145244,-0.34406 -0.321407,-0.6644 -0.522735,-0.96217 l 1.131035,-1.13631 -1.583305,-1.56293 -1.129598,1.13589 c -0.614052,-0.40108 -1.302883,-0.68093 -2.022633,-0.82247 l 0.0093,-1.61852 h -2.241173 l 0.0042,1.63124 c -0.353763,0.0736 -0.705369,0.17977 -1.049785,0.32371 -0.344415,0.14437 -0.665102,0.32092 -0.9635006,0.52046 l -1.1698628,-1.15823 -1.5667691,1.5792 1.1684265,1.15669 c -0.4026573,0.61283 -0.68308,1.29797 -0.8247287,2.01713 l -1.6588041,0.003 v 2.22174 l 1.6724648,-0.006 c 0.073327,0.35077 0.1797598,0.70243 0.3242851,1.04472 0.1452428,0.34448 0.3214064,0.6644 0.5227339,0.96066 l -1.1993431,1.19723 1.5840256,1.56011 1.1964668,-1.19348 c 0.6140517,0.40346 1.3028827,0.68232 2.0233517,0.82331 l 7.19e-4,1.69892 h 2.226848 z m 0.221462,-3.9957 c -1.788948,0.7502 -3.8576,-0.0928 -4.6097055,-1.87438 -0.7521065,-1.78321 0.090598,-3.84627 1.8802645,-4.59604 1.78823,-0.74936 3.856881,0.0929 4.608987,1.87437 0.752106,1.78165 -0.0906,3.84612 -1.879546,4.59605 z"},TASK_TYPE_SERVICE_FILL:{d:"m {mx},{my} c -1.788948,0.7502 -3.8576,-0.0928 -4.6097055,-1.87438 -0.7521065,-1.78321 0.090598,-3.84627 1.8802645,-4.59604 1.78823,-0.74936 3.856881,0.0929 4.608987,1.87437 0.752106,1.78165 -0.0906,3.84612 -1.879546,4.59605 z"},TASK_TYPE_BUSINESS_RULE_HEADER:{d:"m {mx},{my} 0,4 20,0 0,-4 z"},TASK_TYPE_BUSINESS_RULE_MAIN:{d:"m {mx},{my} 0,12 20,0 0,-12 zm 0,8 l 20,0 m -13,-4 l 0,8"},MESSAGE_FLOW_MARKER:{d:"m {mx},{my} m -10.5 ,-7 l 0,14 l 21,0 l 0,-14 z l 10.5,6 l 10.5,-6"}},this.getRawPath=function(t){return this.pathMap[t].d},this.getScaledPath=function(t,n){var i=this.pathMap[t],r,o;n.abspos?(r=n.abspos.x,o=n.abspos.y):(r=n.containerWidth*n.position.mx,o=n.containerHeight*n.position.my);var a={};if(n.position){for(var s=n.containerHeight/i.height*n.yScaleFactor,c=n.containerWidth/i.width*n.xScaleFactor,u=0;u<i.heightElements.length;u++)a["y"+u]=i.heightElements[u]*s;for(var l=0;l<i.widthElements.length;l++)a["x"+l]=i.widthElements[l]*c}var f=hR(i.d,{mx:r,my:o,e:a});return f}}var pR=/\{([^{}]+)\}/g,fR=/(?:(?:^|\.)(.+?)(?=\[|\.|$|\()|\[('|")(.+?)\2\])(\(\))?/g;function dR(e,t,n){var i=n;return t.replace(fR,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 hR(e,t){return String(e).replace(pR,function(n,i){return dR(n,i,t)})}const mR={__init__:["bpmnRenderer"],bpmnRenderer:["type",Br],textRenderer:["type",Em],pathMap:["type",lR]};function gR(e,t){return t=t||{},e.replace(/{([^}]+)}/g,function(n,i){return t[i]||"{"+i+"}"})}const ca={translate:["value",gR]};function $s(e,t,n){return j({id:e.id,type:e.$type,businessObject:e,di:t},n)}function yR(e,t,n){var i=e.waypoint;return!i||i.length<2?[we(t),we(n)]:i.map(function(r){return{x:r.x,y:r.y}})}function Sm(e,t,n){return new Error(`element ${pn(t)} referenced by ${pn(e)}#${n} not yet drawn`)}function Ni(e,t,n,i,r){this._eventBus=e,this._canvas=t,this._elementFactory=n,this._elementRegistry=i,this._textRenderer=r}Ni.$inject=["eventBus","canvas","elementFactory","elementRegistry","textRenderer"],Ni.prototype.add=function(e,t,n){var i,r,o;if(v(t,"bpmndi:BPMNPlane")){var a=v(e,"bpmn:SubProcess")?{id:e.id+"_plane"}:{};i=this._elementFactory.createRoot($s(e,t,a)),this._canvas.addRootElement(i)}else if(v(t,"bpmndi:BPMNShape")){var s=!Ge(e,t),c=_R(e);r=n&&(n.hidden||n.collapsed);var u=t.bounds;i=this._elementFactory.createShape($s(e,t,{collapsed:s,hidden:r,x:Math.round(u.x),y:Math.round(u.y),width:Math.round(u.width),height:Math.round(u.height),isFrame:c})),v(e,"bpmn:BoundaryEvent")&&this._attachBoundary(e,i),v(e,"bpmn:Lane")&&(o=0),v(e,"bpmn:DataStoreReference")&&(vR(n,we(u))||(n=this._canvas.findRoot(n))),this._canvas.addShape(i,n,o)}else if(v(t,"bpmndi:BPMNEdge")){var l=this._getSource(e),f=this._getTarget(e);r=n&&(n.hidden||n.collapsed),i=this._elementFactory.createConnection($s(e,t,{hidden:r,source:l,target:f,waypoints:yR(t,l,f)})),v(e,"bpmn:DataAssociation")&&(n=this._canvas.findRoot(n)),this._canvas.addConnection(i,n,o)}else throw new Error(`unknown di ${pn(t)} for element ${pn(e)}`);return or(e)&&$n(i)&&this.addLabel(e,t,i),this._eventBus.fire("bpmnElement.added",{element:i}),i},Ni.prototype._attachBoundary=function(e,t){var n=e.attachedToRef;if(!n)throw new Error(`missing ${pn(e)}#attachedToRef`);var i=this._elementRegistry.get(n.id),r=i&&i.attachers;if(!i)throw Sm(e,n,"attachedToRef");t.host=i,r||(i.attachers=r=[]),r.indexOf(t)===-1&&r.push(t)},Ni.prototype.addLabel=function(e,t,n){var i,r,o;return i=LS(t,n),r=$n(n),r&&(i=this._textRenderer.getExternalLabelBounds(i,r)),o=this._elementFactory.createLabel($s(e,t,{id:e.id+"_label",labelTarget:n,type:"label",hidden:n.hidden||!$n(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)},Ni.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?Sm(e,i,t+"Ref"):new Error(`${pn(e)}#${t} Ref not specified`)},Ni.prototype._getSource=function(e){return this._getConnectedElement(e,"source")},Ni.prototype._getTarget=function(e){return this._getConnectedElement(e,"target")},Ni.prototype._getElement=function(e){return this._elementRegistry.get(e.id)};function vR(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 _R(e){return v(e,"bpmn:Group")}const Rm={__depends__:[mR,{__depends__:[ca],bpmnImporter:["type",Ni]}]};function ua(e){return{x:e.x+e.width/2,y:e.y+e.height/2}}function ri(e,t){return{x:e.x-t.x,y:e.y-t.y}}function wl(e){return Math.log(e)/Math.log(10)}var bR=1e3;function Q(e){this._eventBus=e}Q.$inject=["eventBus"];function xR(e,t){return function(n){return e.call(t||null,n.context,n.command,n)}}Q.prototype.on=function(e,t,n,i,r,o){if((qt(t)||Ce(t))&&(o=r,r=i,i=n,n=t,t=null),qt(n)&&(o=r,r=i,i=n,n=bR),Ut(r)&&(o=r,r=!1),!qt(i))throw new Error("handlerFn must be a function");xe(e)||(e=[e]);var a=this._eventBus;D(e,function(s){var c=["commandStack",s,t].filter(function(u){return u}).join(".");a.on(c,n,r?xR(i,o):i,o)})},Q.prototype.canExecute=Bi("canExecute"),Q.prototype.preExecute=Bi("preExecute"),Q.prototype.preExecuted=Bi("preExecuted"),Q.prototype.execute=Bi("execute"),Q.prototype.executed=Bi("executed"),Q.prototype.postExecute=Bi("postExecute"),Q.prototype.postExecuted=Bi("postExecuted"),Q.prototype.revert=Bi("revert"),Q.prototype.reverted=Bi("reverted");function Bi(e){return function(n,i,r,o,a){(qt(n)||Ce(n))&&(a=o,o=r,r=i,i=n,n=null),this.on(n,e,i,r,o,a)}}var El=["top","bottom","left","right"],js=10;function Sl(e,t){Q.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(Ls(r)&&!st(r)){var o=SR(r);o&&i(r,o)}}function i(r,o){var a=we(r),s=r.label,c=we(s);if(s.parent){var u=ve(r),l;switch(o){case"top":l={x:a.x,y:u.top-js-s.height/2};break;case"left":l={x:u.left-js-s.width/2,y:a.y};break;case"bottom":l={x:a.x,y:u.bottom+js+s.height/2};break;case"right":l={x:u.right+js+s.width/2,y:a.y};break}var f=ri(l,c);t.moveShape(s,f)}}}se(Sl,Q),Sl.$inject=["eventBus","modeling"];function wR(e){var t=e.host,n=we(e),i=tn(n,t),r;i.indexOf("-")>=0?r=i.split("-"):r=[i];var o=El.filter(function(a){return r.indexOf(a)===-1});return o}function ER(e){var t=we(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 Cm(t,i)});return n}function SR(e){var t=we(e.label),n=we(e),i=Cm(n,t);if(RR(i)){var r=ER(e);if(e.host){var o=wR(e);r=r.concat(o)}var a=El.filter(function(s){return r.indexOf(s)===-1});return a.indexOf(i)!==-1?tn(e.label,e)!=="intersect"?void 0:i:a[0]}}function Cm(e,t){return tn(t,e,5)}function RR(e){return El.indexOf(e)!==-1}function Rl(e){Q.call(this,e),this.preExecute("shape.append",function(t){var n=t.source,i=t.shape;t.position||(v(i,"bpmn:TextAnnotation")?t.position={x:n.x+n.width/2+75,y:n.y-50-i.height/2}:t.position={x:n.x+n.width+80+i.width/2,y:n.y+n.height/2})},!0)}se(Rl,Q),Rl.$inject=["eventBus"];var CR=1500;function Cl(e,t,n){e.invoke(Q,this),this.preExecute("elements.delete",CR,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=$e(r,u=>v(u,"bpmn:Participant")||v(u,"bpmn:SubProcess"));if(!o.length)return[];var a=n.getRootElement(),s=new Set(a.children.filter(u=>v(u,"bpmn:Artifact"))),c=new Set;return D(o,u=>{const l=new Set(no(po(Array.from(s),Lt(u))));c=c.union(l),s=s.difference(l)}),Array.from(c)}}se(Cl,Q),Cl.$inject=["injector","eventBus","canvas"];function Pl(e,t){e.invoke(Q,this),this.postExecute("shape.move",function(n){var i=n.newParent,r=n.shape,o=$e(r.incoming.concat(r.outgoing),function(a){return v(a,"bpmn:Association")});D(o,function(a){t.moveConnection(a,{x:0,y:0},i)})},!0)}se(Pl,Q),Pl.$inject=["injector","modeling"];function _o(e,t){for(En(t)&&(t=[t]);e=e.parent;)if(Be(e,t))return e;return null}function Pm(e,t){var n=_o(e,"bpmn:Process");if(n)return!0;var i=["bpmn:Participant","bpmn:Lane"];if(n=_o(e,i),n)return Yt(n);if(Be(e,i))return Yt(e);var r;for(r=J(e);r&&!v(r,"bpmn:Process");r=r.$parent);if(!t)return!0;var o=t.find(function(a){var s=J(a);return s&&s.get("processRef")===r});return o?Yt(o):!0}var Am=500;function Fs(e,t){t.invoke(Q,this),this._bpmnReplace=e;var n=this;this.postExecuted("elements.create",Am,function(i){var r=i.elements;r=r.filter(function(o){var a=o.host;return Tm(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",Am,function(i){var r=i.shapes,o=i.newHost;if(r.length===1){var a=r[0];Tm(a,o)&&(i.shapes=[n._replaceShape(a,o)])}},!0)}Fs.$inject=["bpmnReplace","injector"],se(Fs,Q),Fs.prototype._replaceShape=function(e,t){var n=PR(e),i={type:"bpmn:BoundaryEvent",host:t};return n&&(i.eventDefinitionType=n.$type),this._bpmnReplace.replaceElement(e,i,{layoutConnection:!1})};function PR(e){var t=J(e),n=t.eventDefinitions;return n&&n[0]}function Tm(e,t){return!Ne(e)&&Be(e,["bpmn:IntermediateThrowEvent","bpmn:IntermediateCatchEvent"])&&!!t}function Al(e,t){Q.call(this,e);function n(i){return $e(i.attachers,function(r){return v(r,"bpmn:BoundaryEvent")})}this.postExecute("connection.create",function(i){var r=i.context.source,o=i.context.target,a=n(o);v(r,"bpmn:EventBasedGateway")&&v(o,"bpmn:ReceiveTask")&&a.length>0&&t.removeElements(a)}),this.postExecute("connection.reconnect",function(i){var r=i.context.oldSource,o=i.context.newSource;v(r,"bpmn:Gateway")&&v(o,"bpmn:EventBasedGateway")&&D(o.outgoing,function(a){var s=a.target,c=n(s);v(s,"bpmn:ReceiveTask")&&c.length>0&&t.removeElements(c)})})}Al.$inject=["eventBus","modeling"],se(Al,Q);function Mm(e){return e.create("bpmn:Category")}function AR(e){return e.create("bpmn:CategoryValue")}function km(e,t){var n=t.get("categoryValueRef");return n||(n=t.categoryValueRef=AR(e)),n.$parent||(n.$parent=Mm(e)),n}function TR(e,t,n){return Mt(t.get("categoryValue"),e),e.$parent=t,Mt(n.get("rootElements"),t),t.$parent=n,e}function MR(e){var t=e.$parent;return t&&(Pt(t.get("categoryValue"),e),e.$parent=null),e}function kR(e){var t=e.$parent;return t&&(Pt(t.get("rootElements"),e),e.$parent=null),e}var OR=500;function Tl(e,t,n){n.invoke(Q,this);function i(c){return t.filter(function(u){return v(u,"bpmn:Group")&&!u.labelTarget}).map(J).filter(function(u){return u!==c})}function r(c,u){return i(u).some(function(l){return l.get("categoryValueRef")===c})}function o(c,u){return i(u).some(function(l){var f=l.get("categoryValueRef");return f&&f.$parent===c})}function a(c,u){c&&u&&TR(c,u,e.getDefinitions())}function s(c,u,l){u&&!o(u,l)&&kR(u),c&&!r(c,l)&&MR(c)}this.executed(["shape.create","label.create"],function(c){var u=c.labelTarget||c.shape;!v(u,"bpmn:Group")||u.labelTarget||a(c.categoryValue,c.category)},!0),this.reverted(["shape.create","label.create"],function(c){var u=c.labelTarget||c.shape;!v(u,"bpmn:Group")||u.labelTarget||s(c.categoryValue,c.category,J(u))},!0),this.executed(["shape.move","shape.resize"],OR,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,J(u))},!0),this.executed("group.updateRefs",function(c){Om(c).forEach(function(u){a(u.categoryValue,u.category)})},!0),this.reverted("group.updateRefs",function(c){Om(c).forEach(function(u){s(u.categoryValue,u.category,J(u.groupShape))})},!0),this.executed("shape.delete",function(c){var u=c.shape;!v(u,"bpmn:Group")||u.labelTarget||s(c.categoryValue,c.category,J(u))},!0),this.reverted("shape.delete",function(c){var u=c.shape;!v(u,"bpmn:Group")||u.labelTarget||a(c.categoryValue,c.category)},!0)}Tl.$inject=["bpmnjs","elementRegistry","injector"],se(Tl,Q);function Om(e){var t;return((t=e.updates)==null?void 0:t.groups)||[]}function Ml(e,t,n){Q.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;bo(S)&&la(E)&&l(E)}function r(g){const S=g.connection,E=g.source,x=g.target;bo(E)&&Hs(x)&&(u(x),p(E,[S]))}function o(g){const S=g.newTarget,E=g.oldSource,x=g.oldTarget;if(x!==S){const w=E;la(x)&&l(x),bo(w)&&Hs(S)&&u(S)}}function a(g){const{element:S}=g;la(S)?(f(S),d(S)):Hs(S)&&h(S)}function s(g){const{newData:S,oldShape:E}=g;if(bo(g.oldShape)&&S.eventDefinitionType!=="bpmn:CompensateEventDefinition"||S.type!=="bpmn:BoundaryEvent"){const x=E.outgoing.find(({target:w})=>la(w));x&&x.target&&(g._connectionTarget=x.target)}else if(!bo(g.oldShape)&&S.eventDefinitionType==="bpmn:CompensateEventDefinition"&&S.type==="bpmn:BoundaryEvent"){const x=E.outgoing.find(({target:w})=>Hs(w));x&&x.target&&(g._connectionTarget=x.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 f(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 p(g,S){g.outgoing.filter(w=>v(w,"bpmn:Association")).filter(w=>la(w.target)&&!S.includes(w)).forEach(w=>t.removeConnection(w))}function d(g){const S=g.attachers.slice();S.length&&t.removeElements(S)}function h(g){const S=g.incoming.filter(E=>bo(E.source));t.removeElements(S)}function m(g){const S=g.outgoing.filter(E=>v(E,"bpmn:SequenceFlow"));t.removeElements(S)}}se(Ml,Q),Ml.$inject=["eventBus","modeling","bpmnRules"];function la(e){const t=J(e);return t&&t.get("isForCompensation")}function bo(e){return e&&v(e,"bpmn:BoundaryEvent")&&go(e,"bpmn:CompensateEventDefinition")}function Hs(e){return e&&v(e,"bpmn:Activity")&&!fn(e)}function kl(e){e.invoke(Q,this),this.preExecute("shape.create",1500,function(t){var n=t.context,i=n.parent,r=n.shape;v(i,"bpmn:Lane")&&!v(r,"bpmn:Lane")&&(n.parent=_o(i,"bpmn:Participant"))})}kl.$inject=["injector"],se(kl,Q);function Ol(e,t){Q.call(this,e),this.preExecute("shape.create",function(n){var a;var i=n.context,r=i.shape;if(v(r,"bpmn:DataObjectReference")&&r.type!=="label"){var o=t.create("bpmn:DataObject");o.isCollection=((a=r.businessObject.dataObjectRef)==null?void 0:a.isCollection)||!1,r.businessObject.dataObjectRef=o}})}Ol.$inject=["eventBus","bpmnFactory"],se(Ol,Q);var Dl=20,Ll=20,Dm=30,zs=2e3;function Il(e,t,n){Q.call(this,t),t.on(["create.start","shape.move.start"],zs,function(r){var o=r.context,a=o.shape,s=e.getRootElement();if(!(!v(a,"bpmn:Participant")||!v(s,"bpmn:Process")||!s.children.length)){var c=s.children.filter(function(f){return!v(f,"bpmn:Group")&&!Ne(f)&&!st(f)});if(c.length){var u=Lt(c),l=DR(a,u);j(a,l),o.createConstraints=LR(a,u)}}}),t.on("create.start",zs,function(r){var o=r.context,a=o.shape,s=e.getRootElement(),c=e.getGraphics(s);function u(l){l.element=s,l.gfx=c}v(a,"bpmn:Participant")&&v(s,"bpmn:Process")&&(t.on("element.hover",zs,u),t.once("create.cleanup",function(){t.off("element.hover",u)}))});function i(){var r=e.getRootElement();return v(r,"bpmn:Collaboration")?r:n.makeCollaboration()}this.preExecute("elements.create",zs,function(r){var o=r.elements,a=r.parent,s=IR(o),c;s&&v(a,"bpmn:Process")&&(r.parent=i(),c=r.hints=r.hints||{},c.participant=s,c.process=a,c.processRef=J(s).get("processRef"))},!0),this.preExecute("shape.create",function(r){var o=r.parent,a=r.shape;v(a,"bpmn:Participant")&&v(o,"bpmn:Process")&&(r.parent=i(),r.process=o,r.processRef=J(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)&&J(s).set("processRef",J(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)&&J(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)}Il.$inject=["canvas","eventBus","modeling"],se(Il,Q);function DR(e,t){t={width:t.width+Dl*2+Dm,height:t.height+Ll*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 LR(e,t){return t=ve(t),{bottom:t.top+e.height/2-Ll,left:t.right-e.width/2+Dl,top:t.bottom-e.height/2+Ll,right:t.left+e.width/2-Dl-Dm}}function IR(e){return lt(e,function(t){return v(t,"bpmn:Participant")})}var Lm="__targetRef_placeholder";function Nl(e,t){Q.call(this,e),this.executed(["connection.create","connection.delete","connection.move","connection.reconnect"],Im(o)),this.reverted(["connection.create","connection.delete","connection.move","connection.reconnect"],Im(o));function n(a,s,c){var u=a.get("dataInputAssociations");return lt(u,function(l){return l!==c&&l.targetRef===s})}function i(a,s){var c=a.get("properties"),u=lt(c,function(l){return l.name===Lm});return!u&&s&&(u=t.create("bpmn:Property",{name:Lm}),Mt(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,f=l&&l.businessObject,p=s.newTarget,d=p&&p.businessObject,h=s.oldTarget||s.target,m=h&&h.businessObject,g=c.businessObject,S;m&&m!==f&&r(m,u),d&&d!==f&&r(d,u),f?(S=i(f,!0),g.targetRef=S):g.targetRef=null}}Nl.$inject=["eventBus","bpmnFactory"],se(Nl,Q);function Im(e){return function(t){var n=t.context,i=n.connection;if(v(i,"bpmn:DataInputAssociation"))return e(t)}}function Gs(e){this._bpmnUpdater=e}Gs.$inject=["bpmnUpdater"],Gs.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),[]},Gs.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 Bl(e,t,n,i){Q.call(this,i),t.registerHandler("dataStore.updateContainment",Gs);function r(){return n.filter(function(s){return v(s,"bpmn:Participant")&&J(s).processRef})[0]}function o(s){return s.children.filter(function(c){return v(c,"bpmn:DataStoreReference")&&!c.labelTarget})}function a(s,c){var u=s.businessObject||s;if(c=c||r(),c){var l=c.businessObject||c;t.execute("dataStore.updateContainment",{dataStoreBo:u,dataStoreDi:Ye(s),newSemanticParent:l.processRef||l,newDiParent:Ye(c)})}}this.preExecute("shape.create",function(s){var c=s.context,u=c.shape;v(u,"bpmn:DataStoreReference")&&u.type!=="label"&&(c.hints||(c.hints={}),c.hints.autoResize=!1)}),this.preExecute("elements.move",function(s){var c=s.context,u=c.shapes,l=u.filter(function(f){return v(f,"bpmn:DataStoreReference")});l.length&&(c.hints||(c.hints={}),c.hints.autoResize=u.filter(function(f){return!v(f,"bpmn:DataStoreReference")}))}),this.postExecute("shape.create",function(s){var c=s.context,u=c.shape,l=u.parent;v(u,"bpmn:DataStoreReference")&&u.type!=="label"&&v(l,"bpmn:Collaboration")&&a(u)}),this.postExecute("shape.move",function(s){var c=s.context,u=c.shape,l=c.oldParent,f=u.parent;if(!v(l,"bpmn:Collaboration")&&v(u,"bpmn:DataStoreReference")&&u.type!=="label"&&v(f,"bpmn:Collaboration")){var p=v(l,"bpmn:Participant")?l:BR(l,"bpmn:Participant");a(u,p)}}),this.postExecute("shape.delete",function(s){var c=s.context,u=c.shape,l=e.getRootElement();Be(u,["bpmn:Participant","bpmn:SubProcess"])&&v(l,"bpmn:Collaboration")&&o(l).filter(function(f){return NR(f,u)}).forEach(function(f){a(f)})}),this.postExecute("canvas.updateRoot",function(s){var c=s.context,u=c.oldRoot,l=c.newRoot,f=o(u);f.forEach(function(p){v(l,"bpmn:Process")&&a(p,l)})})}Bl.$inject=["canvas","commandStack","elementRegistry","eventBus"],se(Bl,Q);function NR(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 BR(e,t){for(;e.parent;){if(v(e.parent,t))return e.parent;e=e.parent}}var Vs=Math.max,Ws=Math.min,$R=20;function Nm(e,t){return{top:e.top-t.top,right:e.right-t.right,bottom:e.bottom-t.bottom,left:e.left-t.left}}function jR(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 FR(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 Us(e,t,n){var i=t[e],r=n.min&&n.min[e],o=n.max&&n.max[e];return Ce(r)&&(i=(/top|left/.test(e)?Ws:Vs)(i,r)),Ce(o)&&(i=(/top|left/.test(e)?Vs:Ws)(i,o)),i}function HR(e,t){if(!t)return e;var n=ve(e);return As({top:Us("top",n,t),right:Us("right",n,t),bottom:Us("bottom",n,t),left:Us("left",n,t)})}function zR(e,t,n,i){var r=ve(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?ve(i):o,s={top:Ws(o.top,a.top),left:Ws(o.left,a.left),bottom:Vs(o.bottom,a.bottom),right:Vs(o.right,a.right)};return As(s)}function pa(e,t){return typeof e<"u"?e:$R}function GR(e,t){var n,i,r,o;return typeof t=="object"?(n=pa(t.left),i=pa(t.right),r=pa(t.top),o=pa(t.bottom)):n=i=r=o=pa(t),{x:e.x-n,y:e.y-r,width:e.width+n+i,height:e.height+r+o}}function VR(e){return!(e.waypoints||e.type==="label")}function Bm(e,t){var n;if(e.length===void 0?n=$e(e.children,VR):n=e,n.length)return GR(Lt(n),t)}var ar=Math.abs;function WR(e,t){return Nm(ve(t),ve(e))}var UR=["bpmn:Participant","bpmn:Process","bpmn:SubProcess"],Vn=30;function qs(e,t){return t=t||[],e.children.filter(function(n){v(n,"bpmn:Lane")&&(qs(n,t),t.push(n))}),t}function sr(e){return e.children.filter(function(t){return v(t,"bpmn:Lane")})}function Wn(e){return _o(e,UR)||e}function qR(e,t){var n=Wn(e),i=v(n,"bpmn:Process")?[]:[n],r=qs(n,i),o=ve(e),a=ve(t),s=WR(e,t),c=[],u=Yt(e);return r.forEach(function(l){if(l!==e){var f=u?0:s.top,p=u?s.right:0,d=u?0:s.bottom,h=u?s.left:0,m=ve(l);s.top&&(ar(m.bottom-o.top)<10&&(d=a.top-m.bottom),ar(m.top-o.top)<5&&(f=a.top-m.top)),s.left&&(ar(m.right-o.left)<10&&(p=a.left-m.right),ar(m.left-o.left)<5&&(h=a.left-m.left)),s.bottom&&(ar(m.top-o.bottom)<10&&(f=a.bottom-m.top),ar(m.bottom-o.bottom)<5&&(d=a.bottom-m.bottom)),s.right&&(ar(m.left-o.right)<10&&(h=a.right-m.left),ar(m.right-o.right)<5&&(p=a.right-m.right)),(f||p||d||h)&&c.push({shape:l,newBounds:FR(l,{top:f,right:p,bottom:d,left:h})})}}),c}var YR=500;function $l(e,t){Q.call(this,e);function n(i,r){var o=Yt(i),a=sr(r),s=[],c=[],u=[],l=[];if(Lr(a,function(g){return o?g.y>i.y?c.push(g):s.push(g):g.x>i.x?l.push(g):u.push(g),g.children}),!!a.length){var f;o?c.length&&s.length?f=i.height/2:f=i.height:l.length&&u.length?f=i.width/2:f=i.width;var p,d,h,m;s.length&&(p=t.calculateAdjustments(s,"y",f,i.y-10),t.makeSpace(p.movingShapes,p.resizingShapes,{x:0,y:f},"s")),c.length&&(d=t.calculateAdjustments(c,"y",-f,i.y+i.height+10),t.makeSpace(d.movingShapes,d.resizingShapes,{x:0,y:-f},"n")),u.length&&(h=t.calculateAdjustments(u,"x",f,i.x-10),t.makeSpace(h.movingShapes,h.resizingShapes,{x:f,y:0},"e")),l.length&&(m=t.calculateAdjustments(l,"x",-f,i.x+i.width+10),t.makeSpace(m.movingShapes,m.resizingShapes,{x:-f,y:0},"w"))}}this.postExecuted("shape.delete",YR,function(i){var r=i.context,o=r.hints,a=r.shape,s=r.oldParent;v(a,"bpmn:Lane")&&(o&&o.nested||n(a,s))})}$l.$inject=["eventBus","spaceTool"],se($l,Q);var $m=500;function Ys(e,t){t.invoke(Q,this),this._bpmnReplace=e;var n=this;this.postExecuted("elements.create",$m,function(i){var r=i.elements;r.filter(function(o){var a=o.host;return jm(o,a)}).map(function(o){return r.indexOf(o)}).forEach(function(o){i.elements[o]=n._replaceShape(r[o])})},!0),this.preExecute("elements.move",$m,function(i){var r=i.shapes,o=i.newHost;r.forEach(function(a,s){var c=a.host;jm(a,XR(r,c)?c:o)&&(r[s]=n._replaceShape(a))})},!0)}Ys.$inject=["bpmnReplace","injector"],se(Ys,Q),Ys.prototype._replaceShape=function(e){var t=KR(e),n;return t?n={type:"bpmn:IntermediateCatchEvent",eventDefinitionType:t.$type}:n={type:"bpmn:IntermediateThrowEvent"},this._bpmnReplace.replaceElement(e,n,{layoutConnection:!1})};function KR(e){var t=J(e),n=t.eventDefinitions;return n&&n[0]}function jm(e,t){return!Ne(e)&&v(e,"bpmn:BoundaryEvent")&&!t}function XR(e,t){return e.indexOf(t)!==-1}var Ks=Math.round,ZR=Math.max;function QR(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 JR(e){var t=[];return e.forEach(function(n,i){t.push([i===0?"M":"L",n.x,n.y])}),t}var Fm=10;function eC(e,t){var n,i;for(n=0;i=e[n];n++)if(ta(i,t)<=Fm)return{point:e[n],bendpoint:!0,index:n};return null}function tC(e,t){var n=Wh(QR(t,Fm),JR(e)),i=n[0],r=n[n.length-1],o;return i?i!==r?i.segment2!==r.segment2?(o=ZR(i.segment2,r.segment2)-1,{point:e[o],bendpoint:!0,index:o}):{point:{x:Ks(i.x+r.x)/2,y:Ks(i.y+r.y)/2},index:i.segment2}:{point:{x:Ks(i.x),y:Ks(i.y)},index:i.segment2}:null}function jl(e,t){return eC(e,t)||tC(e,t)}function Fl(e,t,n){Q.call(this,e);function i(r,o,a){var s=o.waypoints,c,u,l,f,p,d,h,m=r.outgoing.slice(),g=r.incoming.slice(),S;Ce(a.width)?S=we(a):S=a;var E=jl(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||!Hm(r,c[c.length-1]))&&c.push(zm(l)),(u.length===1||!Hm(r,u[0]))&&u.unshift(zm(l))}f=o.source,p=o.target,t.canConnect(f,r,o)&&(n.reconnectEnd(o,r,c||S),d=o),t.canConnect(r,p,o)&&(d?h=n.connect(r,p,{type:o.type,waypoints:u}):(n.reconnectStart(o,r,u||S),h=o));var x=[].concat(d&&$e(g,function(w){return w.source===d.source})||[],h&&$e(m,function(w){return w.target===h.target})||[]);x.length&&n.removeElements(x)}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=we(c),l={x:u.x+s.x,y:u.y+s.y},f=lt(o.children,function(p){var d=t.canInsert(a,p);return d&&jl(p.waypoints,l)});f&&(r.targetFlow=f,r.position=l)}},!0),this.postExecuted("elements.move",function(r){var o=r.shapes,a=r.targetFlow,s=r.position;a&&i(o[0],a,s)},!0),this.preExecute("shape.create",function(r){var o=r.parent,a=r.shape;t.canInsert(a,o)&&(r.targetFlow=o,r.parent=o.parent)},!0),this.postExecuted("shape.create",function(r){var o=r.shape,a=r.targetFlow,s=r.position;a&&i(o,a,s)},!0)}se(Fl,Q),Fl.$inject=["eventBus","bpmnRules","modeling"];function Hm(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 zm(e){return j({},e)}function Hl(e,t){Q.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)&&xo(r)){var c=[];v(o,"bpmn:EventBasedGateway")?c=a.incoming.filter(u=>u!==r&&xo(u)):c=a.incoming.filter(u=>u!==r&&xo(u)&&v(u.source,"bpmn:EventBasedGateway")),c.forEach(function(u){t.removeConnection(u)})}}),this.preExecuted("shape.replace",function(n){var i=n.context,r=i.newShape;if(v(r,"bpmn:EventBasedGateway")){var o=r.outgoing.filter(xo).reduce(function(a,s){return a.includes(s.target)?a:a.concat(s.target)},[]);o.forEach(function(a){a.incoming.filter(xo).forEach(function(s){const c=a.incoming.filter(xo).filter(function(u){return u.source===r});(s.source!==r||c.length>1)&&t.removeConnection(s)})})}})}Hl.$inject=["eventBus","modeling"],se(Hl,Q);function xo(e){return v(e,"bpmn:SequenceFlow")}var Xs=1500,Gm=2e3;function Vm(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"],Xs,function(i){var r=i.context,o=r.shape||i.shape,a=i.hover;v(a,"bpmn:Lane")&&!Be(o,["bpmn:Lane","bpmn:Participant"])&&(i.hover=Wn(a),i.hoverGfx=e.getGraphics(i.hover));var s=n.getRootElement();a&&a!==s&&(o.labelTarget||Be(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"],Xs,function(i){var r=i.hover;v(r,"bpmn:Lane")&&(i.hover=Wn(r)||r,i.hoverGfx=e.getGraphics(i.hover))}),t.on(["bendpoint.move.hover"],Xs,function(i){var r=i.context,o=i.hover,a=r.type;v(o,"bpmn:Lane")&&/reconnect/.test(a)&&(i.hover=Wn(o)||o,i.hoverGfx=e.getGraphics(i.hover))}),t.on(["connect.start"],Xs,function(i){var r=i.context,o=r.start;v(o,"bpmn:Lane")&&(r.start=Wn(o)||o)}),t.on("shape.move.start",Gm,function(i){var r=i.shape;v(r,"bpmn:Lane")&&(i.shape=Wn(r)||r)}),t.on("spaceTool.move",Gm,function(i){var r=i.hover;r&&v(r,"bpmn:Lane")&&(i.hover=Wn(r))})}Vm.$inject=["elementRegistry","eventBus","canvas"];var Wm=770;function zl(e,t,n,i){n.invoke(Q,this);function r(s,c){var u=J(s),l=c.categoryValue||u.categoryValueRef;l||(l=km(e,u));var f=c.category||l.$parent||Mm(e);u.categoryValueRef=l,l.$parent=f,c.categoryValue=l,c.category=f}function o(s,c){var u=J(s),l=c.categoryValue||u.categoryValueRef,f=c.category||l&&l.$parent;l&&(c.categoryValue=l,c.category=f,u.categoryValueRef=null)}this.execute("label.create",function(s){var c=s.context,u=c.labelTarget;v(u,"bpmn:Group")&&r(u,c)}),this.revert("label.create",function(s){var c=s.context,u=c.labelTarget;v(u,"bpmn:Group")&&o(u,c)}),this.execute("shape.delete",function(s){var c=s.context,u=c.shape,l=J(u);if(!(!v(u,"bpmn:Group")||u.labelTarget)){var f=c.categoryValue=l.categoryValueRef;f&&(c.category=f.$parent,l.categoryValueRef=null)}}),this.reverted("shape.delete",function(s){var c=s.context,u=c.shape;if(!(!v(u,"bpmn:Group")||u.labelTarget)){var l=c.category,f=c.categoryValue,p=J(u);f&&(p.categoryValueRef=f,f.$parent=l)}}),this.execute("shape.create",function(s){var c=s.context,u=c.shape,l=c.hints||{};!v(u,"bpmn:Group")||u.labelTarget||l.createElementsBehavior===!1&&!J(u).categoryValueRef&&!c.categoryValue||r(u,c)}),this.reverted("shape.create",function(s){var c=s.context,u=c.shape,l=c.hints||{};!v(u,"bpmn:Group")||u.labelTarget||l.createElementsBehavior===!1&&!J(u).categoryValueRef&&!c.categoryValue||o(u,c)}),this.executed(["shape.move","shape.resize"],function(s){var c=s.context,u=c.shape;!v(u,"bpmn:Group")||u.labelTarget||J(u).categoryValueRef||r(u,c)}),this.reverted(["shape.move","shape.resize"],function(s){var c=s.context,u=c.shape;!v(u,"bpmn:Group")||u.labelTarget||!c.categoryValue||o(u,c)});function a(s,c){var u=e.create(s.$type);return i.copyElement(s,u,null,c)}t.on("copyPaste.copyElement",Wm,function(s){var c=s.descriptor,u=s.element;if(!(!v(u,"bpmn:Group")||u.labelTarget)){var l=J(u);if(l.categoryValueRef){var f=l.categoryValueRef;c.categoryValue=a(f,!0),f.$parent&&(c.category=a(f.$parent,!0))}}}),t.on("copyPaste.pasteElement",Wm,function(s){var c=s.descriptor,u=c.businessObject,l=c.categoryValue,f=c.category;l&&(l=u.categoryValueRef=a(l)),f&&(l.$parent=a(f)),delete c.category,delete c.categoryValue})}zl.$inject=["bpmnFactory","eventBus","injector","moddleCopy"],se(zl,Q);function Gl(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 Um(e){function t(i,r,o){var a={x:o.x,y:o.y-50},s={x:o.x-50,y:o.y},c=Gl(i,r,o,a),u=Gl(i,r,o,s),l;c&&u?qm(c,o)>qm(u,o)?l=u:l=c:l=c||u,i.original=l}function n(i){var r=i.waypoints;t(r[0],r[1],we(i.source)),t(r[r.length-1],r[r.length-2],we(i.target))}e.on("bpmnElement.added",function(i){var r=i.element;r.waypoints&&n(r)})}Um.$inject=["eventBus"];function qm(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function Vl(e){Q.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=J(i),o=Ye(i);if(Be(r,t)){var a=o.get("isHorizontal");a===void 0&&(a=!0),o.set("isHorizontal",a)}})}Vl.$inject=["eventBus"],se(Vl,Q);function Ym(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}function Km(e){return Math.atan((e[1].y-e[0].y)/(e[1].x-e[0].x))}function nC(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 iC(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 Wl(e,t){var n=t[0],i=t[1],r={x:i.x-n.x,y:i.y-n.y},o=iC([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 Xm(e,t){var n=Wl(e,t),i={x:n.x-e.x,y:n.y-e.y};return Ym(i)}function fa(e,t){return Ym({x:e.x-t.x,y:e.y-t.y})}var Zm=Math.sqrt,Qm=Math.min,rC=Math.max,Jm=Math.abs;function eg(e){return Math.pow(e,2)}function da(e,t){return Zm(eg(e.x-t.x)+eg(e.y-t.y))}function oC(e,t){var n=0,i,r,o,a,s,c,u,l,f,p,d;for(n=0;n<t.length-1;n++){if(i=t[n],r=t[n+1],ng(i,r)?u=[i]:(o=da(e,i),a=da(e,r),c=Qm(o,a),u=aC(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:ng(i,u[0])?n:n+1}),u.length===2&&(s=cC(u[0],u[1]),l={type:"segment",position:s,segmentIndex:n,relativeLocation:da(i,s)/da(i,r)}),f=da(l.position,e),(!d||p>f)&&(d=l,p=f)}return d}function aC(e,t,n,i){var r=t.x-e.x,o=t.y-e.y,a=n.x-e.x,s=n.y-e.y,c=r*r+o*o,u=r*a+o*s,l=a*a+s*s-i*i,f=u/c,p=l/c,d=f*f-p;if(d<0&&d>-1e-6&&(d=0),d<0)return[];var h=Zm(d),m=-f+h,g=-f-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(x){return sC(x,e,t)})}function sC(e,t,n){return tg(e.x,t.x,n.x)&&tg(e.y,t.y,n.y)}function tg(e,t,n){return e>=Qm(t,n)-Zs&&e<=rC(t,n)+Zs}function cC(e,t){return{x:(e.x+t.x)/2,y:(e.y+t.y)/2}}var Zs=.1;function ng(e,t){return Jm(e.x-t.x)<=Zs&&Jm(e.y-t.y)<=Zs}function uC(e,t,n,i){var r=n.segmentIndex,o=t.length-e.length;if(i.segmentMove){var a=i.segmentMove.segmentStartIndex,s=i.segmentMove.newSegmentStartIndex;return r===a?s:r>=s?r+o<s?s:r+o:r}if(i.bendpointMove){var c=i.bendpointMove.insert,u=i.bendpointMove.bendpointIndex,l;if(o===0)return r;if(r>=u&&(l=c?r+1:r-1),r<u&&(l=r,c&&n.type!=="bendpoint"&&u-1===r)){var f=rg(t,u);f<n.relativeLocation&&l++}return l}return o===0?r:i.connectionStart&&r===0?0:i.connectionEnd&&r===e.length-2?t.length-2:Math.floor((t.length-2)/2)}function ig(e,t,n,i){var r=0,o=0,a={point:e,delta:{x:0,y:0}},s=oC(e,n),c=s.segmentIndex,u=uC(n,t,s,i);if(u<0||u>t.length-2||u===null)return a;var l=og(n,c),f=og(t,u),p=s.position,d=pC(l,p),h=lC(l,f);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=rg(n,g))}var x={x:(f[1].x-f[0].x)*d+f[0].x,y:(f[1].y-f[0].y)*d+f[0].y},w=nC({x:e.x-p.x,y:e.y-p.y},h);return r=x.x+w.x-e.x,o=x.y+w.y-e.y,{point:Li(x),delta:Li({x:r,y:o})}}function rg(e,t){var n=fa(e[t-1],e[t]),i=fa(e[t],e[t+1]),r=n/(n+i);return r}function lC(e,t){var n=Km(e),i=Km(t);return i-n}function og(e,t){return[e[t],e[t+1]]}function pC(e,t){var n=fa(e[0],e[1]),i=fa(e[0],t);return n===0?0:i/n}function fC(e,t,n,i){var r=we(e);return ig(r,t,n,i).delta}function ha(e,t,n){var i=ua(t),r=ua(n),o=ri(e,i),a={x:o.x*(n.width/t.width),y:o.y*(n.height/t.height)};return Li({x:r.x+a.x,y:r.y+a.y})}function ag(e,t,n){var i=ua(e),r=ua(t),o=ua(n),a=ri(e,i),s=ri(i,r),c=dC(i,t,n);if(c)return c;var u={x:s.x*(n.width/t.width),y:s.y*(n.height/t.height)},l={x:o.x+u.x,y:o.y+u.y};return Li({x:l.x+a.x-e.x,y:l.y+a.y-e.y})}function dC(e,t,n){var i=ve(t),r=ve(n);if(hC(i,r))return null;var o=tn(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=tn(n,s),c!==o?null:a}function hC(e,t){return mC(e,t)||gC(e,t)}function mC(e,t){return e.right!==t.right&&e.left!==t.left}function gC(e,t){return e.top!==t.top&&e.bottom!==t.bottom}var sg="name",cg="text";function Ul(e,t,n,i){Q.call(this,e),this.postExecute("element.updateProperties",r),this.postExecute("element.updateModdleProperties",a=>{J(a.context.element)===a.context.moddleElement&&r(a)});function r(a){var s=a.context,c=s.element,u=s.properties;if(sg in u&&t.updateLabel(c,u[sg]),cg in u&&v(c,"bpmn:TextAnnotation")){var l=i.getTextAnnotationBounds({x:c.x,y:c.y,width:c.width,height:c.height},u[cg]||"");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;Ne(u)||!or(u)||$n(u)&&t.updateLabel(u,$n(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=j({},s.hints),f=s.newWaypoints||c.waypoints,p=s.oldWaypoints;return typeof l.startChanged>"u"&&(l.startChanged=!!l.connectionStart),typeof l.endChanged>"u"&&(l.endChanged=!!l.connectionEnd),fC(u,f,p,l)}this.postExecute(["connection.layout","connection.updateWaypoints"],function(a){var s=a.context,c=s.hints||{};if(c.labelBehavior!==!1){var u=s.connection,l=u.label,f;!l||!l.parent||(f=o(a),t.moveShape(l,f))}}),this.postExecute(["shape.replace"],function(a){var s=a.context,c=s.newShape,u=s.oldShape,l=J(c);l&&or(l)&&u.label&&c.label&&(c.label.x=u.label.x,c.label.y=u.label.y)}),this.preExecute("shape.resize",function(a){var s=a.context,c=s.shape,u=s.hints||{};if(!(!Ne(c)||u.autoResize)){var l=s.newBounds,f=i.getDimensions($n(c)||"",{box:l,style:i.getExternalStyle()}),p=Math.ceil(f.height),d=l.y!==c.y,h=c.y+c.height;s.newBounds={width:l.width,height:p,x:l.x,y:d?h-p:l.y}}}),this.postExecute("shape.resize",function(a){var s=a.context,c=s.shape,u=s.newBounds,l=s.oldBounds;if(Ls(c)){var f=c.label,p=we(f),d=_C(l),h=vC(p,d),m=yC(h,l,u);t.moveShape(f,m)}})}se(Ul,Q),Ul.$inject=["eventBus","modeling","bpmnFactory","textRenderer"];function yC(e,t,n){var i=ha(e,t,n);return Li(ri(i,e))}function vC(e,t){if(t.length){var n=bC(e,t);return Wl(e,n)}}function _C(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 bC(e,t){var n=t.map(function(r){return{line:r,distance:Xm(e,r)}}),i=ai(n,"distance");return i[0].line}function xC(e,t,n,i){return ig(e,t,n,i).point}function ql(e,t){Q.call(this,e);function n(i,r){var o=i.context,a=o.connection,s=j({},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),xC(r,c,u,s)}this.postExecute(["connection.layout","connection.updateWaypoints"],function(i){var r=i.context,o=r.connection,a=o.outgoing,s=o.incoming;s.forEach(function(c){var u=c.waypoints[c.waypoints.length-1],l=n(i,u),f=[].concat(c.waypoints.slice(0,-1),[l]);t.updateWaypoints(c,f)}),a.forEach(function(c){var u=c.waypoints[0],l=n(i,u),f=[].concat([l],c.waypoints.slice(1));t.updateWaypoints(c,f)})}),this.postExecute(["connection.move"],function(i){var r=i.context,o=r.connection,a=o.outgoing,s=o.incoming,c=r.delta;s.forEach(function(u){var l=u.waypoints[u.waypoints.length-1],f={x:l.x+c.x,y:l.y+c.y},p=[].concat(u.waypoints.slice(0,-1),[f]);t.updateWaypoints(u,p)}),a.forEach(function(u){var l=u.waypoints[0],f={x:l.x+c.x,y:l.y+c.y},p=[].concat([f],u.waypoints.slice(1));t.updateWaypoints(u,p)})})}se(ql,Q),ql.$inject=["eventBus","modeling"];function Qs(e,t,n){var i=ec(e),r=lg(i,t),o=i[0];return r.length?r[r.length-1]:ha(o.original||o,n,t)}function Js(e,t,n){var i=ec(e),r=lg(i,t),o=i[i.length-1];return r.length?r[0]:ha(o.original||o,n,t)}function Yl(e,t,n){var i=ec(e),r=ug(t,n),o=i[0];return ha(o.original||o,r,t)}function Kl(e,t,n){var i=ec(e),r=ug(t,n),o=i[i.length-1];return ha(o.original||o,r,t)}function ug(e,t){return{x:e.x-t.x,y:e.y-t.y,width:e.width,height:e.height}}function ec(e){var t=e.waypoints;if(!t.length)throw new Error("connection#"+e.id+": no waypoints");return t}function lg(e,t){var n=cn(e,EC);return $e(n,function(i){return wC(i,t)})}function wC(e,t){return tn(t,e,1)==="intersect"}function EC(e){return e.original||e}function Xl(e,t){Q.call(this,e),this.postExecute("shape.replace",function(n){var i=n.oldShape,r=n.newShape;if(SC(i,r)){var o=RC(i);o.incoming.forEach(function(a){var s=Js(a,r,i);t.reconnectEnd(a,r,s)}),o.outgoing.forEach(function(a){var s=Qs(a,r,i);t.reconnectStart(a,r,s)})}},!0)}Xl.$inject=["eventBus","modeling"],se(Xl,Q);function SC(e,t){return v(e,"bpmn:Participant")&&Ge(e)&&v(t,"bpmn:Participant")&&!Ge(t)}function RC(e){var t=Jo([e]),n=[],i=[];return t.forEach(function(r){r!==e&&(r.incoming.forEach(function(o){v(o,"bpmn:MessageFlow")&&n.push(o)}),r.outgoing.forEach(function(o){v(o,"bpmn:MessageFlow")&&i.push(o)}))},[]),{incoming:n,outgoing:i}}const CC=["bpmn:MessageEventDefinition","bpmn:TimerEventDefinition","bpmn:EscalationEventDefinition","bpmn:ConditionalEventDefinition","bpmn:SignalEventDefinition"];function pg(e){const t=J(e);if(!v(t,"bpmn:BoundaryEvent")&&!(v(t,"bpmn:StartEvent")&&fn(t.$parent)))return!1;const n=t.get("eventDefinitions");return!n||!n.length?!1:CC.some(i=>v(n[0],i))}function fg(e){return v(e,"bpmn:BoundaryEvent")?"cancelActivity":"isInterrupting"}function Zl(e,t){e.invoke(Q,this),this.postExecuted("shape.replace",function(n){const i=n.context.oldShape,r=n.context.newShape,o=n.context.hints;if(!pg(r))return;const a=fg(r);if(o.targetElement&&o.targetElement[a]!==void 0)return;const c=J(i).get(a),u=J(r).get(a);c!==u&&t.updateProperties(r,{[a]:c})})}Zl.$inject=["injector","modeling"],se(Zl,Q);function Ql(e,t){Q.call(this,e),this.preExecute("shape.resize",function(n){var i=n.shape,r=Ye(i),o=r&&r.get("label"),a=o&&o.get("bounds");a&&t.updateModdleProperties(i,o,{bounds:void 0})},!0)}se(Ql,Q),Ql.$inject=["eventBus","modeling"];function Jl(e,t,n){Q.call(this,e),this.preExecute("shape.delete",function(i){var r=i.context.shape;if(!(r.incoming.length!==1||r.outgoing.length!==1)){var o=r.incoming[0],a=r.outgoing[0];if(!(!v(o,"bpmn:SequenceFlow")||!v(a,"bpmn:SequenceFlow"))&&t.canConnect(o.source,a.target,o)){var s=PC(o.waypoints,a.waypoints);n.reconnectEnd(o,a.target,s)}}})}se(Jl,Q),Jl.$inject=["eventBus","bpmnRules","modeling"];function wo(e){return e.original||e}function PC(e,t){var n=Gl(wo(e[e.length-2]),wo(e[e.length-1]),wo(t[1]),wo(t[0]));return n?[].concat(e.slice(0,e.length-1),[n],t.slice(1)):[wo(e[0]),wo(t[t.length-1])]}function ep(e,t){Q.call(this,e),this.preExecute("shape.delete",function(n){var i=n.shape,r=i.parent;v(i,"bpmn:Participant")&&(n.collaborationRoot=r)},!0),this.postExecute("shape.delete",function(n){var i=n.collaborationRoot;if(i&&!i.businessObject.participants.length){var r=t.makeProcess(),o=i.children.slice();t.moveElements(o,{x:0,y:0},r)}},!0)}ep.$inject=["eventBus","modeling"],se(ep,Q);function tp(e,t,n,i){Q.call(this,e);var r=i.get("dragging",!1);function o(c){var u=c.source,l=c.target,f=c.parent;if(f){var p,d;v(c,"bpmn:SequenceFlow")&&(n.canConnectSequenceFlow(u,l)||(d=!0),n.canConnectMessageFlow(u,l)&&(p="bpmn:MessageFlow")),v(c,"bpmn:MessageFlow")&&(n.canConnectMessageFlow(u,l)||(d=!0),n.canConnectSequenceFlow(u,l)&&(p="bpmn:SequenceFlow")),d&&t.removeConnection(c),p&&t.connect(u,l,{type:p,waypoints:c.waypoints.slice()})}}function a(c){var u=c.context,l=u.connection,f=u.newSource||l.source,p=u.newTarget||l.target,d,h;d=n.canConnect(f,p),!(!d||d.type===l.type)&&(h=t.connect(f,p,{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(),f=l&&l.payload.previousSelection,p;!f||!f.length||(p=f.indexOf(c),p!==-1&&f.splice(p,1,u))}this.postExecuted("elements.move",function(c){var u=c.closure,l=u.allConnections;D(l,o)},!0),this.preExecute("connection.reconnect",a),this.postExecuted("element.updateProperties",function(c){var u=c.context,l=u.properties,f=u.element,p=f.businessObject,d;l.default&&(d=lt(f.outgoing,ro({id:f.businessObject.default.id})),d&&t.updateProperties(d,{conditionExpression:void 0})),l.conditionExpression&&p.sourceRef.default===p&&t.updateProperties(f.source,{default:void 0})})}se(tp,Q),tp.$inject=["eventBus","modeling","bpmnRules","injector"];function tc(e,t,n,i,r,o){i.invoke(Q,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=Rn(u,function(f,p){var d=t.canReplace([p],p.host||p.parent||c);return d?f.concat(d.replacements):f},[]);l.length&&this._replaceElements(u,l)},this),this.postExecuted(["elements.move"],500,function(a){var s=a.context,c=s.newParent,u=s.newHost,l=[];D(s.closure.topLevel,function(p){fn(p)?l=l.concat(p.children):l=l.concat(p)}),l.length===1&&u&&(c=u);var f=t.canReplace(l,c);f&&this._replaceElements(l,f.replacements,u)},this),this.postExecute(["shape.replace"],1500,function(a){var s=a.context,c=s.oldShape,u=s.newShape,l=c.attachers,f;l&&l.length&&(f=t.canReplace(l,u),this._replaceElements(l,f.replacements))},this),this.postExecuted(["shape.replace"],1500,function(a){var s=a.context,c=s.oldShape,u=s.newShape;r.unclaimId(c.businessObject.id,c.businessObject),r.updateProperties(u,{id:c.id})})}se(tc,Q),tc.prototype._replaceElements=function(e,t){var n=this._elementRegistry,i=this._bpmnReplace,r=this._selection;D(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)},tc.$inject=["bpmnReplace","bpmnRules","elementRegistry","injector","modeling","selection"];var AC=1500,TC={width:140,height:120},np={width:300,height:60},ip={width:60,height:300},nc={width:300,height:150},ic={width:150,height:300},dg={width:140,height:120},hg={width:100,height:40};function mg(e){e.on("resize.start",AC,function(t){var n=t.context,i=n.shape,r=n.direction,o=n.balanced;(v(i,"bpmn:Lane")||v(i,"bpmn:Participant"))&&(n.resizeConstraints=LC(i,r,o)),v(i,"bpmn:SubProcess")&&Ge(i)&&(n.minDimensions=dg),v(i,"bpmn:TextAnnotation")&&(n.minDimensions=hg)})}mg.$inject=["eventBus"];var cr=Math.abs,MC=Math.min,kC=Math.max;function gg(e,t,n,i){var r=e[t];e[t]=r===void 0?n:i(n,r)}function Eo(e,t,n){return gg(e,t,n,MC)}function So(e,t,n){return gg(e,t,n,kC)}var OC={top:20,left:50,right:20,bottom:20},DC={top:50,left:20,right:20,bottom:20};function LC(e,t,n){var i=Wn(e),r=!0,o=!0,a=qs(i,[i]),s=ve(e),c={},u={},l=Yt(e),f=l?np:ip;/n/.test(t)?u.top=s.bottom-f.height:/e/.test(t)?u.right=s.left+f.width:/s/.test(t)?u.bottom=s.top+f.height:/w/.test(t)&&(u.left=s.right-f.width),a.forEach(function(h){var m=ve(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&&cr(s.top-m.bottom)<10&&So(c,"top",m.top+f.height),cr(s.top-m.top)<5&&Eo(u,"top",m.bottom-f.height)),/e/.test(t)&&(n&&cr(s.right-m.left)<10&&Eo(c,"right",m.right-f.width),cr(s.right-m.right)<5&&So(u,"right",m.left+f.width)),/s/.test(t)&&(n&&cr(s.bottom-m.top)<10&&Eo(c,"bottom",m.bottom-f.height),cr(s.bottom-m.bottom)<5&&So(u,"bottom",m.top+f.height)),/w/.test(t)&&(n&&cr(s.left-m.right)<10&&So(c,"left",m.left+f.width),cr(s.left-m.left)<5&&Eo(u,"left",m.right-f.width))});var p=i.children.filter(function(h){return!h.hidden&&!h.waypoints&&(v(h,"bpmn:FlowElement")||v(h,"bpmn:Artifact"))}),d=l?OC:DC;return p.forEach(function(h){var m=ve(h);/n/.test(t)&&(!l||r)&&Eo(u,"top",m.top-d.top),/e/.test(t)&&(l||o)&&So(u,"right",m.right+d.right),/s/.test(t)&&(!l||o)&&So(u,"bottom",m.bottom+d.bottom),/w/.test(t)&&(l||r)&&Eo(u,"left",m.left-d.left)}),{min:u,max:c}}function yg(e){!e||typeof e.stopPropagation!="function"||e.stopPropagation()}function Ro(e){return e.originalEvent||e.srcEvent}function rp(e){yg(e),yg(Ro(e))}function $r(e){return e.pointers&&e.pointers.length&&(e=e.pointers[0]),e.touches&&e.touches.length&&(e=e.touches[0]),e?{x:e.clientX,y:e.clientY}:null}function vg(){return/mac/i.test(navigator.platform)}function _g(e,t){return(Ro(e)||e).button===t}function ur(e){return _g(e,0)}function IC(e){return _g(e,1)}function ma(e){var t=Ro(e)||e;return ur(e)?vg()?t.metaKey:t.ctrlKey:!1}function rc(e){var t=Ro(e)||e;return ur(e)&&t.shiftKey}var bg=1001;function xg(e,t){e.on("resize.start",bg+500,function(n){var i=n.context,r=i.shape;(v(r,"bpmn:Lane")||v(r,"bpmn:Participant"))&&(i.balanced=!ma(n))}),e.on("resize.end",bg,function(n){var i=n.context,r=i.shape,o=i.canExecute,a=i.newBounds;if(v(r,"bpmn:Lane")||v(r,"bpmn:Participant"))return o&&(a=Xh(a),t.resizeLane(r,a,i.balanced)),!1})}xg.$inject=["eventBus","modeling"];var NC=500;function op(e,t,n,i,r){n.invoke(Q,this);function o(l){return Be(l,["bpmn:ReceiveTask","bpmn:SendTask"])||BC(l,["bpmn:ErrorEventDefinition","bpmn:EscalationEventDefinition","bpmn:MessageEventDefinition","bpmn:SignalEventDefinition"])}function a(l){var f=e.getDefinitions(),p=f.get("rootElements");return!!lt(p,ro({id:l.id}))}function s(l){if(v(l,"bpmn:ErrorEventDefinition"))return"errorRef";if(v(l,"bpmn:EscalationEventDefinition"))return"escalationRef";if(v(l,"bpmn:MessageEventDefinition"))return"messageRef";if(v(l,"bpmn:SignalEventDefinition"))return"signalRef"}function c(l){if(Be(l,["bpmn:ReceiveTask","bpmn:SendTask"]))return l.get("messageRef");var f=l.get("eventDefinitions"),p=f[0];return p.get(s(p))}function u(l,f){if(Be(l,["bpmn:ReceiveTask","bpmn:SendTask"]))return l.set("messageRef",f);var p=l.get("eventDefinitions"),d=p[0];return d.set(s(d),f)}this.executed(["shape.create","element.updateProperties","element.updateModdleProperties"],function(l){var f=l.shape||l.element;if(o(f)){var p=J(f),d=c(p),h;d&&!a(d)&&(h=e.getDefinitions().get("rootElements"),Mt(h,d),l.addedRootElement=d)}},!0),this.reverted(["shape.create","element.updateProperties","element.updateModdleProperties"],function(l){var f=l.addedRootElement;if(f){var p=e.getDefinitions().get("rootElements");Pt(p,f)}},!0),t.on("copyPaste.copyElement",function(l){var f=l.descriptor,p=l.element;if(!(p.labelTarget||!o(p))){var d=J(p),h=c(d);h&&(f.referencedRootElement=h)}}),t.on("copyPaste.pasteElement",NC,function(l){var f=l.descriptor,p=f.businessObject,d=f.referencedRootElement;d&&(a(d)||(d=i.copyElement(d,r.create(d.$type))),u(p,d),delete f.referencedRootElement)})}op.$inject=["bpmnjs","eventBus","injector","moddleCopy","bpmnFactory"],se(op,Q);function BC(e,t){return xe(t)||(t=[t]),Yi(t,function(n){return go(e,n)})}var wg=Math.max;function Eg(e){e.on("spaceTool.getMinDimensions",function(t){var n=t.shapes,i=t.axis,r=t.start,o={};return D(n,function(a){var s=a.id;v(a,"bpmn:Participant")&&(o[s]=jC(a,i,r)),v(a,"bpmn:Lane")&&(o[s]=Yt(a)?np:ip),v(a,"bpmn:SubProcess")&&Ge(a)&&(o[s]=dg),v(a,"bpmn:TextAnnotation")&&(o[s]=hg),v(a,"bpmn:Group")&&(o[s]=TC)}),o})}Eg.$inject=["eventBus"];function $C(e){return e==="x"}function jC(e,t,n){var i=Yt(e);if(!zC(e))return i?nc:ic;var r=$C(t),o={};return r?i?o=nc:o={width:HC(e,n,r),height:ic.height}:i?o={width:nc.width,height:FC(e,n,r)}:o=ic,o}function FC(e,t,n){var i;return i=GC(e,t,n),wg(nc.height,i)}function HC(e,t,n){var i;return i=VC(e,t,n),wg(ic.width,i)}function zC(e){return!!sr(e).length}function GC(e,t,n){var i=sr(e),r;return r=ap(i,t,n),e.height-r.height+np.height}function VC(e,t,n){var i=sr(e),r;return r=ap(i,t,n),e.width-r.width+ip.width}function ap(e,t,n){var i,r,o;for(i=0;i<e.length;i++)if(r=e[i],!n&&t>=r.y&&t<=r.y+r.height||n&&t>=r.x&&t<=r.x+r.width)return o=sr(r),o.length?ap(o,t,n):r}var Sg="_plane";function Rg(e){var t=e.id;return WC(t)}function yi(e){var t=e.id;return v(e,"bpmn:SubProcess")?Cg(t):t}function jr(e){return Cg(e)}function oc(e){var t=Ye(e);return v(t,"bpmndi:BPMNPlane")}function Cg(e){return e+Sg}function WC(e){return e.replace(new RegExp(Sg+"$"),"")}var Pg=400,UC=600,Ag={x:180,y:160};function $i(e,t,n,i,r,o,a){Q.call(this,t),this._canvas=e,this._eventBus=t,this._modeling=n,this._elementFactory=i,this._bpmnFactory=r,this._bpmnjs=o,this._elementRegistry=a;var s=this;function c(f){return v(f,"bpmn:SubProcess")&&!Ge(f)}function u(f){var p=f.shape,d=f.newRootElement,h=J(p);d=s._addDiagram(d||h),f.newRootElement=e.addRootElement(d)}function l(f){var p=f.shape,d=J(p);s._removeDiagram(d);var h=f.newRootElement=a.get(yi(d));e.removeRootElement(h)}this.executed("shape.create",function(f){var p=f.shape;c(p)&&u(f)},!0),this.postExecuted("elements.create",function(f){var p=f.elements;D(p,function(d){if(c(d)){var h=a.get(yi(d));if(!(!h||!d.children||!d.children.length)){var m=Tg(d);s._showRecursively(m),s._moveChildrenToShape(m,h)}}})},!0),this.reverted("shape.create",function(f){var p=f.shape;c(p)&&l(f)},!0),this.preExecute("shape.delete",function(f){var p=f.shape;!v(p,"bpmn:SubProcess")||!Ge(p)||D(oa([p]),d=>{n.removeShape(d.annotation)})},!0),this.preExecuted("shape.delete",function(f){var p=f.shape;if(c(p)){var d=a.get(yi(p));d&&n.removeElements(d.children.slice())}},!0),this.executed("shape.delete",function(f){var p=f.shape;c(p)&&l(f)},!0),this.reverted("shape.delete",function(f){var p=f.shape;c(p)&&u(f)},!0),this.preExecuted("shape.replace",function(f){var p=f.oldShape,d=f.newShape;!c(p)||!c(d)||(f.oldRoot=e.removeRootElement(yi(p)))},!0),this.postExecuted("shape.replace",function(f){var p=f.newShape,d=f.oldRoot,h=e.findRoot(yi(p));if(!(!d||!h)){var m=d.children;n.moveElements(m,{x:0,y:0},h)}},!0),this.executed("element.updateProperties",function(f){var p=f.element;if(v(p,"bpmn:SubProcess")){var d=f.properties,h=f.oldProperties,m=h.id,g=d.id;if(m!==g){if(oc(p)){a.updateId(p,jr(g)),a.updateId(m,g);return}var S=a.get(jr(m));S&&a.updateId(jr(m),jr(g))}}},!0),this.reverted("element.updateProperties",function(f){var p=f.element;if(v(p,"bpmn:SubProcess")){var d=f.properties,h=f.oldProperties,m=h.id,g=d.id;if(m!==g){if(oc(p)){a.updateId(p,jr(m)),a.updateId(g,m);return}var S=a.get(jr(g));S&&a.updateId(S,jr(m))}}},!0),t.on("element.changed",function(f){var p=f.element;if(oc(p)){var d=p,h=a.get(Rg(d));!h||h===d||t.fire("element.changed",{element:h})}}),this.executed("shape.toggleCollapse",Pg,function(f){var p=f.shape;v(p,"bpmn:SubProcess")&&(Ge(p)?l(f):(u(f),s._showRecursively(p.children)))},!0),this.reverted("shape.toggleCollapse",Pg,function(f){var p=f.shape;v(p,"bpmn:SubProcess")&&(Ge(p)?l(f):(u(f),s._showRecursively(p.children)))},!0),this.postExecuted("shape.toggleCollapse",UC,function(f){var p=f.shape;if(v(p,"bpmn:SubProcess")){var d=f.newRootElement;if(d)if(Ge(p))s._moveChildrenToShape(d.children.slice(),p),D(oa(p.children),m=>{n.moveShape(m.annotation,{x:0,y:0},p.parent),D(m.associations,g=>{n.moveConnection(g,{x:0,y:0},p.parent)})});else{s._disconnectSharedAnnotations(p);var h=Tg(p);s._moveChildrenToShape(h,d)}}},!0),t.on("copyPaste.createTree",function(f){var p=f.element,d=f.children;if(c(p)){var h=yi(p),m=a.get(h);m&&d.push.apply(d,m.children)}}),t.on("copyPaste.copyElement",function(f){var p=f.descriptor,d=f.element,h=f.elements,m=d.parent,g=v(Ye(m),"bpmndi:BPMNPlane");if(g){var S=Rg(m),E=lt(h,function(x){return x.id===S});E&&(p.parent=E.id)}}),t.on("copyPaste.pasteElement",function(f){var p=f.descriptor;p.parent&&(c(p.parent)||p.parent.hidden)&&(p.hidden=!0)})}se($i,Q),$i.prototype._moveChildrenToShape=function(e,t){var n=this._modeling;if(e.length){var i=e.filter(function(c){return!c.hidden});if(!i.length){n.moveElements(e,{x:0,y:0},t,{autoResize:!1});return}var r=Lt(i),o;if(!t.x)o={x:Ag.x-r.x,y:Ag.y-r.y};else{var a=we(t),s=we(r);o={x:a.x-s.x,y:a.y-s.y}}n.moveElements(e,o,t,{autoResize:!1})}},$i.prototype._disconnectSharedAnnotations=function(e){var t=this._modeling,n=new Set(_m(e).map(i=>i.annotation));n.size&&D(oa(e.children),i=>{n.has(i.annotation)&&D(i.associations,r=>{t.removeConnection(r)})})},$i.prototype._showRecursively=function(e,t){var n=this,i=[];return e.forEach(function(r){r.hidden=!!t,i=i.concat(r),r.children&&(i=i.concat(n._showRecursively(r.children,r.collapsed||t)))}),i},$i.prototype._addDiagram=function(e){var t=this._bpmnjs,n=t.getDefinitions().diagrams;return e.businessObject||(e=this._createNewDiagram(e)),n.push(e.di.$parent),e},$i.prototype._createNewDiagram=function(e){var t=this._bpmnFactory,n=this._elementFactory,i=t.create("bpmndi:BPMNPlane",{bpmnElement:e}),r=t.create("bpmndi:BPMNDiagram",{plane:i});i.$parent=r;var o=n.createRoot({id:yi(e),type:e.$type,di:i,businessObject:e,collapsed:!0});return o},$i.prototype._removeDiagram=function(e){var t=this._bpmnjs,n=t.getDefinitions().diagrams,i=lt(n,function(r){return r.plane.bpmnElement.id===e.id});return n.splice(n.indexOf(i),1),i},$i.$inject=["canvas","eventBus","modeling","elementFactory","bpmnFactory","bpmnjs","elementRegistry"];function qC(e){var t=[];return D(oa(e),n=>{t.push(n.annotation),t.push.apply(t,n.associations)}),t}function Tg(e){return e.children.slice().concat(qC(e.children)).concat(YC(e))}function YC(e){return pl(e.children||[]).reduce(function(t,n){return n.label&&n.label.parent!==e&&t.push(n.label),t},[])}function sp(e,t){e.invoke(Q,this),this.postExecuted("shape.replace",function(n){var i=n.context.oldShape,r=n.context.newShape;if(!(!v(r,"bpmn:SubProcess")||v(r,"bpmn:AdHocSubProcess")||!(v(i,"bpmn:Task")||v(i,"bpmn:CallActivity"))||!Ge(r))){var o=KC(r);t.createShape({type:"bpmn:StartEvent"},o,r)}})}sp.$inject=["injector","modeling"],se(sp,Q);function KC(e){return{x:e.x+e.width/6,y:e.y+e.height/2}}function cp(e,t){Q.call(this,e),this.preExecute("connection.create",function(n){const{target:i}=n;v(i,"bpmn:TextAnnotation")&&(n.parent=i.parent)},!0),this.preExecute(["shape.create","shape.resize","elements.move"],function(n){const i=n.shapes||[n.shape];i.length===1&&v(i[0],"bpmn:TextAnnotation")&&(n.hints=n.hints||{},n.hints.autoResize=!1)},!0),this.preExecute("shape.resize",function(n){var i=n.context,r=i.shape,o=i.hints||{};if(!(!v(r,"bpmn:TextAnnotation")||o.autoResize)){var a=i.newBounds,s=t.getTextAnnotationBounds(a,$n(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}}})}se(cp,Q),cp.$inject=["eventBus","textRenderer"];function up(e,t){Q.call(this,e),this.postExecuted("shape.toggleCollapse",1500,function(n){var i=n.shape;if(Ge(i))return;var r=Jo(i);r.forEach(function(a){var s=a.incoming.slice(),c=a.outgoing.slice();D(s,function(u){o(u,!0)}),D(c,function(u){o(u,!1)})});function o(a,s){r.indexOf(a.source)!==-1&&r.indexOf(a.target)!==-1||v(a,"bpmn:Association")&&(v(a.source,"bpmn:TextAnnotation")||v(a.target,"bpmn:TextAnnotation"))||(s?t.reconnectEnd(a,i,we(i)):t.reconnectStart(a,i,we(i)))}},!0)}se(up,Q),up.$inject=["eventBus","modeling"];var lp=500;function pp(e,t,n){Q.call(this,e);function i(a){a.length&&a.forEach(function(s){s.type==="label"&&!s.businessObject.name&&(s.hidden=!0)})}function r(a,s){var c=a.children,u=s,l,f;return l=XC(c).concat([a]),f=Bm(l),f?(u.width=Math.max(f.width,u.width),u.height=Math.max(f.height,u.height),u.x=f.x+(f.width-u.width)/2,u.y=f.y+(f.height-u.height)/2):(u.x=a.x+(a.width-u.width)/2,u.y=a.y+(a.height-u.height)/2),u}function o(a,s){return{x:a.x+(a.width-s.width)/2,y:a.y+(a.height-s.height)/2,width:s.width,height:s.height}}this.executed(["shape.toggleCollapse"],lp,function(a){var s=a.context,c=s.shape;v(c,"bpmn:SubProcess")&&(c.collapsed?Ye(c).isExpanded=!1:(i(c.children),Ye(c).isExpanded=!0))}),this.reverted(["shape.toggleCollapse"],lp,function(a){var s=a.context,c=s.shape;c.collapsed?Ye(c).isExpanded=!1:Ye(c).isExpanded=!0}),this.postExecuted(["shape.toggleCollapse"],lp,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"})})}se(pp,Q),pp.$inject=["eventBus","elementFactory","modeling"];function XC(e){return e.filter(function(t){return!t.hidden})}function fp(e,t,n,i){t.invoke(Q,this),this.preExecute("shape.delete",function(r){var o=r.context,a=o.shape,s=a.businessObject;Ne(a)||(v(a,"bpmn:Participant")&&Ge(a)&&n.ids.unclaim(s.processRef.id),i.unclaimId(s.id,s))}),this.preExecute("connection.delete",function(r){var o=r.context,a=o.connection,s=a.businessObject;i.unclaimId(s.id,s)}),this.preExecute("canvas.updateRoot",function(){var r=e.getRootElement(),o=r.businessObject;v(r,"bpmn:Collaboration")&&n.ids.unclaim(o.id)})}se(fp,Q),fp.$inject=["canvas","injector","moddle","modeling"];function dp(e,t){Q.call(this,e),this.preExecute("connection.delete",function(n){var i=n.context,r=i.connection,o=r.source;ZC(r,o)&&t.updateProperties(o,{default:null})})}se(dp,Q),dp.$inject=["eventBus","modeling"];function ZC(e,t){if(!v(e,"bpmn:SequenceFlow"))return!1;var n=J(t),i=J(e);return n.get("default")===i}var QC=500,JC=5e3,Mg=["shape.create","shape.delete","shape.move","shape.resize"],kg=[...Mg,"spaceTool","lane.add","lane.resize","lane.split","elements.create","elements.delete","elements.move"];function hp(e,t){Q.call(this,e);var n;function i(){return n=n||new eP,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(kg,JC,function(){i()}),this.postExecuted(kg,QC,function(){o()}),this.preExecute(Mg,function(a){var s=a.context,c=s.shape,u=r();!c||c.labelTarget||(v(c,"bpmn:Lane")&&u.addLane(c),v(c,"bpmn:FlowNode")&&u.addFlowNode(c))})}hp.$inject=["eventBus","modeling"],se(hp,Q);function eP(){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 tP=500,nP=5e3,Og=["connection.create","connection.delete","connection.layout","connection.move","connection.reconnect","connection.updateWaypoints","shape.create","shape.delete","shape.move","shape.resize"],Dg=[...Og,"elements.create","elements.delete","elements.move","label.create","spaceTool"];function mp(e,t){Q.call(this,e);var n;function i(){return n=n||new iP,n.enter(),n}function r(){if(!n)throw new Error("out of bounds release");return n}function o(){if(!n)throw new Error("out of bounds release");var a=n.leave();return a&&(t.updateCategoryValueRefs(Array.from(n.affectedFlowElements),Array.from(n.affectedGroupEntries.values())),n=null),a}this.preExecute(Dg,nP,function(){i()}),this.postExecuted(Dg,tP,function(){o()}),this.preExecute(Og,function(a){var s=a.context.connection||a.context.shape,c=r();!s||s.labelTarget||(v(s,"bpmn:FlowElement")&&c.addFlowElement(s),v(s,"bpmn:Group")&&c.addGroup(s))}),this.preExecute("label.create",function(a){var s=a.context.labelTarget;v(s,"bpmn:Group")&&r().addGroup(s)})}mp.$inject=["eventBus","modeling"],se(mp,Q);function iP(){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 gp(e,t){Q.call(this,e),this.postExecuted("elements.create",function(n){const i=n.context,r=i.elements;for(const o of r)rP(o)&&!aP(o)&&t.updateProperties(o,{isForCompensation:void 0})})}se(gp,Q),gp.$inject=["eventBus","modeling"];function rP(e){const t=J(e);return t&&t.isForCompensation}function oP(e){return e&&v(e,"bpmn:BoundaryEvent")&&go(e,"bpmn:CompensateEventDefinition")}function aP(e){return e.incoming.filter(n=>oP(n.source)).length>0}const sP={__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",Sl],appendBehavior:["type",Rl],associationBehavior:["type",Pl],attachEventBehavior:["type",Fs],artifactBehavior:["type",Cl],boundaryEventBehavior:["type",Al],categoryRootElementReferenceBehavior:["type",Tl],compensateBoundaryEventBehaviour:["type",Ml],createBehavior:["type",kl],createDataObjectBehavior:["type",Ol],createParticipantBehavior:["type",Il],dataInputAssociationBehavior:["type",Nl],dataStoreBehavior:["type",Bl],deleteLaneBehavior:["type",$l],detachEventBehavior:["type",Ys],dropOnFlowBehavior:["type",Fl],eventBasedGatewayBehavior:["type",Hl],fixHoverBehavior:["type",Vm],groupBehavior:["type",zl],importDockingFix:["type",Um],isHorizontalFix:["type",Vl],labelBehavior:["type",Ul],layoutConnectionBehavior:["type",ql],messageFlowBehavior:["type",Xl],nonInterruptingBehavior:["type",Zl],removeElementBehavior:["type",Jl],removeEmbeddedLabelBoundsBehavior:["type",Ql],removeParticipantBehavior:["type",ep],replaceConnectionBehavior:["type",tp],replaceElementBehaviour:["type",tc],resizeBehavior:["type",mg],resizeLaneBehavior:["type",xg],rootElementReferenceBehavior:["type",op],spaceToolBehavior:["type",Eg],subProcessPlaneBehavior:["type",$i],subProcessStartEventBehavior:["type",sp],textAnnotationBehavior:["type",cp],toggleCollapseConnectionBehaviour:["type",up],toggleElementCollapseBehaviour:["type",pp],unclaimIdBehavior:["type",fp],unsetDefaultFlowBehavior:["type",dp],updateFlowNodeRefsBehavior:["type",hp],updateCategoryValueRefsBehavior:["type",mp],setCompensationActivityAfterPasteBehavior:["type",gp]};function yp(e){this._commandStack=e.get("commandStack",!1)}yp.$inject=["injector"],yp.prototype.allowed=function(e,t){var n=!0,i=this._commandStack;return i&&(n=i.canExecute(e,t)),n===void 0?!0:n};const vi={__init__:["rules"],rules:["type",yp]};function Un(e){Q.call(this,e),this.init()}Un.$inject=["eventBus"],se(Un,Q),Un.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)})},Un.prototype.init=function(){};function Lg(e,t){var n=tn(e,t,-15);return n!=="intersect"?n:null}function rn(e){Un.call(this,e)}se(rn,Un),rn.$inject=["eventBus"],rn.prototype.init=function(){this.addRule("connection.start",function(e){var t=e.source;return cP(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 sc(t,n)}finally{r&&(n.parent=null)}}),this.addRule("connection.reconnect",function(e){var t=e.connection,n=e.source,i=e.target;return sc(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 qg(t,n,i)}),this.addRule("elements.create",function(e){var t=e.elements,n=e.position,i=e.target;return st(i)&&!cc(t,i)?!1:Pr(t,function(r){return st(r)?sc(r.source,r.target,r):r.host?ga(r,r.host,null,n):xp(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 Hg(a)&&!n.includes(a.host)})?!1:ga(n,t,null,i)||Wg(n,t,i)||Ug(n,t)||cc(n,t)}),this.addRule("shape.create",function(e){return xp(e.shape,e.target,e.source,e.position)}),this.addRule("shape.attach",function(e){return ga(e.shape,e.target,null,e.position)}),this.addRule("element.copy",function(e){var t=e.element,n=e.elements;return Qg(n,t)})},rn.prototype.canConnectMessageFlow=Xg,rn.prototype.canConnectSequenceFlow=Zg,rn.prototype.canConnectDataAssociation=wp,rn.prototype.canConnectAssociation=Yg,rn.prototype.canConnectCompensationAssociation=Kg,rn.prototype.canMove=Ug,rn.prototype.canAttach=ga,rn.prototype.canReplace=Wg,rn.prototype.canDrop=Co,rn.prototype.canInsert=cc,rn.prototype.canCreate=xp,rn.prototype.canConnect=sc,rn.prototype.canResize=qg,rn.prototype.canCopy=Qg;function cP(e){return vp(e)?null:Be(e,["bpmn:FlowNode","bpmn:InteractionNode","bpmn:DataObjectReference","bpmn:DataStoreReference","bpmn:Group","bpmn:TextAnnotation"])}function vp(e){return!e||Ne(e)}function Ig(e){do{if(v(e,"bpmn:Process"))return J(e);if(v(e,"bpmn:Participant"))return J(e).processRef||J(e)}while(e=e.parent)}function _p(e){return v(e,"bpmn:TextAnnotation")}function bp(e){return v(e,"bpmn:Group")&&!e.labelTarget}function Ng(e){return v(e,"bpmn:BoundaryEvent")&&_i(e,"bpmn:CompensateEventDefinition")}function ac(e){return J(e).isForCompensation}function uP(e,t){var n=Ig(e),i=Ig(t);return n===i}function lP(e){return v(e,"bpmn:InteractionNode")&&!v(e,"bpmn:BoundaryEvent")&&(!v(e,"bpmn:Event")||v(e,"bpmn:ThrowEvent")&&jg(e,"bpmn:MessageEventDefinition"))}function pP(e){return v(e,"bpmn:InteractionNode")&&!ac(e)&&(!v(e,"bpmn:Event")||v(e,"bpmn:CatchEvent")&&jg(e,"bpmn:MessageEventDefinition"))&&!(v(e,"bpmn:BoundaryEvent")&&!_i(e,"bpmn:MessageEventDefinition"))}function Bg(e){for(var t=e;t=t.parent;){if(v(t,"bpmn:FlowElementsContainer"))return J(t);if(v(t,"bpmn:Participant"))return J(t).processRef}return null}function $g(e,t){var n=Bg(e),i=Bg(t);return n===i}function _i(e,t){var n=J(e);return!!lt(n.eventDefinitions||[],function(i){return v(i,t)})}function jg(e,t){var n=J(e);return(n.eventDefinitions||[]).every(function(i){return v(i,t)})}function fP(e){return v(e,"bpmn:FlowNode")&&!v(e,"bpmn:EndEvent")&&!fn(e)&&!(v(e,"bpmn:IntermediateThrowEvent")&&_i(e,"bpmn:LinkEventDefinition"))&&!Ng(e)&&!ac(e)}function dP(e){return v(e,"bpmn:FlowNode")&&!v(e,"bpmn:StartEvent")&&!v(e,"bpmn:BoundaryEvent")&&!fn(e)&&!(v(e,"bpmn:IntermediateCatchEvent")&&_i(e,"bpmn:LinkEventDefinition"))&&!ac(e)}function hP(e){return v(e,"bpmn:ReceiveTask")||v(e,"bpmn:IntermediateCatchEvent")&&(_i(e,"bpmn:MessageEventDefinition")||_i(e,"bpmn:TimerEventDefinition")||_i(e,"bpmn:ConditionalEventDefinition")||_i(e,"bpmn:SignalEventDefinition"))}function mP(e){for(var t=[];e;)e=e.parent,e&&t.push(e);return t}function Fg(e,t){var n=mP(t);return n.indexOf(e)!==-1}function sc(e,t,n){if(vp(e)||vp(t))return null;if(!v(n,"bpmn:DataAssociation")){if(Xg(e,t))return{type:"bpmn:MessageFlow"};if(Zg(e,t))return{type:"bpmn:SequenceFlow"}}var i=wp(e,t);return i||(Kg(e,t)?{type:"bpmn:Association",associationDirection:"One"}:Yg(e,t)?{type:"bpmn:Association",associationDirection:"None"}:!1)}function Co(e,t){return Ne(e)||bp(e)?!0:v(t,"bpmn:Participant")&&!Ge(t)?!1:v(e,"bpmn:Participant")?v(t,"bpmn:Process")||v(t,"bpmn:Collaboration"):Be(e,["bpmn:DataInput","bpmn:DataOutput"])&&e.parent?t===e.parent:v(e,"bpmn:Lane")?v(t,"bpmn:Participant")||v(t,"bpmn:Lane"):v(e,"bpmn:BoundaryEvent")&&!gP(e)?!1:v(e,"bpmn:FlowElement")&&!v(e,"bpmn:DataStoreReference")?v(t,"bpmn:FlowElementsContainer")?Ge(t):Be(t,["bpmn:Participant","bpmn:Lane"]):v(e,"bpmn:DataStoreReference")&&v(t,"bpmn:Collaboration")?Yi(J(t).get("participants"),function(n){return!!n.get("processRef")}):Be(e,["bpmn:Artifact","bpmn:DataAssociation","bpmn:DataStoreReference"])?Be(t,["bpmn:Collaboration","bpmn:Lane","bpmn:Participant","bpmn:Process","bpmn:SubProcess"]):v(e,"bpmn:MessageFlow")?v(t,"bpmn:Collaboration")||e.source.parent==t||e.target.parent==t:!1}function gP(e){return J(e).cancelActivity&&(zg(e)||Gg(e))}function Hg(e){return!Ne(e)&&v(e,"bpmn:BoundaryEvent")}function yP(e){return v(e,"bpmn:Lane")}function vP(e){return Hg(e)||v(e,"bpmn:IntermediateThrowEvent")&&zg(e)?!0:v(e,"bpmn:IntermediateCatchEvent")&&Gg(e)}function zg(e){var t=J(e);return t&&!(t.eventDefinitions&&t.eventDefinitions.length)}function Gg(e){return Vg(e,["bpmn:MessageEventDefinition","bpmn:TimerEventDefinition","bpmn:SignalEventDefinition","bpmn:ConditionalEventDefinition"])}function Vg(e,t){return t.some(function(n){return _i(e,n)})}function _P(e){return v(e,"bpmn:ReceiveTask")&<(e.incoming,function(t){return v(t.source,"bpmn:EventBasedGateway")})}function ga(e,t,n,i){if(Array.isArray(e)||(e=[e]),e.length!==1)return!1;var r=e[0];return Ne(r)||!vP(r)||fn(t)||!v(t,"bpmn:Activity")||ac(t)||i&&!Lg(i,t)||_P(t)?!1:"attach"}function Wg(e,t,n){if(!t)return!1;var i={replacements:[]};return D(e,function(r){fn(t)||v(r,"bpmn:StartEvent")&&r.type!=="label"&&Co(r,t)&&(AS(r)||i.replacements.push({oldElementId:r.id,newElementType:"bpmn:StartEvent"}),(TS(r)||MS(r)||kS(r))&&i.replacements.push({oldElementId:r.id,newElementType:"bpmn:StartEvent"}),Vg(r,["bpmn:MessageEventDefinition","bpmn:TimerEventDefinition","bpmn:SignalEventDefinition","bpmn:ConditionalEventDefinition"])&&v(t,"bpmn:SubProcess")&&i.replacements.push({oldElementId:r.id,newElementType:"bpmn:StartEvent"})),v(t,"bpmn:Transaction")||_i(r,"bpmn:CancelEventDefinition")&&r.type!=="label"&&(v(r,"bpmn:EndEvent")&&Co(r,t)&&i.replacements.push({oldElementId:r.id,newElementType:"bpmn:EndEvent"}),v(r,"bpmn:BoundaryEvent")&&ga(r,t,null,n)&&i.replacements.push({oldElementId:r.id,newElementType:"bpmn:BoundaryEvent"}))}),i.replacements.length?i:!1}function Ug(e,t){return Yi(e,yP)?!1:t===void 0?!0:t===null?!1:e.every(function(n){return Co(n,t)})}function xp(e,t,n,i){return t?Ne(e)||bp(e)?!0:Co(e,t)||cc(e,t):!1}function qg(e,t,n){return v(e,"bpmn:SubProcess")?Ge(e)&&(!t||t.width>=100&&t.height>=80):v(e,"bpmn:Lane")||v(e,"bpmn:Participant")?!0:_p(e)?n?n==="e"||n==="w":!0:bp(e)?!0:Ne(e)?n?n==="e"||n==="w":!0:!1}function bP(e,t){var n=_p(e),i=_p(t);return(n||i)&&n!==i}function Yg(e,t){return Fg(t,e)||Fg(e,t)?!1:bP(e,t)?!0:!!wp(e,t)}function Kg(e,t){return $g(e,t)&&Ng(e)&&v(t,"bpmn:Activity")&&!wP(t,e)&&!fn(t)}function Xg(e,t){return ey(e)&&!ey(t)?!1:lP(e)&&pP(t)&&!uP(e,t)}function Zg(e,t){return fP(e)&&dP(t)&&$g(e,t)&&!(v(e,"bpmn:EventBasedGateway")&&!hP(t))}function wp(e,t){return Be(e,["bpmn:DataObjectReference","bpmn:DataStoreReference"])&&Be(t,["bpmn:Activity","bpmn:ThrowEvent"])?{type:"bpmn:DataInputAssociation"}:Be(t,["bpmn:DataObjectReference","bpmn:DataStoreReference"])&&Be(e,["bpmn:Activity","bpmn:CatchEvent"])?{type:"bpmn:DataOutputAssociation"}:!1}function cc(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:Be(t,["bpmn:SequenceFlow","bpmn:MessageFlow"])&&!Ne(t)&&v(e,"bpmn:FlowNode")&&!v(e,"bpmn:BoundaryEvent")&&Co(e,t.parent)}function Ep(e,t){return e&&t&&e.indexOf(t)!==-1}function Qg(e,t){return Ne(t)?!0:!(v(t,"bpmn:Lane")&&!Ep(e,t.parent)||v(t,"bpmn:MessageFlow")&&!xP(e,t))}function xP(e,t){var n=Jg(t.source),i=Jg(t.target);return Ep(e,n)&&Ep(e,i)}function Jg(e){for(;e;e=e.parent)if(v(e,"bpmn:Participant"))return e;return null}function ey(e){return _o(e,"bpmn:Process")||_o(e,"bpmn:Collaboration")}function wP(e,t){return e.attachers.includes(t)}const EP={__depends__:[vi],__init__:["bpmnRules"],bpmnRules:["type",rn]};var SP=2e3;function ty(e,t){e.on("saveXML.start",SP,n);function n(){var i=t.getRootElements();D(i,function(r){var o=Ye(r),a,s;a=Jo([r]),a=$e(a,function(c){return c!==r&&!c.labelTarget}),s=cn(a,Ye),o.set("planeElement",s)})}}ty.$inject=["eventBus","canvas"];const RP={__init__:["bpmnDiOrdering"],bpmnDiOrdering:["type",ty]};function uc(e){Q.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)})}uc.prototype.getOrdering=function(e,t){return null},se(uc,Q);function Sp(e,t){uc.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=lt(n,function(c){return Be(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&&!Be(u,c);)u=u.parent;if(!u)throw new Error(`no parent for <${a.id}> in <${s&&s.id}>`);return u}this.getOrdering=function(a,s){if(a.labelTarget||v(a,"bpmn:TextAnnotation"))return{parent:t.findRoot(s)||t.getRootElement(),index:-1};var c=r(a);c.containers&&(s=o(a,s,c.containers));var u=s.children.indexOf(a),l=td(s.children,function(f){return!a.labelTarget&&f.labelTarget?!1:c.level<r(f).level});return l!==-1&&u!==-1&&u<l&&(l-=1),{index:l,parent:s}}}Sp.$inject=["eventBus","canvas"],se(Sp,uc);const CP={__init__:["bpmnOrderingProvider"],bpmnOrderingProvider:["type",Sp]};function ya(){}ya.prototype.get=function(){return this._data},ya.prototype.set=function(e){this._data=e},ya.prototype.clear=function(){var e=this._data;return delete this._data,e},ya.prototype.isEmpty=function(){return!this._data};const PP={clipboard:["type",ya]};var ny=1500;function iy(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",ny,function(s){o(s)})}),(function(){var a,s;t.on("element.hover",function(c){a=c.gfx,s=c.element}),t.on("element.hover",ny,function(c){s&&t.fire("element.out",{element:s,gfx:a})}),t.on("element.out",function(){a=null,s=null})})(),this._findTargetGfx=function(a){var s,c;if(a instanceof MouseEvent)return s=$r(a),c=document.elementFromPoint(s.x,s.y),AP(c)}}iy.$inject=["elementRegistry","eventBus","injector"];function AP(e){return Or(e,"svg, .djs-element",!0)}const TP={__init__:["hoverFix"],hoverFix:["type",iy]};function MP(e){return!0}function lc(e){return ur(e)||IC(e)}var ry=500;function oy(e,t,n){var i=this;function r(T,B,k){if(!s(T,B)){var O,$,ne;k?$=t.getGraphics(k):(O=B.delegateTarget||B.target,O&&($=O,k=t.get($))),!(!$||!k)&&(ne=e.fire(T,{element:k,gfx:$,originalEvent:B}),ne===!1&&(B.stopPropagation(),B.preventDefault()))}}var o={};function a(T){return o[T]}function s(T,B){var k=u[T]||ur;return!k(B)}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":MP,"element.mousedown":lc,"element.mouseup":lc,"element.click":lc,"element.dblclick":lc};function l(T,B,k){var O=c[T];if(!O)throw new Error("unmapped DOM event name <"+T+">");return r(O,B,k)}var f="svg, .djs-element";function p(T,B,k,O){var $=o[k]=function(ne){r(k,ne)};O&&(u[k]=O),$.$delegate=Pn.bind(T,f,B,$)}function d(T,B,k){var O=a(k);O&&Pn.unbind(T,B,O.$delegate)}function h(T){D(c,function(B,k){p(T,k,B)})}function m(T){D(c,function(B,k){d(T,k,B)})}e.on("canvas.destroy",function(T){m(T.svg)}),e.on("canvas.init",function(T){h(T.svg)}),e.on(["shape.added","connection.added"],function(T){var B=T.element,k=T.gfx;e.fire("interactionEvents.createHit",{element:B,gfx:k})}),e.on(["shape.changed","connection.changed"],ry,function(T){var B=T.element,k=T.gfx;e.fire("interactionEvents.updateHit",{element:B,gfx:k})}),e.on("interactionEvents.createHit",ry,function(T){var B=T.element,k=T.gfx;i.createDefaultHit(B,k)}),e.on("interactionEvents.updateHit",function(T){var B=T.element,k=T.gfx;i.updateDefaultHit(B,k)});var g=C("djs-hit djs-hit-stroke"),S=C("djs-hit djs-hit-click-stroke"),E=C("djs-hit djs-hit-all"),x=C("djs-hit djs-hit-no-move"),w={all:E,"click-stroke":S,stroke:g,"no-move":x};function C(T,B){return B=j({stroke:"white",strokeWidth:15},B||{}),n.cls(T,["no-fill","no-border"],B)}function P(T,B){var k=w[B];if(!k)throw new Error("invalid hit type <"+B+">");return ce(T,k),T}function L(T,B){ke(T,B)}this.removeHits=function(T){var B=xs(".djs-hit",T);D(B,zt)},this.createDefaultHit=function(T,B){var k=T.waypoints,O=T.isFrame,$;return k?this.createWaypointsHit(B,k):($=O?"stroke":"all",this.createBoxHit(B,$,{width:T.width,height:T.height}))},this.createWaypointsHit=function(T,B){var k=Qo(B);return P(k,"stroke"),L(T,k),k},this.createBoxHit=function(T,B,k){k=j({x:0,y:0},k);var O=ge("rect");return P(O,B),ce(O,k),L(T,O),O},this.updateDefaultHit=function(T,B){var k=rt(".djs-hit",B);if(k)return T.waypoints?ll(k,T.waypoints):ce(k,{width:T.width,height:T.height}),k},this.fire=r,this.triggerMouseEvent=l,this.mouseHandler=a,this.registerEvent=p,this.unregisterEvent=d}oy.$inject=["eventBus","elementRegistry","styles"];const pc={__init__:["interactionEvents"],interactionEvents:["type",oy]};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();xe(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?D(e,o=>{this._selectedElements.add(o)}):this._selectedElements=new Set(e),this._eventBus.fire("selection.changed",{oldSelection:n,newSelection:this.get()})};var ay="hover",sy="selected";function cy(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,ay)}),t.on("element.out",function(r){i(r.element,ay)}),t.on("selection.changed",function(r){function o(u){i(u,sy)}function a(u){n(u,sy)}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)})}cy.$inject=["canvas","eventBus"];function uy(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;xe(u)?t.select(u):t.select(s.filter(kP))}}),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=lt(o,function(c){return a.id===c.id});s||t.select(a)}),e.on("element.click",function(r){if(ur(r)){var o=r.element;o===n.getRootElement()&&(o=null);var a=t.isSelected(o),s=t.get().length>1,c=rc(r);if(a&&s)return c?t.deselect(o):t.select(o);a?t.deselect(o):t.select(o,c)}})}uy.$inject=["eventBus","selection","canvas","elementRegistry"];function kP(e){return!e.hidden}const qn={__init__:["selectionVisuals","selectionBehavior"],__depends__:[pc],selection:["type",Po],selectionVisuals:["type",cy],selectionBehavior:["type",uy]};var OP=/^djs-cursor-.*$/;function fc(e){var t=vt(document.body);t.removeMatching(OP),e&&t.add("djs-cursor-"+e)}function ly(){fc(null)}var DP=5e3;function py(e,t){t=t||"element.click";function n(){return!1}return e.once(t,DP,n),function(){e.off(t,n)}}var LP=["c","C"],IP=["v","V"],NP=["d","D"],BP=["x","X"],$P=["y","Y"],fy=["z","Z"];function jP(e){return e.ctrlKey||e.metaKey||e.shiftKey||e.altKey}function Mn(e){return e.altKey?!1:e.ctrlKey||e.metaKey}function Gt(e,t){return e=xe(e)?e:[e],e.indexOf(t.key)!==-1||e.indexOf(t.code)!==-1}function Rp(e){return e.shiftKey}function FP(e){return Mn(e)&&Gt(LP,e)}function HP(e){return Mn(e)&&Gt(IP,e)}function zP(e){return Mn(e)&&Gt(NP,e)}function GP(e){return Mn(e)&&Gt(BP,e)}function VP(e){return Mn(e)&&!Rp(e)&&Gt(fy,e)}function WP(e){return Mn(e)&&(Gt($P,e)||Gt(fy,e)&&Rp(e))}var Ao=Math.round,dy="djs-drag-active";function Fr(e){e.preventDefault()}function UP(e){return typeof TouchEvent<"u"&&e instanceof TouchEvent}function qP(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}function hy(e,t,n,i){var r={threshold:5,trapClick:!0},o;function a(x){var w=t.viewbox(),C=t._container.getBoundingClientRect();return{x:w.x+(x.x-C.left)/w.scale,y:w.y+(x.y-C.top)/w.scale}}function s(x,w){w=w||o;var C=e.createEvent(j({},w.payload,w.data,{isTouch:w.isTouch}));return e.fire("drag."+x,C)===!1?!1:e.fire(w.prefix+"."+x,C)}function c(x){var w=x.filter(function(C){return i.get(C.id)});w.length&&n.select(w)}function u(x,w){var C=o.payload,P=o.displacement,L=o.globalStart,T=$r(x),B=ri(T,L),k=o.localStart,O=a(T),$=ri(O,k);if(!o.active&&(w||qP(B)>o.threshold)){if(j(C,{x:Ao(k.x+P.x),y:Ao(k.y+P.y),dx:0,dy:0},{originalEvent:x}),s("start")===!1)return g();o.active=!0,o.keepSelection||(C.previousSelection=n.get(),n.select(null)),o.cursor&&fc(o.cursor),t.addMarker(t.getRootElement(),dy)}rp(x),o.active&&(j(C,{x:Ao(O.x+P.x),y:Ao(O.y+P.y),dx:Ao($.x),dy:Ao($.y)},{originalEvent:x}),s("move"))}function l(x){var w,C=!0;o.active&&(x&&(o.payload.originalEvent=x,rp(x)),C=s("end")),C===!1&&s("rejected"),w=S(C!==!0),s("ended",w)}function f(x){Gt("Escape",x)&&(Fr(x),g())}function p(x){var w;o.active&&(w=py(e),setTimeout(w,400),Fr(x)),l(x)}function d(x){u(x)}function h(x){var w=o.payload;w.hoverGfx=x.gfx,w.hover=x.element,s("hover")}function m(x){s("out");var w=o.payload;w.hoverGfx=null,w.hover=null}function g(x){var w;if(o){var C=o.active;C&&s("cancel"),w=S(x),C&&s("canceled",w)}}function S(x){var w,C;s("cleanup"),ly(),o.trapClick?C=p:C=l,Te.unbind(document,"mousemove",u),Te.unbind(document,"dragstart",Fr),Te.unbind(document,"selectstart",Fr),Te.unbind(document,"mousedown",C,!0),Te.unbind(document,"mouseup",C,!0),Te.unbind(document,"keyup",f),Te.unbind(document,"touchstart",d,!0),Te.unbind(document,"touchcancel",g,!0),Te.unbind(document,"touchmove",u,!0),Te.unbind(document,"touchend",l,!0),e.off("element.hover",h),e.off("element.out",m),t.removeMarker(t.getRootElement(),dy);var P=o.payload.previousSelection;return x!==!1&&P&&!n.get().length&&c(P),w=o,o=null,w}function E(x,w,C,P){o&&g(!1),typeof w=="string"&&(P=C,C=w,w=null),P=j({},r,P||{});var L=P.data||{},T,B,k,O,$;if(P.trapClick?O=p:O=l,x?(T=Ro(x)||x,B=$r(x),rp(x),T.type==="dragstart"&&Fr(T)):(T=null,B={x:0,y:0}),k=a(B),w||(w=k),$=UP(T),o=j({prefix:C,data:L,payload:{},globalStart:B,displacement:ri(w,k),localStart:k,isTouch:$},P),P.manual||($?(Te.bind(document,"touchstart",d,!0),Te.bind(document,"touchcancel",g,!0),Te.bind(document,"touchmove",u,!0),Te.bind(document,"touchend",l,!0)):(Te.bind(document,"mousemove",u),Te.bind(document,"dragstart",Fr),Te.bind(document,"selectstart",Fr),Te.bind(document,"mousedown",O,!0),Te.bind(document,"mouseup",O,!0)),Te.bind(document,"keyup",f),e.on("element.hover",h),e.on("element.out",m)),s("init")===!1)return g(),!1;P.autoActivate&&u(x,!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(x){j(r,x)}}hy.$inject=["eventBus","canvas","selection","elementRegistry"];const ji={__depends__:[TP,qn],dragging:["type",hy]};function To(e){this._counter=0,this._prefix=(e?e+"-":"")+Math.floor(Math.random()*1e9)+"-"}To.prototype.next=function(){return this._prefix+ ++this._counter};const YP=new To("ps");var KP=["marker-start","marker-mid","marker-end"],XP=["circle","ellipse","line","path","polygon","polyline","path","rect"];function lr(e,t,n,i){this._elementRegistry=e,this._canvas=n,this._styles=i}lr.$inject=["elementRegistry","eventBus","canvas","styles"],lr.prototype.cleanUp=function(){console.warn("PreviewSupport#cleanUp is deprecated and will be removed in future versions. You do not need to manually clean up previews anymore. cf. https://github.com/bpmn-io/diagram-js/pull/906")},lr.prototype.getGfx=function(e){return this._elementRegistry.getGraphics(e)},lr.prototype.addDragger=function(e,t,n,i="djs-dragger"){n=n||this.getGfx(e);var r=Ph(n);return this._cloneMarkers(Ir(r),i),ce(r,this._styles.cls(i,[])),ke(t,r),ce(r,"data-preview-support-element-id",e.id),r},lr.prototype.addFrame=function(e,t){var n=ge("rect",{class:"djs-resize-overlay",width:e.width,height:e.height,x:e.x,y:e.y});return ke(t,n),ce(n,"data-preview-support-element-id",e.id),n},lr.prototype._cloneMarkers=function(e,t="djs-dragger",n=e){var i=this;e.childNodes&&e.childNodes.forEach(r=>{i._cloneMarkers(r,t,n)}),eA(e)&&KP.forEach(function(r){if(ce(e,r)){var o=ZP(e,r,i._canvas.getContainer());o&&i._cloneMarker(n,e,o,r,t)}})},lr.prototype._cloneMarker=function(e,t,n,i,r="djs-dragger"){var o=[n.id,r,YP.next()].join("-"),a=rt("marker#"+n.id,e);e=e||this._canvas._svg;var s=a||Ph(n);s.id=o,Ve(s).add(r);var c=rt(":scope > defs",e);c||(c=ge("defs"),ke(e,c)),ke(c,s);var u=JP(s.id);ce(t,i,u)};function ZP(e,t,n){var i=QP(ce(e,t));return rt("marker#"+i,n||document)}function QP(e){return e.match(/url\(['"]?#([^'"]*)['"]?\)/)[1]}function JP(e){return"url(#"+e+")"}function eA(e){return XP.indexOf(e.nodeName)!==-1}const Mo={__init__:["previewSupport"],previewSupport:["type",lr]};var tA="drop-ok",my="drop-not-ok",gy="attach-ok",yy="new-parent",vy="create",nA=2e3;function _y(e,t,n,i,r){function o(c,u,l,f,p){if(!u)return!1;c=$e(c,function(E){var x=E.labelTarget;return!E.parent&&!(Ne(E)&&c.indexOf(x)!==-1)});var d=lt(c,function(E){return!st(E)}),h=!1,m=!1,g=!1;xy(c)&&(h=r.allowed("shape.attach",{position:l,shape:d,target:u})),h||(xy(c)?g=r.allowed("shape.create",{position:l,shape:d,source:f,target:u}):g=r.allowed("elements.create",{elements:c,position:l,target:u}));var S=p.connectionTarget;return g||h?(d&&f&&(m=r.allowed("connection.create",{source:S===f?d:f,target:S===f?f:d,hints:{targetParent:u,targetAttach:h}})),{attach:h,connect:m}):g===null||h===null?null:!1}function a(c,u){[gy,tA,my,yy].forEach(function(l){l===u?e.addMarker(c,l):e.removeMarker(c,l)})}n.on(["create.move","create.hover"],function(c){var u=c.context,l=u.elements,f=c.hover,p=u.source,d=u.hints||{};if(!f){u.canExecute=!1,u.target=null;return}by(c);var h={x:c.x,y:c.y},m=u.canExecute=f&&o(l,f,h,p,d);f&&m!==null&&(u.target=f,m&&m.attach?a(f,gy):a(f,m?yy:my))}),n.on(["create.end","create.out","create.cleanup"],function(c){var u=c.hover;u&&a(u,null)}),n.on("create.end",function(c){var u=c.context,l=u.source,f=u.shape,p=u.elements,d=u.target,h=u.canExecute,m=h&&h.attach,g=h&&h.connect,S=u.hints||{};if(h===!1||!d)return!1;by(c);var E={x:c.x,y:c.y};g?f=i.appendShape(l,f,E,d,{attach:m,connection:g===!0?{}:g,connectionTarget:S.connectionTarget}):(p=i.createElements(p,E,d,j({},S,{attach:m})),f=lt(p,function(x){return!st(x)})),j(u,{elements:p,shape:f}),j(c,{elements:p,shape:f})});function s(){var c=t.context();c&&c.prefix===vy&&t.cancel()}n.on("create.init",function(){n.on("elements.changed",s),n.once(["create.cancel","create.end"],nA,function(){n.off("elements.changed",s)})}),this.start=function(c,u,l){xe(u)||(u=[u]);var f=lt(u,function(h){return!st(h)});if(f){l=j({elements:u,hints:{},shape:f},l||{}),D(u,function(h){Ce(h.x)||(h.x=0),Ce(h.y)||(h.y=0)});var p=$e(u,function(h){return!h.hidden}),d=Lt(p);D(u,function(h){st(h)&&(h.waypoints=cn(h.waypoints,function(m){return{x:m.x-d.x-d.width/2,y:m.y-d.y-d.height/2}})),j(h,{x:h.x-d.x-d.width/2,y:h.y-d.y-d.height/2})}),t.init(c,vy,{cursor:"grabbing",autoActivate:!0,data:{shape:f,elements:u,context:l}})}}}_y.$inject=["canvas","dragging","eventBus","modeling","rules"];function by(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 xy(e){return e&&e.length===1&&!st(e[0])}var iA=750;function wy(e,t,n,i,r){function o(a){var s=ge("g");ce(s,r.cls("djs-drag-group",["no-events"]));var c=ge("g");return a.forEach(function(u){var l;u.hidden||(u.waypoints?(l=n._createContainer("connection",c),n.drawConnection(Ir(l),u)):(l=n._createContainer("shape",c),n.drawShape(Ir(l),u),nn(l,u.x,u.y)),i.addDragger(u,s,l))}),s}t.on("create.move",iA,function(a){var s=a.hover,c=a.context,u=c.elements,l=c.dragGroup;l||(l=c.dragGroup=o(u));var f;s?(l.parentNode||(f=e.getActiveLayer(),ke(f,l)),nn(l,a.x,a.y)):zt(l)}),t.on("create.cleanup",function(a){var s=a.context,c=s.dragGroup;c&&zt(c)})}wy.$inject=["canvas","eventBus","graphicsFactory","previewSupport","styles"];const dc={__depends__:[ji,Mo,vi,qn],__init__:["create","createPreview"],create:["type",_y],createPreview:["type",wy]};function Cp(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)})}Cp.$inject=["eventBus"],Cp.prototype.getLastMoveEvent=function(){return this._lastMoveEvent||rA(0,0)};function rA(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 va={__init__:["mouse"],mouse:["type",Cp]};var Ey=2e3;function kn(e,t,n,i,r,o,a,s){this._canvas=e,this._create=t,this._elementFactory=i,this._eventBus=r,this._modeling=o,this._mouse=a,this._rules=s,r.on("copyPaste.copyElement",function(c){var u=c.descriptor,l=c.element,f=c.elementsSet;u.priority=1,u.id=l.id,f.has(l.parent)&&(u.parent=l.parent.id),oA(l)&&(u.priority=2,u.host=l.host.id),st(l)&&(u.priority=3,u.source=l.source.id,u.target=l.target.id,u.waypoints=aA(l)),Ne(l)&&(u.priority=4,u.labelTarget=l.labelTarget.id),D(["x","y","width","height"],function(p){Ce(l[p])&&(u[p]=l[p])}),u.hidden=l.hidden,u.collapsed=l.collapsed}),r.on("copyPaste.elementsCopied",Ey,function(c){var u;((u=c.hints)==null?void 0:u.clip)!==!1&&n.set(c.tree)}),r.on("copyPaste.pasteElements",Ey,function(c){c.tree||(c.tree=n.get())}),r.on("copyPaste.pasteElements",function(c){var u=c.hints;j(u,{createElementsBehavior:!1})})}kn.$inject=["canvas","create","clipboard","elementFactory","eventBus","modeling","mouse","rules"],kn.prototype.copy=function(e,t={}){var n,i;return xe(e)||(e=e?[e]:[]),n=this._eventBus.fire("copyPaste.canCopyElements",{elements:e}),n===!1?i={}:i=this.createTree(xe(n)?n:e),this._eventBus.fire("copyPaste.elementsCopied",{elements:e,tree:i,hints:t}),i},kn.prototype.paste=function(e={}){var t=this._eventBus.createEvent({type:"copyPaste.pasteElements",hints:{},...e}),n=this._eventBus.fire(t);if(n!==!1){var i=t.tree;if(i){var r=t.hints,o=this._createElements(i);if(t.element&&t.point)return this._paste(o,t.element,t.point,r);this._create.start(this._mouse.getLastMoveEvent(),o,{hints:r})}}},kn.prototype.duplicate=function(e,t={}){var n=this.copy(e,{clip:!1});return this.paste({...t,tree:n})},kn.prototype.cut=function(e){var t=this.copy(e),n=this._getElementIdsFromTree(t),i=e.filter(function(r){return n[r.id]});return i.length>0&&this._modeling.removeElements(i),t},kn.prototype._getElementIdsFromTree=function(e){var t={};return D(e,function(n){D(n,function(i){i.id&&(t[i.id]=!0)})}),t},kn.prototype._paste=function(e,t,n,i){D(e,function(o){Ce(o.x)||(o.x=0),Ce(o.y)||(o.y=0)});var r=Lt(e);return D(e,function(o){st(o)&&(o.waypoints=cn(o.waypoints,function(a){return{x:a.x-r.x-r.width/2,y:a.y-r.y-r.height/2}})),j(o,{x:o.x-r.x-r.width/2,y:o.y-r.y-r.height/2})}),this._modeling.createElements(e,n,t,j({},i))},kn.prototype._createElements=function(e){var t=this,n=this._eventBus,i={},r=[];return D(e,function(o,a){o=ai(o,"priority"),D(o,function(s){var c=j({},si(s,["priority"]));i[s.parent]?c.parent=i[s.parent]:delete c.parent,n.fire("copyPaste.pasteElement",{cache:i,descriptor:c});var u;if(st(c)){c.source=i[s.source],c.target=i[s.target],u=i[s.id]=t.createConnection(c),r.push(u);return}if(Ne(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},kn.prototype.createConnection=function(e){var t=this._elementFactory.createConnection(si(e,["id"]));return t},kn.prototype.createLabel=function(e){var t=this._elementFactory.createLabel(si(e,["id"]));return t},kn.prototype.createShape=function(e){var t=this._elementFactory.createShape(si(e,["id"]));return t},kn.prototype.hasRelations=function(e,t,n){return n||(n=new Set(t)),!(st(e)&&(!n.has(e.source)||!n.has(e.target))||Ne(e)&&!n.has(e.labelTarget))},kn.prototype.createTree=function(e){var t=this._rules,n=this,i={},r=[],o=new Map,a=Rs(e);function s(f,p){return t.allowed("element.copy",{element:f,elements:p})}function c(f,p){var d=o.get(f);if(!d){var h={element:f,depth:p};r.push(h),o.set(f,h);return}if(d.depth<p){r=u(d,r);var m={element:d.element,depth:p};r.push(m),o.set(f,m)}}function u(f,p){var d=p.indexOf(f);return d!==-1&&p.splice(d,1),p}Lr(a,function(f,p,d){if(Ne(f))return;D(f.labels,function(g){c(g,d)});function h(g){g&&g.length&&D(g,function(S){D(S.labels,function(E){c(E,d)}),c(S,d)})}D([f.attachers,f.incoming,f.outgoing],h),c(f,d);var m=[];return f.children&&(m=f.children.slice()),n._eventBus.fire("copyPaste.createTree",{element:f,children:m}),m}),e=cn(r,function(f){return f.element});var l=new Set(e);return r=cn(r,function(f){return f.descriptor={},n._eventBus.fire("copyPaste.copyElement",{descriptor:f.descriptor,element:f.element,elements:e,elementsSet:l}),f}),r=ai(r,function(f){return f.descriptor.priority}),e=cn(r,function(f){return f.element}),D(r,function(f){var p=f.depth;if(!n.hasRelations(f.element,e,l)){Ry(f.element,e),l.delete(f.element);return}if(!s(f.element,e)){Ry(f.element,e),l.delete(f.element);return}i[p]||(i[p]=[]),i[p].push(f.descriptor)}),i};function oA(e){return!!e.host}function aA(e){return cn(e.waypoints,function(t){return t=Sy(t),t.original&&(t.original=Sy(t.original)),t})}function Sy(e){return j({},e)}function Ry(e,t){var n=t.indexOf(e);return n===-1?t:t.splice(n,1)}const sA={__depends__:[PP,dc,va,vi],__init__:["copyPaste"],copyPaste:["type",kn]};function Pp(e,t,n){xe(n)||(n=[n]),D(n,function(i){Cr(e[i])||(t[i]=e[i])})}var Ap=750;function Cy(e,t,n){function i(c,u){var l=e.create(c.$type);return n.copyElement(c,l,null,u)}t.on("copyPaste.copyElement",Ap,function(c){var u=c.descriptor,l=c.element,f=J(l);if(Ne(l))return u;var p=u.businessObject=i(f,!0),d=u.di=i(Ye(l),!0);d.bpmnElement=p,Pp(p,u,"name"),Pp(d,u,"isExpanded"),f.default&&(u.default=f.default.id)});var r="-bpmn-js-refs";function o(c){return c[r]=c[r]||{}}function a(c,u){c[r]=u}function s(c,u,l){var f=J(c);return c.default&&(l[c.default]={element:f,property:"default"}),c.host&&(J(c).attachedToRef=J(u[c.host])),si(l,Rn(l,function(p,d,h){var m=d.element,g=d.property;return h===c.id&&(m.set(g,f),p.push(c.id)),p},[]))}t.on("copyPaste.pasteElement",function(c){var u=c.cache,l=c.descriptor,f=l.businessObject,p=l.di;if(Ne(l)){l.businessObject=J(u[l.labelTarget]),l.di=Ye(u[l.labelTarget]);return}f=l.businessObject=i(f),p=l.di=i(p),p.bpmnElement=f,Pp(l,f,["isExpanded","name"]),l.type=f.$type}),t.on("copyPaste.copyElement",Ap,function(c){var u=c.descriptor,l=c.element;if(v(l,"bpmn:Participant")){var f=J(l);f.processRef&&(u.processRef=i(f.processRef,!0))}}),t.on("copyPaste.pasteElement",function(c){var u=c.descriptor,l=u.processRef;l&&(u.processRef=i(l))}),t.on("copyPaste.createTree",function(c){var u=c.element,l=c.children;v(u,"bpmn:SubProcess")&&D(oa(l),f=>{l.push(f.annotation)})}),t.on("copyPaste.pasteElement",Ap,function(c){var u=c.cache,l=c.descriptor;a(u,s(l,u,o(u)))})}Cy.$inject=["bpmnFactory","eventBus","moddleCopy"];const cA=["artifacts","dataInputAssociations","dataOutputAssociations","default","flowElements","lanes","incoming","outgoing","categoryValue"],uA=["errorRef","escalationRef","messageRef","signalRef","dataObjectRef"];function _a(e,t,n){this._bpmnFactory=t,this._eventBus=e,this._moddle=n,e.on("moddleCopy.canCopyProperties",i=>{const{propertyNames:r}=i;if(!(!r||!r.length))return ai(r,o=>o==="extensionElements")}),e.on("moddleCopy.canCopyProperty",i=>{const{parent:r,property:o,propertyName:a}=i,s=Ut(r)&&r.$descriptor;if(a&&uA.includes(a))return o;if(a&&cA.includes(a)||a&&s&&!lt(s.properties,ro({name:a})))return!1}),e.on("moddleCopy.canSetCopiedProperty",i=>{const{property:r}=i;if(v(r,"bpmn:ExtensionElements")&&(!r.values||!r.values.length))return!1})}_a.$inject=["eventBus","bpmnFactory","moddle"],_a.prototype.copyElement=function(e,t,n,i=!1){n&&!xe(n)&&(n=[n]),n=n||Tp(e.$descriptor);const r=this._eventBus.fire("moddleCopy.canCopyProperties",{propertyNames:n,sourceElement:e,targetElement:t,clone:i});return r===!1||(xe(r)&&(n=r),D(n,o=>{let a;Sn(e,o)&&(a=e.get(o));const s=this.copyProperty(a,t,o,i);!Ft(s)||this._eventBus.fire("moddleCopy.canSetCopiedProperty",{parent:t,property:s,propertyName:o})===!1||t.set(o,s)})),t},_a.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 Ut(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):xe(e)?Rn(e,(a,s)=>{const c=this.copyProperty(s,t,n,i);return c?a.concat(c):a},[]):Ut(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},_a.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 Tp(e,t){return Rn(e.properties,(n,i)=>t&&i.default?n:n.concat(i.name),[])}const Py={__depends__:[sA],__init__:["bpmnCopyPaste","moddleCopy"],bpmnCopyPaste:["type",Cy],moddleCopy:["type",_a]};var Ay=Math.round;function Mp(e,t){this._modeling=e,this._eventBus=t}Mp.$inject=["modeling","eventBus"],Mp.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=Ay(s+o/2),l=Ay(c+a/2),f=i.replaceShape(e,j({},t,{x:u,y:l,width:o,height:a}),n);return r.fire("replace.end",{element:e,newElement:f,hints:n}),f};function Ty(e,t){t.on("replace.end",500,function(n){const{newElement:i,hints:r={}}=n;r.select!==!1&&e.select(i)})}Ty.$inject=["selection","eventBus"];const lA={__init__:["replace","replaceSelectionBehavior"],replaceSelectionBehavior:["type",Ty],replace:["type",Mp]};function pA(e,t,n){xe(n)||(n=[n]),D(n,function(i){Cr(e[i])||(t[i]=e[i])})}var fA=["cancelActivity","instantiate","eventGatewayType","triggeredByEvent","isInterrupting"];function dA(e,t){var n=e&&Sn(e,"collapsed")?e.collapsed:!Ge(e),i;return t&&(Sn(t,"collapsed")||Sn(t,"isExpanded"))?i=Sn(t,"collapsed")?t.collapsed:!t.isExpanded:i=n,n!==i}function My(e,t,n,i,r,o){function a(s,c,u){u=u||{};var l=c.type,f=s.businessObject;if(hc(f)&&(l==="bpmn:SubProcess"||l==="bpmn:AdHocSubProcess")&&dA(s,c))return i.toggleCollapse(s),s;var p=e.create(l),d={type:l,businessObject:p};d.di={},l==="bpmn:ExclusiveGateway"&&(d.di.isMarkerVisible=!0),pA(s.di,d.di,["fill","stroke","background-color","border-color","color"]);var h=Tp(f.$descriptor),m=Tp(p.$descriptor,!0),g=hA(h,m);j(p,ii(c,fA));var S=$e(g,function(w){return w==="eventDefinitions"?ky(s,c.eventDefinitionType):w==="loopCharacteristics"?!fn(p):Sn(p,w)||w==="processRef"&&c.isExpanded===!1||w==="triggeredByEvent"?!1:w==="isForCompensation"?!fn(p):!0});if(p=n.copyElement(f,p,S),c.eventDefinitionType&&(ky(p,c.eventDefinitionType)||(d.eventDefinitionType=c.eventDefinitionType,d.eventDefinitionAttrs=c.eventDefinitionAttrs)),v(f,"bpmn:Activity")){if(hc(f))d.isExpanded=Ge(s);else if(c&&Sn(c,"isExpanded")){d.isExpanded=c.isExpanded;var E=t.getDefaultSize(p,{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}Ge(s)&&!v(f,"bpmn:Task")&&d.isExpanded&&(d.width=s.width,d.height=s.height)}if(hc(f)&&!hc(p)&&(u.moveChildren=!1),v(f,"bpmn:Participant")){c.isExpanded===!0?p.processRef=e.create("bpmn:Process"):u.moveChildren=!1;var x=Yt(s);Ye(s).isHorizontal||(Ye(d).isHorizontal=x),d.width=x?s.width:t.getDefaultSize(d).width,d.height=x?t.getDefaultSize(d).height:s.height}return o.allowed("shape.resize",{shape:p})||(d.height=t.getDefaultSize(d).height,d.width=t.getDefaultSize(d).width),p.name=f.name,Be(f,["bpmn:ExclusiveGateway","bpmn:InclusiveGateway","bpmn:Activity"])&&Be(p,["bpmn:ExclusiveGateway","bpmn:InclusiveGateway","bpmn:Activity"])&&(p.default=f.default),c.host&&!v(f,"bpmn:BoundaryEvent")&&v(p,"bpmn:BoundaryEvent")&&(d.host=c.host),(d.type==="bpmn:DataStoreReference"||d.type==="bpmn:DataObjectReference")&&(d.x=s.x+(s.width-d.width)/2),r.replaceElement(s,d,{...u,targetElement:c})}this.replaceElement=a}My.$inject=["bpmnFactory","elementFactory","moddleCopy","modeling","replace","rules"];function hc(e){return v(e,"bpmn:SubProcess")}function ky(e,t){var n=J(e);return t&&n.get("eventDefinitions").some(function(i){return v(i,t)})}function hA(e,t){return e.filter(function(n){return t.includes(n)})}const Oy={__depends__:[Py,lA,qn],bpmnReplace:["type",My]};var mA=250;function Hr(e){this._eventBus=e,this._tools=[],this._active=null}Hr.$inject=["eventBus"],Hr.prototype.registerTool=function(e,t){var n=this._tools;if(!t)throw new Error(`A tool has to be registered with it's "events"`);n.push(e),this.bindEvents(e,t)},Hr.prototype.isActive=function(e){return e&&this._active===e},Hr.prototype.length=function(e){return this._tools.length},Hr.prototype.setActive=function(e){var t=this._eventBus;this._active!==e&&(this._active=e,t.fire("tool-manager.update",{tool:e}))},Hr.prototype.bindEvents=function(e,t){var n=this._eventBus,i=[];n.on(t.tool+".init",function(r){var o=r.context;if(!o.reactivate&&this.isActive(e)){this.setActive(null);return}this.setActive(e)},this),D(t,function(r){i.push(r+".ended"),i.push(r+".canceled")}),n.on(i,mA,function(r){this._active&&(gA(r)||this.setActive(null))},this)};function gA(e){var t=e.originalEvent&&e.originalEvent.target;return t&&Or(t,'.group[data-group="tools"]')}const mc={__depends__:[ji],__init__:["toolManager"],toolManager:["type",Hr]};function yA(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 vA(e,t){var n=[],i=new Set(e);D(t,function(o){i.add(o)});var r=new Set;return i.forEach(function(o){var a=o.incoming,s=o.outgoing;D(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 _A(e,t,n){var i=e.x,r=e.y,o=e.width,a=e.height,s=n.x,c=n.y;switch(t){case"n":return{x:i,y:r+c,width:o,height:a-c};case"s":return{x:i,y:r,width:o,height:a+c};case"w":return{x:i+s,y:r,width:o-s,height:a};case"e":return{x:i,y:r,width:o+s,height:a};default:throw new Error("unknown direction: "+t)}}var kp=Math.abs,bA=Math.round,Fi={x:"width",y:"height"},Dy="crosshair",pr={n:"top",w:"left",s:"bottom",e:"right"},xA=1500,gc={n:"s",w:"e",s:"n",e:"w"},yc=20;function Yn(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",xA,function(c){var u=c.context,l=u.initialized;l||(l=u.initialized=s.init(c,u)),l&&Iy(c)}),n.on("spaceTool.end",function(c){var u=c.context,l=u.axis,f=u.direction,p=u.movingShapes,d=u.resizingShapes,h=u.start;if(u.initialized){Iy(c);var m={x:0,y:0};m[l]=bA(c["d"+l]),s.makeSpace(p,d,m,f,h),n.once("spaceTool.ended",function(g){s.activateSelection(g.originalEvent,!0,!0)})}})}Yn.$inject=["canvas","dragging","eventBus","modeling","rules","toolManager","mouse"],Yn.prototype.activateSelection=function(e,t,n){this._dragging.init(e,"spaceTool.selection",{autoActivate:t,cursor:Dy,data:{context:{reactivate:n}},trapClick:!1})},Yn.prototype.activateMakeSpace=function(e){this._dragging.init(e,"spaceTool",{autoActivate:!0,cursor:Dy,data:{context:{}}})},Yn.prototype.makeSpace=function(e,t,n,i,r){return this._modeling.createSpace(e,t,n,i,r)},Yn.prototype.init=function(e,t){var n=kp(e.dx)>kp(e.dy)?"x":"y",i=e["d"+n],r=e[n]-i;if(kp(i)<5)return!1;i<0&&(i*=-1),ma(e)&&(i*=-1);var o=yA(n,i),a=this._canvas.getRootElement();!rc(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=wA(c,n,o,r,u);return j(t,c,{axis:n,direction:o,spaceToolConstraints:l,start:r}),fc("resize-"+(n==="x"?"ew":"ns")),!0},Yn.prototype.calculateAdjustments=function(e,t,n,i){var r=this._rules,o=[],a=[],s=new Set,c=new Set,u=[],l=[];function f(d){s.has(d)||(s.add(d),o.push(d));var h=d.label;h&&!s.has(h)&&(s.add(h),o.push(h))}function p(d){c.has(d)||(c.add(d),a.push(d))}return D(e,function(d){if(!(!d.parent||Ne(d))){if(st(d)){l.push(d);return}var h=d[t],m=h+d[Fi[t]];if(EA(d)&&(n>0&&we(d)[t]>i||n<0&&we(d)[t]<i)){u.push(d);return}if(n>0&&h>i||n<0&&m<i){f(d);return}if(h<i&&m>i&&r.allowed("shape.resize",{shape:d})){p(d);return}}}),D(o,function(d){var h=d.attachers;h&&D(h,function(m){f(m)})}),D(u,function(d){var h=d.host;(s.has(h)||c.has(h))&&f(d)}),D(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&&f(g)}),{movingShapes:o,resizingShapes:a}},Yn.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateSelection(e,!!e)},Yn.prototype.isActive=function(){var e=this._dragging.context();return e?/^spaceTool/.test(e.prefix):!1};function Ly(e){return{top:e.top-yc,right:e.right+yc,bottom:e.bottom+yc,left:e.left-yc}}function Iy(e){var t=e.context,n=t.spaceToolConstraints;if(n){var i,r;Ce(n.left)&&(i=Math.max(e.x,n.left),e.dx=e.dx+i-e.x,e.x=i),Ce(n.right)&&(i=Math.min(e.x,n.right),e.dx=e.dx+i-e.x,e.x=i),Ce(n.top)&&(r=Math.max(e.y,n.top),e.dy=e.dy+r-e.y,e.y=r),Ce(n.bottom)&&(r=Math.min(e.y,n.bottom),e.dy=e.dy+r-e.y,e.y=r)}}function wA(e,t,n,i,r){var o=e.movingShapes,a=e.resizingShapes;if(a.length){var s={},c,u,l=new Set(o),f=new Set(a);return D(a,function(p){var d=p.attachers,h=p.children,m=ve(p),g=$e(h,function($){return!st($)&&!Ne($)&&!l.has($)&&!f.has($)}),S=$e(h,function($){return!st($)&&!Ne($)&&l.has($)}),E,x,w,C=[],P=[],L,T,B,k;g.length&&(x=Ly(ve(Lt(g))),E=i-m[pr[n]]+x[pr[n]],n==="n"?s.bottom=u=Ce(u)?Math.min(u,E):E:n==="w"?s.right=u=Ce(u)?Math.min(u,E):E:n==="s"?s.top=c=Ce(c)?Math.max(c,E):E:n==="e"&&(s.left=c=Ce(c)?Math.max(c,E):E)),S.length&&(w=Ly(ve(Lt(S))),E=i-w[pr[gc[n]]]+m[pr[gc[n]]],n==="n"?s.bottom=u=Ce(u)?Math.min(u,E):E:n==="w"?s.right=u=Ce(u)?Math.min(u,E):E:n==="s"?s.top=c=Ce(c)?Math.max(c,E):E:n==="e"&&(s.left=c=Ce(c)?Math.max(c,E):E)),d&&d.length&&(d.forEach(function($){l.has($)?C.push($):P.push($)}),C.length&&(L=ve(Lt(C.map(we))),T=m[pr[gc[n]]]-(L[pr[gc[n]]]-i)),P.length&&(B=ve(Lt(P.map(we))),k=B[pr[n]]-(m[pr[n]]-i)),n==="n"?(E=Math.min(T||1/0,k||1/0),s.bottom=u=Ce(u)?Math.min(u,E):E):n==="w"?(E=Math.min(T||1/0,k||1/0),s.right=u=Ce(u)?Math.min(u,E):E):n==="s"?(E=Math.max(T||-1/0,k||-1/0),s.top=c=Ce(c)?Math.max(c,E):E):n==="e"&&(E=Math.max(T||-1/0,k||-1/0),s.left=c=Ce(c)?Math.max(c,E):E));var O=r&&r[p.id];O&&(n==="n"?(E=i+p[Fi[t]]-O[Fi[t]],s.bottom=u=Ce(u)?Math.min(u,E):E):n==="w"?(E=i+p[Fi[t]]-O[Fi[t]],s.right=u=Ce(u)?Math.min(u,E):E):n==="s"?(E=i-p[Fi[t]]+O[Fi[t]],s.top=c=Ce(c)?Math.max(c,E):E):n==="e"&&(E=i-p[Fi[t]]+O[Fi[t]],s.left=c=Ce(c)?Math.max(c,E):E))}),s}}function EA(e){return!!e.host}var Op="djs-dragging",Ny="djs-resizing",SA=250,vc=Math.max;function By(e,t,n,i,r){function o(a,s){D(a,function(c){r.addDragger(c,s),n.addMarker(c,Op)})}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=ge("g");ce(l,i.cls("djs-crosshair-group",["no-events"])),ke(s,l);var f=ge("path");ce(f,"d",u.x),Ve(f).add("djs-crosshair"),ke(l,f);var p=ge("path");ce(p,"d",u.y),Ve(p).add("djs-crosshair"),ke(l,p),c.crosshairGroup=l}),e.on("spaceTool.selection.move",function(a){var s=a.context.crosshairGroup;nn(s,a.x,a.y)}),e.on("spaceTool.selection.cleanup",function(a){var s=a.context,c=s.crosshairGroup;c&&zt(c)}),e.on("spaceTool.move",SA,function(a){var s=a.context,c=s.line,u=s.axis,l=s.movingShapes,f=s.resizingShapes;if(s.initialized){if(!s.dragGroup){var p=n.getLayer("space");c=ge("path"),ce(c,"d","M0,0 L0,0"),Ve(c).add("djs-crosshair"),ke(p,c),s.line=c;var d=ge("g");ce(d,i.cls("djs-drag-group",["no-events"])),ke(n.getActiveLayer(),d),o(l,d);var h=new Set(l);D(f,function(P){h.add(P)});var m=new Set,g=s.movingConnections=[];h.forEach(function(P){D(P.outgoing,function(L){m.has(L)||!st(L)||!h.has(L.target)||(m.add(L),g.push(L))})}),o(g,d),s.dragGroup=d}if(!s.frameGroup){var S=ge("g");ce(S,i.cls("djs-frame-group",["no-events"])),ke(n.getActiveLayer(),S);var E=[];D(f,function(P){var L=r.addFrame(P,S),T=L.getBBox();E.push({element:L,initialBounds:T}),n.addMarker(P,Ny)}),s.frameGroup=S,s.frames=E}var x={x:"M"+a.x+", -10000 L"+a.x+", 10000",y:"M -10000, "+a.y+" L 10000, "+a.y};ce(c,{d:x[u]});var w={x:"y",y:"x"},C={x:a.dx,y:a.dy};C[w[s.axis]]=0,nn(s.dragGroup,C.x,C.y),D(s.frames,function(P){var L=P.element,T=P.initialBounds,B,k;s.direction==="e"?ce(L,{width:vc(T.width+C.x,5)}):(B=vc(T.width-C.x,5),ce(L,{width:B,x:T.x+T.width-B})),s.direction==="s"?ce(L,{height:vc(T.height+C.y,5)}):(k=vc(T.height-C.y,5),ce(L,{height:k,y:T.y+T.height-k}))})}}),e.on("spaceTool.cleanup",function(a){var s=a.context,c=s.movingShapes,u=s.movingConnections,l=s.resizingShapes,f=s.line,p=s.dragGroup,d=s.frameGroup;D(c,function(h){n.removeMarker(h,Op)}),D(u,function(h){n.removeMarker(h,Op)}),p&&(zt(f),zt(p)),D(l,function(h){n.removeMarker(h,Ny)}),d&&zt(d)})}By.$inject=["eventBus","elementRegistry","canvas","styles","previewSupport"];const RA={__init__:["spaceToolPreview"],__depends__:[ji,vi,mc,Mo,va],spaceTool:["type",Yn],spaceToolPreview:["type",By]};function _c(e,t){e.invoke(Yn,this),this._canvas=t}_c.$inject=["injector","canvas"],se(_c,Yn),_c.prototype.calculateAdjustments=function(e,t,n,i){var r=this._canvas.getRootElement(),o=e[0]===r?null:e[0],a=[];o&&(a=no(po(r.children.filter(u=>v(u,"bpmn:Artifact")),Lt(o))));const s=[...e,...a];var c=Yn.prototype.calculateAdjustments.call(this,s,t,n,i);return c.resizingShapes=c.resizingShapes.filter(function(u){return!(v(u,"bpmn:TextAnnotation")||CA(u)&&(t==="y"&&Yt(u)||t==="x"&&!Yt(u)))}),c};function CA(e){return v(e,"bpmn:Participant")&&!J(e).processRef}const $y={__depends__:[RA],spaceTool:["type",_c]};function wt(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)}wt.$inject=["eventBus","injector"],wt.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()},wt.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},wt.prototype.clear=function(e){this._stack.length=0,this._stackIdx=-1,e!==!1&&this._fire("changed",{trigger:"clear"})},wt.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()}},wt.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()}},wt.prototype.register=function(e,t){this._setHandler(e,t)},wt.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)},wt.prototype.canUndo=function(){return!!this._getUndoAction()},wt.prototype.canRedo=function(){return!!this._getRedoAction()},wt.prototype._getRedoAction=function(){return this._stack[this._stackIdx+1]},wt.prototype._getUndoAction=function(){return this._stack[this._stackIdx]},wt.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)})},wt.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},wt.prototype._createId=function(){return this._uid++},wt.prototype._atomicDo=function(e){const t=this._currentExecution;t.atomic=!0;try{e()}finally{t.atomic=!1}},wt.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()},wt.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)},wt.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:nd("id",i.reverse())}),i.length=0,this._fire("changed",{trigger:t}),e.trigger=null)},wt.prototype._markDirty=function(e){const t=this._currentExecution;e&&(e=xe(e)?e:[e],t.dirty=t.dirty.concat(e))},wt.prototype._executedAction=function(e,t){const n=++this._stackIdx;t||this._stack.splice(n,this._stack.length,e)},wt.prototype._revertedAction=function(e){this._stackIdx--},wt.prototype._getHandler=function(e){return this._handlerMap[e]},wt.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 PA={commandStack:["type",wt]};function fr(e,t){if(typeof t!="function")throw new Error("removeFn iterator must be a function");if(!e)return[];for(var n;n=e[0];)t(n);return e}var AA=250,jy=1400;function Dp(e,t,n){Q.call(this,t);var i=e.get("movePreview",!1);t.on("shape.move.start",jy,function(r){var o=r.context,a=o.shapes,s=o.validatedShapes;o.shapes=Fy(a),o.validatedShapes=Fy(s)}),i&&t.on("shape.move.start",AA,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",jy,function(r){var o=r.context,a=o.closure,s=a.enclosedElements,c=[];D(s,function(u){D(u.labels,function(l){s[l.id]||c.push(l)})}),a.addAll(c)}),this.preExecute(["connection.delete","shape.delete"],function(r){var o=r.context,a=o.connection||o.shape;fr(a.labels,function(s){n.removeShape(s,{nested:!0})})}),this.execute("shape.delete",function(r){var o=r.context,a=o.shape,s=a.labelTarget;s&&(o.labelTargetIndex=fl(s.labels,a),o.labelTarget=s,a.labelTarget=null)}),this.revert("shape.delete",function(r){var o=r.context,a=o.shape,s=o.labelTarget,c=o.labelTargetIndex;s&&(Mt(s.labels,a,c),a.labelTarget=s)})}se(Dp,Q),Dp.$inject=["injector","eventBus","modeling"];function Fy(e){var t=new Set(e);return $e(e,function(n){return!t.has(n.labelTarget)})}const TA={__init__:["labelSupport"],labelSupport:["type",Dp]};var MA=251,Hy=1401,zy="attach-ok";function Lp(e,t,n,i,r){Q.call(this,t);var o=e.get("movePreview",!1);t.on("shape.move.start",Hy,function(a){var s=a.context,c=s.shapes,u=s.validatedShapes;s.shapes=kA(c),s.validatedShapes=OA(u)}),o&&t.on("shape.move.start",MA,function(a){var s=a.context,c=s.shapes,u=Ip(c);D(u,function(l){o.makeDraggable(s,l,!0),D(l.labels,function(f){o.makeDraggable(s,f,!0)})})}),o&&t.on("shape.move.start",function(a){var s=a.context,c=s.shapes;if(c.length===1){var u=c[0],l=u.host;l&&(n.addMarker(l,zy),t.once(["shape.move.out","shape.move.cleanup"],function(){n.removeMarker(l,zy)}))}}),this.preExecuted("elements.move",Hy,function(a){var s=a.context,c=s.closure,u=s.shapes,l=Ip(u);D(l,function(f){c.add(f,c.topLevel[f.host.id])})}),this.postExecuted("elements.move",function(a){var s=a.context,c=s.shapes,u=s.newHost,l;u&&c.length!==1||(u?l=c:l=$e(c,function(f){var p=f.host;return DA(f)&&!LA(c,p)}),D(l,function(f){r.updateAttachment(f,u)}))}),this.postExecuted("elements.move",function(a){var s=a.context.shapes;D(s,function(c){D(c.attachers,function(u){D(u.outgoing.slice(),function(l){var f=i.allowed("connection.reconnect",{connection:l,source:l.source,target:l.target});f||r.removeConnection(l)}),D(u.incoming.slice(),function(l){var f=i.allowed("connection.reconnect",{connection:l,source:l.source,target:l.target});f||r.removeConnection(l)})})})}),this.postExecute("shape.create",function(a){var s=a.context,c=s.shape,u=s.host;u&&r.updateAttachment(c,u)}),this.postExecute("shape.replace",function(a){var s=a.context,c=s.oldShape,u=s.newShape;fr(c.attachers,function(l){var f=i.allowed("elements.move",{target:u,shapes:[l]});f==="attach"?r.updateAttachment(l,u):r.removeShape(l)}),u.attachers.length&&D(u.attachers,function(l){var f=ag(l,c,u);r.moveShape(l,f,l.parent)})}),this.postExecute("shape.resize",function(a){var s=a.context,c=s.shape,u=s.oldBounds,l=s.newBounds,f=c.attachers,p=s.hints||{};p.attachSupport!==!1&&D(f,function(d){var h=ag(d,u,l);r.moveShape(d,h,d.parent),D(d.labels,function(m){r.moveShape(m,h,m.parent)})})}),this.preExecute("shape.delete",function(a){var s=a.context.shape;fr(s.attachers,function(c){r.removeShape(c)}),s.host&&r.updateAttachment(s,null)})}se(Lp,Q),Lp.$inject=["injector","eventBus","canvas","rules","modeling"];function Ip(e){return Tu(cn(e,function(t){return t.attachers||[]}))}function kA(e){var t=Ip(e);return b0("id",e,t)}function OA(e){var t=io(e,"id");return $e(e,function(n){for(;n;){if(n.host&&t[n.host.id])return!1;n=n.parent}return!0})}function DA(e){return!!e.host}function LA(e,t){return e.indexOf(t)!==-1}const IA={__depends__:[vi],__init__:["attachSupport"],attachSupport:["type",Lp]};function Gy(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(Ih(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)})}Gy.$inject=["eventBus","canvas","elementRegistry","graphicsFactory"];const Np={__init__:["changeSupport"],changeSupport:["type",Gy]};function Kn(e){this._model=e}Kn.$inject=["moddle"],Kn.prototype._needsId=function(e){return Be(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"])},Kn.prototype._ensureId=function(e){if(e.id){this._model.ids.claim(e.id,e);return}var t;v(e,"bpmn:Activity")?t="Activity":v(e,"bpmn:Event")?t="Event":v(e,"bpmn:Gateway")?t="Gateway":Be(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))},Kn.prototype.create=function(e,t){var n=this._model.create(e,t||{});return this._ensureId(n),n},Kn.prototype.createDiLabel=function(){return this.create("bpmndi:BPMNLabel",{bounds:this.createDiBounds()})},Kn.prototype.createDiShape=function(e,t){return this.create("bpmndi:BPMNShape",j({bpmnElement:e,bounds:this.createDiBounds()},t))},Kn.prototype.createDiBounds=function(e){return this.create("dc:Bounds",e)},Kn.prototype.createDiWaypoints=function(e){var t=this;return cn(e,function(n){return t.createDiWaypoint(n)})},Kn.prototype.createDiWaypoint=function(e){return this.create("dc:Point",ii(e,["x","y"]))},Kn.prototype.createDiEdge=function(e,t){return this.create("bpmndi:BPMNEdge",j({bpmnElement:e,waypoint:this.createDiWaypoints([])},t))},Kn.prototype.createDiPlane=function(e,t){return this.create("bpmndi:BPMNPlane",j({bpmnElement:e},t))};function On(e,t,n){Q.call(this,e),this._bpmnFactory=t;var i=this;function r(d){var h=d.context,m=h.hints||{},g;!h.cropped&&m.createElementsBehavior!==!1&&(g=h.connection,g.waypoints=n.getCroppedWaypoints(g),h.cropped=!0)}this.executed(["connection.layout","connection.create"],r),this.reverted(["connection.layout"],function(d){delete d.context.cropped});function o(d){var h=d.context;i.updateParent(h.shape||h.connection,h.oldParent)}function a(d){var h=d.context,m=h.shape||h.connection,g=h.parent||h.newParent;i.updateParent(m,g)}this.executed(["shape.move","shape.create","shape.delete","connection.create","connection.move","connection.delete"],Dn(o)),this.reverted(["shape.move","shape.create","shape.delete","connection.create","connection.move","connection.delete"],Dn(a));function s(d){var h=d.context,m=h.oldRoot,g=m.children;D(g,function(S){v(S,"bpmn:BaseElement")&&i.updateParent(S)})}this.executed(["canvas.updateRoot"],s),this.reverted(["canvas.updateRoot"],s);function c(d){var h=d.context.shape;v(h,"bpmn:BaseElement")&&i.updateBounds(h)}this.executed(["shape.move","shape.create","shape.resize"],Dn(function(d){d.context.shape.type!=="label"&&c(d)})),this.reverted(["shape.move","shape.create","shape.resize"],Dn(function(d){d.context.shape.type!=="label"&&c(d)})),e.on("shape.changed",function(d){d.element.type==="label"&&c({context:{shape:d.element}})});function u(d){i.updateConnection(d.context)}this.executed(["connection.create","connection.move","connection.delete","connection.reconnect"],Dn(u)),this.reverted(["connection.create","connection.move","connection.delete","connection.reconnect"],Dn(u));function l(d){i.updateConnectionWaypoints(d.context.connection)}this.executed(["connection.layout","connection.move","connection.updateWaypoints"],Dn(l)),this.reverted(["connection.layout","connection.move","connection.updateWaypoints"],Dn(l)),this.executed("connection.reconnect",Dn(function(d){var h=d.context,m=h.connection,g=h.oldSource,S=h.newSource,E=J(m),x=J(g),w=J(S);E.conditionExpression&&!Be(w,["bpmn:Activity","bpmn:ExclusiveGateway","bpmn:InclusiveGateway"])&&(h.oldConditionExpression=E.conditionExpression,delete E.conditionExpression),g!==S&&x.default===E&&(h.oldDefault=x.default,delete x.default)})),this.reverted("connection.reconnect",Dn(function(d){var h=d.context,m=h.connection,g=h.oldSource,S=h.newSource,E=J(m),x=J(g),w=J(S);h.oldConditionExpression&&(E.conditionExpression=h.oldConditionExpression),h.oldDefault&&(x.default=h.oldDefault,delete w.default)}));function f(d){i.updateAttachment(d.context)}this.executed(["element.updateAttachment"],Dn(f)),this.reverted(["element.updateAttachment"],Dn(f)),this.executed("element.updateLabel",Dn(p)),this.reverted("element.updateLabel",Dn(p));function p(d){const{element:h}=d.context,m=$n(h),g=Ye(h),S=g&&g.get("label");or(h)||oc(h)||(m&&!S?g.set("label",t.create("bpmndi:BPMNLabel")):!m&&S&&g.set("label",void 0))}}se(On,Q),On.$inject=["eventBus","bpmnFactory","connectionDocking"],On.prototype.updateAttachment=function(e){var t=e.shape,n=t.businessObject,i=t.host;n.attachedToRef=i&&i.businessObject},On.prototype.updateParent=function(e,t){if(!Ne(e)&&!(v(e,"bpmn:DataStoreReference")&&e.parent&&v(e.parent,"bpmn:Collaboration"))){var n=e.parent,i=e.businessObject,r=Ye(e),o=n&&n.businessObject,a=Ye(n);v(e,"bpmn:FlowNode")&&this.updateFlowNodeRefs(i,o,t&&t.businessObject),v(e,"bpmn:DataOutputAssociation")&&(e.source?o=e.source.businessObject:o=null),v(e,"bpmn:DataInputAssociation")&&(e.target?o=e.target.businessObject:o=null),this.updateSemanticParent(i,o),v(e,"bpmn:DataObjectReference")&&i.dataObjectRef&&this.updateSemanticParent(i.dataObjectRef,o),this.updateDiParent(r,a)}},On.prototype.updateBounds=function(e){var t=Ye(e),n=BA(e);if(n){var i=ri(n,t.get("bounds"));j(n,{x:e.x+i.x,y:e.y+i.y})}var r=Ne(e)?this._getLabel(t):t,o=r.bounds;o||(o=this._bpmnFactory.createDiBounds(),r.set("bounds",o)),j(o,{x:e.x,y:e.y,width:e.width,height:e.height})},On.prototype.updateFlowNodeRefs=function(e,t,n){if(n!==t){var i,r;v(n,"bpmn:Lane")&&(i=n.get("flowNodeRef"),Pt(i,e)),v(t,"bpmn:Lane")&&(r=t.get("flowNodeRef"),Mt(r,e))}},On.prototype.updateDiConnection=function(e,t,n){var i=Ye(e),r=Ye(t),o=Ye(n);i.sourceElement&&i.sourceElement.bpmnElement!==J(t)&&(i.sourceElement=t&&r),i.targetElement&&i.targetElement.bpmnElement!==J(n)&&(i.targetElement=n&&o)},On.prototype.updateDiParent=function(e,t){if(t&&!v(t,"bpmndi:BPMNPlane")&&(t=t.$parent),e.$parent!==t){var n=(t||e.$parent).get("planeElement");t?(n.push(e),e.$parent=t):(Pt(n,e),e.$parent=null)}};function NA(e){for(;e&&!v(e,"bpmn:Definitions");)e=e.$parent;return e}On.prototype.getLaneSet=function(e){var t,n;return v(e,"bpmn:Lane")?(t=e.childLaneSet,t||(t=this._bpmnFactory.create("bpmn:LaneSet"),e.childLaneSet=t,t.$parent=e),t):(v(e,"bpmn:Participant")&&(e=e.processRef),n=e.get("laneSets"),t=n[0],t||(t=this._bpmnFactory.create("bpmn:LaneSet"),t.$parent=e,n.push(t)),t)},On.prototype.updateSemanticParent=function(e,t,n){var i;if(e.$parent!==t&&!((v(e,"bpmn:DataInput")||v(e,"bpmn:DataOutput"))&&(v(t,"bpmn:Participant")&&"processRef"in t&&(t=t.processRef),"ioSpecification"in t&&t.ioSpecification===e.$parent))){if(v(e,"bpmn:Lane"))t&&(t=this.getLaneSet(t)),i="lanes";else if(v(e,"bpmn:FlowElement")){if(t){if(v(t,"bpmn:Participant"))t=t.processRef;else if(v(t,"bpmn:Lane"))do t=t.$parent.$parent;while(v(t,"bpmn:Lane"))}i="flowElements"}else if(v(e,"bpmn:Artifact")){for(;t&&!v(t,"bpmn:Process")&&!v(t,"bpmn:SubProcess")&&!v(t,"bpmn:Collaboration");)if(v(t,"bpmn:Participant")){t=t.processRef;break}else t=t.$parent;i="artifacts"}else if(v(e,"bpmn:MessageFlow"))i="messageFlows";else if(v(e,"bpmn:Participant")){i="participants";var r=e.processRef,o;r&&(o=NA(e.$parent||t),e.$parent&&(Pt(o.get("rootElements"),r),r.$parent=null),t&&(Mt(o.get("rootElements"),r),r.$parent=o))}else v(e,"bpmn:DataOutputAssociation")?i="dataOutputAssociations":v(e,"bpmn:DataInputAssociation")&&(i="dataInputAssociations");if(!i)throw new Error(`no parent for <${e.id}> in <${t.id}>`);var a;if(e.$parent&&(a=e.$parent.get(i),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))}}},On.prototype.updateConnectionWaypoints=function(e){var t=Ye(e);t.set("waypoint",this._bpmnFactory.createDiWaypoints(e.waypoints))},On.prototype.updateConnection=function(e){var t=e.connection,n=J(t),i=t.source,r=J(i),o=t.target,a=J(t.target),s;if(v(n,"bpmn:DataAssociation"))v(n,"bpmn:DataInputAssociation")?(n.get("sourceRef")[0]=r,s=e.parent||e.newParent||a,this.updateSemanticParent(n,a,s)):v(n,"bpmn:DataOutputAssociation")&&(s=e.parent||e.newParent||r,this.updateSemanticParent(n,r,s),n.targetRef=a);else{var c=v(n,"bpmn:SequenceFlow");n.sourceRef!==r&&(c&&(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)},On.prototype._getLabel=function(e){return e.label||(e.label=this._bpmnFactory.createDiLabel()),e.label};function Dn(e){return function(t){var n=t.context,i=n.shape||n.connection||n.element;v(i,"bpmn:BaseElement")&&e(t)}}function BA(e){if(v(e,"bpmn:Activity")){var t=Ye(e);if(t){var n=t.get("label");if(n)return n.get("bounds")}}}function dr(e,t){Ii.call(this),this._bpmnFactory=e,this._moddle=t}se(dr,Ii),dr.$inject=["bpmnFactory","moddle"],dr.prototype._baseCreate=Ii.prototype.create,dr.prototype.create=function(e,t){if(e==="label"){var n=t.di||this._bpmnFactory.createDiLabel();return this._baseCreate(e,j({type:"label",di:n},Nr,t))}return this.createElement(e,t)},dr.prototype.createElement=function(e,t){t=j({},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(!jA(r)){var o=j({},r||{},{id:i.id+"_di"});e==="root"?r=this._bpmnFactory.createDiPlane(i,o):e==="connection"?r=this._bpmnFactory.createDiEdge(i,o):r=this._bpmnFactory.createDiShape(i,o)}v(i,"bpmn:Group")&&(t=j({isFrame:!0},t)),t=$A(i,t,["processRef","isInterrupting","associationDirection","isForCompensation"]),t.isExpanded&&(t=Bp(r,t,"isExpanded")),Be(i,["bpmn:Lane","bpmn:Participant"])&&(t=Bp(r,t,"isHorizontal")),v(i,"bpmn:SubProcess")&&(t.collapsed=!Ge(i,r)),v(i,"bpmn:ExclusiveGateway")&&(Sn(r,"isMarkerVisible")?r.isMarkerVisible===void 0&&(r.isMarkerVisible=!1):r.isMarkerVisible=!0),Ft(t.triggeredByEvent)&&(i.triggeredByEvent=t.triggeredByEvent,delete t.triggeredByEvent),Ft(t.cancelActivity)&&(i.cancelActivity=t.cancelActivity,delete t.cancelActivity);var a,s;return t.eventDefinitionType&&(a=i.get("eventDefinitions")||[],s=this._bpmnFactory.create(t.eventDefinitionType,t.eventDefinitionAttrs),t.eventDefinitionType==="bpmn:ConditionalEventDefinition"&&(s.condition=this._bpmnFactory.create("bpmn:FormalExpression")),a.push(s),s.$parent=i,i.eventDefinitions=a,delete t.eventDefinitionType),n=this.getDefaultSize(i,r),t=j({id:i.id},n,t,{businessObject:i,di:r}),this._baseCreate(e,t)},dr.prototype.getDefaultSize=function(e,t){var n=J(e);if(t=t||Ye(e),v(n,"bpmn:SubProcess"))return Ge(n,t)?{width:350,height:200}:{width:100,height:80};if(v(n,"bpmn:Task"))return{width:100,height:80};if(v(n,"bpmn:Gateway"))return{width:50,height:50};if(v(n,"bpmn:Event"))return{width:36,height:36};if(v(n,"bpmn:Participant")){var i=t.isHorizontal===void 0||t.isHorizontal===!0;return Ge(n,t)?i?{width:600,height:250}:{width:250,height:600}:i?{width:400,height:60}:{width:60,height:400}}return v(n,"bpmn:Lane")?{width:400,height:100}:v(n,"bpmn:DataObjectReference")?{width:36,height:50}:v(n,"bpmn:DataStoreReference")?{width:50,height:50}:v(n,"bpmn:TextAnnotation")?{width:100,height:40}:v(n,"bpmn:Group")?{width:300,height:300}:{width:100,height:80}},dr.prototype.createParticipantShape=function(e){return Ut(e)||(e={isExpanded:e}),e=j({type:"bpmn:Participant"},e||{}),e.isExpanded!==!1&&(e.processRef=this._bpmnFactory.create("bpmn:Process")),this.createShape(e)};function $A(e,t,n){return D(n,function(i){t=Bp(e,t,i)}),t}function Bp(e,t,n){return t[n]===void 0?t:(e[n]=t[n],si(t,[n]))}function jA(e){return Be(e,["bpmndi:BPMNShape","bpmndi:BPMNEdge","bpmndi:BPMNDiagram","bpmndi:BPMNPlane"])}function bc(e,t){this._modeling=e,this._canvas=t}bc.$inject=["modeling","canvas"],bc.prototype.preExecute=function(e){var t=this._modeling,n=e.elements,i=e.alignment;D(n,function(r){var o={x:0,y:0};Ft(i.left)?o.x=i.left-r.x:Ft(i.right)?o.x=i.right-r.width-r.x:Ft(i.center)?o.x=i.center-Math.round(r.width/2)-r.x:Ft(i.top)?o.y=i.top-r.y:Ft(i.bottom)?o.y=i.bottom-r.height-r.y:Ft(i.middle)&&(o.y=i.middle-Math.round(r.height/2)-r.y),t.moveElements([r],o,r.parent)})},bc.prototype.postExecute=function(e){};function xc(e){this._modeling=e}xc.$inject=["modeling"],xc.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},xc.prototype.postExecute=function(e){var t=e.hints||{};FA(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 FA(e,t){return Yi(e.outgoing,function(n){return n.target===t})}function wc(e,t){this._canvas=e,this._layouter=t}wc.$inject=["canvas","layouter"],wc.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},wc.prototype.revert=function(e){var t=e.connection;return this._canvas.removeConnection(t),t.source=null,t.target=null,t};var Ec=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;D(t,function(f){Ce(f.x)||(f.x=0),Ce(f.y)||(f.y=0)});var s=$e(t,function(f){return!f.hidden}),c=Lt(s);D(t,function(f){st(f)&&(f.waypoints=cn(f.waypoints,function(p){return{x:Ec(p.x-c.x-c.width/2+r.x),y:Ec(p.y-c.y-c.height/2+r.y)}})),j(f,{x:Ec(f.x-c.x-c.width/2+r.x),y:Ec(f.y-c.y-c.height/2+r.y)})});var u=new Set(Rs(t)),l={};D(t,function(f){if(st(f)){l[f.id]=Ce(i)?a.createConnection(l[f.source.id],l[f.target.id],i,f,f.parent||n,o):a.createConnection(l[f.source.id],l[f.target.id],f,f.parent||n,o);return}var p=j({},o);u.has(f)||(p.autoResize=!1),Ne(f)&&(p=si(p,["attach"])),l[f.id]=Ce(i)?a.createShape(f,ii(f,["x","y","width","height"]),f.parent||n,i,p):a.createShape(f,ii(f,["x","y","width","height"]),f.parent||n,p)}),e.elements=no(l)};var Vy=Math.round;function hr(e){this._canvas=e}hr.$inject=["canvas"],hr.prototype.execute=function(e){var t=e.shape,n=e.position,i=e.parent,r=e.parentIndex;if(!i)throw new Error("parent required");if(!n)throw new Error("position required");return n.width!==void 0?j(t,n):j(t,{x:n.x-Vy(t.width/2),y:n.y-Vy(t.height/2)}),this._canvas.addShape(t,i,r),t},hr.prototype.revert=function(e){var t=e.shape;return this._canvas.removeShape(t),t};function ba(e){hr.call(this,e)}se(ba,hr),ba.$inject=["canvas"];var HA=hr.prototype.execute;ba.prototype.execute=function(e){var t=e.shape;return GA(t),t.labelTarget=e.labelTarget,HA.call(this,e)};var zA=hr.prototype.revert;ba.prototype.revert=function(e){return e.shape.labelTarget=null,zA.call(this,e)};function GA(e){["width","height"].forEach(function(t){typeof e[t]>"u"&&(e[t]=0)})}function xa(e,t){this._canvas=e,this._modeling=t}xa.$inject=["canvas","modeling"],xa.prototype.preExecute=function(e){var t=this._modeling,n=e.connection;fr(n.incoming,function(i){t.removeConnection(i,{nested:!0})}),fr(n.outgoing,function(i){t.removeConnection(i,{nested:!0})})},xa.prototype.execute=function(e){var t=e.connection,n=t.parent;return e.parent=n,e.parentIndex=fl(n.children,t),e.source=t.source,e.target=t.target,this._canvas.removeConnection(t),t.source=null,t.target=null,t},xa.prototype.revert=function(e){var t=e.connection,n=e.parent,i=e.parentIndex;return t.source=e.source,t.target=e.target,Mt(n.children,t,i),this._canvas.addConnection(t,n),t};function jp(e,t){this._modeling=e,this._elementRegistry=t}jp.$inject=["modeling","elementRegistry"],jp.prototype.postExecute=function(e){var t=this._modeling,n=this._elementRegistry,i=e.elements;D(i,function(r){n.get(r.id)&&(r.waypoints?t.removeConnection(r):t.removeShape(r))})};function wa(e,t){this._canvas=e,this._modeling=t}wa.$inject=["canvas","modeling"],wa.prototype.preExecute=function(e){var t=this._modeling,n=e.shape;fr(n.incoming,function(i){t.removeConnection(i,{nested:!0})}),fr(n.outgoing,function(i){t.removeConnection(i,{nested:!0})}),fr(n.children,function(i){st(i)?t.removeConnection(i,{nested:!0}):t.removeShape(i,{nested:!0})})},wa.prototype.execute=function(e){var t=this._canvas,n=e.shape,i=n.parent;return e.oldParent=i,e.oldParentIndex=fl(i.children,n),t.removeShape(n),n},wa.prototype.revert=function(e){var t=this._canvas,n=e.shape,i=e.oldParent,r=e.oldParentIndex;return Mt(i.children,n,r),t.addShape(n,i),n};function Sc(e){this._modeling=e}Sc.$inject=["modeling"];var Wy={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[Wy[i]]=0,t.moveElements([S],E,S.parent))}var l=n[0],f=s(n),p=n[f],d,h,m=0;D(n,function(g,S){var E,x,w;if(g.elements.length<2){S&&S!==n.length-1&&(o(g,g.elements[0]),m+=c(g.range));return}E=ai(g.elements,i),x=E[0],S===f&&(x=E[s(E)]),w=a(x),g.range=null,D(E,function(C){if(u(w,C),g.range===null){g.range={min:C[i],max:C[i]+C[r]};return}o(g,C)}),S&&S!==n.length-1&&(m+=c(g.range))}),h=Math.abs(p.range.min-l.range.max),d=Math.round((h-m)/(n.length-1)),!(d<n.length-1)&&D(n,function(g,S){var E={},x;g===l||g===p||(x=n[S-1],g.range.max=0,D(g.elements,function(w,C){E[Wy[i]]=0,E[i]=x.range.max-w[i]+d,g.range.min!==w[i]&&(E[i]+=w[i]-g.range.min),E[i]&&t.moveElements([w],E,w.parent),g.range.max=Math.max(w[i]+w[r],C?g.range.max:0)}))})},Sc.prototype.postExecute=function(e){};function Rc(e,t){this._layouter=e,this._canvas=t}Rc.$inject=["layouter","canvas"],Rc.prototype.execute=function(e){var t=e.connection,n=t.waypoints;return j(e,{oldWaypoints:n}),t.waypoints=this._layouter.layoutConnection(t,e.hints),t},Rc.prototype.revert=function(e){var t=e.connection;return t.waypoints=e.oldWaypoints,t};function Fp(){}Fp.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),Mt(i.children,t,r),t.parent=i,D(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},Fp.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),Mt(i.children,t,r),t.parent=i,D(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 Hp(){this.allShapes={},this.allConnections={},this.enclosedElements={},this.enclosedConnections={},this.topLevel={}}Hp.prototype.add=function(e,t){return this.addAll([e],t)},Hp.prototype.addAll=function(e,t){var n=_1(e,!!t,this);return j(this,n),this};function Ea(e){this._modeling=e}Ea.prototype.moveRecursive=function(e,t,n){return e?this.moveClosure(this.getClosure(e),t,n):[]},Ea.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),D(a,function(f){o.moveShape(f,t,u[f.id]&&!l&&n,{recurse:!1,layout:!1})}),D(s,function(f){var p=!!a[f.source.id],d=!!a[f.target.id];c[f.id]&&p&&d?o.moveConnection(f,t,u[f.id]&&!l&&n):o.layoutConnection(f,{connectionStart:p&&Yl(f,f.source,t),connectionEnd:d&&Kl(f,f.target,t)})})},Ea.prototype.getClosure=function(e){return new Hp().addAll(e,!0)};function Cc(e){this._helper=new Ea(e)}Cc.$inject=["modeling"],Cc.prototype.preExecute=function(e){e.closure=this._helper.getClosure(e.shapes)},Cc.prototype.postExecute=function(e){var t=e.hints,n;t&&t.primaryShape&&(n=t.primaryShape,t.oldParent=n.parent),this._helper.moveClosure(e.closure,e.delta,e.newParent,e.newHost,n)};function zr(e){this._modeling=e,this._helper=new Ea(e)}zr.$inject=["modeling"],zr.prototype.execute=function(e){var t=e.shape,n=e.delta,i=e.newParent||t.parent,r=e.newParentIndex,o=t.parent;return e.oldBounds=ii(t,["x","y","width","height"]),e.oldParent=o,e.oldParentIndex=Pt(o.children,t),Mt(i.children,t,r),j(t,{parent:i,x:t.x+n.x,y:t.y+n.y}),t},zr.prototype.postExecute=function(e){var t=e.shape,n=e.delta,i=e.hints,r=this._modeling;i.layout!==!1&&(D(t.incoming,function(o){r.layoutConnection(o,{connectionEnd:Kl(o,t,n)})}),D(t.outgoing,function(o){r.layoutConnection(o,{connectionStart:Yl(o,t,n)})})),i.recurse!==!1&&this.moveChildren(e)},zr.prototype.revert=function(e){var t=e.shape,n=e.oldParent,i=e.oldParentIndex,r=e.delta;return Mt(n.children,t,i),j(t,{parent:n,x:t.x-r.x,y:t.y-r.y}),t},zr.prototype.moveChildren=function(e){var t=e.delta,n=e.shape;this._helper.moveRecursive(n.children,t,null)},zr.prototype.getNewParent=function(e){return e.newParent||e.shape.parent};function Sa(e){this._modeling=e}Sa.$inject=["modeling"],Sa.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 xe(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},Sa.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||Uy(xe(r)?r[0]:r)),i&&(!n||o.docking==="target")&&(a.connectionEnd=a.connectionEnd||Uy(xe(r)?r[r.length-1]:r)),o.newWaypoints&&(a.waypoints=o.newWaypoints),this._modeling.layoutConnection(t,a))},Sa.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 Uy(e){return e.original||e}function Hi(e,t){this._modeling=e,this._rules=t}Hi.$inject=["modeling","rules"],Hi.prototype.preExecute=function(e){var t=this,n=this._modeling,i=this._rules,r=e.oldShape,o=e.newData,a=e.hints||{},s;function c(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 f;a.moveChildren!==!1&&(f=r.children.slice(),n.moveElements(f,{x:0,y:0},s,a));var p=r.incoming.slice(),d=r.outgoing.slice();D(p,function(h){var m=h.source,g=c(m,s,h);g&&t.reconnectEnd(h,s,Js(h,s,l),a)}),D(d,function(h){var m=h.target,g=c(s,m,h);g&&t.reconnectStart(h,s,Qs(h,s,l),a)})},Hi.prototype.postExecute=function(e){var t=e.oldShape;this._modeling.removeShape(t)},Hi.prototype.execute=function(e){},Hi.prototype.revert=function(e){},Hi.prototype.createShape=function(e,t,n,i){return this._modeling.createShape(e,t,n,i)},Hi.prototype.reconnectStart=function(e,t,n,i){this._modeling.reconnectStart(e,t,n,i)},Hi.prototype.reconnectEnd=function(e,t,n,i){this._modeling.reconnectEnd(e,t,n,i)};function Ra(e){this._modeling=e}Ra.$inject=["modeling"],Ra.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},j(t,{width:n.width,height:n.height,x:n.x,y:n.y}),t},Ra.prototype.postExecute=function(e){var t=this._modeling,n=e.shape,i=e.oldBounds,r=e.hints||{};r.layout!==!1&&(D(n.incoming,function(o){t.layoutConnection(o,{connectionEnd:Js(o,n,i)})}),D(n.outgoing,function(o){t.layoutConnection(o,{connectionStart:Qs(o,n,i)})}))},Ra.prototype.revert=function(e){var t=e.shape,n=e.oldBounds;return j(t,{width:n.width,height:n.height,x:n.x,y:n.y}),t};function mr(e){this._modeling=e}mr.$inject=["modeling"],mr.prototype.preExecute=function(e){var t=e.delta,n=e.direction,i=e.movingShapes,r=e.resizingShapes,o=e.start,a={};this.moveShapes(i,t),D(r,function(s){a[s.id]=WA(s)}),this.resizeShapes(r,t,n),this.updateConnectionWaypoints(vA(i,r),t,n,o,i,r,a)},mr.prototype.execute=function(){},mr.prototype.revert=function(){},mr.prototype.moveShapes=function(e,t){var n=this;D(e,function(i){n._modeling.moveShape(i,t,null,{autoResize:!1,layout:!1,recurse:!1})})},mr.prototype.resizeShapes=function(e,t,n){var i=this;D(e,function(r){var o=_A(r,n,t);i._modeling.resizeShape(r,o,null,{attachSupport:!1,autoResize:!1,layout:!1})})},mr.prototype.updateConnectionWaypoints=function(e,t,n,i,r,o,a){var s=this,c=new Set(r),u=new Set(o);D(e,function(l){var f=l.source,p=l.target,d=VA(l),h=Yy(n),m={},g=c.has(f)||u.has(f),S=c.has(p)||u.has(p);g&&S?(d=cn(d,function(E){return Ky(E,i,n)&&(E[h]=E[h]+t[h]),E.original&&Ky(E.original,i,n)&&(E.original[h]=E.original[h]+t[h]),E}),s._modeling.updateWaypoints(l,d,{labelBehavior:!1})):(g||S)&&(c.has(f)?m.connectionStart=Yl(l,f,t):c.has(p)?m.connectionEnd=Kl(l,p,t):u.has(f)?m.connectionStart=Qs(l,f,a[f.id]):u.has(p)&&(m.connectionEnd=Js(l,p,a[p.id])),s._modeling.layoutConnection(l,m))})};function qy(e){return j({},e)}function VA(e){return cn(e.waypoints,function(t){return t=qy(t),t.original&&(t.original=qy(t.original)),t})}function Yy(e){switch(e){case"n":return"y";case"w":return"x";case"s":return"y";case"e":return"x"}}function Ky(e,t,n){var i=Yy(n);if(/e|s/.test(n))return e[i]>t;if(/n|w/.test(n))return e[i]<t}function WA(e){return{x:e.x,y:e.y,height:e.height,width:e.width}}function Pc(e){this._modeling=e}Pc.$inject=["modeling"],Pc.prototype.execute=function(e){var t=e.shape,n=t.children;e.oldChildrenVisibility=Xy(n),t.collapsed=!t.collapsed;var i=Zy(n,t.collapsed);return[t].concat(i)},Pc.prototype.revert=function(e){var t=e.shape,n=e.oldChildrenVisibility,i=t.children,r=Qy(i,n);return t.collapsed=!t.collapsed,[t].concat(r)};function Xy(e){var t={};return D(e,function(n){t[n.id]=n.hidden,n.children&&(t=j({},t,Xy(n.children)))}),t}function Zy(e,t){var n=[];return D(e,function(i){i.hidden=t,n=n.concat(i),i.children&&(n=n.concat(Zy(i.children,i.collapsed||t)))}),n}function Qy(e,t){var n=[];return D(e,function(i){i.hidden=t[i.id],n=n.concat(i),i.children&&(n=n.concat(Qy(i.children,t)))}),n}function Ac(e){this._modeling=e}Ac.$inject=["modeling"],Ac.prototype.execute=function(e){var t=e.shape,n=e.newHost,i=t.host;return e.oldHost=i,e.attacherIdx=Jy(i,t),ev(n,t),t.host=n,t},Ac.prototype.revert=function(e){var t=e.shape,n=e.newHost,i=e.oldHost,r=e.attacherIdx;return t.host=i,Jy(n,t),ev(i,t,r),t};function Jy(e,t){return Pt(e&&e.attachers,t)}function ev(e,t,n){if(e){var i=e.attachers;i||(e.attachers=i=[]),Mt(i,t,n)}}function zp(){}zp.prototype.execute=function(e){var t=e.connection,n=e.newWaypoints;return e.oldWaypoints=t.waypoints,t.waypoints=n,t},zp.prototype.revert=function(e){var t=e.connection,n=e.oldWaypoints;return t.waypoints=n,t};function ct(e,t,n){this._eventBus=e,this._elementFactory=t,this._commandStack=n;var i=this;e.on("diagram.init",function(){i.registerHandlers(n)})}ct.$inject=["eventBus","elementFactory","commandStack"],ct.prototype.getHandlers=function(){return{"shape.append":xc,"shape.create":hr,"shape.delete":wa,"shape.move":zr,"shape.resize":Ra,"shape.replace":Hi,"shape.toggleCollapse":Pc,spaceTool:mr,"label.create":ba,"connection.create":wc,"connection.delete":xa,"connection.move":Fp,"connection.layout":Rc,"connection.updateWaypoints":zp,"connection.reconnect":Sa,"elements.create":$p,"elements.move":Cc,"elements.delete":jp,"elements.distribute":Sc,"elements.align":bc,"element.updateAttachment":Ac}},ct.prototype.registerHandlers=function(e){D(this.getHandlers(),function(t,n){e.registerHandler(n,t)})},ct.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)},ct.prototype.updateAttachment=function(e,t){var n={shape:e,newHost:t};this._commandStack.execute("element.updateAttachment",n)},ct.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)},ct.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)},ct.prototype.layoutConnection=function(e,t){var n={connection:e,hints:t||{}};this._commandStack.execute("connection.layout",n)},ct.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},ct.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},ct.prototype.createElements=function(e,t,n,i,r){xe(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},ct.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},ct.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},ct.prototype.removeElements=function(e){var t={elements:e};this._commandStack.execute("elements.delete",t)},ct.prototype.distributeElements=function(e,t,n){var i={groups:e,axis:t,dimension:n};this._commandStack.execute("elements.distribute",i)},ct.prototype.removeShape=function(e,t){var n={shape:e,hints:t||{}};this._commandStack.execute("shape.delete",n)},ct.prototype.removeConnection=function(e,t){var n={connection:e,hints:t||{}};this._commandStack.execute("connection.delete",n)},ct.prototype.replaceShape=function(e,t,n){var i={oldShape:e,newData:t,hints:n||{}};return this._commandStack.execute("shape.replace",i),i.newShape},ct.prototype.alignElements=function(e,t){var n={elements:e,alignment:t};this._commandStack.execute("elements.align",n)},ct.prototype.resizeShape=function(e,t,n,i){var r={shape:e,newBounds:t,minBounds:n,hints:i};this._commandStack.execute("shape.resize",r)},ct.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)},ct.prototype.updateWaypoints=function(e,t,n){var i={connection:e,newWaypoints:t,hints:n||{}};this._commandStack.execute("connection.updateWaypoints",i)},ct.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)},ct.prototype.reconnectStart=function(e,t,n,i){i||(i={}),this.reconnect(e,t,e.target,n,j(i,{docking:"source"}))},ct.prototype.reconnectEnd=function(e,t,n,i){i||(i={}),this.reconnect(e,e.source,t,n,j(i,{docking:"target"}))},ct.prototype.connect=function(e,t,n,i){return this.createConnection(e,t,n||{},e.parent,i)},ct.prototype._create=function(e,t){return rS(t)?t:this._elementFactory.create(e,t)},ct.prototype.toggleCollapse=function(e,t){var n={shape:e,hints:t||{}};this._commandStack.execute("shape.toggleCollapse",n)};function Ca(e){this._elementRegistry=e}Ca.$inject=["elementRegistry"],Ca.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||UA(n,Ja(i));return tv(n,i),e.oldProperties=o,e.changed=r,r},Ca.prototype.revert=function(e){var t=e.oldProperties,n=e.moddleElement,i=e.changed;return tv(n,t),i},Ca.prototype._getVisualReferences=function(e){var t=this._elementRegistry;return v(e,"bpmn:DataObject")?qA(e,t):[]};function UA(e,t){return Rn(t,function(n,i){return n[i]=e.get(i),n},{})}function tv(e,t){D(t,function(n,i){e.set(i,n)})}function qA(e,t){return t.filter(function(n){return v(n,"bpmn:DataObjectReference")&&J(n).dataObjectRef===e})}var Pa="default",zi="id",nv="di",YA={width:0,height:0};function Aa(e,t,n,i){this._elementRegistry=e,this._moddle=t,this._modeling=n,this._textRenderer=i}Aa.$inject=["elementRegistry","moddle","modeling","textRenderer"],Aa.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=JA(e.properties),s=e.oldProperties||KA(t,a);return iv(a,o)&&(r.unclaim(o[zi]),i.updateId(t,a[zi]),r.claim(a[zi],o)),Pa in a&&(a[Pa]&&n.push(i.get(a[Pa].id)),o[Pa]&&n.push(i.get(o[Pa].id))),rv(t,a),e.oldProperties=s,e.changed=n,n},Aa.prototype.postExecute=function(e){var t=e.element,n=t.label,i=n&&J(n).name;if(i){var r=this._textRenderer.getExternalLabelBounds(n,i);this._modeling.resizeShape(n,r,YA)}},Aa.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 rv(t,i),iv(n,r)&&(a.unclaim(n[zi]),o.updateId(t,i[zi]),a.claim(i[zi],r)),e.changed};function iv(e,t){return zi in e&&e[zi]!==t[zi]}function KA(e,t){var n=Ja(t),i=e.businessObject,r=Ye(e);return Rn(n,function(o,a){return a!==nv?o[a]=i.get(a):o[a]=XA(r,Ja(t.di)),o},{})}function XA(e,t){return Rn(t,function(n,i){return n[i]=e&&e.get(i),n},{})}function rv(e,t){var n=e.businessObject,i=Ye(e);D(t,function(r,o){o!==nv?n.set(o,r):i&&ZA(i,r)})}function ZA(e,t){D(t,function(n,i){e.set(i,n)})}var QA=["default"];function JA(e){var t=j({},e);return QA.forEach(function(n){n in e&&(t[n]=J(t[n]))}),t}function Tc(e,t){this._canvas=e,this._modeling=t}Tc.$inject=["canvas","modeling"],Tc.prototype.execute=function(e){var t=this._canvas,n=e.newRoot,i=n.businessObject,r=t.getRootElement(),o=r.businessObject,a=o.$parent,s=Ye(r);return t.setRootElement(n),t.removeRootElement(r),Mt(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,[]},Tc.prototype.revert=function(e){var t=this._canvas,n=e.newRoot,i=n.businessObject,r=e.oldRoot,o=r.businessObject,a=i.$parent,s=Ye(n);return t.setRootElement(r),t.removeRootElement(n),Pt(a.rootElements,i),i.$parent=null,Mt(a.rootElements,o),o.$parent=a,n.di=null,s.bpmnElement=o,r.di=s,[]};function Gp(e,t){this._modeling=e,this._spaceTool=t}Gp.$inject=["modeling","spaceTool"],Gp.prototype.preExecute=function(e){var t=this._spaceTool,n=this._modeling,i=e.shape,r=e.location,o=Wn(i),a=o===i,s=a?i:i.parent,c=sr(s),u=Yt(i);if(u?r==="left"?r="top":r==="right"&&(r="bottom"):r==="top"?r="left":r==="bottom"&&(r="right"),!c.length){var l=u?{x:i.x+Vn,y:i.y,width:i.width-Vn,height:i.height}:{x:i.x,y:i.y+Vn,width:i.width,height:i.height-Vn};n.createShape({type:"bpmn:Lane",isHorizontal:u},l,s)}var f=[];Lr(o,function(w){return f.push(w),w.label&&f.push(w.label),w===i?[]:$e(w.children,function(C){return C!==i})});var p,d,h,m,g;r==="top"?(p=-120,d=i.y,h=d+10,m="n",g="y"):r==="left"?(p=-120,d=i.x,h=d+10,m="w",g="x"):r==="bottom"?(p=120,d=i.y+i.height,h=d-10,m="s",g="y"):r==="right"&&(p=120,d=i.x+i.width,h=d-10,m="e",g="x");var S=t.calculateAdjustments(f,g,p,h),E=u?{x:0,y:p}:{x:p,y:0};t.makeSpace(S.movingShapes,S.resizingShapes,E,m,h);var x=u?{x:i.x+(a?Vn:0),y:d-(r==="top"?120:0),width:i.width-(a?Vn:0),height:120}:{x:d-(r==="left"?120:0),y:i.y+(a?Vn:0),width:120,height:i.height-(a?Vn:0)};e.newLane=n.createShape({type:"bpmn:Lane",isHorizontal:u},x,s)};function Vp(e){this._modeling=e}Vp.$inject=["modeling"],Vp.prototype.preExecute=function(e){var t=this._modeling,n=e.shape,i=e.count,r=sr(n),o=r.length;if(o>i)throw new Error(`more than <${i}> child lanes`);var a=Yt(n),s=a?n.height:n.width,c=Math.round(s/i),u,l,f,p;for(p=0;p<i;p++)p===i-1?u=s-c*p:u=c,l=a?{x:n.x+Vn,y:n.y+p*c,width:n.width-Vn,height:u}:{x:n.x+p*c,y:n.y+Vn,width:u,height:n.height-Vn},p<o?t.resizeShape(r[p],l):(f={type:"bpmn:Lane",isHorizontal:a},t.createShape(f,l,n))};function Ta(e,t){this._modeling=e,this._spaceTool=t}Ta.$inject=["modeling","spaceTool"],Ta.prototype.preExecute=function(e){var t=e.shape,n=e.newBounds,i=e.balanced;i!==!1?this.resizeBalanced(t,n):this.resizeSpace(t,n)},Ta.prototype.resizeBalanced=function(e,t){var n=this._modeling,i=qR(e,t);n.resizeShape(e,t),i.forEach(function(r){n.resizeShape(r.shape,r.newBounds)})},Ta.prototype.resizeSpace=function(e,t){var n=this._spaceTool,i=ve(e),r=ve(t),o=Nm(r,i),a=Wn(e),s=[],c=[];Lr(a,function(h){return s.push(h),(v(h,"bpmn:Lane")||v(h,"bpmn:Participant"))&&c.push(h),h.children});var u,l,f,p,d;(o.bottom||o.top)&&(u=o.bottom||o.top,l=e.y+(o.bottom?e.height:0)+(o.bottom?-10:10),f=o.bottom?"s":"n",p=o.top>0||o.bottom<0?-u:u,d=n.calculateAdjustments(s,"y",p,l),n.makeSpace(d.movingShapes,d.resizingShapes,{x:0,y:u},f)),(o.left||o.right)&&(u=o.right||o.left,l=e.x+(o.right?e.width:0)+(o.right?-10:100),f=o.right?"e":"w",p=o.left>0||o.right<0?-u:u,d=n.calculateAdjustments(c,"x",p,l),n.makeSpace(d.movingShapes,d.resizingShapes,{x:u,y:0},f))};var Ma="flowNodeRef",Wp="lanes";function Mc(){}Mc.prototype._computeUpdates=function(e,t){var n=[],i=[],r={},o=[];function a(l,f){var p=ve(f),d={x:l.x+l.width/2,y:l.y+l.height/2};return d.x>p.left&&d.x<p.right&&d.y>p.top&&d.y<p.bottom}function s(l){n.indexOf(l)===-1&&(o.push(l),n.push(l))}function c(l){var f=Wn(l);return r[f.id]||(r[f.id]=qs(f)),r[f.id]}function u(l){if(!l.parent)return[];var f=c(l);return f.filter(function(p){return a(l,p)}).map(function(p){return p.businessObject})}return t.forEach(function(l){var f=Wn(l);if(!(!f||n.indexOf(f)!==-1)){var p=f.children.filter(function(d){return v(d,"bpmn:FlowNode")});p.forEach(s),n.push(f)}}),e.forEach(s),o.forEach(function(l){var f=l.businessObject,p=f.get(Wp),d=p.slice(),h=u(l);i.push({flowNode:f,remove:d,add:h})}),t.forEach(function(l){var f=l.businessObject;l.parent||f.get(Ma).forEach(function(p){i.push({flowNode:p,remove:[f],add:[]})})}),i},Mc.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(Wp);n.remove.forEach(function(o){Pt(r,o),Pt(o.get(Ma),i)}),n.add.forEach(function(o){Mt(r,o),Mt(o.get(Ma),i)})}),[]},Mc.prototype.revert=function(e){var t=e.updates;return t.forEach(function(n){var i=n.flowNode,r=i.get(Wp);n.add.forEach(function(o){Pt(r,o),Pt(o.get(Ma),i)}),n.remove.forEach(function(o){Mt(r,o),Mt(o.get(Ma),i)})}),[]};var Up="categoryValueRef";function ka(e,t){this._bpmnFactory=e,this._elementRegistry=t}ka.$inject=["bpmnFactory","elementRegistry"],ka.prototype._computeUpdates=function(e,t){var n=this._elementRegistry,i=this._bpmnFactory,r=new Map,o=[],a=new Map;function s(E,x,w){if(x){var C=a.get(E);C||(C={},a.set(E,C)),!(w&&C.present)&&(!w&&C.past||(w?C.present={categoryValue:x,root:qp(E)}:C.past={categoryValue:x}))}}function c(E){r.set(E,J(E))}function u(){n.filter(function(E){return v(E,"bpmn:FlowElement")&&!Ne(E)&&E.parent}).forEach(c)}function l(E){var x=J(E),w=x.get("categoryValueRef");return w||(w=km(i,x),o.push(eT(E,w))),w}function f(E){return E.reduce(function(x,w){var C=qp(w),P=x.get(C);return P||(P=[],x.set(C,P)),P.push(w),x},new Map)}e=Array.from(e||[]);var p=f(e);t.length&&u(),e.forEach(c),n.filter(function(E){return v(E,"bpmn:Group")&&!Ne(E)&&E.parent}).forEach(function(E){var x=J(E).get("categoryValueRef");if(!x){var w=qp(E),C=p.get(w)||[],P=po(C,E),L=Object.keys(P).length>0;L&&(x=l(E))}s(E,x,!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,x){return x.present&&E.add(x.present.categoryValue),x.past&&E.add(x.past.categoryValue),E},new Set),m=new Map,g=f(d);a.forEach(function(E,x){var w=E.present;if(w){var C=g.get(w.root)||[],P=po(C,x);C.forEach(function(L){if(P[L.id]){var T=m.get(L);T||(T=new Set,m.set(L,T)),T.add(w.categoryValue)}})}});var S=d.reduce(function(E,x){var w=r.get(x),C=w.get(Up),P=new Set(C),L=m.get(x)||new Set,T=Array.from(L).filter(function(k){return!P.has(k)}),B=C.filter(function(k){return h.has(k)&&!L.has(k)});return(T.length||B.length)&&E.push({businessObject:w,categoryValuesToAdd:T,categoryValuesToRemove:B}),E},[]);return{flowElements:S,groups:o}},ka.prototype.execute=function(e){var t=e.updates;return t||(t=e.updates=this._computeUpdates(e.affectedFlowElements,e.affectedGroupEntries)),tT(t.groups),iT(t.flowElements),[]},ka.prototype.revert=function(e){var t=e.updates;return rT(t.flowElements),nT(t.groups),[]};function eT(e,t){return{groupShape:e,categoryValue:t,category:t.$parent}}function tT(e){e.forEach(function(t){J(t.groupShape).categoryValueRef=t.categoryValue,t.categoryValue.$parent=t.category})}function nT(e){e.forEach(function(t){J(t.groupShape).categoryValueRef=null})}function iT(e){e.forEach(function(t){var n=t.businessObject,i=n.get(Up);t.categoryValuesToRemove.forEach(function(r){Pt(i,r)}),t.categoryValuesToAdd.forEach(function(r){Mt(i,r,!0)})})}function rT(e){e.forEach(function(t){var n=t.businessObject,i=n.get(Up);t.categoryValuesToAdd.forEach(function(r){Pt(i,r)}),t.categoryValuesToRemove.forEach(function(r){Mt(i,r,!0)})})}function qp(e){for(;e.parent;)e=e.parent;return e}function kc(e){this._moddle=e}kc.$inject=["moddle"],kc.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),[]},kc.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 oT={fill:void 0,stroke:void 0};function Yp(e){this._commandStack=e,this._normalizeColor=function(t){if(t){if(En(t)){var n=aT(t);if(n)return n}throw new Error(`invalid color value: ${t}`)}}}Yp.$inject=["commandStack"],Yp.prototype.postExecute=function(e){var t=e.elements,n=e.colors||oT,i=this,r={};"fill"in n&&j(r,{"background-color":this._normalizeColor(n.fill)}),"stroke"in n&&j(r,{"border-color":this._normalizeColor(n.stroke)}),D(t,function(o){var a=st(o)?ii(r,["border-color"]):r,s=Ye(o);if(sT(a),Ne(o)){if(!s||!v(s.label,"bpmndi:BPMNLabel"))return;i._commandStack.execute("element.updateModdleProperties",{element:o,moddleElement:s.label,properties:{color:r["border-color"]}})}else{if(!Be(s,["bpmndi:BPMNEdge","bpmndi:BPMNShape"]))return;i._commandStack.execute("element.updateProperties",{element:o,properties:{di:a}})}})};function aT(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 sT(e){"border-color"in e&&(e.stroke=e["border-color"]),"background-color"in e&&(e.fill=e["background-color"])}var cT={width:0,height:0};function ov(e,t,n){function i(c,u){var l=c.label||c,f=c.labelTarget||c;return NS(l,u),[l,f]}function r(c){var u=c.element,l=u.businessObject,f=c.newLabel;if(!Ne(u)&&or(u)&&!Ls(u)&&!av(f)){var p=7,d=vl(u);d={x:d.x,y:d.y+p},e.createLabel(u,d,{id:l.id+"_label",businessObject:l,di:u.di})}}function o(c){return c.oldLabel=$n(c.element),i(c.element,c.newLabel)}function a(c){return i(c.element,c.oldLabel)}function s(c){var u=c.element,l=u.label||u,f=c.newLabel,p=c.newBounds,d=c.hints||{};if(!(!Ne(l)&&!v(l,"bpmn:TextAnnotation"))){if(Ne(l)&&av(f)){d.removeShape!==!1&&e.removeShape(l,{unsetLabel:!1});return}var h=$n(u);typeof p>"u"&&(p=t.getExternalLabelBounds(l,h)),p&&e.resizeShape(l,p,cT)}}this.preExecute=r,this.execute=o,this.revert=a,this.postExecute=s}ov.$inject=["modeling","textRenderer","bpmnFactory"];function av(e){return!e||!e.trim()}function on(e,t,n,i){ct.call(this,e,t,n),this._bpmnRules=i}se(on,ct),on.$inject=["eventBus","elementFactory","commandStack","bpmnRules"],on.prototype.getHandlers=function(){var e=ct.prototype.getHandlers.call(this);return e["element.updateModdleProperties"]=Ca,e["element.updateProperties"]=Aa,e["canvas.updateRoot"]=Tc,e["lane.add"]=Gp,e["lane.resize"]=Ta,e["lane.split"]=Vp,e["lane.updateRefs"]=Mc,e["group.updateRefs"]=ka,e["id.updateClaim"]=kc,e["element.setColor"]=Yp,e["element.updateLabel"]=ov,e},on.prototype.updateLabel=function(e,t,n,i){this._commandStack.execute("element.updateLabel",{element:e,newLabel:t,newBounds:n,hints:i||{}})},on.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)},on.prototype.updateModdleProperties=function(e,t,n){this._commandStack.execute("element.updateModdleProperties",{element:e,moddleElement:t,properties:n})},on.prototype.updateProperties=function(e,t){this._commandStack.execute("element.updateProperties",{element:e,properties:t})},on.prototype.resizeLane=function(e,t,n){this._commandStack.execute("lane.resize",{shape:e,newBounds:t,balanced:n})},on.prototype.addLane=function(e,t){var n={shape:e,location:t};return this._commandStack.execute("lane.add",n),n.newLane},on.prototype.splitLane=function(e,t){this._commandStack.execute("lane.split",{shape:e,count:t})},on.prototype.makeCollaboration=function(){var e=this._create("root",{type:"bpmn:Collaboration"}),t={newRoot:e};return this._commandStack.execute("canvas.updateRoot",t),e},on.prototype.makeProcess=function(){var e=this._create("root",{type:"bpmn:Process"}),t={newRoot:e};return this._commandStack.execute("canvas.updateRoot",t),e},on.prototype.updateLaneRefs=function(e,t){this._commandStack.execute("lane.updateRefs",{flowNodeShapes:e,laneShapes:t})},on.prototype.updateCategoryValueRefs=function(e,t){this._commandStack.execute("group.updateRefs",{affectedFlowElements:e,affectedGroupEntries:t})},on.prototype.claimId=function(e,t){this._commandStack.execute("id.updateClaim",{id:e,element:t,claiming:!0})},on.prototype.unclaimId=function(e,t){this._commandStack.execute("id.updateClaim",{id:e,element:t})},on.prototype.setColor=function(e,t){e.length||(e=[e]),this._commandStack.execute("element.setColor",{elements:e,colors:t})};function sv(){}sv.prototype.layoutConnection=function(e,t){return t=t||{},[t.connectionStart||we(t.source||e.source),t.connectionEnd||we(t.target||e.target)]};var Oc=20,uT=5,Dc=Math.round,cv=20,lT={"h:h":20,"v:v":20,"h:v":-10,"v:h":-10};function pT(e,t){return!{t:/top/,r:/right/,b:/bottom/,l:/left/,h:/./,v:/./}[t].test(e)}function fT(e,t){return{t:/top/,r:/right/,b:/bottom/,l:/left/,h:/left|right/,v:/top|bottom/}[e].test(t)}function uv(e,t,n){var i=tn(t,e,uT),r=n.split(":")[0],o=Dc((t.x-e.x)/2+e.x),a=Dc((t.y-e.y)/2+e.y),s,c,u=fT(r,i),l=/h|r|l/.test(r),f=!1,p=!1;return u?(s=l?{x:o,y:e.y}:{x:e.x,y:a},c=l?"h:h":"v:v"):(f=pT(i,r),c=l?"h:v":"v:h",f?l?(p=a===e.y,s={x:e.x+Oc*(/l/.test(r)?-1:1),y:p?a+Oc:a}):(p=o===e.x,s={x:p?o+Oc:o,y:e.y+Oc*(/t/.test(r)?-1:1)}):s={x:o,y:a}),{waypoints:Kp(e,s,c).concat(s),directions:c,turnNextDirections:p}}function dT(e,t,n){return uv(e,t,n)}function hT(e,t,n){var i=uv(t,e,lv(n));return{waypoints:i.waypoints.slice().reverse(),directions:lv(i.directions),turnNextDirections:i.turnNextDirections}}function mT(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=Kp(e.waypoints[e.waypoints.length-1],t.waypoints[0],r);return{waypoints:o,directions:r}}function lv(e){return e.split(":").reverse().join(":")}function gT(e,t,n){var i=Dc((t.x-e.x)/2+e.x),r=Dc((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 Kp(e,t,n){if(n=n||"h:h",!RT(n))throw new Error("unknown directions: <"+n+">: must be specified as <start>:<end> with start/end in { h,v,t,r,b,l }");if(fv(n)){var i=dT(e,t,n),r=hT(e,t,n),o=mT(i,r);return[].concat(i.waypoints,o.waypoints,r.waypoints)}return gT(e,t,n)}function yT(e,t,n){var i=Kp(e,t,n);return i.unshift(e),i.push(t),hv(i)}function vT(e,t,n,i,r){var o=r&&r.preferredLayouts||[],a=v0(o,"straight")[0]||"h:h",s=lT[a]||0,c=tn(e,t,s),u=ST(c,a);n=n||we(e),i=i||we(t);var l=u.split(":"),f=dv(n,e,l[0],CT(c)),p=dv(i,t,l[1],c);return yT(f,p,u)}function _T(e,t,n,i,r,o){xe(n)&&(r=n,o=i,n=we(e),i=we(t)),o=j({preferredLayouts:[]},o),r=r||[];var a=o.preferredLayouts,s=a.indexOf("straight")!==-1,c;return c=s&&xT(e,t,n,i,o),c||(c=o.connectionEnd&&ET(t,e,i,r),c)||(c=o.connectionStart&&wT(e,t,n,r),c)?c:!o.connectionStart&&!o.connectionEnd&&r&&r.length?r:vT(e,t,n,i,o)}function bT(e,t,n){return e>=t&&e<=n}function pv(e,t,n){var i={x:"width",y:"height"};return bT(t[e],n[e],n[e]+n[i[e]])}function xT(e,t,n,i,r){var o={},a,s;return s=tn(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 wT(e,t,n,i){return Xp(e,t,n,i)}function ET(e,t,n,i){var r=i.slice().reverse();return r=Xp(e,t,n,r),r?r.reverse():null}function Xp(e,t,n,i){function r(l){return l.length<3?!0:l.length>4?!1:!!lt(l,function(f,p){var d=l[p-1];return d&&ta(f,d)<3})}function o(l,f,p){var d=Di(f,l);switch(d){case"v":return{x:p.x,y:l.y};case"h":return{x:l.x,y:p.y}}return{x:l.x,y:l.y}}function a(l,f,p){var d;for(d=l.length-2;d!==0;d--)if(Bh(l[d],f,cv)||Bh(l[d],p,cv))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=Xp(e,t,n,u)),c&&Di(c)?null:c}function ST(e,t){if(fv(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 RT(e){return e&&/^h|v|t|r|b|l:h|v|t|r|b|l$/.test(e)}function fv(e){return e&&/t|r|b|l/.test(e)}function CT(e){return{top:"bottom",bottom:"top",left:"right",right:"left","top-left":"bottom-right","bottom-right":"top-left","top-right":"bottom-left","bottom-left":"top-right"}[e]}function dv(e,t,n,i){if(n==="h"&&(n=/left/.test(i)?"l":"r"),n==="v"&&(n=/top/.test(i)?"t":"b"),n==="t")return{original:e,x:e.x,y:t.y};if(n==="r")return{original:e,x:t.x+t.width,y:e.y};if(n==="b")return{original:e,x:e.x,y:t.y+t.height};if(n==="l")return{original:e,x:t.x,y:e.y};throw new Error("unexpected dockingDirection: <"+n+">")}function hv(e){return e.reduce(function(t,n,i){var r=t[t.length-1],o=e[i+1];return dl(r,o,n,0)||t.push(n),t},[])}var PT=-10,AT=40,TT={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},MT={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},Zp={top:"bottom","top-right":"bottom-left","top-left":"bottom-right",right:"left",bottom:"top","bottom-right":"top-left","bottom-left":"top-right",left:"right"},Oa={top:"t",right:"r",bottom:"b",left:"l"};function Lc(e){this._elementRegistry=e}se(Lc,sv),Lc.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=mv(r&&r[0],n)),a||(a=mv(r&&r[r.length-1],i)),(v(e,"bpmn:Association")||v(e,"bpmn:DataAssociation"))&&r&&!gv(n,i))return[].concat([o],r.slice(1,-1),[a]);var l=Pm(n,s)?TT:MT;return v(e,"bpmn:MessageFlow")?c=OT(n,i,l):(v(e,"bpmn:SequenceFlow")||gv(n,i))&&(n===i?c={preferredLayouts:$T(n,e,l)}:v(n,"bpmn:BoundaryEvent")?c={preferredLayouts:jT(n,i,a,l)}:Da(n)||Da(i)?c={preferredLayouts:l.subProcess,preserveDocking:LT(n)}:v(n,"bpmn:Gateway")?c={preferredLayouts:l.fromGateway}:v(i,"bpmn:Gateway")?c={preferredLayouts:l.toGateway}:c={preferredLayouts:l.default}),c&&(c=j(c,t),u=hv(_T(n,i,o,a,r,c))),u||[o,a]};function kT(e){var t=e.host;return tn(we(e),t,PT)}function OT(e,t,n){return{preferredLayouts:n.messageFlow,preserveDocking:DT(e,t)}}function DT(e,t){return v(t,"bpmn:Participant")?"source":v(e,"bpmn:Participant")?"target":Da(t)?"source":Da(e)||v(t,"bpmn:Event")?"target":v(e,"bpmn:Event")?"source":null}function LT(e){return Da(e)?"target":"source"}function mv(e,t){return e?e.original||e:we(t)}function gv(e,t){return v(t,"bpmn:Activity")&&v(e,"bpmn:BoundaryEvent")&&t.businessObject.isForCompensation}function Da(e){return v(e,"bpmn:SubProcess")&&Ge(e)}function Gr(e,t){return e===t}function IT(e,t){return t.indexOf(e)!==-1}function ko(e){var t=/right|left/.exec(e);return t&&t[0]}function Oo(e){var t=/top|bottom/.exec(e);return t&&t[0]}function yv(e,t){return Zp[e]===t}function NT(e,t){var n=ko(e),i=Zp[n];return t.indexOf(i)!==-1}function BT(e,t){var n=Oo(e),i=Zp[n];return t.indexOf(i)!==-1}function vv(e){return e==="right"||e==="left"}function $T(e,t,n){var i=t.waypoints,r=i&&i.length&&tn(i[0],e);return r==="top"?n.loop.fromTop:r==="right"?n.loop.fromRight:r==="left"?n.loop.fromLeft:n.loop.fromBottom}function jT(e,t,n,i){var r=we(e),o=we(t),a=kT(e),s,c,u=Gr(e.host,t),l=IT(a,["top","right","bottom","left"]),f=tn(o,r,{x:e.width/2+t.width/2,y:e.height/2+t.height/2});return u?FT(a,l,e,t,n,i):(s=HT(a,f,l,i.isHorizontal),c=zT(a,f,l,i.isHorizontal),[s+":"+c])}function FT(e,t,n,i,r,o){var a=t?e:o.isHorizontal?Oo(e):ko(e),s=Oa[a],c;return t?vv(e)?c=_v("y",n,i,r)?"h":o.boundaryLoop.alternateHorizontalSide:c=_v("x",n,i,r)?"v":o.boundaryLoop.alternateVerticalSide:c=o.boundaryLoop.default,[s+":"+c]}function _v(e,t,n,i){var r=AT;return!(Qp(e,i,n,r)||Qp(e,i,{x:n.x+n.width,y:n.y+n.height},r)||Qp(e,i,we(t),r))}function Qp(e,t,n,i){return Math.abs(t[e]-n[e])<i}function HT(e,t,n,i){if(n)return Oa[e];var r=Oo(e),o=ko(e),a=Oo(t),s=ko(t);if(i){if(Gr(r,a)||yv(o,s))return Oa[r]}else if(Gr(o,s)||yv(r,a))return Oa[o];return Oa[i?o:r]}function zT(e,t,n,i){if(n)return vv(e)?NT(e,t)||Gr(e,t)?"h":"v":BT(e,t)||Gr(e,t)?"v":"h";var r=Oo(e),o=ko(e),a=Oo(t),s=ko(t);return a&&!s?"v":s&&!a?"h":i?Gr(r,a)?"h":"v":Gr(o,s)?"v":"h"}Lc.$inject=["elementRegistry"];function bv(e){return j({original:e.point.original||e.point},e.actual)}function gr(e,t){this._elementRegistry=e,this._graphicsFactory=t}gr.$inject=["elementRegistry","graphicsFactory"],gr.prototype.getCroppedWaypoints=function(e,t,n){t=t||e.source,n=n||e.target;var i=this.getDockingPoint(e,t,!0),r=this.getDockingPoint(e,n),o=e.waypoints.slice(i.idx+1,r.idx);return o.unshift(bv(i)),o.push(bv(r)),o},gr.prototype.getDockingPoint=function(e,t,n){var i=e.waypoints,r,o,a;return r=n?0:i.length-1,o=i[r],a=this._getIntersection(t,e,n),{point:o,actual:a||o,idx:r}},gr.prototype._getIntersection=function(e,t,n){var i=this._getShapePath(e),r=this._getConnectionPath(t);return na(i,r,n)},gr.prototype._getConnectionPath=function(e){return this._graphicsFactory.getConnectionPath(e)},gr.prototype._getShapePath=function(e){return this._graphicsFactory.getShapePath(e)},gr.prototype._getGfx=function(e){return this._elementRegistry.getGraphics(e)};const Jp={__init__:["modeling","bpmnUpdater"],__depends__:[sP,EP,RP,CP,Oy,PA,TA,IA,qn,Np,$y],bpmnFactory:["type",Kn],bpmnUpdater:["type",On],elementFactory:["type",dr],modeling:["type",on],layouter:["type",Lc],connectionDocking:["type",gr]};var GT=10,xv=50,VT=250;function ef(e,t,n,i){for(var r;r=WT(e,n,t);)n=i(t,n,r);return n}function tf(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 WT(e,t,n){var i={x:t.x-n.width/2,y:t.y-n.height/2,width:n.width,height:n.height},r=qT(e);return lt(r,function(o){if(o===n)return!1;var a=tn(o,i,GT);return a==="intersect"})}function UT(e,t){t||(t={});function n(h){return h.source===e?1:-1}var i=t.defaultDistance||xv,r=t.direction||"e",o=t.filter,a=t.getWeight||n,s=t.maxDistance||VT,c=t.reference||"start";o||(o=XT);function u(h,m){return r==="n"?c==="start"?ve(h).top-ve(m).bottom:c==="center"?ve(h).top-we(m).y:ve(h).top-ve(m).top:r==="w"?c==="start"?ve(h).left-ve(m).right:c==="center"?ve(h).left-we(m).x:ve(h).left-ve(m).left:r==="s"?c==="start"?ve(m).top-ve(h).bottom:c==="center"?we(m).y-ve(h).bottom:ve(m).bottom-ve(h).bottom:c==="start"?ve(m).left-ve(h).right:c==="center"?we(m).x-ve(h).right:ve(m).right-ve(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}}),f=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}}),p=l.concat(f).reduce(function(h,m){return h[m.id+"__weight_"+m.weight]=m,h},{}),d=Rn(p,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 qT(e){var t=nf(e);return e.host&&(t=t.concat(nf(e.host))),e.attachers&&(t=t.concat(e.attachers.reduce(function(n,i){return n.concat(nf(i))},[]))),t}function nf(e){return KT(e).concat(YT(e))}function YT(e){return e.incoming.map(function(t){return t.source})}function KT(e){return e.outgoing.map(function(t){return t.target})}function XT(){return!0}var ZT=100;function wv(e,t,n){e.on("autoPlace",ZT,function(i){var r=i.shape,o=i.source;return QT(o,r)}),e.on("autoPlace.end",function(i){n.scrollToElement(i.shape)}),this.append=function(i,r,o){e.fire("autoPlace.start",{source:i,shape:r});var a=e.fire("autoPlace",{source:i,shape:r}),s=t.appendShape(i,r,a,i.parent,o);return e.fire("autoPlace.end",{source:i,shape:s}),s}}wv.$inject=["eventBus","modeling","canvas"];function QT(e,t,n){n||(n={});var i=n.defaultDistance||xv,r=we(e),o=ve(e);return{x:o.right+i+t.width/2,y:r.y}}function Ev(e,t){e.on("autoPlace.end",500,function(n){t.select(n.shape)})}Ev.$inject=["eventBus","selection"];const JT={__init__:["autoPlaceSelectionBehavior"],autoPlace:["type",wv],autoPlaceSelectionBehavior:["type",Ev]};function Sv(e,t,n){var i=Pm(e,n);if(v(t,"bpmn:TextAnnotation"))return tM(e,t,i);if(Be(t,["bpmn:DataObjectReference","bpmn:DataStoreReference"]))return nM(e,t,i);if(v(t,"bpmn:FlowNode"))return eM(e,t,i)}function eM(e,t,n){var i=ve(e),r=we(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=UT(e,{filter:function(d){return v(d,"bpmn:SequenceFlow")},direction:o.directionHint}),s=30,c=o.minDistance,u=o.baseOrientation;v(e,"bpmn:BoundaryEvent")&&(u=tn(e,e.host,-25),u.indexOf(o.boundaryOrientation)!==-1&&(s*=-1));var l=n?{x:i.right+a+t.width/2,y:r.y+Rv(u,c,o)}:{x:r.x+Rv(u,c,o),y:i.bottom+a+t.height/2},f={margin:s,minDistance:c},p=n?{y:f}:{x:f};return ef(e,t,l,tf(p))}function Rv(e,t,n){return e.includes(n.start)?-1*t:e.includes(n.end)?t:0}function tM(e,t,n){var i=ve(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};st(e)&&(r=we(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 ef(e,t,r,tf(a))}function nM(e,t,n){var i=ve(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 ef(e,t,r,tf(a))}function Cv(e,t){e.on("autoPlace",function(n){var i=n.shape,r=n.source;return Sv(r,i,t)})}Cv.$inject=["eventBus","elementRegistry"];const Ic={__depends__:[JT],__init__:["bpmnAutoPlace"],bpmnAutoPlace:["type",Cv]},Pv=[Rm,ca,Jp,Ic];function iM(e={}){Sd(globalThis,e.dom);const t=document.createElement("div");return document.body.appendChild(t),new mo({container:t,moddleExtensions:e.moddleExtensions??as,additionalModules:[...Pv,...e.additionalModules??[]]})}var rM=new To("ov"),oM=500;function Zt(e,t,n,i){this._eventBus=t,this._canvas=n,this._elementRegistry=i,this._ids=rM,this._overlayDefaults=j({show:null,scale:!0},e&&e.defaults),this._overlays={},this._overlayContainers=[],this._overlayRoot=aM(n.getContainer()),this._init()}Zt.$inject=["config.overlays","eventBus","canvas","elementRegistry"],Zt.prototype.get=function(e){if(En(e)&&(e={id:e}),En(e.element)&&(e.element=this._elementRegistry.get(e.element)),e.element){var t=this._getOverlayContainer(e.element,!0);return t?e.type?$e(t.overlays,ro({type:e.type})):t.overlays.slice():[]}else return e.type?$e(this._overlays,ro({type:e.type})):e.id?this._overlays[e.id]:null},Zt.prototype.add=function(e,t,n){if(Ut(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=j({},this._overlayDefaults,n,{id:i,type:t,element:e,html:n.html}),this._addOverlay(n),i},Zt.prototype.remove=function(e){var t=this.get(e)||[];xe(t)||(t=[t]);var n=this;D(t,function(i){var r=n._getOverlayContainer(i.element,!0);if(i&&(fi(i.html),fi(i.htmlContainer),delete i.htmlContainer,delete i.element,delete n._overlays[i.id]),r){var o=r.overlays.indexOf(i);o!==-1&&r.overlays.splice(o,1)}})},Zt.prototype.isShown=function(){return this._overlayRoot.style.display!=="none"},Zt.prototype.show=function(){Nc(this._overlayRoot)},Zt.prototype.hide=function(){Nc(this._overlayRoot,!1)},Zt.prototype.clear=function(){this._overlays={},this._overlayContainers=[],_s(this._overlayRoot)},Zt.prototype._updateOverlayContainer=function(e){var t=e.element,n=e.html,i=t.x,r=t.y;if(t.waypoints){var o=Lt(t);i=o.x,r=o.y}Av(n,i,r),ln(e.html,"data-container-id",t.id)},Zt.prototype._updateOverlay=function(e){var t=e.position,n=e.htmlContainer,i=e.element,r=t.left,o=t.top;if(t.right!==void 0){var a;i.waypoints?a=Lt(i).width:a=i.width,r=t.right*-1+a}if(t.bottom!==void 0){var s;i.waypoints?s=Lt(i).height:s=i.height,o=t.bottom*-1+s}Av(n,r||0,o||0),this._updateOverlayVisibilty(e,this._canvas.viewbox())},Zt.prototype._createOverlayContainer=function(e){var t=dt('<div class="djs-overlays" />');mn(t,{position:"absolute"}),this._overlayRoot.appendChild(t);var n={html:t,element:e,overlays:[]};return this._updateOverlayContainer(n),this._overlayContainers.push(n),n},Zt.prototype._updateRoot=function(e){var t=e.scale||1,n="matrix("+[t,0,0,t,-1*e.x*t,-1*e.y*t].join(",")+")";Tv(this._overlayRoot,n)},Zt.prototype._getOverlayContainer=function(e,t){var n=lt(this._overlayContainers,function(i){return i.element===e});return!n&&!t?this._createOverlayContainer(e):n},Zt.prototype._addOverlay=function(e){var t=e.id,n=e.element,i=e.html,r,o;i.get&&i.constructor.prototype.jquery&&(i=i.get(0)),En(i)&&(i=dt(i)),o=this._getOverlayContainer(n),r=dt('<div class="djs-overlay" data-overlay-id="'+t+'">'),mn(r,{position:"absolute"}),r.appendChild(i),e.type&&vt(r).add("djs-overlay-"+e.type);var a=this._canvas.findRoot(n),s=this._canvas.getRootElement();Nc(r,a===s),e.htmlContainer=r,o.overlays.push(e),o.html.appendChild(r),this._overlays[t]=e,this._updateOverlay(e),this._updateOverlayVisibilty(e,this._canvas.viewbox())},Zt.prototype._updateOverlayVisibilty=function(e,t){var n=e.show,i=this._canvas.findRoot(e.element),r=n&&n.minZoom,o=n&&n.maxZoom,a=e.htmlContainer,s=this._canvas.getRootElement(),c=!0;(i!==s||n&&(Ft(r)&&r>t.scale||Ft(o)&&o<t.scale))&&(c=!1),Nc(a,c),this._updateOverlayScale(e,t)},Zt.prototype._updateOverlayScale=function(e,t){var n=e.scale,i,r,o=e.htmlContainer,a,s="";n!==!0&&(n===!1?(i=1,r=1):(i=n.min,r=n.max),Ft(i)&&t.scale<i&&(a=(1/t.scale||1)*i),Ft(r)&&t.scale>r&&(a=(1/t.scale||1)*r)),Ft(a)&&(s="scale("+a+","+a+")"),Tv(o,s)},Zt.prototype._updateOverlaysVisibilty=function(e){var t=this;D(this._overlays,function(n){t._updateOverlayVisibilty(n,e)})},Zt.prototype._init=function(){var e=this._eventBus,t=this;function n(i){t._updateRoot(i),t._updateOverlaysVisibilty(i),t.show()}e.on("canvas.viewbox.changing",function(i){t.hide()}),e.on("canvas.viewbox.changed",function(i){n(i.viewbox)}),e.on(["shape.remove","connection.remove"],function(i){var r=i.element,o=t.get({element:r});D(o,function(c){t.remove(c.id)});var a=t._getOverlayContainer(r);if(a){fi(a.html);var s=t._overlayContainers.indexOf(a);s!==-1&&t._overlayContainers.splice(s,1)}}),e.on("element.changed",oM,function(i){var r=i.element,o=t._getOverlayContainer(r,!0);o&&(D(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&&vt(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 aM(e){var t=dt('<div class="djs-overlay-container" />');return mn(t,{position:"absolute",width:0,height:0}),e.insertBefore(t,e.firstChild),t}function Av(e,t,n){mn(e,{left:t+"px",top:n+"px"})}function Nc(e,t){e.style.display=t===!1?"none":""}function Tv(e,t){e.style["transform-origin"]="top left",["","-ms-","-webkit-"].forEach(function(n){e.style[n+"transform"]=t})}const Bc={__init__:["overlays"],overlays:["type",Zt]};function rf(e,t){t.invoke(Q,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)})}se(rf,Q),rf.$inject=["canvas","injector"];const sM={__init__:["rootElementsBehavior"],rootElementsBehavior:["type",rf]};function La(e){return CSS.escape(e)}var cM={"&":"&","<":"<",">":">",'"':""","'":"'"};function Mv(e){return e=""+e,e&&e.replace(/[&<>"']/g,function(t){return cM[t]})}var uM="bjs-breadcrumbs-shown";function kv(e,t,n){var i=dt('<ul class="bjs-breadcrumbs"></ul>'),r=n.getContainer(),o=vt(r);r.appendChild(i);var a=[];e.on("element.changed",function(c){var u=c.element,l=J(u),f=lt(a,function(p){return p===l});f&&s()});function s(c){c&&(a=lM(c));var u=a.flatMap(function(f){var p=n.findRoot(yi(f))||n.findRoot(f.id);if(!p&&v(f,"bpmn:Process")){var d=t.find(function(g){var S=J(g);return S&&S.get("processRef")===f});p=d&&n.findRoot(d.id)}if(!p)return[];var h=Mv(f.name||f.id),m=dt('<li><span class="bjs-crumb"><a title="'+h+'">'+h+"</a></span></li>");return m.addEventListener("click",function(){n.setRootElement(p)}),m});i.innerHTML="";var l=u.length>1;o.toggle(uM,l),u.forEach(function(f){i.appendChild(f)})}e.on("root.set",function(c){s(c.element)})}kv.$inject=["eventBus","elementRegistry","canvas"];function lM(e){for(var t=J(e),n=[],i=t;i;i=i.$parent)(v(i,"bpmn:SubProcess")||v(i,"bpmn:Process"))&&n.push(i);return n.reverse()}function Ov(e,t){var n=null,i=new pM;e.on("root.set",function(r){var o=r.element,a=t.viewbox(),s=i.get(o);if(i.set(n,{x:a.x,y:a.y,zoom:a.scale}),n=o,!(!v(o,"bpmn:SubProcess")&&!s)){s=s||{x:0,y:0,zoom:1};var c=(a.x-s.x)*a.scale,u=(a.y-s.y)*a.scale;(c!==0||u!==0)&&t.scroll({dx:c,dy:u}),s.zoom!==a.scale&&t.zoom(s.zoom,{x:0,y:0})}}),e.on("diagram.clear",function(){i.clear(),n=null})}Ov.$inject=["eventBus","canvas"];function pM(){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 Dv={x:180,y:160};function Vr(e,t){this._eventBus=e,this._moddle=t;var n=this;e.on("import.render.start",1500,function(i,r){n._handleImport(r.definitions)})}Vr.prototype._handleImport=function(e){if(e.diagrams){var t=this;this._definitions=e,this._processToDiagramMap={},e.diagrams.forEach(function(i){!i.plane||!i.plane.bpmnElement||(t._processToDiagramMap[i.plane.bpmnElement.id]=i)});var n=e.diagrams.filter(i=>i.plane).flatMap(i=>t._createNewDiagrams(i.plane));n.forEach(function(i){t._movePlaneElementsToOrigin(i.plane)})}},Vr.prototype._createNewDiagrams=function(e){var t=this,n=[],i=[];e.get("planeElement").forEach(function(o){var a=o.bpmnElement;if(a){var s=a.$parent;v(a,"bpmn:SubProcess")&&!o.isExpanded&&n.push(a),dM(a,e)&&i.push({diElement:o,parent:s})}});var r=[];return n.forEach(function(o){if(!t._processToDiagramMap[o.id]){var a=t._createDiagram(o);t._processToDiagramMap[o.id]=a,r.push(a)}}),i.forEach(function(o){for(var a=o.diElement,s=o.parent;s&&n.indexOf(s)===-1;)s=s.$parent;if(s){var c=t._processToDiagramMap[s.id];t._moveToDiPlane(a,c.plane)}}),r},Vr.prototype._movePlaneElementsToOrigin=function(e){var t=e.get("planeElement"),n=fM(e),i={x:n.x-Dv.x,y:n.y-Dv.y};t.forEach(function(r){r.waypoint?r.waypoint.forEach(function(o){o.x=o.x-i.x,o.y=o.y-i.y}):r.bounds&&(r.bounds.x=r.bounds.x-i.x,r.bounds.y=r.bounds.y-i.y)})},Vr.prototype._moveToDiPlane=function(e,t){var n=Lv(e),i=n.plane.get("planeElement");i.splice(i.indexOf(e),1),t.get("planeElement").push(e)},Vr.prototype._createDiagram=function(e){var t=this._moddle.create("bpmndi:BPMNPlane",{bpmnElement:e}),n=this._moddle.create("bpmndi:BPMNDiagram",{plane:t});return t.$parent=n,t.bpmnElement=e,n.$parent=this._definitions,this._definitions.diagrams.push(n),n},Vr.$inject=["eventBus","moddle"];function Lv(e){return v(e,"bpmndi:BPMNDiagram")?e:Lv(e.$parent)}function fM(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=ve(n.bounds);t.top=Math.min(i.top,t.top),t.left=Math.min(i.left,t.left)}}),As(t)}function dM(e,t){var n=e.$parent;return!(!v(n,"bpmn:SubProcess")||n===t.bpmnElement||Be(e,["bpmn:DataInputAssociation","bpmn:DataOutputAssociation"]))}var $c=250,hM='<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>',mM="bjs-drilldown-empty";function yr(e,t,n,i,r){Q.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",$c,function(a){var s=a.shape;o._canDrillDown(s)?o._addOverlay(s):o._removeOverlay(s)},!0),this.reverted("shape.toggleCollapse",$c,function(a){var s=a.shape;o._canDrillDown(s)?o._addOverlay(s):o._removeOverlay(s)},!0),this.executed(["shape.create","shape.move","shape.delete"],$c,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"],$c,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)})})}se(yr,Q),yr.prototype._updateDrilldownOverlay=function(e){var t=this._canvas;if(e){var n=t.findRoot(e);n&&this._updateOverlayVisibility(n)}},yr.prototype._canDrillDown=function(e){var t=this._canvas;return v(e,"bpmn:SubProcess")&&t.findRoot(yi(e))},yr.prototype._updateOverlayVisibility=function(e){var t=this._overlays,n=J(e),i=t.get({element:n.id,type:"drilldown"})[0];if(i){var r=n&&n.get("flowElements")&&n.get("flowElements").length;vt(i.html).toggle(mM,!r)}},yr.prototype._addOverlay=function(e){var t=this._canvas,n=this._overlays,i=J(e),r=n.get({element:e,type:"drilldown"});r.length&&this._removeOverlay(e);var o=dt('<button type="button" class="bjs-drilldown">'+hM+"</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(yi(e)))}),n.add(e,"drilldown",{position:{bottom:-7,right:-8},html:o}),this._updateOverlayVisibility(e)},yr.prototype._removeOverlay=function(e){var t=this._overlays;t.remove({element:e,type:"drilldown"})},yr.$inject=["canvas","eventBus","elementRegistry","overlays","translate"];const gM={__depends__:[Bc,Np,sM],__init__:["drilldownBreadcrumbs","drilldownOverlayBehavior","drilldownCentering","subprocessCompatibility"],drilldownBreadcrumbs:["type",kv],drilldownCentering:["type",Ov],drilldownOverlayBehavior:["type",yr],subprocessCompatibility:["type",Vr]};function vr(e){xt.call(this,e)}se(vr,xt),vr.prototype._modules=[Rm,gM,Bc,qn,ca],vr.prototype._moddleExtensions={};var jc="keyboard.keydown",yM="keyboard.keyup",vM=1e3,Iv="Keyboard binding is now implicit; explicit binding to an element got removed. For more information, see https://github.com/bpmn-io/diagram-js/issues/661";function gn(e,t){var n=this;this._config=e=e||{},this._eventBus=t,this._keydownHandler=this._keydownHandler.bind(this),this._keyupHandler=this._keyupHandler.bind(this),t.on("diagram.destroy",function(){n._fire("destroy"),n.unbind()}),e.bindTo&&console.error("unsupported configuration <keyboard.bindTo>",new Error(Iv));var i=e&&e.bind!==!1;t.on("canvas.init",function(r){n._target=r.svg,i&&n.bind(),n._fire("init")})}gn.$inject=["config.keyboard","eventBus"],gn.prototype._keydownHandler=function(e){this._keyHandler(e,jc)},gn.prototype._keyupHandler=function(e){this._keyHandler(e,yM)},gn.prototype._keyHandler=function(e,t){var n;if(!this._isEventIgnored(e)){var i={keyEvent:e};n=this._eventBus.fire(t||jc,i),n&&e.preventDefault()}},gn.prototype._isEventIgnored=function(e){return!1},gn.prototype.bind=function(e){e&&console.error("unsupported argument <node>",new Error(Iv)),this.unbind(),e=this._node=this._target,Te.bind(e,"keydown",this._keydownHandler),Te.bind(e,"keyup",this._keyupHandler),this._fire("bind")},gn.prototype.getBinding=function(){return this._node},gn.prototype.unbind=function(){var e=this._node;e&&(this._fire("unbind"),Te.unbind(e,"keydown",this._keydownHandler),Te.unbind(e,"keyup",this._keyupHandler)),this._node=null},gn.prototype._fire=function(e){this._eventBus.fire("keyboard."+e,{node:this._node})},gn.prototype.addListener=function(e,t,n){qt(e)&&(n=t,t=e,e=vM),this._eventBus.on(n||jc,e,t)},gn.prototype.removeListener=function(e,t){this._eventBus.off(t||jc,e)},gn.prototype.hasModifier=jP,gn.prototype.isCmd=Mn,gn.prototype.isShift=Rp,gn.prototype.isKey=Gt;var _M=500;function Do(e,t){var n=this;e.on("editorActions.init",_M,function(i){var r=i.editorActions;n.registerBindings(t,r)})}Do.$inject=["eventBus","keyboard"],Do.prototype.registerBindings=function(e,t){function n(i,r){t.isRegistered(i)&&e.addListener(r)}n("undo",function(i){var r=i.keyEvent;if(VP(r))return t.trigger("undo"),!0}),n("redo",function(i){var r=i.keyEvent;if(WP(r))return t.trigger("redo"),!0}),n("copy",function(i){var r=i.keyEvent;if(FP(r))return t.trigger("copy"),!0}),n("paste",function(i){var r=i.keyEvent;if(HP(r))return t.trigger("paste"),!0}),n("duplicate",function(i){var r=i.keyEvent;if(zP(r))return t.trigger("duplicate"),!0}),n("cut",function(i){var r=i.keyEvent;if(GP(r))return t.trigger("cut"),!0}),n("stepZoom",function(i){var r=i.keyEvent;if(Gt(["+","Add","="],r)&&Mn(r))return t.trigger("stepZoom",{value:1}),!0}),n("stepZoom",function(i){var r=i.keyEvent;if(Gt(["-","Subtract"],r)&&Mn(r))return t.trigger("stepZoom",{value:-1}),!0}),n("zoom",function(i){var r=i.keyEvent;if(Gt("0",r)&&Mn(r))return t.trigger("zoom",{value:1}),!0}),n("removeSelection",function(i){var r=i.keyEvent;if(Gt(["Backspace","Delete","Del"],r))return t.trigger("removeSelection"),!0})};const of={__init__:["keyboard","keyboardBindings"],keyboard:["type",gn],keyboardBindings:["type",Do]};var bM={moveSpeed:50,moveSpeedAccelerated:200};function Nv(e,t,n){var i=this;this._config=j({},bM,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})}}Nv.$inject=["config.keyboardMove","keyboard","canvas"];const Bv={__depends__:[of],__init__:["keyboardMove"],keyboardMove:["type",Nv]};var xM=15;function $v(e,t){var n;function i(s){return a(s.originalEvent)}e.on("canvas.focus.changed",function(s){s.focused?e.on("element.mousedown",500,i):e.off("element.mousedown",i)});function r(s){var c=n.start,u=n.button,l=$r(s),f=ri(l,c);if(!n.dragging&&wM(f)>xM&&(n.dragging=!0,u===0&&py(e),fc("grab")),n.dragging){var p=n.last||n.start;f=ri(l,p),t.scroll({dx:f.x,dy:f.y}),n.last=l}s.preventDefault()}function o(s){Te.unbind(document,"mousemove",r),Te.unbind(document,"mouseup",o),n=null,ly()}function a(s){if(!Or(s.target,".djs-draggable")){var c=s.button;if(!(c>=2||s.ctrlKey||s.shiftKey||s.altKey))return n={button:c,start:$r(s)},Te.bind(document,"mousemove",r),Te.bind(document,"mouseup",o),!0}}this.isActive=function(){return!!n}}$v.$inject=["eventBus","canvas"];function wM(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}const jv={__init__:["moveCanvas"],moveCanvas:["type",$v]};function Fv(e,t){var n=wl(e.min),i=wl(e.max),r=Math.abs(n)+Math.abs(i);return r/t}function EM(e,t){return Math.max(e.min,Math.min(e.max,t))}var SM=Math.sign||function(e){return e>=0?1:-1},af={min:.2,max:4},Hv=10,RM=.1,CM=.75;function bi(e,t,n){e=e||{},this._enabled=!1,this._canvas=n,this._container=n._container,this._handleWheel=bn(this._handleWheel,this),this._totalDelta=0,this._scale=e.scale||CM;var i=this;t.on("canvas.mouseover",function(){i._init(e.enabled!==!1)}),t.on("canvas.mouseout",function(){i._init(!1)})}bi.$inject=["config.zoomScroll","eventBus","canvas"],bi.prototype.scroll=function(t){this._canvas.scroll(t)},bi.prototype.reset=function(){this._canvas.zoom("fit-viewport")},bi.prototype.zoom=function(t,n){var i=Fv(af,Hv*2);this._totalDelta+=t,Math.abs(this._totalDelta)>RM&&(this._zoom(t,n,i),this._totalDelta=0)},bi.prototype._handleWheel=function(t){if(this._enabled){var n=this._container;t.preventDefault();var i=t.ctrlKey||vg()&&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))*SM(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)}},bi.prototype.stepZoom=function(t,n){var i=Fv(af,Hv);this._zoom(t,n,i)},bi.prototype._zoom=function(e,t,n){var i=this._canvas,r=e>0?1:-1,o=wl(i.zoom()),a=Math.round(o/n)*n;a+=n*r;var s=Math.pow(10,a);i.zoom(EM(af,s),t)},bi.prototype.toggle=function(t){var n=this._container,i=this._handleWheel,r=this._enabled;return typeof t>"u"&&(t=!r),r!==t&&Te[t?"bind":"unbind"](n,"wheel",i,!1),this._enabled=t,t},bi.prototype._init=function(e){this.toggle(e)};const zv={__init__:["zoomScroll"],zoomScroll:["type",bi]};function Ia(e){vr.call(this,e)}se(Ia,vr),Ia.prototype._navigationModules=[Bv,jv,zv],Ia.prototype._modules=[].concat(vr.prototype._modules,Ia.prototype._navigationModules);function sf(e){return e&&e[e.length-1]}function Gv(e){return e.y}function Vv(e){return e.x}var PM={left:Vv,center:Vv,right:function(e){return e.x+e.width},top:Gv,middle:Gv,bottom:function(e){return e.y+e.height}};function Lo(e,t){this._modeling=e,this._rules=t}Lo.$inject=["modeling","rules"],Lo.prototype._getOrientationDetails=function(e){var t=["top","bottom","middle"],n="x",i="width";return t.indexOf(e)!==-1&&(n="y",i="height"),{axis:n,dimension:i}},Lo.prototype._isType=function(e,t){return t.indexOf(e)!==-1},Lo.prototype._alignmentPosition=function(e,t){var n=this._getOrientationDetails(e),i=n.axis,r=n.dimension,o={},a={},s=!1,c,u,l;function f(p,d){return Math.round((p[i]+d[i]+d[r])/2)}if(this._isType(e,["left","top"]))o[e]=t[0][i];else if(this._isType(e,["right","bottom"]))l=sf(t),o[e]=l[i]+l[r];else if(this._isType(e,["center","middle"])){if(D(t,function(p){var d=p[i]+Math.round(p[r]/2);a[d]?a[d].elements.push(p):a[d]={elements:[p],center:d}}),c=ai(a,function(p){return p.elements.length>1&&(s=!0),p.elements.length}),s)return o[e]=sf(c).center,o;u=t[0],t=ai(t,function(p){return p[i]+p[r]}),l=sf(t),o[e]=f(u,l)}return o},Lo.prototype.trigger=function(e,t){var n=this._modeling,i,r=$e(e,function(c){return!(c.waypoints||c.host||c.labelTarget)});if(i=this._rules.allowed("elements.align",{elements:r}),xe(i)&&(r=i),!(r.length<2||!i)){var o=PM[t],a=ai(r,o),s=this._alignmentPosition(t,a);n.alignElements(a,s)}};const AM={__init__:["alignElements"],alignElements:["type",Lo]},TM=new To;function Io(e){this._scheduled={},e.on("diagram.destroy",()=>{Object.keys(this._scheduled).forEach(t=>{this.cancel(t)})})}Io.$inject=["eventBus"],Io.prototype.schedule=function(e,t=TM.next()){this.cancel(t);const n=this._schedule(e,t);return this._scheduled[t]=n,n.promise},Io.prototype._schedule=function(e,t){const n=MM();return{executionId:setTimeout(()=>{try{this._scheduled[t]=null;try{n.resolve(e())}catch(r){n.reject(r)}}catch(r){console.error("Scheduler#_schedule execution failed",r)}}),promise:n.promise}},Io.prototype.cancel=function(e){const t=this._scheduled[e];t&&(this._cancel(t),this._scheduled[e]=null)},Io.prototype._cancel=function(e){clearTimeout(e.executionId)};function MM(){const e={};return e.promise=new Promise((t,n)=>{e.resolve=t,e.reject=n}),e}const kM={scheduler:["type",Io]};var OM="djs-element-hidden",Fc=".entry",DM=1e3,Wv=8,LM=300;function Nt(e,t,n,i){this._canvas=e,this._elementRegistry=t,this._eventBus=n,this._scheduler=i,this._current=null,this._init()}Nt.$inject=["canvas","elementRegistry","eventBus","scheduler"],Nt.prototype._init=function(){var e=this;this._eventBus.on("selection.changed",function(t){var n=t.newSelection,i=n.length?n.length===1?n[0]:n:null;i?e.open(i,!0):e.close()}),this._eventBus.on("elements.changed",function(t){var n=t.elements,i=e._current;if(i){var r=i.target,o=xe(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=xe(i.target)?i.target:[i.target];r.includes(n)&&e._updateVisibility()}}),this._container=this._createContainer()},Nt.prototype._createContainer=function(){var e=dt('<div class="djs-context-pad-parent"></div>');return this._canvas.getContainer().appendChild(e),e},Nt.prototype.registerProvider=function(e,t){t||(t=e,e=DM),this._eventBus.on("contextPad.getProviders",e,function(n){n.providers.push(t)})},Nt.prototype.getEntries=function(e){var t=this._getProviders(),n=xe(e)?"getMultiElementContextPadEntries":"getContextPadEntries",i={};return D(t,function(r){if(qt(r[n])){var o=r[n](e);qt(o)?i=o(i):D(o,function(a,s){i[s]=a})}}),i},Nt.prototype.trigger=function(e,t,n){var i=this,r,o,a=t.delegateTarget||t.target;if(!a)return t.preventDefault();if(r=ln(a,"data-action"),o=t.originalEvent||t,e==="mouseover"){this._timeout=setTimeout(function(){i._mouseout=i.triggerEntry(r,"hover",o,n)},LM);return}else if(e==="mouseout"){clearTimeout(this._timeout),this._mouseout&&(this._mouseout(),this._mouseout=null);return}return this.triggerEntry(r,e,o,n)},Nt.prototype.triggerEntry=function(e,t,n,i){if(this.isShown()){var r=this._current.target,o=this._current.entries,a=o[e];if(a){var s=a.action;if(this._eventBus.fire("contextPad.trigger",{entry:a,event:n})!==!1){if(qt(s)){if(t==="click")return s(n,r,i)}else if(s[t])return s[t](n,r,i);n.preventDefault()}}}},Nt.prototype.open=function(e,t){if(!(!t&&this.isOpen(e))){var n=this._eventBus.fire("contextPad.open.allowed",{target:e});n!==!1&&(this.close(),this._updateAndOpen(e))}},Nt.prototype._getProviders=function(){var e=this._eventBus.createEvent({type:"contextPad.getProviders",providers:[]});return this._eventBus.fire(e),e.providers},Nt.prototype._updateAndOpen=function(e){var t=this.getEntries(e),n=this._createHtml(e),i;D(t,function(r,o){var a=r.group||"default",s=dt(r.html||'<div class="entry" draggable="true"></div>'),c;ln(s,"data-action",o),c=rt("[data-group="+La(a)+"]",n),c||(c=dt('<div class="group"></div>'),ln(c,"data-group",a),n.appendChild(c)),c.appendChild(s),r.className&&IM(s,r.className),r.title&&ln(s,"title",r.title),r.imageUrl&&(i=dt("<img>"),ln(i,"src",r.imageUrl),i.style.width="100%",i.style.height="100%",s.appendChild(i))}),vt(n).add("open"),this._current={entries:t,html:n,target:e},this._updatePosition(),this._updateVisibility(),this._eventBus.fire("contextPad.open",{current:this._current})},Nt.prototype._createHtml=function(e){var t=this,n=dt('<div class="djs-context-pad"></div>');return Pn.bind(n,Fc,"click",function(i){t.trigger("click",i)}),Pn.bind(n,Fc,"dragstart",function(i){t.trigger("dragstart",i)}),Pn.bind(n,Fc,"mouseover",function(i){t.trigger("mouseover",i)}),Pn.bind(n,Fc,"mouseout",function(i){t.trigger("mouseout",i)}),Te.bind(n,"mousedown",function(i){i.stopPropagation()}),this._container.appendChild(n),this._eventBus.fire("contextPad.create",{target:e,pad:n}),n},Nt.prototype.getPad=function(e){console.warn(new Error("ContextPad#getPad is deprecated and will be removed in future library versions, cf. https://github.com/bpmn-io/diagram-js/pull/888"));let t;return this.isOpen()&&BM(this._current.target,e)?t=this._current.html:t=this._createHtml(e),{html:t}},Nt.prototype.close=function(){this.isOpen()&&(clearTimeout(this._timeout),this._container.innerHTML="",this._eventBus.fire("contextPad.close",{current:this._current}),this._current=null)},Nt.prototype.isOpen=function(e){var t=this._current;if(!t)return!1;if(!e)return!0;var n=t.target;return xe(e)!==xe(n)?!1:xe(e)?e.length===n.length&&Pr(e,function(i){return n.includes(i)}):n===e},Nt.prototype.isShown=function(){return this.isOpen()&&vt(this._current.html).has("open")},Nt.prototype.show=function(){this.isOpen()&&(vt(this._current.html).add("open"),this._updatePosition(),this._eventBus.fire("contextPad.show",{current:this._current}))},Nt.prototype.hide=function(){this.isOpen()&&(vt(this._current.html).remove("open"),this._eventBus.fire("contextPad.hide",{current:this._current}))},Nt.prototype._getPosition=function(e){if(!xe(e)&&st(e)){var t=this._canvas.viewbox(),n=NM(e),i=n.x*t.scale-t.x*t.scale,r=n.y*t.scale-t.y*t.scale;return{left:i+Wv*this._canvas.zoom(),top:r}}var o=this._canvas.getContainer(),a=o.getBoundingClientRect(),s=this._getTargetBounds(e);return{left:s.right-a.left+Wv*this._canvas.zoom(),top:s.top-a.top}},Nt.prototype._updatePosition=function(){const e=()=>{if(this.isOpen()){var t=this._current.html,n=this._getPosition(this._current.target);"x"in n&&"y"in n?(t.style.left=n.x+"px",t.style.top=n.y+"px"):["top","right","bottom","left"].forEach(function(i){i in n&&(t.style[i]=n[i]+"px")})}};this._scheduler.schedule(e,"ContextPad#_updatePosition")},Nt.prototype._updateVisibility=function(){const e=()=>{if(this.isOpen()){var t=this,n=this._current.target,i=xe(n)?n:[n],r=i.some(function(o){return t._canvas.hasMarker(o,OM)});r?t.hide():t.show()}};this._scheduler.schedule(e,"ContextPad#_updateVisibility")},Nt.prototype._getTargetBounds=function(e){var t=this,n=xe(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 IM(e,t){var n=vt(e);t=xe(t)?t:t.split(/\s+/g),t.forEach(function(i){n.add(i)})}function NM(e){return e.waypoints[e.waypoints.length-1]}function BM(e,t){return e=xe(e)?e:[e],t=xe(t)?t:[t],e.length===t.length&&Pr(e,function(n){return t.includes(n)})}const Uv={__depends__:[pc,kM,Bc],contextPad:["type",Nt]};var Hc,Et,qv,_r,Yv,Kv,Xv,cf,zc,Na,Zv,uf,lf,pf,Gc={},Vc=[],$M=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,Wc=Array.isArray;function Gi(e,t){for(var n in t)e[n]=t[n];return e}function ff(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function Qv(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?Hc.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 Uc(e,a,i,r,null)}function Uc(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??++qv,__i:-1,__u:0};return r==null&&Et.vnode!=null&&Et.vnode(o),o}function qc(e){return e.children}function Yc(e,t){this.props=e,this.context=t}function Wr(e,t){if(t==null)return e.__?Wr(e.__,e.__i+1):null;for(var n;t<e.__k.length;t++)if((n=e.__k[t])!=null&&n.__e!=null)return n.__e;return typeof e.type=="function"?Wr(e):null}function jM(e){if(e.__P&&e.__d){var t=e.__v,n=t.__e,i=[],r=[],o=Gi({},t);o.__v=t.__v+1,Et.vnode&&Et.vnode(o),df(e.__P,o,t,e.__n,e.__P.namespaceURI,32&t.__u?[n]:null,i,n??Wr(t),!!(32&t.__u),r),o.__v=t.__v,o.__.__k[o.__i]=o,a_(i,o,r),t.__e=t.__=null,o.__e!=n&&Jv(o)}}function Jv(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}),Jv(e)}function e_(e){(!e.__d&&(e.__d=!0)&&_r.push(e)&&!Kc.__r++||Yv!=Et.debounceRendering)&&((Yv=Et.debounceRendering)||Kv)(Kc)}function Kc(){try{for(var e,t=1;_r.length;)_r.length>t&&_r.sort(Xv),e=_r.shift(),t=_r.length,jM(e)}finally{_r.length=Kc.__r=0}}function t_(e,t,n,i,r,o,a,s,c,u,l){var f,p,d,h,m,g,S=i&&i.__k||Vc,E=t.length;for(c=FM(n,t,S,c,E),f=0;f<E;f++)(d=n.__k[f])!=null&&(p=d.__i!=-1&&S[d.__i]||Gc,d.__i=f,g=df(e,d,p,r,o,a,s,c,u,l),h=d.__e,d.ref&&p.ref!=d.ref&&(p.ref&&hf(p.ref,null,d),l.push(d.ref,d.__c||h,d)),m==null&&h!=null&&(m=h),4&d.__u?(c=n_(d,c,e),p.__e&&(p.__e=null)):typeof d.type=="function"&&g!==void 0?c=g:h&&(c=h.nextSibling),d.__u&=-7);return n.__e=m,c}function FM(e,t,n,i,r){var o,a,s,c,u,l=n.length,f=l,p=0;for(e.__k=new Array(r),o=0;o<r;o++)(a=t[o])!=null&&typeof a!="boolean"&&typeof a!="function"?(typeof a=="string"||typeof a=="number"||typeof a=="bigint"||a.constructor==String?a=e.__k[o]=Uc(null,a,null,null,null):Wc(a)?a=e.__k[o]=Uc(qc,{children:a},null,null,null):a.constructor===void 0&&a.__b>0?a=e.__k[o]=Uc(a.type,a.props,a.key,a.ref?a.ref:null,a.__v):e.__k[o]=a,c=o+p,a.__=e,a.__b=e.__b+1,s=null,(u=a.__i=HM(a,n,c,f))!=-1&&(f--,(s=n[u])&&(s.__u|=2)),s==null||s.__v==null?(u==-1&&(r>l?p--:r<l&&p++),typeof a.type!="function"&&(a.__u|=4)):u!=c&&(u==c-1?p--:u==c+1?p++:(u>c?p--:p++,a.__u|=4))):e.__k[o]=null;if(f)for(o=0;o<l;o++)(s=n[o])!=null&&(2&s.__u)==0&&(s.__e==i&&(i=Wr(s)),c_(s,s));return i}function n_(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=n_(i[r],t,n));return t}e.__e!=t&&(t&&e.type&&!t.parentNode&&(t=Wr(e)),t=n.insertBefore(e.__e,t||null));do t=t&&t.nextSibling;while(t!=null&&t.nodeType==8);return t}function HM(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 i_(e,t,n){t[0]=="-"?e.setProperty(t,n??""):e[t]=n==null?"":typeof n!="number"||$M.test(t)?n:n+"px"}function Xc(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||i_(e.style,t,"");if(n)for(t in n)i&&n[t]==i[t]||i_(e.style,t,n[t])}else if(t[0]=="o"&&t[1]=="n")o=t!=(t=t.replace(Zv,"$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[Na]=i[Na]:(n[Na]=uf,e.addEventListener(t,o?pf:lf,o)):e.removeEventListener(t,o?pf:lf,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 r_(e){return function(t){if(this.l){var n=this.l[t.type+e];if(t[zc]==null)t[zc]=uf++;else if(t[zc]<n[Na])return;return n(Et.event?Et.event(t):t)}}}function df(e,t,n,i,r,o,a,s,c,u){var l,f,p,d,h,m,g,S,E,x,w,C,P,L,T,B,k=t.type;if(t.constructor!==void 0)return null;128&n.__u&&(c=!!(32&n.__u),o=[s=t.__e=n.__e]),(l=Et.__b)&&l(t);e:if(typeof k=="function"){f=a.length;try{if(E=t.props,x=k.prototype&&k.prototype.render,w=(l=k.contextType)&&i[l.__c],C=l?w?w.props.value:l.__:i,n.__c?S=(p=t.__c=n.__c).__=p.__E:(x?t.__c=p=new k(E,C):(t.__c=p=new Yc(E,C),p.constructor=k,p.render=GM),w&&w.sub(p),p.state||(p.state={}),p.__n=i,d=p.__d=!0,p.__h=[],p._sb=[]),x&&p.__s==null&&(p.__s=p.state),x&&k.getDerivedStateFromProps!=null&&(p.__s==p.state&&(p.__s=Gi({},p.__s)),Gi(p.__s,k.getDerivedStateFromProps(E,p.__s))),h=p.props,m=p.state,p.__v=t,d)x&&k.getDerivedStateFromProps==null&&p.componentWillMount!=null&&p.componentWillMount(),x&&p.componentDidMount!=null&&p.__h.push(p.componentDidMount);else{if(x&&k.getDerivedStateFromProps==null&&E!==h&&p.componentWillReceiveProps!=null&&p.componentWillReceiveProps(E,C),t.__v==n.__v||!p.__e&&p.shouldComponentUpdate!=null&&p.shouldComponentUpdate(E,p.__s,C)===!1){t.__v!=n.__v&&(p.props=E,p.state=p.__s,p.__d=!1),t.__e=n.__e,t.__k=n.__k,t.__k.some(function(O){O&&(O.__=t)}),Vc.push.apply(p.__h,p._sb),p._sb=[],p.__h.length&&a.push(p),s=Wr(n);break e}p.componentWillUpdate!=null&&p.componentWillUpdate(E,p.__s,C),x&&p.componentDidUpdate!=null&&p.__h.push(function(){p.componentDidUpdate(h,m,g)})}if(p.context=C,p.props=E,p.__P=e,p.__e=!1,P=Et.__r,L=0,x)p.state=p.__s,p.__d=!1,P&&P(t),l=p.render(p.props,p.state,p.context),Vc.push.apply(p.__h,p._sb),p._sb=[];else do p.__d=!1,P&&P(t),l=p.render(p.props,p.state,p.context),p.state=p.__s;while(p.__d&&++L<25);p.state=p.__s,p.getChildContext!=null&&(i=Gi(Gi({},i),p.getChildContext())),x&&!d&&p.getSnapshotBeforeUpdate!=null&&(g=p.getSnapshotBeforeUpdate(h,m)),T=l!=null&&l.type===qc&&l.key==null?s_(l.props.children):l,s=t_(e,Wc(T)?T:[T],t,n,i,r,o,a,s,c,u),p.base=t.__e,t.__u&=-161,p.__h.length&&a.push(p),S&&(p.__E=p.__=null)}catch(O){if(a.length=f,t.__v=null,c||o!=null){if(O.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(B=o.length;B--;)ff(o[B])}else t.__e=n.__e;t.__k==null&&(t.__k=n.__k||[]),O.then||o_(t),Et.__e(O,t,n)}}else o==null&&t.__v==n.__v?(t.__k=n.__k,t.__e=n.__e):s=t.__e=zM(n.__e,t,n,i,r,o,a,c,u);return(l=Et.diffed)&&l(t),128&t.__u?void 0:s}function o_(e){e&&(e.__c&&(e.__c.__e=!0),e.__k&&e.__k.some(o_))}function a_(e,t,n){for(var i=0;i<n.length;i++)hf(n[i],n[++i],n[++i]);Et.__c&&Et.__c(t,e),e.some(function(r){try{e=r.__h,r.__h=[],e.some(function(o){o.call(r)})}catch(o){Et.__e(o,r.__v)}})}function s_(e){return typeof e!="object"||e==null||e.__b>0?e:Wc(e)?e.map(s_):e.constructor!==void 0?null:Gi({},e)}function zM(e,t,n,i,r,o,a,s,c){var u,l,f,p,d,h,m,g=n.props||Gc,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&&(Et.__m&&Et.__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&&Hc.call(e.childNodes),!s&&o!=null)for(g={},u=0;u<e.attributes.length;u++)g[(d=e.attributes[u]).name]=d.value;for(u in g)d=g[u],u=="dangerouslySetInnerHTML"?f=d:u=="children"||u in S||u=="value"&&"defaultValue"in S||u=="checked"&&"defaultChecked"in S||Xc(e,u,null,d,r);for(u in S)d=S[u],u=="children"?p=d:u=="dangerouslySetInnerHTML"?l=d:u=="value"?h=d:u=="checked"?m=d:s&&typeof d!="function"||g[u]===d||Xc(e,u,d,g[u],r);if(l)s||f&&(l.__html==f.__html||l.__html==e.innerHTML)||(e.innerHTML=l.__html),t.__k=[];else if(f&&(e.innerHTML=""),t_(t.type=="template"?e.content:e,Wc(p)?p:[p],t,n,i,E=="foreignObject"?"http://www.w3.org/1999/xhtml":r,o,a,o?o[0]:n.__k&&Wr(n,0),s,c),o!=null)for(u=o.length;u--;)ff(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])&&Xc(e,u,h,g[u],r),u="checked",m!=null&&m!=e[u]&&Xc(e,u,m,g[u],r))}return e}function hf(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){Et.__e(r,n)}}function c_(e,t,n){var i,r;if(Et.unmount&&Et.unmount(e),(i=e.ref)&&(i.current&&i.current!=e.__e||hf(i,null,t)),(i=e.__c)!=null){if(i.componentWillUnmount)try{i.componentWillUnmount()}catch(o){Et.__e(o,t)}i.base=i.__P=i.__n=null}if(i=e.__k)for(r=0;r<i.length;r++)i[r]&&c_(i[r],t,n||typeof e.type!="function");n||ff(e.__e),e.__c=e.__=e.__e=void 0}function GM(e,t,n){return this.constructor(e,n)}function u_(e,t,n){var i,r,o,a;t==document&&(t=document.documentElement),Et.__&&Et.__(e,t),r=(i=!1)?null:t.__k,o=[],a=[],df(t,e=t.__k=Qv(qc,null,[e]),r||Gc,Gc,t.namespaceURI,r?null:t.firstChild?Hc.call(t.childNodes):null,o,r?r.__e:t.firstChild,i,a),a_(o,e,a),e.props.children=null}Hc=Vc.slice,Et={__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}},qv=0,Yc.prototype.setState=function(e,t){var n;n=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=Gi({},this.state),typeof e=="function"&&(e=e(Gi({},n),this.props)),e&&Gi(n,e),e!=null&&this.__v&&(t&&this._sb.push(t),e_(this))},Yc.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),e_(this))},Yc.prototype.render=qc,_r=[],Kv=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,Xv=function(e,t){return e.__v.__b-t.__v.__b},Kc.__r=0,cf=Math.random().toString(8),zc="__d"+cf,Na="__a"+cf,Zv=/(PointerCapture)$|Capture$/i,uf=0,lf=r_(!1),pf=r_(!0);var l_=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,l_(e,s,n,["",null])),i.push(r),s[0]?t[0]|=2:(t[o-2]=0,t[o]=r)):i.push(s)}return i},p_=new Map;function VM(e){var t=p_.get(this);return t||(t=new Map,p_.set(this,t)),(t=l_(this,t.get(e)||(t.set(e,t=(function(n){for(var i,r,o=1,a="",s="",c=[0],u=function(p){o===1&&(p||(a=a.replace(/^\s*\n\s*|\s*\n\s*$/g,"")))?c.push(0,p,a):o===3&&(p||a)?(c.push(3,p,a),o=2):o===2&&a==="..."&&p?c.push(4,p,0):o===2&&a&&!p?c.push(5,0,!0,a):o>=5&&((a||!p&&o===5)&&(c.push(o,0,a,r),o=6),p&&(c.push(o,p,0,r),o=6)),a=""},l=0;l<n.length;l++){l&&(o===1&&u(),u(l));for(var f=0;f<n[l].length;f++)i=n[l][f],o===1?i==="<"?(u(),c=[c],o=3):a+=i:o===4?a==="--"&&i===">"?(o=1,a=""):a=i+a[0]:s?i===s?s="":a+=i:i==='"'||i==="'"?s=i:i===">"?(u(),o=1):o&&(i==="="?(o=5,r=a,a=""):i==="/"&&(o<5||n[l][f+1]===">")?(u(),o===3&&(c=c[0]),o=c,(c=c[0]).push(2,0,o),o=0):i===" "||i===" "||i===`
|
|
11
|
+
`||i==="\r"?(u(),o=2):a+=i),o===3&&a==="!--"&&(o=4,c=c[0])}return u(),c})(e)),t),arguments,[])).length>1?t:t[0]}var ut=VM.bind(Qv),No,Bt,mf,f_,Ba=0,d_=[],Vt=Et,h_=Vt.__b,m_=Vt.__r,g_=Vt.diffed,y_=Vt.__c,v_=Vt.unmount,__=Vt.__;function Zc(e,t){Vt.__h&&Vt.__h(Bt,e,Ba||t),Ba=0;var n=Bt.__H||(Bt.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({}),n.__[e]}function gf(e){return Ba=1,WM(x_,e)}function WM(e,t,n){var i=Zc(No++,2);if(i.t=e,!i.__c&&(i.__=[x_(void 0,t),function(s){var c=i.__N?i.__N[0]:i.__[0],u=i.t(c,s);c!==u&&(i.__N=[u,i.__[1]],i.__c.setState({}))}],i.__c=Bt,!Bt.__f)){var r=function(s,c,u){if(!i.__c.__H)return!0;var l=!1,f=i.__c.props!==s;if(i.__c.__H.__.some(function(d){if(d.__N){l=!0;var h=d.__[0];d.__=d.__N,d.__N=void 0,h!==d.__[0]&&(f=!0)}}),o){var p=o.call(this,s,c,u);return l?p||f:p}return!l||f};Bt.__f=!0;var o=Bt.shouldComponentUpdate,a=Bt.componentWillUpdate;Bt.componentWillUpdate=function(s,c,u){if(this.__e){var l=o;o=void 0,r(s,c,u),o=l}a&&a.call(this,s,c,u)},Bt.shouldComponentUpdate=r}return i.__N||i.__}function Qc(e,t){var n=Zc(No++,3);!Vt.__s&&_f(n.__H,t)&&(n.__=e,n.u=t,Bt.__H.__h.push(n))}function yf(e,t){var n=Zc(No++,4);!Vt.__s&&_f(n.__H,t)&&(n.__=e,n.u=t,Bt.__h.push(n))}function Jc(e){return Ba=5,Vi(function(){return{current:e}},[])}function Vi(e,t){var n=Zc(No++,7);return _f(n.__H,t)&&(n.__=e(),n.__H=t,n.__h=e),n.__}function $a(e,t){return Ba=8,Vi(function(){return e},t)}function UM(){for(var e;e=d_.shift();){var t=e.__H;if(e.__P&&t)try{t.__h.some(eu),t.__h.some(vf),t.__h=[]}catch(n){t.__h=[],Vt.__e(n,e.__v)}}}Vt.__b=function(e){Bt=null,h_&&h_(e)},Vt.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),__&&__(e,t)},Vt.__r=function(e){m_&&m_(e),No=0;var t=(Bt=e.__c).__H;t&&(mf===Bt?(t.__h=[],Bt.__h=[],t.__.some(function(n){n.__N&&(n.__=n.__N),n.u=n.__N=void 0})):(t.__h.some(eu),t.__h.some(vf),t.__h=[],No=0)),mf=Bt},Vt.diffed=function(e){g_&&g_(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(d_.push(t)!==1&&f_===Vt.requestAnimationFrame||((f_=Vt.requestAnimationFrame)||qM)(UM)),t.__H.__.some(function(n){n.u&&(n.__H=n.u,n.u=void 0)})),mf=Bt=null},Vt.__c=function(e,t){t.some(function(n){try{n.__h.some(eu),n.__h=n.__h.filter(function(i){return!i.__||vf(i)})}catch(i){t.some(function(r){r.__h&&(r.__h=[])}),t=[],Vt.__e(i,n.__v)}}),y_&&y_(e,t)},Vt.unmount=function(e){v_&&v_(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.some(function(i){try{eu(i)}catch(r){t=r}}),n.__H=void 0,t&&Vt.__e(t,n.__v))};var b_=typeof requestAnimationFrame=="function";function qM(e){var t,n=function(){clearTimeout(i),b_&&cancelAnimationFrame(t),setTimeout(e)},i=setTimeout(n,35);b_&&(t=requestAnimationFrame(n))}function eu(e){var t=Bt,n=e.__c;typeof n=="function"&&(e.__c=void 0,n()),Bt=t}function vf(e){var t=Bt;e.__c=e.__(),Bt=t}function _f(e,t){return!e||e.length!==t.length||t.some(function(n,i){return n!==e[i]})}function x_(e,t){return typeof t=="function"?t(e):t}function YM(e){const{navigationStack:t,setNavigationStack:n}=e,i=Vi(()=>t.length<=1?[]:t.slice(0,-1).map((a,s)=>({label:a.label,onClick:()=>n(c=>c.slice(0,s+1))})),[t,n]),r=t.length>0?()=>n([]):null,o=t.length>0?t[t.length-1].label:null;return ut`
|
|
12
12
|
<div class="djs-popup-breadcrumbs">
|
|
13
|
-
${r&&
|
|
13
|
+
${r&&ut`
|
|
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)=>ut`
|
|
27
27
|
<button
|
|
28
28
|
key=${s}
|
|
29
29
|
type="button"
|
|
@@ -35,22 +35,22 @@
|
|
|
35
35
|
</button>
|
|
36
36
|
<span class="djs-popup-breadcrumbs-item--separator" aria-hidden="true"></span>
|
|
37
37
|
`)}
|
|
38
|
-
${o&&
|
|
38
|
+
${o&&ut`
|
|
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
|
|
44
|
+
`}function w_(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=w_(e[t]))&&(i&&(i+=" "),i+=n)}else for(n in e)e[n]&&(i&&(i+=" "),i+=n);return i}function tu(){for(var e,t,n=0,i="",r=arguments.length;n<r;n++)(e=arguments[n])&&(t=w_(e))&&(i&&(i+=" "),i+=t);return i}function KM(e){const{headerEntries:t,onSelect:n,selectedEntry:i,setSelectedEntry:r,title:o}=e,a=Vi(()=>XM(t),[t]),s=u=>u.action&&!u.disabled,c=(u,l)=>{if(s(l))return n(u,l)};return ut`
|
|
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=>ut`
|
|
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=>ut`
|
|
51
51
|
<li key=${l.id}>
|
|
52
52
|
<${s(l)?"button":"span"}
|
|
53
|
-
class=${
|
|
53
|
+
class=${ZM(l,l===i)}
|
|
54
54
|
onClick=${f=>c(f,l)}
|
|
55
55
|
title=${l.title||l.label}
|
|
56
56
|
data-id=${l.id}
|
|
@@ -60,8 +60,8 @@
|
|
|
60
60
|
onFocus=${()=>s(l)&&r(l)}
|
|
61
61
|
onBlur=${()=>s(l)&&r(null)}
|
|
62
62
|
>
|
|
63
|
-
${l.imageUrl&&
|
|
64
|
-
${l.label?
|
|
63
|
+
${l.imageUrl&&ut`<img class="djs-popup-entry-icon" src=${l.imageUrl} alt="" />`||l.imageHtml&&ut`<div class="djs-popup-entry-icon" dangerouslySetInnerHTML=${{__html:l.imageHtml}} />`}
|
|
64
|
+
${l.label?ut`
|
|
65
65
|
<span class="djs-popup-label">${l.label}</span>
|
|
66
66
|
`:null}
|
|
67
67
|
</${l.action?"button":"span"}>
|
|
@@ -70,11 +70,11 @@
|
|
|
70
70
|
</ul>
|
|
71
71
|
`)}
|
|
72
72
|
</div>
|
|
73
|
-
`}function
|
|
73
|
+
`}function XM(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 ZM(e,t){return tu("entry",e.className,e.active?"active":"",e.disabled?"disabled":"",t?"selected":"")}function E_(e,t){return`${e}-entry-${t.id}`}function QM(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 ut`
|
|
74
74
|
<li
|
|
75
|
-
class=${
|
|
75
|
+
class=${tu("entry",{selected:i,disabled:n.disabled})}
|
|
76
76
|
data-id=${n.id}
|
|
77
|
-
id=${
|
|
77
|
+
id=${E_(t,n)}
|
|
78
78
|
role="option"
|
|
79
79
|
aria-selected=${i||void 0}
|
|
80
80
|
aria-haspopup=${n.entries?"true":void 0}
|
|
@@ -88,17 +88,17 @@
|
|
|
88
88
|
>
|
|
89
89
|
<div class="djs-popup-entry-content">
|
|
90
90
|
<span
|
|
91
|
-
class=${
|
|
91
|
+
class=${tu("djs-popup-entry-name",n.className)}
|
|
92
92
|
>
|
|
93
|
-
${n.imageUrl&&
|
|
93
|
+
${n.imageUrl&&ut`<img class="djs-popup-entry-icon" src=${n.imageUrl} alt="" />`||n.imageHtml&&ut`<div class="djs-popup-entry-icon" dangerouslySetInnerHTML=${{__html:n.imageHtml}} />`}
|
|
94
94
|
|
|
95
|
-
${n.label?
|
|
95
|
+
${n.label?ut`
|
|
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&&ut`
|
|
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&&ut`
|
|
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&&ut`
|
|
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
|
|
134
|
+
`}function JM(e){const{selectedEntry:t,setSelectedEntry:n,groupedEntries:i,keyboardSelection:r,idPrefix:o,id:a,ariaLabel:s,tabIndex:c,ariaActivedescendant:u,...l}=e,f=Jc();yf(()=>{if(!r||!r.current)return;const m=f.current;if(!m)return;const g=m.querySelector(".selected");g&&e2(g)},[t]);const p=()=>{r.current=!1},d=m=>{r.current||n(m)},h=()=>{r.current||n(null)};return ut`
|
|
135
135
|
<div
|
|
136
136
|
class="djs-popup-results"
|
|
137
137
|
ref=${f}
|
|
@@ -142,9 +142,9 @@
|
|
|
142
142
|
aria-activedescendant=${u}
|
|
143
143
|
onMouseMove=${p}
|
|
144
144
|
>
|
|
145
|
-
${i.map(m=>
|
|
146
|
-
${m.name&&
|
|
147
|
-
<div key=${m.id} id=${
|
|
145
|
+
${i.map(m=>ut`
|
|
146
|
+
${m.name&&ut`
|
|
147
|
+
<div key=${m.id} id=${S_(o,m)} class="entry-header" title=${m.name}>
|
|
148
148
|
${m.name}
|
|
149
149
|
</div>
|
|
150
150
|
`}
|
|
@@ -152,10 +152,10 @@
|
|
|
152
152
|
class="djs-popup-group"
|
|
153
153
|
data-group=${m.id}
|
|
154
154
|
role="group"
|
|
155
|
-
aria-labelledby=${m.name?
|
|
155
|
+
aria-labelledby=${m.name?S_(o,m):void 0}
|
|
156
156
|
>
|
|
157
|
-
${m.entries.map(g=>
|
|
158
|
-
<${
|
|
157
|
+
${m.entries.map(g=>ut`
|
|
158
|
+
<${QM}
|
|
159
159
|
key=${g.id}
|
|
160
160
|
idPrefix=${o}
|
|
161
161
|
entry=${g}
|
|
@@ -168,36 +168,36 @@
|
|
|
168
168
|
</ul>
|
|
169
169
|
`)}
|
|
170
170
|
</div>
|
|
171
|
-
`}function
|
|
172
|
-
<${
|
|
171
|
+
`}function S_(e,t){return`${e}-group-${t.id}`}function e2(e){typeof e.scrollIntoViewIfNeeded=="function"?e.scrollIntoViewIfNeeded():e.scrollIntoView({scrollMode:"if-needed",block:"nearest"})}const t2=new To("djs-popup");function n2(e){const{onClose:t,onSelect:n,className:i,headerEntries:r,position:o,title:a,width:s,scale:c,search:u,emptyPlaceholder:l,searchFn:f,entries:p,onOpened:d,onClosed:h}=e,[m,g]=gf([]);Qc(()=>{g([])},[p]);const[S,E]=gf(""),x=S.trim().length>0,w=Vi(()=>o2(p),[p]),C=Vi(()=>Ft(u)?w.length>5:!1,[u,w]),P=Vi(()=>{const V=m.length?m[m.length-1].entries:p;return C?x?f(w.filter(({searchable:G})=>G!==!1),S,{keys:["label","search","description"]}).map(({item:G})=>G):V.filter(({rank:G=0})=>G>=0):V},[C,x,w,S,f,m,p]),L=Vi(()=>x?P.length?[{id:"default",entries:P}]:[]:a2(P),[P,x]),[T,B]=gf(P[0]),k=Jc(null),O=Jc(!1),$=Vi(()=>t2.next(),[]),ne=`${$}-results`,le=T&&E_($,T);Qc(()=>{const V=k.current;V&&P.includes(V)?B(V):B(P[0]),k.current=null},[P]);const je=$a(V=>{const G=r2(L);let De=G.indexOf(T)+V;De<0&&(De=G.length-1),De>=G.length&&(De=0),O.current=!0,B(G[De])},[L,T]),W=$a(V=>{V>0&&T&&T.entries&&(O.current=!0,g(G=>[...G,T])),V<0&&m.length>0&&(O.current=!0,k.current=m[m.length+V],g(G=>G.slice(0,V)))},[T,m]),re=$a((V,G,K)=>{if(!(!G||G.disabled))return G.entries?(V.preventDefault(),W(1)):n(V,G,K)},[n,W]),pe=$a(V=>{if(V.key==="Enter"&&T){const G=V.target;return!!Or(G,"a, button",!0)||T.disabled?void 0:re(V,T)}if(V.key==="Backspace"){const G=V.target;if(!(tl(G,"input")&&G.value!==""))return W(-1),V.preventDefault()}if(V.key==="ArrowUp")return je(-1),V.preventDefault();if(V.key==="ArrowDown")return je(1),V.preventDefault();if(V.key==="ArrowRight")return W(1),V.preventDefault();if(V.key==="ArrowLeft")return W(-1),V.preventDefault()},[T,je,W,re]),oe=$a(V=>{tl(V.target,"input")&&E(()=>V.target.value)},[E]);Qc(()=>(d(),()=>{h()}),[]);const fe=!x&&m.length>0,ee=(a||r.length>0)&&!fe;return ut`
|
|
172
|
+
<${R_}
|
|
173
173
|
onClose=${t}
|
|
174
|
-
onKeyup=${
|
|
175
|
-
onKeydown=${
|
|
174
|
+
onKeyup=${oe}
|
|
175
|
+
onKeydown=${pe}
|
|
176
176
|
className=${i}
|
|
177
177
|
position=${o}
|
|
178
178
|
width=${s}
|
|
179
179
|
scale=${c}
|
|
180
180
|
navigationStack=${m}
|
|
181
181
|
>
|
|
182
|
-
${
|
|
183
|
-
<${
|
|
182
|
+
${ee&&ut`
|
|
183
|
+
<${KM}
|
|
184
184
|
headerEntries=${r}
|
|
185
185
|
onSelect=${n}
|
|
186
|
-
selectedEntry=${
|
|
187
|
-
setSelectedEntry=${
|
|
186
|
+
selectedEntry=${T}
|
|
187
|
+
setSelectedEntry=${B}
|
|
188
188
|
title=${a}
|
|
189
189
|
/>
|
|
190
190
|
`}
|
|
191
|
-
${
|
|
192
|
-
<${
|
|
191
|
+
${fe&&ut`
|
|
192
|
+
<${YM}
|
|
193
193
|
navigationStack=${m}
|
|
194
194
|
setNavigationStack=${g}
|
|
195
195
|
/>
|
|
196
196
|
`}
|
|
197
|
-
${p.length>0&&
|
|
197
|
+
${p.length>0&&ut`
|
|
198
198
|
<div class="djs-popup-body">
|
|
199
199
|
|
|
200
|
-
${C&&
|
|
200
|
+
${C&&ut`
|
|
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"/>
|
|
@@ -208,39 +208,39 @@
|
|
|
208
208
|
role="combobox"
|
|
209
209
|
aria-label="${a||"Search"}"
|
|
210
210
|
aria-expanded="true"
|
|
211
|
-
aria-controls=${
|
|
212
|
-
aria-activedescendant=${
|
|
211
|
+
aria-controls=${ne}
|
|
212
|
+
aria-activedescendant=${le||void 0}
|
|
213
213
|
aria-autocomplete="list"
|
|
214
214
|
/>
|
|
215
215
|
</div>
|
|
216
216
|
`}
|
|
217
217
|
|
|
218
|
-
${x&&
|
|
218
|
+
${x&&ut`
|
|
219
219
|
<div class="djs-popup-search-count" aria-live="polite">
|
|
220
|
-
${
|
|
220
|
+
${P.length} ${P.length===1?"result":"results"} found
|
|
221
221
|
</div>
|
|
222
222
|
`}
|
|
223
223
|
|
|
224
|
-
<${
|
|
225
|
-
groupedEntries=${
|
|
226
|
-
selectedEntry=${
|
|
227
|
-
setSelectedEntry=${
|
|
228
|
-
keyboardSelection=${
|
|
229
|
-
onAction=${
|
|
230
|
-
idPrefix=${
|
|
231
|
-
id=${
|
|
224
|
+
<${JM}
|
|
225
|
+
groupedEntries=${L}
|
|
226
|
+
selectedEntry=${T}
|
|
227
|
+
setSelectedEntry=${B}
|
|
228
|
+
keyboardSelection=${O}
|
|
229
|
+
onAction=${re}
|
|
230
|
+
idPrefix=${$}
|
|
231
|
+
id=${ne}
|
|
232
232
|
ariaLabel=${a||"Results"}
|
|
233
233
|
tabIndex=${C?-1:0}
|
|
234
|
-
ariaActivedescendant=${C?void 0:
|
|
234
|
+
ariaActivedescendant=${C?void 0:le||void 0}
|
|
235
235
|
/>
|
|
236
236
|
|
|
237
|
-
${
|
|
237
|
+
${T&&T.documentationRef&&ut`
|
|
238
238
|
<div class="djs-popup-footer">
|
|
239
239
|
<a
|
|
240
240
|
class="djs-popup-footer-docs"
|
|
241
|
-
href=${
|
|
242
|
-
onClick=${
|
|
243
|
-
aria-label=${
|
|
241
|
+
href=${T.documentationRef}
|
|
242
|
+
onClick=${V=>V.stopPropagation()}
|
|
243
|
+
aria-label=${T.label?`Open entry documentation for ${T.label}`:"Open entry documentation"}
|
|
244
244
|
target="_blank"
|
|
245
245
|
rel="noopener"
|
|
246
246
|
>
|
|
@@ -254,14 +254,14 @@
|
|
|
254
254
|
`}
|
|
255
255
|
</div>
|
|
256
256
|
`}
|
|
257
|
-
${l&&
|
|
257
|
+
${l&&P.length===0&&ut`
|
|
258
258
|
<div class="djs-popup-no-results">${qt(l)?l(S):l}</div>
|
|
259
259
|
`}
|
|
260
|
-
</${
|
|
261
|
-
`}function
|
|
260
|
+
</${R_}>
|
|
261
|
+
`}function R_(e){const{onClose:t,onKeydown:n,onKeyup:i,className:r,children:o,navigationStack:a,position:s}=e,c=Jc();return yf(()=>{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]),yf(()=>{const u=c.current;if(!u)return;(u.querySelector("input")||u.querySelector('[role="listbox"]')||u).focus()},[a]),Qc(()=>{const u=f=>{if(f.key==="Escape")return f.preventDefault(),t()},l=f=>{if(!Or(f.target,".djs-popup",!0))return t()};return document.documentElement.addEventListener("keydown",u),document.body.addEventListener("click",l,!0),()=>{document.documentElement.removeEventListener("keydown",u),document.body.removeEventListener("click",l,!0)}},[]),ut`
|
|
262
262
|
<div
|
|
263
|
-
class=${
|
|
264
|
-
style=${
|
|
263
|
+
class=${tu("djs-popup",r)}
|
|
264
|
+
style=${i2(e)}
|
|
265
265
|
onKeydown=${n}
|
|
266
266
|
onKeyup=${i}
|
|
267
267
|
ref=${c}
|
|
@@ -269,8 +269,8 @@
|
|
|
269
269
|
>
|
|
270
270
|
${o}
|
|
271
271
|
</div>
|
|
272
|
-
`}function
|
|
273
|
-
<${
|
|
272
|
+
`}function i2(e){const{width:t}=e,n=typeof t=="number"?`${t}px`:t;return{transform:`scale(${e.scale})`,width:Ft(t)?n:void 0,maxWidth:Ft(t)?"unset":void 0,"transform-origin":"top left"}}function r2(e){const t=[];return e.forEach(n=>{n.entries.forEach(i=>{t.push(i)})}),t}function o2(e){const t=[];function n(i){i.forEach(r=>{if(r.entries){n(r.entries);return}t.push(r)})}return n(e),t}function a2(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 s2="data-id",C_=["contextPad.close","canvas.viewbox.changing","commandStack.changed"],c2=1e3;function St(e,t,n,i){this._eventBus=t,this._canvas=n,this._search=i,this._current=null;var r=Ft(e&&e.scale)?e.scale:{min:1,max:1};this._config={scale:r},t.on("diagram.destroy",()=>{this.close()}),t.on("element.changed",o=>{const a=this.isOpen()&&this._current.target;o.element===a&&this.refresh()})}St.$inject=["config.popupMenu","eventBus","canvas","search"],St.prototype._render=function(){const{position:e,providerId:t,entries:n,headerEntries:i,emptyPlaceholder:r,options:o}=this._current,a=P_(n),s=Object.entries(i).map(([p,d])=>({id:p,...d})),c=e&&(p=>this._ensureVisible(p,e)),u=this._updateScale(this._current.container);u_(ut`
|
|
273
|
+
<${n2}
|
|
274
274
|
onClose=${p=>this.close(p)}
|
|
275
275
|
onSelect=${(p,d,h)=>this.trigger(p,d,h)}
|
|
276
276
|
position=${c}
|
|
@@ -284,7 +284,7 @@
|
|
|
284
284
|
searchFn=${this._search}
|
|
285
285
|
...${{...o}}
|
|
286
286
|
/>
|
|
287
|
-
`,this._current.container)},
|
|
287
|
+
`,this._current.container)},St.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()},St.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()},St.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)}},St.prototype.close=function(){this.isOpen()&&(this._emit("close"),this.reset(),this._canvas.restoreFocus(),this._current=null)},St.prototype.reset=function(){const e=this._current.container;u_(null,e),fi(e)},St.prototype._emit=function(e,t){this._eventBus.fire(`popupMenu.${e}`,t)},St.prototype._onOpened=function(){this._emit("opened")},St.prototype._onClosed=function(){this._emit("closed")},St.prototype._createContainer=function(e){var t=this._canvas,n=t.getContainer();const i=dt(`<div class="djs-popup-parent djs-scrollable" data-popup=${e.provider}></div>`);return n.appendChild(i),i},St.prototype._bindAutoClose=function(){this._eventBus.once(C_,this.close,this)},St.prototype._unbindAutoClose=function(){this._eventBus.off(C_,this.close,this)},St.prototype._updateScale=function(){var e=this._canvas.zoom(),t=this._config.scale,n,i,r=e;return t!==!0&&(t===!1?(n=1,i=1):(n=t.min,i=t.max),Ft(n)&&e<n&&(r=n),Ft(i)&&e>i&&(r=i)),r},St.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}},St.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},St.prototype.registerProvider=function(e,t,n){n||(n=t,t=c2),this._eventBus.on("popupMenu.getProviders."+e,t,function(i){i.providers.push(n)})},St.prototype._getProviders=function(e){var t=this._eventBus.createEvent({type:"popupMenu.getProviders."+e,providers:[]});return this._eventBus.fire(t),t.providers},St.prototype._getEntries=function(e,t){var n={};return D(t,function(i){if(!i.getPopupMenuEntries){D(i.getEntries(e),function(o){var a=o.id;if(!a)throw new Error("entry ID is missing");n[a]=si(o,["id"])});return}var r=i.getPopupMenuEntries(e);qt(r)?n=r(n):D(r,function(o,a){n[a]=o})}),n},St.prototype._getHeaderEntries=function(e,t){var n={};return D(t,function(i){if(!i.getPopupMenuHeaderEntries){if(!i.getHeaderEntries)return;D(i.getHeaderEntries(e),function(o){var a=o.id;if(!a)throw new Error("entry ID is missing");n[a]=si(o,["id"])});return}var r=i.getPopupMenuHeaderEntries(e);qt(r)?n=r(n):D(r,function(o,a){n[a]=o})}),n},St.prototype._getEmptyPlaceholder=function(e){const t=e.find(n=>qt(n.getEmptyPlaceholder));return t&&t.getEmptyPlaceholder()},St.prototype.isOpen=function(){return!!this._current},St.prototype.trigger=function(e,t,n="click"){if(e.preventDefault(),!t){let r=Or(e.delegateTarget||e.target,".entry",!0),o=ln(r,s2);t={id:o,...this._getEntry(o)}}const i=t.action;if(this._emit("trigger",{entry:t,event:e})!==!1){if(qt(i)){if(n==="click")return i(e,t)}else if(i[n])return i[n](e,t)}},St.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 P_(e,t=[]){return Object.entries(e).map(([n,i])=>{const r={id:n,...i};return r.entries?r.entries=P_(r.entries,[...t,...A_(r.search)]):t.length&&(r.search=[...t,...A_(r.search)]),r})}function A_(e){return e?xe(e)?e:[e]:[]}function u2(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=l2(o,r,i);return a?{item:o,tokens:a}:[]}).sort(p2(i))}function l2(e,t,n){const{matchedWords:i,tokens:r}=n.reduce((o,a)=>{const s=e[a],{tokens:c,matchedWords:u}=xe(s)?s.reduce((l,f)=>{const{tokens:p,matchedWords:d}=D_(f,t);return{tokens:[...l.tokens,p],matchedWords:{...l.matchedWords,...d}}},{matchedWords:{},tokens:[]}):D_(s,t);return{tokens:{...o.tokens,[a]:c},matchedWords:{...o.matchedWords,...u}}},{matchedWords:{},tokens:{}});return Object.keys(i).length!==t.length?null:r}function p2(e){return(t,n)=>{let i=0,r=1;for(const o of e){const a=f2(t.tokens[o],n.tokens[o]);if(a!==0){i+=a*r,r*=T_;continue}const s=d2(t.item[o],n.item[o]);if(s!==0){i+=s*r,r*=T_;continue}}return i}}function f2(e,t){return M_(t)-M_(e)}const T_=.5,Bo={FULL:131.9,START_FULL_WORD:8,START_WORD_PART:7.87,WORD_START:2.19,WORD_PART:1,NO_MATCH:-.07};function M_(e){const t=e.reduce((s,c)=>s+k_(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 k_(e){if(xe(e))return Math.max(...e.map(k_));const t=Math.log(e.value.length);return e.match?(e.start?e.end?Bo.FULL:e.wordEnd?Bo.START_FULL_WORD:Bo.START_WORD_PART:e.wordStart?Bo.WORD_START:Bo.WORD_PART)*t:Bo.NO_MATCH*t}function O_(e=""){return xe(e)?e.join(", "):e}function d2(e,t){return O_(e).localeCompare(O_(t))}function D_(e,t){var u;if(!e)return{tokens:[],matchedWords:{}};const n=[],i={},r=t.map(h2),o=[`(?<all>${r.join("\\s+")})`,...r].join("|"),a=new RegExp(o,"ig");let s,c=0;for(;s=a.exec(e);){const[l]=s,f=s.index,p=s.index+l.length,d=f===0,h=p===e.length,m=!!((u=s.groups)!=null&&u.all),g=d||/\s/.test(e.charAt(f-1)),S=h||/\s/.test(e.charAt(p));s.index>c&&n.push({value:e.slice(c,s.index),index:c}),n.push({value:l,index:s.index,match:!0,wordStart:g,wordEnd:S,start:d,end:h,all:m});const E=m?t:[l];for(const x of E)i[x.toLowerCase()]=!0;c=s.index+l.length}return c<e.length&&n.push({value:e.slice(c),index:c}),{tokens:n,matchedWords:i}}function h2(e){return e.replace(/[/\-\\^$*+?.()|[\]{}]/g,"\\$&")}const L_={search:["value",u2]},bf={__depends__:[L_],__init__:["popupMenu"],popupMenu:["type",St]};var I_={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>`},p2=900;function $o(e,t,n,i){e.registerProvider(p2,this),this._contextPad=e,this._popupMenu=t,this._translate=n,this._canvas=i}$o.$inject=["contextPad","popupMenu","translate","canvas"],$o.prototype.getMultiElementContextPadEntries=function(e){var t={};return this._isAllowed(e)&&N(t,this._getEntries(e)),t},$o.prototype._isAllowed=function(e){return!this._popupMenu.isEmpty(e,"align-elements")},$o.prototype._getEntries=function(){var e=this;return{"align-elements":{group:"align-elements",title:e._translate("Align elements"),html:`<div class="entry">${O_.align}</div>`,action:{click:function(t,n){var i=e._getMenuPosition(n);N(i,{cursor:{x:t.x,y:t.y}}),e._popupMenu.open(n,"align-elements",i)}}}}},$o.prototype._getMenuPosition=function(e){var t=5,n=this._contextPad.getPad(e).html,i=n.getBoundingClientRect(),r={x:i.left,y:i.bottom+t};return r};var f2=["left","center","right","top","middle","bottom"];function ja(e,t,n,i){this._alignElements=t,this._translate=n,this._popupMenu=e,this._rules=i,e.registerProvider("align-elements",this)}ja.$inject=["popupMenu","alignElements","translate","rules"],ja.prototype.getPopupMenuEntries=function(e){var t={};return this._isAllowed(e)&&N(t,this._getEntries(e)),t},ja.prototype._isAllowed=function(e){return this._rules.allowed("elements.align",{elements:e})},ja.prototype._getEntries=function(e){var t=this._alignElements,n=this._translate,i=this._popupMenu,r={};return k(f2,function(o){r["align-elements-"+o]={group:"align",title:n("Align elements "+o),className:"bjs-align-elements-menu-entry",imageHtml:O_[o],action:function(){t.trigger(e,o),i.close()}}}),r};function tu(e){Un.call(this,e)}tu.$inject=["eventBus"],se(tu,Un),tu.prototype.init=function(){this.addRule("elements.align",function(e){var t=e.elements,n=He(t,function(i){return!(i.waypoints||i.host||i.labelTarget)});return n=Ss(n),n.length<2?!1:n})};const d2={__depends__:[SM,Gv,vf],__init__:["alignElementsContextPadProvider","alignElementsMenuProvider","bpmnAlignElements"],alignElementsContextPadProvider:["type",$o],alignElementsMenuProvider:["type",ja],bpmnAlignElements:["type",tu]};function Gi(e,t,n,i){Q.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=Au(no(a.closure.topLevel)),c=a.hints,u=c?c.autoResize:!0;if(u!==!1){var l=io(s,function(f){return f.parent.id});k(l,function(f,p){Ce(u)&&(f=f.filter(function(d){return ft(u,ro({id:d.id}))})),r._expand(f,p)})}}),this.postExecuted(["shape.toggleCollapse"],function(o){var a=o.context,s=a.hints,c=a.shape;s&&s.autoResize===!1||c.collapsed||r._expand(c.children||[],c)}),this.postExecuted(["shape.resize"],function(o){var a=o.context,s=a.hints,c=a.shape,u=c.parent;s&&s.autoResize===!1||u&&r._expand([c],u)})}Gi.$inject=["eventBus","elementRegistry","modeling","rules"],se(Gi,Q),Gi.prototype._getOptimalBounds=function(e,t){var n=this.getOffset(t),i=this.getPadding(t),r=be(Lt(e)),o=be(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(N({},o,a))},Gi.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(h2(i,t)){var r=m2(ii(t,["x","y","width","height"]),i);this.resize(t,i,{autoResize:r});var o=t.parent;o&&this._expand([t],o)}}},Gi.prototype.getOffset=function(e){return{top:60,bottom:60,left:100,right:100}},Gi.prototype.getPadding=function(e){return{top:2,bottom:2,left:15,right:15}},Gi.prototype.resize=function(e,t,n){this._modeling.resizeShape(e,t,null,n)};function h2(e,t){return e.x!==t.x||e.y!==t.y||e.width!==t.width||e.height!==t.height}function m2(e,t){var n="";return e=be(e),t=be(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 nu(e){e.invoke(Gi,this)}nu.$inject=["injector"],se(nu,Gi),nu.prototype.resize=function(e,t,n){v(e,"bpmn:Participant")?this._modeling.resizeLane(e,t,null,n):this._modeling.resizeShape(e,t,null,n)};function Fa(e){Un.call(this,e);var t=this;this.addRule("element.autoResize",function(n){return t.canResize(n.elements,n.target)})}Fa.$inject=["eventBus"],se(Fa,Un),Fa.prototype.canResize=function(e,t){return!1};function iu(e,t){Fa.call(this,e),this._modeling=t}se(iu,Fa),iu.$inject=["eventBus","modeling"],iu.prototype.canResize=function(e,t){if(v(t.di,"bpmndi:BPMNPlane")||!v(t,"bpmn:Participant")&&!v(t,"bpmn:Lane")&&!v(t,"bpmn:SubProcess"))return!1;var n=!0;return k(e,function(i){if(v(i,"bpmn:Lane")||$e(i)){n=!1;return}}),n};const g2={__init__:["bpmnAutoResize","bpmnAutoResizeProvider"],bpmnAutoResize:["type",nu],bpmnAutoResizeProvider:["type",iu]};function jo(e,t,n){this._canvas=n,this._opts=N({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()})}jo.$inject=["config.autoScroll","eventBus","canvas"],jo.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++)y2(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 y2(e,t,n){return t<e&&e<n}jo.prototype.stopScroll=function(){clearTimeout(this._scrolling)},jo.prototype.setOptions=function(e){this._opts=N({},this._opts,e)},jo.prototype._toBorderPoint=function(e){var t=this._canvas._container.getBoundingClientRect(),n=$r(e.originalEvent);return{x:n.x-t.left,y:n.y-t.top}};const v2={__depends__:[Bi],__init__:["autoScroll"],autoScroll:["type",jo]};var D_="djs-bendpoint",L_="djs-segment-dragger";function _2(e,t){var n=$r(t),i=e._container.getBoundingClientRect(),r;r={x:i.left,y:i.top};var o=e.viewbox();return{x:o.x+(n.x-r.x)/o.scale,y:o.y+(n.y-r.y)/o.scale}}function _f(e,t,n){var i=_2(e,n),r=Bl(t,i);return r}function bf(e,t){var n=ye("g");We(n).add(D_),De(e,n);var i=ye("circle");ce(i,{cx:0,cy:0,r:4}),We(i).add("djs-visual"),De(n,i);var r=ye("circle");return ce(r,{cx:0,cy:0,r:10}),We(r).add("djs-hit"),De(n,r),t&&We(n).add(t),n}function b2(e,t,n,i){var r=ye("g");De(e,r);var o=18,a=6,s=11,c=w2(t,n,i),u=a+s,l=ye("rect");ce(l,{x:-o/2,y:-a/2,width:o,height:a}),We(l).add("djs-visual"),De(r,l);var f=ye("rect");return ce(f,{x:-c/2,y:-u/2,width:c,height:u}),We(f).add("djs-hit"),De(r,f),sm(r,i==="v"?90:0),r}function I_(e,t,n){var i=ye("g"),r=fl(t,n),o=ki(t,n);return De(e,i),b2(i,t,n,o),We(i).add(L_),We(i).add(o==="h"?"horizontal":"vertical"),tn(i,r.x,r.y),i}function xf(e){return Math.abs(Math.round(e*2/3))}function x2(e,t){var n=E2(e,t);return Gl(e,n)}function w2(e,t,n){var i=t.x-e.x,r=t.y-e.y;return xf(n==="h"?i:r)}function E2(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=qm(e,[a,s]);c<i&&(i=c,r=o)}return[n[r],n[r+1]]}function N_(e,t,n,i,r){function o(x,w,C){var T=x.index,B=x.point,M,z,G,$,V,he;return T<=0||x.bendpoint?!1:(M=w[T-1],z=w[T],G=fl(M,z),$=ki(M,z),V=Math.abs(B.x-G.x),he=Math.abs(B.y-G.y),$&&V<=C&&he<=C)}function a(x,w){var C=x.waypoints,T,B,M,z;return w.index<=0||w.bendpoint||(T={start:C[w.index-1],end:C[w.index]},B=ki(T.start,T.end),!B)?null:(B==="h"?M=T.end.x-T.start.x:M=T.end.y-T.start.y,z=xf(M)/2,z)}function s(x,w){var C=w.waypoints,T=_f(t,C,x),B;if(T){B=a(w,T);var M;if(o(T,C,B)?M=r.start(x,w,T.index):M=i.start(x,w,T.index,!T.bendpoint),M!==!1)return!0}}function c(x,w,C){Oe.bind(x,w,function(T){n.triggerMouseEvent(w,T,C),T.stopPropagation()})}function u(x,w){var C=t.getLayer("overlays"),T=st('.djs-bendpoints[data-element-id="'+La(x.id)+'"]',C);return!T&&w&&(T=ye("g"),ce(T,{"data-element-id":x.id}),We(T).add("djs-bendpoints"),De(C,T),c(T,"mousedown",x),c(T,"click",x),c(T,"dblclick",x)),T}function l(x,w){return st('.djs-segment-dragger[data-segment-idx="'+x+'"]',w)}function f(x,w){w.waypoints.forEach(function(C,T){var B=bf(x);De(x,B),tn(B,C.x,C.y)}),bf(x,"floating")}function p(x,w){for(var C=w.waypoints,T,B,M,z=1;z<C.length;z++)T=C[z-1],B=C[z],ki(T,B)&&(M=I_(x,T,B),ce(M,{"data-segment-idx":z}),c(M,"mousemove",w))}function d(x){k(bs("."+D_,x),function(w){zt(w)})}function h(x){k(bs("."+L_,x),function(w){zt(w)})}function m(x){var w=u(x);return w||(w=u(x,!0),f(w,x),p(w,x)),w}function g(x){var w=u(x);w&&(h(w),d(w),p(w,x),f(w,x))}function S(x,w){var C=st(".floating",x),T=w.point;C&&(tn(C,T.x,T.y),We(C).add("positioned"))}function E(x,w,C){var T=l(w.index,x),B=C[w.index-1],M=C[w.index],z=w.point,G=fl(B,M),$=ki(B,M),V,he;T&&(V=S2(T),he={x:z.x-G.x,y:z.y-G.y},$==="v"&&(he={x:he.y,y:he.x}),tn(V,he.x,he.y))}e.on("connection.changed",function(x){g(x.element)}),e.on("connection.remove",function(x){var w=u(x.element);w&&zt(w)}),e.on("element.marker.update",function(x){var w=x.element,C;w.waypoints&&(C=m(w),x.add?We(C).add(x.marker):We(C).remove(x.marker))}),e.on("element.mousemove",function(x){var w=x.element,C=w.waypoints,T,B;if(C){if(T=u(w,!0),B=_f(t,C,x.originalEvent),!B)return;S(T,B),B.bendpoint||E(T,B,C)}}),e.on("element.mousedown",function(x){if(ur(x)){var w=x.originalEvent,C=x.element;if(C.waypoints)return s(w,C)}}),e.on("selection.changed",function(x){var w=x.newSelection,C=w[0];C&&C.waypoints&&m(C)}),e.on("element.hover",function(x){var w=x.element;w.waypoints&&m(w)}),e.on("element.out",function(x){var w=x.element;if(w.waypoints){var C=u(w);if(C){var T=st(".floating",C);T&&We(T).remove("positioned")}}}),e.on("element.updateId",function(x){var w=x.element,C=x.newId;if(w.waypoints){var T=u(w);T&&ce(T,{"data-element-id":C})}}),this.addHandles=m,this.updateHandles=g,this.getBendpointsContainer=u,this.getSegmentDragger=l}N_.$inject=["eventBus","canvas","interactionEvents","bendpointMove","connectionSegmentMove"];function S2(e){return st(".djs-visual",e)}var B_=Math.round,Ur="reconnectStart",qr="reconnectEnd",Ha="updateWaypoints";function wf(e,t,n,i,r,o){this._injector=e,this.start=function(a,s,c,u){var l=n.getGraphics(s),f=s.source,p=s.target,d=s.waypoints,h;!u&&c===0?h=Ur:!u&&c===d.length-1?h=qr:h=Ha;var m=h===Ha?"connection.updateWaypoints":"connection.reconnect",g=r.allowed(m,{connection:s,source:f,target:p});if(g===!1&&(g=r.allowed(m,{connection:s,source:p,target:f})),g!==!1)return i.init(a,"bendpoint.move",{data:{connection:s,connectionGfx:l,context:{allowed:g,bendpointIndex:c,connection:s,source:f,target:p,insert:u,type:h}}})},t.on("bendpoint.move.hover",function(a){var s=a.context,c=s.connection,u=c.source,l=c.target,f=a.hover,p=s.type;s.hover=f;var d;if(f){var h=p===Ha?"connection.updateWaypoints":"connection.reconnect";if(d=s.allowed=r.allowed(h,{connection:c,source:p===Ur?f:u,target:p===qr?f:l}),d){s.source=p===Ur?f:u,s.target=p===qr?f:l;return}d===!1&&(d=s.allowed=r.allowed(h,{connection:c,source:p===qr?f:l,target:p===Ur?f:u})),d&&(s.source=p===qr?f:l,s.target=p===Ur?f:u)}}),t.on(["bendpoint.move.out","bendpoint.move.cleanup"],function(a){var s=a.context,c=s.type;s.hover=null,s.source=null,s.target=null,c!==Ha&&(s.allowed=!1)}),t.on("bendpoint.move.end",function(a){var s=a.context,c=s.allowed,u=s.bendpointIndex,l=s.connection,f=s.insert,p=l.waypoints.slice(),d=s.source,h=s.target,m=s.type,g=s.hints||{},S={x:B_(a.x),y:B_(a.y)};if(!c)return!1;m===Ha?(f?p.splice(u,0,S):p[u]=S,g.bendpointMove={insert:f,bendpointIndex:u},p=this.cropWaypoints(l,p),o.updateWaypoints(l,H1(p),g)):(m===Ur?(g.docking="source",ru(s)&&(g.docking="target",g.newWaypoints=p.reverse())):m===qr&&(g.docking="target",ru(s)&&(g.docking="source",g.newWaypoints=p.reverse())),o.reconnect(l,d,h,S,g))},this)}wf.$inject=["injector","eventBus","canvas","dragging","rules","modeling"],wf.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 ru(e){var t=e.hover,n=e.source,i=e.target,r=e.type;if(r===Ur)return t&&i&&t===i&&n!==i;if(r===qr)return t&&n&&t===n&&n!==i}var R2="reconnectStart",C2="reconnectEnd",$_="updateWaypoints",za="connect-ok",ou="connect-not-ok",j_="connect-hover",F_="djs-updating",H_="djs-dragging",z_=1100;function G_(e,t,n,i){this._injector=t;var r=t.get("connectionPreview",!1);n.on("bendpoint.move.start",function(o){var a=o.context,s=a.bendpointIndex,c=a.connection,u=a.insert,l=c.waypoints,f=l.slice();a.waypoints=l,u&&f.splice(s,0,{x:o.x,y:o.y}),c.waypoints=f;var p=a.draggerGfx=bf(i.getLayer("overlays"));We(p).add("djs-dragging"),i.addMarker(c,H_),i.addMarker(c,F_)}),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,j_),u===$_)return;s?(i.removeMarker(c,ou),i.addMarker(c,za)):s===!1&&(i.removeMarker(c,za),i.addMarker(c,ou))}}),n.on(["bendpoint.move.out","bendpoint.move.cleanup"],z_,function(o){var a=o.context,s=a.hover,c=a.target;s&&(i.removeMarker(s,j_),i.removeMarker(s,c?za:ou))}),n.on("bendpoint.move.move",function(o){var a=o.context,s=a.allowed,c=a.bendpointIndex,u=a.draggerGfx,l=a.hover,f=a.type,p=a.connection,d=p.source,h=p.target,m=p.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),f===R2?ru(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):f===C2?ru(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),f===$_&&(m=e.cropWaypoints(p,m)),E.waypoints=m,r.drawPreview(a,s,E)),tn(u,o.x,o.y)},this),n.on(["bendpoint.move.end","bendpoint.move.cancel"],z_,function(o){var a=o.context,s=a.connection,c=a.draggerGfx,u=a.hover,l=a.target,f=a.waypoints;s.waypoints=f,zt(c),i.removeMarker(s,F_),i.removeMarker(s,H_),u&&(i.removeMarker(u,za),i.removeMarker(u,l?za:ou)),r&&r.cleanUp(a)})}G_.$inject=["bendpointMove","injector","eventBus","canvas"];var V_="connect-hover",W_="djs-updating";function U_(e,t,n){return Ef(e,t,e[t]+n)}function Ef(e,t,n){return{x:t==="x"?n:e.x,y:t==="y"?n:e.y}}function P2(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 Ef(t,i,s)}function q_(e){return e==="x"?"y":"x"}function Y_(e,t,n){var i,r;return e.original?e.original:(i=Pe(t),r=q_(n),Ef(e,r,i[r]))}function K_(e,t,n,i,r,o){var a=e.get("connectionDocking",!1);this.start=function(f,p,d){var h,m=n.getGraphics(p),g=d-1,S=d,E=p.waypoints,x=E[g],w=E[S],C=_f(n,E,f),T,B,M;if(T=ki(x,w),!!T)return B=T==="v"?"x":"y",g===0&&(x=Y_(x,p.source,B)),S===E.length-1&&(w=Y_(w,p.target,B)),C?M=C.point:M={x:(x.x+w.x)/2,y:(x.y+w.y)/2},h={connection:p,segmentStartIndex:g,segmentEndIndex:S,segmentStart:x,segmentEnd:w,axis:B,dragPosition:M},i.init(f,M,"connectionSegment.move",{cursor:B==="x"?"resize-ew":"resize-ns",data:{connection:p,connectionGfx:m,context:h}})};function s(f,p){if(!a)return p;var d=f.waypoints,h;return f.waypoints=p,h=a.getCroppedWaypoints(f),f.waypoints=d,h}function c(f){r.update("connection",f.connection,f.connectionGfx)}function u(f,p,d){var h=f.newWaypoints,m=f.segmentStartIndex+p,g=h[m],S=f.segmentEndIndex+p,E=h[S],x=q_(f.axis),w=P2(d,g,E,x);tn(f.draggerGfx,w.x,w.y)}function l(f,p){var d=0,h=f.filter(function(m,g){return pl(f[g-1],f[g+1],m)?(d=g<=p?d-1:d,!1):!0});return{waypoints:h,segmentOffset:d}}t.on("connectionSegment.move.start",function(f){var p=f.context,d=f.connection,h=n.getLayer("overlays");p.originalWaypoints=d.waypoints.slice(),p.draggerGfx=I_(h,p.segmentStart,p.segmentEnd),We(p.draggerGfx).add("djs-dragging"),n.addMarker(d,W_)}),t.on("connectionSegment.move.move",function(f){var p=f.context,d=p.connection,h=p.segmentStartIndex,m=p.segmentEndIndex,g=p.segmentStart,S=p.segmentEnd,E=p.axis,x=p.originalWaypoints.slice(),w=U_(g,E,f["d"+E]),C=U_(S,E,f["d"+E]),T=x.length,B=0;x[h]=w,x[m]=C;var M,z;h<2&&(M=en(d.source,w),h===1?M==="intersect"&&(x.shift(),x[0]=w,B--):M!=="intersect"&&(x.unshift(g),B++)),m>T-3&&(z=en(d.target,C),m===T-2?z==="intersect"&&(x.pop(),x[x.length-1]=C):z!=="intersect"&&x.push(S)),p.newWaypoints=d.waypoints=s(d,x),u(p,B,f),p.newSegmentStartIndex=h+B,c(f)}),t.on("connectionSegment.move.hover",function(f){f.context.hover=f.hover,n.addMarker(f.hover,V_)}),t.on(["connectionSegment.move.out","connectionSegment.move.cleanup"],function(f){var p=f.context.hover;p&&n.removeMarker(p,V_)}),t.on("connectionSegment.move.cleanup",function(f){var p=f.context,d=p.connection;p.draggerGfx&&zt(p.draggerGfx),n.removeMarker(d,W_)}),t.on(["connectionSegment.move.cancel","connectionSegment.move.end"],function(f){var p=f.context,d=p.connection;d.waypoints=p.originalWaypoints,c(f)}),t.on("connectionSegment.move.end",function(f){var p=f.context,d=p.connection,h=p.newWaypoints,m=p.newSegmentStartIndex;h=h.map(function(C){return{original:C.original,x:Math.round(C.x),y:Math.round(C.y)}});var g=l(h,m),S=g.waypoints,E=s(d,S),x=g.segmentOffset,w={segmentMove:{segmentStartIndex:p.segmentStartIndex,newSegmentStartIndex:m+x}};o.updateWaypoints(d,E,w)})}K_.$inject=["injector","eventBus","canvas","dragging","graphicsFactory","modeling"];var A2=Math.abs,X_=Math.round;function T2(e,t,n){n=n===void 0?10:n;var i,r;for(i=0;i<t.length;i++)if(r=t[i],A2(r-e)<=n)return r}function Z_(e){return{x:e.x,y:e.y}}function Q_(e){return{x:e.x+e.width,y:e.y+e.height}}function Xn(e,t){return!e||isNaN(e.x)||isNaN(e.y)?t:{x:X_(e.x+e.width/2),y:X_(e.y+e.height/2)}}function Fo(e,t){var n=e.snapped;return n?typeof t=="string"?n[t]:n.x&&n.y:!1}function $t(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 J_(e){return e.children||[]}var M2=Math.abs,eb=Math.round,Sf=10;function tb(e){function t(o,a){if(Ce(o)){for(var s=o.length;s--;)if(M2(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 x2(a,o);if(o.width)return{x:eb(o.width/2+o.x),y:eb(o.height/2+o.y)}}function i(o){var a=o.context,s=a.snapPoints,c=a.connection,u=c.waypoints,l=a.segmentStart,f=a.segmentStartIndex,p=a.segmentEnd,d=a.segmentEndIndex,h=a.axis;if(s)return s;var m=[u[f-1],l,p,u[d+1]];return f<2&&m.unshift(n(c.source,o)),d>u.length-3&&m.unshift(n(c.target,o)),a.snapPoints=s={horizontal:[],vertical:[]},k(m,function(g){g&&(g=g.original||g,h==="y"&&s.horizontal.push(g.y),h==="x"&&s.vertical.push(g.x))}),s}e.on("connectionSegment.move.move",1500,function(o){var a=i(o),s=o.x,c=o.y,u,l;if(a){u=t(a.vertical,s),l=t(a.horizontal,c);var f=s-u,p=c-l;N(o,{dx:o.dx-f,dy:o.dy-p,x:u,y:l}),(f||a.vertical.indexOf(s)!==-1)&&$t(o,"x",u),(p||a.horizontal.indexOf(c)!==-1)&&$t(o,"y",l)}});function r(o){var a=o.snapPoints,s=o.connection.waypoints,c=o.bendpointIndex;if(a)return a;var u=[s[c-1],s[c+1]];return o.snapPoints=a={horizontal:[],vertical:[]},k(u,function(l){l&&(l=l.original||l,a.horizontal.push(l.y),a.vertical.push(l.x))}),a}e.on(["connect.hover","connect.move","connect.end"],1500,function(o){var a=o.context,s=a.hover,c=s&&n(s,o);!ut(s)||!c||!c.x||!c.y||($t(o,"x",c.x),$t(o,"y",c.y))}),e.on(["bendpoint.move.move","bendpoint.move.end"],1500,function(o){var a=o.context,s=r(a),c=a.hover,u=c&&n(c,o),l=o.x,f=o.y,p,d;if(s){p=t(u?s.vertical.concat([u.x]):s.vertical,l),d=t(u?s.horizontal.concat([u.y]):s.horizontal,f);var h=l-p,m=f-d;N(o,{dx:o.dx-h,dy:o.dy-m,x:o.x-h,y:o.y-m}),(h||s.vertical.indexOf(l)!==-1)&&$t(o,"x",p),(m||s.horizontal.indexOf(f)!==-1)&&$t(o,"y",d)}})}tb.$inject=["eventBus"];const k2={__depends__:[Bi,vi],__init__:["bendpoints","bendpointSnapping","bendpointMovePreview"],bendpoints:["type",N_],bendpointMove:["type",wf],bendpointMovePreview:["type",G_],connectionSegmentMove:["type",K_],bendpointSnapping:["type",tb]};function nb(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),!to(l)){if(l!==!1){s.source=c,s.target=u;return}l=s.canExecute=o(c,u),!to(l)&&l!==!1&&(s.source=u,s.target=c)}}),e.on(["connect.out","connect.cleanup"],function(a){var s=a.context;s.hover=null,s.source=null,s.target=null,s.canExecute=!1}),e.on("connect.end",function(a){var s=a.context,c=s.canExecute,u=s.connectionStart,l={x:a.x,y:a.y},f=s.source,p=s.target;if(!c)return!1;var d=null,h={connectionStart:Rf(s)?l:u,connectionEnd:Rf(s)?u:l};Ut(c)&&(d=c),s.connection=n.connect(f,p,d,h)}),this.start=function(a,s,c,u){Ut(c)||(u=c,c=Pe(s)),t.init(a,"connect",{autoActivate:u,data:{shape:s,context:{start:s,connectionStart:c}}})}}nb.$inject=["eventBus","dragging","modeling","rules"];function Rf(e){var t=e.hover,n=e.source,i=e.target;return t&&n&&t===n&&n!==i}var O2=1100,D2=900,ib="connect-ok",rb="connect-not-ok";function ob(e,t,n){var i=e.get("connectionPreview",!1);i&&t.on("connect.move",function(r){var o=r.context,a=o.canExecute,s=o.hover,c=o.source,u=o.start,l=o.startPosition,f=o.target,p=o.connectionStart||l,d=o.connectionEnd||{x:r.x,y:r.y},h=p,m=d;Rf(o)&&(h=d,m=p),i.drawPreview(o,a,{source:c||u,target:f||s,connectionStart:h,connectionEnd:m})}),t.on("connect.hover",D2,function(r){var o=r.context,a=r.hover,s=o.canExecute;s!==null&&n.addMarker(a,s?ib:rb)}),t.on(["connect.out","connect.cleanup"],O2,function(r){var o=r.hover;o&&(n.removeMarker(o,ib),n.removeMarker(o,rb))}),i&&t.on("connect.cleanup",function(r){i.cleanUp(r.context)})}ob.$inject=["injector","eventBus","canvas"];const Cf={__depends__:[qn,vi,Bi],__init__:["connectPreview"],connect:["type",nb],connectPreview:["type",ob]};var L2="djs-dragger";function Vi(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)}Vi.$inject=["injector","canvas","graphicsFactory","elementFactory"],Vi.prototype.drawPreview=function(e,t,n){n=n||{};var i=e.connectionPreviewGfx,r=e.getConnection,o=n.source,a=n.target,s=n.waypoints,c=n.connectionStart,u=n.connectionEnd,l=n.noLayout,f=n.noCropping,p=n.noNoop,d,h=this;if(i||(i=e.connectionPreviewGfx=this.createConnectionPreviewGfx()),xs(i),r||(r=e.getConnection=I2(function(m,g,S){return h.getConnection(m,g,S)})),t&&(d=r(t,o,a)),!d){!p&&this.drawNoopPreview(i,n);return}d.waypoints=s||[],this._layouter&&!l&&(d.waypoints=this._layouter.layoutConnection(d,{source:o,target:a,connectionStart:c,connectionEnd:u,waypoints:n.waypoints||d.waypoints})),(!d.waypoints||!d.waypoints.length)&&(d.waypoints=[o?Pe(o):c,a?Pe(a):u]),this._connectionDocking&&(o||a)&&!f&&(d.waypoints=this._connectionDocking.getCroppedWaypoints(d,o,a)),this._graphicsFactory.drawConnection(i,d,{stroke:"var(--element-dragger-color)"})},Vi.prototype.drawNoopPreview=function(e,t){var n=t.source,i=t.target,r=t.connectionStart||Pe(n),o=t.connectionEnd||Pe(i),a=this.cropWaypoints(r,o,n,i),s=this.createNoopConnection(a[0],a[1]);De(e,s)},Vi.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&&na(o,s,!0)||e,t=i&&na(a,s,!1)||t,[e,t]},Vi.prototype.cleanUp=function(e){e&&e.connectionPreviewGfx&&zt(e.connectionPreviewGfx)},Vi.prototype.getConnection=function(e){var t=N2(e);return this._elementFactory.createConnection(t)},Vi.prototype.createConnectionPreviewGfx=function(){var e=ye("g");return ce(e,{pointerEvents:"none"}),We(e).add(L2),De(this._canvas.getActiveLayer(),e),e},Vi.prototype.createNoopConnection=function(e,t){return Qo([e,t],{stroke:"#333",strokeDasharray:[1],strokeWidth:2,"pointer-events":"none"})};function I2(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 N2(e){return Ut(e)?e:{}}const B2={__init__:["connectionPreview"],connectionPreview:["type",Vi]},au="complex-preview";class ab{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(au);n.filter(s=>!$2(s)).forEach(s=>{let c;ut(s)?(c=this._graphicsFactory._createContainer("connection",ye("g")),this._graphicsFactory.drawConnection(Ir(c),s)):(c=this._graphicsFactory._createContainer("shape",ye("g")),this._graphicsFactory.drawShape(Ir(c),s),tn(c,s.x,s.y)),this._previewSupport.addDragger(s,a,c)}),i.forEach(({element:s,delta:c})=>{this._previewSupport.addDragger(s,a,void 0,"djs-dragging"),this._canvas.addMarker(s,"djs-element-hidden"),this._markers.push([s,"djs-element-hidden"]);const u=this._previewSupport.addDragger(s,a);ut(s)?tn(u,c.x,c.y):tn(u,s.x+c.x,s.y+c.y)}),r.forEach(s=>{this._previewSupport.addDragger(s,a,void 0,"djs-dragging"),this._canvas.addMarker(s,"djs-element-hidden"),this._markers.push([s,"djs-element-hidden"])}),o.forEach(({shape:s,bounds:c})=>{this._canvas.addMarker(s,"djs-hidden"),this._markers.push([s,"djs-hidden"]),this._previewSupport.addDragger(s,a,void 0,"djs-dragging");const u=this._graphicsFactory._createContainer("shape",ye("g"));this._graphicsFactory.drawShape(Ir(u),s,{width:c.width,height:c.height}),tn(u,c.x,c.y),this._previewSupport.addDragger(s,a,u)})}cleanUp(){xs(this._canvas.getLayer(au)),this._markers.forEach(([t,n])=>this._canvas.removeMarker(t,n)),this._markers=[]}show(){this._canvas.showLayer(au)}hide(){this._canvas.hideLayer(au)}}ab.$inject=["canvas","graphicsFactory","previewSupport"];function $2(e){return e.hidden}const j2={__depends__:[Mo],__init__:["complexPreview"],complexPreview:["type",ab]},sb=Math.round;function su(e,t,n,i,r,o){this._complexPreview=e,this._connectionDocking=t,this._elementFactory=n,this._eventBus=i,this._layouter=r,this._rules=o}su.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(N({type:t},n)),l=a.fire("autoPlace",{source:e,shape:u});if(!l)return;N(u,{x:l.x-sb(u.width/2),y:l.y-sb(u.height/2)});const f=c.allowed("connection.create",{source:e,target:u,hints:{targetParent:e.parent}});let p=null;f&&(p=o.createConnection(f),p.waypoints=s.layoutConnection(p,{source:e,target:u}),p.waypoints=r.getCroppedWaypoints(p,e,u)),i.create({created:[u,p].filter(d=>!to(d))})},su.prototype.cleanUp=function(){this._complexPreview.cleanUp()},su.$inject=["complexPreview","connectionDocking","elementFactory","eventBus","layouter","rules"];const F2={__depends__:[Lc,j2,Zp],__init__:["appendPreview"],appendPreview:["type",su]};var cb=Math.min,ub=Math.max;function Pf(e){e.preventDefault()}function Ga(e){e.stopPropagation()}function H2(e){return e.nodeType===Node.TEXT_NODE}function z2(e){return[].slice.call(e)}function oi(e){this.container=e.container,this.parent=mt('<div class="djs-direct-editing-parent"><div class="djs-direct-editing-content" contenteditable="true"></div></div>'),this.content=st("[contenteditable]",this.parent),this.keyHandler=e.keyHandler||function(){},this.resizeHandler=e.resizeHandler||function(){},this.focusoutHandler=e.focusoutHandler||function(){},this.autoResize=bn(this.autoResize,this),this.handlePaste=bn(this.handlePaste,this)}oi.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=ii(t,["width","height","maxWidth","maxHeight","minWidth","minHeight","left","top","backgroundColor","position","overflow","border","wordWrap","textAlign","outline","transform"]);N(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=ii(t,["fontFamily","fontSize","fontWeight","lineHeight","padding","paddingTop","paddingRight","paddingBottom","paddingLeft"]);return N(a.style,{boxSizing:"border-box",width:"100%",outline:"none",wordWrap:"break-word"},u),i.centerVertically&&N(a.style,{position:"absolute",top:"50%",transform:"translate(0, -50%)"},u),a.innerText=n,Oe.bind(a,"keydown",this.keyHandler),Oe.bind(a,"mousedown",Ga),Oe.bind(a,"paste",r.handlePaste),Oe.bind(a,"focusout",this.focusoutHandler),i.autoResize&&Oe.bind(a,"input",this.autoResize),i.resizable&&this.resizable(t),s.appendChild(o),this.setSelection(a.lastChild,a.lastChild&&a.lastChild.length),o},oi.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)}},oi.prototype.insertText=function(e){e=G2(e);var t=document.execCommand("insertText",!1,e);t||this._insertTextIE(e)},oi.prototype._insertTextIE=function(e){var t=this.getSelection(),n=t.startContainer,i=t.endContainer,r=t.startOffset,o=t.endOffset,a=t.commonAncestorContainer,s=z2(a.childNodes),c,u;if(H2(a)){var l=n.textContent;n.textContent=l.substring(0,r)+e+l.substring(o),c=n,u=r+e.length}else if(n===this.content&&i===this.content){var f=document.createTextNode(e);this.content.insertBefore(f,s[r]),c=f,u=f.textContent.length}else{var p=s.indexOf(n),d=s.indexOf(i);s.forEach(function(h,m){m===p?h.textContent=n.textContent.substring(0,r)+e+i.textContent.substring(o):m>p&&m<=d&&fi(h)}),c=n,u=r+e.length}c&&u!==void 0&&setTimeout(function(){self.setSelection(c,u)})},oi.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})}},oi.prototype.resizable=function(){var e=this,t=this.parent,n=this.resizeHandle,i=parseInt(this.style.minWidth)||0,r=parseInt(this.style.minHeight)||0,o=parseInt(this.style.maxWidth)||1/0,a=parseInt(this.style.maxHeight)||1/0;if(!n){n=this.resizeHandle=mt('<div class="djs-direct-editing-resize-handle"></div>');var s,c,u,l,f=function(h){Pf(h),Ga(h),s=h.clientX,c=h.clientY;var m=t.getBoundingClientRect();u=m.width,l=m.height,Oe.bind(document,"mousemove",p),Oe.bind(document,"mouseup",d)},p=function(h){Pf(h),Ga(h);var m=cb(ub(u+h.clientX-s,i),o),g=cb(ub(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){Pf(h),Ga(h),Oe.unbind(document,"mousemove",p,!1),Oe.unbind(document,"mouseup",d,!1)};Oe.bind(n,"mousedown",f)}N(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)},oi.prototype.destroy=function(){var e=this.parent,t=this.content,n=this.resizeHandle;t.innerText="",e.removeAttribute("style"),t.removeAttribute("style"),Oe.unbind(t,"keydown",this.keyHandler),Oe.unbind(t,"mousedown",Ga),Oe.unbind(t,"input",this.autoResize),Oe.unbind(t,"paste",this.handlePaste),Oe.unbind(t,"focusout",this.focusoutHandler),n&&(n.removeAttribute("style"),fi(n)),fi(e)},oi.prototype.getValue=function(){return this.content.innerText.trim()},oi.prototype.getSelection=function(){var e=window.getSelection(),t=e.getRangeAt(0);return t},oi.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 G2(e){return e.replace(/\r\n|\r|\n/g,`
|
|
316
|
-
`)}function Ln(e,t){this._eventBus=e,this._canvas=t,this._providers=[],this._textbox=new oi({container:t.getContainer(),keyHandler:bn(this._handleKey,this),resizeHandler:bn(this._handleResize,this),focusoutHandler:bn(this._handleFocusout,this)}),e.on(["diagram.clear","diagram.destroy"],()=>this._cleanup())}Ln.$inject=["eventBus","canvas"],Ln.prototype.registerProvider=function(e){this._providers.push(e)},Ln.prototype.isActive=function(e){return!!(this._active&&(!e||this._active.element===e))},Ln.prototype.cancel=function(){this._active&&(this._fire("cancel"),this.close())},Ln.prototype._fire=function(e,t){this._eventBus.fire("directEditing."+e,t||{active:this._active})},Ln.prototype.close=function(){this._fire("deactivate"),this._cleanup(),this._canvas.restoreFocus&&this._canvas.restoreFocus()},Ln.prototype._cleanup=function(){this._active&&(this._textbox.destroy(),this._active=null,this.resizable=void 0)},Ln.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()}},Ln.prototype.getValue=function(){return this._textbox.getValue()},Ln.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()},Ln.prototype._handleResize=function(e){this._fire("resize",e)},Ln.prototype._handleFocusout=function(e){e.relatedTarget&&this._textbox.parent.contains(e.relatedTarget)||this.complete()},Ln.prototype.activate=function(e){if(this.isActive()&&this.cancel(),this._eventBus.fire("directEditing.activate.allowed",{element:e})===!1)return!1;var t,n=ft(this._providers,function(i){return(t=i.activate(e))?i:null});return t&&(this.$textbox=this._textbox.create(t.bounds,t.style,t.text,t.options),this._active={element:e,context:t,provider:n},t.options&&t.options.resizable&&(this.resizable=!0),this._fire("activate")),!!t};const lb={__depends__:[lc],__init__:["directEditing"],directEditing:["type",Ln]};function V2(e){return function(t){var n=t.target,i=ee(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===Ve(e);return!o||!a||!s||!c}}const W2={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 Z(e,t={}){var n=W2[e];if(!n)throw new Error("unknown popup entry <"+e+">");return{...n,actionName:"replace-with-"+e,...t}}var U2=[Z("none-start-event",{actionName:"replace-with-none-start"}),Z("none-intermediate-throwing"),Z("none-end-event",{actionName:"replace-with-none-end"}),Z("message-start"),Z("timer-start"),Z("conditional-start"),Z("signal-start")],q2=[Z("none-start-event",{actionName:"replace-with-none-start"}),Z("none-intermediate-throwing"),Z("none-end-event",{actionName:"replace-with-none-end"})],Y2=[Z("none-start-event",{actionName:"replace-with-none-start"}),Z("none-intermediate-throwing",{actionName:"replace-with-none-intermediate-throw"}),Z("none-end-event",{actionName:"replace-with-none-end"}),Z("message-intermediate-catch"),Z("message-intermediate-throw"),Z("timer-intermediate-catch"),Z("escalation-intermediate-throw"),Z("conditional-intermediate-catch"),Z("link-intermediate-catch"),Z("link-intermediate-throw"),Z("compensation-intermediate-throw"),Z("signal-intermediate-catch"),Z("signal-intermediate-throw")],K2=[Z("none-start-event",{actionName:"replace-with-none-start"}),Z("none-intermediate-throwing",{actionName:"replace-with-none-intermediate-throw"}),Z("none-end-event",{actionName:"replace-with-none-end"}),Z("message-end"),Z("escalation-end"),Z("error-end"),Z("cancel-end"),Z("compensation-end"),Z("signal-end"),Z("terminate-end")],X2=[Z("exclusive-gateway"),Z("parallel-gateway"),Z("inclusive-gateway"),Z("complex-gateway"),Z("event-based-gateway")],Z2=[Z("transaction"),Z("event-subprocess"),Z("expanded-ad-hoc-subprocess",{actionName:"replace-with-ad-hoc-subprocess",label:"Ad-hoc sub-process"}),Z("collapsed-subprocess")],Q2=[Z("expanded-subprocess",{actionName:"replace-with-subprocess",label:"Sub-process"}),Z("transaction"),Z("event-subprocess"),Z("collapsed-ad-hoc-subprocess")],pb=[Z("transaction"),Z("expanded-subprocess",{actionName:"replace-with-subprocess",label:"Sub-process"}),Z("expanded-ad-hoc-subprocess",{actionName:"replace-with-ad-hoc-subprocess",label:"Ad-hoc sub-process"}),Z("event-subprocess")],J2=pb,fb=[Z("task"),Z("user-task"),Z("service-task"),Z("send-task"),Z("receive-task"),Z("manual-task"),Z("rule-task"),Z("script-task"),Z("call-activity"),Z("collapsed-subprocess"),Z("expanded-subprocess"),Z("collapsed-ad-hoc-subprocess"),Z("expanded-ad-hoc-subprocess",{actionName:"replace-with-ad-hoc-subprocess"})],ek=[Z("data-store-reference")],tk=[Z("data-object-reference")],nk=[Z("message-boundary"),Z("timer-boundary"),Z("escalation-boundary"),Z("conditional-boundary"),Z("error-boundary"),Z("cancel-boundary"),Z("signal-boundary"),Z("compensation-boundary"),Z("non-interrupting-message-boundary"),Z("non-interrupting-timer-boundary"),Z("non-interrupting-escalation-boundary"),Z("non-interrupting-conditional-boundary"),Z("non-interrupting-signal-boundary")],ik=[Z("message-start"),Z("timer-start"),Z("conditional-start"),Z("signal-start"),Z("error-start"),Z("escalation-start"),Z("compensation-start"),Z("non-interrupting-message-start"),Z("non-interrupting-timer-start"),Z("non-interrupting-conditional-start"),Z("non-interrupting-signal-start"),Z("non-interrupting-escalation-start")],rk=[{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"}],ok=[Z("expanded-pool"),Z("collapsed-pool",{label:function(e){var t="Empty pool/participant";return e.children&&e.children.length&&(t+=" (removes content)"),t}})],ak={"bpmn:MessageEventDefinition":[Z("message-start"),Z("message-intermediate-catch"),Z("message-intermediate-throw"),Z("message-end")],"bpmn:TimerEventDefinition":[Z("timer-start"),Z("timer-intermediate-catch")],"bpmn:ConditionalEventDefinition":[Z("conditional-start"),Z("conditional-intermediate-catch")],"bpmn:SignalEventDefinition":[Z("signal-start"),Z("signal-intermediate-catch"),Z("signal-intermediate-throw"),Z("signal-end")],"bpmn:ErrorEventDefinition":[Z("error-start"),Z("error-end")],"bpmn:EscalationEventDefinition":[Z("escalation-start"),Z("escalation-intermediate-throw"),Z("escalation-end")],"bpmn:CompensateEventDefinition":[Z("compensation-start"),Z("compensation-intermediate-throw"),Z("compensation-end")]};const db={"start-event-non-interrupting":`
|
|
315
|
+
</svg>`},m2=900;function $o(e,t,n,i){e.registerProvider(m2,this),this._contextPad=e,this._popupMenu=t,this._translate=n,this._canvas=i}$o.$inject=["contextPad","popupMenu","translate","canvas"],$o.prototype.getMultiElementContextPadEntries=function(e){var t={};return this._isAllowed(e)&&j(t,this._getEntries(e)),t},$o.prototype._isAllowed=function(e){return!this._popupMenu.isEmpty(e,"align-elements")},$o.prototype._getEntries=function(){var e=this;return{"align-elements":{group:"align-elements",title:e._translate("Align elements"),html:`<div class="entry">${I_.align}</div>`,action:{click:function(t,n){var i=e._getMenuPosition(n);j(i,{cursor:{x:t.x,y:t.y}}),e._popupMenu.open(n,"align-elements",i)}}}}},$o.prototype._getMenuPosition=function(e){var t=5,n=this._contextPad.getPad(e).html,i=n.getBoundingClientRect(),r={x:i.left,y:i.bottom+t};return r};var g2=["left","center","right","top","middle","bottom"];function ja(e,t,n,i){this._alignElements=t,this._translate=n,this._popupMenu=e,this._rules=i,e.registerProvider("align-elements",this)}ja.$inject=["popupMenu","alignElements","translate","rules"],ja.prototype.getPopupMenuEntries=function(e){var t={};return this._isAllowed(e)&&j(t,this._getEntries(e)),t},ja.prototype._isAllowed=function(e){return this._rules.allowed("elements.align",{elements:e})},ja.prototype._getEntries=function(e){var t=this._alignElements,n=this._translate,i=this._popupMenu,r={};return D(g2,function(o){r["align-elements-"+o]={group:"align",title:n("Align elements "+o),className:"bjs-align-elements-menu-entry",imageHtml:I_[o],action:function(){t.trigger(e,o),i.close()}}}),r};function nu(e){Un.call(this,e)}nu.$inject=["eventBus"],se(nu,Un),nu.prototype.init=function(){this.addRule("elements.align",function(e){var t=e.elements,n=$e(t,function(i){return!(i.waypoints||i.host||i.labelTarget)});return n=Rs(n),n.length<2?!1:n})};const y2={__depends__:[AM,Uv,bf],__init__:["alignElementsContextPadProvider","alignElementsMenuProvider","bpmnAlignElements"],alignElementsContextPadProvider:["type",$o],alignElementsMenuProvider:["type",ja],bpmnAlignElements:["type",nu]};function Wi(e,t,n,i){Q.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=Tu(no(a.closure.topLevel)),c=a.hints,u=c?c.autoResize:!0;if(u!==!1){var l=io(s,function(f){return f.parent.id});D(l,function(f,p){xe(u)&&(f=f.filter(function(d){return lt(u,ro({id:d.id}))})),r._expand(f,p)})}}),this.postExecuted(["shape.toggleCollapse"],function(o){var a=o.context,s=a.hints,c=a.shape;s&&s.autoResize===!1||c.collapsed||r._expand(c.children||[],c)}),this.postExecuted(["shape.resize"],function(o){var a=o.context,s=a.hints,c=a.shape,u=c.parent;s&&s.autoResize===!1||u&&r._expand([c],u)})}Wi.$inject=["eventBus","elementRegistry","modeling","rules"],se(Wi,Q),Wi.prototype._getOptimalBounds=function(e,t){var n=this.getOffset(t),i=this.getPadding(t),r=ve(Lt(e)),o=ve(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),As(j({},o,a))},Wi.prototype._expand=function(e,t){typeof t=="string"&&(t=this._elementRegistry.get(t));var n=this._rules.allowed("element.autoResize",{elements:e,target:t});if(n){var i=this._getOptimalBounds(e,t);if(v2(i,t)){var r=_2(ii(t,["x","y","width","height"]),i);this.resize(t,i,{autoResize:r});var o=t.parent;o&&this._expand([t],o)}}},Wi.prototype.getOffset=function(e){return{top:60,bottom:60,left:100,right:100}},Wi.prototype.getPadding=function(e){return{top:2,bottom:2,left:15,right:15}},Wi.prototype.resize=function(e,t,n){this._modeling.resizeShape(e,t,null,n)};function v2(e,t){return e.x!==t.x||e.y!==t.y||e.width!==t.width||e.height!==t.height}function _2(e,t){var n="";return e=ve(e),t=ve(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 iu(e){e.invoke(Wi,this)}iu.$inject=["injector"],se(iu,Wi),iu.prototype.resize=function(e,t,n){v(e,"bpmn:Participant")?this._modeling.resizeLane(e,t,null,n):this._modeling.resizeShape(e,t,null,n)};function Fa(e){Un.call(this,e);var t=this;this.addRule("element.autoResize",function(n){return t.canResize(n.elements,n.target)})}Fa.$inject=["eventBus"],se(Fa,Un),Fa.prototype.canResize=function(e,t){return!1};function ru(e,t){Fa.call(this,e),this._modeling=t}se(ru,Fa),ru.$inject=["eventBus","modeling"],ru.prototype.canResize=function(e,t){if(v(t.di,"bpmndi:BPMNPlane")||!v(t,"bpmn:Participant")&&!v(t,"bpmn:Lane")&&!v(t,"bpmn:SubProcess"))return!1;var n=!0;return D(e,function(i){if(v(i,"bpmn:Lane")||Ne(i)){n=!1;return}}),n};const b2={__init__:["bpmnAutoResize","bpmnAutoResizeProvider"],bpmnAutoResize:["type",iu],bpmnAutoResizeProvider:["type",ru]};function jo(e,t,n){this._canvas=n,this._opts=j({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()})}jo.$inject=["config.autoScroll","eventBus","canvas"],jo.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++)x2(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 x2(e,t,n){return t<e&&e<n}jo.prototype.stopScroll=function(){clearTimeout(this._scrolling)},jo.prototype.setOptions=function(e){this._opts=j({},this._opts,e)},jo.prototype._toBorderPoint=function(e){var t=this._canvas._container.getBoundingClientRect(),n=$r(e.originalEvent);return{x:n.x-t.left,y:n.y-t.top}};const w2={__depends__:[ji],__init__:["autoScroll"],autoScroll:["type",jo]};var N_="djs-bendpoint",B_="djs-segment-dragger";function E2(e,t){var n=$r(t),i=e._container.getBoundingClientRect(),r;r={x:i.left,y:i.top};var o=e.viewbox();return{x:o.x+(n.x-r.x)/o.scale,y:o.y+(n.y-r.y)/o.scale}}function xf(e,t,n){var i=E2(e,n),r=jl(t,i);return r}function wf(e,t){var n=ge("g");Ve(n).add(N_),ke(e,n);var i=ge("circle");ce(i,{cx:0,cy:0,r:4}),Ve(i).add("djs-visual"),ke(n,i);var r=ge("circle");return ce(r,{cx:0,cy:0,r:10}),Ve(r).add("djs-hit"),ke(n,r),t&&Ve(n).add(t),n}function S2(e,t,n,i){var r=ge("g");ke(e,r);var o=18,a=6,s=11,c=C2(t,n,i),u=a+s,l=ge("rect");ce(l,{x:-o/2,y:-a/2,width:o,height:a}),Ve(l).add("djs-visual"),ke(r,l);var f=ge("rect");return ce(f,{x:-c/2,y:-u/2,width:c,height:u}),Ve(f).add("djs-hit"),ke(r,f),lm(r,i==="v"?90:0),r}function $_(e,t,n){var i=ge("g"),r=hl(t,n),o=Di(t,n);return ke(e,i),S2(i,t,n,o),Ve(i).add(B_),Ve(i).add(o==="h"?"horizontal":"vertical"),nn(i,r.x,r.y),i}function Ef(e){return Math.abs(Math.round(e*2/3))}function R2(e,t){var n=P2(e,t);return Wl(e,n)}function C2(e,t,n){var i=t.x-e.x,r=t.y-e.y;return Ef(n==="h"?i:r)}function P2(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=Xm(e,[a,s]);c<i&&(i=c,r=o)}return[n[r],n[r+1]]}function j_(e,t,n,i,r){function o(x,w,C){var P=x.index,L=x.point,T,B,k,O,$,ne;return P<=0||x.bendpoint?!1:(T=w[P-1],B=w[P],k=hl(T,B),O=Di(T,B),$=Math.abs(L.x-k.x),ne=Math.abs(L.y-k.y),O&&$<=C&&ne<=C)}function a(x,w){var C=x.waypoints,P,L,T,B;return w.index<=0||w.bendpoint||(P={start:C[w.index-1],end:C[w.index]},L=Di(P.start,P.end),!L)?null:(L==="h"?T=P.end.x-P.start.x:T=P.end.y-P.start.y,B=Ef(T)/2,B)}function s(x,w){var C=w.waypoints,P=xf(t,C,x),L;if(P){L=a(w,P);var T;if(o(P,C,L)?T=r.start(x,w,P.index):T=i.start(x,w,P.index,!P.bendpoint),T!==!1)return!0}}function c(x,w,C){Te.bind(x,w,function(P){n.triggerMouseEvent(w,P,C),P.stopPropagation()})}function u(x,w){var C=t.getLayer("overlays"),P=rt('.djs-bendpoints[data-element-id="'+La(x.id)+'"]',C);return!P&&w&&(P=ge("g"),ce(P,{"data-element-id":x.id}),Ve(P).add("djs-bendpoints"),ke(C,P),c(P,"mousedown",x),c(P,"click",x),c(P,"dblclick",x)),P}function l(x,w){return rt('.djs-segment-dragger[data-segment-idx="'+x+'"]',w)}function f(x,w){w.waypoints.forEach(function(C,P){var L=wf(x);ke(x,L),nn(L,C.x,C.y)}),wf(x,"floating")}function p(x,w){for(var C=w.waypoints,P,L,T,B=1;B<C.length;B++)P=C[B-1],L=C[B],Di(P,L)&&(T=$_(x,P,L),ce(T,{"data-segment-idx":B}),c(T,"mousemove",w))}function d(x){D(xs("."+N_,x),function(w){zt(w)})}function h(x){D(xs("."+B_,x),function(w){zt(w)})}function m(x){var w=u(x);return w||(w=u(x,!0),f(w,x),p(w,x)),w}function g(x){var w=u(x);w&&(h(w),d(w),p(w,x),f(w,x))}function S(x,w){var C=rt(".floating",x),P=w.point;C&&(nn(C,P.x,P.y),Ve(C).add("positioned"))}function E(x,w,C){var P=l(w.index,x),L=C[w.index-1],T=C[w.index],B=w.point,k=hl(L,T),O=Di(L,T),$,ne;P&&($=A2(P),ne={x:B.x-k.x,y:B.y-k.y},O==="v"&&(ne={x:ne.y,y:ne.x}),nn($,ne.x,ne.y))}e.on("connection.changed",function(x){g(x.element)}),e.on("connection.remove",function(x){var w=u(x.element);w&&zt(w)}),e.on("element.marker.update",function(x){var w=x.element,C;w.waypoints&&(C=m(w),x.add?Ve(C).add(x.marker):Ve(C).remove(x.marker))}),e.on("element.mousemove",function(x){var w=x.element,C=w.waypoints,P,L;if(C){if(P=u(w,!0),L=xf(t,C,x.originalEvent),!L)return;S(P,L),L.bendpoint||E(P,L,C)}}),e.on("element.mousedown",function(x){if(ur(x)){var w=x.originalEvent,C=x.element;if(C.waypoints)return s(w,C)}}),e.on("selection.changed",function(x){var w=x.newSelection,C=w[0];C&&C.waypoints&&m(C)}),e.on("element.hover",function(x){var w=x.element;w.waypoints&&m(w)}),e.on("element.out",function(x){var w=x.element;if(w.waypoints){var C=u(w);if(C){var P=rt(".floating",C);P&&Ve(P).remove("positioned")}}}),e.on("element.updateId",function(x){var w=x.element,C=x.newId;if(w.waypoints){var P=u(w);P&&ce(P,{"data-element-id":C})}}),this.addHandles=m,this.updateHandles=g,this.getBendpointsContainer=u,this.getSegmentDragger=l}j_.$inject=["eventBus","canvas","interactionEvents","bendpointMove","connectionSegmentMove"];function A2(e){return rt(".djs-visual",e)}var F_=Math.round,Ur="reconnectStart",qr="reconnectEnd",Ha="updateWaypoints";function Sf(e,t,n,i,r,o){this._injector=e,this.start=function(a,s,c,u){var l=n.getGraphics(s),f=s.source,p=s.target,d=s.waypoints,h;!u&&c===0?h=Ur:!u&&c===d.length-1?h=qr:h=Ha;var m=h===Ha?"connection.updateWaypoints":"connection.reconnect",g=r.allowed(m,{connection:s,source:f,target:p});if(g===!1&&(g=r.allowed(m,{connection:s,source:p,target:f})),g!==!1)return i.init(a,"bendpoint.move",{data:{connection:s,connectionGfx:l,context:{allowed:g,bendpointIndex:c,connection:s,source:f,target:p,insert:u,type:h}}})},t.on("bendpoint.move.hover",function(a){var s=a.context,c=s.connection,u=c.source,l=c.target,f=a.hover,p=s.type;s.hover=f;var d;if(f){var h=p===Ha?"connection.updateWaypoints":"connection.reconnect";if(d=s.allowed=r.allowed(h,{connection:c,source:p===Ur?f:u,target:p===qr?f:l}),d){s.source=p===Ur?f:u,s.target=p===qr?f:l;return}d===!1&&(d=s.allowed=r.allowed(h,{connection:c,source:p===qr?f:l,target:p===Ur?f:u})),d&&(s.source=p===qr?f:l,s.target=p===Ur?f:u)}}),t.on(["bendpoint.move.out","bendpoint.move.cleanup"],function(a){var s=a.context,c=s.type;s.hover=null,s.source=null,s.target=null,c!==Ha&&(s.allowed=!1)}),t.on("bendpoint.move.end",function(a){var s=a.context,c=s.allowed,u=s.bendpointIndex,l=s.connection,f=s.insert,p=l.waypoints.slice(),d=s.source,h=s.target,m=s.type,g=s.hints||{},S={x:F_(a.x),y:F_(a.y)};if(!c)return!1;m===Ha?(f?p.splice(u,0,S):p[u]=S,g.bendpointMove={insert:f,bendpointIndex:u},p=this.cropWaypoints(l,p),o.updateWaypoints(l,W1(p),g)):(m===Ur?(g.docking="source",ou(s)&&(g.docking="target",g.newWaypoints=p.reverse())):m===qr&&(g.docking="target",ou(s)&&(g.docking="source",g.newWaypoints=p.reverse())),o.reconnect(l,d,h,S,g))},this)}Sf.$inject=["injector","eventBus","canvas","dragging","rules","modeling"],Sf.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 ou(e){var t=e.hover,n=e.source,i=e.target,r=e.type;if(r===Ur)return t&&i&&t===i&&n!==i;if(r===qr)return t&&n&&t===n&&n!==i}var T2="reconnectStart",M2="reconnectEnd",H_="updateWaypoints",za="connect-ok",au="connect-not-ok",z_="connect-hover",G_="djs-updating",V_="djs-dragging",W_=1100;function U_(e,t,n,i){this._injector=t;var r=t.get("connectionPreview",!1);n.on("bendpoint.move.start",function(o){var a=o.context,s=a.bendpointIndex,c=a.connection,u=a.insert,l=c.waypoints,f=l.slice();a.waypoints=l,u&&f.splice(s,0,{x:o.x,y:o.y}),c.waypoints=f;var p=a.draggerGfx=wf(i.getLayer("overlays"));Ve(p).add("djs-dragging"),i.addMarker(c,V_),i.addMarker(c,G_)}),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,z_),u===H_)return;s?(i.removeMarker(c,au),i.addMarker(c,za)):s===!1&&(i.removeMarker(c,za),i.addMarker(c,au))}}),n.on(["bendpoint.move.out","bendpoint.move.cleanup"],W_,function(o){var a=o.context,s=a.hover,c=a.target;s&&(i.removeMarker(s,z_),i.removeMarker(s,c?za:au))}),n.on("bendpoint.move.move",function(o){var a=o.context,s=a.allowed,c=a.bendpointIndex,u=a.draggerGfx,l=a.hover,f=a.type,p=a.connection,d=p.source,h=p.target,m=p.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),f===T2?ou(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):f===M2?ou(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),f===H_&&(m=e.cropWaypoints(p,m)),E.waypoints=m,r.drawPreview(a,s,E)),nn(u,o.x,o.y)},this),n.on(["bendpoint.move.end","bendpoint.move.cancel"],W_,function(o){var a=o.context,s=a.connection,c=a.draggerGfx,u=a.hover,l=a.target,f=a.waypoints;s.waypoints=f,zt(c),i.removeMarker(s,G_),i.removeMarker(s,V_),u&&(i.removeMarker(u,za),i.removeMarker(u,l?za:au)),r&&r.cleanUp(a)})}U_.$inject=["bendpointMove","injector","eventBus","canvas"];var q_="connect-hover",Y_="djs-updating";function K_(e,t,n){return Rf(e,t,e[t]+n)}function Rf(e,t,n){return{x:t==="x"?n:e.x,y:t==="y"?n:e.y}}function k2(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 Rf(t,i,s)}function X_(e){return e==="x"?"y":"x"}function Z_(e,t,n){var i,r;return e.original?e.original:(i=we(t),r=X_(n),Rf(e,r,i[r]))}function Q_(e,t,n,i,r,o){var a=e.get("connectionDocking",!1);this.start=function(f,p,d){var h,m=n.getGraphics(p),g=d-1,S=d,E=p.waypoints,x=E[g],w=E[S],C=xf(n,E,f),P,L,T;if(P=Di(x,w),!!P)return L=P==="v"?"x":"y",g===0&&(x=Z_(x,p.source,L)),S===E.length-1&&(w=Z_(w,p.target,L)),C?T=C.point:T={x:(x.x+w.x)/2,y:(x.y+w.y)/2},h={connection:p,segmentStartIndex:g,segmentEndIndex:S,segmentStart:x,segmentEnd:w,axis:L,dragPosition:T},i.init(f,T,"connectionSegment.move",{cursor:L==="x"?"resize-ew":"resize-ns",data:{connection:p,connectionGfx:m,context:h}})};function s(f,p){if(!a)return p;var d=f.waypoints,h;return f.waypoints=p,h=a.getCroppedWaypoints(f),f.waypoints=d,h}function c(f){r.update("connection",f.connection,f.connectionGfx)}function u(f,p,d){var h=f.newWaypoints,m=f.segmentStartIndex+p,g=h[m],S=f.segmentEndIndex+p,E=h[S],x=X_(f.axis),w=k2(d,g,E,x);nn(f.draggerGfx,w.x,w.y)}function l(f,p){var d=0,h=f.filter(function(m,g){return dl(f[g-1],f[g+1],m)?(d=g<=p?d-1:d,!1):!0});return{waypoints:h,segmentOffset:d}}t.on("connectionSegment.move.start",function(f){var p=f.context,d=f.connection,h=n.getLayer("overlays");p.originalWaypoints=d.waypoints.slice(),p.draggerGfx=$_(h,p.segmentStart,p.segmentEnd),Ve(p.draggerGfx).add("djs-dragging"),n.addMarker(d,Y_)}),t.on("connectionSegment.move.move",function(f){var p=f.context,d=p.connection,h=p.segmentStartIndex,m=p.segmentEndIndex,g=p.segmentStart,S=p.segmentEnd,E=p.axis,x=p.originalWaypoints.slice(),w=K_(g,E,f["d"+E]),C=K_(S,E,f["d"+E]),P=x.length,L=0;x[h]=w,x[m]=C;var T,B;h<2&&(T=tn(d.source,w),h===1?T==="intersect"&&(x.shift(),x[0]=w,L--):T!=="intersect"&&(x.unshift(g),L++)),m>P-3&&(B=tn(d.target,C),m===P-2?B==="intersect"&&(x.pop(),x[x.length-1]=C):B!=="intersect"&&x.push(S)),p.newWaypoints=d.waypoints=s(d,x),u(p,L,f),p.newSegmentStartIndex=h+L,c(f)}),t.on("connectionSegment.move.hover",function(f){f.context.hover=f.hover,n.addMarker(f.hover,q_)}),t.on(["connectionSegment.move.out","connectionSegment.move.cleanup"],function(f){var p=f.context.hover;p&&n.removeMarker(p,q_)}),t.on("connectionSegment.move.cleanup",function(f){var p=f.context,d=p.connection;p.draggerGfx&&zt(p.draggerGfx),n.removeMarker(d,Y_)}),t.on(["connectionSegment.move.cancel","connectionSegment.move.end"],function(f){var p=f.context,d=p.connection;d.waypoints=p.originalWaypoints,c(f)}),t.on("connectionSegment.move.end",function(f){var p=f.context,d=p.connection,h=p.newWaypoints,m=p.newSegmentStartIndex;h=h.map(function(C){return{original:C.original,x:Math.round(C.x),y:Math.round(C.y)}});var g=l(h,m),S=g.waypoints,E=s(d,S),x=g.segmentOffset,w={segmentMove:{segmentStartIndex:p.segmentStartIndex,newSegmentStartIndex:m+x}};o.updateWaypoints(d,E,w)})}Q_.$inject=["injector","eventBus","canvas","dragging","graphicsFactory","modeling"];var O2=Math.abs,J_=Math.round;function D2(e,t,n){n=n===void 0?10:n;var i,r;for(i=0;i<t.length;i++)if(r=t[i],O2(r-e)<=n)return r}function eb(e){return{x:e.x,y:e.y}}function tb(e){return{x:e.x+e.width,y:e.y+e.height}}function Xn(e,t){return!e||isNaN(e.x)||isNaN(e.y)?t:{x:J_(e.x+e.width/2),y:J_(e.y+e.height/2)}}function Fo(e,t){var n=e.snapped;return n?typeof t=="string"?n[t]:n.x&&n.y:!1}function $t(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 nb(e){return e.children||[]}var L2=Math.abs,ib=Math.round,Cf=10;function rb(e){function t(o,a){if(xe(o)){for(var s=o.length;s--;)if(L2(o[s]-a)<=Cf)return o[s]}else{o=+o;var c=a%o;if(c<Cf)return a-c;if(c>o-Cf)return a-c+o}return a}function n(o,a){if(o.waypoints)return R2(a,o);if(o.width)return{x:ib(o.width/2+o.x),y:ib(o.height/2+o.y)}}function i(o){var a=o.context,s=a.snapPoints,c=a.connection,u=c.waypoints,l=a.segmentStart,f=a.segmentStartIndex,p=a.segmentEnd,d=a.segmentEndIndex,h=a.axis;if(s)return s;var m=[u[f-1],l,p,u[d+1]];return f<2&&m.unshift(n(c.source,o)),d>u.length-3&&m.unshift(n(c.target,o)),a.snapPoints=s={horizontal:[],vertical:[]},D(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 f=s-u,p=c-l;j(o,{dx:o.dx-f,dy:o.dy-p,x:u,y:l}),(f||a.vertical.indexOf(s)!==-1)&&$t(o,"x",u),(p||a.horizontal.indexOf(c)!==-1)&&$t(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:[]},D(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);!st(s)||!c||!c.x||!c.y||($t(o,"x",c.x),$t(o,"y",c.y))}),e.on(["bendpoint.move.move","bendpoint.move.end"],1500,function(o){var a=o.context,s=r(a),c=a.hover,u=c&&n(c,o),l=o.x,f=o.y,p,d;if(s){p=t(u?s.vertical.concat([u.x]):s.vertical,l),d=t(u?s.horizontal.concat([u.y]):s.horizontal,f);var h=l-p,m=f-d;j(o,{dx:o.dx-h,dy:o.dy-m,x:o.x-h,y:o.y-m}),(h||s.vertical.indexOf(l)!==-1)&&$t(o,"x",p),(m||s.horizontal.indexOf(f)!==-1)&&$t(o,"y",d)}})}rb.$inject=["eventBus"];const I2={__depends__:[ji,vi],__init__:["bendpoints","bendpointSnapping","bendpointMovePreview"],bendpoints:["type",j_],bendpointMove:["type",Sf],bendpointMovePreview:["type",U_],connectionSegmentMove:["type",Q_],bendpointSnapping:["type",rb]};function ob(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),!to(l)){if(l!==!1){s.source=c,s.target=u;return}l=s.canExecute=o(c,u),!to(l)&&l!==!1&&(s.source=u,s.target=c)}}),e.on(["connect.out","connect.cleanup"],function(a){var s=a.context;s.hover=null,s.source=null,s.target=null,s.canExecute=!1}),e.on("connect.end",function(a){var s=a.context,c=s.canExecute,u=s.connectionStart,l={x:a.x,y:a.y},f=s.source,p=s.target;if(!c)return!1;var d=null,h={connectionStart:Pf(s)?l:u,connectionEnd:Pf(s)?u:l};Ut(c)&&(d=c),s.connection=n.connect(f,p,d,h)}),this.start=function(a,s,c,u){Ut(c)||(u=c,c=we(s)),t.init(a,"connect",{autoActivate:u,data:{shape:s,context:{start:s,connectionStart:c}}})}}ob.$inject=["eventBus","dragging","modeling","rules"];function Pf(e){var t=e.hover,n=e.source,i=e.target;return t&&n&&t===n&&n!==i}var N2=1100,B2=900,ab="connect-ok",sb="connect-not-ok";function cb(e,t,n){var i=e.get("connectionPreview",!1);i&&t.on("connect.move",function(r){var o=r.context,a=o.canExecute,s=o.hover,c=o.source,u=o.start,l=o.startPosition,f=o.target,p=o.connectionStart||l,d=o.connectionEnd||{x:r.x,y:r.y},h=p,m=d;Pf(o)&&(h=d,m=p),i.drawPreview(o,a,{source:c||u,target:f||s,connectionStart:h,connectionEnd:m})}),t.on("connect.hover",B2,function(r){var o=r.context,a=r.hover,s=o.canExecute;s!==null&&n.addMarker(a,s?ab:sb)}),t.on(["connect.out","connect.cleanup"],N2,function(r){var o=r.hover;o&&(n.removeMarker(o,ab),n.removeMarker(o,sb))}),i&&t.on("connect.cleanup",function(r){i.cleanUp(r.context)})}cb.$inject=["injector","eventBus","canvas"];const Af={__depends__:[qn,vi,ji],__init__:["connectPreview"],connect:["type",ob],connectPreview:["type",cb]};var $2="djs-dragger";function Ui(e,t,n,i){this._canvas=t,this._graphicsFactory=n,this._elementFactory=i,this._connectionDocking=e.get("connectionDocking",!1),this._layouter=e.get("layouter",!1)}Ui.$inject=["injector","canvas","graphicsFactory","elementFactory"],Ui.prototype.drawPreview=function(e,t,n){n=n||{};var i=e.connectionPreviewGfx,r=e.getConnection,o=n.source,a=n.target,s=n.waypoints,c=n.connectionStart,u=n.connectionEnd,l=n.noLayout,f=n.noCropping,p=n.noNoop,d,h=this;if(i||(i=e.connectionPreviewGfx=this.createConnectionPreviewGfx()),ws(i),r||(r=e.getConnection=j2(function(m,g,S){return h.getConnection(m,g,S)})),t&&(d=r(t,o,a)),!d){!p&&this.drawNoopPreview(i,n);return}d.waypoints=s||[],this._layouter&&!l&&(d.waypoints=this._layouter.layoutConnection(d,{source:o,target:a,connectionStart:c,connectionEnd:u,waypoints:n.waypoints||d.waypoints})),(!d.waypoints||!d.waypoints.length)&&(d.waypoints=[o?we(o):c,a?we(a):u]),this._connectionDocking&&(o||a)&&!f&&(d.waypoints=this._connectionDocking.getCroppedWaypoints(d,o,a)),this._graphicsFactory.drawConnection(i,d,{stroke:"var(--element-dragger-color)"})},Ui.prototype.drawNoopPreview=function(e,t){var n=t.source,i=t.target,r=t.connectionStart||we(n),o=t.connectionEnd||we(i),a=this.cropWaypoints(r,o,n,i),s=this.createNoopConnection(a[0],a[1]);ke(e,s)},Ui.prototype.cropWaypoints=function(e,t,n,i){var r=this._graphicsFactory,o=n&&r.getShapePath(n),a=i&&r.getShapePath(i),s=r.getConnectionPath({waypoints:[e,t]});return e=n&&na(o,s,!0)||e,t=i&&na(a,s,!1)||t,[e,t]},Ui.prototype.cleanUp=function(e){e&&e.connectionPreviewGfx&&zt(e.connectionPreviewGfx)},Ui.prototype.getConnection=function(e){var t=F2(e);return this._elementFactory.createConnection(t)},Ui.prototype.createConnectionPreviewGfx=function(){var e=ge("g");return ce(e,{pointerEvents:"none"}),Ve(e).add($2),ke(this._canvas.getActiveLayer(),e),e},Ui.prototype.createNoopConnection=function(e,t){return Qo([e,t],{stroke:"#333",strokeDasharray:[1],strokeWidth:2,"pointer-events":"none"})};function j2(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 F2(e){return Ut(e)?e:{}}const H2={__init__:["connectionPreview"],connectionPreview:["type",Ui]},su="complex-preview";class ub{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(su);n.filter(s=>!z2(s)).forEach(s=>{let c;st(s)?(c=this._graphicsFactory._createContainer("connection",ge("g")),this._graphicsFactory.drawConnection(Ir(c),s)):(c=this._graphicsFactory._createContainer("shape",ge("g")),this._graphicsFactory.drawShape(Ir(c),s),nn(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);st(s)?nn(u,c.x,c.y):nn(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",ge("g"));this._graphicsFactory.drawShape(Ir(u),s,{width:c.width,height:c.height}),nn(u,c.x,c.y),this._previewSupport.addDragger(s,a,u)})}cleanUp(){ws(this._canvas.getLayer(su)),this._markers.forEach(([t,n])=>this._canvas.removeMarker(t,n)),this._markers=[]}show(){this._canvas.showLayer(su)}hide(){this._canvas.hideLayer(su)}}ub.$inject=["canvas","graphicsFactory","previewSupport"];function z2(e){return e.hidden}const G2={__depends__:[Mo],__init__:["complexPreview"],complexPreview:["type",ub]},lb=Math.round;function cu(e,t,n,i,r,o){this._complexPreview=e,this._connectionDocking=t,this._elementFactory=n,this._eventBus=i,this._layouter=r,this._rules=o}cu.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(j({type:t},n)),l=a.fire("autoPlace",{source:e,shape:u});if(!l)return;j(u,{x:l.x-lb(u.width/2),y:l.y-lb(u.height/2)});const f=c.allowed("connection.create",{source:e,target:u,hints:{targetParent:e.parent}});let p=null;f&&(p=o.createConnection(f),p.waypoints=s.layoutConnection(p,{source:e,target:u}),p.waypoints=r.getCroppedWaypoints(p,e,u)),i.create({created:[u,p].filter(d=>!to(d))})},cu.prototype.cleanUp=function(){this._complexPreview.cleanUp()},cu.$inject=["complexPreview","connectionDocking","elementFactory","eventBus","layouter","rules"];const V2={__depends__:[Ic,G2,Jp],__init__:["appendPreview"],appendPreview:["type",cu]};var pb=Math.min,fb=Math.max;function Tf(e){e.preventDefault()}function Ga(e){e.stopPropagation()}function W2(e){return e.nodeType===Node.TEXT_NODE}function U2(e){return[].slice.call(e)}function oi(e){this.container=e.container,this.parent=dt('<div class="djs-direct-editing-parent"><div class="djs-direct-editing-content" contenteditable="true"></div></div>'),this.content=rt("[contenteditable]",this.parent),this.keyHandler=e.keyHandler||function(){},this.resizeHandler=e.resizeHandler||function(){},this.focusoutHandler=e.focusoutHandler||function(){},this.autoResize=bn(this.autoResize,this),this.handlePaste=bn(this.handlePaste,this)}oi.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=ii(t,["width","height","maxWidth","maxHeight","minWidth","minHeight","left","top","backgroundColor","position","overflow","border","wordWrap","textAlign","outline","transform"]);j(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=ii(t,["fontFamily","fontSize","fontWeight","lineHeight","padding","paddingTop","paddingRight","paddingBottom","paddingLeft"]);return j(a.style,{boxSizing:"border-box",width:"100%",outline:"none",wordWrap:"break-word"},u),i.centerVertically&&j(a.style,{position:"absolute",top:"50%",transform:"translate(0, -50%)"},u),a.innerText=n,Te.bind(a,"keydown",this.keyHandler),Te.bind(a,"mousedown",Ga),Te.bind(a,"paste",r.handlePaste),Te.bind(a,"focusout",this.focusoutHandler),i.autoResize&&Te.bind(a,"input",this.autoResize),i.resizable&&this.resizable(t),s.appendChild(o),this.setSelection(a.lastChild,a.lastChild&&a.lastChild.length),o},oi.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)}},oi.prototype.insertText=function(e){e=q2(e);var t=document.execCommand("insertText",!1,e);t||this._insertTextIE(e)},oi.prototype._insertTextIE=function(e){var t=this.getSelection(),n=t.startContainer,i=t.endContainer,r=t.startOffset,o=t.endOffset,a=t.commonAncestorContainer,s=U2(a.childNodes),c,u;if(W2(a)){var l=n.textContent;n.textContent=l.substring(0,r)+e+l.substring(o),c=n,u=r+e.length}else if(n===this.content&&i===this.content){var f=document.createTextNode(e);this.content.insertBefore(f,s[r]),c=f,u=f.textContent.length}else{var p=s.indexOf(n),d=s.indexOf(i);s.forEach(function(h,m){m===p?h.textContent=n.textContent.substring(0,r)+e+i.textContent.substring(o):m>p&&m<=d&&fi(h)}),c=n,u=r+e.length}c&&u!==void 0&&setTimeout(function(){self.setSelection(c,u)})},oi.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})}},oi.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=dt('<div class="djs-direct-editing-resize-handle"></div>');var s,c,u,l,f=function(h){Tf(h),Ga(h),s=h.clientX,c=h.clientY;var m=t.getBoundingClientRect();u=m.width,l=m.height,Te.bind(document,"mousemove",p),Te.bind(document,"mouseup",d)},p=function(h){Tf(h),Ga(h);var m=pb(fb(u+h.clientX-s,i),o),g=pb(fb(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){Tf(h),Ga(h),Te.unbind(document,"mousemove",p,!1),Te.unbind(document,"mouseup",d,!1)};Te.bind(n,"mousedown",f)}j(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)},oi.prototype.destroy=function(){var e=this.parent,t=this.content,n=this.resizeHandle;t.innerText="",e.removeAttribute("style"),t.removeAttribute("style"),Te.unbind(t,"keydown",this.keyHandler),Te.unbind(t,"mousedown",Ga),Te.unbind(t,"input",this.autoResize),Te.unbind(t,"paste",this.handlePaste),Te.unbind(t,"focusout",this.focusoutHandler),n&&(n.removeAttribute("style"),fi(n)),fi(e)},oi.prototype.getValue=function(){return this.content.innerText.trim()},oi.prototype.getSelection=function(){var e=window.getSelection(),t=e.getRangeAt(0);return t},oi.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 q2(e){return e.replace(/\r\n|\r|\n/g,`
|
|
316
|
+
`)}function Ln(e,t){this._eventBus=e,this._canvas=t,this._providers=[],this._textbox=new oi({container:t.getContainer(),keyHandler:bn(this._handleKey,this),resizeHandler:bn(this._handleResize,this),focusoutHandler:bn(this._handleFocusout,this)}),e.on(["diagram.clear","diagram.destroy"],()=>this._cleanup())}Ln.$inject=["eventBus","canvas"],Ln.prototype.registerProvider=function(e){this._providers.push(e)},Ln.prototype.isActive=function(e){return!!(this._active&&(!e||this._active.element===e))},Ln.prototype.cancel=function(){this._active&&(this._fire("cancel"),this.close())},Ln.prototype._fire=function(e,t){this._eventBus.fire("directEditing."+e,t||{active:this._active})},Ln.prototype.close=function(){this._fire("deactivate"),this._cleanup(),this._canvas.restoreFocus&&this._canvas.restoreFocus()},Ln.prototype._cleanup=function(){this._active&&(this._textbox.destroy(),this._active=null,this.resizable=void 0)},Ln.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()}},Ln.prototype.getValue=function(){return this._textbox.getValue()},Ln.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()},Ln.prototype._handleResize=function(e){this._fire("resize",e)},Ln.prototype._handleFocusout=function(e){e.relatedTarget&&this._textbox.parent.contains(e.relatedTarget)||this.complete()},Ln.prototype.activate=function(e){if(this.isActive()&&this.cancel(),this._eventBus.fire("directEditing.activate.allowed",{element:e})===!1)return!1;var t,n=lt(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 db={__depends__:[pc],__init__:["directEditing"],directEditing:["type",Ln]};function Y2(e){return function(t){var n=t.target,i=J(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===Ge(e);return!o||!a||!s||!c}}const K2={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 Z(e,t={}){var n=K2[e];if(!n)throw new Error("unknown popup entry <"+e+">");return{...n,actionName:"replace-with-"+e,...t}}var X2=[Z("none-start-event",{actionName:"replace-with-none-start"}),Z("none-intermediate-throwing"),Z("none-end-event",{actionName:"replace-with-none-end"}),Z("message-start"),Z("timer-start"),Z("conditional-start"),Z("signal-start")],Z2=[Z("none-start-event",{actionName:"replace-with-none-start"}),Z("none-intermediate-throwing"),Z("none-end-event",{actionName:"replace-with-none-end"})],Q2=[Z("none-start-event",{actionName:"replace-with-none-start"}),Z("none-intermediate-throwing",{actionName:"replace-with-none-intermediate-throw"}),Z("none-end-event",{actionName:"replace-with-none-end"}),Z("message-intermediate-catch"),Z("message-intermediate-throw"),Z("timer-intermediate-catch"),Z("escalation-intermediate-throw"),Z("conditional-intermediate-catch"),Z("link-intermediate-catch"),Z("link-intermediate-throw"),Z("compensation-intermediate-throw"),Z("signal-intermediate-catch"),Z("signal-intermediate-throw")],J2=[Z("none-start-event",{actionName:"replace-with-none-start"}),Z("none-intermediate-throwing",{actionName:"replace-with-none-intermediate-throw"}),Z("none-end-event",{actionName:"replace-with-none-end"}),Z("message-end"),Z("escalation-end"),Z("error-end"),Z("cancel-end"),Z("compensation-end"),Z("signal-end"),Z("terminate-end")],ek=[Z("exclusive-gateway"),Z("parallel-gateway"),Z("inclusive-gateway"),Z("complex-gateway"),Z("event-based-gateway")],tk=[Z("transaction"),Z("event-subprocess"),Z("expanded-ad-hoc-subprocess",{actionName:"replace-with-ad-hoc-subprocess",label:"Ad-hoc sub-process"}),Z("collapsed-subprocess")],nk=[Z("expanded-subprocess",{actionName:"replace-with-subprocess",label:"Sub-process"}),Z("transaction"),Z("event-subprocess"),Z("collapsed-ad-hoc-subprocess")],hb=[Z("transaction"),Z("expanded-subprocess",{actionName:"replace-with-subprocess",label:"Sub-process"}),Z("expanded-ad-hoc-subprocess",{actionName:"replace-with-ad-hoc-subprocess",label:"Ad-hoc sub-process"}),Z("event-subprocess")],ik=hb,mb=[Z("task"),Z("user-task"),Z("service-task"),Z("send-task"),Z("receive-task"),Z("manual-task"),Z("rule-task"),Z("script-task"),Z("call-activity"),Z("collapsed-subprocess"),Z("expanded-subprocess"),Z("collapsed-ad-hoc-subprocess"),Z("expanded-ad-hoc-subprocess",{actionName:"replace-with-ad-hoc-subprocess"})],rk=[Z("data-store-reference")],ok=[Z("data-object-reference")],ak=[Z("message-boundary"),Z("timer-boundary"),Z("escalation-boundary"),Z("conditional-boundary"),Z("error-boundary"),Z("cancel-boundary"),Z("signal-boundary"),Z("compensation-boundary"),Z("non-interrupting-message-boundary"),Z("non-interrupting-timer-boundary"),Z("non-interrupting-escalation-boundary"),Z("non-interrupting-conditional-boundary"),Z("non-interrupting-signal-boundary")],sk=[Z("message-start"),Z("timer-start"),Z("conditional-start"),Z("signal-start"),Z("error-start"),Z("escalation-start"),Z("compensation-start"),Z("non-interrupting-message-start"),Z("non-interrupting-timer-start"),Z("non-interrupting-conditional-start"),Z("non-interrupting-signal-start"),Z("non-interrupting-escalation-start")],ck=[{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"}],uk=[Z("expanded-pool"),Z("collapsed-pool",{label:function(e){var t="Empty pool/participant";return e.children&&e.children.length&&(t+=" (removes content)"),t}})],lk={"bpmn:MessageEventDefinition":[Z("message-start"),Z("message-intermediate-catch"),Z("message-intermediate-throw"),Z("message-end")],"bpmn:TimerEventDefinition":[Z("timer-start"),Z("timer-intermediate-catch")],"bpmn:ConditionalEventDefinition":[Z("conditional-start"),Z("conditional-intermediate-catch")],"bpmn:SignalEventDefinition":[Z("signal-start"),Z("signal-intermediate-catch"),Z("signal-intermediate-throw"),Z("signal-end")],"bpmn:ErrorEventDefinition":[Z("error-start"),Z("error-end")],"bpmn:EscalationEventDefinition":[Z("escalation-start"),Z("escalation-intermediate-throw"),Z("escalation-end")],"bpmn:CompensateEventDefinition":[Z("compensation-start"),Z("compensation-intermediate-throw"),Z("compensation-end")]};const gb={"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 Zn(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()}Zn.$inject=["bpmnFactory","popupMenu","modeling","moddle","bpmnReplace","rules","translate","moddleCopy"],Zn.prototype._register=function(){this._popupMenu.registerProvider("bpmn-replace",this)},Zn.prototype.getPopupMenuEntries=function(e){var s;var t=e.businessObject,n=this._rules,i=[],r,o=[];if(Ce(e)||!n.allowed("shape.replace",{element:e}))return{};var a=V2(e);return v(t,"bpmn:DataObjectReference")?this._createEntries(e,ek):v(t,"bpmn:DataStoreReference")&&!v(e.parent,"bpmn:Collaboration")?this._createEntries(e,tk):(v(t,"bpmn:Event")&&!v(t,"bpmn:BoundaryEvent")&&(r=(s=t.get("eventDefinitions")[0])==null?void 0:s.$type,i=ak[r]||[],!fn(t.$parent)&&v(t.$parent,"bpmn:SubProcess")&&(i=He(i,function(c){return c.target.type!=="bpmn:StartEvent"}))),v(t,"bpmn:StartEvent")&&!v(t.$parent,"bpmn:SubProcess")?(o=He(U2.concat(i),a),this._createEntries(e,o)):v(t,"bpmn:Participant")?(o=He(ok,function(c){return Ve(e)!==c.target.isExpanded}),this._createEntries(e,o)):v(t,"bpmn:StartEvent")&&fn(t.$parent)?(o=He(ik.concat(i),function(c){var u=c.target,l=u.isInterrupting!==!1,f=t.isInterrupting===l;return a(c)||!a(c)&&!f}),this._createEntries(e,o)):v(t,"bpmn:StartEvent")&&!fn(t.$parent)&&v(t.$parent,"bpmn:SubProcess")?(o=He(q2.concat(i),a),this._createEntries(e,o)):v(t,"bpmn:EndEvent")?(o=He(K2.concat(i),function(c){var u=c.target;return u.eventDefinitionType=="bpmn:CancelEventDefinition"&&!v(t.$parent,"bpmn:Transaction")?!1:a(c)}),this._createEntries(e,o)):v(t,"bpmn:BoundaryEvent")?(o=He(nk,function(c){var u=c.target;if(u.eventDefinitionType=="bpmn:CancelEventDefinition"&&!v(t.attachedToRef,"bpmn:Transaction"))return!1;var l=u.cancelActivity!==!1,f=t.cancelActivity==l;return a(c)||!a(c)&&!f}),this._createEntries(e,o)):v(t,"bpmn:IntermediateCatchEvent")||v(t,"bpmn:IntermediateThrowEvent")?(o=He(Y2.concat(i),a),this._createEntries(e,o)):v(t,"bpmn:Gateway")?(o=He(X2,a),this._createEntries(e,o)):v(t,"bpmn:Transaction")?(o=He(pb,a),this._createEntries(e,o)):fn(t)&&Ve(e)?(o=He(J2,a),this._createEntries(e,o)):v(t,"bpmn:AdHocSubProcess")&&Ve(e)?(o=He(Q2,a),this._createEntries(e,o)):v(t,"bpmn:SubProcess")&&Ve(e)?(o=He(Z2,a),this._createEntries(e,o)):v(t,"bpmn:SubProcess")&&!Ve(e)?(o=He(fb,function(c){var u=c.target.type===e.type,l=c.target.isExpanded===!0;return u===l}),this._createEntries(e,o)):v(t,"bpmn:SequenceFlow")?this._createSequenceFlowEntries(e,rk):v(t,"bpmn:FlowNode")?(o=He(fb,a),this._createEntries(e,o)):{})},Zn.prototype.getPopupMenuHeaderEntries=function(e){var t={};return v(e,"bpmn:Activity")&&!fn(e)&&(t={...t,...this._getLoopCharacteristicsHeaderEntries(e)}),v(e,"bpmn:DataObjectReference")&&(t={...t,...this._getCollectionHeaderEntries(e)}),v(e,"bpmn:Participant")&&(t={...t,...this._getParticipantMultiplicityHeaderEntries(e)}),cg(e)&&(t={...t,...this._getNonInterruptingHeaderEntries(e)}),t},Zn.prototype._createEntries=function(e,t){var n={},i=this;return k(t,function(r){n[r.actionName]=i._createEntry(r,e)}),n},Zn.prototype._createSequenceFlowEntries=function(e,t){var n=ee(e),i={},r=this._modeling,o=this._moddle,a=this;return k(t,function(s){switch(s.actionName){case"replace-with-default-flow":n.sourceRef.default!==n&&(v(n.sourceRef,"bpmn:ExclusiveGateway")||v(n.sourceRef,"bpmn:InclusiveGateway")||v(n.sourceRef,"bpmn:ComplexGateway")||v(n.sourceRef,"bpmn:Activity"))&&(i={...i,[s.actionName]:a._createEntry(s,e,function(){r.updateProperties(e.source,{default:n})})});break;case"replace-with-conditional-flow":!n.conditionExpression&&v(n.sourceRef,"bpmn:Activity")&&(i={...i,[s.actionName]:a._createEntry(s,e,function(){var c=o.create("bpmn:FormalExpression",{body:""});r.updateProperties(e,{conditionExpression:c})})});break;default:v(n.sourceRef,"bpmn:Activity")&&n.conditionExpression&&(i={...i,[s.actionName]:a._createEntry(s,e,function(){r.updateProperties(e,{conditionExpression:void 0})})}),(v(n.sourceRef,"bpmn:ExclusiveGateway")||v(n.sourceRef,"bpmn:InclusiveGateway")||v(n.sourceRef,"bpmn:ComplexGateway")||v(n.sourceRef,"bpmn:Activity"))&&n.sourceRef.default===n&&(i={...i,[s.actionName]:a._createEntry(s,e,function(){r.updateProperties(e.source,{default:void 0})})})}}),i},Zn.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}},Zn.prototype._getLoopCharacteristicsHeaderEntries=function(e){var t=this,n=this._translate;function i(u,l){if(l.active){t._modeling.updateProperties(e,{loopCharacteristics:void 0});return}var f=e.businessObject.get("loopCharacteristics");f&&v(f,l.options.loopCharacteristics)?t._modeling.updateModdleProperties(e,f,{isSequential:l.options.isSequential}):(f=t._moddle.create(l.options.loopCharacteristics,{isSequential:l.options.isSequential}),t._modeling.updateProperties(e,{loopCharacteristics:f}))}var r=ee(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"}}}},Zn.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}}},Zn.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}}},Zn.prototype._getNonInterruptingHeaderEntries=function(e){const t=this._translate,n=ee(e),i=this,r=ug(e),o=v(e,"bpmn:BoundaryEvent")?db["intermediate-event-non-interrupting"]:db["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 sk={__depends__:[vf,Ty,Lc],__init__:["replaceMenuProvider"],replaceMenuProvider:["type",Zn]};function Va(e,t,n,i,r,o,a,s,c,u,l,f,p){e=e||{},i.registerProvider(this),this._contextPad=i,this._modeling=r,this._elementFactory=o,this._connect=a,this._create=s,this._popupMenu=c,this._canvas=u,this._rules=l,this._translate=f,this._eventBus=n,this._appendPreview=p,e.autoPlace!==!1&&(this._autoPlace=t.get("autoPlace",!1)),n.on("create.end",250,function(d){var h=d.context,m=h.shape;if(!(!ma(d)||!i.isOpen(m))){var g=i.getEntries(m);g.replace&&g.replace.action.click(d,m)}}),n.on("contextPad.close",function(){p.cleanUp()})}Va.$inject=["config.contextPad","injector","eventBus","contextPad","modeling","elementFactory","connect","create","popupMenu","canvas","rules","translate","appendPreview"],Va.prototype.getMultiElementContextPadEntries=function(e){var t=this._modeling,n={};return this._isDeleteAllowed(e)&&N(n,{delete:{group:"edit",className:"bpmn-icon-trash",title:this._translate("Delete"),action:{click:function(i,r){t.removeElements(r.slice())}}}}),n},Va.prototype._isDeleteAllowed=function(e){var t=this._rules.allowed("elements.delete",{elements:e});return Ce(t)?Pr(e,n=>t.includes(n)):t},Va.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])&&N(l,h()),l;var f=e.businessObject;function p(x,w){r.start(x,w)}function d(x,w){n.removeElements([w])}function h(){return{delete:{group:"edit",className:"bpmn-icon-trash",title:c("Delete"),action:{click:d}}}}function m(x){var w=5,C=t.getPad(x).html,T=C.getBoundingClientRect(),B={x:T.left,y:T.bottom+w};return B}function g(x,w,C,T){function B(G,$){var V=i.createShape(N({type:x},T));o.start(G,V,{source:$})}var M=s?function(G,$){var V=i.createShape(N({type:x},T));s.append($,V)}:B,z=s?function(G,$){return u.create($,x,T),()=>{u.cleanUp()}}:null;return{group:"model",className:w,title:C,action:{dragstart:B,click:M,hover:z}}}function S(x){return function(w,C){n.splitLane(C,x),t.open(C,!0)}}if(Fe(f,["bpmn:Lane","bpmn:Participant"])&&Ve(e)){var E=sr(e);N(l,{"lane-insert-above":{group:"lane-insert-above",className:"bpmn-icon-lane-insert-above",title:c("Add lane above"),action:{click:function(x,w){n.addLane(w,"top")}}}}),E.length<2&&((Yt(e)?e.height>=120:e.width>=120)&&N(l,{"lane-divide-two":{group:"lane-divide",className:"bpmn-icon-lane-divide-two",title:c("Divide into two lanes"),action:{click:S(2)}}}),(Yt(e)?e.height>=180:e.width>=180)&&N(l,{"lane-divide-three":{group:"lane-divide",className:"bpmn-icon-lane-divide-three",title:c("Divide into three lanes"),action:{click:S(3)}}})),N(l,{"lane-insert-below":{group:"lane-insert-below",className:"bpmn-icon-lane-insert-below",title:c("Add lane below"),action:{click:function(x,w){n.addLane(w,"bottom")}}}})}return v(f,"bpmn:FlowNode")&&(v(f,"bpmn:EventBasedGateway")?N(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"})}):hb(f,"bpmn:BoundaryEvent","bpmn:CompensateEventDefinition")?N(l,{"append.compensation-activity":g("bpmn:Task","bpmn-icon-task",c("Append compensation activity"),{isForCompensation:!0})}):!v(f,"bpmn:EndEvent")&&!f.isForCompensation&&!hb(f,"bpmn:IntermediateThrowEvent","bpmn:LinkEventDefinition")&&!fn(f)&&N(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")||N(l,{replace:{group:"edit",className:"bpmn-icon-screw-wrench",title:c("Change element"),action:{click:function(x,w){var C=N(m(w),{cursor:{x:x.x,y:x.y}});a.open(w,"bpmn-replace",C,{title:c("Change element"),width:"var(--bpmn-replace-popup-width, 300px)",search:!0})}}}}),v(f,"bpmn:SequenceFlow")&&N(l,{"append.text-annotation":g("bpmn:TextAnnotation","bpmn-icon-text-annotation",c("Add text annotation"))}),v(f,"bpmn:MessageFlow")&&N(l,{"append.text-annotation":g("bpmn:TextAnnotation","bpmn-icon-text-annotation",c("Add text annotation"))}),Fe(f,["bpmn:FlowNode","bpmn:InteractionNode","bpmn:DataObjectReference","bpmn:DataStoreReference"])&&N(l,{"append.text-annotation":g("bpmn:TextAnnotation","bpmn-icon-text-annotation",c("Add text annotation")),connect:{group:"connect",className:"bpmn-icon-connection-multi",title:c("Connect to other element"),action:{click:p,dragstart:p}}}),v(f,"bpmn:TextAnnotation")&&N(l,{connect:{group:"connect",className:"bpmn-icon-connection-multi",title:c("Connect using association"),action:{click:p,dragstart:p}}}),Fe(f,["bpmn:DataObjectReference","bpmn:DataStoreReference"])&&N(l,{connect:{group:"connect",className:"bpmn-icon-connection-multi",title:c("Connect using data input association"),action:{click:p,dragstart:p}}}),v(f,"bpmn:Group")&&N(l,{"append.text-annotation":g("bpmn:TextAnnotation","bpmn-icon-text-annotation",c("Add text annotation"))}),this._isDeleteAllowed([e])&&N(l,h()),l};function hb(e,t,n){var i=e.$instanceOf(t),r=!1,o=e.eventDefinitions||[];return k(o,function(a){a.$type===n&&(r=!0)}),i&&r}const ck={__depends__:[F2,lb,Gv,qn,Cf,fc,sk],__init__:["contextPadProvider"],contextPadProvider:["type",Va]};var uk={horizontal:["x","width"],vertical:["y","height"]},mb=5;function Wi(e,t){this._modeling=e,this._filters=[],this.registerFilter(function(n){var i=t.allowed("elements.distribute",{elements:n});return Ce(i)?i:i?n:[]})}Wi.$inject=["modeling","rules"],Wi.prototype.registerFilter=function(e){if(typeof e!="function")throw new Error("the filter has to be a function");this._filters.push(e)},Wi.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},Wi.prototype._filterElements=function(e){var t=this._filters,n=this._axis,i=this._dimension,r=[].concat(e);return t.length?(k(t,function(o){r=o(r,n,i)}),r):e},Wi.prototype._createGroups=function(e){var t=[],n=this,i=this._axis,r=this._dimension;if(!i)throw new Error('must have a defined "axis" and "dimension"');var o=ai(e,i);return k(o,function(a,s){var c=n._findRange(a,i,r),u,l=t[t.length-1];l&&n._hasIntersection(l.range,c)?t[t.length-1].elements.push(a):(u={range:c,elements:[a]},t.push(u))}),t},Wi.prototype._setOrientation=function(e){var t=uk[e];this._axis=t[0],this._dimension=t[1]},Wi.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)},Wi.prototype._findRange=function(e){var t=e[this._axis],n=e[this._dimension];return{min:t+mb,max:t+n-mb}};const lk={__init__:["distributeElements"],distributeElements:["type",Wi]};function cu(e){Un.call(this,e)}cu.$inject=["eventBus"],se(cu,Un),cu.prototype.init=function(){this.addRule("elements.distribute",function(e){var t=e.elements;return t=He(t,function(n){var i=Fe(n,["bpmn:Association","bpmn:BoundaryEvent","bpmn:DataInputAssociation","bpmn:DataOutputAssociation","bpmn:Lane","bpmn:MessageFlow","bpmn:SequenceFlow","bpmn:TextAnnotation"]);return!(n.labelTarget||i)}),t=Ss(t),t.length<3?!1:t})};var gb={horizontal:`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1800 1800">
|
|
327
|
+
</svg>`};function Zn(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()}Zn.$inject=["bpmnFactory","popupMenu","modeling","moddle","bpmnReplace","rules","translate","moddleCopy"],Zn.prototype._register=function(){this._popupMenu.registerProvider("bpmn-replace",this)},Zn.prototype.getPopupMenuEntries=function(e){var s;var t=e.businessObject,n=this._rules,i=[],r,o=[];if(xe(e)||!n.allowed("shape.replace",{element:e}))return{};var a=Y2(e);return v(t,"bpmn:DataObjectReference")?this._createEntries(e,rk):v(t,"bpmn:DataStoreReference")&&!v(e.parent,"bpmn:Collaboration")?this._createEntries(e,ok):(v(t,"bpmn:Event")&&!v(t,"bpmn:BoundaryEvent")&&(r=(s=t.get("eventDefinitions")[0])==null?void 0:s.$type,i=lk[r]||[],!fn(t.$parent)&&v(t.$parent,"bpmn:SubProcess")&&(i=$e(i,function(c){return c.target.type!=="bpmn:StartEvent"}))),v(t,"bpmn:StartEvent")&&!v(t.$parent,"bpmn:SubProcess")?(o=$e(X2.concat(i),a),this._createEntries(e,o)):v(t,"bpmn:Participant")?(o=$e(uk,function(c){return Ge(e)!==c.target.isExpanded}),this._createEntries(e,o)):v(t,"bpmn:StartEvent")&&fn(t.$parent)?(o=$e(sk.concat(i),function(c){var u=c.target,l=u.isInterrupting!==!1,f=t.isInterrupting===l;return a(c)||!a(c)&&!f}),this._createEntries(e,o)):v(t,"bpmn:StartEvent")&&!fn(t.$parent)&&v(t.$parent,"bpmn:SubProcess")?(o=$e(Z2.concat(i),a),this._createEntries(e,o)):v(t,"bpmn:EndEvent")?(o=$e(J2.concat(i),function(c){var u=c.target;return u.eventDefinitionType=="bpmn:CancelEventDefinition"&&!v(t.$parent,"bpmn:Transaction")?!1:a(c)}),this._createEntries(e,o)):v(t,"bpmn:BoundaryEvent")?(o=$e(ak,function(c){var u=c.target;if(u.eventDefinitionType=="bpmn:CancelEventDefinition"&&!v(t.attachedToRef,"bpmn:Transaction"))return!1;var l=u.cancelActivity!==!1,f=t.cancelActivity==l;return a(c)||!a(c)&&!f}),this._createEntries(e,o)):v(t,"bpmn:IntermediateCatchEvent")||v(t,"bpmn:IntermediateThrowEvent")?(o=$e(Q2.concat(i),a),this._createEntries(e,o)):v(t,"bpmn:Gateway")?(o=$e(ek,a),this._createEntries(e,o)):v(t,"bpmn:Transaction")?(o=$e(hb,a),this._createEntries(e,o)):fn(t)&&Ge(e)?(o=$e(ik,a),this._createEntries(e,o)):v(t,"bpmn:AdHocSubProcess")&&Ge(e)?(o=$e(nk,a),this._createEntries(e,o)):v(t,"bpmn:SubProcess")&&Ge(e)?(o=$e(tk,a),this._createEntries(e,o)):v(t,"bpmn:SubProcess")&&!Ge(e)?(o=$e(mb,function(c){var u=c.target.type===e.type,l=c.target.isExpanded===!0;return u===l}),this._createEntries(e,o)):v(t,"bpmn:SequenceFlow")?this._createSequenceFlowEntries(e,ck):v(t,"bpmn:FlowNode")?(o=$e(mb,a),this._createEntries(e,o)):{})},Zn.prototype.getPopupMenuHeaderEntries=function(e){var t={};return v(e,"bpmn:Activity")&&!fn(e)&&(t={...t,...this._getLoopCharacteristicsHeaderEntries(e)}),v(e,"bpmn:DataObjectReference")&&(t={...t,...this._getCollectionHeaderEntries(e)}),v(e,"bpmn:Participant")&&(t={...t,...this._getParticipantMultiplicityHeaderEntries(e)}),pg(e)&&(t={...t,...this._getNonInterruptingHeaderEntries(e)}),t},Zn.prototype._createEntries=function(e,t){var n={},i=this;return D(t,function(r){n[r.actionName]=i._createEntry(r,e)}),n},Zn.prototype._createSequenceFlowEntries=function(e,t){var n=J(e),i={},r=this._modeling,o=this._moddle,a=this;return D(t,function(s){switch(s.actionName){case"replace-with-default-flow":n.sourceRef.default!==n&&(v(n.sourceRef,"bpmn:ExclusiveGateway")||v(n.sourceRef,"bpmn:InclusiveGateway")||v(n.sourceRef,"bpmn:ComplexGateway")||v(n.sourceRef,"bpmn:Activity"))&&(i={...i,[s.actionName]:a._createEntry(s,e,function(){r.updateProperties(e.source,{default:n})})});break;case"replace-with-conditional-flow":!n.conditionExpression&&v(n.sourceRef,"bpmn:Activity")&&(i={...i,[s.actionName]:a._createEntry(s,e,function(){var c=o.create("bpmn:FormalExpression",{body:""});r.updateProperties(e,{conditionExpression:c})})});break;default:v(n.sourceRef,"bpmn:Activity")&&n.conditionExpression&&(i={...i,[s.actionName]:a._createEntry(s,e,function(){r.updateProperties(e,{conditionExpression:void 0})})}),(v(n.sourceRef,"bpmn:ExclusiveGateway")||v(n.sourceRef,"bpmn:InclusiveGateway")||v(n.sourceRef,"bpmn:ComplexGateway")||v(n.sourceRef,"bpmn:Activity"))&&n.sourceRef.default===n&&(i={...i,[s.actionName]:a._createEntry(s,e,function(){r.updateProperties(e.source,{default:void 0})})})}}),i},Zn.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}},Zn.prototype._getLoopCharacteristicsHeaderEntries=function(e){var t=this,n=this._translate;function i(u,l){if(l.active){t._modeling.updateProperties(e,{loopCharacteristics:void 0});return}var f=e.businessObject.get("loopCharacteristics");f&&v(f,l.options.loopCharacteristics)?t._modeling.updateModdleProperties(e,f,{isSequential:l.options.isSequential}):(f=t._moddle.create(l.options.loopCharacteristics,{isSequential:l.options.isSequential}),t._modeling.updateProperties(e,{loopCharacteristics:f}))}var r=J(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"}}}},Zn.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}}},Zn.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}}},Zn.prototype._getNonInterruptingHeaderEntries=function(e){const t=this._translate,n=J(e),i=this,r=fg(e),o=v(e,"bpmn:BoundaryEvent")?gb["intermediate-event-non-interrupting"]:gb["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 pk={__depends__:[bf,Oy,Ic],__init__:["replaceMenuProvider"],replaceMenuProvider:["type",Zn]};function Va(e,t,n,i,r,o,a,s,c,u,l,f,p){e=e||{},i.registerProvider(this),this._contextPad=i,this._modeling=r,this._elementFactory=o,this._connect=a,this._create=s,this._popupMenu=c,this._canvas=u,this._rules=l,this._translate=f,this._eventBus=n,this._appendPreview=p,e.autoPlace!==!1&&(this._autoPlace=t.get("autoPlace",!1)),n.on("create.end",250,function(d){var h=d.context,m=h.shape;if(!(!ma(d)||!i.isOpen(m))){var g=i.getEntries(m);g.replace&&g.replace.action.click(d,m)}}),n.on("contextPad.close",function(){p.cleanUp()})}Va.$inject=["config.contextPad","injector","eventBus","contextPad","modeling","elementFactory","connect","create","popupMenu","canvas","rules","translate","appendPreview"],Va.prototype.getMultiElementContextPadEntries=function(e){var t=this._modeling,n={};return this._isDeleteAllowed(e)&&j(n,{delete:{group:"edit",className:"bpmn-icon-trash",title:this._translate("Delete"),action:{click:function(i,r){t.removeElements(r.slice())}}}}),n},Va.prototype._isDeleteAllowed=function(e){var t=this._rules.allowed("elements.delete",{elements:e});return xe(t)?Pr(e,n=>t.includes(n)):t},Va.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])&&j(l,h()),l;var f=e.businessObject;function p(x,w){r.start(x,w)}function d(x,w){n.removeElements([w])}function h(){return{delete:{group:"edit",className:"bpmn-icon-trash",title:c("Delete"),action:{click:d}}}}function m(x){var w=5,C=t.getPad(x).html,P=C.getBoundingClientRect(),L={x:P.left,y:P.bottom+w};return L}function g(x,w,C,P){function L(k,O){var $=i.createShape(j({type:x},P));o.start(k,$,{source:O})}var T=s?function(k,O){var $=i.createShape(j({type:x},P));s.append(O,$)}:L,B=s?function(k,O){return u.create(O,x,P),()=>{u.cleanUp()}}:null;return{group:"model",className:w,title:C,action:{dragstart:L,click:T,hover:B}}}function S(x){return function(w,C){n.splitLane(C,x),t.open(C,!0)}}if(Be(f,["bpmn:Lane","bpmn:Participant"])&&Ge(e)){var E=sr(e);j(l,{"lane-insert-above":{group:"lane-insert-above",className:"bpmn-icon-lane-insert-above",title:c("Add lane above"),action:{click:function(x,w){n.addLane(w,"top")}}}}),E.length<2&&((Yt(e)?e.height>=120:e.width>=120)&&j(l,{"lane-divide-two":{group:"lane-divide",className:"bpmn-icon-lane-divide-two",title:c("Divide into two lanes"),action:{click:S(2)}}}),(Yt(e)?e.height>=180:e.width>=180)&&j(l,{"lane-divide-three":{group:"lane-divide",className:"bpmn-icon-lane-divide-three",title:c("Divide into three lanes"),action:{click:S(3)}}})),j(l,{"lane-insert-below":{group:"lane-insert-below",className:"bpmn-icon-lane-insert-below",title:c("Add lane below"),action:{click:function(x,w){n.addLane(w,"bottom")}}}})}return v(f,"bpmn:FlowNode")&&(v(f,"bpmn:EventBasedGateway")?j(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"})}):yb(f,"bpmn:BoundaryEvent","bpmn:CompensateEventDefinition")?j(l,{"append.compensation-activity":g("bpmn:Task","bpmn-icon-task",c("Append compensation activity"),{isForCompensation:!0})}):!v(f,"bpmn:EndEvent")&&!f.isForCompensation&&!yb(f,"bpmn:IntermediateThrowEvent","bpmn:LinkEventDefinition")&&!fn(f)&&j(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")||j(l,{replace:{group:"edit",className:"bpmn-icon-screw-wrench",title:c("Change element"),action:{click:function(x,w){var C=j(m(w),{cursor:{x:x.x,y:x.y}});a.open(w,"bpmn-replace",C,{title:c("Change element"),width:"var(--bpmn-replace-popup-width, 300px)",search:!0})}}}}),v(f,"bpmn:SequenceFlow")&&j(l,{"append.text-annotation":g("bpmn:TextAnnotation","bpmn-icon-text-annotation",c("Add text annotation"))}),v(f,"bpmn:MessageFlow")&&j(l,{"append.text-annotation":g("bpmn:TextAnnotation","bpmn-icon-text-annotation",c("Add text annotation"))}),Be(f,["bpmn:FlowNode","bpmn:InteractionNode","bpmn:DataObjectReference","bpmn:DataStoreReference"])&&j(l,{"append.text-annotation":g("bpmn:TextAnnotation","bpmn-icon-text-annotation",c("Add text annotation")),connect:{group:"connect",className:"bpmn-icon-connection-multi",title:c("Connect to other element"),action:{click:p,dragstart:p}}}),v(f,"bpmn:TextAnnotation")&&j(l,{connect:{group:"connect",className:"bpmn-icon-connection-multi",title:c("Connect using association"),action:{click:p,dragstart:p}}}),Be(f,["bpmn:DataObjectReference","bpmn:DataStoreReference"])&&j(l,{connect:{group:"connect",className:"bpmn-icon-connection-multi",title:c("Connect using data input association"),action:{click:p,dragstart:p}}}),v(f,"bpmn:Group")&&j(l,{"append.text-annotation":g("bpmn:TextAnnotation","bpmn-icon-text-annotation",c("Add text annotation"))}),this._isDeleteAllowed([e])&&j(l,h()),l};function yb(e,t,n){var i=e.$instanceOf(t),r=!1,o=e.eventDefinitions||[];return D(o,function(a){a.$type===n&&(r=!0)}),i&&r}const fk={__depends__:[V2,db,Uv,qn,Af,dc,pk],__init__:["contextPadProvider"],contextPadProvider:["type",Va]};var dk={horizontal:["x","width"],vertical:["y","height"]},vb=5;function qi(e,t){this._modeling=e,this._filters=[],this.registerFilter(function(n){var i=t.allowed("elements.distribute",{elements:n});return xe(i)?i:i?n:[]})}qi.$inject=["modeling","rules"],qi.prototype.registerFilter=function(e){if(typeof e!="function")throw new Error("the filter has to be a function");this._filters.push(e)},qi.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},qi.prototype._filterElements=function(e){var t=this._filters,n=this._axis,i=this._dimension,r=[].concat(e);return t.length?(D(t,function(o){r=o(r,n,i)}),r):e},qi.prototype._createGroups=function(e){var t=[],n=this,i=this._axis,r=this._dimension;if(!i)throw new Error('must have a defined "axis" and "dimension"');var o=ai(e,i);return D(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},qi.prototype._setOrientation=function(e){var t=dk[e];this._axis=t[0],this._dimension=t[1]},qi.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)},qi.prototype._findRange=function(e){var t=e[this._axis],n=e[this._dimension];return{min:t+vb,max:t+n-vb}};const hk={__init__:["distributeElements"],distributeElements:["type",qi]};function uu(e){Un.call(this,e)}uu.$inject=["eventBus"],se(uu,Un),uu.prototype.init=function(){this.addRule("elements.distribute",function(e){var t=e.elements;return t=$e(t,function(n){var i=Be(n,["bpmn:Association","bpmn:BoundaryEvent","bpmn:DataInputAssociation","bpmn:DataOutputAssociation","bpmn:Lane","bpmn:MessageFlow","bpmn:SequenceFlow","bpmn:TextAnnotation"]);return!(n.labelTarget||i)}),t=Rs(t),t.length<3?!1:t})};var _b={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>`},pk=900;function Wa(e,t,n,i){this._distributeElements=t,this._translate=n,this._popupMenu=e,this._rules=i,e.registerProvider("align-elements",pk,this)}Wa.$inject=["popupMenu","distributeElements","translate","rules"],Wa.prototype.getPopupMenuEntries=function(e){var t={};return this._isAllowed(e)&&N(t,this._getEntries(e)),t},Wa.prototype._isAllowed=function(e){return this._rules.allowed("elements.distribute",{elements:e})},Wa.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:gb.horizontal,action:function(o,a){t.trigger(e,"horizontal"),i.close()}},"distribute-elements-vertical":{group:"distribute",title:n("Distribute elements vertically"),imageHtml:gb.vertical,action:function(o,a){t.trigger(e,"vertical"),i.close()}}};return r};const fk={__depends__:[vf,lk],__init__:["bpmnDistributeElements","distributeElementsMenuProvider"],bpmnDistributeElements:["type",cu],distributeElementsMenuProvider:["type",Wa]};var yb="is not a registered action",dk="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 f=s.allowed("elements.delete",{elements:l});if(f!==!1){var p=Ce(f)?f:l;return o.cut(p.slice())}}}),r&&this.register("stepZoom",function(l){r.stepZoom(l.value)}),a&&this.register("zoom",function(l){a.zoom(l.value)}),n&&i&&s&&this.register("removeSelection",function(){var l=i.get();if(l.length){var f=s.allowed("elements.delete",{elements:l}),p;f!==!1&&(Ce(f)?p=f:p=l,p.length&&n.removeElements(p.slice()))}}),c&&this.register("moveCanvas",function(l){c.moveCanvas(l)}),u&&this.register("moveSelection",function(l){u.moveSelection(l.direction,l.accelerated)})},Qn.prototype.trigger=function(e,t){if(!this._actions[e])throw Af(e,yb);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);k(e,function(i,r){n._registerAction(r,i)})},Qn.prototype._registerAction=function(e,t){if(this.isRegistered(e))throw Af(e,dk);this._actions[e]=t},Qn.prototype.unregister=function(e){if(!this.isRegistered(e))throw Af(e,yb);this._actions[e]=void 0},Qn.prototype.getActions=function(){return Object.keys(this._actions)},Qn.prototype.isRegistered=function(e){return!!this._actions[e]};function Af(e,t){return new Error(e+" "+t)}const hk={__init__:["editorActions"],editorActions:["type",Qn]};function uu(e){e.invoke(Qn,this)}se(uu,Qn),uu.$inject=["injector"],uu.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),f=e.get("searchPad",!1),p=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=He(m,function(E){return!v(E,"bpmn:Lane")}),u.trigger(g,S))}),i&&p&&this._registerAction("setColor",function(h){var m=i.get();m.length&&p.setColor(m,h)}),i&&l&&this._registerAction("directEditing",function(){var h=i.get();h.length&&l.activate(h[0])}),f&&this._registerAction("find",function(){f.toggle()}),t&&p&&this._registerAction("moveToOrigin",function(){var h=t.getRootElement(),m,g;v(h,"bpmn:Collaboration")?g=n.filter(function(S){return v(S.parent,"bpmn:Collaboration")}):g=n.filter(function(S){return S!==h&&!v(S.parent,"bpmn:SubProcess")}),m=Lt(g),p.moveElements(g,{x:-m.x,y:-m.y},h)}),i&&d&&this._registerAction("replaceElement",function(h){d.triggerEntry("replace","click",h)})};const mk={__depends__:[hk],editorActions:["type",uu]};function vb(e){e.on(["create.init","shape.move.init"],function(t){var n=t.context,i=t.shape;Fe(i,["bpmn:Participant","bpmn:SubProcess","bpmn:TextAnnotation"])&&(n.gridSnappingContext||(n.gridSnappingContext={}),n.gridSnappingContext.snapLocation="top-left")})}vb.$inject=["eventBus"];function Yr(e,t){Q.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;En(a)?r.newBounds=n.snapComplex(c,a):r.newBounds=n.snapSimple(s,c)}})}Yr.$inject=["eventBus","gridSnapping","modeling"],se(Yr,Q),Yr.prototype.snapSimple=function(e,t){var n=this._gridSnapping;return t.width=n.snapValue(t.width,{min:t.width}),t.height=n.snapValue(t.height,{min:t.height}),t.x=e.x+e.width/2-t.width/2,t.y=e.y+e.height/2-t.height/2,t},Yr.prototype.snapComplex=function(e,t){return/w|e/.test(t)&&(e=this.snapHorizontally(e,t)),/n|s/.test(t)&&(e=this.snapVertically(e,t)),e},Yr.prototype.snapHorizontally=function(e,t){var n=this._gridSnapping,i=/w/.test(t),r=/e/.test(t),o={};return o.width=n.snapValue(e.width,{min:e.width}),r&&(i?(o.x=n.snapValue(e.x,{max:e.x}),o.width+=n.snapValue(e.x-o.x,{min:e.x-o.x})):e.x=e.x+e.width-o.width),N(e,o),e},Yr.prototype.snapVertically=function(e,t){var n=this._gridSnapping,i=/n/.test(t),r=/s/.test(t),o={};return o.height=n.snapValue(e.height,{min:e.height}),i&&(r?(o.y=n.snapValue(e.y,{max:e.y}),o.height+=n.snapValue(e.y-o.y,{min:e.y-o.y})):e.y=e.y+e.height-o.height),N(e,o),e};var gk=2e3;function _b(e,t){e.on(["spaceTool.move","spaceTool.end"],gk,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)}})}_b.$inject=["eventBus","gridSnapping"];const yk={__init__:["gridSnappingResizeBehavior","gridSnappingSpaceToolBehavior"],gridSnappingResizeBehavior:["type",Yr],gridSnappingSpaceToolBehavior:["type",_b]};var lu=10;function Tf(e,t,n){return n||(n="round"),Math[n](e/t)*t}var vk=1200,_k=800;function br(e,t,n){var i=!n||n.active!==!1;this._eventBus=t;var r=this;t.on("diagram.init",_k,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"],vk,function(o){var a=o.originalEvent;if(!(!r.active||a&&Mn(a))){var s=o.context,c=s.gridSnappingContext;c||(c=s.gridSnappingContext={}),["x","y"].forEach(function(u){var l={},f=xk(o,u,e);f&&(l.offset=f);var p=bk(o,u);p&&N(l,p),Fo(o,u)||r.snapEvent(o,u,l)})}})}br.prototype.snapEvent=function(e,t,n){var i=this.snapValue(e[t],n);$t(e,t,i)},br.prototype.getGridSpacing=function(){return lu},br.prototype.snapValue=function(e,t){var n=0;t&&t.offset&&(n=t.offset),e+=n,e=Tf(e,lu);var i,r;return t&&t.min&&(i=t.min,ke(i)&&(i=Tf(i+n,lu,"ceil"),e=Math.max(e,i))),t&&t.max&&(r=t.max,ke(r)&&(r=Tf(r+n,lu,"floor"),e=Math.min(e,r))),e-=n,e},br.prototype.isActive=function(){return this.active},br.prototype.setActive=function(e){this.active=e,this._eventBus.fire("gridSnapping.toggle",{active:e})},br.prototype.toggleActive=function(){this.setActive(!this.active)},br.$inject=["elementRegistry","eventBus","config.gridSnapping"];function bk(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&&(pu(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&&(pu(t)?xb(s)?a.x.max=c.left:a.x.min=c.right:bb(s)?a.y.max=c.top:a.y.min=c.bottom),u&&(pu(t)?xb(s)?a.x.min=u.left:a.x.max=u.right:bb(s)?a.y.min=u.top:a.y.max=u.bottom),a[t]}function xk(e,t,n){var i=e.context,r=e.shape,o=i.gridSnappingContext,a=o.snapLocation,s=o.snapOffset;return s&&ke(s[t])||(s||(s=o.snapOffset={}),ke(s[t])||(s[t]=0),!r)||(n.get(r.id)||(pu(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 pu(e){return e==="x"}function bb(e){return e.indexOf("n")!==-1}function xb(e){return e.indexOf("w")!==-1}const wk={__depends__:[yk],__init__:["gridSnapping"],gridSnapping:["type",br]};var Ek=2e3;function wb(e,t,n){e.on("autoPlace",Ek,function(i){var r=i.source,o=Pe(r),a=i.shape,s=xv(r,a,n);return["x","y"].forEach(function(c){var u={};s[c]!==o[c]&&(s[c]>o[c]?u.min=s[c]:u.max=s[c],v(a,"bpmn:TextAnnotation")&&(Sk(c)?u.offset=-a.width/2:u.offset=-a.height/2),s[c]=t.snapValue(s[c],u))}),s})}wb.$inject=["eventBus","gridSnapping","elementRegistry"];function Sk(e){return e==="x"}var Rk=1750;function Eb(e,t,n){t.on(["create.start","shape.move.start"],Rk,function(i){var r=i.context,o=r.shape,a=e.getRootElement();if(!(!v(o,"bpmn:Participant")||!v(a,"bpmn:Process")||!a.children.length)){var s=r.createConstraints;s&&(o.width=n.snapValue(o.width,{min:o.width}),o.height=n.snapValue(o.height,{min:o.height}))}})}Eb.$inject=["canvas","eventBus","gridSnapping"];var Ck=3e3;function fu(e,t,n){Q.call(this,e),this._gridSnapping=t;var i=this;this.postExecuted(["connection.create","connection.layout"],Ck,function(r){var o=r.context,a=o.connection,s=o.hints||{},c=a.waypoints;s.connectionStart||s.connectionEnd||s.createElementsBehavior===!1||Pk(c)&&n.updateWaypoints(a,i.snapMiddleSegments(c))})}fu.$inject=["eventBus","gridSnapping","modeling"],se(fu,Q),fu.prototype.snapMiddleSegments=function(e){var t=this._gridSnapping,n;e=e.slice();for(var i=1;i<e.length-2;i++)n=Mk(t,e[i],e[i+1]),e[i]=n[0],e[i+1]=n[1];return e};function Pk(e){return e.length>3}function Ak(e){return e==="h"}function Tk(e){return e==="v"}function Mk(e,t,n){var i=ki(t,n),r={};return Ak(i)&&(r.y=e.snapValue(t.y)),Tk(i)&&(r.x=e.snapValue(t.x)),("x"in r||"y"in r)&&(t=N({},t,r),n=N({},n,r)),[t,n]}const kk={__depends__:[wk,{__init__:["gridSnappingAutoPlaceBehavior","gridSnappingParticipantBehavior","gridSnappingLayoutConnectionBehavior"],gridSnappingAutoPlaceBehavior:["type",wb],gridSnappingParticipantBehavior:["type",Eb],gridSnappingLayoutConnectionBehavior:["type",fu]}],__init__:["bpmnGridSnapping"],bpmnGridSnapping:["type",vb]};var Ok=30,Sb=30;function Ua(e,t){this._interactionEvents=t;var n=this;e.on(["interactionEvents.createHit","interactionEvents.updateHit"],function(i){var r=i.element,o=i.gfx;if(v(r,"bpmn:Lane"))return n._createParticipantHit(r,o);if(v(r,"bpmn:Participant"))return Ve(r)?n._createParticipantHit(r,o):n._createDefaultHit(r,o);if(v(r,"bpmn:SubProcess"))return Ve(r)?n._createSubProcessHit(r,o):n._createDefaultHit(r,o)})}Ua.$inject=["eventBus","interactionEvents"],Ua.prototype._createDefaultHit=function(e,t){return this._interactionEvents.removeHits(t),this._interactionEvents.createDefaultHit(e,t),!0},Ua.prototype._createParticipantHit=function(e,t){this._interactionEvents.removeHits(t),this._interactionEvents.createBoxHit(t,"no-move",{width:e.width,height:e.height}),this._interactionEvents.createBoxHit(t,"click-stroke",{width:e.width,height:e.height});var n=Yt(e)?{width:Ok,height:e.height}:{width:e.width,height:Sb};return this._interactionEvents.createBoxHit(t,"all",n),!0},Ua.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:Sb}),!0};const Dk={__init__:["bpmnInteractionEvents"],bpmnInteractionEvents:["type",Ua]};function du(e){e.invoke(Do,this)}se(du,Do),du.$inject=["injector"],du.prototype.registerBindings=function(e,t){Do.prototype.registerBindings.call(this,e,t);function n(i,r){t.isRegistered(i)&&e.addListener(r)}n("selectElements",function(i){var r=i.keyEvent;if(e.isKey(["a","A"],r)&&e.isCmd(r))return t.trigger("selectElements"),!0}),n("find",function(i){var r=i.keyEvent;if(e.isKey(["f","F"],r)&&e.isCmd(r))return t.trigger("find"),!0}),n("spaceTool",function(i){var r=i.keyEvent;if(!e.hasModifier(r)&&e.isKey(["s","S"],r))return t.trigger("spaceTool"),!0}),n("lassoTool",function(i){var r=i.keyEvent;if(!e.hasModifier(r)&&e.isKey(["l","L"],r))return t.trigger("lassoTool"),!0}),n("handTool",function(i){var r=i.keyEvent;if(!e.hasModifier(r)&&e.isKey(["h","H"],r))return t.trigger("handTool"),!0}),n("globalConnectTool",function(i){var r=i.keyEvent;if(!e.hasModifier(r)&&e.isKey(["c","C"],r))return t.trigger("globalConnectTool"),!0}),n("directEditing",function(i){var r=i.keyEvent;if(!e.hasModifier(r)&&e.isKey(["e","E"],r))return t.trigger("directEditing"),!0}),n("replaceElement",function(i){var r=i.keyEvent;if(!e.hasModifier(r)&&e.isKey(["r","R"],r))return t.trigger("replaceElement",r),!0})};const Lk={__depends__:[nf],__init__:["keyboardBindings"],keyboardBindings:["type",du]};var Ik={moveSpeed:1,moveSpeedAccelerated:10},Nk=1500,Rb="left",Cb="up",Pb="right",Ab="down",Bk={ArrowLeft:Rb,Left:Rb,ArrowUp:Cb,Up:Cb,ArrowRight:Pb,Right:Pb,ArrowDown:Ab,Down:Ab},$k={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 Tb(e,t,n,i,r){var o=this;this._config=N({},Ik,e||{}),t.addListener(Nk,function(a){var s=a.keyEvent,c=Bk[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=$k[a](u),f=i.allowed("elements.move",{shapes:c,hints:{keyboardMove:!0}});f&&n.moveElements(c,l)}}}Tb.$inject=["config.keyboardMoveSelection","keyboard","modeling","rules","selection"];const jk={__depends__:[nf,qn],__init__:["keyboardMoveSelection"],keyboardMoveSelection:["type",Tb]};var Mb=10;function qa(e,t,n,i){this._dragging=i,this._rules=t;var r=this;function o(c,u){var l=c.shape,f=c.direction,p=c.resizeConstraints,d;c.delta=u,d=IR(l,f,u),c.newBounds=BR(d,p),c.canExecute=r.canResize(c)}function a(c){var u=c.resizeConstraints,l=c.minBounds;u===void 0&&(l===void 0&&(l=r.computeMinResizeBox(c)),c.resizeConstraints={min:be(l)})}function s(c){var u=c.shape,l=c.canExecute,f=c.newBounds;if(l){if(f=qh(f),!Fk(u,f))return;n.resizeShape(u,f)}}e.on("resize.start",function(c){a(c.context)}),e.on("resize.move",function(c){var u={x:c.dx,y:c.dy};o(c.context,u)}),e.on("resize.end",function(c){s(c.context)})}qa.prototype.canResize=function(e){var t=this._rules,n=ii(e,["newBounds","shape","delta","direction"]);return t.allowed("shape.resize",n)},qa.prototype.activate=function(e,t,n){var i=this._dragging,r,o;if(typeof n=="string"&&(n={direction:n}),r=N({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,kb(t,o),"resize",{autoActivate:!0,cursor:Hk(o),data:{shape:t,context:r}})},qa.prototype.computeMinResizeBox=function(e){var t=e.shape,n=e.direction,i,r;return i=e.minDimensions||{width:Mb,height:Mb},r=Lm(t,e.childrenBoxPadding),$R(n,t,i,r)},qa.$inject=["eventBus","rules","modeling","dragging"];function Fk(e,t){return e.x!==t.x||e.y!==t.y||e.width!==t.width||e.height!==t.height}function kb(e,t){var n=Pe(e),i=be(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 Hk(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 Ob="djs-resizing",Db="resize-not-ok",zk=500;function Lb(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,Ob)),s.width>5&&ce(c,{x:s.x,width:s.width}),s.height>5&&ce(c,{y:s.y,height:s.height}),o.canExecute?We(c).remove(Db):We(c).add(Db)}function r(o){var a=o.shape,s=o.frame;s&&zt(o.frame),t.removeMarker(a,Ob)}e.on("resize.move",zk,function(o){i(o.context)}),e.on("resize.cleanup",function(o){r(o.context)})}Lb.$inject=["eventBus","canvas","previewSupport"];var hu=-6,mu=8,gu=20,Ya="djs-resizer",Gk=["n","w","s","e","nw","ne","se","sw"];function xr(e,t,n,i){this._resize=i,this._canvas=t;var r=this;e.on("selection.changed",function(o){var a=o.newSelection;r.removeResizers(),a.length===1&&k(a,bn(r.addResizer,r))}),e.on("shape.changed",function(o){var a=o.element;n.isSelected(a)&&(r.removeResizers(),r.addResizer(a))})}xr.prototype.makeDraggable=function(e,t,n){var i=this._resize;function r(o){ur(o)&&i.activate(o,e,n)}Oe.bind(t,"mousedown",r),Oe.bind(t,"touchstart",r)},xr.prototype._createResizer=function(e,t,n,i){var r=this._getResizersParent(),o=Vk(i),a=ye("g");We(a).add(Ya),We(a).add(Ya+"-"+e.id),We(a).add(Ya+"-"+i),De(r,a);var s=ye("rect");ce(s,{x:-mu/2+o.x,y:-mu/2+o.y,width:mu,height:mu}),We(s).add(Ya+"-visual"),De(a,s);var c=ye("rect");return ce(c,{x:-gu/2+o.x,y:-gu/2+o.y,width:gu,height:gu}),We(c).add(Ya+"-hit"),De(a,c),Ms(a,t,n),a},xr.prototype.createResizer=function(e,t){var n=kb(e,t),i=this._createResizer(e,n.x,n.y,t);this.makeDraggable(e,i,t)},xr.prototype.addResizer=function(e){var t=this;ut(e)||k(Gk,function(n){t._resize.canResize({shape:e,direction:n})&&t.createResizer(e,n)})},xr.prototype.removeResizers=function(){var e=this._getResizersParent();xs(e)},xr.prototype._getResizersParent=function(){return this._canvas.getLayer("resizers")},xr.$inject=["eventBus","canvas","selection","resize"];function Vk(e){var t={x:0,y:0};return e.indexOf("e")!==-1?t.x=-hu:e.indexOf("w")!==-1&&(t.x=hu),e.indexOf("s")!==-1?t.y=-hu:e.indexOf("n")!==-1&&(t.y=hu),t}const Ib={__depends__:[vi,Bi,Mo],__init__:["resize","resizePreview","resizeHandles"],resize:["type",qa],resizePreview:["type",Lb],resizeHandles:["type",xr]};var Wk=2e3;function Ka(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"],Wk,function(c){i.isActive(c.element)&&i.cancel()}),e.on(["commandStack.changed"],function(c){i.isActive()&&i.cancel()}),e.on("directEditing.activate",function(c){o.removeResizers()}),e.on("create.end",500,function(c){var u=c.context,l=u.shape,f=c.context.canExecute,p=c.isTouch;p||f&&(u.hints&&u.hints.createElementsBehavior===!1||s(l))}),e.on("autoPlace.end",500,function(c){s(c.shape)});function s(c,u){(u||Fe(c,["bpmn:Activity","bpmn:Event","bpmn:TextAnnotation","bpmn:Participant"]))&&i.activate(c)}}Ka.$inject=["eventBus","bpmnFactory","canvas","directEditing","modeling","resizeHandles","textRenderer"],Ka.prototype.activate=function(e){var t=$n(e);if(t!==void 0){var n={text:t},i=this.getEditingBBox(e);N(n,i);var r={},o=n.style||{};return N(o,{backgroundColor:null,border:null}),(Fe(e,["bpmn:Task","bpmn:Participant","bpmn:Lane","bpmn:CallActivity"])||Nb(e))&&N(r,{centerVertically:!0}),or(e)&&(N(r,{resizable:!0,autoResize:!0}),N(o,{backgroundColor:"#ffffff",border:"1px solid #ccc"})),v(e,"bpmn:TextAnnotation")&&(N(r,{resizable:!0,autoResize:!0}),N(o,{backgroundColor:"#ffffff",border:"1px solid #ccc"})),N(n,{options:r,style:o}),n}},Ka.prototype.getEditingBBox=function(e){var t=this._canvas,n=e.label||e,i=t.getAbsoluteBBox(n),r={x:i.x+i.width/2,y:i.y+i.height/2},o={x:i.x,y:i.y},a=t.zoom(),s=this._textRenderer.getDefaultStyle(),c=this._textRenderer.getExternalStyle(),u=c.fontSize*a,l=c.lineHeight,f=s.fontSize*a,p=s.lineHeight,d={fontFamily:this._textRenderer.getDefaultStyle().fontFamily,fontWeight:this._textRenderer.getDefaultStyle().fontWeight};if(v(e,"bpmn:Lane")||Yk(e)){var h=Yt(e),m=h?{width:i.height,height:30*a,x:i.x-i.height/2+15*a,y:r.y-30*a/2}:{width:i.width,height:30*a};N(o,m),N(d,{fontSize:f+"px",lineHeight:p,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px",transform:h?"rotate(-90deg)":null})}if(qk(e)){var g=Yt(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};N(o,S),N(d,{fontSize:f+"px",lineHeight:p,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px",transform:g?null:"rotate(-90deg)"})}(Fe(e,["bpmn:Task","bpmn:CallActivity"])||Nb(e))&&(N(o,{width:i.width,height:i.height}),N(d,{fontSize:f+"px",lineHeight:p,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px"})),Uk(e)&&(N(o,{width:i.width,x:i.x}),N(d,{fontSize:f+"px",lineHeight:p,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px"}));var E=1,x=i.width+2*E;if(n.labelTarget&&(N(o,{width:x,height:i.height+2*E,x:i.x-E,y:i.y-E}),N(d,{fontSize:u+"px",lineHeight:l})),or(n)&&!Ds(n)&&!$e(n)){var w=gl(e),C=t.getAbsoluteBBox({x:w.x,y:w.y,width:0,height:0}),T=u,B=Nr.width*a+2*E;N(o,{width:B,height:T+2*E,x:C.x-B/2,y:C.y-T/2-E}),N(d,{fontSize:u+"px",lineHeight:l})}return v(e,"bpmn:TextAnnotation")&&(N(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}),N(d,{textAlign:"left",paddingTop:yo*a+"px",paddingBottom:yo*a+"px",paddingLeft:yo*a+"px",paddingRight:yo*a+"px",fontSize:f+"px",lineHeight:p})),{bounds:o,style:d}},Ka.prototype.update=function(e,t,n,i){var r,o;v(e,"bpmn:TextAnnotation")&&(o=this._canvas.getAbsoluteBBox(e),r={x:e.x,y:e.y,width:e.width/o.width*i.width,height:e.height/o.height*i.height}),Kk(t)&&(t=null),this._modeling.updateLabel(e,t,r)};function Nb(e){return v(e,"bpmn:SubProcess")&&!Ve(e)}function Uk(e){return v(e,"bpmn:SubProcess")&&Ve(e)}function qk(e){return v(e,"bpmn:Participant")&&!Ve(e)}function Yk(e){return v(e,"bpmn:Participant")&&Ve(e)}function Kk(e){return!e||!e.trim()}var Bb="djs-element-hidden",$b="djs-label-hidden";function jb(e,t,n){var i=this,r=t.getDefaultLayer(),o,a,s;e.on("directEditing.activate",function(c){var u=c.active;if(o=u.element.label||u.element,v(o,"bpmn:TextAnnotation")){a=t.getAbsoluteBBox(o),s=ye("g");var l=n.getScaledPath("TEXT_ANNOTATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:o.width,containerHeight:o.height,position:{mx:0,my:0}}),f=i.path=ye("path");ce(f,{d:l,strokeWidth:2,stroke:Xk(o)}),De(s,f),De(r,s),tn(s,o.x,o.y)}v(o,"bpmn:TextAnnotation")||o.labelTarget?t.addMarker(o,Bb):(v(o,"bpmn:Task")||v(o,"bpmn:CallActivity")||v(o,"bpmn:SubProcess")||v(o,"bpmn:Participant")||v(o,"bpmn:Lane"))&&t.addMarker(o,$b)}),e.on("directEditing.resize",function(c){if(v(o,"bpmn:TextAnnotation")){var u=c.height,l=c.dy,f=Math.max(o.height/a.height*(u+l),0),p=n.getScaledPath("TEXT_ANNOTATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:o.width,containerHeight:f,position:{mx:0,my:0}});ce(i.path,{d:p})}}),e.on(["directEditing.complete","directEditing.cancel"],function(c){var u=c.active;u&&(t.removeMarker(u.element.label||u.element,Bb),t.removeMarker(o,$b)),o=void 0,a=void 0,s&&(zt(s),s=void 0)})}jb.$inject=["eventBus","canvas","pathMap"];function Xk(e,t){var n=Qe(e);return n.get("stroke")||t||"black"}const Zk={__depends__:[Lp,Ib,lb],__init__:["labelEditingProvider","labelEditingPreview"],labelEditingProvider:["type",Ka],labelEditingPreview:["type",jb]};var Qk=500,Jk=1e3;function xi(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){B1(o)||i.createOutline(o)}e.on("element.hover",function(o){r(o.element)}),e.on("selection.changed",function(o){k(o.newSelection,r)}),e.on(["shape.changed","connection.changed"],Qk,function(o){var a=o.element,s=o.gfx,c=st(".djs-outline",s);c&&i.updateOutline(a,c)})}xi.prototype.createOutline=function(e){var t=this._elementRegistry.getGraphics(e);if(!t)throw new Error("cannot create outline for non-rendered element");var n=st(".djs-outline",t);return n||(n=this.getOutline(e)||this._createOutlineGfx(),De(t,n),this.updateOutline(e,n)),n},xi.prototype._createOutlineGfx=function(){var e=ye("rect");return ce(e,N({x:0,y:0,rx:4,width:100,height:100},this._outlineStyle)),e},xi.prototype.updateOutline=function(e,t){e.waypoints?this.updateConnectionOutline(t,e):this.updateShapeOutline(t,e)},xi.prototype.updateShapeOutline=function(e,t){var n=!1,i=this._getProviders();i.length&&k(i,function(r){n=n||r.updateOutline(t,e)}),n||ce(e,{x:-this._outlineOffset,y:-this._outlineOffset,width:t.width+this._outlineOffset*2,height:t.height+this._outlineOffset*2})},xi.prototype.updateConnectionOutline=function(e,t){var n=Lt(t);ce(e,{x:n.x-this._outlineOffset,y:n.y-this._outlineOffset,width:n.width+this._outlineOffset*2,height:n.height+this._outlineOffset*2})},xi.prototype.registerProvider=function(e,t){t||(t=e,e=Jk),this._eventBus.on("outline.getProviders",e,function(n){n.providers.push(t)})},xi.prototype._getProviders=function(){var e=this._eventBus.createEvent({type:"outline.getProviders",providers:[]});return this._eventBus.fire(e),e.providers},xi.prototype.getOutline=function(e){var t,n=this._getProviders();return k(n,function(i){qt(i.getOutline)&&(t=t||i.getOutline(e))}),t},xi.$inject=["eventBus","styles","elementRegistry"];var yu=6;function Mf(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)})}Mf.prototype._updateMultiSelectionOutline=function(e){var t=this._canvas.getLayer("selectionOutline");xs(t);var n=e.length>1,i=this._canvas.getContainer();if(We(i)[n?"add":"remove"]("djs-multi-select"),!!n){var r=eO(Lt(e)),o=ye("rect");ce(o,N({rx:3},r)),We(o).add("djs-selection-outline"),De(t,o)}},Mf.$inject=["eventBus","canvas","selection"];function eO(e){return{x:e.x-yu,y:e.y-yu,width:e.width+yu*2,height:e.height+yu*2}}const kf={__depends__:[qn],__init__:["outline","multiSelectionOutline"],outline:["type",xi],multiSelectionOutline:["type",Mf]},Fb=["bpmn:Event","bpmn:SequenceFlow","bpmn:Gateway"],Hb={class:"bjs-label-link",stroke:"var(--element-selected-outline-secondary-stroke-color)",strokeDasharray:"5, 5"},tO=15,vu=2;function zb(e,t,n,i,r){const o=t.getLayer("overlays");e.on(["selection.changed","shape.changed"],function(){s()}),e.on("selection.changed",function({newSelection:f}){var d;const p=f.filter(h=>Fe(h,Fb));if(p.length===1){const h=p[0];$e(h)?a(h,h.labelTarget):(d=h.labels)!=null&&d.length&&a(h.labels[0],h)}if(p.length===2){const h=p.find($e),m=p.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:f}){var p;!Fe(f,Fb)||!l(f)||($e(f)?a(f,f.labelTarget):(p=f.labels)!=null&&p.length&&a(f.labels[0],f))});function a(f,p){const d=Qo([Pe(p),Pe(f)],Hb),h=d.getAttribute("d"),g=r.isSelected(f)?c(f):u(f),S=na(g,h);if(!S)return;const x=r.isSelected(p)?c(p):u(p),w=na(x,h)||Pe(p);fa(w,S)<tO||(cl(d,[w,S]),De(o,d))}function s(){bs(`.${Hb.class}`,o).forEach(zt)}function c(f){const p=i.getOutline(f);if(!p)return u(f);if(p.x){const d={x:f.x+wr(p,"x")-vu,y:f.y+wr(p,"y")-vu,width:wr(p,"width")+vu*2,height:wr(p,"height")+vu*2};return vl(d,wr(p,"rx"))}if(p.cx){const d=wr(p,"r"),h={x:f.x+wr(p,"cx")-d,y:f.y+wr(p,"cy")-d,width:d*2,height:d*2};return ym(h)}}function u(f){return n.getShapePath(f)}function l(f){return r.isSelected(f)}}zb.$inject=["eventBus","canvas","graphicsFactory","outline","selection"];function wr(e,t){return parseFloat(ce(e,t)||0)}const nO={__depends__:[qn,kf],__init__:["labelLink"],labelLink:["type",zb]};var iO=new To("tt");function rO(e){var t=mt('<div class="djs-tooltip-container" />');return mn(t,{position:"absolute",width:"0",height:"0"}),e.insertBefore(t,e.firstChild),t}function oO(e,t,n){mn(e,{left:t+"px",top:n+"px"})}function Of(e,t){e.style.display=t===!1?"none":""}var Gb="djs-tooltip",Df="."+Gb;function wn(e,t){this._eventBus=e,this._canvas=t,this._ids=iO,this._tooltipDefaults={show:{minZoom:.7,maxZoom:5}},this._tooltips={},this._tooltipRoot=rO(t.getContainer());var n=this;Pn.bind(this._tooltipRoot,Df,"mousedown",function(i){i.stopPropagation()}),Pn.bind(this._tooltipRoot,Df,"mouseover",function(i){n.trigger("mouseover",i)}),Pn.bind(this._tooltipRoot,Df,"mouseout",function(i){n.trigger("mouseout",i)}),this._init()}wn.$inject=["eventBus","canvas"],wn.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=N({},this._tooltipDefaults,e,{id:t}),this._addTooltip(e),e.timeout&&this.setTimeout(e),t},wn.prototype.trigger=function(e,t){var n=t.delegateTarget||t.target,i=this.get(ln(n,"data-tooltip-id"));i&&(e==="mouseover"&&i.timeout&&this.clearTimeout(i),e==="mouseout"&&i.timeout&&(i.timeout=1e3,this.setTimeout(i)))},wn.prototype.get=function(e){return typeof e!="string"&&(e=e.id),this._tooltips[e]},wn.prototype.clearTimeout=function(e){if(e=this.get(e),!!e){var t=e.removeTimer;t&&(clearTimeout(t),e.removeTimer=null)}},wn.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)}},wn.prototype.remove=function(e){var t=this.get(e);t&&(fi(t.html),fi(t.htmlContainer),delete t.htmlContainer,delete this._tooltips[t.id])},wn.prototype.show=function(){Of(this._tooltipRoot)},wn.prototype.hide=function(){Of(this._tooltipRoot,!1)},wn.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},wn.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)),En(n)&&(n=mt(n)),i=mt('<div data-tooltip-id="'+t+'" class="'+Gb+'">'),mn(i,{position:"absolute"}),i.appendChild(n),e.type&&bt(i).add("djs-tooltip-"+e.type),e.className&&bt(i).add(e.className),e.htmlContainer=i,r.appendChild(i),this._tooltips[t]=e,this._updateTooltip(e)},wn.prototype._updateTooltip=function(e){var t=e.position,n=e.htmlContainer;oO(n,t.x,t.y)},wn.prototype._updateTooltipVisibilty=function(e){k(this._tooltips,function(t){var n=t.show,i=t.htmlContainer,r=!0;n&&((n.minZoom>e.scale||n.maxZoom<e.scale)&&(r=!1),Of(i,r))})},wn.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 aO={__init__:["tooltips"],tooltips:["type",wn]};var sO="flow elements must be children of pools/participants",cO="Data object must be placed within a pool/participant.";function Vb(e,t,n){function i(r,o,a){t.add({position:{x:r.x+5,y:r.y+5},type:"error",timeout:2e3,html:"<div>"+o+"</div>"})}e.on(["shape.move.rejected","create.rejected"],function(r){var o=r.context,a=o.shape,s=o.target;v(s,"bpmn:Collaboration")&&(v(a,"bpmn:FlowNode")?i(r,n(sO)):v(a,"bpmn:DataObjectReference")&&i(r,n(cO)))})}Vb.$inject=["eventBus","tooltips","translate"];const uO={__depends__:[aO],__init__:["modelingFeedback"],modelingFeedback:["type",Vb]};var lO=500,pO=1250,fO=1500,_u=Math.round;function dO(e){return{x:e.x+_u(e.width/2),y:e.y+_u(e.height/2)}}function Wb(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",fO,function(s){var c=s.context,u=s.shape,l=i.get().slice();l.indexOf(u)===-1&&(l=[u]),l=hO(l),N(c,{shapes:l,validatedShapes:l,shape:u})}),e.on("shape.move.start",pO,function(s){var c=s.context,u=c.validatedShapes,l;if(l=c.canExecute=o(u),!l)return!1}),e.on("shape.move.move",lO,function(s){var c=s.context,u=c.validatedShapes,l=s.hover,f={x:s.dx,y:s.dy},p={x:s.x,y:s.y},d;if(d=o(u,f,p,l),c.delta=f,c.canExecute=d,d===null){c.target=null;return}c.target=l}),e.on("shape.move.end",function(s){var c=s.context,u=c.delta,l=c.canExecute,f=l==="attach",p=c.shapes;if(l===!1)return!1;u.x=_u(u.x),u.y=_u(u.y),!(u.x===0&&u.y===0)&&n.moveElements(p,u,c.target,{primaryShape:c.shape,attach:f})}),e.on("element.mousedown",function(s){if(ur(s)){var c=Ro(s);if(!c)throw new Error("must supply DOM mousedown event");return a(c,s.element)}});function a(s,c,u,l){if(Ut(u)&&(l=u,u=!1),!(c.waypoints||!c.parent)&&!We(s.target).has("djs-hit-no-move")){var f=dO(c),p=t.init(s,f,"shape.move",{cursor:"grabbing",autoActivate:u,data:{shape:c,context:l||{}}});if(p!==!1)return!0}}this.start=a}Wb.$inject=["eventBus","dragging","modeling","selection","rules"];function hO(e){var t=io(e,"id");return He(e,function(n){for(;n=n.parent;)if(t[n.id])return!1;return!0})}var Ub=499,Lf="djs-dragging",qb="drop-ok",Yb="drop-not-ok",Kb="new-parent",Xb="attach-ok";function Zb(e,t,n,i){function r(c){var u=o(c),l=mO(u);return l}function o(c){var u=Jo(c),l=u.flatMap(d=>(d.incoming||[]).concat(d.outgoing||[])),f=u.concat(l),p=[...new Set(f)];return p}function a(c,u){[Xb,qb,Yb,Kb].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,Lf),c.allDraggedElements?c.allDraggedElements.push(u):c.allDraggedElements=[u]}e.on("shape.move.start",Ub,function(c){var u=c.context,l=u.shapes,f=u.allDraggedElements,p=r(l);if(!u.dragGroup){var d=ye("g");ce(d,n.cls("djs-drag-group",["no-events"]));var h=t.getActiveLayer();De(h,d),u.dragGroup=d}p.forEach(function(m){i.addDragger(m,u.dragGroup)}),f?f=Au([f,o(l)]):f=o(l),k(f,function(m){t.addMarker(m,Lf)}),u.allDraggedElements=f,u.differentParents=gO(l)}),e.on("shape.move.move",Ub,function(c){var u=c.context,l=u.dragGroup,f=u.target,p=u.shape.parent,d=u.canExecute;f&&(d==="attach"?a(f,Xb):u.canExecute&&p&&f.id!==p.id?a(f,Kb):a(f,u.canExecute?qb:Yb)),tn(l,c.dx,c.dy)}),e.on(["shape.move.out","shape.move.cleanup"],function(c){var u=c.context,l=u.target;l&&a(l,null)}),e.on("shape.move.cleanup",function(c){var u=c.context,l=u.allDraggedElements,f=u.dragGroup;k(l,function(p){t.removeMarker(p,Lf)}),f&&zt(f)}),this.makeDraggable=s}Zb.$inject=["eventBus","canvas","styles","previewSupport"];function mO(e){var t=new Set;e.forEach(function(i){t.add(i.id)});var n=He(e,function(i){return ut(i)?t.has(i.source.id)&&t.has(i.target.id):!0});return n}function gO(e){return y0(io(e,function(t){return t.parent&&t.parent.id}))!==1}const yO={__depends__:[lc,qn,kf,vi,Bi,Mo],__init__:["move","movePreview"],move:["type",Wb],movePreview:["type",Zb]};var Qb=".djs-palette-toggle",Jb=".entry",vO=Qb+", "+Jb,If="djs-palette-",_O="shown",Nf="open",ex="two-column",bO=1e3;function jt(e,t){this._eventBus=e,this._canvas=t;var n=this;e.on("tool-manager.update",function(i){var r=i.tool;n.updateToolHighlight(r)}),e.on("i18n.changed",function(){n._update()}),e.on("diagram.init",function(){n._diagramInitialized=!0,n._rebuild()})}jt.$inject=["eventBus","canvas"],jt.prototype.registerProvider=function(e,t){t||(t=e,e=bO),this._eventBus.on("palette.getProviders",e,function(n){n.providers.push(t)}),this._rebuild()},jt.prototype.getEntries=function(){var e=this._getProviders();return e.reduce(wO,{})},jt.prototype._rebuild=function(){if(this._diagramInitialized){var e=this._getProviders();e.length&&(this._container||this._init(),this._update())}},jt.prototype._init=function(){var e=this,t=this._eventBus,n=this._getParentContainer(),i=this._container=mt(jt.HTML_MARKUP);n.appendChild(i),bt(n).add(If+_O),Pn.bind(i,vO,"click",function(r){var o=r.delegateTarget;if(Ju(o,Qb))return e.toggle();e.trigger("click",r)}),Oe.bind(i,"mousedown",function(r){r.stopPropagation()}),Pn.bind(i,Jb,"dragstart",function(r){e.trigger("dragstart",r)}),t.on("canvas.resized",this._layoutChanged,this),t.fire("palette.create",{container:i})},jt.prototype._getProviders=function(e){var t=this._eventBus.createEvent({type:"palette.getProviders",providers:[]});return this._eventBus.fire(t),t.providers},jt.prototype._toggleState=function(e){e=e||{};var t=this._getParentContainer(),n=this._container,i=this._eventBus,r,o=bt(n),a=bt(t);"twoColumn"in e?r=e.twoColumn:r=this._needsCollapse(t.clientHeight,this._entries||{}),o.toggle(ex,r),a.toggle(If+ex,r),"open"in e&&(o.toggle(Nf,e.open),a.toggle(If+Nf,e.open)),i.fire("palette.changed",{twoColumn:r,open:this.isOpen()})},jt.prototype._update=function(){var e=st(".djs-palette-entries",this._container),t=this._entries=this.getEntries();vs(e),k(t,function(n,i){var r=n.group||"default",o=st("[data-group="+La(r)+"]",e);o||(o=mt('<div class="group"></div>'),ln(o,"data-group",r),e.appendChild(o));var a=n.html||(n.separator?'<hr class="separator" />':'<div class="entry" draggable="true"></div>'),s=mt(a);if(o.appendChild(s),!n.separator&&(ln(s,"data-action",i),n.title&&ln(s,"title",n.title),n.className&&xO(s,n.className),n.imageUrl)){var c=mt("<img>");ln(c,"src",n.imageUrl),s.appendChild(c)}}),this.open()},jt.prototype.trigger=function(e,t,n){var i,r,o=t.delegateTarget||t.target;return o?(i=ln(o,"data-action"),r=t.originalEvent||t,this.triggerEntry(i,e,r,n)):t.preventDefault()},jt.prototype.triggerEntry=function(e,t,n,i){var r=this._entries,o,a;if(o=r[e],!!o&&(a=o.action,this._eventBus.fire("palette.trigger",{entry:o,event:n})!==!1)){if(qt(a)){if(t==="click")return a(n,i)}else if(a[t])return a[t](n,i);n.preventDefault()}},jt.prototype._layoutChanged=function(){this._toggleState({})},jt.prototype._needsCollapse=function(e,t){var n=50,i=Object.keys(t).length*46;return e<i+n},jt.prototype.close=function(){this._toggleState({open:!1,twoColumn:!1})},jt.prototype.open=function(){this._toggleState({open:!0})},jt.prototype.toggle=function(){this.isOpen()?this.close():this.open()},jt.prototype.isActiveTool=function(e){return e&&this._activeTool===e},jt.prototype.updateToolHighlight=function(e){var t,n;this._toolsContainer||(t=st(".djs-palette-entries",this._container),this._toolsContainer=st("[data-group=tools]",t)),n=this._toolsContainer,k(n.children,function(i){var r=i.getAttribute("data-action");if(r){var o=bt(i);r=r.replace("-tool",""),o.contains("entry")&&r===e?o.add("highlighted-entry"):o.remove("highlighted-entry")}})},jt.prototype.isOpen=function(){return bt(this._container).has(Nf)},jt.prototype._getParentContainer=function(){return this._canvas.getContainer()},jt.HTML_MARKUP='<div class="djs-palette"><div class="djs-palette-entries"></div><div class="djs-palette-toggle"></div></div>';function xO(e,t){var n=bt(e),i=Ce(t)?t:t.split(/\s+/g);i.forEach(function(r){n.add(r)})}function wO(e,t){var n=t.getPaletteEntries();return qt(n)?n(e):(k(n,function(i,r){e[r]=i}),e)}const EO={__init__:["palette"],palette:["type",jt]};var tx="crosshair",nx="selected",SO="djs-dragging-active-lasso";function Er(e,t,n,i,r,o,a){this._selection=r,this._dragging=n,this._mouse=a;var s=this,c={create:function(f){var p=t.getActiveLayer(),d=f.frame=ye("rect");ce(d,{class:"djs-lasso-overlay",width:1,height:1,x:0,y:0}),De(p,d),u(!0),this.update(f)},update:function(f){var p=f.frame,d=f.bbox;p&&d&&ce(p,{x:d.x,y:d.y,width:d.width,height:d.height});var h=f.marked,m=f.lastMarked;if(h&&m){for(const g of m)h.has(g)||t.removeMarker(g,nx);for(const g of h)m.has(g)||t.addMarker(g,nx)}},remove:function(f){this.update(f),f.frame&&zt(f.frame),u(!1)}};function u(f){We(t.getContainer()).toggle(SO,f)}function l(f){var p=i.getAll();return new Set(no(po(p,f)))}o.registerTool("lasso",{tool:"lasso.selection",dragging:"lasso"}),e.on("lasso.selection.end",function(f){var p=f.originalEvent.target;!f.hover&&!(p instanceof SVGElement)||e.once("lasso.selection.ended",function(){s.activateLasso(f.originalEvent,!0)})}),e.on("lasso.end",0,function(f){var p=f.context;s._select(Array.from(p.marked))}),e.on("lasso.start",function(f){var p=f.context;p.bbox=ix(f),p.add=ic(f),p.lastMarked=new Set(r.get()),p.add?p.marked=p.lastMarked:p.marked=new Set,p.initialMarked=p.marked,c.create(p)}),e.on("lasso.move",function(f){var p=f.context,d=p.bbox=ix(f),h=l(d),m=p.initialMarked.union(h);p.lastMarked=p.marked,p.marked=m,c.update(p)}),e.on("lasso.cleanup",function(f){var p=f.context;p.lastMarked=p.marked,p.marked=new Set(r.get()),c.remove(f.context)}),e.on("element.mousedown",1500,function(f){if(ic(f))return s.activateLasso(f.originalEvent),!0})}Er.$inject=["eventBus","canvas","dragging","elementRegistry","selection","toolManager","mouse"],Er.prototype.activateLasso=function(e,t){this._dragging.init(e,"lasso",{autoActivate:t,cursor:tx,data:{context:{}},keepSelection:!0})},Er.prototype.activateSelection=function(e,t){this._dragging.init(e,"lasso.selection",{trapClick:!1,autoActivate:t,cursor:tx,data:{context:{}},keepSelection:!0})},Er.prototype._select=function(e){this._selection.select(e)},Er.prototype.select=function(e,t,n=[]){var i=no(po(e,t));this._select([...n,...i])},Er.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateSelection(e,!!e)},Er.prototype.isActive=function(){var e=this._dragging.context();return e&&/^lasso/.test(e.prefix)};function ix(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 RO={__depends__:[hc,va],__init__:["lassoTool"],lassoTool:["type",Er]};var Bf=1500,rx="grab";function Ho(e,t,n,i,r,o){this._dragging=n,this._mouse=o;var a=this,s=i.get("keyboard",!1);r.registerTool("hand",{tool:"hand",dragging:"hand.move"}),e.on("element.mousedown",Bf,function(c){if(ma(c))return a.activateMove(c.originalEvent,!0),!1}),s&&s.addListener(Bf,function(c){if(!(!ox(c.keyEvent)||a.isActive())){var u=a._mouse.getLastMoveEvent();a.activateMove(u,!!u)}},"keyboard.keydown"),s&&s.addListener(Bf,function(c){!ox(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!ma(c)&&l&&e.once("hand.move.ended",function(f){a.activateHand(f.originalEvent,!0,!0)}),!1})}Ho.$inject=["eventBus","canvas","dragging","injector","toolManager","mouse"],Ho.prototype.activateMove=function(e,t,n){typeof t=="object"&&(n=t,t=!1),this._dragging.init(e,"hand.move",{autoActivate:t,cursor:rx,data:{context:n||{}}})},Ho.prototype.activateHand=function(e,t,n){this._dragging.init(e,"hand",{trapClick:!1,autoActivate:t,cursor:rx,data:{context:{reactivate:n}}})},Ho.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateHand(e,!!e)},Ho.prototype.isActive=function(){var e=this._dragging.context();return e?/^(hand|hand\.move)$/.test(e.prefix):!1};function ox(e){return Gt("Space",e)}const CO={__depends__:[hc,va],__init__:["handTool"],handTool:["type",Ho]};var ax="connect-ok",sx="connect-not-ok";function zo(e,t,n,i,r,o,a){var s=this;this._dragging=t,this._rules=o,this._mouse=a,r.registerTool("global-connect",{tool:"global-connect",dragging:"global-connect.drag"}),e.on("global-connect.hover",function(c){var u=c.context,l=c.hover,f=u.canStartConnect=s.canStartConnect(l);f!==null&&(u.startTarget=l,i.addMarker(l,f?ax:sx))}),e.on(["global-connect.out","global-connect.cleanup"],function(c){var u=c.context.startTarget,l=c.context.canStartConnect;u&&i.removeMarker(u,l?ax:sx)}),e.on(["global-connect.ended"],function(c){var u=c.context,l=u.startTarget,f={x:c.x,y:c.y},p=s.canStartConnect(l);if(p)return e.once("element.out",function(){e.once(["connect.ended","connect.canceled"],function(){e.fire("global-connect.drag.ended")}),n.start(null,l,f)}),!1})}zo.$inject=["eventBus","dragging","connect","canvas","toolManager","rules","mouse"],zo.prototype.start=function(e,t){this._dragging.init(e,"global-connect",{autoActivate:t,trapClick:!1,data:{context:{}}})},zo.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();return this.start(e,!!e)},zo.prototype.isActive=function(){var e=this._dragging.context();return e&&/^global-connect/.test(e.prefix)},zo.prototype.canStartConnect=function(e){return this._rules.allowed("connection.start",{source:e})};const PO={__depends__:[Cf,vi,Bi,hc,va],globalConnect:["type",zo]};function $f(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)}$f.$inject=["palette","create","elementFactory","spaceTool","lassoTool","handTool","globalConnect","translate"],$f.prototype.getPaletteEntries=function(){var e={},t=this._create,n=this._elementFactory,i=this._spaceTool,r=this._lassoTool,o=this._handTool,a=this._globalConnect,s=this._translate;function c(f,p,d,h,m){function g(S){var E=n.createShape(N({type:f},m));t.start(S,E)}return{group:p,className:d,title:h,action:{dragstart:g,click:g}}}function u(f){var p=n.createShape({type:"bpmn:SubProcess",x:0,y:0,isExpanded:!0}),d=n.createShape({type:"bpmn:StartEvent",x:40,y:82,parent:p});t.start(f,[p,d],{hints:{autoSelect:[p]}})}function l(f){t.start(f,n.createParticipantShape())}return N(e,{"hand-tool":{group:"tools",className:"bpmn-icon-hand-tool",title:s("Activate hand tool"),action:{click:function(f){o.activateHand(f)}}},"lasso-tool":{group:"tools",className:"bpmn-icon-lasso-tool",title:s("Activate lasso tool"),action:{click:function(f){r.activateSelection(f)}}},"space-tool":{group:"tools",className:"bpmn-icon-space-tool",title:s("Activate create/remove space tool"),action:{click:function(f){i.activateSelection(f)}}},"global-connect-tool":{group:"tools",className:"bpmn-icon-connection-multi",title:s("Activate global connect tool"),action:{click:function(f){a.start(f)}}},"tool-separator":{group:"tools",separator:!0},"create.start-event":c("bpmn:StartEvent","event","bpmn-icon-start-event-none",s("Create start event")),"create.intermediate-event":c("bpmn:IntermediateThrowEvent","event","bpmn-icon-intermediate-event-none",s("Create intermediate/boundary event")),"create.end-event":c("bpmn:EndEvent","event","bpmn-icon-end-event-none",s("Create end event")),"create.exclusive-gateway":c("bpmn:ExclusiveGateway","gateway","bpmn-icon-gateway-none",s("Create gateway")),"create.task":c("bpmn:Task","activity","bpmn-icon-task",s("Create task")),"create.data-object":c("bpmn:DataObjectReference","data-object","bpmn-icon-data-object",s("Create data object reference")),"create.data-store":c("bpmn:DataStoreReference","data-store","bpmn-icon-data-store",s("Create data store reference")),"create.subprocess-expanded":{group:"activity",className:"bpmn-icon-subprocess-expanded",title:s("Create expanded sub-process"),action:{dragstart:u,click:u}},"create.participant-expanded":{group:"collaboration",className:"bpmn-icon-participant",title:s("Create pool/participant"),action:{dragstart:l,click:l}},"create.group":c("bpmn:Group","artifact","bpmn-icon-group",s("Create group"))}),e};const AO={__depends__:[EO,fc,Iy,RO,CO,PO,ca],__init__:["paletteProvider"],paletteProvider:["type",$f]};var TO=250;function jf(e,t,n,i,r){Q.call(this,e);function o(s){var c=s.canExecute.replacements;k(c,function(u){var l=u.oldElementId,f={type:u.newElementType};if(!s.visualReplacements[l]){var p=t.get(l);N(f,{x:p.x,y:p.y});var d=n.createShape(f);i.addShape(d,p.parent);var h=st('[data-element-id="'+La(p.id)+'"]',s.dragGroup);h&&ce(h,{display:"none"});var m=r.addDragger(d,s.dragGroup);s.visualReplacements[l]=m,i.removeShape(d)}})}function a(s){var c=s.visualReplacements;k(c,function(u,l){var f=st('[data-element-id="'+La(l)+'"]',s.dragGroup);f&&ce(f,{display:"inline"}),u.remove(),c[l]&&delete c[l]})}e.on("shape.move.move",TO,function(s){var c=s.context,u=c.canExecute;c.visualReplacements||(c.visualReplacements={}),u&&u.replacements?o(c):a(c)})}jf.$inject=["eventBus","elementRegistry","elementFactory","canvas","previewSupport"],se(jf,Q);const MO={__depends__:[Mo],__init__:["bpmnReplacePreview"],bpmnReplacePreview:["type",jf]};var kO=1250,Ff=40,OO=20,DO=10,cx=20,ux=["x","y"],LO=Math.abs;function lx(e){e.on(["connect.hover","connect.move","connect.end"],kO,function(t){var n=t.context,i=n.canExecute,r=n.start,o=n.hover,a=n.source,s=n.target;t.originalEvent&&Mn(t.originalEvent)||(n.initialConnectionStart||(n.initialConnectionStart=n.connectionStart),i&&o&&IO(t,o,jO(o)),o&&$O(i,["bpmn:Association","bpmn:DataInputAssociation","bpmn:DataOutputAssociation","bpmn:SequenceFlow"])?(n.connectionStart=Xn(r),Fe(o,["bpmn:Event","bpmn:Gateway"])&&px(t,Xn(o)),Fe(o,["bpmn:Task","bpmn:SubProcess"])&&NO(t,o),v(a,"bpmn:BoundaryEvent")&&s===a.host&&BO(t)):fx(i,"bpmn:MessageFlow")?(v(r,"bpmn:Event")&&(n.connectionStart=Xn(r)),v(o,"bpmn:Event")&&px(t,Xn(o))):n.connectionStart=n.initialConnectionStart)})}lx.$inject=["eventBus"];function IO(e,t,n){ux.forEach(function(i){var r=dx(i,t);e[i]<t[i]+n?$t(e,i,t[i]+n):e[i]>t[i]+r-n&&$t(e,i,t[i]+r-n)})}function NO(e,t){var n=Xn(t);ux.forEach(function(i){FO(e,t,i)&&$t(e,i,n[i])})}function BO(e){var t=e.context,n=t.source,i=t.target;if(!HO(t)){var r=Xn(n),o=en(r,i,-10),a=[];/top|bottom/.test(o)&&a.push("x"),/left|right/.test(o)&&a.push("y"),a.forEach(function(s){var c=e[s],u;LO(c-r[s])<Ff&&(c>r[s]?u=r[s]+Ff:u=r[s]-Ff,$t(e,s,u))})}}function px(e,t){$t(e,"x",t.x),$t(e,"y",t.y)}function fx(e,t){return e&&e.type===t}function $O(e,t){return Ui(t,function(n){return fx(e,n)})}function dx(e,t){return e==="x"?t.width:t.height}function jO(e){return v(e,"bpmn:Task")?DO:OO}function FO(e,t,n){return e[n]>t[n]+cx&&e[n]<t[n]+dx(n,t)-cx}function HO(e){var t=e.hover,n=e.source;return t&&n&&t===n}function Sr(){this._targets={},this._snapOrigins={},this._snapLocations=[],this._defaultSnaps={}}Sr.prototype.getSnapOrigin=function(e){return this._snapOrigins[e]},Sr.prototype.setSnapOrigin=function(e,t){this._snapOrigins[e]=t,this._snapLocations.indexOf(e)===-1&&this._snapLocations.push(e)},Sr.prototype.addDefaultSnap=function(e,t){var n=this._defaultSnaps[e];n||(n=this._defaultSnaps[e]=[]),n.push(t)},Sr.prototype.getSnapLocations=function(){return this._snapLocations},Sr.prototype.setSnapLocations=function(e){this._snapLocations=e},Sr.prototype.pointsForTarget=function(e){var t=e.id||e,n=this._targets[t];return n||(n=this._targets[t]=new bu,n.initDefaults(this._defaultSnaps)),n};function bu(){this._snapValues={}}bu.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)},bu.prototype.snap=function(e,t,n,i){var r=this._snapValues[t];return r&&T2(e[n],r[n],i)},bu.prototype.initDefaults=function(e){var t=this;k(e||{},function(n,i){k(n,function(r){t.add(i,r)})})};var zO=1250;function wi(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"],zO,function(r){var o=r.context,a=o.shape,s=o.snapContext,c=o.target;if(!(r.originalEvent&&Mn(r.originalEvent))&&!(Fo(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()})}wi.$inject=["elementRegistry","eventBus","snapping"],wi.prototype.initSnap=function(e){var t=this._elementRegistry,n=e.context,i=n.shape,r=n.snapContext;r||(r=n.snapContext=new Sr);var o;t.get(i.id)?o=Xn(i,e):o={x:e.x+Xn(i).x,y:e.y+Xn(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}),$e(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},wi.prototype.addSnapTargetPoints=function(e,t,n){var i=this.getSnapTargets(t,n);return k(i,function(r){if($e(r)){$e(t)&&e.add("mid",Xn(r));return}if(ut(r)){if(r.waypoints.length<3)return;var o=r.waypoints.slice(1,-1);k(o,function(a){e.add("mid",a)});return}e.add("mid",Xn(r))}),!ke(t.x)||!ke(t.y)||this._elementRegistry.get(t.id)&&e.add("mid",Xn(t)),e},wi.prototype.getSnapTargets=function(e,t){return J_(t).filter(function(n){return!GO(n)})};function GO(e){return!!e.hidden}var hx=1500;function Go(e,t){t.invoke(wi,this),e.on(["create.move","create.end"],hx,qO),e.on(["create.move","create.end","shape.move.move","shape.move.end"],hx,function(n){var i=n.context,r=i.canExecute,o=i.target,a=r&&(r==="attach"||r.attach);a&&!Fo(n)&&VO(n,o)})}se(Go,wi),Go.$inject=["eventBus","injector"],Go.prototype.initSnap=function(e){var t=wi.prototype.initSnap.call(this,e),n=e.shape,i=!!this._elementRegistry.get(n.id);return k(n.outgoing,function(r){var o=r.waypoints[0];o=o.original||o,t.setSnapOrigin(r.id+"-docking",gx(o,i,e))}),k(n.incoming,function(r){var o=r.waypoints[r.waypoints.length-1];o=o.original||o,t.setSnapOrigin(r.id+"-docking",gx(o,i,e))}),v(n,"bpmn:Participant")&&t.setSnapLocations(["top-left","bottom-right","mid"]),t},Go.prototype.addSnapTargetPoints=function(e,t,n){wi.prototype.addSnapTargetPoints.call(this,e,t,n);var i=this.getSnapTargets(t,n);k(i,function(o){(UO(o)||WO([t,o],"bpmn:TextAnnotation"))&&(e.add("top-left",Z_(o)),e.add("bottom-right",Q_(o)))});var r=this._elementRegistry;return k(t.incoming,function(o){if(r.get(t.id)){mx(i,o.source)||e.add("mid",Pe(o.source));var a=o.waypoints[0];e.add(o.id+"-docking",a.original||a)}}),k(t.outgoing,function(o){if(r.get(t.id)){mx(i,o.target)||e.add("mid",Pe(o.target));var a=o.waypoints[o.waypoints.length-1];e.add(o.id+"-docking",a.original||a)}}),v(n,"bpmn:SequenceFlow")&&(e=this.addSnapTargetPoints(e,t,n.parent)),e},Go.prototype.getSnapTargets=function(e,t){return wi.prototype.getSnapTargets.call(this,e,t).filter(function(n){return!v(n,"bpmn:Lane")})};function VO(e,t){var n=be(t),i=kg(e,t),r=e.context,o=r.shape,a;o.parent?a={x:0,y:0}:a=Pe(o),/top/.test(i)?$t(e,"y",n.top-a.y):/bottom/.test(i)&&$t(e,"y",n.bottom-a.y),/left/.test(i)?$t(e,"x",n.left-a.x):/right/.test(i)&&$t(e,"x",n.right-a.x)}function WO(e,t){return e.every(function(n){return v(n,t)})}function UO(e){return v(e,"bpmn:SubProcess")&&Ve(e)?!0:v(e,"bpmn:Participant")}function qO(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)&&$t(e,"x",e.x),(i&&i>=e.y||o&&o<=e.y)&&$t(e,"y",e.y)}}function mx(e,t){return e.indexOf(t)!==-1}function gx(e,t,n){return t?{x:e.x-n.x,y:e.y-n.y}:{x:e.x,y:e.y}}var YO=1250;function Xa(e,t){var n=this;e.on(["resize.start"],function(i){n.initSnap(i)}),e.on(["resize.move","resize.end"],YO,function(i){var r=i.context,o=r.shape,a=o.parent,s=r.direction,c=r.snapContext;if(!(i.originalEvent&&Mn(i.originalEvent))&&!Fo(i)){var u=c.pointsForTarget(a);u.initialized||(u=n.addSnapTargetPoints(u,o,a,s),u.initialized=!0),ZO(s)&&$t(i,"x",i.x),QO(s)&&$t(i,"y",i.y),t.snap(i,u)}}),e.on(["resize.cleanup"],function(){t.hide()})}Xa.prototype.initSnap=function(e){var t=e.context,n=t.shape,i=t.direction,r=t.snapContext;r||(r=t.snapContext=new Sr);var o=yx(n,i);return r.setSnapOrigin("corner",{x:o.x-e.x,y:o.y-e.y}),r},Xa.prototype.addSnapTargetPoints=function(e,t,n,i){var r=this.getSnapTargets(t,n);return k(r,function(o){e.add("corner",Q_(o)),e.add("corner",Z_(o))}),e.add("corner",yx(t,i)),e},Xa.$inject=["eventBus","snapping"],Xa.prototype.getSnapTargets=function(e,t){return J_(t).filter(function(n){return!KO(n,e)&&!ut(n)&&!XO(n)&&!$e(n)})};function yx(e,t){var n=Pe(e),i=be(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 KO(e,t){return e.host===t}function XO(e){return!!e.hidden}function ZO(e){return e==="n"||e==="s"}function QO(e){return e==="e"||e==="w"}var JO=7,eD=1e3;function Rr(e){this._canvas=e,this._asyncHide=Mu(bn(this.hide,this),eD)}Rr.$inject=["canvas"],Rr.prototype.snap=function(e,t){var n=e.context,i=n.snapContext,r=i.getSnapLocations(),o={x:Fo(e,"x"),y:Fo(e,"y")};k(r,function(a){var s=i.getSnapOrigin(a),c={x:e.x+s.x,y:e.y+s.y};if(k(["x","y"],function(u){var l;o[u]||(l=t.snap(c,a,u,JO),l!==void 0&&(o[u]={value:l,originValue:l-s[u]}))}),o.x&&o.y)return!1}),this.showSnapLine("vertical",o.x&&o.x.value),this.showSnapLine("horizontal",o.y&&o.y.value),k(["x","y"],function(a){var s=o[a];Ut(s)&&$t(e,a,s.originValue)})},Rr.prototype._createLine=function(e){var t=this._canvas.getLayer("snap"),n=ye("path");return ce(n,{d:"M0,0 L0,0"}),We(n).add("djs-snap-line"),De(t,n),{update:function(i){ke(i)?e==="horizontal"?ce(n,{d:"M-100000,"+i+" L+100000,"+i,display:""}):ce(n,{d:"M "+i+",-100000 L "+i+", +100000",display:""}):ce(n,{display:"none"})}}},Rr.prototype._createSnapLines=function(){this._snapLines={horizontal:this._createLine("horizontal"),vertical:this._createLine("vertical")}},Rr.prototype.showSnapLine=function(e,t){var n=this.getSnapLine(e);n&&n.update(t),this._asyncHide()},Rr.prototype.getSnapLine=function(e){return this._snapLines||this._createSnapLines(),this._snapLines[e]},Rr.prototype.hide=function(){k(this._snapLines,function(e){e.update()})};const tD={__depends__:[{__init__:["createMoveSnapping","resizeSnapping","snapping"],createMoveSnapping:["type",wi],resizeSnapping:["type",Xa],snapping:["type",Rr]}],__init__:["connectSnapping","createMoveSnapping"],connectSnapping:["type",lx],createMoveSnapping:["type",Go]};var vx=300;function Le(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=st(Le.INPUT_SELECTOR,this._container),this._resultsContainer=st(Le.RESULTS_CONTAINER_SELECTOR,this._container),this._canvas.getContainer().appendChild(this._container),t.on(["canvas.destroy","diagram.destroy","drag.init","elements.changed"],this.close,this)}Le.$inject=["canvas","eventBus","selection","translate"],Le.prototype._bindEvents=function(){var e=this;function t(n,i,r,o){e._eventMaps.push({el:n,type:r,listener:Pn.bind(n,i,r,o)})}t(document,"html","click",function(n){e.close(!1)}),t(this._container,Le.INPUT_SELECTOR,"click",function(n){n.stopPropagation(),n.delegateTarget.focus()}),t(this._container,Le.RESULT_SELECTOR,"mouseover",function(n){n.stopPropagation(),e._scrollToNode(n.delegateTarget),e._preselect(n.delegateTarget)}),t(this._container,Le.RESULT_SELECTOR,"click",function(n){n.stopPropagation(),e._select(n.delegateTarget)}),t(this._container,Le.INPUT_SELECTOR,"keydown",function(n){Gt("ArrowUp",n)&&n.preventDefault(),Gt("ArrowDown",n)&&n.preventDefault()}),t(this._container,Le.INPUT_SELECTOR,"keyup",function(n){if(Gt("Escape",n))return e.close();if(Gt("Enter",n)){var i=e._getCurrentResult();return i?e._select(i):e.close(!1)}if(Gt("ArrowUp",n))return e._scrollToDirection(!0);if(Gt("ArrowDown",n))return e._scrollToDirection();Gt(["ArrowLeft","ArrowRight"],n)||e._search(n.delegateTarget.value)})},Le.prototype._unbindEvents=function(){this._eventMaps.forEach(function(e){Pn.unbind(e.el,e.type,e.listener)})},Le.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=st(Le.RESULT_SELECTOR,this._resultsContainer);this._scrollToNode(i),this._preselect(i)}},Le.prototype._scrollToDirection=function(e){var t=this._getCurrentResult();if(t){var n=e?t.previousElementSibling:t.nextElementSibling;n&&(this._scrollToNode(n),this._preselect(n))}},Le.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)}},Le.prototype._clearResults=function(){vs(this._resultsContainer),this._results={},this._eventBus.fire("searchPad.cleared")},Le.prototype._getCurrentResult=function(){return st(Le.RESULT_SELECTED_SELECTOR,this._resultsContainer)},Le.prototype._createResultNode=function(e,t){var n=mt(Le.RESULT_HTML);return e.primaryTokens.length>0&&_x(n,e.primaryTokens,Le.RESULT_PRIMARY_HTML),_x(n,e.secondaryTokens,Le.RESULT_SECONDARY_HTML),ln(n,Le.RESULT_ID_ATTRIBUTE,t),this._resultsContainer.appendChild(n),n},Le.prototype.registerProvider=function(e){this._searchProvider=e},Le.prototype.open=function(){if(!this._searchProvider)throw new Error("no search provider registered");this.isOpen()||(this._cachedRootElement=this._canvas.getRootElement(),this._cachedSelection=this._selection.get(),this._cachedViewbox=this._canvas.viewbox(),this._selection.select(null),this._bindEvents(),this._open=!0,bt(this._canvas.getContainer()).add("djs-search-open"),bt(this._container).add("open"),this._searchInput.focus(),this._eventBus.fire("searchPad.opened"))},Le.prototype.close=function(e=!0){this.isOpen()&&(e&&(this._cachedRootElement&&this._canvas.setRootElement(this._cachedRootElement),this._cachedSelection&&this._selection.select(this._cachedSelection),this._cachedViewbox&&this._canvas.viewbox(this._cachedViewbox),this._eventBus.fire("searchPad.restored")),this._cachedRootElement=null,this._cachedSelection=null,this._cachedViewbox=null,this._unbindEvents(),this._open=!1,bt(this._canvas.getContainer()).remove("djs-search-open"),bt(this._container).remove("open"),this._clearResults(),this._searchInput.value="",this._searchInput.blur(),this._eventBus.fire("searchPad.closed"),this._canvas.restoreFocus())},Le.prototype.toggle=function(){this.isOpen()?this.close():this.open()},Le.prototype.isOpen=function(){return this._open},Le.prototype._preselect=function(e){var t=this._getCurrentResult();if(e!==t){t&&bt(t).remove(Le.RESULT_SELECTED_CLASS);var n=ln(e,Le.RESULT_ID_ATTRIBUTE),i=this._results[n].element;bt(e).add(Le.RESULT_SELECTED_CLASS),this._canvas.scrollToElement(i,{top:vx}),this._selection.select(i),this._eventBus.fire("searchPad.preselected",i)}},Le.prototype._select=function(e){var t=ln(e,Le.RESULT_ID_ATTRIBUTE),n=this._results[t].element;this._cachedSelection=null,this._cachedViewbox=null,this.close(!1),this._canvas.scrollToElement(n,{top:vx}),this._selection.select(n),this._eventBus.fire("searchPad.selected",n)},Le.prototype._getBoxHtml=function(){const e=mt(Le.BOX_HTML),t=st(Le.INPUT_SELECTOR,e);return t&&t.setAttribute("aria-label",this._translate("Search in diagram")),e};function _x(e,t,n){var i=nD(t),r=mt(n);r.innerHTML=i,e.appendChild(r)}function nD(e){var t="";return e.forEach(function(n){var i=Pv(n.value||n.matched||n.normal),r=n.match||n.matched;r?t+='<b class="'+Le.RESULT_HIGHLIGHT_CLASS+'">'+i+"</b>":t+=i}),t!==""?t:null}Le.CONTAINER_SELECTOR=".djs-search-container",Le.INPUT_SELECTOR=".djs-search-input input",Le.RESULTS_CONTAINER_SELECTOR=".djs-search-results",Le.RESULT_SELECTOR=".djs-search-result",Le.RESULT_SELECTED_CLASS="djs-search-result-selected",Le.RESULT_SELECTED_SELECTOR="."+Le.RESULT_SELECTED_CLASS,Le.RESULT_ID_ATTRIBUTE="data-result-id",Le.RESULT_HIGHLIGHT_CLASS="djs-search-highlight",Le.BOX_HTML=`<div class="djs-search-container djs-scrollable">
|
|
335
|
+
</svg>`},mk=900;function Wa(e,t,n,i){this._distributeElements=t,this._translate=n,this._popupMenu=e,this._rules=i,e.registerProvider("align-elements",mk,this)}Wa.$inject=["popupMenu","distributeElements","translate","rules"],Wa.prototype.getPopupMenuEntries=function(e){var t={};return this._isAllowed(e)&&j(t,this._getEntries(e)),t},Wa.prototype._isAllowed=function(e){return this._rules.allowed("elements.distribute",{elements:e})},Wa.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:_b.horizontal,action:function(o,a){t.trigger(e,"horizontal"),i.close()}},"distribute-elements-vertical":{group:"distribute",title:n("Distribute elements vertically"),imageHtml:_b.vertical,action:function(o,a){t.trigger(e,"vertical"),i.close()}}};return r};const gk={__depends__:[bf,hk],__init__:["bpmnDistributeElements","distributeElementsMenuProvider"],bpmnDistributeElements:["type",uu],distributeElementsMenuProvider:["type",Wa]};var bb="is not a registered action",yk="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 f=s.allowed("elements.delete",{elements:l});if(f!==!1){var p=xe(f)?f:l;return o.cut(p.slice())}}}),r&&this.register("stepZoom",function(l){r.stepZoom(l.value)}),a&&this.register("zoom",function(l){a.zoom(l.value)}),n&&i&&s&&this.register("removeSelection",function(){var l=i.get();if(l.length){var f=s.allowed("elements.delete",{elements:l}),p;f!==!1&&(xe(f)?p=f:p=l,p.length&&n.removeElements(p.slice()))}}),c&&this.register("moveCanvas",function(l){c.moveCanvas(l)}),u&&this.register("moveSelection",function(l){u.moveSelection(l.direction,l.accelerated)})},Qn.prototype.trigger=function(e,t){if(!this._actions[e])throw Mf(e,bb);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);D(e,function(i,r){n._registerAction(r,i)})},Qn.prototype._registerAction=function(e,t){if(this.isRegistered(e))throw Mf(e,yk);this._actions[e]=t},Qn.prototype.unregister=function(e){if(!this.isRegistered(e))throw Mf(e,bb);this._actions[e]=void 0},Qn.prototype.getActions=function(){return Object.keys(this._actions)},Qn.prototype.isRegistered=function(e){return!!this._actions[e]};function Mf(e,t){return new Error(e+" "+t)}const vk={__init__:["editorActions"],editorActions:["type",Qn]};function lu(e){e.invoke(Qn,this)}se(lu,Qn),lu.$inject=["injector"],lu.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),f=e.get("searchPad",!1),p=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=$e(m,function(E){return!v(E,"bpmn:Lane")}),u.trigger(g,S))}),i&&p&&this._registerAction("setColor",function(h){var m=i.get();m.length&&p.setColor(m,h)}),i&&l&&this._registerAction("directEditing",function(){var h=i.get();h.length&&l.activate(h[0])}),f&&this._registerAction("find",function(){f.toggle()}),t&&p&&this._registerAction("moveToOrigin",function(){var h=t.getRootElement(),m,g;v(h,"bpmn:Collaboration")?g=n.filter(function(S){return v(S.parent,"bpmn:Collaboration")}):g=n.filter(function(S){return S!==h&&!v(S.parent,"bpmn:SubProcess")}),m=Lt(g),p.moveElements(g,{x:-m.x,y:-m.y},h)}),i&&d&&this._registerAction("replaceElement",function(h){d.triggerEntry("replace","click",h)})};const _k={__depends__:[vk],editorActions:["type",lu]};function xb(e){e.on(["create.init","shape.move.init"],function(t){var n=t.context,i=t.shape;Be(i,["bpmn:Participant","bpmn:SubProcess","bpmn:TextAnnotation"])&&(n.gridSnappingContext||(n.gridSnappingContext={}),n.gridSnappingContext.snapLocation="top-left")})}xb.$inject=["eventBus"];function Yr(e,t){Q.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;En(a)?r.newBounds=n.snapComplex(c,a):r.newBounds=n.snapSimple(s,c)}})}Yr.$inject=["eventBus","gridSnapping","modeling"],se(Yr,Q),Yr.prototype.snapSimple=function(e,t){var n=this._gridSnapping;return t.width=n.snapValue(t.width,{min:t.width}),t.height=n.snapValue(t.height,{min:t.height}),t.x=e.x+e.width/2-t.width/2,t.y=e.y+e.height/2-t.height/2,t},Yr.prototype.snapComplex=function(e,t){return/w|e/.test(t)&&(e=this.snapHorizontally(e,t)),/n|s/.test(t)&&(e=this.snapVertically(e,t)),e},Yr.prototype.snapHorizontally=function(e,t){var n=this._gridSnapping,i=/w/.test(t),r=/e/.test(t),o={};return o.width=n.snapValue(e.width,{min:e.width}),r&&(i?(o.x=n.snapValue(e.x,{max:e.x}),o.width+=n.snapValue(e.x-o.x,{min:e.x-o.x})):e.x=e.x+e.width-o.width),j(e,o),e},Yr.prototype.snapVertically=function(e,t){var n=this._gridSnapping,i=/n/.test(t),r=/s/.test(t),o={};return o.height=n.snapValue(e.height,{min:e.height}),i&&(r?(o.y=n.snapValue(e.y,{max:e.y}),o.height+=n.snapValue(e.y-o.y,{min:e.y-o.y})):e.y=e.y+e.height-o.height),j(e,o),e};var bk=2e3;function wb(e,t){e.on(["spaceTool.move","spaceTool.end"],bk,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)}})}wb.$inject=["eventBus","gridSnapping"];const xk={__init__:["gridSnappingResizeBehavior","gridSnappingSpaceToolBehavior"],gridSnappingResizeBehavior:["type",Yr],gridSnappingSpaceToolBehavior:["type",wb]};var pu=10;function kf(e,t,n){return n||(n="round"),Math[n](e/t)*t}var wk=1200,Ek=800;function br(e,t,n){var i=!n||n.active!==!1;this._eventBus=t;var r=this;t.on("diagram.init",Ek,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"],wk,function(o){var a=o.originalEvent;if(!(!r.active||a&&Mn(a))){var s=o.context,c=s.gridSnappingContext;c||(c=s.gridSnappingContext={}),["x","y"].forEach(function(u){var l={},f=Rk(o,u,e);f&&(l.offset=f);var p=Sk(o,u);p&&j(l,p),Fo(o,u)||r.snapEvent(o,u,l)})}})}br.prototype.snapEvent=function(e,t,n){var i=this.snapValue(e[t],n);$t(e,t,i)},br.prototype.getGridSpacing=function(){return pu},br.prototype.snapValue=function(e,t){var n=0;t&&t.offset&&(n=t.offset),e+=n,e=kf(e,pu);var i,r;return t&&t.min&&(i=t.min,Ce(i)&&(i=kf(i+n,pu,"ceil"),e=Math.max(e,i))),t&&t.max&&(r=t.max,Ce(r)&&(r=kf(r+n,pu,"floor"),e=Math.min(e,r))),e-=n,e},br.prototype.isActive=function(){return this.active},br.prototype.setActive=function(e){this.active=e,this._eventBus.fire("gridSnapping.toggle",{active:e})},br.prototype.toggleActive=function(){this.setActive(!this.active)},br.$inject=["elementRegistry","eventBus","config.gridSnapping"];function Sk(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&&(fu(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&&(fu(t)?Sb(s)?a.x.max=c.left:a.x.min=c.right:Eb(s)?a.y.max=c.top:a.y.min=c.bottom),u&&(fu(t)?Sb(s)?a.x.min=u.left:a.x.max=u.right:Eb(s)?a.y.min=u.top:a.y.max=u.bottom),a[t]}function Rk(e,t,n){var i=e.context,r=e.shape,o=i.gridSnappingContext,a=o.snapLocation,s=o.snapOffset;return s&&Ce(s[t])||(s||(s=o.snapOffset={}),Ce(s[t])||(s[t]=0),!r)||(n.get(r.id)||(fu(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 fu(e){return e==="x"}function Eb(e){return e.indexOf("n")!==-1}function Sb(e){return e.indexOf("w")!==-1}const Ck={__depends__:[xk],__init__:["gridSnapping"],gridSnapping:["type",br]};var Pk=2e3;function Rb(e,t,n){e.on("autoPlace",Pk,function(i){var r=i.source,o=we(r),a=i.shape,s=Sv(r,a,n);return["x","y"].forEach(function(c){var u={};s[c]!==o[c]&&(s[c]>o[c]?u.min=s[c]:u.max=s[c],v(a,"bpmn:TextAnnotation")&&(Ak(c)?u.offset=-a.width/2:u.offset=-a.height/2),s[c]=t.snapValue(s[c],u))}),s})}Rb.$inject=["eventBus","gridSnapping","elementRegistry"];function Ak(e){return e==="x"}var Tk=1750;function Cb(e,t,n){t.on(["create.start","shape.move.start"],Tk,function(i){var r=i.context,o=r.shape,a=e.getRootElement();if(!(!v(o,"bpmn:Participant")||!v(a,"bpmn:Process")||!a.children.length)){var s=r.createConstraints;s&&(o.width=n.snapValue(o.width,{min:o.width}),o.height=n.snapValue(o.height,{min:o.height}))}})}Cb.$inject=["canvas","eventBus","gridSnapping"];var Mk=3e3;function du(e,t,n){Q.call(this,e),this._gridSnapping=t;var i=this;this.postExecuted(["connection.create","connection.layout"],Mk,function(r){var o=r.context,a=o.connection,s=o.hints||{},c=a.waypoints;s.connectionStart||s.connectionEnd||s.createElementsBehavior===!1||kk(c)&&n.updateWaypoints(a,i.snapMiddleSegments(c))})}du.$inject=["eventBus","gridSnapping","modeling"],se(du,Q),du.prototype.snapMiddleSegments=function(e){var t=this._gridSnapping,n;e=e.slice();for(var i=1;i<e.length-2;i++)n=Lk(t,e[i],e[i+1]),e[i]=n[0],e[i+1]=n[1];return e};function kk(e){return e.length>3}function Ok(e){return e==="h"}function Dk(e){return e==="v"}function Lk(e,t,n){var i=Di(t,n),r={};return Ok(i)&&(r.y=e.snapValue(t.y)),Dk(i)&&(r.x=e.snapValue(t.x)),("x"in r||"y"in r)&&(t=j({},t,r),n=j({},n,r)),[t,n]}const Ik={__depends__:[Ck,{__init__:["gridSnappingAutoPlaceBehavior","gridSnappingParticipantBehavior","gridSnappingLayoutConnectionBehavior"],gridSnappingAutoPlaceBehavior:["type",Rb],gridSnappingParticipantBehavior:["type",Cb],gridSnappingLayoutConnectionBehavior:["type",du]}],__init__:["bpmnGridSnapping"],bpmnGridSnapping:["type",xb]};var Nk=30,Pb=30;function Ua(e,t){this._interactionEvents=t;var n=this;e.on(["interactionEvents.createHit","interactionEvents.updateHit"],function(i){var r=i.element,o=i.gfx;if(v(r,"bpmn:Lane"))return n._createParticipantHit(r,o);if(v(r,"bpmn:Participant"))return Ge(r)?n._createParticipantHit(r,o):n._createDefaultHit(r,o);if(v(r,"bpmn:SubProcess"))return Ge(r)?n._createSubProcessHit(r,o):n._createDefaultHit(r,o)})}Ua.$inject=["eventBus","interactionEvents"],Ua.prototype._createDefaultHit=function(e,t){return this._interactionEvents.removeHits(t),this._interactionEvents.createDefaultHit(e,t),!0},Ua.prototype._createParticipantHit=function(e,t){this._interactionEvents.removeHits(t),this._interactionEvents.createBoxHit(t,"no-move",{width:e.width,height:e.height}),this._interactionEvents.createBoxHit(t,"click-stroke",{width:e.width,height:e.height});var n=Yt(e)?{width:Nk,height:e.height}:{width:e.width,height:Pb};return this._interactionEvents.createBoxHit(t,"all",n),!0},Ua.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:Pb}),!0};const Bk={__init__:["bpmnInteractionEvents"],bpmnInteractionEvents:["type",Ua]};function hu(e){e.invoke(Do,this)}se(hu,Do),hu.$inject=["injector"],hu.prototype.registerBindings=function(e,t){Do.prototype.registerBindings.call(this,e,t);function n(i,r){t.isRegistered(i)&&e.addListener(r)}n("selectElements",function(i){var r=i.keyEvent;if(e.isKey(["a","A"],r)&&e.isCmd(r))return t.trigger("selectElements"),!0}),n("find",function(i){var r=i.keyEvent;if(e.isKey(["f","F"],r)&&e.isCmd(r))return t.trigger("find"),!0}),n("spaceTool",function(i){var r=i.keyEvent;if(!e.hasModifier(r)&&e.isKey(["s","S"],r))return t.trigger("spaceTool"),!0}),n("lassoTool",function(i){var r=i.keyEvent;if(!e.hasModifier(r)&&e.isKey(["l","L"],r))return t.trigger("lassoTool"),!0}),n("handTool",function(i){var r=i.keyEvent;if(!e.hasModifier(r)&&e.isKey(["h","H"],r))return t.trigger("handTool"),!0}),n("globalConnectTool",function(i){var r=i.keyEvent;if(!e.hasModifier(r)&&e.isKey(["c","C"],r))return t.trigger("globalConnectTool"),!0}),n("directEditing",function(i){var r=i.keyEvent;if(!e.hasModifier(r)&&e.isKey(["e","E"],r))return t.trigger("directEditing"),!0}),n("replaceElement",function(i){var r=i.keyEvent;if(!e.hasModifier(r)&&e.isKey(["r","R"],r))return t.trigger("replaceElement",r),!0})};const $k={__depends__:[of],__init__:["keyboardBindings"],keyboardBindings:["type",hu]};var jk={moveSpeed:1,moveSpeedAccelerated:10},Fk=1500,Ab="left",Tb="up",Mb="right",kb="down",Hk={ArrowLeft:Ab,Left:Ab,ArrowUp:Tb,Up:Tb,ArrowRight:Mb,Right:Mb,ArrowDown:kb,Down:kb},zk={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 Ob(e,t,n,i,r){var o=this;this._config=j({},jk,e||{}),t.addListener(Fk,function(a){var s=a.keyEvent,c=Hk[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=zk[a](u),f=i.allowed("elements.move",{shapes:c,hints:{keyboardMove:!0}});f&&n.moveElements(c,l)}}}Ob.$inject=["config.keyboardMoveSelection","keyboard","modeling","rules","selection"];const Gk={__depends__:[of,qn],__init__:["keyboardMoveSelection"],keyboardMoveSelection:["type",Ob]};var Db=10;function qa(e,t,n,i){this._dragging=i,this._rules=t;var r=this;function o(c,u){var l=c.shape,f=c.direction,p=c.resizeConstraints,d;c.delta=u,d=jR(l,f,u),c.newBounds=HR(d,p),c.canExecute=r.canResize(c)}function a(c){var u=c.resizeConstraints,l=c.minBounds;u===void 0&&(l===void 0&&(l=r.computeMinResizeBox(c)),c.resizeConstraints={min:ve(l)})}function s(c){var u=c.shape,l=c.canExecute,f=c.newBounds;if(l){if(f=Xh(f),!Vk(u,f))return;n.resizeShape(u,f)}}e.on("resize.start",function(c){a(c.context)}),e.on("resize.move",function(c){var u={x:c.dx,y:c.dy};o(c.context,u)}),e.on("resize.end",function(c){s(c.context)})}qa.prototype.canResize=function(e){var t=this._rules,n=ii(e,["newBounds","shape","delta","direction"]);return t.allowed("shape.resize",n)},qa.prototype.activate=function(e,t,n){var i=this._dragging,r,o;if(typeof n=="string"&&(n={direction:n}),r=j({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,Lb(t,o),"resize",{autoActivate:!0,cursor:Wk(o),data:{shape:t,context:r}})},qa.prototype.computeMinResizeBox=function(e){var t=e.shape,n=e.direction,i,r;return i=e.minDimensions||{width:Db,height:Db},r=Bm(t,e.childrenBoxPadding),zR(n,t,i,r)},qa.$inject=["eventBus","rules","modeling","dragging"];function Vk(e,t){return e.x!==t.x||e.y!==t.y||e.width!==t.width||e.height!==t.height}function Lb(e,t){var n=we(e),i=ve(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 Wk(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 Ib="djs-resizing",Nb="resize-not-ok",Uk=500;function Bb(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,Ib)),s.width>5&&ce(c,{x:s.x,width:s.width}),s.height>5&&ce(c,{y:s.y,height:s.height}),o.canExecute?Ve(c).remove(Nb):Ve(c).add(Nb)}function r(o){var a=o.shape,s=o.frame;s&&zt(o.frame),t.removeMarker(a,Ib)}e.on("resize.move",Uk,function(o){i(o.context)}),e.on("resize.cleanup",function(o){r(o.context)})}Bb.$inject=["eventBus","canvas","previewSupport"];var mu=-6,gu=8,yu=20,Ya="djs-resizer",qk=["n","w","s","e","nw","ne","se","sw"];function xr(e,t,n,i){this._resize=i,this._canvas=t;var r=this;e.on("selection.changed",function(o){var a=o.newSelection;r.removeResizers(),a.length===1&&D(a,bn(r.addResizer,r))}),e.on("shape.changed",function(o){var a=o.element;n.isSelected(a)&&(r.removeResizers(),r.addResizer(a))})}xr.prototype.makeDraggable=function(e,t,n){var i=this._resize;function r(o){ur(o)&&i.activate(o,e,n)}Te.bind(t,"mousedown",r),Te.bind(t,"touchstart",r)},xr.prototype._createResizer=function(e,t,n,i){var r=this._getResizersParent(),o=Yk(i),a=ge("g");Ve(a).add(Ya),Ve(a).add(Ya+"-"+e.id),Ve(a).add(Ya+"-"+i),ke(r,a);var s=ge("rect");ce(s,{x:-gu/2+o.x,y:-gu/2+o.y,width:gu,height:gu}),Ve(s).add(Ya+"-visual"),ke(a,s);var c=ge("rect");return ce(c,{x:-yu/2+o.x,y:-yu/2+o.y,width:yu,height:yu}),Ve(c).add(Ya+"-hit"),ke(a,c),ks(a,t,n),a},xr.prototype.createResizer=function(e,t){var n=Lb(e,t),i=this._createResizer(e,n.x,n.y,t);this.makeDraggable(e,i,t)},xr.prototype.addResizer=function(e){var t=this;st(e)||D(qk,function(n){t._resize.canResize({shape:e,direction:n})&&t.createResizer(e,n)})},xr.prototype.removeResizers=function(){var e=this._getResizersParent();ws(e)},xr.prototype._getResizersParent=function(){return this._canvas.getLayer("resizers")},xr.$inject=["eventBus","canvas","selection","resize"];function Yk(e){var t={x:0,y:0};return e.indexOf("e")!==-1?t.x=-mu:e.indexOf("w")!==-1&&(t.x=mu),e.indexOf("s")!==-1?t.y=-mu:e.indexOf("n")!==-1&&(t.y=mu),t}const $b={__depends__:[vi,ji,Mo],__init__:["resize","resizePreview","resizeHandles"],resize:["type",qa],resizePreview:["type",Bb],resizeHandles:["type",xr]};var Kk=2e3;function Ka(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"],Kk,function(c){i.isActive(c.element)&&i.cancel()}),e.on(["commandStack.changed"],function(c){i.isActive()&&i.cancel()}),e.on("directEditing.activate",function(c){o.removeResizers()}),e.on("create.end",500,function(c){var u=c.context,l=u.shape,f=c.context.canExecute,p=c.isTouch;p||f&&(u.hints&&u.hints.createElementsBehavior===!1||s(l))}),e.on("autoPlace.end",500,function(c){s(c.shape)});function s(c,u){(u||Be(c,["bpmn:Activity","bpmn:Event","bpmn:TextAnnotation","bpmn:Participant"]))&&i.activate(c)}}Ka.$inject=["eventBus","bpmnFactory","canvas","directEditing","modeling","resizeHandles","textRenderer"],Ka.prototype.activate=function(e){var t=$n(e);if(t!==void 0){var n={text:t},i=this.getEditingBBox(e);j(n,i);var r={},o=n.style||{};return j(o,{backgroundColor:null,border:null}),(Be(e,["bpmn:Task","bpmn:Participant","bpmn:Lane","bpmn:CallActivity"])||jb(e))&&j(r,{centerVertically:!0}),or(e)&&(j(r,{resizable:!0,autoResize:!0}),j(o,{backgroundColor:"#ffffff",border:"1px solid #ccc"})),v(e,"bpmn:TextAnnotation")&&(j(r,{resizable:!0,autoResize:!0}),j(o,{backgroundColor:"#ffffff",border:"1px solid #ccc"})),j(n,{options:r,style:o}),n}},Ka.prototype.getEditingBBox=function(e){var t=this._canvas,n=e.label||e,i=t.getAbsoluteBBox(n),r={x:i.x+i.width/2,y:i.y+i.height/2},o={x:i.x,y:i.y},a=t.zoom(),s=this._textRenderer.getDefaultStyle(),c=this._textRenderer.getExternalStyle(),u=c.fontSize*a,l=c.lineHeight,f=s.fontSize*a,p=s.lineHeight,d={fontFamily:this._textRenderer.getDefaultStyle().fontFamily,fontWeight:this._textRenderer.getDefaultStyle().fontWeight};if(v(e,"bpmn:Lane")||Qk(e)){var h=Yt(e),m=h?{width:i.height,height:30*a,x:i.x-i.height/2+15*a,y:r.y-30*a/2}:{width:i.width,height:30*a};j(o,m),j(d,{fontSize:f+"px",lineHeight:p,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px",transform:h?"rotate(-90deg)":null})}if(Zk(e)){var g=Yt(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};j(o,S),j(d,{fontSize:f+"px",lineHeight:p,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px",transform:g?null:"rotate(-90deg)"})}(Be(e,["bpmn:Task","bpmn:CallActivity"])||jb(e))&&(j(o,{width:i.width,height:i.height}),j(d,{fontSize:f+"px",lineHeight:p,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px"})),Xk(e)&&(j(o,{width:i.width,x:i.x}),j(d,{fontSize:f+"px",lineHeight:p,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px"}));var E=1,x=i.width+2*E;if(n.labelTarget&&(j(o,{width:x,height:i.height+2*E,x:i.x-E,y:i.y-E}),j(d,{fontSize:u+"px",lineHeight:l})),or(n)&&!Ls(n)&&!Ne(n)){var w=vl(e),C=t.getAbsoluteBBox({x:w.x,y:w.y,width:0,height:0}),P=u,L=Nr.width*a+2*E;j(o,{width:L,height:P+2*E,x:C.x-L/2,y:C.y-P/2-E}),j(d,{fontSize:u+"px",lineHeight:l})}return v(e,"bpmn:TextAnnotation")&&(j(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}),j(d,{textAlign:"left",paddingTop:yo*a+"px",paddingBottom:yo*a+"px",paddingLeft:yo*a+"px",paddingRight:yo*a+"px",fontSize:f+"px",lineHeight:p})),{bounds:o,style:d}},Ka.prototype.update=function(e,t,n,i){var r,o;v(e,"bpmn:TextAnnotation")&&(o=this._canvas.getAbsoluteBBox(e),r={x:e.x,y:e.y,width:e.width/o.width*i.width,height:e.height/o.height*i.height}),Jk(t)&&(t=null),this._modeling.updateLabel(e,t,r)};function jb(e){return v(e,"bpmn:SubProcess")&&!Ge(e)}function Xk(e){return v(e,"bpmn:SubProcess")&&Ge(e)}function Zk(e){return v(e,"bpmn:Participant")&&!Ge(e)}function Qk(e){return v(e,"bpmn:Participant")&&Ge(e)}function Jk(e){return!e||!e.trim()}var Fb="djs-element-hidden",Hb="djs-label-hidden";function zb(e,t,n){var i=this,r=t.getDefaultLayer(),o,a,s;e.on("directEditing.activate",function(c){var u=c.active;if(o=u.element.label||u.element,v(o,"bpmn:TextAnnotation")){a=t.getAbsoluteBBox(o),s=ge("g");var l=n.getScaledPath("TEXT_ANNOTATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:o.width,containerHeight:o.height,position:{mx:0,my:0}}),f=i.path=ge("path");ce(f,{d:l,strokeWidth:2,stroke:eO(o)}),ke(s,f),ke(r,s),nn(s,o.x,o.y)}v(o,"bpmn:TextAnnotation")||o.labelTarget?t.addMarker(o,Fb):(v(o,"bpmn:Task")||v(o,"bpmn:CallActivity")||v(o,"bpmn:SubProcess")||v(o,"bpmn:Participant")||v(o,"bpmn:Lane"))&&t.addMarker(o,Hb)}),e.on("directEditing.resize",function(c){if(v(o,"bpmn:TextAnnotation")){var u=c.height,l=c.dy,f=Math.max(o.height/a.height*(u+l),0),p=n.getScaledPath("TEXT_ANNOTATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:o.width,containerHeight:f,position:{mx:0,my:0}});ce(i.path,{d:p})}}),e.on(["directEditing.complete","directEditing.cancel"],function(c){var u=c.active;u&&(t.removeMarker(u.element.label||u.element,Fb),t.removeMarker(o,Hb)),o=void 0,a=void 0,s&&(zt(s),s=void 0)})}zb.$inject=["eventBus","canvas","pathMap"];function eO(e,t){var n=Ye(e);return n.get("stroke")||t||"black"}const tO={__depends__:[Np,$b,db],__init__:["labelEditingProvider","labelEditingPreview"],labelEditingProvider:["type",Ka],labelEditingPreview:["type",zb]};var nO=500,iO=1e3;function xi(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){H1(o)||i.createOutline(o)}e.on("element.hover",function(o){r(o.element)}),e.on("selection.changed",function(o){D(o.newSelection,r)}),e.on(["shape.changed","connection.changed"],nO,function(o){var a=o.element,s=o.gfx,c=rt(".djs-outline",s);c&&i.updateOutline(a,c)})}xi.prototype.createOutline=function(e){var t=this._elementRegistry.getGraphics(e);if(!t)throw new Error("cannot create outline for non-rendered element");var n=rt(".djs-outline",t);return n||(n=this.getOutline(e)||this._createOutlineGfx(),ke(t,n),this.updateOutline(e,n)),n},xi.prototype._createOutlineGfx=function(){var e=ge("rect");return ce(e,j({x:0,y:0,rx:4,width:100,height:100},this._outlineStyle)),e},xi.prototype.updateOutline=function(e,t){e.waypoints?this.updateConnectionOutline(t,e):this.updateShapeOutline(t,e)},xi.prototype.updateShapeOutline=function(e,t){var n=!1,i=this._getProviders();i.length&&D(i,function(r){n=n||r.updateOutline(t,e)}),n||ce(e,{x:-this._outlineOffset,y:-this._outlineOffset,width:t.width+this._outlineOffset*2,height:t.height+this._outlineOffset*2})},xi.prototype.updateConnectionOutline=function(e,t){var n=Lt(t);ce(e,{x:n.x-this._outlineOffset,y:n.y-this._outlineOffset,width:n.width+this._outlineOffset*2,height:n.height+this._outlineOffset*2})},xi.prototype.registerProvider=function(e,t){t||(t=e,e=iO),this._eventBus.on("outline.getProviders",e,function(n){n.providers.push(t)})},xi.prototype._getProviders=function(){var e=this._eventBus.createEvent({type:"outline.getProviders",providers:[]});return this._eventBus.fire(e),e.providers},xi.prototype.getOutline=function(e){var t,n=this._getProviders();return D(n,function(i){qt(i.getOutline)&&(t=t||i.getOutline(e))}),t},xi.$inject=["eventBus","styles","elementRegistry"];var vu=6;function Of(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)})}Of.prototype._updateMultiSelectionOutline=function(e){var t=this._canvas.getLayer("selectionOutline");ws(t);var n=e.length>1,i=this._canvas.getContainer();if(Ve(i)[n?"add":"remove"]("djs-multi-select"),!!n){var r=rO(Lt(e)),o=ge("rect");ce(o,j({rx:3},r)),Ve(o).add("djs-selection-outline"),ke(t,o)}},Of.$inject=["eventBus","canvas","selection"];function rO(e){return{x:e.x-vu,y:e.y-vu,width:e.width+vu*2,height:e.height+vu*2}}const Df={__depends__:[qn],__init__:["outline","multiSelectionOutline"],outline:["type",xi],multiSelectionOutline:["type",Of]},Gb=["bpmn:Event","bpmn:SequenceFlow","bpmn:Gateway"],Vb={class:"bjs-label-link",stroke:"var(--element-selected-outline-secondary-stroke-color)",strokeDasharray:"5, 5"},oO=15,_u=2;function Wb(e,t,n,i,r){const o=t.getLayer("overlays");e.on(["selection.changed","shape.changed"],function(){s()}),e.on("selection.changed",function({newSelection:f}){var d;const p=f.filter(h=>Be(h,Gb));if(p.length===1){const h=p[0];Ne(h)?a(h,h.labelTarget):(d=h.labels)!=null&&d.length&&a(h.labels[0],h)}if(p.length===2){const h=p.find(Ne),m=p.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:f}){var p;!Be(f,Gb)||!l(f)||(Ne(f)?a(f,f.labelTarget):(p=f.labels)!=null&&p.length&&a(f.labels[0],f))});function a(f,p){const d=Qo([we(p),we(f)],Vb),h=d.getAttribute("d"),g=r.isSelected(f)?c(f):u(f),S=na(g,h);if(!S)return;const x=r.isSelected(p)?c(p):u(p),w=na(x,h)||we(p);fa(w,S)<oO||(ll(d,[w,S]),ke(o,d))}function s(){xs(`.${Vb.class}`,o).forEach(zt)}function c(f){const p=i.getOutline(f);if(!p)return u(f);if(p.x){const d={x:f.x+wr(p,"x")-_u,y:f.y+wr(p,"y")-_u,width:wr(p,"width")+_u*2,height:wr(p,"height")+_u*2};return bl(d,wr(p,"rx"))}if(p.cx){const d=wr(p,"r"),h={x:f.x+wr(p,"cx")-d,y:f.y+wr(p,"cy")-d,width:d*2,height:d*2};return bm(h)}}function u(f){return n.getShapePath(f)}function l(f){return r.isSelected(f)}}Wb.$inject=["eventBus","canvas","graphicsFactory","outline","selection"];function wr(e,t){return parseFloat(ce(e,t)||0)}const aO={__depends__:[qn,Df],__init__:["labelLink"],labelLink:["type",Wb]};var sO=new To("tt");function cO(e){var t=dt('<div class="djs-tooltip-container" />');return mn(t,{position:"absolute",width:"0",height:"0"}),e.insertBefore(t,e.firstChild),t}function uO(e,t,n){mn(e,{left:t+"px",top:n+"px"})}function Lf(e,t){e.style.display=t===!1?"none":""}var Ub="djs-tooltip",If="."+Ub;function wn(e,t){this._eventBus=e,this._canvas=t,this._ids=sO,this._tooltipDefaults={show:{minZoom:.7,maxZoom:5}},this._tooltips={},this._tooltipRoot=cO(t.getContainer());var n=this;Pn.bind(this._tooltipRoot,If,"mousedown",function(i){i.stopPropagation()}),Pn.bind(this._tooltipRoot,If,"mouseover",function(i){n.trigger("mouseover",i)}),Pn.bind(this._tooltipRoot,If,"mouseout",function(i){n.trigger("mouseout",i)}),this._init()}wn.$inject=["eventBus","canvas"],wn.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=j({},this._tooltipDefaults,e,{id:t}),this._addTooltip(e),e.timeout&&this.setTimeout(e),t},wn.prototype.trigger=function(e,t){var n=t.delegateTarget||t.target,i=this.get(ln(n,"data-tooltip-id"));i&&(e==="mouseover"&&i.timeout&&this.clearTimeout(i),e==="mouseout"&&i.timeout&&(i.timeout=1e3,this.setTimeout(i)))},wn.prototype.get=function(e){return typeof e!="string"&&(e=e.id),this._tooltips[e]},wn.prototype.clearTimeout=function(e){if(e=this.get(e),!!e){var t=e.removeTimer;t&&(clearTimeout(t),e.removeTimer=null)}},wn.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)}},wn.prototype.remove=function(e){var t=this.get(e);t&&(fi(t.html),fi(t.htmlContainer),delete t.htmlContainer,delete this._tooltips[t.id])},wn.prototype.show=function(){Lf(this._tooltipRoot)},wn.prototype.hide=function(){Lf(this._tooltipRoot,!1)},wn.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},wn.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)),En(n)&&(n=dt(n)),i=dt('<div data-tooltip-id="'+t+'" class="'+Ub+'">'),mn(i,{position:"absolute"}),i.appendChild(n),e.type&&vt(i).add("djs-tooltip-"+e.type),e.className&&vt(i).add(e.className),e.htmlContainer=i,r.appendChild(i),this._tooltips[t]=e,this._updateTooltip(e)},wn.prototype._updateTooltip=function(e){var t=e.position,n=e.htmlContainer;uO(n,t.x,t.y)},wn.prototype._updateTooltipVisibilty=function(e){D(this._tooltips,function(t){var n=t.show,i=t.htmlContainer,r=!0;n&&((n.minZoom>e.scale||n.maxZoom<e.scale)&&(r=!1),Lf(i,r))})},wn.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 lO={__init__:["tooltips"],tooltips:["type",wn]};var pO="flow elements must be children of pools/participants",fO="Data object must be placed within a pool/participant.";function qb(e,t,n){function i(r,o,a){t.add({position:{x:r.x+5,y:r.y+5},type:"error",timeout:2e3,html:"<div>"+o+"</div>"})}e.on(["shape.move.rejected","create.rejected"],function(r){var o=r.context,a=o.shape,s=o.target;v(s,"bpmn:Collaboration")&&(v(a,"bpmn:FlowNode")?i(r,n(pO)):v(a,"bpmn:DataObjectReference")&&i(r,n(fO)))})}qb.$inject=["eventBus","tooltips","translate"];const dO={__depends__:[lO],__init__:["modelingFeedback"],modelingFeedback:["type",qb]};var hO=500,mO=1250,gO=1500,bu=Math.round;function yO(e){return{x:e.x+bu(e.width/2),y:e.y+bu(e.height/2)}}function Yb(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",gO,function(s){var c=s.context,u=s.shape,l=i.get().slice();l.indexOf(u)===-1&&(l=[u]),l=vO(l),j(c,{shapes:l,validatedShapes:l,shape:u})}),e.on("shape.move.start",mO,function(s){var c=s.context,u=c.validatedShapes,l;if(l=c.canExecute=o(u),!l)return!1}),e.on("shape.move.move",hO,function(s){var c=s.context,u=c.validatedShapes,l=s.hover,f={x:s.dx,y:s.dy},p={x:s.x,y:s.y},d;if(d=o(u,f,p,l),c.delta=f,c.canExecute=d,d===null){c.target=null;return}c.target=l}),e.on("shape.move.end",function(s){var c=s.context,u=c.delta,l=c.canExecute,f=l==="attach",p=c.shapes;if(l===!1)return!1;u.x=bu(u.x),u.y=bu(u.y),!(u.x===0&&u.y===0)&&n.moveElements(p,u,c.target,{primaryShape:c.shape,attach:f})}),e.on("element.mousedown",function(s){if(ur(s)){var c=Ro(s);if(!c)throw new Error("must supply DOM mousedown event");return a(c,s.element)}});function a(s,c,u,l){if(Ut(u)&&(l=u,u=!1),!(c.waypoints||!c.parent)&&!Ve(s.target).has("djs-hit-no-move")){var f=yO(c),p=t.init(s,f,"shape.move",{cursor:"grabbing",autoActivate:u,data:{shape:c,context:l||{}}});if(p!==!1)return!0}}this.start=a}Yb.$inject=["eventBus","dragging","modeling","selection","rules"];function vO(e){var t=io(e,"id");return $e(e,function(n){for(;n=n.parent;)if(t[n.id])return!1;return!0})}var Kb=499,Nf="djs-dragging",Xb="drop-ok",Zb="drop-not-ok",Qb="new-parent",Jb="attach-ok";function ex(e,t,n,i){function r(c){var u=o(c),l=_O(u);return l}function o(c){var u=Jo(c),l=u.flatMap(d=>(d.incoming||[]).concat(d.outgoing||[])),f=u.concat(l),p=[...new Set(f)];return p}function a(c,u){[Jb,Xb,Zb,Qb].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,Nf),c.allDraggedElements?c.allDraggedElements.push(u):c.allDraggedElements=[u]}e.on("shape.move.start",Kb,function(c){var u=c.context,l=u.shapes,f=u.allDraggedElements,p=r(l);if(!u.dragGroup){var d=ge("g");ce(d,n.cls("djs-drag-group",["no-events"]));var h=t.getActiveLayer();ke(h,d),u.dragGroup=d}p.forEach(function(m){i.addDragger(m,u.dragGroup)}),f?f=Tu([f,o(l)]):f=o(l),D(f,function(m){t.addMarker(m,Nf)}),u.allDraggedElements=f,u.differentParents=bO(l)}),e.on("shape.move.move",Kb,function(c){var u=c.context,l=u.dragGroup,f=u.target,p=u.shape.parent,d=u.canExecute;f&&(d==="attach"?a(f,Jb):u.canExecute&&p&&f.id!==p.id?a(f,Qb):a(f,u.canExecute?Xb:Zb)),nn(l,c.dx,c.dy)}),e.on(["shape.move.out","shape.move.cleanup"],function(c){var u=c.context,l=u.target;l&&a(l,null)}),e.on("shape.move.cleanup",function(c){var u=c.context,l=u.allDraggedElements,f=u.dragGroup;D(l,function(p){t.removeMarker(p,Nf)}),f&&zt(f)}),this.makeDraggable=s}ex.$inject=["eventBus","canvas","styles","previewSupport"];function _O(e){var t=new Set;e.forEach(function(i){t.add(i.id)});var n=$e(e,function(i){return st(i)?t.has(i.source.id)&&t.has(i.target.id):!0});return n}function bO(e){return _0(io(e,function(t){return t.parent&&t.parent.id}))!==1}const xO={__depends__:[pc,qn,Df,vi,ji,Mo],__init__:["move","movePreview"],move:["type",Yb],movePreview:["type",ex]};var tx=".djs-palette-toggle",nx=".entry",wO=tx+", "+nx,Bf="djs-palette-",EO="shown",$f="open",ix="two-column",SO=1e3;function jt(e,t){this._eventBus=e,this._canvas=t;var n=this;e.on("tool-manager.update",function(i){var r=i.tool;n.updateToolHighlight(r)}),e.on("i18n.changed",function(){n._update()}),e.on("diagram.init",function(){n._diagramInitialized=!0,n._rebuild()})}jt.$inject=["eventBus","canvas"],jt.prototype.registerProvider=function(e,t){t||(t=e,e=SO),this._eventBus.on("palette.getProviders",e,function(n){n.providers.push(t)}),this._rebuild()},jt.prototype.getEntries=function(){var e=this._getProviders();return e.reduce(CO,{})},jt.prototype._rebuild=function(){if(this._diagramInitialized){var e=this._getProviders();e.length&&(this._container||this._init(),this._update())}},jt.prototype._init=function(){var e=this,t=this._eventBus,n=this._getParentContainer(),i=this._container=dt(jt.HTML_MARKUP);n.appendChild(i),vt(n).add(Bf+EO),Pn.bind(i,wO,"click",function(r){var o=r.delegateTarget;if(tl(o,tx))return e.toggle();e.trigger("click",r)}),Te.bind(i,"mousedown",function(r){r.stopPropagation()}),Pn.bind(i,nx,"dragstart",function(r){e.trigger("dragstart",r)}),t.on("canvas.resized",this._layoutChanged,this),t.fire("palette.create",{container:i})},jt.prototype._getProviders=function(e){var t=this._eventBus.createEvent({type:"palette.getProviders",providers:[]});return this._eventBus.fire(t),t.providers},jt.prototype._toggleState=function(e){e=e||{};var t=this._getParentContainer(),n=this._container,i=this._eventBus,r,o=vt(n),a=vt(t);"twoColumn"in e?r=e.twoColumn:r=this._needsCollapse(t.clientHeight,this._entries||{}),o.toggle(ix,r),a.toggle(Bf+ix,r),"open"in e&&(o.toggle($f,e.open),a.toggle(Bf+$f,e.open)),i.fire("palette.changed",{twoColumn:r,open:this.isOpen()})},jt.prototype._update=function(){var e=rt(".djs-palette-entries",this._container),t=this._entries=this.getEntries();_s(e),D(t,function(n,i){var r=n.group||"default",o=rt("[data-group="+La(r)+"]",e);o||(o=dt('<div class="group"></div>'),ln(o,"data-group",r),e.appendChild(o));var a=n.html||(n.separator?'<hr class="separator" />':'<div class="entry" draggable="true"></div>'),s=dt(a);if(o.appendChild(s),!n.separator&&(ln(s,"data-action",i),n.title&&ln(s,"title",n.title),n.className&&RO(s,n.className),n.imageUrl)){var c=dt("<img>");ln(c,"src",n.imageUrl),s.appendChild(c)}}),this.open()},jt.prototype.trigger=function(e,t,n){var i,r,o=t.delegateTarget||t.target;return o?(i=ln(o,"data-action"),r=t.originalEvent||t,this.triggerEntry(i,e,r,n)):t.preventDefault()},jt.prototype.triggerEntry=function(e,t,n,i){var r=this._entries,o,a;if(o=r[e],!!o&&(a=o.action,this._eventBus.fire("palette.trigger",{entry:o,event:n})!==!1)){if(qt(a)){if(t==="click")return a(n,i)}else if(a[t])return a[t](n,i);n.preventDefault()}},jt.prototype._layoutChanged=function(){this._toggleState({})},jt.prototype._needsCollapse=function(e,t){var n=50,i=Object.keys(t).length*46;return e<i+n},jt.prototype.close=function(){this._toggleState({open:!1,twoColumn:!1})},jt.prototype.open=function(){this._toggleState({open:!0})},jt.prototype.toggle=function(){this.isOpen()?this.close():this.open()},jt.prototype.isActiveTool=function(e){return e&&this._activeTool===e},jt.prototype.updateToolHighlight=function(e){var t,n;this._toolsContainer||(t=rt(".djs-palette-entries",this._container),this._toolsContainer=rt("[data-group=tools]",t)),n=this._toolsContainer,D(n.children,function(i){var r=i.getAttribute("data-action");if(r){var o=vt(i);r=r.replace("-tool",""),o.contains("entry")&&r===e?o.add("highlighted-entry"):o.remove("highlighted-entry")}})},jt.prototype.isOpen=function(){return vt(this._container).has($f)},jt.prototype._getParentContainer=function(){return this._canvas.getContainer()},jt.HTML_MARKUP='<div class="djs-palette"><div class="djs-palette-entries"></div><div class="djs-palette-toggle"></div></div>';function RO(e,t){var n=vt(e),i=xe(t)?t:t.split(/\s+/g);i.forEach(function(r){n.add(r)})}function CO(e,t){var n=t.getPaletteEntries();return qt(n)?n(e):(D(n,function(i,r){e[r]=i}),e)}const PO={__init__:["palette"],palette:["type",jt]};var rx="crosshair",ox="selected",AO="djs-dragging-active-lasso";function Er(e,t,n,i,r,o,a){this._selection=r,this._dragging=n,this._mouse=a;var s=this,c={create:function(f){var p=t.getActiveLayer(),d=f.frame=ge("rect");ce(d,{class:"djs-lasso-overlay",width:1,height:1,x:0,y:0}),ke(p,d),u(!0),this.update(f)},update:function(f){var p=f.frame,d=f.bbox;p&&d&&ce(p,{x:d.x,y:d.y,width:d.width,height:d.height});var h=f.marked,m=f.lastMarked;if(h&&m){for(const g of m)h.has(g)||t.removeMarker(g,ox);for(const g of h)m.has(g)||t.addMarker(g,ox)}},remove:function(f){this.update(f),f.frame&&zt(f.frame),u(!1)}};function u(f){Ve(t.getContainer()).toggle(AO,f)}function l(f){var p=i.getAll();return new Set(no(po(p,f)))}o.registerTool("lasso",{tool:"lasso.selection",dragging:"lasso"}),e.on("lasso.selection.end",function(f){var p=f.originalEvent.target;!f.hover&&!(p instanceof SVGElement)||e.once("lasso.selection.ended",function(){s.activateLasso(f.originalEvent,!0)})}),e.on("lasso.end",0,function(f){var p=f.context;s._select(Array.from(p.marked))}),e.on("lasso.start",function(f){var p=f.context;p.bbox=ax(f),p.add=rc(f),p.lastMarked=new Set(r.get()),p.add?p.marked=p.lastMarked:p.marked=new Set,p.initialMarked=p.marked,c.create(p)}),e.on("lasso.move",function(f){var p=f.context,d=p.bbox=ax(f),h=l(d),m=p.initialMarked.union(h);p.lastMarked=p.marked,p.marked=m,c.update(p)}),e.on("lasso.cleanup",function(f){var p=f.context;p.lastMarked=p.marked,p.marked=new Set(r.get()),c.remove(f.context)}),e.on("element.mousedown",1500,function(f){if(rc(f))return s.activateLasso(f.originalEvent),!0})}Er.$inject=["eventBus","canvas","dragging","elementRegistry","selection","toolManager","mouse"],Er.prototype.activateLasso=function(e,t){this._dragging.init(e,"lasso",{autoActivate:t,cursor:rx,data:{context:{}},keepSelection:!0})},Er.prototype.activateSelection=function(e,t){this._dragging.init(e,"lasso.selection",{trapClick:!1,autoActivate:t,cursor:rx,data:{context:{}},keepSelection:!0})},Er.prototype._select=function(e){this._selection.select(e)},Er.prototype.select=function(e,t,n=[]){var i=no(po(e,t));this._select([...n,...i])},Er.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateSelection(e,!!e)},Er.prototype.isActive=function(){var e=this._dragging.context();return e&&/^lasso/.test(e.prefix)};function ax(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 TO={__depends__:[mc,va],__init__:["lassoTool"],lassoTool:["type",Er]};var jf=1500,sx="grab";function Ho(e,t,n,i,r,o){this._dragging=n,this._mouse=o;var a=this,s=i.get("keyboard",!1);r.registerTool("hand",{tool:"hand",dragging:"hand.move"}),e.on("element.mousedown",jf,function(c){if(ma(c))return a.activateMove(c.originalEvent,!0),!1}),s&&s.addListener(jf,function(c){if(!(!cx(c.keyEvent)||a.isActive())){var u=a._mouse.getLastMoveEvent();a.activateMove(u,!!u)}},"keyboard.keydown"),s&&s.addListener(jf,function(c){!cx(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!ma(c)&&l&&e.once("hand.move.ended",function(f){a.activateHand(f.originalEvent,!0,!0)}),!1})}Ho.$inject=["eventBus","canvas","dragging","injector","toolManager","mouse"],Ho.prototype.activateMove=function(e,t,n){typeof t=="object"&&(n=t,t=!1),this._dragging.init(e,"hand.move",{autoActivate:t,cursor:sx,data:{context:n||{}}})},Ho.prototype.activateHand=function(e,t,n){this._dragging.init(e,"hand",{trapClick:!1,autoActivate:t,cursor:sx,data:{context:{reactivate:n}}})},Ho.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateHand(e,!!e)},Ho.prototype.isActive=function(){var e=this._dragging.context();return e?/^(hand|hand\.move)$/.test(e.prefix):!1};function cx(e){return Gt("Space",e)}const MO={__depends__:[mc,va],__init__:["handTool"],handTool:["type",Ho]};var ux="connect-ok",lx="connect-not-ok";function zo(e,t,n,i,r,o,a){var s=this;this._dragging=t,this._rules=o,this._mouse=a,r.registerTool("global-connect",{tool:"global-connect",dragging:"global-connect.drag"}),e.on("global-connect.hover",function(c){var u=c.context,l=c.hover,f=u.canStartConnect=s.canStartConnect(l);f!==null&&(u.startTarget=l,i.addMarker(l,f?ux:lx))}),e.on(["global-connect.out","global-connect.cleanup"],function(c){var u=c.context.startTarget,l=c.context.canStartConnect;u&&i.removeMarker(u,l?ux:lx)}),e.on(["global-connect.ended"],function(c){var u=c.context,l=u.startTarget,f={x:c.x,y:c.y},p=s.canStartConnect(l);if(p)return e.once("element.out",function(){e.once(["connect.ended","connect.canceled"],function(){e.fire("global-connect.drag.ended")}),n.start(null,l,f)}),!1})}zo.$inject=["eventBus","dragging","connect","canvas","toolManager","rules","mouse"],zo.prototype.start=function(e,t){this._dragging.init(e,"global-connect",{autoActivate:t,trapClick:!1,data:{context:{}}})},zo.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();return this.start(e,!!e)},zo.prototype.isActive=function(){var e=this._dragging.context();return e&&/^global-connect/.test(e.prefix)},zo.prototype.canStartConnect=function(e){return this._rules.allowed("connection.start",{source:e})};const kO={__depends__:[Af,vi,ji,mc,va],globalConnect:["type",zo]};function Ff(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)}Ff.$inject=["palette","create","elementFactory","spaceTool","lassoTool","handTool","globalConnect","translate"],Ff.prototype.getPaletteEntries=function(){var e={},t=this._create,n=this._elementFactory,i=this._spaceTool,r=this._lassoTool,o=this._handTool,a=this._globalConnect,s=this._translate;function c(f,p,d,h,m){function g(S){var E=n.createShape(j({type:f},m));t.start(S,E)}return{group:p,className:d,title:h,action:{dragstart:g,click:g}}}function u(f){var p=n.createShape({type:"bpmn:SubProcess",x:0,y:0,isExpanded:!0}),d=n.createShape({type:"bpmn:StartEvent",x:40,y:82,parent:p});t.start(f,[p,d],{hints:{autoSelect:[p]}})}function l(f){t.start(f,n.createParticipantShape())}return j(e,{"hand-tool":{group:"tools",className:"bpmn-icon-hand-tool",title:s("Activate hand tool"),action:{click:function(f){o.activateHand(f)}}},"lasso-tool":{group:"tools",className:"bpmn-icon-lasso-tool",title:s("Activate lasso tool"),action:{click:function(f){r.activateSelection(f)}}},"space-tool":{group:"tools",className:"bpmn-icon-space-tool",title:s("Activate create/remove space tool"),action:{click:function(f){i.activateSelection(f)}}},"global-connect-tool":{group:"tools",className:"bpmn-icon-connection-multi",title:s("Activate global connect tool"),action:{click:function(f){a.start(f)}}},"tool-separator":{group:"tools",separator:!0},"create.start-event":c("bpmn:StartEvent","event","bpmn-icon-start-event-none",s("Create start event")),"create.intermediate-event":c("bpmn:IntermediateThrowEvent","event","bpmn-icon-intermediate-event-none",s("Create intermediate/boundary event")),"create.end-event":c("bpmn:EndEvent","event","bpmn-icon-end-event-none",s("Create end event")),"create.exclusive-gateway":c("bpmn:ExclusiveGateway","gateway","bpmn-icon-gateway-none",s("Create gateway")),"create.task":c("bpmn:Task","activity","bpmn-icon-task",s("Create task")),"create.data-object":c("bpmn:DataObjectReference","data-object","bpmn-icon-data-object",s("Create data object reference")),"create.data-store":c("bpmn:DataStoreReference","data-store","bpmn-icon-data-store",s("Create data store reference")),"create.subprocess-expanded":{group:"activity",className:"bpmn-icon-subprocess-expanded",title:s("Create expanded sub-process"),action:{dragstart:u,click:u}},"create.participant-expanded":{group:"collaboration",className:"bpmn-icon-participant",title:s("Create pool/participant"),action:{dragstart:l,click:l}},"create.group":c("bpmn:Group","artifact","bpmn-icon-group",s("Create group"))}),e};const OO={__depends__:[PO,dc,$y,TO,MO,kO,ca],__init__:["paletteProvider"],paletteProvider:["type",Ff]};var DO=250;function Hf(e,t,n,i,r){Q.call(this,e);function o(s){var c=s.canExecute.replacements;D(c,function(u){var l=u.oldElementId,f={type:u.newElementType};if(!s.visualReplacements[l]){var p=t.get(l);j(f,{x:p.x,y:p.y});var d=n.createShape(f);i.addShape(d,p.parent);var h=rt('[data-element-id="'+La(p.id)+'"]',s.dragGroup);h&&ce(h,{display:"none"});var m=r.addDragger(d,s.dragGroup);s.visualReplacements[l]=m,i.removeShape(d)}})}function a(s){var c=s.visualReplacements;D(c,function(u,l){var f=rt('[data-element-id="'+La(l)+'"]',s.dragGroup);f&&ce(f,{display:"inline"}),u.remove(),c[l]&&delete c[l]})}e.on("shape.move.move",DO,function(s){var c=s.context,u=c.canExecute;c.visualReplacements||(c.visualReplacements={}),u&&u.replacements?o(c):a(c)})}Hf.$inject=["eventBus","elementRegistry","elementFactory","canvas","previewSupport"],se(Hf,Q);const LO={__depends__:[Mo],__init__:["bpmnReplacePreview"],bpmnReplacePreview:["type",Hf]};var IO=1250,zf=40,NO=20,BO=10,px=20,fx=["x","y"],$O=Math.abs;function dx(e){e.on(["connect.hover","connect.move","connect.end"],IO,function(t){var n=t.context,i=n.canExecute,r=n.start,o=n.hover,a=n.source,s=n.target;t.originalEvent&&Mn(t.originalEvent)||(n.initialConnectionStart||(n.initialConnectionStart=n.connectionStart),i&&o&&jO(t,o,GO(o)),o&&zO(i,["bpmn:Association","bpmn:DataInputAssociation","bpmn:DataOutputAssociation","bpmn:SequenceFlow"])?(n.connectionStart=Xn(r),Be(o,["bpmn:Event","bpmn:Gateway"])&&hx(t,Xn(o)),Be(o,["bpmn:Task","bpmn:SubProcess"])&&FO(t,o),v(a,"bpmn:BoundaryEvent")&&s===a.host&&HO(t)):mx(i,"bpmn:MessageFlow")?(v(r,"bpmn:Event")&&(n.connectionStart=Xn(r)),v(o,"bpmn:Event")&&hx(t,Xn(o))):n.connectionStart=n.initialConnectionStart)})}dx.$inject=["eventBus"];function jO(e,t,n){fx.forEach(function(i){var r=gx(i,t);e[i]<t[i]+n?$t(e,i,t[i]+n):e[i]>t[i]+r-n&&$t(e,i,t[i]+r-n)})}function FO(e,t){var n=Xn(t);fx.forEach(function(i){VO(e,t,i)&&$t(e,i,n[i])})}function HO(e){var t=e.context,n=t.source,i=t.target;if(!WO(t)){var r=Xn(n),o=tn(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;$O(c-r[s])<zf&&(c>r[s]?u=r[s]+zf:u=r[s]-zf,$t(e,s,u))})}}function hx(e,t){$t(e,"x",t.x),$t(e,"y",t.y)}function mx(e,t){return e&&e.type===t}function zO(e,t){return Yi(t,function(n){return mx(e,n)})}function gx(e,t){return e==="x"?t.width:t.height}function GO(e){return v(e,"bpmn:Task")?BO:NO}function VO(e,t,n){return e[n]>t[n]+px&&e[n]<t[n]+gx(n,t)-px}function WO(e){var t=e.hover,n=e.source;return t&&n&&t===n}function Sr(){this._targets={},this._snapOrigins={},this._snapLocations=[],this._defaultSnaps={}}Sr.prototype.getSnapOrigin=function(e){return this._snapOrigins[e]},Sr.prototype.setSnapOrigin=function(e,t){this._snapOrigins[e]=t,this._snapLocations.indexOf(e)===-1&&this._snapLocations.push(e)},Sr.prototype.addDefaultSnap=function(e,t){var n=this._defaultSnaps[e];n||(n=this._defaultSnaps[e]=[]),n.push(t)},Sr.prototype.getSnapLocations=function(){return this._snapLocations},Sr.prototype.setSnapLocations=function(e){this._snapLocations=e},Sr.prototype.pointsForTarget=function(e){var t=e.id||e,n=this._targets[t];return n||(n=this._targets[t]=new xu,n.initDefaults(this._defaultSnaps)),n};function xu(){this._snapValues={}}xu.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)},xu.prototype.snap=function(e,t,n,i){var r=this._snapValues[t];return r&&D2(e[n],r[n],i)},xu.prototype.initDefaults=function(e){var t=this;D(e||{},function(n,i){D(n,function(r){t.add(i,r)})})};var UO=1250;function wi(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"],UO,function(r){var o=r.context,a=o.shape,s=o.snapContext,c=o.target;if(!(r.originalEvent&&Mn(r.originalEvent))&&!(Fo(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()})}wi.$inject=["elementRegistry","eventBus","snapping"],wi.prototype.initSnap=function(e){var t=this._elementRegistry,n=e.context,i=n.shape,r=n.snapContext;r||(r=n.snapContext=new Sr);var o;t.get(i.id)?o=Xn(i,e):o={x:e.x+Xn(i).x,y:e.y+Xn(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}),Ne(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},wi.prototype.addSnapTargetPoints=function(e,t,n){var i=this.getSnapTargets(t,n);return D(i,function(r){if(Ne(r)){Ne(t)&&e.add("mid",Xn(r));return}if(st(r)){if(r.waypoints.length<3)return;var o=r.waypoints.slice(1,-1);D(o,function(a){e.add("mid",a)});return}e.add("mid",Xn(r))}),!Ce(t.x)||!Ce(t.y)||this._elementRegistry.get(t.id)&&e.add("mid",Xn(t)),e},wi.prototype.getSnapTargets=function(e,t){return nb(t).filter(function(n){return!qO(n)})};function qO(e){return!!e.hidden}var yx=1500;function Go(e,t){t.invoke(wi,this),e.on(["create.move","create.end"],yx,ZO),e.on(["create.move","create.end","shape.move.move","shape.move.end"],yx,function(n){var i=n.context,r=i.canExecute,o=i.target,a=r&&(r==="attach"||r.attach);a&&!Fo(n)&&YO(n,o)})}se(Go,wi),Go.$inject=["eventBus","injector"],Go.prototype.initSnap=function(e){var t=wi.prototype.initSnap.call(this,e),n=e.shape,i=!!this._elementRegistry.get(n.id);return D(n.outgoing,function(r){var o=r.waypoints[0];o=o.original||o,t.setSnapOrigin(r.id+"-docking",_x(o,i,e))}),D(n.incoming,function(r){var o=r.waypoints[r.waypoints.length-1];o=o.original||o,t.setSnapOrigin(r.id+"-docking",_x(o,i,e))}),v(n,"bpmn:Participant")&&t.setSnapLocations(["top-left","bottom-right","mid"]),t},Go.prototype.addSnapTargetPoints=function(e,t,n){wi.prototype.addSnapTargetPoints.call(this,e,t,n);var i=this.getSnapTargets(t,n);D(i,function(o){(XO(o)||KO([t,o],"bpmn:TextAnnotation"))&&(e.add("top-left",eb(o)),e.add("bottom-right",tb(o)))});var r=this._elementRegistry;return D(t.incoming,function(o){if(r.get(t.id)){vx(i,o.source)||e.add("mid",we(o.source));var a=o.waypoints[0];e.add(o.id+"-docking",a.original||a)}}),D(t.outgoing,function(o){if(r.get(t.id)){vx(i,o.target)||e.add("mid",we(o.target));var a=o.waypoints[o.waypoints.length-1];e.add(o.id+"-docking",a.original||a)}}),v(n,"bpmn:SequenceFlow")&&(e=this.addSnapTargetPoints(e,t,n.parent)),e},Go.prototype.getSnapTargets=function(e,t){return wi.prototype.getSnapTargets.call(this,e,t).filter(function(n){return!v(n,"bpmn:Lane")})};function YO(e,t){var n=ve(t),i=Lg(e,t),r=e.context,o=r.shape,a;o.parent?a={x:0,y:0}:a=we(o),/top/.test(i)?$t(e,"y",n.top-a.y):/bottom/.test(i)&&$t(e,"y",n.bottom-a.y),/left/.test(i)?$t(e,"x",n.left-a.x):/right/.test(i)&&$t(e,"x",n.right-a.x)}function KO(e,t){return e.every(function(n){return v(n,t)})}function XO(e){return v(e,"bpmn:SubProcess")&&Ge(e)?!0:v(e,"bpmn:Participant")}function ZO(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)&&$t(e,"x",e.x),(i&&i>=e.y||o&&o<=e.y)&&$t(e,"y",e.y)}}function vx(e,t){return e.indexOf(t)!==-1}function _x(e,t,n){return t?{x:e.x-n.x,y:e.y-n.y}:{x:e.x,y:e.y}}var QO=1250;function Xa(e,t){var n=this;e.on(["resize.start"],function(i){n.initSnap(i)}),e.on(["resize.move","resize.end"],QO,function(i){var r=i.context,o=r.shape,a=o.parent,s=r.direction,c=r.snapContext;if(!(i.originalEvent&&Mn(i.originalEvent))&&!Fo(i)){var u=c.pointsForTarget(a);u.initialized||(u=n.addSnapTargetPoints(u,o,a,s),u.initialized=!0),tD(s)&&$t(i,"x",i.x),nD(s)&&$t(i,"y",i.y),t.snap(i,u)}}),e.on(["resize.cleanup"],function(){t.hide()})}Xa.prototype.initSnap=function(e){var t=e.context,n=t.shape,i=t.direction,r=t.snapContext;r||(r=t.snapContext=new Sr);var o=bx(n,i);return r.setSnapOrigin("corner",{x:o.x-e.x,y:o.y-e.y}),r},Xa.prototype.addSnapTargetPoints=function(e,t,n,i){var r=this.getSnapTargets(t,n);return D(r,function(o){e.add("corner",tb(o)),e.add("corner",eb(o))}),e.add("corner",bx(t,i)),e},Xa.$inject=["eventBus","snapping"],Xa.prototype.getSnapTargets=function(e,t){return nb(t).filter(function(n){return!JO(n,e)&&!st(n)&&!eD(n)&&!Ne(n)})};function bx(e,t){var n=we(e),i=ve(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 JO(e,t){return e.host===t}function eD(e){return!!e.hidden}function tD(e){return e==="n"||e==="s"}function nD(e){return e==="e"||e==="w"}var iD=7,rD=1e3;function Rr(e){this._canvas=e,this._asyncHide=ku(bn(this.hide,this),rD)}Rr.$inject=["canvas"],Rr.prototype.snap=function(e,t){var n=e.context,i=n.snapContext,r=i.getSnapLocations(),o={x:Fo(e,"x"),y:Fo(e,"y")};D(r,function(a){var s=i.getSnapOrigin(a),c={x:e.x+s.x,y:e.y+s.y};if(D(["x","y"],function(u){var l;o[u]||(l=t.snap(c,a,u,iD),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),D(["x","y"],function(a){var s=o[a];Ut(s)&&$t(e,a,s.originValue)})},Rr.prototype._createLine=function(e){var t=this._canvas.getLayer("snap"),n=ge("path");return ce(n,{d:"M0,0 L0,0"}),Ve(n).add("djs-snap-line"),ke(t,n),{update:function(i){Ce(i)?e==="horizontal"?ce(n,{d:"M-100000,"+i+" L+100000,"+i,display:""}):ce(n,{d:"M "+i+",-100000 L "+i+", +100000",display:""}):ce(n,{display:"none"})}}},Rr.prototype._createSnapLines=function(){this._snapLines={horizontal:this._createLine("horizontal"),vertical:this._createLine("vertical")}},Rr.prototype.showSnapLine=function(e,t){var n=this.getSnapLine(e);n&&n.update(t),this._asyncHide()},Rr.prototype.getSnapLine=function(e){return this._snapLines||this._createSnapLines(),this._snapLines[e]},Rr.prototype.hide=function(){D(this._snapLines,function(e){e.update()})};const oD={__depends__:[{__init__:["createMoveSnapping","resizeSnapping","snapping"],createMoveSnapping:["type",wi],resizeSnapping:["type",Xa],snapping:["type",Rr]}],__init__:["connectSnapping","createMoveSnapping"],connectSnapping:["type",dx],createMoveSnapping:["type",Go]};var xx=300;function Oe(e,t,n,i){this._open=!1,this._results={},this._eventMaps=[],this._cachedRootElement=null,this._cachedSelection=null,this._cachedViewbox=null,this._canvas=e,this._eventBus=t,this._selection=n,this._translate=i,this._container=this._getBoxHtml(),this._searchInput=rt(Oe.INPUT_SELECTOR,this._container),this._resultsContainer=rt(Oe.RESULTS_CONTAINER_SELECTOR,this._container),this._canvas.getContainer().appendChild(this._container),t.on(["canvas.destroy","diagram.destroy","drag.init","elements.changed"],this.close,this)}Oe.$inject=["canvas","eventBus","selection","translate"],Oe.prototype._bindEvents=function(){var e=this;function t(n,i,r,o){e._eventMaps.push({el:n,type:r,listener:Pn.bind(n,i,r,o)})}t(document,"html","click",function(n){e.close(!1)}),t(this._container,Oe.INPUT_SELECTOR,"click",function(n){n.stopPropagation(),n.delegateTarget.focus()}),t(this._container,Oe.RESULT_SELECTOR,"mouseover",function(n){n.stopPropagation(),e._scrollToNode(n.delegateTarget),e._preselect(n.delegateTarget)}),t(this._container,Oe.RESULT_SELECTOR,"click",function(n){n.stopPropagation(),e._select(n.delegateTarget)}),t(this._container,Oe.INPUT_SELECTOR,"keydown",function(n){Gt("ArrowUp",n)&&n.preventDefault(),Gt("ArrowDown",n)&&n.preventDefault()}),t(this._container,Oe.INPUT_SELECTOR,"keyup",function(n){if(Gt("Escape",n))return e.close();if(Gt("Enter",n)){var i=e._getCurrentResult();return i?e._select(i):e.close(!1)}if(Gt("ArrowUp",n))return e._scrollToDirection(!0);if(Gt("ArrowDown",n))return e._scrollToDirection();Gt(["ArrowLeft","ArrowRight"],n)||e._search(n.delegateTarget.value)})},Oe.prototype._unbindEvents=function(){this._eventMaps.forEach(function(e){Pn.unbind(e.el,e.type,e.listener)})},Oe.prototype._search=function(e){var t=this;if(this._clearResults(),!!e.trim()){var n=this._searchProvider.find(e);if(n=n.filter(function(r){return!t._canvas.getRootElements().includes(r.element)}),!n.length){this._selection.select(null);return}n.forEach(function(r){var o=r.element.id,a=t._createResultNode(r,o);t._results[o]={element:r.element,node:a}});var i=rt(Oe.RESULT_SELECTOR,this._resultsContainer);this._scrollToNode(i),this._preselect(i)}},Oe.prototype._scrollToDirection=function(e){var t=this._getCurrentResult();if(t){var n=e?t.previousElementSibling:t.nextElementSibling;n&&(this._scrollToNode(n),this._preselect(n))}},Oe.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)}},Oe.prototype._clearResults=function(){_s(this._resultsContainer),this._results={},this._eventBus.fire("searchPad.cleared")},Oe.prototype._getCurrentResult=function(){return rt(Oe.RESULT_SELECTED_SELECTOR,this._resultsContainer)},Oe.prototype._createResultNode=function(e,t){var n=dt(Oe.RESULT_HTML);return e.primaryTokens.length>0&&wx(n,e.primaryTokens,Oe.RESULT_PRIMARY_HTML),wx(n,e.secondaryTokens,Oe.RESULT_SECONDARY_HTML),ln(n,Oe.RESULT_ID_ATTRIBUTE,t),this._resultsContainer.appendChild(n),n},Oe.prototype.registerProvider=function(e){this._searchProvider=e},Oe.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,vt(this._canvas.getContainer()).add("djs-search-open"),vt(this._container).add("open"),this._searchInput.focus(),this._eventBus.fire("searchPad.opened"))},Oe.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,vt(this._canvas.getContainer()).remove("djs-search-open"),vt(this._container).remove("open"),this._clearResults(),this._searchInput.value="",this._searchInput.blur(),this._eventBus.fire("searchPad.closed"),this._canvas.restoreFocus())},Oe.prototype.toggle=function(){this.isOpen()?this.close():this.open()},Oe.prototype.isOpen=function(){return this._open},Oe.prototype._preselect=function(e){var t=this._getCurrentResult();if(e!==t){t&&vt(t).remove(Oe.RESULT_SELECTED_CLASS);var n=ln(e,Oe.RESULT_ID_ATTRIBUTE),i=this._results[n].element;vt(e).add(Oe.RESULT_SELECTED_CLASS),this._canvas.scrollToElement(i,{top:xx}),this._selection.select(i),this._eventBus.fire("searchPad.preselected",i)}},Oe.prototype._select=function(e){var t=ln(e,Oe.RESULT_ID_ATTRIBUTE),n=this._results[t].element;this._cachedSelection=null,this._cachedViewbox=null,this.close(!1),this._canvas.scrollToElement(n,{top:xx}),this._selection.select(n),this._eventBus.fire("searchPad.selected",n)},Oe.prototype._getBoxHtml=function(){const e=dt(Oe.BOX_HTML),t=rt(Oe.INPUT_SELECTOR,e);return t&&t.setAttribute("aria-label",this._translate("Search in diagram")),e};function wx(e,t,n){var i=aD(t),r=dt(n);r.innerHTML=i,e.appendChild(r)}function aD(e){var t="";return e.forEach(function(n){var i=Mv(n.value||n.matched||n.normal),r=n.match||n.matched;r?t+='<b class="'+Oe.RESULT_HIGHLIGHT_CLASS+'">'+i+"</b>":t+=i}),t!==""?t:null}Oe.CONTAINER_SELECTOR=".djs-search-container",Oe.INPUT_SELECTOR=".djs-search-input input",Oe.RESULTS_CONTAINER_SELECTOR=".djs-search-results",Oe.RESULT_SELECTOR=".djs-search-result",Oe.RESULT_SELECTED_CLASS="djs-search-result-selected",Oe.RESULT_SELECTED_SELECTOR="."+Oe.RESULT_SELECTED_CLASS,Oe.RESULT_ID_ATTRIBUTE="data-result-id",Oe.RESULT_HIGHLIGHT_CLASS="djs-search-highlight",Oe.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>`,Oe.RESULT_HTML='<div class="djs-search-result"></div>',Oe.RESULT_PRIMARY_HTML='<div class="djs-search-result-primary"></div>',Oe.RESULT_SECONDARY_HTML='<p class="djs-search-result-secondary"></p>';const sD={__depends__:[ca,Bc,qn],searchPad:["type",Oe]};function Gf(e,t,n,i){this._elementRegistry=e,this._canvas=n,this._search=i,t.registerProvider(this)}Gf.$inject=["elementRegistry","searchPad","canvas","search"],Gf.prototype.find=function(e){var t=this._canvas.getRootElements(),n=this._elementRegistry.filter(function(i){return!Ne(i)&&!t.includes(i)});return this._search(n.map(i=>({element:i,label:$n(i),id:i.id})),e,{keys:["label","id"]}).map(cD)};function cD(e){const{item:{element:t},tokens:n}=e;return{element:t,primaryTokens:n.label,secondaryTokens:n.id}}const uD={__depends__:[sD,L_],__init__:["bpmnSearch"],bpmnSearch:["type",Gf]},lD="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",pD="M1.03845 48.1347C1.03845 49.3511 1.07295 50.758 1.38342 52.064C1.69949 53.3938 2.32428 54.7154 3.56383 55.6428C6.02533 57.4841 10.1161 58.7685 14.8212 59.6067C19.5772 60.4538 25.1388 60.8738 30.6831 60.8738C36.2276 60.8738 41.7891 60.4538 46.545 59.6067C51.2504 58.7687 55.3412 57.4842 57.8028 55.6429C59.0424 54.7156 59.6673 53.3938 59.9834 52.064C60.2938 50.7579 60.3285 49.351 60.3285 48.1344V13.8415C60.3285 12.6249 60.2938 11.218 59.9834 9.91171C59.6673 8.58194 59.0423 7.2602 57.8027 6.33294C55.341 4.49168 51.2503 3.20723 46.545 2.36914C41.7891 1.522 36.2276 1.10204 30.6831 1.10205C25.1388 1.10206 19.5772 1.52206 14.8213 2.36923C10.1162 3.20734 6.02543 4.49183 3.5639 6.33314C2.32433 7.26038 1.69951 8.58206 1.38343 9.91181C1.07295 11.2179 1.03845 12.6247 1.03845 13.8411V48.1347Z",fD={width:36,height:50},dD={width:50,height:50};function Ex(e,t,n){return ge("path",{d:e,strokeWidth:2,transform:`translate(${t.x}, ${t.y})`,...n})}const Jn=5;function wu(e,t){this._styles=t,e.registerProvider(this)}wu.$inject=["outline","styles"],wu.prototype.getOutline=function(e){const t=this._styles.cls("djs-outline",["no-fill"]);var n;if(BS(e))return n=ge("rect"),ce(n,j({x:-Jn,y:-Jn,rx:4,width:e.width+Jn*2,height:e.height+Jn*2},t)),n;if(!Ne(e))return v(e,"bpmn:Gateway")?(n=ge("rect"),j(n.style,{"transform-box":"fill-box",transform:"rotate(45deg)","transform-origin":"center"}),ce(n,j({x:2,y:2,rx:4,width:e.width-4,height:e.height-4},t))):Be(e,["bpmn:Task","bpmn:SubProcess","bpmn:Group","bpmn:CallActivity"])?(n=ge("rect"),ce(n,j({x:-Jn,y:-Jn,rx:14,width:e.width+Jn*2,height:e.height+Jn*2},t))):v(e,"bpmn:EndEvent")?(n=ge("circle"),ce(n,j({cx:e.width/2,cy:e.height/2,r:e.width/2+Jn+1},t))):v(e,"bpmn:Event")?(n=ge("circle"),ce(n,j({cx:e.width/2,cy:e.height/2,r:e.width/2+Jn},t))):v(e,"bpmn:DataObjectReference")&&Sx(e,"bpmn:DataObjectReference")?n=Ex(lD,{x:-6,y:-6},t):v(e,"bpmn:DataStoreReference")&&Sx(e,"bpmn:DataStoreReference")&&(n=Ex(pD,{x:-6,y:-6},t)),n},wu.prototype.updateOutline=function(e,t){if(!Ne(e))return Be(e,["bpmn:SubProcess","bpmn:Group"])?(ce(t,{width:e.width+Jn*2,height:e.height+Jn*2}),!0):!!Be(e,["bpmn:Event","bpmn:Gateway","bpmn:DataStoreReference","bpmn:DataObjectReference"])};function Sx(e,t){var n;return t==="bpmn:DataObjectReference"?n=fD:t==="bpmn:DataStoreReference"&&(n=dD),e.width===n.width&&e.height===n.height}const hD={__depends__:[Df],__init__:["outlineProvider"],outlineProvider:["type",wu]};var mD='<?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 Ei(e){mo.call(this,e)}se(Ei,mo),Ei.Viewer=vr,Ei.NavigatedViewer=Ia,Ei.prototype.createDiagram=function(){return this.importXML(mD)},Ei.prototype._interactionModules=[Bv,jv,zv],Ei.prototype._modelingModules=[y2,Ic,w2,b2,I2,Af,H2,fk,Py,dc,gk,_k,Ik,Bk,$k,Gk,tO,aO,Jp,dO,xO,OO,LO,$b,oD,uD,hD],Ei.prototype._modules=[].concat(vr.prototype._modules,Ei.prototype._interactionModules,Ei.prototype._modelingModules);const gD=((e,t)=>{const n=e.__vccOpts||e;for(const[i,r]of t)n[i]=r;return n})(Ot.defineComponent({__name:"BpmnModelerView",props:{xml:{}},emits:["ready","imported","import-error"],setup(e,{expose:t,emit:n}){const i=e,r=n,o=Ot.ref();let a;async function s(u){if(!a)throw new Error("modeler not mounted");try{const{warnings:l}=await a.importXML(u),f=Wu(l);return r("imported",f),{warnings:f}}catch(l){throw r("import-error",l),l}}async function c(){if(!a)throw new Error("modeler not mounted");const{xml:u}=await a.saveXML({format:!0});return u??""}return Ot.onMounted(async()=>{a=new Ei({container:o.value,moddleExtensions:as}),i.xml&&await s(i.xml),r("ready")}),Ot.watch(()=>i.xml,u=>{u&&a&&s(u)}),Ot.onBeforeUnmount(()=>{a==null||a.destroy(),a=void 0}),t({importXml:s,saveXml:c,getModeler:()=>a}),(u,l)=>(Ot.openBlock(),Ot.createElementBlock("div",{ref_key:"container",ref:o,class:"bpmn-modeler-view"},null,512))}}),[["__scopeId","data-v-a9b41c97"]]);ie.APPLY_BPMN_OPS_SCHEMA=m0,ie.BPMN_MODDLE_EXTENSIONS=as,ie.BWL_MODDLE_SCHEMA=Xf,ie.BWL_NS=Kf,ie.BWL_PREFIX=Cu,ie.BWL_SIDES=Pu,ie.BpmnModelerView=gD,ie.EDITOR=NE,ie.FLOW_LABEL_INDENT=kd,ie.HEADLESS_BPMN_MODULES=Pv,ie.HEADLESS_TEXT_METRICS=so,ie.I18N_NS=qw,ie.I18N_PREFIX=xd,ie.LABEL_FORK_MARGIN=qu,ie.MVP_FLOW_NODE_TYPES=Ri,ie.SYMBOLIC_OP_KINDS=Jf,ie.SYMBOLIC_OP_SCHEMA=ed,ie.UNDO_EPISODE_COMMAND=Au,ie.applyBpmnOpBatch=bh,ie.applyBpmnOps=gh,ie.approximateTextWidth=co,ie.auditBpmnGeometry=Fd,ie.auditBpmnGeometryXml=hE,ie.auditGeometry=ki,ie.auditTargetsOf=ui,ie.axisSegmentsOf=hn,ie.blackBoxNameRect=Uu,ie.buildBpmnOpBatch=IE,ie.buildRegistryIndex=zd,ie.containerBoundarySegments=Yo,ie.createBpmnEditorController=BE,ie.createBpmnModdle=wd,ie.createHeadlessBpmnModeler=iM,ie.crossedShapesOf=Hn,ie.crossingCost=Mi,ie.describeProcess=_h,ie.describeProcessXml=LE,ie.edgeCrossCount=ps,ie.edgeCrossingPairsOf=Ku,ie.executeAsUndoEpisode=Qf,ie.forwardThreePointCandidates=Xu,ie.geometryFindingKey=Pi,ie.installHeadlessBpmnDom=Sd,ie.isMvpFlowNodeType=Yf,ie.labelRectsOf=Ko,ie.lineCrossesLabel=Ti,ie.lineThroughLabel=Dd,ie.lineThroughShapeLabel=$d,ie.loadBpmnXml=Vu,ie.lowerOps=mh,ie.oppositeOverlapCount=rE,ie.oppositeOverlapOf=Md,ie.planBackEdgeBoundaryClearance=eh,ie.planCrossPoolRoute=Xd,ie.planEdgeRepair=qd,ie.planLabelLineClearance=oh,ie.planLabelPlacement=rh,ie.planMiddleSegmentShifts=Wd,ie.planOppositeOverlapRepair=nh,ie.planSegmentDetours=Vd,ie.planShapeLabelClearance=ch,ie.repairIntroducedBoundaryHugging=th,ie.repairIntroducedCrossings=Yd,ie.repairIntroducedLabelLines=ah,ie.repairIntroducedOppositeOverlaps=ih,ie.repairIntroducedShapeLabelLines=uh,ie.repairIntroducedSharedSegmentLabels=sh,ie.rerouteIntroducedCrossPoolEdges=Zd,ie.resolverServicesOf=dh,ie.saveBpmnXml=Yw,ie.sceneCrossingCost=Id,ie.sceneFromDefinitions=jd,ie.sceneFromRegistry=Tt,ie.sharedSegmentUnderLabel=ls,ie.sharedSpansOf=us,ie.unreadableOverlapCount=Ai,ie.unreadableOverlapOf=cs,ie.validateOps=fh,ie.warningMessages=Wu,Object.defineProperty(ie,Symbol.toStringTag,{value:"Module"})}));
|