@g1cloud/bpmn-modeler-next 5.0.0-alpha.52 → 5.0.0-alpha.54

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,16 +1,16 @@
1
- (function(ae,Mt){typeof exports=="object"&&typeof module<"u"?Mt(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],Mt):(ae=typeof globalThis<"u"?globalThis:ae||self,Mt(ae.BpmnModeler={},ae.Vue))})(this,(function(ae,Mt){"use strict";var GD=Object.defineProperty;var VD=(ae,Mt,Ei)=>Mt in ae?GD(ae,Mt,{enumerable:!0,configurable:!0,writable:!0,value:Ei}):ae[Mt]=Ei;var Jr=(ae,Mt,Ei)=>VD(ae,typeof Mt!="symbol"?Mt+"":Mt,Ei);const Ei=["startEvent","endEvent","userTask","serviceTask","task","sendTask","receiveTask","exclusiveGateway","parallelGateway"];function Zf(e){return Ei.includes(e)}const Qf="http://g1project.net/spec/bpmn/bwl/1.0",Au="bwl",Tu=["top-left","top","top-right","right","bottom-right","bottom","bottom-left","left"],Jf={name:"bwl-hints",uri:Qf,prefix:Au,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"}]}]},Mu="bwl.undoEpisode",ed=new WeakSet;function f0(e){ed.has(e)||(e.register(Mu,{preExecute(t){try{t.run()}catch(n){t.error=n}}}),ed.add(e))}function td(e,t){f0(e);const n={run:t};if(e.execute(Mu,n),n.error!==void 0)throw e.canUndo()&&e.undo(),n.error}const nd=["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"],d0={description:"생략 = 보존, null = 제거.",anyOf:[{type:"string"},{type:"null"}]},h0={type:"object",description:"레인. 배열 선언 순서 = 풀 내 상→하 순서.",properties:{id:{type:"string"},name:{type:"string"}},required:["id"],additionalProperties:!1},m0={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},g0={type:"object",description:"플로우 노드. 좌표는 지정하지 않는다 — 배치는 resolver 가 결정한다.",properties:{id:{type:"string"},type:{type:"string",enum:[...Ei]},name:{type:"string"},participant:{type:"string",description:"소속 풀 id(협업 문서)."},lane:{type:"string",description:"소속 레인 id(풀 정의에 선언된 것)."}},required:["id","type"],additionalProperties:!1},y0={type:"object",description:"분기 조건 — 게이트웨이가 아닌 플로우에 붙인다. MVP 는 label 만.",properties:{label:{type:"string"}},required:["label"],additionalProperties:!1},v0={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},b0={type:"object",description:"메시지 플로우(풀 경계를 넘는 연결 — 노드 또는 블랙박스 풀 자체가 끝점).",properties:{id:{type:"string"},source:{type:"string"},target:{type:"string"},name:{type:"string"}},required:["id","source","target"],additionalProperties:!1},_0={type:"object",properties:{id:{type:"string"},name:{type:"string"}},required:["id"],additionalProperties:!1},x0={type:"object",description:"데이터 입출력 연관. 방향 = source→target(태스크→스토어 = 쓰기, 스토어→태스크 = 읽기).",properties:{id:{type:"string"},source:{type:"string"},target:{type:"string"}},required:["source","target"],additionalProperties:!1},w0={type:"object",properties:{id:{type:"string"},text:{type:"string"}},required:["id","text"],additionalProperties:!1},E0={type:"object",description:"연관선(주석 ↔ 요소).",properties:{id:{type:"string"},source:{type:"string"},target:{type:"string"}},required:["source","target"],additionalProperties:!1},S0={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},R0={type:"object",description:"주석 방위 힌트 — 앵커 요소 기준 상대 배치. 있으면 결정적 배치, 없으면 휴리스틱.",properties:{anchor:{type:"string",description:"기준 요소 id."},side:{type:"string",enum:[...Tu]},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 C0={"participant.add":sn("participant.add",{description:"풀 추가. order = 풀 세로 순서 힌트 — **작을수록 위**(생략 시 op 순서가 곧 배치 순서). 값은 상대 순서만 쓰므로 1,2,3… 연속이든 10,20,30 간격이든 같다.",properties:{participant:{$ref:"#/$defs/irParticipant"},order:{type:"integer"}},required:["participant"]}),"participant.update":sn("participant.update",{description:"풀 이름/레인 갱신. lanes 는 전체 재선언(생략 = 보존) — 기존 레인을 유지하려면 함께 다시 나열한다.",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"},lanes:{type:"array",items:{$ref:"#/$defs/irLane"}}},required:["id"]}),"node.add":sn("node.add",{description:'플로우 노드 추가. band = 가로 밴드 순번 힌트(주 흐름 0, 갈래 1, 2…) — 위/아래가 아니라 "주 흐름에서 몇 번째 갈래"다. 행 배치(어느 갈래가 위/아래인지)는 호스트가 정한다(대칭·메시지 방향). 레인이 있으면 그 레인 안의 밴드다 — 한 레인 안에서 게이트웨이 출구를 갈라 놓을 때 쓴다. 컨테이너(풀·레인)는 밴드 수만큼 자란다.',properties:{node:{$ref:"#/$defs/irNode"},band:{type:"integer",description:"0 이상 정수(음수는 payload-invalid 로 거부)."}},required:["node"]}),"node.update":sn("node.update",{description:"노드 이름/레인/타입/밴드 갱신. lane = 레인 재배정(이동), type = 태스크·이벤트 타입 전환, band = 행 재지정. 🔴 **기존 문서에서 band 는 「몇 번째 갈래」가 아니라 그 컨테이너의 행 번호**다(describe 의 hints.bands 가 보여 주는 값) — 신규 배치의 band 가 대칭으로 펴지는 것과 다르다. 간선이 도형을 가로지르거나 반대 방향으로 겹칠 때 그 노드를 다른 행으로 옮기는 채널이다.",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"},lane:{type:"string"},type:{type:"string",enum:[...Ei]},band:{type:"integer",description:"0 이상 정수(음수는 payload-invalid 로 거부)."}},required:["id"]}),"sequenceFlow.add":sn("sequenceFlow.add",{description:"시퀀스 플로우 추가. 분기 조건은 게이트웨이가 아닌 플로우의 condition 에 싣는다.",properties:{flow:{$ref:"#/$defs/irSequenceFlow"}},required:["flow"]}),"sequenceFlow.update":sn("sequenceFlow.update",{description:"시퀀스 플로우 이름/조건/끝점 갱신. condition: null = 조건 제거. source/target = 끝점 재배선 — 중간 삽입은 기존 플로우를 지우지 말고 이것으로 한쪽 끝을 옮긴 뒤 새 플로우를 추가한다.",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"},condition:{description:"생략 = 보존, null = 제거.",anyOf:[{$ref:"#/$defs/irFlowCondition"},{type:"null"}]},source:{description:"새 출발 노드 id(생략 = 보존). 같은 배치에서 추가한 노드도 지목할 수 있다.",type:"string"},target:{description:"새 도착 노드 id(생략 = 보존). 같은 배치에서 추가한 노드도 지목할 수 있다.",type:"string"}},required:["id"]}),"messageFlow.add":sn("messageFlow.add",{description:"메시지 플로우 추가(풀 경계를 넘는 연결).",properties:{flow:{$ref:"#/$defs/irMessageFlow"}},required:["flow"]}),"messageFlow.update":sn("messageFlow.update",{description:"메시지 플로우 이름 갱신.",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"}},required:["id"]}),"dataStore.add":sn("dataStore.add",{description:"데이터 스토어 추가(+ 입출력 연관 동반 가능).",properties:{dataStore:{$ref:"#/$defs/irDataStore"},associations:{type:"array",items:{$ref:"#/$defs/irDataAssociation"}}},required:["dataStore"]}),"dataStore.update":sn("dataStore.update",{description:"데이터 스토어 이름 갱신.",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"}},required:["id"]}),"dataAssociation.add":sn("dataAssociation.add",{description:"기존 노드 ↔ 기존 데이터 스토어의 입출력 연관 추가.",properties:{association:{$ref:"#/$defs/irDataAssociation"}},required:["association"]}),"association.add":sn("association.add",{description:"주석 ↔ 요소 연관 추가(한쪽 끝은 주석). 주석 신설과 함께면 annotation.add 의 association 을 쓰고, 이 op 는 추가 연관(한 주석에 여러 연관)용.",properties:{association:{$ref:"#/$defs/irAssociation"}},required:["association"]}),"annotation.add":sn("annotation.add",{description:"텍스트 주석 추가. association 으로 대상 요소와 연결하고, placement 로 방위를 지정하면 결정적 배치된다.",properties:{annotation:{$ref:"#/$defs/irTextAnnotation"},association:{$ref:"#/$defs/irAssociation"},placement:{$ref:"#/$defs/bwlPlacement"}},required:["annotation"]}),"annotation.update":sn("annotation.update",{description:"주석 본문/방위 힌트 갱신. placement: null = 힌트 제거(휴리스틱 복귀). 주석 삭제는 element.remove.",properties:{id:{type:"string"},text:{type:"string"},placement:{description:"생략 = 보존, null = 힌트 제거.",anyOf:[{$ref:"#/$defs/bwlPlacement"},{type:"null"}]}},required:["id"]}),"group.add":sn("group.add",{description:"그룹 추가 — 바운즈는 members 의 bbox 로 산출되므로 좌표를 지정하지 않는다.",properties:{group:{$ref:"#/$defs/irGroup"}},required:["group"]}),"group.update":sn("group.update",{description:"그룹 이름/멤버 갱신. members 는 전체 재선언(생략 = 보존).",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"},members:{type:"array",items:{type:"string"}}},required:["id"]}),"element.remove":sn("element.remove",{description:"요소 제거(카테고리 무관). 부착된 연결선은 함께 제거된다.",properties:{id:{type:"string"}},required:["id"]})},id={anyOf:nd.map(e=>C0[e])},P0={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:h0,irParticipant:m0,irNode:g0,irFlowCondition:y0,irSequenceFlow:v0,irMessageFlow:b0,irDataStore:_0,irDataAssociation:x0,irTextAnnotation:w0,irAssociation:E0,irGroup:S0,bwlPlacement:R0,nullableString:d0,symbolicOp:id}};function ku(e){return Array.prototype.concat.apply([],e)}const Vo=Object.prototype.toString,A0=Object.prototype.hasOwnProperty;function Cr(e){return e===void 0}function Ht(e){return e!==void 0}function eo(e){return e==null}function Ae(e){return Vo.call(e)==="[object Array]"}function Yt(e){return Vo.call(e)==="[object Object]"}function De(e){return Vo.call(e)==="[object Number]"}function Kt(e){const t=Vo.call(e);return t==="[object Function]"||t==="[object AsyncFunction]"||t==="[object GeneratorFunction]"||t==="[object AsyncGeneratorFunction]"||t==="[object Proxy]"}function xn(e){return Vo.call(e)==="[object String]"}function T0(e){if(!Ae(e))throw new Error("must supply array")}function wn(e,t){return!eo(e)&&A0.call(e,t)}function ft(e,t){const n=es(t);let i;return L(e,function(r,o){if(n(r,o))return i=r,!1}),i}function rd(e,t){const n=es(t);let i=Ae(e)?-1:void 0;return L(e,function(r,o){if(n(r,o))return i=o,!1}),i}function ze(e,t){const n=es(t);let i=[];return L(e,function(r,o){n(r,o)&&i.push(r)}),i}function L(e,t){let n,i;if(Cr(e))return;const r=Ae(e)?L0:D0;for(let o in e)if(wn(e,o)&&(n=e[o],i=t(n,r(o)),i===!1))return n}function M0(e,t){if(Cr(e))return[];T0(e);const n=es(t);return e.filter(function(i,r){return!n(i,r)})}function En(e,t,n){return L(e,function(i,r){n=t(n,i,r)}),n}function Pr(e,t){return!!En(e,function(n,i,r){return n&&t(i,r)},!0)}function Yi(e,t){return!!ft(e,t)}function cn(e,t){let n=[];return L(e,function(i,r){n.push(t(i,r))}),n}function Ja(e){return e&&Object.keys(e)||[]}function k0(e){return Ja(e).length}function to(e){return cn(e,t=>t)}function no(e,t,n={}){return t=Ou(t),L(e,function(i){let r=t(i)||"_",o=n[r];o||(o=n[r]=[]),o.push(i)}),n}function od(e,...t){e=Ou(e);let n={};return L(t,r=>no(r,e,n)),cn(n,function(r,o){return r[0]})}const O0=od;function oi(e,t){t=Ou(t);let n=[];return L(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 io(e){return function(t){return Pr(e,function(n,i){return t[i]===n})}}function Ou(e){return Kt(e)?e:t=>t[e]}function es(e){return Kt(e)?e:t=>t===e}function D0(e){return e}function L0(e){return Number(e)}function Du(e,t){let n,i,r,o;function a(p){let f=Date.now(),d=p?0:o+t-f;if(d>0)return s(d);e.apply(r,i),c()}function s(p){n=setTimeout(a,p)}function c(){n&&clearTimeout(n),n=o=i=r=void 0}function u(){n&&a(!0),c()}function l(...p){o=Date.now(),i=p,r=this,n||s(t)}return l.flush=u,l.cancel=c,l}function vn(e,t){return e.bind(t)}function j(e,...t){return Object.assign(e,...t)}function I0(e,t,n){let i=e;return L(t,function(r,o){if(typeof r!="number"&&typeof r!="string")throw new Error("illegal key type: "+typeof r+". Key should be of type number or string.");if(r==="constructor")throw new Error("illegal key: constructor");if(r==="__proto__")throw new Error("illegal key: __proto__");let a=t[o+1],s=i[r];Ht(a)&&eo(s)&&(s=i[r]=isNaN(+a)?{}:[]),Cr(a)?Cr(n)?delete i[r]:i[r]=n:i=s}),e}function ti(e,t){let n={},i=Object(e);return L(t,function(r){r in i&&(n[r]=e[r])}),n}function ai(e,t){let n={},i=Object(e);return L(i,function(r,o){t.indexOf(o)===-1&&(n[o]=r)}),n}function Lu(){}Lu.prototype.get=function(e){return this.$model.properties.get(this,e)},Lu.prototype.set=function(e,t){this.$model.properties.set(this,e,t)};function ad(e,t){this.model=e,this.properties=t}ad.prototype.createType=function(e){var t=this.model,n=this.properties,i=Object.create(Lu.prototype);L(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}),L(a,vn(function(s,c){this.set(c,s)},this))}return o.prototype=i,o.hasType=i.$instanceOf=this.model.hasType,n.defineModel(o,t),n.defineDescriptor(o,e),o};var B0=j(Object.create(null),{String:!0,Boolean:!0,Integer:!0,Real:!0,Element:!0}),sd=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 Iu(e,t){var n=sd[e];return n?n(t):t}function Bu(e){return!!B0[e]}function cd(e){return!!sd[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 Dn(e){this.ns=e,this.name=e.name,this.allTypes=[],this.allTypesByName=Object.create(null),this.properties=[],this.propertiesByName=Object.create(null)}Dn.prototype.build=function(){return ti(this,["ns","name","allTypes","allTypesByName","properties","propertiesByName","bodyProperty","idProperty"])},Dn.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)},Dn.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},Dn.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},Dn.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},Dn.prototype.removeNamedProperty=function(e){var t=e.ns,n=this.propertiesByName;delete n[t.name],delete n[t.localName]},Dn.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},Dn.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},Dn.prototype.assertNotTrait=function(e){if((e.extends||[]).length)throw new Error(`cannot create <${e.name}> extending <${e.extends}>`)},Dn.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")},Dn.prototype.hasProperty=function(e){return this.propertiesByName[e]},Dn.prototype.addTrait=function(e,t){t&&this.assertNotTrait(e);var n=this.allTypesByName,i=this.allTypes,r=e.name;r in n||(L(e.properties,vn(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,L(e,vn(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;ud(t,e,"prefix"),ud(t,e,"uri"),L(e.types,vn(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);L(e.properties,vn(function(o){var a=un(o.name,n.prefix),s=a.name;Bu(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}),L(e.extends,vn(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=Bu(e.name)?{name:e.name}:this.typeMap[e.name],r=this;function o(c,u){var l=un(c,Bu(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+">");L(i.superClass,n?a:s),t(i,!n),L(i.traits,a)},Ki.prototype.getEffectiveDescriptor=function(e){var t=un(e),n=new Dn(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 ud(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(!xn(t)||!t.length)throw new TypeError("property name must be a non-empty string");var i=this.getProperty(e,t),r=i&&i.name;N0(n)?i?delete e[r]:delete e.$attrs[Nu(t)]:i?r in e?e[r]=n:ld(e,i,n):e.$attrs[Nu(t)]=n},Ar.prototype.get=function(e,t){var n=this.getProperty(e,t);if(!n)return e.$attrs[Nu(t)];var i=n.name;return!e[i]&&n.isMany&&ld(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 N0(e){return typeof e>"u"}function ld(e,t,n){Object.defineProperty(e,t.name,{enumerable:!t.isReference,writable:!0,value:n,configurable:!0})}function Nu(e){return e.replace(/^:/,"")}function $n(e,t={}){this.properties=new Ar(this),this.factory=new ad(this,this.properties),this.registry=new Ki(e,this.properties),this.typeCache=Object.create(null),this.config=t}$n.prototype.create=function(e,t){var n=this.getType(e);if(!n)throw new Error("unknown type <"+e+">");return new n(t)},$n.prototype.getType=function(e){var t=this.typeCache,n=xn(e)?e:e.ns.name,i=t[n];return i||(e=this.registry.getEffectiveDescriptor(n),i=t[n]=this.factory.createType(e)),i},$n.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){I0(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}),L(n,function(a,s){Yt(a)&&a.value!==void 0?r[a.name]=a.value:r[s]=a}),r},$n.prototype.getPackage=function(e){return this.registry.getPackage(e)},$n.prototype.getPackages=function(){return this.registry.getPackages()},$n.prototype.getElementDescriptor=function(e){return e.$descriptor},$n.prototype.hasType=function(e,t){t===void 0&&(t=e,e=this);var n=e.$model.getElementDescriptor(e);return t in n.allTypesByName},$n.prototype.getPropertyDescriptor=function(e,t){return this.getElementDescriptor(e).propertiesByName[t]},$n.prototype.getTypeDescriptor=function(e){return this.registry.typeMap[e]};var pd=String.fromCharCode,$0=Object.prototype.hasOwnProperty,j0=/&#(\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 F0(e,t,n,i){return i?$0.call(Wo,i)?Wo[i]:"&"+i+";":pd(t||parseInt(n,16))}function Tr(e){return e.length>3&&e.indexOf("&")!==-1?e.replace(j0,F0):e}var fd="non-whitespace outside of root node";function Xi(e){return new Error(e)}function H0(e){return"missing namespace for prefix <"+e+">"}function ts(e){return{get:e,enumerable:!0}}function z0(e){var t=Object.create(null),n;for(n in e)t[n]=e[n];return t}var dd=Symbol("nameCache");function $u(e){return e+"$uri"}function G0(e){var t=Object.create(null),n,i;for(n in e)i=e[n],t[i]=i,t[$u(i)]=n;return t}function ns(){return{line:0,column:0}}function V0(e){throw e}function hd(e){if(!this)return new hd(e);var t=e&&e.proxy,n,i,r,o,a=V0,s,c,u,l,p=ns,f=!1,d=!1,g="",h=!1,m=!1,S=null,y=!1,x,E,P,C;function D(O){O instanceof Error||(O=Xi(O)),S=O,a(O,p)}function A(O){s&&(O instanceof Error||(O=Xi(O)),s(O,p))}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),oe;for(oe in O)$[oe]=O[oe];return m=!0,C=$,this};function I(){x=m?[]:null,E=m?G0(C):null,P=[],p=ns,y=!1,S=null,d=!1,g=""}this.parse=function(O){if(typeof O!="string")throw Xi("required args <xml=string>");if(f)throw Xi("parse during stream; call end() first");return I(),k(O),p=ns,y=!1,S},this.write=function(O){if(typeof O!="string")throw Xi("required args <xml=string>");return f||(I(),f=!0),S||(g=k(g+O,!0)||""),this},this.end=function(){return f||I(),f=!1,S||k(g),g="",p=ns,y=!1,S},this.stop=function(){y=!0};function k(O,$=!1){var oe=null,ve=null,Ue,Y=0,pe=!1,ge=!1,le=0,Ee=0,re,q,U,Z,Fe,wt,M,w,v,N="",V=0,K;function ye(rt,$t){var At=rt.indexOf(":");if(At===-1)return rt;var yn=E[rt.substring(0,At)];return yn?$t===yn?rt.substr(At+1):yn+rt.substr(At):(A(H0(rt.substring(0,At))),null)}function Ne(){if(K!==null)return K;var rt,$t,At=m&&E.xmlns,yn=m&&h?[]:null,st=V,Rt=N,Jt=Rt.length,Kr,Qn,ri,Jn,jt,qi={},Xa=new Set,Nn,tt,et;e:for(;st<Jt;st++)if(Nn=!1,tt=Rt.charCodeAt(st),!(tt===32||tt<14&&tt>8)){for((tt<65||tt>122||tt>90&&tt<97)&&tt!==95&&tt!==58&&(A("illegal first char attribute name"),Nn=!0),et=st+1;et<Jt;et++)if(tt=Rt.charCodeAt(et),!(tt>96&&tt<123||tt>64&&tt<91||tt>47&&tt<59||tt===46||tt===45||tt===95)){if(tt===32||tt<14&&tt>8){A("missing attribute value"),st=et;continue e}if(tt===61)break;A("illegal attribute name char"),Nn=!0}if(jt=Rt.substring(st,et),jt==="xmlns:xmlns"&&(A("illegal declaration of xmlns"),Nn=!0),tt=Rt.charCodeAt(et+1),tt===34)et=Rt.indexOf('"',st=et+2),et===-1&&(et=Rt.indexOf("'",st),et!==-1&&(A("attribute value quote missmatch"),Nn=!0));else if(tt===39)et=Rt.indexOf("'",st=et+2),et===-1&&(et=Rt.indexOf('"',st),et!==-1&&(A("attribute value quote missmatch"),Nn=!0));else for(A("missing attribute value quotes"),Nn=!0,et=et+1;et<Jt&&(tt=Rt.charCodeAt(et+1),!(tt===32||tt<14&&tt>8));et++);for(et===-1&&(A("missing closing quotes"),et=Jt,Nn=!0),Nn||(ri=Rt.substring(st,et)),st=et;et+1<Jt&&(tt=Rt.charCodeAt(et+1),!(tt===32||tt<14&&tt>8));et++)st===et&&(A("illegal character after attribute end"),Nn=!0);if(st=et+1,Nn)continue e;if(Xa.has(jt)){A("attribute <"+jt+"> already defined");continue}if(Xa.add(jt),!m){qi[jt]=ri;continue}if(h){if(Qn=jt==="xmlns"?"xmlns":jt.charCodeAt(0)===120&&jt.substr(0,6)==="xmlns:"?jt.substr(6):null,Qn!==null){if(rt=Tr(ri),$t=$u(Qn),Jn=C[rt],!Jn){if(Qn==="xmlns"||$t in E&&E[$t]!==rt)do Jn="ns"+Y++;while(typeof E[Jn]<"u");else Jn=Qn;C[rt]=Jn}E[Qn]!==Jn&&(Kr||(E=z0(E),Kr=!0),E[Qn]=Jn,Qn==="xmlns"&&(E[$u(Jn)]=rt,At=Jn),E[$t]=rt),qi[jt]=ri;continue}yn.push(jt,ri);continue}jt=ye(jt,At),jt!==null&&(qi[jt]=ri)}if(h)for(st=0,Jt=yn.length;st<Jt;st++)jt=ye(yn[st++],At),ri=yn[st],jt!==null&&(qi[jt]=ri);return K=qi}function Ze(){for(var rt=/(\r\n|\r|\n)/g,$t=0,At=0,yn=0,st=Ee,Rt,Jt;le>=yn&&(Rt=rt.exec(O),!(!Rt||(st=Rt[0].length+Rt.index,st>le)));)$t+=1,yn=st;return le==-1?(At=st,Jt=O.substring(Ee)):Ee===0?Jt=O.substring(Ee,le):(At=le-yn,Jt=Ee==-1?O.substring(le):O.substring(le,Ee+1)),{data:Jt,line:$t,column:At}}for(p=Ze,t&&(v=Object.create({},{name:ts(function(){return M}),originalName:ts(function(){return w}),attrs:ts(Ne),ns:ts(function(){return E})}));Ee!==-1;){if(O.charCodeAt(Ee)===60?le=Ee:le=O.indexOf("<",Ee),le===-1){if($)return O.substring(Ee);if(P.length)return D("unexpected end of file");if(!d)return D("missing start tag");Ee<O.length&&O.substring(Ee).trim()&&A(fd);return}if(d||(d=!0),Ee!==le){if(P.length){if(n&&(n(O.substring(Ee,le),Tr,p),y))return}else if(O.substring(Ee,le).trim()&&(A(fd),y))return}if(Z=O.charCodeAt(le+1),Z===33){if(U=O.charCodeAt(le+2),U===91&&O.substr(le+3,6)==="CDATA["){if(Ee=O.indexOf("]]>",le),Ee===-1)return $?O.substring(le):D("unclosed cdata");if(o&&(o(O.substring(le+9,Ee),p),y))return;Ee+=3;continue}if(U===45&&O.charCodeAt(le+3)===45){if(Ee=O.indexOf("-->",le),Ee===-1)return $?O.substring(le):D("unclosed comment");if(c&&(c(O.substring(le+4,Ee),Tr,p),y))return;Ee+=3;continue}}if(Z===63){if(Ee=O.indexOf("?>",le),Ee===-1)return $?O.substring(le):D("unclosed question");if(u&&(u(O.substring(le,Ee+2),p),y))return;Ee+=2;continue}for(re=le+1;;re++){if(Fe=O.charCodeAt(re),isNaN(Fe))return $?O.substring(le):(Ee=-1,D("unclosed tag"));if(Fe===34)U=O.indexOf('"',re+1),re=U!==-1?U:re;else if(Fe===39)U=O.indexOf("'",re+1),re=U!==-1?U:re;else if(Fe===62){Ee=re;break}}if(Z===33){if(l&&(l(O.substring(le,Ee+1),Tr,p),y))return;Ee+=1;continue}if(K={},Z===47){if(pe=!1,ge=!0,!P.length)return D("missing open tag");if(re=M=P.pop(),U=le+2+re.length,O.substring(le+2,U)!==re)return D("closing tag mismatch");for(;U<Ee;U++)if(Z=O.charCodeAt(U),!(Z===32||Z>8&&Z<14))return D("close tag")}else{if(O.charCodeAt(Ee-1)===47?(re=M=O.substring(le+1,Ee-1),pe=!0,ge=!0):(re=M=O.substring(le+1,Ee),pe=!0,ge=!1),!(Z>96&&Z<123||Z>64&&Z<91||Z===95||Z===58))return D("illegal first char nodeName");for(U=1,q=re.length;U<q;U++)if(Z=re.charCodeAt(U),!(Z>96&&Z<123||Z>64&&Z<91||Z>47&&Z<59||Z===45||Z===95||Z==46)){if(Z===32||Z<14&&Z>8){M=re.substring(0,U),K=null;break}return D("invalid nodeName")}ge||P.push(M)}if(m){Ue=E,pe&&(ge||x.push(Ue),K===null&&(h=re.indexOf("xmlns",U)!==-1)&&(V=U,N=re,Ne(),h=!1)),w=M,ve!==E&&(oe=E[dd],oe===void 0&&(oe=E[dd]=Object.create(null)),ve=E);var Pt=oe[M];if(Pt!==void 0)M=Pt;else{if(Z=M.indexOf(":"),Z!==-1){if(wt=E[M.substring(0,Z)],!wt)return D("missing namespace on <"+w+">");M=M.substr(Z+1)}else wt=E.xmlns;wt&&(M=wt+":"+M),oe[w]=M}}if(pe&&(V=U,N=re,i&&(t?i(v,Tr,ge,p):i(M,Ne,Tr,ge,p),y)))return;if(ge){if(r&&(r(t?v:M,Tr,pe,p),y))return;m&&(pe?E=Ue:E=x.pop())}Ee+=1}}}function md(e){return e.xml&&e.xml.tagAlias==="lowerCase"}var ju={xsi:"http://www.w3.org/2001/XMLSchema-instance",xml:"http://www.w3.org/XML/1998/namespace"},gd="property";function yd(e){return e.xml&&e.xml.serialize}function W0(e){const t=yd(e);return t!==gd&&(t||null)}function U0(e){return e.charAt(0).toUpperCase()+e.slice(1)}function vd(e,t){return md(t)?e.prefix+":"+U0(e.localName):e.name}function q0(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 Y0(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 q0(o,a)}function Zi(e){return new Error(e)}function Si(e){return e.$descriptor}function K0(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=Si(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 Fu(){}Fu.prototype=Object.create(Uo.prototype),Fu.prototype.handleNode=function(){return this};function ro(){}ro.prototype=Object.create(Uo.prototype),ro.prototype.handleText=function(e){this.body=(this.body||"")+e};function qo(e,t){this.property=e,this.context=t}qo.prototype=Object.create(ro.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 Hu(e,t){this.element=t,this.propertyDesc=e}Hu.prototype=Object.create(ro.prototype),Hu.prototype.handleEnd=function(){var e=this.body||"",t=this.element,n=this.propertyDesc;e=Iu(n.type,e),n.isMany?t.get(n.name).push(e):t.set(n.name,e)};function is(){}is.prototype=Object.create(ro.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=Si(t),i=n.bodyProperty;if(!i)throw Zi("unexpected body text <"+e+">");ro.prototype.handleText.call(this,e)},dn.prototype.handleEnd=function(){var e=this.body,t=this.element,n=Si(t),i=n.bodyProperty;i&&e!==void 0&&(e=Iu(i.type,e),t.set(i.name,e))},dn.prototype.createElement=function(e){var t=e.attributes,n=this.type,i=Si(n),r=this.context,o=new n({}),a=this.model,s;return L(t,function(c,u){var l=i.propertiesByName[u],p;l&&l.isReference?l.isMany?(p=c.split(" "),L(p,function(f){r.addReference({element:o,property:l.ns.name,id:f})})):r.addReference({element:o,property:l.ns.name,id:c}):(l?c=Iu(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=Si(i),a=n.name,s=o.propertiesByName[a];if(s&&!s.isAttr){const u=W0(s);if(u){const l=e.attributes[u];if(l){const p=Y0(l,e.ns,r),f=r.getType(p);return j({},s,{effectiveType:Si(f).name})}}return s}var c=r.getPackage(n.prefix);if(c){const u=vd(n,c),l=r.getType(u);if(s=ft(o.properties,function(p){return!p.isVirtual&&!p.isReference&&!p.isAttribute&&l.hasType(p.type)}),s)return j({},s,{effectiveType:Si(l).name})}else if(s=ft(o.properties,function(u){return!u.isReference&&!u.isAttribute&&u.type==="Element"}),s)return s;throw Zi("unrecognized element <"+n.name+">")},dn.prototype.toString=function(){return"ElementDescriptor["+Si(this.type).name+"]"},dn.prototype.valueHandler=function(e,t){return new Hu(e,t)},dn.prototype.referenceHandler=function(e){return new qo(e,this.context)},dn.prototype.handler=function(e){return e==="Element"?new oo(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,cd(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 zu(e,t,n){dn.call(this,e,t,n)}zu.prototype=Object.create(dn.prototype),zu.prototype.createElement=function(e){var t=e.name,n=un(t),i=this.model,r=this.type,o=i.getPackage(n.prefix),a=o&&vd(n,o)||t;if(!r.hasType(a))throw Zi("unexpected element <"+e.originalName+">");return dn.prototype.createElement.call(this,e)};function oo(e,t,n){this.model=e,this.context=n}oo.prototype=Object.create(is.prototype),oo.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)},oo.prototype.handleChild=function(e){var t=new oo(this.model,"Element",this.context).handleNode(e),n=this.element,i=t.element,r;return i!==void 0&&(r=n.$children=n.$children||[],r.push(i),i.$parent=n),t},oo.prototype.handleEnd=function(){this.body&&(this.element.$body=this.body)};function Gu(e){e instanceof $n&&(e={model:e}),j(this,{lax:!1},e)}Gu.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 K0(j({},t,{rootHandler:i})),s=new hd({proxy:!0}),c=X0();i.context=a,c.push(i);function u(P,C,D){var A=C(),I=A.line,k=A.column,O=A.data;O.charAt(0)==="<"&&O.indexOf(" ")!==-1&&(O=O.slice(0,O.indexOf(" "))+">");var $="unparsable content "+(O?O+" ":"")+`detected
2
- line: `+I+`
1
+ (function(ae,At){typeof exports=="object"&&typeof module<"u"?At(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],At):(ae=typeof globalThis<"u"?globalThis:ae||self,At(ae.BpmnModeler={},ae.Vue))})(this,(function(ae,At){"use strict";var VD=Object.defineProperty;var WD=(ae,At,xi)=>At in ae?VD(ae,At,{enumerable:!0,configurable:!0,writable:!0,value:xi}):ae[At]=xi;var Zr=(ae,At,xi)=>WD(ae,typeof At!="symbol"?At+"":At,xi);const xi=["startEvent","endEvent","userTask","serviceTask","task","sendTask","receiveTask","exclusiveGateway","parallelGateway"];function Jf(e){return xi.includes(e)}const ed="http://g1project.net/spec/bpmn/bwl/1.0",Au="bwl",Tu=["top-left","top","top-right","right","bottom-right","bottom","bottom-left","left"],td={name:"bwl-hints",uri:ed,prefix:Au,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"}]}]},Mu="bwl.undoEpisode",nd=new WeakSet;function d0(e){nd.has(e)||(e.register(Mu,{preExecute(t){try{t.run()}catch(n){t.error=n}}}),nd.add(e))}function id(e,t){d0(e);const n={run:t};if(e.execute(Mu,n),n.error!==void 0)throw e.canUndo()&&e.undo(),n.error}const rd=["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"],h0={description:"생략 = 보존, null = 제거.",anyOf:[{type:"string"},{type:"null"}]},m0={type:"object",description:"레인. 배열 선언 순서 = 풀 내 상→하 순서.",properties:{id:{type:"string"},name:{type:"string"}},required:["id"],additionalProperties:!1},g0={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},y0={type:"object",description:"플로우 노드. 좌표는 지정하지 않는다 — 배치는 resolver 가 결정한다.",properties:{id:{type:"string"},type:{type:"string",enum:[...xi]},name:{type:"string"},participant:{type:"string",description:"소속 풀 id(협업 문서)."},lane:{type:"string",description:"소속 레인 id(풀 정의에 선언된 것)."}},required:["id","type"],additionalProperties:!1},v0={type:"object",description:"분기 조건 — 게이트웨이가 아닌 플로우에 붙인다. MVP 는 label 만.",properties:{label:{type:"string"}},required:["label"],additionalProperties:!1},b0={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},_0={type:"object",description:"메시지 플로우(풀 경계를 넘는 연결 — 노드 또는 블랙박스 풀 자체가 끝점).",properties:{id:{type:"string"},source:{type:"string"},target:{type:"string"},name:{type:"string"}},required:["id","source","target"],additionalProperties:!1},x0={type:"object",properties:{id:{type:"string"},name:{type:"string"}},required:["id"],additionalProperties:!1},w0={type:"object",description:"데이터 입출력 연관. 방향 = source→target(태스크→스토어 = 쓰기, 스토어→태스크 = 읽기).",properties:{id:{type:"string"},source:{type:"string"},target:{type:"string"}},required:["source","target"],additionalProperties:!1},E0={type:"object",properties:{id:{type:"string"},text:{type:"string"}},required:["id","text"],additionalProperties:!1},S0={type:"object",description:"연관선(주석 ↔ 요소).",properties:{id:{type:"string"},source:{type:"string"},target:{type:"string"}},required:["source","target"],additionalProperties:!1},R0={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},C0={type:"object",description:"주석 방위 힌트 — 앵커 요소 기준 상대 배치. 있으면 결정적 배치, 없으면 휴리스틱.",properties:{anchor:{type:"string",description:"기준 요소 id."},side:{type:"string",enum:[...Tu]},offset:{type:"number",description:"앵커 가장자리 → 주석 가장자리 간격(px). 생략 시 50."}},required:["anchor","side"],additionalProperties:!1};function rn(e,t){return{type:"object",description:t.description,properties:{kind:{const:e},...t.properties},required:["kind",...t.required??[]],additionalProperties:!1}}const P0={"participant.add":rn("participant.add",{description:"풀 추가. order = 풀 세로 순서 힌트 — **작을수록 위**(생략 시 op 순서가 곧 배치 순서). 값은 상대 순서만 쓰므로 1,2,3… 연속이든 10,20,30 간격이든 같다.",properties:{participant:{$ref:"#/$defs/irParticipant"},order:{type:"integer"}},required:["participant"]}),"participant.update":rn("participant.update",{description:"풀 이름/레인 갱신. lanes 는 전체 재선언(생략 = 보존) — 기존 레인을 유지하려면 함께 다시 나열한다.",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"},lanes:{type:"array",items:{$ref:"#/$defs/irLane"}}},required:["id"]}),"node.add":rn("node.add",{description:'플로우 노드 추가. band = 가로 밴드 순번 힌트(주 흐름 0, 갈래 1, 2…) — 위/아래가 아니라 "주 흐름에서 몇 번째 갈래"다. 행 배치(어느 갈래가 위/아래인지)는 호스트가 정한다(대칭·메시지 방향). 레인이 있으면 그 레인 안의 밴드다 — 한 레인 안에서 게이트웨이 출구를 갈라 놓을 때 쓴다. 컨테이너(풀·레인)는 밴드 수만큼 자란다.',properties:{node:{$ref:"#/$defs/irNode"},band:{type:"integer",description:"0 이상 정수(음수는 payload-invalid 로 거부)."}},required:["node"]}),"node.update":rn("node.update",{description:"노드 이름/레인/타입/밴드 갱신. lane = 레인 재배정(이동), type = 태스크·이벤트 타입 전환, band = 행 재지정. 🔴 **기존 문서에서 band 는 「몇 번째 갈래」가 아니라 그 컨테이너의 행 번호**다(describe 의 hints.bands 가 보여 주는 값) — 신규 배치의 band 가 대칭으로 펴지는 것과 다르다. 간선이 도형을 가로지르거나 반대 방향으로 겹칠 때 그 노드를 다른 행으로 옮기는 채널이다.",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"},lane:{type:"string"},type:{type:"string",enum:[...xi]},band:{type:"integer",description:"0 이상 정수(음수는 payload-invalid 로 거부)."}},required:["id"]}),"sequenceFlow.add":rn("sequenceFlow.add",{description:"시퀀스 플로우 추가. 분기 조건은 게이트웨이가 아닌 플로우의 condition 에 싣는다.",properties:{flow:{$ref:"#/$defs/irSequenceFlow"}},required:["flow"]}),"sequenceFlow.update":rn("sequenceFlow.update",{description:"시퀀스 플로우 이름/조건/끝점 갱신. condition: null = 조건 제거. source/target = 끝점 재배선 — 중간 삽입은 기존 플로우를 지우지 말고 이것으로 한쪽 끝을 옮긴 뒤 새 플로우를 추가한다.",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"},condition:{description:"생략 = 보존, null = 제거.",anyOf:[{$ref:"#/$defs/irFlowCondition"},{type:"null"}]},source:{description:"새 출발 노드 id(생략 = 보존). 같은 배치에서 추가한 노드도 지목할 수 있다.",type:"string"},target:{description:"새 도착 노드 id(생략 = 보존). 같은 배치에서 추가한 노드도 지목할 수 있다.",type:"string"}},required:["id"]}),"messageFlow.add":rn("messageFlow.add",{description:"메시지 플로우 추가(풀 경계를 넘는 연결).",properties:{flow:{$ref:"#/$defs/irMessageFlow"}},required:["flow"]}),"messageFlow.update":rn("messageFlow.update",{description:"메시지 플로우 이름 갱신.",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"}},required:["id"]}),"dataStore.add":rn("dataStore.add",{description:"데이터 스토어 추가(+ 입출력 연관 동반 가능).",properties:{dataStore:{$ref:"#/$defs/irDataStore"},associations:{type:"array",items:{$ref:"#/$defs/irDataAssociation"}}},required:["dataStore"]}),"dataStore.update":rn("dataStore.update",{description:"데이터 스토어 이름 갱신.",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"}},required:["id"]}),"dataAssociation.add":rn("dataAssociation.add",{description:"기존 노드 ↔ 기존 데이터 스토어의 입출력 연관 추가.",properties:{association:{$ref:"#/$defs/irDataAssociation"}},required:["association"]}),"association.add":rn("association.add",{description:"주석 ↔ 요소 연관 추가(한쪽 끝은 주석). 주석 신설과 함께면 annotation.add 의 association 을 쓰고, 이 op 는 추가 연관(한 주석에 여러 연관)용.",properties:{association:{$ref:"#/$defs/irAssociation"}},required:["association"]}),"annotation.add":rn("annotation.add",{description:"텍스트 주석 추가. association 으로 대상 요소와 연결하고, placement 로 방위를 지정하면 결정적 배치된다.",properties:{annotation:{$ref:"#/$defs/irTextAnnotation"},association:{$ref:"#/$defs/irAssociation"},placement:{$ref:"#/$defs/bwlPlacement"}},required:["annotation"]}),"annotation.update":rn("annotation.update",{description:"주석 본문/방위 힌트 갱신. placement: null = 힌트 제거(휴리스틱 복귀). 주석 삭제는 element.remove.",properties:{id:{type:"string"},text:{type:"string"},placement:{description:"생략 = 보존, null = 힌트 제거.",anyOf:[{$ref:"#/$defs/bwlPlacement"},{type:"null"}]}},required:["id"]}),"group.add":rn("group.add",{description:"그룹 추가 — 바운즈는 members 의 bbox 로 산출되므로 좌표를 지정하지 않는다.",properties:{group:{$ref:"#/$defs/irGroup"}},required:["group"]}),"group.update":rn("group.update",{description:"그룹 이름/멤버 갱신. members 는 전체 재선언(생략 = 보존).",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"},members:{type:"array",items:{type:"string"}}},required:["id"]}),"element.remove":rn("element.remove",{description:"요소 제거(카테고리 무관). 부착된 연결선은 함께 제거된다.",properties:{id:{type:"string"}},required:["id"]})},od={anyOf:rd.map(e=>P0[e])},A0={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:m0,irParticipant:g0,irNode:y0,irFlowCondition:v0,irSequenceFlow:b0,irMessageFlow:_0,irDataStore:x0,irDataAssociation:w0,irTextAnnotation:E0,irAssociation:S0,irGroup:R0,bwlPlacement:C0,nullableString:h0,symbolicOp:od}};function ku(e){return Array.prototype.concat.apply([],e)}const Vo=Object.prototype.toString,T0=Object.prototype.hasOwnProperty;function Sr(e){return e===void 0}function Nt(e){return e!==void 0}function Qr(e){return e==null}function ke(e){return Vo.call(e)==="[object Array]"}function Vt(e){return Vo.call(e)==="[object Object]"}function Le(e){return Vo.call(e)==="[object Number]"}function Wt(e){const t=Vo.call(e);return t==="[object Function]"||t==="[object AsyncFunction]"||t==="[object GeneratorFunction]"||t==="[object AsyncGeneratorFunction]"||t==="[object Proxy]"}function xn(e){return Vo.call(e)==="[object String]"}function M0(e){if(!ke(e))throw new Error("must supply array")}function wn(e,t){return!Qr(e)&&T0.call(e,t)}function lt(e,t){const n=ts(t);let i;return L(e,function(r,o){if(n(r,o))return i=r,!1}),i}function ad(e,t){const n=ts(t);let i=ke(e)?-1:void 0;return L(e,function(r,o){if(n(r,o))return i=o,!1}),i}function Ge(e,t){const n=ts(t);let i=[];return L(e,function(r,o){n(r,o)&&i.push(r)}),i}function L(e,t){let n,i;if(Sr(e))return;const r=ke(e)?I0:L0;for(let o in e)if(wn(e,o)&&(n=e[o],i=t(n,r(o)),i===!1))return n}function k0(e,t){if(Sr(e))return[];M0(e);const n=ts(t);return e.filter(function(i,r){return!n(i,r)})}function En(e,t,n){return L(e,function(i,r){n=t(n,i,r)}),n}function Rr(e,t){return!!En(e,function(n,i,r){return n&&t(i,r)},!0)}function Ui(e,t){return!!lt(e,t)}function on(e,t){let n=[];return L(e,function(i,r){n.push(t(i,r))}),n}function es(e){return e&&Object.keys(e)||[]}function O0(e){return es(e).length}function Jr(e){return on(e,t=>t)}function eo(e,t,n={}){return t=Ou(t),L(e,function(i){let r=t(i)||"_",o=n[r];o||(o=n[r]=[]),o.push(i)}),n}function sd(e,...t){e=Ou(e);let n={};return L(t,r=>eo(r,e,n)),on(n,function(r,o){return r[0]})}const D0=sd;function ii(e,t){t=Ou(t);let n=[];return L(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)}),on(n,i=>i.v)}function to(e){return function(t){return Rr(e,function(n,i){return t[i]===n})}}function Ou(e){return Wt(e)?e:t=>t[e]}function ts(e){return Wt(e)?e:t=>t===e}function L0(e){return e}function I0(e){return Number(e)}function Du(e,t){let n,i,r,o;function a(p){let f=Date.now(),d=p?0:o+t-f;if(d>0)return s(d);e.apply(r,i),c()}function s(p){n=setTimeout(a,p)}function c(){n&&clearTimeout(n),n=o=i=r=void 0}function u(){n&&a(!0),c()}function l(...p){o=Date.now(),i=p,r=this,n||s(t)}return l.flush=u,l.cancel=c,l}function mn(e,t){return e.bind(t)}function H(e,...t){return Object.assign(e,...t)}function N0(e,t,n){let i=e;return L(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];Nt(a)&&Qr(s)&&(s=i[r]=isNaN(+a)?{}:[]),Sr(a)?Sr(n)?delete i[r]:i[r]=n:i=s}),e}function Qn(e,t){let n={},i=Object(e);return L(t,function(r){r in i&&(n[r]=e[r])}),n}function ri(e,t){let n={},i=Object(e);return L(i,function(r,o){t.indexOf(o)===-1&&(n[o]=r)}),n}function Lu(){}Lu.prototype.get=function(e){return this.$model.properties.get(this,e)},Lu.prototype.set=function(e,t){this.$model.properties.set(this,e,t)};function cd(e,t){this.model=e,this.properties=t}cd.prototype.createType=function(e){var t=this.model,n=this.properties,i=Object.create(Lu.prototype);L(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}),L(a,mn(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 B0=H(Object.create(null),{String:!0,Boolean:!0,Integer:!0,Real:!0,Element:!0}),ud=H(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 Iu(e,t){var n=ud[e];return n?n(t):t}function Nu(e){return!!B0[e]}function ld(e){return!!ud[e]}function an(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 Ln(e){this.ns=e,this.name=e.name,this.allTypes=[],this.allTypesByName=Object.create(null),this.properties=[],this.propertiesByName=Object.create(null)}Ln.prototype.build=function(){return Qn(this,["ns","name","allTypes","allTypesByName","properties","propertiesByName","bodyProperty","idProperty"])},Ln.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)},Ln.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},Ln.prototype.redefineProperty=function(e,t,n){var i=e.ns.prefix,r=t.split("#"),o=an(r[0],i),a=an(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},Ln.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},Ln.prototype.removeNamedProperty=function(e){var t=e.ns,n=this.propertiesByName;delete n[t.name],delete n[t.localName]},Ln.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},Ln.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},Ln.prototype.assertNotTrait=function(e){if((e.extends||[]).length)throw new Error(`cannot create <${e.name}> extending <${e.extends}>`)},Ln.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")},Ln.prototype.hasProperty=function(e){return this.propertiesByName[e]},Ln.prototype.addTrait=function(e,t){t&&this.assertNotTrait(e);var n=this.allTypesByName,i=this.allTypes,r=e.name;r in n||(L(e.properties,mn(function(o){o=H({},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,L(e,mn(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=H({},e);var t=this.packageMap;pd(t,e,"prefix"),pd(t,e,"uri"),L(e.types,mn(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=H({},e,{superClass:(e.superClass||[]).slice(),extends:(e.extends||[]).slice(),properties:(e.properties||[]).slice(),meta:H({},e.meta||{})});var n=an(e.name,t.prefix),i=n.name,r=Object.create(null);L(e.properties,mn(function(o){var a=an(o.name,n.prefix),s=a.name;Nu(o.type)||(o.type=an(o.type,a.prefix).name),H(o,{ns:a,name:s}),r[s]=o},this)),H(e,{ns:n,name:i,propertiesByName:r}),L(e.extends,mn(function(o){var a=an(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=Nu(e.name)?{name:e.name}:this.typeMap[e.name],r=this;function o(c,u){var l=an(c,Nu(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+">");L(i.superClass,n?a:s),t(i,!n),L(i.traits,a)},qi.prototype.getEffectiveDescriptor=function(e){var t=an(e),n=new Ln(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 pd(e,t,n){var i=t[n];if(i in e)throw new Error("package with "+n+" <"+i+"> already defined")}function Cr(e){this.model=e}Cr.prototype.set=function(e,t,n){if(!xn(t)||!t.length)throw new TypeError("property name must be a non-empty string");var i=this.getProperty(e,t),r=i&&i.name;$0(n)?i?delete e[r]:delete e.$attrs[Bu(t)]:i?r in e?e[r]=n:fd(e,i,n):e.$attrs[Bu(t)]=n},Cr.prototype.get=function(e,t){var n=this.getProperty(e,t);if(!n)return e.$attrs[Bu(t)];var i=n.name;return!e[i]&&n.isMany&&fd(e,n,[]),e[i]},Cr.prototype.define=function(e,t,n){if(!n.writable){var i=n.value;n=H({},n,{get:function(){return i}}),delete n.value}Object.defineProperty(e,t,n)},Cr.prototype.defineDescriptor=function(e,t){this.define(e,"$descriptor",{value:t})},Cr.prototype.defineModel=function(e,t){this.define(e,"$model",{value:t})},Cr.prototype.getProperty=function(e,t){var n=this.model,i=n.getPropertyDescriptor(e,t);if(i)return i;if(t.includes(":"))return null;const r=n.config.strict;if(typeof r<"u"){const o=new TypeError(`unknown property <${t}> on <${e.$type}>`);if(r)throw o;typeof console<"u"&&console.warn(o)}return null};function $0(e){return typeof e>"u"}function fd(e,t,n){Object.defineProperty(e,t.name,{enumerable:!t.isReference,writable:!0,value:n,configurable:!0})}function Bu(e){return e.replace(/^:/,"")}function $n(e,t={}){this.properties=new Cr(this),this.factory=new cd(this,this.properties),this.registry=new qi(e,this.properties),this.typeCache=Object.create(null),this.config=t}$n.prototype.create=function(e,t){var n=this.getType(e);if(!n)throw new Error("unknown type <"+e+">");return new n(t)},$n.prototype.getType=function(e){var t=this.typeCache,n=xn(e)?e:e.ns.name,i=t[n];return i||(e=this.registry.getEffectiveDescriptor(n),i=t[n]=this.factory.createType(e)),i},$n.prototype.createAny=function(e,t,n){var i=an(e),r={$type:e,$instanceOf:function(a){return a===this.$type},get:function(a){return this[a]},set:function(a,s){N0(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}),L(n,function(a,s){Vt(a)&&a.value!==void 0?r[a.name]=a.value:r[s]=a}),r},$n.prototype.getPackage=function(e){return this.registry.getPackage(e)},$n.prototype.getPackages=function(){return this.registry.getPackages()},$n.prototype.getElementDescriptor=function(e){return e.$descriptor},$n.prototype.hasType=function(e,t){t===void 0&&(t=e,e=this);var n=e.$model.getElementDescriptor(e);return t in n.allTypesByName},$n.prototype.getPropertyDescriptor=function(e,t){return this.getElementDescriptor(e).propertiesByName[t]},$n.prototype.getTypeDescriptor=function(e){return this.registry.typeMap[e]};var dd=String.fromCharCode,j0=Object.prototype.hasOwnProperty,F0=/&#(\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 H0(e,t,n,i){return i?j0.call(Wo,i)?Wo[i]:"&"+i+";":dd(t||parseInt(n,16))}function Pr(e){return e.length>3&&e.indexOf("&")!==-1?e.replace(F0,H0):e}var hd="non-whitespace outside of root node";function Yi(e){return new Error(e)}function z0(e){return"missing namespace for prefix <"+e+">"}function ns(e){return{get:e,enumerable:!0}}function G0(e){var t=Object.create(null),n;for(n in e)t[n]=e[n];return t}var md=Symbol("nameCache");function $u(e){return e+"$uri"}function V0(e){var t=Object.create(null),n,i;for(n in e)i=e[n],t[i]=i,t[$u(i)]=n;return t}function is(){return{line:0,column:0}}function W0(e){throw e}function gd(e){if(!this)return new gd(e);var t=e&&e.proxy,n,i,r,o,a=W0,s,c,u,l,p=is,f=!1,d=!1,g="",h=!1,m=!1,E=null,y=!1,x,S,P,C;function D(O){O instanceof Error||(O=Yi(O)),E=O,a(O,p)}function T(O){s&&(O instanceof Error||(O=Yi(O)),s(O,p))}this.on=function(O,F){if(typeof F!="function")throw Yi("required args <name, cb>");switch(O){case"openTag":i=F;break;case"text":n=F;break;case"closeTag":r=F;break;case"error":a=F;break;case"warn":s=F;break;case"cdata":o=F;break;case"attention":l=F;break;case"question":u=F;break;case"comment":c=F;break;default:throw Yi("unsupported event: "+O)}return this},this.ns=function(O){if(typeof O>"u"&&(O={}),typeof O!="object")throw Yi("required args <nsMap={}>");var F=Object.create(null),oe;for(oe in O)F[oe]=O[oe];return m=!0,C=F,this};function N(){x=m?[]:null,S=m?V0(C):null,P=[],p=is,y=!1,E=null,d=!1,g=""}this.parse=function(O){if(typeof O!="string")throw Yi("required args <xml=string>");if(f)throw Yi("parse during stream; call end() first");return N(),k(O),p=is,y=!1,E},this.write=function(O){if(typeof O!="string")throw Yi("required args <xml=string>");return f||(N(),f=!0),E||(g=k(g+O,!0)||""),this},this.end=function(){return f||N(),f=!1,E||k(g),g="",p=is,y=!1,E},this.stop=function(){y=!0};function k(O,F=!1){var oe=null,_e=null,We,Y=0,le=!1,ge=!1,ue=0,Re=0,re,q,U,Z,He,wt,M,w,b,j="",W=0,K;function ye(nt,Ht){var Xt=nt.indexOf(":");if(Xt===-1)return nt;var ln=S[nt.substring(0,Xt)];return ln?Ht===ln?nt.substr(Xt+1):ln+nt.substr(Xt):(T(z0(nt.substring(0,Xt))),null)}function Ie(){if(K!==null)return K;var nt,Ht,Xt=m&&S.xmlns,ln=m&&h?[]:null,et=W,zt=j,Zt=zt.length,Wi,vn,ti,Zn,It,qr={},Xa=new Set,bn,Ze,rt;e:for(;et<Zt;et++)if(bn=!1,Ze=zt.charCodeAt(et),!(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"),bn=!0),rt=et+1;rt<Zt;rt++)if(Ze=zt.charCodeAt(rt),!(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"),et=rt;continue e}if(Ze===61)break;T("illegal attribute name char"),bn=!0}if(It=zt.substring(et,rt),It==="xmlns:xmlns"&&(T("illegal declaration of xmlns"),bn=!0),Ze=zt.charCodeAt(rt+1),Ze===34)rt=zt.indexOf('"',et=rt+2),rt===-1&&(rt=zt.indexOf("'",et),rt!==-1&&(T("attribute value quote missmatch"),bn=!0));else if(Ze===39)rt=zt.indexOf("'",et=rt+2),rt===-1&&(rt=zt.indexOf('"',et),rt!==-1&&(T("attribute value quote missmatch"),bn=!0));else for(T("missing attribute value quotes"),bn=!0,rt=rt+1;rt<Zt&&(Ze=zt.charCodeAt(rt+1),!(Ze===32||Ze<14&&Ze>8));rt++);for(rt===-1&&(T("missing closing quotes"),rt=Zt,bn=!0),bn||(ti=zt.substring(et,rt)),et=rt;rt+1<Zt&&(Ze=zt.charCodeAt(rt+1),!(Ze===32||Ze<14&&Ze>8));rt++)et===rt&&(T("illegal character after attribute end"),bn=!0);if(et=rt+1,bn)continue e;if(Xa.has(It)){T("attribute <"+It+"> already defined");continue}if(Xa.add(It),!m){qr[It]=ti;continue}if(h){if(vn=It==="xmlns"?"xmlns":It.charCodeAt(0)===120&&It.substr(0,6)==="xmlns:"?It.substr(6):null,vn!==null){if(nt=Pr(ti),Ht=$u(vn),Zn=C[nt],!Zn){if(vn==="xmlns"||Ht in S&&S[Ht]!==nt)do Zn="ns"+Y++;while(typeof S[Zn]<"u");else Zn=vn;C[nt]=Zn}S[vn]!==Zn&&(Wi||(S=G0(S),Wi=!0),S[vn]=Zn,vn==="xmlns"&&(S[$u(Zn)]=nt,Xt=Zn),S[Ht]=nt),qr[It]=ti;continue}ln.push(It,ti);continue}It=ye(It,Xt),It!==null&&(qr[It]=ti)}if(h)for(et=0,Zt=ln.length;et<Zt;et++)It=ye(ln[et++],Xt),ti=ln[et],It!==null&&(qr[It]=ti);return K=qr}function Xe(){for(var nt=/(\r\n|\r|\n)/g,Ht=0,Xt=0,ln=0,et=Re,zt,Zt;ue>=ln&&(zt=nt.exec(O),!(!zt||(et=zt[0].length+zt.index,et>ue)));)Ht+=1,ln=et;return ue==-1?(Xt=et,Zt=O.substring(Re)):Re===0?Zt=O.substring(Re,ue):(Xt=ue-ln,Zt=Re==-1?O.substring(ue):O.substring(ue,Re+1)),{data:Zt,line:Ht,column:Xt}}for(p=Xe,t&&(b=Object.create({},{name:ns(function(){return M}),originalName:ns(function(){return w}),attrs:ns(Ie),ns:ns(function(){return S})}));Re!==-1;){if(O.charCodeAt(Re)===60?ue=Re:ue=O.indexOf("<",Re),ue===-1){if(F)return O.substring(Re);if(P.length)return D("unexpected end of file");if(!d)return D("missing start tag");Re<O.length&&O.substring(Re).trim()&&T(hd);return}if(d||(d=!0),Re!==ue){if(P.length){if(n&&(n(O.substring(Re,ue),Pr,p),y))return}else if(O.substring(Re,ue).trim()&&(T(hd),y))return}if(Z=O.charCodeAt(ue+1),Z===33){if(U=O.charCodeAt(ue+2),U===91&&O.substr(ue+3,6)==="CDATA["){if(Re=O.indexOf("]]>",ue),Re===-1)return F?O.substring(ue):D("unclosed cdata");if(o&&(o(O.substring(ue+9,Re),p),y))return;Re+=3;continue}if(U===45&&O.charCodeAt(ue+3)===45){if(Re=O.indexOf("-->",ue),Re===-1)return F?O.substring(ue):D("unclosed comment");if(c&&(c(O.substring(ue+4,Re),Pr,p),y))return;Re+=3;continue}}if(Z===63){if(Re=O.indexOf("?>",ue),Re===-1)return F?O.substring(ue):D("unclosed question");if(u&&(u(O.substring(ue,Re+2),p),y))return;Re+=2;continue}for(re=ue+1;;re++){if(He=O.charCodeAt(re),isNaN(He))return F?O.substring(ue):(Re=-1,D("unclosed tag"));if(He===34)U=O.indexOf('"',re+1),re=U!==-1?U:re;else if(He===39)U=O.indexOf("'",re+1),re=U!==-1?U:re;else if(He===62){Re=re;break}}if(Z===33){if(l&&(l(O.substring(ue,Re+1),Pr,p),y))return;Re+=1;continue}if(K={},Z===47){if(le=!1,ge=!0,!P.length)return D("missing open tag");if(re=M=P.pop(),U=ue+2+re.length,O.substring(ue+2,U)!==re)return D("closing tag mismatch");for(;U<Re;U++)if(Z=O.charCodeAt(U),!(Z===32||Z>8&&Z<14))return D("close tag")}else{if(O.charCodeAt(Re-1)===47?(re=M=O.substring(ue+1,Re-1),le=!0,ge=!0):(re=M=O.substring(ue+1,Re),le=!0,ge=!1),!(Z>96&&Z<123||Z>64&&Z<91||Z===95||Z===58))return D("illegal first char nodeName");for(U=1,q=re.length;U<q;U++)if(Z=re.charCodeAt(U),!(Z>96&&Z<123||Z>64&&Z<91||Z>47&&Z<59||Z===45||Z===95||Z==46)){if(Z===32||Z<14&&Z>8){M=re.substring(0,U),K=null;break}return D("invalid nodeName")}ge||P.push(M)}if(m){We=S,le&&(ge||x.push(We),K===null&&(h=re.indexOf("xmlns",U)!==-1)&&(W=U,j=re,Ie(),h=!1)),w=M,_e!==S&&(oe=S[md],oe===void 0&&(oe=S[md]=Object.create(null)),_e=S);var Et=oe[M];if(Et!==void 0)M=Et;else{if(Z=M.indexOf(":"),Z!==-1){if(wt=S[M.substring(0,Z)],!wt)return D("missing namespace on <"+w+">");M=M.substr(Z+1)}else wt=S.xmlns;wt&&(M=wt+":"+M),oe[w]=M}}if(le&&(W=U,j=re,i&&(t?i(b,Pr,ge,p):i(M,Ie,Pr,ge,p),y)))return;if(ge){if(r&&(r(t?b:M,Pr,le,p),y))return;m&&(le?S=We:S=x.pop())}Re+=1}}}function yd(e){return e.xml&&e.xml.tagAlias==="lowerCase"}var ju={xsi:"http://www.w3.org/2001/XMLSchema-instance",xml:"http://www.w3.org/XML/1998/namespace"},vd="property";function bd(e){return e.xml&&e.xml.serialize}function U0(e){const t=bd(e);return t!==vd&&(t||null)}function q0(e){return e.charAt(0).toUpperCase()+e.slice(1)}function _d(e,t){return yd(t)?e.prefix+":"+q0(e.localName):e.name}function Y0(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 K0(e,t,n){const i=an(e,t.xmlns),r=`${t[i.prefix]||i.prefix}:${i.localName}`,o=an(r);var a=n.getPackage(o.prefix);return Y0(o,a)}function Ki(e){return new Error(e)}function wi(e){return e.$descriptor}function X0(e){H(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=wi(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 Fu(){}Fu.prototype=Object.create(Uo.prototype),Fu.prototype.handleNode=function(){return this};function no(){}no.prototype=Object.create(Uo.prototype),no.prototype.handleText=function(e){this.body=(this.body||"")+e};function qo(e,t){this.property=e,this.context=t}qo.prototype=Object.create(no.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 Hu(e,t){this.element=t,this.propertyDesc=e}Hu.prototype=Object.create(no.prototype),Hu.prototype.handleEnd=function(){var e=this.body||"",t=this.element,n=this.propertyDesc;e=Iu(n.type,e),n.isMany?t.get(n.name).push(e):t.set(n.name,e)};function rs(){}rs.prototype=Object.create(no.prototype),rs.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 pn(e,t,n){this.model=e,this.type=e.getType(t),this.context=n}pn.prototype=Object.create(rs.prototype),pn.prototype.addReference=function(e){this.context.addReference(e)},pn.prototype.handleText=function(e){var t=this.element,n=wi(t),i=n.bodyProperty;if(!i)throw Ki("unexpected body text <"+e+">");no.prototype.handleText.call(this,e)},pn.prototype.handleEnd=function(){var e=this.body,t=this.element,n=wi(t),i=n.bodyProperty;i&&e!==void 0&&(e=Iu(i.type,e),t.set(i.name,e))},pn.prototype.createElement=function(e){var t=e.attributes,n=this.type,i=wi(n),r=this.context,o=new n({}),a=this.model,s;return L(t,function(c,u){var l=i.propertiesByName[u],p;l&&l.isReference?l.isMany?(p=c.split(" "),L(p,function(f){r.addReference({element:o,property:l.ns.name,id:f})})):r.addReference({element:o,property:l.ns.name,id:c}):(l?c=Iu(l.type,c):u==="xmlns"?u=":"+u:(s=an(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},pn.prototype.getPropertyForNode=function(e){var t=e.name,n=an(t),i=this.type,r=this.model,o=wi(i),a=n.name,s=o.propertiesByName[a];if(s&&!s.isAttr){const u=U0(s);if(u){const l=e.attributes[u];if(l){const p=K0(l,e.ns,r),f=r.getType(p);return H({},s,{effectiveType:wi(f).name})}}return s}var c=r.getPackage(n.prefix);if(c){const u=_d(n,c),l=r.getType(u);if(s=lt(o.properties,function(p){return!p.isVirtual&&!p.isReference&&!p.isAttribute&&l.hasType(p.type)}),s)return H({},s,{effectiveType:wi(l).name})}else if(s=lt(o.properties,function(u){return!u.isReference&&!u.isAttribute&&u.type==="Element"}),s)return s;throw Ki("unrecognized element <"+n.name+">")},pn.prototype.toString=function(){return"ElementDescriptor["+wi(this.type).name+"]"},pn.prototype.valueHandler=function(e,t){return new Hu(e,t)},pn.prototype.referenceHandler=function(e){return new qo(e,this.context)},pn.prototype.handler=function(e){return e==="Element"?new io(this.model,e,this.context):new pn(this.model,e,this.context)},pn.prototype.handleChild=function(e){var t,n,i,r;if(t=this.getPropertyForNode(e),i=this.element,n=t.effectiveType||t.type,ld(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?(H(o,{element:i}),this.context.addReference(o)):o.$parent=i),r};function zu(e,t,n){pn.call(this,e,t,n)}zu.prototype=Object.create(pn.prototype),zu.prototype.createElement=function(e){var t=e.name,n=an(t),i=this.model,r=this.type,o=i.getPackage(n.prefix),a=o&&_d(n,o)||t;if(!r.hasType(a))throw Ki("unexpected element <"+e.originalName+">");return pn.prototype.createElement.call(this,e)};function io(e,t,n){this.model=e,this.context=n}io.prototype=Object.create(rs.prototype),io.prototype.createElement=function(e){var t=e.name,n=an(t),i=n.prefix,r=e.ns[i+"$uri"],o=e.attributes;return this.model.createAny(t,r,o)},io.prototype.handleChild=function(e){var t=new io(this.model,"Element",this.context).handleNode(e),n=this.element,i=t.element,r;return i!==void 0&&(r=n.$children=n.$children||[],r.push(i),i.$parent=n),t},io.prototype.handleEnd=function(){this.body&&(this.element.$body=this.body)};function Gu(e){e instanceof $n&&(e={model:e}),H(this,{lax:!1},e)}Gu.prototype.fromXML=function(e,t,n){var i=t.rootHandler;t instanceof pn?(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 X0(H({},t,{rootHandler:i})),s=new gd({proxy:!0}),c=Z0();i.context=a,c.push(i);function u(P,C,D){var T=C(),N=T.line,k=T.column,O=T.data;O.charAt(0)==="<"&&O.indexOf(" ")!==-1&&(O=O.slice(0,O.indexOf(" "))+">");var F="unparsable content "+(O?O+" ":"")+`detected
2
+ line: `+N+`
3
3
  column: `+k+`
4
- nested error: `+P.message;if(D)return a.addWarning({message:$,error:P}),!0;throw Zi($)}function l(P,C){return u(P,C,!0)}function p(){var P=a.elementsById,C=a.references,D,A;for(D=0;A=C[D];D++){var I=A.element,k=P[A.id],O=Si(I).propertiesByName[A.property];if(k||a.addWarning({message:"unresolved reference <"+A.id+">",element:A.element,property:A.property,value:A.id}),O.isMany){var $=I.get(O.name),oe=$.indexOf(A);oe===-1&&(oe=$.length),k?$[oe]=k:$.splice(oe,1)}else I.set(O.name,k)}}function f(){c.pop().handleEnd()}var d=/^<\?xml /i,g=/ encoding="([^"]+)"/i,h=/^utf-8$/i;function m(P){if(d.test(P)){var C=g.exec(P),D=C&&C[1];!D||h.test(D)||a.addWarning({message:"unsupported document encoding <"+D+">, falling back to UTF-8"})}}function S(P,C){var D=c.peek();try{c.push(D.handleNode(P))}catch(A){u(A,C,o)&&c.push(new Fu)}}function y(P,C){try{c.peek().handleText(P)}catch(D){l(D,C)}}function x(P,C){P.trim()&&y(P,C)}var E=r.getPackages().reduce(function(P,C){return P[C.uri]=C.prefix,P},Object.entries(ju).reduce(function(P,[C,D]){return P[D]=C,P},r.config&&r.config.nsMap||{}));return s.ns(E).on("openTag",function(P,C,D,A){var I=P.attrs||{},k=Object.keys(I).reduce(function($,oe){var ve=C(I[oe]);return $[oe]=ve,$},{}),O={name:P.name,originalName:P.originalName,attributes:k,ns:P.ns};S(O,A)}).on("question",m).on("closeTag",f).on("cdata",y).on("text",function(P,C,D){x(C(P),D)}).on("error",u).on("warn",l),new Promise(function(P,C){var D;try{s.parse(e),p()}catch($){D=$}var A=i.element;!D&&!A&&(D=Zi("failed to parse document as <"+i.type.$descriptor.name+">"));var I=a.warnings,k=a.references,O=a.elementsById;return D?(D.warnings=I,C(D)):P({rootElement:A,elementsById:O,references:k,warnings:I})})},Gu.prototype.handler=function(e){return new zu(this.model,e)};function X0(){var e=[];return Object.defineProperty(e,"peek",{value:function(){return this[this.length-1]}}),e}var Z0=`<?xml version="1.0" encoding="UTF-8"?>
5
- `,Q0=/<|>|'|"|&|\n\r|\n/g,bd=/<|>|&/g;function si(e){this.prefixMap={},this.uriMap={},this.used={},this.wellknown=[],this.custom=[],this.parent=e,this.defaultPrefixMap=e&&e.defaultPrefixMap||{}}si.prototype.mapDefaultPrefixes=function(e){this.defaultPrefixMap=e},si.prototype.defaultUriByPrefix=function(e){return this.defaultPrefixMap[e]},si.prototype.byUri=function(e){return this.uriMap[e]||this.parent&&this.parent.byUri(e)},si.prototype.add=function(e,t){this.uriMap[e.uri]=e,t?this.wellknown.push(e):this.custom.push(e),this.mapPrefix(e.prefix,e.uri)},si.prototype.uriByPrefix=function(e){return this.prefixMap[e||"xmlns"]||this.parent&&this.parent.uriByPrefix(e)},si.prototype.mapPrefix=function(e,t){this.prefixMap[e||"xmlns"]=t},si.prototype.getNSKey=function(e){return e.prefix!==void 0?e.uri+"|"+e.prefix:e.uri},si.prototype.logUsed=function(e){var t=e.uri,n=this.getNSKey(e);this.used[n]=this.byUri(t),this.parent&&this.parent.logUsed(e)},si.prototype.getUsed=function(e){var t=[].concat(this.wellknown,this.custom);return t.filter(n=>{var i=this.getNSKey(n);return this.used[i]})};function J0(e){return e.charAt(0).toLowerCase()+e.slice(1)}function ew(e,t){return md(t)?J0(e):e}function _d(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})}function xd(e){return xn(e)?e:(e.prefix?e.prefix+":":"")+e.localName}function tw(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 nw(e,t){return t.isGeneric?j({localName:t.ns.localName},e):j({localName:ew(t.ns.localName,t.$pkg)},e)}function iw(e,t){return j({localName:t.ns.localName},e)}function rw(e){var t=e.$descriptor;return ze(t.properties,function(n){var i=n.name;if(n.isVirtual||!wn(e,i))return!1;var r=e[i];return r===n.default||r===null?!1:n.isMany?r.length:!0})}var ow={"\n":"#10","\n\r":"#10",'"':"#34","'":"#39","<":"#60",">":"#62","&":"#38"},aw={"<":"lt",">":"gt","&":"amp"};function wd(e,t,n){return e=xn(e)?e:""+e,e.replace(t,function(i){return"&"+n[i]+";"})}function sw(e){return wd(e,Q0,ow)}function cw(e){return wd(e,bd,aw)}function uw(e){return ze(e,function(t){return t.isAttr})}function lw(e){return ze(e,function(t){return!t.isAttr})}function Vu(e){this.tagName=e}Vu.prototype.build=function(e){return this.element=e,this},Vu.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?cw(this.value):this.value)},Mr.prototype.build=function(e,t){return this.value=t,e.type==="String"&&t.search(bd)!==-1&&(this.escape=!0),this};function Wu(e){this.tagName=e}_d(Wu,Mr),Wu.prototype.serializeTo=function(e){e.appendIndent().append("<"+this.tagName+">"),this.serializeValue(e),e.append("</"+this.tagName+">").appendNewLine()};function mt(e,t){this.body=[],this.attrs=[],this.parent=e,this.propertyDescriptor=t}mt.prototype.build=function(e){this.element=e;var t=e.$descriptor,n=this.propertyDescriptor,i,r,o=t.isGeneric;return o?i=this.parseGenericNsAttributes(e):i=this.parseNsAttributes(e),n?this.ns=this.nsPropertyTagName(n):this.ns=this.nsTagName(t),this.tagName=this.addTagName(this.ns),o?this.parseGenericContainments(e):(r=rw(e),this.parseAttributes(uw(r)),this.parseContainments(lw(r))),this.parseGenericAttributes(e,i),this},mt.prototype.nsTagName=function(e){var t=this.logNamespaceUsed(e.ns);return nw(t,e)},mt.prototype.nsPropertyTagName=function(e){var t=this.logNamespaceUsed(e.ns);return iw(t,e)},mt.prototype.isLocalNs=function(e){return e.uri===this.ns.uri},mt.prototype.nsAttributeName=function(e){var t;if(xn(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)},mt.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}))},mt.prototype.parseGenericContainments=function(e){var t=e.$body;t&&this.body.push(new Mr().build({type:"String"},t));var n=e.$children;n&&L(n,i=>{this.body.push(new mt(this).build(i))})},mt.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)}},mt.prototype.parseNsAttributes=function(e){var t=this,n=e.$attrs,i=[];return L(n,function(r,o){var a=t.parseNsAttribute(e,o,r);a&&i.push(a)}),i},mt.prototype.parseGenericAttributes=function(e,t){var n=this;L(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)}})},mt.prototype.parseContainments=function(e){var t=this,n=this.body,i=this.element;L(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(cd(r.type))L(o,function(u){n.push(new Wu(t.addTagName(t.nsPropertyTagName(r))).build(r,u))});else if(a)L(o,function(u){n.push(new Vu(t.addTagName(t.nsPropertyTagName(r))).build(u))});else{var c=yd(r);L(o,function(u){var l;c?c===gd?l=new mt(t,r):l=new rs(t,r,c):l=new mt(t),n.push(l.build(u))})}})},mt.prototype.getNamespaces=function(e){var t=this.namespaces,n=this.parent,i;return t||(i=n&&n.getNamespaces(),e||!i?this.namespaces=t=new si(i):t=i),t},mt.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},mt.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},mt.prototype.parseAttributes=function(e){var t=this,n=this.element;L(e,function(i){var r=n.get(i.name);if(i.isReference)if(!i.isMany)r=r.id;else{var o=[];L(r,function(a){o.push(a.id)}),r=o.join(" ")}t.addAttribute(t.nsAttributeName(i),r)})},mt.prototype.addTagName=function(e){var t=this.logNamespaceUsed(e);return this.getNamespaces().logUsed(t),xd(e)},mt.prototype.addAttribute=function(e,t){var n=this.attrs;xn(t)&&(t=sw(t));var i=rd(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)},mt.prototype.serializeAttributes=function(e){var t=this.attrs,n=this.namespaces;n&&(t=tw(n).concat(t)),L(t,function(i){e.append(" ").append(xd(i.name)).append('="').append(i.value).append('"')})},mt.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(),L(this.body,function(i){i.serializeTo(e)}),n&&e.unindent().appendIndent(),e.append("</"+this.tagName+">")),e.appendNewLine()};function rs(e,t,n){mt.call(this,e,t),this.serialization=n}_d(rs,mt),rs.prototype.parseNsAttributes=function(e){var t=mt.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 pw(){this.value="",this.write=function(e){this.value+=e}}function fw(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 dw(e){e=j({format:!1,preamble:!0},e||{});function t(n,i){var r=i||new pw,o=new fw(r,e.format);e.preamble&&o.append(Z0);var a=new mt,s=n.$model;if(a.getNamespaces().mapDefaultPrefixes(hw(s)),a.build(n).serializeTo(o),!i)return r.value}return{toXML:t}}function hw(e){const t=e.config&&e.config.nsMap||{},n={};for(const i in ju)n[i]=ju[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){$n.call(this,e,t)}os.prototype=Object.create($n.prototype),os.prototype.fromXML=function(e,t,n){xn(t)||(n=t,t="bpmn:Definitions");var i=new Gu(j({model:this,lax:!0},n)),r=i.handler(t);return i.fromXML(e,r)},os.prototype.toXML=function(e,t){var n=new dw(t);return new Promise(function(i,r){try{var o=n.toXML(e);return i({xml:o})}catch(a){return r(a)}})};var mw="BPMN20",gw="http://www.omg.org/spec/BPMN/20100524/MODEL",yw="bpmn",vw=[],bw=[{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"}]}],_w=[{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"}]}],xw={tagAlias:"lowerCase",typePrefix:"t"},ww={name:mw,uri:gw,prefix:yw,associations:vw,types:bw,enumerations:_w,xml:xw},Ew="BPMNDI",Sw="http://www.omg.org/spec/BPMN/20100524/DI",Rw="bpmndi",Cw=[{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"]}],Pw=[{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"}]}],Aw=[],Tw={name:Ew,uri:Sw,prefix:Rw,types:Cw,enumerations:Pw,associations:Aw},Mw="DC",kw="http://www.omg.org/spec/DD/20100524/DC",Ow="dc",Dw=[{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}]}],Lw=[],Iw={name:Mw,uri:kw,prefix:Ow,types:Dw,associations:Lw},Bw="DI",Nw="http://www.omg.org/spec/DD/20100524/DI",$w="di",jw=[{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"}]}],Fw=[],Hw={tagAlias:"lowerCase"},zw={name:Bw,uri:Nw,prefix:$w,types:jw,associations:Fw,xml:Hw},Gw="bpmn.io colors for BPMN",Vw="http://bpmn.io/schema/bpmn/biocolor/1.0",Ww="bioc",Uw=[{name:"ColoredShape",extends:["bpmndi:BPMNShape"],properties:[{name:"stroke",isAttr:!0,type:"String"},{name:"fill",isAttr:!0,type:"String"}]},{name:"ColoredEdge",extends:["bpmndi:BPMNEdge"],properties:[{name:"stroke",isAttr:!0,type:"String"},{name:"fill",isAttr:!0,type:"String"}]}],qw=[],Yw=[],Kw={name:Gw,uri:Vw,prefix:Ww,types:Uw,enumerations:qw,associations:Yw},Xw="BPMN in Color",Zw="http://www.omg.org/spec/BPMN/non-normative/color/1.0",Qw="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"}]}],eE=[],tE=[],nE={name:Xw,uri:Zw,prefix:Qw,types:Jw,enumerations:eE,associations:tE};const iE={bpmn:ww,bpmndi:Tw,dc:Iw,di:zw,bioc:Kw,color:nE};function Ed(e,t){const n=j({},iE,e);return new os(n,t)}const rE={name:"bpmn-i18n",uri:"http://www.omg.org/spec/BPMN/non-normative/extensions/i18n/1.0",prefix:"i18n",types:[{name:"Translation",superClass:["Element"],properties:[{name:"id",isAttr:!0,isId:!0,type:"String"},{name:"body",isBody:!0,type:"String"},{name:"target",isAttr:!0,type:"String",default:"@name"},{name:"textFormat",isAttr:"true",type:"String",default:"text/plain"}]}],enumerations:[],associations:[],xml:{tagAlias:"lowerCase",typePrefix:"t"}},oE="http://www.omg.org/spec/BPMN/non-normative/extensions/i18n/1.0",Sd="i18n",as={[Sd]:rE,[Au]:Jf};function Rd(){return Ed(as)}const Cd=Rd();async function Uu(e){const{rootElement:t,warnings:n}=await Cd.fromXML(e,"bpmn:Definitions");return{definitions:t,warnings:n}}async function aE(e){const{xml:t}=await Cd.toXML(e,{format:!0});return t}function qu(e){return e.map(t=>typeof t=="string"?t:t.message??String(t))}const ao={cjkEm:.865,upperEm:.68,lowerEm:.5,digitEm:.556,spaceEm:.278,otherEm:.35,ascentEm:.9,descentEm:.25},sE=/[ᄀ-ᇿ -〿぀-ヿ㐀-鿿가-힯＀-⦆]/;function cE(e){const t=ao;return sE.test(e)?t.cjkEm:e===" "?t.spaceEm:e>="0"&&e<="9"?t.digitEm:e>="A"&&e<="Z"?t.upperEm:e>="a"&&e<="z"?t.lowerEm:t.otherEm}function so(e,t){let n=0;for(const i of e)n+=t*cE(i);return n}function Pd(e=globalThis,{textMeasurement:t="approximate"}={}){if(!(e!=null&&e.SVGElement))throw new Error("installHeadlessBpmnDom: DOM 전역이 없다 — jsdom window 를 전역에 올린 뒤 호출할 것");t==="approximate"&&uE(e),lE(e),pE(e),fE(e)}function uE(e){var i;const t=(i=e.HTMLCanvasElement)==null?void 0:i.prototype;if(!t||t.__headlessTextMeasurement)return;t.__headlessTextMeasurement=!0;const n={font:"12px sans-serif",letterSpacing:"0px",measureText(r){var a;const o=Number.parseFloat(((a=String(n.font).match(/(\d+(?:\.\d+)?)px/))==null?void 0:a[1])??"12");return{width:so(r,o),fontBoundingBoxAscent:o*ao.ascentEm,fontBoundingBoxDescent:o*ao.descentEm,actualBoundingBoxAscent:o*ao.ascentEm,actualBoundingBoxDescent:o*ao.descentEm}}};t.getContext=()=>n}function lE(e){if(e.SVGMatrix)return;class t{constructor(){Jr(this,"a",1);Jr(this,"b",0);Jr(this,"c",0);Jr(this,"d",1);Jr(this,"e",0);Jr(this,"f",0)}static of(i,r,o,a,s,c){return Object.assign(new t,{a:i,b:r,c:o,d:a,e:s,f:c})}multiply(i){return t.of(this.a*i.a+this.c*i.b,this.b*i.a+this.d*i.b,this.a*i.c+this.c*i.d,this.b*i.c+this.d*i.d,this.a*i.e+this.c*i.f+this.e,this.b*i.e+this.d*i.f+this.f)}translate(i,r){return this.multiply(t.of(1,0,0,1,i,r))}scale(i,r=i){return this.multiply(t.of(i,0,0,r,0,0))}inverse(){const i=this.a*this.d-this.b*this.c;return t.of(this.d/i,-this.b/i,-this.c/i,this.a/i,(this.c*this.f-this.d*this.e)/i,(this.b*this.e-this.a*this.f)/i)}}e.SVGMatrix=t}function pE(e){var o;const t=()=>{const a=new e.SVGMatrix;return{type:0,matrix:a,setTranslate(s,c){a.e=s,a.f=c},setScale(s,c){a.a=s,a.d=c},setRotate(s,c=0,u=0){const l=s*Math.PI/180,p=Math.cos(l),f=Math.sin(l);a.a=p,a.b=f,a.c=-f,a.d=p,a.e=c-p*c+f*u,a.f=u-f*c-p*u},setMatrix(s){Object.assign(a,s)}}},n=a=>{const s=t();return Object.assign(s.matrix,a),s},i=(o=e.SVGSVGElement)==null?void 0:o.prototype;i&&!i.createSVGTransform&&(i.createSVGTransform=t,i.createSVGTransformFromMatrix=n,i.createSVGMatrix=()=>new e.SVGMatrix,i.createSVGPoint=()=>({x:0,y:0,matrixTransform:()=>({x:0,y:0})}));const r=e.SVGElement.prototype;Object.getOwnPropertyDescriptor(r,"transform")||Object.defineProperty(r,"transform",{configurable:!0,get(){if(!this.__headlessTransformList){const a=[];this.__headlessTransformList={baseVal:{get numberOfItems(){return a.length},clear:()=>{a.length=0},appendItem:s=>(a.push(s),s),getItem:s=>a[s],createSVGTransformFromMatrix:n,consolidate:()=>a[a.length-1]??null}}}return this.__headlessTransformList}})}function fE(e){const t=e.SVGElement.prototype;if(!t.getCTM){const n=()=>new e.SVGMatrix;t.getCTM=n,t.getScreenCTM=n}t.getBBox||(t.getBBox=function(){const n=String(this.textContent??"");return{x:0,y:0,width:so(n,12),height:14}})}const ss=new Set(["bpmn:Participant","bpmn:Lane","bpmn:Group","bpmn:SubProcess","bpmn:AdHocSubProcess","bpmn:Transaction"]),dE=1,Yu=new Set(["bpmn:TextAnnotation","bpmn:DataStoreReference","bpmn:DataObjectReference","bpmn:DataInput","bpmn:DataOutput"]),hE=2;function Ri(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]}${e.container?`|⊃${e.container}`:""}`;case"group-overlap-unreadable":return e.reason==="minority"?`gu*|${e.group}|${e.shapes.join(",")}`:e.reason==="throughpass"?`gu>|${e.group}|${e.shapes.join(",")}`:`gu|${e.groups[0]}|${e.groups[1]}|${e.shapes.join(",")}`;case"group-stack-unreadable":return`gs|${e.groups.join("|")}|${e.shapes.join(",")}`;case"group-on-container-boundary":return`gb|${e.group}|${e.container}|${e.side}`;case"group-on-group-boundary":return`gg|${e.groups[0]}|${e.groups[1]}|${e.axis}`;case"group-cuts-shape":return`gc|${e.group}|${e.shape}|${e.side}`;case"pool-name-over-label":return`pn|${e.pool}|${e.label}`}}const Ad=20,cs=5,Td=3,mE=8,Md=12,gE=Md*1.2;function Ku(e,t){const n=t.split(/\r?\n/),i=Math.max(...n.map(o=>so(o,Md))),r=n.length*gE;return{x:e.x+e.width/2-i/2,y:e.y+e.height/2-r/2,width:i,height:r}}const kd=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 us(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)>kd)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>=Ad&&(!n||s>n.length)&&(n={axis:r.axis,length:s,kind:a})}return n}function Od(e,t){const n=us(e,t);return n&&n.kind==="opposite"?{axis:n.axis,length:n.length}:null}function yE(e,t){let n=0;for(const i of t)i.id!==e.id&&Od(e,i)&&n++;return n}function Ci(e,t){let n=0;for(const i of t)i.id!==e.id&&us(e,i)&&n++;return n}const Dd=15,Ld=20;function vE(e,t){const n=t.axis==="v"?[e.x,e.x+e.width]:[e.y,e.y+e.height];if(t.at<n[0]-Ld||t.at>n[1]+Ld)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 Xu=20;function ls(e,t){const n=[];for(const i of t){if(i.axis!==e.axis||Math.abs(i.at-e.at)>kd)continue;const r=Math.max(e.lo,i.lo),o=Math.min(e.hi,i.hi);o-r<Ad||n.push([r-Xu,o+Xu])}return n}function ps(e,t){const n=e.label;if(!n)return null;let i=null;for(const r of hn(e)){const o=vE(n,r);if(o){for(const a of t)if(a.id!==e.id&&!(i&&a.id>=i.other)){for(const[s,c]of ls(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 bE=1,_E=(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 xE(e,t,n,i){const r=n.x+i,o=n.y+i,a=n.x+n.width-i,s=n.y+n.height-i;if(a<=r||s<=o)return!1;const c=t.x-e.x,u=t.y-e.y;let l=0,p=1;const f=(d,g)=>{if(g===0)return d<=0;const h=d/g;if(g>0){if(h>p)return!1;h>l&&(l=h)}else{if(h<l)return!1;h<p&&(p=h)}return!0};return f(r-e.x,c)&&f(e.x-a,-c)&&f(o-e.y,u)&&f(e.y-s,-u)&&p>l}function Zu(e,t,n){return e.x+n<t.x+t.width-n&&t.x+n<e.x+e.width-n&&e.y+n<t.y+t.height-n&&t.y+n<e.y+e.height-n}const wE=(e,t)=>e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height,co=1;function Pi(e,t){const n=e.x+co,i=e.x+e.width-co,r=e.y+co,o=e.y+e.height-co;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 Id(e,t){const n=e.label;if(!n)return null;if(hn(e).some(i=>Pi(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=>Pi(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=>Pi(n,r)))return i.id;return null}function jn(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(xE(e.waypoints[o],e.waypoints[o+1],r,hE)){i.push(r);break}}return i}function EE(e,t,n,i){const r=(u,l,p)=>(l.x-u.x)*(p.y-u.y)-(l.y-u.y)*(p.x-u.x),o=r(n,i,e),a=r(n,i,t),s=r(e,t,n),c=r(e,t,i);return o*a<0&&s*c<0}const Bd=(e,t)=>e.endpoints.some(n=>t.endpoints.includes(n));function fs(e,t){let n=0;for(const i of t){if(i.id===e.id||Bd(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++)EE(e.waypoints[o],e.waypoints[o+1],i.waypoints[a],i.waypoints[a+1])&&(r=!0);r&&n++}return n}function Ai(e,t){let n=0;for(const i of t)i.id===e.id||Bd(e,i)||fs(e,[i])>0&&(n+=i.type===e.type?2:1);return n}function Nd(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++)fs(n[i],[n[r]])>0&&(t+=n[i].type===n[r].type?2:1);return t}function Qu(e){const t=[],n=e.edges;for(let i=0;i<n.length;i++)for(let r=i+1;r<n.length;r++)if(fs(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 $d(e){const t=Qu(e),n=a=>a==="bpmn:MessageFlow"||a.endsWith("Association")?"dashed":"solid",i=new Map(e.edges.map(a=>[a.id,a]));let r=0,o=0;for(const[a,s]of t){const c=i.get(a),u=i.get(s);if(!c||!u)continue;const l=n(c.type),p=n(u.type);l==="solid"&&p==="solid"?r++:l==="dashed"&&p==="dashed"&&o++}return{pairs:t,solidPairs:r,dashedPairs:o,mixedPairs:t.length-r-o,crossPoolMessages:SE(e)}}function SE(e){const t=e.shapes.filter(r=>r.type==="bpmn:Participant");if(t.length<3)return 0;const n=r=>{const o=e.shapes.find(a=>a.id===r);if(o)return t.find(a=>o.x>=a.x&&o.y>=a.y&&o.x+o.width<=a.x+a.width&&o.y+o.height<=a.y+a.height)};let i=0;for(const r of e.edges){if(r.type!=="bpmn:MessageFlow"||r.endpoints.length<2)continue;const o=n(r.endpoints[0]),a=n(r.endpoints[1]);if(!o||!a||o.id===a.id)continue;const s=Math.min(o.y,a.y),c=Math.max(o.y+o.height,a.y+a.height);t.some(u=>u.id!==o.id&&u.id!==a.id&&u.y>s&&u.y+u.height<c)&&i++}return i}function jd(e,t,n){const i=new Set(t.flatMap(r=>[...r.members]));return e.shapes.filter(r=>!r.container&&!Yu.has(r.type)&&!i.has(r.id)&&r.x>=n.x&&r.y>=n.y&&r.x+r.width<=n.right&&r.y+r.height<=n.bottom).map(r=>r.id).sort()}function Fd(e){var n;const t=(n=ht(e==null?void 0:e.extensionElements))==null?void 0:n.values;if(Array.isArray(t))for(const i of t){const r=ht(i);if((r==null?void 0:r.$type)!=="bwl:Members"||typeof r.refs!="string")continue;const o=r.refs.split(/\s+/).filter(Boolean);return o.length?o:void 0}}const Hd=e=>e?{members:e}:{},ci=e=>e.shapes.filter(t=>!t.container);function RE(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 zd(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=>Pi(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=>Pi(n,r)))return i.id;return null}function uo(e){const t=[];for(const n of e.shapes)n.label&&t.push({owner:n.id,rect:n.label});for(const n of e.edges)n.label&&t.push({owner:n.id,rect:n.label});return t}function Ti(e){const t=[],n=e.shapes.filter(h=>!h.container);for(const h of e.edges)for(const m of jn(h,n))t.push({kind:"edge-crosses-shape",edge:h.id,shape:m.id});const i=n.filter(h=>!h.attached);for(let h=0;h<i.length;h++)for(let m=h+1;m<i.length;m++){const S=i[h],y=i[m];if(!Zu(S,y,dE))continue;const x=S.id<y.id?[S.id,y.id]:[y.id,S.id];t.push({kind:"shape-overlap",shapes:x,identical:wE(S,y)})}const r=e.shapes.filter(h=>h.type==="bpmn:Group"&&Array.isArray(h.members)&&h.members.length>0);for(let h=0;h<r.length;h++)for(let m=h+1;m<r.length;m++){const S=r[h],y=r[m],x=Math.min(S.x+S.width,y.x+y.width)-Math.max(S.x,y.x),E=Math.min(S.y+S.height,y.y+y.height)-Math.max(S.y,y.y);if(x<=cs||E<=cs)continue;const P=S.id<y.id?[S.id,y.id]:[y.id,S.id],C=new Set(y.members);if(S.members.some(A=>C.has(A))){const A=jd(e,r,{x:Math.max(S.x,y.x),y:Math.max(S.y,y.y),right:Math.min(S.x+S.width,y.x+y.width),bottom:Math.min(S.y+S.height,y.y+y.height)});A.length&&t.push({kind:"group-overlap-unreadable",reason:"orphan",groups:P,shapes:A});continue}const D=S.x<=y.x&&S.y<=y.y&&S.x+S.width>=y.x+y.width&&S.y+S.height>=y.y+y.height?S.id:y.x<=S.x&&y.y<=S.y&&y.x+y.width>=S.x+S.width&&y.y+y.height>=S.y+S.height?y.id:void 0;t.push({kind:"group-overlap-unintended",groups:P,...D?{container:D}:{}})}const o=new Set(r.flatMap(h=>[...h.members])),a=h=>e.shapes.filter(m=>!m.container&&!Yu.has(m.type)&&m.x>=h.x&&m.y>=h.y&&m.x+m.width<=h.x+h.width&&m.y+m.height<=h.y+h.height);for(const h of r){const m=a(h);if(!m.length)continue;const S=new Set(h.members),y=m.filter(x=>!S.has(x.id));y.some(x=>o.has(x.id))&&(y.length*2<m.length||t.push({kind:"group-overlap-unreadable",reason:"minority",group:h.id,shapes:y.map(x=>x.id).sort()}))}for(const h of r){const m=new Set(a(h).map(C=>C.id)),S=new Set(h.members),y=new Set([...m].filter(C=>!S.has(C)&&o.has(C)));if(!y.size)continue;let x=!1,E=!1,P=!1;for(const C of e.edges){if(C.type!=="bpmn:SequenceFlow"||!C.source||!C.target)continue;const D=y.has(C.source),A=y.has(C.target);!D&&A&&!m.has(C.source)?x=!0:D&&!A&&!m.has(C.target)?E=!0:D&&A&&(P=!0)}x&&E&&P&&t.push({kind:"group-overlap-unreadable",reason:"throughpass",group:h.id,shapes:[...y].sort()})}const s=e.shapes.filter(h=>h.type==="bpmn:Group");for(let h=0;h<s.length;h++)for(let m=h+1;m<s.length;m++)for(let S=m+1;S<s.length;S++){const y=[s[h],s[m],s[S]],x={x:Math.max(...y.map(C=>C.x)),y:Math.max(...y.map(C=>C.y)),right:Math.min(...y.map(C=>C.x+C.width)),bottom:Math.min(...y.map(C=>C.y+C.height))};if(x.right-x.x<=cs||x.bottom-x.y<=cs)continue;const E=jd(e,[],x);if(!E.length)continue;const P=y.map(C=>C.id).sort();t.push({kind:"group-stack-unreadable",groups:P,shapes:E})}for(const h of e.shapes.filter(m=>m.type==="bpmn:Group"))for(const m of e.shapes){if(m.container||m.attached||Yu.has(m.type)||m.width<=0||m.height<=0)continue;const S=[["top",h.y,"h",h.x,h.x+h.width],["bottom",h.y+h.height,"h",h.x,h.x+h.width],["left",h.x,"v",h.y,h.y+h.height],["right",h.x+h.width,"v",h.y,h.y+h.height]];for(const[y,x,E,P,C]of S){const D=E==="h"?m.x:m.y,A=E==="h"?m.x+m.width:m.y+m.height;if(!(D<C&&P<A))continue;const I=E==="h"?m.y:m.x,k=E==="h"?m.y+m.height:m.x+m.width;if(!(I<x&&x<k))continue;const O=Math.min(x-I,k-x);O<mE||t.push({kind:"group-cuts-shape",group:h.id,shape:m.id,side:y,depth:O})}}const c=e.shapes.filter(h=>h.container&&h.type!=="bpmn:Group"&&h.type!=="bpmn:Lane");for(const h of e.shapes.filter(m=>m.type==="bpmn:Group"))for(const m of c){const S=h.x<m.x+m.width&&m.x<h.x+h.width,y=h.y<m.y+m.height&&m.y<h.y+h.height,x=[["top",h.y,m.y,S],["bottom",h.y+h.height,m.y+m.height,S],["left",h.x,m.x,y],["right",h.x+h.width,m.x+m.width,y]];for(const[E,P,C,D]of x)D&&Math.abs(P-C)<=Td&&t.push({kind:"group-on-container-boundary",group:h.id,container:m.id,side:E})}const u=e.shapes.filter(h=>h.type==="bpmn:Group");for(let h=0;h<u.length;h++)for(let m=h+1;m<u.length;m++){const S=u[h],y=u[m],x=S.x<y.x+y.width&&y.x<S.x+S.width,E=S.y<y.y+y.height&&y.y<S.y+S.height,P=[["x",S.x+S.width,y.x,E],["x",y.x+y.width,S.x,E],["y",S.y+S.height,y.y,x],["y",y.y+y.height,S.y,x]];for(const[C,D,A,I]of P)if(I&&Math.abs(D-A)<=Td){t.push({kind:"group-on-group-boundary",groups:S.id<y.id?[S.id,y.id]:[y.id,S.id],axis:C});break}}for(let h=0;h<e.edges.length;h++)for(let m=h+1;m<e.edges.length;m++){const S=e.edges[h],y=e.edges[m],x=us(S,y);if(!x)continue;const E=S.id<y.id?[S.id,y.id]:[y.id,S.id];t.push({kind:x.kind==="opposite"?"edge-overlap-opposite":"edge-overlap-mixed",edges:E,axis:x.axis,length:Math.round(x.length)})}for(const h of e.edges){if(!h.label)continue;const m=ps(h,e.edges);m&&t.push({kind:"label-on-shared-segment",edge:h.id,other:m.other,axis:m.axis})}for(const h of e.edges){if(!h.label)continue;const m=Id(h,e);m&&t.push({kind:"label-over-line",edge:h.id,line:m})}const l=new Set(n.map(h=>h.id)),p=e.shapes.filter(h=>h.type==="bpmn:Participant"&&h.label);for(const h of[...n,...p.filter(m=>!l.has(m.id))]){if(!h.label)continue;const m=zd(h,e);m&&t.push({kind:"label-over-line",edge:h.id,line:m})}const f=new Set(e.shapes.filter(h=>h.type==="bpmn:TextAnnotation").map(h=>h.id));for(const h of p)for(const{owner:m,rect:S}of uo(e))m===h.id||f.has(m)||Zu(h.label,S,co)&&t.push({kind:"pool-name-over-label",pool:h.id,label:m});const d=uo(e);for(const h of n)if(h.type==="bpmn:TextAnnotation")for(const{owner:m,rect:S}of d)m!==h.id&&Zu(h,S,co)&&t.push({kind:"annotation-over-label",annotation:h.id,label:m});const g=new Map(e.shapes.map(h=>[h.id,h]));for(const h of n){const m=h.parent??RE(h,e,g);if(!m)continue;const S=g.get(m);!S||!S.container||_E(S,h,bE)||t.push({kind:"shape-outside-container",shape:h.id,container:S.id})}return t.sort((h,m)=>Ri(h).localeCompare(Ri(m)))}const ht=e=>typeof e=="object"&&e!==null?e:void 0,Et=e=>typeof e=="number"?e:0,Mi=e=>{const t=ht(e);return typeof(t==null?void 0:t.id)=="string"?t.id:void 0};function CE(e){const t=ht(e);if(!t)return[];const n=[];for(const i of["sourceRef","targetRef"]){const r=t[i];for(const o of Array.isArray(r)?r:[r]){const a=Mi(o);a&&n.push(a)}}return n}function PE(e){const t=ht(e);if(!t)return{};const n=Array.isArray(t.sourceRef)?void 0:Mi(t.sourceRef),i=Array.isArray(t.targetRef)?void 0:Mi(t.targetRef);return n&&i?{source:n,target:i}:{}}function AE(e,t){const n=ht(e.$parent);if(!n)return;const i=typeof n.$type=="string"?n.$type:"";if(i==="bpmn:Process"){const r=Mi(n);return r?t.get(r):void 0}if(ss.has(i)&&i!=="bpmn:Lane"&&i!=="bpmn:Group")return Mi(n)}function Gd(e){var a,s,c,u,l;const t=[],n=[],i=((a=ht(e))==null?void 0:a.diagrams)??[],r=new Map,o=new Set;for(const p of((s=ht(e))==null?void 0:s.rootElements)??[]){const f=ht(p);if((f==null?void 0:f.$type)==="bpmn:Collaboration")for(const d of f.participants??[]){const g=ht(d),h=Mi(g),m=Mi(g==null?void 0:g.processRef);h&&m?r.set(m,h):h&&o.add(h)}}for(const p of i){const f=ht((c=ht(p))==null?void 0:c.plane),d=(f==null?void 0:f.planeElement)??[];for(const g of d){const h=ht(g);if(!h)continue;const m=ht(h.bpmnElement),S=typeof(m==null?void 0:m.id)=="string"?m.id:void 0;if(!S)continue;const y=typeof(m==null?void 0:m.$type)=="string"?m.$type:"",x=ht(h.bounds);if(x){const P=h.isExpanded===!1&&y!=="bpmn:Participant",C=ht((u=ht(h.label))==null?void 0:u.bounds),D={id:S,type:y,x:Et(x.x),y:Et(x.y),width:Et(x.width),height:Et(x.height),container:ss.has(y)&&!P,attached:(m==null?void 0:m.attachedToRef)!==void 0,...m?{parent:AE(m,r)}:{},...C?{label:{x:Et(C.x),y:Et(C.y),width:Et(C.width),height:Et(C.height)}}:{},...y==="bpmn:Group"?Hd(Fd(m)):{}},A=h.isHorizontal!==!1,I=typeof(m==null?void 0:m.name)=="string"?m.name:"";o.has(S)&&A&&I&&(D.label=Ku(D,I)),t.push(D);continue}const E=h.waypoint;if(Array.isArray(E)){const P=ht((l=ht(h.label))==null?void 0:l.bounds);n.push({id:S,type:y,waypoints:E.map(C=>{var D,A;return{x:Et((D=ht(C))==null?void 0:D.x),y:Et((A=ht(C))==null?void 0:A.y)}}),endpoints:CE(m),...PE(m),...P?{label:{x:Et(P.x),y:Et(P.y),width:Et(P.width),height:Et(P.height)}}:{}})}}}return{shapes:t,edges:n}}function Vd(e){return Ti(Gd(e))}async function TE(e){const{definitions:t,warnings:n}=await Uu(e);return{findings:Vd(t),warnings:n}}function yt(e){var i;const t=[],n=[];for(const r of e.getAll()){const o=r;if(o.type==="label"||o.labelTarget)continue;const a=typeof o.type=="string"?o.type:"";if(a==="bpmn:Definitions"||a.startsWith("bpmndi:"))continue;const s=o.waypoints;if(s){const h=ht(o.label),m=Mi(o.source),S=Mi(o.target);n.push({id:o.id,type:a,waypoints:s.map(y=>({x:Et(y.x),y:Et(y.y)})),endpoints:[m,S].filter(y=>!!y),...m&&S?{source:m,target:S}:{},...h&&typeof h.x=="number"?{label:{x:h.x,y:Et(h.y),width:Et(h.width),height:Et(h.height)}}:{}});continue}if(typeof o.x!="number"||typeof o.y!="number")continue;const c=ht(o.businessObject),u=ht(o.label);let l=ht(o.parent);for(;l&&l.type==="bpmn:Lane";)l=ht(l.parent);const p=typeof(l==null?void 0:l.type)=="string"?l.type:"",f=l&&ss.has(p)&&p!=="bpmn:Group"&&typeof l.id=="string"?l.id:void 0,d={id:o.id,type:a,x:o.x,y:o.y,width:Et(o.width),height:Et(o.height),container:ss.has(a)&&(a==="bpmn:Participant"||o.collapsed!==!0),attached:(c==null?void 0:c.attachedToRef)!==void 0,...f!==void 0?{parent:f}:{},...u&&typeof u.x=="number"?{label:{x:u.x,y:Et(u.y),width:Et(u.width),height:Et(u.height)}}:{},...a==="bpmn:Group"?Hd(Fd(c)):{}},g=typeof(c==null?void 0:c.name)=="string"?c.name:"";a==="bpmn:Participant"&&!(c!=null&&c.processRef)&&g&&((i=ht(o.di))==null?void 0:i.isHorizontal)!==!1&&(d.label=Ku(d,g)),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 kE(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 Wd(e){let t=e.parent;for(;t;){if(t.type==="bpmn:Participant")return t.id;t=t.parent}}function Ud(e){const t=()=>e.getAll().filter(n=>n.type!=="label"&&!("labelTarget"in n&&n.labelTarget));return{isCollaboration:()=>t().some(n=>n.type==="bpmn:Participant"),categoryOf:n=>{const i=e.get(n);if(!(!i||i.type==="label"))return kE(i.type,i)},lanesOf:n=>t().filter(i=>i.type==="bpmn:Lane"&&Wd(i)===n).sort((i,r)=>i.y-r.y).map(i=>i.id),participantOf:n=>{const i=e.get(n);return i?Wd(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 qd=20,OE=4,kt=(e,t)=>Math.abs(e-t)<.5;function Yd(e,t,n,i=qd){if(kt(e.y,t.y)&&!kt(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(kt(e.x,t.x)&&!kt(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 Kd(e,t,n=qd){if(e.length!==4)return null;const[i,r,o,a]=e;if(kt(i.y,r.y)&&kt(r.x,o.x)&&kt(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(kt(i.x,r.x)&&kt(r.y,o.y)&&kt(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 Ju(e,t){if(e.endpoints.length!==2)return[];const n=t.find(p=>p.id===e.endpoints[0]),i=t.find(p=>p.id===e.endpoints[1]);if(!n||!i)return[];if(i.x<=n.x+n.width)return[];const r=n.y+n.height/2,o=i.y+i.height/2;if(r>=i.y&&r<=i.y+i.height)return[];const a=i.x+i.width/2,s=n.x+n.width/2,c=r>o,u=[{x:n.x+n.width,y:r},{x:a,y:r},{x:a,y:c?i.y+i.height:i.y}],l=[{x:s,y:c?n.y:n.y+n.height},{x:s,y:o},{x:i.x,y:o}];return[u,l]}const Xd=30,DE=[0,-25,25,-40,40];function LE(e,t){if(e.type!=="bpmn:MessageFlow"||e.endpoints.length!==2)return[];const n=t.find(f=>f.id===e.endpoints[0]),i=t.find(f=>f.id===e.endpoints[1]);if(!n||!i)return[];const r=n.y+n.height/2,o=i.y+i.height/2;if(i.y<n.y+n.height&&i.y+i.height>n.y)return[];const a=o<r,s=a?n.y+n.height:n.y,c=a?s+Xd:s-Xd,u=a?i.y+i.height:i.y,l=n.x+n.width/2,p=i.x+i.width/2;return DE.map(f=>[{x:l,y:s},{x:l,y:c},{x:p+f,y:c},{x:p+f,y:u}])}const IE=(e,t,n)=>[...e.slice(0,t+1),...n,...e.slice(t+1)],ds=(e,t,n)=>jn({...e,waypoints:t},n).length;function Zd(e,t,n,i){let r=[...e.waypoints],o=ds(e,r,t);if(o===0)return null;let a=!1;for(const p of Ju(e,t))if(ds(e,p,t)===0)return p;const s=(i??[]).filter(p=>p.id!==e.id).flatMap(hn),c=p=>hn({...e,waypoints:p}).some(f=>ls(f,s).length>0),u=LE(e,t).filter(p=>ds(e,p,t)===0);if(u.length)return u.find(p=>!c(p))??u[0];const l=p=>!n||p.every(f=>f.x>=n.x&&f.x<=n.x+n.width&&f.y>=n.y&&f.y<=n.y+n.height);for(let p=0;p<OE&&o>0;p++){let f=!1;for(let d=0;d+1<r.length&&!f;d++){const g=r[d],h=r[d+1];for(const m of t){if(e.endpoints.includes(m.id)||jn({...e,waypoints:[g,h]},[m]).length===0)continue;const S=Yd(g,h,m),y=S?S.map(E=>IE(r,d,E)):Kd(r,m)??[];if(!y.length)continue;const x=[...y].sort((E,P)=>Number(l(P))-Number(l(E)));for(const E of x){const P=ds(e,E,t);if(P<o){r=E,o=P,f=!0,a=!0;break}}if(f)break}}if(!f)break}return a&&o===0?r:null}function Qd(e,t){const{elementRegistry:n}=e,i=e.modeling,r=yt(n),o=ci(r),a=Ti(r).filter(c=>c.kind==="edge-crosses-shape"&&!t.has(Ri(c)));if(!a.length)return;const s=new Map;for(const c of a){if(c.kind!=="edge-crosses-shape"||s.has(c.edge))continue;const u=r.edges.find(l=>l.id===c.edge);u&&s.set(c.edge,u)}for(const[c,u]of s){const l=n.get(c);if(!l)continue;const p=l.parent,f=p&&typeof p.x=="number"&&typeof p.width=="number"?{x:p.x,y:p.y,width:p.width,height:p.height}:void 0,d=Zd(u,o,f,r.edges);if(!d)continue;const g=r.edges.filter(S=>S.id!==c),h=Ci(u,g);Ci({...u,waypoints:d},g)>h||i.updateWaypoints(l,d)}}const BE=10;function Jd(e,t){if(e.parent){const r=t.find(o=>o.id===e.parent);if(r)return r}const n=e.x+e.width/2,i=e.y+e.height/2;return t.find(r=>n>=r.x&&n<=r.x+r.width&&i>=r.y&&i<=r.y+r.height)}function eh(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=Jd(i,n),a=Jd(r,n);if(!o||!a||o.id===a.id)return null;const s=a.y>o.y,c=s?o:a,u=s?a:o,l=n.filter($=>$.id!==o.id&&$.id!==a.id&&$.y>=c.y+c.height&&$.y+$.height<=u.y).sort(($,oe)=>$.y-oe.y);if(!l.length)return null;const p=l[0],f=l[l.length-1],d=(c.y+c.height+p.y)/2,g=(f.y+f.height+u.y)/2,h=s?d:g,m=s?g:d,S=e.waypoints[0],y=e.waypoints[e.waypoints.length-1],x=ci(t),E=t.edges.filter($=>$.id!==e.id),P=Ai(e,E),C=jn(e,x).length;if(P===0&&C===0||C===0&&e.waypoints.length===2)return null;const D=Math.min(...l.map($=>$.x)),A=Math.max(...l.map($=>$.x+$.width)),I=(S.x+y.x)/2,k=$=>$.filter((oe,ve)=>ve===0||!(kt(oe.x,$[ve-1].x)&&kt(oe.y,$[ve-1].y)));let O;for(let $=D;$<=A;$+=BE){const oe=k([S,{x:S.x,y:h},{x:$,y:h},{x:$,y:m},{x:y.x,y:m},y]),ve={...e,waypoints:oe};if(jn(ve,x).length>0)continue;const Ue=Ai(ve,E),Y=Math.abs($-I);(!O||Ue<O.cross||Ue===O.cross&&Y<O.detour)&&(O={pts:oe,cross:Ue,detour:Y})}return O&&(C>0?O.cross<=P:O.cross<P)?O.pts:null}function th(e,t){const{elementRegistry:n}=e,i=e.modeling,r=yt(n);for(const o of r.edges){if(o.type!=="bpmn:MessageFlow"||t.has(o.id))continue;const a=yt(n),s=a.edges.find(l=>l.id===o.id);if(!s)continue;const c=eh(s,a);if(!c)continue;const u=n.get(o.id);u&&i.updateWaypoints(u,c)}}const kr=[25,-25,40,-40],hs=35;function nh(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-hs:n.y+n.height+hs,p=[];for(const y of[0,...kr]){if(Math.abs(y)>=i.width/2-5)continue;const x=o+y;p.push({pts:[{x:n.x,y:r},{x,y:r},{x,y:c}],cost:Math.abs(y)});for(const E of[0,...kr]){if(Math.abs(E)>=n.width/2-5)continue;const P=a+E;p.push({pts:[{x:P,y:u},{x:P,y:l},{x,y:l},{x,y:c}],cost:Math.abs(y)+Math.abs(E)})}}const f=50,d=i.y+i.height/2,g=s?n.y+n.height:n.y;for(const y of[0,...kr]){if(Math.abs(y)>=n.width/2-5)continue;const x=a+y;p.push({pts:[{x,y:g},{x,y:d},{x:i.x+i.width,y:d}],cost:f+Math.abs(y)})}const h=60,m=s?i.y+i.height:i.y,S=s?i.y+i.height+hs:i.y-hs;for(const y of[0,...kr]){if(Math.abs(y)>=i.width/2-5)continue;const x=o+y;for(const E of[0,...kr]){if(Math.abs(E)>=n.width/2-5)continue;const P=a+E;p.push({pts:[{x:P,y:g},{x:P,y:S},{x,y:S},{x,y:m}],cost:h+Math.abs(y)+Math.abs(E)})}}return p}const ms=30;function ih(e,t){for(let n=1;n<e.length-2;n++){const i=e[n],r=e[n+1],o=kt(i.y,r.y)&&!kt(i.x,r.x),a=kt(i.x,r.x)&&!kt(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)<ms||Math.abs(i.y-(s.y+s.height))<ms)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)<ms||Math.abs(i.x-(s.x+s.width))<ms)return!0}}return!1}const gs=40;function NE(e,t,n){let i=0;for(const r of t){if(r.container||n.includes(r.id))continue;const o=r.x-gs,a=r.x+r.width+gs,s=r.y-gs,c=r.y+r.height+gs;for(let u=1;u<e.length-2;u++){const l=e[u],p=e[u+1],f={x:Math.min(l.x,p.x),y:Math.min(l.y,p.y)},d={x:Math.max(l.x,p.x),y:Math.max(l.y,p.y)};if(f.x<a&&d.x>o&&f.y<c&&d.y>s){i++;break}}}return i}function rh(e,t){if(e.type!=="bpmn:SequenceFlow")return null;const n=t.shapes.filter(C=>C.container),i=new Map(t.shapes.map(C=>[C.id,C])),r=ci(t),o=t.edges.filter(C=>C.id!==e.id),a=Ci(e,o),s=Ai(e,o),c=C=>NE(C,t.shapes,e.endpoints)+(ih(C,n)?1:0),u=c(e.waypoints),l=C=>{if(!C)return;const D=C.x+C.width/2,A=C.y+C.height/2;return n.find(I=>I.type==="bpmn:Lane"&&D>=I.x&&D<=I.x+I.width&&A>=I.y&&A<=I.y+I.height)},p=l(i.get(e.endpoints[0]??"")),f=l(i.get(e.endpoints[1]??"")),d=!!p&&!!f&&p.id!==f.id,g=C=>{if(!d||!f)return!1;for(let D=1;D<C.length-2;D++){const A=C[D],I=C[D+1];if(kt(A.y,I.y)&&!kt(A.x,I.x)&&A.y>f.y&&A.y<f.y+f.height)return!0}return!1},h=g(e.waypoints),S=(C=>{if(!C)return;const D=C.x+C.width/2,A=C.y+C.height/2;return n.filter(I=>I.type==="bpmn:Participant"&&D>=I.x&&D<=I.x+I.width&&A>=I.y&&A<=I.y+I.height).sort((I,k)=>I.width*I.height-k.width*k.height)[0]})(i.get(e.endpoints[0]??"")),y=C=>{if(!S)return 0;let D=0;for(let A=1;A<C.length-1;A++){const I=C[A];(I.x<S.x||I.x>S.x+S.width||I.y<S.y||I.y>S.y+S.height)&&D++}return D},x=y(e.waypoints);if(!ih(e.waypoints,n)&&!(d&&!h)&&x===0)return null;const E=C=>C.reduce((D,A,I)=>I?D+Math.abs(A.x-C[I-1].x)+Math.abs(A.y-C[I-1].y):0,0);let P;for(const{pts:C,cost:D}of nh(e,i)){const A={...e,waypoints:C};if(jn(A,r).length>0)continue;const I=Ci(A,o);if(I>a)continue;const k=y(C);if(k>x)continue;const O=k<x&&I===0;if(!O&&Ai(A,o)>s)continue;const $=c(C),oe=g(C);if(!O&&!(oe&&!h)&&$>=u)continue;const Ue=oe?0:1,Y=E(C);(!P||k<P.out||k===P.out&&(Ue<P.lane||Ue===P.lane&&(I<P.opp||I===P.opp&&($<P.sc||$===P.sc&&(D<P.cost||D===P.cost&&Y<P.len)))))&&(P={pts:C,out:k,sc:$,lane:Ue,opp:I,cost:D,len:Y})}return(P==null?void 0:P.pts)??null}function $E(e,t){const{elementRegistry:n}=e,i=e.modeling,r=yt(n).edges.filter(o=>!t.has(o.id)&&o.waypoints.length>=4).map(o=>o.id).sort();for(const o of r){const a=yt(n),s=a.edges.find(d=>d.id===o);if(!s||s.waypoints.length<4)continue;const c=ci(a),u=a.edges.filter(d=>d.id!==o),l=jn(s,c).length,p=Ci(s,u),f=Ai(s,u);for(const d of Ju(s,a.shapes)){if(d.length>=s.waypoints.length)continue;const g={...s,waypoints:d};if(jn(g,c).length>l||Ci(g,u)>p||Ai(g,u)>f)continue;const h=n.get(o);h&&i.updateWaypoints(h,d);break}}}function oh(e,t){const{elementRegistry:n}=e,i=e.modeling,r=yt(n).edges.filter(o=>o.type==="bpmn:SequenceFlow"&&!t.has(o.id)).map(o=>o.id).sort();for(const o of r){const a=yt(n),s=a.edges.find(l=>l.id===o);if(!s)continue;const c=rh(s,a);if(!c)continue;const u=n.get(o);u&&i.updateWaypoints(u,c)}}function jE(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=kt(n[0].x,n[1].x)&&!kt(n[0].y,n[1].y),s=kt(n[n.length-1].x,n[n.length-2].x)&&!kt(n[n.length-1].y,n[n.length-2].y);for(const c of kr){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 FE(e,t){if(e.type!=="bpmn:SequenceFlow")return[];const n=t.get(e.endpoints[0]??""),i=t.get(e.endpoints[1]??"");if(!n||!i)return[];const r=Math.max(n.x,i.x),o=Math.min(n.x+n.width,i.x+i.width);if(o-r<1)return[];const a=i.y+i.height<=n.y,s=n.y+n.height<=i.y;if(!a&&!s)return[];const c=a?n.y:n.y+n.height,u=a?i.y+i.height:i.y,l=(r+o)/2,p=[];for(const f of[0,...kr]){const d=l+f;d<=r||d>=o||p.push({pts:[{x:d,y:c},{x:d,y:u}],cost:Math.abs(f)})}return p}function ah(e,t){const n=new Map(t.shapes.map(d=>[d.id,d])),i=ci(t),r=t.edges.filter(d=>d.id!==e.id),o=Ci(e,r);if(o===0)return null;const a=Ai(e,r);let s;const c=d=>d.reduce((g,h,m)=>m?g+Math.abs(h.x-d[m-1].x)+Math.abs(h.y-d[m-1].y):0,0),u=3,l=d=>{const g=d[0],h=d[d.length-1],m=Math.hypot(h.x-g.x,h.y-g.y);return m>=1&&c(d)/m>=u?1:0},p=l(e.waypoints),f=[...nh(e,n),...FE(e,n),...jE(e,n)];for(const{pts:d,cost:g}of f){const h={...e,waypoints:d};if(jn(h,i).length>0)continue;const m=Ci(h,r),S=Ai(h,r),y=o-m+(p-l(d));if(m>=o||S-a>y)continue;const x=c(d);(!s||m<s.opposite||m===s.opposite&&(S<s.cross||S===s.cross&&(g<s.cost||g===s.cost&&x<s.len)))&&(s={pts:d,opposite:m,cross:S,cost:g,len:x})}return(s==null?void 0:s.pts)??null}function sh(e,t,n){const{elementRegistry:i}=e,r=e.modeling,o=yt(i),a=Ti(o).filter(l=>(l.kind==="edge-overlap-opposite"||l.kind==="edge-overlap-mixed")&&!t.has(Ri(l)));if(!a.length)return;const s=new Set;for(const l of a)if(!(l.kind!=="edge-overlap-opposite"&&l.kind!=="edge-overlap-mixed"))for(const p of l.edges)n.has(p)||s.add(p);const c=l=>{var p;return((p=o.edges.find(f=>f.id===l))==null?void 0:p.type)??""},u=[...s].sort((l,p)=>{const f=c(l)==="bpmn:SequenceFlow"?0:1,d=c(p)==="bpmn:SequenceFlow"?0:1;return f!==d?f-d:l.localeCompare(p)});for(const l of u){const p=yt(i),f=p.edges.find(h=>h.id===l);if(!f)continue;const d=ah(f,p);if(!d)continue;const g=i.get(l);g&&r.updateWaypoints(g,d)}}const HE=10,zE=(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 ch(e,t){const n=e.label;if(!n)return null;const i=t.edges.filter(a=>a.id!==e.id);if(!ps(e,i))return null;const r=ci(t),o=i.flatMap(hn);for(const a of hn(e)){let s=[[a.lo,a.hi]];for(const[d,g]of ls(a,o))s=s.flatMap(([h,m])=>{const S=[];return d>h&&S.push([h,Math.min(m,d)]),g<m&&S.push([Math.max(h,g),m]),S.filter(([y,x])=>x>y)});const c=a.axis==="h"?n.width:n.height,u=s.find(([d,g])=>g-d>=c+HE*2);if(!u)continue;const l=(u[0]+u[1])/2,p=a.axis==="h"?{x:l,y:a.at-Dd}:{x:a.at+Sn+n.width/2,y:l},f={x:p.x-n.width/2,y:p.y-n.height/2,width:n.width,height:n.height};if(!ps({...e,label:f},i)&&!r.some(d=>!e.endpoints.includes(d.id)&&zE(f,d)))return f}return null}const Sn=8;function uh(e,t){const n=e.label;if(!n)return null;const i=hn(e);if(!i.length)return null;const r=n.x+n.width/2,o=n.y+n.height/2,a=f=>{const d=f.axis==="h"?r:o,g=f.axis==="h"?o-f.at:r-f.at,h=d<f.lo?f.lo-d:d>f.hi?d-f.hi:0;return Math.hypot(g,h)},s=i.reduce((f,d)=>a(d)<a(f)?d:f,i[0]),c=[...i,...t.edges.filter(f=>f.id!==e.id).flatMap(hn),...t.shapes.filter(f=>f.container).flatMap(Yo)],u=f=>!c.some(d=>Pi(f,d));if(u(n))return null;const l=(s.axis==="v"?n.height:n.width)+Sn,p=[0,-l,l,-2*l,2*l];if(s.axis==="v")for(const f of[s.at+Sn,s.at-Sn-n.width])for(const d of p){const g=n.y+d;if(g<s.lo||g+n.height>s.hi)continue;const h={...n,x:f,y:g};if(u(h))return h}else for(const f of[s.at-Sn-n.height,s.at+Sn])for(const d of p){const g=n.x+d;if(g<s.lo||g+n.width>s.hi)continue;const h={...n,x:g,y:f};if(u(h))return h}return null}function lh(e,t){const{elementRegistry:n}=e,i=e.modeling,r=yt(n);for(const o of r.edges){if(!o.label||t.has(o.id))continue;const a=uh(o,r);if(!a)continue;const s=n.get(o.id),c=s==null?void 0:s.label;c&&i.moveElements([c],{x:a.x-c.x,y:a.y-c.y})}}function ph(e,t,n){const{elementRegistry:i}=e,r=e.modeling,o=yt(i),a=Ti(o).filter(s=>s.kind==="label-on-shared-segment"&&!t.has(Ri(s)));for(const s of a){if(s.kind!=="label-on-shared-segment"||n.has(s.edge))continue;const c=o.edges.find(f=>f.id===s.edge);if(!c)continue;const u=ch(c,o);if(!u)continue;const l=i.get(s.edge),p=l==null?void 0:l.label;p&&r.moveElements([p],{x:u.x-p.x,y:u.y-p.y})}}function fh(e,t){const n=e.label;if(!n)return null;const i=[...t.edges.flatMap(hn),...t.shapes.filter(f=>f.container).flatMap(Yo)],r=i.filter(f=>Pi(n,f));if(!r.length)return null;const o=t.shapes.filter(f=>!f.container&&f.id!==e.id),a=uo(t).filter(f=>f.owner!==e.id).map(f=>f.rect),s=(f,d)=>f.x<d.x+d.width&&d.x<f.x+f.width&&f.y<d.y+d.height&&d.y<f.y+f.height,c=f=>!i.some(d=>Pi(f,d))&&!o.some(d=>s(f,d))&&!a.some(d=>s(f,d)),u=[];for(const f of r)f.axis==="h"?u.push({...n,y:f.at-Sn-n.height},{...n,y:f.at+Sn}):u.push({...n,x:f.at-Sn-n.width},{...n,x:f.at+Sn});const l=e.x+e.width/2,p=e.y+e.height/2;return u.push({...n,x:l-n.width/2,y:e.y+e.height+Sn},{...n,x:l-n.width/2,y:e.y-Sn-n.height},{...n,x:e.x+e.width+Sn,y:p-n.height/2},{...n,x:e.x-Sn-n.width,y:p-n.height/2}),u.find(c)??null}function dh(e,t){const{elementRegistry:n}=e,i=e.modeling,r=yt(n);for(const o of r.shapes){if(o.container||!o.label||t.has(o.id))continue;const a=fh(o,yt(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 GE=/^[\p{L}_][\p{L}\p{N}_.\-]*$/u,hh=new Set(["sequenceFlow","messageFlow","dataAssociation","association"]),mh={"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}]},ys=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),el=e=>typeof e=="string"&&e!=="";function VE(e){const t=[];function n(i,r,o,a){if(a===null){el(o)||t.push({kind:"payload-invalid",opIndex:i,field:r});return}if(!ys(o)){t.push({kind:"payload-invalid",opIndex:i,field:r});return}for(const s of a)el(o[s])||t.push({kind:"payload-invalid",opIndex:i,field:`${r}.${s}`})}return e.forEach((i,r)=>{if(!ys(i)||!el(i.kind)||!(i.kind in mh)){t.push({kind:"payload-invalid",opIndex:r,field:"kind"});return}for(const o of mh[i.kind]){const a=o.path.endsWith("[]"),s=a?o.path.slice(0,-2):o.path,c=s.split(".");let u=i;for(const p of c.slice(0,-1)){if(!ys(u))break;u=u[p]}if(!ys(u))continue;const l=u[c[c.length-1]];if(!(l===void 0&&o.optional)&&!(l===null&&o.optional)){if(!a){n(r,o.path,l,o.shape);continue}if(!Array.isArray(l)){t.push({kind:"payload-invalid",opIndex:r,field:o.path});continue}l.forEach((p,f)=>n(r,`${s}[${f}]`,p,o.shape))}}if(i.kind==="node.add"||i.kind==="node.update"){const o=i.band;o!==void 0&&(!Number.isInteger(o)||o<0)&&t.push({kind:"payload-invalid",opIndex:r,field:"band"})}}),t}function gh(e,t){const n=VE(e);if(n.length>0)return n;const i=[],r=new Map,o=new Map;function a(f,d,g){if(!GE.test(d)){i.push({kind:"id-invalid",opIndex:f,id:d});return}if(t.categoryOf(d)!==void 0||r.has(d)){i.push({kind:"id-duplicate",opIndex:f,id:d});return}r.set(d,{...g,opIndex:f})}e.forEach((f,d)=>{var g;switch(f.kind){case"participant.add":a(d,f.participant.id,{category:"participant",lanes:(f.participant.lanes??[]).map(h=>h.id)});for(const h of f.participant.lanes??[])a(d,h.id,{category:"lane"});break;case"node.add":a(d,f.node.id,{category:"flowNode",participant:f.node.participant});break;case"sequenceFlow.add":a(d,f.flow.id,{category:"sequenceFlow"});break;case"messageFlow.add":a(d,f.flow.id,{category:"messageFlow"});break;case"dataStore.add":a(d,f.dataStore.id,{category:"dataStore"});for(const h of f.associations??[])h.id&&a(d,h.id,{category:"dataAssociation"});break;case"dataAssociation.add":f.association.id&&a(d,f.association.id,{category:"dataAssociation"});break;case"association.add":f.association.id&&a(d,f.association.id,{category:"association"});break;case"annotation.add":a(d,f.annotation.id,{category:"annotation"}),(g=f.association)!=null&&g.id&&a(d,f.association.id,{category:"association"});break;case"group.add":a(d,f.group.id,{category:"group"});break;case"participant.update":if(f.lanes){o.set(f.id,f.lanes.map(h=>h.id));for(const h of f.lanes)t.categoryOf(h.id)===void 0&&a(d,h.id,{category:"lane"})}break}});const s=f=>{var d;return((d=r.get(f))==null?void 0:d.category)??t.categoryOf(f)},c=f=>{const d=r.get(f);return d?d.category==="participant"?f:d.participant:t.categoryOf(f)==="participant"?f:t.participantOf(f)};function u(f,d,g,h){const m=s(d);if(m===void 0){i.push({kind:"ref-missing",opIndex:f,ref:d,role:g});return}if(h&&!h.includes(m)){i.push({kind:"ref-category",opIndex:f,ref:d,role:g,expected:h.join("|"),actual:m});return}return m}const l=t.isCollaboration()||e.some(f=>f.kind==="participant.add");return e.forEach((f,d)=>{var g;switch(f.kind){case"participant.add":break;case"node.add":{const{participant:h,lane:m}=f.node;if(h===void 0){(l||m!==void 0)&&i.push({kind:"participant-required",opIndex:d,id:f.node.id});break}if(u(d,h,"participant",["participant"])===void 0)break;m!==void 0&&((((g=r.get(h))==null?void 0:g.lanes)??o.get(h)??t.lanesOf(h)).includes(m)||i.push({kind:"lane-unknown",opIndex:d,lane:m,participant:h}));break}case"sequenceFlow.add":{const{id:h,source:m,target:S,name:y,condition:x}=f.flow,E=u(d,m,"source",["flowNode"]),P=u(d,S,"target",["flowNode"]);E&&P&&c(m)!==c(S)&&i.push({kind:"flow-cross-pool",opIndex:d,id:h}),y!==void 0&&x!==void 0&&i.push({kind:"condition-name-conflict",opIndex:d,id:h});break}case"messageFlow.add":{const{id:h,source:m,target:S}=f.flow,y=u(d,m,"source",["flowNode","participant"]),x=u(d,S,"target",["flowNode","participant"]);if(y&&x){const E=c(m),P=c(S);E!==void 0&&E===P&&i.push({kind:"message-flow-same-pool",opIndex:d,id:h})}break}case"dataStore.add":{for(const h of f.associations??[]){if([h.source,h.target].filter(y=>y===f.dataStore.id).length!==1){i.push({kind:"data-association-ends",opIndex:d,source:h.source,target:h.target});continue}const S=h.source===f.dataStore.id?h.target:h.source;u(d,S,"dataAssociation",["flowNode"])}break}case"dataAssociation.add":{const{source:h,target:m}=f.association,S=u(d,h,"source"),y=u(d,m,"target");if(S&&y){const x=new Set([S,y]);x.has("dataStore")&&x.has("flowNode")||i.push({kind:"data-association-ends",opIndex:d,source:h,target:m})}break}case"association.add":{const{id:h,source:m,target:S}=f.association,y=u(d,m,"source"),x=u(d,S,"target");y&&x&&y!=="annotation"&&x!=="annotation"&&i.push({kind:"association-detached",opIndex:d,annotation:h??`${m}->${S}`});break}case"annotation.add":{if(f.association){const{source:h,target:m}=f.association;if(h!==f.annotation.id&&m!==f.annotation.id)i.push({kind:"association-detached",opIndex:d,annotation:f.annotation.id});else{const S=h===f.annotation.id?m:h;u(d,S,"association")}}f.placement&&u(d,f.placement.anchor,"anchor");break}case"group.add":{for(const h of f.group.members??[]){const m=u(d,h,"member");m&&hh.has(m)&&i.push({kind:"ref-category",opIndex:d,ref:h,role:"member",expected:"shape",actual:m})}break}case"participant.update":{if(p(d,f.id,"participant")===void 0)break;if(f.lanes){const h=t.lanesOf(f.id),m=f.lanes.map(y=>y.id);for(const y of h)m.includes(y)||i.push({kind:"lane-shrink-unsupported",opIndex:d,participant:f.id,lane:y});for(const y of m)t.categoryOf(y)!==void 0&&!h.includes(y)&&i.push({kind:"id-duplicate",opIndex:d,id:y});const S=m.filter(y=>h.includes(y));S.length===h.length&&S.some((y,x)=>y!==h[x])&&i.push({kind:"lane-reorder-unsupported",opIndex:d,participant:f.id})}break}case"node.update":{if(p(d,f.id,"flowNode")===void 0)break;if(f.lane!==void 0){const h=t.participantOf(f.id);(h?o.get(h)??t.lanesOf(h):[]).includes(f.lane)||i.push({kind:"lane-unknown",opIndex:d,lane:f.lane,participant:h??""})}break}case"sequenceFlow.update":{if(p(d,f.id,"sequenceFlow")===void 0)break;if(f.name!==void 0&&f.condition!==void 0&&i.push({kind:"condition-name-conflict",opIndex:d,id:f.id}),f.source!==void 0||f.target!==void 0){const h=f.source===void 0||u(d,f.source,"source",["flowNode"])!==void 0,m=f.target===void 0||u(d,f.target,"target",["flowNode"])!==void 0,S=t.endpointsOf(f.id),y=f.source??(S==null?void 0:S.source),x=f.target??(S==null?void 0:S.target);h&&m&&y!==void 0&&x!==void 0&&new Set([c(y),c(x),c(f.id)]).size>1&&i.push({kind:"flow-cross-pool",opIndex:d,id:f.id})}break}case"messageFlow.update":p(d,f.id,"messageFlow");break;case"dataStore.update":p(d,f.id,"dataStore");break;case"annotation.update":{if(p(d,f.id,"annotation")===void 0)break;f.placement&&u(d,f.placement.anchor,"anchor");break}case"group.update":{if(p(d,f.id,"group")===void 0)break;for(const h of f.members??[]){const m=u(d,h,"member");m&&hh.has(m)&&i.push({kind:"ref-category",opIndex:d,ref:h,role:"member",expected:"shape",actual:m})}break}case"element.remove":{p(d,f.id)==="lane"&&i.push({kind:"ref-category",opIndex:d,ref:f.id,role:"target",expected:"removable",actual:"lane"});break}}}),i;function p(f,d,g){if(r.has(d)){i.push({kind:"target-added-in-batch",opIndex:f,id:d});return}const h=t.categoryOf(d);if(h===void 0){i.push({kind:"ref-missing",opIndex:f,ref:d,role:"target"});return}if(g&&h!==g){i.push({kind:"ref-category",opIndex:f,ref:d,role:"target",expected:g,actual:h});return}return h}}function yh(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 vs(e){return`bpmn:${e[0].toUpperCase()}${e.slice(1)}`}const bs={"top-left":[-1,-1],top:[0,-1],"top-right":[1,-1],right:[1,0],"bottom-right":[1,1],bottom:[0,1],"bottom-left":[-1,1],left:[-1,0]},tn=10,vh=40,WE=10;function tl(e,t,n,i,r){const o=n,a=(k,O)=>{const[$,oe]=bs[k];let ve={x:t.x+t.width/2+$*(t.width/2+o.width/2+O),y:t.y+t.height/2+oe*(t.height/2+o.height/2+O)};const Ue=i.x+tn+o.width/2,Y=i.x+i.width-tn-o.width/2,pe=i.y+tn+o.height/2,ge=i.y+i.height-tn-o.height/2,le={x:Math.min(Y,Math.max(Ue,ve.x)),y:Math.min(ge,Math.max(pe,ve.y))};return(le.x!==ve.x||le.y!==ve.y)&&(ve=Math.abs(le.x-(t.x+t.width/2))<(t.width+o.width)/2+tn&&Math.abs(le.y-(t.y+t.height/2))<(t.height+o.height)/2+tn?{x:t.x+t.width+tn+o.width/2,y:le.y}:le),ve},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=yt(e),u=k=>{var $,oe;if(!r.selfId)return!1;const O=e.get(k);return!!O&&((($=O.source)==null?void 0:$.id)===r.selfId||((oe=O.target)==null?void 0:oe.id)===r.selfId)},l=c.edges.filter(k=>!u(k.id)).flatMap(hn),p=uo(c).filter(k=>k.owner!==r.selfId).map(k=>k.rect),f=k=>({x0:k.x-o.width/2-tn,x1:k.x+o.width/2+tn,y0:k.y-o.height/2-tn,y1:k.y+o.height/2+tn}),d=k=>{const O=f(k);return s.some($=>O.x0<$.x+$.width&&O.x1>$.x&&O.y0<$.y+$.height&&O.y1>$.y)},g=k=>{const O=f(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)},h=k=>{const O=f(k);return p.some($=>O.x0<$.x+$.width&&O.x1>$.x&&O.y0<$.y+$.height&&O.y1>$.y)},m=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=f(k);return m.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)},y=k=>d(k)||g(k)||h(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=Y=>Y.startsWith("top")?Y.replace(/^top/,"bottom"):Y.replace(/^bottom/,"top"),O=Y=>Y.endsWith("left")?Y.replace(/left$/,"right"):Y.replace(/right$/,"left"),$=r.placement.side,oe=[$,k($),O($),k(O($)),"top","bottom","left","right","top-left","top-right","bottom-left","bottom-right"],ve=r.placement.offset??50;let Ue=a($,ve);if(y(Ue)){const Y=new Set;for(const pe of oe){if(Y.has(pe))continue;Y.add(pe);const ge=a(pe,ve);if(x(ge)&&!y(ge)){Ue=ge;break}}}return Ue}const E=r.from,P=i.x+tn+o.width/2,C=i.x+i.width-tn-o.width/2,D=i.y+tn+o.height/2,A=i.y+i.height-tn-o.height/2;let I={x:Math.min(C,Math.max(P,E.x)),y:Math.min(A,Math.max(D,E.y))};if(y(I)){const k=(t.width+o.width)/2+tn,$=[{x:I.x+k,y:I.y},{x:I.x-k,y:I.y},{x:I.x,y:I.y-o.height-tn},{x:I.x,y:I.y+o.height+tn}].filter(x).find(oe=>!y(oe));$&&(I=$)}return I}function Xt(e,t){return e.filter(n=>n.kind===t)}function bh(e,t){var zx,Gx,Vx,Wx,Ux,qx,Yx,Kx,Xx,Zx,Qx,Jx,e0,t0,n0,i0,r0,o0,a0,s0,c0,u0,l0;const{modeling:n,bpmnFactory:i,elementFactory:r,elementRegistry:o,canvas:a,autoPlace:s,bpmnReplace:c}=t,u=()=>a.getRootElement(),l=b=>o.get(b),p=b=>{const R=l(b);if(!R)throw new Error(`하강 참조 해소 실패: ${b}`);return R},f=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 g=Xt(e,"participant.add"),h=Xt(e,"node.add"),m=Xt(e,"sequenceFlow.add"),S=Xt(e,"messageFlow.add"),y=Xt(e,"dataStore.add"),x=Xt(e,"dataAssociation.add"),E=Xt(e,"annotation.add"),P=Xt(e,"group.add"),C=new Map(h.map(b=>[b.node.id,b])),D=(b,R,T)=>{var z;const F=b.businessObject,H=(((z=F.extensionElements)==null?void 0:z.values)??[]).filter(G=>G.$type!==R),B=T?[...H,i.create(R,T)]:H;if(!B.length){F.extensionElements&&n.updateProperties(b,{extensionElements:void 0});return}const W=i.create("bpmn:ExtensionElements",{values:B});B.forEach(G=>{G.$parent=W}),n.updateProperties(b,{extensionElements:W})},A=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 I=b=>o.filter(R=>{var T;return R.type==="bpmn:Lane"&&((T=f(R))==null?void 0:T.id)===b}).sort((R,T)=>R.y-T.y);for(const b of Xt(e,"participant.update")){const R=p(b.id);if(b.name!==void 0&&n.updateProperties(R,{name:b.name??void 0}),!b.lanes)continue;const T=I(b.id);if(!T.length){n.splitLane(R,b.lanes.length),I(b.id).forEach((H,B)=>{const W=b.lanes[B];W&&n.updateProperties(H,{id:W.id,name:W.name})});continue}const F=new Set(T.map(H=>H.id));b.lanes.forEach((H,B)=>{if(F.has(H.id)){n.updateProperties(p(H.id),{name:H.name});return}const W=B===0?n.addLane(I(b.id)[0],"top"):n.addLane(p(b.lanes[B-1].id),"bottom");n.updateProperties(W,{id:H.id,name:H.name})})}const k=150,O=130,$=80,oe=90,ve=180,Ue=30,Y=(b,R,T,F,H)=>{const B=T-R.width/2,W=F-R.height/2;return(b.children??[]).find(z=>!("waypoints"in z&&z.waypoints)&&z.type!=="bpmn:Lane"&&z.type!=="label"&&!(H!=null&&H.has(z.id))&&typeof z.x=="number"&&B<z.x+z.width+Ue&&B+R.width+Ue>z.x&&W<z.y+z.height&&W+R.height>z.y)},pe=new Set;for(const b of g){pe.add(`pool:${b.participant.id}`);for(const R of b.participant.lanes??[])pe.add(R.id)}const ge=new Map;for(const b of h){const R=b.node.lane??`pool:${b.node.participant??""}`;let T=ge.get(R);T||ge.set(R,T=new Set([0])),b.band!==void 0&&T.add(b.band)}const le=new Map;for(const[b,R]of ge){if(!pe.has(b))continue;const T=[...R].sort((B,W)=>B-W),F=T.map((B,W)=>W===0?0:W%2===1?Math.ceil(W/2):-(W/2)),H=Math.min(...F);le.set(b,new Map(T.map((B,W)=>[B,F[W]-H])))}{const b=new Map;for(const R of g)(R.participant.lanes??[]).forEach((T,F)=>b.set(T.id,F));for(const[R,T]of le){if(!b.has(R)||T.size<2)continue;const F=b.get(R),H=T.get(0)??0,B=new Set;for(const ne of h){if(ne.node.lane!==R||(ne.band??0)!==0||!ne.node.type.endsWith("Gateway"))continue;const Ce={in:new Set,out:new Set,cross:new Set};for(const ce of m){const be=ce.flow.source===ne.node.id;if(!be&&ce.flow.target!==ne.node.id)continue;const ot=C.get(be?ce.flow.target:ce.flow.source);if(!ot||ot.node.participant!==ne.node.participant||!ot.node.lane)continue;let Pe,$e=!1;if(ot.node.lane!==R){const ue=b.get(ot.node.lane);if(ue===void 0)continue;Pe=ue>F?"down":"up",$e=!0}else{const ue=T.get(ot.band??0)??H;Pe=ue>H?"down":ue<H?"up":void 0}Pe&&(Ce[be?"out":"in"].add(Pe),$e&&Ce.cross.add(Pe))}for(const ce of["up","down"])Ce.in.has(ce)&&Ce.out.has(ce)&&Ce.cross.has(ce)&&B.add(ce)}if(B.size!==1)continue;const[W]=B,z=Math.max(...T.values()),G=W==="down"?z:0;if(H===G)continue;const Q=[...T.entries()].filter(([ne])=>ne!==0).sort((ne,Ce)=>ne[1]-Ce[1]),fe=[...Array(z+1).keys()].filter(ne=>ne!==G),xe=new Map([[0,G]]);Q.forEach(([ne],Ce)=>xe.set(ne,fe[Ce])),le.set(R,xe)}}const Ee=b=>{var R;return(((R=ge.get(b))==null?void 0:R.size)??0)>1},re=b=>b.band??(b.node.lane||!Ee(`pool:${b.node.participant??""}`)?void 0:0),q=new Map,U=b=>q.get(b.node.id)??re(b),Z=new Set,Fe=new Set;{const b=new Map;for(const F of m)b.set(F.flow.target,(b.get(F.flow.target)??0)+1);const R=F=>{const H=[],B=new Set([F]),W=[F];for(;W.length;){const z=W.shift();H.push(z);for(const G of m)G.flow.source!==z||B.has(G.flow.target)||(b.get(G.flow.target)??0)!==1||(B.add(G.flow.target),W.push(G.flow.target))}return H},T=(F,H)=>{var B;return((B=le.get(F))==null?void 0:B.get(H))??H};for(const F of h){if(!F.node.type.endsWith("Gateway"))continue;const H=F.node.lane??`pool:${F.node.participant??""}`,B=le.get(H);if(!B||B.size<2)continue;const W=U(F);if(W===void 0||T(H,W)!==T(H,0))continue;const z=T(H,W),G=m.filter(ce=>ce.flow.source===F.node.id).map(ce=>C.get(ce.flow.target)).filter(ce=>!!ce&&(ce.node.lane??`pool:${ce.node.participant??""}`)===H),Q=G.filter(ce=>{const be=U(ce);return be!==void 0&&T(H,be)===z&&(b.get(ce.node.id)??0)===1}),fe=G.some(ce=>{const be=U(ce);return be!==void 0&&T(H,be)>z});if(Q.length!==1||!fe)continue;const xe=new Set(G.flatMap(ce=>R(ce.node.id)));if(!m.some(ce=>ce.flow.target===F.node.id&&xe.has(ce.flow.source)))continue;const Ce=new Map;for(const[ce,be]of B)Ce.set(ce,be+1);Ce.set(-1,0),le.set(H,Ce);for(const ce of R(Q[0].node.id))C.has(ce)&&(q.set(ce,-1),Fe.add(ce));Z.add(F.node.id)}}const wt=(b,R)=>{var T;return((T=le.get(b))==null?void 0:T.get(R))??R},M=new Map;for(const[b,R]of ge){let T=0;for(const F of R)T=Math.max(T,wt(b,F));M.set(b,T)}const w=b=>ve+k*b,v=g.map((b,R)=>({op:b,declared:R}));v.sort((b,R)=>{const T=b.op.order??Number.POSITIVE_INFINITY,F=R.op.order??Number.POSITIVE_INFINITY;return T!==F?T-F:b.declared-R.declared});let N=80;for(const b of o.getAll())b.parent===u()&&"height"in b&&typeof b.y=="number"&&(N=Math.max(N,b.y+b.height+60));for(const{op:b}of v){const R=b.participant,T=h.filter(ne=>ne.node.participant===R.id).length,F=((zx=R.lanes)==null?void 0:zx.length)??0,H=Math.max(1200,T*160+300),B=(R.lanes??[]).map(ne=>w(M.get(ne.id)??0)),W=B.reduce((ne,Ce)=>ne+Ce,0);F&&W<300&&(B[F-1]+=300-W);const z=Math.max(300,k*((M.get(`pool:${R.id}`)??0)+1)),G=R.blackBox||T+F===0?120:F?Math.max(300,W):z,Q=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:H,height:G,isExpanded:!0}),fe=n.createShape(Q,{x:100+H/2,y:N+G/2},u()),xe=R.lanes??[];if(xe.length&&n.splitLane(fe,xe.length),xe.length){const ne=o.filter(Ce=>{var ce;return Ce.type==="bpmn:Lane"&&((ce=f(Ce))==null?void 0:ce.id)===R.id}).sort((Ce,ce)=>Ce.y-ce.y);if(ne.forEach((Ce,ce)=>{const be=xe[ce];be&&n.updateProperties(Ce,{id:be.id,name:be.name})}),B.some(Ce=>Ce!==fe.height/F)){let Ce=fe.y;ne.forEach((ce,be)=>{const ot=B[be];n.resizeShape(ce,{x:ce.x,y:Ce,width:ce.width,height:ot}),Ce+=ot})}}N=fe.y+fe.height+60}const V=b=>{var F;const R=C.get(b);if(R)return R.node.participant??"";const T=l(b);return T?T.type==="bpmn:Participant"?T.id:((F=f(T))==null?void 0:F.id)??"":""},K=new Map,ye=b=>{let R=K.get(b);return R||K.set(b,R={nodes:[],flows:[]}),R};for(const b of h)ye(b.node.participant??"").nodes.push(b);for(const b of m)ye(V(b.flow.source)).flows.push(b);const Ne=b=>{var R;return i.create("bpmn:SequenceFlow",{id:b.id,name:b.name??((R=b.condition)==null?void 0:R.label)})},Ze=(b,R)=>r.createShape({type:vs(b.type),businessObject:i.create(vs(b.type),{id:b.id,name:b.name,...R!==void 0?{"bwl:band":R}:{}})}),Pt=[...v.map(({op:b})=>b.participant.id).filter(b=>K.has(b)),...[...K.keys()].filter(b=>!g.some(R=>R.participant.id===b))],rt=b=>b.endsWith("Gateway");for(const b of Pt){const R=K.get(b),T=b?p(b):void 0,F=T?T.x+150:250;let H=T?T.y+80:120;const B=(ue,we,Oe)=>{const Qe=u().children.filter(pt=>!("waypoints"in pt&&pt.waypoints)&&pt.id!==we&&typeof pt.y=="number"&&pt.y>=ue);Qe.length&&n.moveElements(Qe,{x:0,y:Oe})},W=(ue,we)=>{if(ue){const nt=p(ue),Ut=w(we);if(nt.height>=Ut)return;const en=Ut-nt.height,X=f(nt),ie=X?X.y+X.height:nt.y+nt.height;n.resizeLane(nt,{x:nt.x,y:nt.y,width:nt.width,height:Ut},!1),B(ie,X==null?void 0:X.id,en);return}if(!T)return;const Oe=k*(we+1);if(T.height>=Oe)return;const Qe=Oe-T.height,pt=T.y+T.height;n.resizeShape(T,{x:T.x,y:T.y,width:T.width,height:Oe}),B(pt,T.id,Qe)},z=(ue,we,Oe)=>{if(ue){const Qe=p(ue);return Qe.y+Math.min(Qe.height/2,oe)+wt(ue,we??0)*k}return we!==void 0&&T?T.y+$+wt(`pool:${b}`,we)*k:Oe},G=(ue,we,Oe)=>{if(ue){const Qe=p(ue);return Qe.y+Math.min(Qe.height/2,oe)+we*k}return T?T.y+$+we*k:Oe},Q=ue=>ue.participant?p(ue.participant):u(),fe=(ue,we,Oe,Qe,pt,nt)=>{const Ut=Oe!==void 0||Qe!==void 0,en=wt(Oe??`pool:${b}`,Qe??0);if(Ut)for(let se=0;se<4;se++){const _e=G(Oe,en+se,nt);if(!Y(ue,we,pt,_e))return W(Oe,en+se),{x:pt,y:_e}}const X=z(Oe,Qe,nt);Ut&&W(Oe,en);let ie=pt;for(let se=0;se<64;se++){const _e=Y(ue,we,ie,X);if(!_e)break;ie=_e.x+_e.width+O+we.width/2}return{x:ie,y:X}},xe=new Set(R.flows.map(ue=>ue.flow.target)),ne=new Map;for(const ue of R.nodes){if(xe.has(ue.node.id))continue;const we=Ze(ue.node,ue.band),Oe=re(ue),Qe=ue.node.lane?`${ue.node.lane}|${Oe??""}`:Oe!==void 0?`band:${Oe}`:"",pt=Q(ue.node),nt=fe(pt,we,ue.node.lane,Oe,ne.get(Qe)??F,H);n.createShape(we,nt,pt),ne.set(Qe,nt.x+we.width+O),!ue.node.lane&&Oe===void 0&&(H+=160)}const Ce=new Set,ce=new Map,be=new Map,ot=new Map;if(b&&pe.has(`pool:${b}`)){const ue=new Map;for(const X of R.flows)ue.set(X.flow.target,(ue.get(X.flow.target)??0)+1);const we=X=>z(X.node.lane,U(X),Number.NaN),Oe=new Set,Qe=X=>{var _e;const ie=(_e=C.get(X))==null?void 0:_e.node.participant;if(ie)return l(ie);const se=l(X);if(se)return se.type==="bpmn:Participant"?se:f(se)},pt=X=>{const ie=[],se=new Set([X]),_e=[X];for(;_e.length;){const Je=_e.shift(),Ge=C.get(Je);Ge&&ie.push(Ge);for(const ke of R.flows)ke.flow.source!==Je||se.has(ke.flow.target)||(ue.get(ke.flow.target)??0)!==1||(se.add(ke.flow.target),_e.push(ke.flow.target))}return ie},nt=X=>{if(!T)return;const ie=new Set(X.map(Je=>Je.node.id));let se=!1,_e=!1;for(const Je of S){if(!ie.has(Je.flow.source))continue;const Ge=Qe(Je.flow.target);!Ge||Ge.id===T.id||(Ge.y<T.y?se=!0:_e=!0)}return se&&!_e?"up":_e&&!se?"down":void 0};for(const X of R.nodes){if(!rt(X.node.type))continue;const ie=z(X.node.lane,re(X),Number.NaN);if(Number.isNaN(ie))continue;const se=[];for(const ke of R.flows){if(ke.flow.source!==X.node.id)continue;const Ve=C.get(ke.flow.target);if(!Ve||Ve.node.lane!==X.node.lane||(ue.get(Ve.node.id)??0)!==1)continue;const it=re(Ve);if(it===void 0)continue;const qt=z(Ve.node.lane,it,Number.NaN);if(Number.isNaN(qt))continue;const Tt=pt(Ve.node.id),Ft=nt(Tt);Ft&&se.push({subtree:Tt,band:it,row:qt,dir:Ft})}if(!se.some(ke=>ke.dir==="up")||!se.some(ke=>ke.dir==="down")||!se.some(ke=>ke.dir==="up"&&se.some(Ve=>Ve.dir==="down"&&Ve.row<ke.row)))continue;const Je=[...se].sort((ke,Ve)=>ke.row-Ve.row);[...se.filter(ke=>ke.dir==="up"),...se.filter(ke=>ke.dir==="down")].sort((ke,Ve)=>ke.dir===Ve.dir?ke.row-Ve.row:ke.dir==="up"?-1:1).forEach((ke,Ve)=>{const it=Je[Ve].band;if(it!==ke.band){Oe.add(X.node.id);for(const qt of ke.subtree)re(qt)===ke.band&&q.set(qt.node.id,it)}})}const Ut=X=>{if(!T)return;const ie=new Set(X.map(Je=>Je.node.id));let se=!1,_e=!1;for(const Je of S){if(!ie.has(Je.flow.target))continue;const Ge=Qe(Je.flow.source);!Ge||Ge.id===T.id||(Ge.y<T.y?se=!0:_e=!0)}return se&&!_e?"up":_e&&!se?"down":void 0};for(const X of R.nodes){if(!rt(X.node.type))continue;const ie=X.node.lane??`pool:${b}`,se=le.get(ie);if(!se||se.size<2)continue;const _e=se.get(0);if(_e===void 0)continue;const Je=Math.max(...se.values()),Ge=_e===Je&&_e!==0?"down":void 0;if(!Ge)continue;const ke=[];for(const Ft of R.flows){if(Ft.flow.source!==X.node.id)continue;const ei=C.get(Ft.flow.target);if(!ei||ei.node.lane!==X.node.lane||(ue.get(ei.node.id)??0)!==1)continue;const p0=U(ei);p0!==void 0&&ke.push({t:ei,subtree:pt(ei.node.id),band:p0})}const Ve=ke.find(Ft=>(se.get(Ft.band)??Ft.band)===_e);if(!Ve||Ut(Ve.subtree)===Ge||nt(Ve.subtree)===Ge)continue;const it=ke.find(Ft=>Ft!==Ve&&Ut(Ft.subtree)===Ge);if(!it)continue;const qt=Ve.band,Tt=it.band;for(const Ft of Ve.subtree)U(Ft)===qt&&q.set(Ft.node.id,Tt);for(const Ft of it.subtree)U(Ft)===Tt&&q.set(Ft.node.id,qt);Oe.add(X.node.id)}for(const X of R.nodes){if(!rt(X.node.type))continue;const ie=we(X);if(Number.isNaN(ie)||E.some(ke=>{var Ve,it;return(((Ve=ke.placement)==null?void 0:Ve.anchor)??(ke.association?ke.association.source===ke.annotation.id?ke.association.target:ke.association.source:void 0))===X.node.id&&((it=ke.placement)==null?void 0:it.side.startsWith("bottom"))}))continue;let _e,Je=!1,Ge;for(const ke of R.flows){if(ke.flow.source!==X.node.id)continue;const Ve=C.get(ke.flow.target);if(!Ve||!Ve.node.lane&&re(Ve)===void 0)continue;const it=we(Ve);Number.isNaN(it)||(Math.abs(it-ie)<.5&&(Je=!0),it>ie?!_e||it>_e.row?_e={id:Ve.node.id,row:it,count:1}:it===_e.row&&_e.count++:it<ie&&Ve.node.lane===X.node.lane&&(!Ge||it>Ge.row?Ge={op:Ve,row:it,count:1}:it===Ge.row&&Ge.count++))}_e&&_e.count===1&&(ue.get(_e.id)??0)===1&&!Oe.has(X.node.id)&&Ce.add(_e.id),!Je&&Ge&&Ge.count===1&&(ue.get(Ge.op.node.id)??0)===1&&!Z.has(X.node.id)&&ce.set(Ge.op.node.id,{lane:X.node.lane,band:U(X)})}const en=new Map;for(const X of S)en.set(X.flow.target,[...en.get(X.flow.target)??[],X]);for(const X of R.nodes){const ie=en.get(X.node.id);if(!ie||ie.length!==1||!ue.get(X.node.id)||!X.node.lane&&re(X)===void 0||Fe.has(X.node.id))continue;const se=(Gx=C.get(ie[0].flow.source))==null?void 0:Gx.node.participant,_e=se?l(se):void 0;if(!_e||!T||_e.id===T.id)continue;const Je=X.node.lane??`pool:${b}`,Ge=le.get(Je);if(!Ge)continue;const ke=Ge.get(0)??0,Ve=(Ge.get(U(X)??0)??ke)-ke;if(Ve===0)continue;const it=_e.y<T.y;if(it&&Ve<0||!it&&Ve>0)continue;let qt;for(const[Tt,Ft]of Ge){const ei=Ft-ke;(it&&ei<0&&(!qt||ei<qt.row)||!it&&ei>0&&(!qt||ei>qt.row))&&(qt={band:Tt,row:ei})}qt&&be.set(X.node.id,{lane:X.node.lane,band:qt.band})}}const Pe=new Set;let $e=0;for(;$e++<R.nodes.length+2;){for(let Oe=0;Oe<R.nodes.length+R.flows.length+2;Oe++){let Qe=!1;for(const pt of R.flows){const nt=pt.flow;if(Pe.has(nt.id))continue;const Ut=l(nt.source);if(!Ut)continue;const en=l(nt.target),X=C.get(nt.target);if(!en&&X){const ie=Ze(X.node,X.band),se=U(X);if(X.node.lane||se!==void 0){const _e=Q(X.node),Je=Ut,Ge=Je.x+(ot.get(nt.source)??0)+Je.width+O,ke=ce.get(nt.target)??be.get(nt.target),Ve=fe(_e,ie,ke?ke.lane:X.node.lane,ke?ke.band:se,Ce.has(nt.target)?Je.x+Je.width/2:Ge,Number.NaN),it=n.createShape(ie,Ve,_e);Ce.has(nt.target)&&ot.set(nt.target,Ge-(it.x+it.width/2)),n.connect(Ut,it,{type:"bpmn:SequenceFlow",businessObject:Ne(nt)})}else s.append(Ut,ie,{connection:{type:"bpmn:SequenceFlow",businessObject:Ne(nt)}})}else if(en)n.connect(Ut,en,{type:"bpmn:SequenceFlow",businessObject:Ne(nt)});else continue;Pe.add(nt.id),Qe=!0}if(!Qe)break}const ue=R.nodes.filter(Oe=>!l(Oe.node.id));if(!ue.length)break;const we=ue[0];{const Oe=Ze(we.node,we.band),Qe=Q(we.node),pt=re(we);n.createShape(Oe,fe(Qe,Oe,we.node.lane,pt,F,H),Qe),!we.node.lane&&pt===void 0&&(H+=160)}}}const $t=40,At=(b,R=()=>!0)=>{const T=l(b);if(!T)return[];const F=[T],H=new Set([b]);for(let B=0;B<F.length;B++){const W=F[B].id;for(const z of m){const G=z.flow.target;if(z.flow.source!==W||H.has(G)||!C.has(G))continue;H.add(G);const Q=l(G);Q&&R(Q)&&F.push(Q)}}return F},yn=(b,R=()=>!0)=>{const T=l(b);if(!T)return[];const F=[T],H=new Set([b]);for(let B=0;B<F.length;B++){const W=F[B].id;for(const z of m){const G=z.flow.source;if(z.flow.target!==W||H.has(G)||!C.has(G))continue;H.add(G);const Q=l(G);Q&&R(Q)&&F.push(Q)}}return F},st=30,Rt=b=>!("waypoints"in b&&b.waypoints)&&b.type!=="bpmn:Lane"&&b.type!=="label"&&typeof b.x=="number",Jt=(b,R)=>{const T=new Set(b.flatMap(W=>W.subtree.map(z=>z.id)));for(const W of b){const z=(W.pool.children??[]).filter(Rt).filter(Q=>!T.has(Q.id));if(W.subtree.some(Q=>z.some(fe=>Q.x+R<fe.x+fe.width+st&&Q.x+R+Q.width+st>fe.x&&Q.y<fe.y+fe.height&&Q.y+Q.height>fe.y)))return null}const F=b.map(W=>W.pool.width),H=o.filter(W=>W.type==="label").map(W=>({label:W,x:W.x,y:W.y}));n.moveElements(b.flatMap(W=>W.subtree),{x:R,y:0});const B=b.map(W=>{const G=Math.max(...W.subtree.map(Q=>Q.x+Q.width))+150-(W.pool.x+W.pool.width);return G>0&&n.resizeShape(W.pool,{x:W.pool.x,y:W.pool.y,width:W.pool.width+G,height:W.pool.height}),G});return()=>{n.moveElements(b.flatMap(W=>W.subtree),{x:-R,y:0}),b.forEach((W,z)=>{B[z]>0&&n.resizeShape(W.pool,{x:W.pool.x,y:W.pool.y,width:F[z],height:W.pool.height})});for(let W=0;W<3;W++){let z=0;for(const G of H){const Q=G.x-G.label.x,fe=G.y-G.label.y;Math.abs(Q)<=.5&&Math.abs(fe)<=.5||(n.moveElements([G.label],{x:Q,y:fe}),z++)}if(!z)break}}},Kr=()=>{const b=yt(o),R=T=>T.length>=2&&(T.every(F=>Math.abs(F.x-T[0].x)<.01)||T.every(F=>Math.abs(F.y-T[0].y)<.01));return{messages:b.edges.filter(T=>T.type==="bpmn:MessageFlow"&&T.waypoints.length===2).length,lines:b.edges.filter(T=>R(T.waypoints)).length}},Qn=b=>{const R=H=>{const B=[H],W=new Set([H.id]);for(let z=0;z<B.length;z++)for(const G of B[z].outgoing??[]){if(G.type!=="bpmn:SequenceFlow")continue;const Q=G.target;!Q||W.has(Q.id)||b.has(Q.id)||!Rt(Q)||Q.x<H.x||(W.add(Q.id),B.push(Q))}return B},T=new Set(b),F=[];for(const H of o.getAll()){if(H.type!=="bpmn:MessageFlow")continue;const B=H;if(!B.waypoints||B.waypoints.length!==2)continue;const W=B.source,z=B.target;if(!W||!z)continue;const G=b.has(W.id);if(G===b.has(z.id))continue;const Q=G?z:W,fe=f(Q);if(!fe||T.has(Q.id))continue;const xe=R(Q).filter(ne=>!T.has(ne.id));if(xe.length){for(const ne of xe)T.add(ne.id);F.push({subtree:xe,pool:fe})}}return F};for(const b of Xt(e,"sequenceFlow.update")){if(b.target===void 0)continue;const R=C.get(b.target);if(!R)continue;const T=l(b.target),F=l(b.id);if(!T||!F)continue;const H=b.source!==void 0?l(b.source):F.source,B=F.target;if(!H||!B||B.id===T.id)continue;const W=At(b.target),z=new Set(W.map(ce=>ce.id)),G=Math.min(...W.map(ce=>ce.x)),Q=Math.max(...W.map(ce=>ce.x+ce.width)),fe=H.x+H.width,xe=Q-G+$t*2-(B.x-fe);if(xe>0){const ce=f(T),be=(ce==null?void 0:ce.children)??[],ot=ue=>ue.type==="bpmn:Lane",Pe=be.filter(ue=>!("waypoints"in ue&&ue.waypoints)&&!ot(ue)&&!z.has(ue.id)&&ue.x>=B.x),$e=ce?[ce,...be.filter(ue=>ot(ue))]:[];if(Pe.length){const ue=Qn(new Set(Pe.map(we=>we.id)));n.createSpace(Pe,$e,{x:xe,y:0},"e",B.x-1);for(const we of ue){const Oe=Kr(),Qe=Jt([we],xe);if(!Qe)continue;const pt=Kr();(pt.messages<=Oe.messages||pt.lines<Oe.lines)&&Qe()}}}const ne=R.node.lane||R.band!==void 0?T.y+T.height/2:H.y+H.height/2;n.moveElements(W,{x:fe+$t-G,y:ne-(T.y+T.height/2)});const Ce=f(T);if(R.node.lane===void 0&&R.band!==void 0&&Ce){const ce=Ce.y+$+wt(`pool:${R.node.participant??""}`,R.band)*k,be=ce-(T.y+T.height/2);be!==0&&!Y(Ce,T,T.x+T.width/2,ce,z)&&n.moveElements([T],{x:0,y:be})}}const ri=(b,R)=>{const T=R.target===b,F=p(R.source),H=p(R.target),B=T?"bpmn:DataOutputAssociation":"bpmn:DataInputAssociation";n.connect(F,H,R.id?{type:B,businessObject:i.create(B,{id:R.id})}:{type:B})},Jn=100,jt=b=>{for(const R of g){if(!R.participant.blackBox)continue;const T=l(R.participant.id);if(!T)continue;const F=[];for(const B of S){const W=B.flow.source===R.participant.id?B.flow.target:B.flow.target===R.participant.id?B.flow.source:void 0,z=W?l(W):void 0;z&&typeof z.x=="number"&&z.type!=="bpmn:Participant"&&F.push(z)}if(!F.length)continue;const H=Math.max(...F.map(B=>B.x+B.width/2))+Jn;if(H>T.x+T.width&&n.resizeShape(T,{x:T.x,y:T.y,width:H-T.x,height:T.height}),!!b)for(const B of S){const W=l(B.flow.id),z=B.flow.source===R.participant.id?B.flow.target:B.flow.target===R.participant.id?B.flow.source:void 0,G=z?l(z):void 0;if(!W||!G||G.type==="bpmn:Participant")continue;const Q=G.x+G.width/2;if(Q<T.x+10||Q>T.x+T.width-10)continue;const fe=T.y>G.y,xe=fe?G.y+G.height:G.y,ne=fe?T.y:T.y+T.height,Ce=B.flow.source===R.participant.id?[{x:Q,y:ne},{x:Q,y:xe}]:[{x:Q,y:xe},{x:Q,y:ne}],ce=yt(o),be={...ce.edges.find(ot=>ot.id===B.flow.id),waypoints:Ce};jn(be,ci(ce)).length||n.updateWaypoints(W,Ce)}}};jt(!1);for(const b of S){const R=b.flow;n.connect(p(R.source),p(R.target),{type:"bpmn:MessageFlow",businessObject:i.create("bpmn:MessageFlow",{id:R.id,name:R.name})})}{const T=new Set([...m.map(G=>G.flow.id),...S.map(G=>G.flow.id)].filter(G=>!!G)),F=o.filter(G=>!!G.waypoints),H=(G,Q)=>Math.abs(Q.x-G.x)<2?"L":Math.abs(Q.x-(G.x+G.width))<2?"R":Math.abs(Q.y-G.y)<2?"T":Math.abs(Q.y-(G.y+G.height))<2?"B":void 0,B=new Map,W=(G,Q,fe)=>{if(!G||!Q||typeof G.x!="number")return;const xe=H(G,Q);if(!xe)return;let ne=B.get(G.id);ne||B.set(G.id,ne=new Map),ne.set(xe,[...ne.get(xe)??[],fe])};for(const G of F){const Q=G.waypoints;!Q||Q.length<2||(W(G.source,Q[0],{id:G.id,dir:"out"}),W(G.target,Q[Q.length-1],{id:G.id,dir:"in"}))}const z=new Set;for(const[G,Q]of B){const fe=l(G);if(!fe||typeof fe.x!="number"||![...Q.values()].some($e=>{const ue=$e.filter(we=>we.dir==="in");return $e.length>=3&&ue.length>=1&&$e.some(we=>we.dir==="out")&&ue.some(we=>T.has(we.id))}))continue;const ne=f(fe);if(!ne||z.has(ne.id)||(ne.children??[]).some($e=>$e.type==="bpmn:Lane"))continue;const Ce=(Vx=Q.get("T"))!=null&&Vx.length?(Wx=Q.get("B"))!=null&&Wx.length?void 0:"B":"T";if(!Ce||(Ce==="T"?fe.y-ne.y:ne.y+ne.height-(fe.y+fe.height))>=k)continue;const be=(ne.children??[]).filter($e=>!("waypoints"in $e&&$e.waypoints)&&$e.type!=="label"&&typeof $e.x=="number"),ot=ne.y+ne.height;n.resizeShape(ne,{x:ne.x,y:ne.y,width:ne.width,height:ne.height+k});const Pe=u().children.filter($e=>!("waypoints"in $e&&$e.waypoints)&&$e.id!==ne.id&&typeof $e.y=="number"&&$e.y>=ot);Pe.length&&n.moveElements(Pe,{x:0,y:k}),Ce==="T"&&be.length&&n.moveElements(be,{x:0,y:k}),z.add(ne.id)}}const qi=20,Xa=4,Nn=2,tt=[10,30,80],et=()=>{const b=yt(o);return{bad:Ti(b).filter(R=>R.kind==="edge-crosses-shape"||R.kind==="edge-overlap-opposite"||R.kind==="edge-overlap-mixed").length,crossings:Nd(b),straight:b.edges.filter(R=>R.type==="bpmn:MessageFlow"&&R.waypoints.length===2).length}},Go=b=>{const R=yt(o),T=R.edges.find(F=>F.id===b);return T?jn(T,ci(R)).length:0},Su=b=>Go(b)>0,Ru=b=>yt(o).edges.filter(R=>R.type==="bpmn:MessageFlow"&&R.id!==b&&R.waypoints.length===2).length,DD=(b,R,T)=>Jt([{subtree:b,pool:R}],T),Tx=(b,R)=>R.bad>b.bad||R.crossings>b.crossings&&R.straight<=b.straight&&R.bad>=b.bad,Cu=(b,R)=>Tx(b,R)||R.straight<b.straight,Pu=(b,R,T=()=>!0,F=Tx)=>{const H=et(),B=Jt(b,R);if(!B)return!1;const W=et();return F(H,W)||!T()?(B(),!1):!0},Mx=(b,R,T,F=()=>!0)=>Pu([{subtree:b,pool:R}],T,F),Xr=b=>{var R;return!!((R=C.get(b))!=null&&R.node.participant)},Za=new Map;for(const b of S){if(!Xr(b.flow.target))continue;const R=Za.get(b.flow.target)??[];R.push(b),Za.set(b.flow.target,R)}const qf=[...Za.keys()],kx=new Set(m.map(b=>b.flow.target)),Ox=b=>v.findIndex(({op:R})=>R.participant.id===b);qf.sort((b,R)=>{var H,B;const T=kx.has(b)?1:0,F=kx.has(R)?1:0;return T!==F?T-F:Ox((H=C.get(b))==null?void 0:H.node.participant)-Ox((B=C.get(R))==null?void 0:B.node.participant)});const Zr=b=>b.x+b.width/2,LD=b=>{const R=new Map;for(const H of o.getAll()){const B=H;if(!B.waypoints||!B.source||!B.target)continue;(R.get(B.source.id)??R.set(B.source.id,[]).get(B.source.id)).push(B.target.id)}const T=new Set([b]),F=[b];for(let H=0;H<F.length;H++)for(const B of R.get(F[H])??[])T.has(B)||(T.add(B),F.push(B));return T},ID=(b,R)=>{const T=LD(R);let F;for(const H of o.getAll()){const B=H;if(B.type!=="bpmn:MessageFlow"||!B.source||!B.target||B.target.id!==b||T.has(B.source.id))continue;const W=B.source;if(typeof W.x!="number"||W.type==="bpmn:Participant")continue;const z=Zr(W);(F===void 0||z>F)&&(F=z)}return F},Yf=(b,R)=>{const T=l(b.flow.source);if(T)return T.type==="bpmn:Participant"?ID(T.id,R):Zr(T)},Dx=b=>{let R;for(const T of Za.get(b)??[]){const F=Yf(T,b);F!==void 0&&(!R||F>R.cx)&&(R={op:T,cx:F})}return R==null?void 0:R.op},BD=b=>{const R=Dx(b),T=l(b),F=R?Yf(R,b):void 0;return T&&F!==void 0?F-Zr(T):void 0},ND=b=>{const R=BD(b);return R!==void 0&&Math.abs(R)<qi},Lx=(b,R,T,F,H)=>{var B;for(let W=!0;W;){W=!1;for(const z of S){if(z.flow.id===T)continue;const G=R.has(z.flow.source),Q=R.has(z.flow.target);if(G===Q||F(G?z.flow.source:z.flow.target))continue;const fe=G?z.flow.target:z.flow.source;if(H(fe)||!Xr(fe))continue;const xe=l(z.flow.id);if(!(xe!=null&&xe.waypoints)||xe.waypoints.length!==2)continue;const ne=l(fe),Ce=(B=C.get(fe))==null?void 0:B.node.participant;if(!ne||!Ce)continue;const ce=At(fe,be=>be.x>=ne.x).filter(be=>!R.has(be.id));if(!(!ce.length||ce.some(be=>H(be.id)))){for(const be of ce)R.add(be.id);b.set(Ce,[...b.get(Ce)??[],...ce]),W=!0}}}return[...b].map(([W,z])=>({subtree:z,pool:p(W)}))},Ix=(b,R,T,F,H)=>Lx(new Map([[R,[...b]]]),new Set(b.map(B=>B.id)),F,B=>B===T,B=>B===H),Kf=b=>{const R=Dx(b);if(!R)return null;const T=l(b),F=l(R.flow.source),H=Yf(R,b);if(!T||!F||H===void 0)return null;const B=H-Zr(T);if(B>=qi){const W=C.get(b).node.participant,z=At(b,G=>G.x>=T.x);return{groups:Ix(z,W,b,R.flow.id,R.flow.source),dx:B}}if(-B>=qi&&Xr(R.flow.source)){const W=C.get(R.flow.source).node.participant,z=At(R.flow.source,G=>G.x>=F.x&&!ND(G.id));return{groups:Ix(z,W,R.flow.source,R.flow.id,b),dx:-B}}return null},Bx=()=>qf.map(b=>({id:b,plan:Kf(b)})).filter(b=>!!b.plan).sort((b,R)=>Math.min(...b.plan.groups.flatMap(T=>T.subtree.map(F=>F.x)))-Math.min(...R.plan.groups.flatMap(T=>T.subtree.map(F=>F.x)))).map(b=>b.id);for(let b=0;b<3;b++){const R=et(),T=[];for(const H of Bx()){const B=Kf(H);if(!B)continue;const W=Jt(B.groups,B.dx);W&&T.push(W)}if(!T.length)break;if(!Cu(R,et()))continue;for(const H of T.reverse())H();let F=!1;for(const H of Bx()){const B=Kf(H);B&&Pu(B.groups,B.dx,()=>!0,Cu)&&(F=!0)}if(!F)break}for(const b of qf.flatMap(R=>Za.get(R)??[])){if(!Su(b.flow.id))continue;const R=l(b.flow.target);if(!R)continue;const T=p(C.get(b.flow.target).node.participant),F=At(b.flow.target,z=>z.x>=R.x),H=R.width+O,B=Go(b.flow.id),W=Ru(b.flow.id);for(let z=1;z<=Xa;z++){const G=()=>Go(b.flow.id)<B&&Ru(b.flow.id)>=W;if(Mx(F,T,H*z,G))break}}for(const b of S){if(!Su(b.flow.id))continue;const R=l(b.flow.source),T=l(b.flow.target);if(!R||!T||R.type==="bpmn:Participant"||T.type==="bpmn:Participant")continue;const F=R.x+R.width/2;if(Math.abs(F-(T.x+T.width/2))>15)continue;const[H,B]=R.y<T.y?[R.y+R.height,T.y]:[T.y+T.height,R.y],W=[...C.values()].map(z=>l(z.node.id)).filter(z=>!!z&&z.id!==R.id&&z.id!==T.id).filter(z=>z.x<=F&&F<=z.x+z.width&&z.y+z.height>H&&z.y<B).sort((z,G)=>z.x-G.x);for(const z of W){const G=(Ux=C.get(z.id))==null?void 0:Ux.node.participant,Q=G?l(G):void 0;if(!Q)continue;const fe=[...C.values()].filter(ue=>ue.node.participant===G).map(ue=>ue.node.id),xe=ue=>ue.map(we=>l(we)).filter(we=>!!we),Ce=[yn(z.id,ue=>{var we;return((we=C.get(ue.id))==null?void 0:we.node.participant)===G}),xe(fe)].filter(ue=>ue.length),ce=z.width+O,be=Go(b.flow.id),ot=Ru(b.flow.id),Pe=()=>Go(b.flow.id)<be&&Ru(b.flow.id)>=ot;let $e=!1;for(const ue of Ce){for(let we=1;we<=Xa;we++)if(Mx(ue,Q,ce*we,Pe)){$e=!0;break}if($e)break}if(!Su(b.flow.id))break}}for(const b of S){if(!Su(b.flow.id))continue;const R=l(b.flow.id);if(((qx=R==null?void 0:R.waypoints)==null?void 0:qx.length)!==2)continue;const T=l(b.flow.source),F=l(b.flow.target);if(!T||!F||T.type==="bpmn:Participant"||F.type==="bpmn:Participant"||!Xr(b.flow.source)||!Xr(b.flow.target)||Math.abs(Zr(T)-Zr(F))>Nn)continue;const H=Zr(T),B=R.waypoints.map(be=>be.y),[W,z]=[Math.min(...B),Math.max(...B)],G=ci(yt(o)).filter(be=>be.id!==T.id&&be.id!==F.id&&be.x<H&&H<be.x+be.width&&W<be.y+be.height&&be.y<z);if(!G.length)continue;const Q=(Yx=C.get(b.flow.source))==null?void 0:Yx.node.participant,fe=(Kx=C.get(b.flow.target))==null?void 0:Kx.node.participant;if(!Q||!fe)continue;const xe=new Map;for(const[be,ot,Pe]of[[b.flow.source,T,Q],[b.flow.target,F,fe]]){const $e=xe.get(Pe)??[],ue=At(be,we=>we.x>=ot.x).filter(we=>!$e.some(Oe=>Oe.id===we.id));xe.set(Pe,[...$e,...ue])}const ne=new Set([...xe.values()].flat().map(be=>be.id)),Ce=Lx(xe,ne,b.flow.id,be=>be===b.flow.source||be===b.flow.target,()=>!1),ce=Math.max(...G.map(be=>be.x+be.width));for(const be of tt){const ot=ce+be-H;if(ot<=0)continue;if(Pu(Ce,ot,()=>{var $e,ue;return Go(b.flow.id)===0&&((ue=($e=l(b.flow.id))==null?void 0:$e.waypoints)==null?void 0:ue.length)===2},Cu))break}}{const b=T=>T.y+T.height/2,R=[];for(const T of C.keys()){if(!Xr(T))continue;const F=m.filter(W=>W.flow.target===T);if(F.length!==1)continue;const H=l(F[0].flow.source),B=l(T);!H||!B||!C.has(H.id)||Math.abs(b(H)-b(B))>1||B.x-(H.x+H.width)<=O+1||R.push({id:T,pred:H,node:B})}R.sort((T,F)=>T.node.x-F.node.x);for(const{id:T}of R){const F=C.get(T),H=l(T),B=l(m.find(ne=>ne.flow.target===T).flow.source);if(!H||!B)continue;const W=H.x-(B.x+B.width);if(W<=O+1)continue;const z=p(F.node.participant),G=At(T,ne=>ne.x>=H.x),Q=et(),fe=DD(G,z,-(W-O));if(!fe)continue;const xe=et();(xe.bad>Q.bad||xe.crossings>=Q.crossings||xe.straight<Q.straight)&&fe()}}jt(!0);for(const b of y){const R=b.associations??[],T=R.map(B=>B.source===b.dataStore.id?B.target:B.source).map(l).find(Boolean),F=T?f(T)??u():u(),H=T?{x:T.x+T.width/2,y:T.y+T.height+110}:{x:200,y:N+60};n.createShape({type:"bpmn:DataStoreReference",businessObject:i.create("bpmn:DataStoreReference",{id:b.dataStore.id,name:b.dataStore.name})},H,F);for(const B of R)ri(b.dataStore.id,B)}for(const b of x){const T=p(b.association.target).type==="bpmn:DataStoreReference"?b.association.target:b.association.source;ri(T,b.association)}let Nx=0;const Qr=10,$x=40,$D=(b,R)=>{const T=R.map(G=>f(G)).filter(G=>!!G);for(const G of T){const Q=Qr,fe=G.y,xe=G.y+G.height,ne=G.x,Ce=G.x+G.width;if(Math.abs(b.y-fe)<Q){const ce=fe+Q-b.y;b.y+=ce,b.height-=ce}if(Math.abs(b.y+b.height-xe)<Q&&(b.height=xe-Q-b.y),Math.abs(b.x-ne)<Q){const ce=ne+Q-b.x;b.x+=ce,b.width-=ce}Math.abs(b.x+b.width-Ce)<Q&&(b.width=Ce-Q-b.x)}if(!T.length)return;const F=Math.min(...T.map(G=>G.y)),H=Math.max(...T.map(G=>G.y+G.height)),B=F-b.y,W=b.y+b.height-H,z=$x-Qr;if(B>0!=W>0)if(B>0&&B<z){const G=B+Qr;b.y+=G,b.height-=G}else W>0&&W<z&&(b.height-=W+Qr)},jD=(b,R)=>{const T=Qr,F=30,H=o.filter(B=>B.type==="bpmn:Group"&&B.id!==R);for(const B of H){const W=B.x,z=B.x+B.width,G=B.y,Q=B.y+B.height,fe=b.y<Q&&G<b.y+b.height,xe=b.x<z&&W<b.x+b.width;if(fe){if(Math.abs(b.x-z)<T){const ne=Math.min(z+T-b.x,F);ne>0&&b.width-ne>0&&(b.x+=ne,b.width-=ne)}if(Math.abs(b.x+b.width-W)<T){const ne=Math.min(b.x+b.width-(W-T),F);ne>0&&b.width-ne>0&&(b.width-=ne)}}if(xe){if(Math.abs(b.y-Q)<T){const ne=Math.min(Q+T-b.y,F);ne>0&&b.height-ne>0&&(b.y+=ne,b.height-=ne)}if(Math.abs(b.y+b.height-G)<T){const ne=Math.min(b.y+b.height-(G-T),F);ne>0&&b.height-ne>0&&(b.height-=ne)}}}},Xf=(b,R)=>{const T=$x,F=Math.min(...b.map(G=>G.x))-T,H=Math.min(...b.map(G=>G.y))-T,B=Math.max(...b.map(G=>G.x+G.width))+T,W=Math.max(...b.map(G=>G.y+G.height))+T,z={x:F,y:H,width:B-F,height:W-H};return $D(z,b),jD(z,R),z};for(const b of P){const R=(b.group.members??[]).map(l).filter(H=>!!H);let T;R.length?T=Xf(R,b.group.id):(T={x:300+Nx*350,y:40,width:300,height:200},Nx++);const F=n.createShape({type:"bpmn:Group",businessObject:i.create("bpmn:Group",{id:b.group.id}),width:T.width,height:T.height},{x:T.x+T.width/2,y:T.y+T.height/2},u());b.group.name&&n.updateLabel(F,b.group.name),(Xx=b.group.members)!=null&&Xx.length&&D(F,"bwl:Members",{refs:b.group.members.join(" ")})}{const b=o.filter(H=>!!H.waypoints),R=new Map,T=(H,B)=>{!H||!B||(R.has(H)||R.set(H,new Set),R.get(H).add(B))};for(const H of b){const B=(Zx=H.source)==null?void 0:Zx.id,W=(Qx=H.target)==null?void 0:Qx.id;T(B,W),((Jx=H.type)!=null&&Jx.includes("DataOutputAssociation")||(e0=H.type)!=null&&e0.includes("DataInputAssociation")||H.type==="bpmn:Association")&&T(W,B)}const F=o.filter(H=>H.type==="bpmn:Group");for(const H of F){const W=(((t0=H.businessObject.extensionElements)==null?void 0:t0.values)??[]).find(Pe=>Pe.$type==="bwl:Members"),z=((W==null?void 0:W.refs)??"").split(" ").filter(Boolean);if(!z.length)continue;const G=new Set(z),Q=[...z];for(;Q.length;){const Pe=Q.shift();for(const $e of R.get(Pe)??[])G.has($e)||(G.add($e),Q.push($e))}const fe=H.x,xe=H.x+H.width,ne=H.y,Ce=H.y+H.height,ce=Pe=>m.filter($e=>$e.flow.target===Pe).length,be=Pe=>{var ue;const $e=((ue=l(Pe))==null?void 0:ue.type)??"";if($e==="bpmn:StartEvent"&&ce(Pe)===0)return!1;if($e.endsWith("Gateway")){const we=m.filter(Oe=>Oe.flow.target===Pe).map(Oe=>Oe.flow.source);if(we.length&&we.every(Oe=>{var Qe;return((Qe=l(Oe))==null?void 0:Qe.type)==="bpmn:StartEvent"&&ce(Oe)===0}))return!1}return!0},ot=o.filter(Pe=>Rt(Pe)).filter(Pe=>Pe.type!=="bpmn:Group"&&Pe.type!=="bpmn:Participant"&&Pe.type!=="bpmn:TextAnnotation"&&!G.has(Pe.id)&&Xr(Pe.id)&&be(Pe.id)&&Pe.x<xe&&Pe.x+Pe.width>fe&&Pe.y<Ce&&Pe.y+Pe.height>ne);if(ot.length)for(const Pe of[-1,1]){const $e=ot.filter(X=>(X.x+X.width-fe<=xe-X.x?-1:1)===Pe);if(!$e.length)continue;const ue=[];for(const X of $e){const ie=ue.find(se=>se.some(_e=>X.y<_e.y+_e.height&&X.y+X.height>_e.y));ie?ie.push(X):ue.push([X])}const we=new Map;for(const X of ue){let ie=Pe<0?fe-Qr:xe+Qr;for(const se of[...X].sort((_e,Je)=>Pe<0?Je.x-_e.x:_e.x-Je.x)){const _e=Pe<0?Math.min(se.x,ie-se.width):Math.max(se.x,ie);ie=Pe<0?_e-st:_e+se.width+st,_e!==se.x&&Math.sign(_e-se.x)===Pe&&we.set(se.id,_e-se.x)}}const Oe=new Map,Qe=X=>Oe.get(X)===X||!Oe.get(X)?X:Qe(Oe.get(X));for(const X of $e)Oe.set(X.id,X.id);for(const X of S){const ie=we.has(X.flow.source)?X.flow.source:void 0,se=we.has(X.flow.target)?X.flow.target:void 0;if(!ie||!se)continue;const _e=l(X.flow.id);((n0=_e==null?void 0:_e.waypoints)==null?void 0:n0.length)===2&&Oe.set(Qe(ie),Qe(se))}const pt=new Map;for(const X of $e){if(!we.has(X.id))continue;const ie=Qe(X.id);pt.set(ie,[...pt.get(ie)??[],X])}const nt=[...pt.values()].sort((X,ie)=>Pe<0?Math.min(...X.map(se=>se.x))-Math.min(...ie.map(se=>se.x)):Math.max(...ie.map(se=>se.x))-Math.max(...X.map(se=>se.x))),Ut=[];let en=!0;for(const X of nt){const ie=X.map(Je=>we.get(Je.id)??0).reduce((Je,Ge)=>Math.abs(Ge)>Math.abs(Je)?Ge:Je,0),se=new Map;let _e=!0;for(const Je of X){const Ge=f(Je);if(!Ge){_e=!1;break}se.has(Ge.id)||se.set(Ge.id,{subtree:[],pool:Ge}),se.get(Ge.id).subtree.push(Je)}_e&&Pu([...se.values()],ie,()=>!0,Cu)?Ut.push({shapes:X,dx:ie}):en=!1}if(!en)for(const X of Ut.reverse())n.moveElements(X.shapes,{x:-X.dx,y:0})}}}{const b=new Set([...P.map(R=>R.group.id),...Xt(e,"group.update").map(R=>R.id)]);for(const R of o.filter(T=>T.type==="bpmn:Group")){if(b.has(R.id))continue;const F=(((i0=R.businessObject.extensionElements)==null?void 0:i0.values)??[]).find(z=>z.$type==="bwl:Members"),H=((F==null?void 0:F.refs)??"").split(" ").filter(Boolean).map(l).filter(z=>!!z);!H.length||!H.some(z=>{const G=d.get(z.id);return!G||G.x!==z.x||G.y!==z.y})||!H.some(z=>z.x<R.x||z.y<R.y||z.x+z.width>R.x+R.width||z.y+z.height>R.y+R.height)||n.resizeShape(R,Xf(H,R.id))}}{const R=new Map(uo(yt(o)).map(z=>[z.owner,z.rect])),T=o.filter(z=>!!z.waypoints),F=new Map,H=(z,G)=>{!z||!G||(F.has(z)||F.set(z,new Set),F.get(z).add(G))};for(const z of T){const G=(r0=z.source)==null?void 0:r0.id,Q=(o0=z.target)==null?void 0:o0.id;H(G,Q),((a0=z.type)!=null&&a0.includes("DataOutputAssociation")||(s0=z.type)!=null&&s0.includes("DataInputAssociation")||z.type==="bpmn:Association")&&H(Q,G)}const B=z=>m.filter(G=>G.flow.target===z).length,W=z=>{var Q;const G=((Q=l(z))==null?void 0:Q.type)??"";if(G==="bpmn:StartEvent"&&B(z)===0)return!1;if(G.endsWith("Gateway")){const fe=m.filter(xe=>xe.flow.target===z).map(xe=>xe.flow.source);if(fe.length&&fe.every(xe=>{var ne;return((ne=l(xe))==null?void 0:ne.type)==="bpmn:StartEvent"&&B(xe)===0}))return!1}return!0};for(const z of o.filter(G=>G.type==="bpmn:Group")){const Q=(((c0=z.businessObject.extensionElements)==null?void 0:c0.values)??[]).find(ie=>ie.$type==="bwl:Members"),fe=((Q==null?void 0:Q.refs)??"").split(" ").filter(Boolean);if(!fe.length)continue;const xe=fe.map(l).filter(ie=>!!ie);if(!xe.length||!(P.some(ie=>ie.group.id===z.id)||Xt(e,"group.update").some(ie=>ie.id===z.id)||xe.some(ie=>{const se=d.get(ie.id);return!se||se.x!==ie.x||se.y!==ie.y})))continue;const Ce=new Set(fe),ce=[...fe];for(;ce.length;){const ie=ce.shift();for(const se of F.get(ie)??[])Ce.has(se)||(Ce.add(se),ce.push(se))}const be=z.x,ot=z.x+z.width,Pe=z.y,$e=z.y+z.height,ue=ie=>{const se=R.get(ie.id),_e={x:ie.x,y:ie.y,width:ie.width,height:ie.height};return se?[_e,{x:se.x,y:se.y,width:se.width,height:se.height}]:[_e]},we=xe.flatMap(ue),Oe=Math.min(...we.map(ie=>ie.x)),Qe=Math.max(...we.map(ie=>ie.x+ie.width)),pt=Math.min(...we.map(ie=>ie.y)),nt=Math.max(...we.map(ie=>ie.y+ie.height)),Ut={L:Oe-be,R:ot-Qe,T:pt-Pe,B:$e-nt},en=o.filter(ie=>Rt(ie)).filter(ie=>ie.type!=="bpmn:Group"&&ie.type!=="bpmn:Participant"&&ie.type!=="bpmn:TextAnnotation"&&!Ce.has(ie.id)&&W(ie.id)&&ie.x<ot&&ie.x+ie.width>be&&ie.y<$e&&ie.y+ie.height>Pe);if(!en.length)continue;const X={L:0,R:0,T:0,B:0};for(const ie of en){const se=ue(ie),_e=Math.min(...se.map(Tt=>Tt.x)),Je=Math.max(...se.map(Tt=>Tt.x+Tt.width)),Ge=Math.min(...se.map(Tt=>Tt.y)),ke=Math.max(...se.map(Tt=>Tt.y+Tt.height)),Ve={L:Je-be,R:ot-_e,T:ke-Pe,B:$e-Ge},it=["L","R","T","B"].filter(Tt=>Ve[Tt]<=Ut[Tt]+.001);if(!it.length)continue;const qt=it.reduce((Tt,Ft)=>Ve[Ft]<Ve[Tt]?Ft:Tt,it[0]);X[qt]=Math.max(X[qt],Math.min(Ve[qt]+10,Ut[qt]))}!X.L&&!X.R&&!X.T&&!X.B||n.resizeShape(z,{x:z.x+X.L,y:z.y+X.T,width:z.width-X.L-X.R,height:z.height-X.T-X.B})}}const jx=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 T=b;return{x:T.x,y:T.y,width:T.width,height:T.height}};let Qa=0;const Fx=12,Hx=14,FD=15,HD=300,zD=b=>{const R=b.split(`
7
- `),T=Math.max(...R.map(B=>so(B,Fx))),F=Math.max(100,Math.min(HD,Math.ceil(T)+Hx)),H=R.reduce((B,W)=>B+Math.max(1,Math.ceil((so(W,Fx)+Hx)/F)),0);return{width:F,height:Math.max(30,H*FD+10)}};for(const b of E){const R=b.association,T=((u0=b.placement)==null?void 0:u0.anchor)??(R?R.source===b.annotation.id?R.target:R.source:void 0),F=T?l(T):void 0,H=F?jx(F):void 0,B=zD(b.annotation.text??"");let W;if(H&&b.placement){const[fe,xe]=bs[b.placement.side],ne=b.placement.offset??50;W={x:H.x+H.width/2+fe*(H.width/2+B.width/2+ne),y:H.y+H.height/2+xe*(H.height/2+B.height/2+ne)}}else H?(W={x:H.x+H.width/2+180+Qa%3*260,y:H.y-110-Qa%2*95},Qa++):(W={x:300+Qa*260,y:60},Qa++);const z=F?f(F)??u():u(),G=z;H&&typeof G.x=="number"&&typeof G.width=="number"&&G.type==="bpmn:Participant"&&(W=tl(o,H,B,G,b.placement?{placement:b.placement}:{from:W}));const Q=n.createShape({type:"bpmn:TextAnnotation",width:B.width,height:B.height,businessObject:i.create("bpmn:TextAnnotation",{id:b.annotation.id,text:b.annotation.text})},W,z);if(R){const fe=xe=>xe===b.annotation.id?Q:p(xe);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&&D(Q,"bwl:Placement",A(b.placement))}for(const b of Xt(e,"association.add")){const R=b.association;n.connect(p(R.source),p(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=p(b.id);if(b.type&&vs(b.type)!==R.type&&(R=c.replaceElement(R,{type:vs(b.type)})),b.name!==void 0&&n.updateProperties(R,{name:b.name??void 0}),b.lane||b.band!==void 0){b.band!==void 0&&n.updateProperties(R,{"bwl:band":b.band});const T=R.y+R.height/2,F=f(R),H=b.lane?p(b.lane):((F==null?void 0:F.children)??[]).find(W=>W.type==="bpmn:Lane"&&T>=W.y&&T<=W.y+W.height),B=H?H.y+(b.band===void 0?H.height/2:Math.min(H.height/2,oe)+wt(H.id,b.band)*k):b.band!==void 0&&F?F.y+$+wt(`pool:${F.id}`,b.band)*k:void 0;if(B!==void 0){const W=B-T;W!==0&&n.moveElements([R],{x:0,y:W})}}}for(const b of Xt(e,"sequenceFlow.update")){const R=p(b.id);if(b.source!==void 0||b.target!==void 0){const T=R,F=b.source!==void 0?p(b.source):T.source,H=b.target!==void 0?p(b.target):T.target,B=W=>({x:W.x+W.width/2,y:W.y+W.height/2});n.reconnect(T,F,H,[B(F),B(H)])}b.name!==void 0&&n.updateProperties(R,{name:b.name??void 0}),b.condition!==void 0&&n.updateProperties(R,{name:((l0=b.condition)==null?void 0:l0.label)??void 0})}for(const b of Xt(e,"messageFlow.update"))b.name!==void 0&&n.updateProperties(p(b.id),{name:b.name??void 0});for(const b of Xt(e,"dataStore.update"))b.name!==void 0&&n.updateProperties(p(b.id),{name:b.name??void 0});for(const b of Xt(e,"annotation.update")){const R=p(b.id);if(b.text!==void 0&&n.updateProperties(R,{text:b.text}),b.placement===null)D(R,"bwl:Placement",null);else if(b.placement){const T=p(b.placement.anchor),F=jx(T),H=f(T)??u(),B=typeof H.x=="number"&&typeof H.width=="number"&&H.type==="bpmn:Participant",[W,z]=bs[b.placement.side],G=b.placement.offset??50,Q={x:F.x+F.width/2+W*(F.width/2+R.width/2+G),y:F.y+F.height/2+z*(F.height/2+R.height/2+G)},fe=B?tl(o,F,{width:R.width,height:R.height},H,{placement:b.placement,selfId:b.id}):Q;n.moveElements([R],{x:fe.x-(R.x+R.width/2),y:fe.y-(R.y+R.height/2)}),D(R,"bwl:Placement",A(b.placement))}}for(const b of Xt(e,"group.update")){const R=p(b.id);if(b.name!==void 0&&n.updateLabel(R,b.name??""),b.members){const T=b.members.map(l).filter(F=>!!F);T.length&&n.resizeShape(R,Xf(T,b.id)),D(R,"bwl:Members",{refs:b.members.join(" ")})}}}function nl(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 UE(e,t,n){var l,p;const{elementRegistry:i}=e,r=e.modeling,o=f=>Ti(f).filter(d=>!t.has(Ri(d))),a=f=>{var d;return((d=i.get(f))==null?void 0:d.type)==="bpmn:TextAnnotation"},s=yt(i),c=o(s),u=[...new Set(c.flatMap(nl))].filter(f=>n.has(f)&&a(f));if(u.length)for(const f of u){const d=i.get(f);if(!d||typeof d.x!="number"||typeof d.width!="number")continue;let g=d.parent,h;for(;g;){if(g.type==="bpmn:Participant"){h=g;break}g=g.parent}if(!h){const ve=d.x+d.width/2,Ue=d.y+d.height/2;h=i.getAll().find(Y=>{if(Y.type!=="bpmn:Participant")return!1;const pe=Y;return typeof pe.x=="number"&&typeof pe.width=="number"&&ve>=pe.x&&ve<=pe.x+pe.width&&Ue>=pe.y&&Ue<=pe.y+pe.height})}if(!h||typeof h.x!="number"||typeof h.width!="number")continue;const S=(((l=d.businessObject.extensionElements)==null?void 0:l.values)??[]).find(ve=>ve.$type==="bwl:Placement"),y=[...d.incoming??[],...d.outgoing??[]].find(ve=>ve.type==="bpmn:Association"),x=(S!=null&&S.anchor?i.get(S.anchor):void 0)??(y?((p=y.source)==null?void 0:p.id)===f?y.target:y.source:void 0);if(!x)continue;const E=x.waypoints,P=E!=null&&E.length?{x:E[Math.floor((E.length-1)/2)].x,y:E[Math.floor((E.length-1)/2)].y,width:0,height:0}:{x:x.x,y:x.y,width:x.width,height:x.height},C={width:d.width,height:d.height},D={x:d.x+d.width/2,y:d.y+d.height/2},A=S==null?void 0:S.side,I=[];A&&A in bs&&I.push(tl(i,P,C,h,{placement:{side:A,offset:(S==null?void 0:S.offset)??null},selfId:f}));for(const[ve,Ue]of[[-1,0],[1,0],[0,-1],[0,1]])for(let Y=1;Y<=WE;Y++)I.push({x:D.x+ve*vh*Y,y:D.y+Ue*vh*Y});const k={...s,edges:s.edges.filter(ve=>ve.id!==(y==null?void 0:y.id))},O=o(k),$=O.filter(ve=>nl(ve).includes(f)).length;if(!$)continue;let oe;for(const ve of I){const Ue=ve.x-D.x,Y=ve.y-D.y;if(!Ue&&!Y||ve.x-C.width/2<h.x||ve.x+C.width/2>h.x+h.width||ve.y-C.height/2<h.y||ve.y+C.height/2>h.y+h.height)continue;const pe={...k,shapes:k.shapes.map(re=>re.id===f?{...re,x:re.x+Ue,y:re.y+Y}:re)},ge=o(pe),le=ge.filter(re=>nl(re).includes(f)).length;if(le>=$||ge.length>O.length)continue;const Ee=Math.abs(Ue)+Math.abs(Y);if((!oe||le<oe.mine||le===oe.mine&&(ge.length<oe.all||ge.length===oe.all&&Ee<oe.dist))&&(oe={x:ve.x,y:ve.y,mine:le,all:ge.length,dist:Ee}),oe.mine===0&&oe.all<O.length)break}oe&&r.moveElements([d],{x:oe.x-D.x,y:oe.y-D.y})}}function _h(e,t,n=bh){const i=yh(e),r=gh(t,Ud(i.elementRegistry)),o={edgeCrossings:{before:0,after:0,pairs:[],solidPairs:0,dashedPairs:0,mixedPairs:0,crossPoolMessages:0}};if(r.length)return{ok:!1,issues:r,findings:[],stats:o};const a=yt(i.elementRegistry),s=new Set(Ti(a).map(Ri)),c=new Set(a.edges.map(h=>h.id)),u=new Set(a.shapes.map(h=>h.id)),l=Qu(a).length,p=e.get("commandStack");try{td(p,()=>{n(t,i),th(i,c),Qd(i,s),sh(i,s,c),oh(i,c),$E(i,c),ph(i,s,c),lh(i,c),dh(i,u),UE(i,s,u)})}catch(h){return{ok:!1,issues:[{kind:"lower-failed",message:h instanceof Error?h.message:String(h)}],findings:[],stats:o}}const f=yt(i.elementRegistry),d=Ti(f).filter(h=>!s.has(Ri(h))),g=$d(f);return{ok:!0,issues:[],findings:d,stats:{edgeCrossings:{before:l,after:g.pairs.length,pairs:g.pairs,solidPairs:g.solidPairs,dashedPairs:g.dashedPairs,mixedPairs:g.mixedPairs,crossPoolMessages:g.crossPoolMessages}}}}function qE(e){const t=e.slice(e.indexOf(":")+1);return t.charAt(0).toLowerCase()+t.slice(1)}function YE(e,t){return typeof e.get=="function"?e.get(t):e[t]}function xh(e,t){const n=YE(e,t);return typeof n=="number"&&Number.isFinite(n)?n:void 0}function wh(e,t){var i;return(((i=e.extensionElements)==null?void 0:i.values)??[]).find(r=>(r==null?void 0:r.$type)===t)}function KE(e){return typeof e=="string"&&Tu.includes(e)}function ui(e){if(typeof e=="string")return e;const t=e==null?void 0:e.id;return typeof t=="string"?t:void 0}function Eh(e){const t=e.rootElements??[],n=t.find(Y=>Y.$type==="bpmn:Collaboration"),i=new Map(t.filter(Y=>Y.$type==="bpmn:Process").map(Y=>[Y.id,Y])),r=[],o=[],a=[],s=[],c=[],u=[],l={poolOrders:{},bands:{},placements:{}},p=[],f=[],d=[],g=[],h=[],m=[],S=new Set,y=new Set,x=Y=>{Y&&S.add(Y)},E=Y=>{S.add(Y),y.add(Y)},P=Y=>{const pe=wh(Y,"bwl:Placement");if(!pe)return;const ge=typeof pe.anchor=="string"?pe.anchor:void 0;if(!ge||!KE(pe.side))return;const le=typeof pe.offset=="number"?pe.offset:void 0;h.push({owner:Y.id,anchor:ge,side:pe.side,...le!==void 0?{offset:le}:{}})},C=Y=>{const pe=wh(Y,"bwl:Members"),ge=typeof(pe==null?void 0:pe.refs)=="string"?pe.refs.split(/\s+/).filter(Boolean):[];ge.length&&m.push({owner:Y.id,refs:ge})},D=Y=>{var pe;for(const ge of Y)switch(x(ge.id),ge.$type){case"bpmn:TextAnnotation":E(ge.id),s.push({id:ge.id,text:typeof ge.text=="string"?ge.text:""}),P(ge);break;case"bpmn:Association":d.push({id:ge.id,type:ge.$type,source:ui(ge.sourceRef),target:ui(ge.targetRef)});break;case"bpmn:Group":{E(ge.id);const le=(pe=ge.categoryValueRef)==null?void 0:pe.value;c.push({id:ge.id,...typeof le=="string"&&le?{name:le}:{}}),C(ge);break}default:u.push({id:ge.id,type:ge.$type,reason:"type-outside-mvp"})}},A=(Y,pe)=>{const ge=Y.flowElements??[],le=(Y.laneSets??[]).flatMap(re=>re.lanes??[]),Ee=new Map;for(const re of le){x(re.id);for(const q of re.flowNodeRef??[]){const U=ui(q);U&&Ee.set(U,re.id)}}for(const re of ge){if(x(re.id),re.$type==="bpmn:SequenceFlow"){p.push({id:re.id,source:ui(re.sourceRef),target:ui(re.targetRef),...typeof re.name=="string"&&re.name?{name:re.name}:{}});continue}if(re.$type==="bpmn:DataStoreReference"){E(re.id),a.push({id:re.id,...re.name?{name:re.name}:{}});continue}const q=qE(re.$type);if(!Zf(q)){u.push({id:re.id,type:re.$type,reason:"type-outside-mvp"});continue}E(re.id),o.push({id:re.id,type:q,...re.name?{name:re.name}:{},...pe?{participant:pe}:{},...Ee.has(re.id)?{lane:Ee.get(re.id)}:{}});const U=xh(re,"bwl:band");U!==void 0&&(l.bands[re.id]=U);for(const Z of re.dataOutputAssociations??[])x(Z.id),g.push({id:Z.id,type:Z.$type,source:re.id,target:ui(Z.targetRef)});for(const Z of re.dataInputAssociations??[])x(Z.id),g.push({id:Z.id,type:Z.$type,source:ui((Z.sourceRef??[])[0]),target:re.id})}D(Y.artifacts??[])};if(n){const Y=new Set;for(const pe of n.participants??[]){E(pe.id);const ge=ui(pe.processRef);ge&&Y.add(ge);const le=ge?i.get(ge):void 0,Ee=((le==null?void 0:le.laneSets)??[]).flatMap(Z=>Z.lanes??[]),re=Ee.map(Z=>({id:Z.id,...Z.name?{name:Z.name}:{}}));for(const Z of re)E(Z.id);const q=!le||(le.flowElements??[]).length===0&&Ee.length===0&&(le.artifacts??[]).length===0;r.push({id:pe.id,...pe.name?{name:pe.name}:{},...q?{blackBox:!0}:{},...re.length?{lanes:re}:{}});const U=xh(pe,"bwl:poolOrder");U!==void 0&&(l.poolOrders[pe.id]=U),le&&A(le,pe.id)}for(const pe of n.messageFlows??[])x(pe.id),f.push({id:pe.id,source:ui(pe.sourceRef),target:ui(pe.targetRef),...typeof pe.name=="string"&&pe.name?{name:pe.name}:{}});D(n.artifacts??[]);for(const[pe,ge]of i)!Y.has(pe)&&(ge.flowElements??[]).length>0&&u.push({id:pe,type:ge.$type,reason:"unreachable-process"})}else for(const Y of i.values())A(Y);const I=[],k=[],O=[],$=[],oe=(Y,pe)=>!!Y&&!!pe&&y.has(Y)&&y.has(pe);for(const Y of p){if(!oe(Y.source,Y.target)){u.push({id:Y.id,type:"bpmn:SequenceFlow",reason:"endpoint-outside-mvp"});continue}I.push({id:Y.id,source:Y.source,target:Y.target,...Y.name?{name:Y.name}:{}}),y.add(Y.id)}for(const Y of f){if(!oe(Y.source,Y.target)){u.push({id:Y.id,type:"bpmn:MessageFlow",reason:"endpoint-outside-mvp"});continue}k.push({id:Y.id,source:Y.source,target:Y.target,...Y.name?{name:Y.name}:{}}),y.add(Y.id)}for(const Y of g){if(!oe(Y.source,Y.target)){u.push({id:Y.id??"",type:Y.type,reason:"endpoint-outside-mvp"});continue}$.push({...Y.id?{id:Y.id}:{},source:Y.source,target:Y.target}),Y.id&&y.add(Y.id)}for(const Y of d){if(!oe(Y.source,Y.target)){u.push({id:Y.id??"",type:Y.type,reason:"endpoint-outside-mvp"});continue}O.push({...Y.id?{id:Y.id}:{},source:Y.source,target:Y.target})}const ve=new Map(c.map(Y=>[Y.id,Y]));for(const{owner:Y,refs:pe}of m){const ge=pe.filter(Ee=>S.has(Ee)),le=ve.get(Y);le&&ge.length&&(le.members=ge)}for(const Y of h)S.has(Y.anchor)&&(l.placements[Y.owner]={anchor:Y.anchor,side:Y.side,...Y.offset!==void 0?{offset:Y.offset}:{}});return{definition:{...r.length?{participants:r}:{},nodes:o,sequenceFlows:I,...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 XE(e){const{definitions:t,warnings:n}=await Uu(e);return{...Eh(t),warnings:n}}function ZE(e,t,n,i={}){return{documentId:e,baseVersion:t,ops:[...n],origin:i.origin??"agent",clientOpId:(i.mkClientOpId??(()=>crypto.randomUUID()))()}}async function Sh(e,t,{currentVersion:n}){if(t.baseVersion!==n)return{status:"conflict",baseVersion:t.baseVersion,currentVersion:n};const i=_h(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 QE=Symbol("bpmn-editor");function JE(){const e=Mt.ref(!1),t=Mt.ref(!0),n=Mt.ref(!1);let i,r;const o=()=>{e.value=!0};function a(u,l){u.get("canvas").getContainer().style.pointerEvents=l?"":"none";const p=u.get("keyboard");l?(r&&p.bind(r),r=void 0):r||(r=p.getBinding(),p.unbind())}function s(){if(!i)throw new Error("modeler not attached — 뷰 @ready 후 attach() 필요");return i}function c(){return i==null?void 0:i.get("commandStack")}return{dirty:e,editable:t,agentBusy:n,attach(u){i&&this.detach(),i=u,i.get("eventBus").on("commandStack.changed",o),t.value||a(i,!1)},detach(){i==null||i.get("eventBus").off("commandStack.changed",o),i&&!t.value&&a(i,!0),r=void 0,i=void 0},setEditable(u){t.value=u,i&&a(i,u)},async applyAgentBatch(u,l){const p=s();n.value=!0;try{const f=await Sh(p,u,{currentVersion:l});return f.status==="applied"&&(e.value=!1),f}finally{n.value=!1}},async importXml(u){const{warnings:l}=await s().importXML(u);return e.value=!1,{warnings:qu(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 he(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}function e1(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var il={exports:{}},Rh;function t1(){if(Rh)return il.exports;Rh=1;var e=il.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},il.exports}var n1=t1(),i1=e1(n1);function li(e){if(!(this instanceof li))return new li(e);e=e||[128,36,1],this._seed=e.length?i1.rack(e[0],e[1],e[2]):e}li.prototype.next=function(e){return this._seed(e||!0)},li.prototype.nextPrefixed=function(e,t){var n;do n=e+this.next(!0);while(this.assigned(n));return this.claim(n,t),n},li.prototype.claim=function(e,t){this._seed.set(e,t||!0)},li.prototype.assigned=function(e){return this._seed.get(e)||!1},li.prototype.unclaim=function(e){delete this._seed.hats[e]},li.prototype.clear=function(){var e=this._seed.hats,t;for(t in e)this.unclaim(t)};const zt={legend:[1,"<fieldset>","</fieldset>"],tr:[2,"<table><tbody>","</tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],_default:[0,"",""]};zt.td=zt.th=[3,"<table><tbody><tr>","</tr></tbody></table>"],zt.option=zt.optgroup=[1,'<select multiple="multiple">',"</select>"],zt.thead=zt.tbody=zt.colgroup=zt.caption=zt.tfoot=[1,"<table>","</table>"],zt.polyline=zt.ellipse=zt.polygon=zt.circle=zt.text=zt.line=zt.path=zt.rect=zt.g=[1,'<svg xmlns="http://www.w3.org/2000/svg" version="1.1">',"</svg>"];function 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:p}=l;return p.remove(),p}let[r,o,a]=Object.hasOwn(zt,i)?zt[i]:zt._default,s=t.createElement("div");for(s.innerHTML=o+e+a;r--;)s=s.lastChild;if(s.firstChild===s.lastChild){const{firstChild:l}=s;return l.remove(),l}const c=t.createDocumentFragment();return c.append(...s.childNodes),c}function r1(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 L(t,function(i){i&&L(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 o1=Object.prototype.toString;function gt(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 o1.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 a1(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var xs={},Ch;function s1(){if(Ch)return xs;Ch=1;var e,t,n;function i(){e=window.addEventListener?"addEventListener":"attachEvent",t=window.removeEventListener?"removeEventListener":"detachEvent",n=e!=="addEventListener"?"on":""}return xs.bind=function(r,o,a,s){return e||i(),r[e](n+o,a,s||!1),a},xs.unbind=function(r,o,a,s){return t||i(),r[t](n+o,a,s||!1),a},xs}var Ph=s1(),c1=a1(Ph),Le=r1({__proto__:null,default:c1},[Ph]),Ah=["focus","blur"];function u1(e,t,n,i,r){return Ah.indexOf(n)!==-1&&(r=!0),Le.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 l1(e,t,n,i){return Ah.indexOf(t)!==-1&&(i=!0),Le.unbind(e,t,n,i)}var Rn={bind:u1,unbind:l1};function rl(e,t){return e&&typeof e.matches=="function"&&e.matches(t)||!1}function at(e,t){return t=t||document,t.querySelector(e)}function ws(e,t){return t=t||document,t.querySelectorAll(e)}function pi(e){e.parentNode&&e.parentNode.removeChild(e)}function p1(e,t){if(e.ownerDocument!==t.ownerDocument)try{return t.ownerDocument.importNode(e,!0)}catch{}return e}function f1(e,t){return t.appendChild(p1(e,t))}function Ie(e,t){return f1(t,e),e}var ol=2,Th={"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":ol,"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":ol,"text-anchor":1,"text-decoration":1,"text-rendering":1,"unicode-bidi":1,visibility:1,"word-spacing":1,"writing-mode":1};function d1(e,t){return Th[t]?e.style[t]:e.getAttributeNS(null,t)}function Mh(e,t,n){var i=t.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase(),r=Th[i];r?(r===ol&&typeof n=="number"&&(n=String(n)+"px"),e.style[i]=n):e.setAttributeNS(null,t,n)}function h1(e,t){var n=Object.keys(t),i,r;for(i=0,r;r=n[i];i++)Mh(e,r,t[r])}function me(e,t,n){if(typeof t=="string")if(n!==void 0)Mh(e,t,n);else return d1(e,t);else h1(e,t);return e}const m1=Object.prototype.toString;function Ye(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 m1.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 Es(e){for(var t;t=e.firstChild;)e.removeChild(t);return e}function kh(e){return e.cloneNode(!0)}var al={svg:"http://www.w3.org/2000/svg"},Oh='<svg xmlns="'+al.svg+'"';function g1(e){var t=!1;e.substring(0,4)==="<svg"?e.indexOf(al.svg)===-1&&(e=Oh+e.substring(4)):(e=Oh+">"+e+"</svg>",t=!0);var n=y1(e);if(!t)return n;for(var i=document.createDocumentFragment(),r=n.firstChild;r.firstChild;)i.appendChild(r.firstChild);return i}function y1(e){var t;return t=new DOMParser,t.async=!1,t.parseFromString(e,"text/xml")}function Se(e,t){var n;return e=e.trim(),e.charAt(0)==="<"?(n=g1(e).firstChild,n=document.importNode(n,!0)):n=document.createElementNS(al.svg,e),t&&me(n,t),n}var sl=null;function Dh(){return sl===null&&(sl=Se("svg")),sl}function Lh(e,t){var n,i,r=Object.keys(t);for(n=0;i=r[n];n++)e[i]=t[i];return e}function v1(e,t,n,i,r,o){var a=Dh().createSVGMatrix();switch(arguments.length){case 0:return a;case 1:return Lh(a,e);case 6:return Lh(a,{a:e,b:t,c:n,d:i,e:r,f:o})}}function Ko(e){return Dh().createSVGTransform()}var Ih=/([&<>]{1})/g,b1=/([&<>\n\r"]{1})/g,_1={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"'"};function cl(e,t){function n(i,r){return _1[r]||r}return e.replace(t,n)}function Bh(e,t){var n,i,r,o,a;switch(e.nodeType){case 3:t.push(cl(e.textContent,Ih));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,'="',cl(o.value,b1),'"');if(e.hasChildNodes()){for(t.push(">"),a=e.childNodes,n=0,i=a.length;n<i;++n)Bh(a.item(n),t);t.push("</",e.tagName,">")}else t.push("/>");break;case 8:t.push("<!--",cl(e.nodeValue,Ih),"-->");break;case 4:t.push("<![CDATA[",e.nodeValue,"]]>");break;default:throw new Error("unable to handle node "+e.nodeType)}return t}function x1(e){for(var t=e.firstChild,n=[];t;)Bh(t,n),t=t.nextSibling;return n.join("")}function Nh(e,t){return x1(e)}function Gt(e){var t=e.parentNode;return t&&t.removeChild(e),e}function w1(e,t){return t instanceof SVGMatrix?e.createSVGTransformFromMatrix(t):t}function E1(e,t){var n,i;for(e.clear(),n=0;i=t[n];n++)e.appendItem(w1(e,i))}function Xo(e,t){var n=e.transform.baseVal;return t&&(Array.isArray(t)||(t=[t]),E1(n,t)),n.consolidate()}const S1=/^class[ {]/;function R1(e){return S1.test(e.toString())}function ul(e){return Array.isArray(e)}function ll(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function Ss(...e){e.length===1&&ul(e[0])&&(e=e[0]),e=[...e];const t=e.pop();return t.$inject=e,t}const C1=/constructor\s*[^(]*\(\s*([^)]*)\)/m,P1=/^(?:async\s+)?(?:function\s*[^(]*)?(?:\(\s*([^)]*)\)|(\w+))/m,A1=/\/\*([^*]*)\*\//m;function T1(e){if(typeof e!="function")throw new Error(`Cannot annotate "${e}". Expected a function!`);const t=e.toString().match(R1(e)?C1:P1);if(!t)return[];const n=t[1]||t[2];return n&&n.split(",").map(i=>{const r=i.match(A1);return(r&&r[1]||i).trim()})||[]}function $h(e,t){const n=t||{get:function(x,E){if(i.push(x),E===!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 E=i.join(" -> ");return i.length=0,new Error(E?`${x} (Resolving: ${E})`:x)};function c(x,E){if(!r[x]&&x.includes(".")){const P=x.split(".");let C=c(P.shift());for(;P.length;)C=C[P.shift()];return C}if(ll(o,x))return o[x];if(ll(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,E)}function u(x,E){if(typeof E>"u"&&(E={}),typeof x!="function")if(ul(x))x=Ss(x.slice());else throw s(`Cannot invoke "${x}". Expected a function!`);const C=(x.$inject||T1(x)).map(D=>ll(E,D)?E[D]:c(D));return{fn:x,dependencies:C}}function l(x){const{fn:E,dependencies:P}=u(x),C=Function.prototype.bind.call(E,null,...P);return new C}function p(x,E,P){const{fn:C,dependencies:D}=u(x,P);return C.apply(E,D)}function f(x){return Ss(E=>x.get(E))}function d(x,E){if(E&&E.length){const P=Object.create(null),C=Object.create(null),D=[],A=[],I=[];let k,O,$,oe;for(let ve in r)k=r[ve],E.indexOf(ve)!==-1&&(k[2]==="private"?(O=D.indexOf(k[3]),O===-1?($=k[3].createChild([],E),oe=f($),D.push(k[3]),A.push($),I.push(oe),P[ve]=[oe,ve,"private",$]):P[ve]=[I[O],ve,"private",A[O]]):P[ve]=[k[2],k[1]],C[ve]=!0),(k[2]==="factory"||k[2]==="type")&&k[1].$scope&&E.forEach(Ue=>{k[1].$scope.indexOf(Ue)!==-1&&(P[ve]=[k[2],k[1]],C[Ue]=!0)});E.forEach(ve=>{if(!C[ve])throw new Error('No provider for "'+ve+'". Cannot use provider from the parent!')}),x.unshift(P)}return new $h(x,a)}const g={factory:p,type:l,value:function(x){return x}};function h(x,E){const P=x.__init__||[];return function(){P.forEach(C=>{typeof C=="string"?E.get(C):E.invoke(C)})}}function m(x){const E=x.__exports__;if(E){const P=x.__modules__,C=Object.keys(x).reduce((O,$)=>($!=="__exports__"&&$!=="__modules__"&&$!=="__init__"&&$!=="__depends__"&&(O[$]=x[$]),O),Object.create(null)),D=(P||[]).concat(C),A=d(D),I=Ss(function(O){return A.get(O)});E.forEach(function(O){r[O]=[I,O,"private",A]});const k=(x.__init__||[]).slice();return k.unshift(function(){A.init()}),x=Object.assign({},x,{__init__:k}),h(x,A)}return Object.keys(x).forEach(function(P){if(P==="__init__"||P==="__depends__")return;const C=x[P];if(C[2]==="private"){r[P]=C;return}const D=C[0],A=C[1];r[P]=[g[D],M1(D,A),D]}),h(x,a)}function S(x,E){return x.indexOf(E)!==-1||(x=(E.__depends__||[]).reduce(S,x),x.indexOf(E)!==-1)?x:x.concat(E)}function y(x){const E=x.reduce(S,[]).map(m);let P=!1;return function(){P||(P=!0,E.forEach(C=>C()))}}this.get=c,this.invoke=p,this.instantiate=l,this.createChild=d,this.init=y(e)}function M1(e,t){return e!=="value"&&ul(t)&&(t=Ss(t.slice())),t}var k1=1e3;function ki(e,t){var n=this;t=t||k1,e.on(["render.shape","render.connection"],t,function(i,r){var o=i.type,a=r.element,s=r.gfx,c=r.attrs;if(n.canRender(a))return o==="render.shape"?n.drawShape(s,a,c):n.drawConnection(s,a,c)}),e.on(["render.getShapePath","render.getConnectionPath"],t,function(i,r){if(n.canRender(r))return i.type==="render.getShapePath"?n.getShapePath(r):n.getConnectionPath(r)})}ki.prototype.canRender=function(e){},ki.prototype.drawShape=function(e,t){},ki.prototype.drawConnection=function(e,t){},ki.prototype.getShapePath=function(e){},ki.prototype.getConnectionPath=function(e){};function Dr(e){return e.flat().join(",").replace(/,?([A-Za-z]),?/g,"$1")}function O1(e){return["M",e.x,e.y]}function pl(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 L1(e,t){const n=e.length,i=[O1(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(pl(a));continue}const c=Math.min(t,fl(a.x-o.x,a.y-o.y),fl(s.x-a.x,s.y-a.y));if(!c){i.push(pl(a));continue}const u=Rs(a,o,c),l=Rs(a,o,c*.5),p=Rs(a,s,c),f=Rs(a,s,c*.5);i.push(pl(u)),i.push(D1(l,f,p))}return i}function Rs(e,t,n){const i=t.x-e.x,r=t.y-e.y,o=fl(i,r),a=n/o;return{x:e.x+i*a,y:e.y+r*a}}function fl(e,t){return Math.sqrt(Math.pow(e,2)+Math.pow(t,2))}function Zo(e,t,n){De(t)&&(n=t,t=null),t||(t={});const i=Se("path",t);return De(n)&&(i.dataset.cornerRadius=String(n)),dl(i,e)}function dl(e,t){const n=parseInt(e.dataset.cornerRadius,10)||0;return me(e,{d:Dr(L1(t,n))}),e}function Cs(e){var t=new Set(e);return ze(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,Ae(e)||(e=[e]),L(e,function(i,r){var o=t(i,r,n);Ae(o)&&o.length&&Lr(o,t,n+1)})}function hl(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 Qo(e,t){return hl(e)}function I1(e,t,n){Cr(t)&&(t=!0),Yt(t)&&(n=t,t=!0),n=n||{};var i=Jo(n.allShapes),r=Jo(n.allConnections),o=Jo(n.enclosedElements),a=Jo(n.enclosedConnections),s=Jo(n.topLevel,t&&no(e,function(l){return l.id}));function c(l){s[l.source.id]&&s[l.target.id]&&(s[l.id]=[l]),i[l.source.id]&&i[l.target.id]&&(a[l.id]=o[l.id]=l),r[l.id]=l}function u(l){if(o[l.id]=l,l.waypoints)a[l.id]=r[l.id]=l;else return i[l.id]=l,L(l.incoming,c),L(l.outgoing,c),l.children}return Lr(e,u),{allShapes:i,allConnections:r,topLevel:s,enclosedConnections:a,enclosedElements:o}}function Ot(e,t){t=!!t,Ae(e)||(e=[e]);var n,i,r,o;return L(e,function(a){var s=a;a.waypoints&&!t&&(s=Ot(a.waypoints,!0));var c=s.x,u=s.y,l=s.height||0,p=s.width||0;(c<n||n===void 0)&&(n=c),(u<i||i===void 0)&&(i=u),(c+p>r||r===void 0)&&(r=c+p),(u+l>o||o===void 0)&&(o=u+l)}),{x:n,y:i,height:o-i,width:r-n}}function lo(e,t){var n={};return L(e,function(i){var r=i;r.waypoints&&(r=Ot(r)),!De(t.y)&&r.x>t.x&&(n[i.id]=i),!De(t.x)&&r.y>t.y&&(n[i.id]=i),r.x>t.x&&r.y>t.y&&(De(t.width)&&De(t.height)&&r.width+r.x<t.width+t.x&&r.height+r.y<t.height+t.y||!De(t.width)||!De(t.height))&&(n[i.id]=i)}),n}function jh(e){return"waypoints"in e?"connection":"x"in e?"shape":"root"}function Fh(e){return!!(e&&e.isFrame)}function Jo(e,t){return j({},e||{},t||{})}var B1=1;function er(e,t){ki.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})}he(er,ki),er.prototype.canRender=function(){return!0},er.prototype.drawShape=function(t,n,i){var r=Se("rect");return me(r,{x:0,y:0,width:n.width||0,height:n.height||0}),Fh(n)?me(r,j({},this.FRAME_STYLE,i||{})):me(r,j({},this.SHAPE_STYLE,i||{})),Ie(t,r),r},er.prototype.drawConnection=function(t,n,i){var r=Zo(n.waypoints,j({},this.CONNECTION_STYLE,i||{}));return Ie(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 N1(){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){!Ae(n)&&!i&&(i=n,n=[]);var r=En(n,function(o,a){return j(o,e[a]||{})},{});return i?j(r,i):r},this.computeStyle=function(n,i,r){return Ae(i)||(r=i,i=[]),t.style(i||[],j({},r,n||{}))}}const $1={__init__:["defaultRenderer"],defaultRenderer:["type",er],styles:["type",N1]};function St(e,t){if(!e||!t)return-1;var n=e.indexOf(t);return n!==-1&&e.splice(n,1),n}function Ct(e,t,n){if(!(!e||!t)){typeof n!="number"&&(n=-1);var i=e.indexOf(t);if(i!==-1){if(i===n)return;if(n!==-1)e.splice(i,1);else return}n!==-1?e.splice(n,0,t):e.push(t)}}function ml(e,t){return!e||!t?-1:e.indexOf(t)}function ea(e,t){return!e||!t?-1:Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function gl(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=ea(e,t);return Math.abs(r/o)<=i}var j1=2;function Oi(e,t){var n=Array.from(arguments).flat();const i={x:"v",y:"h"};for(const[r,o]of Object.entries(i))if(F1(r,n))return o;return!1}function F1(e,t){const n=t[0];return Pr(t,function(i){return Math.abs(n[e]-i[e])<=j1})}function Hh(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 yl(e,t){return{x:Math.round(e.x+(t.x-e.x)/2),y:Math.round(e.y+(t.y-e.y)/2)}}var H1=/,?([a-z]),?/gi,zh=parseFloat,Dt=Math,tr=Dt.PI,fi=Dt.min,di=Dt.max,Gh=Dt.pow,nr=Dt.abs,z1=/([a-z])[\s,]*((-?\d*\.?\d*(?:e[-+]?\d+)?[\s]*,?[\s]*)+)/ig,G1=/(-?\d*\.?\d*(?:e[-+]?\d+)?)[\s]*,?[\s]*/ig,Vh=Array.isArray||function(e){return e instanceof Array};function V1(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function W1(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 U1(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 V1(r,i)?(W1(o,i),r[i]):(o.length>=1e3&&delete r[o.shift()],o.push(i),r[i]=e(...arguments),r[i])}return t}function q1(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(z1,function(i,r,o){var a=[],s=r.toLowerCase();for(o.replace(G1,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=bl,n}function Y1(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 K1(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 vl(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 bl(){return this.join(",").replace(H1,"$1")}function X1(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=bl,t}function Wh(e,t,n,i,r,o,a,s,c){var u=1-c,l=Gh(u,3),p=Gh(u,2),f=c*c,d=f*c,g=l*e+p*3*c*n+u*3*c*c*r+d*a,h=l*t+p*3*c*i+u*3*c*c*o+d*s;return{x:Ps(g),y:Ps(h)}}function Uh(e){var t=nS(...e);return vl(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 Z1(e,t){return e=vl(e),t=vl(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 qh(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 Yh(e,t,n,i,r,o,a,s,c){c==null&&(c=1),c=c>1?1:c<0?0:c;for(var u=c/2,l=12,p=[-.1252,.1252,-.3678,.3678,-.5873,.5873,-.7699,.7699,-.9041,.9041,-.9816,.9816],f=[.2491,.2491,.2335,.2335,.2032,.2032,.1601,.1601,.1069,.1069,.0472,.0472],d=0,g=0;g<l;g++){var h=u*p[g]+u,m=qh(h,e,n,r,a),S=qh(h,t,i,o,s),y=m*m+S*S;d+=f[g]*Dt.sqrt(y)}return u*d}function Q1(e,t,n,i,r,o,a,s){if(!(di(e,n)<fi(r,a)||fi(e,n)>di(r,a)||di(t,i)<fi(o,s)||fi(t,i)>di(o,s))){var c=(e*i-t*n)*(r-a)-(e-n)*(r*s-o*a),u=(e*i-t*n)*(o-s)-(t-i)*(r*s-o*a),l=(e-n)*(o-s)-(t-i)*(r-a);if(l){var p=Ps(c/l),f=Ps(u/l),d=+p.toFixed(2),g=+f.toFixed(2);if(!(d<+fi(e,n).toFixed(2)||d>+di(e,n).toFixed(2)||d<+fi(r,a).toFixed(2)||d>+di(r,a).toFixed(2)||g<+fi(t,i).toFixed(2)||g>+di(t,i).toFixed(2)||g<+fi(o,s).toFixed(2)||g>+di(o,s).toFixed(2)))return{x:p,y:f}}}}function Ps(e){return Math.round(e*1e11)/1e11}function J1(e,t,n){var i=Uh(e),r=Uh(t);if(!Z1(i,r))return[];var o=Yh(...e),a=Yh(...t),s=Xh(e)?1:~~(o/5)||1,c=Xh(t)?1:~~(a/5)||1,u=new Array(s+1),l=new Array(c+1),p={},f=[],d,g;for(d=0;d<s+1;d++){var h=Wh(...e,d/s);u[d]={x:h.x,y:h.y,t:d/s}}for(d=0;d<c+1;d++)h=Wh(...t,d/c),l[d]={x:h.x,y:h.y,t:d/c};for(d=0;d<s;d++)for(g=0;g<c;g++){var m=u[d],S=u[d+1],y=l[g],x=l[g+1],E=nr(S.x-m.x)<.01?"y":"x",P=nr(x.x-y.x)<.01?"y":"x",C=Q1(m.x,m.y,S.x,S.y,y.x,y.y,x.x,x.y),D;if(C){if(D=C.x.toFixed(9)+"#"+C.y.toFixed(9),p[D])continue;p[D]=!0;var A=m.t+nr((C[E]-m[E])/(S[E]-m[E]))*(S.t-m.t),I=y.t+nr((C[P]-y[P])/(x[P]-y[P]))*(x.t-y.t);A>=0&&A<=1&&I>=0&&I<=1&&f.push({x:C.x,y:C.y,t1:A,t2:I})}}return f}function Kh(e,t,n){e=Jh(e),t=Jh(t);for(var i,r,o,a,s,c,u,l,p,f,d=n?0:[],g=0,h=e.length;g<h;g++){var m=e[g];if(m[0]=="M")i=s=m[1],r=c=m[2];else{m[0]=="C"?(p=[i,r,...m.slice(1)],i=p[6],r=p[7]):(p=[i,r,i,r,s,c,s,c],i=s,r=c);for(var S=0,y=t.length;S<y;S++){var x=t[S];if(x[0]=="M")o=u=x[1],a=l=x[2];else{x[0]=="C"?(f=[o,a,...x.slice(1)],o=f[6],a=f[7]):(f=[o,a,o,a,u,l,u,l],o=u,a=l);var E=J1(p,f);{for(var P=0,C=E.length;P<C;P++)E[P].segment1=g,E[P].segment2=S,E[P].bez1=p,E[P].bez2=f;d=d.concat(E)}}}}}return d}function eS(e){return Vh(e)&&Vh(e[0])}function tS(e){if(Y1(e))return e;var t=new Array(e.length),n=0,i=0,r=0,o=0,a=0,s;e[0][0]=="M"&&(n=+e[0][1],i=+e[0][2],r=n,o=i,a++,t[0]=["M",n,i]);for(var c,u,l=a,p=e.length;l<p;l++){if(u=e[l],s=u[0],t[l]=c=new Array(u.length),s!=s.toUpperCase())switch(c[0]=s.toUpperCase(),c[0]){case"A":c[1]=u[1],c[2]=u[2],c[3]=u[3],c[4]=u[4],c[5]=u[5],c[6]=+u[6]+n,c[7]=+u[7]+i;break;case"V":c[1]=+u[1]+i;break;case"H":c[1]=+u[1]+n;break;case"M":r=+u[1]+n,o=+u[2]+i;default:for(var f=1,d=u.length;f<d;f++)c[f]=+u[f]+(f%2?n:i)}else for(var g=0,h=u.length;g<h;g++)c[g]=u[g];switch(s=s.toUpperCase(),c[0]){case"Z":n=+r,i=+o;break;case"H":n=c[1];break;case"V":i=c[1];break;case"M":r=c[c.length-2],o=c[c.length-1];default:n=c[c.length-2],i=c[c.length-1]}}return t.toString=bl,t}function Xh(e){return e[0]===e[2]&&e[1]===e[3]&&e[4]===e[6]&&e[5]===e[7]}function As(e,t,n,i){return[e,t,n,i,n,i]}function Zh(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 Qh(e,t,n,i,r,o,a,s,c,u){var l=tr*120/180,p=tr/180*(+r||0),f=[],d,g=U1(function(M,w,v){var N=M*Dt.cos(v)-w*Dt.sin(v),V=M*Dt.sin(v)+w*Dt.cos(v);return{x:N,y:V}});if(u)D=u[0],A=u[1],P=u[2],C=u[3];else{d=g(e,t,-p),e=d.x,t=d.y,d=g(s,c,-p),s=d.x,c=d.y;var h=(e-s)/2,m=(t-c)/2,S=h*h/(n*n)+m*m/(i*i);S>1&&(S=Dt.sqrt(S),n=S*n,i=S*i);var y=n*n,x=i*i,E=(o==a?-1:1)*Dt.sqrt(nr((y*x-y*m*m-x*h*h)/(y*m*m+x*h*h))),P=E*n*m/i+(e+s)/2,C=E*-i*h/n+(t+c)/2,D=Dt.asin(((t-C)/i).toFixed(9)),A=Dt.asin(((c-C)/i).toFixed(9));D=e<P?tr-D:D,A=s<P?tr-A:A,D<0&&(D=tr*2+D),A<0&&(A=tr*2+A),a&&D>A&&(D=D-tr*2),!a&&A>D&&(A=A-tr*2)}var I=A-D;if(nr(I)>l){var k=A,O=s,$=c;A=D+l*(a&&A>D?1:-1),s=P+n*Dt.cos(A),c=C+i*Dt.sin(A),f=Qh(s,c,n,i,r,0,a,O,$,[A,k,P,C])}I=A-D;var oe=Dt.cos(D),ve=Dt.sin(D),Ue=Dt.cos(A),Y=Dt.sin(A),pe=Dt.tan(I/4),ge=4/3*n*pe,le=4/3*i*pe,Ee=[e,t],re=[e+ge*ve,t-le*oe],q=[s+ge*Y,c-le*Ue],U=[s,c];if(re[0]=2*Ee[0]-re[0],re[1]=2*Ee[1]-re[1],u)return[re,q,U].concat(f);f=[re,q,U].concat(f).join().split(",");for(var Z=[],Fe=0,wt=f.length;Fe<wt;Fe++)Z[Fe]=Fe%2?g(f[Fe-1],f[Fe],p).y:g(f[Fe],f[Fe+1],p).x;return Z}function nS(e,t,n,i,r,o,a,s){for(var c=[],u=[[],[]],l,p,f,d,g,h,m,S,y=0;y<2;++y){if(y==0?(p=6*e-12*n+6*r,l=-3*e+9*n-9*r+3*a,f=3*n-3*e):(p=6*t-12*i+6*o,l=-3*t+9*i-9*o+3*s,f=3*i-3*t),nr(l)<1e-12){if(nr(p)<1e-12)continue;d=-f/p,0<d&&d<1&&c.push(d);continue}m=p*p-4*f*l,S=Dt.sqrt(m),!(m<0)&&(g=(-p+S)/(2*l),0<g&&g<1&&c.push(g),h=(-p-S)/(2*l),0<h&&h<1&&c.push(h))}for(var x=c.length,E=x,P;x--;)d=c[x],P=1-d,u[0][x]=P*P*P*e+3*P*P*d*n+3*P*d*d*r+d*d*d*a,u[1][x]=P*P*P*t+3*P*P*d*i+3*P*d*d*o+d*d*d*s;return u[0][E]=e,u[1][E]=t,u[0][E+1]=a,u[1][E+1]=s,u[0].length=u[1].length=E+2,{x0:fi(...u[0]),y0:fi(...u[1]),x1:di(...u[0]),y1:di(...u[1])}}function Jh(e){if(eS(e)||(e=q1(e)),K1(e))return e;for(var t=X1(tS(e)),n={x:0,y:0,bx:0,by:0,X:0,Y:0,qx:null,qy:null},i=function(f,d,g){var h,m;if(!f)return["C",d.x,d.y,d.x,d.y,d.x,d.y];switch(!(f[0]in{T:1,Q:1})&&(d.qx=d.qy=null),f[0]){case"M":d.X=f[1],d.Y=f[2];break;case"A":f=["C",...Qh(d.x,d.y,...f.slice(1))];break;case"S":g=="C"||g=="S"?(h=d.x*2-d.bx,m=d.y*2-d.by):(h=d.x,m=d.y),f=["C",h,m,...f.slice(1)];break;case"T":g=="Q"||g=="T"?(d.qx=d.x*2-d.qx,d.qy=d.y*2-d.qy):(d.qx=d.x,d.qy=d.y),f=["C",...Zh(d.x,d.y,d.qx,d.qy,f[1],f[2])];break;case"Q":d.qx=f[1],d.qy=f[2],f=["C",...Zh(d.x,d.y,f[1],f[2],f[3],f[4])];break;case"L":f=["C",...As(d.x,d.y,f[1],f[2])];break;case"H":f=["C",...As(d.x,d.y,f[1],d.y)];break;case"V":f=["C",...As(d.x,d.y,d.x,f[1])];break;case"Z":f=["C",...As(d.x,d.y,d.X,d.Y)];break}return f},r=function(f,d){if(f[d].length>7){f[d].shift();for(var g=f[d];g.length;)o[d]="A",f.splice(d++,0,["C",...g.splice(0,6)]);f.splice(d,1),u=t.length}},o=[],a="",s="",c=0,u=t.length;c<u;c++){t[c]&&(a=t[c][0]),a!="C"&&(o[c]=a,c&&(s=o[c-1])),t[c]=i(t[c],n,s),o[c]!="A"&&a=="C"&&(o[c]="C"),r(t,c);var l=t[c],p=l.length;n.x=l[p-2],n.y=l[p-1],n.bx=zh(l[p-4])||n.x,n.by=zh(l[p-3])||n.y}return t}function ct(e){return Yt(e)&&wn(e,"waypoints")}function je(e){return Yt(e)&&wn(e,"labelTarget")}function iS(e){return Yt(e)&&eo(e.parent)}function em(e){return{x:Math.round(e.x),y:Math.round(e.y),width:Math.round(e.width),height:Math.round(e.height)}}function Di(e){return{x:Math.round(e.x),y:Math.round(e.y)}}function Re(e){return{top:e.y,right:e.x+(e.width||0),bottom:e.y+(e.height||0),left:e.x}}function Ts(e){return{x:e.left,y:e.top,width:e.right-e.left,height:e.bottom-e.top}}function rS(e){return Di({x:e.x+(e.width||0)/2,y:e.y+(e.height||0)/2})}function oS(e){for(var t=e.waypoints,n=t.reduce(function(u,l,p){var f=t[p-1];if(f){var d=u[u.length-1],g=d&&d.endLength||0,h=cS(f,l);u.push({start:f,end:l,startLength:g,endLength:g+h,length:h})}return u},[]),i=n.reduce(function(u,l){return u+l.length},0),r=i/2,o=0,a=n[o];a.endLength<r;)a=n[++o];var s=(r-a.startLength)/a.length,c={x:a.start.x+(a.end.x-a.start.x)*s,y:a.start.y+(a.end.y-a.start.y)*s};return c}function Te(e){return ct(e)?oS(e):rS(e)}function nn(e,t,n){n=n||0,Yt(n)||(n={x:n,y:n});var i=Re(e),r=Re(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 ta(e,t,n){var i=aS(e,t);return i.length===1||i.length===2&&ea(i[0],i[1])<1?Di(i[0]):i.length>1?(i=oi(i,function(r){var o=Math.floor(r.t2*100)||1;return o=100-o,o=(o<10?"0":"")+o,r.segment2+"#"+o}),Di(i[n?0:i.length-1])):null}function aS(e,t){return Kh(e,t)}function sS(e){e=e.slice();for(var t=0,n,i,r;e[t];)n=e[t],i=e[t-1],r=e[t+1],ea(n,r)===0||gl(i,r,n)?e.splice(t,1):t++;return e}function cS(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function Ms(e,t){return Math.round(e*t)/t}function tm(e){return De(e)?e+"px":e}function uS(e){for(;e.parent;)e=e.parent;return e}function lS(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:tm(e.width),height:tm(e.height)}),t.appendChild(n),n}function nm(e,t,n){const i=Se("g");Ye(i).add(t);const r=n!==void 0?n:e.childNodes.length-1;return e.insertBefore(i,e.childNodes[r]||null),i}const pS="base",im=0,fS=1,dS={shape:["x","y","width","height"],connection:["waypoints"]};function Me(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||{})}Me.$inject=["config.canvas","eventBus","graphicsFactory","elementRegistry"],Me.prototype._init=function(e){const t=this._eventBus,n=this._container=lS(e),i=this._svg=Se("svg");me(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")}),Ie(n,i);const r=this._viewport=nm(i,"viewport");e.deferUpdate&&(this._viewboxChanged=Du(this._viewboxChanged,300)),this._restoreFocus=Du(this._restoreFocus,0),t.on("diagram.init",()=>{t.fire("canvas.init",{svg:i,viewport:r})}),t.on(["shape.added","connection.added","shape.removed","connection.removed","elements.changed","root.set"],()=>{delete this._cachedViewbox}),t.on("diagram.destroy",500,this._destroy,this),t.on("diagram.clear",500,this._clear,this)},Me.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},Me.prototype._setFocused=function(e){e!=this._focused&&(this._focused=e,this._eventBus.fire("canvas.focus.changed",{focused:e}))},Me.prototype._clear=function(){this._elementRegistry.getAll().forEach(t=>{const n=jh(t);n==="root"?this.removeRootElement(t):this._removeElement(t,n)}),this._planes=[],this._rootElement=null,delete this._cachedViewbox},Me.prototype.focus=function(){this._svg.focus({preventScroll:!0}),this._setFocused(!0)},Me.prototype.restoreFocus=function(){this._restoreFocus()},Me.prototype._restoreFocus=function(){document.activeElement===document.body&&this.focus()},Me.prototype.isFocused=function(){return this._focused},Me.prototype.getDefaultLayer=function(){return this.getLayer(pS,im)},Me.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},Me.prototype._getChildIndex=function(e){return En(this._layers,function(t,n){return n.visible&&e>=n.index&&t++,t},0)},Me.prototype._createLayer=function(e,t){typeof t>"u"&&(t=fS);const n=this._getChildIndex(t);return{group:nm(this._viewport,"layer-"+e,n),index:t,visible:!0}},Me.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},Me.prototype.hideLayer=function(e){if(!e)throw new Error("must specify a name");const t=this._layers[e];if(!t)throw new Error("layer <"+e+"> does not exist");const n=t.group;return t.visible&&(Gt(n),t.visible=!1),n},Me.prototype._removeLayer=function(e){const t=this._layers[e];t&&(delete this._layers[e],Gt(t.group))},Me.prototype.getActiveLayer=function(){const e=this._findPlaneForRoot(this.getRootElement());return e?e.layer:null},Me.prototype.findRoot=function(e){const t=this._resolveElements(e);let n;for(const i of t){const r=this._findPlaneForRoot(uS(i));if(!r||n&&r.rootElement!==n)return;n=r.rootElement}return n},Me.prototype.getRootElements=function(){return this._planes.map(function(e){return e.rootElement})},Me.prototype._findPlaneForRoot=function(e){return ft(this._planes,function(t){return t.rootElement===e})},Me.prototype._resolveElement=function(e){return typeof e=="string"?this._elementRegistry.get(e):e},Me.prototype._resolveElements=function(e){return Ae(e)||(e=[e]),e.map(t=>this._resolveElement(t)).filter(Boolean)},Me.prototype.getContainer=function(){return this._container},Me.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&&(L([i.gfx,i.secondaryGfx],function(r){r&&(n?(e.markers.add(t),Ye(r).add(t)):(e.markers.delete(t),Ye(r).remove(t)))}),this._eventBus.fire("element.marker.update",{element:e,gfx:i.gfx,marker:t,add:!!n}))},Me.prototype.addMarker=function(e,t){this._updateMarker(e,t,!0)},Me.prototype.removeMarker=function(e,t){this._updateMarker(e,t,!1)},Me.prototype.hasMarker=function(e,t){return e=this._resolveElement(e),e.markers?e.markers.has(t):!1},Me.prototype.toggleMarker=function(e,t){this.hasMarker(e,t)?this.removeMarker(e,t):this.addMarker(e,t)},Me.prototype.getRootElement=function(){const e=this._rootElement;return e||this._planes.length?e:this.setRootElement(this.addRootElement(null))},Me.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,im);return this.hideLayer(n),this._addRoot(e,i),this._planes.push({rootElement:e,layer:i}),e},Me.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},Me.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},Me.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)},Me.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})},Me.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})},Me.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=dS[e];if(!Pr(n,function(r){return typeof t[r]<"u"}))throw new Error("must supply { "+n.join(", ")+" } with "+e)},Me.prototype._setParent=function(e,t,n){Ct(t.children,e,n),e.parent=t},Me.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},Me.prototype.addShape=function(e,t,n){return this._addElement("shape",e,t,n)},Me.prototype.addConnection=function(e,t,n){return this._addElement("connection",e,t,n)},Me.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),St(e.parent&&e.parent.children,e),e.parent=null,r.fire(t+".removed",{element:e}),n.remove(e),e},Me.prototype.removeShape=function(e){return this._removeElement(e,"shape")},Me.prototype.removeConnection=function(e){return this._removeElement(e,"connection")},Me.prototype.getGraphics=function(e,t){return this._elementRegistry.getGraphics(e,t)},Me.prototype._changeViewbox=function(e){this._eventBus.fire("canvas.viewbox.changing"),e.apply(this),this._cachedViewbox=null,this._viewboxChanged()},Me.prototype._viewboxChanged=function(){this._eventBus.fire("canvas.viewbox.changed",{viewbox:this.viewbox()})},Me.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);Xo(t,l)});else return o=this._rootElement?this.getActiveLayer():null,i=o&&o.getBBox()||{},a=Xo(t),r=a?a.matrix:v1(),s=Ms(r.a,1e3),c=Ms(-r.e||0,1e3),u=Ms(-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},Me.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),rm(t,n)}),{x:n.e,y:n.f}},Me.prototype.scrollToElement=function(e,t){let n=100;const i=this._resolveElements(e);if(!i.length)return;const r=this.findRoot(i);if(!r)return;r!==this.getRootElement()&&this.setRootElement(r);const o=i.filter(g=>g!=r);if(!o.length)return;t||(t={}),typeof t=="number"&&(n=t),t={top:t.top||n,right:t.right||n,bottom:t.bottom||n,left:t.left||n};const a=Ot(o),s=Re(a),c=this.viewbox(),u=this.zoom();let l,p;c.y+=t.top/u,c.x+=t.left/u,c.width-=(t.right+t.left)/u,c.height-=(t.bottom+t.top)/u;const f=Re(c);if(!(a.width<c.width&&a.height<c.height))l=a.x-c.x,p=a.y-c.y;else{const g=Math.max(0,s.right-f.right),h=Math.min(0,s.left-f.left),m=Math.max(0,s.bottom-f.bottom),S=Math.min(0,s.top-f.top);l=g||h,p=m||S}this.scroll({dx:-l*u,dy:-p*u})},Me.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)}),Ms(i.a,1e3)};function rm(e,t){const n="matrix("+t.a+","+t.b+","+t.c+","+t.d+","+t.e+","+t.f+")";e.setAttribute("transform",n)}Me.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},Me.prototype._setZoom=function(e,t){const n=this._svg,i=this._viewport,r=n.createSVGMatrix(),o=n.createSVGPoint();let a,s,c,u,l;c=i.getCTM();const p=c.a;return t?(a=j(o,t),s=a.matrixTransform(c.inverse()),u=r.translate(s.x,s.y).scale(1/p*e).translate(-s.x,-s.y),l=c.multiply(u)):l=r.scale(e),rm(this._viewport,l),l},Me.prototype.getSize=function(){return{width:this._container.clientWidth,height:this._container.clientHeight}},Me.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}},Me.prototype.resized=function(){delete this._cachedViewbox,this._eventBus.fire("canvas.resized")};var po="data-element-id";function Ln(e){this._elements={},this._eventBus=e}Ln.$inject=["eventBus"],Ln.prototype.add=function(e,t,n){var i=e.id;this._validateId(i),me(t,po,i),n&&me(n,po,i),this._elements[i]={element:e,gfx:t,secondaryGfx:n}},Ln.prototype.remove=function(e){var t=this._elements,n=e.id||e,i=n&&t[n];i&&(me(i.gfx,po,""),i.secondaryGfx&&me(i.secondaryGfx,po,""),delete t[n])},Ln.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)},Ln.prototype.updateGraphics=function(e,t,n){var i=e.id||e,r=this._elements[i];return n?r.secondaryGfx=t:r.gfx=t,t&&me(t,po,i),t},Ln.prototype.get=function(e){var t;typeof e=="string"?t=e:t=e&&me(e,po);var n=this._elements[t];return n&&n.element},Ln.prototype.filter=function(e){var t=[];return this.forEach(function(n,i){e(n,i)&&t.push(n)}),t},Ln.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}},Ln.prototype.getAll=function(){return this.filter(function(e){return e})},Ln.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)})},Ln.prototype.getGraphics=function(e,t){var n=e.id||e,i=this._elements[n];return i&&(t?i.secondaryGfx:i.gfx)},Ln.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 hS(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 mS(e){return e.__refs_collection===!0}function gS(e,t){return Object.prototype.hasOwnProperty.call(e,t.name||t)}function om(e,t,n){var i=hS(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 yS(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 Fn(e,t){if(!(this instanceof Fn))return new Fn(e,t);e.inverse=t,t.inverse=e,this.props={},this.props[e.name]=e,this.props[t.name]=t}Fn.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?om(this,t,e):yS(this,t,e)},Fn.prototype.ensureRefsCollection=function(e,t){var n=e[t.name];return mS(n)||om(this,t,e),n},Fn.prototype.ensureBound=function(e,t){gS(e,t)||this.bind(e,t)},Fn.prototype.unset=function(e,t,n){e&&(this.ensureBound(e,t),t.collection?this.ensureRefsCollection(e,t).remove(n):e[t.name]=void 0)},Fn.prototype.set=function(e,t,n){e&&(this.ensureBound(e,t),t.collection?this.ensureRefsCollection(e,t).add(n):e[t.name]=n)};var _l=new Fn({name:"children",enumerable:!0,collection:!0},{name:"parent"}),am=new Fn({name:"labels",enumerable:!0,collection:!0},{name:"labelTarget"}),sm=new Fn({name:"attachers",collection:!0},{name:"host"}),cm=new Fn({name:"outgoing",collection:!0},{name:"source"}),um=new Fn({name:"incoming",collection:!0},{name:"target"});function fo(){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)}}),_l.bind(this,"parent"),am.bind(this,"labels"),cm.bind(this,"outgoing"),um.bind(this,"incoming")}function na(){fo.call(this),_l.bind(this,"children"),sm.bind(this,"host"),sm.bind(this,"attachers")}he(na,fo);function lm(){fo.call(this),_l.bind(this,"children")}he(lm,na);function pm(){na.call(this),am.bind(this,"labelTarget")}he(pm,na);function fm(){fo.call(this),cm.bind(this,"source"),um.bind(this,"target")}he(fm,fo);var vS={connection:fm,shape:na,label:pm,root:lm};function bS(e,t){var n=vS[e];if(!n)throw new Error("unknown type: <"+e+">");return j(new n,t)}function _S(e){return e instanceof fo}function Li(){this._uid=12}Li.prototype.createRoot=function(e){return this.create("root",e)},Li.prototype.createLabel=function(e){return this.create("label",e)},Li.prototype.createShape=function(e){return this.create("shape",e)},Li.prototype.createConnection=function(e){return this.create("connection",e)},Li.prototype.create=function(e,t){return t=j({},t||{}),t.id||(t.id=e+"_"+this._uid++),bS(e,t)};var ks="__fn",dm=1e3,xS=Array.prototype.slice;function Cn(){this._listeners={},this.on("diagram.destroy",1,this._destroy,this)}Cn.prototype.on=function(e,t,n,i){if(e=Ae(e)?e:[e],Kt(t)&&(i=n,n=t,t=dm),!De(t))throw new Error("priority must be a number");var r=n;i&&(r=vn(n,i),r[ks]=n[ks]||n);var o=this;e.forEach(function(a){o._addListener(a,{priority:t,callback:r,next:null})})},Cn.prototype.once=function(e,t,n,i){var r=this;if(Kt(t)&&(i=n,n=t,t=dm),!De(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[ks]=n,this.on(e,t,o)},Cn.prototype.off=function(e,t){e=Ae(e)?e:[e];var n=this;e.forEach(function(i){n._removeListener(i,t)})},Cn.prototype.createEvent=function(e){var t=new ia;return t.init(e),t},Cn.prototype.fire=function(e,t){var n,i,r,o;if(o=xS.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 ia?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}},Cn.prototype.handleError=function(e){return this.fire("error",{error:e})===!1},Cn.prototype._destroy=function(){this._listeners={}},Cn.prototype._invokeListeners=function(e,t,n){for(var i;n&&!e.cancelBubble;)i=this._invokeListener(e,t,n),n=n.next;return i},Cn.prototype._invokeListener=function(e,t,n){var i;if(n.callback.__isTomb)return i;try{i=wS(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},Cn.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},Cn.prototype._getListeners=function(e){return this._listeners[e]},Cn.prototype._setListeners=function(e,t){this._listeners[e]=t},Cn.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[ks]===t)&&(r?r.next=i:this._setListeners(e,i)),r=n,n=i};function ia(){}ia.prototype.stopPropagation=function(){this.cancelBubble=!0},ia.prototype.preventDefault=function(){this.defaultPrevented=!0},ia.prototype.init=function(e){j(this,e||{})};function wS(e,t){return e.apply(null,t)}function Ir(e){return e.childNodes[0]}function ES(e){return e.parentNode.childNodes[1]}function Os(e,t,n,i,r){var o=Ko();o.setTranslate(t,n);var a=Ko();a.setRotate(i||0,0,0);var s=Ko();s.setScale(1,1),Xo(e,[o,a,s])}function rn(e,t,n){var i=Ko();i.setTranslate(t,n),Xo(e,i)}function hm(e,t){var n=Ko();n.setRotate(t,0,0),Xo(e,n)}function In(e,t){this._eventBus=e,this._elementRegistry=t}In.$inject=["eventBus","elementRegistry"],In.prototype._getChildrenContainer=function(e){var t=this._elementRegistry.getGraphics(e),n;return e.parent?(n=ES(t),n||(n=Se("g"),Ye(n).add("djs-children"),Ie(t.parentNode,n))):n=t,n},In.prototype._clear=function(e){var t=Ir(e);return _s(t),t},In.prototype._createContainer=function(e,t,n,i){var r=Se("g");Ye(r).add("djs-group"),typeof n<"u"?SS(r,t,t.childNodes[n]):Ie(t,r);var o=Se("g");Ye(o).add("djs-element"),Ye(o).add("djs-"+e),i&&Ye(o).add("djs-frame"),Ie(r,o);var a=Se("g");return Ye(a).add("djs-visual"),Ie(o,a),o},In.prototype.create=function(e,t,n){var i=this._getChildrenContainer(t.parent);return this._createContainer(e,i,n,Fh(t))},In.prototype.updateContainments=function(e){var t=this,n=this._elementRegistry,i;i=En(e,function(r,o){return o.parent&&(r[o.parent.id]=o.parent),r},{}),L(i,function(r){var o=r.children;if(o){var a=t._getChildrenContainer(r),s=a.firstChild;L(o,function(c){var u=n.getGraphics(c).parentNode;u===s?s=s.nextSibling:a.insertBefore(u,s)})}})},In.prototype.drawShape=function(e,t,n={}){var i=this._eventBus;return i.fire("render.shape",{gfx:e,element:t,attrs:n})},In.prototype.getShapePath=function(e){var t=this._eventBus;return t.fire("render.getShapePath",e)},In.prototype.drawConnection=function(e,t,n={}){var i=this._eventBus;return i.fire("render.connection",{gfx:e,element:t,attrs:n})},In.prototype.getConnectionPath=function(e){var t=this._eventBus;return t.fire("render.getConnectionPath",e)},In.prototype.update=function(e,t,n){if(t.parent){var i=this._clear(n);if(e==="shape")this.drawShape(i,t),rn(n,t.x,t.y);else if(e==="connection")this.drawConnection(i,t);else throw new Error("unknown type: "+e);t.hidden?me(n,"display","none"):me(n,"display","block")}},In.prototype.remove=function(e){var t=this._elementRegistry.getGraphics(e);Gt(t.parentNode)};function SS(e,t,n){var i=n||t.firstChild;e!==i&&t.insertBefore(e,i)}const RS={__depends__:[$1],__init__:["canvas"],canvas:["type",Me],elementRegistry:["type",Ln],elementFactory:["type",Li],eventBus:["type",Cn],graphicsFactory:["type",In]};function CS(e){var t=new $h(e);return t.init(),t}function PS(e){e=e||{};var t={config:["value",e]},n=[t,RS].concat(e.modules||[]);return CS(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 bn(e,t){return e.$instanceOf(t)}function AS(e){return ft(e.rootElements,function(t){return bn(t,"bpmn:Process")||bn(t,"bpmn:Collaboration")})}function TS(e){var t={},n=[],i={};function r(q,U){return function(Z){q(Z,U)}}function o(q){t[q.id]=q}function a(q){return t[q.id]}function s(q,U){var Z=q.gfx;if(Z)throw new Error(`already rendered ${pn(q)}`);return e.element(q,i[q.id],U)}function c(q,U){return e.root(q,i[q.id],U)}function u(q,U){try{var Z=i[q.id]&&s(q,U);return o(q),Z}catch(Fe){l(Fe.message,{element:q,error:Fe}),console.error(`failed to import ${pn(q)}`,Fe)}}function l(q,U){e.error(q,U)}var p=this.registerDi=function(U){var Z=U.bpmnElement;Z?i[Z.id]?l(`multiple DI elements defined for ${pn(Z)}`,{element:Z}):i[Z.id]=U:l(`no bpmnElement referenced in ${pn(U)}`,{element:U})};function f(q){d(q.plane)}function d(q){p(q),L(q.planeElement,g)}function g(q){p(q)}this.handleDefinitions=function(U,Z){var Fe=U.diagrams;if(Z&&Fe.indexOf(Z)===-1)throw new Error("diagram not part of <bpmn:Definitions />");if(!Z&&Fe&&Fe.length&&(Z=Fe[0]),!Z)throw new Error("no diagram to display");i={},f(Z);var wt=Z.plane;if(!wt)throw new Error(`no plane for ${pn(Z)}`);var M=wt.bpmnElement;if(!M)if(M=AS(U),M)l(`correcting missing bpmnElement on ${pn(wt)} to ${pn(M)}`),wt.bpmnElement=M,p(wt);else throw new Error("no process or collaboration to display");var w=c(M,wt);if(bn(M,"bpmn:Process")||bn(M,"bpmn:SubProcess"))m(M,w);else if(bn(M,"bpmn:Collaboration"))Ee(M,w),S(U.rootElements,w);else throw new Error(`unsupported bpmnElement for ${pn(wt)}: ${pn(M)}`);h(n)};var h=this.handleDeferred=function(){for(var U;n.length;)U=n.shift(),U()};function m(q,U){pe(q,U),I(q.ioSpecification,U),A(q.artifacts,U),o(q)}function S(q,U){var Z=ze(q,function(Fe){return!a(Fe)&&bn(Fe,"bpmn:Process")&&Fe.laneSets});Z.forEach(r(m,U))}function y(q,U){u(q,U)}function x(q,U){L(q,r(y,U))}function E(q,U){u(q,U)}function P(q,U){u(q,U)}function C(q,U){u(q,U)}function D(q,U){u(q,U)}function A(q,U){L(q,function(Z){bn(Z,"bpmn:Association")?n.push(function(){D(Z,U)}):D(Z,U)})}function I(q,U){q&&(L(q.dataInputs,r(P,U)),L(q.dataOutputs,r(C,U)))}var k=this.handleSubProcess=function(U,Z){pe(U,Z),A(U.artifacts,Z)};function O(q,U){var Z=u(q,U);bn(q,"bpmn:SubProcess")&&k(q,Z||U),bn(q,"bpmn:Activity")&&I(q.ioSpecification,U),n.push(function(){L(q.dataInputAssociations,r(E,U)),L(q.dataOutputAssociations,r(E,U))})}function $(q,U){u(q,U)}function oe(q,U){u(q,U)}function ve(q,U){n.push(function(){var Z=u(q,U);q.childLaneSet&&Ue(q.childLaneSet,Z||U),re(q)})}function Ue(q,U){L(q.lanes,r(ve,U))}function Y(q,U){L(q,r(Ue,U))}function pe(q,U){ge(q.flowElements,U),q.laneSets&&Y(q.laneSets,U)}function ge(q,U){L(q,function(Z){bn(Z,"bpmn:SequenceFlow")?n.push(function(){$(Z,U)}):bn(Z,"bpmn:BoundaryEvent")?n.unshift(function(){O(Z,U)}):bn(Z,"bpmn:FlowNode")?O(Z,U):bn(Z,"bpmn:DataObject")||(bn(Z,"bpmn:DataStoreReference")||bn(Z,"bpmn:DataObjectReference")?oe(Z,U):l(`unrecognized flowElement ${pn(Z)} in context ${pn(U&&U.businessObject)}`,{element:Z,context:U}))})}function le(q,U){var Z=u(q,U),Fe=q.processRef;Fe&&m(Fe,Z||U)}function Ee(q,U){L(q.participants,r(le,U)),n.push(function(){x(q.messageFlows,U)}),A(q.artifacts,U)}function re(q){L(q.flowNodeRef,function(U){var Z=U.get("lanes");Z&&Z.push(q)})}}function _(e,t){var n=te(e);return n&&typeof n.$instanceOf=="function"&&n.$instanceOf(t)}function He(e,t){return Yi(t,function(n){return _(e,n)})}function te(e){return e&&e.businessObject||e}function Ke(e){return e&&e.di}function MS(e,t,n){var i,r,o,a,s=[];function c(u,l){var p={root:function(h,m){return i.add(h,m)},element:function(h,m,S){return i.add(h,m,S)},error:function(h,m){s.push({message:h,context:m})}},f=new TS(p);l=l||u.diagrams&&u.diagrams[0];var d=kS(u,l);if(!d)throw new Error("no diagram to display");L(d,function(h){f.handleDefinitions(u,h)});var g=l.plane.bpmnElement.id;o.setRootElement(o.findRoot(g+"_plane")||o.findRoot(g))}return new Promise(function(u,l){try{return i=e.get("bpmnImporter"),r=e.get("eventBus"),o=e.get("canvas"),r.fire("import.render.start",{definitions:t}),c(t,n),r.fire("import.render.complete",{error:a,warnings:s}),u({warnings:s})}catch(p){return p.warnings=s,l(p)}})}function kS(e,t){if(!(!t||!t.plane)){var n=t.plane.bpmnElement,i=n;!_(n,"bpmn:Process")&&!_(n,"bpmn:Collaboration")&&(i=OS(n));var r;_(i,"bpmn:Collaboration")?r=i:r=ft(e.rootElements,function(u){if(_(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=mm(o),s=[t],c=[n];return L(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 mm(e){var t=[];return L(e,function(n){n&&(t.push(n),t=t.concat(mm(n.flowElements)))}),t}function OS(e){for(var t=e;t;){if(_(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>',gm=DS,ym={verticalAlign:"middle"},vm={color:"#404040"},LS={zIndex:"1001",position:"fixed",top:"0",left:"0",right:"0",bottom:"0"},IS={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"},NS='<div class="bjs-powered-by-lightbox"><div class="backdrop"></div><div class="notice"><a href="https://bpmn.io" target="_blank" rel="noopener" class="link">'+gm+'</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>',hi;function $S(){hi=dt(NS),mn(hi,LS),mn(at("svg",hi),ym),mn(at(".backdrop",hi),IS),mn(at(".notice",hi),BS),mn(at(".link",hi),vm,{margin:"15px 20px 15px 10px",alignSelf:"center"})}function jS(){hi||($S(),Rn.bind(hi,".backdrop","click",function(e){document.body.removeChild(hi)})),document.body.appendChild(hi)}const Ds=5,bm="djs-outline-hidden";function vt(e){e=j({},HS,e),this._moddle=this._createModdle(e),this._container=this._createContainer(e),this._init(this._container,this._moddle,e),GS(this._container)}he(vt,rr),vt.prototype.importXML=async function(t,n){const i=this;function r(a){return i.get("eventBus").createEvent(a)}let o=[];try{t=this._emit("import.parse.start",{xml:t})||t;let a;try{a=await this._moddle.fromXML(t,"bpmn:Definitions")}catch(f){throw this._emit("import.parse.complete",{error:f}),f}let s=a.rootElement;const c=a.references,u=a.warnings,l=a.elementsById;o=o.concat(u),s=this._emit("import.parse.complete",r({error:null,definitions:s,elementsById:l,references:c,warnings:o}))||s;const p=await this.importDefinitions(s,n);return o=o.concat(p.warnings),this._emit("import.done",{error:null,warnings:o}),{warnings:o}}catch(a){let s=a;throw o=o.concat(s.warnings||[]),Ls(s,o),s=FS(s),this._emit("import.done",{error:s,warnings:s.warnings}),s}},vt.prototype.importDefinitions=async function(t,n){return this._setDefinitions(t),{warnings:(await this.open(n)).warnings}},vt.prototype.open=async function(t){const n=this._definitions;let i=t;if(!n){const o=new Error("no XML imported");throw Ls(o,[]),o}if(typeof t=="string"&&(i=zS(n,t),!i)){const o=new Error("BPMNDiagram <"+t+"> not found");throw Ls(o,[]),o}try{this.clear()}catch(o){throw Ls(o,[]),o}const{warnings:r}=await MS(this,n,i);return{warnings:r}},vt.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},vt.prototype.saveSVG=async function(){this._emit("saveSVG.start");let t,n;try{const i=this.get("canvas"),r=i.getActiveLayer(),o=at(":scope > defs",i._svg),a=Nh(r),s=o?"<defs>"+Nh(o)+"</defs>":"",c=i.getContainer();gt(c).add(bm);let u;try{u=r.getBBox()}finally{gt(c).remove(bm)}const l=u.x-Ds,p=u.y-Ds,f=u.width+Ds*2,d=u.height+Ds*2;t=`<?xml version="1.0" encoding="utf-8"?>
4
+ nested error: `+P.message;if(D)return a.addWarning({message:F,error:P}),!0;throw Ki(F)}function l(P,C){return u(P,C,!0)}function p(){var P=a.elementsById,C=a.references,D,T;for(D=0;T=C[D];D++){var N=T.element,k=P[T.id],O=wi(N).propertiesByName[T.property];if(k||a.addWarning({message:"unresolved reference <"+T.id+">",element:T.element,property:T.property,value:T.id}),O.isMany){var F=N.get(O.name),oe=F.indexOf(T);oe===-1&&(oe=F.length),k?F[oe]=k:F.splice(oe,1)}else N.set(O.name,k)}}function f(){c.pop().handleEnd()}var d=/^<\?xml /i,g=/ encoding="([^"]+)"/i,h=/^utf-8$/i;function m(P){if(d.test(P)){var C=g.exec(P),D=C&&C[1];!D||h.test(D)||a.addWarning({message:"unsupported document encoding <"+D+">, falling back to UTF-8"})}}function E(P,C){var D=c.peek();try{c.push(D.handleNode(P))}catch(T){u(T,C,o)&&c.push(new Fu)}}function y(P,C){try{c.peek().handleText(P)}catch(D){l(D,C)}}function x(P,C){P.trim()&&y(P,C)}var S=r.getPackages().reduce(function(P,C){return P[C.uri]=C.prefix,P},Object.entries(ju).reduce(function(P,[C,D]){return P[D]=C,P},r.config&&r.config.nsMap||{}));return s.ns(S).on("openTag",function(P,C,D,T){var N=P.attrs||{},k=Object.keys(N).reduce(function(F,oe){var _e=C(N[oe]);return F[oe]=_e,F},{}),O={name:P.name,originalName:P.originalName,attributes:k,ns:P.ns};E(O,T)}).on("question",m).on("closeTag",f).on("cdata",y).on("text",function(P,C,D){x(C(P),D)}).on("error",u).on("warn",l),new Promise(function(P,C){var D;try{s.parse(e),p()}catch(F){D=F}var T=i.element;!D&&!T&&(D=Ki("failed to parse document as <"+i.type.$descriptor.name+">"));var N=a.warnings,k=a.references,O=a.elementsById;return D?(D.warnings=N,C(D)):P({rootElement:T,elementsById:O,references:k,warnings:N})})},Gu.prototype.handler=function(e){return new zu(this.model,e)};function Z0(){var e=[];return Object.defineProperty(e,"peek",{value:function(){return this[this.length-1]}}),e}var Q0=`<?xml version="1.0" encoding="UTF-8"?>
5
+ `,J0=/<|>|'|"|&|\n\r|\n/g,xd=/<|>|&/g;function oi(e){this.prefixMap={},this.uriMap={},this.used={},this.wellknown=[],this.custom=[],this.parent=e,this.defaultPrefixMap=e&&e.defaultPrefixMap||{}}oi.prototype.mapDefaultPrefixes=function(e){this.defaultPrefixMap=e},oi.prototype.defaultUriByPrefix=function(e){return this.defaultPrefixMap[e]},oi.prototype.byUri=function(e){return this.uriMap[e]||this.parent&&this.parent.byUri(e)},oi.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)},oi.prototype.uriByPrefix=function(e){return this.prefixMap[e||"xmlns"]||this.parent&&this.parent.uriByPrefix(e)},oi.prototype.mapPrefix=function(e,t){this.prefixMap[e||"xmlns"]=t},oi.prototype.getNSKey=function(e){return e.prefix!==void 0?e.uri+"|"+e.prefix:e.uri},oi.prototype.logUsed=function(e){var t=e.uri,n=this.getNSKey(e);this.used[n]=this.byUri(t),this.parent&&this.parent.logUsed(e)},oi.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 ew(e){return e.charAt(0).toLowerCase()+e.slice(1)}function tw(e,t){return yd(t)?ew(e):e}function wd(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})}function Ed(e){return xn(e)?e:(e.prefix?e.prefix+":":"")+e.localName}function nw(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 iw(e,t){return t.isGeneric?H({localName:t.ns.localName},e):H({localName:tw(t.ns.localName,t.$pkg)},e)}function rw(e,t){return H({localName:t.ns.localName},e)}function ow(e){var t=e.$descriptor;return Ge(t.properties,function(n){var i=n.name;if(n.isVirtual||!wn(e,i))return!1;var r=e[i];return r===n.default||r===null?!1:n.isMany?r.length:!0})}var aw={"\n":"#10","\n\r":"#10",'"':"#34","'":"#39","<":"#60",">":"#62","&":"#38"},sw={"<":"lt",">":"gt","&":"amp"};function Sd(e,t,n){return e=xn(e)?e:""+e,e.replace(t,function(i){return"&"+n[i]+";"})}function cw(e){return Sd(e,J0,aw)}function uw(e){return Sd(e,xd,sw)}function lw(e){return Ge(e,function(t){return t.isAttr})}function pw(e){return Ge(e,function(t){return!t.isAttr})}function Vu(e){this.tagName=e}Vu.prototype.build=function(e){return this.element=e,this},Vu.prototype.serializeTo=function(e){e.appendIndent().append("<"+this.tagName+">"+this.element.id+"</"+this.tagName+">").appendNewLine()};function Ar(){}Ar.prototype.serializeValue=Ar.prototype.serializeTo=function(e){e.append(this.escape?uw(this.value):this.value)},Ar.prototype.build=function(e,t){return this.value=t,e.type==="String"&&t.search(xd)!==-1&&(this.escape=!0),this};function Wu(e){this.tagName=e}wd(Wu,Ar),Wu.prototype.serializeTo=function(e){e.appendIndent().append("<"+this.tagName+">"),this.serializeValue(e),e.append("</"+this.tagName+">").appendNewLine()};function mt(e,t){this.body=[],this.attrs=[],this.parent=e,this.propertyDescriptor=t}mt.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=ow(e),this.parseAttributes(lw(r)),this.parseContainments(pw(r))),this.parseGenericAttributes(e,i),this},mt.prototype.nsTagName=function(e){var t=this.logNamespaceUsed(e.ns);return iw(t,e)},mt.prototype.nsPropertyTagName=function(e){var t=this.logNamespaceUsed(e.ns);return rw(t,e)},mt.prototype.isLocalNs=function(e){return e.uri===this.ns.uri},mt.prototype.nsAttributeName=function(e){var t;if(xn(e)?t=an(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}:H({localName:t.localName},n)},mt.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}))},mt.prototype.parseGenericContainments=function(e){var t=e.$body;t&&this.body.push(new Ar().build({type:"String"},t));var n=e.$children;n&&L(n,i=>{this.body.push(new mt(this).build(i))})},mt.prototype.parseNsAttribute=function(e,t,n){var i=e.$model,r=an(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)}},mt.prototype.parseNsAttributes=function(e){var t=this,n=e.$attrs,i=[];return L(n,function(r,o){var a=t.parseNsAttribute(e,o,r);a&&i.push(a)}),i},mt.prototype.parseGenericAttributes=function(e,t){var n=this;L(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)}})},mt.prototype.parseContainments=function(e){var t=this,n=this.body,i=this.element;L(e,function(r){var o=i.get(r.name),a=r.isReference,s=r.isMany;if(s||(o=[o]),r.isBody)n.push(new Ar().build(r,o[0]));else if(ld(r.type))L(o,function(u){n.push(new Wu(t.addTagName(t.nsPropertyTagName(r))).build(r,u))});else if(a)L(o,function(u){n.push(new Vu(t.addTagName(t.nsPropertyTagName(r))).build(u))});else{var c=bd(r);L(o,function(u){var l;c?c===vd?l=new mt(t,r):l=new os(t,r,c):l=new mt(t),n.push(l.build(u))})}})},mt.prototype.getNamespaces=function(e){var t=this.namespaces,n=this.parent,i;return t||(i=n&&n.getNamespaces(),e||!i?this.namespaces=t=new oi(i):t=i),t},mt.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},mt.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},mt.prototype.parseAttributes=function(e){var t=this,n=this.element;L(e,function(i){var r=n.get(i.name);if(i.isReference)if(!i.isMany)r=r.id;else{var o=[];L(r,function(a){o.push(a.id)}),r=o.join(" ")}t.addAttribute(t.nsAttributeName(i),r)})},mt.prototype.addTagName=function(e){var t=this.logNamespaceUsed(e);return this.getNamespaces().logUsed(t),Ed(e)},mt.prototype.addAttribute=function(e,t){var n=this.attrs;xn(t)&&(t=cw(t));var i=ad(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)},mt.prototype.serializeAttributes=function(e){var t=this.attrs,n=this.namespaces;n&&(t=nw(n).concat(t)),L(t,function(i){e.append(" ").append(Ed(i.name)).append('="').append(i.value).append('"')})},mt.prototype.serializeTo=function(e){var t=this.body[0],n=t&&t.constructor!==Ar;e.appendIndent().append("<"+this.tagName),this.serializeAttributes(e),e.append(t?">":" />"),t&&(n&&e.appendNewLine().indent(),L(this.body,function(i){i.serializeTo(e)}),n&&e.unindent().appendIndent(),e.append("</"+this.tagName+">")),e.appendNewLine()};function os(e,t,n){mt.call(this,e,t),this.serialization=n}wd(os,mt),os.prototype.parseNsAttributes=function(e){var t=mt.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},os.prototype.isLocalNs=function(e){return e.uri===(this.typeNs||this.ns).uri};function fw(){this.value="",this.write=function(e){this.value+=e}}function dw(e,t){var n=[""];this.append=function(i){return e.write(i),this},this.appendNewLine=function(){return t&&e.write(`
6
+ `),this},this.appendIndent=function(){return t&&e.write(n.join(" ")),this},this.indent=function(){return n.push(""),this},this.unindent=function(){return n.pop(),this}}function hw(e){e=H({format:!1,preamble:!0},e||{});function t(n,i){var r=i||new fw,o=new dw(r,e.format);e.preamble&&o.append(Q0);var a=new mt,s=n.$model;if(a.getNamespaces().mapDefaultPrefixes(mw(s)),a.build(n).serializeTo(o),!i)return r.value}return{toXML:t}}function mw(e){const t=e.config&&e.config.nsMap||{},n={};for(const i in ju)n[i]=ju[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 as(e,t){$n.call(this,e,t)}as.prototype=Object.create($n.prototype),as.prototype.fromXML=function(e,t,n){xn(t)||(n=t,t="bpmn:Definitions");var i=new Gu(H({model:this,lax:!0},n)),r=i.handler(t);return i.fromXML(e,r)},as.prototype.toXML=function(e,t){var n=new hw(t);return new Promise(function(i,r){try{var o=n.toXML(e);return i({xml:o})}catch(a){return r(a)}})};var gw="BPMN20",yw="http://www.omg.org/spec/BPMN/20100524/MODEL",vw="bpmn",bw=[],_w=[{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"}]}],xw=[{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"}]}],ww={tagAlias:"lowerCase",typePrefix:"t"},Ew={name:gw,uri:yw,prefix:vw,associations:bw,types:_w,enumerations:xw,xml:ww},Sw="BPMNDI",Rw="http://www.omg.org/spec/BPMN/20100524/DI",Cw="bpmndi",Pw=[{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"]}],Aw=[{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"}]}],Tw=[],Mw={name:Sw,uri:Rw,prefix:Cw,types:Pw,enumerations:Aw,associations:Tw},kw="DC",Ow="http://www.omg.org/spec/DD/20100524/DC",Dw="dc",Lw=[{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}]}],Iw=[],Nw={name:kw,uri:Ow,prefix:Dw,types:Lw,associations:Iw},Bw="DI",$w="http://www.omg.org/spec/DD/20100524/DI",jw="di",Fw=[{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"}]}],Hw=[],zw={tagAlias:"lowerCase"},Gw={name:Bw,uri:$w,prefix:jw,types:Fw,associations:Hw,xml:zw},Vw="bpmn.io colors for BPMN",Ww="http://bpmn.io/schema/bpmn/biocolor/1.0",Uw="bioc",qw=[{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"}]}],Yw=[],Kw=[],Xw={name:Vw,uri:Ww,prefix:Uw,types:qw,enumerations:Yw,associations:Kw},Zw="BPMN in Color",Qw="http://www.omg.org/spec/BPMN/non-normative/color/1.0",Jw="color",eE=[{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"}]}],tE=[],nE=[],iE={name:Zw,uri:Qw,prefix:Jw,types:eE,enumerations:tE,associations:nE};const rE={bpmn:Ew,bpmndi:Mw,dc:Nw,di:Gw,bioc:Xw,color:iE};function Rd(e,t){const n=H({},rE,e);return new as(n,t)}const oE={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"}},aE="http://www.omg.org/spec/BPMN/non-normative/extensions/i18n/1.0",Cd="i18n",ss={[Cd]:oE,[Au]:td};function Pd(){return Rd(ss)}const Ad=Pd();async function Uu(e){const{rootElement:t,warnings:n}=await Ad.fromXML(e,"bpmn:Definitions");return{definitions:t,warnings:n}}async function sE(e){const{xml:t}=await Ad.toXML(e,{format:!0});return t}function qu(e){return e.map(t=>typeof t=="string"?t:t.message??String(t))}const ro={cjkEm:.865,upperEm:.68,lowerEm:.5,digitEm:.556,spaceEm:.278,otherEm:.35,ascentEm:.9,descentEm:.25},cE=/[ᄀ-ᇿ -〿぀-ヿ㐀-鿿가-힯＀-⦆]/;function uE(e){const t=ro;return cE.test(e)?t.cjkEm:e===" "?t.spaceEm:e>="0"&&e<="9"?t.digitEm:e>="A"&&e<="Z"?t.upperEm:e>="a"&&e<="z"?t.lowerEm:t.otherEm}function oo(e,t){let n=0;for(const i of e)n+=t*uE(i);return n}function Td(e=globalThis,{textMeasurement:t="approximate"}={}){if(!(e!=null&&e.SVGElement))throw new Error("installHeadlessBpmnDom: DOM 전역이 없다 — jsdom window 를 전역에 올린 뒤 호출할 것");t==="approximate"&&lE(e),pE(e),fE(e),dE(e)}function lE(e){var i;const t=(i=e.HTMLCanvasElement)==null?void 0:i.prototype;if(!t||t.__headlessTextMeasurement)return;t.__headlessTextMeasurement=!0;const n={font:"12px sans-serif",letterSpacing:"0px",measureText(r){var a;const o=Number.parseFloat(((a=String(n.font).match(/(\d+(?:\.\d+)?)px/))==null?void 0:a[1])??"12");return{width:oo(r,o),fontBoundingBoxAscent:o*ro.ascentEm,fontBoundingBoxDescent:o*ro.descentEm,actualBoundingBoxAscent:o*ro.ascentEm,actualBoundingBoxDescent:o*ro.descentEm}}};t.getContext=()=>n}function pE(e){if(e.SVGMatrix)return;class t{constructor(){Zr(this,"a",1);Zr(this,"b",0);Zr(this,"c",0);Zr(this,"d",1);Zr(this,"e",0);Zr(this,"f",0)}static of(i,r,o,a,s,c){return Object.assign(new t,{a:i,b:r,c:o,d:a,e:s,f:c})}multiply(i){return t.of(this.a*i.a+this.c*i.b,this.b*i.a+this.d*i.b,this.a*i.c+this.c*i.d,this.b*i.c+this.d*i.d,this.a*i.e+this.c*i.f+this.e,this.b*i.e+this.d*i.f+this.f)}translate(i,r){return this.multiply(t.of(1,0,0,1,i,r))}scale(i,r=i){return this.multiply(t.of(i,0,0,r,0,0))}inverse(){const i=this.a*this.d-this.b*this.c;return t.of(this.d/i,-this.b/i,-this.c/i,this.a/i,(this.c*this.f-this.d*this.e)/i,(this.b*this.e-this.a*this.f)/i)}}e.SVGMatrix=t}function fE(e){var o;const t=()=>{const a=new e.SVGMatrix;return{type:0,matrix:a,setTranslate(s,c){a.e=s,a.f=c},setScale(s,c){a.a=s,a.d=c},setRotate(s,c=0,u=0){const l=s*Math.PI/180,p=Math.cos(l),f=Math.sin(l);a.a=p,a.b=f,a.c=-f,a.d=p,a.e=c-p*c+f*u,a.f=u-f*c-p*u},setMatrix(s){Object.assign(a,s)}}},n=a=>{const s=t();return Object.assign(s.matrix,a),s},i=(o=e.SVGSVGElement)==null?void 0:o.prototype;i&&!i.createSVGTransform&&(i.createSVGTransform=t,i.createSVGTransformFromMatrix=n,i.createSVGMatrix=()=>new e.SVGMatrix,i.createSVGPoint=()=>({x:0,y:0,matrixTransform:()=>({x:0,y:0})}));const r=e.SVGElement.prototype;Object.getOwnPropertyDescriptor(r,"transform")||Object.defineProperty(r,"transform",{configurable:!0,get(){if(!this.__headlessTransformList){const a=[];this.__headlessTransformList={baseVal:{get numberOfItems(){return a.length},clear:()=>{a.length=0},appendItem:s=>(a.push(s),s),getItem:s=>a[s],createSVGTransformFromMatrix:n,consolidate:()=>a[a.length-1]??null}}}return this.__headlessTransformList}})}function dE(e){const t=e.SVGElement.prototype;if(!t.getCTM){const n=()=>new e.SVGMatrix;t.getCTM=n,t.getScreenCTM=n}t.getBBox||(t.getBBox=function(){const n=String(this.textContent??"");return{x:0,y:0,width:oo(n,12),height:14}})}const cs=new Set(["bpmn:Participant","bpmn:Lane","bpmn:Group","bpmn:SubProcess","bpmn:AdHocSubProcess","bpmn:Transaction"]),hE=1,Yu=new Set(["bpmn:TextAnnotation","bpmn:DataStoreReference","bpmn:DataObjectReference","bpmn:DataInput","bpmn:DataOutput"]),mE=2;function Ei(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]}${e.container?`|⊃${e.container}`:""}`;case"group-overlap-unreadable":return e.reason==="minority"?`gu*|${e.group}|${e.shapes.join(",")}`:e.reason==="throughpass"?`gu>|${e.group}|${e.shapes.join(",")}`:`gu|${e.groups[0]}|${e.groups[1]}|${e.shapes.join(",")}`;case"group-stack-unreadable":return`gs|${e.groups.join("|")}|${e.shapes.join(",")}`;case"group-on-container-boundary":return`gb|${e.group}|${e.container}|${e.side}`;case"group-on-group-boundary":return`gg|${e.groups[0]}|${e.groups[1]}|${e.axis}`;case"group-cuts-shape":return`gc|${e.group}|${e.shape}|${e.side}`;case"pool-name-over-label":return`pn|${e.pool}|${e.label}`}}const Md=20,us=5,kd=3,gE=8,Od=12,yE=Od*1.2;function Ku(e,t){const n=t.split(/\r?\n/),i=Math.max(...n.map(o=>oo(o,Od))),r=n.length*yE;return{x:e.x+e.width/2-i/2,y:e.y+e.height/2-r/2,width:i,height:r}}const Dd=1;function fn(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 ls(e,t){let n=null;const i=e.type!==t.type;for(const r of fn(e))for(const o of fn(t)){if(r.axis!==o.axis||Math.abs(r.at-o.at)>Dd)continue;const a=r.dir!==o.dir?"opposite":i?"mixed":null;if(!a)continue;const s=Math.min(r.hi,o.hi)-Math.max(r.lo,o.lo);s>=Md&&(!n||s>n.length)&&(n={axis:r.axis,length:s,kind:a})}return n}function Ld(e,t){const n=ls(e,t);return n&&n.kind==="opposite"?{axis:n.axis,length:n.length}:null}function vE(e,t){let n=0;for(const i of t)i.id!==e.id&&Ld(e,i)&&n++;return n}function Si(e,t){let n=0;for(const i of t)i.id!==e.id&&ls(e,i)&&n++;return n}const Id=15,Nd=20;function bE(e,t){const n=t.axis==="v"?[e.x,e.x+e.width]:[e.y,e.y+e.height];if(t.at<n[0]-Nd||t.at>n[1]+Nd)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 Xu=20;function ps(e,t){const n=[];for(const i of t){if(i.axis!==e.axis||Math.abs(i.at-e.at)>Dd)continue;const r=Math.max(e.lo,i.lo),o=Math.min(e.hi,i.hi);o-r<Md||n.push([r-Xu,o+Xu])}return n}function fs(e,t){const n=e.label;if(!n)return null;let i=null;for(const r of fn(e)){const o=bE(n,r);if(o){for(const a of t)if(a.id!==e.id&&!(i&&a.id>=i.other)){for(const[s,c]of ps(r,fn(a)))if(Math.min(c,o[1])>Math.max(s,o[0])){i={other:a.id,axis:r.axis};break}}}}return i}const _E=1,xE=(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 wE(e,t,n,i){const r=n.x+i,o=n.y+i,a=n.x+n.width-i,s=n.y+n.height-i;if(a<=r||s<=o)return!1;const c=t.x-e.x,u=t.y-e.y;let l=0,p=1;const f=(d,g)=>{if(g===0)return d<=0;const h=d/g;if(g>0){if(h>p)return!1;h>l&&(l=h)}else{if(h<l)return!1;h<p&&(p=h)}return!0};return f(r-e.x,c)&&f(e.x-a,-c)&&f(o-e.y,u)&&f(e.y-s,-u)&&p>l}function Zu(e,t,n){return e.x+n<t.x+t.width-n&&t.x+n<e.x+e.width-n&&e.y+n<t.y+t.height-n&&t.y+n<e.y+e.height-n}const EE=(e,t)=>e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height,ao=1;function Ri(e,t){const n=e.x+ao,i=e.x+e.width-ao,r=e.y+ao,o=e.y+e.height-ao;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 Bd(e,t){const n=e.label;if(!n)return null;if(fn(e).some(i=>Ri(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(fn(i).some(r=>Ri(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=>Ri(n,r)))return i.id;return null}function Sn(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(wE(e.waypoints[o],e.waypoints[o+1],r,mE)){i.push(r);break}}return i}function SE(e,t,n,i){const r=(u,l,p)=>(l.x-u.x)*(p.y-u.y)-(l.y-u.y)*(p.x-u.x),o=r(n,i,e),a=r(n,i,t),s=r(e,t,n),c=r(e,t,i);return o*a<0&&s*c<0}const $d=(e,t)=>e.endpoints.some(n=>t.endpoints.includes(n));function ds(e,t){let n=0;for(const i of t){if(i.id===e.id||$d(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++)SE(e.waypoints[o],e.waypoints[o+1],i.waypoints[a],i.waypoints[a+1])&&(r=!0);r&&n++}return n}function Ci(e,t){let n=0;for(const i of t)i.id===e.id||$d(e,i)||ds(e,[i])>0&&(n+=i.type===e.type?2:1);return n}function jd(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++)ds(n[i],[n[r]])>0&&(t+=n[i].type===n[r].type?2:1);return t}function Qu(e){const t=[],n=e.edges;for(let i=0;i<n.length;i++)for(let r=i+1;r<n.length;r++)if(ds(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 Fd(e){const t=Qu(e),n=a=>a==="bpmn:MessageFlow"||a.endsWith("Association")?"dashed":"solid",i=new Map(e.edges.map(a=>[a.id,a]));let r=0,o=0;for(const[a,s]of t){const c=i.get(a),u=i.get(s);if(!c||!u)continue;const l=n(c.type),p=n(u.type);l==="solid"&&p==="solid"?r++:l==="dashed"&&p==="dashed"&&o++}return{pairs:t,solidPairs:r,dashedPairs:o,mixedPairs:t.length-r-o,crossPoolMessages:RE(e)}}function RE(e){const t=e.shapes.filter(r=>r.type==="bpmn:Participant");if(t.length<3)return 0;const n=r=>{const o=e.shapes.find(a=>a.id===r);if(o)return t.find(a=>o.x>=a.x&&o.y>=a.y&&o.x+o.width<=a.x+a.width&&o.y+o.height<=a.y+a.height)};let i=0;for(const r of e.edges){if(r.type!=="bpmn:MessageFlow"||r.endpoints.length<2)continue;const o=n(r.endpoints[0]),a=n(r.endpoints[1]);if(!o||!a||o.id===a.id)continue;const s=Math.min(o.y,a.y),c=Math.max(o.y+o.height,a.y+a.height);t.some(u=>u.id!==o.id&&u.id!==a.id&&u.y>s&&u.y+u.height<c)&&i++}return i}function Hd(e,t,n){const i=new Set(t.flatMap(r=>[...r.members]));return e.shapes.filter(r=>!r.container&&!Yu.has(r.type)&&!i.has(r.id)&&r.x>=n.x&&r.y>=n.y&&r.x+r.width<=n.right&&r.y+r.height<=n.bottom).map(r=>r.id).sort()}function zd(e){var n;const t=(n=ht(e==null?void 0:e.extensionElements))==null?void 0:n.values;if(Array.isArray(t))for(const i of t){const r=ht(i);if((r==null?void 0:r.$type)!=="bwl:Members"||typeof r.refs!="string")continue;const o=r.refs.split(/\s+/).filter(Boolean);return o.length?o:void 0}}const Gd=e=>e?{members:e}:{},ai=e=>e.shapes.filter(t=>!t.container);function CE(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 Vd(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(fn(i).some(r=>Ri(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=>Ri(n,r)))return i.id;return null}function so(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 Pi(e){const t=[],n=e.shapes.filter(h=>!h.container);for(const h of e.edges)for(const m of Sn(h,n))t.push({kind:"edge-crosses-shape",edge:h.id,shape:m.id});const i=n.filter(h=>!h.attached);for(let h=0;h<i.length;h++)for(let m=h+1;m<i.length;m++){const E=i[h],y=i[m];if(!Zu(E,y,hE))continue;const x=E.id<y.id?[E.id,y.id]:[y.id,E.id];t.push({kind:"shape-overlap",shapes:x,identical:EE(E,y)})}const r=e.shapes.filter(h=>h.type==="bpmn:Group"&&Array.isArray(h.members)&&h.members.length>0);for(let h=0;h<r.length;h++)for(let m=h+1;m<r.length;m++){const E=r[h],y=r[m],x=Math.min(E.x+E.width,y.x+y.width)-Math.max(E.x,y.x),S=Math.min(E.y+E.height,y.y+y.height)-Math.max(E.y,y.y);if(x<=us||S<=us)continue;const P=E.id<y.id?[E.id,y.id]:[y.id,E.id],C=new Set(y.members);if(E.members.some(T=>C.has(T))){const T=Hd(e,r,{x:Math.max(E.x,y.x),y:Math.max(E.y,y.y),right:Math.min(E.x+E.width,y.x+y.width),bottom:Math.min(E.y+E.height,y.y+y.height)});T.length&&t.push({kind:"group-overlap-unreadable",reason:"orphan",groups:P,shapes:T});continue}const D=E.x<=y.x&&E.y<=y.y&&E.x+E.width>=y.x+y.width&&E.y+E.height>=y.y+y.height?E.id:y.x<=E.x&&y.y<=E.y&&y.x+y.width>=E.x+E.width&&y.y+y.height>=E.y+E.height?y.id:void 0;t.push({kind:"group-overlap-unintended",groups:P,...D?{container:D}:{}})}const o=new Set(r.flatMap(h=>[...h.members])),a=h=>e.shapes.filter(m=>!m.container&&!Yu.has(m.type)&&m.x>=h.x&&m.y>=h.y&&m.x+m.width<=h.x+h.width&&m.y+m.height<=h.y+h.height);for(const h of r){const m=a(h);if(!m.length)continue;const E=new Set(h.members),y=m.filter(x=>!E.has(x.id));y.some(x=>o.has(x.id))&&(y.length*2<m.length||t.push({kind:"group-overlap-unreadable",reason:"minority",group:h.id,shapes:y.map(x=>x.id).sort()}))}for(const h of r){const m=new Set(a(h).map(C=>C.id)),E=new Set(h.members),y=new Set([...m].filter(C=>!E.has(C)&&o.has(C)));if(!y.size)continue;let x=!1,S=!1,P=!1;for(const C of e.edges){if(C.type!=="bpmn:SequenceFlow"||!C.source||!C.target)continue;const D=y.has(C.source),T=y.has(C.target);!D&&T&&!m.has(C.source)?x=!0:D&&!T&&!m.has(C.target)?S=!0:D&&T&&(P=!0)}x&&S&&P&&t.push({kind:"group-overlap-unreadable",reason:"throughpass",group:h.id,shapes:[...y].sort()})}const s=e.shapes.filter(h=>h.type==="bpmn:Group");for(let h=0;h<s.length;h++)for(let m=h+1;m<s.length;m++)for(let E=m+1;E<s.length;E++){const y=[s[h],s[m],s[E]],x={x:Math.max(...y.map(C=>C.x)),y:Math.max(...y.map(C=>C.y)),right:Math.min(...y.map(C=>C.x+C.width)),bottom:Math.min(...y.map(C=>C.y+C.height))};if(x.right-x.x<=us||x.bottom-x.y<=us)continue;const S=Hd(e,[],x);if(!S.length)continue;const P=y.map(C=>C.id).sort();t.push({kind:"group-stack-unreadable",groups:P,shapes:S})}for(const h of e.shapes.filter(m=>m.type==="bpmn:Group"))for(const m of e.shapes){if(m.container||m.attached||Yu.has(m.type)||m.width<=0||m.height<=0)continue;const E=[["top",h.y,"h",h.x,h.x+h.width],["bottom",h.y+h.height,"h",h.x,h.x+h.width],["left",h.x,"v",h.y,h.y+h.height],["right",h.x+h.width,"v",h.y,h.y+h.height]];for(const[y,x,S,P,C]of E){const D=S==="h"?m.x:m.y,T=S==="h"?m.x+m.width:m.y+m.height;if(!(D<C&&P<T))continue;const N=S==="h"?m.y:m.x,k=S==="h"?m.y+m.height:m.x+m.width;if(!(N<x&&x<k))continue;const O=Math.min(x-N,k-x);O<gE||t.push({kind:"group-cuts-shape",group:h.id,shape:m.id,side:y,depth:O})}}const c=e.shapes.filter(h=>h.container&&h.type!=="bpmn:Group"&&h.type!=="bpmn:Lane");for(const h of e.shapes.filter(m=>m.type==="bpmn:Group"))for(const m of c){const E=h.x<m.x+m.width&&m.x<h.x+h.width,y=h.y<m.y+m.height&&m.y<h.y+h.height,x=[["top",h.y,m.y,E],["bottom",h.y+h.height,m.y+m.height,E],["left",h.x,m.x,y],["right",h.x+h.width,m.x+m.width,y]];for(const[S,P,C,D]of x)D&&Math.abs(P-C)<=kd&&t.push({kind:"group-on-container-boundary",group:h.id,container:m.id,side:S})}const u=e.shapes.filter(h=>h.type==="bpmn:Group");for(let h=0;h<u.length;h++)for(let m=h+1;m<u.length;m++){const E=u[h],y=u[m],x=E.x<y.x+y.width&&y.x<E.x+E.width,S=E.y<y.y+y.height&&y.y<E.y+E.height,P=[["x",E.x+E.width,y.x,S],["x",y.x+y.width,E.x,S],["y",E.y+E.height,y.y,x],["y",y.y+y.height,E.y,x]];for(const[C,D,T,N]of P)if(N&&Math.abs(D-T)<=kd){t.push({kind:"group-on-group-boundary",groups:E.id<y.id?[E.id,y.id]:[y.id,E.id],axis:C});break}}for(let h=0;h<e.edges.length;h++)for(let m=h+1;m<e.edges.length;m++){const E=e.edges[h],y=e.edges[m],x=ls(E,y);if(!x)continue;const S=E.id<y.id?[E.id,y.id]:[y.id,E.id];t.push({kind:x.kind==="opposite"?"edge-overlap-opposite":"edge-overlap-mixed",edges:S,axis:x.axis,length:Math.round(x.length)})}for(const h of e.edges){if(!h.label)continue;const m=fs(h,e.edges);m&&t.push({kind:"label-on-shared-segment",edge:h.id,other:m.other,axis:m.axis})}for(const h of e.edges){if(!h.label)continue;const m=Bd(h,e);m&&t.push({kind:"label-over-line",edge:h.id,line:m})}const l=new Set(n.map(h=>h.id)),p=e.shapes.filter(h=>h.type==="bpmn:Participant"&&h.label);for(const h of[...n,...p.filter(m=>!l.has(m.id))]){if(!h.label)continue;const m=Vd(h,e);m&&t.push({kind:"label-over-line",edge:h.id,line:m})}const f=new Set(e.shapes.filter(h=>h.type==="bpmn:TextAnnotation").map(h=>h.id));for(const h of p)for(const{owner:m,rect:E}of so(e))m===h.id||f.has(m)||Zu(h.label,E,ao)&&t.push({kind:"pool-name-over-label",pool:h.id,label:m});const d=so(e);for(const h of n)if(h.type==="bpmn:TextAnnotation")for(const{owner:m,rect:E}of d)m!==h.id&&Zu(h,E,ao)&&t.push({kind:"annotation-over-label",annotation:h.id,label:m});const g=new Map(e.shapes.map(h=>[h.id,h]));for(const h of n){const m=h.parent??CE(h,e,g);if(!m)continue;const E=g.get(m);!E||!E.container||xE(E,h,_E)||t.push({kind:"shape-outside-container",shape:h.id,container:E.id})}return t.sort((h,m)=>Ei(h).localeCompare(Ei(m)))}const ht=e=>typeof e=="object"&&e!==null?e:void 0,St=e=>typeof e=="number"?e:0,Ai=e=>{const t=ht(e);return typeof(t==null?void 0:t.id)=="string"?t.id:void 0};function PE(e){const t=ht(e);if(!t)return[];const n=[];for(const i of["sourceRef","targetRef"]){const r=t[i];for(const o of Array.isArray(r)?r:[r]){const a=Ai(o);a&&n.push(a)}}return n}function AE(e){const t=ht(e);if(!t)return{};const n=Array.isArray(t.sourceRef)?void 0:Ai(t.sourceRef),i=Array.isArray(t.targetRef)?void 0:Ai(t.targetRef);return n&&i?{source:n,target:i}:{}}function TE(e,t){const n=ht(e.$parent);if(!n)return;const i=typeof n.$type=="string"?n.$type:"";if(i==="bpmn:Process"){const r=Ai(n);return r?t.get(r):void 0}if(cs.has(i)&&i!=="bpmn:Lane"&&i!=="bpmn:Group")return Ai(n)}function Wd(e){var a,s,c,u,l;const t=[],n=[],i=((a=ht(e))==null?void 0:a.diagrams)??[],r=new Map,o=new Set;for(const p of((s=ht(e))==null?void 0:s.rootElements)??[]){const f=ht(p);if((f==null?void 0:f.$type)==="bpmn:Collaboration")for(const d of f.participants??[]){const g=ht(d),h=Ai(g),m=Ai(g==null?void 0:g.processRef);h&&m?r.set(m,h):h&&o.add(h)}}for(const p of i){const f=ht((c=ht(p))==null?void 0:c.plane),d=(f==null?void 0:f.planeElement)??[];for(const g of d){const h=ht(g);if(!h)continue;const m=ht(h.bpmnElement),E=typeof(m==null?void 0:m.id)=="string"?m.id:void 0;if(!E)continue;const y=typeof(m==null?void 0:m.$type)=="string"?m.$type:"",x=ht(h.bounds);if(x){const P=h.isExpanded===!1&&y!=="bpmn:Participant",C=ht((u=ht(h.label))==null?void 0:u.bounds),D={id:E,type:y,x:St(x.x),y:St(x.y),width:St(x.width),height:St(x.height),container:cs.has(y)&&!P,attached:(m==null?void 0:m.attachedToRef)!==void 0,...m?{parent:TE(m,r)}:{},...C?{label:{x:St(C.x),y:St(C.y),width:St(C.width),height:St(C.height)}}:{},...y==="bpmn:Group"?Gd(zd(m)):{}},T=h.isHorizontal!==!1,N=typeof(m==null?void 0:m.name)=="string"?m.name:"";o.has(E)&&T&&N&&(D.label=Ku(D,N)),t.push(D);continue}const S=h.waypoint;if(Array.isArray(S)){const P=ht((l=ht(h.label))==null?void 0:l.bounds);n.push({id:E,type:y,waypoints:S.map(C=>{var D,T;return{x:St((D=ht(C))==null?void 0:D.x),y:St((T=ht(C))==null?void 0:T.y)}}),endpoints:PE(m),...AE(m),...P?{label:{x:St(P.x),y:St(P.y),width:St(P.width),height:St(P.height)}}:{}})}}}return{shapes:t,edges:n}}function Ud(e){return Pi(Wd(e))}async function ME(e){const{definitions:t,warnings:n}=await Uu(e);return{findings:Ud(t),warnings:n}}function yt(e){var i;const t=[],n=[];for(const r of e.getAll()){const o=r;if(o.type==="label"||o.labelTarget)continue;const a=typeof o.type=="string"?o.type:"";if(a==="bpmn:Definitions"||a.startsWith("bpmndi:"))continue;const s=o.waypoints;if(s){const h=ht(o.label),m=Ai(o.source),E=Ai(o.target);n.push({id:o.id,type:a,waypoints:s.map(y=>({x:St(y.x),y:St(y.y)})),endpoints:[m,E].filter(y=>!!y),...m&&E?{source:m,target:E}:{},...h&&typeof h.x=="number"?{label:{x:h.x,y:St(h.y),width:St(h.width),height:St(h.height)}}:{}});continue}if(typeof o.x!="number"||typeof o.y!="number")continue;const c=ht(o.businessObject),u=ht(o.label);let l=ht(o.parent);for(;l&&l.type==="bpmn:Lane";)l=ht(l.parent);const p=typeof(l==null?void 0:l.type)=="string"?l.type:"",f=l&&cs.has(p)&&p!=="bpmn:Group"&&typeof l.id=="string"?l.id:void 0,d={id:o.id,type:a,x:o.x,y:o.y,width:St(o.width),height:St(o.height),container:cs.has(a)&&(a==="bpmn:Participant"||o.collapsed!==!0),attached:(c==null?void 0:c.attachedToRef)!==void 0,...f!==void 0?{parent:f}:{},...u&&typeof u.x=="number"?{label:{x:u.x,y:St(u.y),width:St(u.width),height:St(u.height)}}:{},...a==="bpmn:Group"?Gd(zd(c)):{}},g=typeof(c==null?void 0:c.name)=="string"?c.name:"";a==="bpmn:Participant"&&!(c!=null&&c.processRef)&&g&&((i=ht(o.di))==null?void 0:i.isHorizontal)!==!1&&(d.label=Ku(d,g)),t.push(d)}return{shapes:t,edges:n}}const kE={"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 OE(e,t){const n=kE[e];return n||(e==="label"||e.startsWith("bpmndi:")?"other":e.startsWith("bpmn:")&&!("waypoints"in t&&t.waypoints)?"flowNode":"other")}function qd(e){let t=e.parent;for(;t;){if(t.type==="bpmn:Participant")return t.id;t=t.parent}}function Yd(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 OE(i.type,i)},lanesOf:n=>t().filter(i=>i.type==="bpmn:Lane"&&qd(i)===n).sort((i,r)=>i.y-r.y).map(i=>i.id),participantOf:n=>{const i=e.get(n);return i?qd(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 Ju=20,DE=4,pt=(e,t)=>Math.abs(e-t)<.5;function el(e,t,n,i=Ju){if(pt(e.y,t.y)&&!pt(e.x,t.x)){const r=Math.min(e.x,t.x),o=Math.max(e.x,t.x);if(!(r<n.x-i&&n.x+n.width+i<o))return null;const a=e.x<t.x?n.x-i:n.x+n.width+i,s=e.x<t.x?n.x+n.width+i:n.x-i,c=u=>[{x:a,y:e.y},{x:a,y:u},{x:s,y:u},{x:s,y:e.y}];return[c(n.y-i),c(n.y+n.height+i)]}if(pt(e.x,t.x)&&!pt(e.y,t.y)){const r=Math.min(e.y,t.y),o=Math.max(e.y,t.y);if(!(r<n.y-i&&n.y+n.height+i<o))return null;const a=e.y<t.y?n.y-i:n.y+n.height+i,s=e.y<t.y?n.y+n.height+i:n.y-i,c=u=>[{x:e.x,y:a},{x:u,y:a},{x:u,y:s},{x:e.x,y:s}];return[c(n.x-i),c(n.x+n.width+i)]}return null}function Kd(e,t,n,i=Ju){if(n.length<2)return null;if(pt(e.y,t.y)&&!pt(e.x,t.x)){const r=Math.min(e.x,t.x),o=Math.max(e.x,t.x),a=Math.min(...n.map(d=>d.x))-i,s=Math.max(...n.map(d=>d.x+d.width))+i;if(!(r<a&&s<o))return null;const c=e.x<t.x?a:s,u=e.x<t.x?s:a,l=Math.min(...n.map(d=>d.y))-i,p=Math.max(...n.map(d=>d.y+d.height))+i,f=d=>[{x:c,y:e.y},{x:c,y:d},{x:u,y:d},{x:u,y:e.y}];return[f(l),f(p)]}if(pt(e.x,t.x)&&!pt(e.y,t.y)){const r=Math.min(e.y,t.y),o=Math.max(e.y,t.y),a=Math.min(...n.map(d=>d.y))-i,s=Math.max(...n.map(d=>d.y+d.height))+i;if(!(r<a&&s<o))return null;const c=e.y<t.y?a:s,u=e.y<t.y?s:a,l=Math.min(...n.map(d=>d.x))-i,p=Math.max(...n.map(d=>d.x+d.width))+i,f=d=>[{x:e.x,y:c},{x:d,y:c},{x:d,y:u},{x:e.x,y:u}];return[f(l),f(p)]}return null}function Xd(e,t,n=Ju){if(e.length!==4)return null;const[i,r,o,a]=e;if(pt(i.y,r.y)&&pt(r.x,o.x)&&pt(o.y,a.y)){const s=c=>[i,{x:c,y:i.y},{x:c,y:a.y},a];return[s(t.x-n),s(t.x+t.width+n)]}if(pt(i.x,r.x)&&pt(r.y,o.y)&&pt(o.x,a.x)){const s=c=>[i,{x:i.x,y:c},{x:a.x,y:c},a];return[s(t.y-n),s(t.y+t.height+n)]}return null}function tl(e,t){if(e.endpoints.length!==2)return[];const n=t.find(p=>p.id===e.endpoints[0]),i=t.find(p=>p.id===e.endpoints[1]);if(!n||!i)return[];if(i.x<=n.x+n.width)return[];const r=n.y+n.height/2,o=i.y+i.height/2;if(r>=i.y&&r<=i.y+i.height)return[];const a=i.x+i.width/2,s=n.x+n.width/2,c=r>o,u=[{x:n.x+n.width,y:r},{x:a,y:r},{x:a,y:c?i.y+i.height:i.y}],l=[{x:s,y:c?n.y:n.y+n.height},{x:s,y:o},{x:i.x,y:o}];return[u,l]}const Zd=30,LE=[0,-25,25,-40,40];function IE(e,t){if(e.type!=="bpmn:MessageFlow"||e.endpoints.length!==2)return[];const n=t.find(f=>f.id===e.endpoints[0]),i=t.find(f=>f.id===e.endpoints[1]);if(!n||!i)return[];const r=n.y+n.height/2,o=i.y+i.height/2;if(i.y<n.y+n.height&&i.y+i.height>n.y)return[];const a=o<r,s=a?n.y+n.height:n.y,c=a?s+Zd:s-Zd,u=a?i.y+i.height:i.y,l=n.x+n.width/2,p=i.x+i.width/2;return LE.map(f=>[{x:l,y:s},{x:l,y:c},{x:p+f,y:c},{x:p+f,y:u}])}const Qd=(e,t,n)=>[...e.slice(0,t+1),...n,...e.slice(t+1)],co=(e,t,n)=>Sn({...e,waypoints:t},n).length;function Jd(e,t,n,i){let r=[...e.waypoints],o=co(e,r,t);if(o===0)return null;let a=!1;for(const p of tl(e,t))if(co(e,p,t)===0)return p;const s=(i??[]).filter(p=>p.id!==e.id).flatMap(fn),c=p=>fn({...e,waypoints:p}).some(f=>ps(f,s).length>0),u=IE(e,t).filter(p=>co(e,p,t)===0);if(u.length)return u.find(p=>!c(p))??u[0];const l=p=>!n||p.every(f=>f.x>=n.x&&f.x<=n.x+n.width&&f.y>=n.y&&f.y<=n.y+n.height);if(e.endpoints.length===2&&r.length>2){const p=t.find(d=>d.id===e.endpoints[0]),f=t.find(d=>d.id===e.endpoints[1]);if(p&&f&&pt(p.y+p.height/2,f.y+f.height/2)){const d=[r[0],r[r.length-1]];if(pt(d[0].y,d[1].y)&&!pt(d[0].x,d[1].x)){const g=t.filter(y=>!e.endpoints.includes(y.id)&&Sn({...e,waypoints:d},[y]).length>0),h=g.length>=2?Kd(d[0],d[1],g):null,E=(h?h.map(y=>[d[0],...y,d[1]]):g.length===1?(el(d[0],d[1],g[0])??[]).map(y=>[d[0],...y,d[1]]):g.length===0?[d]:[]).filter(y=>co(e,y,t)===0&&y.length<=r.length).sort((y,x)=>Number(l(x))-Number(l(y)));if(E.length)return E.find(y=>!c(y))??E[0]}}}for(let p=0;p+1<r.length;p++){const f=r[p],d=r[p+1],g=t.filter(E=>!e.endpoints.includes(E.id)&&Sn({...e,waypoints:[f,d]},[E]).length>0);if(g.length<2)continue;const h=Kd(f,d,g);if(!h)continue;const m=h.map(E=>Qd(r,p,E)).filter(E=>co(e,E,t)===0).sort((E,y)=>Number(l(y))-Number(l(E)));if(m.length)return m.find(E=>!c(E))??m[0]}for(let p=0;p<DE&&o>0;p++){let f=!1;for(let d=0;d+1<r.length&&!f;d++){const g=r[d],h=r[d+1];for(const m of t){if(e.endpoints.includes(m.id)||Sn({...e,waypoints:[g,h]},[m]).length===0)continue;const E=el(g,h,m),y=E?E.map(S=>Qd(r,d,S)):Xd(r,m)??[];if(!y.length)continue;const x=[...y].sort((S,P)=>Number(l(P))-Number(l(S)));for(const S of x){const P=co(e,S,t);if(P<o){r=S,o=P,f=!0,a=!0;break}}if(f)break}}if(!f)break}return a&&o===0?r:null}function eh(e,t){const{elementRegistry:n}=e,i=e.modeling,r=yt(n),o=ai(r),a=Pi(r).filter(c=>c.kind==="edge-crosses-shape"&&!t.has(Ei(c)));if(!a.length)return;const s=new Map;for(const c of a){if(c.kind!=="edge-crosses-shape"||s.has(c.edge))continue;const u=r.edges.find(l=>l.id===c.edge);u&&s.set(c.edge,u)}for(const[c,u]of s){const l=n.get(c);if(!l)continue;const p=l.parent,f=p&&typeof p.x=="number"&&typeof p.width=="number"?{x:p.x,y:p.y,width:p.width,height:p.height}:void 0,d=Jd(u,o,f,r.edges);if(!d)continue;const g=r.edges.filter(E=>E.id!==c),h=Si(u,g);Si({...u,waypoints:d},g)>h||i.updateWaypoints(l,d)}}const NE=10;function th(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 nh(e,t){if(e.waypoints.length<2||e.endpoints.length!==2)return null;const n=t.shapes.filter(F=>F.type==="bpmn:Participant"&&F.container),i=t.shapes.find(F=>F.id===e.endpoints[0]),r=t.shapes.find(F=>F.id===e.endpoints[1]);if(!i||!r)return null;const o=th(i,n),a=th(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(F=>F.id!==o.id&&F.id!==a.id&&F.y>=c.y+c.height&&F.y+F.height<=u.y).sort((F,oe)=>F.y-oe.y);if(!l.length)return null;const p=l[0],f=l[l.length-1],d=(c.y+c.height+p.y)/2,g=(f.y+f.height+u.y)/2,h=s?d:g,m=s?g:d,E=e.waypoints[0],y=e.waypoints[e.waypoints.length-1],x=ai(t),S=t.edges.filter(F=>F.id!==e.id),P=Ci(e,S),C=Sn(e,x).length;if(P===0&&C===0||C===0&&e.waypoints.length===2)return null;const D=Math.min(...l.map(F=>F.x)),T=Math.max(...l.map(F=>F.x+F.width)),N=(E.x+y.x)/2,k=F=>F.filter((oe,_e)=>_e===0||!(pt(oe.x,F[_e-1].x)&&pt(oe.y,F[_e-1].y)));let O;for(let F=D;F<=T;F+=NE){const oe=k([E,{x:E.x,y:h},{x:F,y:h},{x:F,y:m},{x:y.x,y:m},y]),_e={...e,waypoints:oe};if(Sn(_e,x).length>0)continue;const We=Ci(_e,S),Y=Math.abs(F-N);(!O||We<O.cross||We===O.cross&&Y<O.detour)&&(O={pts:oe,cross:We,detour:Y})}return O&&(C>0?O.cross<=P:O.cross<P)?O.pts:null}function ih(e,t){const{elementRegistry:n}=e,i=e.modeling,r=yt(n);for(const o of r.edges){if(o.type!=="bpmn:MessageFlow"||t.has(o.id))continue;const a=yt(n),s=a.edges.find(l=>l.id===o.id);if(!s)continue;const c=nh(s,a);if(!c)continue;const u=n.get(o.id);u&&i.updateWaypoints(u,c)}}const Tr=[25,-25,40,-40],hs=35;function rh(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-hs:n.y+n.height+hs,p=[];for(const y of[0,...Tr]){if(Math.abs(y)>=i.width/2-5)continue;const x=o+y;p.push({pts:[{x:n.x,y:r},{x,y:r},{x,y:c}],cost:Math.abs(y)});for(const S of[0,...Tr]){if(Math.abs(S)>=n.width/2-5)continue;const P=a+S;p.push({pts:[{x:P,y:u},{x:P,y:l},{x,y:l},{x,y:c}],cost:Math.abs(y)+Math.abs(S)})}}const f=50,d=i.y+i.height/2,g=s?n.y+n.height:n.y;for(const y of[0,...Tr]){if(Math.abs(y)>=n.width/2-5)continue;const x=a+y;p.push({pts:[{x,y:g},{x,y:d},{x:i.x+i.width,y:d}],cost:f+Math.abs(y)})}const h=60,m=s?i.y+i.height:i.y,E=s?i.y+i.height+hs:i.y-hs;for(const y of[0,...Tr]){if(Math.abs(y)>=i.width/2-5)continue;const x=o+y;for(const S of[0,...Tr]){if(Math.abs(S)>=n.width/2-5)continue;const P=a+S;p.push({pts:[{x:P,y:g},{x:P,y:E},{x,y:E},{x,y:m}],cost:h+Math.abs(y)+Math.abs(S)})}}return p}const ms=30;function oh(e,t){for(let n=1;n<e.length-2;n++){const i=e[n],r=e[n+1],o=pt(i.y,r.y)&&!pt(i.x,r.x),a=pt(i.x,r.x)&&!pt(i.y,r.y);if(!(!o&&!a))for(const s of t)if(o){const c=Math.min(i.x,r.x);if(Math.max(i.x,r.x)<=s.x||c>=s.x+s.width)continue;if(Math.abs(i.y-s.y)<ms||Math.abs(i.y-(s.y+s.height))<ms)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)<ms||Math.abs(i.x-(s.x+s.width))<ms)return!0}}return!1}const gs=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-gs,a=r.x+r.width+gs,s=r.y-gs,c=r.y+r.height+gs;for(let u=1;u<e.length-2;u++){const l=e[u],p=e[u+1],f={x:Math.min(l.x,p.x),y:Math.min(l.y,p.y)},d={x:Math.max(l.x,p.x),y:Math.max(l.y,p.y)};if(f.x<a&&d.x>o&&f.y<c&&d.y>s){i++;break}}}return i}function ah(e,t){if(e.type!=="bpmn:SequenceFlow")return null;const n=t.shapes.filter(C=>C.container),i=new Map(t.shapes.map(C=>[C.id,C])),r=ai(t),o=t.edges.filter(C=>C.id!==e.id),a=Si(e,o),s=Ci(e,o),c=C=>BE(C,t.shapes,e.endpoints)+(oh(C,n)?1:0),u=c(e.waypoints),l=C=>{if(!C)return;const D=C.x+C.width/2,T=C.y+C.height/2;return n.find(N=>N.type==="bpmn:Lane"&&D>=N.x&&D<=N.x+N.width&&T>=N.y&&T<=N.y+N.height)},p=l(i.get(e.endpoints[0]??"")),f=l(i.get(e.endpoints[1]??"")),d=!!p&&!!f&&p.id!==f.id,g=C=>{if(!d||!f)return!1;for(let D=1;D<C.length-2;D++){const T=C[D],N=C[D+1];if(pt(T.y,N.y)&&!pt(T.x,N.x)&&T.y>f.y&&T.y<f.y+f.height)return!0}return!1},h=g(e.waypoints),E=(C=>{if(!C)return;const D=C.x+C.width/2,T=C.y+C.height/2;return n.filter(N=>N.type==="bpmn:Participant"&&D>=N.x&&D<=N.x+N.width&&T>=N.y&&T<=N.y+N.height).sort((N,k)=>N.width*N.height-k.width*k.height)[0]})(i.get(e.endpoints[0]??"")),y=C=>{if(!E)return 0;let D=0;for(let T=1;T<C.length-1;T++){const N=C[T];(N.x<E.x||N.x>E.x+E.width||N.y<E.y||N.y>E.y+E.height)&&D++}return D},x=y(e.waypoints);if(!oh(e.waypoints,n)&&!(d&&!h)&&x===0)return null;const S=C=>C.reduce((D,T,N)=>N?D+Math.abs(T.x-C[N-1].x)+Math.abs(T.y-C[N-1].y):0,0);let P;for(const{pts:C,cost:D}of rh(e,i)){const T={...e,waypoints:C};if(Sn(T,r).length>0)continue;const N=Si(T,o);if(N>a)continue;const k=y(C);if(k>x)continue;const O=k<x&&N===0;if(!O&&Ci(T,o)>s)continue;const F=c(C),oe=g(C);if(!O&&!(oe&&!h)&&F>=u)continue;const We=oe?0:1,Y=S(C);(!P||k<P.out||k===P.out&&(We<P.lane||We===P.lane&&(N<P.opp||N===P.opp&&(F<P.sc||F===P.sc&&(D<P.cost||D===P.cost&&Y<P.len)))))&&(P={pts:C,out:k,sc:F,lane:We,opp:N,cost:D,len:Y})}return(P==null?void 0:P.pts)??null}function $E(e,t){const{elementRegistry:n}=e,i=e.modeling,r=yt(n).edges.filter(o=>!t.has(o.id)&&o.waypoints.length>=4).map(o=>o.id).sort();for(const o of r){const a=yt(n),s=a.edges.find(d=>d.id===o);if(!s||s.waypoints.length<4)continue;const c=ai(a),u=a.edges.filter(d=>d.id!==o),l=Sn(s,c).length,p=Si(s,u),f=Ci(s,u);for(const d of tl(s,a.shapes)){if(d.length>=s.waypoints.length)continue;const g={...s,waypoints:d};if(Sn(g,c).length>l||Si(g,u)>p||Ci(g,u)>f)continue;const h=n.get(o);h&&i.updateWaypoints(h,d);break}}}function sh(e,t){const{elementRegistry:n}=e,i=e.modeling,r=yt(n).edges.filter(o=>o.type==="bpmn:SequenceFlow"&&!t.has(o.id)).map(o=>o.id).sort();for(const o of r){const a=yt(n),s=a.edges.find(l=>l.id===o);if(!s)continue;const c=ah(s,a);if(!c)continue;const u=n.get(o);u&&i.updateWaypoints(u,c)}}function jE(e,t){const n=e.waypoints;if(n.length<3)return[];const i=[],r=t.get(e.endpoints[0]??""),o=t.get(e.endpoints[1]??""),a=pt(n[0].x,n[1].x)&&!pt(n[0].y,n[1].y),s=pt(n[n.length-1].x,n[n.length-2].x)&&!pt(n[n.length-1].y,n[n.length-2].y);for(const c of Tr){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 FE(e,t){if(e.type!=="bpmn:SequenceFlow")return[];const n=t.get(e.endpoints[0]??""),i=t.get(e.endpoints[1]??"");if(!n||!i)return[];const r=Math.max(n.x,i.x),o=Math.min(n.x+n.width,i.x+i.width);if(o-r<1)return[];const a=i.y+i.height<=n.y,s=n.y+n.height<=i.y;if(!a&&!s)return[];const c=a?n.y:n.y+n.height,u=a?i.y+i.height:i.y,l=(r+o)/2,p=[];for(const f of[0,...Tr]){const d=l+f;d<=r||d>=o||p.push({pts:[{x:d,y:c},{x:d,y:u}],cost:Math.abs(f)})}return p}function ch(e,t){const n=new Map(t.shapes.map(d=>[d.id,d])),i=ai(t),r=t.edges.filter(d=>d.id!==e.id),o=Si(e,r);if(o===0)return null;const a=Ci(e,r);let s;const c=d=>d.reduce((g,h,m)=>m?g+Math.abs(h.x-d[m-1].x)+Math.abs(h.y-d[m-1].y):0,0),u=3,l=d=>{const g=d[0],h=d[d.length-1],m=Math.hypot(h.x-g.x,h.y-g.y);return m>=1&&c(d)/m>=u?1:0},p=l(e.waypoints),f=[...rh(e,n),...FE(e,n),...jE(e,n)];for(const{pts:d,cost:g}of f){const h={...e,waypoints:d};if(Sn(h,i).length>0)continue;const m=Si(h,r),E=Ci(h,r),y=o-m+(p-l(d));if(m>=o||E-a>y)continue;const x=c(d);(!s||m<s.opposite||m===s.opposite&&(E<s.cross||E===s.cross&&(g<s.cost||g===s.cost&&x<s.len)))&&(s={pts:d,opposite:m,cross:E,cost:g,len:x})}return(s==null?void 0:s.pts)??null}function uh(e,t,n){const{elementRegistry:i}=e,r=e.modeling,o=yt(i),a=Pi(o).filter(l=>(l.kind==="edge-overlap-opposite"||l.kind==="edge-overlap-mixed")&&!t.has(Ei(l)));if(!a.length)return;const s=new Set;for(const l of a)if(!(l.kind!=="edge-overlap-opposite"&&l.kind!=="edge-overlap-mixed"))for(const p of l.edges)n.has(p)||s.add(p);const c=l=>{var p;return((p=o.edges.find(f=>f.id===l))==null?void 0:p.type)??""},u=[...s].sort((l,p)=>{const f=c(l)==="bpmn:SequenceFlow"?0:1,d=c(p)==="bpmn:SequenceFlow"?0:1;return f!==d?f-d:l.localeCompare(p)});for(const l of u){const p=yt(i),f=p.edges.find(h=>h.id===l);if(!f)continue;const d=ch(f,p);if(!d)continue;const g=i.get(l);g&&r.updateWaypoints(g,d)}}const HE=10,zE=(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 lh(e,t){const n=e.label;if(!n)return null;const i=t.edges.filter(a=>a.id!==e.id);if(!fs(e,i))return null;const r=ai(t),o=i.flatMap(fn);for(const a of fn(e)){let s=[[a.lo,a.hi]];for(const[d,g]of ps(a,o))s=s.flatMap(([h,m])=>{const E=[];return d>h&&E.push([h,Math.min(m,d)]),g<m&&E.push([Math.max(h,g),m]),E.filter(([y,x])=>x>y)});const c=a.axis==="h"?n.width:n.height,u=s.find(([d,g])=>g-d>=c+HE*2);if(!u)continue;const l=(u[0]+u[1])/2,p=a.axis==="h"?{x:l,y:a.at-Id}:{x:a.at+Rn+n.width/2,y:l},f={x:p.x-n.width/2,y:p.y-n.height/2,width:n.width,height:n.height};if(!fs({...e,label:f},i)&&!r.some(d=>!e.endpoints.includes(d.id)&&zE(f,d)))return f}return null}const Rn=8;function ph(e,t){const n=e.label;if(!n)return null;const i=fn(e);if(!i.length)return null;const r=n.x+n.width/2,o=n.y+n.height/2,a=f=>{const d=f.axis==="h"?r:o,g=f.axis==="h"?o-f.at:r-f.at,h=d<f.lo?f.lo-d:d>f.hi?d-f.hi:0;return Math.hypot(g,h)},s=i.reduce((f,d)=>a(d)<a(f)?d:f,i[0]),c=[...i,...t.edges.filter(f=>f.id!==e.id).flatMap(fn),...t.shapes.filter(f=>f.container).flatMap(Yo)],u=f=>!c.some(d=>Ri(f,d));if(u(n))return null;const l=(s.axis==="v"?n.height:n.width)+Rn,p=[0,-l,l,-2*l,2*l];if(s.axis==="v")for(const f of[s.at+Rn,s.at-Rn-n.width])for(const d of p){const g=n.y+d;if(g<s.lo||g+n.height>s.hi)continue;const h={...n,x:f,y:g};if(u(h))return h}else for(const f of[s.at-Rn-n.height,s.at+Rn])for(const d of p){const g=n.x+d;if(g<s.lo||g+n.width>s.hi)continue;const h={...n,x:g,y:f};if(u(h))return h}return null}function fh(e,t){const{elementRegistry:n}=e,i=e.modeling,r=yt(n);for(const o of r.edges){if(!o.label||t.has(o.id))continue;const a=ph(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 dh(e,t,n){const{elementRegistry:i}=e,r=e.modeling,o=yt(i),a=Pi(o).filter(s=>s.kind==="label-on-shared-segment"&&!t.has(Ei(s)));for(const s of a){if(s.kind!=="label-on-shared-segment"||n.has(s.edge))continue;const c=o.edges.find(f=>f.id===s.edge);if(!c)continue;const u=lh(c,o);if(!u)continue;const l=i.get(s.edge),p=l==null?void 0:l.label;p&&r.moveElements([p],{x:u.x-p.x,y:u.y-p.y})}}function hh(e,t){const n=e.label;if(!n)return null;const i=[...t.edges.flatMap(fn),...t.shapes.filter(f=>f.container).flatMap(Yo)],r=i.filter(f=>Ri(n,f));if(!r.length)return null;const o=t.shapes.filter(f=>!f.container&&f.id!==e.id),a=so(t).filter(f=>f.owner!==e.id).map(f=>f.rect),s=(f,d)=>f.x<d.x+d.width&&d.x<f.x+f.width&&f.y<d.y+d.height&&d.y<f.y+f.height,c=f=>!i.some(d=>Ri(f,d))&&!o.some(d=>s(f,d))&&!a.some(d=>s(f,d)),u=[];for(const f of r)f.axis==="h"?u.push({...n,y:f.at-Rn-n.height},{...n,y:f.at+Rn}):u.push({...n,x:f.at-Rn-n.width},{...n,x:f.at+Rn});const l=e.x+e.width/2,p=e.y+e.height/2;return u.push({...n,x:l-n.width/2,y:e.y+e.height+Rn},{...n,x:l-n.width/2,y:e.y-Rn-n.height},{...n,x:e.x+e.width+Rn,y:p-n.height/2},{...n,x:e.x-Rn-n.width,y:p-n.height/2}),u.find(c)??null}function mh(e,t){const{elementRegistry:n}=e,i=e.modeling,r=yt(n);for(const o of r.shapes){if(o.container||!o.label||t.has(o.id))continue;const a=hh(o,yt(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 GE=/^[\p{L}_][\p{L}\p{N}_.\-]*$/u,gh=new Set(["sequenceFlow","messageFlow","dataAssociation","association"]),yh={"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}]},ys=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),nl=e=>typeof e=="string"&&e!=="";function VE(e){const t=[];function n(i,r,o,a){if(a===null){nl(o)||t.push({kind:"payload-invalid",opIndex:i,field:r});return}if(!ys(o)){t.push({kind:"payload-invalid",opIndex:i,field:r});return}for(const s of a)nl(o[s])||t.push({kind:"payload-invalid",opIndex:i,field:`${r}.${s}`})}return e.forEach((i,r)=>{if(!ys(i)||!nl(i.kind)||!(i.kind in yh)){t.push({kind:"payload-invalid",opIndex:r,field:"kind"});return}for(const o of yh[i.kind]){const a=o.path.endsWith("[]"),s=a?o.path.slice(0,-2):o.path,c=s.split(".");let u=i;for(const p of c.slice(0,-1)){if(!ys(u))break;u=u[p]}if(!ys(u))continue;const l=u[c[c.length-1]];if(!(l===void 0&&o.optional)&&!(l===null&&o.optional)){if(!a){n(r,o.path,l,o.shape);continue}if(!Array.isArray(l)){t.push({kind:"payload-invalid",opIndex:r,field:o.path});continue}l.forEach((p,f)=>n(r,`${s}[${f}]`,p,o.shape))}}if(i.kind==="node.add"||i.kind==="node.update"){const o=i.band;o!==void 0&&(!Number.isInteger(o)||o<0)&&t.push({kind:"payload-invalid",opIndex:r,field:"band"})}}),t}function vh(e,t){const n=VE(e);if(n.length>0)return n;const i=[],r=new Map,o=new Map;function a(f,d,g){if(!GE.test(d)){i.push({kind:"id-invalid",opIndex:f,id:d});return}if(t.categoryOf(d)!==void 0||r.has(d)){i.push({kind:"id-duplicate",opIndex:f,id:d});return}r.set(d,{...g,opIndex:f})}e.forEach((f,d)=>{var g;switch(f.kind){case"participant.add":a(d,f.participant.id,{category:"participant",lanes:(f.participant.lanes??[]).map(h=>h.id)});for(const h of f.participant.lanes??[])a(d,h.id,{category:"lane"});break;case"node.add":a(d,f.node.id,{category:"flowNode",participant:f.node.participant});break;case"sequenceFlow.add":a(d,f.flow.id,{category:"sequenceFlow"});break;case"messageFlow.add":a(d,f.flow.id,{category:"messageFlow"});break;case"dataStore.add":a(d,f.dataStore.id,{category:"dataStore"});for(const h of f.associations??[])h.id&&a(d,h.id,{category:"dataAssociation"});break;case"dataAssociation.add":f.association.id&&a(d,f.association.id,{category:"dataAssociation"});break;case"association.add":f.association.id&&a(d,f.association.id,{category:"association"});break;case"annotation.add":a(d,f.annotation.id,{category:"annotation"}),(g=f.association)!=null&&g.id&&a(d,f.association.id,{category:"association"});break;case"group.add":a(d,f.group.id,{category:"group"});break;case"participant.update":if(f.lanes){o.set(f.id,f.lanes.map(h=>h.id));for(const h of f.lanes)t.categoryOf(h.id)===void 0&&a(d,h.id,{category:"lane"})}break}});const s=f=>{var d;return((d=r.get(f))==null?void 0:d.category)??t.categoryOf(f)},c=f=>{const d=r.get(f);return d?d.category==="participant"?f:d.participant:t.categoryOf(f)==="participant"?f:t.participantOf(f)};function u(f,d,g,h){const m=s(d);if(m===void 0){i.push({kind:"ref-missing",opIndex:f,ref:d,role:g});return}if(h&&!h.includes(m)){i.push({kind:"ref-category",opIndex:f,ref:d,role:g,expected:h.join("|"),actual:m});return}return m}const l=t.isCollaboration()||e.some(f=>f.kind==="participant.add");return e.forEach((f,d)=>{var g;switch(f.kind){case"participant.add":break;case"node.add":{const{participant:h,lane:m}=f.node;if(h===void 0){(l||m!==void 0)&&i.push({kind:"participant-required",opIndex:d,id:f.node.id});break}if(u(d,h,"participant",["participant"])===void 0)break;m!==void 0&&((((g=r.get(h))==null?void 0:g.lanes)??o.get(h)??t.lanesOf(h)).includes(m)||i.push({kind:"lane-unknown",opIndex:d,lane:m,participant:h}));break}case"sequenceFlow.add":{const{id:h,source:m,target:E,name:y,condition:x}=f.flow,S=u(d,m,"source",["flowNode"]),P=u(d,E,"target",["flowNode"]);S&&P&&c(m)!==c(E)&&i.push({kind:"flow-cross-pool",opIndex:d,id:h}),y!==void 0&&x!==void 0&&i.push({kind:"condition-name-conflict",opIndex:d,id:h});break}case"messageFlow.add":{const{id:h,source:m,target:E}=f.flow,y=u(d,m,"source",["flowNode","participant"]),x=u(d,E,"target",["flowNode","participant"]);if(y&&x){const S=c(m),P=c(E);S!==void 0&&S===P&&i.push({kind:"message-flow-same-pool",opIndex:d,id:h})}break}case"dataStore.add":{for(const h of f.associations??[]){if([h.source,h.target].filter(y=>y===f.dataStore.id).length!==1){i.push({kind:"data-association-ends",opIndex:d,source:h.source,target:h.target});continue}const E=h.source===f.dataStore.id?h.target:h.source;u(d,E,"dataAssociation",["flowNode"])}break}case"dataAssociation.add":{const{source:h,target:m}=f.association,E=u(d,h,"source"),y=u(d,m,"target");if(E&&y){const x=new Set([E,y]);x.has("dataStore")&&x.has("flowNode")||i.push({kind:"data-association-ends",opIndex:d,source:h,target:m})}break}case"association.add":{const{id:h,source:m,target:E}=f.association,y=u(d,m,"source"),x=u(d,E,"target");y&&x&&y!=="annotation"&&x!=="annotation"&&i.push({kind:"association-detached",opIndex:d,annotation:h??`${m}->${E}`});break}case"annotation.add":{if(f.association){const{source:h,target:m}=f.association;if(h!==f.annotation.id&&m!==f.annotation.id)i.push({kind:"association-detached",opIndex:d,annotation:f.annotation.id});else{const E=h===f.annotation.id?m:h;u(d,E,"association")}}f.placement&&u(d,f.placement.anchor,"anchor");break}case"group.add":{for(const h of f.group.members??[]){const m=u(d,h,"member");m&&gh.has(m)&&i.push({kind:"ref-category",opIndex:d,ref:h,role:"member",expected:"shape",actual:m})}break}case"participant.update":{if(p(d,f.id,"participant")===void 0)break;if(f.lanes){const h=t.lanesOf(f.id),m=f.lanes.map(y=>y.id);for(const y of h)m.includes(y)||i.push({kind:"lane-shrink-unsupported",opIndex:d,participant:f.id,lane:y});for(const y of m)t.categoryOf(y)!==void 0&&!h.includes(y)&&i.push({kind:"id-duplicate",opIndex:d,id:y});const E=m.filter(y=>h.includes(y));E.length===h.length&&E.some((y,x)=>y!==h[x])&&i.push({kind:"lane-reorder-unsupported",opIndex:d,participant:f.id})}break}case"node.update":{if(p(d,f.id,"flowNode")===void 0)break;if(f.lane!==void 0){const h=t.participantOf(f.id);(h?o.get(h)??t.lanesOf(h):[]).includes(f.lane)||i.push({kind:"lane-unknown",opIndex:d,lane:f.lane,participant:h??""})}break}case"sequenceFlow.update":{if(p(d,f.id,"sequenceFlow")===void 0)break;if(f.name!==void 0&&f.condition!==void 0&&i.push({kind:"condition-name-conflict",opIndex:d,id:f.id}),f.source!==void 0||f.target!==void 0){const h=f.source===void 0||u(d,f.source,"source",["flowNode"])!==void 0,m=f.target===void 0||u(d,f.target,"target",["flowNode"])!==void 0,E=t.endpointsOf(f.id),y=f.source??(E==null?void 0:E.source),x=f.target??(E==null?void 0:E.target);h&&m&&y!==void 0&&x!==void 0&&new Set([c(y),c(x),c(f.id)]).size>1&&i.push({kind:"flow-cross-pool",opIndex:d,id:f.id})}break}case"messageFlow.update":p(d,f.id,"messageFlow");break;case"dataStore.update":p(d,f.id,"dataStore");break;case"annotation.update":{if(p(d,f.id,"annotation")===void 0)break;f.placement&&u(d,f.placement.anchor,"anchor");break}case"group.update":{if(p(d,f.id,"group")===void 0)break;for(const h of f.members??[]){const m=u(d,h,"member");m&&gh.has(m)&&i.push({kind:"ref-category",opIndex:d,ref:h,role:"member",expected:"shape",actual:m})}break}case"element.remove":{p(d,f.id)==="lane"&&i.push({kind:"ref-category",opIndex:d,ref:f.id,role:"target",expected:"removable",actual:"lane"});break}}}),i;function p(f,d,g){if(r.has(d)){i.push({kind:"target-added-in-batch",opIndex:f,id:d});return}const h=t.categoryOf(d);if(h===void 0){i.push({kind:"ref-missing",opIndex:f,ref:d,role:"target"});return}if(g&&h!==g){i.push({kind:"ref-category",opIndex:f,ref:d,role:"target",expected:g,actual:h});return}return h}}function bh(e){return{modeling:e.get("modeling"),bpmnFactory:e.get("bpmnFactory"),elementFactory:e.get("elementFactory"),elementRegistry:e.get("elementRegistry"),canvas:e.get("canvas"),autoPlace:e.get("autoPlace"),bpmnReplace:e.get("bpmnReplace")}}function vs(e){return`bpmn:${e[0].toUpperCase()}${e.slice(1)}`}const bs={"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]},Qt=10,_h=40,WE=10;function il(e,t,n,i,r){const o=n,a=(k,O)=>{const[F,oe]=bs[k];let _e={x:t.x+t.width/2+F*(t.width/2+o.width/2+O),y:t.y+t.height/2+oe*(t.height/2+o.height/2+O)};const We=i.x+Qt+o.width/2,Y=i.x+i.width-Qt-o.width/2,le=i.y+Qt+o.height/2,ge=i.y+i.height-Qt-o.height/2,ue={x:Math.min(Y,Math.max(We,_e.x)),y:Math.min(ge,Math.max(le,_e.y))};return(ue.x!==_e.x||ue.y!==_e.y)&&(_e=Math.abs(ue.x-(t.x+t.width/2))<(t.width+o.width)/2+Qt&&Math.abs(ue.y-(t.y+t.height/2))<(t.height+o.height)/2+Qt?{x:t.x+t.width+Qt+o.width/2,y:ue.y}:ue),_e},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=yt(e),u=k=>{var F,oe;if(!r.selfId)return!1;const O=e.get(k);return!!O&&(((F=O.source)==null?void 0:F.id)===r.selfId||((oe=O.target)==null?void 0:oe.id)===r.selfId)},l=c.edges.filter(k=>!u(k.id)).flatMap(fn),p=so(c).filter(k=>k.owner!==r.selfId).map(k=>k.rect),f=k=>({x0:k.x-o.width/2-Qt,x1:k.x+o.width/2+Qt,y0:k.y-o.height/2-Qt,y1:k.y+o.height/2+Qt}),d=k=>{const O=f(k);return s.some(F=>O.x0<F.x+F.width&&O.x1>F.x&&O.y0<F.y+F.height&&O.y1>F.y)},g=k=>{const O=f(k);return l.some(F=>F.axis==="h"?F.at>O.y0&&F.at<O.y1&&F.lo<O.x1&&F.hi>O.x0:F.at>O.x0&&F.at<O.x1&&F.lo<O.y1&&F.hi>O.y0)},h=k=>{const O=f(k);return p.some(F=>O.x0<F.x+F.width&&O.x1>F.x&&O.y0<F.y+F.height&&O.y1>F.y)},m=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}]),E=k=>{const O=f(k);return m.some(F=>F.axis==="h"?F.at>O.y0&&F.at<O.y1&&F.lo<O.x1&&F.hi>O.x0:F.at>O.x0&&F.at<O.x1&&F.lo<O.y1&&F.hi>O.y0)},y=k=>d(k)||g(k)||h(k)||E(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=Y=>Y.startsWith("top")?Y.replace(/^top/,"bottom"):Y.replace(/^bottom/,"top"),O=Y=>Y.endsWith("left")?Y.replace(/left$/,"right"):Y.replace(/right$/,"left"),F=r.placement.side,oe=[F,k(F),O(F),k(O(F)),"top","bottom","left","right","top-left","top-right","bottom-left","bottom-right"],_e=r.placement.offset??50;let We=a(F,_e);if(y(We)){const Y=new Set;for(const le of oe){if(Y.has(le))continue;Y.add(le);const ge=a(le,_e);if(x(ge)&&!y(ge)){We=ge;break}}}return We}const S=r.from,P=i.x+Qt+o.width/2,C=i.x+i.width-Qt-o.width/2,D=i.y+Qt+o.height/2,T=i.y+i.height-Qt-o.height/2;let N={x:Math.min(C,Math.max(P,S.x)),y:Math.min(T,Math.max(D,S.y))};if(y(N)){const k=(t.width+o.width)/2+Qt,F=[{x:N.x+k,y:N.y},{x:N.x-k,y:N.y},{x:N.x,y:N.y-o.height-Qt},{x:N.x,y:N.y+o.height+Qt}].filter(x).find(oe=>!y(oe));F&&(N=F)}return N}function Ut(e,t){return e.filter(n=>n.kind===t)}function xh(e,t){var Vx,Wx,Ux,qx,Yx,Kx,Xx,Zx,Qx,Jx,e0,t0,n0,i0,r0,o0,a0,s0,c0,u0,l0,p0,f0;const{modeling:n,bpmnFactory:i,elementFactory:r,elementRegistry:o,canvas:a,autoPlace:s,bpmnReplace:c}=t,u=()=>a.getRootElement(),l=v=>o.get(v),p=v=>{const R=l(v);if(!R)throw new Error(`하강 참조 해소 실패: ${v}`);return R},f=v=>{let R=v.parent;for(;R;){if(R.type==="bpmn:Participant")return R;R=R.parent}},d=new Map;for(const v of o.filter(R=>!("waypoints"in R&&R.waypoints)&&R.type!=="bpmn:Lane"&&R.type!=="label"&&typeof R.x=="number"))d.set(v.id,{x:v.x,y:v.y});const g=Ut(e,"participant.add"),h=Ut(e,"node.add"),m=Ut(e,"sequenceFlow.add"),E=Ut(e,"messageFlow.add"),y=Ut(e,"dataStore.add"),x=Ut(e,"dataAssociation.add"),S=Ut(e,"annotation.add"),P=Ut(e,"group.add"),C=new Map(h.map(v=>[v.node.id,v])),D=(v,R,A)=>{var z;const $=v.businessObject,B=(((z=$.extensionElements)==null?void 0:z.values)??[]).filter(V=>V.$type!==R),I=A?[...B,i.create(R,A)]:B;if(!I.length){$.extensionElements&&n.updateProperties(v,{extensionElements:void 0});return}const G=i.create("bpmn:ExtensionElements",{values:I});I.forEach(V=>{V.$parent=G}),n.updateProperties(v,{extensionElements:G})},T=v=>({anchor:v.anchor,side:v.side,...v.offset!==void 0?{offset:v.offset}:{}});for(const v of Ut(e,"element.remove")){const R=l(v.id);R&&n.removeElements([R])}const N=v=>o.filter(R=>{var A;return R.type==="bpmn:Lane"&&((A=f(R))==null?void 0:A.id)===v}).sort((R,A)=>R.y-A.y);for(const v of Ut(e,"participant.update")){const R=p(v.id);if(v.name!==void 0&&n.updateProperties(R,{name:v.name??void 0}),!v.lanes)continue;const A=N(v.id);if(!A.length){n.splitLane(R,v.lanes.length),N(v.id).forEach((B,I)=>{const G=v.lanes[I];G&&n.updateProperties(B,{id:G.id,name:G.name})});continue}const $=new Set(A.map(B=>B.id));v.lanes.forEach((B,I)=>{if($.has(B.id)){n.updateProperties(p(B.id),{name:B.name});return}const G=I===0?n.addLane(N(v.id)[0],"top"):n.addLane(p(v.lanes[I-1].id),"bottom");n.updateProperties(G,{id:B.id,name:B.name})})}const k=150,O=130,F=80,oe=90,_e=180,We=30,Y=(v,R,A,$,B)=>{const I=A-R.width/2,G=$-R.height/2;return(v.children??[]).find(z=>!("waypoints"in z&&z.waypoints)&&z.type!=="bpmn:Lane"&&z.type!=="label"&&!(B!=null&&B.has(z.id))&&typeof z.x=="number"&&I<z.x+z.width+We&&I+R.width+We>z.x&&G<z.y+z.height&&G+R.height>z.y)},le=new Set;for(const v of g){le.add(`pool:${v.participant.id}`);for(const R of v.participant.lanes??[])le.add(R.id)}const ge=new Map;for(const v of h){const R=v.node.lane??`pool:${v.node.participant??""}`;let A=ge.get(R);A||ge.set(R,A=new Set([0])),v.band!==void 0&&A.add(v.band)}const ue=new Map;for(const[v,R]of ge){if(!le.has(v))continue;const A=[...R].sort((I,G)=>I-G),$=A.map((I,G)=>G===0?0:G%2===1?Math.ceil(G/2):-(G/2)),B=Math.min(...$);ue.set(v,new Map(A.map((I,G)=>[I,$[G]-B])))}{const v=new Map;for(const R of g)(R.participant.lanes??[]).forEach((A,$)=>v.set(A.id,$));for(const[R,A]of ue){if(!v.has(R)||A.size<2)continue;const $=v.get(R),B=A.get(0)??0,I=new Set;for(const ie of h){if(ie.node.lane!==R||(ie.band??0)!==0||!ie.node.type.endsWith("Gateway"))continue;const Me={in:new Set,out:new Set,cross:new Set};for(const ce of m){const we=ce.flow.source===ie.node.id;if(!we&&ce.flow.target!==ie.node.id)continue;const at=C.get(we?ce.flow.target:ce.flow.source);if(!at||at.node.participant!==ie.node.participant||!at.node.lane)continue;let se,ve=!1;if(at.node.lane!==R){const me=v.get(at.node.lane);if(me===void 0)continue;se=me>$?"down":"up",ve=!0}else{const me=A.get(at.band??0)??B;se=me>B?"down":me<B?"up":void 0}se&&(Me[we?"out":"in"].add(se),ve&&Me.cross.add(se))}for(const ce of["up","down"])Me.in.has(ce)&&Me.out.has(ce)&&Me.cross.has(ce)&&I.add(ce)}if(I.size!==1)continue;const[G]=I,z=Math.max(...A.values()),V=G==="down"?z:0;if(B===V)continue;const X=[...A.entries()].filter(([ie])=>ie!==0).sort((ie,Me)=>ie[1]-Me[1]),pe=[...Array(z+1).keys()].filter(ie=>ie!==V),xe=new Map([[0,V]]);X.forEach(([ie],Me)=>xe.set(ie,pe[Me])),ue.set(R,xe)}}const Re=v=>{var R;return(((R=ge.get(v))==null?void 0:R.size)??0)>1},re=v=>v.band??(v.node.lane||!Re(`pool:${v.node.participant??""}`)?void 0:0),q=new Map,U=v=>q.get(v.node.id)??re(v),Z=new Set,He=new Set;{const v=new Map;for(const $ of m)v.set($.flow.target,(v.get($.flow.target)??0)+1);const R=$=>{const B=[],I=new Set([$]),G=[$];for(;G.length;){const z=G.shift();B.push(z);for(const V of m)V.flow.source!==z||I.has(V.flow.target)||(v.get(V.flow.target)??0)!==1||(I.add(V.flow.target),G.push(V.flow.target))}return B},A=($,B)=>{var I;return((I=ue.get($))==null?void 0:I.get(B))??B};for(const $ of h){if(!$.node.type.endsWith("Gateway"))continue;const B=$.node.lane??`pool:${$.node.participant??""}`,I=ue.get(B);if(!I||I.size<2)continue;const G=U($);if(G===void 0||A(B,G)!==A(B,0))continue;const z=A(B,G),V=m.filter(ce=>ce.flow.source===$.node.id).map(ce=>C.get(ce.flow.target)).filter(ce=>!!ce&&(ce.node.lane??`pool:${ce.node.participant??""}`)===B),X=V.filter(ce=>{const we=U(ce);return we!==void 0&&A(B,we)===z&&(v.get(ce.node.id)??0)===1}),pe=V.some(ce=>{const we=U(ce);return we!==void 0&&A(B,we)>z});if(X.length!==1||!pe)continue;const xe=new Set(V.flatMap(ce=>R(ce.node.id)));if(!m.some(ce=>ce.flow.target===$.node.id&&xe.has(ce.flow.source)))continue;const Me=new Map;for(const[ce,we]of I)Me.set(ce,we+1);Me.set(-1,0),ue.set(B,Me);for(const ce of R(X[0].node.id))C.has(ce)&&(q.set(ce,-1),He.add(ce));Z.add($.node.id)}}const wt=(v,R)=>{var A;return((A=ue.get(v))==null?void 0:A.get(R))??R},M=new Map;for(const[v,R]of ge){let A=0;for(const $ of R)A=Math.max(A,wt(v,$));M.set(v,A)}const w=v=>_e+k*v,b=(v,R,A)=>{const $=u().children.filter(B=>!("waypoints"in B&&B.waypoints)&&B.id!==R&&typeof B.y=="number"&&B.y>=v);$.length&&n.moveElements($,{x:0,y:A})},j=(v,R,A)=>{if(v){const G=p(v),z=w(R);if(G.height>=z)return;const V=z-G.height,X=f(G),pe=X?X.y+X.height:G.y+G.height;n.resizeLane(G,{x:G.x,y:G.y,width:G.width,height:z},!1),b(pe,X==null?void 0:X.id,V);return}if(!A)return;const $=k*(R+1);if(A.height>=$)return;const B=$-A.height,I=A.y+A.height;n.resizeShape(A,{x:A.x,y:A.y,width:A.width,height:$}),b(I,A.id,B)},W=g.map((v,R)=>({op:v,declared:R}));W.sort((v,R)=>{const A=v.op.order??Number.POSITIVE_INFINITY,$=R.op.order??Number.POSITIVE_INFINITY;return A!==$?A-$:v.declared-R.declared});let K=80;for(const v of o.getAll())v.parent===u()&&"height"in v&&typeof v.y=="number"&&(K=Math.max(K,v.y+v.height+60));for(const{op:v}of W){const R=v.participant,A=h.filter(ie=>ie.node.participant===R.id).length,$=((Vx=R.lanes)==null?void 0:Vx.length)??0,B=Math.max(1200,A*160+300),I=(R.lanes??[]).map(ie=>w(M.get(ie.id)??0)),G=I.reduce((ie,Me)=>ie+Me,0);$&&G<300&&(I[$-1]+=300-G);const z=Math.max(300,k*((M.get(`pool:${R.id}`)??0)+1)),V=R.blackBox||A+$===0?120:$?Math.max(300,G):z,X=r.createShape({type:"bpmn:Participant",businessObject:i.create("bpmn:Participant",{id:R.id,name:R.name,...v.order!==void 0?{"bwl:poolOrder":v.order}:{},...R.blackBox?{}:{processRef:i.create("bpmn:Process")}}),width:B,height:V,isExpanded:!0}),pe=n.createShape(X,{x:100+B/2,y:K+V/2},u()),xe=R.lanes??[];if(xe.length&&n.splitLane(pe,xe.length),xe.length){const ie=o.filter(Me=>{var ce;return Me.type==="bpmn:Lane"&&((ce=f(Me))==null?void 0:ce.id)===R.id}).sort((Me,ce)=>Me.y-ce.y);if(ie.forEach((Me,ce)=>{const we=xe[ce];we&&n.updateProperties(Me,{id:we.id,name:we.name})}),I.some(Me=>Me!==pe.height/$)){let Me=pe.y;ie.forEach((ce,we)=>{const at=I[we];n.resizeShape(ce,{x:ce.x,y:Me,width:ce.width,height:at}),Me+=at})}}K=pe.y+pe.height+60}const ye=v=>{var $;const R=C.get(v);if(R)return R.node.participant??"";const A=l(v);return A?A.type==="bpmn:Participant"?A.id:(($=f(A))==null?void 0:$.id)??"":""},Ie=new Map,Xe=v=>{let R=Ie.get(v);return R||Ie.set(v,R={nodes:[],flows:[]}),R};for(const v of h)Xe(v.node.participant??"").nodes.push(v);for(const v of m)Xe(ye(v.flow.source)).flows.push(v);const Et=v=>{var R;return i.create("bpmn:SequenceFlow",{id:v.id,name:v.name??((R=v.condition)==null?void 0:R.label)})},nt=(v,R)=>r.createShape({type:vs(v.type),businessObject:i.create(vs(v.type),{id:v.id,name:v.name,...R!==void 0?{"bwl:band":R}:{}})}),Ht=[...W.map(({op:v})=>v.participant.id).filter(v=>Ie.has(v)),...[...Ie.keys()].filter(v=>!g.some(R=>R.participant.id===v))],Xt=v=>v.endsWith("Gateway");for(const v of Ht){const R=Ie.get(v),A=v?p(v):void 0,$=A?A.x+150:250;let B=A?A.y+80:120;const I=(se,ve,me)=>{if(se){const Ae=p(se);return Ae.y+Math.min(Ae.height/2,oe)+wt(se,ve??0)*k}return ve!==void 0&&A?A.y+F+wt(`pool:${v}`,ve)*k:me},G=(se,ve,me)=>{if(se){const Ae=p(se);return Ae.y+Math.min(Ae.height/2,oe)+ve*k}return A?A.y+F+ve*k:me},z=se=>se.participant?p(se.participant):u(),V=(se,ve,me,Ae,it,Qe)=>{const Yt=me!==void 0||Ae!==void 0,_n=wt(me??`pool:${v}`,Ae??0);if(Yt)for(let ne=0;ne<4;ne++){const ee=G(me,_n+ne,Qe);if(!Y(se,ve,it,ee))return j(me,_n+ne,A),{x:it,y:ee}}const Ee=I(me,Ae,Qe);Yt&&j(me,_n,A);let Je=it;for(let ne=0;ne<64;ne++){const ee=Y(se,ve,Je,Ee);if(!ee)break;Je=ee.x+ee.width+O+ve.width/2}return{x:Je,y:Ee}},X=new Set(R.flows.map(se=>se.flow.target)),pe=new Map;for(const se of R.nodes){if(X.has(se.node.id))continue;const ve=nt(se.node,se.band),me=re(se),Ae=se.node.lane?`${se.node.lane}|${me??""}`:me!==void 0?`band:${me}`:"",it=z(se.node),Qe=V(it,ve,se.node.lane,me,pe.get(Ae)??$,B);n.createShape(ve,Qe,it),pe.set(Ae,Qe.x+ve.width+O),!se.node.lane&&me===void 0&&(B+=160)}const xe=new Set,ie=new Map,Me=new Map,ce=new Map;if(v&&le.has(`pool:${v}`)){const se=new Map;for(const Ee of R.flows)se.set(Ee.flow.target,(se.get(Ee.flow.target)??0)+1);const ve=Ee=>I(Ee.node.lane,U(Ee),Number.NaN),me=new Set,Ae=Ee=>{var ee;const Je=(ee=C.get(Ee))==null?void 0:ee.node.participant;if(Je)return l(Je);const ne=l(Ee);if(ne)return ne.type==="bpmn:Participant"?ne:f(ne)},it=Ee=>{const Je=[],ne=new Set([Ee]),ee=[Ee];for(;ee.length;){const be=ee.shift(),Te=C.get(be);Te&&Je.push(Te);for(const Se of R.flows)Se.flow.source!==be||ne.has(Se.flow.target)||(se.get(Se.flow.target)??0)!==1||(ne.add(Se.flow.target),ee.push(Se.flow.target))}return Je},Qe=Ee=>{if(!A)return;const Je=new Set(Ee.map(be=>be.node.id));let ne=!1,ee=!1;for(const be of E){if(!Je.has(be.flow.source))continue;const Te=Ae(be.flow.target);!Te||Te.id===A.id||(Te.y<A.y?ne=!0:ee=!0)}return ne&&!ee?"up":ee&&!ne?"down":void 0};for(const Ee of R.nodes){if(!Xt(Ee.node.type))continue;const Je=I(Ee.node.lane,re(Ee),Number.NaN);if(Number.isNaN(Je))continue;const ne=[];for(const Se of R.flows){if(Se.flow.source!==Ee.node.id)continue;const je=C.get(Se.flow.target);if(!je||je.node.lane!==Ee.node.lane||(se.get(je.node.id)??0)!==1)continue;const tt=re(je);if(tt===void 0)continue;const Gt=I(je.node.lane,tt,Number.NaN);if(Number.isNaN(Gt))continue;const ni=it(je.node.id),Ct=Qe(ni);Ct&&ne.push({subtree:ni,band:tt,row:Gt,dir:Ct})}if(!ne.some(Se=>Se.dir==="up")||!ne.some(Se=>Se.dir==="down")||!ne.some(Se=>Se.dir==="up"&&ne.some(je=>je.dir==="down"&&je.row<Se.row)))continue;const be=[...ne].sort((Se,je)=>Se.row-je.row);[...ne.filter(Se=>Se.dir==="up"),...ne.filter(Se=>Se.dir==="down")].sort((Se,je)=>Se.dir===je.dir?Se.row-je.row:Se.dir==="up"?-1:1).forEach((Se,je)=>{const tt=be[je].band;if(tt!==Se.band){me.add(Ee.node.id);for(const Gt of Se.subtree)re(Gt)===Se.band&&q.set(Gt.node.id,tt)}})}const Yt=Ee=>{if(!A)return;const Je=new Set(Ee.map(be=>be.node.id));let ne=!1,ee=!1;for(const be of E){if(!Je.has(be.flow.target))continue;const Te=Ae(be.flow.source);!Te||Te.id===A.id||(Te.y<A.y?ne=!0:ee=!0)}return ne&&!ee?"up":ee&&!ne?"down":void 0};for(const Ee of R.nodes){if(!Xt(Ee.node.type))continue;const Je=Ee.node.lane??`pool:${v}`,ne=ue.get(Je);if(!ne||ne.size<2)continue;const ee=ne.get(0);if(ee===void 0)continue;const be=Math.max(...ne.values()),Te=ee===be&&ee!==0?"down":void 0;if(!Te)continue;const Se=[];for(const Ct of R.flows){if(Ct.flow.source!==Ee.node.id)continue;const dt=C.get(Ct.flow.target);if(!dt||dt.node.lane!==Ee.node.lane||(se.get(dt.node.id)??0)!==1)continue;const Ja=U(dt);Ja!==void 0&&Se.push({t:dt,subtree:it(dt.node.id),band:Ja})}const je=Se.find(Ct=>(ne.get(Ct.band)??Ct.band)===ee);if(!je||Yt(je.subtree)===Te||Qe(je.subtree)===Te)continue;const tt=Se.find(Ct=>Ct!==je&&Yt(Ct.subtree)===Te);if(!tt)continue;const Gt=je.band,ni=tt.band;for(const Ct of je.subtree)U(Ct)===Gt&&q.set(Ct.node.id,ni);for(const Ct of tt.subtree)U(Ct)===ni&&q.set(Ct.node.id,Gt);me.add(Ee.node.id)}for(const Ee of R.nodes){if(!Xt(Ee.node.type))continue;const Je=ve(Ee);if(Number.isNaN(Je)||S.some(Se=>{var je,tt;return(((je=Se.placement)==null?void 0:je.anchor)??(Se.association?Se.association.source===Se.annotation.id?Se.association.target:Se.association.source:void 0))===Ee.node.id&&((tt=Se.placement)==null?void 0:tt.side.startsWith("bottom"))}))continue;let ee,be=!1,Te;for(const Se of R.flows){if(Se.flow.source!==Ee.node.id)continue;const je=C.get(Se.flow.target);if(!je||!je.node.lane&&re(je)===void 0)continue;const tt=ve(je);Number.isNaN(tt)||(Math.abs(tt-Je)<.5&&(be=!0),tt>Je?!ee||tt>ee.row?ee={id:je.node.id,row:tt,count:1}:tt===ee.row&&ee.count++:tt<Je&&je.node.lane===Ee.node.lane&&(!Te||tt>Te.row?Te={op:je,row:tt,count:1}:tt===Te.row&&Te.count++))}ee&&ee.count===1&&(se.get(ee.id)??0)===1&&!me.has(Ee.node.id)&&xe.add(ee.id),!be&&Te&&Te.count===1&&(se.get(Te.op.node.id)??0)===1&&!Z.has(Ee.node.id)&&ie.set(Te.op.node.id,{lane:Ee.node.lane,band:U(Ee)})}const _n=new Map;for(const Ee of E)_n.set(Ee.flow.target,[..._n.get(Ee.flow.target)??[],Ee]);for(const Ee of R.nodes){const Je=_n.get(Ee.node.id);if(!Je||Je.length!==1||!se.get(Ee.node.id)||!Ee.node.lane&&re(Ee)===void 0||He.has(Ee.node.id))continue;const ne=(Wx=C.get(Je[0].flow.source))==null?void 0:Wx.node.participant,ee=ne?l(ne):void 0;if(!ee||!A||ee.id===A.id)continue;const be=Ee.node.lane??`pool:${v}`,Te=ue.get(be);if(!Te)continue;const Se=Te.get(0)??0,je=(Te.get(U(Ee)??0)??Se)-Se;if(je===0)continue;const tt=ee.y<A.y;if(tt&&je<0||!tt&&je>0)continue;let Gt;for(const[ni,Ct]of Te){const dt=Ct-Se;(tt&&dt<0&&(!Gt||dt<Gt.row)||!tt&&dt>0&&(!Gt||dt>Gt.row))&&(Gt={band:ni,row:dt})}Gt&&Me.set(Ee.node.id,{lane:Ee.node.lane,band:Gt.band})}}const we=new Set;let at=0;for(;at++<R.nodes.length+2;){for(let me=0;me<R.nodes.length+R.flows.length+2;me++){let Ae=!1;for(const it of R.flows){const Qe=it.flow;if(we.has(Qe.id))continue;const Yt=l(Qe.source);if(!Yt)continue;const _n=l(Qe.target),Ee=C.get(Qe.target);if(!_n&&Ee){const Je=nt(Ee.node,Ee.band),ne=U(Ee);if(Ee.node.lane||ne!==void 0){const ee=z(Ee.node),be=Yt,Te=be.x+(ce.get(Qe.source)??0)+be.width+O,Se=ie.get(Qe.target)??Me.get(Qe.target),je=V(ee,Je,Se?Se.lane:Ee.node.lane,Se?Se.band:ne,xe.has(Qe.target)?be.x+be.width/2:Te,Number.NaN),tt=n.createShape(Je,je,ee);xe.has(Qe.target)&&ce.set(Qe.target,Te-(tt.x+tt.width/2)),n.connect(Yt,tt,{type:"bpmn:SequenceFlow",businessObject:Et(Qe)})}else s.append(Yt,Je,{connection:{type:"bpmn:SequenceFlow",businessObject:Et(Qe)}})}else if(_n)n.connect(Yt,_n,{type:"bpmn:SequenceFlow",businessObject:Et(Qe)});else continue;we.add(Qe.id),Ae=!0}if(!Ae)break}const se=R.nodes.filter(me=>!l(me.node.id));if(!se.length)break;const ve=se[0];{const me=nt(ve.node,ve.band),Ae=z(ve.node),it=re(ve);n.createShape(me,V(Ae,me,ve.node.lane,it,$,B),Ae),!ve.node.lane&&it===void 0&&(B+=160)}}}const ln=40,et=(v,R=()=>!0)=>{const A=l(v);if(!A)return[];const $=[A],B=new Set([v]);for(let I=0;I<$.length;I++){const G=$[I].id;for(const z of m){const V=z.flow.target;if(z.flow.source!==G||B.has(V)||!C.has(V))continue;B.add(V);const X=l(V);X&&R(X)&&$.push(X)}}return $},zt=(v,R=()=>!0)=>{const A=l(v);if(!A)return[];const $=[A],B=new Set([v]);for(let I=0;I<$.length;I++){const G=$[I].id;for(const z of m){const V=z.flow.source;if(z.flow.target!==G||B.has(V)||!C.has(V))continue;B.add(V);const X=l(V);X&&R(X)&&$.push(X)}}return $},Zt=30,Wi=v=>!("waypoints"in v&&v.waypoints)&&v.type!=="bpmn:Lane"&&v.type!=="label"&&typeof v.x=="number",vn=(v,R)=>{const A=new Set(v.flatMap(G=>G.subtree.map(z=>z.id)));for(const G of v){const z=(G.pool.children??[]).filter(Wi).filter(X=>!A.has(X.id));if(G.subtree.some(X=>z.some(pe=>X.x+R<pe.x+pe.width+Zt&&X.x+R+X.width+Zt>pe.x&&X.y<pe.y+pe.height&&X.y+X.height>pe.y)))return null}const $=v.map(G=>G.pool.width),B=o.filter(G=>G.type==="label").map(G=>({label:G,x:G.x,y:G.y}));n.moveElements(v.flatMap(G=>G.subtree),{x:R,y:0});const I=v.map(G=>{const V=Math.max(...G.subtree.map(X=>X.x+X.width))+150-(G.pool.x+G.pool.width);return V>0&&n.resizeShape(G.pool,{x:G.pool.x,y:G.pool.y,width:G.pool.width+V,height:G.pool.height}),V});return()=>{n.moveElements(v.flatMap(G=>G.subtree),{x:-R,y:0}),v.forEach((G,z)=>{I[z]>0&&n.resizeShape(G.pool,{x:G.pool.x,y:G.pool.y,width:$[z],height:G.pool.height})});for(let G=0;G<3;G++){let z=0;for(const V of B){const X=V.x-V.label.x,pe=V.y-V.label.y;Math.abs(X)<=.5&&Math.abs(pe)<=.5||(n.moveElements([V.label],{x:X,y:pe}),z++)}if(!z)break}}},ti=()=>{const v=yt(o),R=A=>A.length>=2&&(A.every($=>Math.abs($.x-A[0].x)<.01)||A.every($=>Math.abs($.y-A[0].y)<.01));return{messages:v.edges.filter(A=>A.type==="bpmn:MessageFlow"&&A.waypoints.length===2).length,lines:v.edges.filter(A=>R(A.waypoints)).length}},Zn=v=>{const R=B=>{const I=[B],G=new Set([B.id]);for(let z=0;z<I.length;z++)for(const V of I[z].outgoing??[]){if(V.type!=="bpmn:SequenceFlow")continue;const X=V.target;!X||G.has(X.id)||v.has(X.id)||!Wi(X)||X.x<B.x||(G.add(X.id),I.push(X))}return I},A=new Set(v),$=[];for(const B of o.getAll()){if(B.type!=="bpmn:MessageFlow")continue;const I=B;if(!I.waypoints||I.waypoints.length!==2)continue;const G=I.source,z=I.target;if(!G||!z)continue;const V=v.has(G.id);if(V===v.has(z.id))continue;const X=V?z:G,pe=f(X);if(!pe||A.has(X.id))continue;const xe=R(X).filter(ie=>!A.has(ie.id));if(xe.length){for(const ie of xe)A.add(ie.id);$.push({subtree:xe,pool:pe})}}return $};for(const v of Ut(e,"sequenceFlow.update")){if(v.target===void 0)continue;const R=C.get(v.target);if(!R)continue;const A=l(v.target),$=l(v.id);if(!A||!$)continue;const B=v.source!==void 0?l(v.source):$.source,I=$.target;if(!B||!I||I.id===A.id)continue;const G=et(v.target),z=new Set(G.map(ce=>ce.id)),V=Math.min(...G.map(ce=>ce.x)),X=Math.max(...G.map(ce=>ce.x+ce.width)),pe=B.x+B.width,xe=X-V+ln*2-(I.x-pe);if(xe>0){const ce=f(A),we=(ce==null?void 0:ce.children)??[],at=me=>me.type==="bpmn:Lane",se=we.filter(me=>!("waypoints"in me&&me.waypoints)&&!at(me)&&!z.has(me.id)&&me.x>=I.x),ve=ce?[ce,...we.filter(me=>at(me))]:[];if(se.length){const me=Zn(new Set(se.map(Ae=>Ae.id)));n.createSpace(se,ve,{x:xe,y:0},"e",I.x-1);for(const Ae of me){const it=ti(),Qe=vn([Ae],xe);if(!Qe)continue;const Yt=ti();(Yt.messages<=it.messages||Yt.lines<it.lines)&&Qe()}}}const ie=R.node.lane||R.band!==void 0?A.y+A.height/2:B.y+B.height/2;n.moveElements(G,{x:pe+ln-V,y:ie-(A.y+A.height/2)});const Me=f(A);if(R.node.lane===void 0&&R.band!==void 0&&Me){const ce=Me.y+F+wt(`pool:${R.node.participant??""}`,R.band)*k,we=ce-(A.y+A.height/2);we!==0&&!Y(Me,A,A.x+A.width/2,ce,z)&&n.moveElements([A],{x:0,y:we})}}const It=(v,R)=>{const A=R.target===v,$=p(R.source),B=p(R.target),I=A?"bpmn:DataOutputAssociation":"bpmn:DataInputAssociation";n.connect($,B,R.id?{type:I,businessObject:i.create(I,{id:R.id})}:{type:I})},qr=100,Xa=v=>{for(const R of g){if(!R.participant.blackBox)continue;const A=l(R.participant.id);if(!A)continue;const $=[];for(const I of E){const G=I.flow.source===R.participant.id?I.flow.target:I.flow.target===R.participant.id?I.flow.source:void 0,z=G?l(G):void 0;z&&typeof z.x=="number"&&z.type!=="bpmn:Participant"&&$.push(z)}if(!$.length)continue;const B=Math.max(...$.map(I=>I.x+I.width/2))+qr;if(B>A.x+A.width&&n.resizeShape(A,{x:A.x,y:A.y,width:B-A.x,height:A.height}),!!v)for(const I of E){const G=l(I.flow.id),z=I.flow.source===R.participant.id?I.flow.target:I.flow.target===R.participant.id?I.flow.source:void 0,V=z?l(z):void 0;if(!G||!V||V.type==="bpmn:Participant")continue;const X=V.x+V.width/2;if(X<A.x+10||X>A.x+A.width-10)continue;const pe=A.y>V.y,xe=pe?V.y+V.height:V.y,ie=pe?A.y:A.y+A.height,Me=I.flow.source===R.participant.id?[{x:X,y:ie},{x:X,y:xe}]:[{x:X,y:xe},{x:X,y:ie}],ce=yt(o),we={...ce.edges.find(at=>at.id===I.flow.id),waypoints:Me};Sn(we,ai(ce)).length||n.updateWaypoints(G,Me)}}};Xa(!1);for(const v of E){const R=v.flow;n.connect(p(R.source),p(R.target),{type:"bpmn:MessageFlow",businessObject:i.create("bpmn:MessageFlow",{id:R.id,name:R.name})})}{const A=new Set([...m.map(V=>V.flow.id),...E.map(V=>V.flow.id)].filter(V=>!!V)),$=o.filter(V=>!!V.waypoints),B=(V,X)=>Math.abs(X.x-V.x)<2?"L":Math.abs(X.x-(V.x+V.width))<2?"R":Math.abs(X.y-V.y)<2?"T":Math.abs(X.y-(V.y+V.height))<2?"B":void 0,I=new Map,G=(V,X,pe)=>{if(!V||!X||typeof V.x!="number")return;const xe=B(V,X);if(!xe)return;let ie=I.get(V.id);ie||I.set(V.id,ie=new Map),ie.set(xe,[...ie.get(xe)??[],pe])};for(const V of $){const X=V.waypoints;!X||X.length<2||(G(V.source,X[0],{id:V.id,dir:"out"}),G(V.target,X[X.length-1],{id:V.id,dir:"in"}))}const z=new Set;for(const[V,X]of I){const pe=l(V);if(!pe||typeof pe.x!="number"||![...X.values()].some(ve=>{const me=ve.filter(Ae=>Ae.dir==="in");return ve.length>=3&&me.length>=1&&ve.some(Ae=>Ae.dir==="out")&&me.some(Ae=>A.has(Ae.id))}))continue;const ie=f(pe);if(!ie||z.has(ie.id)||(ie.children??[]).some(ve=>ve.type==="bpmn:Lane"))continue;const Me=(Ux=X.get("T"))!=null&&Ux.length?(qx=X.get("B"))!=null&&qx.length?void 0:"B":"T";if(!Me||(Me==="T"?pe.y-ie.y:ie.y+ie.height-(pe.y+pe.height))>=k)continue;const we=(ie.children??[]).filter(ve=>!("waypoints"in ve&&ve.waypoints)&&ve.type!=="label"&&typeof ve.x=="number"),at=ie.y+ie.height;n.resizeShape(ie,{x:ie.x,y:ie.y,width:ie.width,height:ie.height+k});const se=u().children.filter(ve=>!("waypoints"in ve&&ve.waypoints)&&ve.id!==ie.id&&typeof ve.y=="number"&&ve.y>=at);se.length&&n.moveElements(se,{x:0,y:k}),Me==="T"&&we.length&&n.moveElements(we,{x:0,y:k}),z.add(ie.id)}}const bn=20,Ze=4,rt=2,DD=[10,30,80],zo=()=>{const v=yt(o);return{bad:Pi(v).filter(R=>R.kind==="edge-crosses-shape"||R.kind==="edge-overlap-opposite"||R.kind==="edge-overlap-mixed").length,crossings:jd(v),straight:v.edges.filter(R=>R.type==="bpmn:MessageFlow"&&R.waypoints.length===2).length}},Go=v=>{const R=yt(o),A=R.edges.find($=>$.id===v);return A?Sn(A,ai(R)).length:0},Su=v=>Go(v)>0,Ru=v=>yt(o).edges.filter(R=>R.type==="bpmn:MessageFlow"&&R.id!==v&&R.waypoints.length===2).length,LD=(v,R,A)=>vn([{subtree:v,pool:R}],A),kx=(v,R)=>R.bad>v.bad||R.crossings>v.crossings&&R.straight<=v.straight&&R.bad>=v.bad,Cu=(v,R)=>kx(v,R)||R.straight<v.straight,Pu=(v,R,A=()=>!0,$=kx)=>{const B=zo(),I=vn(v,R);if(!I)return!1;const G=zo();return $(B,G)||!A()?(I(),!1):!0},Ox=(v,R,A,$=()=>!0)=>Pu([{subtree:v,pool:R}],A,$),Yr=v=>{var R;return!!((R=C.get(v))!=null&&R.node.participant)},Za=new Map;for(const v of E){if(!Yr(v.flow.target))continue;const R=Za.get(v.flow.target)??[];R.push(v),Za.set(v.flow.target,R)}const Kf=[...Za.keys()],Dx=new Set(m.map(v=>v.flow.target)),Lx=v=>W.findIndex(({op:R})=>R.participant.id===v);Kf.sort((v,R)=>{var B,I;const A=Dx.has(v)?1:0,$=Dx.has(R)?1:0;return A!==$?A-$:Lx((B=C.get(v))==null?void 0:B.node.participant)-Lx((I=C.get(R))==null?void 0:I.node.participant)});const Kr=v=>v.x+v.width/2,ID=v=>{const R=new Map;for(const B of o.getAll()){const I=B;if(!I.waypoints||!I.source||!I.target)continue;(R.get(I.source.id)??R.set(I.source.id,[]).get(I.source.id)).push(I.target.id)}const A=new Set([v]),$=[v];for(let B=0;B<$.length;B++)for(const I of R.get($[B])??[])A.has(I)||(A.add(I),$.push(I));return A},ND=(v,R)=>{const A=ID(R);let $;for(const B of o.getAll()){const I=B;if(I.type!=="bpmn:MessageFlow"||!I.source||!I.target||I.target.id!==v||A.has(I.source.id))continue;const G=I.source;if(typeof G.x!="number"||G.type==="bpmn:Participant")continue;const z=Kr(G);($===void 0||z>$)&&($=z)}return $},Xf=(v,R)=>{const A=l(v.flow.source);if(A)return A.type==="bpmn:Participant"?ND(A.id,R):Kr(A)},Ix=v=>{let R;for(const A of Za.get(v)??[]){const $=Xf(A,v);$!==void 0&&(!R||$>R.cx)&&(R={op:A,cx:$})}return R==null?void 0:R.op},BD=v=>{const R=Ix(v),A=l(v),$=R?Xf(R,v):void 0;return A&&$!==void 0?$-Kr(A):void 0},$D=v=>{const R=BD(v);return R!==void 0&&Math.abs(R)<bn},Nx=(v,R,A,$,B)=>{var I;for(let G=!0;G;){G=!1;for(const z of E){if(z.flow.id===A)continue;const V=R.has(z.flow.source),X=R.has(z.flow.target);if(V===X||$(V?z.flow.source:z.flow.target))continue;const pe=V?z.flow.target:z.flow.source;if(B(pe)||!Yr(pe))continue;const xe=l(z.flow.id);if(!(xe!=null&&xe.waypoints)||xe.waypoints.length!==2)continue;const ie=l(pe),Me=(I=C.get(pe))==null?void 0:I.node.participant;if(!ie||!Me)continue;const ce=et(pe,we=>we.x>=ie.x).filter(we=>!R.has(we.id));if(!(!ce.length||ce.some(we=>B(we.id)))){for(const we of ce)R.add(we.id);v.set(Me,[...v.get(Me)??[],...ce]),G=!0}}}return[...v].map(([G,z])=>({subtree:z,pool:p(G)}))},Bx=(v,R,A,$,B)=>Nx(new Map([[R,[...v]]]),new Set(v.map(I=>I.id)),$,I=>I===A,I=>I===B),Zf=v=>{const R=Ix(v);if(!R)return null;const A=l(v),$=l(R.flow.source),B=Xf(R,v);if(!A||!$||B===void 0)return null;const I=B-Kr(A);if(I>=bn){const G=C.get(v).node.participant,z=et(v,V=>V.x>=A.x);return{groups:Bx(z,G,v,R.flow.id,R.flow.source),dx:I}}if(-I>=bn&&Yr(R.flow.source)){const G=C.get(R.flow.source).node.participant,z=et(R.flow.source,V=>V.x>=$.x&&!$D(V.id));return{groups:Bx(z,G,R.flow.source,R.flow.id,v),dx:-I}}return null},$x=()=>Kf.map(v=>({id:v,plan:Zf(v)})).filter(v=>!!v.plan).sort((v,R)=>Math.min(...v.plan.groups.flatMap(A=>A.subtree.map($=>$.x)))-Math.min(...R.plan.groups.flatMap(A=>A.subtree.map($=>$.x)))).map(v=>v.id);for(let v=0;v<3;v++){const R=zo(),A=[];for(const B of $x()){const I=Zf(B);if(!I)continue;const G=vn(I.groups,I.dx);G&&A.push(G)}if(!A.length)break;if(!Cu(R,zo()))continue;for(const B of A.reverse())B();let $=!1;for(const B of $x()){const I=Zf(B);I&&Pu(I.groups,I.dx,()=>!0,Cu)&&($=!0)}if(!$)break}for(const v of Kf.flatMap(R=>Za.get(R)??[])){if(!Su(v.flow.id))continue;const R=l(v.flow.target);if(!R)continue;const A=p(C.get(v.flow.target).node.participant),$=et(v.flow.target,z=>z.x>=R.x),B=R.width+O,I=Go(v.flow.id),G=Ru(v.flow.id);for(let z=1;z<=Ze;z++){const V=()=>Go(v.flow.id)<I&&Ru(v.flow.id)>=G;if(Ox($,A,B*z,V))break}}for(const v of E){if(!Su(v.flow.id))continue;const R=l(v.flow.source),A=l(v.flow.target);if(!R||!A||R.type==="bpmn:Participant"||A.type==="bpmn:Participant")continue;const $=R.x+R.width/2;if(Math.abs($-(A.x+A.width/2))>15)continue;const[B,I]=R.y<A.y?[R.y+R.height,A.y]:[A.y+A.height,R.y],G=[...C.values()].map(z=>l(z.node.id)).filter(z=>!!z&&z.id!==R.id&&z.id!==A.id).filter(z=>z.x<=$&&$<=z.x+z.width&&z.y+z.height>B&&z.y<I).sort((z,V)=>z.x-V.x);for(const z of G){const V=(Yx=C.get(z.id))==null?void 0:Yx.node.participant,X=V?l(V):void 0;if(!X)continue;const pe=[...C.values()].filter(me=>me.node.participant===V).map(me=>me.node.id),xe=me=>me.map(Ae=>l(Ae)).filter(Ae=>!!Ae),Me=[zt(z.id,me=>{var Ae;return((Ae=C.get(me.id))==null?void 0:Ae.node.participant)===V}),xe(pe)].filter(me=>me.length),ce=z.width+O,we=Go(v.flow.id),at=Ru(v.flow.id),se=()=>Go(v.flow.id)<we&&Ru(v.flow.id)>=at;let ve=!1;for(const me of Me){for(let Ae=1;Ae<=Ze;Ae++)if(Ox(me,X,ce*Ae,se)){ve=!0;break}if(ve)break}if(!Su(v.flow.id))break}}for(const v of E){if(!Su(v.flow.id))continue;const R=l(v.flow.id);if(((Kx=R==null?void 0:R.waypoints)==null?void 0:Kx.length)!==2)continue;const A=l(v.flow.source),$=l(v.flow.target);if(!A||!$||A.type==="bpmn:Participant"||$.type==="bpmn:Participant"||!Yr(v.flow.source)||!Yr(v.flow.target)||Math.abs(Kr(A)-Kr($))>rt)continue;const B=Kr(A),I=R.waypoints.map(we=>we.y),[G,z]=[Math.min(...I),Math.max(...I)],V=ai(yt(o)).filter(we=>we.id!==A.id&&we.id!==$.id&&we.x<B&&B<we.x+we.width&&G<we.y+we.height&&we.y<z);if(!V.length)continue;const X=(Xx=C.get(v.flow.source))==null?void 0:Xx.node.participant,pe=(Zx=C.get(v.flow.target))==null?void 0:Zx.node.participant;if(!X||!pe)continue;const xe=new Map;for(const[we,at,se]of[[v.flow.source,A,X],[v.flow.target,$,pe]]){const ve=xe.get(se)??[],me=et(we,Ae=>Ae.x>=at.x).filter(Ae=>!ve.some(it=>it.id===Ae.id));xe.set(se,[...ve,...me])}const ie=new Set([...xe.values()].flat().map(we=>we.id)),Me=Nx(xe,ie,v.flow.id,we=>we===v.flow.source||we===v.flow.target,()=>!1),ce=Math.max(...V.map(we=>we.x+we.width));for(const we of DD){const at=ce+we-B;if(at<=0)continue;if(Pu(Me,at,()=>{var ve,me;return Go(v.flow.id)===0&&((me=(ve=l(v.flow.id))==null?void 0:ve.waypoints)==null?void 0:me.length)===2},Cu))break}}{const v=A=>A.y+A.height/2,R=[];for(const A of C.keys()){if(!Yr(A))continue;const $=m.filter(G=>G.flow.target===A);if($.length!==1)continue;const B=l($[0].flow.source),I=l(A);!B||!I||!C.has(B.id)||Math.abs(v(B)-v(I))>1||I.x-(B.x+B.width)<=O+1||R.push({id:A,pred:B,node:I})}R.sort((A,$)=>A.node.x-$.node.x);for(const{id:A}of R){const $=C.get(A),B=l(A),I=l(m.find(ie=>ie.flow.target===A).flow.source);if(!B||!I)continue;const G=B.x-(I.x+I.width);if(G<=O+1)continue;const z=p($.node.participant),V=et(A,ie=>ie.x>=B.x),X=zo(),pe=LD(V,z,-(G-O));if(!pe)continue;const xe=zo();(xe.bad>X.bad||xe.crossings>=X.crossings||xe.straight<X.straight)&&pe()}}Xa(!0);for(const v of y){const R=v.associations??[],A=R.map(I=>I.source===v.dataStore.id?I.target:I.source).map(l).find(Boolean),$=A?f(A)??u():u(),B=A?{x:A.x+A.width/2,y:A.y+A.height+110}:{x:200,y:K+60};n.createShape({type:"bpmn:DataStoreReference",businessObject:i.create("bpmn:DataStoreReference",{id:v.dataStore.id,name:v.dataStore.name})},B,$);for(const I of R)It(v.dataStore.id,I)}for(const v of x){const A=p(v.association.target).type==="bpmn:DataStoreReference"?v.association.target:v.association.source;It(A,v.association)}let jx=0;const Xr=10,Fx=40,jD=(v,R)=>{const A=R.map(V=>f(V)).filter(V=>!!V);for(const V of A){const X=Xr,pe=V.y,xe=V.y+V.height,ie=V.x,Me=V.x+V.width;if(Math.abs(v.y-pe)<X){const ce=pe+X-v.y;v.y+=ce,v.height-=ce}if(Math.abs(v.y+v.height-xe)<X&&(v.height=xe-X-v.y),Math.abs(v.x-ie)<X){const ce=ie+X-v.x;v.x+=ce,v.width-=ce}Math.abs(v.x+v.width-Me)<X&&(v.width=Me-X-v.x)}if(!A.length)return;const $=Math.min(...A.map(V=>V.y)),B=Math.max(...A.map(V=>V.y+V.height)),I=$-v.y,G=v.y+v.height-B,z=Fx-Xr;if(I>0!=G>0)if(I>0&&I<z){const V=I+Xr;v.y+=V,v.height-=V}else G>0&&G<z&&(v.height-=G+Xr)},FD=(v,R)=>{const A=Xr,$=30,B=o.filter(I=>I.type==="bpmn:Group"&&I.id!==R);for(const I of B){const G=I.x,z=I.x+I.width,V=I.y,X=I.y+I.height,pe=v.y<X&&V<v.y+v.height,xe=v.x<z&&G<v.x+v.width;if(pe){if(Math.abs(v.x-z)<A){const ie=Math.min(z+A-v.x,$);ie>0&&v.width-ie>0&&(v.x+=ie,v.width-=ie)}if(Math.abs(v.x+v.width-G)<A){const ie=Math.min(v.x+v.width-(G-A),$);ie>0&&v.width-ie>0&&(v.width-=ie)}}if(xe){if(Math.abs(v.y-X)<A){const ie=Math.min(X+A-v.y,$);ie>0&&v.height-ie>0&&(v.y+=ie,v.height-=ie)}if(Math.abs(v.y+v.height-V)<A){const ie=Math.min(v.y+v.height-(V-A),$);ie>0&&v.height-ie>0&&(v.height-=ie)}}}},Qf=(v,R)=>{const A=Fx,$=Math.min(...v.map(V=>V.x))-A,B=Math.min(...v.map(V=>V.y))-A,I=Math.max(...v.map(V=>V.x+V.width))+A,G=Math.max(...v.map(V=>V.y+V.height))+A,z={x:$,y:B,width:I-$,height:G-B};return jD(z,v),FD(z,R),z};for(const v of P){const R=(v.group.members??[]).map(l).filter(B=>!!B);let A;R.length?A=Qf(R,v.group.id):(A={x:300+jx*350,y:40,width:300,height:200},jx++);const $=n.createShape({type:"bpmn:Group",businessObject:i.create("bpmn:Group",{id:v.group.id}),width:A.width,height:A.height},{x:A.x+A.width/2,y:A.y+A.height/2},u());v.group.name&&n.updateLabel($,v.group.name),(Qx=v.group.members)!=null&&Qx.length&&D($,"bwl:Members",{refs:v.group.members.join(" ")})}{const v=o.filter(B=>!!B.waypoints),R=new Map,A=(B,I)=>{!B||!I||(R.has(B)||R.set(B,new Set),R.get(B).add(I))};for(const B of v){const I=(Jx=B.source)==null?void 0:Jx.id,G=(e0=B.target)==null?void 0:e0.id;A(I,G),((t0=B.type)!=null&&t0.includes("DataOutputAssociation")||(n0=B.type)!=null&&n0.includes("DataInputAssociation")||B.type==="bpmn:Association")&&A(G,I)}const $=o.filter(B=>B.type==="bpmn:Group");for(const B of $){const G=(((i0=B.businessObject.extensionElements)==null?void 0:i0.values)??[]).find(se=>se.$type==="bwl:Members"),z=((G==null?void 0:G.refs)??"").split(" ").filter(Boolean);if(!z.length)continue;const V=new Set(z),X=[...z];for(;X.length;){const se=X.shift();for(const ve of R.get(se)??[])V.has(ve)||(V.add(ve),X.push(ve))}const pe=B.x,xe=B.x+B.width,ie=B.y,Me=B.y+B.height,ce=se=>m.filter(ve=>ve.flow.target===se).length,we=se=>{var me;const ve=((me=l(se))==null?void 0:me.type)??"";if(ve==="bpmn:StartEvent"&&ce(se)===0)return!1;if(ve.endsWith("Gateway")){const Ae=m.filter(it=>it.flow.target===se).map(it=>it.flow.source);if(Ae.length&&Ae.every(it=>{var Qe;return((Qe=l(it))==null?void 0:Qe.type)==="bpmn:StartEvent"&&ce(it)===0}))return!1}return!0},at=o.filter(se=>Wi(se)).filter(se=>se.type!=="bpmn:Group"&&se.type!=="bpmn:Participant"&&se.type!=="bpmn:TextAnnotation"&&!V.has(se.id)&&Yr(se.id)&&we(se.id)&&se.x<xe&&se.x+se.width>pe&&se.y<Me&&se.y+se.height>ie);if(at.length)for(const se of[-1,1]){const ve=at.filter(ne=>(ne.x+ne.width-pe<=xe-ne.x?-1:1)===se);if(!ve.length)continue;const me=[];for(const ne of ve){const ee=me.find(be=>be.some(Te=>ne.y<Te.y+Te.height&&ne.y+ne.height>Te.y));ee?ee.push(ne):me.push([ne])}const Ae=new Map;for(const ne of me){let ee=se<0?pe-Xr:xe+Xr;for(const be of[...ne].sort((Te,Se)=>se<0?Se.x-Te.x:Te.x-Se.x)){const Te=se<0?Math.min(be.x,ee-be.width):Math.max(be.x,ee);ee=se<0?Te-Zt:Te+be.width+Zt,Te!==be.x&&Math.sign(Te-be.x)===se&&Ae.set(be.id,Te-be.x)}}const it=new Map,Qe=ne=>it.get(ne)===ne||!it.get(ne)?ne:Qe(it.get(ne));for(const ne of ve)it.set(ne.id,ne.id);for(const ne of E){const ee=Ae.has(ne.flow.source)?ne.flow.source:void 0,be=Ae.has(ne.flow.target)?ne.flow.target:void 0;if(!ee||!be)continue;const Te=l(ne.flow.id);((r0=Te==null?void 0:Te.waypoints)==null?void 0:r0.length)===2&&it.set(Qe(ee),Qe(be))}const Yt=new Map;for(const ne of ve){if(!Ae.has(ne.id))continue;const ee=Qe(ne.id);Yt.set(ee,[...Yt.get(ee)??[],ne])}const _n=[...Yt.values()].sort((ne,ee)=>se<0?Math.min(...ne.map(be=>be.x))-Math.min(...ee.map(be=>be.x)):Math.max(...ee.map(be=>be.x))-Math.max(...ne.map(be=>be.x))),Ee=[];let Je=!0;for(const ne of _n){const ee=ne.map(Se=>Ae.get(Se.id)??0).reduce((Se,je)=>Math.abs(je)>Math.abs(Se)?je:Se,0),be=new Map;let Te=!0;for(const Se of ne){const je=f(Se);if(!je){Te=!1;break}be.has(je.id)||be.set(je.id,{subtree:[],pool:je}),be.get(je.id).subtree.push(Se)}Te&&Pu([...be.values()],ee,()=>!0,Cu)?Ee.push({shapes:ne,dx:ee}):Je=!1}if(!Je)for(const ne of Ee.reverse())n.moveElements(ne.shapes,{x:-ne.dx,y:0})}}}{const v=new Set([...P.map(R=>R.group.id),...Ut(e,"group.update").map(R=>R.id)]);for(const R of o.filter(A=>A.type==="bpmn:Group")){if(v.has(R.id))continue;const $=(((o0=R.businessObject.extensionElements)==null?void 0:o0.values)??[]).find(z=>z.$type==="bwl:Members"),B=(($==null?void 0:$.refs)??"").split(" ").filter(Boolean).map(l).filter(z=>!!z);!B.length||!B.some(z=>{const V=d.get(z.id);return!V||V.x!==z.x||V.y!==z.y})||!B.some(z=>z.x<R.x||z.y<R.y||z.x+z.width>R.x+R.width||z.y+z.height>R.y+R.height)||n.resizeShape(R,Qf(B,R.id))}}{const R=new Map(so(yt(o)).map(z=>[z.owner,z.rect])),A=o.filter(z=>!!z.waypoints),$=new Map,B=(z,V)=>{!z||!V||($.has(z)||$.set(z,new Set),$.get(z).add(V))};for(const z of A){const V=(a0=z.source)==null?void 0:a0.id,X=(s0=z.target)==null?void 0:s0.id;B(V,X),((c0=z.type)!=null&&c0.includes("DataOutputAssociation")||(u0=z.type)!=null&&u0.includes("DataInputAssociation")||z.type==="bpmn:Association")&&B(X,V)}const I=z=>m.filter(V=>V.flow.target===z).length,G=z=>{var X;const V=((X=l(z))==null?void 0:X.type)??"";if(V==="bpmn:StartEvent"&&I(z)===0)return!1;if(V.endsWith("Gateway")){const pe=m.filter(xe=>xe.flow.target===z).map(xe=>xe.flow.source);if(pe.length&&pe.every(xe=>{var ie;return((ie=l(xe))==null?void 0:ie.type)==="bpmn:StartEvent"&&I(xe)===0}))return!1}return!0};for(const z of o.filter(V=>V.type==="bpmn:Group")){const X=(((l0=z.businessObject.extensionElements)==null?void 0:l0.values)??[]).find(ee=>ee.$type==="bwl:Members"),pe=((X==null?void 0:X.refs)??"").split(" ").filter(Boolean);if(!pe.length)continue;const xe=pe.map(l).filter(ee=>!!ee);if(!xe.length||!(P.some(ee=>ee.group.id===z.id)||Ut(e,"group.update").some(ee=>ee.id===z.id)||xe.some(ee=>{const be=d.get(ee.id);return!be||be.x!==ee.x||be.y!==ee.y})))continue;const Me=new Set(pe),ce=[...pe];for(;ce.length;){const ee=ce.shift();for(const be of $.get(ee)??[])Me.has(be)||(Me.add(be),ce.push(be))}const we=z.x,at=z.x+z.width,se=z.y,ve=z.y+z.height,me=ee=>{const be=R.get(ee.id),Te={x:ee.x,y:ee.y,width:ee.width,height:ee.height};return be?[Te,{x:be.x,y:be.y,width:be.width,height:be.height}]:[Te]},Ae=xe.flatMap(me),it=Math.min(...Ae.map(ee=>ee.x)),Qe=Math.max(...Ae.map(ee=>ee.x+ee.width)),Yt=Math.min(...Ae.map(ee=>ee.y)),_n=Math.max(...Ae.map(ee=>ee.y+ee.height)),Ee={L:it-we,R:at-Qe,T:Yt-se,B:ve-_n},Je=o.filter(ee=>Wi(ee)).filter(ee=>ee.type!=="bpmn:Group"&&ee.type!=="bpmn:Participant"&&ee.type!=="bpmn:TextAnnotation"&&!Me.has(ee.id)&&G(ee.id)&&ee.x<at&&ee.x+ee.width>we&&ee.y<ve&&ee.y+ee.height>se);if(!Je.length)continue;const ne={L:0,R:0,T:0,B:0};for(const ee of Je){const be=me(ee),Te=Math.min(...be.map(dt=>dt.x)),Se=Math.max(...be.map(dt=>dt.x+dt.width)),je=Math.min(...be.map(dt=>dt.y)),tt=Math.max(...be.map(dt=>dt.y+dt.height)),Gt={L:Se-we,R:at-Te,T:tt-se,B:ve-je},ni=["L","R","T","B"].filter(dt=>Gt[dt]<=Ee[dt]+.001);if(!ni.length)continue;const Ct=ni.reduce((dt,Ja)=>Gt[Ja]<Gt[dt]?Ja:dt,ni[0]);ne[Ct]=Math.max(ne[Ct],Math.min(Gt[Ct]+10,Ee[Ct]))}!ne.L&&!ne.R&&!ne.T&&!ne.B||n.resizeShape(z,{x:z.x+ne.L,y:z.y+ne.T,width:z.width-ne.L-ne.R,height:z.height-ne.T-ne.B})}}const Hx=v=>{const R=v.waypoints;if(R!=null&&R.length){const $=R[Math.floor((R.length-1)/2)];return{x:$.x,y:$.y,width:0,height:0}}const A=v;return{x:A.x,y:A.y,width:A.width,height:A.height}};let Qa=0;const zx=12,Gx=14,HD=15,zD=300,GD=v=>{const R=v.split(`
7
+ `),A=Math.max(...R.map(I=>oo(I,zx))),$=Math.max(100,Math.min(zD,Math.ceil(A)+Gx)),B=R.reduce((I,G)=>I+Math.max(1,Math.ceil((oo(G,zx)+Gx)/$)),0);return{width:$,height:Math.max(30,B*HD+10)}};for(const v of S){const R=v.association,A=((p0=v.placement)==null?void 0:p0.anchor)??(R?R.source===v.annotation.id?R.target:R.source:void 0),$=A?l(A):void 0,B=$?Hx($):void 0,I=GD(v.annotation.text??"");let G;if(B&&v.placement){const[pe,xe]=bs[v.placement.side],ie=v.placement.offset??50;G={x:B.x+B.width/2+pe*(B.width/2+I.width/2+ie),y:B.y+B.height/2+xe*(B.height/2+I.height/2+ie)}}else B?(G={x:B.x+B.width/2+180+Qa%3*260,y:B.y-110-Qa%2*95},Qa++):(G={x:300+Qa*260,y:60},Qa++);const z=$?f($)??u():u(),V=z;B&&typeof V.x=="number"&&typeof V.width=="number"&&V.type==="bpmn:Participant"&&(G=il(o,B,I,V,v.placement?{placement:v.placement}:{from:G}));const X=n.createShape({type:"bpmn:TextAnnotation",width:I.width,height:I.height,businessObject:i.create("bpmn:TextAnnotation",{id:v.annotation.id,text:v.annotation.text})},G,z);if(R){const pe=xe=>xe===v.annotation.id?X:p(xe);n.connect(pe(R.source),pe(R.target),R.id?{type:"bpmn:Association",businessObject:i.create("bpmn:Association",{id:R.id})}:{type:"bpmn:Association"})}v.placement&&D(X,"bwl:Placement",T(v.placement))}for(const v of Ut(e,"association.add")){const R=v.association;n.connect(p(R.source),p(R.target),R.id?{type:"bpmn:Association",businessObject:i.create("bpmn:Association",{id:R.id})}:{type:"bpmn:Association"})}for(const v of Ut(e,"node.update")){let R=p(v.id);if(v.type&&vs(v.type)!==R.type&&(R=c.replaceElement(R,{type:vs(v.type)})),v.name!==void 0&&n.updateProperties(R,{name:v.name??void 0}),v.lane||v.band!==void 0){v.band!==void 0&&n.updateProperties(R,{"bwl:band":v.band});const A=R.y+R.height/2,$=f(R),B=v.lane?p(v.lane):(($==null?void 0:$.children)??[]).find(G=>G.type==="bpmn:Lane"&&A>=G.y&&A<=G.y+G.height);v.band!==void 0&&j(B==null?void 0:B.id,v.band,$);const I=B?B.y+(v.band===void 0?B.height/2:Math.min(B.height/2,oe)+wt(B.id,v.band)*k):v.band!==void 0&&$?$.y+F+wt(`pool:${$.id}`,v.band)*k:void 0;if(I!==void 0){const G=I-A;G!==0&&n.moveElements([R],{x:0,y:G})}}}for(const v of Ut(e,"sequenceFlow.update")){const R=p(v.id);if(v.source!==void 0||v.target!==void 0){const A=R,$=v.source!==void 0?p(v.source):A.source,B=v.target!==void 0?p(v.target):A.target,I=G=>({x:G.x+G.width/2,y:G.y+G.height/2});n.reconnect(A,$,B,[I($),I(B)])}v.name!==void 0&&n.updateProperties(R,{name:v.name??void 0}),v.condition!==void 0&&n.updateProperties(R,{name:((f0=v.condition)==null?void 0:f0.label)??void 0})}for(const v of Ut(e,"messageFlow.update"))v.name!==void 0&&n.updateProperties(p(v.id),{name:v.name??void 0});for(const v of Ut(e,"dataStore.update"))v.name!==void 0&&n.updateProperties(p(v.id),{name:v.name??void 0});for(const v of Ut(e,"annotation.update")){const R=p(v.id);if(v.text!==void 0&&n.updateProperties(R,{text:v.text}),v.placement===null)D(R,"bwl:Placement",null);else if(v.placement){const A=p(v.placement.anchor),$=Hx(A),B=f(A)??u(),I=typeof B.x=="number"&&typeof B.width=="number"&&B.type==="bpmn:Participant",[G,z]=bs[v.placement.side],V=v.placement.offset??50,X={x:$.x+$.width/2+G*($.width/2+R.width/2+V),y:$.y+$.height/2+z*($.height/2+R.height/2+V)},pe=I?il(o,$,{width:R.width,height:R.height},B,{placement:v.placement,selfId:v.id}):X;n.moveElements([R],{x:pe.x-(R.x+R.width/2),y:pe.y-(R.y+R.height/2)}),D(R,"bwl:Placement",T(v.placement))}}for(const v of Ut(e,"group.update")){const R=p(v.id);if(v.name!==void 0&&n.updateLabel(R,v.name??""),v.members){const A=v.members.map(l).filter($=>!!$);A.length&&n.resizeShape(R,Qf(A,v.id)),D(R,"bwl:Members",{refs:v.members.join(" ")})}}}function rl(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 UE(e,t,n){var l,p;const{elementRegistry:i}=e,r=e.modeling,o=f=>Pi(f).filter(d=>!t.has(Ei(d))),a=f=>{var d;return((d=i.get(f))==null?void 0:d.type)==="bpmn:TextAnnotation"},s=yt(i),c=o(s),u=[...new Set(c.flatMap(rl))].filter(f=>n.has(f)&&a(f));if(u.length)for(const f of u){const d=i.get(f);if(!d||typeof d.x!="number"||typeof d.width!="number")continue;let g=d.parent,h;for(;g;){if(g.type==="bpmn:Participant"){h=g;break}g=g.parent}if(!h){const _e=d.x+d.width/2,We=d.y+d.height/2;h=i.getAll().find(Y=>{if(Y.type!=="bpmn:Participant")return!1;const le=Y;return typeof le.x=="number"&&typeof le.width=="number"&&_e>=le.x&&_e<=le.x+le.width&&We>=le.y&&We<=le.y+le.height})}if(!h||typeof h.x!="number"||typeof h.width!="number")continue;const E=(((l=d.businessObject.extensionElements)==null?void 0:l.values)??[]).find(_e=>_e.$type==="bwl:Placement"),y=[...d.incoming??[],...d.outgoing??[]].find(_e=>_e.type==="bpmn:Association"),x=(E!=null&&E.anchor?i.get(E.anchor):void 0)??(y?((p=y.source)==null?void 0:p.id)===f?y.target:y.source:void 0);if(!x)continue;const S=x.waypoints,P=S!=null&&S.length?{x:S[Math.floor((S.length-1)/2)].x,y:S[Math.floor((S.length-1)/2)].y,width:0,height:0}:{x:x.x,y:x.y,width:x.width,height:x.height},C={width:d.width,height:d.height},D={x:d.x+d.width/2,y:d.y+d.height/2},T=E==null?void 0:E.side,N=[];T&&T in bs&&N.push(il(i,P,C,h,{placement:{side:T,offset:(E==null?void 0:E.offset)??null},selfId:f}));for(const[_e,We]of[[-1,0],[1,0],[0,-1],[0,1]])for(let Y=1;Y<=WE;Y++)N.push({x:D.x+_e*_h*Y,y:D.y+We*_h*Y});const k={...s,edges:s.edges.filter(_e=>_e.id!==(y==null?void 0:y.id))},O=o(k),F=O.filter(_e=>rl(_e).includes(f)).length;if(!F)continue;let oe;for(const _e of N){const We=_e.x-D.x,Y=_e.y-D.y;if(!We&&!Y||_e.x-C.width/2<h.x||_e.x+C.width/2>h.x+h.width||_e.y-C.height/2<h.y||_e.y+C.height/2>h.y+h.height)continue;const le={...k,shapes:k.shapes.map(re=>re.id===f?{...re,x:re.x+We,y:re.y+Y}:re)},ge=o(le),ue=ge.filter(re=>rl(re).includes(f)).length;if(ue>=F||ge.length>O.length)continue;const Re=Math.abs(We)+Math.abs(Y);if((!oe||ue<oe.mine||ue===oe.mine&&(ge.length<oe.all||ge.length===oe.all&&Re<oe.dist))&&(oe={x:_e.x,y:_e.y,mine:ue,all:ge.length,dist:Re}),oe.mine===0&&oe.all<O.length)break}oe&&r.moveElements([d],{x:oe.x-D.x,y:oe.y-D.y})}}function wh(e,t,n=xh){const i=bh(e),r=vh(t,Yd(i.elementRegistry)),o={edgeCrossings:{before:0,after:0,pairs:[],solidPairs:0,dashedPairs:0,mixedPairs:0,crossPoolMessages:0}};if(r.length)return{ok:!1,issues:r,findings:[],stats:o};const a=yt(i.elementRegistry),s=new Set(Pi(a).map(Ei)),c=new Set(a.edges.map(h=>h.id)),u=new Set(a.shapes.map(h=>h.id)),l=Qu(a).length,p=e.get("commandStack");try{id(p,()=>{n(t,i),ih(i,c),eh(i,s),uh(i,s,c),sh(i,c),$E(i,c),dh(i,s,c),fh(i,c),mh(i,u),UE(i,s,u)})}catch(h){return{ok:!1,issues:[{kind:"lower-failed",message:h instanceof Error?h.message:String(h)}],findings:[],stats:o}}const f=yt(i.elementRegistry),d=Pi(f).filter(h=>!s.has(Ei(h))),g=Fd(f);return{ok:!0,issues:[],findings:d,stats:{edgeCrossings:{before:l,after:g.pairs.length,pairs:g.pairs,solidPairs:g.solidPairs,dashedPairs:g.dashedPairs,mixedPairs:g.mixedPairs,crossPoolMessages:g.crossPoolMessages}}}}function qE(e){const t=e.slice(e.indexOf(":")+1);return t.charAt(0).toLowerCase()+t.slice(1)}function YE(e,t){return typeof e.get=="function"?e.get(t):e[t]}function Eh(e,t){const n=YE(e,t);return typeof n=="number"&&Number.isFinite(n)?n:void 0}function Sh(e,t){var i;return(((i=e.extensionElements)==null?void 0:i.values)??[]).find(r=>(r==null?void 0:r.$type)===t)}function KE(e){return typeof e=="string"&&Tu.includes(e)}function si(e){if(typeof e=="string")return e;const t=e==null?void 0:e.id;return typeof t=="string"?t:void 0}function Rh(e){const t=e.rootElements??[],n=t.find(Y=>Y.$type==="bpmn:Collaboration"),i=new Map(t.filter(Y=>Y.$type==="bpmn:Process").map(Y=>[Y.id,Y])),r=[],o=[],a=[],s=[],c=[],u=[],l={poolOrders:{},bands:{},placements:{}},p=[],f=[],d=[],g=[],h=[],m=[],E=new Set,y=new Set,x=Y=>{Y&&E.add(Y)},S=Y=>{E.add(Y),y.add(Y)},P=Y=>{const le=Sh(Y,"bwl:Placement");if(!le)return;const ge=typeof le.anchor=="string"?le.anchor:void 0;if(!ge||!KE(le.side))return;const ue=typeof le.offset=="number"?le.offset:void 0;h.push({owner:Y.id,anchor:ge,side:le.side,...ue!==void 0?{offset:ue}:{}})},C=Y=>{const le=Sh(Y,"bwl:Members"),ge=typeof(le==null?void 0:le.refs)=="string"?le.refs.split(/\s+/).filter(Boolean):[];ge.length&&m.push({owner:Y.id,refs:ge})},D=Y=>{var le;for(const ge of Y)switch(x(ge.id),ge.$type){case"bpmn:TextAnnotation":S(ge.id),s.push({id:ge.id,text:typeof ge.text=="string"?ge.text:""}),P(ge);break;case"bpmn:Association":d.push({id:ge.id,type:ge.$type,source:si(ge.sourceRef),target:si(ge.targetRef)});break;case"bpmn:Group":{S(ge.id);const ue=(le=ge.categoryValueRef)==null?void 0:le.value;c.push({id:ge.id,...typeof ue=="string"&&ue?{name:ue}:{}}),C(ge);break}default:u.push({id:ge.id,type:ge.$type,reason:"type-outside-mvp"})}},T=(Y,le)=>{const ge=Y.flowElements??[],ue=(Y.laneSets??[]).flatMap(re=>re.lanes??[]),Re=new Map;for(const re of ue){x(re.id);for(const q of re.flowNodeRef??[]){const U=si(q);U&&Re.set(U,re.id)}}for(const re of ge){if(x(re.id),re.$type==="bpmn:SequenceFlow"){p.push({id:re.id,source:si(re.sourceRef),target:si(re.targetRef),...typeof re.name=="string"&&re.name?{name:re.name}:{}});continue}if(re.$type==="bpmn:DataStoreReference"){S(re.id),a.push({id:re.id,...re.name?{name:re.name}:{}});continue}const q=qE(re.$type);if(!Jf(q)){u.push({id:re.id,type:re.$type,reason:"type-outside-mvp"});continue}S(re.id),o.push({id:re.id,type:q,...re.name?{name:re.name}:{},...le?{participant:le}:{},...Re.has(re.id)?{lane:Re.get(re.id)}:{}});const U=Eh(re,"bwl:band");U!==void 0&&(l.bands[re.id]=U);for(const Z of re.dataOutputAssociations??[])x(Z.id),g.push({id:Z.id,type:Z.$type,source:re.id,target:si(Z.targetRef)});for(const Z of re.dataInputAssociations??[])x(Z.id),g.push({id:Z.id,type:Z.$type,source:si((Z.sourceRef??[])[0]),target:re.id})}D(Y.artifacts??[])};if(n){const Y=new Set;for(const le of n.participants??[]){S(le.id);const ge=si(le.processRef);ge&&Y.add(ge);const ue=ge?i.get(ge):void 0,Re=((ue==null?void 0:ue.laneSets)??[]).flatMap(Z=>Z.lanes??[]),re=Re.map(Z=>({id:Z.id,...Z.name?{name:Z.name}:{}}));for(const Z of re)S(Z.id);const q=!ue||(ue.flowElements??[]).length===0&&Re.length===0&&(ue.artifacts??[]).length===0;r.push({id:le.id,...le.name?{name:le.name}:{},...q?{blackBox:!0}:{},...re.length?{lanes:re}:{}});const U=Eh(le,"bwl:poolOrder");U!==void 0&&(l.poolOrders[le.id]=U),ue&&T(ue,le.id)}for(const le of n.messageFlows??[])x(le.id),f.push({id:le.id,source:si(le.sourceRef),target:si(le.targetRef),...typeof le.name=="string"&&le.name?{name:le.name}:{}});D(n.artifacts??[]);for(const[le,ge]of i)!Y.has(le)&&(ge.flowElements??[]).length>0&&u.push({id:le,type:ge.$type,reason:"unreachable-process"})}else for(const Y of i.values())T(Y);const N=[],k=[],O=[],F=[],oe=(Y,le)=>!!Y&&!!le&&y.has(Y)&&y.has(le);for(const Y of p){if(!oe(Y.source,Y.target)){u.push({id:Y.id,type:"bpmn:SequenceFlow",reason:"endpoint-outside-mvp"});continue}N.push({id:Y.id,source:Y.source,target:Y.target,...Y.name?{name:Y.name}:{}}),y.add(Y.id)}for(const Y of f){if(!oe(Y.source,Y.target)){u.push({id:Y.id,type:"bpmn:MessageFlow",reason:"endpoint-outside-mvp"});continue}k.push({id:Y.id,source:Y.source,target:Y.target,...Y.name?{name:Y.name}:{}}),y.add(Y.id)}for(const Y of g){if(!oe(Y.source,Y.target)){u.push({id:Y.id??"",type:Y.type,reason:"endpoint-outside-mvp"});continue}F.push({...Y.id?{id:Y.id}:{},source:Y.source,target:Y.target}),Y.id&&y.add(Y.id)}for(const Y of d){if(!oe(Y.source,Y.target)){u.push({id:Y.id??"",type:Y.type,reason:"endpoint-outside-mvp"});continue}O.push({...Y.id?{id:Y.id}:{},source:Y.source,target:Y.target})}const _e=new Map(c.map(Y=>[Y.id,Y]));for(const{owner:Y,refs:le}of m){const ge=le.filter(Re=>E.has(Re)),ue=_e.get(Y);ue&&ge.length&&(ue.members=ge)}for(const Y of h)E.has(Y.anchor)&&(l.placements[Y.owner]={anchor:Y.anchor,side:Y.side,...Y.offset!==void 0?{offset:Y.offset}:{}});return{definition:{...r.length?{participants:r}:{},nodes:o,sequenceFlows:N,...k.length?{messageFlows:k}:{},...a.length?{dataStores:a}:{},...F.length?{dataAssociations:F}:{},...s.length?{annotations:s}:{},...O.length?{associations:O}:{},...c.length?{groups:c}:{}},hints:l,omitted:u}}async function XE(e){const{definitions:t,warnings:n}=await Uu(e);return{...Rh(t),warnings:n}}function ZE(e,t,n,i={}){return{documentId:e,baseVersion:t,ops:[...n],origin:i.origin??"agent",clientOpId:(i.mkClientOpId??(()=>crypto.randomUUID()))()}}async function Ch(e,t,{currentVersion:n}){if(t.baseVersion!==n)return{status:"conflict",baseVersion:t.baseVersion,currentVersion:n};const i=wh(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 QE=Symbol("bpmn-editor");function JE(){const e=At.ref(!1),t=At.ref(!0),n=At.ref(!1);let i,r;const o=()=>{e.value=!0};function a(u,l){u.get("canvas").getContainer().style.pointerEvents=l?"":"none";const p=u.get("keyboard");l?(r&&p.bind(r),r=void 0):r||(r=p.getBinding(),p.unbind())}function s(){if(!i)throw new Error("modeler not attached — 뷰 @ready 후 attach() 필요");return i}function c(){return i==null?void 0:i.get("commandStack")}return{dirty:e,editable:t,agentBusy:n,attach(u){i&&this.detach(),i=u,i.get("eventBus").on("commandStack.changed",o),t.value||a(i,!1)},detach(){i==null||i.get("eventBus").off("commandStack.changed",o),i&&!t.value&&a(i,!0),r=void 0,i=void 0},setEditable(u){t.value=u,i&&a(i,u)},async applyAgentBatch(u,l){const p=s();n.value=!0;try{const f=await Ch(p,u,{currentVersion:l});return f.status==="applied"&&(e.value=!1),f}finally{n.value=!1}},async importXml(u){const{warnings:l}=await s().importXML(u);return e.value=!1,{warnings:qu(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 de(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}function e1(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var ol={exports:{}},Ph;function t1(){if(Ph)return ol.exports;Ph=1;var e=ol.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},ol.exports}var n1=t1(),i1=e1(n1);function ci(e){if(!(this instanceof ci))return new ci(e);e=e||[128,36,1],this._seed=e.length?i1.rack(e[0],e[1],e[2]):e}ci.prototype.next=function(e){return this._seed(e||!0)},ci.prototype.nextPrefixed=function(e,t){var n;do n=e+this.next(!0);while(this.assigned(n));return this.claim(n,t),n},ci.prototype.claim=function(e,t){this._seed.set(e,t||!0)},ci.prototype.assigned=function(e){return this._seed.get(e)||!1},ci.prototype.unclaim=function(e){delete this._seed.hats[e]},ci.prototype.clear=function(){var e=this._seed.hats,t;for(t in e)this.unclaim(t)};const Bt={legend:[1,"<fieldset>","</fieldset>"],tr:[2,"<table><tbody>","</tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],_default:[0,"",""]};Bt.td=Bt.th=[3,"<table><tbody><tr>","</tr></tbody></table>"],Bt.option=Bt.optgroup=[1,'<select multiple="multiple">',"</select>"],Bt.thead=Bt.tbody=Bt.colgroup=Bt.caption=Bt.tfoot=[1,"<table>","</table>"],Bt.polyline=Bt.ellipse=Bt.polygon=Bt.circle=Bt.text=Bt.line=Bt.path=Bt.rect=Bt.g=[1,'<svg xmlns="http://www.w3.org/2000/svg" version="1.1">',"</svg>"];function ft(e,t=globalThis.document){var u;if(typeof e!="string")throw new TypeError("String expected");const n=/^<!--(.*?)-->$/s.exec(e);if(n)return t.createComment(n[1]);const i=(u=/<([\w:]+)/.exec(e))==null?void 0:u[1];if(!i)return t.createTextNode(e);if(e=e.trim(),i==="body"){const l=t.createElement("html");l.innerHTML=e;const{lastChild:p}=l;return p.remove(),p}let[r,o,a]=Object.hasOwn(Bt,i)?Bt[i]:Bt._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 r1(e,t){return t.forEach(function(n){n&&typeof n!="string"&&!Array.isArray(n)&&Object.keys(n).forEach(function(i){if(i!=="default"&&!(i in e)){var r=Object.getOwnPropertyDescriptor(n,i);Object.defineProperty(e,i,r.get?r:{enumerable:!0,get:function(){return n[i]}})}})}),Object.freeze(e)}function dn(e,...t){const n=e.style;return L(t,function(i){i&&L(i,function(r,o){n[o]=r})}),e}function sn(e,t,n){return arguments.length==2?e.getAttribute(t):n===null?e.removeAttribute(t):(e.setAttribute(t,n),e)}const o1=Object.prototype.toString;function gt(e){return new Xi(e)}function Xi(e){if(!e||!e.nodeType)throw new Error("A DOM element reference is required");this.el=e,this.list=e.classList}Xi.prototype.add=function(e){return this.list.add(e),this},Xi.prototype.remove=function(e){return o1.call(e)=="[object RegExp]"?this.removeMatching(e):(this.list.remove(e),this)},Xi.prototype.removeMatching=function(e){const t=this.array();for(let n=0;n<t.length;n++)e.test(t[n])&&this.remove(t[n]);return this},Xi.prototype.toggle=function(e,t){return typeof t<"u"?t!==this.list.toggle(e,t)&&this.list.toggle(e):this.list.toggle(e),this},Xi.prototype.array=function(){return Array.from(this.list)},Xi.prototype.has=Xi.prototype.contains=function(e){return this.list.contains(e)};function _s(e){for(var t;t=e.firstChild;)e.removeChild(t);return e}function Mr(e,t,n){var i=n?e:e.parentNode;return i&&typeof i.closest=="function"&&i.closest(t)||null}function a1(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var xs={},Ah;function s1(){if(Ah)return xs;Ah=1;var e,t,n;function i(){e=window.addEventListener?"addEventListener":"attachEvent",t=window.removeEventListener?"removeEventListener":"detachEvent",n=e!=="addEventListener"?"on":""}return xs.bind=function(r,o,a,s){return e||i(),r[e](n+o,a,s||!1),a},xs.unbind=function(r,o,a,s){return t||i(),r[t](n+o,a,s||!1),a},xs}var Th=s1(),c1=a1(Th),Ne=r1({__proto__:null,default:c1},[Th]),Mh=["focus","blur"];function u1(e,t,n,i,r){return Mh.indexOf(n)!==-1&&(r=!0),Ne.bind(e,n,function(o){var a=o.target||o.srcElement;o.delegateTarget=Mr(a,t,!0),o.delegateTarget&&i.call(e,o)},r)}function l1(e,t,n,i){return Mh.indexOf(t)!==-1&&(i=!0),Ne.unbind(e,t,n,i)}var Cn={bind:u1,unbind:l1};function al(e,t){return e&&typeof e.matches=="function"&&e.matches(t)||!1}function ot(e,t){return t=t||document,t.querySelector(e)}function ws(e,t){return t=t||document,t.querySelectorAll(e)}function ui(e){e.parentNode&&e.parentNode.removeChild(e)}function p1(e,t){if(e.ownerDocument!==t.ownerDocument)try{return t.ownerDocument.importNode(e,!0)}catch{}return e}function f1(e,t){return t.appendChild(p1(e,t))}function Be(e,t){return f1(t,e),e}var sl=2,kh={"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":sl,"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":sl,"text-anchor":1,"text-decoration":1,"text-rendering":1,"unicode-bidi":1,visibility:1,"word-spacing":1,"writing-mode":1};function d1(e,t){return kh[t]?e.style[t]:e.getAttributeNS(null,t)}function Oh(e,t,n){var i=t.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase(),r=kh[i];r?(r===sl&&typeof n=="number"&&(n=String(n)+"px"),e.style[i]=n):e.setAttributeNS(null,t,n)}function h1(e,t){var n=Object.keys(t),i,r;for(i=0,r;r=n[i];i++)Oh(e,r,t[r])}function he(e,t,n){if(typeof t=="string")if(n!==void 0)Oh(e,t,n);else return d1(e,t);else h1(e,t);return e}const m1=Object.prototype.toString;function qe(e){return new Zi(e)}function Zi(e){if(!e||!e.nodeType)throw new Error("A DOM element reference is required");this.el=e,this.list=e.classList}Zi.prototype.add=function(e){return this.list.add(e),this},Zi.prototype.remove=function(e){return m1.call(e)=="[object RegExp]"?this.removeMatching(e):(this.list.remove(e),this)},Zi.prototype.removeMatching=function(e){const t=this.array();for(let n=0;n<t.length;n++)e.test(t[n])&&this.remove(t[n]);return this},Zi.prototype.toggle=function(e,t){return typeof t<"u"?t!==this.list.toggle(e,t)&&this.list.toggle(e):this.list.toggle(e),this},Zi.prototype.array=function(){return Array.from(this.list)},Zi.prototype.has=Zi.prototype.contains=function(e){return this.list.contains(e)};function Es(e){for(var t;t=e.firstChild;)e.removeChild(t);return e}function Dh(e){return e.cloneNode(!0)}var cl={svg:"http://www.w3.org/2000/svg"},Lh='<svg xmlns="'+cl.svg+'"';function g1(e){var t=!1;e.substring(0,4)==="<svg"?e.indexOf(cl.svg)===-1&&(e=Lh+e.substring(4)):(e=Lh+">"+e+"</svg>",t=!0);var n=y1(e);if(!t)return n;for(var i=document.createDocumentFragment(),r=n.firstChild;r.firstChild;)i.appendChild(r.firstChild);return i}function y1(e){var t;return t=new DOMParser,t.async=!1,t.parseFromString(e,"text/xml")}function Ce(e,t){var n;return e=e.trim(),e.charAt(0)==="<"?(n=g1(e).firstChild,n=document.importNode(n,!0)):n=document.createElementNS(cl.svg,e),t&&he(n,t),n}var ul=null;function Ih(){return ul===null&&(ul=Ce("svg")),ul}function Nh(e,t){var n,i,r=Object.keys(t);for(n=0;i=r[n];n++)e[i]=t[i];return e}function v1(e,t,n,i,r,o){var a=Ih().createSVGMatrix();switch(arguments.length){case 0:return a;case 1:return Nh(a,e);case 6:return Nh(a,{a:e,b:t,c:n,d:i,e:r,f:o})}}function Ko(e){return Ih().createSVGTransform()}var Bh=/([&<>]{1})/g,b1=/([&<>\n\r"]{1})/g,_1={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"'"};function ll(e,t){function n(i,r){return _1[r]||r}return e.replace(t,n)}function $h(e,t){var n,i,r,o,a;switch(e.nodeType){case 3:t.push(ll(e.textContent,Bh));break;case 1:if(t.push("<",e.tagName),e.hasAttributes())for(r=e.attributes,n=0,i=r.length;n<i;++n)o=r.item(n),t.push(" ",o.name,'="',ll(o.value,b1),'"');if(e.hasChildNodes()){for(t.push(">"),a=e.childNodes,n=0,i=a.length;n<i;++n)$h(a.item(n),t);t.push("</",e.tagName,">")}else t.push("/>");break;case 8:t.push("<!--",ll(e.nodeValue,Bh),"-->");break;case 4:t.push("<![CDATA[",e.nodeValue,"]]>");break;default:throw new Error("unable to handle node "+e.nodeType)}return t}function x1(e){for(var t=e.firstChild,n=[];t;)$h(t,n),t=t.nextSibling;return n.join("")}function jh(e,t){return x1(e)}function $t(e){var t=e.parentNode;return t&&t.removeChild(e),e}function w1(e,t){return t instanceof SVGMatrix?e.createSVGTransformFromMatrix(t):t}function E1(e,t){var n,i;for(e.clear(),n=0;i=t[n];n++)e.appendItem(w1(e,i))}function Xo(e,t){var n=e.transform.baseVal;return t&&(Array.isArray(t)||(t=[t]),E1(n,t)),n.consolidate()}const S1=/^class[ {]/;function R1(e){return S1.test(e.toString())}function pl(e){return Array.isArray(e)}function fl(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function Ss(...e){e.length===1&&pl(e[0])&&(e=e[0]),e=[...e];const t=e.pop();return t.$inject=e,t}const C1=/constructor\s*[^(]*\(\s*([^)]*)\)/m,P1=/^(?:async\s+)?(?:function\s*[^(]*)?(?:\(\s*([^)]*)\)|(\w+))/m,A1=/\/\*([^*]*)\*\//m;function T1(e){if(typeof e!="function")throw new Error(`Cannot annotate "${e}". Expected a function!`);const t=e.toString().match(R1(e)?C1:P1);if(!t)return[];const n=t[1]||t[2];return n&&n.split(",").map(i=>{const r=i.match(A1);return(r&&r[1]||i).trim()})||[]}function Fh(e,t){const n=t||{get:function(x,S){if(i.push(x),S===!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 S=i.join(" -> ");return i.length=0,new Error(S?`${x} (Resolving: ${S})`:x)};function c(x,S){if(!r[x]&&x.includes(".")){const P=x.split(".");let C=c(P.shift());for(;P.length;)C=C[P.shift()];return C}if(fl(o,x))return o[x];if(fl(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,S)}function u(x,S){if(typeof S>"u"&&(S={}),typeof x!="function")if(pl(x))x=Ss(x.slice());else throw s(`Cannot invoke "${x}". Expected a function!`);const C=(x.$inject||T1(x)).map(D=>fl(S,D)?S[D]:c(D));return{fn:x,dependencies:C}}function l(x){const{fn:S,dependencies:P}=u(x),C=Function.prototype.bind.call(S,null,...P);return new C}function p(x,S,P){const{fn:C,dependencies:D}=u(x,P);return C.apply(S,D)}function f(x){return Ss(S=>x.get(S))}function d(x,S){if(S&&S.length){const P=Object.create(null),C=Object.create(null),D=[],T=[],N=[];let k,O,F,oe;for(let _e in r)k=r[_e],S.indexOf(_e)!==-1&&(k[2]==="private"?(O=D.indexOf(k[3]),O===-1?(F=k[3].createChild([],S),oe=f(F),D.push(k[3]),T.push(F),N.push(oe),P[_e]=[oe,_e,"private",F]):P[_e]=[N[O],_e,"private",T[O]]):P[_e]=[k[2],k[1]],C[_e]=!0),(k[2]==="factory"||k[2]==="type")&&k[1].$scope&&S.forEach(We=>{k[1].$scope.indexOf(We)!==-1&&(P[_e]=[k[2],k[1]],C[We]=!0)});S.forEach(_e=>{if(!C[_e])throw new Error('No provider for "'+_e+'". Cannot use provider from the parent!')}),x.unshift(P)}return new Fh(x,a)}const g={factory:p,type:l,value:function(x){return x}};function h(x,S){const P=x.__init__||[];return function(){P.forEach(C=>{typeof C=="string"?S.get(C):S.invoke(C)})}}function m(x){const S=x.__exports__;if(S){const P=x.__modules__,C=Object.keys(x).reduce((O,F)=>(F!=="__exports__"&&F!=="__modules__"&&F!=="__init__"&&F!=="__depends__"&&(O[F]=x[F]),O),Object.create(null)),D=(P||[]).concat(C),T=d(D),N=Ss(function(O){return T.get(O)});S.forEach(function(O){r[O]=[N,O,"private",T]});const k=(x.__init__||[]).slice();return k.unshift(function(){T.init()}),x=Object.assign({},x,{__init__:k}),h(x,T)}return Object.keys(x).forEach(function(P){if(P==="__init__"||P==="__depends__")return;const C=x[P];if(C[2]==="private"){r[P]=C;return}const D=C[0],T=C[1];r[P]=[g[D],M1(D,T),D]}),h(x,a)}function E(x,S){return x.indexOf(S)!==-1||(x=(S.__depends__||[]).reduce(E,x),x.indexOf(S)!==-1)?x:x.concat(S)}function y(x){const S=x.reduce(E,[]).map(m);let P=!1;return function(){P||(P=!0,S.forEach(C=>C()))}}this.get=c,this.invoke=p,this.instantiate=l,this.createChild=d,this.init=y(e)}function M1(e,t){return e!=="value"&&pl(t)&&(t=Ss(t.slice())),t}var k1=1e3;function Ti(e,t){var n=this;t=t||k1,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)})}Ti.prototype.canRender=function(e){},Ti.prototype.drawShape=function(e,t){},Ti.prototype.drawConnection=function(e,t){},Ti.prototype.getShapePath=function(e){},Ti.prototype.getConnectionPath=function(e){};function kr(e){return e.flat().join(",").replace(/,?([A-Za-z]),?/g,"$1")}function O1(e){return["M",e.x,e.y]}function dl(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 L1(e,t){const n=e.length,i=[O1(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(dl(a));continue}const c=Math.min(t,hl(a.x-o.x,a.y-o.y),hl(s.x-a.x,s.y-a.y));if(!c){i.push(dl(a));continue}const u=Rs(a,o,c),l=Rs(a,o,c*.5),p=Rs(a,s,c),f=Rs(a,s,c*.5);i.push(dl(u)),i.push(D1(l,f,p))}return i}function Rs(e,t,n){const i=t.x-e.x,r=t.y-e.y,o=hl(i,r),a=n/o;return{x:e.x+i*a,y:e.y+r*a}}function hl(e,t){return Math.sqrt(Math.pow(e,2)+Math.pow(t,2))}function Zo(e,t,n){Le(t)&&(n=t,t=null),t||(t={});const i=Ce("path",t);return Le(n)&&(i.dataset.cornerRadius=String(n)),ml(i,e)}function ml(e,t){const n=parseInt(e.dataset.cornerRadius,10)||0;return he(e,{d:kr(L1(t,n))}),e}function Cs(e){var t=new Set(e);return Ge(e,function(n){for(var i=n.parent;i;){if(t.has(i))return!1;i=i.parent}return!0})}function Or(e,t,n){n=n||0,ke(e)||(e=[e]),L(e,function(i,r){var o=t(i,r,n);ke(o)&&o.length&&Or(o,t,n+1)})}function gl(e,t,n){var i=new Set,r=new Set;return Or(e,function(o,a,s){i.add(o);var c=o.children;if(c&&!r.has(c))return r.add(c),c}),Array.from(i)}function Qo(e,t){return gl(e)}function I1(e,t,n){Sr(t)&&(t=!0),Vt(t)&&(n=t,t=!0),n=n||{};var i=Jo(n.allShapes),r=Jo(n.allConnections),o=Jo(n.enclosedElements),a=Jo(n.enclosedConnections),s=Jo(n.topLevel,t&&eo(e,function(l){return l.id}));function c(l){s[l.source.id]&&s[l.target.id]&&(s[l.id]=[l]),i[l.source.id]&&i[l.target.id]&&(a[l.id]=o[l.id]=l),r[l.id]=l}function u(l){if(o[l.id]=l,l.waypoints)a[l.id]=r[l.id]=l;else return i[l.id]=l,L(l.incoming,c),L(l.outgoing,c),l.children}return Or(e,u),{allShapes:i,allConnections:r,topLevel:s,enclosedConnections:a,enclosedElements:o}}function Tt(e,t){t=!!t,ke(e)||(e=[e]);var n,i,r,o;return L(e,function(a){var s=a;a.waypoints&&!t&&(s=Tt(a.waypoints,!0));var c=s.x,u=s.y,l=s.height||0,p=s.width||0;(c<n||n===void 0)&&(n=c),(u<i||i===void 0)&&(i=u),(c+p>r||r===void 0)&&(r=c+p),(u+l>o||o===void 0)&&(o=u+l)}),{x:n,y:i,height:o-i,width:r-n}}function uo(e,t){var n={};return L(e,function(i){var r=i;r.waypoints&&(r=Tt(r)),!Le(t.y)&&r.x>t.x&&(n[i.id]=i),!Le(t.x)&&r.y>t.y&&(n[i.id]=i),r.x>t.x&&r.y>t.y&&(Le(t.width)&&Le(t.height)&&r.width+r.x<t.width+t.x&&r.height+r.y<t.height+t.y||!Le(t.width)||!Le(t.height))&&(n[i.id]=i)}),n}function Hh(e){return"waypoints"in e?"connection":"x"in e?"shape":"root"}function zh(e){return!!(e&&e.isFrame)}function Jo(e,t){return H({},e||{},t||{})}var N1=1;function Qi(e,t){Ti.call(this,e,N1),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})}de(Qi,Ti),Qi.prototype.canRender=function(){return!0},Qi.prototype.drawShape=function(t,n,i){var r=Ce("rect");return he(r,{x:0,y:0,width:n.width||0,height:n.height||0}),zh(n)?he(r,H({},this.FRAME_STYLE,i||{})):he(r,H({},this.SHAPE_STYLE,i||{})),Be(t,r),r},Qi.prototype.drawConnection=function(t,n,i){var r=Zo(n.waypoints,H({},this.CONNECTION_STYLE,i||{}));return Be(t,r),r},Qi.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 kr(a)},Qi.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 kr(o)},Qi.$inject=["eventBus","styles"];function B1(){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 H(o,{class:n})},this.style=function(n,i){!ke(n)&&!i&&(i=n,n=[]);var r=En(n,function(o,a){return H(o,e[a]||{})},{});return i?H(r,i):r},this.computeStyle=function(n,i,r){return ke(i)||(r=i,i=[]),t.style(i||[],H({},r,n||{}))}}const $1={__init__:["defaultRenderer"],defaultRenderer:["type",Qi],styles:["type",B1]};function Rt(e,t){if(!e||!t)return-1;var n=e.indexOf(t);return n!==-1&&e.splice(n,1),n}function Pt(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 yl(e,t){return!e||!t?-1:e.indexOf(t)}function ea(e,t){return!e||!t?-1:Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function vl(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=ea(e,t);return Math.abs(r/o)<=i}var j1=2;function Mi(e,t){var n=Array.from(arguments).flat();const i={x:"v",y:"h"};for(const[r,o]of Object.entries(i))if(F1(r,n))return o;return!1}function F1(e,t){const n=t[0];return Rr(t,function(i){return Math.abs(n[e]-i[e])<=j1})}function Gh(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 bl(e,t){return{x:Math.round(e.x+(t.x-e.x)/2),y:Math.round(e.y+(t.y-e.y)/2)}}var H1=/,?([a-z]),?/gi,Vh=parseFloat,Mt=Math,Ji=Mt.PI,li=Mt.min,pi=Mt.max,Wh=Mt.pow,er=Mt.abs,z1=/([a-z])[\s,]*((-?\d*\.?\d*(?:e[-+]?\d+)?[\s]*,?[\s]*)+)/ig,G1=/(-?\d*\.?\d*(?:e[-+]?\d+)?)[\s]*,?[\s]*/ig,Uh=Array.isArray||function(e){return e instanceof Array};function V1(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function W1(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 U1(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 V1(r,i)?(W1(o,i),r[i]):(o.length>=1e3&&delete r[o.shift()],o.push(i),r[i]=e(...arguments),r[i])}return t}function q1(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(z1,function(i,r,o){var a=[],s=r.toLowerCase();for(o.replace(G1,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=xl,n}function Y1(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 K1(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 _l(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 xl(){return this.join(",").replace(H1,"$1")}function X1(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=xl,t}function qh(e,t,n,i,r,o,a,s,c){var u=1-c,l=Wh(u,3),p=Wh(u,2),f=c*c,d=f*c,g=l*e+p*3*c*n+u*3*c*c*r+d*a,h=l*t+p*3*c*i+u*3*c*c*o+d*s;return{x:Ps(g),y:Ps(h)}}function Yh(e){var t=nS(...e);return _l(t.x0,t.y0,t.x1-t.x0,t.y1-t.y0)}function tr(e,t,n){return t>=e.x&&t<=e.x+e.width&&n>=e.y&&n<=e.y+e.height}function Z1(e,t){return e=_l(e),t=_l(t),tr(t,e.x,e.y)||tr(t,e.x2,e.y)||tr(t,e.x,e.y2)||tr(t,e.x2,e.y2)||tr(e,t.x,t.y)||tr(e,t.x2,t.y)||tr(e,t.x,t.y2)||tr(e,t.x2,t.y2)||(e.x<t.x2&&e.x>t.x||t.x<e.x2&&t.x>e.x)&&(e.y<t.y2&&e.y>t.y||t.y<e.y2&&t.y>e.y)}function Kh(e,t,n,i,r){var o=-3*t+9*n-9*i+3*r,a=e*o+6*t-12*n+6*i;return e*a-3*t+3*n}function Xh(e,t,n,i,r,o,a,s,c){c==null&&(c=1),c=c>1?1:c<0?0:c;for(var u=c/2,l=12,p=[-.1252,.1252,-.3678,.3678,-.5873,.5873,-.7699,.7699,-.9041,.9041,-.9816,.9816],f=[.2491,.2491,.2335,.2335,.2032,.2032,.1601,.1601,.1069,.1069,.0472,.0472],d=0,g=0;g<l;g++){var h=u*p[g]+u,m=Kh(h,e,n,r,a),E=Kh(h,t,i,o,s),y=m*m+E*E;d+=f[g]*Mt.sqrt(y)}return u*d}function Q1(e,t,n,i,r,o,a,s){if(!(pi(e,n)<li(r,a)||li(e,n)>pi(r,a)||pi(t,i)<li(o,s)||li(t,i)>pi(o,s))){var c=(e*i-t*n)*(r-a)-(e-n)*(r*s-o*a),u=(e*i-t*n)*(o-s)-(t-i)*(r*s-o*a),l=(e-n)*(o-s)-(t-i)*(r-a);if(l){var p=Ps(c/l),f=Ps(u/l),d=+p.toFixed(2),g=+f.toFixed(2);if(!(d<+li(e,n).toFixed(2)||d>+pi(e,n).toFixed(2)||d<+li(r,a).toFixed(2)||d>+pi(r,a).toFixed(2)||g<+li(t,i).toFixed(2)||g>+pi(t,i).toFixed(2)||g<+li(o,s).toFixed(2)||g>+pi(o,s).toFixed(2)))return{x:p,y:f}}}}function Ps(e){return Math.round(e*1e11)/1e11}function J1(e,t,n){var i=Yh(e),r=Yh(t);if(!Z1(i,r))return[];var o=Xh(...e),a=Xh(...t),s=Qh(e)?1:~~(o/5)||1,c=Qh(t)?1:~~(a/5)||1,u=new Array(s+1),l=new Array(c+1),p={},f=[],d,g;for(d=0;d<s+1;d++){var h=qh(...e,d/s);u[d]={x:h.x,y:h.y,t:d/s}}for(d=0;d<c+1;d++)h=qh(...t,d/c),l[d]={x:h.x,y:h.y,t:d/c};for(d=0;d<s;d++)for(g=0;g<c;g++){var m=u[d],E=u[d+1],y=l[g],x=l[g+1],S=er(E.x-m.x)<.01?"y":"x",P=er(x.x-y.x)<.01?"y":"x",C=Q1(m.x,m.y,E.x,E.y,y.x,y.y,x.x,x.y),D;if(C){if(D=C.x.toFixed(9)+"#"+C.y.toFixed(9),p[D])continue;p[D]=!0;var T=m.t+er((C[S]-m[S])/(E[S]-m[S]))*(E.t-m.t),N=y.t+er((C[P]-y[P])/(x[P]-y[P]))*(x.t-y.t);T>=0&&T<=1&&N>=0&&N<=1&&f.push({x:C.x,y:C.y,t1:T,t2:N})}}return f}function Zh(e,t,n){e=tm(e),t=tm(t);for(var i,r,o,a,s,c,u,l,p,f,d=n?0:[],g=0,h=e.length;g<h;g++){var m=e[g];if(m[0]=="M")i=s=m[1],r=c=m[2];else{m[0]=="C"?(p=[i,r,...m.slice(1)],i=p[6],r=p[7]):(p=[i,r,i,r,s,c,s,c],i=s,r=c);for(var E=0,y=t.length;E<y;E++){var x=t[E];if(x[0]=="M")o=u=x[1],a=l=x[2];else{x[0]=="C"?(f=[o,a,...x.slice(1)],o=f[6],a=f[7]):(f=[o,a,o,a,u,l,u,l],o=u,a=l);var S=J1(p,f);{for(var P=0,C=S.length;P<C;P++)S[P].segment1=g,S[P].segment2=E,S[P].bez1=p,S[P].bez2=f;d=d.concat(S)}}}}}return d}function eS(e){return Uh(e)&&Uh(e[0])}function tS(e){if(Y1(e))return e;var t=new Array(e.length),n=0,i=0,r=0,o=0,a=0,s;e[0][0]=="M"&&(n=+e[0][1],i=+e[0][2],r=n,o=i,a++,t[0]=["M",n,i]);for(var c,u,l=a,p=e.length;l<p;l++){if(u=e[l],s=u[0],t[l]=c=new Array(u.length),s!=s.toUpperCase())switch(c[0]=s.toUpperCase(),c[0]){case"A":c[1]=u[1],c[2]=u[2],c[3]=u[3],c[4]=u[4],c[5]=u[5],c[6]=+u[6]+n,c[7]=+u[7]+i;break;case"V":c[1]=+u[1]+i;break;case"H":c[1]=+u[1]+n;break;case"M":r=+u[1]+n,o=+u[2]+i;default:for(var f=1,d=u.length;f<d;f++)c[f]=+u[f]+(f%2?n:i)}else for(var g=0,h=u.length;g<h;g++)c[g]=u[g];switch(s=s.toUpperCase(),c[0]){case"Z":n=+r,i=+o;break;case"H":n=c[1];break;case"V":i=c[1];break;case"M":r=c[c.length-2],o=c[c.length-1];default:n=c[c.length-2],i=c[c.length-1]}}return t.toString=xl,t}function Qh(e){return e[0]===e[2]&&e[1]===e[3]&&e[4]===e[6]&&e[5]===e[7]}function As(e,t,n,i){return[e,t,n,i,n,i]}function Jh(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 em(e,t,n,i,r,o,a,s,c,u){var l=Ji*120/180,p=Ji/180*(+r||0),f=[],d,g=U1(function(M,w,b){var j=M*Mt.cos(b)-w*Mt.sin(b),W=M*Mt.sin(b)+w*Mt.cos(b);return{x:j,y:W}});if(u)D=u[0],T=u[1],P=u[2],C=u[3];else{d=g(e,t,-p),e=d.x,t=d.y,d=g(s,c,-p),s=d.x,c=d.y;var h=(e-s)/2,m=(t-c)/2,E=h*h/(n*n)+m*m/(i*i);E>1&&(E=Mt.sqrt(E),n=E*n,i=E*i);var y=n*n,x=i*i,S=(o==a?-1:1)*Mt.sqrt(er((y*x-y*m*m-x*h*h)/(y*m*m+x*h*h))),P=S*n*m/i+(e+s)/2,C=S*-i*h/n+(t+c)/2,D=Mt.asin(((t-C)/i).toFixed(9)),T=Mt.asin(((c-C)/i).toFixed(9));D=e<P?Ji-D:D,T=s<P?Ji-T:T,D<0&&(D=Ji*2+D),T<0&&(T=Ji*2+T),a&&D>T&&(D=D-Ji*2),!a&&T>D&&(T=T-Ji*2)}var N=T-D;if(er(N)>l){var k=T,O=s,F=c;T=D+l*(a&&T>D?1:-1),s=P+n*Mt.cos(T),c=C+i*Mt.sin(T),f=em(s,c,n,i,r,0,a,O,F,[T,k,P,C])}N=T-D;var oe=Mt.cos(D),_e=Mt.sin(D),We=Mt.cos(T),Y=Mt.sin(T),le=Mt.tan(N/4),ge=4/3*n*le,ue=4/3*i*le,Re=[e,t],re=[e+ge*_e,t-ue*oe],q=[s+ge*Y,c-ue*We],U=[s,c];if(re[0]=2*Re[0]-re[0],re[1]=2*Re[1]-re[1],u)return[re,q,U].concat(f);f=[re,q,U].concat(f).join().split(",");for(var Z=[],He=0,wt=f.length;He<wt;He++)Z[He]=He%2?g(f[He-1],f[He],p).y:g(f[He],f[He+1],p).x;return Z}function nS(e,t,n,i,r,o,a,s){for(var c=[],u=[[],[]],l,p,f,d,g,h,m,E,y=0;y<2;++y){if(y==0?(p=6*e-12*n+6*r,l=-3*e+9*n-9*r+3*a,f=3*n-3*e):(p=6*t-12*i+6*o,l=-3*t+9*i-9*o+3*s,f=3*i-3*t),er(l)<1e-12){if(er(p)<1e-12)continue;d=-f/p,0<d&&d<1&&c.push(d);continue}m=p*p-4*f*l,E=Mt.sqrt(m),!(m<0)&&(g=(-p+E)/(2*l),0<g&&g<1&&c.push(g),h=(-p-E)/(2*l),0<h&&h<1&&c.push(h))}for(var x=c.length,S=x,P;x--;)d=c[x],P=1-d,u[0][x]=P*P*P*e+3*P*P*d*n+3*P*d*d*r+d*d*d*a,u[1][x]=P*P*P*t+3*P*P*d*i+3*P*d*d*o+d*d*d*s;return u[0][S]=e,u[1][S]=t,u[0][S+1]=a,u[1][S+1]=s,u[0].length=u[1].length=S+2,{x0:li(...u[0]),y0:li(...u[1]),x1:pi(...u[0]),y1:pi(...u[1])}}function tm(e){if(eS(e)||(e=q1(e)),K1(e))return e;for(var t=X1(tS(e)),n={x:0,y:0,bx:0,by:0,X:0,Y:0,qx:null,qy:null},i=function(f,d,g){var h,m;if(!f)return["C",d.x,d.y,d.x,d.y,d.x,d.y];switch(!(f[0]in{T:1,Q:1})&&(d.qx=d.qy=null),f[0]){case"M":d.X=f[1],d.Y=f[2];break;case"A":f=["C",...em(d.x,d.y,...f.slice(1))];break;case"S":g=="C"||g=="S"?(h=d.x*2-d.bx,m=d.y*2-d.by):(h=d.x,m=d.y),f=["C",h,m,...f.slice(1)];break;case"T":g=="Q"||g=="T"?(d.qx=d.x*2-d.qx,d.qy=d.y*2-d.qy):(d.qx=d.x,d.qy=d.y),f=["C",...Jh(d.x,d.y,d.qx,d.qy,f[1],f[2])];break;case"Q":d.qx=f[1],d.qy=f[2],f=["C",...Jh(d.x,d.y,f[1],f[2],f[3],f[4])];break;case"L":f=["C",...As(d.x,d.y,f[1],f[2])];break;case"H":f=["C",...As(d.x,d.y,f[1],d.y)];break;case"V":f=["C",...As(d.x,d.y,d.x,f[1])];break;case"Z":f=["C",...As(d.x,d.y,d.X,d.Y)];break}return f},r=function(f,d){if(f[d].length>7){f[d].shift();for(var g=f[d];g.length;)o[d]="A",f.splice(d++,0,["C",...g.splice(0,6)]);f.splice(d,1),u=t.length}},o=[],a="",s="",c=0,u=t.length;c<u;c++){t[c]&&(a=t[c][0]),a!="C"&&(o[c]=a,c&&(s=o[c-1])),t[c]=i(t[c],n,s),o[c]!="A"&&a=="C"&&(o[c]="C"),r(t,c);var l=t[c],p=l.length;n.x=l[p-2],n.y=l[p-1],n.bx=Vh(l[p-4])||n.x,n.by=Vh(l[p-3])||n.y}return t}function st(e){return Vt(e)&&wn(e,"waypoints")}function Fe(e){return Vt(e)&&wn(e,"labelTarget")}function iS(e){return Vt(e)&&Qr(e.parent)}function nm(e){return{x:Math.round(e.x),y:Math.round(e.y),width:Math.round(e.width),height:Math.round(e.height)}}function ki(e){return{x:Math.round(e.x),y:Math.round(e.y)}}function Pe(e){return{top:e.y,right:e.x+(e.width||0),bottom:e.y+(e.height||0),left:e.x}}function Ts(e){return{x:e.left,y:e.top,width:e.right-e.left,height:e.bottom-e.top}}function rS(e){return ki({x:e.x+(e.width||0)/2,y:e.y+(e.height||0)/2})}function oS(e){for(var t=e.waypoints,n=t.reduce(function(u,l,p){var f=t[p-1];if(f){var d=u[u.length-1],g=d&&d.endLength||0,h=cS(f,l);u.push({start:f,end:l,startLength:g,endLength:g+h,length:h})}return u},[]),i=n.reduce(function(u,l){return u+l.length},0),r=i/2,o=0,a=n[o];a.endLength<r;)a=n[++o];var s=(r-a.startLength)/a.length,c={x:a.start.x+(a.end.x-a.start.x)*s,y:a.start.y+(a.end.y-a.start.y)*s};return c}function Oe(e){return st(e)?oS(e):rS(e)}function Jt(e,t,n){n=n||0,Vt(n)||(n={x:n,y:n});var i=Pe(e),r=Pe(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 ta(e,t,n){var i=aS(e,t);return i.length===1||i.length===2&&ea(i[0],i[1])<1?ki(i[0]):i.length>1?(i=ii(i,function(r){var o=Math.floor(r.t2*100)||1;return o=100-o,o=(o<10?"0":"")+o,r.segment2+"#"+o}),ki(i[n?0:i.length-1])):null}function aS(e,t){return Zh(e,t)}function sS(e){e=e.slice();for(var t=0,n,i,r;e[t];)n=e[t],i=e[t-1],r=e[t+1],ea(n,r)===0||vl(i,r,n)?e.splice(t,1):t++;return e}function cS(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function Ms(e,t){return Math.round(e*t)/t}function im(e){return Le(e)?e+"px":e}function uS(e){for(;e.parent;)e=e.parent;return e}function lS(e){e=H({},{width:"100%",height:"100%"},e);const t=e.container||document.body,n=document.createElement("div");return n.setAttribute("class","djs-container djs-parent"),dn(n,{position:"relative",overflow:"hidden",width:im(e.width),height:im(e.height)}),t.appendChild(n),n}function rm(e,t,n){const i=Ce("g");qe(i).add(t);const r=n!==void 0?n:e.childNodes.length-1;return e.insertBefore(i,e.childNodes[r]||null),i}const pS="base",om=0,fS=1,dS={shape:["x","y","width","height"],connection:["waypoints"]};function De(e,t,n,i){this._eventBus=t,this._elementRegistry=i,this._graphicsFactory=n,this._rootsIdx=0,this._layers={},this._planes=[],this._rootElement=null,this._focused=!1,this._init(e||{})}De.$inject=["config.canvas","eventBus","graphicsFactory","elementRegistry"],De.prototype._init=function(e){const t=this._eventBus,n=this._container=lS(e),i=this._svg=Ce("svg");he(i,{width:"100%",height:"100%"}),sn(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")}),Be(n,i);const r=this._viewport=rm(i,"viewport");e.deferUpdate&&(this._viewboxChanged=Du(this._viewboxChanged,300)),this._restoreFocus=Du(this._restoreFocus,0),t.on("diagram.init",()=>{t.fire("canvas.init",{svg:i,viewport:r})}),t.on(["shape.added","connection.added","shape.removed","connection.removed","elements.changed","root.set"],()=>{delete this._cachedViewbox}),t.on("diagram.destroy",500,this._destroy,this),t.on("diagram.clear",500,this._clear,this)},De.prototype._destroy=function(){this._restoreFocus.cancel(),this._eventBus.fire("canvas.destroy",{svg:this._svg,viewport:this._viewport});const e=this._container.parentNode;e&&e.removeChild(this._container),delete this._svg,delete this._container,delete this._layers,delete this._planes,delete this._rootElement,delete this._viewport},De.prototype._setFocused=function(e){e!=this._focused&&(this._focused=e,this._eventBus.fire("canvas.focus.changed",{focused:e}))},De.prototype._clear=function(){this._elementRegistry.getAll().forEach(t=>{const n=Hh(t);n==="root"?this.removeRootElement(t):this._removeElement(t,n)}),this._planes=[],this._rootElement=null,delete this._cachedViewbox},De.prototype.focus=function(){this._svg.focus({preventScroll:!0}),this._setFocused(!0)},De.prototype.restoreFocus=function(){this._restoreFocus()},De.prototype._restoreFocus=function(){document.activeElement===document.body&&this.focus()},De.prototype.isFocused=function(){return this._focused},De.prototype.getDefaultLayer=function(){return this.getLayer(pS,om)},De.prototype.getLayer=function(e,t){if(!e)throw new Error("must specify a name");let n=this._layers[e];if(n||(n=this._layers[e]=this._createLayer(e,t)),typeof t<"u"&&n.index!==t)throw new Error("layer <"+e+"> already created at index <"+t+">");return n.group},De.prototype._getChildIndex=function(e){return En(this._layers,function(t,n){return n.visible&&e>=n.index&&t++,t},0)},De.prototype._createLayer=function(e,t){typeof t>"u"&&(t=fS);const n=this._getChildIndex(t);return{group:rm(this._viewport,"layer-"+e,n),index:t,visible:!0}},De.prototype.showLayer=function(e){if(!e)throw new Error("must specify a name");const t=this._layers[e];if(!t)throw new Error("layer <"+e+"> does not exist");const n=this._viewport,i=t.group,r=t.index;if(t.visible)return i;const o=this._getChildIndex(r);return n.insertBefore(i,n.childNodes[o]||null),t.visible=!0,i},De.prototype.hideLayer=function(e){if(!e)throw new Error("must specify a name");const t=this._layers[e];if(!t)throw new Error("layer <"+e+"> does not exist");const n=t.group;return t.visible&&($t(n),t.visible=!1),n},De.prototype._removeLayer=function(e){const t=this._layers[e];t&&(delete this._layers[e],$t(t.group))},De.prototype.getActiveLayer=function(){const e=this._findPlaneForRoot(this.getRootElement());return e?e.layer:null},De.prototype.findRoot=function(e){const t=this._resolveElements(e);let n;for(const i of t){const r=this._findPlaneForRoot(uS(i));if(!r||n&&r.rootElement!==n)return;n=r.rootElement}return n},De.prototype.getRootElements=function(){return this._planes.map(function(e){return e.rootElement})},De.prototype._findPlaneForRoot=function(e){return lt(this._planes,function(t){return t.rootElement===e})},De.prototype._resolveElement=function(e){return typeof e=="string"?this._elementRegistry.get(e):e},De.prototype._resolveElements=function(e){return ke(e)||(e=[e]),e.map(t=>this._resolveElement(t)).filter(Boolean)},De.prototype.getContainer=function(){return this._container},De.prototype._updateMarker=function(e,t,n){let i;e=this._resolveElement(e),e.markers=e.markers||new Set,i=this._elementRegistry._elements[e.id],i&&(L([i.gfx,i.secondaryGfx],function(r){r&&(n?(e.markers.add(t),qe(r).add(t)):(e.markers.delete(t),qe(r).remove(t)))}),this._eventBus.fire("element.marker.update",{element:e,gfx:i.gfx,marker:t,add:!!n}))},De.prototype.addMarker=function(e,t){this._updateMarker(e,t,!0)},De.prototype.removeMarker=function(e,t){this._updateMarker(e,t,!1)},De.prototype.hasMarker=function(e,t){return e=this._resolveElement(e),e.markers?e.markers.has(t):!1},De.prototype.toggleMarker=function(e,t){this.hasMarker(e,t)?this.removeMarker(e,t):this.addMarker(e,t)},De.prototype.getRootElement=function(){const e=this._rootElement;return e||this._planes.length?e:this.setRootElement(this.addRootElement(null))},De.prototype.addRootElement=function(e){const t=this._rootsIdx++;e||(e={id:"__implicitroot_"+t,children:[],isImplicit:!0});const n=e.layer="root-"+t;this._ensureValid("root",e);const i=this.getLayer(n,om);return this.hideLayer(n),this._addRoot(e,i),this._planes.push({rootElement:e,layer:i}),e},De.prototype.removeRootElement=function(e){if(e=this._resolveElement(e),!!this._findPlaneForRoot(e))return this._removeRoot(e),this._removeLayer(e.layer),this._planes=this._planes.filter(function(n){return n.rootElement!==e}),this._rootElement===e&&(this._rootElement=null),e},De.prototype.setRootElement=function(e){if(e===this._rootElement)return e;let t;if(!e)throw new Error("rootElement required");return t=this._findPlaneForRoot(e),t||(e=this.addRootElement(e)),this._setRoot(e),e},De.prototype._removeRoot=function(e){const t=this._elementRegistry,n=this._eventBus;n.fire("root.remove",{element:e}),n.fire("root.removed",{element:e}),t.remove(e)},De.prototype._addRoot=function(e,t){const n=this._elementRegistry,i=this._eventBus;i.fire("root.add",{element:e}),n.add(e,t),i.fire("root.added",{element:e,gfx:t})},De.prototype._setRoot=function(e,t){const n=this._rootElement;n&&(this._elementRegistry.updateGraphics(n,null,!0),this.hideLayer(n.layer)),e&&(t||(t=this._findPlaneForRoot(e).layer),this._elementRegistry.updateGraphics(e,this._svg,!0),this.showLayer(e.layer)),this._rootElement=e,this._eventBus.fire("root.set",{element:e})},De.prototype._ensureValid=function(e,t){if(!t.id)throw new Error("element must have an id");if(this._elementRegistry.get(t.id))throw new Error("element <"+t.id+"> already exists");const n=dS[e];if(!Rr(n,function(r){return typeof t[r]<"u"}))throw new Error("must supply { "+n.join(", ")+" } with "+e)},De.prototype._setParent=function(e,t,n){Pt(t.children,e,n),e.parent=t},De.prototype._addElement=function(e,t,n,i){n=n||this.getRootElement();const r=this._eventBus,o=this._graphicsFactory;this._ensureValid(e,t),r.fire(e+".add",{element:t,parent:n}),this._setParent(t,n,i);const a=o.create(e,t,i);return this._elementRegistry.add(t,a),o.update(e,t,a),r.fire(e+".added",{element:t,gfx:a}),t},De.prototype.addShape=function(e,t,n){return this._addElement("shape",e,t,n)},De.prototype.addConnection=function(e,t,n){return this._addElement("connection",e,t,n)},De.prototype._removeElement=function(e,t){const n=this._elementRegistry,i=this._graphicsFactory,r=this._eventBus;if(e=n.get(e.id||e),!!e)return r.fire(t+".remove",{element:e}),i.remove(e),Rt(e.parent&&e.parent.children,e),e.parent=null,r.fire(t+".removed",{element:e}),n.remove(e),e},De.prototype.removeShape=function(e){return this._removeElement(e,"shape")},De.prototype.removeConnection=function(e){return this._removeElement(e,"connection")},De.prototype.getGraphics=function(e,t){return this._elementRegistry.getGraphics(e,t)},De.prototype._changeViewbox=function(e){this._eventBus.fire("canvas.viewbox.changing"),e.apply(this),this._cachedViewbox=null,this._viewboxChanged()},De.prototype._viewboxChanged=function(){this._eventBus.fire("canvas.viewbox.changed",{viewbox:this.viewbox()})},De.prototype.viewbox=function(e){if(e===void 0&&this._cachedViewbox)return structuredClone(this._cachedViewbox);const t=this._viewport,n=this.getSize();let i,r,o,a,s,c,u;if(e)this._changeViewbox(function(){s=Math.min(n.width/e.width,n.height/e.height);const l=this._svg.createSVGMatrix().scale(s).translate(-e.x,-e.y);Xo(t,l)});else return o=this._rootElement?this.getActiveLayer():null,i=o&&o.getBBox()||{},a=Xo(t),r=a?a.matrix:v1(),s=Ms(r.a,1e3),c=Ms(-r.e||0,1e3),u=Ms(-r.f||0,1e3),e=this._cachedViewbox={x:c?c/s:0,y:u?u/s:0,width:n.width/s,height:n.height/s,scale:s,inner:{width:i.width||0,height:i.height||0,x:i.x||0,y:i.y||0},outer:n},e;return e},De.prototype.scroll=function(e){const t=this._viewport;let n=t.getCTM();return e&&this._changeViewbox(function(){e=H({dx:0,dy:0},e||{}),n=this._svg.createSVGMatrix().translate(e.dx,e.dy).multiply(n),am(t,n)}),{x:n.e,y:n.f}},De.prototype.scrollToElement=function(e,t){let n=100;const i=this._resolveElements(e);if(!i.length)return;const r=this.findRoot(i);if(!r)return;r!==this.getRootElement()&&this.setRootElement(r);const o=i.filter(g=>g!=r);if(!o.length)return;t||(t={}),typeof t=="number"&&(n=t),t={top:t.top||n,right:t.right||n,bottom:t.bottom||n,left:t.left||n};const a=Tt(o),s=Pe(a),c=this.viewbox(),u=this.zoom();let l,p;c.y+=t.top/u,c.x+=t.left/u,c.width-=(t.right+t.left)/u,c.height-=(t.bottom+t.top)/u;const f=Pe(c);if(!(a.width<c.width&&a.height<c.height))l=a.x-c.x,p=a.y-c.y;else{const g=Math.max(0,s.right-f.right),h=Math.min(0,s.left-f.left),m=Math.max(0,s.bottom-f.bottom),E=Math.min(0,s.top-f.top);l=g||h,p=m||E}this.scroll({dx:-l*u,dy:-p*u})},De.prototype.zoom=function(e,t){if(!e)return this.viewbox(e).scale;if(e==="fit-viewport")return this._fitViewport(t);let n,i;return this._changeViewbox(function(){typeof t!="object"&&(n=this.viewbox().outer,t={x:n.width/2,y:n.height/2}),i=this._setZoom(e,t)}),Ms(i.a,1e3)};function am(e,t){const n="matrix("+t.a+","+t.b+","+t.c+","+t.d+","+t.e+","+t.f+")";e.setAttribute("transform",n)}De.prototype._fitViewport=function(e){const t=this.viewbox(),n=t.outer,i=t.inner;let r,o;return i.x>=0&&i.y>=0&&i.x+i.width<=n.width&&i.y+i.height<=n.height&&!e?o={x:0,y:0,width:Math.max(i.width+i.x,n.width),height:Math.max(i.height+i.y,n.height)}:(r=Math.min(1,n.width/i.width,n.height/i.height),o={x:i.x+(e?i.width/2-n.width/r/2:0),y:i.y+(e?i.height/2-n.height/r/2:0),width:n.width/r,height:n.height/r}),this.viewbox(o),this.viewbox(!1).scale},De.prototype._setZoom=function(e,t){const n=this._svg,i=this._viewport,r=n.createSVGMatrix(),o=n.createSVGPoint();let a,s,c,u,l;c=i.getCTM();const p=c.a;return t?(a=H(o,t),s=a.matrixTransform(c.inverse()),u=r.translate(s.x,s.y).scale(1/p*e).translate(-s.x,-s.y),l=c.multiply(u)):l=r.scale(e),am(this._viewport,l),l},De.prototype.getSize=function(){return{width:this._container.clientWidth,height:this._container.clientHeight}},De.prototype.getAbsoluteBBox=function(e){const t=this.viewbox();let n;e.waypoints?n=this.getGraphics(e).getBBox():n=e;const i=n.x*t.scale-t.x*t.scale,r=n.y*t.scale-t.y*t.scale,o=n.width*t.scale,a=n.height*t.scale;return{x:i,y:r,width:o,height:a}},De.prototype.resized=function(){delete this._cachedViewbox,this._eventBus.fire("canvas.resized")};var lo="data-element-id";function In(e){this._elements={},this._eventBus=e}In.$inject=["eventBus"],In.prototype.add=function(e,t,n){var i=e.id;this._validateId(i),he(t,lo,i),n&&he(n,lo,i),this._elements[i]={element:e,gfx:t,secondaryGfx:n}},In.prototype.remove=function(e){var t=this._elements,n=e.id||e,i=n&&t[n];i&&(he(i.gfx,lo,""),i.secondaryGfx&&he(i.secondaryGfx,lo,""),delete t[n])},In.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)},In.prototype.updateGraphics=function(e,t,n){var i=e.id||e,r=this._elements[i];return n?r.secondaryGfx=t:r.gfx=t,t&&he(t,lo,i),t},In.prototype.get=function(e){var t;typeof e=="string"?t=e:t=e&&he(e,lo);var n=this._elements[t];return n&&n.element},In.prototype.filter=function(e){var t=[];return this.forEach(function(n,i){e(n,i)&&t.push(n)}),t},In.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}},In.prototype.getAll=function(){return this.filter(function(e){return e})},In.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)})},In.prototype.getGraphics=function(e,t){var n=e.id||e,i=this._elements[n];return i&&(t?i.secondaryGfx:i.gfx)},In.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 hS(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 mS(e){return e.__refs_collection===!0}function gS(e,t){return Object.prototype.hasOwnProperty.call(e,t.name||t)}function sm(e,t,n){var i=hS(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 yS(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 jn(e,t){if(!(this instanceof jn))return new jn(e,t);e.inverse=t,t.inverse=e,this.props={},this.props[e.name]=e,this.props[t.name]=t}jn.prototype.bind=function(e,t){if(typeof t=="string"){if(!this.props[t])throw new Error("no property <"+t+"> in ref");t=this.props[t]}t.collection?sm(this,t,e):yS(this,t,e)},jn.prototype.ensureRefsCollection=function(e,t){var n=e[t.name];return mS(n)||sm(this,t,e),n},jn.prototype.ensureBound=function(e,t){gS(e,t)||this.bind(e,t)},jn.prototype.unset=function(e,t,n){e&&(this.ensureBound(e,t),t.collection?this.ensureRefsCollection(e,t).remove(n):e[t.name]=void 0)},jn.prototype.set=function(e,t,n){e&&(this.ensureBound(e,t),t.collection?this.ensureRefsCollection(e,t).add(n):e[t.name]=n)};var wl=new jn({name:"children",enumerable:!0,collection:!0},{name:"parent"}),cm=new jn({name:"labels",enumerable:!0,collection:!0},{name:"labelTarget"}),um=new jn({name:"attachers",collection:!0},{name:"host"}),lm=new jn({name:"outgoing",collection:!0},{name:"source"}),pm=new jn({name:"incoming",collection:!0},{name:"target"});function po(){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)}}),wl.bind(this,"parent"),cm.bind(this,"labels"),lm.bind(this,"outgoing"),pm.bind(this,"incoming")}function na(){po.call(this),wl.bind(this,"children"),um.bind(this,"host"),um.bind(this,"attachers")}de(na,po);function fm(){po.call(this),wl.bind(this,"children")}de(fm,na);function dm(){na.call(this),cm.bind(this,"labelTarget")}de(dm,na);function hm(){po.call(this),lm.bind(this,"source"),pm.bind(this,"target")}de(hm,po);var vS={connection:hm,shape:na,label:dm,root:fm};function bS(e,t){var n=vS[e];if(!n)throw new Error("unknown type: <"+e+">");return H(new n,t)}function _S(e){return e instanceof po}function Oi(){this._uid=12}Oi.prototype.createRoot=function(e){return this.create("root",e)},Oi.prototype.createLabel=function(e){return this.create("label",e)},Oi.prototype.createShape=function(e){return this.create("shape",e)},Oi.prototype.createConnection=function(e){return this.create("connection",e)},Oi.prototype.create=function(e,t){return t=H({},t||{}),t.id||(t.id=e+"_"+this._uid++),bS(e,t)};var ks="__fn",mm=1e3,xS=Array.prototype.slice;function Pn(){this._listeners={},this.on("diagram.destroy",1,this._destroy,this)}Pn.prototype.on=function(e,t,n,i){if(e=ke(e)?e:[e],Wt(t)&&(i=n,n=t,t=mm),!Le(t))throw new Error("priority must be a number");var r=n;i&&(r=mn(n,i),r[ks]=n[ks]||n);var o=this;e.forEach(function(a){o._addListener(a,{priority:t,callback:r,next:null})})},Pn.prototype.once=function(e,t,n,i){var r=this;if(Wt(t)&&(i=n,n=t,t=mm),!Le(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[ks]=n,this.on(e,t,o)},Pn.prototype.off=function(e,t){e=ke(e)?e:[e];var n=this;e.forEach(function(i){n._removeListener(i,t)})},Pn.prototype.createEvent=function(e){var t=new ia;return t.init(e),t},Pn.prototype.fire=function(e,t){var n,i,r,o;if(o=xS.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 ia?n=t:n=this.createEvent(t),o[0]=n;var a=n.type;e!==a&&(n.type=e);try{r=this._invokeListeners(n,o,i)}finally{e!==a&&(n.type=a)}return r===void 0&&n.defaultPrevented&&(r=!1),r}},Pn.prototype.handleError=function(e){return this.fire("error",{error:e})===!1},Pn.prototype._destroy=function(){this._listeners={}},Pn.prototype._invokeListeners=function(e,t,n){for(var i;n&&!e.cancelBubble;)i=this._invokeListener(e,t,n),n=n.next;return i},Pn.prototype._invokeListener=function(e,t,n){var i;if(n.callback.__isTomb)return i;try{i=wS(n.callback,t),i!==void 0&&(e.returnValue=i,e.stopPropagation()),i===!1&&e.preventDefault()}catch(r){if(!this.handleError(r))throw console.error("unhandled error in event listener",r),r}return i},Pn.prototype._addListener=function(e,t){var n=this._getListeners(e),i;if(!n){this._setListeners(e,t);return}for(;n;){if(n.priority<t.priority){t.next=n,i?i.next=t:this._setListeners(e,t);return}i=n,n=n.next}i.next=t},Pn.prototype._getListeners=function(e){return this._listeners[e]},Pn.prototype._setListeners=function(e,t){this._listeners[e]=t},Pn.prototype._removeListener=function(e,t){var n=this._getListeners(e),i,r,o;if(!t){this._setListeners(e,null);return}for(;n;)i=n.next,o=n.callback,(o===t||o[ks]===t)&&(r?r.next=i:this._setListeners(e,i)),r=n,n=i};function ia(){}ia.prototype.stopPropagation=function(){this.cancelBubble=!0},ia.prototype.preventDefault=function(){this.defaultPrevented=!0},ia.prototype.init=function(e){H(this,e||{})};function wS(e,t){return e.apply(null,t)}function Dr(e){return e.childNodes[0]}function ES(e){return e.parentNode.childNodes[1]}function Os(e,t,n,i,r){var o=Ko();o.setTranslate(t,n);var a=Ko();a.setRotate(i||0,0,0);var s=Ko();s.setScale(1,1),Xo(e,[o,a,s])}function en(e,t,n){var i=Ko();i.setTranslate(t,n),Xo(e,i)}function gm(e,t){var n=Ko();n.setRotate(t,0,0),Xo(e,n)}function Nn(e,t){this._eventBus=e,this._elementRegistry=t}Nn.$inject=["eventBus","elementRegistry"],Nn.prototype._getChildrenContainer=function(e){var t=this._elementRegistry.getGraphics(e),n;return e.parent?(n=ES(t),n||(n=Ce("g"),qe(n).add("djs-children"),Be(t.parentNode,n))):n=t,n},Nn.prototype._clear=function(e){var t=Dr(e);return _s(t),t},Nn.prototype._createContainer=function(e,t,n,i){var r=Ce("g");qe(r).add("djs-group"),typeof n<"u"?SS(r,t,t.childNodes[n]):Be(t,r);var o=Ce("g");qe(o).add("djs-element"),qe(o).add("djs-"+e),i&&qe(o).add("djs-frame"),Be(r,o);var a=Ce("g");return qe(a).add("djs-visual"),Be(o,a),o},Nn.prototype.create=function(e,t,n){var i=this._getChildrenContainer(t.parent);return this._createContainer(e,i,n,zh(t))},Nn.prototype.updateContainments=function(e){var t=this,n=this._elementRegistry,i;i=En(e,function(r,o){return o.parent&&(r[o.parent.id]=o.parent),r},{}),L(i,function(r){var o=r.children;if(o){var a=t._getChildrenContainer(r),s=a.firstChild;L(o,function(c){var u=n.getGraphics(c).parentNode;u===s?s=s.nextSibling:a.insertBefore(u,s)})}})},Nn.prototype.drawShape=function(e,t,n={}){var i=this._eventBus;return i.fire("render.shape",{gfx:e,element:t,attrs:n})},Nn.prototype.getShapePath=function(e){var t=this._eventBus;return t.fire("render.getShapePath",e)},Nn.prototype.drawConnection=function(e,t,n={}){var i=this._eventBus;return i.fire("render.connection",{gfx:e,element:t,attrs:n})},Nn.prototype.getConnectionPath=function(e){var t=this._eventBus;return t.fire("render.getConnectionPath",e)},Nn.prototype.update=function(e,t,n){if(t.parent){var i=this._clear(n);if(e==="shape")this.drawShape(i,t),en(n,t.x,t.y);else if(e==="connection")this.drawConnection(i,t);else throw new Error("unknown type: "+e);t.hidden?he(n,"display","none"):he(n,"display","block")}},Nn.prototype.remove=function(e){var t=this._elementRegistry.getGraphics(e);$t(t.parentNode)};function SS(e,t,n){var i=n||t.firstChild;e!==i&&t.insertBefore(e,i)}const RS={__depends__:[$1],__init__:["canvas"],canvas:["type",De],elementRegistry:["type",In],elementFactory:["type",Oi],eventBus:["type",Pn],graphicsFactory:["type",Nn]};function CS(e){var t=new Fh(e);return t.init(),t}function PS(e){e=e||{};var t={config:["value",e]},n=[t,RS].concat(e.modules||[]);return CS(n)}function nr(e,t){this._injector=t||PS(e),this.get("eventBus").fire("diagram.init")}nr.prototype.get=function(e,t){return this._injector.get(e,t)},nr.prototype.invoke=function(e,t,n){return this._injector.invoke(e,t,n)},nr.prototype.destroy=function(){this.get("eventBus").fire("diagram.destroy")},nr.prototype.clear=function(){this.get("eventBus").fire("diagram.clear")};function cn(e){return e?"<"+e.$type+(e.id?' id="'+e.id:"")+'" />':"<null>"}function gn(e,t){return e.$instanceOf(t)}function AS(e){return lt(e.rootElements,function(t){return gn(t,"bpmn:Process")||gn(t,"bpmn:Collaboration")})}function TS(e){var t={},n=[],i={};function r(q,U){return function(Z){q(Z,U)}}function o(q){t[q.id]=q}function a(q){return t[q.id]}function s(q,U){var Z=q.gfx;if(Z)throw new Error(`already rendered ${cn(q)}`);return e.element(q,i[q.id],U)}function c(q,U){return e.root(q,i[q.id],U)}function u(q,U){try{var Z=i[q.id]&&s(q,U);return o(q),Z}catch(He){l(He.message,{element:q,error:He}),console.error(`failed to import ${cn(q)}`,He)}}function l(q,U){e.error(q,U)}var p=this.registerDi=function(U){var Z=U.bpmnElement;Z?i[Z.id]?l(`multiple DI elements defined for ${cn(Z)}`,{element:Z}):i[Z.id]=U:l(`no bpmnElement referenced in ${cn(U)}`,{element:U})};function f(q){d(q.plane)}function d(q){p(q),L(q.planeElement,g)}function g(q){p(q)}this.handleDefinitions=function(U,Z){var He=U.diagrams;if(Z&&He.indexOf(Z)===-1)throw new Error("diagram not part of <bpmn:Definitions />");if(!Z&&He&&He.length&&(Z=He[0]),!Z)throw new Error("no diagram to display");i={},f(Z);var wt=Z.plane;if(!wt)throw new Error(`no plane for ${cn(Z)}`);var M=wt.bpmnElement;if(!M)if(M=AS(U),M)l(`correcting missing bpmnElement on ${cn(wt)} to ${cn(M)}`),wt.bpmnElement=M,p(wt);else throw new Error("no process or collaboration to display");var w=c(M,wt);if(gn(M,"bpmn:Process")||gn(M,"bpmn:SubProcess"))m(M,w);else if(gn(M,"bpmn:Collaboration"))Re(M,w),E(U.rootElements,w);else throw new Error(`unsupported bpmnElement for ${cn(wt)}: ${cn(M)}`);h(n)};var h=this.handleDeferred=function(){for(var U;n.length;)U=n.shift(),U()};function m(q,U){le(q,U),N(q.ioSpecification,U),T(q.artifacts,U),o(q)}function E(q,U){var Z=Ge(q,function(He){return!a(He)&&gn(He,"bpmn:Process")&&He.laneSets});Z.forEach(r(m,U))}function y(q,U){u(q,U)}function x(q,U){L(q,r(y,U))}function S(q,U){u(q,U)}function P(q,U){u(q,U)}function C(q,U){u(q,U)}function D(q,U){u(q,U)}function T(q,U){L(q,function(Z){gn(Z,"bpmn:Association")?n.push(function(){D(Z,U)}):D(Z,U)})}function N(q,U){q&&(L(q.dataInputs,r(P,U)),L(q.dataOutputs,r(C,U)))}var k=this.handleSubProcess=function(U,Z){le(U,Z),T(U.artifacts,Z)};function O(q,U){var Z=u(q,U);gn(q,"bpmn:SubProcess")&&k(q,Z||U),gn(q,"bpmn:Activity")&&N(q.ioSpecification,U),n.push(function(){L(q.dataInputAssociations,r(S,U)),L(q.dataOutputAssociations,r(S,U))})}function F(q,U){u(q,U)}function oe(q,U){u(q,U)}function _e(q,U){n.push(function(){var Z=u(q,U);q.childLaneSet&&We(q.childLaneSet,Z||U),re(q)})}function We(q,U){L(q.lanes,r(_e,U))}function Y(q,U){L(q,r(We,U))}function le(q,U){ge(q.flowElements,U),q.laneSets&&Y(q.laneSets,U)}function ge(q,U){L(q,function(Z){gn(Z,"bpmn:SequenceFlow")?n.push(function(){F(Z,U)}):gn(Z,"bpmn:BoundaryEvent")?n.unshift(function(){O(Z,U)}):gn(Z,"bpmn:FlowNode")?O(Z,U):gn(Z,"bpmn:DataObject")||(gn(Z,"bpmn:DataStoreReference")||gn(Z,"bpmn:DataObjectReference")?oe(Z,U):l(`unrecognized flowElement ${cn(Z)} in context ${cn(U&&U.businessObject)}`,{element:Z,context:U}))})}function ue(q,U){var Z=u(q,U),He=q.processRef;He&&m(He,Z||U)}function Re(q,U){L(q.participants,r(ue,U)),n.push(function(){x(q.messageFlows,U)}),T(q.artifacts,U)}function re(q){L(q.flowNodeRef,function(U){var Z=U.get("lanes");Z&&Z.push(q)})}}function _(e,t){var n=te(e);return n&&typeof n.$instanceOf=="function"&&n.$instanceOf(t)}function ze(e,t){return Ui(t,function(n){return _(e,n)})}function te(e){return e&&e.businessObject||e}function Ye(e){return e&&e.di}function MS(e,t,n){var i,r,o,a,s=[];function c(u,l){var p={root:function(h,m){return i.add(h,m)},element:function(h,m,E){return i.add(h,m,E)},error:function(h,m){s.push({message:h,context:m})}},f=new TS(p);l=l||u.diagrams&&u.diagrams[0];var d=kS(u,l);if(!d)throw new Error("no diagram to display");L(d,function(h){f.handleDefinitions(u,h)});var g=l.plane.bpmnElement.id;o.setRootElement(o.findRoot(g+"_plane")||o.findRoot(g))}return new Promise(function(u,l){try{return i=e.get("bpmnImporter"),r=e.get("eventBus"),o=e.get("canvas"),r.fire("import.render.start",{definitions:t}),c(t,n),r.fire("import.render.complete",{error:a,warnings:s}),u({warnings:s})}catch(p){return p.warnings=s,l(p)}})}function kS(e,t){if(!(!t||!t.plane)){var n=t.plane.bpmnElement,i=n;!_(n,"bpmn:Process")&&!_(n,"bpmn:Collaboration")&&(i=OS(n));var r;_(i,"bpmn:Collaboration")?r=i:r=lt(e.rootElements,function(u){if(_(u,"bpmn:Collaboration"))return lt(u.participants,function(l){return l.processRef===i})});var o=[i];r&&(o=on(r.participants,function(u){return u.processRef}),o.push(r));var a=ym(o),s=[t],c=[n];return L(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 ym(e){var t=[];return L(e,function(n){n&&(t.push(n),t=t.concat(ym(n.flowElements)))}),t}function OS(e){for(var t=e;t;){if(_(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>',vm=DS,bm={verticalAlign:"middle"},_m={color:"#404040"},LS={zIndex:"1001",position:"fixed",top:"0",left:"0",right:"0",bottom:"0"},IS={width:"100%",height:"100%",background:"rgba(40,40,40,0.2)"},NS={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"},BS='<div class="bjs-powered-by-lightbox"><div class="backdrop"></div><div class="notice"><a href="https://bpmn.io" target="_blank" rel="noopener" class="link">'+vm+'</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>',fi;function $S(){fi=ft(BS),dn(fi,LS),dn(ot("svg",fi),bm),dn(ot(".backdrop",fi),IS),dn(ot(".notice",fi),NS),dn(ot(".link",fi),_m,{margin:"15px 20px 15px 10px",alignSelf:"center"})}function jS(){fi||($S(),Cn.bind(fi,".backdrop","click",function(e){document.body.removeChild(fi)})),document.body.appendChild(fi)}const Ds=5,xm="djs-outline-hidden";function vt(e){e=H({},HS,e),this._moddle=this._createModdle(e),this._container=this._createContainer(e),this._init(this._container,this._moddle,e),GS(this._container)}de(vt,nr),vt.prototype.importXML=async function(t,n){const i=this;function r(a){return i.get("eventBus").createEvent(a)}let o=[];try{t=this._emit("import.parse.start",{xml:t})||t;let a;try{a=await this._moddle.fromXML(t,"bpmn:Definitions")}catch(f){throw this._emit("import.parse.complete",{error:f}),f}let s=a.rootElement;const c=a.references,u=a.warnings,l=a.elementsById;o=o.concat(u),s=this._emit("import.parse.complete",r({error:null,definitions:s,elementsById:l,references:c,warnings:o}))||s;const p=await this.importDefinitions(s,n);return o=o.concat(p.warnings),this._emit("import.done",{error:null,warnings:o}),{warnings:o}}catch(a){let s=a;throw o=o.concat(s.warnings||[]),Ls(s,o),s=FS(s),this._emit("import.done",{error:s,warnings:s.warnings}),s}},vt.prototype.importDefinitions=async function(t,n){return this._setDefinitions(t),{warnings:(await this.open(n)).warnings}},vt.prototype.open=async function(t){const n=this._definitions;let i=t;if(!n){const o=new Error("no XML imported");throw Ls(o,[]),o}if(typeof t=="string"&&(i=zS(n,t),!i)){const o=new Error("BPMNDiagram <"+t+"> not found");throw Ls(o,[]),o}try{this.clear()}catch(o){throw Ls(o,[]),o}const{warnings:r}=await MS(this,n,i);return{warnings:r}},vt.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},vt.prototype.saveSVG=async function(){this._emit("saveSVG.start");let t,n;try{const i=this.get("canvas"),r=i.getActiveLayer(),o=ot(":scope > defs",i._svg),a=jh(r),s=o?"<defs>"+jh(o)+"</defs>":"",c=i.getContainer();gt(c).add(xm);let u;try{u=r.getBBox()}finally{gt(c).remove(xm)}const l=u.x-Ds,p=u.y-Ds,f=u.width+Ds*2,d=u.height+Ds*2;t=`<?xml version="1.0" encoding="utf-8"?>
8
8
  <!-- created with bpmn-js / http://bpmn.io -->
9
9
  <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
10
- <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="`+f+'" height="'+d+'" viewBox="'+l+" "+p+" "+f+" "+d+'" version="1.1">'+s+a+"</svg>"}catch(i){n=i}if(this._emit("saveSVG.done",{error:n,svg:t}),n)throw n;return{svg:t}},vt.prototype._setDefinitions=function(e){this._definitions=e},vt.prototype.getModules=function(){return this._modules},vt.prototype.clear=function(){this.getDefinitions()&&rr.prototype.clear.call(this)},vt.prototype.destroy=function(){rr.prototype.destroy.call(this),pi(this._container)},vt.prototype.on=function(e,t,n,i){return this.get("eventBus").on(e,t,n,i)},vt.prototype.off=function(e,t){this.get("eventBus").off(e,t)},vt.prototype.attachTo=function(e){if(!e)throw new Error("parentNode required");this.detach(),e.get&&e.constructor.prototype.jquery&&(e=e.get(0)),typeof e=="string"&&(e=at(e)),e.appendChild(this._container),this._emit("attach",{}),this.get("canvas").resized()},vt.prototype.getDefinitions=function(){return this._definitions},vt.prototype.detach=function(){const e=this._container,t=e.parentNode;t&&(this._emit("detach",{}),t.removeChild(e))},vt.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(ai(n,["additionalModules"]),{canvas:j({},n.canvas,{container:e}),modules:a});rr.call(this,s),n&&n.container&&this.attachTo(n.container)},vt.prototype._emit=function(e,t){return this.get("eventBus").fire(e,t)},vt.prototype._createContainer=function(e){const t=dt('<div class="bjs-container"></div>');return mn(t,{width:_m(e.width),height:_m(e.height),position:e.position}),t},vt.prototype._createModdle=function(e){const t=j({},this._moddleExtensions,e.moddleExtensions);return new Ed(t)},vt.prototype._modules=[];function Ls(e,t){return e.warnings=t,e}function FS(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 HS={width:"100%",height:"100%",position:"relative"};function _m(e){return e+(De(e)?"px":"")}function zS(e,t){return t&&ft(e.diagrams,function(n){return n.id===t})||null}function GS(e){const n='<a href="http://bpmn.io" target="_blank" class="bjs-powered-by" title="Powered by bpmn.io" >'+gm+"</a>",i=dt(n);mn(at("svg",i),ym),mn(i,vm,{position:"absolute",bottom:"15px",right:"15px",zIndex:"100"}),e.appendChild(i),Le.bind(i,"click",function(r){jS(),r.preventDefault()})}function ho(e){vt.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)}he(ho,vt),ho.prototype._createModdle=function(e){var t=vt.prototype._createModdle.call(this,e);return t.ids=new li([32,36,1]),t},ho.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 qe(e,t){return _(e,"bpmn:CallActivity")?!1:_(e,"bpmn:SubProcess")?(t=t||Ke(e),t&&_(t,"bpmndi:BPMNPlane")?!0:t&&!!t.isExpanded):_(e,"bpmn:Participant")?!!te(e).processRef:!0}function Zt(e){if(!(!_(e,"bpmn:Participant")&&!_(e,"bpmn:Lane"))){var t=Ke(e).isHorizontal;return t===void 0?!0:t}}function VS(e){return e&&te(e).isInterrupting!==!1}function fn(e){return e&&!!te(e).triggeredByEvent}function mo(e,t){var n=te(e).eventDefinitions;return Yi(n,function(i){return _(i,t)})}function WS(e){return mo(e,"bpmn:ErrorEventDefinition")}function US(e){return mo(e,"bpmn:EscalationEventDefinition")}function qS(e){return mo(e,"bpmn:CompensateEventDefinition")}var Br={width:90,height:20},xm=15;function or(e){return _(e,"bpmn:Event")||_(e,"bpmn:Gateway")||_(e,"bpmn:DataStoreReference")||_(e,"bpmn:DataObjectReference")||_(e,"bpmn:DataInput")||_(e,"bpmn:DataOutput")||_(e,"bpmn:SequenceFlow")||_(e,"bpmn:MessageFlow")||_(e,"bpmn:Group")}function Is(e){return je(e.label)}function YS(e){var t=e.length/2-1,n=e[Math.floor(t)],i=e[Math.ceil(t+.01)],r=KS(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-=xm:a+=xm,{x:a,y:s}}function KS(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 xl(e){return e.waypoints?YS(e.waypoints):_(e,"bpmn:Group")?{x:e.x+e.width/2,y:e.y+Br.height/2}:{x:e.x+e.width/2,y:e.y+e.height+Br.height/2}}function XS(e,t){var n,i,r,o=e.label;return o&&o.bounds?(r=o.bounds,i={width:Math.max(Br.width,r.width),height:r.height},n={x:r.x+r.width/2,y:r.y+r.height/2}):(n=xl(t),i=Br),j({x:n.x-i.width/2,y:n.y-i.height/2},i)}function wm(e){if(_(e,"bpmn:FlowElement")||_(e,"bpmn:Participant")||_(e,"bpmn:Lane")||_(e,"bpmn:SequenceFlow")||_(e,"bpmn:MessageFlow")||_(e,"bpmn:DataInput")||_(e,"bpmn:DataOutput"))return"name";if(_(e,"bpmn:TextAnnotation"))return"text";if(_(e,"bpmn:Group"))return"categoryValueRef"}function ZS(e){var t=e.categoryValueRef;return t&&t.value||""}function Bn(e){var t=e.businessObject,n=wm(t);if(n)return n==="categoryValueRef"?ZS(t):t[n]||""}function QS(e,t){var n=e.businessObject,i=wm(n);if(i)if(i==="categoryValueRef"){if(!n[i])return e;n[i].value=t}else n[i]=t;return e}function JS(e){return je(e)&&or(e.labelTarget)}var go=7;function Em(e){let t=[];return L(e.incoming,n=>{_(n,"bpmn:Association")&&_(n.source,"bpmn:TextAnnotation")&&t.push({annotation:n.source,association:n})}),L(e.outgoing,n=>{_(n,"bpmn:Association")&&_(n.target,"bpmn:TextAnnotation")&&t.push({annotation:n.target,association:n})}),t}function ra(e){const t=new Map;return L(hl(e),n=>{L(Em(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 wl="hsl(225, 10%, 15%)",eR="white";function mi(e,t){return Yi(e.eventDefinitions,function(n){return n.$type===t})}function tR(e){return e.$type==="bpmn:IntermediateThrowEvent"||e.$type==="bpmn:EndEvent"}function nR(e){var t=e.dataObjectRef;return e.isCollection||t&&t.isCollection}function We(e,t,n){var i=Ke(e);return n||i.get("color:background-color")||i.get("bioc:fill")||t||eR}function de(e,t,n){var i=Ke(e);return n||i.get("color:border-color")||i.get("bioc:stroke")||t||wl}function oa(e,t,n,i){var r=Ke(e),o=r.get("label");return i||o&&o.get("color:color")||t||de(e,n)}function Sm(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 El(e,t){var n=e.x,i=e.y,r=e.width,o=e.height,a=[["M",n+t,i],["l",r-t*2,0],["a",t,t,0,0,1,t,t],["l",0,o-t*2],["a",t,t,0,0,1,-t,t],["l",t*2-r,0],["a",t,t,0,0,1,-t,-t],["l",0,t*2-o],["a",t,t,0,0,1,t,-t],["z"]];return Dr(a)}function iR(e){var t=e.width,n=e.height,i=e.x,r=e.y,o=t/2,a=n/2,s=[["M",i+o,r],["l",o,a],["l",-o,a],["l",-o,-a],["z"]];return Dr(s)}function rR(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 aa(e,t={}){return{width:Hn(e,t),height:Pn(e,t)}}function Hn(e,t={}){return wn(t,"width")?t.width:e.width}function Pn(e,t={}){return wn(t,"height")?t.height:e.height}var oR=new li,aR=10,Bs=3,sR=1.5,Ns=10,cR=4,yo=.95,uR=1,lR=.25;function Nr(e,t,n,i,r,o,a){ki.call(this,t,a);var s=e&&e.defaultFillColor,c=e&&e.defaultStrokeColor,u=e&&e.defaultLabelColor;function l(M){return n.computeStyle(M,{strokeLinecap:"round",strokeLinejoin:"round",stroke:wl,strokeWidth:2,fill:"white"})}function p(M){return n.computeStyle(M,["no-fill"],{strokeLinecap:"round",strokeLinejoin:"round",stroke:wl,strokeWidth:2})}function f(M,w){var{ref:v={x:0,y:0},scale:N=1,element:V,parentGfx:K=r._svg}=w,ye=Se("marker",{id:M,viewBox:"0 0 20 20",refX:v.x,refY:v.y,markerWidth:20*N,markerHeight:20*N,orient:"auto"});Ie(ye,V);var Ne=at(":scope > defs",K);Ne||(Ne=Se("defs"),Ie(K,Ne)),Ie(Ne,ye)}function d(M,w,v,N){var V=oR.nextPrefixed("marker-");return g(M,V,w,v,N),"url(#"+V+")"}function g(M,w,v,N,V){if(v==="sequenceflow-end"){var K=Se("path",{d:"M 1 5 L 11 10 L 1 15 Z",...l({fill:V,stroke:V,strokeWidth:1})});f(w,{element:K,ref:{x:11,y:10},scale:.5,parentGfx:M})}if(v==="messageflow-start"){var ye=Se("circle",{cx:6,cy:6,r:3.5,...l({fill:N,stroke:V,strokeWidth:1,strokeDasharray:[1e4,1]})});f(w,{element:ye,ref:{x:6,y:6},parentGfx:M})}if(v==="messageflow-end"){var Ne=Se("path",{d:"m 1 5 l 0 -3 l 7 3 l -7 3 z",...l({fill:N,stroke:V,strokeWidth:1,strokeDasharray:[1e4,1]})});f(w,{element:Ne,ref:{x:8.5,y:5},parentGfx:M})}if(v==="association-start"){var Ze=Se("path",{d:"M 11 5 L 1 10 L 11 15",...p({fill:"none",stroke:V,strokeWidth:1.5,strokeDasharray:[1e4,1]})});f(w,{element:Ze,ref:{x:1,y:10},scale:.5,parentGfx:M})}if(v==="association-end"){var Pt=Se("path",{d:"M 1 5 L 11 10 L 1 15",...p({fill:"none",stroke:V,strokeWidth:1.5,strokeDasharray:[1e4,1]})});f(w,{element:Pt,ref:{x:11,y:10},scale:.5,parentGfx:M})}if(v==="conditional-flow-marker"){var rt=Se("path",{d:"M 0 10 L 8 6 L 16 10 L 8 14 Z",...l({fill:N,stroke:V})});f(w,{element:rt,ref:{x:-1,y:10},scale:.5,parentGfx:M})}if(v==="conditional-default-flow-marker"){var $t=Se("path",{d:"M 6 4 L 10 16",...l({stroke:V,fill:"none"})});f(w,{element:$t,ref:{x:0,y:10},scale:.5,parentGfx:M})}}function h(M,w,v,N,V={}){Yt(N)&&(V=N,N=0),N=N||0,V=l(V);var K=w/2,ye=v/2,Ne=Se("circle",{cx:K,cy:ye,r:Math.round((w+v)/4-N),...V});return Ie(M,Ne),Ne}function m(M,w,v,N,V,K){Yt(V)&&(K=V,V=0),V=V||0,K=l(K);var ye=Se("rect",{x:V,y:V,width:w-V*2,height:v-V*2,rx:N,ry:N,...K});return Ie(M,ye),ye}function S(M,w,v,N){var V=w/2,K=v/2,ye=[{x:V,y:0},{x:w,y:K},{x:V,y:v},{x:0,y:K}],Ne=ye.map(function(Pt){return Pt.x+","+Pt.y}).join(" ");N=l(N);var Ze=Se("polygon",{...N,points:Ne});return Ie(M,Ze),Ze}function y(M,w,v,N){v=p(v);var V=Zo(w,v,N);return Ie(M,V),V}function x(M,w,v){return y(M,w,v,5)}function E(M,w,v){v=p(v);var N=Se("path",{...v,d:w});return Ie(M,N),N}function P(M,w,v,N){return E(w,v,j({"data-marker":M},N))}function C(M){return wt[M]}function D(M){return function(w,v,N){return C(M)(w,v,N)}}var A={"bpmn:MessageEventDefinition":function(M,w,v={},N){var V=i.getScaledPath("EVENT_MESSAGE",{xScaleFactor:.9,yScaleFactor:.9,containerWidth:v.width||w.width,containerHeight:v.height||w.height,position:{mx:.235,my:.315}}),K=N?de(w,c,v.stroke):We(w,s,v.fill),ye=N?We(w,s,v.fill):de(w,c,v.stroke),Ne=E(M,V,{fill:K,stroke:ye,strokeWidth:1});return Ne},"bpmn:TimerEventDefinition":function(M,w,v={}){var N=v.width||w.width,V=v.height||w.height,K=v.width?1:2,ye=h(M,N,V,.2*V,{fill:We(w,s,v.fill),stroke:de(w,c,v.stroke),strokeWidth:K}),Ne=i.getScaledPath("EVENT_TIMER_WH",{xScaleFactor:.75,yScaleFactor:.75,containerWidth:N,containerHeight:V,position:{mx:.5,my:.5}});E(M,Ne,{stroke:de(w,c,v.stroke),strokeWidth:K});for(var Ze=0;Ze<12;Ze++){var Pt=i.getScaledPath("EVENT_TIMER_LINE",{xScaleFactor:.75,yScaleFactor:.75,containerWidth:N,containerHeight:V,position:{mx:.5,my:.5}}),rt=N/2,$t=V/2;E(M,Pt,{strokeWidth:1,stroke:de(w,c,v.stroke),transform:"rotate("+Ze*30+","+$t+","+rt+")"})}return ye},"bpmn:EscalationEventDefinition":function(M,w,v={},N){var V=i.getScaledPath("EVENT_ESCALATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:v.width||w.width,containerHeight:v.height||w.height,position:{mx:.5,my:.2}}),K=N?de(w,c,v.stroke):We(w,s,v.fill);return E(M,V,{fill:K,stroke:de(w,c,v.stroke),strokeWidth:1})},"bpmn:ConditionalEventDefinition":function(M,w,v={}){var N=i.getScaledPath("EVENT_CONDITIONAL",{xScaleFactor:1,yScaleFactor:1,containerWidth:v.width||w.width,containerHeight:v.height||w.height,position:{mx:.5,my:.222}});return E(M,N,{fill:We(w,s,v.fill),stroke:de(w,c,v.stroke),strokeWidth:1})},"bpmn:LinkEventDefinition":function(M,w,v={},N){var V=i.getScaledPath("EVENT_LINK",{xScaleFactor:1,yScaleFactor:1,containerWidth:w.width,containerHeight:w.height,position:{mx:.57,my:.263}}),K=N?de(w,c,v.stroke):We(w,s,v.fill);return E(M,V,{fill:K,stroke:de(w,c,v.stroke),strokeWidth:1})},"bpmn:ErrorEventDefinition":function(M,w,v={},N){var V=i.getScaledPath("EVENT_ERROR",{xScaleFactor:1.1,yScaleFactor:1.1,containerWidth:v.width||w.width,containerHeight:v.height||w.height,position:{mx:.2,my:.722}}),K=N?de(w,c,v.stroke):We(w,s,v.fill);return E(M,V,{fill:K,stroke:de(w,c,v.stroke),strokeWidth:1})},"bpmn:CancelEventDefinition":function(M,w,v={},N){var V=i.getScaledPath("EVENT_CANCEL_45",{xScaleFactor:1,yScaleFactor:1,containerWidth:w.width,containerHeight:w.height,position:{mx:.638,my:-.055}}),K=N?de(w,c,v.stroke):"none",ye=E(M,V,{fill:K,stroke:de(w,c,v.stroke),strokeWidth:1});return hm(ye,45),ye},"bpmn:CompensateEventDefinition":function(M,w,v={},N){var V=i.getScaledPath("EVENT_COMPENSATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:v.width||w.width,containerHeight:v.height||w.height,position:{mx:.22,my:.5}}),K=N?de(w,c,v.stroke):We(w,s,v.fill);return E(M,V,{fill:K,stroke:de(w,c,v.stroke),strokeWidth:1})},"bpmn:SignalEventDefinition":function(M,w,v={},N){var V=i.getScaledPath("EVENT_SIGNAL",{xScaleFactor:.9,yScaleFactor:.9,containerWidth:v.width||w.width,containerHeight:v.height||w.height,position:{mx:.5,my:.2}}),K=N?de(w,c,v.stroke):We(w,s,v.fill);return E(M,V,{strokeWidth:1,fill:K,stroke:de(w,c,v.stroke)})},"bpmn:MultipleEventDefinition":function(M,w,v={},N){var V=i.getScaledPath("EVENT_MULTIPLE",{xScaleFactor:1.1,yScaleFactor:1.1,containerWidth:v.width||w.width,containerHeight:v.height||w.height,position:{mx:.211,my:.36}}),K=N?de(w,c,v.stroke):We(w,s,v.fill);return E(M,V,{fill:K,stroke:de(w,c,v.stroke),strokeWidth:1})},"bpmn:ParallelMultipleEventDefinition":function(M,w,v={}){var N=i.getScaledPath("EVENT_PARALLEL_MULTIPLE",{xScaleFactor:1.2,yScaleFactor:1.2,containerWidth:v.width||w.width,containerHeight:v.height||w.height,position:{mx:.458,my:.194}});return E(M,N,{fill:We(w,s,v.fill),stroke:de(w,c,v.stroke),strokeWidth:1})},"bpmn:TerminateEventDefinition":function(M,w,v={}){var N=h(M,w.width,w.height,8,{fill:de(w,c,v.stroke),stroke:de(w,c,v.stroke),strokeWidth:4});return N}};function I(M,w,v={},N){var V=te(M),K=tR(V),ye=N||M;return V.get("eventDefinitions")&&V.get("eventDefinitions").length>1?V.get("parallelMultiple")?A["bpmn:ParallelMultipleEventDefinition"](w,ye,v,K):A["bpmn:MultipleEventDefinition"](w,ye,v,K):mi(V,"bpmn:MessageEventDefinition")?A["bpmn:MessageEventDefinition"](w,ye,v,K):mi(V,"bpmn:TimerEventDefinition")?A["bpmn:TimerEventDefinition"](w,ye,v,K):mi(V,"bpmn:ConditionalEventDefinition")?A["bpmn:ConditionalEventDefinition"](w,ye,v,K):mi(V,"bpmn:SignalEventDefinition")?A["bpmn:SignalEventDefinition"](w,ye,v,K):mi(V,"bpmn:EscalationEventDefinition")?A["bpmn:EscalationEventDefinition"](w,ye,v,K):mi(V,"bpmn:LinkEventDefinition")?A["bpmn:LinkEventDefinition"](w,ye,v,K):mi(V,"bpmn:ErrorEventDefinition")?A["bpmn:ErrorEventDefinition"](w,ye,v,K):mi(V,"bpmn:CancelEventDefinition")?A["bpmn:CancelEventDefinition"](w,ye,v,K):mi(V,"bpmn:CompensateEventDefinition")?A["bpmn:CompensateEventDefinition"](w,ye,v,K):mi(V,"bpmn:TerminateEventDefinition")?A["bpmn:TerminateEventDefinition"](w,ye,v,K):null}var k={ParticipantMultiplicityMarker:function(M,w,v={}){var N=Hn(w,v),V=Pn(w,v),K=i.getScaledPath("MARKER_PARALLEL",{xScaleFactor:1,yScaleFactor:1,containerWidth:N,containerHeight:V,position:{mx:(N/2-6)/N,my:(V-15)/V}});P("participant-multiplicity",M,K,{strokeWidth:2,fill:We(w,s,v.fill),stroke:de(w,c,v.stroke)})},SubProcessMarker:function(M,w,v={}){var N=m(M,14,14,0,{strokeWidth:1,fill:We(w,s,v.fill),stroke:de(w,c,v.stroke)});rn(N,w.width/2-7.5,w.height-20);var V=i.getScaledPath("MARKER_SUB_PROCESS",{xScaleFactor:1.5,yScaleFactor:1.5,containerWidth:w.width,containerHeight:w.height,position:{mx:(w.width/2-7.5)/w.width,my:(w.height-20)/w.height}});P("sub-process",M,V,{fill:We(w,s,v.fill),stroke:de(w,c,v.stroke)})},ParallelMarker:function(M,w,v){var N=Hn(w,v),V=Pn(w,v),K=i.getScaledPath("MARKER_PARALLEL",{xScaleFactor:1,yScaleFactor:1,containerWidth:N,containerHeight:V,position:{mx:(N/2+v.parallel)/N,my:(V-20)/V}});P("parallel",M,K,{fill:We(w,s,v.fill),stroke:de(w,c,v.stroke)})},SequentialMarker:function(M,w,v){var N=i.getScaledPath("MARKER_SEQUENTIAL",{xScaleFactor:1,yScaleFactor:1,containerWidth:w.width,containerHeight:w.height,position:{mx:(w.width/2+v.seq)/w.width,my:(w.height-19)/w.height}});P("sequential",M,N,{fill:We(w,s,v.fill),stroke:de(w,c,v.stroke)})},CompensationMarker:function(M,w,v){var N=i.getScaledPath("MARKER_COMPENSATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:w.width,containerHeight:w.height,position:{mx:(w.width/2+v.compensation)/w.width,my:(w.height-13)/w.height}});P("compensation",M,N,{strokeWidth:1,fill:We(w,s,v.fill),stroke:de(w,c,v.stroke)})},LoopMarker:function(M,w,v){var N=Hn(w,v),V=Pn(w,v),K=i.getScaledPath("MARKER_LOOP",{xScaleFactor:1,yScaleFactor:1,containerWidth:N,containerHeight:V,position:{mx:(N/2+v.loop)/N,my:(V-7)/V}});P("loop",M,K,{strokeWidth:1.5,fill:"none",stroke:de(w,c,v.stroke),strokeMiterlimit:.5})},AdhocMarker:function(M,w,v){var N=Hn(w,v),V=Pn(w,v),K=i.getScaledPath("MARKER_ADHOC",{xScaleFactor:1,yScaleFactor:1,containerWidth:N,containerHeight:V,position:{mx:(N/2+v.adhoc)/N,my:(V-15)/V}});P("adhoc",M,K,{strokeWidth:1,fill:de(w,c,v.stroke),stroke:de(w,c,v.stroke)})}};function O(M,w,v,N){k[M](w,v,N)}function $(M,w,v=[],N={}){N={fill:N.fill,stroke:N.stroke,width:Hn(w,N),height:Pn(w,N)};var V=te(w),K=v.includes("SubProcessMarker");K?N={...N,seq:-21,parallel:-22,compensation:-25,loop:-18,adhoc:10}:N={...N,seq:-5,parallel:-6,compensation:-7,loop:0,adhoc:-8},V.get("isForCompensation")&&v.push("CompensationMarker"),_(V,"bpmn:AdHocSubProcess")&&(v.push("AdhocMarker"),K||j(N,{compensation:N.compensation-18}));var ye=V.get("loopCharacteristics"),Ne=ye&&ye.get("isSequential");ye&&(j(N,{compensation:N.compensation-18}),v.includes("AdhocMarker")&&j(N,{seq:-23,loop:-18,parallel:-24}),Ne===void 0&&v.push("LoopMarker"),Ne===!1&&v.push("ParallelMarker"),Ne===!0&&v.push("SequentialMarker")),v.includes("CompensationMarker")&&v.length===1&&j(N,{compensation:-8}),L(v,function(Ze){O(Ze,M,w,N)})}function oe(M,w,v={}){v=j({size:{width:100}},v);var N=o.createText(w||"",v);return Ye(N).add("djs-label"),Ie(M,N),N}function ve(M,w,v,N={}){var V=te(w),K=aa({x:w.x,y:w.y,width:w.width,height:w.height},N);return oe(M,V.name,{align:v,box:K,padding:7,style:{fill:oa(w,u,c,N.stroke)}})}function Ue(M,w,v={}){var N={width:w.width,height:w.height,x:w.width/2+w.x,y:w.height/2+w.y};return oe(M,Bn(w),{box:N,style:j({},o.getExternalStyle(),{fill:oa(w,u,c,v.stroke)})})}function Y(M,w,v,N={}){var V=Zt(v),K=oe(M,w,{box:{height:30,width:V?Pn(v,N):Hn(v,N)},align:"center-middle",style:{fill:oa(v,u,c,N.stroke)}});if(V){var ye=-1*Pn(v,N);Os(K,0,-ye,270)}}function pe(M,w,v={}){var{width:N,height:V}=aa(w,v);return m(M,N,V,Ns,{...v,fill:We(w,s,v.fill),fillOpacity:yo,stroke:de(w,c,v.stroke)})}function ge(M,w,v={}){var N=te(w),V=We(w,s,v.fill),K=de(w,c,v.stroke);return(N.get("associationDirection")==="One"||N.get("associationDirection")==="Both")&&(v.markerEnd=d(M,"association-end",V,K)),N.get("associationDirection")==="Both"&&(v.markerStart=d(M,"association-start",V,K)),v=Xe(v,["markerStart","markerEnd"]),x(M,w.waypoints,{...v,stroke:K,strokeDasharray:"0, 5"})}function le(M,w,v={}){var N=We(w,s,v.fill),V=de(w,c,v.stroke),K=i.getScaledPath("DATA_OBJECT_PATH",{xScaleFactor:1,yScaleFactor:1,containerWidth:w.width,containerHeight:w.height,position:{mx:.474,my:.296}}),ye=E(M,K,{fill:N,fillOpacity:yo,stroke:V}),Ne=te(w);if(nR(Ne)){var Ze=i.getScaledPath("DATA_OBJECT_COLLECTION_PATH",{xScaleFactor:1,yScaleFactor:1,containerWidth:w.width,containerHeight:w.height,position:{mx:.33,my:(w.height-18)/w.height}});E(M,Ze,{strokeWidth:2,fill:N,stroke:V})}return ye}function Ee(M,w,v={}){return h(M,w.width,w.height,{fillOpacity:yo,...v,fill:We(w,s,v.fill),stroke:de(w,c,v.stroke)})}function re(M,w,v={}){return S(M,w.width,w.height,{fill:We(w,s,v.fill),fillOpacity:yo,stroke:de(w,c,v.stroke)})}function q(M,w,v={}){var N=m(M,Hn(w,v),Pn(w,v),0,{fill:We(w,s,v.fill),fillOpacity:v.fillOpacity||yo,stroke:de(w,c,v.stroke),strokeWidth:1.5}),V=te(w);if(_(V,"bpmn:Lane")){var K=V.get("name");Y(M,K,w,v)}return N}function U(M,w,v={}){var N=pe(M,w,v),V=qe(w);if(fn(w)&&(me(N,{strokeDasharray:"0, 5.5",strokeWidth:2.5}),!V)){var K=te(w).flowElements||[],ye=K.filter(Ne=>_(Ne,"bpmn:StartEvent"));ye.length===1&&Z(ye[0],M,v,w)}return ve(M,w,V?"center-top":"center-middle",v),V?$(M,w,void 0,v):$(M,w,["SubProcessMarker"],v),N}function Z(M,w,v,N){var V=22,K={fill:We(N,s,v.fill),stroke:de(N,c,v.stroke),width:V,height:V},ye=te(M).isInterrupting,Ne=ye?0:3,Ze=ye?1:1.2,Pt=20,rt=(V-Pt)/2,$t="translate("+rt+","+rt+")";h(w,Pt,Pt,{fill:K.fill,stroke:K.stroke,strokeWidth:Ze,strokeDasharray:Ne,transform:$t}),I(M,w,K,N)}function Fe(M,w,v={}){var N=pe(M,w,v);return ve(M,w,"center-middle",v),$(M,w,void 0,v),N}var wt=this.handlers={"bpmn:AdHocSubProcess":function(M,w,v={}){return qe(w)?v=Xe(v,["fill","stroke","width","height"]):v=Xe(v,["fill","stroke"]),U(M,w,v)},"bpmn:Association":function(M,w,v={}){return v=Xe(v,["fill","stroke"]),ge(M,w,v)},"bpmn:BoundaryEvent":function(M,w,v={}){var{renderIcon:N=!0}=v;v=Xe(v,["fill","stroke"]);var V=te(w),K=V.get("cancelActivity");v={strokeWidth:1.5,fill:We(w,s,v.fill),fillOpacity:uR,stroke:de(w,c,v.stroke)},K||(v.strokeDasharray="6");var ye=Ee(M,w,v);return h(M,w.width,w.height,Bs,{...v,fill:"none"}),N&&I(w,M,v),ye},"bpmn:BusinessRuleTask":function(M,w,v={}){v=Xe(v,["fill","stroke"]);var N=Fe(M,w,v),V=i.getScaledPath("TASK_TYPE_BUSINESS_RULE_MAIN",{abspos:{x:8,y:8}}),K=E(M,V);me(K,{fill:We(w,s,v.fill),stroke:de(w,c,v.stroke),strokeWidth:1});var ye=i.getScaledPath("TASK_TYPE_BUSINESS_RULE_HEADER",{abspos:{x:8,y:8}}),Ne=E(M,ye);return me(Ne,{fill:de(w,c,v.stroke),stroke:de(w,c,v.stroke),strokeWidth:1}),N},"bpmn:CallActivity":function(M,w,v={}){return v=Xe(v,["fill","stroke"]),U(M,w,{strokeWidth:5,...v})},"bpmn:ComplexGateway":function(M,w,v={}){v=Xe(v,["fill","stroke"]);var N=re(M,w,v),V=i.getScaledPath("GATEWAY_COMPLEX",{xScaleFactor:.5,yScaleFactor:.5,containerWidth:w.width,containerHeight:w.height,position:{mx:.46,my:.26}});return E(M,V,{fill:de(w,c,v.stroke),stroke:de(w,c,v.stroke),strokeWidth:1}),N},"bpmn:DataInput":function(M,w,v={}){v=Xe(v,["fill","stroke"]);var N=i.getRawPath("DATA_ARROW"),V=le(M,w,v);return E(M,N,{fill:"none",stroke:de(w,c,v.stroke),strokeWidth:1}),V},"bpmn:DataInputAssociation":function(M,w,v={}){return v=Xe(v,["fill","stroke"]),ge(M,w,{...v,markerEnd:d(M,"association-end",We(w,s,v.fill),de(w,c,v.stroke))})},"bpmn:DataObject":function(M,w,v={}){return v=Xe(v,["fill","stroke"]),le(M,w,v)},"bpmn:DataObjectReference":D("bpmn:DataObject"),"bpmn:DataOutput":function(M,w,v={}){v=Xe(v,["fill","stroke"]);var N=i.getRawPath("DATA_ARROW"),V=le(M,w,v);return E(M,N,{strokeWidth:1,fill:de(w,c,v.stroke),stroke:de(w,c,v.stroke)}),V},"bpmn:DataOutputAssociation":function(M,w,v={}){return v=Xe(v,["fill","stroke"]),ge(M,w,{...v,markerEnd:d(M,"association-end",We(w,s,v.fill),de(w,c,v.stroke))})},"bpmn:DataStoreReference":function(M,w,v={}){v=Xe(v,["fill","stroke"]);var N=i.getScaledPath("DATA_STORE",{xScaleFactor:1,yScaleFactor:1,containerWidth:w.width,containerHeight:w.height,position:{mx:0,my:.133}});return E(M,N,{fill:We(w,s,v.fill),fillOpacity:yo,stroke:de(w,c,v.stroke),strokeWidth:2})},"bpmn:EndEvent":function(M,w,v={}){var{renderIcon:N=!0}=v;v=Xe(v,["fill","stroke"]);var V=Ee(M,w,{...v,strokeWidth:4});return N&&I(w,M,v),V},"bpmn:EventBasedGateway":function(M,w,v={}){v=Xe(v,["fill","stroke"]);var N=te(w),V=re(M,w,v);h(M,w.width,w.height,w.height*.2,{fill:We(w,"none",v.fill),stroke:de(w,c,v.stroke),strokeWidth:1});var K=N.get("eventGatewayType"),ye=!!N.get("instantiate");function Ne(){var Pt=i.getScaledPath("GATEWAY_EVENT_BASED",{xScaleFactor:.18,yScaleFactor:.18,containerWidth:w.width,containerHeight:w.height,position:{mx:.36,my:.44}});E(M,Pt,{fill:"none",stroke:de(w,c,v.stroke),strokeWidth:2})}if(K==="Parallel"){var Ze=i.getScaledPath("GATEWAY_PARALLEL",{xScaleFactor:.4,yScaleFactor:.4,containerWidth:w.width,containerHeight:w.height,position:{mx:.474,my:.296}});E(M,Ze,{fill:"none",stroke:de(w,c,v.stroke),strokeWidth:1})}else K==="Exclusive"&&(ye||h(M,w.width,w.height,w.height*.26,{fill:"none",stroke:de(w,c,v.stroke),strokeWidth:1}),Ne());return V},"bpmn:ExclusiveGateway":function(M,w,v={}){v=Xe(v,["fill","stroke"]);var N=re(M,w,v),V=i.getScaledPath("GATEWAY_EXCLUSIVE",{xScaleFactor:.4,yScaleFactor:.4,containerWidth:w.width,containerHeight:w.height,position:{mx:.32,my:.3}}),K=Ke(w);return K.get("isMarkerVisible")&&E(M,V,{fill:de(w,c,v.stroke),stroke:de(w,c,v.stroke),strokeWidth:1}),N},"bpmn:Gateway":function(M,w,v={}){return v=Xe(v,["fill","stroke"]),re(M,w,v)},"bpmn:Group":function(M,w,v={}){return v=Xe(v,["fill","stroke","width","height"]),m(M,w.width,w.height,Ns,{stroke:de(w,c,v.stroke),strokeWidth:1.5,strokeDasharray:"10, 6, 0, 6",fill:"none",pointerEvents:"none",width:Hn(w,v),height:Pn(w,v)})},"bpmn:InclusiveGateway":function(M,w,v={}){v=Xe(v,["fill","stroke"]);var N=re(M,w,v);return h(M,w.width,w.height,w.height*.24,{fill:We(w,s,v.fill),stroke:de(w,c,v.stroke),strokeWidth:2.5}),N},"bpmn:IntermediateEvent":function(M,w,v={}){var{renderIcon:N=!0}=v;v=Xe(v,["fill","stroke"]);var V=Ee(M,w,{...v,strokeWidth:1.5});return h(M,w.width,w.height,Bs,{fill:"none",stroke:de(w,c,v.stroke),strokeWidth:1.5}),N&&I(w,M,v),V},"bpmn:IntermediateCatchEvent":D("bpmn:IntermediateEvent"),"bpmn:IntermediateThrowEvent":D("bpmn:IntermediateEvent"),"bpmn:Lane":function(M,w,v={}){return v=Xe(v,["fill","stroke","width","height"]),q(M,w,{...v,fillOpacity:lR})},"bpmn:ManualTask":function(M,w,v={}){v=Xe(v,["fill","stroke"]);var N=Fe(M,w,v),V=i.getScaledPath("TASK_TYPE_MANUAL",{abspos:{x:17,y:15}});return E(M,V,{fill:We(w,s,v.fill),stroke:de(w,c,v.stroke),strokeWidth:.5}),N},"bpmn:MessageFlow":function(M,w,v={}){v=Xe(v,["fill","stroke"]);var N=te(w),V=Ke(w),K=We(w,s,v.fill),ye=de(w,c,v.stroke),Ne=x(M,w.waypoints,{markerEnd:d(M,"messageflow-end",K,ye),markerStart:d(M,"messageflow-start",K,ye),stroke:ye,strokeDasharray:"10, 11",strokeWidth:1.5});if(N.get("messageRef")){var Ze=Ne.getPointAtLength(Ne.getTotalLength()/2),Pt=i.getScaledPath("MESSAGE_FLOW_MARKER",{abspos:{x:Ze.x,y:Ze.y}}),rt={strokeWidth:1};V.get("messageVisibleKind")==="initiating"?(rt.fill=K,rt.stroke=ye):(rt.fill=ye,rt.stroke=K);var $t=E(M,Pt,rt),At=N.get("messageRef"),yn=At.get("name"),st=oe(M,yn,{align:"center-top",fitBox:!0,style:{fill:ye}}),Rt=$t.getBBox(),Jt=st.getBBox(),Kr=Ze.x-Jt.width/2,Qn=Ze.y+Rt.height/2+aR;Os(st,Kr,Qn,0)}return Ne},"bpmn:ParallelGateway":function(M,w,v={}){v=Xe(v,["fill","stroke"]);var N=re(M,w,v),V=i.getScaledPath("GATEWAY_PARALLEL",{xScaleFactor:.6,yScaleFactor:.6,containerWidth:w.width,containerHeight:w.height,position:{mx:.46,my:.2}});return E(M,V,{fill:de(w,c,v.stroke),stroke:de(w,c,v.stroke),strokeWidth:1}),N},"bpmn:Participant":function(M,w,v={}){v=Xe(v,["fill","stroke","width","height"]);var N=q(M,w,v),V=qe(w),K=Zt(w),ye=te(w),Ne=ye.get("name");if(V){var Ze=K?[{x:30,y:0},{x:30,y:Pn(w,v)}]:[{x:0,y:30},{x:Hn(w,v),y:30}];y(M,Ze,{stroke:de(w,c,v.stroke),strokeWidth:sR}),Y(M,Ne,w,v)}else{var Pt=aa(w,v);K||(Pt.height=Hn(w,v),Pt.width=Pn(w,v));var rt=oe(M,Ne,{box:Pt,align:"center-middle",style:{fill:oa(w,u,c,v.stroke)}});if(!K){var $t=-1*Pn(w,v);Os(rt,0,-$t,270)}}return ye.get("participantMultiplicity")&&O("ParticipantMultiplicityMarker",M,w,v),N},"bpmn:ReceiveTask":function(M,w,v={}){v=Xe(v,["fill","stroke"]);var N=te(w),V=Fe(M,w,v),K;return N.get("instantiate")?(h(M,28,28,20*.22,{fill:We(w,s,v.fill),stroke:de(w,c,v.stroke),strokeWidth:1}),K=i.getScaledPath("TASK_TYPE_INSTANTIATING_SEND",{abspos:{x:7.77,y:9.52}})):K=i.getScaledPath("TASK_TYPE_SEND",{xScaleFactor:.9,yScaleFactor:.9,containerWidth:21,containerHeight:14,position:{mx:.3,my:.4}}),E(M,K,{fill:We(w,s,v.fill),stroke:de(w,c,v.stroke),strokeWidth:1}),V},"bpmn:ScriptTask":function(M,w,v={}){v=Xe(v,["fill","stroke"]);var N=Fe(M,w,v),V=i.getScaledPath("TASK_TYPE_SCRIPT",{abspos:{x:15,y:20}});return E(M,V,{fill:We(w,s,v.fill),stroke:de(w,c,v.stroke),strokeWidth:1}),N},"bpmn:SendTask":function(M,w,v={}){v=Xe(v,["fill","stroke"]);var N=Fe(M,w,v),V=i.getScaledPath("TASK_TYPE_SEND",{xScaleFactor:1,yScaleFactor:1,containerWidth:21,containerHeight:14,position:{mx:.285,my:.357}});return E(M,V,{fill:de(w,c,v.stroke),stroke:We(w,s,v.fill),strokeWidth:1}),N},"bpmn:SequenceFlow":function(M,w,v={}){v=Xe(v,["fill","stroke"]);var N=We(w,s,v.fill),V=de(w,c,v.stroke),K=x(M,w.waypoints,{markerEnd:d(M,"sequenceflow-end",N,V),stroke:V}),ye=te(w),{source:Ne}=w;if(Ne){var Ze=te(Ne);ye.get("conditionExpression")&&_(Ze,"bpmn:Activity")&&me(K,{markerStart:d(M,"conditional-flow-marker",N,V)}),Ze.get("default")&&(_(Ze,"bpmn:Gateway")||_(Ze,"bpmn:Activity"))&&Ze.get("default")===ye&&me(K,{markerStart:d(M,"conditional-default-flow-marker",N,V)})}return K},"bpmn:ServiceTask":function(M,w,v={}){v=Xe(v,["fill","stroke"]);var N=Fe(M,w,v);h(M,10,10,{fill:We(w,s,v.fill),stroke:"none",transform:"translate(6, 6)"});var V=i.getScaledPath("TASK_TYPE_SERVICE",{abspos:{x:12,y:18}});E(M,V,{fill:We(w,s,v.fill),stroke:de(w,c,v.stroke),strokeWidth:1}),h(M,10,10,{fill:We(w,s,v.fill),stroke:"none",transform:"translate(11, 10)"});var K=i.getScaledPath("TASK_TYPE_SERVICE",{abspos:{x:17,y:22}});return E(M,K,{fill:We(w,s,v.fill),stroke:de(w,c,v.stroke),strokeWidth:1}),N},"bpmn:StartEvent":function(M,w,v={}){var{renderIcon:N=!0}=v;v=Xe(v,["fill","stroke"]);var V=te(w);V.get("isInterrupting")||(v={...v,strokeDasharray:"6"});var K=Ee(M,w,v);return N&&I(w,M,v),K},"bpmn:SubProcess":function(M,w,v={}){return qe(w)?v=Xe(v,["fill","stroke","width","height"]):v=Xe(v,["fill","stroke"]),U(M,w,v)},"bpmn:Task":function(M,w,v={}){return v=Xe(v,["fill","stroke"]),Fe(M,w,v)},"bpmn:TextAnnotation":function(M,w,v={}){v=Xe(v,["fill","stroke"]);var{width:N,height:V}=aa(w,v),K=m(M,N,V,0,0,{fill:"none",stroke:"none"}),ye=i.getScaledPath("TEXT_ANNOTATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:N,containerHeight:V,position:{mx:0,my:0}});E(M,ye,{stroke:de(w,c,v.stroke)});var Ne=te(w),Ze=Ne.get("text")||"";return oe(M,Ze,{align:"left-top",box:aa(w,v),padding:go,style:{fill:oa(w,u,c,v.stroke)}}),K},"bpmn:Transaction":function(M,w,v={}){qe(w)?v=Xe(v,["fill","stroke","width","height"]):v=Xe(v,["fill","stroke"]);var N=U(M,w,{strokeWidth:1.5,...v}),V=n.style(["no-fill","no-events"],{stroke:de(w,c,v.stroke),strokeWidth:1.5}),K=qe(w);return K||(v={}),m(M,Hn(w,v),Pn(w,v),Ns-Bs,Bs,V),N},"bpmn:UserTask":function(M,w,v={}){v=Xe(v,["fill","stroke"]);var N=Fe(M,w,v),V=15,K=12,ye=i.getScaledPath("TASK_TYPE_USER_1",{abspos:{x:V,y:K}});E(M,ye,{fill:We(w,s,v.fill),stroke:de(w,c,v.stroke),strokeWidth:.5});var Ne=i.getScaledPath("TASK_TYPE_USER_2",{abspos:{x:V,y:K}});E(M,Ne,{fill:We(w,s,v.fill),stroke:de(w,c,v.stroke),strokeWidth:.5});var Ze=i.getScaledPath("TASK_TYPE_USER_3",{abspos:{x:V,y:K}});return E(M,Ze,{fill:de(w,c,v.stroke),stroke:de(w,c,v.stroke),strokeWidth:.5}),N},label:function(M,w,v={}){return Ue(M,w,v)}};this._drawPath=E,this._renderer=C}he(Nr,ki),Nr.$inject=["config.bpmnRenderer","eventBus","styles","pathMap","canvas","textRenderer"],Nr.prototype.canRender=function(e){return _(e,"bpmn:BaseElement")},Nr.prototype.drawShape=function(e,t,n={}){var{type:i}=t,r=this._renderer(i);return r(e,t,n)},Nr.prototype.drawConnection=function(e,t,n={}){var{type:i}=t,r=this._renderer(i);return r(e,t,n)},Nr.prototype.getShapePath=function(e){return je(e)?El(e,cR):_(e,"bpmn:Event")?Sm(e):_(e,"bpmn:Activity")?El(e,Ns):_(e,"bpmn:Gateway")?iR(e):rR(e)};function Xe(e,t=[]){return t.reduce((n,i)=>(e[i]&&(n[i]=e[i]),n),{})}var pR=0,fR={width:150,height:50};function dR(e){var t=e.split("-");return{horizontal:t[0]||"center",vertical:t[1]||"top"}}function hR(e){return Yt(e)?j({top:0,left:0,right:0,bottom:0},e):{top:e,left:e,right:e,bottom:e}}var Sl=null;function mR(){return Sl||(Sl=document.createElement("canvas").getContext("2d")),Sl}function gR(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(Rm(e.fontSize)||"12px"),t.push(e.fontFamily||"sans-serif"),t.join(" ")}function Rm(e){if(e!=null)return typeof e=="number"||/^-?\d+(\.\d+)?$/.test(e)?e+"px":e}function yR(e,t){var n=mR();if(!n)return{width:0,height:0};n.font=gR(t),"letterSpacing"in n&&(n.letterSpacing=Rm(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 vR(e,t,n){for(var i=e.shift(),r=i,o;;){if(o=yR(r,n),o.width=r?o.width:0,r===" "||r===""||o.width<Math.round(t)||r.length<2)return bR(e,r,i,o);r=xR(r,o.width,t)}}function bR(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 Cm="­";function _R(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===Cm)&&r.pop();break}var a=r[r.length-1];return a&&a===Cm&&(r[r.length-1]="-"),r.join("")}function xR(e,t,n){var i=Math.max(e.length*(n/t),1),r=_R(e,i);return r||(r=e.slice(0,Math.max(Math.round(i-1),1))),r}function $s(e){this._config=j({},{size:fR,padding:pR,style:{},align:"center-top"},e||{})}$s.prototype.createText=function(e,t){return this.layoutText(e,t).element},$s.prototype.getDimensions=function(e,t){return this.layoutText(e,t).dimensions},$s.prototype.layoutText=function(e,t){for(var n=j({},this._config.size,t.box),i=j({},this._config.style,t.style),r=dR(t.align||this._config.align),o=hR(t.padding!==void 0?t.padding:this._config.padding),a=t.fitBox||!1,s=wR(i),c=e.split(/\u00AD?\r?\n/),u=[],l=n.width-o.left-o.right;c.length;)u.push(vR(c,l,i));r.vertical==="middle"&&(o.top=o.bottom=0);var p=En(u,function(m,S,y){return m+(s||S.height)},0)+o.top+o.bottom,f=En(u,function(m,S,y){return S.width>m?S.width:m},0),d=o.top;r.vertical==="middle"&&(d+=(n.height-p)/2),d-=(s||u[0].height)/4;var g=Se("text");me(g,i),L(u,function(m){var S;switch(d+=s||m.height,r.horizontal){case"left":S=o.left;break;case"right":S=(a?f:l)-o.right-m.width;break;default:S=Math.max(((a?f:l)-m.width)/2+o.left,0)}var y=Se("tspan");me(y,{x:S,y:d}),y.textContent=m.text,Ie(g,y)});var h={width:f,height:p};return{dimensions:h,element:g}};function wR(e){if("fontSize"in e&&"lineHeight"in e)return e.lineHeight*parseInt(e.fontSize,10)}var ER=12,SR=1.2,RR=40;function Pm(e){var t=j({fontFamily:"Arial, sans-serif",fontSize:ER,fontWeight:"normal",lineHeight:SR},e&&e.defaultStyle||{}),n=parseInt(t.fontSize,10)-1,i=j({},t,{fontSize:n},e&&e.externalStyle||{}),r=new $s({style:t});this.getExternalLabelBounds=function(a,s){var c={width:Math.max(a.width,Br.width),height:30},u=o(s,c,{style:i});return{x:Math.round(a.x+a.width/2-u.width/2),y:a.y,width:Math.ceil(u.width),height:Math.ceil(u.height)}},this.getTextAnnotationBounds=function(a,s){var c=o(s,a,{style:t,align:"left-top",padding:go});return{x:a.x,y:a.y,width:a.width,height:Math.max(RR,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}}Pm.$inject=["config.textRenderer"];function CR(){this.pathMap={EVENT_MESSAGE:{d:"m {mx},{my} l 0,{e.y1} l {e.x1},0 l 0,-{e.y1} z l {e.x0},{e.y0} l {e.x0},-{e.y0}",height:36,width:36,heightElements:[6,14],widthElements:[10.5,21]},EVENT_SIGNAL:{d:"M {mx},{my} l {e.x0},{e.y0} l -{e.x1},0 Z",height:36,width:36,heightElements:[18],widthElements:[10,20]},EVENT_ESCALATION:{d:"M {mx},{my} l {e.x0},{e.y0} l -{e.x0},-{e.y1} l -{e.x0},{e.y1} Z",height:36,width:36,heightElements:[20,7],widthElements:[8]},EVENT_CONDITIONAL:{d:"M {e.x0},{e.y0} l {e.x1},0 l 0,{e.y2} l -{e.x1},0 Z M {e.x2},{e.y3} l {e.x0},0 M {e.x2},{e.y4} l {e.x0},0 M {e.x2},{e.y5} l {e.x0},0 M {e.x2},{e.y6} l {e.x0},0 M {e.x2},{e.y7} l {e.x0},0 M {e.x2},{e.y8} l {e.x0},0 ",height:36,width:36,heightElements:[8.5,14.5,18,11.5,14.5,17.5,20.5,23.5,26.5],widthElements:[10.5,14.5,12.5]},EVENT_LINK:{d:"m {mx},{my} 0,{e.y0} -{e.x1},0 0,{e.y1} {e.x1},0 0,{e.y0} {e.x0},-{e.y2} -{e.x0},-{e.y2} z",height:36,width:36,heightElements:[4.4375,6.75,7.8125],widthElements:[9.84375,13.5]},EVENT_ERROR:{d:"m {mx},{my} {e.x0},-{e.y0} {e.x1},-{e.y1} {e.x2},{e.y2} {e.x3},-{e.y3} -{e.x4},{e.y4} -{e.x5},-{e.y5} z",height:36,width:36,heightElements:[.023,8.737,8.151,16.564,10.591,8.714],widthElements:[.085,6.672,6.97,4.273,5.337,6.636]},EVENT_CANCEL_45:{d:"m {mx},{my} -{e.x1},0 0,{e.x0} {e.x1},0 0,{e.y1} {e.x0},0 0,-{e.y1} {e.x1},0 0,-{e.y0} -{e.x1},0 0,-{e.y1} -{e.x0},0 z",height:36,width:36,heightElements:[4.75,8.5],widthElements:[4.75,8.5]},EVENT_COMPENSATION:{d:"m {mx},{my} {e.x0},-{e.y0} 0,{e.y1} z m {e.x1},-{e.y2} {e.x2},-{e.y3} 0,{e.y1} -{e.x2},-{e.y3} z",height:36,width:36,heightElements:[6.5,13,.4,6.1],widthElements:[9,9.3,8.7]},EVENT_TIMER_WH:{d:"M {mx},{my} l {e.x0},-{e.y0} m -{e.x0},{e.y0} l {e.x1},{e.y1} ",height:36,width:36,heightElements:[10,2],widthElements:[3,7]},EVENT_TIMER_LINE:{d:"M {mx},{my} m {e.x0},{e.y0} l -{e.x1},{e.y1} ",height:36,width:36,heightElements:[10,3],widthElements:[0,0]},EVENT_MULTIPLE:{d:"m {mx},{my} {e.x1},-{e.y0} {e.x1},{e.y0} -{e.x0},{e.y1} -{e.x2},0 z",height:36,width:36,heightElements:[6.28099,12.56199],widthElements:[3.1405,9.42149,12.56198]},EVENT_PARALLEL_MULTIPLE:{d:"m {mx},{my} {e.x0},0 0,{e.y1} {e.x1},0 0,{e.y0} -{e.x1},0 0,{e.y1} -{e.x0},0 0,-{e.y1} -{e.x1},0 0,-{e.y0} {e.x1},0 z",height:36,width:36,heightElements:[2.56228,7.68683],widthElements:[2.56228,7.68683]},GATEWAY_EXCLUSIVE:{d:"m {mx},{my} {e.x0},{e.y0} {e.x1},{e.y0} {e.x2},0 {e.x4},{e.y2} {e.x4},{e.y1} {e.x2},0 {e.x1},{e.y3} {e.x0},{e.y3} {e.x3},0 {e.x5},{e.y1} {e.x5},{e.y2} {e.x3},0 z",height:17.5,width:17.5,heightElements:[8.5,6.5312,-6.5312,-8.5],widthElements:[6.5,-6.5,3,-3,5,-5]},GATEWAY_PARALLEL:{d:"m {mx},{my} 0,{e.y1} -{e.x1},0 0,{e.y0} {e.x1},0 0,{e.y1} {e.x0},0 0,-{e.y1} {e.x1},0 0,-{e.y0} -{e.x1},0 0,-{e.y1} -{e.x0},0 z",height:30,width:30,heightElements:[5,12.5],widthElements:[5,12.5]},GATEWAY_EVENT_BASED:{d:"m {mx},{my} {e.x0},{e.y0} {e.x0},{e.y1} {e.x1},{e.y2} {e.x2},0 z",height:11,width:11,heightElements:[-6,6,12,-12],widthElements:[9,-3,-12]},GATEWAY_COMPLEX:{d:"m {mx},{my} 0,{e.y0} -{e.x0},-{e.y1} -{e.x1},{e.y2} {e.x0},{e.y1} -{e.x2},0 0,{e.y3} {e.x2},0 -{e.x0},{e.y1} l {e.x1},{e.y2} {e.x0},-{e.y1} 0,{e.y0} {e.x3},0 0,-{e.y0} {e.x0},{e.y1} {e.x1},-{e.y2} -{e.x0},-{e.y1} {e.x2},0 0,-{e.y3} -{e.x2},0 {e.x0},-{e.y1} -{e.x1},-{e.y2} -{e.x0},{e.y1} 0,-{e.y0} -{e.x3},0 z",height:17.125,width:17.125,heightElements:[4.875,3.4375,2.125,3],widthElements:[3.4375,2.125,4.875,3]},DATA_OBJECT_PATH:{d:"m 0,0 {e.x1},0 {e.x0},{e.y0} 0,{e.y1} -{e.x2},0 0,-{e.y2} {e.x1},0 0,{e.y0} {e.x0},0",height:61,width:51,heightElements:[10,50,60],widthElements:[10,40,50,60]},DATA_OBJECT_COLLECTION_PATH:{d:"m{mx},{my} m 3,2 l 0,10 m 3,-10 l 0,10 m 3,-10 l 0,10",height:10,width:10,heightElements:[],widthElements:[]},DATA_ARROW:{d:"m 5,9 9,0 0,-3 5,5 -5,5 0,-3 -9,0 z",height:61,width:51,heightElements:[],widthElements:[]},DATA_STORE:{d:"m {mx},{my} l 0,{e.y2} c {e.x0},{e.y1} {e.x1},{e.y1} {e.x2},0 l 0,-{e.y2} c -{e.x0},-{e.y1} -{e.x1},-{e.y1} -{e.x2},0c {e.x0},{e.y1} {e.x1},{e.y1} {e.x2},0 m -{e.x2},{e.y0}c {e.x0},{e.y1} {e.x1},{e.y1} {e.x2},0m -{e.x2},{e.y0}c {e.x0},{e.y1} {e.x1},{e.y1} {e.x2},0",height:61,width:61,heightElements:[7,10,45],widthElements:[2,58,60]},TEXT_ANNOTATION:{d:"m {mx}, {my} m 10,0 l -10,0 l 0,{e.y0} l 10,0",height:30,width:10,heightElements:[30],widthElements:[10]},MARKER_SUB_PROCESS:{d:"m{mx},{my} m 7,2 l 0,10 m -5,-5 l 10,0",height:10,width:10,heightElements:[],widthElements:[]},MARKER_PARALLEL:{d:"m{mx},{my} m 3,2 l 0,10 m 3,-10 l 0,10 m 3,-10 l 0,10",height:10,width:10,heightElements:[],widthElements:[]},MARKER_SEQUENTIAL:{d:"m{mx},{my} m 0,3 l 10,0 m -10,3 l 10,0 m -10,3 l 10,0",height:10,width:10,heightElements:[],widthElements:[]},MARKER_COMPENSATION:{d:"m {mx},{my} 7,-5 0,10 z m 7.1,-0.3 6.9,-4.7 0,10 -6.9,-4.7 z",height:10,width:21,heightElements:[],widthElements:[]},MARKER_LOOP:{d:"m {mx},{my} c 3.526979,0 6.386161,-2.829858 6.386161,-6.320661 0,-3.490806 -2.859182,-6.320661 -6.386161,-6.320661 -3.526978,0 -6.38616,2.829855 -6.38616,6.320661 0,1.745402 0.714797,3.325567 1.870463,4.469381 0.577834,0.571908 1.265885,1.034728 2.029916,1.35457 l -0.718163,-3.909793 m 0.718163,3.909793 -3.885211,0.802902",height:13.9,width:13.7,heightElements:[],widthElements:[]},MARKER_ADHOC:{d:"m {mx},{my} m 0.84461,2.64411 c 1.05533,-1.23780996 2.64337,-2.07882 4.29653,-1.97997996 2.05163,0.0805 3.85579,1.15803 5.76082,1.79107 1.06385,0.34139996 2.24454,0.1438 3.18759,-0.43767 0.61743,-0.33642 1.2775,-0.64078 1.7542,-1.17511 0,0.56023 0,1.12046 0,1.6807 -0.98706,0.96237996 -2.29792,1.62393996 -3.6918,1.66181996 -1.24459,0.0927 -2.46671,-0.2491 -3.59505,-0.74812 -1.35789,-0.55965 -2.75133,-1.33436996 -4.27027,-1.18121996 -1.37741,0.14601 -2.41842,1.13685996 -3.44288,1.96782996 z",height:4,width:15,heightElements:[],widthElements:[]},TASK_TYPE_SEND:{d:"m {mx},{my} l 0,{e.y1} l {e.x1},0 l 0,-{e.y1} z l {e.x0},{e.y0} l {e.x0},-{e.y0}",height:14,width:21,heightElements:[6,14],widthElements:[10.5,21]},TASK_TYPE_SCRIPT:{d:"m {mx},{my} c 9.966553,-6.27276 -8.000926,-7.91932 2.968968,-14.938 l -8.802728,0 c -10.969894,7.01868 6.997585,8.66524 -2.968967,14.938 z m -7,-12 l 5,0 m -4.5,3 l 4.5,0 m -3,3 l 5,0m -4,3 l 5,0",height:15,width:12.6,heightElements:[6,14],widthElements:[10.5,21]},TASK_TYPE_USER_1:{d:"m {mx},{my} c 0.909,-0.845 1.594,-2.049 1.594,-3.385 0,-2.554 -1.805,-4.62199999 -4.357,-4.62199999 -2.55199998,0 -4.28799998,2.06799999 -4.28799998,4.62199999 0,1.348 0.974,2.562 1.89599998,3.405 -0.52899998,0.187 -5.669,2.097 -5.794,4.7560005 v 6.718 h 17 v -6.718 c 0,-2.2980005 -5.5279996,-4.5950005 -6.0509996,-4.7760005 zm -8,6 l 0,5.5 m 11,0 l 0,-5"},TASK_TYPE_USER_2:{d:"m {mx},{my} m 2.162,1.009 c 0,2.4470005 -2.158,4.4310005 -4.821,4.4310005 -2.66499998,0 -4.822,-1.981 -4.822,-4.4310005 "},TASK_TYPE_USER_3:{d:"m {mx},{my} m -6.9,-3.80 c 0,0 2.25099998,-2.358 4.27399998,-1.177 2.024,1.181 4.221,1.537 4.124,0.965 -0.098,-0.57 -0.117,-3.79099999 -4.191,-4.13599999 -3.57499998,0.001 -4.20799998,3.36699999 -4.20699998,4.34799999 z"},TASK_TYPE_MANUAL:{d:"m {mx},{my} c 0.234,-0.01 5.604,0.008 8.029,0.004 0.808,0 1.271,-0.172 1.417,-0.752 0.227,-0.898 -0.334,-1.314 -1.338,-1.316 -2.467,-0.01 -7.886,-0.004 -8.108,-0.004 -0.014,-0.079 0.016,-0.533 0,-0.61 0.195,-0.042 8.507,0.006 9.616,0.002 0.877,-0.007 1.35,-0.438 1.353,-1.208 0.003,-0.768 -0.479,-1.09 -1.35,-1.091 -2.968,-0.002 -9.619,-0.013 -9.619,-0.013 v -0.591 c 0,0 5.052,-0.016 7.225,-0.016 0.888,-0.002 1.354,-0.416 1.351,-1.193 -0.006,-0.761 -0.492,-1.196 -1.361,-1.196 -3.473,-0.005 -10.86,-0.003 -11.0829995,-0.003 -0.022,-0.047 -0.045,-0.094 -0.069,-0.139 0.3939995,-0.319 2.0409995,-1.626 2.4149995,-2.017 0.469,-0.4870005 0.519,-1.1650005 0.162,-1.6040005 -0.414,-0.511 -0.973,-0.5 -1.48,-0.236 -1.4609995,0.764 -6.5999995,3.6430005 -7.7329995,4.2710005 -0.9,0.499 -1.516,1.253 -1.882,2.19 -0.37000002,0.95 -0.17,2.01 -0.166,2.979 0.004,0.718 -0.27300002,1.345 -0.055,2.063 0.629,2.087 2.425,3.312 4.859,3.318 4.6179995,0.014 9.2379995,-0.139 13.8569995,-0.158 0.755,-0.004 1.171,-0.301 1.182,-1.033 0.012,-0.754 -0.423,-0.969 -1.183,-0.973 -1.778,-0.01 -5.824,-0.004 -6.04,-0.004 10e-4,-0.084 0.003,-0.586 10e-4,-0.67 z"},TASK_TYPE_INSTANTIATING_SEND:{d:"m {mx},{my} l 0,8.4 l 12.6,0 l 0,-8.4 z l 6.3,3.6 l 6.3,-3.6"},TASK_TYPE_SERVICE:{d:"m {mx},{my} v -1.71335 c 0.352326,-0.0705 0.703932,-0.17838 1.047628,-0.32133 0.344416,-0.14465 0.665822,-0.32133 0.966377,-0.52145 l 1.19431,1.18005 1.567487,-1.57688 -1.195028,-1.18014 c 0.403376,-0.61394 0.683079,-1.29908 0.825447,-2.01824 l 1.622133,-0.01 v -2.2196 l -1.636514,0.01 c -0.07333,-0.35153 -0.178319,-0.70024 -0.323564,-1.04372 -0.145244,-0.34406 -0.321407,-0.6644 -0.522735,-0.96217 l 1.131035,-1.13631 -1.583305,-1.56293 -1.129598,1.13589 c -0.614052,-0.40108 -1.302883,-0.68093 -2.022633,-0.82247 l 0.0093,-1.61852 h -2.241173 l 0.0042,1.63124 c -0.353763,0.0736 -0.705369,0.17977 -1.049785,0.32371 -0.344415,0.14437 -0.665102,0.32092 -0.9635006,0.52046 l -1.1698628,-1.15823 -1.5667691,1.5792 1.1684265,1.15669 c -0.4026573,0.61283 -0.68308,1.29797 -0.8247287,2.01713 l -1.6588041,0.003 v 2.22174 l 1.6724648,-0.006 c 0.073327,0.35077 0.1797598,0.70243 0.3242851,1.04472 0.1452428,0.34448 0.3214064,0.6644 0.5227339,0.96066 l -1.1993431,1.19723 1.5840256,1.56011 1.1964668,-1.19348 c 0.6140517,0.40346 1.3028827,0.68232 2.0233517,0.82331 l 7.19e-4,1.69892 h 2.226848 z m 0.221462,-3.9957 c -1.788948,0.7502 -3.8576,-0.0928 -4.6097055,-1.87438 -0.7521065,-1.78321 0.090598,-3.84627 1.8802645,-4.59604 1.78823,-0.74936 3.856881,0.0929 4.608987,1.87437 0.752106,1.78165 -0.0906,3.84612 -1.879546,4.59605 z"},TASK_TYPE_SERVICE_FILL:{d:"m {mx},{my} c -1.788948,0.7502 -3.8576,-0.0928 -4.6097055,-1.87438 -0.7521065,-1.78321 0.090598,-3.84627 1.8802645,-4.59604 1.78823,-0.74936 3.856881,0.0929 4.608987,1.87437 0.752106,1.78165 -0.0906,3.84612 -1.879546,4.59605 z"},TASK_TYPE_BUSINESS_RULE_HEADER:{d:"m {mx},{my} 0,4 20,0 0,-4 z"},TASK_TYPE_BUSINESS_RULE_MAIN:{d:"m {mx},{my} 0,12 20,0 0,-12 zm 0,8 l 20,0 m -13,-4 l 0,8"},MESSAGE_FLOW_MARKER:{d:"m {mx},{my} m -10.5 ,-7 l 0,14 l 21,0 l 0,-14 z l 10.5,6 l 10.5,-6"}},this.getRawPath=function(t){return this.pathMap[t].d},this.getScaledPath=function(t,n){var i=this.pathMap[t],r,o;n.abspos?(r=n.abspos.x,o=n.abspos.y):(r=n.containerWidth*n.position.mx,o=n.containerHeight*n.position.my);var a={};if(n.position){for(var s=n.containerHeight/i.height*n.yScaleFactor,c=n.containerWidth/i.width*n.xScaleFactor,u=0;u<i.heightElements.length;u++)a["y"+u]=i.heightElements[u]*s;for(var l=0;l<i.widthElements.length;l++)a["x"+l]=i.widthElements[l]*c}var p=MR(i.d,{mx:r,my:o,e:a});return p}}var PR=/\{([^{}]+)\}/g,AR=/(?:(?:^|\.)(.+?)(?=\[|\.|$|\()|\[('|")(.+?)\2\])(\(\))?/g;function TR(e,t,n){var i=n;return t.replace(AR,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 MR(e,t){return String(e).replace(PR,function(n,i){return TR(n,i,t)})}const kR={__init__:["bpmnRenderer"],bpmnRenderer:["type",Nr],textRenderer:["type",Pm],pathMap:["type",CR]};function OR(e,t){return t=t||{},e.replace(/{([^}]+)}/g,function(n,i){return t[i]||"{"+i+"}"})}const sa={translate:["value",OR]};function js(e,t,n){return j({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?[Te(t),Te(n)]:i.map(function(r){return{x:r.x,y:r.y}})}function Am(e,t,n){return new Error(`element ${pn(t)} referenced by ${pn(e)}#${n} not yet drawn`)}function Ii(e,t,n,i,r){this._eventBus=e,this._canvas=t,this._elementFactory=n,this._elementRegistry=i,this._textRenderer=r}Ii.$inject=["eventBus","canvas","elementFactory","elementRegistry","textRenderer"],Ii.prototype.add=function(e,t,n){var i,r,o;if(_(t,"bpmndi:BPMNPlane")){var a=_(e,"bpmn:SubProcess")?{id:e.id+"_plane"}:{};i=this._elementFactory.createRoot(js(e,t,a)),this._canvas.addRootElement(i)}else if(_(t,"bpmndi:BPMNShape")){var s=!qe(e,t),c=IR(e);r=n&&(n.hidden||n.collapsed);var u=t.bounds;i=this._elementFactory.createShape(js(e,t,{collapsed:s,hidden:r,x:Math.round(u.x),y:Math.round(u.y),width:Math.round(u.width),height:Math.round(u.height),isFrame:c})),_(e,"bpmn:BoundaryEvent")&&this._attachBoundary(e,i),_(e,"bpmn:Lane")&&(o=0),_(e,"bpmn:DataStoreReference")&&(LR(n,Te(u))||(n=this._canvas.findRoot(n))),this._canvas.addShape(i,n,o)}else if(_(t,"bpmndi:BPMNEdge")){var l=this._getSource(e),p=this._getTarget(e);r=n&&(n.hidden||n.collapsed),i=this._elementFactory.createConnection(js(e,t,{hidden:r,source:l,target:p,waypoints:DR(t,l,p)})),_(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)&&Bn(i)&&this.addLabel(e,t,i),this._eventBus.fire("bpmnElement.added",{element:i}),i},Ii.prototype._attachBoundary=function(e,t){var n=e.attachedToRef;if(!n)throw new Error(`missing ${pn(e)}#attachedToRef`);var i=this._elementRegistry.get(n.id),r=i&&i.attachers;if(!i)throw Am(e,n,"attachedToRef");t.host=i,r||(i.attachers=r=[]),r.indexOf(t)===-1&&r.push(t)},Ii.prototype.addLabel=function(e,t,n){var i,r,o;return i=XS(t,n),r=Bn(n),r&&(i=this._textRenderer.getExternalLabelBounds(i,r)),o=this._elementFactory.createLabel(js(e,t,{id:e.id+"_label",labelTarget:n,type:"label",hidden:n.hidden||!Bn(n),x:Math.round(i.x),y:Math.round(i.y),width:Math.round(i.width),height:Math.round(i.height)})),this._canvas.addShape(o,n.parent)},Ii.prototype._getConnectedElement=function(e,t){var n,i,r=e.$type;if(i=e[t+"Ref"],t==="source"&&r==="bpmn:DataInputAssociation"&&(i=i&&i[0]),(t==="source"&&r==="bpmn:DataOutputAssociation"||t==="target"&&r==="bpmn:DataInputAssociation")&&(i=e.$parent),n=i&&this._getElement(i),n)return n;throw i?Am(e,i,t+"Ref"):new Error(`${pn(e)}#${t} Ref not specified`)},Ii.prototype._getSource=function(e){return this._getConnectedElement(e,"source")},Ii.prototype._getTarget=function(e){return this._getConnectedElement(e,"target")},Ii.prototype._getElement=function(e){return this._elementRegistry.get(e.id)};function LR(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 IR(e){return _(e,"bpmn:Group")}const Tm={__depends__:[kR,{__depends__:[sa],bpmnImporter:["type",Ii]}]};function ca(e){return{x:e.x+e.width/2,y:e.y+e.height/2}}function ni(e,t){return{x:e.x-t.x,y:e.y-t.y}}function Rl(e){return Math.log(e)/Math.log(10)}var BR=1e3;function ee(e){this._eventBus=e}ee.$inject=["eventBus"];function NR(e,t){return function(n){return e.call(t||null,n.context,n.command,n)}}ee.prototype.on=function(e,t,n,i,r,o){if((Kt(t)||De(t))&&(o=r,r=i,i=n,n=t,t=null),Kt(n)&&(o=r,r=i,i=n,n=BR),Yt(r)&&(o=r,r=!1),!Kt(i))throw new Error("handlerFn must be a function");Ae(e)||(e=[e]);var a=this._eventBus;L(e,function(s){var c=["commandStack",s,t].filter(function(u){return u}).join(".");a.on(c,n,r?NR(i,o):i,o)})},ee.prototype.canExecute=Bi("canExecute"),ee.prototype.preExecute=Bi("preExecute"),ee.prototype.preExecuted=Bi("preExecuted"),ee.prototype.execute=Bi("execute"),ee.prototype.executed=Bi("executed"),ee.prototype.postExecute=Bi("postExecute"),ee.prototype.postExecuted=Bi("postExecuted"),ee.prototype.revert=Bi("revert"),ee.prototype.reverted=Bi("reverted");function Bi(e){return function(n,i,r,o,a){(Kt(n)||De(n))&&(a=o,o=r,r=i,i=n,n=null),this.on(n,e,i,r,o,a)}}var Cl=["top","bottom","left","right"],Fs=10;function Pl(e,t){ee.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(Is(r)&&!ct(r)){var o=FR(r);o&&i(r,o)}}function i(r,o){var a=Te(r),s=r.label,c=Te(s);if(s.parent){var u=Re(r),l;switch(o){case"top":l={x:a.x,y:u.top-Fs-s.height/2};break;case"left":l={x:u.left-Fs-s.width/2,y:a.y};break;case"bottom":l={x:a.x,y:u.bottom+Fs+s.height/2};break;case"right":l={x:u.right+Fs+s.width/2,y:a.y};break}var p=ni(l,c);t.moveShape(s,p)}}}he(Pl,ee),Pl.$inject=["eventBus","modeling"];function $R(e){var t=e.host,n=Te(e),i=nn(n,t),r;i.indexOf("-")>=0?r=i.split("-"):r=[i];var o=Cl.filter(function(a){return r.indexOf(a)===-1});return o}function jR(e){var t=Te(e),n=[].concat(e.incoming.map(function(i){return i.waypoints[i.waypoints.length-2]}),e.outgoing.map(function(i){return i.waypoints[1]})).map(function(i){return Mm(t,i)});return n}function FR(e){var t=Te(e.label),n=Te(e),i=Mm(n,t);if(HR(i)){var r=jR(e);if(e.host){var o=$R(e);r=r.concat(o)}var a=Cl.filter(function(s){return r.indexOf(s)===-1});return a.indexOf(i)!==-1?nn(e.label,e)!=="intersect"?void 0:i:a[0]}}function Mm(e,t){return nn(t,e,5)}function HR(e){return Cl.indexOf(e)!==-1}function Al(e){ee.call(this,e),this.preExecute("shape.append",function(t){var n=t.source,i=t.shape;t.position||(_(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)}he(Al,ee),Al.$inject=["eventBus"];var zR=1500;function Tl(e,t,n){e.invoke(ee,this),this.preExecute("elements.delete",zR,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=ze(r,u=>_(u,"bpmn:Participant")||_(u,"bpmn:SubProcess"));if(!o.length)return[];var a=n.getRootElement(),s=new Set(a.children.filter(u=>_(u,"bpmn:Artifact"))),c=new Set;return L(o,u=>{const l=new Set(to(lo(Array.from(s),Ot(u))));c=c.union(l),s=s.difference(l)}),Array.from(c)}}he(Tl,ee),Tl.$inject=["injector","eventBus","canvas"];function Ml(e,t){e.invoke(ee,this),this.postExecute("shape.move",function(n){var i=n.newParent,r=n.shape,o=ze(r.incoming.concat(r.outgoing),function(a){return _(a,"bpmn:Association")});L(o,function(a){t.moveConnection(a,{x:0,y:0},i)})},!0)}he(Ml,ee),Ml.$inject=["injector","modeling"];function vo(e,t){for(xn(t)&&(t=[t]);e=e.parent;)if(He(e,t))return e;return null}function km(e,t){var n=vo(e,"bpmn:Process");if(n)return!0;var i=["bpmn:Participant","bpmn:Lane"];if(n=vo(e,i),n)return Zt(n);if(He(e,i))return Zt(e);var r;for(r=te(e);r&&!_(r,"bpmn:Process");r=r.$parent);if(!t)return!0;var o=t.find(function(a){var s=te(a);return s&&s.get("processRef")===r});return o?Zt(o):!0}var Om=500;function Hs(e,t){t.invoke(ee,this),this._bpmnReplace=e;var n=this;this.postExecuted("elements.create",Om,function(i){var r=i.elements;r=r.filter(function(o){var a=o.host;return Dm(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",Om,function(i){var r=i.shapes,o=i.newHost;if(r.length===1){var a=r[0];Dm(a,o)&&(i.shapes=[n._replaceShape(a,o)])}},!0)}Hs.$inject=["bpmnReplace","injector"],he(Hs,ee),Hs.prototype._replaceShape=function(e,t){var n=GR(e),i={type:"bpmn:BoundaryEvent",host:t};return n&&(i.eventDefinitionType=n.$type),this._bpmnReplace.replaceElement(e,i,{layoutConnection:!1})};function GR(e){var t=te(e),n=t.eventDefinitions;return n&&n[0]}function Dm(e,t){return!je(e)&&He(e,["bpmn:IntermediateThrowEvent","bpmn:IntermediateCatchEvent"])&&!!t}function kl(e,t){ee.call(this,e);function n(i){return ze(i.attachers,function(r){return _(r,"bpmn:BoundaryEvent")})}this.postExecute("connection.create",function(i){var r=i.context.source,o=i.context.target,a=n(o);_(r,"bpmn:EventBasedGateway")&&_(o,"bpmn:ReceiveTask")&&a.length>0&&t.removeElements(a)}),this.postExecute("connection.reconnect",function(i){var r=i.context.oldSource,o=i.context.newSource;_(r,"bpmn:Gateway")&&_(o,"bpmn:EventBasedGateway")&&L(o.outgoing,function(a){var s=a.target,c=n(s);_(s,"bpmn:ReceiveTask")&&c.length>0&&t.removeElements(c)})})}kl.$inject=["eventBus","modeling"],he(kl,ee);function Lm(e){return e.create("bpmn:Category")}function VR(e){return e.create("bpmn:CategoryValue")}function Im(e,t){var n=t.get("categoryValueRef");return n||(n=t.categoryValueRef=VR(e)),n.$parent||(n.$parent=Lm(e)),n}function WR(e,t,n){return Ct(t.get("categoryValue"),e),e.$parent=t,Ct(n.get("rootElements"),t),t.$parent=n,e}function UR(e){var t=e.$parent;return t&&(St(t.get("categoryValue"),e),e.$parent=null),e}function qR(e){var t=e.$parent;return t&&(St(t.get("rootElements"),e),e.$parent=null),e}var YR=500;function Ol(e,t,n){n.invoke(ee,this);function i(c){return t.filter(function(u){return _(u,"bpmn:Group")&&!u.labelTarget}).map(te).filter(function(u){return u!==c})}function r(c,u){return i(u).some(function(l){return l.get("categoryValueRef")===c})}function o(c,u){return i(u).some(function(l){var p=l.get("categoryValueRef");return p&&p.$parent===c})}function a(c,u){c&&u&&WR(c,u,e.getDefinitions())}function s(c,u,l){u&&!o(u,l)&&qR(u),c&&!r(c,l)&&UR(c)}this.executed(["shape.create","label.create"],function(c){var u=c.labelTarget||c.shape;!_(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;!_(u,"bpmn:Group")||u.labelTarget||s(c.categoryValue,c.category,te(u))},!0),this.executed(["shape.move","shape.resize"],YR,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,te(u))},!0),this.executed("group.updateRefs",function(c){Bm(c).forEach(function(u){a(u.categoryValue,u.category)})},!0),this.reverted("group.updateRefs",function(c){Bm(c).forEach(function(u){s(u.categoryValue,u.category,te(u.groupShape))})},!0),this.executed("shape.delete",function(c){var u=c.shape;!_(u,"bpmn:Group")||u.labelTarget||s(c.categoryValue,c.category,te(u))},!0),this.reverted("shape.delete",function(c){var u=c.shape;!_(u,"bpmn:Group")||u.labelTarget||a(c.categoryValue,c.category)},!0)}Ol.$inject=["bpmnjs","elementRegistry","injector"],he(Ol,ee);function Bm(e){var t;return((t=e.updates)==null?void 0:t.groups)||[]}function Dl(e,t,n){ee.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(m){const S=m.source,y=m.target;bo(S)&&ua(y)&&l(y)}function r(m){const S=m.connection,y=m.source,x=m.target;bo(y)&&zs(x)&&(u(x),f(y,[S]))}function o(m){const S=m.newTarget,y=m.oldSource,x=m.oldTarget;if(x!==S){const E=y;ua(x)&&l(x),bo(E)&&zs(S)&&u(S)}}function a(m){const{element:S}=m;ua(S)?(p(S),d(S)):zs(S)&&g(S)}function s(m){const{newData:S,oldShape:y}=m;if(bo(m.oldShape)&&S.eventDefinitionType!=="bpmn:CompensateEventDefinition"||S.type!=="bpmn:BoundaryEvent"){const x=y.outgoing.find(({target:E})=>ua(E));x&&x.target&&(m._connectionTarget=x.target)}else if(!bo(m.oldShape)&&S.eventDefinitionType==="bpmn:CompensateEventDefinition"&&S.type==="bpmn:BoundaryEvent"){const x=y.outgoing.find(({target:E})=>zs(E));x&&x.target&&(m._connectionTarget=x.target),h(y)}}function c(m){const{_connectionTarget:S,newShape:y}=m;S&&t.connect(y,S)}function u(m){t.updateProperties(m,{isForCompensation:!0})}function l(m){t.updateProperties(m,{isForCompensation:void 0})}function p(m){for(const S of m.incoming)n.canConnect(S.source,m)||t.removeConnection(S);for(const S of m.outgoing)n.canConnect(m,S.target)||t.removeConnection(S)}function f(m,S){m.outgoing.filter(E=>_(E,"bpmn:Association")).filter(E=>ua(E.target)&&!S.includes(E)).forEach(E=>t.removeConnection(E))}function d(m){const S=m.attachers.slice();S.length&&t.removeElements(S)}function g(m){const S=m.incoming.filter(y=>bo(y.source));t.removeElements(S)}function h(m){const S=m.outgoing.filter(y=>_(y,"bpmn:SequenceFlow"));t.removeElements(S)}}he(Dl,ee),Dl.$inject=["eventBus","modeling","bpmnRules"];function ua(e){const t=te(e);return t&&t.get("isForCompensation")}function bo(e){return e&&_(e,"bpmn:BoundaryEvent")&&mo(e,"bpmn:CompensateEventDefinition")}function zs(e){return e&&_(e,"bpmn:Activity")&&!fn(e)}function Ll(e){e.invoke(ee,this),this.preExecute("shape.create",1500,function(t){var n=t.context,i=n.parent,r=n.shape;_(i,"bpmn:Lane")&&!_(r,"bpmn:Lane")&&(n.parent=vo(i,"bpmn:Participant"))})}Ll.$inject=["injector"],he(Ll,ee);function Il(e,t){ee.call(this,e),this.preExecute("shape.create",function(n){var a;var i=n.context,r=i.shape;if(_(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}})}Il.$inject=["eventBus","bpmnFactory"],he(Il,ee);var Bl=20,Nl=20,Nm=30,Gs=2e3;function $l(e,t,n){ee.call(this,t),t.on(["create.start","shape.move.start"],Gs,function(r){var o=r.context,a=o.shape,s=e.getRootElement();if(!(!_(a,"bpmn:Participant")||!_(s,"bpmn:Process")||!s.children.length)){var c=s.children.filter(function(p){return!_(p,"bpmn:Group")&&!je(p)&&!ct(p)});if(c.length){var u=Ot(c),l=KR(a,u);j(a,l),o.createConstraints=XR(a,u)}}}),t.on("create.start",Gs,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}_(a,"bpmn:Participant")&&_(s,"bpmn:Process")&&(t.on("element.hover",Gs,u),t.once("create.cleanup",function(){t.off("element.hover",u)}))});function i(){var r=e.getRootElement();return _(r,"bpmn:Collaboration")?r:n.makeCollaboration()}this.preExecute("elements.create",Gs,function(r){var o=r.elements,a=r.parent,s=ZR(o),c;s&&_(a,"bpmn:Process")&&(r.parent=i(),c=r.hints=r.hints||{},c.participant=s,c.process=a,c.processRef=te(s).get("processRef"))},!0),this.preExecute("shape.create",function(r){var o=r.parent,a=r.shape;_(a,"bpmn:Participant")&&_(o,"bpmn:Process")&&(r.parent=i(),r.process=o,r.processRef=te(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)&&te(s).set("processRef",te(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)&&te(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)}$l.$inject=["canvas","eventBus","modeling"],he($l,ee);function KR(e,t){t={width:t.width+Bl*2+Nm,height:t.height+Nl*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 XR(e,t){return t=Re(t),{bottom:t.top+e.height/2-Nl,left:t.right-e.width/2+Bl,top:t.bottom-e.height/2+Nl,right:t.left+e.width/2-Bl-Nm}}function ZR(e){return ft(e,function(t){return _(t,"bpmn:Participant")})}var $m="__targetRef_placeholder";function jl(e,t){ee.call(this,e),this.executed(["connection.create","connection.delete","connection.move","connection.reconnect"],jm(o)),this.reverted(["connection.create","connection.delete","connection.move","connection.reconnect"],jm(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===$m});return!u&&s&&(u=t.create("bpmn:Property",{name:$m}),Ct(c,u)),u}function r(a,s){var c=i(a);c&&(n(a,c,s)||St(a.get("properties"),c))}function o(a){var s=a.context,c=s.connection,u=c.businessObject,l=c.target,p=l&&l.businessObject,f=s.newTarget,d=f&&f.businessObject,g=s.oldTarget||s.target,h=g&&g.businessObject,m=c.businessObject,S;h&&h!==p&&r(h,u),d&&d!==p&&r(d,u),p?(S=i(p,!0),m.targetRef=S):m.targetRef=null}}jl.$inject=["eventBus","bpmnFactory"],he(jl,ee);function jm(e){return function(t){var n=t.context,i=n.connection;if(_(i,"bpmn:DataInputAssociation"))return e(t)}}function Vs(e){this._bpmnUpdater=e}Vs.$inject=["bpmnUpdater"],Vs.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),[]},Vs.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 Fl(e,t,n,i){ee.call(this,i),t.registerHandler("dataStore.updateContainment",Vs);function r(){return n.filter(function(s){return _(s,"bpmn:Participant")&&te(s).processRef})[0]}function o(s){return s.children.filter(function(c){return _(c,"bpmn:DataStoreReference")&&!c.labelTarget})}function a(s,c){var u=s.businessObject||s;if(c=c||r(),c){var l=c.businessObject||c;t.execute("dataStore.updateContainment",{dataStoreBo:u,dataStoreDi:Ke(s),newSemanticParent:l.processRef||l,newDiParent:Ke(c)})}}this.preExecute("shape.create",function(s){var c=s.context,u=c.shape;_(u,"bpmn:DataStoreReference")&&u.type!=="label"&&(c.hints||(c.hints={}),c.hints.autoResize=!1)}),this.preExecute("elements.move",function(s){var c=s.context,u=c.shapes,l=u.filter(function(p){return _(p,"bpmn:DataStoreReference")});l.length&&(c.hints||(c.hints={}),c.hints.autoResize=u.filter(function(p){return!_(p,"bpmn:DataStoreReference")}))}),this.postExecute("shape.create",function(s){var c=s.context,u=c.shape,l=u.parent;_(u,"bpmn:DataStoreReference")&&u.type!=="label"&&_(l,"bpmn:Collaboration")&&a(u)}),this.postExecute("shape.move",function(s){var c=s.context,u=c.shape,l=c.oldParent,p=u.parent;if(!_(l,"bpmn:Collaboration")&&_(u,"bpmn:DataStoreReference")&&u.type!=="label"&&_(p,"bpmn:Collaboration")){var f=_(l,"bpmn:Participant")?l:JR(l,"bpmn:Participant");a(u,f)}}),this.postExecute("shape.delete",function(s){var c=s.context,u=c.shape,l=e.getRootElement();He(u,["bpmn:Participant","bpmn:SubProcess"])&&_(l,"bpmn:Collaboration")&&o(l).filter(function(p){return QR(p,u)}).forEach(function(p){a(p)})}),this.postExecute("canvas.updateRoot",function(s){var c=s.context,u=c.oldRoot,l=c.newRoot,p=o(u);p.forEach(function(f){_(l,"bpmn:Process")&&a(f,l)})})}Fl.$inject=["canvas","commandStack","elementRegistry","eventBus"],he(Fl,ee);function QR(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 JR(e,t){for(;e.parent;){if(_(e.parent,t))return e.parent;e=e.parent}}var Ws=Math.max,Us=Math.min,eC=20;function Fm(e,t){return{top:e.top-t.top,right:e.right-t.right,bottom:e.bottom-t.bottom,left:e.left-t.left}}function tC(e,t,n){var i=n.x,r=n.y,o={x:e.x,y:e.y,width:e.width,height:e.height};return t.indexOf("n")!==-1?(o.y=e.y+r,o.height=e.height-r):t.indexOf("s")!==-1&&(o.height=e.height+r),t.indexOf("e")!==-1?o.width=e.width+i:t.indexOf("w")!==-1&&(o.x=e.x+i,o.width=e.width-i),o}function nC(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 qs(e,t,n){var i=t[e],r=n.min&&n.min[e],o=n.max&&n.max[e];return De(r)&&(i=(/top|left/.test(e)?Us:Ws)(i,r)),De(o)&&(i=(/top|left/.test(e)?Ws:Us)(i,o)),i}function iC(e,t){if(!t)return e;var n=Re(e);return Ts({top:qs("top",n,t),right:qs("right",n,t),bottom:qs("bottom",n,t),left:qs("left",n,t)})}function rC(e,t,n,i){var r=Re(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?Re(i):o,s={top:Us(o.top,a.top),left:Us(o.left,a.left),bottom:Ws(o.bottom,a.bottom),right:Ws(o.right,a.right)};return Ts(s)}function la(e,t){return typeof e<"u"?e:eC}function oC(e,t){var n,i,r,o;return typeof t=="object"?(n=la(t.left),i=la(t.right),r=la(t.top),o=la(t.bottom)):n=i=r=o=la(t),{x:e.x-n,y:e.y-r,width:e.width+n+i,height:e.height+r+o}}function aC(e){return!(e.waypoints||e.type==="label")}function Hm(e,t){var n;if(e.length===void 0?n=ze(e.children,aC):n=e,n.length)return oC(Ot(n),t)}var ar=Math.abs;function sC(e,t){return Fm(Re(t),Re(e))}var cC=["bpmn:Participant","bpmn:Process","bpmn:SubProcess"],zn=30;function Ys(e,t){return t=t||[],e.children.filter(function(n){_(n,"bpmn:Lane")&&(Ys(n,t),t.push(n))}),t}function sr(e){return e.children.filter(function(t){return _(t,"bpmn:Lane")})}function Gn(e){return vo(e,cC)||e}function uC(e,t){var n=Gn(e),i=_(n,"bpmn:Process")?[]:[n],r=Ys(n,i),o=Re(e),a=Re(t),s=sC(e,t),c=[],u=Zt(e);return r.forEach(function(l){if(l!==e){var p=u?0:s.top,f=u?s.right:0,d=u?0:s.bottom,g=u?s.left:0,h=Re(l);s.top&&(ar(h.bottom-o.top)<10&&(d=a.top-h.bottom),ar(h.top-o.top)<5&&(p=a.top-h.top)),s.left&&(ar(h.right-o.left)<10&&(f=a.left-h.right),ar(h.left-o.left)<5&&(g=a.left-h.left)),s.bottom&&(ar(h.top-o.bottom)<10&&(p=a.bottom-h.top),ar(h.bottom-o.bottom)<5&&(d=a.bottom-h.bottom)),s.right&&(ar(h.left-o.right)<10&&(g=a.right-h.left),ar(h.right-o.right)<5&&(f=a.right-h.right)),(p||f||d||g)&&c.push({shape:l,newBounds:nC(l,{top:p,right:f,bottom:d,left:g})})}}),c}var lC=500;function Hl(e,t){ee.call(this,e);function n(i,r){var o=Zt(i),a=sr(r),s=[],c=[],u=[],l=[];if(Lr(a,function(m){return o?m.y>i.y?c.push(m):s.push(m):m.x>i.x?l.push(m):u.push(m),m.children}),!!a.length){var p;o?c.length&&s.length?p=i.height/2:p=i.height:l.length&&u.length?p=i.width/2:p=i.width;var f,d,g,h;s.length&&(f=t.calculateAdjustments(s,"y",p,i.y-10),t.makeSpace(f.movingShapes,f.resizingShapes,{x:0,y:p},"s")),c.length&&(d=t.calculateAdjustments(c,"y",-p,i.y+i.height+10),t.makeSpace(d.movingShapes,d.resizingShapes,{x:0,y:-p},"n")),u.length&&(g=t.calculateAdjustments(u,"x",p,i.x-10),t.makeSpace(g.movingShapes,g.resizingShapes,{x:p,y:0},"e")),l.length&&(h=t.calculateAdjustments(l,"x",-p,i.x+i.width+10),t.makeSpace(h.movingShapes,h.resizingShapes,{x:-p,y:0},"w"))}}this.postExecuted("shape.delete",lC,function(i){var r=i.context,o=r.hints,a=r.shape,s=r.oldParent;_(a,"bpmn:Lane")&&(o&&o.nested||n(a,s))})}Hl.$inject=["eventBus","spaceTool"],he(Hl,ee);var zm=500;function Ks(e,t){t.invoke(ee,this),this._bpmnReplace=e;var n=this;this.postExecuted("elements.create",zm,function(i){var r=i.elements;r.filter(function(o){var a=o.host;return Gm(o,a)}).map(function(o){return r.indexOf(o)}).forEach(function(o){i.elements[o]=n._replaceShape(r[o])})},!0),this.preExecute("elements.move",zm,function(i){var r=i.shapes,o=i.newHost;r.forEach(function(a,s){var c=a.host;Gm(a,fC(r,c)?c:o)&&(r[s]=n._replaceShape(a))})},!0)}Ks.$inject=["bpmnReplace","injector"],he(Ks,ee),Ks.prototype._replaceShape=function(e){var t=pC(e),n;return t?n={type:"bpmn:IntermediateCatchEvent",eventDefinitionType:t.$type}:n={type:"bpmn:IntermediateThrowEvent"},this._bpmnReplace.replaceElement(e,n,{layoutConnection:!1})};function pC(e){var t=te(e),n=t.eventDefinitions;return n&&n[0]}function Gm(e,t){return!je(e)&&_(e,"bpmn:BoundaryEvent")&&!t}function fC(e,t){return e.indexOf(t)!==-1}var Xs=Math.round,dC=Math.max;function hC(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 mC(e){var t=[];return e.forEach(function(n,i){t.push([i===0?"M":"L",n.x,n.y])}),t}var Vm=10;function gC(e,t){var n,i;for(n=0;i=e[n];n++)if(ea(i,t)<=Vm)return{point:e[n],bendpoint:!0,index:n};return null}function yC(e,t){var n=Kh(hC(t,Vm),mC(e)),i=n[0],r=n[n.length-1],o;return i?i!==r?i.segment2!==r.segment2?(o=dC(i.segment2,r.segment2)-1,{point:e[o],bendpoint:!0,index:o}):{point:{x:Xs(i.x+r.x)/2,y:Xs(i.y+r.y)/2},index:i.segment2}:{point:{x:Xs(i.x),y:Xs(i.y)},index:i.segment2}:null}function zl(e,t){return gC(e,t)||yC(e,t)}function Gl(e,t,n){ee.call(this,e);function i(r,o,a){var s=o.waypoints,c,u,l,p,f,d,g,h=r.outgoing.slice(),m=r.incoming.slice(),S;De(a.width)?S=Te(a):S=a;var y=zl(s,S);if(y){if(c=s.slice(0,y.index),u=s.slice(y.index+(y.bendpoint?1:0)),!c.length||!u.length)return;l=y.bendpoint?s[y.index]:S,(c.length===1||!Wm(r,c[c.length-1]))&&c.push(Um(l)),(u.length===1||!Wm(r,u[0]))&&u.unshift(Um(l))}p=o.source,f=o.target,t.canConnect(p,r,o)&&(n.reconnectEnd(o,r,c||S),d=o),t.canConnect(r,f,o)&&(d?g=n.connect(r,f,{type:o.type,waypoints:u}):(n.reconnectStart(o,r,u||S),g=o));var x=[].concat(d&&ze(m,function(E){return E.source===d.source})||[],g&&ze(h,function(E){return E.target===g.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=Te(c),l={x:u.x+s.x,y:u.y+s.y},p=ft(o.children,function(f){var d=t.canInsert(a,f);return d&&zl(f.waypoints,l)});p&&(r.targetFlow=p,r.position=l)}},!0),this.postExecuted("elements.move",function(r){var o=r.shapes,a=r.targetFlow,s=r.position;a&&i(o[0],a,s)},!0),this.preExecute("shape.create",function(r){var o=r.parent,a=r.shape;t.canInsert(a,o)&&(r.targetFlow=o,r.parent=o.parent)},!0),this.postExecuted("shape.create",function(r){var o=r.shape,a=r.targetFlow,s=r.position;a&&i(o,a,s)},!0)}he(Gl,ee),Gl.$inject=["eventBus","bpmnRules","modeling"];function Wm(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 Um(e){return j({},e)}function Vl(e,t){ee.call(this,e),this.preExecuted("connection.create",function(n){var i=n.context,r=i.connection,o=i.source,a=i.target,s=i.hints;if(!(s&&s.createElementsBehavior===!1)&&_o(r)){var c=[];_(o,"bpmn:EventBasedGateway")?c=a.incoming.filter(u=>u!==r&&_o(u)):c=a.incoming.filter(u=>u!==r&&_o(u)&&_(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(_(r,"bpmn:EventBasedGateway")){var o=r.outgoing.filter(_o).reduce(function(a,s){return a.includes(s.target)?a:a.concat(s.target)},[]);o.forEach(function(a){a.incoming.filter(_o).forEach(function(s){const c=a.incoming.filter(_o).filter(function(u){return u.source===r});(s.source!==r||c.length>1)&&t.removeConnection(s)})})}})}Vl.$inject=["eventBus","modeling"],he(Vl,ee);function _o(e){return _(e,"bpmn:SequenceFlow")}var Zs=1500,qm=2e3;function Ym(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"],Zs,function(i){var r=i.context,o=r.shape||i.shape,a=i.hover;_(a,"bpmn:Lane")&&!He(o,["bpmn:Lane","bpmn:Participant"])&&(i.hover=Gn(a),i.hoverGfx=e.getGraphics(i.hover));var s=n.getRootElement();a&&a!==s&&(o.labelTarget||He(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"],Zs,function(i){var r=i.hover;_(r,"bpmn:Lane")&&(i.hover=Gn(r)||r,i.hoverGfx=e.getGraphics(i.hover))}),t.on(["bendpoint.move.hover"],Zs,function(i){var r=i.context,o=i.hover,a=r.type;_(o,"bpmn:Lane")&&/reconnect/.test(a)&&(i.hover=Gn(o)||o,i.hoverGfx=e.getGraphics(i.hover))}),t.on(["connect.start"],Zs,function(i){var r=i.context,o=r.start;_(o,"bpmn:Lane")&&(r.start=Gn(o)||o)}),t.on("shape.move.start",qm,function(i){var r=i.shape;_(r,"bpmn:Lane")&&(i.shape=Gn(r)||r)}),t.on("spaceTool.move",qm,function(i){var r=i.hover;r&&_(r,"bpmn:Lane")&&(i.hover=Gn(r))})}Ym.$inject=["elementRegistry","eventBus","canvas"];var Km=770;function Wl(e,t,n,i){n.invoke(ee,this);function r(s,c){var u=te(s),l=c.categoryValue||u.categoryValueRef;l||(l=Im(e,u));var p=c.category||l.$parent||Lm(e);u.categoryValueRef=l,l.$parent=p,c.categoryValue=l,c.category=p}function o(s,c){var u=te(s),l=c.categoryValue||u.categoryValueRef,p=c.category||l&&l.$parent;l&&(c.categoryValue=l,c.category=p,u.categoryValueRef=null)}this.execute("label.create",function(s){var c=s.context,u=c.labelTarget;_(u,"bpmn:Group")&&r(u,c)}),this.revert("label.create",function(s){var c=s.context,u=c.labelTarget;_(u,"bpmn:Group")&&o(u,c)}),this.execute("shape.delete",function(s){var c=s.context,u=c.shape,l=te(u);if(!(!_(u,"bpmn:Group")||u.labelTarget)){var p=c.categoryValue=l.categoryValueRef;p&&(c.category=p.$parent,l.categoryValueRef=null)}}),this.reverted("shape.delete",function(s){var c=s.context,u=c.shape;if(!(!_(u,"bpmn:Group")||u.labelTarget)){var l=c.category,p=c.categoryValue,f=te(u);p&&(f.categoryValueRef=p,p.$parent=l)}}),this.execute("shape.create",function(s){var c=s.context,u=c.shape,l=c.hints||{};!_(u,"bpmn:Group")||u.labelTarget||l.createElementsBehavior===!1&&!te(u).categoryValueRef&&!c.categoryValue||r(u,c)}),this.reverted("shape.create",function(s){var c=s.context,u=c.shape,l=c.hints||{};!_(u,"bpmn:Group")||u.labelTarget||l.createElementsBehavior===!1&&!te(u).categoryValueRef&&!c.categoryValue||o(u,c)}),this.executed(["shape.move","shape.resize"],function(s){var c=s.context,u=c.shape;!_(u,"bpmn:Group")||u.labelTarget||te(u).categoryValueRef||r(u,c)}),this.reverted(["shape.move","shape.resize"],function(s){var c=s.context,u=c.shape;!_(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",Km,function(s){var c=s.descriptor,u=s.element;if(!(!_(u,"bpmn:Group")||u.labelTarget)){var l=te(u);if(l.categoryValueRef){var p=l.categoryValueRef;c.categoryValue=a(p,!0),p.$parent&&(c.category=a(p.$parent,!0))}}}),t.on("copyPaste.pasteElement",Km,function(s){var c=s.descriptor,u=c.businessObject,l=c.categoryValue,p=c.category;l&&(l=u.categoryValueRef=a(l)),p&&(l.$parent=a(p)),delete c.category,delete c.categoryValue})}Wl.$inject=["bpmnFactory","eventBus","injector","moddleCopy"],he(Wl,ee);function Ul(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 Xm(e){function t(i,r,o){var a={x:o.x,y:o.y-50},s={x:o.x-50,y:o.y},c=Ul(i,r,o,a),u=Ul(i,r,o,s),l;c&&u?Zm(c,o)>Zm(u,o)?l=u:l=c:l=c||u,i.original=l}function n(i){var r=i.waypoints;t(r[0],r[1],Te(i.source)),t(r[r.length-1],r[r.length-2],Te(i.target))}e.on("bpmnElement.added",function(i){var r=i.element;r.waypoints&&n(r)})}Xm.$inject=["eventBus"];function Zm(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function ql(e){ee.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=te(i),o=Ke(i);if(He(r,t)){var a=o.get("isHorizontal");a===void 0&&(a=!0),o.set("isHorizontal",a)}})}ql.$inject=["eventBus"],he(ql,ee);function Qm(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}function Jm(e){return Math.atan((e[1].y-e[0].y)/(e[1].x-e[0].x))}function vC(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 bC(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 Yl(e,t){var n=t[0],i=t[1],r={x:i.x-n.x,y:i.y-n.y},o=bC([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 eg(e,t){var n=Yl(e,t),i={x:n.x-e.x,y:n.y-e.y};return Qm(i)}function pa(e,t){return Qm({x:e.x-t.x,y:e.y-t.y})}var tg=Math.sqrt,ng=Math.min,_C=Math.max,ig=Math.abs;function rg(e){return Math.pow(e,2)}function fa(e,t){return tg(rg(e.x-t.x)+rg(e.y-t.y))}function xC(e,t){var n=0,i,r,o,a,s,c,u,l,p,f,d;for(n=0;n<t.length-1;n++){if(i=t[n],r=t[n+1],ag(i,r)?u=[i]:(o=fa(e,i),a=fa(e,r),c=ng(o,a),u=wC(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:ag(i,u[0])?n:n+1}),u.length===2&&(s=SC(u[0],u[1]),l={type:"segment",position:s,segmentIndex:n,relativeLocation:fa(i,s)/fa(i,r)}),p=fa(l.position,e),(!d||f>p)&&(d=l,f=p)}return d}function wC(e,t,n,i){var r=t.x-e.x,o=t.y-e.y,a=n.x-e.x,s=n.y-e.y,c=r*r+o*o,u=r*a+o*s,l=a*a+s*s-i*i,p=u/c,f=l/c,d=p*p-f;if(d<0&&d>-1e-6&&(d=0),d<0)return[];var g=tg(d),h=-p+g,m=-p-g,S={x:e.x-r*h,y:e.y-o*h};if(d===0)return[S];var y={x:e.x-r*m,y:e.y-o*m};return[S,y].filter(function(x){return EC(x,e,t)})}function EC(e,t,n){return og(e.x,t.x,n.x)&&og(e.y,t.y,n.y)}function og(e,t,n){return e>=ng(t,n)-Qs&&e<=_C(t,n)+Qs}function SC(e,t){return{x:(e.x+t.x)/2,y:(e.y+t.y)/2}}var Qs=.1;function ag(e,t){return ig(e.x-t.x)<=Qs&&ig(e.y-t.y)<=Qs}function RC(e,t,n,i){var r=n.segmentIndex,o=t.length-e.length;if(i.segmentMove){var a=i.segmentMove.segmentStartIndex,s=i.segmentMove.newSegmentStartIndex;return r===a?s:r>=s?r+o<s?s:r+o:r}if(i.bendpointMove){var c=i.bendpointMove.insert,u=i.bendpointMove.bendpointIndex,l;if(o===0)return r;if(r>=u&&(l=c?r+1:r-1),r<u&&(l=r,c&&n.type!=="bendpoint"&&u-1===r)){var p=cg(t,u);p<n.relativeLocation&&l++}return l}return o===0?r:i.connectionStart&&r===0?0:i.connectionEnd&&r===e.length-2?t.length-2:Math.floor((t.length-2)/2)}function sg(e,t,n,i){var r=0,o=0,a={point:e,delta:{x:0,y:0}},s=xC(e,n),c=s.segmentIndex,u=RC(n,t,s,i);if(u<0||u>t.length-2||u===null)return a;var l=ug(n,c),p=ug(t,u),f=s.position,d=PC(l,f),g=CC(l,p);if(s.type==="bendpoint"){var h=t.length-n.length,m=s.bendpointIndex,S=n[m];if(t.indexOf(S)!==-1)return a;if(h===0){var y=t[m];return r=y.x-s.position.x,o=y.y-s.position.y,{delta:{x:r,y:o},point:{x:e.x+r,y:e.y+o}}}h<0&&m!==0&&m<n.length-1&&(d=cg(n,m))}var x={x:(p[1].x-p[0].x)*d+p[0].x,y:(p[1].y-p[0].y)*d+p[0].y},E=vC({x:e.x-f.x,y:e.y-f.y},g);return r=x.x+E.x-e.x,o=x.y+E.y-e.y,{point:Di(x),delta:Di({x:r,y:o})}}function cg(e,t){var n=pa(e[t-1],e[t]),i=pa(e[t],e[t+1]),r=n/(n+i);return r}function CC(e,t){var n=Jm(e),i=Jm(t);return i-n}function ug(e,t){return[e[t],e[t+1]]}function PC(e,t){var n=pa(e[0],e[1]),i=pa(e[0],t);return n===0?0:i/n}function AC(e,t,n,i){var r=Te(e);return sg(r,t,n,i).delta}function da(e,t,n){var i=ca(t),r=ca(n),o=ni(e,i),a={x:o.x*(n.width/t.width),y:o.y*(n.height/t.height)};return Di({x:r.x+a.x,y:r.y+a.y})}function lg(e,t,n){var i=ca(e),r=ca(t),o=ca(n),a=ni(e,i),s=ni(i,r),c=TC(i,t,n);if(c)return c;var u={x:s.x*(n.width/t.width),y:s.y*(n.height/t.height)},l={x:o.x+u.x,y:o.y+u.y};return Di({x:l.x+a.x-e.x,y:l.y+a.y-e.y})}function TC(e,t,n){var i=Re(t),r=Re(n);if(MC(i,r))return null;var o=nn(t,e),a,s,c;if(o==="top")a={x:0,y:r.bottom-i.bottom};else if(o==="bottom")a={x:0,y:r.top-i.top};else if(o==="right")a={x:r.left-i.left,y:0};else if(o==="left")a={x:r.right-i.right,y:0};else return null;return s={x:e.x+a.x,y:e.y+a.y},c=nn(n,s),c!==o?null:a}function MC(e,t){return kC(e,t)||OC(e,t)}function kC(e,t){return e.right!==t.right&&e.left!==t.left}function OC(e,t){return e.top!==t.top&&e.bottom!==t.bottom}var pg="name",fg="text";function Kl(e,t,n,i){ee.call(this,e),this.postExecute("element.updateProperties",r),this.postExecute("element.updateModdleProperties",a=>{te(a.context.element)===a.context.moddleElement&&r(a)});function r(a){var s=a.context,c=s.element,u=s.properties;if(pg in u&&t.updateLabel(c,u[pg]),fg in u&&_(c,"bpmn:TextAnnotation")){var l=i.getTextAnnotationBounds({x:c.x,y:c.y,width:c.width,height:c.height},u[fg]||"");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;je(u)||!or(u)||Bn(u)&&t.updateLabel(u,Bn(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),p=s.newWaypoints||c.waypoints,f=s.oldWaypoints;return typeof l.startChanged>"u"&&(l.startChanged=!!l.connectionStart),typeof l.endChanged>"u"&&(l.endChanged=!!l.connectionEnd),AC(u,p,f,l)}this.postExecute(["connection.layout","connection.updateWaypoints"],function(a){var s=a.context,c=s.hints||{};if(c.labelBehavior!==!1){var u=s.connection,l=u.label,p;!l||!l.parent||(p=o(a),t.moveShape(l,p))}}),this.postExecute(["shape.replace"],function(a){var s=a.context,c=s.newShape,u=s.oldShape,l=te(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(!(!je(c)||u.autoResize)){var l=s.newBounds,p=i.getDimensions(Bn(c)||"",{box:l,style:i.getExternalStyle()}),f=Math.ceil(p.height),d=l.y!==c.y,g=c.y+c.height;s.newBounds={width:l.width,height:f,x:l.x,y:d?g-f:l.y}}}),this.postExecute("shape.resize",function(a){var s=a.context,c=s.shape,u=s.newBounds,l=s.oldBounds;if(Is(c)){var p=c.label,f=Te(p),d=IC(l),g=LC(f,d),h=DC(g,l,u);t.moveShape(p,h)}})}he(Kl,ee),Kl.$inject=["eventBus","modeling","bpmnFactory","textRenderer"];function DC(e,t,n){var i=da(e,t,n);return Di(ni(i,e))}function LC(e,t){if(t.length){var n=BC(e,t);return Yl(e,n)}}function IC(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:eg(e,r)}}),i=oi(n,"distance");return i[0].line}function NC(e,t,n,i){return sg(e,t,n,i).point}function Xl(e,t){ee.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),NC(r,c,u,s)}this.postExecute(["connection.layout","connection.updateWaypoints"],function(i){var r=i.context,o=r.connection,a=o.outgoing,s=o.incoming;s.forEach(function(c){var u=c.waypoints[c.waypoints.length-1],l=n(i,u),p=[].concat(c.waypoints.slice(0,-1),[l]);t.updateWaypoints(c,p)}),a.forEach(function(c){var u=c.waypoints[0],l=n(i,u),p=[].concat([l],c.waypoints.slice(1));t.updateWaypoints(c,p)})}),this.postExecute(["connection.move"],function(i){var r=i.context,o=r.connection,a=o.outgoing,s=o.incoming,c=r.delta;s.forEach(function(u){var l=u.waypoints[u.waypoints.length-1],p={x:l.x+c.x,y:l.y+c.y},f=[].concat(u.waypoints.slice(0,-1),[p]);t.updateWaypoints(u,f)}),a.forEach(function(u){var l=u.waypoints[0],p={x:l.x+c.x,y:l.y+c.y},f=[].concat([p],u.waypoints.slice(1));t.updateWaypoints(u,f)})})}he(Xl,ee),Xl.$inject=["eventBus","modeling"];function Js(e,t,n){var i=tc(e),r=hg(i,t),o=i[0];return r.length?r[r.length-1]:da(o.original||o,n,t)}function ec(e,t,n){var i=tc(e),r=hg(i,t),o=i[i.length-1];return r.length?r[0]:da(o.original||o,n,t)}function Zl(e,t,n){var i=tc(e),r=dg(t,n),o=i[0];return da(o.original||o,r,t)}function Ql(e,t,n){var i=tc(e),r=dg(t,n),o=i[i.length-1];return da(o.original||o,r,t)}function dg(e,t){return{x:e.x-t.x,y:e.y-t.y,width:e.width,height:e.height}}function tc(e){var t=e.waypoints;if(!t.length)throw new Error("connection#"+e.id+": no waypoints");return t}function hg(e,t){var n=cn(e,jC);return ze(n,function(i){return $C(i,t)})}function $C(e,t){return nn(t,e,1)==="intersect"}function jC(e){return e.original||e}function Jl(e,t){ee.call(this,e),this.postExecute("shape.replace",function(n){var i=n.oldShape,r=n.newShape;if(FC(i,r)){var o=HC(i);o.incoming.forEach(function(a){var s=ec(a,r,i);t.reconnectEnd(a,r,s)}),o.outgoing.forEach(function(a){var s=Js(a,r,i);t.reconnectStart(a,r,s)})}},!0)}Jl.$inject=["eventBus","modeling"],he(Jl,ee);function FC(e,t){return _(e,"bpmn:Participant")&&qe(e)&&_(t,"bpmn:Participant")&&!qe(t)}function HC(e){var t=Qo([e]),n=[],i=[];return t.forEach(function(r){r!==e&&(r.incoming.forEach(function(o){_(o,"bpmn:MessageFlow")&&n.push(o)}),r.outgoing.forEach(function(o){_(o,"bpmn:MessageFlow")&&i.push(o)}))},[]),{incoming:n,outgoing:i}}const zC=["bpmn:MessageEventDefinition","bpmn:TimerEventDefinition","bpmn:EscalationEventDefinition","bpmn:ConditionalEventDefinition","bpmn:SignalEventDefinition"];function mg(e){const t=te(e);if(!_(t,"bpmn:BoundaryEvent")&&!(_(t,"bpmn:StartEvent")&&fn(t.$parent)))return!1;const n=t.get("eventDefinitions");return!n||!n.length?!1:zC.some(i=>_(n[0],i))}function gg(e){return _(e,"bpmn:BoundaryEvent")?"cancelActivity":"isInterrupting"}function ep(e,t){e.invoke(ee,this),this.postExecuted("shape.replace",function(n){const i=n.context.oldShape,r=n.context.newShape,o=n.context.hints;if(!mg(r))return;const a=gg(r);if(o.targetElement&&o.targetElement[a]!==void 0)return;const c=te(i).get(a),u=te(r).get(a);c!==u&&t.updateProperties(r,{[a]:c})})}ep.$inject=["injector","modeling"],he(ep,ee);function tp(e,t){ee.call(this,e),this.preExecute("shape.resize",function(n){var i=n.shape,r=Ke(i),o=r&&r.get("label"),a=o&&o.get("bounds");a&&t.updateModdleProperties(i,o,{bounds:void 0})},!0)}he(tp,ee),tp.$inject=["eventBus","modeling"];function np(e,t,n){ee.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(!(!_(o,"bpmn:SequenceFlow")||!_(a,"bpmn:SequenceFlow"))&&t.canConnect(o.source,a.target,o)){var s=GC(o.waypoints,a.waypoints);n.reconnectEnd(o,a.target,s)}}})}he(np,ee),np.$inject=["eventBus","bpmnRules","modeling"];function xo(e){return e.original||e}function GC(e,t){var n=Ul(xo(e[e.length-2]),xo(e[e.length-1]),xo(t[1]),xo(t[0]));return n?[].concat(e.slice(0,e.length-1),[n],t.slice(1)):[xo(e[0]),xo(t[t.length-1])]}function ip(e,t){ee.call(this,e),this.preExecute("shape.delete",function(n){var i=n.shape,r=i.parent;_(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)}ip.$inject=["eventBus","modeling"],he(ip,ee);function rp(e,t,n,i){ee.call(this,e);var r=i.get("dragging",!1);function o(c){var u=c.source,l=c.target,p=c.parent;if(p){var f,d;_(c,"bpmn:SequenceFlow")&&(n.canConnectSequenceFlow(u,l)||(d=!0),n.canConnectMessageFlow(u,l)&&(f="bpmn:MessageFlow")),_(c,"bpmn:MessageFlow")&&(n.canConnectMessageFlow(u,l)||(d=!0),n.canConnectSequenceFlow(u,l)&&(f="bpmn:SequenceFlow")),d&&t.removeConnection(c),f&&t.connect(u,l,{type:f,waypoints:c.waypoints.slice()})}}function a(c){var u=c.context,l=u.connection,p=u.newSource||l.source,f=u.newTarget||l.target,d,g;d=n.canConnect(p,f),!(!d||d.type===l.type)&&(g=t.connect(p,f,{type:d.type,associationDirection:d.associationDirection,waypoints:l.waypoints.slice()}),l.parent&&t.removeConnection(l),u.connection=g,r&&s(l,g))}function s(c,u){var l=r.context(),p=l&&l.payload.previousSelection,f;!p||!p.length||(f=p.indexOf(c),f!==-1&&p.splice(f,1,u))}this.postExecuted("elements.move",function(c){var u=c.closure,l=u.allConnections;L(l,o)},!0),this.preExecute("connection.reconnect",a),this.postExecuted("element.updateProperties",function(c){var u=c.context,l=u.properties,p=u.element,f=p.businessObject,d;l.default&&(d=ft(p.outgoing,io({id:p.businessObject.default.id})),d&&t.updateProperties(d,{conditionExpression:void 0})),l.conditionExpression&&f.sourceRef.default===f&&t.updateProperties(p.source,{default:void 0})})}he(rp,ee),rp.$inject=["eventBus","modeling","bpmnRules","injector"];function nc(e,t,n,i,r,o){i.invoke(ee,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=En(u,function(p,f){var d=t.canReplace([f],f.host||f.parent||c);return d?p.concat(d.replacements):p},[]);l.length&&this._replaceElements(u,l)},this),this.postExecuted(["elements.move"],500,function(a){var s=a.context,c=s.newParent,u=s.newHost,l=[];L(s.closure.topLevel,function(f){fn(f)?l=l.concat(f.children):l=l.concat(f)}),l.length===1&&u&&(c=u);var p=t.canReplace(l,c);p&&this._replaceElements(l,p.replacements,u)},this),this.postExecute(["shape.replace"],1500,function(a){var s=a.context,c=s.oldShape,u=s.newShape,l=c.attachers,p;l&&l.length&&(p=t.canReplace(l,u),this._replaceElements(l,p.replacements))},this),this.postExecuted(["shape.replace"],1500,function(a){var s=a.context,c=s.oldShape,u=s.newShape;r.unclaimId(c.businessObject.id,c.businessObject),r.updateProperties(u,{id:c.id})})}he(nc,ee),nc.prototype._replaceElements=function(e,t){var n=this._elementRegistry,i=this._bpmnReplace,r=this._selection;L(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)},nc.$inject=["bpmnReplace","bpmnRules","elementRegistry","injector","modeling","selection"];var VC=1500,WC={width:140,height:120},op={width:300,height:60},ap={width:60,height:300},ic={width:300,height:150},rc={width:150,height:300},yg={width:140,height:120},vg={width:100,height:40};function bg(e){e.on("resize.start",VC,function(t){var n=t.context,i=n.shape,r=n.direction,o=n.balanced;(_(i,"bpmn:Lane")||_(i,"bpmn:Participant"))&&(n.resizeConstraints=XC(i,r,o)),_(i,"bpmn:SubProcess")&&qe(i)&&(n.minDimensions=yg),_(i,"bpmn:TextAnnotation")&&(n.minDimensions=vg)})}bg.$inject=["eventBus"];var cr=Math.abs,UC=Math.min,qC=Math.max;function _g(e,t,n,i){var r=e[t];e[t]=r===void 0?n:i(n,r)}function wo(e,t,n){return _g(e,t,n,UC)}function Eo(e,t,n){return _g(e,t,n,qC)}var YC={top:20,left:50,right:20,bottom:20},KC={top:50,left:20,right:20,bottom:20};function XC(e,t,n){var i=Gn(e),r=!0,o=!0,a=Ys(i,[i]),s=Re(e),c={},u={},l=Zt(e),p=l?op:ap;/n/.test(t)?u.top=s.bottom-p.height:/e/.test(t)?u.right=s.left+p.width:/s/.test(t)?u.bottom=s.top+p.height:/w/.test(t)&&(u.left=s.right-p.width),a.forEach(function(g){var h=Re(g);l?(h.top<s.top-10&&(r=!1),h.bottom>s.bottom+10&&(o=!1)):(h.left<s.left-10&&(r=!1),h.right>s.right+10&&(o=!1)),/n/.test(t)&&(n&&cr(s.top-h.bottom)<10&&Eo(c,"top",h.top+p.height),cr(s.top-h.top)<5&&wo(u,"top",h.bottom-p.height)),/e/.test(t)&&(n&&cr(s.right-h.left)<10&&wo(c,"right",h.right-p.width),cr(s.right-h.right)<5&&Eo(u,"right",h.left+p.width)),/s/.test(t)&&(n&&cr(s.bottom-h.top)<10&&wo(c,"bottom",h.bottom-p.height),cr(s.bottom-h.bottom)<5&&Eo(u,"bottom",h.top+p.height)),/w/.test(t)&&(n&&cr(s.left-h.right)<10&&Eo(c,"left",h.left+p.width),cr(s.left-h.left)<5&&wo(u,"left",h.right-p.width))});var f=i.children.filter(function(g){return!g.hidden&&!g.waypoints&&(_(g,"bpmn:FlowElement")||_(g,"bpmn:Artifact"))}),d=l?YC:KC;return f.forEach(function(g){var h=Re(g);/n/.test(t)&&(!l||r)&&wo(u,"top",h.top-d.top),/e/.test(t)&&(l||o)&&Eo(u,"right",h.right+d.right),/s/.test(t)&&(!l||o)&&Eo(u,"bottom",h.bottom+d.bottom),/w/.test(t)&&(l||r)&&wo(u,"left",h.left-d.left)}),{min:u,max:c}}function xg(e){!e||typeof e.stopPropagation!="function"||e.stopPropagation()}function So(e){return e.originalEvent||e.srcEvent}function sp(e){xg(e),xg(So(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 wg(){return/mac/i.test(navigator.platform)}function Eg(e,t){return(So(e)||e).button===t}function ur(e){return Eg(e,0)}function ZC(e){return Eg(e,1)}function ha(e){var t=So(e)||e;return ur(e)?wg()?t.metaKey:t.ctrlKey:!1}function oc(e){var t=So(e)||e;return ur(e)&&t.shiftKey}var Sg=1001;function Rg(e,t){e.on("resize.start",Sg+500,function(n){var i=n.context,r=i.shape;(_(r,"bpmn:Lane")||_(r,"bpmn:Participant"))&&(i.balanced=!ha(n))}),e.on("resize.end",Sg,function(n){var i=n.context,r=i.shape,o=i.canExecute,a=i.newBounds;if(_(r,"bpmn:Lane")||_(r,"bpmn:Participant"))return o&&(a=em(a),t.resizeLane(r,a,i.balanced)),!1})}Rg.$inject=["eventBus","modeling"];var QC=500;function cp(e,t,n,i,r){n.invoke(ee,this);function o(l){return He(l,["bpmn:ReceiveTask","bpmn:SendTask"])||JC(l,["bpmn:ErrorEventDefinition","bpmn:EscalationEventDefinition","bpmn:MessageEventDefinition","bpmn:SignalEventDefinition"])}function a(l){var p=e.getDefinitions(),f=p.get("rootElements");return!!ft(f,io({id:l.id}))}function s(l){if(_(l,"bpmn:ErrorEventDefinition"))return"errorRef";if(_(l,"bpmn:EscalationEventDefinition"))return"escalationRef";if(_(l,"bpmn:MessageEventDefinition"))return"messageRef";if(_(l,"bpmn:SignalEventDefinition"))return"signalRef"}function c(l){if(He(l,["bpmn:ReceiveTask","bpmn:SendTask"]))return l.get("messageRef");var p=l.get("eventDefinitions"),f=p[0];return f.get(s(f))}function u(l,p){if(He(l,["bpmn:ReceiveTask","bpmn:SendTask"]))return l.set("messageRef",p);var f=l.get("eventDefinitions"),d=f[0];return d.set(s(d),p)}this.executed(["shape.create","element.updateProperties","element.updateModdleProperties"],function(l){var p=l.shape||l.element;if(o(p)){var f=te(p),d=c(f),g;d&&!a(d)&&(g=e.getDefinitions().get("rootElements"),Ct(g,d),l.addedRootElement=d)}},!0),this.reverted(["shape.create","element.updateProperties","element.updateModdleProperties"],function(l){var p=l.addedRootElement;if(p){var f=e.getDefinitions().get("rootElements");St(f,p)}},!0),t.on("copyPaste.copyElement",function(l){var p=l.descriptor,f=l.element;if(!(f.labelTarget||!o(f))){var d=te(f),g=c(d);g&&(p.referencedRootElement=g)}}),t.on("copyPaste.pasteElement",QC,function(l){var p=l.descriptor,f=p.businessObject,d=p.referencedRootElement;d&&(a(d)||(d=i.copyElement(d,r.create(d.$type))),u(f,d),delete p.referencedRootElement)})}cp.$inject=["bpmnjs","eventBus","injector","moddleCopy","bpmnFactory"],he(cp,ee);function JC(e,t){return Ae(t)||(t=[t]),Yi(t,function(n){return mo(e,n)})}var Cg=Math.max;function Pg(e){e.on("spaceTool.getMinDimensions",function(t){var n=t.shapes,i=t.axis,r=t.start,o={};return L(n,function(a){var s=a.id;_(a,"bpmn:Participant")&&(o[s]=tP(a,i,r)),_(a,"bpmn:Lane")&&(o[s]=Zt(a)?op:ap),_(a,"bpmn:SubProcess")&&qe(a)&&(o[s]=yg),_(a,"bpmn:TextAnnotation")&&(o[s]=vg),_(a,"bpmn:Group")&&(o[s]=WC)}),o})}Pg.$inject=["eventBus"];function eP(e){return e==="x"}function tP(e,t,n){var i=Zt(e);if(!rP(e))return i?ic:rc;var r=eP(t),o={};return r?i?o=ic:o={width:iP(e,n,r),height:rc.height}:i?o={width:ic.width,height:nP(e,n,r)}:o=rc,o}function nP(e,t,n){var i;return i=oP(e,t,n),Cg(ic.height,i)}function iP(e,t,n){var i;return i=aP(e,t,n),Cg(rc.width,i)}function rP(e){return!!sr(e).length}function oP(e,t,n){var i=sr(e),r;return r=up(i,t,n),e.height-r.height+op.height}function aP(e,t,n){var i=sr(e),r;return r=up(i,t,n),e.width-r.width+ap.width}function up(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?up(o,t,n):r}var Ag="_plane";function Tg(e){var t=e.id;return sP(t)}function gi(e){var t=e.id;return _(e,"bpmn:SubProcess")?Mg(t):t}function jr(e){return Mg(e)}function ac(e){var t=Ke(e);return _(t,"bpmndi:BPMNPlane")}function Mg(e){return e+Ag}function sP(e){return e.replace(new RegExp(Ag+"$"),"")}var kg=400,cP=600,Og={x:180,y:160};function Ni(e,t,n,i,r,o,a){ee.call(this,t),this._canvas=e,this._eventBus=t,this._modeling=n,this._elementFactory=i,this._bpmnFactory=r,this._bpmnjs=o,this._elementRegistry=a;var s=this;function c(p){return _(p,"bpmn:SubProcess")&&!qe(p)}function u(p){var f=p.shape,d=p.newRootElement,g=te(f);d=s._addDiagram(d||g),p.newRootElement=e.addRootElement(d)}function l(p){var f=p.shape,d=te(f);s._removeDiagram(d);var g=p.newRootElement=a.get(gi(d));e.removeRootElement(g)}this.executed("shape.create",function(p){var f=p.shape;c(f)&&u(p)},!0),this.postExecuted("elements.create",function(p){var f=p.elements;L(f,function(d){if(c(d)){var g=a.get(gi(d));if(!(!g||!d.children||!d.children.length)){var h=Dg(d);s._showRecursively(h),s._moveChildrenToShape(h,g)}}})},!0),this.reverted("shape.create",function(p){var f=p.shape;c(f)&&l(p)},!0),this.preExecute("shape.delete",function(p){var f=p.shape;!_(f,"bpmn:SubProcess")||!qe(f)||L(ra([f]),d=>{n.removeShape(d.annotation)})},!0),this.preExecuted("shape.delete",function(p){var f=p.shape;if(c(f)){var d=a.get(gi(f));d&&n.removeElements(d.children.slice())}},!0),this.executed("shape.delete",function(p){var f=p.shape;c(f)&&l(p)},!0),this.reverted("shape.delete",function(p){var f=p.shape;c(f)&&u(p)},!0),this.preExecuted("shape.replace",function(p){var f=p.oldShape,d=p.newShape;!c(f)||!c(d)||(p.oldRoot=e.removeRootElement(gi(f)))},!0),this.postExecuted("shape.replace",function(p){var f=p.newShape,d=p.oldRoot,g=e.findRoot(gi(f));if(!(!d||!g)){var h=d.children;n.moveElements(h,{x:0,y:0},g)}},!0),this.executed("element.updateProperties",function(p){var f=p.element;if(_(f,"bpmn:SubProcess")){var d=p.properties,g=p.oldProperties,h=g.id,m=d.id;if(h!==m){if(ac(f)){a.updateId(f,jr(m)),a.updateId(h,m);return}var S=a.get(jr(h));S&&a.updateId(jr(h),jr(m))}}},!0),this.reverted("element.updateProperties",function(p){var f=p.element;if(_(f,"bpmn:SubProcess")){var d=p.properties,g=p.oldProperties,h=g.id,m=d.id;if(h!==m){if(ac(f)){a.updateId(f,jr(h)),a.updateId(m,h);return}var S=a.get(jr(m));S&&a.updateId(S,jr(h))}}},!0),t.on("element.changed",function(p){var f=p.element;if(ac(f)){var d=f,g=a.get(Tg(d));!g||g===d||t.fire("element.changed",{element:g})}}),this.executed("shape.toggleCollapse",kg,function(p){var f=p.shape;_(f,"bpmn:SubProcess")&&(qe(f)?l(p):(u(p),s._showRecursively(f.children)))},!0),this.reverted("shape.toggleCollapse",kg,function(p){var f=p.shape;_(f,"bpmn:SubProcess")&&(qe(f)?l(p):(u(p),s._showRecursively(f.children)))},!0),this.postExecuted("shape.toggleCollapse",cP,function(p){var f=p.shape;if(_(f,"bpmn:SubProcess")){var d=p.newRootElement;if(d)if(qe(f))s._moveChildrenToShape(d.children.slice(),f),L(ra(f.children),h=>{n.moveShape(h.annotation,{x:0,y:0},f.parent),L(h.associations,m=>{n.moveConnection(m,{x:0,y:0},f.parent)})});else{s._disconnectSharedAnnotations(f);var g=Dg(f);s._moveChildrenToShape(g,d)}}},!0),t.on("copyPaste.createTree",function(p){var f=p.element,d=p.children;if(c(f)){var g=gi(f),h=a.get(g);h&&d.push.apply(d,h.children)}}),t.on("copyPaste.copyElement",function(p){var f=p.descriptor,d=p.element,g=p.elements,h=d.parent,m=_(Ke(h),"bpmndi:BPMNPlane");if(m){var S=Tg(h),y=ft(g,function(x){return x.id===S});y&&(f.parent=y.id)}}),t.on("copyPaste.pasteElement",function(p){var f=p.descriptor;f.parent&&(c(f.parent)||f.parent.hidden)&&(f.hidden=!0)})}he(Ni,ee),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=Ot(i),o;if(!t.x)o={x:Og.x-r.x,y:Og.y-r.y};else{var a=Te(t),s=Te(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(Em(e).map(i=>i.annotation));n.size&&L(ra(e.children),i=>{n.has(i.annotation)&&L(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:gi(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 uP(e){var t=[];return L(ra(e),n=>{t.push(n.annotation),t.push.apply(t,n.associations)}),t}function Dg(e){return e.children.slice().concat(uP(e.children)).concat(lP(e))}function lP(e){return hl(e.children||[]).reduce(function(t,n){return n.label&&n.label.parent!==e&&t.push(n.label),t},[])}function lp(e,t){e.invoke(ee,this),this.postExecuted("shape.replace",function(n){var i=n.context.oldShape,r=n.context.newShape;if(!(!_(r,"bpmn:SubProcess")||_(r,"bpmn:AdHocSubProcess")||!(_(i,"bpmn:Task")||_(i,"bpmn:CallActivity"))||!qe(r))){var o=pP(r);t.createShape({type:"bpmn:StartEvent"},o,r)}})}lp.$inject=["injector","modeling"],he(lp,ee);function pP(e){return{x:e.x+e.width/6,y:e.y+e.height/2}}function pp(e,t){ee.call(this,e),this.preExecute("connection.create",function(n){const{target:i}=n;_(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&&_(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(!(!_(r,"bpmn:TextAnnotation")||o.autoResize)){var a=i.newBounds,s=t.getTextAnnotationBounds(a,Bn(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}}})}he(pp,ee),pp.$inject=["eventBus","textRenderer"];function fp(e,t){ee.call(this,e),this.postExecuted("shape.toggleCollapse",1500,function(n){var i=n.shape;if(qe(i))return;var r=Qo(i);r.forEach(function(a){var s=a.incoming.slice(),c=a.outgoing.slice();L(s,function(u){o(u,!0)}),L(c,function(u){o(u,!1)})});function o(a,s){r.indexOf(a.source)!==-1&&r.indexOf(a.target)!==-1||_(a,"bpmn:Association")&&(_(a.source,"bpmn:TextAnnotation")||_(a.target,"bpmn:TextAnnotation"))||(s?t.reconnectEnd(a,i,Te(i)):t.reconnectStart(a,i,Te(i)))}},!0)}he(fp,ee),fp.$inject=["eventBus","modeling"];var dp=500;function hp(e,t,n){ee.call(this,e);function i(a){a.length&&a.forEach(function(s){s.type==="label"&&!s.businessObject.name&&(s.hidden=!0)})}function r(a,s){var c=a.children,u=s,l,p;return l=fP(c).concat([a]),p=Hm(l),p?(u.width=Math.max(p.width,u.width),u.height=Math.max(p.height,u.height),u.x=p.x+(p.width-u.width)/2,u.y=p.y+(p.height-u.height)/2):(u.x=a.x+(a.width-u.width)/2,u.y=a.y+(a.height-u.height)/2),u}function o(a,s){return{x:a.x+(a.width-s.width)/2,y:a.y+(a.height-s.height)/2,width:s.width,height:s.height}}this.executed(["shape.toggleCollapse"],dp,function(a){var s=a.context,c=s.shape;_(c,"bpmn:SubProcess")&&(c.collapsed?Ke(c).isExpanded=!1:(i(c.children),Ke(c).isExpanded=!0))}),this.reverted(["shape.toggleCollapse"],dp,function(a){var s=a.context,c=s.shape;c.collapsed?Ke(c).isExpanded=!1:Ke(c).isExpanded=!0}),this.postExecuted(["shape.toggleCollapse"],dp,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"})})}he(hp,ee),hp.$inject=["eventBus","elementFactory","modeling"];function fP(e){return e.filter(function(t){return!t.hidden})}function mp(e,t,n,i){t.invoke(ee,this),this.preExecute("shape.delete",function(r){var o=r.context,a=o.shape,s=a.businessObject;je(a)||(_(a,"bpmn:Participant")&&qe(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;_(r,"bpmn:Collaboration")&&n.ids.unclaim(o.id)})}he(mp,ee),mp.$inject=["canvas","injector","moddle","modeling"];function gp(e,t){ee.call(this,e),this.preExecute("connection.delete",function(n){var i=n.context,r=i.connection,o=r.source;dP(r,o)&&t.updateProperties(o,{default:null})})}he(gp,ee),gp.$inject=["eventBus","modeling"];function dP(e,t){if(!_(e,"bpmn:SequenceFlow"))return!1;var n=te(t),i=te(e);return n.get("default")===i}var hP=500,mP=5e3,Lg=["shape.create","shape.delete","shape.move","shape.resize"],Ig=[...Lg,"spaceTool","lane.add","lane.resize","lane.split","elements.create","elements.delete","elements.move"];function yp(e,t){ee.call(this,e);var n;function i(){return n=n||new gP,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(Ig,mP,function(){i()}),this.postExecuted(Ig,hP,function(){o()}),this.preExecute(Lg,function(a){var s=a.context,c=s.shape,u=r();!c||c.labelTarget||(_(c,"bpmn:Lane")&&u.addLane(c),_(c,"bpmn:FlowNode")&&u.addFlowNode(c))})}yp.$inject=["eventBus","modeling"],he(yp,ee);function gP(){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 yP=500,vP=5e3,Bg=["connection.create","connection.delete","connection.layout","connection.move","connection.reconnect","connection.updateWaypoints","shape.create","shape.delete","shape.move","shape.resize"],Ng=[...Bg,"elements.create","elements.delete","elements.move","label.create","spaceTool"];function vp(e,t){ee.call(this,e);var n;function i(){return n=n||new bP,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(Ng,vP,function(){i()}),this.postExecuted(Ng,yP,function(){o()}),this.preExecute(Bg,function(a){var s=a.context.connection||a.context.shape,c=r();!s||s.labelTarget||(_(s,"bpmn:FlowElement")&&c.addFlowElement(s),_(s,"bpmn:Group")&&c.addGroup(s))}),this.preExecute("label.create",function(a){var s=a.context.labelTarget;_(s,"bpmn:Group")&&r().addGroup(s)})}vp.$inject=["eventBus","modeling"],he(vp,ee);function bP(){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 bp(e,t){ee.call(this,e),this.postExecuted("elements.create",function(n){const i=n.context,r=i.elements;for(const o of r)_P(o)&&!wP(o)&&t.updateProperties(o,{isForCompensation:void 0})})}he(bp,ee),bp.$inject=["eventBus","modeling"];function _P(e){const t=te(e);return t&&t.isForCompensation}function xP(e){return e&&_(e,"bpmn:BoundaryEvent")&&mo(e,"bpmn:CompensateEventDefinition")}function wP(e){return e.incoming.filter(n=>xP(n.source)).length>0}const EP={__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",Pl],appendBehavior:["type",Al],associationBehavior:["type",Ml],attachEventBehavior:["type",Hs],artifactBehavior:["type",Tl],boundaryEventBehavior:["type",kl],categoryRootElementReferenceBehavior:["type",Ol],compensateBoundaryEventBehaviour:["type",Dl],createBehavior:["type",Ll],createDataObjectBehavior:["type",Il],createParticipantBehavior:["type",$l],dataInputAssociationBehavior:["type",jl],dataStoreBehavior:["type",Fl],deleteLaneBehavior:["type",Hl],detachEventBehavior:["type",Ks],dropOnFlowBehavior:["type",Gl],eventBasedGatewayBehavior:["type",Vl],fixHoverBehavior:["type",Ym],groupBehavior:["type",Wl],importDockingFix:["type",Xm],isHorizontalFix:["type",ql],labelBehavior:["type",Kl],layoutConnectionBehavior:["type",Xl],messageFlowBehavior:["type",Jl],nonInterruptingBehavior:["type",ep],removeElementBehavior:["type",np],removeEmbeddedLabelBoundsBehavior:["type",tp],removeParticipantBehavior:["type",ip],replaceConnectionBehavior:["type",rp],replaceElementBehaviour:["type",nc],resizeBehavior:["type",bg],resizeLaneBehavior:["type",Rg],rootElementReferenceBehavior:["type",cp],spaceToolBehavior:["type",Pg],subProcessPlaneBehavior:["type",Ni],subProcessStartEventBehavior:["type",lp],textAnnotationBehavior:["type",pp],toggleCollapseConnectionBehaviour:["type",fp],toggleElementCollapseBehaviour:["type",hp],unclaimIdBehavior:["type",mp],unsetDefaultFlowBehavior:["type",gp],updateFlowNodeRefsBehavior:["type",yp],updateCategoryValueRefsBehavior:["type",vp],setCompensationActivityAfterPasteBehavior:["type",bp]};function _p(e){this._commandStack=e.get("commandStack",!1)}_p.$inject=["injector"],_p.prototype.allowed=function(e,t){var n=!0,i=this._commandStack;return i&&(n=i.canExecute(e,t)),n===void 0?!0:n};const yi={__init__:["rules"],rules:["type",_p]};function Vn(e){ee.call(this,e),this.init()}Vn.$inject=["eventBus"],he(Vn,ee),Vn.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)})},Vn.prototype.init=function(){};function $g(e,t){var n=nn(e,t,-15);return n!=="intersect"?n:null}function on(e){Vn.call(this,e)}he(on,Vn),on.$inject=["eventBus"],on.prototype.init=function(){this.addRule("connection.start",function(e){var t=e.source;return SP(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 cc(t,n)}finally{r&&(n.parent=null)}}),this.addRule("connection.reconnect",function(e){var t=e.connection,n=e.source,i=e.target;return cc(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 Zg(t,n,i)}),this.addRule("elements.create",function(e){var t=e.elements,n=e.position,i=e.target;return ct(i)&&!uc(t,i)?!1:Pr(t,function(r){return ct(r)?cc(r.source,r.target,r):r.host?ma(r,r.host,null,n):Sp(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 Wg(a)&&!n.includes(a.host)})?!1:ma(n,t,null,i)||Kg(n,t,i)||Xg(n,t)||uc(n,t)}),this.addRule("shape.create",function(e){return Sp(e.shape,e.target,e.source,e.position)}),this.addRule("shape.attach",function(e){return ma(e.shape,e.target,null,e.position)}),this.addRule("element.copy",function(e){var t=e.element,n=e.elements;return ny(n,t)})},on.prototype.canConnectMessageFlow=ey,on.prototype.canConnectSequenceFlow=ty,on.prototype.canConnectDataAssociation=Rp,on.prototype.canConnectAssociation=Qg,on.prototype.canConnectCompensationAssociation=Jg,on.prototype.canMove=Xg,on.prototype.canAttach=ma,on.prototype.canReplace=Kg,on.prototype.canDrop=Ro,on.prototype.canInsert=uc,on.prototype.canCreate=Sp,on.prototype.canConnect=cc,on.prototype.canResize=Zg,on.prototype.canCopy=ny;function SP(e){return xp(e)?null:He(e,["bpmn:FlowNode","bpmn:InteractionNode","bpmn:DataObjectReference","bpmn:DataStoreReference","bpmn:Group","bpmn:TextAnnotation"])}function xp(e){return!e||je(e)}function jg(e){do{if(_(e,"bpmn:Process"))return te(e);if(_(e,"bpmn:Participant"))return te(e).processRef||te(e)}while(e=e.parent)}function wp(e){return _(e,"bpmn:TextAnnotation")}function Ep(e){return _(e,"bpmn:Group")&&!e.labelTarget}function Fg(e){return _(e,"bpmn:BoundaryEvent")&&vi(e,"bpmn:CompensateEventDefinition")}function sc(e){return te(e).isForCompensation}function RP(e,t){var n=jg(e),i=jg(t);return n===i}function CP(e){return _(e,"bpmn:InteractionNode")&&!_(e,"bpmn:BoundaryEvent")&&(!_(e,"bpmn:Event")||_(e,"bpmn:ThrowEvent")&&Gg(e,"bpmn:MessageEventDefinition"))}function PP(e){return _(e,"bpmn:InteractionNode")&&!sc(e)&&(!_(e,"bpmn:Event")||_(e,"bpmn:CatchEvent")&&Gg(e,"bpmn:MessageEventDefinition"))&&!(_(e,"bpmn:BoundaryEvent")&&!vi(e,"bpmn:MessageEventDefinition"))}function Hg(e){for(var t=e;t=t.parent;){if(_(t,"bpmn:FlowElementsContainer"))return te(t);if(_(t,"bpmn:Participant"))return te(t).processRef}return null}function zg(e,t){var n=Hg(e),i=Hg(t);return n===i}function vi(e,t){var n=te(e);return!!ft(n.eventDefinitions||[],function(i){return _(i,t)})}function Gg(e,t){var n=te(e);return(n.eventDefinitions||[]).every(function(i){return _(i,t)})}function AP(e){return _(e,"bpmn:FlowNode")&&!_(e,"bpmn:EndEvent")&&!fn(e)&&!(_(e,"bpmn:IntermediateThrowEvent")&&vi(e,"bpmn:LinkEventDefinition"))&&!Fg(e)&&!sc(e)}function TP(e){return _(e,"bpmn:FlowNode")&&!_(e,"bpmn:StartEvent")&&!_(e,"bpmn:BoundaryEvent")&&!fn(e)&&!(_(e,"bpmn:IntermediateCatchEvent")&&vi(e,"bpmn:LinkEventDefinition"))&&!sc(e)}function MP(e){return _(e,"bpmn:ReceiveTask")||_(e,"bpmn:IntermediateCatchEvent")&&(vi(e,"bpmn:MessageEventDefinition")||vi(e,"bpmn:TimerEventDefinition")||vi(e,"bpmn:ConditionalEventDefinition")||vi(e,"bpmn:SignalEventDefinition"))}function kP(e){for(var t=[];e;)e=e.parent,e&&t.push(e);return t}function Vg(e,t){var n=kP(t);return n.indexOf(e)!==-1}function cc(e,t,n){if(xp(e)||xp(t))return null;if(!_(n,"bpmn:DataAssociation")){if(ey(e,t))return{type:"bpmn:MessageFlow"};if(ty(e,t))return{type:"bpmn:SequenceFlow"}}var i=Rp(e,t);return i||(Jg(e,t)?{type:"bpmn:Association",associationDirection:"One"}:Qg(e,t)?{type:"bpmn:Association",associationDirection:"None"}:!1)}function Ro(e,t){return je(e)||Ep(e)?!0:_(t,"bpmn:Participant")&&!qe(t)?!1:_(e,"bpmn:Participant")?_(t,"bpmn:Process")||_(t,"bpmn:Collaboration"):He(e,["bpmn:DataInput","bpmn:DataOutput"])&&e.parent?t===e.parent:_(e,"bpmn:Lane")?_(t,"bpmn:Participant")||_(t,"bpmn:Lane"):_(e,"bpmn:BoundaryEvent")&&!OP(e)?!1:_(e,"bpmn:FlowElement")&&!_(e,"bpmn:DataStoreReference")?_(t,"bpmn:FlowElementsContainer")?qe(t):He(t,["bpmn:Participant","bpmn:Lane"]):_(e,"bpmn:DataStoreReference")&&_(t,"bpmn:Collaboration")?Yi(te(t).get("participants"),function(n){return!!n.get("processRef")}):He(e,["bpmn:Artifact","bpmn:DataAssociation","bpmn:DataStoreReference"])?He(t,["bpmn:Collaboration","bpmn:Lane","bpmn:Participant","bpmn:Process","bpmn:SubProcess"]):_(e,"bpmn:MessageFlow")?_(t,"bpmn:Collaboration")||e.source.parent==t||e.target.parent==t:!1}function OP(e){return te(e).cancelActivity&&(Ug(e)||qg(e))}function Wg(e){return!je(e)&&_(e,"bpmn:BoundaryEvent")}function DP(e){return _(e,"bpmn:Lane")}function LP(e){return Wg(e)||_(e,"bpmn:IntermediateThrowEvent")&&Ug(e)?!0:_(e,"bpmn:IntermediateCatchEvent")&&qg(e)}function Ug(e){var t=te(e);return t&&!(t.eventDefinitions&&t.eventDefinitions.length)}function qg(e){return Yg(e,["bpmn:MessageEventDefinition","bpmn:TimerEventDefinition","bpmn:SignalEventDefinition","bpmn:ConditionalEventDefinition"])}function Yg(e,t){return t.some(function(n){return vi(e,n)})}function IP(e){return _(e,"bpmn:ReceiveTask")&&ft(e.incoming,function(t){return _(t.source,"bpmn:EventBasedGateway")})}function ma(e,t,n,i){if(Array.isArray(e)||(e=[e]),e.length!==1)return!1;var r=e[0];return je(r)||!LP(r)||fn(t)||!_(t,"bpmn:Activity")||sc(t)||i&&!$g(i,t)||IP(t)?!1:"attach"}function Kg(e,t,n){if(!t)return!1;var i={replacements:[]};return L(e,function(r){fn(t)||_(r,"bpmn:StartEvent")&&r.type!=="label"&&Ro(r,t)&&(VS(r)||i.replacements.push({oldElementId:r.id,newElementType:"bpmn:StartEvent"}),(WS(r)||US(r)||qS(r))&&i.replacements.push({oldElementId:r.id,newElementType:"bpmn:StartEvent"}),Yg(r,["bpmn:MessageEventDefinition","bpmn:TimerEventDefinition","bpmn:SignalEventDefinition","bpmn:ConditionalEventDefinition"])&&_(t,"bpmn:SubProcess")&&i.replacements.push({oldElementId:r.id,newElementType:"bpmn:StartEvent"})),_(t,"bpmn:Transaction")||vi(r,"bpmn:CancelEventDefinition")&&r.type!=="label"&&(_(r,"bpmn:EndEvent")&&Ro(r,t)&&i.replacements.push({oldElementId:r.id,newElementType:"bpmn:EndEvent"}),_(r,"bpmn:BoundaryEvent")&&ma(r,t,null,n)&&i.replacements.push({oldElementId:r.id,newElementType:"bpmn:BoundaryEvent"}))}),i.replacements.length?i:!1}function Xg(e,t){return Yi(e,DP)?!1:t===void 0?!0:t===null?!1:e.every(function(n){return Ro(n,t)})}function Sp(e,t,n,i){return t?je(e)||Ep(e)?!0:Ro(e,t)||uc(e,t):!1}function Zg(e,t,n){return _(e,"bpmn:SubProcess")?qe(e)&&(!t||t.width>=100&&t.height>=80):_(e,"bpmn:Lane")||_(e,"bpmn:Participant")?!0:wp(e)?n?n==="e"||n==="w":!0:Ep(e)?!0:je(e)?n?n==="e"||n==="w":!0:!1}function BP(e,t){var n=wp(e),i=wp(t);return(n||i)&&n!==i}function Qg(e,t){return Vg(t,e)||Vg(e,t)?!1:BP(e,t)?!0:!!Rp(e,t)}function Jg(e,t){return zg(e,t)&&Fg(e)&&_(t,"bpmn:Activity")&&!$P(t,e)&&!fn(t)}function ey(e,t){return ry(e)&&!ry(t)?!1:CP(e)&&PP(t)&&!RP(e,t)}function ty(e,t){return AP(e)&&TP(t)&&zg(e,t)&&!(_(e,"bpmn:EventBasedGateway")&&!MP(t))}function Rp(e,t){return He(e,["bpmn:DataObjectReference","bpmn:DataStoreReference"])&&He(t,["bpmn:Activity","bpmn:ThrowEvent"])?{type:"bpmn:DataInputAssociation"}:He(t,["bpmn:DataObjectReference","bpmn:DataStoreReference"])&&He(e,["bpmn:Activity","bpmn:CatchEvent"])?{type:"bpmn:DataOutputAssociation"}:!1}function uc(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:He(t,["bpmn:SequenceFlow","bpmn:MessageFlow"])&&!je(t)&&_(e,"bpmn:FlowNode")&&!_(e,"bpmn:BoundaryEvent")&&Ro(e,t.parent)}function Cp(e,t){return e&&t&&e.indexOf(t)!==-1}function ny(e,t){return je(t)?!0:!(_(t,"bpmn:Lane")&&!Cp(e,t.parent)||_(t,"bpmn:MessageFlow")&&!NP(e,t))}function NP(e,t){var n=iy(t.source),i=iy(t.target);return Cp(e,n)&&Cp(e,i)}function iy(e){for(;e;e=e.parent)if(_(e,"bpmn:Participant"))return e;return null}function ry(e){return vo(e,"bpmn:Process")||vo(e,"bpmn:Collaboration")}function $P(e,t){return e.attachers.includes(t)}const jP={__depends__:[yi],__init__:["bpmnRules"],bpmnRules:["type",on]};var FP=2e3;function oy(e,t){e.on("saveXML.start",FP,n);function n(){var i=t.getRootElements();L(i,function(r){var o=Ke(r),a,s;a=Qo([r]),a=ze(a,function(c){return c!==r&&!c.labelTarget}),s=cn(a,Ke),o.set("planeElement",s)})}}oy.$inject=["eventBus","canvas"];const HP={__init__:["bpmnDiOrdering"],bpmnDiOrdering:["type",oy]};function lc(e){ee.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)})}lc.prototype.getOrdering=function(e,t){return null},he(lc,ee);function Pp(e,t){lc.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 He(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&&!He(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||_(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=rd(s.children,function(p){return!a.labelTarget&&p.labelTarget?!1:c.level<r(p).level});return l!==-1&&u!==-1&&u<l&&(l-=1),{index:l,parent:s}}}Pp.$inject=["eventBus","canvas"],he(Pp,lc);const zP={__init__:["bpmnOrderingProvider"],bpmnOrderingProvider:["type",Pp]};function ga(){}ga.prototype.get=function(){return this._data},ga.prototype.set=function(e){this._data=e},ga.prototype.clear=function(){var e=this._data;return delete this._data,e},ga.prototype.isEmpty=function(){return!this._data};const GP={clipboard:["type",ga]};var ay=1500;function sy(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",ay,function(s){o(s)})}),(function(){var a,s;t.on("element.hover",function(c){a=c.gfx,s=c.element}),t.on("element.hover",ay,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),VP(c)}}sy.$inject=["elementRegistry","eventBus","injector"];function VP(e){return Or(e,"svg, .djs-element",!0)}const WP={__init__:["hoverFix"],hoverFix:["type",sy]};function UP(e){return!0}function pc(e){return ur(e)||ZC(e)}var cy=500;function uy(e,t,n){var i=this;function r(A,I,k){if(!s(A,I)){var O,$,oe;k?$=t.getGraphics(k):(O=I.delegateTarget||I.target,O&&($=O,k=t.get($))),!(!$||!k)&&(oe=e.fire(A,{element:k,gfx:$,originalEvent:I}),oe===!1&&(I.stopPropagation(),I.preventDefault()))}}var o={};function a(A){return o[A]}function s(A,I){var k=u[A]||ur;return!k(I)}var c={click:"element.click",contextmenu:"element.contextmenu",dblclick:"element.dblclick",mousedown:"element.mousedown",mousemove:"element.mousemove",mouseover:"element.hover",mouseout:"element.out",mouseup:"element.mouseup"},u={"element.contextmenu":UP,"element.mousedown":pc,"element.mouseup":pc,"element.click":pc,"element.dblclick":pc};function l(A,I,k){var O=c[A];if(!O)throw new Error("unmapped DOM event name <"+A+">");return r(O,I,k)}var p="svg, .djs-element";function f(A,I,k,O){var $=o[k]=function(oe){r(k,oe)};O&&(u[k]=O),$.$delegate=Rn.bind(A,p,I,$)}function d(A,I,k){var O=a(k);O&&Rn.unbind(A,I,O.$delegate)}function g(A){L(c,function(I,k){f(A,k,I)})}function h(A){L(c,function(I,k){d(A,k,I)})}e.on("canvas.destroy",function(A){h(A.svg)}),e.on("canvas.init",function(A){g(A.svg)}),e.on(["shape.added","connection.added"],function(A){var I=A.element,k=A.gfx;e.fire("interactionEvents.createHit",{element:I,gfx:k})}),e.on(["shape.changed","connection.changed"],cy,function(A){var I=A.element,k=A.gfx;e.fire("interactionEvents.updateHit",{element:I,gfx:k})}),e.on("interactionEvents.createHit",cy,function(A){var I=A.element,k=A.gfx;i.createDefaultHit(I,k)}),e.on("interactionEvents.updateHit",function(A){var I=A.element,k=A.gfx;i.updateDefaultHit(I,k)});var m=P("djs-hit djs-hit-stroke"),S=P("djs-hit djs-hit-click-stroke"),y=P("djs-hit djs-hit-all"),x=P("djs-hit djs-hit-no-move"),E={all:y,"click-stroke":S,stroke:m,"no-move":x};function P(A,I){return I=j({stroke:"white",strokeWidth:15},I||{}),n.cls(A,["no-fill","no-border"],I)}function C(A,I){var k=E[I];if(!k)throw new Error("invalid hit type <"+I+">");return me(A,k),A}function D(A,I){Ie(A,I)}this.removeHits=function(A){var I=ws(".djs-hit",A);L(I,Gt)},this.createDefaultHit=function(A,I){var k=A.waypoints,O=A.isFrame,$;return k?this.createWaypointsHit(I,k):($=O?"stroke":"all",this.createBoxHit(I,$,{width:A.width,height:A.height}))},this.createWaypointsHit=function(A,I){var k=Zo(I);return C(k,"stroke"),D(A,k),k},this.createBoxHit=function(A,I,k){k=j({x:0,y:0},k);var O=Se("rect");return C(O,I),me(O,k),D(A,O),O},this.updateDefaultHit=function(A,I){var k=at(".djs-hit",I);if(k)return A.waypoints?dl(k,A.waypoints):me(k,{width:A.width,height:A.height}),k},this.fire=r,this.triggerMouseEvent=l,this.mouseHandler=a,this.registerEvent=f,this.unregisterEvent=d}uy.$inject=["eventBus","elementRegistry","styles"];const fc={__init__:["interactionEvents"],interactionEvents:["type",uy]};function Co(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)})}Co.$inject=["eventBus","canvas"],Co.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()})}},Co.prototype.get=function(){return Array.from(this._selectedElements)},Co.prototype.isSelected=function(e){return this._selectedElements.has(e)},Co.prototype.select=function(e,t){var n=this.get();Ae(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?L(e,o=>{this._selectedElements.add(o)}):this._selectedElements=new Set(e),this._eventBus.fire("selection.changed",{oldSelection:n,newSelection:this.get()})};var ly="hover",py="selected";function fy(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,ly)}),t.on("element.out",function(r){i(r.element,ly)}),t.on("selection.changed",function(r){function o(u){i(u,py)}function a(u){n(u,py)}var s=new Set(r.oldSelection),c=new Set(r.newSelection);for(let u of s)c.has(u)||o(u);for(let u of c)s.has(u)||a(u)})}fy.$inject=["canvas","eventBus"];function dy(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;Ae(u)?t.select(u):t.select(s.filter(qP))}}),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=oc(r);if(a&&s)return c?t.deselect(o):t.select(o);a?t.deselect(o):t.select(o,c)}})}dy.$inject=["eventBus","selection","canvas","elementRegistry"];function qP(e){return!e.hidden}const Wn={__init__:["selectionVisuals","selectionBehavior"],__depends__:[fc],selection:["type",Co],selectionVisuals:["type",fy],selectionBehavior:["type",dy]};var YP=/^djs-cursor-.*$/;function dc(e){var t=gt(document.body);t.removeMatching(YP),e&&t.add("djs-cursor-"+e)}function hy(){dc(null)}var KP=5e3;function my(e,t){t=t||"element.click";function n(){return!1}return e.once(t,KP,n),function(){e.off(t,n)}}var XP=["c","C"],ZP=["v","V"],QP=["d","D"],JP=["x","X"],eA=["y","Y"],gy=["z","Z"];function tA(e){return e.ctrlKey||e.metaKey||e.shiftKey||e.altKey}function An(e){return e.altKey?!1:e.ctrlKey||e.metaKey}function Vt(e,t){return e=Ae(e)?e:[e],e.indexOf(t.key)!==-1||e.indexOf(t.code)!==-1}function Ap(e){return e.shiftKey}function nA(e){return An(e)&&Vt(XP,e)}function iA(e){return An(e)&&Vt(ZP,e)}function rA(e){return An(e)&&Vt(QP,e)}function oA(e){return An(e)&&Vt(JP,e)}function aA(e){return An(e)&&!Ap(e)&&Vt(gy,e)}function sA(e){return An(e)&&(Vt(eA,e)||Vt(gy,e)&&Ap(e))}var Po=Math.round,yy="djs-drag-active";function Fr(e){e.preventDefault()}function cA(e){return typeof TouchEvent<"u"&&e instanceof TouchEvent}function uA(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}function vy(e,t,n,i){var r={threshold:5,trapClick:!0},o;function a(x){var E=t.viewbox(),P=t._container.getBoundingClientRect();return{x:E.x+(x.x-P.left)/E.scale,y:E.y+(x.y-P.top)/E.scale}}function s(x,E){E=E||o;var P=e.createEvent(j({},E.payload,E.data,{isTouch:E.isTouch}));return e.fire("drag."+x,P)===!1?!1:e.fire(E.prefix+"."+x,P)}function c(x){var E=x.filter(function(P){return i.get(P.id)});E.length&&n.select(E)}function u(x,E){var P=o.payload,C=o.displacement,D=o.globalStart,A=$r(x),I=ni(A,D),k=o.localStart,O=a(A),$=ni(O,k);if(!o.active&&(E||uA(I)>o.threshold)){if(j(P,{x:Po(k.x+C.x),y:Po(k.y+C.y),dx:0,dy:0},{originalEvent:x}),s("start")===!1)return m();o.active=!0,o.keepSelection||(P.previousSelection=n.get(),n.select(null)),o.cursor&&dc(o.cursor),t.addMarker(t.getRootElement(),yy)}sp(x),o.active&&(j(P,{x:Po(O.x+C.x),y:Po(O.y+C.y),dx:Po($.x),dy:Po($.y)},{originalEvent:x}),s("move"))}function l(x){var E,P=!0;o.active&&(x&&(o.payload.originalEvent=x,sp(x)),P=s("end")),P===!1&&s("rejected"),E=S(P!==!0),s("ended",E)}function p(x){Vt("Escape",x)&&(Fr(x),m())}function f(x){var E;o.active&&(E=my(e),setTimeout(E,400),Fr(x)),l(x)}function d(x){u(x)}function g(x){var E=o.payload;E.hoverGfx=x.gfx,E.hover=x.element,s("hover")}function h(x){s("out");var E=o.payload;E.hoverGfx=null,E.hover=null}function m(x){var E;if(o){var P=o.active;P&&s("cancel"),E=S(x),P&&s("canceled",E)}}function S(x){var E,P;s("cleanup"),hy(),o.trapClick?P=f:P=l,Le.unbind(document,"mousemove",u),Le.unbind(document,"dragstart",Fr),Le.unbind(document,"selectstart",Fr),Le.unbind(document,"mousedown",P,!0),Le.unbind(document,"mouseup",P,!0),Le.unbind(document,"keyup",p),Le.unbind(document,"touchstart",d,!0),Le.unbind(document,"touchcancel",m,!0),Le.unbind(document,"touchmove",u,!0),Le.unbind(document,"touchend",l,!0),e.off("element.hover",g),e.off("element.out",h),t.removeMarker(t.getRootElement(),yy);var C=o.payload.previousSelection;return x!==!1&&C&&!n.get().length&&c(C),E=o,o=null,E}function y(x,E,P,C){o&&m(!1),typeof E=="string"&&(C=P,P=E,E=null),C=j({},r,C||{});var D=C.data||{},A,I,k,O,$;if(C.trapClick?O=f:O=l,x?(A=So(x)||x,I=$r(x),sp(x),A.type==="dragstart"&&Fr(A)):(A=null,I={x:0,y:0}),k=a(I),E||(E=k),$=cA(A),o=j({prefix:P,data:D,payload:{},globalStart:I,displacement:ni(E,k),localStart:k,isTouch:$},C),C.manual||($?(Le.bind(document,"touchstart",d,!0),Le.bind(document,"touchcancel",m,!0),Le.bind(document,"touchmove",u,!0),Le.bind(document,"touchend",l,!0)):(Le.bind(document,"mousemove",u),Le.bind(document,"dragstart",Fr),Le.bind(document,"selectstart",Fr),Le.bind(document,"mousedown",O,!0),Le.bind(document,"mouseup",O,!0)),Le.bind(document,"keyup",p),e.on("element.hover",g),e.on("element.out",h)),s("init")===!1)return m(),!1;C.autoActivate&&u(x,!0)}e.on("diagram.destroy",m),this.init=y,this.move=u,this.hover=g,this.out=h,this.end=l,this.cancel=m,this.context=function(){return o},this.setOptions=function(x){j(r,x)}}vy.$inject=["eventBus","canvas","selection","elementRegistry"];const $i={__depends__:[WP,Wn],dragging:["type",vy]};function Ao(e){this._counter=0,this._prefix=(e?e+"-":"")+Math.floor(Math.random()*1e9)+"-"}Ao.prototype.next=function(){return this._prefix+ ++this._counter};const lA=new Ao("ps");var pA=["marker-start","marker-mid","marker-end"],fA=["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=kh(n);return this._cloneMarkers(Ir(r),i),me(r,this._styles.cls(i,[])),Ie(t,r),me(r,"data-preview-support-element-id",e.id),r},lr.prototype.addFrame=function(e,t){var n=Se("rect",{class:"djs-resize-overlay",width:e.width,height:e.height,x:e.x,y:e.y});return Ie(t,n),me(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)}),gA(e)&&pA.forEach(function(r){if(me(e,r)){var o=dA(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,lA.next()].join("-"),a=at("marker#"+n.id,e);e=e||this._canvas._svg;var s=a||kh(n);s.id=o,Ye(s).add(r);var c=at(":scope > defs",e);c||(c=Se("defs"),Ie(e,c)),Ie(c,s);var u=mA(s.id);me(t,i,u)};function dA(e,t,n){var i=hA(me(e,t));return at("marker#"+i,n||document)}function hA(e){return e.match(/url\(['"]?#([^'"]*)['"]?\)/)[1]}function mA(e){return"url(#"+e+")"}function gA(e){return fA.indexOf(e.nodeName)!==-1}const To={__init__:["previewSupport"],previewSupport:["type",lr]};var yA="drop-ok",by="drop-not-ok",_y="attach-ok",xy="new-parent",wy="create",vA=2e3;function Ey(e,t,n,i,r){function o(c,u,l,p,f){if(!u)return!1;c=ze(c,function(y){var x=y.labelTarget;return!y.parent&&!(je(y)&&c.indexOf(x)!==-1)});var d=ft(c,function(y){return!ct(y)}),g=!1,h=!1,m=!1;Ry(c)&&(g=r.allowed("shape.attach",{position:l,shape:d,target:u})),g||(Ry(c)?m=r.allowed("shape.create",{position:l,shape:d,source:p,target:u}):m=r.allowed("elements.create",{elements:c,position:l,target:u}));var S=f.connectionTarget;return m||g?(d&&p&&(h=r.allowed("connection.create",{source:S===p?d:p,target:S===p?p:d,hints:{targetParent:u,targetAttach:g}})),{attach:g,connect:h}):m===null||g===null?null:!1}function a(c,u){[_y,yA,by,xy].forEach(function(l){l===u?e.addMarker(c,l):e.removeMarker(c,l)})}n.on(["create.move","create.hover"],function(c){var u=c.context,l=u.elements,p=c.hover,f=u.source,d=u.hints||{};if(!p){u.canExecute=!1,u.target=null;return}Sy(c);var g={x:c.x,y:c.y},h=u.canExecute=p&&o(l,p,g,f,d);p&&h!==null&&(u.target=p,h&&h.attach?a(p,_y):a(p,h?xy:by))}),n.on(["create.end","create.out","create.cleanup"],function(c){var u=c.hover;u&&a(u,null)}),n.on("create.end",function(c){var u=c.context,l=u.source,p=u.shape,f=u.elements,d=u.target,g=u.canExecute,h=g&&g.attach,m=g&&g.connect,S=u.hints||{};if(g===!1||!d)return!1;Sy(c);var y={x:c.x,y:c.y};m?p=i.appendShape(l,p,y,d,{attach:h,connection:m===!0?{}:m,connectionTarget:S.connectionTarget}):(f=i.createElements(f,y,d,j({},S,{attach:h})),p=ft(f,function(x){return!ct(x)})),j(u,{elements:f,shape:p}),j(c,{elements:f,shape:p})});function s(){var c=t.context();c&&c.prefix===wy&&t.cancel()}n.on("create.init",function(){n.on("elements.changed",s),n.once(["create.cancel","create.end"],vA,function(){n.off("elements.changed",s)})}),this.start=function(c,u,l){Ae(u)||(u=[u]);var p=ft(u,function(g){return!ct(g)});if(p){l=j({elements:u,hints:{},shape:p},l||{}),L(u,function(g){De(g.x)||(g.x=0),De(g.y)||(g.y=0)});var f=ze(u,function(g){return!g.hidden}),d=Ot(f);L(u,function(g){ct(g)&&(g.waypoints=cn(g.waypoints,function(h){return{x:h.x-d.x-d.width/2,y:h.y-d.y-d.height/2}})),j(g,{x:g.x-d.x-d.width/2,y:g.y-d.y-d.height/2})}),t.init(c,wy,{cursor:"grabbing",autoActivate:!0,data:{shape:p,elements:u,context:l}})}}}Ey.$inject=["canvas","dragging","eventBus","modeling","rules"];function Sy(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 Ry(e){return e&&e.length===1&&!ct(e[0])}var bA=750;function Cy(e,t,n,i,r){function o(a){var s=Se("g");me(s,r.cls("djs-drag-group",["no-events"]));var c=Se("g");return a.forEach(function(u){var l;u.hidden||(u.waypoints?(l=n._createContainer("connection",c),n.drawConnection(Ir(l),u)):(l=n._createContainer("shape",c),n.drawShape(Ir(l),u),rn(l,u.x,u.y)),i.addDragger(u,s,l))}),s}t.on("create.move",bA,function(a){var s=a.hover,c=a.context,u=c.elements,l=c.dragGroup;l||(l=c.dragGroup=o(u));var p;s?(l.parentNode||(p=e.getActiveLayer(),Ie(p,l)),rn(l,a.x,a.y)):Gt(l)}),t.on("create.cleanup",function(a){var s=a.context,c=s.dragGroup;c&&Gt(c)})}Cy.$inject=["canvas","eventBus","graphicsFactory","previewSupport","styles"];const hc={__depends__:[$i,To,yi,Wn],__init__:["create","createPreview"],create:["type",Ey],createPreview:["type",Cy]};function Tp(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)})}Tp.$inject=["eventBus"],Tp.prototype.getLastMoveEvent=function(){return this._lastMoveEvent||_A(0,0)};function _A(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 ya={__init__:["mouse"],mouse:["type",Tp]};var Py=2e3;function Tn(e,t,n,i,r,o,a,s){this._canvas=e,this._create=t,this._elementFactory=i,this._eventBus=r,this._modeling=o,this._mouse=a,this._rules=s,r.on("copyPaste.copyElement",function(c){var u=c.descriptor,l=c.element,p=c.elementsSet;u.priority=1,u.id=l.id,p.has(l.parent)&&(u.parent=l.parent.id),xA(l)&&(u.priority=2,u.host=l.host.id),ct(l)&&(u.priority=3,u.source=l.source.id,u.target=l.target.id,u.waypoints=wA(l)),je(l)&&(u.priority=4,u.labelTarget=l.labelTarget.id),L(["x","y","width","height"],function(f){De(l[f])&&(u[f]=l[f])}),u.hidden=l.hidden,u.collapsed=l.collapsed}),r.on("copyPaste.elementsCopied",Py,function(c){var u;((u=c.hints)==null?void 0:u.clip)!==!1&&n.set(c.tree)}),r.on("copyPaste.pasteElements",Py,function(c){c.tree||(c.tree=n.get())}),r.on("copyPaste.pasteElements",function(c){var u=c.hints;j(u,{createElementsBehavior:!1})})}Tn.$inject=["canvas","create","clipboard","elementFactory","eventBus","modeling","mouse","rules"],Tn.prototype.copy=function(e,t={}){var n,i;return Ae(e)||(e=e?[e]:[]),n=this._eventBus.fire("copyPaste.canCopyElements",{elements:e}),n===!1?i={}:i=this.createTree(Ae(n)?n:e),this._eventBus.fire("copyPaste.elementsCopied",{elements:e,tree:i,hints:t}),i},Tn.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})}}},Tn.prototype.duplicate=function(e,t={}){var n=this.copy(e,{clip:!1});return this.paste({...t,tree:n})},Tn.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},Tn.prototype._getElementIdsFromTree=function(e){var t={};return L(e,function(n){L(n,function(i){i.id&&(t[i.id]=!0)})}),t},Tn.prototype._paste=function(e,t,n,i){L(e,function(o){De(o.x)||(o.x=0),De(o.y)||(o.y=0)});var r=Ot(e);return L(e,function(o){ct(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))},Tn.prototype._createElements=function(e){var t=this,n=this._eventBus,i={},r=[];return L(e,function(o,a){o=oi(o,"priority"),L(o,function(s){var c=j({},ai(s,["priority"]));i[s.parent]?c.parent=i[s.parent]:delete c.parent,n.fire("copyPaste.pasteElement",{cache:i,descriptor:c});var u;if(ct(c)){c.source=i[s.source],c.target=i[s.target],u=i[s.id]=t.createConnection(c),r.push(u);return}if(je(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},Tn.prototype.createConnection=function(e){var t=this._elementFactory.createConnection(ai(e,["id"]));return t},Tn.prototype.createLabel=function(e){var t=this._elementFactory.createLabel(ai(e,["id"]));return t},Tn.prototype.createShape=function(e){var t=this._elementFactory.createShape(ai(e,["id"]));return t},Tn.prototype.hasRelations=function(e,t,n){return n||(n=new Set(t)),!(ct(e)&&(!n.has(e.source)||!n.has(e.target))||je(e)&&!n.has(e.labelTarget))},Tn.prototype.createTree=function(e){var t=this._rules,n=this,i={},r=[],o=new Map,a=Cs(e);function s(p,f){return t.allowed("element.copy",{element:p,elements:f})}function c(p,f){var d=o.get(p);if(!d){var g={element:p,depth:f};r.push(g),o.set(p,g);return}if(d.depth<f){r=u(d,r);var h={element:d.element,depth:f};r.push(h),o.set(p,h)}}function u(p,f){var d=f.indexOf(p);return d!==-1&&f.splice(d,1),f}Lr(a,function(p,f,d){if(je(p))return;L(p.labels,function(m){c(m,d)});function g(m){m&&m.length&&L(m,function(S){L(S.labels,function(y){c(y,d)}),c(S,d)})}L([p.attachers,p.incoming,p.outgoing],g),c(p,d);var h=[];return p.children&&(h=p.children.slice()),n._eventBus.fire("copyPaste.createTree",{element:p,children:h}),h}),e=cn(r,function(p){return p.element});var l=new Set(e);return r=cn(r,function(p){return p.descriptor={},n._eventBus.fire("copyPaste.copyElement",{descriptor:p.descriptor,element:p.element,elements:e,elementsSet:l}),p}),r=oi(r,function(p){return p.descriptor.priority}),e=cn(r,function(p){return p.element}),L(r,function(p){var f=p.depth;if(!n.hasRelations(p.element,e,l)){Ty(p.element,e),l.delete(p.element);return}if(!s(p.element,e)){Ty(p.element,e),l.delete(p.element);return}i[f]||(i[f]=[]),i[f].push(p.descriptor)}),i};function xA(e){return!!e.host}function wA(e){return cn(e.waypoints,function(t){return t=Ay(t),t.original&&(t.original=Ay(t.original)),t})}function Ay(e){return j({},e)}function Ty(e,t){var n=t.indexOf(e);return n===-1?t:t.splice(n,1)}const EA={__depends__:[GP,hc,ya,yi],__init__:["copyPaste"],copyPaste:["type",Tn]};function Mp(e,t,n){Ae(n)||(n=[n]),L(n,function(i){Cr(e[i])||(t[i]=e[i])})}var kp=750;function My(e,t,n){function i(c,u){var l=e.create(c.$type);return n.copyElement(c,l,null,u)}t.on("copyPaste.copyElement",kp,function(c){var u=c.descriptor,l=c.element,p=te(l);if(je(l))return u;var f=u.businessObject=i(p,!0),d=u.di=i(Ke(l),!0);d.bpmnElement=f,Mp(f,u,"name"),Mp(d,u,"isExpanded"),p.default&&(u.default=p.default.id)});var r="-bpmn-js-refs";function o(c){return c[r]=c[r]||{}}function a(c,u){c[r]=u}function s(c,u,l){var p=te(c);return c.default&&(l[c.default]={element:p,property:"default"}),c.host&&(te(c).attachedToRef=te(u[c.host])),ai(l,En(l,function(f,d,g){var h=d.element,m=d.property;return g===c.id&&(h.set(m,p),f.push(c.id)),f},[]))}t.on("copyPaste.pasteElement",function(c){var u=c.cache,l=c.descriptor,p=l.businessObject,f=l.di;if(je(l)){l.businessObject=te(u[l.labelTarget]),l.di=Ke(u[l.labelTarget]);return}p=l.businessObject=i(p),f=l.di=i(f),f.bpmnElement=p,Mp(l,p,["isExpanded","name"]),l.type=p.$type}),t.on("copyPaste.copyElement",kp,function(c){var u=c.descriptor,l=c.element;if(_(l,"bpmn:Participant")){var p=te(l);p.processRef&&(u.processRef=i(p.processRef,!0))}}),t.on("copyPaste.pasteElement",function(c){var u=c.descriptor,l=u.processRef;l&&(u.processRef=i(l))}),t.on("copyPaste.createTree",function(c){var u=c.element,l=c.children;_(u,"bpmn:SubProcess")&&L(ra(l),p=>{l.push(p.annotation)})}),t.on("copyPaste.pasteElement",kp,function(c){var u=c.cache,l=c.descriptor;a(u,s(l,u,o(u)))})}My.$inject=["bpmnFactory","eventBus","moddleCopy"];const SA=["artifacts","dataInputAssociations","dataOutputAssociations","default","flowElements","lanes","incoming","outgoing","categoryValue"],RA=["errorRef","escalationRef","messageRef","signalRef","dataObjectRef"];function va(e,t,n){this._bpmnFactory=t,this._eventBus=e,this._moddle=n,e.on("moddleCopy.canCopyProperties",i=>{const{propertyNames:r}=i;if(!(!r||!r.length))return oi(r,o=>o==="extensionElements")}),e.on("moddleCopy.canCopyProperty",i=>{const{parent:r,property:o,propertyName:a}=i,s=Yt(r)&&r.$descriptor;if(a&&RA.includes(a))return o;if(a&&SA.includes(a)||a&&s&&!ft(s.properties,io({name:a})))return!1}),e.on("moddleCopy.canSetCopiedProperty",i=>{const{property:r}=i;if(_(r,"bpmn:ExtensionElements")&&(!r.values||!r.values.length))return!1})}va.$inject=["eventBus","bpmnFactory","moddle"],va.prototype.copyElement=function(e,t,n,i=!1){n&&!Ae(n)&&(n=[n]),n=n||Op(e.$descriptor);const r=this._eventBus.fire("moddleCopy.canCopyProperties",{propertyNames:n,sourceElement:e,targetElement:t,clone:i});return r===!1||(Ae(r)&&(n=r),L(n,o=>{let a;wn(e,o)&&(a=e.get(o));const s=this.copyProperty(a,t,o,i);!Ht(s)||this._eventBus.fire("moddleCopy.canSetCopiedProperty",{parent:t,property:s,propertyName:o})===!1||t.set(o,s)})),t},va.prototype.copyProperty=function(e,t,n,i=!1){let r=this._eventBus.fire("moddleCopy.canCopyProperty",{parent:t,property:e,propertyName:n,clone:i});if(r===!1)return;if(r)return Yt(r)&&r.$type&&!r.$parent&&(r.$parent=t),r;const o=this._moddle.getPropertyDescriptor(t,n);if(!o.isReference)return o.isId?e&&this._copyId(e,t,i):Ae(e)?En(e,(a,s)=>{const c=this.copyProperty(s,t,n,i);return c?a.concat(c):a},[]):Yt(e)&&e.$type?this._moddle.getElementDescriptor(e).isGeneric?void 0:(r=this._bpmnFactory.create(e.$type),r.$parent=t,r=this.copyElement(e,r,null,i),r):e},va.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 Op(e,t){return En(e.properties,(n,i)=>t&&i.default?n:n.concat(i.name),[])}const ky={__depends__:[EA],__init__:["bpmnCopyPaste","moddleCopy"],bpmnCopyPaste:["type",My],moddleCopy:["type",va]};var Oy=Math.round;function Dp(e,t){this._modeling=e,this._eventBus=t}Dp.$inject=["modeling","eventBus"],Dp.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=Oy(s+o/2),l=Oy(c+a/2),p=i.replaceShape(e,j({},t,{x:u,y:l,width:o,height:a}),n);return r.fire("replace.end",{element:e,newElement:p,hints:n}),p};function Dy(e,t){t.on("replace.end",500,function(n){const{newElement:i,hints:r={}}=n;r.select!==!1&&e.select(i)})}Dy.$inject=["selection","eventBus"];const CA={__init__:["replace","replaceSelectionBehavior"],replaceSelectionBehavior:["type",Dy],replace:["type",Dp]};function PA(e,t,n){Ae(n)||(n=[n]),L(n,function(i){Cr(e[i])||(t[i]=e[i])})}var AA=["cancelActivity","instantiate","eventGatewayType","triggeredByEvent","isInterrupting"];function TA(e,t){var n=e&&wn(e,"collapsed")?e.collapsed:!qe(e),i;return t&&(wn(t,"collapsed")||wn(t,"isExpanded"))?i=wn(t,"collapsed")?t.collapsed:!t.isExpanded:i=n,n!==i}function Ly(e,t,n,i,r,o){function a(s,c,u){u=u||{};var l=c.type,p=s.businessObject;if(mc(p)&&(l==="bpmn:SubProcess"||l==="bpmn:AdHocSubProcess")&&TA(s,c))return i.toggleCollapse(s),s;var f=e.create(l),d={type:l,businessObject:f};d.di={},l==="bpmn:ExclusiveGateway"&&(d.di.isMarkerVisible=!0),PA(s.di,d.di,["fill","stroke","background-color","border-color","color"]);var g=Op(p.$descriptor),h=Op(f.$descriptor,!0),m=MA(g,h);j(f,ti(c,AA));var S=ze(m,function(E){return E==="eventDefinitions"?Iy(s,c.eventDefinitionType):E==="loopCharacteristics"?!fn(f):wn(f,E)||E==="processRef"&&c.isExpanded===!1||E==="triggeredByEvent"?!1:E==="isForCompensation"?!fn(f):!0});if(f=n.copyElement(p,f,S),c.eventDefinitionType&&(Iy(f,c.eventDefinitionType)||(d.eventDefinitionType=c.eventDefinitionType,d.eventDefinitionAttrs=c.eventDefinitionAttrs)),_(p,"bpmn:Activity")){if(mc(p))d.isExpanded=qe(s);else if(c&&wn(c,"isExpanded")){d.isExpanded=c.isExpanded;var y=t.getDefaultSize(f,{isExpanded:d.isExpanded});d.width=y.width,d.height=y.height,d.x=s.x-(d.width-s.width)/2,d.y=s.y-(d.height-s.height)/2}qe(s)&&!_(p,"bpmn:Task")&&d.isExpanded&&(d.width=s.width,d.height=s.height)}if(mc(p)&&!mc(f)&&(u.moveChildren=!1),_(p,"bpmn:Participant")){c.isExpanded===!0?f.processRef=e.create("bpmn:Process"):u.moveChildren=!1;var x=Zt(s);Ke(s).isHorizontal||(Ke(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:f})||(d.height=t.getDefaultSize(d).height,d.width=t.getDefaultSize(d).width),f.name=p.name,He(p,["bpmn:ExclusiveGateway","bpmn:InclusiveGateway","bpmn:Activity"])&&He(f,["bpmn:ExclusiveGateway","bpmn:InclusiveGateway","bpmn:Activity"])&&(f.default=p.default),c.host&&!_(p,"bpmn:BoundaryEvent")&&_(f,"bpmn:BoundaryEvent")&&(d.host=c.host),(d.type==="bpmn:DataStoreReference"||d.type==="bpmn:DataObjectReference")&&(d.x=s.x+(s.width-d.width)/2),r.replaceElement(s,d,{...u,targetElement:c})}this.replaceElement=a}Ly.$inject=["bpmnFactory","elementFactory","moddleCopy","modeling","replace","rules"];function mc(e){return _(e,"bpmn:SubProcess")}function Iy(e,t){var n=te(e);return t&&n.get("eventDefinitions").some(function(i){return _(i,t)})}function MA(e,t){return e.filter(function(n){return t.includes(n)})}const By={__depends__:[ky,CA,Wn],bpmnReplace:["type",Ly]};var kA=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),L(t,function(r){i.push(r+".ended"),i.push(r+".canceled")}),n.on(i,kA,function(r){this._active&&(OA(r)||this.setActive(null))},this)};function OA(e){var t=e.originalEvent&&e.originalEvent.target;return t&&Or(t,'.group[data-group="tools"]')}const gc={__depends__:[$i],__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 LA(e,t){var n=[],i=new Set(e);L(t,function(o){i.add(o)});var r=new Set;return i.forEach(function(o){var a=o.incoming,s=o.outgoing;L(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 IA(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 Lp=Math.abs,BA=Math.round,ji={x:"width",y:"height"},Ny="crosshair",pr={n:"top",w:"left",s:"bottom",e:"right"},NA=1500,yc={n:"s",w:"e",s:"n",e:"w"},vc=20;function Un(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",NA,function(c){var u=c.context,l=u.initialized;l||(l=u.initialized=s.init(c,u)),l&&jy(c)}),n.on("spaceTool.end",function(c){var u=c.context,l=u.axis,p=u.direction,f=u.movingShapes,d=u.resizingShapes,g=u.start;if(u.initialized){jy(c);var h={x:0,y:0};h[l]=BA(c["d"+l]),s.makeSpace(f,d,h,p,g),n.once("spaceTool.ended",function(m){s.activateSelection(m.originalEvent,!0,!0)})}})}Un.$inject=["canvas","dragging","eventBus","modeling","rules","toolManager","mouse"],Un.prototype.activateSelection=function(e,t,n){this._dragging.init(e,"spaceTool.selection",{autoActivate:t,cursor:Ny,data:{context:{reactivate:n}},trapClick:!1})},Un.prototype.activateMakeSpace=function(e){this._dragging.init(e,"spaceTool",{autoActivate:!0,cursor:Ny,data:{context:{}}})},Un.prototype.makeSpace=function(e,t,n,i,r){return this._modeling.createSpace(e,t,n,i,r)},Un.prototype.init=function(e,t){var n=Lp(e.dx)>Lp(e.dy)?"x":"y",i=e["d"+n],r=e[n]-i;if(Lp(i)<5)return!1;i<0&&(i*=-1),ha(e)&&(i*=-1);var o=DA(n,i),a=this._canvas.getRootElement();!oc(e)&&e.hover&&(a=e.hover);var s=[...Qo(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=$A(c,n,o,r,u);return j(t,c,{axis:n,direction:o,spaceToolConstraints:l,start:r}),dc("resize-"+(n==="x"?"ew":"ns")),!0},Un.prototype.calculateAdjustments=function(e,t,n,i){var r=this._rules,o=[],a=[],s=new Set,c=new Set,u=[],l=[];function p(d){s.has(d)||(s.add(d),o.push(d));var g=d.label;g&&!s.has(g)&&(s.add(g),o.push(g))}function f(d){c.has(d)||(c.add(d),a.push(d))}return L(e,function(d){if(!(!d.parent||je(d))){if(ct(d)){l.push(d);return}var g=d[t],h=g+d[ji[t]];if(jA(d)&&(n>0&&Te(d)[t]>i||n<0&&Te(d)[t]<i)){u.push(d);return}if(n>0&&g>i||n<0&&h<i){p(d);return}if(g<i&&h>i&&r.allowed("shape.resize",{shape:d})){f(d);return}}}),L(o,function(d){var g=d.attachers;g&&L(g,function(h){p(h)})}),L(u,function(d){var g=d.host;(s.has(g)||c.has(g))&&p(d)}),L(l,function(d){var g=d.source,h=d.target,m=d.label;(s.has(g)||c.has(g))&&(s.has(h)||c.has(h))&&m&&p(m)}),{movingShapes:o,resizingShapes:a}},Un.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateSelection(e,!!e)},Un.prototype.isActive=function(){var e=this._dragging.context();return e?/^spaceTool/.test(e.prefix):!1};function $y(e){return{top:e.top-vc,right:e.right+vc,bottom:e.bottom+vc,left:e.left-vc}}function jy(e){var t=e.context,n=t.spaceToolConstraints;if(n){var i,r;De(n.left)&&(i=Math.max(e.x,n.left),e.dx=e.dx+i-e.x,e.x=i),De(n.right)&&(i=Math.min(e.x,n.right),e.dx=e.dx+i-e.x,e.x=i),De(n.top)&&(r=Math.max(e.y,n.top),e.dy=e.dy+r-e.y,e.y=r),De(n.bottom)&&(r=Math.min(e.y,n.bottom),e.dy=e.dy+r-e.y,e.y=r)}}function $A(e,t,n,i,r){var o=e.movingShapes,a=e.resizingShapes;if(a.length){var s={},c,u,l=new Set(o),p=new Set(a);return L(a,function(f){var d=f.attachers,g=f.children,h=Re(f),m=ze(g,function($){return!ct($)&&!je($)&&!l.has($)&&!p.has($)}),S=ze(g,function($){return!ct($)&&!je($)&&l.has($)}),y,x,E,P=[],C=[],D,A,I,k;m.length&&(x=$y(Re(Ot(m))),y=i-h[pr[n]]+x[pr[n]],n==="n"?s.bottom=u=De(u)?Math.min(u,y):y:n==="w"?s.right=u=De(u)?Math.min(u,y):y:n==="s"?s.top=c=De(c)?Math.max(c,y):y:n==="e"&&(s.left=c=De(c)?Math.max(c,y):y)),S.length&&(E=$y(Re(Ot(S))),y=i-E[pr[yc[n]]]+h[pr[yc[n]]],n==="n"?s.bottom=u=De(u)?Math.min(u,y):y:n==="w"?s.right=u=De(u)?Math.min(u,y):y:n==="s"?s.top=c=De(c)?Math.max(c,y):y:n==="e"&&(s.left=c=De(c)?Math.max(c,y):y)),d&&d.length&&(d.forEach(function($){l.has($)?P.push($):C.push($)}),P.length&&(D=Re(Ot(P.map(Te))),A=h[pr[yc[n]]]-(D[pr[yc[n]]]-i)),C.length&&(I=Re(Ot(C.map(Te))),k=I[pr[n]]-(h[pr[n]]-i)),n==="n"?(y=Math.min(A||1/0,k||1/0),s.bottom=u=De(u)?Math.min(u,y):y):n==="w"?(y=Math.min(A||1/0,k||1/0),s.right=u=De(u)?Math.min(u,y):y):n==="s"?(y=Math.max(A||-1/0,k||-1/0),s.top=c=De(c)?Math.max(c,y):y):n==="e"&&(y=Math.max(A||-1/0,k||-1/0),s.left=c=De(c)?Math.max(c,y):y));var O=r&&r[f.id];O&&(n==="n"?(y=i+f[ji[t]]-O[ji[t]],s.bottom=u=De(u)?Math.min(u,y):y):n==="w"?(y=i+f[ji[t]]-O[ji[t]],s.right=u=De(u)?Math.min(u,y):y):n==="s"?(y=i-f[ji[t]]+O[ji[t]],s.top=c=De(c)?Math.max(c,y):y):n==="e"&&(y=i-f[ji[t]]+O[ji[t]],s.left=c=De(c)?Math.max(c,y):y))}),s}}function jA(e){return!!e.host}var Ip="djs-dragging",Fy="djs-resizing",FA=250,bc=Math.max;function Hy(e,t,n,i,r){function o(a,s){L(a,function(c){r.addDragger(c,s),n.addMarker(c,Ip)})}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=Se("g");me(l,i.cls("djs-crosshair-group",["no-events"])),Ie(s,l);var p=Se("path");me(p,"d",u.x),Ye(p).add("djs-crosshair"),Ie(l,p);var f=Se("path");me(f,"d",u.y),Ye(f).add("djs-crosshair"),Ie(l,f),c.crosshairGroup=l}),e.on("spaceTool.selection.move",function(a){var s=a.context.crosshairGroup;rn(s,a.x,a.y)}),e.on("spaceTool.selection.cleanup",function(a){var s=a.context,c=s.crosshairGroup;c&&Gt(c)}),e.on("spaceTool.move",FA,function(a){var s=a.context,c=s.line,u=s.axis,l=s.movingShapes,p=s.resizingShapes;if(s.initialized){if(!s.dragGroup){var f=n.getLayer("space");c=Se("path"),me(c,"d","M0,0 L0,0"),Ye(c).add("djs-crosshair"),Ie(f,c),s.line=c;var d=Se("g");me(d,i.cls("djs-drag-group",["no-events"])),Ie(n.getActiveLayer(),d),o(l,d);var g=new Set(l);L(p,function(C){g.add(C)});var h=new Set,m=s.movingConnections=[];g.forEach(function(C){L(C.outgoing,function(D){h.has(D)||!ct(D)||!g.has(D.target)||(h.add(D),m.push(D))})}),o(m,d),s.dragGroup=d}if(!s.frameGroup){var S=Se("g");me(S,i.cls("djs-frame-group",["no-events"])),Ie(n.getActiveLayer(),S);var y=[];L(p,function(C){var D=r.addFrame(C,S),A=D.getBBox();y.push({element:D,initialBounds:A}),n.addMarker(C,Fy)}),s.frameGroup=S,s.frames=y}var x={x:"M"+a.x+", -10000 L"+a.x+", 10000",y:"M -10000, "+a.y+" L 10000, "+a.y};me(c,{d:x[u]});var E={x:"y",y:"x"},P={x:a.dx,y:a.dy};P[E[s.axis]]=0,rn(s.dragGroup,P.x,P.y),L(s.frames,function(C){var D=C.element,A=C.initialBounds,I,k;s.direction==="e"?me(D,{width:bc(A.width+P.x,5)}):(I=bc(A.width-P.x,5),me(D,{width:I,x:A.x+A.width-I})),s.direction==="s"?me(D,{height:bc(A.height+P.y,5)}):(k=bc(A.height-P.y,5),me(D,{height:k,y:A.y+A.height-k}))})}}),e.on("spaceTool.cleanup",function(a){var s=a.context,c=s.movingShapes,u=s.movingConnections,l=s.resizingShapes,p=s.line,f=s.dragGroup,d=s.frameGroup;L(c,function(g){n.removeMarker(g,Ip)}),L(u,function(g){n.removeMarker(g,Ip)}),f&&(Gt(p),Gt(f)),L(l,function(g){n.removeMarker(g,Fy)}),d&&Gt(d)})}Hy.$inject=["eventBus","elementRegistry","canvas","styles","previewSupport"];const HA={__init__:["spaceToolPreview"],__depends__:[$i,yi,gc,To,ya],spaceTool:["type",Un],spaceToolPreview:["type",Hy]};function _c(e,t){e.invoke(Un,this),this._canvas=t}_c.$inject=["injector","canvas"],he(_c,Un),_c.prototype.calculateAdjustments=function(e,t,n,i){var r=this._canvas.getRootElement(),o=e[0]===r?null:e[0],a=[];o&&(a=to(lo(r.children.filter(u=>_(u,"bpmn:Artifact")),Ot(o))));const s=[...e,...a];var c=Un.prototype.calculateAdjustments.call(this,s,t,n,i);return c.resizingShapes=c.resizingShapes.filter(function(u){return!(_(u,"bpmn:TextAnnotation")||zA(u)&&(t==="y"&&Zt(u)||t==="x"&&!Zt(u)))}),c};function zA(e){return _(e,"bpmn:Participant")&&!te(e).processRef}const zy={__depends__:[HA],spaceTool:["type",_c]};function bt(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)}bt.$inject=["eventBus","injector"],bt.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()},bt.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},bt.prototype.clear=function(e){this._stack.length=0,this._stackIdx=-1,e!==!1&&this._fire("changed",{trigger:"clear"})},bt.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()}},bt.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()}},bt.prototype.register=function(e,t){this._setHandler(e,t)},bt.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)},bt.prototype.canUndo=function(){return!!this._getUndoAction()},bt.prototype.canRedo=function(){return!!this._getRedoAction()},bt.prototype._getRedoAction=function(){return this._stack[this._stackIdx+1]},bt.prototype._getUndoAction=function(){return this._stack[this._stackIdx]},bt.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)})},bt.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},bt.prototype._createId=function(){return this._uid++},bt.prototype._atomicDo=function(e){const t=this._currentExecution;t.atomic=!0;try{e()}finally{t.atomic=!1}},bt.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()},bt.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)},bt.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:od("id",i.reverse())}),i.length=0,this._fire("changed",{trigger:t}),e.trigger=null)},bt.prototype._markDirty=function(e){const t=this._currentExecution;e&&(e=Ae(e)?e:[e],t.dirty=t.dirty.concat(e))},bt.prototype._executedAction=function(e,t){const n=++this._stackIdx;t||this._stack.splice(n,this._stack.length,e)},bt.prototype._revertedAction=function(e){this._stackIdx--},bt.prototype._getHandler=function(e){return this._handlerMap[e]},bt.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 GA={commandStack:["type",bt]};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 VA=250,Gy=1400;function Bp(e,t,n){ee.call(this,t);var i=e.get("movePreview",!1);t.on("shape.move.start",Gy,function(r){var o=r.context,a=o.shapes,s=o.validatedShapes;o.shapes=Vy(a),o.validatedShapes=Vy(s)}),i&&t.on("shape.move.start",VA,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",Gy,function(r){var o=r.context,a=o.closure,s=a.enclosedElements,c=[];L(s,function(u){L(u.labels,function(l){s[l.id]||c.push(l)})}),a.addAll(c)}),this.preExecute(["connection.delete","shape.delete"],function(r){var o=r.context,a=o.connection||o.shape;fr(a.labels,function(s){n.removeShape(s,{nested:!0})})}),this.execute("shape.delete",function(r){var o=r.context,a=o.shape,s=a.labelTarget;s&&(o.labelTargetIndex=ml(s.labels,a),o.labelTarget=s,a.labelTarget=null)}),this.revert("shape.delete",function(r){var o=r.context,a=o.shape,s=o.labelTarget,c=o.labelTargetIndex;s&&(Ct(s.labels,a,c),a.labelTarget=s)})}he(Bp,ee),Bp.$inject=["injector","eventBus","modeling"];function Vy(e){var t=new Set(e);return ze(e,function(n){return!t.has(n.labelTarget)})}const WA={__init__:["labelSupport"],labelSupport:["type",Bp]};var UA=251,Wy=1401,Uy="attach-ok";function Np(e,t,n,i,r){ee.call(this,t);var o=e.get("movePreview",!1);t.on("shape.move.start",Wy,function(a){var s=a.context,c=s.shapes,u=s.validatedShapes;s.shapes=qA(c),s.validatedShapes=YA(u)}),o&&t.on("shape.move.start",UA,function(a){var s=a.context,c=s.shapes,u=$p(c);L(u,function(l){o.makeDraggable(s,l,!0),L(l.labels,function(p){o.makeDraggable(s,p,!0)})})}),o&&t.on("shape.move.start",function(a){var s=a.context,c=s.shapes;if(c.length===1){var u=c[0],l=u.host;l&&(n.addMarker(l,Uy),t.once(["shape.move.out","shape.move.cleanup"],function(){n.removeMarker(l,Uy)}))}}),this.preExecuted("elements.move",Wy,function(a){var s=a.context,c=s.closure,u=s.shapes,l=$p(u);L(l,function(p){c.add(p,c.topLevel[p.host.id])})}),this.postExecuted("elements.move",function(a){var s=a.context,c=s.shapes,u=s.newHost,l;u&&c.length!==1||(u?l=c:l=ze(c,function(p){var f=p.host;return KA(p)&&!XA(c,f)}),L(l,function(p){r.updateAttachment(p,u)}))}),this.postExecuted("elements.move",function(a){var s=a.context.shapes;L(s,function(c){L(c.attachers,function(u){L(u.outgoing.slice(),function(l){var p=i.allowed("connection.reconnect",{connection:l,source:l.source,target:l.target});p||r.removeConnection(l)}),L(u.incoming.slice(),function(l){var p=i.allowed("connection.reconnect",{connection:l,source:l.source,target:l.target});p||r.removeConnection(l)})})})}),this.postExecute("shape.create",function(a){var s=a.context,c=s.shape,u=s.host;u&&r.updateAttachment(c,u)}),this.postExecute("shape.replace",function(a){var s=a.context,c=s.oldShape,u=s.newShape;fr(c.attachers,function(l){var p=i.allowed("elements.move",{target:u,shapes:[l]});p==="attach"?r.updateAttachment(l,u):r.removeShape(l)}),u.attachers.length&&L(u.attachers,function(l){var p=lg(l,c,u);r.moveShape(l,p,l.parent)})}),this.postExecute("shape.resize",function(a){var s=a.context,c=s.shape,u=s.oldBounds,l=s.newBounds,p=c.attachers,f=s.hints||{};f.attachSupport!==!1&&L(p,function(d){var g=lg(d,u,l);r.moveShape(d,g,d.parent),L(d.labels,function(h){r.moveShape(h,g,h.parent)})})}),this.preExecute("shape.delete",function(a){var s=a.context.shape;fr(s.attachers,function(c){r.removeShape(c)}),s.host&&r.updateAttachment(s,null)})}he(Np,ee),Np.$inject=["injector","eventBus","canvas","rules","modeling"];function $p(e){return ku(cn(e,function(t){return t.attachers||[]}))}function qA(e){var t=$p(e);return O0("id",e,t)}function YA(e){var t=no(e,"id");return ze(e,function(n){for(;n;){if(n.host&&t[n.host.id])return!1;n=n.parent}return!0})}function KA(e){return!!e.host}function XA(e,t){return e.indexOf(t)!==-1}const ZA={__depends__:[yi],__init__:["attachSupport"],attachSupport:["type",Np]};function qy(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(jh(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)})}qy.$inject=["eventBus","canvas","elementRegistry","graphicsFactory"];const jp={__init__:["changeSupport"],changeSupport:["type",qy]};function qn(e){this._model=e}qn.$inject=["moddle"],qn.prototype._needsId=function(e){return He(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"])},qn.prototype._ensureId=function(e){if(e.id){this._model.ids.claim(e.id,e);return}var t;_(e,"bpmn:Activity")?t="Activity":_(e,"bpmn:Event")?t="Event":_(e,"bpmn:Gateway")?t="Gateway":He(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))},qn.prototype.create=function(e,t){var n=this._model.create(e,t||{});return this._ensureId(n),n},qn.prototype.createDiLabel=function(){return this.create("bpmndi:BPMNLabel",{bounds:this.createDiBounds()})},qn.prototype.createDiShape=function(e,t){return this.create("bpmndi:BPMNShape",j({bpmnElement:e,bounds:this.createDiBounds()},t))},qn.prototype.createDiBounds=function(e){return this.create("dc:Bounds",e)},qn.prototype.createDiWaypoints=function(e){var t=this;return cn(e,function(n){return t.createDiWaypoint(n)})},qn.prototype.createDiWaypoint=function(e){return this.create("dc:Point",ti(e,["x","y"]))},qn.prototype.createDiEdge=function(e,t){return this.create("bpmndi:BPMNEdge",j({bpmnElement:e,waypoint:this.createDiWaypoints([])},t))},qn.prototype.createDiPlane=function(e,t){return this.create("bpmndi:BPMNPlane",j({bpmnElement:e},t))};function Mn(e,t,n){ee.call(this,e),this._bpmnFactory=t;var i=this;function r(d){var g=d.context,h=g.hints||{},m;!g.cropped&&h.createElementsBehavior!==!1&&(m=g.connection,m.waypoints=n.getCroppedWaypoints(m),g.cropped=!0)}this.executed(["connection.layout","connection.create"],r),this.reverted(["connection.layout"],function(d){delete d.context.cropped});function o(d){var g=d.context;i.updateParent(g.shape||g.connection,g.oldParent)}function a(d){var g=d.context,h=g.shape||g.connection,m=g.parent||g.newParent;i.updateParent(h,m)}this.executed(["shape.move","shape.create","shape.delete","connection.create","connection.move","connection.delete"],kn(o)),this.reverted(["shape.move","shape.create","shape.delete","connection.create","connection.move","connection.delete"],kn(a));function s(d){var g=d.context,h=g.oldRoot,m=h.children;L(m,function(S){_(S,"bpmn:BaseElement")&&i.updateParent(S)})}this.executed(["canvas.updateRoot"],s),this.reverted(["canvas.updateRoot"],s);function c(d){var g=d.context.shape;_(g,"bpmn:BaseElement")&&i.updateBounds(g)}this.executed(["shape.move","shape.create","shape.resize"],kn(function(d){d.context.shape.type!=="label"&&c(d)})),this.reverted(["shape.move","shape.create","shape.resize"],kn(function(d){d.context.shape.type!=="label"&&c(d)})),e.on("shape.changed",function(d){d.element.type==="label"&&c({context:{shape:d.element}})});function u(d){i.updateConnection(d.context)}this.executed(["connection.create","connection.move","connection.delete","connection.reconnect"],kn(u)),this.reverted(["connection.create","connection.move","connection.delete","connection.reconnect"],kn(u));function l(d){i.updateConnectionWaypoints(d.context.connection)}this.executed(["connection.layout","connection.move","connection.updateWaypoints"],kn(l)),this.reverted(["connection.layout","connection.move","connection.updateWaypoints"],kn(l)),this.executed("connection.reconnect",kn(function(d){var g=d.context,h=g.connection,m=g.oldSource,S=g.newSource,y=te(h),x=te(m),E=te(S);y.conditionExpression&&!He(E,["bpmn:Activity","bpmn:ExclusiveGateway","bpmn:InclusiveGateway"])&&(g.oldConditionExpression=y.conditionExpression,delete y.conditionExpression),m!==S&&x.default===y&&(g.oldDefault=x.default,delete x.default)})),this.reverted("connection.reconnect",kn(function(d){var g=d.context,h=g.connection,m=g.oldSource,S=g.newSource,y=te(h),x=te(m),E=te(S);g.oldConditionExpression&&(y.conditionExpression=g.oldConditionExpression),g.oldDefault&&(x.default=g.oldDefault,delete E.default)}));function p(d){i.updateAttachment(d.context)}this.executed(["element.updateAttachment"],kn(p)),this.reverted(["element.updateAttachment"],kn(p)),this.executed("element.updateLabel",kn(f)),this.reverted("element.updateLabel",kn(f));function f(d){const{element:g}=d.context,h=Bn(g),m=Ke(g),S=m&&m.get("label");or(g)||ac(g)||(h&&!S?m.set("label",t.create("bpmndi:BPMNLabel")):!h&&S&&m.set("label",void 0))}}he(Mn,ee),Mn.$inject=["eventBus","bpmnFactory","connectionDocking"],Mn.prototype.updateAttachment=function(e){var t=e.shape,n=t.businessObject,i=t.host;n.attachedToRef=i&&i.businessObject},Mn.prototype.updateParent=function(e,t){if(!je(e)&&!(_(e,"bpmn:DataStoreReference")&&e.parent&&_(e.parent,"bpmn:Collaboration"))){var n=e.parent,i=e.businessObject,r=Ke(e),o=n&&n.businessObject,a=Ke(n);_(e,"bpmn:FlowNode")&&this.updateFlowNodeRefs(i,o,t&&t.businessObject),_(e,"bpmn:DataOutputAssociation")&&(e.source?o=e.source.businessObject:o=null),_(e,"bpmn:DataInputAssociation")&&(e.target?o=e.target.businessObject:o=null),this.updateSemanticParent(i,o),_(e,"bpmn:DataObjectReference")&&i.dataObjectRef&&this.updateSemanticParent(i.dataObjectRef,o),this.updateDiParent(r,a)}},Mn.prototype.updateBounds=function(e){var t=Ke(e),n=JA(e);if(n){var i=ni(n,t.get("bounds"));j(n,{x:e.x+i.x,y:e.y+i.y})}var r=je(e)?this._getLabel(t):t,o=r.bounds;o||(o=this._bpmnFactory.createDiBounds(),r.set("bounds",o)),j(o,{x:e.x,y:e.y,width:e.width,height:e.height})},Mn.prototype.updateFlowNodeRefs=function(e,t,n){if(n!==t){var i,r;_(n,"bpmn:Lane")&&(i=n.get("flowNodeRef"),St(i,e)),_(t,"bpmn:Lane")&&(r=t.get("flowNodeRef"),Ct(r,e))}},Mn.prototype.updateDiConnection=function(e,t,n){var i=Ke(e),r=Ke(t),o=Ke(n);i.sourceElement&&i.sourceElement.bpmnElement!==te(t)&&(i.sourceElement=t&&r),i.targetElement&&i.targetElement.bpmnElement!==te(n)&&(i.targetElement=n&&o)},Mn.prototype.updateDiParent=function(e,t){if(t&&!_(t,"bpmndi:BPMNPlane")&&(t=t.$parent),e.$parent!==t){var n=(t||e.$parent).get("planeElement");t?(n.push(e),e.$parent=t):(St(n,e),e.$parent=null)}};function QA(e){for(;e&&!_(e,"bpmn:Definitions");)e=e.$parent;return e}Mn.prototype.getLaneSet=function(e){var t,n;return _(e,"bpmn:Lane")?(t=e.childLaneSet,t||(t=this._bpmnFactory.create("bpmn:LaneSet"),e.childLaneSet=t,t.$parent=e),t):(_(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)},Mn.prototype.updateSemanticParent=function(e,t,n){var i;if(e.$parent!==t&&!((_(e,"bpmn:DataInput")||_(e,"bpmn:DataOutput"))&&(_(t,"bpmn:Participant")&&"processRef"in t&&(t=t.processRef),"ioSpecification"in t&&t.ioSpecification===e.$parent))){if(_(e,"bpmn:Lane"))t&&(t=this.getLaneSet(t)),i="lanes";else if(_(e,"bpmn:FlowElement")){if(t){if(_(t,"bpmn:Participant"))t=t.processRef;else if(_(t,"bpmn:Lane"))do t=t.$parent.$parent;while(_(t,"bpmn:Lane"))}i="flowElements"}else if(_(e,"bpmn:Artifact")){for(;t&&!_(t,"bpmn:Process")&&!_(t,"bpmn:SubProcess")&&!_(t,"bpmn:Collaboration");)if(_(t,"bpmn:Participant")){t=t.processRef;break}else t=t.$parent;i="artifacts"}else if(_(e,"bpmn:MessageFlow"))i="messageFlows";else if(_(e,"bpmn:Participant")){i="participants";var r=e.processRef,o;r&&(o=QA(e.$parent||t),e.$parent&&(St(o.get("rootElements"),r),r.$parent=null),t&&(Ct(o.get("rootElements"),r),r.$parent=o))}else _(e,"bpmn:DataOutputAssociation")?i="dataOutputAssociations":_(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),St(a,e)),t?(a=t.get(i),a.push(e),e.$parent=t):e.$parent=null,n){var s=n.get(i);St(a,e),t&&(s||(s=[],t.set(i,s)),s.push(e))}}},Mn.prototype.updateConnectionWaypoints=function(e){var t=Ke(e);t.set("waypoint",this._bpmnFactory.createDiWaypoints(e.waypoints))},Mn.prototype.updateConnection=function(e){var t=e.connection,n=te(t),i=t.source,r=te(i),o=t.target,a=te(t.target),s;if(_(n,"bpmn:DataAssociation"))_(n,"bpmn:DataInputAssociation")?(n.get("sourceRef")[0]=r,s=e.parent||e.newParent||a,this.updateSemanticParent(n,a,s)):_(n,"bpmn:DataOutputAssociation")&&(s=e.parent||e.newParent||r,this.updateSemanticParent(n,r,s),n.targetRef=a);else{var c=_(n,"bpmn:SequenceFlow");n.sourceRef!==r&&(c&&(St(n.sourceRef&&n.sourceRef.get("outgoing"),n),r&&r.get("outgoing")&&r.get("outgoing").push(n)),n.sourceRef=r),n.targetRef!==a&&(c&&(St(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)},Mn.prototype._getLabel=function(e){return e.label||(e.label=this._bpmnFactory.createDiLabel()),e.label};function kn(e){return function(t){var n=t.context,i=n.shape||n.connection||n.element;_(i,"bpmn:BaseElement")&&e(t)}}function JA(e){if(_(e,"bpmn:Activity")){var t=Ke(e);if(t){var n=t.get("label");if(n)return n.get("bounds")}}}function dr(e,t){Li.call(this),this._bpmnFactory=e,this._moddle=t}he(dr,Li),dr.$inject=["bpmnFactory","moddle"],dr.prototype._baseCreate=Li.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},Br,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(!tT(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)}_(i,"bpmn:Group")&&(t=j({isFrame:!0},t)),t=eT(i,t,["processRef","isInterrupting","associationDirection","isForCompensation"]),t.isExpanded&&(t=Fp(r,t,"isExpanded")),He(i,["bpmn:Lane","bpmn:Participant"])&&(t=Fp(r,t,"isHorizontal")),_(i,"bpmn:SubProcess")&&(t.collapsed=!qe(i,r)),_(i,"bpmn:ExclusiveGateway")&&(wn(r,"isMarkerVisible")?r.isMarkerVisible===void 0&&(r.isMarkerVisible=!1):r.isMarkerVisible=!0),Ht(t.triggeredByEvent)&&(i.triggeredByEvent=t.triggeredByEvent,delete t.triggeredByEvent),Ht(t.cancelActivity)&&(i.cancelActivity=t.cancelActivity,delete t.cancelActivity);var a,s;return t.eventDefinitionType&&(a=i.get("eventDefinitions")||[],s=this._bpmnFactory.create(t.eventDefinitionType,t.eventDefinitionAttrs),t.eventDefinitionType==="bpmn:ConditionalEventDefinition"&&(s.condition=this._bpmnFactory.create("bpmn:FormalExpression")),a.push(s),s.$parent=i,i.eventDefinitions=a,delete t.eventDefinitionType),n=this.getDefaultSize(i,r),t=j({id:i.id},n,t,{businessObject:i,di:r}),this._baseCreate(e,t)},dr.prototype.getDefaultSize=function(e,t){var n=te(e);if(t=t||Ke(e),_(n,"bpmn:SubProcess"))return qe(n,t)?{width:350,height:200}:{width:100,height:80};if(_(n,"bpmn:Task"))return{width:100,height:80};if(_(n,"bpmn:Gateway"))return{width:50,height:50};if(_(n,"bpmn:Event"))return{width:36,height:36};if(_(n,"bpmn:Participant")){var i=t.isHorizontal===void 0||t.isHorizontal===!0;return qe(n,t)?i?{width:600,height:250}:{width:250,height:600}:i?{width:400,height:60}:{width:60,height:400}}return _(n,"bpmn:Lane")?{width:400,height:100}:_(n,"bpmn:DataObjectReference")?{width:36,height:50}:_(n,"bpmn:DataStoreReference")?{width:50,height:50}:_(n,"bpmn:TextAnnotation")?{width:100,height:40}:_(n,"bpmn:Group")?{width:300,height:300}:{width:100,height:80}},dr.prototype.createParticipantShape=function(e){return Yt(e)||(e={isExpanded:e}),e=j({type:"bpmn:Participant"},e||{}),e.isExpanded!==!1&&(e.processRef=this._bpmnFactory.create("bpmn:Process")),this.createShape(e)};function eT(e,t,n){return L(n,function(i){t=Fp(e,t,i)}),t}function Fp(e,t,n){return t[n]===void 0?t:(e[n]=t[n],ai(t,[n]))}function tT(e){return He(e,["bpmndi:BPMNShape","bpmndi:BPMNEdge","bpmndi:BPMNDiagram","bpmndi:BPMNPlane"])}function xc(e,t){this._modeling=e,this._canvas=t}xc.$inject=["modeling","canvas"],xc.prototype.preExecute=function(e){var t=this._modeling,n=e.elements,i=e.alignment;L(n,function(r){var o={x:0,y:0};Ht(i.left)?o.x=i.left-r.x:Ht(i.right)?o.x=i.right-r.width-r.x:Ht(i.center)?o.x=i.center-Math.round(r.width/2)-r.x:Ht(i.top)?o.y=i.top-r.y:Ht(i.bottom)?o.y=i.bottom-r.height-r.y:Ht(i.middle)&&(o.y=i.middle-Math.round(r.height/2)-r.y),t.moveElements([r],o,r.parent)})},xc.prototype.postExecute=function(e){};function wc(e){this._modeling=e}wc.$inject=["modeling"],wc.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},wc.prototype.postExecute=function(e){var t=e.hints||{};nT(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 nT(e,t){return Yi(e.outgoing,function(n){return n.target===t})}function Ec(e,t){this._canvas=e,this._layouter=t}Ec.$inject=["canvas","layouter"],Ec.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},Ec.prototype.revert=function(e){var t=e.connection;return this._canvas.removeConnection(t),t.source=null,t.target=null,t};var Sc=Math.round;function Hp(e){this._modeling=e}Hp.$inject=["modeling"],Hp.prototype.preExecute=function(e){var t=e.elements,n=e.parent,i=e.parentIndex,r=e.position,o=e.hints,a=this._modeling;L(t,function(p){De(p.x)||(p.x=0),De(p.y)||(p.y=0)});var s=ze(t,function(p){return!p.hidden}),c=Ot(s);L(t,function(p){ct(p)&&(p.waypoints=cn(p.waypoints,function(f){return{x:Sc(f.x-c.x-c.width/2+r.x),y:Sc(f.y-c.y-c.height/2+r.y)}})),j(p,{x:Sc(p.x-c.x-c.width/2+r.x),y:Sc(p.y-c.y-c.height/2+r.y)})});var u=new Set(Cs(t)),l={};L(t,function(p){if(ct(p)){l[p.id]=De(i)?a.createConnection(l[p.source.id],l[p.target.id],i,p,p.parent||n,o):a.createConnection(l[p.source.id],l[p.target.id],p,p.parent||n,o);return}var f=j({},o);u.has(p)||(f.autoResize=!1),je(p)&&(f=ai(f,["attach"])),l[p.id]=De(i)?a.createShape(p,ti(p,["x","y","width","height"]),p.parent||n,i,f):a.createShape(p,ti(p,["x","y","width","height"]),p.parent||n,f)}),e.elements=to(l)};var Yy=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-Yy(t.width/2),y:n.y-Yy(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)}he(ba,hr),ba.$inject=["canvas"];var iT=hr.prototype.execute;ba.prototype.execute=function(e){var t=e.shape;return oT(t),t.labelTarget=e.labelTarget,iT.call(this,e)};var rT=hr.prototype.revert;ba.prototype.revert=function(e){return e.shape.labelTarget=null,rT.call(this,e)};function oT(e){["width","height"].forEach(function(t){typeof e[t]>"u"&&(e[t]=0)})}function _a(e,t){this._canvas=e,this._modeling=t}_a.$inject=["canvas","modeling"],_a.prototype.preExecute=function(e){var t=this._modeling,n=e.connection;fr(n.incoming,function(i){t.removeConnection(i,{nested:!0})}),fr(n.outgoing,function(i){t.removeConnection(i,{nested:!0})})},_a.prototype.execute=function(e){var t=e.connection,n=t.parent;return e.parent=n,e.parentIndex=ml(n.children,t),e.source=t.source,e.target=t.target,this._canvas.removeConnection(t),t.source=null,t.target=null,t},_a.prototype.revert=function(e){var t=e.connection,n=e.parent,i=e.parentIndex;return t.source=e.source,t.target=e.target,Ct(n.children,t,i),this._canvas.addConnection(t,n),t};function zp(e,t){this._modeling=e,this._elementRegistry=t}zp.$inject=["modeling","elementRegistry"],zp.prototype.postExecute=function(e){var t=this._modeling,n=this._elementRegistry,i=e.elements;L(i,function(r){n.get(r.id)&&(r.waypoints?t.removeConnection(r):t.removeShape(r))})};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.shape;fr(n.incoming,function(i){t.removeConnection(i,{nested:!0})}),fr(n.outgoing,function(i){t.removeConnection(i,{nested:!0})}),fr(n.children,function(i){ct(i)?t.removeConnection(i,{nested:!0}):t.removeShape(i,{nested:!0})})},xa.prototype.execute=function(e){var t=this._canvas,n=e.shape,i=n.parent;return e.oldParent=i,e.oldParentIndex=ml(i.children,n),t.removeShape(n),n},xa.prototype.revert=function(e){var t=this._canvas,n=e.shape,i=e.oldParent,r=e.oldParentIndex;return Ct(i.children,n,r),t.addShape(n,i),n};function Rc(e){this._modeling=e}Rc.$inject=["modeling"];var Ky={x:"y",y:"x"};Rc.prototype.preExecute=function(e){var t=this._modeling,n=e.groups,i=e.axis,r=e.dimension;function o(m,S){m.range.min=Math.min(S[i],m.range.min),m.range.max=Math.max(S[i]+S[r],m.range.max)}function a(m){return m[i]+m[r]/2}function s(m){return m.length-1}function c(m){return m.max-m.min}function u(m,S){var y={y:0};y[i]=m-a(S),y[i]&&(y[Ky[i]]=0,t.moveElements([S],y,S.parent))}var l=n[0],p=s(n),f=n[p],d,g,h=0;L(n,function(m,S){var y,x,E;if(m.elements.length<2){S&&S!==n.length-1&&(o(m,m.elements[0]),h+=c(m.range));return}y=oi(m.elements,i),x=y[0],S===p&&(x=y[s(y)]),E=a(x),m.range=null,L(y,function(P){if(u(E,P),m.range===null){m.range={min:P[i],max:P[i]+P[r]};return}o(m,P)}),S&&S!==n.length-1&&(h+=c(m.range))}),g=Math.abs(f.range.min-l.range.max),d=Math.round((g-h)/(n.length-1)),!(d<n.length-1)&&L(n,function(m,S){var y={},x;m===l||m===f||(x=n[S-1],m.range.max=0,L(m.elements,function(E,P){y[Ky[i]]=0,y[i]=x.range.max-E[i]+d,m.range.min!==E[i]&&(y[i]+=E[i]-m.range.min),y[i]&&t.moveElements([E],y,E.parent),m.range.max=Math.max(E[i]+E[r],P?m.range.max:0)}))})},Rc.prototype.postExecute=function(e){};function Cc(e,t){this._layouter=e,this._canvas=t}Cc.$inject=["layouter","canvas"],Cc.prototype.execute=function(e){var t=e.connection,n=t.waypoints;return j(e,{oldWaypoints:n}),t.waypoints=this._layouter.layoutConnection(t,e.hints),t},Cc.prototype.revert=function(e){var t=e.connection;return t.waypoints=e.oldWaypoints,t};function Gp(){}Gp.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=St(o.children,t),Ct(i.children,t,r),t.parent=i,L(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},Gp.prototype.revert=function(e){var t=e.connection,n=t.parent,i=e.oldParent,r=e.oldParentIndex,o=e.delta;return St(n.children,t),Ct(i.children,t,r),t.parent=i,L(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 Vp(){this.allShapes={},this.allConnections={},this.enclosedElements={},this.enclosedConnections={},this.topLevel={}}Vp.prototype.add=function(e,t){return this.addAll([e],t)},Vp.prototype.addAll=function(e,t){var n=I1(e,!!t,this);return j(this,n),this};function wa(e){this._modeling=e}wa.prototype.moveRecursive=function(e,t,n){return e?this.moveClosure(this.getClosure(e),t,n):[]},wa.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),L(a,function(p){o.moveShape(p,t,u[p.id]&&!l&&n,{recurse:!1,layout:!1})}),L(s,function(p){var f=!!a[p.source.id],d=!!a[p.target.id];c[p.id]&&f&&d?o.moveConnection(p,t,u[p.id]&&!l&&n):o.layoutConnection(p,{connectionStart:f&&Zl(p,p.source,t),connectionEnd:d&&Ql(p,p.target,t)})})},wa.prototype.getClosure=function(e){return new Vp().addAll(e,!0)};function Pc(e){this._helper=new wa(e)}Pc.$inject=["modeling"],Pc.prototype.preExecute=function(e){e.closure=this._helper.getClosure(e.shapes)},Pc.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 wa(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=ti(t,["x","y","width","height"]),e.oldParent=o,e.oldParentIndex=St(o.children,t),Ct(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&&(L(t.incoming,function(o){r.layoutConnection(o,{connectionEnd:Ql(o,t,n)})}),L(t.outgoing,function(o){r.layoutConnection(o,{connectionStart:Zl(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 Ct(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 Ea(e){this._modeling=e}Ea.$inject=["modeling"],Ea.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 Ae(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},Ea.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||Xy(Ae(r)?r[0]:r)),i&&(!n||o.docking==="target")&&(a.connectionEnd=a.connectionEnd||Xy(Ae(r)?r[r.length-1]:r)),o.newWaypoints&&(a.waypoints=o.newWaypoints),this._modeling.layoutConnection(t,a))},Ea.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 Xy(e){return e.original||e}function Fi(e,t){this._modeling=e,this._rules=t}Fi.$inject=["modeling","rules"],Fi.prototype.preExecute=function(e){var t=this,n=this._modeling,i=this._rules,r=e.oldShape,o=e.newData,a=e.hints||{},s;function c(g,h,m){return i.allowed("connection.reconnect",{connection:m,source:g,target:h})}var u={x:o.x,y:o.y},l={x:r.x,y:r.y,width:r.width,height:r.height};s=e.newShape=e.newShape||t.createShape(o,u,r.parent,a),r.host&&n.updateAttachment(s,r.host);var p;a.moveChildren!==!1&&(p=r.children.slice(),n.moveElements(p,{x:0,y:0},s,a));var f=r.incoming.slice(),d=r.outgoing.slice();L(f,function(g){var h=g.source,m=c(h,s,g);m&&t.reconnectEnd(g,s,ec(g,s,l),a)}),L(d,function(g){var h=g.target,m=c(s,h,g);m&&t.reconnectStart(g,s,Js(g,s,l),a)})},Fi.prototype.postExecute=function(e){var t=e.oldShape;this._modeling.removeShape(t)},Fi.prototype.execute=function(e){},Fi.prototype.revert=function(e){},Fi.prototype.createShape=function(e,t,n,i){return this._modeling.createShape(e,t,n,i)},Fi.prototype.reconnectStart=function(e,t,n,i){this._modeling.reconnectStart(e,t,n,i)},Fi.prototype.reconnectEnd=function(e,t,n,i){this._modeling.reconnectEnd(e,t,n,i)};function Sa(e){this._modeling=e}Sa.$inject=["modeling"],Sa.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},Sa.prototype.postExecute=function(e){var t=this._modeling,n=e.shape,i=e.oldBounds,r=e.hints||{};r.layout!==!1&&(L(n.incoming,function(o){t.layoutConnection(o,{connectionEnd:ec(o,n,i)})}),L(n.outgoing,function(o){t.layoutConnection(o,{connectionStart:Js(o,n,i)})}))},Sa.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),L(r,function(s){a[s.id]=sT(s)}),this.resizeShapes(r,t,n),this.updateConnectionWaypoints(LA(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;L(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;L(e,function(r){var o=IA(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);L(e,function(l){var p=l.source,f=l.target,d=aT(l),g=Qy(n),h={},m=c.has(p)||u.has(p),S=c.has(f)||u.has(f);m&&S?(d=cn(d,function(y){return Jy(y,i,n)&&(y[g]=y[g]+t[g]),y.original&&Jy(y.original,i,n)&&(y.original[g]=y.original[g]+t[g]),y}),s._modeling.updateWaypoints(l,d,{labelBehavior:!1})):(m||S)&&(c.has(p)?h.connectionStart=Zl(l,p,t):c.has(f)?h.connectionEnd=Ql(l,f,t):u.has(p)?h.connectionStart=Js(l,p,a[p.id]):u.has(f)&&(h.connectionEnd=ec(l,f,a[f.id])),s._modeling.layoutConnection(l,h))})};function Zy(e){return j({},e)}function aT(e){return cn(e.waypoints,function(t){return t=Zy(t),t.original&&(t.original=Zy(t.original)),t})}function Qy(e){switch(e){case"n":return"y";case"w":return"x";case"s":return"y";case"e":return"x"}}function Jy(e,t,n){var i=Qy(n);if(/e|s/.test(n))return e[i]>t;if(/n|w/.test(n))return e[i]<t}function sT(e){return{x:e.x,y:e.y,height:e.height,width:e.width}}function Ac(e){this._modeling=e}Ac.$inject=["modeling"],Ac.prototype.execute=function(e){var t=e.shape,n=t.children;e.oldChildrenVisibility=ev(n),t.collapsed=!t.collapsed;var i=tv(n,t.collapsed);return[t].concat(i)},Ac.prototype.revert=function(e){var t=e.shape,n=e.oldChildrenVisibility,i=t.children,r=nv(i,n);return t.collapsed=!t.collapsed,[t].concat(r)};function ev(e){var t={};return L(e,function(n){t[n.id]=n.hidden,n.children&&(t=j({},t,ev(n.children)))}),t}function tv(e,t){var n=[];return L(e,function(i){i.hidden=t,n=n.concat(i),i.children&&(n=n.concat(tv(i.children,i.collapsed||t)))}),n}function nv(e,t){var n=[];return L(e,function(i){i.hidden=t[i.id],n=n.concat(i),i.children&&(n=n.concat(nv(i.children,t)))}),n}function Tc(e){this._modeling=e}Tc.$inject=["modeling"],Tc.prototype.execute=function(e){var t=e.shape,n=e.newHost,i=t.host;return e.oldHost=i,e.attacherIdx=iv(i,t),rv(n,t),t.host=n,t},Tc.prototype.revert=function(e){var t=e.shape,n=e.newHost,i=e.oldHost,r=e.attacherIdx;return t.host=i,iv(n,t),rv(i,t,r),t};function iv(e,t){return St(e&&e.attachers,t)}function rv(e,t,n){if(e){var i=e.attachers;i||(e.attachers=i=[]),Ct(i,t,n)}}function Wp(){}Wp.prototype.execute=function(e){var t=e.connection,n=e.newWaypoints;return e.oldWaypoints=t.waypoints,t.waypoints=n,t},Wp.prototype.revert=function(e){var t=e.connection,n=e.oldWaypoints;return t.waypoints=n,t};function ut(e,t,n){this._eventBus=e,this._elementFactory=t,this._commandStack=n;var i=this;e.on("diagram.init",function(){i.registerHandlers(n)})}ut.$inject=["eventBus","elementFactory","commandStack"],ut.prototype.getHandlers=function(){return{"shape.append":wc,"shape.create":hr,"shape.delete":xa,"shape.move":zr,"shape.resize":Sa,"shape.replace":Fi,"shape.toggleCollapse":Ac,spaceTool:mr,"label.create":ba,"connection.create":Ec,"connection.delete":_a,"connection.move":Gp,"connection.layout":Cc,"connection.updateWaypoints":Wp,"connection.reconnect":Ea,"elements.create":Hp,"elements.move":Pc,"elements.delete":zp,"elements.distribute":Rc,"elements.align":xc,"element.updateAttachment":Tc}},ut.prototype.registerHandlers=function(e){L(this.getHandlers(),function(t,n){e.registerHandler(n,t)})},ut.prototype.moveShape=function(e,t,n,i,r){typeof i=="object"&&(r=i,i=null);var o={shape:e,delta:t,newParent:n,newParentIndex:i,hints:r||{}};this._commandStack.execute("shape.move",o)},ut.prototype.updateAttachment=function(e,t){var n={shape:e,newHost:t};this._commandStack.execute("element.updateAttachment",n)},ut.prototype.moveElements=function(e,t,n,i){i=i||{};var r=i.attach,o=n,a;r===!0?(a=n,o=n.parent):r===!1&&(a=null);var s={shapes:e,delta:t,newParent:o,newHost:a,hints:i};this._commandStack.execute("elements.move",s)},ut.prototype.moveConnection=function(e,t,n,i,r){typeof i=="object"&&(r=i,i=void 0);var o={connection:e,delta:t,newParent:n,newParentIndex:i,hints:r||{}};this._commandStack.execute("connection.move",o)},ut.prototype.layoutConnection=function(e,t){var n={connection:e,hints:t||{}};this._commandStack.execute("connection.layout",n)},ut.prototype.createConnection=function(e,t,n,i,r,o){typeof n=="object"&&(o=r,r=i,i=n,n=void 0),i=this._create("connection",i);var a={source:e,target:t,parent:r,parentIndex:n,connection:i,hints:o};return this._commandStack.execute("connection.create",a),a.connection},ut.prototype.createShape=function(e,t,n,i,r){typeof i!="number"&&(r=i,i=void 0),r=r||{};var o=r.attach,a,s;e=this._create("shape",e),o?(a=n.parent,s=n):a=n;var c={position:t,shape:e,parent:a,parentIndex:i,host:s,hints:r};return this._commandStack.execute("shape.create",c),c.shape},ut.prototype.createElements=function(e,t,n,i,r){Ae(e)||(e=[e]),typeof i!="number"&&(r=i,i=void 0),r=r||{};var o={position:t,elements:e,parent:n,parentIndex:i,hints:r};return this._commandStack.execute("elements.create",o),o.elements},ut.prototype.createLabel=function(e,t,n,i){n=this._create("label",n);var r={labelTarget:e,position:t,parent:i||e.parent,shape:n};return this._commandStack.execute("label.create",r),r.shape},ut.prototype.appendShape=function(e,t,n,i,r){r=r||{},t=this._create("shape",t);var o={source:e,position:n,target:i,shape:t,connection:r.connection,connectionParent:r.connectionParent,hints:r};return this._commandStack.execute("shape.append",o),o.shape},ut.prototype.removeElements=function(e){var t={elements:e};this._commandStack.execute("elements.delete",t)},ut.prototype.distributeElements=function(e,t,n){var i={groups:e,axis:t,dimension:n};this._commandStack.execute("elements.distribute",i)},ut.prototype.removeShape=function(e,t){var n={shape:e,hints:t||{}};this._commandStack.execute("shape.delete",n)},ut.prototype.removeConnection=function(e,t){var n={connection:e,hints:t||{}};this._commandStack.execute("connection.delete",n)},ut.prototype.replaceShape=function(e,t,n){var i={oldShape:e,newData:t,hints:n||{}};return this._commandStack.execute("shape.replace",i),i.newShape},ut.prototype.alignElements=function(e,t){var n={elements:e,alignment:t};this._commandStack.execute("elements.align",n)},ut.prototype.resizeShape=function(e,t,n,i){var r={shape:e,newBounds:t,minBounds:n,hints:i};this._commandStack.execute("shape.resize",r)},ut.prototype.createSpace=function(e,t,n,i,r){var o={delta:n,direction:i,movingShapes:e,resizingShapes:t,start:r};this._commandStack.execute("spaceTool",o)},ut.prototype.updateWaypoints=function(e,t,n){var i={connection:e,newWaypoints:t,hints:n||{}};this._commandStack.execute("connection.updateWaypoints",i)},ut.prototype.reconnect=function(e,t,n,i,r){var o={connection:e,newSource:t,newTarget:n,dockingOrPoints:i,hints:r||{}};this._commandStack.execute("connection.reconnect",o)},ut.prototype.reconnectStart=function(e,t,n,i){i||(i={}),this.reconnect(e,t,e.target,n,j(i,{docking:"source"}))},ut.prototype.reconnectEnd=function(e,t,n,i){i||(i={}),this.reconnect(e,e.source,t,n,j(i,{docking:"target"}))},ut.prototype.connect=function(e,t,n,i){return this.createConnection(e,t,n||{},e.parent,i)},ut.prototype._create=function(e,t){return _S(t)?t:this._elementFactory.create(e,t)},ut.prototype.toggleCollapse=function(e,t){var n={shape:e,hints:t||{}};this._commandStack.execute("shape.toggleCollapse",n)};function Ra(e){this._elementRegistry=e}Ra.$inject=["elementRegistry"],Ra.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||cT(n,Ja(i));return ov(n,i),e.oldProperties=o,e.changed=r,r},Ra.prototype.revert=function(e){var t=e.oldProperties,n=e.moddleElement,i=e.changed;return ov(n,t),i},Ra.prototype._getVisualReferences=function(e){var t=this._elementRegistry;return _(e,"bpmn:DataObject")?uT(e,t):[]};function cT(e,t){return En(t,function(n,i){return n[i]=e.get(i),n},{})}function ov(e,t){L(t,function(n,i){e.set(i,n)})}function uT(e,t){return t.filter(function(n){return _(n,"bpmn:DataObjectReference")&&te(n).dataObjectRef===e})}var Ca="default",Hi="id",av="di",lT={width:0,height:0};function Pa(e,t,n,i){this._elementRegistry=e,this._moddle=t,this._modeling=n,this._textRenderer=i}Pa.$inject=["elementRegistry","moddle","modeling","textRenderer"],Pa.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=mT(e.properties),s=e.oldProperties||pT(t,a);return sv(a,o)&&(r.unclaim(o[Hi]),i.updateId(t,a[Hi]),r.claim(a[Hi],o)),Ca in a&&(a[Ca]&&n.push(i.get(a[Ca].id)),o[Ca]&&n.push(i.get(o[Ca].id))),cv(t,a),e.oldProperties=s,e.changed=n,n},Pa.prototype.postExecute=function(e){var t=e.element,n=t.label,i=n&&te(n).name;if(i){var r=this._textRenderer.getExternalLabelBounds(n,i);this._modeling.resizeShape(n,r,lT)}},Pa.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 cv(t,i),sv(n,r)&&(a.unclaim(n[Hi]),o.updateId(t,i[Hi]),a.claim(i[Hi],r)),e.changed};function sv(e,t){return Hi in e&&e[Hi]!==t[Hi]}function pT(e,t){var n=Ja(t),i=e.businessObject,r=Ke(e);return En(n,function(o,a){return a!==av?o[a]=i.get(a):o[a]=fT(r,Ja(t.di)),o},{})}function fT(e,t){return En(t,function(n,i){return n[i]=e&&e.get(i),n},{})}function cv(e,t){var n=e.businessObject,i=Ke(e);L(t,function(r,o){o!==av?n.set(o,r):i&&dT(i,r)})}function dT(e,t){L(t,function(n,i){e.set(i,n)})}var hT=["default"];function mT(e){var t=j({},e);return hT.forEach(function(n){n in e&&(t[n]=te(t[n]))}),t}function Mc(e,t){this._canvas=e,this._modeling=t}Mc.$inject=["canvas","modeling"],Mc.prototype.execute=function(e){var t=this._canvas,n=e.newRoot,i=n.businessObject,r=t.getRootElement(),o=r.businessObject,a=o.$parent,s=Ke(r);return t.setRootElement(n),t.removeRootElement(r),Ct(a.rootElements,i),i.$parent=a,St(a.rootElements,o),o.$parent=null,r.di=null,s.bpmnElement=i,n.di=s,e.oldRoot=r,[]},Mc.prototype.revert=function(e){var t=this._canvas,n=e.newRoot,i=n.businessObject,r=e.oldRoot,o=r.businessObject,a=i.$parent,s=Ke(n);return t.setRootElement(r),t.removeRootElement(n),St(a.rootElements,i),i.$parent=null,Ct(a.rootElements,o),o.$parent=a,n.di=null,s.bpmnElement=o,r.di=s,[]};function Up(e,t){this._modeling=e,this._spaceTool=t}Up.$inject=["modeling","spaceTool"],Up.prototype.preExecute=function(e){var t=this._spaceTool,n=this._modeling,i=e.shape,r=e.location,o=Gn(i),a=o===i,s=a?i:i.parent,c=sr(s),u=Zt(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+zn,y:i.y,width:i.width-zn,height:i.height}:{x:i.x,y:i.y+zn,width:i.width,height:i.height-zn};n.createShape({type:"bpmn:Lane",isHorizontal:u},l,s)}var p=[];Lr(o,function(E){return p.push(E),E.label&&p.push(E.label),E===i?[]:ze(E.children,function(P){return P!==i})});var f,d,g,h,m;r==="top"?(f=-120,d=i.y,g=d+10,h="n",m="y"):r==="left"?(f=-120,d=i.x,g=d+10,h="w",m="x"):r==="bottom"?(f=120,d=i.y+i.height,g=d-10,h="s",m="y"):r==="right"&&(f=120,d=i.x+i.width,g=d-10,h="e",m="x");var S=t.calculateAdjustments(p,m,f,g),y=u?{x:0,y:f}:{x:f,y:0};t.makeSpace(S.movingShapes,S.resizingShapes,y,h,g);var x=u?{x:i.x+(a?zn:0),y:d-(r==="top"?120:0),width:i.width-(a?zn:0),height:120}:{x:d-(r==="left"?120:0),y:i.y+(a?zn:0),width:120,height:i.height-(a?zn:0)};e.newLane=n.createShape({type:"bpmn:Lane",isHorizontal:u},x,s)};function qp(e){this._modeling=e}qp.$inject=["modeling"],qp.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=Zt(n),s=a?n.height:n.width,c=Math.round(s/i),u,l,p,f;for(f=0;f<i;f++)f===i-1?u=s-c*f:u=c,l=a?{x:n.x+zn,y:n.y+f*c,width:n.width-zn,height:u}:{x:n.x+f*c,y:n.y+zn,width:u,height:n.height-zn},f<o?t.resizeShape(r[f],l):(p={type:"bpmn:Lane",isHorizontal:a},t.createShape(p,l,n))};function Aa(e,t){this._modeling=e,this._spaceTool=t}Aa.$inject=["modeling","spaceTool"],Aa.prototype.preExecute=function(e){var t=e.shape,n=e.newBounds,i=e.balanced;i!==!1?this.resizeBalanced(t,n):this.resizeSpace(t,n)},Aa.prototype.resizeBalanced=function(e,t){var n=this._modeling,i=uC(e,t);n.resizeShape(e,t),i.forEach(function(r){n.resizeShape(r.shape,r.newBounds)})},Aa.prototype.resizeSpace=function(e,t){var n=this._spaceTool,i=Re(e),r=Re(t),o=Fm(r,i),a=Gn(e),s=[],c=[];Lr(a,function(g){return s.push(g),(_(g,"bpmn:Lane")||_(g,"bpmn:Participant"))&&c.push(g),g.children});var u,l,p,f,d;(o.bottom||o.top)&&(u=o.bottom||o.top,l=e.y+(o.bottom?e.height:0)+(o.bottom?-10:10),p=o.bottom?"s":"n",f=o.top>0||o.bottom<0?-u:u,d=n.calculateAdjustments(s,"y",f,l),n.makeSpace(d.movingShapes,d.resizingShapes,{x:0,y:u},p)),(o.left||o.right)&&(u=o.right||o.left,l=e.x+(o.right?e.width:0)+(o.right?-10:100),p=o.right?"e":"w",f=o.left>0||o.right<0?-u:u,d=n.calculateAdjustments(c,"x",f,l),n.makeSpace(d.movingShapes,d.resizingShapes,{x:u,y:0},p))};var Ta="flowNodeRef",Yp="lanes";function kc(){}kc.prototype._computeUpdates=function(e,t){var n=[],i=[],r={},o=[];function a(l,p){var f=Re(p),d={x:l.x+l.width/2,y:l.y+l.height/2};return d.x>f.left&&d.x<f.right&&d.y>f.top&&d.y<f.bottom}function s(l){n.indexOf(l)===-1&&(o.push(l),n.push(l))}function c(l){var p=Gn(l);return r[p.id]||(r[p.id]=Ys(p)),r[p.id]}function u(l){if(!l.parent)return[];var p=c(l);return p.filter(function(f){return a(l,f)}).map(function(f){return f.businessObject})}return t.forEach(function(l){var p=Gn(l);if(!(!p||n.indexOf(p)!==-1)){var f=p.children.filter(function(d){return _(d,"bpmn:FlowNode")});f.forEach(s),n.push(p)}}),e.forEach(s),o.forEach(function(l){var p=l.businessObject,f=p.get(Yp),d=f.slice(),g=u(l);i.push({flowNode:p,remove:d,add:g})}),t.forEach(function(l){var p=l.businessObject;l.parent||p.get(Ta).forEach(function(f){i.push({flowNode:f,remove:[p],add:[]})})}),i},kc.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(Yp);n.remove.forEach(function(o){St(r,o),St(o.get(Ta),i)}),n.add.forEach(function(o){Ct(r,o),Ct(o.get(Ta),i)})}),[]},kc.prototype.revert=function(e){var t=e.updates;return t.forEach(function(n){var i=n.flowNode,r=i.get(Yp);n.add.forEach(function(o){St(r,o),St(o.get(Ta),i)}),n.remove.forEach(function(o){Ct(r,o),Ct(o.get(Ta),i)})}),[]};var Kp="categoryValueRef";function Ma(e,t){this._bpmnFactory=e,this._elementRegistry=t}Ma.$inject=["bpmnFactory","elementRegistry"],Ma.prototype._computeUpdates=function(e,t){var n=this._elementRegistry,i=this._bpmnFactory,r=new Map,o=[],a=new Map;function s(y,x,E){if(x){var P=a.get(y);P||(P={},a.set(y,P)),!(E&&P.present)&&(!E&&P.past||(E?P.present={categoryValue:x,root:Xp(y)}:P.past={categoryValue:x}))}}function c(y){r.set(y,te(y))}function u(){n.filter(function(y){return _(y,"bpmn:FlowElement")&&!je(y)&&y.parent}).forEach(c)}function l(y){var x=te(y),E=x.get("categoryValueRef");return E||(E=Im(i,x),o.push(gT(y,E))),E}function p(y){return y.reduce(function(x,E){var P=Xp(E),C=x.get(P);return C||(C=[],x.set(P,C)),C.push(E),x},new Map)}e=Array.from(e||[]);var f=p(e);t.length&&u(),e.forEach(c),n.filter(function(y){return _(y,"bpmn:Group")&&!je(y)&&y.parent}).forEach(function(y){var x=te(y).get("categoryValueRef");if(!x){var E=Xp(y),P=f.get(E)||[],C=lo(P,y),D=Object.keys(C).length>0;D&&(x=l(y))}s(y,x,!0)}),t.forEach(function(y){s(y.groupShape,y.categoryValue,!1)}),o.length&&u();var d=Array.from(r.keys()),g=Array.from(a.values()).reduce(function(y,x){return x.present&&y.add(x.present.categoryValue),x.past&&y.add(x.past.categoryValue),y},new Set),h=new Map,m=p(d);a.forEach(function(y,x){var E=y.present;if(E){var P=m.get(E.root)||[],C=lo(P,x);P.forEach(function(D){if(C[D.id]){var A=h.get(D);A||(A=new Set,h.set(D,A)),A.add(E.categoryValue)}})}});var S=d.reduce(function(y,x){var E=r.get(x),P=E.get(Kp),C=new Set(P),D=h.get(x)||new Set,A=Array.from(D).filter(function(k){return!C.has(k)}),I=P.filter(function(k){return g.has(k)&&!D.has(k)});return(A.length||I.length)&&y.push({businessObject:E,categoryValuesToAdd:A,categoryValuesToRemove:I}),y},[]);return{flowElements:S,groups:o}},Ma.prototype.execute=function(e){var t=e.updates;return t||(t=e.updates=this._computeUpdates(e.affectedFlowElements,e.affectedGroupEntries)),yT(t.groups),bT(t.flowElements),[]},Ma.prototype.revert=function(e){var t=e.updates;return _T(t.flowElements),vT(t.groups),[]};function gT(e,t){return{groupShape:e,categoryValue:t,category:t.$parent}}function yT(e){e.forEach(function(t){te(t.groupShape).categoryValueRef=t.categoryValue,t.categoryValue.$parent=t.category})}function vT(e){e.forEach(function(t){te(t.groupShape).categoryValueRef=null})}function bT(e){e.forEach(function(t){var n=t.businessObject,i=n.get(Kp);t.categoryValuesToRemove.forEach(function(r){St(i,r)}),t.categoryValuesToAdd.forEach(function(r){Ct(i,r,!0)})})}function _T(e){e.forEach(function(t){var n=t.businessObject,i=n.get(Kp);t.categoryValuesToAdd.forEach(function(r){St(i,r)}),t.categoryValuesToRemove.forEach(function(r){Ct(i,r,!0)})})}function Xp(e){for(;e.parent;)e=e.parent;return e}function Oc(e){this._moddle=e}Oc.$inject=["moddle"],Oc.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),[]},Oc.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 xT={fill:void 0,stroke:void 0};function Zp(e){this._commandStack=e,this._normalizeColor=function(t){if(t){if(xn(t)){var n=wT(t);if(n)return n}throw new Error(`invalid color value: ${t}`)}}}Zp.$inject=["commandStack"],Zp.prototype.postExecute=function(e){var t=e.elements,n=e.colors||xT,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)}),L(t,function(o){var a=ct(o)?ti(r,["border-color"]):r,s=Ke(o);if(ET(a),je(o)){if(!s||!_(s.label,"bpmndi:BPMNLabel"))return;i._commandStack.execute("element.updateModdleProperties",{element:o,moddleElement:s.label,properties:{color:r["border-color"]}})}else{if(!He(s,["bpmndi:BPMNEdge","bpmndi:BPMNShape"]))return;i._commandStack.execute("element.updateProperties",{element:o,properties:{di:a}})}})};function wT(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 ET(e){"border-color"in e&&(e.stroke=e["border-color"]),"background-color"in e&&(e.fill=e["background-color"])}var ST={width:0,height:0};function uv(e,t,n){function i(c,u){var l=c.label||c,p=c.labelTarget||c;return QS(l,u),[l,p]}function r(c){var u=c.element,l=u.businessObject,p=c.newLabel;if(!je(u)&&or(u)&&!Is(u)&&!lv(p)){var f=7,d=xl(u);d={x:d.x,y:d.y+f},e.createLabel(u,d,{id:l.id+"_label",businessObject:l,di:u.di})}}function o(c){return c.oldLabel=Bn(c.element),i(c.element,c.newLabel)}function a(c){return i(c.element,c.oldLabel)}function s(c){var u=c.element,l=u.label||u,p=c.newLabel,f=c.newBounds,d=c.hints||{};if(!(!je(l)&&!_(l,"bpmn:TextAnnotation"))){if(je(l)&&lv(p)){d.removeShape!==!1&&e.removeShape(l,{unsetLabel:!1});return}var g=Bn(u);typeof f>"u"&&(f=t.getExternalLabelBounds(l,g)),f&&e.resizeShape(l,f,ST)}}this.preExecute=r,this.execute=o,this.revert=a,this.postExecute=s}uv.$inject=["modeling","textRenderer","bpmnFactory"];function lv(e){return!e||!e.trim()}function an(e,t,n,i){ut.call(this,e,t,n),this._bpmnRules=i}he(an,ut),an.$inject=["eventBus","elementFactory","commandStack","bpmnRules"],an.prototype.getHandlers=function(){var e=ut.prototype.getHandlers.call(this);return e["element.updateModdleProperties"]=Ra,e["element.updateProperties"]=Pa,e["canvas.updateRoot"]=Mc,e["lane.add"]=Up,e["lane.resize"]=Aa,e["lane.split"]=qp,e["lane.updateRefs"]=kc,e["group.updateRefs"]=Ma,e["id.updateClaim"]=Oc,e["element.setColor"]=Zp,e["element.updateLabel"]=uv,e},an.prototype.updateLabel=function(e,t,n,i){this._commandStack.execute("element.updateLabel",{element:e,newLabel:t,newBounds:n,hints:i||{}})},an.prototype.connect=function(e,t,n,i){var r=this._bpmnRules;if(n||(n=r.canConnect(e,t)),!!n)return this.createConnection(e,t,n,e.parent,i)},an.prototype.updateModdleProperties=function(e,t,n){this._commandStack.execute("element.updateModdleProperties",{element:e,moddleElement:t,properties:n})},an.prototype.updateProperties=function(e,t){this._commandStack.execute("element.updateProperties",{element:e,properties:t})},an.prototype.resizeLane=function(e,t,n){this._commandStack.execute("lane.resize",{shape:e,newBounds:t,balanced:n})},an.prototype.addLane=function(e,t){var n={shape:e,location:t};return this._commandStack.execute("lane.add",n),n.newLane},an.prototype.splitLane=function(e,t){this._commandStack.execute("lane.split",{shape:e,count:t})},an.prototype.makeCollaboration=function(){var e=this._create("root",{type:"bpmn:Collaboration"}),t={newRoot:e};return this._commandStack.execute("canvas.updateRoot",t),e},an.prototype.makeProcess=function(){var e=this._create("root",{type:"bpmn:Process"}),t={newRoot:e};return this._commandStack.execute("canvas.updateRoot",t),e},an.prototype.updateLaneRefs=function(e,t){this._commandStack.execute("lane.updateRefs",{flowNodeShapes:e,laneShapes:t})},an.prototype.updateCategoryValueRefs=function(e,t){this._commandStack.execute("group.updateRefs",{affectedFlowElements:e,affectedGroupEntries:t})},an.prototype.claimId=function(e,t){this._commandStack.execute("id.updateClaim",{id:e,element:t,claiming:!0})},an.prototype.unclaimId=function(e,t){this._commandStack.execute("id.updateClaim",{id:e,element:t})},an.prototype.setColor=function(e,t){e.length||(e=[e]),this._commandStack.execute("element.setColor",{elements:e,colors:t})};function pv(){}pv.prototype.layoutConnection=function(e,t){return t=t||{},[t.connectionStart||Te(t.source||e.source),t.connectionEnd||Te(t.target||e.target)]};var Dc=20,RT=5,Lc=Math.round,fv=20,CT={"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 AT(e,t){return{t:/top/,r:/right/,b:/bottom/,l:/left/,h:/left|right/,v:/top|bottom/}[e].test(t)}function dv(e,t,n){var i=nn(t,e,RT),r=n.split(":")[0],o=Lc((t.x-e.x)/2+e.x),a=Lc((t.y-e.y)/2+e.y),s,c,u=AT(r,i),l=/h|r|l/.test(r),p=!1,f=!1;return u?(s=l?{x:o,y:e.y}:{x:e.x,y:a},c=l?"h:h":"v:v"):(p=PT(i,r),c=l?"h:v":"v:h",p?l?(f=a===e.y,s={x:e.x+Dc*(/l/.test(r)?-1:1),y:f?a+Dc:a}):(f=o===e.x,s={x:f?o+Dc:o,y:e.y+Dc*(/t/.test(r)?-1:1)}):s={x:o,y:a}),{waypoints:Qp(e,s,c).concat(s),directions:c,turnNextDirections:f}}function TT(e,t,n){return dv(e,t,n)}function MT(e,t,n){var i=dv(t,e,hv(n));return{waypoints:i.waypoints.slice().reverse(),directions:hv(i.directions),turnNextDirections:i.turnNextDirections}}function kT(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 hv(e){return e.split(":").reverse().join(":")}function OT(e,t,n){var i=Lc((t.x-e.x)/2+e.x),r=Lc((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",!HT(n))throw new Error("unknown directions: <"+n+">: must be specified as <start>:<end> with start/end in { h,v,t,r,b,l }");if(gv(n)){var i=TT(e,t,n),r=MT(e,t,n),o=kT(i,r);return[].concat(i.waypoints,o.waypoints,r.waypoints)}return OT(e,t,n)}function DT(e,t,n){var i=Qp(e,t,n);return i.unshift(e),i.push(t),vv(i)}function LT(e,t,n,i,r){var o=r&&r.preferredLayouts||[],a=M0(o,"straight")[0]||"h:h",s=CT[a]||0,c=nn(e,t,s),u=FT(c,a);n=n||Te(e),i=i||Te(t);var l=u.split(":"),p=yv(n,e,l[0],zT(c)),f=yv(i,t,l[1],c);return DT(p,f,u)}function IT(e,t,n,i,r,o){Ae(n)&&(r=n,o=i,n=Te(e),i=Te(t)),o=j({preferredLayouts:[]},o),r=r||[];var a=o.preferredLayouts,s=a.indexOf("straight")!==-1,c;return c=s&&NT(e,t,n,i,o),c||(c=o.connectionEnd&&jT(t,e,i,r),c)||(c=o.connectionStart&&$T(e,t,n,r),c)?c:!o.connectionStart&&!o.connectionEnd&&r&&r.length?r:LT(e,t,n,i,o)}function BT(e,t,n){return e>=t&&e<=n}function mv(e,t,n){var i={x:"width",y:"height"};return BT(t[e],n[e],n[e]+n[i[e]])}function NT(e,t,n,i,r){var o={},a,s;return s=nn(e,t),/^(top|bottom|left|right)$/.test(s)?(/top|bottom/.test(s)&&(a="x"),/left|right/.test(s)&&(a="y"),r.preserveDocking==="target"?mv(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:mv(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 $T(e,t,n,i){return Jp(e,t,n,i)}function jT(e,t,n,i){var r=i.slice().reverse();return r=Jp(e,t,n,r),r?r.reverse():null}function Jp(e,t,n,i){function r(l){return l.length<3?!0:l.length>4?!1:!!ft(l,function(p,f){var d=l[f-1];return d&&ea(p,d)<3})}function o(l,p,f){var d=Oi(p,l);switch(d){case"v":return{x:f.x,y:l.y};case"h":return{x:l.x,y:f.y}}return{x:l.x,y:l.y}}function a(l,p,f){var d;for(d=l.length-2;d!==0;d--)if(Hh(l[d],p,fv)||Hh(l[d],f,fv))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=Jp(e,t,n,u)),c&&Oi(c)?null:c}function FT(e,t){if(gv(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 HT(e){return e&&/^h|v|t|r|b|l:h|v|t|r|b|l$/.test(e)}function gv(e){return e&&/t|r|b|l/.test(e)}function zT(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 yv(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 vv(e){return e.reduce(function(t,n,i){var r=t[t.length-1],o=e[i+1];return gl(r,o,n,0)||t.push(n),t},[])}var GT=-10,VT=40,WT={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},UT={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},ef={top:"bottom","top-right":"bottom-left","top-left":"bottom-right",right:"left",bottom:"top","bottom-right":"top-left","bottom-left":"top-right",left:"right"},ka={top:"t",right:"r",bottom:"b",left:"l"};function Ic(e){this._elementRegistry=e}he(Ic,pv),Ic.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=bv(r&&r[0],n)),a||(a=bv(r&&r[r.length-1],i)),(_(e,"bpmn:Association")||_(e,"bpmn:DataAssociation"))&&r&&!_v(n,i))return[].concat([o],r.slice(1,-1),[a]);var l=km(n,s)?WT:UT;return _(e,"bpmn:MessageFlow")?c=YT(n,i,l):(_(e,"bpmn:SequenceFlow")||_v(n,i))&&(n===i?c={preferredLayouts:eM(n,e,l)}:_(n,"bpmn:BoundaryEvent")?c={preferredLayouts:tM(n,i,a,l)}:Oa(n)||Oa(i)?c={preferredLayouts:l.subProcess,preserveDocking:XT(n)}:_(n,"bpmn:Gateway")?c={preferredLayouts:l.fromGateway}:_(i,"bpmn:Gateway")?c={preferredLayouts:l.toGateway}:c={preferredLayouts:l.default}),c&&(c=j(c,t),u=vv(IT(n,i,o,a,r,c))),u||[o,a]};function qT(e){var t=e.host;return nn(Te(e),t,GT)}function YT(e,t,n){return{preferredLayouts:n.messageFlow,preserveDocking:KT(e,t)}}function KT(e,t){return _(t,"bpmn:Participant")?"source":_(e,"bpmn:Participant")?"target":Oa(t)?"source":Oa(e)||_(t,"bpmn:Event")?"target":_(e,"bpmn:Event")?"source":null}function XT(e){return Oa(e)?"target":"source"}function bv(e,t){return e?e.original||e:Te(t)}function _v(e,t){return _(t,"bpmn:Activity")&&_(e,"bpmn:BoundaryEvent")&&t.businessObject.isForCompensation}function Oa(e){return _(e,"bpmn:SubProcess")&&qe(e)}function Gr(e,t){return e===t}function ZT(e,t){return t.indexOf(e)!==-1}function Mo(e){var t=/right|left/.exec(e);return t&&t[0]}function ko(e){var t=/top|bottom/.exec(e);return t&&t[0]}function xv(e,t){return ef[e]===t}function QT(e,t){var n=Mo(e),i=ef[n];return t.indexOf(i)!==-1}function JT(e,t){var n=ko(e),i=ef[n];return t.indexOf(i)!==-1}function wv(e){return e==="right"||e==="left"}function eM(e,t,n){var i=t.waypoints,r=i&&i.length&&nn(i[0],e);return r==="top"?n.loop.fromTop:r==="right"?n.loop.fromRight:r==="left"?n.loop.fromLeft:n.loop.fromBottom}function tM(e,t,n,i){var r=Te(e),o=Te(t),a=qT(e),s,c,u=Gr(e.host,t),l=ZT(a,["top","right","bottom","left"]),p=nn(o,r,{x:e.width/2+t.width/2,y:e.height/2+t.height/2});return u?nM(a,l,e,t,n,i):(s=iM(a,p,l,i.isHorizontal),c=rM(a,p,l,i.isHorizontal),[s+":"+c])}function nM(e,t,n,i,r,o){var a=t?e:o.isHorizontal?ko(e):Mo(e),s=ka[a],c;return t?wv(e)?c=Ev("y",n,i,r)?"h":o.boundaryLoop.alternateHorizontalSide:c=Ev("x",n,i,r)?"v":o.boundaryLoop.alternateVerticalSide:c=o.boundaryLoop.default,[s+":"+c]}function Ev(e,t,n,i){var r=VT;return!(tf(e,i,n,r)||tf(e,i,{x:n.x+n.width,y:n.y+n.height},r)||tf(e,i,Te(t),r))}function tf(e,t,n,i){return Math.abs(t[e]-n[e])<i}function iM(e,t,n,i){if(n)return ka[e];var r=ko(e),o=Mo(e),a=ko(t),s=Mo(t);if(i){if(Gr(r,a)||xv(o,s))return ka[r]}else if(Gr(o,s)||xv(r,a))return ka[o];return ka[i?o:r]}function rM(e,t,n,i){if(n)return wv(e)?QT(e,t)||Gr(e,t)?"h":"v":JT(e,t)||Gr(e,t)?"v":"h";var r=ko(e),o=Mo(e),a=ko(t),s=Mo(t);return a&&!s?"v":s&&!a?"h":i?Gr(r,a)?"h":"v":Gr(o,s)?"v":"h"}Ic.$inject=["elementRegistry"];function Sv(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(Sv(i)),o.push(Sv(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 ta(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 nf={__init__:["modeling","bpmnUpdater"],__depends__:[EP,jP,HP,zP,By,GA,WA,ZA,Wn,jp,zy],bpmnFactory:["type",qn],bpmnUpdater:["type",Mn],elementFactory:["type",dr],modeling:["type",an],layouter:["type",Ic],connectionDocking:["type",gr]};var oM=10,Rv=50,aM=250;function rf(e,t,n,i){for(var r;r=sM(e,n,t);)n=i(t,n,r);return n}function of(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 sM(e,t,n){var i={x:t.x-n.width/2,y:t.y-n.height/2,width:n.width,height:n.height},r=uM(e);return ft(r,function(o){if(o===n)return!1;var a=nn(o,i,oM);return a==="intersect"})}function cM(e,t){t||(t={});function n(g){return g.source===e?1:-1}var i=t.defaultDistance||Rv,r=t.direction||"e",o=t.filter,a=t.getWeight||n,s=t.maxDistance||aM,c=t.reference||"start";o||(o=fM);function u(g,h){return r==="n"?c==="start"?Re(g).top-Re(h).bottom:c==="center"?Re(g).top-Te(h).y:Re(g).top-Re(h).top:r==="w"?c==="start"?Re(g).left-Re(h).right:c==="center"?Re(g).left-Te(h).x:Re(g).left-Re(h).left:r==="s"?c==="start"?Re(h).top-Re(g).bottom:c==="center"?Te(h).y-Re(g).bottom:Re(h).bottom-Re(g).bottom:c==="start"?Re(h).left-Re(g).right:c==="center"?Te(h).x-Re(g).right:Re(h).right-Re(g).right}var l=e.incoming.filter(o).map(function(g){var h=a(g),m=h<0?u(g.source,e):u(e,g.source);return{id:g.source.id,distance:m,weight:h}}),p=e.outgoing.filter(o).map(function(g){var h=a(g),m=h>0?u(e,g.target):u(g.target,e);return{id:g.target.id,distance:m,weight:h}}),f=l.concat(p).reduce(function(g,h){return g[h.id+"__weight_"+h.weight]=h,g},{}),d=En(f,function(g,h){var m=h.distance,S=h.weight;return m<0||m>s||(g[String(m)]||(g[String(m)]=0),g[String(m)]+=1*S,(!g.distance||g[g.distance]<g[String(m)])&&(g.distance=m)),g},{});return d.distance||i}function uM(e){var t=af(e);return e.host&&(t=t.concat(af(e.host))),e.attachers&&(t=t.concat(e.attachers.reduce(function(n,i){return n.concat(af(i))},[]))),t}function af(e){return pM(e).concat(lM(e))}function lM(e){return e.incoming.map(function(t){return t.source})}function pM(e){return e.outgoing.map(function(t){return t.target})}function fM(){return!0}var dM=100;function Cv(e,t,n){e.on("autoPlace",dM,function(i){var r=i.shape,o=i.source;return hM(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}}Cv.$inject=["eventBus","modeling","canvas"];function hM(e,t,n){n||(n={});var i=n.defaultDistance||Rv,r=Te(e),o=Re(e);return{x:o.right+i+t.width/2,y:r.y}}function Pv(e,t){e.on("autoPlace.end",500,function(n){t.select(n.shape)})}Pv.$inject=["eventBus","selection"];const mM={__init__:["autoPlaceSelectionBehavior"],autoPlace:["type",Cv],autoPlaceSelectionBehavior:["type",Pv]};function Av(e,t,n){var i=km(e,n);if(_(t,"bpmn:TextAnnotation"))return yM(e,t,i);if(He(t,["bpmn:DataObjectReference","bpmn:DataStoreReference"]))return vM(e,t,i);if(_(t,"bpmn:FlowNode"))return gM(e,t,i)}function gM(e,t,n){var i=Re(e),r=Te(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=cM(e,{filter:function(d){return _(d,"bpmn:SequenceFlow")},direction:o.directionHint}),s=30,c=o.minDistance,u=o.baseOrientation;_(e,"bpmn:BoundaryEvent")&&(u=nn(e,e.host,-25),u.indexOf(o.boundaryOrientation)!==-1&&(s*=-1));var l=n?{x:i.right+a+t.width/2,y:r.y+Tv(u,c,o)}:{x:r.x+Tv(u,c,o),y:i.bottom+a+t.height/2},p={margin:s,minDistance:c},f=n?{y:p}:{x:p};return rf(e,t,l,of(f))}function Tv(e,t,n){return e.includes(n.start)?-1*t:e.includes(n.end)?t:0}function yM(e,t,n){var i=Re(e),r=n?{x:i.right+t.width/2,y:i.top-50-t.height/2}:{x:i.right+50+t.width/2,y:i.bottom+t.height/2};ct(e)&&(r=Te(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 rf(e,t,r,of(a))}function vM(e,t,n){var i=Re(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 rf(e,t,r,of(a))}function Mv(e,t){e.on("autoPlace",function(n){var i=n.shape,r=n.source;return Av(r,i,t)})}Mv.$inject=["eventBus","elementRegistry"];const Bc={__depends__:[mM],__init__:["bpmnAutoPlace"],bpmnAutoPlace:["type",Mv]},kv=[Tm,sa,nf,Bc];function bM(e={}){Pd(globalThis,e.dom);const t=document.createElement("div");return document.body.appendChild(t),new ho({container:t,moddleExtensions:e.moddleExtensions??as,additionalModules:[...kv,...e.additionalModules??[]]})}var _M=new Ao("ov"),xM=500;function Qt(e,t,n,i){this._eventBus=t,this._canvas=n,this._elementRegistry=i,this._ids=_M,this._overlayDefaults=j({show:null,scale:!0},e&&e.defaults),this._overlays={},this._overlayContainers=[],this._overlayRoot=wM(n.getContainer()),this._init()}Qt.$inject=["config.overlays","eventBus","canvas","elementRegistry"],Qt.prototype.get=function(e){if(xn(e)&&(e={id:e}),xn(e.element)&&(e.element=this._elementRegistry.get(e.element)),e.element){var t=this._getOverlayContainer(e.element,!0);return t?e.type?ze(t.overlays,io({type:e.type})):t.overlays.slice():[]}else return e.type?ze(this._overlays,io({type:e.type})):e.id?this._overlays[e.id]:null},Qt.prototype.add=function(e,t,n){if(Yt(t)&&(n=t,t=null),e.id||(e=this._elementRegistry.get(e)),!n.position)throw new Error("must specifiy overlay position");if(!n.html)throw new Error("must specifiy overlay html");if(!e)throw new Error("invalid element specified");var i=this._ids.next();return n=j({},this._overlayDefaults,n,{id:i,type:t,element:e,html:n.html}),this._addOverlay(n),i},Qt.prototype.remove=function(e){var t=this.get(e)||[];Ae(t)||(t=[t]);var n=this;L(t,function(i){var r=n._getOverlayContainer(i.element,!0);if(i&&(pi(i.html),pi(i.htmlContainer),delete i.htmlContainer,delete i.element,delete n._overlays[i.id]),r){var o=r.overlays.indexOf(i);o!==-1&&r.overlays.splice(o,1)}})},Qt.prototype.isShown=function(){return this._overlayRoot.style.display!=="none"},Qt.prototype.show=function(){Nc(this._overlayRoot)},Qt.prototype.hide=function(){Nc(this._overlayRoot,!1)},Qt.prototype.clear=function(){this._overlays={},this._overlayContainers=[],_s(this._overlayRoot)},Qt.prototype._updateOverlayContainer=function(e){var t=e.element,n=e.html,i=t.x,r=t.y;if(t.waypoints){var o=Ot(t);i=o.x,r=o.y}Ov(n,i,r),ln(e.html,"data-container-id",t.id)},Qt.prototype._updateOverlay=function(e){var t=e.position,n=e.htmlContainer,i=e.element,r=t.left,o=t.top;if(t.right!==void 0){var a;i.waypoints?a=Ot(i).width:a=i.width,r=t.right*-1+a}if(t.bottom!==void 0){var s;i.waypoints?s=Ot(i).height:s=i.height,o=t.bottom*-1+s}Ov(n,r||0,o||0),this._updateOverlayVisibilty(e,this._canvas.viewbox())},Qt.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},Qt.prototype._updateRoot=function(e){var t=e.scale||1,n="matrix("+[t,0,0,t,-1*e.x*t,-1*e.y*t].join(",")+")";Dv(this._overlayRoot,n)},Qt.prototype._getOverlayContainer=function(e,t){var n=ft(this._overlayContainers,function(i){return i.element===e});return!n&&!t?this._createOverlayContainer(e):n},Qt.prototype._addOverlay=function(e){var t=e.id,n=e.element,i=e.html,r,o;i.get&&i.constructor.prototype.jquery&&(i=i.get(0)),xn(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&&gt(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())},Qt.prototype._updateOverlayVisibilty=function(e,t){var n=e.show,i=this._canvas.findRoot(e.element),r=n&&n.minZoom,o=n&&n.maxZoom,a=e.htmlContainer,s=this._canvas.getRootElement(),c=!0;(i!==s||n&&(Ht(r)&&r>t.scale||Ht(o)&&o<t.scale))&&(c=!1),Nc(a,c),this._updateOverlayScale(e,t)},Qt.prototype._updateOverlayScale=function(e,t){var n=e.scale,i,r,o=e.htmlContainer,a,s="";n!==!0&&(n===!1?(i=1,r=1):(i=n.min,r=n.max),Ht(i)&&t.scale<i&&(a=(1/t.scale||1)*i),Ht(r)&&t.scale>r&&(a=(1/t.scale||1)*r)),Ht(a)&&(s="scale("+a+","+a+")"),Dv(o,s)},Qt.prototype._updateOverlaysVisibilty=function(e){var t=this;L(this._overlays,function(n){t._updateOverlayVisibilty(n,e)})},Qt.prototype._init=function(){var e=this._eventBus,t=this;function n(i){t._updateRoot(i),t._updateOverlaysVisibilty(i),t.show()}e.on("canvas.viewbox.changing",function(i){t.hide()}),e.on("canvas.viewbox.changed",function(i){n(i.viewbox)}),e.on(["shape.remove","connection.remove"],function(i){var r=i.element,o=t.get({element:r});L(o,function(c){t.remove(c.id)});var a=t._getOverlayContainer(r);if(a){pi(a.html);var s=t._overlayContainers.indexOf(a);s!==-1&&t._overlayContainers.splice(s,1)}}),e.on("element.changed",xM,function(i){var r=i.element,o=t._getOverlayContainer(r,!0);o&&(L(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&&gt(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 wM(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 Ov(e,t,n){mn(e,{left:t+"px",top:n+"px"})}function Nc(e,t){e.style.display=t===!1?"none":""}function Dv(e,t){e.style["transform-origin"]="top left",["","-ms-","-webkit-"].forEach(function(n){e.style[n+"transform"]=t})}const $c={__init__:["overlays"],overlays:["type",Qt]};function sf(e,t){t.invoke(ee,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)})}he(sf,ee),sf.$inject=["canvas","injector"];const EM={__init__:["rootElementsBehavior"],rootElementsBehavior:["type",sf]};function Da(e){return CSS.escape(e)}var SM={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"};function Lv(e){return e=""+e,e&&e.replace(/[&<>"']/g,function(t){return SM[t]})}var RM="bjs-breadcrumbs-shown";function Iv(e,t,n){var i=dt('<ul class="bjs-breadcrumbs"></ul>'),r=n.getContainer(),o=gt(r);r.appendChild(i);var a=[];e.on("element.changed",function(c){var u=c.element,l=te(u),p=ft(a,function(f){return f===l});p&&s()});function s(c){c&&(a=CM(c));var u=a.flatMap(function(p){var f=n.findRoot(gi(p))||n.findRoot(p.id);if(!f&&_(p,"bpmn:Process")){var d=t.find(function(m){var S=te(m);return S&&S.get("processRef")===p});f=d&&n.findRoot(d.id)}if(!f)return[];var g=Lv(p.name||p.id),h=dt('<li><span class="bjs-crumb"><a title="'+g+'">'+g+"</a></span></li>");return h.addEventListener("click",function(){n.setRootElement(f)}),h});i.innerHTML="";var l=u.length>1;o.toggle(RM,l),u.forEach(function(p){i.appendChild(p)})}e.on("root.set",function(c){s(c.element)})}Iv.$inject=["eventBus","elementRegistry","canvas"];function CM(e){for(var t=te(e),n=[],i=t;i;i=i.$parent)(_(i,"bpmn:SubProcess")||_(i,"bpmn:Process"))&&n.push(i);return n.reverse()}function Bv(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,!(!_(o,"bpmn:SubProcess")&&!s)){s=s||{x:0,y:0,zoom:1};var c=(a.x-s.x)*a.scale,u=(a.y-s.y)*a.scale;(c!==0||u!==0)&&t.scroll({dx:c,dy:u}),s.zoom!==a.scale&&t.zoom(s.zoom,{x:0,y:0})}}),e.on("diagram.clear",function(){i.clear(),n=null})}Bv.$inject=["eventBus","canvas"];function 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 Nv={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;_(a,"bpmn:SubProcess")&&!o.isExpanded&&n.push(a),TM(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=AM(e),i={x:n.x-Nv.x,y:n.y-Nv.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=$v(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 $v(e){return _(e,"bpmndi:BPMNDiagram")?e:$v(e.$parent)}function AM(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=Re(n.bounds);t.top=Math.min(i.top,t.top),t.left=Math.min(i.left,t.left)}}),Ts(t)}function TM(e,t){var n=e.$parent;return!(!_(n,"bpmn:SubProcess")||n===t.bpmnElement||He(e,["bpmn:DataInputAssociation","bpmn:DataOutputAssociation"]))}var jc=250,MM='<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>',kM="bjs-drilldown-empty";function yr(e,t,n,i,r){ee.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",jc,function(a){var s=a.shape;o._canDrillDown(s)?o._addOverlay(s):o._removeOverlay(s)},!0),this.reverted("shape.toggleCollapse",jc,function(a){var s=a.shape;o._canDrillDown(s)?o._addOverlay(s):o._removeOverlay(s)},!0),this.executed(["shape.create","shape.move","shape.delete"],jc,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"],jc,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)})})}he(yr,ee),yr.prototype._updateDrilldownOverlay=function(e){var t=this._canvas;if(e){var n=t.findRoot(e);n&&this._updateOverlayVisibility(n)}},yr.prototype._canDrillDown=function(e){var t=this._canvas;return _(e,"bpmn:SubProcess")&&t.findRoot(gi(e))},yr.prototype._updateOverlayVisibility=function(e){var t=this._overlays,n=te(e),i=t.get({element:n.id,type:"drilldown"})[0];if(i){var r=n&&n.get("flowElements")&&n.get("flowElements").length;gt(i.html).toggle(kM,!r)}},yr.prototype._addOverlay=function(e){var t=this._canvas,n=this._overlays,i=te(e),r=n.get({element:e,type:"drilldown"});r.length&&this._removeOverlay(e);var o=dt('<button type="button" class="bjs-drilldown">'+MM+"</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(gi(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 OM={__depends__:[$c,jp,EM],__init__:["drilldownBreadcrumbs","drilldownOverlayBehavior","drilldownCentering","subprocessCompatibility"],drilldownBreadcrumbs:["type",Iv],drilldownCentering:["type",Bv],drilldownOverlayBehavior:["type",yr],subprocessCompatibility:["type",Vr]};function vr(e){vt.call(this,e)}he(vr,vt),vr.prototype._modules=[Tm,OM,$c,Wn,sa],vr.prototype._moddleExtensions={};var Fc="keyboard.keydown",DM="keyboard.keyup",LM=1e3,jv="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(jv));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,Fc)},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||Fc,i),n&&e.preventDefault()}},gn.prototype._isEventIgnored=function(e){return!1},gn.prototype.bind=function(e){e&&console.error("unsupported argument <node>",new Error(jv)),this.unbind(),e=this._node=this._target,Le.bind(e,"keydown",this._keydownHandler),Le.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"),Le.unbind(e,"keydown",this._keydownHandler),Le.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){Kt(e)&&(n=t,t=e,e=LM),this._eventBus.on(n||Fc,e,t)},gn.prototype.removeListener=function(e,t){this._eventBus.off(t||Fc,e)},gn.prototype.hasModifier=tA,gn.prototype.isCmd=An,gn.prototype.isShift=Ap,gn.prototype.isKey=Vt;var IM=500;function Oo(e,t){var n=this;e.on("editorActions.init",IM,function(i){var r=i.editorActions;n.registerBindings(t,r)})}Oo.$inject=["eventBus","keyboard"],Oo.prototype.registerBindings=function(e,t){function n(i,r){t.isRegistered(i)&&e.addListener(r)}n("undo",function(i){var r=i.keyEvent;if(aA(r))return t.trigger("undo"),!0}),n("redo",function(i){var r=i.keyEvent;if(sA(r))return t.trigger("redo"),!0}),n("copy",function(i){var r=i.keyEvent;if(nA(r))return t.trigger("copy"),!0}),n("paste",function(i){var r=i.keyEvent;if(iA(r))return t.trigger("paste"),!0}),n("duplicate",function(i){var r=i.keyEvent;if(rA(r))return t.trigger("duplicate"),!0}),n("cut",function(i){var r=i.keyEvent;if(oA(r))return t.trigger("cut"),!0}),n("stepZoom",function(i){var r=i.keyEvent;if(Vt(["+","Add","="],r)&&An(r))return t.trigger("stepZoom",{value:1}),!0}),n("stepZoom",function(i){var r=i.keyEvent;if(Vt(["-","Subtract"],r)&&An(r))return t.trigger("stepZoom",{value:-1}),!0}),n("zoom",function(i){var r=i.keyEvent;if(Vt("0",r)&&An(r))return t.trigger("zoom",{value:1}),!0}),n("removeSelection",function(i){var r=i.keyEvent;if(Vt(["Backspace","Delete","Del"],r))return t.trigger("removeSelection"),!0})};const cf={__init__:["keyboard","keyboardBindings"],keyboard:["type",gn],keyboardBindings:["type",Oo]};var BM={moveSpeed:50,moveSpeedAccelerated:200};function Fv(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})}}Fv.$inject=["config.keyboardMove","keyboard","canvas"];const Hv={__depends__:[cf],__init__:["keyboardMove"],keyboardMove:["type",Fv]};var NM=15;function zv(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),p=ni(l,c);if(!n.dragging&&$M(p)>NM&&(n.dragging=!0,u===0&&my(e),dc("grab")),n.dragging){var f=n.last||n.start;p=ni(l,f),t.scroll({dx:p.x,dy:p.y}),n.last=l}s.preventDefault()}function o(s){Le.unbind(document,"mousemove",r),Le.unbind(document,"mouseup",o),n=null,hy()}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)},Le.bind(document,"mousemove",r),Le.bind(document,"mouseup",o),!0}}this.isActive=function(){return!!n}}zv.$inject=["eventBus","canvas"];function $M(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}const Gv={__init__:["moveCanvas"],moveCanvas:["type",zv]};function Vv(e,t){var n=Rl(e.min),i=Rl(e.max),r=Math.abs(n)+Math.abs(i);return r/t}function jM(e,t){return Math.max(e.min,Math.min(e.max,t))}var FM=Math.sign||function(e){return e>=0?1:-1},uf={min:.2,max:4},Wv=10,HM=.1,zM=.75;function bi(e,t,n){e=e||{},this._enabled=!1,this._canvas=n,this._container=n._container,this._handleWheel=vn(this._handleWheel,this),this._totalDelta=0,this._scale=e.scale||zM;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=Vv(uf,Wv*2);this._totalDelta+=t,Math.abs(this._totalDelta)>HM&&(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||wg()&&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))*FM(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=Vv(uf,Wv);this._zoom(t,n,i)},bi.prototype._zoom=function(e,t,n){var i=this._canvas,r=e>0?1:-1,o=Rl(i.zoom()),a=Math.round(o/n)*n;a+=n*r;var s=Math.pow(10,a);i.zoom(jM(uf,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&&Le[t?"bind":"unbind"](n,"wheel",i,!1),this._enabled=t,t},bi.prototype._init=function(e){this.toggle(e)};const Uv={__init__:["zoomScroll"],zoomScroll:["type",bi]};function La(e){vr.call(this,e)}he(La,vr),La.prototype._navigationModules=[Hv,Gv,Uv],La.prototype._modules=[].concat(vr.prototype._modules,La.prototype._navigationModules);function lf(e){return e&&e[e.length-1]}function qv(e){return e.y}function Yv(e){return e.x}var GM={left:Yv,center:Yv,right:function(e){return e.x+e.width},top:qv,middle:qv,bottom:function(e){return e.y+e.height}};function Do(e,t){this._modeling=e,this._rules=t}Do.$inject=["modeling","rules"],Do.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}},Do.prototype._isType=function(e,t){return t.indexOf(e)!==-1},Do.prototype._alignmentPosition=function(e,t){var n=this._getOrientationDetails(e),i=n.axis,r=n.dimension,o={},a={},s=!1,c,u,l;function p(f,d){return Math.round((f[i]+d[i]+d[r])/2)}if(this._isType(e,["left","top"]))o[e]=t[0][i];else if(this._isType(e,["right","bottom"]))l=lf(t),o[e]=l[i]+l[r];else if(this._isType(e,["center","middle"])){if(L(t,function(f){var d=f[i]+Math.round(f[r]/2);a[d]?a[d].elements.push(f):a[d]={elements:[f],center:d}}),c=oi(a,function(f){return f.elements.length>1&&(s=!0),f.elements.length}),s)return o[e]=lf(c).center,o;u=t[0],t=oi(t,function(f){return f[i]+f[r]}),l=lf(t),o[e]=p(u,l)}return o},Do.prototype.trigger=function(e,t){var n=this._modeling,i,r=ze(e,function(c){return!(c.waypoints||c.host||c.labelTarget)});if(i=this._rules.allowed("elements.align",{elements:r}),Ae(i)&&(r=i),!(r.length<2||!i)){var o=GM[t],a=oi(r,o),s=this._alignmentPosition(t,a);n.alignElements(a,s)}};const VM={__init__:["alignElements"],alignElements:["type",Do]},WM=new Ao;function Lo(e){this._scheduled={},e.on("diagram.destroy",()=>{Object.keys(this._scheduled).forEach(t=>{this.cancel(t)})})}Lo.$inject=["eventBus"],Lo.prototype.schedule=function(e,t=WM.next()){this.cancel(t);const n=this._schedule(e,t);return this._scheduled[t]=n,n.promise},Lo.prototype._schedule=function(e,t){const n=UM();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}},Lo.prototype.cancel=function(e){const t=this._scheduled[e];t&&(this._cancel(t),this._scheduled[e]=null)},Lo.prototype._cancel=function(e){clearTimeout(e.executionId)};function UM(){const e={};return e.promise=new Promise((t,n)=>{e.resolve=t,e.reject=n}),e}const qM={scheduler:["type",Lo]};var YM="djs-element-hidden",Hc=".entry",KM=1e3,Kv=8,XM=300;function Lt(e,t,n,i){this._canvas=e,this._elementRegistry=t,this._eventBus=n,this._scheduler=i,this._current=null,this._init()}Lt.$inject=["canvas","elementRegistry","eventBus","scheduler"],Lt.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=Ae(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=Ae(i.target)?i.target:[i.target];r.includes(n)&&e._updateVisibility()}}),this._container=this._createContainer()},Lt.prototype._createContainer=function(){var e=dt('<div class="djs-context-pad-parent"></div>');return this._canvas.getContainer().appendChild(e),e},Lt.prototype.registerProvider=function(e,t){t||(t=e,e=KM),this._eventBus.on("contextPad.getProviders",e,function(n){n.providers.push(t)})},Lt.prototype.getEntries=function(e){var t=this._getProviders(),n=Ae(e)?"getMultiElementContextPadEntries":"getContextPadEntries",i={};return L(t,function(r){if(Kt(r[n])){var o=r[n](e);Kt(o)?i=o(i):L(o,function(a,s){i[s]=a})}}),i},Lt.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)},XM);return}else if(e==="mouseout"){clearTimeout(this._timeout),this._mouseout&&(this._mouseout(),this._mouseout=null);return}return this.triggerEntry(r,e,o,n)},Lt.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(Kt(s)){if(t==="click")return s(n,r,i)}else if(s[t])return s[t](n,r,i);n.preventDefault()}}}},Lt.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))}},Lt.prototype._getProviders=function(){var e=this._eventBus.createEvent({type:"contextPad.getProviders",providers:[]});return this._eventBus.fire(e),e.providers},Lt.prototype._updateAndOpen=function(e){var t=this.getEntries(e),n=this._createHtml(e),i;L(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=at("[data-group="+Da(a)+"]",n),c||(c=dt('<div class="group"></div>'),ln(c,"data-group",a),n.appendChild(c)),c.appendChild(s),r.className&&ZM(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))}),gt(n).add("open"),this._current={entries:t,html:n,target:e},this._updatePosition(),this._updateVisibility(),this._eventBus.fire("contextPad.open",{current:this._current})},Lt.prototype._createHtml=function(e){var t=this,n=dt('<div class="djs-context-pad"></div>');return Rn.bind(n,Hc,"click",function(i){t.trigger("click",i)}),Rn.bind(n,Hc,"dragstart",function(i){t.trigger("dragstart",i)}),Rn.bind(n,Hc,"mouseover",function(i){t.trigger("mouseover",i)}),Rn.bind(n,Hc,"mouseout",function(i){t.trigger("mouseout",i)}),Le.bind(n,"mousedown",function(i){i.stopPropagation()}),this._container.appendChild(n),this._eventBus.fire("contextPad.create",{target:e,pad:n}),n},Lt.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()&&JM(this._current.target,e)?t=this._current.html:t=this._createHtml(e),{html:t}},Lt.prototype.close=function(){this.isOpen()&&(clearTimeout(this._timeout),this._container.innerHTML="",this._eventBus.fire("contextPad.close",{current:this._current}),this._current=null)},Lt.prototype.isOpen=function(e){var t=this._current;if(!t)return!1;if(!e)return!0;var n=t.target;return Ae(e)!==Ae(n)?!1:Ae(e)?e.length===n.length&&Pr(e,function(i){return n.includes(i)}):n===e},Lt.prototype.isShown=function(){return this.isOpen()&&gt(this._current.html).has("open")},Lt.prototype.show=function(){this.isOpen()&&(gt(this._current.html).add("open"),this._updatePosition(),this._eventBus.fire("contextPad.show",{current:this._current}))},Lt.prototype.hide=function(){this.isOpen()&&(gt(this._current.html).remove("open"),this._eventBus.fire("contextPad.hide",{current:this._current}))},Lt.prototype._getPosition=function(e){if(!Ae(e)&&ct(e)){var t=this._canvas.viewbox(),n=QM(e),i=n.x*t.scale-t.x*t.scale,r=n.y*t.scale-t.y*t.scale;return{left:i+Kv*this._canvas.zoom(),top:r}}var o=this._canvas.getContainer(),a=o.getBoundingClientRect(),s=this._getTargetBounds(e);return{left:s.right-a.left+Kv*this._canvas.zoom(),top:s.top-a.top}},Lt.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")},Lt.prototype._updateVisibility=function(){const e=()=>{if(this.isOpen()){var t=this,n=this._current.target,i=Ae(n)?n:[n],r=i.some(function(o){return t._canvas.hasMarker(o,YM)});r?t.hide():t.show()}};this._scheduler.schedule(e,"ContextPad#_updateVisibility")},Lt.prototype._getTargetBounds=function(e){var t=this,n=Ae(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 ZM(e,t){var n=gt(e);t=Ae(t)?t:t.split(/\s+/g),t.forEach(function(i){n.add(i)})}function QM(e){return e.waypoints[e.waypoints.length-1]}function JM(e,t){return e=Ae(e)?e:[e],t=Ae(t)?t:[t],e.length===t.length&&Pr(e,function(n){return t.includes(n)})}const Xv={__depends__:[fc,qM,$c],contextPad:["type",Lt]};var zc,_t,Zv,br,Qv,Jv,eb,pf,Gc,Ia,tb,ff,df,hf,Vc={},Wc=[],e2=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,Uc=Array.isArray;function zi(e,t){for(var n in t)e[n]=t[n];return e}function mf(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function nb(e,t,n){var i,r,o,a={};for(o in t)o=="key"?i=t[o]:o=="ref"?r=t[o]:a[o]=t[o];if(arguments.length>2&&(a.children=arguments.length>3?zc.call(arguments,2):n),typeof e=="function"&&e.defaultProps!=null)for(o in e.defaultProps)a[o]===void 0&&(a[o]=e.defaultProps[o]);return qc(e,a,i,r,null)}function qc(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??++Zv,__i:-1,__u:0};return r==null&&_t.vnode!=null&&_t.vnode(o),o}function Yc(e){return e.children}function Kc(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 t2(e){if(e.__P&&e.__d){var t=e.__v,n=t.__e,i=[],r=[],o=zi({},t);o.__v=t.__v+1,_t.vnode&&_t.vnode(o),gf(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,lb(i,o,r),t.__e=t.__=null,o.__e!=n&&ib(o)}}function ib(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}),ib(e)}function rb(e){(!e.__d&&(e.__d=!0)&&br.push(e)&&!Xc.__r++||Qv!=_t.debounceRendering)&&((Qv=_t.debounceRendering)||Jv)(Xc)}function Xc(){try{for(var e,t=1;br.length;)br.length>t&&br.sort(eb),e=br.shift(),t=br.length,t2(e)}finally{br.length=Xc.__r=0}}function ob(e,t,n,i,r,o,a,s,c,u,l){var p,f,d,g,h,m,S=i&&i.__k||Wc,y=t.length;for(c=n2(n,t,S,c,y),p=0;p<y;p++)(d=n.__k[p])!=null&&(f=d.__i!=-1&&S[d.__i]||Vc,d.__i=p,m=gf(e,d,f,r,o,a,s,c,u,l),g=d.__e,d.ref&&f.ref!=d.ref&&(f.ref&&yf(f.ref,null,d),l.push(d.ref,d.__c||g,d)),h==null&&g!=null&&(h=g),4&d.__u?(c=ab(d,c,e),f.__e&&(f.__e=null)):typeof d.type=="function"&&m!==void 0?c=m:g&&(c=g.nextSibling),d.__u&=-7);return n.__e=h,c}function n2(e,t,n,i,r){var o,a,s,c,u,l=n.length,p=l,f=0;for(e.__k=new Array(r),o=0;o<r;o++)(a=t[o])!=null&&typeof a!="boolean"&&typeof a!="function"?(typeof a=="string"||typeof a=="number"||typeof a=="bigint"||a.constructor==String?a=e.__k[o]=qc(null,a,null,null,null):Uc(a)?a=e.__k[o]=qc(Yc,{children:a},null,null,null):a.constructor===void 0&&a.__b>0?a=e.__k[o]=qc(a.type,a.props,a.key,a.ref?a.ref:null,a.__v):e.__k[o]=a,c=o+f,a.__=e,a.__b=e.__b+1,s=null,(u=a.__i=i2(a,n,c,p))!=-1&&(p--,(s=n[u])&&(s.__u|=2)),s==null||s.__v==null?(u==-1&&(r>l?f--:r<l&&f++),typeof a.type!="function"&&(a.__u|=4)):u!=c&&(u==c-1?f--:u==c+1?f++:(u>c?f--:f++,a.__u|=4))):e.__k[o]=null;if(p)for(o=0;o<l;o++)(s=n[o])!=null&&(2&s.__u)==0&&(s.__e==i&&(i=Wr(s)),fb(s,s));return i}function ab(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=ab(i[r],t,n));return t}e.__e!=t&&(t&&e.type&&!t.parentNode&&(t=Wr(e)),t=n.insertBefore(e.__e,t||null));do t=t&&t.nextSibling;while(t!=null&&t.nodeType==8);return t}function i2(e,t,n,i){var r,o,a,s=e.key,c=e.type,u=t[n],l=u!=null&&(2&u.__u)==0;if(u===null&&s==null||l&&s==u.key&&c==u.type)return n;if(i>(l?1:0)){for(r=n-1,o=n+1;r>=0||o<t.length;)if((u=t[a=r>=0?r--:o++])!=null&&(2&u.__u)==0&&s==u.key&&c==u.type)return a}return-1}function sb(e,t,n){t[0]=="-"?e.setProperty(t,n??""):e[t]=n==null?"":typeof n!="number"||e2.test(t)?n:n+"px"}function Zc(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||sb(e.style,t,"");if(n)for(t in n)i&&n[t]==i[t]||sb(e.style,t,n[t])}else if(t[0]=="o"&&t[1]=="n")o=t!=(t=t.replace(tb,"$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[Ia]=i[Ia]:(n[Ia]=ff,e.addEventListener(t,o?hf:df,o)):e.removeEventListener(t,o?hf:df,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 cb(e){return function(t){if(this.l){var n=this.l[t.type+e];if(t[Gc]==null)t[Gc]=ff++;else if(t[Gc]<n[Ia])return;return n(_t.event?_t.event(t):t)}}}function gf(e,t,n,i,r,o,a,s,c,u){var l,p,f,d,g,h,m,S,y,x,E,P,C,D,A,I,k=t.type;if(t.constructor!==void 0)return null;128&n.__u&&(c=!!(32&n.__u),o=[s=t.__e=n.__e]),(l=_t.__b)&&l(t);e:if(typeof k=="function"){p=a.length;try{if(y=t.props,x=k.prototype&&k.prototype.render,E=(l=k.contextType)&&i[l.__c],P=l?E?E.props.value:l.__:i,n.__c?S=(f=t.__c=n.__c).__=f.__E:(x?t.__c=f=new k(y,P):(t.__c=f=new Kc(y,P),f.constructor=k,f.render=o2),E&&E.sub(f),f.state||(f.state={}),f.__n=i,d=f.__d=!0,f.__h=[],f._sb=[]),x&&f.__s==null&&(f.__s=f.state),x&&k.getDerivedStateFromProps!=null&&(f.__s==f.state&&(f.__s=zi({},f.__s)),zi(f.__s,k.getDerivedStateFromProps(y,f.__s))),g=f.props,h=f.state,f.__v=t,d)x&&k.getDerivedStateFromProps==null&&f.componentWillMount!=null&&f.componentWillMount(),x&&f.componentDidMount!=null&&f.__h.push(f.componentDidMount);else{if(x&&k.getDerivedStateFromProps==null&&y!==g&&f.componentWillReceiveProps!=null&&f.componentWillReceiveProps(y,P),t.__v==n.__v||!f.__e&&f.shouldComponentUpdate!=null&&f.shouldComponentUpdate(y,f.__s,P)===!1){t.__v!=n.__v&&(f.props=y,f.state=f.__s,f.__d=!1),t.__e=n.__e,t.__k=n.__k,t.__k.some(function(O){O&&(O.__=t)}),Wc.push.apply(f.__h,f._sb),f._sb=[],f.__h.length&&a.push(f),s=Wr(n);break e}f.componentWillUpdate!=null&&f.componentWillUpdate(y,f.__s,P),x&&f.componentDidUpdate!=null&&f.__h.push(function(){f.componentDidUpdate(g,h,m)})}if(f.context=P,f.props=y,f.__P=e,f.__e=!1,C=_t.__r,D=0,x)f.state=f.__s,f.__d=!1,C&&C(t),l=f.render(f.props,f.state,f.context),Wc.push.apply(f.__h,f._sb),f._sb=[];else do f.__d=!1,C&&C(t),l=f.render(f.props,f.state,f.context),f.state=f.__s;while(f.__d&&++D<25);f.state=f.__s,f.getChildContext!=null&&(i=zi(zi({},i),f.getChildContext())),x&&!d&&f.getSnapshotBeforeUpdate!=null&&(m=f.getSnapshotBeforeUpdate(g,h)),A=l!=null&&l.type===Yc&&l.key==null?pb(l.props.children):l,s=ob(e,Uc(A)?A:[A],t,n,i,r,o,a,s,c,u),f.base=t.__e,t.__u&=-161,f.__h.length&&a.push(f),S&&(f.__E=f.__=null)}catch(O){if(a.length=p,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(I=o.length;I--;)mf(o[I])}else t.__e=n.__e;t.__k==null&&(t.__k=n.__k||[]),O.then||ub(t),_t.__e(O,t,n)}}else o==null&&t.__v==n.__v?(t.__k=n.__k,t.__e=n.__e):s=t.__e=r2(n.__e,t,n,i,r,o,a,c,u);return(l=_t.diffed)&&l(t),128&t.__u?void 0:s}function ub(e){e&&(e.__c&&(e.__c.__e=!0),e.__k&&e.__k.some(ub))}function lb(e,t,n){for(var i=0;i<n.length;i++)yf(n[i],n[++i],n[++i]);_t.__c&&_t.__c(t,e),e.some(function(r){try{e=r.__h,r.__h=[],e.some(function(o){o.call(r)})}catch(o){_t.__e(o,r.__v)}})}function pb(e){return typeof e!="object"||e==null||e.__b>0?e:Uc(e)?e.map(pb):e.constructor!==void 0?null:zi({},e)}function r2(e,t,n,i,r,o,a,s,c){var u,l,p,f,d,g,h,m=n.props||Vc,S=t.props,y=t.type;if(y=="svg"?r="http://www.w3.org/2000/svg":y=="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==!!y&&(y?d.localName==y:d.nodeType==3)){e=d,o[u]=null;break}}if(e==null){if(y==null)return document.createTextNode(S);e=document.createElementNS(r,y,S.is&&S),s&&(_t.__m&&_t.__m(t,o),s=!1),o=null}if(y==null)m===S||s&&e.data==S||(e.data=S);else{if(o=y=="textarea"&&S.defaultValue!=null?null:o&&zc.call(e.childNodes),!s&&o!=null)for(m={},u=0;u<e.attributes.length;u++)m[(d=e.attributes[u]).name]=d.value;for(u in m)d=m[u],u=="dangerouslySetInnerHTML"?p=d:u=="children"||u in S||u=="value"&&"defaultValue"in S||u=="checked"&&"defaultChecked"in S||Zc(e,u,null,d,r);for(u in S)d=S[u],u=="children"?f=d:u=="dangerouslySetInnerHTML"?l=d:u=="value"?g=d:u=="checked"?h=d:s&&typeof d!="function"||m[u]===d||Zc(e,u,d,m[u],r);if(l)s||p&&(l.__html==p.__html||l.__html==e.innerHTML)||(e.innerHTML=l.__html),t.__k=[];else if(p&&(e.innerHTML=""),ob(t.type=="template"?e.content:e,Uc(f)?f:[f],t,n,i,y=="foreignObject"?"http://www.w3.org/1999/xhtml":r,o,a,o?o[0]:n.__k&&Wr(n,0),s,c),o!=null)for(u=o.length;u--;)mf(o[u]);s&&y!="textarea"||(u="value",y=="progress"&&g==null?e.removeAttribute("value"):g!=null&&(g!==e[u]||y=="progress"&&!g||y=="option"&&g!=m[u])&&Zc(e,u,g,m[u],r),u="checked",h!=null&&h!=e[u]&&Zc(e,u,h,m[u],r))}return e}function yf(e,t,n){try{if(typeof e=="function"){var i=typeof e.__u=="function";i&&e.__u(),i&&t==null||(e.__u=e(t))}else e.current=t}catch(r){_t.__e(r,n)}}function fb(e,t,n){var i,r;if(_t.unmount&&_t.unmount(e),(i=e.ref)&&(i.current&&i.current!=e.__e||yf(i,null,t)),(i=e.__c)!=null){if(i.componentWillUnmount)try{i.componentWillUnmount()}catch(o){_t.__e(o,t)}i.base=i.__P=i.__n=null}if(i=e.__k)for(r=0;r<i.length;r++)i[r]&&fb(i[r],t,n||typeof e.type!="function");n||mf(e.__e),e.__c=e.__=e.__e=void 0}function o2(e,t,n){return this.constructor(e,n)}function db(e,t,n){var i,r,o,a;t==document&&(t=document.documentElement),_t.__&&_t.__(e,t),r=(i=!1)?null:t.__k,o=[],a=[],gf(t,e=t.__k=nb(Yc,null,[e]),r||Vc,Vc,t.namespaceURI,r?null:t.firstChild?zc.call(t.childNodes):null,o,r?r.__e:t.firstChild,i,a),lb(o,e,a),e.props.children=null}zc=Wc.slice,_t={__e:function(e,t,n,i){for(var r,o,a;t=t.__;)if((r=t.__c)&&!r.__)try{if((o=r.constructor)&&o.getDerivedStateFromError!=null&&(r.setState(o.getDerivedStateFromError(e)),a=r.__d),r.componentDidCatch!=null&&(r.componentDidCatch(e,i||{}),a=r.__d),a)return r.__E=r}catch(s){e=s}throw e}},Zv=0,Kc.prototype.setState=function(e,t){var n;n=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=zi({},this.state),typeof e=="function"&&(e=e(zi({},n),this.props)),e&&zi(n,e),e!=null&&this.__v&&(t&&this._sb.push(t),rb(this))},Kc.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),rb(this))},Kc.prototype.render=Yc,br=[],Jv=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,eb=function(e,t){return e.__v.__b-t.__v.__b},Xc.__r=0,pf=Math.random().toString(8),Gc="__d"+pf,Ia="__a"+pf,tb=/(PointerCapture)$|Capture$/i,ff=0,df=cb(!1),hf=cb(!0);var hb=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,hb(e,s,n,["",null])),i.push(r),s[0]?t[0]|=2:(t[o-2]=0,t[o]=r)):i.push(s)}return i},mb=new Map;function a2(e){var t=mb.get(this);return t||(t=new Map,mb.set(this,t)),(t=hb(this,t.get(e)||(t.set(e,t=(function(n){for(var i,r,o=1,a="",s="",c=[0],u=function(f){o===1&&(f||(a=a.replace(/^\s*\n\s*|\s*\n\s*$/g,"")))?c.push(0,f,a):o===3&&(f||a)?(c.push(3,f,a),o=2):o===2&&a==="..."&&f?c.push(4,f,0):o===2&&a&&!f?c.push(5,0,!0,a):o>=5&&((a||!f&&o===5)&&(c.push(o,0,a,r),o=6),f&&(c.push(o,f,0,r),o=6)),a=""},l=0;l<n.length;l++){l&&(o===1&&u(),u(l));for(var p=0;p<n[l].length;p++)i=n[l][p],o===1?i==="<"?(u(),c=[c],o=3):a+=i:o===4?a==="--"&&i===">"?(o=1,a=""):a=i+a[0]:s?i===s?s="":a+=i:i==='"'||i==="'"?s=i:i===">"?(u(),o=1):o&&(i==="="?(o=5,r=a,a=""):i==="/"&&(o<5||n[l][p+1]===">")?(u(),o===3&&(c=c[0]),o=c,(c=c[0]).push(2,0,o),o=0):i===" "||i===" "||i===`
11
- `||i==="\r"?(u(),o=2):a+=i),o===3&&a==="!--"&&(o=4,c=c[0])}return u(),c})(e)),t),arguments,[])).length>1?t:t[0]}var lt=a2.bind(nb),Io,It,vf,gb,Ba=0,yb=[],Wt=_t,vb=Wt.__b,bb=Wt.__r,_b=Wt.diffed,xb=Wt.__c,wb=Wt.unmount,Eb=Wt.__;function Qc(e,t){Wt.__h&&Wt.__h(It,e,Ba||t),Ba=0;var n=It.__H||(It.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({}),n.__[e]}function bf(e){return Ba=1,s2(Rb,e)}function s2(e,t,n){var i=Qc(Io++,2);if(i.t=e,!i.__c&&(i.__=[Rb(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=It,!It.__f)){var r=function(s,c,u){if(!i.__c.__H)return!0;var l=!1,p=i.__c.props!==s;if(i.__c.__H.__.some(function(d){if(d.__N){l=!0;var g=d.__[0];d.__=d.__N,d.__N=void 0,g!==d.__[0]&&(p=!0)}}),o){var f=o.call(this,s,c,u);return l?f||p:f}return!l||p};It.__f=!0;var o=It.shouldComponentUpdate,a=It.componentWillUpdate;It.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)},It.shouldComponentUpdate=r}return i.__N||i.__}function Jc(e,t){var n=Qc(Io++,3);!Wt.__s&&wf(n.__H,t)&&(n.__=e,n.u=t,It.__H.__h.push(n))}function _f(e,t){var n=Qc(Io++,4);!Wt.__s&&wf(n.__H,t)&&(n.__=e,n.u=t,It.__h.push(n))}function eu(e){return Ba=5,Gi(function(){return{current:e}},[])}function Gi(e,t){var n=Qc(Io++,7);return wf(n.__H,t)&&(n.__=e(),n.__H=t,n.__h=e),n.__}function Na(e,t){return Ba=8,Gi(function(){return e},t)}function c2(){for(var e;e=yb.shift();){var t=e.__H;if(e.__P&&t)try{t.__h.some(tu),t.__h.some(xf),t.__h=[]}catch(n){t.__h=[],Wt.__e(n,e.__v)}}}Wt.__b=function(e){It=null,vb&&vb(e)},Wt.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),Eb&&Eb(e,t)},Wt.__r=function(e){bb&&bb(e),Io=0;var t=(It=e.__c).__H;t&&(vf===It?(t.__h=[],It.__h=[],t.__.some(function(n){n.__N&&(n.__=n.__N),n.u=n.__N=void 0})):(t.__h.some(tu),t.__h.some(xf),t.__h=[],Io=0)),vf=It},Wt.diffed=function(e){_b&&_b(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(yb.push(t)!==1&&gb===Wt.requestAnimationFrame||((gb=Wt.requestAnimationFrame)||u2)(c2)),t.__H.__.some(function(n){n.u&&(n.__H=n.u,n.u=void 0)})),vf=It=null},Wt.__c=function(e,t){t.some(function(n){try{n.__h.some(tu),n.__h=n.__h.filter(function(i){return!i.__||xf(i)})}catch(i){t.some(function(r){r.__h&&(r.__h=[])}),t=[],Wt.__e(i,n.__v)}}),xb&&xb(e,t)},Wt.unmount=function(e){wb&&wb(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.some(function(i){try{tu(i)}catch(r){t=r}}),n.__H=void 0,t&&Wt.__e(t,n.__v))};var Sb=typeof requestAnimationFrame=="function";function u2(e){var t,n=function(){clearTimeout(i),Sb&&cancelAnimationFrame(t),setTimeout(e)},i=setTimeout(n,35);Sb&&(t=requestAnimationFrame(n))}function tu(e){var t=It,n=e.__c;typeof n=="function"&&(e.__c=void 0,n()),It=t}function xf(e){var t=It;e.__c=e.__(),It=t}function wf(e,t){return!e||e.length!==t.length||t.some(function(n,i){return n!==e[i]})}function Rb(e,t){return typeof t=="function"?t(e):t}function l2(e){const{navigationStack:t,setNavigationStack:n}=e,i=Gi(()=>t.length<=1?[]:t.slice(0,-1).map((a,s)=>({label:a.label,onClick:()=>n(c=>c.slice(0,s+1))})),[t,n]),r=t.length>0?()=>n([]):null,o=t.length>0?t[t.length-1].label:null;return lt`
10
+ <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="`+f+'" height="'+d+'" viewBox="'+l+" "+p+" "+f+" "+d+'" version="1.1">'+s+a+"</svg>"}catch(i){n=i}if(this._emit("saveSVG.done",{error:n,svg:t}),n)throw n;return{svg:t}},vt.prototype._setDefinitions=function(e){this._definitions=e},vt.prototype.getModules=function(){return this._modules},vt.prototype.clear=function(){this.getDefinitions()&&nr.prototype.clear.call(this)},vt.prototype.destroy=function(){nr.prototype.destroy.call(this),ui(this._container)},vt.prototype.on=function(e,t,n,i){return this.get("eventBus").on(e,t,n,i)},vt.prototype.off=function(e,t){this.get("eventBus").off(e,t)},vt.prototype.attachTo=function(e){if(!e)throw new Error("parentNode required");this.detach(),e.get&&e.constructor.prototype.jquery&&(e=e.get(0)),typeof e=="string"&&(e=ot(e)),e.appendChild(this._container),this._emit("attach",{}),this.get("canvas").resized()},vt.prototype.getDefinitions=function(){return this._definitions},vt.prototype.detach=function(){const e=this._container,t=e.parentNode;t&&(this._emit("detach",{}),t.removeChild(e))},vt.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=H(ri(n,["additionalModules"]),{canvas:H({},n.canvas,{container:e}),modules:a});nr.call(this,s),n&&n.container&&this.attachTo(n.container)},vt.prototype._emit=function(e,t){return this.get("eventBus").fire(e,t)},vt.prototype._createContainer=function(e){const t=ft('<div class="bjs-container"></div>');return dn(t,{width:wm(e.width),height:wm(e.height),position:e.position}),t},vt.prototype._createModdle=function(e){const t=H({},this._moddleExtensions,e.moddleExtensions);return new Rd(t)},vt.prototype._modules=[];function Ls(e,t){return e.warnings=t,e}function FS(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 HS={width:"100%",height:"100%",position:"relative"};function wm(e){return e+(Le(e)?"px":"")}function zS(e,t){return t&&lt(e.diagrams,function(n){return n.id===t})||null}function GS(e){const n='<a href="http://bpmn.io" target="_blank" class="bjs-powered-by" title="Powered by bpmn.io" >'+vm+"</a>",i=ft(n);dn(ot("svg",i),bm),dn(i,_m,{position:"absolute",bottom:"15px",right:"15px",zIndex:"100"}),e.appendChild(i),Ne.bind(i,"click",function(r){jS(),r.preventDefault()})}function fo(e){vt.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)}de(fo,vt),fo.prototype._createModdle=function(e){var t=vt.prototype._createModdle.call(this,e);return t.ids=new ci([32,36,1]),t},fo.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 Ue(e,t){return _(e,"bpmn:CallActivity")?!1:_(e,"bpmn:SubProcess")?(t=t||Ye(e),t&&_(t,"bpmndi:BPMNPlane")?!0:t&&!!t.isExpanded):_(e,"bpmn:Participant")?!!te(e).processRef:!0}function qt(e){if(!(!_(e,"bpmn:Participant")&&!_(e,"bpmn:Lane"))){var t=Ye(e).isHorizontal;return t===void 0?!0:t}}function VS(e){return e&&te(e).isInterrupting!==!1}function un(e){return e&&!!te(e).triggeredByEvent}function ho(e,t){var n=te(e).eventDefinitions;return Ui(n,function(i){return _(i,t)})}function WS(e){return ho(e,"bpmn:ErrorEventDefinition")}function US(e){return ho(e,"bpmn:EscalationEventDefinition")}function qS(e){return ho(e,"bpmn:CompensateEventDefinition")}var Lr={width:90,height:20},Em=15;function ir(e){return _(e,"bpmn:Event")||_(e,"bpmn:Gateway")||_(e,"bpmn:DataStoreReference")||_(e,"bpmn:DataObjectReference")||_(e,"bpmn:DataInput")||_(e,"bpmn:DataOutput")||_(e,"bpmn:SequenceFlow")||_(e,"bpmn:MessageFlow")||_(e,"bpmn:Group")}function Is(e){return Fe(e.label)}function YS(e){var t=e.length/2-1,n=e[Math.floor(t)],i=e[Math.ceil(t+.01)],r=KS(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-=Em:a+=Em,{x:a,y:s}}function KS(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 El(e){return e.waypoints?YS(e.waypoints):_(e,"bpmn:Group")?{x:e.x+e.width/2,y:e.y+Lr.height/2}:{x:e.x+e.width/2,y:e.y+e.height+Lr.height/2}}function XS(e,t){var n,i,r,o=e.label;return o&&o.bounds?(r=o.bounds,i={width:Math.max(Lr.width,r.width),height:r.height},n={x:r.x+r.width/2,y:r.y+r.height/2}):(n=El(t),i=Lr),H({x:n.x-i.width/2,y:n.y-i.height/2},i)}function Sm(e){if(_(e,"bpmn:FlowElement")||_(e,"bpmn:Participant")||_(e,"bpmn:Lane")||_(e,"bpmn:SequenceFlow")||_(e,"bpmn:MessageFlow")||_(e,"bpmn:DataInput")||_(e,"bpmn:DataOutput"))return"name";if(_(e,"bpmn:TextAnnotation"))return"text";if(_(e,"bpmn:Group"))return"categoryValueRef"}function ZS(e){var t=e.categoryValueRef;return t&&t.value||""}function Bn(e){var t=e.businessObject,n=Sm(t);if(n)return n==="categoryValueRef"?ZS(t):t[n]||""}function QS(e,t){var n=e.businessObject,i=Sm(n);if(i)if(i==="categoryValueRef"){if(!n[i])return e;n[i].value=t}else n[i]=t;return e}function JS(e){return Fe(e)&&ir(e.labelTarget)}var mo=7;function Rm(e){let t=[];return L(e.incoming,n=>{_(n,"bpmn:Association")&&_(n.source,"bpmn:TextAnnotation")&&t.push({annotation:n.source,association:n})}),L(e.outgoing,n=>{_(n,"bpmn:Association")&&_(n.target,"bpmn:TextAnnotation")&&t.push({annotation:n.target,association:n})}),t}function ra(e){const t=new Map;return L(gl(e),n=>{L(Rm(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 Sl="hsl(225, 10%, 15%)",eR="white";function di(e,t){return Ui(e.eventDefinitions,function(n){return n.$type===t})}function tR(e){return e.$type==="bpmn:IntermediateThrowEvent"||e.$type==="bpmn:EndEvent"}function nR(e){var t=e.dataObjectRef;return e.isCollection||t&&t.isCollection}function Ve(e,t,n){var i=Ye(e);return n||i.get("color:background-color")||i.get("bioc:fill")||t||eR}function fe(e,t,n){var i=Ye(e);return n||i.get("color:border-color")||i.get("bioc:stroke")||t||Sl}function oa(e,t,n,i){var r=Ye(e),o=r.get("label");return i||o&&o.get("color:color")||t||fe(e,n)}function Cm(e){var t=e.x+e.width/2,n=e.y+e.height/2,i=e.width/2,r=[["M",t,n],["m",0,-i],["a",i,i,0,1,1,0,2*i],["a",i,i,0,1,1,0,-2*i],["z"]];return kr(r)}function Rl(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 kr(a)}function iR(e){var t=e.width,n=e.height,i=e.x,r=e.y,o=t/2,a=n/2,s=[["M",i+o,r],["l",o,a],["l",-o,a],["l",-o,-a],["z"]];return kr(s)}function rR(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 kr(o)}function aa(e,t={}){return{width:Fn(e,t),height:An(e,t)}}function Fn(e,t={}){return wn(t,"width")?t.width:e.width}function An(e,t={}){return wn(t,"height")?t.height:e.height}var oR=new ci,aR=10,Ns=3,sR=1.5,Bs=10,cR=4,go=.95,uR=1,lR=.25;function Ir(e,t,n,i,r,o,a){Ti.call(this,t,a);var s=e&&e.defaultFillColor,c=e&&e.defaultStrokeColor,u=e&&e.defaultLabelColor;function l(M){return n.computeStyle(M,{strokeLinecap:"round",strokeLinejoin:"round",stroke:Sl,strokeWidth:2,fill:"white"})}function p(M){return n.computeStyle(M,["no-fill"],{strokeLinecap:"round",strokeLinejoin:"round",stroke:Sl,strokeWidth:2})}function f(M,w){var{ref:b={x:0,y:0},scale:j=1,element:W,parentGfx:K=r._svg}=w,ye=Ce("marker",{id:M,viewBox:"0 0 20 20",refX:b.x,refY:b.y,markerWidth:20*j,markerHeight:20*j,orient:"auto"});Be(ye,W);var Ie=ot(":scope > defs",K);Ie||(Ie=Ce("defs"),Be(K,Ie)),Be(Ie,ye)}function d(M,w,b,j){var W=oR.nextPrefixed("marker-");return g(M,W,w,b,j),"url(#"+W+")"}function g(M,w,b,j,W){if(b==="sequenceflow-end"){var K=Ce("path",{d:"M 1 5 L 11 10 L 1 15 Z",...l({fill:W,stroke:W,strokeWidth:1})});f(w,{element:K,ref:{x:11,y:10},scale:.5,parentGfx:M})}if(b==="messageflow-start"){var ye=Ce("circle",{cx:6,cy:6,r:3.5,...l({fill:j,stroke:W,strokeWidth:1,strokeDasharray:[1e4,1]})});f(w,{element:ye,ref:{x:6,y:6},parentGfx:M})}if(b==="messageflow-end"){var Ie=Ce("path",{d:"m 1 5 l 0 -3 l 7 3 l -7 3 z",...l({fill:j,stroke:W,strokeWidth:1,strokeDasharray:[1e4,1]})});f(w,{element:Ie,ref:{x:8.5,y:5},parentGfx:M})}if(b==="association-start"){var Xe=Ce("path",{d:"M 11 5 L 1 10 L 11 15",...p({fill:"none",stroke:W,strokeWidth:1.5,strokeDasharray:[1e4,1]})});f(w,{element:Xe,ref:{x:1,y:10},scale:.5,parentGfx:M})}if(b==="association-end"){var Et=Ce("path",{d:"M 1 5 L 11 10 L 1 15",...p({fill:"none",stroke:W,strokeWidth:1.5,strokeDasharray:[1e4,1]})});f(w,{element:Et,ref:{x:11,y:10},scale:.5,parentGfx:M})}if(b==="conditional-flow-marker"){var nt=Ce("path",{d:"M 0 10 L 8 6 L 16 10 L 8 14 Z",...l({fill:j,stroke:W})});f(w,{element:nt,ref:{x:-1,y:10},scale:.5,parentGfx:M})}if(b==="conditional-default-flow-marker"){var Ht=Ce("path",{d:"M 6 4 L 10 16",...l({stroke:W,fill:"none"})});f(w,{element:Ht,ref:{x:0,y:10},scale:.5,parentGfx:M})}}function h(M,w,b,j,W={}){Vt(j)&&(W=j,j=0),j=j||0,W=l(W);var K=w/2,ye=b/2,Ie=Ce("circle",{cx:K,cy:ye,r:Math.round((w+b)/4-j),...W});return Be(M,Ie),Ie}function m(M,w,b,j,W,K){Vt(W)&&(K=W,W=0),W=W||0,K=l(K);var ye=Ce("rect",{x:W,y:W,width:w-W*2,height:b-W*2,rx:j,ry:j,...K});return Be(M,ye),ye}function E(M,w,b,j){var W=w/2,K=b/2,ye=[{x:W,y:0},{x:w,y:K},{x:W,y:b},{x:0,y:K}],Ie=ye.map(function(Et){return Et.x+","+Et.y}).join(" ");j=l(j);var Xe=Ce("polygon",{...j,points:Ie});return Be(M,Xe),Xe}function y(M,w,b,j){b=p(b);var W=Zo(w,b,j);return Be(M,W),W}function x(M,w,b){return y(M,w,b,5)}function S(M,w,b){b=p(b);var j=Ce("path",{...b,d:w});return Be(M,j),j}function P(M,w,b,j){return S(w,b,H({"data-marker":M},j))}function C(M){return wt[M]}function D(M){return function(w,b,j){return C(M)(w,b,j)}}var T={"bpmn:MessageEventDefinition":function(M,w,b={},j){var W=i.getScaledPath("EVENT_MESSAGE",{xScaleFactor:.9,yScaleFactor:.9,containerWidth:b.width||w.width,containerHeight:b.height||w.height,position:{mx:.235,my:.315}}),K=j?fe(w,c,b.stroke):Ve(w,s,b.fill),ye=j?Ve(w,s,b.fill):fe(w,c,b.stroke),Ie=S(M,W,{fill:K,stroke:ye,strokeWidth:1});return Ie},"bpmn:TimerEventDefinition":function(M,w,b={}){var j=b.width||w.width,W=b.height||w.height,K=b.width?1:2,ye=h(M,j,W,.2*W,{fill:Ve(w,s,b.fill),stroke:fe(w,c,b.stroke),strokeWidth:K}),Ie=i.getScaledPath("EVENT_TIMER_WH",{xScaleFactor:.75,yScaleFactor:.75,containerWidth:j,containerHeight:W,position:{mx:.5,my:.5}});S(M,Ie,{stroke:fe(w,c,b.stroke),strokeWidth:K});for(var Xe=0;Xe<12;Xe++){var Et=i.getScaledPath("EVENT_TIMER_LINE",{xScaleFactor:.75,yScaleFactor:.75,containerWidth:j,containerHeight:W,position:{mx:.5,my:.5}}),nt=j/2,Ht=W/2;S(M,Et,{strokeWidth:1,stroke:fe(w,c,b.stroke),transform:"rotate("+Xe*30+","+Ht+","+nt+")"})}return ye},"bpmn:EscalationEventDefinition":function(M,w,b={},j){var W=i.getScaledPath("EVENT_ESCALATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:b.width||w.width,containerHeight:b.height||w.height,position:{mx:.5,my:.2}}),K=j?fe(w,c,b.stroke):Ve(w,s,b.fill);return S(M,W,{fill:K,stroke:fe(w,c,b.stroke),strokeWidth:1})},"bpmn:ConditionalEventDefinition":function(M,w,b={}){var j=i.getScaledPath("EVENT_CONDITIONAL",{xScaleFactor:1,yScaleFactor:1,containerWidth:b.width||w.width,containerHeight:b.height||w.height,position:{mx:.5,my:.222}});return S(M,j,{fill:Ve(w,s,b.fill),stroke:fe(w,c,b.stroke),strokeWidth:1})},"bpmn:LinkEventDefinition":function(M,w,b={},j){var W=i.getScaledPath("EVENT_LINK",{xScaleFactor:1,yScaleFactor:1,containerWidth:w.width,containerHeight:w.height,position:{mx:.57,my:.263}}),K=j?fe(w,c,b.stroke):Ve(w,s,b.fill);return S(M,W,{fill:K,stroke:fe(w,c,b.stroke),strokeWidth:1})},"bpmn:ErrorEventDefinition":function(M,w,b={},j){var W=i.getScaledPath("EVENT_ERROR",{xScaleFactor:1.1,yScaleFactor:1.1,containerWidth:b.width||w.width,containerHeight:b.height||w.height,position:{mx:.2,my:.722}}),K=j?fe(w,c,b.stroke):Ve(w,s,b.fill);return S(M,W,{fill:K,stroke:fe(w,c,b.stroke),strokeWidth:1})},"bpmn:CancelEventDefinition":function(M,w,b={},j){var W=i.getScaledPath("EVENT_CANCEL_45",{xScaleFactor:1,yScaleFactor:1,containerWidth:w.width,containerHeight:w.height,position:{mx:.638,my:-.055}}),K=j?fe(w,c,b.stroke):"none",ye=S(M,W,{fill:K,stroke:fe(w,c,b.stroke),strokeWidth:1});return gm(ye,45),ye},"bpmn:CompensateEventDefinition":function(M,w,b={},j){var W=i.getScaledPath("EVENT_COMPENSATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:b.width||w.width,containerHeight:b.height||w.height,position:{mx:.22,my:.5}}),K=j?fe(w,c,b.stroke):Ve(w,s,b.fill);return S(M,W,{fill:K,stroke:fe(w,c,b.stroke),strokeWidth:1})},"bpmn:SignalEventDefinition":function(M,w,b={},j){var W=i.getScaledPath("EVENT_SIGNAL",{xScaleFactor:.9,yScaleFactor:.9,containerWidth:b.width||w.width,containerHeight:b.height||w.height,position:{mx:.5,my:.2}}),K=j?fe(w,c,b.stroke):Ve(w,s,b.fill);return S(M,W,{strokeWidth:1,fill:K,stroke:fe(w,c,b.stroke)})},"bpmn:MultipleEventDefinition":function(M,w,b={},j){var W=i.getScaledPath("EVENT_MULTIPLE",{xScaleFactor:1.1,yScaleFactor:1.1,containerWidth:b.width||w.width,containerHeight:b.height||w.height,position:{mx:.211,my:.36}}),K=j?fe(w,c,b.stroke):Ve(w,s,b.fill);return S(M,W,{fill:K,stroke:fe(w,c,b.stroke),strokeWidth:1})},"bpmn:ParallelMultipleEventDefinition":function(M,w,b={}){var j=i.getScaledPath("EVENT_PARALLEL_MULTIPLE",{xScaleFactor:1.2,yScaleFactor:1.2,containerWidth:b.width||w.width,containerHeight:b.height||w.height,position:{mx:.458,my:.194}});return S(M,j,{fill:Ve(w,s,b.fill),stroke:fe(w,c,b.stroke),strokeWidth:1})},"bpmn:TerminateEventDefinition":function(M,w,b={}){var j=h(M,w.width,w.height,8,{fill:fe(w,c,b.stroke),stroke:fe(w,c,b.stroke),strokeWidth:4});return j}};function N(M,w,b={},j){var W=te(M),K=tR(W),ye=j||M;return W.get("eventDefinitions")&&W.get("eventDefinitions").length>1?W.get("parallelMultiple")?T["bpmn:ParallelMultipleEventDefinition"](w,ye,b,K):T["bpmn:MultipleEventDefinition"](w,ye,b,K):di(W,"bpmn:MessageEventDefinition")?T["bpmn:MessageEventDefinition"](w,ye,b,K):di(W,"bpmn:TimerEventDefinition")?T["bpmn:TimerEventDefinition"](w,ye,b,K):di(W,"bpmn:ConditionalEventDefinition")?T["bpmn:ConditionalEventDefinition"](w,ye,b,K):di(W,"bpmn:SignalEventDefinition")?T["bpmn:SignalEventDefinition"](w,ye,b,K):di(W,"bpmn:EscalationEventDefinition")?T["bpmn:EscalationEventDefinition"](w,ye,b,K):di(W,"bpmn:LinkEventDefinition")?T["bpmn:LinkEventDefinition"](w,ye,b,K):di(W,"bpmn:ErrorEventDefinition")?T["bpmn:ErrorEventDefinition"](w,ye,b,K):di(W,"bpmn:CancelEventDefinition")?T["bpmn:CancelEventDefinition"](w,ye,b,K):di(W,"bpmn:CompensateEventDefinition")?T["bpmn:CompensateEventDefinition"](w,ye,b,K):di(W,"bpmn:TerminateEventDefinition")?T["bpmn:TerminateEventDefinition"](w,ye,b,K):null}var k={ParticipantMultiplicityMarker:function(M,w,b={}){var j=Fn(w,b),W=An(w,b),K=i.getScaledPath("MARKER_PARALLEL",{xScaleFactor:1,yScaleFactor:1,containerWidth:j,containerHeight:W,position:{mx:(j/2-6)/j,my:(W-15)/W}});P("participant-multiplicity",M,K,{strokeWidth:2,fill:Ve(w,s,b.fill),stroke:fe(w,c,b.stroke)})},SubProcessMarker:function(M,w,b={}){var j=m(M,14,14,0,{strokeWidth:1,fill:Ve(w,s,b.fill),stroke:fe(w,c,b.stroke)});en(j,w.width/2-7.5,w.height-20);var W=i.getScaledPath("MARKER_SUB_PROCESS",{xScaleFactor:1.5,yScaleFactor:1.5,containerWidth:w.width,containerHeight:w.height,position:{mx:(w.width/2-7.5)/w.width,my:(w.height-20)/w.height}});P("sub-process",M,W,{fill:Ve(w,s,b.fill),stroke:fe(w,c,b.stroke)})},ParallelMarker:function(M,w,b){var j=Fn(w,b),W=An(w,b),K=i.getScaledPath("MARKER_PARALLEL",{xScaleFactor:1,yScaleFactor:1,containerWidth:j,containerHeight:W,position:{mx:(j/2+b.parallel)/j,my:(W-20)/W}});P("parallel",M,K,{fill:Ve(w,s,b.fill),stroke:fe(w,c,b.stroke)})},SequentialMarker:function(M,w,b){var j=i.getScaledPath("MARKER_SEQUENTIAL",{xScaleFactor:1,yScaleFactor:1,containerWidth:w.width,containerHeight:w.height,position:{mx:(w.width/2+b.seq)/w.width,my:(w.height-19)/w.height}});P("sequential",M,j,{fill:Ve(w,s,b.fill),stroke:fe(w,c,b.stroke)})},CompensationMarker:function(M,w,b){var j=i.getScaledPath("MARKER_COMPENSATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:w.width,containerHeight:w.height,position:{mx:(w.width/2+b.compensation)/w.width,my:(w.height-13)/w.height}});P("compensation",M,j,{strokeWidth:1,fill:Ve(w,s,b.fill),stroke:fe(w,c,b.stroke)})},LoopMarker:function(M,w,b){var j=Fn(w,b),W=An(w,b),K=i.getScaledPath("MARKER_LOOP",{xScaleFactor:1,yScaleFactor:1,containerWidth:j,containerHeight:W,position:{mx:(j/2+b.loop)/j,my:(W-7)/W}});P("loop",M,K,{strokeWidth:1.5,fill:"none",stroke:fe(w,c,b.stroke),strokeMiterlimit:.5})},AdhocMarker:function(M,w,b){var j=Fn(w,b),W=An(w,b),K=i.getScaledPath("MARKER_ADHOC",{xScaleFactor:1,yScaleFactor:1,containerWidth:j,containerHeight:W,position:{mx:(j/2+b.adhoc)/j,my:(W-15)/W}});P("adhoc",M,K,{strokeWidth:1,fill:fe(w,c,b.stroke),stroke:fe(w,c,b.stroke)})}};function O(M,w,b,j){k[M](w,b,j)}function F(M,w,b=[],j={}){j={fill:j.fill,stroke:j.stroke,width:Fn(w,j),height:An(w,j)};var W=te(w),K=b.includes("SubProcessMarker");K?j={...j,seq:-21,parallel:-22,compensation:-25,loop:-18,adhoc:10}:j={...j,seq:-5,parallel:-6,compensation:-7,loop:0,adhoc:-8},W.get("isForCompensation")&&b.push("CompensationMarker"),_(W,"bpmn:AdHocSubProcess")&&(b.push("AdhocMarker"),K||H(j,{compensation:j.compensation-18}));var ye=W.get("loopCharacteristics"),Ie=ye&&ye.get("isSequential");ye&&(H(j,{compensation:j.compensation-18}),b.includes("AdhocMarker")&&H(j,{seq:-23,loop:-18,parallel:-24}),Ie===void 0&&b.push("LoopMarker"),Ie===!1&&b.push("ParallelMarker"),Ie===!0&&b.push("SequentialMarker")),b.includes("CompensationMarker")&&b.length===1&&H(j,{compensation:-8}),L(b,function(Xe){O(Xe,M,w,j)})}function oe(M,w,b={}){b=H({size:{width:100}},b);var j=o.createText(w||"",b);return qe(j).add("djs-label"),Be(M,j),j}function _e(M,w,b,j={}){var W=te(w),K=aa({x:w.x,y:w.y,width:w.width,height:w.height},j);return oe(M,W.name,{align:b,box:K,padding:7,style:{fill:oa(w,u,c,j.stroke)}})}function We(M,w,b={}){var j={width:w.width,height:w.height,x:w.width/2+w.x,y:w.height/2+w.y};return oe(M,Bn(w),{box:j,style:H({},o.getExternalStyle(),{fill:oa(w,u,c,b.stroke)})})}function Y(M,w,b,j={}){var W=qt(b),K=oe(M,w,{box:{height:30,width:W?An(b,j):Fn(b,j)},align:"center-middle",style:{fill:oa(b,u,c,j.stroke)}});if(W){var ye=-1*An(b,j);Os(K,0,-ye,270)}}function le(M,w,b={}){var{width:j,height:W}=aa(w,b);return m(M,j,W,Bs,{...b,fill:Ve(w,s,b.fill),fillOpacity:go,stroke:fe(w,c,b.stroke)})}function ge(M,w,b={}){var j=te(w),W=Ve(w,s,b.fill),K=fe(w,c,b.stroke);return(j.get("associationDirection")==="One"||j.get("associationDirection")==="Both")&&(b.markerEnd=d(M,"association-end",W,K)),j.get("associationDirection")==="Both"&&(b.markerStart=d(M,"association-start",W,K)),b=Ke(b,["markerStart","markerEnd"]),x(M,w.waypoints,{...b,stroke:K,strokeDasharray:"0, 5"})}function ue(M,w,b={}){var j=Ve(w,s,b.fill),W=fe(w,c,b.stroke),K=i.getScaledPath("DATA_OBJECT_PATH",{xScaleFactor:1,yScaleFactor:1,containerWidth:w.width,containerHeight:w.height,position:{mx:.474,my:.296}}),ye=S(M,K,{fill:j,fillOpacity:go,stroke:W}),Ie=te(w);if(nR(Ie)){var Xe=i.getScaledPath("DATA_OBJECT_COLLECTION_PATH",{xScaleFactor:1,yScaleFactor:1,containerWidth:w.width,containerHeight:w.height,position:{mx:.33,my:(w.height-18)/w.height}});S(M,Xe,{strokeWidth:2,fill:j,stroke:W})}return ye}function Re(M,w,b={}){return h(M,w.width,w.height,{fillOpacity:go,...b,fill:Ve(w,s,b.fill),stroke:fe(w,c,b.stroke)})}function re(M,w,b={}){return E(M,w.width,w.height,{fill:Ve(w,s,b.fill),fillOpacity:go,stroke:fe(w,c,b.stroke)})}function q(M,w,b={}){var j=m(M,Fn(w,b),An(w,b),0,{fill:Ve(w,s,b.fill),fillOpacity:b.fillOpacity||go,stroke:fe(w,c,b.stroke),strokeWidth:1.5}),W=te(w);if(_(W,"bpmn:Lane")){var K=W.get("name");Y(M,K,w,b)}return j}function U(M,w,b={}){var j=le(M,w,b),W=Ue(w);if(un(w)&&(he(j,{strokeDasharray:"0, 5.5",strokeWidth:2.5}),!W)){var K=te(w).flowElements||[],ye=K.filter(Ie=>_(Ie,"bpmn:StartEvent"));ye.length===1&&Z(ye[0],M,b,w)}return _e(M,w,W?"center-top":"center-middle",b),W?F(M,w,void 0,b):F(M,w,["SubProcessMarker"],b),j}function Z(M,w,b,j){var W=22,K={fill:Ve(j,s,b.fill),stroke:fe(j,c,b.stroke),width:W,height:W},ye=te(M).isInterrupting,Ie=ye?0:3,Xe=ye?1:1.2,Et=20,nt=(W-Et)/2,Ht="translate("+nt+","+nt+")";h(w,Et,Et,{fill:K.fill,stroke:K.stroke,strokeWidth:Xe,strokeDasharray:Ie,transform:Ht}),N(M,w,K,j)}function He(M,w,b={}){var j=le(M,w,b);return _e(M,w,"center-middle",b),F(M,w,void 0,b),j}var wt=this.handlers={"bpmn:AdHocSubProcess":function(M,w,b={}){return Ue(w)?b=Ke(b,["fill","stroke","width","height"]):b=Ke(b,["fill","stroke"]),U(M,w,b)},"bpmn:Association":function(M,w,b={}){return b=Ke(b,["fill","stroke"]),ge(M,w,b)},"bpmn:BoundaryEvent":function(M,w,b={}){var{renderIcon:j=!0}=b;b=Ke(b,["fill","stroke"]);var W=te(w),K=W.get("cancelActivity");b={strokeWidth:1.5,fill:Ve(w,s,b.fill),fillOpacity:uR,stroke:fe(w,c,b.stroke)},K||(b.strokeDasharray="6");var ye=Re(M,w,b);return h(M,w.width,w.height,Ns,{...b,fill:"none"}),j&&N(w,M,b),ye},"bpmn:BusinessRuleTask":function(M,w,b={}){b=Ke(b,["fill","stroke"]);var j=He(M,w,b),W=i.getScaledPath("TASK_TYPE_BUSINESS_RULE_MAIN",{abspos:{x:8,y:8}}),K=S(M,W);he(K,{fill:Ve(w,s,b.fill),stroke:fe(w,c,b.stroke),strokeWidth:1});var ye=i.getScaledPath("TASK_TYPE_BUSINESS_RULE_HEADER",{abspos:{x:8,y:8}}),Ie=S(M,ye);return he(Ie,{fill:fe(w,c,b.stroke),stroke:fe(w,c,b.stroke),strokeWidth:1}),j},"bpmn:CallActivity":function(M,w,b={}){return b=Ke(b,["fill","stroke"]),U(M,w,{strokeWidth:5,...b})},"bpmn:ComplexGateway":function(M,w,b={}){b=Ke(b,["fill","stroke"]);var j=re(M,w,b),W=i.getScaledPath("GATEWAY_COMPLEX",{xScaleFactor:.5,yScaleFactor:.5,containerWidth:w.width,containerHeight:w.height,position:{mx:.46,my:.26}});return S(M,W,{fill:fe(w,c,b.stroke),stroke:fe(w,c,b.stroke),strokeWidth:1}),j},"bpmn:DataInput":function(M,w,b={}){b=Ke(b,["fill","stroke"]);var j=i.getRawPath("DATA_ARROW"),W=ue(M,w,b);return S(M,j,{fill:"none",stroke:fe(w,c,b.stroke),strokeWidth:1}),W},"bpmn:DataInputAssociation":function(M,w,b={}){return b=Ke(b,["fill","stroke"]),ge(M,w,{...b,markerEnd:d(M,"association-end",Ve(w,s,b.fill),fe(w,c,b.stroke))})},"bpmn:DataObject":function(M,w,b={}){return b=Ke(b,["fill","stroke"]),ue(M,w,b)},"bpmn:DataObjectReference":D("bpmn:DataObject"),"bpmn:DataOutput":function(M,w,b={}){b=Ke(b,["fill","stroke"]);var j=i.getRawPath("DATA_ARROW"),W=ue(M,w,b);return S(M,j,{strokeWidth:1,fill:fe(w,c,b.stroke),stroke:fe(w,c,b.stroke)}),W},"bpmn:DataOutputAssociation":function(M,w,b={}){return b=Ke(b,["fill","stroke"]),ge(M,w,{...b,markerEnd:d(M,"association-end",Ve(w,s,b.fill),fe(w,c,b.stroke))})},"bpmn:DataStoreReference":function(M,w,b={}){b=Ke(b,["fill","stroke"]);var j=i.getScaledPath("DATA_STORE",{xScaleFactor:1,yScaleFactor:1,containerWidth:w.width,containerHeight:w.height,position:{mx:0,my:.133}});return S(M,j,{fill:Ve(w,s,b.fill),fillOpacity:go,stroke:fe(w,c,b.stroke),strokeWidth:2})},"bpmn:EndEvent":function(M,w,b={}){var{renderIcon:j=!0}=b;b=Ke(b,["fill","stroke"]);var W=Re(M,w,{...b,strokeWidth:4});return j&&N(w,M,b),W},"bpmn:EventBasedGateway":function(M,w,b={}){b=Ke(b,["fill","stroke"]);var j=te(w),W=re(M,w,b);h(M,w.width,w.height,w.height*.2,{fill:Ve(w,"none",b.fill),stroke:fe(w,c,b.stroke),strokeWidth:1});var K=j.get("eventGatewayType"),ye=!!j.get("instantiate");function Ie(){var Et=i.getScaledPath("GATEWAY_EVENT_BASED",{xScaleFactor:.18,yScaleFactor:.18,containerWidth:w.width,containerHeight:w.height,position:{mx:.36,my:.44}});S(M,Et,{fill:"none",stroke:fe(w,c,b.stroke),strokeWidth:2})}if(K==="Parallel"){var Xe=i.getScaledPath("GATEWAY_PARALLEL",{xScaleFactor:.4,yScaleFactor:.4,containerWidth:w.width,containerHeight:w.height,position:{mx:.474,my:.296}});S(M,Xe,{fill:"none",stroke:fe(w,c,b.stroke),strokeWidth:1})}else K==="Exclusive"&&(ye||h(M,w.width,w.height,w.height*.26,{fill:"none",stroke:fe(w,c,b.stroke),strokeWidth:1}),Ie());return W},"bpmn:ExclusiveGateway":function(M,w,b={}){b=Ke(b,["fill","stroke"]);var j=re(M,w,b),W=i.getScaledPath("GATEWAY_EXCLUSIVE",{xScaleFactor:.4,yScaleFactor:.4,containerWidth:w.width,containerHeight:w.height,position:{mx:.32,my:.3}}),K=Ye(w);return K.get("isMarkerVisible")&&S(M,W,{fill:fe(w,c,b.stroke),stroke:fe(w,c,b.stroke),strokeWidth:1}),j},"bpmn:Gateway":function(M,w,b={}){return b=Ke(b,["fill","stroke"]),re(M,w,b)},"bpmn:Group":function(M,w,b={}){return b=Ke(b,["fill","stroke","width","height"]),m(M,w.width,w.height,Bs,{stroke:fe(w,c,b.stroke),strokeWidth:1.5,strokeDasharray:"10, 6, 0, 6",fill:"none",pointerEvents:"none",width:Fn(w,b),height:An(w,b)})},"bpmn:InclusiveGateway":function(M,w,b={}){b=Ke(b,["fill","stroke"]);var j=re(M,w,b);return h(M,w.width,w.height,w.height*.24,{fill:Ve(w,s,b.fill),stroke:fe(w,c,b.stroke),strokeWidth:2.5}),j},"bpmn:IntermediateEvent":function(M,w,b={}){var{renderIcon:j=!0}=b;b=Ke(b,["fill","stroke"]);var W=Re(M,w,{...b,strokeWidth:1.5});return h(M,w.width,w.height,Ns,{fill:"none",stroke:fe(w,c,b.stroke),strokeWidth:1.5}),j&&N(w,M,b),W},"bpmn:IntermediateCatchEvent":D("bpmn:IntermediateEvent"),"bpmn:IntermediateThrowEvent":D("bpmn:IntermediateEvent"),"bpmn:Lane":function(M,w,b={}){return b=Ke(b,["fill","stroke","width","height"]),q(M,w,{...b,fillOpacity:lR})},"bpmn:ManualTask":function(M,w,b={}){b=Ke(b,["fill","stroke"]);var j=He(M,w,b),W=i.getScaledPath("TASK_TYPE_MANUAL",{abspos:{x:17,y:15}});return S(M,W,{fill:Ve(w,s,b.fill),stroke:fe(w,c,b.stroke),strokeWidth:.5}),j},"bpmn:MessageFlow":function(M,w,b={}){b=Ke(b,["fill","stroke"]);var j=te(w),W=Ye(w),K=Ve(w,s,b.fill),ye=fe(w,c,b.stroke),Ie=x(M,w.waypoints,{markerEnd:d(M,"messageflow-end",K,ye),markerStart:d(M,"messageflow-start",K,ye),stroke:ye,strokeDasharray:"10, 11",strokeWidth:1.5});if(j.get("messageRef")){var Xe=Ie.getPointAtLength(Ie.getTotalLength()/2),Et=i.getScaledPath("MESSAGE_FLOW_MARKER",{abspos:{x:Xe.x,y:Xe.y}}),nt={strokeWidth:1};W.get("messageVisibleKind")==="initiating"?(nt.fill=K,nt.stroke=ye):(nt.fill=ye,nt.stroke=K);var Ht=S(M,Et,nt),Xt=j.get("messageRef"),ln=Xt.get("name"),et=oe(M,ln,{align:"center-top",fitBox:!0,style:{fill:ye}}),zt=Ht.getBBox(),Zt=et.getBBox(),Wi=Xe.x-Zt.width/2,vn=Xe.y+zt.height/2+aR;Os(et,Wi,vn,0)}return Ie},"bpmn:ParallelGateway":function(M,w,b={}){b=Ke(b,["fill","stroke"]);var j=re(M,w,b),W=i.getScaledPath("GATEWAY_PARALLEL",{xScaleFactor:.6,yScaleFactor:.6,containerWidth:w.width,containerHeight:w.height,position:{mx:.46,my:.2}});return S(M,W,{fill:fe(w,c,b.stroke),stroke:fe(w,c,b.stroke),strokeWidth:1}),j},"bpmn:Participant":function(M,w,b={}){b=Ke(b,["fill","stroke","width","height"]);var j=q(M,w,b),W=Ue(w),K=qt(w),ye=te(w),Ie=ye.get("name");if(W){var Xe=K?[{x:30,y:0},{x:30,y:An(w,b)}]:[{x:0,y:30},{x:Fn(w,b),y:30}];y(M,Xe,{stroke:fe(w,c,b.stroke),strokeWidth:sR}),Y(M,Ie,w,b)}else{var Et=aa(w,b);K||(Et.height=Fn(w,b),Et.width=An(w,b));var nt=oe(M,Ie,{box:Et,align:"center-middle",style:{fill:oa(w,u,c,b.stroke)}});if(!K){var Ht=-1*An(w,b);Os(nt,0,-Ht,270)}}return ye.get("participantMultiplicity")&&O("ParticipantMultiplicityMarker",M,w,b),j},"bpmn:ReceiveTask":function(M,w,b={}){b=Ke(b,["fill","stroke"]);var j=te(w),W=He(M,w,b),K;return j.get("instantiate")?(h(M,28,28,20*.22,{fill:Ve(w,s,b.fill),stroke:fe(w,c,b.stroke),strokeWidth:1}),K=i.getScaledPath("TASK_TYPE_INSTANTIATING_SEND",{abspos:{x:7.77,y:9.52}})):K=i.getScaledPath("TASK_TYPE_SEND",{xScaleFactor:.9,yScaleFactor:.9,containerWidth:21,containerHeight:14,position:{mx:.3,my:.4}}),S(M,K,{fill:Ve(w,s,b.fill),stroke:fe(w,c,b.stroke),strokeWidth:1}),W},"bpmn:ScriptTask":function(M,w,b={}){b=Ke(b,["fill","stroke"]);var j=He(M,w,b),W=i.getScaledPath("TASK_TYPE_SCRIPT",{abspos:{x:15,y:20}});return S(M,W,{fill:Ve(w,s,b.fill),stroke:fe(w,c,b.stroke),strokeWidth:1}),j},"bpmn:SendTask":function(M,w,b={}){b=Ke(b,["fill","stroke"]);var j=He(M,w,b),W=i.getScaledPath("TASK_TYPE_SEND",{xScaleFactor:1,yScaleFactor:1,containerWidth:21,containerHeight:14,position:{mx:.285,my:.357}});return S(M,W,{fill:fe(w,c,b.stroke),stroke:Ve(w,s,b.fill),strokeWidth:1}),j},"bpmn:SequenceFlow":function(M,w,b={}){b=Ke(b,["fill","stroke"]);var j=Ve(w,s,b.fill),W=fe(w,c,b.stroke),K=x(M,w.waypoints,{markerEnd:d(M,"sequenceflow-end",j,W),stroke:W}),ye=te(w),{source:Ie}=w;if(Ie){var Xe=te(Ie);ye.get("conditionExpression")&&_(Xe,"bpmn:Activity")&&he(K,{markerStart:d(M,"conditional-flow-marker",j,W)}),Xe.get("default")&&(_(Xe,"bpmn:Gateway")||_(Xe,"bpmn:Activity"))&&Xe.get("default")===ye&&he(K,{markerStart:d(M,"conditional-default-flow-marker",j,W)})}return K},"bpmn:ServiceTask":function(M,w,b={}){b=Ke(b,["fill","stroke"]);var j=He(M,w,b);h(M,10,10,{fill:Ve(w,s,b.fill),stroke:"none",transform:"translate(6, 6)"});var W=i.getScaledPath("TASK_TYPE_SERVICE",{abspos:{x:12,y:18}});S(M,W,{fill:Ve(w,s,b.fill),stroke:fe(w,c,b.stroke),strokeWidth:1}),h(M,10,10,{fill:Ve(w,s,b.fill),stroke:"none",transform:"translate(11, 10)"});var K=i.getScaledPath("TASK_TYPE_SERVICE",{abspos:{x:17,y:22}});return S(M,K,{fill:Ve(w,s,b.fill),stroke:fe(w,c,b.stroke),strokeWidth:1}),j},"bpmn:StartEvent":function(M,w,b={}){var{renderIcon:j=!0}=b;b=Ke(b,["fill","stroke"]);var W=te(w);W.get("isInterrupting")||(b={...b,strokeDasharray:"6"});var K=Re(M,w,b);return j&&N(w,M,b),K},"bpmn:SubProcess":function(M,w,b={}){return Ue(w)?b=Ke(b,["fill","stroke","width","height"]):b=Ke(b,["fill","stroke"]),U(M,w,b)},"bpmn:Task":function(M,w,b={}){return b=Ke(b,["fill","stroke"]),He(M,w,b)},"bpmn:TextAnnotation":function(M,w,b={}){b=Ke(b,["fill","stroke"]);var{width:j,height:W}=aa(w,b),K=m(M,j,W,0,0,{fill:"none",stroke:"none"}),ye=i.getScaledPath("TEXT_ANNOTATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:j,containerHeight:W,position:{mx:0,my:0}});S(M,ye,{stroke:fe(w,c,b.stroke)});var Ie=te(w),Xe=Ie.get("text")||"";return oe(M,Xe,{align:"left-top",box:aa(w,b),padding:mo,style:{fill:oa(w,u,c,b.stroke)}}),K},"bpmn:Transaction":function(M,w,b={}){Ue(w)?b=Ke(b,["fill","stroke","width","height"]):b=Ke(b,["fill","stroke"]);var j=U(M,w,{strokeWidth:1.5,...b}),W=n.style(["no-fill","no-events"],{stroke:fe(w,c,b.stroke),strokeWidth:1.5}),K=Ue(w);return K||(b={}),m(M,Fn(w,b),An(w,b),Bs-Ns,Ns,W),j},"bpmn:UserTask":function(M,w,b={}){b=Ke(b,["fill","stroke"]);var j=He(M,w,b),W=15,K=12,ye=i.getScaledPath("TASK_TYPE_USER_1",{abspos:{x:W,y:K}});S(M,ye,{fill:Ve(w,s,b.fill),stroke:fe(w,c,b.stroke),strokeWidth:.5});var Ie=i.getScaledPath("TASK_TYPE_USER_2",{abspos:{x:W,y:K}});S(M,Ie,{fill:Ve(w,s,b.fill),stroke:fe(w,c,b.stroke),strokeWidth:.5});var Xe=i.getScaledPath("TASK_TYPE_USER_3",{abspos:{x:W,y:K}});return S(M,Xe,{fill:fe(w,c,b.stroke),stroke:fe(w,c,b.stroke),strokeWidth:.5}),j},label:function(M,w,b={}){return We(M,w,b)}};this._drawPath=S,this._renderer=C}de(Ir,Ti),Ir.$inject=["config.bpmnRenderer","eventBus","styles","pathMap","canvas","textRenderer"],Ir.prototype.canRender=function(e){return _(e,"bpmn:BaseElement")},Ir.prototype.drawShape=function(e,t,n={}){var{type:i}=t,r=this._renderer(i);return r(e,t,n)},Ir.prototype.drawConnection=function(e,t,n={}){var{type:i}=t,r=this._renderer(i);return r(e,t,n)},Ir.prototype.getShapePath=function(e){return Fe(e)?Rl(e,cR):_(e,"bpmn:Event")?Cm(e):_(e,"bpmn:Activity")?Rl(e,Bs):_(e,"bpmn:Gateway")?iR(e):rR(e)};function Ke(e,t=[]){return t.reduce((n,i)=>(e[i]&&(n[i]=e[i]),n),{})}var pR=0,fR={width:150,height:50};function dR(e){var t=e.split("-");return{horizontal:t[0]||"center",vertical:t[1]||"top"}}function hR(e){return Vt(e)?H({top:0,left:0,right:0,bottom:0},e):{top:e,left:e,right:e,bottom:e}}var Cl=null;function mR(){return Cl||(Cl=document.createElement("canvas").getContext("2d")),Cl}function gR(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(Pm(e.fontSize)||"12px"),t.push(e.fontFamily||"sans-serif"),t.join(" ")}function Pm(e){if(e!=null)return typeof e=="number"||/^-?\d+(\.\d+)?$/.test(e)?e+"px":e}function yR(e,t){var n=mR();if(!n)return{width:0,height:0};n.font=gR(t),"letterSpacing"in n&&(n.letterSpacing=Pm(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 vR(e,t,n){for(var i=e.shift(),r=i,o;;){if(o=yR(r,n),o.width=r?o.width:0,r===" "||r===""||o.width<Math.round(t)||r.length<2)return bR(e,r,i,o);r=xR(r,o.width,t)}}function bR(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 Am="­";function _R(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===Am)&&r.pop();break}var a=r[r.length-1];return a&&a===Am&&(r[r.length-1]="-"),r.join("")}function xR(e,t,n){var i=Math.max(e.length*(n/t),1),r=_R(e,i);return r||(r=e.slice(0,Math.max(Math.round(i-1),1))),r}function $s(e){this._config=H({},{size:fR,padding:pR,style:{},align:"center-top"},e||{})}$s.prototype.createText=function(e,t){return this.layoutText(e,t).element},$s.prototype.getDimensions=function(e,t){return this.layoutText(e,t).dimensions},$s.prototype.layoutText=function(e,t){for(var n=H({},this._config.size,t.box),i=H({},this._config.style,t.style),r=dR(t.align||this._config.align),o=hR(t.padding!==void 0?t.padding:this._config.padding),a=t.fitBox||!1,s=wR(i),c=e.split(/\u00AD?\r?\n/),u=[],l=n.width-o.left-o.right;c.length;)u.push(vR(c,l,i));r.vertical==="middle"&&(o.top=o.bottom=0);var p=En(u,function(m,E,y){return m+(s||E.height)},0)+o.top+o.bottom,f=En(u,function(m,E,y){return E.width>m?E.width:m},0),d=o.top;r.vertical==="middle"&&(d+=(n.height-p)/2),d-=(s||u[0].height)/4;var g=Ce("text");he(g,i),L(u,function(m){var E;switch(d+=s||m.height,r.horizontal){case"left":E=o.left;break;case"right":E=(a?f:l)-o.right-m.width;break;default:E=Math.max(((a?f:l)-m.width)/2+o.left,0)}var y=Ce("tspan");he(y,{x:E,y:d}),y.textContent=m.text,Be(g,y)});var h={width:f,height:p};return{dimensions:h,element:g}};function wR(e){if("fontSize"in e&&"lineHeight"in e)return e.lineHeight*parseInt(e.fontSize,10)}var ER=12,SR=1.2,RR=40;function Tm(e){var t=H({fontFamily:"Arial, sans-serif",fontSize:ER,fontWeight:"normal",lineHeight:SR},e&&e.defaultStyle||{}),n=parseInt(t.fontSize,10)-1,i=H({},t,{fontSize:n},e&&e.externalStyle||{}),r=new $s({style:t});this.getExternalLabelBounds=function(a,s){var c={width:Math.max(a.width,Lr.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:mo});return{x:a.x,y:a.y,width:a.width,height:Math.max(RR,Math.round(c.height))}},this.getDimensions=function(a,s){return r.getDimensions(a,s||{})};function o(a,s,c){return r.getDimensions(a,H({box:s},c))}this.createText=function(a,s){return r.createText(a,s||{})},this.getDefaultStyle=function(){return t},this.getExternalStyle=function(){return i}}Tm.$inject=["config.textRenderer"];function CR(){this.pathMap={EVENT_MESSAGE:{d:"m {mx},{my} l 0,{e.y1} l {e.x1},0 l 0,-{e.y1} z l {e.x0},{e.y0} l {e.x0},-{e.y0}",height:36,width:36,heightElements:[6,14],widthElements:[10.5,21]},EVENT_SIGNAL:{d:"M {mx},{my} l {e.x0},{e.y0} l -{e.x1},0 Z",height:36,width:36,heightElements:[18],widthElements:[10,20]},EVENT_ESCALATION:{d:"M {mx},{my} l {e.x0},{e.y0} l -{e.x0},-{e.y1} l -{e.x0},{e.y1} Z",height:36,width:36,heightElements:[20,7],widthElements:[8]},EVENT_CONDITIONAL:{d:"M {e.x0},{e.y0} l {e.x1},0 l 0,{e.y2} l -{e.x1},0 Z M {e.x2},{e.y3} l {e.x0},0 M {e.x2},{e.y4} l {e.x0},0 M {e.x2},{e.y5} l {e.x0},0 M {e.x2},{e.y6} l {e.x0},0 M {e.x2},{e.y7} l {e.x0},0 M {e.x2},{e.y8} l {e.x0},0 ",height:36,width:36,heightElements:[8.5,14.5,18,11.5,14.5,17.5,20.5,23.5,26.5],widthElements:[10.5,14.5,12.5]},EVENT_LINK:{d:"m {mx},{my} 0,{e.y0} -{e.x1},0 0,{e.y1} {e.x1},0 0,{e.y0} {e.x0},-{e.y2} -{e.x0},-{e.y2} z",height:36,width:36,heightElements:[4.4375,6.75,7.8125],widthElements:[9.84375,13.5]},EVENT_ERROR:{d:"m {mx},{my} {e.x0},-{e.y0} {e.x1},-{e.y1} {e.x2},{e.y2} {e.x3},-{e.y3} -{e.x4},{e.y4} -{e.x5},-{e.y5} z",height:36,width:36,heightElements:[.023,8.737,8.151,16.564,10.591,8.714],widthElements:[.085,6.672,6.97,4.273,5.337,6.636]},EVENT_CANCEL_45:{d:"m {mx},{my} -{e.x1},0 0,{e.x0} {e.x1},0 0,{e.y1} {e.x0},0 0,-{e.y1} {e.x1},0 0,-{e.y0} -{e.x1},0 0,-{e.y1} -{e.x0},0 z",height:36,width:36,heightElements:[4.75,8.5],widthElements:[4.75,8.5]},EVENT_COMPENSATION:{d:"m {mx},{my} {e.x0},-{e.y0} 0,{e.y1} z m {e.x1},-{e.y2} {e.x2},-{e.y3} 0,{e.y1} -{e.x2},-{e.y3} z",height:36,width:36,heightElements:[6.5,13,.4,6.1],widthElements:[9,9.3,8.7]},EVENT_TIMER_WH:{d:"M {mx},{my} l {e.x0},-{e.y0} m -{e.x0},{e.y0} l {e.x1},{e.y1} ",height:36,width:36,heightElements:[10,2],widthElements:[3,7]},EVENT_TIMER_LINE:{d:"M {mx},{my} m {e.x0},{e.y0} l -{e.x1},{e.y1} ",height:36,width:36,heightElements:[10,3],widthElements:[0,0]},EVENT_MULTIPLE:{d:"m {mx},{my} {e.x1},-{e.y0} {e.x1},{e.y0} -{e.x0},{e.y1} -{e.x2},0 z",height:36,width:36,heightElements:[6.28099,12.56199],widthElements:[3.1405,9.42149,12.56198]},EVENT_PARALLEL_MULTIPLE:{d:"m {mx},{my} {e.x0},0 0,{e.y1} {e.x1},0 0,{e.y0} -{e.x1},0 0,{e.y1} -{e.x0},0 0,-{e.y1} -{e.x1},0 0,-{e.y0} {e.x1},0 z",height:36,width:36,heightElements:[2.56228,7.68683],widthElements:[2.56228,7.68683]},GATEWAY_EXCLUSIVE:{d:"m {mx},{my} {e.x0},{e.y0} {e.x1},{e.y0} {e.x2},0 {e.x4},{e.y2} {e.x4},{e.y1} {e.x2},0 {e.x1},{e.y3} {e.x0},{e.y3} {e.x3},0 {e.x5},{e.y1} {e.x5},{e.y2} {e.x3},0 z",height:17.5,width:17.5,heightElements:[8.5,6.5312,-6.5312,-8.5],widthElements:[6.5,-6.5,3,-3,5,-5]},GATEWAY_PARALLEL:{d:"m {mx},{my} 0,{e.y1} -{e.x1},0 0,{e.y0} {e.x1},0 0,{e.y1} {e.x0},0 0,-{e.y1} {e.x1},0 0,-{e.y0} -{e.x1},0 0,-{e.y1} -{e.x0},0 z",height:30,width:30,heightElements:[5,12.5],widthElements:[5,12.5]},GATEWAY_EVENT_BASED:{d:"m {mx},{my} {e.x0},{e.y0} {e.x0},{e.y1} {e.x1},{e.y2} {e.x2},0 z",height:11,width:11,heightElements:[-6,6,12,-12],widthElements:[9,-3,-12]},GATEWAY_COMPLEX:{d:"m {mx},{my} 0,{e.y0} -{e.x0},-{e.y1} -{e.x1},{e.y2} {e.x0},{e.y1} -{e.x2},0 0,{e.y3} {e.x2},0 -{e.x0},{e.y1} l {e.x1},{e.y2} {e.x0},-{e.y1} 0,{e.y0} {e.x3},0 0,-{e.y0} {e.x0},{e.y1} {e.x1},-{e.y2} -{e.x0},-{e.y1} {e.x2},0 0,-{e.y3} -{e.x2},0 {e.x0},-{e.y1} -{e.x1},-{e.y2} -{e.x0},{e.y1} 0,-{e.y0} -{e.x3},0 z",height:17.125,width:17.125,heightElements:[4.875,3.4375,2.125,3],widthElements:[3.4375,2.125,4.875,3]},DATA_OBJECT_PATH:{d:"m 0,0 {e.x1},0 {e.x0},{e.y0} 0,{e.y1} -{e.x2},0 0,-{e.y2} {e.x1},0 0,{e.y0} {e.x0},0",height:61,width:51,heightElements:[10,50,60],widthElements:[10,40,50,60]},DATA_OBJECT_COLLECTION_PATH:{d:"m{mx},{my} m 3,2 l 0,10 m 3,-10 l 0,10 m 3,-10 l 0,10",height:10,width:10,heightElements:[],widthElements:[]},DATA_ARROW:{d:"m 5,9 9,0 0,-3 5,5 -5,5 0,-3 -9,0 z",height:61,width:51,heightElements:[],widthElements:[]},DATA_STORE:{d:"m {mx},{my} l 0,{e.y2} c {e.x0},{e.y1} {e.x1},{e.y1} {e.x2},0 l 0,-{e.y2} c -{e.x0},-{e.y1} -{e.x1},-{e.y1} -{e.x2},0c {e.x0},{e.y1} {e.x1},{e.y1} {e.x2},0 m -{e.x2},{e.y0}c {e.x0},{e.y1} {e.x1},{e.y1} {e.x2},0m -{e.x2},{e.y0}c {e.x0},{e.y1} {e.x1},{e.y1} {e.x2},0",height:61,width:61,heightElements:[7,10,45],widthElements:[2,58,60]},TEXT_ANNOTATION:{d:"m {mx}, {my} m 10,0 l -10,0 l 0,{e.y0} l 10,0",height:30,width:10,heightElements:[30],widthElements:[10]},MARKER_SUB_PROCESS:{d:"m{mx},{my} m 7,2 l 0,10 m -5,-5 l 10,0",height:10,width:10,heightElements:[],widthElements:[]},MARKER_PARALLEL:{d:"m{mx},{my} m 3,2 l 0,10 m 3,-10 l 0,10 m 3,-10 l 0,10",height:10,width:10,heightElements:[],widthElements:[]},MARKER_SEQUENTIAL:{d:"m{mx},{my} m 0,3 l 10,0 m -10,3 l 10,0 m -10,3 l 10,0",height:10,width:10,heightElements:[],widthElements:[]},MARKER_COMPENSATION:{d:"m {mx},{my} 7,-5 0,10 z m 7.1,-0.3 6.9,-4.7 0,10 -6.9,-4.7 z",height:10,width:21,heightElements:[],widthElements:[]},MARKER_LOOP:{d:"m {mx},{my} c 3.526979,0 6.386161,-2.829858 6.386161,-6.320661 0,-3.490806 -2.859182,-6.320661 -6.386161,-6.320661 -3.526978,0 -6.38616,2.829855 -6.38616,6.320661 0,1.745402 0.714797,3.325567 1.870463,4.469381 0.577834,0.571908 1.265885,1.034728 2.029916,1.35457 l -0.718163,-3.909793 m 0.718163,3.909793 -3.885211,0.802902",height:13.9,width:13.7,heightElements:[],widthElements:[]},MARKER_ADHOC:{d:"m {mx},{my} m 0.84461,2.64411 c 1.05533,-1.23780996 2.64337,-2.07882 4.29653,-1.97997996 2.05163,0.0805 3.85579,1.15803 5.76082,1.79107 1.06385,0.34139996 2.24454,0.1438 3.18759,-0.43767 0.61743,-0.33642 1.2775,-0.64078 1.7542,-1.17511 0,0.56023 0,1.12046 0,1.6807 -0.98706,0.96237996 -2.29792,1.62393996 -3.6918,1.66181996 -1.24459,0.0927 -2.46671,-0.2491 -3.59505,-0.74812 -1.35789,-0.55965 -2.75133,-1.33436996 -4.27027,-1.18121996 -1.37741,0.14601 -2.41842,1.13685996 -3.44288,1.96782996 z",height:4,width:15,heightElements:[],widthElements:[]},TASK_TYPE_SEND:{d:"m {mx},{my} l 0,{e.y1} l {e.x1},0 l 0,-{e.y1} z l {e.x0},{e.y0} l {e.x0},-{e.y0}",height:14,width:21,heightElements:[6,14],widthElements:[10.5,21]},TASK_TYPE_SCRIPT:{d:"m {mx},{my} c 9.966553,-6.27276 -8.000926,-7.91932 2.968968,-14.938 l -8.802728,0 c -10.969894,7.01868 6.997585,8.66524 -2.968967,14.938 z m -7,-12 l 5,0 m -4.5,3 l 4.5,0 m -3,3 l 5,0m -4,3 l 5,0",height:15,width:12.6,heightElements:[6,14],widthElements:[10.5,21]},TASK_TYPE_USER_1:{d:"m {mx},{my} c 0.909,-0.845 1.594,-2.049 1.594,-3.385 0,-2.554 -1.805,-4.62199999 -4.357,-4.62199999 -2.55199998,0 -4.28799998,2.06799999 -4.28799998,4.62199999 0,1.348 0.974,2.562 1.89599998,3.405 -0.52899998,0.187 -5.669,2.097 -5.794,4.7560005 v 6.718 h 17 v -6.718 c 0,-2.2980005 -5.5279996,-4.5950005 -6.0509996,-4.7760005 zm -8,6 l 0,5.5 m 11,0 l 0,-5"},TASK_TYPE_USER_2:{d:"m {mx},{my} m 2.162,1.009 c 0,2.4470005 -2.158,4.4310005 -4.821,4.4310005 -2.66499998,0 -4.822,-1.981 -4.822,-4.4310005 "},TASK_TYPE_USER_3:{d:"m {mx},{my} m -6.9,-3.80 c 0,0 2.25099998,-2.358 4.27399998,-1.177 2.024,1.181 4.221,1.537 4.124,0.965 -0.098,-0.57 -0.117,-3.79099999 -4.191,-4.13599999 -3.57499998,0.001 -4.20799998,3.36699999 -4.20699998,4.34799999 z"},TASK_TYPE_MANUAL:{d:"m {mx},{my} c 0.234,-0.01 5.604,0.008 8.029,0.004 0.808,0 1.271,-0.172 1.417,-0.752 0.227,-0.898 -0.334,-1.314 -1.338,-1.316 -2.467,-0.01 -7.886,-0.004 -8.108,-0.004 -0.014,-0.079 0.016,-0.533 0,-0.61 0.195,-0.042 8.507,0.006 9.616,0.002 0.877,-0.007 1.35,-0.438 1.353,-1.208 0.003,-0.768 -0.479,-1.09 -1.35,-1.091 -2.968,-0.002 -9.619,-0.013 -9.619,-0.013 v -0.591 c 0,0 5.052,-0.016 7.225,-0.016 0.888,-0.002 1.354,-0.416 1.351,-1.193 -0.006,-0.761 -0.492,-1.196 -1.361,-1.196 -3.473,-0.005 -10.86,-0.003 -11.0829995,-0.003 -0.022,-0.047 -0.045,-0.094 -0.069,-0.139 0.3939995,-0.319 2.0409995,-1.626 2.4149995,-2.017 0.469,-0.4870005 0.519,-1.1650005 0.162,-1.6040005 -0.414,-0.511 -0.973,-0.5 -1.48,-0.236 -1.4609995,0.764 -6.5999995,3.6430005 -7.7329995,4.2710005 -0.9,0.499 -1.516,1.253 -1.882,2.19 -0.37000002,0.95 -0.17,2.01 -0.166,2.979 0.004,0.718 -0.27300002,1.345 -0.055,2.063 0.629,2.087 2.425,3.312 4.859,3.318 4.6179995,0.014 9.2379995,-0.139 13.8569995,-0.158 0.755,-0.004 1.171,-0.301 1.182,-1.033 0.012,-0.754 -0.423,-0.969 -1.183,-0.973 -1.778,-0.01 -5.824,-0.004 -6.04,-0.004 10e-4,-0.084 0.003,-0.586 10e-4,-0.67 z"},TASK_TYPE_INSTANTIATING_SEND:{d:"m {mx},{my} l 0,8.4 l 12.6,0 l 0,-8.4 z l 6.3,3.6 l 6.3,-3.6"},TASK_TYPE_SERVICE:{d:"m {mx},{my} v -1.71335 c 0.352326,-0.0705 0.703932,-0.17838 1.047628,-0.32133 0.344416,-0.14465 0.665822,-0.32133 0.966377,-0.52145 l 1.19431,1.18005 1.567487,-1.57688 -1.195028,-1.18014 c 0.403376,-0.61394 0.683079,-1.29908 0.825447,-2.01824 l 1.622133,-0.01 v -2.2196 l -1.636514,0.01 c -0.07333,-0.35153 -0.178319,-0.70024 -0.323564,-1.04372 -0.145244,-0.34406 -0.321407,-0.6644 -0.522735,-0.96217 l 1.131035,-1.13631 -1.583305,-1.56293 -1.129598,1.13589 c -0.614052,-0.40108 -1.302883,-0.68093 -2.022633,-0.82247 l 0.0093,-1.61852 h -2.241173 l 0.0042,1.63124 c -0.353763,0.0736 -0.705369,0.17977 -1.049785,0.32371 -0.344415,0.14437 -0.665102,0.32092 -0.9635006,0.52046 l -1.1698628,-1.15823 -1.5667691,1.5792 1.1684265,1.15669 c -0.4026573,0.61283 -0.68308,1.29797 -0.8247287,2.01713 l -1.6588041,0.003 v 2.22174 l 1.6724648,-0.006 c 0.073327,0.35077 0.1797598,0.70243 0.3242851,1.04472 0.1452428,0.34448 0.3214064,0.6644 0.5227339,0.96066 l -1.1993431,1.19723 1.5840256,1.56011 1.1964668,-1.19348 c 0.6140517,0.40346 1.3028827,0.68232 2.0233517,0.82331 l 7.19e-4,1.69892 h 2.226848 z m 0.221462,-3.9957 c -1.788948,0.7502 -3.8576,-0.0928 -4.6097055,-1.87438 -0.7521065,-1.78321 0.090598,-3.84627 1.8802645,-4.59604 1.78823,-0.74936 3.856881,0.0929 4.608987,1.87437 0.752106,1.78165 -0.0906,3.84612 -1.879546,4.59605 z"},TASK_TYPE_SERVICE_FILL:{d:"m {mx},{my} c -1.788948,0.7502 -3.8576,-0.0928 -4.6097055,-1.87438 -0.7521065,-1.78321 0.090598,-3.84627 1.8802645,-4.59604 1.78823,-0.74936 3.856881,0.0929 4.608987,1.87437 0.752106,1.78165 -0.0906,3.84612 -1.879546,4.59605 z"},TASK_TYPE_BUSINESS_RULE_HEADER:{d:"m {mx},{my} 0,4 20,0 0,-4 z"},TASK_TYPE_BUSINESS_RULE_MAIN:{d:"m {mx},{my} 0,12 20,0 0,-12 zm 0,8 l 20,0 m -13,-4 l 0,8"},MESSAGE_FLOW_MARKER:{d:"m {mx},{my} m -10.5 ,-7 l 0,14 l 21,0 l 0,-14 z l 10.5,6 l 10.5,-6"}},this.getRawPath=function(t){return this.pathMap[t].d},this.getScaledPath=function(t,n){var i=this.pathMap[t],r,o;n.abspos?(r=n.abspos.x,o=n.abspos.y):(r=n.containerWidth*n.position.mx,o=n.containerHeight*n.position.my);var a={};if(n.position){for(var s=n.containerHeight/i.height*n.yScaleFactor,c=n.containerWidth/i.width*n.xScaleFactor,u=0;u<i.heightElements.length;u++)a["y"+u]=i.heightElements[u]*s;for(var l=0;l<i.widthElements.length;l++)a["x"+l]=i.widthElements[l]*c}var p=MR(i.d,{mx:r,my:o,e:a});return p}}var PR=/\{([^{}]+)\}/g,AR=/(?:(?:^|\.)(.+?)(?=\[|\.|$|\()|\[('|")(.+?)\2\])(\(\))?/g;function TR(e,t,n){var i=n;return t.replace(AR,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 MR(e,t){return String(e).replace(PR,function(n,i){return TR(n,i,t)})}const kR={__init__:["bpmnRenderer"],bpmnRenderer:["type",Ir],textRenderer:["type",Tm],pathMap:["type",CR]};function OR(e,t){return t=t||{},e.replace(/{([^}]+)}/g,function(n,i){return t[i]||"{"+i+"}"})}const sa={translate:["value",OR]};function js(e,t,n){return H({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?[Oe(t),Oe(n)]:i.map(function(r){return{x:r.x,y:r.y}})}function Mm(e,t,n){return new Error(`element ${cn(t)} referenced by ${cn(e)}#${n} not yet drawn`)}function Di(e,t,n,i,r){this._eventBus=e,this._canvas=t,this._elementFactory=n,this._elementRegistry=i,this._textRenderer=r}Di.$inject=["eventBus","canvas","elementFactory","elementRegistry","textRenderer"],Di.prototype.add=function(e,t,n){var i,r,o;if(_(t,"bpmndi:BPMNPlane")){var a=_(e,"bpmn:SubProcess")?{id:e.id+"_plane"}:{};i=this._elementFactory.createRoot(js(e,t,a)),this._canvas.addRootElement(i)}else if(_(t,"bpmndi:BPMNShape")){var s=!Ue(e,t),c=IR(e);r=n&&(n.hidden||n.collapsed);var u=t.bounds;i=this._elementFactory.createShape(js(e,t,{collapsed:s,hidden:r,x:Math.round(u.x),y:Math.round(u.y),width:Math.round(u.width),height:Math.round(u.height),isFrame:c})),_(e,"bpmn:BoundaryEvent")&&this._attachBoundary(e,i),_(e,"bpmn:Lane")&&(o=0),_(e,"bpmn:DataStoreReference")&&(LR(n,Oe(u))||(n=this._canvas.findRoot(n))),this._canvas.addShape(i,n,o)}else if(_(t,"bpmndi:BPMNEdge")){var l=this._getSource(e),p=this._getTarget(e);r=n&&(n.hidden||n.collapsed),i=this._elementFactory.createConnection(js(e,t,{hidden:r,source:l,target:p,waypoints:DR(t,l,p)})),_(e,"bpmn:DataAssociation")&&(n=this._canvas.findRoot(n)),this._canvas.addConnection(i,n,o)}else throw new Error(`unknown di ${cn(t)} for element ${cn(e)}`);return ir(e)&&Bn(i)&&this.addLabel(e,t,i),this._eventBus.fire("bpmnElement.added",{element:i}),i},Di.prototype._attachBoundary=function(e,t){var n=e.attachedToRef;if(!n)throw new Error(`missing ${cn(e)}#attachedToRef`);var i=this._elementRegistry.get(n.id),r=i&&i.attachers;if(!i)throw Mm(e,n,"attachedToRef");t.host=i,r||(i.attachers=r=[]),r.indexOf(t)===-1&&r.push(t)},Di.prototype.addLabel=function(e,t,n){var i,r,o;return i=XS(t,n),r=Bn(n),r&&(i=this._textRenderer.getExternalLabelBounds(i,r)),o=this._elementFactory.createLabel(js(e,t,{id:e.id+"_label",labelTarget:n,type:"label",hidden:n.hidden||!Bn(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)},Di.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?Mm(e,i,t+"Ref"):new Error(`${cn(e)}#${t} Ref not specified`)},Di.prototype._getSource=function(e){return this._getConnectedElement(e,"source")},Di.prototype._getTarget=function(e){return this._getConnectedElement(e,"target")},Di.prototype._getElement=function(e){return this._elementRegistry.get(e.id)};function LR(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 IR(e){return _(e,"bpmn:Group")}const km={__depends__:[kR,{__depends__:[sa],bpmnImporter:["type",Di]}]};function ca(e){return{x:e.x+e.width/2,y:e.y+e.height/2}}function Jn(e,t){return{x:e.x-t.x,y:e.y-t.y}}function Pl(e){return Math.log(e)/Math.log(10)}var NR=1e3;function J(e){this._eventBus=e}J.$inject=["eventBus"];function BR(e,t){return function(n){return e.call(t||null,n.context,n.command,n)}}J.prototype.on=function(e,t,n,i,r,o){if((Wt(t)||Le(t))&&(o=r,r=i,i=n,n=t,t=null),Wt(n)&&(o=r,r=i,i=n,n=NR),Vt(r)&&(o=r,r=!1),!Wt(i))throw new Error("handlerFn must be a function");ke(e)||(e=[e]);var a=this._eventBus;L(e,function(s){var c=["commandStack",s,t].filter(function(u){return u}).join(".");a.on(c,n,r?BR(i,o):i,o)})},J.prototype.canExecute=Li("canExecute"),J.prototype.preExecute=Li("preExecute"),J.prototype.preExecuted=Li("preExecuted"),J.prototype.execute=Li("execute"),J.prototype.executed=Li("executed"),J.prototype.postExecute=Li("postExecute"),J.prototype.postExecuted=Li("postExecuted"),J.prototype.revert=Li("revert"),J.prototype.reverted=Li("reverted");function Li(e){return function(n,i,r,o,a){(Wt(n)||Le(n))&&(a=o,o=r,r=i,i=n,n=null),this.on(n,e,i,r,o,a)}}var Al=["top","bottom","left","right"],Fs=10;function Tl(e,t){J.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(Is(r)&&!st(r)){var o=FR(r);o&&i(r,o)}}function i(r,o){var a=Oe(r),s=r.label,c=Oe(s);if(s.parent){var u=Pe(r),l;switch(o){case"top":l={x:a.x,y:u.top-Fs-s.height/2};break;case"left":l={x:u.left-Fs-s.width/2,y:a.y};break;case"bottom":l={x:a.x,y:u.bottom+Fs+s.height/2};break;case"right":l={x:u.right+Fs+s.width/2,y:a.y};break}var p=Jn(l,c);t.moveShape(s,p)}}}de(Tl,J),Tl.$inject=["eventBus","modeling"];function $R(e){var t=e.host,n=Oe(e),i=Jt(n,t),r;i.indexOf("-")>=0?r=i.split("-"):r=[i];var o=Al.filter(function(a){return r.indexOf(a)===-1});return o}function jR(e){var t=Oe(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 Om(t,i)});return n}function FR(e){var t=Oe(e.label),n=Oe(e),i=Om(n,t);if(HR(i)){var r=jR(e);if(e.host){var o=$R(e);r=r.concat(o)}var a=Al.filter(function(s){return r.indexOf(s)===-1});return a.indexOf(i)!==-1?Jt(e.label,e)!=="intersect"?void 0:i:a[0]}}function Om(e,t){return Jt(t,e,5)}function HR(e){return Al.indexOf(e)!==-1}function Ml(e){J.call(this,e),this.preExecute("shape.append",function(t){var n=t.source,i=t.shape;t.position||(_(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)}de(Ml,J),Ml.$inject=["eventBus"];var zR=1500;function kl(e,t,n){e.invoke(J,this),this.preExecute("elements.delete",zR,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=Ge(r,u=>_(u,"bpmn:Participant")||_(u,"bpmn:SubProcess"));if(!o.length)return[];var a=n.getRootElement(),s=new Set(a.children.filter(u=>_(u,"bpmn:Artifact"))),c=new Set;return L(o,u=>{const l=new Set(Jr(uo(Array.from(s),Tt(u))));c=c.union(l),s=s.difference(l)}),Array.from(c)}}de(kl,J),kl.$inject=["injector","eventBus","canvas"];function Ol(e,t){e.invoke(J,this),this.postExecute("shape.move",function(n){var i=n.newParent,r=n.shape,o=Ge(r.incoming.concat(r.outgoing),function(a){return _(a,"bpmn:Association")});L(o,function(a){t.moveConnection(a,{x:0,y:0},i)})},!0)}de(Ol,J),Ol.$inject=["injector","modeling"];function yo(e,t){for(xn(t)&&(t=[t]);e=e.parent;)if(ze(e,t))return e;return null}function Dm(e,t){var n=yo(e,"bpmn:Process");if(n)return!0;var i=["bpmn:Participant","bpmn:Lane"];if(n=yo(e,i),n)return qt(n);if(ze(e,i))return qt(e);var r;for(r=te(e);r&&!_(r,"bpmn:Process");r=r.$parent);if(!t)return!0;var o=t.find(function(a){var s=te(a);return s&&s.get("processRef")===r});return o?qt(o):!0}var Lm=500;function Hs(e,t){t.invoke(J,this),this._bpmnReplace=e;var n=this;this.postExecuted("elements.create",Lm,function(i){var r=i.elements;r=r.filter(function(o){var a=o.host;return Im(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",Lm,function(i){var r=i.shapes,o=i.newHost;if(r.length===1){var a=r[0];Im(a,o)&&(i.shapes=[n._replaceShape(a,o)])}},!0)}Hs.$inject=["bpmnReplace","injector"],de(Hs,J),Hs.prototype._replaceShape=function(e,t){var n=GR(e),i={type:"bpmn:BoundaryEvent",host:t};return n&&(i.eventDefinitionType=n.$type),this._bpmnReplace.replaceElement(e,i,{layoutConnection:!1})};function GR(e){var t=te(e),n=t.eventDefinitions;return n&&n[0]}function Im(e,t){return!Fe(e)&&ze(e,["bpmn:IntermediateThrowEvent","bpmn:IntermediateCatchEvent"])&&!!t}function Dl(e,t){J.call(this,e);function n(i){return Ge(i.attachers,function(r){return _(r,"bpmn:BoundaryEvent")})}this.postExecute("connection.create",function(i){var r=i.context.source,o=i.context.target,a=n(o);_(r,"bpmn:EventBasedGateway")&&_(o,"bpmn:ReceiveTask")&&a.length>0&&t.removeElements(a)}),this.postExecute("connection.reconnect",function(i){var r=i.context.oldSource,o=i.context.newSource;_(r,"bpmn:Gateway")&&_(o,"bpmn:EventBasedGateway")&&L(o.outgoing,function(a){var s=a.target,c=n(s);_(s,"bpmn:ReceiveTask")&&c.length>0&&t.removeElements(c)})})}Dl.$inject=["eventBus","modeling"],de(Dl,J);function Nm(e){return e.create("bpmn:Category")}function VR(e){return e.create("bpmn:CategoryValue")}function Bm(e,t){var n=t.get("categoryValueRef");return n||(n=t.categoryValueRef=VR(e)),n.$parent||(n.$parent=Nm(e)),n}function WR(e,t,n){return Pt(t.get("categoryValue"),e),e.$parent=t,Pt(n.get("rootElements"),t),t.$parent=n,e}function UR(e){var t=e.$parent;return t&&(Rt(t.get("categoryValue"),e),e.$parent=null),e}function qR(e){var t=e.$parent;return t&&(Rt(t.get("rootElements"),e),e.$parent=null),e}var YR=500;function Ll(e,t,n){n.invoke(J,this);function i(c){return t.filter(function(u){return _(u,"bpmn:Group")&&!u.labelTarget}).map(te).filter(function(u){return u!==c})}function r(c,u){return i(u).some(function(l){return l.get("categoryValueRef")===c})}function o(c,u){return i(u).some(function(l){var p=l.get("categoryValueRef");return p&&p.$parent===c})}function a(c,u){c&&u&&WR(c,u,e.getDefinitions())}function s(c,u,l){u&&!o(u,l)&&qR(u),c&&!r(c,l)&&UR(c)}this.executed(["shape.create","label.create"],function(c){var u=c.labelTarget||c.shape;!_(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;!_(u,"bpmn:Group")||u.labelTarget||s(c.categoryValue,c.category,te(u))},!0),this.executed(["shape.move","shape.resize"],YR,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,te(u))},!0),this.executed("group.updateRefs",function(c){$m(c).forEach(function(u){a(u.categoryValue,u.category)})},!0),this.reverted("group.updateRefs",function(c){$m(c).forEach(function(u){s(u.categoryValue,u.category,te(u.groupShape))})},!0),this.executed("shape.delete",function(c){var u=c.shape;!_(u,"bpmn:Group")||u.labelTarget||s(c.categoryValue,c.category,te(u))},!0),this.reverted("shape.delete",function(c){var u=c.shape;!_(u,"bpmn:Group")||u.labelTarget||a(c.categoryValue,c.category)},!0)}Ll.$inject=["bpmnjs","elementRegistry","injector"],de(Ll,J);function $m(e){var t;return((t=e.updates)==null?void 0:t.groups)||[]}function Il(e,t,n){J.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(m){const E=m.source,y=m.target;vo(E)&&ua(y)&&l(y)}function r(m){const E=m.connection,y=m.source,x=m.target;vo(y)&&zs(x)&&(u(x),f(y,[E]))}function o(m){const E=m.newTarget,y=m.oldSource,x=m.oldTarget;if(x!==E){const S=y;ua(x)&&l(x),vo(S)&&zs(E)&&u(E)}}function a(m){const{element:E}=m;ua(E)?(p(E),d(E)):zs(E)&&g(E)}function s(m){const{newData:E,oldShape:y}=m;if(vo(m.oldShape)&&E.eventDefinitionType!=="bpmn:CompensateEventDefinition"||E.type!=="bpmn:BoundaryEvent"){const x=y.outgoing.find(({target:S})=>ua(S));x&&x.target&&(m._connectionTarget=x.target)}else if(!vo(m.oldShape)&&E.eventDefinitionType==="bpmn:CompensateEventDefinition"&&E.type==="bpmn:BoundaryEvent"){const x=y.outgoing.find(({target:S})=>zs(S));x&&x.target&&(m._connectionTarget=x.target),h(y)}}function c(m){const{_connectionTarget:E,newShape:y}=m;E&&t.connect(y,E)}function u(m){t.updateProperties(m,{isForCompensation:!0})}function l(m){t.updateProperties(m,{isForCompensation:void 0})}function p(m){for(const E of m.incoming)n.canConnect(E.source,m)||t.removeConnection(E);for(const E of m.outgoing)n.canConnect(m,E.target)||t.removeConnection(E)}function f(m,E){m.outgoing.filter(S=>_(S,"bpmn:Association")).filter(S=>ua(S.target)&&!E.includes(S)).forEach(S=>t.removeConnection(S))}function d(m){const E=m.attachers.slice();E.length&&t.removeElements(E)}function g(m){const E=m.incoming.filter(y=>vo(y.source));t.removeElements(E)}function h(m){const E=m.outgoing.filter(y=>_(y,"bpmn:SequenceFlow"));t.removeElements(E)}}de(Il,J),Il.$inject=["eventBus","modeling","bpmnRules"];function ua(e){const t=te(e);return t&&t.get("isForCompensation")}function vo(e){return e&&_(e,"bpmn:BoundaryEvent")&&ho(e,"bpmn:CompensateEventDefinition")}function zs(e){return e&&_(e,"bpmn:Activity")&&!un(e)}function Nl(e){e.invoke(J,this),this.preExecute("shape.create",1500,function(t){var n=t.context,i=n.parent,r=n.shape;_(i,"bpmn:Lane")&&!_(r,"bpmn:Lane")&&(n.parent=yo(i,"bpmn:Participant"))})}Nl.$inject=["injector"],de(Nl,J);function Bl(e,t){J.call(this,e),this.preExecute("shape.create",function(n){var a;var i=n.context,r=i.shape;if(_(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}})}Bl.$inject=["eventBus","bpmnFactory"],de(Bl,J);var $l=20,jl=20,jm=30,Gs=2e3;function Fl(e,t,n){J.call(this,t),t.on(["create.start","shape.move.start"],Gs,function(r){var o=r.context,a=o.shape,s=e.getRootElement();if(!(!_(a,"bpmn:Participant")||!_(s,"bpmn:Process")||!s.children.length)){var c=s.children.filter(function(p){return!_(p,"bpmn:Group")&&!Fe(p)&&!st(p)});if(c.length){var u=Tt(c),l=KR(a,u);H(a,l),o.createConstraints=XR(a,u)}}}),t.on("create.start",Gs,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}_(a,"bpmn:Participant")&&_(s,"bpmn:Process")&&(t.on("element.hover",Gs,u),t.once("create.cleanup",function(){t.off("element.hover",u)}))});function i(){var r=e.getRootElement();return _(r,"bpmn:Collaboration")?r:n.makeCollaboration()}this.preExecute("elements.create",Gs,function(r){var o=r.elements,a=r.parent,s=ZR(o),c;s&&_(a,"bpmn:Process")&&(r.parent=i(),c=r.hints=r.hints||{},c.participant=s,c.process=a,c.processRef=te(s).get("processRef"))},!0),this.preExecute("shape.create",function(r){var o=r.parent,a=r.shape;_(a,"bpmn:Participant")&&_(o,"bpmn:Process")&&(r.parent=i(),r.process=o,r.processRef=te(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)&&te(s).set("processRef",te(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)&&te(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)}Fl.$inject=["canvas","eventBus","modeling"],de(Fl,J);function KR(e,t){t={width:t.width+$l*2+jm,height:t.height+jl*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 XR(e,t){return t=Pe(t),{bottom:t.top+e.height/2-jl,left:t.right-e.width/2+$l,top:t.bottom-e.height/2+jl,right:t.left+e.width/2-$l-jm}}function ZR(e){return lt(e,function(t){return _(t,"bpmn:Participant")})}var Fm="__targetRef_placeholder";function Hl(e,t){J.call(this,e),this.executed(["connection.create","connection.delete","connection.move","connection.reconnect"],Hm(o)),this.reverted(["connection.create","connection.delete","connection.move","connection.reconnect"],Hm(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===Fm});return!u&&s&&(u=t.create("bpmn:Property",{name:Fm}),Pt(c,u)),u}function r(a,s){var c=i(a);c&&(n(a,c,s)||Rt(a.get("properties"),c))}function o(a){var s=a.context,c=s.connection,u=c.businessObject,l=c.target,p=l&&l.businessObject,f=s.newTarget,d=f&&f.businessObject,g=s.oldTarget||s.target,h=g&&g.businessObject,m=c.businessObject,E;h&&h!==p&&r(h,u),d&&d!==p&&r(d,u),p?(E=i(p,!0),m.targetRef=E):m.targetRef=null}}Hl.$inject=["eventBus","bpmnFactory"],de(Hl,J);function Hm(e){return function(t){var n=t.context,i=n.connection;if(_(i,"bpmn:DataInputAssociation"))return e(t)}}function Vs(e){this._bpmnUpdater=e}Vs.$inject=["bpmnUpdater"],Vs.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),[]},Vs.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 zl(e,t,n,i){J.call(this,i),t.registerHandler("dataStore.updateContainment",Vs);function r(){return n.filter(function(s){return _(s,"bpmn:Participant")&&te(s).processRef})[0]}function o(s){return s.children.filter(function(c){return _(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;_(u,"bpmn:DataStoreReference")&&u.type!=="label"&&(c.hints||(c.hints={}),c.hints.autoResize=!1)}),this.preExecute("elements.move",function(s){var c=s.context,u=c.shapes,l=u.filter(function(p){return _(p,"bpmn:DataStoreReference")});l.length&&(c.hints||(c.hints={}),c.hints.autoResize=u.filter(function(p){return!_(p,"bpmn:DataStoreReference")}))}),this.postExecute("shape.create",function(s){var c=s.context,u=c.shape,l=u.parent;_(u,"bpmn:DataStoreReference")&&u.type!=="label"&&_(l,"bpmn:Collaboration")&&a(u)}),this.postExecute("shape.move",function(s){var c=s.context,u=c.shape,l=c.oldParent,p=u.parent;if(!_(l,"bpmn:Collaboration")&&_(u,"bpmn:DataStoreReference")&&u.type!=="label"&&_(p,"bpmn:Collaboration")){var f=_(l,"bpmn:Participant")?l:JR(l,"bpmn:Participant");a(u,f)}}),this.postExecute("shape.delete",function(s){var c=s.context,u=c.shape,l=e.getRootElement();ze(u,["bpmn:Participant","bpmn:SubProcess"])&&_(l,"bpmn:Collaboration")&&o(l).filter(function(p){return QR(p,u)}).forEach(function(p){a(p)})}),this.postExecute("canvas.updateRoot",function(s){var c=s.context,u=c.oldRoot,l=c.newRoot,p=o(u);p.forEach(function(f){_(l,"bpmn:Process")&&a(f,l)})})}zl.$inject=["canvas","commandStack","elementRegistry","eventBus"],de(zl,J);function QR(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 JR(e,t){for(;e.parent;){if(_(e.parent,t))return e.parent;e=e.parent}}var Ws=Math.max,Us=Math.min,eC=20;function zm(e,t){return{top:e.top-t.top,right:e.right-t.right,bottom:e.bottom-t.bottom,left:e.left-t.left}}function tC(e,t,n){var i=n.x,r=n.y,o={x:e.x,y:e.y,width:e.width,height:e.height};return t.indexOf("n")!==-1?(o.y=e.y+r,o.height=e.height-r):t.indexOf("s")!==-1&&(o.height=e.height+r),t.indexOf("e")!==-1?o.width=e.width+i:t.indexOf("w")!==-1&&(o.x=e.x+i,o.width=e.width-i),o}function nC(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 qs(e,t,n){var i=t[e],r=n.min&&n.min[e],o=n.max&&n.max[e];return Le(r)&&(i=(/top|left/.test(e)?Us:Ws)(i,r)),Le(o)&&(i=(/top|left/.test(e)?Ws:Us)(i,o)),i}function iC(e,t){if(!t)return e;var n=Pe(e);return Ts({top:qs("top",n,t),right:qs("right",n,t),bottom:qs("bottom",n,t),left:qs("left",n,t)})}function rC(e,t,n,i){var r=Pe(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?Pe(i):o,s={top:Us(o.top,a.top),left:Us(o.left,a.left),bottom:Ws(o.bottom,a.bottom),right:Ws(o.right,a.right)};return Ts(s)}function la(e,t){return typeof e<"u"?e:eC}function oC(e,t){var n,i,r,o;return typeof t=="object"?(n=la(t.left),i=la(t.right),r=la(t.top),o=la(t.bottom)):n=i=r=o=la(t),{x:e.x-n,y:e.y-r,width:e.width+n+i,height:e.height+r+o}}function aC(e){return!(e.waypoints||e.type==="label")}function Gm(e,t){var n;if(e.length===void 0?n=Ge(e.children,aC):n=e,n.length)return oC(Tt(n),t)}var rr=Math.abs;function sC(e,t){return zm(Pe(t),Pe(e))}var cC=["bpmn:Participant","bpmn:Process","bpmn:SubProcess"],Hn=30;function Ys(e,t){return t=t||[],e.children.filter(function(n){_(n,"bpmn:Lane")&&(Ys(n,t),t.push(n))}),t}function or(e){return e.children.filter(function(t){return _(t,"bpmn:Lane")})}function zn(e){return yo(e,cC)||e}function uC(e,t){var n=zn(e),i=_(n,"bpmn:Process")?[]:[n],r=Ys(n,i),o=Pe(e),a=Pe(t),s=sC(e,t),c=[],u=qt(e);return r.forEach(function(l){if(l!==e){var p=u?0:s.top,f=u?s.right:0,d=u?0:s.bottom,g=u?s.left:0,h=Pe(l);s.top&&(rr(h.bottom-o.top)<10&&(d=a.top-h.bottom),rr(h.top-o.top)<5&&(p=a.top-h.top)),s.left&&(rr(h.right-o.left)<10&&(f=a.left-h.right),rr(h.left-o.left)<5&&(g=a.left-h.left)),s.bottom&&(rr(h.top-o.bottom)<10&&(p=a.bottom-h.top),rr(h.bottom-o.bottom)<5&&(d=a.bottom-h.bottom)),s.right&&(rr(h.left-o.right)<10&&(g=a.right-h.left),rr(h.right-o.right)<5&&(f=a.right-h.right)),(p||f||d||g)&&c.push({shape:l,newBounds:nC(l,{top:p,right:f,bottom:d,left:g})})}}),c}var lC=500;function Gl(e,t){J.call(this,e);function n(i,r){var o=qt(i),a=or(r),s=[],c=[],u=[],l=[];if(Or(a,function(m){return o?m.y>i.y?c.push(m):s.push(m):m.x>i.x?l.push(m):u.push(m),m.children}),!!a.length){var p;o?c.length&&s.length?p=i.height/2:p=i.height:l.length&&u.length?p=i.width/2:p=i.width;var f,d,g,h;s.length&&(f=t.calculateAdjustments(s,"y",p,i.y-10),t.makeSpace(f.movingShapes,f.resizingShapes,{x:0,y:p},"s")),c.length&&(d=t.calculateAdjustments(c,"y",-p,i.y+i.height+10),t.makeSpace(d.movingShapes,d.resizingShapes,{x:0,y:-p},"n")),u.length&&(g=t.calculateAdjustments(u,"x",p,i.x-10),t.makeSpace(g.movingShapes,g.resizingShapes,{x:p,y:0},"e")),l.length&&(h=t.calculateAdjustments(l,"x",-p,i.x+i.width+10),t.makeSpace(h.movingShapes,h.resizingShapes,{x:-p,y:0},"w"))}}this.postExecuted("shape.delete",lC,function(i){var r=i.context,o=r.hints,a=r.shape,s=r.oldParent;_(a,"bpmn:Lane")&&(o&&o.nested||n(a,s))})}Gl.$inject=["eventBus","spaceTool"],de(Gl,J);var Vm=500;function Ks(e,t){t.invoke(J,this),this._bpmnReplace=e;var n=this;this.postExecuted("elements.create",Vm,function(i){var r=i.elements;r.filter(function(o){var a=o.host;return Wm(o,a)}).map(function(o){return r.indexOf(o)}).forEach(function(o){i.elements[o]=n._replaceShape(r[o])})},!0),this.preExecute("elements.move",Vm,function(i){var r=i.shapes,o=i.newHost;r.forEach(function(a,s){var c=a.host;Wm(a,fC(r,c)?c:o)&&(r[s]=n._replaceShape(a))})},!0)}Ks.$inject=["bpmnReplace","injector"],de(Ks,J),Ks.prototype._replaceShape=function(e){var t=pC(e),n;return t?n={type:"bpmn:IntermediateCatchEvent",eventDefinitionType:t.$type}:n={type:"bpmn:IntermediateThrowEvent"},this._bpmnReplace.replaceElement(e,n,{layoutConnection:!1})};function pC(e){var t=te(e),n=t.eventDefinitions;return n&&n[0]}function Wm(e,t){return!Fe(e)&&_(e,"bpmn:BoundaryEvent")&&!t}function fC(e,t){return e.indexOf(t)!==-1}var Xs=Math.round,dC=Math.max;function hC(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 mC(e){var t=[];return e.forEach(function(n,i){t.push([i===0?"M":"L",n.x,n.y])}),t}var Um=10;function gC(e,t){var n,i;for(n=0;i=e[n];n++)if(ea(i,t)<=Um)return{point:e[n],bendpoint:!0,index:n};return null}function yC(e,t){var n=Zh(hC(t,Um),mC(e)),i=n[0],r=n[n.length-1],o;return i?i!==r?i.segment2!==r.segment2?(o=dC(i.segment2,r.segment2)-1,{point:e[o],bendpoint:!0,index:o}):{point:{x:Xs(i.x+r.x)/2,y:Xs(i.y+r.y)/2},index:i.segment2}:{point:{x:Xs(i.x),y:Xs(i.y)},index:i.segment2}:null}function Vl(e,t){return gC(e,t)||yC(e,t)}function Wl(e,t,n){J.call(this,e);function i(r,o,a){var s=o.waypoints,c,u,l,p,f,d,g,h=r.outgoing.slice(),m=r.incoming.slice(),E;Le(a.width)?E=Oe(a):E=a;var y=Vl(s,E);if(y){if(c=s.slice(0,y.index),u=s.slice(y.index+(y.bendpoint?1:0)),!c.length||!u.length)return;l=y.bendpoint?s[y.index]:E,(c.length===1||!qm(r,c[c.length-1]))&&c.push(Ym(l)),(u.length===1||!qm(r,u[0]))&&u.unshift(Ym(l))}p=o.source,f=o.target,t.canConnect(p,r,o)&&(n.reconnectEnd(o,r,c||E),d=o),t.canConnect(r,f,o)&&(d?g=n.connect(r,f,{type:o.type,waypoints:u}):(n.reconnectStart(o,r,u||E),g=o));var x=[].concat(d&&Ge(m,function(S){return S.source===d.source})||[],g&&Ge(h,function(S){return S.target===g.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=Oe(c),l={x:u.x+s.x,y:u.y+s.y},p=lt(o.children,function(f){var d=t.canInsert(a,f);return d&&Vl(f.waypoints,l)});p&&(r.targetFlow=p,r.position=l)}},!0),this.postExecuted("elements.move",function(r){var o=r.shapes,a=r.targetFlow,s=r.position;a&&i(o[0],a,s)},!0),this.preExecute("shape.create",function(r){var o=r.parent,a=r.shape;t.canInsert(a,o)&&(r.targetFlow=o,r.parent=o.parent)},!0),this.postExecuted("shape.create",function(r){var o=r.shape,a=r.targetFlow,s=r.position;a&&i(o,a,s)},!0)}de(Wl,J),Wl.$inject=["eventBus","bpmnRules","modeling"];function qm(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 Ym(e){return H({},e)}function Ul(e,t){J.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)&&bo(r)){var c=[];_(o,"bpmn:EventBasedGateway")?c=a.incoming.filter(u=>u!==r&&bo(u)):c=a.incoming.filter(u=>u!==r&&bo(u)&&_(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(_(r,"bpmn:EventBasedGateway")){var o=r.outgoing.filter(bo).reduce(function(a,s){return a.includes(s.target)?a:a.concat(s.target)},[]);o.forEach(function(a){a.incoming.filter(bo).forEach(function(s){const c=a.incoming.filter(bo).filter(function(u){return u.source===r});(s.source!==r||c.length>1)&&t.removeConnection(s)})})}})}Ul.$inject=["eventBus","modeling"],de(Ul,J);function bo(e){return _(e,"bpmn:SequenceFlow")}var Zs=1500,Km=2e3;function Xm(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"],Zs,function(i){var r=i.context,o=r.shape||i.shape,a=i.hover;_(a,"bpmn:Lane")&&!ze(o,["bpmn:Lane","bpmn:Participant"])&&(i.hover=zn(a),i.hoverGfx=e.getGraphics(i.hover));var s=n.getRootElement();a&&a!==s&&(o.labelTarget||ze(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"],Zs,function(i){var r=i.hover;_(r,"bpmn:Lane")&&(i.hover=zn(r)||r,i.hoverGfx=e.getGraphics(i.hover))}),t.on(["bendpoint.move.hover"],Zs,function(i){var r=i.context,o=i.hover,a=r.type;_(o,"bpmn:Lane")&&/reconnect/.test(a)&&(i.hover=zn(o)||o,i.hoverGfx=e.getGraphics(i.hover))}),t.on(["connect.start"],Zs,function(i){var r=i.context,o=r.start;_(o,"bpmn:Lane")&&(r.start=zn(o)||o)}),t.on("shape.move.start",Km,function(i){var r=i.shape;_(r,"bpmn:Lane")&&(i.shape=zn(r)||r)}),t.on("spaceTool.move",Km,function(i){var r=i.hover;r&&_(r,"bpmn:Lane")&&(i.hover=zn(r))})}Xm.$inject=["elementRegistry","eventBus","canvas"];var Zm=770;function ql(e,t,n,i){n.invoke(J,this);function r(s,c){var u=te(s),l=c.categoryValue||u.categoryValueRef;l||(l=Bm(e,u));var p=c.category||l.$parent||Nm(e);u.categoryValueRef=l,l.$parent=p,c.categoryValue=l,c.category=p}function o(s,c){var u=te(s),l=c.categoryValue||u.categoryValueRef,p=c.category||l&&l.$parent;l&&(c.categoryValue=l,c.category=p,u.categoryValueRef=null)}this.execute("label.create",function(s){var c=s.context,u=c.labelTarget;_(u,"bpmn:Group")&&r(u,c)}),this.revert("label.create",function(s){var c=s.context,u=c.labelTarget;_(u,"bpmn:Group")&&o(u,c)}),this.execute("shape.delete",function(s){var c=s.context,u=c.shape,l=te(u);if(!(!_(u,"bpmn:Group")||u.labelTarget)){var p=c.categoryValue=l.categoryValueRef;p&&(c.category=p.$parent,l.categoryValueRef=null)}}),this.reverted("shape.delete",function(s){var c=s.context,u=c.shape;if(!(!_(u,"bpmn:Group")||u.labelTarget)){var l=c.category,p=c.categoryValue,f=te(u);p&&(f.categoryValueRef=p,p.$parent=l)}}),this.execute("shape.create",function(s){var c=s.context,u=c.shape,l=c.hints||{};!_(u,"bpmn:Group")||u.labelTarget||l.createElementsBehavior===!1&&!te(u).categoryValueRef&&!c.categoryValue||r(u,c)}),this.reverted("shape.create",function(s){var c=s.context,u=c.shape,l=c.hints||{};!_(u,"bpmn:Group")||u.labelTarget||l.createElementsBehavior===!1&&!te(u).categoryValueRef&&!c.categoryValue||o(u,c)}),this.executed(["shape.move","shape.resize"],function(s){var c=s.context,u=c.shape;!_(u,"bpmn:Group")||u.labelTarget||te(u).categoryValueRef||r(u,c)}),this.reverted(["shape.move","shape.resize"],function(s){var c=s.context,u=c.shape;!_(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(!(!_(u,"bpmn:Group")||u.labelTarget)){var l=te(u);if(l.categoryValueRef){var p=l.categoryValueRef;c.categoryValue=a(p,!0),p.$parent&&(c.category=a(p.$parent,!0))}}}),t.on("copyPaste.pasteElement",Zm,function(s){var c=s.descriptor,u=c.businessObject,l=c.categoryValue,p=c.category;l&&(l=u.categoryValueRef=a(l)),p&&(l.$parent=a(p)),delete c.category,delete c.categoryValue})}ql.$inject=["bpmnFactory","eventBus","injector","moddleCopy"],de(ql,J);function Yl(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 Qm(e){function t(i,r,o){var a={x:o.x,y:o.y-50},s={x:o.x-50,y:o.y},c=Yl(i,r,o,a),u=Yl(i,r,o,s),l;c&&u?Jm(c,o)>Jm(u,o)?l=u:l=c:l=c||u,i.original=l}function n(i){var r=i.waypoints;t(r[0],r[1],Oe(i.source)),t(r[r.length-1],r[r.length-2],Oe(i.target))}e.on("bpmnElement.added",function(i){var r=i.element;r.waypoints&&n(r)})}Qm.$inject=["eventBus"];function Jm(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function Kl(e){J.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=te(i),o=Ye(i);if(ze(r,t)){var a=o.get("isHorizontal");a===void 0&&(a=!0),o.set("isHorizontal",a)}})}Kl.$inject=["eventBus"],de(Kl,J);function eg(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}function tg(e){return Math.atan((e[1].y-e[0].y)/(e[1].x-e[0].x))}function vC(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 bC(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 Xl(e,t){var n=t[0],i=t[1],r={x:i.x-n.x,y:i.y-n.y},o=bC([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 ng(e,t){var n=Xl(e,t),i={x:n.x-e.x,y:n.y-e.y};return eg(i)}function pa(e,t){return eg({x:e.x-t.x,y:e.y-t.y})}var ig=Math.sqrt,rg=Math.min,_C=Math.max,og=Math.abs;function ag(e){return Math.pow(e,2)}function fa(e,t){return ig(ag(e.x-t.x)+ag(e.y-t.y))}function xC(e,t){var n=0,i,r,o,a,s,c,u,l,p,f,d;for(n=0;n<t.length-1;n++){if(i=t[n],r=t[n+1],cg(i,r)?u=[i]:(o=fa(e,i),a=fa(e,r),c=rg(o,a),u=wC(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:cg(i,u[0])?n:n+1}),u.length===2&&(s=SC(u[0],u[1]),l={type:"segment",position:s,segmentIndex:n,relativeLocation:fa(i,s)/fa(i,r)}),p=fa(l.position,e),(!d||f>p)&&(d=l,f=p)}return d}function wC(e,t,n,i){var r=t.x-e.x,o=t.y-e.y,a=n.x-e.x,s=n.y-e.y,c=r*r+o*o,u=r*a+o*s,l=a*a+s*s-i*i,p=u/c,f=l/c,d=p*p-f;if(d<0&&d>-1e-6&&(d=0),d<0)return[];var g=ig(d),h=-p+g,m=-p-g,E={x:e.x-r*h,y:e.y-o*h};if(d===0)return[E];var y={x:e.x-r*m,y:e.y-o*m};return[E,y].filter(function(x){return EC(x,e,t)})}function EC(e,t,n){return sg(e.x,t.x,n.x)&&sg(e.y,t.y,n.y)}function sg(e,t,n){return e>=rg(t,n)-Qs&&e<=_C(t,n)+Qs}function SC(e,t){return{x:(e.x+t.x)/2,y:(e.y+t.y)/2}}var Qs=.1;function cg(e,t){return og(e.x-t.x)<=Qs&&og(e.y-t.y)<=Qs}function RC(e,t,n,i){var r=n.segmentIndex,o=t.length-e.length;if(i.segmentMove){var a=i.segmentMove.segmentStartIndex,s=i.segmentMove.newSegmentStartIndex;return r===a?s:r>=s?r+o<s?s:r+o:r}if(i.bendpointMove){var c=i.bendpointMove.insert,u=i.bendpointMove.bendpointIndex,l;if(o===0)return r;if(r>=u&&(l=c?r+1:r-1),r<u&&(l=r,c&&n.type!=="bendpoint"&&u-1===r)){var p=lg(t,u);p<n.relativeLocation&&l++}return l}return o===0?r:i.connectionStart&&r===0?0:i.connectionEnd&&r===e.length-2?t.length-2:Math.floor((t.length-2)/2)}function ug(e,t,n,i){var r=0,o=0,a={point:e,delta:{x:0,y:0}},s=xC(e,n),c=s.segmentIndex,u=RC(n,t,s,i);if(u<0||u>t.length-2||u===null)return a;var l=pg(n,c),p=pg(t,u),f=s.position,d=PC(l,f),g=CC(l,p);if(s.type==="bendpoint"){var h=t.length-n.length,m=s.bendpointIndex,E=n[m];if(t.indexOf(E)!==-1)return a;if(h===0){var y=t[m];return r=y.x-s.position.x,o=y.y-s.position.y,{delta:{x:r,y:o},point:{x:e.x+r,y:e.y+o}}}h<0&&m!==0&&m<n.length-1&&(d=lg(n,m))}var x={x:(p[1].x-p[0].x)*d+p[0].x,y:(p[1].y-p[0].y)*d+p[0].y},S=vC({x:e.x-f.x,y:e.y-f.y},g);return r=x.x+S.x-e.x,o=x.y+S.y-e.y,{point:ki(x),delta:ki({x:r,y:o})}}function lg(e,t){var n=pa(e[t-1],e[t]),i=pa(e[t],e[t+1]),r=n/(n+i);return r}function CC(e,t){var n=tg(e),i=tg(t);return i-n}function pg(e,t){return[e[t],e[t+1]]}function PC(e,t){var n=pa(e[0],e[1]),i=pa(e[0],t);return n===0?0:i/n}function AC(e,t,n,i){var r=Oe(e);return ug(r,t,n,i).delta}function da(e,t,n){var i=ca(t),r=ca(n),o=Jn(e,i),a={x:o.x*(n.width/t.width),y:o.y*(n.height/t.height)};return ki({x:r.x+a.x,y:r.y+a.y})}function fg(e,t,n){var i=ca(e),r=ca(t),o=ca(n),a=Jn(e,i),s=Jn(i,r),c=TC(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 ki({x:l.x+a.x-e.x,y:l.y+a.y-e.y})}function TC(e,t,n){var i=Pe(t),r=Pe(n);if(MC(i,r))return null;var o=Jt(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=Jt(n,s),c!==o?null:a}function MC(e,t){return kC(e,t)||OC(e,t)}function kC(e,t){return e.right!==t.right&&e.left!==t.left}function OC(e,t){return e.top!==t.top&&e.bottom!==t.bottom}var dg="name",hg="text";function Zl(e,t,n,i){J.call(this,e),this.postExecute("element.updateProperties",r),this.postExecute("element.updateModdleProperties",a=>{te(a.context.element)===a.context.moddleElement&&r(a)});function r(a){var s=a.context,c=s.element,u=s.properties;if(dg in u&&t.updateLabel(c,u[dg]),hg in u&&_(c,"bpmn:TextAnnotation")){var l=i.getTextAnnotationBounds({x:c.x,y:c.y,width:c.width,height:c.height},u[hg]||"");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;Fe(u)||!ir(u)||Bn(u)&&t.updateLabel(u,Bn(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=H({},s.hints),p=s.newWaypoints||c.waypoints,f=s.oldWaypoints;return typeof l.startChanged>"u"&&(l.startChanged=!!l.connectionStart),typeof l.endChanged>"u"&&(l.endChanged=!!l.connectionEnd),AC(u,p,f,l)}this.postExecute(["connection.layout","connection.updateWaypoints"],function(a){var s=a.context,c=s.hints||{};if(c.labelBehavior!==!1){var u=s.connection,l=u.label,p;!l||!l.parent||(p=o(a),t.moveShape(l,p))}}),this.postExecute(["shape.replace"],function(a){var s=a.context,c=s.newShape,u=s.oldShape,l=te(c);l&&ir(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(!(!Fe(c)||u.autoResize)){var l=s.newBounds,p=i.getDimensions(Bn(c)||"",{box:l,style:i.getExternalStyle()}),f=Math.ceil(p.height),d=l.y!==c.y,g=c.y+c.height;s.newBounds={width:l.width,height:f,x:l.x,y:d?g-f:l.y}}}),this.postExecute("shape.resize",function(a){var s=a.context,c=s.shape,u=s.newBounds,l=s.oldBounds;if(Is(c)){var p=c.label,f=Oe(p),d=IC(l),g=LC(f,d),h=DC(g,l,u);t.moveShape(p,h)}})}de(Zl,J),Zl.$inject=["eventBus","modeling","bpmnFactory","textRenderer"];function DC(e,t,n){var i=da(e,t,n);return ki(Jn(i,e))}function LC(e,t){if(t.length){var n=NC(e,t);return Xl(e,n)}}function IC(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 NC(e,t){var n=t.map(function(r){return{line:r,distance:ng(e,r)}}),i=ii(n,"distance");return i[0].line}function BC(e,t,n,i){return ug(e,t,n,i).point}function Ql(e,t){J.call(this,e);function n(i,r){var o=i.context,a=o.connection,s=H({},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),BC(r,c,u,s)}this.postExecute(["connection.layout","connection.updateWaypoints"],function(i){var r=i.context,o=r.connection,a=o.outgoing,s=o.incoming;s.forEach(function(c){var u=c.waypoints[c.waypoints.length-1],l=n(i,u),p=[].concat(c.waypoints.slice(0,-1),[l]);t.updateWaypoints(c,p)}),a.forEach(function(c){var u=c.waypoints[0],l=n(i,u),p=[].concat([l],c.waypoints.slice(1));t.updateWaypoints(c,p)})}),this.postExecute(["connection.move"],function(i){var r=i.context,o=r.connection,a=o.outgoing,s=o.incoming,c=r.delta;s.forEach(function(u){var l=u.waypoints[u.waypoints.length-1],p={x:l.x+c.x,y:l.y+c.y},f=[].concat(u.waypoints.slice(0,-1),[p]);t.updateWaypoints(u,f)}),a.forEach(function(u){var l=u.waypoints[0],p={x:l.x+c.x,y:l.y+c.y},f=[].concat([p],u.waypoints.slice(1));t.updateWaypoints(u,f)})})}de(Ql,J),Ql.$inject=["eventBus","modeling"];function Js(e,t,n){var i=tc(e),r=gg(i,t),o=i[0];return r.length?r[r.length-1]:da(o.original||o,n,t)}function ec(e,t,n){var i=tc(e),r=gg(i,t),o=i[i.length-1];return r.length?r[0]:da(o.original||o,n,t)}function Jl(e,t,n){var i=tc(e),r=mg(t,n),o=i[0];return da(o.original||o,r,t)}function ep(e,t,n){var i=tc(e),r=mg(t,n),o=i[i.length-1];return da(o.original||o,r,t)}function mg(e,t){return{x:e.x-t.x,y:e.y-t.y,width:e.width,height:e.height}}function tc(e){var t=e.waypoints;if(!t.length)throw new Error("connection#"+e.id+": no waypoints");return t}function gg(e,t){var n=on(e,jC);return Ge(n,function(i){return $C(i,t)})}function $C(e,t){return Jt(t,e,1)==="intersect"}function jC(e){return e.original||e}function tp(e,t){J.call(this,e),this.postExecute("shape.replace",function(n){var i=n.oldShape,r=n.newShape;if(FC(i,r)){var o=HC(i);o.incoming.forEach(function(a){var s=ec(a,r,i);t.reconnectEnd(a,r,s)}),o.outgoing.forEach(function(a){var s=Js(a,r,i);t.reconnectStart(a,r,s)})}},!0)}tp.$inject=["eventBus","modeling"],de(tp,J);function FC(e,t){return _(e,"bpmn:Participant")&&Ue(e)&&_(t,"bpmn:Participant")&&!Ue(t)}function HC(e){var t=Qo([e]),n=[],i=[];return t.forEach(function(r){r!==e&&(r.incoming.forEach(function(o){_(o,"bpmn:MessageFlow")&&n.push(o)}),r.outgoing.forEach(function(o){_(o,"bpmn:MessageFlow")&&i.push(o)}))},[]),{incoming:n,outgoing:i}}const zC=["bpmn:MessageEventDefinition","bpmn:TimerEventDefinition","bpmn:EscalationEventDefinition","bpmn:ConditionalEventDefinition","bpmn:SignalEventDefinition"];function yg(e){const t=te(e);if(!_(t,"bpmn:BoundaryEvent")&&!(_(t,"bpmn:StartEvent")&&un(t.$parent)))return!1;const n=t.get("eventDefinitions");return!n||!n.length?!1:zC.some(i=>_(n[0],i))}function vg(e){return _(e,"bpmn:BoundaryEvent")?"cancelActivity":"isInterrupting"}function np(e,t){e.invoke(J,this),this.postExecuted("shape.replace",function(n){const i=n.context.oldShape,r=n.context.newShape,o=n.context.hints;if(!yg(r))return;const a=vg(r);if(o.targetElement&&o.targetElement[a]!==void 0)return;const c=te(i).get(a),u=te(r).get(a);c!==u&&t.updateProperties(r,{[a]:c})})}np.$inject=["injector","modeling"],de(np,J);function ip(e,t){J.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)}de(ip,J),ip.$inject=["eventBus","modeling"];function rp(e,t,n){J.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(!(!_(o,"bpmn:SequenceFlow")||!_(a,"bpmn:SequenceFlow"))&&t.canConnect(o.source,a.target,o)){var s=GC(o.waypoints,a.waypoints);n.reconnectEnd(o,a.target,s)}}})}de(rp,J),rp.$inject=["eventBus","bpmnRules","modeling"];function _o(e){return e.original||e}function GC(e,t){var n=Yl(_o(e[e.length-2]),_o(e[e.length-1]),_o(t[1]),_o(t[0]));return n?[].concat(e.slice(0,e.length-1),[n],t.slice(1)):[_o(e[0]),_o(t[t.length-1])]}function op(e,t){J.call(this,e),this.preExecute("shape.delete",function(n){var i=n.shape,r=i.parent;_(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)}op.$inject=["eventBus","modeling"],de(op,J);function ap(e,t,n,i){J.call(this,e);var r=i.get("dragging",!1);function o(c){var u=c.source,l=c.target,p=c.parent;if(p){var f,d;_(c,"bpmn:SequenceFlow")&&(n.canConnectSequenceFlow(u,l)||(d=!0),n.canConnectMessageFlow(u,l)&&(f="bpmn:MessageFlow")),_(c,"bpmn:MessageFlow")&&(n.canConnectMessageFlow(u,l)||(d=!0),n.canConnectSequenceFlow(u,l)&&(f="bpmn:SequenceFlow")),d&&t.removeConnection(c),f&&t.connect(u,l,{type:f,waypoints:c.waypoints.slice()})}}function a(c){var u=c.context,l=u.connection,p=u.newSource||l.source,f=u.newTarget||l.target,d,g;d=n.canConnect(p,f),!(!d||d.type===l.type)&&(g=t.connect(p,f,{type:d.type,associationDirection:d.associationDirection,waypoints:l.waypoints.slice()}),l.parent&&t.removeConnection(l),u.connection=g,r&&s(l,g))}function s(c,u){var l=r.context(),p=l&&l.payload.previousSelection,f;!p||!p.length||(f=p.indexOf(c),f!==-1&&p.splice(f,1,u))}this.postExecuted("elements.move",function(c){var u=c.closure,l=u.allConnections;L(l,o)},!0),this.preExecute("connection.reconnect",a),this.postExecuted("element.updateProperties",function(c){var u=c.context,l=u.properties,p=u.element,f=p.businessObject,d;l.default&&(d=lt(p.outgoing,to({id:p.businessObject.default.id})),d&&t.updateProperties(d,{conditionExpression:void 0})),l.conditionExpression&&f.sourceRef.default===f&&t.updateProperties(p.source,{default:void 0})})}de(ap,J),ap.$inject=["eventBus","modeling","bpmnRules","injector"];function nc(e,t,n,i,r,o){i.invoke(J,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=En(u,function(p,f){var d=t.canReplace([f],f.host||f.parent||c);return d?p.concat(d.replacements):p},[]);l.length&&this._replaceElements(u,l)},this),this.postExecuted(["elements.move"],500,function(a){var s=a.context,c=s.newParent,u=s.newHost,l=[];L(s.closure.topLevel,function(f){un(f)?l=l.concat(f.children):l=l.concat(f)}),l.length===1&&u&&(c=u);var p=t.canReplace(l,c);p&&this._replaceElements(l,p.replacements,u)},this),this.postExecute(["shape.replace"],1500,function(a){var s=a.context,c=s.oldShape,u=s.newShape,l=c.attachers,p;l&&l.length&&(p=t.canReplace(l,u),this._replaceElements(l,p.replacements))},this),this.postExecuted(["shape.replace"],1500,function(a){var s=a.context,c=s.oldShape,u=s.newShape;r.unclaimId(c.businessObject.id,c.businessObject),r.updateProperties(u,{id:c.id})})}de(nc,J),nc.prototype._replaceElements=function(e,t){var n=this._elementRegistry,i=this._bpmnReplace,r=this._selection;L(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)},nc.$inject=["bpmnReplace","bpmnRules","elementRegistry","injector","modeling","selection"];var VC=1500,WC={width:140,height:120},sp={width:300,height:60},cp={width:60,height:300},ic={width:300,height:150},rc={width:150,height:300},bg={width:140,height:120},_g={width:100,height:40};function xg(e){e.on("resize.start",VC,function(t){var n=t.context,i=n.shape,r=n.direction,o=n.balanced;(_(i,"bpmn:Lane")||_(i,"bpmn:Participant"))&&(n.resizeConstraints=XC(i,r,o)),_(i,"bpmn:SubProcess")&&Ue(i)&&(n.minDimensions=bg),_(i,"bpmn:TextAnnotation")&&(n.minDimensions=_g)})}xg.$inject=["eventBus"];var ar=Math.abs,UC=Math.min,qC=Math.max;function wg(e,t,n,i){var r=e[t];e[t]=r===void 0?n:i(n,r)}function xo(e,t,n){return wg(e,t,n,UC)}function wo(e,t,n){return wg(e,t,n,qC)}var YC={top:20,left:50,right:20,bottom:20},KC={top:50,left:20,right:20,bottom:20};function XC(e,t,n){var i=zn(e),r=!0,o=!0,a=Ys(i,[i]),s=Pe(e),c={},u={},l=qt(e),p=l?sp:cp;/n/.test(t)?u.top=s.bottom-p.height:/e/.test(t)?u.right=s.left+p.width:/s/.test(t)?u.bottom=s.top+p.height:/w/.test(t)&&(u.left=s.right-p.width),a.forEach(function(g){var h=Pe(g);l?(h.top<s.top-10&&(r=!1),h.bottom>s.bottom+10&&(o=!1)):(h.left<s.left-10&&(r=!1),h.right>s.right+10&&(o=!1)),/n/.test(t)&&(n&&ar(s.top-h.bottom)<10&&wo(c,"top",h.top+p.height),ar(s.top-h.top)<5&&xo(u,"top",h.bottom-p.height)),/e/.test(t)&&(n&&ar(s.right-h.left)<10&&xo(c,"right",h.right-p.width),ar(s.right-h.right)<5&&wo(u,"right",h.left+p.width)),/s/.test(t)&&(n&&ar(s.bottom-h.top)<10&&xo(c,"bottom",h.bottom-p.height),ar(s.bottom-h.bottom)<5&&wo(u,"bottom",h.top+p.height)),/w/.test(t)&&(n&&ar(s.left-h.right)<10&&wo(c,"left",h.left+p.width),ar(s.left-h.left)<5&&xo(u,"left",h.right-p.width))});var f=i.children.filter(function(g){return!g.hidden&&!g.waypoints&&(_(g,"bpmn:FlowElement")||_(g,"bpmn:Artifact"))}),d=l?YC:KC;return f.forEach(function(g){var h=Pe(g);/n/.test(t)&&(!l||r)&&xo(u,"top",h.top-d.top),/e/.test(t)&&(l||o)&&wo(u,"right",h.right+d.right),/s/.test(t)&&(!l||o)&&wo(u,"bottom",h.bottom+d.bottom),/w/.test(t)&&(l||r)&&xo(u,"left",h.left-d.left)}),{min:u,max:c}}function Eg(e){!e||typeof e.stopPropagation!="function"||e.stopPropagation()}function Eo(e){return e.originalEvent||e.srcEvent}function up(e){Eg(e),Eg(Eo(e))}function Nr(e){return e.pointers&&e.pointers.length&&(e=e.pointers[0]),e.touches&&e.touches.length&&(e=e.touches[0]),e?{x:e.clientX,y:e.clientY}:null}function Sg(){return/mac/i.test(navigator.platform)}function Rg(e,t){return(Eo(e)||e).button===t}function sr(e){return Rg(e,0)}function ZC(e){return Rg(e,1)}function ha(e){var t=Eo(e)||e;return sr(e)?Sg()?t.metaKey:t.ctrlKey:!1}function oc(e){var t=Eo(e)||e;return sr(e)&&t.shiftKey}var Cg=1001;function Pg(e,t){e.on("resize.start",Cg+500,function(n){var i=n.context,r=i.shape;(_(r,"bpmn:Lane")||_(r,"bpmn:Participant"))&&(i.balanced=!ha(n))}),e.on("resize.end",Cg,function(n){var i=n.context,r=i.shape,o=i.canExecute,a=i.newBounds;if(_(r,"bpmn:Lane")||_(r,"bpmn:Participant"))return o&&(a=nm(a),t.resizeLane(r,a,i.balanced)),!1})}Pg.$inject=["eventBus","modeling"];var QC=500;function lp(e,t,n,i,r){n.invoke(J,this);function o(l){return ze(l,["bpmn:ReceiveTask","bpmn:SendTask"])||JC(l,["bpmn:ErrorEventDefinition","bpmn:EscalationEventDefinition","bpmn:MessageEventDefinition","bpmn:SignalEventDefinition"])}function a(l){var p=e.getDefinitions(),f=p.get("rootElements");return!!lt(f,to({id:l.id}))}function s(l){if(_(l,"bpmn:ErrorEventDefinition"))return"errorRef";if(_(l,"bpmn:EscalationEventDefinition"))return"escalationRef";if(_(l,"bpmn:MessageEventDefinition"))return"messageRef";if(_(l,"bpmn:SignalEventDefinition"))return"signalRef"}function c(l){if(ze(l,["bpmn:ReceiveTask","bpmn:SendTask"]))return l.get("messageRef");var p=l.get("eventDefinitions"),f=p[0];return f.get(s(f))}function u(l,p){if(ze(l,["bpmn:ReceiveTask","bpmn:SendTask"]))return l.set("messageRef",p);var f=l.get("eventDefinitions"),d=f[0];return d.set(s(d),p)}this.executed(["shape.create","element.updateProperties","element.updateModdleProperties"],function(l){var p=l.shape||l.element;if(o(p)){var f=te(p),d=c(f),g;d&&!a(d)&&(g=e.getDefinitions().get("rootElements"),Pt(g,d),l.addedRootElement=d)}},!0),this.reverted(["shape.create","element.updateProperties","element.updateModdleProperties"],function(l){var p=l.addedRootElement;if(p){var f=e.getDefinitions().get("rootElements");Rt(f,p)}},!0),t.on("copyPaste.copyElement",function(l){var p=l.descriptor,f=l.element;if(!(f.labelTarget||!o(f))){var d=te(f),g=c(d);g&&(p.referencedRootElement=g)}}),t.on("copyPaste.pasteElement",QC,function(l){var p=l.descriptor,f=p.businessObject,d=p.referencedRootElement;d&&(a(d)||(d=i.copyElement(d,r.create(d.$type))),u(f,d),delete p.referencedRootElement)})}lp.$inject=["bpmnjs","eventBus","injector","moddleCopy","bpmnFactory"],de(lp,J);function JC(e,t){return ke(t)||(t=[t]),Ui(t,function(n){return ho(e,n)})}var Ag=Math.max;function Tg(e){e.on("spaceTool.getMinDimensions",function(t){var n=t.shapes,i=t.axis,r=t.start,o={};return L(n,function(a){var s=a.id;_(a,"bpmn:Participant")&&(o[s]=tP(a,i,r)),_(a,"bpmn:Lane")&&(o[s]=qt(a)?sp:cp),_(a,"bpmn:SubProcess")&&Ue(a)&&(o[s]=bg),_(a,"bpmn:TextAnnotation")&&(o[s]=_g),_(a,"bpmn:Group")&&(o[s]=WC)}),o})}Tg.$inject=["eventBus"];function eP(e){return e==="x"}function tP(e,t,n){var i=qt(e);if(!rP(e))return i?ic:rc;var r=eP(t),o={};return r?i?o=ic:o={width:iP(e,n,r),height:rc.height}:i?o={width:ic.width,height:nP(e,n,r)}:o=rc,o}function nP(e,t,n){var i;return i=oP(e,t,n),Ag(ic.height,i)}function iP(e,t,n){var i;return i=aP(e,t,n),Ag(rc.width,i)}function rP(e){return!!or(e).length}function oP(e,t,n){var i=or(e),r;return r=pp(i,t,n),e.height-r.height+sp.height}function aP(e,t,n){var i=or(e),r;return r=pp(i,t,n),e.width-r.width+cp.width}function pp(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=or(r),o.length?pp(o,t,n):r}var Mg="_plane";function kg(e){var t=e.id;return sP(t)}function hi(e){var t=e.id;return _(e,"bpmn:SubProcess")?Og(t):t}function Br(e){return Og(e)}function ac(e){var t=Ye(e);return _(t,"bpmndi:BPMNPlane")}function Og(e){return e+Mg}function sP(e){return e.replace(new RegExp(Mg+"$"),"")}var Dg=400,cP=600,Lg={x:180,y:160};function Ii(e,t,n,i,r,o,a){J.call(this,t),this._canvas=e,this._eventBus=t,this._modeling=n,this._elementFactory=i,this._bpmnFactory=r,this._bpmnjs=o,this._elementRegistry=a;var s=this;function c(p){return _(p,"bpmn:SubProcess")&&!Ue(p)}function u(p){var f=p.shape,d=p.newRootElement,g=te(f);d=s._addDiagram(d||g),p.newRootElement=e.addRootElement(d)}function l(p){var f=p.shape,d=te(f);s._removeDiagram(d);var g=p.newRootElement=a.get(hi(d));e.removeRootElement(g)}this.executed("shape.create",function(p){var f=p.shape;c(f)&&u(p)},!0),this.postExecuted("elements.create",function(p){var f=p.elements;L(f,function(d){if(c(d)){var g=a.get(hi(d));if(!(!g||!d.children||!d.children.length)){var h=Ig(d);s._showRecursively(h),s._moveChildrenToShape(h,g)}}})},!0),this.reverted("shape.create",function(p){var f=p.shape;c(f)&&l(p)},!0),this.preExecute("shape.delete",function(p){var f=p.shape;!_(f,"bpmn:SubProcess")||!Ue(f)||L(ra([f]),d=>{n.removeShape(d.annotation)})},!0),this.preExecuted("shape.delete",function(p){var f=p.shape;if(c(f)){var d=a.get(hi(f));d&&n.removeElements(d.children.slice())}},!0),this.executed("shape.delete",function(p){var f=p.shape;c(f)&&l(p)},!0),this.reverted("shape.delete",function(p){var f=p.shape;c(f)&&u(p)},!0),this.preExecuted("shape.replace",function(p){var f=p.oldShape,d=p.newShape;!c(f)||!c(d)||(p.oldRoot=e.removeRootElement(hi(f)))},!0),this.postExecuted("shape.replace",function(p){var f=p.newShape,d=p.oldRoot,g=e.findRoot(hi(f));if(!(!d||!g)){var h=d.children;n.moveElements(h,{x:0,y:0},g)}},!0),this.executed("element.updateProperties",function(p){var f=p.element;if(_(f,"bpmn:SubProcess")){var d=p.properties,g=p.oldProperties,h=g.id,m=d.id;if(h!==m){if(ac(f)){a.updateId(f,Br(m)),a.updateId(h,m);return}var E=a.get(Br(h));E&&a.updateId(Br(h),Br(m))}}},!0),this.reverted("element.updateProperties",function(p){var f=p.element;if(_(f,"bpmn:SubProcess")){var d=p.properties,g=p.oldProperties,h=g.id,m=d.id;if(h!==m){if(ac(f)){a.updateId(f,Br(h)),a.updateId(m,h);return}var E=a.get(Br(m));E&&a.updateId(E,Br(h))}}},!0),t.on("element.changed",function(p){var f=p.element;if(ac(f)){var d=f,g=a.get(kg(d));!g||g===d||t.fire("element.changed",{element:g})}}),this.executed("shape.toggleCollapse",Dg,function(p){var f=p.shape;_(f,"bpmn:SubProcess")&&(Ue(f)?l(p):(u(p),s._showRecursively(f.children)))},!0),this.reverted("shape.toggleCollapse",Dg,function(p){var f=p.shape;_(f,"bpmn:SubProcess")&&(Ue(f)?l(p):(u(p),s._showRecursively(f.children)))},!0),this.postExecuted("shape.toggleCollapse",cP,function(p){var f=p.shape;if(_(f,"bpmn:SubProcess")){var d=p.newRootElement;if(d)if(Ue(f))s._moveChildrenToShape(d.children.slice(),f),L(ra(f.children),h=>{n.moveShape(h.annotation,{x:0,y:0},f.parent),L(h.associations,m=>{n.moveConnection(m,{x:0,y:0},f.parent)})});else{s._disconnectSharedAnnotations(f);var g=Ig(f);s._moveChildrenToShape(g,d)}}},!0),t.on("copyPaste.createTree",function(p){var f=p.element,d=p.children;if(c(f)){var g=hi(f),h=a.get(g);h&&d.push.apply(d,h.children)}}),t.on("copyPaste.copyElement",function(p){var f=p.descriptor,d=p.element,g=p.elements,h=d.parent,m=_(Ye(h),"bpmndi:BPMNPlane");if(m){var E=kg(h),y=lt(g,function(x){return x.id===E});y&&(f.parent=y.id)}}),t.on("copyPaste.pasteElement",function(p){var f=p.descriptor;f.parent&&(c(f.parent)||f.parent.hidden)&&(f.hidden=!0)})}de(Ii,J),Ii.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=Tt(i),o;if(!t.x)o={x:Lg.x-r.x,y:Lg.y-r.y};else{var a=Oe(t),s=Oe(r);o={x:a.x-s.x,y:a.y-s.y}}n.moveElements(e,o,t,{autoResize:!1})}},Ii.prototype._disconnectSharedAnnotations=function(e){var t=this._modeling,n=new Set(Rm(e).map(i=>i.annotation));n.size&&L(ra(e.children),i=>{n.has(i.annotation)&&L(i.associations,r=>{t.removeConnection(r)})})},Ii.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},Ii.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},Ii.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:hi(e),type:e.$type,di:i,businessObject:e,collapsed:!0});return o},Ii.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},Ii.$inject=["canvas","eventBus","modeling","elementFactory","bpmnFactory","bpmnjs","elementRegistry"];function uP(e){var t=[];return L(ra(e),n=>{t.push(n.annotation),t.push.apply(t,n.associations)}),t}function Ig(e){return e.children.slice().concat(uP(e.children)).concat(lP(e))}function lP(e){return gl(e.children||[]).reduce(function(t,n){return n.label&&n.label.parent!==e&&t.push(n.label),t},[])}function fp(e,t){e.invoke(J,this),this.postExecuted("shape.replace",function(n){var i=n.context.oldShape,r=n.context.newShape;if(!(!_(r,"bpmn:SubProcess")||_(r,"bpmn:AdHocSubProcess")||!(_(i,"bpmn:Task")||_(i,"bpmn:CallActivity"))||!Ue(r))){var o=pP(r);t.createShape({type:"bpmn:StartEvent"},o,r)}})}fp.$inject=["injector","modeling"],de(fp,J);function pP(e){return{x:e.x+e.width/6,y:e.y+e.height/2}}function dp(e,t){J.call(this,e),this.preExecute("connection.create",function(n){const{target:i}=n;_(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&&_(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(!(!_(r,"bpmn:TextAnnotation")||o.autoResize)){var a=i.newBounds,s=t.getTextAnnotationBounds(a,Bn(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}}})}de(dp,J),dp.$inject=["eventBus","textRenderer"];function hp(e,t){J.call(this,e),this.postExecuted("shape.toggleCollapse",1500,function(n){var i=n.shape;if(Ue(i))return;var r=Qo(i);r.forEach(function(a){var s=a.incoming.slice(),c=a.outgoing.slice();L(s,function(u){o(u,!0)}),L(c,function(u){o(u,!1)})});function o(a,s){r.indexOf(a.source)!==-1&&r.indexOf(a.target)!==-1||_(a,"bpmn:Association")&&(_(a.source,"bpmn:TextAnnotation")||_(a.target,"bpmn:TextAnnotation"))||(s?t.reconnectEnd(a,i,Oe(i)):t.reconnectStart(a,i,Oe(i)))}},!0)}de(hp,J),hp.$inject=["eventBus","modeling"];var mp=500;function gp(e,t,n){J.call(this,e);function i(a){a.length&&a.forEach(function(s){s.type==="label"&&!s.businessObject.name&&(s.hidden=!0)})}function r(a,s){var c=a.children,u=s,l,p;return l=fP(c).concat([a]),p=Gm(l),p?(u.width=Math.max(p.width,u.width),u.height=Math.max(p.height,u.height),u.x=p.x+(p.width-u.width)/2,u.y=p.y+(p.height-u.height)/2):(u.x=a.x+(a.width-u.width)/2,u.y=a.y+(a.height-u.height)/2),u}function o(a,s){return{x:a.x+(a.width-s.width)/2,y:a.y+(a.height-s.height)/2,width:s.width,height:s.height}}this.executed(["shape.toggleCollapse"],mp,function(a){var s=a.context,c=s.shape;_(c,"bpmn:SubProcess")&&(c.collapsed?Ye(c).isExpanded=!1:(i(c.children),Ye(c).isExpanded=!0))}),this.reverted(["shape.toggleCollapse"],mp,function(a){var s=a.context,c=s.shape;c.collapsed?Ye(c).isExpanded=!1:Ye(c).isExpanded=!0}),this.postExecuted(["shape.toggleCollapse"],mp,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"})})}de(gp,J),gp.$inject=["eventBus","elementFactory","modeling"];function fP(e){return e.filter(function(t){return!t.hidden})}function yp(e,t,n,i){t.invoke(J,this),this.preExecute("shape.delete",function(r){var o=r.context,a=o.shape,s=a.businessObject;Fe(a)||(_(a,"bpmn:Participant")&&Ue(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;_(r,"bpmn:Collaboration")&&n.ids.unclaim(o.id)})}de(yp,J),yp.$inject=["canvas","injector","moddle","modeling"];function vp(e,t){J.call(this,e),this.preExecute("connection.delete",function(n){var i=n.context,r=i.connection,o=r.source;dP(r,o)&&t.updateProperties(o,{default:null})})}de(vp,J),vp.$inject=["eventBus","modeling"];function dP(e,t){if(!_(e,"bpmn:SequenceFlow"))return!1;var n=te(t),i=te(e);return n.get("default")===i}var hP=500,mP=5e3,Ng=["shape.create","shape.delete","shape.move","shape.resize"],Bg=[...Ng,"spaceTool","lane.add","lane.resize","lane.split","elements.create","elements.delete","elements.move"];function bp(e,t){J.call(this,e);var n;function i(){return n=n||new gP,n.enter(),n}function r(){if(!n)throw new Error("out of bounds release");return n}function o(){if(!n)throw new Error("out of bounds release");var a=n.leave();return a&&(t.updateLaneRefs(n.flowNodes,n.lanes),n=null),a}this.preExecute(Bg,mP,function(){i()}),this.postExecuted(Bg,hP,function(){o()}),this.preExecute(Ng,function(a){var s=a.context,c=s.shape,u=r();!c||c.labelTarget||(_(c,"bpmn:Lane")&&u.addLane(c),_(c,"bpmn:FlowNode")&&u.addFlowNode(c))})}bp.$inject=["eventBus","modeling"],de(bp,J);function gP(){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 yP=500,vP=5e3,$g=["connection.create","connection.delete","connection.layout","connection.move","connection.reconnect","connection.updateWaypoints","shape.create","shape.delete","shape.move","shape.resize"],jg=[...$g,"elements.create","elements.delete","elements.move","label.create","spaceTool"];function _p(e,t){J.call(this,e);var n;function i(){return n=n||new bP,n.enter(),n}function r(){if(!n)throw new Error("out of bounds release");return n}function o(){if(!n)throw new Error("out of bounds release");var a=n.leave();return a&&(t.updateCategoryValueRefs(Array.from(n.affectedFlowElements),Array.from(n.affectedGroupEntries.values())),n=null),a}this.preExecute(jg,vP,function(){i()}),this.postExecuted(jg,yP,function(){o()}),this.preExecute($g,function(a){var s=a.context.connection||a.context.shape,c=r();!s||s.labelTarget||(_(s,"bpmn:FlowElement")&&c.addFlowElement(s),_(s,"bpmn:Group")&&c.addGroup(s))}),this.preExecute("label.create",function(a){var s=a.context.labelTarget;_(s,"bpmn:Group")&&r().addGroup(s)})}_p.$inject=["eventBus","modeling"],de(_p,J);function bP(){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 xp(e,t){J.call(this,e),this.postExecuted("elements.create",function(n){const i=n.context,r=i.elements;for(const o of r)_P(o)&&!wP(o)&&t.updateProperties(o,{isForCompensation:void 0})})}de(xp,J),xp.$inject=["eventBus","modeling"];function _P(e){const t=te(e);return t&&t.isForCompensation}function xP(e){return e&&_(e,"bpmn:BoundaryEvent")&&ho(e,"bpmn:CompensateEventDefinition")}function wP(e){return e.incoming.filter(n=>xP(n.source)).length>0}const EP={__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",Tl],appendBehavior:["type",Ml],associationBehavior:["type",Ol],attachEventBehavior:["type",Hs],artifactBehavior:["type",kl],boundaryEventBehavior:["type",Dl],categoryRootElementReferenceBehavior:["type",Ll],compensateBoundaryEventBehaviour:["type",Il],createBehavior:["type",Nl],createDataObjectBehavior:["type",Bl],createParticipantBehavior:["type",Fl],dataInputAssociationBehavior:["type",Hl],dataStoreBehavior:["type",zl],deleteLaneBehavior:["type",Gl],detachEventBehavior:["type",Ks],dropOnFlowBehavior:["type",Wl],eventBasedGatewayBehavior:["type",Ul],fixHoverBehavior:["type",Xm],groupBehavior:["type",ql],importDockingFix:["type",Qm],isHorizontalFix:["type",Kl],labelBehavior:["type",Zl],layoutConnectionBehavior:["type",Ql],messageFlowBehavior:["type",tp],nonInterruptingBehavior:["type",np],removeElementBehavior:["type",rp],removeEmbeddedLabelBoundsBehavior:["type",ip],removeParticipantBehavior:["type",op],replaceConnectionBehavior:["type",ap],replaceElementBehaviour:["type",nc],resizeBehavior:["type",xg],resizeLaneBehavior:["type",Pg],rootElementReferenceBehavior:["type",lp],spaceToolBehavior:["type",Tg],subProcessPlaneBehavior:["type",Ii],subProcessStartEventBehavior:["type",fp],textAnnotationBehavior:["type",dp],toggleCollapseConnectionBehaviour:["type",hp],toggleElementCollapseBehaviour:["type",gp],unclaimIdBehavior:["type",yp],unsetDefaultFlowBehavior:["type",vp],updateFlowNodeRefsBehavior:["type",bp],updateCategoryValueRefsBehavior:["type",_p],setCompensationActivityAfterPasteBehavior:["type",xp]};function wp(e){this._commandStack=e.get("commandStack",!1)}wp.$inject=["injector"],wp.prototype.allowed=function(e,t){var n=!0,i=this._commandStack;return i&&(n=i.canExecute(e,t)),n===void 0?!0:n};const mi={__init__:["rules"],rules:["type",wp]};function Gn(e){J.call(this,e),this.init()}Gn.$inject=["eventBus"],de(Gn,J),Gn.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)})},Gn.prototype.init=function(){};function Fg(e,t){var n=Jt(e,t,-15);return n!=="intersect"?n:null}function tn(e){Gn.call(this,e)}de(tn,Gn),tn.$inject=["eventBus"],tn.prototype.init=function(){this.addRule("connection.start",function(e){var t=e.source;return SP(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 cc(t,n)}finally{r&&(n.parent=null)}}),this.addRule("connection.reconnect",function(e){var t=e.connection,n=e.source,i=e.target;return cc(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 Jg(t,n,i)}),this.addRule("elements.create",function(e){var t=e.elements,n=e.position,i=e.target;return st(i)&&!uc(t,i)?!1:Rr(t,function(r){return st(r)?cc(r.source,r.target,r):r.host?ma(r,r.host,null,n):Cp(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 qg(a)&&!n.includes(a.host)})?!1:ma(n,t,null,i)||Zg(n,t,i)||Qg(n,t)||uc(n,t)}),this.addRule("shape.create",function(e){return Cp(e.shape,e.target,e.source,e.position)}),this.addRule("shape.attach",function(e){return ma(e.shape,e.target,null,e.position)}),this.addRule("element.copy",function(e){var t=e.element,n=e.elements;return ry(n,t)})},tn.prototype.canConnectMessageFlow=ny,tn.prototype.canConnectSequenceFlow=iy,tn.prototype.canConnectDataAssociation=Pp,tn.prototype.canConnectAssociation=ey,tn.prototype.canConnectCompensationAssociation=ty,tn.prototype.canMove=Qg,tn.prototype.canAttach=ma,tn.prototype.canReplace=Zg,tn.prototype.canDrop=So,tn.prototype.canInsert=uc,tn.prototype.canCreate=Cp,tn.prototype.canConnect=cc,tn.prototype.canResize=Jg,tn.prototype.canCopy=ry;function SP(e){return Ep(e)?null:ze(e,["bpmn:FlowNode","bpmn:InteractionNode","bpmn:DataObjectReference","bpmn:DataStoreReference","bpmn:Group","bpmn:TextAnnotation"])}function Ep(e){return!e||Fe(e)}function Hg(e){do{if(_(e,"bpmn:Process"))return te(e);if(_(e,"bpmn:Participant"))return te(e).processRef||te(e)}while(e=e.parent)}function Sp(e){return _(e,"bpmn:TextAnnotation")}function Rp(e){return _(e,"bpmn:Group")&&!e.labelTarget}function zg(e){return _(e,"bpmn:BoundaryEvent")&&gi(e,"bpmn:CompensateEventDefinition")}function sc(e){return te(e).isForCompensation}function RP(e,t){var n=Hg(e),i=Hg(t);return n===i}function CP(e){return _(e,"bpmn:InteractionNode")&&!_(e,"bpmn:BoundaryEvent")&&(!_(e,"bpmn:Event")||_(e,"bpmn:ThrowEvent")&&Wg(e,"bpmn:MessageEventDefinition"))}function PP(e){return _(e,"bpmn:InteractionNode")&&!sc(e)&&(!_(e,"bpmn:Event")||_(e,"bpmn:CatchEvent")&&Wg(e,"bpmn:MessageEventDefinition"))&&!(_(e,"bpmn:BoundaryEvent")&&!gi(e,"bpmn:MessageEventDefinition"))}function Gg(e){for(var t=e;t=t.parent;){if(_(t,"bpmn:FlowElementsContainer"))return te(t);if(_(t,"bpmn:Participant"))return te(t).processRef}return null}function Vg(e,t){var n=Gg(e),i=Gg(t);return n===i}function gi(e,t){var n=te(e);return!!lt(n.eventDefinitions||[],function(i){return _(i,t)})}function Wg(e,t){var n=te(e);return(n.eventDefinitions||[]).every(function(i){return _(i,t)})}function AP(e){return _(e,"bpmn:FlowNode")&&!_(e,"bpmn:EndEvent")&&!un(e)&&!(_(e,"bpmn:IntermediateThrowEvent")&&gi(e,"bpmn:LinkEventDefinition"))&&!zg(e)&&!sc(e)}function TP(e){return _(e,"bpmn:FlowNode")&&!_(e,"bpmn:StartEvent")&&!_(e,"bpmn:BoundaryEvent")&&!un(e)&&!(_(e,"bpmn:IntermediateCatchEvent")&&gi(e,"bpmn:LinkEventDefinition"))&&!sc(e)}function MP(e){return _(e,"bpmn:ReceiveTask")||_(e,"bpmn:IntermediateCatchEvent")&&(gi(e,"bpmn:MessageEventDefinition")||gi(e,"bpmn:TimerEventDefinition")||gi(e,"bpmn:ConditionalEventDefinition")||gi(e,"bpmn:SignalEventDefinition"))}function kP(e){for(var t=[];e;)e=e.parent,e&&t.push(e);return t}function Ug(e,t){var n=kP(t);return n.indexOf(e)!==-1}function cc(e,t,n){if(Ep(e)||Ep(t))return null;if(!_(n,"bpmn:DataAssociation")){if(ny(e,t))return{type:"bpmn:MessageFlow"};if(iy(e,t))return{type:"bpmn:SequenceFlow"}}var i=Pp(e,t);return i||(ty(e,t)?{type:"bpmn:Association",associationDirection:"One"}:ey(e,t)?{type:"bpmn:Association",associationDirection:"None"}:!1)}function So(e,t){return Fe(e)||Rp(e)?!0:_(t,"bpmn:Participant")&&!Ue(t)?!1:_(e,"bpmn:Participant")?_(t,"bpmn:Process")||_(t,"bpmn:Collaboration"):ze(e,["bpmn:DataInput","bpmn:DataOutput"])&&e.parent?t===e.parent:_(e,"bpmn:Lane")?_(t,"bpmn:Participant")||_(t,"bpmn:Lane"):_(e,"bpmn:BoundaryEvent")&&!OP(e)?!1:_(e,"bpmn:FlowElement")&&!_(e,"bpmn:DataStoreReference")?_(t,"bpmn:FlowElementsContainer")?Ue(t):ze(t,["bpmn:Participant","bpmn:Lane"]):_(e,"bpmn:DataStoreReference")&&_(t,"bpmn:Collaboration")?Ui(te(t).get("participants"),function(n){return!!n.get("processRef")}):ze(e,["bpmn:Artifact","bpmn:DataAssociation","bpmn:DataStoreReference"])?ze(t,["bpmn:Collaboration","bpmn:Lane","bpmn:Participant","bpmn:Process","bpmn:SubProcess"]):_(e,"bpmn:MessageFlow")?_(t,"bpmn:Collaboration")||e.source.parent==t||e.target.parent==t:!1}function OP(e){return te(e).cancelActivity&&(Yg(e)||Kg(e))}function qg(e){return!Fe(e)&&_(e,"bpmn:BoundaryEvent")}function DP(e){return _(e,"bpmn:Lane")}function LP(e){return qg(e)||_(e,"bpmn:IntermediateThrowEvent")&&Yg(e)?!0:_(e,"bpmn:IntermediateCatchEvent")&&Kg(e)}function Yg(e){var t=te(e);return t&&!(t.eventDefinitions&&t.eventDefinitions.length)}function Kg(e){return Xg(e,["bpmn:MessageEventDefinition","bpmn:TimerEventDefinition","bpmn:SignalEventDefinition","bpmn:ConditionalEventDefinition"])}function Xg(e,t){return t.some(function(n){return gi(e,n)})}function IP(e){return _(e,"bpmn:ReceiveTask")&&lt(e.incoming,function(t){return _(t.source,"bpmn:EventBasedGateway")})}function ma(e,t,n,i){if(Array.isArray(e)||(e=[e]),e.length!==1)return!1;var r=e[0];return Fe(r)||!LP(r)||un(t)||!_(t,"bpmn:Activity")||sc(t)||i&&!Fg(i,t)||IP(t)?!1:"attach"}function Zg(e,t,n){if(!t)return!1;var i={replacements:[]};return L(e,function(r){un(t)||_(r,"bpmn:StartEvent")&&r.type!=="label"&&So(r,t)&&(VS(r)||i.replacements.push({oldElementId:r.id,newElementType:"bpmn:StartEvent"}),(WS(r)||US(r)||qS(r))&&i.replacements.push({oldElementId:r.id,newElementType:"bpmn:StartEvent"}),Xg(r,["bpmn:MessageEventDefinition","bpmn:TimerEventDefinition","bpmn:SignalEventDefinition","bpmn:ConditionalEventDefinition"])&&_(t,"bpmn:SubProcess")&&i.replacements.push({oldElementId:r.id,newElementType:"bpmn:StartEvent"})),_(t,"bpmn:Transaction")||gi(r,"bpmn:CancelEventDefinition")&&r.type!=="label"&&(_(r,"bpmn:EndEvent")&&So(r,t)&&i.replacements.push({oldElementId:r.id,newElementType:"bpmn:EndEvent"}),_(r,"bpmn:BoundaryEvent")&&ma(r,t,null,n)&&i.replacements.push({oldElementId:r.id,newElementType:"bpmn:BoundaryEvent"}))}),i.replacements.length?i:!1}function Qg(e,t){return Ui(e,DP)?!1:t===void 0?!0:t===null?!1:e.every(function(n){return So(n,t)})}function Cp(e,t,n,i){return t?Fe(e)||Rp(e)?!0:So(e,t)||uc(e,t):!1}function Jg(e,t,n){return _(e,"bpmn:SubProcess")?Ue(e)&&(!t||t.width>=100&&t.height>=80):_(e,"bpmn:Lane")||_(e,"bpmn:Participant")?!0:Sp(e)?n?n==="e"||n==="w":!0:Rp(e)?!0:Fe(e)?n?n==="e"||n==="w":!0:!1}function NP(e,t){var n=Sp(e),i=Sp(t);return(n||i)&&n!==i}function ey(e,t){return Ug(t,e)||Ug(e,t)?!1:NP(e,t)?!0:!!Pp(e,t)}function ty(e,t){return Vg(e,t)&&zg(e)&&_(t,"bpmn:Activity")&&!$P(t,e)&&!un(t)}function ny(e,t){return ay(e)&&!ay(t)?!1:CP(e)&&PP(t)&&!RP(e,t)}function iy(e,t){return AP(e)&&TP(t)&&Vg(e,t)&&!(_(e,"bpmn:EventBasedGateway")&&!MP(t))}function Pp(e,t){return ze(e,["bpmn:DataObjectReference","bpmn:DataStoreReference"])&&ze(t,["bpmn:Activity","bpmn:ThrowEvent"])?{type:"bpmn:DataInputAssociation"}:ze(t,["bpmn:DataObjectReference","bpmn:DataStoreReference"])&&ze(e,["bpmn:Activity","bpmn:CatchEvent"])?{type:"bpmn:DataOutputAssociation"}:!1}function uc(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:ze(t,["bpmn:SequenceFlow","bpmn:MessageFlow"])&&!Fe(t)&&_(e,"bpmn:FlowNode")&&!_(e,"bpmn:BoundaryEvent")&&So(e,t.parent)}function Ap(e,t){return e&&t&&e.indexOf(t)!==-1}function ry(e,t){return Fe(t)?!0:!(_(t,"bpmn:Lane")&&!Ap(e,t.parent)||_(t,"bpmn:MessageFlow")&&!BP(e,t))}function BP(e,t){var n=oy(t.source),i=oy(t.target);return Ap(e,n)&&Ap(e,i)}function oy(e){for(;e;e=e.parent)if(_(e,"bpmn:Participant"))return e;return null}function ay(e){return yo(e,"bpmn:Process")||yo(e,"bpmn:Collaboration")}function $P(e,t){return e.attachers.includes(t)}const jP={__depends__:[mi],__init__:["bpmnRules"],bpmnRules:["type",tn]};var FP=2e3;function sy(e,t){e.on("saveXML.start",FP,n);function n(){var i=t.getRootElements();L(i,function(r){var o=Ye(r),a,s;a=Qo([r]),a=Ge(a,function(c){return c!==r&&!c.labelTarget}),s=on(a,Ye),o.set("planeElement",s)})}}sy.$inject=["eventBus","canvas"];const HP={__init__:["bpmnDiOrdering"],bpmnDiOrdering:["type",sy]};function lc(e){J.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)})}lc.prototype.getOrdering=function(e,t){return null},de(lc,J);function Tp(e,t){lc.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 ze(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&&!ze(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||_(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=ad(s.children,function(p){return!a.labelTarget&&p.labelTarget?!1:c.level<r(p).level});return l!==-1&&u!==-1&&u<l&&(l-=1),{index:l,parent:s}}}Tp.$inject=["eventBus","canvas"],de(Tp,lc);const zP={__init__:["bpmnOrderingProvider"],bpmnOrderingProvider:["type",Tp]};function ga(){}ga.prototype.get=function(){return this._data},ga.prototype.set=function(e){this._data=e},ga.prototype.clear=function(){var e=this._data;return delete this._data,e},ga.prototype.isEmpty=function(){return!this._data};const GP={clipboard:["type",ga]};var cy=1500;function uy(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",cy,function(s){o(s)})}),(function(){var a,s;t.on("element.hover",function(c){a=c.gfx,s=c.element}),t.on("element.hover",cy,function(c){s&&t.fire("element.out",{element:s,gfx:a})}),t.on("element.out",function(){a=null,s=null})})(),this._findTargetGfx=function(a){var s,c;if(a instanceof MouseEvent)return s=Nr(a),c=document.elementFromPoint(s.x,s.y),VP(c)}}uy.$inject=["elementRegistry","eventBus","injector"];function VP(e){return Mr(e,"svg, .djs-element",!0)}const WP={__init__:["hoverFix"],hoverFix:["type",uy]};function UP(e){return!0}function pc(e){return sr(e)||ZC(e)}var ly=500;function py(e,t,n){var i=this;function r(T,N,k){if(!s(T,N)){var O,F,oe;k?F=t.getGraphics(k):(O=N.delegateTarget||N.target,O&&(F=O,k=t.get(F))),!(!F||!k)&&(oe=e.fire(T,{element:k,gfx:F,originalEvent:N}),oe===!1&&(N.stopPropagation(),N.preventDefault()))}}var o={};function a(T){return o[T]}function s(T,N){var k=u[T]||sr;return!k(N)}var c={click:"element.click",contextmenu:"element.contextmenu",dblclick:"element.dblclick",mousedown:"element.mousedown",mousemove:"element.mousemove",mouseover:"element.hover",mouseout:"element.out",mouseup:"element.mouseup"},u={"element.contextmenu":UP,"element.mousedown":pc,"element.mouseup":pc,"element.click":pc,"element.dblclick":pc};function l(T,N,k){var O=c[T];if(!O)throw new Error("unmapped DOM event name <"+T+">");return r(O,N,k)}var p="svg, .djs-element";function f(T,N,k,O){var F=o[k]=function(oe){r(k,oe)};O&&(u[k]=O),F.$delegate=Cn.bind(T,p,N,F)}function d(T,N,k){var O=a(k);O&&Cn.unbind(T,N,O.$delegate)}function g(T){L(c,function(N,k){f(T,k,N)})}function h(T){L(c,function(N,k){d(T,k,N)})}e.on("canvas.destroy",function(T){h(T.svg)}),e.on("canvas.init",function(T){g(T.svg)}),e.on(["shape.added","connection.added"],function(T){var N=T.element,k=T.gfx;e.fire("interactionEvents.createHit",{element:N,gfx:k})}),e.on(["shape.changed","connection.changed"],ly,function(T){var N=T.element,k=T.gfx;e.fire("interactionEvents.updateHit",{element:N,gfx:k})}),e.on("interactionEvents.createHit",ly,function(T){var N=T.element,k=T.gfx;i.createDefaultHit(N,k)}),e.on("interactionEvents.updateHit",function(T){var N=T.element,k=T.gfx;i.updateDefaultHit(N,k)});var m=P("djs-hit djs-hit-stroke"),E=P("djs-hit djs-hit-click-stroke"),y=P("djs-hit djs-hit-all"),x=P("djs-hit djs-hit-no-move"),S={all:y,"click-stroke":E,stroke:m,"no-move":x};function P(T,N){return N=H({stroke:"white",strokeWidth:15},N||{}),n.cls(T,["no-fill","no-border"],N)}function C(T,N){var k=S[N];if(!k)throw new Error("invalid hit type <"+N+">");return he(T,k),T}function D(T,N){Be(T,N)}this.removeHits=function(T){var N=ws(".djs-hit",T);L(N,$t)},this.createDefaultHit=function(T,N){var k=T.waypoints,O=T.isFrame,F;return k?this.createWaypointsHit(N,k):(F=O?"stroke":"all",this.createBoxHit(N,F,{width:T.width,height:T.height}))},this.createWaypointsHit=function(T,N){var k=Zo(N);return C(k,"stroke"),D(T,k),k},this.createBoxHit=function(T,N,k){k=H({x:0,y:0},k);var O=Ce("rect");return C(O,N),he(O,k),D(T,O),O},this.updateDefaultHit=function(T,N){var k=ot(".djs-hit",N);if(k)return T.waypoints?ml(k,T.waypoints):he(k,{width:T.width,height:T.height}),k},this.fire=r,this.triggerMouseEvent=l,this.mouseHandler=a,this.registerEvent=f,this.unregisterEvent=d}py.$inject=["eventBus","elementRegistry","styles"];const fc={__init__:["interactionEvents"],interactionEvents:["type",py]};function Ro(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)})}Ro.$inject=["eventBus","canvas"],Ro.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()})}},Ro.prototype.get=function(){return Array.from(this._selectedElements)},Ro.prototype.isSelected=function(e){return this._selectedElements.has(e)},Ro.prototype.select=function(e,t){var n=this.get();ke(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?L(e,o=>{this._selectedElements.add(o)}):this._selectedElements=new Set(e),this._eventBus.fire("selection.changed",{oldSelection:n,newSelection:this.get()})};var fy="hover",dy="selected";function hy(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,fy)}),t.on("element.out",function(r){i(r.element,fy)}),t.on("selection.changed",function(r){function o(u){i(u,dy)}function a(u){n(u,dy)}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)})}hy.$inject=["canvas","eventBus"];function my(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;ke(u)?t.select(u):t.select(s.filter(qP))}}),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(sr(r)){var o=r.element;o===n.getRootElement()&&(o=null);var a=t.isSelected(o),s=t.get().length>1,c=oc(r);if(a&&s)return c?t.deselect(o):t.select(o);a?t.deselect(o):t.select(o,c)}})}my.$inject=["eventBus","selection","canvas","elementRegistry"];function qP(e){return!e.hidden}const Vn={__init__:["selectionVisuals","selectionBehavior"],__depends__:[fc],selection:["type",Ro],selectionVisuals:["type",hy],selectionBehavior:["type",my]};var YP=/^djs-cursor-.*$/;function dc(e){var t=gt(document.body);t.removeMatching(YP),e&&t.add("djs-cursor-"+e)}function gy(){dc(null)}var KP=5e3;function yy(e,t){t=t||"element.click";function n(){return!1}return e.once(t,KP,n),function(){e.off(t,n)}}var XP=["c","C"],ZP=["v","V"],QP=["d","D"],JP=["x","X"],eA=["y","Y"],vy=["z","Z"];function tA(e){return e.ctrlKey||e.metaKey||e.shiftKey||e.altKey}function Tn(e){return e.altKey?!1:e.ctrlKey||e.metaKey}function jt(e,t){return e=ke(e)?e:[e],e.indexOf(t.key)!==-1||e.indexOf(t.code)!==-1}function Mp(e){return e.shiftKey}function nA(e){return Tn(e)&&jt(XP,e)}function iA(e){return Tn(e)&&jt(ZP,e)}function rA(e){return Tn(e)&&jt(QP,e)}function oA(e){return Tn(e)&&jt(JP,e)}function aA(e){return Tn(e)&&!Mp(e)&&jt(vy,e)}function sA(e){return Tn(e)&&(jt(eA,e)||jt(vy,e)&&Mp(e))}var Co=Math.round,by="djs-drag-active";function $r(e){e.preventDefault()}function cA(e){return typeof TouchEvent<"u"&&e instanceof TouchEvent}function uA(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}function _y(e,t,n,i){var r={threshold:5,trapClick:!0},o;function a(x){var S=t.viewbox(),P=t._container.getBoundingClientRect();return{x:S.x+(x.x-P.left)/S.scale,y:S.y+(x.y-P.top)/S.scale}}function s(x,S){S=S||o;var P=e.createEvent(H({},S.payload,S.data,{isTouch:S.isTouch}));return e.fire("drag."+x,P)===!1?!1:e.fire(S.prefix+"."+x,P)}function c(x){var S=x.filter(function(P){return i.get(P.id)});S.length&&n.select(S)}function u(x,S){var P=o.payload,C=o.displacement,D=o.globalStart,T=Nr(x),N=Jn(T,D),k=o.localStart,O=a(T),F=Jn(O,k);if(!o.active&&(S||uA(N)>o.threshold)){if(H(P,{x:Co(k.x+C.x),y:Co(k.y+C.y),dx:0,dy:0},{originalEvent:x}),s("start")===!1)return m();o.active=!0,o.keepSelection||(P.previousSelection=n.get(),n.select(null)),o.cursor&&dc(o.cursor),t.addMarker(t.getRootElement(),by)}up(x),o.active&&(H(P,{x:Co(O.x+C.x),y:Co(O.y+C.y),dx:Co(F.x),dy:Co(F.y)},{originalEvent:x}),s("move"))}function l(x){var S,P=!0;o.active&&(x&&(o.payload.originalEvent=x,up(x)),P=s("end")),P===!1&&s("rejected"),S=E(P!==!0),s("ended",S)}function p(x){jt("Escape",x)&&($r(x),m())}function f(x){var S;o.active&&(S=yy(e),setTimeout(S,400),$r(x)),l(x)}function d(x){u(x)}function g(x){var S=o.payload;S.hoverGfx=x.gfx,S.hover=x.element,s("hover")}function h(x){s("out");var S=o.payload;S.hoverGfx=null,S.hover=null}function m(x){var S;if(o){var P=o.active;P&&s("cancel"),S=E(x),P&&s("canceled",S)}}function E(x){var S,P;s("cleanup"),gy(),o.trapClick?P=f:P=l,Ne.unbind(document,"mousemove",u),Ne.unbind(document,"dragstart",$r),Ne.unbind(document,"selectstart",$r),Ne.unbind(document,"mousedown",P,!0),Ne.unbind(document,"mouseup",P,!0),Ne.unbind(document,"keyup",p),Ne.unbind(document,"touchstart",d,!0),Ne.unbind(document,"touchcancel",m,!0),Ne.unbind(document,"touchmove",u,!0),Ne.unbind(document,"touchend",l,!0),e.off("element.hover",g),e.off("element.out",h),t.removeMarker(t.getRootElement(),by);var C=o.payload.previousSelection;return x!==!1&&C&&!n.get().length&&c(C),S=o,o=null,S}function y(x,S,P,C){o&&m(!1),typeof S=="string"&&(C=P,P=S,S=null),C=H({},r,C||{});var D=C.data||{},T,N,k,O,F;if(C.trapClick?O=f:O=l,x?(T=Eo(x)||x,N=Nr(x),up(x),T.type==="dragstart"&&$r(T)):(T=null,N={x:0,y:0}),k=a(N),S||(S=k),F=cA(T),o=H({prefix:P,data:D,payload:{},globalStart:N,displacement:Jn(S,k),localStart:k,isTouch:F},C),C.manual||(F?(Ne.bind(document,"touchstart",d,!0),Ne.bind(document,"touchcancel",m,!0),Ne.bind(document,"touchmove",u,!0),Ne.bind(document,"touchend",l,!0)):(Ne.bind(document,"mousemove",u),Ne.bind(document,"dragstart",$r),Ne.bind(document,"selectstart",$r),Ne.bind(document,"mousedown",O,!0),Ne.bind(document,"mouseup",O,!0)),Ne.bind(document,"keyup",p),e.on("element.hover",g),e.on("element.out",h)),s("init")===!1)return m(),!1;C.autoActivate&&u(x,!0)}e.on("diagram.destroy",m),this.init=y,this.move=u,this.hover=g,this.out=h,this.end=l,this.cancel=m,this.context=function(){return o},this.setOptions=function(x){H(r,x)}}_y.$inject=["eventBus","canvas","selection","elementRegistry"];const Ni={__depends__:[WP,Vn],dragging:["type",_y]};function Po(e){this._counter=0,this._prefix=(e?e+"-":"")+Math.floor(Math.random()*1e9)+"-"}Po.prototype.next=function(){return this._prefix+ ++this._counter};const lA=new Po("ps");var pA=["marker-start","marker-mid","marker-end"],fA=["circle","ellipse","line","path","polygon","polyline","path","rect"];function cr(e,t,n,i){this._elementRegistry=e,this._canvas=n,this._styles=i}cr.$inject=["elementRegistry","eventBus","canvas","styles"],cr.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")},cr.prototype.getGfx=function(e){return this._elementRegistry.getGraphics(e)},cr.prototype.addDragger=function(e,t,n,i="djs-dragger"){n=n||this.getGfx(e);var r=Dh(n);return this._cloneMarkers(Dr(r),i),he(r,this._styles.cls(i,[])),Be(t,r),he(r,"data-preview-support-element-id",e.id),r},cr.prototype.addFrame=function(e,t){var n=Ce("rect",{class:"djs-resize-overlay",width:e.width,height:e.height,x:e.x,y:e.y});return Be(t,n),he(n,"data-preview-support-element-id",e.id),n},cr.prototype._cloneMarkers=function(e,t="djs-dragger",n=e){var i=this;e.childNodes&&e.childNodes.forEach(r=>{i._cloneMarkers(r,t,n)}),gA(e)&&pA.forEach(function(r){if(he(e,r)){var o=dA(e,r,i._canvas.getContainer());o&&i._cloneMarker(n,e,o,r,t)}})},cr.prototype._cloneMarker=function(e,t,n,i,r="djs-dragger"){var o=[n.id,r,lA.next()].join("-"),a=ot("marker#"+n.id,e);e=e||this._canvas._svg;var s=a||Dh(n);s.id=o,qe(s).add(r);var c=ot(":scope > defs",e);c||(c=Ce("defs"),Be(e,c)),Be(c,s);var u=mA(s.id);he(t,i,u)};function dA(e,t,n){var i=hA(he(e,t));return ot("marker#"+i,n||document)}function hA(e){return e.match(/url\(['"]?#([^'"]*)['"]?\)/)[1]}function mA(e){return"url(#"+e+")"}function gA(e){return fA.indexOf(e.nodeName)!==-1}const Ao={__init__:["previewSupport"],previewSupport:["type",cr]};var yA="drop-ok",xy="drop-not-ok",wy="attach-ok",Ey="new-parent",Sy="create",vA=2e3;function Ry(e,t,n,i,r){function o(c,u,l,p,f){if(!u)return!1;c=Ge(c,function(y){var x=y.labelTarget;return!y.parent&&!(Fe(y)&&c.indexOf(x)!==-1)});var d=lt(c,function(y){return!st(y)}),g=!1,h=!1,m=!1;Py(c)&&(g=r.allowed("shape.attach",{position:l,shape:d,target:u})),g||(Py(c)?m=r.allowed("shape.create",{position:l,shape:d,source:p,target:u}):m=r.allowed("elements.create",{elements:c,position:l,target:u}));var E=f.connectionTarget;return m||g?(d&&p&&(h=r.allowed("connection.create",{source:E===p?d:p,target:E===p?p:d,hints:{targetParent:u,targetAttach:g}})),{attach:g,connect:h}):m===null||g===null?null:!1}function a(c,u){[wy,yA,xy,Ey].forEach(function(l){l===u?e.addMarker(c,l):e.removeMarker(c,l)})}n.on(["create.move","create.hover"],function(c){var u=c.context,l=u.elements,p=c.hover,f=u.source,d=u.hints||{};if(!p){u.canExecute=!1,u.target=null;return}Cy(c);var g={x:c.x,y:c.y},h=u.canExecute=p&&o(l,p,g,f,d);p&&h!==null&&(u.target=p,h&&h.attach?a(p,wy):a(p,h?Ey:xy))}),n.on(["create.end","create.out","create.cleanup"],function(c){var u=c.hover;u&&a(u,null)}),n.on("create.end",function(c){var u=c.context,l=u.source,p=u.shape,f=u.elements,d=u.target,g=u.canExecute,h=g&&g.attach,m=g&&g.connect,E=u.hints||{};if(g===!1||!d)return!1;Cy(c);var y={x:c.x,y:c.y};m?p=i.appendShape(l,p,y,d,{attach:h,connection:m===!0?{}:m,connectionTarget:E.connectionTarget}):(f=i.createElements(f,y,d,H({},E,{attach:h})),p=lt(f,function(x){return!st(x)})),H(u,{elements:f,shape:p}),H(c,{elements:f,shape:p})});function s(){var c=t.context();c&&c.prefix===Sy&&t.cancel()}n.on("create.init",function(){n.on("elements.changed",s),n.once(["create.cancel","create.end"],vA,function(){n.off("elements.changed",s)})}),this.start=function(c,u,l){ke(u)||(u=[u]);var p=lt(u,function(g){return!st(g)});if(p){l=H({elements:u,hints:{},shape:p},l||{}),L(u,function(g){Le(g.x)||(g.x=0),Le(g.y)||(g.y=0)});var f=Ge(u,function(g){return!g.hidden}),d=Tt(f);L(u,function(g){st(g)&&(g.waypoints=on(g.waypoints,function(h){return{x:h.x-d.x-d.width/2,y:h.y-d.y-d.height/2}})),H(g,{x:g.x-d.x-d.width/2,y:g.y-d.y-d.height/2})}),t.init(c,Sy,{cursor:"grabbing",autoActivate:!0,data:{shape:p,elements:u,context:l}})}}}Ry.$inject=["canvas","dragging","eventBus","modeling","rules"];function Cy(e){var t=e.context,n=t.createConstraints;n&&(n.left&&(e.x=Math.max(e.x,n.left)),n.right&&(e.x=Math.min(e.x,n.right)),n.top&&(e.y=Math.max(e.y,n.top)),n.bottom&&(e.y=Math.min(e.y,n.bottom)))}function Py(e){return e&&e.length===1&&!st(e[0])}var bA=750;function Ay(e,t,n,i,r){function o(a){var s=Ce("g");he(s,r.cls("djs-drag-group",["no-events"]));var c=Ce("g");return a.forEach(function(u){var l;u.hidden||(u.waypoints?(l=n._createContainer("connection",c),n.drawConnection(Dr(l),u)):(l=n._createContainer("shape",c),n.drawShape(Dr(l),u),en(l,u.x,u.y)),i.addDragger(u,s,l))}),s}t.on("create.move",bA,function(a){var s=a.hover,c=a.context,u=c.elements,l=c.dragGroup;l||(l=c.dragGroup=o(u));var p;s?(l.parentNode||(p=e.getActiveLayer(),Be(p,l)),en(l,a.x,a.y)):$t(l)}),t.on("create.cleanup",function(a){var s=a.context,c=s.dragGroup;c&&$t(c)})}Ay.$inject=["canvas","eventBus","graphicsFactory","previewSupport","styles"];const hc={__depends__:[Ni,Ao,mi,Vn],__init__:["create","createPreview"],create:["type",Ry],createPreview:["type",Ay]};function kp(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)})}kp.$inject=["eventBus"],kp.prototype.getLastMoveEvent=function(){return this._lastMoveEvent||_A(0,0)};function _A(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 ya={__init__:["mouse"],mouse:["type",kp]};var Ty=2e3;function Mn(e,t,n,i,r,o,a,s){this._canvas=e,this._create=t,this._elementFactory=i,this._eventBus=r,this._modeling=o,this._mouse=a,this._rules=s,r.on("copyPaste.copyElement",function(c){var u=c.descriptor,l=c.element,p=c.elementsSet;u.priority=1,u.id=l.id,p.has(l.parent)&&(u.parent=l.parent.id),xA(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=wA(l)),Fe(l)&&(u.priority=4,u.labelTarget=l.labelTarget.id),L(["x","y","width","height"],function(f){Le(l[f])&&(u[f]=l[f])}),u.hidden=l.hidden,u.collapsed=l.collapsed}),r.on("copyPaste.elementsCopied",Ty,function(c){var u;((u=c.hints)==null?void 0:u.clip)!==!1&&n.set(c.tree)}),r.on("copyPaste.pasteElements",Ty,function(c){c.tree||(c.tree=n.get())}),r.on("copyPaste.pasteElements",function(c){var u=c.hints;H(u,{createElementsBehavior:!1})})}Mn.$inject=["canvas","create","clipboard","elementFactory","eventBus","modeling","mouse","rules"],Mn.prototype.copy=function(e,t={}){var n,i;return ke(e)||(e=e?[e]:[]),n=this._eventBus.fire("copyPaste.canCopyElements",{elements:e}),n===!1?i={}:i=this.createTree(ke(n)?n:e),this._eventBus.fire("copyPaste.elementsCopied",{elements:e,tree:i,hints:t}),i},Mn.prototype.paste=function(e={}){var t=this._eventBus.createEvent({type:"copyPaste.pasteElements",hints:{},...e}),n=this._eventBus.fire(t);if(n!==!1){var i=t.tree;if(i){var r=t.hints,o=this._createElements(i);if(t.element&&t.point)return this._paste(o,t.element,t.point,r);this._create.start(this._mouse.getLastMoveEvent(),o,{hints:r})}}},Mn.prototype.duplicate=function(e,t={}){var n=this.copy(e,{clip:!1});return this.paste({...t,tree:n})},Mn.prototype.cut=function(e){var t=this.copy(e),n=this._getElementIdsFromTree(t),i=e.filter(function(r){return n[r.id]});return i.length>0&&this._modeling.removeElements(i),t},Mn.prototype._getElementIdsFromTree=function(e){var t={};return L(e,function(n){L(n,function(i){i.id&&(t[i.id]=!0)})}),t},Mn.prototype._paste=function(e,t,n,i){L(e,function(o){Le(o.x)||(o.x=0),Le(o.y)||(o.y=0)});var r=Tt(e);return L(e,function(o){st(o)&&(o.waypoints=on(o.waypoints,function(a){return{x:a.x-r.x-r.width/2,y:a.y-r.y-r.height/2}})),H(o,{x:o.x-r.x-r.width/2,y:o.y-r.y-r.height/2})}),this._modeling.createElements(e,n,t,H({},i))},Mn.prototype._createElements=function(e){var t=this,n=this._eventBus,i={},r=[];return L(e,function(o,a){o=ii(o,"priority"),L(o,function(s){var c=H({},ri(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(Fe(c)){c.labelTarget=i[c.labelTarget],u=i[s.id]=t.createLabel(c),r.push(u);return}c.host&&(c.host=i[c.host]),u=i[s.id]=t.createShape(c),r.push(u)})}),r},Mn.prototype.createConnection=function(e){var t=this._elementFactory.createConnection(ri(e,["id"]));return t},Mn.prototype.createLabel=function(e){var t=this._elementFactory.createLabel(ri(e,["id"]));return t},Mn.prototype.createShape=function(e){var t=this._elementFactory.createShape(ri(e,["id"]));return t},Mn.prototype.hasRelations=function(e,t,n){return n||(n=new Set(t)),!(st(e)&&(!n.has(e.source)||!n.has(e.target))||Fe(e)&&!n.has(e.labelTarget))},Mn.prototype.createTree=function(e){var t=this._rules,n=this,i={},r=[],o=new Map,a=Cs(e);function s(p,f){return t.allowed("element.copy",{element:p,elements:f})}function c(p,f){var d=o.get(p);if(!d){var g={element:p,depth:f};r.push(g),o.set(p,g);return}if(d.depth<f){r=u(d,r);var h={element:d.element,depth:f};r.push(h),o.set(p,h)}}function u(p,f){var d=f.indexOf(p);return d!==-1&&f.splice(d,1),f}Or(a,function(p,f,d){if(Fe(p))return;L(p.labels,function(m){c(m,d)});function g(m){m&&m.length&&L(m,function(E){L(E.labels,function(y){c(y,d)}),c(E,d)})}L([p.attachers,p.incoming,p.outgoing],g),c(p,d);var h=[];return p.children&&(h=p.children.slice()),n._eventBus.fire("copyPaste.createTree",{element:p,children:h}),h}),e=on(r,function(p){return p.element});var l=new Set(e);return r=on(r,function(p){return p.descriptor={},n._eventBus.fire("copyPaste.copyElement",{descriptor:p.descriptor,element:p.element,elements:e,elementsSet:l}),p}),r=ii(r,function(p){return p.descriptor.priority}),e=on(r,function(p){return p.element}),L(r,function(p){var f=p.depth;if(!n.hasRelations(p.element,e,l)){ky(p.element,e),l.delete(p.element);return}if(!s(p.element,e)){ky(p.element,e),l.delete(p.element);return}i[f]||(i[f]=[]),i[f].push(p.descriptor)}),i};function xA(e){return!!e.host}function wA(e){return on(e.waypoints,function(t){return t=My(t),t.original&&(t.original=My(t.original)),t})}function My(e){return H({},e)}function ky(e,t){var n=t.indexOf(e);return n===-1?t:t.splice(n,1)}const EA={__depends__:[GP,hc,ya,mi],__init__:["copyPaste"],copyPaste:["type",Mn]};function Op(e,t,n){ke(n)||(n=[n]),L(n,function(i){Sr(e[i])||(t[i]=e[i])})}var Dp=750;function Oy(e,t,n){function i(c,u){var l=e.create(c.$type);return n.copyElement(c,l,null,u)}t.on("copyPaste.copyElement",Dp,function(c){var u=c.descriptor,l=c.element,p=te(l);if(Fe(l))return u;var f=u.businessObject=i(p,!0),d=u.di=i(Ye(l),!0);d.bpmnElement=f,Op(f,u,"name"),Op(d,u,"isExpanded"),p.default&&(u.default=p.default.id)});var r="-bpmn-js-refs";function o(c){return c[r]=c[r]||{}}function a(c,u){c[r]=u}function s(c,u,l){var p=te(c);return c.default&&(l[c.default]={element:p,property:"default"}),c.host&&(te(c).attachedToRef=te(u[c.host])),ri(l,En(l,function(f,d,g){var h=d.element,m=d.property;return g===c.id&&(h.set(m,p),f.push(c.id)),f},[]))}t.on("copyPaste.pasteElement",function(c){var u=c.cache,l=c.descriptor,p=l.businessObject,f=l.di;if(Fe(l)){l.businessObject=te(u[l.labelTarget]),l.di=Ye(u[l.labelTarget]);return}p=l.businessObject=i(p),f=l.di=i(f),f.bpmnElement=p,Op(l,p,["isExpanded","name"]),l.type=p.$type}),t.on("copyPaste.copyElement",Dp,function(c){var u=c.descriptor,l=c.element;if(_(l,"bpmn:Participant")){var p=te(l);p.processRef&&(u.processRef=i(p.processRef,!0))}}),t.on("copyPaste.pasteElement",function(c){var u=c.descriptor,l=u.processRef;l&&(u.processRef=i(l))}),t.on("copyPaste.createTree",function(c){var u=c.element,l=c.children;_(u,"bpmn:SubProcess")&&L(ra(l),p=>{l.push(p.annotation)})}),t.on("copyPaste.pasteElement",Dp,function(c){var u=c.cache,l=c.descriptor;a(u,s(l,u,o(u)))})}Oy.$inject=["bpmnFactory","eventBus","moddleCopy"];const SA=["artifacts","dataInputAssociations","dataOutputAssociations","default","flowElements","lanes","incoming","outgoing","categoryValue"],RA=["errorRef","escalationRef","messageRef","signalRef","dataObjectRef"];function va(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 ii(r,o=>o==="extensionElements")}),e.on("moddleCopy.canCopyProperty",i=>{const{parent:r,property:o,propertyName:a}=i,s=Vt(r)&&r.$descriptor;if(a&&RA.includes(a))return o;if(a&&SA.includes(a)||a&&s&&!lt(s.properties,to({name:a})))return!1}),e.on("moddleCopy.canSetCopiedProperty",i=>{const{property:r}=i;if(_(r,"bpmn:ExtensionElements")&&(!r.values||!r.values.length))return!1})}va.$inject=["eventBus","bpmnFactory","moddle"],va.prototype.copyElement=function(e,t,n,i=!1){n&&!ke(n)&&(n=[n]),n=n||Lp(e.$descriptor);const r=this._eventBus.fire("moddleCopy.canCopyProperties",{propertyNames:n,sourceElement:e,targetElement:t,clone:i});return r===!1||(ke(r)&&(n=r),L(n,o=>{let a;wn(e,o)&&(a=e.get(o));const s=this.copyProperty(a,t,o,i);!Nt(s)||this._eventBus.fire("moddleCopy.canSetCopiedProperty",{parent:t,property:s,propertyName:o})===!1||t.set(o,s)})),t},va.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 Vt(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):ke(e)?En(e,(a,s)=>{const c=this.copyProperty(s,t,n,i);return c?a.concat(c):a},[]):Vt(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},va.prototype._copyId=function(e,t,n=!1){if(n)return e;if(!this._moddle.ids.assigned(e))return this._moddle.ids.claim(e,t),e};function Lp(e,t){return En(e.properties,(n,i)=>t&&i.default?n:n.concat(i.name),[])}const Dy={__depends__:[EA],__init__:["bpmnCopyPaste","moddleCopy"],bpmnCopyPaste:["type",Oy],moddleCopy:["type",va]};var Ly=Math.round;function Ip(e,t){this._modeling=e,this._eventBus=t}Ip.$inject=["modeling","eventBus"],Ip.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=Ly(s+o/2),l=Ly(c+a/2),p=i.replaceShape(e,H({},t,{x:u,y:l,width:o,height:a}),n);return r.fire("replace.end",{element:e,newElement:p,hints:n}),p};function Iy(e,t){t.on("replace.end",500,function(n){const{newElement:i,hints:r={}}=n;r.select!==!1&&e.select(i)})}Iy.$inject=["selection","eventBus"];const CA={__init__:["replace","replaceSelectionBehavior"],replaceSelectionBehavior:["type",Iy],replace:["type",Ip]};function PA(e,t,n){ke(n)||(n=[n]),L(n,function(i){Sr(e[i])||(t[i]=e[i])})}var AA=["cancelActivity","instantiate","eventGatewayType","triggeredByEvent","isInterrupting"];function TA(e,t){var n=e&&wn(e,"collapsed")?e.collapsed:!Ue(e),i;return t&&(wn(t,"collapsed")||wn(t,"isExpanded"))?i=wn(t,"collapsed")?t.collapsed:!t.isExpanded:i=n,n!==i}function Ny(e,t,n,i,r,o){function a(s,c,u){u=u||{};var l=c.type,p=s.businessObject;if(mc(p)&&(l==="bpmn:SubProcess"||l==="bpmn:AdHocSubProcess")&&TA(s,c))return i.toggleCollapse(s),s;var f=e.create(l),d={type:l,businessObject:f};d.di={},l==="bpmn:ExclusiveGateway"&&(d.di.isMarkerVisible=!0),PA(s.di,d.di,["fill","stroke","background-color","border-color","color"]);var g=Lp(p.$descriptor),h=Lp(f.$descriptor,!0),m=MA(g,h);H(f,Qn(c,AA));var E=Ge(m,function(S){return S==="eventDefinitions"?By(s,c.eventDefinitionType):S==="loopCharacteristics"?!un(f):wn(f,S)||S==="processRef"&&c.isExpanded===!1||S==="triggeredByEvent"?!1:S==="isForCompensation"?!un(f):!0});if(f=n.copyElement(p,f,E),c.eventDefinitionType&&(By(f,c.eventDefinitionType)||(d.eventDefinitionType=c.eventDefinitionType,d.eventDefinitionAttrs=c.eventDefinitionAttrs)),_(p,"bpmn:Activity")){if(mc(p))d.isExpanded=Ue(s);else if(c&&wn(c,"isExpanded")){d.isExpanded=c.isExpanded;var y=t.getDefaultSize(f,{isExpanded:d.isExpanded});d.width=y.width,d.height=y.height,d.x=s.x-(d.width-s.width)/2,d.y=s.y-(d.height-s.height)/2}Ue(s)&&!_(p,"bpmn:Task")&&d.isExpanded&&(d.width=s.width,d.height=s.height)}if(mc(p)&&!mc(f)&&(u.moveChildren=!1),_(p,"bpmn:Participant")){c.isExpanded===!0?f.processRef=e.create("bpmn:Process"):u.moveChildren=!1;var x=qt(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:f})||(d.height=t.getDefaultSize(d).height,d.width=t.getDefaultSize(d).width),f.name=p.name,ze(p,["bpmn:ExclusiveGateway","bpmn:InclusiveGateway","bpmn:Activity"])&&ze(f,["bpmn:ExclusiveGateway","bpmn:InclusiveGateway","bpmn:Activity"])&&(f.default=p.default),c.host&&!_(p,"bpmn:BoundaryEvent")&&_(f,"bpmn:BoundaryEvent")&&(d.host=c.host),(d.type==="bpmn:DataStoreReference"||d.type==="bpmn:DataObjectReference")&&(d.x=s.x+(s.width-d.width)/2),r.replaceElement(s,d,{...u,targetElement:c})}this.replaceElement=a}Ny.$inject=["bpmnFactory","elementFactory","moddleCopy","modeling","replace","rules"];function mc(e){return _(e,"bpmn:SubProcess")}function By(e,t){var n=te(e);return t&&n.get("eventDefinitions").some(function(i){return _(i,t)})}function MA(e,t){return e.filter(function(n){return t.includes(n)})}const $y={__depends__:[Dy,CA,Vn],bpmnReplace:["type",Ny]};var kA=250;function jr(e){this._eventBus=e,this._tools=[],this._active=null}jr.$inject=["eventBus"],jr.prototype.registerTool=function(e,t){var n=this._tools;if(!t)throw new Error(`A tool has to be registered with it's "events"`);n.push(e),this.bindEvents(e,t)},jr.prototype.isActive=function(e){return e&&this._active===e},jr.prototype.length=function(e){return this._tools.length},jr.prototype.setActive=function(e){var t=this._eventBus;this._active!==e&&(this._active=e,t.fire("tool-manager.update",{tool:e}))},jr.prototype.bindEvents=function(e,t){var n=this._eventBus,i=[];n.on(t.tool+".init",function(r){var o=r.context;if(!o.reactivate&&this.isActive(e)){this.setActive(null);return}this.setActive(e)},this),L(t,function(r){i.push(r+".ended"),i.push(r+".canceled")}),n.on(i,kA,function(r){this._active&&(OA(r)||this.setActive(null))},this)};function OA(e){var t=e.originalEvent&&e.originalEvent.target;return t&&Mr(t,'.group[data-group="tools"]')}const gc={__depends__:[Ni],__init__:["toolManager"],toolManager:["type",jr]};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 LA(e,t){var n=[],i=new Set(e);L(t,function(o){i.add(o)});var r=new Set;return i.forEach(function(o){var a=o.incoming,s=o.outgoing;L(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 IA(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 Np=Math.abs,NA=Math.round,Bi={x:"width",y:"height"},jy="crosshair",ur={n:"top",w:"left",s:"bottom",e:"right"},BA=1500,yc={n:"s",w:"e",s:"n",e:"w"},vc=20;function Wn(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",BA,function(c){var u=c.context,l=u.initialized;l||(l=u.initialized=s.init(c,u)),l&&Hy(c)}),n.on("spaceTool.end",function(c){var u=c.context,l=u.axis,p=u.direction,f=u.movingShapes,d=u.resizingShapes,g=u.start;if(u.initialized){Hy(c);var h={x:0,y:0};h[l]=NA(c["d"+l]),s.makeSpace(f,d,h,p,g),n.once("spaceTool.ended",function(m){s.activateSelection(m.originalEvent,!0,!0)})}})}Wn.$inject=["canvas","dragging","eventBus","modeling","rules","toolManager","mouse"],Wn.prototype.activateSelection=function(e,t,n){this._dragging.init(e,"spaceTool.selection",{autoActivate:t,cursor:jy,data:{context:{reactivate:n}},trapClick:!1})},Wn.prototype.activateMakeSpace=function(e){this._dragging.init(e,"spaceTool",{autoActivate:!0,cursor:jy,data:{context:{}}})},Wn.prototype.makeSpace=function(e,t,n,i,r){return this._modeling.createSpace(e,t,n,i,r)},Wn.prototype.init=function(e,t){var n=Np(e.dx)>Np(e.dy)?"x":"y",i=e["d"+n],r=e[n]-i;if(Np(i)<5)return!1;i<0&&(i*=-1),ha(e)&&(i*=-1);var o=DA(n,i),a=this._canvas.getRootElement();!oc(e)&&e.hover&&(a=e.hover);var s=[...Qo(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=$A(c,n,o,r,u);return H(t,c,{axis:n,direction:o,spaceToolConstraints:l,start:r}),dc("resize-"+(n==="x"?"ew":"ns")),!0},Wn.prototype.calculateAdjustments=function(e,t,n,i){var r=this._rules,o=[],a=[],s=new Set,c=new Set,u=[],l=[];function p(d){s.has(d)||(s.add(d),o.push(d));var g=d.label;g&&!s.has(g)&&(s.add(g),o.push(g))}function f(d){c.has(d)||(c.add(d),a.push(d))}return L(e,function(d){if(!(!d.parent||Fe(d))){if(st(d)){l.push(d);return}var g=d[t],h=g+d[Bi[t]];if(jA(d)&&(n>0&&Oe(d)[t]>i||n<0&&Oe(d)[t]<i)){u.push(d);return}if(n>0&&g>i||n<0&&h<i){p(d);return}if(g<i&&h>i&&r.allowed("shape.resize",{shape:d})){f(d);return}}}),L(o,function(d){var g=d.attachers;g&&L(g,function(h){p(h)})}),L(u,function(d){var g=d.host;(s.has(g)||c.has(g))&&p(d)}),L(l,function(d){var g=d.source,h=d.target,m=d.label;(s.has(g)||c.has(g))&&(s.has(h)||c.has(h))&&m&&p(m)}),{movingShapes:o,resizingShapes:a}},Wn.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateSelection(e,!!e)},Wn.prototype.isActive=function(){var e=this._dragging.context();return e?/^spaceTool/.test(e.prefix):!1};function Fy(e){return{top:e.top-vc,right:e.right+vc,bottom:e.bottom+vc,left:e.left-vc}}function Hy(e){var t=e.context,n=t.spaceToolConstraints;if(n){var i,r;Le(n.left)&&(i=Math.max(e.x,n.left),e.dx=e.dx+i-e.x,e.x=i),Le(n.right)&&(i=Math.min(e.x,n.right),e.dx=e.dx+i-e.x,e.x=i),Le(n.top)&&(r=Math.max(e.y,n.top),e.dy=e.dy+r-e.y,e.y=r),Le(n.bottom)&&(r=Math.min(e.y,n.bottom),e.dy=e.dy+r-e.y,e.y=r)}}function $A(e,t,n,i,r){var o=e.movingShapes,a=e.resizingShapes;if(a.length){var s={},c,u,l=new Set(o),p=new Set(a);return L(a,function(f){var d=f.attachers,g=f.children,h=Pe(f),m=Ge(g,function(F){return!st(F)&&!Fe(F)&&!l.has(F)&&!p.has(F)}),E=Ge(g,function(F){return!st(F)&&!Fe(F)&&l.has(F)}),y,x,S,P=[],C=[],D,T,N,k;m.length&&(x=Fy(Pe(Tt(m))),y=i-h[ur[n]]+x[ur[n]],n==="n"?s.bottom=u=Le(u)?Math.min(u,y):y:n==="w"?s.right=u=Le(u)?Math.min(u,y):y:n==="s"?s.top=c=Le(c)?Math.max(c,y):y:n==="e"&&(s.left=c=Le(c)?Math.max(c,y):y)),E.length&&(S=Fy(Pe(Tt(E))),y=i-S[ur[yc[n]]]+h[ur[yc[n]]],n==="n"?s.bottom=u=Le(u)?Math.min(u,y):y:n==="w"?s.right=u=Le(u)?Math.min(u,y):y:n==="s"?s.top=c=Le(c)?Math.max(c,y):y:n==="e"&&(s.left=c=Le(c)?Math.max(c,y):y)),d&&d.length&&(d.forEach(function(F){l.has(F)?P.push(F):C.push(F)}),P.length&&(D=Pe(Tt(P.map(Oe))),T=h[ur[yc[n]]]-(D[ur[yc[n]]]-i)),C.length&&(N=Pe(Tt(C.map(Oe))),k=N[ur[n]]-(h[ur[n]]-i)),n==="n"?(y=Math.min(T||1/0,k||1/0),s.bottom=u=Le(u)?Math.min(u,y):y):n==="w"?(y=Math.min(T||1/0,k||1/0),s.right=u=Le(u)?Math.min(u,y):y):n==="s"?(y=Math.max(T||-1/0,k||-1/0),s.top=c=Le(c)?Math.max(c,y):y):n==="e"&&(y=Math.max(T||-1/0,k||-1/0),s.left=c=Le(c)?Math.max(c,y):y));var O=r&&r[f.id];O&&(n==="n"?(y=i+f[Bi[t]]-O[Bi[t]],s.bottom=u=Le(u)?Math.min(u,y):y):n==="w"?(y=i+f[Bi[t]]-O[Bi[t]],s.right=u=Le(u)?Math.min(u,y):y):n==="s"?(y=i-f[Bi[t]]+O[Bi[t]],s.top=c=Le(c)?Math.max(c,y):y):n==="e"&&(y=i-f[Bi[t]]+O[Bi[t]],s.left=c=Le(c)?Math.max(c,y):y))}),s}}function jA(e){return!!e.host}var Bp="djs-dragging",zy="djs-resizing",FA=250,bc=Math.max;function Gy(e,t,n,i,r){function o(a,s){L(a,function(c){r.addDragger(c,s),n.addMarker(c,Bp)})}e.on("spaceTool.selection.start",function(a){var s=n.getLayer("space"),c=a.context,u={x:"M 0,-10000 L 0,10000",y:"M -10000,0 L 10000,0"},l=Ce("g");he(l,i.cls("djs-crosshair-group",["no-events"])),Be(s,l);var p=Ce("path");he(p,"d",u.x),qe(p).add("djs-crosshair"),Be(l,p);var f=Ce("path");he(f,"d",u.y),qe(f).add("djs-crosshair"),Be(l,f),c.crosshairGroup=l}),e.on("spaceTool.selection.move",function(a){var s=a.context.crosshairGroup;en(s,a.x,a.y)}),e.on("spaceTool.selection.cleanup",function(a){var s=a.context,c=s.crosshairGroup;c&&$t(c)}),e.on("spaceTool.move",FA,function(a){var s=a.context,c=s.line,u=s.axis,l=s.movingShapes,p=s.resizingShapes;if(s.initialized){if(!s.dragGroup){var f=n.getLayer("space");c=Ce("path"),he(c,"d","M0,0 L0,0"),qe(c).add("djs-crosshair"),Be(f,c),s.line=c;var d=Ce("g");he(d,i.cls("djs-drag-group",["no-events"])),Be(n.getActiveLayer(),d),o(l,d);var g=new Set(l);L(p,function(C){g.add(C)});var h=new Set,m=s.movingConnections=[];g.forEach(function(C){L(C.outgoing,function(D){h.has(D)||!st(D)||!g.has(D.target)||(h.add(D),m.push(D))})}),o(m,d),s.dragGroup=d}if(!s.frameGroup){var E=Ce("g");he(E,i.cls("djs-frame-group",["no-events"])),Be(n.getActiveLayer(),E);var y=[];L(p,function(C){var D=r.addFrame(C,E),T=D.getBBox();y.push({element:D,initialBounds:T}),n.addMarker(C,zy)}),s.frameGroup=E,s.frames=y}var x={x:"M"+a.x+", -10000 L"+a.x+", 10000",y:"M -10000, "+a.y+" L 10000, "+a.y};he(c,{d:x[u]});var S={x:"y",y:"x"},P={x:a.dx,y:a.dy};P[S[s.axis]]=0,en(s.dragGroup,P.x,P.y),L(s.frames,function(C){var D=C.element,T=C.initialBounds,N,k;s.direction==="e"?he(D,{width:bc(T.width+P.x,5)}):(N=bc(T.width-P.x,5),he(D,{width:N,x:T.x+T.width-N})),s.direction==="s"?he(D,{height:bc(T.height+P.y,5)}):(k=bc(T.height-P.y,5),he(D,{height:k,y:T.y+T.height-k}))})}}),e.on("spaceTool.cleanup",function(a){var s=a.context,c=s.movingShapes,u=s.movingConnections,l=s.resizingShapes,p=s.line,f=s.dragGroup,d=s.frameGroup;L(c,function(g){n.removeMarker(g,Bp)}),L(u,function(g){n.removeMarker(g,Bp)}),f&&($t(p),$t(f)),L(l,function(g){n.removeMarker(g,zy)}),d&&$t(d)})}Gy.$inject=["eventBus","elementRegistry","canvas","styles","previewSupport"];const HA={__init__:["spaceToolPreview"],__depends__:[Ni,mi,gc,Ao,ya],spaceTool:["type",Wn],spaceToolPreview:["type",Gy]};function _c(e,t){e.invoke(Wn,this),this._canvas=t}_c.$inject=["injector","canvas"],de(_c,Wn),_c.prototype.calculateAdjustments=function(e,t,n,i){var r=this._canvas.getRootElement(),o=e[0]===r?null:e[0],a=[];o&&(a=Jr(uo(r.children.filter(u=>_(u,"bpmn:Artifact")),Tt(o))));const s=[...e,...a];var c=Wn.prototype.calculateAdjustments.call(this,s,t,n,i);return c.resizingShapes=c.resizingShapes.filter(function(u){return!(_(u,"bpmn:TextAnnotation")||zA(u)&&(t==="y"&&qt(u)||t==="x"&&!qt(u)))}),c};function zA(e){return _(e,"bpmn:Participant")&&!te(e).processRef}const Vy={__depends__:[HA],spaceTool:["type",_c]};function bt(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)}bt.$inject=["eventBus","injector"],bt.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()},bt.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},bt.prototype.clear=function(e){this._stack.length=0,this._stackIdx=-1,e!==!1&&this._fire("changed",{trigger:"clear"})},bt.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()}},bt.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()}},bt.prototype.register=function(e,t){this._setHandler(e,t)},bt.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)},bt.prototype.canUndo=function(){return!!this._getUndoAction()},bt.prototype.canRedo=function(){return!!this._getRedoAction()},bt.prototype._getRedoAction=function(){return this._stack[this._stackIdx+1]},bt.prototype._getUndoAction=function(){return this._stack[this._stackIdx]},bt.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)})},bt.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},bt.prototype._createId=function(){return this._uid++},bt.prototype._atomicDo=function(e){const t=this._currentExecution;t.atomic=!0;try{e()}finally{t.atomic=!1}},bt.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()},bt.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)},bt.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:sd("id",i.reverse())}),i.length=0,this._fire("changed",{trigger:t}),e.trigger=null)},bt.prototype._markDirty=function(e){const t=this._currentExecution;e&&(e=ke(e)?e:[e],t.dirty=t.dirty.concat(e))},bt.prototype._executedAction=function(e,t){const n=++this._stackIdx;t||this._stack.splice(n,this._stack.length,e)},bt.prototype._revertedAction=function(e){this._stackIdx--},bt.prototype._getHandler=function(e){return this._handlerMap[e]},bt.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 GA={commandStack:["type",bt]};function lr(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 VA=250,Wy=1400;function $p(e,t,n){J.call(this,t);var i=e.get("movePreview",!1);t.on("shape.move.start",Wy,function(r){var o=r.context,a=o.shapes,s=o.validatedShapes;o.shapes=Uy(a),o.validatedShapes=Uy(s)}),i&&t.on("shape.move.start",VA,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",Wy,function(r){var o=r.context,a=o.closure,s=a.enclosedElements,c=[];L(s,function(u){L(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;lr(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=yl(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&&(Pt(s.labels,a,c),a.labelTarget=s)})}de($p,J),$p.$inject=["injector","eventBus","modeling"];function Uy(e){var t=new Set(e);return Ge(e,function(n){return!t.has(n.labelTarget)})}const WA={__init__:["labelSupport"],labelSupport:["type",$p]};var UA=251,qy=1401,Yy="attach-ok";function jp(e,t,n,i,r){J.call(this,t);var o=e.get("movePreview",!1);t.on("shape.move.start",qy,function(a){var s=a.context,c=s.shapes,u=s.validatedShapes;s.shapes=qA(c),s.validatedShapes=YA(u)}),o&&t.on("shape.move.start",UA,function(a){var s=a.context,c=s.shapes,u=Fp(c);L(u,function(l){o.makeDraggable(s,l,!0),L(l.labels,function(p){o.makeDraggable(s,p,!0)})})}),o&&t.on("shape.move.start",function(a){var s=a.context,c=s.shapes;if(c.length===1){var u=c[0],l=u.host;l&&(n.addMarker(l,Yy),t.once(["shape.move.out","shape.move.cleanup"],function(){n.removeMarker(l,Yy)}))}}),this.preExecuted("elements.move",qy,function(a){var s=a.context,c=s.closure,u=s.shapes,l=Fp(u);L(l,function(p){c.add(p,c.topLevel[p.host.id])})}),this.postExecuted("elements.move",function(a){var s=a.context,c=s.shapes,u=s.newHost,l;u&&c.length!==1||(u?l=c:l=Ge(c,function(p){var f=p.host;return KA(p)&&!XA(c,f)}),L(l,function(p){r.updateAttachment(p,u)}))}),this.postExecuted("elements.move",function(a){var s=a.context.shapes;L(s,function(c){L(c.attachers,function(u){L(u.outgoing.slice(),function(l){var p=i.allowed("connection.reconnect",{connection:l,source:l.source,target:l.target});p||r.removeConnection(l)}),L(u.incoming.slice(),function(l){var p=i.allowed("connection.reconnect",{connection:l,source:l.source,target:l.target});p||r.removeConnection(l)})})})}),this.postExecute("shape.create",function(a){var s=a.context,c=s.shape,u=s.host;u&&r.updateAttachment(c,u)}),this.postExecute("shape.replace",function(a){var s=a.context,c=s.oldShape,u=s.newShape;lr(c.attachers,function(l){var p=i.allowed("elements.move",{target:u,shapes:[l]});p==="attach"?r.updateAttachment(l,u):r.removeShape(l)}),u.attachers.length&&L(u.attachers,function(l){var p=fg(l,c,u);r.moveShape(l,p,l.parent)})}),this.postExecute("shape.resize",function(a){var s=a.context,c=s.shape,u=s.oldBounds,l=s.newBounds,p=c.attachers,f=s.hints||{};f.attachSupport!==!1&&L(p,function(d){var g=fg(d,u,l);r.moveShape(d,g,d.parent),L(d.labels,function(h){r.moveShape(h,g,h.parent)})})}),this.preExecute("shape.delete",function(a){var s=a.context.shape;lr(s.attachers,function(c){r.removeShape(c)}),s.host&&r.updateAttachment(s,null)})}de(jp,J),jp.$inject=["injector","eventBus","canvas","rules","modeling"];function Fp(e){return ku(on(e,function(t){return t.attachers||[]}))}function qA(e){var t=Fp(e);return D0("id",e,t)}function YA(e){var t=eo(e,"id");return Ge(e,function(n){for(;n;){if(n.host&&t[n.host.id])return!1;n=n.parent}return!0})}function KA(e){return!!e.host}function XA(e,t){return e.indexOf(t)!==-1}const ZA={__depends__:[mi],__init__:["attachSupport"],attachSupport:["type",jp]};function Ky(e,t,n,i){e.on("element.changed",function(r){var o=r.element;(o.parent||o===t.getRootElement())&&(r.gfx=n.getGraphics(o)),r.gfx&&e.fire(Hh(o)+".changed",r)}),e.on("elements.changed",function(r){var o=r.elements;o.forEach(function(a){e.fire("element.changed",{element:a})}),i.updateContainments(o)}),e.on("shape.changed",function(r){i.update("shape",r.element,r.gfx)}),e.on("connection.changed",function(r){i.update("connection",r.element,r.gfx)})}Ky.$inject=["eventBus","canvas","elementRegistry","graphicsFactory"];const Hp={__init__:["changeSupport"],changeSupport:["type",Ky]};function Un(e){this._model=e}Un.$inject=["moddle"],Un.prototype._needsId=function(e){return ze(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"])},Un.prototype._ensureId=function(e){if(e.id){this._model.ids.claim(e.id,e);return}var t;_(e,"bpmn:Activity")?t="Activity":_(e,"bpmn:Event")?t="Event":_(e,"bpmn:Gateway")?t="Gateway":ze(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))},Un.prototype.create=function(e,t){var n=this._model.create(e,t||{});return this._ensureId(n),n},Un.prototype.createDiLabel=function(){return this.create("bpmndi:BPMNLabel",{bounds:this.createDiBounds()})},Un.prototype.createDiShape=function(e,t){return this.create("bpmndi:BPMNShape",H({bpmnElement:e,bounds:this.createDiBounds()},t))},Un.prototype.createDiBounds=function(e){return this.create("dc:Bounds",e)},Un.prototype.createDiWaypoints=function(e){var t=this;return on(e,function(n){return t.createDiWaypoint(n)})},Un.prototype.createDiWaypoint=function(e){return this.create("dc:Point",Qn(e,["x","y"]))},Un.prototype.createDiEdge=function(e,t){return this.create("bpmndi:BPMNEdge",H({bpmnElement:e,waypoint:this.createDiWaypoints([])},t))},Un.prototype.createDiPlane=function(e,t){return this.create("bpmndi:BPMNPlane",H({bpmnElement:e},t))};function kn(e,t,n){J.call(this,e),this._bpmnFactory=t;var i=this;function r(d){var g=d.context,h=g.hints||{},m;!g.cropped&&h.createElementsBehavior!==!1&&(m=g.connection,m.waypoints=n.getCroppedWaypoints(m),g.cropped=!0)}this.executed(["connection.layout","connection.create"],r),this.reverted(["connection.layout"],function(d){delete d.context.cropped});function o(d){var g=d.context;i.updateParent(g.shape||g.connection,g.oldParent)}function a(d){var g=d.context,h=g.shape||g.connection,m=g.parent||g.newParent;i.updateParent(h,m)}this.executed(["shape.move","shape.create","shape.delete","connection.create","connection.move","connection.delete"],On(o)),this.reverted(["shape.move","shape.create","shape.delete","connection.create","connection.move","connection.delete"],On(a));function s(d){var g=d.context,h=g.oldRoot,m=h.children;L(m,function(E){_(E,"bpmn:BaseElement")&&i.updateParent(E)})}this.executed(["canvas.updateRoot"],s),this.reverted(["canvas.updateRoot"],s);function c(d){var g=d.context.shape;_(g,"bpmn:BaseElement")&&i.updateBounds(g)}this.executed(["shape.move","shape.create","shape.resize"],On(function(d){d.context.shape.type!=="label"&&c(d)})),this.reverted(["shape.move","shape.create","shape.resize"],On(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"],On(u)),this.reverted(["connection.create","connection.move","connection.delete","connection.reconnect"],On(u));function l(d){i.updateConnectionWaypoints(d.context.connection)}this.executed(["connection.layout","connection.move","connection.updateWaypoints"],On(l)),this.reverted(["connection.layout","connection.move","connection.updateWaypoints"],On(l)),this.executed("connection.reconnect",On(function(d){var g=d.context,h=g.connection,m=g.oldSource,E=g.newSource,y=te(h),x=te(m),S=te(E);y.conditionExpression&&!ze(S,["bpmn:Activity","bpmn:ExclusiveGateway","bpmn:InclusiveGateway"])&&(g.oldConditionExpression=y.conditionExpression,delete y.conditionExpression),m!==E&&x.default===y&&(g.oldDefault=x.default,delete x.default)})),this.reverted("connection.reconnect",On(function(d){var g=d.context,h=g.connection,m=g.oldSource,E=g.newSource,y=te(h),x=te(m),S=te(E);g.oldConditionExpression&&(y.conditionExpression=g.oldConditionExpression),g.oldDefault&&(x.default=g.oldDefault,delete S.default)}));function p(d){i.updateAttachment(d.context)}this.executed(["element.updateAttachment"],On(p)),this.reverted(["element.updateAttachment"],On(p)),this.executed("element.updateLabel",On(f)),this.reverted("element.updateLabel",On(f));function f(d){const{element:g}=d.context,h=Bn(g),m=Ye(g),E=m&&m.get("label");ir(g)||ac(g)||(h&&!E?m.set("label",t.create("bpmndi:BPMNLabel")):!h&&E&&m.set("label",void 0))}}de(kn,J),kn.$inject=["eventBus","bpmnFactory","connectionDocking"],kn.prototype.updateAttachment=function(e){var t=e.shape,n=t.businessObject,i=t.host;n.attachedToRef=i&&i.businessObject},kn.prototype.updateParent=function(e,t){if(!Fe(e)&&!(_(e,"bpmn:DataStoreReference")&&e.parent&&_(e.parent,"bpmn:Collaboration"))){var n=e.parent,i=e.businessObject,r=Ye(e),o=n&&n.businessObject,a=Ye(n);_(e,"bpmn:FlowNode")&&this.updateFlowNodeRefs(i,o,t&&t.businessObject),_(e,"bpmn:DataOutputAssociation")&&(e.source?o=e.source.businessObject:o=null),_(e,"bpmn:DataInputAssociation")&&(e.target?o=e.target.businessObject:o=null),this.updateSemanticParent(i,o),_(e,"bpmn:DataObjectReference")&&i.dataObjectRef&&this.updateSemanticParent(i.dataObjectRef,o),this.updateDiParent(r,a)}},kn.prototype.updateBounds=function(e){var t=Ye(e),n=JA(e);if(n){var i=Jn(n,t.get("bounds"));H(n,{x:e.x+i.x,y:e.y+i.y})}var r=Fe(e)?this._getLabel(t):t,o=r.bounds;o||(o=this._bpmnFactory.createDiBounds(),r.set("bounds",o)),H(o,{x:e.x,y:e.y,width:e.width,height:e.height})},kn.prototype.updateFlowNodeRefs=function(e,t,n){if(n!==t){var i,r;_(n,"bpmn:Lane")&&(i=n.get("flowNodeRef"),Rt(i,e)),_(t,"bpmn:Lane")&&(r=t.get("flowNodeRef"),Pt(r,e))}},kn.prototype.updateDiConnection=function(e,t,n){var i=Ye(e),r=Ye(t),o=Ye(n);i.sourceElement&&i.sourceElement.bpmnElement!==te(t)&&(i.sourceElement=t&&r),i.targetElement&&i.targetElement.bpmnElement!==te(n)&&(i.targetElement=n&&o)},kn.prototype.updateDiParent=function(e,t){if(t&&!_(t,"bpmndi:BPMNPlane")&&(t=t.$parent),e.$parent!==t){var n=(t||e.$parent).get("planeElement");t?(n.push(e),e.$parent=t):(Rt(n,e),e.$parent=null)}};function QA(e){for(;e&&!_(e,"bpmn:Definitions");)e=e.$parent;return e}kn.prototype.getLaneSet=function(e){var t,n;return _(e,"bpmn:Lane")?(t=e.childLaneSet,t||(t=this._bpmnFactory.create("bpmn:LaneSet"),e.childLaneSet=t,t.$parent=e),t):(_(e,"bpmn:Participant")&&(e=e.processRef),n=e.get("laneSets"),t=n[0],t||(t=this._bpmnFactory.create("bpmn:LaneSet"),t.$parent=e,n.push(t)),t)},kn.prototype.updateSemanticParent=function(e,t,n){var i;if(e.$parent!==t&&!((_(e,"bpmn:DataInput")||_(e,"bpmn:DataOutput"))&&(_(t,"bpmn:Participant")&&"processRef"in t&&(t=t.processRef),"ioSpecification"in t&&t.ioSpecification===e.$parent))){if(_(e,"bpmn:Lane"))t&&(t=this.getLaneSet(t)),i="lanes";else if(_(e,"bpmn:FlowElement")){if(t){if(_(t,"bpmn:Participant"))t=t.processRef;else if(_(t,"bpmn:Lane"))do t=t.$parent.$parent;while(_(t,"bpmn:Lane"))}i="flowElements"}else if(_(e,"bpmn:Artifact")){for(;t&&!_(t,"bpmn:Process")&&!_(t,"bpmn:SubProcess")&&!_(t,"bpmn:Collaboration");)if(_(t,"bpmn:Participant")){t=t.processRef;break}else t=t.$parent;i="artifacts"}else if(_(e,"bpmn:MessageFlow"))i="messageFlows";else if(_(e,"bpmn:Participant")){i="participants";var r=e.processRef,o;r&&(o=QA(e.$parent||t),e.$parent&&(Rt(o.get("rootElements"),r),r.$parent=null),t&&(Pt(o.get("rootElements"),r),r.$parent=o))}else _(e,"bpmn:DataOutputAssociation")?i="dataOutputAssociations":_(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),Rt(a,e)),t?(a=t.get(i),a.push(e),e.$parent=t):e.$parent=null,n){var s=n.get(i);Rt(a,e),t&&(s||(s=[],t.set(i,s)),s.push(e))}}},kn.prototype.updateConnectionWaypoints=function(e){var t=Ye(e);t.set("waypoint",this._bpmnFactory.createDiWaypoints(e.waypoints))},kn.prototype.updateConnection=function(e){var t=e.connection,n=te(t),i=t.source,r=te(i),o=t.target,a=te(t.target),s;if(_(n,"bpmn:DataAssociation"))_(n,"bpmn:DataInputAssociation")?(n.get("sourceRef")[0]=r,s=e.parent||e.newParent||a,this.updateSemanticParent(n,a,s)):_(n,"bpmn:DataOutputAssociation")&&(s=e.parent||e.newParent||r,this.updateSemanticParent(n,r,s),n.targetRef=a);else{var c=_(n,"bpmn:SequenceFlow");n.sourceRef!==r&&(c&&(Rt(n.sourceRef&&n.sourceRef.get("outgoing"),n),r&&r.get("outgoing")&&r.get("outgoing").push(n)),n.sourceRef=r),n.targetRef!==a&&(c&&(Rt(n.targetRef&&n.targetRef.get("incoming"),n),a&&a.get("incoming")&&a.get("incoming").push(n)),n.targetRef=a)}this.updateConnectionWaypoints(t),this.updateDiConnection(t,i,o)},kn.prototype._getLabel=function(e){return e.label||(e.label=this._bpmnFactory.createDiLabel()),e.label};function On(e){return function(t){var n=t.context,i=n.shape||n.connection||n.element;_(i,"bpmn:BaseElement")&&e(t)}}function JA(e){if(_(e,"bpmn:Activity")){var t=Ye(e);if(t){var n=t.get("label");if(n)return n.get("bounds")}}}function pr(e,t){Oi.call(this),this._bpmnFactory=e,this._moddle=t}de(pr,Oi),pr.$inject=["bpmnFactory","moddle"],pr.prototype._baseCreate=Oi.prototype.create,pr.prototype.create=function(e,t){if(e==="label"){var n=t.di||this._bpmnFactory.createDiLabel();return this._baseCreate(e,H({type:"label",di:n},Lr,t))}return this.createElement(e,t)},pr.prototype.createElement=function(e,t){t=H({},t||{});var n,i=t.businessObject,r=t.di;if(!i){if(!t.type)throw new Error("no shape type specified");i=this._bpmnFactory.create(t.type)}if(!tT(r)){var o=H({},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)}_(i,"bpmn:Group")&&(t=H({isFrame:!0},t)),t=eT(i,t,["processRef","isInterrupting","associationDirection","isForCompensation"]),t.isExpanded&&(t=zp(r,t,"isExpanded")),ze(i,["bpmn:Lane","bpmn:Participant"])&&(t=zp(r,t,"isHorizontal")),_(i,"bpmn:SubProcess")&&(t.collapsed=!Ue(i,r)),_(i,"bpmn:ExclusiveGateway")&&(wn(r,"isMarkerVisible")?r.isMarkerVisible===void 0&&(r.isMarkerVisible=!1):r.isMarkerVisible=!0),Nt(t.triggeredByEvent)&&(i.triggeredByEvent=t.triggeredByEvent,delete t.triggeredByEvent),Nt(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=H({id:i.id},n,t,{businessObject:i,di:r}),this._baseCreate(e,t)},pr.prototype.getDefaultSize=function(e,t){var n=te(e);if(t=t||Ye(e),_(n,"bpmn:SubProcess"))return Ue(n,t)?{width:350,height:200}:{width:100,height:80};if(_(n,"bpmn:Task"))return{width:100,height:80};if(_(n,"bpmn:Gateway"))return{width:50,height:50};if(_(n,"bpmn:Event"))return{width:36,height:36};if(_(n,"bpmn:Participant")){var i=t.isHorizontal===void 0||t.isHorizontal===!0;return Ue(n,t)?i?{width:600,height:250}:{width:250,height:600}:i?{width:400,height:60}:{width:60,height:400}}return _(n,"bpmn:Lane")?{width:400,height:100}:_(n,"bpmn:DataObjectReference")?{width:36,height:50}:_(n,"bpmn:DataStoreReference")?{width:50,height:50}:_(n,"bpmn:TextAnnotation")?{width:100,height:40}:_(n,"bpmn:Group")?{width:300,height:300}:{width:100,height:80}},pr.prototype.createParticipantShape=function(e){return Vt(e)||(e={isExpanded:e}),e=H({type:"bpmn:Participant"},e||{}),e.isExpanded!==!1&&(e.processRef=this._bpmnFactory.create("bpmn:Process")),this.createShape(e)};function eT(e,t,n){return L(n,function(i){t=zp(e,t,i)}),t}function zp(e,t,n){return t[n]===void 0?t:(e[n]=t[n],ri(t,[n]))}function tT(e){return ze(e,["bpmndi:BPMNShape","bpmndi:BPMNEdge","bpmndi:BPMNDiagram","bpmndi:BPMNPlane"])}function xc(e,t){this._modeling=e,this._canvas=t}xc.$inject=["modeling","canvas"],xc.prototype.preExecute=function(e){var t=this._modeling,n=e.elements,i=e.alignment;L(n,function(r){var o={x:0,y:0};Nt(i.left)?o.x=i.left-r.x:Nt(i.right)?o.x=i.right-r.width-r.x:Nt(i.center)?o.x=i.center-Math.round(r.width/2)-r.x:Nt(i.top)?o.y=i.top-r.y:Nt(i.bottom)?o.y=i.bottom-r.height-r.y:Nt(i.middle)&&(o.y=i.middle-Math.round(r.height/2)-r.y),t.moveElements([r],o,r.parent)})},xc.prototype.postExecute=function(e){};function wc(e){this._modeling=e}wc.$inject=["modeling"],wc.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},wc.prototype.postExecute=function(e){var t=e.hints||{};nT(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 nT(e,t){return Ui(e.outgoing,function(n){return n.target===t})}function Ec(e,t){this._canvas=e,this._layouter=t}Ec.$inject=["canvas","layouter"],Ec.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},Ec.prototype.revert=function(e){var t=e.connection;return this._canvas.removeConnection(t),t.source=null,t.target=null,t};var Sc=Math.round;function Gp(e){this._modeling=e}Gp.$inject=["modeling"],Gp.prototype.preExecute=function(e){var t=e.elements,n=e.parent,i=e.parentIndex,r=e.position,o=e.hints,a=this._modeling;L(t,function(p){Le(p.x)||(p.x=0),Le(p.y)||(p.y=0)});var s=Ge(t,function(p){return!p.hidden}),c=Tt(s);L(t,function(p){st(p)&&(p.waypoints=on(p.waypoints,function(f){return{x:Sc(f.x-c.x-c.width/2+r.x),y:Sc(f.y-c.y-c.height/2+r.y)}})),H(p,{x:Sc(p.x-c.x-c.width/2+r.x),y:Sc(p.y-c.y-c.height/2+r.y)})});var u=new Set(Cs(t)),l={};L(t,function(p){if(st(p)){l[p.id]=Le(i)?a.createConnection(l[p.source.id],l[p.target.id],i,p,p.parent||n,o):a.createConnection(l[p.source.id],l[p.target.id],p,p.parent||n,o);return}var f=H({},o);u.has(p)||(f.autoResize=!1),Fe(p)&&(f=ri(f,["attach"])),l[p.id]=Le(i)?a.createShape(p,Qn(p,["x","y","width","height"]),p.parent||n,i,f):a.createShape(p,Qn(p,["x","y","width","height"]),p.parent||n,f)}),e.elements=Jr(l)};var Xy=Math.round;function fr(e){this._canvas=e}fr.$inject=["canvas"],fr.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?H(t,n):H(t,{x:n.x-Xy(t.width/2),y:n.y-Xy(t.height/2)}),this._canvas.addShape(t,i,r),t},fr.prototype.revert=function(e){var t=e.shape;return this._canvas.removeShape(t),t};function ba(e){fr.call(this,e)}de(ba,fr),ba.$inject=["canvas"];var iT=fr.prototype.execute;ba.prototype.execute=function(e){var t=e.shape;return oT(t),t.labelTarget=e.labelTarget,iT.call(this,e)};var rT=fr.prototype.revert;ba.prototype.revert=function(e){return e.shape.labelTarget=null,rT.call(this,e)};function oT(e){["width","height"].forEach(function(t){typeof e[t]>"u"&&(e[t]=0)})}function _a(e,t){this._canvas=e,this._modeling=t}_a.$inject=["canvas","modeling"],_a.prototype.preExecute=function(e){var t=this._modeling,n=e.connection;lr(n.incoming,function(i){t.removeConnection(i,{nested:!0})}),lr(n.outgoing,function(i){t.removeConnection(i,{nested:!0})})},_a.prototype.execute=function(e){var t=e.connection,n=t.parent;return e.parent=n,e.parentIndex=yl(n.children,t),e.source=t.source,e.target=t.target,this._canvas.removeConnection(t),t.source=null,t.target=null,t},_a.prototype.revert=function(e){var t=e.connection,n=e.parent,i=e.parentIndex;return t.source=e.source,t.target=e.target,Pt(n.children,t,i),this._canvas.addConnection(t,n),t};function Vp(e,t){this._modeling=e,this._elementRegistry=t}Vp.$inject=["modeling","elementRegistry"],Vp.prototype.postExecute=function(e){var t=this._modeling,n=this._elementRegistry,i=e.elements;L(i,function(r){n.get(r.id)&&(r.waypoints?t.removeConnection(r):t.removeShape(r))})};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.shape;lr(n.incoming,function(i){t.removeConnection(i,{nested:!0})}),lr(n.outgoing,function(i){t.removeConnection(i,{nested:!0})}),lr(n.children,function(i){st(i)?t.removeConnection(i,{nested:!0}):t.removeShape(i,{nested:!0})})},xa.prototype.execute=function(e){var t=this._canvas,n=e.shape,i=n.parent;return e.oldParent=i,e.oldParentIndex=yl(i.children,n),t.removeShape(n),n},xa.prototype.revert=function(e){var t=this._canvas,n=e.shape,i=e.oldParent,r=e.oldParentIndex;return Pt(i.children,n,r),t.addShape(n,i),n};function Rc(e){this._modeling=e}Rc.$inject=["modeling"];var Zy={x:"y",y:"x"};Rc.prototype.preExecute=function(e){var t=this._modeling,n=e.groups,i=e.axis,r=e.dimension;function o(m,E){m.range.min=Math.min(E[i],m.range.min),m.range.max=Math.max(E[i]+E[r],m.range.max)}function a(m){return m[i]+m[r]/2}function s(m){return m.length-1}function c(m){return m.max-m.min}function u(m,E){var y={y:0};y[i]=m-a(E),y[i]&&(y[Zy[i]]=0,t.moveElements([E],y,E.parent))}var l=n[0],p=s(n),f=n[p],d,g,h=0;L(n,function(m,E){var y,x,S;if(m.elements.length<2){E&&E!==n.length-1&&(o(m,m.elements[0]),h+=c(m.range));return}y=ii(m.elements,i),x=y[0],E===p&&(x=y[s(y)]),S=a(x),m.range=null,L(y,function(P){if(u(S,P),m.range===null){m.range={min:P[i],max:P[i]+P[r]};return}o(m,P)}),E&&E!==n.length-1&&(h+=c(m.range))}),g=Math.abs(f.range.min-l.range.max),d=Math.round((g-h)/(n.length-1)),!(d<n.length-1)&&L(n,function(m,E){var y={},x;m===l||m===f||(x=n[E-1],m.range.max=0,L(m.elements,function(S,P){y[Zy[i]]=0,y[i]=x.range.max-S[i]+d,m.range.min!==S[i]&&(y[i]+=S[i]-m.range.min),y[i]&&t.moveElements([S],y,S.parent),m.range.max=Math.max(S[i]+S[r],P?m.range.max:0)}))})},Rc.prototype.postExecute=function(e){};function Cc(e,t){this._layouter=e,this._canvas=t}Cc.$inject=["layouter","canvas"],Cc.prototype.execute=function(e){var t=e.connection,n=t.waypoints;return H(e,{oldWaypoints:n}),t.waypoints=this._layouter.layoutConnection(t,e.hints),t},Cc.prototype.revert=function(e){var t=e.connection;return t.waypoints=e.oldWaypoints,t};function Wp(){}Wp.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=Rt(o.children,t),Pt(i.children,t,r),t.parent=i,L(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},Wp.prototype.revert=function(e){var t=e.connection,n=t.parent,i=e.oldParent,r=e.oldParentIndex,o=e.delta;return Rt(n.children,t),Pt(i.children,t,r),t.parent=i,L(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 Up(){this.allShapes={},this.allConnections={},this.enclosedElements={},this.enclosedConnections={},this.topLevel={}}Up.prototype.add=function(e,t){return this.addAll([e],t)},Up.prototype.addAll=function(e,t){var n=I1(e,!!t,this);return H(this,n),this};function wa(e){this._modeling=e}wa.prototype.moveRecursive=function(e,t,n){return e?this.moveClosure(this.getClosure(e),t,n):[]},wa.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),L(a,function(p){o.moveShape(p,t,u[p.id]&&!l&&n,{recurse:!1,layout:!1})}),L(s,function(p){var f=!!a[p.source.id],d=!!a[p.target.id];c[p.id]&&f&&d?o.moveConnection(p,t,u[p.id]&&!l&&n):o.layoutConnection(p,{connectionStart:f&&Jl(p,p.source,t),connectionEnd:d&&ep(p,p.target,t)})})},wa.prototype.getClosure=function(e){return new Up().addAll(e,!0)};function Pc(e){this._helper=new wa(e)}Pc.$inject=["modeling"],Pc.prototype.preExecute=function(e){e.closure=this._helper.getClosure(e.shapes)},Pc.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 Fr(e){this._modeling=e,this._helper=new wa(e)}Fr.$inject=["modeling"],Fr.prototype.execute=function(e){var t=e.shape,n=e.delta,i=e.newParent||t.parent,r=e.newParentIndex,o=t.parent;return e.oldBounds=Qn(t,["x","y","width","height"]),e.oldParent=o,e.oldParentIndex=Rt(o.children,t),Pt(i.children,t,r),H(t,{parent:i,x:t.x+n.x,y:t.y+n.y}),t},Fr.prototype.postExecute=function(e){var t=e.shape,n=e.delta,i=e.hints,r=this._modeling;i.layout!==!1&&(L(t.incoming,function(o){r.layoutConnection(o,{connectionEnd:ep(o,t,n)})}),L(t.outgoing,function(o){r.layoutConnection(o,{connectionStart:Jl(o,t,n)})})),i.recurse!==!1&&this.moveChildren(e)},Fr.prototype.revert=function(e){var t=e.shape,n=e.oldParent,i=e.oldParentIndex,r=e.delta;return Pt(n.children,t,i),H(t,{parent:n,x:t.x-r.x,y:t.y-r.y}),t},Fr.prototype.moveChildren=function(e){var t=e.delta,n=e.shape;this._helper.moveRecursive(n.children,t,null)},Fr.prototype.getNewParent=function(e){return e.newParent||e.shape.parent};function Ea(e){this._modeling=e}Ea.$inject=["modeling"],Ea.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 ke(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},Ea.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||Qy(ke(r)?r[0]:r)),i&&(!n||o.docking==="target")&&(a.connectionEnd=a.connectionEnd||Qy(ke(r)?r[r.length-1]:r)),o.newWaypoints&&(a.waypoints=o.newWaypoints),this._modeling.layoutConnection(t,a))},Ea.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 Qy(e){return e.original||e}function $i(e,t){this._modeling=e,this._rules=t}$i.$inject=["modeling","rules"],$i.prototype.preExecute=function(e){var t=this,n=this._modeling,i=this._rules,r=e.oldShape,o=e.newData,a=e.hints||{},s;function c(g,h,m){return i.allowed("connection.reconnect",{connection:m,source:g,target:h})}var u={x:o.x,y:o.y},l={x:r.x,y:r.y,width:r.width,height:r.height};s=e.newShape=e.newShape||t.createShape(o,u,r.parent,a),r.host&&n.updateAttachment(s,r.host);var p;a.moveChildren!==!1&&(p=r.children.slice(),n.moveElements(p,{x:0,y:0},s,a));var f=r.incoming.slice(),d=r.outgoing.slice();L(f,function(g){var h=g.source,m=c(h,s,g);m&&t.reconnectEnd(g,s,ec(g,s,l),a)}),L(d,function(g){var h=g.target,m=c(s,h,g);m&&t.reconnectStart(g,s,Js(g,s,l),a)})},$i.prototype.postExecute=function(e){var t=e.oldShape;this._modeling.removeShape(t)},$i.prototype.execute=function(e){},$i.prototype.revert=function(e){},$i.prototype.createShape=function(e,t,n,i){return this._modeling.createShape(e,t,n,i)},$i.prototype.reconnectStart=function(e,t,n,i){this._modeling.reconnectStart(e,t,n,i)},$i.prototype.reconnectEnd=function(e,t,n,i){this._modeling.reconnectEnd(e,t,n,i)};function Sa(e){this._modeling=e}Sa.$inject=["modeling"],Sa.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},H(t,{width:n.width,height:n.height,x:n.x,y:n.y}),t},Sa.prototype.postExecute=function(e){var t=this._modeling,n=e.shape,i=e.oldBounds,r=e.hints||{};r.layout!==!1&&(L(n.incoming,function(o){t.layoutConnection(o,{connectionEnd:ec(o,n,i)})}),L(n.outgoing,function(o){t.layoutConnection(o,{connectionStart:Js(o,n,i)})}))},Sa.prototype.revert=function(e){var t=e.shape,n=e.oldBounds;return H(t,{width:n.width,height:n.height,x:n.x,y:n.y}),t};function dr(e){this._modeling=e}dr.$inject=["modeling"],dr.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),L(r,function(s){a[s.id]=sT(s)}),this.resizeShapes(r,t,n),this.updateConnectionWaypoints(LA(i,r),t,n,o,i,r,a)},dr.prototype.execute=function(){},dr.prototype.revert=function(){},dr.prototype.moveShapes=function(e,t){var n=this;L(e,function(i){n._modeling.moveShape(i,t,null,{autoResize:!1,layout:!1,recurse:!1})})},dr.prototype.resizeShapes=function(e,t,n){var i=this;L(e,function(r){var o=IA(r,n,t);i._modeling.resizeShape(r,o,null,{attachSupport:!1,autoResize:!1,layout:!1})})},dr.prototype.updateConnectionWaypoints=function(e,t,n,i,r,o,a){var s=this,c=new Set(r),u=new Set(o);L(e,function(l){var p=l.source,f=l.target,d=aT(l),g=ev(n),h={},m=c.has(p)||u.has(p),E=c.has(f)||u.has(f);m&&E?(d=on(d,function(y){return tv(y,i,n)&&(y[g]=y[g]+t[g]),y.original&&tv(y.original,i,n)&&(y.original[g]=y.original[g]+t[g]),y}),s._modeling.updateWaypoints(l,d,{labelBehavior:!1})):(m||E)&&(c.has(p)?h.connectionStart=Jl(l,p,t):c.has(f)?h.connectionEnd=ep(l,f,t):u.has(p)?h.connectionStart=Js(l,p,a[p.id]):u.has(f)&&(h.connectionEnd=ec(l,f,a[f.id])),s._modeling.layoutConnection(l,h))})};function Jy(e){return H({},e)}function aT(e){return on(e.waypoints,function(t){return t=Jy(t),t.original&&(t.original=Jy(t.original)),t})}function ev(e){switch(e){case"n":return"y";case"w":return"x";case"s":return"y";case"e":return"x"}}function tv(e,t,n){var i=ev(n);if(/e|s/.test(n))return e[i]>t;if(/n|w/.test(n))return e[i]<t}function sT(e){return{x:e.x,y:e.y,height:e.height,width:e.width}}function Ac(e){this._modeling=e}Ac.$inject=["modeling"],Ac.prototype.execute=function(e){var t=e.shape,n=t.children;e.oldChildrenVisibility=nv(n),t.collapsed=!t.collapsed;var i=iv(n,t.collapsed);return[t].concat(i)},Ac.prototype.revert=function(e){var t=e.shape,n=e.oldChildrenVisibility,i=t.children,r=rv(i,n);return t.collapsed=!t.collapsed,[t].concat(r)};function nv(e){var t={};return L(e,function(n){t[n.id]=n.hidden,n.children&&(t=H({},t,nv(n.children)))}),t}function iv(e,t){var n=[];return L(e,function(i){i.hidden=t,n=n.concat(i),i.children&&(n=n.concat(iv(i.children,i.collapsed||t)))}),n}function rv(e,t){var n=[];return L(e,function(i){i.hidden=t[i.id],n=n.concat(i),i.children&&(n=n.concat(rv(i.children,t)))}),n}function Tc(e){this._modeling=e}Tc.$inject=["modeling"],Tc.prototype.execute=function(e){var t=e.shape,n=e.newHost,i=t.host;return e.oldHost=i,e.attacherIdx=ov(i,t),av(n,t),t.host=n,t},Tc.prototype.revert=function(e){var t=e.shape,n=e.newHost,i=e.oldHost,r=e.attacherIdx;return t.host=i,ov(n,t),av(i,t,r),t};function ov(e,t){return Rt(e&&e.attachers,t)}function av(e,t,n){if(e){var i=e.attachers;i||(e.attachers=i=[]),Pt(i,t,n)}}function qp(){}qp.prototype.execute=function(e){var t=e.connection,n=e.newWaypoints;return e.oldWaypoints=t.waypoints,t.waypoints=n,t},qp.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":wc,"shape.create":fr,"shape.delete":xa,"shape.move":Fr,"shape.resize":Sa,"shape.replace":$i,"shape.toggleCollapse":Ac,spaceTool:dr,"label.create":ba,"connection.create":Ec,"connection.delete":_a,"connection.move":Wp,"connection.layout":Cc,"connection.updateWaypoints":qp,"connection.reconnect":Ea,"elements.create":Gp,"elements.move":Pc,"elements.delete":Vp,"elements.distribute":Rc,"elements.align":xc,"element.updateAttachment":Tc}},ct.prototype.registerHandlers=function(e){L(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){ke(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,H(i,{docking:"source"}))},ct.prototype.reconnectEnd=function(e,t,n,i){i||(i={}),this.reconnect(e,e.source,t,n,H(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 _S(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 Ra(e){this._elementRegistry=e}Ra.$inject=["elementRegistry"],Ra.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||cT(n,es(i));return sv(n,i),e.oldProperties=o,e.changed=r,r},Ra.prototype.revert=function(e){var t=e.oldProperties,n=e.moddleElement,i=e.changed;return sv(n,t),i},Ra.prototype._getVisualReferences=function(e){var t=this._elementRegistry;return _(e,"bpmn:DataObject")?uT(e,t):[]};function cT(e,t){return En(t,function(n,i){return n[i]=e.get(i),n},{})}function sv(e,t){L(t,function(n,i){e.set(i,n)})}function uT(e,t){return t.filter(function(n){return _(n,"bpmn:DataObjectReference")&&te(n).dataObjectRef===e})}var Ca="default",ji="id",cv="di",lT={width:0,height:0};function Pa(e,t,n,i){this._elementRegistry=e,this._moddle=t,this._modeling=n,this._textRenderer=i}Pa.$inject=["elementRegistry","moddle","modeling","textRenderer"],Pa.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=mT(e.properties),s=e.oldProperties||pT(t,a);return uv(a,o)&&(r.unclaim(o[ji]),i.updateId(t,a[ji]),r.claim(a[ji],o)),Ca in a&&(a[Ca]&&n.push(i.get(a[Ca].id)),o[Ca]&&n.push(i.get(o[Ca].id))),lv(t,a),e.oldProperties=s,e.changed=n,n},Pa.prototype.postExecute=function(e){var t=e.element,n=t.label,i=n&&te(n).name;if(i){var r=this._textRenderer.getExternalLabelBounds(n,i);this._modeling.resizeShape(n,r,lT)}},Pa.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 lv(t,i),uv(n,r)&&(a.unclaim(n[ji]),o.updateId(t,i[ji]),a.claim(i[ji],r)),e.changed};function uv(e,t){return ji in e&&e[ji]!==t[ji]}function pT(e,t){var n=es(t),i=e.businessObject,r=Ye(e);return En(n,function(o,a){return a!==cv?o[a]=i.get(a):o[a]=fT(r,es(t.di)),o},{})}function fT(e,t){return En(t,function(n,i){return n[i]=e&&e.get(i),n},{})}function lv(e,t){var n=e.businessObject,i=Ye(e);L(t,function(r,o){o!==cv?n.set(o,r):i&&dT(i,r)})}function dT(e,t){L(t,function(n,i){e.set(i,n)})}var hT=["default"];function mT(e){var t=H({},e);return hT.forEach(function(n){n in e&&(t[n]=te(t[n]))}),t}function Mc(e,t){this._canvas=e,this._modeling=t}Mc.$inject=["canvas","modeling"],Mc.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),Pt(a.rootElements,i),i.$parent=a,Rt(a.rootElements,o),o.$parent=null,r.di=null,s.bpmnElement=i,n.di=s,e.oldRoot=r,[]},Mc.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),Rt(a.rootElements,i),i.$parent=null,Pt(a.rootElements,o),o.$parent=a,n.di=null,s.bpmnElement=o,r.di=s,[]};function Yp(e,t){this._modeling=e,this._spaceTool=t}Yp.$inject=["modeling","spaceTool"],Yp.prototype.preExecute=function(e){var t=this._spaceTool,n=this._modeling,i=e.shape,r=e.location,o=zn(i),a=o===i,s=a?i:i.parent,c=or(s),u=qt(i);if(u?r==="left"?r="top":r==="right"&&(r="bottom"):r==="top"?r="left":r==="bottom"&&(r="right"),!c.length){var l=u?{x:i.x+Hn,y:i.y,width:i.width-Hn,height:i.height}:{x:i.x,y:i.y+Hn,width:i.width,height:i.height-Hn};n.createShape({type:"bpmn:Lane",isHorizontal:u},l,s)}var p=[];Or(o,function(S){return p.push(S),S.label&&p.push(S.label),S===i?[]:Ge(S.children,function(P){return P!==i})});var f,d,g,h,m;r==="top"?(f=-120,d=i.y,g=d+10,h="n",m="y"):r==="left"?(f=-120,d=i.x,g=d+10,h="w",m="x"):r==="bottom"?(f=120,d=i.y+i.height,g=d-10,h="s",m="y"):r==="right"&&(f=120,d=i.x+i.width,g=d-10,h="e",m="x");var E=t.calculateAdjustments(p,m,f,g),y=u?{x:0,y:f}:{x:f,y:0};t.makeSpace(E.movingShapes,E.resizingShapes,y,h,g);var x=u?{x:i.x+(a?Hn:0),y:d-(r==="top"?120:0),width:i.width-(a?Hn:0),height:120}:{x:d-(r==="left"?120:0),y:i.y+(a?Hn:0),width:120,height:i.height-(a?Hn:0)};e.newLane=n.createShape({type:"bpmn:Lane",isHorizontal:u},x,s)};function Kp(e){this._modeling=e}Kp.$inject=["modeling"],Kp.prototype.preExecute=function(e){var t=this._modeling,n=e.shape,i=e.count,r=or(n),o=r.length;if(o>i)throw new Error(`more than <${i}> child lanes`);var a=qt(n),s=a?n.height:n.width,c=Math.round(s/i),u,l,p,f;for(f=0;f<i;f++)f===i-1?u=s-c*f:u=c,l=a?{x:n.x+Hn,y:n.y+f*c,width:n.width-Hn,height:u}:{x:n.x+f*c,y:n.y+Hn,width:u,height:n.height-Hn},f<o?t.resizeShape(r[f],l):(p={type:"bpmn:Lane",isHorizontal:a},t.createShape(p,l,n))};function Aa(e,t){this._modeling=e,this._spaceTool=t}Aa.$inject=["modeling","spaceTool"],Aa.prototype.preExecute=function(e){var t=e.shape,n=e.newBounds,i=e.balanced;i!==!1?this.resizeBalanced(t,n):this.resizeSpace(t,n)},Aa.prototype.resizeBalanced=function(e,t){var n=this._modeling,i=uC(e,t);n.resizeShape(e,t),i.forEach(function(r){n.resizeShape(r.shape,r.newBounds)})},Aa.prototype.resizeSpace=function(e,t){var n=this._spaceTool,i=Pe(e),r=Pe(t),o=zm(r,i),a=zn(e),s=[],c=[];Or(a,function(g){return s.push(g),(_(g,"bpmn:Lane")||_(g,"bpmn:Participant"))&&c.push(g),g.children});var u,l,p,f,d;(o.bottom||o.top)&&(u=o.bottom||o.top,l=e.y+(o.bottom?e.height:0)+(o.bottom?-10:10),p=o.bottom?"s":"n",f=o.top>0||o.bottom<0?-u:u,d=n.calculateAdjustments(s,"y",f,l),n.makeSpace(d.movingShapes,d.resizingShapes,{x:0,y:u},p)),(o.left||o.right)&&(u=o.right||o.left,l=e.x+(o.right?e.width:0)+(o.right?-10:100),p=o.right?"e":"w",f=o.left>0||o.right<0?-u:u,d=n.calculateAdjustments(c,"x",f,l),n.makeSpace(d.movingShapes,d.resizingShapes,{x:u,y:0},p))};var Ta="flowNodeRef",Xp="lanes";function kc(){}kc.prototype._computeUpdates=function(e,t){var n=[],i=[],r={},o=[];function a(l,p){var f=Pe(p),d={x:l.x+l.width/2,y:l.y+l.height/2};return d.x>f.left&&d.x<f.right&&d.y>f.top&&d.y<f.bottom}function s(l){n.indexOf(l)===-1&&(o.push(l),n.push(l))}function c(l){var p=zn(l);return r[p.id]||(r[p.id]=Ys(p)),r[p.id]}function u(l){if(!l.parent)return[];var p=c(l);return p.filter(function(f){return a(l,f)}).map(function(f){return f.businessObject})}return t.forEach(function(l){var p=zn(l);if(!(!p||n.indexOf(p)!==-1)){var f=p.children.filter(function(d){return _(d,"bpmn:FlowNode")});f.forEach(s),n.push(p)}}),e.forEach(s),o.forEach(function(l){var p=l.businessObject,f=p.get(Xp),d=f.slice(),g=u(l);i.push({flowNode:p,remove:d,add:g})}),t.forEach(function(l){var p=l.businessObject;l.parent||p.get(Ta).forEach(function(f){i.push({flowNode:f,remove:[p],add:[]})})}),i},kc.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(Xp);n.remove.forEach(function(o){Rt(r,o),Rt(o.get(Ta),i)}),n.add.forEach(function(o){Pt(r,o),Pt(o.get(Ta),i)})}),[]},kc.prototype.revert=function(e){var t=e.updates;return t.forEach(function(n){var i=n.flowNode,r=i.get(Xp);n.add.forEach(function(o){Rt(r,o),Rt(o.get(Ta),i)}),n.remove.forEach(function(o){Pt(r,o),Pt(o.get(Ta),i)})}),[]};var Zp="categoryValueRef";function Ma(e,t){this._bpmnFactory=e,this._elementRegistry=t}Ma.$inject=["bpmnFactory","elementRegistry"],Ma.prototype._computeUpdates=function(e,t){var n=this._elementRegistry,i=this._bpmnFactory,r=new Map,o=[],a=new Map;function s(y,x,S){if(x){var P=a.get(y);P||(P={},a.set(y,P)),!(S&&P.present)&&(!S&&P.past||(S?P.present={categoryValue:x,root:Qp(y)}:P.past={categoryValue:x}))}}function c(y){r.set(y,te(y))}function u(){n.filter(function(y){return _(y,"bpmn:FlowElement")&&!Fe(y)&&y.parent}).forEach(c)}function l(y){var x=te(y),S=x.get("categoryValueRef");return S||(S=Bm(i,x),o.push(gT(y,S))),S}function p(y){return y.reduce(function(x,S){var P=Qp(S),C=x.get(P);return C||(C=[],x.set(P,C)),C.push(S),x},new Map)}e=Array.from(e||[]);var f=p(e);t.length&&u(),e.forEach(c),n.filter(function(y){return _(y,"bpmn:Group")&&!Fe(y)&&y.parent}).forEach(function(y){var x=te(y).get("categoryValueRef");if(!x){var S=Qp(y),P=f.get(S)||[],C=uo(P,y),D=Object.keys(C).length>0;D&&(x=l(y))}s(y,x,!0)}),t.forEach(function(y){s(y.groupShape,y.categoryValue,!1)}),o.length&&u();var d=Array.from(r.keys()),g=Array.from(a.values()).reduce(function(y,x){return x.present&&y.add(x.present.categoryValue),x.past&&y.add(x.past.categoryValue),y},new Set),h=new Map,m=p(d);a.forEach(function(y,x){var S=y.present;if(S){var P=m.get(S.root)||[],C=uo(P,x);P.forEach(function(D){if(C[D.id]){var T=h.get(D);T||(T=new Set,h.set(D,T)),T.add(S.categoryValue)}})}});var E=d.reduce(function(y,x){var S=r.get(x),P=S.get(Zp),C=new Set(P),D=h.get(x)||new Set,T=Array.from(D).filter(function(k){return!C.has(k)}),N=P.filter(function(k){return g.has(k)&&!D.has(k)});return(T.length||N.length)&&y.push({businessObject:S,categoryValuesToAdd:T,categoryValuesToRemove:N}),y},[]);return{flowElements:E,groups:o}},Ma.prototype.execute=function(e){var t=e.updates;return t||(t=e.updates=this._computeUpdates(e.affectedFlowElements,e.affectedGroupEntries)),yT(t.groups),bT(t.flowElements),[]},Ma.prototype.revert=function(e){var t=e.updates;return _T(t.flowElements),vT(t.groups),[]};function gT(e,t){return{groupShape:e,categoryValue:t,category:t.$parent}}function yT(e){e.forEach(function(t){te(t.groupShape).categoryValueRef=t.categoryValue,t.categoryValue.$parent=t.category})}function vT(e){e.forEach(function(t){te(t.groupShape).categoryValueRef=null})}function bT(e){e.forEach(function(t){var n=t.businessObject,i=n.get(Zp);t.categoryValuesToRemove.forEach(function(r){Rt(i,r)}),t.categoryValuesToAdd.forEach(function(r){Pt(i,r,!0)})})}function _T(e){e.forEach(function(t){var n=t.businessObject,i=n.get(Zp);t.categoryValuesToAdd.forEach(function(r){Rt(i,r)}),t.categoryValuesToRemove.forEach(function(r){Pt(i,r,!0)})})}function Qp(e){for(;e.parent;)e=e.parent;return e}function Oc(e){this._moddle=e}Oc.$inject=["moddle"],Oc.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),[]},Oc.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 xT={fill:void 0,stroke:void 0};function Jp(e){this._commandStack=e,this._normalizeColor=function(t){if(t){if(xn(t)){var n=wT(t);if(n)return n}throw new Error(`invalid color value: ${t}`)}}}Jp.$inject=["commandStack"],Jp.prototype.postExecute=function(e){var t=e.elements,n=e.colors||xT,i=this,r={};"fill"in n&&H(r,{"background-color":this._normalizeColor(n.fill)}),"stroke"in n&&H(r,{"border-color":this._normalizeColor(n.stroke)}),L(t,function(o){var a=st(o)?Qn(r,["border-color"]):r,s=Ye(o);if(ET(a),Fe(o)){if(!s||!_(s.label,"bpmndi:BPMNLabel"))return;i._commandStack.execute("element.updateModdleProperties",{element:o,moddleElement:s.label,properties:{color:r["border-color"]}})}else{if(!ze(s,["bpmndi:BPMNEdge","bpmndi:BPMNShape"]))return;i._commandStack.execute("element.updateProperties",{element:o,properties:{di:a}})}})};function wT(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 ET(e){"border-color"in e&&(e.stroke=e["border-color"]),"background-color"in e&&(e.fill=e["background-color"])}var ST={width:0,height:0};function pv(e,t,n){function i(c,u){var l=c.label||c,p=c.labelTarget||c;return QS(l,u),[l,p]}function r(c){var u=c.element,l=u.businessObject,p=c.newLabel;if(!Fe(u)&&ir(u)&&!Is(u)&&!fv(p)){var f=7,d=El(u);d={x:d.x,y:d.y+f},e.createLabel(u,d,{id:l.id+"_label",businessObject:l,di:u.di})}}function o(c){return c.oldLabel=Bn(c.element),i(c.element,c.newLabel)}function a(c){return i(c.element,c.oldLabel)}function s(c){var u=c.element,l=u.label||u,p=c.newLabel,f=c.newBounds,d=c.hints||{};if(!(!Fe(l)&&!_(l,"bpmn:TextAnnotation"))){if(Fe(l)&&fv(p)){d.removeShape!==!1&&e.removeShape(l,{unsetLabel:!1});return}var g=Bn(u);typeof f>"u"&&(f=t.getExternalLabelBounds(l,g)),f&&e.resizeShape(l,f,ST)}}this.preExecute=r,this.execute=o,this.revert=a,this.postExecute=s}pv.$inject=["modeling","textRenderer","bpmnFactory"];function fv(e){return!e||!e.trim()}function nn(e,t,n,i){ct.call(this,e,t,n),this._bpmnRules=i}de(nn,ct),nn.$inject=["eventBus","elementFactory","commandStack","bpmnRules"],nn.prototype.getHandlers=function(){var e=ct.prototype.getHandlers.call(this);return e["element.updateModdleProperties"]=Ra,e["element.updateProperties"]=Pa,e["canvas.updateRoot"]=Mc,e["lane.add"]=Yp,e["lane.resize"]=Aa,e["lane.split"]=Kp,e["lane.updateRefs"]=kc,e["group.updateRefs"]=Ma,e["id.updateClaim"]=Oc,e["element.setColor"]=Jp,e["element.updateLabel"]=pv,e},nn.prototype.updateLabel=function(e,t,n,i){this._commandStack.execute("element.updateLabel",{element:e,newLabel:t,newBounds:n,hints:i||{}})},nn.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)},nn.prototype.updateModdleProperties=function(e,t,n){this._commandStack.execute("element.updateModdleProperties",{element:e,moddleElement:t,properties:n})},nn.prototype.updateProperties=function(e,t){this._commandStack.execute("element.updateProperties",{element:e,properties:t})},nn.prototype.resizeLane=function(e,t,n){this._commandStack.execute("lane.resize",{shape:e,newBounds:t,balanced:n})},nn.prototype.addLane=function(e,t){var n={shape:e,location:t};return this._commandStack.execute("lane.add",n),n.newLane},nn.prototype.splitLane=function(e,t){this._commandStack.execute("lane.split",{shape:e,count:t})},nn.prototype.makeCollaboration=function(){var e=this._create("root",{type:"bpmn:Collaboration"}),t={newRoot:e};return this._commandStack.execute("canvas.updateRoot",t),e},nn.prototype.makeProcess=function(){var e=this._create("root",{type:"bpmn:Process"}),t={newRoot:e};return this._commandStack.execute("canvas.updateRoot",t),e},nn.prototype.updateLaneRefs=function(e,t){this._commandStack.execute("lane.updateRefs",{flowNodeShapes:e,laneShapes:t})},nn.prototype.updateCategoryValueRefs=function(e,t){this._commandStack.execute("group.updateRefs",{affectedFlowElements:e,affectedGroupEntries:t})},nn.prototype.claimId=function(e,t){this._commandStack.execute("id.updateClaim",{id:e,element:t,claiming:!0})},nn.prototype.unclaimId=function(e,t){this._commandStack.execute("id.updateClaim",{id:e,element:t})},nn.prototype.setColor=function(e,t){e.length||(e=[e]),this._commandStack.execute("element.setColor",{elements:e,colors:t})};function dv(){}dv.prototype.layoutConnection=function(e,t){return t=t||{},[t.connectionStart||Oe(t.source||e.source),t.connectionEnd||Oe(t.target||e.target)]};var Dc=20,RT=5,Lc=Math.round,hv=20,CT={"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 AT(e,t){return{t:/top/,r:/right/,b:/bottom/,l:/left/,h:/left|right/,v:/top|bottom/}[e].test(t)}function mv(e,t,n){var i=Jt(t,e,RT),r=n.split(":")[0],o=Lc((t.x-e.x)/2+e.x),a=Lc((t.y-e.y)/2+e.y),s,c,u=AT(r,i),l=/h|r|l/.test(r),p=!1,f=!1;return u?(s=l?{x:o,y:e.y}:{x:e.x,y:a},c=l?"h:h":"v:v"):(p=PT(i,r),c=l?"h:v":"v:h",p?l?(f=a===e.y,s={x:e.x+Dc*(/l/.test(r)?-1:1),y:f?a+Dc:a}):(f=o===e.x,s={x:f?o+Dc:o,y:e.y+Dc*(/t/.test(r)?-1:1)}):s={x:o,y:a}),{waypoints:ef(e,s,c).concat(s),directions:c,turnNextDirections:f}}function TT(e,t,n){return mv(e,t,n)}function MT(e,t,n){var i=mv(t,e,gv(n));return{waypoints:i.waypoints.slice().reverse(),directions:gv(i.directions),turnNextDirections:i.turnNextDirections}}function kT(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=ef(e.waypoints[e.waypoints.length-1],t.waypoints[0],r);return{waypoints:o,directions:r}}function gv(e){return e.split(":").reverse().join(":")}function OT(e,t,n){var i=Lc((t.x-e.x)/2+e.x),r=Lc((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 ef(e,t,n){if(n=n||"h:h",!HT(n))throw new Error("unknown directions: <"+n+">: must be specified as <start>:<end> with start/end in { h,v,t,r,b,l }");if(vv(n)){var i=TT(e,t,n),r=MT(e,t,n),o=kT(i,r);return[].concat(i.waypoints,o.waypoints,r.waypoints)}return OT(e,t,n)}function DT(e,t,n){var i=ef(e,t,n);return i.unshift(e),i.push(t),_v(i)}function LT(e,t,n,i,r){var o=r&&r.preferredLayouts||[],a=k0(o,"straight")[0]||"h:h",s=CT[a]||0,c=Jt(e,t,s),u=FT(c,a);n=n||Oe(e),i=i||Oe(t);var l=u.split(":"),p=bv(n,e,l[0],zT(c)),f=bv(i,t,l[1],c);return DT(p,f,u)}function IT(e,t,n,i,r,o){ke(n)&&(r=n,o=i,n=Oe(e),i=Oe(t)),o=H({preferredLayouts:[]},o),r=r||[];var a=o.preferredLayouts,s=a.indexOf("straight")!==-1,c;return c=s&&BT(e,t,n,i,o),c||(c=o.connectionEnd&&jT(t,e,i,r),c)||(c=o.connectionStart&&$T(e,t,n,r),c)?c:!o.connectionStart&&!o.connectionEnd&&r&&r.length?r:LT(e,t,n,i,o)}function NT(e,t,n){return e>=t&&e<=n}function yv(e,t,n){var i={x:"width",y:"height"};return NT(t[e],n[e],n[e]+n[i[e]])}function BT(e,t,n,i,r){var o={},a,s;return s=Jt(e,t),/^(top|bottom|left|right)$/.test(s)?(/top|bottom/.test(s)&&(a="x"),/left|right/.test(s)&&(a="y"),r.preserveDocking==="target"?yv(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:yv(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 $T(e,t,n,i){return tf(e,t,n,i)}function jT(e,t,n,i){var r=i.slice().reverse();return r=tf(e,t,n,r),r?r.reverse():null}function tf(e,t,n,i){function r(l){return l.length<3?!0:l.length>4?!1:!!lt(l,function(p,f){var d=l[f-1];return d&&ea(p,d)<3})}function o(l,p,f){var d=Mi(p,l);switch(d){case"v":return{x:f.x,y:l.y};case"h":return{x:l.x,y:f.y}}return{x:l.x,y:l.y}}function a(l,p,f){var d;for(d=l.length-2;d!==0;d--)if(Gh(l[d],p,hv)||Gh(l[d],f,hv))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=tf(e,t,n,u)),c&&Mi(c)?null:c}function FT(e,t){if(vv(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 HT(e){return e&&/^h|v|t|r|b|l:h|v|t|r|b|l$/.test(e)}function vv(e){return e&&/t|r|b|l/.test(e)}function zT(e){return{top:"bottom",bottom:"top",left:"right",right:"left","top-left":"bottom-right","bottom-right":"top-left","top-right":"bottom-left","bottom-left":"top-right"}[e]}function bv(e,t,n,i){if(n==="h"&&(n=/left/.test(i)?"l":"r"),n==="v"&&(n=/top/.test(i)?"t":"b"),n==="t")return{original:e,x:e.x,y:t.y};if(n==="r")return{original:e,x:t.x+t.width,y:e.y};if(n==="b")return{original:e,x:e.x,y:t.y+t.height};if(n==="l")return{original:e,x:t.x,y:e.y};throw new Error("unexpected dockingDirection: <"+n+">")}function _v(e){return e.reduce(function(t,n,i){var r=t[t.length-1],o=e[i+1];return vl(r,o,n,0)||t.push(n),t},[])}var GT=-10,VT=40,WT={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},UT={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},nf={top:"bottom","top-right":"bottom-left","top-left":"bottom-right",right:"left",bottom:"top","bottom-right":"top-left","bottom-left":"top-right",left:"right"},ka={top:"t",right:"r",bottom:"b",left:"l"};function Ic(e){this._elementRegistry=e}de(Ic,dv),Ic.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=xv(r&&r[0],n)),a||(a=xv(r&&r[r.length-1],i)),(_(e,"bpmn:Association")||_(e,"bpmn:DataAssociation"))&&r&&!wv(n,i))return[].concat([o],r.slice(1,-1),[a]);var l=Dm(n,s)?WT:UT;return _(e,"bpmn:MessageFlow")?c=YT(n,i,l):(_(e,"bpmn:SequenceFlow")||wv(n,i))&&(n===i?c={preferredLayouts:eM(n,e,l)}:_(n,"bpmn:BoundaryEvent")?c={preferredLayouts:tM(n,i,a,l)}:Oa(n)||Oa(i)?c={preferredLayouts:l.subProcess,preserveDocking:XT(n)}:_(n,"bpmn:Gateway")?c={preferredLayouts:l.fromGateway}:_(i,"bpmn:Gateway")?c={preferredLayouts:l.toGateway}:c={preferredLayouts:l.default}),c&&(c=H(c,t),u=_v(IT(n,i,o,a,r,c))),u||[o,a]};function qT(e){var t=e.host;return Jt(Oe(e),t,GT)}function YT(e,t,n){return{preferredLayouts:n.messageFlow,preserveDocking:KT(e,t)}}function KT(e,t){return _(t,"bpmn:Participant")?"source":_(e,"bpmn:Participant")?"target":Oa(t)?"source":Oa(e)||_(t,"bpmn:Event")?"target":_(e,"bpmn:Event")?"source":null}function XT(e){return Oa(e)?"target":"source"}function xv(e,t){return e?e.original||e:Oe(t)}function wv(e,t){return _(t,"bpmn:Activity")&&_(e,"bpmn:BoundaryEvent")&&t.businessObject.isForCompensation}function Oa(e){return _(e,"bpmn:SubProcess")&&Ue(e)}function Hr(e,t){return e===t}function ZT(e,t){return t.indexOf(e)!==-1}function To(e){var t=/right|left/.exec(e);return t&&t[0]}function Mo(e){var t=/top|bottom/.exec(e);return t&&t[0]}function Ev(e,t){return nf[e]===t}function QT(e,t){var n=To(e),i=nf[n];return t.indexOf(i)!==-1}function JT(e,t){var n=Mo(e),i=nf[n];return t.indexOf(i)!==-1}function Sv(e){return e==="right"||e==="left"}function eM(e,t,n){var i=t.waypoints,r=i&&i.length&&Jt(i[0],e);return r==="top"?n.loop.fromTop:r==="right"?n.loop.fromRight:r==="left"?n.loop.fromLeft:n.loop.fromBottom}function tM(e,t,n,i){var r=Oe(e),o=Oe(t),a=qT(e),s,c,u=Hr(e.host,t),l=ZT(a,["top","right","bottom","left"]),p=Jt(o,r,{x:e.width/2+t.width/2,y:e.height/2+t.height/2});return u?nM(a,l,e,t,n,i):(s=iM(a,p,l,i.isHorizontal),c=rM(a,p,l,i.isHorizontal),[s+":"+c])}function nM(e,t,n,i,r,o){var a=t?e:o.isHorizontal?Mo(e):To(e),s=ka[a],c;return t?Sv(e)?c=Rv("y",n,i,r)?"h":o.boundaryLoop.alternateHorizontalSide:c=Rv("x",n,i,r)?"v":o.boundaryLoop.alternateVerticalSide:c=o.boundaryLoop.default,[s+":"+c]}function Rv(e,t,n,i){var r=VT;return!(rf(e,i,n,r)||rf(e,i,{x:n.x+n.width,y:n.y+n.height},r)||rf(e,i,Oe(t),r))}function rf(e,t,n,i){return Math.abs(t[e]-n[e])<i}function iM(e,t,n,i){if(n)return ka[e];var r=Mo(e),o=To(e),a=Mo(t),s=To(t);if(i){if(Hr(r,a)||Ev(o,s))return ka[r]}else if(Hr(o,s)||Ev(r,a))return ka[o];return ka[i?o:r]}function rM(e,t,n,i){if(n)return Sv(e)?QT(e,t)||Hr(e,t)?"h":"v":JT(e,t)||Hr(e,t)?"v":"h";var r=Mo(e),o=To(e),a=Mo(t),s=To(t);return a&&!s?"v":s&&!a?"h":i?Hr(r,a)?"h":"v":Hr(o,s)?"v":"h"}Ic.$inject=["elementRegistry"];function Cv(e){return H({original:e.point.original||e.point},e.actual)}function hr(e,t){this._elementRegistry=e,this._graphicsFactory=t}hr.$inject=["elementRegistry","graphicsFactory"],hr.prototype.getCroppedWaypoints=function(e,t,n){t=t||e.source,n=n||e.target;var i=this.getDockingPoint(e,t,!0),r=this.getDockingPoint(e,n),o=e.waypoints.slice(i.idx+1,r.idx);return o.unshift(Cv(i)),o.push(Cv(r)),o},hr.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}},hr.prototype._getIntersection=function(e,t,n){var i=this._getShapePath(e),r=this._getConnectionPath(t);return ta(i,r,n)},hr.prototype._getConnectionPath=function(e){return this._graphicsFactory.getConnectionPath(e)},hr.prototype._getShapePath=function(e){return this._graphicsFactory.getShapePath(e)},hr.prototype._getGfx=function(e){return this._elementRegistry.getGraphics(e)};const of={__init__:["modeling","bpmnUpdater"],__depends__:[EP,jP,HP,zP,$y,GA,WA,ZA,Vn,Hp,Vy],bpmnFactory:["type",Un],bpmnUpdater:["type",kn],elementFactory:["type",pr],modeling:["type",nn],layouter:["type",Ic],connectionDocking:["type",hr]};var oM=10,Pv=50,aM=250;function af(e,t,n,i){for(var r;r=sM(e,n,t);)n=i(t,n,r);return n}function sf(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 sM(e,t,n){var i={x:t.x-n.width/2,y:t.y-n.height/2,width:n.width,height:n.height},r=uM(e);return lt(r,function(o){if(o===n)return!1;var a=Jt(o,i,oM);return a==="intersect"})}function cM(e,t){t||(t={});function n(g){return g.source===e?1:-1}var i=t.defaultDistance||Pv,r=t.direction||"e",o=t.filter,a=t.getWeight||n,s=t.maxDistance||aM,c=t.reference||"start";o||(o=fM);function u(g,h){return r==="n"?c==="start"?Pe(g).top-Pe(h).bottom:c==="center"?Pe(g).top-Oe(h).y:Pe(g).top-Pe(h).top:r==="w"?c==="start"?Pe(g).left-Pe(h).right:c==="center"?Pe(g).left-Oe(h).x:Pe(g).left-Pe(h).left:r==="s"?c==="start"?Pe(h).top-Pe(g).bottom:c==="center"?Oe(h).y-Pe(g).bottom:Pe(h).bottom-Pe(g).bottom:c==="start"?Pe(h).left-Pe(g).right:c==="center"?Oe(h).x-Pe(g).right:Pe(h).right-Pe(g).right}var l=e.incoming.filter(o).map(function(g){var h=a(g),m=h<0?u(g.source,e):u(e,g.source);return{id:g.source.id,distance:m,weight:h}}),p=e.outgoing.filter(o).map(function(g){var h=a(g),m=h>0?u(e,g.target):u(g.target,e);return{id:g.target.id,distance:m,weight:h}}),f=l.concat(p).reduce(function(g,h){return g[h.id+"__weight_"+h.weight]=h,g},{}),d=En(f,function(g,h){var m=h.distance,E=h.weight;return m<0||m>s||(g[String(m)]||(g[String(m)]=0),g[String(m)]+=1*E,(!g.distance||g[g.distance]<g[String(m)])&&(g.distance=m)),g},{});return d.distance||i}function uM(e){var t=cf(e);return e.host&&(t=t.concat(cf(e.host))),e.attachers&&(t=t.concat(e.attachers.reduce(function(n,i){return n.concat(cf(i))},[]))),t}function cf(e){return pM(e).concat(lM(e))}function lM(e){return e.incoming.map(function(t){return t.source})}function pM(e){return e.outgoing.map(function(t){return t.target})}function fM(){return!0}var dM=100;function Av(e,t,n){e.on("autoPlace",dM,function(i){var r=i.shape,o=i.source;return hM(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}}Av.$inject=["eventBus","modeling","canvas"];function hM(e,t,n){n||(n={});var i=n.defaultDistance||Pv,r=Oe(e),o=Pe(e);return{x:o.right+i+t.width/2,y:r.y}}function Tv(e,t){e.on("autoPlace.end",500,function(n){t.select(n.shape)})}Tv.$inject=["eventBus","selection"];const mM={__init__:["autoPlaceSelectionBehavior"],autoPlace:["type",Av],autoPlaceSelectionBehavior:["type",Tv]};function Mv(e,t,n){var i=Dm(e,n);if(_(t,"bpmn:TextAnnotation"))return yM(e,t,i);if(ze(t,["bpmn:DataObjectReference","bpmn:DataStoreReference"]))return vM(e,t,i);if(_(t,"bpmn:FlowNode"))return gM(e,t,i)}function gM(e,t,n){var i=Pe(e),r=Oe(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=cM(e,{filter:function(d){return _(d,"bpmn:SequenceFlow")},direction:o.directionHint}),s=30,c=o.minDistance,u=o.baseOrientation;_(e,"bpmn:BoundaryEvent")&&(u=Jt(e,e.host,-25),u.indexOf(o.boundaryOrientation)!==-1&&(s*=-1));var l=n?{x:i.right+a+t.width/2,y:r.y+kv(u,c,o)}:{x:r.x+kv(u,c,o),y:i.bottom+a+t.height/2},p={margin:s,minDistance:c},f=n?{y:p}:{x:p};return af(e,t,l,sf(f))}function kv(e,t,n){return e.includes(n.start)?-1*t:e.includes(n.end)?t:0}function yM(e,t,n){var i=Pe(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=Oe(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 af(e,t,r,sf(a))}function vM(e,t,n){var i=Pe(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 af(e,t,r,sf(a))}function Ov(e,t){e.on("autoPlace",function(n){var i=n.shape,r=n.source;return Mv(r,i,t)})}Ov.$inject=["eventBus","elementRegistry"];const Nc={__depends__:[mM],__init__:["bpmnAutoPlace"],bpmnAutoPlace:["type",Ov]},Dv=[km,sa,of,Nc];function bM(e={}){Td(globalThis,e.dom);const t=document.createElement("div");return document.body.appendChild(t),new fo({container:t,moddleExtensions:e.moddleExtensions??ss,additionalModules:[...Dv,...e.additionalModules??[]]})}var _M=new Po("ov"),xM=500;function Kt(e,t,n,i){this._eventBus=t,this._canvas=n,this._elementRegistry=i,this._ids=_M,this._overlayDefaults=H({show:null,scale:!0},e&&e.defaults),this._overlays={},this._overlayContainers=[],this._overlayRoot=wM(n.getContainer()),this._init()}Kt.$inject=["config.overlays","eventBus","canvas","elementRegistry"],Kt.prototype.get=function(e){if(xn(e)&&(e={id:e}),xn(e.element)&&(e.element=this._elementRegistry.get(e.element)),e.element){var t=this._getOverlayContainer(e.element,!0);return t?e.type?Ge(t.overlays,to({type:e.type})):t.overlays.slice():[]}else return e.type?Ge(this._overlays,to({type:e.type})):e.id?this._overlays[e.id]:null},Kt.prototype.add=function(e,t,n){if(Vt(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=H({},this._overlayDefaults,n,{id:i,type:t,element:e,html:n.html}),this._addOverlay(n),i},Kt.prototype.remove=function(e){var t=this.get(e)||[];ke(t)||(t=[t]);var n=this;L(t,function(i){var r=n._getOverlayContainer(i.element,!0);if(i&&(ui(i.html),ui(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)}})},Kt.prototype.isShown=function(){return this._overlayRoot.style.display!=="none"},Kt.prototype.show=function(){Bc(this._overlayRoot)},Kt.prototype.hide=function(){Bc(this._overlayRoot,!1)},Kt.prototype.clear=function(){this._overlays={},this._overlayContainers=[],_s(this._overlayRoot)},Kt.prototype._updateOverlayContainer=function(e){var t=e.element,n=e.html,i=t.x,r=t.y;if(t.waypoints){var o=Tt(t);i=o.x,r=o.y}Lv(n,i,r),sn(e.html,"data-container-id",t.id)},Kt.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=Tt(i).width:a=i.width,r=t.right*-1+a}if(t.bottom!==void 0){var s;i.waypoints?s=Tt(i).height:s=i.height,o=t.bottom*-1+s}Lv(n,r||0,o||0),this._updateOverlayVisibilty(e,this._canvas.viewbox())},Kt.prototype._createOverlayContainer=function(e){var t=ft('<div class="djs-overlays" />');dn(t,{position:"absolute"}),this._overlayRoot.appendChild(t);var n={html:t,element:e,overlays:[]};return this._updateOverlayContainer(n),this._overlayContainers.push(n),n},Kt.prototype._updateRoot=function(e){var t=e.scale||1,n="matrix("+[t,0,0,t,-1*e.x*t,-1*e.y*t].join(",")+")";Iv(this._overlayRoot,n)},Kt.prototype._getOverlayContainer=function(e,t){var n=lt(this._overlayContainers,function(i){return i.element===e});return!n&&!t?this._createOverlayContainer(e):n},Kt.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)),xn(i)&&(i=ft(i)),o=this._getOverlayContainer(n),r=ft('<div class="djs-overlay" data-overlay-id="'+t+'">'),dn(r,{position:"absolute"}),r.appendChild(i),e.type&&gt(r).add("djs-overlay-"+e.type);var a=this._canvas.findRoot(n),s=this._canvas.getRootElement();Bc(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())},Kt.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&&(Nt(r)&&r>t.scale||Nt(o)&&o<t.scale))&&(c=!1),Bc(a,c),this._updateOverlayScale(e,t)},Kt.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),Nt(i)&&t.scale<i&&(a=(1/t.scale||1)*i),Nt(r)&&t.scale>r&&(a=(1/t.scale||1)*r)),Nt(a)&&(s="scale("+a+","+a+")"),Iv(o,s)},Kt.prototype._updateOverlaysVisibilty=function(e){var t=this;L(this._overlays,function(n){t._updateOverlayVisibilty(n,e)})},Kt.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});L(o,function(c){t.remove(c.id)});var a=t._getOverlayContainer(r);if(a){ui(a.html);var s=t._overlayContainers.indexOf(a);s!==-1&&t._overlayContainers.splice(s,1)}}),e.on("element.changed",xM,function(i){var r=i.element,o=t._getOverlayContainer(r,!0);o&&(L(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&&gt(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 wM(e){var t=ft('<div class="djs-overlay-container" />');return dn(t,{position:"absolute",width:0,height:0}),e.insertBefore(t,e.firstChild),t}function Lv(e,t,n){dn(e,{left:t+"px",top:n+"px"})}function Bc(e,t){e.style.display=t===!1?"none":""}function Iv(e,t){e.style["transform-origin"]="top left",["","-ms-","-webkit-"].forEach(function(n){e.style[n+"transform"]=t})}const $c={__init__:["overlays"],overlays:["type",Kt]};function uf(e,t){t.invoke(J,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)})}de(uf,J),uf.$inject=["canvas","injector"];const EM={__init__:["rootElementsBehavior"],rootElementsBehavior:["type",uf]};function Da(e){return CSS.escape(e)}var SM={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"};function Nv(e){return e=""+e,e&&e.replace(/[&<>"']/g,function(t){return SM[t]})}var RM="bjs-breadcrumbs-shown";function Bv(e,t,n){var i=ft('<ul class="bjs-breadcrumbs"></ul>'),r=n.getContainer(),o=gt(r);r.appendChild(i);var a=[];e.on("element.changed",function(c){var u=c.element,l=te(u),p=lt(a,function(f){return f===l});p&&s()});function s(c){c&&(a=CM(c));var u=a.flatMap(function(p){var f=n.findRoot(hi(p))||n.findRoot(p.id);if(!f&&_(p,"bpmn:Process")){var d=t.find(function(m){var E=te(m);return E&&E.get("processRef")===p});f=d&&n.findRoot(d.id)}if(!f)return[];var g=Nv(p.name||p.id),h=ft('<li><span class="bjs-crumb"><a title="'+g+'">'+g+"</a></span></li>");return h.addEventListener("click",function(){n.setRootElement(f)}),h});i.innerHTML="";var l=u.length>1;o.toggle(RM,l),u.forEach(function(p){i.appendChild(p)})}e.on("root.set",function(c){s(c.element)})}Bv.$inject=["eventBus","elementRegistry","canvas"];function CM(e){for(var t=te(e),n=[],i=t;i;i=i.$parent)(_(i,"bpmn:SubProcess")||_(i,"bpmn:Process"))&&n.push(i);return n.reverse()}function $v(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,!(!_(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})}$v.$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 jv={x:180,y:160};function zr(e,t){this._eventBus=e,this._moddle=t;var n=this;e.on("import.render.start",1500,function(i,r){n._handleImport(r.definitions)})}zr.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)})}},zr.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;_(a,"bpmn:SubProcess")&&!o.isExpanded&&n.push(a),TM(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},zr.prototype._movePlaneElementsToOrigin=function(e){var t=e.get("planeElement"),n=AM(e),i={x:n.x-jv.x,y:n.y-jv.y};t.forEach(function(r){r.waypoint?r.waypoint.forEach(function(o){o.x=o.x-i.x,o.y=o.y-i.y}):r.bounds&&(r.bounds.x=r.bounds.x-i.x,r.bounds.y=r.bounds.y-i.y)})},zr.prototype._moveToDiPlane=function(e,t){var n=Fv(e),i=n.plane.get("planeElement");i.splice(i.indexOf(e),1),t.get("planeElement").push(e)},zr.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},zr.$inject=["eventBus","moddle"];function Fv(e){return _(e,"bpmndi:BPMNDiagram")?e:Fv(e.$parent)}function AM(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=Pe(n.bounds);t.top=Math.min(i.top,t.top),t.left=Math.min(i.left,t.left)}}),Ts(t)}function TM(e,t){var n=e.$parent;return!(!_(n,"bpmn:SubProcess")||n===t.bpmnElement||ze(e,["bpmn:DataInputAssociation","bpmn:DataOutputAssociation"]))}var jc=250,MM='<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>',kM="bjs-drilldown-empty";function mr(e,t,n,i,r){J.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",jc,function(a){var s=a.shape;o._canDrillDown(s)?o._addOverlay(s):o._removeOverlay(s)},!0),this.reverted("shape.toggleCollapse",jc,function(a){var s=a.shape;o._canDrillDown(s)?o._addOverlay(s):o._removeOverlay(s)},!0),this.executed(["shape.create","shape.move","shape.delete"],jc,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"],jc,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)})})}de(mr,J),mr.prototype._updateDrilldownOverlay=function(e){var t=this._canvas;if(e){var n=t.findRoot(e);n&&this._updateOverlayVisibility(n)}},mr.prototype._canDrillDown=function(e){var t=this._canvas;return _(e,"bpmn:SubProcess")&&t.findRoot(hi(e))},mr.prototype._updateOverlayVisibility=function(e){var t=this._overlays,n=te(e),i=t.get({element:n.id,type:"drilldown"})[0];if(i){var r=n&&n.get("flowElements")&&n.get("flowElements").length;gt(i.html).toggle(kM,!r)}},mr.prototype._addOverlay=function(e){var t=this._canvas,n=this._overlays,i=te(e),r=n.get({element:e,type:"drilldown"});r.length&&this._removeOverlay(e);var o=ft('<button type="button" class="bjs-drilldown">'+MM+"</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(hi(e)))}),n.add(e,"drilldown",{position:{bottom:-7,right:-8},html:o}),this._updateOverlayVisibility(e)},mr.prototype._removeOverlay=function(e){var t=this._overlays;t.remove({element:e,type:"drilldown"})},mr.$inject=["canvas","eventBus","elementRegistry","overlays","translate"];const OM={__depends__:[$c,Hp,EM],__init__:["drilldownBreadcrumbs","drilldownOverlayBehavior","drilldownCentering","subprocessCompatibility"],drilldownBreadcrumbs:["type",Bv],drilldownCentering:["type",$v],drilldownOverlayBehavior:["type",mr],subprocessCompatibility:["type",zr]};function gr(e){vt.call(this,e)}de(gr,vt),gr.prototype._modules=[km,OM,$c,Vn,sa],gr.prototype._moddleExtensions={};var Fc="keyboard.keydown",DM="keyboard.keyup",LM=1e3,Hv="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 hn(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(Hv));var i=e&&e.bind!==!1;t.on("canvas.init",function(r){n._target=r.svg,i&&n.bind(),n._fire("init")})}hn.$inject=["config.keyboard","eventBus"],hn.prototype._keydownHandler=function(e){this._keyHandler(e,Fc)},hn.prototype._keyupHandler=function(e){this._keyHandler(e,DM)},hn.prototype._keyHandler=function(e,t){var n;if(!this._isEventIgnored(e)){var i={keyEvent:e};n=this._eventBus.fire(t||Fc,i),n&&e.preventDefault()}},hn.prototype._isEventIgnored=function(e){return!1},hn.prototype.bind=function(e){e&&console.error("unsupported argument <node>",new Error(Hv)),this.unbind(),e=this._node=this._target,Ne.bind(e,"keydown",this._keydownHandler),Ne.bind(e,"keyup",this._keyupHandler),this._fire("bind")},hn.prototype.getBinding=function(){return this._node},hn.prototype.unbind=function(){var e=this._node;e&&(this._fire("unbind"),Ne.unbind(e,"keydown",this._keydownHandler),Ne.unbind(e,"keyup",this._keyupHandler)),this._node=null},hn.prototype._fire=function(e){this._eventBus.fire("keyboard."+e,{node:this._node})},hn.prototype.addListener=function(e,t,n){Wt(e)&&(n=t,t=e,e=LM),this._eventBus.on(n||Fc,e,t)},hn.prototype.removeListener=function(e,t){this._eventBus.off(t||Fc,e)},hn.prototype.hasModifier=tA,hn.prototype.isCmd=Tn,hn.prototype.isShift=Mp,hn.prototype.isKey=jt;var IM=500;function ko(e,t){var n=this;e.on("editorActions.init",IM,function(i){var r=i.editorActions;n.registerBindings(t,r)})}ko.$inject=["eventBus","keyboard"],ko.prototype.registerBindings=function(e,t){function n(i,r){t.isRegistered(i)&&e.addListener(r)}n("undo",function(i){var r=i.keyEvent;if(aA(r))return t.trigger("undo"),!0}),n("redo",function(i){var r=i.keyEvent;if(sA(r))return t.trigger("redo"),!0}),n("copy",function(i){var r=i.keyEvent;if(nA(r))return t.trigger("copy"),!0}),n("paste",function(i){var r=i.keyEvent;if(iA(r))return t.trigger("paste"),!0}),n("duplicate",function(i){var r=i.keyEvent;if(rA(r))return t.trigger("duplicate"),!0}),n("cut",function(i){var r=i.keyEvent;if(oA(r))return t.trigger("cut"),!0}),n("stepZoom",function(i){var r=i.keyEvent;if(jt(["+","Add","="],r)&&Tn(r))return t.trigger("stepZoom",{value:1}),!0}),n("stepZoom",function(i){var r=i.keyEvent;if(jt(["-","Subtract"],r)&&Tn(r))return t.trigger("stepZoom",{value:-1}),!0}),n("zoom",function(i){var r=i.keyEvent;if(jt("0",r)&&Tn(r))return t.trigger("zoom",{value:1}),!0}),n("removeSelection",function(i){var r=i.keyEvent;if(jt(["Backspace","Delete","Del"],r))return t.trigger("removeSelection"),!0})};const lf={__init__:["keyboard","keyboardBindings"],keyboard:["type",hn],keyboardBindings:["type",ko]};var NM={moveSpeed:50,moveSpeedAccelerated:200};function zv(e,t,n){var i=this;this._config=H({},NM,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})}}zv.$inject=["config.keyboardMove","keyboard","canvas"];const Gv={__depends__:[lf],__init__:["keyboardMove"],keyboardMove:["type",zv]};var BM=15;function Vv(e,t){var n;function i(s){return a(s.originalEvent)}e.on("canvas.focus.changed",function(s){s.focused?e.on("element.mousedown",500,i):e.off("element.mousedown",i)});function r(s){var c=n.start,u=n.button,l=Nr(s),p=Jn(l,c);if(!n.dragging&&$M(p)>BM&&(n.dragging=!0,u===0&&yy(e),dc("grab")),n.dragging){var f=n.last||n.start;p=Jn(l,f),t.scroll({dx:p.x,dy:p.y}),n.last=l}s.preventDefault()}function o(s){Ne.unbind(document,"mousemove",r),Ne.unbind(document,"mouseup",o),n=null,gy()}function a(s){if(!Mr(s.target,".djs-draggable")){var c=s.button;if(!(c>=2||s.ctrlKey||s.shiftKey||s.altKey))return n={button:c,start:Nr(s)},Ne.bind(document,"mousemove",r),Ne.bind(document,"mouseup",o),!0}}this.isActive=function(){return!!n}}Vv.$inject=["eventBus","canvas"];function $M(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}const Wv={__init__:["moveCanvas"],moveCanvas:["type",Vv]};function Uv(e,t){var n=Pl(e.min),i=Pl(e.max),r=Math.abs(n)+Math.abs(i);return r/t}function jM(e,t){return Math.max(e.min,Math.min(e.max,t))}var FM=Math.sign||function(e){return e>=0?1:-1},pf={min:.2,max:4},qv=10,HM=.1,zM=.75;function yi(e,t,n){e=e||{},this._enabled=!1,this._canvas=n,this._container=n._container,this._handleWheel=mn(this._handleWheel,this),this._totalDelta=0,this._scale=e.scale||zM;var i=this;t.on("canvas.mouseover",function(){i._init(e.enabled!==!1)}),t.on("canvas.mouseout",function(){i._init(!1)})}yi.$inject=["config.zoomScroll","eventBus","canvas"],yi.prototype.scroll=function(t){this._canvas.scroll(t)},yi.prototype.reset=function(){this._canvas.zoom("fit-viewport")},yi.prototype.zoom=function(t,n){var i=Uv(pf,qv*2);this._totalDelta+=t,Math.abs(this._totalDelta)>HM&&(this._zoom(t,n,i),this._totalDelta=0)},yi.prototype._handleWheel=function(t){if(this._enabled){var n=this._container;t.preventDefault();var i=t.ctrlKey||Sg()&&t.metaKey,r=t.shiftKey,o=-1*this._scale,a;if(i?o*=t.deltaMode===0?.02:.32:o*=t.deltaMode===0?1:16,i){var s=n.getBoundingClientRect(),c={x:t.clientX-s.left,y:t.clientY-s.top};a=Math.sqrt(Math.pow(t.deltaY,2)+Math.pow(t.deltaX,2))*FM(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)}},yi.prototype.stepZoom=function(t,n){var i=Uv(pf,qv);this._zoom(t,n,i)},yi.prototype._zoom=function(e,t,n){var i=this._canvas,r=e>0?1:-1,o=Pl(i.zoom()),a=Math.round(o/n)*n;a+=n*r;var s=Math.pow(10,a);i.zoom(jM(pf,s),t)},yi.prototype.toggle=function(t){var n=this._container,i=this._handleWheel,r=this._enabled;return typeof t>"u"&&(t=!r),r!==t&&Ne[t?"bind":"unbind"](n,"wheel",i,!1),this._enabled=t,t},yi.prototype._init=function(e){this.toggle(e)};const Yv={__init__:["zoomScroll"],zoomScroll:["type",yi]};function La(e){gr.call(this,e)}de(La,gr),La.prototype._navigationModules=[Gv,Wv,Yv],La.prototype._modules=[].concat(gr.prototype._modules,La.prototype._navigationModules);function ff(e){return e&&e[e.length-1]}function Kv(e){return e.y}function Xv(e){return e.x}var GM={left:Xv,center:Xv,right:function(e){return e.x+e.width},top:Kv,middle:Kv,bottom:function(e){return e.y+e.height}};function Oo(e,t){this._modeling=e,this._rules=t}Oo.$inject=["modeling","rules"],Oo.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}},Oo.prototype._isType=function(e,t){return t.indexOf(e)!==-1},Oo.prototype._alignmentPosition=function(e,t){var n=this._getOrientationDetails(e),i=n.axis,r=n.dimension,o={},a={},s=!1,c,u,l;function p(f,d){return Math.round((f[i]+d[i]+d[r])/2)}if(this._isType(e,["left","top"]))o[e]=t[0][i];else if(this._isType(e,["right","bottom"]))l=ff(t),o[e]=l[i]+l[r];else if(this._isType(e,["center","middle"])){if(L(t,function(f){var d=f[i]+Math.round(f[r]/2);a[d]?a[d].elements.push(f):a[d]={elements:[f],center:d}}),c=ii(a,function(f){return f.elements.length>1&&(s=!0),f.elements.length}),s)return o[e]=ff(c).center,o;u=t[0],t=ii(t,function(f){return f[i]+f[r]}),l=ff(t),o[e]=p(u,l)}return o},Oo.prototype.trigger=function(e,t){var n=this._modeling,i,r=Ge(e,function(c){return!(c.waypoints||c.host||c.labelTarget)});if(i=this._rules.allowed("elements.align",{elements:r}),ke(i)&&(r=i),!(r.length<2||!i)){var o=GM[t],a=ii(r,o),s=this._alignmentPosition(t,a);n.alignElements(a,s)}};const VM={__init__:["alignElements"],alignElements:["type",Oo]},WM=new Po;function Do(e){this._scheduled={},e.on("diagram.destroy",()=>{Object.keys(this._scheduled).forEach(t=>{this.cancel(t)})})}Do.$inject=["eventBus"],Do.prototype.schedule=function(e,t=WM.next()){this.cancel(t);const n=this._schedule(e,t);return this._scheduled[t]=n,n.promise},Do.prototype._schedule=function(e,t){const n=UM();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}},Do.prototype.cancel=function(e){const t=this._scheduled[e];t&&(this._cancel(t),this._scheduled[e]=null)},Do.prototype._cancel=function(e){clearTimeout(e.executionId)};function UM(){const e={};return e.promise=new Promise((t,n)=>{e.resolve=t,e.reject=n}),e}const qM={scheduler:["type",Do]};var YM="djs-element-hidden",Hc=".entry",KM=1e3,Zv=8,XM=300;function kt(e,t,n,i){this._canvas=e,this._elementRegistry=t,this._eventBus=n,this._scheduler=i,this._current=null,this._init()}kt.$inject=["canvas","elementRegistry","eventBus","scheduler"],kt.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=ke(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=ke(i.target)?i.target:[i.target];r.includes(n)&&e._updateVisibility()}}),this._container=this._createContainer()},kt.prototype._createContainer=function(){var e=ft('<div class="djs-context-pad-parent"></div>');return this._canvas.getContainer().appendChild(e),e},kt.prototype.registerProvider=function(e,t){t||(t=e,e=KM),this._eventBus.on("contextPad.getProviders",e,function(n){n.providers.push(t)})},kt.prototype.getEntries=function(e){var t=this._getProviders(),n=ke(e)?"getMultiElementContextPadEntries":"getContextPadEntries",i={};return L(t,function(r){if(Wt(r[n])){var o=r[n](e);Wt(o)?i=o(i):L(o,function(a,s){i[s]=a})}}),i},kt.prototype.trigger=function(e,t,n){var i=this,r,o,a=t.delegateTarget||t.target;if(!a)return t.preventDefault();if(r=sn(a,"data-action"),o=t.originalEvent||t,e==="mouseover"){this._timeout=setTimeout(function(){i._mouseout=i.triggerEntry(r,"hover",o,n)},XM);return}else if(e==="mouseout"){clearTimeout(this._timeout),this._mouseout&&(this._mouseout(),this._mouseout=null);return}return this.triggerEntry(r,e,o,n)},kt.prototype.triggerEntry=function(e,t,n,i){if(this.isShown()){var r=this._current.target,o=this._current.entries,a=o[e];if(a){var s=a.action;if(this._eventBus.fire("contextPad.trigger",{entry:a,event:n})!==!1){if(Wt(s)){if(t==="click")return s(n,r,i)}else if(s[t])return s[t](n,r,i);n.preventDefault()}}}},kt.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))}},kt.prototype._getProviders=function(){var e=this._eventBus.createEvent({type:"contextPad.getProviders",providers:[]});return this._eventBus.fire(e),e.providers},kt.prototype._updateAndOpen=function(e){var t=this.getEntries(e),n=this._createHtml(e),i;L(t,function(r,o){var a=r.group||"default",s=ft(r.html||'<div class="entry" draggable="true"></div>'),c;sn(s,"data-action",o),c=ot("[data-group="+Da(a)+"]",n),c||(c=ft('<div class="group"></div>'),sn(c,"data-group",a),n.appendChild(c)),c.appendChild(s),r.className&&ZM(s,r.className),r.title&&sn(s,"title",r.title),r.imageUrl&&(i=ft("<img>"),sn(i,"src",r.imageUrl),i.style.width="100%",i.style.height="100%",s.appendChild(i))}),gt(n).add("open"),this._current={entries:t,html:n,target:e},this._updatePosition(),this._updateVisibility(),this._eventBus.fire("contextPad.open",{current:this._current})},kt.prototype._createHtml=function(e){var t=this,n=ft('<div class="djs-context-pad"></div>');return Cn.bind(n,Hc,"click",function(i){t.trigger("click",i)}),Cn.bind(n,Hc,"dragstart",function(i){t.trigger("dragstart",i)}),Cn.bind(n,Hc,"mouseover",function(i){t.trigger("mouseover",i)}),Cn.bind(n,Hc,"mouseout",function(i){t.trigger("mouseout",i)}),Ne.bind(n,"mousedown",function(i){i.stopPropagation()}),this._container.appendChild(n),this._eventBus.fire("contextPad.create",{target:e,pad:n}),n},kt.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()&&JM(this._current.target,e)?t=this._current.html:t=this._createHtml(e),{html:t}},kt.prototype.close=function(){this.isOpen()&&(clearTimeout(this._timeout),this._container.innerHTML="",this._eventBus.fire("contextPad.close",{current:this._current}),this._current=null)},kt.prototype.isOpen=function(e){var t=this._current;if(!t)return!1;if(!e)return!0;var n=t.target;return ke(e)!==ke(n)?!1:ke(e)?e.length===n.length&&Rr(e,function(i){return n.includes(i)}):n===e},kt.prototype.isShown=function(){return this.isOpen()&&gt(this._current.html).has("open")},kt.prototype.show=function(){this.isOpen()&&(gt(this._current.html).add("open"),this._updatePosition(),this._eventBus.fire("contextPad.show",{current:this._current}))},kt.prototype.hide=function(){this.isOpen()&&(gt(this._current.html).remove("open"),this._eventBus.fire("contextPad.hide",{current:this._current}))},kt.prototype._getPosition=function(e){if(!ke(e)&&st(e)){var t=this._canvas.viewbox(),n=QM(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}},kt.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")},kt.prototype._updateVisibility=function(){const e=()=>{if(this.isOpen()){var t=this,n=this._current.target,i=ke(n)?n:[n],r=i.some(function(o){return t._canvas.hasMarker(o,YM)});r?t.hide():t.show()}};this._scheduler.schedule(e,"ContextPad#_updateVisibility")},kt.prototype._getTargetBounds=function(e){var t=this,n=ke(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 ZM(e,t){var n=gt(e);t=ke(t)?t:t.split(/\s+/g),t.forEach(function(i){n.add(i)})}function QM(e){return e.waypoints[e.waypoints.length-1]}function JM(e,t){return e=ke(e)?e:[e],t=ke(t)?t:[t],e.length===t.length&&Rr(e,function(n){return t.includes(n)})}const Qv={__depends__:[fc,qM,$c],contextPad:["type",kt]};var zc,_t,Jv,yr,eb,tb,nb,df,Gc,Ia,ib,hf,mf,gf,Vc={},Wc=[],e2=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,Uc=Array.isArray;function Fi(e,t){for(var n in t)e[n]=t[n];return e}function yf(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function rb(e,t,n){var i,r,o,a={};for(o in t)o=="key"?i=t[o]:o=="ref"?r=t[o]:a[o]=t[o];if(arguments.length>2&&(a.children=arguments.length>3?zc.call(arguments,2):n),typeof e=="function"&&e.defaultProps!=null)for(o in e.defaultProps)a[o]===void 0&&(a[o]=e.defaultProps[o]);return qc(e,a,i,r,null)}function qc(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??++Jv,__i:-1,__u:0};return r==null&&_t.vnode!=null&&_t.vnode(o),o}function Yc(e){return e.children}function Kc(e,t){this.props=e,this.context=t}function Gr(e,t){if(t==null)return e.__?Gr(e.__,e.__i+1):null;for(var n;t<e.__k.length;t++)if((n=e.__k[t])!=null&&n.__e!=null)return n.__e;return typeof e.type=="function"?Gr(e):null}function t2(e){if(e.__P&&e.__d){var t=e.__v,n=t.__e,i=[],r=[],o=Fi({},t);o.__v=t.__v+1,_t.vnode&&_t.vnode(o),vf(e.__P,o,t,e.__n,e.__P.namespaceURI,32&t.__u?[n]:null,i,n??Gr(t),!!(32&t.__u),r),o.__v=t.__v,o.__.__k[o.__i]=o,fb(i,o,r),t.__e=t.__=null,o.__e!=n&&ob(o)}}function ob(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}),ob(e)}function ab(e){(!e.__d&&(e.__d=!0)&&yr.push(e)&&!Xc.__r++||eb!=_t.debounceRendering)&&((eb=_t.debounceRendering)||tb)(Xc)}function Xc(){try{for(var e,t=1;yr.length;)yr.length>t&&yr.sort(nb),e=yr.shift(),t=yr.length,t2(e)}finally{yr.length=Xc.__r=0}}function sb(e,t,n,i,r,o,a,s,c,u,l){var p,f,d,g,h,m,E=i&&i.__k||Wc,y=t.length;for(c=n2(n,t,E,c,y),p=0;p<y;p++)(d=n.__k[p])!=null&&(f=d.__i!=-1&&E[d.__i]||Vc,d.__i=p,m=vf(e,d,f,r,o,a,s,c,u,l),g=d.__e,d.ref&&f.ref!=d.ref&&(f.ref&&bf(f.ref,null,d),l.push(d.ref,d.__c||g,d)),h==null&&g!=null&&(h=g),4&d.__u?(c=cb(d,c,e),f.__e&&(f.__e=null)):typeof d.type=="function"&&m!==void 0?c=m:g&&(c=g.nextSibling),d.__u&=-7);return n.__e=h,c}function n2(e,t,n,i,r){var o,a,s,c,u,l=n.length,p=l,f=0;for(e.__k=new Array(r),o=0;o<r;o++)(a=t[o])!=null&&typeof a!="boolean"&&typeof a!="function"?(typeof a=="string"||typeof a=="number"||typeof a=="bigint"||a.constructor==String?a=e.__k[o]=qc(null,a,null,null,null):Uc(a)?a=e.__k[o]=qc(Yc,{children:a},null,null,null):a.constructor===void 0&&a.__b>0?a=e.__k[o]=qc(a.type,a.props,a.key,a.ref?a.ref:null,a.__v):e.__k[o]=a,c=o+f,a.__=e,a.__b=e.__b+1,s=null,(u=a.__i=i2(a,n,c,p))!=-1&&(p--,(s=n[u])&&(s.__u|=2)),s==null||s.__v==null?(u==-1&&(r>l?f--:r<l&&f++),typeof a.type!="function"&&(a.__u|=4)):u!=c&&(u==c-1?f--:u==c+1?f++:(u>c?f--:f++,a.__u|=4))):e.__k[o]=null;if(p)for(o=0;o<l;o++)(s=n[o])!=null&&(2&s.__u)==0&&(s.__e==i&&(i=Gr(s)),hb(s,s));return i}function cb(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=cb(i[r],t,n));return t}e.__e!=t&&(t&&e.type&&!t.parentNode&&(t=Gr(e)),t=n.insertBefore(e.__e,t||null));do t=t&&t.nextSibling;while(t!=null&&t.nodeType==8);return t}function i2(e,t,n,i){var r,o,a,s=e.key,c=e.type,u=t[n],l=u!=null&&(2&u.__u)==0;if(u===null&&s==null||l&&s==u.key&&c==u.type)return n;if(i>(l?1:0)){for(r=n-1,o=n+1;r>=0||o<t.length;)if((u=t[a=r>=0?r--:o++])!=null&&(2&u.__u)==0&&s==u.key&&c==u.type)return a}return-1}function ub(e,t,n){t[0]=="-"?e.setProperty(t,n??""):e[t]=n==null?"":typeof n!="number"||e2.test(t)?n:n+"px"}function Zc(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||ub(e.style,t,"");if(n)for(t in n)i&&n[t]==i[t]||ub(e.style,t,n[t])}else if(t[0]=="o"&&t[1]=="n")o=t!=(t=t.replace(ib,"$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[Ia]=i[Ia]:(n[Ia]=hf,e.addEventListener(t,o?gf:mf,o)):e.removeEventListener(t,o?gf:mf,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 lb(e){return function(t){if(this.l){var n=this.l[t.type+e];if(t[Gc]==null)t[Gc]=hf++;else if(t[Gc]<n[Ia])return;return n(_t.event?_t.event(t):t)}}}function vf(e,t,n,i,r,o,a,s,c,u){var l,p,f,d,g,h,m,E,y,x,S,P,C,D,T,N,k=t.type;if(t.constructor!==void 0)return null;128&n.__u&&(c=!!(32&n.__u),o=[s=t.__e=n.__e]),(l=_t.__b)&&l(t);e:if(typeof k=="function"){p=a.length;try{if(y=t.props,x=k.prototype&&k.prototype.render,S=(l=k.contextType)&&i[l.__c],P=l?S?S.props.value:l.__:i,n.__c?E=(f=t.__c=n.__c).__=f.__E:(x?t.__c=f=new k(y,P):(t.__c=f=new Kc(y,P),f.constructor=k,f.render=o2),S&&S.sub(f),f.state||(f.state={}),f.__n=i,d=f.__d=!0,f.__h=[],f._sb=[]),x&&f.__s==null&&(f.__s=f.state),x&&k.getDerivedStateFromProps!=null&&(f.__s==f.state&&(f.__s=Fi({},f.__s)),Fi(f.__s,k.getDerivedStateFromProps(y,f.__s))),g=f.props,h=f.state,f.__v=t,d)x&&k.getDerivedStateFromProps==null&&f.componentWillMount!=null&&f.componentWillMount(),x&&f.componentDidMount!=null&&f.__h.push(f.componentDidMount);else{if(x&&k.getDerivedStateFromProps==null&&y!==g&&f.componentWillReceiveProps!=null&&f.componentWillReceiveProps(y,P),t.__v==n.__v||!f.__e&&f.shouldComponentUpdate!=null&&f.shouldComponentUpdate(y,f.__s,P)===!1){t.__v!=n.__v&&(f.props=y,f.state=f.__s,f.__d=!1),t.__e=n.__e,t.__k=n.__k,t.__k.some(function(O){O&&(O.__=t)}),Wc.push.apply(f.__h,f._sb),f._sb=[],f.__h.length&&a.push(f),s=Gr(n);break e}f.componentWillUpdate!=null&&f.componentWillUpdate(y,f.__s,P),x&&f.componentDidUpdate!=null&&f.__h.push(function(){f.componentDidUpdate(g,h,m)})}if(f.context=P,f.props=y,f.__P=e,f.__e=!1,C=_t.__r,D=0,x)f.state=f.__s,f.__d=!1,C&&C(t),l=f.render(f.props,f.state,f.context),Wc.push.apply(f.__h,f._sb),f._sb=[];else do f.__d=!1,C&&C(t),l=f.render(f.props,f.state,f.context),f.state=f.__s;while(f.__d&&++D<25);f.state=f.__s,f.getChildContext!=null&&(i=Fi(Fi({},i),f.getChildContext())),x&&!d&&f.getSnapshotBeforeUpdate!=null&&(m=f.getSnapshotBeforeUpdate(g,h)),T=l!=null&&l.type===Yc&&l.key==null?db(l.props.children):l,s=sb(e,Uc(T)?T:[T],t,n,i,r,o,a,s,c,u),f.base=t.__e,t.__u&=-161,f.__h.length&&a.push(f),E&&(f.__E=f.__=null)}catch(O){if(a.length=p,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(N=o.length;N--;)yf(o[N])}else t.__e=n.__e;t.__k==null&&(t.__k=n.__k||[]),O.then||pb(t),_t.__e(O,t,n)}}else o==null&&t.__v==n.__v?(t.__k=n.__k,t.__e=n.__e):s=t.__e=r2(n.__e,t,n,i,r,o,a,c,u);return(l=_t.diffed)&&l(t),128&t.__u?void 0:s}function pb(e){e&&(e.__c&&(e.__c.__e=!0),e.__k&&e.__k.some(pb))}function fb(e,t,n){for(var i=0;i<n.length;i++)bf(n[i],n[++i],n[++i]);_t.__c&&_t.__c(t,e),e.some(function(r){try{e=r.__h,r.__h=[],e.some(function(o){o.call(r)})}catch(o){_t.__e(o,r.__v)}})}function db(e){return typeof e!="object"||e==null||e.__b>0?e:Uc(e)?e.map(db):e.constructor!==void 0?null:Fi({},e)}function r2(e,t,n,i,r,o,a,s,c){var u,l,p,f,d,g,h,m=n.props||Vc,E=t.props,y=t.type;if(y=="svg"?r="http://www.w3.org/2000/svg":y=="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==!!y&&(y?d.localName==y:d.nodeType==3)){e=d,o[u]=null;break}}if(e==null){if(y==null)return document.createTextNode(E);e=document.createElementNS(r,y,E.is&&E),s&&(_t.__m&&_t.__m(t,o),s=!1),o=null}if(y==null)m===E||s&&e.data==E||(e.data=E);else{if(o=y=="textarea"&&E.defaultValue!=null?null:o&&zc.call(e.childNodes),!s&&o!=null)for(m={},u=0;u<e.attributes.length;u++)m[(d=e.attributes[u]).name]=d.value;for(u in m)d=m[u],u=="dangerouslySetInnerHTML"?p=d:u=="children"||u in E||u=="value"&&"defaultValue"in E||u=="checked"&&"defaultChecked"in E||Zc(e,u,null,d,r);for(u in E)d=E[u],u=="children"?f=d:u=="dangerouslySetInnerHTML"?l=d:u=="value"?g=d:u=="checked"?h=d:s&&typeof d!="function"||m[u]===d||Zc(e,u,d,m[u],r);if(l)s||p&&(l.__html==p.__html||l.__html==e.innerHTML)||(e.innerHTML=l.__html),t.__k=[];else if(p&&(e.innerHTML=""),sb(t.type=="template"?e.content:e,Uc(f)?f:[f],t,n,i,y=="foreignObject"?"http://www.w3.org/1999/xhtml":r,o,a,o?o[0]:n.__k&&Gr(n,0),s,c),o!=null)for(u=o.length;u--;)yf(o[u]);s&&y!="textarea"||(u="value",y=="progress"&&g==null?e.removeAttribute("value"):g!=null&&(g!==e[u]||y=="progress"&&!g||y=="option"&&g!=m[u])&&Zc(e,u,g,m[u],r),u="checked",h!=null&&h!=e[u]&&Zc(e,u,h,m[u],r))}return e}function bf(e,t,n){try{if(typeof e=="function"){var i=typeof e.__u=="function";i&&e.__u(),i&&t==null||(e.__u=e(t))}else e.current=t}catch(r){_t.__e(r,n)}}function hb(e,t,n){var i,r;if(_t.unmount&&_t.unmount(e),(i=e.ref)&&(i.current&&i.current!=e.__e||bf(i,null,t)),(i=e.__c)!=null){if(i.componentWillUnmount)try{i.componentWillUnmount()}catch(o){_t.__e(o,t)}i.base=i.__P=i.__n=null}if(i=e.__k)for(r=0;r<i.length;r++)i[r]&&hb(i[r],t,n||typeof e.type!="function");n||yf(e.__e),e.__c=e.__=e.__e=void 0}function o2(e,t,n){return this.constructor(e,n)}function mb(e,t,n){var i,r,o,a;t==document&&(t=document.documentElement),_t.__&&_t.__(e,t),r=(i=!1)?null:t.__k,o=[],a=[],vf(t,e=t.__k=rb(Yc,null,[e]),r||Vc,Vc,t.namespaceURI,r?null:t.firstChild?zc.call(t.childNodes):null,o,r?r.__e:t.firstChild,i,a),fb(o,e,a),e.props.children=null}zc=Wc.slice,_t={__e:function(e,t,n,i){for(var r,o,a;t=t.__;)if((r=t.__c)&&!r.__)try{if((o=r.constructor)&&o.getDerivedStateFromError!=null&&(r.setState(o.getDerivedStateFromError(e)),a=r.__d),r.componentDidCatch!=null&&(r.componentDidCatch(e,i||{}),a=r.__d),a)return r.__E=r}catch(s){e=s}throw e}},Jv=0,Kc.prototype.setState=function(e,t){var n;n=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=Fi({},this.state),typeof e=="function"&&(e=e(Fi({},n),this.props)),e&&Fi(n,e),e!=null&&this.__v&&(t&&this._sb.push(t),ab(this))},Kc.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),ab(this))},Kc.prototype.render=Yc,yr=[],tb=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,nb=function(e,t){return e.__v.__b-t.__v.__b},Xc.__r=0,df=Math.random().toString(8),Gc="__d"+df,Ia="__a"+df,ib=/(PointerCapture)$|Capture$/i,hf=0,mf=lb(!1),gf=lb(!0);var gb=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,gb(e,s,n,["",null])),i.push(r),s[0]?t[0]|=2:(t[o-2]=0,t[o]=r)):i.push(s)}return i},yb=new Map;function a2(e){var t=yb.get(this);return t||(t=new Map,yb.set(this,t)),(t=gb(this,t.get(e)||(t.set(e,t=(function(n){for(var i,r,o=1,a="",s="",c=[0],u=function(f){o===1&&(f||(a=a.replace(/^\s*\n\s*|\s*\n\s*$/g,"")))?c.push(0,f,a):o===3&&(f||a)?(c.push(3,f,a),o=2):o===2&&a==="..."&&f?c.push(4,f,0):o===2&&a&&!f?c.push(5,0,!0,a):o>=5&&((a||!f&&o===5)&&(c.push(o,0,a,r),o=6),f&&(c.push(o,f,0,r),o=6)),a=""},l=0;l<n.length;l++){l&&(o===1&&u(),u(l));for(var p=0;p<n[l].length;p++)i=n[l][p],o===1?i==="<"?(u(),c=[c],o=3):a+=i:o===4?a==="--"&&i===">"?(o=1,a=""):a=i+a[0]:s?i===s?s="":a+=i:i==='"'||i==="'"?s=i:i===">"?(u(),o=1):o&&(i==="="?(o=5,r=a,a=""):i==="/"&&(o<5||n[l][p+1]===">")?(u(),o===3&&(c=c[0]),o=c,(c=c[0]).push(2,0,o),o=0):i===" "||i===" "||i===`
11
+ `||i==="\r"?(u(),o=2):a+=i),o===3&&a==="!--"&&(o=4,c=c[0])}return u(),c})(e)),t),arguments,[])).length>1?t:t[0]}var ut=a2.bind(rb),Lo,Ot,_f,vb,Na=0,bb=[],Ft=_t,_b=Ft.__b,xb=Ft.__r,wb=Ft.diffed,Eb=Ft.__c,Sb=Ft.unmount,Rb=Ft.__;function Qc(e,t){Ft.__h&&Ft.__h(Ot,e,Na||t),Na=0;var n=Ot.__H||(Ot.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({}),n.__[e]}function xf(e){return Na=1,s2(Pb,e)}function s2(e,t,n){var i=Qc(Lo++,2);if(i.t=e,!i.__c&&(i.__=[Pb(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=Ot,!Ot.__f)){var r=function(s,c,u){if(!i.__c.__H)return!0;var l=!1,p=i.__c.props!==s;if(i.__c.__H.__.some(function(d){if(d.__N){l=!0;var g=d.__[0];d.__=d.__N,d.__N=void 0,g!==d.__[0]&&(p=!0)}}),o){var f=o.call(this,s,c,u);return l?f||p:f}return!l||p};Ot.__f=!0;var o=Ot.shouldComponentUpdate,a=Ot.componentWillUpdate;Ot.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)},Ot.shouldComponentUpdate=r}return i.__N||i.__}function Jc(e,t){var n=Qc(Lo++,3);!Ft.__s&&Sf(n.__H,t)&&(n.__=e,n.u=t,Ot.__H.__h.push(n))}function wf(e,t){var n=Qc(Lo++,4);!Ft.__s&&Sf(n.__H,t)&&(n.__=e,n.u=t,Ot.__h.push(n))}function eu(e){return Na=5,Hi(function(){return{current:e}},[])}function Hi(e,t){var n=Qc(Lo++,7);return Sf(n.__H,t)&&(n.__=e(),n.__H=t,n.__h=e),n.__}function Ba(e,t){return Na=8,Hi(function(){return e},t)}function c2(){for(var e;e=bb.shift();){var t=e.__H;if(e.__P&&t)try{t.__h.some(tu),t.__h.some(Ef),t.__h=[]}catch(n){t.__h=[],Ft.__e(n,e.__v)}}}Ft.__b=function(e){Ot=null,_b&&_b(e)},Ft.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),Rb&&Rb(e,t)},Ft.__r=function(e){xb&&xb(e),Lo=0;var t=(Ot=e.__c).__H;t&&(_f===Ot?(t.__h=[],Ot.__h=[],t.__.some(function(n){n.__N&&(n.__=n.__N),n.u=n.__N=void 0})):(t.__h.some(tu),t.__h.some(Ef),t.__h=[],Lo=0)),_f=Ot},Ft.diffed=function(e){wb&&wb(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(bb.push(t)!==1&&vb===Ft.requestAnimationFrame||((vb=Ft.requestAnimationFrame)||u2)(c2)),t.__H.__.some(function(n){n.u&&(n.__H=n.u,n.u=void 0)})),_f=Ot=null},Ft.__c=function(e,t){t.some(function(n){try{n.__h.some(tu),n.__h=n.__h.filter(function(i){return!i.__||Ef(i)})}catch(i){t.some(function(r){r.__h&&(r.__h=[])}),t=[],Ft.__e(i,n.__v)}}),Eb&&Eb(e,t)},Ft.unmount=function(e){Sb&&Sb(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.some(function(i){try{tu(i)}catch(r){t=r}}),n.__H=void 0,t&&Ft.__e(t,n.__v))};var Cb=typeof requestAnimationFrame=="function";function u2(e){var t,n=function(){clearTimeout(i),Cb&&cancelAnimationFrame(t),setTimeout(e)},i=setTimeout(n,35);Cb&&(t=requestAnimationFrame(n))}function tu(e){var t=Ot,n=e.__c;typeof n=="function"&&(e.__c=void 0,n()),Ot=t}function Ef(e){var t=Ot;e.__c=e.__(),Ot=t}function Sf(e,t){return!e||e.length!==t.length||t.some(function(n,i){return n!==e[i]})}function Pb(e,t){return typeof t=="function"?t(e):t}function l2(e){const{navigationStack:t,setNavigationStack:n}=e,i=Hi(()=>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&&lt`
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)=>lt`
26
+ ${i.map((a,s)=>ut`
27
27
  <button
28
28
  key=${s}
29
29
  type="button"
@@ -35,19 +35,19 @@
35
35
  </button>
36
36
  <span class="djs-popup-breadcrumbs-item--separator" aria-hidden="true"></span>
37
37
  `)}
38
- ${o&&lt`
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 Cb(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=Cb(e[t]))&&(i&&(i+=" "),i+=n)}else for(n in e)e[n]&&(i&&(i+=" "),i+=n);return i}function nu(){for(var e,t,n=0,i="",r=arguments.length;n<r;n++)(e=arguments[n])&&(t=Cb(e))&&(i&&(i+=" "),i+=t);return i}function p2(e){const{headerEntries:t,onSelect:n,selectedEntry:i,setSelectedEntry:r,title:o}=e,a=Gi(()=>f2(t),[t]),s=u=>u.action&&!u.disabled,c=(u,l)=>{if(s(l))return n(u,l)};return lt`
44
+ `}function Ab(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=Ab(e[t]))&&(i&&(i+=" "),i+=n)}else for(n in e)e[n]&&(i&&(i+=" "),i+=n);return i}function nu(){for(var e,t,n=0,i="",r=arguments.length;n<r;n++)(e=arguments[n])&&(t=Ab(e))&&(i&&(i+=" "),i+=t);return i}function p2(e){const{headerEntries:t,onSelect:n,selectedEntry:i,setSelectedEntry:r,title:o}=e,a=Hi(()=>f2(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=>lt`
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=>lt`
50
+ ${u.entries.map(l=>ut`
51
51
  <li key=${l.id}>
52
52
  <${s(l)?"button":"span"}
53
53
  class=${d2(l,l===i)}
@@ -60,8 +60,8 @@
60
60
  onFocus=${()=>s(l)&&r(l)}
61
61
  onBlur=${()=>s(l)&&r(null)}
62
62
  >
63
- ${l.imageUrl&&lt`<img class="djs-popup-entry-icon" src=${l.imageUrl} alt="" />`||l.imageHtml&&lt`<div class="djs-popup-entry-icon" dangerouslySetInnerHTML=${{__html:l.imageHtml}} />`}
64
- ${l.label?lt`
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 f2(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 d2(e,t){return nu("entry",e.className,e.active?"active":"",e.disabled?"disabled":"",t?"selected":"")}function Pb(e,t){return`${e}-entry-${t.id}`}function h2(e){const{idPrefix:t,entry:n,selected:i,onMouseEnter:r,onMouseLeave:o,onAction:a}=e,s=(u,l)=>{if(!n.disabled)return a(u,n,l)},c=!n.entries;return lt`
73
+ `}function f2(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 d2(e,t){return nu("entry",e.className,e.active?"active":"",e.disabled?"disabled":"",t?"selected":"")}function Tb(e,t){return`${e}-entry-${t.id}`}function h2(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
75
  class=${nu("entry",{selected:i,disabled:n.disabled})}
76
76
  data-id=${n.id}
77
- id=${Pb(t,n)}
77
+ id=${Tb(t,n)}
78
78
  role="option"
79
79
  aria-selected=${i||void 0}
80
80
  aria-haspopup=${n.entries?"true":void 0}
@@ -90,15 +90,15 @@
90
90
  <span
91
91
  class=${nu("djs-popup-entry-name",n.className)}
92
92
  >
93
- ${n.imageUrl&&lt`<img class="djs-popup-entry-icon" src=${n.imageUrl} alt="" />`||n.imageHtml&&lt`<div class="djs-popup-entry-icon" dangerouslySetInnerHTML=${{__html:n.imageHtml}} />`}
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?lt`
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&&lt`
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&&lt`
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&&lt`
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 m2(e){const{selectedEntry:t,setSelectedEntry:n,groupedEntries:i,keyboardSelection:r,idPrefix:o,id:a,ariaLabel:s,tabIndex:c,ariaActivedescendant:u,...l}=e,p=eu();_f(()=>{if(!r||!r.current)return;const h=p.current;if(!h)return;const m=h.querySelector(".selected");m&&g2(m)},[t]);const f=()=>{r.current=!1},d=h=>{r.current||n(h)},g=()=>{r.current||n(null)};return lt`
134
+ `}function m2(e){const{selectedEntry:t,setSelectedEntry:n,groupedEntries:i,keyboardSelection:r,idPrefix:o,id:a,ariaLabel:s,tabIndex:c,ariaActivedescendant:u,...l}=e,p=eu();wf(()=>{if(!r||!r.current)return;const h=p.current;if(!h)return;const m=h.querySelector(".selected");m&&g2(m)},[t]);const f=()=>{r.current=!1},d=h=>{r.current||n(h)},g=()=>{r.current||n(null)};return ut`
135
135
  <div
136
136
  class="djs-popup-results"
137
137
  ref=${p}
@@ -142,9 +142,9 @@
142
142
  aria-activedescendant=${u}
143
143
  onMouseMove=${f}
144
144
  >
145
- ${i.map(h=>lt`
146
- ${h.name&&lt`
147
- <div key=${h.id} id=${Ab(o,h)} class="entry-header" title=${h.name}>
145
+ ${i.map(h=>ut`
146
+ ${h.name&&ut`
147
+ <div key=${h.id} id=${Mb(o,h)} class="entry-header" title=${h.name}>
148
148
  ${h.name}
149
149
  </div>
150
150
  `}
@@ -152,9 +152,9 @@
152
152
  class="djs-popup-group"
153
153
  data-group=${h.id}
154
154
  role="group"
155
- aria-labelledby=${h.name?Ab(o,h):void 0}
155
+ aria-labelledby=${h.name?Mb(o,h):void 0}
156
156
  >
157
- ${h.entries.map(m=>lt`
157
+ ${h.entries.map(m=>ut`
158
158
  <${h2}
159
159
  key=${m.id}
160
160
  idPrefix=${o}
@@ -168,10 +168,10 @@
168
168
  </ul>
169
169
  `)}
170
170
  </div>
171
- `}function Ab(e,t){return`${e}-group-${t.id}`}function g2(e){typeof e.scrollIntoViewIfNeeded=="function"?e.scrollIntoViewIfNeeded():e.scrollIntoView({scrollMode:"if-needed",block:"nearest"})}const y2=new Ao("djs-popup");function v2(e){const{onClose:t,onSelect:n,className:i,headerEntries:r,position:o,title:a,width:s,scale:c,search:u,emptyPlaceholder:l,searchFn:p,entries:f,onOpened:d,onClosed:g}=e,[h,m]=bf([]);Jc(()=>{m([])},[f]);const[S,y]=bf(""),x=S.trim().length>0,E=Gi(()=>x2(f),[f]),P=Gi(()=>Ht(u)?E.length>5:!1,[u,E]),C=Gi(()=>{const q=h.length?h[h.length-1].entries:f;return P?x?p(E.filter(({searchable:U})=>U!==!1),S,{keys:["label","search","description"]}).map(({item:U})=>U):q.filter(({rank:U=0})=>U>=0):q},[P,x,E,S,p,h,f]),D=Gi(()=>x?C.length?[{id:"default",entries:C}]:[]:w2(C),[C,x]),[A,I]=bf(C[0]),k=eu(null),O=eu(!1),$=Gi(()=>y2.next(),[]),oe=`${$}-results`,ve=A&&Pb($,A);Jc(()=>{const q=k.current;q&&C.includes(q)?I(q):I(C[0]),k.current=null},[C]);const Ue=Na(q=>{const U=_2(D);let Fe=U.indexOf(A)+q;Fe<0&&(Fe=U.length-1),Fe>=U.length&&(Fe=0),O.current=!0,I(U[Fe])},[D,A]),Y=Na(q=>{q>0&&A&&A.entries&&(O.current=!0,m(U=>[...U,A])),q<0&&h.length>0&&(O.current=!0,k.current=h[h.length+q],m(U=>U.slice(0,q)))},[A,h]),pe=Na((q,U,Z)=>{if(!(!U||U.disabled))return U.entries?(q.preventDefault(),Y(1)):n(q,U,Z)},[n,Y]),ge=Na(q=>{if(q.key==="Enter"&&A){const U=q.target;return!!Or(U,"a, button",!0)||A.disabled?void 0:pe(q,A)}if(q.key==="Backspace"){const U=q.target;if(!(rl(U,"input")&&U.value!==""))return Y(-1),q.preventDefault()}if(q.key==="ArrowUp")return Ue(-1),q.preventDefault();if(q.key==="ArrowDown")return Ue(1),q.preventDefault();if(q.key==="ArrowRight")return Y(1),q.preventDefault();if(q.key==="ArrowLeft")return Y(-1),q.preventDefault()},[A,Ue,Y,pe]),le=Na(q=>{rl(q.target,"input")&&y(()=>q.target.value)},[y]);Jc(()=>(d(),()=>{g()}),[]);const Ee=!x&&h.length>0,re=(a||r.length>0)&&!Ee;return lt`
172
- <${Tb}
171
+ `}function Mb(e,t){return`${e}-group-${t.id}`}function g2(e){typeof e.scrollIntoViewIfNeeded=="function"?e.scrollIntoViewIfNeeded():e.scrollIntoView({scrollMode:"if-needed",block:"nearest"})}const y2=new Po("djs-popup");function v2(e){const{onClose:t,onSelect:n,className:i,headerEntries:r,position:o,title:a,width:s,scale:c,search:u,emptyPlaceholder:l,searchFn:p,entries:f,onOpened:d,onClosed:g}=e,[h,m]=xf([]);Jc(()=>{m([])},[f]);const[E,y]=xf(""),x=E.trim().length>0,S=Hi(()=>x2(f),[f]),P=Hi(()=>Nt(u)?S.length>5:!1,[u,S]),C=Hi(()=>{const q=h.length?h[h.length-1].entries:f;return P?x?p(S.filter(({searchable:U})=>U!==!1),E,{keys:["label","search","description"]}).map(({item:U})=>U):q.filter(({rank:U=0})=>U>=0):q},[P,x,S,E,p,h,f]),D=Hi(()=>x?C.length?[{id:"default",entries:C}]:[]:w2(C),[C,x]),[T,N]=xf(C[0]),k=eu(null),O=eu(!1),F=Hi(()=>y2.next(),[]),oe=`${F}-results`,_e=T&&Tb(F,T);Jc(()=>{const q=k.current;q&&C.includes(q)?N(q):N(C[0]),k.current=null},[C]);const We=Ba(q=>{const U=_2(D);let He=U.indexOf(T)+q;He<0&&(He=U.length-1),He>=U.length&&(He=0),O.current=!0,N(U[He])},[D,T]),Y=Ba(q=>{q>0&&T&&T.entries&&(O.current=!0,m(U=>[...U,T])),q<0&&h.length>0&&(O.current=!0,k.current=h[h.length+q],m(U=>U.slice(0,q)))},[T,h]),le=Ba((q,U,Z)=>{if(!(!U||U.disabled))return U.entries?(q.preventDefault(),Y(1)):n(q,U,Z)},[n,Y]),ge=Ba(q=>{if(q.key==="Enter"&&T){const U=q.target;return!!Mr(U,"a, button",!0)||T.disabled?void 0:le(q,T)}if(q.key==="Backspace"){const U=q.target;if(!(al(U,"input")&&U.value!==""))return Y(-1),q.preventDefault()}if(q.key==="ArrowUp")return We(-1),q.preventDefault();if(q.key==="ArrowDown")return We(1),q.preventDefault();if(q.key==="ArrowRight")return Y(1),q.preventDefault();if(q.key==="ArrowLeft")return Y(-1),q.preventDefault()},[T,We,Y,le]),ue=Ba(q=>{al(q.target,"input")&&y(()=>q.target.value)},[y]);Jc(()=>(d(),()=>{g()}),[]);const Re=!x&&h.length>0,re=(a||r.length>0)&&!Re;return ut`
172
+ <${kb}
173
173
  onClose=${t}
174
- onKeyup=${le}
174
+ onKeyup=${ue}
175
175
  onKeydown=${ge}
176
176
  className=${i}
177
177
  position=${o}
@@ -179,25 +179,25 @@
179
179
  scale=${c}
180
180
  navigationStack=${h}
181
181
  >
182
- ${re&&lt`
182
+ ${re&&ut`
183
183
  <${p2}
184
184
  headerEntries=${r}
185
185
  onSelect=${n}
186
- selectedEntry=${A}
187
- setSelectedEntry=${I}
186
+ selectedEntry=${T}
187
+ setSelectedEntry=${N}
188
188
  title=${a}
189
189
  />
190
190
  `}
191
- ${Ee&&lt`
191
+ ${Re&&ut`
192
192
  <${l2}
193
193
  navigationStack=${h}
194
194
  setNavigationStack=${m}
195
195
  />
196
196
  `}
197
- ${f.length>0&&lt`
197
+ ${f.length>0&&ut`
198
198
  <div class="djs-popup-body">
199
199
 
200
- ${P&&lt`
200
+ ${P&&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"/>
@@ -209,13 +209,13 @@
209
209
  aria-label="${a||"Search"}"
210
210
  aria-expanded="true"
211
211
  aria-controls=${oe}
212
- aria-activedescendant=${ve||void 0}
212
+ aria-activedescendant=${_e||void 0}
213
213
  aria-autocomplete="list"
214
214
  />
215
215
  </div>
216
216
  `}
217
217
 
218
- ${x&&lt`
218
+ ${x&&ut`
219
219
  <div class="djs-popup-search-count" aria-live="polite">
220
220
  ${C.length} ${C.length===1?"result":"results"} found
221
221
  </div>
@@ -223,24 +223,24 @@
223
223
 
224
224
  <${m2}
225
225
  groupedEntries=${D}
226
- selectedEntry=${A}
227
- setSelectedEntry=${I}
226
+ selectedEntry=${T}
227
+ setSelectedEntry=${N}
228
228
  keyboardSelection=${O}
229
- onAction=${pe}
230
- idPrefix=${$}
229
+ onAction=${le}
230
+ idPrefix=${F}
231
231
  id=${oe}
232
232
  ariaLabel=${a||"Results"}
233
233
  tabIndex=${P?-1:0}
234
- ariaActivedescendant=${P?void 0:ve||void 0}
234
+ ariaActivedescendant=${P?void 0:_e||void 0}
235
235
  />
236
236
 
237
- ${A&&A.documentationRef&&lt`
237
+ ${T&&T.documentationRef&&ut`
238
238
  <div class="djs-popup-footer">
239
239
  <a
240
240
  class="djs-popup-footer-docs"
241
- href=${A.documentationRef}
241
+ href=${T.documentationRef}
242
242
  onClick=${q=>q.stopPropagation()}
243
- aria-label=${A.label?`Open entry documentation for ${A.label}`:"Open entry documentation"}
243
+ aria-label=${T.label?`Open entry documentation for ${T.label}`:"Open entry documentation"}
244
244
  target="_blank"
245
245
  rel="noopener"
246
246
  >
@@ -254,11 +254,11 @@
254
254
  `}
255
255
  </div>
256
256
  `}
257
- ${l&&C.length===0&&lt`
258
- <div class="djs-popup-no-results">${Kt(l)?l(S):l}</div>
257
+ ${l&&C.length===0&&ut`
258
+ <div class="djs-popup-no-results">${Wt(l)?l(E):l}</div>
259
259
  `}
260
- </${Tb}>
261
- `}function Tb(e){const{onClose:t,onKeydown:n,onKeyup:i,className:r,children:o,navigationStack:a,position:s}=e,c=eu();return _f(()=>{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]),_f(()=>{const u=c.current;if(!u)return;(u.querySelector("input")||u.querySelector('[role="listbox"]')||u).focus()},[a]),Jc(()=>{const u=p=>{if(p.key==="Escape")return p.preventDefault(),t()},l=p=>{if(!Or(p.target,".djs-popup",!0))return t()};return document.documentElement.addEventListener("keydown",u),document.body.addEventListener("click",l,!0),()=>{document.documentElement.removeEventListener("keydown",u),document.body.removeEventListener("click",l,!0)}},[]),lt`
260
+ </${kb}>
261
+ `}function kb(e){const{onClose:t,onKeydown:n,onKeyup:i,className:r,children:o,navigationStack:a,position:s}=e,c=eu();return wf(()=>{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]),wf(()=>{const u=c.current;if(!u)return;(u.querySelector("input")||u.querySelector('[role="listbox"]')||u).focus()},[a]),Jc(()=>{const u=p=>{if(p.key==="Escape")return p.preventDefault(),t()},l=p=>{if(!Mr(p.target,".djs-popup",!0))return t()};return document.documentElement.addEventListener("keydown",u),document.body.addEventListener("click",l,!0),()=>{document.documentElement.removeEventListener("keydown",u),document.body.removeEventListener("click",l,!0)}},[]),ut`
262
262
  <div
263
263
  class=${nu("djs-popup",r)}
264
264
  style=${b2(e)}
@@ -269,7 +269,7 @@
269
269
  >
270
270
  ${o}
271
271
  </div>
272
- `}function b2(e){const{width:t}=e,n=typeof t=="number"?`${t}px`:t;return{transform:`scale(${e.scale})`,width:Ht(t)?n:void 0,maxWidth:Ht(t)?"unset":void 0,"transform-origin":"top left"}}function _2(e){const t=[];return e.forEach(n=>{n.entries.forEach(i=>{t.push(i)})}),t}function x2(e){const t=[];function n(i){i.forEach(r=>{if(r.entries){n(r.entries);return}t.push(r)})}return n(e),t}function w2(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 E2="data-id",Mb=["contextPad.close","canvas.viewbox.changing","commandStack.changed"],S2=1e3;function xt(e,t,n,i){this._eventBus=t,this._canvas=n,this._search=i,this._current=null;var r=Ht(e&&e.scale)?e.scale:{min:1,max:1};this._config={scale:r},t.on("diagram.destroy",()=>{this.close()}),t.on("element.changed",o=>{const a=this.isOpen()&&this._current.target;o.element===a&&this.refresh()})}xt.$inject=["config.popupMenu","eventBus","canvas","search"],xt.prototype._render=function(){const{position:e,providerId:t,entries:n,headerEntries:i,emptyPlaceholder:r,options:o}=this._current,a=kb(n),s=Object.entries(i).map(([f,d])=>({id:f,...d})),c=e&&(f=>this._ensureVisible(f,e)),u=this._updateScale(this._current.container);db(lt`
272
+ `}function b2(e){const{width:t}=e,n=typeof t=="number"?`${t}px`:t;return{transform:`scale(${e.scale})`,width:Nt(t)?n:void 0,maxWidth:Nt(t)?"unset":void 0,"transform-origin":"top left"}}function _2(e){const t=[];return e.forEach(n=>{n.entries.forEach(i=>{t.push(i)})}),t}function x2(e){const t=[];function n(i){i.forEach(r=>{if(r.entries){n(r.entries);return}t.push(r)})}return n(e),t}function w2(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 E2="data-id",Ob=["contextPad.close","canvas.viewbox.changing","commandStack.changed"],S2=1e3;function xt(e,t,n,i){this._eventBus=t,this._canvas=n,this._search=i,this._current=null;var r=Nt(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()})}xt.$inject=["config.popupMenu","eventBus","canvas","search"],xt.prototype._render=function(){const{position:e,providerId:t,entries:n,headerEntries:i,emptyPlaceholder:r,options:o}=this._current,a=Db(n),s=Object.entries(i).map(([f,d])=>({id:f,...d})),c=e&&(f=>this._ensureVisible(f,e)),u=this._updateScale(this._current.container);mb(ut`
273
273
  <${v2}
274
274
  onClose=${f=>this.close(f)}
275
275
  onSelect=${(f,d,g)=>this.trigger(f,d,g)}
@@ -284,7 +284,7 @@
284
284
  searchFn=${this._search}
285
285
  ...${{...o}}
286
286
  />
287
- `,this._current.container)},xt.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()},xt.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()},xt.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)}},xt.prototype.close=function(){this.isOpen()&&(this._emit("close"),this.reset(),this._canvas.restoreFocus(),this._current=null)},xt.prototype.reset=function(){const e=this._current.container;db(null,e),pi(e)},xt.prototype._emit=function(e,t){this._eventBus.fire(`popupMenu.${e}`,t)},xt.prototype._onOpened=function(){this._emit("opened")},xt.prototype._onClosed=function(){this._emit("closed")},xt.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},xt.prototype._bindAutoClose=function(){this._eventBus.once(Mb,this.close,this)},xt.prototype._unbindAutoClose=function(){this._eventBus.off(Mb,this.close,this)},xt.prototype._updateScale=function(){var e=this._canvas.zoom(),t=this._config.scale,n,i,r=e;return t!==!0&&(t===!1?(n=1,i=1):(n=t.min,i=t.max),Ht(n)&&e<n&&(r=n),Ht(i)&&e>i&&(r=i)),r},xt.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}},xt.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},xt.prototype.registerProvider=function(e,t,n){n||(n=t,t=S2),this._eventBus.on("popupMenu.getProviders."+e,t,function(i){i.providers.push(n)})},xt.prototype._getProviders=function(e){var t=this._eventBus.createEvent({type:"popupMenu.getProviders."+e,providers:[]});return this._eventBus.fire(t),t.providers},xt.prototype._getEntries=function(e,t){var n={};return L(t,function(i){if(!i.getPopupMenuEntries){L(i.getEntries(e),function(o){var a=o.id;if(!a)throw new Error("entry ID is missing");n[a]=ai(o,["id"])});return}var r=i.getPopupMenuEntries(e);Kt(r)?n=r(n):L(r,function(o,a){n[a]=o})}),n},xt.prototype._getHeaderEntries=function(e,t){var n={};return L(t,function(i){if(!i.getPopupMenuHeaderEntries){if(!i.getHeaderEntries)return;L(i.getHeaderEntries(e),function(o){var a=o.id;if(!a)throw new Error("entry ID is missing");n[a]=ai(o,["id"])});return}var r=i.getPopupMenuHeaderEntries(e);Kt(r)?n=r(n):L(r,function(o,a){n[a]=o})}),n},xt.prototype._getEmptyPlaceholder=function(e){const t=e.find(n=>Kt(n.getEmptyPlaceholder));return t&&t.getEmptyPlaceholder()},xt.prototype.isOpen=function(){return!!this._current},xt.prototype.trigger=function(e,t,n="click"){if(e.preventDefault(),!t){let r=Or(e.delegateTarget||e.target,".entry",!0),o=ln(r,E2);t={id:o,...this._getEntry(o)}}const i=t.action;if(this._emit("trigger",{entry:t,event:e})!==!1){if(Kt(i)){if(n==="click")return i(e,t)}else if(i[n])return i[n](e,t)}},xt.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 kb(e,t=[]){return Object.entries(e).map(([n,i])=>{const r={id:n,...i};return r.entries?r.entries=kb(r.entries,[...t,...Ob(r.search)]):t.length&&(r.search=[...t,...Ob(r.search)]),r})}function Ob(e){return e?Ae(e)?e:[e]:[]}function R2(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=C2(o,r,i);return a?{item:o,tokens:a}:[]}).sort(P2(i))}function C2(e,t,n){const{matchedWords:i,tokens:r}=n.reduce((o,a)=>{const s=e[a],{tokens:c,matchedWords:u}=Ae(s)?s.reduce((l,p)=>{const{tokens:f,matchedWords:d}=Nb(p,t);return{tokens:[...l.tokens,f],matchedWords:{...l.matchedWords,...d}}},{matchedWords:{},tokens:[]}):Nb(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=A2(t.tokens[o],n.tokens[o]);if(a!==0){i+=a*r,r*=Db;continue}const s=T2(t.item[o],n.item[o]);if(s!==0){i+=s*r,r*=Db;continue}}return i}}function A2(e,t){return Lb(t)-Lb(e)}const Db=.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 Lb(e){const t=e.reduce((s,c)=>s+Ib(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 Ib(e){if(Ae(e))return Math.max(...e.map(Ib));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 Bb(e=""){return Ae(e)?e.join(", "):e}function T2(e,t){return Bb(e).localeCompare(Bb(t))}function Nb(e,t){var u;if(!e)return{tokens:[],matchedWords:{}};const n=[],i={},r=t.map(M2),o=[`(?<all>${r.join("\\s+")})`,...r].join("|"),a=new RegExp(o,"ig");let s,c=0;for(;s=a.exec(e);){const[l]=s,p=s.index,f=s.index+l.length,d=p===0,g=f===e.length,h=!!((u=s.groups)!=null&&u.all),m=d||/\s/.test(e.charAt(p-1)),S=g||/\s/.test(e.charAt(f));s.index>c&&n.push({value:e.slice(c,s.index),index:c}),n.push({value:l,index:s.index,match:!0,wordStart:m,wordEnd:S,start:d,end:g,all:h});const y=h?t:[l];for(const x of y)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 M2(e){return e.replace(/[/\-\\^$*+?.()|[\]{}]/g,"\\$&")}const $b={search:["value",R2]},Ef={__depends__:[$b],__init__:["popupMenu"],popupMenu:["type",xt]};var jb={align:`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 2000 2000">
287
+ `,this._current.container)},xt.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()},xt.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()},xt.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)}},xt.prototype.close=function(){this.isOpen()&&(this._emit("close"),this.reset(),this._canvas.restoreFocus(),this._current=null)},xt.prototype.reset=function(){const e=this._current.container;mb(null,e),ui(e)},xt.prototype._emit=function(e,t){this._eventBus.fire(`popupMenu.${e}`,t)},xt.prototype._onOpened=function(){this._emit("opened")},xt.prototype._onClosed=function(){this._emit("closed")},xt.prototype._createContainer=function(e){var t=this._canvas,n=t.getContainer();const i=ft(`<div class="djs-popup-parent djs-scrollable" data-popup=${e.provider}></div>`);return n.appendChild(i),i},xt.prototype._bindAutoClose=function(){this._eventBus.once(Ob,this.close,this)},xt.prototype._unbindAutoClose=function(){this._eventBus.off(Ob,this.close,this)},xt.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),Nt(n)&&e<n&&(r=n),Nt(i)&&e>i&&(r=i)),r},xt.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}},xt.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},xt.prototype.registerProvider=function(e,t,n){n||(n=t,t=S2),this._eventBus.on("popupMenu.getProviders."+e,t,function(i){i.providers.push(n)})},xt.prototype._getProviders=function(e){var t=this._eventBus.createEvent({type:"popupMenu.getProviders."+e,providers:[]});return this._eventBus.fire(t),t.providers},xt.prototype._getEntries=function(e,t){var n={};return L(t,function(i){if(!i.getPopupMenuEntries){L(i.getEntries(e),function(o){var a=o.id;if(!a)throw new Error("entry ID is missing");n[a]=ri(o,["id"])});return}var r=i.getPopupMenuEntries(e);Wt(r)?n=r(n):L(r,function(o,a){n[a]=o})}),n},xt.prototype._getHeaderEntries=function(e,t){var n={};return L(t,function(i){if(!i.getPopupMenuHeaderEntries){if(!i.getHeaderEntries)return;L(i.getHeaderEntries(e),function(o){var a=o.id;if(!a)throw new Error("entry ID is missing");n[a]=ri(o,["id"])});return}var r=i.getPopupMenuHeaderEntries(e);Wt(r)?n=r(n):L(r,function(o,a){n[a]=o})}),n},xt.prototype._getEmptyPlaceholder=function(e){const t=e.find(n=>Wt(n.getEmptyPlaceholder));return t&&t.getEmptyPlaceholder()},xt.prototype.isOpen=function(){return!!this._current},xt.prototype.trigger=function(e,t,n="click"){if(e.preventDefault(),!t){let r=Mr(e.delegateTarget||e.target,".entry",!0),o=sn(r,E2);t={id:o,...this._getEntry(o)}}const i=t.action;if(this._emit("trigger",{entry:t,event:e})!==!1){if(Wt(i)){if(n==="click")return i(e,t)}else if(i[n])return i[n](e,t)}},xt.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 Db(e,t=[]){return Object.entries(e).map(([n,i])=>{const r={id:n,...i};return r.entries?r.entries=Db(r.entries,[...t,...Lb(r.search)]):t.length&&(r.search=[...t,...Lb(r.search)]),r})}function Lb(e){return e?ke(e)?e:[e]:[]}function R2(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=C2(o,r,i);return a?{item:o,tokens:a}:[]}).sort(P2(i))}function C2(e,t,n){const{matchedWords:i,tokens:r}=n.reduce((o,a)=>{const s=e[a],{tokens:c,matchedWords:u}=ke(s)?s.reduce((l,p)=>{const{tokens:f,matchedWords:d}=jb(p,t);return{tokens:[...l.tokens,f],matchedWords:{...l.matchedWords,...d}}},{matchedWords:{},tokens:[]}):jb(s,t);return{tokens:{...o.tokens,[a]:c},matchedWords:{...o.matchedWords,...u}}},{matchedWords:{},tokens:{}});return Object.keys(i).length!==t.length?null:r}function P2(e){return(t,n)=>{let i=0,r=1;for(const o of e){const a=A2(t.tokens[o],n.tokens[o]);if(a!==0){i+=a*r,r*=Ib;continue}const s=T2(t.item[o],n.item[o]);if(s!==0){i+=s*r,r*=Ib;continue}}return i}}function A2(e,t){return Nb(t)-Nb(e)}const Ib=.5,Io={FULL:131.9,START_FULL_WORD:8,START_WORD_PART:7.87,WORD_START:2.19,WORD_PART:1,NO_MATCH:-.07};function Nb(e){const t=e.reduce((s,c)=>s+Bb(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 Bb(e){if(ke(e))return Math.max(...e.map(Bb));const t=Math.log(e.value.length);return e.match?(e.start?e.end?Io.FULL:e.wordEnd?Io.START_FULL_WORD:Io.START_WORD_PART:e.wordStart?Io.WORD_START:Io.WORD_PART)*t:Io.NO_MATCH*t}function $b(e=""){return ke(e)?e.join(", "):e}function T2(e,t){return $b(e).localeCompare($b(t))}function jb(e,t){var u;if(!e)return{tokens:[],matchedWords:{}};const n=[],i={},r=t.map(M2),o=[`(?<all>${r.join("\\s+")})`,...r].join("|"),a=new RegExp(o,"ig");let s,c=0;for(;s=a.exec(e);){const[l]=s,p=s.index,f=s.index+l.length,d=p===0,g=f===e.length,h=!!((u=s.groups)!=null&&u.all),m=d||/\s/.test(e.charAt(p-1)),E=g||/\s/.test(e.charAt(f));s.index>c&&n.push({value:e.slice(c,s.index),index:c}),n.push({value:l,index:s.index,match:!0,wordStart:m,wordEnd:E,start:d,end:g,all:h});const y=h?t:[l];for(const x of y)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 M2(e){return e.replace(/[/\-\\^$*+?.()|[\]{}]/g,"\\$&")}const Fb={search:["value",R2]},Rf={__depends__:[Fb],__init__:["popupMenu"],popupMenu:["type",xt]};var Hb={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>`},k2=900;function No(e,t,n,i){e.registerProvider(k2,this),this._contextPad=e,this._popupMenu=t,this._translate=n,this._canvas=i}No.$inject=["contextPad","popupMenu","translate","canvas"],No.prototype.getMultiElementContextPadEntries=function(e){var t={};return this._isAllowed(e)&&j(t,this._getEntries(e)),t},No.prototype._isAllowed=function(e){return!this._popupMenu.isEmpty(e,"align-elements")},No.prototype._getEntries=function(){var e=this;return{"align-elements":{group:"align-elements",title:e._translate("Align elements"),html:`<div class="entry">${jb.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)}}}}},No.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 O2=["left","center","right","top","middle","bottom"];function $a(e,t,n,i){this._alignElements=t,this._translate=n,this._popupMenu=e,this._rules=i,e.registerProvider("align-elements",this)}$a.$inject=["popupMenu","alignElements","translate","rules"],$a.prototype.getPopupMenuEntries=function(e){var t={};return this._isAllowed(e)&&j(t,this._getEntries(e)),t},$a.prototype._isAllowed=function(e){return this._rules.allowed("elements.align",{elements:e})},$a.prototype._getEntries=function(e){var t=this._alignElements,n=this._translate,i=this._popupMenu,r={};return L(O2,function(o){r["align-elements-"+o]={group:"align",title:n("Align elements "+o),className:"bjs-align-elements-menu-entry",imageHtml:jb[o],action:function(){t.trigger(e,o),i.close()}}}),r};function iu(e){Vn.call(this,e)}iu.$inject=["eventBus"],he(iu,Vn),iu.prototype.init=function(){this.addRule("elements.align",function(e){var t=e.elements,n=ze(t,function(i){return!(i.waypoints||i.host||i.labelTarget)});return n=Cs(n),n.length<2?!1:n})};const D2={__depends__:[VM,Xv,Ef],__init__:["alignElementsContextPadProvider","alignElementsMenuProvider","bpmnAlignElements"],alignElementsContextPadProvider:["type",No],alignElementsMenuProvider:["type",$a],bpmnAlignElements:["type",iu]};function Vi(e,t,n,i){ee.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=ku(to(a.closure.topLevel)),c=a.hints,u=c?c.autoResize:!0;if(u!==!1){var l=no(s,function(p){return p.parent.id});L(l,function(p,f){Ae(u)&&(p=p.filter(function(d){return ft(u,io({id:d.id}))})),r._expand(p,f)})}}),this.postExecuted(["shape.toggleCollapse"],function(o){var a=o.context,s=a.hints,c=a.shape;s&&s.autoResize===!1||c.collapsed||r._expand(c.children||[],c)}),this.postExecuted(["shape.resize"],function(o){var a=o.context,s=a.hints,c=a.shape,u=c.parent;s&&s.autoResize===!1||u&&r._expand([c],u)})}Vi.$inject=["eventBus","elementRegistry","modeling","rules"],he(Vi,ee),Vi.prototype._getOptimalBounds=function(e,t){var n=this.getOffset(t),i=this.getPadding(t),r=Re(Ot(e)),o=Re(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),Ts(j({},o,a))},Vi.prototype._expand=function(e,t){typeof t=="string"&&(t=this._elementRegistry.get(t));var n=this._rules.allowed("element.autoResize",{elements:e,target:t});if(n){var i=this._getOptimalBounds(e,t);if(L2(i,t)){var r=I2(ti(t,["x","y","width","height"]),i);this.resize(t,i,{autoResize:r});var o=t.parent;o&&this._expand([t],o)}}},Vi.prototype.getOffset=function(e){return{top:60,bottom:60,left:100,right:100}},Vi.prototype.getPadding=function(e){return{top:2,bottom:2,left:15,right:15}},Vi.prototype.resize=function(e,t,n){this._modeling.resizeShape(e,t,null,n)};function L2(e,t){return e.x!==t.x||e.y!==t.y||e.width!==t.width||e.height!==t.height}function I2(e,t){var n="";return e=Re(e),t=Re(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 ru(e){e.invoke(Vi,this)}ru.$inject=["injector"],he(ru,Vi),ru.prototype.resize=function(e,t,n){_(e,"bpmn:Participant")?this._modeling.resizeLane(e,t,null,n):this._modeling.resizeShape(e,t,null,n)};function ja(e){Vn.call(this,e);var t=this;this.addRule("element.autoResize",function(n){return t.canResize(n.elements,n.target)})}ja.$inject=["eventBus"],he(ja,Vn),ja.prototype.canResize=function(e,t){return!1};function ou(e,t){ja.call(this,e),this._modeling=t}he(ou,ja),ou.$inject=["eventBus","modeling"],ou.prototype.canResize=function(e,t){if(_(t.di,"bpmndi:BPMNPlane")||!_(t,"bpmn:Participant")&&!_(t,"bpmn:Lane")&&!_(t,"bpmn:SubProcess"))return!1;var n=!0;return L(e,function(i){if(_(i,"bpmn:Lane")||je(i)){n=!1;return}}),n};const B2={__init__:["bpmnAutoResize","bpmnAutoResizeProvider"],bpmnAutoResize:["type",ru],bpmnAutoResizeProvider:["type",ou]};function $o(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()})}$o.$inject=["config.autoScroll","eventBus","canvas"],$o.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++)N2(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 N2(e,t,n){return t<e&&e<n}$o.prototype.stopScroll=function(){clearTimeout(this._scrolling)},$o.prototype.setOptions=function(e){this._opts=j({},this._opts,e)},$o.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 $2={__depends__:[$i],__init__:["autoScroll"],autoScroll:["type",$o]};var Fb="djs-bendpoint",Hb="djs-segment-dragger";function j2(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 Sf(e,t,n){var i=j2(e,n),r=zl(t,i);return r}function Rf(e,t){var n=Se("g");Ye(n).add(Fb),Ie(e,n);var i=Se("circle");me(i,{cx:0,cy:0,r:4}),Ye(i).add("djs-visual"),Ie(n,i);var r=Se("circle");return me(r,{cx:0,cy:0,r:10}),Ye(r).add("djs-hit"),Ie(n,r),t&&Ye(n).add(t),n}function F2(e,t,n,i){var r=Se("g");Ie(e,r);var o=18,a=6,s=11,c=z2(t,n,i),u=a+s,l=Se("rect");me(l,{x:-o/2,y:-a/2,width:o,height:a}),Ye(l).add("djs-visual"),Ie(r,l);var p=Se("rect");return me(p,{x:-c/2,y:-u/2,width:c,height:u}),Ye(p).add("djs-hit"),Ie(r,p),hm(r,i==="v"?90:0),r}function zb(e,t,n){var i=Se("g"),r=yl(t,n),o=Oi(t,n);return Ie(e,i),F2(i,t,n,o),Ye(i).add(Hb),Ye(i).add(o==="h"?"horizontal":"vertical"),rn(i,r.x,r.y),i}function Cf(e){return Math.abs(Math.round(e*2/3))}function H2(e,t){var n=G2(e,t);return Yl(e,n)}function z2(e,t,n){var i=t.x-e.x,r=t.y-e.y;return Cf(n==="h"?i:r)}function G2(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=eg(e,[a,s]);c<i&&(i=c,r=o)}return[n[r],n[r+1]]}function Gb(e,t,n,i,r){function o(x,E,P){var C=x.index,D=x.point,A,I,k,O,$,oe;return C<=0||x.bendpoint?!1:(A=E[C-1],I=E[C],k=yl(A,I),O=Oi(A,I),$=Math.abs(D.x-k.x),oe=Math.abs(D.y-k.y),O&&$<=P&&oe<=P)}function a(x,E){var P=x.waypoints,C,D,A,I;return E.index<=0||E.bendpoint||(C={start:P[E.index-1],end:P[E.index]},D=Oi(C.start,C.end),!D)?null:(D==="h"?A=C.end.x-C.start.x:A=C.end.y-C.start.y,I=Cf(A)/2,I)}function s(x,E){var P=E.waypoints,C=Sf(t,P,x),D;if(C){D=a(E,C);var A;if(o(C,P,D)?A=r.start(x,E,C.index):A=i.start(x,E,C.index,!C.bendpoint),A!==!1)return!0}}function c(x,E,P){Le.bind(x,E,function(C){n.triggerMouseEvent(E,C,P),C.stopPropagation()})}function u(x,E){var P=t.getLayer("overlays"),C=at('.djs-bendpoints[data-element-id="'+Da(x.id)+'"]',P);return!C&&E&&(C=Se("g"),me(C,{"data-element-id":x.id}),Ye(C).add("djs-bendpoints"),Ie(P,C),c(C,"mousedown",x),c(C,"click",x),c(C,"dblclick",x)),C}function l(x,E){return at('.djs-segment-dragger[data-segment-idx="'+x+'"]',E)}function p(x,E){E.waypoints.forEach(function(P,C){var D=Rf(x);Ie(x,D),rn(D,P.x,P.y)}),Rf(x,"floating")}function f(x,E){for(var P=E.waypoints,C,D,A,I=1;I<P.length;I++)C=P[I-1],D=P[I],Oi(C,D)&&(A=zb(x,C,D),me(A,{"data-segment-idx":I}),c(A,"mousemove",E))}function d(x){L(ws("."+Fb,x),function(E){Gt(E)})}function g(x){L(ws("."+Hb,x),function(E){Gt(E)})}function h(x){var E=u(x);return E||(E=u(x,!0),p(E,x),f(E,x)),E}function m(x){var E=u(x);E&&(g(E),d(E),f(E,x),p(E,x))}function S(x,E){var P=at(".floating",x),C=E.point;P&&(rn(P,C.x,C.y),Ye(P).add("positioned"))}function y(x,E,P){var C=l(E.index,x),D=P[E.index-1],A=P[E.index],I=E.point,k=yl(D,A),O=Oi(D,A),$,oe;C&&($=V2(C),oe={x:I.x-k.x,y:I.y-k.y},O==="v"&&(oe={x:oe.y,y:oe.x}),rn($,oe.x,oe.y))}e.on("connection.changed",function(x){m(x.element)}),e.on("connection.remove",function(x){var E=u(x.element);E&&Gt(E)}),e.on("element.marker.update",function(x){var E=x.element,P;E.waypoints&&(P=h(E),x.add?Ye(P).add(x.marker):Ye(P).remove(x.marker))}),e.on("element.mousemove",function(x){var E=x.element,P=E.waypoints,C,D;if(P){if(C=u(E,!0),D=Sf(t,P,x.originalEvent),!D)return;S(C,D),D.bendpoint||y(C,D,P)}}),e.on("element.mousedown",function(x){if(ur(x)){var E=x.originalEvent,P=x.element;if(P.waypoints)return s(E,P)}}),e.on("selection.changed",function(x){var E=x.newSelection,P=E[0];P&&P.waypoints&&h(P)}),e.on("element.hover",function(x){var E=x.element;E.waypoints&&h(E)}),e.on("element.out",function(x){var E=x.element;if(E.waypoints){var P=u(E);if(P){var C=at(".floating",P);C&&Ye(C).remove("positioned")}}}),e.on("element.updateId",function(x){var E=x.element,P=x.newId;if(E.waypoints){var C=u(E);C&&me(C,{"data-element-id":P})}}),this.addHandles=h,this.updateHandles=m,this.getBendpointsContainer=u,this.getSegmentDragger=l}Gb.$inject=["eventBus","canvas","interactionEvents","bendpointMove","connectionSegmentMove"];function V2(e){return at(".djs-visual",e)}var Vb=Math.round,Ur="reconnectStart",qr="reconnectEnd",Fa="updateWaypoints";function Pf(e,t,n,i,r,o){this._injector=e,this.start=function(a,s,c,u){var l=n.getGraphics(s),p=s.source,f=s.target,d=s.waypoints,g;!u&&c===0?g=Ur:!u&&c===d.length-1?g=qr:g=Fa;var h=g===Fa?"connection.updateWaypoints":"connection.reconnect",m=r.allowed(h,{connection:s,source:p,target:f});if(m===!1&&(m=r.allowed(h,{connection:s,source:f,target:p})),m!==!1)return i.init(a,"bendpoint.move",{data:{connection:s,connectionGfx:l,context:{allowed:m,bendpointIndex:c,connection:s,source:p,target:f,insert:u,type:g}}})},t.on("bendpoint.move.hover",function(a){var s=a.context,c=s.connection,u=c.source,l=c.target,p=a.hover,f=s.type;s.hover=p;var d;if(p){var g=f===Fa?"connection.updateWaypoints":"connection.reconnect";if(d=s.allowed=r.allowed(g,{connection:c,source:f===Ur?p:u,target:f===qr?p:l}),d){s.source=f===Ur?p:u,s.target=f===qr?p:l;return}d===!1&&(d=s.allowed=r.allowed(g,{connection:c,source:f===qr?p:l,target:f===Ur?p:u})),d&&(s.source=f===qr?p:l,s.target=f===Ur?p:u)}}),t.on(["bendpoint.move.out","bendpoint.move.cleanup"],function(a){var s=a.context,c=s.type;s.hover=null,s.source=null,s.target=null,c!==Fa&&(s.allowed=!1)}),t.on("bendpoint.move.end",function(a){var s=a.context,c=s.allowed,u=s.bendpointIndex,l=s.connection,p=s.insert,f=l.waypoints.slice(),d=s.source,g=s.target,h=s.type,m=s.hints||{},S={x:Vb(a.x),y:Vb(a.y)};if(!c)return!1;h===Fa?(p?f.splice(u,0,S):f[u]=S,m.bendpointMove={insert:p,bendpointIndex:u},f=this.cropWaypoints(l,f),o.updateWaypoints(l,sS(f),m)):(h===Ur?(m.docking="source",au(s)&&(m.docking="target",m.newWaypoints=f.reverse())):h===qr&&(m.docking="target",au(s)&&(m.docking="source",m.newWaypoints=f.reverse())),o.reconnect(l,d,g,S,m))},this)}Pf.$inject=["injector","eventBus","canvas","dragging","rules","modeling"],Pf.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 au(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 W2="reconnectStart",U2="reconnectEnd",Wb="updateWaypoints",Ha="connect-ok",su="connect-not-ok",Ub="connect-hover",qb="djs-updating",Yb="djs-dragging",Kb=1100;function Xb(e,t,n,i){this._injector=t;var r=t.get("connectionPreview",!1);n.on("bendpoint.move.start",function(o){var a=o.context,s=a.bendpointIndex,c=a.connection,u=a.insert,l=c.waypoints,p=l.slice();a.waypoints=l,u&&p.splice(s,0,{x:o.x,y:o.y}),c.waypoints=p;var f=a.draggerGfx=Rf(i.getLayer("overlays"));Ye(f).add("djs-dragging"),i.addMarker(c,Yb),i.addMarker(c,qb)}),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,Ub),u===Wb)return;s?(i.removeMarker(c,su),i.addMarker(c,Ha)):s===!1&&(i.removeMarker(c,Ha),i.addMarker(c,su))}}),n.on(["bendpoint.move.out","bendpoint.move.cleanup"],Kb,function(o){var a=o.context,s=a.hover,c=a.target;s&&(i.removeMarker(s,Ub),i.removeMarker(s,c?Ha:su))}),n.on("bendpoint.move.move",function(o){var a=o.context,s=a.allowed,c=a.bendpointIndex,u=a.draggerGfx,l=a.hover,p=a.type,f=a.connection,d=f.source,g=f.target,h=f.waypoints.slice(),m={x:o.x,y:o.y},S=a.hints||{},y={};r&&(S.connectionStart&&(y.connectionStart=S.connectionStart),S.connectionEnd&&(y.connectionEnd=S.connectionEnd),p===W2?au(a)?(y.connectionEnd=y.connectionEnd||m,y.source=g,y.target=l||d,h=h.reverse()):(y.connectionStart=y.connectionStart||m,y.source=l||d,y.target=g):p===U2?au(a)?(y.connectionStart=y.connectionStart||m,y.source=l||g,y.target=d,h=h.reverse()):(y.connectionEnd=y.connectionEnd||m,y.source=d,y.target=l||g):(y.noCropping=!0,y.noLayout=!0,h[c]=m),p===Wb&&(h=e.cropWaypoints(f,h)),y.waypoints=h,r.drawPreview(a,s,y)),rn(u,o.x,o.y)},this),n.on(["bendpoint.move.end","bendpoint.move.cancel"],Kb,function(o){var a=o.context,s=a.connection,c=a.draggerGfx,u=a.hover,l=a.target,p=a.waypoints;s.waypoints=p,Gt(c),i.removeMarker(s,qb),i.removeMarker(s,Yb),u&&(i.removeMarker(u,Ha),i.removeMarker(u,l?Ha:su)),r&&r.cleanUp(a)})}Xb.$inject=["bendpointMove","injector","eventBus","canvas"];var Zb="connect-hover",Qb="djs-updating";function Jb(e,t,n){return Af(e,t,e[t]+n)}function Af(e,t,n){return{x:t==="x"?n:e.x,y:t==="y"?n:e.y}}function q2(e,t,n,i){var r=Math.max(t[i],n[i]),o=Math.min(t[i],n[i]),a=20,s=Math.min(Math.max(o+a,e[i]),r-a);return Af(t,i,s)}function e_(e){return e==="x"?"y":"x"}function t_(e,t,n){var i,r;return e.original?e.original:(i=Te(t),r=e_(n),Af(e,r,i[r]))}function n_(e,t,n,i,r,o){var a=e.get("connectionDocking",!1);this.start=function(p,f,d){var g,h=n.getGraphics(f),m=d-1,S=d,y=f.waypoints,x=y[m],E=y[S],P=Sf(n,y,p),C,D,A;if(C=Oi(x,E),!!C)return D=C==="v"?"x":"y",m===0&&(x=t_(x,f.source,D)),S===y.length-1&&(E=t_(E,f.target,D)),P?A=P.point:A={x:(x.x+E.x)/2,y:(x.y+E.y)/2},g={connection:f,segmentStartIndex:m,segmentEndIndex:S,segmentStart:x,segmentEnd:E,axis:D,dragPosition:A},i.init(p,A,"connectionSegment.move",{cursor:D==="x"?"resize-ew":"resize-ns",data:{connection:f,connectionGfx:h,context:g}})};function s(p,f){if(!a)return f;var d=p.waypoints,g;return p.waypoints=f,g=a.getCroppedWaypoints(p),p.waypoints=d,g}function c(p){r.update("connection",p.connection,p.connectionGfx)}function u(p,f,d){var g=p.newWaypoints,h=p.segmentStartIndex+f,m=g[h],S=p.segmentEndIndex+f,y=g[S],x=e_(p.axis),E=q2(d,m,y,x);rn(p.draggerGfx,E.x,E.y)}function l(p,f){var d=0,g=p.filter(function(h,m){return gl(p[m-1],p[m+1],h)?(d=m<=f?d-1:d,!1):!0});return{waypoints:g,segmentOffset:d}}t.on("connectionSegment.move.start",function(p){var f=p.context,d=p.connection,g=n.getLayer("overlays");f.originalWaypoints=d.waypoints.slice(),f.draggerGfx=zb(g,f.segmentStart,f.segmentEnd),Ye(f.draggerGfx).add("djs-dragging"),n.addMarker(d,Qb)}),t.on("connectionSegment.move.move",function(p){var f=p.context,d=f.connection,g=f.segmentStartIndex,h=f.segmentEndIndex,m=f.segmentStart,S=f.segmentEnd,y=f.axis,x=f.originalWaypoints.slice(),E=Jb(m,y,p["d"+y]),P=Jb(S,y,p["d"+y]),C=x.length,D=0;x[g]=E,x[h]=P;var A,I;g<2&&(A=nn(d.source,E),g===1?A==="intersect"&&(x.shift(),x[0]=E,D--):A!=="intersect"&&(x.unshift(m),D++)),h>C-3&&(I=nn(d.target,P),h===C-2?I==="intersect"&&(x.pop(),x[x.length-1]=P):I!=="intersect"&&x.push(S)),f.newWaypoints=d.waypoints=s(d,x),u(f,D,p),f.newSegmentStartIndex=g+D,c(p)}),t.on("connectionSegment.move.hover",function(p){p.context.hover=p.hover,n.addMarker(p.hover,Zb)}),t.on(["connectionSegment.move.out","connectionSegment.move.cleanup"],function(p){var f=p.context.hover;f&&n.removeMarker(f,Zb)}),t.on("connectionSegment.move.cleanup",function(p){var f=p.context,d=f.connection;f.draggerGfx&&Gt(f.draggerGfx),n.removeMarker(d,Qb)}),t.on(["connectionSegment.move.cancel","connectionSegment.move.end"],function(p){var f=p.context,d=f.connection;d.waypoints=f.originalWaypoints,c(p)}),t.on("connectionSegment.move.end",function(p){var f=p.context,d=f.connection,g=f.newWaypoints,h=f.newSegmentStartIndex;g=g.map(function(P){return{original:P.original,x:Math.round(P.x),y:Math.round(P.y)}});var m=l(g,h),S=m.waypoints,y=s(d,S),x=m.segmentOffset,E={segmentMove:{segmentStartIndex:f.segmentStartIndex,newSegmentStartIndex:h+x}};o.updateWaypoints(d,y,E)})}n_.$inject=["injector","eventBus","canvas","dragging","graphicsFactory","modeling"];var Y2=Math.abs,i_=Math.round;function K2(e,t,n){n=n===void 0?10:n;var i,r;for(i=0;i<t.length;i++)if(r=t[i],Y2(r-e)<=n)return r}function r_(e){return{x:e.x,y:e.y}}function o_(e){return{x:e.x+e.width,y:e.y+e.height}}function Yn(e,t){return!e||isNaN(e.x)||isNaN(e.y)?t:{x:i_(e.x+e.width/2),y:i_(e.y+e.height/2)}}function jo(e,t){var n=e.snapped;return n?typeof t=="string"?n[t]:n.x&&n.y:!1}function Bt(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 a_(e){return e.children||[]}var X2=Math.abs,s_=Math.round,Tf=10;function c_(e){function t(o,a){if(Ae(o)){for(var s=o.length;s--;)if(X2(o[s]-a)<=Tf)return o[s]}else{o=+o;var c=a%o;if(c<Tf)return a-c;if(c>o-Tf)return a-c+o}return a}function n(o,a){if(o.waypoints)return H2(a,o);if(o.width)return{x:s_(o.width/2+o.x),y:s_(o.height/2+o.y)}}function i(o){var a=o.context,s=a.snapPoints,c=a.connection,u=c.waypoints,l=a.segmentStart,p=a.segmentStartIndex,f=a.segmentEnd,d=a.segmentEndIndex,g=a.axis;if(s)return s;var h=[u[p-1],l,f,u[d+1]];return p<2&&h.unshift(n(c.source,o)),d>u.length-3&&h.unshift(n(c.target,o)),a.snapPoints=s={horizontal:[],vertical:[]},L(h,function(m){m&&(m=m.original||m,g==="y"&&s.horizontal.push(m.y),g==="x"&&s.vertical.push(m.x))}),s}e.on("connectionSegment.move.move",1500,function(o){var a=i(o),s=o.x,c=o.y,u,l;if(a){u=t(a.vertical,s),l=t(a.horizontal,c);var p=s-u,f=c-l;j(o,{dx:o.dx-p,dy:o.dy-f,x:u,y:l}),(p||a.vertical.indexOf(s)!==-1)&&Bt(o,"x",u),(f||a.horizontal.indexOf(c)!==-1)&&Bt(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:[]},L(u,function(l){l&&(l=l.original||l,a.horizontal.push(l.y),a.vertical.push(l.x))}),a}e.on(["connect.hover","connect.move","connect.end"],1500,function(o){var a=o.context,s=a.hover,c=s&&n(s,o);!ct(s)||!c||!c.x||!c.y||(Bt(o,"x",c.x),Bt(o,"y",c.y))}),e.on(["bendpoint.move.move","bendpoint.move.end"],1500,function(o){var a=o.context,s=r(a),c=a.hover,u=c&&n(c,o),l=o.x,p=o.y,f,d;if(s){f=t(u?s.vertical.concat([u.x]):s.vertical,l),d=t(u?s.horizontal.concat([u.y]):s.horizontal,p);var g=l-f,h=p-d;j(o,{dx:o.dx-g,dy:o.dy-h,x:o.x-g,y:o.y-h}),(g||s.vertical.indexOf(l)!==-1)&&Bt(o,"x",f),(h||s.horizontal.indexOf(p)!==-1)&&Bt(o,"y",d)}})}c_.$inject=["eventBus"];const Z2={__depends__:[$i,yi],__init__:["bendpoints","bendpointSnapping","bendpointMovePreview"],bendpoints:["type",Gb],bendpointMove:["type",Pf],bendpointMovePreview:["type",Xb],connectionSegmentMove:["type",n_],bendpointSnapping:["type",c_]};function u_(e,t,n,i){function r(a,s){return i.allowed("connection.create",{source:a,target:s})}function o(a,s){return r(s,a)}e.on("connect.hover",function(a){var s=a.context,c=s.start,u=a.hover,l;if(s.hover=u,l=s.canExecute=r(c,u),!eo(l)){if(l!==!1){s.source=c,s.target=u;return}l=s.canExecute=o(c,u),!eo(l)&&l!==!1&&(s.source=u,s.target=c)}}),e.on(["connect.out","connect.cleanup"],function(a){var s=a.context;s.hover=null,s.source=null,s.target=null,s.canExecute=!1}),e.on("connect.end",function(a){var s=a.context,c=s.canExecute,u=s.connectionStart,l={x:a.x,y:a.y},p=s.source,f=s.target;if(!c)return!1;var d=null,g={connectionStart:Mf(s)?l:u,connectionEnd:Mf(s)?u:l};Yt(c)&&(d=c),s.connection=n.connect(p,f,d,g)}),this.start=function(a,s,c,u){Yt(c)||(u=c,c=Te(s)),t.init(a,"connect",{autoActivate:u,data:{shape:s,context:{start:s,connectionStart:c}}})}}u_.$inject=["eventBus","dragging","modeling","rules"];function Mf(e){var t=e.hover,n=e.source,i=e.target;return t&&n&&t===n&&n!==i}var Q2=1100,J2=900,l_="connect-ok",p_="connect-not-ok";function f_(e,t,n){var i=e.get("connectionPreview",!1);i&&t.on("connect.move",function(r){var o=r.context,a=o.canExecute,s=o.hover,c=o.source,u=o.start,l=o.startPosition,p=o.target,f=o.connectionStart||l,d=o.connectionEnd||{x:r.x,y:r.y},g=f,h=d;Mf(o)&&(g=d,h=f),i.drawPreview(o,a,{source:c||u,target:p||s,connectionStart:g,connectionEnd:h})}),t.on("connect.hover",J2,function(r){var o=r.context,a=r.hover,s=o.canExecute;s!==null&&n.addMarker(a,s?l_:p_)}),t.on(["connect.out","connect.cleanup"],Q2,function(r){var o=r.hover;o&&(n.removeMarker(o,l_),n.removeMarker(o,p_))}),i&&t.on("connect.cleanup",function(r){i.cleanUp(r.context)})}f_.$inject=["injector","eventBus","canvas"];const kf={__depends__:[Wn,yi,$i],__init__:["connectPreview"],connect:["type",u_],connectPreview:["type",f_]};var ek="djs-dragger";function Wi(e,t,n,i){this._canvas=t,this._graphicsFactory=n,this._elementFactory=i,this._connectionDocking=e.get("connectionDocking",!1),this._layouter=e.get("layouter",!1)}Wi.$inject=["injector","canvas","graphicsFactory","elementFactory"],Wi.prototype.drawPreview=function(e,t,n){n=n||{};var i=e.connectionPreviewGfx,r=e.getConnection,o=n.source,a=n.target,s=n.waypoints,c=n.connectionStart,u=n.connectionEnd,l=n.noLayout,p=n.noCropping,f=n.noNoop,d,g=this;if(i||(i=e.connectionPreviewGfx=this.createConnectionPreviewGfx()),Es(i),r||(r=e.getConnection=tk(function(h,m,S){return g.getConnection(h,m,S)})),t&&(d=r(t,o,a)),!d){!f&&this.drawNoopPreview(i,n);return}d.waypoints=s||[],this._layouter&&!l&&(d.waypoints=this._layouter.layoutConnection(d,{source:o,target:a,connectionStart:c,connectionEnd:u,waypoints:n.waypoints||d.waypoints})),(!d.waypoints||!d.waypoints.length)&&(d.waypoints=[o?Te(o):c,a?Te(a):u]),this._connectionDocking&&(o||a)&&!p&&(d.waypoints=this._connectionDocking.getCroppedWaypoints(d,o,a)),this._graphicsFactory.drawConnection(i,d,{stroke:"var(--element-dragger-color)"})},Wi.prototype.drawNoopPreview=function(e,t){var n=t.source,i=t.target,r=t.connectionStart||Te(n),o=t.connectionEnd||Te(i),a=this.cropWaypoints(r,o,n,i),s=this.createNoopConnection(a[0],a[1]);Ie(e,s)},Wi.prototype.cropWaypoints=function(e,t,n,i){var r=this._graphicsFactory,o=n&&r.getShapePath(n),a=i&&r.getShapePath(i),s=r.getConnectionPath({waypoints:[e,t]});return e=n&&ta(o,s,!0)||e,t=i&&ta(a,s,!1)||t,[e,t]},Wi.prototype.cleanUp=function(e){e&&e.connectionPreviewGfx&&Gt(e.connectionPreviewGfx)},Wi.prototype.getConnection=function(e){var t=nk(e);return this._elementFactory.createConnection(t)},Wi.prototype.createConnectionPreviewGfx=function(){var e=Se("g");return me(e,{pointerEvents:"none"}),Ye(e).add(ek),Ie(this._canvas.getActiveLayer(),e),e},Wi.prototype.createNoopConnection=function(e,t){return Zo([e,t],{stroke:"#333",strokeDasharray:[1],strokeWidth:2,"pointer-events":"none"})};function tk(e){var t={};return function(n){var i=JSON.stringify(n),r=t[i];return r||(r=t[i]=e.apply(null,arguments)),r}}function nk(e){return Yt(e)?e:{}}const ik={__init__:["connectionPreview"],connectionPreview:["type",Wi]},cu="complex-preview";class d_{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(cu);n.filter(s=>!rk(s)).forEach(s=>{let c;ct(s)?(c=this._graphicsFactory._createContainer("connection",Se("g")),this._graphicsFactory.drawConnection(Ir(c),s)):(c=this._graphicsFactory._createContainer("shape",Se("g")),this._graphicsFactory.drawShape(Ir(c),s),rn(c,s.x,s.y)),this._previewSupport.addDragger(s,a,c)}),i.forEach(({element:s,delta:c})=>{this._previewSupport.addDragger(s,a,void 0,"djs-dragging"),this._canvas.addMarker(s,"djs-element-hidden"),this._markers.push([s,"djs-element-hidden"]);const u=this._previewSupport.addDragger(s,a);ct(s)?rn(u,c.x,c.y):rn(u,s.x+c.x,s.y+c.y)}),r.forEach(s=>{this._previewSupport.addDragger(s,a,void 0,"djs-dragging"),this._canvas.addMarker(s,"djs-element-hidden"),this._markers.push([s,"djs-element-hidden"])}),o.forEach(({shape:s,bounds:c})=>{this._canvas.addMarker(s,"djs-hidden"),this._markers.push([s,"djs-hidden"]),this._previewSupport.addDragger(s,a,void 0,"djs-dragging");const u=this._graphicsFactory._createContainer("shape",Se("g"));this._graphicsFactory.drawShape(Ir(u),s,{width:c.width,height:c.height}),rn(u,c.x,c.y),this._previewSupport.addDragger(s,a,u)})}cleanUp(){Es(this._canvas.getLayer(cu)),this._markers.forEach(([t,n])=>this._canvas.removeMarker(t,n)),this._markers=[]}show(){this._canvas.showLayer(cu)}hide(){this._canvas.hideLayer(cu)}}d_.$inject=["canvas","graphicsFactory","previewSupport"];function rk(e){return e.hidden}const ok={__depends__:[To],__init__:["complexPreview"],complexPreview:["type",d_]},h_=Math.round;function uu(e,t,n,i,r,o){this._complexPreview=e,this._connectionDocking=t,this._elementFactory=n,this._eventBus=i,this._layouter=r,this._rules=o}uu.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-h_(u.width/2),y:l.y-h_(u.height/2)});const p=c.allowed("connection.create",{source:e,target:u,hints:{targetParent:e.parent}});let f=null;p&&(f=o.createConnection(p),f.waypoints=s.layoutConnection(f,{source:e,target:u}),f.waypoints=r.getCroppedWaypoints(f,e,u)),i.create({created:[u,f].filter(d=>!eo(d))})},uu.prototype.cleanUp=function(){this._complexPreview.cleanUp()},uu.$inject=["complexPreview","connectionDocking","elementFactory","eventBus","layouter","rules"];const ak={__depends__:[Bc,ok,nf],__init__:["appendPreview"],appendPreview:["type",uu]};var m_=Math.min,g_=Math.max;function Of(e){e.preventDefault()}function za(e){e.stopPropagation()}function sk(e){return e.nodeType===Node.TEXT_NODE}function ck(e){return[].slice.call(e)}function ii(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=at("[contenteditable]",this.parent),this.keyHandler=e.keyHandler||function(){},this.resizeHandler=e.resizeHandler||function(){},this.focusoutHandler=e.focusoutHandler||function(){},this.autoResize=vn(this.autoResize,this),this.handlePaste=vn(this.handlePaste,this)}ii.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=ti(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=ti(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,Le.bind(a,"keydown",this.keyHandler),Le.bind(a,"mousedown",za),Le.bind(a,"paste",r.handlePaste),Le.bind(a,"focusout",this.focusoutHandler),i.autoResize&&Le.bind(a,"input",this.autoResize),i.resizable&&this.resizable(t),s.appendChild(o),this.setSelection(a.lastChild,a.lastChild&&a.lastChild.length),o},ii.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)}},ii.prototype.insertText=function(e){e=uk(e);var t=document.execCommand("insertText",!1,e);t||this._insertTextIE(e)},ii.prototype._insertTextIE=function(e){var t=this.getSelection(),n=t.startContainer,i=t.endContainer,r=t.startOffset,o=t.endOffset,a=t.commonAncestorContainer,s=ck(a.childNodes),c,u;if(sk(a)){var l=n.textContent;n.textContent=l.substring(0,r)+e+l.substring(o),c=n,u=r+e.length}else if(n===this.content&&i===this.content){var p=document.createTextNode(e);this.content.insertBefore(p,s[r]),c=p,u=p.textContent.length}else{var f=s.indexOf(n),d=s.indexOf(i);s.forEach(function(g,h){h===f?g.textContent=n.textContent.substring(0,r)+e+i.textContent.substring(o):h>f&&h<=d&&pi(g)}),c=n,u=r+e.length}c&&u!==void 0&&setTimeout(function(){self.setSelection(c,u)})},ii.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})}},ii.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,p=function(g){Of(g),za(g),s=g.clientX,c=g.clientY;var h=t.getBoundingClientRect();u=h.width,l=h.height,Le.bind(document,"mousemove",f),Le.bind(document,"mouseup",d)},f=function(g){Of(g),za(g);var h=m_(g_(u+g.clientX-s,i),o),m=m_(g_(l+g.clientY-c,r),a);t.style.width=h+"px",t.style.height=m+"px",e.resizeHandler({width:u,height:l,dx:g.clientX-s,dy:g.clientY-c})},d=function(g){Of(g),za(g),Le.unbind(document,"mousemove",f,!1),Le.unbind(document,"mouseup",d,!1)};Le.bind(n,"mousedown",p)}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)},ii.prototype.destroy=function(){var e=this.parent,t=this.content,n=this.resizeHandle;t.innerText="",e.removeAttribute("style"),t.removeAttribute("style"),Le.unbind(t,"keydown",this.keyHandler),Le.unbind(t,"mousedown",za),Le.unbind(t,"input",this.autoResize),Le.unbind(t,"paste",this.handlePaste),Le.unbind(t,"focusout",this.focusoutHandler),n&&(n.removeAttribute("style"),pi(n)),pi(e)},ii.prototype.getValue=function(){return this.content.innerText.trim()},ii.prototype.getSelection=function(){var e=window.getSelection(),t=e.getRangeAt(0);return t},ii.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 uk(e){return e.replace(/\r\n|\r|\n/g,`
316
- `)}function On(e,t){this._eventBus=e,this._canvas=t,this._providers=[],this._textbox=new ii({container:t.getContainer(),keyHandler:vn(this._handleKey,this),resizeHandler:vn(this._handleResize,this),focusoutHandler:vn(this._handleFocusout,this)}),e.on(["diagram.clear","diagram.destroy"],()=>this._cleanup())}On.$inject=["eventBus","canvas"],On.prototype.registerProvider=function(e){this._providers.push(e)},On.prototype.isActive=function(e){return!!(this._active&&(!e||this._active.element===e))},On.prototype.cancel=function(){this._active&&(this._fire("cancel"),this.close())},On.prototype._fire=function(e,t){this._eventBus.fire("directEditing."+e,t||{active:this._active})},On.prototype.close=function(){this._fire("deactivate"),this._cleanup(),this._canvas.restoreFocus&&this._canvas.restoreFocus()},On.prototype._cleanup=function(){this._active&&(this._textbox.destroy(),this._active=null,this.resizable=void 0)},On.prototype.complete=function(){var e=this._active;if(e){var t,n=e.context.bounds,i=this.$textbox.getBoundingClientRect(),r=this.getValue(),o=e.context.text;(r!==o||i.height!==n.height||i.width!==n.width)&&(t=this._textbox.container.getBoundingClientRect(),e.provider.update(e.element,r,e.context.text,{x:i.left-t.left,y:i.top-t.top,width:i.width,height:i.height})),this._fire("complete"),this.close()}},On.prototype.getValue=function(){return this._textbox.getValue()},On.prototype._handleKey=function(e){e.stopPropagation();var t=e.keyCode||e.charCode;if(t===27)return e.preventDefault(),this.cancel();if(t===13&&!e.shiftKey)return e.preventDefault(),this.complete()},On.prototype._handleResize=function(e){this._fire("resize",e)},On.prototype._handleFocusout=function(e){e.relatedTarget&&this._textbox.parent.contains(e.relatedTarget)||this.complete()},On.prototype.activate=function(e){if(this.isActive()&&this.cancel(),this._eventBus.fire("directEditing.activate.allowed",{element:e})===!1)return!1;var t,n=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 y_={__depends__:[fc],__init__:["directEditing"],directEditing:["type",On]};function lk(e){return function(t){var n=t.target,i=te(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===qe(e);return!o||!a||!s||!c}}const pk={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 J(e,t={}){var n=pk[e];if(!n)throw new Error("unknown popup entry <"+e+">");return{...n,actionName:"replace-with-"+e,...t}}var fk=[J("none-start-event",{actionName:"replace-with-none-start"}),J("none-intermediate-throwing"),J("none-end-event",{actionName:"replace-with-none-end"}),J("message-start"),J("timer-start"),J("conditional-start"),J("signal-start")],dk=[J("none-start-event",{actionName:"replace-with-none-start"}),J("none-intermediate-throwing"),J("none-end-event",{actionName:"replace-with-none-end"})],hk=[J("none-start-event",{actionName:"replace-with-none-start"}),J("none-intermediate-throwing",{actionName:"replace-with-none-intermediate-throw"}),J("none-end-event",{actionName:"replace-with-none-end"}),J("message-intermediate-catch"),J("message-intermediate-throw"),J("timer-intermediate-catch"),J("escalation-intermediate-throw"),J("conditional-intermediate-catch"),J("link-intermediate-catch"),J("link-intermediate-throw"),J("compensation-intermediate-throw"),J("signal-intermediate-catch"),J("signal-intermediate-throw")],mk=[J("none-start-event",{actionName:"replace-with-none-start"}),J("none-intermediate-throwing",{actionName:"replace-with-none-intermediate-throw"}),J("none-end-event",{actionName:"replace-with-none-end"}),J("message-end"),J("escalation-end"),J("error-end"),J("cancel-end"),J("compensation-end"),J("signal-end"),J("terminate-end")],gk=[J("exclusive-gateway"),J("parallel-gateway"),J("inclusive-gateway"),J("complex-gateway"),J("event-based-gateway")],yk=[J("transaction"),J("event-subprocess"),J("expanded-ad-hoc-subprocess",{actionName:"replace-with-ad-hoc-subprocess",label:"Ad-hoc sub-process"}),J("collapsed-subprocess")],vk=[J("expanded-subprocess",{actionName:"replace-with-subprocess",label:"Sub-process"}),J("transaction"),J("event-subprocess"),J("collapsed-ad-hoc-subprocess")],v_=[J("transaction"),J("expanded-subprocess",{actionName:"replace-with-subprocess",label:"Sub-process"}),J("expanded-ad-hoc-subprocess",{actionName:"replace-with-ad-hoc-subprocess",label:"Ad-hoc sub-process"}),J("event-subprocess")],bk=v_,b_=[J("task"),J("user-task"),J("service-task"),J("send-task"),J("receive-task"),J("manual-task"),J("rule-task"),J("script-task"),J("call-activity"),J("collapsed-subprocess"),J("expanded-subprocess"),J("collapsed-ad-hoc-subprocess"),J("expanded-ad-hoc-subprocess",{actionName:"replace-with-ad-hoc-subprocess"})],_k=[J("data-store-reference")],xk=[J("data-object-reference")],wk=[J("message-boundary"),J("timer-boundary"),J("escalation-boundary"),J("conditional-boundary"),J("error-boundary"),J("cancel-boundary"),J("signal-boundary"),J("compensation-boundary"),J("non-interrupting-message-boundary"),J("non-interrupting-timer-boundary"),J("non-interrupting-escalation-boundary"),J("non-interrupting-conditional-boundary"),J("non-interrupting-signal-boundary")],Ek=[J("message-start"),J("timer-start"),J("conditional-start"),J("signal-start"),J("error-start"),J("escalation-start"),J("compensation-start"),J("non-interrupting-message-start"),J("non-interrupting-timer-start"),J("non-interrupting-conditional-start"),J("non-interrupting-signal-start"),J("non-interrupting-escalation-start")],Sk=[{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"}],Rk=[J("expanded-pool"),J("collapsed-pool",{label:function(e){var t="Empty pool/participant";return e.children&&e.children.length&&(t+=" (removes content)"),t}})],Ck={"bpmn:MessageEventDefinition":[J("message-start"),J("message-intermediate-catch"),J("message-intermediate-throw"),J("message-end")],"bpmn:TimerEventDefinition":[J("timer-start"),J("timer-intermediate-catch")],"bpmn:ConditionalEventDefinition":[J("conditional-start"),J("conditional-intermediate-catch")],"bpmn:SignalEventDefinition":[J("signal-start"),J("signal-intermediate-catch"),J("signal-intermediate-throw"),J("signal-end")],"bpmn:ErrorEventDefinition":[J("error-start"),J("error-end")],"bpmn:EscalationEventDefinition":[J("escalation-start"),J("escalation-intermediate-throw"),J("escalation-end")],"bpmn:CompensateEventDefinition":[J("compensation-start"),J("compensation-intermediate-throw"),J("compensation-end")]};const __={"start-event-non-interrupting":`
315
+ </svg>`},k2=900;function No(e,t,n,i){e.registerProvider(k2,this),this._contextPad=e,this._popupMenu=t,this._translate=n,this._canvas=i}No.$inject=["contextPad","popupMenu","translate","canvas"],No.prototype.getMultiElementContextPadEntries=function(e){var t={};return this._isAllowed(e)&&H(t,this._getEntries(e)),t},No.prototype._isAllowed=function(e){return!this._popupMenu.isEmpty(e,"align-elements")},No.prototype._getEntries=function(){var e=this;return{"align-elements":{group:"align-elements",title:e._translate("Align elements"),html:`<div class="entry">${Hb.align}</div>`,action:{click:function(t,n){var i=e._getMenuPosition(n);H(i,{cursor:{x:t.x,y:t.y}}),e._popupMenu.open(n,"align-elements",i)}}}}},No.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 O2=["left","center","right","top","middle","bottom"];function $a(e,t,n,i){this._alignElements=t,this._translate=n,this._popupMenu=e,this._rules=i,e.registerProvider("align-elements",this)}$a.$inject=["popupMenu","alignElements","translate","rules"],$a.prototype.getPopupMenuEntries=function(e){var t={};return this._isAllowed(e)&&H(t,this._getEntries(e)),t},$a.prototype._isAllowed=function(e){return this._rules.allowed("elements.align",{elements:e})},$a.prototype._getEntries=function(e){var t=this._alignElements,n=this._translate,i=this._popupMenu,r={};return L(O2,function(o){r["align-elements-"+o]={group:"align",title:n("Align elements "+o),className:"bjs-align-elements-menu-entry",imageHtml:Hb[o],action:function(){t.trigger(e,o),i.close()}}}),r};function iu(e){Gn.call(this,e)}iu.$inject=["eventBus"],de(iu,Gn),iu.prototype.init=function(){this.addRule("elements.align",function(e){var t=e.elements,n=Ge(t,function(i){return!(i.waypoints||i.host||i.labelTarget)});return n=Cs(n),n.length<2?!1:n})};const D2={__depends__:[VM,Qv,Rf],__init__:["alignElementsContextPadProvider","alignElementsMenuProvider","bpmnAlignElements"],alignElementsContextPadProvider:["type",No],alignElementsMenuProvider:["type",$a],bpmnAlignElements:["type",iu]};function zi(e,t,n,i){J.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=ku(Jr(a.closure.topLevel)),c=a.hints,u=c?c.autoResize:!0;if(u!==!1){var l=eo(s,function(p){return p.parent.id});L(l,function(p,f){ke(u)&&(p=p.filter(function(d){return lt(u,to({id:d.id}))})),r._expand(p,f)})}}),this.postExecuted(["shape.toggleCollapse"],function(o){var a=o.context,s=a.hints,c=a.shape;s&&s.autoResize===!1||c.collapsed||r._expand(c.children||[],c)}),this.postExecuted(["shape.resize"],function(o){var a=o.context,s=a.hints,c=a.shape,u=c.parent;s&&s.autoResize===!1||u&&r._expand([c],u)})}zi.$inject=["eventBus","elementRegistry","modeling","rules"],de(zi,J),zi.prototype._getOptimalBounds=function(e,t){var n=this.getOffset(t),i=this.getPadding(t),r=Pe(Tt(e)),o=Pe(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),Ts(H({},o,a))},zi.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(L2(i,t)){var r=I2(Qn(t,["x","y","width","height"]),i);this.resize(t,i,{autoResize:r});var o=t.parent;o&&this._expand([t],o)}}},zi.prototype.getOffset=function(e){return{top:60,bottom:60,left:100,right:100}},zi.prototype.getPadding=function(e){return{top:2,bottom:2,left:15,right:15}},zi.prototype.resize=function(e,t,n){this._modeling.resizeShape(e,t,null,n)};function L2(e,t){return e.x!==t.x||e.y!==t.y||e.width!==t.width||e.height!==t.height}function I2(e,t){var n="";return e=Pe(e),t=Pe(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 ru(e){e.invoke(zi,this)}ru.$inject=["injector"],de(ru,zi),ru.prototype.resize=function(e,t,n){_(e,"bpmn:Participant")?this._modeling.resizeLane(e,t,null,n):this._modeling.resizeShape(e,t,null,n)};function ja(e){Gn.call(this,e);var t=this;this.addRule("element.autoResize",function(n){return t.canResize(n.elements,n.target)})}ja.$inject=["eventBus"],de(ja,Gn),ja.prototype.canResize=function(e,t){return!1};function ou(e,t){ja.call(this,e),this._modeling=t}de(ou,ja),ou.$inject=["eventBus","modeling"],ou.prototype.canResize=function(e,t){if(_(t.di,"bpmndi:BPMNPlane")||!_(t,"bpmn:Participant")&&!_(t,"bpmn:Lane")&&!_(t,"bpmn:SubProcess"))return!1;var n=!0;return L(e,function(i){if(_(i,"bpmn:Lane")||Fe(i)){n=!1;return}}),n};const N2={__init__:["bpmnAutoResize","bpmnAutoResizeProvider"],bpmnAutoResize:["type",ru],bpmnAutoResizeProvider:["type",ou]};function Bo(e,t,n){this._canvas=n,this._opts=H({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()})}Bo.$inject=["config.autoScroll","eventBus","canvas"],Bo.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++)B2(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 B2(e,t,n){return t<e&&e<n}Bo.prototype.stopScroll=function(){clearTimeout(this._scrolling)},Bo.prototype.setOptions=function(e){this._opts=H({},this._opts,e)},Bo.prototype._toBorderPoint=function(e){var t=this._canvas._container.getBoundingClientRect(),n=Nr(e.originalEvent);return{x:n.x-t.left,y:n.y-t.top}};const $2={__depends__:[Ni],__init__:["autoScroll"],autoScroll:["type",Bo]};var zb="djs-bendpoint",Gb="djs-segment-dragger";function j2(e,t){var n=Nr(t),i=e._container.getBoundingClientRect(),r;r={x:i.left,y:i.top};var o=e.viewbox();return{x:o.x+(n.x-r.x)/o.scale,y:o.y+(n.y-r.y)/o.scale}}function Cf(e,t,n){var i=j2(e,n),r=Vl(t,i);return r}function Pf(e,t){var n=Ce("g");qe(n).add(zb),Be(e,n);var i=Ce("circle");he(i,{cx:0,cy:0,r:4}),qe(i).add("djs-visual"),Be(n,i);var r=Ce("circle");return he(r,{cx:0,cy:0,r:10}),qe(r).add("djs-hit"),Be(n,r),t&&qe(n).add(t),n}function F2(e,t,n,i){var r=Ce("g");Be(e,r);var o=18,a=6,s=11,c=z2(t,n,i),u=a+s,l=Ce("rect");he(l,{x:-o/2,y:-a/2,width:o,height:a}),qe(l).add("djs-visual"),Be(r,l);var p=Ce("rect");return he(p,{x:-c/2,y:-u/2,width:c,height:u}),qe(p).add("djs-hit"),Be(r,p),gm(r,i==="v"?90:0),r}function Vb(e,t,n){var i=Ce("g"),r=bl(t,n),o=Mi(t,n);return Be(e,i),F2(i,t,n,o),qe(i).add(Gb),qe(i).add(o==="h"?"horizontal":"vertical"),en(i,r.x,r.y),i}function Af(e){return Math.abs(Math.round(e*2/3))}function H2(e,t){var n=G2(e,t);return Xl(e,n)}function z2(e,t,n){var i=t.x-e.x,r=t.y-e.y;return Af(n==="h"?i:r)}function G2(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=ng(e,[a,s]);c<i&&(i=c,r=o)}return[n[r],n[r+1]]}function Wb(e,t,n,i,r){function o(x,S,P){var C=x.index,D=x.point,T,N,k,O,F,oe;return C<=0||x.bendpoint?!1:(T=S[C-1],N=S[C],k=bl(T,N),O=Mi(T,N),F=Math.abs(D.x-k.x),oe=Math.abs(D.y-k.y),O&&F<=P&&oe<=P)}function a(x,S){var P=x.waypoints,C,D,T,N;return S.index<=0||S.bendpoint||(C={start:P[S.index-1],end:P[S.index]},D=Mi(C.start,C.end),!D)?null:(D==="h"?T=C.end.x-C.start.x:T=C.end.y-C.start.y,N=Af(T)/2,N)}function s(x,S){var P=S.waypoints,C=Cf(t,P,x),D;if(C){D=a(S,C);var T;if(o(C,P,D)?T=r.start(x,S,C.index):T=i.start(x,S,C.index,!C.bendpoint),T!==!1)return!0}}function c(x,S,P){Ne.bind(x,S,function(C){n.triggerMouseEvent(S,C,P),C.stopPropagation()})}function u(x,S){var P=t.getLayer("overlays"),C=ot('.djs-bendpoints[data-element-id="'+Da(x.id)+'"]',P);return!C&&S&&(C=Ce("g"),he(C,{"data-element-id":x.id}),qe(C).add("djs-bendpoints"),Be(P,C),c(C,"mousedown",x),c(C,"click",x),c(C,"dblclick",x)),C}function l(x,S){return ot('.djs-segment-dragger[data-segment-idx="'+x+'"]',S)}function p(x,S){S.waypoints.forEach(function(P,C){var D=Pf(x);Be(x,D),en(D,P.x,P.y)}),Pf(x,"floating")}function f(x,S){for(var P=S.waypoints,C,D,T,N=1;N<P.length;N++)C=P[N-1],D=P[N],Mi(C,D)&&(T=Vb(x,C,D),he(T,{"data-segment-idx":N}),c(T,"mousemove",S))}function d(x){L(ws("."+zb,x),function(S){$t(S)})}function g(x){L(ws("."+Gb,x),function(S){$t(S)})}function h(x){var S=u(x);return S||(S=u(x,!0),p(S,x),f(S,x)),S}function m(x){var S=u(x);S&&(g(S),d(S),f(S,x),p(S,x))}function E(x,S){var P=ot(".floating",x),C=S.point;P&&(en(P,C.x,C.y),qe(P).add("positioned"))}function y(x,S,P){var C=l(S.index,x),D=P[S.index-1],T=P[S.index],N=S.point,k=bl(D,T),O=Mi(D,T),F,oe;C&&(F=V2(C),oe={x:N.x-k.x,y:N.y-k.y},O==="v"&&(oe={x:oe.y,y:oe.x}),en(F,oe.x,oe.y))}e.on("connection.changed",function(x){m(x.element)}),e.on("connection.remove",function(x){var S=u(x.element);S&&$t(S)}),e.on("element.marker.update",function(x){var S=x.element,P;S.waypoints&&(P=h(S),x.add?qe(P).add(x.marker):qe(P).remove(x.marker))}),e.on("element.mousemove",function(x){var S=x.element,P=S.waypoints,C,D;if(P){if(C=u(S,!0),D=Cf(t,P,x.originalEvent),!D)return;E(C,D),D.bendpoint||y(C,D,P)}}),e.on("element.mousedown",function(x){if(sr(x)){var S=x.originalEvent,P=x.element;if(P.waypoints)return s(S,P)}}),e.on("selection.changed",function(x){var S=x.newSelection,P=S[0];P&&P.waypoints&&h(P)}),e.on("element.hover",function(x){var S=x.element;S.waypoints&&h(S)}),e.on("element.out",function(x){var S=x.element;if(S.waypoints){var P=u(S);if(P){var C=ot(".floating",P);C&&qe(C).remove("positioned")}}}),e.on("element.updateId",function(x){var S=x.element,P=x.newId;if(S.waypoints){var C=u(S);C&&he(C,{"data-element-id":P})}}),this.addHandles=h,this.updateHandles=m,this.getBendpointsContainer=u,this.getSegmentDragger=l}Wb.$inject=["eventBus","canvas","interactionEvents","bendpointMove","connectionSegmentMove"];function V2(e){return ot(".djs-visual",e)}var Ub=Math.round,Vr="reconnectStart",Wr="reconnectEnd",Fa="updateWaypoints";function Tf(e,t,n,i,r,o){this._injector=e,this.start=function(a,s,c,u){var l=n.getGraphics(s),p=s.source,f=s.target,d=s.waypoints,g;!u&&c===0?g=Vr:!u&&c===d.length-1?g=Wr:g=Fa;var h=g===Fa?"connection.updateWaypoints":"connection.reconnect",m=r.allowed(h,{connection:s,source:p,target:f});if(m===!1&&(m=r.allowed(h,{connection:s,source:f,target:p})),m!==!1)return i.init(a,"bendpoint.move",{data:{connection:s,connectionGfx:l,context:{allowed:m,bendpointIndex:c,connection:s,source:p,target:f,insert:u,type:g}}})},t.on("bendpoint.move.hover",function(a){var s=a.context,c=s.connection,u=c.source,l=c.target,p=a.hover,f=s.type;s.hover=p;var d;if(p){var g=f===Fa?"connection.updateWaypoints":"connection.reconnect";if(d=s.allowed=r.allowed(g,{connection:c,source:f===Vr?p:u,target:f===Wr?p:l}),d){s.source=f===Vr?p:u,s.target=f===Wr?p:l;return}d===!1&&(d=s.allowed=r.allowed(g,{connection:c,source:f===Wr?p:l,target:f===Vr?p:u})),d&&(s.source=f===Wr?p:l,s.target=f===Vr?p:u)}}),t.on(["bendpoint.move.out","bendpoint.move.cleanup"],function(a){var s=a.context,c=s.type;s.hover=null,s.source=null,s.target=null,c!==Fa&&(s.allowed=!1)}),t.on("bendpoint.move.end",function(a){var s=a.context,c=s.allowed,u=s.bendpointIndex,l=s.connection,p=s.insert,f=l.waypoints.slice(),d=s.source,g=s.target,h=s.type,m=s.hints||{},E={x:Ub(a.x),y:Ub(a.y)};if(!c)return!1;h===Fa?(p?f.splice(u,0,E):f[u]=E,m.bendpointMove={insert:p,bendpointIndex:u},f=this.cropWaypoints(l,f),o.updateWaypoints(l,sS(f),m)):(h===Vr?(m.docking="source",au(s)&&(m.docking="target",m.newWaypoints=f.reverse())):h===Wr&&(m.docking="target",au(s)&&(m.docking="source",m.newWaypoints=f.reverse())),o.reconnect(l,d,g,E,m))},this)}Tf.$inject=["injector","eventBus","canvas","dragging","rules","modeling"],Tf.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 au(e){var t=e.hover,n=e.source,i=e.target,r=e.type;if(r===Vr)return t&&i&&t===i&&n!==i;if(r===Wr)return t&&n&&t===n&&n!==i}var W2="reconnectStart",U2="reconnectEnd",qb="updateWaypoints",Ha="connect-ok",su="connect-not-ok",Yb="connect-hover",Kb="djs-updating",Xb="djs-dragging",Zb=1100;function Qb(e,t,n,i){this._injector=t;var r=t.get("connectionPreview",!1);n.on("bendpoint.move.start",function(o){var a=o.context,s=a.bendpointIndex,c=a.connection,u=a.insert,l=c.waypoints,p=l.slice();a.waypoints=l,u&&p.splice(s,0,{x:o.x,y:o.y}),c.waypoints=p;var f=a.draggerGfx=Pf(i.getLayer("overlays"));qe(f).add("djs-dragging"),i.addMarker(c,Xb),i.addMarker(c,Kb)}),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,Yb),u===qb)return;s?(i.removeMarker(c,su),i.addMarker(c,Ha)):s===!1&&(i.removeMarker(c,Ha),i.addMarker(c,su))}}),n.on(["bendpoint.move.out","bendpoint.move.cleanup"],Zb,function(o){var a=o.context,s=a.hover,c=a.target;s&&(i.removeMarker(s,Yb),i.removeMarker(s,c?Ha:su))}),n.on("bendpoint.move.move",function(o){var a=o.context,s=a.allowed,c=a.bendpointIndex,u=a.draggerGfx,l=a.hover,p=a.type,f=a.connection,d=f.source,g=f.target,h=f.waypoints.slice(),m={x:o.x,y:o.y},E=a.hints||{},y={};r&&(E.connectionStart&&(y.connectionStart=E.connectionStart),E.connectionEnd&&(y.connectionEnd=E.connectionEnd),p===W2?au(a)?(y.connectionEnd=y.connectionEnd||m,y.source=g,y.target=l||d,h=h.reverse()):(y.connectionStart=y.connectionStart||m,y.source=l||d,y.target=g):p===U2?au(a)?(y.connectionStart=y.connectionStart||m,y.source=l||g,y.target=d,h=h.reverse()):(y.connectionEnd=y.connectionEnd||m,y.source=d,y.target=l||g):(y.noCropping=!0,y.noLayout=!0,h[c]=m),p===qb&&(h=e.cropWaypoints(f,h)),y.waypoints=h,r.drawPreview(a,s,y)),en(u,o.x,o.y)},this),n.on(["bendpoint.move.end","bendpoint.move.cancel"],Zb,function(o){var a=o.context,s=a.connection,c=a.draggerGfx,u=a.hover,l=a.target,p=a.waypoints;s.waypoints=p,$t(c),i.removeMarker(s,Kb),i.removeMarker(s,Xb),u&&(i.removeMarker(u,Ha),i.removeMarker(u,l?Ha:su)),r&&r.cleanUp(a)})}Qb.$inject=["bendpointMove","injector","eventBus","canvas"];var Jb="connect-hover",e_="djs-updating";function t_(e,t,n){return Mf(e,t,e[t]+n)}function Mf(e,t,n){return{x:t==="x"?n:e.x,y:t==="y"?n:e.y}}function q2(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 Mf(t,i,s)}function n_(e){return e==="x"?"y":"x"}function i_(e,t,n){var i,r;return e.original?e.original:(i=Oe(t),r=n_(n),Mf(e,r,i[r]))}function r_(e,t,n,i,r,o){var a=e.get("connectionDocking",!1);this.start=function(p,f,d){var g,h=n.getGraphics(f),m=d-1,E=d,y=f.waypoints,x=y[m],S=y[E],P=Cf(n,y,p),C,D,T;if(C=Mi(x,S),!!C)return D=C==="v"?"x":"y",m===0&&(x=i_(x,f.source,D)),E===y.length-1&&(S=i_(S,f.target,D)),P?T=P.point:T={x:(x.x+S.x)/2,y:(x.y+S.y)/2},g={connection:f,segmentStartIndex:m,segmentEndIndex:E,segmentStart:x,segmentEnd:S,axis:D,dragPosition:T},i.init(p,T,"connectionSegment.move",{cursor:D==="x"?"resize-ew":"resize-ns",data:{connection:f,connectionGfx:h,context:g}})};function s(p,f){if(!a)return f;var d=p.waypoints,g;return p.waypoints=f,g=a.getCroppedWaypoints(p),p.waypoints=d,g}function c(p){r.update("connection",p.connection,p.connectionGfx)}function u(p,f,d){var g=p.newWaypoints,h=p.segmentStartIndex+f,m=g[h],E=p.segmentEndIndex+f,y=g[E],x=n_(p.axis),S=q2(d,m,y,x);en(p.draggerGfx,S.x,S.y)}function l(p,f){var d=0,g=p.filter(function(h,m){return vl(p[m-1],p[m+1],h)?(d=m<=f?d-1:d,!1):!0});return{waypoints:g,segmentOffset:d}}t.on("connectionSegment.move.start",function(p){var f=p.context,d=p.connection,g=n.getLayer("overlays");f.originalWaypoints=d.waypoints.slice(),f.draggerGfx=Vb(g,f.segmentStart,f.segmentEnd),qe(f.draggerGfx).add("djs-dragging"),n.addMarker(d,e_)}),t.on("connectionSegment.move.move",function(p){var f=p.context,d=f.connection,g=f.segmentStartIndex,h=f.segmentEndIndex,m=f.segmentStart,E=f.segmentEnd,y=f.axis,x=f.originalWaypoints.slice(),S=t_(m,y,p["d"+y]),P=t_(E,y,p["d"+y]),C=x.length,D=0;x[g]=S,x[h]=P;var T,N;g<2&&(T=Jt(d.source,S),g===1?T==="intersect"&&(x.shift(),x[0]=S,D--):T!=="intersect"&&(x.unshift(m),D++)),h>C-3&&(N=Jt(d.target,P),h===C-2?N==="intersect"&&(x.pop(),x[x.length-1]=P):N!=="intersect"&&x.push(E)),f.newWaypoints=d.waypoints=s(d,x),u(f,D,p),f.newSegmentStartIndex=g+D,c(p)}),t.on("connectionSegment.move.hover",function(p){p.context.hover=p.hover,n.addMarker(p.hover,Jb)}),t.on(["connectionSegment.move.out","connectionSegment.move.cleanup"],function(p){var f=p.context.hover;f&&n.removeMarker(f,Jb)}),t.on("connectionSegment.move.cleanup",function(p){var f=p.context,d=f.connection;f.draggerGfx&&$t(f.draggerGfx),n.removeMarker(d,e_)}),t.on(["connectionSegment.move.cancel","connectionSegment.move.end"],function(p){var f=p.context,d=f.connection;d.waypoints=f.originalWaypoints,c(p)}),t.on("connectionSegment.move.end",function(p){var f=p.context,d=f.connection,g=f.newWaypoints,h=f.newSegmentStartIndex;g=g.map(function(P){return{original:P.original,x:Math.round(P.x),y:Math.round(P.y)}});var m=l(g,h),E=m.waypoints,y=s(d,E),x=m.segmentOffset,S={segmentMove:{segmentStartIndex:f.segmentStartIndex,newSegmentStartIndex:h+x}};o.updateWaypoints(d,y,S)})}r_.$inject=["injector","eventBus","canvas","dragging","graphicsFactory","modeling"];var Y2=Math.abs,o_=Math.round;function K2(e,t,n){n=n===void 0?10:n;var i,r;for(i=0;i<t.length;i++)if(r=t[i],Y2(r-e)<=n)return r}function a_(e){return{x:e.x,y:e.y}}function s_(e){return{x:e.x+e.width,y:e.y+e.height}}function qn(e,t){return!e||isNaN(e.x)||isNaN(e.y)?t:{x:o_(e.x+e.width/2),y:o_(e.y+e.height/2)}}function $o(e,t){var n=e.snapped;return n?typeof t=="string"?n[t]:n.x&&n.y:!1}function Dt(e,t,n){if(typeof t!="string")throw new Error("axis must be in [x, y]");if(typeof n!="number"&&n!==!1)throw new Error("value must be Number or false");var i,r=e[t],o=e.snapped=e.snapped||{};return n===!1?o[t]=!1:(o[t]=!0,i=n-r,e[t]+=i,e["d"+t]+=i),r}function c_(e){return e.children||[]}var X2=Math.abs,u_=Math.round,kf=10;function l_(e){function t(o,a){if(ke(o)){for(var s=o.length;s--;)if(X2(o[s]-a)<=kf)return o[s]}else{o=+o;var c=a%o;if(c<kf)return a-c;if(c>o-kf)return a-c+o}return a}function n(o,a){if(o.waypoints)return H2(a,o);if(o.width)return{x:u_(o.width/2+o.x),y:u_(o.height/2+o.y)}}function i(o){var a=o.context,s=a.snapPoints,c=a.connection,u=c.waypoints,l=a.segmentStart,p=a.segmentStartIndex,f=a.segmentEnd,d=a.segmentEndIndex,g=a.axis;if(s)return s;var h=[u[p-1],l,f,u[d+1]];return p<2&&h.unshift(n(c.source,o)),d>u.length-3&&h.unshift(n(c.target,o)),a.snapPoints=s={horizontal:[],vertical:[]},L(h,function(m){m&&(m=m.original||m,g==="y"&&s.horizontal.push(m.y),g==="x"&&s.vertical.push(m.x))}),s}e.on("connectionSegment.move.move",1500,function(o){var a=i(o),s=o.x,c=o.y,u,l;if(a){u=t(a.vertical,s),l=t(a.horizontal,c);var p=s-u,f=c-l;H(o,{dx:o.dx-p,dy:o.dy-f,x:u,y:l}),(p||a.vertical.indexOf(s)!==-1)&&Dt(o,"x",u),(f||a.horizontal.indexOf(c)!==-1)&&Dt(o,"y",l)}});function r(o){var a=o.snapPoints,s=o.connection.waypoints,c=o.bendpointIndex;if(a)return a;var u=[s[c-1],s[c+1]];return o.snapPoints=a={horizontal:[],vertical:[]},L(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||(Dt(o,"x",c.x),Dt(o,"y",c.y))}),e.on(["bendpoint.move.move","bendpoint.move.end"],1500,function(o){var a=o.context,s=r(a),c=a.hover,u=c&&n(c,o),l=o.x,p=o.y,f,d;if(s){f=t(u?s.vertical.concat([u.x]):s.vertical,l),d=t(u?s.horizontal.concat([u.y]):s.horizontal,p);var g=l-f,h=p-d;H(o,{dx:o.dx-g,dy:o.dy-h,x:o.x-g,y:o.y-h}),(g||s.vertical.indexOf(l)!==-1)&&Dt(o,"x",f),(h||s.horizontal.indexOf(p)!==-1)&&Dt(o,"y",d)}})}l_.$inject=["eventBus"];const Z2={__depends__:[Ni,mi],__init__:["bendpoints","bendpointSnapping","bendpointMovePreview"],bendpoints:["type",Wb],bendpointMove:["type",Tf],bendpointMovePreview:["type",Qb],connectionSegmentMove:["type",r_],bendpointSnapping:["type",l_]};function p_(e,t,n,i){function r(a,s){return i.allowed("connection.create",{source:a,target:s})}function o(a,s){return r(s,a)}e.on("connect.hover",function(a){var s=a.context,c=s.start,u=a.hover,l;if(s.hover=u,l=s.canExecute=r(c,u),!Qr(l)){if(l!==!1){s.source=c,s.target=u;return}l=s.canExecute=o(c,u),!Qr(l)&&l!==!1&&(s.source=u,s.target=c)}}),e.on(["connect.out","connect.cleanup"],function(a){var s=a.context;s.hover=null,s.source=null,s.target=null,s.canExecute=!1}),e.on("connect.end",function(a){var s=a.context,c=s.canExecute,u=s.connectionStart,l={x:a.x,y:a.y},p=s.source,f=s.target;if(!c)return!1;var d=null,g={connectionStart:Of(s)?l:u,connectionEnd:Of(s)?u:l};Vt(c)&&(d=c),s.connection=n.connect(p,f,d,g)}),this.start=function(a,s,c,u){Vt(c)||(u=c,c=Oe(s)),t.init(a,"connect",{autoActivate:u,data:{shape:s,context:{start:s,connectionStart:c}}})}}p_.$inject=["eventBus","dragging","modeling","rules"];function Of(e){var t=e.hover,n=e.source,i=e.target;return t&&n&&t===n&&n!==i}var Q2=1100,J2=900,f_="connect-ok",d_="connect-not-ok";function h_(e,t,n){var i=e.get("connectionPreview",!1);i&&t.on("connect.move",function(r){var o=r.context,a=o.canExecute,s=o.hover,c=o.source,u=o.start,l=o.startPosition,p=o.target,f=o.connectionStart||l,d=o.connectionEnd||{x:r.x,y:r.y},g=f,h=d;Of(o)&&(g=d,h=f),i.drawPreview(o,a,{source:c||u,target:p||s,connectionStart:g,connectionEnd:h})}),t.on("connect.hover",J2,function(r){var o=r.context,a=r.hover,s=o.canExecute;s!==null&&n.addMarker(a,s?f_:d_)}),t.on(["connect.out","connect.cleanup"],Q2,function(r){var o=r.hover;o&&(n.removeMarker(o,f_),n.removeMarker(o,d_))}),i&&t.on("connect.cleanup",function(r){i.cleanUp(r.context)})}h_.$inject=["injector","eventBus","canvas"];const Df={__depends__:[Vn,mi,Ni],__init__:["connectPreview"],connect:["type",p_],connectPreview:["type",h_]};var ek="djs-dragger";function Gi(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)}Gi.$inject=["injector","canvas","graphicsFactory","elementFactory"],Gi.prototype.drawPreview=function(e,t,n){n=n||{};var i=e.connectionPreviewGfx,r=e.getConnection,o=n.source,a=n.target,s=n.waypoints,c=n.connectionStart,u=n.connectionEnd,l=n.noLayout,p=n.noCropping,f=n.noNoop,d,g=this;if(i||(i=e.connectionPreviewGfx=this.createConnectionPreviewGfx()),Es(i),r||(r=e.getConnection=tk(function(h,m,E){return g.getConnection(h,m,E)})),t&&(d=r(t,o,a)),!d){!f&&this.drawNoopPreview(i,n);return}d.waypoints=s||[],this._layouter&&!l&&(d.waypoints=this._layouter.layoutConnection(d,{source:o,target:a,connectionStart:c,connectionEnd:u,waypoints:n.waypoints||d.waypoints})),(!d.waypoints||!d.waypoints.length)&&(d.waypoints=[o?Oe(o):c,a?Oe(a):u]),this._connectionDocking&&(o||a)&&!p&&(d.waypoints=this._connectionDocking.getCroppedWaypoints(d,o,a)),this._graphicsFactory.drawConnection(i,d,{stroke:"var(--element-dragger-color)"})},Gi.prototype.drawNoopPreview=function(e,t){var n=t.source,i=t.target,r=t.connectionStart||Oe(n),o=t.connectionEnd||Oe(i),a=this.cropWaypoints(r,o,n,i),s=this.createNoopConnection(a[0],a[1]);Be(e,s)},Gi.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&&ta(o,s,!0)||e,t=i&&ta(a,s,!1)||t,[e,t]},Gi.prototype.cleanUp=function(e){e&&e.connectionPreviewGfx&&$t(e.connectionPreviewGfx)},Gi.prototype.getConnection=function(e){var t=nk(e);return this._elementFactory.createConnection(t)},Gi.prototype.createConnectionPreviewGfx=function(){var e=Ce("g");return he(e,{pointerEvents:"none"}),qe(e).add(ek),Be(this._canvas.getActiveLayer(),e),e},Gi.prototype.createNoopConnection=function(e,t){return Zo([e,t],{stroke:"#333",strokeDasharray:[1],strokeWidth:2,"pointer-events":"none"})};function tk(e){var t={};return function(n){var i=JSON.stringify(n),r=t[i];return r||(r=t[i]=e.apply(null,arguments)),r}}function nk(e){return Vt(e)?e:{}}const ik={__init__:["connectionPreview"],connectionPreview:["type",Gi]},cu="complex-preview";class m_{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(cu);n.filter(s=>!rk(s)).forEach(s=>{let c;st(s)?(c=this._graphicsFactory._createContainer("connection",Ce("g")),this._graphicsFactory.drawConnection(Dr(c),s)):(c=this._graphicsFactory._createContainer("shape",Ce("g")),this._graphicsFactory.drawShape(Dr(c),s),en(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)?en(u,c.x,c.y):en(u,s.x+c.x,s.y+c.y)}),r.forEach(s=>{this._previewSupport.addDragger(s,a,void 0,"djs-dragging"),this._canvas.addMarker(s,"djs-element-hidden"),this._markers.push([s,"djs-element-hidden"])}),o.forEach(({shape:s,bounds:c})=>{this._canvas.addMarker(s,"djs-hidden"),this._markers.push([s,"djs-hidden"]),this._previewSupport.addDragger(s,a,void 0,"djs-dragging");const u=this._graphicsFactory._createContainer("shape",Ce("g"));this._graphicsFactory.drawShape(Dr(u),s,{width:c.width,height:c.height}),en(u,c.x,c.y),this._previewSupport.addDragger(s,a,u)})}cleanUp(){Es(this._canvas.getLayer(cu)),this._markers.forEach(([t,n])=>this._canvas.removeMarker(t,n)),this._markers=[]}show(){this._canvas.showLayer(cu)}hide(){this._canvas.hideLayer(cu)}}m_.$inject=["canvas","graphicsFactory","previewSupport"];function rk(e){return e.hidden}const ok={__depends__:[Ao],__init__:["complexPreview"],complexPreview:["type",m_]},g_=Math.round;function uu(e,t,n,i,r,o){this._complexPreview=e,this._connectionDocking=t,this._elementFactory=n,this._eventBus=i,this._layouter=r,this._rules=o}uu.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(H({type:t},n)),l=a.fire("autoPlace",{source:e,shape:u});if(!l)return;H(u,{x:l.x-g_(u.width/2),y:l.y-g_(u.height/2)});const p=c.allowed("connection.create",{source:e,target:u,hints:{targetParent:e.parent}});let f=null;p&&(f=o.createConnection(p),f.waypoints=s.layoutConnection(f,{source:e,target:u}),f.waypoints=r.getCroppedWaypoints(f,e,u)),i.create({created:[u,f].filter(d=>!Qr(d))})},uu.prototype.cleanUp=function(){this._complexPreview.cleanUp()},uu.$inject=["complexPreview","connectionDocking","elementFactory","eventBus","layouter","rules"];const ak={__depends__:[Nc,ok,of],__init__:["appendPreview"],appendPreview:["type",uu]};var y_=Math.min,v_=Math.max;function Lf(e){e.preventDefault()}function za(e){e.stopPropagation()}function sk(e){return e.nodeType===Node.TEXT_NODE}function ck(e){return[].slice.call(e)}function ei(e){this.container=e.container,this.parent=ft('<div class="djs-direct-editing-parent"><div class="djs-direct-editing-content" contenteditable="true"></div></div>'),this.content=ot("[contenteditable]",this.parent),this.keyHandler=e.keyHandler||function(){},this.resizeHandler=e.resizeHandler||function(){},this.focusoutHandler=e.focusoutHandler||function(){},this.autoResize=mn(this.autoResize,this),this.handlePaste=mn(this.handlePaste,this)}ei.prototype.create=function(e,t,n,i){var r=this,o=this.parent,a=this.content,s=this.container;i=this.options=i||{},t=this.style=t||{};var c=Qn(t,["width","height","maxWidth","maxHeight","minWidth","minHeight","left","top","backgroundColor","position","overflow","border","wordWrap","textAlign","outline","transform"]);H(o.style,{width:e.width+"px",height:e.height+"px",maxWidth:e.maxWidth+"px",maxHeight:e.maxHeight+"px",minWidth:e.minWidth+"px",minHeight:e.minHeight+"px",left:e.x+"px",top:e.y+"px",backgroundColor:"#ffffff",position:"absolute",overflow:"visible",border:"1px solid #ccc",boxSizing:"border-box",wordWrap:"normal",textAlign:"center",outline:"none"},c);var u=Qn(t,["fontFamily","fontSize","fontWeight","lineHeight","padding","paddingTop","paddingRight","paddingBottom","paddingLeft"]);return H(a.style,{boxSizing:"border-box",width:"100%",outline:"none",wordWrap:"break-word"},u),i.centerVertically&&H(a.style,{position:"absolute",top:"50%",transform:"translate(0, -50%)"},u),a.innerText=n,Ne.bind(a,"keydown",this.keyHandler),Ne.bind(a,"mousedown",za),Ne.bind(a,"paste",r.handlePaste),Ne.bind(a,"focusout",this.focusoutHandler),i.autoResize&&Ne.bind(a,"input",this.autoResize),i.resizable&&this.resizable(t),s.appendChild(o),this.setSelection(a.lastChild,a.lastChild&&a.lastChild.length),o},ei.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)}},ei.prototype.insertText=function(e){e=uk(e);var t=document.execCommand("insertText",!1,e);t||this._insertTextIE(e)},ei.prototype._insertTextIE=function(e){var t=this.getSelection(),n=t.startContainer,i=t.endContainer,r=t.startOffset,o=t.endOffset,a=t.commonAncestorContainer,s=ck(a.childNodes),c,u;if(sk(a)){var l=n.textContent;n.textContent=l.substring(0,r)+e+l.substring(o),c=n,u=r+e.length}else if(n===this.content&&i===this.content){var p=document.createTextNode(e);this.content.insertBefore(p,s[r]),c=p,u=p.textContent.length}else{var f=s.indexOf(n),d=s.indexOf(i);s.forEach(function(g,h){h===f?g.textContent=n.textContent.substring(0,r)+e+i.textContent.substring(o):h>f&&h<=d&&ui(g)}),c=n,u=r+e.length}c&&u!==void 0&&setTimeout(function(){self.setSelection(c,u)})},ei.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})}},ei.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=ft('<div class="djs-direct-editing-resize-handle"></div>');var s,c,u,l,p=function(g){Lf(g),za(g),s=g.clientX,c=g.clientY;var h=t.getBoundingClientRect();u=h.width,l=h.height,Ne.bind(document,"mousemove",f),Ne.bind(document,"mouseup",d)},f=function(g){Lf(g),za(g);var h=y_(v_(u+g.clientX-s,i),o),m=y_(v_(l+g.clientY-c,r),a);t.style.width=h+"px",t.style.height=m+"px",e.resizeHandler({width:u,height:l,dx:g.clientX-s,dy:g.clientY-c})},d=function(g){Lf(g),za(g),Ne.unbind(document,"mousemove",f,!1),Ne.unbind(document,"mouseup",d,!1)};Ne.bind(n,"mousedown",p)}H(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)},ei.prototype.destroy=function(){var e=this.parent,t=this.content,n=this.resizeHandle;t.innerText="",e.removeAttribute("style"),t.removeAttribute("style"),Ne.unbind(t,"keydown",this.keyHandler),Ne.unbind(t,"mousedown",za),Ne.unbind(t,"input",this.autoResize),Ne.unbind(t,"paste",this.handlePaste),Ne.unbind(t,"focusout",this.focusoutHandler),n&&(n.removeAttribute("style"),ui(n)),ui(e)},ei.prototype.getValue=function(){return this.content.innerText.trim()},ei.prototype.getSelection=function(){var e=window.getSelection(),t=e.getRangeAt(0);return t},ei.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 uk(e){return e.replace(/\r\n|\r|\n/g,`
316
+ `)}function Dn(e,t){this._eventBus=e,this._canvas=t,this._providers=[],this._textbox=new ei({container:t.getContainer(),keyHandler:mn(this._handleKey,this),resizeHandler:mn(this._handleResize,this),focusoutHandler:mn(this._handleFocusout,this)}),e.on(["diagram.clear","diagram.destroy"],()=>this._cleanup())}Dn.$inject=["eventBus","canvas"],Dn.prototype.registerProvider=function(e){this._providers.push(e)},Dn.prototype.isActive=function(e){return!!(this._active&&(!e||this._active.element===e))},Dn.prototype.cancel=function(){this._active&&(this._fire("cancel"),this.close())},Dn.prototype._fire=function(e,t){this._eventBus.fire("directEditing."+e,t||{active:this._active})},Dn.prototype.close=function(){this._fire("deactivate"),this._cleanup(),this._canvas.restoreFocus&&this._canvas.restoreFocus()},Dn.prototype._cleanup=function(){this._active&&(this._textbox.destroy(),this._active=null,this.resizable=void 0)},Dn.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()}},Dn.prototype.getValue=function(){return this._textbox.getValue()},Dn.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()},Dn.prototype._handleResize=function(e){this._fire("resize",e)},Dn.prototype._handleFocusout=function(e){e.relatedTarget&&this._textbox.parent.contains(e.relatedTarget)||this.complete()},Dn.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 b_={__depends__:[fc],__init__:["directEditing"],directEditing:["type",Dn]};function lk(e){return function(t){var n=t.target,i=te(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===Ue(e);return!o||!a||!s||!c}}const pk={task:{label:"Task",className:"bpmn-icon-task",target:{type:"bpmn:Task"}},"user-task":{label:"User task",className:"bpmn-icon-user",target:{type:"bpmn:UserTask"}},"service-task":{label:"Service task",className:"bpmn-icon-service",target:{type:"bpmn:ServiceTask"}},"send-task":{label:"Send task",className:"bpmn-icon-send",target:{type:"bpmn:SendTask"}},"receive-task":{label:"Receive task",className:"bpmn-icon-receive",target:{type:"bpmn:ReceiveTask"}},"manual-task":{label:"Manual task",className:"bpmn-icon-manual",target:{type:"bpmn:ManualTask"}},"rule-task":{label:"Business rule task",className:"bpmn-icon-business-rule",target:{type:"bpmn:BusinessRuleTask"}},"script-task":{label:"Script task",className:"bpmn-icon-script",target:{type:"bpmn:ScriptTask"}},"call-activity":{label:"Call activity",className:"bpmn-icon-call-activity",target:{type:"bpmn:CallActivity"}},transaction:{label:"Transaction",className:"bpmn-icon-transaction",target:{type:"bpmn:Transaction",isExpanded:!0}},"event-subprocess":{label:"Event sub-process",className:"bpmn-icon-event-subprocess-expanded",target:{type:"bpmn:SubProcess",triggeredByEvent:!0,isExpanded:!0}},"collapsed-subprocess":{label:"Sub-process (collapsed)",className:"bpmn-icon-subprocess-collapsed",target:{type:"bpmn:SubProcess",isExpanded:!1}},"expanded-subprocess":{label:"Sub-process (expanded)",className:"bpmn-icon-subprocess-expanded",target:{type:"bpmn:SubProcess",isExpanded:!0}},"collapsed-ad-hoc-subprocess":{label:"Ad-hoc sub-process (collapsed)",className:"bpmn-icon-subprocess-collapsed",target:{type:"bpmn:AdHocSubProcess",isExpanded:!1}},"expanded-ad-hoc-subprocess":{label:"Ad-hoc sub-process (expanded)",className:"bpmn-icon-subprocess-expanded",target:{type:"bpmn:AdHocSubProcess",isExpanded:!0}},"exclusive-gateway":{label:"Exclusive gateway",className:"bpmn-icon-gateway-xor",target:{type:"bpmn:ExclusiveGateway"}},"parallel-gateway":{label:"Parallel gateway",className:"bpmn-icon-gateway-parallel",target:{type:"bpmn:ParallelGateway"}},"inclusive-gateway":{label:"Inclusive gateway",className:"bpmn-icon-gateway-or",target:{type:"bpmn:InclusiveGateway"}},"complex-gateway":{label:"Complex gateway",className:"bpmn-icon-gateway-complex",target:{type:"bpmn:ComplexGateway"}},"event-based-gateway":{label:"Event-based gateway",className:"bpmn-icon-gateway-eventbased",target:{type:"bpmn:EventBasedGateway",instantiate:!1,eventGatewayType:"Exclusive"}},"data-store-reference":{label:"Data store reference",className:"bpmn-icon-data-store",target:{type:"bpmn:DataStoreReference"}},"data-object-reference":{label:"Data object reference",className:"bpmn-icon-data-object",target:{type:"bpmn:DataObjectReference"}},"expanded-pool":{label:"Expanded pool/participant",className:"bpmn-icon-participant",target:{type:"bpmn:Participant",isExpanded:!0}},"collapsed-pool":{label:"Empty pool/participant",className:"bpmn-icon-lane",target:{type:"bpmn:Participant",isExpanded:!1}},"none-start-event":{label:"Start event",className:"bpmn-icon-start-event-none",target:{type:"bpmn:StartEvent"}},"none-intermediate-throwing":{label:"Intermediate throw event",className:"bpmn-icon-intermediate-event-none",target:{type:"bpmn:IntermediateThrowEvent"}},"none-boundary-event":{label:"Boundary event",className:"bpmn-icon-intermediate-event-none",target:{type:"bpmn:BoundaryEvent"}},"none-end-event":{label:"End event",className:"bpmn-icon-end-event-none",target:{type:"bpmn:EndEvent"}},"message-start":{label:"Message start event",className:"bpmn-icon-start-event-message",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:MessageEventDefinition",isInterrupting:!0}},"timer-start":{label:"Timer start event",className:"bpmn-icon-start-event-timer",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:TimerEventDefinition",isInterrupting:!0}},"conditional-start":{label:"Conditional start event",className:"bpmn-icon-start-event-condition",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:ConditionalEventDefinition",isInterrupting:!0}},"signal-start":{label:"Signal start event",className:"bpmn-icon-start-event-signal",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:SignalEventDefinition",isInterrupting:!0}},"error-start":{label:"Error start event",className:"bpmn-icon-start-event-error",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:ErrorEventDefinition",isInterrupting:!0}},"escalation-start":{label:"Escalation start event",className:"bpmn-icon-start-event-escalation",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:EscalationEventDefinition",isInterrupting:!0}},"compensation-start":{label:"Compensation start event",className:"bpmn-icon-start-event-compensation",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:CompensateEventDefinition",isInterrupting:!0}},"non-interrupting-message-start":{label:"Message start event (non-interrupting)",className:"bpmn-icon-start-event-non-interrupting-message",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:MessageEventDefinition",isInterrupting:!1}},"non-interrupting-timer-start":{label:"Timer start event (non-interrupting)",className:"bpmn-icon-start-event-non-interrupting-timer",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:TimerEventDefinition",isInterrupting:!1}},"non-interrupting-conditional-start":{label:"Conditional start event (non-interrupting)",className:"bpmn-icon-start-event-non-interrupting-condition",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:ConditionalEventDefinition",isInterrupting:!1}},"non-interrupting-signal-start":{label:"Signal start event (non-interrupting)",className:"bpmn-icon-start-event-non-interrupting-signal",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:SignalEventDefinition",isInterrupting:!1}},"non-interrupting-escalation-start":{label:"Escalation start event (non-interrupting)",className:"bpmn-icon-start-event-non-interrupting-escalation",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:EscalationEventDefinition",isInterrupting:!1}},"message-intermediate-catch":{label:"Message intermediate catch event",className:"bpmn-icon-intermediate-event-catch-message",target:{type:"bpmn:IntermediateCatchEvent",eventDefinitionType:"bpmn:MessageEventDefinition"}},"message-intermediate-throw":{label:"Message intermediate throw event",className:"bpmn-icon-intermediate-event-throw-message",target:{type:"bpmn:IntermediateThrowEvent",eventDefinitionType:"bpmn:MessageEventDefinition"}},"timer-intermediate-catch":{label:"Timer intermediate catch event",className:"bpmn-icon-intermediate-event-catch-timer",target:{type:"bpmn:IntermediateCatchEvent",eventDefinitionType:"bpmn:TimerEventDefinition"}},"escalation-intermediate-throw":{label:"Escalation intermediate throw event",className:"bpmn-icon-intermediate-event-throw-escalation",target:{type:"bpmn:IntermediateThrowEvent",eventDefinitionType:"bpmn:EscalationEventDefinition"}},"conditional-intermediate-catch":{label:"Conditional intermediate catch event",className:"bpmn-icon-intermediate-event-catch-condition",target:{type:"bpmn:IntermediateCatchEvent",eventDefinitionType:"bpmn:ConditionalEventDefinition"}},"link-intermediate-catch":{label:"Link intermediate catch event",className:"bpmn-icon-intermediate-event-catch-link",target:{type:"bpmn:IntermediateCatchEvent",eventDefinitionType:"bpmn:LinkEventDefinition",eventDefinitionAttrs:{name:""}}},"link-intermediate-throw":{label:"Link intermediate throw event",className:"bpmn-icon-intermediate-event-throw-link",target:{type:"bpmn:IntermediateThrowEvent",eventDefinitionType:"bpmn:LinkEventDefinition",eventDefinitionAttrs:{name:""}}},"compensation-intermediate-throw":{label:"Compensation intermediate throw event",className:"bpmn-icon-intermediate-event-throw-compensation",target:{type:"bpmn:IntermediateThrowEvent",eventDefinitionType:"bpmn:CompensateEventDefinition"}},"signal-intermediate-catch":{label:"Signal intermediate catch event",className:"bpmn-icon-intermediate-event-catch-signal",target:{type:"bpmn:IntermediateCatchEvent",eventDefinitionType:"bpmn:SignalEventDefinition"}},"signal-intermediate-throw":{label:"Signal intermediate throw event",className:"bpmn-icon-intermediate-event-throw-signal",target:{type:"bpmn:IntermediateThrowEvent",eventDefinitionType:"bpmn:SignalEventDefinition"}},"message-boundary":{label:"Message boundary event",className:"bpmn-icon-intermediate-event-catch-message",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:MessageEventDefinition",cancelActivity:!0}},"timer-boundary":{label:"Timer boundary event",className:"bpmn-icon-intermediate-event-catch-timer",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:TimerEventDefinition",cancelActivity:!0}},"escalation-boundary":{label:"Escalation boundary event",className:"bpmn-icon-intermediate-event-catch-escalation",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:EscalationEventDefinition",cancelActivity:!0}},"conditional-boundary":{label:"Conditional boundary event",className:"bpmn-icon-intermediate-event-catch-condition",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:ConditionalEventDefinition",cancelActivity:!0}},"error-boundary":{label:"Error boundary event",className:"bpmn-icon-intermediate-event-catch-error",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:ErrorEventDefinition",cancelActivity:!0}},"cancel-boundary":{label:"Cancel boundary event",className:"bpmn-icon-intermediate-event-catch-cancel",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:CancelEventDefinition",cancelActivity:!0}},"signal-boundary":{label:"Signal boundary event",className:"bpmn-icon-intermediate-event-catch-signal",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:SignalEventDefinition",cancelActivity:!0}},"compensation-boundary":{label:"Compensation boundary event",className:"bpmn-icon-intermediate-event-catch-compensation",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:CompensateEventDefinition",cancelActivity:!0}},"non-interrupting-message-boundary":{label:"Message boundary event (non-interrupting)",className:"bpmn-icon-intermediate-event-catch-non-interrupting-message",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:MessageEventDefinition",cancelActivity:!1}},"non-interrupting-timer-boundary":{label:"Timer boundary event (non-interrupting)",className:"bpmn-icon-intermediate-event-catch-non-interrupting-timer",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:TimerEventDefinition",cancelActivity:!1}},"non-interrupting-escalation-boundary":{label:"Escalation boundary event (non-interrupting)",className:"bpmn-icon-intermediate-event-catch-non-interrupting-escalation",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:EscalationEventDefinition",cancelActivity:!1}},"non-interrupting-conditional-boundary":{label:"Conditional boundary event (non-interrupting)",className:"bpmn-icon-intermediate-event-catch-non-interrupting-condition",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:ConditionalEventDefinition",cancelActivity:!1}},"non-interrupting-signal-boundary":{label:"Signal boundary event (non-interrupting)",className:"bpmn-icon-intermediate-event-catch-non-interrupting-signal",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:SignalEventDefinition",cancelActivity:!1}},"message-end":{label:"Message end event",className:"bpmn-icon-end-event-message",target:{type:"bpmn:EndEvent",eventDefinitionType:"bpmn:MessageEventDefinition"}},"escalation-end":{label:"Escalation end event",className:"bpmn-icon-end-event-escalation",target:{type:"bpmn:EndEvent",eventDefinitionType:"bpmn:EscalationEventDefinition"}},"error-end":{label:"Error end event",className:"bpmn-icon-end-event-error",target:{type:"bpmn:EndEvent",eventDefinitionType:"bpmn:ErrorEventDefinition"}},"cancel-end":{label:"Cancel end event",className:"bpmn-icon-end-event-cancel",target:{type:"bpmn:EndEvent",eventDefinitionType:"bpmn:CancelEventDefinition"}},"compensation-end":{label:"Compensation end event",className:"bpmn-icon-end-event-compensation",target:{type:"bpmn:EndEvent",eventDefinitionType:"bpmn:CompensateEventDefinition"}},"signal-end":{label:"Signal end event",className:"bpmn-icon-end-event-signal",target:{type:"bpmn:EndEvent",eventDefinitionType:"bpmn:SignalEventDefinition"}},"terminate-end":{label:"Terminate end event",className:"bpmn-icon-end-event-terminate",target:{type:"bpmn:EndEvent",eventDefinitionType:"bpmn:TerminateEventDefinition"}}};function Q(e,t={}){var n=pk[e];if(!n)throw new Error("unknown popup entry <"+e+">");return{...n,actionName:"replace-with-"+e,...t}}var fk=[Q("none-start-event",{actionName:"replace-with-none-start"}),Q("none-intermediate-throwing"),Q("none-end-event",{actionName:"replace-with-none-end"}),Q("message-start"),Q("timer-start"),Q("conditional-start"),Q("signal-start")],dk=[Q("none-start-event",{actionName:"replace-with-none-start"}),Q("none-intermediate-throwing"),Q("none-end-event",{actionName:"replace-with-none-end"})],hk=[Q("none-start-event",{actionName:"replace-with-none-start"}),Q("none-intermediate-throwing",{actionName:"replace-with-none-intermediate-throw"}),Q("none-end-event",{actionName:"replace-with-none-end"}),Q("message-intermediate-catch"),Q("message-intermediate-throw"),Q("timer-intermediate-catch"),Q("escalation-intermediate-throw"),Q("conditional-intermediate-catch"),Q("link-intermediate-catch"),Q("link-intermediate-throw"),Q("compensation-intermediate-throw"),Q("signal-intermediate-catch"),Q("signal-intermediate-throw")],mk=[Q("none-start-event",{actionName:"replace-with-none-start"}),Q("none-intermediate-throwing",{actionName:"replace-with-none-intermediate-throw"}),Q("none-end-event",{actionName:"replace-with-none-end"}),Q("message-end"),Q("escalation-end"),Q("error-end"),Q("cancel-end"),Q("compensation-end"),Q("signal-end"),Q("terminate-end")],gk=[Q("exclusive-gateway"),Q("parallel-gateway"),Q("inclusive-gateway"),Q("complex-gateway"),Q("event-based-gateway")],yk=[Q("transaction"),Q("event-subprocess"),Q("expanded-ad-hoc-subprocess",{actionName:"replace-with-ad-hoc-subprocess",label:"Ad-hoc sub-process"}),Q("collapsed-subprocess")],vk=[Q("expanded-subprocess",{actionName:"replace-with-subprocess",label:"Sub-process"}),Q("transaction"),Q("event-subprocess"),Q("collapsed-ad-hoc-subprocess")],__=[Q("transaction"),Q("expanded-subprocess",{actionName:"replace-with-subprocess",label:"Sub-process"}),Q("expanded-ad-hoc-subprocess",{actionName:"replace-with-ad-hoc-subprocess",label:"Ad-hoc sub-process"}),Q("event-subprocess")],bk=__,x_=[Q("task"),Q("user-task"),Q("service-task"),Q("send-task"),Q("receive-task"),Q("manual-task"),Q("rule-task"),Q("script-task"),Q("call-activity"),Q("collapsed-subprocess"),Q("expanded-subprocess"),Q("collapsed-ad-hoc-subprocess"),Q("expanded-ad-hoc-subprocess",{actionName:"replace-with-ad-hoc-subprocess"})],_k=[Q("data-store-reference")],xk=[Q("data-object-reference")],wk=[Q("message-boundary"),Q("timer-boundary"),Q("escalation-boundary"),Q("conditional-boundary"),Q("error-boundary"),Q("cancel-boundary"),Q("signal-boundary"),Q("compensation-boundary"),Q("non-interrupting-message-boundary"),Q("non-interrupting-timer-boundary"),Q("non-interrupting-escalation-boundary"),Q("non-interrupting-conditional-boundary"),Q("non-interrupting-signal-boundary")],Ek=[Q("message-start"),Q("timer-start"),Q("conditional-start"),Q("signal-start"),Q("error-start"),Q("escalation-start"),Q("compensation-start"),Q("non-interrupting-message-start"),Q("non-interrupting-timer-start"),Q("non-interrupting-conditional-start"),Q("non-interrupting-signal-start"),Q("non-interrupting-escalation-start")],Sk=[{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"}],Rk=[Q("expanded-pool"),Q("collapsed-pool",{label:function(e){var t="Empty pool/participant";return e.children&&e.children.length&&(t+=" (removes content)"),t}})],Ck={"bpmn:MessageEventDefinition":[Q("message-start"),Q("message-intermediate-catch"),Q("message-intermediate-throw"),Q("message-end")],"bpmn:TimerEventDefinition":[Q("timer-start"),Q("timer-intermediate-catch")],"bpmn:ConditionalEventDefinition":[Q("conditional-start"),Q("conditional-intermediate-catch")],"bpmn:SignalEventDefinition":[Q("signal-start"),Q("signal-intermediate-catch"),Q("signal-intermediate-throw"),Q("signal-end")],"bpmn:ErrorEventDefinition":[Q("error-start"),Q("error-end")],"bpmn:EscalationEventDefinition":[Q("escalation-start"),Q("escalation-intermediate-throw"),Q("escalation-end")],"bpmn:CompensateEventDefinition":[Q("compensation-start"),Q("compensation-intermediate-throw"),Q("compensation-end")]};const w_={"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 Kn(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()}Kn.$inject=["bpmnFactory","popupMenu","modeling","moddle","bpmnReplace","rules","translate","moddleCopy"],Kn.prototype._register=function(){this._popupMenu.registerProvider("bpmn-replace",this)},Kn.prototype.getPopupMenuEntries=function(e){var s;var t=e.businessObject,n=this._rules,i=[],r,o=[];if(Ae(e)||!n.allowed("shape.replace",{element:e}))return{};var a=lk(e);return _(t,"bpmn:DataObjectReference")?this._createEntries(e,_k):_(t,"bpmn:DataStoreReference")&&!_(e.parent,"bpmn:Collaboration")?this._createEntries(e,xk):(_(t,"bpmn:Event")&&!_(t,"bpmn:BoundaryEvent")&&(r=(s=t.get("eventDefinitions")[0])==null?void 0:s.$type,i=Ck[r]||[],!fn(t.$parent)&&_(t.$parent,"bpmn:SubProcess")&&(i=ze(i,function(c){return c.target.type!=="bpmn:StartEvent"}))),_(t,"bpmn:StartEvent")&&!_(t.$parent,"bpmn:SubProcess")?(o=ze(fk.concat(i),a),this._createEntries(e,o)):_(t,"bpmn:Participant")?(o=ze(Rk,function(c){return qe(e)!==c.target.isExpanded}),this._createEntries(e,o)):_(t,"bpmn:StartEvent")&&fn(t.$parent)?(o=ze(Ek.concat(i),function(c){var u=c.target,l=u.isInterrupting!==!1,p=t.isInterrupting===l;return a(c)||!a(c)&&!p}),this._createEntries(e,o)):_(t,"bpmn:StartEvent")&&!fn(t.$parent)&&_(t.$parent,"bpmn:SubProcess")?(o=ze(dk.concat(i),a),this._createEntries(e,o)):_(t,"bpmn:EndEvent")?(o=ze(mk.concat(i),function(c){var u=c.target;return u.eventDefinitionType=="bpmn:CancelEventDefinition"&&!_(t.$parent,"bpmn:Transaction")?!1:a(c)}),this._createEntries(e,o)):_(t,"bpmn:BoundaryEvent")?(o=ze(wk,function(c){var u=c.target;if(u.eventDefinitionType=="bpmn:CancelEventDefinition"&&!_(t.attachedToRef,"bpmn:Transaction"))return!1;var l=u.cancelActivity!==!1,p=t.cancelActivity==l;return a(c)||!a(c)&&!p}),this._createEntries(e,o)):_(t,"bpmn:IntermediateCatchEvent")||_(t,"bpmn:IntermediateThrowEvent")?(o=ze(hk.concat(i),a),this._createEntries(e,o)):_(t,"bpmn:Gateway")?(o=ze(gk,a),this._createEntries(e,o)):_(t,"bpmn:Transaction")?(o=ze(v_,a),this._createEntries(e,o)):fn(t)&&qe(e)?(o=ze(bk,a),this._createEntries(e,o)):_(t,"bpmn:AdHocSubProcess")&&qe(e)?(o=ze(vk,a),this._createEntries(e,o)):_(t,"bpmn:SubProcess")&&qe(e)?(o=ze(yk,a),this._createEntries(e,o)):_(t,"bpmn:SubProcess")&&!qe(e)?(o=ze(b_,function(c){var u=c.target.type===e.type,l=c.target.isExpanded===!0;return u===l}),this._createEntries(e,o)):_(t,"bpmn:SequenceFlow")?this._createSequenceFlowEntries(e,Sk):_(t,"bpmn:FlowNode")?(o=ze(b_,a),this._createEntries(e,o)):{})},Kn.prototype.getPopupMenuHeaderEntries=function(e){var t={};return _(e,"bpmn:Activity")&&!fn(e)&&(t={...t,...this._getLoopCharacteristicsHeaderEntries(e)}),_(e,"bpmn:DataObjectReference")&&(t={...t,...this._getCollectionHeaderEntries(e)}),_(e,"bpmn:Participant")&&(t={...t,...this._getParticipantMultiplicityHeaderEntries(e)}),mg(e)&&(t={...t,...this._getNonInterruptingHeaderEntries(e)}),t},Kn.prototype._createEntries=function(e,t){var n={},i=this;return L(t,function(r){n[r.actionName]=i._createEntry(r,e)}),n},Kn.prototype._createSequenceFlowEntries=function(e,t){var n=te(e),i={},r=this._modeling,o=this._moddle,a=this;return L(t,function(s){switch(s.actionName){case"replace-with-default-flow":n.sourceRef.default!==n&&(_(n.sourceRef,"bpmn:ExclusiveGateway")||_(n.sourceRef,"bpmn:InclusiveGateway")||_(n.sourceRef,"bpmn:ComplexGateway")||_(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&&_(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:_(n.sourceRef,"bpmn:Activity")&&n.conditionExpression&&(i={...i,[s.actionName]:a._createEntry(s,e,function(){r.updateProperties(e,{conditionExpression:void 0})})}),(_(n.sourceRef,"bpmn:ExclusiveGateway")||_(n.sourceRef,"bpmn:InclusiveGateway")||_(n.sourceRef,"bpmn:ComplexGateway")||_(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},Kn.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}},Kn.prototype._getLoopCharacteristicsHeaderEntries=function(e){var t=this,n=this._translate;function i(u,l){if(l.active){t._modeling.updateProperties(e,{loopCharacteristics:void 0});return}var p=e.businessObject.get("loopCharacteristics");p&&_(p,l.options.loopCharacteristics)?t._modeling.updateModdleProperties(e,p,{isSequential:l.options.isSequential}):(p=t._moddle.create(l.options.loopCharacteristics,{isSequential:l.options.isSequential}),t._modeling.updateProperties(e,{loopCharacteristics:p}))}var r=te(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"}}}},Kn.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}}},Kn.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}}},Kn.prototype._getNonInterruptingHeaderEntries=function(e){const t=this._translate,n=te(e),i=this,r=gg(e),o=_(e,"bpmn:BoundaryEvent")?__["intermediate-event-non-interrupting"]:__["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__:[Ef,By,Bc],__init__:["replaceMenuProvider"],replaceMenuProvider:["type",Kn]};function Ga(e,t,n,i,r,o,a,s,c,u,l,p,f){e=e||{},i.registerProvider(this),this._contextPad=i,this._modeling=r,this._elementFactory=o,this._connect=a,this._create=s,this._popupMenu=c,this._canvas=u,this._rules=l,this._translate=p,this._eventBus=n,this._appendPreview=f,e.autoPlace!==!1&&(this._autoPlace=t.get("autoPlace",!1)),n.on("create.end",250,function(d){var g=d.context,h=g.shape;if(!(!ha(d)||!i.isOpen(h))){var m=i.getEntries(h);m.replace&&m.replace.action.click(d,h)}}),n.on("contextPad.close",function(){f.cleanUp()})}Ga.$inject=["config.contextPad","injector","eventBus","contextPad","modeling","elementFactory","connect","create","popupMenu","canvas","rules","translate","appendPreview"],Ga.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},Ga.prototype._isDeleteAllowed=function(e){var t=this._rules.allowed("elements.delete",{elements:e});return Ae(t)?Pr(e,n=>t.includes(n)):t},Ga.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,g()),l;var p=e.businessObject;function f(x,E){r.start(x,E)}function d(x,E){n.removeElements([E])}function g(){return{delete:{group:"edit",className:"bpmn-icon-trash",title:c("Delete"),action:{click:d}}}}function h(x){var E=5,P=t.getPad(x).html,C=P.getBoundingClientRect(),D={x:C.left,y:C.bottom+E};return D}function m(x,E,P,C){function D(k,O){var $=i.createShape(j({type:x},C));o.start(k,$,{source:O})}var A=s?function(k,O){var $=i.createShape(j({type:x},C));s.append(O,$)}:D,I=s?function(k,O){return u.create(O,x,C),()=>{u.cleanUp()}}:null;return{group:"model",className:E,title:P,action:{dragstart:D,click:A,hover:I}}}function S(x){return function(E,P){n.splitLane(P,x),t.open(P,!0)}}if(He(p,["bpmn:Lane","bpmn:Participant"])&&qe(e)){var y=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,E){n.addLane(E,"top")}}}}),y.length<2&&((Zt(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)}}}),(Zt(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,E){n.addLane(E,"bottom")}}}})}return _(p,"bpmn:FlowNode")&&(_(p,"bpmn:EventBasedGateway")?j(l,{"append.receive-task":m("bpmn:ReceiveTask","bpmn-icon-receive-task",c("Append receive task")),"append.message-intermediate-event":m("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-message",c("Append message intermediate catch event"),{eventDefinitionType:"bpmn:MessageEventDefinition"}),"append.timer-intermediate-event":m("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-timer",c("Append timer intermediate catch event"),{eventDefinitionType:"bpmn:TimerEventDefinition"}),"append.condition-intermediate-event":m("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-condition",c("Append conditional intermediate catch event"),{eventDefinitionType:"bpmn:ConditionalEventDefinition"}),"append.signal-intermediate-event":m("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-signal",c("Append signal intermediate catch event"),{eventDefinitionType:"bpmn:SignalEventDefinition"})}):x_(p,"bpmn:BoundaryEvent","bpmn:CompensateEventDefinition")?j(l,{"append.compensation-activity":m("bpmn:Task","bpmn-icon-task",c("Append compensation activity"),{isForCompensation:!0})}):!_(p,"bpmn:EndEvent")&&!p.isForCompensation&&!x_(p,"bpmn:IntermediateThrowEvent","bpmn:LinkEventDefinition")&&!fn(p)&&j(l,{"append.end-event":m("bpmn:EndEvent","bpmn-icon-end-event-none",c("Append end event")),"append.gateway":m("bpmn:ExclusiveGateway","bpmn-icon-gateway-none",c("Append gateway")),"append.append-task":m("bpmn:Task","bpmn-icon-task",c("Append task")),"append.intermediate-event":m("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,E){var P=j(h(E),{cursor:{x:x.x,y:x.y}});a.open(E,"bpmn-replace",P,{title:c("Change element"),width:"var(--bpmn-replace-popup-width, 300px)",search:!0})}}}}),_(p,"bpmn:SequenceFlow")&&j(l,{"append.text-annotation":m("bpmn:TextAnnotation","bpmn-icon-text-annotation",c("Add text annotation"))}),_(p,"bpmn:MessageFlow")&&j(l,{"append.text-annotation":m("bpmn:TextAnnotation","bpmn-icon-text-annotation",c("Add text annotation"))}),He(p,["bpmn:FlowNode","bpmn:InteractionNode","bpmn:DataObjectReference","bpmn:DataStoreReference"])&&j(l,{"append.text-annotation":m("bpmn:TextAnnotation","bpmn-icon-text-annotation",c("Add text annotation")),connect:{group:"connect",className:"bpmn-icon-connection-multi",title:c("Connect to other element"),action:{click:f,dragstart:f}}}),_(p,"bpmn:TextAnnotation")&&j(l,{connect:{group:"connect",className:"bpmn-icon-connection-multi",title:c("Connect using association"),action:{click:f,dragstart:f}}}),He(p,["bpmn:DataObjectReference","bpmn:DataStoreReference"])&&j(l,{connect:{group:"connect",className:"bpmn-icon-connection-multi",title:c("Connect using data input association"),action:{click:f,dragstart:f}}}),_(p,"bpmn:Group")&&j(l,{"append.text-annotation":m("bpmn:TextAnnotation","bpmn-icon-text-annotation",c("Add text annotation"))}),this._isDeleteAllowed([e])&&j(l,g()),l};function x_(e,t,n){var i=e.$instanceOf(t),r=!1,o=e.eventDefinitions||[];return L(o,function(a){a.$type===n&&(r=!0)}),i&&r}const Ak={__depends__:[ak,y_,Xv,Wn,kf,hc,Pk],__init__:["contextPadProvider"],contextPadProvider:["type",Ga]};var Tk={horizontal:["x","width"],vertical:["y","height"]},w_=5;function Ui(e,t){this._modeling=e,this._filters=[],this.registerFilter(function(n){var i=t.allowed("elements.distribute",{elements:n});return Ae(i)?i:i?n:[]})}Ui.$inject=["modeling","rules"],Ui.prototype.registerFilter=function(e){if(typeof e!="function")throw new Error("the filter has to be a function");this._filters.push(e)},Ui.prototype.trigger=function(e,t){var n=this._modeling,i,r;if(!(e.length<3)&&(this._setOrientation(t),r=this._filterElements(e),i=this._createGroups(r),!(i.length<=2)))return n.distributeElements(i,this._axis,this._dimension),i},Ui.prototype._filterElements=function(e){var t=this._filters,n=this._axis,i=this._dimension,r=[].concat(e);return t.length?(L(t,function(o){r=o(r,n,i)}),r):e},Ui.prototype._createGroups=function(e){var t=[],n=this,i=this._axis,r=this._dimension;if(!i)throw new Error('must have a defined "axis" and "dimension"');var o=oi(e,i);return L(o,function(a,s){var c=n._findRange(a,i,r),u,l=t[t.length-1];l&&n._hasIntersection(l.range,c)?t[t.length-1].elements.push(a):(u={range:c,elements:[a]},t.push(u))}),t},Ui.prototype._setOrientation=function(e){var t=Tk[e];this._axis=t[0],this._dimension=t[1]},Ui.prototype._hasIntersection=function(e,t){return Math.max(e.min,e.max)>=Math.min(t.min,t.max)&&Math.min(e.min,e.max)<=Math.max(t.min,t.max)},Ui.prototype._findRange=function(e){var t=e[this._axis],n=e[this._dimension];return{min:t+w_,max:t+n-w_}};const Mk={__init__:["distributeElements"],distributeElements:["type",Ui]};function lu(e){Vn.call(this,e)}lu.$inject=["eventBus"],he(lu,Vn),lu.prototype.init=function(){this.addRule("elements.distribute",function(e){var t=e.elements;return t=ze(t,function(n){var i=He(n,["bpmn:Association","bpmn:BoundaryEvent","bpmn:DataInputAssociation","bpmn:DataOutputAssociation","bpmn:Lane","bpmn:MessageFlow","bpmn:SequenceFlow","bpmn:TextAnnotation"]);return!(n.labelTarget||i)}),t=Cs(t),t.length<3?!1:t})};var E_={horizontal:`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1800 1800">
327
+ </svg>`};function Yn(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()}Yn.$inject=["bpmnFactory","popupMenu","modeling","moddle","bpmnReplace","rules","translate","moddleCopy"],Yn.prototype._register=function(){this._popupMenu.registerProvider("bpmn-replace",this)},Yn.prototype.getPopupMenuEntries=function(e){var s;var t=e.businessObject,n=this._rules,i=[],r,o=[];if(ke(e)||!n.allowed("shape.replace",{element:e}))return{};var a=lk(e);return _(t,"bpmn:DataObjectReference")?this._createEntries(e,_k):_(t,"bpmn:DataStoreReference")&&!_(e.parent,"bpmn:Collaboration")?this._createEntries(e,xk):(_(t,"bpmn:Event")&&!_(t,"bpmn:BoundaryEvent")&&(r=(s=t.get("eventDefinitions")[0])==null?void 0:s.$type,i=Ck[r]||[],!un(t.$parent)&&_(t.$parent,"bpmn:SubProcess")&&(i=Ge(i,function(c){return c.target.type!=="bpmn:StartEvent"}))),_(t,"bpmn:StartEvent")&&!_(t.$parent,"bpmn:SubProcess")?(o=Ge(fk.concat(i),a),this._createEntries(e,o)):_(t,"bpmn:Participant")?(o=Ge(Rk,function(c){return Ue(e)!==c.target.isExpanded}),this._createEntries(e,o)):_(t,"bpmn:StartEvent")&&un(t.$parent)?(o=Ge(Ek.concat(i),function(c){var u=c.target,l=u.isInterrupting!==!1,p=t.isInterrupting===l;return a(c)||!a(c)&&!p}),this._createEntries(e,o)):_(t,"bpmn:StartEvent")&&!un(t.$parent)&&_(t.$parent,"bpmn:SubProcess")?(o=Ge(dk.concat(i),a),this._createEntries(e,o)):_(t,"bpmn:EndEvent")?(o=Ge(mk.concat(i),function(c){var u=c.target;return u.eventDefinitionType=="bpmn:CancelEventDefinition"&&!_(t.$parent,"bpmn:Transaction")?!1:a(c)}),this._createEntries(e,o)):_(t,"bpmn:BoundaryEvent")?(o=Ge(wk,function(c){var u=c.target;if(u.eventDefinitionType=="bpmn:CancelEventDefinition"&&!_(t.attachedToRef,"bpmn:Transaction"))return!1;var l=u.cancelActivity!==!1,p=t.cancelActivity==l;return a(c)||!a(c)&&!p}),this._createEntries(e,o)):_(t,"bpmn:IntermediateCatchEvent")||_(t,"bpmn:IntermediateThrowEvent")?(o=Ge(hk.concat(i),a),this._createEntries(e,o)):_(t,"bpmn:Gateway")?(o=Ge(gk,a),this._createEntries(e,o)):_(t,"bpmn:Transaction")?(o=Ge(__,a),this._createEntries(e,o)):un(t)&&Ue(e)?(o=Ge(bk,a),this._createEntries(e,o)):_(t,"bpmn:AdHocSubProcess")&&Ue(e)?(o=Ge(vk,a),this._createEntries(e,o)):_(t,"bpmn:SubProcess")&&Ue(e)?(o=Ge(yk,a),this._createEntries(e,o)):_(t,"bpmn:SubProcess")&&!Ue(e)?(o=Ge(x_,function(c){var u=c.target.type===e.type,l=c.target.isExpanded===!0;return u===l}),this._createEntries(e,o)):_(t,"bpmn:SequenceFlow")?this._createSequenceFlowEntries(e,Sk):_(t,"bpmn:FlowNode")?(o=Ge(x_,a),this._createEntries(e,o)):{})},Yn.prototype.getPopupMenuHeaderEntries=function(e){var t={};return _(e,"bpmn:Activity")&&!un(e)&&(t={...t,...this._getLoopCharacteristicsHeaderEntries(e)}),_(e,"bpmn:DataObjectReference")&&(t={...t,...this._getCollectionHeaderEntries(e)}),_(e,"bpmn:Participant")&&(t={...t,...this._getParticipantMultiplicityHeaderEntries(e)}),yg(e)&&(t={...t,...this._getNonInterruptingHeaderEntries(e)}),t},Yn.prototype._createEntries=function(e,t){var n={},i=this;return L(t,function(r){n[r.actionName]=i._createEntry(r,e)}),n},Yn.prototype._createSequenceFlowEntries=function(e,t){var n=te(e),i={},r=this._modeling,o=this._moddle,a=this;return L(t,function(s){switch(s.actionName){case"replace-with-default-flow":n.sourceRef.default!==n&&(_(n.sourceRef,"bpmn:ExclusiveGateway")||_(n.sourceRef,"bpmn:InclusiveGateway")||_(n.sourceRef,"bpmn:ComplexGateway")||_(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&&_(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:_(n.sourceRef,"bpmn:Activity")&&n.conditionExpression&&(i={...i,[s.actionName]:a._createEntry(s,e,function(){r.updateProperties(e,{conditionExpression:void 0})})}),(_(n.sourceRef,"bpmn:ExclusiveGateway")||_(n.sourceRef,"bpmn:InclusiveGateway")||_(n.sourceRef,"bpmn:ComplexGateway")||_(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},Yn.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}},Yn.prototype._getLoopCharacteristicsHeaderEntries=function(e){var t=this,n=this._translate;function i(u,l){if(l.active){t._modeling.updateProperties(e,{loopCharacteristics:void 0});return}var p=e.businessObject.get("loopCharacteristics");p&&_(p,l.options.loopCharacteristics)?t._modeling.updateModdleProperties(e,p,{isSequential:l.options.isSequential}):(p=t._moddle.create(l.options.loopCharacteristics,{isSequential:l.options.isSequential}),t._modeling.updateProperties(e,{loopCharacteristics:p}))}var r=te(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"}}}},Yn.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}}},Yn.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}}},Yn.prototype._getNonInterruptingHeaderEntries=function(e){const t=this._translate,n=te(e),i=this,r=vg(e),o=_(e,"bpmn:BoundaryEvent")?w_["intermediate-event-non-interrupting"]:w_["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__:[Rf,$y,Nc],__init__:["replaceMenuProvider"],replaceMenuProvider:["type",Yn]};function Ga(e,t,n,i,r,o,a,s,c,u,l,p,f){e=e||{},i.registerProvider(this),this._contextPad=i,this._modeling=r,this._elementFactory=o,this._connect=a,this._create=s,this._popupMenu=c,this._canvas=u,this._rules=l,this._translate=p,this._eventBus=n,this._appendPreview=f,e.autoPlace!==!1&&(this._autoPlace=t.get("autoPlace",!1)),n.on("create.end",250,function(d){var g=d.context,h=g.shape;if(!(!ha(d)||!i.isOpen(h))){var m=i.getEntries(h);m.replace&&m.replace.action.click(d,h)}}),n.on("contextPad.close",function(){f.cleanUp()})}Ga.$inject=["config.contextPad","injector","eventBus","contextPad","modeling","elementFactory","connect","create","popupMenu","canvas","rules","translate","appendPreview"],Ga.prototype.getMultiElementContextPadEntries=function(e){var t=this._modeling,n={};return this._isDeleteAllowed(e)&&H(n,{delete:{group:"edit",className:"bpmn-icon-trash",title:this._translate("Delete"),action:{click:function(i,r){t.removeElements(r.slice())}}}}),n},Ga.prototype._isDeleteAllowed=function(e){var t=this._rules.allowed("elements.delete",{elements:e});return ke(t)?Rr(e,n=>t.includes(n)):t},Ga.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])&&H(l,g()),l;var p=e.businessObject;function f(x,S){r.start(x,S)}function d(x,S){n.removeElements([S])}function g(){return{delete:{group:"edit",className:"bpmn-icon-trash",title:c("Delete"),action:{click:d}}}}function h(x){var S=5,P=t.getPad(x).html,C=P.getBoundingClientRect(),D={x:C.left,y:C.bottom+S};return D}function m(x,S,P,C){function D(k,O){var F=i.createShape(H({type:x},C));o.start(k,F,{source:O})}var T=s?function(k,O){var F=i.createShape(H({type:x},C));s.append(O,F)}:D,N=s?function(k,O){return u.create(O,x,C),()=>{u.cleanUp()}}:null;return{group:"model",className:S,title:P,action:{dragstart:D,click:T,hover:N}}}function E(x){return function(S,P){n.splitLane(P,x),t.open(P,!0)}}if(ze(p,["bpmn:Lane","bpmn:Participant"])&&Ue(e)){var y=or(e);H(l,{"lane-insert-above":{group:"lane-insert-above",className:"bpmn-icon-lane-insert-above",title:c("Add lane above"),action:{click:function(x,S){n.addLane(S,"top")}}}}),y.length<2&&((qt(e)?e.height>=120:e.width>=120)&&H(l,{"lane-divide-two":{group:"lane-divide",className:"bpmn-icon-lane-divide-two",title:c("Divide into two lanes"),action:{click:E(2)}}}),(qt(e)?e.height>=180:e.width>=180)&&H(l,{"lane-divide-three":{group:"lane-divide",className:"bpmn-icon-lane-divide-three",title:c("Divide into three lanes"),action:{click:E(3)}}})),H(l,{"lane-insert-below":{group:"lane-insert-below",className:"bpmn-icon-lane-insert-below",title:c("Add lane below"),action:{click:function(x,S){n.addLane(S,"bottom")}}}})}return _(p,"bpmn:FlowNode")&&(_(p,"bpmn:EventBasedGateway")?H(l,{"append.receive-task":m("bpmn:ReceiveTask","bpmn-icon-receive-task",c("Append receive task")),"append.message-intermediate-event":m("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-message",c("Append message intermediate catch event"),{eventDefinitionType:"bpmn:MessageEventDefinition"}),"append.timer-intermediate-event":m("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-timer",c("Append timer intermediate catch event"),{eventDefinitionType:"bpmn:TimerEventDefinition"}),"append.condition-intermediate-event":m("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-condition",c("Append conditional intermediate catch event"),{eventDefinitionType:"bpmn:ConditionalEventDefinition"}),"append.signal-intermediate-event":m("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-signal",c("Append signal intermediate catch event"),{eventDefinitionType:"bpmn:SignalEventDefinition"})}):E_(p,"bpmn:BoundaryEvent","bpmn:CompensateEventDefinition")?H(l,{"append.compensation-activity":m("bpmn:Task","bpmn-icon-task",c("Append compensation activity"),{isForCompensation:!0})}):!_(p,"bpmn:EndEvent")&&!p.isForCompensation&&!E_(p,"bpmn:IntermediateThrowEvent","bpmn:LinkEventDefinition")&&!un(p)&&H(l,{"append.end-event":m("bpmn:EndEvent","bpmn-icon-end-event-none",c("Append end event")),"append.gateway":m("bpmn:ExclusiveGateway","bpmn-icon-gateway-none",c("Append gateway")),"append.append-task":m("bpmn:Task","bpmn-icon-task",c("Append task")),"append.intermediate-event":m("bpmn:IntermediateThrowEvent","bpmn-icon-intermediate-event-none",c("Append intermediate/boundary event"))})),a.isEmpty(e,"bpmn-replace")||H(l,{replace:{group:"edit",className:"bpmn-icon-screw-wrench",title:c("Change element"),action:{click:function(x,S){var P=H(h(S),{cursor:{x:x.x,y:x.y}});a.open(S,"bpmn-replace",P,{title:c("Change element"),width:"var(--bpmn-replace-popup-width, 300px)",search:!0})}}}}),_(p,"bpmn:SequenceFlow")&&H(l,{"append.text-annotation":m("bpmn:TextAnnotation","bpmn-icon-text-annotation",c("Add text annotation"))}),_(p,"bpmn:MessageFlow")&&H(l,{"append.text-annotation":m("bpmn:TextAnnotation","bpmn-icon-text-annotation",c("Add text annotation"))}),ze(p,["bpmn:FlowNode","bpmn:InteractionNode","bpmn:DataObjectReference","bpmn:DataStoreReference"])&&H(l,{"append.text-annotation":m("bpmn:TextAnnotation","bpmn-icon-text-annotation",c("Add text annotation")),connect:{group:"connect",className:"bpmn-icon-connection-multi",title:c("Connect to other element"),action:{click:f,dragstart:f}}}),_(p,"bpmn:TextAnnotation")&&H(l,{connect:{group:"connect",className:"bpmn-icon-connection-multi",title:c("Connect using association"),action:{click:f,dragstart:f}}}),ze(p,["bpmn:DataObjectReference","bpmn:DataStoreReference"])&&H(l,{connect:{group:"connect",className:"bpmn-icon-connection-multi",title:c("Connect using data input association"),action:{click:f,dragstart:f}}}),_(p,"bpmn:Group")&&H(l,{"append.text-annotation":m("bpmn:TextAnnotation","bpmn-icon-text-annotation",c("Add text annotation"))}),this._isDeleteAllowed([e])&&H(l,g()),l};function E_(e,t,n){var i=e.$instanceOf(t),r=!1,o=e.eventDefinitions||[];return L(o,function(a){a.$type===n&&(r=!0)}),i&&r}const Ak={__depends__:[ak,b_,Qv,Vn,Df,hc,Pk],__init__:["contextPadProvider"],contextPadProvider:["type",Ga]};var Tk={horizontal:["x","width"],vertical:["y","height"]},S_=5;function Vi(e,t){this._modeling=e,this._filters=[],this.registerFilter(function(n){var i=t.allowed("elements.distribute",{elements:n});return ke(i)?i:i?n:[]})}Vi.$inject=["modeling","rules"],Vi.prototype.registerFilter=function(e){if(typeof e!="function")throw new Error("the filter has to be a function");this._filters.push(e)},Vi.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},Vi.prototype._filterElements=function(e){var t=this._filters,n=this._axis,i=this._dimension,r=[].concat(e);return t.length?(L(t,function(o){r=o(r,n,i)}),r):e},Vi.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=ii(e,i);return L(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},Vi.prototype._setOrientation=function(e){var t=Tk[e];this._axis=t[0],this._dimension=t[1]},Vi.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)},Vi.prototype._findRange=function(e){var t=e[this._axis],n=e[this._dimension];return{min:t+S_,max:t+n-S_}};const Mk={__init__:["distributeElements"],distributeElements:["type",Vi]};function lu(e){Gn.call(this,e)}lu.$inject=["eventBus"],de(lu,Gn),lu.prototype.init=function(){this.addRule("elements.distribute",function(e){var t=e.elements;return t=Ge(t,function(n){var i=ze(n,["bpmn:Association","bpmn:BoundaryEvent","bpmn:DataInputAssociation","bpmn:DataOutputAssociation","bpmn:Lane","bpmn:MessageFlow","bpmn:SequenceFlow","bpmn:TextAnnotation"]);return!(n.labelTarget||i)}),t=Cs(t),t.length<3?!1:t})};var R_={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>`},kk=900;function Va(e,t,n,i){this._distributeElements=t,this._translate=n,this._popupMenu=e,this._rules=i,e.registerProvider("align-elements",kk,this)}Va.$inject=["popupMenu","distributeElements","translate","rules"],Va.prototype.getPopupMenuEntries=function(e){var t={};return this._isAllowed(e)&&j(t,this._getEntries(e)),t},Va.prototype._isAllowed=function(e){return this._rules.allowed("elements.distribute",{elements:e})},Va.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:E_.horizontal,action:function(o,a){t.trigger(e,"horizontal"),i.close()}},"distribute-elements-vertical":{group:"distribute",title:n("Distribute elements vertically"),imageHtml:E_.vertical,action:function(o,a){t.trigger(e,"vertical"),i.close()}}};return r};const Ok={__depends__:[Ef,Mk],__init__:["bpmnDistributeElements","distributeElementsMenuProvider"],bpmnDistributeElements:["type",lu],distributeElementsMenuProvider:["type",Va]};var S_="is not a registered action",Dk="is already registered";function Xn(e,t){this._eventBus=e,this._actions={};var n=this;e.on("diagram.init",function(){n._registerDefaultActions(t),e.fire("editorActions.init",{editorActions:n})})}Xn.$inject=["eventBus","injector"],Xn.prototype._registerDefaultActions=function(e){var t=e.get("commandStack",!1),n=e.get("modeling",!1),i=e.get("selection",!1),r=e.get("zoomScroll",!1),o=e.get("copyPaste",!1),a=e.get("canvas",!1),s=e.get("rules",!1),c=e.get("keyboardMove",!1),u=e.get("keyboardMoveSelection",!1);t&&(this.register("undo",function(){t.undo()}),this.register("redo",function(){t.redo()})),o&&i&&this.register("copy",function(){var l=i.get();if(l.length)return o.copy(l)}),o&&i&&this.register("duplicate",function(){var l=i.get();if(l.length)return o.duplicate(l)}),o&&this.register("paste",function(){o.paste()}),o&&i&&s&&this.register("cut",function(){var l=i.get();if(l.length){var p=s.allowed("elements.delete",{elements:l});if(p!==!1){var f=Ae(p)?p:l;return o.cut(f.slice())}}}),r&&this.register("stepZoom",function(l){r.stepZoom(l.value)}),a&&this.register("zoom",function(l){a.zoom(l.value)}),n&&i&&s&&this.register("removeSelection",function(){var l=i.get();if(l.length){var p=s.allowed("elements.delete",{elements:l}),f;p!==!1&&(Ae(p)?f=p:f=l,f.length&&n.removeElements(f.slice()))}}),c&&this.register("moveCanvas",function(l){c.moveCanvas(l)}),u&&this.register("moveSelection",function(l){u.moveSelection(l.direction,l.accelerated)})},Xn.prototype.trigger=function(e,t){if(!this._actions[e])throw Df(e,S_);var n=this._eventBus.fire("editorActions.allowed",{action:e,opts:t});if(n!==!1)return this._actions[e](t)},Xn.prototype.register=function(e,t){var n=this;if(typeof e=="string")return this._registerAction(e,t);L(e,function(i,r){n._registerAction(r,i)})},Xn.prototype._registerAction=function(e,t){if(this.isRegistered(e))throw Df(e,Dk);this._actions[e]=t},Xn.prototype.unregister=function(e){if(!this.isRegistered(e))throw Df(e,S_);this._actions[e]=void 0},Xn.prototype.getActions=function(){return Object.keys(this._actions)},Xn.prototype.isRegistered=function(e){return!!this._actions[e]};function Df(e,t){return new Error(e+" "+t)}const Lk={__init__:["editorActions"],editorActions:["type",Xn]};function pu(e){e.invoke(Xn,this)}he(pu,Xn),pu.$inject=["injector"],pu.prototype._registerDefaultActions=function(e){Xn.prototype._registerDefaultActions.call(this,e);var t=e.get("canvas",!1),n=e.get("elementRegistry",!1),i=e.get("selection",!1),r=e.get("spaceTool",!1),o=e.get("lassoTool",!1),a=e.get("handTool",!1),s=e.get("globalConnect",!1),c=e.get("distributeElements",!1),u=e.get("alignElements",!1),l=e.get("directEditing",!1),p=e.get("searchPad",!1),f=e.get("modeling",!1),d=e.get("contextPad",!1);t&&n&&i&&this._registerAction("selectElements",function(){var g=t.getRootElement(),h=n.filter(function(m){return m!==g});return i.select(h),h}),r&&this._registerAction("spaceTool",function(){r.toggle()}),o&&this._registerAction("lassoTool",function(){o.toggle()}),a&&this._registerAction("handTool",function(){a.toggle()}),s&&this._registerAction("globalConnectTool",function(){s.toggle()}),i&&c&&this._registerAction("distributeElements",function(g){var h=i.get(),m=g.type;h.length&&c.trigger(h,m)}),i&&u&&this._registerAction("alignElements",function(g){var h=i.get(),m=[],S=g.type;h.length&&(m=ze(h,function(y){return!_(y,"bpmn:Lane")}),u.trigger(m,S))}),i&&f&&this._registerAction("setColor",function(g){var h=i.get();h.length&&f.setColor(h,g)}),i&&l&&this._registerAction("directEditing",function(){var g=i.get();g.length&&l.activate(g[0])}),p&&this._registerAction("find",function(){p.toggle()}),t&&f&&this._registerAction("moveToOrigin",function(){var g=t.getRootElement(),h,m;_(g,"bpmn:Collaboration")?m=n.filter(function(S){return _(S.parent,"bpmn:Collaboration")}):m=n.filter(function(S){return S!==g&&!_(S.parent,"bpmn:SubProcess")}),h=Ot(m),f.moveElements(m,{x:-h.x,y:-h.y},g)}),i&&d&&this._registerAction("replaceElement",function(g){d.triggerEntry("replace","click",g)})};const Ik={__depends__:[Lk],editorActions:["type",pu]};function R_(e){e.on(["create.init","shape.move.init"],function(t){var n=t.context,i=t.shape;He(i,["bpmn:Participant","bpmn:SubProcess","bpmn:TextAnnotation"])&&(n.gridSnappingContext||(n.gridSnappingContext={}),n.gridSnappingContext.snapLocation="top-left")})}R_.$inject=["eventBus"];function Yr(e,t){ee.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;xn(a)?r.newBounds=n.snapComplex(c,a):r.newBounds=n.snapSimple(s,c)}})}Yr.$inject=["eventBus","gridSnapping","modeling"],he(Yr,ee),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 C_(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)}})}C_.$inject=["eventBus","gridSnapping"];const Nk={__init__:["gridSnappingResizeBehavior","gridSnappingSpaceToolBehavior"],gridSnappingResizeBehavior:["type",Yr],gridSnappingSpaceToolBehavior:["type",C_]};var fu=10;function Lf(e,t,n){return n||(n="round"),Math[n](e/t)*t}var $k=1200,jk=800;function _r(e,t,n){var i=!n||n.active!==!1;this._eventBus=t;var r=this;t.on("diagram.init",jk,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"],$k,function(o){var a=o.originalEvent;if(!(!r.active||a&&An(a))){var s=o.context,c=s.gridSnappingContext;c||(c=s.gridSnappingContext={}),["x","y"].forEach(function(u){var l={},p=Hk(o,u,e);p&&(l.offset=p);var f=Fk(o,u);f&&j(l,f),jo(o,u)||r.snapEvent(o,u,l)})}})}_r.prototype.snapEvent=function(e,t,n){var i=this.snapValue(e[t],n);Bt(e,t,i)},_r.prototype.getGridSpacing=function(){return fu},_r.prototype.snapValue=function(e,t){var n=0;t&&t.offset&&(n=t.offset),e+=n,e=Lf(e,fu);var i,r;return t&&t.min&&(i=t.min,De(i)&&(i=Lf(i+n,fu,"ceil"),e=Math.max(e,i))),t&&t.max&&(r=t.max,De(r)&&(r=Lf(r+n,fu,"floor"),e=Math.min(e,r))),e-=n,e},_r.prototype.isActive=function(){return this.active},_r.prototype.setActive=function(e){this.active=e,this._eventBus.fire("gridSnapping.toggle",{active:e})},_r.prototype.toggleActive=function(){this.setActive(!this.active)},_r.$inject=["elementRegistry","eventBus","config.gridSnapping"];function Fk(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&&(du(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&&(du(t)?A_(s)?a.x.max=c.left:a.x.min=c.right:P_(s)?a.y.max=c.top:a.y.min=c.bottom),u&&(du(t)?A_(s)?a.x.min=u.left:a.x.max=u.right:P_(s)?a.y.min=u.top:a.y.max=u.bottom),a[t]}function Hk(e,t,n){var i=e.context,r=e.shape,o=i.gridSnappingContext,a=o.snapLocation,s=o.snapOffset;return s&&De(s[t])||(s||(s=o.snapOffset={}),De(s[t])||(s[t]=0),!r)||(n.get(r.id)||(du(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 du(e){return e==="x"}function P_(e){return e.indexOf("n")!==-1}function A_(e){return e.indexOf("w")!==-1}const zk={__depends__:[Nk],__init__:["gridSnapping"],gridSnapping:["type",_r]};var Gk=2e3;function T_(e,t,n){e.on("autoPlace",Gk,function(i){var r=i.source,o=Te(r),a=i.shape,s=Av(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],_(a,"bpmn:TextAnnotation")&&(Vk(c)?u.offset=-a.width/2:u.offset=-a.height/2),s[c]=t.snapValue(s[c],u))}),s})}T_.$inject=["eventBus","gridSnapping","elementRegistry"];function Vk(e){return e==="x"}var Wk=1750;function M_(e,t,n){t.on(["create.start","shape.move.start"],Wk,function(i){var r=i.context,o=r.shape,a=e.getRootElement();if(!(!_(o,"bpmn:Participant")||!_(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}))}})}M_.$inject=["canvas","eventBus","gridSnapping"];var Uk=3e3;function hu(e,t,n){ee.call(this,e),this._gridSnapping=t;var i=this;this.postExecuted(["connection.create","connection.layout"],Uk,function(r){var o=r.context,a=o.connection,s=o.hints||{},c=a.waypoints;s.connectionStart||s.connectionEnd||s.createElementsBehavior===!1||qk(c)&&n.updateWaypoints(a,i.snapMiddleSegments(c))})}hu.$inject=["eventBus","gridSnapping","modeling"],he(hu,ee),hu.prototype.snapMiddleSegments=function(e){var t=this._gridSnapping,n;e=e.slice();for(var i=1;i<e.length-2;i++)n=Xk(t,e[i],e[i+1]),e[i]=n[0],e[i+1]=n[1];return e};function qk(e){return e.length>3}function Yk(e){return e==="h"}function Kk(e){return e==="v"}function Xk(e,t,n){var i=Oi(t,n),r={};return Yk(i)&&(r.y=e.snapValue(t.y)),Kk(i)&&(r.x=e.snapValue(t.x)),("x"in r||"y"in r)&&(t=j({},t,r),n=j({},n,r)),[t,n]}const Zk={__depends__:[zk,{__init__:["gridSnappingAutoPlaceBehavior","gridSnappingParticipantBehavior","gridSnappingLayoutConnectionBehavior"],gridSnappingAutoPlaceBehavior:["type",T_],gridSnappingParticipantBehavior:["type",M_],gridSnappingLayoutConnectionBehavior:["type",hu]}],__init__:["bpmnGridSnapping"],bpmnGridSnapping:["type",R_]};var Qk=30,k_=30;function Wa(e,t){this._interactionEvents=t;var n=this;e.on(["interactionEvents.createHit","interactionEvents.updateHit"],function(i){var r=i.element,o=i.gfx;if(_(r,"bpmn:Lane"))return n._createParticipantHit(r,o);if(_(r,"bpmn:Participant"))return qe(r)?n._createParticipantHit(r,o):n._createDefaultHit(r,o);if(_(r,"bpmn:SubProcess"))return qe(r)?n._createSubProcessHit(r,o):n._createDefaultHit(r,o)})}Wa.$inject=["eventBus","interactionEvents"],Wa.prototype._createDefaultHit=function(e,t){return this._interactionEvents.removeHits(t),this._interactionEvents.createDefaultHit(e,t),!0},Wa.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=Zt(e)?{width:Qk,height:e.height}:{width:e.width,height:k_};return this._interactionEvents.createBoxHit(t,"all",n),!0},Wa.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:k_}),!0};const Jk={__init__:["bpmnInteractionEvents"],bpmnInteractionEvents:["type",Wa]};function mu(e){e.invoke(Oo,this)}he(mu,Oo),mu.$inject=["injector"],mu.prototype.registerBindings=function(e,t){Oo.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 eO={__depends__:[cf],__init__:["keyboardBindings"],keyboardBindings:["type",mu]};var tO={moveSpeed:1,moveSpeedAccelerated:10},nO=1500,O_="left",D_="up",L_="right",I_="down",iO={ArrowLeft:O_,Left:O_,ArrowUp:D_,Up:D_,ArrowRight:L_,Right:L_,ArrowDown:I_,Down:I_},rO={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 B_(e,t,n,i,r){var o=this;this._config=j({},tO,e||{}),t.addListener(nO,function(a){var s=a.keyEvent,c=iO[s.key];if(c&&!t.isCmd(s)){var u=t.isShift(s);return o.moveSelection(c,u),!0}}),this.moveSelection=function(a,s){var c=r.get();if(c.length){var u=this._config[s?"moveSpeedAccelerated":"moveSpeed"],l=rO[a](u),p=i.allowed("elements.move",{shapes:c,hints:{keyboardMove:!0}});p&&n.moveElements(c,l)}}}B_.$inject=["config.keyboardMoveSelection","keyboard","modeling","rules","selection"];const oO={__depends__:[cf,Wn],__init__:["keyboardMoveSelection"],keyboardMoveSelection:["type",B_]};var N_=10;function Ua(e,t,n,i){this._dragging=i,this._rules=t;var r=this;function o(c,u){var l=c.shape,p=c.direction,f=c.resizeConstraints,d;c.delta=u,d=tC(l,p,u),c.newBounds=iC(d,f),c.canExecute=r.canResize(c)}function a(c){var u=c.resizeConstraints,l=c.minBounds;u===void 0&&(l===void 0&&(l=r.computeMinResizeBox(c)),c.resizeConstraints={min:Re(l)})}function s(c){var u=c.shape,l=c.canExecute,p=c.newBounds;if(l){if(p=em(p),!aO(u,p))return;n.resizeShape(u,p)}}e.on("resize.start",function(c){a(c.context)}),e.on("resize.move",function(c){var u={x:c.dx,y:c.dy};o(c.context,u)}),e.on("resize.end",function(c){s(c.context)})}Ua.prototype.canResize=function(e){var t=this._rules,n=ti(e,["newBounds","shape","delta","direction"]);return t.allowed("shape.resize",n)},Ua.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,$_(t,o),"resize",{autoActivate:!0,cursor:sO(o),data:{shape:t,context:r}})},Ua.prototype.computeMinResizeBox=function(e){var t=e.shape,n=e.direction,i,r;return i=e.minDimensions||{width:N_,height:N_},r=Hm(t,e.childrenBoxPadding),rC(n,t,i,r)},Ua.$inject=["eventBus","rules","modeling","dragging"];function aO(e,t){return e.x!==t.x||e.y!==t.y||e.width!==t.width||e.height!==t.height}function $_(e,t){var n=Te(e),i=Re(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 sO(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 j_="djs-resizing",F_="resize-not-ok",cO=500;function H_(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,j_)),s.width>5&&me(c,{x:s.x,width:s.width}),s.height>5&&me(c,{y:s.y,height:s.height}),o.canExecute?Ye(c).remove(F_):Ye(c).add(F_)}function r(o){var a=o.shape,s=o.frame;s&&Gt(o.frame),t.removeMarker(a,j_)}e.on("resize.move",cO,function(o){i(o.context)}),e.on("resize.cleanup",function(o){r(o.context)})}H_.$inject=["eventBus","canvas","previewSupport"];var gu=-6,yu=8,vu=20,qa="djs-resizer",uO=["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&&L(a,vn(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)}Le.bind(t,"mousedown",r),Le.bind(t,"touchstart",r)},xr.prototype._createResizer=function(e,t,n,i){var r=this._getResizersParent(),o=lO(i),a=Se("g");Ye(a).add(qa),Ye(a).add(qa+"-"+e.id),Ye(a).add(qa+"-"+i),Ie(r,a);var s=Se("rect");me(s,{x:-yu/2+o.x,y:-yu/2+o.y,width:yu,height:yu}),Ye(s).add(qa+"-visual"),Ie(a,s);var c=Se("rect");return me(c,{x:-vu/2+o.x,y:-vu/2+o.y,width:vu,height:vu}),Ye(c).add(qa+"-hit"),Ie(a,c),Os(a,t,n),a},xr.prototype.createResizer=function(e,t){var n=$_(e,t),i=this._createResizer(e,n.x,n.y,t);this.makeDraggable(e,i,t)},xr.prototype.addResizer=function(e){var t=this;ct(e)||L(uO,function(n){t._resize.canResize({shape:e,direction:n})&&t.createResizer(e,n)})},xr.prototype.removeResizers=function(){var e=this._getResizersParent();Es(e)},xr.prototype._getResizersParent=function(){return this._canvas.getLayer("resizers")},xr.$inject=["eventBus","canvas","selection","resize"];function lO(e){var t={x:0,y:0};return e.indexOf("e")!==-1?t.x=-gu:e.indexOf("w")!==-1&&(t.x=gu),e.indexOf("s")!==-1?t.y=-gu:e.indexOf("n")!==-1&&(t.y=gu),t}const z_={__depends__:[yi,$i,To],__init__:["resize","resizePreview","resizeHandles"],resize:["type",Ua],resizePreview:["type",H_],resizeHandles:["type",xr]};var pO=2e3;function Ya(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"],pO,function(c){i.isActive(c.element)&&i.cancel()}),e.on(["commandStack.changed"],function(c){i.isActive()&&i.cancel()}),e.on("directEditing.activate",function(c){o.removeResizers()}),e.on("create.end",500,function(c){var u=c.context,l=u.shape,p=c.context.canExecute,f=c.isTouch;f||p&&(u.hints&&u.hints.createElementsBehavior===!1||s(l))}),e.on("autoPlace.end",500,function(c){s(c.shape)});function s(c,u){(u||He(c,["bpmn:Activity","bpmn:Event","bpmn:TextAnnotation","bpmn:Participant"]))&&i.activate(c)}}Ya.$inject=["eventBus","bpmnFactory","canvas","directEditing","modeling","resizeHandles","textRenderer"],Ya.prototype.activate=function(e){var t=Bn(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}),(He(e,["bpmn:Task","bpmn:Participant","bpmn:Lane","bpmn:CallActivity"])||G_(e))&&j(r,{centerVertically:!0}),or(e)&&(j(r,{resizable:!0,autoResize:!0}),j(o,{backgroundColor:"#ffffff",border:"1px solid #ccc"})),_(e,"bpmn:TextAnnotation")&&(j(r,{resizable:!0,autoResize:!0}),j(o,{backgroundColor:"#ffffff",border:"1px solid #ccc"})),j(n,{options:r,style:o}),n}},Ya.prototype.getEditingBBox=function(e){var t=this._canvas,n=e.label||e,i=t.getAbsoluteBBox(n),r={x:i.x+i.width/2,y:i.y+i.height/2},o={x:i.x,y:i.y},a=t.zoom(),s=this._textRenderer.getDefaultStyle(),c=this._textRenderer.getExternalStyle(),u=c.fontSize*a,l=c.lineHeight,p=s.fontSize*a,f=s.lineHeight,d={fontFamily:this._textRenderer.getDefaultStyle().fontFamily,fontWeight:this._textRenderer.getDefaultStyle().fontWeight};if(_(e,"bpmn:Lane")||hO(e)){var g=Zt(e),h=g?{width:i.height,height:30*a,x:i.x-i.height/2+15*a,y:r.y-30*a/2}:{width:i.width,height:30*a};j(o,h),j(d,{fontSize:p+"px",lineHeight:f,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px",transform:g?"rotate(-90deg)":null})}if(dO(e)){var m=Zt(e),S=m?{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:p+"px",lineHeight:f,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px",transform:m?null:"rotate(-90deg)"})}(He(e,["bpmn:Task","bpmn:CallActivity"])||G_(e))&&(j(o,{width:i.width,height:i.height}),j(d,{fontSize:p+"px",lineHeight:f,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px"})),fO(e)&&(j(o,{width:i.width,x:i.x}),j(d,{fontSize:p+"px",lineHeight:f,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px"}));var y=1,x=i.width+2*y;if(n.labelTarget&&(j(o,{width:x,height:i.height+2*y,x:i.x-y,y:i.y-y}),j(d,{fontSize:u+"px",lineHeight:l})),or(n)&&!Is(n)&&!je(n)){var E=xl(e),P=t.getAbsoluteBBox({x:E.x,y:E.y,width:0,height:0}),C=u,D=Br.width*a+2*y;j(o,{width:D,height:C+2*y,x:P.x-D/2,y:P.y-C/2-y}),j(d,{fontSize:u+"px",lineHeight:l})}return _(e,"bpmn:TextAnnotation")&&(j(o,{width:i.width+2*y,height:i.height+2*y,x:i.x-y,y:i.y-y,minWidth:30*a,minHeight:10*a}),j(d,{textAlign:"left",paddingTop:go*a+"px",paddingBottom:go*a+"px",paddingLeft:go*a+"px",paddingRight:go*a+"px",fontSize:p+"px",lineHeight:f})),{bounds:o,style:d}},Ya.prototype.update=function(e,t,n,i){var r,o;_(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}),mO(t)&&(t=null),this._modeling.updateLabel(e,t,r)};function G_(e){return _(e,"bpmn:SubProcess")&&!qe(e)}function fO(e){return _(e,"bpmn:SubProcess")&&qe(e)}function dO(e){return _(e,"bpmn:Participant")&&!qe(e)}function hO(e){return _(e,"bpmn:Participant")&&qe(e)}function mO(e){return!e||!e.trim()}var V_="djs-element-hidden",W_="djs-label-hidden";function U_(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,_(o,"bpmn:TextAnnotation")){a=t.getAbsoluteBBox(o),s=Se("g");var l=n.getScaledPath("TEXT_ANNOTATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:o.width,containerHeight:o.height,position:{mx:0,my:0}}),p=i.path=Se("path");me(p,{d:l,strokeWidth:2,stroke:gO(o)}),Ie(s,p),Ie(r,s),rn(s,o.x,o.y)}_(o,"bpmn:TextAnnotation")||o.labelTarget?t.addMarker(o,V_):(_(o,"bpmn:Task")||_(o,"bpmn:CallActivity")||_(o,"bpmn:SubProcess")||_(o,"bpmn:Participant")||_(o,"bpmn:Lane"))&&t.addMarker(o,W_)}),e.on("directEditing.resize",function(c){if(_(o,"bpmn:TextAnnotation")){var u=c.height,l=c.dy,p=Math.max(o.height/a.height*(u+l),0),f=n.getScaledPath("TEXT_ANNOTATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:o.width,containerHeight:p,position:{mx:0,my:0}});me(i.path,{d:f})}}),e.on(["directEditing.complete","directEditing.cancel"],function(c){var u=c.active;u&&(t.removeMarker(u.element.label||u.element,V_),t.removeMarker(o,W_)),o=void 0,a=void 0,s&&(Gt(s),s=void 0)})}U_.$inject=["eventBus","canvas","pathMap"];function gO(e,t){var n=Ke(e);return n.get("stroke")||t||"black"}const yO={__depends__:[jp,z_,y_],__init__:["labelEditingProvider","labelEditingPreview"],labelEditingProvider:["type",Ya],labelEditingPreview:["type",U_]};var vO=500,bO=1e3;function _i(e,t,n){this._eventBus=e,this._elementRegistry=n,this._outlineOffset=5,this._outlineStyle=t.cls("djs-outline",["no-fill"]);var i=this;function r(o){iS(o)||i.createOutline(o)}e.on("element.hover",function(o){r(o.element)}),e.on("selection.changed",function(o){L(o.newSelection,r)}),e.on(["shape.changed","connection.changed"],vO,function(o){var a=o.element,s=o.gfx,c=at(".djs-outline",s);c&&i.updateOutline(a,c)})}_i.prototype.createOutline=function(e){var t=this._elementRegistry.getGraphics(e);if(!t)throw new Error("cannot create outline for non-rendered element");var n=at(".djs-outline",t);return n||(n=this.getOutline(e)||this._createOutlineGfx(),Ie(t,n),this.updateOutline(e,n)),n},_i.prototype._createOutlineGfx=function(){var e=Se("rect");return me(e,j({x:0,y:0,rx:4,width:100,height:100},this._outlineStyle)),e},_i.prototype.updateOutline=function(e,t){e.waypoints?this.updateConnectionOutline(t,e):this.updateShapeOutline(t,e)},_i.prototype.updateShapeOutline=function(e,t){var n=!1,i=this._getProviders();i.length&&L(i,function(r){n=n||r.updateOutline(t,e)}),n||me(e,{x:-this._outlineOffset,y:-this._outlineOffset,width:t.width+this._outlineOffset*2,height:t.height+this._outlineOffset*2})},_i.prototype.updateConnectionOutline=function(e,t){var n=Ot(t);me(e,{x:n.x-this._outlineOffset,y:n.y-this._outlineOffset,width:n.width+this._outlineOffset*2,height:n.height+this._outlineOffset*2})},_i.prototype.registerProvider=function(e,t){t||(t=e,e=bO),this._eventBus.on("outline.getProviders",e,function(n){n.providers.push(t)})},_i.prototype._getProviders=function(){var e=this._eventBus.createEvent({type:"outline.getProviders",providers:[]});return this._eventBus.fire(e),e.providers},_i.prototype.getOutline=function(e){var t,n=this._getProviders();return L(n,function(i){Kt(i.getOutline)&&(t=t||i.getOutline(e))}),t},_i.$inject=["eventBus","styles","elementRegistry"];var bu=6;function If(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)})}If.prototype._updateMultiSelectionOutline=function(e){var t=this._canvas.getLayer("selectionOutline");Es(t);var n=e.length>1,i=this._canvas.getContainer();if(Ye(i)[n?"add":"remove"]("djs-multi-select"),!!n){var r=_O(Ot(e)),o=Se("rect");me(o,j({rx:3},r)),Ye(o).add("djs-selection-outline"),Ie(t,o)}},If.$inject=["eventBus","canvas","selection"];function _O(e){return{x:e.x-bu,y:e.y-bu,width:e.width+bu*2,height:e.height+bu*2}}const Bf={__depends__:[Wn],__init__:["outline","multiSelectionOutline"],outline:["type",_i],multiSelectionOutline:["type",If]},q_=["bpmn:Event","bpmn:SequenceFlow","bpmn:Gateway"],Y_={class:"bjs-label-link",stroke:"var(--element-selected-outline-secondary-stroke-color)",strokeDasharray:"5, 5"},xO=15,_u=2;function K_(e,t,n,i,r){const o=t.getLayer("overlays");e.on(["selection.changed","shape.changed"],function(){s()}),e.on("selection.changed",function({newSelection:p}){var d;const f=p.filter(g=>He(g,q_));if(f.length===1){const g=f[0];je(g)?a(g,g.labelTarget):(d=g.labels)!=null&&d.length&&a(g.labels[0],g)}if(f.length===2){const g=f.find(je),h=f.find(m=>{var S;return(S=m.labels)==null?void 0:S.includes(g)});g&&h&&a(g,h)}}),e.on("shape.changed",function({element:p}){var f;!He(p,q_)||!l(p)||(je(p)?a(p,p.labelTarget):(f=p.labels)!=null&&f.length&&a(p.labels[0],p))});function a(p,f){const d=Zo([Te(f),Te(p)],Y_),g=d.getAttribute("d"),m=r.isSelected(p)?c(p):u(p),S=ta(m,g);if(!S)return;const x=r.isSelected(f)?c(f):u(f),E=ta(x,g)||Te(f);pa(E,S)<xO||(dl(d,[E,S]),Ie(o,d))}function s(){ws(`.${Y_.class}`,o).forEach(Gt)}function c(p){const f=i.getOutline(p);if(!f)return u(p);if(f.x){const d={x:p.x+wr(f,"x")-_u,y:p.y+wr(f,"y")-_u,width:wr(f,"width")+_u*2,height:wr(f,"height")+_u*2};return El(d,wr(f,"rx"))}if(f.cx){const d=wr(f,"r"),g={x:p.x+wr(f,"cx")-d,y:p.y+wr(f,"cy")-d,width:d*2,height:d*2};return Sm(g)}}function u(p){return n.getShapePath(p)}function l(p){return r.isSelected(p)}}K_.$inject=["eventBus","canvas","graphicsFactory","outline","selection"];function wr(e,t){return parseFloat(me(e,t)||0)}const wO={__depends__:[Wn,Bf],__init__:["labelLink"],labelLink:["type",K_]};var EO=new Ao("tt");function SO(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 RO(e,t,n){mn(e,{left:t+"px",top:n+"px"})}function Nf(e,t){e.style.display=t===!1?"none":""}var X_="djs-tooltip",$f="."+X_;function _n(e,t){this._eventBus=e,this._canvas=t,this._ids=EO,this._tooltipDefaults={show:{minZoom:.7,maxZoom:5}},this._tooltips={},this._tooltipRoot=SO(t.getContainer());var n=this;Rn.bind(this._tooltipRoot,$f,"mousedown",function(i){i.stopPropagation()}),Rn.bind(this._tooltipRoot,$f,"mouseover",function(i){n.trigger("mouseover",i)}),Rn.bind(this._tooltipRoot,$f,"mouseout",function(i){n.trigger("mouseout",i)}),this._init()}_n.$inject=["eventBus","canvas"],_n.prototype.add=function(e){if(!e.position)throw new Error("must specifiy tooltip position");if(!e.html)throw new Error("must specifiy tooltip html");var t=this._ids.next();return e=j({},this._tooltipDefaults,e,{id:t}),this._addTooltip(e),e.timeout&&this.setTimeout(e),t},_n.prototype.trigger=function(e,t){var n=t.delegateTarget||t.target,i=this.get(ln(n,"data-tooltip-id"));i&&(e==="mouseover"&&i.timeout&&this.clearTimeout(i),e==="mouseout"&&i.timeout&&(i.timeout=1e3,this.setTimeout(i)))},_n.prototype.get=function(e){return typeof e!="string"&&(e=e.id),this._tooltips[e]},_n.prototype.clearTimeout=function(e){if(e=this.get(e),!!e){var t=e.removeTimer;t&&(clearTimeout(t),e.removeTimer=null)}},_n.prototype.setTimeout=function(e){if(e=this.get(e),!!e){this.clearTimeout(e);var t=this;e.removeTimer=setTimeout(function(){t.remove(e)},e.timeout)}},_n.prototype.remove=function(e){var t=this.get(e);t&&(pi(t.html),pi(t.htmlContainer),delete t.htmlContainer,delete this._tooltips[t.id])},_n.prototype.show=function(){Nf(this._tooltipRoot)},_n.prototype.hide=function(){Nf(this._tooltipRoot,!1)},_n.prototype._updateRoot=function(e){var t=e.scale||1,n=e.scale||1,i="matrix("+t+",0,0,"+n+","+-1*e.x*t+","+-1*e.y*n+")";this._tooltipRoot.style.transform=i,this._tooltipRoot.style["-ms-transform"]=i},_n.prototype._addTooltip=function(e){var t=e.id,n=e.html,i,r=this._tooltipRoot;n.get&&n.constructor.prototype.jquery&&(n=n.get(0)),xn(n)&&(n=dt(n)),i=dt('<div data-tooltip-id="'+t+'" class="'+X_+'">'),mn(i,{position:"absolute"}),i.appendChild(n),e.type&&gt(i).add("djs-tooltip-"+e.type),e.className&&gt(i).add(e.className),e.htmlContainer=i,r.appendChild(i),this._tooltips[t]=e,this._updateTooltip(e)},_n.prototype._updateTooltip=function(e){var t=e.position,n=e.htmlContainer;RO(n,t.x,t.y)},_n.prototype._updateTooltipVisibilty=function(e){L(this._tooltips,function(t){var n=t.show,i=t.htmlContainer,r=!0;n&&((n.minZoom>e.scale||n.maxZoom<e.scale)&&(r=!1),Nf(i,r))})},_n.prototype._init=function(){var e=this;function t(n){e._updateRoot(n),e._updateTooltipVisibilty(n),e.show()}this._eventBus.on("canvas.viewbox.changing",function(n){e.hide()}),this._eventBus.on("canvas.viewbox.changed",function(n){t(n.viewbox)})};const CO={__init__:["tooltips"],tooltips:["type",_n]};var PO="flow elements must be children of pools/participants",AO="Data object must be placed within a pool/participant.";function Z_(e,t,n){function i(r,o,a){t.add({position:{x:r.x+5,y:r.y+5},type:"error",timeout:2e3,html:"<div>"+o+"</div>"})}e.on(["shape.move.rejected","create.rejected"],function(r){var o=r.context,a=o.shape,s=o.target;_(s,"bpmn:Collaboration")&&(_(a,"bpmn:FlowNode")?i(r,n(PO)):_(a,"bpmn:DataObjectReference")&&i(r,n(AO)))})}Z_.$inject=["eventBus","tooltips","translate"];const TO={__depends__:[CO],__init__:["modelingFeedback"],modelingFeedback:["type",Z_]};var MO=500,kO=1250,OO=1500,xu=Math.round;function DO(e){return{x:e.x+xu(e.width/2),y:e.y+xu(e.height/2)}}function Q_(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",OO,function(s){var c=s.context,u=s.shape,l=i.get().slice();l.indexOf(u)===-1&&(l=[u]),l=LO(l),j(c,{shapes:l,validatedShapes:l,shape:u})}),e.on("shape.move.start",kO,function(s){var c=s.context,u=c.validatedShapes,l;if(l=c.canExecute=o(u),!l)return!1}),e.on("shape.move.move",MO,function(s){var c=s.context,u=c.validatedShapes,l=s.hover,p={x:s.dx,y:s.dy},f={x:s.x,y:s.y},d;if(d=o(u,p,f,l),c.delta=p,c.canExecute=d,d===null){c.target=null;return}c.target=l}),e.on("shape.move.end",function(s){var c=s.context,u=c.delta,l=c.canExecute,p=l==="attach",f=c.shapes;if(l===!1)return!1;u.x=xu(u.x),u.y=xu(u.y),!(u.x===0&&u.y===0)&&n.moveElements(f,u,c.target,{primaryShape:c.shape,attach:p})}),e.on("element.mousedown",function(s){if(ur(s)){var c=So(s);if(!c)throw new Error("must supply DOM mousedown event");return a(c,s.element)}});function a(s,c,u,l){if(Yt(u)&&(l=u,u=!1),!(c.waypoints||!c.parent)&&!Ye(s.target).has("djs-hit-no-move")){var p=DO(c),f=t.init(s,p,"shape.move",{cursor:"grabbing",autoActivate:u,data:{shape:c,context:l||{}}});if(f!==!1)return!0}}this.start=a}Q_.$inject=["eventBus","dragging","modeling","selection","rules"];function LO(e){var t=no(e,"id");return ze(e,function(n){for(;n=n.parent;)if(t[n.id])return!1;return!0})}var J_=499,jf="djs-dragging",ex="drop-ok",tx="drop-not-ok",nx="new-parent",ix="attach-ok";function rx(e,t,n,i){function r(c){var u=o(c),l=IO(u);return l}function o(c){var u=Qo(c),l=u.flatMap(d=>(d.incoming||[]).concat(d.outgoing||[])),p=u.concat(l),f=[...new Set(p)];return f}function a(c,u){[ix,ex,tx,nx].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,jf),c.allDraggedElements?c.allDraggedElements.push(u):c.allDraggedElements=[u]}e.on("shape.move.start",J_,function(c){var u=c.context,l=u.shapes,p=u.allDraggedElements,f=r(l);if(!u.dragGroup){var d=Se("g");me(d,n.cls("djs-drag-group",["no-events"]));var g=t.getActiveLayer();Ie(g,d),u.dragGroup=d}f.forEach(function(h){i.addDragger(h,u.dragGroup)}),p?p=ku([p,o(l)]):p=o(l),L(p,function(h){t.addMarker(h,jf)}),u.allDraggedElements=p,u.differentParents=BO(l)}),e.on("shape.move.move",J_,function(c){var u=c.context,l=u.dragGroup,p=u.target,f=u.shape.parent,d=u.canExecute;p&&(d==="attach"?a(p,ix):u.canExecute&&f&&p.id!==f.id?a(p,nx):a(p,u.canExecute?ex:tx)),rn(l,c.dx,c.dy)}),e.on(["shape.move.out","shape.move.cleanup"],function(c){var u=c.context,l=u.target;l&&a(l,null)}),e.on("shape.move.cleanup",function(c){var u=c.context,l=u.allDraggedElements,p=u.dragGroup;L(l,function(f){t.removeMarker(f,jf)}),p&&Gt(p)}),this.makeDraggable=s}rx.$inject=["eventBus","canvas","styles","previewSupport"];function IO(e){var t=new Set;e.forEach(function(i){t.add(i.id)});var n=ze(e,function(i){return ct(i)?t.has(i.source.id)&&t.has(i.target.id):!0});return n}function BO(e){return k0(no(e,function(t){return t.parent&&t.parent.id}))!==1}const NO={__depends__:[fc,Wn,Bf,yi,$i,To],__init__:["move","movePreview"],move:["type",Q_],movePreview:["type",rx]};var ox=".djs-palette-toggle",ax=".entry",$O=ox+", "+ax,Ff="djs-palette-",jO="shown",Hf="open",sx="two-column",FO=1e3;function Nt(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()})}Nt.$inject=["eventBus","canvas"],Nt.prototype.registerProvider=function(e,t){t||(t=e,e=FO),this._eventBus.on("palette.getProviders",e,function(n){n.providers.push(t)}),this._rebuild()},Nt.prototype.getEntries=function(){var e=this._getProviders();return e.reduce(zO,{})},Nt.prototype._rebuild=function(){if(this._diagramInitialized){var e=this._getProviders();e.length&&(this._container||this._init(),this._update())}},Nt.prototype._init=function(){var e=this,t=this._eventBus,n=this._getParentContainer(),i=this._container=dt(Nt.HTML_MARKUP);n.appendChild(i),gt(n).add(Ff+jO),Rn.bind(i,$O,"click",function(r){var o=r.delegateTarget;if(rl(o,ox))return e.toggle();e.trigger("click",r)}),Le.bind(i,"mousedown",function(r){r.stopPropagation()}),Rn.bind(i,ax,"dragstart",function(r){e.trigger("dragstart",r)}),t.on("canvas.resized",this._layoutChanged,this),t.fire("palette.create",{container:i})},Nt.prototype._getProviders=function(e){var t=this._eventBus.createEvent({type:"palette.getProviders",providers:[]});return this._eventBus.fire(t),t.providers},Nt.prototype._toggleState=function(e){e=e||{};var t=this._getParentContainer(),n=this._container,i=this._eventBus,r,o=gt(n),a=gt(t);"twoColumn"in e?r=e.twoColumn:r=this._needsCollapse(t.clientHeight,this._entries||{}),o.toggle(sx,r),a.toggle(Ff+sx,r),"open"in e&&(o.toggle(Hf,e.open),a.toggle(Ff+Hf,e.open)),i.fire("palette.changed",{twoColumn:r,open:this.isOpen()})},Nt.prototype._update=function(){var e=at(".djs-palette-entries",this._container),t=this._entries=this.getEntries();_s(e),L(t,function(n,i){var r=n.group||"default",o=at("[data-group="+Da(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&&HO(s,n.className),n.imageUrl)){var c=dt("<img>");ln(c,"src",n.imageUrl),s.appendChild(c)}}),this.open()},Nt.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()},Nt.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(Kt(a)){if(t==="click")return a(n,i)}else if(a[t])return a[t](n,i);n.preventDefault()}},Nt.prototype._layoutChanged=function(){this._toggleState({})},Nt.prototype._needsCollapse=function(e,t){var n=50,i=Object.keys(t).length*46;return e<i+n},Nt.prototype.close=function(){this._toggleState({open:!1,twoColumn:!1})},Nt.prototype.open=function(){this._toggleState({open:!0})},Nt.prototype.toggle=function(){this.isOpen()?this.close():this.open()},Nt.prototype.isActiveTool=function(e){return e&&this._activeTool===e},Nt.prototype.updateToolHighlight=function(e){var t,n;this._toolsContainer||(t=at(".djs-palette-entries",this._container),this._toolsContainer=at("[data-group=tools]",t)),n=this._toolsContainer,L(n.children,function(i){var r=i.getAttribute("data-action");if(r){var o=gt(i);r=r.replace("-tool",""),o.contains("entry")&&r===e?o.add("highlighted-entry"):o.remove("highlighted-entry")}})},Nt.prototype.isOpen=function(){return gt(this._container).has(Hf)},Nt.prototype._getParentContainer=function(){return this._canvas.getContainer()},Nt.HTML_MARKUP='<div class="djs-palette"><div class="djs-palette-entries"></div><div class="djs-palette-toggle"></div></div>';function HO(e,t){var n=gt(e),i=Ae(t)?t:t.split(/\s+/g);i.forEach(function(r){n.add(r)})}function zO(e,t){var n=t.getPaletteEntries();return Kt(n)?n(e):(L(n,function(i,r){e[r]=i}),e)}const GO={__init__:["palette"],palette:["type",Nt]};var cx="crosshair",ux="selected",VO="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(p){var f=t.getActiveLayer(),d=p.frame=Se("rect");me(d,{class:"djs-lasso-overlay",width:1,height:1,x:0,y:0}),Ie(f,d),u(!0),this.update(p)},update:function(p){var f=p.frame,d=p.bbox;f&&d&&me(f,{x:d.x,y:d.y,width:d.width,height:d.height});var g=p.marked,h=p.lastMarked;if(g&&h){for(const m of h)g.has(m)||t.removeMarker(m,ux);for(const m of g)h.has(m)||t.addMarker(m,ux)}},remove:function(p){this.update(p),p.frame&&Gt(p.frame),u(!1)}};function u(p){Ye(t.getContainer()).toggle(VO,p)}function l(p){var f=i.getAll();return new Set(to(lo(f,p)))}o.registerTool("lasso",{tool:"lasso.selection",dragging:"lasso"}),e.on("lasso.selection.end",function(p){var f=p.originalEvent.target;!p.hover&&!(f instanceof SVGElement)||e.once("lasso.selection.ended",function(){s.activateLasso(p.originalEvent,!0)})}),e.on("lasso.end",0,function(p){var f=p.context;s._select(Array.from(f.marked))}),e.on("lasso.start",function(p){var f=p.context;f.bbox=lx(p),f.add=oc(p),f.lastMarked=new Set(r.get()),f.add?f.marked=f.lastMarked:f.marked=new Set,f.initialMarked=f.marked,c.create(f)}),e.on("lasso.move",function(p){var f=p.context,d=f.bbox=lx(p),g=l(d),h=f.initialMarked.union(g);f.lastMarked=f.marked,f.marked=h,c.update(f)}),e.on("lasso.cleanup",function(p){var f=p.context;f.lastMarked=f.marked,f.marked=new Set(r.get()),c.remove(p.context)}),e.on("element.mousedown",1500,function(p){if(oc(p))return s.activateLasso(p.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:cx,data:{context:{}},keepSelection:!0})},Er.prototype.activateSelection=function(e,t){this._dragging.init(e,"lasso.selection",{trapClick:!1,autoActivate:t,cursor:cx,data:{context:{}},keepSelection:!0})},Er.prototype._select=function(e){this._selection.select(e)},Er.prototype.select=function(e,t,n=[]){var i=to(lo(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 lx(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 WO={__depends__:[gc,ya],__init__:["lassoTool"],lassoTool:["type",Er]};var zf=1500,px="grab";function Fo(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",zf,function(c){if(ha(c))return a.activateMove(c.originalEvent,!0),!1}),s&&s.addListener(zf,function(c){if(!(!fx(c.keyEvent)||a.isActive())){var u=a._mouse.getLastMoveEvent();a.activateMove(u,!!u)}},"keyboard.keydown"),s&&s.addListener(zf,function(c){!fx(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!ha(c)&&l&&e.once("hand.move.ended",function(p){a.activateHand(p.originalEvent,!0,!0)}),!1})}Fo.$inject=["eventBus","canvas","dragging","injector","toolManager","mouse"],Fo.prototype.activateMove=function(e,t,n){typeof t=="object"&&(n=t,t=!1),this._dragging.init(e,"hand.move",{autoActivate:t,cursor:px,data:{context:n||{}}})},Fo.prototype.activateHand=function(e,t,n){this._dragging.init(e,"hand",{trapClick:!1,autoActivate:t,cursor:px,data:{context:{reactivate:n}}})},Fo.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateHand(e,!!e)},Fo.prototype.isActive=function(){var e=this._dragging.context();return e?/^(hand|hand\.move)$/.test(e.prefix):!1};function fx(e){return Vt("Space",e)}const UO={__depends__:[gc,ya],__init__:["handTool"],handTool:["type",Fo]};var dx="connect-ok",hx="connect-not-ok";function Ho(e,t,n,i,r,o,a){var s=this;this._dragging=t,this._rules=o,this._mouse=a,r.registerTool("global-connect",{tool:"global-connect",dragging:"global-connect.drag"}),e.on("global-connect.hover",function(c){var u=c.context,l=c.hover,p=u.canStartConnect=s.canStartConnect(l);p!==null&&(u.startTarget=l,i.addMarker(l,p?dx:hx))}),e.on(["global-connect.out","global-connect.cleanup"],function(c){var u=c.context.startTarget,l=c.context.canStartConnect;u&&i.removeMarker(u,l?dx:hx)}),e.on(["global-connect.ended"],function(c){var u=c.context,l=u.startTarget,p={x:c.x,y:c.y},f=s.canStartConnect(l);if(f)return e.once("element.out",function(){e.once(["connect.ended","connect.canceled"],function(){e.fire("global-connect.drag.ended")}),n.start(null,l,p)}),!1})}Ho.$inject=["eventBus","dragging","connect","canvas","toolManager","rules","mouse"],Ho.prototype.start=function(e,t){this._dragging.init(e,"global-connect",{autoActivate:t,trapClick:!1,data:{context:{}}})},Ho.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();return this.start(e,!!e)},Ho.prototype.isActive=function(){var e=this._dragging.context();return e&&/^global-connect/.test(e.prefix)},Ho.prototype.canStartConnect=function(e){return this._rules.allowed("connection.start",{source:e})};const qO={__depends__:[kf,yi,$i,gc,ya],globalConnect:["type",Ho]};function Gf(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)}Gf.$inject=["palette","create","elementFactory","spaceTool","lassoTool","handTool","globalConnect","translate"],Gf.prototype.getPaletteEntries=function(){var e={},t=this._create,n=this._elementFactory,i=this._spaceTool,r=this._lassoTool,o=this._handTool,a=this._globalConnect,s=this._translate;function c(p,f,d,g,h){function m(S){var y=n.createShape(j({type:p},h));t.start(S,y)}return{group:f,className:d,title:g,action:{dragstart:m,click:m}}}function u(p){var f=n.createShape({type:"bpmn:SubProcess",x:0,y:0,isExpanded:!0}),d=n.createShape({type:"bpmn:StartEvent",x:40,y:82,parent:f});t.start(p,[f,d],{hints:{autoSelect:[f]}})}function l(p){t.start(p,n.createParticipantShape())}return j(e,{"hand-tool":{group:"tools",className:"bpmn-icon-hand-tool",title:s("Activate hand tool"),action:{click:function(p){o.activateHand(p)}}},"lasso-tool":{group:"tools",className:"bpmn-icon-lasso-tool",title:s("Activate lasso tool"),action:{click:function(p){r.activateSelection(p)}}},"space-tool":{group:"tools",className:"bpmn-icon-space-tool",title:s("Activate create/remove space tool"),action:{click:function(p){i.activateSelection(p)}}},"global-connect-tool":{group:"tools",className:"bpmn-icon-connection-multi",title:s("Activate global connect tool"),action:{click:function(p){a.start(p)}}},"tool-separator":{group:"tools",separator:!0},"create.start-event":c("bpmn:StartEvent","event","bpmn-icon-start-event-none",s("Create start event")),"create.intermediate-event":c("bpmn:IntermediateThrowEvent","event","bpmn-icon-intermediate-event-none",s("Create intermediate/boundary event")),"create.end-event":c("bpmn:EndEvent","event","bpmn-icon-end-event-none",s("Create end event")),"create.exclusive-gateway":c("bpmn:ExclusiveGateway","gateway","bpmn-icon-gateway-none",s("Create gateway")),"create.task":c("bpmn:Task","activity","bpmn-icon-task",s("Create task")),"create.data-object":c("bpmn:DataObjectReference","data-object","bpmn-icon-data-object",s("Create data object reference")),"create.data-store":c("bpmn:DataStoreReference","data-store","bpmn-icon-data-store",s("Create data store reference")),"create.subprocess-expanded":{group:"activity",className:"bpmn-icon-subprocess-expanded",title:s("Create expanded sub-process"),action:{dragstart:u,click:u}},"create.participant-expanded":{group:"collaboration",className:"bpmn-icon-participant",title:s("Create pool/participant"),action:{dragstart:l,click:l}},"create.group":c("bpmn:Group","artifact","bpmn-icon-group",s("Create group"))}),e};const YO={__depends__:[GO,hc,zy,WO,UO,qO,sa],__init__:["paletteProvider"],paletteProvider:["type",Gf]};var KO=250;function Vf(e,t,n,i,r){ee.call(this,e);function o(s){var c=s.canExecute.replacements;L(c,function(u){var l=u.oldElementId,p={type:u.newElementType};if(!s.visualReplacements[l]){var f=t.get(l);j(p,{x:f.x,y:f.y});var d=n.createShape(p);i.addShape(d,f.parent);var g=at('[data-element-id="'+Da(f.id)+'"]',s.dragGroup);g&&me(g,{display:"none"});var h=r.addDragger(d,s.dragGroup);s.visualReplacements[l]=h,i.removeShape(d)}})}function a(s){var c=s.visualReplacements;L(c,function(u,l){var p=at('[data-element-id="'+Da(l)+'"]',s.dragGroup);p&&me(p,{display:"inline"}),u.remove(),c[l]&&delete c[l]})}e.on("shape.move.move",KO,function(s){var c=s.context,u=c.canExecute;c.visualReplacements||(c.visualReplacements={}),u&&u.replacements?o(c):a(c)})}Vf.$inject=["eventBus","elementRegistry","elementFactory","canvas","previewSupport"],he(Vf,ee);const XO={__depends__:[To],__init__:["bpmnReplacePreview"],bpmnReplacePreview:["type",Vf]};var ZO=1250,Wf=40,QO=20,JO=10,mx=20,gx=["x","y"],eD=Math.abs;function yx(e){e.on(["connect.hover","connect.move","connect.end"],ZO,function(t){var n=t.context,i=n.canExecute,r=n.start,o=n.hover,a=n.source,s=n.target;t.originalEvent&&An(t.originalEvent)||(n.initialConnectionStart||(n.initialConnectionStart=n.connectionStart),i&&o&&tD(t,o,oD(o)),o&&rD(i,["bpmn:Association","bpmn:DataInputAssociation","bpmn:DataOutputAssociation","bpmn:SequenceFlow"])?(n.connectionStart=Yn(r),He(o,["bpmn:Event","bpmn:Gateway"])&&vx(t,Yn(o)),He(o,["bpmn:Task","bpmn:SubProcess"])&&nD(t,o),_(a,"bpmn:BoundaryEvent")&&s===a.host&&iD(t)):bx(i,"bpmn:MessageFlow")?(_(r,"bpmn:Event")&&(n.connectionStart=Yn(r)),_(o,"bpmn:Event")&&vx(t,Yn(o))):n.connectionStart=n.initialConnectionStart)})}yx.$inject=["eventBus"];function tD(e,t,n){gx.forEach(function(i){var r=_x(i,t);e[i]<t[i]+n?Bt(e,i,t[i]+n):e[i]>t[i]+r-n&&Bt(e,i,t[i]+r-n)})}function nD(e,t){var n=Yn(t);gx.forEach(function(i){aD(e,t,i)&&Bt(e,i,n[i])})}function iD(e){var t=e.context,n=t.source,i=t.target;if(!sD(t)){var r=Yn(n),o=nn(r,i,-10),a=[];/top|bottom/.test(o)&&a.push("x"),/left|right/.test(o)&&a.push("y"),a.forEach(function(s){var c=e[s],u;eD(c-r[s])<Wf&&(c>r[s]?u=r[s]+Wf:u=r[s]-Wf,Bt(e,s,u))})}}function vx(e,t){Bt(e,"x",t.x),Bt(e,"y",t.y)}function bx(e,t){return e&&e.type===t}function rD(e,t){return Yi(t,function(n){return bx(e,n)})}function _x(e,t){return e==="x"?t.width:t.height}function oD(e){return _(e,"bpmn:Task")?JO:QO}function aD(e,t,n){return e[n]>t[n]+mx&&e[n]<t[n]+_x(n,t)-mx}function sD(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 wu,n.initDefaults(this._defaultSnaps)),n};function wu(){this._snapValues={}}wu.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)},wu.prototype.snap=function(e,t,n,i){var r=this._snapValues[t];return r&&K2(e[n],r[n],i)},wu.prototype.initDefaults=function(e){var t=this;L(e||{},function(n,i){L(n,function(r){t.add(i,r)})})};var cD=1250;function xi(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"],cD,function(r){var o=r.context,a=o.shape,s=o.snapContext,c=o.target;if(!(r.originalEvent&&An(r.originalEvent))&&!(jo(r)||!c)){var u=s.pointsForTarget(c);u.initialized||(u=i.addSnapTargetPoints(u,a,c),u.initialized=!0),n.snap(r,u)}}),t.on(["create.cleanup","shape.move.cleanup"],function(){n.hide()})}xi.$inject=["elementRegistry","eventBus","snapping"],xi.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=Yn(i,e):o={x:e.x+Yn(i).x,y:e.y+Yn(i).y};var a={x:o.x-i.width/2,y:o.y-i.height/2},s={x:o.x+i.width/2,y:o.y+i.height/2};return r.setSnapOrigin("mid",{x:o.x-e.x,y:o.y-e.y}),je(i)||(r.setSnapOrigin("top-left",{x:a.x-e.x,y:a.y-e.y}),r.setSnapOrigin("bottom-right",{x:s.x-e.x,y:s.y-e.y})),r},xi.prototype.addSnapTargetPoints=function(e,t,n){var i=this.getSnapTargets(t,n);return L(i,function(r){if(je(r)){je(t)&&e.add("mid",Yn(r));return}if(ct(r)){if(r.waypoints.length<3)return;var o=r.waypoints.slice(1,-1);L(o,function(a){e.add("mid",a)});return}e.add("mid",Yn(r))}),!De(t.x)||!De(t.y)||this._elementRegistry.get(t.id)&&e.add("mid",Yn(t)),e},xi.prototype.getSnapTargets=function(e,t){return a_(t).filter(function(n){return!uD(n)})};function uD(e){return!!e.hidden}var xx=1500;function zo(e,t){t.invoke(xi,this),e.on(["create.move","create.end"],xx,dD),e.on(["create.move","create.end","shape.move.move","shape.move.end"],xx,function(n){var i=n.context,r=i.canExecute,o=i.target,a=r&&(r==="attach"||r.attach);a&&!jo(n)&&lD(n,o)})}he(zo,xi),zo.$inject=["eventBus","injector"],zo.prototype.initSnap=function(e){var t=xi.prototype.initSnap.call(this,e),n=e.shape,i=!!this._elementRegistry.get(n.id);return L(n.outgoing,function(r){var o=r.waypoints[0];o=o.original||o,t.setSnapOrigin(r.id+"-docking",Ex(o,i,e))}),L(n.incoming,function(r){var o=r.waypoints[r.waypoints.length-1];o=o.original||o,t.setSnapOrigin(r.id+"-docking",Ex(o,i,e))}),_(n,"bpmn:Participant")&&t.setSnapLocations(["top-left","bottom-right","mid"]),t},zo.prototype.addSnapTargetPoints=function(e,t,n){xi.prototype.addSnapTargetPoints.call(this,e,t,n);var i=this.getSnapTargets(t,n);L(i,function(o){(fD(o)||pD([t,o],"bpmn:TextAnnotation"))&&(e.add("top-left",r_(o)),e.add("bottom-right",o_(o)))});var r=this._elementRegistry;return L(t.incoming,function(o){if(r.get(t.id)){wx(i,o.source)||e.add("mid",Te(o.source));var a=o.waypoints[0];e.add(o.id+"-docking",a.original||a)}}),L(t.outgoing,function(o){if(r.get(t.id)){wx(i,o.target)||e.add("mid",Te(o.target));var a=o.waypoints[o.waypoints.length-1];e.add(o.id+"-docking",a.original||a)}}),_(n,"bpmn:SequenceFlow")&&(e=this.addSnapTargetPoints(e,t,n.parent)),e},zo.prototype.getSnapTargets=function(e,t){return xi.prototype.getSnapTargets.call(this,e,t).filter(function(n){return!_(n,"bpmn:Lane")})};function lD(e,t){var n=Re(t),i=$g(e,t),r=e.context,o=r.shape,a;o.parent?a={x:0,y:0}:a=Te(o),/top/.test(i)?Bt(e,"y",n.top-a.y):/bottom/.test(i)&&Bt(e,"y",n.bottom-a.y),/left/.test(i)?Bt(e,"x",n.left-a.x):/right/.test(i)&&Bt(e,"x",n.right-a.x)}function pD(e,t){return e.every(function(n){return _(n,t)})}function fD(e){return _(e,"bpmn:SubProcess")&&qe(e)?!0:_(e,"bpmn:Participant")}function dD(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)&&Bt(e,"x",e.x),(i&&i>=e.y||o&&o<=e.y)&&Bt(e,"y",e.y)}}function wx(e,t){return e.indexOf(t)!==-1}function Ex(e,t,n){return t?{x:e.x-n.x,y:e.y-n.y}:{x:e.x,y:e.y}}var hD=1250;function Ka(e,t){var n=this;e.on(["resize.start"],function(i){n.initSnap(i)}),e.on(["resize.move","resize.end"],hD,function(i){var r=i.context,o=r.shape,a=o.parent,s=r.direction,c=r.snapContext;if(!(i.originalEvent&&An(i.originalEvent))&&!jo(i)){var u=c.pointsForTarget(a);u.initialized||(u=n.addSnapTargetPoints(u,o,a,s),u.initialized=!0),yD(s)&&Bt(i,"x",i.x),vD(s)&&Bt(i,"y",i.y),t.snap(i,u)}}),e.on(["resize.cleanup"],function(){t.hide()})}Ka.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=Sx(n,i);return r.setSnapOrigin("corner",{x:o.x-e.x,y:o.y-e.y}),r},Ka.prototype.addSnapTargetPoints=function(e,t,n,i){var r=this.getSnapTargets(t,n);return L(r,function(o){e.add("corner",o_(o)),e.add("corner",r_(o))}),e.add("corner",Sx(t,i)),e},Ka.$inject=["eventBus","snapping"],Ka.prototype.getSnapTargets=function(e,t){return a_(t).filter(function(n){return!mD(n,e)&&!ct(n)&&!gD(n)&&!je(n)})};function Sx(e,t){var n=Te(e),i=Re(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 mD(e,t){return e.host===t}function gD(e){return!!e.hidden}function yD(e){return e==="n"||e==="s"}function vD(e){return e==="e"||e==="w"}var bD=7,_D=1e3;function Rr(e){this._canvas=e,this._asyncHide=Du(vn(this.hide,this),_D)}Rr.$inject=["canvas"],Rr.prototype.snap=function(e,t){var n=e.context,i=n.snapContext,r=i.getSnapLocations(),o={x:jo(e,"x"),y:jo(e,"y")};L(r,function(a){var s=i.getSnapOrigin(a),c={x:e.x+s.x,y:e.y+s.y};if(L(["x","y"],function(u){var l;o[u]||(l=t.snap(c,a,u,bD),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),L(["x","y"],function(a){var s=o[a];Yt(s)&&Bt(e,a,s.originValue)})},Rr.prototype._createLine=function(e){var t=this._canvas.getLayer("snap"),n=Se("path");return me(n,{d:"M0,0 L0,0"}),Ye(n).add("djs-snap-line"),Ie(t,n),{update:function(i){De(i)?e==="horizontal"?me(n,{d:"M-100000,"+i+" L+100000,"+i,display:""}):me(n,{d:"M "+i+",-100000 L "+i+", +100000",display:""}):me(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(){L(this._snapLines,function(e){e.update()})};const xD={__depends__:[{__init__:["createMoveSnapping","resizeSnapping","snapping"],createMoveSnapping:["type",xi],resizeSnapping:["type",Ka],snapping:["type",Rr]}],__init__:["connectSnapping","createMoveSnapping"],connectSnapping:["type",yx],createMoveSnapping:["type",zo]};var Rx=300;function Be(e,t,n,i){this._open=!1,this._results={},this._eventMaps=[],this._cachedRootElement=null,this._cachedSelection=null,this._cachedViewbox=null,this._canvas=e,this._eventBus=t,this._selection=n,this._translate=i,this._container=this._getBoxHtml(),this._searchInput=at(Be.INPUT_SELECTOR,this._container),this._resultsContainer=at(Be.RESULTS_CONTAINER_SELECTOR,this._container),this._canvas.getContainer().appendChild(this._container),t.on(["canvas.destroy","diagram.destroy","drag.init","elements.changed"],this.close,this)}Be.$inject=["canvas","eventBus","selection","translate"],Be.prototype._bindEvents=function(){var e=this;function t(n,i,r,o){e._eventMaps.push({el:n,type:r,listener:Rn.bind(n,i,r,o)})}t(document,"html","click",function(n){e.close(!1)}),t(this._container,Be.INPUT_SELECTOR,"click",function(n){n.stopPropagation(),n.delegateTarget.focus()}),t(this._container,Be.RESULT_SELECTOR,"mouseover",function(n){n.stopPropagation(),e._scrollToNode(n.delegateTarget),e._preselect(n.delegateTarget)}),t(this._container,Be.RESULT_SELECTOR,"click",function(n){n.stopPropagation(),e._select(n.delegateTarget)}),t(this._container,Be.INPUT_SELECTOR,"keydown",function(n){Vt("ArrowUp",n)&&n.preventDefault(),Vt("ArrowDown",n)&&n.preventDefault()}),t(this._container,Be.INPUT_SELECTOR,"keyup",function(n){if(Vt("Escape",n))return e.close();if(Vt("Enter",n)){var i=e._getCurrentResult();return i?e._select(i):e.close(!1)}if(Vt("ArrowUp",n))return e._scrollToDirection(!0);if(Vt("ArrowDown",n))return e._scrollToDirection();Vt(["ArrowLeft","ArrowRight"],n)||e._search(n.delegateTarget.value)})},Be.prototype._unbindEvents=function(){this._eventMaps.forEach(function(e){Rn.unbind(e.el,e.type,e.listener)})},Be.prototype._search=function(e){var t=this;if(this._clearResults(),!!e.trim()){var n=this._searchProvider.find(e);if(n=n.filter(function(r){return!t._canvas.getRootElements().includes(r.element)}),!n.length){this._selection.select(null);return}n.forEach(function(r){var o=r.element.id,a=t._createResultNode(r,o);t._results[o]={element:r.element,node:a}});var i=at(Be.RESULT_SELECTOR,this._resultsContainer);this._scrollToNode(i),this._preselect(i)}},Be.prototype._scrollToDirection=function(e){var t=this._getCurrentResult();if(t){var n=e?t.previousElementSibling:t.nextElementSibling;n&&(this._scrollToNode(n),this._preselect(n))}},Be.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)}},Be.prototype._clearResults=function(){_s(this._resultsContainer),this._results={},this._eventBus.fire("searchPad.cleared")},Be.prototype._getCurrentResult=function(){return at(Be.RESULT_SELECTED_SELECTOR,this._resultsContainer)},Be.prototype._createResultNode=function(e,t){var n=dt(Be.RESULT_HTML);return e.primaryTokens.length>0&&Cx(n,e.primaryTokens,Be.RESULT_PRIMARY_HTML),Cx(n,e.secondaryTokens,Be.RESULT_SECONDARY_HTML),ln(n,Be.RESULT_ID_ATTRIBUTE,t),this._resultsContainer.appendChild(n),n},Be.prototype.registerProvider=function(e){this._searchProvider=e},Be.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,gt(this._canvas.getContainer()).add("djs-search-open"),gt(this._container).add("open"),this._searchInput.focus(),this._eventBus.fire("searchPad.opened"))},Be.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,gt(this._canvas.getContainer()).remove("djs-search-open"),gt(this._container).remove("open"),this._clearResults(),this._searchInput.value="",this._searchInput.blur(),this._eventBus.fire("searchPad.closed"),this._canvas.restoreFocus())},Be.prototype.toggle=function(){this.isOpen()?this.close():this.open()},Be.prototype.isOpen=function(){return this._open},Be.prototype._preselect=function(e){var t=this._getCurrentResult();if(e!==t){t&&gt(t).remove(Be.RESULT_SELECTED_CLASS);var n=ln(e,Be.RESULT_ID_ATTRIBUTE),i=this._results[n].element;gt(e).add(Be.RESULT_SELECTED_CLASS),this._canvas.scrollToElement(i,{top:Rx}),this._selection.select(i),this._eventBus.fire("searchPad.preselected",i)}},Be.prototype._select=function(e){var t=ln(e,Be.RESULT_ID_ATTRIBUTE),n=this._results[t].element;this._cachedSelection=null,this._cachedViewbox=null,this.close(!1),this._canvas.scrollToElement(n,{top:Rx}),this._selection.select(n),this._eventBus.fire("searchPad.selected",n)},Be.prototype._getBoxHtml=function(){const e=dt(Be.BOX_HTML),t=at(Be.INPUT_SELECTOR,e);return t&&t.setAttribute("aria-label",this._translate("Search in diagram")),e};function Cx(e,t,n){var i=wD(t),r=dt(n);r.innerHTML=i,e.appendChild(r)}function wD(e){var t="";return e.forEach(function(n){var i=Lv(n.value||n.matched||n.normal),r=n.match||n.matched;r?t+='<b class="'+Be.RESULT_HIGHLIGHT_CLASS+'">'+i+"</b>":t+=i}),t!==""?t:null}Be.CONTAINER_SELECTOR=".djs-search-container",Be.INPUT_SELECTOR=".djs-search-input input",Be.RESULTS_CONTAINER_SELECTOR=".djs-search-results",Be.RESULT_SELECTOR=".djs-search-result",Be.RESULT_SELECTED_CLASS="djs-search-result-selected",Be.RESULT_SELECTED_SELECTOR="."+Be.RESULT_SELECTED_CLASS,Be.RESULT_ID_ATTRIBUTE="data-result-id",Be.RESULT_HIGHLIGHT_CLASS="djs-search-highlight",Be.BOX_HTML=`<div class="djs-search-container djs-scrollable">
335
+ </svg>`},kk=900;function Va(e,t,n,i){this._distributeElements=t,this._translate=n,this._popupMenu=e,this._rules=i,e.registerProvider("align-elements",kk,this)}Va.$inject=["popupMenu","distributeElements","translate","rules"],Va.prototype.getPopupMenuEntries=function(e){var t={};return this._isAllowed(e)&&H(t,this._getEntries(e)),t},Va.prototype._isAllowed=function(e){return this._rules.allowed("elements.distribute",{elements:e})},Va.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:R_.horizontal,action:function(o,a){t.trigger(e,"horizontal"),i.close()}},"distribute-elements-vertical":{group:"distribute",title:n("Distribute elements vertically"),imageHtml:R_.vertical,action:function(o,a){t.trigger(e,"vertical"),i.close()}}};return r};const Ok={__depends__:[Rf,Mk],__init__:["bpmnDistributeElements","distributeElementsMenuProvider"],bpmnDistributeElements:["type",lu],distributeElementsMenuProvider:["type",Va]};var C_="is not a registered action",Dk="is already registered";function Kn(e,t){this._eventBus=e,this._actions={};var n=this;e.on("diagram.init",function(){n._registerDefaultActions(t),e.fire("editorActions.init",{editorActions:n})})}Kn.$inject=["eventBus","injector"],Kn.prototype._registerDefaultActions=function(e){var t=e.get("commandStack",!1),n=e.get("modeling",!1),i=e.get("selection",!1),r=e.get("zoomScroll",!1),o=e.get("copyPaste",!1),a=e.get("canvas",!1),s=e.get("rules",!1),c=e.get("keyboardMove",!1),u=e.get("keyboardMoveSelection",!1);t&&(this.register("undo",function(){t.undo()}),this.register("redo",function(){t.redo()})),o&&i&&this.register("copy",function(){var l=i.get();if(l.length)return o.copy(l)}),o&&i&&this.register("duplicate",function(){var l=i.get();if(l.length)return o.duplicate(l)}),o&&this.register("paste",function(){o.paste()}),o&&i&&s&&this.register("cut",function(){var l=i.get();if(l.length){var p=s.allowed("elements.delete",{elements:l});if(p!==!1){var f=ke(p)?p:l;return o.cut(f.slice())}}}),r&&this.register("stepZoom",function(l){r.stepZoom(l.value)}),a&&this.register("zoom",function(l){a.zoom(l.value)}),n&&i&&s&&this.register("removeSelection",function(){var l=i.get();if(l.length){var p=s.allowed("elements.delete",{elements:l}),f;p!==!1&&(ke(p)?f=p:f=l,f.length&&n.removeElements(f.slice()))}}),c&&this.register("moveCanvas",function(l){c.moveCanvas(l)}),u&&this.register("moveSelection",function(l){u.moveSelection(l.direction,l.accelerated)})},Kn.prototype.trigger=function(e,t){if(!this._actions[e])throw If(e,C_);var n=this._eventBus.fire("editorActions.allowed",{action:e,opts:t});if(n!==!1)return this._actions[e](t)},Kn.prototype.register=function(e,t){var n=this;if(typeof e=="string")return this._registerAction(e,t);L(e,function(i,r){n._registerAction(r,i)})},Kn.prototype._registerAction=function(e,t){if(this.isRegistered(e))throw If(e,Dk);this._actions[e]=t},Kn.prototype.unregister=function(e){if(!this.isRegistered(e))throw If(e,C_);this._actions[e]=void 0},Kn.prototype.getActions=function(){return Object.keys(this._actions)},Kn.prototype.isRegistered=function(e){return!!this._actions[e]};function If(e,t){return new Error(e+" "+t)}const Lk={__init__:["editorActions"],editorActions:["type",Kn]};function pu(e){e.invoke(Kn,this)}de(pu,Kn),pu.$inject=["injector"],pu.prototype._registerDefaultActions=function(e){Kn.prototype._registerDefaultActions.call(this,e);var t=e.get("canvas",!1),n=e.get("elementRegistry",!1),i=e.get("selection",!1),r=e.get("spaceTool",!1),o=e.get("lassoTool",!1),a=e.get("handTool",!1),s=e.get("globalConnect",!1),c=e.get("distributeElements",!1),u=e.get("alignElements",!1),l=e.get("directEditing",!1),p=e.get("searchPad",!1),f=e.get("modeling",!1),d=e.get("contextPad",!1);t&&n&&i&&this._registerAction("selectElements",function(){var g=t.getRootElement(),h=n.filter(function(m){return m!==g});return i.select(h),h}),r&&this._registerAction("spaceTool",function(){r.toggle()}),o&&this._registerAction("lassoTool",function(){o.toggle()}),a&&this._registerAction("handTool",function(){a.toggle()}),s&&this._registerAction("globalConnectTool",function(){s.toggle()}),i&&c&&this._registerAction("distributeElements",function(g){var h=i.get(),m=g.type;h.length&&c.trigger(h,m)}),i&&u&&this._registerAction("alignElements",function(g){var h=i.get(),m=[],E=g.type;h.length&&(m=Ge(h,function(y){return!_(y,"bpmn:Lane")}),u.trigger(m,E))}),i&&f&&this._registerAction("setColor",function(g){var h=i.get();h.length&&f.setColor(h,g)}),i&&l&&this._registerAction("directEditing",function(){var g=i.get();g.length&&l.activate(g[0])}),p&&this._registerAction("find",function(){p.toggle()}),t&&f&&this._registerAction("moveToOrigin",function(){var g=t.getRootElement(),h,m;_(g,"bpmn:Collaboration")?m=n.filter(function(E){return _(E.parent,"bpmn:Collaboration")}):m=n.filter(function(E){return E!==g&&!_(E.parent,"bpmn:SubProcess")}),h=Tt(m),f.moveElements(m,{x:-h.x,y:-h.y},g)}),i&&d&&this._registerAction("replaceElement",function(g){d.triggerEntry("replace","click",g)})};const Ik={__depends__:[Lk],editorActions:["type",pu]};function P_(e){e.on(["create.init","shape.move.init"],function(t){var n=t.context,i=t.shape;ze(i,["bpmn:Participant","bpmn:SubProcess","bpmn:TextAnnotation"])&&(n.gridSnappingContext||(n.gridSnappingContext={}),n.gridSnappingContext.snapLocation="top-left")})}P_.$inject=["eventBus"];function Ur(e,t){J.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;xn(a)?r.newBounds=n.snapComplex(c,a):r.newBounds=n.snapSimple(s,c)}})}Ur.$inject=["eventBus","gridSnapping","modeling"],de(Ur,J),Ur.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},Ur.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},Ur.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),H(e,o),e},Ur.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),H(e,o),e};var Nk=2e3;function A_(e,t){e.on(["spaceTool.move","spaceTool.end"],Nk,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)}})}A_.$inject=["eventBus","gridSnapping"];const Bk={__init__:["gridSnappingResizeBehavior","gridSnappingSpaceToolBehavior"],gridSnappingResizeBehavior:["type",Ur],gridSnappingSpaceToolBehavior:["type",A_]};var fu=10;function Nf(e,t,n){return n||(n="round"),Math[n](e/t)*t}var $k=1200,jk=800;function vr(e,t,n){var i=!n||n.active!==!1;this._eventBus=t;var r=this;t.on("diagram.init",jk,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"],$k,function(o){var a=o.originalEvent;if(!(!r.active||a&&Tn(a))){var s=o.context,c=s.gridSnappingContext;c||(c=s.gridSnappingContext={}),["x","y"].forEach(function(u){var l={},p=Hk(o,u,e);p&&(l.offset=p);var f=Fk(o,u);f&&H(l,f),$o(o,u)||r.snapEvent(o,u,l)})}})}vr.prototype.snapEvent=function(e,t,n){var i=this.snapValue(e[t],n);Dt(e,t,i)},vr.prototype.getGridSpacing=function(){return fu},vr.prototype.snapValue=function(e,t){var n=0;t&&t.offset&&(n=t.offset),e+=n,e=Nf(e,fu);var i,r;return t&&t.min&&(i=t.min,Le(i)&&(i=Nf(i+n,fu,"ceil"),e=Math.max(e,i))),t&&t.max&&(r=t.max,Le(r)&&(r=Nf(r+n,fu,"floor"),e=Math.min(e,r))),e-=n,e},vr.prototype.isActive=function(){return this.active},vr.prototype.setActive=function(e){this.active=e,this._eventBus.fire("gridSnapping.toggle",{active:e})},vr.prototype.toggleActive=function(){this.setActive(!this.active)},vr.$inject=["elementRegistry","eventBus","config.gridSnapping"];function Fk(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&&(du(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&&(du(t)?M_(s)?a.x.max=c.left:a.x.min=c.right:T_(s)?a.y.max=c.top:a.y.min=c.bottom),u&&(du(t)?M_(s)?a.x.min=u.left:a.x.max=u.right:T_(s)?a.y.min=u.top:a.y.max=u.bottom),a[t]}function Hk(e,t,n){var i=e.context,r=e.shape,o=i.gridSnappingContext,a=o.snapLocation,s=o.snapOffset;return s&&Le(s[t])||(s||(s=o.snapOffset={}),Le(s[t])||(s[t]=0),!r)||(n.get(r.id)||(du(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 du(e){return e==="x"}function T_(e){return e.indexOf("n")!==-1}function M_(e){return e.indexOf("w")!==-1}const zk={__depends__:[Bk],__init__:["gridSnapping"],gridSnapping:["type",vr]};var Gk=2e3;function k_(e,t,n){e.on("autoPlace",Gk,function(i){var r=i.source,o=Oe(r),a=i.shape,s=Mv(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],_(a,"bpmn:TextAnnotation")&&(Vk(c)?u.offset=-a.width/2:u.offset=-a.height/2),s[c]=t.snapValue(s[c],u))}),s})}k_.$inject=["eventBus","gridSnapping","elementRegistry"];function Vk(e){return e==="x"}var Wk=1750;function O_(e,t,n){t.on(["create.start","shape.move.start"],Wk,function(i){var r=i.context,o=r.shape,a=e.getRootElement();if(!(!_(o,"bpmn:Participant")||!_(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}))}})}O_.$inject=["canvas","eventBus","gridSnapping"];var Uk=3e3;function hu(e,t,n){J.call(this,e),this._gridSnapping=t;var i=this;this.postExecuted(["connection.create","connection.layout"],Uk,function(r){var o=r.context,a=o.connection,s=o.hints||{},c=a.waypoints;s.connectionStart||s.connectionEnd||s.createElementsBehavior===!1||qk(c)&&n.updateWaypoints(a,i.snapMiddleSegments(c))})}hu.$inject=["eventBus","gridSnapping","modeling"],de(hu,J),hu.prototype.snapMiddleSegments=function(e){var t=this._gridSnapping,n;e=e.slice();for(var i=1;i<e.length-2;i++)n=Xk(t,e[i],e[i+1]),e[i]=n[0],e[i+1]=n[1];return e};function qk(e){return e.length>3}function Yk(e){return e==="h"}function Kk(e){return e==="v"}function Xk(e,t,n){var i=Mi(t,n),r={};return Yk(i)&&(r.y=e.snapValue(t.y)),Kk(i)&&(r.x=e.snapValue(t.x)),("x"in r||"y"in r)&&(t=H({},t,r),n=H({},n,r)),[t,n]}const Zk={__depends__:[zk,{__init__:["gridSnappingAutoPlaceBehavior","gridSnappingParticipantBehavior","gridSnappingLayoutConnectionBehavior"],gridSnappingAutoPlaceBehavior:["type",k_],gridSnappingParticipantBehavior:["type",O_],gridSnappingLayoutConnectionBehavior:["type",hu]}],__init__:["bpmnGridSnapping"],bpmnGridSnapping:["type",P_]};var Qk=30,D_=30;function Wa(e,t){this._interactionEvents=t;var n=this;e.on(["interactionEvents.createHit","interactionEvents.updateHit"],function(i){var r=i.element,o=i.gfx;if(_(r,"bpmn:Lane"))return n._createParticipantHit(r,o);if(_(r,"bpmn:Participant"))return Ue(r)?n._createParticipantHit(r,o):n._createDefaultHit(r,o);if(_(r,"bpmn:SubProcess"))return Ue(r)?n._createSubProcessHit(r,o):n._createDefaultHit(r,o)})}Wa.$inject=["eventBus","interactionEvents"],Wa.prototype._createDefaultHit=function(e,t){return this._interactionEvents.removeHits(t),this._interactionEvents.createDefaultHit(e,t),!0},Wa.prototype._createParticipantHit=function(e,t){this._interactionEvents.removeHits(t),this._interactionEvents.createBoxHit(t,"no-move",{width:e.width,height:e.height}),this._interactionEvents.createBoxHit(t,"click-stroke",{width:e.width,height:e.height});var n=qt(e)?{width:Qk,height:e.height}:{width:e.width,height:D_};return this._interactionEvents.createBoxHit(t,"all",n),!0},Wa.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:D_}),!0};const Jk={__init__:["bpmnInteractionEvents"],bpmnInteractionEvents:["type",Wa]};function mu(e){e.invoke(ko,this)}de(mu,ko),mu.$inject=["injector"],mu.prototype.registerBindings=function(e,t){ko.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 eO={__depends__:[lf],__init__:["keyboardBindings"],keyboardBindings:["type",mu]};var tO={moveSpeed:1,moveSpeedAccelerated:10},nO=1500,L_="left",I_="up",N_="right",B_="down",iO={ArrowLeft:L_,Left:L_,ArrowUp:I_,Up:I_,ArrowRight:N_,Right:N_,ArrowDown:B_,Down:B_},rO={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 $_(e,t,n,i,r){var o=this;this._config=H({},tO,e||{}),t.addListener(nO,function(a){var s=a.keyEvent,c=iO[s.key];if(c&&!t.isCmd(s)){var u=t.isShift(s);return o.moveSelection(c,u),!0}}),this.moveSelection=function(a,s){var c=r.get();if(c.length){var u=this._config[s?"moveSpeedAccelerated":"moveSpeed"],l=rO[a](u),p=i.allowed("elements.move",{shapes:c,hints:{keyboardMove:!0}});p&&n.moveElements(c,l)}}}$_.$inject=["config.keyboardMoveSelection","keyboard","modeling","rules","selection"];const oO={__depends__:[lf,Vn],__init__:["keyboardMoveSelection"],keyboardMoveSelection:["type",$_]};var j_=10;function Ua(e,t,n,i){this._dragging=i,this._rules=t;var r=this;function o(c,u){var l=c.shape,p=c.direction,f=c.resizeConstraints,d;c.delta=u,d=tC(l,p,u),c.newBounds=iC(d,f),c.canExecute=r.canResize(c)}function a(c){var u=c.resizeConstraints,l=c.minBounds;u===void 0&&(l===void 0&&(l=r.computeMinResizeBox(c)),c.resizeConstraints={min:Pe(l)})}function s(c){var u=c.shape,l=c.canExecute,p=c.newBounds;if(l){if(p=nm(p),!aO(u,p))return;n.resizeShape(u,p)}}e.on("resize.start",function(c){a(c.context)}),e.on("resize.move",function(c){var u={x:c.dx,y:c.dy};o(c.context,u)}),e.on("resize.end",function(c){s(c.context)})}Ua.prototype.canResize=function(e){var t=this._rules,n=Qn(e,["newBounds","shape","delta","direction"]);return t.allowed("shape.resize",n)},Ua.prototype.activate=function(e,t,n){var i=this._dragging,r,o;if(typeof n=="string"&&(n={direction:n}),r=H({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,F_(t,o),"resize",{autoActivate:!0,cursor:sO(o),data:{shape:t,context:r}})},Ua.prototype.computeMinResizeBox=function(e){var t=e.shape,n=e.direction,i,r;return i=e.minDimensions||{width:j_,height:j_},r=Gm(t,e.childrenBoxPadding),rC(n,t,i,r)},Ua.$inject=["eventBus","rules","modeling","dragging"];function aO(e,t){return e.x!==t.x||e.y!==t.y||e.width!==t.width||e.height!==t.height}function F_(e,t){var n=Oe(e),i=Pe(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 sO(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 H_="djs-resizing",z_="resize-not-ok",cO=500;function G_(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,H_)),s.width>5&&he(c,{x:s.x,width:s.width}),s.height>5&&he(c,{y:s.y,height:s.height}),o.canExecute?qe(c).remove(z_):qe(c).add(z_)}function r(o){var a=o.shape,s=o.frame;s&&$t(o.frame),t.removeMarker(a,H_)}e.on("resize.move",cO,function(o){i(o.context)}),e.on("resize.cleanup",function(o){r(o.context)})}G_.$inject=["eventBus","canvas","previewSupport"];var gu=-6,yu=8,vu=20,qa="djs-resizer",uO=["n","w","s","e","nw","ne","se","sw"];function br(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&&L(a,mn(r.addResizer,r))}),e.on("shape.changed",function(o){var a=o.element;n.isSelected(a)&&(r.removeResizers(),r.addResizer(a))})}br.prototype.makeDraggable=function(e,t,n){var i=this._resize;function r(o){sr(o)&&i.activate(o,e,n)}Ne.bind(t,"mousedown",r),Ne.bind(t,"touchstart",r)},br.prototype._createResizer=function(e,t,n,i){var r=this._getResizersParent(),o=lO(i),a=Ce("g");qe(a).add(qa),qe(a).add(qa+"-"+e.id),qe(a).add(qa+"-"+i),Be(r,a);var s=Ce("rect");he(s,{x:-yu/2+o.x,y:-yu/2+o.y,width:yu,height:yu}),qe(s).add(qa+"-visual"),Be(a,s);var c=Ce("rect");return he(c,{x:-vu/2+o.x,y:-vu/2+o.y,width:vu,height:vu}),qe(c).add(qa+"-hit"),Be(a,c),Os(a,t,n),a},br.prototype.createResizer=function(e,t){var n=F_(e,t),i=this._createResizer(e,n.x,n.y,t);this.makeDraggable(e,i,t)},br.prototype.addResizer=function(e){var t=this;st(e)||L(uO,function(n){t._resize.canResize({shape:e,direction:n})&&t.createResizer(e,n)})},br.prototype.removeResizers=function(){var e=this._getResizersParent();Es(e)},br.prototype._getResizersParent=function(){return this._canvas.getLayer("resizers")},br.$inject=["eventBus","canvas","selection","resize"];function lO(e){var t={x:0,y:0};return e.indexOf("e")!==-1?t.x=-gu:e.indexOf("w")!==-1&&(t.x=gu),e.indexOf("s")!==-1?t.y=-gu:e.indexOf("n")!==-1&&(t.y=gu),t}const V_={__depends__:[mi,Ni,Ao],__init__:["resize","resizePreview","resizeHandles"],resize:["type",Ua],resizePreview:["type",G_],resizeHandles:["type",br]};var pO=2e3;function Ya(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"],pO,function(c){i.isActive(c.element)&&i.cancel()}),e.on(["commandStack.changed"],function(c){i.isActive()&&i.cancel()}),e.on("directEditing.activate",function(c){o.removeResizers()}),e.on("create.end",500,function(c){var u=c.context,l=u.shape,p=c.context.canExecute,f=c.isTouch;f||p&&(u.hints&&u.hints.createElementsBehavior===!1||s(l))}),e.on("autoPlace.end",500,function(c){s(c.shape)});function s(c,u){(u||ze(c,["bpmn:Activity","bpmn:Event","bpmn:TextAnnotation","bpmn:Participant"]))&&i.activate(c)}}Ya.$inject=["eventBus","bpmnFactory","canvas","directEditing","modeling","resizeHandles","textRenderer"],Ya.prototype.activate=function(e){var t=Bn(e);if(t!==void 0){var n={text:t},i=this.getEditingBBox(e);H(n,i);var r={},o=n.style||{};return H(o,{backgroundColor:null,border:null}),(ze(e,["bpmn:Task","bpmn:Participant","bpmn:Lane","bpmn:CallActivity"])||W_(e))&&H(r,{centerVertically:!0}),ir(e)&&(H(r,{resizable:!0,autoResize:!0}),H(o,{backgroundColor:"#ffffff",border:"1px solid #ccc"})),_(e,"bpmn:TextAnnotation")&&(H(r,{resizable:!0,autoResize:!0}),H(o,{backgroundColor:"#ffffff",border:"1px solid #ccc"})),H(n,{options:r,style:o}),n}},Ya.prototype.getEditingBBox=function(e){var t=this._canvas,n=e.label||e,i=t.getAbsoluteBBox(n),r={x:i.x+i.width/2,y:i.y+i.height/2},o={x:i.x,y:i.y},a=t.zoom(),s=this._textRenderer.getDefaultStyle(),c=this._textRenderer.getExternalStyle(),u=c.fontSize*a,l=c.lineHeight,p=s.fontSize*a,f=s.lineHeight,d={fontFamily:this._textRenderer.getDefaultStyle().fontFamily,fontWeight:this._textRenderer.getDefaultStyle().fontWeight};if(_(e,"bpmn:Lane")||hO(e)){var g=qt(e),h=g?{width:i.height,height:30*a,x:i.x-i.height/2+15*a,y:r.y-30*a/2}:{width:i.width,height:30*a};H(o,h),H(d,{fontSize:p+"px",lineHeight:f,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px",transform:g?"rotate(-90deg)":null})}if(dO(e)){var m=qt(e),E=m?{width:i.width,height:i.height}:{width:i.height,height:i.width,x:r.x-i.height/2,y:r.y-i.width/2};H(o,E),H(d,{fontSize:p+"px",lineHeight:f,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px",transform:m?null:"rotate(-90deg)"})}(ze(e,["bpmn:Task","bpmn:CallActivity"])||W_(e))&&(H(o,{width:i.width,height:i.height}),H(d,{fontSize:p+"px",lineHeight:f,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px"})),fO(e)&&(H(o,{width:i.width,x:i.x}),H(d,{fontSize:p+"px",lineHeight:f,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px"}));var y=1,x=i.width+2*y;if(n.labelTarget&&(H(o,{width:x,height:i.height+2*y,x:i.x-y,y:i.y-y}),H(d,{fontSize:u+"px",lineHeight:l})),ir(n)&&!Is(n)&&!Fe(n)){var S=El(e),P=t.getAbsoluteBBox({x:S.x,y:S.y,width:0,height:0}),C=u,D=Lr.width*a+2*y;H(o,{width:D,height:C+2*y,x:P.x-D/2,y:P.y-C/2-y}),H(d,{fontSize:u+"px",lineHeight:l})}return _(e,"bpmn:TextAnnotation")&&(H(o,{width:i.width+2*y,height:i.height+2*y,x:i.x-y,y:i.y-y,minWidth:30*a,minHeight:10*a}),H(d,{textAlign:"left",paddingTop:mo*a+"px",paddingBottom:mo*a+"px",paddingLeft:mo*a+"px",paddingRight:mo*a+"px",fontSize:p+"px",lineHeight:f})),{bounds:o,style:d}},Ya.prototype.update=function(e,t,n,i){var r,o;_(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}),mO(t)&&(t=null),this._modeling.updateLabel(e,t,r)};function W_(e){return _(e,"bpmn:SubProcess")&&!Ue(e)}function fO(e){return _(e,"bpmn:SubProcess")&&Ue(e)}function dO(e){return _(e,"bpmn:Participant")&&!Ue(e)}function hO(e){return _(e,"bpmn:Participant")&&Ue(e)}function mO(e){return!e||!e.trim()}var U_="djs-element-hidden",q_="djs-label-hidden";function Y_(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,_(o,"bpmn:TextAnnotation")){a=t.getAbsoluteBBox(o),s=Ce("g");var l=n.getScaledPath("TEXT_ANNOTATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:o.width,containerHeight:o.height,position:{mx:0,my:0}}),p=i.path=Ce("path");he(p,{d:l,strokeWidth:2,stroke:gO(o)}),Be(s,p),Be(r,s),en(s,o.x,o.y)}_(o,"bpmn:TextAnnotation")||o.labelTarget?t.addMarker(o,U_):(_(o,"bpmn:Task")||_(o,"bpmn:CallActivity")||_(o,"bpmn:SubProcess")||_(o,"bpmn:Participant")||_(o,"bpmn:Lane"))&&t.addMarker(o,q_)}),e.on("directEditing.resize",function(c){if(_(o,"bpmn:TextAnnotation")){var u=c.height,l=c.dy,p=Math.max(o.height/a.height*(u+l),0),f=n.getScaledPath("TEXT_ANNOTATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:o.width,containerHeight:p,position:{mx:0,my:0}});he(i.path,{d:f})}}),e.on(["directEditing.complete","directEditing.cancel"],function(c){var u=c.active;u&&(t.removeMarker(u.element.label||u.element,U_),t.removeMarker(o,q_)),o=void 0,a=void 0,s&&($t(s),s=void 0)})}Y_.$inject=["eventBus","canvas","pathMap"];function gO(e,t){var n=Ye(e);return n.get("stroke")||t||"black"}const yO={__depends__:[Hp,V_,b_],__init__:["labelEditingProvider","labelEditingPreview"],labelEditingProvider:["type",Ya],labelEditingPreview:["type",Y_]};var vO=500,bO=1e3;function vi(e,t,n){this._eventBus=e,this._elementRegistry=n,this._outlineOffset=5,this._outlineStyle=t.cls("djs-outline",["no-fill"]);var i=this;function r(o){iS(o)||i.createOutline(o)}e.on("element.hover",function(o){r(o.element)}),e.on("selection.changed",function(o){L(o.newSelection,r)}),e.on(["shape.changed","connection.changed"],vO,function(o){var a=o.element,s=o.gfx,c=ot(".djs-outline",s);c&&i.updateOutline(a,c)})}vi.prototype.createOutline=function(e){var t=this._elementRegistry.getGraphics(e);if(!t)throw new Error("cannot create outline for non-rendered element");var n=ot(".djs-outline",t);return n||(n=this.getOutline(e)||this._createOutlineGfx(),Be(t,n),this.updateOutline(e,n)),n},vi.prototype._createOutlineGfx=function(){var e=Ce("rect");return he(e,H({x:0,y:0,rx:4,width:100,height:100},this._outlineStyle)),e},vi.prototype.updateOutline=function(e,t){e.waypoints?this.updateConnectionOutline(t,e):this.updateShapeOutline(t,e)},vi.prototype.updateShapeOutline=function(e,t){var n=!1,i=this._getProviders();i.length&&L(i,function(r){n=n||r.updateOutline(t,e)}),n||he(e,{x:-this._outlineOffset,y:-this._outlineOffset,width:t.width+this._outlineOffset*2,height:t.height+this._outlineOffset*2})},vi.prototype.updateConnectionOutline=function(e,t){var n=Tt(t);he(e,{x:n.x-this._outlineOffset,y:n.y-this._outlineOffset,width:n.width+this._outlineOffset*2,height:n.height+this._outlineOffset*2})},vi.prototype.registerProvider=function(e,t){t||(t=e,e=bO),this._eventBus.on("outline.getProviders",e,function(n){n.providers.push(t)})},vi.prototype._getProviders=function(){var e=this._eventBus.createEvent({type:"outline.getProviders",providers:[]});return this._eventBus.fire(e),e.providers},vi.prototype.getOutline=function(e){var t,n=this._getProviders();return L(n,function(i){Wt(i.getOutline)&&(t=t||i.getOutline(e))}),t},vi.$inject=["eventBus","styles","elementRegistry"];var bu=6;function Bf(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)})}Bf.prototype._updateMultiSelectionOutline=function(e){var t=this._canvas.getLayer("selectionOutline");Es(t);var n=e.length>1,i=this._canvas.getContainer();if(qe(i)[n?"add":"remove"]("djs-multi-select"),!!n){var r=_O(Tt(e)),o=Ce("rect");he(o,H({rx:3},r)),qe(o).add("djs-selection-outline"),Be(t,o)}},Bf.$inject=["eventBus","canvas","selection"];function _O(e){return{x:e.x-bu,y:e.y-bu,width:e.width+bu*2,height:e.height+bu*2}}const $f={__depends__:[Vn],__init__:["outline","multiSelectionOutline"],outline:["type",vi],multiSelectionOutline:["type",Bf]},K_=["bpmn:Event","bpmn:SequenceFlow","bpmn:Gateway"],X_={class:"bjs-label-link",stroke:"var(--element-selected-outline-secondary-stroke-color)",strokeDasharray:"5, 5"},xO=15,_u=2;function Z_(e,t,n,i,r){const o=t.getLayer("overlays");e.on(["selection.changed","shape.changed"],function(){s()}),e.on("selection.changed",function({newSelection:p}){var d;const f=p.filter(g=>ze(g,K_));if(f.length===1){const g=f[0];Fe(g)?a(g,g.labelTarget):(d=g.labels)!=null&&d.length&&a(g.labels[0],g)}if(f.length===2){const g=f.find(Fe),h=f.find(m=>{var E;return(E=m.labels)==null?void 0:E.includes(g)});g&&h&&a(g,h)}}),e.on("shape.changed",function({element:p}){var f;!ze(p,K_)||!l(p)||(Fe(p)?a(p,p.labelTarget):(f=p.labels)!=null&&f.length&&a(p.labels[0],p))});function a(p,f){const d=Zo([Oe(f),Oe(p)],X_),g=d.getAttribute("d"),m=r.isSelected(p)?c(p):u(p),E=ta(m,g);if(!E)return;const x=r.isSelected(f)?c(f):u(f),S=ta(x,g)||Oe(f);pa(S,E)<xO||(ml(d,[S,E]),Be(o,d))}function s(){ws(`.${X_.class}`,o).forEach($t)}function c(p){const f=i.getOutline(p);if(!f)return u(p);if(f.x){const d={x:p.x+_r(f,"x")-_u,y:p.y+_r(f,"y")-_u,width:_r(f,"width")+_u*2,height:_r(f,"height")+_u*2};return Rl(d,_r(f,"rx"))}if(f.cx){const d=_r(f,"r"),g={x:p.x+_r(f,"cx")-d,y:p.y+_r(f,"cy")-d,width:d*2,height:d*2};return Cm(g)}}function u(p){return n.getShapePath(p)}function l(p){return r.isSelected(p)}}Z_.$inject=["eventBus","canvas","graphicsFactory","outline","selection"];function _r(e,t){return parseFloat(he(e,t)||0)}const wO={__depends__:[Vn,$f],__init__:["labelLink"],labelLink:["type",Z_]};var EO=new Po("tt");function SO(e){var t=ft('<div class="djs-tooltip-container" />');return dn(t,{position:"absolute",width:"0",height:"0"}),e.insertBefore(t,e.firstChild),t}function RO(e,t,n){dn(e,{left:t+"px",top:n+"px"})}function jf(e,t){e.style.display=t===!1?"none":""}var Q_="djs-tooltip",Ff="."+Q_;function yn(e,t){this._eventBus=e,this._canvas=t,this._ids=EO,this._tooltipDefaults={show:{minZoom:.7,maxZoom:5}},this._tooltips={},this._tooltipRoot=SO(t.getContainer());var n=this;Cn.bind(this._tooltipRoot,Ff,"mousedown",function(i){i.stopPropagation()}),Cn.bind(this._tooltipRoot,Ff,"mouseover",function(i){n.trigger("mouseover",i)}),Cn.bind(this._tooltipRoot,Ff,"mouseout",function(i){n.trigger("mouseout",i)}),this._init()}yn.$inject=["eventBus","canvas"],yn.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=H({},this._tooltipDefaults,e,{id:t}),this._addTooltip(e),e.timeout&&this.setTimeout(e),t},yn.prototype.trigger=function(e,t){var n=t.delegateTarget||t.target,i=this.get(sn(n,"data-tooltip-id"));i&&(e==="mouseover"&&i.timeout&&this.clearTimeout(i),e==="mouseout"&&i.timeout&&(i.timeout=1e3,this.setTimeout(i)))},yn.prototype.get=function(e){return typeof e!="string"&&(e=e.id),this._tooltips[e]},yn.prototype.clearTimeout=function(e){if(e=this.get(e),!!e){var t=e.removeTimer;t&&(clearTimeout(t),e.removeTimer=null)}},yn.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)}},yn.prototype.remove=function(e){var t=this.get(e);t&&(ui(t.html),ui(t.htmlContainer),delete t.htmlContainer,delete this._tooltips[t.id])},yn.prototype.show=function(){jf(this._tooltipRoot)},yn.prototype.hide=function(){jf(this._tooltipRoot,!1)},yn.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},yn.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)),xn(n)&&(n=ft(n)),i=ft('<div data-tooltip-id="'+t+'" class="'+Q_+'">'),dn(i,{position:"absolute"}),i.appendChild(n),e.type&&gt(i).add("djs-tooltip-"+e.type),e.className&&gt(i).add(e.className),e.htmlContainer=i,r.appendChild(i),this._tooltips[t]=e,this._updateTooltip(e)},yn.prototype._updateTooltip=function(e){var t=e.position,n=e.htmlContainer;RO(n,t.x,t.y)},yn.prototype._updateTooltipVisibilty=function(e){L(this._tooltips,function(t){var n=t.show,i=t.htmlContainer,r=!0;n&&((n.minZoom>e.scale||n.maxZoom<e.scale)&&(r=!1),jf(i,r))})},yn.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 CO={__init__:["tooltips"],tooltips:["type",yn]};var PO="flow elements must be children of pools/participants",AO="Data object must be placed within a pool/participant.";function J_(e,t,n){function i(r,o,a){t.add({position:{x:r.x+5,y:r.y+5},type:"error",timeout:2e3,html:"<div>"+o+"</div>"})}e.on(["shape.move.rejected","create.rejected"],function(r){var o=r.context,a=o.shape,s=o.target;_(s,"bpmn:Collaboration")&&(_(a,"bpmn:FlowNode")?i(r,n(PO)):_(a,"bpmn:DataObjectReference")&&i(r,n(AO)))})}J_.$inject=["eventBus","tooltips","translate"];const TO={__depends__:[CO],__init__:["modelingFeedback"],modelingFeedback:["type",J_]};var MO=500,kO=1250,OO=1500,xu=Math.round;function DO(e){return{x:e.x+xu(e.width/2),y:e.y+xu(e.height/2)}}function ex(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",OO,function(s){var c=s.context,u=s.shape,l=i.get().slice();l.indexOf(u)===-1&&(l=[u]),l=LO(l),H(c,{shapes:l,validatedShapes:l,shape:u})}),e.on("shape.move.start",kO,function(s){var c=s.context,u=c.validatedShapes,l;if(l=c.canExecute=o(u),!l)return!1}),e.on("shape.move.move",MO,function(s){var c=s.context,u=c.validatedShapes,l=s.hover,p={x:s.dx,y:s.dy},f={x:s.x,y:s.y},d;if(d=o(u,p,f,l),c.delta=p,c.canExecute=d,d===null){c.target=null;return}c.target=l}),e.on("shape.move.end",function(s){var c=s.context,u=c.delta,l=c.canExecute,p=l==="attach",f=c.shapes;if(l===!1)return!1;u.x=xu(u.x),u.y=xu(u.y),!(u.x===0&&u.y===0)&&n.moveElements(f,u,c.target,{primaryShape:c.shape,attach:p})}),e.on("element.mousedown",function(s){if(sr(s)){var c=Eo(s);if(!c)throw new Error("must supply DOM mousedown event");return a(c,s.element)}});function a(s,c,u,l){if(Vt(u)&&(l=u,u=!1),!(c.waypoints||!c.parent)&&!qe(s.target).has("djs-hit-no-move")){var p=DO(c),f=t.init(s,p,"shape.move",{cursor:"grabbing",autoActivate:u,data:{shape:c,context:l||{}}});if(f!==!1)return!0}}this.start=a}ex.$inject=["eventBus","dragging","modeling","selection","rules"];function LO(e){var t=eo(e,"id");return Ge(e,function(n){for(;n=n.parent;)if(t[n.id])return!1;return!0})}var tx=499,Hf="djs-dragging",nx="drop-ok",ix="drop-not-ok",rx="new-parent",ox="attach-ok";function ax(e,t,n,i){function r(c){var u=o(c),l=IO(u);return l}function o(c){var u=Qo(c),l=u.flatMap(d=>(d.incoming||[]).concat(d.outgoing||[])),p=u.concat(l),f=[...new Set(p)];return f}function a(c,u){[ox,nx,ix,rx].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,Hf),c.allDraggedElements?c.allDraggedElements.push(u):c.allDraggedElements=[u]}e.on("shape.move.start",tx,function(c){var u=c.context,l=u.shapes,p=u.allDraggedElements,f=r(l);if(!u.dragGroup){var d=Ce("g");he(d,n.cls("djs-drag-group",["no-events"]));var g=t.getActiveLayer();Be(g,d),u.dragGroup=d}f.forEach(function(h){i.addDragger(h,u.dragGroup)}),p?p=ku([p,o(l)]):p=o(l),L(p,function(h){t.addMarker(h,Hf)}),u.allDraggedElements=p,u.differentParents=NO(l)}),e.on("shape.move.move",tx,function(c){var u=c.context,l=u.dragGroup,p=u.target,f=u.shape.parent,d=u.canExecute;p&&(d==="attach"?a(p,ox):u.canExecute&&f&&p.id!==f.id?a(p,rx):a(p,u.canExecute?nx:ix)),en(l,c.dx,c.dy)}),e.on(["shape.move.out","shape.move.cleanup"],function(c){var u=c.context,l=u.target;l&&a(l,null)}),e.on("shape.move.cleanup",function(c){var u=c.context,l=u.allDraggedElements,p=u.dragGroup;L(l,function(f){t.removeMarker(f,Hf)}),p&&$t(p)}),this.makeDraggable=s}ax.$inject=["eventBus","canvas","styles","previewSupport"];function IO(e){var t=new Set;e.forEach(function(i){t.add(i.id)});var n=Ge(e,function(i){return st(i)?t.has(i.source.id)&&t.has(i.target.id):!0});return n}function NO(e){return O0(eo(e,function(t){return t.parent&&t.parent.id}))!==1}const BO={__depends__:[fc,Vn,$f,mi,Ni,Ao],__init__:["move","movePreview"],move:["type",ex],movePreview:["type",ax]};var sx=".djs-palette-toggle",cx=".entry",$O=sx+", "+cx,zf="djs-palette-",jO="shown",Gf="open",ux="two-column",FO=1e3;function Lt(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()})}Lt.$inject=["eventBus","canvas"],Lt.prototype.registerProvider=function(e,t){t||(t=e,e=FO),this._eventBus.on("palette.getProviders",e,function(n){n.providers.push(t)}),this._rebuild()},Lt.prototype.getEntries=function(){var e=this._getProviders();return e.reduce(zO,{})},Lt.prototype._rebuild=function(){if(this._diagramInitialized){var e=this._getProviders();e.length&&(this._container||this._init(),this._update())}},Lt.prototype._init=function(){var e=this,t=this._eventBus,n=this._getParentContainer(),i=this._container=ft(Lt.HTML_MARKUP);n.appendChild(i),gt(n).add(zf+jO),Cn.bind(i,$O,"click",function(r){var o=r.delegateTarget;if(al(o,sx))return e.toggle();e.trigger("click",r)}),Ne.bind(i,"mousedown",function(r){r.stopPropagation()}),Cn.bind(i,cx,"dragstart",function(r){e.trigger("dragstart",r)}),t.on("canvas.resized",this._layoutChanged,this),t.fire("palette.create",{container:i})},Lt.prototype._getProviders=function(e){var t=this._eventBus.createEvent({type:"palette.getProviders",providers:[]});return this._eventBus.fire(t),t.providers},Lt.prototype._toggleState=function(e){e=e||{};var t=this._getParentContainer(),n=this._container,i=this._eventBus,r,o=gt(n),a=gt(t);"twoColumn"in e?r=e.twoColumn:r=this._needsCollapse(t.clientHeight,this._entries||{}),o.toggle(ux,r),a.toggle(zf+ux,r),"open"in e&&(o.toggle(Gf,e.open),a.toggle(zf+Gf,e.open)),i.fire("palette.changed",{twoColumn:r,open:this.isOpen()})},Lt.prototype._update=function(){var e=ot(".djs-palette-entries",this._container),t=this._entries=this.getEntries();_s(e),L(t,function(n,i){var r=n.group||"default",o=ot("[data-group="+Da(r)+"]",e);o||(o=ft('<div class="group"></div>'),sn(o,"data-group",r),e.appendChild(o));var a=n.html||(n.separator?'<hr class="separator" />':'<div class="entry" draggable="true"></div>'),s=ft(a);if(o.appendChild(s),!n.separator&&(sn(s,"data-action",i),n.title&&sn(s,"title",n.title),n.className&&HO(s,n.className),n.imageUrl)){var c=ft("<img>");sn(c,"src",n.imageUrl),s.appendChild(c)}}),this.open()},Lt.prototype.trigger=function(e,t,n){var i,r,o=t.delegateTarget||t.target;return o?(i=sn(o,"data-action"),r=t.originalEvent||t,this.triggerEntry(i,e,r,n)):t.preventDefault()},Lt.prototype.triggerEntry=function(e,t,n,i){var r=this._entries,o,a;if(o=r[e],!!o&&(a=o.action,this._eventBus.fire("palette.trigger",{entry:o,event:n})!==!1)){if(Wt(a)){if(t==="click")return a(n,i)}else if(a[t])return a[t](n,i);n.preventDefault()}},Lt.prototype._layoutChanged=function(){this._toggleState({})},Lt.prototype._needsCollapse=function(e,t){var n=50,i=Object.keys(t).length*46;return e<i+n},Lt.prototype.close=function(){this._toggleState({open:!1,twoColumn:!1})},Lt.prototype.open=function(){this._toggleState({open:!0})},Lt.prototype.toggle=function(){this.isOpen()?this.close():this.open()},Lt.prototype.isActiveTool=function(e){return e&&this._activeTool===e},Lt.prototype.updateToolHighlight=function(e){var t,n;this._toolsContainer||(t=ot(".djs-palette-entries",this._container),this._toolsContainer=ot("[data-group=tools]",t)),n=this._toolsContainer,L(n.children,function(i){var r=i.getAttribute("data-action");if(r){var o=gt(i);r=r.replace("-tool",""),o.contains("entry")&&r===e?o.add("highlighted-entry"):o.remove("highlighted-entry")}})},Lt.prototype.isOpen=function(){return gt(this._container).has(Gf)},Lt.prototype._getParentContainer=function(){return this._canvas.getContainer()},Lt.HTML_MARKUP='<div class="djs-palette"><div class="djs-palette-entries"></div><div class="djs-palette-toggle"></div></div>';function HO(e,t){var n=gt(e),i=ke(t)?t:t.split(/\s+/g);i.forEach(function(r){n.add(r)})}function zO(e,t){var n=t.getPaletteEntries();return Wt(n)?n(e):(L(n,function(i,r){e[r]=i}),e)}const GO={__init__:["palette"],palette:["type",Lt]};var lx="crosshair",px="selected",VO="djs-dragging-active-lasso";function xr(e,t,n,i,r,o,a){this._selection=r,this._dragging=n,this._mouse=a;var s=this,c={create:function(p){var f=t.getActiveLayer(),d=p.frame=Ce("rect");he(d,{class:"djs-lasso-overlay",width:1,height:1,x:0,y:0}),Be(f,d),u(!0),this.update(p)},update:function(p){var f=p.frame,d=p.bbox;f&&d&&he(f,{x:d.x,y:d.y,width:d.width,height:d.height});var g=p.marked,h=p.lastMarked;if(g&&h){for(const m of h)g.has(m)||t.removeMarker(m,px);for(const m of g)h.has(m)||t.addMarker(m,px)}},remove:function(p){this.update(p),p.frame&&$t(p.frame),u(!1)}};function u(p){qe(t.getContainer()).toggle(VO,p)}function l(p){var f=i.getAll();return new Set(Jr(uo(f,p)))}o.registerTool("lasso",{tool:"lasso.selection",dragging:"lasso"}),e.on("lasso.selection.end",function(p){var f=p.originalEvent.target;!p.hover&&!(f instanceof SVGElement)||e.once("lasso.selection.ended",function(){s.activateLasso(p.originalEvent,!0)})}),e.on("lasso.end",0,function(p){var f=p.context;s._select(Array.from(f.marked))}),e.on("lasso.start",function(p){var f=p.context;f.bbox=fx(p),f.add=oc(p),f.lastMarked=new Set(r.get()),f.add?f.marked=f.lastMarked:f.marked=new Set,f.initialMarked=f.marked,c.create(f)}),e.on("lasso.move",function(p){var f=p.context,d=f.bbox=fx(p),g=l(d),h=f.initialMarked.union(g);f.lastMarked=f.marked,f.marked=h,c.update(f)}),e.on("lasso.cleanup",function(p){var f=p.context;f.lastMarked=f.marked,f.marked=new Set(r.get()),c.remove(p.context)}),e.on("element.mousedown",1500,function(p){if(oc(p))return s.activateLasso(p.originalEvent),!0})}xr.$inject=["eventBus","canvas","dragging","elementRegistry","selection","toolManager","mouse"],xr.prototype.activateLasso=function(e,t){this._dragging.init(e,"lasso",{autoActivate:t,cursor:lx,data:{context:{}},keepSelection:!0})},xr.prototype.activateSelection=function(e,t){this._dragging.init(e,"lasso.selection",{trapClick:!1,autoActivate:t,cursor:lx,data:{context:{}},keepSelection:!0})},xr.prototype._select=function(e){this._selection.select(e)},xr.prototype.select=function(e,t,n=[]){var i=Jr(uo(e,t));this._select([...n,...i])},xr.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateSelection(e,!!e)},xr.prototype.isActive=function(){var e=this._dragging.context();return e&&/^lasso/.test(e.prefix)};function fx(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 WO={__depends__:[gc,ya],__init__:["lassoTool"],lassoTool:["type",xr]};var Vf=1500,dx="grab";function jo(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",Vf,function(c){if(ha(c))return a.activateMove(c.originalEvent,!0),!1}),s&&s.addListener(Vf,function(c){if(!(!hx(c.keyEvent)||a.isActive())){var u=a._mouse.getLastMoveEvent();a.activateMove(u,!!u)}},"keyboard.keydown"),s&&s.addListener(Vf,function(c){!hx(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!ha(c)&&l&&e.once("hand.move.ended",function(p){a.activateHand(p.originalEvent,!0,!0)}),!1})}jo.$inject=["eventBus","canvas","dragging","injector","toolManager","mouse"],jo.prototype.activateMove=function(e,t,n){typeof t=="object"&&(n=t,t=!1),this._dragging.init(e,"hand.move",{autoActivate:t,cursor:dx,data:{context:n||{}}})},jo.prototype.activateHand=function(e,t,n){this._dragging.init(e,"hand",{trapClick:!1,autoActivate:t,cursor:dx,data:{context:{reactivate:n}}})},jo.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateHand(e,!!e)},jo.prototype.isActive=function(){var e=this._dragging.context();return e?/^(hand|hand\.move)$/.test(e.prefix):!1};function hx(e){return jt("Space",e)}const UO={__depends__:[gc,ya],__init__:["handTool"],handTool:["type",jo]};var mx="connect-ok",gx="connect-not-ok";function Fo(e,t,n,i,r,o,a){var s=this;this._dragging=t,this._rules=o,this._mouse=a,r.registerTool("global-connect",{tool:"global-connect",dragging:"global-connect.drag"}),e.on("global-connect.hover",function(c){var u=c.context,l=c.hover,p=u.canStartConnect=s.canStartConnect(l);p!==null&&(u.startTarget=l,i.addMarker(l,p?mx:gx))}),e.on(["global-connect.out","global-connect.cleanup"],function(c){var u=c.context.startTarget,l=c.context.canStartConnect;u&&i.removeMarker(u,l?mx:gx)}),e.on(["global-connect.ended"],function(c){var u=c.context,l=u.startTarget,p={x:c.x,y:c.y},f=s.canStartConnect(l);if(f)return e.once("element.out",function(){e.once(["connect.ended","connect.canceled"],function(){e.fire("global-connect.drag.ended")}),n.start(null,l,p)}),!1})}Fo.$inject=["eventBus","dragging","connect","canvas","toolManager","rules","mouse"],Fo.prototype.start=function(e,t){this._dragging.init(e,"global-connect",{autoActivate:t,trapClick:!1,data:{context:{}}})},Fo.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();return this.start(e,!!e)},Fo.prototype.isActive=function(){var e=this._dragging.context();return e&&/^global-connect/.test(e.prefix)},Fo.prototype.canStartConnect=function(e){return this._rules.allowed("connection.start",{source:e})};const qO={__depends__:[Df,mi,Ni,gc,ya],globalConnect:["type",Fo]};function Wf(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)}Wf.$inject=["palette","create","elementFactory","spaceTool","lassoTool","handTool","globalConnect","translate"],Wf.prototype.getPaletteEntries=function(){var e={},t=this._create,n=this._elementFactory,i=this._spaceTool,r=this._lassoTool,o=this._handTool,a=this._globalConnect,s=this._translate;function c(p,f,d,g,h){function m(E){var y=n.createShape(H({type:p},h));t.start(E,y)}return{group:f,className:d,title:g,action:{dragstart:m,click:m}}}function u(p){var f=n.createShape({type:"bpmn:SubProcess",x:0,y:0,isExpanded:!0}),d=n.createShape({type:"bpmn:StartEvent",x:40,y:82,parent:f});t.start(p,[f,d],{hints:{autoSelect:[f]}})}function l(p){t.start(p,n.createParticipantShape())}return H(e,{"hand-tool":{group:"tools",className:"bpmn-icon-hand-tool",title:s("Activate hand tool"),action:{click:function(p){o.activateHand(p)}}},"lasso-tool":{group:"tools",className:"bpmn-icon-lasso-tool",title:s("Activate lasso tool"),action:{click:function(p){r.activateSelection(p)}}},"space-tool":{group:"tools",className:"bpmn-icon-space-tool",title:s("Activate create/remove space tool"),action:{click:function(p){i.activateSelection(p)}}},"global-connect-tool":{group:"tools",className:"bpmn-icon-connection-multi",title:s("Activate global connect tool"),action:{click:function(p){a.start(p)}}},"tool-separator":{group:"tools",separator:!0},"create.start-event":c("bpmn:StartEvent","event","bpmn-icon-start-event-none",s("Create start event")),"create.intermediate-event":c("bpmn:IntermediateThrowEvent","event","bpmn-icon-intermediate-event-none",s("Create intermediate/boundary event")),"create.end-event":c("bpmn:EndEvent","event","bpmn-icon-end-event-none",s("Create end event")),"create.exclusive-gateway":c("bpmn:ExclusiveGateway","gateway","bpmn-icon-gateway-none",s("Create gateway")),"create.task":c("bpmn:Task","activity","bpmn-icon-task",s("Create task")),"create.data-object":c("bpmn:DataObjectReference","data-object","bpmn-icon-data-object",s("Create data object reference")),"create.data-store":c("bpmn:DataStoreReference","data-store","bpmn-icon-data-store",s("Create data store reference")),"create.subprocess-expanded":{group:"activity",className:"bpmn-icon-subprocess-expanded",title:s("Create expanded sub-process"),action:{dragstart:u,click:u}},"create.participant-expanded":{group:"collaboration",className:"bpmn-icon-participant",title:s("Create pool/participant"),action:{dragstart:l,click:l}},"create.group":c("bpmn:Group","artifact","bpmn-icon-group",s("Create group"))}),e};const YO={__depends__:[GO,hc,Vy,WO,UO,qO,sa],__init__:["paletteProvider"],paletteProvider:["type",Wf]};var KO=250;function Uf(e,t,n,i,r){J.call(this,e);function o(s){var c=s.canExecute.replacements;L(c,function(u){var l=u.oldElementId,p={type:u.newElementType};if(!s.visualReplacements[l]){var f=t.get(l);H(p,{x:f.x,y:f.y});var d=n.createShape(p);i.addShape(d,f.parent);var g=ot('[data-element-id="'+Da(f.id)+'"]',s.dragGroup);g&&he(g,{display:"none"});var h=r.addDragger(d,s.dragGroup);s.visualReplacements[l]=h,i.removeShape(d)}})}function a(s){var c=s.visualReplacements;L(c,function(u,l){var p=ot('[data-element-id="'+Da(l)+'"]',s.dragGroup);p&&he(p,{display:"inline"}),u.remove(),c[l]&&delete c[l]})}e.on("shape.move.move",KO,function(s){var c=s.context,u=c.canExecute;c.visualReplacements||(c.visualReplacements={}),u&&u.replacements?o(c):a(c)})}Uf.$inject=["eventBus","elementRegistry","elementFactory","canvas","previewSupport"],de(Uf,J);const XO={__depends__:[Ao],__init__:["bpmnReplacePreview"],bpmnReplacePreview:["type",Uf]};var ZO=1250,qf=40,QO=20,JO=10,yx=20,vx=["x","y"],eD=Math.abs;function bx(e){e.on(["connect.hover","connect.move","connect.end"],ZO,function(t){var n=t.context,i=n.canExecute,r=n.start,o=n.hover,a=n.source,s=n.target;t.originalEvent&&Tn(t.originalEvent)||(n.initialConnectionStart||(n.initialConnectionStart=n.connectionStart),i&&o&&tD(t,o,oD(o)),o&&rD(i,["bpmn:Association","bpmn:DataInputAssociation","bpmn:DataOutputAssociation","bpmn:SequenceFlow"])?(n.connectionStart=qn(r),ze(o,["bpmn:Event","bpmn:Gateway"])&&_x(t,qn(o)),ze(o,["bpmn:Task","bpmn:SubProcess"])&&nD(t,o),_(a,"bpmn:BoundaryEvent")&&s===a.host&&iD(t)):xx(i,"bpmn:MessageFlow")?(_(r,"bpmn:Event")&&(n.connectionStart=qn(r)),_(o,"bpmn:Event")&&_x(t,qn(o))):n.connectionStart=n.initialConnectionStart)})}bx.$inject=["eventBus"];function tD(e,t,n){vx.forEach(function(i){var r=wx(i,t);e[i]<t[i]+n?Dt(e,i,t[i]+n):e[i]>t[i]+r-n&&Dt(e,i,t[i]+r-n)})}function nD(e,t){var n=qn(t);vx.forEach(function(i){aD(e,t,i)&&Dt(e,i,n[i])})}function iD(e){var t=e.context,n=t.source,i=t.target;if(!sD(t)){var r=qn(n),o=Jt(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;eD(c-r[s])<qf&&(c>r[s]?u=r[s]+qf:u=r[s]-qf,Dt(e,s,u))})}}function _x(e,t){Dt(e,"x",t.x),Dt(e,"y",t.y)}function xx(e,t){return e&&e.type===t}function rD(e,t){return Ui(t,function(n){return xx(e,n)})}function wx(e,t){return e==="x"?t.width:t.height}function oD(e){return _(e,"bpmn:Task")?JO:QO}function aD(e,t,n){return e[n]>t[n]+yx&&e[n]<t[n]+wx(n,t)-yx}function sD(e){var t=e.hover,n=e.source;return t&&n&&t===n}function wr(){this._targets={},this._snapOrigins={},this._snapLocations=[],this._defaultSnaps={}}wr.prototype.getSnapOrigin=function(e){return this._snapOrigins[e]},wr.prototype.setSnapOrigin=function(e,t){this._snapOrigins[e]=t,this._snapLocations.indexOf(e)===-1&&this._snapLocations.push(e)},wr.prototype.addDefaultSnap=function(e,t){var n=this._defaultSnaps[e];n||(n=this._defaultSnaps[e]=[]),n.push(t)},wr.prototype.getSnapLocations=function(){return this._snapLocations},wr.prototype.setSnapLocations=function(e){this._snapLocations=e},wr.prototype.pointsForTarget=function(e){var t=e.id||e,n=this._targets[t];return n||(n=this._targets[t]=new wu,n.initDefaults(this._defaultSnaps)),n};function wu(){this._snapValues={}}wu.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)},wu.prototype.snap=function(e,t,n,i){var r=this._snapValues[t];return r&&K2(e[n],r[n],i)},wu.prototype.initDefaults=function(e){var t=this;L(e||{},function(n,i){L(n,function(r){t.add(i,r)})})};var cD=1250;function bi(e,t,n){var i=this;this._elementRegistry=e,t.on(["create.start","shape.move.start"],function(r){i.initSnap(r)}),t.on(["create.move","create.end","shape.move.move","shape.move.end"],cD,function(r){var o=r.context,a=o.shape,s=o.snapContext,c=o.target;if(!(r.originalEvent&&Tn(r.originalEvent))&&!($o(r)||!c)){var u=s.pointsForTarget(c);u.initialized||(u=i.addSnapTargetPoints(u,a,c),u.initialized=!0),n.snap(r,u)}}),t.on(["create.cleanup","shape.move.cleanup"],function(){n.hide()})}bi.$inject=["elementRegistry","eventBus","snapping"],bi.prototype.initSnap=function(e){var t=this._elementRegistry,n=e.context,i=n.shape,r=n.snapContext;r||(r=n.snapContext=new wr);var o;t.get(i.id)?o=qn(i,e):o={x:e.x+qn(i).x,y:e.y+qn(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}),Fe(i)||(r.setSnapOrigin("top-left",{x:a.x-e.x,y:a.y-e.y}),r.setSnapOrigin("bottom-right",{x:s.x-e.x,y:s.y-e.y})),r},bi.prototype.addSnapTargetPoints=function(e,t,n){var i=this.getSnapTargets(t,n);return L(i,function(r){if(Fe(r)){Fe(t)&&e.add("mid",qn(r));return}if(st(r)){if(r.waypoints.length<3)return;var o=r.waypoints.slice(1,-1);L(o,function(a){e.add("mid",a)});return}e.add("mid",qn(r))}),!Le(t.x)||!Le(t.y)||this._elementRegistry.get(t.id)&&e.add("mid",qn(t)),e},bi.prototype.getSnapTargets=function(e,t){return c_(t).filter(function(n){return!uD(n)})};function uD(e){return!!e.hidden}var Ex=1500;function Ho(e,t){t.invoke(bi,this),e.on(["create.move","create.end"],Ex,dD),e.on(["create.move","create.end","shape.move.move","shape.move.end"],Ex,function(n){var i=n.context,r=i.canExecute,o=i.target,a=r&&(r==="attach"||r.attach);a&&!$o(n)&&lD(n,o)})}de(Ho,bi),Ho.$inject=["eventBus","injector"],Ho.prototype.initSnap=function(e){var t=bi.prototype.initSnap.call(this,e),n=e.shape,i=!!this._elementRegistry.get(n.id);return L(n.outgoing,function(r){var o=r.waypoints[0];o=o.original||o,t.setSnapOrigin(r.id+"-docking",Rx(o,i,e))}),L(n.incoming,function(r){var o=r.waypoints[r.waypoints.length-1];o=o.original||o,t.setSnapOrigin(r.id+"-docking",Rx(o,i,e))}),_(n,"bpmn:Participant")&&t.setSnapLocations(["top-left","bottom-right","mid"]),t},Ho.prototype.addSnapTargetPoints=function(e,t,n){bi.prototype.addSnapTargetPoints.call(this,e,t,n);var i=this.getSnapTargets(t,n);L(i,function(o){(fD(o)||pD([t,o],"bpmn:TextAnnotation"))&&(e.add("top-left",a_(o)),e.add("bottom-right",s_(o)))});var r=this._elementRegistry;return L(t.incoming,function(o){if(r.get(t.id)){Sx(i,o.source)||e.add("mid",Oe(o.source));var a=o.waypoints[0];e.add(o.id+"-docking",a.original||a)}}),L(t.outgoing,function(o){if(r.get(t.id)){Sx(i,o.target)||e.add("mid",Oe(o.target));var a=o.waypoints[o.waypoints.length-1];e.add(o.id+"-docking",a.original||a)}}),_(n,"bpmn:SequenceFlow")&&(e=this.addSnapTargetPoints(e,t,n.parent)),e},Ho.prototype.getSnapTargets=function(e,t){return bi.prototype.getSnapTargets.call(this,e,t).filter(function(n){return!_(n,"bpmn:Lane")})};function lD(e,t){var n=Pe(t),i=Fg(e,t),r=e.context,o=r.shape,a;o.parent?a={x:0,y:0}:a=Oe(o),/top/.test(i)?Dt(e,"y",n.top-a.y):/bottom/.test(i)&&Dt(e,"y",n.bottom-a.y),/left/.test(i)?Dt(e,"x",n.left-a.x):/right/.test(i)&&Dt(e,"x",n.right-a.x)}function pD(e,t){return e.every(function(n){return _(n,t)})}function fD(e){return _(e,"bpmn:SubProcess")&&Ue(e)?!0:_(e,"bpmn:Participant")}function dD(e){var t=e.context,n=t.createConstraints;if(n){var i=n.top,r=n.right,o=n.bottom,a=n.left;(a&&a>=e.x||r&&r<=e.x)&&Dt(e,"x",e.x),(i&&i>=e.y||o&&o<=e.y)&&Dt(e,"y",e.y)}}function Sx(e,t){return e.indexOf(t)!==-1}function Rx(e,t,n){return t?{x:e.x-n.x,y:e.y-n.y}:{x:e.x,y:e.y}}var hD=1250;function Ka(e,t){var n=this;e.on(["resize.start"],function(i){n.initSnap(i)}),e.on(["resize.move","resize.end"],hD,function(i){var r=i.context,o=r.shape,a=o.parent,s=r.direction,c=r.snapContext;if(!(i.originalEvent&&Tn(i.originalEvent))&&!$o(i)){var u=c.pointsForTarget(a);u.initialized||(u=n.addSnapTargetPoints(u,o,a,s),u.initialized=!0),yD(s)&&Dt(i,"x",i.x),vD(s)&&Dt(i,"y",i.y),t.snap(i,u)}}),e.on(["resize.cleanup"],function(){t.hide()})}Ka.prototype.initSnap=function(e){var t=e.context,n=t.shape,i=t.direction,r=t.snapContext;r||(r=t.snapContext=new wr);var o=Cx(n,i);return r.setSnapOrigin("corner",{x:o.x-e.x,y:o.y-e.y}),r},Ka.prototype.addSnapTargetPoints=function(e,t,n,i){var r=this.getSnapTargets(t,n);return L(r,function(o){e.add("corner",s_(o)),e.add("corner",a_(o))}),e.add("corner",Cx(t,i)),e},Ka.$inject=["eventBus","snapping"],Ka.prototype.getSnapTargets=function(e,t){return c_(t).filter(function(n){return!mD(n,e)&&!st(n)&&!gD(n)&&!Fe(n)})};function Cx(e,t){var n=Oe(e),i=Pe(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 mD(e,t){return e.host===t}function gD(e){return!!e.hidden}function yD(e){return e==="n"||e==="s"}function vD(e){return e==="e"||e==="w"}var bD=7,_D=1e3;function Er(e){this._canvas=e,this._asyncHide=Du(mn(this.hide,this),_D)}Er.$inject=["canvas"],Er.prototype.snap=function(e,t){var n=e.context,i=n.snapContext,r=i.getSnapLocations(),o={x:$o(e,"x"),y:$o(e,"y")};L(r,function(a){var s=i.getSnapOrigin(a),c={x:e.x+s.x,y:e.y+s.y};if(L(["x","y"],function(u){var l;o[u]||(l=t.snap(c,a,u,bD),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),L(["x","y"],function(a){var s=o[a];Vt(s)&&Dt(e,a,s.originValue)})},Er.prototype._createLine=function(e){var t=this._canvas.getLayer("snap"),n=Ce("path");return he(n,{d:"M0,0 L0,0"}),qe(n).add("djs-snap-line"),Be(t,n),{update:function(i){Le(i)?e==="horizontal"?he(n,{d:"M-100000,"+i+" L+100000,"+i,display:""}):he(n,{d:"M "+i+",-100000 L "+i+", +100000",display:""}):he(n,{display:"none"})}}},Er.prototype._createSnapLines=function(){this._snapLines={horizontal:this._createLine("horizontal"),vertical:this._createLine("vertical")}},Er.prototype.showSnapLine=function(e,t){var n=this.getSnapLine(e);n&&n.update(t),this._asyncHide()},Er.prototype.getSnapLine=function(e){return this._snapLines||this._createSnapLines(),this._snapLines[e]},Er.prototype.hide=function(){L(this._snapLines,function(e){e.update()})};const xD={__depends__:[{__init__:["createMoveSnapping","resizeSnapping","snapping"],createMoveSnapping:["type",bi],resizeSnapping:["type",Ka],snapping:["type",Er]}],__init__:["connectSnapping","createMoveSnapping"],connectSnapping:["type",bx],createMoveSnapping:["type",Ho]};var Px=300;function $e(e,t,n,i){this._open=!1,this._results={},this._eventMaps=[],this._cachedRootElement=null,this._cachedSelection=null,this._cachedViewbox=null,this._canvas=e,this._eventBus=t,this._selection=n,this._translate=i,this._container=this._getBoxHtml(),this._searchInput=ot($e.INPUT_SELECTOR,this._container),this._resultsContainer=ot($e.RESULTS_CONTAINER_SELECTOR,this._container),this._canvas.getContainer().appendChild(this._container),t.on(["canvas.destroy","diagram.destroy","drag.init","elements.changed"],this.close,this)}$e.$inject=["canvas","eventBus","selection","translate"],$e.prototype._bindEvents=function(){var e=this;function t(n,i,r,o){e._eventMaps.push({el:n,type:r,listener:Cn.bind(n,i,r,o)})}t(document,"html","click",function(n){e.close(!1)}),t(this._container,$e.INPUT_SELECTOR,"click",function(n){n.stopPropagation(),n.delegateTarget.focus()}),t(this._container,$e.RESULT_SELECTOR,"mouseover",function(n){n.stopPropagation(),e._scrollToNode(n.delegateTarget),e._preselect(n.delegateTarget)}),t(this._container,$e.RESULT_SELECTOR,"click",function(n){n.stopPropagation(),e._select(n.delegateTarget)}),t(this._container,$e.INPUT_SELECTOR,"keydown",function(n){jt("ArrowUp",n)&&n.preventDefault(),jt("ArrowDown",n)&&n.preventDefault()}),t(this._container,$e.INPUT_SELECTOR,"keyup",function(n){if(jt("Escape",n))return e.close();if(jt("Enter",n)){var i=e._getCurrentResult();return i?e._select(i):e.close(!1)}if(jt("ArrowUp",n))return e._scrollToDirection(!0);if(jt("ArrowDown",n))return e._scrollToDirection();jt(["ArrowLeft","ArrowRight"],n)||e._search(n.delegateTarget.value)})},$e.prototype._unbindEvents=function(){this._eventMaps.forEach(function(e){Cn.unbind(e.el,e.type,e.listener)})},$e.prototype._search=function(e){var t=this;if(this._clearResults(),!!e.trim()){var n=this._searchProvider.find(e);if(n=n.filter(function(r){return!t._canvas.getRootElements().includes(r.element)}),!n.length){this._selection.select(null);return}n.forEach(function(r){var o=r.element.id,a=t._createResultNode(r,o);t._results[o]={element:r.element,node:a}});var i=ot($e.RESULT_SELECTOR,this._resultsContainer);this._scrollToNode(i),this._preselect(i)}},$e.prototype._scrollToDirection=function(e){var t=this._getCurrentResult();if(t){var n=e?t.previousElementSibling:t.nextElementSibling;n&&(this._scrollToNode(n),this._preselect(n))}},$e.prototype._scrollToNode=function(e){if(!(!e||e===this._getCurrentResult())){var t=e.offsetTop,n=this._resultsContainer.scrollTop,i=t-this._resultsContainer.clientHeight+e.clientHeight;t<n?this._resultsContainer.scrollTop=t:n<i&&(this._resultsContainer.scrollTop=i)}},$e.prototype._clearResults=function(){_s(this._resultsContainer),this._results={},this._eventBus.fire("searchPad.cleared")},$e.prototype._getCurrentResult=function(){return ot($e.RESULT_SELECTED_SELECTOR,this._resultsContainer)},$e.prototype._createResultNode=function(e,t){var n=ft($e.RESULT_HTML);return e.primaryTokens.length>0&&Ax(n,e.primaryTokens,$e.RESULT_PRIMARY_HTML),Ax(n,e.secondaryTokens,$e.RESULT_SECONDARY_HTML),sn(n,$e.RESULT_ID_ATTRIBUTE,t),this._resultsContainer.appendChild(n),n},$e.prototype.registerProvider=function(e){this._searchProvider=e},$e.prototype.open=function(){if(!this._searchProvider)throw new Error("no search provider registered");this.isOpen()||(this._cachedRootElement=this._canvas.getRootElement(),this._cachedSelection=this._selection.get(),this._cachedViewbox=this._canvas.viewbox(),this._selection.select(null),this._bindEvents(),this._open=!0,gt(this._canvas.getContainer()).add("djs-search-open"),gt(this._container).add("open"),this._searchInput.focus(),this._eventBus.fire("searchPad.opened"))},$e.prototype.close=function(e=!0){this.isOpen()&&(e&&(this._cachedRootElement&&this._canvas.setRootElement(this._cachedRootElement),this._cachedSelection&&this._selection.select(this._cachedSelection),this._cachedViewbox&&this._canvas.viewbox(this._cachedViewbox),this._eventBus.fire("searchPad.restored")),this._cachedRootElement=null,this._cachedSelection=null,this._cachedViewbox=null,this._unbindEvents(),this._open=!1,gt(this._canvas.getContainer()).remove("djs-search-open"),gt(this._container).remove("open"),this._clearResults(),this._searchInput.value="",this._searchInput.blur(),this._eventBus.fire("searchPad.closed"),this._canvas.restoreFocus())},$e.prototype.toggle=function(){this.isOpen()?this.close():this.open()},$e.prototype.isOpen=function(){return this._open},$e.prototype._preselect=function(e){var t=this._getCurrentResult();if(e!==t){t&&gt(t).remove($e.RESULT_SELECTED_CLASS);var n=sn(e,$e.RESULT_ID_ATTRIBUTE),i=this._results[n].element;gt(e).add($e.RESULT_SELECTED_CLASS),this._canvas.scrollToElement(i,{top:Px}),this._selection.select(i),this._eventBus.fire("searchPad.preselected",i)}},$e.prototype._select=function(e){var t=sn(e,$e.RESULT_ID_ATTRIBUTE),n=this._results[t].element;this._cachedSelection=null,this._cachedViewbox=null,this.close(!1),this._canvas.scrollToElement(n,{top:Px}),this._selection.select(n),this._eventBus.fire("searchPad.selected",n)},$e.prototype._getBoxHtml=function(){const e=ft($e.BOX_HTML),t=ot($e.INPUT_SELECTOR,e);return t&&t.setAttribute("aria-label",this._translate("Search in diagram")),e};function Ax(e,t,n){var i=wD(t),r=ft(n);r.innerHTML=i,e.appendChild(r)}function wD(e){var t="";return e.forEach(function(n){var i=Nv(n.value||n.matched||n.normal),r=n.match||n.matched;r?t+='<b class="'+$e.RESULT_HIGHLIGHT_CLASS+'">'+i+"</b>":t+=i}),t!==""?t:null}$e.CONTAINER_SELECTOR=".djs-search-container",$e.INPUT_SELECTOR=".djs-search-input input",$e.RESULTS_CONTAINER_SELECTOR=".djs-search-results",$e.RESULT_SELECTOR=".djs-search-result",$e.RESULT_SELECTED_CLASS="djs-search-result-selected",$e.RESULT_SELECTED_SELECTOR="."+$e.RESULT_SELECTED_CLASS,$e.RESULT_ID_ATTRIBUTE="data-result-id",$e.RESULT_HIGHLIGHT_CLASS="djs-search-highlight",$e.BOX_HTML=`<div class="djs-search-container djs-scrollable">
336
336
  <div class="djs-search-input">
337
337
  <svg class="djs-search-icon" width="14" height="14" viewBox="0 0 14 14" fill="none" xmlns="http://www.w3.org/2000/svg">
338
338
  <path fill-rule="evenodd" clip-rule="evenodd" d="M9.0325 8.5H9.625L13.3675 12.25L12.25 13.3675L8.5 9.625V9.0325L8.2975 8.8225C7.4425 9.5575 6.3325 10 5.125 10C2.4325 10 0.25 7.8175 0.25 5.125C0.25 2.4325 2.4325 0.25 5.125 0.25C7.8175 0.25 10 2.4325 10 5.125C10 6.3325 9.5575 7.4425 8.8225 8.2975L9.0325 8.5ZM1.75 5.125C1.75 6.9925 3.2575 8.5 5.125 8.5C6.9925 8.5 8.5 6.9925 8.5 5.125C8.5 3.2575 6.9925 1.75 5.125 1.75C3.2575 1.75 1.75 3.2575 1.75 5.125Z" fill="#22242A"/>
@@ -340,4 +340,4 @@
340
340
  <input type="text" spellcheck="false" />
341
341
  </div>
342
342
  <div class="djs-search-results" />
343
- </div>`,Be.RESULT_HTML='<div class="djs-search-result"></div>',Be.RESULT_PRIMARY_HTML='<div class="djs-search-result-primary"></div>',Be.RESULT_SECONDARY_HTML='<p class="djs-search-result-secondary"></p>';const ED={__depends__:[sa,$c,Wn],searchPad:["type",Be]};function Uf(e,t,n,i){this._elementRegistry=e,this._canvas=n,this._search=i,t.registerProvider(this)}Uf.$inject=["elementRegistry","searchPad","canvas","search"],Uf.prototype.find=function(e){var t=this._canvas.getRootElements(),n=this._elementRegistry.filter(function(i){return!je(i)&&!t.includes(i)});return this._search(n.map(i=>({element:i,label:Bn(i),id:i.id})),e,{keys:["label","id"]}).map(SD)};function SD(e){const{item:{element:t},tokens:n}=e;return{element:t,primaryTokens:n.label,secondaryTokens:n.id}}const RD={__depends__:[ED,$b],__init__:["bpmnSearch"],bpmnSearch:["type",Uf]},CD="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",AD={width:36,height:50},TD={width:50,height:50};function Px(e,t,n){return Se("path",{d:e,strokeWidth:2,transform:`translate(${t.x}, ${t.y})`,...n})}const Zn=5;function Eu(e,t){this._styles=t,e.registerProvider(this)}Eu.$inject=["outline","styles"],Eu.prototype.getOutline=function(e){const t=this._styles.cls("djs-outline",["no-fill"]);var n;if(JS(e))return n=Se("rect"),me(n,j({x:-Zn,y:-Zn,rx:4,width:e.width+Zn*2,height:e.height+Zn*2},t)),n;if(!je(e))return _(e,"bpmn:Gateway")?(n=Se("rect"),j(n.style,{"transform-box":"fill-box",transform:"rotate(45deg)","transform-origin":"center"}),me(n,j({x:2,y:2,rx:4,width:e.width-4,height:e.height-4},t))):He(e,["bpmn:Task","bpmn:SubProcess","bpmn:Group","bpmn:CallActivity"])?(n=Se("rect"),me(n,j({x:-Zn,y:-Zn,rx:14,width:e.width+Zn*2,height:e.height+Zn*2},t))):_(e,"bpmn:EndEvent")?(n=Se("circle"),me(n,j({cx:e.width/2,cy:e.height/2,r:e.width/2+Zn+1},t))):_(e,"bpmn:Event")?(n=Se("circle"),me(n,j({cx:e.width/2,cy:e.height/2,r:e.width/2+Zn},t))):_(e,"bpmn:DataObjectReference")&&Ax(e,"bpmn:DataObjectReference")?n=Px(CD,{x:-6,y:-6},t):_(e,"bpmn:DataStoreReference")&&Ax(e,"bpmn:DataStoreReference")&&(n=Px(PD,{x:-6,y:-6},t)),n},Eu.prototype.updateOutline=function(e,t){if(!je(e))return He(e,["bpmn:SubProcess","bpmn:Group"])?(me(t,{width:e.width+Zn*2,height:e.height+Zn*2}),!0):!!He(e,["bpmn:Event","bpmn:Gateway","bpmn:DataStoreReference","bpmn:DataObjectReference"])};function Ax(e,t){var n;return t==="bpmn:DataObjectReference"?n=AD:t==="bpmn:DataStoreReference"&&(n=TD),e.width===n.width&&e.height===n.height}const MD={__depends__:[Bf],__init__:["outlineProvider"],outlineProvider:["type",Eu]};var kD='<?xml version="1.0" encoding="UTF-8"?><bpmn:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" targetNamespace="http://bpmn.io/schema/bpmn" id="Definitions_1"><bpmn:process id="Process_1" isExecutable="false"><bpmn:startEvent id="StartEvent_1"/></bpmn:process><bpmndi:BPMNDiagram id="BPMNDiagram_1"><bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="Process_1"><bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="StartEvent_1"><dc:Bounds height="36.0" width="36.0" x="173.0" y="102.0"/></bpmndi:BPMNShape></bpmndi:BPMNPlane></bpmndi:BPMNDiagram></bpmn:definitions>';function wi(e){ho.call(this,e)}he(wi,ho),wi.Viewer=vr,wi.NavigatedViewer=La,wi.prototype.createDiagram=function(){return this.importXML(kD)},wi.prototype._interactionModules=[Hv,Gv,Uv],wi.prototype._modelingModules=[D2,Bc,$2,B2,Z2,kf,ik,Ak,ky,hc,Ok,Ik,Zk,Jk,eO,oO,yO,wO,nf,TO,NO,YO,XO,z_,xD,RD,MD],wi.prototype._modules=[].concat(vr.prototype._modules,wi.prototype._interactionModules,wi.prototype._modelingModules);const OD=((e,t)=>{const n=e.__vccOpts||e;for(const[i,r]of t)n[i]=r;return n})(Mt.defineComponent({__name:"BpmnModelerView",props:{xml:{}},emits:["ready","imported","import-error"],setup(e,{expose:t,emit:n}){const i=e,r=n,o=Mt.ref();let a;async function s(u){if(!a)throw new Error("modeler not mounted");try{const{warnings:l}=await a.importXML(u),p=qu(l);return r("imported",p),{warnings:p}}catch(l){throw r("import-error",l),l}}async function c(){if(!a)throw new Error("modeler not mounted");const{xml:u}=await a.saveXML({format:!0});return u??""}return Mt.onMounted(async()=>{a=new wi({container:o.value,moddleExtensions:as}),i.xml&&await s(i.xml),r("ready")}),Mt.watch(()=>i.xml,u=>{u&&a&&s(u)}),Mt.onBeforeUnmount(()=>{a==null||a.destroy(),a=void 0}),t({importXml:s,saveXml:c,getModeler:()=>a}),(u,l)=>(Mt.openBlock(),Mt.createElementBlock("div",{ref_key:"container",ref:o,class:"bpmn-modeler-view"},null,512))}}),[["__scopeId","data-v-a9b41c97"]]);ae.APPLY_BPMN_OPS_SCHEMA=P0,ae.BPMN_MODDLE_EXTENSIONS=as,ae.BWL_MODDLE_SCHEMA=Jf,ae.BWL_NS=Qf,ae.BWL_PREFIX=Au,ae.BWL_SIDES=Tu,ae.BpmnModelerView=OD,ae.EDITOR=QE,ae.FLOW_LABEL_INDENT=Dd,ae.HEADLESS_BPMN_MODULES=kv,ae.HEADLESS_TEXT_METRICS=ao,ae.I18N_NS=oE,ae.I18N_PREFIX=Sd,ae.LABEL_FORK_MARGIN=Xu,ae.MVP_FLOW_NODE_TYPES=Ei,ae.SYMBOLIC_OP_KINDS=nd,ae.SYMBOLIC_OP_SCHEMA=id,ae.UNDO_EPISODE_COMMAND=Mu,ae.applyBpmnOpBatch=Sh,ae.applyBpmnOps=_h,ae.approximateTextWidth=so,ae.auditBpmnGeometry=Vd,ae.auditBpmnGeometryXml=TE,ae.auditGeometry=Ti,ae.auditTargetsOf=ci,ae.axisSegmentsOf=hn,ae.blackBoxNameRect=Ku,ae.buildBpmnOpBatch=ZE,ae.buildRegistryIndex=Ud,ae.containerBoundarySegments=Yo,ae.createBpmnEditorController=JE,ae.createBpmnModdle=Rd,ae.createHeadlessBpmnModeler=bM,ae.crossedShapesOf=jn,ae.crossingCost=Ai,ae.describeProcess=Eh,ae.describeProcessXml=XE,ae.edgeCrossCount=fs,ae.edgeCrossingPairsOf=Qu,ae.edgeCrossingStatsOf=$d,ae.executeAsUndoEpisode=td,ae.forwardThreePointCandidates=Ju,ae.geometryFindingKey=Ri,ae.installHeadlessBpmnDom=Pd,ae.isMvpFlowNodeType=Zf,ae.labelRectsOf=uo,ae.lineCrossesLabel=Pi,ae.lineThroughLabel=Id,ae.lineThroughShapeLabel=zd,ae.loadBpmnXml=Uu,ae.lowerOps=bh,ae.oppositeOverlapCount=yE,ae.oppositeOverlapOf=Od,ae.planBackEdgeBoundaryClearance=rh,ae.planCrossPoolRoute=eh,ae.planEdgeRepair=Zd,ae.planLabelLineClearance=uh,ae.planLabelPlacement=ch,ae.planMiddleSegmentShifts=Kd,ae.planOppositeOverlapRepair=ah,ae.planSegmentDetours=Yd,ae.planShapeLabelClearance=fh,ae.repairIntroducedBoundaryHugging=oh,ae.repairIntroducedCrossings=Qd,ae.repairIntroducedLabelLines=lh,ae.repairIntroducedOppositeOverlaps=sh,ae.repairIntroducedShapeLabelLines=dh,ae.repairIntroducedSharedSegmentLabels=ph,ae.rerouteIntroducedCrossPoolEdges=th,ae.resolverServicesOf=yh,ae.saveBpmnXml=aE,ae.sceneCrossingCost=Nd,ae.sceneFromDefinitions=Gd,ae.sceneFromRegistry=yt,ae.sharedSegmentUnderLabel=ps,ae.sharedSpansOf=ls,ae.unreadableOverlapCount=Ci,ae.unreadableOverlapOf=us,ae.validateOps=gh,ae.warningMessages=qu,Object.defineProperty(ae,Symbol.toStringTag,{value:"Module"})}));
343
+ </div>`,$e.RESULT_HTML='<div class="djs-search-result"></div>',$e.RESULT_PRIMARY_HTML='<div class="djs-search-result-primary"></div>',$e.RESULT_SECONDARY_HTML='<p class="djs-search-result-secondary"></p>';const ED={__depends__:[sa,$c,Vn],searchPad:["type",$e]};function Yf(e,t,n,i){this._elementRegistry=e,this._canvas=n,this._search=i,t.registerProvider(this)}Yf.$inject=["elementRegistry","searchPad","canvas","search"],Yf.prototype.find=function(e){var t=this._canvas.getRootElements(),n=this._elementRegistry.filter(function(i){return!Fe(i)&&!t.includes(i)});return this._search(n.map(i=>({element:i,label:Bn(i),id:i.id})),e,{keys:["label","id"]}).map(SD)};function SD(e){const{item:{element:t},tokens:n}=e;return{element:t,primaryTokens:n.label,secondaryTokens:n.id}}const RD={__depends__:[ED,Fb],__init__:["bpmnSearch"],bpmnSearch:["type",Yf]},CD="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",AD={width:36,height:50},TD={width:50,height:50};function Tx(e,t,n){return Ce("path",{d:e,strokeWidth:2,transform:`translate(${t.x}, ${t.y})`,...n})}const Xn=5;function Eu(e,t){this._styles=t,e.registerProvider(this)}Eu.$inject=["outline","styles"],Eu.prototype.getOutline=function(e){const t=this._styles.cls("djs-outline",["no-fill"]);var n;if(JS(e))return n=Ce("rect"),he(n,H({x:-Xn,y:-Xn,rx:4,width:e.width+Xn*2,height:e.height+Xn*2},t)),n;if(!Fe(e))return _(e,"bpmn:Gateway")?(n=Ce("rect"),H(n.style,{"transform-box":"fill-box",transform:"rotate(45deg)","transform-origin":"center"}),he(n,H({x:2,y:2,rx:4,width:e.width-4,height:e.height-4},t))):ze(e,["bpmn:Task","bpmn:SubProcess","bpmn:Group","bpmn:CallActivity"])?(n=Ce("rect"),he(n,H({x:-Xn,y:-Xn,rx:14,width:e.width+Xn*2,height:e.height+Xn*2},t))):_(e,"bpmn:EndEvent")?(n=Ce("circle"),he(n,H({cx:e.width/2,cy:e.height/2,r:e.width/2+Xn+1},t))):_(e,"bpmn:Event")?(n=Ce("circle"),he(n,H({cx:e.width/2,cy:e.height/2,r:e.width/2+Xn},t))):_(e,"bpmn:DataObjectReference")&&Mx(e,"bpmn:DataObjectReference")?n=Tx(CD,{x:-6,y:-6},t):_(e,"bpmn:DataStoreReference")&&Mx(e,"bpmn:DataStoreReference")&&(n=Tx(PD,{x:-6,y:-6},t)),n},Eu.prototype.updateOutline=function(e,t){if(!Fe(e))return ze(e,["bpmn:SubProcess","bpmn:Group"])?(he(t,{width:e.width+Xn*2,height:e.height+Xn*2}),!0):!!ze(e,["bpmn:Event","bpmn:Gateway","bpmn:DataStoreReference","bpmn:DataObjectReference"])};function Mx(e,t){var n;return t==="bpmn:DataObjectReference"?n=AD:t==="bpmn:DataStoreReference"&&(n=TD),e.width===n.width&&e.height===n.height}const MD={__depends__:[$f],__init__:["outlineProvider"],outlineProvider:["type",Eu]};var kD='<?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 _i(e){fo.call(this,e)}de(_i,fo),_i.Viewer=gr,_i.NavigatedViewer=La,_i.prototype.createDiagram=function(){return this.importXML(kD)},_i.prototype._interactionModules=[Gv,Wv,Yv],_i.prototype._modelingModules=[D2,Nc,$2,N2,Z2,Df,ik,Ak,Dy,hc,Ok,Ik,Zk,Jk,eO,oO,yO,wO,of,TO,BO,YO,XO,V_,xD,RD,MD],_i.prototype._modules=[].concat(gr.prototype._modules,_i.prototype._interactionModules,_i.prototype._modelingModules);const OD=((e,t)=>{const n=e.__vccOpts||e;for(const[i,r]of t)n[i]=r;return n})(At.defineComponent({__name:"BpmnModelerView",props:{xml:{}},emits:["ready","imported","import-error"],setup(e,{expose:t,emit:n}){const i=e,r=n,o=At.ref();let a;async function s(u){if(!a)throw new Error("modeler not mounted");try{const{warnings:l}=await a.importXML(u),p=qu(l);return r("imported",p),{warnings:p}}catch(l){throw r("import-error",l),l}}async function c(){if(!a)throw new Error("modeler not mounted");const{xml:u}=await a.saveXML({format:!0});return u??""}return At.onMounted(async()=>{a=new _i({container:o.value,moddleExtensions:ss}),i.xml&&await s(i.xml),r("ready")}),At.watch(()=>i.xml,u=>{u&&a&&s(u)}),At.onBeforeUnmount(()=>{a==null||a.destroy(),a=void 0}),t({importXml:s,saveXml:c,getModeler:()=>a}),(u,l)=>(At.openBlock(),At.createElementBlock("div",{ref_key:"container",ref:o,class:"bpmn-modeler-view"},null,512))}}),[["__scopeId","data-v-a9b41c97"]]);ae.APPLY_BPMN_OPS_SCHEMA=A0,ae.BPMN_MODDLE_EXTENSIONS=ss,ae.BWL_MODDLE_SCHEMA=td,ae.BWL_NS=ed,ae.BWL_PREFIX=Au,ae.BWL_SIDES=Tu,ae.BpmnModelerView=OD,ae.EDITOR=QE,ae.FLOW_LABEL_INDENT=Id,ae.HEADLESS_BPMN_MODULES=Dv,ae.HEADLESS_TEXT_METRICS=ro,ae.I18N_NS=aE,ae.I18N_PREFIX=Cd,ae.LABEL_FORK_MARGIN=Xu,ae.MVP_FLOW_NODE_TYPES=xi,ae.SYMBOLIC_OP_KINDS=rd,ae.SYMBOLIC_OP_SCHEMA=od,ae.UNDO_EPISODE_COMMAND=Mu,ae.applyBpmnOpBatch=Ch,ae.applyBpmnOps=wh,ae.approximateTextWidth=oo,ae.auditBpmnGeometry=Ud,ae.auditBpmnGeometryXml=ME,ae.auditGeometry=Pi,ae.auditTargetsOf=ai,ae.axisSegmentsOf=fn,ae.blackBoxNameRect=Ku,ae.buildBpmnOpBatch=ZE,ae.buildRegistryIndex=Yd,ae.containerBoundarySegments=Yo,ae.createBpmnEditorController=JE,ae.createBpmnModdle=Pd,ae.createHeadlessBpmnModeler=bM,ae.crossedShapesOf=Sn,ae.crossingCost=Ci,ae.describeProcess=Rh,ae.describeProcessXml=XE,ae.edgeCrossCount=ds,ae.edgeCrossingPairsOf=Qu,ae.edgeCrossingStatsOf=Fd,ae.executeAsUndoEpisode=id,ae.forwardThreePointCandidates=tl,ae.geometryFindingKey=Ei,ae.installHeadlessBpmnDom=Td,ae.isMvpFlowNodeType=Jf,ae.labelRectsOf=so,ae.lineCrossesLabel=Ri,ae.lineThroughLabel=Bd,ae.lineThroughShapeLabel=Vd,ae.loadBpmnXml=Uu,ae.lowerOps=xh,ae.oppositeOverlapCount=vE,ae.oppositeOverlapOf=Ld,ae.planBackEdgeBoundaryClearance=ah,ae.planCrossPoolRoute=nh,ae.planEdgeRepair=Jd,ae.planLabelLineClearance=ph,ae.planLabelPlacement=lh,ae.planMiddleSegmentShifts=Xd,ae.planOppositeOverlapRepair=ch,ae.planSegmentDetours=el,ae.planShapeLabelClearance=hh,ae.repairIntroducedBoundaryHugging=sh,ae.repairIntroducedCrossings=eh,ae.repairIntroducedLabelLines=fh,ae.repairIntroducedOppositeOverlaps=uh,ae.repairIntroducedShapeLabelLines=mh,ae.repairIntroducedSharedSegmentLabels=dh,ae.rerouteIntroducedCrossPoolEdges=ih,ae.resolverServicesOf=bh,ae.saveBpmnXml=sE,ae.sceneCrossingCost=jd,ae.sceneFromDefinitions=Wd,ae.sceneFromRegistry=yt,ae.sharedSegmentUnderLabel=fs,ae.sharedSpansOf=ps,ae.unreadableOverlapCount=Si,ae.unreadableOverlapOf=ls,ae.validateOps=vh,ae.warningMessages=qu,Object.defineProperty(ae,Symbol.toStringTag,{value:"Module"})}));