@g1cloud/bpmn-modeler-next 5.0.0-alpha.55 → 5.0.0-alpha.56

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(oe,At){typeof exports=="object"&&typeof module<"u"?At(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],At):(oe=typeof globalThis<"u"?globalThis:oe||self,At(oe.BpmnModeler={},oe.Vue))})(this,(function(oe,At){"use strict";var KD=Object.defineProperty;var XD=(oe,At,Ri)=>At in oe?KD(oe,At,{enumerable:!0,configurable:!0,writable:!0,value:Ri}):oe[At]=Ri;var Zr=(oe,At,Ri)=>XD(oe,typeof At!="symbol"?At+"":At,Ri);const Ri=["startEvent","endEvent","userTask","serviceTask","task","sendTask","receiveTask","exclusiveGateway","parallelGateway"];function td(e){return Ri.includes(e)}const nd="http://g1project.net/spec/bpmn/bwl/1.0",Au="bwl",Tu=["top-left","top","top-right","right","bottom-right","bottom","bottom-left","left"],id={name:"bwl-hints",uri:nd,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",rd=new WeakSet;function v0(e){rd.has(e)||(e.register(Mu,{preExecute(t){try{t.run()}catch(n){t.error=n}}}),rd.add(e))}function od(e,t){v0(e);const n={run:t};if(e.execute(Mu,n),n.error!==void 0)throw e.canUndo()&&e.undo(),n.error}const ad=["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"],b0={description:"생략 = 보존, null = 제거.",anyOf:[{type:"string"},{type:"null"}]},_0={type:"object",description:"레인. 배열 선언 순서 = 풀 내 상→하 순서.",properties:{id:{type:"string"},name:{type:"string"}},required:["id"],additionalProperties:!1},x0={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},w0={type:"object",description:"플로우 노드. 좌표는 지정하지 않는다 — 배치는 resolver 가 결정한다.",properties:{id:{type:"string"},type:{type:"string",enum:[...Ri]},name:{type:"string"},participant:{type:"string",description:"소속 풀 id(협업 문서)."},lane:{type:"string",description:"소속 레인 id(풀 정의에 선언된 것)."}},required:["id","type"],additionalProperties:!1},E0={type:"object",description:"분기 조건 — 게이트웨이가 아닌 플로우에 붙인다. MVP 는 label 만.",properties:{label:{type:"string"}},required:["label"],additionalProperties:!1},S0={type:"object",description:"시퀀스 플로우(같은 풀 안 노드 간).",properties:{id:{type:"string"},source:{type:"string"},target:{type:"string"},name:{type:"string"},condition:{$ref:"#/$defs/irFlowCondition"}},required:["id","source","target"],additionalProperties:!1},R0={type:"object",description:"메시지 플로우(풀 경계를 넘는 연결 — 노드 또는 블랙박스 풀 자체가 끝점).",properties:{id:{type:"string"},source:{type:"string"},target:{type:"string"},name:{type:"string"}},required:["id","source","target"],additionalProperties:!1},C0={type:"object",properties:{id:{type:"string"},name:{type:"string"}},required:["id"],additionalProperties:!1},P0={type:"object",description:"데이터 입출력 연관. 방향 = source→target(태스크→스토어 = 쓰기, 스토어→태스크 = 읽기).",properties:{id:{type:"string"},source:{type:"string"},target:{type:"string"}},required:["source","target"],additionalProperties:!1},A0={type:"object",properties:{id:{type:"string"},text:{type:"string"}},required:["id","text"],additionalProperties:!1},T0={type:"object",description:"연관선(주석 ↔ 요소).",properties:{id:{type:"string"},source:{type:"string"},target:{type:"string"}},required:["source","target"],additionalProperties:!1},M0={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},k0={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 O0={"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:[...Ri]},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"]})},sd={anyOf:ad.map(e=>O0[e])},D0={type:"object",description:"BPMN 문서에 요소를 추가·수정·삭제할 때 호출한다. 기존 요소는 describeProcess 가 노출하는 id 로 지정하고, 신규 요소 id 는 문서 내 유일한 XML NCName(공백 없이 문자/밑줄 시작)으로 짓는다. 좌표는 지정하지 않는다 — 배치는 서버가 결정하며, 필요하면 힌트(placement/band/order)로 의도만 전달하라.",properties:{ops:{type:"array",items:{$ref:"#/$defs/symbolicOp"}}},required:["ops"],additionalProperties:!1,$defs:{irLane:_0,irParticipant:x0,irNode:w0,irFlowCondition:E0,irSequenceFlow:S0,irMessageFlow:R0,irDataStore:C0,irDataAssociation:P0,irTextAnnotation:A0,irAssociation:T0,irGroup:M0,bwlPlacement:k0,nullableString:b0,symbolicOp:sd}};function ku(e){return Array.prototype.concat.apply([],e)}const Vo=Object.prototype.toString,L0=Object.prototype.hasOwnProperty;function Rr(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 wn(e){return Vo.call(e)==="[object String]"}function I0(e){if(!ke(e))throw new Error("must supply array")}function En(e,t){return!Qr(e)&&L0.call(e,t)}function lt(e,t){const n=ns(t);let i;return L(e,function(r,o){if(n(r,o))return i=r,!1}),i}function cd(e,t){const n=ns(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=ns(t);let i=[];return L(e,function(r,o){n(r,o)&&i.push(r)}),i}function L(e,t){let n,i;if(Rr(e))return;const r=ke(e)?F0:j0;for(let o in e)if(En(e,o)&&(n=e[o],i=t(n,r(o)),i===!1))return n}function N0(e,t){if(Rr(e))return[];I0(e);const n=ns(t);return e.filter(function(i,r){return!n(i,r)})}function Sn(e,t,n){return L(e,function(i,r){n=t(n,i,r)}),n}function Cr(e,t){return!!Sn(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 ts(e){return e&&Object.keys(e)||[]}function B0(e){return ts(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 ud(e,...t){e=Ou(e);let n={};return L(t,r=>eo(r,e,n)),on(n,function(r,o){return r[0]})}const $0=ud;function ai(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 Cr(e,function(n,i){return t[i]===n})}}function Ou(e){return Wt(e)?e:t=>t[e]}function ns(e){return Wt(e)?e:t=>t===e}function j0(e){return e}function F0(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 H0(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)?{}:[]),Rr(a)?Rr(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 si(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 ld(e,t){this.model=e,this.properties=t}ld.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 z0=H(Object.create(null),{String:!0,Boolean:!0,Integer:!0,Real:!0,Element:!0}),pd=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=pd[e];return n?n(t):t}function Nu(e){return!!z0[e]}function fd(e){return!!pd[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;dd(t,e,"prefix"),dd(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 dd(e,t,n){var i=t[n];if(i in e)throw new Error("package with "+n+" <"+i+"> already defined")}function Pr(e){this.model=e}Pr.prototype.set=function(e,t,n){if(!wn(t)||!t.length)throw new TypeError("property name must be a non-empty string");var i=this.getProperty(e,t),r=i&&i.name;G0(n)?i?delete e[r]:delete e.$attrs[Bu(t)]:i?r in e?e[r]=n:hd(e,i,n):e.$attrs[Bu(t)]=n},Pr.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&&hd(e,n,[]),e[i]},Pr.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)},Pr.prototype.defineDescriptor=function(e,t){this.define(e,"$descriptor",{value:t})},Pr.prototype.defineModel=function(e,t){this.define(e,"$model",{value:t})},Pr.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 G0(e){return typeof e>"u"}function hd(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 Pr(this),this.factory=new ld(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=wn(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){H0(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 md=String.fromCharCode,V0=Object.prototype.hasOwnProperty,W0=/&#(\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 U0(e,t,n,i){return i?V0.call(Wo,i)?Wo[i]:"&"+i+";":md(t||parseInt(n,16))}function Ar(e){return e.length>3&&e.indexOf("&")!==-1?e.replace(W0,U0):e}var gd="non-whitespace outside of root node";function Yi(e){return new Error(e)}function q0(e){return"missing namespace for prefix <"+e+">"}function is(e){return{get:e,enumerable:!0}}function Y0(e){var t=Object.create(null),n;for(n in e)t[n]=e[n];return t}var yd=Symbol("nameCache");function $u(e){return e+"$uri"}function K0(e){var t=Object.create(null),n,i;for(n in e)i=e[n],t[i]=i,t[$u(i)]=n;return t}function rs(){return{line:0,column:0}}function X0(e){throw e}function vd(e){if(!this)return new vd(e);var t=e&&e.proxy,n,i,r,o,a=X0,s,c,u,l,p=rs,f=!1,d=!1,g="",h=!1,m=!1,w=null,y=!1,_,S,P,C;function D(O){O instanceof Error||(O=Yi(O)),w=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),ae;for(ae in O)F[ae]=O[ae];return m=!0,C=F,this};function N(){_=m?[]:null,S=m?K0(C):null,P=[],p=rs,y=!1,w=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=rs,y=!1,w},this.write=function(O){if(typeof O!="string")throw Yi("required args <xml=string>");return f||(N(),f=!0),w||(g=k(g+O,!0)||""),this},this.end=function(){return f||N(),f=!1,w||k(g),g="",p=rs,y=!1,w},this.stop=function(){y=!0};function k(O,F=!1){var ae=null,_e=null,We,Y=0,le=!1,ge=!1,ue=0,Re=0,re,q,U,Z,He,wt,M,E,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(q0(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,bn,ri,Zn,It,qr={},Za=new Set,_n,Ze,rt;e:for(;et<Zt;et++)if(_n=!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"),_n=!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"),_n=!0}if(It=zt.substring(et,rt),It==="xmlns:xmlns"&&(T("illegal declaration of xmlns"),_n=!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"),_n=!0));else if(Ze===39)rt=zt.indexOf("'",et=rt+2),rt===-1&&(rt=zt.indexOf('"',et),rt!==-1&&(T("attribute value quote missmatch"),_n=!0));else for(T("missing attribute value quotes"),_n=!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,_n=!0),_n||(ri=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"),_n=!0);if(et=rt+1,_n)continue e;if(Za.has(It)){T("attribute <"+It+"> already defined");continue}if(Za.add(It),!m){qr[It]=ri;continue}if(h){if(bn=It==="xmlns"?"xmlns":It.charCodeAt(0)===120&&It.substr(0,6)==="xmlns:"?It.substr(6):null,bn!==null){if(nt=Ar(ri),Ht=$u(bn),Zn=C[nt],!Zn){if(bn==="xmlns"||Ht in S&&S[Ht]!==nt)do Zn="ns"+Y++;while(typeof S[Zn]<"u");else Zn=bn;C[nt]=Zn}S[bn]!==Zn&&(Wi||(S=Y0(S),Wi=!0),S[bn]=Zn,bn==="xmlns"&&(S[$u(Zn)]=nt,Xt=Zn),S[Ht]=nt),qr[It]=ri;continue}ln.push(It,ri);continue}It=ye(It,Xt),It!==null&&(qr[It]=ri)}if(h)for(et=0,Zt=ln.length;et<Zt;et++)It=ye(ln[et++],Xt),ri=ln[et],It!==null&&(qr[It]=ri);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:is(function(){return M}),originalName:is(function(){return E}),attrs:is(Ie),ns:is(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(gd);return}if(d||(d=!0),Re!==ue){if(P.length){if(n&&(n(O.substring(Re,ue),Ar,p),y))return}else if(O.substring(Re,ue).trim()&&(T(gd),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),Ar,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),Ar,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||_.push(We),K===null&&(h=re.indexOf("xmlns",U)!==-1)&&(W=U,j=re,Ie(),h=!1)),E=M,_e!==S&&(ae=S[yd],ae===void 0&&(ae=S[yd]=Object.create(null)),_e=S);var Et=ae[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 <"+E+">");M=M.substr(Z+1)}else wt=S.xmlns;wt&&(M=wt+":"+M),ae[E]=M}}if(le&&(W=U,j=re,i&&(t?i(b,Ar,ge,p):i(M,Ie,Ar,ge,p),y)))return;if(ge){if(r&&(r(t?b:M,Ar,le,p),y))return;m&&(le?S=We:S=_.pop())}Re+=1}}}function bd(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"},_d="property";function xd(e){return e.xml&&e.xml.serialize}function Z0(e){const t=xd(e);return t!==_d&&(t||null)}function Q0(e){return e.charAt(0).toUpperCase()+e.slice(1)}function wd(e,t){return bd(t)?e.prefix+":"+Q0(e.localName):e.name}function J0(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 ew(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 J0(o,a)}function Ki(e){return new Error(e)}function Ci(e){return e.$descriptor}function tw(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=Ci(t),r=i.idProperty,o;if(r&&(o=t.get(r.name),o)){if(!/^([a-z][\w-.]*:)?[a-z_][\w-.]*$/i.test(o))throw new Error("illegal ID <"+o+">");if(n[o])throw Ki("duplicate ID <"+o+">");n[o]=t}},this.addWarning=function(t){this.warnings.push(t)}}function Uo(){}Uo.prototype.handleEnd=function(){},Uo.prototype.handleText=function(){},Uo.prototype.handleNode=function(){};function 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 os(){}os.prototype=Object.create(no.prototype),os.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(os.prototype),pn.prototype.addReference=function(e){this.context.addReference(e)},pn.prototype.handleText=function(e){var t=this.element,n=Ci(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=Ci(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=Ci(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=Ci(i),a=n.name,s=o.propertiesByName[a];if(s&&!s.isAttr){const u=Z0(s);if(u){const l=e.attributes[u];if(l){const p=ew(l,e.ns,r),f=r.getType(p);return H({},s,{effectiveType:Ci(f).name})}}return s}var c=r.getPackage(n.prefix);if(c){const u=wd(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:Ci(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["+Ci(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,fd(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&&wd(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(os.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 tw(H({},t,{rootHandler:i})),s=new vd({proxy:!0}),c=nw();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+`
1
+ (function(re,At){typeof exports=="object"&&typeof module<"u"?At(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],At):(re=typeof globalThis<"u"?globalThis:re||self,At(re.BpmnModeler={},re.Vue))})(this,(function(re,At){"use strict";var nL=Object.defineProperty;var iL=(re,At,Ri)=>At in re?nL(re,At,{enumerable:!0,configurable:!0,writable:!0,value:Ri}):re[At]=Ri;var Xr=(re,At,Ri)=>iL(re,typeof At!="symbol"?At+"":At,Ri);const Ri=["startEvent","endEvent","userTask","serviceTask","task","sendTask","receiveTask","exclusiveGateway","parallelGateway"];function id(e){return Ri.includes(e)}const rd="http://g1project.net/spec/bpmn/bwl/1.0",Tu="bwl",Mu=["top-left","top","top-right","right","bottom-right","bottom","bottom-left","left"],od={name:"bwl-hints",uri:rd,prefix:Tu,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"}]}]},ku="bwl.undoEpisode",ad=new WeakSet;function w0(e){ad.has(e)||(e.register(ku,{preExecute(t){try{t.run()}catch(n){t.error=n}}}),ad.add(e))}function sd(e,t){w0(e);const n={run:t};if(e.execute(ku,n),n.error!==void 0)throw e.canUndo()&&e.undo(),n.error}const cd=["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"],E0={description:"생략 = 보존, null = 제거.",anyOf:[{type:"string"},{type:"null"}]},S0={type:"object",description:"레인. 배열 선언 순서 = 풀 내 상→하 순서.",properties:{id:{type:"string"},name:{type:"string"}},required:["id"],additionalProperties:!1},R0={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},C0={type:"object",description:"플로우 노드. 좌표는 지정하지 않는다 — 배치는 resolver 가 결정한다.",properties:{id:{type:"string"},type:{type:"string",enum:[...Ri]},name:{type:"string"},participant:{type:"string",description:"소속 풀 id(협업 문서)."},lane:{type:"string",description:"소속 레인 id(풀 정의에 선언된 것)."}},required:["id","type"],additionalProperties:!1},P0={type:"object",description:"분기 조건 — 게이트웨이가 아닌 플로우에 붙인다. MVP 는 label 만.",properties:{label:{type:"string"}},required:["label"],additionalProperties:!1},A0={type:"object",description:"시퀀스 플로우(같은 풀 안 노드 간).",properties:{id:{type:"string"},source:{type:"string"},target:{type:"string"},name:{type:"string"},condition:{$ref:"#/$defs/irFlowCondition"}},required:["id","source","target"],additionalProperties:!1},T0={type:"object",description:"메시지 플로우(풀 경계를 넘는 연결 — 노드 또는 블랙박스 풀 자체가 끝점).",properties:{id:{type:"string"},source:{type:"string"},target:{type:"string"},name:{type:"string"}},required:["id","source","target"],additionalProperties:!1},M0={type:"object",properties:{id:{type:"string"},name:{type:"string"}},required:["id"],additionalProperties:!1},k0={type:"object",description:"데이터 입출력 연관. 방향 = source→target(태스크→스토어 = 쓰기, 스토어→태스크 = 읽기).",properties:{id:{type:"string"},source:{type:"string"},target:{type:"string"}},required:["source","target"],additionalProperties:!1},O0={type:"object",properties:{id:{type:"string"},text:{type:"string"}},required:["id","text"],additionalProperties:!1},D0={type:"object",description:"연관선(주석 ↔ 요소).",properties:{id:{type:"string"},source:{type:"string"},target:{type:"string"}},required:["source","target"],additionalProperties:!1},L0={type:"object",description:"그룹 — members(요소 id 목록)가 bwl:members 힌트로 기록되고 바운즈는 멤버 bbox 로 산출된다.",properties:{id:{type:"string"},name:{type:"string"},members:{type:"array",items:{type:"string"}}},required:["id"],additionalProperties:!1},I0={type:"object",description:"주석 방위 힌트 — 앵커 요소 기준 상대 배치. 있으면 결정적 배치, 없으면 휴리스틱.",properties:{anchor:{type:"string",description:"기준 요소 id."},side:{type:"string",enum:[...Mu]},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 B0={"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:[...Ri]},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"]})},ud={anyOf:cd.map(e=>B0[e])},N0={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:S0,irParticipant:R0,irNode:C0,irFlowCondition:P0,irSequenceFlow:A0,irMessageFlow:T0,irDataStore:M0,irDataAssociation:k0,irTextAnnotation:O0,irAssociation:D0,irGroup:L0,bwlPlacement:I0,nullableString:E0,symbolicOp:ud}};function Ou(e){return Array.prototype.concat.apply([],e)}const Wo=Object.prototype.toString,$0=Object.prototype.hasOwnProperty;function Sr(e){return e===void 0}function $t(e){return e!==void 0}function Zr(e){return e==null}function ke(e){return Wo.call(e)==="[object Array]"}function Vt(e){return Wo.call(e)==="[object Object]"}function Le(e){return Wo.call(e)==="[object Number]"}function Wt(e){const t=Wo.call(e);return t==="[object Function]"||t==="[object AsyncFunction]"||t==="[object GeneratorFunction]"||t==="[object AsyncGeneratorFunction]"||t==="[object Proxy]"}function wn(e){return Wo.call(e)==="[object String]"}function F0(e){if(!ke(e))throw new Error("must supply array")}function En(e,t){return!Zr(e)&&$0.call(e,t)}function lt(e,t){const n=ns(t);let i;return L(e,function(r,o){if(n(r,o))return i=r,!1}),i}function ld(e,t){const n=ns(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=ns(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)?V0:G0;for(let o in e)if(En(e,o)&&(n=e[o],i=t(n,r(o)),i===!1))return n}function j0(e,t){if(Sr(e))return[];F0(e);const n=ns(t);return e.filter(function(i,r){return!n(i,r)})}function Sn(e,t,n){return L(e,function(i,r){n=t(n,i,r)}),n}function Rr(e,t){return!!Sn(e,function(n,i,r){return n&&t(i,r)},!0)}function Wi(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 ts(e){return e&&Object.keys(e)||[]}function H0(e){return ts(e).length}function Qr(e){return on(e,t=>t)}function Jr(e,t,n={}){return t=Du(t),L(e,function(i){let r=t(i)||"_",o=n[r];o||(o=n[r]=[]),o.push(i)}),n}function pd(e,...t){e=Du(e);let n={};return L(t,r=>Jr(r,e,n)),on(n,function(r,o){return r[0]})}const z0=pd;function ci(e,t){t=Du(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 eo(e){return function(t){return Rr(e,function(n,i){return t[i]===n})}}function Du(e){return Wt(e)?e:t=>t[e]}function ns(e){return Wt(e)?e:t=>t===e}function G0(e){return e}function V0(e){return Number(e)}function Lu(e,t){let n,i,r,o;function a(f){let p=Date.now(),d=f?0:o+t-p;if(d>0)return s(d);e.apply(r,i),c()}function s(f){n=setTimeout(a,f)}function c(){n&&clearTimeout(n),n=o=i=r=void 0}function u(){n&&a(!0),c()}function l(...f){o=Date.now(),i=f,r=this,n||s(t)}return l.flush=u,l.cancel=c,l}function gn(e,t){return e.bind(t)}function z(e,...t){return Object.assign(e,...t)}function W0(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];$t(a)&&Zr(s)&&(s=i[r]=isNaN(+a)?{}:[]),Sr(a)?Sr(n)?delete i[r]:i[r]=n:i=s}),e}function ni(e,t){let n={},i=Object(e);return L(t,function(r){r in i&&(n[r]=e[r])}),n}function ui(e,t){let n={},i=Object(e);return L(i,function(r,o){t.indexOf(o)===-1&&(n[o]=r)}),n}function Iu(){}Iu.prototype.get=function(e){return this.$model.properties.get(this,e)},Iu.prototype.set=function(e,t){this.$model.properties.set(this,e,t)};function fd(e,t){this.model=e,this.properties=t}fd.prototype.createType=function(e){var t=this.model,n=this.properties,i=Object.create(Iu.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,gn(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 U0=z(Object.create(null),{String:!0,Boolean:!0,Integer:!0,Real:!0,Element:!0}),dd=z(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 Bu(e,t){var n=dd[e];return n?n(t):t}function Nu(e){return!!U0[e]}function hd(e){return!!dd[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 ni(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,gn(function(o){o=z({},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 Ui(e,t){this.packageMap=Object.create(null),this.typeMap=Object.create(null),this.packages=[],this.properties=t,L(e,gn(this.registerPackage,this))}Ui.prototype.getPackage=function(e){return this.packageMap[e]},Ui.prototype.getPackages=function(){return this.packages},Ui.prototype.registerPackage=function(e){e=z({},e);var t=this.packageMap;md(t,e,"prefix"),md(t,e,"uri"),L(e.types,gn(function(n){this.registerType(n,e)},this)),t[e.uri]=t[e.prefix]=e,this.packages.push(e)},Ui.prototype.registerType=function(e,t){e=z({},e,{superClass:(e.superClass||[]).slice(),extends:(e.extends||[]).slice(),properties:(e.properties||[]).slice(),meta:z({},e.meta||{})});var n=an(e.name,t.prefix),i=n.name,r=Object.create(null);L(e.properties,gn(function(o){var a=an(o.name,n.prefix),s=a.name;Nu(o.type)||(o.type=an(o.type,a.prefix).name),z(o,{ns:a,name:s}),r[s]=o},this)),z(e,{ns:n,name:i,propertiesByName:r}),L(e.extends,gn(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},Ui.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)},Ui.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},Ui.prototype.definePackage=function(e,t){this.properties.define(e,"$pkg",{value:t})};function md(e,t,n){var i=t[n];if(i in e)throw new Error("package with "+n+" <"+i+"> already defined")}function Cr(e){this.model=e}Cr.prototype.set=function(e,t,n){if(!wn(t)||!t.length)throw new TypeError("property name must be a non-empty string");var i=this.getProperty(e,t),r=i&&i.name;q0(n)?i?delete e[r]:delete e.$attrs[$u(t)]:i?r in e?e[r]=n:gd(e,i,n):e.$attrs[$u(t)]=n},Cr.prototype.get=function(e,t){var n=this.getProperty(e,t);if(!n)return e.$attrs[$u(t)];var i=n.name;return!e[i]&&n.isMany&&gd(e,n,[]),e[i]},Cr.prototype.define=function(e,t,n){if(!n.writable){var i=n.value;n=z({},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 q0(e){return typeof e>"u"}function gd(e,t,n){Object.defineProperty(e,t.name,{enumerable:!t.isReference,writable:!0,value:n,configurable:!0})}function $u(e){return e.replace(/^:/,"")}function zn(e,t={}){this.properties=new Cr(this),this.factory=new fd(this,this.properties),this.registry=new Ui(e,this.properties),this.typeCache=Object.create(null),this.config=t}zn.prototype.create=function(e,t){var n=this.getType(e);if(!n)throw new Error("unknown type <"+e+">");return new n(t)},zn.prototype.getType=function(e){var t=this.typeCache,n=wn(e)?e:e.ns.name,i=t[n];return i||(e=this.registry.getEffectiveDescriptor(n),i=t[n]=this.factory.createType(e)),i},zn.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){W0(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},zn.prototype.getPackage=function(e){return this.registry.getPackage(e)},zn.prototype.getPackages=function(){return this.registry.getPackages()},zn.prototype.getElementDescriptor=function(e){return e.$descriptor},zn.prototype.hasType=function(e,t){t===void 0&&(t=e,e=this);var n=e.$model.getElementDescriptor(e);return t in n.allTypesByName},zn.prototype.getPropertyDescriptor=function(e,t){return this.getElementDescriptor(e).propertiesByName[t]},zn.prototype.getTypeDescriptor=function(e){return this.registry.typeMap[e]};var yd=String.fromCharCode,Y0=Object.prototype.hasOwnProperty,K0=/&#(\d+);|&#x([0-9a-f]+);|&(\w+);/ig,Uo={amp:"&",apos:"'",gt:">",lt:"<",quot:'"'};Object.keys(Uo).forEach(function(e){Uo[e.toUpperCase()]=Uo[e]});function X0(e,t,n,i){return i?Y0.call(Uo,i)?Uo[i]:"&"+i+";":yd(t||parseInt(n,16))}function Pr(e){return e.length>3&&e.indexOf("&")!==-1?e.replace(K0,X0):e}var vd="non-whitespace outside of root node";function qi(e){return new Error(e)}function Z0(e){return"missing namespace for prefix <"+e+">"}function is(e){return{get:e,enumerable:!0}}function Q0(e){var t=Object.create(null),n;for(n in e)t[n]=e[n];return t}var bd=Symbol("nameCache");function Fu(e){return e+"$uri"}function J0(e){var t=Object.create(null),n,i;for(n in e)i=e[n],t[i]=i,t[Fu(i)]=n;return t}function rs(){return{line:0,column:0}}function ew(e){throw e}function _d(e){if(!this)return new _d(e);var t=e&&e.proxy,n,i,r,o,a=ew,s,c,u,l,f=rs,p=!1,d=!1,g="",h=!1,m=!1,_=null,y=!1,x,S,P,C;function D(O){O instanceof Error||(O=qi(O)),_=O,a(O,f)}function T(O){s&&(O instanceof Error||(O=qi(O)),s(O,f))}this.on=function(O,j){if(typeof j!="function")throw qi("required args <name, cb>");switch(O){case"openTag":i=j;break;case"text":n=j;break;case"closeTag":r=j;break;case"error":a=j;break;case"warn":s=j;break;case"cdata":o=j;break;case"attention":l=j;break;case"question":u=j;break;case"comment":c=j;break;default:throw qi("unsupported event: "+O)}return this},this.ns=function(O){if(typeof O>"u"&&(O={}),typeof O!="object")throw qi("required args <nsMap={}>");var j=Object.create(null),oe;for(oe in O)j[oe]=O[oe];return m=!0,C=j,this};function $(){x=m?[]:null,S=m?J0(C):null,P=[],f=rs,y=!1,_=null,d=!1,g=""}this.parse=function(O){if(typeof O!="string")throw qi("required args <xml=string>");if(p)throw qi("parse during stream; call end() first");return $(),k(O),f=rs,y=!1,_},this.write=function(O){if(typeof O!="string")throw qi("required args <xml=string>");return p||($(),p=!0),_||(g=k(g+O,!0)||""),this},this.end=function(){return p||$(),p=!1,_||k(g),g="",f=rs,y=!1,_},this.stop=function(){y=!0};function k(O,j=!1){var oe=null,xe=null,Ue,Y=0,ue=!1,ve=!1,le=0,be=0,ce,U,q,K,He,Yt,M,E,b,F="",W=0,X;function me(it,Pt){var Zt=it.indexOf(":");if(Zt===-1)return it;var mn=S[it.substring(0,Zt)];return mn?Pt===mn?it.substr(Zt+1):mn+it.substr(Zt):(T(Z0(it.substring(0,Zt))),null)}function Ie(){if(X!==null)return X;var it,Pt,Zt=m&&S.xmlns,mn=m&&h?[]:null,ut=W,It=F,Bt=It.length,zo,bn,jn,_n,Nt,Ur={},Za=new Set,Hn,Xe,et;e:for(;ut<Bt;ut++)if(Hn=!1,Xe=It.charCodeAt(ut),!(Xe===32||Xe<14&&Xe>8)){for((Xe<65||Xe>122||Xe>90&&Xe<97)&&Xe!==95&&Xe!==58&&(T("illegal first char attribute name"),Hn=!0),et=ut+1;et<Bt;et++)if(Xe=It.charCodeAt(et),!(Xe>96&&Xe<123||Xe>64&&Xe<91||Xe>47&&Xe<59||Xe===46||Xe===45||Xe===95)){if(Xe===32||Xe<14&&Xe>8){T("missing attribute value"),ut=et;continue e}if(Xe===61)break;T("illegal attribute name char"),Hn=!0}if(Nt=It.substring(ut,et),Nt==="xmlns:xmlns"&&(T("illegal declaration of xmlns"),Hn=!0),Xe=It.charCodeAt(et+1),Xe===34)et=It.indexOf('"',ut=et+2),et===-1&&(et=It.indexOf("'",ut),et!==-1&&(T("attribute value quote missmatch"),Hn=!0));else if(Xe===39)et=It.indexOf("'",ut=et+2),et===-1&&(et=It.indexOf('"',ut),et!==-1&&(T("attribute value quote missmatch"),Hn=!0));else for(T("missing attribute value quotes"),Hn=!0,et=et+1;et<Bt&&(Xe=It.charCodeAt(et+1),!(Xe===32||Xe<14&&Xe>8));et++);for(et===-1&&(T("missing closing quotes"),et=Bt,Hn=!0),Hn||(jn=It.substring(ut,et)),ut=et;et+1<Bt&&(Xe=It.charCodeAt(et+1),!(Xe===32||Xe<14&&Xe>8));et++)ut===et&&(T("illegal character after attribute end"),Hn=!0);if(ut=et+1,Hn)continue e;if(Za.has(Nt)){T("attribute <"+Nt+"> already defined");continue}if(Za.add(Nt),!m){Ur[Nt]=jn;continue}if(h){if(bn=Nt==="xmlns"?"xmlns":Nt.charCodeAt(0)===120&&Nt.substr(0,6)==="xmlns:"?Nt.substr(6):null,bn!==null){if(it=Pr(jn),Pt=Fu(bn),_n=C[it],!_n){if(bn==="xmlns"||Pt in S&&S[Pt]!==it)do _n="ns"+Y++;while(typeof S[_n]<"u");else _n=bn;C[it]=_n}S[bn]!==_n&&(zo||(S=Q0(S),zo=!0),S[bn]=_n,bn==="xmlns"&&(S[Fu(_n)]=it,Zt=_n),S[Pt]=it),Ur[Nt]=jn;continue}mn.push(Nt,jn);continue}Nt=me(Nt,Zt),Nt!==null&&(Ur[Nt]=jn)}if(h)for(ut=0,Bt=mn.length;ut<Bt;ut++)Nt=me(mn[ut++],Zt),jn=mn[ut],Nt!==null&&(Ur[Nt]=jn);return X=Ur}function Ze(){for(var it=/(\r\n|\r|\n)/g,Pt=0,Zt=0,mn=0,ut=be,It,Bt;le>=mn&&(It=it.exec(O),!(!It||(ut=It[0].length+It.index,ut>le)));)Pt+=1,mn=ut;return le==-1?(Zt=ut,Bt=O.substring(be)):be===0?Bt=O.substring(be,le):(Zt=le-mn,Bt=be==-1?O.substring(le):O.substring(le,be+1)),{data:Bt,line:Pt,column:Zt}}for(f=Ze,t&&(b=Object.create({},{name:is(function(){return M}),originalName:is(function(){return E}),attrs:is(Ie),ns:is(function(){return S})}));be!==-1;){if(O.charCodeAt(be)===60?le=be:le=O.indexOf("<",be),le===-1){if(j)return O.substring(be);if(P.length)return D("unexpected end of file");if(!d)return D("missing start tag");be<O.length&&O.substring(be).trim()&&T(vd);return}if(d||(d=!0),be!==le){if(P.length){if(n&&(n(O.substring(be,le),Pr,f),y))return}else if(O.substring(be,le).trim()&&(T(vd),y))return}if(K=O.charCodeAt(le+1),K===33){if(q=O.charCodeAt(le+2),q===91&&O.substr(le+3,6)==="CDATA["){if(be=O.indexOf("]]>",le),be===-1)return j?O.substring(le):D("unclosed cdata");if(o&&(o(O.substring(le+9,be),f),y))return;be+=3;continue}if(q===45&&O.charCodeAt(le+3)===45){if(be=O.indexOf("-->",le),be===-1)return j?O.substring(le):D("unclosed comment");if(c&&(c(O.substring(le+4,be),Pr,f),y))return;be+=3;continue}}if(K===63){if(be=O.indexOf("?>",le),be===-1)return j?O.substring(le):D("unclosed question");if(u&&(u(O.substring(le,be+2),f),y))return;be+=2;continue}for(ce=le+1;;ce++){if(He=O.charCodeAt(ce),isNaN(He))return j?O.substring(le):(be=-1,D("unclosed tag"));if(He===34)q=O.indexOf('"',ce+1),ce=q!==-1?q:ce;else if(He===39)q=O.indexOf("'",ce+1),ce=q!==-1?q:ce;else if(He===62){be=ce;break}}if(K===33){if(l&&(l(O.substring(le,be+1),Pr,f),y))return;be+=1;continue}if(X={},K===47){if(ue=!1,ve=!0,!P.length)return D("missing open tag");if(ce=M=P.pop(),q=le+2+ce.length,O.substring(le+2,q)!==ce)return D("closing tag mismatch");for(;q<be;q++)if(K=O.charCodeAt(q),!(K===32||K>8&&K<14))return D("close tag")}else{if(O.charCodeAt(be-1)===47?(ce=M=O.substring(le+1,be-1),ue=!0,ve=!0):(ce=M=O.substring(le+1,be),ue=!0,ve=!1),!(K>96&&K<123||K>64&&K<91||K===95||K===58))return D("illegal first char nodeName");for(q=1,U=ce.length;q<U;q++)if(K=ce.charCodeAt(q),!(K>96&&K<123||K>64&&K<91||K>47&&K<59||K===45||K===95||K==46)){if(K===32||K<14&&K>8){M=ce.substring(0,q),X=null;break}return D("invalid nodeName")}ve||P.push(M)}if(m){Ue=S,ue&&(ve||x.push(Ue),X===null&&(h=ce.indexOf("xmlns",q)!==-1)&&(W=q,F=ce,Ie(),h=!1)),E=M,xe!==S&&(oe=S[bd],oe===void 0&&(oe=S[bd]=Object.create(null)),xe=S);var gt=oe[M];if(gt!==void 0)M=gt;else{if(K=M.indexOf(":"),K!==-1){if(Yt=S[M.substring(0,K)],!Yt)return D("missing namespace on <"+E+">");M=M.substr(K+1)}else Yt=S.xmlns;Yt&&(M=Yt+":"+M),oe[E]=M}}if(ue&&(W=q,F=ce,i&&(t?i(b,Pr,ve,f):i(M,Ie,Pr,ve,f),y)))return;if(ve){if(r&&(r(t?b:M,Pr,ue,f),y))return;m&&(ue?S=Ue:S=x.pop())}be+=1}}}function xd(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"},wd="property";function Ed(e){return e.xml&&e.xml.serialize}function tw(e){const t=Ed(e);return t!==wd&&(t||null)}function nw(e){return e.charAt(0).toUpperCase()+e.slice(1)}function Sd(e,t){return xd(t)?e.prefix+":"+nw(e.localName):e.name}function iw(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 rw(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 iw(o,a)}function Yi(e){return new Error(e)}function Ci(e){return e.$descriptor}function ow(e){z(this,e),this.elementsById={},this.references=[],this.warnings=[],this.addReference=function(t){this.references.push(t)},this.addElement=function(t){if(!t)throw Yi("expected element");var n=this.elementsById,i=Ci(t),r=i.idProperty,o;if(r&&(o=t.get(r.name),o)){if(!/^([a-z][\w-.]*:)?[a-z_][\w-.]*$/i.test(o))throw new Error("illegal ID <"+o+">");if(n[o])throw Yi("duplicate ID <"+o+">");n[o]=t}},this.addWarning=function(t){this.warnings.push(t)}}function qo(){}qo.prototype.handleEnd=function(){},qo.prototype.handleText=function(){},qo.prototype.handleNode=function(){};function Hu(){}Hu.prototype=Object.create(qo.prototype),Hu.prototype.handleNode=function(){return this};function to(){}to.prototype=Object.create(qo.prototype),to.prototype.handleText=function(e){this.body=(this.body||"")+e};function Yo(e,t){this.property=e,this.context=t}Yo.prototype=Object.create(to.prototype),Yo.prototype.handleNode=function(e){if(this.element)throw Yi("expected no sub nodes");return this.element=this.createReference(e),this},Yo.prototype.handleEnd=function(){this.element.id=this.body},Yo.prototype.createReference=function(e){return{property:this.property.ns.name,id:""}};function zu(e,t){this.element=t,this.propertyDesc=e}zu.prototype=Object.create(to.prototype),zu.prototype.handleEnd=function(){var e=this.body||"",t=this.element,n=this.propertyDesc;e=Bu(n.type,e),n.isMany?t.get(n.name).push(e):t.set(n.name,e)};function os(){}os.prototype=Object.create(to.prototype),os.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 ln(e,t,n){this.model=e,this.type=e.getType(t),this.context=n}ln.prototype=Object.create(os.prototype),ln.prototype.addReference=function(e){this.context.addReference(e)},ln.prototype.handleText=function(e){var t=this.element,n=Ci(t),i=n.bodyProperty;if(!i)throw Yi("unexpected body text <"+e+">");to.prototype.handleText.call(this,e)},ln.prototype.handleEnd=function(){var e=this.body,t=this.element,n=Ci(t),i=n.bodyProperty;i&&e!==void 0&&(e=Bu(i.type,e),t.set(i.name,e))},ln.prototype.createElement=function(e){var t=e.attributes,n=this.type,i=Ci(n),r=this.context,o=new n({}),a=this.model,s;return L(t,function(c,u){var l=i.propertiesByName[u],f;l&&l.isReference?l.isMany?(f=c.split(" "),L(f,function(p){r.addReference({element:o,property:l.ns.name,id:p})})):r.addReference({element:o,property:l.ns.name,id:c}):(l?c=Bu(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},ln.prototype.getPropertyForNode=function(e){var t=e.name,n=an(t),i=this.type,r=this.model,o=Ci(i),a=n.name,s=o.propertiesByName[a];if(s&&!s.isAttr){const u=tw(s);if(u){const l=e.attributes[u];if(l){const f=rw(l,e.ns,r),p=r.getType(f);return z({},s,{effectiveType:Ci(p).name})}}return s}var c=r.getPackage(n.prefix);if(c){const u=Sd(n,c),l=r.getType(u);if(s=lt(o.properties,function(f){return!f.isVirtual&&!f.isReference&&!f.isAttribute&&l.hasType(f.type)}),s)return z({},s,{effectiveType:Ci(l).name})}else if(s=lt(o.properties,function(u){return!u.isReference&&!u.isAttribute&&u.type==="Element"}),s)return s;throw Yi("unrecognized element <"+n.name+">")},ln.prototype.toString=function(){return"ElementDescriptor["+Ci(this.type).name+"]"},ln.prototype.valueHandler=function(e,t){return new zu(e,t)},ln.prototype.referenceHandler=function(e){return new Yo(e,this.context)},ln.prototype.handler=function(e){return e==="Element"?new no(this.model,e,this.context):new ln(this.model,e,this.context)},ln.prototype.handleChild=function(e){var t,n,i,r;if(t=this.getPropertyForNode(e),i=this.element,n=t.effectiveType||t.type,hd(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?(z(o,{element:i}),this.context.addReference(o)):o.$parent=i),r};function Gu(e,t,n){ln.call(this,e,t,n)}Gu.prototype=Object.create(ln.prototype),Gu.prototype.createElement=function(e){var t=e.name,n=an(t),i=this.model,r=this.type,o=i.getPackage(n.prefix),a=o&&Sd(n,o)||t;if(!r.hasType(a))throw Yi("unexpected element <"+e.originalName+">");return ln.prototype.createElement.call(this,e)};function no(e,t,n){this.model=e,this.context=n}no.prototype=Object.create(os.prototype),no.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)},no.prototype.handleChild=function(e){var t=new no(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},no.prototype.handleEnd=function(){this.body&&(this.element.$body=this.body)};function Vu(e){e instanceof zn&&(e={model:e}),z(this,{lax:!1},e)}Vu.prototype.fromXML=function(e,t,n){var i=t.rootHandler;t instanceof ln?(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 ow(z({},t,{rootHandler:i})),s=new _d({proxy:!0}),c=aw();i.context=a,c.push(i);function u(P,C,D){var T=C(),$=T.line,k=T.column,O=T.data;O.charAt(0)==="<"&&O.indexOf(" ")!==-1&&(O=O.slice(0,O.indexOf(" "))+">");var j="unparsable content "+(O?O+" ":"")+`detected
2
+ line: `+$+`
3
3
  column: `+k+`
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=Ci(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),ae=F.indexOf(T);ae===-1&&(ae=F.length),k?F[ae]=k:F.splice(ae,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 w(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 _(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,ae){var _e=C(N[ae]);return F[ae]=_e,F},{}),O={name:P.name,originalName:P.originalName,attributes:k,ns:P.ns};w(O,T)}).on("question",m).on("closeTag",f).on("cdata",y).on("text",function(P,C,D){_(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 nw(){var e=[];return Object.defineProperty(e,"peek",{value:function(){return this[this.length-1]}}),e}var iw=`<?xml version="1.0" encoding="UTF-8"?>
5
- `,rw=/<|>|'|"|&|\n\r|\n/g,Ed=/<|>|&/g;function ci(e){this.prefixMap={},this.uriMap={},this.used={},this.wellknown=[],this.custom=[],this.parent=e,this.defaultPrefixMap=e&&e.defaultPrefixMap||{}}ci.prototype.mapDefaultPrefixes=function(e){this.defaultPrefixMap=e},ci.prototype.defaultUriByPrefix=function(e){return this.defaultPrefixMap[e]},ci.prototype.byUri=function(e){return this.uriMap[e]||this.parent&&this.parent.byUri(e)},ci.prototype.add=function(e,t){this.uriMap[e.uri]=e,t?this.wellknown.push(e):this.custom.push(e),this.mapPrefix(e.prefix,e.uri)},ci.prototype.uriByPrefix=function(e){return this.prefixMap[e||"xmlns"]||this.parent&&this.parent.uriByPrefix(e)},ci.prototype.mapPrefix=function(e,t){this.prefixMap[e||"xmlns"]=t},ci.prototype.getNSKey=function(e){return e.prefix!==void 0?e.uri+"|"+e.prefix:e.uri},ci.prototype.logUsed=function(e){var t=e.uri,n=this.getNSKey(e);this.used[n]=this.byUri(t),this.parent&&this.parent.logUsed(e)},ci.prototype.getUsed=function(e){var t=[].concat(this.wellknown,this.custom);return t.filter(n=>{var i=this.getNSKey(n);return this.used[i]})};function ow(e){return e.charAt(0).toLowerCase()+e.slice(1)}function aw(e,t){return bd(t)?ow(e):e}function Sd(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})}function Rd(e){return wn(e)?e:(e.prefix?e.prefix+":":"")+e.localName}function sw(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 cw(e,t){return t.isGeneric?H({localName:t.ns.localName},e):H({localName:aw(t.ns.localName,t.$pkg)},e)}function uw(e,t){return H({localName:t.ns.localName},e)}function lw(e){var t=e.$descriptor;return Ge(t.properties,function(n){var i=n.name;if(n.isVirtual||!En(e,i))return!1;var r=e[i];return r===n.default||r===null?!1:n.isMany?r.length:!0})}var pw={"\n":"#10","\n\r":"#10",'"':"#34","'":"#39","<":"#60",">":"#62","&":"#38"},fw={"<":"lt",">":"gt","&":"amp"};function Cd(e,t,n){return e=wn(e)?e:""+e,e.replace(t,function(i){return"&"+n[i]+";"})}function dw(e){return Cd(e,rw,pw)}function hw(e){return Cd(e,Ed,fw)}function mw(e){return Ge(e,function(t){return t.isAttr})}function gw(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 Tr(){}Tr.prototype.serializeValue=Tr.prototype.serializeTo=function(e){e.append(this.escape?hw(this.value):this.value)},Tr.prototype.build=function(e,t){return this.value=t,e.type==="String"&&t.search(Ed)!==-1&&(this.escape=!0),this};function Wu(e){this.tagName=e}Sd(Wu,Tr),Wu.prototype.serializeTo=function(e){e.appendIndent().append("<"+this.tagName+">"),this.serializeValue(e),e.append("</"+this.tagName+">").appendNewLine()};function gt(e,t){this.body=[],this.attrs=[],this.parent=e,this.propertyDescriptor=t}gt.prototype.build=function(e){this.element=e;var t=e.$descriptor,n=this.propertyDescriptor,i,r,o=t.isGeneric;return o?i=this.parseGenericNsAttributes(e):i=this.parseNsAttributes(e),n?this.ns=this.nsPropertyTagName(n):this.ns=this.nsTagName(t),this.tagName=this.addTagName(this.ns),o?this.parseGenericContainments(e):(r=lw(e),this.parseAttributes(mw(r)),this.parseContainments(gw(r))),this.parseGenericAttributes(e,i),this},gt.prototype.nsTagName=function(e){var t=this.logNamespaceUsed(e.ns);return cw(t,e)},gt.prototype.nsPropertyTagName=function(e){var t=this.logNamespaceUsed(e.ns);return uw(t,e)},gt.prototype.isLocalNs=function(e){return e.uri===this.ns.uri},gt.prototype.nsAttributeName=function(e){var t;if(wn(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)},gt.prototype.parseGenericNsAttributes=function(e){return Object.entries(e).filter(([t,n])=>!t.startsWith("$")&&this.parseNsAttribute(e,t,n)).map(([t,n])=>({name:t,value:n}))},gt.prototype.parseGenericContainments=function(e){var t=e.$body;t&&this.body.push(new Tr().build({type:"String"},t));var n=e.$children;n&&L(n,i=>{this.body.push(new gt(this).build(i))})},gt.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)}},gt.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},gt.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)}})},gt.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 Tr().build(r,o[0]));else if(fd(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=xd(r);L(o,function(u){var l;c?c===_d?l=new gt(t,r):l=new as(t,r,c):l=new gt(t),n.push(l.build(u))})}})},gt.prototype.getNamespaces=function(e){var t=this.namespaces,n=this.parent,i;return t||(i=n&&n.getNamespaces(),e||!i?this.namespaces=t=new ci(i):t=i),t},gt.prototype.logNamespace=function(e,t,n){var i=this.getNamespaces(n),r=e.uri,o=e.prefix,a=i.byUri(r);return(!a||n)&&i.add(e,t),i.mapPrefix(o,r),e},gt.prototype.logNamespaceUsed=function(e,t){var n=this.getNamespaces(t),i=e.prefix,r=e.uri,o,a,s;if(!i&&!r)return{localName:e.localName};if(s=n.defaultUriByPrefix(i),r=r||s||n.uriByPrefix(i),!r)throw new Error("no namespace uri given for prefix <"+i+">");if(e=n.byUri(r),!e&&!i&&(e=this.logNamespace({uri:r},s===r,!0)),!e){for(o=i,a=1;n.uriByPrefix(o);)o=i+"_"+a++;e=this.logNamespace({prefix:o,uri:r},s===r)}return i&&n.mapPrefix(i,r),e},gt.prototype.parseAttributes=function(e){var t=this,n=this.element;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)})},gt.prototype.addTagName=function(e){var t=this.logNamespaceUsed(e);return this.getNamespaces().logUsed(t),Rd(e)},gt.prototype.addAttribute=function(e,t){var n=this.attrs;wn(t)&&(t=dw(t));var i=cd(n,function(o){return o.name.localName===e.localName&&o.name.uri===e.uri&&o.name.prefix===e.prefix}),r={name:e,value:t};i!==-1?n.splice(i,1,r):n.push(r)},gt.prototype.serializeAttributes=function(e){var t=this.attrs,n=this.namespaces;n&&(t=sw(n).concat(t)),L(t,function(i){e.append(" ").append(Rd(i.name)).append('="').append(i.value).append('"')})},gt.prototype.serializeTo=function(e){var t=this.body[0],n=t&&t.constructor!==Tr;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 as(e,t,n){gt.call(this,e,t),this.serialization=n}Sd(as,gt),as.prototype.parseNsAttributes=function(e){var t=gt.prototype.parseNsAttributes.call(this,e).filter(a=>a.name!==this.serialization),n=e.$descriptor;if(n.name===this.propertyDescriptor.type)return t;var i=this.typeNs=this.nsTagName(n);this.getNamespaces().logUsed(this.typeNs);var r=e.$model.getPackage(i.uri),o=r.xml&&r.xml.typePrefix||"";return this.addAttribute(this.nsAttributeName(this.serialization),(i.prefix?i.prefix+":":"")+o+n.ns.localName),t},as.prototype.isLocalNs=function(e){return e.uri===(this.typeNs||this.ns).uri};function yw(){this.value="",this.write=function(e){this.value+=e}}function vw(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 bw(e){e=H({format:!1,preamble:!0},e||{});function t(n,i){var r=i||new yw,o=new vw(r,e.format);e.preamble&&o.append(iw);var a=new gt,s=n.$model;if(a.getNamespaces().mapDefaultPrefixes(_w(s)),a.build(n).serializeTo(o),!i)return r.value}return{toXML:t}}function _w(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 ss(e,t){$n.call(this,e,t)}ss.prototype=Object.create($n.prototype),ss.prototype.fromXML=function(e,t,n){wn(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)},ss.prototype.toXML=function(e,t){var n=new bw(t);return new Promise(function(i,r){try{var o=n.toXML(e);return i({xml:o})}catch(a){return r(a)}})};var xw="BPMN20",ww="http://www.omg.org/spec/BPMN/20100524/MODEL",Ew="bpmn",Sw=[],Rw=[{name:"Interface",superClass:["RootElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"operations",type:"Operation",isMany:!0},{name:"implementationRef",isAttr:!0,type:"String"}]},{name:"Operation",superClass:["BaseElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"inMessageRef",type:"Message",isReference:!0},{name:"outMessageRef",type:"Message",isReference:!0},{name:"errorRef",type:"Error",isMany:!0,isReference:!0},{name:"implementationRef",isAttr:!0,type:"String"}]},{name:"EndPoint",superClass:["RootElement"]},{name:"Auditing",superClass:["BaseElement"]},{name:"GlobalTask",superClass:["CallableElement"],properties:[{name:"resources",type:"ResourceRole",isMany:!0}]},{name:"Monitoring",superClass:["BaseElement"]},{name:"Performer",superClass:["ResourceRole"]},{name:"Process",superClass:["FlowElementsContainer","CallableElement"],properties:[{name:"processType",type:"ProcessType",isAttr:!0},{name:"isClosed",isAttr:!0,type:"Boolean"},{name:"auditing",type:"Auditing"},{name:"monitoring",type:"Monitoring"},{name:"properties",type:"Property",isMany:!0},{name:"laneSets",isMany:!0,replaces:"FlowElementsContainer#laneSets",type:"LaneSet"},{name:"flowElements",isMany:!0,replaces:"FlowElementsContainer#flowElements",type:"FlowElement"},{name:"artifacts",type:"Artifact",isMany:!0},{name:"resources",type:"ResourceRole",isMany:!0},{name:"correlationSubscriptions",type:"CorrelationSubscription",isMany:!0},{name:"supports",type:"Process",isMany:!0,isReference:!0},{name:"definitionalCollaborationRef",type:"Collaboration",isAttr:!0,isReference:!0},{name:"isExecutable",isAttr:!0,type:"Boolean"}]},{name:"LaneSet",superClass:["BaseElement"],properties:[{name:"lanes",type:"Lane",isMany:!0},{name:"name",isAttr:!0,type:"String"}]},{name:"Lane",superClass:["BaseElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"partitionElementRef",type:"BaseElement",isAttr:!0,isReference:!0},{name:"partitionElement",type:"BaseElement"},{name:"flowNodeRef",type:"FlowNode",isMany:!0,isReference:!0},{name:"childLaneSet",type:"LaneSet",xml:{serialize:"xsi:type"}}]},{name:"GlobalManualTask",superClass:["GlobalTask"]},{name:"ManualTask",superClass:["Task"]},{name:"UserTask",superClass:["Task"],properties:[{name:"renderings",type:"Rendering",isMany:!0},{name:"implementation",isAttr:!0,type:"String"}]},{name:"Rendering",superClass:["BaseElement"]},{name:"HumanPerformer",superClass:["Performer"]},{name:"PotentialOwner",superClass:["HumanPerformer"]},{name:"GlobalUserTask",superClass:["GlobalTask"],properties:[{name:"implementation",isAttr:!0,type:"String"},{name:"renderings",type:"Rendering",isMany:!0}]},{name:"Gateway",isAbstract:!0,superClass:["FlowNode"],properties:[{name:"gatewayDirection",type:"GatewayDirection",default:"Unspecified",isAttr:!0}]},{name:"EventBasedGateway",superClass:["Gateway"],properties:[{name:"instantiate",default:!1,isAttr:!0,type:"Boolean"},{name:"eventGatewayType",type:"EventBasedGatewayType",isAttr:!0,default:"Exclusive"}]},{name:"ComplexGateway",superClass:["Gateway"],properties:[{name:"activationCondition",type:"Expression",xml:{serialize:"xsi:type"}},{name:"default",type:"SequenceFlow",isAttr:!0,isReference:!0}]},{name:"ExclusiveGateway",superClass:["Gateway"],properties:[{name:"default",type:"SequenceFlow",isAttr:!0,isReference:!0}]},{name:"InclusiveGateway",superClass:["Gateway"],properties:[{name:"default",type:"SequenceFlow",isAttr:!0,isReference:!0}]},{name:"ParallelGateway",superClass:["Gateway"]},{name:"RootElement",isAbstract:!0,superClass:["BaseElement"]},{name:"Relationship",superClass:["BaseElement"],properties:[{name:"type",isAttr:!0,type:"String"},{name:"direction",type:"RelationshipDirection",isAttr:!0},{name:"source",isMany:!0,isReference:!0,type:"Element"},{name:"target",isMany:!0,isReference:!0,type:"Element"}]},{name:"BaseElement",isAbstract:!0,properties:[{name:"id",isAttr:!0,type:"String",isId:!0},{name:"documentation",type:"Documentation",isMany:!0},{name:"extensionDefinitions",type:"ExtensionDefinition",isMany:!0,isReference:!0},{name:"extensionElements",type:"ExtensionElements"}]},{name:"Extension",properties:[{name:"mustUnderstand",default:!1,isAttr:!0,type:"Boolean"},{name:"definition",type:"ExtensionDefinition",isAttr:!0,isReference:!0}]},{name:"ExtensionDefinition",properties:[{name:"name",isAttr:!0,type:"String"},{name:"extensionAttributeDefinitions",type:"ExtensionAttributeDefinition",isMany:!0}]},{name:"ExtensionAttributeDefinition",properties:[{name:"name",isAttr:!0,type:"String"},{name:"type",isAttr:!0,type:"String"},{name:"isReference",default:!1,isAttr:!0,type:"Boolean"},{name:"extensionDefinition",type:"ExtensionDefinition",isAttr:!0,isReference:!0}]},{name:"ExtensionElements",properties:[{name:"valueRef",isAttr:!0,isReference:!0,type:"Element"},{name:"values",type:"Element",isMany:!0},{name:"extensionAttributeDefinition",type:"ExtensionAttributeDefinition",isAttr:!0,isReference:!0}]},{name:"Documentation",superClass:["BaseElement"],properties:[{name:"text",type:"String",isBody:!0},{name:"textFormat",default:"text/plain",isAttr:!0,type:"String"}]},{name:"Event",isAbstract:!0,superClass:["FlowNode","InteractionNode"],properties:[{name:"properties",type:"Property",isMany:!0}]},{name:"IntermediateCatchEvent",superClass:["CatchEvent"]},{name:"IntermediateThrowEvent",superClass:["ThrowEvent"]},{name:"EndEvent",superClass:["ThrowEvent"]},{name:"StartEvent",superClass:["CatchEvent"],properties:[{name:"isInterrupting",default:!0,isAttr:!0,type:"Boolean"}]},{name:"ThrowEvent",isAbstract:!0,superClass:["Event"],properties:[{name:"dataInputs",type:"DataInput",isMany:!0},{name:"dataInputAssociations",type:"DataInputAssociation",isMany:!0},{name:"inputSet",type:"InputSet"},{name:"eventDefinitions",type:"EventDefinition",isMany:!0},{name:"eventDefinitionRef",type:"EventDefinition",isMany:!0,isReference:!0}]},{name:"CatchEvent",isAbstract:!0,superClass:["Event"],properties:[{name:"parallelMultiple",isAttr:!0,type:"Boolean",default:!1},{name:"dataOutputs",type:"DataOutput",isMany:!0},{name:"dataOutputAssociations",type:"DataOutputAssociation",isMany:!0},{name:"outputSet",type:"OutputSet"},{name:"eventDefinitions",type:"EventDefinition",isMany:!0},{name:"eventDefinitionRef",type:"EventDefinition",isMany:!0,isReference:!0}]},{name:"BoundaryEvent",superClass:["CatchEvent"],properties:[{name:"cancelActivity",default:!0,isAttr:!0,type:"Boolean"},{name:"attachedToRef",type:"Activity",isAttr:!0,isReference:!0}]},{name:"EventDefinition",isAbstract:!0,superClass:["RootElement"]},{name:"CancelEventDefinition",superClass:["EventDefinition"]},{name:"ErrorEventDefinition",superClass:["EventDefinition"],properties:[{name:"errorRef",type:"Error",isAttr:!0,isReference:!0}]},{name:"TerminateEventDefinition",superClass:["EventDefinition"]},{name:"EscalationEventDefinition",superClass:["EventDefinition"],properties:[{name:"escalationRef",type:"Escalation",isAttr:!0,isReference:!0}]},{name:"Escalation",properties:[{name:"structureRef",type:"ItemDefinition",isAttr:!0,isReference:!0},{name:"name",isAttr:!0,type:"String"},{name:"escalationCode",isAttr:!0,type:"String"}],superClass:["RootElement"]},{name:"CompensateEventDefinition",superClass:["EventDefinition"],properties:[{name:"waitForCompletion",isAttr:!0,type:"Boolean",default:!0},{name:"activityRef",type:"Activity",isAttr:!0,isReference:!0}]},{name:"TimerEventDefinition",superClass:["EventDefinition"],properties:[{name:"timeDate",type:"Expression",xml:{serialize:"xsi:type"}},{name:"timeCycle",type:"Expression",xml:{serialize:"xsi:type"}},{name:"timeDuration",type:"Expression",xml:{serialize:"xsi:type"}}]},{name:"LinkEventDefinition",superClass:["EventDefinition"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"target",type:"LinkEventDefinition",isReference:!0},{name:"source",type:"LinkEventDefinition",isMany:!0,isReference:!0}]},{name:"MessageEventDefinition",superClass:["EventDefinition"],properties:[{name:"messageRef",type:"Message",isAttr:!0,isReference:!0},{name:"operationRef",type:"Operation",isReference:!0}]},{name:"ConditionalEventDefinition",superClass:["EventDefinition"],properties:[{name:"condition",type:"Expression",xml:{serialize:"xsi:type"}}]},{name:"SignalEventDefinition",superClass:["EventDefinition"],properties:[{name:"signalRef",type:"Signal",isAttr:!0,isReference:!0}]},{name:"Signal",superClass:["RootElement"],properties:[{name:"structureRef",type:"ItemDefinition",isAttr:!0,isReference:!0},{name:"name",isAttr:!0,type:"String"}]},{name:"ImplicitThrowEvent",superClass:["ThrowEvent"]},{name:"DataState",superClass:["BaseElement"],properties:[{name:"name",isAttr:!0,type:"String"}]},{name:"ItemAwareElement",superClass:["BaseElement"],properties:[{name:"itemSubjectRef",type:"ItemDefinition",isAttr:!0,isReference:!0},{name:"dataState",type:"DataState"}]},{name:"DataAssociation",superClass:["BaseElement"],properties:[{name:"sourceRef",type:"ItemAwareElement",isMany:!0,isReference:!0},{name:"targetRef",type:"ItemAwareElement",isReference:!0},{name:"transformation",type:"FormalExpression",xml:{serialize:"property"}},{name:"assignment",type:"Assignment",isMany:!0}]},{name:"DataInput",superClass:["ItemAwareElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"isCollection",default:!1,isAttr:!0,type:"Boolean"},{name:"inputSetRef",type:"InputSet",isMany:!0,isVirtual:!0,isReference:!0},{name:"inputSetWithOptional",type:"InputSet",isMany:!0,isVirtual:!0,isReference:!0},{name:"inputSetWithWhileExecuting",type:"InputSet",isMany:!0,isVirtual:!0,isReference:!0}]},{name:"DataOutput",superClass:["ItemAwareElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"isCollection",default:!1,isAttr:!0,type:"Boolean"},{name:"outputSetRef",type:"OutputSet",isMany:!0,isVirtual:!0,isReference:!0},{name:"outputSetWithOptional",type:"OutputSet",isMany:!0,isVirtual:!0,isReference:!0},{name:"outputSetWithWhileExecuting",type:"OutputSet",isMany:!0,isVirtual:!0,isReference:!0}]},{name:"InputSet",superClass:["BaseElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"dataInputRefs",type:"DataInput",isMany:!0,isReference:!0},{name:"optionalInputRefs",type:"DataInput",isMany:!0,isReference:!0},{name:"whileExecutingInputRefs",type:"DataInput",isMany:!0,isReference:!0},{name:"outputSetRefs",type:"OutputSet",isMany:!0,isReference:!0}]},{name:"OutputSet",superClass:["BaseElement"],properties:[{name:"dataOutputRefs",type:"DataOutput",isMany:!0,isReference:!0},{name:"name",isAttr:!0,type:"String"},{name:"inputSetRefs",type:"InputSet",isMany:!0,isReference:!0},{name:"optionalOutputRefs",type:"DataOutput",isMany:!0,isReference:!0},{name:"whileExecutingOutputRefs",type:"DataOutput",isMany:!0,isReference:!0}]},{name:"Property",superClass:["ItemAwareElement"],properties:[{name:"name",isAttr:!0,type:"String"}]},{name:"DataInputAssociation",superClass:["DataAssociation"]},{name:"DataOutputAssociation",superClass:["DataAssociation"]},{name:"InputOutputSpecification",superClass:["BaseElement"],properties:[{name:"dataInputs",type:"DataInput",isMany:!0},{name:"dataOutputs",type:"DataOutput",isMany:!0},{name:"inputSets",type:"InputSet",isMany:!0},{name:"outputSets",type:"OutputSet",isMany:!0}]},{name:"DataObject",superClass:["FlowElement","ItemAwareElement"],properties:[{name:"isCollection",default:!1,isAttr:!0,type:"Boolean"}]},{name:"InputOutputBinding",properties:[{name:"inputDataRef",type:"InputSet",isAttr:!0,isReference:!0},{name:"outputDataRef",type:"OutputSet",isAttr:!0,isReference:!0},{name:"operationRef",type:"Operation",isAttr:!0,isReference:!0}]},{name:"Assignment",superClass:["BaseElement"],properties:[{name:"from",type:"Expression",xml:{serialize:"xsi:type"}},{name:"to",type:"Expression",xml:{serialize:"xsi:type"}}]},{name:"DataStore",superClass:["RootElement","ItemAwareElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"capacity",isAttr:!0,type:"Integer"},{name:"isUnlimited",default:!0,isAttr:!0,type:"Boolean"}]},{name:"DataStoreReference",superClass:["ItemAwareElement","FlowElement"],properties:[{name:"dataStoreRef",type:"DataStore",isAttr:!0,isReference:!0}]},{name:"DataObjectReference",superClass:["ItemAwareElement","FlowElement"],properties:[{name:"dataObjectRef",type:"DataObject",isAttr:!0,isReference:!0}]},{name:"ConversationLink",superClass:["BaseElement"],properties:[{name:"sourceRef",type:"InteractionNode",isAttr:!0,isReference:!0},{name:"targetRef",type:"InteractionNode",isAttr:!0,isReference:!0},{name:"name",isAttr:!0,type:"String"}]},{name:"ConversationAssociation",superClass:["BaseElement"],properties:[{name:"innerConversationNodeRef",type:"ConversationNode",isAttr:!0,isReference:!0},{name:"outerConversationNodeRef",type:"ConversationNode",isAttr:!0,isReference:!0}]},{name:"CallConversation",superClass:["ConversationNode"],properties:[{name:"calledCollaborationRef",type:"Collaboration",isAttr:!0,isReference:!0},{name:"participantAssociations",type:"ParticipantAssociation",isMany:!0}]},{name:"Conversation",superClass:["ConversationNode"]},{name:"SubConversation",superClass:["ConversationNode"],properties:[{name:"conversationNodes",type:"ConversationNode",isMany:!0}]},{name:"ConversationNode",isAbstract:!0,superClass:["InteractionNode","BaseElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"participantRef",type:"Participant",isMany:!0,isReference:!0},{name:"messageFlowRefs",type:"MessageFlow",isMany:!0,isReference:!0},{name:"correlationKeys",type:"CorrelationKey",isMany:!0}]},{name:"GlobalConversation",superClass:["Collaboration"]},{name:"PartnerEntity",superClass:["RootElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"participantRef",type:"Participant",isMany:!0,isReference:!0}]},{name:"PartnerRole",superClass:["RootElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"participantRef",type:"Participant",isMany:!0,isReference:!0}]},{name:"CorrelationProperty",superClass:["RootElement"],properties:[{name:"correlationPropertyRetrievalExpression",type:"CorrelationPropertyRetrievalExpression",isMany:!0},{name:"name",isAttr:!0,type:"String"},{name:"type",type:"ItemDefinition",isAttr:!0,isReference:!0}]},{name:"Error",superClass:["RootElement"],properties:[{name:"structureRef",type:"ItemDefinition",isAttr:!0,isReference:!0},{name:"name",isAttr:!0,type:"String"},{name:"errorCode",isAttr:!0,type:"String"}]},{name:"CorrelationKey",superClass:["BaseElement"],properties:[{name:"correlationPropertyRef",type:"CorrelationProperty",isMany:!0,isReference:!0},{name:"name",isAttr:!0,type:"String"}]},{name:"Expression",superClass:["BaseElement"],isAbstract:!1,properties:[{name:"body",isBody:!0,type:"String"}]},{name:"FormalExpression",superClass:["Expression"],properties:[{name:"language",isAttr:!0,type:"String"},{name:"evaluatesToTypeRef",type:"ItemDefinition",isAttr:!0,isReference:!0}]},{name:"Message",superClass:["RootElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"itemRef",type:"ItemDefinition",isAttr:!0,isReference:!0}]},{name:"ItemDefinition",superClass:["RootElement"],properties:[{name:"itemKind",type:"ItemKind",isAttr:!0},{name:"structureRef",isAttr:!0,type:"String"},{name:"isCollection",default:!1,isAttr:!0,type:"Boolean"},{name:"import",type:"Import",isAttr:!0,isReference:!0}]},{name:"FlowElement",isAbstract:!0,superClass:["BaseElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"auditing",type:"Auditing"},{name:"monitoring",type:"Monitoring"},{name:"categoryValueRef",type:"CategoryValue",isMany:!0,isReference:!0}]},{name:"SequenceFlow",superClass:["FlowElement"],properties:[{name:"isImmediate",isAttr:!0,type:"Boolean"},{name:"conditionExpression",type:"Expression",xml:{serialize:"xsi:type"}},{name:"sourceRef",type:"FlowNode",isAttr:!0,isReference:!0},{name:"targetRef",type:"FlowNode",isAttr:!0,isReference:!0}]},{name:"FlowElementsContainer",isAbstract:!0,superClass:["BaseElement"],properties:[{name:"laneSets",type:"LaneSet",isMany:!0},{name:"flowElements",type:"FlowElement",isMany:!0}]},{name:"CallableElement",isAbstract:!0,superClass:["RootElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"ioSpecification",type:"InputOutputSpecification",xml:{serialize:"property"}},{name:"supportedInterfaceRef",type:"Interface",isMany:!0,isReference:!0},{name:"ioBinding",type:"InputOutputBinding",isMany:!0,xml:{serialize:"property"}}]},{name:"FlowNode",isAbstract:!0,superClass:["FlowElement"],properties:[{name:"incoming",type:"SequenceFlow",isMany:!0,isReference:!0},{name:"outgoing",type:"SequenceFlow",isMany:!0,isReference:!0},{name:"lanes",type:"Lane",isMany:!0,isVirtual:!0,isReference:!0}]},{name:"CorrelationPropertyRetrievalExpression",superClass:["BaseElement"],properties:[{name:"messagePath",type:"FormalExpression"},{name:"messageRef",type:"Message",isAttr:!0,isReference:!0}]},{name:"CorrelationPropertyBinding",superClass:["BaseElement"],properties:[{name:"dataPath",type:"FormalExpression"},{name:"correlationPropertyRef",type:"CorrelationProperty",isAttr:!0,isReference:!0}]},{name:"Resource",superClass:["RootElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"resourceParameters",type:"ResourceParameter",isMany:!0}]},{name:"ResourceParameter",superClass:["BaseElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"isRequired",isAttr:!0,type:"Boolean"},{name:"type",type:"ItemDefinition",isAttr:!0,isReference:!0}]},{name:"CorrelationSubscription",superClass:["BaseElement"],properties:[{name:"correlationKeyRef",type:"CorrelationKey",isAttr:!0,isReference:!0},{name:"correlationPropertyBinding",type:"CorrelationPropertyBinding",isMany:!0}]},{name:"MessageFlow",superClass:["BaseElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"sourceRef",type:"InteractionNode",isAttr:!0,isReference:!0},{name:"targetRef",type:"InteractionNode",isAttr:!0,isReference:!0},{name:"messageRef",type:"Message",isAttr:!0,isReference:!0}]},{name:"MessageFlowAssociation",superClass:["BaseElement"],properties:[{name:"innerMessageFlowRef",type:"MessageFlow",isAttr:!0,isReference:!0},{name:"outerMessageFlowRef",type:"MessageFlow",isAttr:!0,isReference:!0}]},{name:"InteractionNode",isAbstract:!0,properties:[{name:"incomingConversationLinks",type:"ConversationLink",isMany:!0,isVirtual:!0,isReference:!0},{name:"outgoingConversationLinks",type:"ConversationLink",isMany:!0,isVirtual:!0,isReference:!0}]},{name:"Participant",superClass:["InteractionNode","BaseElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"interfaceRef",type:"Interface",isMany:!0,isReference:!0},{name:"participantMultiplicity",type:"ParticipantMultiplicity"},{name:"endPointRefs",type:"EndPoint",isMany:!0,isReference:!0},{name:"processRef",type:"Process",isAttr:!0,isReference:!0}]},{name:"ParticipantAssociation",superClass:["BaseElement"],properties:[{name:"innerParticipantRef",type:"Participant",isAttr:!0,isReference:!0},{name:"outerParticipantRef",type:"Participant",isAttr:!0,isReference:!0}]},{name:"ParticipantMultiplicity",properties:[{name:"minimum",default:0,isAttr:!0,type:"Integer"},{name:"maximum",default:1,isAttr:!0,type:"Integer"}],superClass:["BaseElement"]},{name:"Collaboration",superClass:["RootElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"isClosed",isAttr:!0,type:"Boolean"},{name:"participants",type:"Participant",isMany:!0},{name:"messageFlows",type:"MessageFlow",isMany:!0},{name:"artifacts",type:"Artifact",isMany:!0},{name:"conversations",type:"ConversationNode",isMany:!0},{name:"conversationAssociations",type:"ConversationAssociation"},{name:"participantAssociations",type:"ParticipantAssociation",isMany:!0},{name:"messageFlowAssociations",type:"MessageFlowAssociation",isMany:!0},{name:"correlationKeys",type:"CorrelationKey",isMany:!0},{name:"choreographyRef",type:"Choreography",isMany:!0,isReference:!0},{name:"conversationLinks",type:"ConversationLink",isMany:!0}]},{name:"ChoreographyActivity",isAbstract:!0,superClass:["FlowNode"],properties:[{name:"participantRef",type:"Participant",isMany:!0,isReference:!0},{name:"initiatingParticipantRef",type:"Participant",isAttr:!0,isReference:!0},{name:"correlationKeys",type:"CorrelationKey",isMany:!0},{name:"loopType",type:"ChoreographyLoopType",default:"None",isAttr:!0}]},{name:"CallChoreography",superClass:["ChoreographyActivity"],properties:[{name:"calledChoreographyRef",type:"Choreography",isAttr:!0,isReference:!0},{name:"participantAssociations",type:"ParticipantAssociation",isMany:!0}]},{name:"SubChoreography",superClass:["ChoreographyActivity","FlowElementsContainer"],properties:[{name:"artifacts",type:"Artifact",isMany:!0}]},{name:"ChoreographyTask",superClass:["ChoreographyActivity"],properties:[{name:"messageFlowRef",type:"MessageFlow",isMany:!0,isReference:!0}]},{name:"Choreography",superClass:["Collaboration","FlowElementsContainer"]},{name:"GlobalChoreographyTask",superClass:["Choreography"],properties:[{name:"initiatingParticipantRef",type:"Participant",isAttr:!0,isReference:!0}]},{name:"TextAnnotation",superClass:["Artifact"],properties:[{name:"text",type:"String"},{name:"textFormat",default:"text/plain",isAttr:!0,type:"String"}]},{name:"Group",superClass:["Artifact"],properties:[{name:"categoryValueRef",type:"CategoryValue",isAttr:!0,isReference:!0}]},{name:"Association",superClass:["Artifact"],properties:[{name:"associationDirection",type:"AssociationDirection",isAttr:!0},{name:"sourceRef",type:"BaseElement",isAttr:!0,isReference:!0},{name:"targetRef",type:"BaseElement",isAttr:!0,isReference:!0}]},{name:"Category",superClass:["RootElement"],properties:[{name:"categoryValue",type:"CategoryValue",isMany:!0},{name:"name",isAttr:!0,type:"String"}]},{name:"Artifact",isAbstract:!0,superClass:["BaseElement"]},{name:"CategoryValue",superClass:["BaseElement"],properties:[{name:"categorizedFlowElements",type:"FlowElement",isMany:!0,isVirtual:!0,isReference:!0},{name:"value",isAttr:!0,type:"String"}]},{name:"Activity",isAbstract:!0,superClass:["FlowNode"],properties:[{name:"isForCompensation",default:!1,isAttr:!0,type:"Boolean"},{name:"default",type:"SequenceFlow",isAttr:!0,isReference:!0},{name:"ioSpecification",type:"InputOutputSpecification",xml:{serialize:"property"}},{name:"boundaryEventRefs",type:"BoundaryEvent",isMany:!0,isReference:!0},{name:"properties",type:"Property",isMany:!0},{name:"dataInputAssociations",type:"DataInputAssociation",isMany:!0},{name:"dataOutputAssociations",type:"DataOutputAssociation",isMany:!0},{name:"startQuantity",default:1,isAttr:!0,type:"Integer"},{name:"resources",type:"ResourceRole",isMany:!0},{name:"completionQuantity",default:1,isAttr:!0,type:"Integer"},{name:"loopCharacteristics",type:"LoopCharacteristics"}]},{name:"ServiceTask",superClass:["Task"],properties:[{name:"implementation",isAttr:!0,type:"String"},{name:"operationRef",type:"Operation",isAttr:!0,isReference:!0}]},{name:"SubProcess",superClass:["Activity","FlowElementsContainer","InteractionNode"],properties:[{name:"triggeredByEvent",default:!1,isAttr:!0,type:"Boolean"},{name:"artifacts",type:"Artifact",isMany:!0}]},{name:"LoopCharacteristics",isAbstract:!0,superClass:["BaseElement"]},{name:"MultiInstanceLoopCharacteristics",superClass:["LoopCharacteristics"],properties:[{name:"isSequential",default:!1,isAttr:!0,type:"Boolean"},{name:"behavior",type:"MultiInstanceBehavior",default:"All",isAttr:!0},{name:"loopCardinality",type:"Expression",xml:{serialize:"xsi:type"}},{name:"loopDataInputRef",type:"ItemAwareElement",isReference:!0},{name:"loopDataOutputRef",type:"ItemAwareElement",isReference:!0},{name:"inputDataItem",type:"DataInput",xml:{serialize:"property"}},{name:"outputDataItem",type:"DataOutput",xml:{serialize:"property"}},{name:"complexBehaviorDefinition",type:"ComplexBehaviorDefinition",isMany:!0},{name:"completionCondition",type:"Expression",xml:{serialize:"xsi:type"}},{name:"oneBehaviorEventRef",type:"EventDefinition",isAttr:!0,isReference:!0},{name:"noneBehaviorEventRef",type:"EventDefinition",isAttr:!0,isReference:!0}]},{name:"StandardLoopCharacteristics",superClass:["LoopCharacteristics"],properties:[{name:"testBefore",default:!1,isAttr:!0,type:"Boolean"},{name:"loopCondition",type:"Expression",xml:{serialize:"xsi:type"}},{name:"loopMaximum",type:"Integer",isAttr:!0}]},{name:"CallActivity",superClass:["Activity","InteractionNode"],properties:[{name:"calledElement",type:"String",isAttr:!0}]},{name:"Task",superClass:["Activity","InteractionNode"]},{name:"SendTask",superClass:["Task"],properties:[{name:"implementation",isAttr:!0,type:"String"},{name:"operationRef",type:"Operation",isAttr:!0,isReference:!0},{name:"messageRef",type:"Message",isAttr:!0,isReference:!0}]},{name:"ReceiveTask",superClass:["Task"],properties:[{name:"implementation",isAttr:!0,type:"String"},{name:"instantiate",default:!1,isAttr:!0,type:"Boolean"},{name:"operationRef",type:"Operation",isAttr:!0,isReference:!0},{name:"messageRef",type:"Message",isAttr:!0,isReference:!0}]},{name:"ScriptTask",superClass:["Task"],properties:[{name:"scriptFormat",isAttr:!0,type:"String"},{name:"script",type:"String"}]},{name:"BusinessRuleTask",superClass:["Task"],properties:[{name:"implementation",isAttr:!0,type:"String"}]},{name:"AdHocSubProcess",superClass:["SubProcess"],properties:[{name:"completionCondition",type:"Expression",xml:{serialize:"xsi:type"}},{name:"ordering",type:"AdHocOrdering",isAttr:!0},{name:"cancelRemainingInstances",default:!0,isAttr:!0,type:"Boolean"}]},{name:"Transaction",superClass:["SubProcess"],properties:[{name:"protocol",isAttr:!0,type:"String"},{name:"method",isAttr:!0,type:"String"}]},{name:"GlobalScriptTask",superClass:["GlobalTask"],properties:[{name:"scriptLanguage",isAttr:!0,type:"String"},{name:"script",isAttr:!0,type:"String"}]},{name:"GlobalBusinessRuleTask",superClass:["GlobalTask"],properties:[{name:"implementation",isAttr:!0,type:"String"}]},{name:"ComplexBehaviorDefinition",superClass:["BaseElement"],properties:[{name:"condition",type:"FormalExpression"},{name:"event",type:"ImplicitThrowEvent"}]},{name:"ResourceRole",superClass:["BaseElement"],properties:[{name:"resourceRef",type:"Resource",isReference:!0},{name:"resourceParameterBindings",type:"ResourceParameterBinding",isMany:!0},{name:"resourceAssignmentExpression",type:"ResourceAssignmentExpression"},{name:"name",isAttr:!0,type:"String"}]},{name:"ResourceParameterBinding",properties:[{name:"expression",type:"Expression",xml:{serialize:"xsi:type"}},{name:"parameterRef",type:"ResourceParameter",isAttr:!0,isReference:!0}],superClass:["BaseElement"]},{name:"ResourceAssignmentExpression",properties:[{name:"expression",type:"Expression",xml:{serialize:"xsi:type"}}],superClass:["BaseElement"]},{name:"Import",properties:[{name:"importType",isAttr:!0,type:"String"},{name:"location",isAttr:!0,type:"String"},{name:"namespace",isAttr:!0,type:"String"}]},{name:"Definitions",superClass:["BaseElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"targetNamespace",isAttr:!0,type:"String"},{name:"expressionLanguage",default:"http://www.w3.org/1999/XPath",isAttr:!0,type:"String"},{name:"typeLanguage",default:"http://www.w3.org/2001/XMLSchema",isAttr:!0,type:"String"},{name:"imports",type:"Import",isMany:!0},{name:"extensions",type:"Extension",isMany:!0},{name:"rootElements",type:"RootElement",isMany:!0},{name:"diagrams",isMany:!0,type:"bpmndi:BPMNDiagram"},{name:"exporter",isAttr:!0,type:"String"},{name:"relationships",type:"Relationship",isMany:!0},{name:"exporterVersion",isAttr:!0,type:"String"}]}],Cw=[{name:"ProcessType",literalValues:[{name:"None"},{name:"Public"},{name:"Private"}]},{name:"GatewayDirection",literalValues:[{name:"Unspecified"},{name:"Converging"},{name:"Diverging"},{name:"Mixed"}]},{name:"EventBasedGatewayType",literalValues:[{name:"Parallel"},{name:"Exclusive"}]},{name:"RelationshipDirection",literalValues:[{name:"None"},{name:"Forward"},{name:"Backward"},{name:"Both"}]},{name:"ItemKind",literalValues:[{name:"Physical"},{name:"Information"}]},{name:"ChoreographyLoopType",literalValues:[{name:"None"},{name:"Standard"},{name:"MultiInstanceSequential"},{name:"MultiInstanceParallel"}]},{name:"AssociationDirection",literalValues:[{name:"None"},{name:"One"},{name:"Both"}]},{name:"MultiInstanceBehavior",literalValues:[{name:"None"},{name:"One"},{name:"All"},{name:"Complex"}]},{name:"AdHocOrdering",literalValues:[{name:"Parallel"},{name:"Sequential"}]}],Pw={tagAlias:"lowerCase",typePrefix:"t"},Aw={name:xw,uri:ww,prefix:Ew,associations:Sw,types:Rw,enumerations:Cw,xml:Pw},Tw="BPMNDI",Mw="http://www.omg.org/spec/BPMN/20100524/DI",kw="bpmndi",Ow=[{name:"BPMNDiagram",properties:[{name:"plane",type:"BPMNPlane",redefines:"di:Diagram#rootElement"},{name:"labelStyle",type:"BPMNLabelStyle",isMany:!0}],superClass:["di:Diagram"]},{name:"BPMNPlane",properties:[{name:"bpmnElement",isAttr:!0,isReference:!0,type:"bpmn:BaseElement",redefines:"di:DiagramElement#modelElement"}],superClass:["di:Plane"]},{name:"BPMNShape",properties:[{name:"bpmnElement",isAttr:!0,isReference:!0,type:"bpmn:BaseElement",redefines:"di:DiagramElement#modelElement"},{name:"isHorizontal",isAttr:!0,type:"Boolean"},{name:"isExpanded",isAttr:!0,type:"Boolean"},{name:"isMarkerVisible",isAttr:!0,type:"Boolean"},{name:"label",type:"BPMNLabel"},{name:"isMessageVisible",isAttr:!0,type:"Boolean"},{name:"participantBandKind",type:"ParticipantBandKind",isAttr:!0},{name:"choreographyActivityShape",type:"BPMNShape",isAttr:!0,isReference:!0}],superClass:["di:LabeledShape"]},{name:"BPMNEdge",properties:[{name:"label",type:"BPMNLabel"},{name:"bpmnElement",isAttr:!0,isReference:!0,type:"bpmn:BaseElement",redefines:"di:DiagramElement#modelElement"},{name:"sourceElement",isAttr:!0,isReference:!0,type:"di:DiagramElement",redefines:"di:Edge#source"},{name:"targetElement",isAttr:!0,isReference:!0,type:"di:DiagramElement",redefines:"di:Edge#target"},{name:"messageVisibleKind",type:"MessageVisibleKind",isAttr:!0,default:"initiating"}],superClass:["di:LabeledEdge"]},{name:"BPMNLabel",properties:[{name:"labelStyle",type:"BPMNLabelStyle",isAttr:!0,isReference:!0,redefines:"di:DiagramElement#style"}],superClass:["di:Label"]},{name:"BPMNLabelStyle",properties:[{name:"font",type:"dc:Font"}],superClass:["di:Style"]}],Dw=[{name:"ParticipantBandKind",literalValues:[{name:"top_initiating"},{name:"middle_initiating"},{name:"bottom_initiating"},{name:"top_non_initiating"},{name:"middle_non_initiating"},{name:"bottom_non_initiating"}]},{name:"MessageVisibleKind",literalValues:[{name:"initiating"},{name:"non_initiating"}]}],Lw=[],Iw={name:Tw,uri:Mw,prefix:kw,types:Ow,enumerations:Dw,associations:Lw},Nw="DC",Bw="http://www.omg.org/spec/DD/20100524/DC",$w="dc",jw=[{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}]}],Fw=[],Hw={name:Nw,uri:Bw,prefix:$w,types:jw,associations:Fw},zw="DI",Gw="http://www.omg.org/spec/DD/20100524/DI",Vw="di",Ww=[{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"}]}],Uw=[],qw={tagAlias:"lowerCase"},Yw={name:zw,uri:Gw,prefix:Vw,types:Ww,associations:Uw,xml:qw},Kw="bpmn.io colors for BPMN",Xw="http://bpmn.io/schema/bpmn/biocolor/1.0",Zw="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"}]}],Jw=[],eE=[],tE={name:Kw,uri:Xw,prefix:Zw,types:Qw,enumerations:Jw,associations:eE},nE="BPMN in Color",iE="http://www.omg.org/spec/BPMN/non-normative/color/1.0",rE="color",oE=[{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"}]}],aE=[],sE=[],cE={name:nE,uri:iE,prefix:rE,types:oE,enumerations:aE,associations:sE};const uE={bpmn:Aw,bpmndi:Iw,dc:Hw,di:Yw,bioc:tE,color:cE};function Pd(e,t){const n=H({},uE,e);return new ss(n,t)}const lE={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"}},pE="http://www.omg.org/spec/BPMN/non-normative/extensions/i18n/1.0",Ad="i18n",cs={[Ad]:lE,[Au]:id};function Td(){return Pd(cs)}const Md=Td();async function Uu(e){const{rootElement:t,warnings:n}=await Md.fromXML(e,"bpmn:Definitions");return{definitions:t,warnings:n}}async function fE(e){const{xml:t}=await Md.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},dE=/[ᄀ-ᇿ -〿぀-ヿ㐀-鿿가-힯＀-⦆]/;function hE(e){const t=ro;return dE.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*hE(i);return n}function kd(e=globalThis,{textMeasurement:t="approximate"}={}){if(!(e!=null&&e.SVGElement))throw new Error("installHeadlessBpmnDom: DOM 전역이 없다 — jsdom window 를 전역에 올린 뒤 호출할 것");t==="approximate"&&mE(e),gE(e),yE(e),vE(e)}function mE(e){var i;const t=(i=e.HTMLCanvasElement)==null?void 0:i.prototype;if(!t||t.__headlessTextMeasurement)return;t.__headlessTextMeasurement=!0;const n={font:"12px sans-serif",letterSpacing:"0px",measureText(r){var a;const o=Number.parseFloat(((a=String(n.font).match(/(\d+(?:\.\d+)?)px/))==null?void 0:a[1])??"12");return{width:oo(r,o),fontBoundingBoxAscent:o*ro.ascentEm,fontBoundingBoxDescent:o*ro.descentEm,actualBoundingBoxAscent:o*ro.ascentEm,actualBoundingBoxDescent:o*ro.descentEm}}};t.getContext=()=>n}function gE(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 yE(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 vE(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 us=new Set(["bpmn:Participant","bpmn:Lane","bpmn:Group","bpmn:SubProcess","bpmn:AdHocSubProcess","bpmn:Transaction"]),bE=1,Yu=new Set(["bpmn:TextAnnotation","bpmn:DataStoreReference","bpmn:DataObjectReference","bpmn:DataInput","bpmn:DataOutput"]),_E=2;function ui(e){switch(e.kind){case"label-over-line":return`L|${e.edge}|${e.line}`;case"edge-crosses-shape":return`x|${e.edge}|${e.shape}`;case"shape-overlap":return`o|${e.shapes[0]}|${e.shapes[1]}`;case"shape-outside-container":return`c|${e.shape}|${e.container}`;case"edge-overlap-opposite":return`p|${e.edges[0]}|${e.edges[1]}`;case"edge-overlap-mixed":return`m|${e.edges[0]}|${e.edges[1]}`;case"edge-overlap-unrelated":return`u|${e.edges[0]}|${e.edges[1]}`;case"label-on-shared-segment":return`l|${e.edge}|${e.other}`;case"annotation-over-label":return`a|${e.annotation}|${e.label}`;case"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 Od=20,ls=5,Dd=3,xE=8,Ld=12,wE=Ld*1.2;function Ku(e,t){const n=t.split(/\r?\n/),i=Math.max(...n.map(o=>oo(o,Ld))),r=n.length*wE;return{x:e.x+e.width/2-i/2,y:e.y+e.height/2-r/2,width:i,height:r}}const Id=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 Yo(e,t){let n=null;const i=e.type!==t.type,o=!!(e.source&&e.target&&t.source&&t.target)&&e.source!==t.source&&e.source!==t.target&&e.target!==t.source&&e.target!==t.target;for(const a of fn(e))for(const s of fn(t)){if(a.axis!==s.axis||Math.abs(a.at-s.at)>Id)continue;const c=a.dir!==s.dir?"opposite":i?"mixed":o?"unrelated":null;if(!c)continue;const u=Math.min(a.hi,s.hi)-Math.max(a.lo,s.lo);u>=Od&&(!n||u>n.length)&&(n={axis:a.axis,length:u,kind:c})}return n}function Xu(e){return e.kind==="edge-overlap-opposite"||e.kind==="edge-overlap-mixed"||e.kind==="edge-overlap-unrelated"}function Nd(e,t){const n=Yo(e,t);return n&&n.kind==="opposite"?{axis:n.axis,length:n.length}:null}function EE(e,t){let n=0;for(const i of t)i.id!==e.id&&Nd(e,i)&&n++;return n}function Jn(e,t){let n=0;for(const i of t)i.id!==e.id&&Yo(e,i)&&n++;return n}const Bd=15,$d=20;function SE(e,t){const n=t.axis==="v"?[e.x,e.x+e.width]:[e.y,e.y+e.height];if(t.at<n[0]-$d||t.at>n[1]+$d)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 Zu=20;function ps(e,t){const n=[];for(const i of t){if(i.axis!==e.axis||Math.abs(i.at-e.at)>Id)continue;const r=Math.max(e.lo,i.lo),o=Math.min(e.hi,i.hi);o-r<Od||n.push([r-Zu,o+Zu])}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=SE(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 RE=1,CE=(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 PE(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 Qu(e,t,n){return e.x+n<t.x+t.width-n&&t.x+n<e.x+e.width-n&&e.y+n<t.y+t.height-n&&t.y+n<e.y+e.height-n}const AE=(e,t)=>e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height,ao=1;function Pi(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 Ko(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 jd(e,t){const n=e.label;if(!n)return null;if(fn(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(fn(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(Ko(i).some(r=>Pi(n,r)))return i.id;return null}function gn(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(PE(e.waypoints[o],e.waypoints[o+1],r,_E)){i.push(r);break}}return i}function TE(e,t,n,i){const r=(u,l,p)=>(l.x-u.x)*(p.y-u.y)-(l.y-u.y)*(p.x-u.x),o=r(n,i,e),a=r(n,i,t),s=r(e,t,n),c=r(e,t,i);return o*a<0&&s*c<0}const Fd=(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||Fd(e,i))continue;let r=!1;for(let o=0;o+1<e.waypoints.length&&!r;o++)for(let a=0;a+1<i.waypoints.length&&!r;a++)TE(e.waypoints[o],e.waypoints[o+1],i.waypoints[a],i.waypoints[a+1])&&(r=!0);r&&n++}return n}function ei(e,t){let n=0;for(const i of t)i.id===e.id||Fd(e,i)||ds(e,[i])>0&&(n+=i.type===e.type?2:1);return n}function Hd(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 Ju(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 zd(e){const t=Ju(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:ME(e)}}function ME(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 Gd(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 Vd(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 Wd=e=>e?{members:e}:{},ti=e=>e.shapes.filter(t=>!t.container);function kE(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 Ud(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=>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(Ko(i).some(r=>Pi(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 li(e){const t=[],n=e.shapes.filter(h=>!h.container);for(const h of e.edges)for(const m of gn(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 w=i[h],y=i[m];if(!Qu(w,y,bE))continue;const _=w.id<y.id?[w.id,y.id]:[y.id,w.id];t.push({kind:"shape-overlap",shapes:_,identical:AE(w,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 w=r[h],y=r[m],_=Math.min(w.x+w.width,y.x+y.width)-Math.max(w.x,y.x),S=Math.min(w.y+w.height,y.y+y.height)-Math.max(w.y,y.y);if(_<=ls||S<=ls)continue;const P=w.id<y.id?[w.id,y.id]:[y.id,w.id],C=new Set(y.members);if(w.members.some(T=>C.has(T))){const T=Gd(e,r,{x:Math.max(w.x,y.x),y:Math.max(w.y,y.y),right:Math.min(w.x+w.width,y.x+y.width),bottom:Math.min(w.y+w.height,y.y+y.height)});T.length&&t.push({kind:"group-overlap-unreadable",reason:"orphan",groups:P,shapes:T});continue}const D=w.x<=y.x&&w.y<=y.y&&w.x+w.width>=y.x+y.width&&w.y+w.height>=y.y+y.height?w.id:y.x<=w.x&&y.y<=w.y&&y.x+y.width>=w.x+w.width&&y.y+y.height>=w.y+w.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 w=new Set(h.members),y=m.filter(_=>!w.has(_.id));y.some(_=>o.has(_.id))&&(y.length*2<m.length||t.push({kind:"group-overlap-unreadable",reason:"minority",group:h.id,shapes:y.map(_=>_.id).sort()}))}for(const h of r){const m=new Set(a(h).map(C=>C.id)),w=new Set(h.members),y=new Set([...m].filter(C=>!w.has(C)&&o.has(C)));if(!y.size)continue;let _=!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)?_=!0:D&&!T&&!m.has(C.target)?S=!0:D&&T&&(P=!0)}_&&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 w=m+1;w<s.length;w++){const y=[s[h],s[m],s[w]],_={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(_.right-_.x<=ls||_.bottom-_.y<=ls)continue;const S=Gd(e,[],_);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 w=[["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,_,S,P,C]of w){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<_&&_<k))continue;const O=Math.min(_-N,k-_);O<xE||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 w=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,_=[["top",h.y,m.y,w],["bottom",h.y+h.height,m.y+m.height,w],["left",h.x,m.x,y],["right",h.x+h.width,m.x+m.width,y]];for(const[S,P,C,D]of _)D&&Math.abs(P-C)<=Dd&&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 w=u[h],y=u[m],_=w.x<y.x+y.width&&y.x<w.x+w.width,S=w.y<y.y+y.height&&y.y<w.y+w.height,P=[["x",w.x+w.width,y.x,S],["x",y.x+y.width,w.x,S],["y",w.y+w.height,y.y,_],["y",y.y+y.height,w.y,_]];for(const[C,D,T,N]of P)if(N&&Math.abs(D-T)<=Dd){t.push({kind:"group-on-group-boundary",groups:w.id<y.id?[w.id,y.id]:[y.id,w.id],axis:C});break}}for(let h=0;h<e.edges.length;h++)for(let m=h+1;m<e.edges.length;m++){const w=e.edges[h],y=e.edges[m],_=Yo(w,y);if(!_)continue;const S=w.id<y.id?[w.id,y.id]:[y.id,w.id];t.push({kind:_.kind==="opposite"?"edge-overlap-opposite":_.kind==="mixed"?"edge-overlap-mixed":"edge-overlap-unrelated",edges:S,axis:_.axis,length:Math.round(_.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=jd(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=Ud(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:w}of so(e))m===h.id||f.has(m)||Qu(h.label,w,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:w}of d)m!==h.id&&Qu(h,w,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??kE(h,e,g);if(!m)continue;const w=g.get(m);!w||!w.container||CE(w,h,RE)||t.push({kind:"shape-outside-container",shape:h.id,container:w.id})}return t.sort((h,m)=>ui(h).localeCompare(ui(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 OE(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 DE(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 LE(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(us.has(i)&&i!=="bpmn:Lane"&&i!=="bpmn:Group")return Ai(n)}function qd(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),w=typeof(m==null?void 0:m.id)=="string"?m.id:void 0;if(!w)continue;const y=typeof(m==null?void 0:m.$type)=="string"?m.$type:"",_=ht(h.bounds);if(_){const P=h.isExpanded===!1&&y!=="bpmn:Participant",C=ht((u=ht(h.label))==null?void 0:u.bounds),D={id:w,type:y,x:St(_.x),y:St(_.y),width:St(_.width),height:St(_.height),container:us.has(y)&&!P,attached:(m==null?void 0:m.attachedToRef)!==void 0,...m?{parent:LE(m,r)}:{},...C?{label:{x:St(C.x),y:St(C.y),width:St(C.width),height:St(C.height)}}:{},...y==="bpmn:Group"?Wd(Vd(m)):{}},T=h.isHorizontal!==!1,N=typeof(m==null?void 0:m.name)=="string"?m.name:"";o.has(w)&&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:w,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:OE(m),...DE(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 Yd(e){return li(qd(e))}async function IE(e){const{definitions:t,warnings:n}=await Uu(e);return{findings:Yd(t),warnings:n}}function mt(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),w=Ai(o.target);n.push({id:o.id,type:a,waypoints:s.map(y=>({x:St(y.x),y:St(y.y)})),endpoints:[m,w].filter(y=>!!y),...m&&w?{source:m,target:w}:{},...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&&us.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:us.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"?Wd(Vd(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 NE={"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 BE(e,t){const n=NE[e];return n||(e==="label"||e.startsWith("bpmndi:")?"other":e.startsWith("bpmn:")&&!("waypoints"in t&&t.waypoints)?"flowNode":"other")}function Kd(e){let t=e.parent;for(;t;){if(t.type==="bpmn:Participant")return t.id;t=t.parent}}function Xd(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 BE(i.type,i)},lanesOf:n=>t().filter(i=>i.type==="bpmn:Lane"&&Kd(i)===n).sort((i,r)=>i.y-r.y).map(i=>i.id),participantOf:n=>{const i=e.get(n);return i?Kd(i):void 0},endpointsOf:n=>{var r,o;const i=e.get(n);if(!(!i||i.type==="label")&&"waypoints"in i)return{source:(r=i.source)==null?void 0:r.id,target:(o=i.target)==null?void 0:o.id}}}}const el=20,$E=4,pt=(e,t)=>Math.abs(e-t)<.5;function tl(e,t,n,i=el){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 Zd(e,t,n,i=el){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 Qd(e,t,n=el){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 nl(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 Jd=30,jE=[0,-25,25,-40,40];function FE(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+Jd:s-Jd,u=a?i.y+i.height:i.y,l=n.x+n.width/2,p=i.x+i.width/2;return jE.map(f=>[{x:l,y:s},{x:l,y:c},{x:p+f,y:c},{x:p+f,y:u}])}const eh=(e,t,n)=>[...e.slice(0,t+1),...n,...e.slice(t+1)],co=(e,t,n)=>gn({...e,waypoints:t},n).length;function th(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 nl(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=FE(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)&&gn({...e,waypoints:d},[y]).length>0),h=g.length>=2?Zd(d[0],d[1],g):null,w=(h?h.map(y=>[d[0],...y,d[1]]):g.length===1?(tl(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,_)=>Number(l(_))-Number(l(y)));if(w.length)return w.find(y=>!c(y))??w[0]}}}for(let p=0;p+1<r.length;p++){const f=r[p],d=r[p+1],g=t.filter(w=>!e.endpoints.includes(w.id)&&gn({...e,waypoints:[f,d]},[w]).length>0);if(g.length<2)continue;const h=Zd(f,d,g);if(!h)continue;const m=h.map(w=>eh(r,p,w)).filter(w=>co(e,w,t)===0).sort((w,y)=>Number(l(y))-Number(l(w)));if(m.length)return m.find(w=>!c(w))??m[0]}for(let p=0;p<$E&&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)||gn({...e,waypoints:[g,h]},[m]).length===0)continue;const w=tl(g,h,m),y=w?w.map(S=>eh(r,d,S)):Qd(r,m)??[];if(!y.length)continue;const _=[...y].sort((S,P)=>Number(l(P))-Number(l(S)));for(const S of _){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 nh(e,t){const{elementRegistry:n}=e,i=e.modeling,r=mt(n),o=ti(r),a=li(r).filter(c=>c.kind==="edge-crosses-shape"&&!t.has(ui(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=th(u,o,f,r.edges);if(!d)continue;const g=r.edges.filter(w=>w.id!==c),h=Jn(u,g);Jn({...u,waypoints:d},g)>h||i.updateWaypoints(l,d)}}const HE=10;function ih(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 rh(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=ih(i,n),a=ih(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,ae)=>F.y-ae.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,w=e.waypoints[0],y=e.waypoints[e.waypoints.length-1],_=ti(t),S=t.edges.filter(F=>F.id!==e.id),P=ei(e,S),C=gn(e,_).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=(w.x+y.x)/2,k=F=>F.filter((ae,_e)=>_e===0||!(pt(ae.x,F[_e-1].x)&&pt(ae.y,F[_e-1].y)));let O;for(let F=D;F<=T;F+=HE){const ae=k([w,{x:w.x,y:h},{x:F,y:h},{x:F,y:m},{x:y.x,y:m},y]),_e={...e,waypoints:ae};if(gn(_e,_).length>0)continue;const We=ei(_e,S),Y=Math.abs(F-N);(!O||We<O.cross||We===O.cross&&Y<O.detour)&&(O={pts:ae,cross:We,detour:Y})}return O&&(C>0?O.cross<=P:O.cross<P)?O.pts:null}function oh(e,t){const{elementRegistry:n}=e,i=e.modeling,r=mt(n);for(const o of r.edges){if(o.type!=="bpmn:MessageFlow"||t.has(o.id))continue;const a=mt(n),s=a.edges.find(l=>l.id===o.id);if(!s)continue;const c=rh(s,a);if(!c)continue;const u=n.get(o.id);u&&i.updateWaypoints(u,c)}}const Xi=[25,-25,40,-40],hs=35;function il(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,...Xi]){if(Math.abs(y)>=i.width/2-5)continue;const _=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,...Xi]){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,...Xi]){if(Math.abs(y)>=n.width/2-5)continue;const _=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,w=s?i.y+i.height+hs:i.y-hs;for(const y of[0,...Xi]){if(Math.abs(y)>=i.width/2-5)continue;const _=o+y;for(const S of[0,...Xi]){if(Math.abs(S)>=n.width/2-5)continue;const P=a+S;p.push({pts:[{x:P,y:g},{x:P,y:w},{x:_,y:w},{x:_,y:m}],cost:h+Math.abs(y)+Math.abs(S)})}}return p}const ms=30;function ah(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 zE(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 sh(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=ti(t),o=t.edges.filter(C=>C.id!==e.id),a=Jn(e,o),s=ei(e,o),c=C=>zE(C,t.shapes,e.endpoints)+(ah(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),w=(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(!w)return 0;let D=0;for(let T=1;T<C.length-1;T++){const N=C[T];(N.x<w.x||N.x>w.x+w.width||N.y<w.y||N.y>w.y+w.height)&&D++}return D},_=y(e.waypoints);if(!ah(e.waypoints,n)&&!(d&&!h)&&_===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 il(e,i)){const T={...e,waypoints:C};if(gn(T,r).length>0)continue;const N=Jn(T,o);if(N>a)continue;const k=y(C);if(k>_)continue;const O=k<_&&N===0;if(!O&&ei(T,o)>s)continue;const F=c(C),ae=g(C);if(!O&&!(ae&&!h)&&F>=u)continue;const We=ae?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 GE(e,t){const{elementRegistry:n}=e,i=e.modeling,r=mt(n).edges.filter(o=>!t.has(o.id)&&o.waypoints.length>=4).map(o=>o.id).sort();for(const o of r){const a=mt(n),s=a.edges.find(d=>d.id===o);if(!s||s.waypoints.length<4)continue;const c=ti(a),u=a.edges.filter(d=>d.id!==o),l=gn(s,c).length,p=Jn(s,u),f=ei(s,u);for(const d of nl(s,a.shapes)){if(d.length>=s.waypoints.length)continue;const g={...s,waypoints:d};if(gn(g,c).length>l||Jn(g,u)>p||ei(g,u)>f)continue;const h=n.get(o);h&&i.updateWaypoints(h,d);break}}}function ch(e,t){const{elementRegistry:n}=e,i=e.modeling,r=mt(n).edges.filter(o=>o.type==="bpmn:SequenceFlow"&&!t.has(o.id)).map(o=>o.id).sort();for(const o of r){const a=mt(n),s=a.edges.find(l=>l.id===o);if(!s)continue;const c=sh(s,a);if(!c)continue;const u=n.get(o);u&&i.updateWaypoints(u,c)}}function uh(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 Xi){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 VE(e,t){if(e.type!=="bpmn:SequenceFlow")return[];const n=t.get(e.endpoints[0]??""),i=t.get(e.endpoints[1]??"");if(!n||!i)return[];if(Math.min(n.x+n.width,i.x+i.width)-Math.max(n.x,i.x)>=1)return[];const r=i.y+i.height<=n.y,o=n.y+n.height<=i.y;if(!r&&!o)return[];const a=i.x>=n.x+n.width,s=i.x+i.width<=n.x;if(!a&&!s)return[];const c=n.x+n.width/2,u=n.y+n.height/2,l=i.x+i.width/2,p=i.y+i.height/2,f=a?n.x+n.width:n.x,d=o?n.y+n.height:n.y,g=a?i.x:i.x+i.width,h=o?i.y:i.y+i.height,m=[];for(const w of[0,...Xi])Math.abs(w)<i.width/2-5&&m.push({pts:[{x:f,y:u},{x:l+w,y:u},{x:l+w,y:h}],cost:Math.abs(w)}),Math.abs(w)<i.height/2-5&&m.push({pts:[{x:c,y:d},{x:c,y:p+w},{x:g,y:p+w}],cost:Math.abs(w)});return m}function lh(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,...Xi]){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 ph(e,t){const n=new Map(t.shapes.map(d=>[d.id,d])),i=ti(t),r=t.edges.filter(d=>d.id!==e.id),o=Jn(e,r);if(o===0)return null;const a=ei(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=[...il(e,n),...lh(e,n),...uh(e,n)];for(const{pts:d,cost:g}of f){const h={...e,waypoints:d};if(gn(h,i).length>0)continue;const m=Jn(h,r),w=ei(h,r),y=o-m+(p-l(d));if(m>=o||w-a>y)continue;const _=c(d);(!s||m<s.opposite||m===s.opposite&&(w<s.cross||w===s.cross&&(g<s.cost||g===s.cost&&_<s.len)))&&(s={pts:d,opposite:m,cross:w,cost:g,len:_})}return(s==null?void 0:s.pts)??null}function fh(e,t){var i;let n=0;for(const r of t)r.id!==e.id&&((i=Yo(e,r))==null?void 0:i.kind)==="unrelated"&&n++;return n}function WE(e,t){const n=new Map(t.shapes.map(f=>[f.id,f])),i=ti(t),r=t.edges.filter(f=>f.id!==e.id),o=fh(e,r);if(o===0)return null;const a=Jn(e,r),s=ei(e,r),c=f=>f.reduce((d,g,h)=>h?d+Math.abs(g.x-f[h-1].x)+Math.abs(g.y-f[h-1].y):0,0),u=2;let l;const p=[...il(e,n),...lh(e,n),...VE(e,n),...uh(e,n)];for(const{pts:f,cost:d}of p){const g={...e,waypoints:f};if(gn(g,i).length>0)continue;const h=fh(g,r);if(h>=o)continue;const m=Jn(g,r);if(m-h>a-o)continue;const w=ei(g,r);if(w-s>(o-h)*u)continue;const y=c(f);(!l||h<l.fake||h===l.fake&&(m<l.unreadable||m===l.unreadable&&(w<l.cross||w===l.cross&&(d<l.cost||d===l.cost&&y<l.length))))&&(l={pts:f,fake:h,unreadable:m,cross:w,cost:d,length:y})}return(l==null?void 0:l.pts)??null}function dh(e,t,n){const{elementRegistry:i}=e,r=e.modeling,o=li(mt(i)).filter(s=>s.kind==="edge-overlap-unrelated"&&!t.has(ui(s)));if(!o.length)return;const a=new Set;for(const s of o)if(s.kind==="edge-overlap-unrelated")for(const c of s.edges)n.has(c)||a.add(c);for(const s of[...a].sort()){const c=mt(i),u=c.edges.find(f=>f.id===s);if(!u)continue;const l=WE(u,c);if(!l)continue;const p=i.get(s);p&&r.updateWaypoints(p,l)}}function hh(e,t,n){const{elementRegistry:i}=e,r=e.modeling,o=mt(i),a=li(o).filter(l=>Xu(l)&&!t.has(ui(l)));if(!a.length)return;const s=new Set;for(const l of a)if(Xu(l))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=mt(i),f=p.edges.find(h=>h.id===l);if(!f)continue;const d=ph(f,p);if(!d)continue;const g=i.get(l);g&&r.updateWaypoints(g,d)}}const UE=10,qE=(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 mh(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=ti(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 w=[];return d>h&&w.push([h,Math.min(m,d)]),g<m&&w.push([Math.max(h,g),m]),w.filter(([y,_])=>_>y)});const c=a.axis==="h"?n.width:n.height,u=s.find(([d,g])=>g-d>=c+UE*2);if(!u)continue;const l=(u[0]+u[1])/2,p=a.axis==="h"?{x:l,y:a.at-Bd}:{x:a.at+Rn+n.width/2,y:l},f={x:p.x-n.width/2,y:p.y-n.height/2,width:n.width,height:n.height};if(!fs({...e,label:f},i)&&!r.some(d=>!e.endpoints.includes(d.id)&&qE(f,d)))return f}return null}const Rn=8;function gh(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(Ko)],u=f=>!c.some(d=>Pi(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 yh(e,t){const{elementRegistry:n}=e,i=e.modeling,r=mt(n);for(const o of r.edges){if(!o.label||t.has(o.id))continue;const a=gh(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 vh(e,t,n){const{elementRegistry:i}=e,r=e.modeling,o=mt(i),a=li(o).filter(s=>s.kind==="label-on-shared-segment"&&!t.has(ui(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=mh(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 bh(e,t){const n=e.label;if(!n)return null;const i=[...t.edges.flatMap(fn),...t.shapes.filter(f=>f.container).flatMap(Ko)],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=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=>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-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 _h(e,t){const{elementRegistry:n}=e,i=e.modeling,r=mt(n);for(const o of r.shapes){if(o.container||!o.label||t.has(o.id))continue;const a=bh(o,mt(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 YE=/^[\p{L}_][\p{L}\p{N}_.\-]*$/u,xh=new Set(["sequenceFlow","messageFlow","dataAssociation","association"]),wh={"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),rl=e=>typeof e=="string"&&e!=="";function KE(e){const t=[];function n(i,r,o,a){if(a===null){rl(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)rl(o[s])||t.push({kind:"payload-invalid",opIndex:i,field:`${r}.${s}`})}return e.forEach((i,r)=>{if(!ys(i)||!rl(i.kind)||!(i.kind in wh)){t.push({kind:"payload-invalid",opIndex:r,field:"kind"});return}for(const o of wh[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 Eh(e,t){const n=KE(e);if(n.length>0)return n;const i=[],r=new Map,o=new Map;function a(f,d,g){if(!YE.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:w,name:y,condition:_}=f.flow,S=u(d,m,"source",["flowNode"]),P=u(d,w,"target",["flowNode"]);S&&P&&c(m)!==c(w)&&i.push({kind:"flow-cross-pool",opIndex:d,id:h}),y!==void 0&&_!==void 0&&i.push({kind:"condition-name-conflict",opIndex:d,id:h});break}case"messageFlow.add":{const{id:h,source:m,target:w}=f.flow,y=u(d,m,"source",["flowNode","participant"]),_=u(d,w,"target",["flowNode","participant"]);if(y&&_){const S=c(m),P=c(w);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 w=h.source===f.dataStore.id?h.target:h.source;u(d,w,"dataAssociation",["flowNode"])}break}case"dataAssociation.add":{const{source:h,target:m}=f.association,w=u(d,h,"source"),y=u(d,m,"target");if(w&&y){const _=new Set([w,y]);_.has("dataStore")&&_.has("flowNode")||i.push({kind:"data-association-ends",opIndex:d,source:h,target:m})}break}case"association.add":{const{id:h,source:m,target:w}=f.association,y=u(d,m,"source"),_=u(d,w,"target");y&&_&&y!=="annotation"&&_!=="annotation"&&i.push({kind:"association-detached",opIndex:d,annotation:h??`${m}->${w}`});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 w=h===f.annotation.id?m:h;u(d,w,"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&&xh.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 w=m.filter(y=>h.includes(y));w.length===h.length&&w.some((y,_)=>y!==h[_])&&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,w=t.endpointsOf(f.id),y=f.source??(w==null?void 0:w.source),_=f.target??(w==null?void 0:w.target);h&&m&&y!==void 0&&_!==void 0&&new Set([c(y),c(_),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&&xh.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 Sh(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,Rh=40,XE=10;function ol(e,t,n,i,r){const o=n,a=(k,O)=>{const[F,ae]=bs[k];let _e={x:t.x+t.width/2+F*(t.width/2+o.width/2+O),y:t.y+t.height/2+ae*(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=mt(e),u=k=>{var F,ae;if(!r.selfId)return!1;const O=e.get(k);return!!O&&(((F=O.source)==null?void 0:F.id)===r.selfId||((ae=O.target)==null?void 0:ae.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}]),w=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)||w(k),_=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,ae=[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 ae){if(Y.has(le))continue;Y.add(le);const ge=a(le,_e);if(_(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(_).find(ae=>!y(ae));F&&(N=F)}return N}function Ut(e,t){return e.filter(n=>n.kind===t)}function Ch(e,t){var Kx,Xx,Zx,Qx,Jx,e0,t0,n0,i0,r0,o0,a0,s0,c0,u0,l0,p0,f0,d0,h0,m0,g0,y0;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"),w=Ut(e,"messageFlow.add"),y=Ut(e,"dataStore.add"),_=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,ae=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 E=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=E(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,$=((Kx=R.lanes)==null?void 0:Kx.length)??0,B=Math.max(1200,A*160+300),I=(R.lanes??[]).map(ie=>E(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,ae)+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,ae)+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,xn=wt(me??`pool:${v}`,Ae??0);if(Yt)for(let ne=0;ne<4;ne++){const ee=G(me,xn+ne,Qe);if(!Y(se,ve,it,ee))return j(me,xn+ne,A),{x:it,y:ee}}const Ee=I(me,Ae,Qe);Yt&&j(me,xn,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 w){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 oi=it(je.node.id),Ct=Qe(oi);Ct&&ne.push({subtree:oi,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 w){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 es=U(dt);es!==void 0&&Se.push({t:dt,subtree:it(dt.node.id),band:es})}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,oi=tt.band;for(const Ct of je.subtree)U(Ct)===Gt&&q.set(Ct.node.id,oi);for(const Ct of tt.subtree)U(Ct)===oi&&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 xn=new Map;for(const Ee of w)xn.set(Ee.flow.target,[...xn.get(Ee.flow.target)??[],Ee]);for(const Ee of R.nodes){const Je=xn.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=(Xx=C.get(Je[0].flow.source))==null?void 0:Xx.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[oi,Ct]of Te){const dt=Ct-Se;(tt&&dt<0&&(!Gt||dt<Gt.row)||!tt&&dt>0&&(!Gt||dt>Gt.row))&&(Gt={band:oi,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 xn=l(Qe.target),Ee=C.get(Qe.target);if(!xn&&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(xn)n.connect(Yt,xn,{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",bn=(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}}},ri=()=>{const v=mt(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=ri(),Qe=bn([Ae],xe);if(!Qe)continue;const Yt=ri();(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,Za=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 w){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 w){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=mt(o),we={...ce.edges.find(at=>at.id===I.flow.id),waypoints:Me};gn(we,ti(ce)).length||n.updateWaypoints(G,Me)}}};Za(!1);for(const v of w){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),...w.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=(Zx=X.get("T"))!=null&&Zx.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 _n=20,Ze=4,rt=2,$D=[10,30,80],zo=()=>{const v=mt(o);return{bad:li(v).filter(R=>R.kind==="edge-crosses-shape"||R.kind==="edge-overlap-opposite"||R.kind==="edge-overlap-mixed").length,crossings:Hd(v),straight:v.edges.filter(R=>R.type==="bpmn:MessageFlow"&&R.waypoints.length===2).length}},Go=v=>{const R=mt(o),A=R.edges.find($=>$.id===v);return A?gn(A,ti(R)).length:0},Su=v=>Go(v)>0,Ru=v=>mt(o).edges.filter(R=>R.type==="bpmn:MessageFlow"&&R.id!==v&&R.waypoints.length===2).length,jD=(v,R,A)=>bn([{subtree:v,pool:R}],A),Nx=(v,R)=>R.bad>v.bad||R.crossings>v.crossings&&R.straight<=v.straight&&R.bad>=v.bad,Cu=(v,R)=>Nx(v,R)||R.straight<v.straight,Pu=(v,R,A=()=>!0,$=Nx)=>{const B=zo(),I=bn(v,R);if(!I)return!1;const G=zo();return $(B,G)||!A()?(I(),!1):!0},Bx=(v,R,A,$=()=>!0)=>Pu([{subtree:v,pool:R}],A,$),Yr=v=>{var R;return!!((R=C.get(v))!=null&&R.node.participant)},Qa=new Map;for(const v of w){if(!Yr(v.flow.target))continue;const R=Qa.get(v.flow.target)??[];R.push(v),Qa.set(v.flow.target,R)}const Zf=[...Qa.keys()],$x=new Set(m.map(v=>v.flow.target)),jx=v=>W.findIndex(({op:R})=>R.participant.id===v);Zf.sort((v,R)=>{var B,I;const A=$x.has(v)?1:0,$=$x.has(R)?1:0;return A!==$?A-$:jx((B=C.get(v))==null?void 0:B.node.participant)-jx((I=C.get(R))==null?void 0:I.node.participant)});const Kr=v=>v.x+v.width/2,FD=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},HD=(v,R)=>{const A=FD(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 $},Qf=(v,R)=>{const A=l(v.flow.source);if(A)return A.type==="bpmn:Participant"?HD(A.id,R):Kr(A)},Fx=v=>{let R;for(const A of Qa.get(v)??[]){const $=Qf(A,v);$!==void 0&&(!R||$>R.cx)&&(R={op:A,cx:$})}return R==null?void 0:R.op},zD=v=>{const R=Fx(v),A=l(v),$=R?Qf(R,v):void 0;return A&&$!==void 0?$-Kr(A):void 0},GD=v=>{const R=zD(v);return R!==void 0&&Math.abs(R)<_n},Hx=(v,R,A,$,B)=>{var I;for(let G=!0;G;){G=!1;for(const z of w){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)}))},zx=(v,R,A,$,B)=>Hx(new Map([[R,[...v]]]),new Set(v.map(I=>I.id)),$,I=>I===A,I=>I===B),Jf=v=>{const R=Fx(v);if(!R)return null;const A=l(v),$=l(R.flow.source),B=Qf(R,v);if(!A||!$||B===void 0)return null;const I=B-Kr(A);if(I>=_n){const G=C.get(v).node.participant,z=et(v,V=>V.x>=A.x);return{groups:zx(z,G,v,R.flow.id,R.flow.source),dx:I}}if(-I>=_n&&Yr(R.flow.source)){const G=C.get(R.flow.source).node.participant,z=et(R.flow.source,V=>V.x>=$.x&&!GD(V.id));return{groups:zx(z,G,R.flow.source,R.flow.id,v),dx:-I}}return null},Gx=()=>Zf.map(v=>({id:v,plan:Jf(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 Gx()){const I=Jf(B);if(!I)continue;const G=bn(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 Gx()){const I=Jf(B);I&&Pu(I.groups,I.dx,()=>!0,Cu)&&($=!0)}if(!$)break}for(const v of Zf.flatMap(R=>Qa.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(Bx($,A,B*z,V))break}}for(const v of w){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=(Jx=C.get(z.id))==null?void 0:Jx.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(Bx(me,X,ce*Ae,se)){ve=!0;break}if(ve)break}if(!Su(v.flow.id))break}}for(const v of w){if(!Su(v.flow.id))continue;const R=l(v.flow.id);if(((e0=R==null?void 0:R.waypoints)==null?void 0:e0.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=ti(mt(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=(t0=C.get(v.flow.source))==null?void 0:t0.node.participant,pe=(n0=C.get(v.flow.target))==null?void 0:n0.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=Hx(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 $D){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=jD(V,z,-(G-O));if(!pe)continue;const xe=zo();(xe.bad>X.bad||xe.crossings>=X.crossings||xe.straight<X.straight)&&pe()}}Za(!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 _){const A=p(v.association.target).type==="bpmn:DataStoreReference"?v.association.target:v.association.source;It(A,v.association)}let Vx=0;const Xr=10,Wx=40,VD=(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=Wx-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)},WD=(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)}}}},ed=(v,R)=>{const A=Wx,$=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 VD(z,v),WD(z,R),z};for(const v of P){const R=(v.group.members??[]).map(l).filter(B=>!!B);let A;R.length?A=ed(R,v.group.id):(A={x:300+Vx*350,y:40,width:300,height:200},Vx++);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),(i0=v.group.members)!=null&&i0.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=(r0=B.source)==null?void 0:r0.id,G=(o0=B.target)==null?void 0:o0.id;A(I,G),((a0=B.type)!=null&&a0.includes("DataOutputAssociation")||(s0=B.type)!=null&&s0.includes("DataInputAssociation")||B.type==="bpmn:Association")&&A(G,I)}const $=o.filter(B=>B.type==="bpmn:Group");for(const B of $){const G=(((c0=B.businessObject.extensionElements)==null?void 0:c0.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 w){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);((u0=Te==null?void 0:Te.waypoints)==null?void 0:u0.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 xn=[...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 xn){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 $=(((l0=R.businessObject.extensionElements)==null?void 0:l0.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,ed(B,R.id))}}{const R=new Map(so(mt(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=(p0=z.source)==null?void 0:p0.id,X=(f0=z.target)==null?void 0:f0.id;B(V,X),((d0=z.type)!=null&&d0.includes("DataOutputAssociation")||(h0=z.type)!=null&&h0.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=(((m0=z.businessObject.extensionElements)==null?void 0:m0.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)),xn=Math.max(...Ae.map(ee=>ee.y+ee.height)),Ee={L:it-we,R:at-Qe,T:Yt-se,B:ve-xn},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},oi=["L","R","T","B"].filter(dt=>Gt[dt]<=Ee[dt]+.001);if(!oi.length)continue;const Ct=oi.reduce((dt,es)=>Gt[es]<Gt[dt]?es:dt,oi[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 Ux=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 Ja=0;const qx=12,Yx=14,UD=15,qD=300,YD=v=>{const R=v.split(`
7
- `),A=Math.max(...R.map(I=>oo(I,qx))),$=Math.max(100,Math.min(qD,Math.ceil(A)+Yx)),B=R.reduce((I,G)=>I+Math.max(1,Math.ceil((oo(G,qx)+Yx)/$)),0);return{width:$,height:Math.max(30,B*UD+10)}};for(const v of S){const R=v.association,A=((g0=v.placement)==null?void 0:g0.anchor)??(R?R.source===v.annotation.id?R.target:R.source:void 0),$=A?l(A):void 0,B=$?Ux($):void 0,I=YD(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+Ja%3*260,y:B.y-110-Ja%2*95},Ja++):(G={x:300+Ja*260,y:60},Ja++);const z=$?f($)??u():u(),V=z;B&&typeof V.x=="number"&&typeof V.width=="number"&&V.type==="bpmn:Participant"&&(G=ol(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,ae)+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:((y0=v.condition)==null?void 0:y0.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),$=Ux(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?ol(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,ed(A,v.id)),D(R,"bwl:Members",{refs:v.members.join(" ")})}}}function al(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 ZE(e,t,n){var l,p;const{elementRegistry:i}=e,r=e.modeling,o=f=>li(f).filter(d=>!t.has(ui(d))),a=f=>{var d;return((d=i.get(f))==null?void 0:d.type)==="bpmn:TextAnnotation"},s=mt(i),c=o(s),u=[...new Set(c.flatMap(al))].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 w=(((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"),_=(w!=null&&w.anchor?i.get(w.anchor):void 0)??(y?((p=y.source)==null?void 0:p.id)===f?y.target:y.source:void 0);if(!_)continue;const S=_.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,y:_.y,width:_.width,height:_.height},C={width:d.width,height:d.height},D={x:d.x+d.width/2,y:d.y+d.height/2},T=w==null?void 0:w.side,N=[];T&&T in bs&&N.push(ol(i,P,C,h,{placement:{side:T,offset:(w==null?void 0:w.offset)??null},selfId:f}));for(const[_e,We]of[[-1,0],[1,0],[0,-1],[0,1]])for(let Y=1;Y<=XE;Y++)N.push({x:D.x+_e*Rh*Y,y:D.y+We*Rh*Y});const k={...s,edges:s.edges.filter(_e=>_e.id!==(y==null?void 0:y.id))},O=o(k),F=O.filter(_e=>al(_e).includes(f)).length;if(!F)continue;let ae;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=>al(re).includes(f)).length;if(ue>=F||ge.length>O.length)continue;const Re=Math.abs(We)+Math.abs(Y);if((!ae||ue<ae.mine||ue===ae.mine&&(ge.length<ae.all||ge.length===ae.all&&Re<ae.dist))&&(ae={x:_e.x,y:_e.y,mine:ue,all:ge.length,dist:Re}),ae.mine===0&&ae.all<O.length)break}ae&&r.moveElements([d],{x:ae.x-D.x,y:ae.y-D.y})}}function Ph(e,t,n=Ch){const i=Sh(e),r=Eh(t,Xd(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=mt(i.elementRegistry),s=new Set(li(a).map(ui)),c=new Set(a.edges.map(h=>h.id)),u=new Set(a.shapes.map(h=>h.id)),l=Ju(a).length,p=e.get("commandStack");try{od(p,()=>{n(t,i),oh(i,c),nh(i,s),hh(i,s,c),ch(i,c),GE(i,c),dh(i,s,c),vh(i,s,c),yh(i,c),_h(i,u),ZE(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=mt(i.elementRegistry),d=li(f).filter(h=>!s.has(ui(h))),g=zd(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 JE(e,t){return typeof e.get=="function"?e.get(t):e[t]}function Ah(e,t){const n=JE(e,t);return typeof n=="number"&&Number.isFinite(n)?n:void 0}function Th(e,t){var i;return(((i=e.extensionElements)==null?void 0:i.values)??[]).find(r=>(r==null?void 0:r.$type)===t)}function e1(e){return typeof e=="string"&&Tu.includes(e)}function pi(e){if(typeof e=="string")return e;const t=e==null?void 0:e.id;return typeof t=="string"?t:void 0}function Mh(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=[],w=new Set,y=new Set,_=Y=>{Y&&w.add(Y)},S=Y=>{w.add(Y),y.add(Y)},P=Y=>{const le=Th(Y,"bwl:Placement");if(!le)return;const ge=typeof le.anchor=="string"?le.anchor:void 0;if(!ge||!e1(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=Th(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(_(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:pi(ge.sourceRef),target:pi(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){_(re.id);for(const q of re.flowNodeRef??[]){const U=pi(q);U&&Re.set(U,re.id)}}for(const re of ge){if(_(re.id),re.$type==="bpmn:SequenceFlow"){p.push({id:re.id,source:pi(re.sourceRef),target:pi(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(!td(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=Ah(re,"bwl:band");U!==void 0&&(l.bands[re.id]=U);for(const Z of re.dataOutputAssociations??[])_(Z.id),g.push({id:Z.id,type:Z.$type,source:re.id,target:pi(Z.targetRef)});for(const Z of re.dataInputAssociations??[])_(Z.id),g.push({id:Z.id,type:Z.$type,source:pi((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=pi(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=Ah(le,"bwl:poolOrder");U!==void 0&&(l.poolOrders[le.id]=U),ue&&T(ue,le.id)}for(const le of n.messageFlows??[])_(le.id),f.push({id:le.id,source:pi(le.sourceRef),target:pi(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=[],ae=(Y,le)=>!!Y&&!!le&&y.has(Y)&&y.has(le);for(const Y of p){if(!ae(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(!ae(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(!ae(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(!ae(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=>w.has(Re)),ue=_e.get(Y);ue&&ge.length&&(ue.members=ge)}for(const Y of h)w.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 t1(e){const{definitions:t,warnings:n}=await Uu(e);return{...Mh(t),warnings:n}}function n1(e,t,n,i={}){return{documentId:e,baseVersion:t,ops:[...n],origin:i.origin??"agent",clientOpId:(i.mkClientOpId??(()=>crypto.randomUUID()))()}}async function kh(e,t,{currentVersion:n}){if(t.baseVersion!==n)return{status:"conflict",baseVersion:t.baseVersion,currentVersion:n};const i=Ph(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 i1=Symbol("bpmn-editor");function r1(){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 kh(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 o1(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var sl={exports:{}},Oh;function a1(){if(Oh)return sl.exports;Oh=1;var e=sl.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},sl.exports}var s1=a1(),c1=o1(s1);function fi(e){if(!(this instanceof fi))return new fi(e);e=e||[128,36,1],this._seed=e.length?c1.rack(e[0],e[1],e[2]):e}fi.prototype.next=function(e){return this._seed(e||!0)},fi.prototype.nextPrefixed=function(e,t){var n;do n=e+this.next(!0);while(this.assigned(n));return this.claim(n,t),n},fi.prototype.claim=function(e,t){this._seed.set(e,t||!0)},fi.prototype.assigned=function(e){return this._seed.get(e)||!1},fi.prototype.unclaim=function(e){delete this._seed.hats[e]},fi.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 u1(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 l1=Object.prototype.toString;function yt(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 l1.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 _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 p1(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var xs={},Dh;function f1(){if(Dh)return xs;Dh=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 Lh=f1(),d1=p1(Lh),Ne=u1({__proto__:null,default:d1},[Lh]),Ih=["focus","blur"];function h1(e,t,n,i,r){return Ih.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 m1(e,t,n,i){return Ih.indexOf(t)!==-1&&(i=!0),Ne.unbind(e,t,n,i)}var Cn={bind:h1,unbind:m1};function cl(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 di(e){e.parentNode&&e.parentNode.removeChild(e)}function g1(e,t){if(e.ownerDocument!==t.ownerDocument)try{return t.ownerDocument.importNode(e,!0)}catch{}return e}function y1(e,t){return t.appendChild(g1(e,t))}function Be(e,t){return y1(t,e),e}var ul=2,Nh={"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":ul,"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":ul,"text-anchor":1,"text-decoration":1,"text-rendering":1,"unicode-bidi":1,visibility:1,"word-spacing":1,"writing-mode":1};function v1(e,t){return Nh[t]?e.style[t]:e.getAttributeNS(null,t)}function Bh(e,t,n){var i=t.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase(),r=Nh[i];r?(r===ul&&typeof n=="number"&&(n=String(n)+"px"),e.style[i]=n):e.setAttributeNS(null,t,n)}function b1(e,t){var n=Object.keys(t),i,r;for(i=0,r;r=n[i];i++)Bh(e,r,t[r])}function he(e,t,n){if(typeof t=="string")if(n!==void 0)Bh(e,t,n);else return v1(e,t);else b1(e,t);return e}const _1=Object.prototype.toString;function qe(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 _1.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 Es(e){for(var t;t=e.firstChild;)e.removeChild(t);return e}function $h(e){return e.cloneNode(!0)}var ll={svg:"http://www.w3.org/2000/svg"},jh='<svg xmlns="'+ll.svg+'"';function x1(e){var t=!1;e.substring(0,4)==="<svg"?e.indexOf(ll.svg)===-1&&(e=jh+e.substring(4)):(e=jh+">"+e+"</svg>",t=!0);var n=w1(e);if(!t)return n;for(var i=document.createDocumentFragment(),r=n.firstChild;r.firstChild;)i.appendChild(r.firstChild);return i}function w1(e){var t;return t=new DOMParser,t.async=!1,t.parseFromString(e,"text/xml")}function Ce(e,t){var n;return e=e.trim(),e.charAt(0)==="<"?(n=x1(e).firstChild,n=document.importNode(n,!0)):n=document.createElementNS(ll.svg,e),t&&he(n,t),n}var pl=null;function Fh(){return pl===null&&(pl=Ce("svg")),pl}function Hh(e,t){var n,i,r=Object.keys(t);for(n=0;i=r[n];n++)e[i]=t[i];return e}function E1(e,t,n,i,r,o){var a=Fh().createSVGMatrix();switch(arguments.length){case 0:return a;case 1:return Hh(a,e);case 6:return Hh(a,{a:e,b:t,c:n,d:i,e:r,f:o})}}function Xo(e){return Fh().createSVGTransform()}var zh=/([&<>]{1})/g,S1=/([&<>\n\r"]{1})/g,R1={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"'"};function fl(e,t){function n(i,r){return R1[r]||r}return e.replace(t,n)}function Gh(e,t){var n,i,r,o,a;switch(e.nodeType){case 3:t.push(fl(e.textContent,zh));break;case 1:if(t.push("<",e.tagName),e.hasAttributes())for(r=e.attributes,n=0,i=r.length;n<i;++n)o=r.item(n),t.push(" ",o.name,'="',fl(o.value,S1),'"');if(e.hasChildNodes()){for(t.push(">"),a=e.childNodes,n=0,i=a.length;n<i;++n)Gh(a.item(n),t);t.push("</",e.tagName,">")}else t.push("/>");break;case 8:t.push("<!--",fl(e.nodeValue,zh),"-->");break;case 4:t.push("<![CDATA[",e.nodeValue,"]]>");break;default:throw new Error("unable to handle node "+e.nodeType)}return t}function C1(e){for(var t=e.firstChild,n=[];t;)Gh(t,n),t=t.nextSibling;return n.join("")}function Vh(e,t){return C1(e)}function $t(e){var t=e.parentNode;return t&&t.removeChild(e),e}function P1(e,t){return t instanceof SVGMatrix?e.createSVGTransformFromMatrix(t):t}function A1(e,t){var n,i;for(e.clear(),n=0;i=t[n];n++)e.appendItem(P1(e,i))}function Zo(e,t){var n=e.transform.baseVal;return t&&(Array.isArray(t)||(t=[t]),A1(n,t)),n.consolidate()}const T1=/^class[ {]/;function M1(e){return T1.test(e.toString())}function dl(e){return Array.isArray(e)}function hl(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function Ss(...e){e.length===1&&dl(e[0])&&(e=e[0]),e=[...e];const t=e.pop();return t.$inject=e,t}const k1=/constructor\s*[^(]*\(\s*([^)]*)\)/m,O1=/^(?:async\s+)?(?:function\s*[^(]*)?(?:\(\s*([^)]*)\)|(\w+))/m,D1=/\/\*([^*]*)\*\//m;function L1(e){if(typeof e!="function")throw new Error(`Cannot annotate "${e}". Expected a function!`);const t=e.toString().match(M1(e)?k1:O1);if(!t)return[];const n=t[1]||t[2];return n&&n.split(",").map(i=>{const r=i.match(D1);return(r&&r[1]||i).trim()})||[]}function Wh(e,t){const n=t||{get:function(_,S){if(i.push(_),S===!1)return null;throw s(`No provider for "${_}"!`)}},i=[],r=this._providers=Object.create(n._providers||null),o=this._instances=Object.create(null),a=o.injector=this,s=function(_){const S=i.join(" -> ");return i.length=0,new Error(S?`${_} (Resolving: ${S})`:_)};function c(_,S){if(!r[_]&&_.includes(".")){const P=_.split(".");let C=c(P.shift());for(;P.length;)C=C[P.shift()];return C}if(hl(o,_))return o[_];if(hl(r,_)){if(i.indexOf(_)!==-1)throw i.push(_),s("Cannot resolve circular dependency!");return i.push(_),o[_]=r[_][0](r[_][1]),i.pop(),o[_]}return n.get(_,S)}function u(_,S){if(typeof S>"u"&&(S={}),typeof _!="function")if(dl(_))_=Ss(_.slice());else throw s(`Cannot invoke "${_}". Expected a function!`);const C=(_.$inject||L1(_)).map(D=>hl(S,D)?S[D]:c(D));return{fn:_,dependencies:C}}function l(_){const{fn:S,dependencies:P}=u(_),C=Function.prototype.bind.call(S,null,...P);return new C}function p(_,S,P){const{fn:C,dependencies:D}=u(_,P);return C.apply(S,D)}function f(_){return Ss(S=>_.get(S))}function d(_,S){if(S&&S.length){const P=Object.create(null),C=Object.create(null),D=[],T=[],N=[];let k,O,F,ae;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),ae=f(F),D.push(k[3]),T.push(F),N.push(ae),P[_e]=[ae,_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!')}),_.unshift(P)}return new Wh(_,a)}const g={factory:p,type:l,value:function(_){return _}};function h(_,S){const P=_.__init__||[];return function(){P.forEach(C=>{typeof C=="string"?S.get(C):S.invoke(C)})}}function m(_){const S=_.__exports__;if(S){const P=_.__modules__,C=Object.keys(_).reduce((O,F)=>(F!=="__exports__"&&F!=="__modules__"&&F!=="__init__"&&F!=="__depends__"&&(O[F]=_[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=(_.__init__||[]).slice();return k.unshift(function(){T.init()}),_=Object.assign({},_,{__init__:k}),h(_,T)}return Object.keys(_).forEach(function(P){if(P==="__init__"||P==="__depends__")return;const C=_[P];if(C[2]==="private"){r[P]=C;return}const D=C[0],T=C[1];r[P]=[g[D],I1(D,T),D]}),h(_,a)}function w(_,S){return _.indexOf(S)!==-1||(_=(S.__depends__||[]).reduce(w,_),_.indexOf(S)!==-1)?_:_.concat(S)}function y(_){const S=_.reduce(w,[]).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 I1(e,t){return e!=="value"&&dl(t)&&(t=Ss(t.slice())),t}var N1=1e3;function Ti(e,t){var n=this;t=t||N1,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 B1(e){return["M",e.x,e.y]}function ml(e){return["L",e.x,e.y]}function $1(e,t,n){return["C",e.x,e.y,t.x,t.y,n.x,n.y]}function j1(e,t){const n=e.length,i=[B1(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(ml(a));continue}const c=Math.min(t,gl(a.x-o.x,a.y-o.y),gl(s.x-a.x,s.y-a.y));if(!c){i.push(ml(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(ml(u)),i.push($1(l,f,p))}return i}function Rs(e,t,n){const i=t.x-e.x,r=t.y-e.y,o=gl(i,r),a=n/o;return{x:e.x+i*a,y:e.y+r*a}}function gl(e,t){return Math.sqrt(Math.pow(e,2)+Math.pow(t,2))}function Qo(e,t,n){Le(t)&&(n=t,t=null),t||(t={});const i=Ce("path",t);return Le(n)&&(i.dataset.cornerRadius=String(n)),yl(i,e)}function yl(e,t){const n=parseInt(e.dataset.cornerRadius,10)||0;return he(e,{d:kr(j1(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 vl(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 Jo(e,t){return vl(e)}function F1(e,t,n){Rr(t)&&(t=!0),Vt(t)&&(n=t,t=!0),n=n||{};var i=ea(n.allShapes),r=ea(n.allConnections),o=ea(n.enclosedElements),a=ea(n.enclosedConnections),s=ea(n.topLevel,t&&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 Uh(e){return"waypoints"in e?"connection":"x"in e?"shape":"root"}function qh(e){return!!(e&&e.isFrame)}function ea(e,t){return H({},e||{},t||{})}var H1=1;function Ji(e,t){Ti.call(this,e,H1),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(Ji,Ti),Ji.prototype.canRender=function(){return!0},Ji.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}),qh(n)?he(r,H({},this.FRAME_STYLE,i||{})):he(r,H({},this.SHAPE_STYLE,i||{})),Be(t,r),r},Ji.prototype.drawConnection=function(t,n,i){var r=Qo(n.waypoints,H({},this.CONNECTION_STYLE,i||{}));return Be(t,r),r},Ji.prototype.getShapePath=function(t){var n=t.x,i=t.y,r=t.width,o=t.height,a=[["M",n,i],["l",r,0],["l",0,o],["l",-r,0],["z"]];return kr(a)},Ji.prototype.getConnectionPath=function(t){var n=t.waypoints,i,r,o=[];for(i=0;r=n[i];i++)r=r.original||r,o.push([i===0?"M":"L",r.x,r.y]);return kr(o)},Ji.$inject=["eventBus","styles"];function z1(){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=Sn(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 G1={__init__:["defaultRenderer"],defaultRenderer:["type",Ji],styles:["type",z1]};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 bl(e,t){return!e||!t?-1:e.indexOf(t)}function ta(e,t){return!e||!t?-1:Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function _l(e,t,n,i){if(typeof i>"u"&&(i=5),!e||!t||!n)return!1;var r=(t.x-e.x)*(n.y-e.y)-(t.y-e.y)*(n.x-e.x),o=ta(e,t);return Math.abs(r/o)<=i}var V1=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(W1(r,n))return o;return!1}function W1(e,t){const n=t[0];return Cr(t,function(i){return Math.abs(n[e]-i[e])<=V1})}function Yh(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 xl(e,t){return{x:Math.round(e.x+(t.x-e.x)/2),y:Math.round(e.y+(t.y-e.y)/2)}}var U1=/,?([a-z]),?/gi,Kh=parseFloat,Mt=Math,er=Mt.PI,hi=Mt.min,mi=Mt.max,Xh=Mt.pow,tr=Mt.abs,q1=/([a-z])[\s,]*((-?\d*\.?\d*(?:e[-+]?\d+)?[\s]*,?[\s]*)+)/ig,Y1=/(-?\d*\.?\d*(?:e[-+]?\d+)?)[\s]*,?[\s]*/ig,Zh=Array.isArray||function(e){return e instanceof Array};function K1(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function X1(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 Z1(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 K1(r,i)?(X1(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(q1,function(i,r,o){var a=[],s=r.toLowerCase();for(o.replace(Y1,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=El,n}function J1(e){for(var t=0,n=e.length;t<n;t++){var i=e[t][0];if(typeof i=="string"&&i!==i.toUpperCase())return!1}return!0}function eS(e){for(var t=0,n=e.length;t<n;t++){var i=e[t][0];if(i!=="M"&&i!=="C")return!1}return!0}function wl(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 El(){return this.join(",").replace(U1,"$1")}function tS(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=El,t}function Qh(e,t,n,i,r,o,a,s,c){var u=1-c,l=Xh(u,3),p=Xh(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 Jh(e){var t=sS(...e);return wl(t.x0,t.y0,t.x1-t.x0,t.y1-t.y0)}function nr(e,t,n){return t>=e.x&&t<=e.x+e.width&&n>=e.y&&n<=e.y+e.height}function nS(e,t){return e=wl(e),t=wl(t),nr(t,e.x,e.y)||nr(t,e.x2,e.y)||nr(t,e.x,e.y2)||nr(t,e.x2,e.y2)||nr(e,t.x,t.y)||nr(e,t.x2,t.y)||nr(e,t.x,t.y2)||nr(e,t.x2,t.y2)||(e.x<t.x2&&e.x>t.x||t.x<e.x2&&t.x>e.x)&&(e.y<t.y2&&e.y>t.y||t.y<e.y2&&t.y>e.y)}function em(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 tm(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=em(h,e,n,r,a),w=em(h,t,i,o,s),y=m*m+w*w;d+=f[g]*Mt.sqrt(y)}return u*d}function iS(e,t,n,i,r,o,a,s){if(!(mi(e,n)<hi(r,a)||hi(e,n)>mi(r,a)||mi(t,i)<hi(o,s)||hi(t,i)>mi(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<+hi(e,n).toFixed(2)||d>+mi(e,n).toFixed(2)||d<+hi(r,a).toFixed(2)||d>+mi(r,a).toFixed(2)||g<+hi(t,i).toFixed(2)||g>+mi(t,i).toFixed(2)||g<+hi(o,s).toFixed(2)||g>+mi(o,s).toFixed(2)))return{x:p,y:f}}}}function Ps(e){return Math.round(e*1e11)/1e11}function rS(e,t,n){var i=Jh(e),r=Jh(t);if(!nS(i,r))return[];var o=tm(...e),a=tm(...t),s=im(e)?1:~~(o/5)||1,c=im(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],w=u[d+1],y=l[g],_=l[g+1],S=tr(w.x-m.x)<.01?"y":"x",P=tr(_.x-y.x)<.01?"y":"x",C=iS(m.x,m.y,w.x,w.y,y.x,y.y,_.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+tr((C[S]-m[S])/(w[S]-m[S]))*(w.t-m.t),N=y.t+tr((C[P]-y[P])/(_[P]-y[P]))*(_.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 nm(e,t,n){e=am(e),t=am(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 w=0,y=t.length;w<y;w++){var _=t[w];if(_[0]=="M")o=u=_[1],a=l=_[2];else{_[0]=="C"?(f=[o,a,..._.slice(1)],o=f[6],a=f[7]):(f=[o,a,o,a,u,l,u,l],o=u,a=l);var S=rS(p,f);{for(var P=0,C=S.length;P<C;P++)S[P].segment1=g,S[P].segment2=w,S[P].bez1=p,S[P].bez2=f;d=d.concat(S)}}}}}return d}function oS(e){return Zh(e)&&Zh(e[0])}function aS(e){if(J1(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=El,t}function im(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 rm(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 om(e,t,n,i,r,o,a,s,c,u){var l=er*120/180,p=er/180*(+r||0),f=[],d,g=Z1(function(M,E,b){var j=M*Mt.cos(b)-E*Mt.sin(b),W=M*Mt.sin(b)+E*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,w=h*h/(n*n)+m*m/(i*i);w>1&&(w=Mt.sqrt(w),n=w*n,i=w*i);var y=n*n,_=i*i,S=(o==a?-1:1)*Mt.sqrt(tr((y*_-y*m*m-_*h*h)/(y*m*m+_*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?er-D:D,T=s<P?er-T:T,D<0&&(D=er*2+D),T<0&&(T=er*2+T),a&&D>T&&(D=D-er*2),!a&&T>D&&(T=T-er*2)}var N=T-D;if(tr(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=om(s,c,n,i,r,0,a,O,F,[T,k,P,C])}N=T-D;var ae=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*ae],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 sS(e,t,n,i,r,o,a,s){for(var c=[],u=[[],[]],l,p,f,d,g,h,m,w,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),tr(l)<1e-12){if(tr(p)<1e-12)continue;d=-f/p,0<d&&d<1&&c.push(d);continue}m=p*p-4*f*l,w=Mt.sqrt(m),!(m<0)&&(g=(-p+w)/(2*l),0<g&&g<1&&c.push(g),h=(-p-w)/(2*l),0<h&&h<1&&c.push(h))}for(var _=c.length,S=_,P;_--;)d=c[_],P=1-d,u[0][_]=P*P*P*e+3*P*P*d*n+3*P*d*d*r+d*d*d*a,u[1][_]=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:hi(...u[0]),y0:hi(...u[1]),x1:mi(...u[0]),y1:mi(...u[1])}}function am(e){if(oS(e)||(e=Q1(e)),eS(e))return e;for(var t=tS(aS(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",...om(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",...rm(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",...rm(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=Kh(l[p-4])||n.x,n.by=Kh(l[p-3])||n.y}return t}function st(e){return Vt(e)&&En(e,"waypoints")}function Fe(e){return Vt(e)&&En(e,"labelTarget")}function cS(e){return Vt(e)&&Qr(e.parent)}function sm(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 uS(e){return ki({x:e.x+(e.width||0)/2,y:e.y+(e.height||0)/2})}function lS(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=dS(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)?lS(e):uS(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 na(e,t,n){var i=pS(e,t);return i.length===1||i.length===2&&ta(i[0],i[1])<1?ki(i[0]):i.length>1?(i=ai(i,function(r){var o=Math.floor(r.t2*100)||1;return o=100-o,o=(o<10?"0":"")+o,r.segment2+"#"+o}),ki(i[n?0:i.length-1])):null}function pS(e,t){return nm(e,t)}function fS(e){e=e.slice();for(var t=0,n,i,r;e[t];)n=e[t],i=e[t-1],r=e[t+1],ta(n,r)===0||_l(i,r,n)?e.splice(t,1):t++;return e}function dS(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 cm(e){return Le(e)?e+"px":e}function hS(e){for(;e.parent;)e=e.parent;return e}function mS(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:cm(e.width),height:cm(e.height)}),t.appendChild(n),n}function um(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 gS="base",lm=0,yS=1,vS={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=mS(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=um(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=Uh(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(gS,lm)},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 Sn(this._layers,function(t,n){return n.visible&&e>=n.index&&t++,t},0)},De.prototype._createLayer=function(e,t){typeof t>"u"&&(t=yS);const n=this._getChildIndex(t);return{group:um(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(hS(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,lm);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=vS[e];if(!Cr(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);Zo(t,l)});else return o=this._rootElement?this.getActiveLayer():null,i=o&&o.getBBox()||{},a=Zo(t),r=a?a.matrix:E1(),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),pm(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),w=Math.min(0,s.top-f.top);l=g||h,p=m||w}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 pm(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),pm(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 bS(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 _S(e){return e.__refs_collection===!0}function xS(e,t){return Object.prototype.hasOwnProperty.call(e,t.name||t)}function fm(e,t,n){var i=bS(n[t.name]||[],e,t,n);Object.defineProperty(n,t.name,{enumerable:t.enumerable,value:i}),i.length&&i.forEach(function(r){e.set(r,t.inverse,n)})}function wS(e,t,n){var i=t.inverse,r=n[t.name];Object.defineProperty(n,t.name,{configurable:t.configurable,enumerable:t.enumerable,get:function(){return r},set:function(o){if(o!==r){var a=r;r=null,a&&e.unset(a,i,n),r=o,e.set(r,i,n)}}})}function 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?fm(this,t,e):wS(this,t,e)},jn.prototype.ensureRefsCollection=function(e,t){var n=e[t.name];return _S(n)||fm(this,t,e),n},jn.prototype.ensureBound=function(e,t){xS(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 Sl=new jn({name:"children",enumerable:!0,collection:!0},{name:"parent"}),dm=new jn({name:"labels",enumerable:!0,collection:!0},{name:"labelTarget"}),hm=new jn({name:"attachers",collection:!0},{name:"host"}),mm=new jn({name:"outgoing",collection:!0},{name:"source"}),gm=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)}}),Sl.bind(this,"parent"),dm.bind(this,"labels"),mm.bind(this,"outgoing"),gm.bind(this,"incoming")}function ia(){po.call(this),Sl.bind(this,"children"),hm.bind(this,"host"),hm.bind(this,"attachers")}de(ia,po);function ym(){po.call(this),Sl.bind(this,"children")}de(ym,ia);function vm(){ia.call(this),dm.bind(this,"labelTarget")}de(vm,ia);function bm(){po.call(this),mm.bind(this,"source"),gm.bind(this,"target")}de(bm,po);var ES={connection:bm,shape:ia,label:vm,root:ym};function SS(e,t){var n=ES[e];if(!n)throw new Error("unknown type: <"+e+">");return H(new n,t)}function RS(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++),SS(e,t)};var ks="__fn",_m=1e3,CS=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=_m),!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=_m),!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 ra;return t.init(e),t},Pn.prototype.fire=function(e,t){var n,i,r,o;if(o=CS.call(arguments),typeof e=="object"&&(t=e,e=t.type),!e)throw new Error("no event type specified");if(i=this._listeners[e],!!i){t instanceof ra?n=t:n=this.createEvent(t),o[0]=n;var a=n.type;e!==a&&(n.type=e);try{r=this._invokeListeners(n,o,i)}finally{e!==a&&(n.type=a)}return r===void 0&&n.defaultPrevented&&(r=!1),r}},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=PS(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 ra(){}ra.prototype.stopPropagation=function(){this.cancelBubble=!0},ra.prototype.preventDefault=function(){this.defaultPrevented=!0},ra.prototype.init=function(e){H(this,e||{})};function PS(e,t){return e.apply(null,t)}function Dr(e){return e.childNodes[0]}function AS(e){return e.parentNode.childNodes[1]}function Os(e,t,n,i,r){var o=Xo();o.setTranslate(t,n);var a=Xo();a.setRotate(i||0,0,0);var s=Xo();s.setScale(1,1),Zo(e,[o,a,s])}function en(e,t,n){var i=Xo();i.setTranslate(t,n),Zo(e,i)}function xm(e,t){var n=Xo();n.setRotate(t,0,0),Zo(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=AS(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"?TS(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,qh(t))},Nn.prototype.updateContainments=function(e){var t=this,n=this._elementRegistry,i;i=Sn(e,function(r,o){return o.parent&&(r[o.parent.id]=o.parent),r},{}),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 TS(e,t,n){var i=n||t.firstChild;e!==i&&t.insertBefore(e,i)}const MS={__depends__:[G1],__init__:["canvas"],canvas:["type",De],elementRegistry:["type",In],elementFactory:["type",Oi],eventBus:["type",Pn],graphicsFactory:["type",Nn]};function kS(e){var t=new Wh(e);return t.init(),t}function OS(e){e=e||{};var t={config:["value",e]},n=[t,MS].concat(e.modules||[]);return kS(n)}function ir(e,t){this._injector=t||OS(e),this.get("eventBus").fire("diagram.init")}ir.prototype.get=function(e,t){return this._injector.get(e,t)},ir.prototype.invoke=function(e,t,n){return this._injector.invoke(e,t,n)},ir.prototype.destroy=function(){this.get("eventBus").fire("diagram.destroy")},ir.prototype.clear=function(){this.get("eventBus").fire("diagram.clear")};function cn(e){return e?"<"+e.$type+(e.id?' id="'+e.id:"")+'" />':"<null>"}function yn(e,t){return e.$instanceOf(t)}function DS(e){return lt(e.rootElements,function(t){return yn(t,"bpmn:Process")||yn(t,"bpmn:Collaboration")})}function LS(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=DS(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 E=c(M,wt);if(yn(M,"bpmn:Process")||yn(M,"bpmn:SubProcess"))m(M,E);else if(yn(M,"bpmn:Collaboration"))Re(M,E),w(U.rootElements,E);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 w(q,U){var Z=Ge(q,function(He){return!a(He)&&yn(He,"bpmn:Process")&&He.laneSets});Z.forEach(r(m,U))}function y(q,U){u(q,U)}function _(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){yn(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);yn(q,"bpmn:SubProcess")&&k(q,Z||U),yn(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 ae(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){yn(Z,"bpmn:SequenceFlow")?n.push(function(){F(Z,U)}):yn(Z,"bpmn:BoundaryEvent")?n.unshift(function(){O(Z,U)}):yn(Z,"bpmn:FlowNode")?O(Z,U):yn(Z,"bpmn:DataObject")||(yn(Z,"bpmn:DataStoreReference")||yn(Z,"bpmn:DataObjectReference")?ae(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(){_(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 x(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 x(e,n)})}function te(e){return e&&e.businessObject||e}function Ye(e){return e&&e.di}function IS(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,w){return i.add(h,m,w)},error:function(h,m){s.push({message:h,context:m})}},f=new LS(p);l=l||u.diagrams&&u.diagrams[0];var d=NS(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 NS(e,t){if(!(!t||!t.plane)){var n=t.plane.bpmnElement,i=n;!x(n,"bpmn:Process")&&!x(n,"bpmn:Collaboration")&&(i=BS(n));var r;x(i,"bpmn:Collaboration")?r=i:r=lt(e.rootElements,function(u){if(x(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=wm(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 wm(e){var t=[];return L(e,function(n){n&&(t.push(n),t=t.concat(wm(n.flowElements)))}),t}function BS(e){for(var t=e;t;){if(x(t,"bpmn:Process"))return t;t=t.$parent}}var $S='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 14.02 5.57" width="53" height="21"><path fill="currentColor" d="M1.88.92v.14c0 .41-.13.68-.4.8.33.14.46.44.46.86v.33c0 .61-.33.95-.95.95H0V0h.95c.65 0 .93.3.93.92zM.63.57v1.06h.24c.24 0 .38-.1.38-.43V.98c0-.28-.1-.4-.32-.4zm0 1.63v1.22h.36c.2 0 .32-.1.32-.39v-.35c0-.37-.12-.48-.4-.48H.63zM4.18.99v.52c0 .64-.31.98-.94.98h-.3V4h-.62V0h.92c.63 0 .94.35.94.99zM2.94.57v1.35h.3c.2 0 .3-.09.3-.37v-.6c0-.29-.1-.38-.3-.38h-.3zm2.89 2.27L6.25 0h.88v4h-.6V1.12L6.1 3.99h-.6l-.46-2.82v2.82h-.55V0h.87zM8.14 1.1V4h-.56V0h.79L9 2.4V0h.56v4h-.64zm2.49 2.29v.6h-.6v-.6zM12.12 1c0-.63.33-1 .95-1 .61 0 .95.37.95 1v2.04c0 .64-.34 1-.95 1-.62 0-.95-.37-.95-1zm.62 2.08c0 .28.13.39.33.39s.32-.1.32-.4V.98c0-.29-.12-.4-.32-.4s-.33.11-.33.4z"/><path fill="currentColor" d="M0 4.53h14.02v1.04H0zM11.08 0h.63v.62h-.63zm.63 4V1h-.63v2.98z"/></svg>',Em=$S,Sm={verticalAlign:"middle"},Rm={color:"#404040"},jS={zIndex:"1001",position:"fixed",top:"0",left:"0",right:"0",bottom:"0"},FS={width:"100%",height:"100%",background:"rgba(40,40,40,0.2)"},HS={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"},zS='<div class="bjs-powered-by-lightbox"><div class="backdrop"></div><div class="notice"><a href="https://bpmn.io" target="_blank" rel="noopener" class="link">'+Em+'</a><span>Web-based tooling for BPMN, DMN and forms powered by <a href="https://bpmn.io" target="_blank" rel="noopener">bpmn.io</a>.</span></div></div>',gi;function GS(){gi=ft(zS),dn(gi,jS),dn(ot("svg",gi),Sm),dn(ot(".backdrop",gi),FS),dn(ot(".notice",gi),HS),dn(ot(".link",gi),Rm,{margin:"15px 20px 15px 10px",alignSelf:"center"})}function VS(){gi||(GS(),Cn.bind(gi,".backdrop","click",function(e){document.body.removeChild(gi)})),document.body.appendChild(gi)}const Ds=5,Cm="djs-outline-hidden";function vt(e){e=H({},US,e),this._moddle=this._createModdle(e),this._container=this._createContainer(e),this._init(this._container,this._moddle,e),YS(this._container)}de(vt,ir),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=WS(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=qS(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 IS(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=Vh(r),s=o?"<defs>"+Vh(o)+"</defs>":"",c=i.getContainer();yt(c).add(Cm);let u;try{u=r.getBBox()}finally{yt(c).remove(Cm)}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:j,error:P}),!0;throw Yi(j)}function l(P,C){return u(P,C,!0)}function f(){var P=a.elementsById,C=a.references,D,T;for(D=0;T=C[D];D++){var $=T.element,k=P[T.id],O=Ci($).propertiesByName[T.property];if(k||a.addWarning({message:"unresolved reference <"+T.id+">",element:T.element,property:T.property,value:T.id}),O.isMany){var j=$.get(O.name),oe=j.indexOf(T);oe===-1&&(oe=j.length),k?j[oe]=k:j.splice(oe,1)}else $.set(O.name,k)}}function p(){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 _(P,C){var D=c.peek();try{c.push(D.handleNode(P))}catch(T){u(T,C,o)&&c.push(new Hu)}}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 $=P.attrs||{},k=Object.keys($).reduce(function(j,oe){var xe=C($[oe]);return j[oe]=xe,j},{}),O={name:P.name,originalName:P.originalName,attributes:k,ns:P.ns};_(O,T)}).on("question",m).on("closeTag",p).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),f()}catch(j){D=j}var T=i.element;!D&&!T&&(D=Yi("failed to parse document as <"+i.type.$descriptor.name+">"));var $=a.warnings,k=a.references,O=a.elementsById;return D?(D.warnings=$,C(D)):P({rootElement:T,elementsById:O,references:k,warnings:$})})},Vu.prototype.handler=function(e){return new Gu(this.model,e)};function aw(){var e=[];return Object.defineProperty(e,"peek",{value:function(){return this[this.length-1]}}),e}var sw=`<?xml version="1.0" encoding="UTF-8"?>
5
+ `,cw=/<|>|'|"|&|\n\r|\n/g,Rd=/<|>|&/g;function li(e){this.prefixMap={},this.uriMap={},this.used={},this.wellknown=[],this.custom=[],this.parent=e,this.defaultPrefixMap=e&&e.defaultPrefixMap||{}}li.prototype.mapDefaultPrefixes=function(e){this.defaultPrefixMap=e},li.prototype.defaultUriByPrefix=function(e){return this.defaultPrefixMap[e]},li.prototype.byUri=function(e){return this.uriMap[e]||this.parent&&this.parent.byUri(e)},li.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)},li.prototype.uriByPrefix=function(e){return this.prefixMap[e||"xmlns"]||this.parent&&this.parent.uriByPrefix(e)},li.prototype.mapPrefix=function(e,t){this.prefixMap[e||"xmlns"]=t},li.prototype.getNSKey=function(e){return e.prefix!==void 0?e.uri+"|"+e.prefix:e.uri},li.prototype.logUsed=function(e){var t=e.uri,n=this.getNSKey(e);this.used[n]=this.byUri(t),this.parent&&this.parent.logUsed(e)},li.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 uw(e){return e.charAt(0).toLowerCase()+e.slice(1)}function lw(e,t){return xd(t)?uw(e):e}function Cd(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})}function Pd(e){return wn(e)?e:(e.prefix?e.prefix+":":"")+e.localName}function pw(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 fw(e,t){return t.isGeneric?z({localName:t.ns.localName},e):z({localName:lw(t.ns.localName,t.$pkg)},e)}function dw(e,t){return z({localName:t.ns.localName},e)}function hw(e){var t=e.$descriptor;return Ge(t.properties,function(n){var i=n.name;if(n.isVirtual||!En(e,i))return!1;var r=e[i];return r===n.default||r===null?!1:n.isMany?r.length:!0})}var mw={"\n":"#10","\n\r":"#10",'"':"#34","'":"#39","<":"#60",">":"#62","&":"#38"},gw={"<":"lt",">":"gt","&":"amp"};function Ad(e,t,n){return e=wn(e)?e:""+e,e.replace(t,function(i){return"&"+n[i]+";"})}function yw(e){return Ad(e,cw,mw)}function vw(e){return Ad(e,Rd,gw)}function bw(e){return Ge(e,function(t){return t.isAttr})}function _w(e){return Ge(e,function(t){return!t.isAttr})}function Wu(e){this.tagName=e}Wu.prototype.build=function(e){return this.element=e,this},Wu.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?vw(this.value):this.value)},Ar.prototype.build=function(e,t){return this.value=t,e.type==="String"&&t.search(Rd)!==-1&&(this.escape=!0),this};function Uu(e){this.tagName=e}Cd(Uu,Ar),Uu.prototype.serializeTo=function(e){e.appendIndent().append("<"+this.tagName+">"),this.serializeValue(e),e.append("</"+this.tagName+">").appendNewLine()};function yt(e,t){this.body=[],this.attrs=[],this.parent=e,this.propertyDescriptor=t}yt.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=hw(e),this.parseAttributes(bw(r)),this.parseContainments(_w(r))),this.parseGenericAttributes(e,i),this},yt.prototype.nsTagName=function(e){var t=this.logNamespaceUsed(e.ns);return fw(t,e)},yt.prototype.nsPropertyTagName=function(e){var t=this.logNamespaceUsed(e.ns);return dw(t,e)},yt.prototype.isLocalNs=function(e){return e.uri===this.ns.uri},yt.prototype.nsAttributeName=function(e){var t;if(wn(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}:z({localName:t.localName},n)},yt.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}))},yt.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 yt(this).build(i))})},yt.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)}},yt.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},yt.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)}})},yt.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(hd(r.type))L(o,function(u){n.push(new Uu(t.addTagName(t.nsPropertyTagName(r))).build(r,u))});else if(a)L(o,function(u){n.push(new Wu(t.addTagName(t.nsPropertyTagName(r))).build(u))});else{var c=Ed(r);L(o,function(u){var l;c?c===wd?l=new yt(t,r):l=new as(t,r,c):l=new yt(t),n.push(l.build(u))})}})},yt.prototype.getNamespaces=function(e){var t=this.namespaces,n=this.parent,i;return t||(i=n&&n.getNamespaces(),e||!i?this.namespaces=t=new li(i):t=i),t},yt.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},yt.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},yt.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)})},yt.prototype.addTagName=function(e){var t=this.logNamespaceUsed(e);return this.getNamespaces().logUsed(t),Pd(e)},yt.prototype.addAttribute=function(e,t){var n=this.attrs;wn(t)&&(t=yw(t));var i=ld(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)},yt.prototype.serializeAttributes=function(e){var t=this.attrs,n=this.namespaces;n&&(t=pw(n).concat(t)),L(t,function(i){e.append(" ").append(Pd(i.name)).append('="').append(i.value).append('"')})},yt.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 as(e,t,n){yt.call(this,e,t),this.serialization=n}Cd(as,yt),as.prototype.parseNsAttributes=function(e){var t=yt.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},as.prototype.isLocalNs=function(e){return e.uri===(this.typeNs||this.ns).uri};function xw(){this.value="",this.write=function(e){this.value+=e}}function ww(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 Ew(e){e=z({format:!1,preamble:!0},e||{});function t(n,i){var r=i||new xw,o=new ww(r,e.format);e.preamble&&o.append(sw);var a=new yt,s=n.$model;if(a.getNamespaces().mapDefaultPrefixes(Sw(s)),a.build(n).serializeTo(o),!i)return r.value}return{toXML:t}}function Sw(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 ss(e,t){zn.call(this,e,t)}ss.prototype=Object.create(zn.prototype),ss.prototype.fromXML=function(e,t,n){wn(t)||(n=t,t="bpmn:Definitions");var i=new Vu(z({model:this,lax:!0},n)),r=i.handler(t);return i.fromXML(e,r)},ss.prototype.toXML=function(e,t){var n=new Ew(t);return new Promise(function(i,r){try{var o=n.toXML(e);return i({xml:o})}catch(a){return r(a)}})};var Rw="BPMN20",Cw="http://www.omg.org/spec/BPMN/20100524/MODEL",Pw="bpmn",Aw=[],Tw=[{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"}]}],Mw=[{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"}]}],kw={tagAlias:"lowerCase",typePrefix:"t"},Ow={name:Rw,uri:Cw,prefix:Pw,associations:Aw,types:Tw,enumerations:Mw,xml:kw},Dw="BPMNDI",Lw="http://www.omg.org/spec/BPMN/20100524/DI",Iw="bpmndi",Bw=[{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"]}],Nw=[{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"}]}],$w=[],Fw={name:Dw,uri:Lw,prefix:Iw,types:Bw,enumerations:Nw,associations:$w},jw="DC",Hw="http://www.omg.org/spec/DD/20100524/DC",zw="dc",Gw=[{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}]}],Vw=[],Ww={name:jw,uri:Hw,prefix:zw,types:Gw,associations:Vw},Uw="DI",qw="http://www.omg.org/spec/DD/20100524/DI",Yw="di",Kw=[{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"}]}],Xw=[],Zw={tagAlias:"lowerCase"},Qw={name:Uw,uri:qw,prefix:Yw,types:Kw,associations:Xw,xml:Zw},Jw="bpmn.io colors for BPMN",eE="http://bpmn.io/schema/bpmn/biocolor/1.0",tE="bioc",nE=[{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"}]}],iE=[],rE=[],oE={name:Jw,uri:eE,prefix:tE,types:nE,enumerations:iE,associations:rE},aE="BPMN in Color",sE="http://www.omg.org/spec/BPMN/non-normative/color/1.0",cE="color",uE=[{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"}]}],lE=[],pE=[],fE={name:aE,uri:sE,prefix:cE,types:uE,enumerations:lE,associations:pE};const dE={bpmn:Ow,bpmndi:Fw,dc:Ww,di:Qw,bioc:oE,color:fE};function Td(e,t){const n=z({},dE,e);return new ss(n,t)}const hE={name:"bpmn-i18n",uri:"http://www.omg.org/spec/BPMN/non-normative/extensions/i18n/1.0",prefix:"i18n",types:[{name:"Translation",superClass:["Element"],properties:[{name:"id",isAttr:!0,isId:!0,type:"String"},{name:"body",isBody:!0,type:"String"},{name:"target",isAttr:!0,type:"String",default:"@name"},{name:"textFormat",isAttr:"true",type:"String",default:"text/plain"}]}],enumerations:[],associations:[],xml:{tagAlias:"lowerCase",typePrefix:"t"}},mE="http://www.omg.org/spec/BPMN/non-normative/extensions/i18n/1.0",Md="i18n",cs={[Md]:hE,[Tu]:od};function kd(){return Td(cs)}const Od=kd();async function qu(e){const{rootElement:t,warnings:n}=await Od.fromXML(e,"bpmn:Definitions");return{definitions:t,warnings:n}}async function gE(e){const{xml:t}=await Od.toXML(e,{format:!0});return t}function Yu(e){return e.map(t=>typeof t=="string"?t:t.message??String(t))}const io={cjkEm:.865,upperEm:.68,lowerEm:.5,digitEm:.556,spaceEm:.278,otherEm:.35,ascentEm:.9,descentEm:.25},yE=/[ᄀ-ᇿ -〿぀-ヿ㐀-鿿가-힯＀-⦆]/;function vE(e){const t=io;return yE.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 ro(e,t){let n=0;for(const i of e)n+=t*vE(i);return n}function Dd(e=globalThis,{textMeasurement:t="approximate"}={}){if(!(e!=null&&e.SVGElement))throw new Error("installHeadlessBpmnDom: DOM 전역이 없다 — jsdom window 를 전역에 올린 뒤 호출할 것");t==="approximate"&&bE(e),_E(e),xE(e),wE(e)}function bE(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:ro(r,o),fontBoundingBoxAscent:o*io.ascentEm,fontBoundingBoxDescent:o*io.descentEm,actualBoundingBoxAscent:o*io.ascentEm,actualBoundingBoxDescent:o*io.descentEm}}};t.getContext=()=>n}function _E(e){if(e.SVGMatrix)return;class t{constructor(){Xr(this,"a",1);Xr(this,"b",0);Xr(this,"c",0);Xr(this,"d",1);Xr(this,"e",0);Xr(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 xE(e){var o;const t=()=>{const a=new e.SVGMatrix;return{type:0,matrix:a,setTranslate(s,c){a.e=s,a.f=c},setScale(s,c){a.a=s,a.d=c},setRotate(s,c=0,u=0){const l=s*Math.PI/180,f=Math.cos(l),p=Math.sin(l);a.a=f,a.b=p,a.c=-p,a.d=f,a.e=c-f*c+p*u,a.f=u-p*c-f*u},setMatrix(s){Object.assign(a,s)}}},n=a=>{const s=t();return Object.assign(s.matrix,a),s},i=(o=e.SVGSVGElement)==null?void 0:o.prototype;i&&!i.createSVGTransform&&(i.createSVGTransform=t,i.createSVGTransformFromMatrix=n,i.createSVGMatrix=()=>new e.SVGMatrix,i.createSVGPoint=()=>({x:0,y:0,matrixTransform:()=>({x:0,y:0})}));const r=e.SVGElement.prototype;Object.getOwnPropertyDescriptor(r,"transform")||Object.defineProperty(r,"transform",{configurable:!0,get(){if(!this.__headlessTransformList){const a=[];this.__headlessTransformList={baseVal:{get numberOfItems(){return a.length},clear:()=>{a.length=0},appendItem:s=>(a.push(s),s),getItem:s=>a[s],createSVGTransformFromMatrix:n,consolidate:()=>a[a.length-1]??null}}}return this.__headlessTransformList}})}function wE(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:ro(n,12),height:14}})}const us=new Set(["bpmn:Participant","bpmn:Lane","bpmn:Group","bpmn:SubProcess","bpmn:AdHocSubProcess","bpmn:Transaction"]),EE=1,Ku=new Set(["bpmn:TextAnnotation","bpmn:DataStoreReference","bpmn:DataObjectReference","bpmn:DataInput","bpmn:DataOutput"]),SE=2;function ii(e){switch(e.kind){case"label-over-line":return`L|${e.edge}|${e.line}`;case"edge-crosses-shape":return`x|${e.edge}|${e.shape}`;case"shape-overlap":return`o|${e.shapes[0]}|${e.shapes[1]}`;case"shape-outside-container":return`c|${e.shape}|${e.container}`;case"edge-overlap-opposite":return`p|${e.edges[0]}|${e.edges[1]}`;case"edge-overlap-mixed":return`m|${e.edges[0]}|${e.edges[1]}`;case"edge-overlap-unrelated":return`u|${e.edges[0]}|${e.edges[1]}`;case"label-on-shared-segment":return`l|${e.edge}|${e.other}`;case"annotation-over-label":return`a|${e.annotation}|${e.label}`;case"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 Ld=20,ls=5,Id=3,RE=8,Bd=12,CE=Bd*1.2;function Xu(e,t){const n=t.split(/\r?\n/),i=Math.max(...n.map(o=>ro(o,Bd))),r=n.length*CE;return{x:e.x+e.width/2-i/2,y:e.y+e.height/2-r/2,width:i,height:r}}const Nd=1;function pn(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 oo(e,t){let n=null;const i=e.type!==t.type,o=!!(e.source&&e.target&&t.source&&t.target)&&e.source!==t.source&&e.source!==t.target&&e.target!==t.source&&e.target!==t.target;for(const a of pn(e))for(const s of pn(t)){if(a.axis!==s.axis||Math.abs(a.at-s.at)>Nd)continue;const c=a.dir!==s.dir?"opposite":i?"mixed":o?"unrelated":null;if(!c)continue;const u=Math.min(a.hi,s.hi)-Math.max(a.lo,s.lo);u>=Ld&&(!n||u>n.length)&&(n={axis:a.axis,length:u,kind:c})}return n}function Zu(e){return e.kind==="edge-overlap-opposite"||e.kind==="edge-overlap-mixed"||e.kind==="edge-overlap-unrelated"}function $d(e,t){const n=oo(e,t);return n&&n.kind==="opposite"?{axis:n.axis,length:n.length}:null}function PE(e,t){let n=0;for(const i of t)i.id!==e.id&&$d(e,i)&&n++;return n}function In(e,t){let n=0;for(const i of t)i.id!==e.id&&oo(e,i)&&n++;return n}const Fd=15,jd=20;function AE(e,t){const n=t.axis==="v"?[e.x,e.x+e.width]:[e.y,e.y+e.height];if(t.at<n[0]-jd||t.at>n[1]+jd)return null;const i=t.axis==="v"?[e.y,e.y+e.height]:[e.x,e.x+e.width],r=Math.max(i[0],t.lo),o=Math.min(i[1],t.hi);return o>r?[r,o]:null}const Qu=20;function ps(e,t){const n=[];for(const i of t){if(i.axis!==e.axis||Math.abs(i.at-e.at)>Nd)continue;const r=Math.max(e.lo,i.lo),o=Math.min(e.hi,i.hi);o-r<Ld||n.push([r-Qu,o+Qu])}return n}function fs(e,t){const n=e.label;if(!n)return null;let i=null;for(const r of pn(e)){const o=AE(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,pn(a)))if(Math.min(c,o[1])>Math.max(s,o[0])){i={other:a.id,axis:r.axis};break}}}}return i}const TE=1,ME=(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 kE(e,t,n,i){const r=n.x+i,o=n.y+i,a=n.x+n.width-i,s=n.y+n.height-i;if(a<=r||s<=o)return!1;const c=t.x-e.x,u=t.y-e.y;let l=0,f=1;const p=(d,g)=>{if(g===0)return d<=0;const h=d/g;if(g>0){if(h>f)return!1;h>l&&(l=h)}else{if(h<l)return!1;h<f&&(f=h)}return!0};return p(r-e.x,c)&&p(e.x-a,-c)&&p(o-e.y,u)&&p(e.y-s,-u)&&f>l}function Ju(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 OE=(e,t)=>e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height,ao=1;function Pi(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 Ko(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 Hd(e,t){const n=e.label;if(!n)return null;if(pn(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(pn(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(Ko(i).some(r=>Pi(n,r)))return i.id;return null}function fn(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(kE(e.waypoints[o],e.waypoints[o+1],r,SE)){i.push(r);break}}return i}function DE(e,t,n,i){const r=(u,l,f)=>(l.x-u.x)*(f.y-u.y)-(l.y-u.y)*(f.x-u.x),o=r(n,i,e),a=r(n,i,t),s=r(e,t,n),c=r(e,t,i);return o*a<0&&s*c<0}const zd=(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||zd(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++)DE(e.waypoints[o],e.waypoints[o+1],i.waypoints[a],i.waypoints[a+1])&&(r=!0);r&&n++}return n}function Bn(e,t){let n=0;for(const i of t)i.id===e.id||zd(e,i)||ds(e,[i])>0&&(n+=i.type===e.type?2:1);return n}function Gd(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 el(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 Vd(e){const t=el(e),n=a=>a==="bpmn:MessageFlow"||a.endsWith("Association")?"dashed":"solid",i=new Map(e.edges.map(a=>[a.id,a]));let r=0,o=0;for(const[a,s]of t){const c=i.get(a),u=i.get(s);if(!c||!u)continue;const l=n(c.type),f=n(u.type);l==="solid"&&f==="solid"?r++:l==="dashed"&&f==="dashed"&&o++}return{pairs:t,solidPairs:r,dashedPairs:o,mixedPairs:t.length-r-o,crossPoolMessages:LE(e)}}function LE(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 Wd(e,t,n){const i=new Set(t.flatMap(r=>[...r.members]));return e.shapes.filter(r=>!r.container&&!Ku.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 Ud(e){var n;const t=(n=mt(e==null?void 0:e.extensionElements))==null?void 0:n.values;if(Array.isArray(t))for(const i of t){const r=mt(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 qd=e=>e?{members:e}:{},Gn=e=>e.shapes.filter(t=>!t.container);function IE(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 Yd(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(pn(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(Ko(i).some(r=>Pi(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 ri(e){const t=[],n=e.shapes.filter(h=>!h.container);for(const h of e.edges)for(const m of fn(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 _=i[h],y=i[m];if(!Ju(_,y,EE))continue;const x=_.id<y.id?[_.id,y.id]:[y.id,_.id];t.push({kind:"shape-overlap",shapes:x,identical:OE(_,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 _=r[h],y=r[m],x=Math.min(_.x+_.width,y.x+y.width)-Math.max(_.x,y.x),S=Math.min(_.y+_.height,y.y+y.height)-Math.max(_.y,y.y);if(x<=ls||S<=ls)continue;const P=_.id<y.id?[_.id,y.id]:[y.id,_.id],C=new Set(y.members);if(_.members.some(T=>C.has(T))){const T=Wd(e,r,{x:Math.max(_.x,y.x),y:Math.max(_.y,y.y),right:Math.min(_.x+_.width,y.x+y.width),bottom:Math.min(_.y+_.height,y.y+y.height)});T.length&&t.push({kind:"group-overlap-unreadable",reason:"orphan",groups:P,shapes:T});continue}const D=_.x<=y.x&&_.y<=y.y&&_.x+_.width>=y.x+y.width&&_.y+_.height>=y.y+y.height?_.id:y.x<=_.x&&y.y<=_.y&&y.x+y.width>=_.x+_.width&&y.y+y.height>=_.y+_.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&&!Ku.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 _=new Set(h.members),y=m.filter(x=>!_.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)),_=new Set(h.members),y=new Set([...m].filter(C=>!_.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 _=m+1;_<s.length;_++){const y=[s[h],s[m],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<=ls||x.bottom-x.y<=ls)continue;const S=Wd(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||Ku.has(m.type)||m.width<=0||m.height<=0)continue;const _=[["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 _){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 $=S==="h"?m.y:m.x,k=S==="h"?m.y+m.height:m.x+m.width;if(!($<x&&x<k))continue;const O=Math.min(x-$,k-x);O<RE||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 _=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,_],["bottom",h.y+h.height,m.y+m.height,_],["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)<=Id&&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 _=u[h],y=u[m],x=_.x<y.x+y.width&&y.x<_.x+_.width,S=_.y<y.y+y.height&&y.y<_.y+_.height,P=[["x",_.x+_.width,y.x,S],["x",y.x+y.width,_.x,S],["y",_.y+_.height,y.y,x],["y",y.y+y.height,_.y,x]];for(const[C,D,T,$]of P)if($&&Math.abs(D-T)<=Id){t.push({kind:"group-on-group-boundary",groups:_.id<y.id?[_.id,y.id]:[y.id,_.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.edges[h],y=e.edges[m],x=oo(_,y);if(!x)continue;const S=_.id<y.id?[_.id,y.id]:[y.id,_.id];t.push({kind:x.kind==="opposite"?"edge-overlap-opposite":x.kind==="mixed"?"edge-overlap-mixed":"edge-overlap-unrelated",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=Hd(h,e);m&&t.push({kind:"label-over-line",edge:h.id,line:m})}const l=new Set(n.map(h=>h.id)),f=e.shapes.filter(h=>h.type==="bpmn:Participant"&&h.label);for(const h of[...n,...f.filter(m=>!l.has(m.id))]){if(!h.label)continue;const m=Yd(h,e);m&&t.push({kind:"label-over-line",edge:h.id,line:m})}const p=new Set(e.shapes.filter(h=>h.type==="bpmn:TextAnnotation").map(h=>h.id));for(const h of f)for(const{owner:m,rect:_}of so(e))m===h.id||p.has(m)||Ju(h.label,_,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:_}of d)m!==h.id&&Ju(h,_,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??IE(h,e,g);if(!m)continue;const _=g.get(m);!_||!_.container||ME(_,h,TE)||t.push({kind:"shape-outside-container",shape:h.id,container:_.id})}return t.sort((h,m)=>ii(h).localeCompare(ii(m)))}const mt=e=>typeof e=="object"&&e!==null?e:void 0,Et=e=>typeof e=="number"?e:0,Ai=e=>{const t=mt(e);return typeof(t==null?void 0:t.id)=="string"?t.id:void 0};function BE(e){const t=mt(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 NE(e){const t=mt(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 $E(e,t){const n=mt(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(us.has(i)&&i!=="bpmn:Lane"&&i!=="bpmn:Group")return Ai(n)}function Kd(e){var a,s,c,u,l;const t=[],n=[],i=((a=mt(e))==null?void 0:a.diagrams)??[],r=new Map,o=new Set;for(const f of((s=mt(e))==null?void 0:s.rootElements)??[]){const p=mt(f);if((p==null?void 0:p.$type)==="bpmn:Collaboration")for(const d of p.participants??[]){const g=mt(d),h=Ai(g),m=Ai(g==null?void 0:g.processRef);h&&m?r.set(m,h):h&&o.add(h)}}for(const f of i){const p=mt((c=mt(f))==null?void 0:c.plane),d=(p==null?void 0:p.planeElement)??[];for(const g of d){const h=mt(g);if(!h)continue;const m=mt(h.bpmnElement),_=typeof(m==null?void 0:m.id)=="string"?m.id:void 0;if(!_)continue;const y=typeof(m==null?void 0:m.$type)=="string"?m.$type:"",x=mt(h.bounds);if(x){const P=h.isExpanded===!1&&y!=="bpmn:Participant",C=mt((u=mt(h.label))==null?void 0:u.bounds),D={id:_,type:y,x:Et(x.x),y:Et(x.y),width:Et(x.width),height:Et(x.height),container:us.has(y)&&!P,attached:(m==null?void 0:m.attachedToRef)!==void 0,...m?{parent:$E(m,r)}:{},...C?{label:{x:Et(C.x),y:Et(C.y),width:Et(C.width),height:Et(C.height)}}:{},...y==="bpmn:Group"?qd(Ud(m)):{}},T=h.isHorizontal!==!1,$=typeof(m==null?void 0:m.name)=="string"?m.name:"";o.has(_)&&T&&$&&(D.label=Xu(D,$)),t.push(D);continue}const S=h.waypoint;if(Array.isArray(S)){const P=mt((l=mt(h.label))==null?void 0:l.bounds);n.push({id:_,type:y,waypoints:S.map(C=>{var D,T;return{x:Et((D=mt(C))==null?void 0:D.x),y:Et((T=mt(C))==null?void 0:T.y)}}),endpoints:BE(m),...NE(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 Xd(e){return ri(Kd(e))}async function FE(e){const{definitions:t,warnings:n}=await qu(e);return{findings:Xd(t),warnings:n}}function pt(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=mt(o.label),m=Ai(o.source),_=Ai(o.target);n.push({id:o.id,type:a,waypoints:s.map(y=>({x:Et(y.x),y:Et(y.y)})),endpoints:[m,_].filter(y=>!!y),...m&&_?{source:m,target:_}:{},...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=mt(o.businessObject),u=mt(o.label);let l=mt(o.parent);for(;l&&l.type==="bpmn:Lane";)l=mt(l.parent);const f=typeof(l==null?void 0:l.type)=="string"?l.type:"",p=l&&us.has(f)&&f!=="bpmn:Group"&&typeof l.id=="string"?l.id:void 0,d={id:o.id,type:a,x:o.x,y:o.y,width:Et(o.width),height:Et(o.height),container:us.has(a)&&(a==="bpmn:Participant"||o.collapsed!==!0),attached:(c==null?void 0:c.attachedToRef)!==void 0,...p!==void 0?{parent:p}:{},...u&&typeof u.x=="number"?{label:{x:u.x,y:Et(u.y),width:Et(u.width),height:Et(u.height)}}:{},...a==="bpmn:Group"?qd(Ud(c)):{}},g=typeof(c==null?void 0:c.name)=="string"?c.name:"";a==="bpmn:Participant"&&!(c!=null&&c.processRef)&&g&&((i=mt(o.di))==null?void 0:i.isHorizontal)!==!1&&(d.label=Xu(d,g)),t.push(d)}return{shapes:t,edges:n}}const jE={"bpmn:Participant":"participant","bpmn:Lane":"lane","bpmn:SequenceFlow":"sequenceFlow","bpmn:MessageFlow":"messageFlow","bpmn:DataStoreReference":"dataStore","bpmn:DataInputAssociation":"dataAssociation","bpmn:DataOutputAssociation":"dataAssociation","bpmn:TextAnnotation":"annotation","bpmn:Association":"association","bpmn:Group":"group"};function HE(e,t){const n=jE[e];return n||(e==="label"||e.startsWith("bpmndi:")?"other":e.startsWith("bpmn:")&&!("waypoints"in t&&t.waypoints)?"flowNode":"other")}function Zd(e){let t=e.parent;for(;t;){if(t.type==="bpmn:Participant")return t.id;t=t.parent}}function Qd(e){const t=()=>e.getAll().filter(n=>n.type!=="label"&&!("labelTarget"in n&&n.labelTarget));return{isCollaboration:()=>t().some(n=>n.type==="bpmn:Participant"),categoryOf:n=>{const i=e.get(n);if(!(!i||i.type==="label"))return HE(i.type,i)},lanesOf:n=>t().filter(i=>i.type==="bpmn:Lane"&&Zd(i)===n).sort((i,r)=>i.y-r.y).map(i=>i.id),participantOf:n=>{const i=e.get(n);return i?Zd(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 tl=20,zE=4,ft=(e,t)=>Math.abs(e-t)<.5;function nl(e,t,n,i=tl){if(ft(e.y,t.y)&&!ft(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(ft(e.x,t.x)&&!ft(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 Jd(e,t,n,i=tl){if(n.length<2)return null;if(ft(e.y,t.y)&&!ft(e.x,t.x)){const r=Math.min(e.x,t.x),o=Math.max(e.x,t.x),a=Math.min(...n.map(d=>d.x))-i,s=Math.max(...n.map(d=>d.x+d.width))+i;if(!(r<a&&s<o))return null;const c=e.x<t.x?a:s,u=e.x<t.x?s:a,l=Math.min(...n.map(d=>d.y))-i,f=Math.max(...n.map(d=>d.y+d.height))+i,p=d=>[{x:c,y:e.y},{x:c,y:d},{x:u,y:d},{x:u,y:e.y}];return[p(l),p(f)]}if(ft(e.x,t.x)&&!ft(e.y,t.y)){const r=Math.min(e.y,t.y),o=Math.max(e.y,t.y),a=Math.min(...n.map(d=>d.y))-i,s=Math.max(...n.map(d=>d.y+d.height))+i;if(!(r<a&&s<o))return null;const c=e.y<t.y?a:s,u=e.y<t.y?s:a,l=Math.min(...n.map(d=>d.x))-i,f=Math.max(...n.map(d=>d.x+d.width))+i,p=d=>[{x:e.x,y:c},{x:d,y:c},{x:d,y:u},{x:e.x,y:u}];return[p(l),p(f)]}return null}function eh(e,t,n=tl){if(e.length!==4)return null;const[i,r,o,a]=e;if(ft(i.y,r.y)&&ft(r.x,o.x)&&ft(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(ft(i.x,r.x)&&ft(r.y,o.y)&&ft(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 il(e,t){if(e.endpoints.length!==2)return[];const n=t.find(f=>f.id===e.endpoints[0]),i=t.find(f=>f.id===e.endpoints[1]);if(!n||!i)return[];if(i.x<=n.x+n.width)return[];const r=n.y+n.height/2,o=i.y+i.height/2;if(r>=i.y&&r<=i.y+i.height)return[];const a=i.x+i.width/2,s=n.x+n.width/2,c=r>o,u=[{x:n.x+n.width,y:r},{x:a,y:r},{x:a,y:c?i.y+i.height:i.y}],l=[{x:s,y:c?n.y:n.y+n.height},{x:s,y:o},{x:i.x,y:o}];return[u,l]}const th=30,GE=[0,-25,25,-40,40];function VE(e,t){if(e.type!=="bpmn:MessageFlow"||e.endpoints.length!==2)return[];const n=t.find(p=>p.id===e.endpoints[0]),i=t.find(p=>p.id===e.endpoints[1]);if(!n||!i)return[];const r=n.y+n.height/2,o=i.y+i.height/2;if(i.y<n.y+n.height&&i.y+i.height>n.y)return[];const a=o<r,s=a?n.y+n.height:n.y,c=a?s+th:s-th,u=a?i.y+i.height:i.y,l=n.x+n.width/2,f=i.x+i.width/2;return GE.map(p=>[{x:l,y:s},{x:l,y:c},{x:f+p,y:c},{x:f+p,y:u}])}const nh=(e,t,n)=>[...e.slice(0,t+1),...n,...e.slice(t+1)],co=(e,t,n)=>fn({...e,waypoints:t},n).length;function ih(e,t,n,i){let r=[...e.waypoints],o=co(e,r,t);if(o===0)return null;let a=!1;for(const f of il(e,t))if(co(e,f,t)===0)return f;const s=(i??[]).filter(f=>f.id!==e.id).flatMap(pn),c=f=>pn({...e,waypoints:f}).some(p=>ps(p,s).length>0),u=VE(e,t).filter(f=>co(e,f,t)===0);if(u.length)return u.find(f=>!c(f))??u[0];const l=f=>!n||f.every(p=>p.x>=n.x&&p.x<=n.x+n.width&&p.y>=n.y&&p.y<=n.y+n.height);if(e.endpoints.length===2&&r.length>2){const f=t.find(d=>d.id===e.endpoints[0]),p=t.find(d=>d.id===e.endpoints[1]);if(f&&p&&ft(f.y+f.height/2,p.y+p.height/2)){const d=[r[0],r[r.length-1]];if(ft(d[0].y,d[1].y)&&!ft(d[0].x,d[1].x)){const g=t.filter(y=>!e.endpoints.includes(y.id)&&fn({...e,waypoints:d},[y]).length>0),h=g.length>=2?Jd(d[0],d[1],g):null,_=(h?h.map(y=>[d[0],...y,d[1]]):g.length===1?(nl(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(_.length)return _.find(y=>!c(y))??_[0]}}}for(let f=0;f+1<r.length;f++){const p=r[f],d=r[f+1],g=t.filter(_=>!e.endpoints.includes(_.id)&&fn({...e,waypoints:[p,d]},[_]).length>0);if(g.length<2)continue;const h=Jd(p,d,g);if(!h)continue;const m=h.map(_=>nh(r,f,_)).filter(_=>co(e,_,t)===0).sort((_,y)=>Number(l(y))-Number(l(_)));if(m.length)return m.find(_=>!c(_))??m[0]}for(let f=0;f<zE&&o>0;f++){let p=!1;for(let d=0;d+1<r.length&&!p;d++){const g=r[d],h=r[d+1];for(const m of t){if(e.endpoints.includes(m.id)||fn({...e,waypoints:[g,h]},[m]).length===0)continue;const _=nl(g,h,m),y=_?_.map(S=>nh(r,d,S)):eh(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,p=!0,a=!0;break}}if(p)break}}if(!p)break}return a&&o===0?r:null}function rh(e,t){const{elementRegistry:n}=e,i=e.modeling,r=pt(n),o=Gn(r),a=ri(r).filter(c=>c.kind==="edge-crosses-shape"&&!t.has(ii(c)));if(!a.length)return;const s=new Map;for(const c of a){if(c.kind!=="edge-crosses-shape"||s.has(c.edge))continue;const u=r.edges.find(l=>l.id===c.edge);u&&s.set(c.edge,u)}for(const[c,u]of s){const l=n.get(c);if(!l)continue;const f=l.parent,p=f&&typeof f.x=="number"&&typeof f.width=="number"?{x:f.x,y:f.y,width:f.width,height:f.height}:void 0,d=ih(u,o,p,r.edges);if(!d)continue;const g=r.edges.filter(_=>_.id!==c),h=In(u,g);In({...u,waypoints:d},g)>h||i.updateWaypoints(l,d)}}const WE=10;function oh(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 ah(e,t){if(e.waypoints.length<2||e.endpoints.length!==2)return null;const n=t.shapes.filter(j=>j.type==="bpmn:Participant"&&j.container),i=t.shapes.find(j=>j.id===e.endpoints[0]),r=t.shapes.find(j=>j.id===e.endpoints[1]);if(!i||!r)return null;const o=oh(i,n),a=oh(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(j=>j.id!==o.id&&j.id!==a.id&&j.y>=c.y+c.height&&j.y+j.height<=u.y).sort((j,oe)=>j.y-oe.y);if(!l.length)return null;const f=l[0],p=l[l.length-1],d=(c.y+c.height+f.y)/2,g=(p.y+p.height+u.y)/2,h=s?d:g,m=s?g:d,_=e.waypoints[0],y=e.waypoints[e.waypoints.length-1],x=Gn(t),S=t.edges.filter(j=>j.id!==e.id),P=Bn(e,S),C=fn(e,x).length;if(P===0&&C===0||C===0&&e.waypoints.length===2)return null;const D=Math.min(...l.map(j=>j.x)),T=Math.max(...l.map(j=>j.x+j.width)),$=(_.x+y.x)/2,k=j=>j.filter((oe,xe)=>xe===0||!(ft(oe.x,j[xe-1].x)&&ft(oe.y,j[xe-1].y)));let O;for(let j=D;j<=T;j+=WE){const oe=k([_,{x:_.x,y:h},{x:j,y:h},{x:j,y:m},{x:y.x,y:m},y]),xe={...e,waypoints:oe};if(fn(xe,x).length>0)continue;const Ue=Bn(xe,S),Y=Math.abs(j-$);(!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 sh(e,t){const{elementRegistry:n}=e,i=e.modeling,r=pt(n);for(const o of r.edges){if(o.type!=="bpmn:MessageFlow"||t.has(o.id))continue;const a=pt(n),s=a.edges.find(l=>l.id===o.id);if(!s)continue;const c=ah(s,a);if(!c)continue;const u=n.get(o.id);u&&i.updateWaypoints(u,c)}}const Ki=[25,-25,40,-40],hs=35;function ms(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,f=[];for(const y of[0,...Ki]){if(Math.abs(y)>=i.width/2-5)continue;const x=o+y;f.push({pts:[{x:n.x,y:r},{x,y:r},{x,y:c}],cost:Math.abs(y)});for(const S of[0,...Ki]){if(Math.abs(S)>=n.width/2-5)continue;const P=a+S;f.push({pts:[{x:P,y:u},{x:P,y:l},{x,y:l},{x,y:c}],cost:Math.abs(y)+Math.abs(S)})}}const p=50,d=i.y+i.height/2,g=s?n.y+n.height:n.y;for(const y of[0,...Ki]){if(Math.abs(y)>=n.width/2-5)continue;const x=a+y;f.push({pts:[{x,y:g},{x,y:d},{x:i.x+i.width,y:d}],cost:p+Math.abs(y)})}const h=60,m=s?i.y+i.height:i.y,_=s?i.y+i.height+hs:i.y-hs;for(const y of[0,...Ki]){if(Math.abs(y)>=i.width/2-5)continue;const x=o+y;for(const S of[0,...Ki]){if(Math.abs(S)>=n.width/2-5)continue;const P=a+S;f.push({pts:[{x:P,y:g},{x:P,y:_},{x,y:_},{x,y:m}],cost:h+Math.abs(y)+Math.abs(S)})}}return f}const gs=30;function ch(e,t){for(let n=1;n<e.length-2;n++){const i=e[n],r=e[n+1],o=ft(i.y,r.y)&&!ft(i.x,r.x),a=ft(i.x,r.x)&&!ft(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)<gs||Math.abs(i.y-(s.y+s.height))<gs)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)<gs||Math.abs(i.x-(s.x+s.width))<gs)return!0}}return!1}const ys=40;function UE(e,t,n){let i=0;for(const r of t){if(r.container||n.includes(r.id))continue;const o=r.x-ys,a=r.x+r.width+ys,s=r.y-ys,c=r.y+r.height+ys;for(let u=1;u<e.length-2;u++){const l=e[u],f=e[u+1],p={x:Math.min(l.x,f.x),y:Math.min(l.y,f.y)},d={x:Math.max(l.x,f.x),y:Math.max(l.y,f.y)};if(p.x<a&&d.x>o&&p.y<c&&d.y>s){i++;break}}}return i}function uh(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=Gn(t),o=t.edges.filter(C=>C.id!==e.id),a=In(e,o),s=Bn(e,o),c=C=>UE(C,t.shapes,e.endpoints)+(ch(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($=>$.type==="bpmn:Lane"&&D>=$.x&&D<=$.x+$.width&&T>=$.y&&T<=$.y+$.height)},f=l(i.get(e.endpoints[0]??"")),p=l(i.get(e.endpoints[1]??"")),d=!!f&&!!p&&f.id!==p.id,g=C=>{if(!d||!p)return!1;for(let D=1;D<C.length-2;D++){const T=C[D],$=C[D+1];if(ft(T.y,$.y)&&!ft(T.x,$.x)&&T.y>p.y&&T.y<p.y+p.height)return!0}return!1},h=g(e.waypoints),_=(C=>{if(!C)return;const D=C.x+C.width/2,T=C.y+C.height/2;return n.filter($=>$.type==="bpmn:Participant"&&D>=$.x&&D<=$.x+$.width&&T>=$.y&&T<=$.y+$.height).sort(($,k)=>$.width*$.height-k.width*k.height)[0]})(i.get(e.endpoints[0]??"")),y=C=>{if(!_)return 0;let D=0;for(let T=1;T<C.length-1;T++){const $=C[T];($.x<_.x||$.x>_.x+_.width||$.y<_.y||$.y>_.y+_.height)&&D++}return D},x=y(e.waypoints);if(!ch(e.waypoints,n)&&!(d&&!h)&&x===0)return null;const S=C=>C.reduce((D,T,$)=>$?D+Math.abs(T.x-C[$-1].x)+Math.abs(T.y-C[$-1].y):0,0);let P;for(const{pts:C,cost:D}of ms(e,i)){const T={...e,waypoints:C};if(fn(T,r).length>0)continue;const $=In(T,o);if($>a)continue;const k=y(C);if(k>x)continue;const O=k<x&&$===0;if(!O&&Bn(T,o)>s)continue;const j=c(C),oe=g(C);if(!O&&!(oe&&!h)&&j>=u)continue;const Ue=oe?0:1,Y=S(C);(!P||k<P.out||k===P.out&&(Ue<P.lane||Ue===P.lane&&($<P.opp||$===P.opp&&(j<P.sc||j===P.sc&&(D<P.cost||D===P.cost&&Y<P.len)))))&&(P={pts:C,out:k,sc:j,lane:Ue,opp:$,cost:D,len:Y})}return(P==null?void 0:P.pts)??null}function qE(e,t){const{elementRegistry:n}=e,i=e.modeling,r=pt(n).edges.filter(o=>!t.has(o.id)&&o.waypoints.length>=4).map(o=>o.id).sort();for(const o of r){const a=pt(n),s=a.edges.find(d=>d.id===o);if(!s||s.waypoints.length<4)continue;const c=Gn(a),u=a.edges.filter(d=>d.id!==o),l=fn(s,c).length,f=In(s,u),p=Bn(s,u);for(const d of il(s,a.shapes)){if(d.length>=s.waypoints.length)continue;const g={...s,waypoints:d};if(fn(g,c).length>l||In(g,u)>f||Bn(g,u)>p)continue;const h=n.get(o);h&&i.updateWaypoints(h,d);break}}}function lh(e,t){const{elementRegistry:n}=e,i=e.modeling,r=pt(n).edges.filter(o=>o.type==="bpmn:SequenceFlow"&&!t.has(o.id)).map(o=>o.id).sort();for(const o of r){const a=pt(n),s=a.edges.find(l=>l.id===o);if(!s)continue;const c=uh(s,a);if(!c)continue;const u=n.get(o);u&&i.updateWaypoints(u,c)}}function rl(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=ft(n[0].x,n[1].x)&&!ft(n[0].y,n[1].y),s=ft(n[n.length-1].x,n[n.length-2].x)&&!ft(n[n.length-1].y,n[n.length-2].y);for(const c of Ki){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 YE(e,t){if(e.type!=="bpmn:SequenceFlow")return[];const n=t.get(e.endpoints[0]??""),i=t.get(e.endpoints[1]??"");if(!n||!i)return[];if(Math.min(n.x+n.width,i.x+i.width)-Math.max(n.x,i.x)>=1)return[];const r=i.y+i.height<=n.y,o=n.y+n.height<=i.y;if(!r&&!o)return[];const a=i.x>=n.x+n.width,s=i.x+i.width<=n.x;if(!a&&!s)return[];const c=n.x+n.width/2,u=n.y+n.height/2,l=i.x+i.width/2,f=i.y+i.height/2,p=a?n.x+n.width:n.x,d=o?n.y+n.height:n.y,g=a?i.x:i.x+i.width,h=o?i.y:i.y+i.height,m=[];for(const _ of[0,...Ki])Math.abs(_)<i.width/2-5&&m.push({pts:[{x:p,y:u},{x:l+_,y:u},{x:l+_,y:h}],cost:Math.abs(_)}),Math.abs(_)<i.height/2-5&&m.push({pts:[{x:c,y:d},{x:c,y:f+_},{x:g,y:f+_}],cost:Math.abs(_)});return m}function ol(e,t){if(e.type!=="bpmn:SequenceFlow")return[];const n=t.get(e.endpoints[0]??""),i=t.get(e.endpoints[1]??"");if(!n||!i)return[];const r=Math.max(n.x,i.x),o=Math.min(n.x+n.width,i.x+i.width);if(o-r<1)return[];const a=i.y+i.height<=n.y,s=n.y+n.height<=i.y;if(!a&&!s)return[];const c=a?n.y:n.y+n.height,u=a?i.y+i.height:i.y,l=(r+o)/2,f=[];for(const p of[0,...Ki]){const d=l+p;d<=r||d>=o||f.push({pts:[{x:d,y:c},{x:d,y:u}],cost:Math.abs(p)})}return f}function ph(e,t){const n=new Map(t.shapes.map(d=>[d.id,d])),i=Gn(t),r=t.edges.filter(d=>d.id!==e.id),o=In(e,r);if(o===0)return null;const a=Bn(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},f=l(e.waypoints),p=[...ms(e,n),...ol(e,n),...rl(e,n)];for(const{pts:d,cost:g}of p){const h={...e,waypoints:d};if(fn(h,i).length>0)continue;const m=In(h,r),_=Bn(h,r),y=o-m+(f-l(d));if(m>=o||_-a>y)continue;const x=c(d);(!s||m<s.opposite||m===s.opposite&&(_<s.cross||_===s.cross&&(g<s.cost||g===s.cost&&x<s.len)))&&(s={pts:d,opposite:m,cross:_,cost:g,len:x})}return(s==null?void 0:s.pts)??null}function fh(e,t){var i;let n=0;for(const r of t)r.id!==e.id&&((i=oo(e,r))==null?void 0:i.kind)==="unrelated"&&n++;return n}function KE(e,t){const n=new Map(t.shapes.map(p=>[p.id,p])),i=Gn(t),r=t.edges.filter(p=>p.id!==e.id),o=fh(e,r);if(o===0)return null;const a=In(e,r),s=Bn(e,r),c=p=>p.reduce((d,g,h)=>h?d+Math.abs(g.x-p[h-1].x)+Math.abs(g.y-p[h-1].y):0,0),u=2;let l;const f=[...ms(e,n),...ol(e,n),...YE(e,n),...rl(e,n)];for(const{pts:p,cost:d}of f){const g={...e,waypoints:p};if(fn(g,i).length>0)continue;const h=fh(g,r);if(h>=o)continue;const m=In(g,r);if(m-h>a-o)continue;const _=Bn(g,r);if(_-s>(o-h)*u)continue;const y=c(p);(!l||h<l.fake||h===l.fake&&(m<l.unreadable||m===l.unreadable&&(_<l.cross||_===l.cross&&(d<l.cost||d===l.cost&&y<l.length))))&&(l={pts:p,fake:h,unreadable:m,cross:_,cost:d,length:y})}return(l==null?void 0:l.pts)??null}function dh(e,t,n){const{elementRegistry:i}=e,r=e.modeling,o=ri(pt(i)).filter(s=>s.kind==="edge-overlap-unrelated"&&!t.has(ii(s)));if(!o.length)return;const a=new Set;for(const s of o)if(s.kind==="edge-overlap-unrelated")for(const c of s.edges)n.has(c)||a.add(c);for(const s of[...a].sort()){const c=pt(i),u=c.edges.find(p=>p.id===s);if(!u)continue;const l=KE(u,c);if(!l)continue;const f=i.get(s);f&&r.updateWaypoints(f,l)}}function hh(e,t){const n=t.get(e.endpoints[0]??""),i=t.get(e.endpoints[1]??"");return!!n&&!!i&&i.x+i.width>n.x}function mh(e,t,n){var u;if(e.type!=="bpmn:SequenceFlow"||t.type!=="bpmn:SequenceFlow"||((u=oo(e,t))==null?void 0:u.kind)!=="opposite")return!1;const[i,r]=e.endpoints,[o,a]=t.endpoints,s=[i,r].filter(l=>l&&(l===o||l===a)).length;return!(!!r&&r===o||!!a&&a===i)||s!==1?!1:hh(e,n)&&hh(t,n)}function gh(e,t,n){let i=0;for(const r of t)r.id!==e.id&&mh(e,r,n)&&i++;return i}function XE(e,t){const n=new Map(t.shapes.map(p=>[p.id,p])),i=Gn(t),r=t.edges.filter(p=>p.id!==e.id),o=gh(e,r,n);if(o===0)return null;const a=In(e,r),s=Bn(e,r),c=p=>p.reduce((d,g,h)=>h?d+Math.abs(g.x-p[h-1].x)+Math.abs(g.y-p[h-1].y):0,0),u=2;let l;const f=[...ms(e,n),...ol(e,n),...rl(e,n)];for(const{pts:p,cost:d}of f){const g={...e,waypoints:p};if(fn(g,i).length>0)continue;const h=gh(g,r,n);if(h>=o)continue;const m=In(g,r);if(m-h>a-o)continue;const _=Bn(g,r);if(_-s>(o-h)*u)continue;const y=c(p);(!l||h<l.chain||h===l.chain&&(m<l.unreadable||m===l.unreadable&&(_<l.cross||_===l.cross&&(d<l.cost||d===l.cost&&y<l.length))))&&(l={pts:p,chain:h,unreadable:m,cross:_,cost:d,length:y})}return(l==null?void 0:l.pts)??null}function ZE(e,t,n){const{elementRegistry:i}=e,r=e.modeling,o=pt(i),a=new Map(o.shapes.map(u=>[u.id,u])),s=ri(o).filter(u=>u.kind==="edge-overlap-opposite"&&!t.has(ii(u)));if(!s.length)return;const c=new Set;for(const u of s){if(u.kind!=="edge-overlap-opposite")continue;const[l,f]=u.edges.map(p=>o.edges.find(d=>d.id===p));if(!(!l||!f||!mh(l,f,a)))for(const p of u.edges)n.has(p)||c.add(p)}for(const u of[...c].sort()){const l=pt(i),f=l.edges.find(g=>g.id===u);if(!f)continue;const p=XE(f,l);if(!p)continue;const d=i.get(u);d&&r.updateWaypoints(d,p)}}function yh(e,t,n){const{elementRegistry:i}=e,r=e.modeling,o=pt(i),a=ri(o).filter(l=>Zu(l)&&!t.has(ii(l)));if(!a.length)return;const s=new Set;for(const l of a)if(Zu(l))for(const f of l.edges)n.has(f)||s.add(f);const c=l=>{var f;return((f=o.edges.find(p=>p.id===l))==null?void 0:f.type)??""},u=[...s].sort((l,f)=>{const p=c(l)==="bpmn:SequenceFlow"?0:1,d=c(f)==="bpmn:SequenceFlow"?0:1;return p!==d?p-d:l.localeCompare(f)});for(const l of u){const f=pt(i),p=f.edges.find(h=>h.id===l);if(!p)continue;const d=ph(p,f);if(!d)continue;const g=i.get(l);g&&r.updateWaypoints(g,d)}}const QE=10,JE=(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 vh(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=Gn(t),o=i.flatMap(pn);for(const a of pn(e)){let s=[[a.lo,a.hi]];for(const[d,g]of ps(a,o))s=s.flatMap(([h,m])=>{const _=[];return d>h&&_.push([h,Math.min(m,d)]),g<m&&_.push([Math.max(h,g),m]),_.filter(([y,x])=>x>y)});const c=a.axis==="h"?n.width:n.height,u=s.find(([d,g])=>g-d>=c+QE*2);if(!u)continue;const l=(u[0]+u[1])/2,f=a.axis==="h"?{x:l,y:a.at-Fd}:{x:a.at+Rn+n.width/2,y:l},p={x:f.x-n.width/2,y:f.y-n.height/2,width:n.width,height:n.height};if(!fs({...e,label:p},i)&&!r.some(d=>!e.endpoints.includes(d.id)&&JE(p,d)))return p}return null}const Rn=8;function bh(e,t){const n=e.label;if(!n)return null;const i=pn(e);if(!i.length)return null;const r=n.x+n.width/2,o=n.y+n.height/2,a=p=>{const d=p.axis==="h"?r:o,g=p.axis==="h"?o-p.at:r-p.at,h=d<p.lo?p.lo-d:d>p.hi?d-p.hi:0;return Math.hypot(g,h)},s=i.reduce((p,d)=>a(d)<a(p)?d:p,i[0]),c=[...i,...t.edges.filter(p=>p.id!==e.id).flatMap(pn),...t.shapes.filter(p=>p.container).flatMap(Ko)],u=p=>!c.some(d=>Pi(p,d));if(u(n))return null;const l=(s.axis==="v"?n.height:n.width)+Rn,f=[0,-l,l,-2*l,2*l];if(s.axis==="v")for(const p of[s.at+Rn,s.at-Rn-n.width])for(const d of f){const g=n.y+d;if(g<s.lo||g+n.height>s.hi)continue;const h={...n,x:p,y:g};if(u(h))return h}else for(const p of[s.at-Rn-n.height,s.at+Rn])for(const d of f){const g=n.x+d;if(g<s.lo||g+n.width>s.hi)continue;const h={...n,x:g,y:p};if(u(h))return h}return null}function _h(e,t){const{elementRegistry:n}=e,i=e.modeling,r=pt(n);for(const o of r.edges){if(!o.label||t.has(o.id))continue;const a=bh(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 xh(e,t,n){const{elementRegistry:i}=e,r=e.modeling,o=pt(i),a=ri(o).filter(s=>s.kind==="label-on-shared-segment"&&!t.has(ii(s)));for(const s of a){if(s.kind!=="label-on-shared-segment"||n.has(s.edge))continue;const c=o.edges.find(p=>p.id===s.edge);if(!c)continue;const u=vh(c,o);if(!u)continue;const l=i.get(s.edge),f=l==null?void 0:l.label;f&&r.moveElements([f],{x:u.x-f.x,y:u.y-f.y})}}function wh(e,t){const n=e.label;if(!n)return null;const i=[...t.edges.flatMap(pn),...t.shapes.filter(p=>p.container).flatMap(Ko)],r=i.filter(p=>Pi(n,p));if(!r.length)return null;const o=t.shapes.filter(p=>!p.container&&p.id!==e.id),a=so(t).filter(p=>p.owner!==e.id).map(p=>p.rect),s=(p,d)=>p.x<d.x+d.width&&d.x<p.x+p.width&&p.y<d.y+d.height&&d.y<p.y+p.height,c=p=>!i.some(d=>Pi(p,d))&&!o.some(d=>s(p,d))&&!a.some(d=>s(p,d)),u=[];for(const p of r)p.axis==="h"?u.push({...n,y:p.at-Rn-n.height},{...n,y:p.at+Rn}):u.push({...n,x:p.at-Rn-n.width},{...n,x:p.at+Rn});const l=e.x+e.width/2,f=e.y+e.height/2;return u.push({...n,x:l-n.width/2,y:e.y+e.height+Rn},{...n,x:l-n.width/2,y:e.y-Rn-n.height},{...n,x:e.x+e.width+Rn,y:f-n.height/2},{...n,x:e.x-Rn-n.width,y:f-n.height/2}),u.find(c)??null}function Eh(e,t){const{elementRegistry:n}=e,i=e.modeling,r=pt(n);for(const o of r.shapes){if(o.container||!o.label||t.has(o.id))continue;const a=wh(o,pt(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 e1=/^[\p{L}_][\p{L}\p{N}_.\-]*$/u,Sh=new Set(["sequenceFlow","messageFlow","dataAssociation","association"]),Rh={"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}]},vs=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),al=e=>typeof e=="string"&&e!=="";function t1(e){const t=[];function n(i,r,o,a){if(a===null){al(o)||t.push({kind:"payload-invalid",opIndex:i,field:r});return}if(!vs(o)){t.push({kind:"payload-invalid",opIndex:i,field:r});return}for(const s of a)al(o[s])||t.push({kind:"payload-invalid",opIndex:i,field:`${r}.${s}`})}return e.forEach((i,r)=>{if(!vs(i)||!al(i.kind)||!(i.kind in Rh)){t.push({kind:"payload-invalid",opIndex:r,field:"kind"});return}for(const o of Rh[i.kind]){const a=o.path.endsWith("[]"),s=a?o.path.slice(0,-2):o.path,c=s.split(".");let u=i;for(const f of c.slice(0,-1)){if(!vs(u))break;u=u[f]}if(!vs(u))continue;const l=u[c[c.length-1]];if(!(l===void 0&&o.optional)&&!(l===null&&o.optional)){if(!a){n(r,o.path,l,o.shape);continue}if(!Array.isArray(l)){t.push({kind:"payload-invalid",opIndex:r,field:o.path});continue}l.forEach((f,p)=>n(r,`${s}[${p}]`,f,o.shape))}}if(i.kind==="node.add"||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 Ch(e,t){const n=t1(e);if(n.length>0)return n;const i=[],r=new Map,o=new Map;function a(p,d,g){if(!e1.test(d)){i.push({kind:"id-invalid",opIndex:p,id:d});return}if(t.categoryOf(d)!==void 0||r.has(d)){i.push({kind:"id-duplicate",opIndex:p,id:d});return}r.set(d,{...g,opIndex:p})}e.forEach((p,d)=>{var g;switch(p.kind){case"participant.add":a(d,p.participant.id,{category:"participant",lanes:(p.participant.lanes??[]).map(h=>h.id)});for(const h of p.participant.lanes??[])a(d,h.id,{category:"lane"});break;case"node.add":a(d,p.node.id,{category:"flowNode",participant:p.node.participant});break;case"sequenceFlow.add":a(d,p.flow.id,{category:"sequenceFlow"});break;case"messageFlow.add":a(d,p.flow.id,{category:"messageFlow"});break;case"dataStore.add":a(d,p.dataStore.id,{category:"dataStore"});for(const h of p.associations??[])h.id&&a(d,h.id,{category:"dataAssociation"});break;case"dataAssociation.add":p.association.id&&a(d,p.association.id,{category:"dataAssociation"});break;case"association.add":p.association.id&&a(d,p.association.id,{category:"association"});break;case"annotation.add":a(d,p.annotation.id,{category:"annotation"}),(g=p.association)!=null&&g.id&&a(d,p.association.id,{category:"association"});break;case"group.add":a(d,p.group.id,{category:"group"});break;case"participant.update":if(p.lanes){o.set(p.id,p.lanes.map(h=>h.id));for(const h of p.lanes)t.categoryOf(h.id)===void 0&&a(d,h.id,{category:"lane"})}break}});const s=p=>{var d;return((d=r.get(p))==null?void 0:d.category)??t.categoryOf(p)},c=p=>{const d=r.get(p);return d?d.category==="participant"?p:d.participant:t.categoryOf(p)==="participant"?p:t.participantOf(p)};function u(p,d,g,h){const m=s(d);if(m===void 0){i.push({kind:"ref-missing",opIndex:p,ref:d,role:g});return}if(h&&!h.includes(m)){i.push({kind:"ref-category",opIndex:p,ref:d,role:g,expected:h.join("|"),actual:m});return}return m}const l=t.isCollaboration()||e.some(p=>p.kind==="participant.add");return e.forEach((p,d)=>{var g;switch(p.kind){case"participant.add":break;case"node.add":{const{participant:h,lane:m}=p.node;if(h===void 0){(l||m!==void 0)&&i.push({kind:"participant-required",opIndex:d,id:p.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:_,name:y,condition:x}=p.flow,S=u(d,m,"source",["flowNode"]),P=u(d,_,"target",["flowNode"]);S&&P&&c(m)!==c(_)&&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:_}=p.flow,y=u(d,m,"source",["flowNode","participant"]),x=u(d,_,"target",["flowNode","participant"]);if(y&&x){const S=c(m),P=c(_);S!==void 0&&S===P&&i.push({kind:"message-flow-same-pool",opIndex:d,id:h})}break}case"dataStore.add":{for(const h of p.associations??[]){if([h.source,h.target].filter(y=>y===p.dataStore.id).length!==1){i.push({kind:"data-association-ends",opIndex:d,source:h.source,target:h.target});continue}const _=h.source===p.dataStore.id?h.target:h.source;u(d,_,"dataAssociation",["flowNode"])}break}case"dataAssociation.add":{const{source:h,target:m}=p.association,_=u(d,h,"source"),y=u(d,m,"target");if(_&&y){const x=new Set([_,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:_}=p.association,y=u(d,m,"source"),x=u(d,_,"target");y&&x&&y!=="annotation"&&x!=="annotation"&&i.push({kind:"association-detached",opIndex:d,annotation:h??`${m}->${_}`});break}case"annotation.add":{if(p.association){const{source:h,target:m}=p.association;if(h!==p.annotation.id&&m!==p.annotation.id)i.push({kind:"association-detached",opIndex:d,annotation:p.annotation.id});else{const _=h===p.annotation.id?m:h;u(d,_,"association")}}p.placement&&u(d,p.placement.anchor,"anchor");break}case"group.add":{for(const h of p.group.members??[]){const m=u(d,h,"member");m&&Sh.has(m)&&i.push({kind:"ref-category",opIndex:d,ref:h,role:"member",expected:"shape",actual:m})}break}case"participant.update":{if(f(d,p.id,"participant")===void 0)break;if(p.lanes){const h=t.lanesOf(p.id),m=p.lanes.map(y=>y.id);for(const y of h)m.includes(y)||i.push({kind:"lane-shrink-unsupported",opIndex:d,participant:p.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 _=m.filter(y=>h.includes(y));_.length===h.length&&_.some((y,x)=>y!==h[x])&&i.push({kind:"lane-reorder-unsupported",opIndex:d,participant:p.id})}break}case"node.update":{if(f(d,p.id,"flowNode")===void 0)break;if(p.lane!==void 0){const h=t.participantOf(p.id);(h?o.get(h)??t.lanesOf(h):[]).includes(p.lane)||i.push({kind:"lane-unknown",opIndex:d,lane:p.lane,participant:h??""})}break}case"sequenceFlow.update":{if(f(d,p.id,"sequenceFlow")===void 0)break;if(p.name!==void 0&&p.condition!==void 0&&i.push({kind:"condition-name-conflict",opIndex:d,id:p.id}),p.source!==void 0||p.target!==void 0){const h=p.source===void 0||u(d,p.source,"source",["flowNode"])!==void 0,m=p.target===void 0||u(d,p.target,"target",["flowNode"])!==void 0,_=t.endpointsOf(p.id),y=p.source??(_==null?void 0:_.source),x=p.target??(_==null?void 0:_.target);h&&m&&y!==void 0&&x!==void 0&&new Set([c(y),c(x),c(p.id)]).size>1&&i.push({kind:"flow-cross-pool",opIndex:d,id:p.id})}break}case"messageFlow.update":f(d,p.id,"messageFlow");break;case"dataStore.update":f(d,p.id,"dataStore");break;case"annotation.update":{if(f(d,p.id,"annotation")===void 0)break;p.placement&&u(d,p.placement.anchor,"anchor");break}case"group.update":{if(f(d,p.id,"group")===void 0)break;for(const h of p.members??[]){const m=u(d,h,"member");m&&Sh.has(m)&&i.push({kind:"ref-category",opIndex:d,ref:h,role:"member",expected:"shape",actual:m})}break}case"element.remove":{f(d,p.id)==="lane"&&i.push({kind:"ref-category",opIndex:d,ref:p.id,role:"target",expected:"removable",actual:"lane"});break}}}),i;function f(p,d,g){if(r.has(d)){i.push({kind:"target-added-in-batch",opIndex:p,id:d});return}const h=t.categoryOf(d);if(h===void 0){i.push({kind:"ref-missing",opIndex:p,ref:d,role:"target"});return}if(g&&h!==g){i.push({kind:"ref-category",opIndex:p,ref:d,role:"target",expected:g,actual:h});return}return h}}function Ph(e){return{modeling:e.get("modeling"),bpmnFactory:e.get("bpmnFactory"),elementFactory:e.get("elementFactory"),elementRegistry:e.get("elementRegistry"),canvas:e.get("canvas"),autoPlace:e.get("autoPlace"),bpmnReplace:e.get("bpmnReplace")}}function bs(e){return`bpmn:${e[0].toUpperCase()}${e.slice(1)}`}const _s={"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,Ah=40,n1=10;function sl(e,t,n,i,r){const o=n,a=(k,O)=>{const[j,oe]=_s[k];let xe={x:t.x+t.width/2+j*(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+Qt+o.width/2,Y=i.x+i.width-Qt-o.width/2,ue=i.y+Qt+o.height/2,ve=i.y+i.height-Qt-o.height/2,le={x:Math.min(Y,Math.max(Ue,xe.x)),y:Math.min(ve,Math.max(ue,xe.y))};return(le.x!==xe.x||le.y!==xe.y)&&(xe=Math.abs(le.x-(t.x+t.width/2))<(t.width+o.width)/2+Qt&&Math.abs(le.y-(t.y+t.height/2))<(t.height+o.height)/2+Qt?{x:t.x+t.width+Qt+o.width/2,y:le.y}:le),xe},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=pt(e),u=k=>{var j,oe;if(!r.selfId)return!1;const O=e.get(k);return!!O&&(((j=O.source)==null?void 0:j.id)===r.selfId||((oe=O.target)==null?void 0:oe.id)===r.selfId)},l=c.edges.filter(k=>!u(k.id)).flatMap(pn),f=so(c).filter(k=>k.owner!==r.selfId).map(k=>k.rect),p=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=p(k);return s.some(j=>O.x0<j.x+j.width&&O.x1>j.x&&O.y0<j.y+j.height&&O.y1>j.y)},g=k=>{const O=p(k);return l.some(j=>j.axis==="h"?j.at>O.y0&&j.at<O.y1&&j.lo<O.x1&&j.hi>O.x0:j.at>O.x0&&j.at<O.x1&&j.lo<O.y1&&j.hi>O.y0)},h=k=>{const O=p(k);return f.some(j=>O.x0<j.x+j.width&&O.x1>j.x&&O.y0<j.y+j.height&&O.y1>j.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}]),_=k=>{const O=p(k);return m.some(j=>j.axis==="h"?j.at>O.y0&&j.at<O.y1&&j.lo<O.x1&&j.hi>O.x0:j.at>O.x0&&j.at<O.x1&&j.lo<O.y1&&j.hi>O.y0)},y=k=>d(k)||g(k)||h(k)||_(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"),j=r.placement.side,oe=[j,k(j),O(j),k(O(j)),"top","bottom","left","right","top-left","top-right","bottom-left","bottom-right"],xe=r.placement.offset??50;let Ue=a(j,xe);if(y(Ue)){const Y=new Set;for(const ue of oe){if(Y.has(ue))continue;Y.add(ue);const ve=a(ue,xe);if(x(ve)&&!y(ve)){Ue=ve;break}}}return Ue}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 $={x:Math.min(C,Math.max(P,S.x)),y:Math.min(T,Math.max(D,S.y))};if(y($)){const k=(t.width+o.width)/2+Qt,j=[{x:$.x+k,y:$.y},{x:$.x-k,y:$.y},{x:$.x,y:$.y-o.height-Qt},{x:$.x,y:$.y+o.height+Qt}].filter(x).find(oe=>!y(oe));j&&($=j)}return $}function Ut(e,t){return e.filter(n=>n.kind===t)}function Th(e,t){var Jx,e0,t0,n0,i0,r0,o0,a0,s0,c0,u0,l0,p0,f0,d0,h0,m0,g0,y0,v0,b0,_0,x0;const{modeling:n,bpmnFactory:i,elementFactory:r,elementRegistry:o,canvas:a,autoPlace:s,bpmnReplace:c}=t,u=()=>a.getRootElement(),l=v=>o.get(v),f=v=>{const R=l(v);if(!R)throw new Error(`하강 참조 해소 실패: ${v}`);return R},p=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"),_=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 H;const I=v.businessObject,N=(((H=I.extensionElements)==null?void 0:H.values)??[]).filter(V=>V.$type!==R),B=A?[...N,i.create(R,A)]:N;if(!B.length){I.extensionElements&&n.updateProperties(v,{extensionElements:void 0});return}const G=i.create("bpmn:ExtensionElements",{values:B});B.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 $=v=>o.filter(R=>{var A;return R.type==="bpmn:Lane"&&((A=p(R))==null?void 0:A.id)===v}).sort((R,A)=>R.y-A.y);for(const v of Ut(e,"participant.update")){const R=f(v.id);if(v.name!==void 0&&n.updateProperties(R,{name:v.name??void 0}),!v.lanes)continue;const A=$(v.id);if(!A.length){n.splitLane(R,v.lanes.length),$(v.id).forEach((N,B)=>{const G=v.lanes[B];G&&n.updateProperties(N,{id:G.id,name:G.name})});continue}const I=new Set(A.map(N=>N.id));v.lanes.forEach((N,B)=>{if(I.has(N.id)){n.updateProperties(f(N.id),{name:N.name});return}const G=B===0?n.addLane($(v.id)[0],"top"):n.addLane(f(v.lanes[B-1].id),"bottom");n.updateProperties(G,{id:N.id,name:N.name})})}const k=150,O=130,j=80,oe=90,xe=180,Ue=30,Y=30,ue=(v,R,A,I,N)=>{const B=A-R.width/2,G=I-R.height/2;return(v.children??[]).find(H=>!("waypoints"in H&&H.waypoints)&&H.type!=="bpmn:Lane"&&H.type!=="label"&&!(N!=null&&N.has(H.id))&&typeof H.x=="number"&&B<H.x+H.width+Y&&B+R.width+Y>H.x&&G<H.y+H.height&&G+R.height>H.y)},ve=new Set;for(const v of g){ve.add(`pool:${v.participant.id}`);for(const R of v.participant.lanes??[])ve.add(R.id)}const le=new Map;for(const v of h){const R=v.node.lane??`pool:${v.node.participant??""}`;let A=le.get(R);A||le.set(R,A=new Set([0])),v.band!==void 0&&A.add(v.band)}const be=new Map;for(const[v,R]of le){if(!ve.has(v))continue;const A=[...R].sort((B,G)=>B-G),I=A.map((B,G)=>G===0?0:G%2===1?Math.ceil(G/2):-(G/2)),N=Math.min(...I);be.set(v,new Map(A.map((B,G)=>[B,I[G]-N])))}{const v=new Map;for(const R of g)(R.participant.lanes??[]).forEach((A,I)=>v.set(A.id,I));for(const[R,A]of be){if(!v.has(R)||A.size<2)continue;const I=v.get(R),N=A.get(0)??0,B=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 se of m){const Ee=se.flow.source===ie.node.id;if(!Ee&&se.flow.target!==ie.node.id)continue;const ot=C.get(Ee?se.flow.target:se.flow.source);if(!ot||ot.node.participant!==ie.node.participant||!ot.node.lane)continue;let ae,ye=!1;if(ot.node.lane!==R){const ge=v.get(ot.node.lane);if(ge===void 0)continue;ae=ge>I?"down":"up",ye=!0}else{const ge=A.get(ot.band??0)??N;ae=ge>N?"down":ge<N?"up":void 0}ae&&(Me[Ee?"out":"in"].add(ae),ye&&Me.cross.add(ae))}for(const se of["up","down"])Me.in.has(se)&&Me.out.has(se)&&Me.cross.has(se)&&B.add(se)}if(B.size!==1)continue;const[G]=B,H=Math.max(...A.values()),V=G==="down"?H:0;if(N===V)continue;const Z=[...A.entries()].filter(([ie])=>ie!==0).sort((ie,Me)=>ie[1]-Me[1]),pe=[...Array(H+1).keys()].filter(ie=>ie!==V),we=new Map([[0,V]]);Z.forEach(([ie],Me)=>we.set(ie,pe[Me])),be.set(R,we)}}const ce=v=>{var R;return(((R=le.get(v))==null?void 0:R.size)??0)>1},U=v=>v.band??(v.node.lane||!ce(`pool:${v.node.participant??""}`)?void 0:0),q=new Map,K=v=>q.get(v.node.id)??U(v),He=new Set,Yt=new Set;{const v=new Map;for(const I of m)v.set(I.flow.target,(v.get(I.flow.target)??0)+1);const R=I=>{const N=[],B=new Set([I]),G=[I];for(;G.length;){const H=G.shift();N.push(H);for(const V of m)V.flow.source!==H||B.has(V.flow.target)||(v.get(V.flow.target)??0)!==1||(B.add(V.flow.target),G.push(V.flow.target))}return N},A=(I,N)=>{var B;return((B=be.get(I))==null?void 0:B.get(N))??N};for(const I of h){if(!I.node.type.endsWith("Gateway"))continue;const N=I.node.lane??`pool:${I.node.participant??""}`,B=be.get(N);if(!B||B.size<2)continue;const G=K(I);if(G===void 0||A(N,G)!==A(N,0))continue;const H=A(N,G),V=m.filter(se=>se.flow.source===I.node.id).map(se=>C.get(se.flow.target)).filter(se=>!!se&&(se.node.lane??`pool:${se.node.participant??""}`)===N),Z=V.filter(se=>{const Ee=K(se);return Ee!==void 0&&A(N,Ee)===H&&(v.get(se.node.id)??0)===1}),pe=V.some(se=>{const Ee=K(se);return Ee!==void 0&&A(N,Ee)>H});if(Z.length!==1||!pe)continue;const we=new Set(V.flatMap(se=>R(se.node.id)));if(!m.some(se=>se.flow.target===I.node.id&&we.has(se.flow.source)))continue;const Me=new Map;for(const[se,Ee]of B)Me.set(se,Ee+1);Me.set(-1,0),be.set(N,Me);for(const se of R(Z[0].node.id))C.has(se)&&(q.set(se,-1),Yt.add(se));He.add(I.node.id)}}const M=(v,R)=>{var A;return((A=be.get(v))==null?void 0:A.get(R))??R},E=new Map;for(const[v,R]of le){let A=0;for(const I of R)A=Math.max(A,M(v,I));E.set(v,A)}const b=v=>xe+k*v,F=(v,R,A)=>{const I=u().children.filter(N=>!("waypoints"in N&&N.waypoints)&&N.id!==R&&typeof N.y=="number"&&N.y>=v);I.length&&n.moveElements(I,{x:0,y:A})},W=(v,R,A)=>{const I=v.type==="bpmn:Participant"?v:void 0;if(!I||I.children.some(H=>H.type==="bpmn:Lane"))return;const N=A+R.height/2+Ue-I.y;if(I.height>=N)return;const B=N-I.height,G=I.y+I.height;n.resizeShape(I,{x:I.x,y:I.y,width:I.width,height:N}),F(G,I.id,B)},X=(v,R,A)=>{if(v){const G=f(v),H=b(R);if(G.height>=H)return;const V=H-G.height,Z=p(G),pe=Z?Z.y+Z.height:G.y+G.height;n.resizeLane(G,{x:G.x,y:G.y,width:G.width,height:H},!1),F(pe,Z==null?void 0:Z.id,V);return}if(!A)return;const I=k*(R+1);if(A.height>=I)return;const N=I-A.height,B=A.y+A.height;n.resizeShape(A,{x:A.x,y:A.y,width:A.width,height:I}),F(B,A.id,N)},me=g.map((v,R)=>({op:v,declared:R}));me.sort((v,R)=>{const A=v.op.order??Number.POSITIVE_INFINITY,I=R.op.order??Number.POSITIVE_INFINITY;return A!==I?A-I:v.declared-R.declared});let Ie=80;for(const v of o.getAll())v.parent===u()&&"height"in v&&typeof v.y=="number"&&(Ie=Math.max(Ie,v.y+v.height+60));for(const{op:v}of me){const R=v.participant,A=h.filter(ie=>ie.node.participant===R.id).length,I=((Jx=R.lanes)==null?void 0:Jx.length)??0,N=Math.max(1200,A*160+300),B=(R.lanes??[]).map(ie=>b(E.get(ie.id)??0)),G=B.reduce((ie,Me)=>ie+Me,0);I&&G<300&&(B[I-1]+=300-G);const H=Math.max(300,k*((E.get(`pool:${R.id}`)??0)+1)),V=R.blackBox||A+I===0?120:I?Math.max(300,G):H,Z=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:N,height:V,isExpanded:!0}),pe=n.createShape(Z,{x:100+N/2,y:Ie+V/2},u()),we=R.lanes??[];if(we.length&&n.splitLane(pe,we.length),we.length){const ie=o.filter(Me=>{var se;return Me.type==="bpmn:Lane"&&((se=p(Me))==null?void 0:se.id)===R.id}).sort((Me,se)=>Me.y-se.y);if(ie.forEach((Me,se)=>{const Ee=we[se];Ee&&n.updateProperties(Me,{id:Ee.id,name:Ee.name})}),B.some(Me=>Me!==pe.height/I)){let Me=pe.y;ie.forEach((se,Ee)=>{const ot=B[Ee];n.resizeShape(se,{x:se.x,y:Me,width:se.width,height:ot}),Me+=ot})}}Ie=pe.y+pe.height+60}const Ze=v=>{var I;const R=C.get(v);if(R)return R.node.participant??"";const A=l(v);return A?A.type==="bpmn:Participant"?A.id:((I=p(A))==null?void 0:I.id)??"":""},gt=new Map,it=v=>{let R=gt.get(v);return R||gt.set(v,R={nodes:[],flows:[]}),R};for(const v of h)it(v.node.participant??"").nodes.push(v);for(const v of m)it(Ze(v.flow.source)).flows.push(v);const Pt=v=>{var R;return i.create("bpmn:SequenceFlow",{id:v.id,name:v.name??((R=v.condition)==null?void 0:R.label)})},Zt=(v,R)=>r.createShape({type:bs(v.type),businessObject:i.create(bs(v.type),{id:v.id,name:v.name,...R!==void 0?{"bwl:band":R}:{}})}),mn=[...me.map(({op:v})=>v.participant.id).filter(v=>gt.has(v)),...[...gt.keys()].filter(v=>!g.some(R=>R.participant.id===v))],ut=v=>v.endsWith("Gateway");for(const v of mn){const R=gt.get(v),A=v?f(v):void 0,I=A?A.x+150:250;let N=A?A.y+80:120;const B=(ae,ye,ge)=>{if(ae){const Ae=f(ae);return Ae.y+Math.min(Ae.height/2,oe)+M(ae,ye??0)*k}return ye!==void 0&&A?A.y+j+M(`pool:${v}`,ye)*k:ge},G=(ae,ye,ge)=>{if(ae){const Ae=f(ae);return Ae.y+Math.min(Ae.height/2,oe)+ye*k}return A?A.y+j+ye*k:ge},H=ae=>ae.participant?f(ae.participant):u(),V=(ae,ye,ge,Ae,nt,Qe)=>{const Kt=ge!==void 0||Ae!==void 0,xn=M(ge??`pool:${v}`,Ae??0);if(Kt)for(let ne=0;ne<4;ne++){const ee=G(ge,xn+ne,Qe);if(!ue(ae,ye,nt,ee))return X(ge,xn+ne,A),{x:nt,y:ee}}const Se=B(ge,Ae,Qe);Kt?X(ge,xn,A):W(ae,ye,Se);let Je=nt;for(let ne=0;ne<64;ne++){const ee=ue(ae,ye,Je,Se);if(!ee)break;Je=ee.x+ee.width+O+ye.width/2}return{x:Je,y:Se}},Z=new Set(R.flows.map(ae=>ae.flow.target)),pe=new Map;for(const ae of R.nodes){if(Z.has(ae.node.id))continue;const ye=Zt(ae.node,ae.band),ge=U(ae),Ae=ae.node.lane?`${ae.node.lane}|${ge??""}`:ge!==void 0?`band:${ge}`:"",nt=H(ae.node),Qe=V(nt,ye,ae.node.lane,ge,pe.get(Ae)??I,N);n.createShape(ye,Qe,nt),pe.set(Ae,Qe.x+ye.width+O),!ae.node.lane&&ge===void 0&&(N+=160)}const we=new Set,ie=new Map,Me=new Map,se=new Map;if(v&&ve.has(`pool:${v}`)){const ae=new Map;for(const Se of R.flows)ae.set(Se.flow.target,(ae.get(Se.flow.target)??0)+1);const ye=Se=>B(Se.node.lane,K(Se),Number.NaN),ge=new Set,Ae=Se=>{var ee;const Je=(ee=C.get(Se))==null?void 0:ee.node.participant;if(Je)return l(Je);const ne=l(Se);if(ne)return ne.type==="bpmn:Participant"?ne:p(ne)},nt=Se=>{const Je=[],ne=new Set([Se]),ee=[Se];for(;ee.length;){const _e=ee.shift(),Te=C.get(_e);Te&&Je.push(Te);for(const Re of R.flows)Re.flow.source!==_e||ne.has(Re.flow.target)||(ae.get(Re.flow.target)??0)!==1||(ne.add(Re.flow.target),ee.push(Re.flow.target))}return Je},Qe=Se=>{if(!A)return;const Je=new Set(Se.map(_e=>_e.node.id));let ne=!1,ee=!1;for(const _e of _){if(!Je.has(_e.flow.source))continue;const Te=Ae(_e.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 Se of R.nodes){if(!ut(Se.node.type))continue;const Je=B(Se.node.lane,U(Se),Number.NaN);if(Number.isNaN(Je))continue;const ne=[];for(const Re of R.flows){if(Re.flow.source!==Se.node.id)continue;const Fe=C.get(Re.flow.target);if(!Fe||Fe.node.lane!==Se.node.lane||(ae.get(Fe.node.id)??0)!==1)continue;const tt=U(Fe);if(tt===void 0)continue;const Gt=B(Fe.node.lane,tt,Number.NaN);if(Number.isNaN(Gt))continue;const si=nt(Fe.node.id),Rt=Qe(si);Rt&&ne.push({subtree:si,band:tt,row:Gt,dir:Rt})}if(!ne.some(Re=>Re.dir==="up")||!ne.some(Re=>Re.dir==="down")||!ne.some(Re=>Re.dir==="up"&&ne.some(Fe=>Fe.dir==="down"&&Fe.row<Re.row)))continue;const _e=[...ne].sort((Re,Fe)=>Re.row-Fe.row);[...ne.filter(Re=>Re.dir==="up"),...ne.filter(Re=>Re.dir==="down")].sort((Re,Fe)=>Re.dir===Fe.dir?Re.row-Fe.row:Re.dir==="up"?-1:1).forEach((Re,Fe)=>{const tt=_e[Fe].band;if(tt!==Re.band){ge.add(Se.node.id);for(const Gt of Re.subtree)U(Gt)===Re.band&&q.set(Gt.node.id,tt)}})}const Kt=Se=>{if(!A)return;const Je=new Set(Se.map(_e=>_e.node.id));let ne=!1,ee=!1;for(const _e of _){if(!Je.has(_e.flow.target))continue;const Te=Ae(_e.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 Se of R.nodes){if(!ut(Se.node.type))continue;const Je=Se.node.lane??`pool:${v}`,ne=be.get(Je);if(!ne||ne.size<2)continue;const ee=ne.get(0);if(ee===void 0)continue;const _e=Math.max(...ne.values()),Te=ee===_e&&ee!==0?"down":void 0;if(!Te)continue;const Re=[];for(const Rt of R.flows){if(Rt.flow.source!==Se.node.id)continue;const ht=C.get(Rt.flow.target);if(!ht||ht.node.lane!==Se.node.lane||(ae.get(ht.node.id)??0)!==1)continue;const es=K(ht);es!==void 0&&Re.push({t:ht,subtree:nt(ht.node.id),band:es})}const Fe=Re.find(Rt=>(ne.get(Rt.band)??Rt.band)===ee);if(!Fe||Kt(Fe.subtree)===Te||Qe(Fe.subtree)===Te)continue;const tt=Re.find(Rt=>Rt!==Fe&&Kt(Rt.subtree)===Te);if(!tt)continue;const Gt=Fe.band,si=tt.band;for(const Rt of Fe.subtree)K(Rt)===Gt&&q.set(Rt.node.id,si);for(const Rt of tt.subtree)K(Rt)===si&&q.set(Rt.node.id,Gt);ge.add(Se.node.id)}for(const Se of R.nodes){if(!ut(Se.node.type))continue;const Je=ye(Se);if(Number.isNaN(Je)||S.some(Re=>{var Fe,tt;return(((Fe=Re.placement)==null?void 0:Fe.anchor)??(Re.association?Re.association.source===Re.annotation.id?Re.association.target:Re.association.source:void 0))===Se.node.id&&((tt=Re.placement)==null?void 0:tt.side.startsWith("bottom"))}))continue;let ee,_e=!1,Te;for(const Re of R.flows){if(Re.flow.source!==Se.node.id)continue;const Fe=C.get(Re.flow.target);if(!Fe||!Fe.node.lane&&U(Fe)===void 0)continue;const tt=ye(Fe);Number.isNaN(tt)||(Math.abs(tt-Je)<.5&&(_e=!0),tt>Je?!ee||tt>ee.row?ee={id:Fe.node.id,row:tt,count:1}:tt===ee.row&&ee.count++:tt<Je&&Fe.node.lane===Se.node.lane&&(!Te||tt>Te.row?Te={op:Fe,row:tt,count:1}:tt===Te.row&&Te.count++))}ee&&ee.count===1&&(ae.get(ee.id)??0)===1&&!ge.has(Se.node.id)&&we.add(ee.id),!_e&&Te&&Te.count===1&&(ae.get(Te.op.node.id)??0)===1&&!He.has(Se.node.id)&&ie.set(Te.op.node.id,{lane:Se.node.lane,band:K(Se)})}const xn=new Map;for(const Se of _)xn.set(Se.flow.target,[...xn.get(Se.flow.target)??[],Se]);for(const Se of R.nodes){const Je=xn.get(Se.node.id);if(!Je||Je.length!==1||!ae.get(Se.node.id)||!Se.node.lane&&U(Se)===void 0||Yt.has(Se.node.id))continue;const ne=(e0=C.get(Je[0].flow.source))==null?void 0:e0.node.participant,ee=ne?l(ne):void 0;if(!ee||!A||ee.id===A.id)continue;const _e=Se.node.lane??`pool:${v}`,Te=be.get(_e);if(!Te)continue;const Re=Te.get(0)??0,Fe=(Te.get(K(Se)??0)??Re)-Re;if(Fe===0)continue;const tt=ee.y<A.y;if(tt&&Fe<0||!tt&&Fe>0)continue;let Gt;for(const[si,Rt]of Te){const ht=Rt-Re;(tt&&ht<0&&(!Gt||ht<Gt.row)||!tt&&ht>0&&(!Gt||ht>Gt.row))&&(Gt={band:si,row:ht})}Gt&&Me.set(Se.node.id,{lane:Se.node.lane,band:Gt.band})}}const Ee=new Set;let ot=0;for(;ot++<R.nodes.length+2;){for(let ge=0;ge<R.nodes.length+R.flows.length+2;ge++){let Ae=!1;for(const nt of R.flows){const Qe=nt.flow;if(Ee.has(Qe.id))continue;const Kt=l(Qe.source);if(!Kt)continue;const xn=l(Qe.target),Se=C.get(Qe.target);if(!xn&&Se){const Je=Zt(Se.node,Se.band),ne=K(Se);if(Se.node.lane||ne!==void 0){const ee=H(Se.node),_e=Kt,Te=_e.x+(se.get(Qe.source)??0)+_e.width+O,Re=ie.get(Qe.target)??Me.get(Qe.target),Fe=V(ee,Je,Re?Re.lane:Se.node.lane,Re?Re.band:ne,we.has(Qe.target)?_e.x+_e.width/2:Te,Number.NaN),tt=n.createShape(Je,Fe,ee);we.has(Qe.target)&&se.set(Qe.target,Te-(tt.x+tt.width/2)),n.connect(Kt,tt,{type:"bpmn:SequenceFlow",businessObject:Pt(Qe)})}else s.append(Kt,Je,{connection:{type:"bpmn:SequenceFlow",businessObject:Pt(Qe)}})}else if(xn)n.connect(Kt,xn,{type:"bpmn:SequenceFlow",businessObject:Pt(Qe)});else continue;Ee.add(Qe.id),Ae=!0}if(!Ae)break}const ae=R.nodes.filter(ge=>!l(ge.node.id));if(!ae.length)break;const ye=ae[0];{const ge=Zt(ye.node,ye.band),Ae=H(ye.node),nt=U(ye);n.createShape(ge,V(Ae,ge,ye.node.lane,nt,I,N),Ae),!ye.node.lane&&nt===void 0&&(N+=160)}}}const It=40,Bt=(v,R=()=>!0)=>{const A=l(v);if(!A)return[];const I=[A],N=new Set([v]);for(let B=0;B<I.length;B++){const G=I[B].id;for(const H of m){const V=H.flow.target;if(H.flow.source!==G||N.has(V)||!C.has(V))continue;N.add(V);const Z=l(V);Z&&R(Z)&&I.push(Z)}}return I},zo=(v,R=()=>!0)=>{const A=l(v);if(!A)return[];const I=[A],N=new Set([v]);for(let B=0;B<I.length;B++){const G=I[B].id;for(const H of m){const V=H.flow.source;if(H.flow.target!==G||N.has(V)||!C.has(V))continue;N.add(V);const Z=l(V);Z&&R(Z)&&I.push(Z)}}return I},bn=30,jn=v=>!("waypoints"in v&&v.waypoints)&&v.type!=="bpmn:Lane"&&v.type!=="label"&&typeof v.x=="number",_n=(v,R)=>{const A=new Set(v.flatMap(G=>G.subtree.map(H=>H.id)));for(const G of v){const H=(G.pool.children??[]).filter(jn).filter(Z=>!A.has(Z.id));if(G.subtree.some(Z=>H.some(pe=>Z.x+R<pe.x+pe.width+bn&&Z.x+R+Z.width+bn>pe.x&&Z.y<pe.y+pe.height&&Z.y+Z.height>pe.y)))return null}const I=v.map(G=>G.pool.width),N=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 B=v.map(G=>{const V=Math.max(...G.subtree.map(Z=>Z.x+Z.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,H)=>{B[H]>0&&n.resizeShape(G.pool,{x:G.pool.x,y:G.pool.y,width:I[H],height:G.pool.height})});for(let G=0;G<3;G++){let H=0;for(const V of N){const Z=V.x-V.label.x,pe=V.y-V.label.y;Math.abs(Z)<=.5&&Math.abs(pe)<=.5||(n.moveElements([V.label],{x:Z,y:pe}),H++)}if(!H)break}}},Nt=()=>{const v=pt(o),R=A=>A.length>=2&&(A.every(I=>Math.abs(I.x-A[0].x)<.01)||A.every(I=>Math.abs(I.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}},Ur=v=>{const R=N=>{const B=[N],G=new Set([N.id]);for(let H=0;H<B.length;H++)for(const V of B[H].outgoing??[]){if(V.type!=="bpmn:SequenceFlow")continue;const Z=V.target;!Z||G.has(Z.id)||v.has(Z.id)||!jn(Z)||Z.x<N.x||(G.add(Z.id),B.push(Z))}return B},A=new Set(v),I=[];for(const N of o.getAll()){if(N.type!=="bpmn:MessageFlow")continue;const B=N;if(!B.waypoints||B.waypoints.length!==2)continue;const G=B.source,H=B.target;if(!G||!H)continue;const V=v.has(G.id);if(V===v.has(H.id))continue;const Z=V?H:G,pe=p(Z);if(!pe||A.has(Z.id))continue;const we=R(Z).filter(ie=>!A.has(ie.id));if(we.length){for(const ie of we)A.add(ie.id);I.push({subtree:we,pool:pe})}}return I};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),I=l(v.id);if(!A||!I)continue;const N=v.source!==void 0?l(v.source):I.source,B=I.target;if(!N||!B||B.id===A.id)continue;const G=Bt(v.target),H=new Set(G.map(se=>se.id)),V=Math.min(...G.map(se=>se.x)),Z=Math.max(...G.map(se=>se.x+se.width)),pe=N.x+N.width,we=Z-V+It*2-(B.x-pe);if(we>0){const se=p(A),Ee=(se==null?void 0:se.children)??[],ot=ge=>ge.type==="bpmn:Lane",ae=Ee.filter(ge=>!("waypoints"in ge&&ge.waypoints)&&!ot(ge)&&!H.has(ge.id)&&ge.x>=B.x),ye=se?[se,...Ee.filter(ge=>ot(ge))]:[];if(ae.length){const ge=Ur(new Set(ae.map(Ae=>Ae.id)));n.createSpace(ae,ye,{x:we,y:0},"e",B.x-1);for(const Ae of ge){const nt=Nt(),Qe=_n([Ae],we);if(!Qe)continue;const Kt=Nt();(Kt.messages<=nt.messages||Kt.lines<nt.lines)&&Qe()}}}const ie=R.node.lane||R.band!==void 0?A.y+A.height/2:N.y+N.height/2;n.moveElements(G,{x:pe+It-V,y:ie-(A.y+A.height/2)});const Me=p(A);if(R.node.lane===void 0&&R.band!==void 0&&Me){const se=Me.y+j+M(`pool:${R.node.participant??""}`,R.band)*k,Ee=se-(A.y+A.height/2);Ee!==0&&!ue(Me,A,A.x+A.width/2,se,H)&&n.moveElements([A],{x:0,y:Ee})}}const Za=(v,R)=>{const A=R.target===v,I=f(R.source),N=f(R.target),B=A?"bpmn:DataOutputAssociation":"bpmn:DataInputAssociation";n.connect(I,N,R.id?{type:B,businessObject:i.create(B,{id:R.id})}:{type:B})},Hn=100,Xe=v=>{for(const R of g){if(!R.participant.blackBox)continue;const A=l(R.participant.id);if(!A)continue;const I=[];for(const B of _){const G=B.flow.source===R.participant.id?B.flow.target:B.flow.target===R.participant.id?B.flow.source:void 0,H=G?l(G):void 0;H&&typeof H.x=="number"&&H.type!=="bpmn:Participant"&&I.push(H)}if(!I.length)continue;const N=Math.max(...I.map(B=>B.x+B.width/2))+Hn;if(N>A.x+A.width&&n.resizeShape(A,{x:A.x,y:A.y,width:N-A.x,height:A.height}),!!v)for(const B of _){const G=l(B.flow.id),H=B.flow.source===R.participant.id?B.flow.target:B.flow.target===R.participant.id?B.flow.source:void 0,V=H?l(H):void 0;if(!G||!V||V.type==="bpmn:Participant")continue;const Z=V.x+V.width/2;if(Z<A.x+10||Z>A.x+A.width-10)continue;const pe=A.y>V.y,we=pe?V.y+V.height:V.y,ie=pe?A.y:A.y+A.height,Me=B.flow.source===R.participant.id?[{x:Z,y:ie},{x:Z,y:we}]:[{x:Z,y:we},{x:Z,y:ie}],se=pt(o),Ee={...se.edges.find(ot=>ot.id===B.flow.id),waypoints:Me};fn(Ee,Gn(se)).length||n.updateWaypoints(G,Me)}}};Xe(!1);for(const v of _){const R=v.flow;n.connect(f(R.source),f(R.target),{type:"bpmn:MessageFlow",businessObject:i.create("bpmn:MessageFlow",{id:R.id,name:R.name})})}{const A=new Set([...m.map(V=>V.flow.id),..._.map(V=>V.flow.id)].filter(V=>!!V)),I=o.filter(V=>!!V.waypoints),N=(V,Z)=>Math.abs(Z.x-V.x)<2?"L":Math.abs(Z.x-(V.x+V.width))<2?"R":Math.abs(Z.y-V.y)<2?"T":Math.abs(Z.y-(V.y+V.height))<2?"B":void 0,B=new Map,G=(V,Z,pe)=>{if(!V||!Z||typeof V.x!="number")return;const we=N(V,Z);if(!we)return;let ie=B.get(V.id);ie||B.set(V.id,ie=new Map),ie.set(we,[...ie.get(we)??[],pe])};for(const V of I){const Z=V.waypoints;!Z||Z.length<2||(G(V.source,Z[0],{id:V.id,dir:"out"}),G(V.target,Z[Z.length-1],{id:V.id,dir:"in"}))}const H=new Set;for(const[V,Z]of B){const pe=l(V);if(!pe||typeof pe.x!="number"||![...Z.values()].some(ye=>{const ge=ye.filter(Ae=>Ae.dir==="in");return ye.length>=3&&ge.length>=1&&ye.some(Ae=>Ae.dir==="out")&&ge.some(Ae=>A.has(Ae.id))}))continue;const ie=p(pe);if(!ie||H.has(ie.id)||(ie.children??[]).some(ye=>ye.type==="bpmn:Lane"))continue;const Me=(t0=Z.get("T"))!=null&&t0.length?(n0=Z.get("B"))!=null&&n0.length?void 0:"B":"T";if(!Me||(Me==="T"?pe.y-ie.y:ie.y+ie.height-(pe.y+pe.height))>=k)continue;const Ee=(ie.children??[]).filter(ye=>!("waypoints"in ye&&ye.waypoints)&&ye.type!=="label"&&typeof ye.x=="number"),ot=ie.y+ie.height;n.resizeShape(ie,{x:ie.x,y:ie.y,width:ie.width,height:ie.height+k});const ae=u().children.filter(ye=>!("waypoints"in ye&&ye.waypoints)&&ye.id!==ie.id&&typeof ye.y=="number"&&ye.y>=ot);ae.length&&n.moveElements(ae,{x:0,y:k}),Me==="T"&&Ee.length&&n.moveElements(Ee,{x:0,y:k}),H.add(ie.id)}}const et=20,Fx=4,VD=2,WD=[10,30,80],Go=()=>{const v=pt(o);return{bad:ri(v).filter(R=>R.kind==="edge-crosses-shape"||R.kind==="edge-overlap-opposite"||R.kind==="edge-overlap-mixed").length,crossings:Gd(v),straight:v.edges.filter(R=>R.type==="bpmn:MessageFlow"&&R.waypoints.length===2).length}},Vo=v=>{const R=pt(o),A=R.edges.find(I=>I.id===v);return A?fn(A,Gn(R)).length:0},Ru=v=>Vo(v)>0,Cu=v=>pt(o).edges.filter(R=>R.type==="bpmn:MessageFlow"&&R.id!==v&&R.waypoints.length===2).length,UD=(v,R,A)=>_n([{subtree:v,pool:R}],A),jx=(v,R)=>R.bad>v.bad||R.crossings>v.crossings&&R.straight<=v.straight&&R.bad>=v.bad,Pu=(v,R)=>jx(v,R)||R.straight<v.straight,Au=(v,R,A=()=>!0,I=jx)=>{const N=Go(),B=_n(v,R);if(!B)return!1;const G=Go();return I(N,G)||!A()?(B(),!1):!0},Hx=(v,R,A,I=()=>!0)=>Au([{subtree:v,pool:R}],A,I),qr=v=>{var R;return!!((R=C.get(v))!=null&&R.node.participant)},Qa=new Map;for(const v of _){if(!qr(v.flow.target))continue;const R=Qa.get(v.flow.target)??[];R.push(v),Qa.set(v.flow.target,R)}const Jf=[...Qa.keys()],zx=new Set(m.map(v=>v.flow.target)),Gx=v=>me.findIndex(({op:R})=>R.participant.id===v);Jf.sort((v,R)=>{var N,B;const A=zx.has(v)?1:0,I=zx.has(R)?1:0;return A!==I?A-I:Gx((N=C.get(v))==null?void 0:N.node.participant)-Gx((B=C.get(R))==null?void 0:B.node.participant)});const Yr=v=>v.x+v.width/2,qD=v=>{const R=new Map;for(const N of o.getAll()){const B=N;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 A=new Set([v]),I=[v];for(let N=0;N<I.length;N++)for(const B of R.get(I[N])??[])A.has(B)||(A.add(B),I.push(B));return A},YD=(v,R)=>{const A=qD(R);let I;for(const N of o.getAll()){const B=N;if(B.type!=="bpmn:MessageFlow"||!B.source||!B.target||B.target.id!==v||A.has(B.source.id))continue;const G=B.source;if(typeof G.x!="number"||G.type==="bpmn:Participant")continue;const H=Yr(G);(I===void 0||H>I)&&(I=H)}return I},ed=(v,R)=>{const A=l(v.flow.source);if(A)return A.type==="bpmn:Participant"?YD(A.id,R):Yr(A)},Vx=v=>{let R;for(const A of Qa.get(v)??[]){const I=ed(A,v);I!==void 0&&(!R||I>R.cx)&&(R={op:A,cx:I})}return R==null?void 0:R.op},KD=v=>{const R=Vx(v),A=l(v),I=R?ed(R,v):void 0;return A&&I!==void 0?I-Yr(A):void 0},XD=v=>{const R=KD(v);return R!==void 0&&Math.abs(R)<et},Wx=(v,R,A,I,N)=>{var B;for(let G=!0;G;){G=!1;for(const H of _){if(H.flow.id===A)continue;const V=R.has(H.flow.source),Z=R.has(H.flow.target);if(V===Z||I(V?H.flow.source:H.flow.target))continue;const pe=V?H.flow.target:H.flow.source;if(N(pe)||!qr(pe))continue;const we=l(H.flow.id);if(!(we!=null&&we.waypoints)||we.waypoints.length!==2)continue;const ie=l(pe),Me=(B=C.get(pe))==null?void 0:B.node.participant;if(!ie||!Me)continue;const se=Bt(pe,Ee=>Ee.x>=ie.x).filter(Ee=>!R.has(Ee.id));if(!(!se.length||se.some(Ee=>N(Ee.id)))){for(const Ee of se)R.add(Ee.id);v.set(Me,[...v.get(Me)??[],...se]),G=!0}}}return[...v].map(([G,H])=>({subtree:H,pool:f(G)}))},Ux=(v,R,A,I,N)=>Wx(new Map([[R,[...v]]]),new Set(v.map(B=>B.id)),I,B=>B===A,B=>B===N),td=v=>{const R=Vx(v);if(!R)return null;const A=l(v),I=l(R.flow.source),N=ed(R,v);if(!A||!I||N===void 0)return null;const B=N-Yr(A);if(B>=et){const G=C.get(v).node.participant,H=Bt(v,V=>V.x>=A.x);return{groups:Ux(H,G,v,R.flow.id,R.flow.source),dx:B}}if(-B>=et&&qr(R.flow.source)){const G=C.get(R.flow.source).node.participant,H=Bt(R.flow.source,V=>V.x>=I.x&&!XD(V.id));return{groups:Ux(H,G,R.flow.source,R.flow.id,v),dx:-B}}return null},qx=()=>Jf.map(v=>({id:v,plan:td(v)})).filter(v=>!!v.plan).sort((v,R)=>Math.min(...v.plan.groups.flatMap(A=>A.subtree.map(I=>I.x)))-Math.min(...R.plan.groups.flatMap(A=>A.subtree.map(I=>I.x)))).map(v=>v.id);for(let v=0;v<3;v++){const R=Go(),A=[];for(const N of qx()){const B=td(N);if(!B)continue;const G=_n(B.groups,B.dx);G&&A.push(G)}if(!A.length)break;if(!Pu(R,Go()))continue;for(const N of A.reverse())N();let I=!1;for(const N of qx()){const B=td(N);B&&Au(B.groups,B.dx,()=>!0,Pu)&&(I=!0)}if(!I)break}for(const v of Jf.flatMap(R=>Qa.get(R)??[])){if(!Ru(v.flow.id))continue;const R=l(v.flow.target);if(!R)continue;const A=f(C.get(v.flow.target).node.participant),I=Bt(v.flow.target,H=>H.x>=R.x),N=R.width+O,B=Vo(v.flow.id),G=Cu(v.flow.id);for(let H=1;H<=Fx;H++){const V=()=>Vo(v.flow.id)<B&&Cu(v.flow.id)>=G;if(Hx(I,A,N*H,V))break}}for(const v of _){if(!Ru(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 I=R.x+R.width/2;if(Math.abs(I-(A.x+A.width/2))>15)continue;const[N,B]=R.y<A.y?[R.y+R.height,A.y]:[A.y+A.height,R.y],G=[...C.values()].map(H=>l(H.node.id)).filter(H=>!!H&&H.id!==R.id&&H.id!==A.id).filter(H=>H.x<=I&&I<=H.x+H.width&&H.y+H.height>N&&H.y<B).sort((H,V)=>H.x-V.x);for(const H of G){const V=(i0=C.get(H.id))==null?void 0:i0.node.participant,Z=V?l(V):void 0;if(!Z)continue;const pe=[...C.values()].filter(ge=>ge.node.participant===V).map(ge=>ge.node.id),we=ge=>ge.map(Ae=>l(Ae)).filter(Ae=>!!Ae),Me=[zo(H.id,ge=>{var Ae;return((Ae=C.get(ge.id))==null?void 0:Ae.node.participant)===V}),we(pe)].filter(ge=>ge.length),se=H.width+O,Ee=Vo(v.flow.id),ot=Cu(v.flow.id),ae=()=>Vo(v.flow.id)<Ee&&Cu(v.flow.id)>=ot;let ye=!1;for(const ge of Me){for(let Ae=1;Ae<=Fx;Ae++)if(Hx(ge,Z,se*Ae,ae)){ye=!0;break}if(ye)break}if(!Ru(v.flow.id))break}}for(const v of _){if(!Ru(v.flow.id))continue;const R=l(v.flow.id);if(((r0=R==null?void 0:R.waypoints)==null?void 0:r0.length)!==2)continue;const A=l(v.flow.source),I=l(v.flow.target);if(!A||!I||A.type==="bpmn:Participant"||I.type==="bpmn:Participant"||!qr(v.flow.source)||!qr(v.flow.target)||Math.abs(Yr(A)-Yr(I))>VD)continue;const N=Yr(A),B=R.waypoints.map(Ee=>Ee.y),[G,H]=[Math.min(...B),Math.max(...B)],V=Gn(pt(o)).filter(Ee=>Ee.id!==A.id&&Ee.id!==I.id&&Ee.x<N&&N<Ee.x+Ee.width&&G<Ee.y+Ee.height&&Ee.y<H);if(!V.length)continue;const Z=(o0=C.get(v.flow.source))==null?void 0:o0.node.participant,pe=(a0=C.get(v.flow.target))==null?void 0:a0.node.participant;if(!Z||!pe)continue;const we=new Map;for(const[Ee,ot,ae]of[[v.flow.source,A,Z],[v.flow.target,I,pe]]){const ye=we.get(ae)??[],ge=Bt(Ee,Ae=>Ae.x>=ot.x).filter(Ae=>!ye.some(nt=>nt.id===Ae.id));we.set(ae,[...ye,...ge])}const ie=new Set([...we.values()].flat().map(Ee=>Ee.id)),Me=Wx(we,ie,v.flow.id,Ee=>Ee===v.flow.source||Ee===v.flow.target,()=>!1),se=Math.max(...V.map(Ee=>Ee.x+Ee.width));for(const Ee of WD){const ot=se+Ee-N;if(ot<=0)continue;if(Au(Me,ot,()=>{var ye,ge;return Vo(v.flow.id)===0&&((ge=(ye=l(v.flow.id))==null?void 0:ye.waypoints)==null?void 0:ge.length)===2},Pu))break}}{const v=A=>A.y+A.height/2,R=[];for(const A of C.keys()){if(!qr(A))continue;const I=m.filter(G=>G.flow.target===A);if(I.length!==1)continue;const N=l(I[0].flow.source),B=l(A);!N||!B||!C.has(N.id)||Math.abs(v(N)-v(B))>1||B.x-(N.x+N.width)<=O+1||R.push({id:A,pred:N,node:B})}R.sort((A,I)=>A.node.x-I.node.x);for(const{id:A}of R){const I=C.get(A),N=l(A),B=l(m.find(ie=>ie.flow.target===A).flow.source);if(!N||!B)continue;const G=N.x-(B.x+B.width);if(G<=O+1)continue;const H=f(I.node.participant),V=Bt(A,ie=>ie.x>=N.x),Z=Go(),pe=UD(V,H,-(G-O));if(!pe)continue;const we=Go();(we.bad>Z.bad||we.crossings>=Z.crossings||we.straight<Z.straight)&&pe()}}Xe(!0);for(const v of y){const R=v.associations??[],A=R.map(B=>B.source===v.dataStore.id?B.target:B.source).map(l).find(Boolean),I=A?p(A)??u():u(),N=A?{x:A.x+A.width/2,y:A.y+A.height+110}:{x:200,y:Ie+60};n.createShape({type:"bpmn:DataStoreReference",businessObject:i.create("bpmn:DataStoreReference",{id:v.dataStore.id,name:v.dataStore.name})},N,I);for(const B of R)Za(v.dataStore.id,B)}for(const v of x){const A=f(v.association.target).type==="bpmn:DataStoreReference"?v.association.target:v.association.source;Za(A,v.association)}let Yx=0;const Kr=10,Kx=40,ZD=(v,R)=>{const A=R.map(V=>p(V)).filter(V=>!!V);for(const V of A){const Z=Kr,pe=V.y,we=V.y+V.height,ie=V.x,Me=V.x+V.width;if(Math.abs(v.y-pe)<Z){const se=pe+Z-v.y;v.y+=se,v.height-=se}if(Math.abs(v.y+v.height-we)<Z&&(v.height=we-Z-v.y),Math.abs(v.x-ie)<Z){const se=ie+Z-v.x;v.x+=se,v.width-=se}Math.abs(v.x+v.width-Me)<Z&&(v.width=Me-Z-v.x)}if(!A.length)return;const I=Math.min(...A.map(V=>V.y)),N=Math.max(...A.map(V=>V.y+V.height)),B=I-v.y,G=v.y+v.height-N,H=Kx-Kr;if(B>0!=G>0)if(B>0&&B<H){const V=B+Kr;v.y+=V,v.height-=V}else G>0&&G<H&&(v.height-=G+Kr)},QD=(v,R)=>{const A=Kr,I=30,N=o.filter(B=>B.type==="bpmn:Group"&&B.id!==R);for(const B of N){const G=B.x,H=B.x+B.width,V=B.y,Z=B.y+B.height,pe=v.y<Z&&V<v.y+v.height,we=v.x<H&&G<v.x+v.width;if(pe){if(Math.abs(v.x-H)<A){const ie=Math.min(H+A-v.x,I);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),I);ie>0&&v.width-ie>0&&(v.width-=ie)}}if(we){if(Math.abs(v.y-Z)<A){const ie=Math.min(Z+A-v.y,I);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),I);ie>0&&v.height-ie>0&&(v.height-=ie)}}}},nd=(v,R)=>{const A=Kx,I=Math.min(...v.map(V=>V.x))-A,N=Math.min(...v.map(V=>V.y))-A,B=Math.max(...v.map(V=>V.x+V.width))+A,G=Math.max(...v.map(V=>V.y+V.height))+A,H={x:I,y:N,width:B-I,height:G-N};return ZD(H,v),QD(H,R),H};for(const v of P){const R=(v.group.members??[]).map(l).filter(N=>!!N);let A;R.length?A=nd(R,v.group.id):(A={x:300+Yx*350,y:40,width:300,height:200},Yx++);const I=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(I,v.group.name),(s0=v.group.members)!=null&&s0.length&&D(I,"bwl:Members",{refs:v.group.members.join(" ")})}{const v=o.filter(N=>!!N.waypoints),R=new Map,A=(N,B)=>{!N||!B||(R.has(N)||R.set(N,new Set),R.get(N).add(B))};for(const N of v){const B=(c0=N.source)==null?void 0:c0.id,G=(u0=N.target)==null?void 0:u0.id;A(B,G),((l0=N.type)!=null&&l0.includes("DataOutputAssociation")||(p0=N.type)!=null&&p0.includes("DataInputAssociation")||N.type==="bpmn:Association")&&A(G,B)}const I=o.filter(N=>N.type==="bpmn:Group");for(const N of I){const G=(((f0=N.businessObject.extensionElements)==null?void 0:f0.values)??[]).find(ae=>ae.$type==="bwl:Members"),H=((G==null?void 0:G.refs)??"").split(" ").filter(Boolean);if(!H.length)continue;const V=new Set(H),Z=[...H];for(;Z.length;){const ae=Z.shift();for(const ye of R.get(ae)??[])V.has(ye)||(V.add(ye),Z.push(ye))}const pe=N.x,we=N.x+N.width,ie=N.y,Me=N.y+N.height,se=ae=>m.filter(ye=>ye.flow.target===ae).length,Ee=ae=>{var ge;const ye=((ge=l(ae))==null?void 0:ge.type)??"";if(ye==="bpmn:StartEvent"&&se(ae)===0)return!1;if(ye.endsWith("Gateway")){const Ae=m.filter(nt=>nt.flow.target===ae).map(nt=>nt.flow.source);if(Ae.length&&Ae.every(nt=>{var Qe;return((Qe=l(nt))==null?void 0:Qe.type)==="bpmn:StartEvent"&&se(nt)===0}))return!1}return!0},ot=o.filter(ae=>jn(ae)).filter(ae=>ae.type!=="bpmn:Group"&&ae.type!=="bpmn:Participant"&&ae.type!=="bpmn:TextAnnotation"&&!V.has(ae.id)&&qr(ae.id)&&Ee(ae.id)&&ae.x<we&&ae.x+ae.width>pe&&ae.y<Me&&ae.y+ae.height>ie);if(ot.length)for(const ae of[-1,1]){const ye=ot.filter(ne=>(ne.x+ne.width-pe<=we-ne.x?-1:1)===ae);if(!ye.length)continue;const ge=[];for(const ne of ye){const ee=ge.find(_e=>_e.some(Te=>ne.y<Te.y+Te.height&&ne.y+ne.height>Te.y));ee?ee.push(ne):ge.push([ne])}const Ae=new Map;for(const ne of ge){let ee=ae<0?pe-Kr:we+Kr;for(const _e of[...ne].sort((Te,Re)=>ae<0?Re.x-Te.x:Te.x-Re.x)){const Te=ae<0?Math.min(_e.x,ee-_e.width):Math.max(_e.x,ee);ee=ae<0?Te-bn:Te+_e.width+bn,Te!==_e.x&&Math.sign(Te-_e.x)===ae&&Ae.set(_e.id,Te-_e.x)}}const nt=new Map,Qe=ne=>nt.get(ne)===ne||!nt.get(ne)?ne:Qe(nt.get(ne));for(const ne of ye)nt.set(ne.id,ne.id);for(const ne of _){const ee=Ae.has(ne.flow.source)?ne.flow.source:void 0,_e=Ae.has(ne.flow.target)?ne.flow.target:void 0;if(!ee||!_e)continue;const Te=l(ne.flow.id);((d0=Te==null?void 0:Te.waypoints)==null?void 0:d0.length)===2&&nt.set(Qe(ee),Qe(_e))}const Kt=new Map;for(const ne of ye){if(!Ae.has(ne.id))continue;const ee=Qe(ne.id);Kt.set(ee,[...Kt.get(ee)??[],ne])}const xn=[...Kt.values()].sort((ne,ee)=>ae<0?Math.min(...ne.map(_e=>_e.x))-Math.min(...ee.map(_e=>_e.x)):Math.max(...ee.map(_e=>_e.x))-Math.max(...ne.map(_e=>_e.x))),Se=[];let Je=!0;for(const ne of xn){const ee=ne.map(Re=>Ae.get(Re.id)??0).reduce((Re,Fe)=>Math.abs(Fe)>Math.abs(Re)?Fe:Re,0),_e=new Map;let Te=!0;for(const Re of ne){const Fe=p(Re);if(!Fe){Te=!1;break}_e.has(Fe.id)||_e.set(Fe.id,{subtree:[],pool:Fe}),_e.get(Fe.id).subtree.push(Re)}Te&&Au([..._e.values()],ee,()=>!0,Pu)?Se.push({shapes:ne,dx:ee}):Je=!1}if(!Je)for(const ne of Se.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 I=(((h0=R.businessObject.extensionElements)==null?void 0:h0.values)??[]).find(H=>H.$type==="bwl:Members"),N=((I==null?void 0:I.refs)??"").split(" ").filter(Boolean).map(l).filter(H=>!!H);!N.length||!N.some(H=>{const V=d.get(H.id);return!V||V.x!==H.x||V.y!==H.y})||!N.some(H=>H.x<R.x||H.y<R.y||H.x+H.width>R.x+R.width||H.y+H.height>R.y+R.height)||n.resizeShape(R,nd(N,R.id))}}{const R=new Map(so(pt(o)).map(H=>[H.owner,H.rect])),A=o.filter(H=>!!H.waypoints),I=new Map,N=(H,V)=>{!H||!V||(I.has(H)||I.set(H,new Set),I.get(H).add(V))};for(const H of A){const V=(m0=H.source)==null?void 0:m0.id,Z=(g0=H.target)==null?void 0:g0.id;N(V,Z),((y0=H.type)!=null&&y0.includes("DataOutputAssociation")||(v0=H.type)!=null&&v0.includes("DataInputAssociation")||H.type==="bpmn:Association")&&N(Z,V)}const B=H=>m.filter(V=>V.flow.target===H).length,G=H=>{var Z;const V=((Z=l(H))==null?void 0:Z.type)??"";if(V==="bpmn:StartEvent"&&B(H)===0)return!1;if(V.endsWith("Gateway")){const pe=m.filter(we=>we.flow.target===H).map(we=>we.flow.source);if(pe.length&&pe.every(we=>{var ie;return((ie=l(we))==null?void 0:ie.type)==="bpmn:StartEvent"&&B(we)===0}))return!1}return!0};for(const H of o.filter(V=>V.type==="bpmn:Group")){const Z=(((b0=H.businessObject.extensionElements)==null?void 0:b0.values)??[]).find(ee=>ee.$type==="bwl:Members"),pe=((Z==null?void 0:Z.refs)??"").split(" ").filter(Boolean);if(!pe.length)continue;const we=pe.map(l).filter(ee=>!!ee);if(!we.length||!(P.some(ee=>ee.group.id===H.id)||Ut(e,"group.update").some(ee=>ee.id===H.id)||we.some(ee=>{const _e=d.get(ee.id);return!_e||_e.x!==ee.x||_e.y!==ee.y})))continue;const Me=new Set(pe),se=[...pe];for(;se.length;){const ee=se.shift();for(const _e of I.get(ee)??[])Me.has(_e)||(Me.add(_e),se.push(_e))}const Ee=H.x,ot=H.x+H.width,ae=H.y,ye=H.y+H.height,ge=ee=>{const _e=R.get(ee.id),Te={x:ee.x,y:ee.y,width:ee.width,height:ee.height};return _e?[Te,{x:_e.x,y:_e.y,width:_e.width,height:_e.height}]:[Te]},Ae=we.flatMap(ge),nt=Math.min(...Ae.map(ee=>ee.x)),Qe=Math.max(...Ae.map(ee=>ee.x+ee.width)),Kt=Math.min(...Ae.map(ee=>ee.y)),xn=Math.max(...Ae.map(ee=>ee.y+ee.height)),Se={L:nt-Ee,R:ot-Qe,T:Kt-ae,B:ye-xn},Je=o.filter(ee=>jn(ee)).filter(ee=>ee.type!=="bpmn:Group"&&ee.type!=="bpmn:Participant"&&ee.type!=="bpmn:TextAnnotation"&&!Me.has(ee.id)&&G(ee.id)&&ee.x<ot&&ee.x+ee.width>Ee&&ee.y<ye&&ee.y+ee.height>ae);if(!Je.length)continue;const ne={L:0,R:0,T:0,B:0};for(const ee of Je){const _e=ge(ee),Te=Math.min(..._e.map(ht=>ht.x)),Re=Math.max(..._e.map(ht=>ht.x+ht.width)),Fe=Math.min(..._e.map(ht=>ht.y)),tt=Math.max(..._e.map(ht=>ht.y+ht.height)),Gt={L:Re-Ee,R:ot-Te,T:tt-ae,B:ye-Fe},si=["L","R","T","B"].filter(ht=>Gt[ht]<=Se[ht]+.001);if(!si.length)continue;const Rt=si.reduce((ht,es)=>Gt[es]<Gt[ht]?es:ht,si[0]);ne[Rt]=Math.max(ne[Rt],Math.min(Gt[Rt]+10,Se[Rt]))}!ne.L&&!ne.R&&!ne.T&&!ne.B||n.resizeShape(H,{x:H.x+ne.L,y:H.y+ne.T,width:H.width-ne.L-ne.R,height:H.height-ne.T-ne.B})}}const Xx=v=>{const R=v.waypoints;if(R!=null&&R.length){const I=R[Math.floor((R.length-1)/2)];return{x:I.x,y:I.y,width:0,height:0}}const A=v;return{x:A.x,y:A.y,width:A.width,height:A.height}};let Ja=0;const Zx=12,Qx=14,JD=15,eL=300,tL=v=>{const R=v.split(`
7
+ `),A=Math.max(...R.map(B=>ro(B,Zx))),I=Math.max(100,Math.min(eL,Math.ceil(A)+Qx)),N=R.reduce((B,G)=>B+Math.max(1,Math.ceil((ro(G,Zx)+Qx)/I)),0);return{width:I,height:Math.max(30,N*JD+10)}};for(const v of S){const R=v.association,A=((_0=v.placement)==null?void 0:_0.anchor)??(R?R.source===v.annotation.id?R.target:R.source:void 0),I=A?l(A):void 0,N=I?Xx(I):void 0,B=tL(v.annotation.text??"");let G;if(N&&v.placement){const[pe,we]=_s[v.placement.side],ie=v.placement.offset??50;G={x:N.x+N.width/2+pe*(N.width/2+B.width/2+ie),y:N.y+N.height/2+we*(N.height/2+B.height/2+ie)}}else N?(G={x:N.x+N.width/2+180+Ja%3*260,y:N.y-110-Ja%2*95},Ja++):(G={x:300+Ja*260,y:60},Ja++);const H=I?p(I)??u():u(),V=H;N&&typeof V.x=="number"&&typeof V.width=="number"&&V.type==="bpmn:Participant"&&(G=sl(o,N,B,V,v.placement?{placement:v.placement}:{from:G}));const Z=n.createShape({type:"bpmn:TextAnnotation",width:B.width,height:B.height,businessObject:i.create("bpmn:TextAnnotation",{id:v.annotation.id,text:v.annotation.text})},G,H);if(R){const pe=we=>we===v.annotation.id?Z:f(we);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(Z,"bwl:Placement",T(v.placement))}for(const v of Ut(e,"association.add")){const R=v.association;n.connect(f(R.source),f(R.target),R.id?{type:"bpmn:Association",businessObject:i.create("bpmn:Association",{id:R.id})}:{type:"bpmn:Association"})}for(const v of Ut(e,"node.update")){let R=f(v.id);if(v.type&&bs(v.type)!==R.type&&(R=c.replaceElement(R,{type:bs(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,I=p(R),N=v.lane?f(v.lane):((I==null?void 0:I.children)??[]).find(G=>G.type==="bpmn:Lane"&&A>=G.y&&A<=G.y+G.height);v.band!==void 0&&X(N==null?void 0:N.id,v.band,I);const B=N?N.y+(v.band===void 0?N.height/2:Math.min(N.height/2,oe)+M(N.id,v.band)*k):v.band!==void 0&&I?I.y+j+M(`pool:${I.id}`,v.band)*k:void 0;if(B!==void 0){const G=B-A;G!==0&&n.moveElements([R],{x:0,y:G})}}}for(const v of Ut(e,"sequenceFlow.update")){const R=f(v.id);if(v.source!==void 0||v.target!==void 0){const A=R,I=v.source!==void 0?f(v.source):A.source,N=v.target!==void 0?f(v.target):A.target,B=G=>({x:G.x+G.width/2,y:G.y+G.height/2});n.reconnect(A,I,N,[B(I),B(N)])}v.name!==void 0&&n.updateProperties(R,{name:v.name??void 0}),v.condition!==void 0&&n.updateProperties(R,{name:((x0=v.condition)==null?void 0:x0.label)??void 0})}for(const v of Ut(e,"messageFlow.update"))v.name!==void 0&&n.updateProperties(f(v.id),{name:v.name??void 0});for(const v of Ut(e,"dataStore.update"))v.name!==void 0&&n.updateProperties(f(v.id),{name:v.name??void 0});for(const v of Ut(e,"annotation.update")){const R=f(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=f(v.placement.anchor),I=Xx(A),N=p(A)??u(),B=typeof N.x=="number"&&typeof N.width=="number"&&N.type==="bpmn:Participant",[G,H]=_s[v.placement.side],V=v.placement.offset??50,Z={x:I.x+I.width/2+G*(I.width/2+R.width/2+V),y:I.y+I.height/2+H*(I.height/2+R.height/2+V)},pe=B?sl(o,I,{width:R.width,height:R.height},N,{placement:v.placement,selfId:v.id}):Z;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=f(v.id);if(v.name!==void 0&&n.updateLabel(R,v.name??""),v.members){const A=v.members.map(l).filter(I=>!!I);A.length&&n.resizeShape(R,nd(A,v.id)),D(R,"bwl:Members",{refs:v.members.join(" ")})}}}function cl(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 i1(e,t,n){var l,f;const{elementRegistry:i}=e,r=e.modeling,o=p=>ri(p).filter(d=>!t.has(ii(d))),a=p=>{var d;return((d=i.get(p))==null?void 0:d.type)==="bpmn:TextAnnotation"},s=pt(i),c=o(s),u=[...new Set(c.flatMap(cl))].filter(p=>n.has(p)&&a(p));if(u.length)for(const p of u){const d=i.get(p);if(!d||typeof d.x!="number"||typeof d.width!="number")continue;let g=d.parent,h;for(;g;){if(g.type==="bpmn:Participant"){h=g;break}g=g.parent}if(!h){const xe=d.x+d.width/2,Ue=d.y+d.height/2;h=i.getAll().find(Y=>{if(Y.type!=="bpmn:Participant")return!1;const ue=Y;return typeof ue.x=="number"&&typeof ue.width=="number"&&xe>=ue.x&&xe<=ue.x+ue.width&&Ue>=ue.y&&Ue<=ue.y+ue.height})}if(!h||typeof h.x!="number"||typeof h.width!="number")continue;const _=(((l=d.businessObject.extensionElements)==null?void 0:l.values)??[]).find(xe=>xe.$type==="bwl:Placement"),y=[...d.incoming??[],...d.outgoing??[]].find(xe=>xe.type==="bpmn:Association"),x=(_!=null&&_.anchor?i.get(_.anchor):void 0)??(y?((f=y.source)==null?void 0:f.id)===p?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=_==null?void 0:_.side,$=[];T&&T in _s&&$.push(sl(i,P,C,h,{placement:{side:T,offset:(_==null?void 0:_.offset)??null},selfId:p}));for(const[xe,Ue]of[[-1,0],[1,0],[0,-1],[0,1]])for(let Y=1;Y<=n1;Y++)$.push({x:D.x+xe*Ah*Y,y:D.y+Ue*Ah*Y});const k={...s,edges:s.edges.filter(xe=>xe.id!==(y==null?void 0:y.id))},O=o(k),j=O.filter(xe=>cl(xe).includes(p)).length;if(!j)continue;let oe;for(const xe of $){const Ue=xe.x-D.x,Y=xe.y-D.y;if(!Ue&&!Y||xe.x-C.width/2<h.x||xe.x+C.width/2>h.x+h.width||xe.y-C.height/2<h.y||xe.y+C.height/2>h.y+h.height)continue;const ue={...k,shapes:k.shapes.map(ce=>ce.id===p?{...ce,x:ce.x+Ue,y:ce.y+Y}:ce)},ve=o(ue),le=ve.filter(ce=>cl(ce).includes(p)).length;if(le>=j||ve.length>O.length)continue;const be=Math.abs(Ue)+Math.abs(Y);if((!oe||le<oe.mine||le===oe.mine&&(ve.length<oe.all||ve.length===oe.all&&be<oe.dist))&&(oe={x:xe.x,y:xe.y,mine:le,all:ve.length,dist:be}),oe.mine===0&&oe.all<O.length)break}oe&&r.moveElements([d],{x:oe.x-D.x,y:oe.y-D.y})}}function Mh(e,t,n=Th){const i=Ph(e),r=Ch(t,Qd(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=pt(i.elementRegistry),s=new Set(ri(a).map(ii)),c=new Set(a.edges.map(h=>h.id)),u=new Set(a.shapes.map(h=>h.id)),l=el(a).length,f=e.get("commandStack");try{sd(f,()=>{n(t,i),sh(i,c),rh(i,s),yh(i,s,c),lh(i,c),qE(i,c),dh(i,s,c),ZE(i,s,c),xh(i,s,c),_h(i,c),Eh(i,u),i1(i,s,u)})}catch(h){return{ok:!1,issues:[{kind:"lower-failed",message:h instanceof Error?h.message:String(h)}],findings:[],stats:o}}const p=pt(i.elementRegistry),d=ri(p).filter(h=>!s.has(ii(h))),g=Vd(p);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 r1(e){const t=e.slice(e.indexOf(":")+1);return t.charAt(0).toLowerCase()+t.slice(1)}function o1(e,t){return typeof e.get=="function"?e.get(t):e[t]}function kh(e,t){const n=o1(e,t);return typeof n=="number"&&Number.isFinite(n)?n:void 0}function Oh(e,t){var i;return(((i=e.extensionElements)==null?void 0:i.values)??[]).find(r=>(r==null?void 0:r.$type)===t)}function a1(e){return typeof e=="string"&&Mu.includes(e)}function pi(e){if(typeof e=="string")return e;const t=e==null?void 0:e.id;return typeof t=="string"?t:void 0}function Dh(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:{}},f=[],p=[],d=[],g=[],h=[],m=[],_=new Set,y=new Set,x=Y=>{Y&&_.add(Y)},S=Y=>{_.add(Y),y.add(Y)},P=Y=>{const ue=Oh(Y,"bwl:Placement");if(!ue)return;const ve=typeof ue.anchor=="string"?ue.anchor:void 0;if(!ve||!a1(ue.side))return;const le=typeof ue.offset=="number"?ue.offset:void 0;h.push({owner:Y.id,anchor:ve,side:ue.side,...le!==void 0?{offset:le}:{}})},C=Y=>{const ue=Oh(Y,"bwl:Members"),ve=typeof(ue==null?void 0:ue.refs)=="string"?ue.refs.split(/\s+/).filter(Boolean):[];ve.length&&m.push({owner:Y.id,refs:ve})},D=Y=>{var ue;for(const ve of Y)switch(x(ve.id),ve.$type){case"bpmn:TextAnnotation":S(ve.id),s.push({id:ve.id,text:typeof ve.text=="string"?ve.text:""}),P(ve);break;case"bpmn:Association":d.push({id:ve.id,type:ve.$type,source:pi(ve.sourceRef),target:pi(ve.targetRef)});break;case"bpmn:Group":{S(ve.id);const le=(ue=ve.categoryValueRef)==null?void 0:ue.value;c.push({id:ve.id,...typeof le=="string"&&le?{name:le}:{}}),C(ve);break}default:u.push({id:ve.id,type:ve.$type,reason:"type-outside-mvp"})}},T=(Y,ue)=>{const ve=Y.flowElements??[],le=(Y.laneSets??[]).flatMap(ce=>ce.lanes??[]),be=new Map;for(const ce of le){x(ce.id);for(const U of ce.flowNodeRef??[]){const q=pi(U);q&&be.set(q,ce.id)}}for(const ce of ve){if(x(ce.id),ce.$type==="bpmn:SequenceFlow"){f.push({id:ce.id,source:pi(ce.sourceRef),target:pi(ce.targetRef),...typeof ce.name=="string"&&ce.name?{name:ce.name}:{}});continue}if(ce.$type==="bpmn:DataStoreReference"){S(ce.id),a.push({id:ce.id,...ce.name?{name:ce.name}:{}});continue}const U=r1(ce.$type);if(!id(U)){u.push({id:ce.id,type:ce.$type,reason:"type-outside-mvp"});continue}S(ce.id),o.push({id:ce.id,type:U,...ce.name?{name:ce.name}:{},...ue?{participant:ue}:{},...be.has(ce.id)?{lane:be.get(ce.id)}:{}});const q=kh(ce,"bwl:band");q!==void 0&&(l.bands[ce.id]=q);for(const K of ce.dataOutputAssociations??[])x(K.id),g.push({id:K.id,type:K.$type,source:ce.id,target:pi(K.targetRef)});for(const K of ce.dataInputAssociations??[])x(K.id),g.push({id:K.id,type:K.$type,source:pi((K.sourceRef??[])[0]),target:ce.id})}D(Y.artifacts??[])};if(n){const Y=new Set;for(const ue of n.participants??[]){S(ue.id);const ve=pi(ue.processRef);ve&&Y.add(ve);const le=ve?i.get(ve):void 0,be=((le==null?void 0:le.laneSets)??[]).flatMap(K=>K.lanes??[]),ce=be.map(K=>({id:K.id,...K.name?{name:K.name}:{}}));for(const K of ce)S(K.id);const U=!le||(le.flowElements??[]).length===0&&be.length===0&&(le.artifacts??[]).length===0;r.push({id:ue.id,...ue.name?{name:ue.name}:{},...U?{blackBox:!0}:{},...ce.length?{lanes:ce}:{}});const q=kh(ue,"bwl:poolOrder");q!==void 0&&(l.poolOrders[ue.id]=q),le&&T(le,ue.id)}for(const ue of n.messageFlows??[])x(ue.id),p.push({id:ue.id,source:pi(ue.sourceRef),target:pi(ue.targetRef),...typeof ue.name=="string"&&ue.name?{name:ue.name}:{}});D(n.artifacts??[]);for(const[ue,ve]of i)!Y.has(ue)&&(ve.flowElements??[]).length>0&&u.push({id:ue,type:ve.$type,reason:"unreachable-process"})}else for(const Y of i.values())T(Y);const $=[],k=[],O=[],j=[],oe=(Y,ue)=>!!Y&&!!ue&&y.has(Y)&&y.has(ue);for(const Y of f){if(!oe(Y.source,Y.target)){u.push({id:Y.id,type:"bpmn:SequenceFlow",reason:"endpoint-outside-mvp"});continue}$.push({id:Y.id,source:Y.source,target:Y.target,...Y.name?{name:Y.name}:{}}),y.add(Y.id)}for(const Y of p){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}j.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 xe=new Map(c.map(Y=>[Y.id,Y]));for(const{owner:Y,refs:ue}of m){const ve=ue.filter(be=>_.has(be)),le=xe.get(Y);le&&ve.length&&(le.members=ve)}for(const Y of h)_.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:$,...k.length?{messageFlows:k}:{},...a.length?{dataStores:a}:{},...j.length?{dataAssociations:j}:{},...s.length?{annotations:s}:{},...O.length?{associations:O}:{},...c.length?{groups:c}:{}},hints:l,omitted:u}}async function s1(e){const{definitions:t,warnings:n}=await qu(e);return{...Dh(t),warnings:n}}function c1(e,t,n,i={}){return{documentId:e,baseVersion:t,ops:[...n],origin:i.origin??"agent",clientOpId:(i.mkClientOpId??(()=>crypto.randomUUID()))()}}async function Lh(e,t,{currentVersion:n}){if(t.baseVersion!==n)return{status:"conflict",baseVersion:t.baseVersion,currentVersion:n};const i=Mh(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 u1=Symbol("bpmn-editor");function l1(){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 f=u.get("keyboard");l?(r&&f.bind(r),r=void 0):r||(r=f.getBinding(),f.unbind())}function s(){if(!i)throw new Error("modeler not attached — 뷰 @ready 후 attach() 필요");return i}function c(){return i==null?void 0:i.get("commandStack")}return{dirty:e,editable:t,agentBusy:n,attach(u){i&&this.detach(),i=u,i.get("eventBus").on("commandStack.changed",o),t.value||a(i,!1)},detach(){i==null||i.get("eventBus").off("commandStack.changed",o),i&&!t.value&&a(i,!0),r=void 0,i=void 0},setEditable(u){t.value=u,i&&a(i,u)},async applyAgentBatch(u,l){const f=s();n.value=!0;try{const p=await Lh(f,u,{currentVersion:l});return p.status==="applied"&&(e.value=!1),p}finally{n.value=!1}},async importXml(u){const{warnings:l}=await s().importXML(u);return e.value=!1,{warnings:Yu(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 p1(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var ul={exports:{}},Ih;function f1(){if(Ih)return ul.exports;Ih=1;var e=ul.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},ul.exports}var d1=f1(),h1=p1(d1);function fi(e){if(!(this instanceof fi))return new fi(e);e=e||[128,36,1],this._seed=e.length?h1.rack(e[0],e[1],e[2]):e}fi.prototype.next=function(e){return this._seed(e||!0)},fi.prototype.nextPrefixed=function(e,t){var n;do n=e+this.next(!0);while(this.assigned(n));return this.claim(n,t),n},fi.prototype.claim=function(e,t){this._seed.set(e,t||!0)},fi.prototype.assigned=function(e){return this._seed.get(e)||!1},fi.prototype.unclaim=function(e){delete this._seed.hats[e]},fi.prototype.clear=function(){var e=this._seed.hats,t;for(t in e)this.unclaim(t)};const Ft={legend:[1,"<fieldset>","</fieldset>"],tr:[2,"<table><tbody>","</tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],_default:[0,"",""]};Ft.td=Ft.th=[3,"<table><tbody><tr>","</tr></tbody></table>"],Ft.option=Ft.optgroup=[1,'<select multiple="multiple">',"</select>"],Ft.thead=Ft.tbody=Ft.colgroup=Ft.caption=Ft.tfoot=[1,"<table>","</table>"],Ft.polyline=Ft.ellipse=Ft.polygon=Ft.circle=Ft.text=Ft.line=Ft.path=Ft.rect=Ft.g=[1,'<svg xmlns="http://www.w3.org/2000/svg" version="1.1">',"</svg>"];function dt(e,t=globalThis.document){var u;if(typeof e!="string")throw new TypeError("String expected");const n=/^<!--(.*?)-->$/s.exec(e);if(n)return t.createComment(n[1]);const i=(u=/<([\w:]+)/.exec(e))==null?void 0:u[1];if(!i)return t.createTextNode(e);if(e=e.trim(),i==="body"){const l=t.createElement("html");l.innerHTML=e;const{lastChild:f}=l;return f.remove(),f}let[r,o,a]=Object.hasOwn(Ft,i)?Ft[i]:Ft._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 m1(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 g1=Object.prototype.toString;function vt(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 g1.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 xs(e){for(var t;t=e.firstChild;)e.removeChild(t);return e}function Tr(e,t,n){var i=n?e:e.parentNode;return i&&typeof i.closest=="function"&&i.closest(t)||null}function y1(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var ws={},Bh;function v1(){if(Bh)return ws;Bh=1;var e,t,n;function i(){e=window.addEventListener?"addEventListener":"attachEvent",t=window.removeEventListener?"removeEventListener":"detachEvent",n=e!=="addEventListener"?"on":""}return ws.bind=function(r,o,a,s){return e||i(),r[e](n+o,a,s||!1),a},ws.unbind=function(r,o,a,s){return t||i(),r[t](n+o,a,s||!1),a},ws}var Nh=v1(),b1=y1(Nh),Be=m1({__proto__:null,default:b1},[Nh]),$h=["focus","blur"];function _1(e,t,n,i,r){return $h.indexOf(n)!==-1&&(r=!0),Be.bind(e,n,function(o){var a=o.target||o.srcElement;o.delegateTarget=Tr(a,t,!0),o.delegateTarget&&i.call(e,o)},r)}function x1(e,t,n,i){return $h.indexOf(t)!==-1&&(i=!0),Be.unbind(e,t,n,i)}var Cn={bind:_1,unbind:x1};function ll(e,t){return e&&typeof e.matches=="function"&&e.matches(t)||!1}function rt(e,t){return t=t||document,t.querySelector(e)}function Es(e,t){return t=t||document,t.querySelectorAll(e)}function di(e){e.parentNode&&e.parentNode.removeChild(e)}function w1(e,t){if(e.ownerDocument!==t.ownerDocument)try{return t.ownerDocument.importNode(e,!0)}catch{}return e}function E1(e,t){return t.appendChild(w1(e,t))}function Ne(e,t){return E1(t,e),e}var pl=2,Fh={"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":pl,"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":pl,"text-anchor":1,"text-decoration":1,"text-rendering":1,"unicode-bidi":1,visibility:1,"word-spacing":1,"writing-mode":1};function S1(e,t){return Fh[t]?e.style[t]:e.getAttributeNS(null,t)}function jh(e,t,n){var i=t.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase(),r=Fh[i];r?(r===pl&&typeof n=="number"&&(n=String(n)+"px"),e.style[i]=n):e.setAttributeNS(null,t,n)}function R1(e,t){var n=Object.keys(t),i,r;for(i=0,r;r=n[i];i++)jh(e,r,t[r])}function he(e,t,n){if(typeof t=="string")if(n!==void 0)jh(e,t,n);else return S1(e,t);else R1(e,t);return e}const C1=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 C1.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 Ss(e){for(var t;t=e.firstChild;)e.removeChild(t);return e}function Hh(e){return e.cloneNode(!0)}var fl={svg:"http://www.w3.org/2000/svg"},zh='<svg xmlns="'+fl.svg+'"';function P1(e){var t=!1;e.substring(0,4)==="<svg"?e.indexOf(fl.svg)===-1&&(e=zh+e.substring(4)):(e=zh+">"+e+"</svg>",t=!0);var n=A1(e);if(!t)return n;for(var i=document.createDocumentFragment(),r=n.firstChild;r.firstChild;)i.appendChild(r.firstChild);return i}function A1(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=P1(e).firstChild,n=document.importNode(n,!0)):n=document.createElementNS(fl.svg,e),t&&he(n,t),n}var dl=null;function Gh(){return dl===null&&(dl=Ce("svg")),dl}function Vh(e,t){var n,i,r=Object.keys(t);for(n=0;i=r[n];n++)e[i]=t[i];return e}function T1(e,t,n,i,r,o){var a=Gh().createSVGMatrix();switch(arguments.length){case 0:return a;case 1:return Vh(a,e);case 6:return Vh(a,{a:e,b:t,c:n,d:i,e:r,f:o})}}function Xo(e){return Gh().createSVGTransform()}var Wh=/([&<>]{1})/g,M1=/([&<>\n\r"]{1})/g,k1={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"'"};function hl(e,t){function n(i,r){return k1[r]||r}return e.replace(t,n)}function Uh(e,t){var n,i,r,o,a;switch(e.nodeType){case 3:t.push(hl(e.textContent,Wh));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,'="',hl(o.value,M1),'"');if(e.hasChildNodes()){for(t.push(">"),a=e.childNodes,n=0,i=a.length;n<i;++n)Uh(a.item(n),t);t.push("</",e.tagName,">")}else t.push("/>");break;case 8:t.push("<!--",hl(e.nodeValue,Wh),"-->");break;case 4:t.push("<![CDATA[",e.nodeValue,"]]>");break;default:throw new Error("unable to handle node "+e.nodeType)}return t}function O1(e){for(var t=e.firstChild,n=[];t;)Uh(t,n),t=t.nextSibling;return n.join("")}function qh(e,t){return O1(e)}function jt(e){var t=e.parentNode;return t&&t.removeChild(e),e}function D1(e,t){return t instanceof SVGMatrix?e.createSVGTransformFromMatrix(t):t}function L1(e,t){var n,i;for(e.clear(),n=0;i=t[n];n++)e.appendItem(D1(e,i))}function Zo(e,t){var n=e.transform.baseVal;return t&&(Array.isArray(t)||(t=[t]),L1(n,t)),n.consolidate()}const I1=/^class[ {]/;function B1(e){return I1.test(e.toString())}function ml(e){return Array.isArray(e)}function gl(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function Rs(...e){e.length===1&&ml(e[0])&&(e=e[0]),e=[...e];const t=e.pop();return t.$inject=e,t}const N1=/constructor\s*[^(]*\(\s*([^)]*)\)/m,$1=/^(?:async\s+)?(?:function\s*[^(]*)?(?:\(\s*([^)]*)\)|(\w+))/m,F1=/\/\*([^*]*)\*\//m;function j1(e){if(typeof e!="function")throw new Error(`Cannot annotate "${e}". Expected a function!`);const t=e.toString().match(B1(e)?N1:$1);if(!t)return[];const n=t[1]||t[2];return n&&n.split(",").map(i=>{const r=i.match(F1);return(r&&r[1]||i).trim()})||[]}function Yh(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(gl(o,x))return o[x];if(gl(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(ml(x))x=Rs(x.slice());else throw s(`Cannot invoke "${x}". Expected a function!`);const C=(x.$inject||j1(x)).map(D=>gl(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 f(x,S,P){const{fn:C,dependencies:D}=u(x,P);return C.apply(S,D)}function p(x){return Rs(S=>x.get(S))}function d(x,S){if(S&&S.length){const P=Object.create(null),C=Object.create(null),D=[],T=[],$=[];let k,O,j,oe;for(let xe in r)k=r[xe],S.indexOf(xe)!==-1&&(k[2]==="private"?(O=D.indexOf(k[3]),O===-1?(j=k[3].createChild([],S),oe=p(j),D.push(k[3]),T.push(j),$.push(oe),P[xe]=[oe,xe,"private",j]):P[xe]=[$[O],xe,"private",T[O]]):P[xe]=[k[2],k[1]],C[xe]=!0),(k[2]==="factory"||k[2]==="type")&&k[1].$scope&&S.forEach(Ue=>{k[1].$scope.indexOf(Ue)!==-1&&(P[xe]=[k[2],k[1]],C[Ue]=!0)});S.forEach(xe=>{if(!C[xe])throw new Error('No provider for "'+xe+'". Cannot use provider from the parent!')}),x.unshift(P)}return new Yh(x,a)}const g={factory:f,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,j)=>(j!=="__exports__"&&j!=="__modules__"&&j!=="__init__"&&j!=="__depends__"&&(O[j]=x[j]),O),Object.create(null)),D=(P||[]).concat(C),T=d(D),$=Rs(function(O){return T.get(O)});S.forEach(function(O){r[O]=[$,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],H1(D,T),D]}),h(x,a)}function _(x,S){return x.indexOf(S)!==-1||(x=(S.__depends__||[]).reduce(_,x),x.indexOf(S)!==-1)?x:x.concat(S)}function y(x){const S=x.reduce(_,[]).map(m);let P=!1;return function(){P||(P=!0,S.forEach(C=>C()))}}this.get=c,this.invoke=f,this.instantiate=l,this.createChild=d,this.init=y(e)}function H1(e,t){return e!=="value"&&ml(t)&&(t=Rs(t.slice())),t}var z1=1e3;function Ti(e,t){var n=this;t=t||z1,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 Mr(e){return e.flat().join(",").replace(/,?([A-Za-z]),?/g,"$1")}function G1(e){return["M",e.x,e.y]}function yl(e){return["L",e.x,e.y]}function V1(e,t,n){return["C",e.x,e.y,t.x,t.y,n.x,n.y]}function W1(e,t){const n=e.length,i=[G1(e[0])];for(let r=1;r<n;r++){const o=e[r-1],a=e[r],s=e[r+1];if(!s||!t){i.push(yl(a));continue}const c=Math.min(t,vl(a.x-o.x,a.y-o.y),vl(s.x-a.x,s.y-a.y));if(!c){i.push(yl(a));continue}const u=Cs(a,o,c),l=Cs(a,o,c*.5),f=Cs(a,s,c),p=Cs(a,s,c*.5);i.push(yl(u)),i.push(V1(l,p,f))}return i}function Cs(e,t,n){const i=t.x-e.x,r=t.y-e.y,o=vl(i,r),a=n/o;return{x:e.x+i*a,y:e.y+r*a}}function vl(e,t){return Math.sqrt(Math.pow(e,2)+Math.pow(t,2))}function Qo(e,t,n){Le(t)&&(n=t,t=null),t||(t={});const i=Ce("path",t);return Le(n)&&(i.dataset.cornerRadius=String(n)),bl(i,e)}function bl(e,t){const n=parseInt(e.dataset.cornerRadius,10)||0;return he(e,{d:Mr(W1(t,n))}),e}function Ps(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 kr(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&&kr(o,t,n+1)})}function _l(e,t,n){var i=new Set,r=new Set;return kr(e,function(o,a,s){i.add(o);var c=o.children;if(c&&!r.has(c))return r.add(c),c}),Array.from(i)}function Jo(e,t){return _l(e)}function U1(e,t,n){Sr(t)&&(t=!0),Vt(t)&&(n=t,t=!0),n=n||{};var i=ea(n.allShapes),r=ea(n.allConnections),o=ea(n.enclosedElements),a=ea(n.enclosedConnections),s=ea(n.topLevel,t&&Jr(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 kr(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,f=s.width||0;(c<n||n===void 0)&&(n=c),(u<i||i===void 0)&&(i=u),(c+f>r||r===void 0)&&(r=c+f),(u+l>o||o===void 0)&&(o=u+l)}),{x:n,y:i,height:o-i,width:r-n}}function 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 Kh(e){return"waypoints"in e?"connection":"x"in e?"shape":"root"}function Xh(e){return!!(e&&e.isFrame)}function ea(e,t){return z({},e||{},t||{})}var q1=1;function Qi(e,t){Ti.call(this,e,q1),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}),Xh(n)?he(r,z({},this.FRAME_STYLE,i||{})):he(r,z({},this.SHAPE_STYLE,i||{})),Ne(t,r),r},Qi.prototype.drawConnection=function(t,n,i){var r=Qo(n.waypoints,z({},this.CONNECTION_STYLE,i||{}));return Ne(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 Mr(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 Mr(o)},Qi.$inject=["eventBus","styles"];function Y1(){var e={"no-fill":{fill:"none"},"no-border":{strokeOpacity:0},"no-events":{pointerEvents:"none"}},t=this;this.cls=function(n,i,r){var o=this.style(i,r);return z(o,{class:n})},this.style=function(n,i){!ke(n)&&!i&&(i=n,n=[]);var r=Sn(n,function(o,a){return z(o,e[a]||{})},{});return i?z(r,i):r},this.computeStyle=function(n,i,r){return ke(i)||(r=i,i=[]),t.style(i||[],z({},r,n||{}))}}const K1={__init__:["defaultRenderer"],defaultRenderer:["type",Qi],styles:["type",Y1]};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 xl(e,t){return!e||!t?-1:e.indexOf(t)}function ta(e,t){return!e||!t?-1:Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function wl(e,t,n,i){if(typeof i>"u"&&(i=5),!e||!t||!n)return!1;var r=(t.x-e.x)*(n.y-e.y)-(t.y-e.y)*(n.x-e.x),o=ta(e,t);return Math.abs(r/o)<=i}var X1=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(Z1(r,n))return o;return!1}function Z1(e,t){const n=t[0];return Rr(t,function(i){return Math.abs(n[e]-i[e])<=X1})}function Zh(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 El(e,t){return{x:Math.round(e.x+(t.x-e.x)/2),y:Math.round(e.y+(t.y-e.y)/2)}}var Q1=/,?([a-z]),?/gi,Qh=parseFloat,Mt=Math,Ji=Mt.PI,hi=Mt.min,mi=Mt.max,Jh=Mt.pow,er=Mt.abs,J1=/([a-z])[\s,]*((-?\d*\.?\d*(?:e[-+]?\d+)?[\s]*,?[\s]*)+)/ig,eS=/(-?\d*\.?\d*(?:e[-+]?\d+)?)[\s]*,?[\s]*/ig,em=Array.isArray||function(e){return e instanceof Array};function tS(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function nS(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 iS(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 tS(r,i)?(nS(o,i),r[i]):(o.length>=1e3&&delete r[o.shift()],o.push(i),r[i]=e(...arguments),r[i])}return t}function rS(e){if(!e)return null;var t={a:7,c:6,h:1,l:2,m:2,q:4,s:4,t:2,v:1,z:0},n=[];return String(e).replace(J1,function(i,r,o){var a=[],s=r.toLowerCase();for(o.replace(eS,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=Rl,n}function oS(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 aS(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 Sl(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 Rl(){return this.join(",").replace(Q1,"$1")}function sS(e){for(var t=new Array(e.length),n=0,i=e.length;n<i;n++)for(var r=e[n],o=t[n]=new Array(r.length),a=0,s=r.length;a<s;a++)o[a]=r[a];return t.toString=Rl,t}function tm(e,t,n,i,r,o,a,s,c){var u=1-c,l=Jh(u,3),f=Jh(u,2),p=c*c,d=p*c,g=l*e+f*3*c*n+u*3*c*c*r+d*a,h=l*t+f*3*c*i+u*3*c*c*o+d*s;return{x:As(g),y:As(h)}}function nm(e){var t=dS(...e);return Sl(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 cS(e,t){return e=Sl(e),t=Sl(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 im(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 rm(e,t,n,i,r,o,a,s,c){c==null&&(c=1),c=c>1?1:c<0?0:c;for(var u=c/2,l=12,f=[-.1252,.1252,-.3678,.3678,-.5873,.5873,-.7699,.7699,-.9041,.9041,-.9816,.9816],p=[.2491,.2491,.2335,.2335,.2032,.2032,.1601,.1601,.1069,.1069,.0472,.0472],d=0,g=0;g<l;g++){var h=u*f[g]+u,m=im(h,e,n,r,a),_=im(h,t,i,o,s),y=m*m+_*_;d+=p[g]*Mt.sqrt(y)}return u*d}function uS(e,t,n,i,r,o,a,s){if(!(mi(e,n)<hi(r,a)||hi(e,n)>mi(r,a)||mi(t,i)<hi(o,s)||hi(t,i)>mi(o,s))){var c=(e*i-t*n)*(r-a)-(e-n)*(r*s-o*a),u=(e*i-t*n)*(o-s)-(t-i)*(r*s-o*a),l=(e-n)*(o-s)-(t-i)*(r-a);if(l){var f=As(c/l),p=As(u/l),d=+f.toFixed(2),g=+p.toFixed(2);if(!(d<+hi(e,n).toFixed(2)||d>+mi(e,n).toFixed(2)||d<+hi(r,a).toFixed(2)||d>+mi(r,a).toFixed(2)||g<+hi(t,i).toFixed(2)||g>+mi(t,i).toFixed(2)||g<+hi(o,s).toFixed(2)||g>+mi(o,s).toFixed(2)))return{x:f,y:p}}}}function As(e){return Math.round(e*1e11)/1e11}function lS(e,t,n){var i=nm(e),r=nm(t);if(!cS(i,r))return[];var o=rm(...e),a=rm(...t),s=am(e)?1:~~(o/5)||1,c=am(t)?1:~~(a/5)||1,u=new Array(s+1),l=new Array(c+1),f={},p=[],d,g;for(d=0;d<s+1;d++){var h=tm(...e,d/s);u[d]={x:h.x,y:h.y,t:d/s}}for(d=0;d<c+1;d++)h=tm(...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],_=u[d+1],y=l[g],x=l[g+1],S=er(_.x-m.x)<.01?"y":"x",P=er(x.x-y.x)<.01?"y":"x",C=uS(m.x,m.y,_.x,_.y,y.x,y.y,x.x,x.y),D;if(C){if(D=C.x.toFixed(9)+"#"+C.y.toFixed(9),f[D])continue;f[D]=!0;var T=m.t+er((C[S]-m[S])/(_[S]-m[S]))*(_.t-m.t),$=y.t+er((C[P]-y[P])/(x[P]-y[P]))*(x.t-y.t);T>=0&&T<=1&&$>=0&&$<=1&&p.push({x:C.x,y:C.y,t1:T,t2:$})}}return p}function om(e,t,n){e=um(e),t=um(t);for(var i,r,o,a,s,c,u,l,f,p,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"?(f=[i,r,...m.slice(1)],i=f[6],r=f[7]):(f=[i,r,i,r,s,c,s,c],i=s,r=c);for(var _=0,y=t.length;_<y;_++){var x=t[_];if(x[0]=="M")o=u=x[1],a=l=x[2];else{x[0]=="C"?(p=[o,a,...x.slice(1)],o=p[6],a=p[7]):(p=[o,a,o,a,u,l,u,l],o=u,a=l);var S=lS(f,p);{for(var P=0,C=S.length;P<C;P++)S[P].segment1=g,S[P].segment2=_,S[P].bez1=f,S[P].bez2=p;d=d.concat(S)}}}}}return d}function pS(e){return em(e)&&em(e[0])}function fS(e){if(oS(e))return e;var t=new Array(e.length),n=0,i=0,r=0,o=0,a=0,s;e[0][0]=="M"&&(n=+e[0][1],i=+e[0][2],r=n,o=i,a++,t[0]=["M",n,i]);for(var c,u,l=a,f=e.length;l<f;l++){if(u=e[l],s=u[0],t[l]=c=new Array(u.length),s!=s.toUpperCase())switch(c[0]=s.toUpperCase(),c[0]){case"A":c[1]=u[1],c[2]=u[2],c[3]=u[3],c[4]=u[4],c[5]=u[5],c[6]=+u[6]+n,c[7]=+u[7]+i;break;case"V":c[1]=+u[1]+i;break;case"H":c[1]=+u[1]+n;break;case"M":r=+u[1]+n,o=+u[2]+i;default:for(var p=1,d=u.length;p<d;p++)c[p]=+u[p]+(p%2?n:i)}else for(var 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=Rl,t}function am(e){return e[0]===e[2]&&e[1]===e[3]&&e[4]===e[6]&&e[5]===e[7]}function Ts(e,t,n,i){return[e,t,n,i,n,i]}function sm(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 cm(e,t,n,i,r,o,a,s,c,u){var l=Ji*120/180,f=Ji/180*(+r||0),p=[],d,g=iS(function(M,E,b){var F=M*Mt.cos(b)-E*Mt.sin(b),W=M*Mt.sin(b)+E*Mt.cos(b);return{x:F,y:W}});if(u)D=u[0],T=u[1],P=u[2],C=u[3];else{d=g(e,t,-f),e=d.x,t=d.y,d=g(s,c,-f),s=d.x,c=d.y;var h=(e-s)/2,m=(t-c)/2,_=h*h/(n*n)+m*m/(i*i);_>1&&(_=Mt.sqrt(_),n=_*n,i=_*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 $=T-D;if(er($)>l){var k=T,O=s,j=c;T=D+l*(a&&T>D?1:-1),s=P+n*Mt.cos(T),c=C+i*Mt.sin(T),p=cm(s,c,n,i,r,0,a,O,j,[T,k,P,C])}$=T-D;var oe=Mt.cos(D),xe=Mt.sin(D),Ue=Mt.cos(T),Y=Mt.sin(T),ue=Mt.tan($/4),ve=4/3*n*ue,le=4/3*i*ue,be=[e,t],ce=[e+ve*xe,t-le*oe],U=[s+ve*Y,c-le*Ue],q=[s,c];if(ce[0]=2*be[0]-ce[0],ce[1]=2*be[1]-ce[1],u)return[ce,U,q].concat(p);p=[ce,U,q].concat(p).join().split(",");for(var K=[],He=0,Yt=p.length;He<Yt;He++)K[He]=He%2?g(p[He-1],p[He],f).y:g(p[He],p[He+1],f).x;return K}function dS(e,t,n,i,r,o,a,s){for(var c=[],u=[[],[]],l,f,p,d,g,h,m,_,y=0;y<2;++y){if(y==0?(f=6*e-12*n+6*r,l=-3*e+9*n-9*r+3*a,p=3*n-3*e):(f=6*t-12*i+6*o,l=-3*t+9*i-9*o+3*s,p=3*i-3*t),er(l)<1e-12){if(er(f)<1e-12)continue;d=-p/f,0<d&&d<1&&c.push(d);continue}m=f*f-4*p*l,_=Mt.sqrt(m),!(m<0)&&(g=(-f+_)/(2*l),0<g&&g<1&&c.push(g),h=(-f-_)/(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:hi(...u[0]),y0:hi(...u[1]),x1:mi(...u[0]),y1:mi(...u[1])}}function um(e){if(pS(e)||(e=rS(e)),aS(e))return e;for(var t=sS(fS(e)),n={x:0,y:0,bx:0,by:0,X:0,Y:0,qx:null,qy:null},i=function(p,d,g){var h,m;if(!p)return["C",d.x,d.y,d.x,d.y,d.x,d.y];switch(!(p[0]in{T:1,Q:1})&&(d.qx=d.qy=null),p[0]){case"M":d.X=p[1],d.Y=p[2];break;case"A":p=["C",...cm(d.x,d.y,...p.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),p=["C",h,m,...p.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),p=["C",...sm(d.x,d.y,d.qx,d.qy,p[1],p[2])];break;case"Q":d.qx=p[1],d.qy=p[2],p=["C",...sm(d.x,d.y,p[1],p[2],p[3],p[4])];break;case"L":p=["C",...Ts(d.x,d.y,p[1],p[2])];break;case"H":p=["C",...Ts(d.x,d.y,p[1],d.y)];break;case"V":p=["C",...Ts(d.x,d.y,d.x,p[1])];break;case"Z":p=["C",...Ts(d.x,d.y,d.X,d.Y)];break}return p},r=function(p,d){if(p[d].length>7){p[d].shift();for(var g=p[d];g.length;)o[d]="A",p.splice(d++,0,["C",...g.splice(0,6)]);p.splice(d,1),u=t.length}},o=[],a="",s="",c=0,u=t.length;c<u;c++){t[c]&&(a=t[c][0]),a!="C"&&(o[c]=a,c&&(s=o[c-1])),t[c]=i(t[c],n,s),o[c]!="A"&&a=="C"&&(o[c]="C"),r(t,c);var l=t[c],f=l.length;n.x=l[f-2],n.y=l[f-1],n.bx=Qh(l[f-4])||n.x,n.by=Qh(l[f-3])||n.y}return t}function at(e){return Vt(e)&&En(e,"waypoints")}function je(e){return Vt(e)&&En(e,"labelTarget")}function hS(e){return Vt(e)&&Zr(e.parent)}function lm(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 Ms(e){return{x:e.left,y:e.top,width:e.right-e.left,height:e.bottom-e.top}}function mS(e){return ki({x:e.x+(e.width||0)/2,y:e.y+(e.height||0)/2})}function gS(e){for(var t=e.waypoints,n=t.reduce(function(u,l,f){var p=t[f-1];if(p){var d=u[u.length-1],g=d&&d.endLength||0,h=bS(p,l);u.push({start:p,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 at(e)?gS(e):mS(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 na(e,t,n){var i=yS(e,t);return i.length===1||i.length===2&&ta(i[0],i[1])<1?ki(i[0]):i.length>1?(i=ci(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 yS(e,t){return om(e,t)}function vS(e){e=e.slice();for(var t=0,n,i,r;e[t];)n=e[t],i=e[t-1],r=e[t+1],ta(n,r)===0||wl(i,r,n)?e.splice(t,1):t++;return e}function bS(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function ks(e,t){return Math.round(e*t)/t}function pm(e){return Le(e)?e+"px":e}function _S(e){for(;e.parent;)e=e.parent;return e}function xS(e){e=z({},{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:pm(e.width),height:pm(e.height)}),t.appendChild(n),n}function fm(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 wS="base",dm=0,ES=1,SS={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=xS(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")}),Ne(n,i);const r=this._viewport=fm(i,"viewport");e.deferUpdate&&(this._viewboxChanged=Lu(this._viewboxChanged,300)),this._restoreFocus=Lu(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=Kh(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(wS,dm)},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 Sn(this._layers,function(t,n){return n.visible&&e>=n.index&&t++,t},0)},De.prototype._createLayer=function(e,t){typeof t>"u"&&(t=ES);const n=this._getChildIndex(t);return{group:fm(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&&(jt(n),t.visible=!1),n},De.prototype._removeLayer=function(e){const t=this._layers[e];t&&(delete this._layers[e],jt(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(_S(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,dm);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=SS[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){Ct(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),St(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);Zo(t,l)});else return o=this._rootElement?this.getActiveLayer():null,i=o&&o.getBBox()||{},a=Zo(t),r=a?a.matrix:T1(),s=ks(r.a,1e3),c=ks(-r.e||0,1e3),u=ks(-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=z({dx:0,dy:0},e||{}),n=this._svg.createSVGMatrix().translate(e.dx,e.dy).multiply(n),hm(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,f;c.y+=t.top/u,c.x+=t.left/u,c.width-=(t.right+t.left)/u,c.height-=(t.bottom+t.top)/u;const p=Pe(c);if(!(a.width<c.width&&a.height<c.height))l=a.x-c.x,f=a.y-c.y;else{const g=Math.max(0,s.right-p.right),h=Math.min(0,s.left-p.left),m=Math.max(0,s.bottom-p.bottom),_=Math.min(0,s.top-p.top);l=g||h,f=m||_}this.scroll({dx:-l*u,dy:-f*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)}),ks(i.a,1e3)};function hm(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 f=c.a;return t?(a=z(o,t),s=a.matrixTransform(c.inverse()),u=r.translate(s.x,s.y).scale(1/f*e).translate(-s.x,-s.y),l=c.multiply(u)):l=r.scale(e),hm(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 Nn(e){this._elements={},this._eventBus=e}Nn.$inject=["eventBus"],Nn.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}},Nn.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])},Nn.prototype.updateId=function(e,t){this._validateId(t),typeof e=="string"&&(e=this.get(e)),this._eventBus.fire("element.updateId",{element:e,newId:t});var n=this.getGraphics(e),i=this.getGraphics(e,!0);this.remove(e),e.id=t,this.add(e,n,i)},Nn.prototype.updateGraphics=function(e,t,n){var i=e.id||e,r=this._elements[i];return n?r.secondaryGfx=t:r.gfx=t,t&&he(t,lo,i),t},Nn.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},Nn.prototype.filter=function(e){var t=[];return this.forEach(function(n,i){e(n,i)&&t.push(n)}),t},Nn.prototype.find=function(e){for(var t=this._elements,n=Object.keys(t),i=0;i<n.length;i++){var r=n[i],o=t[r],a=o.element,s=o.gfx;if(e(a,s))return a}},Nn.prototype.getAll=function(){return this.filter(function(e){return e})},Nn.prototype.forEach=function(e){var t=this._elements;Object.keys(t).forEach(function(n){var i=t[n],r=i.element,o=i.gfx;return e(r,o)})},Nn.prototype.getGraphics=function(e,t){var n=e.id||e,i=this._elements[n];return i&&(t?i.secondaryGfx:i.gfx)},Nn.prototype._validateId=function(e){if(!e)throw new Error("element must have an id");if(this._elements[e])throw new Error("element with id "+e+" already added")};function RS(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 CS(e){return e.__refs_collection===!0}function PS(e,t){return Object.prototype.hasOwnProperty.call(e,t.name||t)}function mm(e,t,n){var i=RS(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 AS(e,t,n){var i=t.inverse,r=n[t.name];Object.defineProperty(n,t.name,{configurable:t.configurable,enumerable:t.enumerable,get:function(){return r},set:function(o){if(o!==r){var a=r;r=null,a&&e.unset(a,i,n),r=o,e.set(r,i,n)}}})}function Vn(e,t){if(!(this instanceof Vn))return new Vn(e,t);e.inverse=t,t.inverse=e,this.props={},this.props[e.name]=e,this.props[t.name]=t}Vn.prototype.bind=function(e,t){if(typeof t=="string"){if(!this.props[t])throw new Error("no property <"+t+"> in ref");t=this.props[t]}t.collection?mm(this,t,e):AS(this,t,e)},Vn.prototype.ensureRefsCollection=function(e,t){var n=e[t.name];return CS(n)||mm(this,t,e),n},Vn.prototype.ensureBound=function(e,t){PS(e,t)||this.bind(e,t)},Vn.prototype.unset=function(e,t,n){e&&(this.ensureBound(e,t),t.collection?this.ensureRefsCollection(e,t).remove(n):e[t.name]=void 0)},Vn.prototype.set=function(e,t,n){e&&(this.ensureBound(e,t),t.collection?this.ensureRefsCollection(e,t).add(n):e[t.name]=n)};var Cl=new Vn({name:"children",enumerable:!0,collection:!0},{name:"parent"}),gm=new Vn({name:"labels",enumerable:!0,collection:!0},{name:"labelTarget"}),ym=new Vn({name:"attachers",collection:!0},{name:"host"}),vm=new Vn({name:"outgoing",collection:!0},{name:"source"}),bm=new Vn({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)}}),Cl.bind(this,"parent"),gm.bind(this,"labels"),vm.bind(this,"outgoing"),bm.bind(this,"incoming")}function ia(){po.call(this),Cl.bind(this,"children"),ym.bind(this,"host"),ym.bind(this,"attachers")}de(ia,po);function _m(){po.call(this),Cl.bind(this,"children")}de(_m,ia);function xm(){ia.call(this),gm.bind(this,"labelTarget")}de(xm,ia);function wm(){po.call(this),vm.bind(this,"source"),bm.bind(this,"target")}de(wm,po);var TS={connection:wm,shape:ia,label:xm,root:_m};function MS(e,t){var n=TS[e];if(!n)throw new Error("unknown type: <"+e+">");return z(new n,t)}function kS(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=z({},t||{}),t.id||(t.id=e+"_"+this._uid++),MS(e,t)};var Os="__fn",Em=1e3,OS=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=Em),!Le(t))throw new Error("priority must be a number");var r=n;i&&(r=gn(n,i),r[Os]=n[Os]||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=Em),!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[Os]=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 ra;return t.init(e),t},Pn.prototype.fire=function(e,t){var n,i,r,o;if(o=OS.call(arguments),typeof e=="object"&&(t=e,e=t.type),!e)throw new Error("no event type specified");if(i=this._listeners[e],!!i){t instanceof ra?n=t:n=this.createEvent(t),o[0]=n;var a=n.type;e!==a&&(n.type=e);try{r=this._invokeListeners(n,o,i)}finally{e!==a&&(n.type=a)}return r===void 0&&n.defaultPrevented&&(r=!1),r}},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=DS(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[Os]===t)&&(r?r.next=i:this._setListeners(e,i)),r=n,n=i};function ra(){}ra.prototype.stopPropagation=function(){this.cancelBubble=!0},ra.prototype.preventDefault=function(){this.defaultPrevented=!0},ra.prototype.init=function(e){z(this,e||{})};function DS(e,t){return e.apply(null,t)}function Or(e){return e.childNodes[0]}function LS(e){return e.parentNode.childNodes[1]}function Ds(e,t,n,i,r){var o=Xo();o.setTranslate(t,n);var a=Xo();a.setRotate(i||0,0,0);var s=Xo();s.setScale(1,1),Zo(e,[o,a,s])}function en(e,t,n){var i=Xo();i.setTranslate(t,n),Zo(e,i)}function Sm(e,t){var n=Xo();n.setRotate(t,0,0),Zo(e,n)}function $n(e,t){this._eventBus=e,this._elementRegistry=t}$n.$inject=["eventBus","elementRegistry"],$n.prototype._getChildrenContainer=function(e){var t=this._elementRegistry.getGraphics(e),n;return e.parent?(n=LS(t),n||(n=Ce("g"),qe(n).add("djs-children"),Ne(t.parentNode,n))):n=t,n},$n.prototype._clear=function(e){var t=Or(e);return xs(t),t},$n.prototype._createContainer=function(e,t,n,i){var r=Ce("g");qe(r).add("djs-group"),typeof n<"u"?IS(r,t,t.childNodes[n]):Ne(t,r);var o=Ce("g");qe(o).add("djs-element"),qe(o).add("djs-"+e),i&&qe(o).add("djs-frame"),Ne(r,o);var a=Ce("g");return qe(a).add("djs-visual"),Ne(o,a),o},$n.prototype.create=function(e,t,n){var i=this._getChildrenContainer(t.parent);return this._createContainer(e,i,n,Xh(t))},$n.prototype.updateContainments=function(e){var t=this,n=this._elementRegistry,i;i=Sn(e,function(r,o){return o.parent&&(r[o.parent.id]=o.parent),r},{}),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)})}})},$n.prototype.drawShape=function(e,t,n={}){var i=this._eventBus;return i.fire("render.shape",{gfx:e,element:t,attrs:n})},$n.prototype.getShapePath=function(e){var t=this._eventBus;return t.fire("render.getShapePath",e)},$n.prototype.drawConnection=function(e,t,n={}){var i=this._eventBus;return i.fire("render.connection",{gfx:e,element:t,attrs:n})},$n.prototype.getConnectionPath=function(e){var t=this._eventBus;return t.fire("render.getConnectionPath",e)},$n.prototype.update=function(e,t,n){if(t.parent){var i=this._clear(n);if(e==="shape")this.drawShape(i,t),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")}},$n.prototype.remove=function(e){var t=this._elementRegistry.getGraphics(e);jt(t.parentNode)};function IS(e,t,n){var i=n||t.firstChild;e!==i&&t.insertBefore(e,i)}const BS={__depends__:[K1],__init__:["canvas"],canvas:["type",De],elementRegistry:["type",Nn],elementFactory:["type",Oi],eventBus:["type",Pn],graphicsFactory:["type",$n]};function NS(e){var t=new Yh(e);return t.init(),t}function $S(e){e=e||{};var t={config:["value",e]},n=[t,BS].concat(e.modules||[]);return NS(n)}function nr(e,t){this._injector=t||$S(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 yn(e,t){return e.$instanceOf(t)}function FS(e){return lt(e.rootElements,function(t){return yn(t,"bpmn:Process")||yn(t,"bpmn:Collaboration")})}function jS(e){var t={},n=[],i={};function r(U,q){return function(K){U(K,q)}}function o(U){t[U.id]=U}function a(U){return t[U.id]}function s(U,q){var K=U.gfx;if(K)throw new Error(`already rendered ${cn(U)}`);return e.element(U,i[U.id],q)}function c(U,q){return e.root(U,i[U.id],q)}function u(U,q){try{var K=i[U.id]&&s(U,q);return o(U),K}catch(He){l(He.message,{element:U,error:He}),console.error(`failed to import ${cn(U)}`,He)}}function l(U,q){e.error(U,q)}var f=this.registerDi=function(q){var K=q.bpmnElement;K?i[K.id]?l(`multiple DI elements defined for ${cn(K)}`,{element:K}):i[K.id]=q:l(`no bpmnElement referenced in ${cn(q)}`,{element:q})};function p(U){d(U.plane)}function d(U){f(U),L(U.planeElement,g)}function g(U){f(U)}this.handleDefinitions=function(q,K){var He=q.diagrams;if(K&&He.indexOf(K)===-1)throw new Error("diagram not part of <bpmn:Definitions />");if(!K&&He&&He.length&&(K=He[0]),!K)throw new Error("no diagram to display");i={},p(K);var Yt=K.plane;if(!Yt)throw new Error(`no plane for ${cn(K)}`);var M=Yt.bpmnElement;if(!M)if(M=FS(q),M)l(`correcting missing bpmnElement on ${cn(Yt)} to ${cn(M)}`),Yt.bpmnElement=M,f(Yt);else throw new Error("no process or collaboration to display");var E=c(M,Yt);if(yn(M,"bpmn:Process")||yn(M,"bpmn:SubProcess"))m(M,E);else if(yn(M,"bpmn:Collaboration"))be(M,E),_(q.rootElements,E);else throw new Error(`unsupported bpmnElement for ${cn(Yt)}: ${cn(M)}`);h(n)};var h=this.handleDeferred=function(){for(var q;n.length;)q=n.shift(),q()};function m(U,q){ue(U,q),$(U.ioSpecification,q),T(U.artifacts,q),o(U)}function _(U,q){var K=Ge(U,function(He){return!a(He)&&yn(He,"bpmn:Process")&&He.laneSets});K.forEach(r(m,q))}function y(U,q){u(U,q)}function x(U,q){L(U,r(y,q))}function S(U,q){u(U,q)}function P(U,q){u(U,q)}function C(U,q){u(U,q)}function D(U,q){u(U,q)}function T(U,q){L(U,function(K){yn(K,"bpmn:Association")?n.push(function(){D(K,q)}):D(K,q)})}function $(U,q){U&&(L(U.dataInputs,r(P,q)),L(U.dataOutputs,r(C,q)))}var k=this.handleSubProcess=function(q,K){ue(q,K),T(q.artifacts,K)};function O(U,q){var K=u(U,q);yn(U,"bpmn:SubProcess")&&k(U,K||q),yn(U,"bpmn:Activity")&&$(U.ioSpecification,q),n.push(function(){L(U.dataInputAssociations,r(S,q)),L(U.dataOutputAssociations,r(S,q))})}function j(U,q){u(U,q)}function oe(U,q){u(U,q)}function xe(U,q){n.push(function(){var K=u(U,q);U.childLaneSet&&Ue(U.childLaneSet,K||q),ce(U)})}function Ue(U,q){L(U.lanes,r(xe,q))}function Y(U,q){L(U,r(Ue,q))}function ue(U,q){ve(U.flowElements,q),U.laneSets&&Y(U.laneSets,q)}function ve(U,q){L(U,function(K){yn(K,"bpmn:SequenceFlow")?n.push(function(){j(K,q)}):yn(K,"bpmn:BoundaryEvent")?n.unshift(function(){O(K,q)}):yn(K,"bpmn:FlowNode")?O(K,q):yn(K,"bpmn:DataObject")||(yn(K,"bpmn:DataStoreReference")||yn(K,"bpmn:DataObjectReference")?oe(K,q):l(`unrecognized flowElement ${cn(K)} in context ${cn(q&&q.businessObject)}`,{element:K,context:q}))})}function le(U,q){var K=u(U,q),He=U.processRef;He&&m(He,K||q)}function be(U,q){L(U.participants,r(le,q)),n.push(function(){x(U.messageFlows,q)}),T(U.artifacts,q)}function ce(U){L(U.flowNodeRef,function(q){var K=q.get("lanes");K&&K.push(U)})}}function w(e,t){var n=te(e);return n&&typeof n.$instanceOf=="function"&&n.$instanceOf(t)}function ze(e,t){return Wi(t,function(n){return w(e,n)})}function te(e){return e&&e.businessObject||e}function Ye(e){return e&&e.di}function HS(e,t,n){var i,r,o,a,s=[];function c(u,l){var f={root:function(h,m){return i.add(h,m)},element:function(h,m,_){return i.add(h,m,_)},error:function(h,m){s.push({message:h,context:m})}},p=new jS(f);l=l||u.diagrams&&u.diagrams[0];var d=zS(u,l);if(!d)throw new Error("no diagram to display");L(d,function(h){p.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(f){return f.warnings=s,l(f)}})}function zS(e,t){if(!(!t||!t.plane)){var n=t.plane.bpmnElement,i=n;!w(n,"bpmn:Process")&&!w(n,"bpmn:Collaboration")&&(i=GS(n));var r;w(i,"bpmn:Collaboration")?r=i:r=lt(e.rootElements,function(u){if(w(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=Rm(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 Rm(e){var t=[];return L(e,function(n){n&&(t.push(n),t=t.concat(Rm(n.flowElements)))}),t}function GS(e){for(var t=e;t;){if(w(t,"bpmn:Process"))return t;t=t.$parent}}var VS='<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>',Cm=VS,Pm={verticalAlign:"middle"},Am={color:"#404040"},WS={zIndex:"1001",position:"fixed",top:"0",left:"0",right:"0",bottom:"0"},US={width:"100%",height:"100%",background:"rgba(40,40,40,0.2)"},qS={position:"absolute",left:"50%",top:"40%",transform:"translate(-50%)",width:"260px",padding:"10px",background:"white",boxShadow:"0 1px 4px rgba(0,0,0,0.3)",fontFamily:"Helvetica, Arial, sans-serif",fontSize:"14px",display:"flex",lineHeight:"1.3"},YS='<div class="bjs-powered-by-lightbox"><div class="backdrop"></div><div class="notice"><a href="https://bpmn.io" target="_blank" rel="noopener" class="link">'+Cm+'</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>',gi;function KS(){gi=dt(YS),dn(gi,WS),dn(rt("svg",gi),Pm),dn(rt(".backdrop",gi),US),dn(rt(".notice",gi),qS),dn(rt(".link",gi),Am,{margin:"15px 20px 15px 10px",alignSelf:"center"})}function XS(){gi||(KS(),Cn.bind(gi,".backdrop","click",function(e){document.body.removeChild(gi)})),document.body.appendChild(gi)}const Ls=5,Tm="djs-outline-hidden";function bt(e){e=z({},QS,e),this._moddle=this._createModdle(e),this._container=this._createContainer(e),this._init(this._container,this._moddle,e),eR(this._container)}de(bt,nr),bt.prototype.importXML=async function(t,n){const i=this;function r(a){return i.get("eventBus").createEvent(a)}let o=[];try{t=this._emit("import.parse.start",{xml:t})||t;let a;try{a=await this._moddle.fromXML(t,"bpmn:Definitions")}catch(p){throw this._emit("import.parse.complete",{error:p}),p}let s=a.rootElement;const c=a.references,u=a.warnings,l=a.elementsById;o=o.concat(u),s=this._emit("import.parse.complete",r({error:null,definitions:s,elementsById:l,references:c,warnings:o}))||s;const f=await this.importDefinitions(s,n);return o=o.concat(f.warnings),this._emit("import.done",{error:null,warnings:o}),{warnings:o}}catch(a){let s=a;throw o=o.concat(s.warnings||[]),Is(s,o),s=ZS(s),this._emit("import.done",{error:s,warnings:s.warnings}),s}},bt.prototype.importDefinitions=async function(t,n){return this._setDefinitions(t),{warnings:(await this.open(n)).warnings}},bt.prototype.open=async function(t){const n=this._definitions;let i=t;if(!n){const o=new Error("no XML imported");throw Is(o,[]),o}if(typeof t=="string"&&(i=JS(n,t),!i)){const o=new Error("BPMNDiagram <"+t+"> not found");throw Is(o,[]),o}try{this.clear()}catch(o){throw Is(o,[]),o}const{warnings:r}=await HS(this,n,i);return{warnings:r}},bt.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},bt.prototype.saveSVG=async function(){this._emit("saveSVG.start");let t,n;try{const i=this.get("canvas"),r=i.getActiveLayer(),o=rt(":scope > defs",i._svg),a=qh(r),s=o?"<defs>"+qh(o)+"</defs>":"",c=i.getContainer();vt(c).add(Tm);let u;try{u=r.getBBox()}finally{vt(c).remove(Tm)}const l=u.x-Ls,f=u.y-Ls,p=u.width+Ls*2,d=u.height+Ls*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()&&ir.prototype.clear.call(this)},vt.prototype.destroy=function(){ir.prototype.destroy.call(this),di(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(si(n,["additionalModules"]),{canvas:H({},n.canvas,{container:e}),modules:a});ir.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:Pm(e.width),height:Pm(e.height),position:e.position}),t},vt.prototype._createModdle=function(e){const t=H({},this._moddleExtensions,e.moddleExtensions);return new Pd(t)},vt.prototype._modules=[];function Ls(e,t){return e.warnings=t,e}function WS(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 US={width:"100%",height:"100%",position:"relative"};function Pm(e){return e+(Le(e)?"px":"")}function qS(e,t){return t&&lt(e.diagrams,function(n){return n.id===t})||null}function YS(e){const n='<a href="http://bpmn.io" target="_blank" class="bjs-powered-by" title="Powered by bpmn.io" >'+Em+"</a>",i=ft(n);dn(ot("svg",i),Sm),dn(i,Rm,{position:"absolute",bottom:"15px",right:"15px",zIndex:"100"}),e.appendChild(i),Ne.bind(i,"click",function(r){VS(),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 fi([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 x(e,"bpmn:CallActivity")?!1:x(e,"bpmn:SubProcess")?(t=t||Ye(e),t&&x(t,"bpmndi:BPMNPlane")?!0:t&&!!t.isExpanded):x(e,"bpmn:Participant")?!!te(e).processRef:!0}function qt(e){if(!(!x(e,"bpmn:Participant")&&!x(e,"bpmn:Lane"))){var t=Ye(e).isHorizontal;return t===void 0?!0:t}}function KS(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 x(i,t)})}function XS(e){return ho(e,"bpmn:ErrorEventDefinition")}function ZS(e){return ho(e,"bpmn:EscalationEventDefinition")}function QS(e){return ho(e,"bpmn:CompensateEventDefinition")}var Lr={width:90,height:20},Am=15;function rr(e){return x(e,"bpmn:Event")||x(e,"bpmn:Gateway")||x(e,"bpmn:DataStoreReference")||x(e,"bpmn:DataObjectReference")||x(e,"bpmn:DataInput")||x(e,"bpmn:DataOutput")||x(e,"bpmn:SequenceFlow")||x(e,"bpmn:MessageFlow")||x(e,"bpmn:Group")}function Is(e){return Fe(e.label)}function JS(e){var t=e.length/2-1,n=e[Math.floor(t)],i=e[Math.ceil(t+.01)],r=eR(e),o=Math.atan((i.y-n.y)/(i.x-n.x)),a=r.x,s=r.y;return Math.abs(o)<Math.PI/2?s-=Am:a+=Am,{x:a,y:s}}function eR(e){var t=e.length/2-1,n=e[Math.floor(t)],i=e[Math.ceil(t+.01)];return{x:n.x+(i.x-n.x)/2,y:n.y+(i.y-n.y)/2}}function Rl(e){return e.waypoints?JS(e.waypoints):x(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 tR(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=Rl(t),i=Lr),H({x:n.x-i.width/2,y:n.y-i.height/2},i)}function Tm(e){if(x(e,"bpmn:FlowElement")||x(e,"bpmn:Participant")||x(e,"bpmn:Lane")||x(e,"bpmn:SequenceFlow")||x(e,"bpmn:MessageFlow")||x(e,"bpmn:DataInput")||x(e,"bpmn:DataOutput"))return"name";if(x(e,"bpmn:TextAnnotation"))return"text";if(x(e,"bpmn:Group"))return"categoryValueRef"}function nR(e){var t=e.categoryValueRef;return t&&t.value||""}function Bn(e){var t=e.businessObject,n=Tm(t);if(n)return n==="categoryValueRef"?nR(t):t[n]||""}function iR(e,t){var n=e.businessObject,i=Tm(n);if(i)if(i==="categoryValueRef"){if(!n[i])return e;n[i].value=t}else n[i]=t;return e}function rR(e){return Fe(e)&&rr(e.labelTarget)}var mo=7;function Mm(e){let t=[];return L(e.incoming,n=>{x(n,"bpmn:Association")&&x(n.source,"bpmn:TextAnnotation")&&t.push({annotation:n.source,association:n})}),L(e.outgoing,n=>{x(n,"bpmn:Association")&&x(n.target,"bpmn:TextAnnotation")&&t.push({annotation:n.target,association:n})}),t}function oa(e){const t=new Map;return L(vl(e),n=>{L(Mm(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 Cl="hsl(225, 10%, 15%)",oR="white";function yi(e,t){return Ui(e.eventDefinitions,function(n){return n.$type===t})}function aR(e){return e.$type==="bpmn:IntermediateThrowEvent"||e.$type==="bpmn:EndEvent"}function sR(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||oR}function fe(e,t,n){var i=Ye(e);return n||i.get("color:border-color")||i.get("bioc:stroke")||t||Cl}function aa(e,t,n,i){var r=Ye(e),o=r.get("label");return i||o&&o.get("color:color")||t||fe(e,n)}function km(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 Pl(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 cR(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 uR(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 sa(e,t={}){return{width:Fn(e,t),height:An(e,t)}}function Fn(e,t={}){return En(t,"width")?t.width:e.width}function An(e,t={}){return En(t,"height")?t.height:e.height}var lR=new fi,pR=10,Ns=3,fR=1.5,Bs=10,dR=4,go=.95,hR=1,mR=.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:Cl,strokeWidth:2,fill:"white"})}function p(M){return n.computeStyle(M,["no-fill"],{strokeLinecap:"round",strokeLinejoin:"round",stroke:Cl,strokeWidth:2})}function f(M,E){var{ref:b={x:0,y:0},scale:j=1,element:W,parentGfx:K=r._svg}=E,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,E,b,j){var W=lR.nextPrefixed("marker-");return g(M,W,E,b,j),"url(#"+W+")"}function g(M,E,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(E,{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(E,{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(E,{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(E,{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(E,{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(E,{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(E,{element:Ht,ref:{x:0,y:10},scale:.5,parentGfx:M})}}function h(M,E,b,j,W={}){Vt(j)&&(W=j,j=0),j=j||0,W=l(W);var K=E/2,ye=b/2,Ie=Ce("circle",{cx:K,cy:ye,r:Math.round((E+b)/4-j),...W});return Be(M,Ie),Ie}function m(M,E,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:E-W*2,height:b-W*2,rx:j,ry:j,...K});return Be(M,ye),ye}function w(M,E,b,j){var W=E/2,K=b/2,ye=[{x:W,y:0},{x:E,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,E,b,j){b=p(b);var W=Qo(E,b,j);return Be(M,W),W}function _(M,E,b){return y(M,E,b,5)}function S(M,E,b){b=p(b);var j=Ce("path",{...b,d:E});return Be(M,j),j}function P(M,E,b,j){return S(E,b,H({"data-marker":M},j))}function C(M){return wt[M]}function D(M){return function(E,b,j){return C(M)(E,b,j)}}var T={"bpmn:MessageEventDefinition":function(M,E,b={},j){var W=i.getScaledPath("EVENT_MESSAGE",{xScaleFactor:.9,yScaleFactor:.9,containerWidth:b.width||E.width,containerHeight:b.height||E.height,position:{mx:.235,my:.315}}),K=j?fe(E,c,b.stroke):Ve(E,s,b.fill),ye=j?Ve(E,s,b.fill):fe(E,c,b.stroke),Ie=S(M,W,{fill:K,stroke:ye,strokeWidth:1});return Ie},"bpmn:TimerEventDefinition":function(M,E,b={}){var j=b.width||E.width,W=b.height||E.height,K=b.width?1:2,ye=h(M,j,W,.2*W,{fill:Ve(E,s,b.fill),stroke:fe(E,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(E,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(E,c,b.stroke),transform:"rotate("+Xe*30+","+Ht+","+nt+")"})}return ye},"bpmn:EscalationEventDefinition":function(M,E,b={},j){var W=i.getScaledPath("EVENT_ESCALATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:b.width||E.width,containerHeight:b.height||E.height,position:{mx:.5,my:.2}}),K=j?fe(E,c,b.stroke):Ve(E,s,b.fill);return S(M,W,{fill:K,stroke:fe(E,c,b.stroke),strokeWidth:1})},"bpmn:ConditionalEventDefinition":function(M,E,b={}){var j=i.getScaledPath("EVENT_CONDITIONAL",{xScaleFactor:1,yScaleFactor:1,containerWidth:b.width||E.width,containerHeight:b.height||E.height,position:{mx:.5,my:.222}});return S(M,j,{fill:Ve(E,s,b.fill),stroke:fe(E,c,b.stroke),strokeWidth:1})},"bpmn:LinkEventDefinition":function(M,E,b={},j){var W=i.getScaledPath("EVENT_LINK",{xScaleFactor:1,yScaleFactor:1,containerWidth:E.width,containerHeight:E.height,position:{mx:.57,my:.263}}),K=j?fe(E,c,b.stroke):Ve(E,s,b.fill);return S(M,W,{fill:K,stroke:fe(E,c,b.stroke),strokeWidth:1})},"bpmn:ErrorEventDefinition":function(M,E,b={},j){var W=i.getScaledPath("EVENT_ERROR",{xScaleFactor:1.1,yScaleFactor:1.1,containerWidth:b.width||E.width,containerHeight:b.height||E.height,position:{mx:.2,my:.722}}),K=j?fe(E,c,b.stroke):Ve(E,s,b.fill);return S(M,W,{fill:K,stroke:fe(E,c,b.stroke),strokeWidth:1})},"bpmn:CancelEventDefinition":function(M,E,b={},j){var W=i.getScaledPath("EVENT_CANCEL_45",{xScaleFactor:1,yScaleFactor:1,containerWidth:E.width,containerHeight:E.height,position:{mx:.638,my:-.055}}),K=j?fe(E,c,b.stroke):"none",ye=S(M,W,{fill:K,stroke:fe(E,c,b.stroke),strokeWidth:1});return xm(ye,45),ye},"bpmn:CompensateEventDefinition":function(M,E,b={},j){var W=i.getScaledPath("EVENT_COMPENSATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:b.width||E.width,containerHeight:b.height||E.height,position:{mx:.22,my:.5}}),K=j?fe(E,c,b.stroke):Ve(E,s,b.fill);return S(M,W,{fill:K,stroke:fe(E,c,b.stroke),strokeWidth:1})},"bpmn:SignalEventDefinition":function(M,E,b={},j){var W=i.getScaledPath("EVENT_SIGNAL",{xScaleFactor:.9,yScaleFactor:.9,containerWidth:b.width||E.width,containerHeight:b.height||E.height,position:{mx:.5,my:.2}}),K=j?fe(E,c,b.stroke):Ve(E,s,b.fill);return S(M,W,{strokeWidth:1,fill:K,stroke:fe(E,c,b.stroke)})},"bpmn:MultipleEventDefinition":function(M,E,b={},j){var W=i.getScaledPath("EVENT_MULTIPLE",{xScaleFactor:1.1,yScaleFactor:1.1,containerWidth:b.width||E.width,containerHeight:b.height||E.height,position:{mx:.211,my:.36}}),K=j?fe(E,c,b.stroke):Ve(E,s,b.fill);return S(M,W,{fill:K,stroke:fe(E,c,b.stroke),strokeWidth:1})},"bpmn:ParallelMultipleEventDefinition":function(M,E,b={}){var j=i.getScaledPath("EVENT_PARALLEL_MULTIPLE",{xScaleFactor:1.2,yScaleFactor:1.2,containerWidth:b.width||E.width,containerHeight:b.height||E.height,position:{mx:.458,my:.194}});return S(M,j,{fill:Ve(E,s,b.fill),stroke:fe(E,c,b.stroke),strokeWidth:1})},"bpmn:TerminateEventDefinition":function(M,E,b={}){var j=h(M,E.width,E.height,8,{fill:fe(E,c,b.stroke),stroke:fe(E,c,b.stroke),strokeWidth:4});return j}};function N(M,E,b={},j){var W=te(M),K=aR(W),ye=j||M;return W.get("eventDefinitions")&&W.get("eventDefinitions").length>1?W.get("parallelMultiple")?T["bpmn:ParallelMultipleEventDefinition"](E,ye,b,K):T["bpmn:MultipleEventDefinition"](E,ye,b,K):yi(W,"bpmn:MessageEventDefinition")?T["bpmn:MessageEventDefinition"](E,ye,b,K):yi(W,"bpmn:TimerEventDefinition")?T["bpmn:TimerEventDefinition"](E,ye,b,K):yi(W,"bpmn:ConditionalEventDefinition")?T["bpmn:ConditionalEventDefinition"](E,ye,b,K):yi(W,"bpmn:SignalEventDefinition")?T["bpmn:SignalEventDefinition"](E,ye,b,K):yi(W,"bpmn:EscalationEventDefinition")?T["bpmn:EscalationEventDefinition"](E,ye,b,K):yi(W,"bpmn:LinkEventDefinition")?T["bpmn:LinkEventDefinition"](E,ye,b,K):yi(W,"bpmn:ErrorEventDefinition")?T["bpmn:ErrorEventDefinition"](E,ye,b,K):yi(W,"bpmn:CancelEventDefinition")?T["bpmn:CancelEventDefinition"](E,ye,b,K):yi(W,"bpmn:CompensateEventDefinition")?T["bpmn:CompensateEventDefinition"](E,ye,b,K):yi(W,"bpmn:TerminateEventDefinition")?T["bpmn:TerminateEventDefinition"](E,ye,b,K):null}var k={ParticipantMultiplicityMarker:function(M,E,b={}){var j=Fn(E,b),W=An(E,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(E,s,b.fill),stroke:fe(E,c,b.stroke)})},SubProcessMarker:function(M,E,b={}){var j=m(M,14,14,0,{strokeWidth:1,fill:Ve(E,s,b.fill),stroke:fe(E,c,b.stroke)});en(j,E.width/2-7.5,E.height-20);var W=i.getScaledPath("MARKER_SUB_PROCESS",{xScaleFactor:1.5,yScaleFactor:1.5,containerWidth:E.width,containerHeight:E.height,position:{mx:(E.width/2-7.5)/E.width,my:(E.height-20)/E.height}});P("sub-process",M,W,{fill:Ve(E,s,b.fill),stroke:fe(E,c,b.stroke)})},ParallelMarker:function(M,E,b){var j=Fn(E,b),W=An(E,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(E,s,b.fill),stroke:fe(E,c,b.stroke)})},SequentialMarker:function(M,E,b){var j=i.getScaledPath("MARKER_SEQUENTIAL",{xScaleFactor:1,yScaleFactor:1,containerWidth:E.width,containerHeight:E.height,position:{mx:(E.width/2+b.seq)/E.width,my:(E.height-19)/E.height}});P("sequential",M,j,{fill:Ve(E,s,b.fill),stroke:fe(E,c,b.stroke)})},CompensationMarker:function(M,E,b){var j=i.getScaledPath("MARKER_COMPENSATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:E.width,containerHeight:E.height,position:{mx:(E.width/2+b.compensation)/E.width,my:(E.height-13)/E.height}});P("compensation",M,j,{strokeWidth:1,fill:Ve(E,s,b.fill),stroke:fe(E,c,b.stroke)})},LoopMarker:function(M,E,b){var j=Fn(E,b),W=An(E,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(E,c,b.stroke),strokeMiterlimit:.5})},AdhocMarker:function(M,E,b){var j=Fn(E,b),W=An(E,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(E,c,b.stroke),stroke:fe(E,c,b.stroke)})}};function O(M,E,b,j){k[M](E,b,j)}function F(M,E,b=[],j={}){j={fill:j.fill,stroke:j.stroke,width:Fn(E,j),height:An(E,j)};var W=te(E),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"),x(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,E,j)})}function ae(M,E,b={}){b=H({size:{width:100}},b);var j=o.createText(E||"",b);return qe(j).add("djs-label"),Be(M,j),j}function _e(M,E,b,j={}){var W=te(E),K=sa({x:E.x,y:E.y,width:E.width,height:E.height},j);return ae(M,W.name,{align:b,box:K,padding:7,style:{fill:aa(E,u,c,j.stroke)}})}function We(M,E,b={}){var j={width:E.width,height:E.height,x:E.width/2+E.x,y:E.height/2+E.y};return ae(M,Bn(E),{box:j,style:H({},o.getExternalStyle(),{fill:aa(E,u,c,b.stroke)})})}function Y(M,E,b,j={}){var W=qt(b),K=ae(M,E,{box:{height:30,width:W?An(b,j):Fn(b,j)},align:"center-middle",style:{fill:aa(b,u,c,j.stroke)}});if(W){var ye=-1*An(b,j);Os(K,0,-ye,270)}}function le(M,E,b={}){var{width:j,height:W}=sa(E,b);return m(M,j,W,Bs,{...b,fill:Ve(E,s,b.fill),fillOpacity:go,stroke:fe(E,c,b.stroke)})}function ge(M,E,b={}){var j=te(E),W=Ve(E,s,b.fill),K=fe(E,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"]),_(M,E.waypoints,{...b,stroke:K,strokeDasharray:"0, 5"})}function ue(M,E,b={}){var j=Ve(E,s,b.fill),W=fe(E,c,b.stroke),K=i.getScaledPath("DATA_OBJECT_PATH",{xScaleFactor:1,yScaleFactor:1,containerWidth:E.width,containerHeight:E.height,position:{mx:.474,my:.296}}),ye=S(M,K,{fill:j,fillOpacity:go,stroke:W}),Ie=te(E);if(sR(Ie)){var Xe=i.getScaledPath("DATA_OBJECT_COLLECTION_PATH",{xScaleFactor:1,yScaleFactor:1,containerWidth:E.width,containerHeight:E.height,position:{mx:.33,my:(E.height-18)/E.height}});S(M,Xe,{strokeWidth:2,fill:j,stroke:W})}return ye}function Re(M,E,b={}){return h(M,E.width,E.height,{fillOpacity:go,...b,fill:Ve(E,s,b.fill),stroke:fe(E,c,b.stroke)})}function re(M,E,b={}){return w(M,E.width,E.height,{fill:Ve(E,s,b.fill),fillOpacity:go,stroke:fe(E,c,b.stroke)})}function q(M,E,b={}){var j=m(M,Fn(E,b),An(E,b),0,{fill:Ve(E,s,b.fill),fillOpacity:b.fillOpacity||go,stroke:fe(E,c,b.stroke),strokeWidth:1.5}),W=te(E);if(x(W,"bpmn:Lane")){var K=W.get("name");Y(M,K,E,b)}return j}function U(M,E,b={}){var j=le(M,E,b),W=Ue(E);if(un(E)&&(he(j,{strokeDasharray:"0, 5.5",strokeWidth:2.5}),!W)){var K=te(E).flowElements||[],ye=K.filter(Ie=>x(Ie,"bpmn:StartEvent"));ye.length===1&&Z(ye[0],M,b,E)}return _e(M,E,W?"center-top":"center-middle",b),W?F(M,E,void 0,b):F(M,E,["SubProcessMarker"],b),j}function Z(M,E,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(E,Et,Et,{fill:K.fill,stroke:K.stroke,strokeWidth:Xe,strokeDasharray:Ie,transform:Ht}),N(M,E,K,j)}function He(M,E,b={}){var j=le(M,E,b);return _e(M,E,"center-middle",b),F(M,E,void 0,b),j}var wt=this.handlers={"bpmn:AdHocSubProcess":function(M,E,b={}){return Ue(E)?b=Ke(b,["fill","stroke","width","height"]):b=Ke(b,["fill","stroke"]),U(M,E,b)},"bpmn:Association":function(M,E,b={}){return b=Ke(b,["fill","stroke"]),ge(M,E,b)},"bpmn:BoundaryEvent":function(M,E,b={}){var{renderIcon:j=!0}=b;b=Ke(b,["fill","stroke"]);var W=te(E),K=W.get("cancelActivity");b={strokeWidth:1.5,fill:Ve(E,s,b.fill),fillOpacity:hR,stroke:fe(E,c,b.stroke)},K||(b.strokeDasharray="6");var ye=Re(M,E,b);return h(M,E.width,E.height,Ns,{...b,fill:"none"}),j&&N(E,M,b),ye},"bpmn:BusinessRuleTask":function(M,E,b={}){b=Ke(b,["fill","stroke"]);var j=He(M,E,b),W=i.getScaledPath("TASK_TYPE_BUSINESS_RULE_MAIN",{abspos:{x:8,y:8}}),K=S(M,W);he(K,{fill:Ve(E,s,b.fill),stroke:fe(E,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(E,c,b.stroke),stroke:fe(E,c,b.stroke),strokeWidth:1}),j},"bpmn:CallActivity":function(M,E,b={}){return b=Ke(b,["fill","stroke"]),U(M,E,{strokeWidth:5,...b})},"bpmn:ComplexGateway":function(M,E,b={}){b=Ke(b,["fill","stroke"]);var j=re(M,E,b),W=i.getScaledPath("GATEWAY_COMPLEX",{xScaleFactor:.5,yScaleFactor:.5,containerWidth:E.width,containerHeight:E.height,position:{mx:.46,my:.26}});return S(M,W,{fill:fe(E,c,b.stroke),stroke:fe(E,c,b.stroke),strokeWidth:1}),j},"bpmn:DataInput":function(M,E,b={}){b=Ke(b,["fill","stroke"]);var j=i.getRawPath("DATA_ARROW"),W=ue(M,E,b);return S(M,j,{fill:"none",stroke:fe(E,c,b.stroke),strokeWidth:1}),W},"bpmn:DataInputAssociation":function(M,E,b={}){return b=Ke(b,["fill","stroke"]),ge(M,E,{...b,markerEnd:d(M,"association-end",Ve(E,s,b.fill),fe(E,c,b.stroke))})},"bpmn:DataObject":function(M,E,b={}){return b=Ke(b,["fill","stroke"]),ue(M,E,b)},"bpmn:DataObjectReference":D("bpmn:DataObject"),"bpmn:DataOutput":function(M,E,b={}){b=Ke(b,["fill","stroke"]);var j=i.getRawPath("DATA_ARROW"),W=ue(M,E,b);return S(M,j,{strokeWidth:1,fill:fe(E,c,b.stroke),stroke:fe(E,c,b.stroke)}),W},"bpmn:DataOutputAssociation":function(M,E,b={}){return b=Ke(b,["fill","stroke"]),ge(M,E,{...b,markerEnd:d(M,"association-end",Ve(E,s,b.fill),fe(E,c,b.stroke))})},"bpmn:DataStoreReference":function(M,E,b={}){b=Ke(b,["fill","stroke"]);var j=i.getScaledPath("DATA_STORE",{xScaleFactor:1,yScaleFactor:1,containerWidth:E.width,containerHeight:E.height,position:{mx:0,my:.133}});return S(M,j,{fill:Ve(E,s,b.fill),fillOpacity:go,stroke:fe(E,c,b.stroke),strokeWidth:2})},"bpmn:EndEvent":function(M,E,b={}){var{renderIcon:j=!0}=b;b=Ke(b,["fill","stroke"]);var W=Re(M,E,{...b,strokeWidth:4});return j&&N(E,M,b),W},"bpmn:EventBasedGateway":function(M,E,b={}){b=Ke(b,["fill","stroke"]);var j=te(E),W=re(M,E,b);h(M,E.width,E.height,E.height*.2,{fill:Ve(E,"none",b.fill),stroke:fe(E,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:E.width,containerHeight:E.height,position:{mx:.36,my:.44}});S(M,Et,{fill:"none",stroke:fe(E,c,b.stroke),strokeWidth:2})}if(K==="Parallel"){var Xe=i.getScaledPath("GATEWAY_PARALLEL",{xScaleFactor:.4,yScaleFactor:.4,containerWidth:E.width,containerHeight:E.height,position:{mx:.474,my:.296}});S(M,Xe,{fill:"none",stroke:fe(E,c,b.stroke),strokeWidth:1})}else K==="Exclusive"&&(ye||h(M,E.width,E.height,E.height*.26,{fill:"none",stroke:fe(E,c,b.stroke),strokeWidth:1}),Ie());return W},"bpmn:ExclusiveGateway":function(M,E,b={}){b=Ke(b,["fill","stroke"]);var j=re(M,E,b),W=i.getScaledPath("GATEWAY_EXCLUSIVE",{xScaleFactor:.4,yScaleFactor:.4,containerWidth:E.width,containerHeight:E.height,position:{mx:.32,my:.3}}),K=Ye(E);return K.get("isMarkerVisible")&&S(M,W,{fill:fe(E,c,b.stroke),stroke:fe(E,c,b.stroke),strokeWidth:1}),j},"bpmn:Gateway":function(M,E,b={}){return b=Ke(b,["fill","stroke"]),re(M,E,b)},"bpmn:Group":function(M,E,b={}){return b=Ke(b,["fill","stroke","width","height"]),m(M,E.width,E.height,Bs,{stroke:fe(E,c,b.stroke),strokeWidth:1.5,strokeDasharray:"10, 6, 0, 6",fill:"none",pointerEvents:"none",width:Fn(E,b),height:An(E,b)})},"bpmn:InclusiveGateway":function(M,E,b={}){b=Ke(b,["fill","stroke"]);var j=re(M,E,b);return h(M,E.width,E.height,E.height*.24,{fill:Ve(E,s,b.fill),stroke:fe(E,c,b.stroke),strokeWidth:2.5}),j},"bpmn:IntermediateEvent":function(M,E,b={}){var{renderIcon:j=!0}=b;b=Ke(b,["fill","stroke"]);var W=Re(M,E,{...b,strokeWidth:1.5});return h(M,E.width,E.height,Ns,{fill:"none",stroke:fe(E,c,b.stroke),strokeWidth:1.5}),j&&N(E,M,b),W},"bpmn:IntermediateCatchEvent":D("bpmn:IntermediateEvent"),"bpmn:IntermediateThrowEvent":D("bpmn:IntermediateEvent"),"bpmn:Lane":function(M,E,b={}){return b=Ke(b,["fill","stroke","width","height"]),q(M,E,{...b,fillOpacity:mR})},"bpmn:ManualTask":function(M,E,b={}){b=Ke(b,["fill","stroke"]);var j=He(M,E,b),W=i.getScaledPath("TASK_TYPE_MANUAL",{abspos:{x:17,y:15}});return S(M,W,{fill:Ve(E,s,b.fill),stroke:fe(E,c,b.stroke),strokeWidth:.5}),j},"bpmn:MessageFlow":function(M,E,b={}){b=Ke(b,["fill","stroke"]);var j=te(E),W=Ye(E),K=Ve(E,s,b.fill),ye=fe(E,c,b.stroke),Ie=_(M,E.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=ae(M,ln,{align:"center-top",fitBox:!0,style:{fill:ye}}),zt=Ht.getBBox(),Zt=et.getBBox(),Wi=Xe.x-Zt.width/2,bn=Xe.y+zt.height/2+pR;Os(et,Wi,bn,0)}return Ie},"bpmn:ParallelGateway":function(M,E,b={}){b=Ke(b,["fill","stroke"]);var j=re(M,E,b),W=i.getScaledPath("GATEWAY_PARALLEL",{xScaleFactor:.6,yScaleFactor:.6,containerWidth:E.width,containerHeight:E.height,position:{mx:.46,my:.2}});return S(M,W,{fill:fe(E,c,b.stroke),stroke:fe(E,c,b.stroke),strokeWidth:1}),j},"bpmn:Participant":function(M,E,b={}){b=Ke(b,["fill","stroke","width","height"]);var j=q(M,E,b),W=Ue(E),K=qt(E),ye=te(E),Ie=ye.get("name");if(W){var Xe=K?[{x:30,y:0},{x:30,y:An(E,b)}]:[{x:0,y:30},{x:Fn(E,b),y:30}];y(M,Xe,{stroke:fe(E,c,b.stroke),strokeWidth:fR}),Y(M,Ie,E,b)}else{var Et=sa(E,b);K||(Et.height=Fn(E,b),Et.width=An(E,b));var nt=ae(M,Ie,{box:Et,align:"center-middle",style:{fill:aa(E,u,c,b.stroke)}});if(!K){var Ht=-1*An(E,b);Os(nt,0,-Ht,270)}}return ye.get("participantMultiplicity")&&O("ParticipantMultiplicityMarker",M,E,b),j},"bpmn:ReceiveTask":function(M,E,b={}){b=Ke(b,["fill","stroke"]);var j=te(E),W=He(M,E,b),K;return j.get("instantiate")?(h(M,28,28,20*.22,{fill:Ve(E,s,b.fill),stroke:fe(E,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(E,s,b.fill),stroke:fe(E,c,b.stroke),strokeWidth:1}),W},"bpmn:ScriptTask":function(M,E,b={}){b=Ke(b,["fill","stroke"]);var j=He(M,E,b),W=i.getScaledPath("TASK_TYPE_SCRIPT",{abspos:{x:15,y:20}});return S(M,W,{fill:Ve(E,s,b.fill),stroke:fe(E,c,b.stroke),strokeWidth:1}),j},"bpmn:SendTask":function(M,E,b={}){b=Ke(b,["fill","stroke"]);var j=He(M,E,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(E,c,b.stroke),stroke:Ve(E,s,b.fill),strokeWidth:1}),j},"bpmn:SequenceFlow":function(M,E,b={}){b=Ke(b,["fill","stroke"]);var j=Ve(E,s,b.fill),W=fe(E,c,b.stroke),K=_(M,E.waypoints,{markerEnd:d(M,"sequenceflow-end",j,W),stroke:W}),ye=te(E),{source:Ie}=E;if(Ie){var Xe=te(Ie);ye.get("conditionExpression")&&x(Xe,"bpmn:Activity")&&he(K,{markerStart:d(M,"conditional-flow-marker",j,W)}),Xe.get("default")&&(x(Xe,"bpmn:Gateway")||x(Xe,"bpmn:Activity"))&&Xe.get("default")===ye&&he(K,{markerStart:d(M,"conditional-default-flow-marker",j,W)})}return K},"bpmn:ServiceTask":function(M,E,b={}){b=Ke(b,["fill","stroke"]);var j=He(M,E,b);h(M,10,10,{fill:Ve(E,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(E,s,b.fill),stroke:fe(E,c,b.stroke),strokeWidth:1}),h(M,10,10,{fill:Ve(E,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(E,s,b.fill),stroke:fe(E,c,b.stroke),strokeWidth:1}),j},"bpmn:StartEvent":function(M,E,b={}){var{renderIcon:j=!0}=b;b=Ke(b,["fill","stroke"]);var W=te(E);W.get("isInterrupting")||(b={...b,strokeDasharray:"6"});var K=Re(M,E,b);return j&&N(E,M,b),K},"bpmn:SubProcess":function(M,E,b={}){return Ue(E)?b=Ke(b,["fill","stroke","width","height"]):b=Ke(b,["fill","stroke"]),U(M,E,b)},"bpmn:Task":function(M,E,b={}){return b=Ke(b,["fill","stroke"]),He(M,E,b)},"bpmn:TextAnnotation":function(M,E,b={}){b=Ke(b,["fill","stroke"]);var{width:j,height:W}=sa(E,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(E,c,b.stroke)});var Ie=te(E),Xe=Ie.get("text")||"";return ae(M,Xe,{align:"left-top",box:sa(E,b),padding:mo,style:{fill:aa(E,u,c,b.stroke)}}),K},"bpmn:Transaction":function(M,E,b={}){Ue(E)?b=Ke(b,["fill","stroke","width","height"]):b=Ke(b,["fill","stroke"]);var j=U(M,E,{strokeWidth:1.5,...b}),W=n.style(["no-fill","no-events"],{stroke:fe(E,c,b.stroke),strokeWidth:1.5}),K=Ue(E);return K||(b={}),m(M,Fn(E,b),An(E,b),Bs-Ns,Ns,W),j},"bpmn:UserTask":function(M,E,b={}){b=Ke(b,["fill","stroke"]);var j=He(M,E,b),W=15,K=12,ye=i.getScaledPath("TASK_TYPE_USER_1",{abspos:{x:W,y:K}});S(M,ye,{fill:Ve(E,s,b.fill),stroke:fe(E,c,b.stroke),strokeWidth:.5});var Ie=i.getScaledPath("TASK_TYPE_USER_2",{abspos:{x:W,y:K}});S(M,Ie,{fill:Ve(E,s,b.fill),stroke:fe(E,c,b.stroke),strokeWidth:.5});var Xe=i.getScaledPath("TASK_TYPE_USER_3",{abspos:{x:W,y:K}});return S(M,Xe,{fill:fe(E,c,b.stroke),stroke:fe(E,c,b.stroke),strokeWidth:.5}),j},label:function(M,E,b={}){return We(M,E,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 x(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)?Pl(e,dR):x(e,"bpmn:Event")?km(e):x(e,"bpmn:Activity")?Pl(e,Bs):x(e,"bpmn:Gateway")?cR(e):uR(e)};function Ke(e,t=[]){return t.reduce((n,i)=>(e[i]&&(n[i]=e[i]),n),{})}var gR=0,yR={width:150,height:50};function vR(e){var t=e.split("-");return{horizontal:t[0]||"center",vertical:t[1]||"top"}}function bR(e){return Vt(e)?H({top:0,left:0,right:0,bottom:0},e):{top:e,left:e,right:e,bottom:e}}var Al=null;function _R(){return Al||(Al=document.createElement("canvas").getContext("2d")),Al}function xR(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(Om(e.fontSize)||"12px"),t.push(e.fontFamily||"sans-serif"),t.join(" ")}function Om(e){if(e!=null)return typeof e=="number"||/^-?\d+(\.\d+)?$/.test(e)?e+"px":e}function wR(e,t){var n=_R();if(!n)return{width:0,height:0};n.font=xR(t),"letterSpacing"in n&&(n.letterSpacing=Om(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 ER(e,t,n){for(var i=e.shift(),r=i,o;;){if(o=wR(r,n),o.width=r?o.width:0,r===" "||r===""||o.width<Math.round(t)||r.length<2)return SR(e,r,i,o);r=CR(r,o.width,t)}}function SR(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 Dm="­";function RR(e,t){var n=e.split(/(\s|-|\u00AD)/g),i,r=[],o=0;if(n.length>1)for(;i=n.shift();)if(i.length+o<t)r.push(i),o+=i.length;else{(i==="-"||i===Dm)&&r.pop();break}var a=r[r.length-1];return a&&a===Dm&&(r[r.length-1]="-"),r.join("")}function CR(e,t,n){var i=Math.max(e.length*(n/t),1),r=RR(e,i);return r||(r=e.slice(0,Math.max(Math.round(i-1),1))),r}function $s(e){this._config=H({},{size:yR,padding:gR,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=vR(t.align||this._config.align),o=bR(t.padding!==void 0?t.padding:this._config.padding),a=t.fitBox||!1,s=PR(i),c=e.split(/\u00AD?\r?\n/),u=[],l=n.width-o.left-o.right;c.length;)u.push(ER(c,l,i));r.vertical==="middle"&&(o.top=o.bottom=0);var p=Sn(u,function(m,w,y){return m+(s||w.height)},0)+o.top+o.bottom,f=Sn(u,function(m,w,y){return w.width>m?w.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 w;switch(d+=s||m.height,r.horizontal){case"left":w=o.left;break;case"right":w=(a?f:l)-o.right-m.width;break;default:w=Math.max(((a?f:l)-m.width)/2+o.left,0)}var y=Ce("tspan");he(y,{x:w,y:d}),y.textContent=m.text,Be(g,y)});var h={width:f,height:p};return{dimensions:h,element:g}};function PR(e){if("fontSize"in e&&"lineHeight"in e)return e.lineHeight*parseInt(e.fontSize,10)}var AR=12,TR=1.2,MR=40;function Lm(e){var t=H({fontFamily:"Arial, sans-serif",fontSize:AR,fontWeight:"normal",lineHeight:TR},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(MR,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}}Lm.$inject=["config.textRenderer"];function kR(){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=IR(i.d,{mx:r,my:o,e:a});return p}}var OR=/\{([^{}]+)\}/g,DR=/(?:(?:^|\.)(.+?)(?=\[|\.|$|\()|\[('|")(.+?)\2\])(\(\))?/g;function LR(e,t,n){var i=n;return t.replace(DR,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 IR(e,t){return String(e).replace(OR,function(n,i){return LR(n,i,t)})}const NR={__init__:["bpmnRenderer"],bpmnRenderer:["type",Ir],textRenderer:["type",Lm],pathMap:["type",kR]};function BR(e,t){return t=t||{},e.replace(/{([^}]+)}/g,function(n,i){return t[i]||"{"+i+"}"})}const ca={translate:["value",BR]};function js(e,t,n){return H({id:e.id,type:e.$type,businessObject:e,di:t},n)}function $R(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 Im(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(x(t,"bpmndi:BPMNPlane")){var a=x(e,"bpmn:SubProcess")?{id:e.id+"_plane"}:{};i=this._elementFactory.createRoot(js(e,t,a)),this._canvas.addRootElement(i)}else if(x(t,"bpmndi:BPMNShape")){var s=!Ue(e,t),c=FR(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})),x(e,"bpmn:BoundaryEvent")&&this._attachBoundary(e,i),x(e,"bpmn:Lane")&&(o=0),x(e,"bpmn:DataStoreReference")&&(jR(n,Oe(u))||(n=this._canvas.findRoot(n))),this._canvas.addShape(i,n,o)}else if(x(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:$R(t,l,p)})),x(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 rr(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 Im(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=tR(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?Im(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 jR(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 FR(e){return x(e,"bpmn:Group")}const Nm={__depends__:[NR,{__depends__:[ca],bpmnImporter:["type",Di]}]};function ua(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 Tl(e){return Math.log(e)/Math.log(10)}var HR=1e3;function J(e){this._eventBus=e}J.$inject=["eventBus"];function zR(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=HR),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?zR(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 Ml=["top","bottom","left","right"],Fs=10;function kl(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=WR(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=ni(l,c);t.moveShape(s,p)}}}de(kl,J),kl.$inject=["eventBus","modeling"];function GR(e){var t=e.host,n=Oe(e),i=Jt(n,t),r;i.indexOf("-")>=0?r=i.split("-"):r=[i];var o=Ml.filter(function(a){return r.indexOf(a)===-1});return o}function VR(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 Bm(t,i)});return n}function WR(e){var t=Oe(e.label),n=Oe(e),i=Bm(n,t);if(UR(i)){var r=VR(e);if(e.host){var o=GR(e);r=r.concat(o)}var a=Ml.filter(function(s){return r.indexOf(s)===-1});return a.indexOf(i)!==-1?Jt(e.label,e)!=="intersect"?void 0:i:a[0]}}function Bm(e,t){return Jt(t,e,5)}function UR(e){return Ml.indexOf(e)!==-1}function Ol(e){J.call(this,e),this.preExecute("shape.append",function(t){var n=t.source,i=t.shape;t.position||(x(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(Ol,J),Ol.$inject=["eventBus"];var qR=1500;function Dl(e,t,n){e.invoke(J,this),this.preExecute("elements.delete",qR,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=>x(u,"bpmn:Participant")||x(u,"bpmn:SubProcess"));if(!o.length)return[];var a=n.getRootElement(),s=new Set(a.children.filter(u=>x(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(Dl,J),Dl.$inject=["injector","eventBus","canvas"];function Ll(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 x(a,"bpmn:Association")});L(o,function(a){t.moveConnection(a,{x:0,y:0},i)})},!0)}de(Ll,J),Ll.$inject=["injector","modeling"];function yo(e,t){for(wn(t)&&(t=[t]);e=e.parent;)if(ze(e,t))return e;return null}function $m(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&&!x(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 jm=500;function Hs(e,t){t.invoke(J,this),this._bpmnReplace=e;var n=this;this.postExecuted("elements.create",jm,function(i){var r=i.elements;r=r.filter(function(o){var a=o.host;return Fm(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",jm,function(i){var r=i.shapes,o=i.newHost;if(r.length===1){var a=r[0];Fm(a,o)&&(i.shapes=[n._replaceShape(a,o)])}},!0)}Hs.$inject=["bpmnReplace","injector"],de(Hs,J),Hs.prototype._replaceShape=function(e,t){var n=YR(e),i={type:"bpmn:BoundaryEvent",host:t};return n&&(i.eventDefinitionType=n.$type),this._bpmnReplace.replaceElement(e,i,{layoutConnection:!1})};function YR(e){var t=te(e),n=t.eventDefinitions;return n&&n[0]}function Fm(e,t){return!Fe(e)&&ze(e,["bpmn:IntermediateThrowEvent","bpmn:IntermediateCatchEvent"])&&!!t}function Il(e,t){J.call(this,e);function n(i){return Ge(i.attachers,function(r){return x(r,"bpmn:BoundaryEvent")})}this.postExecute("connection.create",function(i){var r=i.context.source,o=i.context.target,a=n(o);x(r,"bpmn:EventBasedGateway")&&x(o,"bpmn:ReceiveTask")&&a.length>0&&t.removeElements(a)}),this.postExecute("connection.reconnect",function(i){var r=i.context.oldSource,o=i.context.newSource;x(r,"bpmn:Gateway")&&x(o,"bpmn:EventBasedGateway")&&L(o.outgoing,function(a){var s=a.target,c=n(s);x(s,"bpmn:ReceiveTask")&&c.length>0&&t.removeElements(c)})})}Il.$inject=["eventBus","modeling"],de(Il,J);function Hm(e){return e.create("bpmn:Category")}function KR(e){return e.create("bpmn:CategoryValue")}function zm(e,t){var n=t.get("categoryValueRef");return n||(n=t.categoryValueRef=KR(e)),n.$parent||(n.$parent=Hm(e)),n}function XR(e,t,n){return Pt(t.get("categoryValue"),e),e.$parent=t,Pt(n.get("rootElements"),t),t.$parent=n,e}function ZR(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 JR=500;function Nl(e,t,n){n.invoke(J,this);function i(c){return t.filter(function(u){return x(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&&XR(c,u,e.getDefinitions())}function s(c,u,l){u&&!o(u,l)&&QR(u),c&&!r(c,l)&&ZR(c)}this.executed(["shape.create","label.create"],function(c){var u=c.labelTarget||c.shape;!x(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;!x(u,"bpmn:Group")||u.labelTarget||s(c.categoryValue,c.category,te(u))},!0),this.executed(["shape.move","shape.resize"],JR,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){Gm(c).forEach(function(u){a(u.categoryValue,u.category)})},!0),this.reverted("group.updateRefs",function(c){Gm(c).forEach(function(u){s(u.categoryValue,u.category,te(u.groupShape))})},!0),this.executed("shape.delete",function(c){var u=c.shape;!x(u,"bpmn:Group")||u.labelTarget||s(c.categoryValue,c.category,te(u))},!0),this.reverted("shape.delete",function(c){var u=c.shape;!x(u,"bpmn:Group")||u.labelTarget||a(c.categoryValue,c.category)},!0)}Nl.$inject=["bpmnjs","elementRegistry","injector"],de(Nl,J);function Gm(e){var t;return((t=e.updates)==null?void 0:t.groups)||[]}function Bl(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 w=m.source,y=m.target;vo(w)&&la(y)&&l(y)}function r(m){const w=m.connection,y=m.source,_=m.target;vo(y)&&zs(_)&&(u(_),f(y,[w]))}function o(m){const w=m.newTarget,y=m.oldSource,_=m.oldTarget;if(_!==w){const S=y;la(_)&&l(_),vo(S)&&zs(w)&&u(w)}}function a(m){const{element:w}=m;la(w)?(p(w),d(w)):zs(w)&&g(w)}function s(m){const{newData:w,oldShape:y}=m;if(vo(m.oldShape)&&w.eventDefinitionType!=="bpmn:CompensateEventDefinition"||w.type!=="bpmn:BoundaryEvent"){const _=y.outgoing.find(({target:S})=>la(S));_&&_.target&&(m._connectionTarget=_.target)}else if(!vo(m.oldShape)&&w.eventDefinitionType==="bpmn:CompensateEventDefinition"&&w.type==="bpmn:BoundaryEvent"){const _=y.outgoing.find(({target:S})=>zs(S));_&&_.target&&(m._connectionTarget=_.target),h(y)}}function c(m){const{_connectionTarget:w,newShape:y}=m;w&&t.connect(y,w)}function u(m){t.updateProperties(m,{isForCompensation:!0})}function l(m){t.updateProperties(m,{isForCompensation:void 0})}function p(m){for(const w of m.incoming)n.canConnect(w.source,m)||t.removeConnection(w);for(const w of m.outgoing)n.canConnect(m,w.target)||t.removeConnection(w)}function f(m,w){m.outgoing.filter(S=>x(S,"bpmn:Association")).filter(S=>la(S.target)&&!w.includes(S)).forEach(S=>t.removeConnection(S))}function d(m){const w=m.attachers.slice();w.length&&t.removeElements(w)}function g(m){const w=m.incoming.filter(y=>vo(y.source));t.removeElements(w)}function h(m){const w=m.outgoing.filter(y=>x(y,"bpmn:SequenceFlow"));t.removeElements(w)}}de(Bl,J),Bl.$inject=["eventBus","modeling","bpmnRules"];function la(e){const t=te(e);return t&&t.get("isForCompensation")}function vo(e){return e&&x(e,"bpmn:BoundaryEvent")&&ho(e,"bpmn:CompensateEventDefinition")}function zs(e){return e&&x(e,"bpmn:Activity")&&!un(e)}function $l(e){e.invoke(J,this),this.preExecute("shape.create",1500,function(t){var n=t.context,i=n.parent,r=n.shape;x(i,"bpmn:Lane")&&!x(r,"bpmn:Lane")&&(n.parent=yo(i,"bpmn:Participant"))})}$l.$inject=["injector"],de($l,J);function jl(e,t){J.call(this,e),this.preExecute("shape.create",function(n){var a;var i=n.context,r=i.shape;if(x(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}})}jl.$inject=["eventBus","bpmnFactory"],de(jl,J);var Fl=20,Hl=20,Vm=30,Gs=2e3;function zl(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(!(!x(a,"bpmn:Participant")||!x(s,"bpmn:Process")||!s.children.length)){var c=s.children.filter(function(p){return!x(p,"bpmn:Group")&&!Fe(p)&&!st(p)});if(c.length){var u=Tt(c),l=eC(a,u);H(a,l),o.createConstraints=tC(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}x(a,"bpmn:Participant")&&x(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 x(r,"bpmn:Collaboration")?r:n.makeCollaboration()}this.preExecute("elements.create",Gs,function(r){var o=r.elements,a=r.parent,s=nC(o),c;s&&x(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;x(a,"bpmn:Participant")&&x(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)}zl.$inject=["canvas","eventBus","modeling"],de(zl,J);function eC(e,t){t={width:t.width+Fl*2+Vm,height:t.height+Hl*2};var n=Math.max(e.width,t.width),i=Math.max(e.height,t.height);return{x:-n/2,y:-i/2,width:n,height:i}}function tC(e,t){return t=Pe(t),{bottom:t.top+e.height/2-Hl,left:t.right-e.width/2+Fl,top:t.bottom-e.height/2+Hl,right:t.left+e.width/2-Fl-Vm}}function nC(e){return lt(e,function(t){return x(t,"bpmn:Participant")})}var Wm="__targetRef_placeholder";function Gl(e,t){J.call(this,e),this.executed(["connection.create","connection.delete","connection.move","connection.reconnect"],Um(o)),this.reverted(["connection.create","connection.delete","connection.move","connection.reconnect"],Um(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===Wm});return!u&&s&&(u=t.create("bpmn:Property",{name:Wm}),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,w;h&&h!==p&&r(h,u),d&&d!==p&&r(d,u),p?(w=i(p,!0),m.targetRef=w):m.targetRef=null}}Gl.$inject=["eventBus","bpmnFactory"],de(Gl,J);function Um(e){return function(t){var n=t.context,i=n.connection;if(x(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 Vl(e,t,n,i){J.call(this,i),t.registerHandler("dataStore.updateContainment",Vs);function r(){return n.filter(function(s){return x(s,"bpmn:Participant")&&te(s).processRef})[0]}function o(s){return s.children.filter(function(c){return x(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;x(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 x(p,"bpmn:DataStoreReference")});l.length&&(c.hints||(c.hints={}),c.hints.autoResize=u.filter(function(p){return!x(p,"bpmn:DataStoreReference")}))}),this.postExecute("shape.create",function(s){var c=s.context,u=c.shape,l=u.parent;x(u,"bpmn:DataStoreReference")&&u.type!=="label"&&x(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(!x(l,"bpmn:Collaboration")&&x(u,"bpmn:DataStoreReference")&&u.type!=="label"&&x(p,"bpmn:Collaboration")){var f=x(l,"bpmn:Participant")?l:rC(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"])&&x(l,"bpmn:Collaboration")&&o(l).filter(function(p){return iC(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){x(l,"bpmn:Process")&&a(f,l)})})}Vl.$inject=["canvas","commandStack","elementRegistry","eventBus"],de(Vl,J);function iC(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 rC(e,t){for(;e.parent;){if(x(e.parent,t))return e.parent;e=e.parent}}var Ws=Math.max,Us=Math.min,oC=20;function qm(e,t){return{top:e.top-t.top,right:e.right-t.right,bottom:e.bottom-t.bottom,left:e.left-t.left}}function aC(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 sC(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 cC(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 uC(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 pa(e,t){return typeof e<"u"?e:oC}function lC(e,t){var n,i,r,o;return typeof t=="object"?(n=pa(t.left),i=pa(t.right),r=pa(t.top),o=pa(t.bottom)):n=i=r=o=pa(t),{x:e.x-n,y:e.y-r,width:e.width+n+i,height:e.height+r+o}}function pC(e){return!(e.waypoints||e.type==="label")}function Ym(e,t){var n;if(e.length===void 0?n=Ge(e.children,pC):n=e,n.length)return lC(Tt(n),t)}var or=Math.abs;function fC(e,t){return qm(Pe(t),Pe(e))}var dC=["bpmn:Participant","bpmn:Process","bpmn:SubProcess"],Hn=30;function Ys(e,t){return t=t||[],e.children.filter(function(n){x(n,"bpmn:Lane")&&(Ys(n,t),t.push(n))}),t}function ar(e){return e.children.filter(function(t){return x(t,"bpmn:Lane")})}function zn(e){return yo(e,dC)||e}function hC(e,t){var n=zn(e),i=x(n,"bpmn:Process")?[]:[n],r=Ys(n,i),o=Pe(e),a=Pe(t),s=fC(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&&(or(h.bottom-o.top)<10&&(d=a.top-h.bottom),or(h.top-o.top)<5&&(p=a.top-h.top)),s.left&&(or(h.right-o.left)<10&&(f=a.left-h.right),or(h.left-o.left)<5&&(g=a.left-h.left)),s.bottom&&(or(h.top-o.bottom)<10&&(p=a.bottom-h.top),or(h.bottom-o.bottom)<5&&(d=a.bottom-h.bottom)),s.right&&(or(h.left-o.right)<10&&(g=a.right-h.left),or(h.right-o.right)<5&&(f=a.right-h.right)),(p||f||d||g)&&c.push({shape:l,newBounds:sC(l,{top:p,right:f,bottom:d,left:g})})}}),c}var mC=500;function Wl(e,t){J.call(this,e);function n(i,r){var o=qt(i),a=ar(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",mC,function(i){var r=i.context,o=r.hints,a=r.shape,s=r.oldParent;x(a,"bpmn:Lane")&&(o&&o.nested||n(a,s))})}Wl.$inject=["eventBus","spaceTool"],de(Wl,J);var Km=500;function Ks(e,t){t.invoke(J,this),this._bpmnReplace=e;var n=this;this.postExecuted("elements.create",Km,function(i){var r=i.elements;r.filter(function(o){var a=o.host;return Xm(o,a)}).map(function(o){return r.indexOf(o)}).forEach(function(o){i.elements[o]=n._replaceShape(r[o])})},!0),this.preExecute("elements.move",Km,function(i){var r=i.shapes,o=i.newHost;r.forEach(function(a,s){var c=a.host;Xm(a,yC(r,c)?c:o)&&(r[s]=n._replaceShape(a))})},!0)}Ks.$inject=["bpmnReplace","injector"],de(Ks,J),Ks.prototype._replaceShape=function(e){var t=gC(e),n;return t?n={type:"bpmn:IntermediateCatchEvent",eventDefinitionType:t.$type}:n={type:"bpmn:IntermediateThrowEvent"},this._bpmnReplace.replaceElement(e,n,{layoutConnection:!1})};function gC(e){var t=te(e),n=t.eventDefinitions;return n&&n[0]}function Xm(e,t){return!Fe(e)&&x(e,"bpmn:BoundaryEvent")&&!t}function yC(e,t){return e.indexOf(t)!==-1}var Xs=Math.round,vC=Math.max;function bC(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 _C(e){var t=[];return e.forEach(function(n,i){t.push([i===0?"M":"L",n.x,n.y])}),t}var Zm=10;function xC(e,t){var n,i;for(n=0;i=e[n];n++)if(ta(i,t)<=Zm)return{point:e[n],bendpoint:!0,index:n};return null}function wC(e,t){var n=nm(bC(t,Zm),_C(e)),i=n[0],r=n[n.length-1],o;return i?i!==r?i.segment2!==r.segment2?(o=vC(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 Ul(e,t){return xC(e,t)||wC(e,t)}function ql(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(),w;Le(a.width)?w=Oe(a):w=a;var y=Ul(s,w);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]:w,(c.length===1||!Qm(r,c[c.length-1]))&&c.push(Jm(l)),(u.length===1||!Qm(r,u[0]))&&u.unshift(Jm(l))}p=o.source,f=o.target,t.canConnect(p,r,o)&&(n.reconnectEnd(o,r,c||w),d=o),t.canConnect(r,f,o)&&(d?g=n.connect(r,f,{type:o.type,waypoints:u}):(n.reconnectStart(o,r,u||w),g=o));var _=[].concat(d&&Ge(m,function(S){return S.source===d.source})||[],g&&Ge(h,function(S){return S.target===g.target})||[]);_.length&&n.removeElements(_)}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&&Ul(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(ql,J),ql.$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 Jm(e){return H({},e)}function Yl(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=[];x(o,"bpmn:EventBasedGateway")?c=a.incoming.filter(u=>u!==r&&bo(u)):c=a.incoming.filter(u=>u!==r&&bo(u)&&x(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(x(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)})})}})}Yl.$inject=["eventBus","modeling"],de(Yl,J);function bo(e){return x(e,"bpmn:SequenceFlow")}var Zs=1500,eg=2e3;function tg(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;x(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;x(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;x(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;x(o,"bpmn:Lane")&&(r.start=zn(o)||o)}),t.on("shape.move.start",eg,function(i){var r=i.shape;x(r,"bpmn:Lane")&&(i.shape=zn(r)||r)}),t.on("spaceTool.move",eg,function(i){var r=i.hover;r&&x(r,"bpmn:Lane")&&(i.hover=zn(r))})}tg.$inject=["elementRegistry","eventBus","canvas"];var ng=770;function Kl(e,t,n,i){n.invoke(J,this);function r(s,c){var u=te(s),l=c.categoryValue||u.categoryValueRef;l||(l=zm(e,u));var p=c.category||l.$parent||Hm(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;x(u,"bpmn:Group")&&r(u,c)}),this.revert("label.create",function(s){var c=s.context,u=c.labelTarget;x(u,"bpmn:Group")&&o(u,c)}),this.execute("shape.delete",function(s){var c=s.context,u=c.shape,l=te(u);if(!(!x(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(!(!x(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||{};!x(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||{};!x(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;!x(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;!x(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",ng,function(s){var c=s.descriptor,u=s.element;if(!(!x(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",ng,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})}Kl.$inject=["bpmnFactory","eventBus","injector","moddleCopy"],de(Kl,J);function Xl(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 ig(e){function t(i,r,o){var a={x:o.x,y:o.y-50},s={x:o.x-50,y:o.y},c=Xl(i,r,o,a),u=Xl(i,r,o,s),l;c&&u?rg(c,o)>rg(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)})}ig.$inject=["eventBus"];function rg(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function Zl(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)}})}Zl.$inject=["eventBus"],de(Zl,J);function og(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}function ag(e){return Math.atan((e[1].y-e[0].y)/(e[1].x-e[0].x))}function EC(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 SC(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 Ql(e,t){var n=t[0],i=t[1],r={x:i.x-n.x,y:i.y-n.y},o=SC([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 sg(e,t){var n=Ql(e,t),i={x:n.x-e.x,y:n.y-e.y};return og(i)}function fa(e,t){return og({x:e.x-t.x,y:e.y-t.y})}var cg=Math.sqrt,ug=Math.min,RC=Math.max,lg=Math.abs;function pg(e){return Math.pow(e,2)}function da(e,t){return cg(pg(e.x-t.x)+pg(e.y-t.y))}function CC(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],dg(i,r)?u=[i]:(o=da(e,i),a=da(e,r),c=ug(o,a),u=PC(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:dg(i,u[0])?n:n+1}),u.length===2&&(s=TC(u[0],u[1]),l={type:"segment",position:s,segmentIndex:n,relativeLocation:da(i,s)/da(i,r)}),p=da(l.position,e),(!d||f>p)&&(d=l,f=p)}return d}function PC(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=cg(d),h=-p+g,m=-p-g,w={x:e.x-r*h,y:e.y-o*h};if(d===0)return[w];var y={x:e.x-r*m,y:e.y-o*m};return[w,y].filter(function(_){return AC(_,e,t)})}function AC(e,t,n){return fg(e.x,t.x,n.x)&&fg(e.y,t.y,n.y)}function fg(e,t,n){return e>=ug(t,n)-Qs&&e<=RC(t,n)+Qs}function TC(e,t){return{x:(e.x+t.x)/2,y:(e.y+t.y)/2}}var Qs=.1;function dg(e,t){return lg(e.x-t.x)<=Qs&&lg(e.y-t.y)<=Qs}function MC(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=mg(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 hg(e,t,n,i){var r=0,o=0,a={point:e,delta:{x:0,y:0}},s=CC(e,n),c=s.segmentIndex,u=MC(n,t,s,i);if(u<0||u>t.length-2||u===null)return a;var l=gg(n,c),p=gg(t,u),f=s.position,d=OC(l,f),g=kC(l,p);if(s.type==="bendpoint"){var h=t.length-n.length,m=s.bendpointIndex,w=n[m];if(t.indexOf(w)!==-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=mg(n,m))}var _={x:(p[1].x-p[0].x)*d+p[0].x,y:(p[1].y-p[0].y)*d+p[0].y},S=EC({x:e.x-f.x,y:e.y-f.y},g);return r=_.x+S.x-e.x,o=_.y+S.y-e.y,{point:ki(_),delta:ki({x:r,y:o})}}function mg(e,t){var n=fa(e[t-1],e[t]),i=fa(e[t],e[t+1]),r=n/(n+i);return r}function kC(e,t){var n=ag(e),i=ag(t);return i-n}function gg(e,t){return[e[t],e[t+1]]}function OC(e,t){var n=fa(e[0],e[1]),i=fa(e[0],t);return n===0?0:i/n}function DC(e,t,n,i){var r=Oe(e);return hg(r,t,n,i).delta}function ha(e,t,n){var i=ua(t),r=ua(n),o=ni(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 yg(e,t,n){var i=ua(e),r=ua(t),o=ua(n),a=ni(e,i),s=ni(i,r),c=LC(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 LC(e,t,n){var i=Pe(t),r=Pe(n);if(IC(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 IC(e,t){return NC(e,t)||BC(e,t)}function NC(e,t){return e.right!==t.right&&e.left!==t.left}function BC(e,t){return e.top!==t.top&&e.bottom!==t.bottom}var vg="name",bg="text";function Jl(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(vg in u&&t.updateLabel(c,u[vg]),bg in u&&x(c,"bpmn:TextAnnotation")){var l=i.getTextAnnotationBounds({x:c.x,y:c.y,width:c.width,height:c.height},u[bg]||"");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)||!rr(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),DC(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&&rr(l)&&u.label&&c.label&&(c.label.x=u.label.x,c.label.y=u.label.y)}),this.preExecute("shape.resize",function(a){var s=a.context,c=s.shape,u=s.hints||{};if(!(!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=FC(l),g=jC(f,d),h=$C(g,l,u);t.moveShape(p,h)}})}de(Jl,J),Jl.$inject=["eventBus","modeling","bpmnFactory","textRenderer"];function $C(e,t,n){var i=ha(e,t,n);return ki(ni(i,e))}function jC(e,t){if(t.length){var n=HC(e,t);return Ql(e,n)}}function FC(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 HC(e,t){var n=t.map(function(r){return{line:r,distance:sg(e,r)}}),i=ai(n,"distance");return i[0].line}function zC(e,t,n,i){return hg(e,t,n,i).point}function ep(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),zC(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(ep,J),ep.$inject=["eventBus","modeling"];function Js(e,t,n){var i=tc(e),r=xg(i,t),o=i[0];return r.length?r[r.length-1]:ha(o.original||o,n,t)}function ec(e,t,n){var i=tc(e),r=xg(i,t),o=i[i.length-1];return r.length?r[0]:ha(o.original||o,n,t)}function tp(e,t,n){var i=tc(e),r=_g(t,n),o=i[0];return ha(o.original||o,r,t)}function np(e,t,n){var i=tc(e),r=_g(t,n),o=i[i.length-1];return ha(o.original||o,r,t)}function _g(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 xg(e,t){var n=on(e,VC);return Ge(n,function(i){return GC(i,t)})}function GC(e,t){return Jt(t,e,1)==="intersect"}function VC(e){return e.original||e}function ip(e,t){J.call(this,e),this.postExecute("shape.replace",function(n){var i=n.oldShape,r=n.newShape;if(WC(i,r)){var o=UC(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)}ip.$inject=["eventBus","modeling"],de(ip,J);function WC(e,t){return x(e,"bpmn:Participant")&&Ue(e)&&x(t,"bpmn:Participant")&&!Ue(t)}function UC(e){var t=Jo([e]),n=[],i=[];return t.forEach(function(r){r!==e&&(r.incoming.forEach(function(o){x(o,"bpmn:MessageFlow")&&n.push(o)}),r.outgoing.forEach(function(o){x(o,"bpmn:MessageFlow")&&i.push(o)}))},[]),{incoming:n,outgoing:i}}const qC=["bpmn:MessageEventDefinition","bpmn:TimerEventDefinition","bpmn:EscalationEventDefinition","bpmn:ConditionalEventDefinition","bpmn:SignalEventDefinition"];function wg(e){const t=te(e);if(!x(t,"bpmn:BoundaryEvent")&&!(x(t,"bpmn:StartEvent")&&un(t.$parent)))return!1;const n=t.get("eventDefinitions");return!n||!n.length?!1:qC.some(i=>x(n[0],i))}function Eg(e){return x(e,"bpmn:BoundaryEvent")?"cancelActivity":"isInterrupting"}function rp(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(!wg(r))return;const a=Eg(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})})}rp.$inject=["injector","modeling"],de(rp,J);function op(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(op,J),op.$inject=["eventBus","modeling"];function ap(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(!(!x(o,"bpmn:SequenceFlow")||!x(a,"bpmn:SequenceFlow"))&&t.canConnect(o.source,a.target,o)){var s=YC(o.waypoints,a.waypoints);n.reconnectEnd(o,a.target,s)}}})}de(ap,J),ap.$inject=["eventBus","bpmnRules","modeling"];function _o(e){return e.original||e}function YC(e,t){var n=Xl(_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 sp(e,t){J.call(this,e),this.preExecute("shape.delete",function(n){var i=n.shape,r=i.parent;x(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)}sp.$inject=["eventBus","modeling"],de(sp,J);function cp(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;x(c,"bpmn:SequenceFlow")&&(n.canConnectSequenceFlow(u,l)||(d=!0),n.canConnectMessageFlow(u,l)&&(f="bpmn:MessageFlow")),x(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(cp,J),cp.$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=Sn(u,function(p,f){var d=t.canReplace([f],f.host||f.parent||c);return d?p.concat(d.replacements):p},[]);l.length&&this._replaceElements(u,l)},this),this.postExecuted(["elements.move"],500,function(a){var s=a.context,c=s.newParent,u=s.newHost,l=[];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 KC=1500,XC={width:140,height:120},up={width:300,height:60},lp={width:60,height:300},ic={width:300,height:150},rc={width:150,height:300},Sg={width:140,height:120},Rg={width:100,height:40};function Cg(e){e.on("resize.start",KC,function(t){var n=t.context,i=n.shape,r=n.direction,o=n.balanced;(x(i,"bpmn:Lane")||x(i,"bpmn:Participant"))&&(n.resizeConstraints=tP(i,r,o)),x(i,"bpmn:SubProcess")&&Ue(i)&&(n.minDimensions=Sg),x(i,"bpmn:TextAnnotation")&&(n.minDimensions=Rg)})}Cg.$inject=["eventBus"];var sr=Math.abs,ZC=Math.min,QC=Math.max;function Pg(e,t,n,i){var r=e[t];e[t]=r===void 0?n:i(n,r)}function xo(e,t,n){return Pg(e,t,n,ZC)}function wo(e,t,n){return Pg(e,t,n,QC)}var JC={top:20,left:50,right:20,bottom:20},eP={top:50,left:20,right:20,bottom:20};function tP(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?up:lp;/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&&sr(s.top-h.bottom)<10&&wo(c,"top",h.top+p.height),sr(s.top-h.top)<5&&xo(u,"top",h.bottom-p.height)),/e/.test(t)&&(n&&sr(s.right-h.left)<10&&xo(c,"right",h.right-p.width),sr(s.right-h.right)<5&&wo(u,"right",h.left+p.width)),/s/.test(t)&&(n&&sr(s.bottom-h.top)<10&&xo(c,"bottom",h.bottom-p.height),sr(s.bottom-h.bottom)<5&&wo(u,"bottom",h.top+p.height)),/w/.test(t)&&(n&&sr(s.left-h.right)<10&&wo(c,"left",h.left+p.width),sr(s.left-h.left)<5&&xo(u,"left",h.right-p.width))});var f=i.children.filter(function(g){return!g.hidden&&!g.waypoints&&(x(g,"bpmn:FlowElement")||x(g,"bpmn:Artifact"))}),d=l?JC:eP;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 Ag(e){!e||typeof e.stopPropagation!="function"||e.stopPropagation()}function Eo(e){return e.originalEvent||e.srcEvent}function pp(e){Ag(e),Ag(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 Tg(){return/mac/i.test(navigator.platform)}function Mg(e,t){return(Eo(e)||e).button===t}function cr(e){return Mg(e,0)}function nP(e){return Mg(e,1)}function ma(e){var t=Eo(e)||e;return cr(e)?Tg()?t.metaKey:t.ctrlKey:!1}function oc(e){var t=Eo(e)||e;return cr(e)&&t.shiftKey}var kg=1001;function Og(e,t){e.on("resize.start",kg+500,function(n){var i=n.context,r=i.shape;(x(r,"bpmn:Lane")||x(r,"bpmn:Participant"))&&(i.balanced=!ma(n))}),e.on("resize.end",kg,function(n){var i=n.context,r=i.shape,o=i.canExecute,a=i.newBounds;if(x(r,"bpmn:Lane")||x(r,"bpmn:Participant"))return o&&(a=sm(a),t.resizeLane(r,a,i.balanced)),!1})}Og.$inject=["eventBus","modeling"];var iP=500;function fp(e,t,n,i,r){n.invoke(J,this);function o(l){return ze(l,["bpmn:ReceiveTask","bpmn:SendTask"])||rP(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(x(l,"bpmn:ErrorEventDefinition"))return"errorRef";if(x(l,"bpmn:EscalationEventDefinition"))return"escalationRef";if(x(l,"bpmn:MessageEventDefinition"))return"messageRef";if(x(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",iP,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)})}fp.$inject=["bpmnjs","eventBus","injector","moddleCopy","bpmnFactory"],de(fp,J);function rP(e,t){return ke(t)||(t=[t]),Ui(t,function(n){return ho(e,n)})}var Dg=Math.max;function Lg(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;x(a,"bpmn:Participant")&&(o[s]=aP(a,i,r)),x(a,"bpmn:Lane")&&(o[s]=qt(a)?up:lp),x(a,"bpmn:SubProcess")&&Ue(a)&&(o[s]=Sg),x(a,"bpmn:TextAnnotation")&&(o[s]=Rg),x(a,"bpmn:Group")&&(o[s]=XC)}),o})}Lg.$inject=["eventBus"];function oP(e){return e==="x"}function aP(e,t,n){var i=qt(e);if(!uP(e))return i?ic:rc;var r=oP(t),o={};return r?i?o=ic:o={width:cP(e,n,r),height:rc.height}:i?o={width:ic.width,height:sP(e,n,r)}:o=rc,o}function sP(e,t,n){var i;return i=lP(e,t,n),Dg(ic.height,i)}function cP(e,t,n){var i;return i=pP(e,t,n),Dg(rc.width,i)}function uP(e){return!!ar(e).length}function lP(e,t,n){var i=ar(e),r;return r=dp(i,t,n),e.height-r.height+up.height}function pP(e,t,n){var i=ar(e),r;return r=dp(i,t,n),e.width-r.width+lp.width}function dp(e,t,n){var i,r,o;for(i=0;i<e.length;i++)if(r=e[i],!n&&t>=r.y&&t<=r.y+r.height||n&&t>=r.x&&t<=r.x+r.width)return o=ar(r),o.length?dp(o,t,n):r}var Ig="_plane";function Ng(e){var t=e.id;return fP(t)}function vi(e){var t=e.id;return x(e,"bpmn:SubProcess")?Bg(t):t}function Br(e){return Bg(e)}function ac(e){var t=Ye(e);return x(t,"bpmndi:BPMNPlane")}function Bg(e){return e+Ig}function fP(e){return e.replace(new RegExp(Ig+"$"),"")}var $g=400,dP=600,jg={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 x(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(vi(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(vi(d));if(!(!g||!d.children||!d.children.length)){var h=Fg(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;!x(f,"bpmn:SubProcess")||!Ue(f)||L(oa([f]),d=>{n.removeShape(d.annotation)})},!0),this.preExecuted("shape.delete",function(p){var f=p.shape;if(c(f)){var d=a.get(vi(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(vi(f)))},!0),this.postExecuted("shape.replace",function(p){var f=p.newShape,d=p.oldRoot,g=e.findRoot(vi(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(x(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 w=a.get(Br(h));w&&a.updateId(Br(h),Br(m))}}},!0),this.reverted("element.updateProperties",function(p){var f=p.element;if(x(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 w=a.get(Br(m));w&&a.updateId(w,Br(h))}}},!0),t.on("element.changed",function(p){var f=p.element;if(ac(f)){var d=f,g=a.get(Ng(d));!g||g===d||t.fire("element.changed",{element:g})}}),this.executed("shape.toggleCollapse",$g,function(p){var f=p.shape;x(f,"bpmn:SubProcess")&&(Ue(f)?l(p):(u(p),s._showRecursively(f.children)))},!0),this.reverted("shape.toggleCollapse",$g,function(p){var f=p.shape;x(f,"bpmn:SubProcess")&&(Ue(f)?l(p):(u(p),s._showRecursively(f.children)))},!0),this.postExecuted("shape.toggleCollapse",dP,function(p){var f=p.shape;if(x(f,"bpmn:SubProcess")){var d=p.newRootElement;if(d)if(Ue(f))s._moveChildrenToShape(d.children.slice(),f),L(oa(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=Fg(f);s._moveChildrenToShape(g,d)}}},!0),t.on("copyPaste.createTree",function(p){var f=p.element,d=p.children;if(c(f)){var g=vi(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=x(Ye(h),"bpmndi:BPMNPlane");if(m){var w=Ng(h),y=lt(g,function(_){return _.id===w});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:jg.x-r.x,y:jg.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(Mm(e).map(i=>i.annotation));n.size&&L(oa(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:vi(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 hP(e){var t=[];return L(oa(e),n=>{t.push(n.annotation),t.push.apply(t,n.associations)}),t}function Fg(e){return e.children.slice().concat(hP(e.children)).concat(mP(e))}function mP(e){return vl(e.children||[]).reduce(function(t,n){return n.label&&n.label.parent!==e&&t.push(n.label),t},[])}function hp(e,t){e.invoke(J,this),this.postExecuted("shape.replace",function(n){var i=n.context.oldShape,r=n.context.newShape;if(!(!x(r,"bpmn:SubProcess")||x(r,"bpmn:AdHocSubProcess")||!(x(i,"bpmn:Task")||x(i,"bpmn:CallActivity"))||!Ue(r))){var o=gP(r);t.createShape({type:"bpmn:StartEvent"},o,r)}})}hp.$inject=["injector","modeling"],de(hp,J);function gP(e){return{x:e.x+e.width/6,y:e.y+e.height/2}}function mp(e,t){J.call(this,e),this.preExecute("connection.create",function(n){const{target:i}=n;x(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&&x(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(!(!x(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(mp,J),mp.$inject=["eventBus","textRenderer"];function gp(e,t){J.call(this,e),this.postExecuted("shape.toggleCollapse",1500,function(n){var i=n.shape;if(Ue(i))return;var r=Jo(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||x(a,"bpmn:Association")&&(x(a.source,"bpmn:TextAnnotation")||x(a.target,"bpmn:TextAnnotation"))||(s?t.reconnectEnd(a,i,Oe(i)):t.reconnectStart(a,i,Oe(i)))}},!0)}de(gp,J),gp.$inject=["eventBus","modeling"];var yp=500;function vp(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=yP(c).concat([a]),p=Ym(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"],yp,function(a){var s=a.context,c=s.shape;x(c,"bpmn:SubProcess")&&(c.collapsed?Ye(c).isExpanded=!1:(i(c.children),Ye(c).isExpanded=!0))}),this.reverted(["shape.toggleCollapse"],yp,function(a){var s=a.context,c=s.shape;c.collapsed?Ye(c).isExpanded=!1:Ye(c).isExpanded=!0}),this.postExecuted(["shape.toggleCollapse"],yp,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(vp,J),vp.$inject=["eventBus","elementFactory","modeling"];function yP(e){return e.filter(function(t){return!t.hidden})}function bp(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)||(x(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;x(r,"bpmn:Collaboration")&&n.ids.unclaim(o.id)})}de(bp,J),bp.$inject=["canvas","injector","moddle","modeling"];function _p(e,t){J.call(this,e),this.preExecute("connection.delete",function(n){var i=n.context,r=i.connection,o=r.source;vP(r,o)&&t.updateProperties(o,{default:null})})}de(_p,J),_p.$inject=["eventBus","modeling"];function vP(e,t){if(!x(e,"bpmn:SequenceFlow"))return!1;var n=te(t),i=te(e);return n.get("default")===i}var bP=500,_P=5e3,Hg=["shape.create","shape.delete","shape.move","shape.resize"],zg=[...Hg,"spaceTool","lane.add","lane.resize","lane.split","elements.create","elements.delete","elements.move"];function xp(e,t){J.call(this,e);var n;function i(){return n=n||new xP,n.enter(),n}function r(){if(!n)throw new Error("out of bounds release");return n}function o(){if(!n)throw new Error("out of bounds release");var a=n.leave();return a&&(t.updateLaneRefs(n.flowNodes,n.lanes),n=null),a}this.preExecute(zg,_P,function(){i()}),this.postExecuted(zg,bP,function(){o()}),this.preExecute(Hg,function(a){var s=a.context,c=s.shape,u=r();!c||c.labelTarget||(x(c,"bpmn:Lane")&&u.addLane(c),x(c,"bpmn:FlowNode")&&u.addFlowNode(c))})}xp.$inject=["eventBus","modeling"],de(xp,J);function xP(){this.flowNodes=[],this.lanes=[],this.counter=0,this.addLane=function(e){this.lanes.push(e)},this.addFlowNode=function(e){this.flowNodes.push(e)},this.enter=function(){this.counter++},this.leave=function(){return this.counter--,!this.counter}}var wP=500,EP=5e3,Gg=["connection.create","connection.delete","connection.layout","connection.move","connection.reconnect","connection.updateWaypoints","shape.create","shape.delete","shape.move","shape.resize"],Vg=[...Gg,"elements.create","elements.delete","elements.move","label.create","spaceTool"];function wp(e,t){J.call(this,e);var n;function i(){return n=n||new SP,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(Vg,EP,function(){i()}),this.postExecuted(Vg,wP,function(){o()}),this.preExecute(Gg,function(a){var s=a.context.connection||a.context.shape,c=r();!s||s.labelTarget||(x(s,"bpmn:FlowElement")&&c.addFlowElement(s),x(s,"bpmn:Group")&&c.addGroup(s))}),this.preExecute("label.create",function(a){var s=a.context.labelTarget;x(s,"bpmn:Group")&&r().addGroup(s)})}wp.$inject=["eventBus","modeling"],de(wp,J);function SP(){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 Ep(e,t){J.call(this,e),this.postExecuted("elements.create",function(n){const i=n.context,r=i.elements;for(const o of r)RP(o)&&!PP(o)&&t.updateProperties(o,{isForCompensation:void 0})})}de(Ep,J),Ep.$inject=["eventBus","modeling"];function RP(e){const t=te(e);return t&&t.isForCompensation}function CP(e){return e&&x(e,"bpmn:BoundaryEvent")&&ho(e,"bpmn:CompensateEventDefinition")}function PP(e){return e.incoming.filter(n=>CP(n.source)).length>0}const AP={__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",kl],appendBehavior:["type",Ol],associationBehavior:["type",Ll],attachEventBehavior:["type",Hs],artifactBehavior:["type",Dl],boundaryEventBehavior:["type",Il],categoryRootElementReferenceBehavior:["type",Nl],compensateBoundaryEventBehaviour:["type",Bl],createBehavior:["type",$l],createDataObjectBehavior:["type",jl],createParticipantBehavior:["type",zl],dataInputAssociationBehavior:["type",Gl],dataStoreBehavior:["type",Vl],deleteLaneBehavior:["type",Wl],detachEventBehavior:["type",Ks],dropOnFlowBehavior:["type",ql],eventBasedGatewayBehavior:["type",Yl],fixHoverBehavior:["type",tg],groupBehavior:["type",Kl],importDockingFix:["type",ig],isHorizontalFix:["type",Zl],labelBehavior:["type",Jl],layoutConnectionBehavior:["type",ep],messageFlowBehavior:["type",ip],nonInterruptingBehavior:["type",rp],removeElementBehavior:["type",ap],removeEmbeddedLabelBoundsBehavior:["type",op],removeParticipantBehavior:["type",sp],replaceConnectionBehavior:["type",cp],replaceElementBehaviour:["type",nc],resizeBehavior:["type",Cg],resizeLaneBehavior:["type",Og],rootElementReferenceBehavior:["type",fp],spaceToolBehavior:["type",Lg],subProcessPlaneBehavior:["type",Ii],subProcessStartEventBehavior:["type",hp],textAnnotationBehavior:["type",mp],toggleCollapseConnectionBehaviour:["type",gp],toggleElementCollapseBehaviour:["type",vp],unclaimIdBehavior:["type",bp],unsetDefaultFlowBehavior:["type",_p],updateFlowNodeRefsBehavior:["type",xp],updateCategoryValueRefsBehavior:["type",wp],setCompensationActivityAfterPasteBehavior:["type",Ep]};function Sp(e){this._commandStack=e.get("commandStack",!1)}Sp.$inject=["injector"],Sp.prototype.allowed=function(e,t){var n=!0,i=this._commandStack;return i&&(n=i.canExecute(e,t)),n===void 0?!0:n};const bi={__init__:["rules"],rules:["type",Sp]};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 Wg(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 TP(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 ry(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:Cr(t,function(r){return st(r)?cc(r.source,r.target,r):r.host?ga(r,r.host,null,n):Ap(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:ga(n,t,null,i)||ny(n,t,i)||iy(n,t)||uc(n,t)}),this.addRule("shape.create",function(e){return Ap(e.shape,e.target,e.source,e.position)}),this.addRule("shape.attach",function(e){return ga(e.shape,e.target,null,e.position)}),this.addRule("element.copy",function(e){var t=e.element,n=e.elements;return uy(n,t)})},tn.prototype.canConnectMessageFlow=sy,tn.prototype.canConnectSequenceFlow=cy,tn.prototype.canConnectDataAssociation=Tp,tn.prototype.canConnectAssociation=oy,tn.prototype.canConnectCompensationAssociation=ay,tn.prototype.canMove=iy,tn.prototype.canAttach=ga,tn.prototype.canReplace=ny,tn.prototype.canDrop=So,tn.prototype.canInsert=uc,tn.prototype.canCreate=Ap,tn.prototype.canConnect=cc,tn.prototype.canResize=ry,tn.prototype.canCopy=uy;function TP(e){return Rp(e)?null:ze(e,["bpmn:FlowNode","bpmn:InteractionNode","bpmn:DataObjectReference","bpmn:DataStoreReference","bpmn:Group","bpmn:TextAnnotation"])}function Rp(e){return!e||Fe(e)}function Ug(e){do{if(x(e,"bpmn:Process"))return te(e);if(x(e,"bpmn:Participant"))return te(e).processRef||te(e)}while(e=e.parent)}function Cp(e){return x(e,"bpmn:TextAnnotation")}function Pp(e){return x(e,"bpmn:Group")&&!e.labelTarget}function qg(e){return x(e,"bpmn:BoundaryEvent")&&_i(e,"bpmn:CompensateEventDefinition")}function sc(e){return te(e).isForCompensation}function MP(e,t){var n=Ug(e),i=Ug(t);return n===i}function kP(e){return x(e,"bpmn:InteractionNode")&&!x(e,"bpmn:BoundaryEvent")&&(!x(e,"bpmn:Event")||x(e,"bpmn:ThrowEvent")&&Xg(e,"bpmn:MessageEventDefinition"))}function OP(e){return x(e,"bpmn:InteractionNode")&&!sc(e)&&(!x(e,"bpmn:Event")||x(e,"bpmn:CatchEvent")&&Xg(e,"bpmn:MessageEventDefinition"))&&!(x(e,"bpmn:BoundaryEvent")&&!_i(e,"bpmn:MessageEventDefinition"))}function Yg(e){for(var t=e;t=t.parent;){if(x(t,"bpmn:FlowElementsContainer"))return te(t);if(x(t,"bpmn:Participant"))return te(t).processRef}return null}function Kg(e,t){var n=Yg(e),i=Yg(t);return n===i}function _i(e,t){var n=te(e);return!!lt(n.eventDefinitions||[],function(i){return x(i,t)})}function Xg(e,t){var n=te(e);return(n.eventDefinitions||[]).every(function(i){return x(i,t)})}function DP(e){return x(e,"bpmn:FlowNode")&&!x(e,"bpmn:EndEvent")&&!un(e)&&!(x(e,"bpmn:IntermediateThrowEvent")&&_i(e,"bpmn:LinkEventDefinition"))&&!qg(e)&&!sc(e)}function LP(e){return x(e,"bpmn:FlowNode")&&!x(e,"bpmn:StartEvent")&&!x(e,"bpmn:BoundaryEvent")&&!un(e)&&!(x(e,"bpmn:IntermediateCatchEvent")&&_i(e,"bpmn:LinkEventDefinition"))&&!sc(e)}function IP(e){return x(e,"bpmn:ReceiveTask")||x(e,"bpmn:IntermediateCatchEvent")&&(_i(e,"bpmn:MessageEventDefinition")||_i(e,"bpmn:TimerEventDefinition")||_i(e,"bpmn:ConditionalEventDefinition")||_i(e,"bpmn:SignalEventDefinition"))}function NP(e){for(var t=[];e;)e=e.parent,e&&t.push(e);return t}function Zg(e,t){var n=NP(t);return n.indexOf(e)!==-1}function cc(e,t,n){if(Rp(e)||Rp(t))return null;if(!x(n,"bpmn:DataAssociation")){if(sy(e,t))return{type:"bpmn:MessageFlow"};if(cy(e,t))return{type:"bpmn:SequenceFlow"}}var i=Tp(e,t);return i||(ay(e,t)?{type:"bpmn:Association",associationDirection:"One"}:oy(e,t)?{type:"bpmn:Association",associationDirection:"None"}:!1)}function So(e,t){return Fe(e)||Pp(e)?!0:x(t,"bpmn:Participant")&&!Ue(t)?!1:x(e,"bpmn:Participant")?x(t,"bpmn:Process")||x(t,"bpmn:Collaboration"):ze(e,["bpmn:DataInput","bpmn:DataOutput"])&&e.parent?t===e.parent:x(e,"bpmn:Lane")?x(t,"bpmn:Participant")||x(t,"bpmn:Lane"):x(e,"bpmn:BoundaryEvent")&&!BP(e)?!1:x(e,"bpmn:FlowElement")&&!x(e,"bpmn:DataStoreReference")?x(t,"bpmn:FlowElementsContainer")?Ue(t):ze(t,["bpmn:Participant","bpmn:Lane"]):x(e,"bpmn:DataStoreReference")&&x(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"]):x(e,"bpmn:MessageFlow")?x(t,"bpmn:Collaboration")||e.source.parent==t||e.target.parent==t:!1}function BP(e){return te(e).cancelActivity&&(Jg(e)||ey(e))}function Qg(e){return!Fe(e)&&x(e,"bpmn:BoundaryEvent")}function $P(e){return x(e,"bpmn:Lane")}function jP(e){return Qg(e)||x(e,"bpmn:IntermediateThrowEvent")&&Jg(e)?!0:x(e,"bpmn:IntermediateCatchEvent")&&ey(e)}function Jg(e){var t=te(e);return t&&!(t.eventDefinitions&&t.eventDefinitions.length)}function ey(e){return ty(e,["bpmn:MessageEventDefinition","bpmn:TimerEventDefinition","bpmn:SignalEventDefinition","bpmn:ConditionalEventDefinition"])}function ty(e,t){return t.some(function(n){return _i(e,n)})}function FP(e){return x(e,"bpmn:ReceiveTask")&&lt(e.incoming,function(t){return x(t.source,"bpmn:EventBasedGateway")})}function ga(e,t,n,i){if(Array.isArray(e)||(e=[e]),e.length!==1)return!1;var r=e[0];return Fe(r)||!jP(r)||un(t)||!x(t,"bpmn:Activity")||sc(t)||i&&!Wg(i,t)||FP(t)?!1:"attach"}function ny(e,t,n){if(!t)return!1;var i={replacements:[]};return L(e,function(r){un(t)||x(r,"bpmn:StartEvent")&&r.type!=="label"&&So(r,t)&&(KS(r)||i.replacements.push({oldElementId:r.id,newElementType:"bpmn:StartEvent"}),(XS(r)||ZS(r)||QS(r))&&i.replacements.push({oldElementId:r.id,newElementType:"bpmn:StartEvent"}),ty(r,["bpmn:MessageEventDefinition","bpmn:TimerEventDefinition","bpmn:SignalEventDefinition","bpmn:ConditionalEventDefinition"])&&x(t,"bpmn:SubProcess")&&i.replacements.push({oldElementId:r.id,newElementType:"bpmn:StartEvent"})),x(t,"bpmn:Transaction")||_i(r,"bpmn:CancelEventDefinition")&&r.type!=="label"&&(x(r,"bpmn:EndEvent")&&So(r,t)&&i.replacements.push({oldElementId:r.id,newElementType:"bpmn:EndEvent"}),x(r,"bpmn:BoundaryEvent")&&ga(r,t,null,n)&&i.replacements.push({oldElementId:r.id,newElementType:"bpmn:BoundaryEvent"}))}),i.replacements.length?i:!1}function iy(e,t){return Ui(e,$P)?!1:t===void 0?!0:t===null?!1:e.every(function(n){return So(n,t)})}function Ap(e,t,n,i){return t?Fe(e)||Pp(e)?!0:So(e,t)||uc(e,t):!1}function ry(e,t,n){return x(e,"bpmn:SubProcess")?Ue(e)&&(!t||t.width>=100&&t.height>=80):x(e,"bpmn:Lane")||x(e,"bpmn:Participant")?!0:Cp(e)?n?n==="e"||n==="w":!0:Pp(e)?!0:Fe(e)?n?n==="e"||n==="w":!0:!1}function HP(e,t){var n=Cp(e),i=Cp(t);return(n||i)&&n!==i}function oy(e,t){return Zg(t,e)||Zg(e,t)?!1:HP(e,t)?!0:!!Tp(e,t)}function ay(e,t){return Kg(e,t)&&qg(e)&&x(t,"bpmn:Activity")&&!GP(t,e)&&!un(t)}function sy(e,t){return py(e)&&!py(t)?!1:kP(e)&&OP(t)&&!MP(e,t)}function cy(e,t){return DP(e)&&LP(t)&&Kg(e,t)&&!(x(e,"bpmn:EventBasedGateway")&&!IP(t))}function Tp(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)&&x(e,"bpmn:FlowNode")&&!x(e,"bpmn:BoundaryEvent")&&So(e,t.parent)}function Mp(e,t){return e&&t&&e.indexOf(t)!==-1}function uy(e,t){return Fe(t)?!0:!(x(t,"bpmn:Lane")&&!Mp(e,t.parent)||x(t,"bpmn:MessageFlow")&&!zP(e,t))}function zP(e,t){var n=ly(t.source),i=ly(t.target);return Mp(e,n)&&Mp(e,i)}function ly(e){for(;e;e=e.parent)if(x(e,"bpmn:Participant"))return e;return null}function py(e){return yo(e,"bpmn:Process")||yo(e,"bpmn:Collaboration")}function GP(e,t){return e.attachers.includes(t)}const VP={__depends__:[bi],__init__:["bpmnRules"],bpmnRules:["type",tn]};var WP=2e3;function fy(e,t){e.on("saveXML.start",WP,n);function n(){var i=t.getRootElements();L(i,function(r){var o=Ye(r),a,s;a=Jo([r]),a=Ge(a,function(c){return c!==r&&!c.labelTarget}),s=on(a,Ye),o.set("planeElement",s)})}}fy.$inject=["eventBus","canvas"];const UP={__init__:["bpmnDiOrdering"],bpmnDiOrdering:["type",fy]};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 kp(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||x(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=cd(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}}}kp.$inject=["eventBus","canvas"],de(kp,lc);const qP={__init__:["bpmnOrderingProvider"],bpmnOrderingProvider:["type",kp]};function ya(){}ya.prototype.get=function(){return this._data},ya.prototype.set=function(e){this._data=e},ya.prototype.clear=function(){var e=this._data;return delete this._data,e},ya.prototype.isEmpty=function(){return!this._data};const YP={clipboard:["type",ya]};var dy=1500;function hy(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",dy,function(s){o(s)})}),(function(){var a,s;t.on("element.hover",function(c){a=c.gfx,s=c.element}),t.on("element.hover",dy,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),KP(c)}}hy.$inject=["elementRegistry","eventBus","injector"];function KP(e){return Mr(e,"svg, .djs-element",!0)}const XP={__init__:["hoverFix"],hoverFix:["type",hy]};function ZP(e){return!0}function pc(e){return cr(e)||nP(e)}var my=500;function gy(e,t,n){var i=this;function r(T,N,k){if(!s(T,N)){var O,F,ae;k?F=t.getGraphics(k):(O=N.delegateTarget||N.target,O&&(F=O,k=t.get(F))),!(!F||!k)&&(ae=e.fire(T,{element:k,gfx:F,originalEvent:N}),ae===!1&&(N.stopPropagation(),N.preventDefault()))}}var o={};function a(T){return o[T]}function s(T,N){var k=u[T]||cr;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":ZP,"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(ae){r(k,ae)};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"],my,function(T){var N=T.element,k=T.gfx;e.fire("interactionEvents.updateHit",{element:N,gfx:k})}),e.on("interactionEvents.createHit",my,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"),w=P("djs-hit djs-hit-click-stroke"),y=P("djs-hit djs-hit-all"),_=P("djs-hit djs-hit-no-move"),S={all:y,"click-stroke":w,stroke:m,"no-move":_};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=Qo(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?yl(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}gy.$inject=["eventBus","elementRegistry","styles"];const fc={__init__:["interactionEvents"],interactionEvents:["type",gy]};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 yy="hover",vy="selected";function by(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,yy)}),t.on("element.out",function(r){i(r.element,yy)}),t.on("selection.changed",function(r){function o(u){i(u,vy)}function a(u){n(u,vy)}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)})}by.$inject=["canvas","eventBus"];function _y(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(cr(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)}})}_y.$inject=["eventBus","selection","canvas","elementRegistry"];function QP(e){return!e.hidden}const Vn={__init__:["selectionVisuals","selectionBehavior"],__depends__:[fc],selection:["type",Ro],selectionVisuals:["type",by],selectionBehavior:["type",_y]};var JP=/^djs-cursor-.*$/;function dc(e){var t=yt(document.body);t.removeMatching(JP),e&&t.add("djs-cursor-"+e)}function xy(){dc(null)}var eA=5e3;function wy(e,t){t=t||"element.click";function n(){return!1}return e.once(t,eA,n),function(){e.off(t,n)}}var tA=["c","C"],nA=["v","V"],iA=["d","D"],rA=["x","X"],oA=["y","Y"],Ey=["z","Z"];function aA(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 Op(e){return e.shiftKey}function sA(e){return Tn(e)&&jt(tA,e)}function cA(e){return Tn(e)&&jt(nA,e)}function uA(e){return Tn(e)&&jt(iA,e)}function lA(e){return Tn(e)&&jt(rA,e)}function pA(e){return Tn(e)&&!Op(e)&&jt(Ey,e)}function fA(e){return Tn(e)&&(jt(oA,e)||jt(Ey,e)&&Op(e))}var Co=Math.round,Sy="djs-drag-active";function $r(e){e.preventDefault()}function dA(e){return typeof TouchEvent<"u"&&e instanceof TouchEvent}function hA(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}function Ry(e,t,n,i){var r={threshold:5,trapClick:!0},o;function a(_){var S=t.viewbox(),P=t._container.getBoundingClientRect();return{x:S.x+(_.x-P.left)/S.scale,y:S.y+(_.y-P.top)/S.scale}}function s(_,S){S=S||o;var P=e.createEvent(H({},S.payload,S.data,{isTouch:S.isTouch}));return e.fire("drag."+_,P)===!1?!1:e.fire(S.prefix+"."+_,P)}function c(_){var S=_.filter(function(P){return i.get(P.id)});S.length&&n.select(S)}function u(_,S){var P=o.payload,C=o.displacement,D=o.globalStart,T=Nr(_),N=ni(T,D),k=o.localStart,O=a(T),F=ni(O,k);if(!o.active&&(S||hA(N)>o.threshold)){if(H(P,{x:Co(k.x+C.x),y:Co(k.y+C.y),dx:0,dy:0},{originalEvent:_}),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(),Sy)}pp(_),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:_}),s("move"))}function l(_){var S,P=!0;o.active&&(_&&(o.payload.originalEvent=_,pp(_)),P=s("end")),P===!1&&s("rejected"),S=w(P!==!0),s("ended",S)}function p(_){jt("Escape",_)&&($r(_),m())}function f(_){var S;o.active&&(S=wy(e),setTimeout(S,400),$r(_)),l(_)}function d(_){u(_)}function g(_){var S=o.payload;S.hoverGfx=_.gfx,S.hover=_.element,s("hover")}function h(_){s("out");var S=o.payload;S.hoverGfx=null,S.hover=null}function m(_){var S;if(o){var P=o.active;P&&s("cancel"),S=w(_),P&&s("canceled",S)}}function w(_){var S,P;s("cleanup"),xy(),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(),Sy);var C=o.payload.previousSelection;return _!==!1&&C&&!n.get().length&&c(C),S=o,o=null,S}function y(_,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,_?(T=Eo(_)||_,N=Nr(_),pp(_),T.type==="dragstart"&&$r(T)):(T=null,N={x:0,y:0}),k=a(N),S||(S=k),F=dA(T),o=H({prefix:P,data:D,payload:{},globalStart:N,displacement:ni(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(_,!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(_){H(r,_)}}Ry.$inject=["eventBus","canvas","selection","elementRegistry"];const Ni={__depends__:[XP,Vn],dragging:["type",Ry]};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 mA=new Po("ps");var gA=["marker-start","marker-mid","marker-end"],yA=["circle","ellipse","line","path","polygon","polyline","path","rect"];function ur(e,t,n,i){this._elementRegistry=e,this._canvas=n,this._styles=i}ur.$inject=["elementRegistry","eventBus","canvas","styles"],ur.prototype.cleanUp=function(){console.warn("PreviewSupport#cleanUp is deprecated and will be removed in future versions. You do not need to manually clean up previews anymore. cf. https://github.com/bpmn-io/diagram-js/pull/906")},ur.prototype.getGfx=function(e){return this._elementRegistry.getGraphics(e)},ur.prototype.addDragger=function(e,t,n,i="djs-dragger"){n=n||this.getGfx(e);var r=$h(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},ur.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},ur.prototype._cloneMarkers=function(e,t="djs-dragger",n=e){var i=this;e.childNodes&&e.childNodes.forEach(r=>{i._cloneMarkers(r,t,n)}),xA(e)&&gA.forEach(function(r){if(he(e,r)){var o=vA(e,r,i._canvas.getContainer());o&&i._cloneMarker(n,e,o,r,t)}})},ur.prototype._cloneMarker=function(e,t,n,i,r="djs-dragger"){var o=[n.id,r,mA.next()].join("-"),a=ot("marker#"+n.id,e);e=e||this._canvas._svg;var s=a||$h(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=_A(s.id);he(t,i,u)};function vA(e,t,n){var i=bA(he(e,t));return ot("marker#"+i,n||document)}function bA(e){return e.match(/url\(['"]?#([^'"]*)['"]?\)/)[1]}function _A(e){return"url(#"+e+")"}function xA(e){return yA.indexOf(e.nodeName)!==-1}const Ao={__init__:["previewSupport"],previewSupport:["type",ur]};var wA="drop-ok",Cy="drop-not-ok",Py="attach-ok",Ay="new-parent",Ty="create",EA=2e3;function My(e,t,n,i,r){function o(c,u,l,p,f){if(!u)return!1;c=Ge(c,function(y){var _=y.labelTarget;return!y.parent&&!(Fe(y)&&c.indexOf(_)!==-1)});var d=lt(c,function(y){return!st(y)}),g=!1,h=!1,m=!1;Oy(c)&&(g=r.allowed("shape.attach",{position:l,shape:d,target:u})),g||(Oy(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 w=f.connectionTarget;return m||g?(d&&p&&(h=r.allowed("connection.create",{source:w===p?d:p,target:w===p?p:d,hints:{targetParent:u,targetAttach:g}})),{attach:g,connect:h}):m===null||g===null?null:!1}function a(c,u){[Py,wA,Cy,Ay].forEach(function(l){l===u?e.addMarker(c,l):e.removeMarker(c,l)})}n.on(["create.move","create.hover"],function(c){var u=c.context,l=u.elements,p=c.hover,f=u.source,d=u.hints||{};if(!p){u.canExecute=!1,u.target=null;return}ky(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,Py):a(p,h?Ay:Cy))}),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,w=u.hints||{};if(g===!1||!d)return!1;ky(c);var y={x:c.x,y:c.y};m?p=i.appendShape(l,p,y,d,{attach:h,connection:m===!0?{}:m,connectionTarget:w.connectionTarget}):(f=i.createElements(f,y,d,H({},w,{attach:h})),p=lt(f,function(_){return!st(_)})),H(u,{elements:f,shape:p}),H(c,{elements:f,shape:p})});function s(){var c=t.context();c&&c.prefix===Ty&&t.cancel()}n.on("create.init",function(){n.on("elements.changed",s),n.once(["create.cancel","create.end"],EA,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,Ty,{cursor:"grabbing",autoActivate:!0,data:{shape:p,elements:u,context:l}})}}}My.$inject=["canvas","dragging","eventBus","modeling","rules"];function ky(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 Oy(e){return e&&e.length===1&&!st(e[0])}var SA=750;function Dy(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",SA,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)})}Dy.$inject=["canvas","eventBus","graphicsFactory","previewSupport","styles"];const hc={__depends__:[Ni,Ao,bi,Vn],__init__:["create","createPreview"],create:["type",My],createPreview:["type",Dy]};function Dp(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)})}Dp.$inject=["eventBus"],Dp.prototype.getLastMoveEvent=function(){return this._lastMoveEvent||RA(0,0)};function RA(e,t){var n=document.createEvent("MouseEvent"),i=e,r=t,o=e,a=t;return n.initMouseEvent&&n.initMouseEvent("mousemove",!0,!0,window,0,i,r,o,a,!1,!1,!1,!1,0,null),n}const va={__init__:["mouse"],mouse:["type",Dp]};var Ly=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),CA(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=PA(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",Ly,function(c){var u;((u=c.hints)==null?void 0:u.clip)!==!1&&n.set(c.tree)}),r.on("copyPaste.pasteElements",Ly,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=ai(o,"priority"),L(o,function(s){var c=H({},si(s,["priority"]));i[s.parent]?c.parent=i[s.parent]:delete c.parent,n.fire("copyPaste.pasteElement",{cache:i,descriptor:c});var u;if(st(c)){c.source=i[s.source],c.target=i[s.target],u=i[s.id]=t.createConnection(c),r.push(u);return}if(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(si(e,["id"]));return t},Mn.prototype.createLabel=function(e){var t=this._elementFactory.createLabel(si(e,["id"]));return t},Mn.prototype.createShape=function(e){var t=this._elementFactory.createShape(si(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(w){L(w.labels,function(y){c(y,d)}),c(w,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=ai(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)){Ny(p.element,e),l.delete(p.element);return}if(!s(p.element,e)){Ny(p.element,e),l.delete(p.element);return}i[f]||(i[f]=[]),i[f].push(p.descriptor)}),i};function CA(e){return!!e.host}function PA(e){return on(e.waypoints,function(t){return t=Iy(t),t.original&&(t.original=Iy(t.original)),t})}function Iy(e){return H({},e)}function Ny(e,t){var n=t.indexOf(e);return n===-1?t:t.splice(n,1)}const AA={__depends__:[YP,hc,va,bi],__init__:["copyPaste"],copyPaste:["type",Mn]};function Lp(e,t,n){ke(n)||(n=[n]),L(n,function(i){Rr(e[i])||(t[i]=e[i])})}var Ip=750;function By(e,t,n){function i(c,u){var l=e.create(c.$type);return n.copyElement(c,l,null,u)}t.on("copyPaste.copyElement",Ip,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,Lp(f,u,"name"),Lp(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])),si(l,Sn(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,Lp(l,p,["isExpanded","name"]),l.type=p.$type}),t.on("copyPaste.copyElement",Ip,function(c){var u=c.descriptor,l=c.element;if(x(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;x(u,"bpmn:SubProcess")&&L(oa(l),p=>{l.push(p.annotation)})}),t.on("copyPaste.pasteElement",Ip,function(c){var u=c.cache,l=c.descriptor;a(u,s(l,u,o(u)))})}By.$inject=["bpmnFactory","eventBus","moddleCopy"];const TA=["artifacts","dataInputAssociations","dataOutputAssociations","default","flowElements","lanes","incoming","outgoing","categoryValue"],MA=["errorRef","escalationRef","messageRef","signalRef","dataObjectRef"];function ba(e,t,n){this._bpmnFactory=t,this._eventBus=e,this._moddle=n,e.on("moddleCopy.canCopyProperties",i=>{const{propertyNames:r}=i;if(!(!r||!r.length))return ai(r,o=>o==="extensionElements")}),e.on("moddleCopy.canCopyProperty",i=>{const{parent:r,property:o,propertyName:a}=i,s=Vt(r)&&r.$descriptor;if(a&&MA.includes(a))return o;if(a&&TA.includes(a)||a&&s&&!lt(s.properties,to({name:a})))return!1}),e.on("moddleCopy.canSetCopiedProperty",i=>{const{property:r}=i;if(x(r,"bpmn:ExtensionElements")&&(!r.values||!r.values.length))return!1})}ba.$inject=["eventBus","bpmnFactory","moddle"],ba.prototype.copyElement=function(e,t,n,i=!1){n&&!ke(n)&&(n=[n]),n=n||Np(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;En(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},ba.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)?Sn(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},ba.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 Np(e,t){return Sn(e.properties,(n,i)=>t&&i.default?n:n.concat(i.name),[])}const $y={__depends__:[AA],__init__:["bpmnCopyPaste","moddleCopy"],bpmnCopyPaste:["type",By],moddleCopy:["type",ba]};var jy=Math.round;function Bp(e,t){this._modeling=e,this._eventBus=t}Bp.$inject=["modeling","eventBus"],Bp.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=jy(s+o/2),l=jy(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 Fy(e,t){t.on("replace.end",500,function(n){const{newElement:i,hints:r={}}=n;r.select!==!1&&e.select(i)})}Fy.$inject=["selection","eventBus"];const kA={__init__:["replace","replaceSelectionBehavior"],replaceSelectionBehavior:["type",Fy],replace:["type",Bp]};function OA(e,t,n){ke(n)||(n=[n]),L(n,function(i){Rr(e[i])||(t[i]=e[i])})}var DA=["cancelActivity","instantiate","eventGatewayType","triggeredByEvent","isInterrupting"];function LA(e,t){var n=e&&En(e,"collapsed")?e.collapsed:!Ue(e),i;return t&&(En(t,"collapsed")||En(t,"isExpanded"))?i=En(t,"collapsed")?t.collapsed:!t.isExpanded:i=n,n!==i}function Hy(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")&&LA(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),OA(s.di,d.di,["fill","stroke","background-color","border-color","color"]);var g=Np(p.$descriptor),h=Np(f.$descriptor,!0),m=IA(g,h);H(f,Qn(c,DA));var w=Ge(m,function(S){return S==="eventDefinitions"?zy(s,c.eventDefinitionType):S==="loopCharacteristics"?!un(f):En(f,S)||S==="processRef"&&c.isExpanded===!1||S==="triggeredByEvent"?!1:S==="isForCompensation"?!un(f):!0});if(f=n.copyElement(p,f,w),c.eventDefinitionType&&(zy(f,c.eventDefinitionType)||(d.eventDefinitionType=c.eventDefinitionType,d.eventDefinitionAttrs=c.eventDefinitionAttrs)),x(p,"bpmn:Activity")){if(mc(p))d.isExpanded=Ue(s);else if(c&&En(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)&&!x(p,"bpmn:Task")&&d.isExpanded&&(d.width=s.width,d.height=s.height)}if(mc(p)&&!mc(f)&&(u.moveChildren=!1),x(p,"bpmn:Participant")){c.isExpanded===!0?f.processRef=e.create("bpmn:Process"):u.moveChildren=!1;var _=qt(s);Ye(s).isHorizontal||(Ye(d).isHorizontal=_),d.width=_?s.width:t.getDefaultSize(d).width,d.height=_?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&&!x(p,"bpmn:BoundaryEvent")&&x(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}Hy.$inject=["bpmnFactory","elementFactory","moddleCopy","modeling","replace","rules"];function mc(e){return x(e,"bpmn:SubProcess")}function zy(e,t){var n=te(e);return t&&n.get("eventDefinitions").some(function(i){return x(i,t)})}function IA(e,t){return e.filter(function(n){return t.includes(n)})}const Gy={__depends__:[$y,kA,Vn],bpmnReplace:["type",Hy]};var NA=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,NA,function(r){this._active&&(BA(r)||this.setActive(null))},this)};function BA(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 $A(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 jA(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 FA(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 $p=Math.abs,HA=Math.round,Bi={x:"width",y:"height"},Vy="crosshair",lr={n:"top",w:"left",s:"bottom",e:"right"},zA=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",zA,function(c){var u=c.context,l=u.initialized;l||(l=u.initialized=s.init(c,u)),l&&Uy(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){Uy(c);var h={x:0,y:0};h[l]=HA(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:Vy,data:{context:{reactivate:n}},trapClick:!1})},Wn.prototype.activateMakeSpace=function(e){this._dragging.init(e,"spaceTool",{autoActivate:!0,cursor:Vy,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=$p(e.dx)>$p(e.dy)?"x":"y",i=e["d"+n],r=e[n]-i;if($p(i)<5)return!1;i<0&&(i*=-1),ma(e)&&(i*=-1);var o=$A(n,i),a=this._canvas.getRootElement();!oc(e)&&e.hover&&(a=e.hover);var s=[...Jo(a),...a.attachers||[]],c=this.calculateAdjustments(s,n,i,r),u=this._eventBus.fire("spaceTool.getMinDimensions",{axis:n,direction:o,shapes:c.resizingShapes,start:r}),l=GA(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(VA(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 Wy(e){return{top:e.top-vc,right:e.right+vc,bottom:e.bottom+vc,left:e.left-vc}}function Uy(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 GA(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)}),w=Ge(g,function(F){return!st(F)&&!Fe(F)&&l.has(F)}),y,_,S,P=[],C=[],D,T,N,k;m.length&&(_=Wy(Pe(Tt(m))),y=i-h[lr[n]]+_[lr[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)),w.length&&(S=Wy(Pe(Tt(w))),y=i-S[lr[yc[n]]]+h[lr[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[lr[yc[n]]]-(D[lr[yc[n]]]-i)),C.length&&(N=Pe(Tt(C.map(Oe))),k=N[lr[n]]-(h[lr[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 VA(e){return!!e.host}var jp="djs-dragging",qy="djs-resizing",WA=250,bc=Math.max;function Yy(e,t,n,i,r){function o(a,s){L(a,function(c){r.addDragger(c,s),n.addMarker(c,jp)})}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",WA,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 w=Ce("g");he(w,i.cls("djs-frame-group",["no-events"])),Be(n.getActiveLayer(),w);var y=[];L(p,function(C){var D=r.addFrame(C,w),T=D.getBBox();y.push({element:D,initialBounds:T}),n.addMarker(C,qy)}),s.frameGroup=w,s.frames=y}var _={x:"M"+a.x+", -10000 L"+a.x+", 10000",y:"M -10000, "+a.y+" L 10000, "+a.y};he(c,{d:_[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,jp)}),L(u,function(g){n.removeMarker(g,jp)}),f&&($t(p),$t(f)),L(l,function(g){n.removeMarker(g,qy)}),d&&$t(d)})}Yy.$inject=["eventBus","elementRegistry","canvas","styles","previewSupport"];const UA={__init__:["spaceToolPreview"],__depends__:[Ni,bi,gc,Ao,va],spaceTool:["type",Wn],spaceToolPreview:["type",Yy]};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=>x(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!(x(u,"bpmn:TextAnnotation")||qA(u)&&(t==="y"&&qt(u)||t==="x"&&!qt(u)))}),c};function qA(e){return x(e,"bpmn:Participant")&&!te(e).processRef}const Ky={__depends__:[UA],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:ud("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 YA={commandStack:["type",bt]};function pr(e,t){if(typeof t!="function")throw new Error("removeFn iterator must be a function");if(!e)return[];for(var n;n=e[0];)t(n);return e}var KA=250,Xy=1400;function Fp(e,t,n){J.call(this,t);var i=e.get("movePreview",!1);t.on("shape.move.start",Xy,function(r){var o=r.context,a=o.shapes,s=o.validatedShapes;o.shapes=Zy(a),o.validatedShapes=Zy(s)}),i&&t.on("shape.move.start",KA,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",Xy,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;pr(a.labels,function(s){n.removeShape(s,{nested:!0})})}),this.execute("shape.delete",function(r){var o=r.context,a=o.shape,s=a.labelTarget;s&&(o.labelTargetIndex=bl(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(Fp,J),Fp.$inject=["injector","eventBus","modeling"];function Zy(e){var t=new Set(e);return Ge(e,function(n){return!t.has(n.labelTarget)})}const XA={__init__:["labelSupport"],labelSupport:["type",Fp]};var ZA=251,Qy=1401,Jy="attach-ok";function Hp(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=JA(u)}),o&&t.on("shape.move.start",ZA,function(a){var s=a.context,c=s.shapes,u=zp(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,Jy),t.once(["shape.move.out","shape.move.cleanup"],function(){n.removeMarker(l,Jy)}))}}),this.preExecuted("elements.move",Qy,function(a){var s=a.context,c=s.closure,u=s.shapes,l=zp(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 eT(p)&&!tT(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;pr(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=yg(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=yg(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;pr(s.attachers,function(c){r.removeShape(c)}),s.host&&r.updateAttachment(s,null)})}de(Hp,J),Hp.$inject=["injector","eventBus","canvas","rules","modeling"];function zp(e){return ku(on(e,function(t){return t.attachers||[]}))}function QA(e){var t=zp(e);return $0("id",e,t)}function JA(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 eT(e){return!!e.host}function tT(e,t){return e.indexOf(t)!==-1}const nT={__depends__:[bi],__init__:["attachSupport"],attachSupport:["type",Hp]};function ev(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(Uh(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)})}ev.$inject=["eventBus","canvas","elementRegistry","graphicsFactory"];const Gp={__init__:["changeSupport"],changeSupport:["type",ev]};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;x(e,"bpmn:Activity")?t="Activity":x(e,"bpmn:Event")?t="Event":x(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(w){x(w,"bpmn:BaseElement")&&i.updateParent(w)})}this.executed(["canvas.updateRoot"],s),this.reverted(["canvas.updateRoot"],s);function c(d){var g=d.context.shape;x(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,w=g.newSource,y=te(h),_=te(m),S=te(w);y.conditionExpression&&!ze(S,["bpmn:Activity","bpmn:ExclusiveGateway","bpmn:InclusiveGateway"])&&(g.oldConditionExpression=y.conditionExpression,delete y.conditionExpression),m!==w&&_.default===y&&(g.oldDefault=_.default,delete _.default)})),this.reverted("connection.reconnect",On(function(d){var g=d.context,h=g.connection,m=g.oldSource,w=g.newSource,y=te(h),_=te(m),S=te(w);g.oldConditionExpression&&(y.conditionExpression=g.oldConditionExpression),g.oldDefault&&(_.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),w=m&&m.get("label");rr(g)||ac(g)||(h&&!w?m.set("label",t.create("bpmndi:BPMNLabel")):!h&&w&&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)&&!(x(e,"bpmn:DataStoreReference")&&e.parent&&x(e.parent,"bpmn:Collaboration"))){var n=e.parent,i=e.businessObject,r=Ye(e),o=n&&n.businessObject,a=Ye(n);x(e,"bpmn:FlowNode")&&this.updateFlowNodeRefs(i,o,t&&t.businessObject),x(e,"bpmn:DataOutputAssociation")&&(e.source?o=e.source.businessObject:o=null),x(e,"bpmn:DataInputAssociation")&&(e.target?o=e.target.businessObject:o=null),this.updateSemanticParent(i,o),x(e,"bpmn:DataObjectReference")&&i.dataObjectRef&&this.updateSemanticParent(i.dataObjectRef,o),this.updateDiParent(r,a)}},kn.prototype.updateBounds=function(e){var t=Ye(e),n=rT(e);if(n){var i=ni(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;x(n,"bpmn:Lane")&&(i=n.get("flowNodeRef"),Rt(i,e)),x(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&&!x(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 iT(e){for(;e&&!x(e,"bpmn:Definitions");)e=e.$parent;return e}kn.prototype.getLaneSet=function(e){var t,n;return x(e,"bpmn:Lane")?(t=e.childLaneSet,t||(t=this._bpmnFactory.create("bpmn:LaneSet"),e.childLaneSet=t,t.$parent=e),t):(x(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&&!((x(e,"bpmn:DataInput")||x(e,"bpmn:DataOutput"))&&(x(t,"bpmn:Participant")&&"processRef"in t&&(t=t.processRef),"ioSpecification"in t&&t.ioSpecification===e.$parent))){if(x(e,"bpmn:Lane"))t&&(t=this.getLaneSet(t)),i="lanes";else if(x(e,"bpmn:FlowElement")){if(t){if(x(t,"bpmn:Participant"))t=t.processRef;else if(x(t,"bpmn:Lane"))do t=t.$parent.$parent;while(x(t,"bpmn:Lane"))}i="flowElements"}else if(x(e,"bpmn:Artifact")){for(;t&&!x(t,"bpmn:Process")&&!x(t,"bpmn:SubProcess")&&!x(t,"bpmn:Collaboration");)if(x(t,"bpmn:Participant")){t=t.processRef;break}else t=t.$parent;i="artifacts"}else if(x(e,"bpmn:MessageFlow"))i="messageFlows";else if(x(e,"bpmn:Participant")){i="participants";var r=e.processRef,o;r&&(o=iT(e.$parent||t),e.$parent&&(Rt(o.get("rootElements"),r),r.$parent=null),t&&(Pt(o.get("rootElements"),r),r.$parent=o))}else x(e,"bpmn:DataOutputAssociation")?i="dataOutputAssociations":x(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(x(n,"bpmn:DataAssociation"))x(n,"bpmn:DataInputAssociation")?(n.get("sourceRef")[0]=r,s=e.parent||e.newParent||a,this.updateSemanticParent(n,a,s)):x(n,"bpmn:DataOutputAssociation")&&(s=e.parent||e.newParent||r,this.updateSemanticParent(n,r,s),n.targetRef=a);else{var c=x(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;x(i,"bpmn:BaseElement")&&e(t)}}function rT(e){if(x(e,"bpmn:Activity")){var t=Ye(e);if(t){var n=t.get("label");if(n)return n.get("bounds")}}}function fr(e,t){Oi.call(this),this._bpmnFactory=e,this._moddle=t}de(fr,Oi),fr.$inject=["bpmnFactory","moddle"],fr.prototype._baseCreate=Oi.prototype.create,fr.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)},fr.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(!aT(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)}x(i,"bpmn:Group")&&(t=H({isFrame:!0},t)),t=oT(i,t,["processRef","isInterrupting","associationDirection","isForCompensation"]),t.isExpanded&&(t=Vp(r,t,"isExpanded")),ze(i,["bpmn:Lane","bpmn:Participant"])&&(t=Vp(r,t,"isHorizontal")),x(i,"bpmn:SubProcess")&&(t.collapsed=!Ue(i,r)),x(i,"bpmn:ExclusiveGateway")&&(En(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)},fr.prototype.getDefaultSize=function(e,t){var n=te(e);if(t=t||Ye(e),x(n,"bpmn:SubProcess"))return Ue(n,t)?{width:350,height:200}:{width:100,height:80};if(x(n,"bpmn:Task"))return{width:100,height:80};if(x(n,"bpmn:Gateway"))return{width:50,height:50};if(x(n,"bpmn:Event"))return{width:36,height:36};if(x(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 x(n,"bpmn:Lane")?{width:400,height:100}:x(n,"bpmn:DataObjectReference")?{width:36,height:50}:x(n,"bpmn:DataStoreReference")?{width:50,height:50}:x(n,"bpmn:TextAnnotation")?{width:100,height:40}:x(n,"bpmn:Group")?{width:300,height:300}:{width:100,height:80}},fr.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 oT(e,t,n){return L(n,function(i){t=Vp(e,t,i)}),t}function Vp(e,t,n){return t[n]===void 0?t:(e[n]=t[n],si(t,[n]))}function aT(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||{};sT(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 sT(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 Wp(e){this._modeling=e}Wp.$inject=["modeling"],Wp.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=si(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 tv=Math.round;function dr(e){this._canvas=e}dr.$inject=["canvas"],dr.prototype.execute=function(e){var t=e.shape,n=e.position,i=e.parent,r=e.parentIndex;if(!i)throw new Error("parent required");if(!n)throw new Error("position required");return n.width!==void 0?H(t,n):H(t,{x:n.x-tv(t.width/2),y:n.y-tv(t.height/2)}),this._canvas.addShape(t,i,r),t},dr.prototype.revert=function(e){var t=e.shape;return this._canvas.removeShape(t),t};function _a(e){dr.call(this,e)}de(_a,dr),_a.$inject=["canvas"];var cT=dr.prototype.execute;_a.prototype.execute=function(e){var t=e.shape;return lT(t),t.labelTarget=e.labelTarget,cT.call(this,e)};var uT=dr.prototype.revert;_a.prototype.revert=function(e){return e.shape.labelTarget=null,uT.call(this,e)};function lT(e){["width","height"].forEach(function(t){typeof e[t]>"u"&&(e[t]=0)})}function xa(e,t){this._canvas=e,this._modeling=t}xa.$inject=["canvas","modeling"],xa.prototype.preExecute=function(e){var t=this._modeling,n=e.connection;pr(n.incoming,function(i){t.removeConnection(i,{nested:!0})}),pr(n.outgoing,function(i){t.removeConnection(i,{nested:!0})})},xa.prototype.execute=function(e){var t=e.connection,n=t.parent;return e.parent=n,e.parentIndex=bl(n.children,t),e.source=t.source,e.target=t.target,this._canvas.removeConnection(t),t.source=null,t.target=null,t},xa.prototype.revert=function(e){var t=e.connection,n=e.parent,i=e.parentIndex;return t.source=e.source,t.target=e.target,Pt(n.children,t,i),this._canvas.addConnection(t,n),t};function Up(e,t){this._modeling=e,this._elementRegistry=t}Up.$inject=["modeling","elementRegistry"],Up.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 wa(e,t){this._canvas=e,this._modeling=t}wa.$inject=["canvas","modeling"],wa.prototype.preExecute=function(e){var t=this._modeling,n=e.shape;pr(n.incoming,function(i){t.removeConnection(i,{nested:!0})}),pr(n.outgoing,function(i){t.removeConnection(i,{nested:!0})}),pr(n.children,function(i){st(i)?t.removeConnection(i,{nested:!0}):t.removeShape(i,{nested:!0})})},wa.prototype.execute=function(e){var t=this._canvas,n=e.shape,i=n.parent;return e.oldParent=i,e.oldParentIndex=bl(i.children,n),t.removeShape(n),n},wa.prototype.revert=function(e){var t=this._canvas,n=e.shape,i=e.oldParent,r=e.oldParentIndex;return Pt(i.children,n,r),t.addShape(n,i),n};function Rc(e){this._modeling=e}Rc.$inject=["modeling"];var nv={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,w){m.range.min=Math.min(w[i],m.range.min),m.range.max=Math.max(w[i]+w[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,w){var y={y:0};y[i]=m-a(w),y[i]&&(y[nv[i]]=0,t.moveElements([w],y,w.parent))}var l=n[0],p=s(n),f=n[p],d,g,h=0;L(n,function(m,w){var y,_,S;if(m.elements.length<2){w&&w!==n.length-1&&(o(m,m.elements[0]),h+=c(m.range));return}y=ai(m.elements,i),_=y[0],w===p&&(_=y[s(y)]),S=a(_),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)}),w&&w!==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,w){var y={},_;m===l||m===f||(_=n[w-1],m.range.max=0,L(m.elements,function(S,P){y[nv[i]]=0,y[i]=_.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 qp(){}qp.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},qp.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 Yp(){this.allShapes={},this.allConnections={},this.enclosedElements={},this.enclosedConnections={},this.topLevel={}}Yp.prototype.add=function(e,t){return this.addAll([e],t)},Yp.prototype.addAll=function(e,t){var n=F1(e,!!t,this);return H(this,n),this};function Ea(e){this._modeling=e}Ea.prototype.moveRecursive=function(e,t,n){return e?this.moveClosure(this.getClosure(e),t,n):[]},Ea.prototype.moveClosure=function(e,t,n,i,r){var o=this._modeling,a=e.allShapes,s=e.allConnections,c=e.enclosedConnections,u=e.topLevel,l=!1;r&&r.parent===n&&(l=!0),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&&tp(p,p.source,t),connectionEnd:d&&np(p,p.target,t)})})},Ea.prototype.getClosure=function(e){return new Yp().addAll(e,!0)};function Pc(e){this._helper=new Ea(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 Ea(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:np(o,t,n)})}),L(t.outgoing,function(o){r.layoutConnection(o,{connectionStart:tp(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 Sa(e){this._modeling=e}Sa.$inject=["modeling"],Sa.prototype.execute=function(e){var t=e.newSource,n=e.newTarget,i=e.connection,r=e.dockingOrPoints;if(!t&&!n)throw new Error("newSource or newTarget required");return 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},Sa.prototype.postExecute=function(e){var t=e.connection,n=e.newSource,i=e.newTarget,r=e.dockingOrPoints,o=e.hints||{},a={};o.connectionStart&&(a.connectionStart=o.connectionStart),o.connectionEnd&&(a.connectionEnd=o.connectionEnd),o.layoutConnection!==!1&&(n&&(!i||o.docking==="source")&&(a.connectionStart=a.connectionStart||iv(ke(r)?r[0]:r)),i&&(!n||o.docking==="target")&&(a.connectionEnd=a.connectionEnd||iv(ke(r)?r[r.length-1]:r)),o.newWaypoints&&(a.waypoints=o.newWaypoints),this._modeling.layoutConnection(t,a))},Sa.prototype.revert=function(e){var t=e.oldSource,n=e.oldTarget,i=e.oldWaypoints,r=e.connection;return t&&(r.source=t),n&&(r.target=n),i&&(r.waypoints=i),r};function iv(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 Ra(e){this._modeling=e}Ra.$inject=["modeling"],Ra.prototype.execute=function(e){var t=e.shape,n=e.newBounds,i=e.minBounds;if(n.x===void 0||n.y===void 0||n.width===void 0||n.height===void 0)throw new Error("newBounds must have {x, y, width, height} properties");if(i&&(n.width<i.width||n.height<i.height))throw new Error("width and height cannot be less than minimum height and width");if(!i&&n.width<10||n.height<10)throw new Error("width and height cannot be less than 10px");return e.oldBounds={width:t.width,height:t.height,x:t.x,y:t.y},H(t,{width:n.width,height:n.height,x:n.x,y:n.y}),t},Ra.prototype.postExecute=function(e){var t=this._modeling,n=e.shape,i=e.oldBounds,r=e.hints||{};r.layout!==!1&&(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)})}))},Ra.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 hr(e){this._modeling=e}hr.$inject=["modeling"],hr.prototype.preExecute=function(e){var t=e.delta,n=e.direction,i=e.movingShapes,r=e.resizingShapes,o=e.start,a={};this.moveShapes(i,t),L(r,function(s){a[s.id]=fT(s)}),this.resizeShapes(r,t,n),this.updateConnectionWaypoints(jA(i,r),t,n,o,i,r,a)},hr.prototype.execute=function(){},hr.prototype.revert=function(){},hr.prototype.moveShapes=function(e,t){var n=this;L(e,function(i){n._modeling.moveShape(i,t,null,{autoResize:!1,layout:!1,recurse:!1})})},hr.prototype.resizeShapes=function(e,t,n){var i=this;L(e,function(r){var o=FA(r,n,t);i._modeling.resizeShape(r,o,null,{attachSupport:!1,autoResize:!1,layout:!1})})},hr.prototype.updateConnectionWaypoints=function(e,t,n,i,r,o,a){var s=this,c=new Set(r),u=new Set(o);L(e,function(l){var p=l.source,f=l.target,d=pT(l),g=ov(n),h={},m=c.has(p)||u.has(p),w=c.has(f)||u.has(f);m&&w?(d=on(d,function(y){return av(y,i,n)&&(y[g]=y[g]+t[g]),y.original&&av(y.original,i,n)&&(y.original[g]=y.original[g]+t[g]),y}),s._modeling.updateWaypoints(l,d,{labelBehavior:!1})):(m||w)&&(c.has(p)?h.connectionStart=tp(l,p,t):c.has(f)?h.connectionEnd=np(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 rv(e){return H({},e)}function pT(e){return on(e.waypoints,function(t){return t=rv(t),t.original&&(t.original=rv(t.original)),t})}function ov(e){switch(e){case"n":return"y";case"w":return"x";case"s":return"y";case"e":return"x"}}function av(e,t,n){var i=ov(n);if(/e|s/.test(n))return e[i]>t;if(/n|w/.test(n))return e[i]<t}function fT(e){return{x:e.x,y:e.y,height:e.height,width:e.width}}function Ac(e){this._modeling=e}Ac.$inject=["modeling"],Ac.prototype.execute=function(e){var t=e.shape,n=t.children;e.oldChildrenVisibility=sv(n),t.collapsed=!t.collapsed;var i=cv(n,t.collapsed);return[t].concat(i)},Ac.prototype.revert=function(e){var t=e.shape,n=e.oldChildrenVisibility,i=t.children,r=uv(i,n);return t.collapsed=!t.collapsed,[t].concat(r)};function sv(e){var t={};return L(e,function(n){t[n.id]=n.hidden,n.children&&(t=H({},t,sv(n.children)))}),t}function cv(e,t){var n=[];return L(e,function(i){i.hidden=t,n=n.concat(i),i.children&&(n=n.concat(cv(i.children,i.collapsed||t)))}),n}function uv(e,t){var n=[];return L(e,function(i){i.hidden=t[i.id],n=n.concat(i),i.children&&(n=n.concat(uv(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=lv(i,t),pv(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,lv(n,t),pv(i,t,r),t};function lv(e,t){return Rt(e&&e.attachers,t)}function pv(e,t,n){if(e){var i=e.attachers;i||(e.attachers=i=[]),Pt(i,t,n)}}function Kp(){}Kp.prototype.execute=function(e){var t=e.connection,n=e.newWaypoints;return e.oldWaypoints=t.waypoints,t.waypoints=n,t},Kp.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":dr,"shape.delete":wa,"shape.move":Fr,"shape.resize":Ra,"shape.replace":$i,"shape.toggleCollapse":Ac,spaceTool:hr,"label.create":_a,"connection.create":Ec,"connection.delete":xa,"connection.move":qp,"connection.layout":Cc,"connection.updateWaypoints":Kp,"connection.reconnect":Sa,"elements.create":Wp,"elements.move":Pc,"elements.delete":Up,"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 RS(t)?t:this._elementFactory.create(e,t)},ct.prototype.toggleCollapse=function(e,t){var n={shape:e,hints:t||{}};this._commandStack.execute("shape.toggleCollapse",n)};function Ca(e){this._elementRegistry=e}Ca.$inject=["elementRegistry"],Ca.prototype.execute=function(e){var t=e.element,n=e.moddleElement,i=e.properties;if(!n)throw new Error("<moddleElement> required");var r=e.changed||this._getVisualReferences(n).concat(t),o=e.oldProperties||dT(n,ts(i));return fv(n,i),e.oldProperties=o,e.changed=r,r},Ca.prototype.revert=function(e){var t=e.oldProperties,n=e.moddleElement,i=e.changed;return fv(n,t),i},Ca.prototype._getVisualReferences=function(e){var t=this._elementRegistry;return x(e,"bpmn:DataObject")?hT(e,t):[]};function dT(e,t){return Sn(t,function(n,i){return n[i]=e.get(i),n},{})}function fv(e,t){L(t,function(n,i){e.set(i,n)})}function hT(e,t){return t.filter(function(n){return x(n,"bpmn:DataObjectReference")&&te(n).dataObjectRef===e})}var Pa="default",ji="id",dv="di",mT={width:0,height:0};function Aa(e,t,n,i){this._elementRegistry=e,this._moddle=t,this._modeling=n,this._textRenderer=i}Aa.$inject=["elementRegistry","moddle","modeling","textRenderer"],Aa.prototype.execute=function(e){var t=e.element,n=[t];if(!t)throw new Error("element required");var i=this._elementRegistry,r=this._moddle.ids,o=t.businessObject,a=_T(e.properties),s=e.oldProperties||gT(t,a);return hv(a,o)&&(r.unclaim(o[ji]),i.updateId(t,a[ji]),r.claim(a[ji],o)),Pa in a&&(a[Pa]&&n.push(i.get(a[Pa].id)),o[Pa]&&n.push(i.get(o[Pa].id))),mv(t,a),e.oldProperties=s,e.changed=n,n},Aa.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,mT)}},Aa.prototype.revert=function(e){var t=e.element,n=e.properties,i=e.oldProperties,r=t.businessObject,o=this._elementRegistry,a=this._moddle.ids;return mv(t,i),hv(n,r)&&(a.unclaim(n[ji]),o.updateId(t,i[ji]),a.claim(i[ji],r)),e.changed};function hv(e,t){return ji in e&&e[ji]!==t[ji]}function gT(e,t){var n=ts(t),i=e.businessObject,r=Ye(e);return Sn(n,function(o,a){return a!==dv?o[a]=i.get(a):o[a]=yT(r,ts(t.di)),o},{})}function yT(e,t){return Sn(t,function(n,i){return n[i]=e&&e.get(i),n},{})}function mv(e,t){var n=e.businessObject,i=Ye(e);L(t,function(r,o){o!==dv?n.set(o,r):i&&vT(i,r)})}function vT(e,t){L(t,function(n,i){e.set(i,n)})}var bT=["default"];function _T(e){var t=H({},e);return bT.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 Xp(e,t){this._modeling=e,this._spaceTool=t}Xp.$inject=["modeling","spaceTool"],Xp.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=ar(s),u=qt(i);if(u?r==="left"?r="top":r==="right"&&(r="bottom"):r==="top"?r="left":r==="bottom"&&(r="right"),!c.length){var l=u?{x:i.x+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 w=t.calculateAdjustments(p,m,f,g),y=u?{x:0,y:f}:{x:f,y:0};t.makeSpace(w.movingShapes,w.resizingShapes,y,h,g);var _=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},_,s)};function Zp(e){this._modeling=e}Zp.$inject=["modeling"],Zp.prototype.preExecute=function(e){var t=this._modeling,n=e.shape,i=e.count,r=ar(n),o=r.length;if(o>i)throw new Error(`more than <${i}> child lanes`);var a=qt(n),s=a?n.height:n.width,c=Math.round(s/i),u,l,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 Ta(e,t){this._modeling=e,this._spaceTool=t}Ta.$inject=["modeling","spaceTool"],Ta.prototype.preExecute=function(e){var t=e.shape,n=e.newBounds,i=e.balanced;i!==!1?this.resizeBalanced(t,n):this.resizeSpace(t,n)},Ta.prototype.resizeBalanced=function(e,t){var n=this._modeling,i=hC(e,t);n.resizeShape(e,t),i.forEach(function(r){n.resizeShape(r.shape,r.newBounds)})},Ta.prototype.resizeSpace=function(e,t){var n=this._spaceTool,i=Pe(e),r=Pe(t),o=qm(r,i),a=zn(e),s=[],c=[];Or(a,function(g){return s.push(g),(x(g,"bpmn:Lane")||x(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 Ma="flowNodeRef",Qp="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 x(d,"bpmn:FlowNode")});f.forEach(s),n.push(p)}}),e.forEach(s),o.forEach(function(l){var p=l.businessObject,f=p.get(Qp),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(Ma).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(Qp);n.remove.forEach(function(o){Rt(r,o),Rt(o.get(Ma),i)}),n.add.forEach(function(o){Pt(r,o),Pt(o.get(Ma),i)})}),[]},kc.prototype.revert=function(e){var t=e.updates;return t.forEach(function(n){var i=n.flowNode,r=i.get(Qp);n.add.forEach(function(o){Rt(r,o),Rt(o.get(Ma),i)}),n.remove.forEach(function(o){Pt(r,o),Pt(o.get(Ma),i)})}),[]};var Jp="categoryValueRef";function ka(e,t){this._bpmnFactory=e,this._elementRegistry=t}ka.$inject=["bpmnFactory","elementRegistry"],ka.prototype._computeUpdates=function(e,t){var n=this._elementRegistry,i=this._bpmnFactory,r=new Map,o=[],a=new Map;function s(y,_,S){if(_){var P=a.get(y);P||(P={},a.set(y,P)),!(S&&P.present)&&(!S&&P.past||(S?P.present={categoryValue:_,root:ef(y)}:P.past={categoryValue:_}))}}function c(y){r.set(y,te(y))}function u(){n.filter(function(y){return x(y,"bpmn:FlowElement")&&!Fe(y)&&y.parent}).forEach(c)}function l(y){var _=te(y),S=_.get("categoryValueRef");return S||(S=zm(i,_),o.push(xT(y,S))),S}function p(y){return y.reduce(function(_,S){var P=ef(S),C=_.get(P);return C||(C=[],_.set(P,C)),C.push(S),_},new Map)}e=Array.from(e||[]);var f=p(e);t.length&&u(),e.forEach(c),n.filter(function(y){return x(y,"bpmn:Group")&&!Fe(y)&&y.parent}).forEach(function(y){var _=te(y).get("categoryValueRef");if(!_){var S=ef(y),P=f.get(S)||[],C=uo(P,y),D=Object.keys(C).length>0;D&&(_=l(y))}s(y,_,!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,_){return _.present&&y.add(_.present.categoryValue),_.past&&y.add(_.past.categoryValue),y},new Set),h=new Map,m=p(d);a.forEach(function(y,_){var S=y.present;if(S){var P=m.get(S.root)||[],C=uo(P,_);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 w=d.reduce(function(y,_){var S=r.get(_),P=S.get(Jp),C=new Set(P),D=h.get(_)||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:w,groups:o}},ka.prototype.execute=function(e){var t=e.updates;return t||(t=e.updates=this._computeUpdates(e.affectedFlowElements,e.affectedGroupEntries)),wT(t.groups),ST(t.flowElements),[]},ka.prototype.revert=function(e){var t=e.updates;return RT(t.flowElements),ET(t.groups),[]};function xT(e,t){return{groupShape:e,categoryValue:t,category:t.$parent}}function wT(e){e.forEach(function(t){te(t.groupShape).categoryValueRef=t.categoryValue,t.categoryValue.$parent=t.category})}function ET(e){e.forEach(function(t){te(t.groupShape).categoryValueRef=null})}function ST(e){e.forEach(function(t){var n=t.businessObject,i=n.get(Jp);t.categoryValuesToRemove.forEach(function(r){Rt(i,r)}),t.categoryValuesToAdd.forEach(function(r){Pt(i,r,!0)})})}function RT(e){e.forEach(function(t){var n=t.businessObject,i=n.get(Jp);t.categoryValuesToAdd.forEach(function(r){Rt(i,r)}),t.categoryValuesToRemove.forEach(function(r){Pt(i,r,!0)})})}function ef(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 CT={fill:void 0,stroke:void 0};function tf(e){this._commandStack=e,this._normalizeColor=function(t){if(t){if(wn(t)){var n=PT(t);if(n)return n}throw new Error(`invalid color value: ${t}`)}}}tf.$inject=["commandStack"],tf.prototype.postExecute=function(e){var t=e.elements,n=e.colors||CT,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(AT(a),Fe(o)){if(!s||!x(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 PT(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 AT(e){"border-color"in e&&(e.stroke=e["border-color"]),"background-color"in e&&(e.fill=e["background-color"])}var TT={width:0,height:0};function gv(e,t,n){function i(c,u){var l=c.label||c,p=c.labelTarget||c;return iR(l,u),[l,p]}function r(c){var u=c.element,l=u.businessObject,p=c.newLabel;if(!Fe(u)&&rr(u)&&!Is(u)&&!yv(p)){var f=7,d=Rl(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)&&!x(l,"bpmn:TextAnnotation"))){if(Fe(l)&&yv(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,TT)}}this.preExecute=r,this.execute=o,this.revert=a,this.postExecute=s}gv.$inject=["modeling","textRenderer","bpmnFactory"];function yv(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"]=Ca,e["element.updateProperties"]=Aa,e["canvas.updateRoot"]=Mc,e["lane.add"]=Xp,e["lane.resize"]=Ta,e["lane.split"]=Zp,e["lane.updateRefs"]=kc,e["group.updateRefs"]=ka,e["id.updateClaim"]=Oc,e["element.setColor"]=tf,e["element.updateLabel"]=gv,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 vv(){}vv.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,MT=5,Lc=Math.round,bv=20,kT={"h:h":20,"v:v":20,"h:v":-10,"v:h":-10};function OT(e,t){return!{t:/top/,r:/right/,b:/bottom/,l:/left/,h:/./,v:/./}[t].test(e)}function DT(e,t){return{t:/top/,r:/right/,b:/bottom/,l:/left/,h:/left|right/,v:/top|bottom/}[e].test(t)}function _v(e,t,n){var i=Jt(t,e,MT),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=DT(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=OT(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:nf(e,s,c).concat(s),directions:c,turnNextDirections:f}}function LT(e,t,n){return _v(e,t,n)}function IT(e,t,n){var i=_v(t,e,xv(n));return{waypoints:i.waypoints.slice().reverse(),directions:xv(i.directions),turnNextDirections:i.turnNextDirections}}function NT(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=nf(e.waypoints[e.waypoints.length-1],t.waypoints[0],r);return{waypoints:o,directions:r}}function xv(e){return e.split(":").reverse().join(":")}function BT(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 nf(e,t,n){if(n=n||"h:h",!UT(n))throw new Error("unknown directions: <"+n+">: must be specified as <start>:<end> with start/end in { h,v,t,r,b,l }");if(Ev(n)){var i=LT(e,t,n),r=IT(e,t,n),o=NT(i,r);return[].concat(i.waypoints,o.waypoints,r.waypoints)}return BT(e,t,n)}function $T(e,t,n){var i=nf(e,t,n);return i.unshift(e),i.push(t),Rv(i)}function jT(e,t,n,i,r){var o=r&&r.preferredLayouts||[],a=N0(o,"straight")[0]||"h:h",s=kT[a]||0,c=Jt(e,t,s),u=WT(c,a);n=n||Oe(e),i=i||Oe(t);var l=u.split(":"),p=Sv(n,e,l[0],qT(c)),f=Sv(i,t,l[1],c);return $T(p,f,u)}function FT(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&&zT(e,t,n,i,o),c||(c=o.connectionEnd&&VT(t,e,i,r),c)||(c=o.connectionStart&&GT(e,t,n,r),c)?c:!o.connectionStart&&!o.connectionEnd&&r&&r.length?r:jT(e,t,n,i,o)}function HT(e,t,n){return e>=t&&e<=n}function wv(e,t,n){var i={x:"width",y:"height"};return HT(t[e],n[e],n[e]+n[i[e]])}function zT(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"?wv(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:wv(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 GT(e,t,n,i){return rf(e,t,n,i)}function VT(e,t,n,i){var r=i.slice().reverse();return r=rf(e,t,n,r),r?r.reverse():null}function rf(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&&ta(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(Yh(l[d],p,bv)||Yh(l[d],f,bv))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=rf(e,t,n,u)),c&&Mi(c)?null:c}function WT(e,t){if(Ev(t))return t;switch(e){case"intersect":return"t:t";case"top":case"bottom":return"v:v";case"left":case"right":return"h:h";default:return t}}function UT(e){return e&&/^h|v|t|r|b|l:h|v|t|r|b|l$/.test(e)}function Ev(e){return e&&/t|r|b|l/.test(e)}function qT(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 Sv(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 Rv(e){return e.reduce(function(t,n,i){var r=t[t.length-1],o=e[i+1];return _l(r,o,n,0)||t.push(n),t},[])}var YT=-10,KT=40,XT={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},ZT={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},of={top:"bottom","top-right":"bottom-left","top-left":"bottom-right",right:"left",bottom:"top","bottom-right":"top-left","bottom-left":"top-right",left:"right"},Oa={top:"t",right:"r",bottom:"b",left:"l"};function Ic(e){this._elementRegistry=e}de(Ic,vv),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=Cv(r&&r[0],n)),a||(a=Cv(r&&r[r.length-1],i)),(x(e,"bpmn:Association")||x(e,"bpmn:DataAssociation"))&&r&&!Pv(n,i))return[].concat([o],r.slice(1,-1),[a]);var l=$m(n,s)?XT:ZT;return x(e,"bpmn:MessageFlow")?c=JT(n,i,l):(x(e,"bpmn:SequenceFlow")||Pv(n,i))&&(n===i?c={preferredLayouts:oM(n,e,l)}:x(n,"bpmn:BoundaryEvent")?c={preferredLayouts:aM(n,i,a,l)}:Da(n)||Da(i)?c={preferredLayouts:l.subProcess,preserveDocking:tM(n)}:x(n,"bpmn:Gateway")?c={preferredLayouts:l.fromGateway}:x(i,"bpmn:Gateway")?c={preferredLayouts:l.toGateway}:c={preferredLayouts:l.default}),c&&(c=H(c,t),u=Rv(FT(n,i,o,a,r,c))),u||[o,a]};function QT(e){var t=e.host;return Jt(Oe(e),t,YT)}function JT(e,t,n){return{preferredLayouts:n.messageFlow,preserveDocking:eM(e,t)}}function eM(e,t){return x(t,"bpmn:Participant")?"source":x(e,"bpmn:Participant")?"target":Da(t)?"source":Da(e)||x(t,"bpmn:Event")?"target":x(e,"bpmn:Event")?"source":null}function tM(e){return Da(e)?"target":"source"}function Cv(e,t){return e?e.original||e:Oe(t)}function Pv(e,t){return x(t,"bpmn:Activity")&&x(e,"bpmn:BoundaryEvent")&&t.businessObject.isForCompensation}function Da(e){return x(e,"bpmn:SubProcess")&&Ue(e)}function Hr(e,t){return e===t}function nM(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 Av(e,t){return of[e]===t}function iM(e,t){var n=To(e),i=of[n];return t.indexOf(i)!==-1}function rM(e,t){var n=Mo(e),i=of[n];return t.indexOf(i)!==-1}function Tv(e){return e==="right"||e==="left"}function oM(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 aM(e,t,n,i){var r=Oe(e),o=Oe(t),a=QT(e),s,c,u=Hr(e.host,t),l=nM(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?sM(a,l,e,t,n,i):(s=cM(a,p,l,i.isHorizontal),c=uM(a,p,l,i.isHorizontal),[s+":"+c])}function sM(e,t,n,i,r,o){var a=t?e:o.isHorizontal?Mo(e):To(e),s=Oa[a],c;return t?Tv(e)?c=Mv("y",n,i,r)?"h":o.boundaryLoop.alternateHorizontalSide:c=Mv("x",n,i,r)?"v":o.boundaryLoop.alternateVerticalSide:c=o.boundaryLoop.default,[s+":"+c]}function Mv(e,t,n,i){var r=KT;return!(af(e,i,n,r)||af(e,i,{x:n.x+n.width,y:n.y+n.height},r)||af(e,i,Oe(t),r))}function af(e,t,n,i){return Math.abs(t[e]-n[e])<i}function cM(e,t,n,i){if(n)return Oa[e];var r=Mo(e),o=To(e),a=Mo(t),s=To(t);if(i){if(Hr(r,a)||Av(o,s))return Oa[r]}else if(Hr(o,s)||Av(r,a))return Oa[o];return Oa[i?o:r]}function uM(e,t,n,i){if(n)return Tv(e)?iM(e,t)||Hr(e,t)?"h":"v":rM(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 kv(e){return H({original:e.point.original||e.point},e.actual)}function mr(e,t){this._elementRegistry=e,this._graphicsFactory=t}mr.$inject=["elementRegistry","graphicsFactory"],mr.prototype.getCroppedWaypoints=function(e,t,n){t=t||e.source,n=n||e.target;var i=this.getDockingPoint(e,t,!0),r=this.getDockingPoint(e,n),o=e.waypoints.slice(i.idx+1,r.idx);return o.unshift(kv(i)),o.push(kv(r)),o},mr.prototype.getDockingPoint=function(e,t,n){var i=e.waypoints,r,o,a;return r=n?0:i.length-1,o=i[r],a=this._getIntersection(t,e,n),{point:o,actual:a||o,idx:r}},mr.prototype._getIntersection=function(e,t,n){var i=this._getShapePath(e),r=this._getConnectionPath(t);return na(i,r,n)},mr.prototype._getConnectionPath=function(e){return this._graphicsFactory.getConnectionPath(e)},mr.prototype._getShapePath=function(e){return this._graphicsFactory.getShapePath(e)},mr.prototype._getGfx=function(e){return this._elementRegistry.getGraphics(e)};const sf={__init__:["modeling","bpmnUpdater"],__depends__:[AP,VP,UP,qP,Gy,YA,XA,nT,Vn,Gp,Ky],bpmnFactory:["type",Un],bpmnUpdater:["type",kn],elementFactory:["type",fr],modeling:["type",nn],layouter:["type",Ic],connectionDocking:["type",mr]};var lM=10,Ov=50,pM=250;function cf(e,t,n,i){for(var r;r=fM(e,n,t);)n=i(t,n,r);return n}function uf(e){return function(t,n,i){var r={x:n.x,y:n.y};return["x","y"].forEach(function(o){var a=e[o];if(a){var s=o==="x"?"width":"height",c=a.margin,u=a.minDistance;c<0?r[o]=Math.min(i[o]+c-t[s]/2,n[o]-u+c):r[o]=Math.max(i[o]+i[s]+c+t[s]/2,n[o]+u+c)}}),r}}function fM(e,t,n){var i={x:t.x-n.width/2,y:t.y-n.height/2,width:n.width,height:n.height},r=hM(e);return lt(r,function(o){if(o===n)return!1;var a=Jt(o,i,lM);return a==="intersect"})}function dM(e,t){t||(t={});function n(g){return g.source===e?1:-1}var i=t.defaultDistance||Ov,r=t.direction||"e",o=t.filter,a=t.getWeight||n,s=t.maxDistance||pM,c=t.reference||"start";o||(o=yM);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=Sn(f,function(g,h){var m=h.distance,w=h.weight;return m<0||m>s||(g[String(m)]||(g[String(m)]=0),g[String(m)]+=1*w,(!g.distance||g[g.distance]<g[String(m)])&&(g.distance=m)),g},{});return d.distance||i}function hM(e){var t=lf(e);return e.host&&(t=t.concat(lf(e.host))),e.attachers&&(t=t.concat(e.attachers.reduce(function(n,i){return n.concat(lf(i))},[]))),t}function lf(e){return gM(e).concat(mM(e))}function mM(e){return e.incoming.map(function(t){return t.source})}function gM(e){return e.outgoing.map(function(t){return t.target})}function yM(){return!0}var vM=100;function Dv(e,t,n){e.on("autoPlace",vM,function(i){var r=i.shape,o=i.source;return bM(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}}Dv.$inject=["eventBus","modeling","canvas"];function bM(e,t,n){n||(n={});var i=n.defaultDistance||Ov,r=Oe(e),o=Pe(e);return{x:o.right+i+t.width/2,y:r.y}}function Lv(e,t){e.on("autoPlace.end",500,function(n){t.select(n.shape)})}Lv.$inject=["eventBus","selection"];const _M={__init__:["autoPlaceSelectionBehavior"],autoPlace:["type",Dv],autoPlaceSelectionBehavior:["type",Lv]};function Iv(e,t,n){var i=$m(e,n);if(x(t,"bpmn:TextAnnotation"))return wM(e,t,i);if(ze(t,["bpmn:DataObjectReference","bpmn:DataStoreReference"]))return EM(e,t,i);if(x(t,"bpmn:FlowNode"))return xM(e,t,i)}function xM(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=dM(e,{filter:function(d){return x(d,"bpmn:SequenceFlow")},direction:o.directionHint}),s=30,c=o.minDistance,u=o.baseOrientation;x(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+Nv(u,c,o)}:{x:r.x+Nv(u,c,o),y:i.bottom+a+t.height/2},p={margin:s,minDistance:c},f=n?{y:p}:{x:p};return cf(e,t,l,uf(f))}function Nv(e,t,n){return e.includes(n.start)?-1*t:e.includes(n.end)?t:0}function wM(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 cf(e,t,r,uf(a))}function EM(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 cf(e,t,r,uf(a))}function Bv(e,t){e.on("autoPlace",function(n){var i=n.shape,r=n.source;return Iv(r,i,t)})}Bv.$inject=["eventBus","elementRegistry"];const Nc={__depends__:[_M],__init__:["bpmnAutoPlace"],bpmnAutoPlace:["type",Bv]},$v=[Nm,ca,sf,Nc];function SM(e={}){kd(globalThis,e.dom);const t=document.createElement("div");return document.body.appendChild(t),new fo({container:t,moddleExtensions:e.moddleExtensions??cs,additionalModules:[...$v,...e.additionalModules??[]]})}var RM=new Po("ov"),CM=500;function Kt(e,t,n,i){this._eventBus=t,this._canvas=n,this._elementRegistry=i,this._ids=RM,this._overlayDefaults=H({show:null,scale:!0},e&&e.defaults),this._overlays={},this._overlayContainers=[],this._overlayRoot=PM(n.getContainer()),this._init()}Kt.$inject=["config.overlays","eventBus","canvas","elementRegistry"],Kt.prototype.get=function(e){if(wn(e)&&(e={id:e}),wn(e.element)&&(e.element=this._elementRegistry.get(e.element)),e.element){var t=this._getOverlayContainer(e.element,!0);return t?e.type?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&&(di(i.html),di(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}jv(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}jv(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(",")+")";Fv(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)),wn(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&&yt(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+")"),Fv(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){di(a.html);var s=t._overlayContainers.indexOf(a);s!==-1&&t._overlayContainers.splice(s,1)}}),e.on("element.changed",CM,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&&yt(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 PM(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 jv(e,t,n){dn(e,{left:t+"px",top:n+"px"})}function Bc(e,t){e.style.display=t===!1?"none":""}function Fv(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 pf(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(pf,J),pf.$inject=["canvas","injector"];const AM={__init__:["rootElementsBehavior"],rootElementsBehavior:["type",pf]};function La(e){return CSS.escape(e)}var TM={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"};function Hv(e){return e=""+e,e&&e.replace(/[&<>"']/g,function(t){return TM[t]})}var MM="bjs-breadcrumbs-shown";function zv(e,t,n){var i=ft('<ul class="bjs-breadcrumbs"></ul>'),r=n.getContainer(),o=yt(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=kM(c));var u=a.flatMap(function(p){var f=n.findRoot(vi(p))||n.findRoot(p.id);if(!f&&x(p,"bpmn:Process")){var d=t.find(function(m){var w=te(m);return w&&w.get("processRef")===p});f=d&&n.findRoot(d.id)}if(!f)return[];var g=Hv(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(MM,l),u.forEach(function(p){i.appendChild(p)})}e.on("root.set",function(c){s(c.element)})}zv.$inject=["eventBus","elementRegistry","canvas"];function kM(e){for(var t=te(e),n=[],i=t;i;i=i.$parent)(x(i,"bpmn:SubProcess")||x(i,"bpmn:Process"))&&n.push(i);return n.reverse()}function Gv(e,t){var n=null,i=new OM;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,!(!x(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})}Gv.$inject=["eventBus","canvas"];function OM(){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 Vv={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;x(a,"bpmn:SubProcess")&&!o.isExpanded&&n.push(a),LM(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=DM(e),i={x:n.x-Vv.x,y:n.y-Vv.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=Wv(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 Wv(e){return x(e,"bpmndi:BPMNDiagram")?e:Wv(e.$parent)}function DM(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 LM(e,t){var n=e.$parent;return!(!x(n,"bpmn:SubProcess")||n===t.bpmnElement||ze(e,["bpmn:DataInputAssociation","bpmn:DataOutputAssociation"]))}var jc=250,IM='<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>',NM="bjs-drilldown-empty";function gr(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(gr,J),gr.prototype._updateDrilldownOverlay=function(e){var t=this._canvas;if(e){var n=t.findRoot(e);n&&this._updateOverlayVisibility(n)}},gr.prototype._canDrillDown=function(e){var t=this._canvas;return x(e,"bpmn:SubProcess")&&t.findRoot(vi(e))},gr.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;yt(i.html).toggle(NM,!r)}},gr.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">'+IM+"</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(vi(e)))}),n.add(e,"drilldown",{position:{bottom:-7,right:-8},html:o}),this._updateOverlayVisibility(e)},gr.prototype._removeOverlay=function(e){var t=this._overlays;t.remove({element:e,type:"drilldown"})},gr.$inject=["canvas","eventBus","elementRegistry","overlays","translate"];const BM={__depends__:[$c,Gp,AM],__init__:["drilldownBreadcrumbs","drilldownOverlayBehavior","drilldownCentering","subprocessCompatibility"],drilldownBreadcrumbs:["type",zv],drilldownCentering:["type",Gv],drilldownOverlayBehavior:["type",gr],subprocessCompatibility:["type",zr]};function yr(e){vt.call(this,e)}de(yr,vt),yr.prototype._modules=[Nm,BM,$c,Vn,ca],yr.prototype._moddleExtensions={};var Fc="keyboard.keydown",$M="keyboard.keyup",jM=1e3,Uv="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(Uv));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,$M)},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(Uv)),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=jM),this._eventBus.on(n||Fc,e,t)},hn.prototype.removeListener=function(e,t){this._eventBus.off(t||Fc,e)},hn.prototype.hasModifier=aA,hn.prototype.isCmd=Tn,hn.prototype.isShift=Op,hn.prototype.isKey=jt;var FM=500;function ko(e,t){var n=this;e.on("editorActions.init",FM,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(pA(r))return t.trigger("undo"),!0}),n("redo",function(i){var r=i.keyEvent;if(fA(r))return t.trigger("redo"),!0}),n("copy",function(i){var r=i.keyEvent;if(sA(r))return t.trigger("copy"),!0}),n("paste",function(i){var r=i.keyEvent;if(cA(r))return t.trigger("paste"),!0}),n("duplicate",function(i){var r=i.keyEvent;if(uA(r))return t.trigger("duplicate"),!0}),n("cut",function(i){var r=i.keyEvent;if(lA(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 ff={__init__:["keyboard","keyboardBindings"],keyboard:["type",hn],keyboardBindings:["type",ko]};var HM={moveSpeed:50,moveSpeedAccelerated:200};function qv(e,t,n){var i=this;this._config=H({},HM,e||{}),t.addListener(r);function r(o){var a=o.keyEvent,s=i._config;if(t.isCmd(a)&&t.isKey(["ArrowLeft","Left","ArrowUp","Up","ArrowDown","Down","ArrowRight","Right"],a)){var c=t.isShift(a)?s.moveSpeedAccelerated:s.moveSpeed,u;switch(a.key){case"ArrowLeft":case"Left":u="left";break;case"ArrowUp":case"Up":u="up";break;case"ArrowRight":case"Right":u="right";break;case"ArrowDown":case"Down":u="down";break}return i.moveCanvas({speed:c,direction:u}),!0}}this.moveCanvas=function(o){var a=0,s=0,c=o.speed,u=c/Math.min(Math.sqrt(n.viewbox().scale),1);switch(o.direction){case"left":a=u;break;case"up":s=u;break;case"right":a=-u;break;case"down":s=-u;break}n.scroll({dx:a,dy:s})}}qv.$inject=["config.keyboardMove","keyboard","canvas"];const Yv={__depends__:[ff],__init__:["keyboardMove"],keyboardMove:["type",qv]};var zM=15;function Kv(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=ni(l,c);if(!n.dragging&&GM(p)>zM&&(n.dragging=!0,u===0&&wy(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){Ne.unbind(document,"mousemove",r),Ne.unbind(document,"mouseup",o),n=null,xy()}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}}Kv.$inject=["eventBus","canvas"];function GM(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}const Xv={__init__:["moveCanvas"],moveCanvas:["type",Kv]};function Zv(e,t){var n=Tl(e.min),i=Tl(e.max),r=Math.abs(n)+Math.abs(i);return r/t}function VM(e,t){return Math.max(e.min,Math.min(e.max,t))}var WM=Math.sign||function(e){return e>=0?1:-1},df={min:.2,max:4},Qv=10,UM=.1,qM=.75;function xi(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||qM;var i=this;t.on("canvas.mouseover",function(){i._init(e.enabled!==!1)}),t.on("canvas.mouseout",function(){i._init(!1)})}xi.$inject=["config.zoomScroll","eventBus","canvas"],xi.prototype.scroll=function(t){this._canvas.scroll(t)},xi.prototype.reset=function(){this._canvas.zoom("fit-viewport")},xi.prototype.zoom=function(t,n){var i=Zv(df,Qv*2);this._totalDelta+=t,Math.abs(this._totalDelta)>UM&&(this._zoom(t,n,i),this._totalDelta=0)},xi.prototype._handleWheel=function(t){if(this._enabled){var n=this._container;t.preventDefault();var i=t.ctrlKey||Tg()&&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))*WM(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)}},xi.prototype.stepZoom=function(t,n){var i=Zv(df,Qv);this._zoom(t,n,i)},xi.prototype._zoom=function(e,t,n){var i=this._canvas,r=e>0?1:-1,o=Tl(i.zoom()),a=Math.round(o/n)*n;a+=n*r;var s=Math.pow(10,a);i.zoom(VM(df,s),t)},xi.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},xi.prototype._init=function(e){this.toggle(e)};const Jv={__init__:["zoomScroll"],zoomScroll:["type",xi]};function Ia(e){yr.call(this,e)}de(Ia,yr),Ia.prototype._navigationModules=[Yv,Xv,Jv],Ia.prototype._modules=[].concat(yr.prototype._modules,Ia.prototype._navigationModules);function hf(e){return e&&e[e.length-1]}function eb(e){return e.y}function tb(e){return e.x}var YM={left:tb,center:tb,right:function(e){return e.x+e.width},top:eb,middle:eb,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=hf(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=ai(a,function(f){return f.elements.length>1&&(s=!0),f.elements.length}),s)return o[e]=hf(c).center,o;u=t[0],t=ai(t,function(f){return f[i]+f[r]}),l=hf(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=YM[t],a=ai(r,o),s=this._alignmentPosition(t,a);n.alignElements(a,s)}};const KM={__init__:["alignElements"],alignElements:["type",Oo]},XM=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=XM.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=ZM();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 ZM(){const e={};return e.promise=new Promise((t,n)=>{e.resolve=t,e.reject=n}),e}const QM={scheduler:["type",Do]};var JM="djs-element-hidden",Hc=".entry",e2=1e3,nb=8,t2=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=e2),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)},t2);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="+La(a)+"]",n),c||(c=ft('<div class="group"></div>'),sn(c,"data-group",a),n.appendChild(c)),c.appendChild(s),r.className&&n2(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))}),yt(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()&&r2(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&&Cr(e,function(i){return n.includes(i)}):n===e},kt.prototype.isShown=function(){return this.isOpen()&&yt(this._current.html).has("open")},kt.prototype.show=function(){this.isOpen()&&(yt(this._current.html).add("open"),this._updatePosition(),this._eventBus.fire("contextPad.show",{current:this._current}))},kt.prototype.hide=function(){this.isOpen()&&(yt(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=i2(e),i=n.x*t.scale-t.x*t.scale,r=n.y*t.scale-t.y*t.scale;return{left:i+nb*this._canvas.zoom(),top:r}}var o=this._canvas.getContainer(),a=o.getBoundingClientRect(),s=this._getTargetBounds(e);return{left:s.right-a.left+nb*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,JM)});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 n2(e,t){var n=yt(e);t=ke(t)?t:t.split(/\s+/g),t.forEach(function(i){n.add(i)})}function i2(e){return e.waypoints[e.waypoints.length-1]}function r2(e,t){return e=ke(e)?e:[e],t=ke(t)?t:[t],e.length===t.length&&Cr(e,function(n){return t.includes(n)})}const ib={__depends__:[fc,QM,$c],contextPad:["type",kt]};var zc,_t,rb,vr,ob,ab,sb,mf,Gc,Na,cb,gf,yf,vf,Vc={},Wc=[],o2=/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 bf(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function ub(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??++rb,__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 a2(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),_f(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,yb(i,o,r),t.__e=t.__=null,o.__e!=n&&lb(o)}}function lb(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}),lb(e)}function pb(e){(!e.__d&&(e.__d=!0)&&vr.push(e)&&!Xc.__r++||ob!=_t.debounceRendering)&&((ob=_t.debounceRendering)||ab)(Xc)}function Xc(){try{for(var e,t=1;vr.length;)vr.length>t&&vr.sort(sb),e=vr.shift(),t=vr.length,a2(e)}finally{vr.length=Xc.__r=0}}function fb(e,t,n,i,r,o,a,s,c,u,l){var p,f,d,g,h,m,w=i&&i.__k||Wc,y=t.length;for(c=s2(n,t,w,c,y),p=0;p<y;p++)(d=n.__k[p])!=null&&(f=d.__i!=-1&&w[d.__i]||Vc,d.__i=p,m=_f(e,d,f,r,o,a,s,c,u,l),g=d.__e,d.ref&&f.ref!=d.ref&&(f.ref&&xf(f.ref,null,d),l.push(d.ref,d.__c||g,d)),h==null&&g!=null&&(h=g),4&d.__u?(c=db(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 s2(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=c2(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)),bb(s,s));return i}function db(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=db(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 c2(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 hb(e,t,n){t[0]=="-"?e.setProperty(t,n??""):e[t]=n==null?"":typeof n!="number"||o2.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||hb(e.style,t,"");if(n)for(t in n)i&&n[t]==i[t]||hb(e.style,t,n[t])}else if(t[0]=="o"&&t[1]=="n")o=t!=(t=t.replace(cb,"$1")),a=t.toLowerCase(),t=a in e||t=="onFocusOut"||t=="onFocusIn"?a.slice(2):t.slice(2),e.l||(e.l={}),e.l[t+o]=n,n?i?n[Na]=i[Na]:(n[Na]=gf,e.addEventListener(t,o?vf:yf,o)):e.removeEventListener(t,o?vf:yf,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 mb(e){return function(t){if(this.l){var n=this.l[t.type+e];if(t[Gc]==null)t[Gc]=gf++;else if(t[Gc]<n[Na])return;return n(_t.event?_t.event(t):t)}}}function _f(e,t,n,i,r,o,a,s,c,u){var l,p,f,d,g,h,m,w,y,_,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,_=k.prototype&&k.prototype.render,S=(l=k.contextType)&&i[l.__c],P=l?S?S.props.value:l.__:i,n.__c?w=(f=t.__c=n.__c).__=f.__E:(_?t.__c=f=new k(y,P):(t.__c=f=new Kc(y,P),f.constructor=k,f.render=l2),S&&S.sub(f),f.state||(f.state={}),f.__n=i,d=f.__d=!0,f.__h=[],f._sb=[]),_&&f.__s==null&&(f.__s=f.state),_&&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)_&&k.getDerivedStateFromProps==null&&f.componentWillMount!=null&&f.componentWillMount(),_&&f.componentDidMount!=null&&f.__h.push(f.componentDidMount);else{if(_&&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),_&&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,_)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())),_&&!d&&f.getSnapshotBeforeUpdate!=null&&(m=f.getSnapshotBeforeUpdate(g,h)),T=l!=null&&l.type===Yc&&l.key==null?vb(l.props.children):l,s=fb(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),w&&(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--;)bf(o[N])}else t.__e=n.__e;t.__k==null&&(t.__k=n.__k||[]),O.then||gb(t),_t.__e(O,t,n)}}else o==null&&t.__v==n.__v?(t.__k=n.__k,t.__e=n.__e):s=t.__e=u2(n.__e,t,n,i,r,o,a,c,u);return(l=_t.diffed)&&l(t),128&t.__u?void 0:s}function gb(e){e&&(e.__c&&(e.__c.__e=!0),e.__k&&e.__k.some(gb))}function yb(e,t,n){for(var i=0;i<n.length;i++)xf(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 vb(e){return typeof e!="object"||e==null||e.__b>0?e:Uc(e)?e.map(vb):e.constructor!==void 0?null:Fi({},e)}function u2(e,t,n,i,r,o,a,s,c){var u,l,p,f,d,g,h,m=n.props||Vc,w=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(w);e=document.createElementNS(r,y,w.is&&w),s&&(_t.__m&&_t.__m(t,o),s=!1),o=null}if(y==null)m===w||s&&e.data==w||(e.data=w);else{if(o=y=="textarea"&&w.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 w||u=="value"&&"defaultValue"in w||u=="checked"&&"defaultChecked"in w||Zc(e,u,null,d,r);for(u in w)d=w[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=""),fb(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--;)bf(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 xf(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 bb(e,t,n){var i,r;if(_t.unmount&&_t.unmount(e),(i=e.ref)&&(i.current&&i.current!=e.__e||xf(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]&&bb(i[r],t,n||typeof e.type!="function");n||bf(e.__e),e.__c=e.__=e.__e=void 0}function l2(e,t,n){return this.constructor(e,n)}function _b(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=[],_f(t,e=t.__k=ub(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),yb(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}},rb=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),pb(this))},Kc.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),pb(this))},Kc.prototype.render=Yc,vr=[],ab=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,sb=function(e,t){return e.__v.__b-t.__v.__b},Xc.__r=0,mf=Math.random().toString(8),Gc="__d"+mf,Na="__a"+mf,cb=/(PointerCapture)$|Capture$/i,gf=0,yf=mb(!1),vf=mb(!0);var xb=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,xb(e,s,n,["",null])),i.push(r),s[0]?t[0]|=2:(t[o-2]=0,t[o]=r)):i.push(s)}return i},wb=new Map;function p2(e){var t=wb.get(this);return t||(t=new Map,wb.set(this,t)),(t=xb(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=p2.bind(ub),Lo,Ot,wf,Eb,Ba=0,Sb=[],Ft=_t,Rb=Ft.__b,Cb=Ft.__r,Pb=Ft.diffed,Ab=Ft.__c,Tb=Ft.unmount,Mb=Ft.__;function Qc(e,t){Ft.__h&&Ft.__h(Ot,e,Ba||t),Ba=0;var n=Ot.__H||(Ot.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({}),n.__[e]}function Ef(e){return Ba=1,f2(Ob,e)}function f2(e,t,n){var i=Qc(Lo++,2);if(i.t=e,!i.__c&&(i.__=[Ob(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&&Cf(n.__H,t)&&(n.__=e,n.u=t,Ot.__H.__h.push(n))}function Sf(e,t){var n=Qc(Lo++,4);!Ft.__s&&Cf(n.__H,t)&&(n.__=e,n.u=t,Ot.__h.push(n))}function eu(e){return Ba=5,Hi(function(){return{current:e}},[])}function Hi(e,t){var n=Qc(Lo++,7);return Cf(n.__H,t)&&(n.__=e(),n.__H=t,n.__h=e),n.__}function $a(e,t){return Ba=8,Hi(function(){return e},t)}function d2(){for(var e;e=Sb.shift();){var t=e.__H;if(e.__P&&t)try{t.__h.some(tu),t.__h.some(Rf),t.__h=[]}catch(n){t.__h=[],Ft.__e(n,e.__v)}}}Ft.__b=function(e){Ot=null,Rb&&Rb(e)},Ft.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),Mb&&Mb(e,t)},Ft.__r=function(e){Cb&&Cb(e),Lo=0;var t=(Ot=e.__c).__H;t&&(wf===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(Rf),t.__h=[],Lo=0)),wf=Ot},Ft.diffed=function(e){Pb&&Pb(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(Sb.push(t)!==1&&Eb===Ft.requestAnimationFrame||((Eb=Ft.requestAnimationFrame)||h2)(d2)),t.__H.__.some(function(n){n.u&&(n.__H=n.u,n.u=void 0)})),wf=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.__||Rf(i)})}catch(i){t.some(function(r){r.__h&&(r.__h=[])}),t=[],Ft.__e(i,n.__v)}}),Ab&&Ab(e,t)},Ft.unmount=function(e){Tb&&Tb(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 kb=typeof requestAnimationFrame=="function";function h2(e){var t,n=function(){clearTimeout(i),kb&&cancelAnimationFrame(t),setTimeout(e)},i=setTimeout(n,35);kb&&(t=requestAnimationFrame(n))}function tu(e){var t=Ot,n=e.__c;typeof n=="function"&&(e.__c=void 0,n()),Ot=t}function Rf(e){var t=Ot;e.__c=e.__(),Ot=t}function Cf(e,t){return!e||e.length!==t.length||t.some(function(n,i){return n!==e[i]})}function Ob(e,t){return typeof t=="function"?t(e):t}function m2(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`
10
+ <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="`+p+'" height="'+d+'" viewBox="'+l+" "+f+" "+p+" "+d+'" version="1.1">'+s+a+"</svg>"}catch(i){n=i}if(this._emit("saveSVG.done",{error:n,svg:t}),n)throw n;return{svg:t}},bt.prototype._setDefinitions=function(e){this._definitions=e},bt.prototype.getModules=function(){return this._modules},bt.prototype.clear=function(){this.getDefinitions()&&nr.prototype.clear.call(this)},bt.prototype.destroy=function(){nr.prototype.destroy.call(this),di(this._container)},bt.prototype.on=function(e,t,n,i){return this.get("eventBus").on(e,t,n,i)},bt.prototype.off=function(e,t){this.get("eventBus").off(e,t)},bt.prototype.attachTo=function(e){if(!e)throw new Error("parentNode required");this.detach(),e.get&&e.constructor.prototype.jquery&&(e=e.get(0)),typeof e=="string"&&(e=rt(e)),e.appendChild(this._container),this._emit("attach",{}),this.get("canvas").resized()},bt.prototype.getDefinitions=function(){return this._definitions},bt.prototype.detach=function(){const e=this._container,t=e.parentNode;t&&(this._emit("detach",{}),t.removeChild(e))},bt.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=z(ui(n,["additionalModules"]),{canvas:z({},n.canvas,{container:e}),modules:a});nr.call(this,s),n&&n.container&&this.attachTo(n.container)},bt.prototype._emit=function(e,t){return this.get("eventBus").fire(e,t)},bt.prototype._createContainer=function(e){const t=dt('<div class="bjs-container"></div>');return dn(t,{width:Mm(e.width),height:Mm(e.height),position:e.position}),t},bt.prototype._createModdle=function(e){const t=z({},this._moddleExtensions,e.moddleExtensions);return new Td(t)},bt.prototype._modules=[];function Is(e,t){return e.warnings=t,e}function ZS(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 QS={width:"100%",height:"100%",position:"relative"};function Mm(e){return e+(Le(e)?"px":"")}function JS(e,t){return t&&lt(e.diagrams,function(n){return n.id===t})||null}function eR(e){const n='<a href="http://bpmn.io" target="_blank" class="bjs-powered-by" title="Powered by bpmn.io" >'+Cm+"</a>",i=dt(n);dn(rt("svg",i),Pm),dn(i,Am,{position:"absolute",bottom:"15px",right:"15px",zIndex:"100"}),e.appendChild(i),Be.bind(i,"click",function(r){XS(),r.preventDefault()})}function fo(e){bt.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,bt),fo.prototype._createModdle=function(e){var t=bt.prototype._createModdle.call(this,e);return t.ids=new fi([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 We(e,t){return w(e,"bpmn:CallActivity")?!1:w(e,"bpmn:SubProcess")?(t=t||Ye(e),t&&w(t,"bpmndi:BPMNPlane")?!0:t&&!!t.isExpanded):w(e,"bpmn:Participant")?!!te(e).processRef:!0}function qt(e){if(!(!w(e,"bpmn:Participant")&&!w(e,"bpmn:Lane"))){var t=Ye(e).isHorizontal;return t===void 0?!0:t}}function tR(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 Wi(n,function(i){return w(i,t)})}function nR(e){return ho(e,"bpmn:ErrorEventDefinition")}function iR(e){return ho(e,"bpmn:EscalationEventDefinition")}function rR(e){return ho(e,"bpmn:CompensateEventDefinition")}var Dr={width:90,height:20},km=15;function ir(e){return w(e,"bpmn:Event")||w(e,"bpmn:Gateway")||w(e,"bpmn:DataStoreReference")||w(e,"bpmn:DataObjectReference")||w(e,"bpmn:DataInput")||w(e,"bpmn:DataOutput")||w(e,"bpmn:SequenceFlow")||w(e,"bpmn:MessageFlow")||w(e,"bpmn:Group")}function Bs(e){return je(e.label)}function oR(e){var t=e.length/2-1,n=e[Math.floor(t)],i=e[Math.ceil(t+.01)],r=aR(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-=km:a+=km,{x:a,y:s}}function aR(e){var t=e.length/2-1,n=e[Math.floor(t)],i=e[Math.ceil(t+.01)];return{x:n.x+(i.x-n.x)/2,y:n.y+(i.y-n.y)/2}}function Pl(e){return e.waypoints?oR(e.waypoints):w(e,"bpmn:Group")?{x:e.x+e.width/2,y:e.y+Dr.height/2}:{x:e.x+e.width/2,y:e.y+e.height+Dr.height/2}}function sR(e,t){var n,i,r,o=e.label;return o&&o.bounds?(r=o.bounds,i={width:Math.max(Dr.width,r.width),height:r.height},n={x:r.x+r.width/2,y:r.y+r.height/2}):(n=Pl(t),i=Dr),z({x:n.x-i.width/2,y:n.y-i.height/2},i)}function Om(e){if(w(e,"bpmn:FlowElement")||w(e,"bpmn:Participant")||w(e,"bpmn:Lane")||w(e,"bpmn:SequenceFlow")||w(e,"bpmn:MessageFlow")||w(e,"bpmn:DataInput")||w(e,"bpmn:DataOutput"))return"name";if(w(e,"bpmn:TextAnnotation"))return"text";if(w(e,"bpmn:Group"))return"categoryValueRef"}function cR(e){var t=e.categoryValueRef;return t&&t.value||""}function Fn(e){var t=e.businessObject,n=Om(t);if(n)return n==="categoryValueRef"?cR(t):t[n]||""}function uR(e,t){var n=e.businessObject,i=Om(n);if(i)if(i==="categoryValueRef"){if(!n[i])return e;n[i].value=t}else n[i]=t;return e}function lR(e){return je(e)&&ir(e.labelTarget)}var mo=7;function Dm(e){let t=[];return L(e.incoming,n=>{w(n,"bpmn:Association")&&w(n.source,"bpmn:TextAnnotation")&&t.push({annotation:n.source,association:n})}),L(e.outgoing,n=>{w(n,"bpmn:Association")&&w(n.target,"bpmn:TextAnnotation")&&t.push({annotation:n.target,association:n})}),t}function oa(e){const t=new Map;return L(_l(e),n=>{L(Dm(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 Al="hsl(225, 10%, 15%)",pR="white";function yi(e,t){return Wi(e.eventDefinitions,function(n){return n.$type===t})}function fR(e){return e.$type==="bpmn:IntermediateThrowEvent"||e.$type==="bpmn:EndEvent"}function dR(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||pR}function fe(e,t,n){var i=Ye(e);return n||i.get("color:border-color")||i.get("bioc:stroke")||t||Al}function aa(e,t,n,i){var r=Ye(e),o=r.get("label");return i||o&&o.get("color:color")||t||fe(e,n)}function Lm(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 Mr(r)}function Tl(e,t){var n=e.x,i=e.y,r=e.width,o=e.height,a=[["M",n+t,i],["l",r-t*2,0],["a",t,t,0,0,1,t,t],["l",0,o-t*2],["a",t,t,0,0,1,-t,t],["l",t*2-r,0],["a",t,t,0,0,1,-t,-t],["l",0,t*2-o],["a",t,t,0,0,1,t,-t],["z"]];return Mr(a)}function hR(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 Mr(s)}function mR(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 Mr(o)}function sa(e,t={}){return{width:Wn(e,t),height:An(e,t)}}function Wn(e,t={}){return En(t,"width")?t.width:e.width}function An(e,t={}){return En(t,"height")?t.height:e.height}var gR=new fi,yR=10,Ns=3,vR=1.5,$s=10,bR=4,go=.95,_R=1,xR=.25;function Lr(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:Al,strokeWidth:2,fill:"white"})}function f(M){return n.computeStyle(M,["no-fill"],{strokeLinecap:"round",strokeLinejoin:"round",stroke:Al,strokeWidth:2})}function p(M,E){var{ref:b={x:0,y:0},scale:F=1,element:W,parentGfx:X=r._svg}=E,me=Ce("marker",{id:M,viewBox:"0 0 20 20",refX:b.x,refY:b.y,markerWidth:20*F,markerHeight:20*F,orient:"auto"});Ne(me,W);var Ie=rt(":scope > defs",X);Ie||(Ie=Ce("defs"),Ne(X,Ie)),Ne(Ie,me)}function d(M,E,b,F){var W=gR.nextPrefixed("marker-");return g(M,W,E,b,F),"url(#"+W+")"}function g(M,E,b,F,W){if(b==="sequenceflow-end"){var X=Ce("path",{d:"M 1 5 L 11 10 L 1 15 Z",...l({fill:W,stroke:W,strokeWidth:1})});p(E,{element:X,ref:{x:11,y:10},scale:.5,parentGfx:M})}if(b==="messageflow-start"){var me=Ce("circle",{cx:6,cy:6,r:3.5,...l({fill:F,stroke:W,strokeWidth:1,strokeDasharray:[1e4,1]})});p(E,{element:me,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:F,stroke:W,strokeWidth:1,strokeDasharray:[1e4,1]})});p(E,{element:Ie,ref:{x:8.5,y:5},parentGfx:M})}if(b==="association-start"){var Ze=Ce("path",{d:"M 11 5 L 1 10 L 11 15",...f({fill:"none",stroke:W,strokeWidth:1.5,strokeDasharray:[1e4,1]})});p(E,{element:Ze,ref:{x:1,y:10},scale:.5,parentGfx:M})}if(b==="association-end"){var gt=Ce("path",{d:"M 1 5 L 11 10 L 1 15",...f({fill:"none",stroke:W,strokeWidth:1.5,strokeDasharray:[1e4,1]})});p(E,{element:gt,ref:{x:11,y:10},scale:.5,parentGfx:M})}if(b==="conditional-flow-marker"){var it=Ce("path",{d:"M 0 10 L 8 6 L 16 10 L 8 14 Z",...l({fill:F,stroke:W})});p(E,{element:it,ref:{x:-1,y:10},scale:.5,parentGfx:M})}if(b==="conditional-default-flow-marker"){var Pt=Ce("path",{d:"M 6 4 L 10 16",...l({stroke:W,fill:"none"})});p(E,{element:Pt,ref:{x:0,y:10},scale:.5,parentGfx:M})}}function h(M,E,b,F,W={}){Vt(F)&&(W=F,F=0),F=F||0,W=l(W);var X=E/2,me=b/2,Ie=Ce("circle",{cx:X,cy:me,r:Math.round((E+b)/4-F),...W});return Ne(M,Ie),Ie}function m(M,E,b,F,W,X){Vt(W)&&(X=W,W=0),W=W||0,X=l(X);var me=Ce("rect",{x:W,y:W,width:E-W*2,height:b-W*2,rx:F,ry:F,...X});return Ne(M,me),me}function _(M,E,b,F){var W=E/2,X=b/2,me=[{x:W,y:0},{x:E,y:X},{x:W,y:b},{x:0,y:X}],Ie=me.map(function(gt){return gt.x+","+gt.y}).join(" ");F=l(F);var Ze=Ce("polygon",{...F,points:Ie});return Ne(M,Ze),Ze}function y(M,E,b,F){b=f(b);var W=Qo(E,b,F);return Ne(M,W),W}function x(M,E,b){return y(M,E,b,5)}function S(M,E,b){b=f(b);var F=Ce("path",{...b,d:E});return Ne(M,F),F}function P(M,E,b,F){return S(E,b,z({"data-marker":M},F))}function C(M){return Yt[M]}function D(M){return function(E,b,F){return C(M)(E,b,F)}}var T={"bpmn:MessageEventDefinition":function(M,E,b={},F){var W=i.getScaledPath("EVENT_MESSAGE",{xScaleFactor:.9,yScaleFactor:.9,containerWidth:b.width||E.width,containerHeight:b.height||E.height,position:{mx:.235,my:.315}}),X=F?fe(E,c,b.stroke):Ve(E,s,b.fill),me=F?Ve(E,s,b.fill):fe(E,c,b.stroke),Ie=S(M,W,{fill:X,stroke:me,strokeWidth:1});return Ie},"bpmn:TimerEventDefinition":function(M,E,b={}){var F=b.width||E.width,W=b.height||E.height,X=b.width?1:2,me=h(M,F,W,.2*W,{fill:Ve(E,s,b.fill),stroke:fe(E,c,b.stroke),strokeWidth:X}),Ie=i.getScaledPath("EVENT_TIMER_WH",{xScaleFactor:.75,yScaleFactor:.75,containerWidth:F,containerHeight:W,position:{mx:.5,my:.5}});S(M,Ie,{stroke:fe(E,c,b.stroke),strokeWidth:X});for(var Ze=0;Ze<12;Ze++){var gt=i.getScaledPath("EVENT_TIMER_LINE",{xScaleFactor:.75,yScaleFactor:.75,containerWidth:F,containerHeight:W,position:{mx:.5,my:.5}}),it=F/2,Pt=W/2;S(M,gt,{strokeWidth:1,stroke:fe(E,c,b.stroke),transform:"rotate("+Ze*30+","+Pt+","+it+")"})}return me},"bpmn:EscalationEventDefinition":function(M,E,b={},F){var W=i.getScaledPath("EVENT_ESCALATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:b.width||E.width,containerHeight:b.height||E.height,position:{mx:.5,my:.2}}),X=F?fe(E,c,b.stroke):Ve(E,s,b.fill);return S(M,W,{fill:X,stroke:fe(E,c,b.stroke),strokeWidth:1})},"bpmn:ConditionalEventDefinition":function(M,E,b={}){var F=i.getScaledPath("EVENT_CONDITIONAL",{xScaleFactor:1,yScaleFactor:1,containerWidth:b.width||E.width,containerHeight:b.height||E.height,position:{mx:.5,my:.222}});return S(M,F,{fill:Ve(E,s,b.fill),stroke:fe(E,c,b.stroke),strokeWidth:1})},"bpmn:LinkEventDefinition":function(M,E,b={},F){var W=i.getScaledPath("EVENT_LINK",{xScaleFactor:1,yScaleFactor:1,containerWidth:E.width,containerHeight:E.height,position:{mx:.57,my:.263}}),X=F?fe(E,c,b.stroke):Ve(E,s,b.fill);return S(M,W,{fill:X,stroke:fe(E,c,b.stroke),strokeWidth:1})},"bpmn:ErrorEventDefinition":function(M,E,b={},F){var W=i.getScaledPath("EVENT_ERROR",{xScaleFactor:1.1,yScaleFactor:1.1,containerWidth:b.width||E.width,containerHeight:b.height||E.height,position:{mx:.2,my:.722}}),X=F?fe(E,c,b.stroke):Ve(E,s,b.fill);return S(M,W,{fill:X,stroke:fe(E,c,b.stroke),strokeWidth:1})},"bpmn:CancelEventDefinition":function(M,E,b={},F){var W=i.getScaledPath("EVENT_CANCEL_45",{xScaleFactor:1,yScaleFactor:1,containerWidth:E.width,containerHeight:E.height,position:{mx:.638,my:-.055}}),X=F?fe(E,c,b.stroke):"none",me=S(M,W,{fill:X,stroke:fe(E,c,b.stroke),strokeWidth:1});return Sm(me,45),me},"bpmn:CompensateEventDefinition":function(M,E,b={},F){var W=i.getScaledPath("EVENT_COMPENSATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:b.width||E.width,containerHeight:b.height||E.height,position:{mx:.22,my:.5}}),X=F?fe(E,c,b.stroke):Ve(E,s,b.fill);return S(M,W,{fill:X,stroke:fe(E,c,b.stroke),strokeWidth:1})},"bpmn:SignalEventDefinition":function(M,E,b={},F){var W=i.getScaledPath("EVENT_SIGNAL",{xScaleFactor:.9,yScaleFactor:.9,containerWidth:b.width||E.width,containerHeight:b.height||E.height,position:{mx:.5,my:.2}}),X=F?fe(E,c,b.stroke):Ve(E,s,b.fill);return S(M,W,{strokeWidth:1,fill:X,stroke:fe(E,c,b.stroke)})},"bpmn:MultipleEventDefinition":function(M,E,b={},F){var W=i.getScaledPath("EVENT_MULTIPLE",{xScaleFactor:1.1,yScaleFactor:1.1,containerWidth:b.width||E.width,containerHeight:b.height||E.height,position:{mx:.211,my:.36}}),X=F?fe(E,c,b.stroke):Ve(E,s,b.fill);return S(M,W,{fill:X,stroke:fe(E,c,b.stroke),strokeWidth:1})},"bpmn:ParallelMultipleEventDefinition":function(M,E,b={}){var F=i.getScaledPath("EVENT_PARALLEL_MULTIPLE",{xScaleFactor:1.2,yScaleFactor:1.2,containerWidth:b.width||E.width,containerHeight:b.height||E.height,position:{mx:.458,my:.194}});return S(M,F,{fill:Ve(E,s,b.fill),stroke:fe(E,c,b.stroke),strokeWidth:1})},"bpmn:TerminateEventDefinition":function(M,E,b={}){var F=h(M,E.width,E.height,8,{fill:fe(E,c,b.stroke),stroke:fe(E,c,b.stroke),strokeWidth:4});return F}};function $(M,E,b={},F){var W=te(M),X=fR(W),me=F||M;return W.get("eventDefinitions")&&W.get("eventDefinitions").length>1?W.get("parallelMultiple")?T["bpmn:ParallelMultipleEventDefinition"](E,me,b,X):T["bpmn:MultipleEventDefinition"](E,me,b,X):yi(W,"bpmn:MessageEventDefinition")?T["bpmn:MessageEventDefinition"](E,me,b,X):yi(W,"bpmn:TimerEventDefinition")?T["bpmn:TimerEventDefinition"](E,me,b,X):yi(W,"bpmn:ConditionalEventDefinition")?T["bpmn:ConditionalEventDefinition"](E,me,b,X):yi(W,"bpmn:SignalEventDefinition")?T["bpmn:SignalEventDefinition"](E,me,b,X):yi(W,"bpmn:EscalationEventDefinition")?T["bpmn:EscalationEventDefinition"](E,me,b,X):yi(W,"bpmn:LinkEventDefinition")?T["bpmn:LinkEventDefinition"](E,me,b,X):yi(W,"bpmn:ErrorEventDefinition")?T["bpmn:ErrorEventDefinition"](E,me,b,X):yi(W,"bpmn:CancelEventDefinition")?T["bpmn:CancelEventDefinition"](E,me,b,X):yi(W,"bpmn:CompensateEventDefinition")?T["bpmn:CompensateEventDefinition"](E,me,b,X):yi(W,"bpmn:TerminateEventDefinition")?T["bpmn:TerminateEventDefinition"](E,me,b,X):null}var k={ParticipantMultiplicityMarker:function(M,E,b={}){var F=Wn(E,b),W=An(E,b),X=i.getScaledPath("MARKER_PARALLEL",{xScaleFactor:1,yScaleFactor:1,containerWidth:F,containerHeight:W,position:{mx:(F/2-6)/F,my:(W-15)/W}});P("participant-multiplicity",M,X,{strokeWidth:2,fill:Ve(E,s,b.fill),stroke:fe(E,c,b.stroke)})},SubProcessMarker:function(M,E,b={}){var F=m(M,14,14,0,{strokeWidth:1,fill:Ve(E,s,b.fill),stroke:fe(E,c,b.stroke)});en(F,E.width/2-7.5,E.height-20);var W=i.getScaledPath("MARKER_SUB_PROCESS",{xScaleFactor:1.5,yScaleFactor:1.5,containerWidth:E.width,containerHeight:E.height,position:{mx:(E.width/2-7.5)/E.width,my:(E.height-20)/E.height}});P("sub-process",M,W,{fill:Ve(E,s,b.fill),stroke:fe(E,c,b.stroke)})},ParallelMarker:function(M,E,b){var F=Wn(E,b),W=An(E,b),X=i.getScaledPath("MARKER_PARALLEL",{xScaleFactor:1,yScaleFactor:1,containerWidth:F,containerHeight:W,position:{mx:(F/2+b.parallel)/F,my:(W-20)/W}});P("parallel",M,X,{fill:Ve(E,s,b.fill),stroke:fe(E,c,b.stroke)})},SequentialMarker:function(M,E,b){var F=i.getScaledPath("MARKER_SEQUENTIAL",{xScaleFactor:1,yScaleFactor:1,containerWidth:E.width,containerHeight:E.height,position:{mx:(E.width/2+b.seq)/E.width,my:(E.height-19)/E.height}});P("sequential",M,F,{fill:Ve(E,s,b.fill),stroke:fe(E,c,b.stroke)})},CompensationMarker:function(M,E,b){var F=i.getScaledPath("MARKER_COMPENSATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:E.width,containerHeight:E.height,position:{mx:(E.width/2+b.compensation)/E.width,my:(E.height-13)/E.height}});P("compensation",M,F,{strokeWidth:1,fill:Ve(E,s,b.fill),stroke:fe(E,c,b.stroke)})},LoopMarker:function(M,E,b){var F=Wn(E,b),W=An(E,b),X=i.getScaledPath("MARKER_LOOP",{xScaleFactor:1,yScaleFactor:1,containerWidth:F,containerHeight:W,position:{mx:(F/2+b.loop)/F,my:(W-7)/W}});P("loop",M,X,{strokeWidth:1.5,fill:"none",stroke:fe(E,c,b.stroke),strokeMiterlimit:.5})},AdhocMarker:function(M,E,b){var F=Wn(E,b),W=An(E,b),X=i.getScaledPath("MARKER_ADHOC",{xScaleFactor:1,yScaleFactor:1,containerWidth:F,containerHeight:W,position:{mx:(F/2+b.adhoc)/F,my:(W-15)/W}});P("adhoc",M,X,{strokeWidth:1,fill:fe(E,c,b.stroke),stroke:fe(E,c,b.stroke)})}};function O(M,E,b,F){k[M](E,b,F)}function j(M,E,b=[],F={}){F={fill:F.fill,stroke:F.stroke,width:Wn(E,F),height:An(E,F)};var W=te(E),X=b.includes("SubProcessMarker");X?F={...F,seq:-21,parallel:-22,compensation:-25,loop:-18,adhoc:10}:F={...F,seq:-5,parallel:-6,compensation:-7,loop:0,adhoc:-8},W.get("isForCompensation")&&b.push("CompensationMarker"),w(W,"bpmn:AdHocSubProcess")&&(b.push("AdhocMarker"),X||z(F,{compensation:F.compensation-18}));var me=W.get("loopCharacteristics"),Ie=me&&me.get("isSequential");me&&(z(F,{compensation:F.compensation-18}),b.includes("AdhocMarker")&&z(F,{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&&z(F,{compensation:-8}),L(b,function(Ze){O(Ze,M,E,F)})}function oe(M,E,b={}){b=z({size:{width:100}},b);var F=o.createText(E||"",b);return qe(F).add("djs-label"),Ne(M,F),F}function xe(M,E,b,F={}){var W=te(E),X=sa({x:E.x,y:E.y,width:E.width,height:E.height},F);return oe(M,W.name,{align:b,box:X,padding:7,style:{fill:aa(E,u,c,F.stroke)}})}function Ue(M,E,b={}){var F={width:E.width,height:E.height,x:E.width/2+E.x,y:E.height/2+E.y};return oe(M,Fn(E),{box:F,style:z({},o.getExternalStyle(),{fill:aa(E,u,c,b.stroke)})})}function Y(M,E,b,F={}){var W=qt(b),X=oe(M,E,{box:{height:30,width:W?An(b,F):Wn(b,F)},align:"center-middle",style:{fill:aa(b,u,c,F.stroke)}});if(W){var me=-1*An(b,F);Ds(X,0,-me,270)}}function ue(M,E,b={}){var{width:F,height:W}=sa(E,b);return m(M,F,W,$s,{...b,fill:Ve(E,s,b.fill),fillOpacity:go,stroke:fe(E,c,b.stroke)})}function ve(M,E,b={}){var F=te(E),W=Ve(E,s,b.fill),X=fe(E,c,b.stroke);return(F.get("associationDirection")==="One"||F.get("associationDirection")==="Both")&&(b.markerEnd=d(M,"association-end",W,X)),F.get("associationDirection")==="Both"&&(b.markerStart=d(M,"association-start",W,X)),b=Ke(b,["markerStart","markerEnd"]),x(M,E.waypoints,{...b,stroke:X,strokeDasharray:"0, 5"})}function le(M,E,b={}){var F=Ve(E,s,b.fill),W=fe(E,c,b.stroke),X=i.getScaledPath("DATA_OBJECT_PATH",{xScaleFactor:1,yScaleFactor:1,containerWidth:E.width,containerHeight:E.height,position:{mx:.474,my:.296}}),me=S(M,X,{fill:F,fillOpacity:go,stroke:W}),Ie=te(E);if(dR(Ie)){var Ze=i.getScaledPath("DATA_OBJECT_COLLECTION_PATH",{xScaleFactor:1,yScaleFactor:1,containerWidth:E.width,containerHeight:E.height,position:{mx:.33,my:(E.height-18)/E.height}});S(M,Ze,{strokeWidth:2,fill:F,stroke:W})}return me}function be(M,E,b={}){return h(M,E.width,E.height,{fillOpacity:go,...b,fill:Ve(E,s,b.fill),stroke:fe(E,c,b.stroke)})}function ce(M,E,b={}){return _(M,E.width,E.height,{fill:Ve(E,s,b.fill),fillOpacity:go,stroke:fe(E,c,b.stroke)})}function U(M,E,b={}){var F=m(M,Wn(E,b),An(E,b),0,{fill:Ve(E,s,b.fill),fillOpacity:b.fillOpacity||go,stroke:fe(E,c,b.stroke),strokeWidth:1.5}),W=te(E);if(w(W,"bpmn:Lane")){var X=W.get("name");Y(M,X,E,b)}return F}function q(M,E,b={}){var F=ue(M,E,b),W=We(E);if(un(E)&&(he(F,{strokeDasharray:"0, 5.5",strokeWidth:2.5}),!W)){var X=te(E).flowElements||[],me=X.filter(Ie=>w(Ie,"bpmn:StartEvent"));me.length===1&&K(me[0],M,b,E)}return xe(M,E,W?"center-top":"center-middle",b),W?j(M,E,void 0,b):j(M,E,["SubProcessMarker"],b),F}function K(M,E,b,F){var W=22,X={fill:Ve(F,s,b.fill),stroke:fe(F,c,b.stroke),width:W,height:W},me=te(M).isInterrupting,Ie=me?0:3,Ze=me?1:1.2,gt=20,it=(W-gt)/2,Pt="translate("+it+","+it+")";h(E,gt,gt,{fill:X.fill,stroke:X.stroke,strokeWidth:Ze,strokeDasharray:Ie,transform:Pt}),$(M,E,X,F)}function He(M,E,b={}){var F=ue(M,E,b);return xe(M,E,"center-middle",b),j(M,E,void 0,b),F}var Yt=this.handlers={"bpmn:AdHocSubProcess":function(M,E,b={}){return We(E)?b=Ke(b,["fill","stroke","width","height"]):b=Ke(b,["fill","stroke"]),q(M,E,b)},"bpmn:Association":function(M,E,b={}){return b=Ke(b,["fill","stroke"]),ve(M,E,b)},"bpmn:BoundaryEvent":function(M,E,b={}){var{renderIcon:F=!0}=b;b=Ke(b,["fill","stroke"]);var W=te(E),X=W.get("cancelActivity");b={strokeWidth:1.5,fill:Ve(E,s,b.fill),fillOpacity:_R,stroke:fe(E,c,b.stroke)},X||(b.strokeDasharray="6");var me=be(M,E,b);return h(M,E.width,E.height,Ns,{...b,fill:"none"}),F&&$(E,M,b),me},"bpmn:BusinessRuleTask":function(M,E,b={}){b=Ke(b,["fill","stroke"]);var F=He(M,E,b),W=i.getScaledPath("TASK_TYPE_BUSINESS_RULE_MAIN",{abspos:{x:8,y:8}}),X=S(M,W);he(X,{fill:Ve(E,s,b.fill),stroke:fe(E,c,b.stroke),strokeWidth:1});var me=i.getScaledPath("TASK_TYPE_BUSINESS_RULE_HEADER",{abspos:{x:8,y:8}}),Ie=S(M,me);return he(Ie,{fill:fe(E,c,b.stroke),stroke:fe(E,c,b.stroke),strokeWidth:1}),F},"bpmn:CallActivity":function(M,E,b={}){return b=Ke(b,["fill","stroke"]),q(M,E,{strokeWidth:5,...b})},"bpmn:ComplexGateway":function(M,E,b={}){b=Ke(b,["fill","stroke"]);var F=ce(M,E,b),W=i.getScaledPath("GATEWAY_COMPLEX",{xScaleFactor:.5,yScaleFactor:.5,containerWidth:E.width,containerHeight:E.height,position:{mx:.46,my:.26}});return S(M,W,{fill:fe(E,c,b.stroke),stroke:fe(E,c,b.stroke),strokeWidth:1}),F},"bpmn:DataInput":function(M,E,b={}){b=Ke(b,["fill","stroke"]);var F=i.getRawPath("DATA_ARROW"),W=le(M,E,b);return S(M,F,{fill:"none",stroke:fe(E,c,b.stroke),strokeWidth:1}),W},"bpmn:DataInputAssociation":function(M,E,b={}){return b=Ke(b,["fill","stroke"]),ve(M,E,{...b,markerEnd:d(M,"association-end",Ve(E,s,b.fill),fe(E,c,b.stroke))})},"bpmn:DataObject":function(M,E,b={}){return b=Ke(b,["fill","stroke"]),le(M,E,b)},"bpmn:DataObjectReference":D("bpmn:DataObject"),"bpmn:DataOutput":function(M,E,b={}){b=Ke(b,["fill","stroke"]);var F=i.getRawPath("DATA_ARROW"),W=le(M,E,b);return S(M,F,{strokeWidth:1,fill:fe(E,c,b.stroke),stroke:fe(E,c,b.stroke)}),W},"bpmn:DataOutputAssociation":function(M,E,b={}){return b=Ke(b,["fill","stroke"]),ve(M,E,{...b,markerEnd:d(M,"association-end",Ve(E,s,b.fill),fe(E,c,b.stroke))})},"bpmn:DataStoreReference":function(M,E,b={}){b=Ke(b,["fill","stroke"]);var F=i.getScaledPath("DATA_STORE",{xScaleFactor:1,yScaleFactor:1,containerWidth:E.width,containerHeight:E.height,position:{mx:0,my:.133}});return S(M,F,{fill:Ve(E,s,b.fill),fillOpacity:go,stroke:fe(E,c,b.stroke),strokeWidth:2})},"bpmn:EndEvent":function(M,E,b={}){var{renderIcon:F=!0}=b;b=Ke(b,["fill","stroke"]);var W=be(M,E,{...b,strokeWidth:4});return F&&$(E,M,b),W},"bpmn:EventBasedGateway":function(M,E,b={}){b=Ke(b,["fill","stroke"]);var F=te(E),W=ce(M,E,b);h(M,E.width,E.height,E.height*.2,{fill:Ve(E,"none",b.fill),stroke:fe(E,c,b.stroke),strokeWidth:1});var X=F.get("eventGatewayType"),me=!!F.get("instantiate");function Ie(){var gt=i.getScaledPath("GATEWAY_EVENT_BASED",{xScaleFactor:.18,yScaleFactor:.18,containerWidth:E.width,containerHeight:E.height,position:{mx:.36,my:.44}});S(M,gt,{fill:"none",stroke:fe(E,c,b.stroke),strokeWidth:2})}if(X==="Parallel"){var Ze=i.getScaledPath("GATEWAY_PARALLEL",{xScaleFactor:.4,yScaleFactor:.4,containerWidth:E.width,containerHeight:E.height,position:{mx:.474,my:.296}});S(M,Ze,{fill:"none",stroke:fe(E,c,b.stroke),strokeWidth:1})}else X==="Exclusive"&&(me||h(M,E.width,E.height,E.height*.26,{fill:"none",stroke:fe(E,c,b.stroke),strokeWidth:1}),Ie());return W},"bpmn:ExclusiveGateway":function(M,E,b={}){b=Ke(b,["fill","stroke"]);var F=ce(M,E,b),W=i.getScaledPath("GATEWAY_EXCLUSIVE",{xScaleFactor:.4,yScaleFactor:.4,containerWidth:E.width,containerHeight:E.height,position:{mx:.32,my:.3}}),X=Ye(E);return X.get("isMarkerVisible")&&S(M,W,{fill:fe(E,c,b.stroke),stroke:fe(E,c,b.stroke),strokeWidth:1}),F},"bpmn:Gateway":function(M,E,b={}){return b=Ke(b,["fill","stroke"]),ce(M,E,b)},"bpmn:Group":function(M,E,b={}){return b=Ke(b,["fill","stroke","width","height"]),m(M,E.width,E.height,$s,{stroke:fe(E,c,b.stroke),strokeWidth:1.5,strokeDasharray:"10, 6, 0, 6",fill:"none",pointerEvents:"none",width:Wn(E,b),height:An(E,b)})},"bpmn:InclusiveGateway":function(M,E,b={}){b=Ke(b,["fill","stroke"]);var F=ce(M,E,b);return h(M,E.width,E.height,E.height*.24,{fill:Ve(E,s,b.fill),stroke:fe(E,c,b.stroke),strokeWidth:2.5}),F},"bpmn:IntermediateEvent":function(M,E,b={}){var{renderIcon:F=!0}=b;b=Ke(b,["fill","stroke"]);var W=be(M,E,{...b,strokeWidth:1.5});return h(M,E.width,E.height,Ns,{fill:"none",stroke:fe(E,c,b.stroke),strokeWidth:1.5}),F&&$(E,M,b),W},"bpmn:IntermediateCatchEvent":D("bpmn:IntermediateEvent"),"bpmn:IntermediateThrowEvent":D("bpmn:IntermediateEvent"),"bpmn:Lane":function(M,E,b={}){return b=Ke(b,["fill","stroke","width","height"]),U(M,E,{...b,fillOpacity:xR})},"bpmn:ManualTask":function(M,E,b={}){b=Ke(b,["fill","stroke"]);var F=He(M,E,b),W=i.getScaledPath("TASK_TYPE_MANUAL",{abspos:{x:17,y:15}});return S(M,W,{fill:Ve(E,s,b.fill),stroke:fe(E,c,b.stroke),strokeWidth:.5}),F},"bpmn:MessageFlow":function(M,E,b={}){b=Ke(b,["fill","stroke"]);var F=te(E),W=Ye(E),X=Ve(E,s,b.fill),me=fe(E,c,b.stroke),Ie=x(M,E.waypoints,{markerEnd:d(M,"messageflow-end",X,me),markerStart:d(M,"messageflow-start",X,me),stroke:me,strokeDasharray:"10, 11",strokeWidth:1.5});if(F.get("messageRef")){var Ze=Ie.getPointAtLength(Ie.getTotalLength()/2),gt=i.getScaledPath("MESSAGE_FLOW_MARKER",{abspos:{x:Ze.x,y:Ze.y}}),it={strokeWidth:1};W.get("messageVisibleKind")==="initiating"?(it.fill=X,it.stroke=me):(it.fill=me,it.stroke=X);var Pt=S(M,gt,it),Zt=F.get("messageRef"),mn=Zt.get("name"),ut=oe(M,mn,{align:"center-top",fitBox:!0,style:{fill:me}}),It=Pt.getBBox(),Bt=ut.getBBox(),zo=Ze.x-Bt.width/2,bn=Ze.y+It.height/2+yR;Ds(ut,zo,bn,0)}return Ie},"bpmn:ParallelGateway":function(M,E,b={}){b=Ke(b,["fill","stroke"]);var F=ce(M,E,b),W=i.getScaledPath("GATEWAY_PARALLEL",{xScaleFactor:.6,yScaleFactor:.6,containerWidth:E.width,containerHeight:E.height,position:{mx:.46,my:.2}});return S(M,W,{fill:fe(E,c,b.stroke),stroke:fe(E,c,b.stroke),strokeWidth:1}),F},"bpmn:Participant":function(M,E,b={}){b=Ke(b,["fill","stroke","width","height"]);var F=U(M,E,b),W=We(E),X=qt(E),me=te(E),Ie=me.get("name");if(W){var Ze=X?[{x:30,y:0},{x:30,y:An(E,b)}]:[{x:0,y:30},{x:Wn(E,b),y:30}];y(M,Ze,{stroke:fe(E,c,b.stroke),strokeWidth:vR}),Y(M,Ie,E,b)}else{var gt=sa(E,b);X||(gt.height=Wn(E,b),gt.width=An(E,b));var it=oe(M,Ie,{box:gt,align:"center-middle",style:{fill:aa(E,u,c,b.stroke)}});if(!X){var Pt=-1*An(E,b);Ds(it,0,-Pt,270)}}return me.get("participantMultiplicity")&&O("ParticipantMultiplicityMarker",M,E,b),F},"bpmn:ReceiveTask":function(M,E,b={}){b=Ke(b,["fill","stroke"]);var F=te(E),W=He(M,E,b),X;return F.get("instantiate")?(h(M,28,28,20*.22,{fill:Ve(E,s,b.fill),stroke:fe(E,c,b.stroke),strokeWidth:1}),X=i.getScaledPath("TASK_TYPE_INSTANTIATING_SEND",{abspos:{x:7.77,y:9.52}})):X=i.getScaledPath("TASK_TYPE_SEND",{xScaleFactor:.9,yScaleFactor:.9,containerWidth:21,containerHeight:14,position:{mx:.3,my:.4}}),S(M,X,{fill:Ve(E,s,b.fill),stroke:fe(E,c,b.stroke),strokeWidth:1}),W},"bpmn:ScriptTask":function(M,E,b={}){b=Ke(b,["fill","stroke"]);var F=He(M,E,b),W=i.getScaledPath("TASK_TYPE_SCRIPT",{abspos:{x:15,y:20}});return S(M,W,{fill:Ve(E,s,b.fill),stroke:fe(E,c,b.stroke),strokeWidth:1}),F},"bpmn:SendTask":function(M,E,b={}){b=Ke(b,["fill","stroke"]);var F=He(M,E,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(E,c,b.stroke),stroke:Ve(E,s,b.fill),strokeWidth:1}),F},"bpmn:SequenceFlow":function(M,E,b={}){b=Ke(b,["fill","stroke"]);var F=Ve(E,s,b.fill),W=fe(E,c,b.stroke),X=x(M,E.waypoints,{markerEnd:d(M,"sequenceflow-end",F,W),stroke:W}),me=te(E),{source:Ie}=E;if(Ie){var Ze=te(Ie);me.get("conditionExpression")&&w(Ze,"bpmn:Activity")&&he(X,{markerStart:d(M,"conditional-flow-marker",F,W)}),Ze.get("default")&&(w(Ze,"bpmn:Gateway")||w(Ze,"bpmn:Activity"))&&Ze.get("default")===me&&he(X,{markerStart:d(M,"conditional-default-flow-marker",F,W)})}return X},"bpmn:ServiceTask":function(M,E,b={}){b=Ke(b,["fill","stroke"]);var F=He(M,E,b);h(M,10,10,{fill:Ve(E,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(E,s,b.fill),stroke:fe(E,c,b.stroke),strokeWidth:1}),h(M,10,10,{fill:Ve(E,s,b.fill),stroke:"none",transform:"translate(11, 10)"});var X=i.getScaledPath("TASK_TYPE_SERVICE",{abspos:{x:17,y:22}});return S(M,X,{fill:Ve(E,s,b.fill),stroke:fe(E,c,b.stroke),strokeWidth:1}),F},"bpmn:StartEvent":function(M,E,b={}){var{renderIcon:F=!0}=b;b=Ke(b,["fill","stroke"]);var W=te(E);W.get("isInterrupting")||(b={...b,strokeDasharray:"6"});var X=be(M,E,b);return F&&$(E,M,b),X},"bpmn:SubProcess":function(M,E,b={}){return We(E)?b=Ke(b,["fill","stroke","width","height"]):b=Ke(b,["fill","stroke"]),q(M,E,b)},"bpmn:Task":function(M,E,b={}){return b=Ke(b,["fill","stroke"]),He(M,E,b)},"bpmn:TextAnnotation":function(M,E,b={}){b=Ke(b,["fill","stroke"]);var{width:F,height:W}=sa(E,b),X=m(M,F,W,0,0,{fill:"none",stroke:"none"}),me=i.getScaledPath("TEXT_ANNOTATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:F,containerHeight:W,position:{mx:0,my:0}});S(M,me,{stroke:fe(E,c,b.stroke)});var Ie=te(E),Ze=Ie.get("text")||"";return oe(M,Ze,{align:"left-top",box:sa(E,b),padding:mo,style:{fill:aa(E,u,c,b.stroke)}}),X},"bpmn:Transaction":function(M,E,b={}){We(E)?b=Ke(b,["fill","stroke","width","height"]):b=Ke(b,["fill","stroke"]);var F=q(M,E,{strokeWidth:1.5,...b}),W=n.style(["no-fill","no-events"],{stroke:fe(E,c,b.stroke),strokeWidth:1.5}),X=We(E);return X||(b={}),m(M,Wn(E,b),An(E,b),$s-Ns,Ns,W),F},"bpmn:UserTask":function(M,E,b={}){b=Ke(b,["fill","stroke"]);var F=He(M,E,b),W=15,X=12,me=i.getScaledPath("TASK_TYPE_USER_1",{abspos:{x:W,y:X}});S(M,me,{fill:Ve(E,s,b.fill),stroke:fe(E,c,b.stroke),strokeWidth:.5});var Ie=i.getScaledPath("TASK_TYPE_USER_2",{abspos:{x:W,y:X}});S(M,Ie,{fill:Ve(E,s,b.fill),stroke:fe(E,c,b.stroke),strokeWidth:.5});var Ze=i.getScaledPath("TASK_TYPE_USER_3",{abspos:{x:W,y:X}});return S(M,Ze,{fill:fe(E,c,b.stroke),stroke:fe(E,c,b.stroke),strokeWidth:.5}),F},label:function(M,E,b={}){return Ue(M,E,b)}};this._drawPath=S,this._renderer=C}de(Lr,Ti),Lr.$inject=["config.bpmnRenderer","eventBus","styles","pathMap","canvas","textRenderer"],Lr.prototype.canRender=function(e){return w(e,"bpmn:BaseElement")},Lr.prototype.drawShape=function(e,t,n={}){var{type:i}=t,r=this._renderer(i);return r(e,t,n)},Lr.prototype.drawConnection=function(e,t,n={}){var{type:i}=t,r=this._renderer(i);return r(e,t,n)},Lr.prototype.getShapePath=function(e){return je(e)?Tl(e,bR):w(e,"bpmn:Event")?Lm(e):w(e,"bpmn:Activity")?Tl(e,$s):w(e,"bpmn:Gateway")?hR(e):mR(e)};function Ke(e,t=[]){return t.reduce((n,i)=>(e[i]&&(n[i]=e[i]),n),{})}var wR=0,ER={width:150,height:50};function SR(e){var t=e.split("-");return{horizontal:t[0]||"center",vertical:t[1]||"top"}}function RR(e){return Vt(e)?z({top:0,left:0,right:0,bottom:0},e):{top:e,left:e,right:e,bottom:e}}var Ml=null;function CR(){return Ml||(Ml=document.createElement("canvas").getContext("2d")),Ml}function PR(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(Im(e.fontSize)||"12px"),t.push(e.fontFamily||"sans-serif"),t.join(" ")}function Im(e){if(e!=null)return typeof e=="number"||/^-?\d+(\.\d+)?$/.test(e)?e+"px":e}function AR(e,t){var n=CR();if(!n)return{width:0,height:0};n.font=PR(t),"letterSpacing"in n&&(n.letterSpacing=Im(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 TR(e,t,n){for(var i=e.shift(),r=i,o;;){if(o=AR(r,n),o.width=r?o.width:0,r===" "||r===""||o.width<Math.round(t)||r.length<2)return MR(e,r,i,o);r=OR(r,o.width,t)}}function MR(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 Bm="­";function kR(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===Bm)&&r.pop();break}var a=r[r.length-1];return a&&a===Bm&&(r[r.length-1]="-"),r.join("")}function OR(e,t,n){var i=Math.max(e.length*(n/t),1),r=kR(e,i);return r||(r=e.slice(0,Math.max(Math.round(i-1),1))),r}function Fs(e){this._config=z({},{size:ER,padding:wR,style:{},align:"center-top"},e||{})}Fs.prototype.createText=function(e,t){return this.layoutText(e,t).element},Fs.prototype.getDimensions=function(e,t){return this.layoutText(e,t).dimensions},Fs.prototype.layoutText=function(e,t){for(var n=z({},this._config.size,t.box),i=z({},this._config.style,t.style),r=SR(t.align||this._config.align),o=RR(t.padding!==void 0?t.padding:this._config.padding),a=t.fitBox||!1,s=DR(i),c=e.split(/\u00AD?\r?\n/),u=[],l=n.width-o.left-o.right;c.length;)u.push(TR(c,l,i));r.vertical==="middle"&&(o.top=o.bottom=0);var f=Sn(u,function(m,_,y){return m+(s||_.height)},0)+o.top+o.bottom,p=Sn(u,function(m,_,y){return _.width>m?_.width:m},0),d=o.top;r.vertical==="middle"&&(d+=(n.height-f)/2),d-=(s||u[0].height)/4;var g=Ce("text");he(g,i),L(u,function(m){var _;switch(d+=s||m.height,r.horizontal){case"left":_=o.left;break;case"right":_=(a?p:l)-o.right-m.width;break;default:_=Math.max(((a?p:l)-m.width)/2+o.left,0)}var y=Ce("tspan");he(y,{x:_,y:d}),y.textContent=m.text,Ne(g,y)});var h={width:p,height:f};return{dimensions:h,element:g}};function DR(e){if("fontSize"in e&&"lineHeight"in e)return e.lineHeight*parseInt(e.fontSize,10)}var LR=12,IR=1.2,BR=40;function Nm(e){var t=z({fontFamily:"Arial, sans-serif",fontSize:LR,fontWeight:"normal",lineHeight:IR},e&&e.defaultStyle||{}),n=parseInt(t.fontSize,10)-1,i=z({},t,{fontSize:n},e&&e.externalStyle||{}),r=new Fs({style:t});this.getExternalLabelBounds=function(a,s){var c={width:Math.max(a.width,Dr.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(BR,Math.round(c.height))}},this.getDimensions=function(a,s){return r.getDimensions(a,s||{})};function o(a,s,c){return r.getDimensions(a,z({box:s},c))}this.createText=function(a,s){return r.createText(a,s||{})},this.getDefaultStyle=function(){return t},this.getExternalStyle=function(){return i}}Nm.$inject=["config.textRenderer"];function NR(){this.pathMap={EVENT_MESSAGE:{d:"m {mx},{my} l 0,{e.y1} l {e.x1},0 l 0,-{e.y1} z l {e.x0},{e.y0} l {e.x0},-{e.y0}",height:36,width:36,heightElements:[6,14],widthElements:[10.5,21]},EVENT_SIGNAL:{d:"M {mx},{my} l {e.x0},{e.y0} l -{e.x1},0 Z",height:36,width:36,heightElements:[18],widthElements:[10,20]},EVENT_ESCALATION:{d:"M {mx},{my} l {e.x0},{e.y0} l -{e.x0},-{e.y1} l -{e.x0},{e.y1} Z",height:36,width:36,heightElements:[20,7],widthElements:[8]},EVENT_CONDITIONAL:{d:"M {e.x0},{e.y0} l {e.x1},0 l 0,{e.y2} l -{e.x1},0 Z M {e.x2},{e.y3} l {e.x0},0 M {e.x2},{e.y4} l {e.x0},0 M {e.x2},{e.y5} l {e.x0},0 M {e.x2},{e.y6} l {e.x0},0 M {e.x2},{e.y7} l {e.x0},0 M {e.x2},{e.y8} l {e.x0},0 ",height:36,width:36,heightElements:[8.5,14.5,18,11.5,14.5,17.5,20.5,23.5,26.5],widthElements:[10.5,14.5,12.5]},EVENT_LINK:{d:"m {mx},{my} 0,{e.y0} -{e.x1},0 0,{e.y1} {e.x1},0 0,{e.y0} {e.x0},-{e.y2} -{e.x0},-{e.y2} z",height:36,width:36,heightElements:[4.4375,6.75,7.8125],widthElements:[9.84375,13.5]},EVENT_ERROR:{d:"m {mx},{my} {e.x0},-{e.y0} {e.x1},-{e.y1} {e.x2},{e.y2} {e.x3},-{e.y3} -{e.x4},{e.y4} -{e.x5},-{e.y5} z",height:36,width:36,heightElements:[.023,8.737,8.151,16.564,10.591,8.714],widthElements:[.085,6.672,6.97,4.273,5.337,6.636]},EVENT_CANCEL_45:{d:"m {mx},{my} -{e.x1},0 0,{e.x0} {e.x1},0 0,{e.y1} {e.x0},0 0,-{e.y1} {e.x1},0 0,-{e.y0} -{e.x1},0 0,-{e.y1} -{e.x0},0 z",height:36,width:36,heightElements:[4.75,8.5],widthElements:[4.75,8.5]},EVENT_COMPENSATION:{d:"m {mx},{my} {e.x0},-{e.y0} 0,{e.y1} z m {e.x1},-{e.y2} {e.x2},-{e.y3} 0,{e.y1} -{e.x2},-{e.y3} z",height:36,width:36,heightElements:[6.5,13,.4,6.1],widthElements:[9,9.3,8.7]},EVENT_TIMER_WH:{d:"M {mx},{my} l {e.x0},-{e.y0} m -{e.x0},{e.y0} l {e.x1},{e.y1} ",height:36,width:36,heightElements:[10,2],widthElements:[3,7]},EVENT_TIMER_LINE:{d:"M {mx},{my} m {e.x0},{e.y0} l -{e.x1},{e.y1} ",height:36,width:36,heightElements:[10,3],widthElements:[0,0]},EVENT_MULTIPLE:{d:"m {mx},{my} {e.x1},-{e.y0} {e.x1},{e.y0} -{e.x0},{e.y1} -{e.x2},0 z",height:36,width:36,heightElements:[6.28099,12.56199],widthElements:[3.1405,9.42149,12.56198]},EVENT_PARALLEL_MULTIPLE:{d:"m {mx},{my} {e.x0},0 0,{e.y1} {e.x1},0 0,{e.y0} -{e.x1},0 0,{e.y1} -{e.x0},0 0,-{e.y1} -{e.x1},0 0,-{e.y0} {e.x1},0 z",height:36,width:36,heightElements:[2.56228,7.68683],widthElements:[2.56228,7.68683]},GATEWAY_EXCLUSIVE:{d:"m {mx},{my} {e.x0},{e.y0} {e.x1},{e.y0} {e.x2},0 {e.x4},{e.y2} {e.x4},{e.y1} {e.x2},0 {e.x1},{e.y3} {e.x0},{e.y3} {e.x3},0 {e.x5},{e.y1} {e.x5},{e.y2} {e.x3},0 z",height:17.5,width:17.5,heightElements:[8.5,6.5312,-6.5312,-8.5],widthElements:[6.5,-6.5,3,-3,5,-5]},GATEWAY_PARALLEL:{d:"m {mx},{my} 0,{e.y1} -{e.x1},0 0,{e.y0} {e.x1},0 0,{e.y1} {e.x0},0 0,-{e.y1} {e.x1},0 0,-{e.y0} -{e.x1},0 0,-{e.y1} -{e.x0},0 z",height:30,width:30,heightElements:[5,12.5],widthElements:[5,12.5]},GATEWAY_EVENT_BASED:{d:"m {mx},{my} {e.x0},{e.y0} {e.x0},{e.y1} {e.x1},{e.y2} {e.x2},0 z",height:11,width:11,heightElements:[-6,6,12,-12],widthElements:[9,-3,-12]},GATEWAY_COMPLEX:{d:"m {mx},{my} 0,{e.y0} -{e.x0},-{e.y1} -{e.x1},{e.y2} {e.x0},{e.y1} -{e.x2},0 0,{e.y3} {e.x2},0 -{e.x0},{e.y1} l {e.x1},{e.y2} {e.x0},-{e.y1} 0,{e.y0} {e.x3},0 0,-{e.y0} {e.x0},{e.y1} {e.x1},-{e.y2} -{e.x0},-{e.y1} {e.x2},0 0,-{e.y3} -{e.x2},0 {e.x0},-{e.y1} -{e.x1},-{e.y2} -{e.x0},{e.y1} 0,-{e.y0} -{e.x3},0 z",height:17.125,width:17.125,heightElements:[4.875,3.4375,2.125,3],widthElements:[3.4375,2.125,4.875,3]},DATA_OBJECT_PATH:{d:"m 0,0 {e.x1},0 {e.x0},{e.y0} 0,{e.y1} -{e.x2},0 0,-{e.y2} {e.x1},0 0,{e.y0} {e.x0},0",height:61,width:51,heightElements:[10,50,60],widthElements:[10,40,50,60]},DATA_OBJECT_COLLECTION_PATH:{d:"m{mx},{my} m 3,2 l 0,10 m 3,-10 l 0,10 m 3,-10 l 0,10",height:10,width:10,heightElements:[],widthElements:[]},DATA_ARROW:{d:"m 5,9 9,0 0,-3 5,5 -5,5 0,-3 -9,0 z",height:61,width:51,heightElements:[],widthElements:[]},DATA_STORE:{d:"m {mx},{my} l 0,{e.y2} c {e.x0},{e.y1} {e.x1},{e.y1} {e.x2},0 l 0,-{e.y2} c -{e.x0},-{e.y1} -{e.x1},-{e.y1} -{e.x2},0c {e.x0},{e.y1} {e.x1},{e.y1} {e.x2},0 m -{e.x2},{e.y0}c {e.x0},{e.y1} {e.x1},{e.y1} {e.x2},0m -{e.x2},{e.y0}c {e.x0},{e.y1} {e.x1},{e.y1} {e.x2},0",height:61,width:61,heightElements:[7,10,45],widthElements:[2,58,60]},TEXT_ANNOTATION:{d:"m {mx}, {my} m 10,0 l -10,0 l 0,{e.y0} l 10,0",height:30,width:10,heightElements:[30],widthElements:[10]},MARKER_SUB_PROCESS:{d:"m{mx},{my} m 7,2 l 0,10 m -5,-5 l 10,0",height:10,width:10,heightElements:[],widthElements:[]},MARKER_PARALLEL:{d:"m{mx},{my} m 3,2 l 0,10 m 3,-10 l 0,10 m 3,-10 l 0,10",height:10,width:10,heightElements:[],widthElements:[]},MARKER_SEQUENTIAL:{d:"m{mx},{my} m 0,3 l 10,0 m -10,3 l 10,0 m -10,3 l 10,0",height:10,width:10,heightElements:[],widthElements:[]},MARKER_COMPENSATION:{d:"m {mx},{my} 7,-5 0,10 z m 7.1,-0.3 6.9,-4.7 0,10 -6.9,-4.7 z",height:10,width:21,heightElements:[],widthElements:[]},MARKER_LOOP:{d:"m {mx},{my} c 3.526979,0 6.386161,-2.829858 6.386161,-6.320661 0,-3.490806 -2.859182,-6.320661 -6.386161,-6.320661 -3.526978,0 -6.38616,2.829855 -6.38616,6.320661 0,1.745402 0.714797,3.325567 1.870463,4.469381 0.577834,0.571908 1.265885,1.034728 2.029916,1.35457 l -0.718163,-3.909793 m 0.718163,3.909793 -3.885211,0.802902",height:13.9,width:13.7,heightElements:[],widthElements:[]},MARKER_ADHOC:{d:"m {mx},{my} m 0.84461,2.64411 c 1.05533,-1.23780996 2.64337,-2.07882 4.29653,-1.97997996 2.05163,0.0805 3.85579,1.15803 5.76082,1.79107 1.06385,0.34139996 2.24454,0.1438 3.18759,-0.43767 0.61743,-0.33642 1.2775,-0.64078 1.7542,-1.17511 0,0.56023 0,1.12046 0,1.6807 -0.98706,0.96237996 -2.29792,1.62393996 -3.6918,1.66181996 -1.24459,0.0927 -2.46671,-0.2491 -3.59505,-0.74812 -1.35789,-0.55965 -2.75133,-1.33436996 -4.27027,-1.18121996 -1.37741,0.14601 -2.41842,1.13685996 -3.44288,1.96782996 z",height:4,width:15,heightElements:[],widthElements:[]},TASK_TYPE_SEND:{d:"m {mx},{my} l 0,{e.y1} l {e.x1},0 l 0,-{e.y1} z l {e.x0},{e.y0} l {e.x0},-{e.y0}",height:14,width:21,heightElements:[6,14],widthElements:[10.5,21]},TASK_TYPE_SCRIPT:{d:"m {mx},{my} c 9.966553,-6.27276 -8.000926,-7.91932 2.968968,-14.938 l -8.802728,0 c -10.969894,7.01868 6.997585,8.66524 -2.968967,14.938 z m -7,-12 l 5,0 m -4.5,3 l 4.5,0 m -3,3 l 5,0m -4,3 l 5,0",height:15,width:12.6,heightElements:[6,14],widthElements:[10.5,21]},TASK_TYPE_USER_1:{d:"m {mx},{my} c 0.909,-0.845 1.594,-2.049 1.594,-3.385 0,-2.554 -1.805,-4.62199999 -4.357,-4.62199999 -2.55199998,0 -4.28799998,2.06799999 -4.28799998,4.62199999 0,1.348 0.974,2.562 1.89599998,3.405 -0.52899998,0.187 -5.669,2.097 -5.794,4.7560005 v 6.718 h 17 v -6.718 c 0,-2.2980005 -5.5279996,-4.5950005 -6.0509996,-4.7760005 zm -8,6 l 0,5.5 m 11,0 l 0,-5"},TASK_TYPE_USER_2:{d:"m {mx},{my} m 2.162,1.009 c 0,2.4470005 -2.158,4.4310005 -4.821,4.4310005 -2.66499998,0 -4.822,-1.981 -4.822,-4.4310005 "},TASK_TYPE_USER_3:{d:"m {mx},{my} m -6.9,-3.80 c 0,0 2.25099998,-2.358 4.27399998,-1.177 2.024,1.181 4.221,1.537 4.124,0.965 -0.098,-0.57 -0.117,-3.79099999 -4.191,-4.13599999 -3.57499998,0.001 -4.20799998,3.36699999 -4.20699998,4.34799999 z"},TASK_TYPE_MANUAL:{d:"m {mx},{my} c 0.234,-0.01 5.604,0.008 8.029,0.004 0.808,0 1.271,-0.172 1.417,-0.752 0.227,-0.898 -0.334,-1.314 -1.338,-1.316 -2.467,-0.01 -7.886,-0.004 -8.108,-0.004 -0.014,-0.079 0.016,-0.533 0,-0.61 0.195,-0.042 8.507,0.006 9.616,0.002 0.877,-0.007 1.35,-0.438 1.353,-1.208 0.003,-0.768 -0.479,-1.09 -1.35,-1.091 -2.968,-0.002 -9.619,-0.013 -9.619,-0.013 v -0.591 c 0,0 5.052,-0.016 7.225,-0.016 0.888,-0.002 1.354,-0.416 1.351,-1.193 -0.006,-0.761 -0.492,-1.196 -1.361,-1.196 -3.473,-0.005 -10.86,-0.003 -11.0829995,-0.003 -0.022,-0.047 -0.045,-0.094 -0.069,-0.139 0.3939995,-0.319 2.0409995,-1.626 2.4149995,-2.017 0.469,-0.4870005 0.519,-1.1650005 0.162,-1.6040005 -0.414,-0.511 -0.973,-0.5 -1.48,-0.236 -1.4609995,0.764 -6.5999995,3.6430005 -7.7329995,4.2710005 -0.9,0.499 -1.516,1.253 -1.882,2.19 -0.37000002,0.95 -0.17,2.01 -0.166,2.979 0.004,0.718 -0.27300002,1.345 -0.055,2.063 0.629,2.087 2.425,3.312 4.859,3.318 4.6179995,0.014 9.2379995,-0.139 13.8569995,-0.158 0.755,-0.004 1.171,-0.301 1.182,-1.033 0.012,-0.754 -0.423,-0.969 -1.183,-0.973 -1.778,-0.01 -5.824,-0.004 -6.04,-0.004 10e-4,-0.084 0.003,-0.586 10e-4,-0.67 z"},TASK_TYPE_INSTANTIATING_SEND:{d:"m {mx},{my} l 0,8.4 l 12.6,0 l 0,-8.4 z l 6.3,3.6 l 6.3,-3.6"},TASK_TYPE_SERVICE:{d:"m {mx},{my} v -1.71335 c 0.352326,-0.0705 0.703932,-0.17838 1.047628,-0.32133 0.344416,-0.14465 0.665822,-0.32133 0.966377,-0.52145 l 1.19431,1.18005 1.567487,-1.57688 -1.195028,-1.18014 c 0.403376,-0.61394 0.683079,-1.29908 0.825447,-2.01824 l 1.622133,-0.01 v -2.2196 l -1.636514,0.01 c -0.07333,-0.35153 -0.178319,-0.70024 -0.323564,-1.04372 -0.145244,-0.34406 -0.321407,-0.6644 -0.522735,-0.96217 l 1.131035,-1.13631 -1.583305,-1.56293 -1.129598,1.13589 c -0.614052,-0.40108 -1.302883,-0.68093 -2.022633,-0.82247 l 0.0093,-1.61852 h -2.241173 l 0.0042,1.63124 c -0.353763,0.0736 -0.705369,0.17977 -1.049785,0.32371 -0.344415,0.14437 -0.665102,0.32092 -0.9635006,0.52046 l -1.1698628,-1.15823 -1.5667691,1.5792 1.1684265,1.15669 c -0.4026573,0.61283 -0.68308,1.29797 -0.8247287,2.01713 l -1.6588041,0.003 v 2.22174 l 1.6724648,-0.006 c 0.073327,0.35077 0.1797598,0.70243 0.3242851,1.04472 0.1452428,0.34448 0.3214064,0.6644 0.5227339,0.96066 l -1.1993431,1.19723 1.5840256,1.56011 1.1964668,-1.19348 c 0.6140517,0.40346 1.3028827,0.68232 2.0233517,0.82331 l 7.19e-4,1.69892 h 2.226848 z m 0.221462,-3.9957 c -1.788948,0.7502 -3.8576,-0.0928 -4.6097055,-1.87438 -0.7521065,-1.78321 0.090598,-3.84627 1.8802645,-4.59604 1.78823,-0.74936 3.856881,0.0929 4.608987,1.87437 0.752106,1.78165 -0.0906,3.84612 -1.879546,4.59605 z"},TASK_TYPE_SERVICE_FILL:{d:"m {mx},{my} c -1.788948,0.7502 -3.8576,-0.0928 -4.6097055,-1.87438 -0.7521065,-1.78321 0.090598,-3.84627 1.8802645,-4.59604 1.78823,-0.74936 3.856881,0.0929 4.608987,1.87437 0.752106,1.78165 -0.0906,3.84612 -1.879546,4.59605 z"},TASK_TYPE_BUSINESS_RULE_HEADER:{d:"m {mx},{my} 0,4 20,0 0,-4 z"},TASK_TYPE_BUSINESS_RULE_MAIN:{d:"m {mx},{my} 0,12 20,0 0,-12 zm 0,8 l 20,0 m -13,-4 l 0,8"},MESSAGE_FLOW_MARKER:{d:"m {mx},{my} m -10.5 ,-7 l 0,14 l 21,0 l 0,-14 z l 10.5,6 l 10.5,-6"}},this.getRawPath=function(t){return this.pathMap[t].d},this.getScaledPath=function(t,n){var i=this.pathMap[t],r,o;n.abspos?(r=n.abspos.x,o=n.abspos.y):(r=n.containerWidth*n.position.mx,o=n.containerHeight*n.position.my);var a={};if(n.position){for(var s=n.containerHeight/i.height*n.yScaleFactor,c=n.containerWidth/i.width*n.xScaleFactor,u=0;u<i.heightElements.length;u++)a["y"+u]=i.heightElements[u]*s;for(var l=0;l<i.widthElements.length;l++)a["x"+l]=i.widthElements[l]*c}var f=HR(i.d,{mx:r,my:o,e:a});return f}}var $R=/\{([^{}]+)\}/g,FR=/(?:(?:^|\.)(.+?)(?=\[|\.|$|\()|\[('|")(.+?)\2\])(\(\))?/g;function jR(e,t,n){var i=n;return t.replace(FR,function(r,o,a,s,c){o=o||s,i&&(o in i&&(i=i[o]),typeof i=="function"&&c&&(i=i()))}),i=(i==null||i==n?e:i)+"",i}function HR(e,t){return String(e).replace($R,function(n,i){return jR(n,i,t)})}const zR={__init__:["bpmnRenderer"],bpmnRenderer:["type",Lr],textRenderer:["type",Nm],pathMap:["type",NR]};function GR(e,t){return t=t||{},e.replace(/{([^}]+)}/g,function(n,i){return t[i]||"{"+i+"}"})}const ca={translate:["value",GR]};function js(e,t,n){return z({id:e.id,type:e.$type,businessObject:e,di:t},n)}function VR(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 $m(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(w(t,"bpmndi:BPMNPlane")){var a=w(e,"bpmn:SubProcess")?{id:e.id+"_plane"}:{};i=this._elementFactory.createRoot(js(e,t,a)),this._canvas.addRootElement(i)}else if(w(t,"bpmndi:BPMNShape")){var s=!We(e,t),c=UR(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})),w(e,"bpmn:BoundaryEvent")&&this._attachBoundary(e,i),w(e,"bpmn:Lane")&&(o=0),w(e,"bpmn:DataStoreReference")&&(WR(n,Oe(u))||(n=this._canvas.findRoot(n))),this._canvas.addShape(i,n,o)}else if(w(t,"bpmndi:BPMNEdge")){var l=this._getSource(e),f=this._getTarget(e);r=n&&(n.hidden||n.collapsed),i=this._elementFactory.createConnection(js(e,t,{hidden:r,source:l,target:f,waypoints:VR(t,l,f)})),w(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)&&Fn(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 $m(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=sR(t,n),r=Fn(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||!Fn(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?$m(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 WR(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 UR(e){return w(e,"bpmn:Group")}const Fm={__depends__:[zR,{__depends__:[ca],bpmnImporter:["type",Di]}]};function ua(e){return{x:e.x+e.width/2,y:e.y+e.height/2}}function oi(e,t){return{x:e.x-t.x,y:e.y-t.y}}function kl(e){return Math.log(e)/Math.log(10)}var qR=1e3;function J(e){this._eventBus=e}J.$inject=["eventBus"];function YR(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=qR),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?YR(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 Ol=["top","bottom","left","right"],Hs=10;function Dl(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(Bs(r)&&!at(r)){var o=ZR(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-Hs-s.height/2};break;case"left":l={x:u.left-Hs-s.width/2,y:a.y};break;case"bottom":l={x:a.x,y:u.bottom+Hs+s.height/2};break;case"right":l={x:u.right+Hs+s.width/2,y:a.y};break}var f=oi(l,c);t.moveShape(s,f)}}}de(Dl,J),Dl.$inject=["eventBus","modeling"];function KR(e){var t=e.host,n=Oe(e),i=Jt(n,t),r;i.indexOf("-")>=0?r=i.split("-"):r=[i];var o=Ol.filter(function(a){return r.indexOf(a)===-1});return o}function XR(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 jm(t,i)});return n}function ZR(e){var t=Oe(e.label),n=Oe(e),i=jm(n,t);if(QR(i)){var r=XR(e);if(e.host){var o=KR(e);r=r.concat(o)}var a=Ol.filter(function(s){return r.indexOf(s)===-1});return a.indexOf(i)!==-1?Jt(e.label,e)!=="intersect"?void 0:i:a[0]}}function jm(e,t){return Jt(t,e,5)}function QR(e){return Ol.indexOf(e)!==-1}function Ll(e){J.call(this,e),this.preExecute("shape.append",function(t){var n=t.source,i=t.shape;t.position||(w(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(Ll,J),Ll.$inject=["eventBus"];var JR=1500;function Il(e,t,n){e.invoke(J,this),this.preExecute("elements.delete",JR,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=>w(u,"bpmn:Participant")||w(u,"bpmn:SubProcess"));if(!o.length)return[];var a=n.getRootElement(),s=new Set(a.children.filter(u=>w(u,"bpmn:Artifact"))),c=new Set;return L(o,u=>{const l=new Set(Qr(uo(Array.from(s),Tt(u))));c=c.union(l),s=s.difference(l)}),Array.from(c)}}de(Il,J),Il.$inject=["injector","eventBus","canvas"];function Bl(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 w(a,"bpmn:Association")});L(o,function(a){t.moveConnection(a,{x:0,y:0},i)})},!0)}de(Bl,J),Bl.$inject=["injector","modeling"];function yo(e,t){for(wn(t)&&(t=[t]);e=e.parent;)if(ze(e,t))return e;return null}function Hm(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&&!w(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 zm=500;function zs(e,t){t.invoke(J,this),this._bpmnReplace=e;var n=this;this.postExecuted("elements.create",zm,function(i){var r=i.elements;r=r.filter(function(o){var a=o.host;return Gm(o,a)}),r.length===1&&r.map(function(o){return r.indexOf(o)}).forEach(function(o){var a=r[o];i.elements[o]=n._replaceShape(r[o],a)})},!0),this.preExecute("elements.move",zm,function(i){var r=i.shapes,o=i.newHost;if(r.length===1){var a=r[0];Gm(a,o)&&(i.shapes=[n._replaceShape(a,o)])}},!0)}zs.$inject=["bpmnReplace","injector"],de(zs,J),zs.prototype._replaceShape=function(e,t){var n=eC(e),i={type:"bpmn:BoundaryEvent",host:t};return n&&(i.eventDefinitionType=n.$type),this._bpmnReplace.replaceElement(e,i,{layoutConnection:!1})};function eC(e){var t=te(e),n=t.eventDefinitions;return n&&n[0]}function Gm(e,t){return!je(e)&&ze(e,["bpmn:IntermediateThrowEvent","bpmn:IntermediateCatchEvent"])&&!!t}function Nl(e,t){J.call(this,e);function n(i){return Ge(i.attachers,function(r){return w(r,"bpmn:BoundaryEvent")})}this.postExecute("connection.create",function(i){var r=i.context.source,o=i.context.target,a=n(o);w(r,"bpmn:EventBasedGateway")&&w(o,"bpmn:ReceiveTask")&&a.length>0&&t.removeElements(a)}),this.postExecute("connection.reconnect",function(i){var r=i.context.oldSource,o=i.context.newSource;w(r,"bpmn:Gateway")&&w(o,"bpmn:EventBasedGateway")&&L(o.outgoing,function(a){var s=a.target,c=n(s);w(s,"bpmn:ReceiveTask")&&c.length>0&&t.removeElements(c)})})}Nl.$inject=["eventBus","modeling"],de(Nl,J);function Vm(e){return e.create("bpmn:Category")}function tC(e){return e.create("bpmn:CategoryValue")}function Wm(e,t){var n=t.get("categoryValueRef");return n||(n=t.categoryValueRef=tC(e)),n.$parent||(n.$parent=Vm(e)),n}function nC(e,t,n){return Ct(t.get("categoryValue"),e),e.$parent=t,Ct(n.get("rootElements"),t),t.$parent=n,e}function iC(e){var t=e.$parent;return t&&(St(t.get("categoryValue"),e),e.$parent=null),e}function rC(e){var t=e.$parent;return t&&(St(t.get("rootElements"),e),e.$parent=null),e}var oC=500;function $l(e,t,n){n.invoke(J,this);function i(c){return t.filter(function(u){return w(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 f=l.get("categoryValueRef");return f&&f.$parent===c})}function a(c,u){c&&u&&nC(c,u,e.getDefinitions())}function s(c,u,l){u&&!o(u,l)&&rC(u),c&&!r(c,l)&&iC(c)}this.executed(["shape.create","label.create"],function(c){var u=c.labelTarget||c.shape;!w(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;!w(u,"bpmn:Group")||u.labelTarget||s(c.categoryValue,c.category,te(u))},!0),this.executed(["shape.move","shape.resize"],oC,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){Um(c).forEach(function(u){a(u.categoryValue,u.category)})},!0),this.reverted("group.updateRefs",function(c){Um(c).forEach(function(u){s(u.categoryValue,u.category,te(u.groupShape))})},!0),this.executed("shape.delete",function(c){var u=c.shape;!w(u,"bpmn:Group")||u.labelTarget||s(c.categoryValue,c.category,te(u))},!0),this.reverted("shape.delete",function(c){var u=c.shape;!w(u,"bpmn:Group")||u.labelTarget||a(c.categoryValue,c.category)},!0)}$l.$inject=["bpmnjs","elementRegistry","injector"],de($l,J);function Um(e){var t;return((t=e.updates)==null?void 0:t.groups)||[]}function Fl(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 _=m.source,y=m.target;vo(_)&&la(y)&&l(y)}function r(m){const _=m.connection,y=m.source,x=m.target;vo(y)&&Gs(x)&&(u(x),p(y,[_]))}function o(m){const _=m.newTarget,y=m.oldSource,x=m.oldTarget;if(x!==_){const S=y;la(x)&&l(x),vo(S)&&Gs(_)&&u(_)}}function a(m){const{element:_}=m;la(_)?(f(_),d(_)):Gs(_)&&g(_)}function s(m){const{newData:_,oldShape:y}=m;if(vo(m.oldShape)&&_.eventDefinitionType!=="bpmn:CompensateEventDefinition"||_.type!=="bpmn:BoundaryEvent"){const x=y.outgoing.find(({target:S})=>la(S));x&&x.target&&(m._connectionTarget=x.target)}else if(!vo(m.oldShape)&&_.eventDefinitionType==="bpmn:CompensateEventDefinition"&&_.type==="bpmn:BoundaryEvent"){const x=y.outgoing.find(({target:S})=>Gs(S));x&&x.target&&(m._connectionTarget=x.target),h(y)}}function c(m){const{_connectionTarget:_,newShape:y}=m;_&&t.connect(y,_)}function u(m){t.updateProperties(m,{isForCompensation:!0})}function l(m){t.updateProperties(m,{isForCompensation:void 0})}function f(m){for(const _ of m.incoming)n.canConnect(_.source,m)||t.removeConnection(_);for(const _ of m.outgoing)n.canConnect(m,_.target)||t.removeConnection(_)}function p(m,_){m.outgoing.filter(S=>w(S,"bpmn:Association")).filter(S=>la(S.target)&&!_.includes(S)).forEach(S=>t.removeConnection(S))}function d(m){const _=m.attachers.slice();_.length&&t.removeElements(_)}function g(m){const _=m.incoming.filter(y=>vo(y.source));t.removeElements(_)}function h(m){const _=m.outgoing.filter(y=>w(y,"bpmn:SequenceFlow"));t.removeElements(_)}}de(Fl,J),Fl.$inject=["eventBus","modeling","bpmnRules"];function la(e){const t=te(e);return t&&t.get("isForCompensation")}function vo(e){return e&&w(e,"bpmn:BoundaryEvent")&&ho(e,"bpmn:CompensateEventDefinition")}function Gs(e){return e&&w(e,"bpmn:Activity")&&!un(e)}function jl(e){e.invoke(J,this),this.preExecute("shape.create",1500,function(t){var n=t.context,i=n.parent,r=n.shape;w(i,"bpmn:Lane")&&!w(r,"bpmn:Lane")&&(n.parent=yo(i,"bpmn:Participant"))})}jl.$inject=["injector"],de(jl,J);function Hl(e,t){J.call(this,e),this.preExecute("shape.create",function(n){var a;var i=n.context,r=i.shape;if(w(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}})}Hl.$inject=["eventBus","bpmnFactory"],de(Hl,J);var zl=20,Gl=20,qm=30,Vs=2e3;function Vl(e,t,n){J.call(this,t),t.on(["create.start","shape.move.start"],Vs,function(r){var o=r.context,a=o.shape,s=e.getRootElement();if(!(!w(a,"bpmn:Participant")||!w(s,"bpmn:Process")||!s.children.length)){var c=s.children.filter(function(f){return!w(f,"bpmn:Group")&&!je(f)&&!at(f)});if(c.length){var u=Tt(c),l=aC(a,u);z(a,l),o.createConstraints=sC(a,u)}}}),t.on("create.start",Vs,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}w(a,"bpmn:Participant")&&w(s,"bpmn:Process")&&(t.on("element.hover",Vs,u),t.once("create.cleanup",function(){t.off("element.hover",u)}))});function i(){var r=e.getRootElement();return w(r,"bpmn:Collaboration")?r:n.makeCollaboration()}this.preExecute("elements.create",Vs,function(r){var o=r.elements,a=r.parent,s=cC(o),c;s&&w(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;w(a,"bpmn:Participant")&&w(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)}Vl.$inject=["canvas","eventBus","modeling"],de(Vl,J);function aC(e,t){t={width:t.width+zl*2+qm,height:t.height+Gl*2};var n=Math.max(e.width,t.width),i=Math.max(e.height,t.height);return{x:-n/2,y:-i/2,width:n,height:i}}function sC(e,t){return t=Pe(t),{bottom:t.top+e.height/2-Gl,left:t.right-e.width/2+zl,top:t.bottom-e.height/2+Gl,right:t.left+e.width/2-zl-qm}}function cC(e){return lt(e,function(t){return w(t,"bpmn:Participant")})}var Ym="__targetRef_placeholder";function Wl(e,t){J.call(this,e),this.executed(["connection.create","connection.delete","connection.move","connection.reconnect"],Km(o)),this.reverted(["connection.create","connection.delete","connection.move","connection.reconnect"],Km(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===Ym});return!u&&s&&(u=t.create("bpmn:Property",{name:Ym}),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,f=l&&l.businessObject,p=s.newTarget,d=p&&p.businessObject,g=s.oldTarget||s.target,h=g&&g.businessObject,m=c.businessObject,_;h&&h!==f&&r(h,u),d&&d!==f&&r(d,u),f?(_=i(f,!0),m.targetRef=_):m.targetRef=null}}Wl.$inject=["eventBus","bpmnFactory"],de(Wl,J);function Km(e){return function(t){var n=t.context,i=n.connection;if(w(i,"bpmn:DataInputAssociation"))return e(t)}}function Ws(e){this._bpmnUpdater=e}Ws.$inject=["bpmnUpdater"],Ws.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),[]},Ws.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 Ul(e,t,n,i){J.call(this,i),t.registerHandler("dataStore.updateContainment",Ws);function r(){return n.filter(function(s){return w(s,"bpmn:Participant")&&te(s).processRef})[0]}function o(s){return s.children.filter(function(c){return w(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;w(u,"bpmn:DataStoreReference")&&u.type!=="label"&&(c.hints||(c.hints={}),c.hints.autoResize=!1)}),this.preExecute("elements.move",function(s){var c=s.context,u=c.shapes,l=u.filter(function(f){return w(f,"bpmn:DataStoreReference")});l.length&&(c.hints||(c.hints={}),c.hints.autoResize=u.filter(function(f){return!w(f,"bpmn:DataStoreReference")}))}),this.postExecute("shape.create",function(s){var c=s.context,u=c.shape,l=u.parent;w(u,"bpmn:DataStoreReference")&&u.type!=="label"&&w(l,"bpmn:Collaboration")&&a(u)}),this.postExecute("shape.move",function(s){var c=s.context,u=c.shape,l=c.oldParent,f=u.parent;if(!w(l,"bpmn:Collaboration")&&w(u,"bpmn:DataStoreReference")&&u.type!=="label"&&w(f,"bpmn:Collaboration")){var p=w(l,"bpmn:Participant")?l:lC(l,"bpmn:Participant");a(u,p)}}),this.postExecute("shape.delete",function(s){var c=s.context,u=c.shape,l=e.getRootElement();ze(u,["bpmn:Participant","bpmn:SubProcess"])&&w(l,"bpmn:Collaboration")&&o(l).filter(function(f){return uC(f,u)}).forEach(function(f){a(f)})}),this.postExecute("canvas.updateRoot",function(s){var c=s.context,u=c.oldRoot,l=c.newRoot,f=o(u);f.forEach(function(p){w(l,"bpmn:Process")&&a(p,l)})})}Ul.$inject=["canvas","commandStack","elementRegistry","eventBus"],de(Ul,J);function uC(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 lC(e,t){for(;e.parent;){if(w(e.parent,t))return e.parent;e=e.parent}}var Us=Math.max,qs=Math.min,pC=20;function Xm(e,t){return{top:e.top-t.top,right:e.right-t.right,bottom:e.bottom-t.bottom,left:e.left-t.left}}function fC(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 dC(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 Ys(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)?qs:Us)(i,r)),Le(o)&&(i=(/top|left/.test(e)?Us:qs)(i,o)),i}function hC(e,t){if(!t)return e;var n=Pe(e);return Ms({top:Ys("top",n,t),right:Ys("right",n,t),bottom:Ys("bottom",n,t),left:Ys("left",n,t)})}function mC(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:qs(o.top,a.top),left:qs(o.left,a.left),bottom:Us(o.bottom,a.bottom),right:Us(o.right,a.right)};return Ms(s)}function pa(e,t){return typeof e<"u"?e:pC}function gC(e,t){var n,i,r,o;return typeof t=="object"?(n=pa(t.left),i=pa(t.right),r=pa(t.top),o=pa(t.bottom)):n=i=r=o=pa(t),{x:e.x-n,y:e.y-r,width:e.width+n+i,height:e.height+r+o}}function yC(e){return!(e.waypoints||e.type==="label")}function Zm(e,t){var n;if(e.length===void 0?n=Ge(e.children,yC):n=e,n.length)return gC(Tt(n),t)}var rr=Math.abs;function vC(e,t){return Xm(Pe(t),Pe(e))}var bC=["bpmn:Participant","bpmn:Process","bpmn:SubProcess"],Un=30;function Ks(e,t){return t=t||[],e.children.filter(function(n){w(n,"bpmn:Lane")&&(Ks(n,t),t.push(n))}),t}function or(e){return e.children.filter(function(t){return w(t,"bpmn:Lane")})}function qn(e){return yo(e,bC)||e}function _C(e,t){var n=qn(e),i=w(n,"bpmn:Process")?[]:[n],r=Ks(n,i),o=Pe(e),a=Pe(t),s=vC(e,t),c=[],u=qt(e);return r.forEach(function(l){if(l!==e){var f=u?0:s.top,p=u?s.right:0,d=u?0:s.bottom,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&&(f=a.top-h.top)),s.left&&(rr(h.right-o.left)<10&&(p=a.left-h.right),rr(h.left-o.left)<5&&(g=a.left-h.left)),s.bottom&&(rr(h.top-o.bottom)<10&&(f=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&&(p=a.right-h.right)),(f||p||d||g)&&c.push({shape:l,newBounds:dC(l,{top:f,right:p,bottom:d,left:g})})}}),c}var xC=500;function ql(e,t){J.call(this,e);function n(i,r){var o=qt(i),a=or(r),s=[],c=[],u=[],l=[];if(kr(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 f;o?c.length&&s.length?f=i.height/2:f=i.height:l.length&&u.length?f=i.width/2:f=i.width;var p,d,g,h;s.length&&(p=t.calculateAdjustments(s,"y",f,i.y-10),t.makeSpace(p.movingShapes,p.resizingShapes,{x:0,y:f},"s")),c.length&&(d=t.calculateAdjustments(c,"y",-f,i.y+i.height+10),t.makeSpace(d.movingShapes,d.resizingShapes,{x:0,y:-f},"n")),u.length&&(g=t.calculateAdjustments(u,"x",f,i.x-10),t.makeSpace(g.movingShapes,g.resizingShapes,{x:f,y:0},"e")),l.length&&(h=t.calculateAdjustments(l,"x",-f,i.x+i.width+10),t.makeSpace(h.movingShapes,h.resizingShapes,{x:-f,y:0},"w"))}}this.postExecuted("shape.delete",xC,function(i){var r=i.context,o=r.hints,a=r.shape,s=r.oldParent;w(a,"bpmn:Lane")&&(o&&o.nested||n(a,s))})}ql.$inject=["eventBus","spaceTool"],de(ql,J);var Qm=500;function Xs(e,t){t.invoke(J,this),this._bpmnReplace=e;var n=this;this.postExecuted("elements.create",Qm,function(i){var r=i.elements;r.filter(function(o){var a=o.host;return Jm(o,a)}).map(function(o){return r.indexOf(o)}).forEach(function(o){i.elements[o]=n._replaceShape(r[o])})},!0),this.preExecute("elements.move",Qm,function(i){var r=i.shapes,o=i.newHost;r.forEach(function(a,s){var c=a.host;Jm(a,EC(r,c)?c:o)&&(r[s]=n._replaceShape(a))})},!0)}Xs.$inject=["bpmnReplace","injector"],de(Xs,J),Xs.prototype._replaceShape=function(e){var t=wC(e),n;return t?n={type:"bpmn:IntermediateCatchEvent",eventDefinitionType:t.$type}:n={type:"bpmn:IntermediateThrowEvent"},this._bpmnReplace.replaceElement(e,n,{layoutConnection:!1})};function wC(e){var t=te(e),n=t.eventDefinitions;return n&&n[0]}function Jm(e,t){return!je(e)&&w(e,"bpmn:BoundaryEvent")&&!t}function EC(e,t){return e.indexOf(t)!==-1}var Zs=Math.round,SC=Math.max;function RC(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 CC(e){var t=[];return e.forEach(function(n,i){t.push([i===0?"M":"L",n.x,n.y])}),t}var eg=10;function PC(e,t){var n,i;for(n=0;i=e[n];n++)if(ta(i,t)<=eg)return{point:e[n],bendpoint:!0,index:n};return null}function AC(e,t){var n=om(RC(t,eg),CC(e)),i=n[0],r=n[n.length-1],o;return i?i!==r?i.segment2!==r.segment2?(o=SC(i.segment2,r.segment2)-1,{point:e[o],bendpoint:!0,index:o}):{point:{x:Zs(i.x+r.x)/2,y:Zs(i.y+r.y)/2},index:i.segment2}:{point:{x:Zs(i.x),y:Zs(i.y)},index:i.segment2}:null}function Yl(e,t){return PC(e,t)||AC(e,t)}function Kl(e,t,n){J.call(this,e);function i(r,o,a){var s=o.waypoints,c,u,l,f,p,d,g,h=r.outgoing.slice(),m=r.incoming.slice(),_;Le(a.width)?_=Oe(a):_=a;var y=Yl(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]:_,(c.length===1||!tg(r,c[c.length-1]))&&c.push(ng(l)),(u.length===1||!tg(r,u[0]))&&u.unshift(ng(l))}f=o.source,p=o.target,t.canConnect(f,r,o)&&(n.reconnectEnd(o,r,c||_),d=o),t.canConnect(r,p,o)&&(d?g=n.connect(r,p,{type:o.type,waypoints:u}):(n.reconnectStart(o,r,u||_),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},f=lt(o.children,function(p){var d=t.canInsert(a,p);return d&&Yl(p.waypoints,l)});f&&(r.targetFlow=f,r.position=l)}},!0),this.postExecuted("elements.move",function(r){var o=r.shapes,a=r.targetFlow,s=r.position;a&&i(o[0],a,s)},!0),this.preExecute("shape.create",function(r){var o=r.parent,a=r.shape;t.canInsert(a,o)&&(r.targetFlow=o,r.parent=o.parent)},!0),this.postExecuted("shape.create",function(r){var o=r.shape,a=r.targetFlow,s=r.position;a&&i(o,a,s)},!0)}de(Kl,J),Kl.$inject=["eventBus","bpmnRules","modeling"];function tg(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 ng(e){return z({},e)}function Xl(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=[];w(o,"bpmn:EventBasedGateway")?c=a.incoming.filter(u=>u!==r&&bo(u)):c=a.incoming.filter(u=>u!==r&&bo(u)&&w(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(w(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)})})}})}Xl.$inject=["eventBus","modeling"],de(Xl,J);function bo(e){return w(e,"bpmn:SequenceFlow")}var Qs=1500,ig=2e3;function rg(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"],Qs,function(i){var r=i.context,o=r.shape||i.shape,a=i.hover;w(a,"bpmn:Lane")&&!ze(o,["bpmn:Lane","bpmn:Participant"])&&(i.hover=qn(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"],Qs,function(i){var r=i.hover;w(r,"bpmn:Lane")&&(i.hover=qn(r)||r,i.hoverGfx=e.getGraphics(i.hover))}),t.on(["bendpoint.move.hover"],Qs,function(i){var r=i.context,o=i.hover,a=r.type;w(o,"bpmn:Lane")&&/reconnect/.test(a)&&(i.hover=qn(o)||o,i.hoverGfx=e.getGraphics(i.hover))}),t.on(["connect.start"],Qs,function(i){var r=i.context,o=r.start;w(o,"bpmn:Lane")&&(r.start=qn(o)||o)}),t.on("shape.move.start",ig,function(i){var r=i.shape;w(r,"bpmn:Lane")&&(i.shape=qn(r)||r)}),t.on("spaceTool.move",ig,function(i){var r=i.hover;r&&w(r,"bpmn:Lane")&&(i.hover=qn(r))})}rg.$inject=["elementRegistry","eventBus","canvas"];var og=770;function Zl(e,t,n,i){n.invoke(J,this);function r(s,c){var u=te(s),l=c.categoryValue||u.categoryValueRef;l||(l=Wm(e,u));var f=c.category||l.$parent||Vm(e);u.categoryValueRef=l,l.$parent=f,c.categoryValue=l,c.category=f}function o(s,c){var u=te(s),l=c.categoryValue||u.categoryValueRef,f=c.category||l&&l.$parent;l&&(c.categoryValue=l,c.category=f,u.categoryValueRef=null)}this.execute("label.create",function(s){var c=s.context,u=c.labelTarget;w(u,"bpmn:Group")&&r(u,c)}),this.revert("label.create",function(s){var c=s.context,u=c.labelTarget;w(u,"bpmn:Group")&&o(u,c)}),this.execute("shape.delete",function(s){var c=s.context,u=c.shape,l=te(u);if(!(!w(u,"bpmn:Group")||u.labelTarget)){var f=c.categoryValue=l.categoryValueRef;f&&(c.category=f.$parent,l.categoryValueRef=null)}}),this.reverted("shape.delete",function(s){var c=s.context,u=c.shape;if(!(!w(u,"bpmn:Group")||u.labelTarget)){var l=c.category,f=c.categoryValue,p=te(u);f&&(p.categoryValueRef=f,f.$parent=l)}}),this.execute("shape.create",function(s){var c=s.context,u=c.shape,l=c.hints||{};!w(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||{};!w(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;!w(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;!w(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",og,function(s){var c=s.descriptor,u=s.element;if(!(!w(u,"bpmn:Group")||u.labelTarget)){var l=te(u);if(l.categoryValueRef){var f=l.categoryValueRef;c.categoryValue=a(f,!0),f.$parent&&(c.category=a(f.$parent,!0))}}}),t.on("copyPaste.pasteElement",og,function(s){var c=s.descriptor,u=c.businessObject,l=c.categoryValue,f=c.category;l&&(l=u.categoryValueRef=a(l)),f&&(l.$parent=a(f)),delete c.category,delete c.categoryValue})}Zl.$inject=["bpmnFactory","eventBus","injector","moddleCopy"],de(Zl,J);function Ql(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 ag(e){function t(i,r,o){var a={x:o.x,y:o.y-50},s={x:o.x-50,y:o.y},c=Ql(i,r,o,a),u=Ql(i,r,o,s),l;c&&u?sg(c,o)>sg(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)})}ag.$inject=["eventBus"];function sg(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function Jl(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)}})}Jl.$inject=["eventBus"],de(Jl,J);function cg(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}function ug(e){return Math.atan((e[1].y-e[0].y)/(e[1].x-e[0].x))}function TC(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 MC(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 ep(e,t){var n=t[0],i=t[1],r={x:i.x-n.x,y:i.y-n.y},o=MC([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 lg(e,t){var n=ep(e,t),i={x:n.x-e.x,y:n.y-e.y};return cg(i)}function fa(e,t){return cg({x:e.x-t.x,y:e.y-t.y})}var pg=Math.sqrt,fg=Math.min,kC=Math.max,dg=Math.abs;function hg(e){return Math.pow(e,2)}function da(e,t){return pg(hg(e.x-t.x)+hg(e.y-t.y))}function OC(e,t){var n=0,i,r,o,a,s,c,u,l,f,p,d;for(n=0;n<t.length-1;n++){if(i=t[n],r=t[n+1],gg(i,r)?u=[i]:(o=da(e,i),a=da(e,r),c=fg(o,a),u=DC(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:gg(i,u[0])?n:n+1}),u.length===2&&(s=IC(u[0],u[1]),l={type:"segment",position:s,segmentIndex:n,relativeLocation:da(i,s)/da(i,r)}),f=da(l.position,e),(!d||p>f)&&(d=l,p=f)}return d}function DC(e,t,n,i){var r=t.x-e.x,o=t.y-e.y,a=n.x-e.x,s=n.y-e.y,c=r*r+o*o,u=r*a+o*s,l=a*a+s*s-i*i,f=u/c,p=l/c,d=f*f-p;if(d<0&&d>-1e-6&&(d=0),d<0)return[];var g=pg(d),h=-f+g,m=-f-g,_={x:e.x-r*h,y:e.y-o*h};if(d===0)return[_];var y={x:e.x-r*m,y:e.y-o*m};return[_,y].filter(function(x){return LC(x,e,t)})}function LC(e,t,n){return mg(e.x,t.x,n.x)&&mg(e.y,t.y,n.y)}function mg(e,t,n){return e>=fg(t,n)-Js&&e<=kC(t,n)+Js}function IC(e,t){return{x:(e.x+t.x)/2,y:(e.y+t.y)/2}}var Js=.1;function gg(e,t){return dg(e.x-t.x)<=Js&&dg(e.y-t.y)<=Js}function BC(e,t,n,i){var r=n.segmentIndex,o=t.length-e.length;if(i.segmentMove){var a=i.segmentMove.segmentStartIndex,s=i.segmentMove.newSegmentStartIndex;return r===a?s:r>=s?r+o<s?s:r+o:r}if(i.bendpointMove){var c=i.bendpointMove.insert,u=i.bendpointMove.bendpointIndex,l;if(o===0)return r;if(r>=u&&(l=c?r+1:r-1),r<u&&(l=r,c&&n.type!=="bendpoint"&&u-1===r)){var f=vg(t,u);f<n.relativeLocation&&l++}return l}return o===0?r:i.connectionStart&&r===0?0:i.connectionEnd&&r===e.length-2?t.length-2:Math.floor((t.length-2)/2)}function yg(e,t,n,i){var r=0,o=0,a={point:e,delta:{x:0,y:0}},s=OC(e,n),c=s.segmentIndex,u=BC(n,t,s,i);if(u<0||u>t.length-2||u===null)return a;var l=bg(n,c),f=bg(t,u),p=s.position,d=$C(l,p),g=NC(l,f);if(s.type==="bendpoint"){var h=t.length-n.length,m=s.bendpointIndex,_=n[m];if(t.indexOf(_)!==-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=vg(n,m))}var x={x:(f[1].x-f[0].x)*d+f[0].x,y:(f[1].y-f[0].y)*d+f[0].y},S=TC({x:e.x-p.x,y:e.y-p.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 vg(e,t){var n=fa(e[t-1],e[t]),i=fa(e[t],e[t+1]),r=n/(n+i);return r}function NC(e,t){var n=ug(e),i=ug(t);return i-n}function bg(e,t){return[e[t],e[t+1]]}function $C(e,t){var n=fa(e[0],e[1]),i=fa(e[0],t);return n===0?0:i/n}function FC(e,t,n,i){var r=Oe(e);return yg(r,t,n,i).delta}function ha(e,t,n){var i=ua(t),r=ua(n),o=oi(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 _g(e,t,n){var i=ua(e),r=ua(t),o=ua(n),a=oi(e,i),s=oi(i,r),c=jC(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 jC(e,t,n){var i=Pe(t),r=Pe(n);if(HC(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 HC(e,t){return zC(e,t)||GC(e,t)}function zC(e,t){return e.right!==t.right&&e.left!==t.left}function GC(e,t){return e.top!==t.top&&e.bottom!==t.bottom}var xg="name",wg="text";function tp(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(xg in u&&t.updateLabel(c,u[xg]),wg in u&&w(c,"bpmn:TextAnnotation")){var l=i.getTextAnnotationBounds({x:c.x,y:c.y,width:c.width,height:c.height},u[wg]||"");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)||!ir(u)||Fn(u)&&t.updateLabel(u,Fn(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=z({},s.hints),f=s.newWaypoints||c.waypoints,p=s.oldWaypoints;return typeof l.startChanged>"u"&&(l.startChanged=!!l.connectionStart),typeof l.endChanged>"u"&&(l.endChanged=!!l.connectionEnd),FC(u,f,p,l)}this.postExecute(["connection.layout","connection.updateWaypoints"],function(a){var s=a.context,c=s.hints||{};if(c.labelBehavior!==!1){var u=s.connection,l=u.label,f;!l||!l.parent||(f=o(a),t.moveShape(l,f))}}),this.postExecute(["shape.replace"],function(a){var s=a.context,c=s.newShape,u=s.oldShape,l=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(!(!je(c)||u.autoResize)){var l=s.newBounds,f=i.getDimensions(Fn(c)||"",{box:l,style:i.getExternalStyle()}),p=Math.ceil(f.height),d=l.y!==c.y,g=c.y+c.height;s.newBounds={width:l.width,height:p,x:l.x,y:d?g-p:l.y}}}),this.postExecute("shape.resize",function(a){var s=a.context,c=s.shape,u=s.newBounds,l=s.oldBounds;if(Bs(c)){var f=c.label,p=Oe(f),d=UC(l),g=WC(p,d),h=VC(g,l,u);t.moveShape(f,h)}})}de(tp,J),tp.$inject=["eventBus","modeling","bpmnFactory","textRenderer"];function VC(e,t,n){var i=ha(e,t,n);return ki(oi(i,e))}function WC(e,t){if(t.length){var n=qC(e,t);return ep(e,n)}}function UC(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 qC(e,t){var n=t.map(function(r){return{line:r,distance:lg(e,r)}}),i=ci(n,"distance");return i[0].line}function YC(e,t,n,i){return yg(e,t,n,i).point}function np(e,t){J.call(this,e);function n(i,r){var o=i.context,a=o.connection,s=z({},o.hints),c=o.newWaypoints||a.waypoints,u=o.oldWaypoints;return typeof s.startChanged>"u"&&(s.startChanged=!!s.connectionStart),typeof s.endChanged>"u"&&(s.endChanged=!!s.connectionEnd),YC(r,c,u,s)}this.postExecute(["connection.layout","connection.updateWaypoints"],function(i){var r=i.context,o=r.connection,a=o.outgoing,s=o.incoming;s.forEach(function(c){var u=c.waypoints[c.waypoints.length-1],l=n(i,u),f=[].concat(c.waypoints.slice(0,-1),[l]);t.updateWaypoints(c,f)}),a.forEach(function(c){var u=c.waypoints[0],l=n(i,u),f=[].concat([l],c.waypoints.slice(1));t.updateWaypoints(c,f)})}),this.postExecute(["connection.move"],function(i){var r=i.context,o=r.connection,a=o.outgoing,s=o.incoming,c=r.delta;s.forEach(function(u){var l=u.waypoints[u.waypoints.length-1],f={x:l.x+c.x,y:l.y+c.y},p=[].concat(u.waypoints.slice(0,-1),[f]);t.updateWaypoints(u,p)}),a.forEach(function(u){var l=u.waypoints[0],f={x:l.x+c.x,y:l.y+c.y},p=[].concat([f],u.waypoints.slice(1));t.updateWaypoints(u,p)})})}de(np,J),np.$inject=["eventBus","modeling"];function ec(e,t,n){var i=nc(e),r=Sg(i,t),o=i[0];return r.length?r[r.length-1]:ha(o.original||o,n,t)}function tc(e,t,n){var i=nc(e),r=Sg(i,t),o=i[i.length-1];return r.length?r[0]:ha(o.original||o,n,t)}function ip(e,t,n){var i=nc(e),r=Eg(t,n),o=i[0];return ha(o.original||o,r,t)}function rp(e,t,n){var i=nc(e),r=Eg(t,n),o=i[i.length-1];return ha(o.original||o,r,t)}function Eg(e,t){return{x:e.x-t.x,y:e.y-t.y,width:e.width,height:e.height}}function nc(e){var t=e.waypoints;if(!t.length)throw new Error("connection#"+e.id+": no waypoints");return t}function Sg(e,t){var n=on(e,XC);return Ge(n,function(i){return KC(i,t)})}function KC(e,t){return Jt(t,e,1)==="intersect"}function XC(e){return e.original||e}function op(e,t){J.call(this,e),this.postExecute("shape.replace",function(n){var i=n.oldShape,r=n.newShape;if(ZC(i,r)){var o=QC(i);o.incoming.forEach(function(a){var s=tc(a,r,i);t.reconnectEnd(a,r,s)}),o.outgoing.forEach(function(a){var s=ec(a,r,i);t.reconnectStart(a,r,s)})}},!0)}op.$inject=["eventBus","modeling"],de(op,J);function ZC(e,t){return w(e,"bpmn:Participant")&&We(e)&&w(t,"bpmn:Participant")&&!We(t)}function QC(e){var t=Jo([e]),n=[],i=[];return t.forEach(function(r){r!==e&&(r.incoming.forEach(function(o){w(o,"bpmn:MessageFlow")&&n.push(o)}),r.outgoing.forEach(function(o){w(o,"bpmn:MessageFlow")&&i.push(o)}))},[]),{incoming:n,outgoing:i}}const JC=["bpmn:MessageEventDefinition","bpmn:TimerEventDefinition","bpmn:EscalationEventDefinition","bpmn:ConditionalEventDefinition","bpmn:SignalEventDefinition"];function Rg(e){const t=te(e);if(!w(t,"bpmn:BoundaryEvent")&&!(w(t,"bpmn:StartEvent")&&un(t.$parent)))return!1;const n=t.get("eventDefinitions");return!n||!n.length?!1:JC.some(i=>w(n[0],i))}function Cg(e){return w(e,"bpmn:BoundaryEvent")?"cancelActivity":"isInterrupting"}function ap(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(!Rg(r))return;const a=Cg(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})})}ap.$inject=["injector","modeling"],de(ap,J);function sp(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(sp,J),sp.$inject=["eventBus","modeling"];function cp(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(!(!w(o,"bpmn:SequenceFlow")||!w(a,"bpmn:SequenceFlow"))&&t.canConnect(o.source,a.target,o)){var s=eP(o.waypoints,a.waypoints);n.reconnectEnd(o,a.target,s)}}})}de(cp,J),cp.$inject=["eventBus","bpmnRules","modeling"];function _o(e){return e.original||e}function eP(e,t){var n=Ql(_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 up(e,t){J.call(this,e),this.preExecute("shape.delete",function(n){var i=n.shape,r=i.parent;w(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)}up.$inject=["eventBus","modeling"],de(up,J);function lp(e,t,n,i){J.call(this,e);var r=i.get("dragging",!1);function o(c){var u=c.source,l=c.target,f=c.parent;if(f){var p,d;w(c,"bpmn:SequenceFlow")&&(n.canConnectSequenceFlow(u,l)||(d=!0),n.canConnectMessageFlow(u,l)&&(p="bpmn:MessageFlow")),w(c,"bpmn:MessageFlow")&&(n.canConnectMessageFlow(u,l)||(d=!0),n.canConnectSequenceFlow(u,l)&&(p="bpmn:SequenceFlow")),d&&t.removeConnection(c),p&&t.connect(u,l,{type:p,waypoints:c.waypoints.slice()})}}function a(c){var u=c.context,l=u.connection,f=u.newSource||l.source,p=u.newTarget||l.target,d,g;d=n.canConnect(f,p),!(!d||d.type===l.type)&&(g=t.connect(f,p,{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(),f=l&&l.payload.previousSelection,p;!f||!f.length||(p=f.indexOf(c),p!==-1&&f.splice(p,1,u))}this.postExecuted("elements.move",function(c){var u=c.closure,l=u.allConnections;L(l,o)},!0),this.preExecute("connection.reconnect",a),this.postExecuted("element.updateProperties",function(c){var u=c.context,l=u.properties,f=u.element,p=f.businessObject,d;l.default&&(d=lt(f.outgoing,eo({id:f.businessObject.default.id})),d&&t.updateProperties(d,{conditionExpression:void 0})),l.conditionExpression&&p.sourceRef.default===p&&t.updateProperties(f.source,{default:void 0})})}de(lp,J),lp.$inject=["eventBus","modeling","bpmnRules","injector"];function ic(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=Sn(u,function(f,p){var d=t.canReplace([p],p.host||p.parent||c);return d?f.concat(d.replacements):f},[]);l.length&&this._replaceElements(u,l)},this),this.postExecuted(["elements.move"],500,function(a){var s=a.context,c=s.newParent,u=s.newHost,l=[];L(s.closure.topLevel,function(p){un(p)?l=l.concat(p.children):l=l.concat(p)}),l.length===1&&u&&(c=u);var f=t.canReplace(l,c);f&&this._replaceElements(l,f.replacements,u)},this),this.postExecute(["shape.replace"],1500,function(a){var s=a.context,c=s.oldShape,u=s.newShape,l=c.attachers,f;l&&l.length&&(f=t.canReplace(l,u),this._replaceElements(l,f.replacements))},this),this.postExecuted(["shape.replace"],1500,function(a){var s=a.context,c=s.oldShape,u=s.newShape;r.unclaimId(c.businessObject.id,c.businessObject),r.updateProperties(u,{id:c.id})})}de(ic,J),ic.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)},ic.$inject=["bpmnReplace","bpmnRules","elementRegistry","injector","modeling","selection"];var tP=1500,nP={width:140,height:120},pp={width:300,height:60},fp={width:60,height:300},rc={width:300,height:150},oc={width:150,height:300},Pg={width:140,height:120},Ag={width:100,height:40};function Tg(e){e.on("resize.start",tP,function(t){var n=t.context,i=n.shape,r=n.direction,o=n.balanced;(w(i,"bpmn:Lane")||w(i,"bpmn:Participant"))&&(n.resizeConstraints=sP(i,r,o)),w(i,"bpmn:SubProcess")&&We(i)&&(n.minDimensions=Pg),w(i,"bpmn:TextAnnotation")&&(n.minDimensions=Ag)})}Tg.$inject=["eventBus"];var ar=Math.abs,iP=Math.min,rP=Math.max;function Mg(e,t,n,i){var r=e[t];e[t]=r===void 0?n:i(n,r)}function xo(e,t,n){return Mg(e,t,n,iP)}function wo(e,t,n){return Mg(e,t,n,rP)}var oP={top:20,left:50,right:20,bottom:20},aP={top:50,left:20,right:20,bottom:20};function sP(e,t,n){var i=qn(e),r=!0,o=!0,a=Ks(i,[i]),s=Pe(e),c={},u={},l=qt(e),f=l?pp:fp;/n/.test(t)?u.top=s.bottom-f.height:/e/.test(t)?u.right=s.left+f.width:/s/.test(t)?u.bottom=s.top+f.height:/w/.test(t)&&(u.left=s.right-f.width),a.forEach(function(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+f.height),ar(s.top-h.top)<5&&xo(u,"top",h.bottom-f.height)),/e/.test(t)&&(n&&ar(s.right-h.left)<10&&xo(c,"right",h.right-f.width),ar(s.right-h.right)<5&&wo(u,"right",h.left+f.width)),/s/.test(t)&&(n&&ar(s.bottom-h.top)<10&&xo(c,"bottom",h.bottom-f.height),ar(s.bottom-h.bottom)<5&&wo(u,"bottom",h.top+f.height)),/w/.test(t)&&(n&&ar(s.left-h.right)<10&&wo(c,"left",h.left+f.width),ar(s.left-h.left)<5&&xo(u,"left",h.right-f.width))});var p=i.children.filter(function(g){return!g.hidden&&!g.waypoints&&(w(g,"bpmn:FlowElement")||w(g,"bpmn:Artifact"))}),d=l?oP:aP;return p.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 kg(e){!e||typeof e.stopPropagation!="function"||e.stopPropagation()}function Eo(e){return e.originalEvent||e.srcEvent}function dp(e){kg(e),kg(Eo(e))}function Ir(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 Og(){return/mac/i.test(navigator.platform)}function Dg(e,t){return(Eo(e)||e).button===t}function sr(e){return Dg(e,0)}function cP(e){return Dg(e,1)}function ma(e){var t=Eo(e)||e;return sr(e)?Og()?t.metaKey:t.ctrlKey:!1}function ac(e){var t=Eo(e)||e;return sr(e)&&t.shiftKey}var Lg=1001;function Ig(e,t){e.on("resize.start",Lg+500,function(n){var i=n.context,r=i.shape;(w(r,"bpmn:Lane")||w(r,"bpmn:Participant"))&&(i.balanced=!ma(n))}),e.on("resize.end",Lg,function(n){var i=n.context,r=i.shape,o=i.canExecute,a=i.newBounds;if(w(r,"bpmn:Lane")||w(r,"bpmn:Participant"))return o&&(a=lm(a),t.resizeLane(r,a,i.balanced)),!1})}Ig.$inject=["eventBus","modeling"];var uP=500;function hp(e,t,n,i,r){n.invoke(J,this);function o(l){return ze(l,["bpmn:ReceiveTask","bpmn:SendTask"])||lP(l,["bpmn:ErrorEventDefinition","bpmn:EscalationEventDefinition","bpmn:MessageEventDefinition","bpmn:SignalEventDefinition"])}function a(l){var f=e.getDefinitions(),p=f.get("rootElements");return!!lt(p,eo({id:l.id}))}function s(l){if(w(l,"bpmn:ErrorEventDefinition"))return"errorRef";if(w(l,"bpmn:EscalationEventDefinition"))return"escalationRef";if(w(l,"bpmn:MessageEventDefinition"))return"messageRef";if(w(l,"bpmn:SignalEventDefinition"))return"signalRef"}function c(l){if(ze(l,["bpmn:ReceiveTask","bpmn:SendTask"]))return l.get("messageRef");var f=l.get("eventDefinitions"),p=f[0];return p.get(s(p))}function u(l,f){if(ze(l,["bpmn:ReceiveTask","bpmn:SendTask"]))return l.set("messageRef",f);var p=l.get("eventDefinitions"),d=p[0];return d.set(s(d),f)}this.executed(["shape.create","element.updateProperties","element.updateModdleProperties"],function(l){var f=l.shape||l.element;if(o(f)){var p=te(f),d=c(p),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 f=l.addedRootElement;if(f){var p=e.getDefinitions().get("rootElements");St(p,f)}},!0),t.on("copyPaste.copyElement",function(l){var f=l.descriptor,p=l.element;if(!(p.labelTarget||!o(p))){var d=te(p),g=c(d);g&&(f.referencedRootElement=g)}}),t.on("copyPaste.pasteElement",uP,function(l){var f=l.descriptor,p=f.businessObject,d=f.referencedRootElement;d&&(a(d)||(d=i.copyElement(d,r.create(d.$type))),u(p,d),delete f.referencedRootElement)})}hp.$inject=["bpmnjs","eventBus","injector","moddleCopy","bpmnFactory"],de(hp,J);function lP(e,t){return ke(t)||(t=[t]),Wi(t,function(n){return ho(e,n)})}var Bg=Math.max;function Ng(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;w(a,"bpmn:Participant")&&(o[s]=fP(a,i,r)),w(a,"bpmn:Lane")&&(o[s]=qt(a)?pp:fp),w(a,"bpmn:SubProcess")&&We(a)&&(o[s]=Pg),w(a,"bpmn:TextAnnotation")&&(o[s]=Ag),w(a,"bpmn:Group")&&(o[s]=nP)}),o})}Ng.$inject=["eventBus"];function pP(e){return e==="x"}function fP(e,t,n){var i=qt(e);if(!mP(e))return i?rc:oc;var r=pP(t),o={};return r?i?o=rc:o={width:hP(e,n,r),height:oc.height}:i?o={width:rc.width,height:dP(e,n,r)}:o=oc,o}function dP(e,t,n){var i;return i=gP(e,t,n),Bg(rc.height,i)}function hP(e,t,n){var i;return i=yP(e,t,n),Bg(oc.width,i)}function mP(e){return!!or(e).length}function gP(e,t,n){var i=or(e),r;return r=mp(i,t,n),e.height-r.height+pp.height}function yP(e,t,n){var i=or(e),r;return r=mp(i,t,n),e.width-r.width+fp.width}function mp(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?mp(o,t,n):r}var $g="_plane";function Fg(e){var t=e.id;return vP(t)}function vi(e){var t=e.id;return w(e,"bpmn:SubProcess")?jg(t):t}function Br(e){return jg(e)}function sc(e){var t=Ye(e);return w(t,"bpmndi:BPMNPlane")}function jg(e){return e+$g}function vP(e){return e.replace(new RegExp($g+"$"),"")}var Hg=400,bP=600,zg={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(f){return w(f,"bpmn:SubProcess")&&!We(f)}function u(f){var p=f.shape,d=f.newRootElement,g=te(p);d=s._addDiagram(d||g),f.newRootElement=e.addRootElement(d)}function l(f){var p=f.shape,d=te(p);s._removeDiagram(d);var g=f.newRootElement=a.get(vi(d));e.removeRootElement(g)}this.executed("shape.create",function(f){var p=f.shape;c(p)&&u(f)},!0),this.postExecuted("elements.create",function(f){var p=f.elements;L(p,function(d){if(c(d)){var g=a.get(vi(d));if(!(!g||!d.children||!d.children.length)){var h=Gg(d);s._showRecursively(h),s._moveChildrenToShape(h,g)}}})},!0),this.reverted("shape.create",function(f){var p=f.shape;c(p)&&l(f)},!0),this.preExecute("shape.delete",function(f){var p=f.shape;!w(p,"bpmn:SubProcess")||!We(p)||L(oa([p]),d=>{n.removeShape(d.annotation)})},!0),this.preExecuted("shape.delete",function(f){var p=f.shape;if(c(p)){var d=a.get(vi(p));d&&n.removeElements(d.children.slice())}},!0),this.executed("shape.delete",function(f){var p=f.shape;c(p)&&l(f)},!0),this.reverted("shape.delete",function(f){var p=f.shape;c(p)&&u(f)},!0),this.preExecuted("shape.replace",function(f){var p=f.oldShape,d=f.newShape;!c(p)||!c(d)||(f.oldRoot=e.removeRootElement(vi(p)))},!0),this.postExecuted("shape.replace",function(f){var p=f.newShape,d=f.oldRoot,g=e.findRoot(vi(p));if(!(!d||!g)){var h=d.children;n.moveElements(h,{x:0,y:0},g)}},!0),this.executed("element.updateProperties",function(f){var p=f.element;if(w(p,"bpmn:SubProcess")){var d=f.properties,g=f.oldProperties,h=g.id,m=d.id;if(h!==m){if(sc(p)){a.updateId(p,Br(m)),a.updateId(h,m);return}var _=a.get(Br(h));_&&a.updateId(Br(h),Br(m))}}},!0),this.reverted("element.updateProperties",function(f){var p=f.element;if(w(p,"bpmn:SubProcess")){var d=f.properties,g=f.oldProperties,h=g.id,m=d.id;if(h!==m){if(sc(p)){a.updateId(p,Br(h)),a.updateId(m,h);return}var _=a.get(Br(m));_&&a.updateId(_,Br(h))}}},!0),t.on("element.changed",function(f){var p=f.element;if(sc(p)){var d=p,g=a.get(Fg(d));!g||g===d||t.fire("element.changed",{element:g})}}),this.executed("shape.toggleCollapse",Hg,function(f){var p=f.shape;w(p,"bpmn:SubProcess")&&(We(p)?l(f):(u(f),s._showRecursively(p.children)))},!0),this.reverted("shape.toggleCollapse",Hg,function(f){var p=f.shape;w(p,"bpmn:SubProcess")&&(We(p)?l(f):(u(f),s._showRecursively(p.children)))},!0),this.postExecuted("shape.toggleCollapse",bP,function(f){var p=f.shape;if(w(p,"bpmn:SubProcess")){var d=f.newRootElement;if(d)if(We(p))s._moveChildrenToShape(d.children.slice(),p),L(oa(p.children),h=>{n.moveShape(h.annotation,{x:0,y:0},p.parent),L(h.associations,m=>{n.moveConnection(m,{x:0,y:0},p.parent)})});else{s._disconnectSharedAnnotations(p);var g=Gg(p);s._moveChildrenToShape(g,d)}}},!0),t.on("copyPaste.createTree",function(f){var p=f.element,d=f.children;if(c(p)){var g=vi(p),h=a.get(g);h&&d.push.apply(d,h.children)}}),t.on("copyPaste.copyElement",function(f){var p=f.descriptor,d=f.element,g=f.elements,h=d.parent,m=w(Ye(h),"bpmndi:BPMNPlane");if(m){var _=Fg(h),y=lt(g,function(x){return x.id===_});y&&(p.parent=y.id)}}),t.on("copyPaste.pasteElement",function(f){var p=f.descriptor;p.parent&&(c(p.parent)||p.parent.hidden)&&(p.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:zg.x-r.x,y:zg.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(Dm(e).map(i=>i.annotation));n.size&&L(oa(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:vi(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 _P(e){var t=[];return L(oa(e),n=>{t.push(n.annotation),t.push.apply(t,n.associations)}),t}function Gg(e){return e.children.slice().concat(_P(e.children)).concat(xP(e))}function xP(e){return _l(e.children||[]).reduce(function(t,n){return n.label&&n.label.parent!==e&&t.push(n.label),t},[])}function gp(e,t){e.invoke(J,this),this.postExecuted("shape.replace",function(n){var i=n.context.oldShape,r=n.context.newShape;if(!(!w(r,"bpmn:SubProcess")||w(r,"bpmn:AdHocSubProcess")||!(w(i,"bpmn:Task")||w(i,"bpmn:CallActivity"))||!We(r))){var o=wP(r);t.createShape({type:"bpmn:StartEvent"},o,r)}})}gp.$inject=["injector","modeling"],de(gp,J);function wP(e){return{x:e.x+e.width/6,y:e.y+e.height/2}}function yp(e,t){J.call(this,e),this.preExecute("connection.create",function(n){const{target:i}=n;w(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&&w(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(!(!w(r,"bpmn:TextAnnotation")||o.autoResize)){var a=i.newBounds,s=t.getTextAnnotationBounds(a,Fn(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(yp,J),yp.$inject=["eventBus","textRenderer"];function vp(e,t){J.call(this,e),this.postExecuted("shape.toggleCollapse",1500,function(n){var i=n.shape;if(We(i))return;var r=Jo(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||w(a,"bpmn:Association")&&(w(a.source,"bpmn:TextAnnotation")||w(a.target,"bpmn:TextAnnotation"))||(s?t.reconnectEnd(a,i,Oe(i)):t.reconnectStart(a,i,Oe(i)))}},!0)}de(vp,J),vp.$inject=["eventBus","modeling"];var bp=500;function _p(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,f;return l=EP(c).concat([a]),f=Zm(l),f?(u.width=Math.max(f.width,u.width),u.height=Math.max(f.height,u.height),u.x=f.x+(f.width-u.width)/2,u.y=f.y+(f.height-u.height)/2):(u.x=a.x+(a.width-u.width)/2,u.y=a.y+(a.height-u.height)/2),u}function o(a,s){return{x:a.x+(a.width-s.width)/2,y:a.y+(a.height-s.height)/2,width:s.width,height:s.height}}this.executed(["shape.toggleCollapse"],bp,function(a){var s=a.context,c=s.shape;w(c,"bpmn:SubProcess")&&(c.collapsed?Ye(c).isExpanded=!1:(i(c.children),Ye(c).isExpanded=!0))}),this.reverted(["shape.toggleCollapse"],bp,function(a){var s=a.context,c=s.shape;c.collapsed?Ye(c).isExpanded=!1:Ye(c).isExpanded=!0}),this.postExecuted(["shape.toggleCollapse"],bp,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(_p,J),_p.$inject=["eventBus","elementFactory","modeling"];function EP(e){return e.filter(function(t){return!t.hidden})}function xp(e,t,n,i){t.invoke(J,this),this.preExecute("shape.delete",function(r){var o=r.context,a=o.shape,s=a.businessObject;je(a)||(w(a,"bpmn:Participant")&&We(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;w(r,"bpmn:Collaboration")&&n.ids.unclaim(o.id)})}de(xp,J),xp.$inject=["canvas","injector","moddle","modeling"];function wp(e,t){J.call(this,e),this.preExecute("connection.delete",function(n){var i=n.context,r=i.connection,o=r.source;SP(r,o)&&t.updateProperties(o,{default:null})})}de(wp,J),wp.$inject=["eventBus","modeling"];function SP(e,t){if(!w(e,"bpmn:SequenceFlow"))return!1;var n=te(t),i=te(e);return n.get("default")===i}var RP=500,CP=5e3,Vg=["shape.create","shape.delete","shape.move","shape.resize"],Wg=[...Vg,"spaceTool","lane.add","lane.resize","lane.split","elements.create","elements.delete","elements.move"];function Ep(e,t){J.call(this,e);var n;function i(){return n=n||new PP,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(Wg,CP,function(){i()}),this.postExecuted(Wg,RP,function(){o()}),this.preExecute(Vg,function(a){var s=a.context,c=s.shape,u=r();!c||c.labelTarget||(w(c,"bpmn:Lane")&&u.addLane(c),w(c,"bpmn:FlowNode")&&u.addFlowNode(c))})}Ep.$inject=["eventBus","modeling"],de(Ep,J);function PP(){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 AP=500,TP=5e3,Ug=["connection.create","connection.delete","connection.layout","connection.move","connection.reconnect","connection.updateWaypoints","shape.create","shape.delete","shape.move","shape.resize"],qg=[...Ug,"elements.create","elements.delete","elements.move","label.create","spaceTool"];function Sp(e,t){J.call(this,e);var n;function i(){return n=n||new MP,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(qg,TP,function(){i()}),this.postExecuted(qg,AP,function(){o()}),this.preExecute(Ug,function(a){var s=a.context.connection||a.context.shape,c=r();!s||s.labelTarget||(w(s,"bpmn:FlowElement")&&c.addFlowElement(s),w(s,"bpmn:Group")&&c.addGroup(s))}),this.preExecute("label.create",function(a){var s=a.context.labelTarget;w(s,"bpmn:Group")&&r().addGroup(s)})}Sp.$inject=["eventBus","modeling"],de(Sp,J);function MP(){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 Rp(e,t){J.call(this,e),this.postExecuted("elements.create",function(n){const i=n.context,r=i.elements;for(const o of r)kP(o)&&!DP(o)&&t.updateProperties(o,{isForCompensation:void 0})})}de(Rp,J),Rp.$inject=["eventBus","modeling"];function kP(e){const t=te(e);return t&&t.isForCompensation}function OP(e){return e&&w(e,"bpmn:BoundaryEvent")&&ho(e,"bpmn:CompensateEventDefinition")}function DP(e){return e.incoming.filter(n=>OP(n.source)).length>0}const LP={__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",Dl],appendBehavior:["type",Ll],associationBehavior:["type",Bl],attachEventBehavior:["type",zs],artifactBehavior:["type",Il],boundaryEventBehavior:["type",Nl],categoryRootElementReferenceBehavior:["type",$l],compensateBoundaryEventBehaviour:["type",Fl],createBehavior:["type",jl],createDataObjectBehavior:["type",Hl],createParticipantBehavior:["type",Vl],dataInputAssociationBehavior:["type",Wl],dataStoreBehavior:["type",Ul],deleteLaneBehavior:["type",ql],detachEventBehavior:["type",Xs],dropOnFlowBehavior:["type",Kl],eventBasedGatewayBehavior:["type",Xl],fixHoverBehavior:["type",rg],groupBehavior:["type",Zl],importDockingFix:["type",ag],isHorizontalFix:["type",Jl],labelBehavior:["type",tp],layoutConnectionBehavior:["type",np],messageFlowBehavior:["type",op],nonInterruptingBehavior:["type",ap],removeElementBehavior:["type",cp],removeEmbeddedLabelBoundsBehavior:["type",sp],removeParticipantBehavior:["type",up],replaceConnectionBehavior:["type",lp],replaceElementBehaviour:["type",ic],resizeBehavior:["type",Tg],resizeLaneBehavior:["type",Ig],rootElementReferenceBehavior:["type",hp],spaceToolBehavior:["type",Ng],subProcessPlaneBehavior:["type",Ii],subProcessStartEventBehavior:["type",gp],textAnnotationBehavior:["type",yp],toggleCollapseConnectionBehaviour:["type",vp],toggleElementCollapseBehaviour:["type",_p],unclaimIdBehavior:["type",xp],unsetDefaultFlowBehavior:["type",wp],updateFlowNodeRefsBehavior:["type",Ep],updateCategoryValueRefsBehavior:["type",Sp],setCompensationActivityAfterPasteBehavior:["type",Rp]};function Cp(e){this._commandStack=e.get("commandStack",!1)}Cp.$inject=["injector"],Cp.prototype.allowed=function(e,t){var n=!0,i=this._commandStack;return i&&(n=i.canExecute(e,t)),n===void 0?!0:n};const bi={__init__:["rules"],rules:["type",Cp]};function Yn(e){J.call(this,e),this.init()}Yn.$inject=["eventBus"],de(Yn,J),Yn.prototype.addRule=function(e,t,n){var i=this;typeof e=="string"&&(e=[e]),e.forEach(function(r){i.canExecute(r,t,function(o,a,s){return n(o)},!0)})},Yn.prototype.init=function(){};function Yg(e,t){var n=Jt(e,t,-15);return n!=="intersect"?n:null}function tn(e){Yn.call(this,e)}de(tn,Yn),tn.$inject=["eventBus"],tn.prototype.init=function(){this.addRule("connection.start",function(e){var t=e.source;return IP(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 uc(t,n)}finally{r&&(n.parent=null)}}),this.addRule("connection.reconnect",function(e){var t=e.connection,n=e.source,i=e.target;return uc(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 sy(t,n,i)}),this.addRule("elements.create",function(e){var t=e.elements,n=e.position,i=e.target;return at(i)&&!lc(t,i)?!1:Rr(t,function(r){return at(r)?uc(r.source,r.target,r):r.host?ga(r,r.host,null,n):Mp(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 ty(a)&&!n.includes(a.host)})?!1:ga(n,t,null,i)||oy(n,t,i)||ay(n,t)||lc(n,t)}),this.addRule("shape.create",function(e){return Mp(e.shape,e.target,e.source,e.position)}),this.addRule("shape.attach",function(e){return ga(e.shape,e.target,null,e.position)}),this.addRule("element.copy",function(e){var t=e.element,n=e.elements;return fy(n,t)})},tn.prototype.canConnectMessageFlow=ly,tn.prototype.canConnectSequenceFlow=py,tn.prototype.canConnectDataAssociation=kp,tn.prototype.canConnectAssociation=cy,tn.prototype.canConnectCompensationAssociation=uy,tn.prototype.canMove=ay,tn.prototype.canAttach=ga,tn.prototype.canReplace=oy,tn.prototype.canDrop=So,tn.prototype.canInsert=lc,tn.prototype.canCreate=Mp,tn.prototype.canConnect=uc,tn.prototype.canResize=sy,tn.prototype.canCopy=fy;function IP(e){return Pp(e)?null:ze(e,["bpmn:FlowNode","bpmn:InteractionNode","bpmn:DataObjectReference","bpmn:DataStoreReference","bpmn:Group","bpmn:TextAnnotation"])}function Pp(e){return!e||je(e)}function Kg(e){do{if(w(e,"bpmn:Process"))return te(e);if(w(e,"bpmn:Participant"))return te(e).processRef||te(e)}while(e=e.parent)}function Ap(e){return w(e,"bpmn:TextAnnotation")}function Tp(e){return w(e,"bpmn:Group")&&!e.labelTarget}function Xg(e){return w(e,"bpmn:BoundaryEvent")&&_i(e,"bpmn:CompensateEventDefinition")}function cc(e){return te(e).isForCompensation}function BP(e,t){var n=Kg(e),i=Kg(t);return n===i}function NP(e){return w(e,"bpmn:InteractionNode")&&!w(e,"bpmn:BoundaryEvent")&&(!w(e,"bpmn:Event")||w(e,"bpmn:ThrowEvent")&&Jg(e,"bpmn:MessageEventDefinition"))}function $P(e){return w(e,"bpmn:InteractionNode")&&!cc(e)&&(!w(e,"bpmn:Event")||w(e,"bpmn:CatchEvent")&&Jg(e,"bpmn:MessageEventDefinition"))&&!(w(e,"bpmn:BoundaryEvent")&&!_i(e,"bpmn:MessageEventDefinition"))}function Zg(e){for(var t=e;t=t.parent;){if(w(t,"bpmn:FlowElementsContainer"))return te(t);if(w(t,"bpmn:Participant"))return te(t).processRef}return null}function Qg(e,t){var n=Zg(e),i=Zg(t);return n===i}function _i(e,t){var n=te(e);return!!lt(n.eventDefinitions||[],function(i){return w(i,t)})}function Jg(e,t){var n=te(e);return(n.eventDefinitions||[]).every(function(i){return w(i,t)})}function FP(e){return w(e,"bpmn:FlowNode")&&!w(e,"bpmn:EndEvent")&&!un(e)&&!(w(e,"bpmn:IntermediateThrowEvent")&&_i(e,"bpmn:LinkEventDefinition"))&&!Xg(e)&&!cc(e)}function jP(e){return w(e,"bpmn:FlowNode")&&!w(e,"bpmn:StartEvent")&&!w(e,"bpmn:BoundaryEvent")&&!un(e)&&!(w(e,"bpmn:IntermediateCatchEvent")&&_i(e,"bpmn:LinkEventDefinition"))&&!cc(e)}function HP(e){return w(e,"bpmn:ReceiveTask")||w(e,"bpmn:IntermediateCatchEvent")&&(_i(e,"bpmn:MessageEventDefinition")||_i(e,"bpmn:TimerEventDefinition")||_i(e,"bpmn:ConditionalEventDefinition")||_i(e,"bpmn:SignalEventDefinition"))}function zP(e){for(var t=[];e;)e=e.parent,e&&t.push(e);return t}function ey(e,t){var n=zP(t);return n.indexOf(e)!==-1}function uc(e,t,n){if(Pp(e)||Pp(t))return null;if(!w(n,"bpmn:DataAssociation")){if(ly(e,t))return{type:"bpmn:MessageFlow"};if(py(e,t))return{type:"bpmn:SequenceFlow"}}var i=kp(e,t);return i||(uy(e,t)?{type:"bpmn:Association",associationDirection:"One"}:cy(e,t)?{type:"bpmn:Association",associationDirection:"None"}:!1)}function So(e,t){return je(e)||Tp(e)?!0:w(t,"bpmn:Participant")&&!We(t)?!1:w(e,"bpmn:Participant")?w(t,"bpmn:Process")||w(t,"bpmn:Collaboration"):ze(e,["bpmn:DataInput","bpmn:DataOutput"])&&e.parent?t===e.parent:w(e,"bpmn:Lane")?w(t,"bpmn:Participant")||w(t,"bpmn:Lane"):w(e,"bpmn:BoundaryEvent")&&!GP(e)?!1:w(e,"bpmn:FlowElement")&&!w(e,"bpmn:DataStoreReference")?w(t,"bpmn:FlowElementsContainer")?We(t):ze(t,["bpmn:Participant","bpmn:Lane"]):w(e,"bpmn:DataStoreReference")&&w(t,"bpmn:Collaboration")?Wi(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"]):w(e,"bpmn:MessageFlow")?w(t,"bpmn:Collaboration")||e.source.parent==t||e.target.parent==t:!1}function GP(e){return te(e).cancelActivity&&(ny(e)||iy(e))}function ty(e){return!je(e)&&w(e,"bpmn:BoundaryEvent")}function VP(e){return w(e,"bpmn:Lane")}function WP(e){return ty(e)||w(e,"bpmn:IntermediateThrowEvent")&&ny(e)?!0:w(e,"bpmn:IntermediateCatchEvent")&&iy(e)}function ny(e){var t=te(e);return t&&!(t.eventDefinitions&&t.eventDefinitions.length)}function iy(e){return ry(e,["bpmn:MessageEventDefinition","bpmn:TimerEventDefinition","bpmn:SignalEventDefinition","bpmn:ConditionalEventDefinition"])}function ry(e,t){return t.some(function(n){return _i(e,n)})}function UP(e){return w(e,"bpmn:ReceiveTask")&&lt(e.incoming,function(t){return w(t.source,"bpmn:EventBasedGateway")})}function ga(e,t,n,i){if(Array.isArray(e)||(e=[e]),e.length!==1)return!1;var r=e[0];return je(r)||!WP(r)||un(t)||!w(t,"bpmn:Activity")||cc(t)||i&&!Yg(i,t)||UP(t)?!1:"attach"}function oy(e,t,n){if(!t)return!1;var i={replacements:[]};return L(e,function(r){un(t)||w(r,"bpmn:StartEvent")&&r.type!=="label"&&So(r,t)&&(tR(r)||i.replacements.push({oldElementId:r.id,newElementType:"bpmn:StartEvent"}),(nR(r)||iR(r)||rR(r))&&i.replacements.push({oldElementId:r.id,newElementType:"bpmn:StartEvent"}),ry(r,["bpmn:MessageEventDefinition","bpmn:TimerEventDefinition","bpmn:SignalEventDefinition","bpmn:ConditionalEventDefinition"])&&w(t,"bpmn:SubProcess")&&i.replacements.push({oldElementId:r.id,newElementType:"bpmn:StartEvent"})),w(t,"bpmn:Transaction")||_i(r,"bpmn:CancelEventDefinition")&&r.type!=="label"&&(w(r,"bpmn:EndEvent")&&So(r,t)&&i.replacements.push({oldElementId:r.id,newElementType:"bpmn:EndEvent"}),w(r,"bpmn:BoundaryEvent")&&ga(r,t,null,n)&&i.replacements.push({oldElementId:r.id,newElementType:"bpmn:BoundaryEvent"}))}),i.replacements.length?i:!1}function ay(e,t){return Wi(e,VP)?!1:t===void 0?!0:t===null?!1:e.every(function(n){return So(n,t)})}function Mp(e,t,n,i){return t?je(e)||Tp(e)?!0:So(e,t)||lc(e,t):!1}function sy(e,t,n){return w(e,"bpmn:SubProcess")?We(e)&&(!t||t.width>=100&&t.height>=80):w(e,"bpmn:Lane")||w(e,"bpmn:Participant")?!0:Ap(e)?n?n==="e"||n==="w":!0:Tp(e)?!0:je(e)?n?n==="e"||n==="w":!0:!1}function qP(e,t){var n=Ap(e),i=Ap(t);return(n||i)&&n!==i}function cy(e,t){return ey(t,e)||ey(e,t)?!1:qP(e,t)?!0:!!kp(e,t)}function uy(e,t){return Qg(e,t)&&Xg(e)&&w(t,"bpmn:Activity")&&!KP(t,e)&&!un(t)}function ly(e,t){return hy(e)&&!hy(t)?!1:NP(e)&&$P(t)&&!BP(e,t)}function py(e,t){return FP(e)&&jP(t)&&Qg(e,t)&&!(w(e,"bpmn:EventBasedGateway")&&!HP(t))}function kp(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 lc(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"])&&!je(t)&&w(e,"bpmn:FlowNode")&&!w(e,"bpmn:BoundaryEvent")&&So(e,t.parent)}function Op(e,t){return e&&t&&e.indexOf(t)!==-1}function fy(e,t){return je(t)?!0:!(w(t,"bpmn:Lane")&&!Op(e,t.parent)||w(t,"bpmn:MessageFlow")&&!YP(e,t))}function YP(e,t){var n=dy(t.source),i=dy(t.target);return Op(e,n)&&Op(e,i)}function dy(e){for(;e;e=e.parent)if(w(e,"bpmn:Participant"))return e;return null}function hy(e){return yo(e,"bpmn:Process")||yo(e,"bpmn:Collaboration")}function KP(e,t){return e.attachers.includes(t)}const XP={__depends__:[bi],__init__:["bpmnRules"],bpmnRules:["type",tn]};var ZP=2e3;function my(e,t){e.on("saveXML.start",ZP,n);function n(){var i=t.getRootElements();L(i,function(r){var o=Ye(r),a,s;a=Jo([r]),a=Ge(a,function(c){return c!==r&&!c.labelTarget}),s=on(a,Ye),o.set("planeElement",s)})}}my.$inject=["eventBus","canvas"];const QP={__init__:["bpmnDiOrdering"],bpmnDiOrdering:["type",my]};function pc(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)})}pc.prototype.getOrdering=function(e,t){return null},de(pc,J);function Dp(e,t){pc.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||w(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=ld(s.children,function(f){return!a.labelTarget&&f.labelTarget?!1:c.level<r(f).level});return l!==-1&&u!==-1&&u<l&&(l-=1),{index:l,parent:s}}}Dp.$inject=["eventBus","canvas"],de(Dp,pc);const JP={__init__:["bpmnOrderingProvider"],bpmnOrderingProvider:["type",Dp]};function ya(){}ya.prototype.get=function(){return this._data},ya.prototype.set=function(e){this._data=e},ya.prototype.clear=function(){var e=this._data;return delete this._data,e},ya.prototype.isEmpty=function(){return!this._data};const eA={clipboard:["type",ya]};var gy=1500;function yy(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",gy,function(s){o(s)})}),(function(){var a,s;t.on("element.hover",function(c){a=c.gfx,s=c.element}),t.on("element.hover",gy,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=Ir(a),c=document.elementFromPoint(s.x,s.y),tA(c)}}yy.$inject=["elementRegistry","eventBus","injector"];function tA(e){return Tr(e,"svg, .djs-element",!0)}const nA={__init__:["hoverFix"],hoverFix:["type",yy]};function iA(e){return!0}function fc(e){return sr(e)||cP(e)}var vy=500;function by(e,t,n){var i=this;function r(T,$,k){if(!s(T,$)){var O,j,oe;k?j=t.getGraphics(k):(O=$.delegateTarget||$.target,O&&(j=O,k=t.get(j))),!(!j||!k)&&(oe=e.fire(T,{element:k,gfx:j,originalEvent:$}),oe===!1&&($.stopPropagation(),$.preventDefault()))}}var o={};function a(T){return o[T]}function s(T,$){var k=u[T]||sr;return!k($)}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":iA,"element.mousedown":fc,"element.mouseup":fc,"element.click":fc,"element.dblclick":fc};function l(T,$,k){var O=c[T];if(!O)throw new Error("unmapped DOM event name <"+T+">");return r(O,$,k)}var f="svg, .djs-element";function p(T,$,k,O){var j=o[k]=function(oe){r(k,oe)};O&&(u[k]=O),j.$delegate=Cn.bind(T,f,$,j)}function d(T,$,k){var O=a(k);O&&Cn.unbind(T,$,O.$delegate)}function g(T){L(c,function($,k){p(T,k,$)})}function h(T){L(c,function($,k){d(T,k,$)})}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 $=T.element,k=T.gfx;e.fire("interactionEvents.createHit",{element:$,gfx:k})}),e.on(["shape.changed","connection.changed"],vy,function(T){var $=T.element,k=T.gfx;e.fire("interactionEvents.updateHit",{element:$,gfx:k})}),e.on("interactionEvents.createHit",vy,function(T){var $=T.element,k=T.gfx;i.createDefaultHit($,k)}),e.on("interactionEvents.updateHit",function(T){var $=T.element,k=T.gfx;i.updateDefaultHit($,k)});var m=P("djs-hit djs-hit-stroke"),_=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":_,stroke:m,"no-move":x};function P(T,$){return $=z({stroke:"white",strokeWidth:15},$||{}),n.cls(T,["no-fill","no-border"],$)}function C(T,$){var k=S[$];if(!k)throw new Error("invalid hit type <"+$+">");return he(T,k),T}function D(T,$){Ne(T,$)}this.removeHits=function(T){var $=Es(".djs-hit",T);L($,jt)},this.createDefaultHit=function(T,$){var k=T.waypoints,O=T.isFrame,j;return k?this.createWaypointsHit($,k):(j=O?"stroke":"all",this.createBoxHit($,j,{width:T.width,height:T.height}))},this.createWaypointsHit=function(T,$){var k=Qo($);return C(k,"stroke"),D(T,k),k},this.createBoxHit=function(T,$,k){k=z({x:0,y:0},k);var O=Ce("rect");return C(O,$),he(O,k),D(T,O),O},this.updateDefaultHit=function(T,$){var k=rt(".djs-hit",$);if(k)return T.waypoints?bl(k,T.waypoints):he(k,{width:T.width,height:T.height}),k},this.fire=r,this.triggerMouseEvent=l,this.mouseHandler=a,this.registerEvent=p,this.unregisterEvent=d}by.$inject=["eventBus","elementRegistry","styles"];const dc={__init__:["interactionEvents"],interactionEvents:["type",by]};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 _y="hover",xy="selected";function wy(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,_y)}),t.on("element.out",function(r){i(r.element,_y)}),t.on("selection.changed",function(r){function o(u){i(u,xy)}function a(u){n(u,xy)}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)})}wy.$inject=["canvas","eventBus"];function Ey(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(rA))}}),e.on("connect.end",500,function(r){var o=r.context,a=o.connection;a&&t.select(a)}),e.on("shape.move.end",500,function(r){var o=r.previousSelection||[],a=i.get(r.context.shape.id),s=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=ac(r);if(a&&s)return c?t.deselect(o):t.select(o);a?t.deselect(o):t.select(o,c)}})}Ey.$inject=["eventBus","selection","canvas","elementRegistry"];function rA(e){return!e.hidden}const Kn={__init__:["selectionVisuals","selectionBehavior"],__depends__:[dc],selection:["type",Ro],selectionVisuals:["type",wy],selectionBehavior:["type",Ey]};var oA=/^djs-cursor-.*$/;function hc(e){var t=vt(document.body);t.removeMatching(oA),e&&t.add("djs-cursor-"+e)}function Sy(){hc(null)}var aA=5e3;function Ry(e,t){t=t||"element.click";function n(){return!1}return e.once(t,aA,n),function(){e.off(t,n)}}var sA=["c","C"],cA=["v","V"],uA=["d","D"],lA=["x","X"],pA=["y","Y"],Cy=["z","Z"];function fA(e){return e.ctrlKey||e.metaKey||e.shiftKey||e.altKey}function Tn(e){return e.altKey?!1:e.ctrlKey||e.metaKey}function Ht(e,t){return e=ke(e)?e:[e],e.indexOf(t.key)!==-1||e.indexOf(t.code)!==-1}function Lp(e){return e.shiftKey}function dA(e){return Tn(e)&&Ht(sA,e)}function hA(e){return Tn(e)&&Ht(cA,e)}function mA(e){return Tn(e)&&Ht(uA,e)}function gA(e){return Tn(e)&&Ht(lA,e)}function yA(e){return Tn(e)&&!Lp(e)&&Ht(Cy,e)}function vA(e){return Tn(e)&&(Ht(pA,e)||Ht(Cy,e)&&Lp(e))}var Co=Math.round,Py="djs-drag-active";function Nr(e){e.preventDefault()}function bA(e){return typeof TouchEvent<"u"&&e instanceof TouchEvent}function _A(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}function Ay(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(z({},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=Ir(x),$=oi(T,D),k=o.localStart,O=a(T),j=oi(O,k);if(!o.active&&(S||_A($)>o.threshold)){if(z(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&&hc(o.cursor),t.addMarker(t.getRootElement(),Py)}dp(x),o.active&&(z(P,{x:Co(O.x+C.x),y:Co(O.y+C.y),dx:Co(j.x),dy:Co(j.y)},{originalEvent:x}),s("move"))}function l(x){var S,P=!0;o.active&&(x&&(o.payload.originalEvent=x,dp(x)),P=s("end")),P===!1&&s("rejected"),S=_(P!==!0),s("ended",S)}function f(x){Ht("Escape",x)&&(Nr(x),m())}function p(x){var S;o.active&&(S=Ry(e),setTimeout(S,400),Nr(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=_(x),P&&s("canceled",S)}}function _(x){var S,P;s("cleanup"),Sy(),o.trapClick?P=p:P=l,Be.unbind(document,"mousemove",u),Be.unbind(document,"dragstart",Nr),Be.unbind(document,"selectstart",Nr),Be.unbind(document,"mousedown",P,!0),Be.unbind(document,"mouseup",P,!0),Be.unbind(document,"keyup",f),Be.unbind(document,"touchstart",d,!0),Be.unbind(document,"touchcancel",m,!0),Be.unbind(document,"touchmove",u,!0),Be.unbind(document,"touchend",l,!0),e.off("element.hover",g),e.off("element.out",h),t.removeMarker(t.getRootElement(),Py);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=z({},r,C||{});var D=C.data||{},T,$,k,O,j;if(C.trapClick?O=p:O=l,x?(T=Eo(x)||x,$=Ir(x),dp(x),T.type==="dragstart"&&Nr(T)):(T=null,$={x:0,y:0}),k=a($),S||(S=k),j=bA(T),o=z({prefix:P,data:D,payload:{},globalStart:$,displacement:oi(S,k),localStart:k,isTouch:j},C),C.manual||(j?(Be.bind(document,"touchstart",d,!0),Be.bind(document,"touchcancel",m,!0),Be.bind(document,"touchmove",u,!0),Be.bind(document,"touchend",l,!0)):(Be.bind(document,"mousemove",u),Be.bind(document,"dragstart",Nr),Be.bind(document,"selectstart",Nr),Be.bind(document,"mousedown",O,!0),Be.bind(document,"mouseup",O,!0)),Be.bind(document,"keyup",f),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){z(r,x)}}Ay.$inject=["eventBus","canvas","selection","elementRegistry"];const Bi={__depends__:[nA,Kn],dragging:["type",Ay]};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 xA=new Po("ps");var wA=["marker-start","marker-mid","marker-end"],EA=["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=Hh(n);return this._cloneMarkers(Or(r),i),he(r,this._styles.cls(i,[])),Ne(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 Ne(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)}),PA(e)&&wA.forEach(function(r){if(he(e,r)){var o=SA(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,xA.next()].join("-"),a=rt("marker#"+n.id,e);e=e||this._canvas._svg;var s=a||Hh(n);s.id=o,qe(s).add(r);var c=rt(":scope > defs",e);c||(c=Ce("defs"),Ne(e,c)),Ne(c,s);var u=CA(s.id);he(t,i,u)};function SA(e,t,n){var i=RA(he(e,t));return rt("marker#"+i,n||document)}function RA(e){return e.match(/url\(['"]?#([^'"]*)['"]?\)/)[1]}function CA(e){return"url(#"+e+")"}function PA(e){return EA.indexOf(e.nodeName)!==-1}const Ao={__init__:["previewSupport"],previewSupport:["type",cr]};var AA="drop-ok",Ty="drop-not-ok",My="attach-ok",ky="new-parent",Oy="create",TA=2e3;function Dy(e,t,n,i,r){function o(c,u,l,f,p){if(!u)return!1;c=Ge(c,function(y){var x=y.labelTarget;return!y.parent&&!(je(y)&&c.indexOf(x)!==-1)});var d=lt(c,function(y){return!at(y)}),g=!1,h=!1,m=!1;Iy(c)&&(g=r.allowed("shape.attach",{position:l,shape:d,target:u})),g||(Iy(c)?m=r.allowed("shape.create",{position:l,shape:d,source:f,target:u}):m=r.allowed("elements.create",{elements:c,position:l,target:u}));var _=p.connectionTarget;return m||g?(d&&f&&(h=r.allowed("connection.create",{source:_===f?d:f,target:_===f?f:d,hints:{targetParent:u,targetAttach:g}})),{attach:g,connect:h}):m===null||g===null?null:!1}function a(c,u){[My,AA,Ty,ky].forEach(function(l){l===u?e.addMarker(c,l):e.removeMarker(c,l)})}n.on(["create.move","create.hover"],function(c){var u=c.context,l=u.elements,f=c.hover,p=u.source,d=u.hints||{};if(!f){u.canExecute=!1,u.target=null;return}Ly(c);var g={x:c.x,y:c.y},h=u.canExecute=f&&o(l,f,g,p,d);f&&h!==null&&(u.target=f,h&&h.attach?a(f,My):a(f,h?ky:Ty))}),n.on(["create.end","create.out","create.cleanup"],function(c){var u=c.hover;u&&a(u,null)}),n.on("create.end",function(c){var u=c.context,l=u.source,f=u.shape,p=u.elements,d=u.target,g=u.canExecute,h=g&&g.attach,m=g&&g.connect,_=u.hints||{};if(g===!1||!d)return!1;Ly(c);var y={x:c.x,y:c.y};m?f=i.appendShape(l,f,y,d,{attach:h,connection:m===!0?{}:m,connectionTarget:_.connectionTarget}):(p=i.createElements(p,y,d,z({},_,{attach:h})),f=lt(p,function(x){return!at(x)})),z(u,{elements:p,shape:f}),z(c,{elements:p,shape:f})});function s(){var c=t.context();c&&c.prefix===Oy&&t.cancel()}n.on("create.init",function(){n.on("elements.changed",s),n.once(["create.cancel","create.end"],TA,function(){n.off("elements.changed",s)})}),this.start=function(c,u,l){ke(u)||(u=[u]);var f=lt(u,function(g){return!at(g)});if(f){l=z({elements:u,hints:{},shape:f},l||{}),L(u,function(g){Le(g.x)||(g.x=0),Le(g.y)||(g.y=0)});var p=Ge(u,function(g){return!g.hidden}),d=Tt(p);L(u,function(g){at(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}})),z(g,{x:g.x-d.x-d.width/2,y:g.y-d.y-d.height/2})}),t.init(c,Oy,{cursor:"grabbing",autoActivate:!0,data:{shape:f,elements:u,context:l}})}}}Dy.$inject=["canvas","dragging","eventBus","modeling","rules"];function Ly(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 Iy(e){return e&&e.length===1&&!at(e[0])}var MA=750;function By(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(Or(l),u)):(l=n._createContainer("shape",c),n.drawShape(Or(l),u),en(l,u.x,u.y)),i.addDragger(u,s,l))}),s}t.on("create.move",MA,function(a){var s=a.hover,c=a.context,u=c.elements,l=c.dragGroup;l||(l=c.dragGroup=o(u));var f;s?(l.parentNode||(f=e.getActiveLayer(),Ne(f,l)),en(l,a.x,a.y)):jt(l)}),t.on("create.cleanup",function(a){var s=a.context,c=s.dragGroup;c&&jt(c)})}By.$inject=["canvas","eventBus","graphicsFactory","previewSupport","styles"];const mc={__depends__:[Bi,Ao,bi,Kn],__init__:["create","createPreview"],create:["type",Dy],createPreview:["type",By]};function Ip(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)})}Ip.$inject=["eventBus"],Ip.prototype.getLastMoveEvent=function(){return this._lastMoveEvent||kA(0,0)};function kA(e,t){var n=document.createEvent("MouseEvent"),i=e,r=t,o=e,a=t;return n.initMouseEvent&&n.initMouseEvent("mousemove",!0,!0,window,0,i,r,o,a,!1,!1,!1,!1,0,null),n}const va={__init__:["mouse"],mouse:["type",Ip]};var Ny=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,f=c.elementsSet;u.priority=1,u.id=l.id,f.has(l.parent)&&(u.parent=l.parent.id),OA(l)&&(u.priority=2,u.host=l.host.id),at(l)&&(u.priority=3,u.source=l.source.id,u.target=l.target.id,u.waypoints=DA(l)),je(l)&&(u.priority=4,u.labelTarget=l.labelTarget.id),L(["x","y","width","height"],function(p){Le(l[p])&&(u[p]=l[p])}),u.hidden=l.hidden,u.collapsed=l.collapsed}),r.on("copyPaste.elementsCopied",Ny,function(c){var u;((u=c.hints)==null?void 0:u.clip)!==!1&&n.set(c.tree)}),r.on("copyPaste.pasteElements",Ny,function(c){c.tree||(c.tree=n.get())}),r.on("copyPaste.pasteElements",function(c){var u=c.hints;z(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){at(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}})),z(o,{x:o.x-r.x-r.width/2,y:o.y-r.y-r.height/2})}),this._modeling.createElements(e,n,t,z({},i))},Mn.prototype._createElements=function(e){var t=this,n=this._eventBus,i={},r=[];return L(e,function(o,a){o=ci(o,"priority"),L(o,function(s){var c=z({},ui(s,["priority"]));i[s.parent]?c.parent=i[s.parent]:delete c.parent,n.fire("copyPaste.pasteElement",{cache:i,descriptor:c});var u;if(at(c)){c.source=i[s.source],c.target=i[s.target],u=i[s.id]=t.createConnection(c),r.push(u);return}if(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},Mn.prototype.createConnection=function(e){var t=this._elementFactory.createConnection(ui(e,["id"]));return t},Mn.prototype.createLabel=function(e){var t=this._elementFactory.createLabel(ui(e,["id"]));return t},Mn.prototype.createShape=function(e){var t=this._elementFactory.createShape(ui(e,["id"]));return t},Mn.prototype.hasRelations=function(e,t,n){return n||(n=new Set(t)),!(at(e)&&(!n.has(e.source)||!n.has(e.target))||je(e)&&!n.has(e.labelTarget))},Mn.prototype.createTree=function(e){var t=this._rules,n=this,i={},r=[],o=new Map,a=Ps(e);function s(f,p){return t.allowed("element.copy",{element:f,elements:p})}function c(f,p){var d=o.get(f);if(!d){var g={element:f,depth:p};r.push(g),o.set(f,g);return}if(d.depth<p){r=u(d,r);var h={element:d.element,depth:p};r.push(h),o.set(f,h)}}function u(f,p){var d=p.indexOf(f);return d!==-1&&p.splice(d,1),p}kr(a,function(f,p,d){if(je(f))return;L(f.labels,function(m){c(m,d)});function g(m){m&&m.length&&L(m,function(_){L(_.labels,function(y){c(y,d)}),c(_,d)})}L([f.attachers,f.incoming,f.outgoing],g),c(f,d);var h=[];return f.children&&(h=f.children.slice()),n._eventBus.fire("copyPaste.createTree",{element:f,children:h}),h}),e=on(r,function(f){return f.element});var l=new Set(e);return r=on(r,function(f){return f.descriptor={},n._eventBus.fire("copyPaste.copyElement",{descriptor:f.descriptor,element:f.element,elements:e,elementsSet:l}),f}),r=ci(r,function(f){return f.descriptor.priority}),e=on(r,function(f){return f.element}),L(r,function(f){var p=f.depth;if(!n.hasRelations(f.element,e,l)){Fy(f.element,e),l.delete(f.element);return}if(!s(f.element,e)){Fy(f.element,e),l.delete(f.element);return}i[p]||(i[p]=[]),i[p].push(f.descriptor)}),i};function OA(e){return!!e.host}function DA(e){return on(e.waypoints,function(t){return t=$y(t),t.original&&(t.original=$y(t.original)),t})}function $y(e){return z({},e)}function Fy(e,t){var n=t.indexOf(e);return n===-1?t:t.splice(n,1)}const LA={__depends__:[eA,mc,va,bi],__init__:["copyPaste"],copyPaste:["type",Mn]};function Bp(e,t,n){ke(n)||(n=[n]),L(n,function(i){Sr(e[i])||(t[i]=e[i])})}var Np=750;function jy(e,t,n){function i(c,u){var l=e.create(c.$type);return n.copyElement(c,l,null,u)}t.on("copyPaste.copyElement",Np,function(c){var u=c.descriptor,l=c.element,f=te(l);if(je(l))return u;var p=u.businessObject=i(f,!0),d=u.di=i(Ye(l),!0);d.bpmnElement=p,Bp(p,u,"name"),Bp(d,u,"isExpanded"),f.default&&(u.default=f.default.id)});var r="-bpmn-js-refs";function o(c){return c[r]=c[r]||{}}function a(c,u){c[r]=u}function s(c,u,l){var f=te(c);return c.default&&(l[c.default]={element:f,property:"default"}),c.host&&(te(c).attachedToRef=te(u[c.host])),ui(l,Sn(l,function(p,d,g){var h=d.element,m=d.property;return g===c.id&&(h.set(m,f),p.push(c.id)),p},[]))}t.on("copyPaste.pasteElement",function(c){var u=c.cache,l=c.descriptor,f=l.businessObject,p=l.di;if(je(l)){l.businessObject=te(u[l.labelTarget]),l.di=Ye(u[l.labelTarget]);return}f=l.businessObject=i(f),p=l.di=i(p),p.bpmnElement=f,Bp(l,f,["isExpanded","name"]),l.type=f.$type}),t.on("copyPaste.copyElement",Np,function(c){var u=c.descriptor,l=c.element;if(w(l,"bpmn:Participant")){var f=te(l);f.processRef&&(u.processRef=i(f.processRef,!0))}}),t.on("copyPaste.pasteElement",function(c){var u=c.descriptor,l=u.processRef;l&&(u.processRef=i(l))}),t.on("copyPaste.createTree",function(c){var u=c.element,l=c.children;w(u,"bpmn:SubProcess")&&L(oa(l),f=>{l.push(f.annotation)})}),t.on("copyPaste.pasteElement",Np,function(c){var u=c.cache,l=c.descriptor;a(u,s(l,u,o(u)))})}jy.$inject=["bpmnFactory","eventBus","moddleCopy"];const IA=["artifacts","dataInputAssociations","dataOutputAssociations","default","flowElements","lanes","incoming","outgoing","categoryValue"],BA=["errorRef","escalationRef","messageRef","signalRef","dataObjectRef"];function ba(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 ci(r,o=>o==="extensionElements")}),e.on("moddleCopy.canCopyProperty",i=>{const{parent:r,property:o,propertyName:a}=i,s=Vt(r)&&r.$descriptor;if(a&&BA.includes(a))return o;if(a&&IA.includes(a)||a&&s&&!lt(s.properties,eo({name:a})))return!1}),e.on("moddleCopy.canSetCopiedProperty",i=>{const{property:r}=i;if(w(r,"bpmn:ExtensionElements")&&(!r.values||!r.values.length))return!1})}ba.$inject=["eventBus","bpmnFactory","moddle"],ba.prototype.copyElement=function(e,t,n,i=!1){n&&!ke(n)&&(n=[n]),n=n||$p(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;En(e,o)&&(a=e.get(o));const s=this.copyProperty(a,t,o,i);!$t(s)||this._eventBus.fire("moddleCopy.canSetCopiedProperty",{parent:t,property:s,propertyName:o})===!1||t.set(o,s)})),t},ba.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)?Sn(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},ba.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 $p(e,t){return Sn(e.properties,(n,i)=>t&&i.default?n:n.concat(i.name),[])}const Hy={__depends__:[LA],__init__:["bpmnCopyPaste","moddleCopy"],bpmnCopyPaste:["type",jy],moddleCopy:["type",ba]};var zy=Math.round;function Fp(e,t){this._modeling=e,this._eventBus=t}Fp.$inject=["modeling","eventBus"],Fp.prototype.replaceElement=function(e,t,n){if(e.waypoints)return null;var i=this._modeling,r=this._eventBus;r.fire("replace.start",{element:e,attrs:t,hints:n});var o=t.width||e.width,a=t.height||e.height,s=t.x||e.x,c=t.y||e.y,u=zy(s+o/2),l=zy(c+a/2),f=i.replaceShape(e,z({},t,{x:u,y:l,width:o,height:a}),n);return r.fire("replace.end",{element:e,newElement:f,hints:n}),f};function Gy(e,t){t.on("replace.end",500,function(n){const{newElement:i,hints:r={}}=n;r.select!==!1&&e.select(i)})}Gy.$inject=["selection","eventBus"];const NA={__init__:["replace","replaceSelectionBehavior"],replaceSelectionBehavior:["type",Gy],replace:["type",Fp]};function $A(e,t,n){ke(n)||(n=[n]),L(n,function(i){Sr(e[i])||(t[i]=e[i])})}var FA=["cancelActivity","instantiate","eventGatewayType","triggeredByEvent","isInterrupting"];function jA(e,t){var n=e&&En(e,"collapsed")?e.collapsed:!We(e),i;return t&&(En(t,"collapsed")||En(t,"isExpanded"))?i=En(t,"collapsed")?t.collapsed:!t.isExpanded:i=n,n!==i}function Vy(e,t,n,i,r,o){function a(s,c,u){u=u||{};var l=c.type,f=s.businessObject;if(gc(f)&&(l==="bpmn:SubProcess"||l==="bpmn:AdHocSubProcess")&&jA(s,c))return i.toggleCollapse(s),s;var p=e.create(l),d={type:l,businessObject:p};d.di={},l==="bpmn:ExclusiveGateway"&&(d.di.isMarkerVisible=!0),$A(s.di,d.di,["fill","stroke","background-color","border-color","color"]);var g=$p(f.$descriptor),h=$p(p.$descriptor,!0),m=HA(g,h);z(p,ni(c,FA));var _=Ge(m,function(S){return S==="eventDefinitions"?Wy(s,c.eventDefinitionType):S==="loopCharacteristics"?!un(p):En(p,S)||S==="processRef"&&c.isExpanded===!1||S==="triggeredByEvent"?!1:S==="isForCompensation"?!un(p):!0});if(p=n.copyElement(f,p,_),c.eventDefinitionType&&(Wy(p,c.eventDefinitionType)||(d.eventDefinitionType=c.eventDefinitionType,d.eventDefinitionAttrs=c.eventDefinitionAttrs)),w(f,"bpmn:Activity")){if(gc(f))d.isExpanded=We(s);else if(c&&En(c,"isExpanded")){d.isExpanded=c.isExpanded;var y=t.getDefaultSize(p,{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}We(s)&&!w(f,"bpmn:Task")&&d.isExpanded&&(d.width=s.width,d.height=s.height)}if(gc(f)&&!gc(p)&&(u.moveChildren=!1),w(f,"bpmn:Participant")){c.isExpanded===!0?p.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:p})||(d.height=t.getDefaultSize(d).height,d.width=t.getDefaultSize(d).width),p.name=f.name,ze(f,["bpmn:ExclusiveGateway","bpmn:InclusiveGateway","bpmn:Activity"])&&ze(p,["bpmn:ExclusiveGateway","bpmn:InclusiveGateway","bpmn:Activity"])&&(p.default=f.default),c.host&&!w(f,"bpmn:BoundaryEvent")&&w(p,"bpmn:BoundaryEvent")&&(d.host=c.host),(d.type==="bpmn:DataStoreReference"||d.type==="bpmn:DataObjectReference")&&(d.x=s.x+(s.width-d.width)/2),r.replaceElement(s,d,{...u,targetElement:c})}this.replaceElement=a}Vy.$inject=["bpmnFactory","elementFactory","moddleCopy","modeling","replace","rules"];function gc(e){return w(e,"bpmn:SubProcess")}function Wy(e,t){var n=te(e);return t&&n.get("eventDefinitions").some(function(i){return w(i,t)})}function HA(e,t){return e.filter(function(n){return t.includes(n)})}const Uy={__depends__:[Hy,NA,Kn],bpmnReplace:["type",Vy]};var zA=250;function $r(e){this._eventBus=e,this._tools=[],this._active=null}$r.$inject=["eventBus"],$r.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)},$r.prototype.isActive=function(e){return e&&this._active===e},$r.prototype.length=function(e){return this._tools.length},$r.prototype.setActive=function(e){var t=this._eventBus;this._active!==e&&(this._active=e,t.fire("tool-manager.update",{tool:e}))},$r.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,zA,function(r){this._active&&(GA(r)||this.setActive(null))},this)};function GA(e){var t=e.originalEvent&&e.originalEvent.target;return t&&Tr(t,'.group[data-group="tools"]')}const yc={__depends__:[Bi],__init__:["toolManager"],toolManager:["type",$r]};function VA(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 WA(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 UA(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 jp=Math.abs,qA=Math.round,Ni={x:"width",y:"height"},qy="crosshair",ur={n:"top",w:"left",s:"bottom",e:"right"},YA=1500,vc={n:"s",w:"e",s:"n",e:"w"},bc=20;function Xn(e,t,n,i,r,o,a){this._canvas=e,this._dragging=t,this._eventBus=n,this._modeling=i,this._rules=r,this._toolManager=o,this._mouse=a;var s=this;o.registerTool("space",{tool:"spaceTool.selection",dragging:"spaceTool"}),n.on("spaceTool.selection.end",function(c){n.once("spaceTool.selection.ended",function(){s.activateMakeSpace(c.originalEvent)})}),n.on("spaceTool.move",YA,function(c){var u=c.context,l=u.initialized;l||(l=u.initialized=s.init(c,u)),l&&Ky(c)}),n.on("spaceTool.end",function(c){var u=c.context,l=u.axis,f=u.direction,p=u.movingShapes,d=u.resizingShapes,g=u.start;if(u.initialized){Ky(c);var h={x:0,y:0};h[l]=qA(c["d"+l]),s.makeSpace(p,d,h,f,g),n.once("spaceTool.ended",function(m){s.activateSelection(m.originalEvent,!0,!0)})}})}Xn.$inject=["canvas","dragging","eventBus","modeling","rules","toolManager","mouse"],Xn.prototype.activateSelection=function(e,t,n){this._dragging.init(e,"spaceTool.selection",{autoActivate:t,cursor:qy,data:{context:{reactivate:n}},trapClick:!1})},Xn.prototype.activateMakeSpace=function(e){this._dragging.init(e,"spaceTool",{autoActivate:!0,cursor:qy,data:{context:{}}})},Xn.prototype.makeSpace=function(e,t,n,i,r){return this._modeling.createSpace(e,t,n,i,r)},Xn.prototype.init=function(e,t){var n=jp(e.dx)>jp(e.dy)?"x":"y",i=e["d"+n],r=e[n]-i;if(jp(i)<5)return!1;i<0&&(i*=-1),ma(e)&&(i*=-1);var o=VA(n,i),a=this._canvas.getRootElement();!ac(e)&&e.hover&&(a=e.hover);var s=[...Jo(a),...a.attachers||[]],c=this.calculateAdjustments(s,n,i,r),u=this._eventBus.fire("spaceTool.getMinDimensions",{axis:n,direction:o,shapes:c.resizingShapes,start:r}),l=KA(c,n,o,r,u);return z(t,c,{axis:n,direction:o,spaceToolConstraints:l,start:r}),hc("resize-"+(n==="x"?"ew":"ns")),!0},Xn.prototype.calculateAdjustments=function(e,t,n,i){var r=this._rules,o=[],a=[],s=new Set,c=new Set,u=[],l=[];function f(d){s.has(d)||(s.add(d),o.push(d));var g=d.label;g&&!s.has(g)&&(s.add(g),o.push(g))}function p(d){c.has(d)||(c.add(d),a.push(d))}return L(e,function(d){if(!(!d.parent||je(d))){if(at(d)){l.push(d);return}var g=d[t],h=g+d[Ni[t]];if(XA(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){f(d);return}if(g<i&&h>i&&r.allowed("shape.resize",{shape:d})){p(d);return}}}),L(o,function(d){var g=d.attachers;g&&L(g,function(h){f(h)})}),L(u,function(d){var g=d.host;(s.has(g)||c.has(g))&&f(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&&f(m)}),{movingShapes:o,resizingShapes:a}},Xn.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateSelection(e,!!e)},Xn.prototype.isActive=function(){var e=this._dragging.context();return e?/^spaceTool/.test(e.prefix):!1};function Yy(e){return{top:e.top-bc,right:e.right+bc,bottom:e.bottom+bc,left:e.left-bc}}function Ky(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 KA(e,t,n,i,r){var o=e.movingShapes,a=e.resizingShapes;if(a.length){var s={},c,u,l=new Set(o),f=new Set(a);return L(a,function(p){var d=p.attachers,g=p.children,h=Pe(p),m=Ge(g,function(j){return!at(j)&&!je(j)&&!l.has(j)&&!f.has(j)}),_=Ge(g,function(j){return!at(j)&&!je(j)&&l.has(j)}),y,x,S,P=[],C=[],D,T,$,k;m.length&&(x=Yy(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)),_.length&&(S=Yy(Pe(Tt(_))),y=i-S[ur[vc[n]]]+h[ur[vc[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(j){l.has(j)?P.push(j):C.push(j)}),P.length&&(D=Pe(Tt(P.map(Oe))),T=h[ur[vc[n]]]-(D[ur[vc[n]]]-i)),C.length&&($=Pe(Tt(C.map(Oe))),k=$[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[p.id];O&&(n==="n"?(y=i+p[Ni[t]]-O[Ni[t]],s.bottom=u=Le(u)?Math.min(u,y):y):n==="w"?(y=i+p[Ni[t]]-O[Ni[t]],s.right=u=Le(u)?Math.min(u,y):y):n==="s"?(y=i-p[Ni[t]]+O[Ni[t]],s.top=c=Le(c)?Math.max(c,y):y):n==="e"&&(y=i-p[Ni[t]]+O[Ni[t]],s.left=c=Le(c)?Math.max(c,y):y))}),s}}function XA(e){return!!e.host}var Hp="djs-dragging",Xy="djs-resizing",ZA=250,_c=Math.max;function Zy(e,t,n,i,r){function o(a,s){L(a,function(c){r.addDragger(c,s),n.addMarker(c,Hp)})}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"])),Ne(s,l);var f=Ce("path");he(f,"d",u.x),qe(f).add("djs-crosshair"),Ne(l,f);var p=Ce("path");he(p,"d",u.y),qe(p).add("djs-crosshair"),Ne(l,p),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&&jt(c)}),e.on("spaceTool.move",ZA,function(a){var s=a.context,c=s.line,u=s.axis,l=s.movingShapes,f=s.resizingShapes;if(s.initialized){if(!s.dragGroup){var p=n.getLayer("space");c=Ce("path"),he(c,"d","M0,0 L0,0"),qe(c).add("djs-crosshair"),Ne(p,c),s.line=c;var d=Ce("g");he(d,i.cls("djs-drag-group",["no-events"])),Ne(n.getActiveLayer(),d),o(l,d);var g=new Set(l);L(f,function(C){g.add(C)});var h=new Set,m=s.movingConnections=[];g.forEach(function(C){L(C.outgoing,function(D){h.has(D)||!at(D)||!g.has(D.target)||(h.add(D),m.push(D))})}),o(m,d),s.dragGroup=d}if(!s.frameGroup){var _=Ce("g");he(_,i.cls("djs-frame-group",["no-events"])),Ne(n.getActiveLayer(),_);var y=[];L(f,function(C){var D=r.addFrame(C,_),T=D.getBBox();y.push({element:D,initialBounds:T}),n.addMarker(C,Xy)}),s.frameGroup=_,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,$,k;s.direction==="e"?he(D,{width:_c(T.width+P.x,5)}):($=_c(T.width-P.x,5),he(D,{width:$,x:T.x+T.width-$})),s.direction==="s"?he(D,{height:_c(T.height+P.y,5)}):(k=_c(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,f=s.line,p=s.dragGroup,d=s.frameGroup;L(c,function(g){n.removeMarker(g,Hp)}),L(u,function(g){n.removeMarker(g,Hp)}),p&&(jt(f),jt(p)),L(l,function(g){n.removeMarker(g,Xy)}),d&&jt(d)})}Zy.$inject=["eventBus","elementRegistry","canvas","styles","previewSupport"];const QA={__init__:["spaceToolPreview"],__depends__:[Bi,bi,yc,Ao,va],spaceTool:["type",Xn],spaceToolPreview:["type",Zy]};function xc(e,t){e.invoke(Xn,this),this._canvas=t}xc.$inject=["injector","canvas"],de(xc,Xn),xc.prototype.calculateAdjustments=function(e,t,n,i){var r=this._canvas.getRootElement(),o=e[0]===r?null:e[0],a=[];o&&(a=Qr(uo(r.children.filter(u=>w(u,"bpmn:Artifact")),Tt(o))));const s=[...e,...a];var c=Xn.prototype.calculateAdjustments.call(this,s,t,n,i);return c.resizingShapes=c.resizingShapes.filter(function(u){return!(w(u,"bpmn:TextAnnotation")||JA(u)&&(t==="y"&&qt(u)||t==="x"&&!qt(u)))}),c};function JA(e){return w(e,"bpmn:Participant")&&!te(e).processRef}const Qy={__depends__:[QA],spaceTool:["type",xc]};function _t(e,t){this._handlerMap={},this._stack=[],this._stackIdx=-1,this._currentExecution={actions:[],dirty:[],trigger:null},this._injector=t,this._eventBus=e,this._uid=1,e.on(["diagram.destroy","diagram.clear"],function(){this.clear(!1)},this)}_t.$inject=["eventBus","injector"],_t.prototype.execute=function(e,t){if(!e)throw new Error("command required");this._currentExecution.trigger="execute";const n={command:e,context:t};this._pushAction(n),this._internalExecute(n),this._popAction()},_t.prototype.canExecute=function(e,t){const n={command:e,context:t},i=this._getHandler(e);let r=this._fire(e,"canExecute",n);if(r===void 0){if(!i)return!1;i.canExecute&&(r=i.canExecute(t))}return r},_t.prototype.clear=function(e){this._stack.length=0,this._stackIdx=-1,e!==!1&&this._fire("changed",{trigger:"clear"})},_t.prototype.undo=function(){let e=this._getUndoAction(),t;if(e){for(this._currentExecution.trigger="undo",this._pushAction(e);e&&(this._internalUndo(e),t=this._getUndoAction(),!(!t||t.id!==e.id));)e=t;this._popAction()}},_t.prototype.redo=function(){let e=this._getRedoAction(),t;if(e){for(this._currentExecution.trigger="redo",this._pushAction(e);e&&(this._internalExecute(e,!0),t=this._getRedoAction(),!(!t||t.id!==e.id));)e=t;this._popAction()}},_t.prototype.register=function(e,t){this._setHandler(e,t)},_t.prototype.registerHandler=function(e,t){if(!e||!t)throw new Error("command and handlerCls must be defined");const n=this._injector.instantiate(t);this.register(e,n)},_t.prototype.canUndo=function(){return!!this._getUndoAction()},_t.prototype.canRedo=function(){return!!this._getRedoAction()},_t.prototype._getRedoAction=function(){return this._stack[this._stackIdx+1]},_t.prototype._getUndoAction=function(){return this._stack[this._stackIdx]},_t.prototype._internalUndo=function(e){const t=e.command,n=e.context,i=this._getHandler(t);this._atomicDo(()=>{this._fire(t,"revert",e),i.revert&&this._markDirty(i.revert(n)),this._revertedAction(e),this._fire(t,"reverted",e)})},_t.prototype._fire=function(e,t,n){arguments.length<3&&(n=t,t=null);const i=t?[e+"."+t,t]:[e];let r;n=this._eventBus.createEvent(n);for(const o of i)if(r=this._eventBus.fire("commandStack."+o,n),n.cancelBubble)break;return r},_t.prototype._createId=function(){return this._uid++},_t.prototype._atomicDo=function(e){const t=this._currentExecution;t.atomic=!0;try{e()}finally{t.atomic=!1}},_t.prototype._internalExecute=function(e,t){const n=e.command,i=e.context,r=this._getHandler(n);if(!r)throw new Error("no command handler registered for <"+n+">");this._pushAction(e),t||(this._fire(n,"preExecute",e),r.preExecute&&r.preExecute(i),this._fire(n,"preExecuted",e)),this._atomicDo(()=>{this._fire(n,"execute",e),r.execute&&this._markDirty(r.execute(i)),this._executedAction(e,t),this._fire(n,"executed",e)}),t||(this._fire(n,"postExecute",e),r.postExecute&&r.postExecute(i),this._fire(n,"postExecuted",e)),this._popAction()},_t.prototype._pushAction=function(e){const t=this._currentExecution,n=t.actions,i=n[0];if(t.atomic)throw new Error("illegal invocation in <execute> or <revert> phase (action: "+e.command+")");e.id||(e.id=i&&i.id||this._createId()),n.push(e)},_t.prototype._popAction=function(){const e=this._currentExecution,t=e.trigger,n=e.actions,i=e.dirty;n.pop(),n.length||(this._eventBus.fire("elements.changed",{elements:pd("id",i.reverse())}),i.length=0,this._fire("changed",{trigger:t}),e.trigger=null)},_t.prototype._markDirty=function(e){const t=this._currentExecution;e&&(e=ke(e)?e:[e],t.dirty=t.dirty.concat(e))},_t.prototype._executedAction=function(e,t){const n=++this._stackIdx;t||this._stack.splice(n,this._stack.length,e)},_t.prototype._revertedAction=function(e){this._stackIdx--},_t.prototype._getHandler=function(e){return this._handlerMap[e]},_t.prototype._setHandler=function(e,t){if(!e||!t)throw new Error("command and handler required");if(this._handlerMap[e])throw new Error("overriding handler for command <"+e+">");this._handlerMap[e]=t};const eT={commandStack:["type",_t]};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 tT=250,Jy=1400;function zp(e,t,n){J.call(this,t);var i=e.get("movePreview",!1);t.on("shape.move.start",Jy,function(r){var o=r.context,a=o.shapes,s=o.validatedShapes;o.shapes=ev(a),o.validatedShapes=ev(s)}),i&&t.on("shape.move.start",tT,function(r){var o=r.context,a=new Set(o.shapes),s=new Set;for(const c of a)for(const u of c.labels)!u.hidden&&!a.has(u)&&s.add(u),c.labelTarget&&s.add(c);for(const c of s)i.makeDraggable(o,c,!0)}),this.preExecuted("elements.move",Jy,function(r){var o=r.context,a=o.closure,s=a.enclosedElements,c=[];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=xl(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)})}de(zp,J),zp.$inject=["injector","eventBus","modeling"];function ev(e){var t=new Set(e);return Ge(e,function(n){return!t.has(n.labelTarget)})}const nT={__init__:["labelSupport"],labelSupport:["type",zp]};var iT=251,tv=1401,nv="attach-ok";function Gp(e,t,n,i,r){J.call(this,t);var o=e.get("movePreview",!1);t.on("shape.move.start",tv,function(a){var s=a.context,c=s.shapes,u=s.validatedShapes;s.shapes=rT(c),s.validatedShapes=oT(u)}),o&&t.on("shape.move.start",iT,function(a){var s=a.context,c=s.shapes,u=Vp(c);L(u,function(l){o.makeDraggable(s,l,!0),L(l.labels,function(f){o.makeDraggable(s,f,!0)})})}),o&&t.on("shape.move.start",function(a){var s=a.context,c=s.shapes;if(c.length===1){var u=c[0],l=u.host;l&&(n.addMarker(l,nv),t.once(["shape.move.out","shape.move.cleanup"],function(){n.removeMarker(l,nv)}))}}),this.preExecuted("elements.move",tv,function(a){var s=a.context,c=s.closure,u=s.shapes,l=Vp(u);L(l,function(f){c.add(f,c.topLevel[f.host.id])})}),this.postExecuted("elements.move",function(a){var s=a.context,c=s.shapes,u=s.newHost,l;u&&c.length!==1||(u?l=c:l=Ge(c,function(f){var p=f.host;return aT(f)&&!sT(c,p)}),L(l,function(f){r.updateAttachment(f,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 f=i.allowed("connection.reconnect",{connection:l,source:l.source,target:l.target});f||r.removeConnection(l)}),L(u.incoming.slice(),function(l){var f=i.allowed("connection.reconnect",{connection:l,source:l.source,target:l.target});f||r.removeConnection(l)})})})}),this.postExecute("shape.create",function(a){var s=a.context,c=s.shape,u=s.host;u&&r.updateAttachment(c,u)}),this.postExecute("shape.replace",function(a){var s=a.context,c=s.oldShape,u=s.newShape;lr(c.attachers,function(l){var f=i.allowed("elements.move",{target:u,shapes:[l]});f==="attach"?r.updateAttachment(l,u):r.removeShape(l)}),u.attachers.length&&L(u.attachers,function(l){var f=_g(l,c,u);r.moveShape(l,f,l.parent)})}),this.postExecute("shape.resize",function(a){var s=a.context,c=s.shape,u=s.oldBounds,l=s.newBounds,f=c.attachers,p=s.hints||{};p.attachSupport!==!1&&L(f,function(d){var g=_g(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(Gp,J),Gp.$inject=["injector","eventBus","canvas","rules","modeling"];function Vp(e){return Ou(on(e,function(t){return t.attachers||[]}))}function rT(e){var t=Vp(e);return z0("id",e,t)}function oT(e){var t=Jr(e,"id");return Ge(e,function(n){for(;n;){if(n.host&&t[n.host.id])return!1;n=n.parent}return!0})}function aT(e){return!!e.host}function sT(e,t){return e.indexOf(t)!==-1}const cT={__depends__:[bi],__init__:["attachSupport"],attachSupport:["type",Gp]};function iv(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(Kh(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)})}iv.$inject=["eventBus","canvas","elementRegistry","graphicsFactory"];const Wp={__init__:["changeSupport"],changeSupport:["type",iv]};function Zn(e){this._model=e}Zn.$inject=["moddle"],Zn.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"])},Zn.prototype._ensureId=function(e){if(e.id){this._model.ids.claim(e.id,e);return}var t;w(e,"bpmn:Activity")?t="Activity":w(e,"bpmn:Event")?t="Event":w(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))},Zn.prototype.create=function(e,t){var n=this._model.create(e,t||{});return this._ensureId(n),n},Zn.prototype.createDiLabel=function(){return this.create("bpmndi:BPMNLabel",{bounds:this.createDiBounds()})},Zn.prototype.createDiShape=function(e,t){return this.create("bpmndi:BPMNShape",z({bpmnElement:e,bounds:this.createDiBounds()},t))},Zn.prototype.createDiBounds=function(e){return this.create("dc:Bounds",e)},Zn.prototype.createDiWaypoints=function(e){var t=this;return on(e,function(n){return t.createDiWaypoint(n)})},Zn.prototype.createDiWaypoint=function(e){return this.create("dc:Point",ni(e,["x","y"]))},Zn.prototype.createDiEdge=function(e,t){return this.create("bpmndi:BPMNEdge",z({bpmnElement:e,waypoint:this.createDiWaypoints([])},t))},Zn.prototype.createDiPlane=function(e,t){return this.create("bpmndi:BPMNPlane",z({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(_){w(_,"bpmn:BaseElement")&&i.updateParent(_)})}this.executed(["canvas.updateRoot"],s),this.reverted(["canvas.updateRoot"],s);function c(d){var g=d.context.shape;w(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,_=g.newSource,y=te(h),x=te(m),S=te(_);y.conditionExpression&&!ze(S,["bpmn:Activity","bpmn:ExclusiveGateway","bpmn:InclusiveGateway"])&&(g.oldConditionExpression=y.conditionExpression,delete y.conditionExpression),m!==_&&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,_=g.newSource,y=te(h),x=te(m),S=te(_);g.oldConditionExpression&&(y.conditionExpression=g.oldConditionExpression),g.oldDefault&&(x.default=g.oldDefault,delete S.default)}));function f(d){i.updateAttachment(d.context)}this.executed(["element.updateAttachment"],On(f)),this.reverted(["element.updateAttachment"],On(f)),this.executed("element.updateLabel",On(p)),this.reverted("element.updateLabel",On(p));function p(d){const{element:g}=d.context,h=Fn(g),m=Ye(g),_=m&&m.get("label");ir(g)||sc(g)||(h&&!_?m.set("label",t.create("bpmndi:BPMNLabel")):!h&&_&&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(!je(e)&&!(w(e,"bpmn:DataStoreReference")&&e.parent&&w(e.parent,"bpmn:Collaboration"))){var n=e.parent,i=e.businessObject,r=Ye(e),o=n&&n.businessObject,a=Ye(n);w(e,"bpmn:FlowNode")&&this.updateFlowNodeRefs(i,o,t&&t.businessObject),w(e,"bpmn:DataOutputAssociation")&&(e.source?o=e.source.businessObject:o=null),w(e,"bpmn:DataInputAssociation")&&(e.target?o=e.target.businessObject:o=null),this.updateSemanticParent(i,o),w(e,"bpmn:DataObjectReference")&&i.dataObjectRef&&this.updateSemanticParent(i.dataObjectRef,o),this.updateDiParent(r,a)}},kn.prototype.updateBounds=function(e){var t=Ye(e),n=lT(e);if(n){var i=oi(n,t.get("bounds"));z(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)),z(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;w(n,"bpmn:Lane")&&(i=n.get("flowNodeRef"),St(i,e)),w(t,"bpmn:Lane")&&(r=t.get("flowNodeRef"),Ct(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&&!w(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 uT(e){for(;e&&!w(e,"bpmn:Definitions");)e=e.$parent;return e}kn.prototype.getLaneSet=function(e){var t,n;return w(e,"bpmn:Lane")?(t=e.childLaneSet,t||(t=this._bpmnFactory.create("bpmn:LaneSet"),e.childLaneSet=t,t.$parent=e),t):(w(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&&!((w(e,"bpmn:DataInput")||w(e,"bpmn:DataOutput"))&&(w(t,"bpmn:Participant")&&"processRef"in t&&(t=t.processRef),"ioSpecification"in t&&t.ioSpecification===e.$parent))){if(w(e,"bpmn:Lane"))t&&(t=this.getLaneSet(t)),i="lanes";else if(w(e,"bpmn:FlowElement")){if(t){if(w(t,"bpmn:Participant"))t=t.processRef;else if(w(t,"bpmn:Lane"))do t=t.$parent.$parent;while(w(t,"bpmn:Lane"))}i="flowElements"}else if(w(e,"bpmn:Artifact")){for(;t&&!w(t,"bpmn:Process")&&!w(t,"bpmn:SubProcess")&&!w(t,"bpmn:Collaboration");)if(w(t,"bpmn:Participant")){t=t.processRef;break}else t=t.$parent;i="artifacts"}else if(w(e,"bpmn:MessageFlow"))i="messageFlows";else if(w(e,"bpmn:Participant")){i="participants";var r=e.processRef,o;r&&(o=uT(e.$parent||t),e.$parent&&(St(o.get("rootElements"),r),r.$parent=null),t&&(Ct(o.get("rootElements"),r),r.$parent=o))}else w(e,"bpmn:DataOutputAssociation")?i="dataOutputAssociations":w(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))}}},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(w(n,"bpmn:DataAssociation"))w(n,"bpmn:DataInputAssociation")?(n.get("sourceRef")[0]=r,s=e.parent||e.newParent||a,this.updateSemanticParent(n,a,s)):w(n,"bpmn:DataOutputAssociation")&&(s=e.parent||e.newParent||r,this.updateSemanticParent(n,r,s),n.targetRef=a);else{var c=w(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)},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;w(i,"bpmn:BaseElement")&&e(t)}}function lT(e){if(w(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,z({type:"label",di:n},Dr,t))}return this.createElement(e,t)},pr.prototype.createElement=function(e,t){t=z({},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(!fT(r)){var o=z({},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)}w(i,"bpmn:Group")&&(t=z({isFrame:!0},t)),t=pT(i,t,["processRef","isInterrupting","associationDirection","isForCompensation"]),t.isExpanded&&(t=Up(r,t,"isExpanded")),ze(i,["bpmn:Lane","bpmn:Participant"])&&(t=Up(r,t,"isHorizontal")),w(i,"bpmn:SubProcess")&&(t.collapsed=!We(i,r)),w(i,"bpmn:ExclusiveGateway")&&(En(r,"isMarkerVisible")?r.isMarkerVisible===void 0&&(r.isMarkerVisible=!1):r.isMarkerVisible=!0),$t(t.triggeredByEvent)&&(i.triggeredByEvent=t.triggeredByEvent,delete t.triggeredByEvent),$t(t.cancelActivity)&&(i.cancelActivity=t.cancelActivity,delete t.cancelActivity);var a,s;return t.eventDefinitionType&&(a=i.get("eventDefinitions")||[],s=this._bpmnFactory.create(t.eventDefinitionType,t.eventDefinitionAttrs),t.eventDefinitionType==="bpmn:ConditionalEventDefinition"&&(s.condition=this._bpmnFactory.create("bpmn:FormalExpression")),a.push(s),s.$parent=i,i.eventDefinitions=a,delete t.eventDefinitionType),n=this.getDefaultSize(i,r),t=z({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),w(n,"bpmn:SubProcess"))return We(n,t)?{width:350,height:200}:{width:100,height:80};if(w(n,"bpmn:Task"))return{width:100,height:80};if(w(n,"bpmn:Gateway"))return{width:50,height:50};if(w(n,"bpmn:Event"))return{width:36,height:36};if(w(n,"bpmn:Participant")){var i=t.isHorizontal===void 0||t.isHorizontal===!0;return We(n,t)?i?{width:600,height:250}:{width:250,height:600}:i?{width:400,height:60}:{width:60,height:400}}return w(n,"bpmn:Lane")?{width:400,height:100}:w(n,"bpmn:DataObjectReference")?{width:36,height:50}:w(n,"bpmn:DataStoreReference")?{width:50,height:50}:w(n,"bpmn:TextAnnotation")?{width:100,height:40}:w(n,"bpmn:Group")?{width:300,height:300}:{width:100,height:80}},pr.prototype.createParticipantShape=function(e){return Vt(e)||(e={isExpanded:e}),e=z({type:"bpmn:Participant"},e||{}),e.isExpanded!==!1&&(e.processRef=this._bpmnFactory.create("bpmn:Process")),this.createShape(e)};function pT(e,t,n){return L(n,function(i){t=Up(e,t,i)}),t}function Up(e,t,n){return t[n]===void 0?t:(e[n]=t[n],ui(t,[n]))}function fT(e){return ze(e,["bpmndi:BPMNShape","bpmndi:BPMNEdge","bpmndi:BPMNDiagram","bpmndi:BPMNPlane"])}function wc(e,t){this._modeling=e,this._canvas=t}wc.$inject=["modeling","canvas"],wc.prototype.preExecute=function(e){var t=this._modeling,n=e.elements,i=e.alignment;L(n,function(r){var o={x:0,y:0};$t(i.left)?o.x=i.left-r.x:$t(i.right)?o.x=i.right-r.width-r.x:$t(i.center)?o.x=i.center-Math.round(r.width/2)-r.x:$t(i.top)?o.y=i.top-r.y:$t(i.bottom)?o.y=i.bottom-r.height-r.y:$t(i.middle)&&(o.y=i.middle-Math.round(r.height/2)-r.y),t.moveElements([r],o,r.parent)})},wc.prototype.postExecute=function(e){};function Ec(e){this._modeling=e}Ec.$inject=["modeling"],Ec.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},Ec.prototype.postExecute=function(e){var t=e.hints||{};dT(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 dT(e,t){return Wi(e.outgoing,function(n){return n.target===t})}function Sc(e,t){this._canvas=e,this._layouter=t}Sc.$inject=["canvas","layouter"],Sc.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},Sc.prototype.revert=function(e){var t=e.connection;return this._canvas.removeConnection(t),t.source=null,t.target=null,t};var Rc=Math.round;function qp(e){this._modeling=e}qp.$inject=["modeling"],qp.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(f){Le(f.x)||(f.x=0),Le(f.y)||(f.y=0)});var s=Ge(t,function(f){return!f.hidden}),c=Tt(s);L(t,function(f){at(f)&&(f.waypoints=on(f.waypoints,function(p){return{x:Rc(p.x-c.x-c.width/2+r.x),y:Rc(p.y-c.y-c.height/2+r.y)}})),z(f,{x:Rc(f.x-c.x-c.width/2+r.x),y:Rc(f.y-c.y-c.height/2+r.y)})});var u=new Set(Ps(t)),l={};L(t,function(f){if(at(f)){l[f.id]=Le(i)?a.createConnection(l[f.source.id],l[f.target.id],i,f,f.parent||n,o):a.createConnection(l[f.source.id],l[f.target.id],f,f.parent||n,o);return}var p=z({},o);u.has(f)||(p.autoResize=!1),je(f)&&(p=ui(p,["attach"])),l[f.id]=Le(i)?a.createShape(f,ni(f,["x","y","width","height"]),f.parent||n,i,p):a.createShape(f,ni(f,["x","y","width","height"]),f.parent||n,p)}),e.elements=Qr(l)};var rv=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?z(t,n):z(t,{x:n.x-rv(t.width/2),y:n.y-rv(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 _a(e){fr.call(this,e)}de(_a,fr),_a.$inject=["canvas"];var hT=fr.prototype.execute;_a.prototype.execute=function(e){var t=e.shape;return gT(t),t.labelTarget=e.labelTarget,hT.call(this,e)};var mT=fr.prototype.revert;_a.prototype.revert=function(e){return e.shape.labelTarget=null,mT.call(this,e)};function gT(e){["width","height"].forEach(function(t){typeof e[t]>"u"&&(e[t]=0)})}function xa(e,t){this._canvas=e,this._modeling=t}xa.$inject=["canvas","modeling"],xa.prototype.preExecute=function(e){var t=this._modeling,n=e.connection;lr(n.incoming,function(i){t.removeConnection(i,{nested:!0})}),lr(n.outgoing,function(i){t.removeConnection(i,{nested:!0})})},xa.prototype.execute=function(e){var t=e.connection,n=t.parent;return e.parent=n,e.parentIndex=xl(n.children,t),e.source=t.source,e.target=t.target,this._canvas.removeConnection(t),t.source=null,t.target=null,t},xa.prototype.revert=function(e){var t=e.connection,n=e.parent,i=e.parentIndex;return t.source=e.source,t.target=e.target,Ct(n.children,t,i),this._canvas.addConnection(t,n),t};function Yp(e,t){this._modeling=e,this._elementRegistry=t}Yp.$inject=["modeling","elementRegistry"],Yp.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 wa(e,t){this._canvas=e,this._modeling=t}wa.$inject=["canvas","modeling"],wa.prototype.preExecute=function(e){var t=this._modeling,n=e.shape;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){at(i)?t.removeConnection(i,{nested:!0}):t.removeShape(i,{nested:!0})})},wa.prototype.execute=function(e){var t=this._canvas,n=e.shape,i=n.parent;return e.oldParent=i,e.oldParentIndex=xl(i.children,n),t.removeShape(n),n},wa.prototype.revert=function(e){var t=this._canvas,n=e.shape,i=e.oldParent,r=e.oldParentIndex;return Ct(i.children,n,r),t.addShape(n,i),n};function Cc(e){this._modeling=e}Cc.$inject=["modeling"];var ov={x:"y",y:"x"};Cc.prototype.preExecute=function(e){var t=this._modeling,n=e.groups,i=e.axis,r=e.dimension;function o(m,_){m.range.min=Math.min(_[i],m.range.min),m.range.max=Math.max(_[i]+_[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,_){var y={y:0};y[i]=m-a(_),y[i]&&(y[ov[i]]=0,t.moveElements([_],y,_.parent))}var l=n[0],f=s(n),p=n[f],d,g,h=0;L(n,function(m,_){var y,x,S;if(m.elements.length<2){_&&_!==n.length-1&&(o(m,m.elements[0]),h+=c(m.range));return}y=ci(m.elements,i),x=y[0],_===f&&(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)}),_&&_!==n.length-1&&(h+=c(m.range))}),g=Math.abs(p.range.min-l.range.max),d=Math.round((g-h)/(n.length-1)),!(d<n.length-1)&&L(n,function(m,_){var y={},x;m===l||m===p||(x=n[_-1],m.range.max=0,L(m.elements,function(S,P){y[ov[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)}))})},Cc.prototype.postExecute=function(e){};function Pc(e,t){this._layouter=e,this._canvas=t}Pc.$inject=["layouter","canvas"],Pc.prototype.execute=function(e){var t=e.connection,n=t.waypoints;return z(e,{oldWaypoints:n}),t.waypoints=this._layouter.layoutConnection(t,e.hints),t},Pc.prototype.revert=function(e){var t=e.connection;return t.waypoints=e.oldWaypoints,t};function Kp(){}Kp.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},Kp.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 Xp(){this.allShapes={},this.allConnections={},this.enclosedElements={},this.enclosedConnections={},this.topLevel={}}Xp.prototype.add=function(e,t){return this.addAll([e],t)},Xp.prototype.addAll=function(e,t){var n=U1(e,!!t,this);return z(this,n),this};function Ea(e){this._modeling=e}Ea.prototype.moveRecursive=function(e,t,n){return e?this.moveClosure(this.getClosure(e),t,n):[]},Ea.prototype.moveClosure=function(e,t,n,i,r){var o=this._modeling,a=e.allShapes,s=e.allConnections,c=e.enclosedConnections,u=e.topLevel,l=!1;r&&r.parent===n&&(l=!0),L(a,function(f){o.moveShape(f,t,u[f.id]&&!l&&n,{recurse:!1,layout:!1})}),L(s,function(f){var p=!!a[f.source.id],d=!!a[f.target.id];c[f.id]&&p&&d?o.moveConnection(f,t,u[f.id]&&!l&&n):o.layoutConnection(f,{connectionStart:p&&ip(f,f.source,t),connectionEnd:d&&rp(f,f.target,t)})})},Ea.prototype.getClosure=function(e){return new Xp().addAll(e,!0)};function Ac(e){this._helper=new Ea(e)}Ac.$inject=["modeling"],Ac.prototype.preExecute=function(e){e.closure=this._helper.getClosure(e.shapes)},Ac.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 Ea(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=ni(t,["x","y","width","height"]),e.oldParent=o,e.oldParentIndex=St(o.children,t),Ct(i.children,t,r),z(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:rp(o,t,n)})}),L(t.outgoing,function(o){r.layoutConnection(o,{connectionStart:ip(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 Ct(n.children,t,i),z(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 Sa(e){this._modeling=e}Sa.$inject=["modeling"],Sa.prototype.execute=function(e){var t=e.newSource,n=e.newTarget,i=e.connection,r=e.dockingOrPoints;if(!t&&!n)throw new Error("newSource or newTarget required");return 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},Sa.prototype.postExecute=function(e){var t=e.connection,n=e.newSource,i=e.newTarget,r=e.dockingOrPoints,o=e.hints||{},a={};o.connectionStart&&(a.connectionStart=o.connectionStart),o.connectionEnd&&(a.connectionEnd=o.connectionEnd),o.layoutConnection!==!1&&(n&&(!i||o.docking==="source")&&(a.connectionStart=a.connectionStart||av(ke(r)?r[0]:r)),i&&(!n||o.docking==="target")&&(a.connectionEnd=a.connectionEnd||av(ke(r)?r[r.length-1]:r)),o.newWaypoints&&(a.waypoints=o.newWaypoints),this._modeling.layoutConnection(t,a))},Sa.prototype.revert=function(e){var t=e.oldSource,n=e.oldTarget,i=e.oldWaypoints,r=e.connection;return t&&(r.source=t),n&&(r.target=n),i&&(r.waypoints=i),r};function av(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 f;a.moveChildren!==!1&&(f=r.children.slice(),n.moveElements(f,{x:0,y:0},s,a));var p=r.incoming.slice(),d=r.outgoing.slice();L(p,function(g){var h=g.source,m=c(h,s,g);m&&t.reconnectEnd(g,s,tc(g,s,l),a)}),L(d,function(g){var h=g.target,m=c(s,h,g);m&&t.reconnectStart(g,s,ec(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 Ra(e){this._modeling=e}Ra.$inject=["modeling"],Ra.prototype.execute=function(e){var t=e.shape,n=e.newBounds,i=e.minBounds;if(n.x===void 0||n.y===void 0||n.width===void 0||n.height===void 0)throw new Error("newBounds must have {x, y, width, height} properties");if(i&&(n.width<i.width||n.height<i.height))throw new Error("width and height cannot be less than minimum height and width");if(!i&&n.width<10||n.height<10)throw new Error("width and height cannot be less than 10px");return e.oldBounds={width:t.width,height:t.height,x:t.x,y:t.y},z(t,{width:n.width,height:n.height,x:n.x,y:n.y}),t},Ra.prototype.postExecute=function(e){var t=this._modeling,n=e.shape,i=e.oldBounds,r=e.hints||{};r.layout!==!1&&(L(n.incoming,function(o){t.layoutConnection(o,{connectionEnd:tc(o,n,i)})}),L(n.outgoing,function(o){t.layoutConnection(o,{connectionStart:ec(o,n,i)})}))},Ra.prototype.revert=function(e){var t=e.shape,n=e.oldBounds;return z(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]=vT(s)}),this.resizeShapes(r,t,n),this.updateConnectionWaypoints(WA(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=UA(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 f=l.source,p=l.target,d=yT(l),g=cv(n),h={},m=c.has(f)||u.has(f),_=c.has(p)||u.has(p);m&&_?(d=on(d,function(y){return uv(y,i,n)&&(y[g]=y[g]+t[g]),y.original&&uv(y.original,i,n)&&(y.original[g]=y.original[g]+t[g]),y}),s._modeling.updateWaypoints(l,d,{labelBehavior:!1})):(m||_)&&(c.has(f)?h.connectionStart=ip(l,f,t):c.has(p)?h.connectionEnd=rp(l,p,t):u.has(f)?h.connectionStart=ec(l,f,a[f.id]):u.has(p)&&(h.connectionEnd=tc(l,p,a[p.id])),s._modeling.layoutConnection(l,h))})};function sv(e){return z({},e)}function yT(e){return on(e.waypoints,function(t){return t=sv(t),t.original&&(t.original=sv(t.original)),t})}function cv(e){switch(e){case"n":return"y";case"w":return"x";case"s":return"y";case"e":return"x"}}function uv(e,t,n){var i=cv(n);if(/e|s/.test(n))return e[i]>t;if(/n|w/.test(n))return e[i]<t}function vT(e){return{x:e.x,y:e.y,height:e.height,width:e.width}}function Tc(e){this._modeling=e}Tc.$inject=["modeling"],Tc.prototype.execute=function(e){var t=e.shape,n=t.children;e.oldChildrenVisibility=lv(n),t.collapsed=!t.collapsed;var i=pv(n,t.collapsed);return[t].concat(i)},Tc.prototype.revert=function(e){var t=e.shape,n=e.oldChildrenVisibility,i=t.children,r=fv(i,n);return t.collapsed=!t.collapsed,[t].concat(r)};function lv(e){var t={};return L(e,function(n){t[n.id]=n.hidden,n.children&&(t=z({},t,lv(n.children)))}),t}function pv(e,t){var n=[];return L(e,function(i){i.hidden=t,n=n.concat(i),i.children&&(n=n.concat(pv(i.children,i.collapsed||t)))}),n}function fv(e,t){var n=[];return L(e,function(i){i.hidden=t[i.id],n=n.concat(i),i.children&&(n=n.concat(fv(i.children,t)))}),n}function Mc(e){this._modeling=e}Mc.$inject=["modeling"],Mc.prototype.execute=function(e){var t=e.shape,n=e.newHost,i=t.host;return e.oldHost=i,e.attacherIdx=dv(i,t),hv(n,t),t.host=n,t},Mc.prototype.revert=function(e){var t=e.shape,n=e.newHost,i=e.oldHost,r=e.attacherIdx;return t.host=i,dv(n,t),hv(i,t,r),t};function dv(e,t){return St(e&&e.attachers,t)}function hv(e,t,n){if(e){var i=e.attachers;i||(e.attachers=i=[]),Ct(i,t,n)}}function Zp(){}Zp.prototype.execute=function(e){var t=e.connection,n=e.newWaypoints;return e.oldWaypoints=t.waypoints,t.waypoints=n,t},Zp.prototype.revert=function(e){var t=e.connection,n=e.oldWaypoints;return t.waypoints=n,t};function st(e,t,n){this._eventBus=e,this._elementFactory=t,this._commandStack=n;var i=this;e.on("diagram.init",function(){i.registerHandlers(n)})}st.$inject=["eventBus","elementFactory","commandStack"],st.prototype.getHandlers=function(){return{"shape.append":Ec,"shape.create":fr,"shape.delete":wa,"shape.move":Fr,"shape.resize":Ra,"shape.replace":$i,"shape.toggleCollapse":Tc,spaceTool:dr,"label.create":_a,"connection.create":Sc,"connection.delete":xa,"connection.move":Kp,"connection.layout":Pc,"connection.updateWaypoints":Zp,"connection.reconnect":Sa,"elements.create":qp,"elements.move":Ac,"elements.delete":Yp,"elements.distribute":Cc,"elements.align":wc,"element.updateAttachment":Mc}},st.prototype.registerHandlers=function(e){L(this.getHandlers(),function(t,n){e.registerHandler(n,t)})},st.prototype.moveShape=function(e,t,n,i,r){typeof i=="object"&&(r=i,i=null);var o={shape:e,delta:t,newParent:n,newParentIndex:i,hints:r||{}};this._commandStack.execute("shape.move",o)},st.prototype.updateAttachment=function(e,t){var n={shape:e,newHost:t};this._commandStack.execute("element.updateAttachment",n)},st.prototype.moveElements=function(e,t,n,i){i=i||{};var r=i.attach,o=n,a;r===!0?(a=n,o=n.parent):r===!1&&(a=null);var s={shapes:e,delta:t,newParent:o,newHost:a,hints:i};this._commandStack.execute("elements.move",s)},st.prototype.moveConnection=function(e,t,n,i,r){typeof i=="object"&&(r=i,i=void 0);var o={connection:e,delta:t,newParent:n,newParentIndex:i,hints:r||{}};this._commandStack.execute("connection.move",o)},st.prototype.layoutConnection=function(e,t){var n={connection:e,hints:t||{}};this._commandStack.execute("connection.layout",n)},st.prototype.createConnection=function(e,t,n,i,r,o){typeof n=="object"&&(o=r,r=i,i=n,n=void 0),i=this._create("connection",i);var a={source:e,target:t,parent:r,parentIndex:n,connection:i,hints:o};return this._commandStack.execute("connection.create",a),a.connection},st.prototype.createShape=function(e,t,n,i,r){typeof i!="number"&&(r=i,i=void 0),r=r||{};var o=r.attach,a,s;e=this._create("shape",e),o?(a=n.parent,s=n):a=n;var c={position:t,shape:e,parent:a,parentIndex:i,host:s,hints:r};return this._commandStack.execute("shape.create",c),c.shape},st.prototype.createElements=function(e,t,n,i,r){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},st.prototype.createLabel=function(e,t,n,i){n=this._create("label",n);var r={labelTarget:e,position:t,parent:i||e.parent,shape:n};return this._commandStack.execute("label.create",r),r.shape},st.prototype.appendShape=function(e,t,n,i,r){r=r||{},t=this._create("shape",t);var o={source:e,position:n,target:i,shape:t,connection:r.connection,connectionParent:r.connectionParent,hints:r};return this._commandStack.execute("shape.append",o),o.shape},st.prototype.removeElements=function(e){var t={elements:e};this._commandStack.execute("elements.delete",t)},st.prototype.distributeElements=function(e,t,n){var i={groups:e,axis:t,dimension:n};this._commandStack.execute("elements.distribute",i)},st.prototype.removeShape=function(e,t){var n={shape:e,hints:t||{}};this._commandStack.execute("shape.delete",n)},st.prototype.removeConnection=function(e,t){var n={connection:e,hints:t||{}};this._commandStack.execute("connection.delete",n)},st.prototype.replaceShape=function(e,t,n){var i={oldShape:e,newData:t,hints:n||{}};return this._commandStack.execute("shape.replace",i),i.newShape},st.prototype.alignElements=function(e,t){var n={elements:e,alignment:t};this._commandStack.execute("elements.align",n)},st.prototype.resizeShape=function(e,t,n,i){var r={shape:e,newBounds:t,minBounds:n,hints:i};this._commandStack.execute("shape.resize",r)},st.prototype.createSpace=function(e,t,n,i,r){var o={delta:n,direction:i,movingShapes:e,resizingShapes:t,start:r};this._commandStack.execute("spaceTool",o)},st.prototype.updateWaypoints=function(e,t,n){var i={connection:e,newWaypoints:t,hints:n||{}};this._commandStack.execute("connection.updateWaypoints",i)},st.prototype.reconnect=function(e,t,n,i,r){var o={connection:e,newSource:t,newTarget:n,dockingOrPoints:i,hints:r||{}};this._commandStack.execute("connection.reconnect",o)},st.prototype.reconnectStart=function(e,t,n,i){i||(i={}),this.reconnect(e,t,e.target,n,z(i,{docking:"source"}))},st.prototype.reconnectEnd=function(e,t,n,i){i||(i={}),this.reconnect(e,e.source,t,n,z(i,{docking:"target"}))},st.prototype.connect=function(e,t,n,i){return this.createConnection(e,t,n||{},e.parent,i)},st.prototype._create=function(e,t){return kS(t)?t:this._elementFactory.create(e,t)},st.prototype.toggleCollapse=function(e,t){var n={shape:e,hints:t||{}};this._commandStack.execute("shape.toggleCollapse",n)};function Ca(e){this._elementRegistry=e}Ca.$inject=["elementRegistry"],Ca.prototype.execute=function(e){var t=e.element,n=e.moddleElement,i=e.properties;if(!n)throw new Error("<moddleElement> required");var r=e.changed||this._getVisualReferences(n).concat(t),o=e.oldProperties||bT(n,ts(i));return mv(n,i),e.oldProperties=o,e.changed=r,r},Ca.prototype.revert=function(e){var t=e.oldProperties,n=e.moddleElement,i=e.changed;return mv(n,t),i},Ca.prototype._getVisualReferences=function(e){var t=this._elementRegistry;return w(e,"bpmn:DataObject")?_T(e,t):[]};function bT(e,t){return Sn(t,function(n,i){return n[i]=e.get(i),n},{})}function mv(e,t){L(t,function(n,i){e.set(i,n)})}function _T(e,t){return t.filter(function(n){return w(n,"bpmn:DataObjectReference")&&te(n).dataObjectRef===e})}var Pa="default",Fi="id",gv="di",xT={width:0,height:0};function Aa(e,t,n,i){this._elementRegistry=e,this._moddle=t,this._modeling=n,this._textRenderer=i}Aa.$inject=["elementRegistry","moddle","modeling","textRenderer"],Aa.prototype.execute=function(e){var t=e.element,n=[t];if(!t)throw new Error("element required");var i=this._elementRegistry,r=this._moddle.ids,o=t.businessObject,a=CT(e.properties),s=e.oldProperties||wT(t,a);return yv(a,o)&&(r.unclaim(o[Fi]),i.updateId(t,a[Fi]),r.claim(a[Fi],o)),Pa in a&&(a[Pa]&&n.push(i.get(a[Pa].id)),o[Pa]&&n.push(i.get(o[Pa].id))),vv(t,a),e.oldProperties=s,e.changed=n,n},Aa.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,xT)}},Aa.prototype.revert=function(e){var t=e.element,n=e.properties,i=e.oldProperties,r=t.businessObject,o=this._elementRegistry,a=this._moddle.ids;return vv(t,i),yv(n,r)&&(a.unclaim(n[Fi]),o.updateId(t,i[Fi]),a.claim(i[Fi],r)),e.changed};function yv(e,t){return Fi in e&&e[Fi]!==t[Fi]}function wT(e,t){var n=ts(t),i=e.businessObject,r=Ye(e);return Sn(n,function(o,a){return a!==gv?o[a]=i.get(a):o[a]=ET(r,ts(t.di)),o},{})}function ET(e,t){return Sn(t,function(n,i){return n[i]=e&&e.get(i),n},{})}function vv(e,t){var n=e.businessObject,i=Ye(e);L(t,function(r,o){o!==gv?n.set(o,r):i&&ST(i,r)})}function ST(e,t){L(t,function(n,i){e.set(i,n)})}var RT=["default"];function CT(e){var t=z({},e);return RT.forEach(function(n){n in e&&(t[n]=te(t[n]))}),t}function kc(e,t){this._canvas=e,this._modeling=t}kc.$inject=["canvas","modeling"],kc.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),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,[]},kc.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),St(a.rootElements,i),i.$parent=null,Ct(a.rootElements,o),o.$parent=a,n.di=null,s.bpmnElement=o,r.di=s,[]};function Qp(e,t){this._modeling=e,this._spaceTool=t}Qp.$inject=["modeling","spaceTool"],Qp.prototype.preExecute=function(e){var t=this._spaceTool,n=this._modeling,i=e.shape,r=e.location,o=qn(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+Un,y:i.y,width:i.width-Un,height:i.height}:{x:i.x,y:i.y+Un,width:i.width,height:i.height-Un};n.createShape({type:"bpmn:Lane",isHorizontal:u},l,s)}var f=[];kr(o,function(S){return f.push(S),S.label&&f.push(S.label),S===i?[]:Ge(S.children,function(P){return P!==i})});var p,d,g,h,m;r==="top"?(p=-120,d=i.y,g=d+10,h="n",m="y"):r==="left"?(p=-120,d=i.x,g=d+10,h="w",m="x"):r==="bottom"?(p=120,d=i.y+i.height,g=d-10,h="s",m="y"):r==="right"&&(p=120,d=i.x+i.width,g=d-10,h="e",m="x");var _=t.calculateAdjustments(f,m,p,g),y=u?{x:0,y:p}:{x:p,y:0};t.makeSpace(_.movingShapes,_.resizingShapes,y,h,g);var x=u?{x:i.x+(a?Un:0),y:d-(r==="top"?120:0),width:i.width-(a?Un:0),height:120}:{x:d-(r==="left"?120:0),y:i.y+(a?Un:0),width:120,height:i.height-(a?Un:0)};e.newLane=n.createShape({type:"bpmn:Lane",isHorizontal:u},x,s)};function Jp(e){this._modeling=e}Jp.$inject=["modeling"],Jp.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,f,p;for(p=0;p<i;p++)p===i-1?u=s-c*p:u=c,l=a?{x:n.x+Un,y:n.y+p*c,width:n.width-Un,height:u}:{x:n.x+p*c,y:n.y+Un,width:u,height:n.height-Un},p<o?t.resizeShape(r[p],l):(f={type:"bpmn:Lane",isHorizontal:a},t.createShape(f,l,n))};function Ta(e,t){this._modeling=e,this._spaceTool=t}Ta.$inject=["modeling","spaceTool"],Ta.prototype.preExecute=function(e){var t=e.shape,n=e.newBounds,i=e.balanced;i!==!1?this.resizeBalanced(t,n):this.resizeSpace(t,n)},Ta.prototype.resizeBalanced=function(e,t){var n=this._modeling,i=_C(e,t);n.resizeShape(e,t),i.forEach(function(r){n.resizeShape(r.shape,r.newBounds)})},Ta.prototype.resizeSpace=function(e,t){var n=this._spaceTool,i=Pe(e),r=Pe(t),o=Xm(r,i),a=qn(e),s=[],c=[];kr(a,function(g){return s.push(g),(w(g,"bpmn:Lane")||w(g,"bpmn:Participant"))&&c.push(g),g.children});var u,l,f,p,d;(o.bottom||o.top)&&(u=o.bottom||o.top,l=e.y+(o.bottom?e.height:0)+(o.bottom?-10:10),f=o.bottom?"s":"n",p=o.top>0||o.bottom<0?-u:u,d=n.calculateAdjustments(s,"y",p,l),n.makeSpace(d.movingShapes,d.resizingShapes,{x:0,y:u},f)),(o.left||o.right)&&(u=o.right||o.left,l=e.x+(o.right?e.width:0)+(o.right?-10:100),f=o.right?"e":"w",p=o.left>0||o.right<0?-u:u,d=n.calculateAdjustments(c,"x",p,l),n.makeSpace(d.movingShapes,d.resizingShapes,{x:u,y:0},f))};var Ma="flowNodeRef",ef="lanes";function Oc(){}Oc.prototype._computeUpdates=function(e,t){var n=[],i=[],r={},o=[];function a(l,f){var p=Pe(f),d={x:l.x+l.width/2,y:l.y+l.height/2};return d.x>p.left&&d.x<p.right&&d.y>p.top&&d.y<p.bottom}function s(l){n.indexOf(l)===-1&&(o.push(l),n.push(l))}function c(l){var f=qn(l);return r[f.id]||(r[f.id]=Ks(f)),r[f.id]}function u(l){if(!l.parent)return[];var f=c(l);return f.filter(function(p){return a(l,p)}).map(function(p){return p.businessObject})}return t.forEach(function(l){var f=qn(l);if(!(!f||n.indexOf(f)!==-1)){var p=f.children.filter(function(d){return w(d,"bpmn:FlowNode")});p.forEach(s),n.push(f)}}),e.forEach(s),o.forEach(function(l){var f=l.businessObject,p=f.get(ef),d=p.slice(),g=u(l);i.push({flowNode:f,remove:d,add:g})}),t.forEach(function(l){var f=l.businessObject;l.parent||f.get(Ma).forEach(function(p){i.push({flowNode:p,remove:[f],add:[]})})}),i},Oc.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(ef);n.remove.forEach(function(o){St(r,o),St(o.get(Ma),i)}),n.add.forEach(function(o){Ct(r,o),Ct(o.get(Ma),i)})}),[]},Oc.prototype.revert=function(e){var t=e.updates;return t.forEach(function(n){var i=n.flowNode,r=i.get(ef);n.add.forEach(function(o){St(r,o),St(o.get(Ma),i)}),n.remove.forEach(function(o){Ct(r,o),Ct(o.get(Ma),i)})}),[]};var tf="categoryValueRef";function ka(e,t){this._bpmnFactory=e,this._elementRegistry=t}ka.$inject=["bpmnFactory","elementRegistry"],ka.prototype._computeUpdates=function(e,t){var n=this._elementRegistry,i=this._bpmnFactory,r=new Map,o=[],a=new Map;function s(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:nf(y)}:P.past={categoryValue:x}))}}function c(y){r.set(y,te(y))}function u(){n.filter(function(y){return w(y,"bpmn:FlowElement")&&!je(y)&&y.parent}).forEach(c)}function l(y){var x=te(y),S=x.get("categoryValueRef");return S||(S=Wm(i,x),o.push(PT(y,S))),S}function f(y){return y.reduce(function(x,S){var P=nf(S),C=x.get(P);return C||(C=[],x.set(P,C)),C.push(S),x},new Map)}e=Array.from(e||[]);var p=f(e);t.length&&u(),e.forEach(c),n.filter(function(y){return w(y,"bpmn:Group")&&!je(y)&&y.parent}).forEach(function(y){var x=te(y).get("categoryValueRef");if(!x){var S=nf(y),P=p.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=f(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 _=d.reduce(function(y,x){var S=r.get(x),P=S.get(tf),C=new Set(P),D=h.get(x)||new Set,T=Array.from(D).filter(function(k){return!C.has(k)}),$=P.filter(function(k){return g.has(k)&&!D.has(k)});return(T.length||$.length)&&y.push({businessObject:S,categoryValuesToAdd:T,categoryValuesToRemove:$}),y},[]);return{flowElements:_,groups:o}},ka.prototype.execute=function(e){var t=e.updates;return t||(t=e.updates=this._computeUpdates(e.affectedFlowElements,e.affectedGroupEntries)),AT(t.groups),MT(t.flowElements),[]},ka.prototype.revert=function(e){var t=e.updates;return kT(t.flowElements),TT(t.groups),[]};function PT(e,t){return{groupShape:e,categoryValue:t,category:t.$parent}}function AT(e){e.forEach(function(t){te(t.groupShape).categoryValueRef=t.categoryValue,t.categoryValue.$parent=t.category})}function TT(e){e.forEach(function(t){te(t.groupShape).categoryValueRef=null})}function MT(e){e.forEach(function(t){var n=t.businessObject,i=n.get(tf);t.categoryValuesToRemove.forEach(function(r){St(i,r)}),t.categoryValuesToAdd.forEach(function(r){Ct(i,r,!0)})})}function kT(e){e.forEach(function(t){var n=t.businessObject,i=n.get(tf);t.categoryValuesToAdd.forEach(function(r){St(i,r)}),t.categoryValuesToRemove.forEach(function(r){Ct(i,r,!0)})})}function nf(e){for(;e.parent;)e=e.parent;return e}function Dc(e){this._moddle=e}Dc.$inject=["moddle"],Dc.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),[]},Dc.prototype.revert=function(e){var t=this._moddle.ids,n=e.id,i=e.element,r=e.claiming;return r?t.unclaim(n):t.claim(n,i),[]};var OT={fill:void 0,stroke:void 0};function rf(e){this._commandStack=e,this._normalizeColor=function(t){if(t){if(wn(t)){var n=DT(t);if(n)return n}throw new Error(`invalid color value: ${t}`)}}}rf.$inject=["commandStack"],rf.prototype.postExecute=function(e){var t=e.elements,n=e.colors||OT,i=this,r={};"fill"in n&&z(r,{"background-color":this._normalizeColor(n.fill)}),"stroke"in n&&z(r,{"border-color":this._normalizeColor(n.stroke)}),L(t,function(o){var a=at(o)?ni(r,["border-color"]):r,s=Ye(o);if(LT(a),je(o)){if(!s||!w(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 DT(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 LT(e){"border-color"in e&&(e.stroke=e["border-color"]),"background-color"in e&&(e.fill=e["background-color"])}var IT={width:0,height:0};function bv(e,t,n){function i(c,u){var l=c.label||c,f=c.labelTarget||c;return uR(l,u),[l,f]}function r(c){var u=c.element,l=u.businessObject,f=c.newLabel;if(!je(u)&&ir(u)&&!Bs(u)&&!_v(f)){var p=7,d=Pl(u);d={x:d.x,y:d.y+p},e.createLabel(u,d,{id:l.id+"_label",businessObject:l,di:u.di})}}function o(c){return c.oldLabel=Fn(c.element),i(c.element,c.newLabel)}function a(c){return i(c.element,c.oldLabel)}function s(c){var u=c.element,l=u.label||u,f=c.newLabel,p=c.newBounds,d=c.hints||{};if(!(!je(l)&&!w(l,"bpmn:TextAnnotation"))){if(je(l)&&_v(f)){d.removeShape!==!1&&e.removeShape(l,{unsetLabel:!1});return}var g=Fn(u);typeof p>"u"&&(p=t.getExternalLabelBounds(l,g)),p&&e.resizeShape(l,p,IT)}}this.preExecute=r,this.execute=o,this.revert=a,this.postExecute=s}bv.$inject=["modeling","textRenderer","bpmnFactory"];function _v(e){return!e||!e.trim()}function nn(e,t,n,i){st.call(this,e,t,n),this._bpmnRules=i}de(nn,st),nn.$inject=["eventBus","elementFactory","commandStack","bpmnRules"],nn.prototype.getHandlers=function(){var e=st.prototype.getHandlers.call(this);return e["element.updateModdleProperties"]=Ca,e["element.updateProperties"]=Aa,e["canvas.updateRoot"]=kc,e["lane.add"]=Qp,e["lane.resize"]=Ta,e["lane.split"]=Jp,e["lane.updateRefs"]=Oc,e["group.updateRefs"]=ka,e["id.updateClaim"]=Dc,e["element.setColor"]=rf,e["element.updateLabel"]=bv,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 xv(){}xv.prototype.layoutConnection=function(e,t){return t=t||{},[t.connectionStart||Oe(t.source||e.source),t.connectionEnd||Oe(t.target||e.target)]};var Lc=20,BT=5,Ic=Math.round,wv=20,NT={"h:h":20,"v:v":20,"h:v":-10,"v:h":-10};function $T(e,t){return!{t:/top/,r:/right/,b:/bottom/,l:/left/,h:/./,v:/./}[t].test(e)}function FT(e,t){return{t:/top/,r:/right/,b:/bottom/,l:/left/,h:/left|right/,v:/top|bottom/}[e].test(t)}function Ev(e,t,n){var i=Jt(t,e,BT),r=n.split(":")[0],o=Ic((t.x-e.x)/2+e.x),a=Ic((t.y-e.y)/2+e.y),s,c,u=FT(r,i),l=/h|r|l/.test(r),f=!1,p=!1;return u?(s=l?{x:o,y:e.y}:{x:e.x,y:a},c=l?"h:h":"v:v"):(f=$T(i,r),c=l?"h:v":"v:h",f?l?(p=a===e.y,s={x:e.x+Lc*(/l/.test(r)?-1:1),y:p?a+Lc:a}):(p=o===e.x,s={x:p?o+Lc:o,y:e.y+Lc*(/t/.test(r)?-1:1)}):s={x:o,y:a}),{waypoints:of(e,s,c).concat(s),directions:c,turnNextDirections:p}}function jT(e,t,n){return Ev(e,t,n)}function HT(e,t,n){var i=Ev(t,e,Sv(n));return{waypoints:i.waypoints.slice().reverse(),directions:Sv(i.directions),turnNextDirections:i.turnNextDirections}}function zT(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=of(e.waypoints[e.waypoints.length-1],t.waypoints[0],r);return{waypoints:o,directions:r}}function Sv(e){return e.split(":").reverse().join(":")}function GT(e,t,n){var i=Ic((t.x-e.x)/2+e.x),r=Ic((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 of(e,t,n){if(n=n||"h:h",!QT(n))throw new Error("unknown directions: <"+n+">: must be specified as <start>:<end> with start/end in { h,v,t,r,b,l }");if(Cv(n)){var i=jT(e,t,n),r=HT(e,t,n),o=zT(i,r);return[].concat(i.waypoints,o.waypoints,r.waypoints)}return GT(e,t,n)}function VT(e,t,n){var i=of(e,t,n);return i.unshift(e),i.push(t),Av(i)}function WT(e,t,n,i,r){var o=r&&r.preferredLayouts||[],a=j0(o,"straight")[0]||"h:h",s=NT[a]||0,c=Jt(e,t,s),u=ZT(c,a);n=n||Oe(e),i=i||Oe(t);var l=u.split(":"),f=Pv(n,e,l[0],JT(c)),p=Pv(i,t,l[1],c);return VT(f,p,u)}function UT(e,t,n,i,r,o){ke(n)&&(r=n,o=i,n=Oe(e),i=Oe(t)),o=z({preferredLayouts:[]},o),r=r||[];var a=o.preferredLayouts,s=a.indexOf("straight")!==-1,c;return c=s&&YT(e,t,n,i,o),c||(c=o.connectionEnd&&XT(t,e,i,r),c)||(c=o.connectionStart&&KT(e,t,n,r),c)?c:!o.connectionStart&&!o.connectionEnd&&r&&r.length?r:WT(e,t,n,i,o)}function qT(e,t,n){return e>=t&&e<=n}function Rv(e,t,n){var i={x:"width",y:"height"};return qT(t[e],n[e],n[e]+n[i[e]])}function YT(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"?Rv(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:Rv(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 KT(e,t,n,i){return af(e,t,n,i)}function XT(e,t,n,i){var r=i.slice().reverse();return r=af(e,t,n,r),r?r.reverse():null}function af(e,t,n,i){function r(l){return l.length<3?!0:l.length>4?!1:!!lt(l,function(f,p){var d=l[p-1];return d&&ta(f,d)<3})}function o(l,f,p){var d=Mi(f,l);switch(d){case"v":return{x:p.x,y:l.y};case"h":return{x:l.x,y:p.y}}return{x:l.x,y:l.y}}function a(l,f,p){var d;for(d=l.length-2;d!==0;d--)if(Zh(l[d],f,wv)||Zh(l[d],p,wv))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=af(e,t,n,u)),c&&Mi(c)?null:c}function ZT(e,t){if(Cv(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 QT(e){return e&&/^h|v|t|r|b|l:h|v|t|r|b|l$/.test(e)}function Cv(e){return e&&/t|r|b|l/.test(e)}function JT(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 Pv(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 Av(e){return e.reduce(function(t,n,i){var r=t[t.length-1],o=e[i+1];return wl(r,o,n,0)||t.push(n),t},[])}var eM=-10,tM=40,nM={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},iM={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},sf={top:"bottom","top-right":"bottom-left","top-left":"bottom-right",right:"left",bottom:"top","bottom-right":"top-left","bottom-left":"top-right",left:"right"},Oa={top:"t",right:"r",bottom:"b",left:"l"};function Bc(e){this._elementRegistry=e}de(Bc,xv),Bc.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=Tv(r&&r[0],n)),a||(a=Tv(r&&r[r.length-1],i)),(w(e,"bpmn:Association")||w(e,"bpmn:DataAssociation"))&&r&&!Mv(n,i))return[].concat([o],r.slice(1,-1),[a]);var l=Hm(n,s)?nM:iM;return w(e,"bpmn:MessageFlow")?c=oM(n,i,l):(w(e,"bpmn:SequenceFlow")||Mv(n,i))&&(n===i?c={preferredLayouts:pM(n,e,l)}:w(n,"bpmn:BoundaryEvent")?c={preferredLayouts:fM(n,i,a,l)}:Da(n)||Da(i)?c={preferredLayouts:l.subProcess,preserveDocking:sM(n)}:w(n,"bpmn:Gateway")?c={preferredLayouts:l.fromGateway}:w(i,"bpmn:Gateway")?c={preferredLayouts:l.toGateway}:c={preferredLayouts:l.default}),c&&(c=z(c,t),u=Av(UT(n,i,o,a,r,c))),u||[o,a]};function rM(e){var t=e.host;return Jt(Oe(e),t,eM)}function oM(e,t,n){return{preferredLayouts:n.messageFlow,preserveDocking:aM(e,t)}}function aM(e,t){return w(t,"bpmn:Participant")?"source":w(e,"bpmn:Participant")?"target":Da(t)?"source":Da(e)||w(t,"bpmn:Event")?"target":w(e,"bpmn:Event")?"source":null}function sM(e){return Da(e)?"target":"source"}function Tv(e,t){return e?e.original||e:Oe(t)}function Mv(e,t){return w(t,"bpmn:Activity")&&w(e,"bpmn:BoundaryEvent")&&t.businessObject.isForCompensation}function Da(e){return w(e,"bpmn:SubProcess")&&We(e)}function jr(e,t){return e===t}function cM(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 kv(e,t){return sf[e]===t}function uM(e,t){var n=To(e),i=sf[n];return t.indexOf(i)!==-1}function lM(e,t){var n=Mo(e),i=sf[n];return t.indexOf(i)!==-1}function Ov(e){return e==="right"||e==="left"}function pM(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 fM(e,t,n,i){var r=Oe(e),o=Oe(t),a=rM(e),s,c,u=jr(e.host,t),l=cM(a,["top","right","bottom","left"]),f=Jt(o,r,{x:e.width/2+t.width/2,y:e.height/2+t.height/2});return u?dM(a,l,e,t,n,i):(s=hM(a,f,l,i.isHorizontal),c=mM(a,f,l,i.isHorizontal),[s+":"+c])}function dM(e,t,n,i,r,o){var a=t?e:o.isHorizontal?Mo(e):To(e),s=Oa[a],c;return t?Ov(e)?c=Dv("y",n,i,r)?"h":o.boundaryLoop.alternateHorizontalSide:c=Dv("x",n,i,r)?"v":o.boundaryLoop.alternateVerticalSide:c=o.boundaryLoop.default,[s+":"+c]}function Dv(e,t,n,i){var r=tM;return!(cf(e,i,n,r)||cf(e,i,{x:n.x+n.width,y:n.y+n.height},r)||cf(e,i,Oe(t),r))}function cf(e,t,n,i){return Math.abs(t[e]-n[e])<i}function hM(e,t,n,i){if(n)return Oa[e];var r=Mo(e),o=To(e),a=Mo(t),s=To(t);if(i){if(jr(r,a)||kv(o,s))return Oa[r]}else if(jr(o,s)||kv(r,a))return Oa[o];return Oa[i?o:r]}function mM(e,t,n,i){if(n)return Ov(e)?uM(e,t)||jr(e,t)?"h":"v":lM(e,t)||jr(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?jr(r,a)?"h":"v":jr(o,s)?"v":"h"}Bc.$inject=["elementRegistry"];function Lv(e){return z({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(Lv(i)),o.push(Lv(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 na(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 uf={__init__:["modeling","bpmnUpdater"],__depends__:[LP,XP,QP,JP,Uy,eT,nT,cT,Kn,Wp,Qy],bpmnFactory:["type",Zn],bpmnUpdater:["type",kn],elementFactory:["type",pr],modeling:["type",nn],layouter:["type",Bc],connectionDocking:["type",hr]};var gM=10,Iv=50,yM=250;function lf(e,t,n,i){for(var r;r=vM(e,n,t);)n=i(t,n,r);return n}function pf(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 vM(e,t,n){var i={x:t.x-n.width/2,y:t.y-n.height/2,width:n.width,height:n.height},r=_M(e);return lt(r,function(o){if(o===n)return!1;var a=Jt(o,i,gM);return a==="intersect"})}function bM(e,t){t||(t={});function n(g){return g.source===e?1:-1}var i=t.defaultDistance||Iv,r=t.direction||"e",o=t.filter,a=t.getWeight||n,s=t.maxDistance||yM,c=t.reference||"start";o||(o=EM);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}}),f=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}}),p=l.concat(f).reduce(function(g,h){return g[h.id+"__weight_"+h.weight]=h,g},{}),d=Sn(p,function(g,h){var m=h.distance,_=h.weight;return m<0||m>s||(g[String(m)]||(g[String(m)]=0),g[String(m)]+=1*_,(!g.distance||g[g.distance]<g[String(m)])&&(g.distance=m)),g},{});return d.distance||i}function _M(e){var t=ff(e);return e.host&&(t=t.concat(ff(e.host))),e.attachers&&(t=t.concat(e.attachers.reduce(function(n,i){return n.concat(ff(i))},[]))),t}function ff(e){return wM(e).concat(xM(e))}function xM(e){return e.incoming.map(function(t){return t.source})}function wM(e){return e.outgoing.map(function(t){return t.target})}function EM(){return!0}var SM=100;function Bv(e,t,n){e.on("autoPlace",SM,function(i){var r=i.shape,o=i.source;return RM(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}}Bv.$inject=["eventBus","modeling","canvas"];function RM(e,t,n){n||(n={});var i=n.defaultDistance||Iv,r=Oe(e),o=Pe(e);return{x:o.right+i+t.width/2,y:r.y}}function Nv(e,t){e.on("autoPlace.end",500,function(n){t.select(n.shape)})}Nv.$inject=["eventBus","selection"];const CM={__init__:["autoPlaceSelectionBehavior"],autoPlace:["type",Bv],autoPlaceSelectionBehavior:["type",Nv]};function $v(e,t,n){var i=Hm(e,n);if(w(t,"bpmn:TextAnnotation"))return AM(e,t,i);if(ze(t,["bpmn:DataObjectReference","bpmn:DataStoreReference"]))return TM(e,t,i);if(w(t,"bpmn:FlowNode"))return PM(e,t,i)}function PM(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=bM(e,{filter:function(d){return w(d,"bpmn:SequenceFlow")},direction:o.directionHint}),s=30,c=o.minDistance,u=o.baseOrientation;w(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+Fv(u,c,o)}:{x:r.x+Fv(u,c,o),y:i.bottom+a+t.height/2},f={margin:s,minDistance:c},p=n?{y:f}:{x:f};return lf(e,t,l,pf(p))}function Fv(e,t,n){return e.includes(n.start)?-1*t:e.includes(n.end)?t:0}function AM(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};at(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 lf(e,t,r,pf(a))}function TM(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 lf(e,t,r,pf(a))}function jv(e,t){e.on("autoPlace",function(n){var i=n.shape,r=n.source;return $v(r,i,t)})}jv.$inject=["eventBus","elementRegistry"];const Nc={__depends__:[CM],__init__:["bpmnAutoPlace"],bpmnAutoPlace:["type",jv]},Hv=[Fm,ca,uf,Nc];function MM(e={}){Dd(globalThis,e.dom);const t=document.createElement("div");return document.body.appendChild(t),new fo({container:t,moddleExtensions:e.moddleExtensions??cs,additionalModules:[...Hv,...e.additionalModules??[]]})}var kM=new Po("ov"),OM=500;function Xt(e,t,n,i){this._eventBus=t,this._canvas=n,this._elementRegistry=i,this._ids=kM,this._overlayDefaults=z({show:null,scale:!0},e&&e.defaults),this._overlays={},this._overlayContainers=[],this._overlayRoot=DM(n.getContainer()),this._init()}Xt.$inject=["config.overlays","eventBus","canvas","elementRegistry"],Xt.prototype.get=function(e){if(wn(e)&&(e={id:e}),wn(e.element)&&(e.element=this._elementRegistry.get(e.element)),e.element){var t=this._getOverlayContainer(e.element,!0);return t?e.type?Ge(t.overlays,eo({type:e.type})):t.overlays.slice():[]}else return e.type?Ge(this._overlays,eo({type:e.type})):e.id?this._overlays[e.id]:null},Xt.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=z({},this._overlayDefaults,n,{id:i,type:t,element:e,html:n.html}),this._addOverlay(n),i},Xt.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&&(di(i.html),di(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)}})},Xt.prototype.isShown=function(){return this._overlayRoot.style.display!=="none"},Xt.prototype.show=function(){$c(this._overlayRoot)},Xt.prototype.hide=function(){$c(this._overlayRoot,!1)},Xt.prototype.clear=function(){this._overlays={},this._overlayContainers=[],xs(this._overlayRoot)},Xt.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}zv(n,i,r),sn(e.html,"data-container-id",t.id)},Xt.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}zv(n,r||0,o||0),this._updateOverlayVisibilty(e,this._canvas.viewbox())},Xt.prototype._createOverlayContainer=function(e){var t=dt('<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},Xt.prototype._updateRoot=function(e){var t=e.scale||1,n="matrix("+[t,0,0,t,-1*e.x*t,-1*e.y*t].join(",")+")";Gv(this._overlayRoot,n)},Xt.prototype._getOverlayContainer=function(e,t){var n=lt(this._overlayContainers,function(i){return i.element===e});return!n&&!t?this._createOverlayContainer(e):n},Xt.prototype._addOverlay=function(e){var t=e.id,n=e.element,i=e.html,r,o;i.get&&i.constructor.prototype.jquery&&(i=i.get(0)),wn(i)&&(i=dt(i)),o=this._getOverlayContainer(n),r=dt('<div class="djs-overlay" data-overlay-id="'+t+'">'),dn(r,{position:"absolute"}),r.appendChild(i),e.type&&vt(r).add("djs-overlay-"+e.type);var a=this._canvas.findRoot(n),s=this._canvas.getRootElement();$c(r,a===s),e.htmlContainer=r,o.overlays.push(e),o.html.appendChild(r),this._overlays[t]=e,this._updateOverlay(e),this._updateOverlayVisibilty(e,this._canvas.viewbox())},Xt.prototype._updateOverlayVisibilty=function(e,t){var n=e.show,i=this._canvas.findRoot(e.element),r=n&&n.minZoom,o=n&&n.maxZoom,a=e.htmlContainer,s=this._canvas.getRootElement(),c=!0;(i!==s||n&&($t(r)&&r>t.scale||$t(o)&&o<t.scale))&&(c=!1),$c(a,c),this._updateOverlayScale(e,t)},Xt.prototype._updateOverlayScale=function(e,t){var n=e.scale,i,r,o=e.htmlContainer,a,s="";n!==!0&&(n===!1?(i=1,r=1):(i=n.min,r=n.max),$t(i)&&t.scale<i&&(a=(1/t.scale||1)*i),$t(r)&&t.scale>r&&(a=(1/t.scale||1)*r)),$t(a)&&(s="scale("+a+","+a+")"),Gv(o,s)},Xt.prototype._updateOverlaysVisibilty=function(e){var t=this;L(this._overlays,function(n){t._updateOverlayVisibilty(n,e)})},Xt.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){di(a.html);var s=t._overlayContainers.indexOf(a);s!==-1&&t._overlayContainers.splice(s,1)}}),e.on("element.changed",OM,function(i){var r=i.element,o=t._getOverlayContainer(r,!0);o&&(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&&vt(r.html)[i.add?"add":"remove"](i.marker)}),e.on("root.set",function(){t._updateOverlaysVisibilty(t._canvas.viewbox())}),e.on("diagram.clear",this.clear,this)};function DM(e){var t=dt('<div class="djs-overlay-container" />');return dn(t,{position:"absolute",width:0,height:0}),e.insertBefore(t,e.firstChild),t}function zv(e,t,n){dn(e,{left:t+"px",top:n+"px"})}function $c(e,t){e.style.display=t===!1?"none":""}function Gv(e,t){e.style["transform-origin"]="top left",["","-ms-","-webkit-"].forEach(function(n){e.style[n+"transform"]=t})}const Fc={__init__:["overlays"],overlays:["type",Xt]};function df(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(df,J),df.$inject=["canvas","injector"];const LM={__init__:["rootElementsBehavior"],rootElementsBehavior:["type",df]};function La(e){return CSS.escape(e)}var IM={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"};function Vv(e){return e=""+e,e&&e.replace(/[&<>"']/g,function(t){return IM[t]})}var BM="bjs-breadcrumbs-shown";function Wv(e,t,n){var i=dt('<ul class="bjs-breadcrumbs"></ul>'),r=n.getContainer(),o=vt(r);r.appendChild(i);var a=[];e.on("element.changed",function(c){var u=c.element,l=te(u),f=lt(a,function(p){return p===l});f&&s()});function s(c){c&&(a=NM(c));var u=a.flatMap(function(f){var p=n.findRoot(vi(f))||n.findRoot(f.id);if(!p&&w(f,"bpmn:Process")){var d=t.find(function(m){var _=te(m);return _&&_.get("processRef")===f});p=d&&n.findRoot(d.id)}if(!p)return[];var g=Vv(f.name||f.id),h=dt('<li><span class="bjs-crumb"><a title="'+g+'">'+g+"</a></span></li>");return h.addEventListener("click",function(){n.setRootElement(p)}),h});i.innerHTML="";var l=u.length>1;o.toggle(BM,l),u.forEach(function(f){i.appendChild(f)})}e.on("root.set",function(c){s(c.element)})}Wv.$inject=["eventBus","elementRegistry","canvas"];function NM(e){for(var t=te(e),n=[],i=t;i;i=i.$parent)(w(i,"bpmn:SubProcess")||w(i,"bpmn:Process"))&&n.push(i);return n.reverse()}function Uv(e,t){var n=null,i=new $M;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,!(!w(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})}Uv.$inject=["eventBus","canvas"];function $M(){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 qv={x:180,y:160};function Hr(e,t){this._eventBus=e,this._moddle=t;var n=this;e.on("import.render.start",1500,function(i,r){n._handleImport(r.definitions)})}Hr.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)})}},Hr.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;w(a,"bpmn:SubProcess")&&!o.isExpanded&&n.push(a),jM(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},Hr.prototype._movePlaneElementsToOrigin=function(e){var t=e.get("planeElement"),n=FM(e),i={x:n.x-qv.x,y:n.y-qv.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)})},Hr.prototype._moveToDiPlane=function(e,t){var n=Yv(e),i=n.plane.get("planeElement");i.splice(i.indexOf(e),1),t.get("planeElement").push(e)},Hr.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},Hr.$inject=["eventBus","moddle"];function Yv(e){return w(e,"bpmndi:BPMNDiagram")?e:Yv(e.$parent)}function FM(e){var t={top:1/0,right:-1/0,bottom:-1/0,left:1/0};return e.planeElement.forEach(function(n){if(n.bounds){var i=Pe(n.bounds);t.top=Math.min(i.top,t.top),t.left=Math.min(i.left,t.left)}}),Ms(t)}function jM(e,t){var n=e.$parent;return!(!w(n,"bpmn:SubProcess")||n===t.bpmnElement||ze(e,["bpmn:DataInputAssociation","bpmn:DataOutputAssociation"]))}var jc=250,HM='<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 16 16"><path fill-rule="evenodd" d="M4.81801948,3.50735931 L10.4996894,9.1896894 L10.5,4 L12,4 L12,12 L4,12 L4,10.5 L9.6896894,10.4996894 L3.75735931,4.56801948 C3.46446609,4.27512627 3.46446609,3.80025253 3.75735931,3.50735931 C4.05025253,3.21446609 4.52512627,3.21446609 4.81801948,3.50735931 Z"/></svg>',zM="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 w(e,"bpmn:SubProcess")&&t.findRoot(vi(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;vt(i.html).toggle(zM,!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=dt('<button type="button" class="bjs-drilldown">'+HM+"</button>"),a=i.get("name")||i.get("id"),s=this._translate("Open {element}",{element:a});o.setAttribute("title",s),o.addEventListener("click",function(){t.setRootElement(t.findRoot(vi(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 GM={__depends__:[Fc,Wp,LM],__init__:["drilldownBreadcrumbs","drilldownOverlayBehavior","drilldownCentering","subprocessCompatibility"],drilldownBreadcrumbs:["type",Wv],drilldownCentering:["type",Uv],drilldownOverlayBehavior:["type",mr],subprocessCompatibility:["type",Hr]};function gr(e){bt.call(this,e)}de(gr,bt),gr.prototype._modules=[Fm,GM,Fc,Kn,ca],gr.prototype._moddleExtensions={};var Hc="keyboard.keydown",VM="keyboard.keyup",WM=1e3,Kv="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(Kv));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,Hc)},hn.prototype._keyupHandler=function(e){this._keyHandler(e,VM)},hn.prototype._keyHandler=function(e,t){var n;if(!this._isEventIgnored(e)){var i={keyEvent:e};n=this._eventBus.fire(t||Hc,i),n&&e.preventDefault()}},hn.prototype._isEventIgnored=function(e){return!1},hn.prototype.bind=function(e){e&&console.error("unsupported argument <node>",new Error(Kv)),this.unbind(),e=this._node=this._target,Be.bind(e,"keydown",this._keydownHandler),Be.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"),Be.unbind(e,"keydown",this._keydownHandler),Be.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=WM),this._eventBus.on(n||Hc,e,t)},hn.prototype.removeListener=function(e,t){this._eventBus.off(t||Hc,e)},hn.prototype.hasModifier=fA,hn.prototype.isCmd=Tn,hn.prototype.isShift=Lp,hn.prototype.isKey=Ht;var UM=500;function ko(e,t){var n=this;e.on("editorActions.init",UM,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(yA(r))return t.trigger("undo"),!0}),n("redo",function(i){var r=i.keyEvent;if(vA(r))return t.trigger("redo"),!0}),n("copy",function(i){var r=i.keyEvent;if(dA(r))return t.trigger("copy"),!0}),n("paste",function(i){var r=i.keyEvent;if(hA(r))return t.trigger("paste"),!0}),n("duplicate",function(i){var r=i.keyEvent;if(mA(r))return t.trigger("duplicate"),!0}),n("cut",function(i){var r=i.keyEvent;if(gA(r))return t.trigger("cut"),!0}),n("stepZoom",function(i){var r=i.keyEvent;if(Ht(["+","Add","="],r)&&Tn(r))return t.trigger("stepZoom",{value:1}),!0}),n("stepZoom",function(i){var r=i.keyEvent;if(Ht(["-","Subtract"],r)&&Tn(r))return t.trigger("stepZoom",{value:-1}),!0}),n("zoom",function(i){var r=i.keyEvent;if(Ht("0",r)&&Tn(r))return t.trigger("zoom",{value:1}),!0}),n("removeSelection",function(i){var r=i.keyEvent;if(Ht(["Backspace","Delete","Del"],r))return t.trigger("removeSelection"),!0})};const hf={__init__:["keyboard","keyboardBindings"],keyboard:["type",hn],keyboardBindings:["type",ko]};var qM={moveSpeed:50,moveSpeedAccelerated:200};function Xv(e,t,n){var i=this;this._config=z({},qM,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})}}Xv.$inject=["config.keyboardMove","keyboard","canvas"];const Zv={__depends__:[hf],__init__:["keyboardMove"],keyboardMove:["type",Xv]};var YM=15;function Qv(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=Ir(s),f=oi(l,c);if(!n.dragging&&KM(f)>YM&&(n.dragging=!0,u===0&&Ry(e),hc("grab")),n.dragging){var p=n.last||n.start;f=oi(l,p),t.scroll({dx:f.x,dy:f.y}),n.last=l}s.preventDefault()}function o(s){Be.unbind(document,"mousemove",r),Be.unbind(document,"mouseup",o),n=null,Sy()}function a(s){if(!Tr(s.target,".djs-draggable")){var c=s.button;if(!(c>=2||s.ctrlKey||s.shiftKey||s.altKey))return n={button:c,start:Ir(s)},Be.bind(document,"mousemove",r),Be.bind(document,"mouseup",o),!0}}this.isActive=function(){return!!n}}Qv.$inject=["eventBus","canvas"];function KM(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}const Jv={__init__:["moveCanvas"],moveCanvas:["type",Qv]};function eb(e,t){var n=kl(e.min),i=kl(e.max),r=Math.abs(n)+Math.abs(i);return r/t}function XM(e,t){return Math.max(e.min,Math.min(e.max,t))}var ZM=Math.sign||function(e){return e>=0?1:-1},mf={min:.2,max:4},tb=10,QM=.1,JM=.75;function xi(e,t,n){e=e||{},this._enabled=!1,this._canvas=n,this._container=n._container,this._handleWheel=gn(this._handleWheel,this),this._totalDelta=0,this._scale=e.scale||JM;var i=this;t.on("canvas.mouseover",function(){i._init(e.enabled!==!1)}),t.on("canvas.mouseout",function(){i._init(!1)})}xi.$inject=["config.zoomScroll","eventBus","canvas"],xi.prototype.scroll=function(t){this._canvas.scroll(t)},xi.prototype.reset=function(){this._canvas.zoom("fit-viewport")},xi.prototype.zoom=function(t,n){var i=eb(mf,tb*2);this._totalDelta+=t,Math.abs(this._totalDelta)>QM&&(this._zoom(t,n,i),this._totalDelta=0)},xi.prototype._handleWheel=function(t){if(this._enabled){var n=this._container;t.preventDefault();var i=t.ctrlKey||Og()&&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))*ZM(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)}},xi.prototype.stepZoom=function(t,n){var i=eb(mf,tb);this._zoom(t,n,i)},xi.prototype._zoom=function(e,t,n){var i=this._canvas,r=e>0?1:-1,o=kl(i.zoom()),a=Math.round(o/n)*n;a+=n*r;var s=Math.pow(10,a);i.zoom(XM(mf,s),t)},xi.prototype.toggle=function(t){var n=this._container,i=this._handleWheel,r=this._enabled;return typeof t>"u"&&(t=!r),r!==t&&Be[t?"bind":"unbind"](n,"wheel",i,!1),this._enabled=t,t},xi.prototype._init=function(e){this.toggle(e)};const nb={__init__:["zoomScroll"],zoomScroll:["type",xi]};function Ia(e){gr.call(this,e)}de(Ia,gr),Ia.prototype._navigationModules=[Zv,Jv,nb],Ia.prototype._modules=[].concat(gr.prototype._modules,Ia.prototype._navigationModules);function gf(e){return e&&e[e.length-1]}function ib(e){return e.y}function rb(e){return e.x}var e2={left:rb,center:rb,right:function(e){return e.x+e.width},top:ib,middle:ib,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 f(p,d){return Math.round((p[i]+d[i]+d[r])/2)}if(this._isType(e,["left","top"]))o[e]=t[0][i];else if(this._isType(e,["right","bottom"]))l=gf(t),o[e]=l[i]+l[r];else if(this._isType(e,["center","middle"])){if(L(t,function(p){var d=p[i]+Math.round(p[r]/2);a[d]?a[d].elements.push(p):a[d]={elements:[p],center:d}}),c=ci(a,function(p){return p.elements.length>1&&(s=!0),p.elements.length}),s)return o[e]=gf(c).center,o;u=t[0],t=ci(t,function(p){return p[i]+p[r]}),l=gf(t),o[e]=f(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=e2[t],a=ci(r,o),s=this._alignmentPosition(t,a);n.alignElements(a,s)}};const t2={__init__:["alignElements"],alignElements:["type",Oo]},n2=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=n2.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=i2();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 i2(){const e={};return e.promise=new Promise((t,n)=>{e.resolve=t,e.reject=n}),e}const r2={scheduler:["type",Do]};var o2="djs-element-hidden",zc=".entry",a2=1e3,ob=8,s2=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=dt('<div class="djs-context-pad-parent"></div>');return this._canvas.getContainer().appendChild(e),e},kt.prototype.registerProvider=function(e,t){t||(t=e,e=a2),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)},s2);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=dt(r.html||'<div class="entry" draggable="true"></div>'),c;sn(s,"data-action",o),c=rt("[data-group="+La(a)+"]",n),c||(c=dt('<div class="group"></div>'),sn(c,"data-group",a),n.appendChild(c)),c.appendChild(s),r.className&&c2(s,r.className),r.title&&sn(s,"title",r.title),r.imageUrl&&(i=dt("<img>"),sn(i,"src",r.imageUrl),i.style.width="100%",i.style.height="100%",s.appendChild(i))}),vt(n).add("open"),this._current={entries:t,html:n,target:e},this._updatePosition(),this._updateVisibility(),this._eventBus.fire("contextPad.open",{current:this._current})},kt.prototype._createHtml=function(e){var t=this,n=dt('<div class="djs-context-pad"></div>');return Cn.bind(n,zc,"click",function(i){t.trigger("click",i)}),Cn.bind(n,zc,"dragstart",function(i){t.trigger("dragstart",i)}),Cn.bind(n,zc,"mouseover",function(i){t.trigger("mouseover",i)}),Cn.bind(n,zc,"mouseout",function(i){t.trigger("mouseout",i)}),Be.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()&&l2(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()&&vt(this._current.html).has("open")},kt.prototype.show=function(){this.isOpen()&&(vt(this._current.html).add("open"),this._updatePosition(),this._eventBus.fire("contextPad.show",{current:this._current}))},kt.prototype.hide=function(){this.isOpen()&&(vt(this._current.html).remove("open"),this._eventBus.fire("contextPad.hide",{current:this._current}))},kt.prototype._getPosition=function(e){if(!ke(e)&&at(e)){var t=this._canvas.viewbox(),n=u2(e),i=n.x*t.scale-t.x*t.scale,r=n.y*t.scale-t.y*t.scale;return{left:i+ob*this._canvas.zoom(),top:r}}var o=this._canvas.getContainer(),a=o.getBoundingClientRect(),s=this._getTargetBounds(e);return{left:s.right-a.left+ob*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,o2)});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 c2(e,t){var n=vt(e);t=ke(t)?t:t.split(/\s+/g),t.forEach(function(i){n.add(i)})}function u2(e){return e.waypoints[e.waypoints.length-1]}function l2(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 ab={__depends__:[dc,r2,Fc],contextPad:["type",kt]};var Gc,xt,sb,yr,cb,ub,lb,yf,Vc,Ba,pb,vf,bf,_f,Wc={},Uc=[],p2=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,qc=Array.isArray;function ji(e,t){for(var n in t)e[n]=t[n];return e}function xf(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function fb(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?Gc.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 Yc(e,a,i,r,null)}function Yc(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??++sb,__i:-1,__u:0};return r==null&&xt.vnode!=null&&xt.vnode(o),o}function Kc(e){return e.children}function Xc(e,t){this.props=e,this.context=t}function zr(e,t){if(t==null)return e.__?zr(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"?zr(e):null}function f2(e){if(e.__P&&e.__d){var t=e.__v,n=t.__e,i=[],r=[],o=ji({},t);o.__v=t.__v+1,xt.vnode&&xt.vnode(o),wf(e.__P,o,t,e.__n,e.__P.namespaceURI,32&t.__u?[n]:null,i,n??zr(t),!!(32&t.__u),r),o.__v=t.__v,o.__.__k[o.__i]=o,_b(i,o,r),t.__e=t.__=null,o.__e!=n&&db(o)}}function db(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}),db(e)}function hb(e){(!e.__d&&(e.__d=!0)&&yr.push(e)&&!Zc.__r++||cb!=xt.debounceRendering)&&((cb=xt.debounceRendering)||ub)(Zc)}function Zc(){try{for(var e,t=1;yr.length;)yr.length>t&&yr.sort(lb),e=yr.shift(),t=yr.length,f2(e)}finally{yr.length=Zc.__r=0}}function mb(e,t,n,i,r,o,a,s,c,u,l){var f,p,d,g,h,m,_=i&&i.__k||Uc,y=t.length;for(c=d2(n,t,_,c,y),f=0;f<y;f++)(d=n.__k[f])!=null&&(p=d.__i!=-1&&_[d.__i]||Wc,d.__i=f,m=wf(e,d,p,r,o,a,s,c,u,l),g=d.__e,d.ref&&p.ref!=d.ref&&(p.ref&&Ef(p.ref,null,d),l.push(d.ref,d.__c||g,d)),h==null&&g!=null&&(h=g),4&d.__u?(c=gb(d,c,e),p.__e&&(p.__e=null)):typeof d.type=="function"&&m!==void 0?c=m:g&&(c=g.nextSibling),d.__u&=-7);return n.__e=h,c}function d2(e,t,n,i,r){var o,a,s,c,u,l=n.length,f=l,p=0;for(e.__k=new Array(r),o=0;o<r;o++)(a=t[o])!=null&&typeof a!="boolean"&&typeof a!="function"?(typeof a=="string"||typeof a=="number"||typeof a=="bigint"||a.constructor==String?a=e.__k[o]=Yc(null,a,null,null,null):qc(a)?a=e.__k[o]=Yc(Kc,{children:a},null,null,null):a.constructor===void 0&&a.__b>0?a=e.__k[o]=Yc(a.type,a.props,a.key,a.ref?a.ref:null,a.__v):e.__k[o]=a,c=o+p,a.__=e,a.__b=e.__b+1,s=null,(u=a.__i=h2(a,n,c,f))!=-1&&(f--,(s=n[u])&&(s.__u|=2)),s==null||s.__v==null?(u==-1&&(r>l?p--:r<l&&p++),typeof a.type!="function"&&(a.__u|=4)):u!=c&&(u==c-1?p--:u==c+1?p++:(u>c?p--:p++,a.__u|=4))):e.__k[o]=null;if(f)for(o=0;o<l;o++)(s=n[o])!=null&&(2&s.__u)==0&&(s.__e==i&&(i=zr(s)),wb(s,s));return i}function gb(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=gb(i[r],t,n));return t}e.__e!=t&&(t&&e.type&&!t.parentNode&&(t=zr(e)),t=n.insertBefore(e.__e,t||null));do t=t&&t.nextSibling;while(t!=null&&t.nodeType==8);return t}function h2(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 yb(e,t,n){t[0]=="-"?e.setProperty(t,n??""):e[t]=n==null?"":typeof n!="number"||p2.test(t)?n:n+"px"}function Qc(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||yb(e.style,t,"");if(n)for(t in n)i&&n[t]==i[t]||yb(e.style,t,n[t])}else if(t[0]=="o"&&t[1]=="n")o=t!=(t=t.replace(pb,"$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[Ba]=i[Ba]:(n[Ba]=vf,e.addEventListener(t,o?_f:bf,o)):e.removeEventListener(t,o?_f:bf,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 vb(e){return function(t){if(this.l){var n=this.l[t.type+e];if(t[Vc]==null)t[Vc]=vf++;else if(t[Vc]<n[Ba])return;return n(xt.event?xt.event(t):t)}}}function wf(e,t,n,i,r,o,a,s,c,u){var l,f,p,d,g,h,m,_,y,x,S,P,C,D,T,$,k=t.type;if(t.constructor!==void 0)return null;128&n.__u&&(c=!!(32&n.__u),o=[s=t.__e=n.__e]),(l=xt.__b)&&l(t);e:if(typeof k=="function"){f=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?_=(p=t.__c=n.__c).__=p.__E:(x?t.__c=p=new k(y,P):(t.__c=p=new Xc(y,P),p.constructor=k,p.render=g2),S&&S.sub(p),p.state||(p.state={}),p.__n=i,d=p.__d=!0,p.__h=[],p._sb=[]),x&&p.__s==null&&(p.__s=p.state),x&&k.getDerivedStateFromProps!=null&&(p.__s==p.state&&(p.__s=ji({},p.__s)),ji(p.__s,k.getDerivedStateFromProps(y,p.__s))),g=p.props,h=p.state,p.__v=t,d)x&&k.getDerivedStateFromProps==null&&p.componentWillMount!=null&&p.componentWillMount(),x&&p.componentDidMount!=null&&p.__h.push(p.componentDidMount);else{if(x&&k.getDerivedStateFromProps==null&&y!==g&&p.componentWillReceiveProps!=null&&p.componentWillReceiveProps(y,P),t.__v==n.__v||!p.__e&&p.shouldComponentUpdate!=null&&p.shouldComponentUpdate(y,p.__s,P)===!1){t.__v!=n.__v&&(p.props=y,p.state=p.__s,p.__d=!1),t.__e=n.__e,t.__k=n.__k,t.__k.some(function(O){O&&(O.__=t)}),Uc.push.apply(p.__h,p._sb),p._sb=[],p.__h.length&&a.push(p),s=zr(n);break e}p.componentWillUpdate!=null&&p.componentWillUpdate(y,p.__s,P),x&&p.componentDidUpdate!=null&&p.__h.push(function(){p.componentDidUpdate(g,h,m)})}if(p.context=P,p.props=y,p.__P=e,p.__e=!1,C=xt.__r,D=0,x)p.state=p.__s,p.__d=!1,C&&C(t),l=p.render(p.props,p.state,p.context),Uc.push.apply(p.__h,p._sb),p._sb=[];else do p.__d=!1,C&&C(t),l=p.render(p.props,p.state,p.context),p.state=p.__s;while(p.__d&&++D<25);p.state=p.__s,p.getChildContext!=null&&(i=ji(ji({},i),p.getChildContext())),x&&!d&&p.getSnapshotBeforeUpdate!=null&&(m=p.getSnapshotBeforeUpdate(g,h)),T=l!=null&&l.type===Kc&&l.key==null?xb(l.props.children):l,s=mb(e,qc(T)?T:[T],t,n,i,r,o,a,s,c,u),p.base=t.__e,t.__u&=-161,p.__h.length&&a.push(p),_&&(p.__E=p.__=null)}catch(O){if(a.length=f,t.__v=null,c||o!=null){if(O.then){for(t.__u|=c?160:128;s&&s.nodeType==8&&s.nextSibling;)s=s.nextSibling;o!=null&&(o[o.indexOf(s)]=null),t.__e=s}else if(o!=null)for($=o.length;$--;)xf(o[$])}else t.__e=n.__e;t.__k==null&&(t.__k=n.__k||[]),O.then||bb(t),xt.__e(O,t,n)}}else o==null&&t.__v==n.__v?(t.__k=n.__k,t.__e=n.__e):s=t.__e=m2(n.__e,t,n,i,r,o,a,c,u);return(l=xt.diffed)&&l(t),128&t.__u?void 0:s}function bb(e){e&&(e.__c&&(e.__c.__e=!0),e.__k&&e.__k.some(bb))}function _b(e,t,n){for(var i=0;i<n.length;i++)Ef(n[i],n[++i],n[++i]);xt.__c&&xt.__c(t,e),e.some(function(r){try{e=r.__h,r.__h=[],e.some(function(o){o.call(r)})}catch(o){xt.__e(o,r.__v)}})}function xb(e){return typeof e!="object"||e==null||e.__b>0?e:qc(e)?e.map(xb):e.constructor!==void 0?null:ji({},e)}function m2(e,t,n,i,r,o,a,s,c){var u,l,f,p,d,g,h,m=n.props||Wc,_=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=document.createElementNS(r,y,_.is&&_),s&&(xt.__m&&xt.__m(t,o),s=!1),o=null}if(y==null)m===_||s&&e.data==_||(e.data=_);else{if(o=y=="textarea"&&_.defaultValue!=null?null:o&&Gc.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"?f=d:u=="children"||u in _||u=="value"&&"defaultValue"in _||u=="checked"&&"defaultChecked"in _||Qc(e,u,null,d,r);for(u in _)d=_[u],u=="children"?p=d:u=="dangerouslySetInnerHTML"?l=d:u=="value"?g=d:u=="checked"?h=d:s&&typeof d!="function"||m[u]===d||Qc(e,u,d,m[u],r);if(l)s||f&&(l.__html==f.__html||l.__html==e.innerHTML)||(e.innerHTML=l.__html),t.__k=[];else if(f&&(e.innerHTML=""),mb(t.type=="template"?e.content:e,qc(p)?p:[p],t,n,i,y=="foreignObject"?"http://www.w3.org/1999/xhtml":r,o,a,o?o[0]:n.__k&&zr(n,0),s,c),o!=null)for(u=o.length;u--;)xf(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])&&Qc(e,u,g,m[u],r),u="checked",h!=null&&h!=e[u]&&Qc(e,u,h,m[u],r))}return e}function Ef(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){xt.__e(r,n)}}function wb(e,t,n){var i,r;if(xt.unmount&&xt.unmount(e),(i=e.ref)&&(i.current&&i.current!=e.__e||Ef(i,null,t)),(i=e.__c)!=null){if(i.componentWillUnmount)try{i.componentWillUnmount()}catch(o){xt.__e(o,t)}i.base=i.__P=i.__n=null}if(i=e.__k)for(r=0;r<i.length;r++)i[r]&&wb(i[r],t,n||typeof e.type!="function");n||xf(e.__e),e.__c=e.__=e.__e=void 0}function g2(e,t,n){return this.constructor(e,n)}function Eb(e,t,n){var i,r,o,a;t==document&&(t=document.documentElement),xt.__&&xt.__(e,t),r=(i=!1)?null:t.__k,o=[],a=[],wf(t,e=t.__k=fb(Kc,null,[e]),r||Wc,Wc,t.namespaceURI,r?null:t.firstChild?Gc.call(t.childNodes):null,o,r?r.__e:t.firstChild,i,a),_b(o,e,a),e.props.children=null}Gc=Uc.slice,xt={__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}},sb=0,Xc.prototype.setState=function(e,t){var n;n=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=ji({},this.state),typeof e=="function"&&(e=e(ji({},n),this.props)),e&&ji(n,e),e!=null&&this.__v&&(t&&this._sb.push(t),hb(this))},Xc.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),hb(this))},Xc.prototype.render=Kc,yr=[],ub=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,lb=function(e,t){return e.__v.__b-t.__v.__b},Zc.__r=0,yf=Math.random().toString(8),Vc="__d"+yf,Ba="__a"+yf,pb=/(PointerCapture)$|Capture$/i,vf=0,bf=vb(!1),_f=vb(!0);var Sb=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,Sb(e,s,n,["",null])),i.push(r),s[0]?t[0]|=2:(t[o-2]=0,t[o]=r)):i.push(s)}return i},Rb=new Map;function y2(e){var t=Rb.get(this);return t||(t=new Map,Rb.set(this,t)),(t=Sb(this,t.get(e)||(t.set(e,t=(function(n){for(var i,r,o=1,a="",s="",c=[0],u=function(p){o===1&&(p||(a=a.replace(/^\s*\n\s*|\s*\n\s*$/g,"")))?c.push(0,p,a):o===3&&(p||a)?(c.push(3,p,a),o=2):o===2&&a==="..."&&p?c.push(4,p,0):o===2&&a&&!p?c.push(5,0,!0,a):o>=5&&((a||!p&&o===5)&&(c.push(o,0,a,r),o=6),p&&(c.push(o,p,0,r),o=6)),a=""},l=0;l<n.length;l++){l&&(o===1&&u(),u(l));for(var f=0;f<n[l].length;f++)i=n[l][f],o===1?i==="<"?(u(),c=[c],o=3):a+=i:o===4?a==="--"&&i===">"?(o=1,a=""):a=i+a[0]:s?i===s?s="":a+=i:i==='"'||i==="'"?s=i:i===">"?(u(),o=1):o&&(i==="="?(o=5,r=a,a=""):i==="/"&&(o<5||n[l][f+1]===">")?(u(),o===3&&(c=c[0]),o=c,(c=c[0]).push(2,0,o),o=0):i===" "||i===" "||i===`
11
+ `||i==="\r"?(u(),o=2):a+=i),o===3&&a==="!--"&&(o=4,c=c[0])}return u(),c})(e)),t),arguments,[])).length>1?t:t[0]}var ct=y2.bind(fb),Lo,Ot,Sf,Cb,Na=0,Pb=[],zt=xt,Ab=zt.__b,Tb=zt.__r,Mb=zt.diffed,kb=zt.__c,Ob=zt.unmount,Db=zt.__;function Jc(e,t){zt.__h&&zt.__h(Ot,e,Na||t),Na=0;var n=Ot.__H||(Ot.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({}),n.__[e]}function Rf(e){return Na=1,v2(Ib,e)}function v2(e,t,n){var i=Jc(Lo++,2);if(i.t=e,!i.__c&&(i.__=[Ib(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,f=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]&&(f=!0)}}),o){var p=o.call(this,s,c,u);return l?p||f:p}return!l||f};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 eu(e,t){var n=Jc(Lo++,3);!zt.__s&&Af(n.__H,t)&&(n.__=e,n.u=t,Ot.__H.__h.push(n))}function Cf(e,t){var n=Jc(Lo++,4);!zt.__s&&Af(n.__H,t)&&(n.__=e,n.u=t,Ot.__h.push(n))}function tu(e){return Na=5,Hi(function(){return{current:e}},[])}function Hi(e,t){var n=Jc(Lo++,7);return Af(n.__H,t)&&(n.__=e(),n.__H=t,n.__h=e),n.__}function $a(e,t){return Na=8,Hi(function(){return e},t)}function b2(){for(var e;e=Pb.shift();){var t=e.__H;if(e.__P&&t)try{t.__h.some(nu),t.__h.some(Pf),t.__h=[]}catch(n){t.__h=[],zt.__e(n,e.__v)}}}zt.__b=function(e){Ot=null,Ab&&Ab(e)},zt.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),Db&&Db(e,t)},zt.__r=function(e){Tb&&Tb(e),Lo=0;var t=(Ot=e.__c).__H;t&&(Sf===Ot?(t.__h=[],Ot.__h=[],t.__.some(function(n){n.__N&&(n.__=n.__N),n.u=n.__N=void 0})):(t.__h.some(nu),t.__h.some(Pf),t.__h=[],Lo=0)),Sf=Ot},zt.diffed=function(e){Mb&&Mb(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(Pb.push(t)!==1&&Cb===zt.requestAnimationFrame||((Cb=zt.requestAnimationFrame)||_2)(b2)),t.__H.__.some(function(n){n.u&&(n.__H=n.u,n.u=void 0)})),Sf=Ot=null},zt.__c=function(e,t){t.some(function(n){try{n.__h.some(nu),n.__h=n.__h.filter(function(i){return!i.__||Pf(i)})}catch(i){t.some(function(r){r.__h&&(r.__h=[])}),t=[],zt.__e(i,n.__v)}}),kb&&kb(e,t)},zt.unmount=function(e){Ob&&Ob(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.some(function(i){try{nu(i)}catch(r){t=r}}),n.__H=void 0,t&&zt.__e(t,n.__v))};var Lb=typeof requestAnimationFrame=="function";function _2(e){var t,n=function(){clearTimeout(i),Lb&&cancelAnimationFrame(t),setTimeout(e)},i=setTimeout(n,35);Lb&&(t=requestAnimationFrame(n))}function nu(e){var t=Ot,n=e.__c;typeof n=="function"&&(e.__c=void 0,n()),Ot=t}function Pf(e){var t=Ot;e.__c=e.__(),Ot=t}function Af(e,t){return!e||e.length!==t.length||t.some(function(n,i){return n!==e[i]})}function Ib(e,t){return typeof t=="function"?t(e):t}function x2(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 ct`
12
12
  <div class="djs-popup-breadcrumbs">
13
- ${r&&ut`
13
+ ${r&&ct`
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)=>ut`
26
+ ${i.map((a,s)=>ct`
27
27
  <button
28
28
  key=${s}
29
29
  type="button"
@@ -35,23 +35,23 @@
35
35
  </button>
36
36
  <span class="djs-popup-breadcrumbs-item--separator" aria-hidden="true"></span>
37
37
  `)}
38
- ${o&&ut`
38
+ ${o&&ct`
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 Db(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=Db(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=Db(e))&&(i&&(i+=" "),i+=t);return i}function g2(e){const{headerEntries:t,onSelect:n,selectedEntry:i,setSelectedEntry:r,title:o}=e,a=Hi(()=>y2(t),[t]),s=u=>u.action&&!u.disabled,c=(u,l)=>{if(s(l))return n(u,l)};return ut`
44
+ `}function Bb(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=Bb(e[t]))&&(i&&(i+=" "),i+=n)}else for(n in e)e[n]&&(i&&(i+=" "),i+=n);return i}function iu(){for(var e,t,n=0,i="",r=arguments.length;n<r;n++)(e=arguments[n])&&(t=Bb(e))&&(i&&(i+=" "),i+=t);return i}function w2(e){const{headerEntries:t,onSelect:n,selectedEntry:i,setSelectedEntry:r,title:o}=e,a=Hi(()=>E2(t),[t]),s=u=>u.action&&!u.disabled,c=(u,l)=>{if(s(l))return n(u,l)};return ct`
45
45
  <div class="djs-popup-header">
46
46
  <h3 class="djs-popup-title" title=${o}>${o}</h3>
47
- ${a.map(u=>ut`
47
+ ${a.map(u=>ct`
48
48
  <ul key=${u.id} class="djs-popup-header-group" data-header-group=${u.id}>
49
49
 
50
- ${u.entries.map(l=>ut`
50
+ ${u.entries.map(l=>ct`
51
51
  <li key=${l.id}>
52
52
  <${s(l)?"button":"span"}
53
- class=${v2(l,l===i)}
54
- onClick=${p=>c(p,l)}
53
+ class=${S2(l,l===i)}
54
+ onClick=${f=>c(f,l)}
55
55
  title=${l.title||l.label}
56
56
  data-id=${l.id}
57
57
  aria-disabled=${l.disabled||void 0}
@@ -60,8 +60,8 @@
60
60
  onFocus=${()=>s(l)&&r(l)}
61
61
  onBlur=${()=>s(l)&&r(null)}
62
62
  >
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`
63
+ ${l.imageUrl&&ct`<img class="djs-popup-entry-icon" src=${l.imageUrl} alt="" />`||l.imageHtml&&ct`<div class="djs-popup-entry-icon" dangerouslySetInnerHTML=${{__html:l.imageHtml}} />`}
64
+ ${l.label?ct`
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 y2(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 v2(e,t){return nu("entry",e.className,e.active?"active":"",e.disabled?"disabled":"",t?"selected":"")}function Lb(e,t){return`${e}-entry-${t.id}`}function b2(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`
73
+ `}function E2(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 S2(e,t){return iu("entry",e.className,e.active?"active":"",e.disabled?"disabled":"",t?"selected":"")}function Nb(e,t){return`${e}-entry-${t.id}`}function R2(e){const{idPrefix:t,entry:n,selected:i,onMouseEnter:r,onMouseLeave:o,onAction:a}=e,s=(u,l)=>{if(!n.disabled)return a(u,n,l)},c=!n.entries;return ct`
74
74
  <li
75
- class=${nu("entry",{selected:i,disabled:n.disabled})}
75
+ class=${iu("entry",{selected:i,disabled:n.disabled})}
76
76
  data-id=${n.id}
77
- id=${Lb(t,n)}
77
+ id=${Nb(t,n)}
78
78
  role="option"
79
79
  aria-selected=${i||void 0}
80
80
  aria-haspopup=${n.entries?"true":void 0}
@@ -88,17 +88,17 @@
88
88
  >
89
89
  <div class="djs-popup-entry-content">
90
90
  <span
91
- class=${nu("djs-popup-entry-name",n.className)}
91
+ class=${iu("djs-popup-entry-name",n.className)}
92
92
  >
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}} />`}
93
+ ${n.imageUrl&&ct`<img class="djs-popup-entry-icon" src=${n.imageUrl} alt="" />`||n.imageHtml&&ct`<div class="djs-popup-entry-icon" dangerouslySetInnerHTML=${{__html:n.imageHtml}} />`}
94
94
 
95
- ${n.label?ut`
95
+ ${n.label?ct`
96
96
  <span class="djs-popup-label">
97
97
  ${n.label}
98
98
  </span>
99
99
  `:null}
100
100
 
101
- ${n.documentationRef&&ut`
101
+ ${n.documentationRef&&ct`
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&&ut`
118
+ ${n.description&&ct`
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&&ut`
126
+ ${n.entries&&ct`
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,20 +131,20 @@
131
131
  </div>
132
132
  `}
133
133
  </li>
134
- `}function _2(e){const{selectedEntry:t,setSelectedEntry:n,groupedEntries:i,keyboardSelection:r,idPrefix:o,id:a,ariaLabel:s,tabIndex:c,ariaActivedescendant:u,...l}=e,p=eu();Sf(()=>{if(!r||!r.current)return;const h=p.current;if(!h)return;const m=h.querySelector(".selected");m&&x2(m)},[t]);const f=()=>{r.current=!1},d=h=>{r.current||n(h)},g=()=>{r.current||n(null)};return ut`
134
+ `}function C2(e){const{selectedEntry:t,setSelectedEntry:n,groupedEntries:i,keyboardSelection:r,idPrefix:o,id:a,ariaLabel:s,tabIndex:c,ariaActivedescendant:u,...l}=e,f=tu();Cf(()=>{if(!r||!r.current)return;const h=f.current;if(!h)return;const m=h.querySelector(".selected");m&&P2(m)},[t]);const p=()=>{r.current=!1},d=h=>{r.current||n(h)},g=()=>{r.current||n(null)};return ct`
135
135
  <div
136
136
  class="djs-popup-results"
137
- ref=${p}
137
+ ref=${f}
138
138
  id=${a}
139
139
  role="listbox"
140
140
  aria-label=${s}
141
141
  tabIndex=${c}
142
142
  aria-activedescendant=${u}
143
- onMouseMove=${f}
143
+ onMouseMove=${p}
144
144
  >
145
- ${i.map(h=>ut`
146
- ${h.name&&ut`
147
- <div key=${h.id} id=${Ib(o,h)} class="entry-header" title=${h.name}>
145
+ ${i.map(h=>ct`
146
+ ${h.name&&ct`
147
+ <div key=${h.id} id=${$b(o,h)} class="entry-header" title=${h.name}>
148
148
  ${h.name}
149
149
  </div>
150
150
  `}
@@ -152,10 +152,10 @@
152
152
  class="djs-popup-group"
153
153
  data-group=${h.id}
154
154
  role="group"
155
- aria-labelledby=${h.name?Ib(o,h):void 0}
155
+ aria-labelledby=${h.name?$b(o,h):void 0}
156
156
  >
157
- ${h.entries.map(m=>ut`
158
- <${b2}
157
+ ${h.entries.map(m=>ct`
158
+ <${R2}
159
159
  key=${m.id}
160
160
  idPrefix=${o}
161
161
  entry=${m}
@@ -168,36 +168,36 @@
168
168
  </ul>
169
169
  `)}
170
170
  </div>
171
- `}function Ib(e,t){return`${e}-group-${t.id}`}function x2(e){typeof e.scrollIntoViewIfNeeded=="function"?e.scrollIntoViewIfNeeded():e.scrollIntoView({scrollMode:"if-needed",block:"nearest"})}const w2=new Po("djs-popup");function E2(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]=Ef([]);Jc(()=>{m([])},[f]);const[w,y]=Ef(""),_=w.trim().length>0,S=Hi(()=>C2(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?_?p(S.filter(({searchable:U})=>U!==!1),w,{keys:["label","search","description"]}).map(({item:U})=>U):q.filter(({rank:U=0})=>U>=0):q},[P,_,S,w,p,h,f]),D=Hi(()=>_?C.length?[{id:"default",entries:C}]:[]:P2(C),[C,_]),[T,N]=Ef(C[0]),k=eu(null),O=eu(!1),F=Hi(()=>w2.next(),[]),ae=`${F}-results`,_e=T&&Lb(F,T);Jc(()=>{const q=k.current;q&&C.includes(q)?N(q):N(C[0]),k.current=null},[C]);const We=$a(q=>{const U=R2(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=$a(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=$a((q,U,Z)=>{if(!(!U||U.disabled))return U.entries?(q.preventDefault(),Y(1)):n(q,U,Z)},[n,Y]),ge=$a(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(!(cl(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=$a(q=>{cl(q.target,"input")&&y(()=>q.target.value)},[y]);Jc(()=>(d(),()=>{g()}),[]);const Re=!_&&h.length>0,re=(a||r.length>0)&&!Re;return ut`
172
- <${Nb}
171
+ `}function $b(e,t){return`${e}-group-${t.id}`}function P2(e){typeof e.scrollIntoViewIfNeeded=="function"?e.scrollIntoViewIfNeeded():e.scrollIntoView({scrollMode:"if-needed",block:"nearest"})}const A2=new Po("djs-popup");function T2(e){const{onClose:t,onSelect:n,className:i,headerEntries:r,position:o,title:a,width:s,scale:c,search:u,emptyPlaceholder:l,searchFn:f,entries:p,onOpened:d,onClosed:g}=e,[h,m]=Rf([]);eu(()=>{m([])},[p]);const[_,y]=Rf(""),x=_.trim().length>0,S=Hi(()=>O2(p),[p]),P=Hi(()=>$t(u)?S.length>5:!1,[u,S]),C=Hi(()=>{const U=h.length?h[h.length-1].entries:p;return P?x?f(S.filter(({searchable:q})=>q!==!1),_,{keys:["label","search","description"]}).map(({item:q})=>q):U.filter(({rank:q=0})=>q>=0):U},[P,x,S,_,f,h,p]),D=Hi(()=>x?C.length?[{id:"default",entries:C}]:[]:D2(C),[C,x]),[T,$]=Rf(C[0]),k=tu(null),O=tu(!1),j=Hi(()=>A2.next(),[]),oe=`${j}-results`,xe=T&&Nb(j,T);eu(()=>{const U=k.current;U&&C.includes(U)?$(U):$(C[0]),k.current=null},[C]);const Ue=$a(U=>{const q=k2(D);let He=q.indexOf(T)+U;He<0&&(He=q.length-1),He>=q.length&&(He=0),O.current=!0,$(q[He])},[D,T]),Y=$a(U=>{U>0&&T&&T.entries&&(O.current=!0,m(q=>[...q,T])),U<0&&h.length>0&&(O.current=!0,k.current=h[h.length+U],m(q=>q.slice(0,U)))},[T,h]),ue=$a((U,q,K)=>{if(!(!q||q.disabled))return q.entries?(U.preventDefault(),Y(1)):n(U,q,K)},[n,Y]),ve=$a(U=>{if(U.key==="Enter"&&T){const q=U.target;return!!Tr(q,"a, button",!0)||T.disabled?void 0:ue(U,T)}if(U.key==="Backspace"){const q=U.target;if(!(ll(q,"input")&&q.value!==""))return Y(-1),U.preventDefault()}if(U.key==="ArrowUp")return Ue(-1),U.preventDefault();if(U.key==="ArrowDown")return Ue(1),U.preventDefault();if(U.key==="ArrowRight")return Y(1),U.preventDefault();if(U.key==="ArrowLeft")return Y(-1),U.preventDefault()},[T,Ue,Y,ue]),le=$a(U=>{ll(U.target,"input")&&y(()=>U.target.value)},[y]);eu(()=>(d(),()=>{g()}),[]);const be=!x&&h.length>0,ce=(a||r.length>0)&&!be;return ct`
172
+ <${Fb}
173
173
  onClose=${t}
174
- onKeyup=${ue}
175
- onKeydown=${ge}
174
+ onKeyup=${le}
175
+ onKeydown=${ve}
176
176
  className=${i}
177
177
  position=${o}
178
178
  width=${s}
179
179
  scale=${c}
180
180
  navigationStack=${h}
181
181
  >
182
- ${re&&ut`
183
- <${g2}
182
+ ${ce&&ct`
183
+ <${w2}
184
184
  headerEntries=${r}
185
185
  onSelect=${n}
186
186
  selectedEntry=${T}
187
- setSelectedEntry=${N}
187
+ setSelectedEntry=${$}
188
188
  title=${a}
189
189
  />
190
190
  `}
191
- ${Re&&ut`
192
- <${m2}
191
+ ${be&&ct`
192
+ <${x2}
193
193
  navigationStack=${h}
194
194
  setNavigationStack=${m}
195
195
  />
196
196
  `}
197
- ${f.length>0&&ut`
197
+ ${p.length>0&&ct`
198
198
  <div class="djs-popup-body">
199
199
 
200
- ${P&&ut`
200
+ ${P&&ct`
201
201
  <div class="djs-popup-search">
202
202
  <svg class="djs-popup-search-icon" width="14" height="14" viewBox="0 0 14 14" fill="none" xmlns="http://www.w3.org/2000/svg">
203
203
  <path fill-rule="evenodd" clip-rule="evenodd" d="M9.0325 8.5H9.625L13.3675 12.25L12.25 13.3675L8.5 9.625V9.0325L8.2975 8.8225C7.4425 9.5575 6.3325 10 5.125 10C2.4325 10 0.25 7.8175 0.25 5.125C0.25 2.4325 2.4325 0.25 5.125 0.25C7.8175 0.25 10 2.4325 10 5.125C10 6.3325 9.5575 7.4425 8.8225 8.2975L9.0325 8.5ZM1.75 5.125C1.75 6.9925 3.2575 8.5 5.125 8.5C6.9925 8.5 8.5 6.9925 8.5 5.125C8.5 3.2575 6.9925 1.75 5.125 1.75C3.2575 1.75 1.75 3.2575 1.75 5.125Z" fill="#22242A"/>
@@ -208,38 +208,38 @@
208
208
  role="combobox"
209
209
  aria-label="${a||"Search"}"
210
210
  aria-expanded="true"
211
- aria-controls=${ae}
212
- aria-activedescendant=${_e||void 0}
211
+ aria-controls=${oe}
212
+ aria-activedescendant=${xe||void 0}
213
213
  aria-autocomplete="list"
214
214
  />
215
215
  </div>
216
216
  `}
217
217
 
218
- ${_&&ut`
218
+ ${x&&ct`
219
219
  <div class="djs-popup-search-count" aria-live="polite">
220
220
  ${C.length} ${C.length===1?"result":"results"} found
221
221
  </div>
222
222
  `}
223
223
 
224
- <${_2}
224
+ <${C2}
225
225
  groupedEntries=${D}
226
226
  selectedEntry=${T}
227
- setSelectedEntry=${N}
227
+ setSelectedEntry=${$}
228
228
  keyboardSelection=${O}
229
- onAction=${le}
230
- idPrefix=${F}
231
- id=${ae}
229
+ onAction=${ue}
230
+ idPrefix=${j}
231
+ id=${oe}
232
232
  ariaLabel=${a||"Results"}
233
233
  tabIndex=${P?-1:0}
234
- ariaActivedescendant=${P?void 0:_e||void 0}
234
+ ariaActivedescendant=${P?void 0:xe||void 0}
235
235
  />
236
236
 
237
- ${T&&T.documentationRef&&ut`
237
+ ${T&&T.documentationRef&&ct`
238
238
  <div class="djs-popup-footer">
239
239
  <a
240
240
  class="djs-popup-footer-docs"
241
241
  href=${T.documentationRef}
242
- onClick=${q=>q.stopPropagation()}
242
+ onClick=${U=>U.stopPropagation()}
243
243
  aria-label=${T.label?`Open entry documentation for ${T.label}`:"Open entry documentation"}
244
244
  target="_blank"
245
245
  rel="noopener"
@@ -254,14 +254,14 @@
254
254
  `}
255
255
  </div>
256
256
  `}
257
- ${l&&C.length===0&&ut`
258
- <div class="djs-popup-no-results">${Wt(l)?l(w):l}</div>
257
+ ${l&&C.length===0&&ct`
258
+ <div class="djs-popup-no-results">${Wt(l)?l(_):l}</div>
259
259
  `}
260
- </${Nb}>
261
- `}function Nb(e){const{onClose:t,onKeydown:n,onKeyup:i,className:r,children:o,navigationStack:a,position:s}=e,c=eu();return Sf(()=>{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]),Sf(()=>{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`
260
+ </${Fb}>
261
+ `}function Fb(e){const{onClose:t,onKeydown:n,onKeyup:i,className:r,children:o,navigationStack:a,position:s}=e,c=tu();return Cf(()=>{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]),Cf(()=>{const u=c.current;if(!u)return;(u.querySelector("input")||u.querySelector('[role="listbox"]')||u).focus()},[a]),eu(()=>{const u=f=>{if(f.key==="Escape")return f.preventDefault(),t()},l=f=>{if(!Tr(f.target,".djs-popup",!0))return t()};return document.documentElement.addEventListener("keydown",u),document.body.addEventListener("click",l,!0),()=>{document.documentElement.removeEventListener("keydown",u),document.body.removeEventListener("click",l,!0)}},[]),ct`
262
262
  <div
263
- class=${nu("djs-popup",r)}
264
- style=${S2(e)}
263
+ class=${iu("djs-popup",r)}
264
+ style=${M2(e)}
265
265
  onKeydown=${n}
266
266
  onKeyup=${i}
267
267
  ref=${c}
@@ -269,10 +269,10 @@
269
269
  >
270
270
  ${o}
271
271
  </div>
272
- `}function S2(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 R2(e){const t=[];return e.forEach(n=>{n.entries.forEach(i=>{t.push(i)})}),t}function C2(e){const t=[];function n(i){i.forEach(r=>{if(r.entries){n(r.entries);return}t.push(r)})}return n(e),t}function P2(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 A2="data-id",Bb=["contextPad.close","canvas.viewbox.changing","commandStack.changed"],T2=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=$b(n),s=Object.entries(i).map(([f,d])=>({id:f,...d})),c=e&&(f=>this._ensureVisible(f,e)),u=this._updateScale(this._current.container);_b(ut`
273
- <${E2}
274
- onClose=${f=>this.close(f)}
275
- onSelect=${(f,d,g)=>this.trigger(f,d,g)}
272
+ `}function M2(e){const{width:t}=e,n=typeof t=="number"?`${t}px`:t;return{transform:`scale(${e.scale})`,width:$t(t)?n:void 0,maxWidth:$t(t)?"unset":void 0,"transform-origin":"top left"}}function k2(e){const t=[];return e.forEach(n=>{n.entries.forEach(i=>{t.push(i)})}),t}function O2(e){const t=[];function n(i){i.forEach(r=>{if(r.entries){n(r.entries);return}t.push(r)})}return n(e),t}function D2(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 L2="data-id",jb=["contextPad.close","canvas.viewbox.changing","commandStack.changed"],I2=1e3;function wt(e,t,n,i){this._eventBus=t,this._canvas=n,this._search=i,this._current=null;var r=$t(e&&e.scale)?e.scale:{min:1,max:1};this._config={scale:r},t.on("diagram.destroy",()=>{this.close()}),t.on("element.changed",o=>{const a=this.isOpen()&&this._current.target;o.element===a&&this.refresh()})}wt.$inject=["config.popupMenu","eventBus","canvas","search"],wt.prototype._render=function(){const{position:e,providerId:t,entries:n,headerEntries:i,emptyPlaceholder:r,options:o}=this._current,a=Hb(n),s=Object.entries(i).map(([p,d])=>({id:p,...d})),c=e&&(p=>this._ensureVisible(p,e)),u=this._updateScale(this._current.container);Eb(ct`
273
+ <${T2}
274
+ onClose=${p=>this.close(p)}
275
+ onSelect=${(p,d,g)=>this.trigger(p,d,g)}
276
276
  position=${c}
277
277
  className=${t}
278
278
  entries=${a}
@@ -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;_b(null,e),di(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(Bb,this.close,this)},xt.prototype._unbindAutoClose=function(){this._eventBus.off(Bb,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=T2),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]=si(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]=si(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,A2);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 $b(e,t=[]){return Object.entries(e).map(([n,i])=>{const r={id:n,...i};return r.entries?r.entries=$b(r.entries,[...t,...jb(r.search)]):t.length&&(r.search=[...t,...jb(r.search)]),r})}function jb(e){return e?ke(e)?e:[e]:[]}function M2(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=k2(o,r,i);return a?{item:o,tokens:a}:[]}).sort(O2(i))}function k2(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}=Vb(p,t);return{tokens:[...l.tokens,f],matchedWords:{...l.matchedWords,...d}}},{matchedWords:{},tokens:[]}):Vb(s,t);return{tokens:{...o.tokens,[a]:c},matchedWords:{...o.matchedWords,...u}}},{matchedWords:{},tokens:{}});return Object.keys(i).length!==t.length?null:r}function O2(e){return(t,n)=>{let i=0,r=1;for(const o of e){const a=D2(t.tokens[o],n.tokens[o]);if(a!==0){i+=a*r,r*=Fb;continue}const s=L2(t.item[o],n.item[o]);if(s!==0){i+=s*r,r*=Fb;continue}}return i}}function D2(e,t){return Hb(t)-Hb(e)}const Fb=.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 Hb(e){const t=e.reduce((s,c)=>s+zb(c),0),n=e.flat(),i=n.reduce((s,c)=>s+c.value.length,0),r=n.reduce((s,c)=>s+(c.match?c.value.length:0),0),o=i?r/i:0;return t*(1+o)}function zb(e){if(ke(e))return Math.max(...e.map(zb));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 Gb(e=""){return ke(e)?e.join(", "):e}function L2(e,t){return Gb(e).localeCompare(Gb(t))}function Vb(e,t){var u;if(!e)return{tokens:[],matchedWords:{}};const n=[],i={},r=t.map(I2),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)),w=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:w,start:d,end:g,all:h});const y=h?t:[l];for(const _ of y)i[_.toLowerCase()]=!0;c=s.index+l.length}return c<e.length&&n.push({value:e.slice(c),index:c}),{tokens:n,matchedWords:i}}function I2(e){return e.replace(/[/\-\\^$*+?.()|[\]{}]/g,"\\$&")}const Wb={search:["value",M2]},Pf={__depends__:[Wb],__init__:["popupMenu"],popupMenu:["type",xt]};var Ub={align:`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 2000 2000">
287
+ `,this._current.container)},wt.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()},wt.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()},wt.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)}},wt.prototype.close=function(){this.isOpen()&&(this._emit("close"),this.reset(),this._canvas.restoreFocus(),this._current=null)},wt.prototype.reset=function(){const e=this._current.container;Eb(null,e),di(e)},wt.prototype._emit=function(e,t){this._eventBus.fire(`popupMenu.${e}`,t)},wt.prototype._onOpened=function(){this._emit("opened")},wt.prototype._onClosed=function(){this._emit("closed")},wt.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},wt.prototype._bindAutoClose=function(){this._eventBus.once(jb,this.close,this)},wt.prototype._unbindAutoClose=function(){this._eventBus.off(jb,this.close,this)},wt.prototype._updateScale=function(){var e=this._canvas.zoom(),t=this._config.scale,n,i,r=e;return t!==!0&&(t===!1?(n=1,i=1):(n=t.min,i=t.max),$t(n)&&e<n&&(r=n),$t(i)&&e>i&&(r=i)),r},wt.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}},wt.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},wt.prototype.registerProvider=function(e,t,n){n||(n=t,t=I2),this._eventBus.on("popupMenu.getProviders."+e,t,function(i){i.providers.push(n)})},wt.prototype._getProviders=function(e){var t=this._eventBus.createEvent({type:"popupMenu.getProviders."+e,providers:[]});return this._eventBus.fire(t),t.providers},wt.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]=ui(o,["id"])});return}var r=i.getPopupMenuEntries(e);Wt(r)?n=r(n):L(r,function(o,a){n[a]=o})}),n},wt.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]=ui(o,["id"])});return}var r=i.getPopupMenuHeaderEntries(e);Wt(r)?n=r(n):L(r,function(o,a){n[a]=o})}),n},wt.prototype._getEmptyPlaceholder=function(e){const t=e.find(n=>Wt(n.getEmptyPlaceholder));return t&&t.getEmptyPlaceholder()},wt.prototype.isOpen=function(){return!!this._current},wt.prototype.trigger=function(e,t,n="click"){if(e.preventDefault(),!t){let r=Tr(e.delegateTarget||e.target,".entry",!0),o=sn(r,L2);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)}},wt.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 Hb(e,t=[]){return Object.entries(e).map(([n,i])=>{const r={id:n,...i};return r.entries?r.entries=Hb(r.entries,[...t,...zb(r.search)]):t.length&&(r.search=[...t,...zb(r.search)]),r})}function zb(e){return e?ke(e)?e:[e]:[]}function B2(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=N2(o,r,i);return a?{item:o,tokens:a}:[]}).sort($2(i))}function N2(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,f)=>{const{tokens:p,matchedWords:d}=qb(f,t);return{tokens:[...l.tokens,p],matchedWords:{...l.matchedWords,...d}}},{matchedWords:{},tokens:[]}):qb(s,t);return{tokens:{...o.tokens,[a]:c},matchedWords:{...o.matchedWords,...u}}},{matchedWords:{},tokens:{}});return Object.keys(i).length!==t.length?null:r}function $2(e){return(t,n)=>{let i=0,r=1;for(const o of e){const a=F2(t.tokens[o],n.tokens[o]);if(a!==0){i+=a*r,r*=Gb;continue}const s=j2(t.item[o],n.item[o]);if(s!==0){i+=s*r,r*=Gb;continue}}return i}}function F2(e,t){return Vb(t)-Vb(e)}const Gb=.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 Vb(e){const t=e.reduce((s,c)=>s+Wb(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 Wb(e){if(ke(e))return Math.max(...e.map(Wb));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 Ub(e=""){return ke(e)?e.join(", "):e}function j2(e,t){return Ub(e).localeCompare(Ub(t))}function qb(e,t){var u;if(!e)return{tokens:[],matchedWords:{}};const n=[],i={},r=t.map(H2),o=[`(?<all>${r.join("\\s+")})`,...r].join("|"),a=new RegExp(o,"ig");let s,c=0;for(;s=a.exec(e);){const[l]=s,f=s.index,p=s.index+l.length,d=f===0,g=p===e.length,h=!!((u=s.groups)!=null&&u.all),m=d||/\s/.test(e.charAt(f-1)),_=g||/\s/.test(e.charAt(p));s.index>c&&n.push({value:e.slice(c,s.index),index:c}),n.push({value:l,index:s.index,match:!0,wordStart:m,wordEnd:_,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 H2(e){return e.replace(/[/\-\\^$*+?.()|[\]{}]/g,"\\$&")}const Yb={search:["value",B2]},Tf={__depends__:[Yb],__init__:["popupMenu"],popupMenu:["type",wt]};var Kb={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>`},N2=900;function No(e,t,n,i){e.registerProvider(N2,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">${Ub.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 B2=["left","center","right","top","middle","bottom"];function ja(e,t,n,i){this._alignElements=t,this._translate=n,this._popupMenu=e,this._rules=i,e.registerProvider("align-elements",this)}ja.$inject=["popupMenu","alignElements","translate","rules"],ja.prototype.getPopupMenuEntries=function(e){var t={};return this._isAllowed(e)&&H(t,this._getEntries(e)),t},ja.prototype._isAllowed=function(e){return this._rules.allowed("elements.align",{elements:e})},ja.prototype._getEntries=function(e){var t=this._alignElements,n=this._translate,i=this._popupMenu,r={};return L(B2,function(o){r["align-elements-"+o]={group:"align",title:n("Align elements "+o),className:"bjs-align-elements-menu-entry",imageHtml:Ub[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 $2={__depends__:[KM,ib,Pf],__init__:["alignElementsContextPadProvider","alignElementsMenuProvider","bpmnAlignElements"],alignElementsContextPadProvider:["type",No],alignElementsMenuProvider:["type",ja],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(j2(i,t)){var r=F2(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 j2(e,t){return e.x!==t.x||e.y!==t.y||e.width!==t.width||e.height!==t.height}function F2(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){x(e,"bpmn:Participant")?this._modeling.resizeLane(e,t,null,n):this._modeling.resizeShape(e,t,null,n)};function Fa(e){Gn.call(this,e);var t=this;this.addRule("element.autoResize",function(n){return t.canResize(n.elements,n.target)})}Fa.$inject=["eventBus"],de(Fa,Gn),Fa.prototype.canResize=function(e,t){return!1};function ou(e,t){Fa.call(this,e),this._modeling=t}de(ou,Fa),ou.$inject=["eventBus","modeling"],ou.prototype.canResize=function(e,t){if(x(t.di,"bpmndi:BPMNPlane")||!x(t,"bpmn:Participant")&&!x(t,"bpmn:Lane")&&!x(t,"bpmn:SubProcess"))return!1;var n=!0;return L(e,function(i){if(x(i,"bpmn:Lane")||Fe(i)){n=!1;return}}),n};const H2={__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++)z2(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 z2(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 G2={__depends__:[Ni],__init__:["autoScroll"],autoScroll:["type",Bo]};var qb="djs-bendpoint",Yb="djs-segment-dragger";function V2(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 Af(e,t,n){var i=V2(e,n),r=Ul(t,i);return r}function Tf(e,t){var n=Ce("g");qe(n).add(qb),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 W2(e,t,n,i){var r=Ce("g");Be(e,r);var o=18,a=6,s=11,c=q2(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),xm(r,i==="v"?90:0),r}function Kb(e,t,n){var i=Ce("g"),r=xl(t,n),o=Mi(t,n);return Be(e,i),W2(i,t,n,o),qe(i).add(Yb),qe(i).add(o==="h"?"horizontal":"vertical"),en(i,r.x,r.y),i}function Mf(e){return Math.abs(Math.round(e*2/3))}function U2(e,t){var n=Y2(e,t);return Ql(e,n)}function q2(e,t,n){var i=t.x-e.x,r=t.y-e.y;return Mf(n==="h"?i:r)}function Y2(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=sg(e,[a,s]);c<i&&(i=c,r=o)}return[n[r],n[r+1]]}function Xb(e,t,n,i,r){function o(_,S,P){var C=_.index,D=_.point,T,N,k,O,F,ae;return C<=0||_.bendpoint?!1:(T=S[C-1],N=S[C],k=xl(T,N),O=Mi(T,N),F=Math.abs(D.x-k.x),ae=Math.abs(D.y-k.y),O&&F<=P&&ae<=P)}function a(_,S){var P=_.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=Mf(T)/2,N)}function s(_,S){var P=S.waypoints,C=Af(t,P,_),D;if(C){D=a(S,C);var T;if(o(C,P,D)?T=r.start(_,S,C.index):T=i.start(_,S,C.index,!C.bendpoint),T!==!1)return!0}}function c(_,S,P){Ne.bind(_,S,function(C){n.triggerMouseEvent(S,C,P),C.stopPropagation()})}function u(_,S){var P=t.getLayer("overlays"),C=ot('.djs-bendpoints[data-element-id="'+La(_.id)+'"]',P);return!C&&S&&(C=Ce("g"),he(C,{"data-element-id":_.id}),qe(C).add("djs-bendpoints"),Be(P,C),c(C,"mousedown",_),c(C,"click",_),c(C,"dblclick",_)),C}function l(_,S){return ot('.djs-segment-dragger[data-segment-idx="'+_+'"]',S)}function p(_,S){S.waypoints.forEach(function(P,C){var D=Tf(_);Be(_,D),en(D,P.x,P.y)}),Tf(_,"floating")}function f(_,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=Kb(_,C,D),he(T,{"data-segment-idx":N}),c(T,"mousemove",S))}function d(_){L(ws("."+qb,_),function(S){$t(S)})}function g(_){L(ws("."+Yb,_),function(S){$t(S)})}function h(_){var S=u(_);return S||(S=u(_,!0),p(S,_),f(S,_)),S}function m(_){var S=u(_);S&&(g(S),d(S),f(S,_),p(S,_))}function w(_,S){var P=ot(".floating",_),C=S.point;P&&(en(P,C.x,C.y),qe(P).add("positioned"))}function y(_,S,P){var C=l(S.index,_),D=P[S.index-1],T=P[S.index],N=S.point,k=xl(D,T),O=Mi(D,T),F,ae;C&&(F=K2(C),ae={x:N.x-k.x,y:N.y-k.y},O==="v"&&(ae={x:ae.y,y:ae.x}),en(F,ae.x,ae.y))}e.on("connection.changed",function(_){m(_.element)}),e.on("connection.remove",function(_){var S=u(_.element);S&&$t(S)}),e.on("element.marker.update",function(_){var S=_.element,P;S.waypoints&&(P=h(S),_.add?qe(P).add(_.marker):qe(P).remove(_.marker))}),e.on("element.mousemove",function(_){var S=_.element,P=S.waypoints,C,D;if(P){if(C=u(S,!0),D=Af(t,P,_.originalEvent),!D)return;w(C,D),D.bendpoint||y(C,D,P)}}),e.on("element.mousedown",function(_){if(cr(_)){var S=_.originalEvent,P=_.element;if(P.waypoints)return s(S,P)}}),e.on("selection.changed",function(_){var S=_.newSelection,P=S[0];P&&P.waypoints&&h(P)}),e.on("element.hover",function(_){var S=_.element;S.waypoints&&h(S)}),e.on("element.out",function(_){var S=_.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(_){var S=_.element,P=_.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}Xb.$inject=["eventBus","canvas","interactionEvents","bendpointMove","connectionSegmentMove"];function K2(e){return ot(".djs-visual",e)}var Zb=Math.round,Vr="reconnectStart",Wr="reconnectEnd",Ha="updateWaypoints";function kf(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=Ha;var h=g===Ha?"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===Ha?"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!==Ha&&(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||{},w={x:Zb(a.x),y:Zb(a.y)};if(!c)return!1;h===Ha?(p?f.splice(u,0,w):f[u]=w,m.bendpointMove={insert:p,bendpointIndex:u},f=this.cropWaypoints(l,f),o.updateWaypoints(l,fS(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,w,m))},this)}kf.$inject=["injector","eventBus","canvas","dragging","rules","modeling"],kf.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 X2="reconnectStart",Z2="reconnectEnd",Qb="updateWaypoints",za="connect-ok",su="connect-not-ok",Jb="connect-hover",e_="djs-updating",t_="djs-dragging",n_=1100;function i_(e,t,n,i){this._injector=t;var r=t.get("connectionPreview",!1);n.on("bendpoint.move.start",function(o){var a=o.context,s=a.bendpointIndex,c=a.connection,u=a.insert,l=c.waypoints,p=l.slice();a.waypoints=l,u&&p.splice(s,0,{x:o.x,y:o.y}),c.waypoints=p;var f=a.draggerGfx=Tf(i.getLayer("overlays"));qe(f).add("djs-dragging"),i.addMarker(c,t_),i.addMarker(c,e_)}),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,Jb),u===Qb)return;s?(i.removeMarker(c,su),i.addMarker(c,za)):s===!1&&(i.removeMarker(c,za),i.addMarker(c,su))}}),n.on(["bendpoint.move.out","bendpoint.move.cleanup"],n_,function(o){var a=o.context,s=a.hover,c=a.target;s&&(i.removeMarker(s,Jb),i.removeMarker(s,c?za: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},w=a.hints||{},y={};r&&(w.connectionStart&&(y.connectionStart=w.connectionStart),w.connectionEnd&&(y.connectionEnd=w.connectionEnd),p===X2?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===Z2?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"],n_,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,e_),i.removeMarker(s,t_),u&&(i.removeMarker(u,za),i.removeMarker(u,l?za:su)),r&&r.cleanUp(a)})}i_.$inject=["bendpointMove","injector","eventBus","canvas"];var r_="connect-hover",o_="djs-updating";function a_(e,t,n){return Of(e,t,e[t]+n)}function Of(e,t,n){return{x:t==="x"?n:e.x,y:t==="y"?n:e.y}}function 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 Of(t,i,s)}function s_(e){return e==="x"?"y":"x"}function c_(e,t,n){var i,r;return e.original?e.original:(i=Oe(t),r=s_(n),Of(e,r,i[r]))}function u_(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,w=d,y=f.waypoints,_=y[m],S=y[w],P=Af(n,y,p),C,D,T;if(C=Mi(_,S),!!C)return D=C==="v"?"x":"y",m===0&&(_=c_(_,f.source,D)),w===y.length-1&&(S=c_(S,f.target,D)),P?T=P.point:T={x:(_.x+S.x)/2,y:(_.y+S.y)/2},g={connection:f,segmentStartIndex:m,segmentEndIndex:w,segmentStart:_,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],w=p.segmentEndIndex+f,y=g[w],_=s_(p.axis),S=Q2(d,m,y,_);en(p.draggerGfx,S.x,S.y)}function l(p,f){var d=0,g=p.filter(function(h,m){return _l(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=Kb(g,f.segmentStart,f.segmentEnd),qe(f.draggerGfx).add("djs-dragging"),n.addMarker(d,o_)}),t.on("connectionSegment.move.move",function(p){var f=p.context,d=f.connection,g=f.segmentStartIndex,h=f.segmentEndIndex,m=f.segmentStart,w=f.segmentEnd,y=f.axis,_=f.originalWaypoints.slice(),S=a_(m,y,p["d"+y]),P=a_(w,y,p["d"+y]),C=_.length,D=0;_[g]=S,_[h]=P;var T,N;g<2&&(T=Jt(d.source,S),g===1?T==="intersect"&&(_.shift(),_[0]=S,D--):T!=="intersect"&&(_.unshift(m),D++)),h>C-3&&(N=Jt(d.target,P),h===C-2?N==="intersect"&&(_.pop(),_[_.length-1]=P):N!=="intersect"&&_.push(w)),f.newWaypoints=d.waypoints=s(d,_),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,r_)}),t.on(["connectionSegment.move.out","connectionSegment.move.cleanup"],function(p){var f=p.context.hover;f&&n.removeMarker(f,r_)}),t.on("connectionSegment.move.cleanup",function(p){var f=p.context,d=f.connection;f.draggerGfx&&$t(f.draggerGfx),n.removeMarker(d,o_)}),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),w=m.waypoints,y=s(d,w),_=m.segmentOffset,S={segmentMove:{segmentStartIndex:f.segmentStartIndex,newSegmentStartIndex:h+_}};o.updateWaypoints(d,y,S)})}u_.$inject=["injector","eventBus","canvas","dragging","graphicsFactory","modeling"];var J2=Math.abs,l_=Math.round;function ek(e,t,n){n=n===void 0?10:n;var i,r;for(i=0;i<t.length;i++)if(r=t[i],J2(r-e)<=n)return r}function p_(e){return{x:e.x,y:e.y}}function f_(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:l_(e.x+e.width/2),y:l_(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 d_(e){return e.children||[]}var tk=Math.abs,h_=Math.round,Df=10;function m_(e){function t(o,a){if(ke(o)){for(var s=o.length;s--;)if(tk(o[s]-a)<=Df)return o[s]}else{o=+o;var c=a%o;if(c<Df)return a-c;if(c>o-Df)return a-c+o}return a}function n(o,a){if(o.waypoints)return U2(a,o);if(o.width)return{x:h_(o.width/2+o.x),y:h_(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)}})}m_.$inject=["eventBus"];const nk={__depends__:[Ni,bi],__init__:["bendpoints","bendpointSnapping","bendpointMovePreview"],bendpoints:["type",Xb],bendpointMove:["type",kf],bendpointMovePreview:["type",i_],connectionSegmentMove:["type",u_],bendpointSnapping:["type",m_]};function g_(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:Lf(s)?l:u,connectionEnd:Lf(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}}})}}g_.$inject=["eventBus","dragging","modeling","rules"];function Lf(e){var t=e.hover,n=e.source,i=e.target;return t&&n&&t===n&&n!==i}var ik=1100,rk=900,y_="connect-ok",v_="connect-not-ok";function b_(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;Lf(o)&&(g=d,h=f),i.drawPreview(o,a,{source:c||u,target:p||s,connectionStart:g,connectionEnd:h})}),t.on("connect.hover",rk,function(r){var o=r.context,a=r.hover,s=o.canExecute;s!==null&&n.addMarker(a,s?y_:v_)}),t.on(["connect.out","connect.cleanup"],ik,function(r){var o=r.hover;o&&(n.removeMarker(o,y_),n.removeMarker(o,v_))}),i&&t.on("connect.cleanup",function(r){i.cleanUp(r.context)})}b_.$inject=["injector","eventBus","canvas"];const If={__depends__:[Vn,bi,Ni],__init__:["connectPreview"],connect:["type",g_],connectPreview:["type",b_]};var ok="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=ak(function(h,m,w){return g.getConnection(h,m,w)})),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&&na(o,s,!0)||e,t=i&&na(a,s,!1)||t,[e,t]},Gi.prototype.cleanUp=function(e){e&&e.connectionPreviewGfx&&$t(e.connectionPreviewGfx)},Gi.prototype.getConnection=function(e){var t=sk(e);return this._elementFactory.createConnection(t)},Gi.prototype.createConnectionPreviewGfx=function(){var e=Ce("g");return he(e,{pointerEvents:"none"}),qe(e).add(ok),Be(this._canvas.getActiveLayer(),e),e},Gi.prototype.createNoopConnection=function(e,t){return Qo([e,t],{stroke:"#333",strokeDasharray:[1],strokeWidth:2,"pointer-events":"none"})};function ak(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 sk(e){return Vt(e)?e:{}}const ck={__init__:["connectionPreview"],connectionPreview:["type",Gi]},cu="complex-preview";class __{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=>!uk(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)}}__.$inject=["canvas","graphicsFactory","previewSupport"];function uk(e){return e.hidden}const lk={__depends__:[Ao],__init__:["complexPreview"],complexPreview:["type",__]},x_=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-x_(u.width/2),y:l.y-x_(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 pk={__depends__:[Nc,lk,sf],__init__:["appendPreview"],appendPreview:["type",uu]};var w_=Math.min,E_=Math.max;function Nf(e){e.preventDefault()}function Ga(e){e.stopPropagation()}function fk(e){return e.nodeType===Node.TEXT_NODE}function dk(e){return[].slice.call(e)}function ii(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)}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=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",Ga),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},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=hk(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=dk(a.childNodes),c,u;if(fk(a)){var l=n.textContent;n.textContent=l.substring(0,r)+e+l.substring(o),c=n,u=r+e.length}else if(n===this.content&&i===this.content){var 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&&di(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=ft('<div class="djs-direct-editing-resize-handle"></div>');var s,c,u,l,p=function(g){Nf(g),Ga(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){Nf(g),Ga(g);var h=w_(E_(u+g.clientX-s,i),o),m=w_(E_(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){Nf(g),Ga(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)},ii.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",Ga),Ne.unbind(t,"input",this.autoResize),Ne.unbind(t,"paste",this.handlePaste),Ne.unbind(t,"focusout",this.focusoutHandler),n&&(n.removeAttribute("style"),di(n)),di(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 hk(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 ii({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 S_={__depends__:[fc],__init__:["directEditing"],directEditing:["type",Dn]};function mk(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 gk={task:{label:"Task",className:"bpmn-icon-task",target:{type:"bpmn:Task"}},"user-task":{label:"User task",className:"bpmn-icon-user",target:{type:"bpmn:UserTask"}},"service-task":{label:"Service task",className:"bpmn-icon-service",target:{type:"bpmn:ServiceTask"}},"send-task":{label:"Send task",className:"bpmn-icon-send",target:{type:"bpmn:SendTask"}},"receive-task":{label:"Receive task",className:"bpmn-icon-receive",target:{type:"bpmn:ReceiveTask"}},"manual-task":{label:"Manual task",className:"bpmn-icon-manual",target:{type:"bpmn:ManualTask"}},"rule-task":{label:"Business rule task",className:"bpmn-icon-business-rule",target:{type:"bpmn:BusinessRuleTask"}},"script-task":{label:"Script task",className:"bpmn-icon-script",target:{type:"bpmn:ScriptTask"}},"call-activity":{label:"Call activity",className:"bpmn-icon-call-activity",target:{type:"bpmn:CallActivity"}},transaction:{label:"Transaction",className:"bpmn-icon-transaction",target:{type:"bpmn:Transaction",isExpanded:!0}},"event-subprocess":{label:"Event sub-process",className:"bpmn-icon-event-subprocess-expanded",target:{type:"bpmn:SubProcess",triggeredByEvent:!0,isExpanded:!0}},"collapsed-subprocess":{label:"Sub-process (collapsed)",className:"bpmn-icon-subprocess-collapsed",target:{type:"bpmn:SubProcess",isExpanded:!1}},"expanded-subprocess":{label:"Sub-process (expanded)",className:"bpmn-icon-subprocess-expanded",target:{type:"bpmn:SubProcess",isExpanded:!0}},"collapsed-ad-hoc-subprocess":{label:"Ad-hoc sub-process (collapsed)",className:"bpmn-icon-subprocess-collapsed",target:{type:"bpmn:AdHocSubProcess",isExpanded:!1}},"expanded-ad-hoc-subprocess":{label:"Ad-hoc sub-process (expanded)",className:"bpmn-icon-subprocess-expanded",target:{type:"bpmn:AdHocSubProcess",isExpanded:!0}},"exclusive-gateway":{label:"Exclusive gateway",className:"bpmn-icon-gateway-xor",target:{type:"bpmn:ExclusiveGateway"}},"parallel-gateway":{label:"Parallel gateway",className:"bpmn-icon-gateway-parallel",target:{type:"bpmn:ParallelGateway"}},"inclusive-gateway":{label:"Inclusive gateway",className:"bpmn-icon-gateway-or",target:{type:"bpmn:InclusiveGateway"}},"complex-gateway":{label:"Complex gateway",className:"bpmn-icon-gateway-complex",target:{type:"bpmn:ComplexGateway"}},"event-based-gateway":{label:"Event-based gateway",className:"bpmn-icon-gateway-eventbased",target:{type:"bpmn:EventBasedGateway",instantiate:!1,eventGatewayType:"Exclusive"}},"data-store-reference":{label:"Data store reference",className:"bpmn-icon-data-store",target:{type:"bpmn:DataStoreReference"}},"data-object-reference":{label:"Data object reference",className:"bpmn-icon-data-object",target:{type:"bpmn:DataObjectReference"}},"expanded-pool":{label:"Expanded pool/participant",className:"bpmn-icon-participant",target:{type:"bpmn:Participant",isExpanded:!0}},"collapsed-pool":{label:"Empty pool/participant",className:"bpmn-icon-lane",target:{type:"bpmn:Participant",isExpanded:!1}},"none-start-event":{label:"Start event",className:"bpmn-icon-start-event-none",target:{type:"bpmn:StartEvent"}},"none-intermediate-throwing":{label:"Intermediate throw event",className:"bpmn-icon-intermediate-event-none",target:{type:"bpmn:IntermediateThrowEvent"}},"none-boundary-event":{label:"Boundary event",className:"bpmn-icon-intermediate-event-none",target:{type:"bpmn:BoundaryEvent"}},"none-end-event":{label:"End event",className:"bpmn-icon-end-event-none",target:{type:"bpmn:EndEvent"}},"message-start":{label:"Message start event",className:"bpmn-icon-start-event-message",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:MessageEventDefinition",isInterrupting:!0}},"timer-start":{label:"Timer start event",className:"bpmn-icon-start-event-timer",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:TimerEventDefinition",isInterrupting:!0}},"conditional-start":{label:"Conditional start event",className:"bpmn-icon-start-event-condition",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:ConditionalEventDefinition",isInterrupting:!0}},"signal-start":{label:"Signal start event",className:"bpmn-icon-start-event-signal",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:SignalEventDefinition",isInterrupting:!0}},"error-start":{label:"Error start event",className:"bpmn-icon-start-event-error",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:ErrorEventDefinition",isInterrupting:!0}},"escalation-start":{label:"Escalation start event",className:"bpmn-icon-start-event-escalation",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:EscalationEventDefinition",isInterrupting:!0}},"compensation-start":{label:"Compensation start event",className:"bpmn-icon-start-event-compensation",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:CompensateEventDefinition",isInterrupting:!0}},"non-interrupting-message-start":{label:"Message start event (non-interrupting)",className:"bpmn-icon-start-event-non-interrupting-message",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:MessageEventDefinition",isInterrupting:!1}},"non-interrupting-timer-start":{label:"Timer start event (non-interrupting)",className:"bpmn-icon-start-event-non-interrupting-timer",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:TimerEventDefinition",isInterrupting:!1}},"non-interrupting-conditional-start":{label:"Conditional start event (non-interrupting)",className:"bpmn-icon-start-event-non-interrupting-condition",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:ConditionalEventDefinition",isInterrupting:!1}},"non-interrupting-signal-start":{label:"Signal start event (non-interrupting)",className:"bpmn-icon-start-event-non-interrupting-signal",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:SignalEventDefinition",isInterrupting:!1}},"non-interrupting-escalation-start":{label:"Escalation start event (non-interrupting)",className:"bpmn-icon-start-event-non-interrupting-escalation",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:EscalationEventDefinition",isInterrupting:!1}},"message-intermediate-catch":{label:"Message intermediate catch event",className:"bpmn-icon-intermediate-event-catch-message",target:{type:"bpmn:IntermediateCatchEvent",eventDefinitionType:"bpmn:MessageEventDefinition"}},"message-intermediate-throw":{label:"Message intermediate throw event",className:"bpmn-icon-intermediate-event-throw-message",target:{type:"bpmn:IntermediateThrowEvent",eventDefinitionType:"bpmn:MessageEventDefinition"}},"timer-intermediate-catch":{label:"Timer intermediate catch event",className:"bpmn-icon-intermediate-event-catch-timer",target:{type:"bpmn:IntermediateCatchEvent",eventDefinitionType:"bpmn:TimerEventDefinition"}},"escalation-intermediate-throw":{label:"Escalation intermediate throw event",className:"bpmn-icon-intermediate-event-throw-escalation",target:{type:"bpmn:IntermediateThrowEvent",eventDefinitionType:"bpmn:EscalationEventDefinition"}},"conditional-intermediate-catch":{label:"Conditional intermediate catch event",className:"bpmn-icon-intermediate-event-catch-condition",target:{type:"bpmn:IntermediateCatchEvent",eventDefinitionType:"bpmn:ConditionalEventDefinition"}},"link-intermediate-catch":{label:"Link intermediate catch event",className:"bpmn-icon-intermediate-event-catch-link",target:{type:"bpmn:IntermediateCatchEvent",eventDefinitionType:"bpmn:LinkEventDefinition",eventDefinitionAttrs:{name:""}}},"link-intermediate-throw":{label:"Link intermediate throw event",className:"bpmn-icon-intermediate-event-throw-link",target:{type:"bpmn:IntermediateThrowEvent",eventDefinitionType:"bpmn:LinkEventDefinition",eventDefinitionAttrs:{name:""}}},"compensation-intermediate-throw":{label:"Compensation intermediate throw event",className:"bpmn-icon-intermediate-event-throw-compensation",target:{type:"bpmn:IntermediateThrowEvent",eventDefinitionType:"bpmn:CompensateEventDefinition"}},"signal-intermediate-catch":{label:"Signal intermediate catch event",className:"bpmn-icon-intermediate-event-catch-signal",target:{type:"bpmn:IntermediateCatchEvent",eventDefinitionType:"bpmn:SignalEventDefinition"}},"signal-intermediate-throw":{label:"Signal intermediate throw event",className:"bpmn-icon-intermediate-event-throw-signal",target:{type:"bpmn:IntermediateThrowEvent",eventDefinitionType:"bpmn:SignalEventDefinition"}},"message-boundary":{label:"Message boundary event",className:"bpmn-icon-intermediate-event-catch-message",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:MessageEventDefinition",cancelActivity:!0}},"timer-boundary":{label:"Timer boundary event",className:"bpmn-icon-intermediate-event-catch-timer",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:TimerEventDefinition",cancelActivity:!0}},"escalation-boundary":{label:"Escalation boundary event",className:"bpmn-icon-intermediate-event-catch-escalation",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:EscalationEventDefinition",cancelActivity:!0}},"conditional-boundary":{label:"Conditional boundary event",className:"bpmn-icon-intermediate-event-catch-condition",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:ConditionalEventDefinition",cancelActivity:!0}},"error-boundary":{label:"Error boundary event",className:"bpmn-icon-intermediate-event-catch-error",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:ErrorEventDefinition",cancelActivity:!0}},"cancel-boundary":{label:"Cancel boundary event",className:"bpmn-icon-intermediate-event-catch-cancel",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:CancelEventDefinition",cancelActivity:!0}},"signal-boundary":{label:"Signal boundary event",className:"bpmn-icon-intermediate-event-catch-signal",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:SignalEventDefinition",cancelActivity:!0}},"compensation-boundary":{label:"Compensation boundary event",className:"bpmn-icon-intermediate-event-catch-compensation",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:CompensateEventDefinition",cancelActivity:!0}},"non-interrupting-message-boundary":{label:"Message boundary event (non-interrupting)",className:"bpmn-icon-intermediate-event-catch-non-interrupting-message",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:MessageEventDefinition",cancelActivity:!1}},"non-interrupting-timer-boundary":{label:"Timer boundary event (non-interrupting)",className:"bpmn-icon-intermediate-event-catch-non-interrupting-timer",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:TimerEventDefinition",cancelActivity:!1}},"non-interrupting-escalation-boundary":{label:"Escalation boundary event (non-interrupting)",className:"bpmn-icon-intermediate-event-catch-non-interrupting-escalation",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:EscalationEventDefinition",cancelActivity:!1}},"non-interrupting-conditional-boundary":{label:"Conditional boundary event (non-interrupting)",className:"bpmn-icon-intermediate-event-catch-non-interrupting-condition",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:ConditionalEventDefinition",cancelActivity:!1}},"non-interrupting-signal-boundary":{label:"Signal boundary event (non-interrupting)",className:"bpmn-icon-intermediate-event-catch-non-interrupting-signal",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:SignalEventDefinition",cancelActivity:!1}},"message-end":{label:"Message end event",className:"bpmn-icon-end-event-message",target:{type:"bpmn:EndEvent",eventDefinitionType:"bpmn:MessageEventDefinition"}},"escalation-end":{label:"Escalation end event",className:"bpmn-icon-end-event-escalation",target:{type:"bpmn:EndEvent",eventDefinitionType:"bpmn:EscalationEventDefinition"}},"error-end":{label:"Error end event",className:"bpmn-icon-end-event-error",target:{type:"bpmn:EndEvent",eventDefinitionType:"bpmn:ErrorEventDefinition"}},"cancel-end":{label:"Cancel end event",className:"bpmn-icon-end-event-cancel",target:{type:"bpmn:EndEvent",eventDefinitionType:"bpmn:CancelEventDefinition"}},"compensation-end":{label:"Compensation end event",className:"bpmn-icon-end-event-compensation",target:{type:"bpmn:EndEvent",eventDefinitionType:"bpmn:CompensateEventDefinition"}},"signal-end":{label:"Signal end event",className:"bpmn-icon-end-event-signal",target:{type:"bpmn:EndEvent",eventDefinitionType:"bpmn:SignalEventDefinition"}},"terminate-end":{label:"Terminate end event",className:"bpmn-icon-end-event-terminate",target:{type:"bpmn:EndEvent",eventDefinitionType:"bpmn:TerminateEventDefinition"}}};function Q(e,t={}){var n=gk[e];if(!n)throw new Error("unknown popup entry <"+e+">");return{...n,actionName:"replace-with-"+e,...t}}var yk=[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")],vk=[Q("none-start-event",{actionName:"replace-with-none-start"}),Q("none-intermediate-throwing"),Q("none-end-event",{actionName:"replace-with-none-end"})],bk=[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")],_k=[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")],xk=[Q("exclusive-gateway"),Q("parallel-gateway"),Q("inclusive-gateway"),Q("complex-gateway"),Q("event-based-gateway")],wk=[Q("transaction"),Q("event-subprocess"),Q("expanded-ad-hoc-subprocess",{actionName:"replace-with-ad-hoc-subprocess",label:"Ad-hoc sub-process"}),Q("collapsed-subprocess")],Ek=[Q("expanded-subprocess",{actionName:"replace-with-subprocess",label:"Sub-process"}),Q("transaction"),Q("event-subprocess"),Q("collapsed-ad-hoc-subprocess")],R_=[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")],Sk=R_,C_=[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"})],Rk=[Q("data-store-reference")],Ck=[Q("data-object-reference")],Pk=[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")],Ak=[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")],Tk=[{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"}],Mk=[Q("expanded-pool"),Q("collapsed-pool",{label:function(e){var t="Empty pool/participant";return e.children&&e.children.length&&(t+=" (removes content)"),t}})],kk={"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 P_={"start-event-non-interrupting":`
315
+ </svg>`},z2=900;function Bo(e,t,n,i){e.registerProvider(z2,this),this._contextPad=e,this._popupMenu=t,this._translate=n,this._canvas=i}Bo.$inject=["contextPad","popupMenu","translate","canvas"],Bo.prototype.getMultiElementContextPadEntries=function(e){var t={};return this._isAllowed(e)&&z(t,this._getEntries(e)),t},Bo.prototype._isAllowed=function(e){return!this._popupMenu.isEmpty(e,"align-elements")},Bo.prototype._getEntries=function(){var e=this;return{"align-elements":{group:"align-elements",title:e._translate("Align elements"),html:`<div class="entry">${Kb.align}</div>`,action:{click:function(t,n){var i=e._getMenuPosition(n);z(i,{cursor:{x:t.x,y:t.y}}),e._popupMenu.open(n,"align-elements",i)}}}}},Bo.prototype._getMenuPosition=function(e){var t=5,n=this._contextPad.getPad(e).html,i=n.getBoundingClientRect(),r={x:i.left,y:i.bottom+t};return r};var G2=["left","center","right","top","middle","bottom"];function Fa(e,t,n,i){this._alignElements=t,this._translate=n,this._popupMenu=e,this._rules=i,e.registerProvider("align-elements",this)}Fa.$inject=["popupMenu","alignElements","translate","rules"],Fa.prototype.getPopupMenuEntries=function(e){var t={};return this._isAllowed(e)&&z(t,this._getEntries(e)),t},Fa.prototype._isAllowed=function(e){return this._rules.allowed("elements.align",{elements:e})},Fa.prototype._getEntries=function(e){var t=this._alignElements,n=this._translate,i=this._popupMenu,r={};return L(G2,function(o){r["align-elements-"+o]={group:"align",title:n("Align elements "+o),className:"bjs-align-elements-menu-entry",imageHtml:Kb[o],action:function(){t.trigger(e,o),i.close()}}}),r};function ru(e){Yn.call(this,e)}ru.$inject=["eventBus"],de(ru,Yn),ru.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=Ps(n),n.length<2?!1:n})};const V2={__depends__:[t2,ab,Tf],__init__:["alignElementsContextPadProvider","alignElementsMenuProvider","bpmnAlignElements"],alignElementsContextPadProvider:["type",Bo],alignElementsMenuProvider:["type",Fa],bpmnAlignElements:["type",ru]};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=Ou(Qr(a.closure.topLevel)),c=a.hints,u=c?c.autoResize:!0;if(u!==!1){var l=Jr(s,function(f){return f.parent.id});L(l,function(f,p){ke(u)&&(f=f.filter(function(d){return lt(u,eo({id:d.id}))})),r._expand(f,p)})}}),this.postExecuted(["shape.toggleCollapse"],function(o){var a=o.context,s=a.hints,c=a.shape;s&&s.autoResize===!1||c.collapsed||r._expand(c.children||[],c)}),this.postExecuted(["shape.resize"],function(o){var a=o.context,s=a.hints,c=a.shape,u=c.parent;s&&s.autoResize===!1||u&&r._expand([c],u)})}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),Ms(z({},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(W2(i,t)){var r=U2(ni(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 W2(e,t){return e.x!==t.x||e.y!==t.y||e.width!==t.width||e.height!==t.height}function U2(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 ou(e){e.invoke(zi,this)}ou.$inject=["injector"],de(ou,zi),ou.prototype.resize=function(e,t,n){w(e,"bpmn:Participant")?this._modeling.resizeLane(e,t,null,n):this._modeling.resizeShape(e,t,null,n)};function ja(e){Yn.call(this,e);var t=this;this.addRule("element.autoResize",function(n){return t.canResize(n.elements,n.target)})}ja.$inject=["eventBus"],de(ja,Yn),ja.prototype.canResize=function(e,t){return!1};function au(e,t){ja.call(this,e),this._modeling=t}de(au,ja),au.$inject=["eventBus","modeling"],au.prototype.canResize=function(e,t){if(w(t.di,"bpmndi:BPMNPlane")||!w(t,"bpmn:Participant")&&!w(t,"bpmn:Lane")&&!w(t,"bpmn:SubProcess"))return!1;var n=!0;return L(e,function(i){if(w(i,"bpmn:Lane")||je(i)){n=!1;return}}),n};const q2={__init__:["bpmnAutoResize","bpmnAutoResizeProvider"],bpmnAutoResize:["type",ou],bpmnAutoResizeProvider:["type",au]};function No(e,t,n){this._canvas=n,this._opts=z({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()})}No.$inject=["config.autoScroll","eventBus","canvas"],No.prototype.startScroll=function(e){var t=this._canvas,n=this._opts,i=this,r=t.getContainer().getBoundingClientRect(),o=[e.x,e.y,r.width-e.x,r.height-e.y];this.stopScroll();for(var a=0,s=0,c=0;c<4;c++)Y2(o[c],n.scrollThresholdOut[c],n.scrollThresholdIn[c])&&(c===0?a=n.scrollStep:c==1?s=n.scrollStep:c==2?a=-n.scrollStep:c==3&&(s=-n.scrollStep));(a!==0||s!==0)&&(t.scroll({dx:a,dy:s}),this._scrolling=setTimeout(function(){i.startScroll(e)},n.scrollRepeatTimeout))};function Y2(e,t,n){return t<e&&e<n}No.prototype.stopScroll=function(){clearTimeout(this._scrolling)},No.prototype.setOptions=function(e){this._opts=z({},this._opts,e)},No.prototype._toBorderPoint=function(e){var t=this._canvas._container.getBoundingClientRect(),n=Ir(e.originalEvent);return{x:n.x-t.left,y:n.y-t.top}};const K2={__depends__:[Bi],__init__:["autoScroll"],autoScroll:["type",No]};var Xb="djs-bendpoint",Zb="djs-segment-dragger";function X2(e,t){var n=Ir(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 Mf(e,t,n){var i=X2(e,n),r=Yl(t,i);return r}function kf(e,t){var n=Ce("g");qe(n).add(Xb),Ne(e,n);var i=Ce("circle");he(i,{cx:0,cy:0,r:4}),qe(i).add("djs-visual"),Ne(n,i);var r=Ce("circle");return he(r,{cx:0,cy:0,r:10}),qe(r).add("djs-hit"),Ne(n,r),t&&qe(n).add(t),n}function Z2(e,t,n,i){var r=Ce("g");Ne(e,r);var o=18,a=6,s=11,c=J2(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"),Ne(r,l);var f=Ce("rect");return he(f,{x:-c/2,y:-u/2,width:c,height:u}),qe(f).add("djs-hit"),Ne(r,f),Sm(r,i==="v"?90:0),r}function Qb(e,t,n){var i=Ce("g"),r=El(t,n),o=Mi(t,n);return Ne(e,i),Z2(i,t,n,o),qe(i).add(Zb),qe(i).add(o==="h"?"horizontal":"vertical"),en(i,r.x,r.y),i}function Of(e){return Math.abs(Math.round(e*2/3))}function Q2(e,t){var n=ek(e,t);return ep(e,n)}function J2(e,t,n){var i=t.x-e.x,r=t.y-e.y;return Of(n==="h"?i:r)}function ek(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=lg(e,[a,s]);c<i&&(i=c,r=o)}return[n[r],n[r+1]]}function Jb(e,t,n,i,r){function o(x,S,P){var C=x.index,D=x.point,T,$,k,O,j,oe;return C<=0||x.bendpoint?!1:(T=S[C-1],$=S[C],k=El(T,$),O=Mi(T,$),j=Math.abs(D.x-k.x),oe=Math.abs(D.y-k.y),O&&j<=P&&oe<=P)}function a(x,S){var P=x.waypoints,C,D,T,$;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,$=Of(T)/2,$)}function s(x,S){var P=S.waypoints,C=Mf(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){Be.bind(x,S,function(C){n.triggerMouseEvent(S,C,P),C.stopPropagation()})}function u(x,S){var P=t.getLayer("overlays"),C=rt('.djs-bendpoints[data-element-id="'+La(x.id)+'"]',P);return!C&&S&&(C=Ce("g"),he(C,{"data-element-id":x.id}),qe(C).add("djs-bendpoints"),Ne(P,C),c(C,"mousedown",x),c(C,"click",x),c(C,"dblclick",x)),C}function l(x,S){return rt('.djs-segment-dragger[data-segment-idx="'+x+'"]',S)}function f(x,S){S.waypoints.forEach(function(P,C){var D=kf(x);Ne(x,D),en(D,P.x,P.y)}),kf(x,"floating")}function p(x,S){for(var P=S.waypoints,C,D,T,$=1;$<P.length;$++)C=P[$-1],D=P[$],Mi(C,D)&&(T=Qb(x,C,D),he(T,{"data-segment-idx":$}),c(T,"mousemove",S))}function d(x){L(Es("."+Xb,x),function(S){jt(S)})}function g(x){L(Es("."+Zb,x),function(S){jt(S)})}function h(x){var S=u(x);return S||(S=u(x,!0),f(S,x),p(S,x)),S}function m(x){var S=u(x);S&&(g(S),d(S),p(S,x),f(S,x))}function _(x,S){var P=rt(".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],$=S.point,k=El(D,T),O=Mi(D,T),j,oe;C&&(j=tk(C),oe={x:$.x-k.x,y:$.y-k.y},O==="v"&&(oe={x:oe.y,y:oe.x}),en(j,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&&jt(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=Mf(t,P,x.originalEvent),!D)return;_(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=rt(".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}Jb.$inject=["eventBus","canvas","interactionEvents","bendpointMove","connectionSegmentMove"];function tk(e){return rt(".djs-visual",e)}var e_=Math.round,Gr="reconnectStart",Vr="reconnectEnd",Ha="updateWaypoints";function Df(e,t,n,i,r,o){this._injector=e,this.start=function(a,s,c,u){var l=n.getGraphics(s),f=s.source,p=s.target,d=s.waypoints,g;!u&&c===0?g=Gr:!u&&c===d.length-1?g=Vr:g=Ha;var h=g===Ha?"connection.updateWaypoints":"connection.reconnect",m=r.allowed(h,{connection:s,source:f,target:p});if(m===!1&&(m=r.allowed(h,{connection:s,source:p,target:f})),m!==!1)return i.init(a,"bendpoint.move",{data:{connection:s,connectionGfx:l,context:{allowed:m,bendpointIndex:c,connection:s,source:f,target:p,insert:u,type:g}}})},t.on("bendpoint.move.hover",function(a){var s=a.context,c=s.connection,u=c.source,l=c.target,f=a.hover,p=s.type;s.hover=f;var d;if(f){var g=p===Ha?"connection.updateWaypoints":"connection.reconnect";if(d=s.allowed=r.allowed(g,{connection:c,source:p===Gr?f:u,target:p===Vr?f:l}),d){s.source=p===Gr?f:u,s.target=p===Vr?f:l;return}d===!1&&(d=s.allowed=r.allowed(g,{connection:c,source:p===Vr?f:l,target:p===Gr?f:u})),d&&(s.source=p===Vr?f:l,s.target=p===Gr?f:u)}}),t.on(["bendpoint.move.out","bendpoint.move.cleanup"],function(a){var s=a.context,c=s.type;s.hover=null,s.source=null,s.target=null,c!==Ha&&(s.allowed=!1)}),t.on("bendpoint.move.end",function(a){var s=a.context,c=s.allowed,u=s.bendpointIndex,l=s.connection,f=s.insert,p=l.waypoints.slice(),d=s.source,g=s.target,h=s.type,m=s.hints||{},_={x:e_(a.x),y:e_(a.y)};if(!c)return!1;h===Ha?(f?p.splice(u,0,_):p[u]=_,m.bendpointMove={insert:f,bendpointIndex:u},p=this.cropWaypoints(l,p),o.updateWaypoints(l,vS(p),m)):(h===Gr?(m.docking="source",su(s)&&(m.docking="target",m.newWaypoints=p.reverse())):h===Vr&&(m.docking="target",su(s)&&(m.docking="source",m.newWaypoints=p.reverse())),o.reconnect(l,d,g,_,m))},this)}Df.$inject=["injector","eventBus","canvas","dragging","rules","modeling"],Df.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 su(e){var t=e.hover,n=e.source,i=e.target,r=e.type;if(r===Gr)return t&&i&&t===i&&n!==i;if(r===Vr)return t&&n&&t===n&&n!==i}var nk="reconnectStart",ik="reconnectEnd",t_="updateWaypoints",za="connect-ok",cu="connect-not-ok",n_="connect-hover",i_="djs-updating",r_="djs-dragging",o_=1100;function a_(e,t,n,i){this._injector=t;var r=t.get("connectionPreview",!1);n.on("bendpoint.move.start",function(o){var a=o.context,s=a.bendpointIndex,c=a.connection,u=a.insert,l=c.waypoints,f=l.slice();a.waypoints=l,u&&f.splice(s,0,{x:o.x,y:o.y}),c.waypoints=f;var p=a.draggerGfx=kf(i.getLayer("overlays"));qe(p).add("djs-dragging"),i.addMarker(c,r_),i.addMarker(c,i_)}),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,n_),u===t_)return;s?(i.removeMarker(c,cu),i.addMarker(c,za)):s===!1&&(i.removeMarker(c,za),i.addMarker(c,cu))}}),n.on(["bendpoint.move.out","bendpoint.move.cleanup"],o_,function(o){var a=o.context,s=a.hover,c=a.target;s&&(i.removeMarker(s,n_),i.removeMarker(s,c?za:cu))}),n.on("bendpoint.move.move",function(o){var a=o.context,s=a.allowed,c=a.bendpointIndex,u=a.draggerGfx,l=a.hover,f=a.type,p=a.connection,d=p.source,g=p.target,h=p.waypoints.slice(),m={x:o.x,y:o.y},_=a.hints||{},y={};r&&(_.connectionStart&&(y.connectionStart=_.connectionStart),_.connectionEnd&&(y.connectionEnd=_.connectionEnd),f===nk?su(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):f===ik?su(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),f===t_&&(h=e.cropWaypoints(p,h)),y.waypoints=h,r.drawPreview(a,s,y)),en(u,o.x,o.y)},this),n.on(["bendpoint.move.end","bendpoint.move.cancel"],o_,function(o){var a=o.context,s=a.connection,c=a.draggerGfx,u=a.hover,l=a.target,f=a.waypoints;s.waypoints=f,jt(c),i.removeMarker(s,i_),i.removeMarker(s,r_),u&&(i.removeMarker(u,za),i.removeMarker(u,l?za:cu)),r&&r.cleanUp(a)})}a_.$inject=["bendpointMove","injector","eventBus","canvas"];var s_="connect-hover",c_="djs-updating";function u_(e,t,n){return Lf(e,t,e[t]+n)}function Lf(e,t,n){return{x:t==="x"?n:e.x,y:t==="y"?n:e.y}}function rk(e,t,n,i){var r=Math.max(t[i],n[i]),o=Math.min(t[i],n[i]),a=20,s=Math.min(Math.max(o+a,e[i]),r-a);return Lf(t,i,s)}function l_(e){return e==="x"?"y":"x"}function p_(e,t,n){var i,r;return e.original?e.original:(i=Oe(t),r=l_(n),Lf(e,r,i[r]))}function f_(e,t,n,i,r,o){var a=e.get("connectionDocking",!1);this.start=function(f,p,d){var g,h=n.getGraphics(p),m=d-1,_=d,y=p.waypoints,x=y[m],S=y[_],P=Mf(n,y,f),C,D,T;if(C=Mi(x,S),!!C)return D=C==="v"?"x":"y",m===0&&(x=p_(x,p.source,D)),_===y.length-1&&(S=p_(S,p.target,D)),P?T=P.point:T={x:(x.x+S.x)/2,y:(x.y+S.y)/2},g={connection:p,segmentStartIndex:m,segmentEndIndex:_,segmentStart:x,segmentEnd:S,axis:D,dragPosition:T},i.init(f,T,"connectionSegment.move",{cursor:D==="x"?"resize-ew":"resize-ns",data:{connection:p,connectionGfx:h,context:g}})};function s(f,p){if(!a)return p;var d=f.waypoints,g;return f.waypoints=p,g=a.getCroppedWaypoints(f),f.waypoints=d,g}function c(f){r.update("connection",f.connection,f.connectionGfx)}function u(f,p,d){var g=f.newWaypoints,h=f.segmentStartIndex+p,m=g[h],_=f.segmentEndIndex+p,y=g[_],x=l_(f.axis),S=rk(d,m,y,x);en(f.draggerGfx,S.x,S.y)}function l(f,p){var d=0,g=f.filter(function(h,m){return wl(f[m-1],f[m+1],h)?(d=m<=p?d-1:d,!1):!0});return{waypoints:g,segmentOffset:d}}t.on("connectionSegment.move.start",function(f){var p=f.context,d=f.connection,g=n.getLayer("overlays");p.originalWaypoints=d.waypoints.slice(),p.draggerGfx=Qb(g,p.segmentStart,p.segmentEnd),qe(p.draggerGfx).add("djs-dragging"),n.addMarker(d,c_)}),t.on("connectionSegment.move.move",function(f){var p=f.context,d=p.connection,g=p.segmentStartIndex,h=p.segmentEndIndex,m=p.segmentStart,_=p.segmentEnd,y=p.axis,x=p.originalWaypoints.slice(),S=u_(m,y,f["d"+y]),P=u_(_,y,f["d"+y]),C=x.length,D=0;x[g]=S,x[h]=P;var T,$;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&&($=Jt(d.target,P),h===C-2?$==="intersect"&&(x.pop(),x[x.length-1]=P):$!=="intersect"&&x.push(_)),p.newWaypoints=d.waypoints=s(d,x),u(p,D,f),p.newSegmentStartIndex=g+D,c(f)}),t.on("connectionSegment.move.hover",function(f){f.context.hover=f.hover,n.addMarker(f.hover,s_)}),t.on(["connectionSegment.move.out","connectionSegment.move.cleanup"],function(f){var p=f.context.hover;p&&n.removeMarker(p,s_)}),t.on("connectionSegment.move.cleanup",function(f){var p=f.context,d=p.connection;p.draggerGfx&&jt(p.draggerGfx),n.removeMarker(d,c_)}),t.on(["connectionSegment.move.cancel","connectionSegment.move.end"],function(f){var p=f.context,d=p.connection;d.waypoints=p.originalWaypoints,c(f)}),t.on("connectionSegment.move.end",function(f){var p=f.context,d=p.connection,g=p.newWaypoints,h=p.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),_=m.waypoints,y=s(d,_),x=m.segmentOffset,S={segmentMove:{segmentStartIndex:p.segmentStartIndex,newSegmentStartIndex:h+x}};o.updateWaypoints(d,y,S)})}f_.$inject=["injector","eventBus","canvas","dragging","graphicsFactory","modeling"];var ok=Math.abs,d_=Math.round;function ak(e,t,n){n=n===void 0?10:n;var i,r;for(i=0;i<t.length;i++)if(r=t[i],ok(r-e)<=n)return r}function h_(e){return{x:e.x,y:e.y}}function m_(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:d_(e.x+e.width/2),y:d_(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 g_(e){return e.children||[]}var sk=Math.abs,y_=Math.round,If=10;function v_(e){function t(o,a){if(ke(o)){for(var s=o.length;s--;)if(sk(o[s]-a)<=If)return o[s]}else{o=+o;var c=a%o;if(c<If)return a-c;if(c>o-If)return a-c+o}return a}function n(o,a){if(o.waypoints)return Q2(a,o);if(o.width)return{x:y_(o.width/2+o.x),y:y_(o.height/2+o.y)}}function i(o){var a=o.context,s=a.snapPoints,c=a.connection,u=c.waypoints,l=a.segmentStart,f=a.segmentStartIndex,p=a.segmentEnd,d=a.segmentEndIndex,g=a.axis;if(s)return s;var h=[u[f-1],l,p,u[d+1]];return f<2&&h.unshift(n(c.source,o)),d>u.length-3&&h.unshift(n(c.target,o)),a.snapPoints=s={horizontal:[],vertical:[]},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 f=s-u,p=c-l;z(o,{dx:o.dx-f,dy:o.dy-p,x:u,y:l}),(f||a.vertical.indexOf(s)!==-1)&&Dt(o,"x",u),(p||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);!at(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,f=o.y,p,d;if(s){p=t(u?s.vertical.concat([u.x]):s.vertical,l),d=t(u?s.horizontal.concat([u.y]):s.horizontal,f);var g=l-p,h=f-d;z(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",p),(h||s.horizontal.indexOf(f)!==-1)&&Dt(o,"y",d)}})}v_.$inject=["eventBus"];const ck={__depends__:[Bi,bi],__init__:["bendpoints","bendpointSnapping","bendpointMovePreview"],bendpoints:["type",Jb],bendpointMove:["type",Df],bendpointMovePreview:["type",a_],connectionSegmentMove:["type",f_],bendpointSnapping:["type",v_]};function b_(e,t,n,i){function r(a,s){return i.allowed("connection.create",{source:a,target:s})}function o(a,s){return r(s,a)}e.on("connect.hover",function(a){var s=a.context,c=s.start,u=a.hover,l;if(s.hover=u,l=s.canExecute=r(c,u),!Zr(l)){if(l!==!1){s.source=c,s.target=u;return}l=s.canExecute=o(c,u),!Zr(l)&&l!==!1&&(s.source=u,s.target=c)}}),e.on(["connect.out","connect.cleanup"],function(a){var s=a.context;s.hover=null,s.source=null,s.target=null,s.canExecute=!1}),e.on("connect.end",function(a){var s=a.context,c=s.canExecute,u=s.connectionStart,l={x:a.x,y:a.y},f=s.source,p=s.target;if(!c)return!1;var d=null,g={connectionStart:Bf(s)?l:u,connectionEnd:Bf(s)?u:l};Vt(c)&&(d=c),s.connection=n.connect(f,p,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}}})}}b_.$inject=["eventBus","dragging","modeling","rules"];function Bf(e){var t=e.hover,n=e.source,i=e.target;return t&&n&&t===n&&n!==i}var uk=1100,lk=900,__="connect-ok",x_="connect-not-ok";function w_(e,t,n){var i=e.get("connectionPreview",!1);i&&t.on("connect.move",function(r){var o=r.context,a=o.canExecute,s=o.hover,c=o.source,u=o.start,l=o.startPosition,f=o.target,p=o.connectionStart||l,d=o.connectionEnd||{x:r.x,y:r.y},g=p,h=d;Bf(o)&&(g=d,h=p),i.drawPreview(o,a,{source:c||u,target:f||s,connectionStart:g,connectionEnd:h})}),t.on("connect.hover",lk,function(r){var o=r.context,a=r.hover,s=o.canExecute;s!==null&&n.addMarker(a,s?__:x_)}),t.on(["connect.out","connect.cleanup"],uk,function(r){var o=r.hover;o&&(n.removeMarker(o,__),n.removeMarker(o,x_))}),i&&t.on("connect.cleanup",function(r){i.cleanUp(r.context)})}w_.$inject=["injector","eventBus","canvas"];const Nf={__depends__:[Kn,bi,Bi],__init__:["connectPreview"],connect:["type",b_],connectPreview:["type",w_]};var pk="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,f=n.noCropping,p=n.noNoop,d,g=this;if(i||(i=e.connectionPreviewGfx=this.createConnectionPreviewGfx()),Ss(i),r||(r=e.getConnection=fk(function(h,m,_){return g.getConnection(h,m,_)})),t&&(d=r(t,o,a)),!d){!p&&this.drawNoopPreview(i,n);return}d.waypoints=s||[],this._layouter&&!l&&(d.waypoints=this._layouter.layoutConnection(d,{source:o,target:a,connectionStart:c,connectionEnd:u,waypoints:n.waypoints||d.waypoints})),(!d.waypoints||!d.waypoints.length)&&(d.waypoints=[o?Oe(o):c,a?Oe(a):u]),this._connectionDocking&&(o||a)&&!f&&(d.waypoints=this._connectionDocking.getCroppedWaypoints(d,o,a)),this._graphicsFactory.drawConnection(i,d,{stroke:"var(--element-dragger-color)"})},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]);Ne(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&&na(o,s,!0)||e,t=i&&na(a,s,!1)||t,[e,t]},Gi.prototype.cleanUp=function(e){e&&e.connectionPreviewGfx&&jt(e.connectionPreviewGfx)},Gi.prototype.getConnection=function(e){var t=dk(e);return this._elementFactory.createConnection(t)},Gi.prototype.createConnectionPreviewGfx=function(){var e=Ce("g");return he(e,{pointerEvents:"none"}),qe(e).add(pk),Ne(this._canvas.getActiveLayer(),e),e},Gi.prototype.createNoopConnection=function(e,t){return Qo([e,t],{stroke:"#333",strokeDasharray:[1],strokeWidth:2,"pointer-events":"none"})};function fk(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 dk(e){return Vt(e)?e:{}}const hk={__init__:["connectionPreview"],connectionPreview:["type",Gi]},uu="complex-preview";class E_{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(uu);n.filter(s=>!mk(s)).forEach(s=>{let c;at(s)?(c=this._graphicsFactory._createContainer("connection",Ce("g")),this._graphicsFactory.drawConnection(Or(c),s)):(c=this._graphicsFactory._createContainer("shape",Ce("g")),this._graphicsFactory.drawShape(Or(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);at(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(Or(u),s,{width:c.width,height:c.height}),en(u,c.x,c.y),this._previewSupport.addDragger(s,a,u)})}cleanUp(){Ss(this._canvas.getLayer(uu)),this._markers.forEach(([t,n])=>this._canvas.removeMarker(t,n)),this._markers=[]}show(){this._canvas.showLayer(uu)}hide(){this._canvas.hideLayer(uu)}}E_.$inject=["canvas","graphicsFactory","previewSupport"];function mk(e){return e.hidden}const gk={__depends__:[Ao],__init__:["complexPreview"],complexPreview:["type",E_]},S_=Math.round;function lu(e,t,n,i,r,o){this._complexPreview=e,this._connectionDocking=t,this._elementFactory=n,this._eventBus=i,this._layouter=r,this._rules=o}lu.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(z({type:t},n)),l=a.fire("autoPlace",{source:e,shape:u});if(!l)return;z(u,{x:l.x-S_(u.width/2),y:l.y-S_(u.height/2)});const f=c.allowed("connection.create",{source:e,target:u,hints:{targetParent:e.parent}});let p=null;f&&(p=o.createConnection(f),p.waypoints=s.layoutConnection(p,{source:e,target:u}),p.waypoints=r.getCroppedWaypoints(p,e,u)),i.create({created:[u,p].filter(d=>!Zr(d))})},lu.prototype.cleanUp=function(){this._complexPreview.cleanUp()},lu.$inject=["complexPreview","connectionDocking","elementFactory","eventBus","layouter","rules"];const yk={__depends__:[Nc,gk,uf],__init__:["appendPreview"],appendPreview:["type",lu]};var R_=Math.min,C_=Math.max;function $f(e){e.preventDefault()}function Ga(e){e.stopPropagation()}function vk(e){return e.nodeType===Node.TEXT_NODE}function bk(e){return[].slice.call(e)}function ai(e){this.container=e.container,this.parent=dt('<div class="djs-direct-editing-parent"><div class="djs-direct-editing-content" contenteditable="true"></div></div>'),this.content=rt("[contenteditable]",this.parent),this.keyHandler=e.keyHandler||function(){},this.resizeHandler=e.resizeHandler||function(){},this.focusoutHandler=e.focusoutHandler||function(){},this.autoResize=gn(this.autoResize,this),this.handlePaste=gn(this.handlePaste,this)}ai.prototype.create=function(e,t,n,i){var r=this,o=this.parent,a=this.content,s=this.container;i=this.options=i||{},t=this.style=t||{};var c=ni(t,["width","height","maxWidth","maxHeight","minWidth","minHeight","left","top","backgroundColor","position","overflow","border","wordWrap","textAlign","outline","transform"]);z(o.style,{width:e.width+"px",height:e.height+"px",maxWidth:e.maxWidth+"px",maxHeight:e.maxHeight+"px",minWidth:e.minWidth+"px",minHeight:e.minHeight+"px",left:e.x+"px",top:e.y+"px",backgroundColor:"#ffffff",position:"absolute",overflow:"visible",border:"1px solid #ccc",boxSizing:"border-box",wordWrap:"normal",textAlign:"center",outline:"none"},c);var u=ni(t,["fontFamily","fontSize","fontWeight","lineHeight","padding","paddingTop","paddingRight","paddingBottom","paddingLeft"]);return z(a.style,{boxSizing:"border-box",width:"100%",outline:"none",wordWrap:"break-word"},u),i.centerVertically&&z(a.style,{position:"absolute",top:"50%",transform:"translate(0, -50%)"},u),a.innerText=n,Be.bind(a,"keydown",this.keyHandler),Be.bind(a,"mousedown",Ga),Be.bind(a,"paste",r.handlePaste),Be.bind(a,"focusout",this.focusoutHandler),i.autoResize&&Be.bind(a,"input",this.autoResize),i.resizable&&this.resizable(t),s.appendChild(o),this.setSelection(a.lastChild,a.lastChild&&a.lastChild.length),o},ai.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)}},ai.prototype.insertText=function(e){e=_k(e);var t=document.execCommand("insertText",!1,e);t||this._insertTextIE(e)},ai.prototype._insertTextIE=function(e){var t=this.getSelection(),n=t.startContainer,i=t.endContainer,r=t.startOffset,o=t.endOffset,a=t.commonAncestorContainer,s=bk(a.childNodes),c,u;if(vk(a)){var l=n.textContent;n.textContent=l.substring(0,r)+e+l.substring(o),c=n,u=r+e.length}else if(n===this.content&&i===this.content){var f=document.createTextNode(e);this.content.insertBefore(f,s[r]),c=f,u=f.textContent.length}else{var p=s.indexOf(n),d=s.indexOf(i);s.forEach(function(g,h){h===p?g.textContent=n.textContent.substring(0,r)+e+i.textContent.substring(o):h>p&&h<=d&&di(g)}),c=n,u=r+e.length}c&&u!==void 0&&setTimeout(function(){self.setSelection(c,u)})},ai.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})}},ai.prototype.resizable=function(){var e=this,t=this.parent,n=this.resizeHandle,i=parseInt(this.style.minWidth)||0,r=parseInt(this.style.minHeight)||0,o=parseInt(this.style.maxWidth)||1/0,a=parseInt(this.style.maxHeight)||1/0;if(!n){n=this.resizeHandle=dt('<div class="djs-direct-editing-resize-handle"></div>');var s,c,u,l,f=function(g){$f(g),Ga(g),s=g.clientX,c=g.clientY;var h=t.getBoundingClientRect();u=h.width,l=h.height,Be.bind(document,"mousemove",p),Be.bind(document,"mouseup",d)},p=function(g){$f(g),Ga(g);var h=R_(C_(u+g.clientX-s,i),o),m=R_(C_(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){$f(g),Ga(g),Be.unbind(document,"mousemove",p,!1),Be.unbind(document,"mouseup",d,!1)};Be.bind(n,"mousedown",f)}z(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)},ai.prototype.destroy=function(){var e=this.parent,t=this.content,n=this.resizeHandle;t.innerText="",e.removeAttribute("style"),t.removeAttribute("style"),Be.unbind(t,"keydown",this.keyHandler),Be.unbind(t,"mousedown",Ga),Be.unbind(t,"input",this.autoResize),Be.unbind(t,"paste",this.handlePaste),Be.unbind(t,"focusout",this.focusoutHandler),n&&(n.removeAttribute("style"),di(n)),di(e)},ai.prototype.getValue=function(){return this.content.innerText.trim()},ai.prototype.getSelection=function(){var e=window.getSelection(),t=e.getRangeAt(0);return t},ai.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 _k(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 ai({container:t.getContainer(),keyHandler:gn(this._handleKey,this),resizeHandler:gn(this._handleResize,this),focusoutHandler:gn(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 P_={__depends__:[dc],__init__:["directEditing"],directEditing:["type",Dn]};function xk(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===We(e);return!o||!a||!s||!c}}const wk={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=wk[e];if(!n)throw new Error("unknown popup entry <"+e+">");return{...n,actionName:"replace-with-"+e,...t}}var Ek=[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")],Sk=[Q("none-start-event",{actionName:"replace-with-none-start"}),Q("none-intermediate-throwing"),Q("none-end-event",{actionName:"replace-with-none-end"})],Rk=[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")],Ck=[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")],Pk=[Q("exclusive-gateway"),Q("parallel-gateway"),Q("inclusive-gateway"),Q("complex-gateway"),Q("event-based-gateway")],Ak=[Q("transaction"),Q("event-subprocess"),Q("expanded-ad-hoc-subprocess",{actionName:"replace-with-ad-hoc-subprocess",label:"Ad-hoc sub-process"}),Q("collapsed-subprocess")],Tk=[Q("expanded-subprocess",{actionName:"replace-with-subprocess",label:"Sub-process"}),Q("transaction"),Q("event-subprocess"),Q("collapsed-ad-hoc-subprocess")],A_=[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")],Mk=A_,T_=[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"})],kk=[Q("data-store-reference")],Ok=[Q("data-object-reference")],Dk=[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")],Lk=[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")],Ik=[{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"}],Bk=[Q("expanded-pool"),Q("collapsed-pool",{label:function(e){var t="Empty pool/participant";return e.children&&e.children.length&&(t+=" (removes content)"),t}})],Nk={"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 M_={"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 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=mk(e);return x(t,"bpmn:DataObjectReference")?this._createEntries(e,Rk):x(t,"bpmn:DataStoreReference")&&!x(e.parent,"bpmn:Collaboration")?this._createEntries(e,Ck):(x(t,"bpmn:Event")&&!x(t,"bpmn:BoundaryEvent")&&(r=(s=t.get("eventDefinitions")[0])==null?void 0:s.$type,i=kk[r]||[],!un(t.$parent)&&x(t.$parent,"bpmn:SubProcess")&&(i=Ge(i,function(c){return c.target.type!=="bpmn:StartEvent"}))),x(t,"bpmn:StartEvent")&&!x(t.$parent,"bpmn:SubProcess")?(o=Ge(yk.concat(i),a),this._createEntries(e,o)):x(t,"bpmn:Participant")?(o=Ge(Mk,function(c){return Ue(e)!==c.target.isExpanded}),this._createEntries(e,o)):x(t,"bpmn:StartEvent")&&un(t.$parent)?(o=Ge(Ak.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)):x(t,"bpmn:StartEvent")&&!un(t.$parent)&&x(t.$parent,"bpmn:SubProcess")?(o=Ge(vk.concat(i),a),this._createEntries(e,o)):x(t,"bpmn:EndEvent")?(o=Ge(_k.concat(i),function(c){var u=c.target;return u.eventDefinitionType=="bpmn:CancelEventDefinition"&&!x(t.$parent,"bpmn:Transaction")?!1:a(c)}),this._createEntries(e,o)):x(t,"bpmn:BoundaryEvent")?(o=Ge(Pk,function(c){var u=c.target;if(u.eventDefinitionType=="bpmn:CancelEventDefinition"&&!x(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)):x(t,"bpmn:IntermediateCatchEvent")||x(t,"bpmn:IntermediateThrowEvent")?(o=Ge(bk.concat(i),a),this._createEntries(e,o)):x(t,"bpmn:Gateway")?(o=Ge(xk,a),this._createEntries(e,o)):x(t,"bpmn:Transaction")?(o=Ge(R_,a),this._createEntries(e,o)):un(t)&&Ue(e)?(o=Ge(Sk,a),this._createEntries(e,o)):x(t,"bpmn:AdHocSubProcess")&&Ue(e)?(o=Ge(Ek,a),this._createEntries(e,o)):x(t,"bpmn:SubProcess")&&Ue(e)?(o=Ge(wk,a),this._createEntries(e,o)):x(t,"bpmn:SubProcess")&&!Ue(e)?(o=Ge(C_,function(c){var u=c.target.type===e.type,l=c.target.isExpanded===!0;return u===l}),this._createEntries(e,o)):x(t,"bpmn:SequenceFlow")?this._createSequenceFlowEntries(e,Tk):x(t,"bpmn:FlowNode")?(o=Ge(C_,a),this._createEntries(e,o)):{})},Yn.prototype.getPopupMenuHeaderEntries=function(e){var t={};return x(e,"bpmn:Activity")&&!un(e)&&(t={...t,...this._getLoopCharacteristicsHeaderEntries(e)}),x(e,"bpmn:DataObjectReference")&&(t={...t,...this._getCollectionHeaderEntries(e)}),x(e,"bpmn:Participant")&&(t={...t,...this._getParticipantMultiplicityHeaderEntries(e)}),wg(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&&(x(n.sourceRef,"bpmn:ExclusiveGateway")||x(n.sourceRef,"bpmn:InclusiveGateway")||x(n.sourceRef,"bpmn:ComplexGateway")||x(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&&x(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:x(n.sourceRef,"bpmn:Activity")&&n.conditionExpression&&(i={...i,[s.actionName]:a._createEntry(s,e,function(){r.updateProperties(e,{conditionExpression:void 0})})}),(x(n.sourceRef,"bpmn:ExclusiveGateway")||x(n.sourceRef,"bpmn:InclusiveGateway")||x(n.sourceRef,"bpmn:ComplexGateway")||x(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&&x(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=Eg(e),o=x(e,"bpmn:BoundaryEvent")?P_["intermediate-event-non-interrupting"]:P_["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 Ok={__depends__:[Pf,Gy,Nc],__init__:["replaceMenuProvider"],replaceMenuProvider:["type",Yn]};function Va(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(!(!ma(d)||!i.isOpen(h))){var m=i.getEntries(h);m.replace&&m.replace.action.click(d,h)}}),n.on("contextPad.close",function(){f.cleanUp()})}Va.$inject=["config.contextPad","injector","eventBus","contextPad","modeling","elementFactory","connect","create","popupMenu","canvas","rules","translate","appendPreview"],Va.prototype.getMultiElementContextPadEntries=function(e){var t=this._modeling,n={};return this._isDeleteAllowed(e)&&H(n,{delete:{group:"edit",className:"bpmn-icon-trash",title:this._translate("Delete"),action:{click:function(i,r){t.removeElements(r.slice())}}}}),n},Va.prototype._isDeleteAllowed=function(e){var t=this._rules.allowed("elements.delete",{elements:e});return ke(t)?Cr(e,n=>t.includes(n)):t},Va.prototype.getContextPadEntries=function(e){var t=this._contextPad,n=this._modeling,i=this._elementFactory,r=this._connect,o=this._create,a=this._popupMenu,s=this._autoPlace,c=this._translate,u=this._appendPreview,l={};if(e.type==="label")return this._isDeleteAllowed([e])&&H(l,g()),l;var p=e.businessObject;function f(_,S){r.start(_,S)}function d(_,S){n.removeElements([S])}function g(){return{delete:{group:"edit",className:"bpmn-icon-trash",title:c("Delete"),action:{click:d}}}}function h(_){var S=5,P=t.getPad(_).html,C=P.getBoundingClientRect(),D={x:C.left,y:C.bottom+S};return D}function m(_,S,P,C){function D(k,O){var F=i.createShape(H({type:_},C));o.start(k,F,{source:O})}var T=s?function(k,O){var F=i.createShape(H({type:_},C));s.append(O,F)}:D,N=s?function(k,O){return u.create(O,_,C),()=>{u.cleanUp()}}:null;return{group:"model",className:S,title:P,action:{dragstart:D,click:T,hover:N}}}function w(_){return function(S,P){n.splitLane(P,_),t.open(P,!0)}}if(ze(p,["bpmn:Lane","bpmn:Participant"])&&Ue(e)){var y=ar(e);H(l,{"lane-insert-above":{group:"lane-insert-above",className:"bpmn-icon-lane-insert-above",title:c("Add lane above"),action:{click:function(_,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:w(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:w(3)}}})),H(l,{"lane-insert-below":{group:"lane-insert-below",className:"bpmn-icon-lane-insert-below",title:c("Add lane below"),action:{click:function(_,S){n.addLane(S,"bottom")}}}})}return x(p,"bpmn:FlowNode")&&(x(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"})}):A_(p,"bpmn:BoundaryEvent","bpmn:CompensateEventDefinition")?H(l,{"append.compensation-activity":m("bpmn:Task","bpmn-icon-task",c("Append compensation activity"),{isForCompensation:!0})}):!x(p,"bpmn:EndEvent")&&!p.isForCompensation&&!A_(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(_,S){var P=H(h(S),{cursor:{x:_.x,y:_.y}});a.open(S,"bpmn-replace",P,{title:c("Change element"),width:"var(--bpmn-replace-popup-width, 300px)",search:!0})}}}}),x(p,"bpmn:SequenceFlow")&&H(l,{"append.text-annotation":m("bpmn:TextAnnotation","bpmn-icon-text-annotation",c("Add text annotation"))}),x(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}}}),x(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}}}),x(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 A_(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 Dk={__depends__:[pk,S_,ib,Vn,If,hc,Ok],__init__:["contextPadProvider"],contextPadProvider:["type",Va]};var Lk={horizontal:["x","width"],vertical:["y","height"]},T_=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=ai(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=Lk[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+T_,max:t+n-T_}};const Ik={__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 M_={horizontal:`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1800 1800">
327
+ </svg>`};function Jn(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()}Jn.$inject=["bpmnFactory","popupMenu","modeling","moddle","bpmnReplace","rules","translate","moddleCopy"],Jn.prototype._register=function(){this._popupMenu.registerProvider("bpmn-replace",this)},Jn.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=xk(e);return w(t,"bpmn:DataObjectReference")?this._createEntries(e,kk):w(t,"bpmn:DataStoreReference")&&!w(e.parent,"bpmn:Collaboration")?this._createEntries(e,Ok):(w(t,"bpmn:Event")&&!w(t,"bpmn:BoundaryEvent")&&(r=(s=t.get("eventDefinitions")[0])==null?void 0:s.$type,i=Nk[r]||[],!un(t.$parent)&&w(t.$parent,"bpmn:SubProcess")&&(i=Ge(i,function(c){return c.target.type!=="bpmn:StartEvent"}))),w(t,"bpmn:StartEvent")&&!w(t.$parent,"bpmn:SubProcess")?(o=Ge(Ek.concat(i),a),this._createEntries(e,o)):w(t,"bpmn:Participant")?(o=Ge(Bk,function(c){return We(e)!==c.target.isExpanded}),this._createEntries(e,o)):w(t,"bpmn:StartEvent")&&un(t.$parent)?(o=Ge(Lk.concat(i),function(c){var u=c.target,l=u.isInterrupting!==!1,f=t.isInterrupting===l;return a(c)||!a(c)&&!f}),this._createEntries(e,o)):w(t,"bpmn:StartEvent")&&!un(t.$parent)&&w(t.$parent,"bpmn:SubProcess")?(o=Ge(Sk.concat(i),a),this._createEntries(e,o)):w(t,"bpmn:EndEvent")?(o=Ge(Ck.concat(i),function(c){var u=c.target;return u.eventDefinitionType=="bpmn:CancelEventDefinition"&&!w(t.$parent,"bpmn:Transaction")?!1:a(c)}),this._createEntries(e,o)):w(t,"bpmn:BoundaryEvent")?(o=Ge(Dk,function(c){var u=c.target;if(u.eventDefinitionType=="bpmn:CancelEventDefinition"&&!w(t.attachedToRef,"bpmn:Transaction"))return!1;var l=u.cancelActivity!==!1,f=t.cancelActivity==l;return a(c)||!a(c)&&!f}),this._createEntries(e,o)):w(t,"bpmn:IntermediateCatchEvent")||w(t,"bpmn:IntermediateThrowEvent")?(o=Ge(Rk.concat(i),a),this._createEntries(e,o)):w(t,"bpmn:Gateway")?(o=Ge(Pk,a),this._createEntries(e,o)):w(t,"bpmn:Transaction")?(o=Ge(A_,a),this._createEntries(e,o)):un(t)&&We(e)?(o=Ge(Mk,a),this._createEntries(e,o)):w(t,"bpmn:AdHocSubProcess")&&We(e)?(o=Ge(Tk,a),this._createEntries(e,o)):w(t,"bpmn:SubProcess")&&We(e)?(o=Ge(Ak,a),this._createEntries(e,o)):w(t,"bpmn:SubProcess")&&!We(e)?(o=Ge(T_,function(c){var u=c.target.type===e.type,l=c.target.isExpanded===!0;return u===l}),this._createEntries(e,o)):w(t,"bpmn:SequenceFlow")?this._createSequenceFlowEntries(e,Ik):w(t,"bpmn:FlowNode")?(o=Ge(T_,a),this._createEntries(e,o)):{})},Jn.prototype.getPopupMenuHeaderEntries=function(e){var t={};return w(e,"bpmn:Activity")&&!un(e)&&(t={...t,...this._getLoopCharacteristicsHeaderEntries(e)}),w(e,"bpmn:DataObjectReference")&&(t={...t,...this._getCollectionHeaderEntries(e)}),w(e,"bpmn:Participant")&&(t={...t,...this._getParticipantMultiplicityHeaderEntries(e)}),Rg(e)&&(t={...t,...this._getNonInterruptingHeaderEntries(e)}),t},Jn.prototype._createEntries=function(e,t){var n={},i=this;return L(t,function(r){n[r.actionName]=i._createEntry(r,e)}),n},Jn.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&&(w(n.sourceRef,"bpmn:ExclusiveGateway")||w(n.sourceRef,"bpmn:InclusiveGateway")||w(n.sourceRef,"bpmn:ComplexGateway")||w(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&&w(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:w(n.sourceRef,"bpmn:Activity")&&n.conditionExpression&&(i={...i,[s.actionName]:a._createEntry(s,e,function(){r.updateProperties(e,{conditionExpression:void 0})})}),(w(n.sourceRef,"bpmn:ExclusiveGateway")||w(n.sourceRef,"bpmn:InclusiveGateway")||w(n.sourceRef,"bpmn:ComplexGateway")||w(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},Jn.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}},Jn.prototype._getLoopCharacteristicsHeaderEntries=function(e){var t=this,n=this._translate;function i(u,l){if(l.active){t._modeling.updateProperties(e,{loopCharacteristics:void 0});return}var f=e.businessObject.get("loopCharacteristics");f&&w(f,l.options.loopCharacteristics)?t._modeling.updateModdleProperties(e,f,{isSequential:l.options.isSequential}):(f=t._moddle.create(l.options.loopCharacteristics,{isSequential:l.options.isSequential}),t._modeling.updateProperties(e,{loopCharacteristics:f}))}var r=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"}}}},Jn.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}}},Jn.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}}},Jn.prototype._getNonInterruptingHeaderEntries=function(e){const t=this._translate,n=te(e),i=this,r=Cg(e),o=w(e,"bpmn:BoundaryEvent")?M_["intermediate-event-non-interrupting"]:M_["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 $k={__depends__:[Tf,Uy,Nc],__init__:["replaceMenuProvider"],replaceMenuProvider:["type",Jn]};function Va(e,t,n,i,r,o,a,s,c,u,l,f,p){e=e||{},i.registerProvider(this),this._contextPad=i,this._modeling=r,this._elementFactory=o,this._connect=a,this._create=s,this._popupMenu=c,this._canvas=u,this._rules=l,this._translate=f,this._eventBus=n,this._appendPreview=p,e.autoPlace!==!1&&(this._autoPlace=t.get("autoPlace",!1)),n.on("create.end",250,function(d){var g=d.context,h=g.shape;if(!(!ma(d)||!i.isOpen(h))){var m=i.getEntries(h);m.replace&&m.replace.action.click(d,h)}}),n.on("contextPad.close",function(){p.cleanUp()})}Va.$inject=["config.contextPad","injector","eventBus","contextPad","modeling","elementFactory","connect","create","popupMenu","canvas","rules","translate","appendPreview"],Va.prototype.getMultiElementContextPadEntries=function(e){var t=this._modeling,n={};return this._isDeleteAllowed(e)&&z(n,{delete:{group:"edit",className:"bpmn-icon-trash",title:this._translate("Delete"),action:{click:function(i,r){t.removeElements(r.slice())}}}}),n},Va.prototype._isDeleteAllowed=function(e){var t=this._rules.allowed("elements.delete",{elements:e});return ke(t)?Rr(e,n=>t.includes(n)):t},Va.prototype.getContextPadEntries=function(e){var t=this._contextPad,n=this._modeling,i=this._elementFactory,r=this._connect,o=this._create,a=this._popupMenu,s=this._autoPlace,c=this._translate,u=this._appendPreview,l={};if(e.type==="label")return this._isDeleteAllowed([e])&&z(l,g()),l;var f=e.businessObject;function p(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 j=i.createShape(z({type:x},C));o.start(k,j,{source:O})}var T=s?function(k,O){var j=i.createShape(z({type:x},C));s.append(O,j)}:D,$=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:$}}}function _(x){return function(S,P){n.splitLane(P,x),t.open(P,!0)}}if(ze(f,["bpmn:Lane","bpmn:Participant"])&&We(e)){var y=or(e);z(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)&&z(l,{"lane-divide-two":{group:"lane-divide",className:"bpmn-icon-lane-divide-two",title:c("Divide into two lanes"),action:{click:_(2)}}}),(qt(e)?e.height>=180:e.width>=180)&&z(l,{"lane-divide-three":{group:"lane-divide",className:"bpmn-icon-lane-divide-three",title:c("Divide into three lanes"),action:{click:_(3)}}})),z(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 w(f,"bpmn:FlowNode")&&(w(f,"bpmn:EventBasedGateway")?z(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"})}):k_(f,"bpmn:BoundaryEvent","bpmn:CompensateEventDefinition")?z(l,{"append.compensation-activity":m("bpmn:Task","bpmn-icon-task",c("Append compensation activity"),{isForCompensation:!0})}):!w(f,"bpmn:EndEvent")&&!f.isForCompensation&&!k_(f,"bpmn:IntermediateThrowEvent","bpmn:LinkEventDefinition")&&!un(f)&&z(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")||z(l,{replace:{group:"edit",className:"bpmn-icon-screw-wrench",title:c("Change element"),action:{click:function(x,S){var P=z(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})}}}}),w(f,"bpmn:SequenceFlow")&&z(l,{"append.text-annotation":m("bpmn:TextAnnotation","bpmn-icon-text-annotation",c("Add text annotation"))}),w(f,"bpmn:MessageFlow")&&z(l,{"append.text-annotation":m("bpmn:TextAnnotation","bpmn-icon-text-annotation",c("Add text annotation"))}),ze(f,["bpmn:FlowNode","bpmn:InteractionNode","bpmn:DataObjectReference","bpmn:DataStoreReference"])&&z(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:p,dragstart:p}}}),w(f,"bpmn:TextAnnotation")&&z(l,{connect:{group:"connect",className:"bpmn-icon-connection-multi",title:c("Connect using association"),action:{click:p,dragstart:p}}}),ze(f,["bpmn:DataObjectReference","bpmn:DataStoreReference"])&&z(l,{connect:{group:"connect",className:"bpmn-icon-connection-multi",title:c("Connect using data input association"),action:{click:p,dragstart:p}}}),w(f,"bpmn:Group")&&z(l,{"append.text-annotation":m("bpmn:TextAnnotation","bpmn-icon-text-annotation",c("Add text annotation"))}),this._isDeleteAllowed([e])&&z(l,g()),l};function k_(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 Fk={__depends__:[yk,P_,ab,Kn,Nf,mc,$k],__init__:["contextPadProvider"],contextPadProvider:["type",Va]};var jk={horizontal:["x","width"],vertical:["y","height"]},O_=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=ci(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=jk[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+O_,max:t+n-O_}};const Hk={__init__:["distributeElements"],distributeElements:["type",Vi]};function pu(e){Yn.call(this,e)}pu.$inject=["eventBus"],de(pu,Yn),pu.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=Ps(t),t.length<3?!1:t})};var D_={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>`},Nk=900;function Wa(e,t,n,i){this._distributeElements=t,this._translate=n,this._popupMenu=e,this._rules=i,e.registerProvider("align-elements",Nk,this)}Wa.$inject=["popupMenu","distributeElements","translate","rules"],Wa.prototype.getPopupMenuEntries=function(e){var t={};return this._isAllowed(e)&&H(t,this._getEntries(e)),t},Wa.prototype._isAllowed=function(e){return this._rules.allowed("elements.distribute",{elements:e})},Wa.prototype._getEntries=function(e){var t=this._distributeElements,n=this._translate,i=this._popupMenu,r={"distribute-elements-horizontal":{group:"distribute",title:n("Distribute elements horizontally"),className:"bjs-align-elements-menu-entry",imageHtml:M_.horizontal,action:function(o,a){t.trigger(e,"horizontal"),i.close()}},"distribute-elements-vertical":{group:"distribute",title:n("Distribute elements vertically"),imageHtml:M_.vertical,action:function(o,a){t.trigger(e,"vertical"),i.close()}}};return r};const Bk={__depends__:[Pf,Ik],__init__:["bpmnDistributeElements","distributeElementsMenuProvider"],bpmnDistributeElements:["type",lu],distributeElementsMenuProvider:["type",Wa]};var k_="is not a registered action",$k="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 Bf(e,k_);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 Bf(e,$k);this._actions[e]=t},Kn.prototype.unregister=function(e){if(!this.isRegistered(e))throw Bf(e,k_);this._actions[e]=void 0},Kn.prototype.getActions=function(){return Object.keys(this._actions)},Kn.prototype.isRegistered=function(e){return!!this._actions[e]};function Bf(e,t){return new Error(e+" "+t)}const jk={__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=[],w=g.type;h.length&&(m=Ge(h,function(y){return!x(y,"bpmn:Lane")}),u.trigger(m,w))}),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;x(g,"bpmn:Collaboration")?m=n.filter(function(w){return x(w.parent,"bpmn:Collaboration")}):m=n.filter(function(w){return w!==g&&!x(w.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 Fk={__depends__:[jk],editorActions:["type",pu]};function O_(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")})}O_.$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;wn(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 Hk=2e3;function D_(e,t){e.on(["spaceTool.move","spaceTool.end"],Hk,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)}})}D_.$inject=["eventBus","gridSnapping"];const zk={__init__:["gridSnappingResizeBehavior","gridSnappingSpaceToolBehavior"],gridSnappingResizeBehavior:["type",Ur],gridSnappingSpaceToolBehavior:["type",D_]};var fu=10;function $f(e,t,n){return n||(n="round"),Math[n](e/t)*t}var Gk=1200,Vk=800;function br(e,t,n){var i=!n||n.active!==!1;this._eventBus=t;var r=this;t.on("diagram.init",Vk,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"],Gk,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=Uk(o,u,e);p&&(l.offset=p);var f=Wk(o,u);f&&H(l,f),$o(o,u)||r.snapEvent(o,u,l)})}})}br.prototype.snapEvent=function(e,t,n){var i=this.snapValue(e[t],n);Dt(e,t,i)},br.prototype.getGridSpacing=function(){return fu},br.prototype.snapValue=function(e,t){var n=0;t&&t.offset&&(n=t.offset),e+=n,e=$f(e,fu);var i,r;return t&&t.min&&(i=t.min,Le(i)&&(i=$f(i+n,fu,"ceil"),e=Math.max(e,i))),t&&t.max&&(r=t.max,Le(r)&&(r=$f(r+n,fu,"floor"),e=Math.min(e,r))),e-=n,e},br.prototype.isActive=function(){return this.active},br.prototype.setActive=function(e){this.active=e,this._eventBus.fire("gridSnapping.toggle",{active:e})},br.prototype.toggleActive=function(){this.setActive(!this.active)},br.$inject=["elementRegistry","eventBus","config.gridSnapping"];function Wk(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)?I_(s)?a.x.max=c.left:a.x.min=c.right:L_(s)?a.y.max=c.top:a.y.min=c.bottom),u&&(du(t)?I_(s)?a.x.min=u.left:a.x.max=u.right:L_(s)?a.y.min=u.top:a.y.max=u.bottom),a[t]}function Uk(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 L_(e){return e.indexOf("n")!==-1}function I_(e){return e.indexOf("w")!==-1}const qk={__depends__:[zk],__init__:["gridSnapping"],gridSnapping:["type",br]};var Yk=2e3;function N_(e,t,n){e.on("autoPlace",Yk,function(i){var r=i.source,o=Oe(r),a=i.shape,s=Iv(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],x(a,"bpmn:TextAnnotation")&&(Kk(c)?u.offset=-a.width/2:u.offset=-a.height/2),s[c]=t.snapValue(s[c],u))}),s})}N_.$inject=["eventBus","gridSnapping","elementRegistry"];function Kk(e){return e==="x"}var Xk=1750;function B_(e,t,n){t.on(["create.start","shape.move.start"],Xk,function(i){var r=i.context,o=r.shape,a=e.getRootElement();if(!(!x(o,"bpmn:Participant")||!x(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}))}})}B_.$inject=["canvas","eventBus","gridSnapping"];var Zk=3e3;function hu(e,t,n){J.call(this,e),this._gridSnapping=t;var i=this;this.postExecuted(["connection.create","connection.layout"],Zk,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=tO(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 Jk(e){return e==="h"}function eO(e){return e==="v"}function tO(e,t,n){var i=Mi(t,n),r={};return Jk(i)&&(r.y=e.snapValue(t.y)),eO(i)&&(r.x=e.snapValue(t.x)),("x"in r||"y"in r)&&(t=H({},t,r),n=H({},n,r)),[t,n]}const nO={__depends__:[qk,{__init__:["gridSnappingAutoPlaceBehavior","gridSnappingParticipantBehavior","gridSnappingLayoutConnectionBehavior"],gridSnappingAutoPlaceBehavior:["type",N_],gridSnappingParticipantBehavior:["type",B_],gridSnappingLayoutConnectionBehavior:["type",hu]}],__init__:["bpmnGridSnapping"],bpmnGridSnapping:["type",O_]};var iO=30,$_=30;function Ua(e,t){this._interactionEvents=t;var n=this;e.on(["interactionEvents.createHit","interactionEvents.updateHit"],function(i){var r=i.element,o=i.gfx;if(x(r,"bpmn:Lane"))return n._createParticipantHit(r,o);if(x(r,"bpmn:Participant"))return Ue(r)?n._createParticipantHit(r,o):n._createDefaultHit(r,o);if(x(r,"bpmn:SubProcess"))return Ue(r)?n._createSubProcessHit(r,o):n._createDefaultHit(r,o)})}Ua.$inject=["eventBus","interactionEvents"],Ua.prototype._createDefaultHit=function(e,t){return this._interactionEvents.removeHits(t),this._interactionEvents.createDefaultHit(e,t),!0},Ua.prototype._createParticipantHit=function(e,t){this._interactionEvents.removeHits(t),this._interactionEvents.createBoxHit(t,"no-move",{width:e.width,height:e.height}),this._interactionEvents.createBoxHit(t,"click-stroke",{width:e.width,height:e.height});var n=qt(e)?{width:iO,height:e.height}:{width:e.width,height:$_};return this._interactionEvents.createBoxHit(t,"all",n),!0},Ua.prototype._createSubProcessHit=function(e,t){return this._interactionEvents.removeHits(t),this._interactionEvents.createBoxHit(t,"no-move",{width:e.width,height:e.height}),this._interactionEvents.createBoxHit(t,"click-stroke",{width:e.width,height:e.height}),this._interactionEvents.createBoxHit(t,"all",{width:e.width,height:$_}),!0};const rO={__init__:["bpmnInteractionEvents"],bpmnInteractionEvents:["type",Ua]};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 oO={__depends__:[ff],__init__:["keyboardBindings"],keyboardBindings:["type",mu]};var aO={moveSpeed:1,moveSpeedAccelerated:10},sO=1500,j_="left",F_="up",H_="right",z_="down",cO={ArrowLeft:j_,Left:j_,ArrowUp:F_,Up:F_,ArrowRight:H_,Right:H_,ArrowDown:z_,Down:z_},uO={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 G_(e,t,n,i,r){var o=this;this._config=H({},aO,e||{}),t.addListener(sO,function(a){var s=a.keyEvent,c=cO[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=uO[a](u),p=i.allowed("elements.move",{shapes:c,hints:{keyboardMove:!0}});p&&n.moveElements(c,l)}}}G_.$inject=["config.keyboardMoveSelection","keyboard","modeling","rules","selection"];const lO={__depends__:[ff,Vn],__init__:["keyboardMoveSelection"],keyboardMoveSelection:["type",G_]};var V_=10;function qa(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=aC(l,p,u),c.newBounds=cC(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=sm(p),!pO(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)})}qa.prototype.canResize=function(e){var t=this._rules,n=Qn(e,["newBounds","shape","delta","direction"]);return t.allowed("shape.resize",n)},qa.prototype.activate=function(e,t,n){var i=this._dragging,r,o;if(typeof n=="string"&&(n={direction:n}),r=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,W_(t,o),"resize",{autoActivate:!0,cursor:fO(o),data:{shape:t,context:r}})},qa.prototype.computeMinResizeBox=function(e){var t=e.shape,n=e.direction,i,r;return i=e.minDimensions||{width:V_,height:V_},r=Ym(t,e.childrenBoxPadding),uC(n,t,i,r)},qa.$inject=["eventBus","rules","modeling","dragging"];function pO(e,t){return e.x!==t.x||e.y!==t.y||e.width!==t.width||e.height!==t.height}function W_(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 fO(e){var t="resize-";return e==="n"||e==="s"?t+"ns":e==="e"||e==="w"?t+"ew":e==="nw"||e==="se"?t+"nwse":t+"nesw"}var U_="djs-resizing",q_="resize-not-ok",dO=500;function Y_(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,U_)),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(q_):qe(c).add(q_)}function r(o){var a=o.shape,s=o.frame;s&&$t(o.frame),t.removeMarker(a,U_)}e.on("resize.move",dO,function(o){i(o.context)}),e.on("resize.cleanup",function(o){r(o.context)})}Y_.$inject=["eventBus","canvas","previewSupport"];var gu=-6,yu=8,vu=20,Ya="djs-resizer",hO=["n","w","s","e","nw","ne","se","sw"];function _r(e,t,n,i){this._resize=i,this._canvas=t;var r=this;e.on("selection.changed",function(o){var a=o.newSelection;r.removeResizers(),a.length===1&&L(a,mn(r.addResizer,r))}),e.on("shape.changed",function(o){var a=o.element;n.isSelected(a)&&(r.removeResizers(),r.addResizer(a))})}_r.prototype.makeDraggable=function(e,t,n){var i=this._resize;function r(o){cr(o)&&i.activate(o,e,n)}Ne.bind(t,"mousedown",r),Ne.bind(t,"touchstart",r)},_r.prototype._createResizer=function(e,t,n,i){var r=this._getResizersParent(),o=mO(i),a=Ce("g");qe(a).add(Ya),qe(a).add(Ya+"-"+e.id),qe(a).add(Ya+"-"+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(Ya+"-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(Ya+"-hit"),Be(a,c),Os(a,t,n),a},_r.prototype.createResizer=function(e,t){var n=W_(e,t),i=this._createResizer(e,n.x,n.y,t);this.makeDraggable(e,i,t)},_r.prototype.addResizer=function(e){var t=this;st(e)||L(hO,function(n){t._resize.canResize({shape:e,direction:n})&&t.createResizer(e,n)})},_r.prototype.removeResizers=function(){var e=this._getResizersParent();Es(e)},_r.prototype._getResizersParent=function(){return this._canvas.getLayer("resizers")},_r.$inject=["eventBus","canvas","selection","resize"];function mO(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 K_={__depends__:[bi,Ni,Ao],__init__:["resize","resizePreview","resizeHandles"],resize:["type",qa],resizePreview:["type",Y_],resizeHandles:["type",_r]};var gO=2e3;function Ka(e,t,n,i,r,o,a){this._bpmnFactory=t,this._canvas=n,this._modeling=r,this._textRenderer=a,i.registerProvider(this),e.on("element.dblclick",function(c){s(c.element,!0)}),e.on(["autoPlace.start","canvas.viewbox.changing","drag.init","element.mousedown","popupMenu.open","root.set","selection.changed"],function(){i.isActive()&&i.complete()}),e.on(["shape.remove","connection.remove"],gO,function(c){i.isActive(c.element)&&i.cancel()}),e.on(["commandStack.changed"],function(c){i.isActive()&&i.cancel()}),e.on("directEditing.activate",function(c){o.removeResizers()}),e.on("create.end",500,function(c){var u=c.context,l=u.shape,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)}}Ka.$inject=["eventBus","bpmnFactory","canvas","directEditing","modeling","resizeHandles","textRenderer"],Ka.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"])||X_(e))&&H(r,{centerVertically:!0}),rr(e)&&(H(r,{resizable:!0,autoResize:!0}),H(o,{backgroundColor:"#ffffff",border:"1px solid #ccc"})),x(e,"bpmn:TextAnnotation")&&(H(r,{resizable:!0,autoResize:!0}),H(o,{backgroundColor:"#ffffff",border:"1px solid #ccc"})),H(n,{options:r,style:o}),n}},Ka.prototype.getEditingBBox=function(e){var t=this._canvas,n=e.label||e,i=t.getAbsoluteBBox(n),r={x:i.x+i.width/2,y:i.y+i.height/2},o={x:i.x,y:i.y},a=t.zoom(),s=this._textRenderer.getDefaultStyle(),c=this._textRenderer.getExternalStyle(),u=c.fontSize*a,l=c.lineHeight,p=s.fontSize*a,f=s.lineHeight,d={fontFamily:this._textRenderer.getDefaultStyle().fontFamily,fontWeight:this._textRenderer.getDefaultStyle().fontWeight};if(x(e,"bpmn:Lane")||bO(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(vO(e)){var m=qt(e),w=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,w),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"])||X_(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"})),yO(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,_=i.width+2*y;if(n.labelTarget&&(H(o,{width:_,height:i.height+2*y,x:i.x-y,y:i.y-y}),H(d,{fontSize:u+"px",lineHeight:l})),rr(n)&&!Is(n)&&!Fe(n)){var S=Rl(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 x(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}},Ka.prototype.update=function(e,t,n,i){var r,o;x(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}),_O(t)&&(t=null),this._modeling.updateLabel(e,t,r)};function X_(e){return x(e,"bpmn:SubProcess")&&!Ue(e)}function yO(e){return x(e,"bpmn:SubProcess")&&Ue(e)}function vO(e){return x(e,"bpmn:Participant")&&!Ue(e)}function bO(e){return x(e,"bpmn:Participant")&&Ue(e)}function _O(e){return!e||!e.trim()}var Z_="djs-element-hidden",Q_="djs-label-hidden";function J_(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,x(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:xO(o)}),Be(s,p),Be(r,s),en(s,o.x,o.y)}x(o,"bpmn:TextAnnotation")||o.labelTarget?t.addMarker(o,Z_):(x(o,"bpmn:Task")||x(o,"bpmn:CallActivity")||x(o,"bpmn:SubProcess")||x(o,"bpmn:Participant")||x(o,"bpmn:Lane"))&&t.addMarker(o,Q_)}),e.on("directEditing.resize",function(c){if(x(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,Z_),t.removeMarker(o,Q_)),o=void 0,a=void 0,s&&($t(s),s=void 0)})}J_.$inject=["eventBus","canvas","pathMap"];function xO(e,t){var n=Ye(e);return n.get("stroke")||t||"black"}const wO={__depends__:[Gp,K_,S_],__init__:["labelEditingProvider","labelEditingPreview"],labelEditingProvider:["type",Ka],labelEditingPreview:["type",J_]};var EO=500,SO=1e3;function wi(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){cS(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"],EO,function(o){var a=o.element,s=o.gfx,c=ot(".djs-outline",s);c&&i.updateOutline(a,c)})}wi.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},wi.prototype._createOutlineGfx=function(){var e=Ce("rect");return he(e,H({x:0,y:0,rx:4,width:100,height:100},this._outlineStyle)),e},wi.prototype.updateOutline=function(e,t){e.waypoints?this.updateConnectionOutline(t,e):this.updateShapeOutline(t,e)},wi.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})},wi.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})},wi.prototype.registerProvider=function(e,t){t||(t=e,e=SO),this._eventBus.on("outline.getProviders",e,function(n){n.providers.push(t)})},wi.prototype._getProviders=function(){var e=this._eventBus.createEvent({type:"outline.getProviders",providers:[]});return this._eventBus.fire(e),e.providers},wi.prototype.getOutline=function(e){var t,n=this._getProviders();return L(n,function(i){Wt(i.getOutline)&&(t=t||i.getOutline(e))}),t},wi.$inject=["eventBus","styles","elementRegistry"];var bu=6;function jf(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)})}jf.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=RO(Tt(e)),o=Ce("rect");he(o,H({rx:3},r)),qe(o).add("djs-selection-outline"),Be(t,o)}},jf.$inject=["eventBus","canvas","selection"];function RO(e){return{x:e.x-bu,y:e.y-bu,width:e.width+bu*2,height:e.height+bu*2}}const Ff={__depends__:[Vn],__init__:["outline","multiSelectionOutline"],outline:["type",wi],multiSelectionOutline:["type",jf]},ex=["bpmn:Event","bpmn:SequenceFlow","bpmn:Gateway"],tx={class:"bjs-label-link",stroke:"var(--element-selected-outline-secondary-stroke-color)",strokeDasharray:"5, 5"},CO=15,_u=2;function nx(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,ex));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 w;return(w=m.labels)==null?void 0:w.includes(g)});g&&h&&a(g,h)}}),e.on("shape.changed",function({element:p}){var f;!ze(p,ex)||!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=Qo([Oe(f),Oe(p)],tx),g=d.getAttribute("d"),m=r.isSelected(p)?c(p):u(p),w=na(m,g);if(!w)return;const _=r.isSelected(f)?c(f):u(f),S=na(_,g)||Oe(f);fa(S,w)<CO||(yl(d,[S,w]),Be(o,d))}function s(){ws(`.${tx.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+xr(f,"x")-_u,y:p.y+xr(f,"y")-_u,width:xr(f,"width")+_u*2,height:xr(f,"height")+_u*2};return Pl(d,xr(f,"rx"))}if(f.cx){const d=xr(f,"r"),g={x:p.x+xr(f,"cx")-d,y:p.y+xr(f,"cy")-d,width:d*2,height:d*2};return km(g)}}function u(p){return n.getShapePath(p)}function l(p){return r.isSelected(p)}}nx.$inject=["eventBus","canvas","graphicsFactory","outline","selection"];function xr(e,t){return parseFloat(he(e,t)||0)}const PO={__depends__:[Vn,Ff],__init__:["labelLink"],labelLink:["type",nx]};var AO=new Po("tt");function TO(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 MO(e,t,n){dn(e,{left:t+"px",top:n+"px"})}function Hf(e,t){e.style.display=t===!1?"none":""}var ix="djs-tooltip",zf="."+ix;function vn(e,t){this._eventBus=e,this._canvas=t,this._ids=AO,this._tooltipDefaults={show:{minZoom:.7,maxZoom:5}},this._tooltips={},this._tooltipRoot=TO(t.getContainer());var n=this;Cn.bind(this._tooltipRoot,zf,"mousedown",function(i){i.stopPropagation()}),Cn.bind(this._tooltipRoot,zf,"mouseover",function(i){n.trigger("mouseover",i)}),Cn.bind(this._tooltipRoot,zf,"mouseout",function(i){n.trigger("mouseout",i)}),this._init()}vn.$inject=["eventBus","canvas"],vn.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},vn.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)))},vn.prototype.get=function(e){return typeof e!="string"&&(e=e.id),this._tooltips[e]},vn.prototype.clearTimeout=function(e){if(e=this.get(e),!!e){var t=e.removeTimer;t&&(clearTimeout(t),e.removeTimer=null)}},vn.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)}},vn.prototype.remove=function(e){var t=this.get(e);t&&(di(t.html),di(t.htmlContainer),delete t.htmlContainer,delete this._tooltips[t.id])},vn.prototype.show=function(){Hf(this._tooltipRoot)},vn.prototype.hide=function(){Hf(this._tooltipRoot,!1)},vn.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},vn.prototype._addTooltip=function(e){var t=e.id,n=e.html,i,r=this._tooltipRoot;n.get&&n.constructor.prototype.jquery&&(n=n.get(0)),wn(n)&&(n=ft(n)),i=ft('<div data-tooltip-id="'+t+'" class="'+ix+'">'),dn(i,{position:"absolute"}),i.appendChild(n),e.type&&yt(i).add("djs-tooltip-"+e.type),e.className&&yt(i).add(e.className),e.htmlContainer=i,r.appendChild(i),this._tooltips[t]=e,this._updateTooltip(e)},vn.prototype._updateTooltip=function(e){var t=e.position,n=e.htmlContainer;MO(n,t.x,t.y)},vn.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),Hf(i,r))})},vn.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 kO={__init__:["tooltips"],tooltips:["type",vn]};var OO="flow elements must be children of pools/participants",DO="Data object must be placed within a pool/participant.";function rx(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;x(s,"bpmn:Collaboration")&&(x(a,"bpmn:FlowNode")?i(r,n(OO)):x(a,"bpmn:DataObjectReference")&&i(r,n(DO)))})}rx.$inject=["eventBus","tooltips","translate"];const LO={__depends__:[kO],__init__:["modelingFeedback"],modelingFeedback:["type",rx]};var IO=500,NO=1250,BO=1500,xu=Math.round;function $O(e){return{x:e.x+xu(e.width/2),y:e.y+xu(e.height/2)}}function ox(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",BO,function(s){var c=s.context,u=s.shape,l=i.get().slice();l.indexOf(u)===-1&&(l=[u]),l=jO(l),H(c,{shapes:l,validatedShapes:l,shape:u})}),e.on("shape.move.start",NO,function(s){var c=s.context,u=c.validatedShapes,l;if(l=c.canExecute=o(u),!l)return!1}),e.on("shape.move.move",IO,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(cr(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=$O(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}ox.$inject=["eventBus","dragging","modeling","selection","rules"];function jO(e){var t=eo(e,"id");return Ge(e,function(n){for(;n=n.parent;)if(t[n.id])return!1;return!0})}var ax=499,Gf="djs-dragging",sx="drop-ok",cx="drop-not-ok",ux="new-parent",lx="attach-ok";function px(e,t,n,i){function r(c){var u=o(c),l=FO(u);return l}function o(c){var u=Jo(c),l=u.flatMap(d=>(d.incoming||[]).concat(d.outgoing||[])),p=u.concat(l),f=[...new Set(p)];return f}function a(c,u){[lx,sx,cx,ux].forEach(function(l){l===u?t.addMarker(c,l):t.removeMarker(c,l)})}function s(c,u,l){i.addDragger(u,c.dragGroup),l&&t.addMarker(u,Gf),c.allDraggedElements?c.allDraggedElements.push(u):c.allDraggedElements=[u]}e.on("shape.move.start",ax,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,Gf)}),u.allDraggedElements=p,u.differentParents=HO(l)}),e.on("shape.move.move",ax,function(c){var u=c.context,l=u.dragGroup,p=u.target,f=u.shape.parent,d=u.canExecute;p&&(d==="attach"?a(p,lx):u.canExecute&&f&&p.id!==f.id?a(p,ux):a(p,u.canExecute?sx:cx)),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,Gf)}),p&&$t(p)}),this.makeDraggable=s}px.$inject=["eventBus","canvas","styles","previewSupport"];function FO(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 HO(e){return B0(eo(e,function(t){return t.parent&&t.parent.id}))!==1}const zO={__depends__:[fc,Vn,Ff,bi,Ni,Ao],__init__:["move","movePreview"],move:["type",ox],movePreview:["type",px]};var fx=".djs-palette-toggle",dx=".entry",GO=fx+", "+dx,Vf="djs-palette-",VO="shown",Wf="open",hx="two-column",WO=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=WO),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(qO,{})},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),yt(n).add(Vf+VO),Cn.bind(i,GO,"click",function(r){var o=r.delegateTarget;if(cl(o,fx))return e.toggle();e.trigger("click",r)}),Ne.bind(i,"mousedown",function(r){r.stopPropagation()}),Cn.bind(i,dx,"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=yt(n),a=yt(t);"twoColumn"in e?r=e.twoColumn:r=this._needsCollapse(t.clientHeight,this._entries||{}),o.toggle(hx,r),a.toggle(Vf+hx,r),"open"in e&&(o.toggle(Wf,e.open),a.toggle(Vf+Wf,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="+La(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&&UO(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=yt(i);r=r.replace("-tool",""),o.contains("entry")&&r===e?o.add("highlighted-entry"):o.remove("highlighted-entry")}})},Lt.prototype.isOpen=function(){return yt(this._container).has(Wf)},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 UO(e,t){var n=yt(e),i=ke(t)?t:t.split(/\s+/g);i.forEach(function(r){n.add(r)})}function qO(e,t){var n=t.getPaletteEntries();return Wt(n)?n(e):(L(n,function(i,r){e[r]=i}),e)}const YO={__init__:["palette"],palette:["type",Lt]};var mx="crosshair",gx="selected",KO="djs-dragging-active-lasso";function wr(e,t,n,i,r,o,a){this._selection=r,this._dragging=n,this._mouse=a;var s=this,c={create:function(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,gx);for(const m of g)h.has(m)||t.addMarker(m,gx)}},remove:function(p){this.update(p),p.frame&&$t(p.frame),u(!1)}};function u(p){qe(t.getContainer()).toggle(KO,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=yx(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=yx(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})}wr.$inject=["eventBus","canvas","dragging","elementRegistry","selection","toolManager","mouse"],wr.prototype.activateLasso=function(e,t){this._dragging.init(e,"lasso",{autoActivate:t,cursor:mx,data:{context:{}},keepSelection:!0})},wr.prototype.activateSelection=function(e,t){this._dragging.init(e,"lasso.selection",{trapClick:!1,autoActivate:t,cursor:mx,data:{context:{}},keepSelection:!0})},wr.prototype._select=function(e){this._selection.select(e)},wr.prototype.select=function(e,t,n=[]){var i=Jr(uo(e,t));this._select([...n,...i])},wr.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateSelection(e,!!e)},wr.prototype.isActive=function(){var e=this._dragging.context();return e&&/^lasso/.test(e.prefix)};function yx(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 XO={__depends__:[gc,va],__init__:["lassoTool"],lassoTool:["type",wr]};var Uf=1500,vx="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",Uf,function(c){if(ma(c))return a.activateMove(c.originalEvent,!0),!1}),s&&s.addListener(Uf,function(c){if(!(!bx(c.keyEvent)||a.isActive())){var u=a._mouse.getLastMoveEvent();a.activateMove(u,!!u)}},"keyboard.keydown"),s&&s.addListener(Uf,function(c){!bx(c.keyEvent)||!a.isActive()||a.toggle()},"keyboard.keyup"),e.on("hand.end",function(c){var u=c.originalEvent.target;if(!c.hover&&!(u instanceof SVGElement))return!1;e.once("hand.ended",function(){a.activateMove(c.originalEvent,{reactivate:!0})})}),e.on("hand.move.move",function(c){var u=t.viewbox().scale;t.scroll({dx:c.dx*u,dy:c.dy*u})}),e.on("hand.move.end",function(c){var u=c.context,l=u.reactivate;return!ma(c)&&l&&e.once("hand.move.ended",function(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:vx,data:{context:n||{}}})},jo.prototype.activateHand=function(e,t,n){this._dragging.init(e,"hand",{trapClick:!1,autoActivate:t,cursor:vx,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 bx(e){return jt("Space",e)}const ZO={__depends__:[gc,va],__init__:["handTool"],handTool:["type",jo]};var _x="connect-ok",xx="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?_x:xx))}),e.on(["global-connect.out","global-connect.cleanup"],function(c){var u=c.context.startTarget,l=c.context.canStartConnect;u&&i.removeMarker(u,l?_x:xx)}),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__:[If,bi,Ni,gc,va],globalConnect:["type",Fo]};function qf(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)}qf.$inject=["palette","create","elementFactory","spaceTool","lassoTool","handTool","globalConnect","translate"],qf.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(w){var y=n.createShape(H({type:p},h));t.start(w,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 JO={__depends__:[YO,hc,Ky,XO,ZO,QO,ca],__init__:["paletteProvider"],paletteProvider:["type",qf]};var eD=250;function Yf(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="'+La(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="'+La(l)+'"]',s.dragGroup);p&&he(p,{display:"inline"}),u.remove(),c[l]&&delete c[l]})}e.on("shape.move.move",eD,function(s){var c=s.context,u=c.canExecute;c.visualReplacements||(c.visualReplacements={}),u&&u.replacements?o(c):a(c)})}Yf.$inject=["eventBus","elementRegistry","elementFactory","canvas","previewSupport"],de(Yf,J);const tD={__depends__:[Ao],__init__:["bpmnReplacePreview"],bpmnReplacePreview:["type",Yf]};var nD=1250,Kf=40,iD=20,rD=10,wx=20,Ex=["x","y"],oD=Math.abs;function Sx(e){e.on(["connect.hover","connect.move","connect.end"],nD,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&&aD(t,o,lD(o)),o&&uD(i,["bpmn:Association","bpmn:DataInputAssociation","bpmn:DataOutputAssociation","bpmn:SequenceFlow"])?(n.connectionStart=qn(r),ze(o,["bpmn:Event","bpmn:Gateway"])&&Rx(t,qn(o)),ze(o,["bpmn:Task","bpmn:SubProcess"])&&sD(t,o),x(a,"bpmn:BoundaryEvent")&&s===a.host&&cD(t)):Cx(i,"bpmn:MessageFlow")?(x(r,"bpmn:Event")&&(n.connectionStart=qn(r)),x(o,"bpmn:Event")&&Rx(t,qn(o))):n.connectionStart=n.initialConnectionStart)})}Sx.$inject=["eventBus"];function aD(e,t,n){Ex.forEach(function(i){var r=Px(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 sD(e,t){var n=qn(t);Ex.forEach(function(i){pD(e,t,i)&&Dt(e,i,n[i])})}function cD(e){var t=e.context,n=t.source,i=t.target;if(!fD(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;oD(c-r[s])<Kf&&(c>r[s]?u=r[s]+Kf:u=r[s]-Kf,Dt(e,s,u))})}}function Rx(e,t){Dt(e,"x",t.x),Dt(e,"y",t.y)}function Cx(e,t){return e&&e.type===t}function uD(e,t){return Ui(t,function(n){return Cx(e,n)})}function Px(e,t){return e==="x"?t.width:t.height}function lD(e){return x(e,"bpmn:Task")?rD:iD}function pD(e,t,n){return e[n]>t[n]+wx&&e[n]<t[n]+Px(n,t)-wx}function fD(e){var t=e.hover,n=e.source;return t&&n&&t===n}function Er(){this._targets={},this._snapOrigins={},this._snapLocations=[],this._defaultSnaps={}}Er.prototype.getSnapOrigin=function(e){return this._snapOrigins[e]},Er.prototype.setSnapOrigin=function(e,t){this._snapOrigins[e]=t,this._snapLocations.indexOf(e)===-1&&this._snapLocations.push(e)},Er.prototype.addDefaultSnap=function(e,t){var n=this._defaultSnaps[e];n||(n=this._defaultSnaps[e]=[]),n.push(t)},Er.prototype.getSnapLocations=function(){return this._snapLocations},Er.prototype.setSnapLocations=function(e){this._snapLocations=e},Er.prototype.pointsForTarget=function(e){var t=e.id||e,n=this._targets[t];return n||(n=this._targets[t]=new 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&&ek(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 dD=1250;function Ei(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"],dD,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()})}Ei.$inject=["elementRegistry","eventBus","snapping"],Ei.prototype.initSnap=function(e){var t=this._elementRegistry,n=e.context,i=n.shape,r=n.snapContext;r||(r=n.snapContext=new Er);var o;t.get(i.id)?o=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},Ei.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},Ei.prototype.getSnapTargets=function(e,t){return d_(t).filter(function(n){return!hD(n)})};function hD(e){return!!e.hidden}var Ax=1500;function Ho(e,t){t.invoke(Ei,this),e.on(["create.move","create.end"],Ax,vD),e.on(["create.move","create.end","shape.move.move","shape.move.end"],Ax,function(n){var i=n.context,r=i.canExecute,o=i.target,a=r&&(r==="attach"||r.attach);a&&!$o(n)&&mD(n,o)})}de(Ho,Ei),Ho.$inject=["eventBus","injector"],Ho.prototype.initSnap=function(e){var t=Ei.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",Mx(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",Mx(o,i,e))}),x(n,"bpmn:Participant")&&t.setSnapLocations(["top-left","bottom-right","mid"]),t},Ho.prototype.addSnapTargetPoints=function(e,t,n){Ei.prototype.addSnapTargetPoints.call(this,e,t,n);var i=this.getSnapTargets(t,n);L(i,function(o){(yD(o)||gD([t,o],"bpmn:TextAnnotation"))&&(e.add("top-left",p_(o)),e.add("bottom-right",f_(o)))});var r=this._elementRegistry;return L(t.incoming,function(o){if(r.get(t.id)){Tx(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)){Tx(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)}}),x(n,"bpmn:SequenceFlow")&&(e=this.addSnapTargetPoints(e,t,n.parent)),e},Ho.prototype.getSnapTargets=function(e,t){return Ei.prototype.getSnapTargets.call(this,e,t).filter(function(n){return!x(n,"bpmn:Lane")})};function mD(e,t){var n=Pe(t),i=Wg(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 gD(e,t){return e.every(function(n){return x(n,t)})}function yD(e){return x(e,"bpmn:SubProcess")&&Ue(e)?!0:x(e,"bpmn:Participant")}function vD(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 Tx(e,t){return e.indexOf(t)!==-1}function Mx(e,t,n){return t?{x:e.x-n.x,y:e.y-n.y}:{x:e.x,y:e.y}}var bD=1250;function Xa(e,t){var n=this;e.on(["resize.start"],function(i){n.initSnap(i)}),e.on(["resize.move","resize.end"],bD,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),wD(s)&&Dt(i,"x",i.x),ED(s)&&Dt(i,"y",i.y),t.snap(i,u)}}),e.on(["resize.cleanup"],function(){t.hide()})}Xa.prototype.initSnap=function(e){var t=e.context,n=t.shape,i=t.direction,r=t.snapContext;r||(r=t.snapContext=new Er);var o=kx(n,i);return r.setSnapOrigin("corner",{x:o.x-e.x,y:o.y-e.y}),r},Xa.prototype.addSnapTargetPoints=function(e,t,n,i){var r=this.getSnapTargets(t,n);return L(r,function(o){e.add("corner",f_(o)),e.add("corner",p_(o))}),e.add("corner",kx(t,i)),e},Xa.$inject=["eventBus","snapping"],Xa.prototype.getSnapTargets=function(e,t){return d_(t).filter(function(n){return!_D(n,e)&&!st(n)&&!xD(n)&&!Fe(n)})};function kx(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 _D(e,t){return e.host===t}function xD(e){return!!e.hidden}function wD(e){return e==="n"||e==="s"}function ED(e){return e==="e"||e==="w"}var SD=7,RD=1e3;function Sr(e){this._canvas=e,this._asyncHide=Du(mn(this.hide,this),RD)}Sr.$inject=["canvas"],Sr.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,SD),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)})},Sr.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"})}}},Sr.prototype._createSnapLines=function(){this._snapLines={horizontal:this._createLine("horizontal"),vertical:this._createLine("vertical")}},Sr.prototype.showSnapLine=function(e,t){var n=this.getSnapLine(e);n&&n.update(t),this._asyncHide()},Sr.prototype.getSnapLine=function(e){return this._snapLines||this._createSnapLines(),this._snapLines[e]},Sr.prototype.hide=function(){L(this._snapLines,function(e){e.update()})};const CD={__depends__:[{__init__:["createMoveSnapping","resizeSnapping","snapping"],createMoveSnapping:["type",Ei],resizeSnapping:["type",Xa],snapping:["type",Sr]}],__init__:["connectSnapping","createMoveSnapping"],connectSnapping:["type",Sx],createMoveSnapping:["type",Ho]};var Ox=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&&Dx(n,e.primaryTokens,$e.RESULT_PRIMARY_HTML),Dx(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,yt(this._canvas.getContainer()).add("djs-search-open"),yt(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,yt(this._canvas.getContainer()).remove("djs-search-open"),yt(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&&yt(t).remove($e.RESULT_SELECTED_CLASS);var n=sn(e,$e.RESULT_ID_ATTRIBUTE),i=this._results[n].element;yt(e).add($e.RESULT_SELECTED_CLASS),this._canvas.scrollToElement(i,{top:Ox}),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:Ox}),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 Dx(e,t,n){var i=PD(t),r=ft(n);r.innerHTML=i,e.appendChild(r)}function PD(e){var t="";return e.forEach(function(n){var i=Hv(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">
335
+ </svg>`},zk=900;function Wa(e,t,n,i){this._distributeElements=t,this._translate=n,this._popupMenu=e,this._rules=i,e.registerProvider("align-elements",zk,this)}Wa.$inject=["popupMenu","distributeElements","translate","rules"],Wa.prototype.getPopupMenuEntries=function(e){var t={};return this._isAllowed(e)&&z(t,this._getEntries(e)),t},Wa.prototype._isAllowed=function(e){return this._rules.allowed("elements.distribute",{elements:e})},Wa.prototype._getEntries=function(e){var t=this._distributeElements,n=this._translate,i=this._popupMenu,r={"distribute-elements-horizontal":{group:"distribute",title:n("Distribute elements horizontally"),className:"bjs-align-elements-menu-entry",imageHtml:D_.horizontal,action:function(o,a){t.trigger(e,"horizontal"),i.close()}},"distribute-elements-vertical":{group:"distribute",title:n("Distribute elements vertically"),imageHtml:D_.vertical,action:function(o,a){t.trigger(e,"vertical"),i.close()}}};return r};const Gk={__depends__:[Tf,Hk],__init__:["bpmnDistributeElements","distributeElementsMenuProvider"],bpmnDistributeElements:["type",pu],distributeElementsMenuProvider:["type",Wa]};var L_="is not a registered action",Vk="is already registered";function ei(e,t){this._eventBus=e,this._actions={};var n=this;e.on("diagram.init",function(){n._registerDefaultActions(t),e.fire("editorActions.init",{editorActions:n})})}ei.$inject=["eventBus","injector"],ei.prototype._registerDefaultActions=function(e){var t=e.get("commandStack",!1),n=e.get("modeling",!1),i=e.get("selection",!1),r=e.get("zoomScroll",!1),o=e.get("copyPaste",!1),a=e.get("canvas",!1),s=e.get("rules",!1),c=e.get("keyboardMove",!1),u=e.get("keyboardMoveSelection",!1);t&&(this.register("undo",function(){t.undo()}),this.register("redo",function(){t.redo()})),o&&i&&this.register("copy",function(){var l=i.get();if(l.length)return o.copy(l)}),o&&i&&this.register("duplicate",function(){var l=i.get();if(l.length)return o.duplicate(l)}),o&&this.register("paste",function(){o.paste()}),o&&i&&s&&this.register("cut",function(){var l=i.get();if(l.length){var f=s.allowed("elements.delete",{elements:l});if(f!==!1){var p=ke(f)?f:l;return o.cut(p.slice())}}}),r&&this.register("stepZoom",function(l){r.stepZoom(l.value)}),a&&this.register("zoom",function(l){a.zoom(l.value)}),n&&i&&s&&this.register("removeSelection",function(){var l=i.get();if(l.length){var f=s.allowed("elements.delete",{elements:l}),p;f!==!1&&(ke(f)?p=f:p=l,p.length&&n.removeElements(p.slice()))}}),c&&this.register("moveCanvas",function(l){c.moveCanvas(l)}),u&&this.register("moveSelection",function(l){u.moveSelection(l.direction,l.accelerated)})},ei.prototype.trigger=function(e,t){if(!this._actions[e])throw Ff(e,L_);var n=this._eventBus.fire("editorActions.allowed",{action:e,opts:t});if(n!==!1)return this._actions[e](t)},ei.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)})},ei.prototype._registerAction=function(e,t){if(this.isRegistered(e))throw Ff(e,Vk);this._actions[e]=t},ei.prototype.unregister=function(e){if(!this.isRegistered(e))throw Ff(e,L_);this._actions[e]=void 0},ei.prototype.getActions=function(){return Object.keys(this._actions)},ei.prototype.isRegistered=function(e){return!!this._actions[e]};function Ff(e,t){return new Error(e+" "+t)}const Wk={__init__:["editorActions"],editorActions:["type",ei]};function fu(e){e.invoke(ei,this)}de(fu,ei),fu.$inject=["injector"],fu.prototype._registerDefaultActions=function(e){ei.prototype._registerDefaultActions.call(this,e);var t=e.get("canvas",!1),n=e.get("elementRegistry",!1),i=e.get("selection",!1),r=e.get("spaceTool",!1),o=e.get("lassoTool",!1),a=e.get("handTool",!1),s=e.get("globalConnect",!1),c=e.get("distributeElements",!1),u=e.get("alignElements",!1),l=e.get("directEditing",!1),f=e.get("searchPad",!1),p=e.get("modeling",!1),d=e.get("contextPad",!1);t&&n&&i&&this._registerAction("selectElements",function(){var 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=[],_=g.type;h.length&&(m=Ge(h,function(y){return!w(y,"bpmn:Lane")}),u.trigger(m,_))}),i&&p&&this._registerAction("setColor",function(g){var h=i.get();h.length&&p.setColor(h,g)}),i&&l&&this._registerAction("directEditing",function(){var g=i.get();g.length&&l.activate(g[0])}),f&&this._registerAction("find",function(){f.toggle()}),t&&p&&this._registerAction("moveToOrigin",function(){var g=t.getRootElement(),h,m;w(g,"bpmn:Collaboration")?m=n.filter(function(_){return w(_.parent,"bpmn:Collaboration")}):m=n.filter(function(_){return _!==g&&!w(_.parent,"bpmn:SubProcess")}),h=Tt(m),p.moveElements(m,{x:-h.x,y:-h.y},g)}),i&&d&&this._registerAction("replaceElement",function(g){d.triggerEntry("replace","click",g)})};const Uk={__depends__:[Wk],editorActions:["type",fu]};function I_(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")})}I_.$inject=["eventBus"];function Wr(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;wn(a)?r.newBounds=n.snapComplex(c,a):r.newBounds=n.snapSimple(s,c)}})}Wr.$inject=["eventBus","gridSnapping","modeling"],de(Wr,J),Wr.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},Wr.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},Wr.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),z(e,o),e},Wr.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),z(e,o),e};var qk=2e3;function B_(e,t){e.on(["spaceTool.move","spaceTool.end"],qk,function(n){var i=n.context;if(i.initialized){var r=i.axis,o;r==="x"?(o=t.snapValue(n.dx),n.x=n.x+o-n.dx,n.dx=o):(o=t.snapValue(n.dy),n.y=n.y+o-n.dy,n.dy=o)}})}B_.$inject=["eventBus","gridSnapping"];const Yk={__init__:["gridSnappingResizeBehavior","gridSnappingSpaceToolBehavior"],gridSnappingResizeBehavior:["type",Wr],gridSnappingSpaceToolBehavior:["type",B_]};var du=10;function jf(e,t,n){return n||(n="round"),Math[n](e/t)*t}var Kk=1200,Xk=800;function vr(e,t,n){var i=!n||n.active!==!1;this._eventBus=t;var r=this;t.on("diagram.init",Xk,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"],Kk,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={},f=Qk(o,u,e);f&&(l.offset=f);var p=Zk(o,u);p&&z(l,p),$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 du},vr.prototype.snapValue=function(e,t){var n=0;t&&t.offset&&(n=t.offset),e+=n,e=jf(e,du);var i,r;return t&&t.min&&(i=t.min,Le(i)&&(i=jf(i+n,du,"ceil"),e=Math.max(e,i))),t&&t.max&&(r=t.max,Le(r)&&(r=jf(r+n,du,"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 Zk(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&&(hu(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&&(hu(t)?$_(s)?a.x.max=c.left:a.x.min=c.right:N_(s)?a.y.max=c.top:a.y.min=c.bottom),u&&(hu(t)?$_(s)?a.x.min=u.left:a.x.max=u.right:N_(s)?a.y.min=u.top:a.y.max=u.bottom),a[t]}function Qk(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)||(hu(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 hu(e){return e==="x"}function N_(e){return e.indexOf("n")!==-1}function $_(e){return e.indexOf("w")!==-1}const Jk={__depends__:[Yk],__init__:["gridSnapping"],gridSnapping:["type",vr]};var eO=2e3;function F_(e,t,n){e.on("autoPlace",eO,function(i){var r=i.source,o=Oe(r),a=i.shape,s=$v(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],w(a,"bpmn:TextAnnotation")&&(tO(c)?u.offset=-a.width/2:u.offset=-a.height/2),s[c]=t.snapValue(s[c],u))}),s})}F_.$inject=["eventBus","gridSnapping","elementRegistry"];function tO(e){return e==="x"}var nO=1750;function j_(e,t,n){t.on(["create.start","shape.move.start"],nO,function(i){var r=i.context,o=r.shape,a=e.getRootElement();if(!(!w(o,"bpmn:Participant")||!w(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}))}})}j_.$inject=["canvas","eventBus","gridSnapping"];var iO=3e3;function mu(e,t,n){J.call(this,e),this._gridSnapping=t;var i=this;this.postExecuted(["connection.create","connection.layout"],iO,function(r){var o=r.context,a=o.connection,s=o.hints||{},c=a.waypoints;s.connectionStart||s.connectionEnd||s.createElementsBehavior===!1||rO(c)&&n.updateWaypoints(a,i.snapMiddleSegments(c))})}mu.$inject=["eventBus","gridSnapping","modeling"],de(mu,J),mu.prototype.snapMiddleSegments=function(e){var t=this._gridSnapping,n;e=e.slice();for(var i=1;i<e.length-2;i++)n=sO(t,e[i],e[i+1]),e[i]=n[0],e[i+1]=n[1];return e};function rO(e){return e.length>3}function oO(e){return e==="h"}function aO(e){return e==="v"}function sO(e,t,n){var i=Mi(t,n),r={};return oO(i)&&(r.y=e.snapValue(t.y)),aO(i)&&(r.x=e.snapValue(t.x)),("x"in r||"y"in r)&&(t=z({},t,r),n=z({},n,r)),[t,n]}const cO={__depends__:[Jk,{__init__:["gridSnappingAutoPlaceBehavior","gridSnappingParticipantBehavior","gridSnappingLayoutConnectionBehavior"],gridSnappingAutoPlaceBehavior:["type",F_],gridSnappingParticipantBehavior:["type",j_],gridSnappingLayoutConnectionBehavior:["type",mu]}],__init__:["bpmnGridSnapping"],bpmnGridSnapping:["type",I_]};var uO=30,H_=30;function Ua(e,t){this._interactionEvents=t;var n=this;e.on(["interactionEvents.createHit","interactionEvents.updateHit"],function(i){var r=i.element,o=i.gfx;if(w(r,"bpmn:Lane"))return n._createParticipantHit(r,o);if(w(r,"bpmn:Participant"))return We(r)?n._createParticipantHit(r,o):n._createDefaultHit(r,o);if(w(r,"bpmn:SubProcess"))return We(r)?n._createSubProcessHit(r,o):n._createDefaultHit(r,o)})}Ua.$inject=["eventBus","interactionEvents"],Ua.prototype._createDefaultHit=function(e,t){return this._interactionEvents.removeHits(t),this._interactionEvents.createDefaultHit(e,t),!0},Ua.prototype._createParticipantHit=function(e,t){this._interactionEvents.removeHits(t),this._interactionEvents.createBoxHit(t,"no-move",{width:e.width,height:e.height}),this._interactionEvents.createBoxHit(t,"click-stroke",{width:e.width,height:e.height});var n=qt(e)?{width:uO,height:e.height}:{width:e.width,height:H_};return this._interactionEvents.createBoxHit(t,"all",n),!0},Ua.prototype._createSubProcessHit=function(e,t){return this._interactionEvents.removeHits(t),this._interactionEvents.createBoxHit(t,"no-move",{width:e.width,height:e.height}),this._interactionEvents.createBoxHit(t,"click-stroke",{width:e.width,height:e.height}),this._interactionEvents.createBoxHit(t,"all",{width:e.width,height:H_}),!0};const lO={__init__:["bpmnInteractionEvents"],bpmnInteractionEvents:["type",Ua]};function gu(e){e.invoke(ko,this)}de(gu,ko),gu.$inject=["injector"],gu.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 pO={__depends__:[hf],__init__:["keyboardBindings"],keyboardBindings:["type",gu]};var fO={moveSpeed:1,moveSpeedAccelerated:10},dO=1500,z_="left",G_="up",V_="right",W_="down",hO={ArrowLeft:z_,Left:z_,ArrowUp:G_,Up:G_,ArrowRight:V_,Right:V_,ArrowDown:W_,Down:W_},mO={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 U_(e,t,n,i,r){var o=this;this._config=z({},fO,e||{}),t.addListener(dO,function(a){var s=a.keyEvent,c=hO[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=mO[a](u),f=i.allowed("elements.move",{shapes:c,hints:{keyboardMove:!0}});f&&n.moveElements(c,l)}}}U_.$inject=["config.keyboardMoveSelection","keyboard","modeling","rules","selection"];const gO={__depends__:[hf,Kn],__init__:["keyboardMoveSelection"],keyboardMoveSelection:["type",U_]};var q_=10;function qa(e,t,n,i){this._dragging=i,this._rules=t;var r=this;function o(c,u){var l=c.shape,f=c.direction,p=c.resizeConstraints,d;c.delta=u,d=fC(l,f,u),c.newBounds=hC(d,p),c.canExecute=r.canResize(c)}function a(c){var u=c.resizeConstraints,l=c.minBounds;u===void 0&&(l===void 0&&(l=r.computeMinResizeBox(c)),c.resizeConstraints={min:Pe(l)})}function s(c){var u=c.shape,l=c.canExecute,f=c.newBounds;if(l){if(f=lm(f),!yO(u,f))return;n.resizeShape(u,f)}}e.on("resize.start",function(c){a(c.context)}),e.on("resize.move",function(c){var u={x:c.dx,y:c.dy};o(c.context,u)}),e.on("resize.end",function(c){s(c.context)})}qa.prototype.canResize=function(e){var t=this._rules,n=ni(e,["newBounds","shape","delta","direction"]);return t.allowed("shape.resize",n)},qa.prototype.activate=function(e,t,n){var i=this._dragging,r,o;if(typeof n=="string"&&(n={direction:n}),r=z({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,Y_(t,o),"resize",{autoActivate:!0,cursor:vO(o),data:{shape:t,context:r}})},qa.prototype.computeMinResizeBox=function(e){var t=e.shape,n=e.direction,i,r;return i=e.minDimensions||{width:q_,height:q_},r=Zm(t,e.childrenBoxPadding),mC(n,t,i,r)},qa.$inject=["eventBus","rules","modeling","dragging"];function yO(e,t){return e.x!==t.x||e.y!==t.y||e.width!==t.width||e.height!==t.height}function Y_(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 vO(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 K_="djs-resizing",X_="resize-not-ok",bO=500;function Z_(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,K_)),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(X_):qe(c).add(X_)}function r(o){var a=o.shape,s=o.frame;s&&jt(o.frame),t.removeMarker(a,K_)}e.on("resize.move",bO,function(o){i(o.context)}),e.on("resize.cleanup",function(o){r(o.context)})}Z_.$inject=["eventBus","canvas","previewSupport"];var yu=-6,vu=8,bu=20,Ya="djs-resizer",_O=["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,gn(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)}Be.bind(t,"mousedown",r),Be.bind(t,"touchstart",r)},br.prototype._createResizer=function(e,t,n,i){var r=this._getResizersParent(),o=xO(i),a=Ce("g");qe(a).add(Ya),qe(a).add(Ya+"-"+e.id),qe(a).add(Ya+"-"+i),Ne(r,a);var s=Ce("rect");he(s,{x:-vu/2+o.x,y:-vu/2+o.y,width:vu,height:vu}),qe(s).add(Ya+"-visual"),Ne(a,s);var c=Ce("rect");return he(c,{x:-bu/2+o.x,y:-bu/2+o.y,width:bu,height:bu}),qe(c).add(Ya+"-hit"),Ne(a,c),Ds(a,t,n),a},br.prototype.createResizer=function(e,t){var n=Y_(e,t),i=this._createResizer(e,n.x,n.y,t);this.makeDraggable(e,i,t)},br.prototype.addResizer=function(e){var t=this;at(e)||L(_O,function(n){t._resize.canResize({shape:e,direction:n})&&t.createResizer(e,n)})},br.prototype.removeResizers=function(){var e=this._getResizersParent();Ss(e)},br.prototype._getResizersParent=function(){return this._canvas.getLayer("resizers")},br.$inject=["eventBus","canvas","selection","resize"];function xO(e){var t={x:0,y:0};return e.indexOf("e")!==-1?t.x=-yu:e.indexOf("w")!==-1&&(t.x=yu),e.indexOf("s")!==-1?t.y=-yu:e.indexOf("n")!==-1&&(t.y=yu),t}const Q_={__depends__:[bi,Bi,Ao],__init__:["resize","resizePreview","resizeHandles"],resize:["type",qa],resizePreview:["type",Z_],resizeHandles:["type",br]};var wO=2e3;function Ka(e,t,n,i,r,o,a){this._bpmnFactory=t,this._canvas=n,this._modeling=r,this._textRenderer=a,i.registerProvider(this),e.on("element.dblclick",function(c){s(c.element,!0)}),e.on(["autoPlace.start","canvas.viewbox.changing","drag.init","element.mousedown","popupMenu.open","root.set","selection.changed"],function(){i.isActive()&&i.complete()}),e.on(["shape.remove","connection.remove"],wO,function(c){i.isActive(c.element)&&i.cancel()}),e.on(["commandStack.changed"],function(c){i.isActive()&&i.cancel()}),e.on("directEditing.activate",function(c){o.removeResizers()}),e.on("create.end",500,function(c){var u=c.context,l=u.shape,f=c.context.canExecute,p=c.isTouch;p||f&&(u.hints&&u.hints.createElementsBehavior===!1||s(l))}),e.on("autoPlace.end",500,function(c){s(c.shape)});function s(c,u){(u||ze(c,["bpmn:Activity","bpmn:Event","bpmn:TextAnnotation","bpmn:Participant"]))&&i.activate(c)}}Ka.$inject=["eventBus","bpmnFactory","canvas","directEditing","modeling","resizeHandles","textRenderer"],Ka.prototype.activate=function(e){var t=Fn(e);if(t!==void 0){var n={text:t},i=this.getEditingBBox(e);z(n,i);var r={},o=n.style||{};return z(o,{backgroundColor:null,border:null}),(ze(e,["bpmn:Task","bpmn:Participant","bpmn:Lane","bpmn:CallActivity"])||J_(e))&&z(r,{centerVertically:!0}),ir(e)&&(z(r,{resizable:!0,autoResize:!0}),z(o,{backgroundColor:"#ffffff",border:"1px solid #ccc"})),w(e,"bpmn:TextAnnotation")&&(z(r,{resizable:!0,autoResize:!0}),z(o,{backgroundColor:"#ffffff",border:"1px solid #ccc"})),z(n,{options:r,style:o}),n}},Ka.prototype.getEditingBBox=function(e){var t=this._canvas,n=e.label||e,i=t.getAbsoluteBBox(n),r={x:i.x+i.width/2,y:i.y+i.height/2},o={x:i.x,y:i.y},a=t.zoom(),s=this._textRenderer.getDefaultStyle(),c=this._textRenderer.getExternalStyle(),u=c.fontSize*a,l=c.lineHeight,f=s.fontSize*a,p=s.lineHeight,d={fontFamily:this._textRenderer.getDefaultStyle().fontFamily,fontWeight:this._textRenderer.getDefaultStyle().fontWeight};if(w(e,"bpmn:Lane")||RO(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};z(o,h),z(d,{fontSize:f+"px",lineHeight:p,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px",transform:g?"rotate(-90deg)":null})}if(SO(e)){var m=qt(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};z(o,_),z(d,{fontSize:f+"px",lineHeight:p,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"])||J_(e))&&(z(o,{width:i.width,height:i.height}),z(d,{fontSize:f+"px",lineHeight:p,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px"})),EO(e)&&(z(o,{width:i.width,x:i.x}),z(d,{fontSize:f+"px",lineHeight:p,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&&(z(o,{width:x,height:i.height+2*y,x:i.x-y,y:i.y-y}),z(d,{fontSize:u+"px",lineHeight:l})),ir(n)&&!Bs(n)&&!je(n)){var S=Pl(e),P=t.getAbsoluteBBox({x:S.x,y:S.y,width:0,height:0}),C=u,D=Dr.width*a+2*y;z(o,{width:D,height:C+2*y,x:P.x-D/2,y:P.y-C/2-y}),z(d,{fontSize:u+"px",lineHeight:l})}return w(e,"bpmn:TextAnnotation")&&(z(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}),z(d,{textAlign:"left",paddingTop:mo*a+"px",paddingBottom:mo*a+"px",paddingLeft:mo*a+"px",paddingRight:mo*a+"px",fontSize:f+"px",lineHeight:p})),{bounds:o,style:d}},Ka.prototype.update=function(e,t,n,i){var r,o;w(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}),CO(t)&&(t=null),this._modeling.updateLabel(e,t,r)};function J_(e){return w(e,"bpmn:SubProcess")&&!We(e)}function EO(e){return w(e,"bpmn:SubProcess")&&We(e)}function SO(e){return w(e,"bpmn:Participant")&&!We(e)}function RO(e){return w(e,"bpmn:Participant")&&We(e)}function CO(e){return!e||!e.trim()}var ex="djs-element-hidden",tx="djs-label-hidden";function nx(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,w(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}}),f=i.path=Ce("path");he(f,{d:l,strokeWidth:2,stroke:PO(o)}),Ne(s,f),Ne(r,s),en(s,o.x,o.y)}w(o,"bpmn:TextAnnotation")||o.labelTarget?t.addMarker(o,ex):(w(o,"bpmn:Task")||w(o,"bpmn:CallActivity")||w(o,"bpmn:SubProcess")||w(o,"bpmn:Participant")||w(o,"bpmn:Lane"))&&t.addMarker(o,tx)}),e.on("directEditing.resize",function(c){if(w(o,"bpmn:TextAnnotation")){var u=c.height,l=c.dy,f=Math.max(o.height/a.height*(u+l),0),p=n.getScaledPath("TEXT_ANNOTATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:o.width,containerHeight:f,position:{mx:0,my:0}});he(i.path,{d:p})}}),e.on(["directEditing.complete","directEditing.cancel"],function(c){var u=c.active;u&&(t.removeMarker(u.element.label||u.element,ex),t.removeMarker(o,tx)),o=void 0,a=void 0,s&&(jt(s),s=void 0)})}nx.$inject=["eventBus","canvas","pathMap"];function PO(e,t){var n=Ye(e);return n.get("stroke")||t||"black"}const AO={__depends__:[Wp,Q_,P_],__init__:["labelEditingProvider","labelEditingPreview"],labelEditingProvider:["type",Ka],labelEditingPreview:["type",nx]};var TO=500,MO=1e3;function wi(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){hS(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"],TO,function(o){var a=o.element,s=o.gfx,c=rt(".djs-outline",s);c&&i.updateOutline(a,c)})}wi.prototype.createOutline=function(e){var t=this._elementRegistry.getGraphics(e);if(!t)throw new Error("cannot create outline for non-rendered element");var n=rt(".djs-outline",t);return n||(n=this.getOutline(e)||this._createOutlineGfx(),Ne(t,n),this.updateOutline(e,n)),n},wi.prototype._createOutlineGfx=function(){var e=Ce("rect");return he(e,z({x:0,y:0,rx:4,width:100,height:100},this._outlineStyle)),e},wi.prototype.updateOutline=function(e,t){e.waypoints?this.updateConnectionOutline(t,e):this.updateShapeOutline(t,e)},wi.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})},wi.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})},wi.prototype.registerProvider=function(e,t){t||(t=e,e=MO),this._eventBus.on("outline.getProviders",e,function(n){n.providers.push(t)})},wi.prototype._getProviders=function(){var e=this._eventBus.createEvent({type:"outline.getProviders",providers:[]});return this._eventBus.fire(e),e.providers},wi.prototype.getOutline=function(e){var t,n=this._getProviders();return L(n,function(i){Wt(i.getOutline)&&(t=t||i.getOutline(e))}),t},wi.$inject=["eventBus","styles","elementRegistry"];var _u=6;function Hf(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)})}Hf.prototype._updateMultiSelectionOutline=function(e){var t=this._canvas.getLayer("selectionOutline");Ss(t);var n=e.length>1,i=this._canvas.getContainer();if(qe(i)[n?"add":"remove"]("djs-multi-select"),!!n){var r=kO(Tt(e)),o=Ce("rect");he(o,z({rx:3},r)),qe(o).add("djs-selection-outline"),Ne(t,o)}},Hf.$inject=["eventBus","canvas","selection"];function kO(e){return{x:e.x-_u,y:e.y-_u,width:e.width+_u*2,height:e.height+_u*2}}const zf={__depends__:[Kn],__init__:["outline","multiSelectionOutline"],outline:["type",wi],multiSelectionOutline:["type",Hf]},ix=["bpmn:Event","bpmn:SequenceFlow","bpmn:Gateway"],rx={class:"bjs-label-link",stroke:"var(--element-selected-outline-secondary-stroke-color)",strokeDasharray:"5, 5"},OO=15,xu=2;function ox(e,t,n,i,r){const o=t.getLayer("overlays");e.on(["selection.changed","shape.changed"],function(){s()}),e.on("selection.changed",function({newSelection:f}){var d;const p=f.filter(g=>ze(g,ix));if(p.length===1){const g=p[0];je(g)?a(g,g.labelTarget):(d=g.labels)!=null&&d.length&&a(g.labels[0],g)}if(p.length===2){const g=p.find(je),h=p.find(m=>{var _;return(_=m.labels)==null?void 0:_.includes(g)});g&&h&&a(g,h)}}),e.on("shape.changed",function({element:f}){var p;!ze(f,ix)||!l(f)||(je(f)?a(f,f.labelTarget):(p=f.labels)!=null&&p.length&&a(f.labels[0],f))});function a(f,p){const d=Qo([Oe(p),Oe(f)],rx),g=d.getAttribute("d"),m=r.isSelected(f)?c(f):u(f),_=na(m,g);if(!_)return;const x=r.isSelected(p)?c(p):u(p),S=na(x,g)||Oe(p);fa(S,_)<OO||(bl(d,[S,_]),Ne(o,d))}function s(){Es(`.${rx.class}`,o).forEach(jt)}function c(f){const p=i.getOutline(f);if(!p)return u(f);if(p.x){const d={x:f.x+_r(p,"x")-xu,y:f.y+_r(p,"y")-xu,width:_r(p,"width")+xu*2,height:_r(p,"height")+xu*2};return Tl(d,_r(p,"rx"))}if(p.cx){const d=_r(p,"r"),g={x:f.x+_r(p,"cx")-d,y:f.y+_r(p,"cy")-d,width:d*2,height:d*2};return Lm(g)}}function u(f){return n.getShapePath(f)}function l(f){return r.isSelected(f)}}ox.$inject=["eventBus","canvas","graphicsFactory","outline","selection"];function _r(e,t){return parseFloat(he(e,t)||0)}const DO={__depends__:[Kn,zf],__init__:["labelLink"],labelLink:["type",ox]};var LO=new Po("tt");function IO(e){var t=dt('<div class="djs-tooltip-container" />');return dn(t,{position:"absolute",width:"0",height:"0"}),e.insertBefore(t,e.firstChild),t}function BO(e,t,n){dn(e,{left:t+"px",top:n+"px"})}function Gf(e,t){e.style.display=t===!1?"none":""}var ax="djs-tooltip",Vf="."+ax;function vn(e,t){this._eventBus=e,this._canvas=t,this._ids=LO,this._tooltipDefaults={show:{minZoom:.7,maxZoom:5}},this._tooltips={},this._tooltipRoot=IO(t.getContainer());var n=this;Cn.bind(this._tooltipRoot,Vf,"mousedown",function(i){i.stopPropagation()}),Cn.bind(this._tooltipRoot,Vf,"mouseover",function(i){n.trigger("mouseover",i)}),Cn.bind(this._tooltipRoot,Vf,"mouseout",function(i){n.trigger("mouseout",i)}),this._init()}vn.$inject=["eventBus","canvas"],vn.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=z({},this._tooltipDefaults,e,{id:t}),this._addTooltip(e),e.timeout&&this.setTimeout(e),t},vn.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)))},vn.prototype.get=function(e){return typeof e!="string"&&(e=e.id),this._tooltips[e]},vn.prototype.clearTimeout=function(e){if(e=this.get(e),!!e){var t=e.removeTimer;t&&(clearTimeout(t),e.removeTimer=null)}},vn.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)}},vn.prototype.remove=function(e){var t=this.get(e);t&&(di(t.html),di(t.htmlContainer),delete t.htmlContainer,delete this._tooltips[t.id])},vn.prototype.show=function(){Gf(this._tooltipRoot)},vn.prototype.hide=function(){Gf(this._tooltipRoot,!1)},vn.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},vn.prototype._addTooltip=function(e){var t=e.id,n=e.html,i,r=this._tooltipRoot;n.get&&n.constructor.prototype.jquery&&(n=n.get(0)),wn(n)&&(n=dt(n)),i=dt('<div data-tooltip-id="'+t+'" class="'+ax+'">'),dn(i,{position:"absolute"}),i.appendChild(n),e.type&&vt(i).add("djs-tooltip-"+e.type),e.className&&vt(i).add(e.className),e.htmlContainer=i,r.appendChild(i),this._tooltips[t]=e,this._updateTooltip(e)},vn.prototype._updateTooltip=function(e){var t=e.position,n=e.htmlContainer;BO(n,t.x,t.y)},vn.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),Gf(i,r))})},vn.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 NO={__init__:["tooltips"],tooltips:["type",vn]};var $O="flow elements must be children of pools/participants",FO="Data object must be placed within a pool/participant.";function sx(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;w(s,"bpmn:Collaboration")&&(w(a,"bpmn:FlowNode")?i(r,n($O)):w(a,"bpmn:DataObjectReference")&&i(r,n(FO)))})}sx.$inject=["eventBus","tooltips","translate"];const jO={__depends__:[NO],__init__:["modelingFeedback"],modelingFeedback:["type",sx]};var HO=500,zO=1250,GO=1500,wu=Math.round;function VO(e){return{x:e.x+wu(e.width/2),y:e.y+wu(e.height/2)}}function cx(e,t,n,i,r){function o(s,c,u,l){return r.allowed("elements.move",{shapes:s,delta:c,position:u,target:l})}e.on("shape.move.start",GO,function(s){var c=s.context,u=s.shape,l=i.get().slice();l.indexOf(u)===-1&&(l=[u]),l=WO(l),z(c,{shapes:l,validatedShapes:l,shape:u})}),e.on("shape.move.start",zO,function(s){var c=s.context,u=c.validatedShapes,l;if(l=c.canExecute=o(u),!l)return!1}),e.on("shape.move.move",HO,function(s){var c=s.context,u=c.validatedShapes,l=s.hover,f={x:s.dx,y:s.dy},p={x:s.x,y:s.y},d;if(d=o(u,f,p,l),c.delta=f,c.canExecute=d,d===null){c.target=null;return}c.target=l}),e.on("shape.move.end",function(s){var c=s.context,u=c.delta,l=c.canExecute,f=l==="attach",p=c.shapes;if(l===!1)return!1;u.x=wu(u.x),u.y=wu(u.y),!(u.x===0&&u.y===0)&&n.moveElements(p,u,c.target,{primaryShape:c.shape,attach:f})}),e.on("element.mousedown",function(s){if(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 f=VO(c),p=t.init(s,f,"shape.move",{cursor:"grabbing",autoActivate:u,data:{shape:c,context:l||{}}});if(p!==!1)return!0}}this.start=a}cx.$inject=["eventBus","dragging","modeling","selection","rules"];function WO(e){var t=Jr(e,"id");return Ge(e,function(n){for(;n=n.parent;)if(t[n.id])return!1;return!0})}var ux=499,Wf="djs-dragging",lx="drop-ok",px="drop-not-ok",fx="new-parent",dx="attach-ok";function hx(e,t,n,i){function r(c){var u=o(c),l=UO(u);return l}function o(c){var u=Jo(c),l=u.flatMap(d=>(d.incoming||[]).concat(d.outgoing||[])),f=u.concat(l),p=[...new Set(f)];return p}function a(c,u){[dx,lx,px,fx].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,Wf),c.allDraggedElements?c.allDraggedElements.push(u):c.allDraggedElements=[u]}e.on("shape.move.start",ux,function(c){var u=c.context,l=u.shapes,f=u.allDraggedElements,p=r(l);if(!u.dragGroup){var d=Ce("g");he(d,n.cls("djs-drag-group",["no-events"]));var g=t.getActiveLayer();Ne(g,d),u.dragGroup=d}p.forEach(function(h){i.addDragger(h,u.dragGroup)}),f?f=Ou([f,o(l)]):f=o(l),L(f,function(h){t.addMarker(h,Wf)}),u.allDraggedElements=f,u.differentParents=qO(l)}),e.on("shape.move.move",ux,function(c){var u=c.context,l=u.dragGroup,f=u.target,p=u.shape.parent,d=u.canExecute;f&&(d==="attach"?a(f,dx):u.canExecute&&p&&f.id!==p.id?a(f,fx):a(f,u.canExecute?lx:px)),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,f=u.dragGroup;L(l,function(p){t.removeMarker(p,Wf)}),f&&jt(f)}),this.makeDraggable=s}hx.$inject=["eventBus","canvas","styles","previewSupport"];function UO(e){var t=new Set;e.forEach(function(i){t.add(i.id)});var n=Ge(e,function(i){return at(i)?t.has(i.source.id)&&t.has(i.target.id):!0});return n}function qO(e){return H0(Jr(e,function(t){return t.parent&&t.parent.id}))!==1}const YO={__depends__:[dc,Kn,zf,bi,Bi,Ao],__init__:["move","movePreview"],move:["type",cx],movePreview:["type",hx]};var mx=".djs-palette-toggle",gx=".entry",KO=mx+", "+gx,Uf="djs-palette-",XO="shown",qf="open",yx="two-column",ZO=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=ZO),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(JO,{})},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=dt(Lt.HTML_MARKUP);n.appendChild(i),vt(n).add(Uf+XO),Cn.bind(i,KO,"click",function(r){var o=r.delegateTarget;if(ll(o,mx))return e.toggle();e.trigger("click",r)}),Be.bind(i,"mousedown",function(r){r.stopPropagation()}),Cn.bind(i,gx,"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=vt(n),a=vt(t);"twoColumn"in e?r=e.twoColumn:r=this._needsCollapse(t.clientHeight,this._entries||{}),o.toggle(yx,r),a.toggle(Uf+yx,r),"open"in e&&(o.toggle(qf,e.open),a.toggle(Uf+qf,e.open)),i.fire("palette.changed",{twoColumn:r,open:this.isOpen()})},Lt.prototype._update=function(){var e=rt(".djs-palette-entries",this._container),t=this._entries=this.getEntries();xs(e),L(t,function(n,i){var r=n.group||"default",o=rt("[data-group="+La(r)+"]",e);o||(o=dt('<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=dt(a);if(o.appendChild(s),!n.separator&&(sn(s,"data-action",i),n.title&&sn(s,"title",n.title),n.className&&QO(s,n.className),n.imageUrl)){var c=dt("<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=rt(".djs-palette-entries",this._container),this._toolsContainer=rt("[data-group=tools]",t)),n=this._toolsContainer,L(n.children,function(i){var r=i.getAttribute("data-action");if(r){var o=vt(i);r=r.replace("-tool",""),o.contains("entry")&&r===e?o.add("highlighted-entry"):o.remove("highlighted-entry")}})},Lt.prototype.isOpen=function(){return vt(this._container).has(qf)},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 QO(e,t){var n=vt(e),i=ke(t)?t:t.split(/\s+/g);i.forEach(function(r){n.add(r)})}function JO(e,t){var n=t.getPaletteEntries();return Wt(n)?n(e):(L(n,function(i,r){e[r]=i}),e)}const eD={__init__:["palette"],palette:["type",Lt]};var vx="crosshair",bx="selected",tD="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(f){var p=t.getActiveLayer(),d=f.frame=Ce("rect");he(d,{class:"djs-lasso-overlay",width:1,height:1,x:0,y:0}),Ne(p,d),u(!0),this.update(f)},update:function(f){var p=f.frame,d=f.bbox;p&&d&&he(p,{x:d.x,y:d.y,width:d.width,height:d.height});var g=f.marked,h=f.lastMarked;if(g&&h){for(const m of h)g.has(m)||t.removeMarker(m,bx);for(const m of g)h.has(m)||t.addMarker(m,bx)}},remove:function(f){this.update(f),f.frame&&jt(f.frame),u(!1)}};function u(f){qe(t.getContainer()).toggle(tD,f)}function l(f){var p=i.getAll();return new Set(Qr(uo(p,f)))}o.registerTool("lasso",{tool:"lasso.selection",dragging:"lasso"}),e.on("lasso.selection.end",function(f){var p=f.originalEvent.target;!f.hover&&!(p instanceof SVGElement)||e.once("lasso.selection.ended",function(){s.activateLasso(f.originalEvent,!0)})}),e.on("lasso.end",0,function(f){var p=f.context;s._select(Array.from(p.marked))}),e.on("lasso.start",function(f){var p=f.context;p.bbox=_x(f),p.add=ac(f),p.lastMarked=new Set(r.get()),p.add?p.marked=p.lastMarked:p.marked=new Set,p.initialMarked=p.marked,c.create(p)}),e.on("lasso.move",function(f){var p=f.context,d=p.bbox=_x(f),g=l(d),h=p.initialMarked.union(g);p.lastMarked=p.marked,p.marked=h,c.update(p)}),e.on("lasso.cleanup",function(f){var p=f.context;p.lastMarked=p.marked,p.marked=new Set(r.get()),c.remove(f.context)}),e.on("element.mousedown",1500,function(f){if(ac(f))return s.activateLasso(f.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:vx,data:{context:{}},keepSelection:!0})},xr.prototype.activateSelection=function(e,t){this._dragging.init(e,"lasso.selection",{trapClick:!1,autoActivate:t,cursor:vx,data:{context:{}},keepSelection:!0})},xr.prototype._select=function(e){this._selection.select(e)},xr.prototype.select=function(e,t,n=[]){var i=Qr(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 _x(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 nD={__depends__:[yc,va],__init__:["lassoTool"],lassoTool:["type",xr]};var Yf=1500,xx="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",Yf,function(c){if(ma(c))return a.activateMove(c.originalEvent,!0),!1}),s&&s.addListener(Yf,function(c){if(!(!wx(c.keyEvent)||a.isActive())){var u=a._mouse.getLastMoveEvent();a.activateMove(u,!!u)}},"keyboard.keydown"),s&&s.addListener(Yf,function(c){!wx(c.keyEvent)||!a.isActive()||a.toggle()},"keyboard.keyup"),e.on("hand.end",function(c){var u=c.originalEvent.target;if(!c.hover&&!(u instanceof SVGElement))return!1;e.once("hand.ended",function(){a.activateMove(c.originalEvent,{reactivate:!0})})}),e.on("hand.move.move",function(c){var u=t.viewbox().scale;t.scroll({dx:c.dx*u,dy:c.dy*u})}),e.on("hand.move.end",function(c){var u=c.context,l=u.reactivate;return!ma(c)&&l&&e.once("hand.move.ended",function(f){a.activateHand(f.originalEvent,!0,!0)}),!1})}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:xx,data:{context:n||{}}})},Fo.prototype.activateHand=function(e,t,n){this._dragging.init(e,"hand",{trapClick:!1,autoActivate:t,cursor:xx,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 wx(e){return Ht("Space",e)}const iD={__depends__:[yc,va],__init__:["handTool"],handTool:["type",Fo]};var Ex="connect-ok",Sx="connect-not-ok";function jo(e,t,n,i,r,o,a){var s=this;this._dragging=t,this._rules=o,this._mouse=a,r.registerTool("global-connect",{tool:"global-connect",dragging:"global-connect.drag"}),e.on("global-connect.hover",function(c){var u=c.context,l=c.hover,f=u.canStartConnect=s.canStartConnect(l);f!==null&&(u.startTarget=l,i.addMarker(l,f?Ex:Sx))}),e.on(["global-connect.out","global-connect.cleanup"],function(c){var u=c.context.startTarget,l=c.context.canStartConnect;u&&i.removeMarker(u,l?Ex:Sx)}),e.on(["global-connect.ended"],function(c){var u=c.context,l=u.startTarget,f={x:c.x,y:c.y},p=s.canStartConnect(l);if(p)return e.once("element.out",function(){e.once(["connect.ended","connect.canceled"],function(){e.fire("global-connect.drag.ended")}),n.start(null,l,f)}),!1})}jo.$inject=["eventBus","dragging","connect","canvas","toolManager","rules","mouse"],jo.prototype.start=function(e,t){this._dragging.init(e,"global-connect",{autoActivate:t,trapClick:!1,data:{context:{}}})},jo.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();return this.start(e,!!e)},jo.prototype.isActive=function(){var e=this._dragging.context();return e&&/^global-connect/.test(e.prefix)},jo.prototype.canStartConnect=function(e){return this._rules.allowed("connection.start",{source:e})};const rD={__depends__:[Nf,bi,Bi,yc,va],globalConnect:["type",jo]};function Kf(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)}Kf.$inject=["palette","create","elementFactory","spaceTool","lassoTool","handTool","globalConnect","translate"],Kf.prototype.getPaletteEntries=function(){var e={},t=this._create,n=this._elementFactory,i=this._spaceTool,r=this._lassoTool,o=this._handTool,a=this._globalConnect,s=this._translate;function c(f,p,d,g,h){function m(_){var y=n.createShape(z({type:f},h));t.start(_,y)}return{group:p,className:d,title:g,action:{dragstart:m,click:m}}}function u(f){var p=n.createShape({type:"bpmn:SubProcess",x:0,y:0,isExpanded:!0}),d=n.createShape({type:"bpmn:StartEvent",x:40,y:82,parent:p});t.start(f,[p,d],{hints:{autoSelect:[p]}})}function l(f){t.start(f,n.createParticipantShape())}return z(e,{"hand-tool":{group:"tools",className:"bpmn-icon-hand-tool",title:s("Activate hand tool"),action:{click:function(f){o.activateHand(f)}}},"lasso-tool":{group:"tools",className:"bpmn-icon-lasso-tool",title:s("Activate lasso tool"),action:{click:function(f){r.activateSelection(f)}}},"space-tool":{group:"tools",className:"bpmn-icon-space-tool",title:s("Activate create/remove space tool"),action:{click:function(f){i.activateSelection(f)}}},"global-connect-tool":{group:"tools",className:"bpmn-icon-connection-multi",title:s("Activate global connect tool"),action:{click:function(f){a.start(f)}}},"tool-separator":{group:"tools",separator:!0},"create.start-event":c("bpmn:StartEvent","event","bpmn-icon-start-event-none",s("Create start event")),"create.intermediate-event":c("bpmn:IntermediateThrowEvent","event","bpmn-icon-intermediate-event-none",s("Create intermediate/boundary event")),"create.end-event":c("bpmn:EndEvent","event","bpmn-icon-end-event-none",s("Create end event")),"create.exclusive-gateway":c("bpmn:ExclusiveGateway","gateway","bpmn-icon-gateway-none",s("Create gateway")),"create.task":c("bpmn:Task","activity","bpmn-icon-task",s("Create task")),"create.data-object":c("bpmn:DataObjectReference","data-object","bpmn-icon-data-object",s("Create data object reference")),"create.data-store":c("bpmn:DataStoreReference","data-store","bpmn-icon-data-store",s("Create data store reference")),"create.subprocess-expanded":{group:"activity",className:"bpmn-icon-subprocess-expanded",title:s("Create expanded sub-process"),action:{dragstart:u,click:u}},"create.participant-expanded":{group:"collaboration",className:"bpmn-icon-participant",title:s("Create pool/participant"),action:{dragstart:l,click:l}},"create.group":c("bpmn:Group","artifact","bpmn-icon-group",s("Create group"))}),e};const oD={__depends__:[eD,mc,Qy,nD,iD,rD,ca],__init__:["paletteProvider"],paletteProvider:["type",Kf]};var aD=250;function Xf(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,f={type:u.newElementType};if(!s.visualReplacements[l]){var p=t.get(l);z(f,{x:p.x,y:p.y});var d=n.createShape(f);i.addShape(d,p.parent);var g=rt('[data-element-id="'+La(p.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 f=rt('[data-element-id="'+La(l)+'"]',s.dragGroup);f&&he(f,{display:"inline"}),u.remove(),c[l]&&delete c[l]})}e.on("shape.move.move",aD,function(s){var c=s.context,u=c.canExecute;c.visualReplacements||(c.visualReplacements={}),u&&u.replacements?o(c):a(c)})}Xf.$inject=["eventBus","elementRegistry","elementFactory","canvas","previewSupport"],de(Xf,J);const sD={__depends__:[Ao],__init__:["bpmnReplacePreview"],bpmnReplacePreview:["type",Xf]};var cD=1250,Zf=40,uD=20,lD=10,Rx=20,Cx=["x","y"],pD=Math.abs;function Px(e){e.on(["connect.hover","connect.move","connect.end"],cD,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&&fD(t,o,gD(o)),o&&mD(i,["bpmn:Association","bpmn:DataInputAssociation","bpmn:DataOutputAssociation","bpmn:SequenceFlow"])?(n.connectionStart=Qn(r),ze(o,["bpmn:Event","bpmn:Gateway"])&&Ax(t,Qn(o)),ze(o,["bpmn:Task","bpmn:SubProcess"])&&dD(t,o),w(a,"bpmn:BoundaryEvent")&&s===a.host&&hD(t)):Tx(i,"bpmn:MessageFlow")?(w(r,"bpmn:Event")&&(n.connectionStart=Qn(r)),w(o,"bpmn:Event")&&Ax(t,Qn(o))):n.connectionStart=n.initialConnectionStart)})}Px.$inject=["eventBus"];function fD(e,t,n){Cx.forEach(function(i){var r=Mx(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 dD(e,t){var n=Qn(t);Cx.forEach(function(i){yD(e,t,i)&&Dt(e,i,n[i])})}function hD(e){var t=e.context,n=t.source,i=t.target;if(!vD(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;pD(c-r[s])<Zf&&(c>r[s]?u=r[s]+Zf:u=r[s]-Zf,Dt(e,s,u))})}}function Ax(e,t){Dt(e,"x",t.x),Dt(e,"y",t.y)}function Tx(e,t){return e&&e.type===t}function mD(e,t){return Wi(t,function(n){return Tx(e,n)})}function Mx(e,t){return e==="x"?t.width:t.height}function gD(e){return w(e,"bpmn:Task")?lD:uD}function yD(e,t,n){return e[n]>t[n]+Rx&&e[n]<t[n]+Mx(n,t)-Rx}function vD(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 Eu,n.initDefaults(this._defaultSnaps)),n};function Eu(){this._snapValues={}}Eu.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)},Eu.prototype.snap=function(e,t,n,i){var r=this._snapValues[t];return r&&ak(e[n],r[n],i)},Eu.prototype.initDefaults=function(e){var t=this;L(e||{},function(n,i){L(n,function(r){t.add(i,r)})})};var bD=1250;function Ei(e,t,n){var i=this;this._elementRegistry=e,t.on(["create.start","shape.move.start"],function(r){i.initSnap(r)}),t.on(["create.move","create.end","shape.move.move","shape.move.end"],bD,function(r){var o=r.context,a=o.shape,s=o.snapContext,c=o.target;if(!(r.originalEvent&&Tn(r.originalEvent))&&!($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()})}Ei.$inject=["elementRegistry","eventBus","snapping"],Ei.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}),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},Ei.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",Qn(r));return}if(at(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},Ei.prototype.getSnapTargets=function(e,t){return g_(t).filter(function(n){return!_D(n)})};function _D(e){return!!e.hidden}var kx=1500;function Ho(e,t){t.invoke(Ei,this),e.on(["create.move","create.end"],kx,SD),e.on(["create.move","create.end","shape.move.move","shape.move.end"],kx,function(n){var i=n.context,r=i.canExecute,o=i.target,a=r&&(r==="attach"||r.attach);a&&!$o(n)&&xD(n,o)})}de(Ho,Ei),Ho.$inject=["eventBus","injector"],Ho.prototype.initSnap=function(e){var t=Ei.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",Dx(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",Dx(o,i,e))}),w(n,"bpmn:Participant")&&t.setSnapLocations(["top-left","bottom-right","mid"]),t},Ho.prototype.addSnapTargetPoints=function(e,t,n){Ei.prototype.addSnapTargetPoints.call(this,e,t,n);var i=this.getSnapTargets(t,n);L(i,function(o){(ED(o)||wD([t,o],"bpmn:TextAnnotation"))&&(e.add("top-left",h_(o)),e.add("bottom-right",m_(o)))});var r=this._elementRegistry;return L(t.incoming,function(o){if(r.get(t.id)){Ox(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)){Ox(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)}}),w(n,"bpmn:SequenceFlow")&&(e=this.addSnapTargetPoints(e,t,n.parent)),e},Ho.prototype.getSnapTargets=function(e,t){return Ei.prototype.getSnapTargets.call(this,e,t).filter(function(n){return!w(n,"bpmn:Lane")})};function xD(e,t){var n=Pe(t),i=Yg(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 wD(e,t){return e.every(function(n){return w(n,t)})}function ED(e){return w(e,"bpmn:SubProcess")&&We(e)?!0:w(e,"bpmn:Participant")}function SD(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 Ox(e,t){return e.indexOf(t)!==-1}function Dx(e,t,n){return t?{x:e.x-n.x,y:e.y-n.y}:{x:e.x,y:e.y}}var RD=1250;function Xa(e,t){var n=this;e.on(["resize.start"],function(i){n.initSnap(i)}),e.on(["resize.move","resize.end"],RD,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),AD(s)&&Dt(i,"x",i.x),TD(s)&&Dt(i,"y",i.y),t.snap(i,u)}}),e.on(["resize.cleanup"],function(){t.hide()})}Xa.prototype.initSnap=function(e){var t=e.context,n=t.shape,i=t.direction,r=t.snapContext;r||(r=t.snapContext=new wr);var o=Lx(n,i);return r.setSnapOrigin("corner",{x:o.x-e.x,y:o.y-e.y}),r},Xa.prototype.addSnapTargetPoints=function(e,t,n,i){var r=this.getSnapTargets(t,n);return L(r,function(o){e.add("corner",m_(o)),e.add("corner",h_(o))}),e.add("corner",Lx(t,i)),e},Xa.$inject=["eventBus","snapping"],Xa.prototype.getSnapTargets=function(e,t){return g_(t).filter(function(n){return!CD(n,e)&&!at(n)&&!PD(n)&&!je(n)})};function Lx(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 CD(e,t){return e.host===t}function PD(e){return!!e.hidden}function AD(e){return e==="n"||e==="s"}function TD(e){return e==="e"||e==="w"}var MD=7,kD=1e3;function Er(e){this._canvas=e,this._asyncHide=Lu(gn(this.hide,this),kD)}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,MD),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"),Ne(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 OD={__depends__:[{__init__:["createMoveSnapping","resizeSnapping","snapping"],createMoveSnapping:["type",Ei],resizeSnapping:["type",Xa],snapping:["type",Er]}],__init__:["connectSnapping","createMoveSnapping"],connectSnapping:["type",Px],createMoveSnapping:["type",Ho]};var Ix=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=rt($e.INPUT_SELECTOR,this._container),this._resultsContainer=rt($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){Ht("ArrowUp",n)&&n.preventDefault(),Ht("ArrowDown",n)&&n.preventDefault()}),t(this._container,$e.INPUT_SELECTOR,"keyup",function(n){if(Ht("Escape",n))return e.close();if(Ht("Enter",n)){var i=e._getCurrentResult();return i?e._select(i):e.close(!1)}if(Ht("ArrowUp",n))return e._scrollToDirection(!0);if(Ht("ArrowDown",n))return e._scrollToDirection();Ht(["ArrowLeft","ArrowRight"],n)||e._search(n.delegateTarget.value)})},$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=rt($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(){xs(this._resultsContainer),this._results={},this._eventBus.fire("searchPad.cleared")},$e.prototype._getCurrentResult=function(){return rt($e.RESULT_SELECTED_SELECTOR,this._resultsContainer)},$e.prototype._createResultNode=function(e,t){var n=dt($e.RESULT_HTML);return e.primaryTokens.length>0&&Bx(n,e.primaryTokens,$e.RESULT_PRIMARY_HTML),Bx(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,vt(this._canvas.getContainer()).add("djs-search-open"),vt(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,vt(this._canvas.getContainer()).remove("djs-search-open"),vt(this._container).remove("open"),this._clearResults(),this._searchInput.value="",this._searchInput.blur(),this._eventBus.fire("searchPad.closed"),this._canvas.restoreFocus())},$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&&vt(t).remove($e.RESULT_SELECTED_CLASS);var n=sn(e,$e.RESULT_ID_ATTRIBUTE),i=this._results[n].element;vt(e).add($e.RESULT_SELECTED_CLASS),this._canvas.scrollToElement(i,{top:Ix}),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:Ix}),this._selection.select(n),this._eventBus.fire("searchPad.selected",n)},$e.prototype._getBoxHtml=function(){const e=dt($e.BOX_HTML),t=rt($e.INPUT_SELECTOR,e);return t&&t.setAttribute("aria-label",this._translate("Search in diagram")),e};function Bx(e,t,n){var i=DD(t),r=dt(n);r.innerHTML=i,e.appendChild(r)}function DD(e){var t="";return e.forEach(function(n){var i=Vv(n.value||n.matched||n.normal),r=n.match||n.matched;r?t+='<b class="'+$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>`,$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 AD={__depends__:[ca,$c,Vn],searchPad:["type",$e]};function Xf(e,t,n,i){this._elementRegistry=e,this._canvas=n,this._search=i,t.registerProvider(this)}Xf.$inject=["elementRegistry","searchPad","canvas","search"],Xf.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(TD)};function TD(e){const{item:{element:t},tokens:n}=e;return{element:t,primaryTokens:n.label,secondaryTokens:n.id}}const MD={__depends__:[AD,Wb],__init__:["bpmnSearch"],bpmnSearch:["type",Xf]},kD="M44.7648 11.3263L36.9892 2.64074C36.0451 1.58628 34.5651 0.988708 33.1904 0.988708H5.98667C3.22688 0.988708 0.989624 3.34892 0.989624 6.26039V55.0235C0.989624 57.9349 3.22688 60.2952 5.98667 60.2952H40.966C43.7257 60.2952 45.963 57.9349 45.963 55.0235V14.9459C45.963 13.5998 45.6407 12.3048 44.7648 11.3263Z",OD="M1.03845 48.1347C1.03845 49.3511 1.07295 50.758 1.38342 52.064C1.69949 53.3938 2.32428 54.7154 3.56383 55.6428C6.02533 57.4841 10.1161 58.7685 14.8212 59.6067C19.5772 60.4538 25.1388 60.8738 30.6831 60.8738C36.2276 60.8738 41.7891 60.4538 46.545 59.6067C51.2504 58.7687 55.3412 57.4842 57.8028 55.6429C59.0424 54.7156 59.6673 53.3938 59.9834 52.064C60.2938 50.7579 60.3285 49.351 60.3285 48.1344V13.8415C60.3285 12.6249 60.2938 11.218 59.9834 9.91171C59.6673 8.58194 59.0423 7.2602 57.8027 6.33294C55.341 4.49168 51.2503 3.20723 46.545 2.36914C41.7891 1.522 36.2276 1.10204 30.6831 1.10205C25.1388 1.10206 19.5772 1.52206 14.8213 2.36923C10.1162 3.20734 6.02543 4.49183 3.5639 6.33314C2.32433 7.26038 1.69951 8.58206 1.38343 9.91181C1.07295 11.2179 1.03845 12.6247 1.03845 13.8411V48.1347Z",DD={width:36,height:50},LD={width:50,height:50};function Lx(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(rR(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 x(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))):x(e,"bpmn:EndEvent")?(n=Ce("circle"),he(n,H({cx:e.width/2,cy:e.height/2,r:e.width/2+Xn+1},t))):x(e,"bpmn:Event")?(n=Ce("circle"),he(n,H({cx:e.width/2,cy:e.height/2,r:e.width/2+Xn},t))):x(e,"bpmn:DataObjectReference")&&Ix(e,"bpmn:DataObjectReference")?n=Lx(kD,{x:-6,y:-6},t):x(e,"bpmn:DataStoreReference")&&Ix(e,"bpmn:DataStoreReference")&&(n=Lx(OD,{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 Ix(e,t){var n;return t==="bpmn:DataObjectReference"?n=DD:t==="bpmn:DataStoreReference"&&(n=LD),e.width===n.width&&e.height===n.height}const ID={__depends__:[Ff],__init__:["outlineProvider"],outlineProvider:["type",Eu]};var ND='<?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 Si(e){fo.call(this,e)}de(Si,fo),Si.Viewer=yr,Si.NavigatedViewer=Ia,Si.prototype.createDiagram=function(){return this.importXML(ND)},Si.prototype._interactionModules=[Yv,Xv,Jv],Si.prototype._modelingModules=[$2,Nc,G2,H2,nk,If,ck,Dk,$y,hc,Bk,Fk,nO,rO,oO,lO,wO,PO,sf,LO,zO,JO,tD,K_,CD,MD,ID],Si.prototype._modules=[].concat(yr.prototype._modules,Si.prototype._interactionModules,Si.prototype._modelingModules);const BD=((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 Si({container:o.value,moddleExtensions:cs}),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"]]);oe.APPLY_BPMN_OPS_SCHEMA=D0,oe.BPMN_MODDLE_EXTENSIONS=cs,oe.BWL_MODDLE_SCHEMA=id,oe.BWL_NS=nd,oe.BWL_PREFIX=Au,oe.BWL_SIDES=Tu,oe.BpmnModelerView=BD,oe.EDITOR=i1,oe.FLOW_LABEL_INDENT=Bd,oe.HEADLESS_BPMN_MODULES=$v,oe.HEADLESS_TEXT_METRICS=ro,oe.I18N_NS=pE,oe.I18N_PREFIX=Ad,oe.LABEL_FORK_MARGIN=Zu,oe.MVP_FLOW_NODE_TYPES=Ri,oe.SYMBOLIC_OP_KINDS=ad,oe.SYMBOLIC_OP_SCHEMA=sd,oe.UNDO_EPISODE_COMMAND=Mu,oe.applyBpmnOpBatch=kh,oe.applyBpmnOps=Ph,oe.approximateTextWidth=oo,oe.auditBpmnGeometry=Yd,oe.auditBpmnGeometryXml=IE,oe.auditGeometry=li,oe.auditTargetsOf=ti,oe.axisSegmentsOf=fn,oe.blackBoxNameRect=Ku,oe.buildBpmnOpBatch=n1,oe.buildRegistryIndex=Xd,oe.containerBoundarySegments=Ko,oe.createBpmnEditorController=r1,oe.createBpmnModdle=Td,oe.createHeadlessBpmnModeler=SM,oe.crossedShapesOf=gn,oe.crossingCost=ei,oe.describeProcess=Mh,oe.describeProcessXml=t1,oe.edgeCrossCount=ds,oe.edgeCrossingPairsOf=Ju,oe.edgeCrossingStatsOf=zd,oe.executeAsUndoEpisode=od,oe.forwardThreePointCandidates=nl,oe.geometryFindingKey=ui,oe.installHeadlessBpmnDom=kd,oe.isEdgeOverlapFinding=Xu,oe.isMvpFlowNodeType=td,oe.labelRectsOf=so,oe.lineCrossesLabel=Pi,oe.lineThroughLabel=jd,oe.lineThroughShapeLabel=Ud,oe.loadBpmnXml=Uu,oe.lowerOps=Ch,oe.oppositeOverlapCount=EE,oe.oppositeOverlapOf=Nd,oe.planBackEdgeBoundaryClearance=sh,oe.planCrossPoolRoute=rh,oe.planEdgeRepair=th,oe.planLabelLineClearance=gh,oe.planLabelPlacement=mh,oe.planMiddleSegmentShifts=Qd,oe.planOppositeOverlapRepair=ph,oe.planSegmentDetours=tl,oe.planShapeLabelClearance=bh,oe.repairIntroducedBoundaryHugging=ch,oe.repairIntroducedCrossings=nh,oe.repairIntroducedFakeMerges=dh,oe.repairIntroducedLabelLines=yh,oe.repairIntroducedOppositeOverlaps=hh,oe.repairIntroducedShapeLabelLines=_h,oe.repairIntroducedSharedSegmentLabels=vh,oe.rerouteIntroducedCrossPoolEdges=oh,oe.resolverServicesOf=Sh,oe.saveBpmnXml=fE,oe.sceneCrossingCost=Hd,oe.sceneFromDefinitions=qd,oe.sceneFromRegistry=mt,oe.sharedSegmentUnderLabel=fs,oe.sharedSpansOf=ps,oe.unreadableOverlapCount=Jn,oe.unreadableOverlapOf=Yo,oe.validateOps=Eh,oe.warningMessages=qu,Object.defineProperty(oe,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 LD={__depends__:[ca,Fc,Kn],searchPad:["type",$e]};function Qf(e,t,n,i){this._elementRegistry=e,this._canvas=n,this._search=i,t.registerProvider(this)}Qf.$inject=["elementRegistry","searchPad","canvas","search"],Qf.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:Fn(i),id:i.id})),e,{keys:["label","id"]}).map(ID)};function ID(e){const{item:{element:t},tokens:n}=e;return{element:t,primaryTokens:n.label,secondaryTokens:n.id}}const BD={__depends__:[LD,Yb],__init__:["bpmnSearch"],bpmnSearch:["type",Qf]},ND="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",$D="M1.03845 48.1347C1.03845 49.3511 1.07295 50.758 1.38342 52.064C1.69949 53.3938 2.32428 54.7154 3.56383 55.6428C6.02533 57.4841 10.1161 58.7685 14.8212 59.6067C19.5772 60.4538 25.1388 60.8738 30.6831 60.8738C36.2276 60.8738 41.7891 60.4538 46.545 59.6067C51.2504 58.7687 55.3412 57.4842 57.8028 55.6429C59.0424 54.7156 59.6673 53.3938 59.9834 52.064C60.2938 50.7579 60.3285 49.351 60.3285 48.1344V13.8415C60.3285 12.6249 60.2938 11.218 59.9834 9.91171C59.6673 8.58194 59.0423 7.2602 57.8027 6.33294C55.341 4.49168 51.2503 3.20723 46.545 2.36914C41.7891 1.522 36.2276 1.10204 30.6831 1.10205C25.1388 1.10206 19.5772 1.52206 14.8213 2.36923C10.1162 3.20734 6.02543 4.49183 3.5639 6.33314C2.32433 7.26038 1.69951 8.58206 1.38343 9.91181C1.07295 11.2179 1.03845 12.6247 1.03845 13.8411V48.1347Z",FD={width:36,height:50},jD={width:50,height:50};function Nx(e,t,n){return Ce("path",{d:e,strokeWidth:2,transform:`translate(${t.x}, ${t.y})`,...n})}const ti=5;function Su(e,t){this._styles=t,e.registerProvider(this)}Su.$inject=["outline","styles"],Su.prototype.getOutline=function(e){const t=this._styles.cls("djs-outline",["no-fill"]);var n;if(lR(e))return n=Ce("rect"),he(n,z({x:-ti,y:-ti,rx:4,width:e.width+ti*2,height:e.height+ti*2},t)),n;if(!je(e))return w(e,"bpmn:Gateway")?(n=Ce("rect"),z(n.style,{"transform-box":"fill-box",transform:"rotate(45deg)","transform-origin":"center"}),he(n,z({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,z({x:-ti,y:-ti,rx:14,width:e.width+ti*2,height:e.height+ti*2},t))):w(e,"bpmn:EndEvent")?(n=Ce("circle"),he(n,z({cx:e.width/2,cy:e.height/2,r:e.width/2+ti+1},t))):w(e,"bpmn:Event")?(n=Ce("circle"),he(n,z({cx:e.width/2,cy:e.height/2,r:e.width/2+ti},t))):w(e,"bpmn:DataObjectReference")&&$x(e,"bpmn:DataObjectReference")?n=Nx(ND,{x:-6,y:-6},t):w(e,"bpmn:DataStoreReference")&&$x(e,"bpmn:DataStoreReference")&&(n=Nx($D,{x:-6,y:-6},t)),n},Su.prototype.updateOutline=function(e,t){if(!je(e))return ze(e,["bpmn:SubProcess","bpmn:Group"])?(he(t,{width:e.width+ti*2,height:e.height+ti*2}),!0):!!ze(e,["bpmn:Event","bpmn:Gateway","bpmn:DataStoreReference","bpmn:DataObjectReference"])};function $x(e,t){var n;return t==="bpmn:DataObjectReference"?n=FD:t==="bpmn:DataStoreReference"&&(n=jD),e.width===n.width&&e.height===n.height}const HD={__depends__:[zf],__init__:["outlineProvider"],outlineProvider:["type",Su]};var zD='<?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 Si(e){fo.call(this,e)}de(Si,fo),Si.Viewer=gr,Si.NavigatedViewer=Ia,Si.prototype.createDiagram=function(){return this.importXML(zD)},Si.prototype._interactionModules=[Zv,Jv,nb],Si.prototype._modelingModules=[V2,Nc,K2,q2,ck,Nf,hk,Fk,Hy,mc,Gk,Uk,cO,lO,pO,gO,AO,DO,uf,jO,YO,oD,sD,Q_,OD,BD,HD],Si.prototype._modules=[].concat(gr.prototype._modules,Si.prototype._interactionModules,Si.prototype._modelingModules);const GD=((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),f=Yu(l);return r("imported",f),{warnings:f}}catch(l){throw r("import-error",l),l}}async function c(){if(!a)throw new Error("modeler not mounted");const{xml:u}=await a.saveXML({format:!0});return u??""}return At.onMounted(async()=>{a=new Si({container:o.value,moddleExtensions:cs}),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"]]);re.APPLY_BPMN_OPS_SCHEMA=N0,re.BPMN_MODDLE_EXTENSIONS=cs,re.BWL_MODDLE_SCHEMA=od,re.BWL_NS=rd,re.BWL_PREFIX=Tu,re.BWL_SIDES=Mu,re.BpmnModelerView=GD,re.EDITOR=u1,re.FLOW_LABEL_INDENT=Fd,re.HEADLESS_BPMN_MODULES=Hv,re.HEADLESS_TEXT_METRICS=io,re.I18N_NS=mE,re.I18N_PREFIX=Md,re.LABEL_FORK_MARGIN=Qu,re.MVP_FLOW_NODE_TYPES=Ri,re.SYMBOLIC_OP_KINDS=cd,re.SYMBOLIC_OP_SCHEMA=ud,re.UNDO_EPISODE_COMMAND=ku,re.applyBpmnOpBatch=Lh,re.applyBpmnOps=Mh,re.approximateTextWidth=ro,re.auditBpmnGeometry=Xd,re.auditBpmnGeometryXml=FE,re.auditGeometry=ri,re.auditTargetsOf=Gn,re.axisSegmentsOf=pn,re.blackBoxNameRect=Xu,re.buildBpmnOpBatch=c1,re.buildRegistryIndex=Qd,re.containerBoundarySegments=Ko,re.createBpmnEditorController=l1,re.createBpmnModdle=kd,re.createHeadlessBpmnModeler=MM,re.crossedShapesOf=fn,re.crossingCost=Bn,re.describeProcess=Dh,re.describeProcessXml=s1,re.edgeCrossCount=ds,re.edgeCrossingPairsOf=el,re.edgeCrossingStatsOf=Vd,re.executeAsUndoEpisode=sd,re.forwardThreePointCandidates=il,re.geometryFindingKey=ii,re.installHeadlessBpmnDom=Dd,re.isEdgeOverlapFinding=Zu,re.isMvpFlowNodeType=id,re.labelRectsOf=so,re.lineCrossesLabel=Pi,re.lineThroughLabel=Hd,re.lineThroughShapeLabel=Yd,re.loadBpmnXml=qu,re.lowerOps=Th,re.oppositeOverlapCount=PE,re.oppositeOverlapOf=$d,re.planBackEdgeBoundaryClearance=uh,re.planCrossPoolRoute=ah,re.planEdgeRepair=ih,re.planLabelLineClearance=bh,re.planLabelPlacement=vh,re.planMiddleSegmentShifts=eh,re.planOppositeOverlapRepair=ph,re.planSegmentDetours=nl,re.planShapeLabelClearance=wh,re.repairIntroducedBoundaryHugging=lh,re.repairIntroducedCrossings=rh,re.repairIntroducedFakeMerges=dh,re.repairIntroducedLabelLines=_h,re.repairIntroducedOppositeOverlaps=yh,re.repairIntroducedShapeLabelLines=Eh,re.repairIntroducedSharedSegmentLabels=xh,re.rerouteIntroducedCrossPoolEdges=sh,re.resolverServicesOf=Ph,re.saveBpmnXml=gE,re.sceneCrossingCost=Gd,re.sceneFromDefinitions=Kd,re.sceneFromRegistry=pt,re.sharedSegmentUnderLabel=fs,re.sharedSpansOf=ps,re.unreadableOverlapCount=In,re.unreadableOverlapOf=oo,re.validateOps=Ch,re.warningMessages=Yu,Object.defineProperty(re,Symbol.toStringTag,{value:"Module"})}));