@g1cloud/bpmn-modeler-next 5.0.0-alpha.5 → 5.0.0-alpha.8

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,15 +1,15 @@
1
- (function(oe,Ye){typeof exports=="object"&&typeof module<"u"?Ye(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],Ye):(oe=typeof globalThis<"u"?globalThis:oe||self,Ye(oe.BpmnModeler={},oe.Vue))})(this,(function(oe,Ye){"use strict";var S2=Object.defineProperty;var R2=(oe,Ye,kn)=>Ye in oe?S2(oe,Ye,{enumerable:!0,configurable:!0,writable:!0,value:kn}):oe[Ye]=kn;var Xi=(oe,Ye,kn)=>R2(oe,typeof Ye!="symbol"?Ye+"":Ye,kn);const kn=["startEvent","endEvent","userTask","serviceTask","task","sendTask","receiveTask","exclusiveGateway","parallelGateway"];function _p(e){return kn.includes(e)}const bp="http://g1project.net/spec/bpmn/bwl/1.0",sc="bwl",cc=["top-left","top","top-right","right","bottom-right","bottom","bottom-left","left"],Ep={name:"bwl-hints",uri:bp,prefix:sc,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"}]}]},uc="bwl.undoEpisode",xp=new WeakSet;function w_(e){xp.has(e)||(e.register(uc,{preExecute(t){try{t.run()}catch(n){t.error=n}}}),xp.add(e))}function wp(e,t){w_(e);const n={run:t};if(e.execute(uc,n),n.error!==void 0)throw e.canUndo()&&e.undo(),n.error}const Sp=["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"],S_={description:"생략 = 보존, null = 제거.",anyOf:[{type:"string"},{type:"null"}]},R_={type:"object",description:"레인. 배열 선언 순서 = 풀 내 상→하 순서.",properties:{id:{type:"string"},name:{type:"string"}},required:["id"],additionalProperties:!1},C_={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},P_={type:"object",description:"플로우 노드. 좌표는 지정하지 않는다 — 배치는 resolver 가 결정한다.",properties:{id:{type:"string"},type:{type:"string",enum:[...kn]},name:{type:"string"},participant:{type:"string",description:"소속 풀 id(협업 문서)."},lane:{type:"string",description:"소속 레인 id(풀 정의에 선언된 것)."}},required:["id","type"],additionalProperties:!1},A_={type:"object",description:"분기 조건 — 게이트웨이가 아닌 플로우에 붙인다. MVP 는 label 만.",properties:{label:{type:"string"}},required:["label"],additionalProperties:!1},T_={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},M_={type:"object",description:"메시지 플로우(풀 경계를 넘는 연결 — 노드 또는 블랙박스 풀 자체가 끝점).",properties:{id:{type:"string"},source:{type:"string"},target:{type:"string"},name:{type:"string"}},required:["id","source","target"],additionalProperties:!1},k_={type:"object",properties:{id:{type:"string"},name:{type:"string"}},required:["id"],additionalProperties:!1},D_={type:"object",description:"데이터 입출력 연관. 방향 = source→target(태스크→스토어 = 쓰기, 스토어→태스크 = 읽기).",properties:{id:{type:"string"},source:{type:"string"},target:{type:"string"}},required:["source","target"],additionalProperties:!1},O_={type:"object",properties:{id:{type:"string"},text:{type:"string"}},required:["id","text"],additionalProperties:!1},I_={type:"object",description:"연관선(주석 ↔ 요소).",properties:{id:{type:"string"},source:{type:"string"},target:{type:"string"}},required:["source","target"],additionalProperties:!1},L_={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},B_={type:"object",description:"주석 방위 힌트 — 앵커 요소 기준 상대 배치. 있으면 결정적 배치, 없으면 휴리스틱.",properties:{anchor:{type:"string",description:"기준 요소 id."},side:{type:"string",enum:[...cc]},offset:{type:"number"}},required:["anchor","side"],additionalProperties:!1};function yt(e,t){return{type:"object",description:t.description,properties:{kind:{const:e},...t.properties},required:["kind",...t.required??[]],additionalProperties:!1}}const N_={"participant.add":yt("participant.add",{description:"풀 추가. order = 풀 세로 순서 힌트(생략 시 op 순서가 곧 배치 순서).",properties:{participant:{$ref:"#/$defs/irParticipant"},order:{type:"integer"}},required:["participant"]}),"participant.update":yt("participant.update",{description:"풀 이름/레인 갱신. lanes 는 전체 재선언(생략 = 보존) — 기존 레인을 유지하려면 함께 다시 나열한다.",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"},lanes:{type:"array",items:{$ref:"#/$defs/irLane"}}},required:["id"]}),"node.add":yt("node.add",{description:"플로우 노드 추가. band = 프로세스 내부 가로 밴드 순번 힌트(주 흐름 0, 보조 스트랜드 1…).",properties:{node:{$ref:"#/$defs/irNode"},band:{type:"integer"}},required:["node"]}),"node.update":yt("node.update",{description:"노드 이름/레인/타입 갱신. lane = 레인 재배정(이동), type = 태스크·이벤트 타입 전환.",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"},lane:{type:"string"},type:{type:"string",enum:[...kn]}},required:["id"]}),"sequenceFlow.add":yt("sequenceFlow.add",{description:"시퀀스 플로우 추가. 분기 조건은 게이트웨이가 아닌 플로우의 condition 에 싣는다.",properties:{flow:{$ref:"#/$defs/irSequenceFlow"}},required:["flow"]}),"sequenceFlow.update":yt("sequenceFlow.update",{description:"시퀀스 플로우 이름/조건/끝점 갱신. condition: null = 조건 제거. source/target = 끝점 재배선 — 중간 삽입은 기존 플로우를 지우지 말고 이것으로 한쪽 끝을 옮긴 뒤 새 플로우를 추가한다.",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"},condition:{description:"생략 = 보존, null = 제거.",anyOf:[{$ref:"#/$defs/irFlowCondition"},{type:"null"}]},source:{description:"새 출발 노드 id(생략 = 보존). 같은 배치에서 추가한 노드도 지목할 수 있다.",type:"string"},target:{description:"새 도착 노드 id(생략 = 보존). 같은 배치에서 추가한 노드도 지목할 수 있다.",type:"string"}},required:["id"]}),"messageFlow.add":yt("messageFlow.add",{description:"메시지 플로우 추가(풀 경계를 넘는 연결).",properties:{flow:{$ref:"#/$defs/irMessageFlow"}},required:["flow"]}),"messageFlow.update":yt("messageFlow.update",{description:"메시지 플로우 이름 갱신.",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"}},required:["id"]}),"dataStore.add":yt("dataStore.add",{description:"데이터 스토어 추가(+ 입출력 연관 동반 가능).",properties:{dataStore:{$ref:"#/$defs/irDataStore"},associations:{type:"array",items:{$ref:"#/$defs/irDataAssociation"}}},required:["dataStore"]}),"dataStore.update":yt("dataStore.update",{description:"데이터 스토어 이름 갱신.",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"}},required:["id"]}),"dataAssociation.add":yt("dataAssociation.add",{description:"기존 노드 ↔ 기존 데이터 스토어의 입출력 연관 추가.",properties:{association:{$ref:"#/$defs/irDataAssociation"}},required:["association"]}),"association.add":yt("association.add",{description:"주석 ↔ 요소 연관 추가(한쪽 끝은 주석). 주석 신설과 함께면 annotation.add 의 association 을 쓰고, 이 op 는 추가 연관(한 주석에 여러 연관)용.",properties:{association:{$ref:"#/$defs/irAssociation"}},required:["association"]}),"annotation.add":yt("annotation.add",{description:"텍스트 주석 추가. association 으로 대상 요소와 연결하고, placement 로 방위를 지정하면 결정적 배치된다.",properties:{annotation:{$ref:"#/$defs/irTextAnnotation"},association:{$ref:"#/$defs/irAssociation"},placement:{$ref:"#/$defs/bwlPlacement"}},required:["annotation"]}),"annotation.update":yt("annotation.update",{description:"주석 본문/방위 힌트 갱신. placement: null = 힌트 제거(휴리스틱 복귀). 주석 삭제는 element.remove.",properties:{id:{type:"string"},text:{type:"string"},placement:{description:"생략 = 보존, null = 힌트 제거.",anyOf:[{$ref:"#/$defs/bwlPlacement"},{type:"null"}]}},required:["id"]}),"group.add":yt("group.add",{description:"그룹 추가 — 바운즈는 members 의 bbox 로 산출되므로 좌표를 지정하지 않는다.",properties:{group:{$ref:"#/$defs/irGroup"}},required:["group"]}),"group.update":yt("group.update",{description:"그룹 이름/멤버 갱신. members 는 전체 재선언(생략 = 보존).",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"},members:{type:"array",items:{type:"string"}}},required:["id"]}),"element.remove":yt("element.remove",{description:"요소 제거(카테고리 무관). 부착된 연결선은 함께 제거된다.",properties:{id:{type:"string"}},required:["id"]})},Rp={anyOf:Sp.map(e=>N_[e])},$_={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:R_,irParticipant:C_,irNode:P_,irFlowCondition:A_,irSequenceFlow:T_,irMessageFlow:M_,irDataStore:k_,irDataAssociation:D_,irTextAnnotation:O_,irAssociation:I_,irGroup:L_,bwlPlacement:B_,nullableString:S_,symbolicOp:Rp}};function lc(e){return Array.prototype.concat.apply([],e)}const Nr=Object.prototype.toString,j_=Object.prototype.hasOwnProperty;function Pi(e){return e===void 0}function it(e){return e!==void 0}function Zi(e){return e==null}function se(e){return Nr.call(e)==="[object Array]"}function ut(e){return Nr.call(e)==="[object Object]"}function le(e){return Nr.call(e)==="[object Number]"}function lt(e){const t=Nr.call(e);return t==="[object Function]"||t==="[object AsyncFunction]"||t==="[object GeneratorFunction]"||t==="[object AsyncGeneratorFunction]"||t==="[object Proxy]"}function kt(e){return Nr.call(e)==="[object String]"}function F_(e){if(!se(e))throw new Error("must supply array")}function Dt(e,t){return!Zi(e)&&j_.call(e,t)}function Le(e,t){const n=Wo(t);let i;return A(e,function(r,o){if(n(r,o))return i=r,!1}),i}function Cp(e,t){const n=Wo(t);let i=se(e)?-1:void 0;return A(e,function(r,o){if(n(r,o))return i=o,!1}),i}function ye(e,t){const n=Wo(t);let i=[];return A(e,function(r,o){n(r,o)&&i.push(r)}),i}function A(e,t){let n,i;if(Pi(e))return;const r=se(e)?W_:G_;for(let o in e)if(Dt(e,o)&&(n=e[o],i=t(n,r(o)),i===!1))return n}function H_(e,t){if(Pi(e))return[];F_(e);const n=Wo(t);return e.filter(function(i,r){return!n(i,r)})}function Ot(e,t,n){return A(e,function(i,r){n=t(n,i,r)}),n}function Ai(e,t){return!!Ot(e,function(n,i,r){return n&&t(i,r)},!0)}function Kn(e,t){return!!Le(e,t)}function _t(e,t){let n=[];return A(e,function(i,r){n.push(t(i,r))}),n}function Go(e){return e&&Object.keys(e)||[]}function z_(e){return Go(e).length}function Qi(e){return _t(e,t=>t)}function Ji(e,t,n={}){return t=pc(t),A(e,function(i){let r=t(i)||"_",o=n[r];o||(o=n[r]=[]),o.push(i)}),n}function Pp(e,...t){e=pc(e);let n={};return A(t,r=>Ji(r,e,n)),_t(n,function(r,o){return r[0]})}const V_=Pp;function dn(e,t){t=pc(t);let n=[];return A(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)}),_t(n,i=>i.v)}function er(e){return function(t){return Ai(e,function(n,i){return t[i]===n})}}function pc(e){return lt(e)?e:t=>t[e]}function Wo(e){return lt(e)?e:t=>t===e}function G_(e){return e}function W_(e){return Number(e)}function fc(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 At(e,t){return e.bind(t)}function k(e,...t){return Object.assign(e,...t)}function U_(e,t,n){let i=e;return A(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];it(a)&&Zi(s)&&(s=i[r]=isNaN(+a)?{}:[]),Pi(a)?Pi(n)?delete i[r]:i[r]=n:i=s}),e}function cn(e,t){let n={},i=Object(e);return A(t,function(r){r in i&&(n[r]=e[r])}),n}function hn(e,t){let n={},i=Object(e);return A(i,function(r,o){t.indexOf(o)===-1&&(n[o]=r)}),n}function dc(){}dc.prototype.get=function(e){return this.$model.properties.get(this,e)},dc.prototype.set=function(e,t){this.$model.properties.set(this,e,t)};function Ap(e,t){this.model=e,this.properties=t}Ap.prototype.createType=function(e){var t=this.model,n=this.properties,i=Object.create(dc.prototype);A(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}),A(a,At(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 q_=k(Object.create(null),{String:!0,Boolean:!0,Integer:!0,Real:!0,Element:!0}),Tp=k(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 hc(e,t){var n=Tp[e];return n?n(t):t}function mc(e){return!!q_[e]}function Mp(e){return!!Tp[e]}function bt(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 Vt(e){this.ns=e,this.name=e.name,this.allTypes=[],this.allTypesByName=Object.create(null),this.properties=[],this.propertiesByName=Object.create(null)}Vt.prototype.build=function(){return cn(this,["ns","name","allTypes","allTypesByName","properties","propertiesByName","bodyProperty","idProperty"])},Vt.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)},Vt.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},Vt.prototype.redefineProperty=function(e,t,n){var i=e.ns.prefix,r=t.split("#"),o=bt(r[0],i),a=bt(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},Vt.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},Vt.prototype.removeNamedProperty=function(e){var t=e.ns,n=this.propertiesByName;delete n[t.name],delete n[t.localName]},Vt.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},Vt.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},Vt.prototype.assertNotTrait=function(e){if((e.extends||[]).length)throw new Error(`cannot create <${e.name}> extending <${e.extends}>`)},Vt.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")},Vt.prototype.hasProperty=function(e){return this.propertiesByName[e]},Vt.prototype.addTrait=function(e,t){t&&this.assertNotTrait(e);var n=this.allTypesByName,i=this.allTypes,r=e.name;r in n||(A(e.properties,At(function(o){o=k({},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 Xn(e,t){this.packageMap=Object.create(null),this.typeMap=Object.create(null),this.packages=[],this.properties=t,A(e,At(this.registerPackage,this))}Xn.prototype.getPackage=function(e){return this.packageMap[e]},Xn.prototype.getPackages=function(){return this.packages},Xn.prototype.registerPackage=function(e){e=k({},e);var t=this.packageMap;kp(t,e,"prefix"),kp(t,e,"uri"),A(e.types,At(function(n){this.registerType(n,e)},this)),t[e.uri]=t[e.prefix]=e,this.packages.push(e)},Xn.prototype.registerType=function(e,t){e=k({},e,{superClass:(e.superClass||[]).slice(),extends:(e.extends||[]).slice(),properties:(e.properties||[]).slice(),meta:k({},e.meta||{})});var n=bt(e.name,t.prefix),i=n.name,r=Object.create(null);A(e.properties,At(function(o){var a=bt(o.name,n.prefix),s=a.name;mc(o.type)||(o.type=bt(o.type,a.prefix).name),k(o,{ns:a,name:s}),r[s]=o},this)),k(e,{ns:n,name:i,propertiesByName:r}),A(e.extends,At(function(o){var a=bt(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},Xn.prototype.mapTypes=function(e,t,n){var i=mc(e.name)?{name:e.name}:this.typeMap[e.name],r=this;function o(c,u){var l=bt(c,mc(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+">");A(i.superClass,n?a:s),t(i,!n),A(i.traits,a)},Xn.prototype.getEffectiveDescriptor=function(e){var t=bt(e),n=new Vt(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},Xn.prototype.definePackage=function(e,t){this.properties.define(e,"$pkg",{value:t})};function kp(e,t,n){var i=t[n];if(i in e)throw new Error("package with "+n+" <"+i+"> already defined")}function Ti(e){this.model=e}Ti.prototype.set=function(e,t,n){if(!kt(t)||!t.length)throw new TypeError("property name must be a non-empty string");var i=this.getProperty(e,t),r=i&&i.name;Y_(n)?i?delete e[r]:delete e.$attrs[gc(t)]:i?r in e?e[r]=n:Dp(e,i,n):e.$attrs[gc(t)]=n},Ti.prototype.get=function(e,t){var n=this.getProperty(e,t);if(!n)return e.$attrs[gc(t)];var i=n.name;return!e[i]&&n.isMany&&Dp(e,n,[]),e[i]},Ti.prototype.define=function(e,t,n){if(!n.writable){var i=n.value;n=k({},n,{get:function(){return i}}),delete n.value}Object.defineProperty(e,t,n)},Ti.prototype.defineDescriptor=function(e,t){this.define(e,"$descriptor",{value:t})},Ti.prototype.defineModel=function(e,t){this.define(e,"$model",{value:t})},Ti.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 Y_(e){return typeof e>"u"}function Dp(e,t,n){Object.defineProperty(e,t.name,{enumerable:!t.isReference,writable:!0,value:n,configurable:!0})}function gc(e){return e.replace(/^:/,"")}function Yt(e,t={}){this.properties=new Ti(this),this.factory=new Ap(this,this.properties),this.registry=new Xn(e,this.properties),this.typeCache=Object.create(null),this.config=t}Yt.prototype.create=function(e,t){var n=this.getType(e);if(!n)throw new Error("unknown type <"+e+">");return new n(t)},Yt.prototype.getType=function(e){var t=this.typeCache,n=kt(e)?e:e.ns.name,i=t[n];return i||(e=this.registry.getEffectiveDescriptor(n),i=t[n]=this.factory.createType(e)),i},Yt.prototype.createAny=function(e,t,n){var i=bt(e),r={$type:e,$instanceOf:function(a){return a===this.$type},get:function(a){return this[a]},set:function(a,s){U_(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}),A(n,function(a,s){ut(a)&&a.value!==void 0?r[a.name]=a.value:r[s]=a}),r},Yt.prototype.getPackage=function(e){return this.registry.getPackage(e)},Yt.prototype.getPackages=function(){return this.registry.getPackages()},Yt.prototype.getElementDescriptor=function(e){return e.$descriptor},Yt.prototype.hasType=function(e,t){t===void 0&&(t=e,e=this);var n=e.$model.getElementDescriptor(e);return t in n.allTypesByName},Yt.prototype.getPropertyDescriptor=function(e,t){return this.getElementDescriptor(e).propertiesByName[t]},Yt.prototype.getTypeDescriptor=function(e){return this.registry.typeMap[e]};var Op=String.fromCharCode,K_=Object.prototype.hasOwnProperty,X_=/&#(\d+);|&#x([0-9a-f]+);|&(\w+);/ig,$r={amp:"&",apos:"'",gt:">",lt:"<",quot:'"'};Object.keys($r).forEach(function(e){$r[e.toUpperCase()]=$r[e]});function Z_(e,t,n,i){return i?K_.call($r,i)?$r[i]:"&"+i+";":Op(t||parseInt(n,16))}function Mi(e){return e.length>3&&e.indexOf("&")!==-1?e.replace(X_,Z_):e}var Ip="non-whitespace outside of root node";function Zn(e){return new Error(e)}function Q_(e){return"missing namespace for prefix <"+e+">"}function Uo(e){return{get:e,enumerable:!0}}function J_(e){var t=Object.create(null),n;for(n in e)t[n]=e[n];return t}var Lp=Symbol("nameCache");function vc(e){return e+"$uri"}function eb(e){var t=Object.create(null),n,i;for(n in e)i=e[n],t[i]=i,t[vc(i)]=n;return t}function qo(){return{line:0,column:0}}function tb(e){throw e}function Bp(e){if(!this)return new Bp(e);var t=e&&e.proxy,n,i,r,o,a=tb,s,c,u,l,p=qo,f=!1,d=!1,h="",g=!1,y=!1,S=null,w=!1,E,x,R,M;function O(I){I instanceof Error||(I=Zn(I)),S=I,a(I,p)}function P(I){s&&(I instanceof Error||(I=Zn(I)),s(I,p))}this.on=function(I,G){if(typeof G!="function")throw Zn("required args <name, cb>");switch(I){case"openTag":i=G;break;case"text":n=G;break;case"closeTag":r=G;break;case"error":a=G;break;case"warn":s=G;break;case"cdata":o=G;break;case"attention":l=G;break;case"question":u=G;break;case"comment":c=G;break;default:throw Zn("unsupported event: "+I)}return this},this.ns=function(I){if(typeof I>"u"&&(I={}),typeof I!="object")throw Zn("required args <nsMap={}>");var G=Object.create(null),ie;for(ie in I)G[ie]=I[ie];return y=!0,M=G,this};function j(){E=y?[]:null,x=y?eb(M):null,R=[],p=qo,w=!1,S=null,d=!1,h=""}this.parse=function(I){if(typeof I!="string")throw Zn("required args <xml=string>");if(f)throw Zn("parse during stream; call end() first");return j(),$(I),p=qo,w=!1,S},this.write=function(I){if(typeof I!="string")throw Zn("required args <xml=string>");return f||(j(),f=!0),S||(h=$(h+I,!0)||""),this},this.end=function(){return f||j(),f=!1,S||$(h),h="",p=qo,w=!1,S},this.stop=function(){w=!0};function $(I,G=!1){var ie=null,Te=null,tt,W=0,J=!1,re=!1,Q=0,ee=0,q,N,B,F,ge,D,b,m,v,C="",T=0,L;function U(we,he){var _e=we.indexOf(":");if(_e===-1)return we;var je=x[we.substring(0,_e)];return je?he===je?we.substr(_e+1):je+we.substr(_e):(P(Q_(we.substring(0,_e))),null)}function K(){if(L!==null)return L;var we,he,_e=y&&x.xmlns,je=y&&g?[]:null,Ce=T,Be=C,$e=Be.length,ct,zt,St,qt,nt,Ki={},x_=new Set,fn,Ae,Ie;e:for(;Ce<$e;Ce++)if(fn=!1,Ae=Be.charCodeAt(Ce),!(Ae===32||Ae<14&&Ae>8)){for((Ae<65||Ae>122||Ae>90&&Ae<97)&&Ae!==95&&Ae!==58&&(P("illegal first char attribute name"),fn=!0),Ie=Ce+1;Ie<$e;Ie++)if(Ae=Be.charCodeAt(Ie),!(Ae>96&&Ae<123||Ae>64&&Ae<91||Ae>47&&Ae<59||Ae===46||Ae===45||Ae===95)){if(Ae===32||Ae<14&&Ae>8){P("missing attribute value"),Ce=Ie;continue e}if(Ae===61)break;P("illegal attribute name char"),fn=!0}if(nt=Be.substring(Ce,Ie),nt==="xmlns:xmlns"&&(P("illegal declaration of xmlns"),fn=!0),Ae=Be.charCodeAt(Ie+1),Ae===34)Ie=Be.indexOf('"',Ce=Ie+2),Ie===-1&&(Ie=Be.indexOf("'",Ce),Ie!==-1&&(P("attribute value quote missmatch"),fn=!0));else if(Ae===39)Ie=Be.indexOf("'",Ce=Ie+2),Ie===-1&&(Ie=Be.indexOf('"',Ce),Ie!==-1&&(P("attribute value quote missmatch"),fn=!0));else for(P("missing attribute value quotes"),fn=!0,Ie=Ie+1;Ie<$e&&(Ae=Be.charCodeAt(Ie+1),!(Ae===32||Ae<14&&Ae>8));Ie++);for(Ie===-1&&(P("missing closing quotes"),Ie=$e,fn=!0),fn||(St=Be.substring(Ce,Ie)),Ce=Ie;Ie+1<$e&&(Ae=Be.charCodeAt(Ie+1),!(Ae===32||Ae<14&&Ae>8));Ie++)Ce===Ie&&(P("illegal character after attribute end"),fn=!0);if(Ce=Ie+1,fn)continue e;if(x_.has(nt)){P("attribute <"+nt+"> already defined");continue}if(x_.add(nt),!y){Ki[nt]=St;continue}if(g){if(zt=nt==="xmlns"?"xmlns":nt.charCodeAt(0)===120&&nt.substr(0,6)==="xmlns:"?nt.substr(6):null,zt!==null){if(we=Mi(St),he=vc(zt),qt=M[we],!qt){if(zt==="xmlns"||he in x&&x[he]!==we)do qt="ns"+W++;while(typeof x[qt]<"u");else qt=zt;M[we]=qt}x[zt]!==qt&&(ct||(x=J_(x),ct=!0),x[zt]=qt,zt==="xmlns"&&(x[vc(qt)]=we,_e=qt),x[he]=we),Ki[nt]=St;continue}je.push(nt,St);continue}nt=U(nt,_e),nt!==null&&(Ki[nt]=St)}if(g)for(Ce=0,$e=je.length;Ce<$e;Ce++)nt=U(je[Ce++],_e),St=je[Ce],nt!==null&&(Ki[nt]=St);return L=Ki}function ae(){for(var we=/(\r\n|\r|\n)/g,he=0,_e=0,je=0,Ce=ee,Be,$e;Q>=je&&(Be=we.exec(I),!(!Be||(Ce=Be[0].length+Be.index,Ce>Q)));)he+=1,je=Ce;return Q==-1?(_e=Ce,$e=I.substring(ee)):ee===0?$e=I.substring(ee,Q):(_e=Q-je,$e=ee==-1?I.substring(Q):I.substring(Q,ee+1)),{data:$e,line:he,column:_e}}for(p=ae,t&&(v=Object.create({},{name:Uo(function(){return b}),originalName:Uo(function(){return m}),attrs:Uo(K),ns:Uo(function(){return x})}));ee!==-1;){if(I.charCodeAt(ee)===60?Q=ee:Q=I.indexOf("<",ee),Q===-1){if(G)return I.substring(ee);if(R.length)return O("unexpected end of file");if(!d)return O("missing start tag");ee<I.length&&I.substring(ee).trim()&&P(Ip);return}if(d||(d=!0),ee!==Q){if(R.length){if(n&&(n(I.substring(ee,Q),Mi,p),w))return}else if(I.substring(ee,Q).trim()&&(P(Ip),w))return}if(F=I.charCodeAt(Q+1),F===33){if(B=I.charCodeAt(Q+2),B===91&&I.substr(Q+3,6)==="CDATA["){if(ee=I.indexOf("]]>",Q),ee===-1)return G?I.substring(Q):O("unclosed cdata");if(o&&(o(I.substring(Q+9,ee),p),w))return;ee+=3;continue}if(B===45&&I.charCodeAt(Q+3)===45){if(ee=I.indexOf("-->",Q),ee===-1)return G?I.substring(Q):O("unclosed comment");if(c&&(c(I.substring(Q+4,ee),Mi,p),w))return;ee+=3;continue}}if(F===63){if(ee=I.indexOf("?>",Q),ee===-1)return G?I.substring(Q):O("unclosed question");if(u&&(u(I.substring(Q,ee+2),p),w))return;ee+=2;continue}for(q=Q+1;;q++){if(ge=I.charCodeAt(q),isNaN(ge))return G?I.substring(Q):(ee=-1,O("unclosed tag"));if(ge===34)B=I.indexOf('"',q+1),q=B!==-1?B:q;else if(ge===39)B=I.indexOf("'",q+1),q=B!==-1?B:q;else if(ge===62){ee=q;break}}if(F===33){if(l&&(l(I.substring(Q,ee+1),Mi,p),w))return;ee+=1;continue}if(L={},F===47){if(J=!1,re=!0,!R.length)return O("missing open tag");if(q=b=R.pop(),B=Q+2+q.length,I.substring(Q+2,B)!==q)return O("closing tag mismatch");for(;B<ee;B++)if(F=I.charCodeAt(B),!(F===32||F>8&&F<14))return O("close tag")}else{if(I.charCodeAt(ee-1)===47?(q=b=I.substring(Q+1,ee-1),J=!0,re=!0):(q=b=I.substring(Q+1,ee),J=!0,re=!1),!(F>96&&F<123||F>64&&F<91||F===95||F===58))return O("illegal first char nodeName");for(B=1,N=q.length;B<N;B++)if(F=q.charCodeAt(B),!(F>96&&F<123||F>64&&F<91||F>47&&F<59||F===45||F===95||F==46)){if(F===32||F<14&&F>8){b=q.substring(0,B),L=null;break}return O("invalid nodeName")}re||R.push(b)}if(y){tt=x,J&&(re||E.push(tt),L===null&&(g=q.indexOf("xmlns",B)!==-1)&&(T=B,C=q,K(),g=!1)),m=b,Te!==x&&(ie=x[Lp],ie===void 0&&(ie=x[Lp]=Object.create(null)),Te=x);var Pe=ie[b];if(Pe!==void 0)b=Pe;else{if(F=b.indexOf(":"),F!==-1){if(D=x[b.substring(0,F)],!D)return O("missing namespace on <"+m+">");b=b.substr(F+1)}else D=x.xmlns;D&&(b=D+":"+b),ie[m]=b}}if(J&&(T=B,C=q,i&&(t?i(v,Mi,re,p):i(b,K,Mi,re,p),w)))return;if(re){if(r&&(r(t?v:b,Mi,J,p),w))return;y&&(J?x=tt:x=E.pop())}ee+=1}}}function Np(e){return e.xml&&e.xml.tagAlias==="lowerCase"}var yc={xsi:"http://www.w3.org/2001/XMLSchema-instance",xml:"http://www.w3.org/XML/1998/namespace"},$p="property";function jp(e){return e.xml&&e.xml.serialize}function nb(e){const t=jp(e);return t!==$p&&(t||null)}function ib(e){return e.charAt(0).toUpperCase()+e.slice(1)}function Fp(e,t){return Np(t)?e.prefix+":"+ib(e.localName):e.name}function rb(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 ob(e,t,n){const i=bt(e,t.xmlns),r=`${t[i.prefix]||i.prefix}:${i.localName}`,o=bt(r);var a=n.getPackage(o.prefix);return rb(o,a)}function Qn(e){return new Error(e)}function Dn(e){return e.$descriptor}function ab(e){k(this,e),this.elementsById={},this.references=[],this.warnings=[],this.addReference=function(t){this.references.push(t)},this.addElement=function(t){if(!t)throw Qn("expected element");var n=this.elementsById,i=Dn(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 Qn("duplicate ID <"+o+">");n[o]=t}},this.addWarning=function(t){this.warnings.push(t)}}function jr(){}jr.prototype.handleEnd=function(){},jr.prototype.handleText=function(){},jr.prototype.handleNode=function(){};function _c(){}_c.prototype=Object.create(jr.prototype),_c.prototype.handleNode=function(){return this};function tr(){}tr.prototype=Object.create(jr.prototype),tr.prototype.handleText=function(e){this.body=(this.body||"")+e};function Fr(e,t){this.property=e,this.context=t}Fr.prototype=Object.create(tr.prototype),Fr.prototype.handleNode=function(e){if(this.element)throw Qn("expected no sub nodes");return this.element=this.createReference(e),this},Fr.prototype.handleEnd=function(){this.element.id=this.body},Fr.prototype.createReference=function(e){return{property:this.property.ns.name,id:""}};function bc(e,t){this.element=t,this.propertyDesc=e}bc.prototype=Object.create(tr.prototype),bc.prototype.handleEnd=function(){var e=this.body||"",t=this.element,n=this.propertyDesc;e=hc(n.type,e),n.isMany?t.get(n.name).push(e):t.set(n.name,e)};function Yo(){}Yo.prototype=Object.create(tr.prototype),Yo.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 Rt(e,t,n){this.model=e,this.type=e.getType(t),this.context=n}Rt.prototype=Object.create(Yo.prototype),Rt.prototype.addReference=function(e){this.context.addReference(e)},Rt.prototype.handleText=function(e){var t=this.element,n=Dn(t),i=n.bodyProperty;if(!i)throw Qn("unexpected body text <"+e+">");tr.prototype.handleText.call(this,e)},Rt.prototype.handleEnd=function(){var e=this.body,t=this.element,n=Dn(t),i=n.bodyProperty;i&&e!==void 0&&(e=hc(i.type,e),t.set(i.name,e))},Rt.prototype.createElement=function(e){var t=e.attributes,n=this.type,i=Dn(n),r=this.context,o=new n({}),a=this.model,s;return A(t,function(c,u){var l=i.propertiesByName[u],p;l&&l.isReference?l.isMany?(p=c.split(" "),A(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=hc(l.type,c):u==="xmlns"?u=":"+u:(s=bt(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},Rt.prototype.getPropertyForNode=function(e){var t=e.name,n=bt(t),i=this.type,r=this.model,o=Dn(i),a=n.name,s=o.propertiesByName[a];if(s&&!s.isAttr){const u=nb(s);if(u){const l=e.attributes[u];if(l){const p=ob(l,e.ns,r),f=r.getType(p);return k({},s,{effectiveType:Dn(f).name})}}return s}var c=r.getPackage(n.prefix);if(c){const u=Fp(n,c),l=r.getType(u);if(s=Le(o.properties,function(p){return!p.isVirtual&&!p.isReference&&!p.isAttribute&&l.hasType(p.type)}),s)return k({},s,{effectiveType:Dn(l).name})}else if(s=Le(o.properties,function(u){return!u.isReference&&!u.isAttribute&&u.type==="Element"}),s)return s;throw Qn("unrecognized element <"+n.name+">")},Rt.prototype.toString=function(){return"ElementDescriptor["+Dn(this.type).name+"]"},Rt.prototype.valueHandler=function(e,t){return new bc(e,t)},Rt.prototype.referenceHandler=function(e){return new Fr(e,this.context)},Rt.prototype.handler=function(e){return e==="Element"?new nr(this.model,e,this.context):new Rt(this.model,e,this.context)},Rt.prototype.handleChild=function(e){var t,n,i,r;if(t=this.getPropertyForNode(e),i=this.element,n=t.effectiveType||t.type,Mp(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?(k(o,{element:i}),this.context.addReference(o)):o.$parent=i),r};function Ec(e,t,n){Rt.call(this,e,t,n)}Ec.prototype=Object.create(Rt.prototype),Ec.prototype.createElement=function(e){var t=e.name,n=bt(t),i=this.model,r=this.type,o=i.getPackage(n.prefix),a=o&&Fp(n,o)||t;if(!r.hasType(a))throw Qn("unexpected element <"+e.originalName+">");return Rt.prototype.createElement.call(this,e)};function nr(e,t,n){this.model=e,this.context=n}nr.prototype=Object.create(Yo.prototype),nr.prototype.createElement=function(e){var t=e.name,n=bt(t),i=n.prefix,r=e.ns[i+"$uri"],o=e.attributes;return this.model.createAny(t,r,o)},nr.prototype.handleChild=function(e){var t=new nr(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},nr.prototype.handleEnd=function(){this.body&&(this.element.$body=this.body)};function xc(e){e instanceof Yt&&(e={model:e}),k(this,{lax:!1},e)}xc.prototype.fromXML=function(e,t,n){var i=t.rootHandler;t instanceof Rt?(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 ab(k({},t,{rootHandler:i})),s=new Bp({proxy:!0}),c=sb();i.context=a,c.push(i);function u(R,M,O){var P=M(),j=P.line,$=P.column,I=P.data;I.charAt(0)==="<"&&I.indexOf(" ")!==-1&&(I=I.slice(0,I.indexOf(" "))+">");var G="unparsable content "+(I?I+" ":"")+`detected
2
- line: `+j+`
3
- column: `+$+`
4
- nested error: `+R.message;if(O)return a.addWarning({message:G,error:R}),!0;throw Qn(G)}function l(R,M){return u(R,M,!0)}function p(){var R=a.elementsById,M=a.references,O,P;for(O=0;P=M[O];O++){var j=P.element,$=R[P.id],I=Dn(j).propertiesByName[P.property];if($||a.addWarning({message:"unresolved reference <"+P.id+">",element:P.element,property:P.property,value:P.id}),I.isMany){var G=j.get(I.name),ie=G.indexOf(P);ie===-1&&(ie=G.length),$?G[ie]=$:G.splice(ie,1)}else j.set(I.name,$)}}function f(){c.pop().handleEnd()}var d=/^<\?xml /i,h=/ encoding="([^"]+)"/i,g=/^utf-8$/i;function y(R){if(d.test(R)){var M=h.exec(R),O=M&&M[1];!O||g.test(O)||a.addWarning({message:"unsupported document encoding <"+O+">, falling back to UTF-8"})}}function S(R,M){var O=c.peek();try{c.push(O.handleNode(R))}catch(P){u(P,M,o)&&c.push(new _c)}}function w(R,M){try{c.peek().handleText(R)}catch(O){l(O,M)}}function E(R,M){R.trim()&&w(R,M)}var x=r.getPackages().reduce(function(R,M){return R[M.uri]=M.prefix,R},Object.entries(yc).reduce(function(R,[M,O]){return R[O]=M,R},r.config&&r.config.nsMap||{}));return s.ns(x).on("openTag",function(R,M,O,P){var j=R.attrs||{},$=Object.keys(j).reduce(function(G,ie){var Te=M(j[ie]);return G[ie]=Te,G},{}),I={name:R.name,originalName:R.originalName,attributes:$,ns:R.ns};S(I,P)}).on("question",y).on("closeTag",f).on("cdata",w).on("text",function(R,M,O){E(M(R),O)}).on("error",u).on("warn",l),new Promise(function(R,M){var O;try{s.parse(e),p()}catch(G){O=G}var P=i.element;!O&&!P&&(O=Qn("failed to parse document as <"+i.type.$descriptor.name+">"));var j=a.warnings,$=a.references,I=a.elementsById;return O?(O.warnings=j,M(O)):R({rootElement:P,elementsById:I,references:$,warnings:j})})},xc.prototype.handler=function(e){return new Ec(this.model,e)};function sb(){var e=[];return Object.defineProperty(e,"peek",{value:function(){return this[this.length-1]}}),e}var cb=`<?xml version="1.0" encoding="UTF-8"?>
5
- `,ub=/<|>|'|"|&|\n\r|\n/g,Hp=/<|>|&/g;function mn(e){this.prefixMap={},this.uriMap={},this.used={},this.wellknown=[],this.custom=[],this.parent=e,this.defaultPrefixMap=e&&e.defaultPrefixMap||{}}mn.prototype.mapDefaultPrefixes=function(e){this.defaultPrefixMap=e},mn.prototype.defaultUriByPrefix=function(e){return this.defaultPrefixMap[e]},mn.prototype.byUri=function(e){return this.uriMap[e]||this.parent&&this.parent.byUri(e)},mn.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)},mn.prototype.uriByPrefix=function(e){return this.prefixMap[e||"xmlns"]||this.parent&&this.parent.uriByPrefix(e)},mn.prototype.mapPrefix=function(e,t){this.prefixMap[e||"xmlns"]=t},mn.prototype.getNSKey=function(e){return e.prefix!==void 0?e.uri+"|"+e.prefix:e.uri},mn.prototype.logUsed=function(e){var t=e.uri,n=this.getNSKey(e);this.used[n]=this.byUri(t),this.parent&&this.parent.logUsed(e)},mn.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 lb(e){return e.charAt(0).toLowerCase()+e.slice(1)}function pb(e,t){return Np(t)?lb(e):e}function zp(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})}function Vp(e){return kt(e)?e:(e.prefix?e.prefix+":":"")+e.localName}function fb(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 db(e,t){return t.isGeneric?k({localName:t.ns.localName},e):k({localName:pb(t.ns.localName,t.$pkg)},e)}function hb(e,t){return k({localName:t.ns.localName},e)}function mb(e){var t=e.$descriptor;return ye(t.properties,function(n){var i=n.name;if(n.isVirtual||!Dt(e,i))return!1;var r=e[i];return r===n.default||r===null?!1:n.isMany?r.length:!0})}var gb={"\n":"#10","\n\r":"#10",'"':"#34","'":"#39","<":"#60",">":"#62","&":"#38"},vb={"<":"lt",">":"gt","&":"amp"};function Gp(e,t,n){return e=kt(e)?e:""+e,e.replace(t,function(i){return"&"+n[i]+";"})}function yb(e){return Gp(e,ub,gb)}function _b(e){return Gp(e,Hp,vb)}function bb(e){return ye(e,function(t){return t.isAttr})}function Eb(e){return ye(e,function(t){return!t.isAttr})}function wc(e){this.tagName=e}wc.prototype.build=function(e){return this.element=e,this},wc.prototype.serializeTo=function(e){e.appendIndent().append("<"+this.tagName+">"+this.element.id+"</"+this.tagName+">").appendNewLine()};function ki(){}ki.prototype.serializeValue=ki.prototype.serializeTo=function(e){e.append(this.escape?_b(this.value):this.value)},ki.prototype.build=function(e,t){return this.value=t,e.type==="String"&&t.search(Hp)!==-1&&(this.escape=!0),this};function Sc(e){this.tagName=e}zp(Sc,ki),Sc.prototype.serializeTo=function(e){e.appendIndent().append("<"+this.tagName+">"),this.serializeValue(e),e.append("</"+this.tagName+">").appendNewLine()};function Fe(e,t){this.body=[],this.attrs=[],this.parent=e,this.propertyDescriptor=t}Fe.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=mb(e),this.parseAttributes(bb(r)),this.parseContainments(Eb(r))),this.parseGenericAttributes(e,i),this},Fe.prototype.nsTagName=function(e){var t=this.logNamespaceUsed(e.ns);return db(t,e)},Fe.prototype.nsPropertyTagName=function(e){var t=this.logNamespaceUsed(e.ns);return hb(t,e)},Fe.prototype.isLocalNs=function(e){return e.uri===this.ns.uri},Fe.prototype.nsAttributeName=function(e){var t;if(kt(e)?t=bt(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}:k({localName:t.localName},n)},Fe.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}))},Fe.prototype.parseGenericContainments=function(e){var t=e.$body;t&&this.body.push(new ki().build({type:"String"},t));var n=e.$children;n&&A(n,i=>{this.body.push(new Fe(this).build(i))})},Fe.prototype.parseNsAttribute=function(e,t,n){var i=e.$model,r=bt(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)}},Fe.prototype.parseNsAttributes=function(e){var t=this,n=e.$attrs,i=[];return A(n,function(r,o){var a=t.parseNsAttribute(e,o,r);a&&i.push(a)}),i},Fe.prototype.parseGenericAttributes=function(e,t){var n=this;A(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)}})},Fe.prototype.parseContainments=function(e){var t=this,n=this.body,i=this.element;A(e,function(r){var o=i.get(r.name),a=r.isReference,s=r.isMany;if(s||(o=[o]),r.isBody)n.push(new ki().build(r,o[0]));else if(Mp(r.type))A(o,function(u){n.push(new Sc(t.addTagName(t.nsPropertyTagName(r))).build(r,u))});else if(a)A(o,function(u){n.push(new wc(t.addTagName(t.nsPropertyTagName(r))).build(u))});else{var c=jp(r);A(o,function(u){var l;c?c===$p?l=new Fe(t,r):l=new Ko(t,r,c):l=new Fe(t),n.push(l.build(u))})}})},Fe.prototype.getNamespaces=function(e){var t=this.namespaces,n=this.parent,i;return t||(i=n&&n.getNamespaces(),e||!i?this.namespaces=t=new mn(i):t=i),t},Fe.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},Fe.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},Fe.prototype.parseAttributes=function(e){var t=this,n=this.element;A(e,function(i){var r=n.get(i.name);if(i.isReference)if(!i.isMany)r=r.id;else{var o=[];A(r,function(a){o.push(a.id)}),r=o.join(" ")}t.addAttribute(t.nsAttributeName(i),r)})},Fe.prototype.addTagName=function(e){var t=this.logNamespaceUsed(e);return this.getNamespaces().logUsed(t),Vp(e)},Fe.prototype.addAttribute=function(e,t){var n=this.attrs;kt(t)&&(t=yb(t));var i=Cp(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)},Fe.prototype.serializeAttributes=function(e){var t=this.attrs,n=this.namespaces;n&&(t=fb(n).concat(t)),A(t,function(i){e.append(" ").append(Vp(i.name)).append('="').append(i.value).append('"')})},Fe.prototype.serializeTo=function(e){var t=this.body[0],n=t&&t.constructor!==ki;e.appendIndent().append("<"+this.tagName),this.serializeAttributes(e),e.append(t?">":" />"),t&&(n&&e.appendNewLine().indent(),A(this.body,function(i){i.serializeTo(e)}),n&&e.unindent().appendIndent(),e.append("</"+this.tagName+">")),e.appendNewLine()};function Ko(e,t,n){Fe.call(this,e,t),this.serialization=n}zp(Ko,Fe),Ko.prototype.parseNsAttributes=function(e){var t=Fe.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},Ko.prototype.isLocalNs=function(e){return e.uri===(this.typeNs||this.ns).uri};function xb(){this.value="",this.write=function(e){this.value+=e}}function wb(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 Sb(e){e=k({format:!1,preamble:!0},e||{});function t(n,i){var r=i||new xb,o=new wb(r,e.format);e.preamble&&o.append(cb);var a=new Fe,s=n.$model;if(a.getNamespaces().mapDefaultPrefixes(Rb(s)),a.build(n).serializeTo(o),!i)return r.value}return{toXML:t}}function Rb(e){const t=e.config&&e.config.nsMap||{},n={};for(const i in yc)n[i]=yc[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 Xo(e,t){Yt.call(this,e,t)}Xo.prototype=Object.create(Yt.prototype),Xo.prototype.fromXML=function(e,t,n){kt(t)||(n=t,t="bpmn:Definitions");var i=new xc(k({model:this,lax:!0},n)),r=i.handler(t);return i.fromXML(e,r)},Xo.prototype.toXML=function(e,t){var n=new Sb(t);return new Promise(function(i,r){try{var o=n.toXML(e);return i({xml:o})}catch(a){return r(a)}})};var Cb="BPMN20",Pb="http://www.omg.org/spec/BPMN/20100524/MODEL",Ab="bpmn",Tb=[],Mb=[{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"}]}],kb=[{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"}]}],Db={tagAlias:"lowerCase",typePrefix:"t"},Ob={name:Cb,uri:Pb,prefix:Ab,associations:Tb,types:Mb,enumerations:kb,xml:Db},Ib="BPMNDI",Lb="http://www.omg.org/spec/BPMN/20100524/DI",Bb="bpmndi",Nb=[{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"]}],$b=[{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"}]}],jb=[],Fb={name:Ib,uri:Lb,prefix:Bb,types:Nb,enumerations:$b,associations:jb},Hb="DC",zb="http://www.omg.org/spec/DD/20100524/DC",Vb="dc",Gb=[{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}]}],Wb=[],Ub={name:Hb,uri:zb,prefix:Vb,types:Gb,associations:Wb},qb="DI",Yb="http://www.omg.org/spec/DD/20100524/DI",Kb="di",Xb=[{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"}]}],Zb=[],Qb={tagAlias:"lowerCase"},Jb={name:qb,uri:Yb,prefix:Kb,types:Xb,associations:Zb,xml:Qb},e0="bpmn.io colors for BPMN",t0="http://bpmn.io/schema/bpmn/biocolor/1.0",n0="bioc",i0=[{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"}]}],r0=[],o0=[],a0={name:e0,uri:t0,prefix:n0,types:i0,enumerations:r0,associations:o0},s0="BPMN in Color",c0="http://www.omg.org/spec/BPMN/non-normative/color/1.0",u0="color",l0=[{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"}]}],p0=[],f0=[],d0={name:s0,uri:c0,prefix:u0,types:l0,enumerations:p0,associations:f0};const h0={bpmn:Ob,bpmndi:Fb,dc:Ub,di:Jb,bioc:a0,color:d0};function Wp(e,t){const n=k({},h0,e);return new Xo(n,t)}const m0={name:"bpmn-i18n",uri:"http://www.omg.org/spec/BPMN/non-normative/extensions/i18n/1.0",prefix:"i18n",types:[{name:"Translation",superClass:["Element"],properties:[{name:"id",isAttr:!0,isId:!0,type:"String"},{name:"body",isBody:!0,type:"String"},{name:"target",isAttr:!0,type:"String",default:"@name"},{name:"textFormat",isAttr:"true",type:"String",default:"text/plain"}]}],enumerations:[],associations:[],xml:{tagAlias:"lowerCase",typePrefix:"t"}},g0="http://www.omg.org/spec/BPMN/non-normative/extensions/i18n/1.0",Up="i18n",Zo={[Up]:m0,[sc]:Ep};function qp(){return Wp(Zo)}const Yp=qp();async function Rc(e){const{rootElement:t,warnings:n}=await Yp.fromXML(e,"bpmn:Definitions");return{definitions:t,warnings:n}}async function v0(e){const{xml:t}=await Yp.toXML(e,{format:!0});return t}function Cc(e){return e.map(t=>typeof t=="string"?t:t.message??String(t))}const Kp=new Set(["bpmn:Participant","bpmn:Lane","bpmn:Group","bpmn:SubProcess","bpmn:AdHocSubProcess","bpmn:Transaction"]),y0=1,_0=2;function ir(e){return e.kind==="edge-crosses-shape"?`x|${e.edge}|${e.shape}`:`o|${e.shapes[0]}|${e.shapes[1]}`}function b0(e,t,n,i){const r=n.x+i,o=n.y+i,a=n.x+n.width-i,s=n.y+n.height-i;if(a<=r||s<=o)return!1;const c=t.x-e.x,u=t.y-e.y;let l=0,p=1;const f=(d,h)=>{if(h===0)return d<=0;const g=d/h;if(h>0){if(g>p)return!1;g>l&&(l=g)}else{if(g<l)return!1;g<p&&(p=g)}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 E0(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 x0=(e,t)=>e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height;function Qo(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(b0(e.waypoints[o],e.waypoints[o+1],r,_0)){i.push(r);break}}return i}const Xp=e=>e.shapes.filter(t=>!t.container);function Hr(e){const t=[],n=e.shapes.filter(r=>!r.container);for(const r of e.edges)for(const o of Qo(r,n))t.push({kind:"edge-crosses-shape",edge:r.id,shape:o.id});const i=n.filter(r=>!r.attached);for(let r=0;r<i.length;r++)for(let o=r+1;o<i.length;o++){const a=i[r],s=i[o];if(!E0(a,s,y0))continue;const c=a.id<s.id?[a.id,s.id]:[s.id,a.id];t.push({kind:"shape-overlap",shapes:c,identical:x0(a,s)})}return t.sort((r,o)=>ir(r).localeCompare(ir(o)))}const un=e=>typeof e=="object"&&e!==null?e:void 0,gn=e=>typeof e=="number"?e:0,Pc=e=>{const t=un(e);return typeof(t==null?void 0:t.id)=="string"?t.id:void 0};function w0(e){const t=un(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=Pc(o);a&&n.push(a)}}return n}function Zp(e){var r,o;const t=[],n=[],i=((r=un(e))==null?void 0:r.diagrams)??[];for(const a of i){const s=un((o=un(a))==null?void 0:o.plane),c=(s==null?void 0:s.planeElement)??[];for(const u of c){const l=un(u);if(!l)continue;const p=un(l.bpmnElement),f=typeof(p==null?void 0:p.id)=="string"?p.id:void 0;if(!f)continue;const d=typeof(p==null?void 0:p.$type)=="string"?p.$type:"",h=un(l.bounds);if(h){const y=l.isExpanded===!1;t.push({id:f,type:d,x:gn(h.x),y:gn(h.y),width:gn(h.width),height:gn(h.height),container:Kp.has(d)&&!y,attached:(p==null?void 0:p.attachedToRef)!==void 0});continue}const g=l.waypoint;Array.isArray(g)&&n.push({id:f,type:d,waypoints:g.map(y=>{var S,w;return{x:gn((S=un(y))==null?void 0:S.x),y:gn((w=un(y))==null?void 0:w.y)}}),endpoints:w0(p)})}}return{shapes:t,edges:n}}function Qp(e){return Hr(Zp(e))}async function S0(e){const{definitions:t,warnings:n}=await Rc(e);return{findings:Qp(t),warnings:n}}function Jo(e){const t=[],n=[];for(const i of e.getAll()){const r=i;if(r.type==="label"||r.labelTarget)continue;const o=typeof r.type=="string"?r.type:"";if(o==="bpmn:Definitions"||o.startsWith("bpmndi:"))continue;const a=r.waypoints;if(a){n.push({id:r.id,type:o,waypoints:a.map(c=>({x:gn(c.x),y:gn(c.y)})),endpoints:[Pc(r.source),Pc(r.target)].filter(c=>!!c)});continue}if(typeof r.x!="number"||typeof r.y!="number")continue;const s=un(r.businessObject);t.push({id:r.id,type:o,x:r.x,y:r.y,width:gn(r.width),height:gn(r.height),container:Kp.has(o)&&r.collapsed!==!0,attached:(s==null?void 0:s.attachedToRef)!==void 0})}return{shapes:t,edges:n}}const R0={"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 C0(e,t){const n=R0[e];return n||(e==="label"||e.startsWith("bpmndi:")?"other":e.startsWith("bpmn:")&&!("waypoints"in t&&t.waypoints)?"flowNode":"other")}function Jp(e){let t=e.parent;for(;t;){if(t.type==="bpmn:Participant")return t.id;t=t.parent}}function ef(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 C0(i.type,i)},lanesOf:n=>t().filter(i=>i.type==="bpmn:Lane"&&Jp(i)===n).sort((i,r)=>i.y-r.y).map(i=>i.id),participantOf:n=>{const i=e.get(n);return i?Jp(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 P0=20,A0=4,ea=(e,t)=>Math.abs(e-t)<.5;function tf(e,t,n,i=P0){if(ea(e.y,t.y)&&!ea(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(ea(e.x,t.x)&&!ea(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}const T0=(e,t,n)=>[...e.slice(0,t+1),...n,...e.slice(t+1)],nf=(e,t,n)=>Qo({...e,waypoints:t},n).length;function rf(e,t,n){let i=[...e.waypoints],r=nf(e,i,t);if(r===0)return null;let o=!1;const a=s=>!n||s.every(c=>c.x>=n.x&&c.x<=n.x+n.width&&c.y>=n.y&&c.y<=n.y+n.height);for(let s=0;s<A0&&r>0;s++){let c=!1;for(let u=0;u+1<i.length&&!c;u++){const l=i[u],p=i[u+1];for(const f of t){if(e.endpoints.includes(f.id)||Qo({...e,waypoints:[l,p]},[f]).length===0)continue;const d=tf(l,p,f);if(!d)continue;const h=[...d].sort((g,y)=>Number(a(y))-Number(a(g)));for(const g of h){const y=T0(i,u,g),S=nf(e,y,t);if(S<r){i=y,r=S,c=!0,o=!0;break}}if(c)break}}if(!c)break}return o&&r===0?i:null}function of(e,t){const{elementRegistry:n}=e,i=e.modeling,r=Jo(n),o=Xp(r),a=Hr(r).filter(c=>c.kind==="edge-crosses-shape"&&!t.has(ir(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=rf(u,o,f);d&&i.updateWaypoints(l,d)}}const M0=/^[\p{L}_][\p{L}\p{N}_.\-]*$/u,af=new Set(["sequenceFlow","messageFlow","dataAssociation","association"]),sf={"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}]},ta=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),Ac=e=>typeof e=="string"&&e!=="";function k0(e){const t=[];function n(i,r,o,a){if(a===null){Ac(o)||t.push({kind:"payload-invalid",opIndex:i,field:r});return}if(!ta(o)){t.push({kind:"payload-invalid",opIndex:i,field:r});return}for(const s of a)Ac(o[s])||t.push({kind:"payload-invalid",opIndex:i,field:`${r}.${s}`})}return e.forEach((i,r)=>{if(!ta(i)||!Ac(i.kind)||!(i.kind in sf)){t.push({kind:"payload-invalid",opIndex:r,field:"kind"});return}for(const o of sf[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(!ta(u))break;u=u[p]}if(!ta(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))}}}),t}function cf(e,t){const n=k0(e);if(n.length>0)return n;const i=[],r=new Map,o=new Map;function a(f,d,h){if(!M0.test(d)){i.push({kind:"id-invalid",opIndex:f,id:d});return}if(t.categoryOf(d)!==void 0||r.has(d)){i.push({kind:"id-duplicate",opIndex:f,id:d});return}r.set(d,{...h,opIndex:f})}e.forEach((f,d)=>{var h;switch(f.kind){case"participant.add":a(d,f.participant.id,{category:"participant",lanes:(f.participant.lanes??[]).map(g=>g.id)});for(const g of f.participant.lanes??[])a(d,g.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 g of f.associations??[])g.id&&a(d,g.id,{category:"dataAssociation"});break;case"dataAssociation.add":f.association.id&&a(d,f.association.id,{category:"dataAssociation"});break;case"association.add":f.association.id&&a(d,f.association.id,{category:"association"});break;case"annotation.add":a(d,f.annotation.id,{category:"annotation"}),(h=f.association)!=null&&h.id&&a(d,f.association.id,{category:"association"});break;case"group.add":a(d,f.group.id,{category:"group"});break;case"participant.update":if(f.lanes){o.set(f.id,f.lanes.map(g=>g.id));for(const g of f.lanes)t.categoryOf(g.id)===void 0&&a(d,g.id,{category:"lane"})}break}});const s=f=>{var d;return((d=r.get(f))==null?void 0:d.category)??t.categoryOf(f)},c=f=>{const d=r.get(f);return d?d.category==="participant"?f:d.participant:t.categoryOf(f)==="participant"?f:t.participantOf(f)};function u(f,d,h,g){const y=s(d);if(y===void 0){i.push({kind:"ref-missing",opIndex:f,ref:d,role:h});return}if(g&&!g.includes(y)){i.push({kind:"ref-category",opIndex:f,ref:d,role:h,expected:g.join("|"),actual:y});return}return y}const l=t.isCollaboration()||e.some(f=>f.kind==="participant.add");return e.forEach((f,d)=>{var h;switch(f.kind){case"participant.add":break;case"node.add":{const{participant:g,lane:y}=f.node;if(g===void 0){(l||y!==void 0)&&i.push({kind:"participant-required",opIndex:d,id:f.node.id});break}if(u(d,g,"participant",["participant"])===void 0)break;y!==void 0&&((((h=r.get(g))==null?void 0:h.lanes)??o.get(g)??t.lanesOf(g)).includes(y)||i.push({kind:"lane-unknown",opIndex:d,lane:y,participant:g}));break}case"sequenceFlow.add":{const{id:g,source:y,target:S,name:w,condition:E}=f.flow,x=u(d,y,"source",["flowNode"]),R=u(d,S,"target",["flowNode"]);x&&R&&c(y)!==c(S)&&i.push({kind:"flow-cross-pool",opIndex:d,id:g}),w!==void 0&&E!==void 0&&i.push({kind:"condition-name-conflict",opIndex:d,id:g});break}case"messageFlow.add":{const{id:g,source:y,target:S}=f.flow,w=u(d,y,"source",["flowNode","participant"]),E=u(d,S,"target",["flowNode","participant"]);if(w&&E){const x=c(y),R=c(S);x!==void 0&&x===R&&i.push({kind:"message-flow-same-pool",opIndex:d,id:g})}break}case"dataStore.add":{for(const g of f.associations??[]){if([g.source,g.target].filter(w=>w===f.dataStore.id).length!==1){i.push({kind:"data-association-ends",opIndex:d,source:g.source,target:g.target});continue}const S=g.source===f.dataStore.id?g.target:g.source;u(d,S,"dataAssociation",["flowNode"])}break}case"dataAssociation.add":{const{source:g,target:y}=f.association,S=u(d,g,"source"),w=u(d,y,"target");if(S&&w){const E=new Set([S,w]);E.has("dataStore")&&E.has("flowNode")||i.push({kind:"data-association-ends",opIndex:d,source:g,target:y})}break}case"association.add":{const{id:g,source:y,target:S}=f.association,w=u(d,y,"source"),E=u(d,S,"target");w&&E&&w!=="annotation"&&E!=="annotation"&&i.push({kind:"association-detached",opIndex:d,annotation:g??`${y}->${S}`});break}case"annotation.add":{if(f.association){const{source:g,target:y}=f.association;if(g!==f.annotation.id&&y!==f.annotation.id)i.push({kind:"association-detached",opIndex:d,annotation:f.annotation.id});else{const S=g===f.annotation.id?y:g;u(d,S,"association")}}f.placement&&u(d,f.placement.anchor,"anchor");break}case"group.add":{for(const g of f.group.members??[]){const y=u(d,g,"member");y&&af.has(y)&&i.push({kind:"ref-category",opIndex:d,ref:g,role:"member",expected:"shape",actual:y})}break}case"participant.update":{if(p(d,f.id,"participant")===void 0)break;if(f.lanes){const g=t.lanesOf(f.id),y=f.lanes.map(w=>w.id);for(const w of g)y.includes(w)||i.push({kind:"lane-shrink-unsupported",opIndex:d,participant:f.id,lane:w});for(const w of y)t.categoryOf(w)!==void 0&&!g.includes(w)&&i.push({kind:"id-duplicate",opIndex:d,id:w});const S=y.filter(w=>g.includes(w));S.length===g.length&&S.some((w,E)=>w!==g[E])&&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 g=t.participantOf(f.id);(g?o.get(g)??t.lanesOf(g):[]).includes(f.lane)||i.push({kind:"lane-unknown",opIndex:d,lane:f.lane,participant:g??""})}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 g=f.source===void 0||u(d,f.source,"source",["flowNode"])!==void 0,y=f.target===void 0||u(d,f.target,"target",["flowNode"])!==void 0,S=t.endpointsOf(f.id),w=f.source??(S==null?void 0:S.source),E=f.target??(S==null?void 0:S.target);g&&y&&w!==void 0&&E!==void 0&&new Set([c(w),c(E),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 g of f.members??[]){const y=u(d,g,"member");y&&af.has(y)&&i.push({kind:"ref-category",opIndex:d,ref:g,role:"member",expected:"shape",actual:y})}break}case"element.remove":{p(d,f.id)==="lane"&&i.push({kind:"ref-category",opIndex:d,ref:f.id,role:"target",expected:"removable",actual:"lane"});break}}}),i;function p(f,d,h){if(r.has(d)){i.push({kind:"target-added-in-batch",opIndex:f,id:d});return}const g=t.categoryOf(d);if(g===void 0){i.push({kind:"ref-missing",opIndex:f,ref:d,role:"target"});return}if(h&&g!==h){i.push({kind:"ref-category",opIndex:f,ref:d,role:"target",expected:h,actual:g});return}return g}}function uf(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 na(e){return`bpmn:${e[0].toUpperCase()}${e.slice(1)}`}const lf={"top-left":[-1,-1],top:[0,-1],"top-right":[1,-1],right:[1,0],"bottom-right":[1,1],bottom:[0,1],"bottom-left":[-1,1],left:[-1,0]};function dt(e,t){return e.filter(n=>n.kind===t)}function pf(e,t){var N,B,F,ge;const{modeling:n,bpmnFactory:i,elementFactory:r,elementRegistry:o,canvas:a,autoPlace:s,bpmnReplace:c}=t,u=()=>a.getRootElement(),l=D=>o.get(D),p=D=>{const b=l(D);if(!b)throw new Error(`하강 참조 해소 실패: ${D}`);return b},f=D=>{let b=D.parent;for(;b;){if(b.type==="bpmn:Participant")return b;b=b.parent}},d=dt(e,"participant.add"),h=dt(e,"node.add"),g=dt(e,"sequenceFlow.add"),y=dt(e,"messageFlow.add"),S=dt(e,"dataStore.add"),w=dt(e,"dataAssociation.add"),E=dt(e,"annotation.add"),x=dt(e,"group.add"),R=new Map(h.map(D=>[D.node.id,D])),M=(D,b,m)=>{var U;const v=D.businessObject,C=(((U=v.extensionElements)==null?void 0:U.values)??[]).filter(K=>K.$type!==b),T=m?[...C,i.create(b,m)]:C;if(!T.length){v.extensionElements&&n.updateProperties(D,{extensionElements:void 0});return}const L=i.create("bpmn:ExtensionElements",{values:T});T.forEach(K=>{K.$parent=L}),n.updateProperties(D,{extensionElements:L})},O=D=>({anchor:D.anchor,side:D.side,...D.offset!==void 0?{offset:D.offset}:{}});for(const D of dt(e,"element.remove")){const b=l(D.id);b&&n.removeElements([b])}const P=D=>o.filter(b=>{var m;return b.type==="bpmn:Lane"&&((m=f(b))==null?void 0:m.id)===D}).sort((b,m)=>b.y-m.y);for(const D of dt(e,"participant.update")){const b=p(D.id);if(D.name!==void 0&&n.updateProperties(b,{name:D.name??void 0}),!D.lanes)continue;const m=P(D.id);if(!m.length){n.splitLane(b,D.lanes.length),P(D.id).forEach((C,T)=>{const L=D.lanes[T];L&&n.updateProperties(C,{id:L.id,name:L.name})});continue}const v=new Set(m.map(C=>C.id));D.lanes.forEach((C,T)=>{if(v.has(C.id)){n.updateProperties(p(C.id),{name:C.name});return}const L=T===0?n.addLane(P(D.id)[0],"top"):n.addLane(p(D.lanes[T-1].id),"bottom");n.updateProperties(L,{id:C.id,name:C.name})})}const j=d.map((D,b)=>({op:D,declared:b}));j.sort((D,b)=>{const m=D.op.order??Number.POSITIVE_INFINITY,v=b.op.order??Number.POSITIVE_INFINITY;return m!==v?m-v:D.declared-b.declared});let $=80;for(const D of o.getAll())D.parent===u()&&"height"in D&&typeof D.y=="number"&&($=Math.max($,D.y+D.height+60));for(const{op:D}of j){const b=D.participant,m=h.filter(ae=>ae.node.participant===b.id).length,v=((N=b.lanes)==null?void 0:N.length)??0,C=Math.max(1200,m*160+300),T=b.blackBox||m+v===0?120:Math.max(300,v*180),L=r.createShape({type:"bpmn:Participant",businessObject:i.create("bpmn:Participant",{id:b.id,name:b.name,...D.order!==void 0?{"bwl:poolOrder":D.order}:{},...b.blackBox?{}:{processRef:i.create("bpmn:Process")}}),width:C,height:T,isExpanded:!0}),U=n.createShape(L,{x:100+C/2,y:$+T/2},u()),K=b.lanes??[];K.length&&n.splitLane(U,K.length),K.length&&o.filter(Pe=>{var we;return Pe.type==="bpmn:Lane"&&((we=f(Pe))==null?void 0:we.id)===b.id}).sort((Pe,we)=>Pe.y-we.y).forEach((Pe,we)=>{const he=K[we];he&&n.updateProperties(Pe,{id:he.id,name:he.name})}),$=U.y+U.height+60}const I=D=>{var v;const b=R.get(D);if(b)return b.node.participant??"";const m=l(D);return m?m.type==="bpmn:Participant"?m.id:((v=f(m))==null?void 0:v.id)??"":""},G=new Map,ie=D=>{let b=G.get(D);return b||G.set(D,b={nodes:[],flows:[]}),b};for(const D of h)ie(D.node.participant??"").nodes.push(D);for(const D of g)ie(I(D.flow.source)).flows.push(D);const Te=D=>{var b;return i.create("bpmn:SequenceFlow",{id:D.id,name:D.name??((b=D.condition)==null?void 0:b.label)})},tt=(D,b)=>r.createShape({type:na(D.type),businessObject:i.create(na(D.type),{id:D.id,name:D.name,...b!==void 0?{"bwl:band":b}:{}})});for(const[D,b]of G){const m=D?p(D):void 0,v=m?m.x+150:250;let C=m?m.y+80:120;const T=he=>{const _e=p(he);return _e.y+_e.height/2},L=(he,_e)=>he.node.lane?T(he.node.lane):he.band!==void 0&&m?m.y+80+he.band*150:_e,U=he=>he.participant?p(he.participant):u(),K=new Set(b.flows.map(he=>he.flow.target)),ae=new Map;for(const he of b.nodes){if(K.has(he.node.id))continue;const _e=tt(he.node,he.band),je=he.node.lane??(he.band!==void 0?`band:${he.band}`:""),Ce=ae.get(je)??v;n.createShape(_e,{x:Ce,y:L(he,C)},U(he.node)),ae.set(je,Ce+_e.width+130),!he.node.lane&&he.band===void 0&&(C+=160)}const Pe=new Set;let we=0;for(;we++<b.nodes.length+2;){for(let je=0;je<b.nodes.length+b.flows.length+2;je++){let Ce=!1;for(const Be of b.flows){const $e=Be.flow;if(Pe.has($e.id))continue;const ct=l($e.source);if(!ct)continue;const zt=l($e.target),St=R.get($e.target);if(!zt&&St){const qt=tt(St.node,St.band),nt=St.node.lane?T(St.node.lane):St.band!==void 0&&m?m.y+80+St.band*150:void 0;if(nt!==void 0){const Ki=n.createShape(qt,{x:ct.x+ct.width+130,y:nt},U(St.node));n.connect(ct,Ki,{type:"bpmn:SequenceFlow",businessObject:Te($e)})}else s.append(ct,qt,{connection:{type:"bpmn:SequenceFlow",businessObject:Te($e)}})}else if(zt)n.connect(ct,zt,{type:"bpmn:SequenceFlow",businessObject:Te($e)});else continue;Pe.add($e.id),Ce=!0}if(!Ce)break}const he=b.nodes.filter(je=>!l(je.node.id));if(!he.length)break;const _e=he[0];n.createShape(tt(_e.node,_e.band),{x:v,y:L(_e,C)},U(_e.node)),!_e.node.lane&&_e.band===void 0&&(C+=160)}}const W=40;for(const D of dt(e,"sequenceFlow.update")){if(D.target===void 0)continue;const b=R.get(D.target);if(!b)continue;const m=l(D.target),v=l(D.id);if(!m||!v)continue;const C=D.source!==void 0?l(D.source):v.source,T=v.target;if(!C||!T||T.id===m.id)continue;const L=[m],U=new Set([D.target]);for(let _e=0;_e<L.length;_e++){const je=L[_e].id;for(const Ce of g){const Be=Ce.flow.target;if(Ce.flow.source!==je||U.has(Be)||!R.has(Be))continue;U.add(Be);const $e=l(Be);$e&&L.push($e)}}const K=Math.min(...L.map(_e=>_e.x)),ae=Math.max(...L.map(_e=>_e.x+_e.width)),Pe=C.x+C.width,we=ae-K+W*2-(T.x-Pe);if(we>0){const _e=f(m),je=(_e==null?void 0:_e.children)??[],Ce=ct=>ct.type==="bpmn:Lane",Be=je.filter(ct=>!("waypoints"in ct&&ct.waypoints)&&!Ce(ct)&&!U.has(ct.id)&&ct.x>=T.x),$e=_e?[_e,...je.filter(ct=>Ce(ct))]:[];Be.length&&n.createSpace(Be,$e,{x:we,y:0},"e",T.x-1)}const he=b.node.lane||b.band!==void 0?m.y+m.height/2:C.y+C.height/2;n.moveElements(L,{x:Pe+W-K,y:he-(m.y+m.height/2)})}const J=(D,b)=>{const m=b.target===D,v=p(b.source),C=p(b.target),T=m?"bpmn:DataOutputAssociation":"bpmn:DataInputAssociation";n.connect(v,C,b.id?{type:T,businessObject:i.create(T,{id:b.id})}:{type:T})};for(const D of S){const b=D.associations??[],m=b.map(T=>T.source===D.dataStore.id?T.target:T.source).map(l).find(Boolean),v=m?f(m)??u():u(),C=m?{x:m.x+m.width/2,y:m.y+m.height+110}:{x:200,y:$+60};n.createShape({type:"bpmn:DataStoreReference",businessObject:i.create("bpmn:DataStoreReference",{id:D.dataStore.id,name:D.dataStore.name})},C,v);for(const T of b)J(D.dataStore.id,T)}for(const D of w){const m=p(D.association.target).type==="bpmn:DataStoreReference"?D.association.target:D.association.source;J(m,D.association)}for(const D of y){const b=D.flow;n.connect(p(b.source),p(b.target),{type:"bpmn:MessageFlow",businessObject:i.create("bpmn:MessageFlow",{id:b.id,name:b.name})})}let re=0;for(const D of x){const b=(D.group.members??[]).map(l).filter(T=>!!T),m=40;let v;if(b.length){const T=Math.min(...b.map(ae=>ae.x))-m,L=Math.min(...b.map(ae=>ae.y))-m,U=Math.max(...b.map(ae=>ae.x+ae.width))+m,K=Math.max(...b.map(ae=>ae.y+ae.height))+m;v={x:T,y:L,width:U-T,height:K-L}}else v={x:300+re*350,y:40,width:300,height:200},re++;const C=n.createShape({type:"bpmn:Group",businessObject:i.create("bpmn:Group",{id:D.group.id}),width:v.width,height:v.height},{x:v.x+v.width/2,y:v.y+v.height/2},u());D.group.name&&n.updateLabel(C,D.group.name),(B=D.group.members)!=null&&B.length&&M(C,"bwl:Members",{refs:D.group.members.join(" ")})}const Q=D=>{const b=D.waypoints;if(b!=null&&b.length){const v=b[Math.floor((b.length-1)/2)];return{x:v.x,y:v.y,width:0,height:0}}const m=D;return{x:m.x,y:m.y,width:m.width,height:m.height}};let ee=0;const q={width:100,height:30};for(const D of E){const b=D.association,m=((F=D.placement)==null?void 0:F.anchor)??(b?b.source===D.annotation.id?b.target:b.source:void 0),v=m?l(m):void 0,C=v?Q(v):void 0;let T;if(C&&D.placement){const[K,ae]=lf[D.placement.side],Pe=D.placement.offset??50;T={x:C.x+C.width/2+K*(C.width/2+q.width/2+Pe),y:C.y+C.height/2+ae*(C.height/2+q.height/2+Pe)}}else C?(T={x:C.x+C.width/2+180+ee%3*260,y:C.y-110-ee%2*95},ee++):(T={x:300+ee*260,y:60},ee++);const L=v?f(v)??u():u(),U=n.createShape({type:"bpmn:TextAnnotation",businessObject:i.create("bpmn:TextAnnotation",{id:D.annotation.id,text:D.annotation.text})},T,L);if(b){const K=ae=>ae===D.annotation.id?U:p(ae);n.connect(K(b.source),K(b.target),b.id?{type:"bpmn:Association",businessObject:i.create("bpmn:Association",{id:b.id})}:{type:"bpmn:Association"})}D.placement&&M(U,"bwl:Placement",O(D.placement))}for(const D of dt(e,"association.add")){const b=D.association;n.connect(p(b.source),p(b.target),b.id?{type:"bpmn:Association",businessObject:i.create("bpmn:Association",{id:b.id})}:{type:"bpmn:Association"})}for(const D of dt(e,"node.update")){let b=p(D.id);if(D.type&&na(D.type)!==b.type&&(b=c.replaceElement(b,{type:na(D.type)})),D.name!==void 0&&n.updateProperties(b,{name:D.name??void 0}),D.lane){const m=p(D.lane),v=m.y+m.height/2-(b.y+b.height/2);v!==0&&n.moveElements([b],{x:0,y:v})}}for(const D of dt(e,"sequenceFlow.update")){const b=p(D.id);if(D.source!==void 0||D.target!==void 0){const m=b,v=D.source!==void 0?p(D.source):m.source,C=D.target!==void 0?p(D.target):m.target,T=L=>({x:L.x+L.width/2,y:L.y+L.height/2});n.reconnect(m,v,C,[T(v),T(C)])}D.name!==void 0&&n.updateProperties(b,{name:D.name??void 0}),D.condition!==void 0&&n.updateProperties(b,{name:((ge=D.condition)==null?void 0:ge.label)??void 0})}for(const D of dt(e,"messageFlow.update"))D.name!==void 0&&n.updateProperties(p(D.id),{name:D.name??void 0});for(const D of dt(e,"dataStore.update"))D.name!==void 0&&n.updateProperties(p(D.id),{name:D.name??void 0});for(const D of dt(e,"annotation.update")){const b=p(D.id);if(D.text!==void 0&&n.updateProperties(b,{text:D.text}),D.placement===null)M(b,"bwl:Placement",null);else if(D.placement){const m=Q(p(D.placement.anchor)),[v,C]=lf[D.placement.side],T=D.placement.offset??50,L=m.x+m.width/2+v*(m.width/2+b.width/2+T),U=m.y+m.height/2+C*(m.height/2+b.height/2+T);n.moveElements([b],{x:L-(b.x+b.width/2),y:U-(b.y+b.height/2)}),M(b,"bwl:Placement",O(D.placement))}}for(const D of dt(e,"group.update")){const b=p(D.id);if(D.name!==void 0&&n.updateLabel(b,D.name??""),D.members){const m=D.members.map(l).filter(v=>!!v);if(m.length){const C=Math.min(...m.map(K=>K.x))-40,T=Math.min(...m.map(K=>K.y))-40,L=Math.max(...m.map(K=>K.x+K.width))+40,U=Math.max(...m.map(K=>K.y+K.height))+40;n.resizeShape(b,{x:C,y:T,width:L-C,height:U-T})}M(b,"bwl:Members",{refs:D.members.join(" ")})}}}function ff(e,t,n=pf){const i=uf(e),r=cf(t,ef(i.elementRegistry));if(r.length)return{ok:!1,issues:r,findings:[]};const o=new Set(Hr(Jo(i.elementRegistry)).map(ir)),a=e.get("commandStack");try{wp(a,()=>{n(t,i),of(i,o)})}catch(c){return{ok:!1,issues:[{kind:"lower-failed",message:c instanceof Error?c.message:String(c)}],findings:[]}}const s=Hr(Jo(i.elementRegistry)).filter(c=>!o.has(ir(c)));return{ok:!0,issues:[],findings:s}}function D0(e){const t=e.slice(e.indexOf(":")+1);return t.charAt(0).toLowerCase()+t.slice(1)}function O0(e,t){return typeof e.get=="function"?e.get(t):e[t]}function df(e,t){const n=O0(e,t);return typeof n=="number"&&Number.isFinite(n)?n:void 0}function hf(e,t){var i;return(((i=e.extensionElements)==null?void 0:i.values)??[]).find(r=>(r==null?void 0:r.$type)===t)}function I0(e){return typeof e=="string"&&cc.includes(e)}function vn(e){if(typeof e=="string")return e;const t=e==null?void 0:e.id;return typeof t=="string"?t:void 0}function mf(e){const t=e.rootElements??[],n=t.find(W=>W.$type==="bpmn:Collaboration"),i=new Map(t.filter(W=>W.$type==="bpmn:Process").map(W=>[W.id,W])),r=[],o=[],a=[],s=[],c=[],u=[],l={poolOrders:{},bands:{},placements:{}},p=[],f=[],d=[],h=[],g=[],y=[],S=new Set,w=new Set,E=W=>{W&&S.add(W)},x=W=>{S.add(W),w.add(W)},R=W=>{const J=hf(W,"bwl:Placement");if(!J)return;const re=typeof J.anchor=="string"?J.anchor:void 0;if(!re||!I0(J.side))return;const Q=typeof J.offset=="number"?J.offset:void 0;g.push({owner:W.id,anchor:re,side:J.side,...Q!==void 0?{offset:Q}:{}})},M=W=>{const J=hf(W,"bwl:Members"),re=typeof(J==null?void 0:J.refs)=="string"?J.refs.split(/\s+/).filter(Boolean):[];re.length&&y.push({owner:W.id,refs:re})},O=W=>{var J;for(const re of W)switch(E(re.id),re.$type){case"bpmn:TextAnnotation":x(re.id),s.push({id:re.id,text:typeof re.text=="string"?re.text:""}),R(re);break;case"bpmn:Association":d.push({id:re.id,type:re.$type,source:vn(re.sourceRef),target:vn(re.targetRef)});break;case"bpmn:Group":{x(re.id);const Q=(J=re.categoryValueRef)==null?void 0:J.value;c.push({id:re.id,...typeof Q=="string"&&Q?{name:Q}:{}}),M(re);break}default:u.push({id:re.id,type:re.$type,reason:"type-outside-mvp"})}},P=(W,J)=>{const re=W.flowElements??[],Q=(W.laneSets??[]).flatMap(q=>q.lanes??[]),ee=new Map;for(const q of Q){E(q.id);for(const N of q.flowNodeRef??[]){const B=vn(N);B&&ee.set(B,q.id)}}for(const q of re){if(E(q.id),q.$type==="bpmn:SequenceFlow"){p.push({id:q.id,source:vn(q.sourceRef),target:vn(q.targetRef),...typeof q.name=="string"&&q.name?{name:q.name}:{}});continue}if(q.$type==="bpmn:DataStoreReference"){x(q.id),a.push({id:q.id,...q.name?{name:q.name}:{}});continue}const N=D0(q.$type);if(!_p(N)){u.push({id:q.id,type:q.$type,reason:"type-outside-mvp"});continue}x(q.id),o.push({id:q.id,type:N,...q.name?{name:q.name}:{},...J?{participant:J}:{},...ee.has(q.id)?{lane:ee.get(q.id)}:{}});const B=df(q,"bwl:band");B!==void 0&&(l.bands[q.id]=B);for(const F of q.dataOutputAssociations??[])E(F.id),h.push({id:F.id,type:F.$type,source:q.id,target:vn(F.targetRef)});for(const F of q.dataInputAssociations??[])E(F.id),h.push({id:F.id,type:F.$type,source:vn((F.sourceRef??[])[0]),target:q.id})}O(W.artifacts??[])};if(n){const W=new Set;for(const J of n.participants??[]){x(J.id);const re=vn(J.processRef);re&&W.add(re);const Q=re?i.get(re):void 0,ee=((Q==null?void 0:Q.laneSets)??[]).flatMap(F=>F.lanes??[]),q=ee.map(F=>({id:F.id,...F.name?{name:F.name}:{}}));for(const F of q)x(F.id);const N=!Q||(Q.flowElements??[]).length===0&&ee.length===0&&(Q.artifacts??[]).length===0;r.push({id:J.id,...J.name?{name:J.name}:{},...N?{blackBox:!0}:{},...q.length?{lanes:q}:{}});const B=df(J,"bwl:poolOrder");B!==void 0&&(l.poolOrders[J.id]=B),Q&&P(Q,J.id)}for(const J of n.messageFlows??[])E(J.id),f.push({id:J.id,source:vn(J.sourceRef),target:vn(J.targetRef),...typeof J.name=="string"&&J.name?{name:J.name}:{}});O(n.artifacts??[]);for(const[J,re]of i)!W.has(J)&&(re.flowElements??[]).length>0&&u.push({id:J,type:re.$type,reason:"unreachable-process"})}else for(const W of i.values())P(W);const j=[],$=[],I=[],G=[],ie=(W,J)=>!!W&&!!J&&w.has(W)&&w.has(J);for(const W of p){if(!ie(W.source,W.target)){u.push({id:W.id,type:"bpmn:SequenceFlow",reason:"endpoint-outside-mvp"});continue}j.push({id:W.id,source:W.source,target:W.target,...W.name?{name:W.name}:{}}),w.add(W.id)}for(const W of f){if(!ie(W.source,W.target)){u.push({id:W.id,type:"bpmn:MessageFlow",reason:"endpoint-outside-mvp"});continue}$.push({id:W.id,source:W.source,target:W.target,...W.name?{name:W.name}:{}}),w.add(W.id)}for(const W of h){if(!ie(W.source,W.target)){u.push({id:W.id??"",type:W.type,reason:"endpoint-outside-mvp"});continue}G.push({...W.id?{id:W.id}:{},source:W.source,target:W.target}),W.id&&w.add(W.id)}for(const W of d){if(!ie(W.source,W.target)){u.push({id:W.id??"",type:W.type,reason:"endpoint-outside-mvp"});continue}I.push({...W.id?{id:W.id}:{},source:W.source,target:W.target})}const Te=new Map(c.map(W=>[W.id,W]));for(const{owner:W,refs:J}of y){const re=J.filter(ee=>S.has(ee)),Q=Te.get(W);Q&&re.length&&(Q.members=re)}for(const W of g)S.has(W.anchor)&&(l.placements[W.owner]={anchor:W.anchor,side:W.side,...W.offset!==void 0?{offset:W.offset}:{}});return{definition:{...r.length?{participants:r}:{},nodes:o,sequenceFlows:j,...$.length?{messageFlows:$}:{},...a.length?{dataStores:a}:{},...G.length?{dataAssociations:G}:{},...s.length?{annotations:s}:{},...I.length?{associations:I}:{},...c.length?{groups:c}:{}},hints:l,omitted:u}}async function L0(e){const{definitions:t,warnings:n}=await Rc(e);return{...mf(t),warnings:n}}function B0(e,t,n,i={}){return{documentId:e,baseVersion:t,ops:[...n],origin:i.origin??"agent",clientOpId:(i.mkClientOpId??(()=>crypto.randomUUID()))()}}async function gf(e,t,{currentVersion:n}){if(t.baseVersion!==n)return{status:"conflict",baseVersion:t.baseVersion,currentVersion:n};const i=ff(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}}const N0=Symbol("bpmn-editor");function $0(){const e=Ye.ref(!1),t=Ye.ref(!0),n=Ye.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 gf(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:Cc(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 X(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}function j0(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Tc={exports:{}},vf;function F0(){if(vf)return Tc.exports;vf=1;var e=Tc.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},Tc.exports}var H0=F0(),z0=j0(H0);function yn(e){if(!(this instanceof yn))return new yn(e);e=e||[128,36,1],this._seed=e.length?z0.rack(e[0],e[1],e[2]):e}yn.prototype.next=function(e){return this._seed(e||!0)},yn.prototype.nextPrefixed=function(e,t){var n;do n=e+this.next(!0);while(this.assigned(n));return this.claim(n,t),n},yn.prototype.claim=function(e,t){this._seed.set(e,t||!0)},yn.prototype.assigned=function(e){return this._seed.get(e)||!1},yn.prototype.unclaim=function(e){delete this._seed.hats[e]},yn.prototype.clear=function(){var e=this._seed.hats,t;for(t in e)this.unclaim(t)};const rt={legend:[1,"<fieldset>","</fieldset>"],tr:[2,"<table><tbody>","</tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],_default:[0,"",""]};rt.td=rt.th=[3,"<table><tbody><tr>","</tr></tbody></table>"],rt.option=rt.optgroup=[1,'<select multiple="multiple">',"</select>"],rt.thead=rt.tbody=rt.colgroup=rt.caption=rt.tfoot=[1,"<table>","</table>"],rt.polyline=rt.ellipse=rt.polygon=rt.circle=rt.text=rt.line=rt.path=rt.rect=rt.g=[1,'<svg xmlns="http://www.w3.org/2000/svg" version="1.1">',"</svg>"];function Ne(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(rt,i)?rt[i]:rt._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 V0(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 Ct(e,...t){const n=e.style;return A(t,function(i){i&&A(i,function(r,o){n[o]=r})}),e}function Et(e,t,n){return arguments.length==2?e.getAttribute(t):n===null?e.removeAttribute(t):(e.setAttribute(t,n),e)}const G0=Object.prototype.toString;function He(e){return new Jn(e)}function Jn(e){if(!e||!e.nodeType)throw new Error("A DOM element reference is required");this.el=e,this.list=e.classList}Jn.prototype.add=function(e){return this.list.add(e),this},Jn.prototype.remove=function(e){return G0.call(e)=="[object RegExp]"?this.removeMatching(e):(this.list.remove(e),this)},Jn.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},Jn.prototype.toggle=function(e,t){return typeof t<"u"?t!==this.list.toggle(e,t)&&this.list.toggle(e):this.list.toggle(e),this},Jn.prototype.array=function(){return Array.from(this.list)},Jn.prototype.has=Jn.prototype.contains=function(e){return this.list.contains(e)};function ia(e){for(var t;t=e.firstChild;)e.removeChild(t);return e}function Di(e,t,n){var i=n?e:e.parentNode;return i&&typeof i.closest=="function"&&i.closest(t)||null}function W0(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var ra={},yf;function U0(){if(yf)return ra;yf=1;var e,t,n;function i(){e=window.addEventListener?"addEventListener":"attachEvent",t=window.removeEventListener?"removeEventListener":"detachEvent",n=e!=="addEventListener"?"on":""}return ra.bind=function(r,o,a,s){return e||i(),r[e](n+o,a,s||!1),a},ra.unbind=function(r,o,a,s){return t||i(),r[t](n+o,a,s||!1),a},ra}var _f=U0(),q0=W0(_f),pe=V0({__proto__:null,default:q0},[_f]),bf=["focus","blur"];function Y0(e,t,n,i,r){return bf.indexOf(n)!==-1&&(r=!0),pe.bind(e,n,function(o){var a=o.target||o.srcElement;o.delegateTarget=Di(a,t,!0),o.delegateTarget&&i.call(e,o)},r)}function K0(e,t,n,i){return bf.indexOf(t)!==-1&&(i=!0),pe.unbind(e,t,n,i)}var It={bind:Y0,unbind:K0};function Mc(e,t){return e&&typeof e.matches=="function"&&e.matches(t)||!1}function Me(e,t){return t=t||document,t.querySelector(e)}function oa(e,t){return t=t||document,t.querySelectorAll(e)}function _n(e){e.parentNode&&e.parentNode.removeChild(e)}function X0(e,t){if(e.ownerDocument!==t.ownerDocument)try{return t.ownerDocument.importNode(e,!0)}catch{}return e}function Z0(e,t){return t.appendChild(X0(e,t))}function fe(e,t){return Z0(t,e),e}var kc=2,Ef={"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":kc,"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":kc,"text-anchor":1,"text-decoration":1,"text-rendering":1,"unicode-bidi":1,visibility:1,"word-spacing":1,"writing-mode":1};function Q0(e,t){return Ef[t]?e.style[t]:e.getAttributeNS(null,t)}function xf(e,t,n){var i=t.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase(),r=Ef[i];r?(r===kc&&typeof n=="number"&&(n=String(n)+"px"),e.style[i]=n):e.setAttributeNS(null,t,n)}function J0(e,t){var n=Object.keys(t),i,r;for(i=0,r;r=n[i];i++)xf(e,r,t[r])}function Z(e,t,n){if(typeof t=="string")if(n!==void 0)xf(e,t,n);else return Q0(e,t);else J0(e,t);return e}const eE=Object.prototype.toString;function xe(e){return new ei(e)}function ei(e){if(!e||!e.nodeType)throw new Error("A DOM element reference is required");this.el=e,this.list=e.classList}ei.prototype.add=function(e){return this.list.add(e),this},ei.prototype.remove=function(e){return eE.call(e)=="[object RegExp]"?this.removeMatching(e):(this.list.remove(e),this)},ei.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},ei.prototype.toggle=function(e,t){return typeof t<"u"?t!==this.list.toggle(e,t)&&this.list.toggle(e):this.list.toggle(e),this},ei.prototype.array=function(){return Array.from(this.list)},ei.prototype.has=ei.prototype.contains=function(e){return this.list.contains(e)};function aa(e){for(var t;t=e.firstChild;)e.removeChild(t);return e}function wf(e){return e.cloneNode(!0)}var Dc={svg:"http://www.w3.org/2000/svg"},Sf='<svg xmlns="'+Dc.svg+'"';function tE(e){var t=!1;e.substring(0,4)==="<svg"?e.indexOf(Dc.svg)===-1&&(e=Sf+e.substring(4)):(e=Sf+">"+e+"</svg>",t=!0);var n=nE(e);if(!t)return n;for(var i=document.createDocumentFragment(),r=n.firstChild;r.firstChild;)i.appendChild(r.firstChild);return i}function nE(e){var t;return t=new DOMParser,t.async=!1,t.parseFromString(e,"text/xml")}function te(e,t){var n;return e=e.trim(),e.charAt(0)==="<"?(n=tE(e).firstChild,n=document.importNode(n,!0)):n=document.createElementNS(Dc.svg,e),t&&Z(n,t),n}var Oc=null;function Rf(){return Oc===null&&(Oc=te("svg")),Oc}function Cf(e,t){var n,i,r=Object.keys(t);for(n=0;i=r[n];n++)e[i]=t[i];return e}function iE(e,t,n,i,r,o){var a=Rf().createSVGMatrix();switch(arguments.length){case 0:return a;case 1:return Cf(a,e);case 6:return Cf(a,{a:e,b:t,c:n,d:i,e:r,f:o})}}function zr(e){return Rf().createSVGTransform()}var Pf=/([&<>]{1})/g,rE=/([&<>\n\r"]{1})/g,oE={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"'"};function Ic(e,t){function n(i,r){return oE[r]||r}return e.replace(t,n)}function Af(e,t){var n,i,r,o,a;switch(e.nodeType){case 3:t.push(Ic(e.textContent,Pf));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,'="',Ic(o.value,rE),'"');if(e.hasChildNodes()){for(t.push(">"),a=e.childNodes,n=0,i=a.length;n<i;++n)Af(a.item(n),t);t.push("</",e.tagName,">")}else t.push("/>");break;case 8:t.push("<!--",Ic(e.nodeValue,Pf),"-->");break;case 4:t.push("<![CDATA[",e.nodeValue,"]]>");break;default:throw new Error("unable to handle node "+e.nodeType)}return t}function aE(e){for(var t=e.firstChild,n=[];t;)Af(t,n),t=t.nextSibling;return n.join("")}function Tf(e,t){return aE(e)}function ot(e){var t=e.parentNode;return t&&t.removeChild(e),e}function sE(e,t){return t instanceof SVGMatrix?e.createSVGTransformFromMatrix(t):t}function cE(e,t){var n,i;for(e.clear(),n=0;i=t[n];n++)e.appendItem(sE(e,i))}function Vr(e,t){var n=e.transform.baseVal;return t&&(Array.isArray(t)||(t=[t]),cE(n,t)),n.consolidate()}const uE=/^class[ {]/;function lE(e){return uE.test(e.toString())}function Lc(e){return Array.isArray(e)}function Bc(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function sa(...e){e.length===1&&Lc(e[0])&&(e=e[0]),e=[...e];const t=e.pop();return t.$inject=e,t}const pE=/constructor\s*[^(]*\(\s*([^)]*)\)/m,fE=/^(?:async\s+)?(?:function\s*[^(]*)?(?:\(\s*([^)]*)\)|(\w+))/m,dE=/\/\*([^*]*)\*\//m;function hE(e){if(typeof e!="function")throw new Error(`Cannot annotate "${e}". Expected a function!`);const t=e.toString().match(lE(e)?pE:fE);if(!t)return[];const n=t[1]||t[2];return n&&n.split(",").map(i=>{const r=i.match(dE);return(r&&r[1]||i).trim()})||[]}function Mf(e,t){const n=t||{get:function(E,x){if(i.push(E),x===!1)return null;throw s(`No provider for "${E}"!`)}},i=[],r=this._providers=Object.create(n._providers||null),o=this._instances=Object.create(null),a=o.injector=this,s=function(E){const x=i.join(" -> ");return i.length=0,new Error(x?`${E} (Resolving: ${x})`:E)};function c(E,x){if(!r[E]&&E.includes(".")){const R=E.split(".");let M=c(R.shift());for(;R.length;)M=M[R.shift()];return M}if(Bc(o,E))return o[E];if(Bc(r,E)){if(i.indexOf(E)!==-1)throw i.push(E),s("Cannot resolve circular dependency!");return i.push(E),o[E]=r[E][0](r[E][1]),i.pop(),o[E]}return n.get(E,x)}function u(E,x){if(typeof x>"u"&&(x={}),typeof E!="function")if(Lc(E))E=sa(E.slice());else throw s(`Cannot invoke "${E}". Expected a function!`);const M=(E.$inject||hE(E)).map(O=>Bc(x,O)?x[O]:c(O));return{fn:E,dependencies:M}}function l(E){const{fn:x,dependencies:R}=u(E),M=Function.prototype.bind.call(x,null,...R);return new M}function p(E,x,R){const{fn:M,dependencies:O}=u(E,R);return M.apply(x,O)}function f(E){return sa(x=>E.get(x))}function d(E,x){if(x&&x.length){const R=Object.create(null),M=Object.create(null),O=[],P=[],j=[];let $,I,G,ie;for(let Te in r)$=r[Te],x.indexOf(Te)!==-1&&($[2]==="private"?(I=O.indexOf($[3]),I===-1?(G=$[3].createChild([],x),ie=f(G),O.push($[3]),P.push(G),j.push(ie),R[Te]=[ie,Te,"private",G]):R[Te]=[j[I],Te,"private",P[I]]):R[Te]=[$[2],$[1]],M[Te]=!0),($[2]==="factory"||$[2]==="type")&&$[1].$scope&&x.forEach(tt=>{$[1].$scope.indexOf(tt)!==-1&&(R[Te]=[$[2],$[1]],M[tt]=!0)});x.forEach(Te=>{if(!M[Te])throw new Error('No provider for "'+Te+'". Cannot use provider from the parent!')}),E.unshift(R)}return new Mf(E,a)}const h={factory:p,type:l,value:function(E){return E}};function g(E,x){const R=E.__init__||[];return function(){R.forEach(M=>{typeof M=="string"?x.get(M):x.invoke(M)})}}function y(E){const x=E.__exports__;if(x){const R=E.__modules__,M=Object.keys(E).reduce((I,G)=>(G!=="__exports__"&&G!=="__modules__"&&G!=="__init__"&&G!=="__depends__"&&(I[G]=E[G]),I),Object.create(null)),O=(R||[]).concat(M),P=d(O),j=sa(function(I){return P.get(I)});x.forEach(function(I){r[I]=[j,I,"private",P]});const $=(E.__init__||[]).slice();return $.unshift(function(){P.init()}),E=Object.assign({},E,{__init__:$}),g(E,P)}return Object.keys(E).forEach(function(R){if(R==="__init__"||R==="__depends__")return;const M=E[R];if(M[2]==="private"){r[R]=M;return}const O=M[0],P=M[1];r[R]=[h[O],mE(O,P),O]}),g(E,a)}function S(E,x){return E.indexOf(x)!==-1||(E=(x.__depends__||[]).reduce(S,E),E.indexOf(x)!==-1)?E:E.concat(x)}function w(E){const x=E.reduce(S,[]).map(y);let R=!1;return function(){R||(R=!0,x.forEach(M=>M()))}}this.get=c,this.invoke=p,this.instantiate=l,this.createChild=d,this.init=w(e)}function mE(e,t){return e!=="value"&&Lc(t)&&(t=sa(t.slice())),t}var gE=1e3;function On(e,t){var n=this;t=t||gE,e.on(["render.shape","render.connection"],t,function(i,r){var o=i.type,a=r.element,s=r.gfx,c=r.attrs;if(n.canRender(a))return o==="render.shape"?n.drawShape(s,a,c):n.drawConnection(s,a,c)}),e.on(["render.getShapePath","render.getConnectionPath"],t,function(i,r){if(n.canRender(r))return i.type==="render.getShapePath"?n.getShapePath(r):n.getConnectionPath(r)})}On.prototype.canRender=function(e){},On.prototype.drawShape=function(e,t){},On.prototype.drawConnection=function(e,t){},On.prototype.getShapePath=function(e){},On.prototype.getConnectionPath=function(e){};function Oi(e){return e.flat().join(",").replace(/,?([A-Za-z]),?/g,"$1")}function vE(e){return["M",e.x,e.y]}function Nc(e){return["L",e.x,e.y]}function yE(e,t,n){return["C",e.x,e.y,t.x,t.y,n.x,n.y]}function _E(e,t){const n=e.length,i=[vE(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(Nc(a));continue}const c=Math.min(t,$c(a.x-o.x,a.y-o.y),$c(s.x-a.x,s.y-a.y));if(!c){i.push(Nc(a));continue}const u=ca(a,o,c),l=ca(a,o,c*.5),p=ca(a,s,c),f=ca(a,s,c*.5);i.push(Nc(u)),i.push(yE(l,f,p))}return i}function ca(e,t,n){const i=t.x-e.x,r=t.y-e.y,o=$c(i,r),a=n/o;return{x:e.x+i*a,y:e.y+r*a}}function $c(e,t){return Math.sqrt(Math.pow(e,2)+Math.pow(t,2))}function Gr(e,t,n){le(t)&&(n=t,t=null),t||(t={});const i=te("path",t);return le(n)&&(i.dataset.cornerRadius=String(n)),jc(i,e)}function jc(e,t){const n=parseInt(e.dataset.cornerRadius,10)||0;return Z(e,{d:Oi(_E(t,n))}),e}function ua(e){var t=new Set(e);return ye(e,function(n){for(var i=n.parent;i;){if(t.has(i))return!1;i=i.parent}return!0})}function Ii(e,t,n){n=n||0,se(e)||(e=[e]),A(e,function(i,r){var o=t(i,r,n);se(o)&&o.length&&Ii(o,t,n+1)})}function Fc(e,t,n){var i=new Set,r=new Set;return Ii(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 Wr(e,t){return Fc(e)}function bE(e,t,n){Pi(t)&&(t=!0),ut(t)&&(n=t,t=!0),n=n||{};var i=Ur(n.allShapes),r=Ur(n.allConnections),o=Ur(n.enclosedElements),a=Ur(n.enclosedConnections),s=Ur(n.topLevel,t&&Ji(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,A(l.incoming,c),A(l.outgoing,c),l.children}return Ii(e,u),{allShapes:i,allConnections:r,topLevel:s,enclosedConnections:a,enclosedElements:o}}function Ke(e,t){t=!!t,se(e)||(e=[e]);var n,i,r,o;return A(e,function(a){var s=a;a.waypoints&&!t&&(s=Ke(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 rr(e,t){var n={};return A(e,function(i){var r=i;r.waypoints&&(r=Ke(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 kf(e){return"waypoints"in e?"connection":"x"in e?"shape":"root"}function Df(e){return!!(e&&e.isFrame)}function Ur(e,t){return k({},e||{},t||{})}var EE=1;function ti(e,t){On.call(this,e,EE),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})}X(ti,On),ti.prototype.canRender=function(){return!0},ti.prototype.drawShape=function(t,n,i){var r=te("rect");return Z(r,{x:0,y:0,width:n.width||0,height:n.height||0}),Df(n)?Z(r,k({},this.FRAME_STYLE,i||{})):Z(r,k({},this.SHAPE_STYLE,i||{})),fe(t,r),r},ti.prototype.drawConnection=function(t,n,i){var r=Gr(n.waypoints,k({},this.CONNECTION_STYLE,i||{}));return fe(t,r),r},ti.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 Oi(a)},ti.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 Oi(o)},ti.$inject=["eventBus","styles"];function xE(){var e={"no-fill":{fill:"none"},"no-border":{strokeOpacity:0},"no-events":{pointerEvents:"none"}},t=this;this.cls=function(n,i,r){var o=this.style(i,r);return k(o,{class:n})},this.style=function(n,i){!se(n)&&!i&&(i=n,n=[]);var r=Ot(n,function(o,a){return k(o,e[a]||{})},{});return i?k(r,i):r},this.computeStyle=function(n,i,r){return se(i)||(r=i,i=[]),t.style(i||[],k({},r,n||{}))}}const wE={__init__:["defaultRenderer"],defaultRenderer:["type",ti],styles:["type",xE]};function Ue(e,t){if(!e||!t)return-1;var n=e.indexOf(t);return n!==-1&&e.splice(n,1),n}function qe(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 Hc(e,t){return!e||!t?-1:e.indexOf(t)}function qr(e,t){return!e||!t?-1:Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function zc(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=qr(e,t);return Math.abs(r/o)<=i}var SE=2;function In(e,t){var n=Array.from(arguments).flat();const i={x:"v",y:"h"};for(const[r,o]of Object.entries(i))if(RE(r,n))return o;return!1}function RE(e,t){const n=t[0];return Ai(t,function(i){return Math.abs(n[e]-i[e])<=SE})}function Of(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 Vc(e,t){return{x:Math.round(e.x+(t.x-e.x)/2),y:Math.round(e.y+(t.y-e.y)/2)}}var CE=/,?([a-z]),?/gi,If=parseFloat,Xe=Math,ni=Xe.PI,bn=Xe.min,En=Xe.max,Lf=Xe.pow,ii=Xe.abs,PE=/([a-z])[\s,]*((-?\d*\.?\d*(?:e[-+]?\d+)?[\s]*,?[\s]*)+)/ig,AE=/(-?\d*\.?\d*(?:e[-+]?\d+)?)[\s]*,?[\s]*/ig,Bf=Array.isArray||function(e){return e instanceof Array};function TE(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function ME(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 kE(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 TE(r,i)?(ME(o,i),r[i]):(o.length>=1e3&&delete r[o.shift()],o.push(i),r[i]=e(...arguments),r[i])}return t}function DE(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(PE,function(i,r,o){var a=[],s=r.toLowerCase();for(o.replace(AE,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=Wc,n}function OE(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 IE(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 Gc(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 Wc(){return this.join(",").replace(CE,"$1")}function LE(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=Wc,t}function Nf(e,t,n,i,r,o,a,s,c){var u=1-c,l=Lf(u,3),p=Lf(u,2),f=c*c,d=f*c,h=l*e+p*3*c*n+u*3*c*c*r+d*a,g=l*t+p*3*c*i+u*3*c*c*o+d*s;return{x:la(h),y:la(g)}}function $f(e){var t=HE(...e);return Gc(t.x0,t.y0,t.x1-t.x0,t.y1-t.y0)}function ri(e,t,n){return t>=e.x&&t<=e.x+e.width&&n>=e.y&&n<=e.y+e.height}function BE(e,t){return e=Gc(e),t=Gc(t),ri(t,e.x,e.y)||ri(t,e.x2,e.y)||ri(t,e.x,e.y2)||ri(t,e.x2,e.y2)||ri(e,t.x,t.y)||ri(e,t.x2,t.y)||ri(e,t.x,t.y2)||ri(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 jf(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 Ff(e,t,n,i,r,o,a,s,c){c==null&&(c=1),c=c>1?1:c<0?0:c;for(var u=c/2,l=12,p=[-.1252,.1252,-.3678,.3678,-.5873,.5873,-.7699,.7699,-.9041,.9041,-.9816,.9816],f=[.2491,.2491,.2335,.2335,.2032,.2032,.1601,.1601,.1069,.1069,.0472,.0472],d=0,h=0;h<l;h++){var g=u*p[h]+u,y=jf(g,e,n,r,a),S=jf(g,t,i,o,s),w=y*y+S*S;d+=f[h]*Xe.sqrt(w)}return u*d}function NE(e,t,n,i,r,o,a,s){if(!(En(e,n)<bn(r,a)||bn(e,n)>En(r,a)||En(t,i)<bn(o,s)||bn(t,i)>En(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=la(c/l),f=la(u/l),d=+p.toFixed(2),h=+f.toFixed(2);if(!(d<+bn(e,n).toFixed(2)||d>+En(e,n).toFixed(2)||d<+bn(r,a).toFixed(2)||d>+En(r,a).toFixed(2)||h<+bn(t,i).toFixed(2)||h>+En(t,i).toFixed(2)||h<+bn(o,s).toFixed(2)||h>+En(o,s).toFixed(2)))return{x:p,y:f}}}}function la(e){return Math.round(e*1e11)/1e11}function $E(e,t,n){var i=$f(e),r=$f(t);if(!BE(i,r))return[];var o=Ff(...e),a=Ff(...t),s=zf(e)?1:~~(o/5)||1,c=zf(t)?1:~~(a/5)||1,u=new Array(s+1),l=new Array(c+1),p={},f=[],d,h;for(d=0;d<s+1;d++){var g=Nf(...e,d/s);u[d]={x:g.x,y:g.y,t:d/s}}for(d=0;d<c+1;d++)g=Nf(...t,d/c),l[d]={x:g.x,y:g.y,t:d/c};for(d=0;d<s;d++)for(h=0;h<c;h++){var y=u[d],S=u[d+1],w=l[h],E=l[h+1],x=ii(S.x-y.x)<.01?"y":"x",R=ii(E.x-w.x)<.01?"y":"x",M=NE(y.x,y.y,S.x,S.y,w.x,w.y,E.x,E.y),O;if(M){if(O=M.x.toFixed(9)+"#"+M.y.toFixed(9),p[O])continue;p[O]=!0;var P=y.t+ii((M[x]-y[x])/(S[x]-y[x]))*(S.t-y.t),j=w.t+ii((M[R]-w[R])/(E[R]-w[R]))*(E.t-w.t);P>=0&&P<=1&&j>=0&&j<=1&&f.push({x:M.x,y:M.y,t1:P,t2:j})}}return f}function Hf(e,t,n){e=Wf(e),t=Wf(t);for(var i,r,o,a,s,c,u,l,p,f,d=n?0:[],h=0,g=e.length;h<g;h++){var y=e[h];if(y[0]=="M")i=s=y[1],r=c=y[2];else{y[0]=="C"?(p=[i,r,...y.slice(1)],i=p[6],r=p[7]):(p=[i,r,i,r,s,c,s,c],i=s,r=c);for(var S=0,w=t.length;S<w;S++){var E=t[S];if(E[0]=="M")o=u=E[1],a=l=E[2];else{E[0]=="C"?(f=[o,a,...E.slice(1)],o=f[6],a=f[7]):(f=[o,a,o,a,u,l,u,l],o=u,a=l);var x=$E(p,f);{for(var R=0,M=x.length;R<M;R++)x[R].segment1=h,x[R].segment2=S,x[R].bez1=p,x[R].bez2=f;d=d.concat(x)}}}}}return d}function jE(e){return Bf(e)&&Bf(e[0])}function FE(e){if(OE(e))return e;var t=new Array(e.length),n=0,i=0,r=0,o=0,a=0,s;e[0][0]=="M"&&(n=+e[0][1],i=+e[0][2],r=n,o=i,a++,t[0]=["M",n,i]);for(var c,u,l=a,p=e.length;l<p;l++){if(u=e[l],s=u[0],t[l]=c=new Array(u.length),s!=s.toUpperCase())switch(c[0]=s.toUpperCase(),c[0]){case"A":c[1]=u[1],c[2]=u[2],c[3]=u[3],c[4]=u[4],c[5]=u[5],c[6]=+u[6]+n,c[7]=+u[7]+i;break;case"V":c[1]=+u[1]+i;break;case"H":c[1]=+u[1]+n;break;case"M":r=+u[1]+n,o=+u[2]+i;default:for(var f=1,d=u.length;f<d;f++)c[f]=+u[f]+(f%2?n:i)}else for(var h=0,g=u.length;h<g;h++)c[h]=u[h];switch(s=s.toUpperCase(),c[0]){case"Z":n=+r,i=+o;break;case"H":n=c[1];break;case"V":i=c[1];break;case"M":r=c[c.length-2],o=c[c.length-1];default:n=c[c.length-2],i=c[c.length-1]}}return t.toString=Wc,t}function zf(e){return e[0]===e[2]&&e[1]===e[3]&&e[4]===e[6]&&e[5]===e[7]}function pa(e,t,n,i){return[e,t,n,i,n,i]}function Vf(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 Gf(e,t,n,i,r,o,a,s,c,u){var l=ni*120/180,p=ni/180*(+r||0),f=[],d,h=kE(function(b,m,v){var C=b*Xe.cos(v)-m*Xe.sin(v),T=b*Xe.sin(v)+m*Xe.cos(v);return{x:C,y:T}});if(u)O=u[0],P=u[1],R=u[2],M=u[3];else{d=h(e,t,-p),e=d.x,t=d.y,d=h(s,c,-p),s=d.x,c=d.y;var g=(e-s)/2,y=(t-c)/2,S=g*g/(n*n)+y*y/(i*i);S>1&&(S=Xe.sqrt(S),n=S*n,i=S*i);var w=n*n,E=i*i,x=(o==a?-1:1)*Xe.sqrt(ii((w*E-w*y*y-E*g*g)/(w*y*y+E*g*g))),R=x*n*y/i+(e+s)/2,M=x*-i*g/n+(t+c)/2,O=Xe.asin(((t-M)/i).toFixed(9)),P=Xe.asin(((c-M)/i).toFixed(9));O=e<R?ni-O:O,P=s<R?ni-P:P,O<0&&(O=ni*2+O),P<0&&(P=ni*2+P),a&&O>P&&(O=O-ni*2),!a&&P>O&&(P=P-ni*2)}var j=P-O;if(ii(j)>l){var $=P,I=s,G=c;P=O+l*(a&&P>O?1:-1),s=R+n*Xe.cos(P),c=M+i*Xe.sin(P),f=Gf(s,c,n,i,r,0,a,I,G,[P,$,R,M])}j=P-O;var ie=Xe.cos(O),Te=Xe.sin(O),tt=Xe.cos(P),W=Xe.sin(P),J=Xe.tan(j/4),re=4/3*n*J,Q=4/3*i*J,ee=[e,t],q=[e+re*Te,t-Q*ie],N=[s+re*W,c-Q*tt],B=[s,c];if(q[0]=2*ee[0]-q[0],q[1]=2*ee[1]-q[1],u)return[q,N,B].concat(f);f=[q,N,B].concat(f).join().split(",");for(var F=[],ge=0,D=f.length;ge<D;ge++)F[ge]=ge%2?h(f[ge-1],f[ge],p).y:h(f[ge],f[ge+1],p).x;return F}function HE(e,t,n,i,r,o,a,s){for(var c=[],u=[[],[]],l,p,f,d,h,g,y,S,w=0;w<2;++w){if(w==0?(p=6*e-12*n+6*r,l=-3*e+9*n-9*r+3*a,f=3*n-3*e):(p=6*t-12*i+6*o,l=-3*t+9*i-9*o+3*s,f=3*i-3*t),ii(l)<1e-12){if(ii(p)<1e-12)continue;d=-f/p,0<d&&d<1&&c.push(d);continue}y=p*p-4*f*l,S=Xe.sqrt(y),!(y<0)&&(h=(-p+S)/(2*l),0<h&&h<1&&c.push(h),g=(-p-S)/(2*l),0<g&&g<1&&c.push(g))}for(var E=c.length,x=E,R;E--;)d=c[E],R=1-d,u[0][E]=R*R*R*e+3*R*R*d*n+3*R*d*d*r+d*d*d*a,u[1][E]=R*R*R*t+3*R*R*d*i+3*R*d*d*o+d*d*d*s;return u[0][x]=e,u[1][x]=t,u[0][x+1]=a,u[1][x+1]=s,u[0].length=u[1].length=x+2,{x0:bn(...u[0]),y0:bn(...u[1]),x1:En(...u[0]),y1:En(...u[1])}}function Wf(e){if(jE(e)||(e=DE(e)),IE(e))return e;for(var t=LE(FE(e)),n={x:0,y:0,bx:0,by:0,X:0,Y:0,qx:null,qy:null},i=function(f,d,h){var g,y;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",...Gf(d.x,d.y,...f.slice(1))];break;case"S":h=="C"||h=="S"?(g=d.x*2-d.bx,y=d.y*2-d.by):(g=d.x,y=d.y),f=["C",g,y,...f.slice(1)];break;case"T":h=="Q"||h=="T"?(d.qx=d.x*2-d.qx,d.qy=d.y*2-d.qy):(d.qx=d.x,d.qy=d.y),f=["C",...Vf(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",...Vf(d.x,d.y,f[1],f[2],f[3],f[4])];break;case"L":f=["C",...pa(d.x,d.y,f[1],f[2])];break;case"H":f=["C",...pa(d.x,d.y,f[1],d.y)];break;case"V":f=["C",...pa(d.x,d.y,d.x,f[1])];break;case"Z":f=["C",...pa(d.x,d.y,d.X,d.Y)];break}return f},r=function(f,d){if(f[d].length>7){f[d].shift();for(var h=f[d];h.length;)o[d]="A",f.splice(d++,0,["C",...h.splice(0,6)]);f.splice(d,1),u=t.length}},o=[],a="",s="",c=0,u=t.length;c<u;c++){t[c]&&(a=t[c][0]),a!="C"&&(o[c]=a,c&&(s=o[c-1])),t[c]=i(t[c],n,s),o[c]!="A"&&a=="C"&&(o[c]="C"),r(t,c);var l=t[c],p=l.length;n.x=l[p-2],n.y=l[p-1],n.bx=If(l[p-4])||n.x,n.by=If(l[p-3])||n.y}return t}function ke(e){return ut(e)&&Dt(e,"waypoints")}function me(e){return ut(e)&&Dt(e,"labelTarget")}function zE(e){return ut(e)&&Zi(e.parent)}function Uf(e){return{x:Math.round(e.x),y:Math.round(e.y),width:Math.round(e.width),height:Math.round(e.height)}}function Ln(e){return{x:Math.round(e.x),y:Math.round(e.y)}}function ne(e){return{top:e.y,right:e.x+(e.width||0),bottom:e.y+(e.height||0),left:e.x}}function fa(e){return{x:e.left,y:e.top,width:e.right-e.left,height:e.bottom-e.top}}function VE(e){return Ln({x:e.x+(e.width||0)/2,y:e.y+(e.height||0)/2})}function GE(e){for(var t=e.waypoints,n=t.reduce(function(u,l,p){var f=t[p-1];if(f){var d=u[u.length-1],h=d&&d.endLength||0,g=qE(f,l);u.push({start:f,end:l,startLength:h,endLength:h+g,length:g})}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 ce(e){return ke(e)?GE(e):VE(e)}function ht(e,t,n){n=n||0,ut(n)||(n={x:n,y:n});var i=ne(e),r=ne(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 Yr(e,t,n){var i=WE(e,t);return i.length===1||i.length===2&&qr(i[0],i[1])<1?Ln(i[0]):i.length>1?(i=dn(i,function(r){var o=Math.floor(r.t2*100)||1;return o=100-o,o=(o<10?"0":"")+o,r.segment2+"#"+o}),Ln(i[n?0:i.length-1])):null}function WE(e,t){return Hf(e,t)}function UE(e){e=e.slice();for(var t=0,n,i,r;e[t];)n=e[t],i=e[t-1],r=e[t+1],qr(n,r)===0||zc(i,r,n)?e.splice(t,1):t++;return e}function qE(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function da(e,t){return Math.round(e*t)/t}function qf(e){return le(e)?e+"px":e}function YE(e){for(;e.parent;)e=e.parent;return e}function KE(e){e=k({},{width:"100%",height:"100%"},e);const t=e.container||document.body,n=document.createElement("div");return n.setAttribute("class","djs-container djs-parent"),Ct(n,{position:"relative",overflow:"hidden",width:qf(e.width),height:qf(e.height)}),t.appendChild(n),n}function Yf(e,t,n){const i=te("g");xe(i).add(t);const r=n!==void 0?n:e.childNodes.length-1;return e.insertBefore(i,e.childNodes[r]||null),i}const XE="base",Kf=0,ZE=1,QE={shape:["x","y","width","height"],connection:["waypoints"]};function ue(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||{})}ue.$inject=["config.canvas","eventBus","graphicsFactory","elementRegistry"],ue.prototype._init=function(e){const t=this._eventBus,n=this._container=KE(e),i=this._svg=te("svg");Z(i,{width:"100%",height:"100%"}),Et(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")}),fe(n,i);const r=this._viewport=Yf(i,"viewport");e.deferUpdate&&(this._viewboxChanged=fc(this._viewboxChanged,300)),this._restoreFocus=fc(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)},ue.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},ue.prototype._setFocused=function(e){e!=this._focused&&(this._focused=e,this._eventBus.fire("canvas.focus.changed",{focused:e}))},ue.prototype._clear=function(){this._elementRegistry.getAll().forEach(t=>{const n=kf(t);n==="root"?this.removeRootElement(t):this._removeElement(t,n)}),this._planes=[],this._rootElement=null,delete this._cachedViewbox},ue.prototype.focus=function(){this._svg.focus({preventScroll:!0}),this._setFocused(!0)},ue.prototype.restoreFocus=function(){this._restoreFocus()},ue.prototype._restoreFocus=function(){document.activeElement===document.body&&this.focus()},ue.prototype.isFocused=function(){return this._focused},ue.prototype.getDefaultLayer=function(){return this.getLayer(XE,Kf)},ue.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},ue.prototype._getChildIndex=function(e){return Ot(this._layers,function(t,n){return n.visible&&e>=n.index&&t++,t},0)},ue.prototype._createLayer=function(e,t){typeof t>"u"&&(t=ZE);const n=this._getChildIndex(t);return{group:Yf(this._viewport,"layer-"+e,n),index:t,visible:!0}},ue.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},ue.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&&(ot(n),t.visible=!1),n},ue.prototype._removeLayer=function(e){const t=this._layers[e];t&&(delete this._layers[e],ot(t.group))},ue.prototype.getActiveLayer=function(){const e=this._findPlaneForRoot(this.getRootElement());return e?e.layer:null},ue.prototype.findRoot=function(e){const t=this._resolveElements(e);let n;for(const i of t){const r=this._findPlaneForRoot(YE(i));if(!r||n&&r.rootElement!==n)return;n=r.rootElement}return n},ue.prototype.getRootElements=function(){return this._planes.map(function(e){return e.rootElement})},ue.prototype._findPlaneForRoot=function(e){return Le(this._planes,function(t){return t.rootElement===e})},ue.prototype._resolveElement=function(e){return typeof e=="string"?this._elementRegistry.get(e):e},ue.prototype._resolveElements=function(e){return se(e)||(e=[e]),e.map(t=>this._resolveElement(t)).filter(Boolean)},ue.prototype.getContainer=function(){return this._container},ue.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&&(A([i.gfx,i.secondaryGfx],function(r){r&&(n?(e.markers.add(t),xe(r).add(t)):(e.markers.delete(t),xe(r).remove(t)))}),this._eventBus.fire("element.marker.update",{element:e,gfx:i.gfx,marker:t,add:!!n}))},ue.prototype.addMarker=function(e,t){this._updateMarker(e,t,!0)},ue.prototype.removeMarker=function(e,t){this._updateMarker(e,t,!1)},ue.prototype.hasMarker=function(e,t){return e=this._resolveElement(e),e.markers?e.markers.has(t):!1},ue.prototype.toggleMarker=function(e,t){this.hasMarker(e,t)?this.removeMarker(e,t):this.addMarker(e,t)},ue.prototype.getRootElement=function(){const e=this._rootElement;return e||this._planes.length?e:this.setRootElement(this.addRootElement(null))},ue.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,Kf);return this.hideLayer(n),this._addRoot(e,i),this._planes.push({rootElement:e,layer:i}),e},ue.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},ue.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},ue.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)},ue.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})},ue.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})},ue.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=QE[e];if(!Ai(n,function(r){return typeof t[r]<"u"}))throw new Error("must supply { "+n.join(", ")+" } with "+e)},ue.prototype._setParent=function(e,t,n){qe(t.children,e,n),e.parent=t},ue.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},ue.prototype.addShape=function(e,t,n){return this._addElement("shape",e,t,n)},ue.prototype.addConnection=function(e,t,n){return this._addElement("connection",e,t,n)},ue.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),Ue(e.parent&&e.parent.children,e),e.parent=null,r.fire(t+".removed",{element:e}),n.remove(e),e},ue.prototype.removeShape=function(e){return this._removeElement(e,"shape")},ue.prototype.removeConnection=function(e){return this._removeElement(e,"connection")},ue.prototype.getGraphics=function(e,t){return this._elementRegistry.getGraphics(e,t)},ue.prototype._changeViewbox=function(e){this._eventBus.fire("canvas.viewbox.changing"),e.apply(this),this._cachedViewbox=null,this._viewboxChanged()},ue.prototype._viewboxChanged=function(){this._eventBus.fire("canvas.viewbox.changed",{viewbox:this.viewbox()})},ue.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);Vr(t,l)});else return o=this._rootElement?this.getActiveLayer():null,i=o&&o.getBBox()||{},a=Vr(t),r=a?a.matrix:iE(),s=da(r.a,1e3),c=da(-r.e||0,1e3),u=da(-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},ue.prototype.scroll=function(e){const t=this._viewport;let n=t.getCTM();return e&&this._changeViewbox(function(){e=k({dx:0,dy:0},e||{}),n=this._svg.createSVGMatrix().translate(e.dx,e.dy).multiply(n),Xf(t,n)}),{x:n.e,y:n.f}},ue.prototype.scrollToElement=function(e,t){let n=100;const i=this._resolveElements(e);if(!i.length)return;const r=this.findRoot(i);if(!r)return;r!==this.getRootElement()&&this.setRootElement(r);const o=i.filter(h=>h!=r);if(!o.length)return;t||(t={}),typeof t=="number"&&(n=t),t={top:t.top||n,right:t.right||n,bottom:t.bottom||n,left:t.left||n};const a=Ke(o),s=ne(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=ne(c);if(!(a.width<c.width&&a.height<c.height))l=a.x-c.x,p=a.y-c.y;else{const h=Math.max(0,s.right-f.right),g=Math.min(0,s.left-f.left),y=Math.max(0,s.bottom-f.bottom),S=Math.min(0,s.top-f.top);l=h||g,p=y||S}this.scroll({dx:-l*u,dy:-p*u})},ue.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)}),da(i.a,1e3)};function Xf(e,t){const n="matrix("+t.a+","+t.b+","+t.c+","+t.d+","+t.e+","+t.f+")";e.setAttribute("transform",n)}ue.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},ue.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=k(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),Xf(this._viewport,l),l},ue.prototype.getSize=function(){return{width:this._container.clientWidth,height:this._container.clientHeight}},ue.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}},ue.prototype.resized=function(){delete this._cachedViewbox,this._eventBus.fire("canvas.resized")};var or="data-element-id";function Gt(e){this._elements={},this._eventBus=e}Gt.$inject=["eventBus"],Gt.prototype.add=function(e,t,n){var i=e.id;this._validateId(i),Z(t,or,i),n&&Z(n,or,i),this._elements[i]={element:e,gfx:t,secondaryGfx:n}},Gt.prototype.remove=function(e){var t=this._elements,n=e.id||e,i=n&&t[n];i&&(Z(i.gfx,or,""),i.secondaryGfx&&Z(i.secondaryGfx,or,""),delete t[n])},Gt.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)},Gt.prototype.updateGraphics=function(e,t,n){var i=e.id||e,r=this._elements[i];return n?r.secondaryGfx=t:r.gfx=t,t&&Z(t,or,i),t},Gt.prototype.get=function(e){var t;typeof e=="string"?t=e:t=e&&Z(e,or);var n=this._elements[t];return n&&n.element},Gt.prototype.filter=function(e){var t=[];return this.forEach(function(n,i){e(n,i)&&t.push(n)}),t},Gt.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}},Gt.prototype.getAll=function(){return this.filter(function(e){return e})},Gt.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)})},Gt.prototype.getGraphics=function(e,t){var n=e.id||e,i=this._elements[n];return i&&(t?i.secondaryGfx:i.gfx)},Gt.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 JE(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 ex(e){return e.__refs_collection===!0}function tx(e,t){return Object.prototype.hasOwnProperty.call(e,t.name||t)}function Zf(e,t,n){var i=JE(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 nx(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 Kt(e,t){if(!(this instanceof Kt))return new Kt(e,t);e.inverse=t,t.inverse=e,this.props={},this.props[e.name]=e,this.props[t.name]=t}Kt.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?Zf(this,t,e):nx(this,t,e)},Kt.prototype.ensureRefsCollection=function(e,t){var n=e[t.name];return ex(n)||Zf(this,t,e),n},Kt.prototype.ensureBound=function(e,t){tx(e,t)||this.bind(e,t)},Kt.prototype.unset=function(e,t,n){e&&(this.ensureBound(e,t),t.collection?this.ensureRefsCollection(e,t).remove(n):e[t.name]=void 0)},Kt.prototype.set=function(e,t,n){e&&(this.ensureBound(e,t),t.collection?this.ensureRefsCollection(e,t).add(n):e[t.name]=n)};var Uc=new Kt({name:"children",enumerable:!0,collection:!0},{name:"parent"}),Qf=new Kt({name:"labels",enumerable:!0,collection:!0},{name:"labelTarget"}),Jf=new Kt({name:"attachers",collection:!0},{name:"host"}),ed=new Kt({name:"outgoing",collection:!0},{name:"source"}),td=new Kt({name:"incoming",collection:!0},{name:"target"});function ar(){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)}}),Uc.bind(this,"parent"),Qf.bind(this,"labels"),ed.bind(this,"outgoing"),td.bind(this,"incoming")}function Kr(){ar.call(this),Uc.bind(this,"children"),Jf.bind(this,"host"),Jf.bind(this,"attachers")}X(Kr,ar);function nd(){ar.call(this),Uc.bind(this,"children")}X(nd,Kr);function id(){Kr.call(this),Qf.bind(this,"labelTarget")}X(id,Kr);function rd(){ar.call(this),ed.bind(this,"source"),td.bind(this,"target")}X(rd,ar);var ix={connection:rd,shape:Kr,label:id,root:nd};function rx(e,t){var n=ix[e];if(!n)throw new Error("unknown type: <"+e+">");return k(new n,t)}function ox(e){return e instanceof ar}function Bn(){this._uid=12}Bn.prototype.createRoot=function(e){return this.create("root",e)},Bn.prototype.createLabel=function(e){return this.create("label",e)},Bn.prototype.createShape=function(e){return this.create("shape",e)},Bn.prototype.createConnection=function(e){return this.create("connection",e)},Bn.prototype.create=function(e,t){return t=k({},t||{}),t.id||(t.id=e+"_"+this._uid++),rx(e,t)};var ha="__fn",od=1e3,ax=Array.prototype.slice;function Lt(){this._listeners={},this.on("diagram.destroy",1,this._destroy,this)}Lt.prototype.on=function(e,t,n,i){if(e=se(e)?e:[e],lt(t)&&(i=n,n=t,t=od),!le(t))throw new Error("priority must be a number");var r=n;i&&(r=At(n,i),r[ha]=n[ha]||n);var o=this;e.forEach(function(a){o._addListener(a,{priority:t,callback:r,next:null})})},Lt.prototype.once=function(e,t,n,i){var r=this;if(lt(t)&&(i=n,n=t,t=od),!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[ha]=n,this.on(e,t,o)},Lt.prototype.off=function(e,t){e=se(e)?e:[e];var n=this;e.forEach(function(i){n._removeListener(i,t)})},Lt.prototype.createEvent=function(e){var t=new Xr;return t.init(e),t},Lt.prototype.fire=function(e,t){var n,i,r,o;if(o=ax.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 Xr?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}},Lt.prototype.handleError=function(e){return this.fire("error",{error:e})===!1},Lt.prototype._destroy=function(){this._listeners={}},Lt.prototype._invokeListeners=function(e,t,n){for(var i;n&&!e.cancelBubble;)i=this._invokeListener(e,t,n),n=n.next;return i},Lt.prototype._invokeListener=function(e,t,n){var i;if(n.callback.__isTomb)return i;try{i=sx(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},Lt.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},Lt.prototype._getListeners=function(e){return this._listeners[e]},Lt.prototype._setListeners=function(e,t){this._listeners[e]=t},Lt.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[ha]===t)&&(r?r.next=i:this._setListeners(e,i)),r=n,n=i};function Xr(){}Xr.prototype.stopPropagation=function(){this.cancelBubble=!0},Xr.prototype.preventDefault=function(){this.defaultPrevented=!0},Xr.prototype.init=function(e){k(this,e||{})};function sx(e,t){return e.apply(null,t)}function Li(e){return e.childNodes[0]}function cx(e){return e.parentNode.childNodes[1]}function ma(e,t,n,i,r){var o=zr();o.setTranslate(t,n);var a=zr();a.setRotate(i||0,0,0);var s=zr();s.setScale(1,1),Vr(e,[o,a,s])}function mt(e,t,n){var i=zr();i.setTranslate(t,n),Vr(e,i)}function ad(e,t){var n=zr();n.setRotate(t,0,0),Vr(e,n)}function Wt(e,t){this._eventBus=e,this._elementRegistry=t}Wt.$inject=["eventBus","elementRegistry"],Wt.prototype._getChildrenContainer=function(e){var t=this._elementRegistry.getGraphics(e),n;return e.parent?(n=cx(t),n||(n=te("g"),xe(n).add("djs-children"),fe(t.parentNode,n))):n=t,n},Wt.prototype._clear=function(e){var t=Li(e);return ia(t),t},Wt.prototype._createContainer=function(e,t,n,i){var r=te("g");xe(r).add("djs-group"),typeof n<"u"?ux(r,t,t.childNodes[n]):fe(t,r);var o=te("g");xe(o).add("djs-element"),xe(o).add("djs-"+e),i&&xe(o).add("djs-frame"),fe(r,o);var a=te("g");return xe(a).add("djs-visual"),fe(o,a),o},Wt.prototype.create=function(e,t,n){var i=this._getChildrenContainer(t.parent);return this._createContainer(e,i,n,Df(t))},Wt.prototype.updateContainments=function(e){var t=this,n=this._elementRegistry,i;i=Ot(e,function(r,o){return o.parent&&(r[o.parent.id]=o.parent),r},{}),A(i,function(r){var o=r.children;if(o){var a=t._getChildrenContainer(r),s=a.firstChild;A(o,function(c){var u=n.getGraphics(c).parentNode;u===s?s=s.nextSibling:a.insertBefore(u,s)})}})},Wt.prototype.drawShape=function(e,t,n={}){var i=this._eventBus;return i.fire("render.shape",{gfx:e,element:t,attrs:n})},Wt.prototype.getShapePath=function(e){var t=this._eventBus;return t.fire("render.getShapePath",e)},Wt.prototype.drawConnection=function(e,t,n={}){var i=this._eventBus;return i.fire("render.connection",{gfx:e,element:t,attrs:n})},Wt.prototype.getConnectionPath=function(e){var t=this._eventBus;return t.fire("render.getConnectionPath",e)},Wt.prototype.update=function(e,t,n){if(t.parent){var i=this._clear(n);if(e==="shape")this.drawShape(i,t),mt(n,t.x,t.y);else if(e==="connection")this.drawConnection(i,t);else throw new Error("unknown type: "+e);t.hidden?Z(n,"display","none"):Z(n,"display","block")}},Wt.prototype.remove=function(e){var t=this._elementRegistry.getGraphics(e);ot(t.parentNode)};function ux(e,t,n){var i=n||t.firstChild;e!==i&&t.insertBefore(e,i)}const lx={__depends__:[wE],__init__:["canvas"],canvas:["type",ue],elementRegistry:["type",Gt],elementFactory:["type",Bn],eventBus:["type",Lt],graphicsFactory:["type",Wt]};function px(e){var t=new Mf(e);return t.init(),t}function fx(e){e=e||{};var t={config:["value",e]},n=[t,lx].concat(e.modules||[]);return px(n)}function oi(e,t){this._injector=t||fx(e),this.get("eventBus").fire("diagram.init")}oi.prototype.get=function(e,t){return this._injector.get(e,t)},oi.prototype.invoke=function(e,t,n){return this._injector.invoke(e,t,n)},oi.prototype.destroy=function(){this.get("eventBus").fire("diagram.destroy")},oi.prototype.clear=function(){this.get("eventBus").fire("diagram.clear")};function xt(e){return e?"<"+e.$type+(e.id?' id="'+e.id:"")+'" />':"<null>"}function Tt(e,t){return e.$instanceOf(t)}function dx(e){return Le(e.rootElements,function(t){return Tt(t,"bpmn:Process")||Tt(t,"bpmn:Collaboration")})}function hx(e){var t={},n=[],i={};function r(N,B){return function(F){N(F,B)}}function o(N){t[N.id]=N}function a(N){return t[N.id]}function s(N,B){var F=N.gfx;if(F)throw new Error(`already rendered ${xt(N)}`);return e.element(N,i[N.id],B)}function c(N,B){return e.root(N,i[N.id],B)}function u(N,B){try{var F=i[N.id]&&s(N,B);return o(N),F}catch(ge){l(ge.message,{element:N,error:ge}),console.error(`failed to import ${xt(N)}`,ge)}}function l(N,B){e.error(N,B)}var p=this.registerDi=function(B){var F=B.bpmnElement;F?i[F.id]?l(`multiple DI elements defined for ${xt(F)}`,{element:F}):i[F.id]=B:l(`no bpmnElement referenced in ${xt(B)}`,{element:B})};function f(N){d(N.plane)}function d(N){p(N),A(N.planeElement,h)}function h(N){p(N)}this.handleDefinitions=function(B,F){var ge=B.diagrams;if(F&&ge.indexOf(F)===-1)throw new Error("diagram not part of <bpmn:Definitions />");if(!F&&ge&&ge.length&&(F=ge[0]),!F)throw new Error("no diagram to display");i={},f(F);var D=F.plane;if(!D)throw new Error(`no plane for ${xt(F)}`);var b=D.bpmnElement;if(!b)if(b=dx(B),b)l(`correcting missing bpmnElement on ${xt(D)} to ${xt(b)}`),D.bpmnElement=b,p(D);else throw new Error("no process or collaboration to display");var m=c(b,D);if(Tt(b,"bpmn:Process")||Tt(b,"bpmn:SubProcess"))y(b,m);else if(Tt(b,"bpmn:Collaboration"))ee(b,m),S(B.rootElements,m);else throw new Error(`unsupported bpmnElement for ${xt(D)}: ${xt(b)}`);g(n)};var g=this.handleDeferred=function(){for(var B;n.length;)B=n.shift(),B()};function y(N,B){J(N,B),j(N.ioSpecification,B),P(N.artifacts,B),o(N)}function S(N,B){var F=ye(N,function(ge){return!a(ge)&&Tt(ge,"bpmn:Process")&&ge.laneSets});F.forEach(r(y,B))}function w(N,B){u(N,B)}function E(N,B){A(N,r(w,B))}function x(N,B){u(N,B)}function R(N,B){u(N,B)}function M(N,B){u(N,B)}function O(N,B){u(N,B)}function P(N,B){A(N,function(F){Tt(F,"bpmn:Association")?n.push(function(){O(F,B)}):O(F,B)})}function j(N,B){N&&(A(N.dataInputs,r(R,B)),A(N.dataOutputs,r(M,B)))}var $=this.handleSubProcess=function(B,F){J(B,F),P(B.artifacts,F)};function I(N,B){var F=u(N,B);Tt(N,"bpmn:SubProcess")&&$(N,F||B),Tt(N,"bpmn:Activity")&&j(N.ioSpecification,B),n.push(function(){A(N.dataInputAssociations,r(x,B)),A(N.dataOutputAssociations,r(x,B))})}function G(N,B){u(N,B)}function ie(N,B){u(N,B)}function Te(N,B){n.push(function(){var F=u(N,B);N.childLaneSet&&tt(N.childLaneSet,F||B),q(N)})}function tt(N,B){A(N.lanes,r(Te,B))}function W(N,B){A(N,r(tt,B))}function J(N,B){re(N.flowElements,B),N.laneSets&&W(N.laneSets,B)}function re(N,B){A(N,function(F){Tt(F,"bpmn:SequenceFlow")?n.push(function(){G(F,B)}):Tt(F,"bpmn:BoundaryEvent")?n.unshift(function(){I(F,B)}):Tt(F,"bpmn:FlowNode")?I(F,B):Tt(F,"bpmn:DataObject")||(Tt(F,"bpmn:DataStoreReference")||Tt(F,"bpmn:DataObjectReference")?ie(F,B):l(`unrecognized flowElement ${xt(F)} in context ${xt(B&&B.businessObject)}`,{element:F,context:B}))})}function Q(N,B){var F=u(N,B),ge=N.processRef;ge&&y(ge,F||B)}function ee(N,B){A(N.participants,r(Q,B)),n.push(function(){E(N.messageFlows,B)}),P(N.artifacts,B)}function q(N){A(N.flowNodeRef,function(B){var F=B.get("lanes");F&&F.push(N)})}}function _(e,t){var n=V(e);return n&&typeof n.$instanceOf=="function"&&n.$instanceOf(t)}function ve(e,t){return Kn(t,function(n){return _(e,n)})}function V(e){return e&&e.businessObject||e}function Se(e){return e&&e.di}function mx(e,t,n){var i,r,o,a,s=[];function c(u,l){var p={root:function(g,y){return i.add(g,y)},element:function(g,y,S){return i.add(g,y,S)},error:function(g,y){s.push({message:g,context:y})}},f=new hx(p);l=l||u.diagrams&&u.diagrams[0];var d=gx(u,l);if(!d)throw new Error("no diagram to display");A(d,function(g){f.handleDefinitions(u,g)});var h=l.plane.bpmnElement.id;o.setRootElement(o.findRoot(h+"_plane")||o.findRoot(h))}return new Promise(function(u,l){try{return i=e.get("bpmnImporter"),r=e.get("eventBus"),o=e.get("canvas"),r.fire("import.render.start",{definitions:t}),c(t,n),r.fire("import.render.complete",{error:a,warnings:s}),u({warnings:s})}catch(p){return p.warnings=s,l(p)}})}function gx(e,t){if(!(!t||!t.plane)){var n=t.plane.bpmnElement,i=n;!_(n,"bpmn:Process")&&!_(n,"bpmn:Collaboration")&&(i=vx(n));var r;_(i,"bpmn:Collaboration")?r=i:r=Le(e.rootElements,function(u){if(_(u,"bpmn:Collaboration"))return Le(u.participants,function(l){return l.processRef===i})});var o=[i];r&&(o=_t(r.participants,function(u){return u.processRef}),o.push(r));var a=sd(o),s=[t],c=[n];return A(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 sd(e){var t=[];return A(e,function(n){n&&(t.push(n),t=t.concat(sd(n.flowElements)))}),t}function vx(e){for(var t=e;t;){if(_(t,"bpmn:Process"))return t;t=t.$parent}}var yx='<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>',cd=yx,ud={verticalAlign:"middle"},ld={color:"#404040"},_x={zIndex:"1001",position:"fixed",top:"0",left:"0",right:"0",bottom:"0"},bx={width:"100%",height:"100%",background:"rgba(40,40,40,0.2)"},Ex={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"},xx='<div class="bjs-powered-by-lightbox"><div class="backdrop"></div><div class="notice"><a href="https://bpmn.io" target="_blank" rel="noopener" class="link">'+cd+'</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>',xn;function wx(){xn=Ne(xx),Ct(xn,_x),Ct(Me("svg",xn),ud),Ct(Me(".backdrop",xn),bx),Ct(Me(".notice",xn),Ex),Ct(Me(".link",xn),ld,{margin:"15px 20px 15px 10px",alignSelf:"center"})}function Sx(){xn||(wx(),It.bind(xn,".backdrop","click",function(e){document.body.removeChild(xn)})),document.body.appendChild(xn)}const ga=5,pd="djs-outline-hidden";function ze(e){e=k({},Cx,e),this._moddle=this._createModdle(e),this._container=this._createContainer(e),this._init(this._container,this._moddle,e),Ax(this._container)}X(ze,oi),ze.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||[]),va(s,o),s=Rx(s),this._emit("import.done",{error:s,warnings:s.warnings}),s}},ze.prototype.importDefinitions=async function(t,n){return this._setDefinitions(t),{warnings:(await this.open(n)).warnings}},ze.prototype.open=async function(t){const n=this._definitions;let i=t;if(!n){const o=new Error("no XML imported");throw va(o,[]),o}if(typeof t=="string"&&(i=Px(n,t),!i)){const o=new Error("BPMNDiagram <"+t+"> not found");throw va(o,[]),o}try{this.clear()}catch(o){throw va(o,[]),o}const{warnings:r}=await mx(this,n,i);return{warnings:r}},ze.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},ze.prototype.saveSVG=async function(){this._emit("saveSVG.start");let t,n;try{const i=this.get("canvas"),r=i.getActiveLayer(),o=Me(":scope > defs",i._svg),a=Tf(r),s=o?"<defs>"+Tf(o)+"</defs>":"",c=i.getContainer();He(c).add(pd);let u;try{u=r.getBBox()}finally{He(c).remove(pd)}const l=u.x-ga,p=u.y-ga,f=u.width+ga*2,d=u.height+ga*2;t=`<?xml version="1.0" encoding="utf-8"?>
1
+ (function(ee,ot){typeof exports=="object"&&typeof module<"u"?ot(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],ot):(ee=typeof globalThis<"u"?globalThis:ee||self,ot(ee.BpmnModeler={},ee.Vue))})(this,(function(ee,ot){"use strict";var Ak=Object.defineProperty;var Tk=(ee,ot,Jn)=>ot in ee?Ak(ee,ot,{enumerable:!0,configurable:!0,writable:!0,value:Jn}):ee[ot]=Jn;var Cr=(ee,ot,Jn)=>Tk(ee,typeof ot!="symbol"?ot+"":ot,Jn);const Jn=["startEvent","endEvent","userTask","serviceTask","task","sendTask","receiveTask","exclusiveGateway","parallelGateway"];function Jp(e){return Jn.includes(e)}const ef="http://g1project.net/spec/bpmn/bwl/1.0",Bc="bwl",Nc=["top-left","top","top-right","right","bottom-right","bottom","bottom-left","left"],tf={name:"bwl-hints",uri:ef,prefix:Bc,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"}]}]},$c="bwl.undoEpisode",nf=new WeakSet;function hb(e){nf.has(e)||(e.register($c,{preExecute(t){try{t.run()}catch(n){t.error=n}}}),nf.add(e))}function rf(e,t){hb(e);const n={run:t};if(e.execute($c,n),n.error!==void 0)throw e.canUndo()&&e.undo(),n.error}const of=["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"],mb={description:"생략 = 보존, null = 제거.",anyOf:[{type:"string"},{type:"null"}]},gb={type:"object",description:"레인. 배열 선언 순서 = 풀 내 상→하 순서.",properties:{id:{type:"string"},name:{type:"string"}},required:["id"],additionalProperties:!1},vb={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},yb={type:"object",description:"플로우 노드. 좌표는 지정하지 않는다 — 배치는 resolver 가 결정한다.",properties:{id:{type:"string"},type:{type:"string",enum:[...Jn]},name:{type:"string"},participant:{type:"string",description:"소속 풀 id(협업 문서)."},lane:{type:"string",description:"소속 레인 id(풀 정의에 선언된 것)."}},required:["id","type"],additionalProperties:!1},_b={type:"object",description:"분기 조건 — 게이트웨이가 아닌 플로우에 붙인다. MVP 는 label 만.",properties:{label:{type:"string"}},required:["label"],additionalProperties:!1},bb={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},xb={type:"object",description:"메시지 플로우(풀 경계를 넘는 연결 — 노드 또는 블랙박스 풀 자체가 끝점).",properties:{id:{type:"string"},source:{type:"string"},target:{type:"string"},name:{type:"string"}},required:["id","source","target"],additionalProperties:!1},Eb={type:"object",properties:{id:{type:"string"},name:{type:"string"}},required:["id"],additionalProperties:!1},wb={type:"object",description:"데이터 입출력 연관. 방향 = source→target(태스크→스토어 = 쓰기, 스토어→태스크 = 읽기).",properties:{id:{type:"string"},source:{type:"string"},target:{type:"string"}},required:["source","target"],additionalProperties:!1},Sb={type:"object",properties:{id:{type:"string"},text:{type:"string"}},required:["id","text"],additionalProperties:!1},Rb={type:"object",description:"연관선(주석 ↔ 요소).",properties:{id:{type:"string"},source:{type:"string"},target:{type:"string"}},required:["source","target"],additionalProperties:!1},Cb={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},Pb={type:"object",description:"주석 방위 힌트 — 앵커 요소 기준 상대 배치. 있으면 결정적 배치, 없으면 휴리스틱.",properties:{anchor:{type:"string",description:"기준 요소 id."},side:{type:"string",enum:[...Nc]},offset:{type:"number"}},required:["anchor","side"],additionalProperties:!1};function Ot(e,t){return{type:"object",description:t.description,properties:{kind:{const:e},...t.properties},required:["kind",...t.required??[]],additionalProperties:!1}}const Ab={"participant.add":Ot("participant.add",{description:"풀 추가. order = 풀 세로 순서 힌트(생략 시 op 순서가 곧 배치 순서).",properties:{participant:{$ref:"#/$defs/irParticipant"},order:{type:"integer"}},required:["participant"]}),"participant.update":Ot("participant.update",{description:"풀 이름/레인 갱신. lanes 는 전체 재선언(생략 = 보존) — 기존 레인을 유지하려면 함께 다시 나열한다.",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"},lanes:{type:"array",items:{$ref:"#/$defs/irLane"}}},required:["id"]}),"node.add":Ot("node.add",{description:"플로우 노드 추가. band = 가로 밴드 순번 힌트(주 흐름 0, 보조 스트랜드 1…). 레인이 있으면 그 레인 안의 밴드다 — 한 레인 안에서 게이트웨이 출구를 갈라 놓을 때 쓴다. 컨테이너(풀·레인)는 밴드 수만큼 자란다.",properties:{node:{$ref:"#/$defs/irNode"},band:{type:"integer"}},required:["node"]}),"node.update":Ot("node.update",{description:"노드 이름/레인/타입 갱신. lane = 레인 재배정(이동), type = 태스크·이벤트 타입 전환.",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"},lane:{type:"string"},type:{type:"string",enum:[...Jn]}},required:["id"]}),"sequenceFlow.add":Ot("sequenceFlow.add",{description:"시퀀스 플로우 추가. 분기 조건은 게이트웨이가 아닌 플로우의 condition 에 싣는다.",properties:{flow:{$ref:"#/$defs/irSequenceFlow"}},required:["flow"]}),"sequenceFlow.update":Ot("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":Ot("messageFlow.add",{description:"메시지 플로우 추가(풀 경계를 넘는 연결).",properties:{flow:{$ref:"#/$defs/irMessageFlow"}},required:["flow"]}),"messageFlow.update":Ot("messageFlow.update",{description:"메시지 플로우 이름 갱신.",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"}},required:["id"]}),"dataStore.add":Ot("dataStore.add",{description:"데이터 스토어 추가(+ 입출력 연관 동반 가능).",properties:{dataStore:{$ref:"#/$defs/irDataStore"},associations:{type:"array",items:{$ref:"#/$defs/irDataAssociation"}}},required:["dataStore"]}),"dataStore.update":Ot("dataStore.update",{description:"데이터 스토어 이름 갱신.",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"}},required:["id"]}),"dataAssociation.add":Ot("dataAssociation.add",{description:"기존 노드 ↔ 기존 데이터 스토어의 입출력 연관 추가.",properties:{association:{$ref:"#/$defs/irDataAssociation"}},required:["association"]}),"association.add":Ot("association.add",{description:"주석 ↔ 요소 연관 추가(한쪽 끝은 주석). 주석 신설과 함께면 annotation.add 의 association 을 쓰고, 이 op 는 추가 연관(한 주석에 여러 연관)용.",properties:{association:{$ref:"#/$defs/irAssociation"}},required:["association"]}),"annotation.add":Ot("annotation.add",{description:"텍스트 주석 추가. association 으로 대상 요소와 연결하고, placement 로 방위를 지정하면 결정적 배치된다.",properties:{annotation:{$ref:"#/$defs/irTextAnnotation"},association:{$ref:"#/$defs/irAssociation"},placement:{$ref:"#/$defs/bwlPlacement"}},required:["annotation"]}),"annotation.update":Ot("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":Ot("group.add",{description:"그룹 추가 — 바운즈는 members 의 bbox 로 산출되므로 좌표를 지정하지 않는다.",properties:{group:{$ref:"#/$defs/irGroup"}},required:["group"]}),"group.update":Ot("group.update",{description:"그룹 이름/멤버 갱신. members 는 전체 재선언(생략 = 보존).",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"},members:{type:"array",items:{type:"string"}}},required:["id"]}),"element.remove":Ot("element.remove",{description:"요소 제거(카테고리 무관). 부착된 연결선은 함께 제거된다.",properties:{id:{type:"string"}},required:["id"]})},af={anyOf:of.map(e=>Ab[e])},Tb={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:gb,irParticipant:vb,irNode:yb,irFlowCondition:_b,irSequenceFlow:bb,irMessageFlow:xb,irDataStore:Eb,irDataAssociation:wb,irTextAnnotation:Sb,irAssociation:Rb,irGroup:Cb,bwlPlacement:Pb,nullableString:mb,symbolicOp:af}};function jc(e){return Array.prototype.concat.apply([],e)}const ho=Object.prototype.toString,Mb=Object.prototype.hasOwnProperty;function er(e){return e===void 0}function mt(e){return e!==void 0}function Pr(e){return e==null}function pe(e){return ho.call(e)==="[object Array]"}function xt(e){return ho.call(e)==="[object Object]"}function he(e){return ho.call(e)==="[object Number]"}function Et(e){const t=ho.call(e);return t==="[object Function]"||t==="[object AsyncFunction]"||t==="[object GeneratorFunction]"||t==="[object AsyncGeneratorFunction]"||t==="[object Proxy]"}function Qt(e){return ho.call(e)==="[object String]"}function kb(e){if(!pe(e))throw new Error("must supply array")}function Jt(e,t){return!Pr(e)&&Mb.call(e,t)}function He(e,t){const n=xa(t);let i;return T(e,function(r,o){if(n(r,o))return i=r,!1}),i}function sf(e,t){const n=xa(t);let i=pe(e)?-1:void 0;return T(e,function(r,o){if(n(r,o))return i=o,!1}),i}function we(e,t){const n=xa(t);let i=[];return T(e,function(r,o){n(r,o)&&i.push(r)}),i}function T(e,t){let n,i;if(er(e))return;const r=pe(e)?Bb:Lb;for(let o in e)if(Jt(e,o)&&(n=e[o],i=t(n,r(o)),i===!1))return n}function Db(e,t){if(er(e))return[];kb(e);const n=xa(t);return e.filter(function(i,r){return!n(i,r)})}function en(e,t,n){return T(e,function(i,r){n=t(n,i,r)}),n}function tr(e,t){return!!en(e,function(n,i,r){return n&&t(i,r)},!0)}function bi(e,t){return!!He(e,t)}function It(e,t){let n=[];return T(e,function(i,r){n.push(t(i,r))}),n}function ba(e){return e&&Object.keys(e)||[]}function Ob(e){return ba(e).length}function Ar(e){return It(e,t=>t)}function Tr(e,t,n={}){return t=Fc(t),T(e,function(i){let r=t(i)||"_",o=n[r];o||(o=n[r]=[]),o.push(i)}),n}function cf(e,...t){e=Fc(e);let n={};return T(t,r=>Tr(r,e,n)),It(n,function(r,o){return r[0]})}const Ib=cf;function In(e,t){t=Fc(t);let n=[];return T(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)}),It(n,i=>i.v)}function Mr(e){return function(t){return tr(e,function(n,i){return t[i]===n})}}function Fc(e){return Et(e)?e:t=>t[e]}function xa(e){return Et(e)?e:t=>t===e}function Lb(e){return e}function Bb(e){return Number(e)}function Hc(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 Yt(e,t){return e.bind(t)}function k(e,...t){return Object.assign(e,...t)}function Nb(e,t,n){let i=e;return T(t,function(r,o){if(typeof r!="number"&&typeof r!="string")throw new Error("illegal key type: "+typeof r+". Key should be of type number or string.");if(r==="constructor")throw new Error("illegal key: constructor");if(r==="__proto__")throw new Error("illegal key: __proto__");let a=t[o+1],s=i[r];mt(a)&&Pr(s)&&(s=i[r]=isNaN(+a)?{}:[]),er(a)?er(n)?delete i[r]:i[r]=n:i=s}),e}function Mn(e,t){let n={},i=Object(e);return T(t,function(r){r in i&&(n[r]=e[r])}),n}function Ln(e,t){let n={},i=Object(e);return T(i,function(r,o){t.indexOf(o)===-1&&(n[o]=r)}),n}function zc(){}zc.prototype.get=function(e){return this.$model.properties.get(this,e)},zc.prototype.set=function(e,t){this.$model.properties.set(this,e,t)};function uf(e,t){this.model=e,this.properties=t}uf.prototype.createType=function(e){var t=this.model,n=this.properties,i=Object.create(zc.prototype);T(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}),T(a,Yt(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 $b=k(Object.create(null),{String:!0,Boolean:!0,Integer:!0,Real:!0,Element:!0}),lf=k(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 Vc(e,t){var n=lf[e];return n?n(t):t}function Gc(e){return!!$b[e]}function pf(e){return!!lf[e]}function Lt(e,t){var n=e.split(/:/),i,r;if(n.length===1)i=e,r=t;else if(n.length===2)i=n[1],r=n[0];else throw new Error("expected <prefix:localName> or <localName>, got "+e);return e=(r?r+":":"")+i,{name:e,prefix:r,localName:i}}function pn(e){this.ns=e,this.name=e.name,this.allTypes=[],this.allTypesByName=Object.create(null),this.properties=[],this.propertiesByName=Object.create(null)}pn.prototype.build=function(){return Mn(this,["ns","name","allTypes","allTypesByName","properties","propertiesByName","bodyProperty","idProperty"])},pn.prototype.addProperty=function(e,t,n){typeof t=="boolean"&&(n=t,t=void 0),this.addNamedProperty(e,n!==!1);var i=this.properties;t!==void 0?i.splice(t,0,e):i.push(e)},pn.prototype.replaceProperty=function(e,t,n){var i=e.ns,r=this.properties,o=this.propertiesByName,a=e.name!==t.name;if(e.isId){if(!t.isId)throw new Error("property <"+t.ns.name+"> must be id property to refine <"+e.ns.name+">");this.setIdProperty(t,!1)}if(e.isBody){if(!t.isBody)throw new Error("property <"+t.ns.name+"> must be body property to refine <"+e.ns.name+">");this.setBodyProperty(t,!1)}var s=r.indexOf(e);if(s===-1)throw new Error("property <"+i.name+"> not found in property list");r.splice(s,1),this.addProperty(t,n?void 0:s,a),o[i.name]=o[i.localName]=t},pn.prototype.redefineProperty=function(e,t,n){var i=e.ns.prefix,r=t.split("#"),o=Lt(r[0],i),a=Lt(r[1],o.prefix).name,s=this.propertiesByName[a];if(s)this.replaceProperty(s,e,n);else throw new Error("refined property <"+a+"> not found");delete e.redefines},pn.prototype.addNamedProperty=function(e,t){var n=e.ns,i=this.propertiesByName;t&&(this.assertNotDefined(e,n.name),this.assertNotDefined(e,n.localName)),i[n.name]=i[n.localName]=e},pn.prototype.removeNamedProperty=function(e){var t=e.ns,n=this.propertiesByName;delete n[t.name],delete n[t.localName]},pn.prototype.setBodyProperty=function(e,t){if(t&&this.bodyProperty)throw new Error("body property defined multiple times (<"+this.bodyProperty.ns.name+">, <"+e.ns.name+">)");this.bodyProperty=e},pn.prototype.setIdProperty=function(e,t){if(t&&this.idProperty)throw new Error("id property defined multiple times (<"+this.idProperty.ns.name+">, <"+e.ns.name+">)");this.idProperty=e},pn.prototype.assertNotTrait=function(e){if((e.extends||[]).length)throw new Error(`cannot create <${e.name}> extending <${e.extends}>`)},pn.prototype.assertNotDefined=function(e,t){var n=e.name,i=this.propertiesByName[n];if(i)throw new Error("property <"+n+"> already defined; override of <"+i.definedBy.ns.name+"#"+i.ns.name+"> by <"+e.definedBy.ns.name+"#"+e.ns.name+"> not allowed without redefines")},pn.prototype.hasProperty=function(e){return this.propertiesByName[e]},pn.prototype.addTrait=function(e,t){t&&this.assertNotTrait(e);var n=this.allTypesByName,i=this.allTypes,r=e.name;r in n||(T(e.properties,Yt(function(o){o=k({},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 xi(e,t){this.packageMap=Object.create(null),this.typeMap=Object.create(null),this.packages=[],this.properties=t,T(e,Yt(this.registerPackage,this))}xi.prototype.getPackage=function(e){return this.packageMap[e]},xi.prototype.getPackages=function(){return this.packages},xi.prototype.registerPackage=function(e){e=k({},e);var t=this.packageMap;ff(t,e,"prefix"),ff(t,e,"uri"),T(e.types,Yt(function(n){this.registerType(n,e)},this)),t[e.uri]=t[e.prefix]=e,this.packages.push(e)},xi.prototype.registerType=function(e,t){e=k({},e,{superClass:(e.superClass||[]).slice(),extends:(e.extends||[]).slice(),properties:(e.properties||[]).slice(),meta:k({},e.meta||{})});var n=Lt(e.name,t.prefix),i=n.name,r=Object.create(null);T(e.properties,Yt(function(o){var a=Lt(o.name,n.prefix),s=a.name;Gc(o.type)||(o.type=Lt(o.type,a.prefix).name),k(o,{ns:a,name:s}),r[s]=o},this)),k(e,{ns:n,name:i,propertiesByName:r}),T(e.extends,Yt(function(o){var a=Lt(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},xi.prototype.mapTypes=function(e,t,n){var i=Gc(e.name)?{name:e.name}:this.typeMap[e.name],r=this;function o(c,u){var l=Lt(c,Gc(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+">");T(i.superClass,n?a:s),t(i,!n),T(i.traits,a)},xi.prototype.getEffectiveDescriptor=function(e){var t=Lt(e),n=new pn(t);this.mapTypes(t,function(r,o){n.addTrait(r,o)});var i=n.build();return this.definePackage(i,i.allTypes[i.allTypes.length-1].$pkg),i},xi.prototype.definePackage=function(e,t){this.properties.define(e,"$pkg",{value:t})};function ff(e,t,n){var i=t[n];if(i in e)throw new Error("package with "+n+" <"+i+"> already defined")}function nr(e){this.model=e}nr.prototype.set=function(e,t,n){if(!Qt(t)||!t.length)throw new TypeError("property name must be a non-empty string");var i=this.getProperty(e,t),r=i&&i.name;jb(n)?i?delete e[r]:delete e.$attrs[Wc(t)]:i?r in e?e[r]=n:df(e,i,n):e.$attrs[Wc(t)]=n},nr.prototype.get=function(e,t){var n=this.getProperty(e,t);if(!n)return e.$attrs[Wc(t)];var i=n.name;return!e[i]&&n.isMany&&df(e,n,[]),e[i]},nr.prototype.define=function(e,t,n){if(!n.writable){var i=n.value;n=k({},n,{get:function(){return i}}),delete n.value}Object.defineProperty(e,t,n)},nr.prototype.defineDescriptor=function(e,t){this.define(e,"$descriptor",{value:t})},nr.prototype.defineModel=function(e,t){this.define(e,"$model",{value:t})},nr.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 jb(e){return typeof e>"u"}function df(e,t,n){Object.defineProperty(e,t.name,{enumerable:!t.isReference,writable:!0,value:n,configurable:!0})}function Wc(e){return e.replace(/^:/,"")}function gn(e,t={}){this.properties=new nr(this),this.factory=new uf(this,this.properties),this.registry=new xi(e,this.properties),this.typeCache=Object.create(null),this.config=t}gn.prototype.create=function(e,t){var n=this.getType(e);if(!n)throw new Error("unknown type <"+e+">");return new n(t)},gn.prototype.getType=function(e){var t=this.typeCache,n=Qt(e)?e:e.ns.name,i=t[n];return i||(e=this.registry.getEffectiveDescriptor(n),i=t[n]=this.factory.createType(e)),i},gn.prototype.createAny=function(e,t,n){var i=Lt(e),r={$type:e,$instanceOf:function(a){return a===this.$type},get:function(a){return this[a]},set:function(a,s){Nb(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}),T(n,function(a,s){xt(a)&&a.value!==void 0?r[a.name]=a.value:r[s]=a}),r},gn.prototype.getPackage=function(e){return this.registry.getPackage(e)},gn.prototype.getPackages=function(){return this.registry.getPackages()},gn.prototype.getElementDescriptor=function(e){return e.$descriptor},gn.prototype.hasType=function(e,t){t===void 0&&(t=e,e=this);var n=e.$model.getElementDescriptor(e);return t in n.allTypesByName},gn.prototype.getPropertyDescriptor=function(e,t){return this.getElementDescriptor(e).propertiesByName[t]},gn.prototype.getTypeDescriptor=function(e){return this.registry.typeMap[e]};var hf=String.fromCharCode,Fb=Object.prototype.hasOwnProperty,Hb=/&#(\d+);|&#x([0-9a-f]+);|&(\w+);/ig,mo={amp:"&",apos:"'",gt:">",lt:"<",quot:'"'};Object.keys(mo).forEach(function(e){mo[e.toUpperCase()]=mo[e]});function zb(e,t,n,i){return i?Fb.call(mo,i)?mo[i]:"&"+i+";":hf(t||parseInt(n,16))}function ir(e){return e.length>3&&e.indexOf("&")!==-1?e.replace(Hb,zb):e}var mf="non-whitespace outside of root node";function Ei(e){return new Error(e)}function Vb(e){return"missing namespace for prefix <"+e+">"}function Ea(e){return{get:e,enumerable:!0}}function Gb(e){var t=Object.create(null),n;for(n in e)t[n]=e[n];return t}var gf=Symbol("nameCache");function Uc(e){return e+"$uri"}function Wb(e){var t=Object.create(null),n,i;for(n in e)i=e[n],t[i]=i,t[Uc(i)]=n;return t}function wa(){return{line:0,column:0}}function Ub(e){throw e}function vf(e){if(!this)return new vf(e);var t=e&&e.proxy,n,i,r,o,a=Ub,s,c,u,l,p=wa,f=!1,d=!1,h="",m=!1,g=!1,w=null,E=!1,b,x,S,A;function I(L){L instanceof Error||(L=Ei(L)),w=L,a(L,p)}function C(L){s&&(L instanceof Error||(L=Ei(L)),s(L,p))}this.on=function(L,F){if(typeof F!="function")throw Ei("required args <name, cb>");switch(L){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 Ei("unsupported event: "+L)}return this},this.ns=function(L){if(typeof L>"u"&&(L={}),typeof L!="object")throw Ei("required args <nsMap={}>");var F=Object.create(null),re;for(re in L)F[re]=L[re];return g=!0,A=F,this};function $(){b=g?[]:null,x=g?Wb(A):null,S=[],p=wa,E=!1,w=null,d=!1,h=""}this.parse=function(L){if(typeof L!="string")throw Ei("required args <xml=string>");if(f)throw Ei("parse during stream; call end() first");return $(),j(L),p=wa,E=!1,w},this.write=function(L){if(typeof L!="string")throw Ei("required args <xml=string>");return f||($(),f=!0),w||(h=j(h+L,!0)||""),this},this.end=function(){return f||$(),f=!1,w||j(h),h="",p=wa,E=!1,w},this.stop=function(){E=!0};function j(L,F=!1){var re=null,Ae=null,Je,q=0,ae=!1,ue=!1,oe=0,ce=0,X,B,N,V,be,bt,R,_,v,M="",O=0,H;function ne(Ne,ft){var Dt=Ne.indexOf(":");if(Dt===-1)return Ne;var Ft=x[Ne.substring(0,Dt)];return Ft?ft===Ft?Ne.substr(Dt+1):Ft+Ne.substr(Dt):(C(Vb(Ne.substring(0,Dt))),null)}function ye(){if(H!==null)return H;var Ne,ft,Dt=g&&x.xmlns,Ft=g&&m?[]:null,Le=O,dt=M,Ht=dt.length,Rr,mn,On,P,D,z={},ie=new Set,te,Y,K;e:for(;Le<Ht;Le++)if(te=!1,Y=dt.charCodeAt(Le),!(Y===32||Y<14&&Y>8)){for((Y<65||Y>122||Y>90&&Y<97)&&Y!==95&&Y!==58&&(C("illegal first char attribute name"),te=!0),K=Le+1;K<Ht;K++)if(Y=dt.charCodeAt(K),!(Y>96&&Y<123||Y>64&&Y<91||Y>47&&Y<59||Y===46||Y===45||Y===95)){if(Y===32||Y<14&&Y>8){C("missing attribute value"),Le=K;continue e}if(Y===61)break;C("illegal attribute name char"),te=!0}if(D=dt.substring(Le,K),D==="xmlns:xmlns"&&(C("illegal declaration of xmlns"),te=!0),Y=dt.charCodeAt(K+1),Y===34)K=dt.indexOf('"',Le=K+2),K===-1&&(K=dt.indexOf("'",Le),K!==-1&&(C("attribute value quote missmatch"),te=!0));else if(Y===39)K=dt.indexOf("'",Le=K+2),K===-1&&(K=dt.indexOf('"',Le),K!==-1&&(C("attribute value quote missmatch"),te=!0));else for(C("missing attribute value quotes"),te=!0,K=K+1;K<Ht&&(Y=dt.charCodeAt(K+1),!(Y===32||Y<14&&Y>8));K++);for(K===-1&&(C("missing closing quotes"),K=Ht,te=!0),te||(On=dt.substring(Le,K)),Le=K;K+1<Ht&&(Y=dt.charCodeAt(K+1),!(Y===32||Y<14&&Y>8));K++)Le===K&&(C("illegal character after attribute end"),te=!0);if(Le=K+1,te)continue e;if(ie.has(D)){C("attribute <"+D+"> already defined");continue}if(ie.add(D),!g){z[D]=On;continue}if(m){if(mn=D==="xmlns"?"xmlns":D.charCodeAt(0)===120&&D.substr(0,6)==="xmlns:"?D.substr(6):null,mn!==null){if(Ne=ir(On),ft=Uc(mn),P=A[Ne],!P){if(mn==="xmlns"||ft in x&&x[ft]!==Ne)do P="ns"+q++;while(typeof x[P]<"u");else P=mn;A[Ne]=P}x[mn]!==P&&(Rr||(x=Gb(x),Rr=!0),x[mn]=P,mn==="xmlns"&&(x[Uc(P)]=Ne,Dt=P),x[ft]=Ne),z[D]=On;continue}Ft.push(D,On);continue}D=ne(D,Dt),D!==null&&(z[D]=On)}if(m)for(Le=0,Ht=Ft.length;Le<Ht;Le++)D=ne(Ft[Le++],Dt),On=Ft[Le],D!==null&&(z[D]=On);return H=z}function De(){for(var Ne=/(\r\n|\r|\n)/g,ft=0,Dt=0,Ft=0,Le=ce,dt,Ht;oe>=Ft&&(dt=Ne.exec(L),!(!dt||(Le=dt[0].length+dt.index,Le>oe)));)ft+=1,Ft=Le;return oe==-1?(Dt=Le,Ht=L.substring(ce)):ce===0?Ht=L.substring(ce,oe):(Dt=oe-Ft,Ht=ce==-1?L.substring(oe):L.substring(oe,ce+1)),{data:Ht,line:ft,column:Dt}}for(p=De,t&&(v=Object.create({},{name:Ea(function(){return R}),originalName:Ea(function(){return _}),attrs:Ea(ye),ns:Ea(function(){return x})}));ce!==-1;){if(L.charCodeAt(ce)===60?oe=ce:oe=L.indexOf("<",ce),oe===-1){if(F)return L.substring(ce);if(S.length)return I("unexpected end of file");if(!d)return I("missing start tag");ce<L.length&&L.substring(ce).trim()&&C(mf);return}if(d||(d=!0),ce!==oe){if(S.length){if(n&&(n(L.substring(ce,oe),ir,p),E))return}else if(L.substring(ce,oe).trim()&&(C(mf),E))return}if(V=L.charCodeAt(oe+1),V===33){if(N=L.charCodeAt(oe+2),N===91&&L.substr(oe+3,6)==="CDATA["){if(ce=L.indexOf("]]>",oe),ce===-1)return F?L.substring(oe):I("unclosed cdata");if(o&&(o(L.substring(oe+9,ce),p),E))return;ce+=3;continue}if(N===45&&L.charCodeAt(oe+3)===45){if(ce=L.indexOf("-->",oe),ce===-1)return F?L.substring(oe):I("unclosed comment");if(c&&(c(L.substring(oe+4,ce),ir,p),E))return;ce+=3;continue}}if(V===63){if(ce=L.indexOf("?>",oe),ce===-1)return F?L.substring(oe):I("unclosed question");if(u&&(u(L.substring(oe,ce+2),p),E))return;ce+=2;continue}for(X=oe+1;;X++){if(be=L.charCodeAt(X),isNaN(be))return F?L.substring(oe):(ce=-1,I("unclosed tag"));if(be===34)N=L.indexOf('"',X+1),X=N!==-1?N:X;else if(be===39)N=L.indexOf("'",X+1),X=N!==-1?N:X;else if(be===62){ce=X;break}}if(V===33){if(l&&(l(L.substring(oe,ce+1),ir,p),E))return;ce+=1;continue}if(H={},V===47){if(ae=!1,ue=!0,!S.length)return I("missing open tag");if(X=R=S.pop(),N=oe+2+X.length,L.substring(oe+2,N)!==X)return I("closing tag mismatch");for(;N<ce;N++)if(V=L.charCodeAt(N),!(V===32||V>8&&V<14))return I("close tag")}else{if(L.charCodeAt(ce-1)===47?(X=R=L.substring(oe+1,ce-1),ae=!0,ue=!0):(X=R=L.substring(oe+1,ce),ae=!0,ue=!1),!(V>96&&V<123||V>64&&V<91||V===95||V===58))return I("illegal first char nodeName");for(N=1,B=X.length;N<B;N++)if(V=X.charCodeAt(N),!(V>96&&V<123||V>64&&V<91||V>47&&V<59||V===45||V===95||V==46)){if(V===32||V<14&&V>8){R=X.substring(0,N),H=null;break}return I("invalid nodeName")}ue||S.push(R)}if(g){Je=x,ae&&(ue||b.push(Je),H===null&&(m=X.indexOf("xmlns",N)!==-1)&&(O=N,M=X,ye(),m=!1)),_=R,Ae!==x&&(re=x[gf],re===void 0&&(re=x[gf]=Object.create(null)),Ae=x);var et=re[R];if(et!==void 0)R=et;else{if(V=R.indexOf(":"),V!==-1){if(bt=x[R.substring(0,V)],!bt)return I("missing namespace on <"+_+">");R=R.substr(V+1)}else bt=x.xmlns;bt&&(R=bt+":"+R),re[_]=R}}if(ae&&(O=N,M=X,i&&(t?i(v,ir,ue,p):i(R,ye,ir,ue,p),E)))return;if(ue){if(r&&(r(t?v:R,ir,ae,p),E))return;g&&(ae?x=Je:x=b.pop())}ce+=1}}}function yf(e){return e.xml&&e.xml.tagAlias==="lowerCase"}var qc={xsi:"http://www.w3.org/2001/XMLSchema-instance",xml:"http://www.w3.org/XML/1998/namespace"},_f="property";function bf(e){return e.xml&&e.xml.serialize}function qb(e){const t=bf(e);return t!==_f&&(t||null)}function Yb(e){return e.charAt(0).toUpperCase()+e.slice(1)}function xf(e,t){return yf(t)?e.prefix+":"+Yb(e.localName):e.name}function Kb(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 Xb(e,t,n){const i=Lt(e,t.xmlns),r=`${t[i.prefix]||i.prefix}:${i.localName}`,o=Lt(r);var a=n.getPackage(o.prefix);return Kb(o,a)}function wi(e){return new Error(e)}function ei(e){return e.$descriptor}function Zb(e){k(this,e),this.elementsById={},this.references=[],this.warnings=[],this.addReference=function(t){this.references.push(t)},this.addElement=function(t){if(!t)throw wi("expected element");var n=this.elementsById,i=ei(t),r=i.idProperty,o;if(r&&(o=t.get(r.name),o)){if(!/^([a-z][\w-.]*:)?[a-z_][\w-.]*$/i.test(o))throw new Error("illegal ID <"+o+">");if(n[o])throw wi("duplicate ID <"+o+">");n[o]=t}},this.addWarning=function(t){this.warnings.push(t)}}function go(){}go.prototype.handleEnd=function(){},go.prototype.handleText=function(){},go.prototype.handleNode=function(){};function Yc(){}Yc.prototype=Object.create(go.prototype),Yc.prototype.handleNode=function(){return this};function kr(){}kr.prototype=Object.create(go.prototype),kr.prototype.handleText=function(e){this.body=(this.body||"")+e};function vo(e,t){this.property=e,this.context=t}vo.prototype=Object.create(kr.prototype),vo.prototype.handleNode=function(e){if(this.element)throw wi("expected no sub nodes");return this.element=this.createReference(e),this},vo.prototype.handleEnd=function(){this.element.id=this.body},vo.prototype.createReference=function(e){return{property:this.property.ns.name,id:""}};function Kc(e,t){this.element=t,this.propertyDesc=e}Kc.prototype=Object.create(kr.prototype),Kc.prototype.handleEnd=function(){var e=this.body||"",t=this.element,n=this.propertyDesc;e=Vc(n.type,e),n.isMany?t.get(n.name).push(e):t.set(n.name,e)};function Sa(){}Sa.prototype=Object.create(kr.prototype),Sa.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 Vt(e,t,n){this.model=e,this.type=e.getType(t),this.context=n}Vt.prototype=Object.create(Sa.prototype),Vt.prototype.addReference=function(e){this.context.addReference(e)},Vt.prototype.handleText=function(e){var t=this.element,n=ei(t),i=n.bodyProperty;if(!i)throw wi("unexpected body text <"+e+">");kr.prototype.handleText.call(this,e)},Vt.prototype.handleEnd=function(){var e=this.body,t=this.element,n=ei(t),i=n.bodyProperty;i&&e!==void 0&&(e=Vc(i.type,e),t.set(i.name,e))},Vt.prototype.createElement=function(e){var t=e.attributes,n=this.type,i=ei(n),r=this.context,o=new n({}),a=this.model,s;return T(t,function(c,u){var l=i.propertiesByName[u],p;l&&l.isReference?l.isMany?(p=c.split(" "),T(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=Vc(l.type,c):u==="xmlns"?u=":"+u:(s=Lt(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},Vt.prototype.getPropertyForNode=function(e){var t=e.name,n=Lt(t),i=this.type,r=this.model,o=ei(i),a=n.name,s=o.propertiesByName[a];if(s&&!s.isAttr){const u=qb(s);if(u){const l=e.attributes[u];if(l){const p=Xb(l,e.ns,r),f=r.getType(p);return k({},s,{effectiveType:ei(f).name})}}return s}var c=r.getPackage(n.prefix);if(c){const u=xf(n,c),l=r.getType(u);if(s=He(o.properties,function(p){return!p.isVirtual&&!p.isReference&&!p.isAttribute&&l.hasType(p.type)}),s)return k({},s,{effectiveType:ei(l).name})}else if(s=He(o.properties,function(u){return!u.isReference&&!u.isAttribute&&u.type==="Element"}),s)return s;throw wi("unrecognized element <"+n.name+">")},Vt.prototype.toString=function(){return"ElementDescriptor["+ei(this.type).name+"]"},Vt.prototype.valueHandler=function(e,t){return new Kc(e,t)},Vt.prototype.referenceHandler=function(e){return new vo(e,this.context)},Vt.prototype.handler=function(e){return e==="Element"?new Dr(this.model,e,this.context):new Vt(this.model,e,this.context)},Vt.prototype.handleChild=function(e){var t,n,i,r;if(t=this.getPropertyForNode(e),i=this.element,n=t.effectiveType||t.type,pf(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?(k(o,{element:i}),this.context.addReference(o)):o.$parent=i),r};function Xc(e,t,n){Vt.call(this,e,t,n)}Xc.prototype=Object.create(Vt.prototype),Xc.prototype.createElement=function(e){var t=e.name,n=Lt(t),i=this.model,r=this.type,o=i.getPackage(n.prefix),a=o&&xf(n,o)||t;if(!r.hasType(a))throw wi("unexpected element <"+e.originalName+">");return Vt.prototype.createElement.call(this,e)};function Dr(e,t,n){this.model=e,this.context=n}Dr.prototype=Object.create(Sa.prototype),Dr.prototype.createElement=function(e){var t=e.name,n=Lt(t),i=n.prefix,r=e.ns[i+"$uri"],o=e.attributes;return this.model.createAny(t,r,o)},Dr.prototype.handleChild=function(e){var t=new Dr(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},Dr.prototype.handleEnd=function(){this.body&&(this.element.$body=this.body)};function Zc(e){e instanceof gn&&(e={model:e}),k(this,{lax:!1},e)}Zc.prototype.fromXML=function(e,t,n){var i=t.rootHandler;t instanceof Vt?(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 Zb(k({},t,{rootHandler:i})),s=new vf({proxy:!0}),c=Qb();i.context=a,c.push(i);function u(S,A,I){var C=A(),$=C.line,j=C.column,L=C.data;L.charAt(0)==="<"&&L.indexOf(" ")!==-1&&(L=L.slice(0,L.indexOf(" "))+">");var F="unparsable content "+(L?L+" ":"")+`detected
2
+ line: `+$+`
3
+ column: `+j+`
4
+ nested error: `+S.message;if(I)return a.addWarning({message:F,error:S}),!0;throw wi(F)}function l(S,A){return u(S,A,!0)}function p(){var S=a.elementsById,A=a.references,I,C;for(I=0;C=A[I];I++){var $=C.element,j=S[C.id],L=ei($).propertiesByName[C.property];if(j||a.addWarning({message:"unresolved reference <"+C.id+">",element:C.element,property:C.property,value:C.id}),L.isMany){var F=$.get(L.name),re=F.indexOf(C);re===-1&&(re=F.length),j?F[re]=j:F.splice(re,1)}else $.set(L.name,j)}}function f(){c.pop().handleEnd()}var d=/^<\?xml /i,h=/ encoding="([^"]+)"/i,m=/^utf-8$/i;function g(S){if(d.test(S)){var A=h.exec(S),I=A&&A[1];!I||m.test(I)||a.addWarning({message:"unsupported document encoding <"+I+">, falling back to UTF-8"})}}function w(S,A){var I=c.peek();try{c.push(I.handleNode(S))}catch(C){u(C,A,o)&&c.push(new Yc)}}function E(S,A){try{c.peek().handleText(S)}catch(I){l(I,A)}}function b(S,A){S.trim()&&E(S,A)}var x=r.getPackages().reduce(function(S,A){return S[A.uri]=A.prefix,S},Object.entries(qc).reduce(function(S,[A,I]){return S[I]=A,S},r.config&&r.config.nsMap||{}));return s.ns(x).on("openTag",function(S,A,I,C){var $=S.attrs||{},j=Object.keys($).reduce(function(F,re){var Ae=A($[re]);return F[re]=Ae,F},{}),L={name:S.name,originalName:S.originalName,attributes:j,ns:S.ns};w(L,C)}).on("question",g).on("closeTag",f).on("cdata",E).on("text",function(S,A,I){b(A(S),I)}).on("error",u).on("warn",l),new Promise(function(S,A){var I;try{s.parse(e),p()}catch(F){I=F}var C=i.element;!I&&!C&&(I=wi("failed to parse document as <"+i.type.$descriptor.name+">"));var $=a.warnings,j=a.references,L=a.elementsById;return I?(I.warnings=$,A(I)):S({rootElement:C,elementsById:L,references:j,warnings:$})})},Zc.prototype.handler=function(e){return new Xc(this.model,e)};function Qb(){var e=[];return Object.defineProperty(e,"peek",{value:function(){return this[this.length-1]}}),e}var Jb=`<?xml version="1.0" encoding="UTF-8"?>
5
+ `,e0=/<|>|'|"|&|\n\r|\n/g,Ef=/<|>|&/g;function Bn(e){this.prefixMap={},this.uriMap={},this.used={},this.wellknown=[],this.custom=[],this.parent=e,this.defaultPrefixMap=e&&e.defaultPrefixMap||{}}Bn.prototype.mapDefaultPrefixes=function(e){this.defaultPrefixMap=e},Bn.prototype.defaultUriByPrefix=function(e){return this.defaultPrefixMap[e]},Bn.prototype.byUri=function(e){return this.uriMap[e]||this.parent&&this.parent.byUri(e)},Bn.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)},Bn.prototype.uriByPrefix=function(e){return this.prefixMap[e||"xmlns"]||this.parent&&this.parent.uriByPrefix(e)},Bn.prototype.mapPrefix=function(e,t){this.prefixMap[e||"xmlns"]=t},Bn.prototype.getNSKey=function(e){return e.prefix!==void 0?e.uri+"|"+e.prefix:e.uri},Bn.prototype.logUsed=function(e){var t=e.uri,n=this.getNSKey(e);this.used[n]=this.byUri(t),this.parent&&this.parent.logUsed(e)},Bn.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 t0(e){return e.charAt(0).toLowerCase()+e.slice(1)}function n0(e,t){return yf(t)?t0(e):e}function wf(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})}function Sf(e){return Qt(e)?e:(e.prefix?e.prefix+":":"")+e.localName}function i0(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 r0(e,t){return t.isGeneric?k({localName:t.ns.localName},e):k({localName:n0(t.ns.localName,t.$pkg)},e)}function o0(e,t){return k({localName:t.ns.localName},e)}function a0(e){var t=e.$descriptor;return we(t.properties,function(n){var i=n.name;if(n.isVirtual||!Jt(e,i))return!1;var r=e[i];return r===n.default||r===null?!1:n.isMany?r.length:!0})}var s0={"\n":"#10","\n\r":"#10",'"':"#34","'":"#39","<":"#60",">":"#62","&":"#38"},c0={"<":"lt",">":"gt","&":"amp"};function Rf(e,t,n){return e=Qt(e)?e:""+e,e.replace(t,function(i){return"&"+n[i]+";"})}function u0(e){return Rf(e,e0,s0)}function l0(e){return Rf(e,Ef,c0)}function p0(e){return we(e,function(t){return t.isAttr})}function f0(e){return we(e,function(t){return!t.isAttr})}function Qc(e){this.tagName=e}Qc.prototype.build=function(e){return this.element=e,this},Qc.prototype.serializeTo=function(e){e.appendIndent().append("<"+this.tagName+">"+this.element.id+"</"+this.tagName+">").appendNewLine()};function rr(){}rr.prototype.serializeValue=rr.prototype.serializeTo=function(e){e.append(this.escape?l0(this.value):this.value)},rr.prototype.build=function(e,t){return this.value=t,e.type==="String"&&t.search(Ef)!==-1&&(this.escape=!0),this};function Jc(e){this.tagName=e}wf(Jc,rr),Jc.prototype.serializeTo=function(e){e.appendIndent().append("<"+this.tagName+">"),this.serializeValue(e),e.append("</"+this.tagName+">").appendNewLine()};function qe(e,t){this.body=[],this.attrs=[],this.parent=e,this.propertyDescriptor=t}qe.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=a0(e),this.parseAttributes(p0(r)),this.parseContainments(f0(r))),this.parseGenericAttributes(e,i),this},qe.prototype.nsTagName=function(e){var t=this.logNamespaceUsed(e.ns);return r0(t,e)},qe.prototype.nsPropertyTagName=function(e){var t=this.logNamespaceUsed(e.ns);return o0(t,e)},qe.prototype.isLocalNs=function(e){return e.uri===this.ns.uri},qe.prototype.nsAttributeName=function(e){var t;if(Qt(e)?t=Lt(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}:k({localName:t.localName},n)},qe.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}))},qe.prototype.parseGenericContainments=function(e){var t=e.$body;t&&this.body.push(new rr().build({type:"String"},t));var n=e.$children;n&&T(n,i=>{this.body.push(new qe(this).build(i))})},qe.prototype.parseNsAttribute=function(e,t,n){var i=e.$model,r=Lt(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)}},qe.prototype.parseNsAttributes=function(e){var t=this,n=e.$attrs,i=[];return T(n,function(r,o){var a=t.parseNsAttribute(e,o,r);a&&i.push(a)}),i},qe.prototype.parseGenericAttributes=function(e,t){var n=this;T(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)}})},qe.prototype.parseContainments=function(e){var t=this,n=this.body,i=this.element;T(e,function(r){var o=i.get(r.name),a=r.isReference,s=r.isMany;if(s||(o=[o]),r.isBody)n.push(new rr().build(r,o[0]));else if(pf(r.type))T(o,function(u){n.push(new Jc(t.addTagName(t.nsPropertyTagName(r))).build(r,u))});else if(a)T(o,function(u){n.push(new Qc(t.addTagName(t.nsPropertyTagName(r))).build(u))});else{var c=bf(r);T(o,function(u){var l;c?c===_f?l=new qe(t,r):l=new Ra(t,r,c):l=new qe(t),n.push(l.build(u))})}})},qe.prototype.getNamespaces=function(e){var t=this.namespaces,n=this.parent,i;return t||(i=n&&n.getNamespaces(),e||!i?this.namespaces=t=new Bn(i):t=i),t},qe.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},qe.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},qe.prototype.parseAttributes=function(e){var t=this,n=this.element;T(e,function(i){var r=n.get(i.name);if(i.isReference)if(!i.isMany)r=r.id;else{var o=[];T(r,function(a){o.push(a.id)}),r=o.join(" ")}t.addAttribute(t.nsAttributeName(i),r)})},qe.prototype.addTagName=function(e){var t=this.logNamespaceUsed(e);return this.getNamespaces().logUsed(t),Sf(e)},qe.prototype.addAttribute=function(e,t){var n=this.attrs;Qt(t)&&(t=u0(t));var i=sf(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)},qe.prototype.serializeAttributes=function(e){var t=this.attrs,n=this.namespaces;n&&(t=i0(n).concat(t)),T(t,function(i){e.append(" ").append(Sf(i.name)).append('="').append(i.value).append('"')})},qe.prototype.serializeTo=function(e){var t=this.body[0],n=t&&t.constructor!==rr;e.appendIndent().append("<"+this.tagName),this.serializeAttributes(e),e.append(t?">":" />"),t&&(n&&e.appendNewLine().indent(),T(this.body,function(i){i.serializeTo(e)}),n&&e.unindent().appendIndent(),e.append("</"+this.tagName+">")),e.appendNewLine()};function Ra(e,t,n){qe.call(this,e,t),this.serialization=n}wf(Ra,qe),Ra.prototype.parseNsAttributes=function(e){var t=qe.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},Ra.prototype.isLocalNs=function(e){return e.uri===(this.typeNs||this.ns).uri};function d0(){this.value="",this.write=function(e){this.value+=e}}function h0(e,t){var n=[""];this.append=function(i){return e.write(i),this},this.appendNewLine=function(){return t&&e.write(`
6
+ `),this},this.appendIndent=function(){return t&&e.write(n.join(" ")),this},this.indent=function(){return n.push(""),this},this.unindent=function(){return n.pop(),this}}function m0(e){e=k({format:!1,preamble:!0},e||{});function t(n,i){var r=i||new d0,o=new h0(r,e.format);e.preamble&&o.append(Jb);var a=new qe,s=n.$model;if(a.getNamespaces().mapDefaultPrefixes(g0(s)),a.build(n).serializeTo(o),!i)return r.value}return{toXML:t}}function g0(e){const t=e.config&&e.config.nsMap||{},n={};for(const i in qc)n[i]=qc[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 Ca(e,t){gn.call(this,e,t)}Ca.prototype=Object.create(gn.prototype),Ca.prototype.fromXML=function(e,t,n){Qt(t)||(n=t,t="bpmn:Definitions");var i=new Zc(k({model:this,lax:!0},n)),r=i.handler(t);return i.fromXML(e,r)},Ca.prototype.toXML=function(e,t){var n=new m0(t);return new Promise(function(i,r){try{var o=n.toXML(e);return i({xml:o})}catch(a){return r(a)}})};var v0="BPMN20",y0="http://www.omg.org/spec/BPMN/20100524/MODEL",_0="bpmn",b0=[],x0=[{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"}]}],E0=[{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"}]}],w0={tagAlias:"lowerCase",typePrefix:"t"},S0={name:v0,uri:y0,prefix:_0,associations:b0,types:x0,enumerations:E0,xml:w0},R0="BPMNDI",C0="http://www.omg.org/spec/BPMN/20100524/DI",P0="bpmndi",A0=[{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"]}],T0=[{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"}]}],M0=[],k0={name:R0,uri:C0,prefix:P0,types:A0,enumerations:T0,associations:M0},D0="DC",O0="http://www.omg.org/spec/DD/20100524/DC",I0="dc",L0=[{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}]}],B0=[],N0={name:D0,uri:O0,prefix:I0,types:L0,associations:B0},$0="DI",j0="http://www.omg.org/spec/DD/20100524/DI",F0="di",H0=[{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"}]}],z0=[],V0={tagAlias:"lowerCase"},G0={name:$0,uri:j0,prefix:F0,types:H0,associations:z0,xml:V0},W0="bpmn.io colors for BPMN",U0="http://bpmn.io/schema/bpmn/biocolor/1.0",q0="bioc",Y0=[{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"}]}],K0=[],X0=[],Z0={name:W0,uri:U0,prefix:q0,types:Y0,enumerations:K0,associations:X0},Q0="BPMN in Color",J0="http://www.omg.org/spec/BPMN/non-normative/color/1.0",ex="color",tx=[{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"}]}],nx=[],ix=[],rx={name:Q0,uri:J0,prefix:ex,types:tx,enumerations:nx,associations:ix};const ox={bpmn:S0,bpmndi:k0,dc:N0,di:G0,bioc:Z0,color:rx};function Cf(e,t){const n=k({},ox,e);return new Ca(n,t)}const ax={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"}},sx="http://www.omg.org/spec/BPMN/non-normative/extensions/i18n/1.0",Pf="i18n",Pa={[Pf]:ax,[Bc]:tf};function Af(){return Cf(Pa)}const Tf=Af();async function eu(e){const{rootElement:t,warnings:n}=await Tf.fromXML(e,"bpmn:Definitions");return{definitions:t,warnings:n}}async function cx(e){const{xml:t}=await Tf.toXML(e,{format:!0});return t}function tu(e){return e.map(t=>typeof t=="string"?t:t.message??String(t))}const Aa=new Set(["bpmn:Participant","bpmn:Lane","bpmn:Group","bpmn:SubProcess","bpmn:AdHocSubProcess","bpmn:Transaction"]),ux=1,lx=2;function Si(e){switch(e.kind){case"edge-crosses-shape":return`x|${e.edge}|${e.shape}`;case"shape-overlap":return`o|${e.shapes[0]}|${e.shapes[1]}`;case"shape-outside-container":return`c|${e.shape}|${e.container}`;case"edge-overlap-opposite":return`p|${e.edges[0]}|${e.edges[1]}`;case"label-on-shared-segment":return`l|${e.edge}|${e.other}`}}const Mf=20,kf=1;function or(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 nu(e,t){let n=null;for(const i of or(e))for(const r of or(t)){if(i.axis!==r.axis||i.dir===r.dir||Math.abs(i.at-r.at)>kf)continue;const o=Math.min(i.hi,r.hi)-Math.max(i.lo,r.lo);o>=Mf&&(!n||o>n.length)&&(n={axis:i.axis,length:o})}return n}function iu(e,t){let n=0;for(const i of t)i.id!==e.id&&nu(e,i)&&n++;return n}const ru=15,Df=20;function px(e,t){const n=t.axis==="v"?[e.x,e.x+e.width]:[e.y,e.y+e.height];if(t.at<n[0]-Df||t.at>n[1]+Df)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 ou=20;function au(e,t){const n=[];for(const i of t){if(i.axis!==e.axis||Math.abs(i.at-e.at)>kf)continue;const r=Math.max(e.lo,i.lo),o=Math.min(e.hi,i.hi);o-r<Mf||n.push([r-ou,o+ou])}return n}function Ta(e,t){const n=e.label;if(!n)return null;let i=null;for(const r of or(e)){const o=px(n,r);if(o){for(const a of t)if(a.id!==e.id&&!(i&&a.id>=i.other)){for(const[s,c]of au(r,or(a)))if(Math.min(c,o[1])>Math.max(s,o[0])){i={other:a.id,axis:r.axis};break}}}}return i}const fx=1,dx=(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 hx(e,t,n,i){const r=n.x+i,o=n.y+i,a=n.x+n.width-i,s=n.y+n.height-i;if(a<=r||s<=o)return!1;const c=t.x-e.x,u=t.y-e.y;let l=0,p=1;const f=(d,h)=>{if(h===0)return d<=0;const m=d/h;if(h>0){if(m>p)return!1;m>l&&(l=m)}else{if(m<l)return!1;m<p&&(p=m)}return!0};return f(r-e.x,c)&&f(e.x-a,-c)&&f(o-e.y,u)&&f(e.y-s,-u)&&p>l}function mx(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 gx=(e,t)=>e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height;function ar(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(hx(e.waypoints[o],e.waypoints[o+1],r,lx)){i.push(r);break}}return i}function vx(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 yx=(e,t)=>e.endpoints.some(n=>t.endpoints.includes(n));function Or(e,t){let n=0;for(const i of t){if(i.id===e.id||yx(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++)vx(e.waypoints[o],e.waypoints[o+1],i.waypoints[a],i.waypoints[a+1])&&(r=!0);r&&n++}return n}function su(e){const t=[],n=e.edges;for(let i=0;i<n.length;i++)for(let r=i+1;r<n.length;r++)if(Or(n[i],[n[r]])>0){const o=n[i].id,a=n[r].id;t.push(o<a?[o,a]:[a,o])}return t.sort((i,r)=>`${i[0]}|${i[1]}`.localeCompare(`${r[0]}|${r[1]}`))}const yo=e=>e.shapes.filter(t=>!t.container);function Ri(e){const t=[],n=e.shapes.filter(o=>!o.container);for(const o of e.edges)for(const a of ar(o,n))t.push({kind:"edge-crosses-shape",edge:o.id,shape:a.id});const i=n.filter(o=>!o.attached);for(let o=0;o<i.length;o++)for(let a=o+1;a<i.length;a++){const s=i[o],c=i[a];if(!mx(s,c,ux))continue;const u=s.id<c.id?[s.id,c.id]:[c.id,s.id];t.push({kind:"shape-overlap",shapes:u,identical:gx(s,c)})}for(let o=0;o<e.edges.length;o++)for(let a=o+1;a<e.edges.length;a++){const s=e.edges[o],c=e.edges[a],u=nu(s,c);if(!u)continue;const l=s.id<c.id?[s.id,c.id]:[c.id,s.id];t.push({kind:"edge-overlap-opposite",edges:l,axis:u.axis,length:Math.round(u.length)})}for(const o of e.edges){if(!o.label)continue;const a=Ta(o,e.edges);a&&t.push({kind:"label-on-shared-segment",edge:o.id,other:a.other,axis:a.axis})}const r=new Map(e.shapes.map(o=>[o.id,o]));for(const o of n){if(!o.parent)continue;const a=r.get(o.parent);!a||!a.container||dx(a,o,fx)||t.push({kind:"shape-outside-container",shape:o.id,container:a.id})}return t.sort((o,a)=>Si(o).localeCompare(Si(a)))}const wt=e=>typeof e=="object"&&e!==null?e:void 0,Bt=e=>typeof e=="number"?e:0,sr=e=>{const t=wt(e);return typeof(t==null?void 0:t.id)=="string"?t.id:void 0};function _x(e){const t=wt(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=sr(o);a&&n.push(a)}}return n}function bx(e,t){const n=wt(e.$parent);if(!n)return;const i=typeof n.$type=="string"?n.$type:"";if(i==="bpmn:Process"){const r=sr(n);return r?t.get(r):void 0}if(Aa.has(i)&&i!=="bpmn:Lane"&&i!=="bpmn:Group")return sr(n)}function Of(e){var o,a,s,c;const t=[],n=[],i=((o=wt(e))==null?void 0:o.diagrams)??[],r=new Map;for(const u of((a=wt(e))==null?void 0:a.rootElements)??[]){const l=wt(u);if((l==null?void 0:l.$type)==="bpmn:Collaboration")for(const p of l.participants??[]){const f=wt(p),d=sr(f),h=sr(f==null?void 0:f.processRef);d&&h&&r.set(h,d)}}for(const u of i){const l=wt((s=wt(u))==null?void 0:s.plane),p=(l==null?void 0:l.planeElement)??[];for(const f of p){const d=wt(f);if(!d)continue;const h=wt(d.bpmnElement),m=typeof(h==null?void 0:h.id)=="string"?h.id:void 0;if(!m)continue;const g=typeof(h==null?void 0:h.$type)=="string"?h.$type:"",w=wt(d.bounds);if(w){const b=d.isExpanded===!1;t.push({id:m,type:g,x:Bt(w.x),y:Bt(w.y),width:Bt(w.width),height:Bt(w.height),container:Aa.has(g)&&!b,attached:(h==null?void 0:h.attachedToRef)!==void 0,...h?{parent:bx(h,r)}:{}});continue}const E=d.waypoint;if(Array.isArray(E)){const b=wt((c=wt(d.label))==null?void 0:c.bounds);n.push({id:m,type:g,waypoints:E.map(x=>{var S,A;return{x:Bt((S=wt(x))==null?void 0:S.x),y:Bt((A=wt(x))==null?void 0:A.y)}}),endpoints:_x(h),...b?{label:{x:Bt(b.x),y:Bt(b.y),width:Bt(b.width),height:Bt(b.height)}}:{}})}}}return{shapes:t,edges:n}}function If(e){return Ri(Of(e))}async function xx(e){const{definitions:t,warnings:n}=await eu(e);return{findings:If(t),warnings:n}}function Nn(e){const t=[],n=[];for(const i of e.getAll()){const r=i;if(r.type==="label"||r.labelTarget)continue;const o=typeof r.type=="string"?r.type:"";if(o==="bpmn:Definitions"||o.startsWith("bpmndi:"))continue;const a=r.waypoints;if(a){const p=wt(r.label);n.push({id:r.id,type:o,waypoints:a.map(f=>({x:Bt(f.x),y:Bt(f.y)})),endpoints:[sr(r.source),sr(r.target)].filter(f=>!!f),...p&&typeof p.x=="number"?{label:{x:p.x,y:Bt(p.y),width:Bt(p.width),height:Bt(p.height)}}:{}});continue}if(typeof r.x!="number"||typeof r.y!="number")continue;const s=wt(r.businessObject);let c=wt(r.parent);for(;c&&c.type==="bpmn:Lane";)c=wt(c.parent);const u=typeof(c==null?void 0:c.type)=="string"?c.type:"",l=c&&Aa.has(u)&&u!=="bpmn:Group"&&typeof c.id=="string"?c.id:void 0;t.push({id:r.id,type:o,x:r.x,y:r.y,width:Bt(r.width),height:Bt(r.height),container:Aa.has(o)&&r.collapsed!==!0,attached:(s==null?void 0:s.attachedToRef)!==void 0,...l!==void 0?{parent:l}:{}})}return{shapes:t,edges:n}}const Ex={"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 wx(e,t){const n=Ex[e];return n||(e==="label"||e.startsWith("bpmndi:")?"other":e.startsWith("bpmn:")&&!("waypoints"in t&&t.waypoints)?"flowNode":"other")}function Lf(e){let t=e.parent;for(;t;){if(t.type==="bpmn:Participant")return t.id;t=t.parent}}function Bf(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 wx(i.type,i)},lanesOf:n=>t().filter(i=>i.type==="bpmn:Lane"&&Lf(i)===n).sort((i,r)=>i.y-r.y).map(i=>i.id),participantOf:n=>{const i=e.get(n);return i?Lf(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 Nf=20,Sx=4,Gt=(e,t)=>Math.abs(e-t)<.5;function $f(e,t,n,i=Nf){if(Gt(e.y,t.y)&&!Gt(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(Gt(e.x,t.x)&&!Gt(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 jf(e,t,n=Nf){if(e.length!==4)return null;const[i,r,o,a]=e;if(Gt(i.y,r.y)&&Gt(r.x,o.x)&&Gt(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(Gt(i.x,r.x)&&Gt(r.y,o.y)&&Gt(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}const Rx=(e,t,n)=>[...e.slice(0,t+1),...n,...e.slice(t+1)],Ff=(e,t,n)=>ar({...e,waypoints:t},n).length;function Hf(e,t,n){let i=[...e.waypoints],r=Ff(e,i,t);if(r===0)return null;let o=!1;const a=s=>!n||s.every(c=>c.x>=n.x&&c.x<=n.x+n.width&&c.y>=n.y&&c.y<=n.y+n.height);for(let s=0;s<Sx&&r>0;s++){let c=!1;for(let u=0;u+1<i.length&&!c;u++){const l=i[u],p=i[u+1];for(const f of t){if(e.endpoints.includes(f.id)||ar({...e,waypoints:[l,p]},[f]).length===0)continue;const d=$f(l,p,f),h=d?d.map(g=>Rx(i,u,g)):jf(i,f)??[];if(!h.length)continue;const m=[...h].sort((g,w)=>Number(a(w))-Number(a(g)));for(const g of m){const w=Ff(e,g,t);if(w<r){i=g,r=w,c=!0,o=!0;break}}if(c)break}}if(!c)break}return o&&r===0?i:null}function zf(e,t){const{elementRegistry:n}=e,i=e.modeling,r=Nn(n),o=yo(r),a=Ri(r).filter(c=>c.kind==="edge-crosses-shape"&&!t.has(Si(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=Hf(u,o,f);d&&i.updateWaypoints(l,d)}}const Cx=10;function Vf(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 Gf(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=Vf(i,n),a=Vf(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,re)=>F.y-re.y);if(!l.length)return null;const p=l[0],f=l[l.length-1],d=(c.y+c.height+p.y)/2,h=(f.y+f.height+u.y)/2,m=s?d:h,g=s?h:d,w=e.waypoints[0],E=e.waypoints[e.waypoints.length-1],b=yo(t),x=t.edges.filter(F=>F.id!==e.id),S=Or(e,x),A=ar(e,b).length;if(S===0&&A===0)return null;const I=Math.min(...l.map(F=>F.x)),C=Math.max(...l.map(F=>F.x+F.width)),$=(w.x+E.x)/2,j=F=>F.filter((re,Ae)=>Ae===0||!(Gt(re.x,F[Ae-1].x)&&Gt(re.y,F[Ae-1].y)));let L;for(let F=I;F<=C;F+=Cx){const re=j([w,{x:w.x,y:m},{x:F,y:m},{x:F,y:g},{x:E.x,y:g},E]),Ae={...e,waypoints:re};if(ar(Ae,b).length>0)continue;const Je=Or(Ae,x),q=Math.abs(F-$);(!L||Je<L.cross||Je===L.cross&&q<L.detour)&&(L={pts:re,cross:Je,detour:q})}return L&&(A>0?L.cross<=S:L.cross<S)?L.pts:null}function Wf(e,t){const{elementRegistry:n}=e,i=e.modeling,r=Nn(n);for(const o of r.edges){if(o.type!=="bpmn:MessageFlow"||t.has(o.id))continue;const a=Nn(n),s=a.edges.find(l=>l.id===o.id);if(!s)continue;const c=Gf(s,a);if(!c)continue;const u=n.get(o.id);u&&i.updateWaypoints(u,c)}}const Px=[25,-25,40,-40],Uf=35;function Ax(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=[{x:n.x,y:r},{x:o,y:r},{x:o,y:c}],l=s?n.y:n.y+n.height,p=s?n.y-Uf:n.y+n.height+Uf;return[u,[{x:a,y:l},{x:a,y:p},{x:o,y:p},{x:o,y:c}]]}function Tx(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=Gt(n[0].x,n[1].x)&&!Gt(n[0].y,n[1].y),s=Gt(n[n.length-1].x,n[n.length-2].x)&&!Gt(n[n.length-1].y,n[n.length-2].y);for(const c of Px){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(u)}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(u)}}return i}function qf(e,t){const n=new Map(t.shapes.map(u=>[u.id,u])),i=yo(t),r=t.edges.filter(u=>u.id!==e.id),o=iu(e,r);if(o===0)return null;const a=Or(e,r);let s;const c=u=>u.reduce((l,p,f)=>f?l+Math.abs(p.x-u[f-1].x)+Math.abs(p.y-u[f-1].y):0,0);for(const u of[...Ax(e,n),...Tx(e,n)]){const l={...e,waypoints:u};if(ar(l,i).length>0)continue;const p=iu(l,r),f=Or(l,r);if(p>=o||f-a>o-p)continue;const d=c(u);(!s||p<s.opposite||p===s.opposite&&(f<s.cross||f===s.cross&&d<s.len))&&(s={pts:u,opposite:p,cross:f,len:d})}return(s==null?void 0:s.pts)??null}function Yf(e,t,n){const{elementRegistry:i}=e,r=e.modeling,o=Nn(i),a=Ri(o).filter(c=>c.kind==="edge-overlap-opposite"&&!t.has(Si(c)));if(!a.length)return;const s=new Set;for(const c of a)if(c.kind==="edge-overlap-opposite")for(const u of c.edges)n.has(u)||s.add(u);for(const c of s){const u=Nn(i),l=u.edges.find(d=>d.id===c);if(!l)continue;const p=qf(l,u);if(!p)continue;const f=i.get(c);f&&r.updateWaypoints(f,p)}}const Mx=10,kx=(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 Kf(e,t){const n=e.label;if(!n)return null;const i=t.edges.filter(a=>a.id!==e.id);if(!Ta(e,i))return null;const r=yo(t),o=i.flatMap(or);for(const a of or(e)){let s=[[a.lo,a.hi]];for(const[d,h]of au(a,o))s=s.flatMap(([m,g])=>{const w=[];return d>m&&w.push([m,Math.min(g,d)]),h<g&&w.push([Math.max(m,h),g]),w.filter(([E,b])=>b>E)});const c=a.axis==="h"?n.width:n.height,u=s.find(([d,h])=>h-d>=c+Mx*2);if(!u)continue;const l=(u[0]+u[1])/2,p=a.axis==="h"?{x:l,y:a.at-ru}:{x:a.at+ru,y:l},f={x:p.x-n.width/2,y:p.y-n.height/2,width:n.width,height:n.height};if(!Ta({...e,label:f},i)&&!r.some(d=>!e.endpoints.includes(d.id)&&kx(f,d)))return f}return null}function Xf(e,t,n){const{elementRegistry:i}=e,r=e.modeling,o=Nn(i),a=Ri(o).filter(s=>s.kind==="label-on-shared-segment"&&!t.has(Si(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=Kf(c,o);if(!u)continue;const l=i.get(s.edge),p=l==null?void 0:l.label;p&&r.moveElements([p],{x:u.x-p.x,y:u.y-p.y})}}const Dx=/^[\p{L}_][\p{L}\p{N}_.\-]*$/u,Zf=new Set(["sequenceFlow","messageFlow","dataAssociation","association"]),Qf={"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}]},Ma=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),cu=e=>typeof e=="string"&&e!=="";function Ox(e){const t=[];function n(i,r,o,a){if(a===null){cu(o)||t.push({kind:"payload-invalid",opIndex:i,field:r});return}if(!Ma(o)){t.push({kind:"payload-invalid",opIndex:i,field:r});return}for(const s of a)cu(o[s])||t.push({kind:"payload-invalid",opIndex:i,field:`${r}.${s}`})}return e.forEach((i,r)=>{if(!Ma(i)||!cu(i.kind)||!(i.kind in Qf)){t.push({kind:"payload-invalid",opIndex:r,field:"kind"});return}for(const o of Qf[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(!Ma(u))break;u=u[p]}if(!Ma(u))continue;const l=u[c[c.length-1]];if(!(l===void 0&&o.optional)&&!(l===null&&o.optional)){if(!a){n(r,o.path,l,o.shape);continue}if(!Array.isArray(l)){t.push({kind:"payload-invalid",opIndex:r,field:o.path});continue}l.forEach((p,f)=>n(r,`${s}[${f}]`,p,o.shape))}}if(i.kind==="node.add"){const o=i.band;o!==void 0&&(!Number.isInteger(o)||o<0)&&t.push({kind:"payload-invalid",opIndex:r,field:"band"})}}),t}function Jf(e,t){const n=Ox(e);if(n.length>0)return n;const i=[],r=new Map,o=new Map;function a(f,d,h){if(!Dx.test(d)){i.push({kind:"id-invalid",opIndex:f,id:d});return}if(t.categoryOf(d)!==void 0||r.has(d)){i.push({kind:"id-duplicate",opIndex:f,id:d});return}r.set(d,{...h,opIndex:f})}e.forEach((f,d)=>{var h;switch(f.kind){case"participant.add":a(d,f.participant.id,{category:"participant",lanes:(f.participant.lanes??[]).map(m=>m.id)});for(const m of f.participant.lanes??[])a(d,m.id,{category:"lane"});break;case"node.add":a(d,f.node.id,{category:"flowNode",participant:f.node.participant});break;case"sequenceFlow.add":a(d,f.flow.id,{category:"sequenceFlow"});break;case"messageFlow.add":a(d,f.flow.id,{category:"messageFlow"});break;case"dataStore.add":a(d,f.dataStore.id,{category:"dataStore"});for(const m of f.associations??[])m.id&&a(d,m.id,{category:"dataAssociation"});break;case"dataAssociation.add":f.association.id&&a(d,f.association.id,{category:"dataAssociation"});break;case"association.add":f.association.id&&a(d,f.association.id,{category:"association"});break;case"annotation.add":a(d,f.annotation.id,{category:"annotation"}),(h=f.association)!=null&&h.id&&a(d,f.association.id,{category:"association"});break;case"group.add":a(d,f.group.id,{category:"group"});break;case"participant.update":if(f.lanes){o.set(f.id,f.lanes.map(m=>m.id));for(const m of f.lanes)t.categoryOf(m.id)===void 0&&a(d,m.id,{category:"lane"})}break}});const s=f=>{var d;return((d=r.get(f))==null?void 0:d.category)??t.categoryOf(f)},c=f=>{const d=r.get(f);return d?d.category==="participant"?f:d.participant:t.categoryOf(f)==="participant"?f:t.participantOf(f)};function u(f,d,h,m){const g=s(d);if(g===void 0){i.push({kind:"ref-missing",opIndex:f,ref:d,role:h});return}if(m&&!m.includes(g)){i.push({kind:"ref-category",opIndex:f,ref:d,role:h,expected:m.join("|"),actual:g});return}return g}const l=t.isCollaboration()||e.some(f=>f.kind==="participant.add");return e.forEach((f,d)=>{var h;switch(f.kind){case"participant.add":break;case"node.add":{const{participant:m,lane:g}=f.node;if(m===void 0){(l||g!==void 0)&&i.push({kind:"participant-required",opIndex:d,id:f.node.id});break}if(u(d,m,"participant",["participant"])===void 0)break;g!==void 0&&((((h=r.get(m))==null?void 0:h.lanes)??o.get(m)??t.lanesOf(m)).includes(g)||i.push({kind:"lane-unknown",opIndex:d,lane:g,participant:m}));break}case"sequenceFlow.add":{const{id:m,source:g,target:w,name:E,condition:b}=f.flow,x=u(d,g,"source",["flowNode"]),S=u(d,w,"target",["flowNode"]);x&&S&&c(g)!==c(w)&&i.push({kind:"flow-cross-pool",opIndex:d,id:m}),E!==void 0&&b!==void 0&&i.push({kind:"condition-name-conflict",opIndex:d,id:m});break}case"messageFlow.add":{const{id:m,source:g,target:w}=f.flow,E=u(d,g,"source",["flowNode","participant"]),b=u(d,w,"target",["flowNode","participant"]);if(E&&b){const x=c(g),S=c(w);x!==void 0&&x===S&&i.push({kind:"message-flow-same-pool",opIndex:d,id:m})}break}case"dataStore.add":{for(const m of f.associations??[]){if([m.source,m.target].filter(E=>E===f.dataStore.id).length!==1){i.push({kind:"data-association-ends",opIndex:d,source:m.source,target:m.target});continue}const w=m.source===f.dataStore.id?m.target:m.source;u(d,w,"dataAssociation",["flowNode"])}break}case"dataAssociation.add":{const{source:m,target:g}=f.association,w=u(d,m,"source"),E=u(d,g,"target");if(w&&E){const b=new Set([w,E]);b.has("dataStore")&&b.has("flowNode")||i.push({kind:"data-association-ends",opIndex:d,source:m,target:g})}break}case"association.add":{const{id:m,source:g,target:w}=f.association,E=u(d,g,"source"),b=u(d,w,"target");E&&b&&E!=="annotation"&&b!=="annotation"&&i.push({kind:"association-detached",opIndex:d,annotation:m??`${g}->${w}`});break}case"annotation.add":{if(f.association){const{source:m,target:g}=f.association;if(m!==f.annotation.id&&g!==f.annotation.id)i.push({kind:"association-detached",opIndex:d,annotation:f.annotation.id});else{const w=m===f.annotation.id?g:m;u(d,w,"association")}}f.placement&&u(d,f.placement.anchor,"anchor");break}case"group.add":{for(const m of f.group.members??[]){const g=u(d,m,"member");g&&Zf.has(g)&&i.push({kind:"ref-category",opIndex:d,ref:m,role:"member",expected:"shape",actual:g})}break}case"participant.update":{if(p(d,f.id,"participant")===void 0)break;if(f.lanes){const m=t.lanesOf(f.id),g=f.lanes.map(E=>E.id);for(const E of m)g.includes(E)||i.push({kind:"lane-shrink-unsupported",opIndex:d,participant:f.id,lane:E});for(const E of g)t.categoryOf(E)!==void 0&&!m.includes(E)&&i.push({kind:"id-duplicate",opIndex:d,id:E});const w=g.filter(E=>m.includes(E));w.length===m.length&&w.some((E,b)=>E!==m[b])&&i.push({kind:"lane-reorder-unsupported",opIndex:d,participant:f.id})}break}case"node.update":{if(p(d,f.id,"flowNode")===void 0)break;if(f.lane!==void 0){const m=t.participantOf(f.id);(m?o.get(m)??t.lanesOf(m):[]).includes(f.lane)||i.push({kind:"lane-unknown",opIndex:d,lane:f.lane,participant:m??""})}break}case"sequenceFlow.update":{if(p(d,f.id,"sequenceFlow")===void 0)break;if(f.name!==void 0&&f.condition!==void 0&&i.push({kind:"condition-name-conflict",opIndex:d,id:f.id}),f.source!==void 0||f.target!==void 0){const m=f.source===void 0||u(d,f.source,"source",["flowNode"])!==void 0,g=f.target===void 0||u(d,f.target,"target",["flowNode"])!==void 0,w=t.endpointsOf(f.id),E=f.source??(w==null?void 0:w.source),b=f.target??(w==null?void 0:w.target);m&&g&&E!==void 0&&b!==void 0&&new Set([c(E),c(b),c(f.id)]).size>1&&i.push({kind:"flow-cross-pool",opIndex:d,id:f.id})}break}case"messageFlow.update":p(d,f.id,"messageFlow");break;case"dataStore.update":p(d,f.id,"dataStore");break;case"annotation.update":{if(p(d,f.id,"annotation")===void 0)break;f.placement&&u(d,f.placement.anchor,"anchor");break}case"group.update":{if(p(d,f.id,"group")===void 0)break;for(const m of f.members??[]){const g=u(d,m,"member");g&&Zf.has(g)&&i.push({kind:"ref-category",opIndex:d,ref:m,role:"member",expected:"shape",actual:g})}break}case"element.remove":{p(d,f.id)==="lane"&&i.push({kind:"ref-category",opIndex:d,ref:f.id,role:"target",expected:"removable",actual:"lane"});break}}}),i;function p(f,d,h){if(r.has(d)){i.push({kind:"target-added-in-batch",opIndex:f,id:d});return}const m=t.categoryOf(d);if(m===void 0){i.push({kind:"ref-missing",opIndex:f,ref:d,role:"target"});return}if(h&&m!==h){i.push({kind:"ref-category",opIndex:f,ref:d,role:"target",expected:h,actual:m});return}return m}}function ed(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 ka(e){return`bpmn:${e[0].toUpperCase()}${e.slice(1)}`}const td={"top-left":[-1,-1],top:[0,-1],"top-right":[1,-1],right:[1,0],"bottom-right":[1,1],bottom:[0,1],"bottom-left":[-1,1],left:[-1,0]};function Pt(e,t){return e.filter(n=>n.kind===t)}function nd(e,t){var Ht,Rr,mn,On;const{modeling:n,bpmnFactory:i,elementFactory:r,elementRegistry:o,canvas:a,autoPlace:s,bpmnReplace:c}=t,u=()=>a.getRootElement(),l=P=>o.get(P),p=P=>{const D=l(P);if(!D)throw new Error(`하강 참조 해소 실패: ${P}`);return D},f=P=>{let D=P.parent;for(;D;){if(D.type==="bpmn:Participant")return D;D=D.parent}},d=Pt(e,"participant.add"),h=Pt(e,"node.add"),m=Pt(e,"sequenceFlow.add"),g=Pt(e,"messageFlow.add"),w=Pt(e,"dataStore.add"),E=Pt(e,"dataAssociation.add"),b=Pt(e,"annotation.add"),x=Pt(e,"group.add"),S=new Map(h.map(P=>[P.node.id,P])),A=(P,D,z)=>{var ht;const ie=P.businessObject,te=(((ht=ie.extensionElements)==null?void 0:ht.values)??[]).filter(Ee=>Ee.$type!==D),Y=z?[...te,i.create(D,z)]:te;if(!Y.length){ie.extensionElements&&n.updateProperties(P,{extensionElements:void 0});return}const K=i.create("bpmn:ExtensionElements",{values:Y});Y.forEach(Ee=>{Ee.$parent=K}),n.updateProperties(P,{extensionElements:K})},I=P=>({anchor:P.anchor,side:P.side,...P.offset!==void 0?{offset:P.offset}:{}});for(const P of Pt(e,"element.remove")){const D=l(P.id);D&&n.removeElements([D])}const C=P=>o.filter(D=>{var z;return D.type==="bpmn:Lane"&&((z=f(D))==null?void 0:z.id)===P}).sort((D,z)=>D.y-z.y);for(const P of Pt(e,"participant.update")){const D=p(P.id);if(P.name!==void 0&&n.updateProperties(D,{name:P.name??void 0}),!P.lanes)continue;const z=C(P.id);if(!z.length){n.splitLane(D,P.lanes.length),C(P.id).forEach((te,Y)=>{const K=P.lanes[Y];K&&n.updateProperties(te,{id:K.id,name:K.name})});continue}const ie=new Set(z.map(te=>te.id));P.lanes.forEach((te,Y)=>{if(ie.has(te.id)){n.updateProperties(p(te.id),{name:te.name});return}const K=Y===0?n.addLane(C(P.id)[0],"top"):n.addLane(p(P.lanes[Y-1].id),"bottom");n.updateProperties(K,{id:te.id,name:te.name})})}const $=150,j=80,L=90,F=180,re=new Set;for(const P of d){re.add(`pool:${P.participant.id}`);for(const D of P.participant.lanes??[])re.add(D.id)}const Ae=new Map;for(const P of h){const D=P.node.lane??`pool:${P.node.participant??""}`;let z=Ae.get(D);z||Ae.set(D,z=new Set([0])),P.band!==void 0&&z.add(P.band)}const Je=new Map;for(const[P,D]of Ae){if(!re.has(P))continue;const z=[...D].sort((Y,K)=>Y-K),ie=z.map((Y,K)=>K===0?0:K%2===1?Math.ceil(K/2):-(K/2)),te=Math.min(...ie);Je.set(P,new Map(z.map((Y,K)=>[Y,ie[K]-te])))}const q=P=>{var D;return(((D=Ae.get(P))==null?void 0:D.size)??0)>1},ae=P=>P.band??(P.node.lane||!q(`pool:${P.node.participant??""}`)?void 0:0),ue=(P,D)=>{var z;return((z=Je.get(P))==null?void 0:z.get(D))??D},oe=new Map;for(const[P,D]of Ae){let z=0;for(const ie of D)z=Math.max(z,ue(P,ie));oe.set(P,z)}const ce=P=>F+$*P,X=d.map((P,D)=>({op:P,declared:D}));X.sort((P,D)=>{const z=P.op.order??Number.POSITIVE_INFINITY,ie=D.op.order??Number.POSITIVE_INFINITY;return z!==ie?z-ie:P.declared-D.declared});let B=80;for(const P of o.getAll())P.parent===u()&&"height"in P&&typeof P.y=="number"&&(B=Math.max(B,P.y+P.height+60));for(const{op:P}of X){const D=P.participant,z=h.filter(qt=>qt.node.participant===D.id).length,ie=((Ht=D.lanes)==null?void 0:Ht.length)??0,te=Math.max(1200,z*160+300),Y=(D.lanes??[]).map(qt=>ce(oe.get(qt.id)??0)),K=Y.reduce((qt,Ve)=>qt+Ve,0);ie&&K<300&&(Y[ie-1]+=300-K);const ht=Math.max(300,$*((oe.get(`pool:${D.id}`)??0)+1)),Ee=D.blackBox||z+ie===0?120:ie?Math.max(300,K):ht,We=r.createShape({type:"bpmn:Participant",businessObject:i.create("bpmn:Participant",{id:D.id,name:D.name,...P.order!==void 0?{"bwl:poolOrder":P.order}:{},...D.blackBox?{}:{processRef:i.create("bpmn:Process")}}),width:te,height:Ee,isExpanded:!0}),Zt=n.createShape(We,{x:100+te/2,y:B+Ee/2},u()),Tn=D.lanes??[];if(Tn.length&&n.splitLane(Zt,Tn.length),Tn.length){const qt=o.filter(Ve=>{var Rt;return Ve.type==="bpmn:Lane"&&((Rt=f(Ve))==null?void 0:Rt.id)===D.id}).sort((Ve,Rt)=>Ve.y-Rt.y);if(qt.forEach((Ve,Rt)=>{const Ue=Tn[Rt];Ue&&n.updateProperties(Ve,{id:Ue.id,name:Ue.name})}),Y.some(Ve=>Ve!==Zt.height/ie)){let Ve=Zt.y;qt.forEach((Rt,Ue)=>{const ln=Y[Ue];n.resizeShape(Rt,{x:Rt.x,y:Ve,width:Rt.width,height:ln}),Ve+=ln})}}B=Zt.y+Zt.height+60}const N=P=>{var ie;const D=S.get(P);if(D)return D.node.participant??"";const z=l(P);return z?z.type==="bpmn:Participant"?z.id:((ie=f(z))==null?void 0:ie.id)??"":""},V=new Map,be=P=>{let D=V.get(P);return D||V.set(P,D={nodes:[],flows:[]}),D};for(const P of h)be(P.node.participant??"").nodes.push(P);for(const P of m)be(N(P.flow.source)).flows.push(P);const bt=P=>{var D;return i.create("bpmn:SequenceFlow",{id:P.id,name:P.name??((D=P.condition)==null?void 0:D.label)})},R=(P,D)=>r.createShape({type:ka(P.type),businessObject:i.create(ka(P.type),{id:P.id,name:P.name,...D!==void 0?{"bwl:band":D}:{}})}),_=[...X.map(({op:P})=>P.participant.id).filter(P=>V.has(P)),...[...V.keys()].filter(P=>!d.some(D=>D.participant.id===P))],v=200;for(const P of _){const D=V.get(P),z=P?p(P):void 0;if(z&&d.some(Te=>Te.participant.id===P)){const Te=new Set(D.flows.map(Oe=>Oe.flow.target)),Ce=D.nodes.filter(Oe=>!Te.has(Oe.node.id)).map(Oe=>Oe.node.id),Ie=g.find(Oe=>Ce.includes(Oe.flow.target)&&l(Oe.flow.source));if(Ie){const Oe=l(Ie.flow.source),ze=Oe.x+Oe.width/2-(z.x+150);ze>=v&&n.moveElements([z],{x:ze,y:0})}}const ie=z?z.x+150:250;let te=z?z.y+80:120;const Y=(Te,Ce,Ie)=>{const Oe=u().children.filter(rt=>!("waypoints"in rt&&rt.waypoints)&&rt.id!==Ce&&typeof rt.y=="number"&&rt.y>=Te);Oe.length&&n.moveElements(Oe,{x:0,y:Ie})},K=(Te,Ce)=>{if(Te){const ze=p(Te),nt=ce(Ce);if(ze.height>=nt)return;const vi=nt-ze.height,zt=f(ze),yi=zt?zt.y+zt.height:ze.y+ze.height;n.resizeLane(ze,{x:ze.x,y:ze.y,width:ze.width,height:nt},!1),Y(yi,zt==null?void 0:zt.id,vi);return}if(!z)return;const Ie=$*(Ce+1);if(z.height>=Ie)return;const Oe=Ie-z.height,rt=z.y+z.height;n.resizeShape(z,{x:z.x,y:z.y,width:z.width,height:Ie}),Y(rt,z.id,Oe)},ht=(Te,Ce,Ie)=>{if(Te){const Oe=p(Te);return Oe.y+Math.min(Oe.height/2,L)+ue(Te,Ce??0)*$}return Ce!==void 0&&z?z.y+j+ue(`pool:${P}`,Ce)*$:Ie},Ee=(Te,Ce,Ie)=>{if(Te){const Oe=p(Te);return Oe.y+Math.min(Oe.height/2,L)+Ce*$}return z?z.y+j+Ce*$:Ie},We=Te=>Te.participant?p(Te.participant):u(),Zt=30,Tn=(Te,Ce,Ie,Oe)=>{const rt=Ie-Ce.width/2,ze=Oe-Ce.height/2;return(Te.children??[]).find(nt=>!("waypoints"in nt&&nt.waypoints)&&nt.type!=="bpmn:Lane"&&nt.type!=="label"&&typeof nt.x=="number"&&rt<nt.x+nt.width+Zt&&rt+Ce.width+Zt>nt.x&&ze<nt.y+nt.height&&ze+Ce.height>nt.y)},qt=(Te,Ce,Ie,Oe,rt,ze)=>{const nt=Ie!==void 0||Oe!==void 0,vi=ue(Ie??`pool:${P}`,Oe??0);if(nt)for(let Qn=0;Qn<4;Qn++){const _i=Ee(Ie,vi+Qn,ze);if(!Tn(Te,Ce,rt,_i))return K(Ie,vi+Qn),{x:rt,y:_i}}const zt=ht(Ie,Oe,ze);nt&&K(Ie,vi);let yi=rt;for(let Qn=0;Qn<64;Qn++){const _i=Tn(Te,Ce,yi,zt);if(!_i)break;yi=_i.x+_i.width+130+Ce.width/2}return{x:yi,y:zt}},Ve=new Set(D.flows.map(Te=>Te.flow.target)),Rt=new Map;for(const Te of D.nodes){if(Ve.has(Te.node.id))continue;const Ce=R(Te.node,Te.band),Ie=ae(Te),Oe=Te.node.lane?`${Te.node.lane}|${Ie??""}`:Ie!==void 0?`band:${Ie}`:"",rt=We(Te.node),ze=qt(rt,Ce,Te.node.lane,Ie,Rt.get(Oe)??ie,te);n.createShape(Ce,ze,rt),Rt.set(Oe,ze.x+Ce.width+130),!Te.node.lane&&Ie===void 0&&(te+=160)}const Ue=new Set;let ln=0;for(;ln++<D.nodes.length+2;){for(let Ie=0;Ie<D.nodes.length+D.flows.length+2;Ie++){let Oe=!1;for(const rt of D.flows){const ze=rt.flow;if(Ue.has(ze.id))continue;const nt=l(ze.source);if(!nt)continue;const vi=l(ze.target),zt=S.get(ze.target);if(!vi&&zt){const yi=R(zt.node,zt.band),Qn=ae(zt);if(zt.node.lane||Qn!==void 0){const _i=We(zt.node),db=nt,Ck=qt(_i,yi,zt.node.lane,Qn,db.x+db.width+130,Number.NaN),Pk=n.createShape(yi,Ck,_i);n.connect(nt,Pk,{type:"bpmn:SequenceFlow",businessObject:bt(ze)})}else s.append(nt,yi,{connection:{type:"bpmn:SequenceFlow",businessObject:bt(ze)}})}else if(vi)n.connect(nt,vi,{type:"bpmn:SequenceFlow",businessObject:bt(ze)});else continue;Ue.add(ze.id),Oe=!0}if(!Oe)break}const Te=D.nodes.filter(Ie=>!l(Ie.node.id));if(!Te.length)break;const Ce=Te[0];{const Ie=R(Ce.node,Ce.band),Oe=We(Ce.node),rt=ae(Ce);n.createShape(Ie,qt(Oe,Ie,Ce.node.lane,rt,ie,te),Oe),!Ce.node.lane&&rt===void 0&&(te+=160)}}}const M=40,O=(P,D=()=>!0)=>{const z=l(P);if(!z)return[];const ie=[z],te=new Set([P]);for(let Y=0;Y<ie.length;Y++){const K=ie[Y].id;for(const ht of m){const Ee=ht.flow.target;if(ht.flow.source!==K||te.has(Ee)||!S.has(Ee))continue;te.add(Ee);const We=l(Ee);We&&D(We)&&ie.push(We)}}return ie};for(const P of Pt(e,"sequenceFlow.update")){if(P.target===void 0)continue;const D=S.get(P.target);if(!D)continue;const z=l(P.target),ie=l(P.id);if(!z||!ie)continue;const te=P.source!==void 0?l(P.source):ie.source,Y=ie.target;if(!te||!Y||Y.id===z.id)continue;const K=O(P.target),ht=new Set(K.map(Ve=>Ve.id)),Ee=Math.min(...K.map(Ve=>Ve.x)),We=Math.max(...K.map(Ve=>Ve.x+Ve.width)),Zt=te.x+te.width,Tn=We-Ee+M*2-(Y.x-Zt);if(Tn>0){const Ve=f(z),Rt=(Ve==null?void 0:Ve.children)??[],Ue=Ce=>Ce.type==="bpmn:Lane",ln=Rt.filter(Ce=>!("waypoints"in Ce&&Ce.waypoints)&&!Ue(Ce)&&!ht.has(Ce.id)&&Ce.x>=Y.x),Te=Ve?[Ve,...Rt.filter(Ce=>Ue(Ce))]:[];ln.length&&n.createSpace(ln,Te,{x:Tn,y:0},"e",Y.x-1)}const qt=D.node.lane||D.band!==void 0?z.y+z.height/2:te.y+te.height/2;n.moveElements(K,{x:Zt+M-Ee,y:qt-(z.y+z.height/2)})}const H=(P,D)=>{const z=D.target===P,ie=p(D.source),te=p(D.target),Y=z?"bpmn:DataOutputAssociation":"bpmn:DataInputAssociation";n.connect(ie,te,D.id?{type:Y,businessObject:i.create(Y,{id:D.id})}:{type:Y})};for(const P of w){const D=P.associations??[],z=D.map(Y=>Y.source===P.dataStore.id?Y.target:Y.source).map(l).find(Boolean),ie=z?f(z)??u():u(),te=z?{x:z.x+z.width/2,y:z.y+z.height+110}:{x:200,y:B+60};n.createShape({type:"bpmn:DataStoreReference",businessObject:i.create("bpmn:DataStoreReference",{id:P.dataStore.id,name:P.dataStore.name})},te,ie);for(const Y of D)H(P.dataStore.id,Y)}for(const P of E){const z=p(P.association.target).type==="bpmn:DataStoreReference"?P.association.target:P.association.source;H(z,P.association)}for(const P of g){const D=P.flow;n.connect(p(D.source),p(D.target),{type:"bpmn:MessageFlow",businessObject:i.create("bpmn:MessageFlow",{id:D.id,name:D.name})})}const ne=100,ye=30,De=new Set(m.map(P=>P.flow.target)),et=new Map;for(const P of g)et.set(P.flow.target,(et.get(P.flow.target)??0)+1);const Ne=P=>!("waypoints"in P&&P.waypoints)&&P.type!=="bpmn:Lane"&&P.type!=="label"&&typeof P.x=="number",ft=()=>Ri(Nn(o)).filter(P=>P.kind==="edge-crosses-shape"||P.kind==="edge-overlap-opposite").length;for(const P of g){const D=S.get(P.flow.target),z=D==null?void 0:D.node.participant;if(!D||!z||!re.has(`pool:${z}`)||!De.has(P.flow.target)||(et.get(P.flow.target)??0)!==1)continue;const ie=l(P.flow.target),te=l(P.flow.source);if(!ie||!te)continue;const Y=te.x+te.width/2-(ie.x+ie.width/2);if(Y<ne)continue;const K=O(P.flow.target,Ue=>Ue.x>=ie.x),ht=new Set(K.map(Ue=>Ue.id)),Ee=p(z),We=(Ee.children??[]).filter(Ne).filter(Ue=>!ht.has(Ue.id));if(K.some(Ue=>We.some(ln=>Ue.x+Y<ln.x+ln.width+ye&&Ue.x+Y+Ue.width+ye>ln.x&&Ue.y<ln.y+ln.height&&Ue.y+Ue.height>ln.y)))continue;const Tn=ft(),qt=Ee.width;n.moveElements(K,{x:Y,y:0});const Rt=Math.max(...K.map(Ue=>Ue.x+Ue.width))+150-(Ee.x+Ee.width);Rt>0&&n.resizeShape(Ee,{x:Ee.x,y:Ee.y,width:Ee.width+Rt,height:Ee.height}),ft()>Tn&&(n.moveElements(K,{x:-Y,y:0}),Rt>0&&n.resizeShape(Ee,{x:Ee.x,y:Ee.y,width:qt,height:Ee.height}))}let Dt=0;for(const P of x){const D=(P.group.members??[]).map(l).filter(Y=>!!Y),z=40;let ie;if(D.length){const Y=Math.min(...D.map(We=>We.x))-z,K=Math.min(...D.map(We=>We.y))-z,ht=Math.max(...D.map(We=>We.x+We.width))+z,Ee=Math.max(...D.map(We=>We.y+We.height))+z;ie={x:Y,y:K,width:ht-Y,height:Ee-K}}else ie={x:300+Dt*350,y:40,width:300,height:200},Dt++;const te=n.createShape({type:"bpmn:Group",businessObject:i.create("bpmn:Group",{id:P.group.id}),width:ie.width,height:ie.height},{x:ie.x+ie.width/2,y:ie.y+ie.height/2},u());P.group.name&&n.updateLabel(te,P.group.name),(Rr=P.group.members)!=null&&Rr.length&&A(te,"bwl:Members",{refs:P.group.members.join(" ")})}const Ft=P=>{const D=P.waypoints;if(D!=null&&D.length){const ie=D[Math.floor((D.length-1)/2)];return{x:ie.x,y:ie.y,width:0,height:0}}const z=P;return{x:z.x,y:z.y,width:z.width,height:z.height}};let Le=0;const dt={width:100,height:30};for(const P of b){const D=P.association,z=((mn=P.placement)==null?void 0:mn.anchor)??(D?D.source===P.annotation.id?D.target:D.source:void 0),ie=z?l(z):void 0,te=ie?Ft(ie):void 0;let Y;if(te&&P.placement){const[Ee,We]=td[P.placement.side],Zt=P.placement.offset??50;Y={x:te.x+te.width/2+Ee*(te.width/2+dt.width/2+Zt),y:te.y+te.height/2+We*(te.height/2+dt.height/2+Zt)}}else te?(Y={x:te.x+te.width/2+180+Le%3*260,y:te.y-110-Le%2*95},Le++):(Y={x:300+Le*260,y:60},Le++);const K=ie?f(ie)??u():u(),ht=n.createShape({type:"bpmn:TextAnnotation",businessObject:i.create("bpmn:TextAnnotation",{id:P.annotation.id,text:P.annotation.text})},Y,K);if(D){const Ee=We=>We===P.annotation.id?ht:p(We);n.connect(Ee(D.source),Ee(D.target),D.id?{type:"bpmn:Association",businessObject:i.create("bpmn:Association",{id:D.id})}:{type:"bpmn:Association"})}P.placement&&A(ht,"bwl:Placement",I(P.placement))}for(const P of Pt(e,"association.add")){const D=P.association;n.connect(p(D.source),p(D.target),D.id?{type:"bpmn:Association",businessObject:i.create("bpmn:Association",{id:D.id})}:{type:"bpmn:Association"})}for(const P of Pt(e,"node.update")){let D=p(P.id);if(P.type&&ka(P.type)!==D.type&&(D=c.replaceElement(D,{type:ka(P.type)})),P.name!==void 0&&n.updateProperties(D,{name:P.name??void 0}),P.lane){const z=p(P.lane),ie=z.y+z.height/2-(D.y+D.height/2);ie!==0&&n.moveElements([D],{x:0,y:ie})}}for(const P of Pt(e,"sequenceFlow.update")){const D=p(P.id);if(P.source!==void 0||P.target!==void 0){const z=D,ie=P.source!==void 0?p(P.source):z.source,te=P.target!==void 0?p(P.target):z.target,Y=K=>({x:K.x+K.width/2,y:K.y+K.height/2});n.reconnect(z,ie,te,[Y(ie),Y(te)])}P.name!==void 0&&n.updateProperties(D,{name:P.name??void 0}),P.condition!==void 0&&n.updateProperties(D,{name:((On=P.condition)==null?void 0:On.label)??void 0})}for(const P of Pt(e,"messageFlow.update"))P.name!==void 0&&n.updateProperties(p(P.id),{name:P.name??void 0});for(const P of Pt(e,"dataStore.update"))P.name!==void 0&&n.updateProperties(p(P.id),{name:P.name??void 0});for(const P of Pt(e,"annotation.update")){const D=p(P.id);if(P.text!==void 0&&n.updateProperties(D,{text:P.text}),P.placement===null)A(D,"bwl:Placement",null);else if(P.placement){const z=Ft(p(P.placement.anchor)),[ie,te]=td[P.placement.side],Y=P.placement.offset??50,K=z.x+z.width/2+ie*(z.width/2+D.width/2+Y),ht=z.y+z.height/2+te*(z.height/2+D.height/2+Y);n.moveElements([D],{x:K-(D.x+D.width/2),y:ht-(D.y+D.height/2)}),A(D,"bwl:Placement",I(P.placement))}}for(const P of Pt(e,"group.update")){const D=p(P.id);if(P.name!==void 0&&n.updateLabel(D,P.name??""),P.members){const z=P.members.map(l).filter(ie=>!!ie);if(z.length){const te=Math.min(...z.map(Ee=>Ee.x))-40,Y=Math.min(...z.map(Ee=>Ee.y))-40,K=Math.max(...z.map(Ee=>Ee.x+Ee.width))+40,ht=Math.max(...z.map(Ee=>Ee.y+Ee.height))+40;n.resizeShape(D,{x:te,y:Y,width:K-te,height:ht-Y})}A(D,"bwl:Members",{refs:P.members.join(" ")})}}}function id(e,t,n=nd){const i=ed(e),r=Jf(t,Bf(i.elementRegistry)),o={edgeCrossings:{before:0,after:0}};if(r.length)return{ok:!1,issues:r,findings:[],stats:o};const a=Nn(i.elementRegistry),s=new Set(Ri(a).map(Si)),c=new Set(a.edges.map(d=>d.id)),u=su(a).length,l=e.get("commandStack");try{rf(l,()=>{n(t,i),Wf(i,c),zf(i,s),Yf(i,s,c),Xf(i,s,c)})}catch(d){return{ok:!1,issues:[{kind:"lower-failed",message:d instanceof Error?d.message:String(d)}],findings:[],stats:o}}const p=Nn(i.elementRegistry),f=Ri(p).filter(d=>!s.has(Si(d)));return{ok:!0,issues:[],findings:f,stats:{edgeCrossings:{before:u,after:su(p).length}}}}function Ix(e){const t=e.slice(e.indexOf(":")+1);return t.charAt(0).toLowerCase()+t.slice(1)}function Lx(e,t){return typeof e.get=="function"?e.get(t):e[t]}function rd(e,t){const n=Lx(e,t);return typeof n=="number"&&Number.isFinite(n)?n:void 0}function od(e,t){var i;return(((i=e.extensionElements)==null?void 0:i.values)??[]).find(r=>(r==null?void 0:r.$type)===t)}function Bx(e){return typeof e=="string"&&Nc.includes(e)}function $n(e){if(typeof e=="string")return e;const t=e==null?void 0:e.id;return typeof t=="string"?t:void 0}function ad(e){const t=e.rootElements??[],n=t.find(q=>q.$type==="bpmn:Collaboration"),i=new Map(t.filter(q=>q.$type==="bpmn:Process").map(q=>[q.id,q])),r=[],o=[],a=[],s=[],c=[],u=[],l={poolOrders:{},bands:{},placements:{}},p=[],f=[],d=[],h=[],m=[],g=[],w=new Set,E=new Set,b=q=>{q&&w.add(q)},x=q=>{w.add(q),E.add(q)},S=q=>{const ae=od(q,"bwl:Placement");if(!ae)return;const ue=typeof ae.anchor=="string"?ae.anchor:void 0;if(!ue||!Bx(ae.side))return;const oe=typeof ae.offset=="number"?ae.offset:void 0;m.push({owner:q.id,anchor:ue,side:ae.side,...oe!==void 0?{offset:oe}:{}})},A=q=>{const ae=od(q,"bwl:Members"),ue=typeof(ae==null?void 0:ae.refs)=="string"?ae.refs.split(/\s+/).filter(Boolean):[];ue.length&&g.push({owner:q.id,refs:ue})},I=q=>{var ae;for(const ue of q)switch(b(ue.id),ue.$type){case"bpmn:TextAnnotation":x(ue.id),s.push({id:ue.id,text:typeof ue.text=="string"?ue.text:""}),S(ue);break;case"bpmn:Association":d.push({id:ue.id,type:ue.$type,source:$n(ue.sourceRef),target:$n(ue.targetRef)});break;case"bpmn:Group":{x(ue.id);const oe=(ae=ue.categoryValueRef)==null?void 0:ae.value;c.push({id:ue.id,...typeof oe=="string"&&oe?{name:oe}:{}}),A(ue);break}default:u.push({id:ue.id,type:ue.$type,reason:"type-outside-mvp"})}},C=(q,ae)=>{const ue=q.flowElements??[],oe=(q.laneSets??[]).flatMap(X=>X.lanes??[]),ce=new Map;for(const X of oe){b(X.id);for(const B of X.flowNodeRef??[]){const N=$n(B);N&&ce.set(N,X.id)}}for(const X of ue){if(b(X.id),X.$type==="bpmn:SequenceFlow"){p.push({id:X.id,source:$n(X.sourceRef),target:$n(X.targetRef),...typeof X.name=="string"&&X.name?{name:X.name}:{}});continue}if(X.$type==="bpmn:DataStoreReference"){x(X.id),a.push({id:X.id,...X.name?{name:X.name}:{}});continue}const B=Ix(X.$type);if(!Jp(B)){u.push({id:X.id,type:X.$type,reason:"type-outside-mvp"});continue}x(X.id),o.push({id:X.id,type:B,...X.name?{name:X.name}:{},...ae?{participant:ae}:{},...ce.has(X.id)?{lane:ce.get(X.id)}:{}});const N=rd(X,"bwl:band");N!==void 0&&(l.bands[X.id]=N);for(const V of X.dataOutputAssociations??[])b(V.id),h.push({id:V.id,type:V.$type,source:X.id,target:$n(V.targetRef)});for(const V of X.dataInputAssociations??[])b(V.id),h.push({id:V.id,type:V.$type,source:$n((V.sourceRef??[])[0]),target:X.id})}I(q.artifacts??[])};if(n){const q=new Set;for(const ae of n.participants??[]){x(ae.id);const ue=$n(ae.processRef);ue&&q.add(ue);const oe=ue?i.get(ue):void 0,ce=((oe==null?void 0:oe.laneSets)??[]).flatMap(V=>V.lanes??[]),X=ce.map(V=>({id:V.id,...V.name?{name:V.name}:{}}));for(const V of X)x(V.id);const B=!oe||(oe.flowElements??[]).length===0&&ce.length===0&&(oe.artifacts??[]).length===0;r.push({id:ae.id,...ae.name?{name:ae.name}:{},...B?{blackBox:!0}:{},...X.length?{lanes:X}:{}});const N=rd(ae,"bwl:poolOrder");N!==void 0&&(l.poolOrders[ae.id]=N),oe&&C(oe,ae.id)}for(const ae of n.messageFlows??[])b(ae.id),f.push({id:ae.id,source:$n(ae.sourceRef),target:$n(ae.targetRef),...typeof ae.name=="string"&&ae.name?{name:ae.name}:{}});I(n.artifacts??[]);for(const[ae,ue]of i)!q.has(ae)&&(ue.flowElements??[]).length>0&&u.push({id:ae,type:ue.$type,reason:"unreachable-process"})}else for(const q of i.values())C(q);const $=[],j=[],L=[],F=[],re=(q,ae)=>!!q&&!!ae&&E.has(q)&&E.has(ae);for(const q of p){if(!re(q.source,q.target)){u.push({id:q.id,type:"bpmn:SequenceFlow",reason:"endpoint-outside-mvp"});continue}$.push({id:q.id,source:q.source,target:q.target,...q.name?{name:q.name}:{}}),E.add(q.id)}for(const q of f){if(!re(q.source,q.target)){u.push({id:q.id,type:"bpmn:MessageFlow",reason:"endpoint-outside-mvp"});continue}j.push({id:q.id,source:q.source,target:q.target,...q.name?{name:q.name}:{}}),E.add(q.id)}for(const q of h){if(!re(q.source,q.target)){u.push({id:q.id??"",type:q.type,reason:"endpoint-outside-mvp"});continue}F.push({...q.id?{id:q.id}:{},source:q.source,target:q.target}),q.id&&E.add(q.id)}for(const q of d){if(!re(q.source,q.target)){u.push({id:q.id??"",type:q.type,reason:"endpoint-outside-mvp"});continue}L.push({...q.id?{id:q.id}:{},source:q.source,target:q.target})}const Ae=new Map(c.map(q=>[q.id,q]));for(const{owner:q,refs:ae}of g){const ue=ae.filter(ce=>w.has(ce)),oe=Ae.get(q);oe&&ue.length&&(oe.members=ue)}for(const q of m)w.has(q.anchor)&&(l.placements[q.owner]={anchor:q.anchor,side:q.side,...q.offset!==void 0?{offset:q.offset}:{}});return{definition:{...r.length?{participants:r}:{},nodes:o,sequenceFlows:$,...j.length?{messageFlows:j}:{},...a.length?{dataStores:a}:{},...F.length?{dataAssociations:F}:{},...s.length?{annotations:s}:{},...L.length?{associations:L}:{},...c.length?{groups:c}:{}},hints:l,omitted:u}}async function Nx(e){const{definitions:t,warnings:n}=await eu(e);return{...ad(t),warnings:n}}function $x(e,t,n,i={}){return{documentId:e,baseVersion:t,ops:[...n],origin:i.origin??"agent",clientOpId:(i.mkClientOpId??(()=>crypto.randomUUID()))()}}async function sd(e,t,{currentVersion:n}){if(t.baseVersion!==n)return{status:"conflict",baseVersion:t.baseVersion,currentVersion:n};const i=id(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 jx=Symbol("bpmn-editor");function Fx(){const e=ot.ref(!1),t=ot.ref(!0),n=ot.ref(!1);let i,r;const o=()=>{e.value=!0};function a(u,l){u.get("canvas").getContainer().style.pointerEvents=l?"":"none";const 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 sd(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:tu(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 Q(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}function Hx(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var uu={exports:{}},cd;function zx(){if(cd)return uu.exports;cd=1;var e=uu.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},uu.exports}var Vx=zx(),Gx=Hx(Vx);function jn(e){if(!(this instanceof jn))return new jn(e);e=e||[128,36,1],this._seed=e.length?Gx.rack(e[0],e[1],e[2]):e}jn.prototype.next=function(e){return this._seed(e||!0)},jn.prototype.nextPrefixed=function(e,t){var n;do n=e+this.next(!0);while(this.assigned(n));return this.claim(n,t),n},jn.prototype.claim=function(e,t){this._seed.set(e,t||!0)},jn.prototype.assigned=function(e){return this._seed.get(e)||!1},jn.prototype.unclaim=function(e){delete this._seed.hats[e]},jn.prototype.clear=function(){var e=this._seed.hats,t;for(t in e)this.unclaim(t)};const gt={legend:[1,"<fieldset>","</fieldset>"],tr:[2,"<table><tbody>","</tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],_default:[0,"",""]};gt.td=gt.th=[3,"<table><tbody><tr>","</tr></tbody></table>"],gt.option=gt.optgroup=[1,'<select multiple="multiple">',"</select>"],gt.thead=gt.tbody=gt.colgroup=gt.caption=gt.tfoot=[1,"<table>","</table>"],gt.polyline=gt.ellipse=gt.polygon=gt.circle=gt.text=gt.line=gt.path=gt.rect=gt.g=[1,'<svg xmlns="http://www.w3.org/2000/svg" version="1.1">',"</svg>"];function Ge(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(gt,i)?gt[i]:gt._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 Wx(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 Wt(e,...t){const n=e.style;return T(t,function(i){i&&T(i,function(r,o){n[o]=r})}),e}function Nt(e,t,n){return arguments.length==2?e.getAttribute(t):n===null?e.removeAttribute(t):(e.setAttribute(t,n),e)}const Ux=Object.prototype.toString;function Ye(e){return new Ci(e)}function Ci(e){if(!e||!e.nodeType)throw new Error("A DOM element reference is required");this.el=e,this.list=e.classList}Ci.prototype.add=function(e){return this.list.add(e),this},Ci.prototype.remove=function(e){return Ux.call(e)=="[object RegExp]"?this.removeMatching(e):(this.list.remove(e),this)},Ci.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},Ci.prototype.toggle=function(e,t){return typeof t<"u"?t!==this.list.toggle(e,t)&&this.list.toggle(e):this.list.toggle(e),this},Ci.prototype.array=function(){return Array.from(this.list)},Ci.prototype.has=Ci.prototype.contains=function(e){return this.list.contains(e)};function Da(e){for(var t;t=e.firstChild;)e.removeChild(t);return e}function cr(e,t,n){var i=n?e:e.parentNode;return i&&typeof i.closest=="function"&&i.closest(t)||null}function qx(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Oa={},ud;function Yx(){if(ud)return Oa;ud=1;var e,t,n;function i(){e=window.addEventListener?"addEventListener":"attachEvent",t=window.removeEventListener?"removeEventListener":"detachEvent",n=e!=="addEventListener"?"on":""}return Oa.bind=function(r,o,a,s){return e||i(),r[e](n+o,a,s||!1),a},Oa.unbind=function(r,o,a,s){return t||i(),r[t](n+o,a,s||!1),a},Oa}var ld=Yx(),Kx=qx(ld),me=Wx({__proto__:null,default:Kx},[ld]),pd=["focus","blur"];function Xx(e,t,n,i,r){return pd.indexOf(n)!==-1&&(r=!0),me.bind(e,n,function(o){var a=o.target||o.srcElement;o.delegateTarget=cr(a,t,!0),o.delegateTarget&&i.call(e,o)},r)}function Zx(e,t,n,i){return pd.indexOf(t)!==-1&&(i=!0),me.unbind(e,t,n,i)}var tn={bind:Xx,unbind:Zx};function lu(e,t){return e&&typeof e.matches=="function"&&e.matches(t)||!1}function Be(e,t){return t=t||document,t.querySelector(e)}function Ia(e,t){return t=t||document,t.querySelectorAll(e)}function Fn(e){e.parentNode&&e.parentNode.removeChild(e)}function Qx(e,t){if(e.ownerDocument!==t.ownerDocument)try{return t.ownerDocument.importNode(e,!0)}catch{}return e}function Jx(e,t){return t.appendChild(Qx(e,t))}function ge(e,t){return Jx(t,e),e}var pu=2,fd={"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":pu,"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":pu,"text-anchor":1,"text-decoration":1,"text-rendering":1,"unicode-bidi":1,visibility:1,"word-spacing":1,"writing-mode":1};function eE(e,t){return fd[t]?e.style[t]:e.getAttributeNS(null,t)}function dd(e,t,n){var i=t.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase(),r=fd[i];r?(r===pu&&typeof n=="number"&&(n=String(n)+"px"),e.style[i]=n):e.setAttributeNS(null,t,n)}function tE(e,t){var n=Object.keys(t),i,r;for(i=0,r;r=n[i];i++)dd(e,r,t[r])}function J(e,t,n){if(typeof t=="string")if(n!==void 0)dd(e,t,n);else return eE(e,t);else tE(e,t);return e}const nE=Object.prototype.toString;function Pe(e){return new Pi(e)}function Pi(e){if(!e||!e.nodeType)throw new Error("A DOM element reference is required");this.el=e,this.list=e.classList}Pi.prototype.add=function(e){return this.list.add(e),this},Pi.prototype.remove=function(e){return nE.call(e)=="[object RegExp]"?this.removeMatching(e):(this.list.remove(e),this)},Pi.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},Pi.prototype.toggle=function(e,t){return typeof t<"u"?t!==this.list.toggle(e,t)&&this.list.toggle(e):this.list.toggle(e),this},Pi.prototype.array=function(){return Array.from(this.list)},Pi.prototype.has=Pi.prototype.contains=function(e){return this.list.contains(e)};function La(e){for(var t;t=e.firstChild;)e.removeChild(t);return e}function hd(e){return e.cloneNode(!0)}var fu={svg:"http://www.w3.org/2000/svg"},md='<svg xmlns="'+fu.svg+'"';function iE(e){var t=!1;e.substring(0,4)==="<svg"?e.indexOf(fu.svg)===-1&&(e=md+e.substring(4)):(e=md+">"+e+"</svg>",t=!0);var n=rE(e);if(!t)return n;for(var i=document.createDocumentFragment(),r=n.firstChild;r.firstChild;)i.appendChild(r.firstChild);return i}function rE(e){var t;return t=new DOMParser,t.async=!1,t.parseFromString(e,"text/xml")}function se(e,t){var n;return e=e.trim(),e.charAt(0)==="<"?(n=iE(e).firstChild,n=document.importNode(n,!0)):n=document.createElementNS(fu.svg,e),t&&J(n,t),n}var du=null;function gd(){return du===null&&(du=se("svg")),du}function vd(e,t){var n,i,r=Object.keys(t);for(n=0;i=r[n];n++)e[i]=t[i];return e}function oE(e,t,n,i,r,o){var a=gd().createSVGMatrix();switch(arguments.length){case 0:return a;case 1:return vd(a,e);case 6:return vd(a,{a:e,b:t,c:n,d:i,e:r,f:o})}}function _o(e){return gd().createSVGTransform()}var yd=/([&<>]{1})/g,aE=/([&<>\n\r"]{1})/g,sE={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"'"};function hu(e,t){function n(i,r){return sE[r]||r}return e.replace(t,n)}function _d(e,t){var n,i,r,o,a;switch(e.nodeType){case 3:t.push(hu(e.textContent,yd));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,'="',hu(o.value,aE),'"');if(e.hasChildNodes()){for(t.push(">"),a=e.childNodes,n=0,i=a.length;n<i;++n)_d(a.item(n),t);t.push("</",e.tagName,">")}else t.push("/>");break;case 8:t.push("<!--",hu(e.nodeValue,yd),"-->");break;case 4:t.push("<![CDATA[",e.nodeValue,"]]>");break;default:throw new Error("unable to handle node "+e.nodeType)}return t}function cE(e){for(var t=e.firstChild,n=[];t;)_d(t,n),t=t.nextSibling;return n.join("")}function bd(e,t){return cE(e)}function vt(e){var t=e.parentNode;return t&&t.removeChild(e),e}function uE(e,t){return t instanceof SVGMatrix?e.createSVGTransformFromMatrix(t):t}function lE(e,t){var n,i;for(e.clear(),n=0;i=t[n];n++)e.appendItem(uE(e,i))}function bo(e,t){var n=e.transform.baseVal;return t&&(Array.isArray(t)||(t=[t]),lE(n,t)),n.consolidate()}const pE=/^class[ {]/;function fE(e){return pE.test(e.toString())}function mu(e){return Array.isArray(e)}function gu(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function Ba(...e){e.length===1&&mu(e[0])&&(e=e[0]),e=[...e];const t=e.pop();return t.$inject=e,t}const dE=/constructor\s*[^(]*\(\s*([^)]*)\)/m,hE=/^(?:async\s+)?(?:function\s*[^(]*)?(?:\(\s*([^)]*)\)|(\w+))/m,mE=/\/\*([^*]*)\*\//m;function gE(e){if(typeof e!="function")throw new Error(`Cannot annotate "${e}". Expected a function!`);const t=e.toString().match(fE(e)?dE:hE);if(!t)return[];const n=t[1]||t[2];return n&&n.split(",").map(i=>{const r=i.match(mE);return(r&&r[1]||i).trim()})||[]}function xd(e,t){const n=t||{get:function(b,x){if(i.push(b),x===!1)return null;throw s(`No provider for "${b}"!`)}},i=[],r=this._providers=Object.create(n._providers||null),o=this._instances=Object.create(null),a=o.injector=this,s=function(b){const x=i.join(" -> ");return i.length=0,new Error(x?`${b} (Resolving: ${x})`:b)};function c(b,x){if(!r[b]&&b.includes(".")){const S=b.split(".");let A=c(S.shift());for(;S.length;)A=A[S.shift()];return A}if(gu(o,b))return o[b];if(gu(r,b)){if(i.indexOf(b)!==-1)throw i.push(b),s("Cannot resolve circular dependency!");return i.push(b),o[b]=r[b][0](r[b][1]),i.pop(),o[b]}return n.get(b,x)}function u(b,x){if(typeof x>"u"&&(x={}),typeof b!="function")if(mu(b))b=Ba(b.slice());else throw s(`Cannot invoke "${b}". Expected a function!`);const A=(b.$inject||gE(b)).map(I=>gu(x,I)?x[I]:c(I));return{fn:b,dependencies:A}}function l(b){const{fn:x,dependencies:S}=u(b),A=Function.prototype.bind.call(x,null,...S);return new A}function p(b,x,S){const{fn:A,dependencies:I}=u(b,S);return A.apply(x,I)}function f(b){return Ba(x=>b.get(x))}function d(b,x){if(x&&x.length){const S=Object.create(null),A=Object.create(null),I=[],C=[],$=[];let j,L,F,re;for(let Ae in r)j=r[Ae],x.indexOf(Ae)!==-1&&(j[2]==="private"?(L=I.indexOf(j[3]),L===-1?(F=j[3].createChild([],x),re=f(F),I.push(j[3]),C.push(F),$.push(re),S[Ae]=[re,Ae,"private",F]):S[Ae]=[$[L],Ae,"private",C[L]]):S[Ae]=[j[2],j[1]],A[Ae]=!0),(j[2]==="factory"||j[2]==="type")&&j[1].$scope&&x.forEach(Je=>{j[1].$scope.indexOf(Je)!==-1&&(S[Ae]=[j[2],j[1]],A[Je]=!0)});x.forEach(Ae=>{if(!A[Ae])throw new Error('No provider for "'+Ae+'". Cannot use provider from the parent!')}),b.unshift(S)}return new xd(b,a)}const h={factory:p,type:l,value:function(b){return b}};function m(b,x){const S=b.__init__||[];return function(){S.forEach(A=>{typeof A=="string"?x.get(A):x.invoke(A)})}}function g(b){const x=b.__exports__;if(x){const S=b.__modules__,A=Object.keys(b).reduce((L,F)=>(F!=="__exports__"&&F!=="__modules__"&&F!=="__init__"&&F!=="__depends__"&&(L[F]=b[F]),L),Object.create(null)),I=(S||[]).concat(A),C=d(I),$=Ba(function(L){return C.get(L)});x.forEach(function(L){r[L]=[$,L,"private",C]});const j=(b.__init__||[]).slice();return j.unshift(function(){C.init()}),b=Object.assign({},b,{__init__:j}),m(b,C)}return Object.keys(b).forEach(function(S){if(S==="__init__"||S==="__depends__")return;const A=b[S];if(A[2]==="private"){r[S]=A;return}const I=A[0],C=A[1];r[S]=[h[I],vE(I,C),I]}),m(b,a)}function w(b,x){return b.indexOf(x)!==-1||(b=(x.__depends__||[]).reduce(w,b),b.indexOf(x)!==-1)?b:b.concat(x)}function E(b){const x=b.reduce(w,[]).map(g);let S=!1;return function(){S||(S=!0,x.forEach(A=>A()))}}this.get=c,this.invoke=p,this.instantiate=l,this.createChild=d,this.init=E(e)}function vE(e,t){return e!=="value"&&mu(t)&&(t=Ba(t.slice())),t}var yE=1e3;function ti(e,t){var n=this;t=t||yE,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 ur(e){return e.flat().join(",").replace(/,?([A-Za-z]),?/g,"$1")}function _E(e){return["M",e.x,e.y]}function vu(e){return["L",e.x,e.y]}function bE(e,t,n){return["C",e.x,e.y,t.x,t.y,n.x,n.y]}function xE(e,t){const n=e.length,i=[_E(e[0])];for(let r=1;r<n;r++){const o=e[r-1],a=e[r],s=e[r+1];if(!s||!t){i.push(vu(a));continue}const c=Math.min(t,yu(a.x-o.x,a.y-o.y),yu(s.x-a.x,s.y-a.y));if(!c){i.push(vu(a));continue}const u=Na(a,o,c),l=Na(a,o,c*.5),p=Na(a,s,c),f=Na(a,s,c*.5);i.push(vu(u)),i.push(bE(l,f,p))}return i}function Na(e,t,n){const i=t.x-e.x,r=t.y-e.y,o=yu(i,r),a=n/o;return{x:e.x+i*a,y:e.y+r*a}}function yu(e,t){return Math.sqrt(Math.pow(e,2)+Math.pow(t,2))}function xo(e,t,n){he(t)&&(n=t,t=null),t||(t={});const i=se("path",t);return he(n)&&(i.dataset.cornerRadius=String(n)),_u(i,e)}function _u(e,t){const n=parseInt(e.dataset.cornerRadius,10)||0;return J(e,{d:ur(xE(t,n))}),e}function $a(e){var t=new Set(e);return we(e,function(n){for(var i=n.parent;i;){if(t.has(i))return!1;i=i.parent}return!0})}function lr(e,t,n){n=n||0,pe(e)||(e=[e]),T(e,function(i,r){var o=t(i,r,n);pe(o)&&o.length&&lr(o,t,n+1)})}function bu(e,t,n){var i=new Set,r=new Set;return lr(e,function(o,a,s){i.add(o);var c=o.children;if(c&&!r.has(c))return r.add(c),c}),Array.from(i)}function Eo(e,t){return bu(e)}function EE(e,t,n){er(t)&&(t=!0),xt(t)&&(n=t,t=!0),n=n||{};var i=wo(n.allShapes),r=wo(n.allConnections),o=wo(n.enclosedElements),a=wo(n.enclosedConnections),s=wo(n.topLevel,t&&Tr(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,T(l.incoming,c),T(l.outgoing,c),l.children}return lr(e,u),{allShapes:i,allConnections:r,topLevel:s,enclosedConnections:a,enclosedElements:o}}function at(e,t){t=!!t,pe(e)||(e=[e]);var n,i,r,o;return T(e,function(a){var s=a;a.waypoints&&!t&&(s=at(a.waypoints,!0));var c=s.x,u=s.y,l=s.height||0,p=s.width||0;(c<n||n===void 0)&&(n=c),(u<i||i===void 0)&&(i=u),(c+p>r||r===void 0)&&(r=c+p),(u+l>o||o===void 0)&&(o=u+l)}),{x:n,y:i,height:o-i,width:r-n}}function Ir(e,t){var n={};return T(e,function(i){var r=i;r.waypoints&&(r=at(r)),!he(t.y)&&r.x>t.x&&(n[i.id]=i),!he(t.x)&&r.y>t.y&&(n[i.id]=i),r.x>t.x&&r.y>t.y&&(he(t.width)&&he(t.height)&&r.width+r.x<t.width+t.x&&r.height+r.y<t.height+t.y||!he(t.width)||!he(t.height))&&(n[i.id]=i)}),n}function Ed(e){return"waypoints"in e?"connection":"x"in e?"shape":"root"}function wd(e){return!!(e&&e.isFrame)}function wo(e,t){return k({},e||{},t||{})}var wE=1;function Ai(e,t){ti.call(this,e,wE),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})}Q(Ai,ti),Ai.prototype.canRender=function(){return!0},Ai.prototype.drawShape=function(t,n,i){var r=se("rect");return J(r,{x:0,y:0,width:n.width||0,height:n.height||0}),wd(n)?J(r,k({},this.FRAME_STYLE,i||{})):J(r,k({},this.SHAPE_STYLE,i||{})),ge(t,r),r},Ai.prototype.drawConnection=function(t,n,i){var r=xo(n.waypoints,k({},this.CONNECTION_STYLE,i||{}));return ge(t,r),r},Ai.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 ur(a)},Ai.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 ur(o)},Ai.$inject=["eventBus","styles"];function SE(){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 k(o,{class:n})},this.style=function(n,i){!pe(n)&&!i&&(i=n,n=[]);var r=en(n,function(o,a){return k(o,e[a]||{})},{});return i?k(r,i):r},this.computeStyle=function(n,i,r){return pe(i)||(r=i,i=[]),t.style(i||[],k({},r,n||{}))}}const RE={__init__:["defaultRenderer"],defaultRenderer:["type",Ai],styles:["type",SE]};function tt(e,t){if(!e||!t)return-1;var n=e.indexOf(t);return n!==-1&&e.splice(n,1),n}function it(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 xu(e,t){return!e||!t?-1:e.indexOf(t)}function So(e,t){return!e||!t?-1:Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function Eu(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=So(e,t);return Math.abs(r/o)<=i}var CE=2;function ni(e,t){var n=Array.from(arguments).flat();const i={x:"v",y:"h"};for(const[r,o]of Object.entries(i))if(PE(r,n))return o;return!1}function PE(e,t){const n=t[0];return tr(t,function(i){return Math.abs(n[e]-i[e])<=CE})}function Sd(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 wu(e,t){return{x:Math.round(e.x+(t.x-e.x)/2),y:Math.round(e.y+(t.y-e.y)/2)}}var AE=/,?([a-z]),?/gi,Rd=parseFloat,st=Math,Ti=st.PI,Hn=st.min,zn=st.max,Cd=st.pow,Mi=st.abs,TE=/([a-z])[\s,]*((-?\d*\.?\d*(?:e[-+]?\d+)?[\s]*,?[\s]*)+)/ig,ME=/(-?\d*\.?\d*(?:e[-+]?\d+)?)[\s]*,?[\s]*/ig,Pd=Array.isArray||function(e){return e instanceof Array};function kE(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function DE(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 OE(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 kE(r,i)?(DE(o,i),r[i]):(o.length>=1e3&&delete r[o.shift()],o.push(i),r[i]=e(...arguments),r[i])}return t}function IE(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(TE,function(i,r,o){var a=[],s=r.toLowerCase();for(o.replace(ME,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=Ru,n}function LE(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 BE(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 Su(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 Ru(){return this.join(",").replace(AE,"$1")}function NE(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=Ru,t}function Ad(e,t,n,i,r,o,a,s,c){var u=1-c,l=Cd(u,3),p=Cd(u,2),f=c*c,d=f*c,h=l*e+p*3*c*n+u*3*c*c*r+d*a,m=l*t+p*3*c*i+u*3*c*c*o+d*s;return{x:ja(h),y:ja(m)}}function Td(e){var t=VE(...e);return Su(t.x0,t.y0,t.x1-t.x0,t.y1-t.y0)}function ki(e,t,n){return t>=e.x&&t<=e.x+e.width&&n>=e.y&&n<=e.y+e.height}function $E(e,t){return e=Su(e),t=Su(t),ki(t,e.x,e.y)||ki(t,e.x2,e.y)||ki(t,e.x,e.y2)||ki(t,e.x2,e.y2)||ki(e,t.x,t.y)||ki(e,t.x2,t.y)||ki(e,t.x,t.y2)||ki(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 Md(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 kd(e,t,n,i,r,o,a,s,c){c==null&&(c=1),c=c>1?1:c<0?0:c;for(var u=c/2,l=12,p=[-.1252,.1252,-.3678,.3678,-.5873,.5873,-.7699,.7699,-.9041,.9041,-.9816,.9816],f=[.2491,.2491,.2335,.2335,.2032,.2032,.1601,.1601,.1069,.1069,.0472,.0472],d=0,h=0;h<l;h++){var m=u*p[h]+u,g=Md(m,e,n,r,a),w=Md(m,t,i,o,s),E=g*g+w*w;d+=f[h]*st.sqrt(E)}return u*d}function jE(e,t,n,i,r,o,a,s){if(!(zn(e,n)<Hn(r,a)||Hn(e,n)>zn(r,a)||zn(t,i)<Hn(o,s)||Hn(t,i)>zn(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=ja(c/l),f=ja(u/l),d=+p.toFixed(2),h=+f.toFixed(2);if(!(d<+Hn(e,n).toFixed(2)||d>+zn(e,n).toFixed(2)||d<+Hn(r,a).toFixed(2)||d>+zn(r,a).toFixed(2)||h<+Hn(t,i).toFixed(2)||h>+zn(t,i).toFixed(2)||h<+Hn(o,s).toFixed(2)||h>+zn(o,s).toFixed(2)))return{x:p,y:f}}}}function ja(e){return Math.round(e*1e11)/1e11}function FE(e,t,n){var i=Td(e),r=Td(t);if(!$E(i,r))return[];var o=kd(...e),a=kd(...t),s=Od(e)?1:~~(o/5)||1,c=Od(t)?1:~~(a/5)||1,u=new Array(s+1),l=new Array(c+1),p={},f=[],d,h;for(d=0;d<s+1;d++){var m=Ad(...e,d/s);u[d]={x:m.x,y:m.y,t:d/s}}for(d=0;d<c+1;d++)m=Ad(...t,d/c),l[d]={x:m.x,y:m.y,t:d/c};for(d=0;d<s;d++)for(h=0;h<c;h++){var g=u[d],w=u[d+1],E=l[h],b=l[h+1],x=Mi(w.x-g.x)<.01?"y":"x",S=Mi(b.x-E.x)<.01?"y":"x",A=jE(g.x,g.y,w.x,w.y,E.x,E.y,b.x,b.y),I;if(A){if(I=A.x.toFixed(9)+"#"+A.y.toFixed(9),p[I])continue;p[I]=!0;var C=g.t+Mi((A[x]-g[x])/(w[x]-g[x]))*(w.t-g.t),$=E.t+Mi((A[S]-E[S])/(b[S]-E[S]))*(b.t-E.t);C>=0&&C<=1&&$>=0&&$<=1&&f.push({x:A.x,y:A.y,t1:C,t2:$})}}return f}function Dd(e,t,n){e=Bd(e),t=Bd(t);for(var i,r,o,a,s,c,u,l,p,f,d=n?0:[],h=0,m=e.length;h<m;h++){var g=e[h];if(g[0]=="M")i=s=g[1],r=c=g[2];else{g[0]=="C"?(p=[i,r,...g.slice(1)],i=p[6],r=p[7]):(p=[i,r,i,r,s,c,s,c],i=s,r=c);for(var w=0,E=t.length;w<E;w++){var b=t[w];if(b[0]=="M")o=u=b[1],a=l=b[2];else{b[0]=="C"?(f=[o,a,...b.slice(1)],o=f[6],a=f[7]):(f=[o,a,o,a,u,l,u,l],o=u,a=l);var x=FE(p,f);{for(var S=0,A=x.length;S<A;S++)x[S].segment1=h,x[S].segment2=w,x[S].bez1=p,x[S].bez2=f;d=d.concat(x)}}}}}return d}function HE(e){return Pd(e)&&Pd(e[0])}function zE(e){if(LE(e))return e;var t=new Array(e.length),n=0,i=0,r=0,o=0,a=0,s;e[0][0]=="M"&&(n=+e[0][1],i=+e[0][2],r=n,o=i,a++,t[0]=["M",n,i]);for(var c,u,l=a,p=e.length;l<p;l++){if(u=e[l],s=u[0],t[l]=c=new Array(u.length),s!=s.toUpperCase())switch(c[0]=s.toUpperCase(),c[0]){case"A":c[1]=u[1],c[2]=u[2],c[3]=u[3],c[4]=u[4],c[5]=u[5],c[6]=+u[6]+n,c[7]=+u[7]+i;break;case"V":c[1]=+u[1]+i;break;case"H":c[1]=+u[1]+n;break;case"M":r=+u[1]+n,o=+u[2]+i;default:for(var f=1,d=u.length;f<d;f++)c[f]=+u[f]+(f%2?n:i)}else for(var h=0,m=u.length;h<m;h++)c[h]=u[h];switch(s=s.toUpperCase(),c[0]){case"Z":n=+r,i=+o;break;case"H":n=c[1];break;case"V":i=c[1];break;case"M":r=c[c.length-2],o=c[c.length-1];default:n=c[c.length-2],i=c[c.length-1]}}return t.toString=Ru,t}function Od(e){return e[0]===e[2]&&e[1]===e[3]&&e[4]===e[6]&&e[5]===e[7]}function Fa(e,t,n,i){return[e,t,n,i,n,i]}function Id(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 Ld(e,t,n,i,r,o,a,s,c,u){var l=Ti*120/180,p=Ti/180*(+r||0),f=[],d,h=OE(function(R,_,v){var M=R*st.cos(v)-_*st.sin(v),O=R*st.sin(v)+_*st.cos(v);return{x:M,y:O}});if(u)I=u[0],C=u[1],S=u[2],A=u[3];else{d=h(e,t,-p),e=d.x,t=d.y,d=h(s,c,-p),s=d.x,c=d.y;var m=(e-s)/2,g=(t-c)/2,w=m*m/(n*n)+g*g/(i*i);w>1&&(w=st.sqrt(w),n=w*n,i=w*i);var E=n*n,b=i*i,x=(o==a?-1:1)*st.sqrt(Mi((E*b-E*g*g-b*m*m)/(E*g*g+b*m*m))),S=x*n*g/i+(e+s)/2,A=x*-i*m/n+(t+c)/2,I=st.asin(((t-A)/i).toFixed(9)),C=st.asin(((c-A)/i).toFixed(9));I=e<S?Ti-I:I,C=s<S?Ti-C:C,I<0&&(I=Ti*2+I),C<0&&(C=Ti*2+C),a&&I>C&&(I=I-Ti*2),!a&&C>I&&(C=C-Ti*2)}var $=C-I;if(Mi($)>l){var j=C,L=s,F=c;C=I+l*(a&&C>I?1:-1),s=S+n*st.cos(C),c=A+i*st.sin(C),f=Ld(s,c,n,i,r,0,a,L,F,[C,j,S,A])}$=C-I;var re=st.cos(I),Ae=st.sin(I),Je=st.cos(C),q=st.sin(C),ae=st.tan($/4),ue=4/3*n*ae,oe=4/3*i*ae,ce=[e,t],X=[e+ue*Ae,t-oe*re],B=[s+ue*q,c-oe*Je],N=[s,c];if(X[0]=2*ce[0]-X[0],X[1]=2*ce[1]-X[1],u)return[X,B,N].concat(f);f=[X,B,N].concat(f).join().split(",");for(var V=[],be=0,bt=f.length;be<bt;be++)V[be]=be%2?h(f[be-1],f[be],p).y:h(f[be],f[be+1],p).x;return V}function VE(e,t,n,i,r,o,a,s){for(var c=[],u=[[],[]],l,p,f,d,h,m,g,w,E=0;E<2;++E){if(E==0?(p=6*e-12*n+6*r,l=-3*e+9*n-9*r+3*a,f=3*n-3*e):(p=6*t-12*i+6*o,l=-3*t+9*i-9*o+3*s,f=3*i-3*t),Mi(l)<1e-12){if(Mi(p)<1e-12)continue;d=-f/p,0<d&&d<1&&c.push(d);continue}g=p*p-4*f*l,w=st.sqrt(g),!(g<0)&&(h=(-p+w)/(2*l),0<h&&h<1&&c.push(h),m=(-p-w)/(2*l),0<m&&m<1&&c.push(m))}for(var b=c.length,x=b,S;b--;)d=c[b],S=1-d,u[0][b]=S*S*S*e+3*S*S*d*n+3*S*d*d*r+d*d*d*a,u[1][b]=S*S*S*t+3*S*S*d*i+3*S*d*d*o+d*d*d*s;return u[0][x]=e,u[1][x]=t,u[0][x+1]=a,u[1][x+1]=s,u[0].length=u[1].length=x+2,{x0:Hn(...u[0]),y0:Hn(...u[1]),x1:zn(...u[0]),y1:zn(...u[1])}}function Bd(e){if(HE(e)||(e=IE(e)),BE(e))return e;for(var t=NE(zE(e)),n={x:0,y:0,bx:0,by:0,X:0,Y:0,qx:null,qy:null},i=function(f,d,h){var m,g;if(!f)return["C",d.x,d.y,d.x,d.y,d.x,d.y];switch(!(f[0]in{T:1,Q:1})&&(d.qx=d.qy=null),f[0]){case"M":d.X=f[1],d.Y=f[2];break;case"A":f=["C",...Ld(d.x,d.y,...f.slice(1))];break;case"S":h=="C"||h=="S"?(m=d.x*2-d.bx,g=d.y*2-d.by):(m=d.x,g=d.y),f=["C",m,g,...f.slice(1)];break;case"T":h=="Q"||h=="T"?(d.qx=d.x*2-d.qx,d.qy=d.y*2-d.qy):(d.qx=d.x,d.qy=d.y),f=["C",...Id(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",...Id(d.x,d.y,f[1],f[2],f[3],f[4])];break;case"L":f=["C",...Fa(d.x,d.y,f[1],f[2])];break;case"H":f=["C",...Fa(d.x,d.y,f[1],d.y)];break;case"V":f=["C",...Fa(d.x,d.y,d.x,f[1])];break;case"Z":f=["C",...Fa(d.x,d.y,d.X,d.Y)];break}return f},r=function(f,d){if(f[d].length>7){f[d].shift();for(var h=f[d];h.length;)o[d]="A",f.splice(d++,0,["C",...h.splice(0,6)]);f.splice(d,1),u=t.length}},o=[],a="",s="",c=0,u=t.length;c<u;c++){t[c]&&(a=t[c][0]),a!="C"&&(o[c]=a,c&&(s=o[c-1])),t[c]=i(t[c],n,s),o[c]!="A"&&a=="C"&&(o[c]="C"),r(t,c);var l=t[c],p=l.length;n.x=l[p-2],n.y=l[p-1],n.bx=Rd(l[p-4])||n.x,n.by=Rd(l[p-3])||n.y}return t}function $e(e){return xt(e)&&Jt(e,"waypoints")}function _e(e){return xt(e)&&Jt(e,"labelTarget")}function GE(e){return xt(e)&&Pr(e.parent)}function Nd(e){return{x:Math.round(e.x),y:Math.round(e.y),width:Math.round(e.width),height:Math.round(e.height)}}function ii(e){return{x:Math.round(e.x),y:Math.round(e.y)}}function le(e){return{top:e.y,right:e.x+(e.width||0),bottom:e.y+(e.height||0),left:e.x}}function Ha(e){return{x:e.left,y:e.top,width:e.right-e.left,height:e.bottom-e.top}}function WE(e){return ii({x:e.x+(e.width||0)/2,y:e.y+(e.height||0)/2})}function UE(e){for(var t=e.waypoints,n=t.reduce(function(u,l,p){var f=t[p-1];if(f){var d=u[u.length-1],h=d&&d.endLength||0,m=KE(f,l);u.push({start:f,end:l,startLength:h,endLength:h+m,length:m})}return u},[]),i=n.reduce(function(u,l){return u+l.length},0),r=i/2,o=0,a=n[o];a.endLength<r;)a=n[++o];var s=(r-a.startLength)/a.length,c={x:a.start.x+(a.end.x-a.start.x)*s,y:a.start.y+(a.end.y-a.start.y)*s};return c}function fe(e){return $e(e)?UE(e):WE(e)}function At(e,t,n){n=n||0,xt(n)||(n={x:n,y:n});var i=le(e),r=le(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 Ro(e,t,n){var i=qE(e,t);return i.length===1||i.length===2&&So(i[0],i[1])<1?ii(i[0]):i.length>1?(i=In(i,function(r){var o=Math.floor(r.t2*100)||1;return o=100-o,o=(o<10?"0":"")+o,r.segment2+"#"+o}),ii(i[n?0:i.length-1])):null}function qE(e,t){return Dd(e,t)}function YE(e){e=e.slice();for(var t=0,n,i,r;e[t];)n=e[t],i=e[t-1],r=e[t+1],So(n,r)===0||Eu(i,r,n)?e.splice(t,1):t++;return e}function KE(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function za(e,t){return Math.round(e*t)/t}function $d(e){return he(e)?e+"px":e}function XE(e){for(;e.parent;)e=e.parent;return e}function ZE(e){e=k({},{width:"100%",height:"100%"},e);const t=e.container||document.body,n=document.createElement("div");return n.setAttribute("class","djs-container djs-parent"),Wt(n,{position:"relative",overflow:"hidden",width:$d(e.width),height:$d(e.height)}),t.appendChild(n),n}function jd(e,t,n){const i=se("g");Pe(i).add(t);const r=n!==void 0?n:e.childNodes.length-1;return e.insertBefore(i,e.childNodes[r]||null),i}const QE="base",Fd=0,JE=1,ew={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=ZE(e),i=this._svg=se("svg");J(i,{width:"100%",height:"100%"}),Nt(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")}),ge(n,i);const r=this._viewport=jd(i,"viewport");e.deferUpdate&&(this._viewboxChanged=Hc(this._viewboxChanged,300)),this._restoreFocus=Hc(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=Ed(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(QE,Fd)},de.prototype.getLayer=function(e,t){if(!e)throw new Error("must specify a name");let n=this._layers[e];if(n||(n=this._layers[e]=this._createLayer(e,t)),typeof t<"u"&&n.index!==t)throw new Error("layer <"+e+"> already created at index <"+t+">");return n.group},de.prototype._getChildIndex=function(e){return en(this._layers,function(t,n){return n.visible&&e>=n.index&&t++,t},0)},de.prototype._createLayer=function(e,t){typeof t>"u"&&(t=JE);const n=this._getChildIndex(t);return{group:jd(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&&(vt(n),t.visible=!1),n},de.prototype._removeLayer=function(e){const t=this._layers[e];t&&(delete this._layers[e],vt(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(XE(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 He(this._planes,function(t){return t.rootElement===e})},de.prototype._resolveElement=function(e){return typeof e=="string"?this._elementRegistry.get(e):e},de.prototype._resolveElements=function(e){return pe(e)||(e=[e]),e.map(t=>this._resolveElement(t)).filter(Boolean)},de.prototype.getContainer=function(){return this._container},de.prototype._updateMarker=function(e,t,n){let i;e=this._resolveElement(e),e.markers=e.markers||new Set,i=this._elementRegistry._elements[e.id],i&&(T([i.gfx,i.secondaryGfx],function(r){r&&(n?(e.markers.add(t),Pe(r).add(t)):(e.markers.delete(t),Pe(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,Fd);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=ew[e];if(!tr(n,function(r){return typeof t[r]<"u"}))throw new Error("must supply { "+n.join(", ")+" } with "+e)},de.prototype._setParent=function(e,t,n){it(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),tt(e.parent&&e.parent.children,e),e.parent=null,r.fire(t+".removed",{element:e}),n.remove(e),e},de.prototype.removeShape=function(e){return this._removeElement(e,"shape")},de.prototype.removeConnection=function(e){return this._removeElement(e,"connection")},de.prototype.getGraphics=function(e,t){return this._elementRegistry.getGraphics(e,t)},de.prototype._changeViewbox=function(e){this._eventBus.fire("canvas.viewbox.changing"),e.apply(this),this._cachedViewbox=null,this._viewboxChanged()},de.prototype._viewboxChanged=function(){this._eventBus.fire("canvas.viewbox.changed",{viewbox:this.viewbox()})},de.prototype.viewbox=function(e){if(e===void 0&&this._cachedViewbox)return structuredClone(this._cachedViewbox);const t=this._viewport,n=this.getSize();let i,r,o,a,s,c,u;if(e)this._changeViewbox(function(){s=Math.min(n.width/e.width,n.height/e.height);const l=this._svg.createSVGMatrix().scale(s).translate(-e.x,-e.y);bo(t,l)});else return o=this._rootElement?this.getActiveLayer():null,i=o&&o.getBBox()||{},a=bo(t),r=a?a.matrix:oE(),s=za(r.a,1e3),c=za(-r.e||0,1e3),u=za(-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=k({dx:0,dy:0},e||{}),n=this._svg.createSVGMatrix().translate(e.dx,e.dy).multiply(n),Hd(t,n)}),{x:n.e,y:n.f}},de.prototype.scrollToElement=function(e,t){let n=100;const i=this._resolveElements(e);if(!i.length)return;const r=this.findRoot(i);if(!r)return;r!==this.getRootElement()&&this.setRootElement(r);const o=i.filter(h=>h!=r);if(!o.length)return;t||(t={}),typeof t=="number"&&(n=t),t={top:t.top||n,right:t.right||n,bottom:t.bottom||n,left:t.left||n};const a=at(o),s=le(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=le(c);if(!(a.width<c.width&&a.height<c.height))l=a.x-c.x,p=a.y-c.y;else{const h=Math.max(0,s.right-f.right),m=Math.min(0,s.left-f.left),g=Math.max(0,s.bottom-f.bottom),w=Math.min(0,s.top-f.top);l=h||m,p=g||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)}),za(i.a,1e3)};function Hd(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=k(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),Hd(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 Lr="data-element-id";function fn(e){this._elements={},this._eventBus=e}fn.$inject=["eventBus"],fn.prototype.add=function(e,t,n){var i=e.id;this._validateId(i),J(t,Lr,i),n&&J(n,Lr,i),this._elements[i]={element:e,gfx:t,secondaryGfx:n}},fn.prototype.remove=function(e){var t=this._elements,n=e.id||e,i=n&&t[n];i&&(J(i.gfx,Lr,""),i.secondaryGfx&&J(i.secondaryGfx,Lr,""),delete t[n])},fn.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)},fn.prototype.updateGraphics=function(e,t,n){var i=e.id||e,r=this._elements[i];return n?r.secondaryGfx=t:r.gfx=t,t&&J(t,Lr,i),t},fn.prototype.get=function(e){var t;typeof e=="string"?t=e:t=e&&J(e,Lr);var n=this._elements[t];return n&&n.element},fn.prototype.filter=function(e){var t=[];return this.forEach(function(n,i){e(n,i)&&t.push(n)}),t},fn.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}},fn.prototype.getAll=function(){return this.filter(function(e){return e})},fn.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)})},fn.prototype.getGraphics=function(e,t){var n=e.id||e,i=this._elements[n];return i&&(t?i.secondaryGfx:i.gfx)},fn.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 tw(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 nw(e){return e.__refs_collection===!0}function iw(e,t){return Object.prototype.hasOwnProperty.call(e,t.name||t)}function zd(e,t,n){var i=tw(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 rw(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?zd(this,t,e):rw(this,t,e)},vn.prototype.ensureRefsCollection=function(e,t){var n=e[t.name];return nw(n)||zd(this,t,e),n},vn.prototype.ensureBound=function(e,t){iw(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 Cu=new vn({name:"children",enumerable:!0,collection:!0},{name:"parent"}),Vd=new vn({name:"labels",enumerable:!0,collection:!0},{name:"labelTarget"}),Gd=new vn({name:"attachers",collection:!0},{name:"host"}),Wd=new vn({name:"outgoing",collection:!0},{name:"source"}),Ud=new vn({name:"incoming",collection:!0},{name:"target"});function Br(){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)}}),Cu.bind(this,"parent"),Vd.bind(this,"labels"),Wd.bind(this,"outgoing"),Ud.bind(this,"incoming")}function Co(){Br.call(this),Cu.bind(this,"children"),Gd.bind(this,"host"),Gd.bind(this,"attachers")}Q(Co,Br);function qd(){Br.call(this),Cu.bind(this,"children")}Q(qd,Co);function Yd(){Co.call(this),Vd.bind(this,"labelTarget")}Q(Yd,Co);function Kd(){Br.call(this),Wd.bind(this,"source"),Ud.bind(this,"target")}Q(Kd,Br);var ow={connection:Kd,shape:Co,label:Yd,root:qd};function aw(e,t){var n=ow[e];if(!n)throw new Error("unknown type: <"+e+">");return k(new n,t)}function sw(e){return e instanceof Br}function ri(){this._uid=12}ri.prototype.createRoot=function(e){return this.create("root",e)},ri.prototype.createLabel=function(e){return this.create("label",e)},ri.prototype.createShape=function(e){return this.create("shape",e)},ri.prototype.createConnection=function(e){return this.create("connection",e)},ri.prototype.create=function(e,t){return t=k({},t||{}),t.id||(t.id=e+"_"+this._uid++),aw(e,t)};var Va="__fn",Xd=1e3,cw=Array.prototype.slice;function nn(){this._listeners={},this.on("diagram.destroy",1,this._destroy,this)}nn.prototype.on=function(e,t,n,i){if(e=pe(e)?e:[e],Et(t)&&(i=n,n=t,t=Xd),!he(t))throw new Error("priority must be a number");var r=n;i&&(r=Yt(n,i),r[Va]=n[Va]||n);var o=this;e.forEach(function(a){o._addListener(a,{priority:t,callback:r,next:null})})},nn.prototype.once=function(e,t,n,i){var r=this;if(Et(t)&&(i=n,n=t,t=Xd),!he(t))throw new Error("priority must be a number");function o(){o.__isTomb=!0;var a=n.apply(i,arguments);return r.off(e,o),a}o[Va]=n,this.on(e,t,o)},nn.prototype.off=function(e,t){e=pe(e)?e:[e];var n=this;e.forEach(function(i){n._removeListener(i,t)})},nn.prototype.createEvent=function(e){var t=new Po;return t.init(e),t},nn.prototype.fire=function(e,t){var n,i,r,o;if(o=cw.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 Po?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}},nn.prototype.handleError=function(e){return this.fire("error",{error:e})===!1},nn.prototype._destroy=function(){this._listeners={}},nn.prototype._invokeListeners=function(e,t,n){for(var i;n&&!e.cancelBubble;)i=this._invokeListener(e,t,n),n=n.next;return i},nn.prototype._invokeListener=function(e,t,n){var i;if(n.callback.__isTomb)return i;try{i=uw(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},nn.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},nn.prototype._getListeners=function(e){return this._listeners[e]},nn.prototype._setListeners=function(e,t){this._listeners[e]=t},nn.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[Va]===t)&&(r?r.next=i:this._setListeners(e,i)),r=n,n=i};function Po(){}Po.prototype.stopPropagation=function(){this.cancelBubble=!0},Po.prototype.preventDefault=function(){this.defaultPrevented=!0},Po.prototype.init=function(e){k(this,e||{})};function uw(e,t){return e.apply(null,t)}function pr(e){return e.childNodes[0]}function lw(e){return e.parentNode.childNodes[1]}function Ga(e,t,n,i,r){var o=_o();o.setTranslate(t,n);var a=_o();a.setRotate(i||0,0,0);var s=_o();s.setScale(1,1),bo(e,[o,a,s])}function Tt(e,t,n){var i=_o();i.setTranslate(t,n),bo(e,i)}function Zd(e,t){var n=_o();n.setRotate(t,0,0),bo(e,n)}function dn(e,t){this._eventBus=e,this._elementRegistry=t}dn.$inject=["eventBus","elementRegistry"],dn.prototype._getChildrenContainer=function(e){var t=this._elementRegistry.getGraphics(e),n;return e.parent?(n=lw(t),n||(n=se("g"),Pe(n).add("djs-children"),ge(t.parentNode,n))):n=t,n},dn.prototype._clear=function(e){var t=pr(e);return Da(t),t},dn.prototype._createContainer=function(e,t,n,i){var r=se("g");Pe(r).add("djs-group"),typeof n<"u"?pw(r,t,t.childNodes[n]):ge(t,r);var o=se("g");Pe(o).add("djs-element"),Pe(o).add("djs-"+e),i&&Pe(o).add("djs-frame"),ge(r,o);var a=se("g");return Pe(a).add("djs-visual"),ge(o,a),o},dn.prototype.create=function(e,t,n){var i=this._getChildrenContainer(t.parent);return this._createContainer(e,i,n,wd(t))},dn.prototype.updateContainments=function(e){var t=this,n=this._elementRegistry,i;i=en(e,function(r,o){return o.parent&&(r[o.parent.id]=o.parent),r},{}),T(i,function(r){var o=r.children;if(o){var a=t._getChildrenContainer(r),s=a.firstChild;T(o,function(c){var u=n.getGraphics(c).parentNode;u===s?s=s.nextSibling:a.insertBefore(u,s)})}})},dn.prototype.drawShape=function(e,t,n={}){var i=this._eventBus;return i.fire("render.shape",{gfx:e,element:t,attrs:n})},dn.prototype.getShapePath=function(e){var t=this._eventBus;return t.fire("render.getShapePath",e)},dn.prototype.drawConnection=function(e,t,n={}){var i=this._eventBus;return i.fire("render.connection",{gfx:e,element:t,attrs:n})},dn.prototype.getConnectionPath=function(e){var t=this._eventBus;return t.fire("render.getConnectionPath",e)},dn.prototype.update=function(e,t,n){if(t.parent){var i=this._clear(n);if(e==="shape")this.drawShape(i,t),Tt(n,t.x,t.y);else if(e==="connection")this.drawConnection(i,t);else throw new Error("unknown type: "+e);t.hidden?J(n,"display","none"):J(n,"display","block")}},dn.prototype.remove=function(e){var t=this._elementRegistry.getGraphics(e);vt(t.parentNode)};function pw(e,t,n){var i=n||t.firstChild;e!==i&&t.insertBefore(e,i)}const fw={__depends__:[RE],__init__:["canvas"],canvas:["type",de],elementRegistry:["type",fn],elementFactory:["type",ri],eventBus:["type",nn],graphicsFactory:["type",dn]};function dw(e){var t=new xd(e);return t.init(),t}function hw(e){e=e||{};var t={config:["value",e]},n=[t,fw].concat(e.modules||[]);return dw(n)}function Di(e,t){this._injector=t||hw(e),this.get("eventBus").fire("diagram.init")}Di.prototype.get=function(e,t){return this._injector.get(e,t)},Di.prototype.invoke=function(e,t,n){return this._injector.invoke(e,t,n)},Di.prototype.destroy=function(){this.get("eventBus").fire("diagram.destroy")},Di.prototype.clear=function(){this.get("eventBus").fire("diagram.clear")};function $t(e){return e?"<"+e.$type+(e.id?' id="'+e.id:"")+'" />':"<null>"}function Kt(e,t){return e.$instanceOf(t)}function mw(e){return He(e.rootElements,function(t){return Kt(t,"bpmn:Process")||Kt(t,"bpmn:Collaboration")})}function gw(e){var t={},n=[],i={};function r(B,N){return function(V){B(V,N)}}function o(B){t[B.id]=B}function a(B){return t[B.id]}function s(B,N){var V=B.gfx;if(V)throw new Error(`already rendered ${$t(B)}`);return e.element(B,i[B.id],N)}function c(B,N){return e.root(B,i[B.id],N)}function u(B,N){try{var V=i[B.id]&&s(B,N);return o(B),V}catch(be){l(be.message,{element:B,error:be}),console.error(`failed to import ${$t(B)}`,be)}}function l(B,N){e.error(B,N)}var p=this.registerDi=function(N){var V=N.bpmnElement;V?i[V.id]?l(`multiple DI elements defined for ${$t(V)}`,{element:V}):i[V.id]=N:l(`no bpmnElement referenced in ${$t(N)}`,{element:N})};function f(B){d(B.plane)}function d(B){p(B),T(B.planeElement,h)}function h(B){p(B)}this.handleDefinitions=function(N,V){var be=N.diagrams;if(V&&be.indexOf(V)===-1)throw new Error("diagram not part of <bpmn:Definitions />");if(!V&&be&&be.length&&(V=be[0]),!V)throw new Error("no diagram to display");i={},f(V);var bt=V.plane;if(!bt)throw new Error(`no plane for ${$t(V)}`);var R=bt.bpmnElement;if(!R)if(R=mw(N),R)l(`correcting missing bpmnElement on ${$t(bt)} to ${$t(R)}`),bt.bpmnElement=R,p(bt);else throw new Error("no process or collaboration to display");var _=c(R,bt);if(Kt(R,"bpmn:Process")||Kt(R,"bpmn:SubProcess"))g(R,_);else if(Kt(R,"bpmn:Collaboration"))ce(R,_),w(N.rootElements,_);else throw new Error(`unsupported bpmnElement for ${$t(bt)}: ${$t(R)}`);m(n)};var m=this.handleDeferred=function(){for(var N;n.length;)N=n.shift(),N()};function g(B,N){ae(B,N),$(B.ioSpecification,N),C(B.artifacts,N),o(B)}function w(B,N){var V=we(B,function(be){return!a(be)&&Kt(be,"bpmn:Process")&&be.laneSets});V.forEach(r(g,N))}function E(B,N){u(B,N)}function b(B,N){T(B,r(E,N))}function x(B,N){u(B,N)}function S(B,N){u(B,N)}function A(B,N){u(B,N)}function I(B,N){u(B,N)}function C(B,N){T(B,function(V){Kt(V,"bpmn:Association")?n.push(function(){I(V,N)}):I(V,N)})}function $(B,N){B&&(T(B.dataInputs,r(S,N)),T(B.dataOutputs,r(A,N)))}var j=this.handleSubProcess=function(N,V){ae(N,V),C(N.artifacts,V)};function L(B,N){var V=u(B,N);Kt(B,"bpmn:SubProcess")&&j(B,V||N),Kt(B,"bpmn:Activity")&&$(B.ioSpecification,N),n.push(function(){T(B.dataInputAssociations,r(x,N)),T(B.dataOutputAssociations,r(x,N))})}function F(B,N){u(B,N)}function re(B,N){u(B,N)}function Ae(B,N){n.push(function(){var V=u(B,N);B.childLaneSet&&Je(B.childLaneSet,V||N),X(B)})}function Je(B,N){T(B.lanes,r(Ae,N))}function q(B,N){T(B,r(Je,N))}function ae(B,N){ue(B.flowElements,N),B.laneSets&&q(B.laneSets,N)}function ue(B,N){T(B,function(V){Kt(V,"bpmn:SequenceFlow")?n.push(function(){F(V,N)}):Kt(V,"bpmn:BoundaryEvent")?n.unshift(function(){L(V,N)}):Kt(V,"bpmn:FlowNode")?L(V,N):Kt(V,"bpmn:DataObject")||(Kt(V,"bpmn:DataStoreReference")||Kt(V,"bpmn:DataObjectReference")?re(V,N):l(`unrecognized flowElement ${$t(V)} in context ${$t(N&&N.businessObject)}`,{element:V,context:N}))})}function oe(B,N){var V=u(B,N),be=B.processRef;be&&g(be,V||N)}function ce(B,N){T(B.participants,r(oe,N)),n.push(function(){b(B.messageFlows,N)}),C(B.artifacts,N)}function X(B){T(B.flowNodeRef,function(N){var V=N.get("lanes");V&&V.push(B)})}}function y(e,t){var n=U(e);return n&&typeof n.$instanceOf=="function"&&n.$instanceOf(t)}function xe(e,t){return bi(t,function(n){return y(e,n)})}function U(e){return e&&e.businessObject||e}function Me(e){return e&&e.di}function vw(e,t,n){var i,r,o,a,s=[];function c(u,l){var p={root:function(m,g){return i.add(m,g)},element:function(m,g,w){return i.add(m,g,w)},error:function(m,g){s.push({message:m,context:g})}},f=new gw(p);l=l||u.diagrams&&u.diagrams[0];var d=yw(u,l);if(!d)throw new Error("no diagram to display");T(d,function(m){f.handleDefinitions(u,m)});var h=l.plane.bpmnElement.id;o.setRootElement(o.findRoot(h+"_plane")||o.findRoot(h))}return new Promise(function(u,l){try{return i=e.get("bpmnImporter"),r=e.get("eventBus"),o=e.get("canvas"),r.fire("import.render.start",{definitions:t}),c(t,n),r.fire("import.render.complete",{error:a,warnings:s}),u({warnings:s})}catch(p){return p.warnings=s,l(p)}})}function yw(e,t){if(!(!t||!t.plane)){var n=t.plane.bpmnElement,i=n;!y(n,"bpmn:Process")&&!y(n,"bpmn:Collaboration")&&(i=_w(n));var r;y(i,"bpmn:Collaboration")?r=i:r=He(e.rootElements,function(u){if(y(u,"bpmn:Collaboration"))return He(u.participants,function(l){return l.processRef===i})});var o=[i];r&&(o=It(r.participants,function(u){return u.processRef}),o.push(r));var a=Qd(o),s=[t],c=[n];return T(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 Qd(e){var t=[];return T(e,function(n){n&&(t.push(n),t=t.concat(Qd(n.flowElements)))}),t}function _w(e){for(var t=e;t;){if(y(t,"bpmn:Process"))return t;t=t.$parent}}var bw='<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>',Jd=bw,eh={verticalAlign:"middle"},th={color:"#404040"},xw={zIndex:"1001",position:"fixed",top:"0",left:"0",right:"0",bottom:"0"},Ew={width:"100%",height:"100%",background:"rgba(40,40,40,0.2)"},ww={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"},Sw='<div class="bjs-powered-by-lightbox"><div class="backdrop"></div><div class="notice"><a href="https://bpmn.io" target="_blank" rel="noopener" class="link">'+Jd+'</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>',Vn;function Rw(){Vn=Ge(Sw),Wt(Vn,xw),Wt(Be("svg",Vn),eh),Wt(Be(".backdrop",Vn),Ew),Wt(Be(".notice",Vn),ww),Wt(Be(".link",Vn),th,{margin:"15px 20px 15px 10px",alignSelf:"center"})}function Cw(){Vn||(Rw(),tn.bind(Vn,".backdrop","click",function(e){document.body.removeChild(Vn)})),document.body.appendChild(Vn)}const Wa=5,nh="djs-outline-hidden";function Ke(e){e=k({},Aw,e),this._moddle=this._createModdle(e),this._container=this._createContainer(e),this._init(this._container,this._moddle,e),Mw(this._container)}Q(Ke,Di),Ke.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||[]),Ua(s,o),s=Pw(s),this._emit("import.done",{error:s,warnings:s.warnings}),s}},Ke.prototype.importDefinitions=async function(t,n){return this._setDefinitions(t),{warnings:(await this.open(n)).warnings}},Ke.prototype.open=async function(t){const n=this._definitions;let i=t;if(!n){const o=new Error("no XML imported");throw Ua(o,[]),o}if(typeof t=="string"&&(i=Tw(n,t),!i)){const o=new Error("BPMNDiagram <"+t+"> not found");throw Ua(o,[]),o}try{this.clear()}catch(o){throw Ua(o,[]),o}const{warnings:r}=await vw(this,n,i);return{warnings:r}},Ke.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},Ke.prototype.saveSVG=async function(){this._emit("saveSVG.start");let t,n;try{const i=this.get("canvas"),r=i.getActiveLayer(),o=Be(":scope > defs",i._svg),a=bd(r),s=o?"<defs>"+bd(o)+"</defs>":"",c=i.getContainer();Ye(c).add(nh);let u;try{u=r.getBBox()}finally{Ye(c).remove(nh)}const l=u.x-Wa,p=u.y-Wa,f=u.width+Wa*2,d=u.height+Wa*2;t=`<?xml version="1.0" encoding="utf-8"?>
7
7
  <!-- created with bpmn-js / http://bpmn.io -->
8
8
  <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
9
- <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}},ze.prototype._setDefinitions=function(e){this._definitions=e},ze.prototype.getModules=function(){return this._modules},ze.prototype.clear=function(){this.getDefinitions()&&oi.prototype.clear.call(this)},ze.prototype.destroy=function(){oi.prototype.destroy.call(this),_n(this._container)},ze.prototype.on=function(e,t,n,i){return this.get("eventBus").on(e,t,n,i)},ze.prototype.off=function(e,t){this.get("eventBus").off(e,t)},ze.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=Me(e)),e.appendChild(this._container),this._emit("attach",{}),this.get("canvas").resized()},ze.prototype.getDefinitions=function(){return this._definitions},ze.prototype.detach=function(){const e=this._container,t=e.parentNode;t&&(this._emit("detach",{}),t.removeChild(e))},ze.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=k(hn(n,["additionalModules"]),{canvas:k({},n.canvas,{container:e}),modules:a});oi.call(this,s),n&&n.container&&this.attachTo(n.container)},ze.prototype._emit=function(e,t){return this.get("eventBus").fire(e,t)},ze.prototype._createContainer=function(e){const t=Ne('<div class="bjs-container"></div>');return Ct(t,{width:fd(e.width),height:fd(e.height),position:e.position}),t},ze.prototype._createModdle=function(e){const t=k({},this._moddleExtensions,e.moddleExtensions);return new Wp(t)},ze.prototype._modules=[];function va(e,t){return e.warnings=t,e}function Rx(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 Cx={width:"100%",height:"100%",position:"relative"};function fd(e){return e+(le(e)?"px":"")}function Px(e,t){return t&&Le(e.diagrams,function(n){return n.id===t})||null}function Ax(e){const n='<a href="http://bpmn.io" target="_blank" class="bjs-powered-by" title="Powered by bpmn.io" >'+cd+"</a>",i=Ne(n);Ct(Me("svg",i),ud),Ct(i,ld,{position:"absolute",bottom:"15px",right:"15px",zIndex:"100"}),e.appendChild(i),pe.bind(i,"click",function(r){Sx(),r.preventDefault()})}function sr(e){ze.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)}X(sr,ze),sr.prototype._createModdle=function(e){var t=ze.prototype._createModdle.call(this,e);return t.ids=new yn([32,36,1]),t},sr.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 Ee(e,t){return _(e,"bpmn:CallActivity")?!1:_(e,"bpmn:SubProcess")?(t=t||Se(e),t&&_(t,"bpmndi:BPMNPlane")?!0:t&&!!t.isExpanded):_(e,"bpmn:Participant")?!!V(e).processRef:!0}function pt(e){if(!(!_(e,"bpmn:Participant")&&!_(e,"bpmn:Lane"))){var t=Se(e).isHorizontal;return t===void 0?!0:t}}function Tx(e){return e&&V(e).isInterrupting!==!1}function wt(e){return e&&!!V(e).triggeredByEvent}function cr(e,t){var n=V(e).eventDefinitions;return Kn(n,function(i){return _(i,t)})}function Mx(e){return cr(e,"bpmn:ErrorEventDefinition")}function kx(e){return cr(e,"bpmn:EscalationEventDefinition")}function Dx(e){return cr(e,"bpmn:CompensateEventDefinition")}var Bi={width:90,height:20},dd=15;function ai(e){return _(e,"bpmn:Event")||_(e,"bpmn:Gateway")||_(e,"bpmn:DataStoreReference")||_(e,"bpmn:DataObjectReference")||_(e,"bpmn:DataInput")||_(e,"bpmn:DataOutput")||_(e,"bpmn:SequenceFlow")||_(e,"bpmn:MessageFlow")||_(e,"bpmn:Group")}function ya(e){return me(e.label)}function Ox(e){var t=e.length/2-1,n=e[Math.floor(t)],i=e[Math.ceil(t+.01)],r=Ix(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-=dd:a+=dd,{x:a,y:s}}function Ix(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 qc(e){return e.waypoints?Ox(e.waypoints):_(e,"bpmn:Group")?{x:e.x+e.width/2,y:e.y+Bi.height/2}:{x:e.x+e.width/2,y:e.y+e.height+Bi.height/2}}function Lx(e,t){var n,i,r,o=e.label;return o&&o.bounds?(r=o.bounds,i={width:Math.max(Bi.width,r.width),height:r.height},n={x:r.x+r.width/2,y:r.y+r.height/2}):(n=qc(t),i=Bi),k({x:n.x-i.width/2,y:n.y-i.height/2},i)}function hd(e){if(_(e,"bpmn:FlowElement")||_(e,"bpmn:Participant")||_(e,"bpmn:Lane")||_(e,"bpmn:SequenceFlow")||_(e,"bpmn:MessageFlow")||_(e,"bpmn:DataInput")||_(e,"bpmn:DataOutput"))return"name";if(_(e,"bpmn:TextAnnotation"))return"text";if(_(e,"bpmn:Group"))return"categoryValueRef"}function Bx(e){var t=e.categoryValueRef;return t&&t.value||""}function Ut(e){var t=e.businessObject,n=hd(t);if(n)return n==="categoryValueRef"?Bx(t):t[n]||""}function Nx(e,t){var n=e.businessObject,i=hd(n);if(i)if(i==="categoryValueRef"){if(!n[i])return e;n[i].value=t}else n[i]=t;return e}function $x(e){return me(e)&&ai(e.labelTarget)}var ur=7;function md(e){let t=[];return A(e.incoming,n=>{_(n,"bpmn:Association")&&_(n.source,"bpmn:TextAnnotation")&&t.push({annotation:n.source,association:n})}),A(e.outgoing,n=>{_(n,"bpmn:Association")&&_(n.target,"bpmn:TextAnnotation")&&t.push({annotation:n.target,association:n})}),t}function Zr(e){const t=new Map;return A(Fc(e),n=>{A(md(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 Yc="hsl(225, 10%, 15%)",jx="white";function wn(e,t){return Kn(e.eventDefinitions,function(n){return n.$type===t})}function Fx(e){return e.$type==="bpmn:IntermediateThrowEvent"||e.$type==="bpmn:EndEvent"}function Hx(e){var t=e.dataObjectRef;return e.isCollection||t&&t.isCollection}function be(e,t,n){var i=Se(e);return n||i.get("color:background-color")||i.get("bioc:fill")||t||jx}function Y(e,t,n){var i=Se(e);return n||i.get("color:border-color")||i.get("bioc:stroke")||t||Yc}function Qr(e,t,n,i){var r=Se(e),o=r.get("label");return i||o&&o.get("color:color")||t||Y(e,n)}function gd(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 Oi(r)}function Kc(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 Oi(a)}function zx(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 Oi(s)}function Vx(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 Oi(o)}function Jr(e,t={}){return{width:Xt(e,t),height:Bt(e,t)}}function Xt(e,t={}){return Dt(t,"width")?t.width:e.width}function Bt(e,t={}){return Dt(t,"height")?t.height:e.height}var Gx=new yn,Wx=10,_a=3,Ux=1.5,ba=10,qx=4,lr=.95,Yx=1,Kx=.25;function Ni(e,t,n,i,r,o,a){On.call(this,t,a);var s=e&&e.defaultFillColor,c=e&&e.defaultStrokeColor,u=e&&e.defaultLabelColor;function l(b){return n.computeStyle(b,{strokeLinecap:"round",strokeLinejoin:"round",stroke:Yc,strokeWidth:2,fill:"white"})}function p(b){return n.computeStyle(b,["no-fill"],{strokeLinecap:"round",strokeLinejoin:"round",stroke:Yc,strokeWidth:2})}function f(b,m){var{ref:v={x:0,y:0},scale:C=1,element:T,parentGfx:L=r._svg}=m,U=te("marker",{id:b,viewBox:"0 0 20 20",refX:v.x,refY:v.y,markerWidth:20*C,markerHeight:20*C,orient:"auto"});fe(U,T);var K=Me(":scope > defs",L);K||(K=te("defs"),fe(L,K)),fe(K,U)}function d(b,m,v,C){var T=Gx.nextPrefixed("marker-");return h(b,T,m,v,C),"url(#"+T+")"}function h(b,m,v,C,T){if(v==="sequenceflow-end"){var L=te("path",{d:"M 1 5 L 11 10 L 1 15 Z",...l({fill:T,stroke:T,strokeWidth:1})});f(m,{element:L,ref:{x:11,y:10},scale:.5,parentGfx:b})}if(v==="messageflow-start"){var U=te("circle",{cx:6,cy:6,r:3.5,...l({fill:C,stroke:T,strokeWidth:1,strokeDasharray:[1e4,1]})});f(m,{element:U,ref:{x:6,y:6},parentGfx:b})}if(v==="messageflow-end"){var K=te("path",{d:"m 1 5 l 0 -3 l 7 3 l -7 3 z",...l({fill:C,stroke:T,strokeWidth:1,strokeDasharray:[1e4,1]})});f(m,{element:K,ref:{x:8.5,y:5},parentGfx:b})}if(v==="association-start"){var ae=te("path",{d:"M 11 5 L 1 10 L 11 15",...p({fill:"none",stroke:T,strokeWidth:1.5,strokeDasharray:[1e4,1]})});f(m,{element:ae,ref:{x:1,y:10},scale:.5,parentGfx:b})}if(v==="association-end"){var Pe=te("path",{d:"M 1 5 L 11 10 L 1 15",...p({fill:"none",stroke:T,strokeWidth:1.5,strokeDasharray:[1e4,1]})});f(m,{element:Pe,ref:{x:11,y:10},scale:.5,parentGfx:b})}if(v==="conditional-flow-marker"){var we=te("path",{d:"M 0 10 L 8 6 L 16 10 L 8 14 Z",...l({fill:C,stroke:T})});f(m,{element:we,ref:{x:-1,y:10},scale:.5,parentGfx:b})}if(v==="conditional-default-flow-marker"){var he=te("path",{d:"M 6 4 L 10 16",...l({stroke:T,fill:"none"})});f(m,{element:he,ref:{x:0,y:10},scale:.5,parentGfx:b})}}function g(b,m,v,C,T={}){ut(C)&&(T=C,C=0),C=C||0,T=l(T);var L=m/2,U=v/2,K=te("circle",{cx:L,cy:U,r:Math.round((m+v)/4-C),...T});return fe(b,K),K}function y(b,m,v,C,T,L){ut(T)&&(L=T,T=0),T=T||0,L=l(L);var U=te("rect",{x:T,y:T,width:m-T*2,height:v-T*2,rx:C,ry:C,...L});return fe(b,U),U}function S(b,m,v,C){var T=m/2,L=v/2,U=[{x:T,y:0},{x:m,y:L},{x:T,y:v},{x:0,y:L}],K=U.map(function(Pe){return Pe.x+","+Pe.y}).join(" ");C=l(C);var ae=te("polygon",{...C,points:K});return fe(b,ae),ae}function w(b,m,v,C){v=p(v);var T=Gr(m,v,C);return fe(b,T),T}function E(b,m,v){return w(b,m,v,5)}function x(b,m,v){v=p(v);var C=te("path",{...v,d:m});return fe(b,C),C}function R(b,m,v,C){return x(m,v,k({"data-marker":b},C))}function M(b){return D[b]}function O(b){return function(m,v,C){return M(b)(m,v,C)}}var P={"bpmn:MessageEventDefinition":function(b,m,v={},C){var T=i.getScaledPath("EVENT_MESSAGE",{xScaleFactor:.9,yScaleFactor:.9,containerWidth:v.width||m.width,containerHeight:v.height||m.height,position:{mx:.235,my:.315}}),L=C?Y(m,c,v.stroke):be(m,s,v.fill),U=C?be(m,s,v.fill):Y(m,c,v.stroke),K=x(b,T,{fill:L,stroke:U,strokeWidth:1});return K},"bpmn:TimerEventDefinition":function(b,m,v={}){var C=v.width||m.width,T=v.height||m.height,L=v.width?1:2,U=g(b,C,T,.2*T,{fill:be(m,s,v.fill),stroke:Y(m,c,v.stroke),strokeWidth:L}),K=i.getScaledPath("EVENT_TIMER_WH",{xScaleFactor:.75,yScaleFactor:.75,containerWidth:C,containerHeight:T,position:{mx:.5,my:.5}});x(b,K,{stroke:Y(m,c,v.stroke),strokeWidth:L});for(var ae=0;ae<12;ae++){var Pe=i.getScaledPath("EVENT_TIMER_LINE",{xScaleFactor:.75,yScaleFactor:.75,containerWidth:C,containerHeight:T,position:{mx:.5,my:.5}}),we=C/2,he=T/2;x(b,Pe,{strokeWidth:1,stroke:Y(m,c,v.stroke),transform:"rotate("+ae*30+","+he+","+we+")"})}return U},"bpmn:EscalationEventDefinition":function(b,m,v={},C){var T=i.getScaledPath("EVENT_ESCALATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:v.width||m.width,containerHeight:v.height||m.height,position:{mx:.5,my:.2}}),L=C?Y(m,c,v.stroke):be(m,s,v.fill);return x(b,T,{fill:L,stroke:Y(m,c,v.stroke),strokeWidth:1})},"bpmn:ConditionalEventDefinition":function(b,m,v={}){var C=i.getScaledPath("EVENT_CONDITIONAL",{xScaleFactor:1,yScaleFactor:1,containerWidth:v.width||m.width,containerHeight:v.height||m.height,position:{mx:.5,my:.222}});return x(b,C,{fill:be(m,s,v.fill),stroke:Y(m,c,v.stroke),strokeWidth:1})},"bpmn:LinkEventDefinition":function(b,m,v={},C){var T=i.getScaledPath("EVENT_LINK",{xScaleFactor:1,yScaleFactor:1,containerWidth:m.width,containerHeight:m.height,position:{mx:.57,my:.263}}),L=C?Y(m,c,v.stroke):be(m,s,v.fill);return x(b,T,{fill:L,stroke:Y(m,c,v.stroke),strokeWidth:1})},"bpmn:ErrorEventDefinition":function(b,m,v={},C){var T=i.getScaledPath("EVENT_ERROR",{xScaleFactor:1.1,yScaleFactor:1.1,containerWidth:v.width||m.width,containerHeight:v.height||m.height,position:{mx:.2,my:.722}}),L=C?Y(m,c,v.stroke):be(m,s,v.fill);return x(b,T,{fill:L,stroke:Y(m,c,v.stroke),strokeWidth:1})},"bpmn:CancelEventDefinition":function(b,m,v={},C){var T=i.getScaledPath("EVENT_CANCEL_45",{xScaleFactor:1,yScaleFactor:1,containerWidth:m.width,containerHeight:m.height,position:{mx:.638,my:-.055}}),L=C?Y(m,c,v.stroke):"none",U=x(b,T,{fill:L,stroke:Y(m,c,v.stroke),strokeWidth:1});return ad(U,45),U},"bpmn:CompensateEventDefinition":function(b,m,v={},C){var T=i.getScaledPath("EVENT_COMPENSATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:v.width||m.width,containerHeight:v.height||m.height,position:{mx:.22,my:.5}}),L=C?Y(m,c,v.stroke):be(m,s,v.fill);return x(b,T,{fill:L,stroke:Y(m,c,v.stroke),strokeWidth:1})},"bpmn:SignalEventDefinition":function(b,m,v={},C){var T=i.getScaledPath("EVENT_SIGNAL",{xScaleFactor:.9,yScaleFactor:.9,containerWidth:v.width||m.width,containerHeight:v.height||m.height,position:{mx:.5,my:.2}}),L=C?Y(m,c,v.stroke):be(m,s,v.fill);return x(b,T,{strokeWidth:1,fill:L,stroke:Y(m,c,v.stroke)})},"bpmn:MultipleEventDefinition":function(b,m,v={},C){var T=i.getScaledPath("EVENT_MULTIPLE",{xScaleFactor:1.1,yScaleFactor:1.1,containerWidth:v.width||m.width,containerHeight:v.height||m.height,position:{mx:.211,my:.36}}),L=C?Y(m,c,v.stroke):be(m,s,v.fill);return x(b,T,{fill:L,stroke:Y(m,c,v.stroke),strokeWidth:1})},"bpmn:ParallelMultipleEventDefinition":function(b,m,v={}){var C=i.getScaledPath("EVENT_PARALLEL_MULTIPLE",{xScaleFactor:1.2,yScaleFactor:1.2,containerWidth:v.width||m.width,containerHeight:v.height||m.height,position:{mx:.458,my:.194}});return x(b,C,{fill:be(m,s,v.fill),stroke:Y(m,c,v.stroke),strokeWidth:1})},"bpmn:TerminateEventDefinition":function(b,m,v={}){var C=g(b,m.width,m.height,8,{fill:Y(m,c,v.stroke),stroke:Y(m,c,v.stroke),strokeWidth:4});return C}};function j(b,m,v={},C){var T=V(b),L=Fx(T),U=C||b;return T.get("eventDefinitions")&&T.get("eventDefinitions").length>1?T.get("parallelMultiple")?P["bpmn:ParallelMultipleEventDefinition"](m,U,v,L):P["bpmn:MultipleEventDefinition"](m,U,v,L):wn(T,"bpmn:MessageEventDefinition")?P["bpmn:MessageEventDefinition"](m,U,v,L):wn(T,"bpmn:TimerEventDefinition")?P["bpmn:TimerEventDefinition"](m,U,v,L):wn(T,"bpmn:ConditionalEventDefinition")?P["bpmn:ConditionalEventDefinition"](m,U,v,L):wn(T,"bpmn:SignalEventDefinition")?P["bpmn:SignalEventDefinition"](m,U,v,L):wn(T,"bpmn:EscalationEventDefinition")?P["bpmn:EscalationEventDefinition"](m,U,v,L):wn(T,"bpmn:LinkEventDefinition")?P["bpmn:LinkEventDefinition"](m,U,v,L):wn(T,"bpmn:ErrorEventDefinition")?P["bpmn:ErrorEventDefinition"](m,U,v,L):wn(T,"bpmn:CancelEventDefinition")?P["bpmn:CancelEventDefinition"](m,U,v,L):wn(T,"bpmn:CompensateEventDefinition")?P["bpmn:CompensateEventDefinition"](m,U,v,L):wn(T,"bpmn:TerminateEventDefinition")?P["bpmn:TerminateEventDefinition"](m,U,v,L):null}var $={ParticipantMultiplicityMarker:function(b,m,v={}){var C=Xt(m,v),T=Bt(m,v),L=i.getScaledPath("MARKER_PARALLEL",{xScaleFactor:1,yScaleFactor:1,containerWidth:C,containerHeight:T,position:{mx:(C/2-6)/C,my:(T-15)/T}});R("participant-multiplicity",b,L,{strokeWidth:2,fill:be(m,s,v.fill),stroke:Y(m,c,v.stroke)})},SubProcessMarker:function(b,m,v={}){var C=y(b,14,14,0,{strokeWidth:1,fill:be(m,s,v.fill),stroke:Y(m,c,v.stroke)});mt(C,m.width/2-7.5,m.height-20);var T=i.getScaledPath("MARKER_SUB_PROCESS",{xScaleFactor:1.5,yScaleFactor:1.5,containerWidth:m.width,containerHeight:m.height,position:{mx:(m.width/2-7.5)/m.width,my:(m.height-20)/m.height}});R("sub-process",b,T,{fill:be(m,s,v.fill),stroke:Y(m,c,v.stroke)})},ParallelMarker:function(b,m,v){var C=Xt(m,v),T=Bt(m,v),L=i.getScaledPath("MARKER_PARALLEL",{xScaleFactor:1,yScaleFactor:1,containerWidth:C,containerHeight:T,position:{mx:(C/2+v.parallel)/C,my:(T-20)/T}});R("parallel",b,L,{fill:be(m,s,v.fill),stroke:Y(m,c,v.stroke)})},SequentialMarker:function(b,m,v){var C=i.getScaledPath("MARKER_SEQUENTIAL",{xScaleFactor:1,yScaleFactor:1,containerWidth:m.width,containerHeight:m.height,position:{mx:(m.width/2+v.seq)/m.width,my:(m.height-19)/m.height}});R("sequential",b,C,{fill:be(m,s,v.fill),stroke:Y(m,c,v.stroke)})},CompensationMarker:function(b,m,v){var C=i.getScaledPath("MARKER_COMPENSATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:m.width,containerHeight:m.height,position:{mx:(m.width/2+v.compensation)/m.width,my:(m.height-13)/m.height}});R("compensation",b,C,{strokeWidth:1,fill:be(m,s,v.fill),stroke:Y(m,c,v.stroke)})},LoopMarker:function(b,m,v){var C=Xt(m,v),T=Bt(m,v),L=i.getScaledPath("MARKER_LOOP",{xScaleFactor:1,yScaleFactor:1,containerWidth:C,containerHeight:T,position:{mx:(C/2+v.loop)/C,my:(T-7)/T}});R("loop",b,L,{strokeWidth:1.5,fill:"none",stroke:Y(m,c,v.stroke),strokeMiterlimit:.5})},AdhocMarker:function(b,m,v){var C=Xt(m,v),T=Bt(m,v),L=i.getScaledPath("MARKER_ADHOC",{xScaleFactor:1,yScaleFactor:1,containerWidth:C,containerHeight:T,position:{mx:(C/2+v.adhoc)/C,my:(T-15)/T}});R("adhoc",b,L,{strokeWidth:1,fill:Y(m,c,v.stroke),stroke:Y(m,c,v.stroke)})}};function I(b,m,v,C){$[b](m,v,C)}function G(b,m,v=[],C={}){C={fill:C.fill,stroke:C.stroke,width:Xt(m,C),height:Bt(m,C)};var T=V(m),L=v.includes("SubProcessMarker");L?C={...C,seq:-21,parallel:-22,compensation:-25,loop:-18,adhoc:10}:C={...C,seq:-5,parallel:-6,compensation:-7,loop:0,adhoc:-8},T.get("isForCompensation")&&v.push("CompensationMarker"),_(T,"bpmn:AdHocSubProcess")&&(v.push("AdhocMarker"),L||k(C,{compensation:C.compensation-18}));var U=T.get("loopCharacteristics"),K=U&&U.get("isSequential");U&&(k(C,{compensation:C.compensation-18}),v.includes("AdhocMarker")&&k(C,{seq:-23,loop:-18,parallel:-24}),K===void 0&&v.push("LoopMarker"),K===!1&&v.push("ParallelMarker"),K===!0&&v.push("SequentialMarker")),v.includes("CompensationMarker")&&v.length===1&&k(C,{compensation:-8}),A(v,function(ae){I(ae,b,m,C)})}function ie(b,m,v={}){v=k({size:{width:100}},v);var C=o.createText(m||"",v);return xe(C).add("djs-label"),fe(b,C),C}function Te(b,m,v,C={}){var T=V(m),L=Jr({x:m.x,y:m.y,width:m.width,height:m.height},C);return ie(b,T.name,{align:v,box:L,padding:7,style:{fill:Qr(m,u,c,C.stroke)}})}function tt(b,m,v={}){var C={width:m.width,height:m.height,x:m.width/2+m.x,y:m.height/2+m.y};return ie(b,Ut(m),{box:C,style:k({},o.getExternalStyle(),{fill:Qr(m,u,c,v.stroke)})})}function W(b,m,v,C={}){var T=pt(v),L=ie(b,m,{box:{height:30,width:T?Bt(v,C):Xt(v,C)},align:"center-middle",style:{fill:Qr(v,u,c,C.stroke)}});if(T){var U=-1*Bt(v,C);ma(L,0,-U,270)}}function J(b,m,v={}){var{width:C,height:T}=Jr(m,v);return y(b,C,T,ba,{...v,fill:be(m,s,v.fill),fillOpacity:lr,stroke:Y(m,c,v.stroke)})}function re(b,m,v={}){var C=V(m),T=be(m,s,v.fill),L=Y(m,c,v.stroke);return(C.get("associationDirection")==="One"||C.get("associationDirection")==="Both")&&(v.markerEnd=d(b,"association-end",T,L)),C.get("associationDirection")==="Both"&&(v.markerStart=d(b,"association-start",T,L)),v=Re(v,["markerStart","markerEnd"]),E(b,m.waypoints,{...v,stroke:L,strokeDasharray:"0, 5"})}function Q(b,m,v={}){var C=be(m,s,v.fill),T=Y(m,c,v.stroke),L=i.getScaledPath("DATA_OBJECT_PATH",{xScaleFactor:1,yScaleFactor:1,containerWidth:m.width,containerHeight:m.height,position:{mx:.474,my:.296}}),U=x(b,L,{fill:C,fillOpacity:lr,stroke:T}),K=V(m);if(Hx(K)){var ae=i.getScaledPath("DATA_OBJECT_COLLECTION_PATH",{xScaleFactor:1,yScaleFactor:1,containerWidth:m.width,containerHeight:m.height,position:{mx:.33,my:(m.height-18)/m.height}});x(b,ae,{strokeWidth:2,fill:C,stroke:T})}return U}function ee(b,m,v={}){return g(b,m.width,m.height,{fillOpacity:lr,...v,fill:be(m,s,v.fill),stroke:Y(m,c,v.stroke)})}function q(b,m,v={}){return S(b,m.width,m.height,{fill:be(m,s,v.fill),fillOpacity:lr,stroke:Y(m,c,v.stroke)})}function N(b,m,v={}){var C=y(b,Xt(m,v),Bt(m,v),0,{fill:be(m,s,v.fill),fillOpacity:v.fillOpacity||lr,stroke:Y(m,c,v.stroke),strokeWidth:1.5}),T=V(m);if(_(T,"bpmn:Lane")){var L=T.get("name");W(b,L,m,v)}return C}function B(b,m,v={}){var C=J(b,m,v),T=Ee(m);if(wt(m)&&(Z(C,{strokeDasharray:"0, 5.5",strokeWidth:2.5}),!T)){var L=V(m).flowElements||[],U=L.filter(K=>_(K,"bpmn:StartEvent"));U.length===1&&F(U[0],b,v,m)}return Te(b,m,T?"center-top":"center-middle",v),T?G(b,m,void 0,v):G(b,m,["SubProcessMarker"],v),C}function F(b,m,v,C){var T=22,L={fill:be(C,s,v.fill),stroke:Y(C,c,v.stroke),width:T,height:T},U=V(b).isInterrupting,K=U?0:3,ae=U?1:1.2,Pe=20,we=(T-Pe)/2,he="translate("+we+","+we+")";g(m,Pe,Pe,{fill:L.fill,stroke:L.stroke,strokeWidth:ae,strokeDasharray:K,transform:he}),j(b,m,L,C)}function ge(b,m,v={}){var C=J(b,m,v);return Te(b,m,"center-middle",v),G(b,m,void 0,v),C}var D=this.handlers={"bpmn:AdHocSubProcess":function(b,m,v={}){return Ee(m)?v=Re(v,["fill","stroke","width","height"]):v=Re(v,["fill","stroke"]),B(b,m,v)},"bpmn:Association":function(b,m,v={}){return v=Re(v,["fill","stroke"]),re(b,m,v)},"bpmn:BoundaryEvent":function(b,m,v={}){var{renderIcon:C=!0}=v;v=Re(v,["fill","stroke"]);var T=V(m),L=T.get("cancelActivity");v={strokeWidth:1.5,fill:be(m,s,v.fill),fillOpacity:Yx,stroke:Y(m,c,v.stroke)},L||(v.strokeDasharray="6");var U=ee(b,m,v);return g(b,m.width,m.height,_a,{...v,fill:"none"}),C&&j(m,b,v),U},"bpmn:BusinessRuleTask":function(b,m,v={}){v=Re(v,["fill","stroke"]);var C=ge(b,m,v),T=i.getScaledPath("TASK_TYPE_BUSINESS_RULE_MAIN",{abspos:{x:8,y:8}}),L=x(b,T);Z(L,{fill:be(m,s,v.fill),stroke:Y(m,c,v.stroke),strokeWidth:1});var U=i.getScaledPath("TASK_TYPE_BUSINESS_RULE_HEADER",{abspos:{x:8,y:8}}),K=x(b,U);return Z(K,{fill:Y(m,c,v.stroke),stroke:Y(m,c,v.stroke),strokeWidth:1}),C},"bpmn:CallActivity":function(b,m,v={}){return v=Re(v,["fill","stroke"]),B(b,m,{strokeWidth:5,...v})},"bpmn:ComplexGateway":function(b,m,v={}){v=Re(v,["fill","stroke"]);var C=q(b,m,v),T=i.getScaledPath("GATEWAY_COMPLEX",{xScaleFactor:.5,yScaleFactor:.5,containerWidth:m.width,containerHeight:m.height,position:{mx:.46,my:.26}});return x(b,T,{fill:Y(m,c,v.stroke),stroke:Y(m,c,v.stroke),strokeWidth:1}),C},"bpmn:DataInput":function(b,m,v={}){v=Re(v,["fill","stroke"]);var C=i.getRawPath("DATA_ARROW"),T=Q(b,m,v);return x(b,C,{fill:"none",stroke:Y(m,c,v.stroke),strokeWidth:1}),T},"bpmn:DataInputAssociation":function(b,m,v={}){return v=Re(v,["fill","stroke"]),re(b,m,{...v,markerEnd:d(b,"association-end",be(m,s,v.fill),Y(m,c,v.stroke))})},"bpmn:DataObject":function(b,m,v={}){return v=Re(v,["fill","stroke"]),Q(b,m,v)},"bpmn:DataObjectReference":O("bpmn:DataObject"),"bpmn:DataOutput":function(b,m,v={}){v=Re(v,["fill","stroke"]);var C=i.getRawPath("DATA_ARROW"),T=Q(b,m,v);return x(b,C,{strokeWidth:1,fill:Y(m,c,v.stroke),stroke:Y(m,c,v.stroke)}),T},"bpmn:DataOutputAssociation":function(b,m,v={}){return v=Re(v,["fill","stroke"]),re(b,m,{...v,markerEnd:d(b,"association-end",be(m,s,v.fill),Y(m,c,v.stroke))})},"bpmn:DataStoreReference":function(b,m,v={}){v=Re(v,["fill","stroke"]);var C=i.getScaledPath("DATA_STORE",{xScaleFactor:1,yScaleFactor:1,containerWidth:m.width,containerHeight:m.height,position:{mx:0,my:.133}});return x(b,C,{fill:be(m,s,v.fill),fillOpacity:lr,stroke:Y(m,c,v.stroke),strokeWidth:2})},"bpmn:EndEvent":function(b,m,v={}){var{renderIcon:C=!0}=v;v=Re(v,["fill","stroke"]);var T=ee(b,m,{...v,strokeWidth:4});return C&&j(m,b,v),T},"bpmn:EventBasedGateway":function(b,m,v={}){v=Re(v,["fill","stroke"]);var C=V(m),T=q(b,m,v);g(b,m.width,m.height,m.height*.2,{fill:be(m,"none",v.fill),stroke:Y(m,c,v.stroke),strokeWidth:1});var L=C.get("eventGatewayType"),U=!!C.get("instantiate");function K(){var Pe=i.getScaledPath("GATEWAY_EVENT_BASED",{xScaleFactor:.18,yScaleFactor:.18,containerWidth:m.width,containerHeight:m.height,position:{mx:.36,my:.44}});x(b,Pe,{fill:"none",stroke:Y(m,c,v.stroke),strokeWidth:2})}if(L==="Parallel"){var ae=i.getScaledPath("GATEWAY_PARALLEL",{xScaleFactor:.4,yScaleFactor:.4,containerWidth:m.width,containerHeight:m.height,position:{mx:.474,my:.296}});x(b,ae,{fill:"none",stroke:Y(m,c,v.stroke),strokeWidth:1})}else L==="Exclusive"&&(U||g(b,m.width,m.height,m.height*.26,{fill:"none",stroke:Y(m,c,v.stroke),strokeWidth:1}),K());return T},"bpmn:ExclusiveGateway":function(b,m,v={}){v=Re(v,["fill","stroke"]);var C=q(b,m,v),T=i.getScaledPath("GATEWAY_EXCLUSIVE",{xScaleFactor:.4,yScaleFactor:.4,containerWidth:m.width,containerHeight:m.height,position:{mx:.32,my:.3}}),L=Se(m);return L.get("isMarkerVisible")&&x(b,T,{fill:Y(m,c,v.stroke),stroke:Y(m,c,v.stroke),strokeWidth:1}),C},"bpmn:Gateway":function(b,m,v={}){return v=Re(v,["fill","stroke"]),q(b,m,v)},"bpmn:Group":function(b,m,v={}){return v=Re(v,["fill","stroke","width","height"]),y(b,m.width,m.height,ba,{stroke:Y(m,c,v.stroke),strokeWidth:1.5,strokeDasharray:"10, 6, 0, 6",fill:"none",pointerEvents:"none",width:Xt(m,v),height:Bt(m,v)})},"bpmn:InclusiveGateway":function(b,m,v={}){v=Re(v,["fill","stroke"]);var C=q(b,m,v);return g(b,m.width,m.height,m.height*.24,{fill:be(m,s,v.fill),stroke:Y(m,c,v.stroke),strokeWidth:2.5}),C},"bpmn:IntermediateEvent":function(b,m,v={}){var{renderIcon:C=!0}=v;v=Re(v,["fill","stroke"]);var T=ee(b,m,{...v,strokeWidth:1.5});return g(b,m.width,m.height,_a,{fill:"none",stroke:Y(m,c,v.stroke),strokeWidth:1.5}),C&&j(m,b,v),T},"bpmn:IntermediateCatchEvent":O("bpmn:IntermediateEvent"),"bpmn:IntermediateThrowEvent":O("bpmn:IntermediateEvent"),"bpmn:Lane":function(b,m,v={}){return v=Re(v,["fill","stroke","width","height"]),N(b,m,{...v,fillOpacity:Kx})},"bpmn:ManualTask":function(b,m,v={}){v=Re(v,["fill","stroke"]);var C=ge(b,m,v),T=i.getScaledPath("TASK_TYPE_MANUAL",{abspos:{x:17,y:15}});return x(b,T,{fill:be(m,s,v.fill),stroke:Y(m,c,v.stroke),strokeWidth:.5}),C},"bpmn:MessageFlow":function(b,m,v={}){v=Re(v,["fill","stroke"]);var C=V(m),T=Se(m),L=be(m,s,v.fill),U=Y(m,c,v.stroke),K=E(b,m.waypoints,{markerEnd:d(b,"messageflow-end",L,U),markerStart:d(b,"messageflow-start",L,U),stroke:U,strokeDasharray:"10, 11",strokeWidth:1.5});if(C.get("messageRef")){var ae=K.getPointAtLength(K.getTotalLength()/2),Pe=i.getScaledPath("MESSAGE_FLOW_MARKER",{abspos:{x:ae.x,y:ae.y}}),we={strokeWidth:1};T.get("messageVisibleKind")==="initiating"?(we.fill=L,we.stroke=U):(we.fill=U,we.stroke=L);var he=x(b,Pe,we),_e=C.get("messageRef"),je=_e.get("name"),Ce=ie(b,je,{align:"center-top",fitBox:!0,style:{fill:U}}),Be=he.getBBox(),$e=Ce.getBBox(),ct=ae.x-$e.width/2,zt=ae.y+Be.height/2+Wx;ma(Ce,ct,zt,0)}return K},"bpmn:ParallelGateway":function(b,m,v={}){v=Re(v,["fill","stroke"]);var C=q(b,m,v),T=i.getScaledPath("GATEWAY_PARALLEL",{xScaleFactor:.6,yScaleFactor:.6,containerWidth:m.width,containerHeight:m.height,position:{mx:.46,my:.2}});return x(b,T,{fill:Y(m,c,v.stroke),stroke:Y(m,c,v.stroke),strokeWidth:1}),C},"bpmn:Participant":function(b,m,v={}){v=Re(v,["fill","stroke","width","height"]);var C=N(b,m,v),T=Ee(m),L=pt(m),U=V(m),K=U.get("name");if(T){var ae=L?[{x:30,y:0},{x:30,y:Bt(m,v)}]:[{x:0,y:30},{x:Xt(m,v),y:30}];w(b,ae,{stroke:Y(m,c,v.stroke),strokeWidth:Ux}),W(b,K,m,v)}else{var Pe=Jr(m,v);L||(Pe.height=Xt(m,v),Pe.width=Bt(m,v));var we=ie(b,K,{box:Pe,align:"center-middle",style:{fill:Qr(m,u,c,v.stroke)}});if(!L){var he=-1*Bt(m,v);ma(we,0,-he,270)}}return U.get("participantMultiplicity")&&I("ParticipantMultiplicityMarker",b,m,v),C},"bpmn:ReceiveTask":function(b,m,v={}){v=Re(v,["fill","stroke"]);var C=V(m),T=ge(b,m,v),L;return C.get("instantiate")?(g(b,28,28,20*.22,{fill:be(m,s,v.fill),stroke:Y(m,c,v.stroke),strokeWidth:1}),L=i.getScaledPath("TASK_TYPE_INSTANTIATING_SEND",{abspos:{x:7.77,y:9.52}})):L=i.getScaledPath("TASK_TYPE_SEND",{xScaleFactor:.9,yScaleFactor:.9,containerWidth:21,containerHeight:14,position:{mx:.3,my:.4}}),x(b,L,{fill:be(m,s,v.fill),stroke:Y(m,c,v.stroke),strokeWidth:1}),T},"bpmn:ScriptTask":function(b,m,v={}){v=Re(v,["fill","stroke"]);var C=ge(b,m,v),T=i.getScaledPath("TASK_TYPE_SCRIPT",{abspos:{x:15,y:20}});return x(b,T,{fill:be(m,s,v.fill),stroke:Y(m,c,v.stroke),strokeWidth:1}),C},"bpmn:SendTask":function(b,m,v={}){v=Re(v,["fill","stroke"]);var C=ge(b,m,v),T=i.getScaledPath("TASK_TYPE_SEND",{xScaleFactor:1,yScaleFactor:1,containerWidth:21,containerHeight:14,position:{mx:.285,my:.357}});return x(b,T,{fill:Y(m,c,v.stroke),stroke:be(m,s,v.fill),strokeWidth:1}),C},"bpmn:SequenceFlow":function(b,m,v={}){v=Re(v,["fill","stroke"]);var C=be(m,s,v.fill),T=Y(m,c,v.stroke),L=E(b,m.waypoints,{markerEnd:d(b,"sequenceflow-end",C,T),stroke:T}),U=V(m),{source:K}=m;if(K){var ae=V(K);U.get("conditionExpression")&&_(ae,"bpmn:Activity")&&Z(L,{markerStart:d(b,"conditional-flow-marker",C,T)}),ae.get("default")&&(_(ae,"bpmn:Gateway")||_(ae,"bpmn:Activity"))&&ae.get("default")===U&&Z(L,{markerStart:d(b,"conditional-default-flow-marker",C,T)})}return L},"bpmn:ServiceTask":function(b,m,v={}){v=Re(v,["fill","stroke"]);var C=ge(b,m,v);g(b,10,10,{fill:be(m,s,v.fill),stroke:"none",transform:"translate(6, 6)"});var T=i.getScaledPath("TASK_TYPE_SERVICE",{abspos:{x:12,y:18}});x(b,T,{fill:be(m,s,v.fill),stroke:Y(m,c,v.stroke),strokeWidth:1}),g(b,10,10,{fill:be(m,s,v.fill),stroke:"none",transform:"translate(11, 10)"});var L=i.getScaledPath("TASK_TYPE_SERVICE",{abspos:{x:17,y:22}});return x(b,L,{fill:be(m,s,v.fill),stroke:Y(m,c,v.stroke),strokeWidth:1}),C},"bpmn:StartEvent":function(b,m,v={}){var{renderIcon:C=!0}=v;v=Re(v,["fill","stroke"]);var T=V(m);T.get("isInterrupting")||(v={...v,strokeDasharray:"6"});var L=ee(b,m,v);return C&&j(m,b,v),L},"bpmn:SubProcess":function(b,m,v={}){return Ee(m)?v=Re(v,["fill","stroke","width","height"]):v=Re(v,["fill","stroke"]),B(b,m,v)},"bpmn:Task":function(b,m,v={}){return v=Re(v,["fill","stroke"]),ge(b,m,v)},"bpmn:TextAnnotation":function(b,m,v={}){v=Re(v,["fill","stroke"]);var{width:C,height:T}=Jr(m,v),L=y(b,C,T,0,0,{fill:"none",stroke:"none"}),U=i.getScaledPath("TEXT_ANNOTATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:C,containerHeight:T,position:{mx:0,my:0}});x(b,U,{stroke:Y(m,c,v.stroke)});var K=V(m),ae=K.get("text")||"";return ie(b,ae,{align:"left-top",box:Jr(m,v),padding:ur,style:{fill:Qr(m,u,c,v.stroke)}}),L},"bpmn:Transaction":function(b,m,v={}){Ee(m)?v=Re(v,["fill","stroke","width","height"]):v=Re(v,["fill","stroke"]);var C=B(b,m,{strokeWidth:1.5,...v}),T=n.style(["no-fill","no-events"],{stroke:Y(m,c,v.stroke),strokeWidth:1.5}),L=Ee(m);return L||(v={}),y(b,Xt(m,v),Bt(m,v),ba-_a,_a,T),C},"bpmn:UserTask":function(b,m,v={}){v=Re(v,["fill","stroke"]);var C=ge(b,m,v),T=15,L=12,U=i.getScaledPath("TASK_TYPE_USER_1",{abspos:{x:T,y:L}});x(b,U,{fill:be(m,s,v.fill),stroke:Y(m,c,v.stroke),strokeWidth:.5});var K=i.getScaledPath("TASK_TYPE_USER_2",{abspos:{x:T,y:L}});x(b,K,{fill:be(m,s,v.fill),stroke:Y(m,c,v.stroke),strokeWidth:.5});var ae=i.getScaledPath("TASK_TYPE_USER_3",{abspos:{x:T,y:L}});return x(b,ae,{fill:Y(m,c,v.stroke),stroke:Y(m,c,v.stroke),strokeWidth:.5}),C},label:function(b,m,v={}){return tt(b,m,v)}};this._drawPath=x,this._renderer=M}X(Ni,On),Ni.$inject=["config.bpmnRenderer","eventBus","styles","pathMap","canvas","textRenderer"],Ni.prototype.canRender=function(e){return _(e,"bpmn:BaseElement")},Ni.prototype.drawShape=function(e,t,n={}){var{type:i}=t,r=this._renderer(i);return r(e,t,n)},Ni.prototype.drawConnection=function(e,t,n={}){var{type:i}=t,r=this._renderer(i);return r(e,t,n)},Ni.prototype.getShapePath=function(e){return me(e)?Kc(e,qx):_(e,"bpmn:Event")?gd(e):_(e,"bpmn:Activity")?Kc(e,ba):_(e,"bpmn:Gateway")?zx(e):Vx(e)};function Re(e,t=[]){return t.reduce((n,i)=>(e[i]&&(n[i]=e[i]),n),{})}var Xx=0,Zx={width:150,height:50};function Qx(e){var t=e.split("-");return{horizontal:t[0]||"center",vertical:t[1]||"top"}}function Jx(e){return ut(e)?k({top:0,left:0,right:0,bottom:0},e):{top:e,left:e,right:e,bottom:e}}var Xc=null;function ew(){return Xc||(Xc=document.createElement("canvas").getContext("2d")),Xc}function tw(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(vd(e.fontSize)||"12px"),t.push(e.fontFamily||"sans-serif"),t.join(" ")}function vd(e){if(e!=null)return typeof e=="number"||/^-?\d+(\.\d+)?$/.test(e)?e+"px":e}function nw(e,t){var n=ew();if(!n)return{width:0,height:0};n.font=tw(t),"letterSpacing"in n&&(n.letterSpacing=vd(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 iw(e,t,n){for(var i=e.shift(),r=i,o;;){if(o=nw(r,n),o.width=r?o.width:0,r===" "||r===""||o.width<Math.round(t)||r.length<2)return rw(e,r,i,o);r=aw(r,o.width,t)}}function rw(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 yd="­";function ow(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===yd)&&r.pop();break}var a=r[r.length-1];return a&&a===yd&&(r[r.length-1]="-"),r.join("")}function aw(e,t,n){var i=Math.max(e.length*(n/t),1),r=ow(e,i);return r||(r=e.slice(0,Math.max(Math.round(i-1),1))),r}function Ea(e){this._config=k({},{size:Zx,padding:Xx,style:{},align:"center-top"},e||{})}Ea.prototype.createText=function(e,t){return this.layoutText(e,t).element},Ea.prototype.getDimensions=function(e,t){return this.layoutText(e,t).dimensions},Ea.prototype.layoutText=function(e,t){for(var n=k({},this._config.size,t.box),i=k({},this._config.style,t.style),r=Qx(t.align||this._config.align),o=Jx(t.padding!==void 0?t.padding:this._config.padding),a=t.fitBox||!1,s=sw(i),c=e.split(/\u00AD?\r?\n/),u=[],l=n.width-o.left-o.right;c.length;)u.push(iw(c,l,i));r.vertical==="middle"&&(o.top=o.bottom=0);var p=Ot(u,function(y,S,w){return y+(s||S.height)},0)+o.top+o.bottom,f=Ot(u,function(y,S,w){return S.width>y?S.width:y},0),d=o.top;r.vertical==="middle"&&(d+=(n.height-p)/2),d-=(s||u[0].height)/4;var h=te("text");Z(h,i),A(u,function(y){var S;switch(d+=s||y.height,r.horizontal){case"left":S=o.left;break;case"right":S=(a?f:l)-o.right-y.width;break;default:S=Math.max(((a?f:l)-y.width)/2+o.left,0)}var w=te("tspan");Z(w,{x:S,y:d}),w.textContent=y.text,fe(h,w)});var g={width:f,height:p};return{dimensions:g,element:h}};function sw(e){if("fontSize"in e&&"lineHeight"in e)return e.lineHeight*parseInt(e.fontSize,10)}var cw=12,uw=1.2,lw=40;function _d(e){var t=k({fontFamily:"Arial, sans-serif",fontSize:cw,fontWeight:"normal",lineHeight:uw},e&&e.defaultStyle||{}),n=parseInt(t.fontSize,10)-1,i=k({},t,{fontSize:n},e&&e.externalStyle||{}),r=new Ea({style:t});this.getExternalLabelBounds=function(a,s){var c={width:Math.max(a.width,Bi.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:ur});return{x:a.x,y:a.y,width:a.width,height:Math.max(lw,Math.round(c.height))}},this.getDimensions=function(a,s){return r.getDimensions(a,s||{})};function o(a,s,c){return r.getDimensions(a,k({box:s},c))}this.createText=function(a,s){return r.createText(a,s||{})},this.getDefaultStyle=function(){return t},this.getExternalStyle=function(){return i}}_d.$inject=["config.textRenderer"];function pw(){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=mw(i.d,{mx:r,my:o,e:a});return p}}var fw=/\{([^{}]+)\}/g,dw=/(?:(?:^|\.)(.+?)(?=\[|\.|$|\()|\[('|")(.+?)\2\])(\(\))?/g;function hw(e,t,n){var i=n;return t.replace(dw,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 mw(e,t){return String(e).replace(fw,function(n,i){return hw(n,i,t)})}const gw={__init__:["bpmnRenderer"],bpmnRenderer:["type",Ni],textRenderer:["type",_d],pathMap:["type",pw]};function vw(e,t){return t=t||{},e.replace(/{([^}]+)}/g,function(n,i){return t[i]||"{"+i+"}"})}const eo={translate:["value",vw]};function xa(e,t,n){return k({id:e.id,type:e.$type,businessObject:e,di:t},n)}function yw(e,t,n){var i=e.waypoint;return!i||i.length<2?[ce(t),ce(n)]:i.map(function(r){return{x:r.x,y:r.y}})}function bd(e,t,n){return new Error(`element ${xt(t)} referenced by ${xt(e)}#${n} not yet drawn`)}function Nn(e,t,n,i,r){this._eventBus=e,this._canvas=t,this._elementFactory=n,this._elementRegistry=i,this._textRenderer=r}Nn.$inject=["eventBus","canvas","elementFactory","elementRegistry","textRenderer"],Nn.prototype.add=function(e,t,n){var i,r,o;if(_(t,"bpmndi:BPMNPlane")){var a=_(e,"bpmn:SubProcess")?{id:e.id+"_plane"}:{};i=this._elementFactory.createRoot(xa(e,t,a)),this._canvas.addRootElement(i)}else if(_(t,"bpmndi:BPMNShape")){var s=!Ee(e,t),c=bw(e);r=n&&(n.hidden||n.collapsed);var u=t.bounds;i=this._elementFactory.createShape(xa(e,t,{collapsed:s,hidden:r,x:Math.round(u.x),y:Math.round(u.y),width:Math.round(u.width),height:Math.round(u.height),isFrame:c})),_(e,"bpmn:BoundaryEvent")&&this._attachBoundary(e,i),_(e,"bpmn:Lane")&&(o=0),_(e,"bpmn:DataStoreReference")&&(_w(n,ce(u))||(n=this._canvas.findRoot(n))),this._canvas.addShape(i,n,o)}else if(_(t,"bpmndi:BPMNEdge")){var l=this._getSource(e),p=this._getTarget(e);r=n&&(n.hidden||n.collapsed),i=this._elementFactory.createConnection(xa(e,t,{hidden:r,source:l,target:p,waypoints:yw(t,l,p)})),_(e,"bpmn:DataAssociation")&&(n=this._canvas.findRoot(n)),this._canvas.addConnection(i,n,o)}else throw new Error(`unknown di ${xt(t)} for element ${xt(e)}`);return ai(e)&&Ut(i)&&this.addLabel(e,t,i),this._eventBus.fire("bpmnElement.added",{element:i}),i},Nn.prototype._attachBoundary=function(e,t){var n=e.attachedToRef;if(!n)throw new Error(`missing ${xt(e)}#attachedToRef`);var i=this._elementRegistry.get(n.id),r=i&&i.attachers;if(!i)throw bd(e,n,"attachedToRef");t.host=i,r||(i.attachers=r=[]),r.indexOf(t)===-1&&r.push(t)},Nn.prototype.addLabel=function(e,t,n){var i,r,o;return i=Lx(t,n),r=Ut(n),r&&(i=this._textRenderer.getExternalLabelBounds(i,r)),o=this._elementFactory.createLabel(xa(e,t,{id:e.id+"_label",labelTarget:n,type:"label",hidden:n.hidden||!Ut(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)},Nn.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?bd(e,i,t+"Ref"):new Error(`${xt(e)}#${t} Ref not specified`)},Nn.prototype._getSource=function(e){return this._getConnectedElement(e,"source")},Nn.prototype._getTarget=function(e){return this._getConnectedElement(e,"target")},Nn.prototype._getElement=function(e){return this._elementRegistry.get(e.id)};function _w(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 bw(e){return _(e,"bpmn:Group")}const Ed={__depends__:[gw,{__depends__:[eo],bpmnImporter:["type",Nn]}]};function to(e){return{x:e.x+e.width/2,y:e.y+e.height/2}}function ln(e,t){return{x:e.x-t.x,y:e.y-t.y}}function Zc(e){return Math.log(e)/Math.log(10)}var Ew=1e3;function z(e){this._eventBus=e}z.$inject=["eventBus"];function xw(e,t){return function(n){return e.call(t||null,n.context,n.command,n)}}z.prototype.on=function(e,t,n,i,r,o){if((lt(t)||le(t))&&(o=r,r=i,i=n,n=t,t=null),lt(n)&&(o=r,r=i,i=n,n=Ew),ut(r)&&(o=r,r=!1),!lt(i))throw new Error("handlerFn must be a function");se(e)||(e=[e]);var a=this._eventBus;A(e,function(s){var c=["commandStack",s,t].filter(function(u){return u}).join(".");a.on(c,n,r?xw(i,o):i,o)})},z.prototype.canExecute=$n("canExecute"),z.prototype.preExecute=$n("preExecute"),z.prototype.preExecuted=$n("preExecuted"),z.prototype.execute=$n("execute"),z.prototype.executed=$n("executed"),z.prototype.postExecute=$n("postExecute"),z.prototype.postExecuted=$n("postExecuted"),z.prototype.revert=$n("revert"),z.prototype.reverted=$n("reverted");function $n(e){return function(n,i,r,o,a){(lt(n)||le(n))&&(a=o,o=r,r=i,i=n,n=null),this.on(n,e,i,r,o,a)}}var Qc=["top","bottom","left","right"],wa=10;function Jc(e,t){z.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(ya(r)&&!ke(r)){var o=Rw(r);o&&i(r,o)}}function i(r,o){var a=ce(r),s=r.label,c=ce(s);if(s.parent){var u=ne(r),l;switch(o){case"top":l={x:a.x,y:u.top-wa-s.height/2};break;case"left":l={x:u.left-wa-s.width/2,y:a.y};break;case"bottom":l={x:a.x,y:u.bottom+wa+s.height/2};break;case"right":l={x:u.right+wa+s.width/2,y:a.y};break}var p=ln(l,c);t.moveShape(s,p)}}}X(Jc,z),Jc.$inject=["eventBus","modeling"];function ww(e){var t=e.host,n=ce(e),i=ht(n,t),r;i.indexOf("-")>=0?r=i.split("-"):r=[i];var o=Qc.filter(function(a){return r.indexOf(a)===-1});return o}function Sw(e){var t=ce(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 xd(t,i)});return n}function Rw(e){var t=ce(e.label),n=ce(e),i=xd(n,t);if(Cw(i)){var r=Sw(e);if(e.host){var o=ww(e);r=r.concat(o)}var a=Qc.filter(function(s){return r.indexOf(s)===-1});return a.indexOf(i)!==-1?ht(e.label,e)!=="intersect"?void 0:i:a[0]}}function xd(e,t){return ht(t,e,5)}function Cw(e){return Qc.indexOf(e)!==-1}function eu(e){z.call(this,e),this.preExecute("shape.append",function(t){var n=t.source,i=t.shape;t.position||(_(i,"bpmn:TextAnnotation")?t.position={x:n.x+n.width/2+75,y:n.y-50-i.height/2}:t.position={x:n.x+n.width+80+i.width/2,y:n.y+n.height/2})},!0)}X(eu,z),eu.$inject=["eventBus"];var Pw=1500;function tu(e,t,n){e.invoke(z,this),this.preExecute("elements.delete",Pw,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=ye(r,u=>_(u,"bpmn:Participant")||_(u,"bpmn:SubProcess"));if(!o.length)return[];var a=n.getRootElement(),s=new Set(a.children.filter(u=>_(u,"bpmn:Artifact"))),c=new Set;return A(o,u=>{const l=new Set(Qi(rr(Array.from(s),Ke(u))));c=c.union(l),s=s.difference(l)}),Array.from(c)}}X(tu,z),tu.$inject=["injector","eventBus","canvas"];function nu(e,t){e.invoke(z,this),this.postExecute("shape.move",function(n){var i=n.newParent,r=n.shape,o=ye(r.incoming.concat(r.outgoing),function(a){return _(a,"bpmn:Association")});A(o,function(a){t.moveConnection(a,{x:0,y:0},i)})},!0)}X(nu,z),nu.$inject=["injector","modeling"];function pr(e,t){for(kt(t)&&(t=[t]);e=e.parent;)if(ve(e,t))return e;return null}function wd(e,t){var n=pr(e,"bpmn:Process");if(n)return!0;var i=["bpmn:Participant","bpmn:Lane"];if(n=pr(e,i),n)return pt(n);if(ve(e,i))return pt(e);var r;for(r=V(e);r&&!_(r,"bpmn:Process");r=r.$parent);if(!t)return!0;var o=t.find(function(a){var s=V(a);return s&&s.get("processRef")===r});return o?pt(o):!0}var Sd=500;function Sa(e,t){t.invoke(z,this),this._bpmnReplace=e;var n=this;this.postExecuted("elements.create",Sd,function(i){var r=i.elements;r=r.filter(function(o){var a=o.host;return Rd(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",Sd,function(i){var r=i.shapes,o=i.newHost;if(r.length===1){var a=r[0];Rd(a,o)&&(i.shapes=[n._replaceShape(a,o)])}},!0)}Sa.$inject=["bpmnReplace","injector"],X(Sa,z),Sa.prototype._replaceShape=function(e,t){var n=Aw(e),i={type:"bpmn:BoundaryEvent",host:t};return n&&(i.eventDefinitionType=n.$type),this._bpmnReplace.replaceElement(e,i,{layoutConnection:!1})};function Aw(e){var t=V(e),n=t.eventDefinitions;return n&&n[0]}function Rd(e,t){return!me(e)&&ve(e,["bpmn:IntermediateThrowEvent","bpmn:IntermediateCatchEvent"])&&!!t}function iu(e,t){z.call(this,e);function n(i){return ye(i.attachers,function(r){return _(r,"bpmn:BoundaryEvent")})}this.postExecute("connection.create",function(i){var r=i.context.source,o=i.context.target,a=n(o);_(r,"bpmn:EventBasedGateway")&&_(o,"bpmn:ReceiveTask")&&a.length>0&&t.removeElements(a)}),this.postExecute("connection.reconnect",function(i){var r=i.context.oldSource,o=i.context.newSource;_(r,"bpmn:Gateway")&&_(o,"bpmn:EventBasedGateway")&&A(o.outgoing,function(a){var s=a.target,c=n(s);_(s,"bpmn:ReceiveTask")&&c.length>0&&t.removeElements(c)})})}iu.$inject=["eventBus","modeling"],X(iu,z);function Cd(e){return e.create("bpmn:Category")}function Tw(e){return e.create("bpmn:CategoryValue")}function Pd(e,t){var n=t.get("categoryValueRef");return n||(n=t.categoryValueRef=Tw(e)),n.$parent||(n.$parent=Cd(e)),n}function Mw(e,t,n){return qe(t.get("categoryValue"),e),e.$parent=t,qe(n.get("rootElements"),t),t.$parent=n,e}function kw(e){var t=e.$parent;return t&&(Ue(t.get("categoryValue"),e),e.$parent=null),e}function Dw(e){var t=e.$parent;return t&&(Ue(t.get("rootElements"),e),e.$parent=null),e}var Ow=500;function ru(e,t,n){n.invoke(z,this);function i(c){return t.filter(function(u){return _(u,"bpmn:Group")&&!u.labelTarget}).map(V).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&&Mw(c,u,e.getDefinitions())}function s(c,u,l){u&&!o(u,l)&&Dw(u),c&&!r(c,l)&&kw(c)}this.executed(["shape.create","label.create"],function(c){var u=c.labelTarget||c.shape;!_(u,"bpmn:Group")||u.labelTarget||a(c.categoryValue,c.category)},!0),this.reverted(["shape.create","label.create"],function(c){var u=c.labelTarget||c.shape;!_(u,"bpmn:Group")||u.labelTarget||s(c.categoryValue,c.category,V(u))},!0),this.executed(["shape.move","shape.resize"],Ow,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,V(u))},!0),this.executed("group.updateRefs",function(c){Ad(c).forEach(function(u){a(u.categoryValue,u.category)})},!0),this.reverted("group.updateRefs",function(c){Ad(c).forEach(function(u){s(u.categoryValue,u.category,V(u.groupShape))})},!0),this.executed("shape.delete",function(c){var u=c.shape;!_(u,"bpmn:Group")||u.labelTarget||s(c.categoryValue,c.category,V(u))},!0),this.reverted("shape.delete",function(c){var u=c.shape;!_(u,"bpmn:Group")||u.labelTarget||a(c.categoryValue,c.category)},!0)}ru.$inject=["bpmnjs","elementRegistry","injector"],X(ru,z);function Ad(e){var t;return((t=e.updates)==null?void 0:t.groups)||[]}function ou(e,t,n){z.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(y){const S=y.source,w=y.target;fr(S)&&no(w)&&l(w)}function r(y){const S=y.connection,w=y.source,E=y.target;fr(w)&&Ra(E)&&(u(E),f(w,[S]))}function o(y){const S=y.newTarget,w=y.oldSource,E=y.oldTarget;if(E!==S){const x=w;no(E)&&l(E),fr(x)&&Ra(S)&&u(S)}}function a(y){const{element:S}=y;no(S)?(p(S),d(S)):Ra(S)&&h(S)}function s(y){const{newData:S,oldShape:w}=y;if(fr(y.oldShape)&&S.eventDefinitionType!=="bpmn:CompensateEventDefinition"||S.type!=="bpmn:BoundaryEvent"){const E=w.outgoing.find(({target:x})=>no(x));E&&E.target&&(y._connectionTarget=E.target)}else if(!fr(y.oldShape)&&S.eventDefinitionType==="bpmn:CompensateEventDefinition"&&S.type==="bpmn:BoundaryEvent"){const E=w.outgoing.find(({target:x})=>Ra(x));E&&E.target&&(y._connectionTarget=E.target),g(w)}}function c(y){const{_connectionTarget:S,newShape:w}=y;S&&t.connect(w,S)}function u(y){t.updateProperties(y,{isForCompensation:!0})}function l(y){t.updateProperties(y,{isForCompensation:void 0})}function p(y){for(const S of y.incoming)n.canConnect(S.source,y)||t.removeConnection(S);for(const S of y.outgoing)n.canConnect(y,S.target)||t.removeConnection(S)}function f(y,S){y.outgoing.filter(x=>_(x,"bpmn:Association")).filter(x=>no(x.target)&&!S.includes(x)).forEach(x=>t.removeConnection(x))}function d(y){const S=y.attachers.slice();S.length&&t.removeElements(S)}function h(y){const S=y.incoming.filter(w=>fr(w.source));t.removeElements(S)}function g(y){const S=y.outgoing.filter(w=>_(w,"bpmn:SequenceFlow"));t.removeElements(S)}}X(ou,z),ou.$inject=["eventBus","modeling","bpmnRules"];function no(e){const t=V(e);return t&&t.get("isForCompensation")}function fr(e){return e&&_(e,"bpmn:BoundaryEvent")&&cr(e,"bpmn:CompensateEventDefinition")}function Ra(e){return e&&_(e,"bpmn:Activity")&&!wt(e)}function au(e){e.invoke(z,this),this.preExecute("shape.create",1500,function(t){var n=t.context,i=n.parent,r=n.shape;_(i,"bpmn:Lane")&&!_(r,"bpmn:Lane")&&(n.parent=pr(i,"bpmn:Participant"))})}au.$inject=["injector"],X(au,z);function su(e,t){z.call(this,e),this.preExecute("shape.create",function(n){var a;var i=n.context,r=i.shape;if(_(r,"bpmn:DataObjectReference")&&r.type!=="label"){var o=t.create("bpmn:DataObject");o.isCollection=((a=r.businessObject.dataObjectRef)==null?void 0:a.isCollection)||!1,r.businessObject.dataObjectRef=o}})}su.$inject=["eventBus","bpmnFactory"],X(su,z);var cu=20,uu=20,Td=30,Ca=2e3;function lu(e,t,n){z.call(this,t),t.on(["create.start","shape.move.start"],Ca,function(r){var o=r.context,a=o.shape,s=e.getRootElement();if(!(!_(a,"bpmn:Participant")||!_(s,"bpmn:Process")||!s.children.length)){var c=s.children.filter(function(p){return!_(p,"bpmn:Group")&&!me(p)&&!ke(p)});if(c.length){var u=Ke(c),l=Iw(a,u);k(a,l),o.createConstraints=Lw(a,u)}}}),t.on("create.start",Ca,function(r){var o=r.context,a=o.shape,s=e.getRootElement(),c=e.getGraphics(s);function u(l){l.element=s,l.gfx=c}_(a,"bpmn:Participant")&&_(s,"bpmn:Process")&&(t.on("element.hover",Ca,u),t.once("create.cleanup",function(){t.off("element.hover",u)}))});function i(){var r=e.getRootElement();return _(r,"bpmn:Collaboration")?r:n.makeCollaboration()}this.preExecute("elements.create",Ca,function(r){var o=r.elements,a=r.parent,s=Bw(o),c;s&&_(a,"bpmn:Process")&&(r.parent=i(),c=r.hints=r.hints||{},c.participant=s,c.process=a,c.processRef=V(s).get("processRef"))},!0),this.preExecute("shape.create",function(r){var o=r.parent,a=r.shape;_(a,"bpmn:Participant")&&_(o,"bpmn:Process")&&(r.parent=i(),r.process=o,r.processRef=V(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)&&V(s).set("processRef",V(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)&&V(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)}lu.$inject=["canvas","eventBus","modeling"],X(lu,z);function Iw(e,t){t={width:t.width+cu*2+Td,height:t.height+uu*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 Lw(e,t){return t=ne(t),{bottom:t.top+e.height/2-uu,left:t.right-e.width/2+cu,top:t.bottom-e.height/2+uu,right:t.left+e.width/2-cu-Td}}function Bw(e){return Le(e,function(t){return _(t,"bpmn:Participant")})}var Md="__targetRef_placeholder";function pu(e,t){z.call(this,e),this.executed(["connection.create","connection.delete","connection.move","connection.reconnect"],kd(o)),this.reverted(["connection.create","connection.delete","connection.move","connection.reconnect"],kd(o));function n(a,s,c){var u=a.get("dataInputAssociations");return Le(u,function(l){return l!==c&&l.targetRef===s})}function i(a,s){var c=a.get("properties"),u=Le(c,function(l){return l.name===Md});return!u&&s&&(u=t.create("bpmn:Property",{name:Md}),qe(c,u)),u}function r(a,s){var c=i(a);c&&(n(a,c,s)||Ue(a.get("properties"),c))}function o(a){var s=a.context,c=s.connection,u=c.businessObject,l=c.target,p=l&&l.businessObject,f=s.newTarget,d=f&&f.businessObject,h=s.oldTarget||s.target,g=h&&h.businessObject,y=c.businessObject,S;g&&g!==p&&r(g,u),d&&d!==p&&r(d,u),p?(S=i(p,!0),y.targetRef=S):y.targetRef=null}}pu.$inject=["eventBus","bpmnFactory"],X(pu,z);function kd(e){return function(t){var n=t.context,i=n.connection;if(_(i,"bpmn:DataInputAssociation"))return e(t)}}function Pa(e){this._bpmnUpdater=e}Pa.$inject=["bpmnUpdater"],Pa.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),[]},Pa.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 fu(e,t,n,i){z.call(this,i),t.registerHandler("dataStore.updateContainment",Pa);function r(){return n.filter(function(s){return _(s,"bpmn:Participant")&&V(s).processRef})[0]}function o(s){return s.children.filter(function(c){return _(c,"bpmn:DataStoreReference")&&!c.labelTarget})}function a(s,c){var u=s.businessObject||s;if(c=c||r(),c){var l=c.businessObject||c;t.execute("dataStore.updateContainment",{dataStoreBo:u,dataStoreDi:Se(s),newSemanticParent:l.processRef||l,newDiParent:Se(c)})}}this.preExecute("shape.create",function(s){var c=s.context,u=c.shape;_(u,"bpmn:DataStoreReference")&&u.type!=="label"&&(c.hints||(c.hints={}),c.hints.autoResize=!1)}),this.preExecute("elements.move",function(s){var c=s.context,u=c.shapes,l=u.filter(function(p){return _(p,"bpmn:DataStoreReference")});l.length&&(c.hints||(c.hints={}),c.hints.autoResize=u.filter(function(p){return!_(p,"bpmn:DataStoreReference")}))}),this.postExecute("shape.create",function(s){var c=s.context,u=c.shape,l=u.parent;_(u,"bpmn:DataStoreReference")&&u.type!=="label"&&_(l,"bpmn:Collaboration")&&a(u)}),this.postExecute("shape.move",function(s){var c=s.context,u=c.shape,l=c.oldParent,p=u.parent;if(!_(l,"bpmn:Collaboration")&&_(u,"bpmn:DataStoreReference")&&u.type!=="label"&&_(p,"bpmn:Collaboration")){var f=_(l,"bpmn:Participant")?l:$w(l,"bpmn:Participant");a(u,f)}}),this.postExecute("shape.delete",function(s){var c=s.context,u=c.shape,l=e.getRootElement();ve(u,["bpmn:Participant","bpmn:SubProcess"])&&_(l,"bpmn:Collaboration")&&o(l).filter(function(p){return Nw(p,u)}).forEach(function(p){a(p)})}),this.postExecute("canvas.updateRoot",function(s){var c=s.context,u=c.oldRoot,l=c.newRoot,p=o(u);p.forEach(function(f){_(l,"bpmn:Process")&&a(f,l)})})}fu.$inject=["canvas","commandStack","elementRegistry","eventBus"],X(fu,z);function Nw(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 $w(e,t){for(;e.parent;){if(_(e.parent,t))return e.parent;e=e.parent}}var Aa=Math.max,Ta=Math.min,jw=20;function Dd(e,t){return{top:e.top-t.top,right:e.right-t.right,bottom:e.bottom-t.bottom,left:e.left-t.left}}function Fw(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 Hw(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 Ma(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)?Ta:Aa)(i,r)),le(o)&&(i=(/top|left/.test(e)?Aa:Ta)(i,o)),i}function zw(e,t){if(!t)return e;var n=ne(e);return fa({top:Ma("top",n,t),right:Ma("right",n,t),bottom:Ma("bottom",n,t),left:Ma("left",n,t)})}function Vw(e,t,n,i){var r=ne(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?ne(i):o,s={top:Ta(o.top,a.top),left:Ta(o.left,a.left),bottom:Aa(o.bottom,a.bottom),right:Aa(o.right,a.right)};return fa(s)}function io(e,t){return typeof e<"u"?e:jw}function Gw(e,t){var n,i,r,o;return typeof t=="object"?(n=io(t.left),i=io(t.right),r=io(t.top),o=io(t.bottom)):n=i=r=o=io(t),{x:e.x-n,y:e.y-r,width:e.width+n+i,height:e.height+r+o}}function Ww(e){return!(e.waypoints||e.type==="label")}function Od(e,t){var n;if(e.length===void 0?n=ye(e.children,Ww):n=e,n.length)return Gw(Ke(n),t)}var si=Math.abs;function Uw(e,t){return Dd(ne(t),ne(e))}var qw=["bpmn:Participant","bpmn:Process","bpmn:SubProcess"],Zt=30;function ka(e,t){return t=t||[],e.children.filter(function(n){_(n,"bpmn:Lane")&&(ka(n,t),t.push(n))}),t}function ci(e){return e.children.filter(function(t){return _(t,"bpmn:Lane")})}function Qt(e){return pr(e,qw)||e}function Yw(e,t){var n=Qt(e),i=_(n,"bpmn:Process")?[]:[n],r=ka(n,i),o=ne(e),a=ne(t),s=Uw(e,t),c=[],u=pt(e);return r.forEach(function(l){if(l!==e){var p=u?0:s.top,f=u?s.right:0,d=u?0:s.bottom,h=u?s.left:0,g=ne(l);s.top&&(si(g.bottom-o.top)<10&&(d=a.top-g.bottom),si(g.top-o.top)<5&&(p=a.top-g.top)),s.left&&(si(g.right-o.left)<10&&(f=a.left-g.right),si(g.left-o.left)<5&&(h=a.left-g.left)),s.bottom&&(si(g.top-o.bottom)<10&&(p=a.bottom-g.top),si(g.bottom-o.bottom)<5&&(d=a.bottom-g.bottom)),s.right&&(si(g.left-o.right)<10&&(h=a.right-g.left),si(g.right-o.right)<5&&(f=a.right-g.right)),(p||f||d||h)&&c.push({shape:l,newBounds:Hw(l,{top:p,right:f,bottom:d,left:h})})}}),c}var Kw=500;function du(e,t){z.call(this,e);function n(i,r){var o=pt(i),a=ci(r),s=[],c=[],u=[],l=[];if(Ii(a,function(y){return o?y.y>i.y?c.push(y):s.push(y):y.x>i.x?l.push(y):u.push(y),y.children}),!!a.length){var p;o?c.length&&s.length?p=i.height/2:p=i.height:l.length&&u.length?p=i.width/2:p=i.width;var f,d,h,g;s.length&&(f=t.calculateAdjustments(s,"y",p,i.y-10),t.makeSpace(f.movingShapes,f.resizingShapes,{x:0,y:p},"s")),c.length&&(d=t.calculateAdjustments(c,"y",-p,i.y+i.height+10),t.makeSpace(d.movingShapes,d.resizingShapes,{x:0,y:-p},"n")),u.length&&(h=t.calculateAdjustments(u,"x",p,i.x-10),t.makeSpace(h.movingShapes,h.resizingShapes,{x:p,y:0},"e")),l.length&&(g=t.calculateAdjustments(l,"x",-p,i.x+i.width+10),t.makeSpace(g.movingShapes,g.resizingShapes,{x:-p,y:0},"w"))}}this.postExecuted("shape.delete",Kw,function(i){var r=i.context,o=r.hints,a=r.shape,s=r.oldParent;_(a,"bpmn:Lane")&&(o&&o.nested||n(a,s))})}du.$inject=["eventBus","spaceTool"],X(du,z);var Id=500;function Da(e,t){t.invoke(z,this),this._bpmnReplace=e;var n=this;this.postExecuted("elements.create",Id,function(i){var r=i.elements;r.filter(function(o){var a=o.host;return Ld(o,a)}).map(function(o){return r.indexOf(o)}).forEach(function(o){i.elements[o]=n._replaceShape(r[o])})},!0),this.preExecute("elements.move",Id,function(i){var r=i.shapes,o=i.newHost;r.forEach(function(a,s){var c=a.host;Ld(a,Zw(r,c)?c:o)&&(r[s]=n._replaceShape(a))})},!0)}Da.$inject=["bpmnReplace","injector"],X(Da,z),Da.prototype._replaceShape=function(e){var t=Xw(e),n;return t?n={type:"bpmn:IntermediateCatchEvent",eventDefinitionType:t.$type}:n={type:"bpmn:IntermediateThrowEvent"},this._bpmnReplace.replaceElement(e,n,{layoutConnection:!1})};function Xw(e){var t=V(e),n=t.eventDefinitions;return n&&n[0]}function Ld(e,t){return!me(e)&&_(e,"bpmn:BoundaryEvent")&&!t}function Zw(e,t){return e.indexOf(t)!==-1}var Oa=Math.round,Qw=Math.max;function Jw(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 e1(e){var t=[];return e.forEach(function(n,i){t.push([i===0?"M":"L",n.x,n.y])}),t}var Bd=10;function t1(e,t){var n,i;for(n=0;i=e[n];n++)if(qr(i,t)<=Bd)return{point:e[n],bendpoint:!0,index:n};return null}function n1(e,t){var n=Hf(Jw(t,Bd),e1(e)),i=n[0],r=n[n.length-1],o;return i?i!==r?i.segment2!==r.segment2?(o=Qw(i.segment2,r.segment2)-1,{point:e[o],bendpoint:!0,index:o}):{point:{x:Oa(i.x+r.x)/2,y:Oa(i.y+r.y)/2},index:i.segment2}:{point:{x:Oa(i.x),y:Oa(i.y)},index:i.segment2}:null}function hu(e,t){return t1(e,t)||n1(e,t)}function mu(e,t,n){z.call(this,e);function i(r,o,a){var s=o.waypoints,c,u,l,p,f,d,h,g=r.outgoing.slice(),y=r.incoming.slice(),S;le(a.width)?S=ce(a):S=a;var w=hu(s,S);if(w){if(c=s.slice(0,w.index),u=s.slice(w.index+(w.bendpoint?1:0)),!c.length||!u.length)return;l=w.bendpoint?s[w.index]:S,(c.length===1||!Nd(r,c[c.length-1]))&&c.push($d(l)),(u.length===1||!Nd(r,u[0]))&&u.unshift($d(l))}p=o.source,f=o.target,t.canConnect(p,r,o)&&(n.reconnectEnd(o,r,c||S),d=o),t.canConnect(r,f,o)&&(d?h=n.connect(r,f,{type:o.type,waypoints:u}):(n.reconnectStart(o,r,u||S),h=o));var E=[].concat(d&&ye(y,function(x){return x.source===d.source})||[],h&&ye(g,function(x){return x.target===h.target})||[]);E.length&&n.removeElements(E)}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=ce(c),l={x:u.x+s.x,y:u.y+s.y},p=Le(o.children,function(f){var d=t.canInsert(a,f);return d&&hu(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)}X(mu,z),mu.$inject=["eventBus","bpmnRules","modeling"];function Nd(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 $d(e){return k({},e)}function gu(e,t){z.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)&&dr(r)){var c=[];_(o,"bpmn:EventBasedGateway")?c=a.incoming.filter(u=>u!==r&&dr(u)):c=a.incoming.filter(u=>u!==r&&dr(u)&&_(u.source,"bpmn:EventBasedGateway")),c.forEach(function(u){t.removeConnection(u)})}}),this.preExecuted("shape.replace",function(n){var i=n.context,r=i.newShape;if(_(r,"bpmn:EventBasedGateway")){var o=r.outgoing.filter(dr).reduce(function(a,s){return a.includes(s.target)?a:a.concat(s.target)},[]);o.forEach(function(a){a.incoming.filter(dr).forEach(function(s){const c=a.incoming.filter(dr).filter(function(u){return u.source===r});(s.source!==r||c.length>1)&&t.removeConnection(s)})})}})}gu.$inject=["eventBus","modeling"],X(gu,z);function dr(e){return _(e,"bpmn:SequenceFlow")}var Ia=1500,jd=2e3;function Fd(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"],Ia,function(i){var r=i.context,o=r.shape||i.shape,a=i.hover;_(a,"bpmn:Lane")&&!ve(o,["bpmn:Lane","bpmn:Participant"])&&(i.hover=Qt(a),i.hoverGfx=e.getGraphics(i.hover));var s=n.getRootElement();a&&a!==s&&(o.labelTarget||ve(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"],Ia,function(i){var r=i.hover;_(r,"bpmn:Lane")&&(i.hover=Qt(r)||r,i.hoverGfx=e.getGraphics(i.hover))}),t.on(["bendpoint.move.hover"],Ia,function(i){var r=i.context,o=i.hover,a=r.type;_(o,"bpmn:Lane")&&/reconnect/.test(a)&&(i.hover=Qt(o)||o,i.hoverGfx=e.getGraphics(i.hover))}),t.on(["connect.start"],Ia,function(i){var r=i.context,o=r.start;_(o,"bpmn:Lane")&&(r.start=Qt(o)||o)}),t.on("shape.move.start",jd,function(i){var r=i.shape;_(r,"bpmn:Lane")&&(i.shape=Qt(r)||r)}),t.on("spaceTool.move",jd,function(i){var r=i.hover;r&&_(r,"bpmn:Lane")&&(i.hover=Qt(r))})}Fd.$inject=["elementRegistry","eventBus","canvas"];var Hd=770;function vu(e,t,n,i){n.invoke(z,this);function r(s,c){var u=V(s),l=c.categoryValue||u.categoryValueRef;l||(l=Pd(e,u));var p=c.category||l.$parent||Cd(e);u.categoryValueRef=l,l.$parent=p,c.categoryValue=l,c.category=p}function o(s,c){var u=V(s),l=c.categoryValue||u.categoryValueRef,p=c.category||l&&l.$parent;l&&(c.categoryValue=l,c.category=p,u.categoryValueRef=null)}this.execute("label.create",function(s){var c=s.context,u=c.labelTarget;_(u,"bpmn:Group")&&r(u,c)}),this.revert("label.create",function(s){var c=s.context,u=c.labelTarget;_(u,"bpmn:Group")&&o(u,c)}),this.execute("shape.delete",function(s){var c=s.context,u=c.shape,l=V(u);if(!(!_(u,"bpmn:Group")||u.labelTarget)){var p=c.categoryValue=l.categoryValueRef;p&&(c.category=p.$parent,l.categoryValueRef=null)}}),this.reverted("shape.delete",function(s){var c=s.context,u=c.shape;if(!(!_(u,"bpmn:Group")||u.labelTarget)){var l=c.category,p=c.categoryValue,f=V(u);p&&(f.categoryValueRef=p,p.$parent=l)}}),this.execute("shape.create",function(s){var c=s.context,u=c.shape,l=c.hints||{};!_(u,"bpmn:Group")||u.labelTarget||l.createElementsBehavior===!1&&!V(u).categoryValueRef&&!c.categoryValue||r(u,c)}),this.reverted("shape.create",function(s){var c=s.context,u=c.shape,l=c.hints||{};!_(u,"bpmn:Group")||u.labelTarget||l.createElementsBehavior===!1&&!V(u).categoryValueRef&&!c.categoryValue||o(u,c)}),this.executed(["shape.move","shape.resize"],function(s){var c=s.context,u=c.shape;!_(u,"bpmn:Group")||u.labelTarget||V(u).categoryValueRef||r(u,c)}),this.reverted(["shape.move","shape.resize"],function(s){var c=s.context,u=c.shape;!_(u,"bpmn:Group")||u.labelTarget||!c.categoryValue||o(u,c)});function a(s,c){var u=e.create(s.$type);return i.copyElement(s,u,null,c)}t.on("copyPaste.copyElement",Hd,function(s){var c=s.descriptor,u=s.element;if(!(!_(u,"bpmn:Group")||u.labelTarget)){var l=V(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",Hd,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})}vu.$inject=["bpmnFactory","eventBus","injector","moddleCopy"],X(vu,z);function yu(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 zd(e){function t(i,r,o){var a={x:o.x,y:o.y-50},s={x:o.x-50,y:o.y},c=yu(i,r,o,a),u=yu(i,r,o,s),l;c&&u?Vd(c,o)>Vd(u,o)?l=u:l=c:l=c||u,i.original=l}function n(i){var r=i.waypoints;t(r[0],r[1],ce(i.source)),t(r[r.length-1],r[r.length-2],ce(i.target))}e.on("bpmnElement.added",function(i){var r=i.element;r.waypoints&&n(r)})}zd.$inject=["eventBus"];function Vd(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function _u(e){z.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=V(i),o=Se(i);if(ve(r,t)){var a=o.get("isHorizontal");a===void 0&&(a=!0),o.set("isHorizontal",a)}})}_u.$inject=["eventBus"],X(_u,z);function Gd(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}function Wd(e){return Math.atan((e[1].y-e[0].y)/(e[1].x-e[0].x))}function i1(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 r1(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 bu(e,t){var n=t[0],i=t[1],r={x:i.x-n.x,y:i.y-n.y},o=r1([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 Ud(e,t){var n=bu(e,t),i={x:n.x-e.x,y:n.y-e.y};return Gd(i)}function ro(e,t){return Gd({x:e.x-t.x,y:e.y-t.y})}var qd=Math.sqrt,Yd=Math.min,o1=Math.max,Kd=Math.abs;function Xd(e){return Math.pow(e,2)}function oo(e,t){return qd(Xd(e.x-t.x)+Xd(e.y-t.y))}function a1(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],Qd(i,r)?u=[i]:(o=oo(e,i),a=oo(e,r),c=Yd(o,a),u=s1(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:Qd(i,u[0])?n:n+1}),u.length===2&&(s=u1(u[0],u[1]),l={type:"segment",position:s,segmentIndex:n,relativeLocation:oo(i,s)/oo(i,r)}),p=oo(l.position,e),(!d||f>p)&&(d=l,f=p)}return d}function s1(e,t,n,i){var r=t.x-e.x,o=t.y-e.y,a=n.x-e.x,s=n.y-e.y,c=r*r+o*o,u=r*a+o*s,l=a*a+s*s-i*i,p=u/c,f=l/c,d=p*p-f;if(d<0&&d>-1e-6&&(d=0),d<0)return[];var h=qd(d),g=-p+h,y=-p-h,S={x:e.x-r*g,y:e.y-o*g};if(d===0)return[S];var w={x:e.x-r*y,y:e.y-o*y};return[S,w].filter(function(E){return c1(E,e,t)})}function c1(e,t,n){return Zd(e.x,t.x,n.x)&&Zd(e.y,t.y,n.y)}function Zd(e,t,n){return e>=Yd(t,n)-La&&e<=o1(t,n)+La}function u1(e,t){return{x:(e.x+t.x)/2,y:(e.y+t.y)/2}}var La=.1;function Qd(e,t){return Kd(e.x-t.x)<=La&&Kd(e.y-t.y)<=La}function l1(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=eh(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 Jd(e,t,n,i){var r=0,o=0,a={point:e,delta:{x:0,y:0}},s=a1(e,n),c=s.segmentIndex,u=l1(n,t,s,i);if(u<0||u>t.length-2||u===null)return a;var l=th(n,c),p=th(t,u),f=s.position,d=f1(l,f),h=p1(l,p);if(s.type==="bendpoint"){var g=t.length-n.length,y=s.bendpointIndex,S=n[y];if(t.indexOf(S)!==-1)return a;if(g===0){var w=t[y];return r=w.x-s.position.x,o=w.y-s.position.y,{delta:{x:r,y:o},point:{x:e.x+r,y:e.y+o}}}g<0&&y!==0&&y<n.length-1&&(d=eh(n,y))}var E={x:(p[1].x-p[0].x)*d+p[0].x,y:(p[1].y-p[0].y)*d+p[0].y},x=i1({x:e.x-f.x,y:e.y-f.y},h);return r=E.x+x.x-e.x,o=E.y+x.y-e.y,{point:Ln(E),delta:Ln({x:r,y:o})}}function eh(e,t){var n=ro(e[t-1],e[t]),i=ro(e[t],e[t+1]),r=n/(n+i);return r}function p1(e,t){var n=Wd(e),i=Wd(t);return i-n}function th(e,t){return[e[t],e[t+1]]}function f1(e,t){var n=ro(e[0],e[1]),i=ro(e[0],t);return n===0?0:i/n}function d1(e,t,n,i){var r=ce(e);return Jd(r,t,n,i).delta}function ao(e,t,n){var i=to(t),r=to(n),o=ln(e,i),a={x:o.x*(n.width/t.width),y:o.y*(n.height/t.height)};return Ln({x:r.x+a.x,y:r.y+a.y})}function nh(e,t,n){var i=to(e),r=to(t),o=to(n),a=ln(e,i),s=ln(i,r),c=h1(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 Ln({x:l.x+a.x-e.x,y:l.y+a.y-e.y})}function h1(e,t,n){var i=ne(t),r=ne(n);if(m1(i,r))return null;var o=ht(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=ht(n,s),c!==o?null:a}function m1(e,t){return g1(e,t)||v1(e,t)}function g1(e,t){return e.right!==t.right&&e.left!==t.left}function v1(e,t){return e.top!==t.top&&e.bottom!==t.bottom}var ih="name",rh="text";function Eu(e,t,n,i){z.call(this,e),this.postExecute("element.updateProperties",r),this.postExecute("element.updateModdleProperties",a=>{V(a.context.element)===a.context.moddleElement&&r(a)});function r(a){var s=a.context,c=s.element,u=s.properties;if(ih in u&&t.updateLabel(c,u[ih]),rh in u&&_(c,"bpmn:TextAnnotation")){var l=i.getTextAnnotationBounds({x:c.x,y:c.y,width:c.width,height:c.height},u[rh]||"");t.updateLabel(c,u.text,l)}}this.postExecute(["shape.create","connection.create"],function(a){var s=a.context,c=s.hints||{};if(c.createElementsBehavior!==!1){var u=s.shape||s.connection;me(u)||!ai(u)||Ut(u)&&t.updateLabel(u,Ut(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=k({},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),d1(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=V(c);l&&ai(l)&&u.label&&c.label&&(c.label.x=u.label.x,c.label.y=u.label.y)}),this.preExecute("shape.resize",function(a){var s=a.context,c=s.shape,u=s.hints||{};if(!(!me(c)||u.autoResize)){var l=s.newBounds,p=i.getDimensions(Ut(c)||"",{box:l,style:i.getExternalStyle()}),f=Math.ceil(p.height),d=l.y!==c.y,h=c.y+c.height;s.newBounds={width:l.width,height:f,x:l.x,y:d?h-f:l.y}}}),this.postExecute("shape.resize",function(a){var s=a.context,c=s.shape,u=s.newBounds,l=s.oldBounds;if(ya(c)){var p=c.label,f=ce(p),d=b1(l),h=_1(f,d),g=y1(h,l,u);t.moveShape(p,g)}})}X(Eu,z),Eu.$inject=["eventBus","modeling","bpmnFactory","textRenderer"];function y1(e,t,n){var i=ao(e,t,n);return Ln(ln(i,e))}function _1(e,t){if(t.length){var n=E1(e,t);return bu(e,n)}}function b1(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 E1(e,t){var n=t.map(function(r){return{line:r,distance:Ud(e,r)}}),i=dn(n,"distance");return i[0].line}function x1(e,t,n,i){return Jd(e,t,n,i).point}function xu(e,t){z.call(this,e);function n(i,r){var o=i.context,a=o.connection,s=k({},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),x1(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)})})}X(xu,z),xu.$inject=["eventBus","modeling"];function Ba(e,t,n){var i=$a(e),r=ah(i,t),o=i[0];return r.length?r[r.length-1]:ao(o.original||o,n,t)}function Na(e,t,n){var i=$a(e),r=ah(i,t),o=i[i.length-1];return r.length?r[0]:ao(o.original||o,n,t)}function wu(e,t,n){var i=$a(e),r=oh(t,n),o=i[0];return ao(o.original||o,r,t)}function Su(e,t,n){var i=$a(e),r=oh(t,n),o=i[i.length-1];return ao(o.original||o,r,t)}function oh(e,t){return{x:e.x-t.x,y:e.y-t.y,width:e.width,height:e.height}}function $a(e){var t=e.waypoints;if(!t.length)throw new Error("connection#"+e.id+": no waypoints");return t}function ah(e,t){var n=_t(e,S1);return ye(n,function(i){return w1(i,t)})}function w1(e,t){return ht(t,e,1)==="intersect"}function S1(e){return e.original||e}function Ru(e,t){z.call(this,e),this.postExecute("shape.replace",function(n){var i=n.oldShape,r=n.newShape;if(R1(i,r)){var o=C1(i);o.incoming.forEach(function(a){var s=Na(a,r,i);t.reconnectEnd(a,r,s)}),o.outgoing.forEach(function(a){var s=Ba(a,r,i);t.reconnectStart(a,r,s)})}},!0)}Ru.$inject=["eventBus","modeling"],X(Ru,z);function R1(e,t){return _(e,"bpmn:Participant")&&Ee(e)&&_(t,"bpmn:Participant")&&!Ee(t)}function C1(e){var t=Wr([e]),n=[],i=[];return t.forEach(function(r){r!==e&&(r.incoming.forEach(function(o){_(o,"bpmn:MessageFlow")&&n.push(o)}),r.outgoing.forEach(function(o){_(o,"bpmn:MessageFlow")&&i.push(o)}))},[]),{incoming:n,outgoing:i}}const P1=["bpmn:MessageEventDefinition","bpmn:TimerEventDefinition","bpmn:EscalationEventDefinition","bpmn:ConditionalEventDefinition","bpmn:SignalEventDefinition"];function sh(e){const t=V(e);if(!_(t,"bpmn:BoundaryEvent")&&!(_(t,"bpmn:StartEvent")&&wt(t.$parent)))return!1;const n=t.get("eventDefinitions");return!n||!n.length?!1:P1.some(i=>_(n[0],i))}function ch(e){return _(e,"bpmn:BoundaryEvent")?"cancelActivity":"isInterrupting"}function Cu(e,t){e.invoke(z,this),this.postExecuted("shape.replace",function(n){const i=n.context.oldShape,r=n.context.newShape,o=n.context.hints;if(!sh(r))return;const a=ch(r);if(o.targetElement&&o.targetElement[a]!==void 0)return;const c=V(i).get(a),u=V(r).get(a);c!==u&&t.updateProperties(r,{[a]:c})})}Cu.$inject=["injector","modeling"],X(Cu,z);function Pu(e,t){z.call(this,e),this.preExecute("shape.resize",function(n){var i=n.shape,r=Se(i),o=r&&r.get("label"),a=o&&o.get("bounds");a&&t.updateModdleProperties(i,o,{bounds:void 0})},!0)}X(Pu,z),Pu.$inject=["eventBus","modeling"];function Au(e,t,n){z.call(this,e),this.preExecute("shape.delete",function(i){var r=i.context.shape;if(!(r.incoming.length!==1||r.outgoing.length!==1)){var o=r.incoming[0],a=r.outgoing[0];if(!(!_(o,"bpmn:SequenceFlow")||!_(a,"bpmn:SequenceFlow"))&&t.canConnect(o.source,a.target,o)){var s=A1(o.waypoints,a.waypoints);n.reconnectEnd(o,a.target,s)}}})}X(Au,z),Au.$inject=["eventBus","bpmnRules","modeling"];function hr(e){return e.original||e}function A1(e,t){var n=yu(hr(e[e.length-2]),hr(e[e.length-1]),hr(t[1]),hr(t[0]));return n?[].concat(e.slice(0,e.length-1),[n],t.slice(1)):[hr(e[0]),hr(t[t.length-1])]}function Tu(e,t){z.call(this,e),this.preExecute("shape.delete",function(n){var i=n.shape,r=i.parent;_(i,"bpmn:Participant")&&(n.collaborationRoot=r)},!0),this.postExecute("shape.delete",function(n){var i=n.collaborationRoot;if(i&&!i.businessObject.participants.length){var r=t.makeProcess(),o=i.children.slice();t.moveElements(o,{x:0,y:0},r)}},!0)}Tu.$inject=["eventBus","modeling"],X(Tu,z);function Mu(e,t,n,i){z.call(this,e);var r=i.get("dragging",!1);function o(c){var u=c.source,l=c.target,p=c.parent;if(p){var f,d;_(c,"bpmn:SequenceFlow")&&(n.canConnectSequenceFlow(u,l)||(d=!0),n.canConnectMessageFlow(u,l)&&(f="bpmn:MessageFlow")),_(c,"bpmn:MessageFlow")&&(n.canConnectMessageFlow(u,l)||(d=!0),n.canConnectSequenceFlow(u,l)&&(f="bpmn:SequenceFlow")),d&&t.removeConnection(c),f&&t.connect(u,l,{type:f,waypoints:c.waypoints.slice()})}}function a(c){var u=c.context,l=u.connection,p=u.newSource||l.source,f=u.newTarget||l.target,d,h;d=n.canConnect(p,f),!(!d||d.type===l.type)&&(h=t.connect(p,f,{type:d.type,associationDirection:d.associationDirection,waypoints:l.waypoints.slice()}),l.parent&&t.removeConnection(l),u.connection=h,r&&s(l,h))}function s(c,u){var l=r.context(),p=l&&l.payload.previousSelection,f;!p||!p.length||(f=p.indexOf(c),f!==-1&&p.splice(f,1,u))}this.postExecuted("elements.move",function(c){var u=c.closure,l=u.allConnections;A(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=Le(p.outgoing,er({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})})}X(Mu,z),Mu.$inject=["eventBus","modeling","bpmnRules","injector"];function ja(e,t,n,i,r,o){i.invoke(z,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=Ot(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=[];A(s.closure.topLevel,function(f){wt(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})})}X(ja,z),ja.prototype._replaceElements=function(e,t){var n=this._elementRegistry,i=this._bpmnReplace,r=this._selection;A(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)},ja.$inject=["bpmnReplace","bpmnRules","elementRegistry","injector","modeling","selection"];var T1=1500,M1={width:140,height:120},ku={width:300,height:60},Du={width:60,height:300},Fa={width:300,height:150},Ha={width:150,height:300},uh={width:140,height:120},lh={width:100,height:40};function ph(e){e.on("resize.start",T1,function(t){var n=t.context,i=n.shape,r=n.direction,o=n.balanced;(_(i,"bpmn:Lane")||_(i,"bpmn:Participant"))&&(n.resizeConstraints=L1(i,r,o)),_(i,"bpmn:SubProcess")&&Ee(i)&&(n.minDimensions=uh),_(i,"bpmn:TextAnnotation")&&(n.minDimensions=lh)})}ph.$inject=["eventBus"];var ui=Math.abs,k1=Math.min,D1=Math.max;function fh(e,t,n,i){var r=e[t];e[t]=r===void 0?n:i(n,r)}function mr(e,t,n){return fh(e,t,n,k1)}function gr(e,t,n){return fh(e,t,n,D1)}var O1={top:20,left:50,right:20,bottom:20},I1={top:50,left:20,right:20,bottom:20};function L1(e,t,n){var i=Qt(e),r=!0,o=!0,a=ka(i,[i]),s=ne(e),c={},u={},l=pt(e),p=l?ku:Du;/n/.test(t)?u.top=s.bottom-p.height:/e/.test(t)?u.right=s.left+p.width:/s/.test(t)?u.bottom=s.top+p.height:/w/.test(t)&&(u.left=s.right-p.width),a.forEach(function(h){var g=ne(h);l?(g.top<s.top-10&&(r=!1),g.bottom>s.bottom+10&&(o=!1)):(g.left<s.left-10&&(r=!1),g.right>s.right+10&&(o=!1)),/n/.test(t)&&(n&&ui(s.top-g.bottom)<10&&gr(c,"top",g.top+p.height),ui(s.top-g.top)<5&&mr(u,"top",g.bottom-p.height)),/e/.test(t)&&(n&&ui(s.right-g.left)<10&&mr(c,"right",g.right-p.width),ui(s.right-g.right)<5&&gr(u,"right",g.left+p.width)),/s/.test(t)&&(n&&ui(s.bottom-g.top)<10&&mr(c,"bottom",g.bottom-p.height),ui(s.bottom-g.bottom)<5&&gr(u,"bottom",g.top+p.height)),/w/.test(t)&&(n&&ui(s.left-g.right)<10&&gr(c,"left",g.left+p.width),ui(s.left-g.left)<5&&mr(u,"left",g.right-p.width))});var f=i.children.filter(function(h){return!h.hidden&&!h.waypoints&&(_(h,"bpmn:FlowElement")||_(h,"bpmn:Artifact"))}),d=l?O1:I1;return f.forEach(function(h){var g=ne(h);/n/.test(t)&&(!l||r)&&mr(u,"top",g.top-d.top),/e/.test(t)&&(l||o)&&gr(u,"right",g.right+d.right),/s/.test(t)&&(!l||o)&&gr(u,"bottom",g.bottom+d.bottom),/w/.test(t)&&(l||r)&&mr(u,"left",g.left-d.left)}),{min:u,max:c}}function dh(e){!e||typeof e.stopPropagation!="function"||e.stopPropagation()}function vr(e){return e.originalEvent||e.srcEvent}function Ou(e){dh(e),dh(vr(e))}function $i(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 hh(){return/mac/i.test(navigator.platform)}function mh(e,t){return(vr(e)||e).button===t}function li(e){return mh(e,0)}function B1(e){return mh(e,1)}function so(e){var t=vr(e)||e;return li(e)?hh()?t.metaKey:t.ctrlKey:!1}function za(e){var t=vr(e)||e;return li(e)&&t.shiftKey}var gh=1001;function vh(e,t){e.on("resize.start",gh+500,function(n){var i=n.context,r=i.shape;(_(r,"bpmn:Lane")||_(r,"bpmn:Participant"))&&(i.balanced=!so(n))}),e.on("resize.end",gh,function(n){var i=n.context,r=i.shape,o=i.canExecute,a=i.newBounds;if(_(r,"bpmn:Lane")||_(r,"bpmn:Participant"))return o&&(a=Uf(a),t.resizeLane(r,a,i.balanced)),!1})}vh.$inject=["eventBus","modeling"];var N1=500;function Iu(e,t,n,i,r){n.invoke(z,this);function o(l){return ve(l,["bpmn:ReceiveTask","bpmn:SendTask"])||$1(l,["bpmn:ErrorEventDefinition","bpmn:EscalationEventDefinition","bpmn:MessageEventDefinition","bpmn:SignalEventDefinition"])}function a(l){var p=e.getDefinitions(),f=p.get("rootElements");return!!Le(f,er({id:l.id}))}function s(l){if(_(l,"bpmn:ErrorEventDefinition"))return"errorRef";if(_(l,"bpmn:EscalationEventDefinition"))return"escalationRef";if(_(l,"bpmn:MessageEventDefinition"))return"messageRef";if(_(l,"bpmn:SignalEventDefinition"))return"signalRef"}function c(l){if(ve(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(ve(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=V(p),d=c(f),h;d&&!a(d)&&(h=e.getDefinitions().get("rootElements"),qe(h,d),l.addedRootElement=d)}},!0),this.reverted(["shape.create","element.updateProperties","element.updateModdleProperties"],function(l){var p=l.addedRootElement;if(p){var f=e.getDefinitions().get("rootElements");Ue(f,p)}},!0),t.on("copyPaste.copyElement",function(l){var p=l.descriptor,f=l.element;if(!(f.labelTarget||!o(f))){var d=V(f),h=c(d);h&&(p.referencedRootElement=h)}}),t.on("copyPaste.pasteElement",N1,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)})}Iu.$inject=["bpmnjs","eventBus","injector","moddleCopy","bpmnFactory"],X(Iu,z);function $1(e,t){return se(t)||(t=[t]),Kn(t,function(n){return cr(e,n)})}var yh=Math.max;function _h(e){e.on("spaceTool.getMinDimensions",function(t){var n=t.shapes,i=t.axis,r=t.start,o={};return A(n,function(a){var s=a.id;_(a,"bpmn:Participant")&&(o[s]=F1(a,i,r)),_(a,"bpmn:Lane")&&(o[s]=pt(a)?ku:Du),_(a,"bpmn:SubProcess")&&Ee(a)&&(o[s]=uh),_(a,"bpmn:TextAnnotation")&&(o[s]=lh),_(a,"bpmn:Group")&&(o[s]=M1)}),o})}_h.$inject=["eventBus"];function j1(e){return e==="x"}function F1(e,t,n){var i=pt(e);if(!V1(e))return i?Fa:Ha;var r=j1(t),o={};return r?i?o=Fa:o={width:z1(e,n,r),height:Ha.height}:i?o={width:Fa.width,height:H1(e,n,r)}:o=Ha,o}function H1(e,t,n){var i;return i=G1(e,t,n),yh(Fa.height,i)}function z1(e,t,n){var i;return i=W1(e,t,n),yh(Ha.width,i)}function V1(e){return!!ci(e).length}function G1(e,t,n){var i=ci(e),r;return r=Lu(i,t,n),e.height-r.height+ku.height}function W1(e,t,n){var i=ci(e),r;return r=Lu(i,t,n),e.width-r.width+Du.width}function Lu(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=ci(r),o.length?Lu(o,t,n):r}var bh="_plane";function Eh(e){var t=e.id;return U1(t)}function Sn(e){var t=e.id;return _(e,"bpmn:SubProcess")?xh(t):t}function ji(e){return xh(e)}function Va(e){var t=Se(e);return _(t,"bpmndi:BPMNPlane")}function xh(e){return e+bh}function U1(e){return e.replace(new RegExp(bh+"$"),"")}var wh=400,q1=600,Sh={x:180,y:160};function jn(e,t,n,i,r,o,a){z.call(this,t),this._canvas=e,this._eventBus=t,this._modeling=n,this._elementFactory=i,this._bpmnFactory=r,this._bpmnjs=o,this._elementRegistry=a;var s=this;function c(p){return _(p,"bpmn:SubProcess")&&!Ee(p)}function u(p){var f=p.shape,d=p.newRootElement,h=V(f);d=s._addDiagram(d||h),p.newRootElement=e.addRootElement(d)}function l(p){var f=p.shape,d=V(f);s._removeDiagram(d);var h=p.newRootElement=a.get(Sn(d));e.removeRootElement(h)}this.executed("shape.create",function(p){var f=p.shape;c(f)&&u(p)},!0),this.postExecuted("elements.create",function(p){var f=p.elements;A(f,function(d){if(c(d)){var h=a.get(Sn(d));if(!(!h||!d.children||!d.children.length)){var g=Rh(d);s._showRecursively(g),s._moveChildrenToShape(g,h)}}})},!0),this.reverted("shape.create",function(p){var f=p.shape;c(f)&&l(p)},!0),this.preExecute("shape.delete",function(p){var f=p.shape;!_(f,"bpmn:SubProcess")||!Ee(f)||A(Zr([f]),d=>{n.removeShape(d.annotation)})},!0),this.preExecuted("shape.delete",function(p){var f=p.shape;if(c(f)){var d=a.get(Sn(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(Sn(f)))},!0),this.postExecuted("shape.replace",function(p){var f=p.newShape,d=p.oldRoot,h=e.findRoot(Sn(f));if(!(!d||!h)){var g=d.children;n.moveElements(g,{x:0,y:0},h)}},!0),this.executed("element.updateProperties",function(p){var f=p.element;if(_(f,"bpmn:SubProcess")){var d=p.properties,h=p.oldProperties,g=h.id,y=d.id;if(g!==y){if(Va(f)){a.updateId(f,ji(y)),a.updateId(g,y);return}var S=a.get(ji(g));S&&a.updateId(ji(g),ji(y))}}},!0),this.reverted("element.updateProperties",function(p){var f=p.element;if(_(f,"bpmn:SubProcess")){var d=p.properties,h=p.oldProperties,g=h.id,y=d.id;if(g!==y){if(Va(f)){a.updateId(f,ji(g)),a.updateId(y,g);return}var S=a.get(ji(y));S&&a.updateId(S,ji(g))}}},!0),t.on("element.changed",function(p){var f=p.element;if(Va(f)){var d=f,h=a.get(Eh(d));!h||h===d||t.fire("element.changed",{element:h})}}),this.executed("shape.toggleCollapse",wh,function(p){var f=p.shape;_(f,"bpmn:SubProcess")&&(Ee(f)?l(p):(u(p),s._showRecursively(f.children)))},!0),this.reverted("shape.toggleCollapse",wh,function(p){var f=p.shape;_(f,"bpmn:SubProcess")&&(Ee(f)?l(p):(u(p),s._showRecursively(f.children)))},!0),this.postExecuted("shape.toggleCollapse",q1,function(p){var f=p.shape;if(_(f,"bpmn:SubProcess")){var d=p.newRootElement;if(d)if(Ee(f))s._moveChildrenToShape(d.children.slice(),f),A(Zr(f.children),g=>{n.moveShape(g.annotation,{x:0,y:0},f.parent),A(g.associations,y=>{n.moveConnection(y,{x:0,y:0},f.parent)})});else{s._disconnectSharedAnnotations(f);var h=Rh(f);s._moveChildrenToShape(h,d)}}},!0),t.on("copyPaste.createTree",function(p){var f=p.element,d=p.children;if(c(f)){var h=Sn(f),g=a.get(h);g&&d.push.apply(d,g.children)}}),t.on("copyPaste.copyElement",function(p){var f=p.descriptor,d=p.element,h=p.elements,g=d.parent,y=_(Se(g),"bpmndi:BPMNPlane");if(y){var S=Eh(g),w=Le(h,function(E){return E.id===S});w&&(f.parent=w.id)}}),t.on("copyPaste.pasteElement",function(p){var f=p.descriptor;f.parent&&(c(f.parent)||f.parent.hidden)&&(f.hidden=!0)})}X(jn,z),jn.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=Ke(i),o;if(!t.x)o={x:Sh.x-r.x,y:Sh.y-r.y};else{var a=ce(t),s=ce(r);o={x:a.x-s.x,y:a.y-s.y}}n.moveElements(e,o,t,{autoResize:!1})}},jn.prototype._disconnectSharedAnnotations=function(e){var t=this._modeling,n=new Set(md(e).map(i=>i.annotation));n.size&&A(Zr(e.children),i=>{n.has(i.annotation)&&A(i.associations,r=>{t.removeConnection(r)})})},jn.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},jn.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},jn.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:Sn(e),type:e.$type,di:i,businessObject:e,collapsed:!0});return o},jn.prototype._removeDiagram=function(e){var t=this._bpmnjs,n=t.getDefinitions().diagrams,i=Le(n,function(r){return r.plane.bpmnElement.id===e.id});return n.splice(n.indexOf(i),1),i},jn.$inject=["canvas","eventBus","modeling","elementFactory","bpmnFactory","bpmnjs","elementRegistry"];function Y1(e){var t=[];return A(Zr(e),n=>{t.push(n.annotation),t.push.apply(t,n.associations)}),t}function Rh(e){return e.children.slice().concat(Y1(e.children)).concat(K1(e))}function K1(e){return Fc(e.children||[]).reduce(function(t,n){return n.label&&n.label.parent!==e&&t.push(n.label),t},[])}function Bu(e,t){e.invoke(z,this),this.postExecuted("shape.replace",function(n){var i=n.context.oldShape,r=n.context.newShape;if(!(!_(r,"bpmn:SubProcess")||_(r,"bpmn:AdHocSubProcess")||!(_(i,"bpmn:Task")||_(i,"bpmn:CallActivity"))||!Ee(r))){var o=X1(r);t.createShape({type:"bpmn:StartEvent"},o,r)}})}Bu.$inject=["injector","modeling"],X(Bu,z);function X1(e){return{x:e.x+e.width/6,y:e.y+e.height/2}}function Nu(e,t){z.call(this,e),this.preExecute("connection.create",function(n){const{target:i}=n;_(i,"bpmn:TextAnnotation")&&(n.parent=i.parent)},!0),this.preExecute(["shape.create","shape.resize","elements.move"],function(n){const i=n.shapes||[n.shape];i.length===1&&_(i[0],"bpmn:TextAnnotation")&&(n.hints=n.hints||{},n.hints.autoResize=!1)},!0),this.preExecute("shape.resize",function(n){var i=n.context,r=i.shape,o=i.hints||{};if(!(!_(r,"bpmn:TextAnnotation")||o.autoResize)){var a=i.newBounds,s=t.getTextAnnotationBounds(a,Ut(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}}})}X(Nu,z),Nu.$inject=["eventBus","textRenderer"];function $u(e,t){z.call(this,e),this.postExecuted("shape.toggleCollapse",1500,function(n){var i=n.shape;if(Ee(i))return;var r=Wr(i);r.forEach(function(a){var s=a.incoming.slice(),c=a.outgoing.slice();A(s,function(u){o(u,!0)}),A(c,function(u){o(u,!1)})});function o(a,s){r.indexOf(a.source)!==-1&&r.indexOf(a.target)!==-1||_(a,"bpmn:Association")&&(_(a.source,"bpmn:TextAnnotation")||_(a.target,"bpmn:TextAnnotation"))||(s?t.reconnectEnd(a,i,ce(i)):t.reconnectStart(a,i,ce(i)))}},!0)}X($u,z),$u.$inject=["eventBus","modeling"];var ju=500;function Fu(e,t,n){z.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=Z1(c).concat([a]),p=Od(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"],ju,function(a){var s=a.context,c=s.shape;_(c,"bpmn:SubProcess")&&(c.collapsed?Se(c).isExpanded=!1:(i(c.children),Se(c).isExpanded=!0))}),this.reverted(["shape.toggleCollapse"],ju,function(a){var s=a.context,c=s.shape;c.collapsed?Se(c).isExpanded=!1:Se(c).isExpanded=!0}),this.postExecuted(["shape.toggleCollapse"],ju,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"})})}X(Fu,z),Fu.$inject=["eventBus","elementFactory","modeling"];function Z1(e){return e.filter(function(t){return!t.hidden})}function Hu(e,t,n,i){t.invoke(z,this),this.preExecute("shape.delete",function(r){var o=r.context,a=o.shape,s=a.businessObject;me(a)||(_(a,"bpmn:Participant")&&Ee(a)&&n.ids.unclaim(s.processRef.id),i.unclaimId(s.id,s))}),this.preExecute("connection.delete",function(r){var o=r.context,a=o.connection,s=a.businessObject;i.unclaimId(s.id,s)}),this.preExecute("canvas.updateRoot",function(){var r=e.getRootElement(),o=r.businessObject;_(r,"bpmn:Collaboration")&&n.ids.unclaim(o.id)})}X(Hu,z),Hu.$inject=["canvas","injector","moddle","modeling"];function zu(e,t){z.call(this,e),this.preExecute("connection.delete",function(n){var i=n.context,r=i.connection,o=r.source;Q1(r,o)&&t.updateProperties(o,{default:null})})}X(zu,z),zu.$inject=["eventBus","modeling"];function Q1(e,t){if(!_(e,"bpmn:SequenceFlow"))return!1;var n=V(t),i=V(e);return n.get("default")===i}var J1=500,eS=5e3,Ch=["shape.create","shape.delete","shape.move","shape.resize"],Ph=[...Ch,"spaceTool","lane.add","lane.resize","lane.split","elements.create","elements.delete","elements.move"];function Vu(e,t){z.call(this,e);var n;function i(){return n=n||new tS,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(Ph,eS,function(){i()}),this.postExecuted(Ph,J1,function(){o()}),this.preExecute(Ch,function(a){var s=a.context,c=s.shape,u=r();!c||c.labelTarget||(_(c,"bpmn:Lane")&&u.addLane(c),_(c,"bpmn:FlowNode")&&u.addFlowNode(c))})}Vu.$inject=["eventBus","modeling"],X(Vu,z);function tS(){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 nS=500,iS=5e3,Ah=["connection.create","connection.delete","connection.layout","connection.move","connection.reconnect","connection.updateWaypoints","shape.create","shape.delete","shape.move","shape.resize"],Th=[...Ah,"elements.create","elements.delete","elements.move","label.create","spaceTool"];function Gu(e,t){z.call(this,e);var n;function i(){return n=n||new rS,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(Th,iS,function(){i()}),this.postExecuted(Th,nS,function(){o()}),this.preExecute(Ah,function(a){var s=a.context.connection||a.context.shape,c=r();!s||s.labelTarget||(_(s,"bpmn:FlowElement")&&c.addFlowElement(s),_(s,"bpmn:Group")&&c.addGroup(s))}),this.preExecute("label.create",function(a){var s=a.context.labelTarget;_(s,"bpmn:Group")&&r().addGroup(s)})}Gu.$inject=["eventBus","modeling"],X(Gu,z);function rS(){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 Wu(e,t){z.call(this,e),this.postExecuted("elements.create",function(n){const i=n.context,r=i.elements;for(const o of r)oS(o)&&!sS(o)&&t.updateProperties(o,{isForCompensation:void 0})})}X(Wu,z),Wu.$inject=["eventBus","modeling"];function oS(e){const t=V(e);return t&&t.isForCompensation}function aS(e){return e&&_(e,"bpmn:BoundaryEvent")&&cr(e,"bpmn:CompensateEventDefinition")}function sS(e){return e.incoming.filter(n=>aS(n.source)).length>0}const cS={__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",Jc],appendBehavior:["type",eu],associationBehavior:["type",nu],attachEventBehavior:["type",Sa],artifactBehavior:["type",tu],boundaryEventBehavior:["type",iu],categoryRootElementReferenceBehavior:["type",ru],compensateBoundaryEventBehaviour:["type",ou],createBehavior:["type",au],createDataObjectBehavior:["type",su],createParticipantBehavior:["type",lu],dataInputAssociationBehavior:["type",pu],dataStoreBehavior:["type",fu],deleteLaneBehavior:["type",du],detachEventBehavior:["type",Da],dropOnFlowBehavior:["type",mu],eventBasedGatewayBehavior:["type",gu],fixHoverBehavior:["type",Fd],groupBehavior:["type",vu],importDockingFix:["type",zd],isHorizontalFix:["type",_u],labelBehavior:["type",Eu],layoutConnectionBehavior:["type",xu],messageFlowBehavior:["type",Ru],nonInterruptingBehavior:["type",Cu],removeElementBehavior:["type",Au],removeEmbeddedLabelBoundsBehavior:["type",Pu],removeParticipantBehavior:["type",Tu],replaceConnectionBehavior:["type",Mu],replaceElementBehaviour:["type",ja],resizeBehavior:["type",ph],resizeLaneBehavior:["type",vh],rootElementReferenceBehavior:["type",Iu],spaceToolBehavior:["type",_h],subProcessPlaneBehavior:["type",jn],subProcessStartEventBehavior:["type",Bu],textAnnotationBehavior:["type",Nu],toggleCollapseConnectionBehaviour:["type",$u],toggleElementCollapseBehaviour:["type",Fu],unclaimIdBehavior:["type",Hu],unsetDefaultFlowBehavior:["type",zu],updateFlowNodeRefsBehavior:["type",Vu],updateCategoryValueRefsBehavior:["type",Gu],setCompensationActivityAfterPasteBehavior:["type",Wu]};function Uu(e){this._commandStack=e.get("commandStack",!1)}Uu.$inject=["injector"],Uu.prototype.allowed=function(e,t){var n=!0,i=this._commandStack;return i&&(n=i.canExecute(e,t)),n===void 0?!0:n};const Rn={__init__:["rules"],rules:["type",Uu]};function Jt(e){z.call(this,e),this.init()}Jt.$inject=["eventBus"],X(Jt,z),Jt.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)})},Jt.prototype.init=function(){};function Mh(e,t){var n=ht(e,t,-15);return n!=="intersect"?n:null}function gt(e){Jt.call(this,e)}X(gt,Jt),gt.$inject=["eventBus"],gt.prototype.init=function(){this.addRule("connection.start",function(e){var t=e.source;return uS(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 Wa(t,n)}finally{r&&(n.parent=null)}}),this.addRule("connection.reconnect",function(e){var t=e.connection,n=e.source,i=e.target;return Wa(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 Vh(t,n,i)}),this.addRule("elements.create",function(e){var t=e.elements,n=e.position,i=e.target;return ke(i)&&!Ua(t,i)?!1:Ai(t,function(r){return ke(r)?Wa(r.source,r.target,r):r.host?co(r,r.host,null,n):Xu(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 Nh(a)&&!n.includes(a.host)})?!1:co(n,t,null,i)||Hh(n,t,i)||zh(n,t)||Ua(n,t)}),this.addRule("shape.create",function(e){return Xu(e.shape,e.target,e.source,e.position)}),this.addRule("shape.attach",function(e){return co(e.shape,e.target,null,e.position)}),this.addRule("element.copy",function(e){var t=e.element,n=e.elements;return Yh(n,t)})},gt.prototype.canConnectMessageFlow=Uh,gt.prototype.canConnectSequenceFlow=qh,gt.prototype.canConnectDataAssociation=Zu,gt.prototype.canConnectAssociation=Gh,gt.prototype.canConnectCompensationAssociation=Wh,gt.prototype.canMove=zh,gt.prototype.canAttach=co,gt.prototype.canReplace=Hh,gt.prototype.canDrop=yr,gt.prototype.canInsert=Ua,gt.prototype.canCreate=Xu,gt.prototype.canConnect=Wa,gt.prototype.canResize=Vh,gt.prototype.canCopy=Yh;function uS(e){return qu(e)?null:ve(e,["bpmn:FlowNode","bpmn:InteractionNode","bpmn:DataObjectReference","bpmn:DataStoreReference","bpmn:Group","bpmn:TextAnnotation"])}function qu(e){return!e||me(e)}function kh(e){do{if(_(e,"bpmn:Process"))return V(e);if(_(e,"bpmn:Participant"))return V(e).processRef||V(e)}while(e=e.parent)}function Yu(e){return _(e,"bpmn:TextAnnotation")}function Ku(e){return _(e,"bpmn:Group")&&!e.labelTarget}function Dh(e){return _(e,"bpmn:BoundaryEvent")&&Cn(e,"bpmn:CompensateEventDefinition")}function Ga(e){return V(e).isForCompensation}function lS(e,t){var n=kh(e),i=kh(t);return n===i}function pS(e){return _(e,"bpmn:InteractionNode")&&!_(e,"bpmn:BoundaryEvent")&&(!_(e,"bpmn:Event")||_(e,"bpmn:ThrowEvent")&&Lh(e,"bpmn:MessageEventDefinition"))}function fS(e){return _(e,"bpmn:InteractionNode")&&!Ga(e)&&(!_(e,"bpmn:Event")||_(e,"bpmn:CatchEvent")&&Lh(e,"bpmn:MessageEventDefinition"))&&!(_(e,"bpmn:BoundaryEvent")&&!Cn(e,"bpmn:MessageEventDefinition"))}function Oh(e){for(var t=e;t=t.parent;){if(_(t,"bpmn:FlowElementsContainer"))return V(t);if(_(t,"bpmn:Participant"))return V(t).processRef}return null}function Ih(e,t){var n=Oh(e),i=Oh(t);return n===i}function Cn(e,t){var n=V(e);return!!Le(n.eventDefinitions||[],function(i){return _(i,t)})}function Lh(e,t){var n=V(e);return(n.eventDefinitions||[]).every(function(i){return _(i,t)})}function dS(e){return _(e,"bpmn:FlowNode")&&!_(e,"bpmn:EndEvent")&&!wt(e)&&!(_(e,"bpmn:IntermediateThrowEvent")&&Cn(e,"bpmn:LinkEventDefinition"))&&!Dh(e)&&!Ga(e)}function hS(e){return _(e,"bpmn:FlowNode")&&!_(e,"bpmn:StartEvent")&&!_(e,"bpmn:BoundaryEvent")&&!wt(e)&&!(_(e,"bpmn:IntermediateCatchEvent")&&Cn(e,"bpmn:LinkEventDefinition"))&&!Ga(e)}function mS(e){return _(e,"bpmn:ReceiveTask")||_(e,"bpmn:IntermediateCatchEvent")&&(Cn(e,"bpmn:MessageEventDefinition")||Cn(e,"bpmn:TimerEventDefinition")||Cn(e,"bpmn:ConditionalEventDefinition")||Cn(e,"bpmn:SignalEventDefinition"))}function gS(e){for(var t=[];e;)e=e.parent,e&&t.push(e);return t}function Bh(e,t){var n=gS(t);return n.indexOf(e)!==-1}function Wa(e,t,n){if(qu(e)||qu(t))return null;if(!_(n,"bpmn:DataAssociation")){if(Uh(e,t))return{type:"bpmn:MessageFlow"};if(qh(e,t))return{type:"bpmn:SequenceFlow"}}var i=Zu(e,t);return i||(Wh(e,t)?{type:"bpmn:Association",associationDirection:"One"}:Gh(e,t)?{type:"bpmn:Association",associationDirection:"None"}:!1)}function yr(e,t){return me(e)||Ku(e)?!0:_(t,"bpmn:Participant")&&!Ee(t)?!1:_(e,"bpmn:Participant")?_(t,"bpmn:Process")||_(t,"bpmn:Collaboration"):ve(e,["bpmn:DataInput","bpmn:DataOutput"])&&e.parent?t===e.parent:_(e,"bpmn:Lane")?_(t,"bpmn:Participant")||_(t,"bpmn:Lane"):_(e,"bpmn:BoundaryEvent")&&!vS(e)?!1:_(e,"bpmn:FlowElement")&&!_(e,"bpmn:DataStoreReference")?_(t,"bpmn:FlowElementsContainer")?Ee(t):ve(t,["bpmn:Participant","bpmn:Lane"]):_(e,"bpmn:DataStoreReference")&&_(t,"bpmn:Collaboration")?Kn(V(t).get("participants"),function(n){return!!n.get("processRef")}):ve(e,["bpmn:Artifact","bpmn:DataAssociation","bpmn:DataStoreReference"])?ve(t,["bpmn:Collaboration","bpmn:Lane","bpmn:Participant","bpmn:Process","bpmn:SubProcess"]):_(e,"bpmn:MessageFlow")?_(t,"bpmn:Collaboration")||e.source.parent==t||e.target.parent==t:!1}function vS(e){return V(e).cancelActivity&&($h(e)||jh(e))}function Nh(e){return!me(e)&&_(e,"bpmn:BoundaryEvent")}function yS(e){return _(e,"bpmn:Lane")}function _S(e){return Nh(e)||_(e,"bpmn:IntermediateThrowEvent")&&$h(e)?!0:_(e,"bpmn:IntermediateCatchEvent")&&jh(e)}function $h(e){var t=V(e);return t&&!(t.eventDefinitions&&t.eventDefinitions.length)}function jh(e){return Fh(e,["bpmn:MessageEventDefinition","bpmn:TimerEventDefinition","bpmn:SignalEventDefinition","bpmn:ConditionalEventDefinition"])}function Fh(e,t){return t.some(function(n){return Cn(e,n)})}function bS(e){return _(e,"bpmn:ReceiveTask")&&Le(e.incoming,function(t){return _(t.source,"bpmn:EventBasedGateway")})}function co(e,t,n,i){if(Array.isArray(e)||(e=[e]),e.length!==1)return!1;var r=e[0];return me(r)||!_S(r)||wt(t)||!_(t,"bpmn:Activity")||Ga(t)||i&&!Mh(i,t)||bS(t)?!1:"attach"}function Hh(e,t,n){if(!t)return!1;var i={replacements:[]};return A(e,function(r){wt(t)||_(r,"bpmn:StartEvent")&&r.type!=="label"&&yr(r,t)&&(Tx(r)||i.replacements.push({oldElementId:r.id,newElementType:"bpmn:StartEvent"}),(Mx(r)||kx(r)||Dx(r))&&i.replacements.push({oldElementId:r.id,newElementType:"bpmn:StartEvent"}),Fh(r,["bpmn:MessageEventDefinition","bpmn:TimerEventDefinition","bpmn:SignalEventDefinition","bpmn:ConditionalEventDefinition"])&&_(t,"bpmn:SubProcess")&&i.replacements.push({oldElementId:r.id,newElementType:"bpmn:StartEvent"})),_(t,"bpmn:Transaction")||Cn(r,"bpmn:CancelEventDefinition")&&r.type!=="label"&&(_(r,"bpmn:EndEvent")&&yr(r,t)&&i.replacements.push({oldElementId:r.id,newElementType:"bpmn:EndEvent"}),_(r,"bpmn:BoundaryEvent")&&co(r,t,null,n)&&i.replacements.push({oldElementId:r.id,newElementType:"bpmn:BoundaryEvent"}))}),i.replacements.length?i:!1}function zh(e,t){return Kn(e,yS)?!1:t===void 0?!0:t===null?!1:e.every(function(n){return yr(n,t)})}function Xu(e,t,n,i){return t?me(e)||Ku(e)?!0:yr(e,t)||Ua(e,t):!1}function Vh(e,t,n){return _(e,"bpmn:SubProcess")?Ee(e)&&(!t||t.width>=100&&t.height>=80):_(e,"bpmn:Lane")||_(e,"bpmn:Participant")?!0:Yu(e)?n?n==="e"||n==="w":!0:Ku(e)?!0:me(e)?n?n==="e"||n==="w":!0:!1}function ES(e,t){var n=Yu(e),i=Yu(t);return(n||i)&&n!==i}function Gh(e,t){return Bh(t,e)||Bh(e,t)?!1:ES(e,t)?!0:!!Zu(e,t)}function Wh(e,t){return Ih(e,t)&&Dh(e)&&_(t,"bpmn:Activity")&&!wS(t,e)&&!wt(t)}function Uh(e,t){return Xh(e)&&!Xh(t)?!1:pS(e)&&fS(t)&&!lS(e,t)}function qh(e,t){return dS(e)&&hS(t)&&Ih(e,t)&&!(_(e,"bpmn:EventBasedGateway")&&!mS(t))}function Zu(e,t){return ve(e,["bpmn:DataObjectReference","bpmn:DataStoreReference"])&&ve(t,["bpmn:Activity","bpmn:ThrowEvent"])?{type:"bpmn:DataInputAssociation"}:ve(t,["bpmn:DataObjectReference","bpmn:DataStoreReference"])&&ve(e,["bpmn:Activity","bpmn:CatchEvent"])?{type:"bpmn:DataOutputAssociation"}:!1}function Ua(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:ve(t,["bpmn:SequenceFlow","bpmn:MessageFlow"])&&!me(t)&&_(e,"bpmn:FlowNode")&&!_(e,"bpmn:BoundaryEvent")&&yr(e,t.parent)}function Qu(e,t){return e&&t&&e.indexOf(t)!==-1}function Yh(e,t){return me(t)?!0:!(_(t,"bpmn:Lane")&&!Qu(e,t.parent)||_(t,"bpmn:MessageFlow")&&!xS(e,t))}function xS(e,t){var n=Kh(t.source),i=Kh(t.target);return Qu(e,n)&&Qu(e,i)}function Kh(e){for(;e;e=e.parent)if(_(e,"bpmn:Participant"))return e;return null}function Xh(e){return pr(e,"bpmn:Process")||pr(e,"bpmn:Collaboration")}function wS(e,t){return e.attachers.includes(t)}const SS={__depends__:[Rn],__init__:["bpmnRules"],bpmnRules:["type",gt]};var RS=2e3;function Zh(e,t){e.on("saveXML.start",RS,n);function n(){var i=t.getRootElements();A(i,function(r){var o=Se(r),a,s;a=Wr([r]),a=ye(a,function(c){return c!==r&&!c.labelTarget}),s=_t(a,Se),o.set("planeElement",s)})}}Zh.$inject=["eventBus","canvas"];const CS={__init__:["bpmnDiOrdering"],bpmnDiOrdering:["type",Zh]};function qa(e){z.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)})}qa.prototype.getOrdering=function(e,t){return null},X(qa,z);function Ju(e,t){qa.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=Le(n,function(c){return ve(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&&!ve(u,c);)u=u.parent;if(!u)throw new Error(`no parent for <${a.id}> in <${s&&s.id}>`);return u}this.getOrdering=function(a,s){if(a.labelTarget||_(a,"bpmn:TextAnnotation"))return{parent:t.findRoot(s)||t.getRootElement(),index:-1};var c=r(a);c.containers&&(s=o(a,s,c.containers));var u=s.children.indexOf(a),l=Cp(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}}}Ju.$inject=["eventBus","canvas"],X(Ju,qa);const PS={__init__:["bpmnOrderingProvider"],bpmnOrderingProvider:["type",Ju]};function uo(){}uo.prototype.get=function(){return this._data},uo.prototype.set=function(e){this._data=e},uo.prototype.clear=function(){var e=this._data;return delete this._data,e},uo.prototype.isEmpty=function(){return!this._data};const AS={clipboard:["type",uo]};var Qh=1500;function Jh(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",Qh,function(s){o(s)})}),(function(){var a,s;t.on("element.hover",function(c){a=c.gfx,s=c.element}),t.on("element.hover",Qh,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=$i(a),c=document.elementFromPoint(s.x,s.y),TS(c)}}Jh.$inject=["elementRegistry","eventBus","injector"];function TS(e){return Di(e,"svg, .djs-element",!0)}const MS={__init__:["hoverFix"],hoverFix:["type",Jh]};function kS(e){return!0}function Ya(e){return li(e)||B1(e)}var em=500;function tm(e,t,n){var i=this;function r(P,j,$){if(!s(P,j)){var I,G,ie;$?G=t.getGraphics($):(I=j.delegateTarget||j.target,I&&(G=I,$=t.get(G))),!(!G||!$)&&(ie=e.fire(P,{element:$,gfx:G,originalEvent:j}),ie===!1&&(j.stopPropagation(),j.preventDefault()))}}var o={};function a(P){return o[P]}function s(P,j){var $=u[P]||li;return!$(j)}var c={click:"element.click",contextmenu:"element.contextmenu",dblclick:"element.dblclick",mousedown:"element.mousedown",mousemove:"element.mousemove",mouseover:"element.hover",mouseout:"element.out",mouseup:"element.mouseup"},u={"element.contextmenu":kS,"element.mousedown":Ya,"element.mouseup":Ya,"element.click":Ya,"element.dblclick":Ya};function l(P,j,$){var I=c[P];if(!I)throw new Error("unmapped DOM event name <"+P+">");return r(I,j,$)}var p="svg, .djs-element";function f(P,j,$,I){var G=o[$]=function(ie){r($,ie)};I&&(u[$]=I),G.$delegate=It.bind(P,p,j,G)}function d(P,j,$){var I=a($);I&&It.unbind(P,j,I.$delegate)}function h(P){A(c,function(j,$){f(P,$,j)})}function g(P){A(c,function(j,$){d(P,$,j)})}e.on("canvas.destroy",function(P){g(P.svg)}),e.on("canvas.init",function(P){h(P.svg)}),e.on(["shape.added","connection.added"],function(P){var j=P.element,$=P.gfx;e.fire("interactionEvents.createHit",{element:j,gfx:$})}),e.on(["shape.changed","connection.changed"],em,function(P){var j=P.element,$=P.gfx;e.fire("interactionEvents.updateHit",{element:j,gfx:$})}),e.on("interactionEvents.createHit",em,function(P){var j=P.element,$=P.gfx;i.createDefaultHit(j,$)}),e.on("interactionEvents.updateHit",function(P){var j=P.element,$=P.gfx;i.updateDefaultHit(j,$)});var y=R("djs-hit djs-hit-stroke"),S=R("djs-hit djs-hit-click-stroke"),w=R("djs-hit djs-hit-all"),E=R("djs-hit djs-hit-no-move"),x={all:w,"click-stroke":S,stroke:y,"no-move":E};function R(P,j){return j=k({stroke:"white",strokeWidth:15},j||{}),n.cls(P,["no-fill","no-border"],j)}function M(P,j){var $=x[j];if(!$)throw new Error("invalid hit type <"+j+">");return Z(P,$),P}function O(P,j){fe(P,j)}this.removeHits=function(P){var j=oa(".djs-hit",P);A(j,ot)},this.createDefaultHit=function(P,j){var $=P.waypoints,I=P.isFrame,G;return $?this.createWaypointsHit(j,$):(G=I?"stroke":"all",this.createBoxHit(j,G,{width:P.width,height:P.height}))},this.createWaypointsHit=function(P,j){var $=Gr(j);return M($,"stroke"),O(P,$),$},this.createBoxHit=function(P,j,$){$=k({x:0,y:0},$);var I=te("rect");return M(I,j),Z(I,$),O(P,I),I},this.updateDefaultHit=function(P,j){var $=Me(".djs-hit",j);if($)return P.waypoints?jc($,P.waypoints):Z($,{width:P.width,height:P.height}),$},this.fire=r,this.triggerMouseEvent=l,this.mouseHandler=a,this.registerEvent=f,this.unregisterEvent=d}tm.$inject=["eventBus","elementRegistry","styles"];const Ka={__init__:["interactionEvents"],interactionEvents:["type",tm]};function _r(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)})}_r.$inject=["eventBus","canvas"],_r.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()})}},_r.prototype.get=function(){return Array.from(this._selectedElements)},_r.prototype.isSelected=function(e){return this._selectedElements.has(e)},_r.prototype.select=function(e,t){var n=this.get();se(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?A(e,o=>{this._selectedElements.add(o)}):this._selectedElements=new Set(e),this._eventBus.fire("selection.changed",{oldSelection:n,newSelection:this.get()})};var nm="hover",im="selected";function rm(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,nm)}),t.on("element.out",function(r){i(r.element,nm)}),t.on("selection.changed",function(r){function o(u){i(u,im)}function a(u){n(u,im)}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)})}rm.$inject=["canvas","eventBus"];function om(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;se(u)?t.select(u):t.select(s.filter(DS))}}),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=Le(o,function(c){return a.id===c.id});s||t.select(a)}),e.on("element.click",function(r){if(li(r)){var o=r.element;o===n.getRootElement()&&(o=null);var a=t.isSelected(o),s=t.get().length>1,c=za(r);if(a&&s)return c?t.deselect(o):t.select(o);a?t.deselect(o):t.select(o,c)}})}om.$inject=["eventBus","selection","canvas","elementRegistry"];function DS(e){return!e.hidden}const en={__init__:["selectionVisuals","selectionBehavior"],__depends__:[Ka],selection:["type",_r],selectionVisuals:["type",rm],selectionBehavior:["type",om]};var OS=/^djs-cursor-.*$/;function Xa(e){var t=He(document.body);t.removeMatching(OS),e&&t.add("djs-cursor-"+e)}function am(){Xa(null)}var IS=5e3;function sm(e,t){t=t||"element.click";function n(){return!1}return e.once(t,IS,n),function(){e.off(t,n)}}var LS=["c","C"],BS=["v","V"],NS=["d","D"],$S=["x","X"],jS=["y","Y"],cm=["z","Z"];function FS(e){return e.ctrlKey||e.metaKey||e.shiftKey||e.altKey}function Nt(e){return e.altKey?!1:e.ctrlKey||e.metaKey}function at(e,t){return e=se(e)?e:[e],e.indexOf(t.key)!==-1||e.indexOf(t.code)!==-1}function el(e){return e.shiftKey}function HS(e){return Nt(e)&&at(LS,e)}function zS(e){return Nt(e)&&at(BS,e)}function VS(e){return Nt(e)&&at(NS,e)}function GS(e){return Nt(e)&&at($S,e)}function WS(e){return Nt(e)&&!el(e)&&at(cm,e)}function US(e){return Nt(e)&&(at(jS,e)||at(cm,e)&&el(e))}var br=Math.round,um="djs-drag-active";function Fi(e){e.preventDefault()}function qS(e){return typeof TouchEvent<"u"&&e instanceof TouchEvent}function YS(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}function lm(e,t,n,i){var r={threshold:5,trapClick:!0},o;function a(E){var x=t.viewbox(),R=t._container.getBoundingClientRect();return{x:x.x+(E.x-R.left)/x.scale,y:x.y+(E.y-R.top)/x.scale}}function s(E,x){x=x||o;var R=e.createEvent(k({},x.payload,x.data,{isTouch:x.isTouch}));return e.fire("drag."+E,R)===!1?!1:e.fire(x.prefix+"."+E,R)}function c(E){var x=E.filter(function(R){return i.get(R.id)});x.length&&n.select(x)}function u(E,x){var R=o.payload,M=o.displacement,O=o.globalStart,P=$i(E),j=ln(P,O),$=o.localStart,I=a(P),G=ln(I,$);if(!o.active&&(x||YS(j)>o.threshold)){if(k(R,{x:br($.x+M.x),y:br($.y+M.y),dx:0,dy:0},{originalEvent:E}),s("start")===!1)return y();o.active=!0,o.keepSelection||(R.previousSelection=n.get(),n.select(null)),o.cursor&&Xa(o.cursor),t.addMarker(t.getRootElement(),um)}Ou(E),o.active&&(k(R,{x:br(I.x+M.x),y:br(I.y+M.y),dx:br(G.x),dy:br(G.y)},{originalEvent:E}),s("move"))}function l(E){var x,R=!0;o.active&&(E&&(o.payload.originalEvent=E,Ou(E)),R=s("end")),R===!1&&s("rejected"),x=S(R!==!0),s("ended",x)}function p(E){at("Escape",E)&&(Fi(E),y())}function f(E){var x;o.active&&(x=sm(e),setTimeout(x,400),Fi(E)),l(E)}function d(E){u(E)}function h(E){var x=o.payload;x.hoverGfx=E.gfx,x.hover=E.element,s("hover")}function g(E){s("out");var x=o.payload;x.hoverGfx=null,x.hover=null}function y(E){var x;if(o){var R=o.active;R&&s("cancel"),x=S(E),R&&s("canceled",x)}}function S(E){var x,R;s("cleanup"),am(),o.trapClick?R=f:R=l,pe.unbind(document,"mousemove",u),pe.unbind(document,"dragstart",Fi),pe.unbind(document,"selectstart",Fi),pe.unbind(document,"mousedown",R,!0),pe.unbind(document,"mouseup",R,!0),pe.unbind(document,"keyup",p),pe.unbind(document,"touchstart",d,!0),pe.unbind(document,"touchcancel",y,!0),pe.unbind(document,"touchmove",u,!0),pe.unbind(document,"touchend",l,!0),e.off("element.hover",h),e.off("element.out",g),t.removeMarker(t.getRootElement(),um);var M=o.payload.previousSelection;return E!==!1&&M&&!n.get().length&&c(M),x=o,o=null,x}function w(E,x,R,M){o&&y(!1),typeof x=="string"&&(M=R,R=x,x=null),M=k({},r,M||{});var O=M.data||{},P,j,$,I,G;if(M.trapClick?I=f:I=l,E?(P=vr(E)||E,j=$i(E),Ou(E),P.type==="dragstart"&&Fi(P)):(P=null,j={x:0,y:0}),$=a(j),x||(x=$),G=qS(P),o=k({prefix:R,data:O,payload:{},globalStart:j,displacement:ln(x,$),localStart:$,isTouch:G},M),M.manual||(G?(pe.bind(document,"touchstart",d,!0),pe.bind(document,"touchcancel",y,!0),pe.bind(document,"touchmove",u,!0),pe.bind(document,"touchend",l,!0)):(pe.bind(document,"mousemove",u),pe.bind(document,"dragstart",Fi),pe.bind(document,"selectstart",Fi),pe.bind(document,"mousedown",I,!0),pe.bind(document,"mouseup",I,!0)),pe.bind(document,"keyup",p),e.on("element.hover",h),e.on("element.out",g)),s("init")===!1)return y(),!1;M.autoActivate&&u(E,!0)}e.on("diagram.destroy",y),this.init=w,this.move=u,this.hover=h,this.out=g,this.end=l,this.cancel=y,this.context=function(){return o},this.setOptions=function(E){k(r,E)}}lm.$inject=["eventBus","canvas","selection","elementRegistry"];const Fn={__depends__:[MS,en],dragging:["type",lm]};function Er(e){this._counter=0,this._prefix=(e?e+"-":"")+Math.floor(Math.random()*1e9)+"-"}Er.prototype.next=function(){return this._prefix+ ++this._counter};const KS=new Er("ps");var XS=["marker-start","marker-mid","marker-end"],ZS=["circle","ellipse","line","path","polygon","polyline","path","rect"];function pi(e,t,n,i){this._elementRegistry=e,this._canvas=n,this._styles=i}pi.$inject=["elementRegistry","eventBus","canvas","styles"],pi.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")},pi.prototype.getGfx=function(e){return this._elementRegistry.getGraphics(e)},pi.prototype.addDragger=function(e,t,n,i="djs-dragger"){n=n||this.getGfx(e);var r=wf(n);return this._cloneMarkers(Li(r),i),Z(r,this._styles.cls(i,[])),fe(t,r),Z(r,"data-preview-support-element-id",e.id),r},pi.prototype.addFrame=function(e,t){var n=te("rect",{class:"djs-resize-overlay",width:e.width,height:e.height,x:e.x,y:e.y});return fe(t,n),Z(n,"data-preview-support-element-id",e.id),n},pi.prototype._cloneMarkers=function(e,t="djs-dragger",n=e){var i=this;e.childNodes&&e.childNodes.forEach(r=>{i._cloneMarkers(r,t,n)}),tR(e)&&XS.forEach(function(r){if(Z(e,r)){var o=QS(e,r,i._canvas.getContainer());o&&i._cloneMarker(n,e,o,r,t)}})},pi.prototype._cloneMarker=function(e,t,n,i,r="djs-dragger"){var o=[n.id,r,KS.next()].join("-"),a=Me("marker#"+n.id,e);e=e||this._canvas._svg;var s=a||wf(n);s.id=o,xe(s).add(r);var c=Me(":scope > defs",e);c||(c=te("defs"),fe(e,c)),fe(c,s);var u=eR(s.id);Z(t,i,u)};function QS(e,t,n){var i=JS(Z(e,t));return Me("marker#"+i,n||document)}function JS(e){return e.match(/url\(['"]?#([^'"]*)['"]?\)/)[1]}function eR(e){return"url(#"+e+")"}function tR(e){return ZS.indexOf(e.nodeName)!==-1}const xr={__init__:["previewSupport"],previewSupport:["type",pi]};var nR="drop-ok",pm="drop-not-ok",fm="attach-ok",dm="new-parent",hm="create",iR=2e3;function mm(e,t,n,i,r){function o(c,u,l,p,f){if(!u)return!1;c=ye(c,function(w){var E=w.labelTarget;return!w.parent&&!(me(w)&&c.indexOf(E)!==-1)});var d=Le(c,function(w){return!ke(w)}),h=!1,g=!1,y=!1;vm(c)&&(h=r.allowed("shape.attach",{position:l,shape:d,target:u})),h||(vm(c)?y=r.allowed("shape.create",{position:l,shape:d,source:p,target:u}):y=r.allowed("elements.create",{elements:c,position:l,target:u}));var S=f.connectionTarget;return y||h?(d&&p&&(g=r.allowed("connection.create",{source:S===p?d:p,target:S===p?p:d,hints:{targetParent:u,targetAttach:h}})),{attach:h,connect:g}):y===null||h===null?null:!1}function a(c,u){[fm,nR,pm,dm].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}gm(c);var h={x:c.x,y:c.y},g=u.canExecute=p&&o(l,p,h,f,d);p&&g!==null&&(u.target=p,g&&g.attach?a(p,fm):a(p,g?dm:pm))}),n.on(["create.end","create.out","create.cleanup"],function(c){var u=c.hover;u&&a(u,null)}),n.on("create.end",function(c){var u=c.context,l=u.source,p=u.shape,f=u.elements,d=u.target,h=u.canExecute,g=h&&h.attach,y=h&&h.connect,S=u.hints||{};if(h===!1||!d)return!1;gm(c);var w={x:c.x,y:c.y};y?p=i.appendShape(l,p,w,d,{attach:g,connection:y===!0?{}:y,connectionTarget:S.connectionTarget}):(f=i.createElements(f,w,d,k({},S,{attach:g})),p=Le(f,function(E){return!ke(E)})),k(u,{elements:f,shape:p}),k(c,{elements:f,shape:p})});function s(){var c=t.context();c&&c.prefix===hm&&t.cancel()}n.on("create.init",function(){n.on("elements.changed",s),n.once(["create.cancel","create.end"],iR,function(){n.off("elements.changed",s)})}),this.start=function(c,u,l){se(u)||(u=[u]);var p=Le(u,function(h){return!ke(h)});if(p){l=k({elements:u,hints:{},shape:p},l||{}),A(u,function(h){le(h.x)||(h.x=0),le(h.y)||(h.y=0)});var f=ye(u,function(h){return!h.hidden}),d=Ke(f);A(u,function(h){ke(h)&&(h.waypoints=_t(h.waypoints,function(g){return{x:g.x-d.x-d.width/2,y:g.y-d.y-d.height/2}})),k(h,{x:h.x-d.x-d.width/2,y:h.y-d.y-d.height/2})}),t.init(c,hm,{cursor:"grabbing",autoActivate:!0,data:{shape:p,elements:u,context:l}})}}}mm.$inject=["canvas","dragging","eventBus","modeling","rules"];function gm(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 vm(e){return e&&e.length===1&&!ke(e[0])}var rR=750;function ym(e,t,n,i,r){function o(a){var s=te("g");Z(s,r.cls("djs-drag-group",["no-events"]));var c=te("g");return a.forEach(function(u){var l;u.hidden||(u.waypoints?(l=n._createContainer("connection",c),n.drawConnection(Li(l),u)):(l=n._createContainer("shape",c),n.drawShape(Li(l),u),mt(l,u.x,u.y)),i.addDragger(u,s,l))}),s}t.on("create.move",rR,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(),fe(p,l)),mt(l,a.x,a.y)):ot(l)}),t.on("create.cleanup",function(a){var s=a.context,c=s.dragGroup;c&&ot(c)})}ym.$inject=["canvas","eventBus","graphicsFactory","previewSupport","styles"];const Za={__depends__:[Fn,xr,Rn,en],__init__:["create","createPreview"],create:["type",mm],createPreview:["type",ym]};function tl(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)})}tl.$inject=["eventBus"],tl.prototype.getLastMoveEvent=function(){return this._lastMoveEvent||oR(0,0)};function oR(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 lo={__init__:["mouse"],mouse:["type",tl]};var _m=2e3;function $t(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),aR(l)&&(u.priority=2,u.host=l.host.id),ke(l)&&(u.priority=3,u.source=l.source.id,u.target=l.target.id,u.waypoints=sR(l)),me(l)&&(u.priority=4,u.labelTarget=l.labelTarget.id),A(["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",_m,function(c){var u;((u=c.hints)==null?void 0:u.clip)!==!1&&n.set(c.tree)}),r.on("copyPaste.pasteElements",_m,function(c){c.tree||(c.tree=n.get())}),r.on("copyPaste.pasteElements",function(c){var u=c.hints;k(u,{createElementsBehavior:!1})})}$t.$inject=["canvas","create","clipboard","elementFactory","eventBus","modeling","mouse","rules"],$t.prototype.copy=function(e,t={}){var n,i;return se(e)||(e=e?[e]:[]),n=this._eventBus.fire("copyPaste.canCopyElements",{elements:e}),n===!1?i={}:i=this.createTree(se(n)?n:e),this._eventBus.fire("copyPaste.elementsCopied",{elements:e,tree:i,hints:t}),i},$t.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})}}},$t.prototype.duplicate=function(e,t={}){var n=this.copy(e,{clip:!1});return this.paste({...t,tree:n})},$t.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},$t.prototype._getElementIdsFromTree=function(e){var t={};return A(e,function(n){A(n,function(i){i.id&&(t[i.id]=!0)})}),t},$t.prototype._paste=function(e,t,n,i){A(e,function(o){le(o.x)||(o.x=0),le(o.y)||(o.y=0)});var r=Ke(e);return A(e,function(o){ke(o)&&(o.waypoints=_t(o.waypoints,function(a){return{x:a.x-r.x-r.width/2,y:a.y-r.y-r.height/2}})),k(o,{x:o.x-r.x-r.width/2,y:o.y-r.y-r.height/2})}),this._modeling.createElements(e,n,t,k({},i))},$t.prototype._createElements=function(e){var t=this,n=this._eventBus,i={},r=[];return A(e,function(o,a){o=dn(o,"priority"),A(o,function(s){var c=k({},hn(s,["priority"]));i[s.parent]?c.parent=i[s.parent]:delete c.parent,n.fire("copyPaste.pasteElement",{cache:i,descriptor:c});var u;if(ke(c)){c.source=i[s.source],c.target=i[s.target],u=i[s.id]=t.createConnection(c),r.push(u);return}if(me(c)){c.labelTarget=i[c.labelTarget],u=i[s.id]=t.createLabel(c),r.push(u);return}c.host&&(c.host=i[c.host]),u=i[s.id]=t.createShape(c),r.push(u)})}),r},$t.prototype.createConnection=function(e){var t=this._elementFactory.createConnection(hn(e,["id"]));return t},$t.prototype.createLabel=function(e){var t=this._elementFactory.createLabel(hn(e,["id"]));return t},$t.prototype.createShape=function(e){var t=this._elementFactory.createShape(hn(e,["id"]));return t},$t.prototype.hasRelations=function(e,t,n){return n||(n=new Set(t)),!(ke(e)&&(!n.has(e.source)||!n.has(e.target))||me(e)&&!n.has(e.labelTarget))},$t.prototype.createTree=function(e){var t=this._rules,n=this,i={},r=[],o=new Map,a=ua(e);function s(p,f){return t.allowed("element.copy",{element:p,elements:f})}function c(p,f){var d=o.get(p);if(!d){var h={element:p,depth:f};r.push(h),o.set(p,h);return}if(d.depth<f){r=u(d,r);var g={element:d.element,depth:f};r.push(g),o.set(p,g)}}function u(p,f){var d=f.indexOf(p);return d!==-1&&f.splice(d,1),f}Ii(a,function(p,f,d){if(me(p))return;A(p.labels,function(y){c(y,d)});function h(y){y&&y.length&&A(y,function(S){A(S.labels,function(w){c(w,d)}),c(S,d)})}A([p.attachers,p.incoming,p.outgoing],h),c(p,d);var g=[];return p.children&&(g=p.children.slice()),n._eventBus.fire("copyPaste.createTree",{element:p,children:g}),g}),e=_t(r,function(p){return p.element});var l=new Set(e);return r=_t(r,function(p){return p.descriptor={},n._eventBus.fire("copyPaste.copyElement",{descriptor:p.descriptor,element:p.element,elements:e,elementsSet:l}),p}),r=dn(r,function(p){return p.descriptor.priority}),e=_t(r,function(p){return p.element}),A(r,function(p){var f=p.depth;if(!n.hasRelations(p.element,e,l)){Em(p.element,e),l.delete(p.element);return}if(!s(p.element,e)){Em(p.element,e),l.delete(p.element);return}i[f]||(i[f]=[]),i[f].push(p.descriptor)}),i};function aR(e){return!!e.host}function sR(e){return _t(e.waypoints,function(t){return t=bm(t),t.original&&(t.original=bm(t.original)),t})}function bm(e){return k({},e)}function Em(e,t){var n=t.indexOf(e);return n===-1?t:t.splice(n,1)}const cR={__depends__:[AS,Za,lo,Rn],__init__:["copyPaste"],copyPaste:["type",$t]};function nl(e,t,n){se(n)||(n=[n]),A(n,function(i){Pi(e[i])||(t[i]=e[i])})}var il=750;function xm(e,t,n){function i(c,u){var l=e.create(c.$type);return n.copyElement(c,l,null,u)}t.on("copyPaste.copyElement",il,function(c){var u=c.descriptor,l=c.element,p=V(l);if(me(l))return u;var f=u.businessObject=i(p,!0),d=u.di=i(Se(l),!0);d.bpmnElement=f,nl(f,u,"name"),nl(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=V(c);return c.default&&(l[c.default]={element:p,property:"default"}),c.host&&(V(c).attachedToRef=V(u[c.host])),hn(l,Ot(l,function(f,d,h){var g=d.element,y=d.property;return h===c.id&&(g.set(y,p),f.push(c.id)),f},[]))}t.on("copyPaste.pasteElement",function(c){var u=c.cache,l=c.descriptor,p=l.businessObject,f=l.di;if(me(l)){l.businessObject=V(u[l.labelTarget]),l.di=Se(u[l.labelTarget]);return}p=l.businessObject=i(p),f=l.di=i(f),f.bpmnElement=p,nl(l,p,["isExpanded","name"]),l.type=p.$type}),t.on("copyPaste.copyElement",il,function(c){var u=c.descriptor,l=c.element;if(_(l,"bpmn:Participant")){var p=V(l);p.processRef&&(u.processRef=i(p.processRef,!0))}}),t.on("copyPaste.pasteElement",function(c){var u=c.descriptor,l=u.processRef;l&&(u.processRef=i(l))}),t.on("copyPaste.createTree",function(c){var u=c.element,l=c.children;_(u,"bpmn:SubProcess")&&A(Zr(l),p=>{l.push(p.annotation)})}),t.on("copyPaste.pasteElement",il,function(c){var u=c.cache,l=c.descriptor;a(u,s(l,u,o(u)))})}xm.$inject=["bpmnFactory","eventBus","moddleCopy"];const uR=["artifacts","dataInputAssociations","dataOutputAssociations","default","flowElements","lanes","incoming","outgoing","categoryValue"],lR=["errorRef","escalationRef","messageRef","signalRef","dataObjectRef"];function po(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 dn(r,o=>o==="extensionElements")}),e.on("moddleCopy.canCopyProperty",i=>{const{parent:r,property:o,propertyName:a}=i,s=ut(r)&&r.$descriptor;if(a&&lR.includes(a))return o;if(a&&uR.includes(a)||a&&s&&!Le(s.properties,er({name:a})))return!1}),e.on("moddleCopy.canSetCopiedProperty",i=>{const{property:r}=i;if(_(r,"bpmn:ExtensionElements")&&(!r.values||!r.values.length))return!1})}po.$inject=["eventBus","bpmnFactory","moddle"],po.prototype.copyElement=function(e,t,n,i=!1){n&&!se(n)&&(n=[n]),n=n||rl(e.$descriptor);const r=this._eventBus.fire("moddleCopy.canCopyProperties",{propertyNames:n,sourceElement:e,targetElement:t,clone:i});return r===!1||(se(r)&&(n=r),A(n,o=>{let a;Dt(e,o)&&(a=e.get(o));const s=this.copyProperty(a,t,o,i);!it(s)||this._eventBus.fire("moddleCopy.canSetCopiedProperty",{parent:t,property:s,propertyName:o})===!1||t.set(o,s)})),t},po.prototype.copyProperty=function(e,t,n,i=!1){let r=this._eventBus.fire("moddleCopy.canCopyProperty",{parent:t,property:e,propertyName:n,clone:i});if(r===!1)return;if(r)return ut(r)&&r.$type&&!r.$parent&&(r.$parent=t),r;const o=this._moddle.getPropertyDescriptor(t,n);if(!o.isReference)return o.isId?e&&this._copyId(e,t,i):se(e)?Ot(e,(a,s)=>{const c=this.copyProperty(s,t,n,i);return c?a.concat(c):a},[]):ut(e)&&e.$type?this._moddle.getElementDescriptor(e).isGeneric?void 0:(r=this._bpmnFactory.create(e.$type),r.$parent=t,r=this.copyElement(e,r,null,i),r):e},po.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 rl(e,t){return Ot(e.properties,(n,i)=>t&&i.default?n:n.concat(i.name),[])}const wm={__depends__:[cR],__init__:["bpmnCopyPaste","moddleCopy"],bpmnCopyPaste:["type",xm],moddleCopy:["type",po]};var Sm=Math.round;function ol(e,t){this._modeling=e,this._eventBus=t}ol.$inject=["modeling","eventBus"],ol.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=Sm(s+o/2),l=Sm(c+a/2),p=i.replaceShape(e,k({},t,{x:u,y:l,width:o,height:a}),n);return r.fire("replace.end",{element:e,newElement:p,hints:n}),p};function Rm(e,t){t.on("replace.end",500,function(n){const{newElement:i,hints:r={}}=n;r.select!==!1&&e.select(i)})}Rm.$inject=["selection","eventBus"];const pR={__init__:["replace","replaceSelectionBehavior"],replaceSelectionBehavior:["type",Rm],replace:["type",ol]};function fR(e,t,n){se(n)||(n=[n]),A(n,function(i){Pi(e[i])||(t[i]=e[i])})}var dR=["cancelActivity","instantiate","eventGatewayType","triggeredByEvent","isInterrupting"];function hR(e,t){var n=e&&Dt(e,"collapsed")?e.collapsed:!Ee(e),i;return t&&(Dt(t,"collapsed")||Dt(t,"isExpanded"))?i=Dt(t,"collapsed")?t.collapsed:!t.isExpanded:i=n,n!==i}function Cm(e,t,n,i,r,o){function a(s,c,u){u=u||{};var l=c.type,p=s.businessObject;if(Qa(p)&&(l==="bpmn:SubProcess"||l==="bpmn:AdHocSubProcess")&&hR(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),fR(s.di,d.di,["fill","stroke","background-color","border-color","color"]);var h=rl(p.$descriptor),g=rl(f.$descriptor,!0),y=mR(h,g);k(f,cn(c,dR));var S=ye(y,function(x){return x==="eventDefinitions"?Pm(s,c.eventDefinitionType):x==="loopCharacteristics"?!wt(f):Dt(f,x)||x==="processRef"&&c.isExpanded===!1||x==="triggeredByEvent"?!1:x==="isForCompensation"?!wt(f):!0});if(f=n.copyElement(p,f,S),c.eventDefinitionType&&(Pm(f,c.eventDefinitionType)||(d.eventDefinitionType=c.eventDefinitionType,d.eventDefinitionAttrs=c.eventDefinitionAttrs)),_(p,"bpmn:Activity")){if(Qa(p))d.isExpanded=Ee(s);else if(c&&Dt(c,"isExpanded")){d.isExpanded=c.isExpanded;var w=t.getDefaultSize(f,{isExpanded:d.isExpanded});d.width=w.width,d.height=w.height,d.x=s.x-(d.width-s.width)/2,d.y=s.y-(d.height-s.height)/2}Ee(s)&&!_(p,"bpmn:Task")&&d.isExpanded&&(d.width=s.width,d.height=s.height)}if(Qa(p)&&!Qa(f)&&(u.moveChildren=!1),_(p,"bpmn:Participant")){c.isExpanded===!0?f.processRef=e.create("bpmn:Process"):u.moveChildren=!1;var E=pt(s);Se(s).isHorizontal||(Se(d).isHorizontal=E),d.width=E?s.width:t.getDefaultSize(d).width,d.height=E?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,ve(p,["bpmn:ExclusiveGateway","bpmn:InclusiveGateway","bpmn:Activity"])&&ve(f,["bpmn:ExclusiveGateway","bpmn:InclusiveGateway","bpmn:Activity"])&&(f.default=p.default),c.host&&!_(p,"bpmn:BoundaryEvent")&&_(f,"bpmn:BoundaryEvent")&&(d.host=c.host),(d.type==="bpmn:DataStoreReference"||d.type==="bpmn:DataObjectReference")&&(d.x=s.x+(s.width-d.width)/2),r.replaceElement(s,d,{...u,targetElement:c})}this.replaceElement=a}Cm.$inject=["bpmnFactory","elementFactory","moddleCopy","modeling","replace","rules"];function Qa(e){return _(e,"bpmn:SubProcess")}function Pm(e,t){var n=V(e);return t&&n.get("eventDefinitions").some(function(i){return _(i,t)})}function mR(e,t){return e.filter(function(n){return t.includes(n)})}const Am={__depends__:[wm,pR,en],bpmnReplace:["type",Cm]};var gR=250;function Hi(e){this._eventBus=e,this._tools=[],this._active=null}Hi.$inject=["eventBus"],Hi.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)},Hi.prototype.isActive=function(e){return e&&this._active===e},Hi.prototype.length=function(e){return this._tools.length},Hi.prototype.setActive=function(e){var t=this._eventBus;this._active!==e&&(this._active=e,t.fire("tool-manager.update",{tool:e}))},Hi.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),A(t,function(r){i.push(r+".ended"),i.push(r+".canceled")}),n.on(i,gR,function(r){this._active&&(vR(r)||this.setActive(null))},this)};function vR(e){var t=e.originalEvent&&e.originalEvent.target;return t&&Di(t,'.group[data-group="tools"]')}const Ja={__depends__:[Fn],__init__:["toolManager"],toolManager:["type",Hi]};function yR(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 _R(e,t){var n=[],i=new Set(e);A(t,function(o){i.add(o)});var r=new Set;return i.forEach(function(o){var a=o.incoming,s=o.outgoing;A(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 bR(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 al=Math.abs,ER=Math.round,Hn={x:"width",y:"height"},Tm="crosshair",fi={n:"top",w:"left",s:"bottom",e:"right"},xR=1500,es={n:"s",w:"e",s:"n",e:"w"},ts=20;function tn(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",xR,function(c){var u=c.context,l=u.initialized;l||(l=u.initialized=s.init(c,u)),l&&km(c)}),n.on("spaceTool.end",function(c){var u=c.context,l=u.axis,p=u.direction,f=u.movingShapes,d=u.resizingShapes,h=u.start;if(u.initialized){km(c);var g={x:0,y:0};g[l]=ER(c["d"+l]),s.makeSpace(f,d,g,p,h),n.once("spaceTool.ended",function(y){s.activateSelection(y.originalEvent,!0,!0)})}})}tn.$inject=["canvas","dragging","eventBus","modeling","rules","toolManager","mouse"],tn.prototype.activateSelection=function(e,t,n){this._dragging.init(e,"spaceTool.selection",{autoActivate:t,cursor:Tm,data:{context:{reactivate:n}},trapClick:!1})},tn.prototype.activateMakeSpace=function(e){this._dragging.init(e,"spaceTool",{autoActivate:!0,cursor:Tm,data:{context:{}}})},tn.prototype.makeSpace=function(e,t,n,i,r){return this._modeling.createSpace(e,t,n,i,r)},tn.prototype.init=function(e,t){var n=al(e.dx)>al(e.dy)?"x":"y",i=e["d"+n],r=e[n]-i;if(al(i)<5)return!1;i<0&&(i*=-1),so(e)&&(i*=-1);var o=yR(n,i),a=this._canvas.getRootElement();!za(e)&&e.hover&&(a=e.hover);var s=[...Wr(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=wR(c,n,o,r,u);return k(t,c,{axis:n,direction:o,spaceToolConstraints:l,start:r}),Xa("resize-"+(n==="x"?"ew":"ns")),!0},tn.prototype.calculateAdjustments=function(e,t,n,i){var r=this._rules,o=[],a=[],s=new Set,c=new Set,u=[],l=[];function p(d){s.has(d)||(s.add(d),o.push(d));var h=d.label;h&&!s.has(h)&&(s.add(h),o.push(h))}function f(d){c.has(d)||(c.add(d),a.push(d))}return A(e,function(d){if(!(!d.parent||me(d))){if(ke(d)){l.push(d);return}var h=d[t],g=h+d[Hn[t]];if(SR(d)&&(n>0&&ce(d)[t]>i||n<0&&ce(d)[t]<i)){u.push(d);return}if(n>0&&h>i||n<0&&g<i){p(d);return}if(h<i&&g>i&&r.allowed("shape.resize",{shape:d})){f(d);return}}}),A(o,function(d){var h=d.attachers;h&&A(h,function(g){p(g)})}),A(u,function(d){var h=d.host;(s.has(h)||c.has(h))&&p(d)}),A(l,function(d){var h=d.source,g=d.target,y=d.label;(s.has(h)||c.has(h))&&(s.has(g)||c.has(g))&&y&&p(y)}),{movingShapes:o,resizingShapes:a}},tn.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateSelection(e,!!e)},tn.prototype.isActive=function(){var e=this._dragging.context();return e?/^spaceTool/.test(e.prefix):!1};function Mm(e){return{top:e.top-ts,right:e.right+ts,bottom:e.bottom+ts,left:e.left-ts}}function km(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 wR(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 A(a,function(f){var d=f.attachers,h=f.children,g=ne(f),y=ye(h,function(G){return!ke(G)&&!me(G)&&!l.has(G)&&!p.has(G)}),S=ye(h,function(G){return!ke(G)&&!me(G)&&l.has(G)}),w,E,x,R=[],M=[],O,P,j,$;y.length&&(E=Mm(ne(Ke(y))),w=i-g[fi[n]]+E[fi[n]],n==="n"?s.bottom=u=le(u)?Math.min(u,w):w:n==="w"?s.right=u=le(u)?Math.min(u,w):w:n==="s"?s.top=c=le(c)?Math.max(c,w):w:n==="e"&&(s.left=c=le(c)?Math.max(c,w):w)),S.length&&(x=Mm(ne(Ke(S))),w=i-x[fi[es[n]]]+g[fi[es[n]]],n==="n"?s.bottom=u=le(u)?Math.min(u,w):w:n==="w"?s.right=u=le(u)?Math.min(u,w):w:n==="s"?s.top=c=le(c)?Math.max(c,w):w:n==="e"&&(s.left=c=le(c)?Math.max(c,w):w)),d&&d.length&&(d.forEach(function(G){l.has(G)?R.push(G):M.push(G)}),R.length&&(O=ne(Ke(R.map(ce))),P=g[fi[es[n]]]-(O[fi[es[n]]]-i)),M.length&&(j=ne(Ke(M.map(ce))),$=j[fi[n]]-(g[fi[n]]-i)),n==="n"?(w=Math.min(P||1/0,$||1/0),s.bottom=u=le(u)?Math.min(u,w):w):n==="w"?(w=Math.min(P||1/0,$||1/0),s.right=u=le(u)?Math.min(u,w):w):n==="s"?(w=Math.max(P||-1/0,$||-1/0),s.top=c=le(c)?Math.max(c,w):w):n==="e"&&(w=Math.max(P||-1/0,$||-1/0),s.left=c=le(c)?Math.max(c,w):w));var I=r&&r[f.id];I&&(n==="n"?(w=i+f[Hn[t]]-I[Hn[t]],s.bottom=u=le(u)?Math.min(u,w):w):n==="w"?(w=i+f[Hn[t]]-I[Hn[t]],s.right=u=le(u)?Math.min(u,w):w):n==="s"?(w=i-f[Hn[t]]+I[Hn[t]],s.top=c=le(c)?Math.max(c,w):w):n==="e"&&(w=i-f[Hn[t]]+I[Hn[t]],s.left=c=le(c)?Math.max(c,w):w))}),s}}function SR(e){return!!e.host}var sl="djs-dragging",Dm="djs-resizing",RR=250,ns=Math.max;function Om(e,t,n,i,r){function o(a,s){A(a,function(c){r.addDragger(c,s),n.addMarker(c,sl)})}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=te("g");Z(l,i.cls("djs-crosshair-group",["no-events"])),fe(s,l);var p=te("path");Z(p,"d",u.x),xe(p).add("djs-crosshair"),fe(l,p);var f=te("path");Z(f,"d",u.y),xe(f).add("djs-crosshair"),fe(l,f),c.crosshairGroup=l}),e.on("spaceTool.selection.move",function(a){var s=a.context.crosshairGroup;mt(s,a.x,a.y)}),e.on("spaceTool.selection.cleanup",function(a){var s=a.context,c=s.crosshairGroup;c&&ot(c)}),e.on("spaceTool.move",RR,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=te("path"),Z(c,"d","M0,0 L0,0"),xe(c).add("djs-crosshair"),fe(f,c),s.line=c;var d=te("g");Z(d,i.cls("djs-drag-group",["no-events"])),fe(n.getActiveLayer(),d),o(l,d);var h=new Set(l);A(p,function(M){h.add(M)});var g=new Set,y=s.movingConnections=[];h.forEach(function(M){A(M.outgoing,function(O){g.has(O)||!ke(O)||!h.has(O.target)||(g.add(O),y.push(O))})}),o(y,d),s.dragGroup=d}if(!s.frameGroup){var S=te("g");Z(S,i.cls("djs-frame-group",["no-events"])),fe(n.getActiveLayer(),S);var w=[];A(p,function(M){var O=r.addFrame(M,S),P=O.getBBox();w.push({element:O,initialBounds:P}),n.addMarker(M,Dm)}),s.frameGroup=S,s.frames=w}var E={x:"M"+a.x+", -10000 L"+a.x+", 10000",y:"M -10000, "+a.y+" L 10000, "+a.y};Z(c,{d:E[u]});var x={x:"y",y:"x"},R={x:a.dx,y:a.dy};R[x[s.axis]]=0,mt(s.dragGroup,R.x,R.y),A(s.frames,function(M){var O=M.element,P=M.initialBounds,j,$;s.direction==="e"?Z(O,{width:ns(P.width+R.x,5)}):(j=ns(P.width-R.x,5),Z(O,{width:j,x:P.x+P.width-j})),s.direction==="s"?Z(O,{height:ns(P.height+R.y,5)}):($=ns(P.height-R.y,5),Z(O,{height:$,y:P.y+P.height-$}))})}}),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;A(c,function(h){n.removeMarker(h,sl)}),A(u,function(h){n.removeMarker(h,sl)}),f&&(ot(p),ot(f)),A(l,function(h){n.removeMarker(h,Dm)}),d&&ot(d)})}Om.$inject=["eventBus","elementRegistry","canvas","styles","previewSupport"];const CR={__init__:["spaceToolPreview"],__depends__:[Fn,Rn,Ja,xr,lo],spaceTool:["type",tn],spaceToolPreview:["type",Om]};function is(e,t){e.invoke(tn,this),this._canvas=t}is.$inject=["injector","canvas"],X(is,tn),is.prototype.calculateAdjustments=function(e,t,n,i){var r=this._canvas.getRootElement(),o=e[0]===r?null:e[0],a=[];o&&(a=Qi(rr(r.children.filter(u=>_(u,"bpmn:Artifact")),Ke(o))));const s=[...e,...a];var c=tn.prototype.calculateAdjustments.call(this,s,t,n,i);return c.resizingShapes=c.resizingShapes.filter(function(u){return!(_(u,"bpmn:TextAnnotation")||PR(u)&&(t==="y"&&pt(u)||t==="x"&&!pt(u)))}),c};function PR(e){return _(e,"bpmn:Participant")&&!V(e).processRef}const Im={__depends__:[CR],spaceTool:["type",is]};function Ve(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)}Ve.$inject=["eventBus","injector"],Ve.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()},Ve.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},Ve.prototype.clear=function(e){this._stack.length=0,this._stackIdx=-1,e!==!1&&this._fire("changed",{trigger:"clear"})},Ve.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()}},Ve.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()}},Ve.prototype.register=function(e,t){this._setHandler(e,t)},Ve.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)},Ve.prototype.canUndo=function(){return!!this._getUndoAction()},Ve.prototype.canRedo=function(){return!!this._getRedoAction()},Ve.prototype._getRedoAction=function(){return this._stack[this._stackIdx+1]},Ve.prototype._getUndoAction=function(){return this._stack[this._stackIdx]},Ve.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)})},Ve.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},Ve.prototype._createId=function(){return this._uid++},Ve.prototype._atomicDo=function(e){const t=this._currentExecution;t.atomic=!0;try{e()}finally{t.atomic=!1}},Ve.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()},Ve.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)},Ve.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:Pp("id",i.reverse())}),i.length=0,this._fire("changed",{trigger:t}),e.trigger=null)},Ve.prototype._markDirty=function(e){const t=this._currentExecution;e&&(e=se(e)?e:[e],t.dirty=t.dirty.concat(e))},Ve.prototype._executedAction=function(e,t){const n=++this._stackIdx;t||this._stack.splice(n,this._stack.length,e)},Ve.prototype._revertedAction=function(e){this._stackIdx--},Ve.prototype._getHandler=function(e){return this._handlerMap[e]},Ve.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 AR={commandStack:["type",Ve]};function di(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 TR=250,Lm=1400;function cl(e,t,n){z.call(this,t);var i=e.get("movePreview",!1);t.on("shape.move.start",Lm,function(r){var o=r.context,a=o.shapes,s=o.validatedShapes;o.shapes=Bm(a),o.validatedShapes=Bm(s)}),i&&t.on("shape.move.start",TR,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",Lm,function(r){var o=r.context,a=o.closure,s=a.enclosedElements,c=[];A(s,function(u){A(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;di(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=Hc(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&&(qe(s.labels,a,c),a.labelTarget=s)})}X(cl,z),cl.$inject=["injector","eventBus","modeling"];function Bm(e){var t=new Set(e);return ye(e,function(n){return!t.has(n.labelTarget)})}const MR={__init__:["labelSupport"],labelSupport:["type",cl]};var kR=251,Nm=1401,$m="attach-ok";function ul(e,t,n,i,r){z.call(this,t);var o=e.get("movePreview",!1);t.on("shape.move.start",Nm,function(a){var s=a.context,c=s.shapes,u=s.validatedShapes;s.shapes=DR(c),s.validatedShapes=OR(u)}),o&&t.on("shape.move.start",kR,function(a){var s=a.context,c=s.shapes,u=ll(c);A(u,function(l){o.makeDraggable(s,l,!0),A(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,$m),t.once(["shape.move.out","shape.move.cleanup"],function(){n.removeMarker(l,$m)}))}}),this.preExecuted("elements.move",Nm,function(a){var s=a.context,c=s.closure,u=s.shapes,l=ll(u);A(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=ye(c,function(p){var f=p.host;return IR(p)&&!LR(c,f)}),A(l,function(p){r.updateAttachment(p,u)}))}),this.postExecuted("elements.move",function(a){var s=a.context.shapes;A(s,function(c){A(c.attachers,function(u){A(u.outgoing.slice(),function(l){var p=i.allowed("connection.reconnect",{connection:l,source:l.source,target:l.target});p||r.removeConnection(l)}),A(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;di(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&&A(u.attachers,function(l){var p=nh(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&&A(p,function(d){var h=nh(d,u,l);r.moveShape(d,h,d.parent),A(d.labels,function(g){r.moveShape(g,h,g.parent)})})}),this.preExecute("shape.delete",function(a){var s=a.context.shape;di(s.attachers,function(c){r.removeShape(c)}),s.host&&r.updateAttachment(s,null)})}X(ul,z),ul.$inject=["injector","eventBus","canvas","rules","modeling"];function ll(e){return lc(_t(e,function(t){return t.attachers||[]}))}function DR(e){var t=ll(e);return V_("id",e,t)}function OR(e){var t=Ji(e,"id");return ye(e,function(n){for(;n;){if(n.host&&t[n.host.id])return!1;n=n.parent}return!0})}function IR(e){return!!e.host}function LR(e,t){return e.indexOf(t)!==-1}const BR={__depends__:[Rn],__init__:["attachSupport"],attachSupport:["type",ul]};function jm(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(kf(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)})}jm.$inject=["eventBus","canvas","elementRegistry","graphicsFactory"];const pl={__init__:["changeSupport"],changeSupport:["type",jm]};function nn(e){this._model=e}nn.$inject=["moddle"],nn.prototype._needsId=function(e){return ve(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"])},nn.prototype._ensureId=function(e){if(e.id){this._model.ids.claim(e.id,e);return}var t;_(e,"bpmn:Activity")?t="Activity":_(e,"bpmn:Event")?t="Event":_(e,"bpmn:Gateway")?t="Gateway":ve(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))},nn.prototype.create=function(e,t){var n=this._model.create(e,t||{});return this._ensureId(n),n},nn.prototype.createDiLabel=function(){return this.create("bpmndi:BPMNLabel",{bounds:this.createDiBounds()})},nn.prototype.createDiShape=function(e,t){return this.create("bpmndi:BPMNShape",k({bpmnElement:e,bounds:this.createDiBounds()},t))},nn.prototype.createDiBounds=function(e){return this.create("dc:Bounds",e)},nn.prototype.createDiWaypoints=function(e){var t=this;return _t(e,function(n){return t.createDiWaypoint(n)})},nn.prototype.createDiWaypoint=function(e){return this.create("dc:Point",cn(e,["x","y"]))},nn.prototype.createDiEdge=function(e,t){return this.create("bpmndi:BPMNEdge",k({bpmnElement:e,waypoint:this.createDiWaypoints([])},t))},nn.prototype.createDiPlane=function(e,t){return this.create("bpmndi:BPMNPlane",k({bpmnElement:e},t))};function jt(e,t,n){z.call(this,e),this._bpmnFactory=t;var i=this;function r(d){var h=d.context,g=h.hints||{},y;!h.cropped&&g.createElementsBehavior!==!1&&(y=h.connection,y.waypoints=n.getCroppedWaypoints(y),h.cropped=!0)}this.executed(["connection.layout","connection.create"],r),this.reverted(["connection.layout"],function(d){delete d.context.cropped});function o(d){var h=d.context;i.updateParent(h.shape||h.connection,h.oldParent)}function a(d){var h=d.context,g=h.shape||h.connection,y=h.parent||h.newParent;i.updateParent(g,y)}this.executed(["shape.move","shape.create","shape.delete","connection.create","connection.move","connection.delete"],Ft(o)),this.reverted(["shape.move","shape.create","shape.delete","connection.create","connection.move","connection.delete"],Ft(a));function s(d){var h=d.context,g=h.oldRoot,y=g.children;A(y,function(S){_(S,"bpmn:BaseElement")&&i.updateParent(S)})}this.executed(["canvas.updateRoot"],s),this.reverted(["canvas.updateRoot"],s);function c(d){var h=d.context.shape;_(h,"bpmn:BaseElement")&&i.updateBounds(h)}this.executed(["shape.move","shape.create","shape.resize"],Ft(function(d){d.context.shape.type!=="label"&&c(d)})),this.reverted(["shape.move","shape.create","shape.resize"],Ft(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"],Ft(u)),this.reverted(["connection.create","connection.move","connection.delete","connection.reconnect"],Ft(u));function l(d){i.updateConnectionWaypoints(d.context.connection)}this.executed(["connection.layout","connection.move","connection.updateWaypoints"],Ft(l)),this.reverted(["connection.layout","connection.move","connection.updateWaypoints"],Ft(l)),this.executed("connection.reconnect",Ft(function(d){var h=d.context,g=h.connection,y=h.oldSource,S=h.newSource,w=V(g),E=V(y),x=V(S);w.conditionExpression&&!ve(x,["bpmn:Activity","bpmn:ExclusiveGateway","bpmn:InclusiveGateway"])&&(h.oldConditionExpression=w.conditionExpression,delete w.conditionExpression),y!==S&&E.default===w&&(h.oldDefault=E.default,delete E.default)})),this.reverted("connection.reconnect",Ft(function(d){var h=d.context,g=h.connection,y=h.oldSource,S=h.newSource,w=V(g),E=V(y),x=V(S);h.oldConditionExpression&&(w.conditionExpression=h.oldConditionExpression),h.oldDefault&&(E.default=h.oldDefault,delete x.default)}));function p(d){i.updateAttachment(d.context)}this.executed(["element.updateAttachment"],Ft(p)),this.reverted(["element.updateAttachment"],Ft(p)),this.executed("element.updateLabel",Ft(f)),this.reverted("element.updateLabel",Ft(f));function f(d){const{element:h}=d.context,g=Ut(h),y=Se(h),S=y&&y.get("label");ai(h)||Va(h)||(g&&!S?y.set("label",t.create("bpmndi:BPMNLabel")):!g&&S&&y.set("label",void 0))}}X(jt,z),jt.$inject=["eventBus","bpmnFactory","connectionDocking"],jt.prototype.updateAttachment=function(e){var t=e.shape,n=t.businessObject,i=t.host;n.attachedToRef=i&&i.businessObject},jt.prototype.updateParent=function(e,t){if(!me(e)&&!(_(e,"bpmn:DataStoreReference")&&e.parent&&_(e.parent,"bpmn:Collaboration"))){var n=e.parent,i=e.businessObject,r=Se(e),o=n&&n.businessObject,a=Se(n);_(e,"bpmn:FlowNode")&&this.updateFlowNodeRefs(i,o,t&&t.businessObject),_(e,"bpmn:DataOutputAssociation")&&(e.source?o=e.source.businessObject:o=null),_(e,"bpmn:DataInputAssociation")&&(e.target?o=e.target.businessObject:o=null),this.updateSemanticParent(i,o),_(e,"bpmn:DataObjectReference")&&i.dataObjectRef&&this.updateSemanticParent(i.dataObjectRef,o),this.updateDiParent(r,a)}},jt.prototype.updateBounds=function(e){var t=Se(e),n=$R(e);if(n){var i=ln(n,t.get("bounds"));k(n,{x:e.x+i.x,y:e.y+i.y})}var r=me(e)?this._getLabel(t):t,o=r.bounds;o||(o=this._bpmnFactory.createDiBounds(),r.set("bounds",o)),k(o,{x:e.x,y:e.y,width:e.width,height:e.height})},jt.prototype.updateFlowNodeRefs=function(e,t,n){if(n!==t){var i,r;_(n,"bpmn:Lane")&&(i=n.get("flowNodeRef"),Ue(i,e)),_(t,"bpmn:Lane")&&(r=t.get("flowNodeRef"),qe(r,e))}},jt.prototype.updateDiConnection=function(e,t,n){var i=Se(e),r=Se(t),o=Se(n);i.sourceElement&&i.sourceElement.bpmnElement!==V(t)&&(i.sourceElement=t&&r),i.targetElement&&i.targetElement.bpmnElement!==V(n)&&(i.targetElement=n&&o)},jt.prototype.updateDiParent=function(e,t){if(t&&!_(t,"bpmndi:BPMNPlane")&&(t=t.$parent),e.$parent!==t){var n=(t||e.$parent).get("planeElement");t?(n.push(e),e.$parent=t):(Ue(n,e),e.$parent=null)}};function NR(e){for(;e&&!_(e,"bpmn:Definitions");)e=e.$parent;return e}jt.prototype.getLaneSet=function(e){var t,n;return _(e,"bpmn:Lane")?(t=e.childLaneSet,t||(t=this._bpmnFactory.create("bpmn:LaneSet"),e.childLaneSet=t,t.$parent=e),t):(_(e,"bpmn:Participant")&&(e=e.processRef),n=e.get("laneSets"),t=n[0],t||(t=this._bpmnFactory.create("bpmn:LaneSet"),t.$parent=e,n.push(t)),t)},jt.prototype.updateSemanticParent=function(e,t,n){var i;if(e.$parent!==t&&!((_(e,"bpmn:DataInput")||_(e,"bpmn:DataOutput"))&&(_(t,"bpmn:Participant")&&"processRef"in t&&(t=t.processRef),"ioSpecification"in t&&t.ioSpecification===e.$parent))){if(_(e,"bpmn:Lane"))t&&(t=this.getLaneSet(t)),i="lanes";else if(_(e,"bpmn:FlowElement")){if(t){if(_(t,"bpmn:Participant"))t=t.processRef;else if(_(t,"bpmn:Lane"))do t=t.$parent.$parent;while(_(t,"bpmn:Lane"))}i="flowElements"}else if(_(e,"bpmn:Artifact")){for(;t&&!_(t,"bpmn:Process")&&!_(t,"bpmn:SubProcess")&&!_(t,"bpmn:Collaboration");)if(_(t,"bpmn:Participant")){t=t.processRef;break}else t=t.$parent;i="artifacts"}else if(_(e,"bpmn:MessageFlow"))i="messageFlows";else if(_(e,"bpmn:Participant")){i="participants";var r=e.processRef,o;r&&(o=NR(e.$parent||t),e.$parent&&(Ue(o.get("rootElements"),r),r.$parent=null),t&&(qe(o.get("rootElements"),r),r.$parent=o))}else _(e,"bpmn:DataOutputAssociation")?i="dataOutputAssociations":_(e,"bpmn:DataInputAssociation")&&(i="dataInputAssociations");if(!i)throw new Error(`no parent for <${e.id}> in <${t.id}>`);var a;if(e.$parent&&(a=e.$parent.get(i),Ue(a,e)),t?(a=t.get(i),a.push(e),e.$parent=t):e.$parent=null,n){var s=n.get(i);Ue(a,e),t&&(s||(s=[],t.set(i,s)),s.push(e))}}},jt.prototype.updateConnectionWaypoints=function(e){var t=Se(e);t.set("waypoint",this._bpmnFactory.createDiWaypoints(e.waypoints))},jt.prototype.updateConnection=function(e){var t=e.connection,n=V(t),i=t.source,r=V(i),o=t.target,a=V(t.target),s;if(_(n,"bpmn:DataAssociation"))_(n,"bpmn:DataInputAssociation")?(n.get("sourceRef")[0]=r,s=e.parent||e.newParent||a,this.updateSemanticParent(n,a,s)):_(n,"bpmn:DataOutputAssociation")&&(s=e.parent||e.newParent||r,this.updateSemanticParent(n,r,s),n.targetRef=a);else{var c=_(n,"bpmn:SequenceFlow");n.sourceRef!==r&&(c&&(Ue(n.sourceRef&&n.sourceRef.get("outgoing"),n),r&&r.get("outgoing")&&r.get("outgoing").push(n)),n.sourceRef=r),n.targetRef!==a&&(c&&(Ue(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)},jt.prototype._getLabel=function(e){return e.label||(e.label=this._bpmnFactory.createDiLabel()),e.label};function Ft(e){return function(t){var n=t.context,i=n.shape||n.connection||n.element;_(i,"bpmn:BaseElement")&&e(t)}}function $R(e){if(_(e,"bpmn:Activity")){var t=Se(e);if(t){var n=t.get("label");if(n)return n.get("bounds")}}}function hi(e,t){Bn.call(this),this._bpmnFactory=e,this._moddle=t}X(hi,Bn),hi.$inject=["bpmnFactory","moddle"],hi.prototype._baseCreate=Bn.prototype.create,hi.prototype.create=function(e,t){if(e==="label"){var n=t.di||this._bpmnFactory.createDiLabel();return this._baseCreate(e,k({type:"label",di:n},Bi,t))}return this.createElement(e,t)},hi.prototype.createElement=function(e,t){t=k({},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(!FR(r)){var o=k({},r||{},{id:i.id+"_di"});e==="root"?r=this._bpmnFactory.createDiPlane(i,o):e==="connection"?r=this._bpmnFactory.createDiEdge(i,o):r=this._bpmnFactory.createDiShape(i,o)}_(i,"bpmn:Group")&&(t=k({isFrame:!0},t)),t=jR(i,t,["processRef","isInterrupting","associationDirection","isForCompensation"]),t.isExpanded&&(t=fl(r,t,"isExpanded")),ve(i,["bpmn:Lane","bpmn:Participant"])&&(t=fl(r,t,"isHorizontal")),_(i,"bpmn:SubProcess")&&(t.collapsed=!Ee(i,r)),_(i,"bpmn:ExclusiveGateway")&&(Dt(r,"isMarkerVisible")?r.isMarkerVisible===void 0&&(r.isMarkerVisible=!1):r.isMarkerVisible=!0),it(t.triggeredByEvent)&&(i.triggeredByEvent=t.triggeredByEvent,delete t.triggeredByEvent),it(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=k({id:i.id},n,t,{businessObject:i,di:r}),this._baseCreate(e,t)},hi.prototype.getDefaultSize=function(e,t){var n=V(e);if(t=t||Se(e),_(n,"bpmn:SubProcess"))return Ee(n,t)?{width:350,height:200}:{width:100,height:80};if(_(n,"bpmn:Task"))return{width:100,height:80};if(_(n,"bpmn:Gateway"))return{width:50,height:50};if(_(n,"bpmn:Event"))return{width:36,height:36};if(_(n,"bpmn:Participant")){var i=t.isHorizontal===void 0||t.isHorizontal===!0;return Ee(n,t)?i?{width:600,height:250}:{width:250,height:600}:i?{width:400,height:60}:{width:60,height:400}}return _(n,"bpmn:Lane")?{width:400,height:100}:_(n,"bpmn:DataObjectReference")?{width:36,height:50}:_(n,"bpmn:DataStoreReference")?{width:50,height:50}:_(n,"bpmn:TextAnnotation")?{width:100,height:40}:_(n,"bpmn:Group")?{width:300,height:300}:{width:100,height:80}},hi.prototype.createParticipantShape=function(e){return ut(e)||(e={isExpanded:e}),e=k({type:"bpmn:Participant"},e||{}),e.isExpanded!==!1&&(e.processRef=this._bpmnFactory.create("bpmn:Process")),this.createShape(e)};function jR(e,t,n){return A(n,function(i){t=fl(e,t,i)}),t}function fl(e,t,n){return t[n]===void 0?t:(e[n]=t[n],hn(t,[n]))}function FR(e){return ve(e,["bpmndi:BPMNShape","bpmndi:BPMNEdge","bpmndi:BPMNDiagram","bpmndi:BPMNPlane"])}function rs(e,t){this._modeling=e,this._canvas=t}rs.$inject=["modeling","canvas"],rs.prototype.preExecute=function(e){var t=this._modeling,n=e.elements,i=e.alignment;A(n,function(r){var o={x:0,y:0};it(i.left)?o.x=i.left-r.x:it(i.right)?o.x=i.right-r.width-r.x:it(i.center)?o.x=i.center-Math.round(r.width/2)-r.x:it(i.top)?o.y=i.top-r.y:it(i.bottom)?o.y=i.bottom-r.height-r.y:it(i.middle)&&(o.y=i.middle-Math.round(r.height/2)-r.y),t.moveElements([r],o,r.parent)})},rs.prototype.postExecute=function(e){};function os(e){this._modeling=e}os.$inject=["modeling"],os.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},os.prototype.postExecute=function(e){var t=e.hints||{};HR(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 HR(e,t){return Kn(e.outgoing,function(n){return n.target===t})}function as(e,t){this._canvas=e,this._layouter=t}as.$inject=["canvas","layouter"],as.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},as.prototype.revert=function(e){var t=e.connection;return this._canvas.removeConnection(t),t.source=null,t.target=null,t};var ss=Math.round;function dl(e){this._modeling=e}dl.$inject=["modeling"],dl.prototype.preExecute=function(e){var t=e.elements,n=e.parent,i=e.parentIndex,r=e.position,o=e.hints,a=this._modeling;A(t,function(p){le(p.x)||(p.x=0),le(p.y)||(p.y=0)});var s=ye(t,function(p){return!p.hidden}),c=Ke(s);A(t,function(p){ke(p)&&(p.waypoints=_t(p.waypoints,function(f){return{x:ss(f.x-c.x-c.width/2+r.x),y:ss(f.y-c.y-c.height/2+r.y)}})),k(p,{x:ss(p.x-c.x-c.width/2+r.x),y:ss(p.y-c.y-c.height/2+r.y)})});var u=new Set(ua(t)),l={};A(t,function(p){if(ke(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=k({},o);u.has(p)||(f.autoResize=!1),me(p)&&(f=hn(f,["attach"])),l[p.id]=le(i)?a.createShape(p,cn(p,["x","y","width","height"]),p.parent||n,i,f):a.createShape(p,cn(p,["x","y","width","height"]),p.parent||n,f)}),e.elements=Qi(l)};var Fm=Math.round;function mi(e){this._canvas=e}mi.$inject=["canvas"],mi.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?k(t,n):k(t,{x:n.x-Fm(t.width/2),y:n.y-Fm(t.height/2)}),this._canvas.addShape(t,i,r),t},mi.prototype.revert=function(e){var t=e.shape;return this._canvas.removeShape(t),t};function fo(e){mi.call(this,e)}X(fo,mi),fo.$inject=["canvas"];var zR=mi.prototype.execute;fo.prototype.execute=function(e){var t=e.shape;return GR(t),t.labelTarget=e.labelTarget,zR.call(this,e)};var VR=mi.prototype.revert;fo.prototype.revert=function(e){return e.shape.labelTarget=null,VR.call(this,e)};function GR(e){["width","height"].forEach(function(t){typeof e[t]>"u"&&(e[t]=0)})}function ho(e,t){this._canvas=e,this._modeling=t}ho.$inject=["canvas","modeling"],ho.prototype.preExecute=function(e){var t=this._modeling,n=e.connection;di(n.incoming,function(i){t.removeConnection(i,{nested:!0})}),di(n.outgoing,function(i){t.removeConnection(i,{nested:!0})})},ho.prototype.execute=function(e){var t=e.connection,n=t.parent;return e.parent=n,e.parentIndex=Hc(n.children,t),e.source=t.source,e.target=t.target,this._canvas.removeConnection(t),t.source=null,t.target=null,t},ho.prototype.revert=function(e){var t=e.connection,n=e.parent,i=e.parentIndex;return t.source=e.source,t.target=e.target,qe(n.children,t,i),this._canvas.addConnection(t,n),t};function hl(e,t){this._modeling=e,this._elementRegistry=t}hl.$inject=["modeling","elementRegistry"],hl.prototype.postExecute=function(e){var t=this._modeling,n=this._elementRegistry,i=e.elements;A(i,function(r){n.get(r.id)&&(r.waypoints?t.removeConnection(r):t.removeShape(r))})};function mo(e,t){this._canvas=e,this._modeling=t}mo.$inject=["canvas","modeling"],mo.prototype.preExecute=function(e){var t=this._modeling,n=e.shape;di(n.incoming,function(i){t.removeConnection(i,{nested:!0})}),di(n.outgoing,function(i){t.removeConnection(i,{nested:!0})}),di(n.children,function(i){ke(i)?t.removeConnection(i,{nested:!0}):t.removeShape(i,{nested:!0})})},mo.prototype.execute=function(e){var t=this._canvas,n=e.shape,i=n.parent;return e.oldParent=i,e.oldParentIndex=Hc(i.children,n),t.removeShape(n),n},mo.prototype.revert=function(e){var t=this._canvas,n=e.shape,i=e.oldParent,r=e.oldParentIndex;return qe(i.children,n,r),t.addShape(n,i),n};function cs(e){this._modeling=e}cs.$inject=["modeling"];var Hm={x:"y",y:"x"};cs.prototype.preExecute=function(e){var t=this._modeling,n=e.groups,i=e.axis,r=e.dimension;function o(y,S){y.range.min=Math.min(S[i],y.range.min),y.range.max=Math.max(S[i]+S[r],y.range.max)}function a(y){return y[i]+y[r]/2}function s(y){return y.length-1}function c(y){return y.max-y.min}function u(y,S){var w={y:0};w[i]=y-a(S),w[i]&&(w[Hm[i]]=0,t.moveElements([S],w,S.parent))}var l=n[0],p=s(n),f=n[p],d,h,g=0;A(n,function(y,S){var w,E,x;if(y.elements.length<2){S&&S!==n.length-1&&(o(y,y.elements[0]),g+=c(y.range));return}w=dn(y.elements,i),E=w[0],S===p&&(E=w[s(w)]),x=a(E),y.range=null,A(w,function(R){if(u(x,R),y.range===null){y.range={min:R[i],max:R[i]+R[r]};return}o(y,R)}),S&&S!==n.length-1&&(g+=c(y.range))}),h=Math.abs(f.range.min-l.range.max),d=Math.round((h-g)/(n.length-1)),!(d<n.length-1)&&A(n,function(y,S){var w={},E;y===l||y===f||(E=n[S-1],y.range.max=0,A(y.elements,function(x,R){w[Hm[i]]=0,w[i]=E.range.max-x[i]+d,y.range.min!==x[i]&&(w[i]+=x[i]-y.range.min),w[i]&&t.moveElements([x],w,x.parent),y.range.max=Math.max(x[i]+x[r],R?y.range.max:0)}))})},cs.prototype.postExecute=function(e){};function us(e,t){this._layouter=e,this._canvas=t}us.$inject=["layouter","canvas"],us.prototype.execute=function(e){var t=e.connection,n=t.waypoints;return k(e,{oldWaypoints:n}),t.waypoints=this._layouter.layoutConnection(t,e.hints),t},us.prototype.revert=function(e){var t=e.connection;return t.waypoints=e.oldWaypoints,t};function ml(){}ml.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=Ue(o.children,t),qe(i.children,t,r),t.parent=i,A(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},ml.prototype.revert=function(e){var t=e.connection,n=t.parent,i=e.oldParent,r=e.oldParentIndex,o=e.delta;return Ue(n.children,t),qe(i.children,t,r),t.parent=i,A(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 gl(){this.allShapes={},this.allConnections={},this.enclosedElements={},this.enclosedConnections={},this.topLevel={}}gl.prototype.add=function(e,t){return this.addAll([e],t)},gl.prototype.addAll=function(e,t){var n=bE(e,!!t,this);return k(this,n),this};function go(e){this._modeling=e}go.prototype.moveRecursive=function(e,t,n){return e?this.moveClosure(this.getClosure(e),t,n):[]},go.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),A(a,function(p){o.moveShape(p,t,u[p.id]&&!l&&n,{recurse:!1,layout:!1})}),A(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&&wu(p,p.source,t),connectionEnd:d&&Su(p,p.target,t)})})},go.prototype.getClosure=function(e){return new gl().addAll(e,!0)};function ls(e){this._helper=new go(e)}ls.$inject=["modeling"],ls.prototype.preExecute=function(e){e.closure=this._helper.getClosure(e.shapes)},ls.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 zi(e){this._modeling=e,this._helper=new go(e)}zi.$inject=["modeling"],zi.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=cn(t,["x","y","width","height"]),e.oldParent=o,e.oldParentIndex=Ue(o.children,t),qe(i.children,t,r),k(t,{parent:i,x:t.x+n.x,y:t.y+n.y}),t},zi.prototype.postExecute=function(e){var t=e.shape,n=e.delta,i=e.hints,r=this._modeling;i.layout!==!1&&(A(t.incoming,function(o){r.layoutConnection(o,{connectionEnd:Su(o,t,n)})}),A(t.outgoing,function(o){r.layoutConnection(o,{connectionStart:wu(o,t,n)})})),i.recurse!==!1&&this.moveChildren(e)},zi.prototype.revert=function(e){var t=e.shape,n=e.oldParent,i=e.oldParentIndex,r=e.delta;return qe(n.children,t,i),k(t,{parent:n,x:t.x-r.x,y:t.y-r.y}),t},zi.prototype.moveChildren=function(e){var t=e.delta,n=e.shape;this._helper.moveRecursive(n.children,t,null)},zi.prototype.getNewParent=function(e){return e.newParent||e.shape.parent};function vo(e){this._modeling=e}vo.$inject=["modeling"],vo.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 se(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},vo.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||zm(se(r)?r[0]:r)),i&&(!n||o.docking==="target")&&(a.connectionEnd=a.connectionEnd||zm(se(r)?r[r.length-1]:r)),o.newWaypoints&&(a.waypoints=o.newWaypoints),this._modeling.layoutConnection(t,a))},vo.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 zm(e){return e.original||e}function zn(e,t){this._modeling=e,this._rules=t}zn.$inject=["modeling","rules"],zn.prototype.preExecute=function(e){var t=this,n=this._modeling,i=this._rules,r=e.oldShape,o=e.newData,a=e.hints||{},s;function c(h,g,y){return i.allowed("connection.reconnect",{connection:y,source:h,target:g})}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();A(f,function(h){var g=h.source,y=c(g,s,h);y&&t.reconnectEnd(h,s,Na(h,s,l),a)}),A(d,function(h){var g=h.target,y=c(s,g,h);y&&t.reconnectStart(h,s,Ba(h,s,l),a)})},zn.prototype.postExecute=function(e){var t=e.oldShape;this._modeling.removeShape(t)},zn.prototype.execute=function(e){},zn.prototype.revert=function(e){},zn.prototype.createShape=function(e,t,n,i){return this._modeling.createShape(e,t,n,i)},zn.prototype.reconnectStart=function(e,t,n,i){this._modeling.reconnectStart(e,t,n,i)},zn.prototype.reconnectEnd=function(e,t,n,i){this._modeling.reconnectEnd(e,t,n,i)};function yo(e){this._modeling=e}yo.$inject=["modeling"],yo.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},k(t,{width:n.width,height:n.height,x:n.x,y:n.y}),t},yo.prototype.postExecute=function(e){var t=this._modeling,n=e.shape,i=e.oldBounds,r=e.hints||{};r.layout!==!1&&(A(n.incoming,function(o){t.layoutConnection(o,{connectionEnd:Na(o,n,i)})}),A(n.outgoing,function(o){t.layoutConnection(o,{connectionStart:Ba(o,n,i)})}))},yo.prototype.revert=function(e){var t=e.shape,n=e.oldBounds;return k(t,{width:n.width,height:n.height,x:n.x,y:n.y}),t};function gi(e){this._modeling=e}gi.$inject=["modeling"],gi.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),A(r,function(s){a[s.id]=UR(s)}),this.resizeShapes(r,t,n),this.updateConnectionWaypoints(_R(i,r),t,n,o,i,r,a)},gi.prototype.execute=function(){},gi.prototype.revert=function(){},gi.prototype.moveShapes=function(e,t){var n=this;A(e,function(i){n._modeling.moveShape(i,t,null,{autoResize:!1,layout:!1,recurse:!1})})},gi.prototype.resizeShapes=function(e,t,n){var i=this;A(e,function(r){var o=bR(r,n,t);i._modeling.resizeShape(r,o,null,{attachSupport:!1,autoResize:!1,layout:!1})})},gi.prototype.updateConnectionWaypoints=function(e,t,n,i,r,o,a){var s=this,c=new Set(r),u=new Set(o);A(e,function(l){var p=l.source,f=l.target,d=WR(l),h=Gm(n),g={},y=c.has(p)||u.has(p),S=c.has(f)||u.has(f);y&&S?(d=_t(d,function(w){return Wm(w,i,n)&&(w[h]=w[h]+t[h]),w.original&&Wm(w.original,i,n)&&(w.original[h]=w.original[h]+t[h]),w}),s._modeling.updateWaypoints(l,d,{labelBehavior:!1})):(y||S)&&(c.has(p)?g.connectionStart=wu(l,p,t):c.has(f)?g.connectionEnd=Su(l,f,t):u.has(p)?g.connectionStart=Ba(l,p,a[p.id]):u.has(f)&&(g.connectionEnd=Na(l,f,a[f.id])),s._modeling.layoutConnection(l,g))})};function Vm(e){return k({},e)}function WR(e){return _t(e.waypoints,function(t){return t=Vm(t),t.original&&(t.original=Vm(t.original)),t})}function Gm(e){switch(e){case"n":return"y";case"w":return"x";case"s":return"y";case"e":return"x"}}function Wm(e,t,n){var i=Gm(n);if(/e|s/.test(n))return e[i]>t;if(/n|w/.test(n))return e[i]<t}function UR(e){return{x:e.x,y:e.y,height:e.height,width:e.width}}function ps(e){this._modeling=e}ps.$inject=["modeling"],ps.prototype.execute=function(e){var t=e.shape,n=t.children;e.oldChildrenVisibility=Um(n),t.collapsed=!t.collapsed;var i=qm(n,t.collapsed);return[t].concat(i)},ps.prototype.revert=function(e){var t=e.shape,n=e.oldChildrenVisibility,i=t.children,r=Ym(i,n);return t.collapsed=!t.collapsed,[t].concat(r)};function Um(e){var t={};return A(e,function(n){t[n.id]=n.hidden,n.children&&(t=k({},t,Um(n.children)))}),t}function qm(e,t){var n=[];return A(e,function(i){i.hidden=t,n=n.concat(i),i.children&&(n=n.concat(qm(i.children,i.collapsed||t)))}),n}function Ym(e,t){var n=[];return A(e,function(i){i.hidden=t[i.id],n=n.concat(i),i.children&&(n=n.concat(Ym(i.children,t)))}),n}function fs(e){this._modeling=e}fs.$inject=["modeling"],fs.prototype.execute=function(e){var t=e.shape,n=e.newHost,i=t.host;return e.oldHost=i,e.attacherIdx=Km(i,t),Xm(n,t),t.host=n,t},fs.prototype.revert=function(e){var t=e.shape,n=e.newHost,i=e.oldHost,r=e.attacherIdx;return t.host=i,Km(n,t),Xm(i,t,r),t};function Km(e,t){return Ue(e&&e.attachers,t)}function Xm(e,t,n){if(e){var i=e.attachers;i||(e.attachers=i=[]),qe(i,t,n)}}function vl(){}vl.prototype.execute=function(e){var t=e.connection,n=e.newWaypoints;return e.oldWaypoints=t.waypoints,t.waypoints=n,t},vl.prototype.revert=function(e){var t=e.connection,n=e.oldWaypoints;return t.waypoints=n,t};function De(e,t,n){this._eventBus=e,this._elementFactory=t,this._commandStack=n;var i=this;e.on("diagram.init",function(){i.registerHandlers(n)})}De.$inject=["eventBus","elementFactory","commandStack"],De.prototype.getHandlers=function(){return{"shape.append":os,"shape.create":mi,"shape.delete":mo,"shape.move":zi,"shape.resize":yo,"shape.replace":zn,"shape.toggleCollapse":ps,spaceTool:gi,"label.create":fo,"connection.create":as,"connection.delete":ho,"connection.move":ml,"connection.layout":us,"connection.updateWaypoints":vl,"connection.reconnect":vo,"elements.create":dl,"elements.move":ls,"elements.delete":hl,"elements.distribute":cs,"elements.align":rs,"element.updateAttachment":fs}},De.prototype.registerHandlers=function(e){A(this.getHandlers(),function(t,n){e.registerHandler(n,t)})},De.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)},De.prototype.updateAttachment=function(e,t){var n={shape:e,newHost:t};this._commandStack.execute("element.updateAttachment",n)},De.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)},De.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)},De.prototype.layoutConnection=function(e,t){var n={connection:e,hints:t||{}};this._commandStack.execute("connection.layout",n)},De.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},De.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},De.prototype.createElements=function(e,t,n,i,r){se(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},De.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},De.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},De.prototype.removeElements=function(e){var t={elements:e};this._commandStack.execute("elements.delete",t)},De.prototype.distributeElements=function(e,t,n){var i={groups:e,axis:t,dimension:n};this._commandStack.execute("elements.distribute",i)},De.prototype.removeShape=function(e,t){var n={shape:e,hints:t||{}};this._commandStack.execute("shape.delete",n)},De.prototype.removeConnection=function(e,t){var n={connection:e,hints:t||{}};this._commandStack.execute("connection.delete",n)},De.prototype.replaceShape=function(e,t,n){var i={oldShape:e,newData:t,hints:n||{}};return this._commandStack.execute("shape.replace",i),i.newShape},De.prototype.alignElements=function(e,t){var n={elements:e,alignment:t};this._commandStack.execute("elements.align",n)},De.prototype.resizeShape=function(e,t,n,i){var r={shape:e,newBounds:t,minBounds:n,hints:i};this._commandStack.execute("shape.resize",r)},De.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)},De.prototype.updateWaypoints=function(e,t,n){var i={connection:e,newWaypoints:t,hints:n||{}};this._commandStack.execute("connection.updateWaypoints",i)},De.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)},De.prototype.reconnectStart=function(e,t,n,i){i||(i={}),this.reconnect(e,t,e.target,n,k(i,{docking:"source"}))},De.prototype.reconnectEnd=function(e,t,n,i){i||(i={}),this.reconnect(e,e.source,t,n,k(i,{docking:"target"}))},De.prototype.connect=function(e,t,n,i){return this.createConnection(e,t,n||{},e.parent,i)},De.prototype._create=function(e,t){return ox(t)?t:this._elementFactory.create(e,t)},De.prototype.toggleCollapse=function(e,t){var n={shape:e,hints:t||{}};this._commandStack.execute("shape.toggleCollapse",n)};function _o(e){this._elementRegistry=e}_o.$inject=["elementRegistry"],_o.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||qR(n,Go(i));return Zm(n,i),e.oldProperties=o,e.changed=r,r},_o.prototype.revert=function(e){var t=e.oldProperties,n=e.moddleElement,i=e.changed;return Zm(n,t),i},_o.prototype._getVisualReferences=function(e){var t=this._elementRegistry;return _(e,"bpmn:DataObject")?YR(e,t):[]};function qR(e,t){return Ot(t,function(n,i){return n[i]=e.get(i),n},{})}function Zm(e,t){A(t,function(n,i){e.set(i,n)})}function YR(e,t){return t.filter(function(n){return _(n,"bpmn:DataObjectReference")&&V(n).dataObjectRef===e})}var bo="default",Vn="id",Qm="di",KR={width:0,height:0};function Eo(e,t,n,i){this._elementRegistry=e,this._moddle=t,this._modeling=n,this._textRenderer=i}Eo.$inject=["elementRegistry","moddle","modeling","textRenderer"],Eo.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=eC(e.properties),s=e.oldProperties||XR(t,a);return Jm(a,o)&&(r.unclaim(o[Vn]),i.updateId(t,a[Vn]),r.claim(a[Vn],o)),bo in a&&(a[bo]&&n.push(i.get(a[bo].id)),o[bo]&&n.push(i.get(o[bo].id))),eg(t,a),e.oldProperties=s,e.changed=n,n},Eo.prototype.postExecute=function(e){var t=e.element,n=t.label,i=n&&V(n).name;if(i){var r=this._textRenderer.getExternalLabelBounds(n,i);this._modeling.resizeShape(n,r,KR)}},Eo.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 eg(t,i),Jm(n,r)&&(a.unclaim(n[Vn]),o.updateId(t,i[Vn]),a.claim(i[Vn],r)),e.changed};function Jm(e,t){return Vn in e&&e[Vn]!==t[Vn]}function XR(e,t){var n=Go(t),i=e.businessObject,r=Se(e);return Ot(n,function(o,a){return a!==Qm?o[a]=i.get(a):o[a]=ZR(r,Go(t.di)),o},{})}function ZR(e,t){return Ot(t,function(n,i){return n[i]=e&&e.get(i),n},{})}function eg(e,t){var n=e.businessObject,i=Se(e);A(t,function(r,o){o!==Qm?n.set(o,r):i&&QR(i,r)})}function QR(e,t){A(t,function(n,i){e.set(i,n)})}var JR=["default"];function eC(e){var t=k({},e);return JR.forEach(function(n){n in e&&(t[n]=V(t[n]))}),t}function ds(e,t){this._canvas=e,this._modeling=t}ds.$inject=["canvas","modeling"],ds.prototype.execute=function(e){var t=this._canvas,n=e.newRoot,i=n.businessObject,r=t.getRootElement(),o=r.businessObject,a=o.$parent,s=Se(r);return t.setRootElement(n),t.removeRootElement(r),qe(a.rootElements,i),i.$parent=a,Ue(a.rootElements,o),o.$parent=null,r.di=null,s.bpmnElement=i,n.di=s,e.oldRoot=r,[]},ds.prototype.revert=function(e){var t=this._canvas,n=e.newRoot,i=n.businessObject,r=e.oldRoot,o=r.businessObject,a=i.$parent,s=Se(n);return t.setRootElement(r),t.removeRootElement(n),Ue(a.rootElements,i),i.$parent=null,qe(a.rootElements,o),o.$parent=a,n.di=null,s.bpmnElement=o,r.di=s,[]};function yl(e,t){this._modeling=e,this._spaceTool=t}yl.$inject=["modeling","spaceTool"],yl.prototype.preExecute=function(e){var t=this._spaceTool,n=this._modeling,i=e.shape,r=e.location,o=Qt(i),a=o===i,s=a?i:i.parent,c=ci(s),u=pt(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+Zt,y:i.y,width:i.width-Zt,height:i.height}:{x:i.x,y:i.y+Zt,width:i.width,height:i.height-Zt};n.createShape({type:"bpmn:Lane",isHorizontal:u},l,s)}var p=[];Ii(o,function(x){return p.push(x),x.label&&p.push(x.label),x===i?[]:ye(x.children,function(R){return R!==i})});var f,d,h,g,y;r==="top"?(f=-120,d=i.y,h=d+10,g="n",y="y"):r==="left"?(f=-120,d=i.x,h=d+10,g="w",y="x"):r==="bottom"?(f=120,d=i.y+i.height,h=d-10,g="s",y="y"):r==="right"&&(f=120,d=i.x+i.width,h=d-10,g="e",y="x");var S=t.calculateAdjustments(p,y,f,h),w=u?{x:0,y:f}:{x:f,y:0};t.makeSpace(S.movingShapes,S.resizingShapes,w,g,h);var E=u?{x:i.x+(a?Zt:0),y:d-(r==="top"?120:0),width:i.width-(a?Zt:0),height:120}:{x:d-(r==="left"?120:0),y:i.y+(a?Zt:0),width:120,height:i.height-(a?Zt:0)};e.newLane=n.createShape({type:"bpmn:Lane",isHorizontal:u},E,s)};function _l(e){this._modeling=e}_l.$inject=["modeling"],_l.prototype.preExecute=function(e){var t=this._modeling,n=e.shape,i=e.count,r=ci(n),o=r.length;if(o>i)throw new Error(`more than <${i}> child lanes`);var a=pt(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+Zt,y:n.y+f*c,width:n.width-Zt,height:u}:{x:n.x+f*c,y:n.y+Zt,width:u,height:n.height-Zt},f<o?t.resizeShape(r[f],l):(p={type:"bpmn:Lane",isHorizontal:a},t.createShape(p,l,n))};function xo(e,t){this._modeling=e,this._spaceTool=t}xo.$inject=["modeling","spaceTool"],xo.prototype.preExecute=function(e){var t=e.shape,n=e.newBounds,i=e.balanced;i!==!1?this.resizeBalanced(t,n):this.resizeSpace(t,n)},xo.prototype.resizeBalanced=function(e,t){var n=this._modeling,i=Yw(e,t);n.resizeShape(e,t),i.forEach(function(r){n.resizeShape(r.shape,r.newBounds)})},xo.prototype.resizeSpace=function(e,t){var n=this._spaceTool,i=ne(e),r=ne(t),o=Dd(r,i),a=Qt(e),s=[],c=[];Ii(a,function(h){return s.push(h),(_(h,"bpmn:Lane")||_(h,"bpmn:Participant"))&&c.push(h),h.children});var u,l,p,f,d;(o.bottom||o.top)&&(u=o.bottom||o.top,l=e.y+(o.bottom?e.height:0)+(o.bottom?-10:10),p=o.bottom?"s":"n",f=o.top>0||o.bottom<0?-u:u,d=n.calculateAdjustments(s,"y",f,l),n.makeSpace(d.movingShapes,d.resizingShapes,{x:0,y:u},p)),(o.left||o.right)&&(u=o.right||o.left,l=e.x+(o.right?e.width:0)+(o.right?-10:100),p=o.right?"e":"w",f=o.left>0||o.right<0?-u:u,d=n.calculateAdjustments(c,"x",f,l),n.makeSpace(d.movingShapes,d.resizingShapes,{x:u,y:0},p))};var wo="flowNodeRef",bl="lanes";function hs(){}hs.prototype._computeUpdates=function(e,t){var n=[],i=[],r={},o=[];function a(l,p){var f=ne(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=Qt(l);return r[p.id]||(r[p.id]=ka(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=Qt(l);if(!(!p||n.indexOf(p)!==-1)){var f=p.children.filter(function(d){return _(d,"bpmn:FlowNode")});f.forEach(s),n.push(p)}}),e.forEach(s),o.forEach(function(l){var p=l.businessObject,f=p.get(bl),d=f.slice(),h=u(l);i.push({flowNode:p,remove:d,add:h})}),t.forEach(function(l){var p=l.businessObject;l.parent||p.get(wo).forEach(function(f){i.push({flowNode:f,remove:[p],add:[]})})}),i},hs.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(bl);n.remove.forEach(function(o){Ue(r,o),Ue(o.get(wo),i)}),n.add.forEach(function(o){qe(r,o),qe(o.get(wo),i)})}),[]},hs.prototype.revert=function(e){var t=e.updates;return t.forEach(function(n){var i=n.flowNode,r=i.get(bl);n.add.forEach(function(o){Ue(r,o),Ue(o.get(wo),i)}),n.remove.forEach(function(o){qe(r,o),qe(o.get(wo),i)})}),[]};var El="categoryValueRef";function So(e,t){this._bpmnFactory=e,this._elementRegistry=t}So.$inject=["bpmnFactory","elementRegistry"],So.prototype._computeUpdates=function(e,t){var n=this._elementRegistry,i=this._bpmnFactory,r=new Map,o=[],a=new Map;function s(w,E,x){if(E){var R=a.get(w);R||(R={},a.set(w,R)),!(x&&R.present)&&(!x&&R.past||(x?R.present={categoryValue:E,root:xl(w)}:R.past={categoryValue:E}))}}function c(w){r.set(w,V(w))}function u(){n.filter(function(w){return _(w,"bpmn:FlowElement")&&!me(w)&&w.parent}).forEach(c)}function l(w){var E=V(w),x=E.get("categoryValueRef");return x||(x=Pd(i,E),o.push(tC(w,x))),x}function p(w){return w.reduce(function(E,x){var R=xl(x),M=E.get(R);return M||(M=[],E.set(R,M)),M.push(x),E},new Map)}e=Array.from(e||[]);var f=p(e);t.length&&u(),e.forEach(c),n.filter(function(w){return _(w,"bpmn:Group")&&!me(w)&&w.parent}).forEach(function(w){var E=V(w).get("categoryValueRef");if(!E){var x=xl(w),R=f.get(x)||[],M=rr(R,w),O=Object.keys(M).length>0;O&&(E=l(w))}s(w,E,!0)}),t.forEach(function(w){s(w.groupShape,w.categoryValue,!1)}),o.length&&u();var d=Array.from(r.keys()),h=Array.from(a.values()).reduce(function(w,E){return E.present&&w.add(E.present.categoryValue),E.past&&w.add(E.past.categoryValue),w},new Set),g=new Map,y=p(d);a.forEach(function(w,E){var x=w.present;if(x){var R=y.get(x.root)||[],M=rr(R,E);R.forEach(function(O){if(M[O.id]){var P=g.get(O);P||(P=new Set,g.set(O,P)),P.add(x.categoryValue)}})}});var S=d.reduce(function(w,E){var x=r.get(E),R=x.get(El),M=new Set(R),O=g.get(E)||new Set,P=Array.from(O).filter(function($){return!M.has($)}),j=R.filter(function($){return h.has($)&&!O.has($)});return(P.length||j.length)&&w.push({businessObject:x,categoryValuesToAdd:P,categoryValuesToRemove:j}),w},[]);return{flowElements:S,groups:o}},So.prototype.execute=function(e){var t=e.updates;return t||(t=e.updates=this._computeUpdates(e.affectedFlowElements,e.affectedGroupEntries)),nC(t.groups),rC(t.flowElements),[]},So.prototype.revert=function(e){var t=e.updates;return oC(t.flowElements),iC(t.groups),[]};function tC(e,t){return{groupShape:e,categoryValue:t,category:t.$parent}}function nC(e){e.forEach(function(t){V(t.groupShape).categoryValueRef=t.categoryValue,t.categoryValue.$parent=t.category})}function iC(e){e.forEach(function(t){V(t.groupShape).categoryValueRef=null})}function rC(e){e.forEach(function(t){var n=t.businessObject,i=n.get(El);t.categoryValuesToRemove.forEach(function(r){Ue(i,r)}),t.categoryValuesToAdd.forEach(function(r){qe(i,r,!0)})})}function oC(e){e.forEach(function(t){var n=t.businessObject,i=n.get(El);t.categoryValuesToAdd.forEach(function(r){Ue(i,r)}),t.categoryValuesToRemove.forEach(function(r){qe(i,r,!0)})})}function xl(e){for(;e.parent;)e=e.parent;return e}function ms(e){this._moddle=e}ms.$inject=["moddle"],ms.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),[]},ms.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 aC={fill:void 0,stroke:void 0};function wl(e){this._commandStack=e,this._normalizeColor=function(t){if(t){if(kt(t)){var n=sC(t);if(n)return n}throw new Error(`invalid color value: ${t}`)}}}wl.$inject=["commandStack"],wl.prototype.postExecute=function(e){var t=e.elements,n=e.colors||aC,i=this,r={};"fill"in n&&k(r,{"background-color":this._normalizeColor(n.fill)}),"stroke"in n&&k(r,{"border-color":this._normalizeColor(n.stroke)}),A(t,function(o){var a=ke(o)?cn(r,["border-color"]):r,s=Se(o);if(cC(a),me(o)){if(!s||!_(s.label,"bpmndi:BPMNLabel"))return;i._commandStack.execute("element.updateModdleProperties",{element:o,moddleElement:s.label,properties:{color:r["border-color"]}})}else{if(!ve(s,["bpmndi:BPMNEdge","bpmndi:BPMNShape"]))return;i._commandStack.execute("element.updateProperties",{element:o,properties:{di:a}})}})};function sC(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 cC(e){"border-color"in e&&(e.stroke=e["border-color"]),"background-color"in e&&(e.fill=e["background-color"])}var uC={width:0,height:0};function tg(e,t,n){function i(c,u){var l=c.label||c,p=c.labelTarget||c;return Nx(l,u),[l,p]}function r(c){var u=c.element,l=u.businessObject,p=c.newLabel;if(!me(u)&&ai(u)&&!ya(u)&&!ng(p)){var f=7,d=qc(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=Ut(c.element),i(c.element,c.newLabel)}function a(c){return i(c.element,c.oldLabel)}function s(c){var u=c.element,l=u.label||u,p=c.newLabel,f=c.newBounds,d=c.hints||{};if(!(!me(l)&&!_(l,"bpmn:TextAnnotation"))){if(me(l)&&ng(p)){d.removeShape!==!1&&e.removeShape(l,{unsetLabel:!1});return}var h=Ut(u);typeof f>"u"&&(f=t.getExternalLabelBounds(l,h)),f&&e.resizeShape(l,f,uC)}}this.preExecute=r,this.execute=o,this.revert=a,this.postExecute=s}tg.$inject=["modeling","textRenderer","bpmnFactory"];function ng(e){return!e||!e.trim()}function vt(e,t,n,i){De.call(this,e,t,n),this._bpmnRules=i}X(vt,De),vt.$inject=["eventBus","elementFactory","commandStack","bpmnRules"],vt.prototype.getHandlers=function(){var e=De.prototype.getHandlers.call(this);return e["element.updateModdleProperties"]=_o,e["element.updateProperties"]=Eo,e["canvas.updateRoot"]=ds,e["lane.add"]=yl,e["lane.resize"]=xo,e["lane.split"]=_l,e["lane.updateRefs"]=hs,e["group.updateRefs"]=So,e["id.updateClaim"]=ms,e["element.setColor"]=wl,e["element.updateLabel"]=tg,e},vt.prototype.updateLabel=function(e,t,n,i){this._commandStack.execute("element.updateLabel",{element:e,newLabel:t,newBounds:n,hints:i||{}})},vt.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)},vt.prototype.updateModdleProperties=function(e,t,n){this._commandStack.execute("element.updateModdleProperties",{element:e,moddleElement:t,properties:n})},vt.prototype.updateProperties=function(e,t){this._commandStack.execute("element.updateProperties",{element:e,properties:t})},vt.prototype.resizeLane=function(e,t,n){this._commandStack.execute("lane.resize",{shape:e,newBounds:t,balanced:n})},vt.prototype.addLane=function(e,t){var n={shape:e,location:t};return this._commandStack.execute("lane.add",n),n.newLane},vt.prototype.splitLane=function(e,t){this._commandStack.execute("lane.split",{shape:e,count:t})},vt.prototype.makeCollaboration=function(){var e=this._create("root",{type:"bpmn:Collaboration"}),t={newRoot:e};return this._commandStack.execute("canvas.updateRoot",t),e},vt.prototype.makeProcess=function(){var e=this._create("root",{type:"bpmn:Process"}),t={newRoot:e};return this._commandStack.execute("canvas.updateRoot",t),e},vt.prototype.updateLaneRefs=function(e,t){this._commandStack.execute("lane.updateRefs",{flowNodeShapes:e,laneShapes:t})},vt.prototype.updateCategoryValueRefs=function(e,t){this._commandStack.execute("group.updateRefs",{affectedFlowElements:e,affectedGroupEntries:t})},vt.prototype.claimId=function(e,t){this._commandStack.execute("id.updateClaim",{id:e,element:t,claiming:!0})},vt.prototype.unclaimId=function(e,t){this._commandStack.execute("id.updateClaim",{id:e,element:t})},vt.prototype.setColor=function(e,t){e.length||(e=[e]),this._commandStack.execute("element.setColor",{elements:e,colors:t})};function ig(){}ig.prototype.layoutConnection=function(e,t){return t=t||{},[t.connectionStart||ce(t.source||e.source),t.connectionEnd||ce(t.target||e.target)]};var gs=20,lC=5,vs=Math.round,rg=20,pC={"h:h":20,"v:v":20,"h:v":-10,"v:h":-10};function fC(e,t){return!{t:/top/,r:/right/,b:/bottom/,l:/left/,h:/./,v:/./}[t].test(e)}function dC(e,t){return{t:/top/,r:/right/,b:/bottom/,l:/left/,h:/left|right/,v:/top|bottom/}[e].test(t)}function og(e,t,n){var i=ht(t,e,lC),r=n.split(":")[0],o=vs((t.x-e.x)/2+e.x),a=vs((t.y-e.y)/2+e.y),s,c,u=dC(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=fC(i,r),c=l?"h:v":"v:h",p?l?(f=a===e.y,s={x:e.x+gs*(/l/.test(r)?-1:1),y:f?a+gs:a}):(f=o===e.x,s={x:f?o+gs:o,y:e.y+gs*(/t/.test(r)?-1:1)}):s={x:o,y:a}),{waypoints:Sl(e,s,c).concat(s),directions:c,turnNextDirections:f}}function hC(e,t,n){return og(e,t,n)}function mC(e,t,n){var i=og(t,e,ag(n));return{waypoints:i.waypoints.slice().reverse(),directions:ag(i.directions),turnNextDirections:i.turnNextDirections}}function gC(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=Sl(e.waypoints[e.waypoints.length-1],t.waypoints[0],r);return{waypoints:o,directions:r}}function ag(e){return e.split(":").reverse().join(":")}function vC(e,t,n){var i=vs((t.x-e.x)/2+e.x),r=vs((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 Sl(e,t,n){if(n=n||"h:h",!CC(n))throw new Error("unknown directions: <"+n+">: must be specified as <start>:<end> with start/end in { h,v,t,r,b,l }");if(cg(n)){var i=hC(e,t,n),r=mC(e,t,n),o=gC(i,r);return[].concat(i.waypoints,o.waypoints,r.waypoints)}return vC(e,t,n)}function yC(e,t,n){var i=Sl(e,t,n);return i.unshift(e),i.push(t),lg(i)}function _C(e,t,n,i,r){var o=r&&r.preferredLayouts||[],a=H_(o,"straight")[0]||"h:h",s=pC[a]||0,c=ht(e,t,s),u=RC(c,a);n=n||ce(e),i=i||ce(t);var l=u.split(":"),p=ug(n,e,l[0],PC(c)),f=ug(i,t,l[1],c);return yC(p,f,u)}function bC(e,t,n,i,r,o){se(n)&&(r=n,o=i,n=ce(e),i=ce(t)),o=k({preferredLayouts:[]},o),r=r||[];var a=o.preferredLayouts,s=a.indexOf("straight")!==-1,c;return c=s&&xC(e,t,n,i,o),c||(c=o.connectionEnd&&SC(t,e,i,r),c)||(c=o.connectionStart&&wC(e,t,n,r),c)?c:!o.connectionStart&&!o.connectionEnd&&r&&r.length?r:_C(e,t,n,i,o)}function EC(e,t,n){return e>=t&&e<=n}function sg(e,t,n){var i={x:"width",y:"height"};return EC(t[e],n[e],n[e]+n[i[e]])}function xC(e,t,n,i,r){var o={},a,s;return s=ht(e,t),/^(top|bottom|left|right)$/.test(s)?(/top|bottom/.test(s)&&(a="x"),/left|right/.test(s)&&(a="y"),r.preserveDocking==="target"?sg(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:sg(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 wC(e,t,n,i){return Rl(e,t,n,i)}function SC(e,t,n,i){var r=i.slice().reverse();return r=Rl(e,t,n,r),r?r.reverse():null}function Rl(e,t,n,i){function r(l){return l.length<3?!0:l.length>4?!1:!!Le(l,function(p,f){var d=l[f-1];return d&&qr(p,d)<3})}function o(l,p,f){var d=In(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(Of(l[d],p,rg)||Of(l[d],f,rg))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=Rl(e,t,n,u)),c&&In(c)?null:c}function RC(e,t){if(cg(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 CC(e){return e&&/^h|v|t|r|b|l:h|v|t|r|b|l$/.test(e)}function cg(e){return e&&/t|r|b|l/.test(e)}function PC(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 ug(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 lg(e){return e.reduce(function(t,n,i){var r=t[t.length-1],o=e[i+1];return zc(r,o,n,0)||t.push(n),t},[])}var AC=-10,TC=40,MC={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},kC={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},Cl={top:"bottom","top-right":"bottom-left","top-left":"bottom-right",right:"left",bottom:"top","bottom-right":"top-left","bottom-left":"top-right",left:"right"},Ro={top:"t",right:"r",bottom:"b",left:"l"};function ys(e){this._elementRegistry=e}X(ys,ig),ys.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=pg(r&&r[0],n)),a||(a=pg(r&&r[r.length-1],i)),(_(e,"bpmn:Association")||_(e,"bpmn:DataAssociation"))&&r&&!fg(n,i))return[].concat([o],r.slice(1,-1),[a]);var l=wd(n,s)?MC:kC;return _(e,"bpmn:MessageFlow")?c=OC(n,i,l):(_(e,"bpmn:SequenceFlow")||fg(n,i))&&(n===i?c={preferredLayouts:jC(n,e,l)}:_(n,"bpmn:BoundaryEvent")?c={preferredLayouts:FC(n,i,a,l)}:Co(n)||Co(i)?c={preferredLayouts:l.subProcess,preserveDocking:LC(n)}:_(n,"bpmn:Gateway")?c={preferredLayouts:l.fromGateway}:_(i,"bpmn:Gateway")?c={preferredLayouts:l.toGateway}:c={preferredLayouts:l.default}),c&&(c=k(c,t),u=lg(bC(n,i,o,a,r,c))),u||[o,a]};function DC(e){var t=e.host;return ht(ce(e),t,AC)}function OC(e,t,n){return{preferredLayouts:n.messageFlow,preserveDocking:IC(e,t)}}function IC(e,t){return _(t,"bpmn:Participant")?"source":_(e,"bpmn:Participant")?"target":Co(t)?"source":Co(e)||_(t,"bpmn:Event")?"target":_(e,"bpmn:Event")?"source":null}function LC(e){return Co(e)?"target":"source"}function pg(e,t){return e?e.original||e:ce(t)}function fg(e,t){return _(t,"bpmn:Activity")&&_(e,"bpmn:BoundaryEvent")&&t.businessObject.isForCompensation}function Co(e){return _(e,"bpmn:SubProcess")&&Ee(e)}function Vi(e,t){return e===t}function BC(e,t){return t.indexOf(e)!==-1}function wr(e){var t=/right|left/.exec(e);return t&&t[0]}function Sr(e){var t=/top|bottom/.exec(e);return t&&t[0]}function dg(e,t){return Cl[e]===t}function NC(e,t){var n=wr(e),i=Cl[n];return t.indexOf(i)!==-1}function $C(e,t){var n=Sr(e),i=Cl[n];return t.indexOf(i)!==-1}function hg(e){return e==="right"||e==="left"}function jC(e,t,n){var i=t.waypoints,r=i&&i.length&&ht(i[0],e);return r==="top"?n.loop.fromTop:r==="right"?n.loop.fromRight:r==="left"?n.loop.fromLeft:n.loop.fromBottom}function FC(e,t,n,i){var r=ce(e),o=ce(t),a=DC(e),s,c,u=Vi(e.host,t),l=BC(a,["top","right","bottom","left"]),p=ht(o,r,{x:e.width/2+t.width/2,y:e.height/2+t.height/2});return u?HC(a,l,e,t,n,i):(s=zC(a,p,l,i.isHorizontal),c=VC(a,p,l,i.isHorizontal),[s+":"+c])}function HC(e,t,n,i,r,o){var a=t?e:o.isHorizontal?Sr(e):wr(e),s=Ro[a],c;return t?hg(e)?c=mg("y",n,i,r)?"h":o.boundaryLoop.alternateHorizontalSide:c=mg("x",n,i,r)?"v":o.boundaryLoop.alternateVerticalSide:c=o.boundaryLoop.default,[s+":"+c]}function mg(e,t,n,i){var r=TC;return!(Pl(e,i,n,r)||Pl(e,i,{x:n.x+n.width,y:n.y+n.height},r)||Pl(e,i,ce(t),r))}function Pl(e,t,n,i){return Math.abs(t[e]-n[e])<i}function zC(e,t,n,i){if(n)return Ro[e];var r=Sr(e),o=wr(e),a=Sr(t),s=wr(t);if(i){if(Vi(r,a)||dg(o,s))return Ro[r]}else if(Vi(o,s)||dg(r,a))return Ro[o];return Ro[i?o:r]}function VC(e,t,n,i){if(n)return hg(e)?NC(e,t)||Vi(e,t)?"h":"v":$C(e,t)||Vi(e,t)?"v":"h";var r=Sr(e),o=wr(e),a=Sr(t),s=wr(t);return a&&!s?"v":s&&!a?"h":i?Vi(r,a)?"h":"v":Vi(o,s)?"v":"h"}ys.$inject=["elementRegistry"];function gg(e){return k({original:e.point.original||e.point},e.actual)}function vi(e,t){this._elementRegistry=e,this._graphicsFactory=t}vi.$inject=["elementRegistry","graphicsFactory"],vi.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(gg(i)),o.push(gg(r)),o},vi.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}},vi.prototype._getIntersection=function(e,t,n){var i=this._getShapePath(e),r=this._getConnectionPath(t);return Yr(i,r,n)},vi.prototype._getConnectionPath=function(e){return this._graphicsFactory.getConnectionPath(e)},vi.prototype._getShapePath=function(e){return this._graphicsFactory.getShapePath(e)},vi.prototype._getGfx=function(e){return this._elementRegistry.getGraphics(e)};const Al={__init__:["modeling","bpmnUpdater"],__depends__:[cS,SS,CS,PS,Am,AR,MR,BR,en,pl,Im],bpmnFactory:["type",nn],bpmnUpdater:["type",jt],elementFactory:["type",hi],modeling:["type",vt],layouter:["type",ys],connectionDocking:["type",vi]};var GC=10,vg=50,WC=250;function Tl(e,t,n,i){for(var r;r=UC(e,n,t);)n=i(t,n,r);return n}function Ml(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 UC(e,t,n){var i={x:t.x-n.width/2,y:t.y-n.height/2,width:n.width,height:n.height},r=YC(e);return Le(r,function(o){if(o===n)return!1;var a=ht(o,i,GC);return a==="intersect"})}function qC(e,t){t||(t={});function n(h){return h.source===e?1:-1}var i=t.defaultDistance||vg,r=t.direction||"e",o=t.filter,a=t.getWeight||n,s=t.maxDistance||WC,c=t.reference||"start";o||(o=ZC);function u(h,g){return r==="n"?c==="start"?ne(h).top-ne(g).bottom:c==="center"?ne(h).top-ce(g).y:ne(h).top-ne(g).top:r==="w"?c==="start"?ne(h).left-ne(g).right:c==="center"?ne(h).left-ce(g).x:ne(h).left-ne(g).left:r==="s"?c==="start"?ne(g).top-ne(h).bottom:c==="center"?ce(g).y-ne(h).bottom:ne(g).bottom-ne(h).bottom:c==="start"?ne(g).left-ne(h).right:c==="center"?ce(g).x-ne(h).right:ne(g).right-ne(h).right}var l=e.incoming.filter(o).map(function(h){var g=a(h),y=g<0?u(h.source,e):u(e,h.source);return{id:h.source.id,distance:y,weight:g}}),p=e.outgoing.filter(o).map(function(h){var g=a(h),y=g>0?u(e,h.target):u(h.target,e);return{id:h.target.id,distance:y,weight:g}}),f=l.concat(p).reduce(function(h,g){return h[g.id+"__weight_"+g.weight]=g,h},{}),d=Ot(f,function(h,g){var y=g.distance,S=g.weight;return y<0||y>s||(h[String(y)]||(h[String(y)]=0),h[String(y)]+=1*S,(!h.distance||h[h.distance]<h[String(y)])&&(h.distance=y)),h},{});return d.distance||i}function YC(e){var t=kl(e);return e.host&&(t=t.concat(kl(e.host))),e.attachers&&(t=t.concat(e.attachers.reduce(function(n,i){return n.concat(kl(i))},[]))),t}function kl(e){return XC(e).concat(KC(e))}function KC(e){return e.incoming.map(function(t){return t.source})}function XC(e){return e.outgoing.map(function(t){return t.target})}function ZC(){return!0}var QC=100;function yg(e,t,n){e.on("autoPlace",QC,function(i){var r=i.shape,o=i.source;return JC(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}}yg.$inject=["eventBus","modeling","canvas"];function JC(e,t,n){n||(n={});var i=n.defaultDistance||vg,r=ce(e),o=ne(e);return{x:o.right+i+t.width/2,y:r.y}}function _g(e,t){e.on("autoPlace.end",500,function(n){t.select(n.shape)})}_g.$inject=["eventBus","selection"];const eP={__init__:["autoPlaceSelectionBehavior"],autoPlace:["type",yg],autoPlaceSelectionBehavior:["type",_g]};function bg(e,t,n){var i=wd(e,n);if(_(t,"bpmn:TextAnnotation"))return nP(e,t,i);if(ve(t,["bpmn:DataObjectReference","bpmn:DataStoreReference"]))return iP(e,t,i);if(_(t,"bpmn:FlowNode"))return tP(e,t,i)}function tP(e,t,n){var i=ne(e),r=ce(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=qC(e,{filter:function(d){return _(d,"bpmn:SequenceFlow")},direction:o.directionHint}),s=30,c=o.minDistance,u=o.baseOrientation;_(e,"bpmn:BoundaryEvent")&&(u=ht(e,e.host,-25),u.indexOf(o.boundaryOrientation)!==-1&&(s*=-1));var l=n?{x:i.right+a+t.width/2,y:r.y+Eg(u,c,o)}:{x:r.x+Eg(u,c,o),y:i.bottom+a+t.height/2},p={margin:s,minDistance:c},f=n?{y:p}:{x:p};return Tl(e,t,l,Ml(f))}function Eg(e,t,n){return e.includes(n.start)?-1*t:e.includes(n.end)?t:0}function nP(e,t,n){var i=ne(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};ke(e)&&(r=ce(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 Tl(e,t,r,Ml(a))}function iP(e,t,n){var i=ne(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 Tl(e,t,r,Ml(a))}function xg(e,t){e.on("autoPlace",function(n){var i=n.shape,r=n.source;return bg(r,i,t)})}xg.$inject=["eventBus","elementRegistry"];const _s={__depends__:[eP],__init__:["bpmnAutoPlace"],bpmnAutoPlace:["type",xg]},Rr={cjkEm:.865,upperEm:.68,lowerEm:.5,digitEm:.556,spaceEm:.278,otherEm:.35,ascentEm:.9,descentEm:.25},rP=/[ᄀ-ᇿ -〿぀-ヿ㐀-鿿가-힯＀-⦆]/;function oP(e){const t=Rr;return rP.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 Dl(e,t){let n=0;for(const i of e)n+=t*oP(i);return n}function wg(e=globalThis,{textMeasurement:t="approximate"}={}){if(!(e!=null&&e.SVGElement))throw new Error("installHeadlessBpmnDom: DOM 전역이 없다 — jsdom window 를 전역에 올린 뒤 호출할 것");t==="approximate"&&aP(e),sP(e),cP(e),uP(e)}function aP(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:Dl(r,o),fontBoundingBoxAscent:o*Rr.ascentEm,fontBoundingBoxDescent:o*Rr.descentEm,actualBoundingBoxAscent:o*Rr.ascentEm,actualBoundingBoxDescent:o*Rr.descentEm}}};t.getContext=()=>n}function sP(e){if(e.SVGMatrix)return;class t{constructor(){Xi(this,"a",1);Xi(this,"b",0);Xi(this,"c",0);Xi(this,"d",1);Xi(this,"e",0);Xi(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 cP(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 uP(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:Dl(n,12),height:14}})}const Sg=[Ed,eo,Al,_s];function lP(e={}){wg(globalThis,e.dom);const t=document.createElement("div");return document.body.appendChild(t),new sr({container:t,moddleExtensions:e.moddleExtensions??Zo,additionalModules:[...Sg,...e.additionalModules??[]]})}var pP=new Er("ov"),fP=500;function ft(e,t,n,i){this._eventBus=t,this._canvas=n,this._elementRegistry=i,this._ids=pP,this._overlayDefaults=k({show:null,scale:!0},e&&e.defaults),this._overlays={},this._overlayContainers=[],this._overlayRoot=dP(n.getContainer()),this._init()}ft.$inject=["config.overlays","eventBus","canvas","elementRegistry"],ft.prototype.get=function(e){if(kt(e)&&(e={id:e}),kt(e.element)&&(e.element=this._elementRegistry.get(e.element)),e.element){var t=this._getOverlayContainer(e.element,!0);return t?e.type?ye(t.overlays,er({type:e.type})):t.overlays.slice():[]}else return e.type?ye(this._overlays,er({type:e.type})):e.id?this._overlays[e.id]:null},ft.prototype.add=function(e,t,n){if(ut(t)&&(n=t,t=null),e.id||(e=this._elementRegistry.get(e)),!n.position)throw new Error("must specifiy overlay position");if(!n.html)throw new Error("must specifiy overlay html");if(!e)throw new Error("invalid element specified");var i=this._ids.next();return n=k({},this._overlayDefaults,n,{id:i,type:t,element:e,html:n.html}),this._addOverlay(n),i},ft.prototype.remove=function(e){var t=this.get(e)||[];se(t)||(t=[t]);var n=this;A(t,function(i){var r=n._getOverlayContainer(i.element,!0);if(i&&(_n(i.html),_n(i.htmlContainer),delete i.htmlContainer,delete i.element,delete n._overlays[i.id]),r){var o=r.overlays.indexOf(i);o!==-1&&r.overlays.splice(o,1)}})},ft.prototype.isShown=function(){return this._overlayRoot.style.display!=="none"},ft.prototype.show=function(){bs(this._overlayRoot)},ft.prototype.hide=function(){bs(this._overlayRoot,!1)},ft.prototype.clear=function(){this._overlays={},this._overlayContainers=[],ia(this._overlayRoot)},ft.prototype._updateOverlayContainer=function(e){var t=e.element,n=e.html,i=t.x,r=t.y;if(t.waypoints){var o=Ke(t);i=o.x,r=o.y}Rg(n,i,r),Et(e.html,"data-container-id",t.id)},ft.prototype._updateOverlay=function(e){var t=e.position,n=e.htmlContainer,i=e.element,r=t.left,o=t.top;if(t.right!==void 0){var a;i.waypoints?a=Ke(i).width:a=i.width,r=t.right*-1+a}if(t.bottom!==void 0){var s;i.waypoints?s=Ke(i).height:s=i.height,o=t.bottom*-1+s}Rg(n,r||0,o||0),this._updateOverlayVisibilty(e,this._canvas.viewbox())},ft.prototype._createOverlayContainer=function(e){var t=Ne('<div class="djs-overlays" />');Ct(t,{position:"absolute"}),this._overlayRoot.appendChild(t);var n={html:t,element:e,overlays:[]};return this._updateOverlayContainer(n),this._overlayContainers.push(n),n},ft.prototype._updateRoot=function(e){var t=e.scale||1,n="matrix("+[t,0,0,t,-1*e.x*t,-1*e.y*t].join(",")+")";Cg(this._overlayRoot,n)},ft.prototype._getOverlayContainer=function(e,t){var n=Le(this._overlayContainers,function(i){return i.element===e});return!n&&!t?this._createOverlayContainer(e):n},ft.prototype._addOverlay=function(e){var t=e.id,n=e.element,i=e.html,r,o;i.get&&i.constructor.prototype.jquery&&(i=i.get(0)),kt(i)&&(i=Ne(i)),o=this._getOverlayContainer(n),r=Ne('<div class="djs-overlay" data-overlay-id="'+t+'">'),Ct(r,{position:"absolute"}),r.appendChild(i),e.type&&He(r).add("djs-overlay-"+e.type);var a=this._canvas.findRoot(n),s=this._canvas.getRootElement();bs(r,a===s),e.htmlContainer=r,o.overlays.push(e),o.html.appendChild(r),this._overlays[t]=e,this._updateOverlay(e),this._updateOverlayVisibilty(e,this._canvas.viewbox())},ft.prototype._updateOverlayVisibilty=function(e,t){var n=e.show,i=this._canvas.findRoot(e.element),r=n&&n.minZoom,o=n&&n.maxZoom,a=e.htmlContainer,s=this._canvas.getRootElement(),c=!0;(i!==s||n&&(it(r)&&r>t.scale||it(o)&&o<t.scale))&&(c=!1),bs(a,c),this._updateOverlayScale(e,t)},ft.prototype._updateOverlayScale=function(e,t){var n=e.scale,i,r,o=e.htmlContainer,a,s="";n!==!0&&(n===!1?(i=1,r=1):(i=n.min,r=n.max),it(i)&&t.scale<i&&(a=(1/t.scale||1)*i),it(r)&&t.scale>r&&(a=(1/t.scale||1)*r)),it(a)&&(s="scale("+a+","+a+")"),Cg(o,s)},ft.prototype._updateOverlaysVisibilty=function(e){var t=this;A(this._overlays,function(n){t._updateOverlayVisibilty(n,e)})},ft.prototype._init=function(){var e=this._eventBus,t=this;function n(i){t._updateRoot(i),t._updateOverlaysVisibilty(i),t.show()}e.on("canvas.viewbox.changing",function(i){t.hide()}),e.on("canvas.viewbox.changed",function(i){n(i.viewbox)}),e.on(["shape.remove","connection.remove"],function(i){var r=i.element,o=t.get({element:r});A(o,function(c){t.remove(c.id)});var a=t._getOverlayContainer(r);if(a){_n(a.html);var s=t._overlayContainers.indexOf(a);s!==-1&&t._overlayContainers.splice(s,1)}}),e.on("element.changed",fP,function(i){var r=i.element,o=t._getOverlayContainer(r,!0);o&&(A(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&&He(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 dP(e){var t=Ne('<div class="djs-overlay-container" />');return Ct(t,{position:"absolute",width:0,height:0}),e.insertBefore(t,e.firstChild),t}function Rg(e,t,n){Ct(e,{left:t+"px",top:n+"px"})}function bs(e,t){e.style.display=t===!1?"none":""}function Cg(e,t){e.style["transform-origin"]="top left",["","-ms-","-webkit-"].forEach(function(n){e.style[n+"transform"]=t})}const Es={__init__:["overlays"],overlays:["type",ft]};function Ol(e,t){t.invoke(z,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)})}X(Ol,z),Ol.$inject=["canvas","injector"];const hP={__init__:["rootElementsBehavior"],rootElementsBehavior:["type",Ol]};function Po(e){return CSS.escape(e)}var mP={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"};function Pg(e){return e=""+e,e&&e.replace(/[&<>"']/g,function(t){return mP[t]})}var gP="bjs-breadcrumbs-shown";function Ag(e,t,n){var i=Ne('<ul class="bjs-breadcrumbs"></ul>'),r=n.getContainer(),o=He(r);r.appendChild(i);var a=[];e.on("element.changed",function(c){var u=c.element,l=V(u),p=Le(a,function(f){return f===l});p&&s()});function s(c){c&&(a=vP(c));var u=a.flatMap(function(p){var f=n.findRoot(Sn(p))||n.findRoot(p.id);if(!f&&_(p,"bpmn:Process")){var d=t.find(function(y){var S=V(y);return S&&S.get("processRef")===p});f=d&&n.findRoot(d.id)}if(!f)return[];var h=Pg(p.name||p.id),g=Ne('<li><span class="bjs-crumb"><a title="'+h+'">'+h+"</a></span></li>");return g.addEventListener("click",function(){n.setRootElement(f)}),g});i.innerHTML="";var l=u.length>1;o.toggle(gP,l),u.forEach(function(p){i.appendChild(p)})}e.on("root.set",function(c){s(c.element)})}Ag.$inject=["eventBus","elementRegistry","canvas"];function vP(e){for(var t=V(e),n=[],i=t;i;i=i.$parent)(_(i,"bpmn:SubProcess")||_(i,"bpmn:Process"))&&n.push(i);return n.reverse()}function Tg(e,t){var n=null,i=new yP;e.on("root.set",function(r){var o=r.element,a=t.viewbox(),s=i.get(o);if(i.set(n,{x:a.x,y:a.y,zoom:a.scale}),n=o,!(!_(o,"bpmn:SubProcess")&&!s)){s=s||{x:0,y:0,zoom:1};var c=(a.x-s.x)*a.scale,u=(a.y-s.y)*a.scale;(c!==0||u!==0)&&t.scroll({dx:c,dy:u}),s.zoom!==a.scale&&t.zoom(s.zoom,{x:0,y:0})}}),e.on("diagram.clear",function(){i.clear(),n=null})}Tg.$inject=["eventBus","canvas"];function yP(){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 Mg={x:180,y:160};function Gi(e,t){this._eventBus=e,this._moddle=t;var n=this;e.on("import.render.start",1500,function(i,r){n._handleImport(r.definitions)})}Gi.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)})}},Gi.prototype._createNewDiagrams=function(e){var t=this,n=[],i=[];e.get("planeElement").forEach(function(o){var a=o.bpmnElement;if(a){var s=a.$parent;_(a,"bpmn:SubProcess")&&!o.isExpanded&&n.push(a),bP(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},Gi.prototype._movePlaneElementsToOrigin=function(e){var t=e.get("planeElement"),n=_P(e),i={x:n.x-Mg.x,y:n.y-Mg.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)})},Gi.prototype._moveToDiPlane=function(e,t){var n=kg(e),i=n.plane.get("planeElement");i.splice(i.indexOf(e),1),t.get("planeElement").push(e)},Gi.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},Gi.$inject=["eventBus","moddle"];function kg(e){return _(e,"bpmndi:BPMNDiagram")?e:kg(e.$parent)}function _P(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=ne(n.bounds);t.top=Math.min(i.top,t.top),t.left=Math.min(i.left,t.left)}}),fa(t)}function bP(e,t){var n=e.$parent;return!(!_(n,"bpmn:SubProcess")||n===t.bpmnElement||ve(e,["bpmn:DataInputAssociation","bpmn:DataOutputAssociation"]))}var xs=250,EP='<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>',xP="bjs-drilldown-empty";function yi(e,t,n,i,r){z.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",xs,function(a){var s=a.shape;o._canDrillDown(s)?o._addOverlay(s):o._removeOverlay(s)},!0),this.reverted("shape.toggleCollapse",xs,function(a){var s=a.shape;o._canDrillDown(s)?o._addOverlay(s):o._removeOverlay(s)},!0),this.executed(["shape.create","shape.move","shape.delete"],xs,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"],xs,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)})})}X(yi,z),yi.prototype._updateDrilldownOverlay=function(e){var t=this._canvas;if(e){var n=t.findRoot(e);n&&this._updateOverlayVisibility(n)}},yi.prototype._canDrillDown=function(e){var t=this._canvas;return _(e,"bpmn:SubProcess")&&t.findRoot(Sn(e))},yi.prototype._updateOverlayVisibility=function(e){var t=this._overlays,n=V(e),i=t.get({element:n.id,type:"drilldown"})[0];if(i){var r=n&&n.get("flowElements")&&n.get("flowElements").length;He(i.html).toggle(xP,!r)}},yi.prototype._addOverlay=function(e){var t=this._canvas,n=this._overlays,i=V(e),r=n.get({element:e,type:"drilldown"});r.length&&this._removeOverlay(e);var o=Ne('<button type="button" class="bjs-drilldown">'+EP+"</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(Sn(e)))}),n.add(e,"drilldown",{position:{bottom:-7,right:-8},html:o}),this._updateOverlayVisibility(e)},yi.prototype._removeOverlay=function(e){var t=this._overlays;t.remove({element:e,type:"drilldown"})},yi.$inject=["canvas","eventBus","elementRegistry","overlays","translate"];const wP={__depends__:[Es,pl,hP],__init__:["drilldownBreadcrumbs","drilldownOverlayBehavior","drilldownCentering","subprocessCompatibility"],drilldownBreadcrumbs:["type",Ag],drilldownCentering:["type",Tg],drilldownOverlayBehavior:["type",yi],subprocessCompatibility:["type",Gi]};function _i(e){ze.call(this,e)}X(_i,ze),_i.prototype._modules=[Ed,wP,Es,en,eo],_i.prototype._moddleExtensions={};var ws="keyboard.keydown",SP="keyboard.keyup",RP=1e3,Dg="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 Pt(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(Dg));var i=e&&e.bind!==!1;t.on("canvas.init",function(r){n._target=r.svg,i&&n.bind(),n._fire("init")})}Pt.$inject=["config.keyboard","eventBus"],Pt.prototype._keydownHandler=function(e){this._keyHandler(e,ws)},Pt.prototype._keyupHandler=function(e){this._keyHandler(e,SP)},Pt.prototype._keyHandler=function(e,t){var n;if(!this._isEventIgnored(e)){var i={keyEvent:e};n=this._eventBus.fire(t||ws,i),n&&e.preventDefault()}},Pt.prototype._isEventIgnored=function(e){return!1},Pt.prototype.bind=function(e){e&&console.error("unsupported argument <node>",new Error(Dg)),this.unbind(),e=this._node=this._target,pe.bind(e,"keydown",this._keydownHandler),pe.bind(e,"keyup",this._keyupHandler),this._fire("bind")},Pt.prototype.getBinding=function(){return this._node},Pt.prototype.unbind=function(){var e=this._node;e&&(this._fire("unbind"),pe.unbind(e,"keydown",this._keydownHandler),pe.unbind(e,"keyup",this._keyupHandler)),this._node=null},Pt.prototype._fire=function(e){this._eventBus.fire("keyboard."+e,{node:this._node})},Pt.prototype.addListener=function(e,t,n){lt(e)&&(n=t,t=e,e=RP),this._eventBus.on(n||ws,e,t)},Pt.prototype.removeListener=function(e,t){this._eventBus.off(t||ws,e)},Pt.prototype.hasModifier=FS,Pt.prototype.isCmd=Nt,Pt.prototype.isShift=el,Pt.prototype.isKey=at;var CP=500;function Cr(e,t){var n=this;e.on("editorActions.init",CP,function(i){var r=i.editorActions;n.registerBindings(t,r)})}Cr.$inject=["eventBus","keyboard"],Cr.prototype.registerBindings=function(e,t){function n(i,r){t.isRegistered(i)&&e.addListener(r)}n("undo",function(i){var r=i.keyEvent;if(WS(r))return t.trigger("undo"),!0}),n("redo",function(i){var r=i.keyEvent;if(US(r))return t.trigger("redo"),!0}),n("copy",function(i){var r=i.keyEvent;if(HS(r))return t.trigger("copy"),!0}),n("paste",function(i){var r=i.keyEvent;if(zS(r))return t.trigger("paste"),!0}),n("duplicate",function(i){var r=i.keyEvent;if(VS(r))return t.trigger("duplicate"),!0}),n("cut",function(i){var r=i.keyEvent;if(GS(r))return t.trigger("cut"),!0}),n("stepZoom",function(i){var r=i.keyEvent;if(at(["+","Add","="],r)&&Nt(r))return t.trigger("stepZoom",{value:1}),!0}),n("stepZoom",function(i){var r=i.keyEvent;if(at(["-","Subtract"],r)&&Nt(r))return t.trigger("stepZoom",{value:-1}),!0}),n("zoom",function(i){var r=i.keyEvent;if(at("0",r)&&Nt(r))return t.trigger("zoom",{value:1}),!0}),n("removeSelection",function(i){var r=i.keyEvent;if(at(["Backspace","Delete","Del"],r))return t.trigger("removeSelection"),!0})};const Il={__init__:["keyboard","keyboardBindings"],keyboard:["type",Pt],keyboardBindings:["type",Cr]};var PP={moveSpeed:50,moveSpeedAccelerated:200};function Og(e,t,n){var i=this;this._config=k({},PP,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})}}Og.$inject=["config.keyboardMove","keyboard","canvas"];const Ig={__depends__:[Il],__init__:["keyboardMove"],keyboardMove:["type",Og]};var AP=15;function Lg(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=$i(s),p=ln(l,c);if(!n.dragging&&TP(p)>AP&&(n.dragging=!0,u===0&&sm(e),Xa("grab")),n.dragging){var f=n.last||n.start;p=ln(l,f),t.scroll({dx:p.x,dy:p.y}),n.last=l}s.preventDefault()}function o(s){pe.unbind(document,"mousemove",r),pe.unbind(document,"mouseup",o),n=null,am()}function a(s){if(!Di(s.target,".djs-draggable")){var c=s.button;if(!(c>=2||s.ctrlKey||s.shiftKey||s.altKey))return n={button:c,start:$i(s)},pe.bind(document,"mousemove",r),pe.bind(document,"mouseup",o),!0}}this.isActive=function(){return!!n}}Lg.$inject=["eventBus","canvas"];function TP(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}const Bg={__init__:["moveCanvas"],moveCanvas:["type",Lg]};function Ng(e,t){var n=Zc(e.min),i=Zc(e.max),r=Math.abs(n)+Math.abs(i);return r/t}function MP(e,t){return Math.max(e.min,Math.min(e.max,t))}var kP=Math.sign||function(e){return e>=0?1:-1},Ll={min:.2,max:4},$g=10,DP=.1,OP=.75;function Pn(e,t,n){e=e||{},this._enabled=!1,this._canvas=n,this._container=n._container,this._handleWheel=At(this._handleWheel,this),this._totalDelta=0,this._scale=e.scale||OP;var i=this;t.on("canvas.mouseover",function(){i._init(e.enabled!==!1)}),t.on("canvas.mouseout",function(){i._init(!1)})}Pn.$inject=["config.zoomScroll","eventBus","canvas"],Pn.prototype.scroll=function(t){this._canvas.scroll(t)},Pn.prototype.reset=function(){this._canvas.zoom("fit-viewport")},Pn.prototype.zoom=function(t,n){var i=Ng(Ll,$g*2);this._totalDelta+=t,Math.abs(this._totalDelta)>DP&&(this._zoom(t,n,i),this._totalDelta=0)},Pn.prototype._handleWheel=function(t){if(this._enabled){var n=this._container;t.preventDefault();var i=t.ctrlKey||hh()&&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))*kP(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)}},Pn.prototype.stepZoom=function(t,n){var i=Ng(Ll,$g);this._zoom(t,n,i)},Pn.prototype._zoom=function(e,t,n){var i=this._canvas,r=e>0?1:-1,o=Zc(i.zoom()),a=Math.round(o/n)*n;a+=n*r;var s=Math.pow(10,a);i.zoom(MP(Ll,s),t)},Pn.prototype.toggle=function(t){var n=this._container,i=this._handleWheel,r=this._enabled;return typeof t>"u"&&(t=!r),r!==t&&pe[t?"bind":"unbind"](n,"wheel",i,!1),this._enabled=t,t},Pn.prototype._init=function(e){this.toggle(e)};const jg={__init__:["zoomScroll"],zoomScroll:["type",Pn]};function Ao(e){_i.call(this,e)}X(Ao,_i),Ao.prototype._navigationModules=[Ig,Bg,jg],Ao.prototype._modules=[].concat(_i.prototype._modules,Ao.prototype._navigationModules);function Bl(e){return e&&e[e.length-1]}function Fg(e){return e.y}function Hg(e){return e.x}var IP={left:Hg,center:Hg,right:function(e){return e.x+e.width},top:Fg,middle:Fg,bottom:function(e){return e.y+e.height}};function Pr(e,t){this._modeling=e,this._rules=t}Pr.$inject=["modeling","rules"],Pr.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}},Pr.prototype._isType=function(e,t){return t.indexOf(e)!==-1},Pr.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=Bl(t),o[e]=l[i]+l[r];else if(this._isType(e,["center","middle"])){if(A(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=dn(a,function(f){return f.elements.length>1&&(s=!0),f.elements.length}),s)return o[e]=Bl(c).center,o;u=t[0],t=dn(t,function(f){return f[i]+f[r]}),l=Bl(t),o[e]=p(u,l)}return o},Pr.prototype.trigger=function(e,t){var n=this._modeling,i,r=ye(e,function(c){return!(c.waypoints||c.host||c.labelTarget)});if(i=this._rules.allowed("elements.align",{elements:r}),se(i)&&(r=i),!(r.length<2||!i)){var o=IP[t],a=dn(r,o),s=this._alignmentPosition(t,a);n.alignElements(a,s)}};const LP={__init__:["alignElements"],alignElements:["type",Pr]},BP=new Er;function Ar(e){this._scheduled={},e.on("diagram.destroy",()=>{Object.keys(this._scheduled).forEach(t=>{this.cancel(t)})})}Ar.$inject=["eventBus"],Ar.prototype.schedule=function(e,t=BP.next()){this.cancel(t);const n=this._schedule(e,t);return this._scheduled[t]=n,n.promise},Ar.prototype._schedule=function(e,t){const n=NP();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}},Ar.prototype.cancel=function(e){const t=this._scheduled[e];t&&(this._cancel(t),this._scheduled[e]=null)},Ar.prototype._cancel=function(e){clearTimeout(e.executionId)};function NP(){const e={};return e.promise=new Promise((t,n)=>{e.resolve=t,e.reject=n}),e}const $P={scheduler:["type",Ar]};var jP="djs-element-hidden",Ss=".entry",FP=1e3,zg=8,HP=300;function Ze(e,t,n,i){this._canvas=e,this._elementRegistry=t,this._eventBus=n,this._scheduler=i,this._current=null,this._init()}Ze.$inject=["canvas","elementRegistry","eventBus","scheduler"],Ze.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=se(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=se(i.target)?i.target:[i.target];r.includes(n)&&e._updateVisibility()}}),this._container=this._createContainer()},Ze.prototype._createContainer=function(){var e=Ne('<div class="djs-context-pad-parent"></div>');return this._canvas.getContainer().appendChild(e),e},Ze.prototype.registerProvider=function(e,t){t||(t=e,e=FP),this._eventBus.on("contextPad.getProviders",e,function(n){n.providers.push(t)})},Ze.prototype.getEntries=function(e){var t=this._getProviders(),n=se(e)?"getMultiElementContextPadEntries":"getContextPadEntries",i={};return A(t,function(r){if(lt(r[n])){var o=r[n](e);lt(o)?i=o(i):A(o,function(a,s){i[s]=a})}}),i},Ze.prototype.trigger=function(e,t,n){var i=this,r,o,a=t.delegateTarget||t.target;if(!a)return t.preventDefault();if(r=Et(a,"data-action"),o=t.originalEvent||t,e==="mouseover"){this._timeout=setTimeout(function(){i._mouseout=i.triggerEntry(r,"hover",o,n)},HP);return}else if(e==="mouseout"){clearTimeout(this._timeout),this._mouseout&&(this._mouseout(),this._mouseout=null);return}return this.triggerEntry(r,e,o,n)},Ze.prototype.triggerEntry=function(e,t,n,i){if(this.isShown()){var r=this._current.target,o=this._current.entries,a=o[e];if(a){var s=a.action;if(this._eventBus.fire("contextPad.trigger",{entry:a,event:n})!==!1){if(lt(s)){if(t==="click")return s(n,r,i)}else if(s[t])return s[t](n,r,i);n.preventDefault()}}}},Ze.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))}},Ze.prototype._getProviders=function(){var e=this._eventBus.createEvent({type:"contextPad.getProviders",providers:[]});return this._eventBus.fire(e),e.providers},Ze.prototype._updateAndOpen=function(e){var t=this.getEntries(e),n=this._createHtml(e),i;A(t,function(r,o){var a=r.group||"default",s=Ne(r.html||'<div class="entry" draggable="true"></div>'),c;Et(s,"data-action",o),c=Me("[data-group="+Po(a)+"]",n),c||(c=Ne('<div class="group"></div>'),Et(c,"data-group",a),n.appendChild(c)),c.appendChild(s),r.className&&zP(s,r.className),r.title&&Et(s,"title",r.title),r.imageUrl&&(i=Ne("<img>"),Et(i,"src",r.imageUrl),i.style.width="100%",i.style.height="100%",s.appendChild(i))}),He(n).add("open"),this._current={entries:t,html:n,target:e},this._updatePosition(),this._updateVisibility(),this._eventBus.fire("contextPad.open",{current:this._current})},Ze.prototype._createHtml=function(e){var t=this,n=Ne('<div class="djs-context-pad"></div>');return It.bind(n,Ss,"click",function(i){t.trigger("click",i)}),It.bind(n,Ss,"dragstart",function(i){t.trigger("dragstart",i)}),It.bind(n,Ss,"mouseover",function(i){t.trigger("mouseover",i)}),It.bind(n,Ss,"mouseout",function(i){t.trigger("mouseout",i)}),pe.bind(n,"mousedown",function(i){i.stopPropagation()}),this._container.appendChild(n),this._eventBus.fire("contextPad.create",{target:e,pad:n}),n},Ze.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()&&GP(this._current.target,e)?t=this._current.html:t=this._createHtml(e),{html:t}},Ze.prototype.close=function(){this.isOpen()&&(clearTimeout(this._timeout),this._container.innerHTML="",this._eventBus.fire("contextPad.close",{current:this._current}),this._current=null)},Ze.prototype.isOpen=function(e){var t=this._current;if(!t)return!1;if(!e)return!0;var n=t.target;return se(e)!==se(n)?!1:se(e)?e.length===n.length&&Ai(e,function(i){return n.includes(i)}):n===e},Ze.prototype.isShown=function(){return this.isOpen()&&He(this._current.html).has("open")},Ze.prototype.show=function(){this.isOpen()&&(He(this._current.html).add("open"),this._updatePosition(),this._eventBus.fire("contextPad.show",{current:this._current}))},Ze.prototype.hide=function(){this.isOpen()&&(He(this._current.html).remove("open"),this._eventBus.fire("contextPad.hide",{current:this._current}))},Ze.prototype._getPosition=function(e){if(!se(e)&&ke(e)){var t=this._canvas.viewbox(),n=VP(e),i=n.x*t.scale-t.x*t.scale,r=n.y*t.scale-t.y*t.scale;return{left:i+zg*this._canvas.zoom(),top:r}}var o=this._canvas.getContainer(),a=o.getBoundingClientRect(),s=this._getTargetBounds(e);return{left:s.right-a.left+zg*this._canvas.zoom(),top:s.top-a.top}},Ze.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")},Ze.prototype._updateVisibility=function(){const e=()=>{if(this.isOpen()){var t=this,n=this._current.target,i=se(n)?n:[n],r=i.some(function(o){return t._canvas.hasMarker(o,jP)});r?t.hide():t.show()}};this._scheduler.schedule(e,"ContextPad#_updateVisibility")},Ze.prototype._getTargetBounds=function(e){var t=this,n=se(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 zP(e,t){var n=He(e);t=se(t)?t:t.split(/\s+/g),t.forEach(function(i){n.add(i)})}function VP(e){return e.waypoints[e.waypoints.length-1]}function GP(e,t){return e=se(e)?e:[e],t=se(t)?t:[t],e.length===t.length&&Ai(e,function(n){return t.includes(n)})}const Vg={__depends__:[Ka,$P,Es],contextPad:["type",Ze]};var Rs,Ge,Gg,bi,Wg,Ug,qg,Nl,Cs,To,Yg,$l,jl,Fl,Ps={},As=[],WP=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,Ts=Array.isArray;function Gn(e,t){for(var n in t)e[n]=t[n];return e}function Hl(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function Kg(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?Rs.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 Ms(e,a,i,r,null)}function Ms(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??++Gg,__i:-1,__u:0};return r==null&&Ge.vnode!=null&&Ge.vnode(o),o}function ks(e){return e.children}function Ds(e,t){this.props=e,this.context=t}function Wi(e,t){if(t==null)return e.__?Wi(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"?Wi(e):null}function UP(e){if(e.__P&&e.__d){var t=e.__v,n=t.__e,i=[],r=[],o=Gn({},t);o.__v=t.__v+1,Ge.vnode&&Ge.vnode(o),zl(e.__P,o,t,e.__n,e.__P.namespaceURI,32&t.__u?[n]:null,i,n??Wi(t),!!(32&t.__u),r),o.__v=t.__v,o.__.__k[o.__i]=o,iv(i,o,r),t.__e=t.__=null,o.__e!=n&&Xg(o)}}function Xg(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}),Xg(e)}function Zg(e){(!e.__d&&(e.__d=!0)&&bi.push(e)&&!Os.__r++||Wg!=Ge.debounceRendering)&&((Wg=Ge.debounceRendering)||Ug)(Os)}function Os(){try{for(var e,t=1;bi.length;)bi.length>t&&bi.sort(qg),e=bi.shift(),t=bi.length,UP(e)}finally{bi.length=Os.__r=0}}function Qg(e,t,n,i,r,o,a,s,c,u,l){var p,f,d,h,g,y,S=i&&i.__k||As,w=t.length;for(c=qP(n,t,S,c,w),p=0;p<w;p++)(d=n.__k[p])!=null&&(f=d.__i!=-1&&S[d.__i]||Ps,d.__i=p,y=zl(e,d,f,r,o,a,s,c,u,l),h=d.__e,d.ref&&f.ref!=d.ref&&(f.ref&&Vl(f.ref,null,d),l.push(d.ref,d.__c||h,d)),g==null&&h!=null&&(g=h),4&d.__u?(c=Jg(d,c,e),f.__e&&(f.__e=null)):typeof d.type=="function"&&y!==void 0?c=y:h&&(c=h.nextSibling),d.__u&=-7);return n.__e=g,c}function qP(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]=Ms(null,a,null,null,null):Ts(a)?a=e.__k[o]=Ms(ks,{children:a},null,null,null):a.constructor===void 0&&a.__b>0?a=e.__k[o]=Ms(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=YP(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=Wi(s)),ov(s,s));return i}function Jg(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=Jg(i[r],t,n));return t}e.__e!=t&&(t&&e.type&&!t.parentNode&&(t=Wi(e)),t=n.insertBefore(e.__e,t||null));do t=t&&t.nextSibling;while(t!=null&&t.nodeType==8);return t}function YP(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 ev(e,t,n){t[0]=="-"?e.setProperty(t,n??""):e[t]=n==null?"":typeof n!="number"||WP.test(t)?n:n+"px"}function Is(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||ev(e.style,t,"");if(n)for(t in n)i&&n[t]==i[t]||ev(e.style,t,n[t])}else if(t[0]=="o"&&t[1]=="n")o=t!=(t=t.replace(Yg,"$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[To]=i[To]:(n[To]=$l,e.addEventListener(t,o?Fl:jl,o)):e.removeEventListener(t,o?Fl:jl,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 tv(e){return function(t){if(this.l){var n=this.l[t.type+e];if(t[Cs]==null)t[Cs]=$l++;else if(t[Cs]<n[To])return;return n(Ge.event?Ge.event(t):t)}}}function zl(e,t,n,i,r,o,a,s,c,u){var l,p,f,d,h,g,y,S,w,E,x,R,M,O,P,j,$=t.type;if(t.constructor!==void 0)return null;128&n.__u&&(c=!!(32&n.__u),o=[s=t.__e=n.__e]),(l=Ge.__b)&&l(t);e:if(typeof $=="function"){p=a.length;try{if(w=t.props,E=$.prototype&&$.prototype.render,x=(l=$.contextType)&&i[l.__c],R=l?x?x.props.value:l.__:i,n.__c?S=(f=t.__c=n.__c).__=f.__E:(E?t.__c=f=new $(w,R):(t.__c=f=new Ds(w,R),f.constructor=$,f.render=XP),x&&x.sub(f),f.state||(f.state={}),f.__n=i,d=f.__d=!0,f.__h=[],f._sb=[]),E&&f.__s==null&&(f.__s=f.state),E&&$.getDerivedStateFromProps!=null&&(f.__s==f.state&&(f.__s=Gn({},f.__s)),Gn(f.__s,$.getDerivedStateFromProps(w,f.__s))),h=f.props,g=f.state,f.__v=t,d)E&&$.getDerivedStateFromProps==null&&f.componentWillMount!=null&&f.componentWillMount(),E&&f.componentDidMount!=null&&f.__h.push(f.componentDidMount);else{if(E&&$.getDerivedStateFromProps==null&&w!==h&&f.componentWillReceiveProps!=null&&f.componentWillReceiveProps(w,R),t.__v==n.__v||!f.__e&&f.shouldComponentUpdate!=null&&f.shouldComponentUpdate(w,f.__s,R)===!1){t.__v!=n.__v&&(f.props=w,f.state=f.__s,f.__d=!1),t.__e=n.__e,t.__k=n.__k,t.__k.some(function(I){I&&(I.__=t)}),As.push.apply(f.__h,f._sb),f._sb=[],f.__h.length&&a.push(f),s=Wi(n);break e}f.componentWillUpdate!=null&&f.componentWillUpdate(w,f.__s,R),E&&f.componentDidUpdate!=null&&f.__h.push(function(){f.componentDidUpdate(h,g,y)})}if(f.context=R,f.props=w,f.__P=e,f.__e=!1,M=Ge.__r,O=0,E)f.state=f.__s,f.__d=!1,M&&M(t),l=f.render(f.props,f.state,f.context),As.push.apply(f.__h,f._sb),f._sb=[];else do f.__d=!1,M&&M(t),l=f.render(f.props,f.state,f.context),f.state=f.__s;while(f.__d&&++O<25);f.state=f.__s,f.getChildContext!=null&&(i=Gn(Gn({},i),f.getChildContext())),E&&!d&&f.getSnapshotBeforeUpdate!=null&&(y=f.getSnapshotBeforeUpdate(h,g)),P=l!=null&&l.type===ks&&l.key==null?rv(l.props.children):l,s=Qg(e,Ts(P)?P:[P],t,n,i,r,o,a,s,c,u),f.base=t.__e,t.__u&=-161,f.__h.length&&a.push(f),S&&(f.__E=f.__=null)}catch(I){if(a.length=p,t.__v=null,c||o!=null){if(I.then){for(t.__u|=c?160:128;s&&s.nodeType==8&&s.nextSibling;)s=s.nextSibling;o!=null&&(o[o.indexOf(s)]=null),t.__e=s}else if(o!=null)for(j=o.length;j--;)Hl(o[j])}else t.__e=n.__e;t.__k==null&&(t.__k=n.__k||[]),I.then||nv(t),Ge.__e(I,t,n)}}else o==null&&t.__v==n.__v?(t.__k=n.__k,t.__e=n.__e):s=t.__e=KP(n.__e,t,n,i,r,o,a,c,u);return(l=Ge.diffed)&&l(t),128&t.__u?void 0:s}function nv(e){e&&(e.__c&&(e.__c.__e=!0),e.__k&&e.__k.some(nv))}function iv(e,t,n){for(var i=0;i<n.length;i++)Vl(n[i],n[++i],n[++i]);Ge.__c&&Ge.__c(t,e),e.some(function(r){try{e=r.__h,r.__h=[],e.some(function(o){o.call(r)})}catch(o){Ge.__e(o,r.__v)}})}function rv(e){return typeof e!="object"||e==null||e.__b>0?e:Ts(e)?e.map(rv):e.constructor!==void 0?null:Gn({},e)}function KP(e,t,n,i,r,o,a,s,c){var u,l,p,f,d,h,g,y=n.props||Ps,S=t.props,w=t.type;if(w=="svg"?r="http://www.w3.org/2000/svg":w=="math"?r="http://www.w3.org/1998/Math/MathML":r||(r="http://www.w3.org/1999/xhtml"),o!=null){for(u=0;u<o.length;u++)if((d=o[u])&&"setAttribute"in d==!!w&&(w?d.localName==w:d.nodeType==3)){e=d,o[u]=null;break}}if(e==null){if(w==null)return document.createTextNode(S);e=document.createElementNS(r,w,S.is&&S),s&&(Ge.__m&&Ge.__m(t,o),s=!1),o=null}if(w==null)y===S||s&&e.data==S||(e.data=S);else{if(o=w=="textarea"&&S.defaultValue!=null?null:o&&Rs.call(e.childNodes),!s&&o!=null)for(y={},u=0;u<e.attributes.length;u++)y[(d=e.attributes[u]).name]=d.value;for(u in y)d=y[u],u=="dangerouslySetInnerHTML"?p=d:u=="children"||u in S||u=="value"&&"defaultValue"in S||u=="checked"&&"defaultChecked"in S||Is(e,u,null,d,r);for(u in S)d=S[u],u=="children"?f=d:u=="dangerouslySetInnerHTML"?l=d:u=="value"?h=d:u=="checked"?g=d:s&&typeof d!="function"||y[u]===d||Is(e,u,d,y[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=""),Qg(t.type=="template"?e.content:e,Ts(f)?f:[f],t,n,i,w=="foreignObject"?"http://www.w3.org/1999/xhtml":r,o,a,o?o[0]:n.__k&&Wi(n,0),s,c),o!=null)for(u=o.length;u--;)Hl(o[u]);s&&w!="textarea"||(u="value",w=="progress"&&h==null?e.removeAttribute("value"):h!=null&&(h!==e[u]||w=="progress"&&!h||w=="option"&&h!=y[u])&&Is(e,u,h,y[u],r),u="checked",g!=null&&g!=e[u]&&Is(e,u,g,y[u],r))}return e}function Vl(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){Ge.__e(r,n)}}function ov(e,t,n){var i,r;if(Ge.unmount&&Ge.unmount(e),(i=e.ref)&&(i.current&&i.current!=e.__e||Vl(i,null,t)),(i=e.__c)!=null){if(i.componentWillUnmount)try{i.componentWillUnmount()}catch(o){Ge.__e(o,t)}i.base=i.__P=i.__n=null}if(i=e.__k)for(r=0;r<i.length;r++)i[r]&&ov(i[r],t,n||typeof e.type!="function");n||Hl(e.__e),e.__c=e.__=e.__e=void 0}function XP(e,t,n){return this.constructor(e,n)}function av(e,t,n){var i,r,o,a;t==document&&(t=document.documentElement),Ge.__&&Ge.__(e,t),r=(i=!1)?null:t.__k,o=[],a=[],zl(t,e=t.__k=Kg(ks,null,[e]),r||Ps,Ps,t.namespaceURI,r?null:t.firstChild?Rs.call(t.childNodes):null,o,r?r.__e:t.firstChild,i,a),iv(o,e,a),e.props.children=null}Rs=As.slice,Ge={__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}},Gg=0,Ds.prototype.setState=function(e,t){var n;n=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=Gn({},this.state),typeof e=="function"&&(e=e(Gn({},n),this.props)),e&&Gn(n,e),e!=null&&this.__v&&(t&&this._sb.push(t),Zg(this))},Ds.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),Zg(this))},Ds.prototype.render=ks,bi=[],Ug=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,qg=function(e,t){return e.__v.__b-t.__v.__b},Os.__r=0,Nl=Math.random().toString(8),Cs="__d"+Nl,To="__a"+Nl,Yg=/(PointerCapture)$|Capture$/i,$l=0,jl=tv(!1),Fl=tv(!0);var sv=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,sv(e,s,n,["",null])),i.push(r),s[0]?t[0]|=2:(t[o-2]=0,t[o]=r)):i.push(s)}return i},cv=new Map;function ZP(e){var t=cv.get(this);return t||(t=new Map,cv.set(this,t)),(t=sv(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===`
10
- `||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 Oe=ZP.bind(Kg),Tr,Qe,Gl,uv,Mo=0,lv=[],st=Ge,pv=st.__b,fv=st.__r,dv=st.diffed,hv=st.__c,mv=st.unmount,gv=st.__;function Ls(e,t){st.__h&&st.__h(Qe,e,Mo||t),Mo=0;var n=Qe.__H||(Qe.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({}),n.__[e]}function Wl(e){return Mo=1,QP(yv,e)}function QP(e,t,n){var i=Ls(Tr++,2);if(i.t=e,!i.__c&&(i.__=[yv(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=Qe,!Qe.__f)){var r=function(s,c,u){if(!i.__c.__H)return!0;var l=!1,p=i.__c.props!==s;if(i.__c.__H.__.some(function(d){if(d.__N){l=!0;var h=d.__[0];d.__=d.__N,d.__N=void 0,h!==d.__[0]&&(p=!0)}}),o){var f=o.call(this,s,c,u);return l?f||p:f}return!l||p};Qe.__f=!0;var o=Qe.shouldComponentUpdate,a=Qe.componentWillUpdate;Qe.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)},Qe.shouldComponentUpdate=r}return i.__N||i.__}function Bs(e,t){var n=Ls(Tr++,3);!st.__s&&Yl(n.__H,t)&&(n.__=e,n.u=t,Qe.__H.__h.push(n))}function Ul(e,t){var n=Ls(Tr++,4);!st.__s&&Yl(n.__H,t)&&(n.__=e,n.u=t,Qe.__h.push(n))}function Ns(e){return Mo=5,Wn(function(){return{current:e}},[])}function Wn(e,t){var n=Ls(Tr++,7);return Yl(n.__H,t)&&(n.__=e(),n.__H=t,n.__h=e),n.__}function ko(e,t){return Mo=8,Wn(function(){return e},t)}function JP(){for(var e;e=lv.shift();){var t=e.__H;if(e.__P&&t)try{t.__h.some($s),t.__h.some(ql),t.__h=[]}catch(n){t.__h=[],st.__e(n,e.__v)}}}st.__b=function(e){Qe=null,pv&&pv(e)},st.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),gv&&gv(e,t)},st.__r=function(e){fv&&fv(e),Tr=0;var t=(Qe=e.__c).__H;t&&(Gl===Qe?(t.__h=[],Qe.__h=[],t.__.some(function(n){n.__N&&(n.__=n.__N),n.u=n.__N=void 0})):(t.__h.some($s),t.__h.some(ql),t.__h=[],Tr=0)),Gl=Qe},st.diffed=function(e){dv&&dv(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(lv.push(t)!==1&&uv===st.requestAnimationFrame||((uv=st.requestAnimationFrame)||eA)(JP)),t.__H.__.some(function(n){n.u&&(n.__H=n.u,n.u=void 0)})),Gl=Qe=null},st.__c=function(e,t){t.some(function(n){try{n.__h.some($s),n.__h=n.__h.filter(function(i){return!i.__||ql(i)})}catch(i){t.some(function(r){r.__h&&(r.__h=[])}),t=[],st.__e(i,n.__v)}}),hv&&hv(e,t)},st.unmount=function(e){mv&&mv(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.some(function(i){try{$s(i)}catch(r){t=r}}),n.__H=void 0,t&&st.__e(t,n.__v))};var vv=typeof requestAnimationFrame=="function";function eA(e){var t,n=function(){clearTimeout(i),vv&&cancelAnimationFrame(t),setTimeout(e)},i=setTimeout(n,35);vv&&(t=requestAnimationFrame(n))}function $s(e){var t=Qe,n=e.__c;typeof n=="function"&&(e.__c=void 0,n()),Qe=t}function ql(e){var t=Qe;e.__c=e.__(),Qe=t}function Yl(e,t){return!e||e.length!==t.length||t.some(function(n,i){return n!==e[i]})}function yv(e,t){return typeof t=="function"?t(e):t}function tA(e){const{navigationStack:t,setNavigationStack:n}=e,i=Wn(()=>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 Oe`
9
+ <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}},Ke.prototype._setDefinitions=function(e){this._definitions=e},Ke.prototype.getModules=function(){return this._modules},Ke.prototype.clear=function(){this.getDefinitions()&&Di.prototype.clear.call(this)},Ke.prototype.destroy=function(){Di.prototype.destroy.call(this),Fn(this._container)},Ke.prototype.on=function(e,t,n,i){return this.get("eventBus").on(e,t,n,i)},Ke.prototype.off=function(e,t){this.get("eventBus").off(e,t)},Ke.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=Be(e)),e.appendChild(this._container),this._emit("attach",{}),this.get("canvas").resized()},Ke.prototype.getDefinitions=function(){return this._definitions},Ke.prototype.detach=function(){const e=this._container,t=e.parentNode;t&&(this._emit("detach",{}),t.removeChild(e))},Ke.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=k(Ln(n,["additionalModules"]),{canvas:k({},n.canvas,{container:e}),modules:a});Di.call(this,s),n&&n.container&&this.attachTo(n.container)},Ke.prototype._emit=function(e,t){return this.get("eventBus").fire(e,t)},Ke.prototype._createContainer=function(e){const t=Ge('<div class="bjs-container"></div>');return Wt(t,{width:ih(e.width),height:ih(e.height),position:e.position}),t},Ke.prototype._createModdle=function(e){const t=k({},this._moddleExtensions,e.moddleExtensions);return new Cf(t)},Ke.prototype._modules=[];function Ua(e,t){return e.warnings=t,e}function Pw(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 Aw={width:"100%",height:"100%",position:"relative"};function ih(e){return e+(he(e)?"px":"")}function Tw(e,t){return t&&He(e.diagrams,function(n){return n.id===t})||null}function Mw(e){const n='<a href="http://bpmn.io" target="_blank" class="bjs-powered-by" title="Powered by bpmn.io" >'+Jd+"</a>",i=Ge(n);Wt(Be("svg",i),eh),Wt(i,th,{position:"absolute",bottom:"15px",right:"15px",zIndex:"100"}),e.appendChild(i),me.bind(i,"click",function(r){Cw(),r.preventDefault()})}function Nr(e){Ke.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)}Q(Nr,Ke),Nr.prototype._createModdle=function(e){var t=Ke.prototype._createModdle.call(this,e);return t.ids=new jn([32,36,1]),t},Nr.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 Re(e,t){return y(e,"bpmn:CallActivity")?!1:y(e,"bpmn:SubProcess")?(t=t||Me(e),t&&y(t,"bpmndi:BPMNPlane")?!0:t&&!!t.isExpanded):y(e,"bpmn:Participant")?!!U(e).processRef:!0}function St(e){if(!(!y(e,"bpmn:Participant")&&!y(e,"bpmn:Lane"))){var t=Me(e).isHorizontal;return t===void 0?!0:t}}function kw(e){return e&&U(e).isInterrupting!==!1}function jt(e){return e&&!!U(e).triggeredByEvent}function $r(e,t){var n=U(e).eventDefinitions;return bi(n,function(i){return y(i,t)})}function Dw(e){return $r(e,"bpmn:ErrorEventDefinition")}function Ow(e){return $r(e,"bpmn:EscalationEventDefinition")}function Iw(e){return $r(e,"bpmn:CompensateEventDefinition")}var fr={width:90,height:20},rh=15;function Oi(e){return y(e,"bpmn:Event")||y(e,"bpmn:Gateway")||y(e,"bpmn:DataStoreReference")||y(e,"bpmn:DataObjectReference")||y(e,"bpmn:DataInput")||y(e,"bpmn:DataOutput")||y(e,"bpmn:SequenceFlow")||y(e,"bpmn:MessageFlow")||y(e,"bpmn:Group")}function qa(e){return _e(e.label)}function Lw(e){var t=e.length/2-1,n=e[Math.floor(t)],i=e[Math.ceil(t+.01)],r=Bw(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-=rh:a+=rh,{x:a,y:s}}function Bw(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 Pu(e){return e.waypoints?Lw(e.waypoints):y(e,"bpmn:Group")?{x:e.x+e.width/2,y:e.y+fr.height/2}:{x:e.x+e.width/2,y:e.y+e.height+fr.height/2}}function Nw(e,t){var n,i,r,o=e.label;return o&&o.bounds?(r=o.bounds,i={width:Math.max(fr.width,r.width),height:r.height},n={x:r.x+r.width/2,y:r.y+r.height/2}):(n=Pu(t),i=fr),k({x:n.x-i.width/2,y:n.y-i.height/2},i)}function oh(e){if(y(e,"bpmn:FlowElement")||y(e,"bpmn:Participant")||y(e,"bpmn:Lane")||y(e,"bpmn:SequenceFlow")||y(e,"bpmn:MessageFlow")||y(e,"bpmn:DataInput")||y(e,"bpmn:DataOutput"))return"name";if(y(e,"bpmn:TextAnnotation"))return"text";if(y(e,"bpmn:Group"))return"categoryValueRef"}function $w(e){var t=e.categoryValueRef;return t&&t.value||""}function hn(e){var t=e.businessObject,n=oh(t);if(n)return n==="categoryValueRef"?$w(t):t[n]||""}function jw(e,t){var n=e.businessObject,i=oh(n);if(i)if(i==="categoryValueRef"){if(!n[i])return e;n[i].value=t}else n[i]=t;return e}function Fw(e){return _e(e)&&Oi(e.labelTarget)}var jr=7;function ah(e){let t=[];return T(e.incoming,n=>{y(n,"bpmn:Association")&&y(n.source,"bpmn:TextAnnotation")&&t.push({annotation:n.source,association:n})}),T(e.outgoing,n=>{y(n,"bpmn:Association")&&y(n.target,"bpmn:TextAnnotation")&&t.push({annotation:n.target,association:n})}),t}function Ao(e){const t=new Map;return T(bu(e),n=>{T(ah(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 Au="hsl(225, 10%, 15%)",Hw="white";function Gn(e,t){return bi(e.eventDefinitions,function(n){return n.$type===t})}function zw(e){return e.$type==="bpmn:IntermediateThrowEvent"||e.$type==="bpmn:EndEvent"}function Vw(e){var t=e.dataObjectRef;return e.isCollection||t&&t.isCollection}function Se(e,t,n){var i=Me(e);return n||i.get("color:background-color")||i.get("bioc:fill")||t||Hw}function Z(e,t,n){var i=Me(e);return n||i.get("color:border-color")||i.get("bioc:stroke")||t||Au}function To(e,t,n,i){var r=Me(e),o=r.get("label");return i||o&&o.get("color:color")||t||Z(e,n)}function sh(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 ur(r)}function Tu(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 ur(a)}function Gw(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 ur(s)}function Ww(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 ur(o)}function Mo(e,t={}){return{width:yn(e,t),height:rn(e,t)}}function yn(e,t={}){return Jt(t,"width")?t.width:e.width}function rn(e,t={}){return Jt(t,"height")?t.height:e.height}var Uw=new jn,qw=10,Ya=3,Yw=1.5,Ka=10,Kw=4,Fr=.95,Xw=1,Zw=.25;function dr(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(R){return n.computeStyle(R,{strokeLinecap:"round",strokeLinejoin:"round",stroke:Au,strokeWidth:2,fill:"white"})}function p(R){return n.computeStyle(R,["no-fill"],{strokeLinecap:"round",strokeLinejoin:"round",stroke:Au,strokeWidth:2})}function f(R,_){var{ref:v={x:0,y:0},scale:M=1,element:O,parentGfx:H=r._svg}=_,ne=se("marker",{id:R,viewBox:"0 0 20 20",refX:v.x,refY:v.y,markerWidth:20*M,markerHeight:20*M,orient:"auto"});ge(ne,O);var ye=Be(":scope > defs",H);ye||(ye=se("defs"),ge(H,ye)),ge(ye,ne)}function d(R,_,v,M){var O=Uw.nextPrefixed("marker-");return h(R,O,_,v,M),"url(#"+O+")"}function h(R,_,v,M,O){if(v==="sequenceflow-end"){var H=se("path",{d:"M 1 5 L 11 10 L 1 15 Z",...l({fill:O,stroke:O,strokeWidth:1})});f(_,{element:H,ref:{x:11,y:10},scale:.5,parentGfx:R})}if(v==="messageflow-start"){var ne=se("circle",{cx:6,cy:6,r:3.5,...l({fill:M,stroke:O,strokeWidth:1,strokeDasharray:[1e4,1]})});f(_,{element:ne,ref:{x:6,y:6},parentGfx:R})}if(v==="messageflow-end"){var ye=se("path",{d:"m 1 5 l 0 -3 l 7 3 l -7 3 z",...l({fill:M,stroke:O,strokeWidth:1,strokeDasharray:[1e4,1]})});f(_,{element:ye,ref:{x:8.5,y:5},parentGfx:R})}if(v==="association-start"){var De=se("path",{d:"M 11 5 L 1 10 L 11 15",...p({fill:"none",stroke:O,strokeWidth:1.5,strokeDasharray:[1e4,1]})});f(_,{element:De,ref:{x:1,y:10},scale:.5,parentGfx:R})}if(v==="association-end"){var et=se("path",{d:"M 1 5 L 11 10 L 1 15",...p({fill:"none",stroke:O,strokeWidth:1.5,strokeDasharray:[1e4,1]})});f(_,{element:et,ref:{x:11,y:10},scale:.5,parentGfx:R})}if(v==="conditional-flow-marker"){var Ne=se("path",{d:"M 0 10 L 8 6 L 16 10 L 8 14 Z",...l({fill:M,stroke:O})});f(_,{element:Ne,ref:{x:-1,y:10},scale:.5,parentGfx:R})}if(v==="conditional-default-flow-marker"){var ft=se("path",{d:"M 6 4 L 10 16",...l({stroke:O,fill:"none"})});f(_,{element:ft,ref:{x:0,y:10},scale:.5,parentGfx:R})}}function m(R,_,v,M,O={}){xt(M)&&(O=M,M=0),M=M||0,O=l(O);var H=_/2,ne=v/2,ye=se("circle",{cx:H,cy:ne,r:Math.round((_+v)/4-M),...O});return ge(R,ye),ye}function g(R,_,v,M,O,H){xt(O)&&(H=O,O=0),O=O||0,H=l(H);var ne=se("rect",{x:O,y:O,width:_-O*2,height:v-O*2,rx:M,ry:M,...H});return ge(R,ne),ne}function w(R,_,v,M){var O=_/2,H=v/2,ne=[{x:O,y:0},{x:_,y:H},{x:O,y:v},{x:0,y:H}],ye=ne.map(function(et){return et.x+","+et.y}).join(" ");M=l(M);var De=se("polygon",{...M,points:ye});return ge(R,De),De}function E(R,_,v,M){v=p(v);var O=xo(_,v,M);return ge(R,O),O}function b(R,_,v){return E(R,_,v,5)}function x(R,_,v){v=p(v);var M=se("path",{...v,d:_});return ge(R,M),M}function S(R,_,v,M){return x(_,v,k({"data-marker":R},M))}function A(R){return bt[R]}function I(R){return function(_,v,M){return A(R)(_,v,M)}}var C={"bpmn:MessageEventDefinition":function(R,_,v={},M){var O=i.getScaledPath("EVENT_MESSAGE",{xScaleFactor:.9,yScaleFactor:.9,containerWidth:v.width||_.width,containerHeight:v.height||_.height,position:{mx:.235,my:.315}}),H=M?Z(_,c,v.stroke):Se(_,s,v.fill),ne=M?Se(_,s,v.fill):Z(_,c,v.stroke),ye=x(R,O,{fill:H,stroke:ne,strokeWidth:1});return ye},"bpmn:TimerEventDefinition":function(R,_,v={}){var M=v.width||_.width,O=v.height||_.height,H=v.width?1:2,ne=m(R,M,O,.2*O,{fill:Se(_,s,v.fill),stroke:Z(_,c,v.stroke),strokeWidth:H}),ye=i.getScaledPath("EVENT_TIMER_WH",{xScaleFactor:.75,yScaleFactor:.75,containerWidth:M,containerHeight:O,position:{mx:.5,my:.5}});x(R,ye,{stroke:Z(_,c,v.stroke),strokeWidth:H});for(var De=0;De<12;De++){var et=i.getScaledPath("EVENT_TIMER_LINE",{xScaleFactor:.75,yScaleFactor:.75,containerWidth:M,containerHeight:O,position:{mx:.5,my:.5}}),Ne=M/2,ft=O/2;x(R,et,{strokeWidth:1,stroke:Z(_,c,v.stroke),transform:"rotate("+De*30+","+ft+","+Ne+")"})}return ne},"bpmn:EscalationEventDefinition":function(R,_,v={},M){var O=i.getScaledPath("EVENT_ESCALATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:v.width||_.width,containerHeight:v.height||_.height,position:{mx:.5,my:.2}}),H=M?Z(_,c,v.stroke):Se(_,s,v.fill);return x(R,O,{fill:H,stroke:Z(_,c,v.stroke),strokeWidth:1})},"bpmn:ConditionalEventDefinition":function(R,_,v={}){var M=i.getScaledPath("EVENT_CONDITIONAL",{xScaleFactor:1,yScaleFactor:1,containerWidth:v.width||_.width,containerHeight:v.height||_.height,position:{mx:.5,my:.222}});return x(R,M,{fill:Se(_,s,v.fill),stroke:Z(_,c,v.stroke),strokeWidth:1})},"bpmn:LinkEventDefinition":function(R,_,v={},M){var O=i.getScaledPath("EVENT_LINK",{xScaleFactor:1,yScaleFactor:1,containerWidth:_.width,containerHeight:_.height,position:{mx:.57,my:.263}}),H=M?Z(_,c,v.stroke):Se(_,s,v.fill);return x(R,O,{fill:H,stroke:Z(_,c,v.stroke),strokeWidth:1})},"bpmn:ErrorEventDefinition":function(R,_,v={},M){var O=i.getScaledPath("EVENT_ERROR",{xScaleFactor:1.1,yScaleFactor:1.1,containerWidth:v.width||_.width,containerHeight:v.height||_.height,position:{mx:.2,my:.722}}),H=M?Z(_,c,v.stroke):Se(_,s,v.fill);return x(R,O,{fill:H,stroke:Z(_,c,v.stroke),strokeWidth:1})},"bpmn:CancelEventDefinition":function(R,_,v={},M){var O=i.getScaledPath("EVENT_CANCEL_45",{xScaleFactor:1,yScaleFactor:1,containerWidth:_.width,containerHeight:_.height,position:{mx:.638,my:-.055}}),H=M?Z(_,c,v.stroke):"none",ne=x(R,O,{fill:H,stroke:Z(_,c,v.stroke),strokeWidth:1});return Zd(ne,45),ne},"bpmn:CompensateEventDefinition":function(R,_,v={},M){var O=i.getScaledPath("EVENT_COMPENSATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:v.width||_.width,containerHeight:v.height||_.height,position:{mx:.22,my:.5}}),H=M?Z(_,c,v.stroke):Se(_,s,v.fill);return x(R,O,{fill:H,stroke:Z(_,c,v.stroke),strokeWidth:1})},"bpmn:SignalEventDefinition":function(R,_,v={},M){var O=i.getScaledPath("EVENT_SIGNAL",{xScaleFactor:.9,yScaleFactor:.9,containerWidth:v.width||_.width,containerHeight:v.height||_.height,position:{mx:.5,my:.2}}),H=M?Z(_,c,v.stroke):Se(_,s,v.fill);return x(R,O,{strokeWidth:1,fill:H,stroke:Z(_,c,v.stroke)})},"bpmn:MultipleEventDefinition":function(R,_,v={},M){var O=i.getScaledPath("EVENT_MULTIPLE",{xScaleFactor:1.1,yScaleFactor:1.1,containerWidth:v.width||_.width,containerHeight:v.height||_.height,position:{mx:.211,my:.36}}),H=M?Z(_,c,v.stroke):Se(_,s,v.fill);return x(R,O,{fill:H,stroke:Z(_,c,v.stroke),strokeWidth:1})},"bpmn:ParallelMultipleEventDefinition":function(R,_,v={}){var M=i.getScaledPath("EVENT_PARALLEL_MULTIPLE",{xScaleFactor:1.2,yScaleFactor:1.2,containerWidth:v.width||_.width,containerHeight:v.height||_.height,position:{mx:.458,my:.194}});return x(R,M,{fill:Se(_,s,v.fill),stroke:Z(_,c,v.stroke),strokeWidth:1})},"bpmn:TerminateEventDefinition":function(R,_,v={}){var M=m(R,_.width,_.height,8,{fill:Z(_,c,v.stroke),stroke:Z(_,c,v.stroke),strokeWidth:4});return M}};function $(R,_,v={},M){var O=U(R),H=zw(O),ne=M||R;return O.get("eventDefinitions")&&O.get("eventDefinitions").length>1?O.get("parallelMultiple")?C["bpmn:ParallelMultipleEventDefinition"](_,ne,v,H):C["bpmn:MultipleEventDefinition"](_,ne,v,H):Gn(O,"bpmn:MessageEventDefinition")?C["bpmn:MessageEventDefinition"](_,ne,v,H):Gn(O,"bpmn:TimerEventDefinition")?C["bpmn:TimerEventDefinition"](_,ne,v,H):Gn(O,"bpmn:ConditionalEventDefinition")?C["bpmn:ConditionalEventDefinition"](_,ne,v,H):Gn(O,"bpmn:SignalEventDefinition")?C["bpmn:SignalEventDefinition"](_,ne,v,H):Gn(O,"bpmn:EscalationEventDefinition")?C["bpmn:EscalationEventDefinition"](_,ne,v,H):Gn(O,"bpmn:LinkEventDefinition")?C["bpmn:LinkEventDefinition"](_,ne,v,H):Gn(O,"bpmn:ErrorEventDefinition")?C["bpmn:ErrorEventDefinition"](_,ne,v,H):Gn(O,"bpmn:CancelEventDefinition")?C["bpmn:CancelEventDefinition"](_,ne,v,H):Gn(O,"bpmn:CompensateEventDefinition")?C["bpmn:CompensateEventDefinition"](_,ne,v,H):Gn(O,"bpmn:TerminateEventDefinition")?C["bpmn:TerminateEventDefinition"](_,ne,v,H):null}var j={ParticipantMultiplicityMarker:function(R,_,v={}){var M=yn(_,v),O=rn(_,v),H=i.getScaledPath("MARKER_PARALLEL",{xScaleFactor:1,yScaleFactor:1,containerWidth:M,containerHeight:O,position:{mx:(M/2-6)/M,my:(O-15)/O}});S("participant-multiplicity",R,H,{strokeWidth:2,fill:Se(_,s,v.fill),stroke:Z(_,c,v.stroke)})},SubProcessMarker:function(R,_,v={}){var M=g(R,14,14,0,{strokeWidth:1,fill:Se(_,s,v.fill),stroke:Z(_,c,v.stroke)});Tt(M,_.width/2-7.5,_.height-20);var O=i.getScaledPath("MARKER_SUB_PROCESS",{xScaleFactor:1.5,yScaleFactor:1.5,containerWidth:_.width,containerHeight:_.height,position:{mx:(_.width/2-7.5)/_.width,my:(_.height-20)/_.height}});S("sub-process",R,O,{fill:Se(_,s,v.fill),stroke:Z(_,c,v.stroke)})},ParallelMarker:function(R,_,v){var M=yn(_,v),O=rn(_,v),H=i.getScaledPath("MARKER_PARALLEL",{xScaleFactor:1,yScaleFactor:1,containerWidth:M,containerHeight:O,position:{mx:(M/2+v.parallel)/M,my:(O-20)/O}});S("parallel",R,H,{fill:Se(_,s,v.fill),stroke:Z(_,c,v.stroke)})},SequentialMarker:function(R,_,v){var M=i.getScaledPath("MARKER_SEQUENTIAL",{xScaleFactor:1,yScaleFactor:1,containerWidth:_.width,containerHeight:_.height,position:{mx:(_.width/2+v.seq)/_.width,my:(_.height-19)/_.height}});S("sequential",R,M,{fill:Se(_,s,v.fill),stroke:Z(_,c,v.stroke)})},CompensationMarker:function(R,_,v){var M=i.getScaledPath("MARKER_COMPENSATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:_.width,containerHeight:_.height,position:{mx:(_.width/2+v.compensation)/_.width,my:(_.height-13)/_.height}});S("compensation",R,M,{strokeWidth:1,fill:Se(_,s,v.fill),stroke:Z(_,c,v.stroke)})},LoopMarker:function(R,_,v){var M=yn(_,v),O=rn(_,v),H=i.getScaledPath("MARKER_LOOP",{xScaleFactor:1,yScaleFactor:1,containerWidth:M,containerHeight:O,position:{mx:(M/2+v.loop)/M,my:(O-7)/O}});S("loop",R,H,{strokeWidth:1.5,fill:"none",stroke:Z(_,c,v.stroke),strokeMiterlimit:.5})},AdhocMarker:function(R,_,v){var M=yn(_,v),O=rn(_,v),H=i.getScaledPath("MARKER_ADHOC",{xScaleFactor:1,yScaleFactor:1,containerWidth:M,containerHeight:O,position:{mx:(M/2+v.adhoc)/M,my:(O-15)/O}});S("adhoc",R,H,{strokeWidth:1,fill:Z(_,c,v.stroke),stroke:Z(_,c,v.stroke)})}};function L(R,_,v,M){j[R](_,v,M)}function F(R,_,v=[],M={}){M={fill:M.fill,stroke:M.stroke,width:yn(_,M),height:rn(_,M)};var O=U(_),H=v.includes("SubProcessMarker");H?M={...M,seq:-21,parallel:-22,compensation:-25,loop:-18,adhoc:10}:M={...M,seq:-5,parallel:-6,compensation:-7,loop:0,adhoc:-8},O.get("isForCompensation")&&v.push("CompensationMarker"),y(O,"bpmn:AdHocSubProcess")&&(v.push("AdhocMarker"),H||k(M,{compensation:M.compensation-18}));var ne=O.get("loopCharacteristics"),ye=ne&&ne.get("isSequential");ne&&(k(M,{compensation:M.compensation-18}),v.includes("AdhocMarker")&&k(M,{seq:-23,loop:-18,parallel:-24}),ye===void 0&&v.push("LoopMarker"),ye===!1&&v.push("ParallelMarker"),ye===!0&&v.push("SequentialMarker")),v.includes("CompensationMarker")&&v.length===1&&k(M,{compensation:-8}),T(v,function(De){L(De,R,_,M)})}function re(R,_,v={}){v=k({size:{width:100}},v);var M=o.createText(_||"",v);return Pe(M).add("djs-label"),ge(R,M),M}function Ae(R,_,v,M={}){var O=U(_),H=Mo({x:_.x,y:_.y,width:_.width,height:_.height},M);return re(R,O.name,{align:v,box:H,padding:7,style:{fill:To(_,u,c,M.stroke)}})}function Je(R,_,v={}){var M={width:_.width,height:_.height,x:_.width/2+_.x,y:_.height/2+_.y};return re(R,hn(_),{box:M,style:k({},o.getExternalStyle(),{fill:To(_,u,c,v.stroke)})})}function q(R,_,v,M={}){var O=St(v),H=re(R,_,{box:{height:30,width:O?rn(v,M):yn(v,M)},align:"center-middle",style:{fill:To(v,u,c,M.stroke)}});if(O){var ne=-1*rn(v,M);Ga(H,0,-ne,270)}}function ae(R,_,v={}){var{width:M,height:O}=Mo(_,v);return g(R,M,O,Ka,{...v,fill:Se(_,s,v.fill),fillOpacity:Fr,stroke:Z(_,c,v.stroke)})}function ue(R,_,v={}){var M=U(_),O=Se(_,s,v.fill),H=Z(_,c,v.stroke);return(M.get("associationDirection")==="One"||M.get("associationDirection")==="Both")&&(v.markerEnd=d(R,"association-end",O,H)),M.get("associationDirection")==="Both"&&(v.markerStart=d(R,"association-start",O,H)),v=ke(v,["markerStart","markerEnd"]),b(R,_.waypoints,{...v,stroke:H,strokeDasharray:"0, 5"})}function oe(R,_,v={}){var M=Se(_,s,v.fill),O=Z(_,c,v.stroke),H=i.getScaledPath("DATA_OBJECT_PATH",{xScaleFactor:1,yScaleFactor:1,containerWidth:_.width,containerHeight:_.height,position:{mx:.474,my:.296}}),ne=x(R,H,{fill:M,fillOpacity:Fr,stroke:O}),ye=U(_);if(Vw(ye)){var De=i.getScaledPath("DATA_OBJECT_COLLECTION_PATH",{xScaleFactor:1,yScaleFactor:1,containerWidth:_.width,containerHeight:_.height,position:{mx:.33,my:(_.height-18)/_.height}});x(R,De,{strokeWidth:2,fill:M,stroke:O})}return ne}function ce(R,_,v={}){return m(R,_.width,_.height,{fillOpacity:Fr,...v,fill:Se(_,s,v.fill),stroke:Z(_,c,v.stroke)})}function X(R,_,v={}){return w(R,_.width,_.height,{fill:Se(_,s,v.fill),fillOpacity:Fr,stroke:Z(_,c,v.stroke)})}function B(R,_,v={}){var M=g(R,yn(_,v),rn(_,v),0,{fill:Se(_,s,v.fill),fillOpacity:v.fillOpacity||Fr,stroke:Z(_,c,v.stroke),strokeWidth:1.5}),O=U(_);if(y(O,"bpmn:Lane")){var H=O.get("name");q(R,H,_,v)}return M}function N(R,_,v={}){var M=ae(R,_,v),O=Re(_);if(jt(_)&&(J(M,{strokeDasharray:"0, 5.5",strokeWidth:2.5}),!O)){var H=U(_).flowElements||[],ne=H.filter(ye=>y(ye,"bpmn:StartEvent"));ne.length===1&&V(ne[0],R,v,_)}return Ae(R,_,O?"center-top":"center-middle",v),O?F(R,_,void 0,v):F(R,_,["SubProcessMarker"],v),M}function V(R,_,v,M){var O=22,H={fill:Se(M,s,v.fill),stroke:Z(M,c,v.stroke),width:O,height:O},ne=U(R).isInterrupting,ye=ne?0:3,De=ne?1:1.2,et=20,Ne=(O-et)/2,ft="translate("+Ne+","+Ne+")";m(_,et,et,{fill:H.fill,stroke:H.stroke,strokeWidth:De,strokeDasharray:ye,transform:ft}),$(R,_,H,M)}function be(R,_,v={}){var M=ae(R,_,v);return Ae(R,_,"center-middle",v),F(R,_,void 0,v),M}var bt=this.handlers={"bpmn:AdHocSubProcess":function(R,_,v={}){return Re(_)?v=ke(v,["fill","stroke","width","height"]):v=ke(v,["fill","stroke"]),N(R,_,v)},"bpmn:Association":function(R,_,v={}){return v=ke(v,["fill","stroke"]),ue(R,_,v)},"bpmn:BoundaryEvent":function(R,_,v={}){var{renderIcon:M=!0}=v;v=ke(v,["fill","stroke"]);var O=U(_),H=O.get("cancelActivity");v={strokeWidth:1.5,fill:Se(_,s,v.fill),fillOpacity:Xw,stroke:Z(_,c,v.stroke)},H||(v.strokeDasharray="6");var ne=ce(R,_,v);return m(R,_.width,_.height,Ya,{...v,fill:"none"}),M&&$(_,R,v),ne},"bpmn:BusinessRuleTask":function(R,_,v={}){v=ke(v,["fill","stroke"]);var M=be(R,_,v),O=i.getScaledPath("TASK_TYPE_BUSINESS_RULE_MAIN",{abspos:{x:8,y:8}}),H=x(R,O);J(H,{fill:Se(_,s,v.fill),stroke:Z(_,c,v.stroke),strokeWidth:1});var ne=i.getScaledPath("TASK_TYPE_BUSINESS_RULE_HEADER",{abspos:{x:8,y:8}}),ye=x(R,ne);return J(ye,{fill:Z(_,c,v.stroke),stroke:Z(_,c,v.stroke),strokeWidth:1}),M},"bpmn:CallActivity":function(R,_,v={}){return v=ke(v,["fill","stroke"]),N(R,_,{strokeWidth:5,...v})},"bpmn:ComplexGateway":function(R,_,v={}){v=ke(v,["fill","stroke"]);var M=X(R,_,v),O=i.getScaledPath("GATEWAY_COMPLEX",{xScaleFactor:.5,yScaleFactor:.5,containerWidth:_.width,containerHeight:_.height,position:{mx:.46,my:.26}});return x(R,O,{fill:Z(_,c,v.stroke),stroke:Z(_,c,v.stroke),strokeWidth:1}),M},"bpmn:DataInput":function(R,_,v={}){v=ke(v,["fill","stroke"]);var M=i.getRawPath("DATA_ARROW"),O=oe(R,_,v);return x(R,M,{fill:"none",stroke:Z(_,c,v.stroke),strokeWidth:1}),O},"bpmn:DataInputAssociation":function(R,_,v={}){return v=ke(v,["fill","stroke"]),ue(R,_,{...v,markerEnd:d(R,"association-end",Se(_,s,v.fill),Z(_,c,v.stroke))})},"bpmn:DataObject":function(R,_,v={}){return v=ke(v,["fill","stroke"]),oe(R,_,v)},"bpmn:DataObjectReference":I("bpmn:DataObject"),"bpmn:DataOutput":function(R,_,v={}){v=ke(v,["fill","stroke"]);var M=i.getRawPath("DATA_ARROW"),O=oe(R,_,v);return x(R,M,{strokeWidth:1,fill:Z(_,c,v.stroke),stroke:Z(_,c,v.stroke)}),O},"bpmn:DataOutputAssociation":function(R,_,v={}){return v=ke(v,["fill","stroke"]),ue(R,_,{...v,markerEnd:d(R,"association-end",Se(_,s,v.fill),Z(_,c,v.stroke))})},"bpmn:DataStoreReference":function(R,_,v={}){v=ke(v,["fill","stroke"]);var M=i.getScaledPath("DATA_STORE",{xScaleFactor:1,yScaleFactor:1,containerWidth:_.width,containerHeight:_.height,position:{mx:0,my:.133}});return x(R,M,{fill:Se(_,s,v.fill),fillOpacity:Fr,stroke:Z(_,c,v.stroke),strokeWidth:2})},"bpmn:EndEvent":function(R,_,v={}){var{renderIcon:M=!0}=v;v=ke(v,["fill","stroke"]);var O=ce(R,_,{...v,strokeWidth:4});return M&&$(_,R,v),O},"bpmn:EventBasedGateway":function(R,_,v={}){v=ke(v,["fill","stroke"]);var M=U(_),O=X(R,_,v);m(R,_.width,_.height,_.height*.2,{fill:Se(_,"none",v.fill),stroke:Z(_,c,v.stroke),strokeWidth:1});var H=M.get("eventGatewayType"),ne=!!M.get("instantiate");function ye(){var et=i.getScaledPath("GATEWAY_EVENT_BASED",{xScaleFactor:.18,yScaleFactor:.18,containerWidth:_.width,containerHeight:_.height,position:{mx:.36,my:.44}});x(R,et,{fill:"none",stroke:Z(_,c,v.stroke),strokeWidth:2})}if(H==="Parallel"){var De=i.getScaledPath("GATEWAY_PARALLEL",{xScaleFactor:.4,yScaleFactor:.4,containerWidth:_.width,containerHeight:_.height,position:{mx:.474,my:.296}});x(R,De,{fill:"none",stroke:Z(_,c,v.stroke),strokeWidth:1})}else H==="Exclusive"&&(ne||m(R,_.width,_.height,_.height*.26,{fill:"none",stroke:Z(_,c,v.stroke),strokeWidth:1}),ye());return O},"bpmn:ExclusiveGateway":function(R,_,v={}){v=ke(v,["fill","stroke"]);var M=X(R,_,v),O=i.getScaledPath("GATEWAY_EXCLUSIVE",{xScaleFactor:.4,yScaleFactor:.4,containerWidth:_.width,containerHeight:_.height,position:{mx:.32,my:.3}}),H=Me(_);return H.get("isMarkerVisible")&&x(R,O,{fill:Z(_,c,v.stroke),stroke:Z(_,c,v.stroke),strokeWidth:1}),M},"bpmn:Gateway":function(R,_,v={}){return v=ke(v,["fill","stroke"]),X(R,_,v)},"bpmn:Group":function(R,_,v={}){return v=ke(v,["fill","stroke","width","height"]),g(R,_.width,_.height,Ka,{stroke:Z(_,c,v.stroke),strokeWidth:1.5,strokeDasharray:"10, 6, 0, 6",fill:"none",pointerEvents:"none",width:yn(_,v),height:rn(_,v)})},"bpmn:InclusiveGateway":function(R,_,v={}){v=ke(v,["fill","stroke"]);var M=X(R,_,v);return m(R,_.width,_.height,_.height*.24,{fill:Se(_,s,v.fill),stroke:Z(_,c,v.stroke),strokeWidth:2.5}),M},"bpmn:IntermediateEvent":function(R,_,v={}){var{renderIcon:M=!0}=v;v=ke(v,["fill","stroke"]);var O=ce(R,_,{...v,strokeWidth:1.5});return m(R,_.width,_.height,Ya,{fill:"none",stroke:Z(_,c,v.stroke),strokeWidth:1.5}),M&&$(_,R,v),O},"bpmn:IntermediateCatchEvent":I("bpmn:IntermediateEvent"),"bpmn:IntermediateThrowEvent":I("bpmn:IntermediateEvent"),"bpmn:Lane":function(R,_,v={}){return v=ke(v,["fill","stroke","width","height"]),B(R,_,{...v,fillOpacity:Zw})},"bpmn:ManualTask":function(R,_,v={}){v=ke(v,["fill","stroke"]);var M=be(R,_,v),O=i.getScaledPath("TASK_TYPE_MANUAL",{abspos:{x:17,y:15}});return x(R,O,{fill:Se(_,s,v.fill),stroke:Z(_,c,v.stroke),strokeWidth:.5}),M},"bpmn:MessageFlow":function(R,_,v={}){v=ke(v,["fill","stroke"]);var M=U(_),O=Me(_),H=Se(_,s,v.fill),ne=Z(_,c,v.stroke),ye=b(R,_.waypoints,{markerEnd:d(R,"messageflow-end",H,ne),markerStart:d(R,"messageflow-start",H,ne),stroke:ne,strokeDasharray:"10, 11",strokeWidth:1.5});if(M.get("messageRef")){var De=ye.getPointAtLength(ye.getTotalLength()/2),et=i.getScaledPath("MESSAGE_FLOW_MARKER",{abspos:{x:De.x,y:De.y}}),Ne={strokeWidth:1};O.get("messageVisibleKind")==="initiating"?(Ne.fill=H,Ne.stroke=ne):(Ne.fill=ne,Ne.stroke=H);var ft=x(R,et,Ne),Dt=M.get("messageRef"),Ft=Dt.get("name"),Le=re(R,Ft,{align:"center-top",fitBox:!0,style:{fill:ne}}),dt=ft.getBBox(),Ht=Le.getBBox(),Rr=De.x-Ht.width/2,mn=De.y+dt.height/2+qw;Ga(Le,Rr,mn,0)}return ye},"bpmn:ParallelGateway":function(R,_,v={}){v=ke(v,["fill","stroke"]);var M=X(R,_,v),O=i.getScaledPath("GATEWAY_PARALLEL",{xScaleFactor:.6,yScaleFactor:.6,containerWidth:_.width,containerHeight:_.height,position:{mx:.46,my:.2}});return x(R,O,{fill:Z(_,c,v.stroke),stroke:Z(_,c,v.stroke),strokeWidth:1}),M},"bpmn:Participant":function(R,_,v={}){v=ke(v,["fill","stroke","width","height"]);var M=B(R,_,v),O=Re(_),H=St(_),ne=U(_),ye=ne.get("name");if(O){var De=H?[{x:30,y:0},{x:30,y:rn(_,v)}]:[{x:0,y:30},{x:yn(_,v),y:30}];E(R,De,{stroke:Z(_,c,v.stroke),strokeWidth:Yw}),q(R,ye,_,v)}else{var et=Mo(_,v);H||(et.height=yn(_,v),et.width=rn(_,v));var Ne=re(R,ye,{box:et,align:"center-middle",style:{fill:To(_,u,c,v.stroke)}});if(!H){var ft=-1*rn(_,v);Ga(Ne,0,-ft,270)}}return ne.get("participantMultiplicity")&&L("ParticipantMultiplicityMarker",R,_,v),M},"bpmn:ReceiveTask":function(R,_,v={}){v=ke(v,["fill","stroke"]);var M=U(_),O=be(R,_,v),H;return M.get("instantiate")?(m(R,28,28,20*.22,{fill:Se(_,s,v.fill),stroke:Z(_,c,v.stroke),strokeWidth:1}),H=i.getScaledPath("TASK_TYPE_INSTANTIATING_SEND",{abspos:{x:7.77,y:9.52}})):H=i.getScaledPath("TASK_TYPE_SEND",{xScaleFactor:.9,yScaleFactor:.9,containerWidth:21,containerHeight:14,position:{mx:.3,my:.4}}),x(R,H,{fill:Se(_,s,v.fill),stroke:Z(_,c,v.stroke),strokeWidth:1}),O},"bpmn:ScriptTask":function(R,_,v={}){v=ke(v,["fill","stroke"]);var M=be(R,_,v),O=i.getScaledPath("TASK_TYPE_SCRIPT",{abspos:{x:15,y:20}});return x(R,O,{fill:Se(_,s,v.fill),stroke:Z(_,c,v.stroke),strokeWidth:1}),M},"bpmn:SendTask":function(R,_,v={}){v=ke(v,["fill","stroke"]);var M=be(R,_,v),O=i.getScaledPath("TASK_TYPE_SEND",{xScaleFactor:1,yScaleFactor:1,containerWidth:21,containerHeight:14,position:{mx:.285,my:.357}});return x(R,O,{fill:Z(_,c,v.stroke),stroke:Se(_,s,v.fill),strokeWidth:1}),M},"bpmn:SequenceFlow":function(R,_,v={}){v=ke(v,["fill","stroke"]);var M=Se(_,s,v.fill),O=Z(_,c,v.stroke),H=b(R,_.waypoints,{markerEnd:d(R,"sequenceflow-end",M,O),stroke:O}),ne=U(_),{source:ye}=_;if(ye){var De=U(ye);ne.get("conditionExpression")&&y(De,"bpmn:Activity")&&J(H,{markerStart:d(R,"conditional-flow-marker",M,O)}),De.get("default")&&(y(De,"bpmn:Gateway")||y(De,"bpmn:Activity"))&&De.get("default")===ne&&J(H,{markerStart:d(R,"conditional-default-flow-marker",M,O)})}return H},"bpmn:ServiceTask":function(R,_,v={}){v=ke(v,["fill","stroke"]);var M=be(R,_,v);m(R,10,10,{fill:Se(_,s,v.fill),stroke:"none",transform:"translate(6, 6)"});var O=i.getScaledPath("TASK_TYPE_SERVICE",{abspos:{x:12,y:18}});x(R,O,{fill:Se(_,s,v.fill),stroke:Z(_,c,v.stroke),strokeWidth:1}),m(R,10,10,{fill:Se(_,s,v.fill),stroke:"none",transform:"translate(11, 10)"});var H=i.getScaledPath("TASK_TYPE_SERVICE",{abspos:{x:17,y:22}});return x(R,H,{fill:Se(_,s,v.fill),stroke:Z(_,c,v.stroke),strokeWidth:1}),M},"bpmn:StartEvent":function(R,_,v={}){var{renderIcon:M=!0}=v;v=ke(v,["fill","stroke"]);var O=U(_);O.get("isInterrupting")||(v={...v,strokeDasharray:"6"});var H=ce(R,_,v);return M&&$(_,R,v),H},"bpmn:SubProcess":function(R,_,v={}){return Re(_)?v=ke(v,["fill","stroke","width","height"]):v=ke(v,["fill","stroke"]),N(R,_,v)},"bpmn:Task":function(R,_,v={}){return v=ke(v,["fill","stroke"]),be(R,_,v)},"bpmn:TextAnnotation":function(R,_,v={}){v=ke(v,["fill","stroke"]);var{width:M,height:O}=Mo(_,v),H=g(R,M,O,0,0,{fill:"none",stroke:"none"}),ne=i.getScaledPath("TEXT_ANNOTATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:M,containerHeight:O,position:{mx:0,my:0}});x(R,ne,{stroke:Z(_,c,v.stroke)});var ye=U(_),De=ye.get("text")||"";return re(R,De,{align:"left-top",box:Mo(_,v),padding:jr,style:{fill:To(_,u,c,v.stroke)}}),H},"bpmn:Transaction":function(R,_,v={}){Re(_)?v=ke(v,["fill","stroke","width","height"]):v=ke(v,["fill","stroke"]);var M=N(R,_,{strokeWidth:1.5,...v}),O=n.style(["no-fill","no-events"],{stroke:Z(_,c,v.stroke),strokeWidth:1.5}),H=Re(_);return H||(v={}),g(R,yn(_,v),rn(_,v),Ka-Ya,Ya,O),M},"bpmn:UserTask":function(R,_,v={}){v=ke(v,["fill","stroke"]);var M=be(R,_,v),O=15,H=12,ne=i.getScaledPath("TASK_TYPE_USER_1",{abspos:{x:O,y:H}});x(R,ne,{fill:Se(_,s,v.fill),stroke:Z(_,c,v.stroke),strokeWidth:.5});var ye=i.getScaledPath("TASK_TYPE_USER_2",{abspos:{x:O,y:H}});x(R,ye,{fill:Se(_,s,v.fill),stroke:Z(_,c,v.stroke),strokeWidth:.5});var De=i.getScaledPath("TASK_TYPE_USER_3",{abspos:{x:O,y:H}});return x(R,De,{fill:Z(_,c,v.stroke),stroke:Z(_,c,v.stroke),strokeWidth:.5}),M},label:function(R,_,v={}){return Je(R,_,v)}};this._drawPath=x,this._renderer=A}Q(dr,ti),dr.$inject=["config.bpmnRenderer","eventBus","styles","pathMap","canvas","textRenderer"],dr.prototype.canRender=function(e){return y(e,"bpmn:BaseElement")},dr.prototype.drawShape=function(e,t,n={}){var{type:i}=t,r=this._renderer(i);return r(e,t,n)},dr.prototype.drawConnection=function(e,t,n={}){var{type:i}=t,r=this._renderer(i);return r(e,t,n)},dr.prototype.getShapePath=function(e){return _e(e)?Tu(e,Kw):y(e,"bpmn:Event")?sh(e):y(e,"bpmn:Activity")?Tu(e,Ka):y(e,"bpmn:Gateway")?Gw(e):Ww(e)};function ke(e,t=[]){return t.reduce((n,i)=>(e[i]&&(n[i]=e[i]),n),{})}var Qw=0,Jw={width:150,height:50};function e1(e){var t=e.split("-");return{horizontal:t[0]||"center",vertical:t[1]||"top"}}function t1(e){return xt(e)?k({top:0,left:0,right:0,bottom:0},e):{top:e,left:e,right:e,bottom:e}}var Mu=null;function n1(){return Mu||(Mu=document.createElement("canvas").getContext("2d")),Mu}function i1(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(ch(e.fontSize)||"12px"),t.push(e.fontFamily||"sans-serif"),t.join(" ")}function ch(e){if(e!=null)return typeof e=="number"||/^-?\d+(\.\d+)?$/.test(e)?e+"px":e}function r1(e,t){var n=n1();if(!n)return{width:0,height:0};n.font=i1(t),"letterSpacing"in n&&(n.letterSpacing=ch(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 o1(e,t,n){for(var i=e.shift(),r=i,o;;){if(o=r1(r,n),o.width=r?o.width:0,r===" "||r===""||o.width<Math.round(t)||r.length<2)return a1(e,r,i,o);r=c1(r,o.width,t)}}function a1(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 uh="­";function s1(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===uh)&&r.pop();break}var a=r[r.length-1];return a&&a===uh&&(r[r.length-1]="-"),r.join("")}function c1(e,t,n){var i=Math.max(e.length*(n/t),1),r=s1(e,i);return r||(r=e.slice(0,Math.max(Math.round(i-1),1))),r}function Xa(e){this._config=k({},{size:Jw,padding:Qw,style:{},align:"center-top"},e||{})}Xa.prototype.createText=function(e,t){return this.layoutText(e,t).element},Xa.prototype.getDimensions=function(e,t){return this.layoutText(e,t).dimensions},Xa.prototype.layoutText=function(e,t){for(var n=k({},this._config.size,t.box),i=k({},this._config.style,t.style),r=e1(t.align||this._config.align),o=t1(t.padding!==void 0?t.padding:this._config.padding),a=t.fitBox||!1,s=u1(i),c=e.split(/\u00AD?\r?\n/),u=[],l=n.width-o.left-o.right;c.length;)u.push(o1(c,l,i));r.vertical==="middle"&&(o.top=o.bottom=0);var p=en(u,function(g,w,E){return g+(s||w.height)},0)+o.top+o.bottom,f=en(u,function(g,w,E){return w.width>g?w.width:g},0),d=o.top;r.vertical==="middle"&&(d+=(n.height-p)/2),d-=(s||u[0].height)/4;var h=se("text");J(h,i),T(u,function(g){var w;switch(d+=s||g.height,r.horizontal){case"left":w=o.left;break;case"right":w=(a?f:l)-o.right-g.width;break;default:w=Math.max(((a?f:l)-g.width)/2+o.left,0)}var E=se("tspan");J(E,{x:w,y:d}),E.textContent=g.text,ge(h,E)});var m={width:f,height:p};return{dimensions:m,element:h}};function u1(e){if("fontSize"in e&&"lineHeight"in e)return e.lineHeight*parseInt(e.fontSize,10)}var l1=12,p1=1.2,f1=40;function lh(e){var t=k({fontFamily:"Arial, sans-serif",fontSize:l1,fontWeight:"normal",lineHeight:p1},e&&e.defaultStyle||{}),n=parseInt(t.fontSize,10)-1,i=k({},t,{fontSize:n},e&&e.externalStyle||{}),r=new Xa({style:t});this.getExternalLabelBounds=function(a,s){var c={width:Math.max(a.width,fr.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:jr});return{x:a.x,y:a.y,width:a.width,height:Math.max(f1,Math.round(c.height))}},this.getDimensions=function(a,s){return r.getDimensions(a,s||{})};function o(a,s,c){return r.getDimensions(a,k({box:s},c))}this.createText=function(a,s){return r.createText(a,s||{})},this.getDefaultStyle=function(){return t},this.getExternalStyle=function(){return i}}lh.$inject=["config.textRenderer"];function d1(){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=v1(i.d,{mx:r,my:o,e:a});return p}}var h1=/\{([^{}]+)\}/g,m1=/(?:(?:^|\.)(.+?)(?=\[|\.|$|\()|\[('|")(.+?)\2\])(\(\))?/g;function g1(e,t,n){var i=n;return t.replace(m1,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 v1(e,t){return String(e).replace(h1,function(n,i){return g1(n,i,t)})}const y1={__init__:["bpmnRenderer"],bpmnRenderer:["type",dr],textRenderer:["type",lh],pathMap:["type",d1]};function _1(e,t){return t=t||{},e.replace(/{([^}]+)}/g,function(n,i){return t[i]||"{"+i+"}"})}const ko={translate:["value",_1]};function Za(e,t,n){return k({id:e.id,type:e.$type,businessObject:e,di:t},n)}function b1(e,t,n){var i=e.waypoint;return!i||i.length<2?[fe(t),fe(n)]:i.map(function(r){return{x:r.x,y:r.y}})}function ph(e,t,n){return new Error(`element ${$t(t)} referenced by ${$t(e)}#${n} not yet drawn`)}function oi(e,t,n,i,r){this._eventBus=e,this._canvas=t,this._elementFactory=n,this._elementRegistry=i,this._textRenderer=r}oi.$inject=["eventBus","canvas","elementFactory","elementRegistry","textRenderer"],oi.prototype.add=function(e,t,n){var i,r,o;if(y(t,"bpmndi:BPMNPlane")){var a=y(e,"bpmn:SubProcess")?{id:e.id+"_plane"}:{};i=this._elementFactory.createRoot(Za(e,t,a)),this._canvas.addRootElement(i)}else if(y(t,"bpmndi:BPMNShape")){var s=!Re(e,t),c=E1(e);r=n&&(n.hidden||n.collapsed);var u=t.bounds;i=this._elementFactory.createShape(Za(e,t,{collapsed:s,hidden:r,x:Math.round(u.x),y:Math.round(u.y),width:Math.round(u.width),height:Math.round(u.height),isFrame:c})),y(e,"bpmn:BoundaryEvent")&&this._attachBoundary(e,i),y(e,"bpmn:Lane")&&(o=0),y(e,"bpmn:DataStoreReference")&&(x1(n,fe(u))||(n=this._canvas.findRoot(n))),this._canvas.addShape(i,n,o)}else if(y(t,"bpmndi:BPMNEdge")){var l=this._getSource(e),p=this._getTarget(e);r=n&&(n.hidden||n.collapsed),i=this._elementFactory.createConnection(Za(e,t,{hidden:r,source:l,target:p,waypoints:b1(t,l,p)})),y(e,"bpmn:DataAssociation")&&(n=this._canvas.findRoot(n)),this._canvas.addConnection(i,n,o)}else throw new Error(`unknown di ${$t(t)} for element ${$t(e)}`);return Oi(e)&&hn(i)&&this.addLabel(e,t,i),this._eventBus.fire("bpmnElement.added",{element:i}),i},oi.prototype._attachBoundary=function(e,t){var n=e.attachedToRef;if(!n)throw new Error(`missing ${$t(e)}#attachedToRef`);var i=this._elementRegistry.get(n.id),r=i&&i.attachers;if(!i)throw ph(e,n,"attachedToRef");t.host=i,r||(i.attachers=r=[]),r.indexOf(t)===-1&&r.push(t)},oi.prototype.addLabel=function(e,t,n){var i,r,o;return i=Nw(t,n),r=hn(n),r&&(i=this._textRenderer.getExternalLabelBounds(i,r)),o=this._elementFactory.createLabel(Za(e,t,{id:e.id+"_label",labelTarget:n,type:"label",hidden:n.hidden||!hn(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)},oi.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?ph(e,i,t+"Ref"):new Error(`${$t(e)}#${t} Ref not specified`)},oi.prototype._getSource=function(e){return this._getConnectedElement(e,"source")},oi.prototype._getTarget=function(e){return this._getConnectedElement(e,"target")},oi.prototype._getElement=function(e){return this._elementRegistry.get(e.id)};function x1(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 E1(e){return y(e,"bpmn:Group")}const fh={__depends__:[y1,{__depends__:[ko],bpmnImporter:["type",oi]}]};function Do(e){return{x:e.x+e.width/2,y:e.y+e.height/2}}function kn(e,t){return{x:e.x-t.x,y:e.y-t.y}}function ku(e){return Math.log(e)/Math.log(10)}var w1=1e3;function W(e){this._eventBus=e}W.$inject=["eventBus"];function S1(e,t){return function(n){return e.call(t||null,n.context,n.command,n)}}W.prototype.on=function(e,t,n,i,r,o){if((Et(t)||he(t))&&(o=r,r=i,i=n,n=t,t=null),Et(n)&&(o=r,r=i,i=n,n=w1),xt(r)&&(o=r,r=!1),!Et(i))throw new Error("handlerFn must be a function");pe(e)||(e=[e]);var a=this._eventBus;T(e,function(s){var c=["commandStack",s,t].filter(function(u){return u}).join(".");a.on(c,n,r?S1(i,o):i,o)})},W.prototype.canExecute=ai("canExecute"),W.prototype.preExecute=ai("preExecute"),W.prototype.preExecuted=ai("preExecuted"),W.prototype.execute=ai("execute"),W.prototype.executed=ai("executed"),W.prototype.postExecute=ai("postExecute"),W.prototype.postExecuted=ai("postExecuted"),W.prototype.revert=ai("revert"),W.prototype.reverted=ai("reverted");function ai(e){return function(n,i,r,o,a){(Et(n)||he(n))&&(a=o,o=r,r=i,i=n,n=null),this.on(n,e,i,r,o,a)}}var Du=["top","bottom","left","right"],Qa=10;function Ou(e,t){W.call(this,e),this.postExecuted(["connection.create","connection.layout","connection.updateWaypoints"],function(r){var o=r.context,a=o.connection,s=a.source,c=a.target,u=o.hints||{};u.createElementsBehavior!==!1&&(n(s),n(c))}),this.postExecuted(["label.create"],function(r){var o=r.context,a=o.shape,s=o.hints||{};s.createElementsBehavior!==!1&&n(a.labelTarget)}),this.postExecuted(["elements.create"],function(r){var o=r.context,a=o.elements,s=o.hints||{};s.createElementsBehavior!==!1&&a.forEach(function(c){n(c)})});function n(r){if(qa(r)&&!$e(r)){var o=P1(r);o&&i(r,o)}}function i(r,o){var a=fe(r),s=r.label,c=fe(s);if(s.parent){var u=le(r),l;switch(o){case"top":l={x:a.x,y:u.top-Qa-s.height/2};break;case"left":l={x:u.left-Qa-s.width/2,y:a.y};break;case"bottom":l={x:a.x,y:u.bottom+Qa+s.height/2};break;case"right":l={x:u.right+Qa+s.width/2,y:a.y};break}var p=kn(l,c);t.moveShape(s,p)}}}Q(Ou,W),Ou.$inject=["eventBus","modeling"];function R1(e){var t=e.host,n=fe(e),i=At(n,t),r;i.indexOf("-")>=0?r=i.split("-"):r=[i];var o=Du.filter(function(a){return r.indexOf(a)===-1});return o}function C1(e){var t=fe(e),n=[].concat(e.incoming.map(function(i){return i.waypoints[i.waypoints.length-2]}),e.outgoing.map(function(i){return i.waypoints[1]})).map(function(i){return dh(t,i)});return n}function P1(e){var t=fe(e.label),n=fe(e),i=dh(n,t);if(A1(i)){var r=C1(e);if(e.host){var o=R1(e);r=r.concat(o)}var a=Du.filter(function(s){return r.indexOf(s)===-1});return a.indexOf(i)!==-1?At(e.label,e)!=="intersect"?void 0:i:a[0]}}function dh(e,t){return At(t,e,5)}function A1(e){return Du.indexOf(e)!==-1}function Iu(e){W.call(this,e),this.preExecute("shape.append",function(t){var n=t.source,i=t.shape;t.position||(y(i,"bpmn:TextAnnotation")?t.position={x:n.x+n.width/2+75,y:n.y-50-i.height/2}:t.position={x:n.x+n.width+80+i.width/2,y:n.y+n.height/2})},!0)}Q(Iu,W),Iu.$inject=["eventBus"];var T1=1500;function Lu(e,t,n){e.invoke(W,this),this.preExecute("elements.delete",T1,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=we(r,u=>y(u,"bpmn:Participant")||y(u,"bpmn:SubProcess"));if(!o.length)return[];var a=n.getRootElement(),s=new Set(a.children.filter(u=>y(u,"bpmn:Artifact"))),c=new Set;return T(o,u=>{const l=new Set(Ar(Ir(Array.from(s),at(u))));c=c.union(l),s=s.difference(l)}),Array.from(c)}}Q(Lu,W),Lu.$inject=["injector","eventBus","canvas"];function Bu(e,t){e.invoke(W,this),this.postExecute("shape.move",function(n){var i=n.newParent,r=n.shape,o=we(r.incoming.concat(r.outgoing),function(a){return y(a,"bpmn:Association")});T(o,function(a){t.moveConnection(a,{x:0,y:0},i)})},!0)}Q(Bu,W),Bu.$inject=["injector","modeling"];function Hr(e,t){for(Qt(t)&&(t=[t]);e=e.parent;)if(xe(e,t))return e;return null}function hh(e,t){var n=Hr(e,"bpmn:Process");if(n)return!0;var i=["bpmn:Participant","bpmn:Lane"];if(n=Hr(e,i),n)return St(n);if(xe(e,i))return St(e);var r;for(r=U(e);r&&!y(r,"bpmn:Process");r=r.$parent);if(!t)return!0;var o=t.find(function(a){var s=U(a);return s&&s.get("processRef")===r});return o?St(o):!0}var mh=500;function Ja(e,t){t.invoke(W,this),this._bpmnReplace=e;var n=this;this.postExecuted("elements.create",mh,function(i){var r=i.elements;r=r.filter(function(o){var a=o.host;return gh(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",mh,function(i){var r=i.shapes,o=i.newHost;if(r.length===1){var a=r[0];gh(a,o)&&(i.shapes=[n._replaceShape(a,o)])}},!0)}Ja.$inject=["bpmnReplace","injector"],Q(Ja,W),Ja.prototype._replaceShape=function(e,t){var n=M1(e),i={type:"bpmn:BoundaryEvent",host:t};return n&&(i.eventDefinitionType=n.$type),this._bpmnReplace.replaceElement(e,i,{layoutConnection:!1})};function M1(e){var t=U(e),n=t.eventDefinitions;return n&&n[0]}function gh(e,t){return!_e(e)&&xe(e,["bpmn:IntermediateThrowEvent","bpmn:IntermediateCatchEvent"])&&!!t}function Nu(e,t){W.call(this,e);function n(i){return we(i.attachers,function(r){return y(r,"bpmn:BoundaryEvent")})}this.postExecute("connection.create",function(i){var r=i.context.source,o=i.context.target,a=n(o);y(r,"bpmn:EventBasedGateway")&&y(o,"bpmn:ReceiveTask")&&a.length>0&&t.removeElements(a)}),this.postExecute("connection.reconnect",function(i){var r=i.context.oldSource,o=i.context.newSource;y(r,"bpmn:Gateway")&&y(o,"bpmn:EventBasedGateway")&&T(o.outgoing,function(a){var s=a.target,c=n(s);y(s,"bpmn:ReceiveTask")&&c.length>0&&t.removeElements(c)})})}Nu.$inject=["eventBus","modeling"],Q(Nu,W);function vh(e){return e.create("bpmn:Category")}function k1(e){return e.create("bpmn:CategoryValue")}function yh(e,t){var n=t.get("categoryValueRef");return n||(n=t.categoryValueRef=k1(e)),n.$parent||(n.$parent=vh(e)),n}function D1(e,t,n){return it(t.get("categoryValue"),e),e.$parent=t,it(n.get("rootElements"),t),t.$parent=n,e}function O1(e){var t=e.$parent;return t&&(tt(t.get("categoryValue"),e),e.$parent=null),e}function I1(e){var t=e.$parent;return t&&(tt(t.get("rootElements"),e),e.$parent=null),e}var L1=500;function $u(e,t,n){n.invoke(W,this);function i(c){return t.filter(function(u){return y(u,"bpmn:Group")&&!u.labelTarget}).map(U).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&&D1(c,u,e.getDefinitions())}function s(c,u,l){u&&!o(u,l)&&I1(u),c&&!r(c,l)&&O1(c)}this.executed(["shape.create","label.create"],function(c){var u=c.labelTarget||c.shape;!y(u,"bpmn:Group")||u.labelTarget||a(c.categoryValue,c.category)},!0),this.reverted(["shape.create","label.create"],function(c){var u=c.labelTarget||c.shape;!y(u,"bpmn:Group")||u.labelTarget||s(c.categoryValue,c.category,U(u))},!0),this.executed(["shape.move","shape.resize"],L1,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,U(u))},!0),this.executed("group.updateRefs",function(c){_h(c).forEach(function(u){a(u.categoryValue,u.category)})},!0),this.reverted("group.updateRefs",function(c){_h(c).forEach(function(u){s(u.categoryValue,u.category,U(u.groupShape))})},!0),this.executed("shape.delete",function(c){var u=c.shape;!y(u,"bpmn:Group")||u.labelTarget||s(c.categoryValue,c.category,U(u))},!0),this.reverted("shape.delete",function(c){var u=c.shape;!y(u,"bpmn:Group")||u.labelTarget||a(c.categoryValue,c.category)},!0)}$u.$inject=["bpmnjs","elementRegistry","injector"],Q($u,W);function _h(e){var t;return((t=e.updates)==null?void 0:t.groups)||[]}function ju(e,t,n){W.call(this,e),this.preExecute("shape.replace",s,!0),this.postExecuted("shape.replace",c,!0),this.preExecute("connection.create",r,!0),this.postExecuted("connection.delete",i,!0),this.postExecuted("connection.reconnect",o,!0),this.postExecuted("element.updateProperties",a,!0);function i(g){const w=g.source,E=g.target;zr(w)&&Oo(E)&&l(E)}function r(g){const w=g.connection,E=g.source,b=g.target;zr(E)&&es(b)&&(u(b),f(E,[w]))}function o(g){const w=g.newTarget,E=g.oldSource,b=g.oldTarget;if(b!==w){const x=E;Oo(b)&&l(b),zr(x)&&es(w)&&u(w)}}function a(g){const{element:w}=g;Oo(w)?(p(w),d(w)):es(w)&&h(w)}function s(g){const{newData:w,oldShape:E}=g;if(zr(g.oldShape)&&w.eventDefinitionType!=="bpmn:CompensateEventDefinition"||w.type!=="bpmn:BoundaryEvent"){const b=E.outgoing.find(({target:x})=>Oo(x));b&&b.target&&(g._connectionTarget=b.target)}else if(!zr(g.oldShape)&&w.eventDefinitionType==="bpmn:CompensateEventDefinition"&&w.type==="bpmn:BoundaryEvent"){const b=E.outgoing.find(({target:x})=>es(x));b&&b.target&&(g._connectionTarget=b.target),m(E)}}function c(g){const{_connectionTarget:w,newShape:E}=g;w&&t.connect(E,w)}function u(g){t.updateProperties(g,{isForCompensation:!0})}function l(g){t.updateProperties(g,{isForCompensation:void 0})}function p(g){for(const w of g.incoming)n.canConnect(w.source,g)||t.removeConnection(w);for(const w of g.outgoing)n.canConnect(g,w.target)||t.removeConnection(w)}function f(g,w){g.outgoing.filter(x=>y(x,"bpmn:Association")).filter(x=>Oo(x.target)&&!w.includes(x)).forEach(x=>t.removeConnection(x))}function d(g){const w=g.attachers.slice();w.length&&t.removeElements(w)}function h(g){const w=g.incoming.filter(E=>zr(E.source));t.removeElements(w)}function m(g){const w=g.outgoing.filter(E=>y(E,"bpmn:SequenceFlow"));t.removeElements(w)}}Q(ju,W),ju.$inject=["eventBus","modeling","bpmnRules"];function Oo(e){const t=U(e);return t&&t.get("isForCompensation")}function zr(e){return e&&y(e,"bpmn:BoundaryEvent")&&$r(e,"bpmn:CompensateEventDefinition")}function es(e){return e&&y(e,"bpmn:Activity")&&!jt(e)}function Fu(e){e.invoke(W,this),this.preExecute("shape.create",1500,function(t){var n=t.context,i=n.parent,r=n.shape;y(i,"bpmn:Lane")&&!y(r,"bpmn:Lane")&&(n.parent=Hr(i,"bpmn:Participant"))})}Fu.$inject=["injector"],Q(Fu,W);function Hu(e,t){W.call(this,e),this.preExecute("shape.create",function(n){var a;var i=n.context,r=i.shape;if(y(r,"bpmn:DataObjectReference")&&r.type!=="label"){var o=t.create("bpmn:DataObject");o.isCollection=((a=r.businessObject.dataObjectRef)==null?void 0:a.isCollection)||!1,r.businessObject.dataObjectRef=o}})}Hu.$inject=["eventBus","bpmnFactory"],Q(Hu,W);var zu=20,Vu=20,bh=30,ts=2e3;function Gu(e,t,n){W.call(this,t),t.on(["create.start","shape.move.start"],ts,function(r){var o=r.context,a=o.shape,s=e.getRootElement();if(!(!y(a,"bpmn:Participant")||!y(s,"bpmn:Process")||!s.children.length)){var c=s.children.filter(function(p){return!y(p,"bpmn:Group")&&!_e(p)&&!$e(p)});if(c.length){var u=at(c),l=B1(a,u);k(a,l),o.createConstraints=N1(a,u)}}}),t.on("create.start",ts,function(r){var o=r.context,a=o.shape,s=e.getRootElement(),c=e.getGraphics(s);function u(l){l.element=s,l.gfx=c}y(a,"bpmn:Participant")&&y(s,"bpmn:Process")&&(t.on("element.hover",ts,u),t.once("create.cleanup",function(){t.off("element.hover",u)}))});function i(){var r=e.getRootElement();return y(r,"bpmn:Collaboration")?r:n.makeCollaboration()}this.preExecute("elements.create",ts,function(r){var o=r.elements,a=r.parent,s=$1(o),c;s&&y(a,"bpmn:Process")&&(r.parent=i(),c=r.hints=r.hints||{},c.participant=s,c.process=a,c.processRef=U(s).get("processRef"))},!0),this.preExecute("shape.create",function(r){var o=r.parent,a=r.shape;y(a,"bpmn:Participant")&&y(o,"bpmn:Process")&&(r.parent=i(),r.process=o,r.processRef=U(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)&&U(s).set("processRef",U(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)&&U(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)}Gu.$inject=["canvas","eventBus","modeling"],Q(Gu,W);function B1(e,t){t={width:t.width+zu*2+bh,height:t.height+Vu*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 N1(e,t){return t=le(t),{bottom:t.top+e.height/2-Vu,left:t.right-e.width/2+zu,top:t.bottom-e.height/2+Vu,right:t.left+e.width/2-zu-bh}}function $1(e){return He(e,function(t){return y(t,"bpmn:Participant")})}var xh="__targetRef_placeholder";function Wu(e,t){W.call(this,e),this.executed(["connection.create","connection.delete","connection.move","connection.reconnect"],Eh(o)),this.reverted(["connection.create","connection.delete","connection.move","connection.reconnect"],Eh(o));function n(a,s,c){var u=a.get("dataInputAssociations");return He(u,function(l){return l!==c&&l.targetRef===s})}function i(a,s){var c=a.get("properties"),u=He(c,function(l){return l.name===xh});return!u&&s&&(u=t.create("bpmn:Property",{name:xh}),it(c,u)),u}function r(a,s){var c=i(a);c&&(n(a,c,s)||tt(a.get("properties"),c))}function o(a){var s=a.context,c=s.connection,u=c.businessObject,l=c.target,p=l&&l.businessObject,f=s.newTarget,d=f&&f.businessObject,h=s.oldTarget||s.target,m=h&&h.businessObject,g=c.businessObject,w;m&&m!==p&&r(m,u),d&&d!==p&&r(d,u),p?(w=i(p,!0),g.targetRef=w):g.targetRef=null}}Wu.$inject=["eventBus","bpmnFactory"],Q(Wu,W);function Eh(e){return function(t){var n=t.context,i=n.connection;if(y(i,"bpmn:DataInputAssociation"))return e(t)}}function ns(e){this._bpmnUpdater=e}ns.$inject=["bpmnUpdater"],ns.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),[]},ns.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 Uu(e,t,n,i){W.call(this,i),t.registerHandler("dataStore.updateContainment",ns);function r(){return n.filter(function(s){return y(s,"bpmn:Participant")&&U(s).processRef})[0]}function o(s){return s.children.filter(function(c){return y(c,"bpmn:DataStoreReference")&&!c.labelTarget})}function a(s,c){var u=s.businessObject||s;if(c=c||r(),c){var l=c.businessObject||c;t.execute("dataStore.updateContainment",{dataStoreBo:u,dataStoreDi:Me(s),newSemanticParent:l.processRef||l,newDiParent:Me(c)})}}this.preExecute("shape.create",function(s){var c=s.context,u=c.shape;y(u,"bpmn:DataStoreReference")&&u.type!=="label"&&(c.hints||(c.hints={}),c.hints.autoResize=!1)}),this.preExecute("elements.move",function(s){var c=s.context,u=c.shapes,l=u.filter(function(p){return y(p,"bpmn:DataStoreReference")});l.length&&(c.hints||(c.hints={}),c.hints.autoResize=u.filter(function(p){return!y(p,"bpmn:DataStoreReference")}))}),this.postExecute("shape.create",function(s){var c=s.context,u=c.shape,l=u.parent;y(u,"bpmn:DataStoreReference")&&u.type!=="label"&&y(l,"bpmn:Collaboration")&&a(u)}),this.postExecute("shape.move",function(s){var c=s.context,u=c.shape,l=c.oldParent,p=u.parent;if(!y(l,"bpmn:Collaboration")&&y(u,"bpmn:DataStoreReference")&&u.type!=="label"&&y(p,"bpmn:Collaboration")){var f=y(l,"bpmn:Participant")?l:F1(l,"bpmn:Participant");a(u,f)}}),this.postExecute("shape.delete",function(s){var c=s.context,u=c.shape,l=e.getRootElement();xe(u,["bpmn:Participant","bpmn:SubProcess"])&&y(l,"bpmn:Collaboration")&&o(l).filter(function(p){return j1(p,u)}).forEach(function(p){a(p)})}),this.postExecute("canvas.updateRoot",function(s){var c=s.context,u=c.oldRoot,l=c.newRoot,p=o(u);p.forEach(function(f){y(l,"bpmn:Process")&&a(f,l)})})}Uu.$inject=["canvas","commandStack","elementRegistry","eventBus"],Q(Uu,W);function j1(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 F1(e,t){for(;e.parent;){if(y(e.parent,t))return e.parent;e=e.parent}}var is=Math.max,rs=Math.min,H1=20;function wh(e,t){return{top:e.top-t.top,right:e.right-t.right,bottom:e.bottom-t.bottom,left:e.left-t.left}}function z1(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 V1(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 os(e,t,n){var i=t[e],r=n.min&&n.min[e],o=n.max&&n.max[e];return he(r)&&(i=(/top|left/.test(e)?rs:is)(i,r)),he(o)&&(i=(/top|left/.test(e)?is:rs)(i,o)),i}function G1(e,t){if(!t)return e;var n=le(e);return Ha({top:os("top",n,t),right:os("right",n,t),bottom:os("bottom",n,t),left:os("left",n,t)})}function W1(e,t,n,i){var r=le(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?le(i):o,s={top:rs(o.top,a.top),left:rs(o.left,a.left),bottom:is(o.bottom,a.bottom),right:is(o.right,a.right)};return Ha(s)}function Io(e,t){return typeof e<"u"?e:H1}function U1(e,t){var n,i,r,o;return typeof t=="object"?(n=Io(t.left),i=Io(t.right),r=Io(t.top),o=Io(t.bottom)):n=i=r=o=Io(t),{x:e.x-n,y:e.y-r,width:e.width+n+i,height:e.height+r+o}}function q1(e){return!(e.waypoints||e.type==="label")}function Sh(e,t){var n;if(e.length===void 0?n=we(e.children,q1):n=e,n.length)return U1(at(n),t)}var Ii=Math.abs;function Y1(e,t){return wh(le(t),le(e))}var K1=["bpmn:Participant","bpmn:Process","bpmn:SubProcess"],_n=30;function as(e,t){return t=t||[],e.children.filter(function(n){y(n,"bpmn:Lane")&&(as(n,t),t.push(n))}),t}function Li(e){return e.children.filter(function(t){return y(t,"bpmn:Lane")})}function bn(e){return Hr(e,K1)||e}function X1(e,t){var n=bn(e),i=y(n,"bpmn:Process")?[]:[n],r=as(n,i),o=le(e),a=le(t),s=Y1(e,t),c=[],u=St(e);return r.forEach(function(l){if(l!==e){var p=u?0:s.top,f=u?s.right:0,d=u?0:s.bottom,h=u?s.left:0,m=le(l);s.top&&(Ii(m.bottom-o.top)<10&&(d=a.top-m.bottom),Ii(m.top-o.top)<5&&(p=a.top-m.top)),s.left&&(Ii(m.right-o.left)<10&&(f=a.left-m.right),Ii(m.left-o.left)<5&&(h=a.left-m.left)),s.bottom&&(Ii(m.top-o.bottom)<10&&(p=a.bottom-m.top),Ii(m.bottom-o.bottom)<5&&(d=a.bottom-m.bottom)),s.right&&(Ii(m.left-o.right)<10&&(h=a.right-m.left),Ii(m.right-o.right)<5&&(f=a.right-m.right)),(p||f||d||h)&&c.push({shape:l,newBounds:V1(l,{top:p,right:f,bottom:d,left:h})})}}),c}var Z1=500;function qu(e,t){W.call(this,e);function n(i,r){var o=St(i),a=Li(r),s=[],c=[],u=[],l=[];if(lr(a,function(g){return o?g.y>i.y?c.push(g):s.push(g):g.x>i.x?l.push(g):u.push(g),g.children}),!!a.length){var p;o?c.length&&s.length?p=i.height/2:p=i.height:l.length&&u.length?p=i.width/2:p=i.width;var f,d,h,m;s.length&&(f=t.calculateAdjustments(s,"y",p,i.y-10),t.makeSpace(f.movingShapes,f.resizingShapes,{x:0,y:p},"s")),c.length&&(d=t.calculateAdjustments(c,"y",-p,i.y+i.height+10),t.makeSpace(d.movingShapes,d.resizingShapes,{x:0,y:-p},"n")),u.length&&(h=t.calculateAdjustments(u,"x",p,i.x-10),t.makeSpace(h.movingShapes,h.resizingShapes,{x:p,y:0},"e")),l.length&&(m=t.calculateAdjustments(l,"x",-p,i.x+i.width+10),t.makeSpace(m.movingShapes,m.resizingShapes,{x:-p,y:0},"w"))}}this.postExecuted("shape.delete",Z1,function(i){var r=i.context,o=r.hints,a=r.shape,s=r.oldParent;y(a,"bpmn:Lane")&&(o&&o.nested||n(a,s))})}qu.$inject=["eventBus","spaceTool"],Q(qu,W);var Rh=500;function ss(e,t){t.invoke(W,this),this._bpmnReplace=e;var n=this;this.postExecuted("elements.create",Rh,function(i){var r=i.elements;r.filter(function(o){var a=o.host;return Ch(o,a)}).map(function(o){return r.indexOf(o)}).forEach(function(o){i.elements[o]=n._replaceShape(r[o])})},!0),this.preExecute("elements.move",Rh,function(i){var r=i.shapes,o=i.newHost;r.forEach(function(a,s){var c=a.host;Ch(a,J1(r,c)?c:o)&&(r[s]=n._replaceShape(a))})},!0)}ss.$inject=["bpmnReplace","injector"],Q(ss,W),ss.prototype._replaceShape=function(e){var t=Q1(e),n;return t?n={type:"bpmn:IntermediateCatchEvent",eventDefinitionType:t.$type}:n={type:"bpmn:IntermediateThrowEvent"},this._bpmnReplace.replaceElement(e,n,{layoutConnection:!1})};function Q1(e){var t=U(e),n=t.eventDefinitions;return n&&n[0]}function Ch(e,t){return!_e(e)&&y(e,"bpmn:BoundaryEvent")&&!t}function J1(e,t){return e.indexOf(t)!==-1}var cs=Math.round,eS=Math.max;function tS(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 nS(e){var t=[];return e.forEach(function(n,i){t.push([i===0?"M":"L",n.x,n.y])}),t}var Ph=10;function iS(e,t){var n,i;for(n=0;i=e[n];n++)if(So(i,t)<=Ph)return{point:e[n],bendpoint:!0,index:n};return null}function rS(e,t){var n=Dd(tS(t,Ph),nS(e)),i=n[0],r=n[n.length-1],o;return i?i!==r?i.segment2!==r.segment2?(o=eS(i.segment2,r.segment2)-1,{point:e[o],bendpoint:!0,index:o}):{point:{x:cs(i.x+r.x)/2,y:cs(i.y+r.y)/2},index:i.segment2}:{point:{x:cs(i.x),y:cs(i.y)},index:i.segment2}:null}function Yu(e,t){return iS(e,t)||rS(e,t)}function Ku(e,t,n){W.call(this,e);function i(r,o,a){var s=o.waypoints,c,u,l,p,f,d,h,m=r.outgoing.slice(),g=r.incoming.slice(),w;he(a.width)?w=fe(a):w=a;var E=Yu(s,w);if(E){if(c=s.slice(0,E.index),u=s.slice(E.index+(E.bendpoint?1:0)),!c.length||!u.length)return;l=E.bendpoint?s[E.index]:w,(c.length===1||!Ah(r,c[c.length-1]))&&c.push(Th(l)),(u.length===1||!Ah(r,u[0]))&&u.unshift(Th(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?h=n.connect(r,f,{type:o.type,waypoints:u}):(n.reconnectStart(o,r,u||w),h=o));var b=[].concat(d&&we(g,function(x){return x.source===d.source})||[],h&&we(m,function(x){return x.target===h.target})||[]);b.length&&n.removeElements(b)}this.preExecute("elements.move",function(r){var o=r.newParent,a=r.shapes,s=r.delta,c=a[0];if(!(!c||!o)){o&&o.waypoints&&(r.newParent=o=o.parent);var u=fe(c),l={x:u.x+s.x,y:u.y+s.y},p=He(o.children,function(f){var d=t.canInsert(a,f);return d&&Yu(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)}Q(Ku,W),Ku.$inject=["eventBus","bpmnRules","modeling"];function Ah(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 Th(e){return k({},e)}function Xu(e,t){W.call(this,e),this.preExecuted("connection.create",function(n){var i=n.context,r=i.connection,o=i.source,a=i.target,s=i.hints;if(!(s&&s.createElementsBehavior===!1)&&Vr(r)){var c=[];y(o,"bpmn:EventBasedGateway")?c=a.incoming.filter(u=>u!==r&&Vr(u)):c=a.incoming.filter(u=>u!==r&&Vr(u)&&y(u.source,"bpmn:EventBasedGateway")),c.forEach(function(u){t.removeConnection(u)})}}),this.preExecuted("shape.replace",function(n){var i=n.context,r=i.newShape;if(y(r,"bpmn:EventBasedGateway")){var o=r.outgoing.filter(Vr).reduce(function(a,s){return a.includes(s.target)?a:a.concat(s.target)},[]);o.forEach(function(a){a.incoming.filter(Vr).forEach(function(s){const c=a.incoming.filter(Vr).filter(function(u){return u.source===r});(s.source!==r||c.length>1)&&t.removeConnection(s)})})}})}Xu.$inject=["eventBus","modeling"],Q(Xu,W);function Vr(e){return y(e,"bpmn:SequenceFlow")}var us=1500,Mh=2e3;function kh(e,t,n){t.on(["create.hover","create.move","create.out","create.end","shape.move.hover","shape.move.move","shape.move.out","shape.move.end"],us,function(i){var r=i.context,o=r.shape||i.shape,a=i.hover;y(a,"bpmn:Lane")&&!xe(o,["bpmn:Lane","bpmn:Participant"])&&(i.hover=bn(a),i.hoverGfx=e.getGraphics(i.hover));var s=n.getRootElement();a&&a!==s&&(o.labelTarget||xe(o,["bpmn:Group","bpmn:TextAnnotation"]))&&(i.hover=s,i.hoverGfx=e.getGraphics(i.hover))}),t.on(["connect.hover","connect.out","connect.end","connect.cleanup","global-connect.hover","global-connect.out","global-connect.end","global-connect.cleanup"],us,function(i){var r=i.hover;y(r,"bpmn:Lane")&&(i.hover=bn(r)||r,i.hoverGfx=e.getGraphics(i.hover))}),t.on(["bendpoint.move.hover"],us,function(i){var r=i.context,o=i.hover,a=r.type;y(o,"bpmn:Lane")&&/reconnect/.test(a)&&(i.hover=bn(o)||o,i.hoverGfx=e.getGraphics(i.hover))}),t.on(["connect.start"],us,function(i){var r=i.context,o=r.start;y(o,"bpmn:Lane")&&(r.start=bn(o)||o)}),t.on("shape.move.start",Mh,function(i){var r=i.shape;y(r,"bpmn:Lane")&&(i.shape=bn(r)||r)}),t.on("spaceTool.move",Mh,function(i){var r=i.hover;r&&y(r,"bpmn:Lane")&&(i.hover=bn(r))})}kh.$inject=["elementRegistry","eventBus","canvas"];var Dh=770;function Zu(e,t,n,i){n.invoke(W,this);function r(s,c){var u=U(s),l=c.categoryValue||u.categoryValueRef;l||(l=yh(e,u));var p=c.category||l.$parent||vh(e);u.categoryValueRef=l,l.$parent=p,c.categoryValue=l,c.category=p}function o(s,c){var u=U(s),l=c.categoryValue||u.categoryValueRef,p=c.category||l&&l.$parent;l&&(c.categoryValue=l,c.category=p,u.categoryValueRef=null)}this.execute("label.create",function(s){var c=s.context,u=c.labelTarget;y(u,"bpmn:Group")&&r(u,c)}),this.revert("label.create",function(s){var c=s.context,u=c.labelTarget;y(u,"bpmn:Group")&&o(u,c)}),this.execute("shape.delete",function(s){var c=s.context,u=c.shape,l=U(u);if(!(!y(u,"bpmn:Group")||u.labelTarget)){var p=c.categoryValue=l.categoryValueRef;p&&(c.category=p.$parent,l.categoryValueRef=null)}}),this.reverted("shape.delete",function(s){var c=s.context,u=c.shape;if(!(!y(u,"bpmn:Group")||u.labelTarget)){var l=c.category,p=c.categoryValue,f=U(u);p&&(f.categoryValueRef=p,p.$parent=l)}}),this.execute("shape.create",function(s){var c=s.context,u=c.shape,l=c.hints||{};!y(u,"bpmn:Group")||u.labelTarget||l.createElementsBehavior===!1&&!U(u).categoryValueRef&&!c.categoryValue||r(u,c)}),this.reverted("shape.create",function(s){var c=s.context,u=c.shape,l=c.hints||{};!y(u,"bpmn:Group")||u.labelTarget||l.createElementsBehavior===!1&&!U(u).categoryValueRef&&!c.categoryValue||o(u,c)}),this.executed(["shape.move","shape.resize"],function(s){var c=s.context,u=c.shape;!y(u,"bpmn:Group")||u.labelTarget||U(u).categoryValueRef||r(u,c)}),this.reverted(["shape.move","shape.resize"],function(s){var c=s.context,u=c.shape;!y(u,"bpmn:Group")||u.labelTarget||!c.categoryValue||o(u,c)});function a(s,c){var u=e.create(s.$type);return i.copyElement(s,u,null,c)}t.on("copyPaste.copyElement",Dh,function(s){var c=s.descriptor,u=s.element;if(!(!y(u,"bpmn:Group")||u.labelTarget)){var l=U(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",Dh,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})}Zu.$inject=["bpmnFactory","eventBus","injector","moddleCopy"],Q(Zu,W);function Qu(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 Oh(e){function t(i,r,o){var a={x:o.x,y:o.y-50},s={x:o.x-50,y:o.y},c=Qu(i,r,o,a),u=Qu(i,r,o,s),l;c&&u?Ih(c,o)>Ih(u,o)?l=u:l=c:l=c||u,i.original=l}function n(i){var r=i.waypoints;t(r[0],r[1],fe(i.source)),t(r[r.length-1],r[r.length-2],fe(i.target))}e.on("bpmnElement.added",function(i){var r=i.element;r.waypoints&&n(r)})}Oh.$inject=["eventBus"];function Ih(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function Ju(e){W.call(this,e);var t=["bpmn:Participant","bpmn:Lane"];this.executed(["shape.move","shape.create","shape.resize"],function(n){var i=n.context.shape,r=U(i),o=Me(i);if(xe(r,t)){var a=o.get("isHorizontal");a===void 0&&(a=!0),o.set("isHorizontal",a)}})}Ju.$inject=["eventBus"],Q(Ju,W);function Lh(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}function Bh(e){return Math.atan((e[1].y-e[0].y)/(e[1].x-e[0].x))}function oS(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 aS(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 el(e,t){var n=t[0],i=t[1],r={x:i.x-n.x,y:i.y-n.y},o=aS([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 Nh(e,t){var n=el(e,t),i={x:n.x-e.x,y:n.y-e.y};return Lh(i)}function Lo(e,t){return Lh({x:e.x-t.x,y:e.y-t.y})}var $h=Math.sqrt,jh=Math.min,sS=Math.max,Fh=Math.abs;function Hh(e){return Math.pow(e,2)}function Bo(e,t){return $h(Hh(e.x-t.x)+Hh(e.y-t.y))}function cS(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],Vh(i,r)?u=[i]:(o=Bo(e,i),a=Bo(e,r),c=jh(o,a),u=uS(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:Vh(i,u[0])?n:n+1}),u.length===2&&(s=pS(u[0],u[1]),l={type:"segment",position:s,segmentIndex:n,relativeLocation:Bo(i,s)/Bo(i,r)}),p=Bo(l.position,e),(!d||f>p)&&(d=l,f=p)}return d}function uS(e,t,n,i){var r=t.x-e.x,o=t.y-e.y,a=n.x-e.x,s=n.y-e.y,c=r*r+o*o,u=r*a+o*s,l=a*a+s*s-i*i,p=u/c,f=l/c,d=p*p-f;if(d<0&&d>-1e-6&&(d=0),d<0)return[];var h=$h(d),m=-p+h,g=-p-h,w={x:e.x-r*m,y:e.y-o*m};if(d===0)return[w];var E={x:e.x-r*g,y:e.y-o*g};return[w,E].filter(function(b){return lS(b,e,t)})}function lS(e,t,n){return zh(e.x,t.x,n.x)&&zh(e.y,t.y,n.y)}function zh(e,t,n){return e>=jh(t,n)-ls&&e<=sS(t,n)+ls}function pS(e,t){return{x:(e.x+t.x)/2,y:(e.y+t.y)/2}}var ls=.1;function Vh(e,t){return Fh(e.x-t.x)<=ls&&Fh(e.y-t.y)<=ls}function fS(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=Wh(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 Gh(e,t,n,i){var r=0,o=0,a={point:e,delta:{x:0,y:0}},s=cS(e,n),c=s.segmentIndex,u=fS(n,t,s,i);if(u<0||u>t.length-2||u===null)return a;var l=Uh(n,c),p=Uh(t,u),f=s.position,d=hS(l,f),h=dS(l,p);if(s.type==="bendpoint"){var m=t.length-n.length,g=s.bendpointIndex,w=n[g];if(t.indexOf(w)!==-1)return a;if(m===0){var E=t[g];return r=E.x-s.position.x,o=E.y-s.position.y,{delta:{x:r,y:o},point:{x:e.x+r,y:e.y+o}}}m<0&&g!==0&&g<n.length-1&&(d=Wh(n,g))}var b={x:(p[1].x-p[0].x)*d+p[0].x,y:(p[1].y-p[0].y)*d+p[0].y},x=oS({x:e.x-f.x,y:e.y-f.y},h);return r=b.x+x.x-e.x,o=b.y+x.y-e.y,{point:ii(b),delta:ii({x:r,y:o})}}function Wh(e,t){var n=Lo(e[t-1],e[t]),i=Lo(e[t],e[t+1]),r=n/(n+i);return r}function dS(e,t){var n=Bh(e),i=Bh(t);return i-n}function Uh(e,t){return[e[t],e[t+1]]}function hS(e,t){var n=Lo(e[0],e[1]),i=Lo(e[0],t);return n===0?0:i/n}function mS(e,t,n,i){var r=fe(e);return Gh(r,t,n,i).delta}function No(e,t,n){var i=Do(t),r=Do(n),o=kn(e,i),a={x:o.x*(n.width/t.width),y:o.y*(n.height/t.height)};return ii({x:r.x+a.x,y:r.y+a.y})}function qh(e,t,n){var i=Do(e),r=Do(t),o=Do(n),a=kn(e,i),s=kn(i,r),c=gS(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 ii({x:l.x+a.x-e.x,y:l.y+a.y-e.y})}function gS(e,t,n){var i=le(t),r=le(n);if(vS(i,r))return null;var o=At(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=At(n,s),c!==o?null:a}function vS(e,t){return yS(e,t)||_S(e,t)}function yS(e,t){return e.right!==t.right&&e.left!==t.left}function _S(e,t){return e.top!==t.top&&e.bottom!==t.bottom}var Yh="name",Kh="text";function tl(e,t,n,i){W.call(this,e),this.postExecute("element.updateProperties",r),this.postExecute("element.updateModdleProperties",a=>{U(a.context.element)===a.context.moddleElement&&r(a)});function r(a){var s=a.context,c=s.element,u=s.properties;if(Yh in u&&t.updateLabel(c,u[Yh]),Kh in u&&y(c,"bpmn:TextAnnotation")){var l=i.getTextAnnotationBounds({x:c.x,y:c.y,width:c.width,height:c.height},u[Kh]||"");t.updateLabel(c,u.text,l)}}this.postExecute(["shape.create","connection.create"],function(a){var s=a.context,c=s.hints||{};if(c.createElementsBehavior!==!1){var u=s.shape||s.connection;_e(u)||!Oi(u)||hn(u)&&t.updateLabel(u,hn(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=k({},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),mS(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=U(c);l&&Oi(l)&&u.label&&c.label&&(c.label.x=u.label.x,c.label.y=u.label.y)}),this.preExecute("shape.resize",function(a){var s=a.context,c=s.shape,u=s.hints||{};if(!(!_e(c)||u.autoResize)){var l=s.newBounds,p=i.getDimensions(hn(c)||"",{box:l,style:i.getExternalStyle()}),f=Math.ceil(p.height),d=l.y!==c.y,h=c.y+c.height;s.newBounds={width:l.width,height:f,x:l.x,y:d?h-f:l.y}}}),this.postExecute("shape.resize",function(a){var s=a.context,c=s.shape,u=s.newBounds,l=s.oldBounds;if(qa(c)){var p=c.label,f=fe(p),d=ES(l),h=xS(f,d),m=bS(h,l,u);t.moveShape(p,m)}})}Q(tl,W),tl.$inject=["eventBus","modeling","bpmnFactory","textRenderer"];function bS(e,t,n){var i=No(e,t,n);return ii(kn(i,e))}function xS(e,t){if(t.length){var n=wS(e,t);return el(e,n)}}function ES(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 wS(e,t){var n=t.map(function(r){return{line:r,distance:Nh(e,r)}}),i=In(n,"distance");return i[0].line}function SS(e,t,n,i){return Gh(e,t,n,i).point}function nl(e,t){W.call(this,e);function n(i,r){var o=i.context,a=o.connection,s=k({},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),SS(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)})})}Q(nl,W),nl.$inject=["eventBus","modeling"];function ps(e,t,n){var i=ds(e),r=Zh(i,t),o=i[0];return r.length?r[r.length-1]:No(o.original||o,n,t)}function fs(e,t,n){var i=ds(e),r=Zh(i,t),o=i[i.length-1];return r.length?r[0]:No(o.original||o,n,t)}function il(e,t,n){var i=ds(e),r=Xh(t,n),o=i[0];return No(o.original||o,r,t)}function rl(e,t,n){var i=ds(e),r=Xh(t,n),o=i[i.length-1];return No(o.original||o,r,t)}function Xh(e,t){return{x:e.x-t.x,y:e.y-t.y,width:e.width,height:e.height}}function ds(e){var t=e.waypoints;if(!t.length)throw new Error("connection#"+e.id+": no waypoints");return t}function Zh(e,t){var n=It(e,CS);return we(n,function(i){return RS(i,t)})}function RS(e,t){return At(t,e,1)==="intersect"}function CS(e){return e.original||e}function ol(e,t){W.call(this,e),this.postExecute("shape.replace",function(n){var i=n.oldShape,r=n.newShape;if(PS(i,r)){var o=AS(i);o.incoming.forEach(function(a){var s=fs(a,r,i);t.reconnectEnd(a,r,s)}),o.outgoing.forEach(function(a){var s=ps(a,r,i);t.reconnectStart(a,r,s)})}},!0)}ol.$inject=["eventBus","modeling"],Q(ol,W);function PS(e,t){return y(e,"bpmn:Participant")&&Re(e)&&y(t,"bpmn:Participant")&&!Re(t)}function AS(e){var t=Eo([e]),n=[],i=[];return t.forEach(function(r){r!==e&&(r.incoming.forEach(function(o){y(o,"bpmn:MessageFlow")&&n.push(o)}),r.outgoing.forEach(function(o){y(o,"bpmn:MessageFlow")&&i.push(o)}))},[]),{incoming:n,outgoing:i}}const TS=["bpmn:MessageEventDefinition","bpmn:TimerEventDefinition","bpmn:EscalationEventDefinition","bpmn:ConditionalEventDefinition","bpmn:SignalEventDefinition"];function Qh(e){const t=U(e);if(!y(t,"bpmn:BoundaryEvent")&&!(y(t,"bpmn:StartEvent")&&jt(t.$parent)))return!1;const n=t.get("eventDefinitions");return!n||!n.length?!1:TS.some(i=>y(n[0],i))}function Jh(e){return y(e,"bpmn:BoundaryEvent")?"cancelActivity":"isInterrupting"}function al(e,t){e.invoke(W,this),this.postExecuted("shape.replace",function(n){const i=n.context.oldShape,r=n.context.newShape,o=n.context.hints;if(!Qh(r))return;const a=Jh(r);if(o.targetElement&&o.targetElement[a]!==void 0)return;const c=U(i).get(a),u=U(r).get(a);c!==u&&t.updateProperties(r,{[a]:c})})}al.$inject=["injector","modeling"],Q(al,W);function sl(e,t){W.call(this,e),this.preExecute("shape.resize",function(n){var i=n.shape,r=Me(i),o=r&&r.get("label"),a=o&&o.get("bounds");a&&t.updateModdleProperties(i,o,{bounds:void 0})},!0)}Q(sl,W),sl.$inject=["eventBus","modeling"];function cl(e,t,n){W.call(this,e),this.preExecute("shape.delete",function(i){var r=i.context.shape;if(!(r.incoming.length!==1||r.outgoing.length!==1)){var o=r.incoming[0],a=r.outgoing[0];if(!(!y(o,"bpmn:SequenceFlow")||!y(a,"bpmn:SequenceFlow"))&&t.canConnect(o.source,a.target,o)){var s=MS(o.waypoints,a.waypoints);n.reconnectEnd(o,a.target,s)}}})}Q(cl,W),cl.$inject=["eventBus","bpmnRules","modeling"];function Gr(e){return e.original||e}function MS(e,t){var n=Qu(Gr(e[e.length-2]),Gr(e[e.length-1]),Gr(t[1]),Gr(t[0]));return n?[].concat(e.slice(0,e.length-1),[n],t.slice(1)):[Gr(e[0]),Gr(t[t.length-1])]}function ul(e,t){W.call(this,e),this.preExecute("shape.delete",function(n){var i=n.shape,r=i.parent;y(i,"bpmn:Participant")&&(n.collaborationRoot=r)},!0),this.postExecute("shape.delete",function(n){var i=n.collaborationRoot;if(i&&!i.businessObject.participants.length){var r=t.makeProcess(),o=i.children.slice();t.moveElements(o,{x:0,y:0},r)}},!0)}ul.$inject=["eventBus","modeling"],Q(ul,W);function ll(e,t,n,i){W.call(this,e);var r=i.get("dragging",!1);function o(c){var u=c.source,l=c.target,p=c.parent;if(p){var f,d;y(c,"bpmn:SequenceFlow")&&(n.canConnectSequenceFlow(u,l)||(d=!0),n.canConnectMessageFlow(u,l)&&(f="bpmn:MessageFlow")),y(c,"bpmn:MessageFlow")&&(n.canConnectMessageFlow(u,l)||(d=!0),n.canConnectSequenceFlow(u,l)&&(f="bpmn:SequenceFlow")),d&&t.removeConnection(c),f&&t.connect(u,l,{type:f,waypoints:c.waypoints.slice()})}}function a(c){var u=c.context,l=u.connection,p=u.newSource||l.source,f=u.newTarget||l.target,d,h;d=n.canConnect(p,f),!(!d||d.type===l.type)&&(h=t.connect(p,f,{type:d.type,associationDirection:d.associationDirection,waypoints:l.waypoints.slice()}),l.parent&&t.removeConnection(l),u.connection=h,r&&s(l,h))}function s(c,u){var l=r.context(),p=l&&l.payload.previousSelection,f;!p||!p.length||(f=p.indexOf(c),f!==-1&&p.splice(f,1,u))}this.postExecuted("elements.move",function(c){var u=c.closure,l=u.allConnections;T(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=He(p.outgoing,Mr({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})})}Q(ll,W),ll.$inject=["eventBus","modeling","bpmnRules","injector"];function hs(e,t,n,i,r,o){i.invoke(W,this),this._bpmnReplace=e,this._elementRegistry=n,this._selection=o,this.postExecuted(["elements.create"],500,function(a){var s=a.context,c=s.parent,u=s.elements,l=en(u,function(p,f){var d=t.canReplace([f],f.host||f.parent||c);return d?p.concat(d.replacements):p},[]);l.length&&this._replaceElements(u,l)},this),this.postExecuted(["elements.move"],500,function(a){var s=a.context,c=s.newParent,u=s.newHost,l=[];T(s.closure.topLevel,function(f){jt(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})})}Q(hs,W),hs.prototype._replaceElements=function(e,t){var n=this._elementRegistry,i=this._bpmnReplace,r=this._selection;T(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)},hs.$inject=["bpmnReplace","bpmnRules","elementRegistry","injector","modeling","selection"];var kS=1500,DS={width:140,height:120},pl={width:300,height:60},fl={width:60,height:300},ms={width:300,height:150},gs={width:150,height:300},em={width:140,height:120},tm={width:100,height:40};function nm(e){e.on("resize.start",kS,function(t){var n=t.context,i=n.shape,r=n.direction,o=n.balanced;(y(i,"bpmn:Lane")||y(i,"bpmn:Participant"))&&(n.resizeConstraints=NS(i,r,o)),y(i,"bpmn:SubProcess")&&Re(i)&&(n.minDimensions=em),y(i,"bpmn:TextAnnotation")&&(n.minDimensions=tm)})}nm.$inject=["eventBus"];var Bi=Math.abs,OS=Math.min,IS=Math.max;function im(e,t,n,i){var r=e[t];e[t]=r===void 0?n:i(n,r)}function Wr(e,t,n){return im(e,t,n,OS)}function Ur(e,t,n){return im(e,t,n,IS)}var LS={top:20,left:50,right:20,bottom:20},BS={top:50,left:20,right:20,bottom:20};function NS(e,t,n){var i=bn(e),r=!0,o=!0,a=as(i,[i]),s=le(e),c={},u={},l=St(e),p=l?pl:fl;/n/.test(t)?u.top=s.bottom-p.height:/e/.test(t)?u.right=s.left+p.width:/s/.test(t)?u.bottom=s.top+p.height:/w/.test(t)&&(u.left=s.right-p.width),a.forEach(function(h){var m=le(h);l?(m.top<s.top-10&&(r=!1),m.bottom>s.bottom+10&&(o=!1)):(m.left<s.left-10&&(r=!1),m.right>s.right+10&&(o=!1)),/n/.test(t)&&(n&&Bi(s.top-m.bottom)<10&&Ur(c,"top",m.top+p.height),Bi(s.top-m.top)<5&&Wr(u,"top",m.bottom-p.height)),/e/.test(t)&&(n&&Bi(s.right-m.left)<10&&Wr(c,"right",m.right-p.width),Bi(s.right-m.right)<5&&Ur(u,"right",m.left+p.width)),/s/.test(t)&&(n&&Bi(s.bottom-m.top)<10&&Wr(c,"bottom",m.bottom-p.height),Bi(s.bottom-m.bottom)<5&&Ur(u,"bottom",m.top+p.height)),/w/.test(t)&&(n&&Bi(s.left-m.right)<10&&Ur(c,"left",m.left+p.width),Bi(s.left-m.left)<5&&Wr(u,"left",m.right-p.width))});var f=i.children.filter(function(h){return!h.hidden&&!h.waypoints&&(y(h,"bpmn:FlowElement")||y(h,"bpmn:Artifact"))}),d=l?LS:BS;return f.forEach(function(h){var m=le(h);/n/.test(t)&&(!l||r)&&Wr(u,"top",m.top-d.top),/e/.test(t)&&(l||o)&&Ur(u,"right",m.right+d.right),/s/.test(t)&&(!l||o)&&Ur(u,"bottom",m.bottom+d.bottom),/w/.test(t)&&(l||r)&&Wr(u,"left",m.left-d.left)}),{min:u,max:c}}function rm(e){!e||typeof e.stopPropagation!="function"||e.stopPropagation()}function qr(e){return e.originalEvent||e.srcEvent}function dl(e){rm(e),rm(qr(e))}function hr(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 om(){return/mac/i.test(navigator.platform)}function am(e,t){return(qr(e)||e).button===t}function Ni(e){return am(e,0)}function $S(e){return am(e,1)}function $o(e){var t=qr(e)||e;return Ni(e)?om()?t.metaKey:t.ctrlKey:!1}function vs(e){var t=qr(e)||e;return Ni(e)&&t.shiftKey}var sm=1001;function cm(e,t){e.on("resize.start",sm+500,function(n){var i=n.context,r=i.shape;(y(r,"bpmn:Lane")||y(r,"bpmn:Participant"))&&(i.balanced=!$o(n))}),e.on("resize.end",sm,function(n){var i=n.context,r=i.shape,o=i.canExecute,a=i.newBounds;if(y(r,"bpmn:Lane")||y(r,"bpmn:Participant"))return o&&(a=Nd(a),t.resizeLane(r,a,i.balanced)),!1})}cm.$inject=["eventBus","modeling"];var jS=500;function hl(e,t,n,i,r){n.invoke(W,this);function o(l){return xe(l,["bpmn:ReceiveTask","bpmn:SendTask"])||FS(l,["bpmn:ErrorEventDefinition","bpmn:EscalationEventDefinition","bpmn:MessageEventDefinition","bpmn:SignalEventDefinition"])}function a(l){var p=e.getDefinitions(),f=p.get("rootElements");return!!He(f,Mr({id:l.id}))}function s(l){if(y(l,"bpmn:ErrorEventDefinition"))return"errorRef";if(y(l,"bpmn:EscalationEventDefinition"))return"escalationRef";if(y(l,"bpmn:MessageEventDefinition"))return"messageRef";if(y(l,"bpmn:SignalEventDefinition"))return"signalRef"}function c(l){if(xe(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(xe(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=U(p),d=c(f),h;d&&!a(d)&&(h=e.getDefinitions().get("rootElements"),it(h,d),l.addedRootElement=d)}},!0),this.reverted(["shape.create","element.updateProperties","element.updateModdleProperties"],function(l){var p=l.addedRootElement;if(p){var f=e.getDefinitions().get("rootElements");tt(f,p)}},!0),t.on("copyPaste.copyElement",function(l){var p=l.descriptor,f=l.element;if(!(f.labelTarget||!o(f))){var d=U(f),h=c(d);h&&(p.referencedRootElement=h)}}),t.on("copyPaste.pasteElement",jS,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)})}hl.$inject=["bpmnjs","eventBus","injector","moddleCopy","bpmnFactory"],Q(hl,W);function FS(e,t){return pe(t)||(t=[t]),bi(t,function(n){return $r(e,n)})}var um=Math.max;function lm(e){e.on("spaceTool.getMinDimensions",function(t){var n=t.shapes,i=t.axis,r=t.start,o={};return T(n,function(a){var s=a.id;y(a,"bpmn:Participant")&&(o[s]=zS(a,i,r)),y(a,"bpmn:Lane")&&(o[s]=St(a)?pl:fl),y(a,"bpmn:SubProcess")&&Re(a)&&(o[s]=em),y(a,"bpmn:TextAnnotation")&&(o[s]=tm),y(a,"bpmn:Group")&&(o[s]=DS)}),o})}lm.$inject=["eventBus"];function HS(e){return e==="x"}function zS(e,t,n){var i=St(e);if(!WS(e))return i?ms:gs;var r=HS(t),o={};return r?i?o=ms:o={width:GS(e,n,r),height:gs.height}:i?o={width:ms.width,height:VS(e,n,r)}:o=gs,o}function VS(e,t,n){var i;return i=US(e,t,n),um(ms.height,i)}function GS(e,t,n){var i;return i=qS(e,t,n),um(gs.width,i)}function WS(e){return!!Li(e).length}function US(e,t,n){var i=Li(e),r;return r=ml(i,t,n),e.height-r.height+pl.height}function qS(e,t,n){var i=Li(e),r;return r=ml(i,t,n),e.width-r.width+fl.width}function ml(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=Li(r),o.length?ml(o,t,n):r}var pm="_plane";function fm(e){var t=e.id;return YS(t)}function Wn(e){var t=e.id;return y(e,"bpmn:SubProcess")?dm(t):t}function mr(e){return dm(e)}function ys(e){var t=Me(e);return y(t,"bpmndi:BPMNPlane")}function dm(e){return e+pm}function YS(e){return e.replace(new RegExp(pm+"$"),"")}var hm=400,KS=600,mm={x:180,y:160};function si(e,t,n,i,r,o,a){W.call(this,t),this._canvas=e,this._eventBus=t,this._modeling=n,this._elementFactory=i,this._bpmnFactory=r,this._bpmnjs=o,this._elementRegistry=a;var s=this;function c(p){return y(p,"bpmn:SubProcess")&&!Re(p)}function u(p){var f=p.shape,d=p.newRootElement,h=U(f);d=s._addDiagram(d||h),p.newRootElement=e.addRootElement(d)}function l(p){var f=p.shape,d=U(f);s._removeDiagram(d);var h=p.newRootElement=a.get(Wn(d));e.removeRootElement(h)}this.executed("shape.create",function(p){var f=p.shape;c(f)&&u(p)},!0),this.postExecuted("elements.create",function(p){var f=p.elements;T(f,function(d){if(c(d)){var h=a.get(Wn(d));if(!(!h||!d.children||!d.children.length)){var m=gm(d);s._showRecursively(m),s._moveChildrenToShape(m,h)}}})},!0),this.reverted("shape.create",function(p){var f=p.shape;c(f)&&l(p)},!0),this.preExecute("shape.delete",function(p){var f=p.shape;!y(f,"bpmn:SubProcess")||!Re(f)||T(Ao([f]),d=>{n.removeShape(d.annotation)})},!0),this.preExecuted("shape.delete",function(p){var f=p.shape;if(c(f)){var d=a.get(Wn(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(Wn(f)))},!0),this.postExecuted("shape.replace",function(p){var f=p.newShape,d=p.oldRoot,h=e.findRoot(Wn(f));if(!(!d||!h)){var m=d.children;n.moveElements(m,{x:0,y:0},h)}},!0),this.executed("element.updateProperties",function(p){var f=p.element;if(y(f,"bpmn:SubProcess")){var d=p.properties,h=p.oldProperties,m=h.id,g=d.id;if(m!==g){if(ys(f)){a.updateId(f,mr(g)),a.updateId(m,g);return}var w=a.get(mr(m));w&&a.updateId(mr(m),mr(g))}}},!0),this.reverted("element.updateProperties",function(p){var f=p.element;if(y(f,"bpmn:SubProcess")){var d=p.properties,h=p.oldProperties,m=h.id,g=d.id;if(m!==g){if(ys(f)){a.updateId(f,mr(m)),a.updateId(g,m);return}var w=a.get(mr(g));w&&a.updateId(w,mr(m))}}},!0),t.on("element.changed",function(p){var f=p.element;if(ys(f)){var d=f,h=a.get(fm(d));!h||h===d||t.fire("element.changed",{element:h})}}),this.executed("shape.toggleCollapse",hm,function(p){var f=p.shape;y(f,"bpmn:SubProcess")&&(Re(f)?l(p):(u(p),s._showRecursively(f.children)))},!0),this.reverted("shape.toggleCollapse",hm,function(p){var f=p.shape;y(f,"bpmn:SubProcess")&&(Re(f)?l(p):(u(p),s._showRecursively(f.children)))},!0),this.postExecuted("shape.toggleCollapse",KS,function(p){var f=p.shape;if(y(f,"bpmn:SubProcess")){var d=p.newRootElement;if(d)if(Re(f))s._moveChildrenToShape(d.children.slice(),f),T(Ao(f.children),m=>{n.moveShape(m.annotation,{x:0,y:0},f.parent),T(m.associations,g=>{n.moveConnection(g,{x:0,y:0},f.parent)})});else{s._disconnectSharedAnnotations(f);var h=gm(f);s._moveChildrenToShape(h,d)}}},!0),t.on("copyPaste.createTree",function(p){var f=p.element,d=p.children;if(c(f)){var h=Wn(f),m=a.get(h);m&&d.push.apply(d,m.children)}}),t.on("copyPaste.copyElement",function(p){var f=p.descriptor,d=p.element,h=p.elements,m=d.parent,g=y(Me(m),"bpmndi:BPMNPlane");if(g){var w=fm(m),E=He(h,function(b){return b.id===w});E&&(f.parent=E.id)}}),t.on("copyPaste.pasteElement",function(p){var f=p.descriptor;f.parent&&(c(f.parent)||f.parent.hidden)&&(f.hidden=!0)})}Q(si,W),si.prototype._moveChildrenToShape=function(e,t){var n=this._modeling;if(e.length){var i=e.filter(function(c){return!c.hidden});if(!i.length){n.moveElements(e,{x:0,y:0},t,{autoResize:!1});return}var r=at(i),o;if(!t.x)o={x:mm.x-r.x,y:mm.y-r.y};else{var a=fe(t),s=fe(r);o={x:a.x-s.x,y:a.y-s.y}}n.moveElements(e,o,t,{autoResize:!1})}},si.prototype._disconnectSharedAnnotations=function(e){var t=this._modeling,n=new Set(ah(e).map(i=>i.annotation));n.size&&T(Ao(e.children),i=>{n.has(i.annotation)&&T(i.associations,r=>{t.removeConnection(r)})})},si.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},si.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},si.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:Wn(e),type:e.$type,di:i,businessObject:e,collapsed:!0});return o},si.prototype._removeDiagram=function(e){var t=this._bpmnjs,n=t.getDefinitions().diagrams,i=He(n,function(r){return r.plane.bpmnElement.id===e.id});return n.splice(n.indexOf(i),1),i},si.$inject=["canvas","eventBus","modeling","elementFactory","bpmnFactory","bpmnjs","elementRegistry"];function XS(e){var t=[];return T(Ao(e),n=>{t.push(n.annotation),t.push.apply(t,n.associations)}),t}function gm(e){return e.children.slice().concat(XS(e.children)).concat(ZS(e))}function ZS(e){return bu(e.children||[]).reduce(function(t,n){return n.label&&n.label.parent!==e&&t.push(n.label),t},[])}function gl(e,t){e.invoke(W,this),this.postExecuted("shape.replace",function(n){var i=n.context.oldShape,r=n.context.newShape;if(!(!y(r,"bpmn:SubProcess")||y(r,"bpmn:AdHocSubProcess")||!(y(i,"bpmn:Task")||y(i,"bpmn:CallActivity"))||!Re(r))){var o=QS(r);t.createShape({type:"bpmn:StartEvent"},o,r)}})}gl.$inject=["injector","modeling"],Q(gl,W);function QS(e){return{x:e.x+e.width/6,y:e.y+e.height/2}}function vl(e,t){W.call(this,e),this.preExecute("connection.create",function(n){const{target:i}=n;y(i,"bpmn:TextAnnotation")&&(n.parent=i.parent)},!0),this.preExecute(["shape.create","shape.resize","elements.move"],function(n){const i=n.shapes||[n.shape];i.length===1&&y(i[0],"bpmn:TextAnnotation")&&(n.hints=n.hints||{},n.hints.autoResize=!1)},!0),this.preExecute("shape.resize",function(n){var i=n.context,r=i.shape,o=i.hints||{};if(!(!y(r,"bpmn:TextAnnotation")||o.autoResize)){var a=i.newBounds,s=t.getTextAnnotationBounds(a,hn(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}}})}Q(vl,W),vl.$inject=["eventBus","textRenderer"];function yl(e,t){W.call(this,e),this.postExecuted("shape.toggleCollapse",1500,function(n){var i=n.shape;if(Re(i))return;var r=Eo(i);r.forEach(function(a){var s=a.incoming.slice(),c=a.outgoing.slice();T(s,function(u){o(u,!0)}),T(c,function(u){o(u,!1)})});function o(a,s){r.indexOf(a.source)!==-1&&r.indexOf(a.target)!==-1||y(a,"bpmn:Association")&&(y(a.source,"bpmn:TextAnnotation")||y(a.target,"bpmn:TextAnnotation"))||(s?t.reconnectEnd(a,i,fe(i)):t.reconnectStart(a,i,fe(i)))}},!0)}Q(yl,W),yl.$inject=["eventBus","modeling"];var _l=500;function bl(e,t,n){W.call(this,e);function i(a){a.length&&a.forEach(function(s){s.type==="label"&&!s.businessObject.name&&(s.hidden=!0)})}function r(a,s){var c=a.children,u=s,l,p;return l=JS(c).concat([a]),p=Sh(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"],_l,function(a){var s=a.context,c=s.shape;y(c,"bpmn:SubProcess")&&(c.collapsed?Me(c).isExpanded=!1:(i(c.children),Me(c).isExpanded=!0))}),this.reverted(["shape.toggleCollapse"],_l,function(a){var s=a.context,c=s.shape;c.collapsed?Me(c).isExpanded=!1:Me(c).isExpanded=!0}),this.postExecuted(["shape.toggleCollapse"],_l,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"})})}Q(bl,W),bl.$inject=["eventBus","elementFactory","modeling"];function JS(e){return e.filter(function(t){return!t.hidden})}function xl(e,t,n,i){t.invoke(W,this),this.preExecute("shape.delete",function(r){var o=r.context,a=o.shape,s=a.businessObject;_e(a)||(y(a,"bpmn:Participant")&&Re(a)&&n.ids.unclaim(s.processRef.id),i.unclaimId(s.id,s))}),this.preExecute("connection.delete",function(r){var o=r.context,a=o.connection,s=a.businessObject;i.unclaimId(s.id,s)}),this.preExecute("canvas.updateRoot",function(){var r=e.getRootElement(),o=r.businessObject;y(r,"bpmn:Collaboration")&&n.ids.unclaim(o.id)})}Q(xl,W),xl.$inject=["canvas","injector","moddle","modeling"];function El(e,t){W.call(this,e),this.preExecute("connection.delete",function(n){var i=n.context,r=i.connection,o=r.source;eR(r,o)&&t.updateProperties(o,{default:null})})}Q(El,W),El.$inject=["eventBus","modeling"];function eR(e,t){if(!y(e,"bpmn:SequenceFlow"))return!1;var n=U(t),i=U(e);return n.get("default")===i}var tR=500,nR=5e3,vm=["shape.create","shape.delete","shape.move","shape.resize"],ym=[...vm,"spaceTool","lane.add","lane.resize","lane.split","elements.create","elements.delete","elements.move"];function wl(e,t){W.call(this,e);var n;function i(){return n=n||new iR,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(ym,nR,function(){i()}),this.postExecuted(ym,tR,function(){o()}),this.preExecute(vm,function(a){var s=a.context,c=s.shape,u=r();!c||c.labelTarget||(y(c,"bpmn:Lane")&&u.addLane(c),y(c,"bpmn:FlowNode")&&u.addFlowNode(c))})}wl.$inject=["eventBus","modeling"],Q(wl,W);function iR(){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 rR=500,oR=5e3,_m=["connection.create","connection.delete","connection.layout","connection.move","connection.reconnect","connection.updateWaypoints","shape.create","shape.delete","shape.move","shape.resize"],bm=[..._m,"elements.create","elements.delete","elements.move","label.create","spaceTool"];function Sl(e,t){W.call(this,e);var n;function i(){return n=n||new aR,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(bm,oR,function(){i()}),this.postExecuted(bm,rR,function(){o()}),this.preExecute(_m,function(a){var s=a.context.connection||a.context.shape,c=r();!s||s.labelTarget||(y(s,"bpmn:FlowElement")&&c.addFlowElement(s),y(s,"bpmn:Group")&&c.addGroup(s))}),this.preExecute("label.create",function(a){var s=a.context.labelTarget;y(s,"bpmn:Group")&&r().addGroup(s)})}Sl.$inject=["eventBus","modeling"],Q(Sl,W);function aR(){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 Rl(e,t){W.call(this,e),this.postExecuted("elements.create",function(n){const i=n.context,r=i.elements;for(const o of r)sR(o)&&!uR(o)&&t.updateProperties(o,{isForCompensation:void 0})})}Q(Rl,W),Rl.$inject=["eventBus","modeling"];function sR(e){const t=U(e);return t&&t.isForCompensation}function cR(e){return e&&y(e,"bpmn:BoundaryEvent")&&$r(e,"bpmn:CompensateEventDefinition")}function uR(e){return e.incoming.filter(n=>cR(n.source)).length>0}const lR={__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",Ou],appendBehavior:["type",Iu],associationBehavior:["type",Bu],attachEventBehavior:["type",Ja],artifactBehavior:["type",Lu],boundaryEventBehavior:["type",Nu],categoryRootElementReferenceBehavior:["type",$u],compensateBoundaryEventBehaviour:["type",ju],createBehavior:["type",Fu],createDataObjectBehavior:["type",Hu],createParticipantBehavior:["type",Gu],dataInputAssociationBehavior:["type",Wu],dataStoreBehavior:["type",Uu],deleteLaneBehavior:["type",qu],detachEventBehavior:["type",ss],dropOnFlowBehavior:["type",Ku],eventBasedGatewayBehavior:["type",Xu],fixHoverBehavior:["type",kh],groupBehavior:["type",Zu],importDockingFix:["type",Oh],isHorizontalFix:["type",Ju],labelBehavior:["type",tl],layoutConnectionBehavior:["type",nl],messageFlowBehavior:["type",ol],nonInterruptingBehavior:["type",al],removeElementBehavior:["type",cl],removeEmbeddedLabelBoundsBehavior:["type",sl],removeParticipantBehavior:["type",ul],replaceConnectionBehavior:["type",ll],replaceElementBehaviour:["type",hs],resizeBehavior:["type",nm],resizeLaneBehavior:["type",cm],rootElementReferenceBehavior:["type",hl],spaceToolBehavior:["type",lm],subProcessPlaneBehavior:["type",si],subProcessStartEventBehavior:["type",gl],textAnnotationBehavior:["type",vl],toggleCollapseConnectionBehaviour:["type",yl],toggleElementCollapseBehaviour:["type",bl],unclaimIdBehavior:["type",xl],unsetDefaultFlowBehavior:["type",El],updateFlowNodeRefsBehavior:["type",wl],updateCategoryValueRefsBehavior:["type",Sl],setCompensationActivityAfterPasteBehavior:["type",Rl]};function Cl(e){this._commandStack=e.get("commandStack",!1)}Cl.$inject=["injector"],Cl.prototype.allowed=function(e,t){var n=!0,i=this._commandStack;return i&&(n=i.canExecute(e,t)),n===void 0?!0:n};const Un={__init__:["rules"],rules:["type",Cl]};function xn(e){W.call(this,e),this.init()}xn.$inject=["eventBus"],Q(xn,W),xn.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)})},xn.prototype.init=function(){};function xm(e,t){var n=At(e,t,-15);return n!=="intersect"?n:null}function Mt(e){xn.call(this,e)}Q(Mt,xn),Mt.$inject=["eventBus"],Mt.prototype.init=function(){this.addRule("connection.start",function(e){var t=e.source;return pR(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 bs(t,n)}finally{r&&(n.parent=null)}}),this.addRule("connection.reconnect",function(e){var t=e.connection,n=e.source,i=e.target;return bs(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 Im(t,n,i)}),this.addRule("elements.create",function(e){var t=e.elements,n=e.position,i=e.target;return $e(i)&&!xs(t,i)?!1:tr(t,function(r){return $e(r)?bs(r.source,r.target,r):r.host?jo(r,r.host,null,n):Ml(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 Am(a)&&!n.includes(a.host)})?!1:jo(n,t,null,i)||Dm(n,t,i)||Om(n,t)||xs(n,t)}),this.addRule("shape.create",function(e){return Ml(e.shape,e.target,e.source,e.position)}),this.addRule("shape.attach",function(e){return jo(e.shape,e.target,null,e.position)}),this.addRule("element.copy",function(e){var t=e.element,n=e.elements;return jm(n,t)})},Mt.prototype.canConnectMessageFlow=Nm,Mt.prototype.canConnectSequenceFlow=$m,Mt.prototype.canConnectDataAssociation=kl,Mt.prototype.canConnectAssociation=Lm,Mt.prototype.canConnectCompensationAssociation=Bm,Mt.prototype.canMove=Om,Mt.prototype.canAttach=jo,Mt.prototype.canReplace=Dm,Mt.prototype.canDrop=Yr,Mt.prototype.canInsert=xs,Mt.prototype.canCreate=Ml,Mt.prototype.canConnect=bs,Mt.prototype.canResize=Im,Mt.prototype.canCopy=jm;function pR(e){return Pl(e)?null:xe(e,["bpmn:FlowNode","bpmn:InteractionNode","bpmn:DataObjectReference","bpmn:DataStoreReference","bpmn:Group","bpmn:TextAnnotation"])}function Pl(e){return!e||_e(e)}function Em(e){do{if(y(e,"bpmn:Process"))return U(e);if(y(e,"bpmn:Participant"))return U(e).processRef||U(e)}while(e=e.parent)}function Al(e){return y(e,"bpmn:TextAnnotation")}function Tl(e){return y(e,"bpmn:Group")&&!e.labelTarget}function wm(e){return y(e,"bpmn:BoundaryEvent")&&qn(e,"bpmn:CompensateEventDefinition")}function _s(e){return U(e).isForCompensation}function fR(e,t){var n=Em(e),i=Em(t);return n===i}function dR(e){return y(e,"bpmn:InteractionNode")&&!y(e,"bpmn:BoundaryEvent")&&(!y(e,"bpmn:Event")||y(e,"bpmn:ThrowEvent")&&Cm(e,"bpmn:MessageEventDefinition"))}function hR(e){return y(e,"bpmn:InteractionNode")&&!_s(e)&&(!y(e,"bpmn:Event")||y(e,"bpmn:CatchEvent")&&Cm(e,"bpmn:MessageEventDefinition"))&&!(y(e,"bpmn:BoundaryEvent")&&!qn(e,"bpmn:MessageEventDefinition"))}function Sm(e){for(var t=e;t=t.parent;){if(y(t,"bpmn:FlowElementsContainer"))return U(t);if(y(t,"bpmn:Participant"))return U(t).processRef}return null}function Rm(e,t){var n=Sm(e),i=Sm(t);return n===i}function qn(e,t){var n=U(e);return!!He(n.eventDefinitions||[],function(i){return y(i,t)})}function Cm(e,t){var n=U(e);return(n.eventDefinitions||[]).every(function(i){return y(i,t)})}function mR(e){return y(e,"bpmn:FlowNode")&&!y(e,"bpmn:EndEvent")&&!jt(e)&&!(y(e,"bpmn:IntermediateThrowEvent")&&qn(e,"bpmn:LinkEventDefinition"))&&!wm(e)&&!_s(e)}function gR(e){return y(e,"bpmn:FlowNode")&&!y(e,"bpmn:StartEvent")&&!y(e,"bpmn:BoundaryEvent")&&!jt(e)&&!(y(e,"bpmn:IntermediateCatchEvent")&&qn(e,"bpmn:LinkEventDefinition"))&&!_s(e)}function vR(e){return y(e,"bpmn:ReceiveTask")||y(e,"bpmn:IntermediateCatchEvent")&&(qn(e,"bpmn:MessageEventDefinition")||qn(e,"bpmn:TimerEventDefinition")||qn(e,"bpmn:ConditionalEventDefinition")||qn(e,"bpmn:SignalEventDefinition"))}function yR(e){for(var t=[];e;)e=e.parent,e&&t.push(e);return t}function Pm(e,t){var n=yR(t);return n.indexOf(e)!==-1}function bs(e,t,n){if(Pl(e)||Pl(t))return null;if(!y(n,"bpmn:DataAssociation")){if(Nm(e,t))return{type:"bpmn:MessageFlow"};if($m(e,t))return{type:"bpmn:SequenceFlow"}}var i=kl(e,t);return i||(Bm(e,t)?{type:"bpmn:Association",associationDirection:"One"}:Lm(e,t)?{type:"bpmn:Association",associationDirection:"None"}:!1)}function Yr(e,t){return _e(e)||Tl(e)?!0:y(t,"bpmn:Participant")&&!Re(t)?!1:y(e,"bpmn:Participant")?y(t,"bpmn:Process")||y(t,"bpmn:Collaboration"):xe(e,["bpmn:DataInput","bpmn:DataOutput"])&&e.parent?t===e.parent:y(e,"bpmn:Lane")?y(t,"bpmn:Participant")||y(t,"bpmn:Lane"):y(e,"bpmn:BoundaryEvent")&&!_R(e)?!1:y(e,"bpmn:FlowElement")&&!y(e,"bpmn:DataStoreReference")?y(t,"bpmn:FlowElementsContainer")?Re(t):xe(t,["bpmn:Participant","bpmn:Lane"]):y(e,"bpmn:DataStoreReference")&&y(t,"bpmn:Collaboration")?bi(U(t).get("participants"),function(n){return!!n.get("processRef")}):xe(e,["bpmn:Artifact","bpmn:DataAssociation","bpmn:DataStoreReference"])?xe(t,["bpmn:Collaboration","bpmn:Lane","bpmn:Participant","bpmn:Process","bpmn:SubProcess"]):y(e,"bpmn:MessageFlow")?y(t,"bpmn:Collaboration")||e.source.parent==t||e.target.parent==t:!1}function _R(e){return U(e).cancelActivity&&(Tm(e)||Mm(e))}function Am(e){return!_e(e)&&y(e,"bpmn:BoundaryEvent")}function bR(e){return y(e,"bpmn:Lane")}function xR(e){return Am(e)||y(e,"bpmn:IntermediateThrowEvent")&&Tm(e)?!0:y(e,"bpmn:IntermediateCatchEvent")&&Mm(e)}function Tm(e){var t=U(e);return t&&!(t.eventDefinitions&&t.eventDefinitions.length)}function Mm(e){return km(e,["bpmn:MessageEventDefinition","bpmn:TimerEventDefinition","bpmn:SignalEventDefinition","bpmn:ConditionalEventDefinition"])}function km(e,t){return t.some(function(n){return qn(e,n)})}function ER(e){return y(e,"bpmn:ReceiveTask")&&He(e.incoming,function(t){return y(t.source,"bpmn:EventBasedGateway")})}function jo(e,t,n,i){if(Array.isArray(e)||(e=[e]),e.length!==1)return!1;var r=e[0];return _e(r)||!xR(r)||jt(t)||!y(t,"bpmn:Activity")||_s(t)||i&&!xm(i,t)||ER(t)?!1:"attach"}function Dm(e,t,n){if(!t)return!1;var i={replacements:[]};return T(e,function(r){jt(t)||y(r,"bpmn:StartEvent")&&r.type!=="label"&&Yr(r,t)&&(kw(r)||i.replacements.push({oldElementId:r.id,newElementType:"bpmn:StartEvent"}),(Dw(r)||Ow(r)||Iw(r))&&i.replacements.push({oldElementId:r.id,newElementType:"bpmn:StartEvent"}),km(r,["bpmn:MessageEventDefinition","bpmn:TimerEventDefinition","bpmn:SignalEventDefinition","bpmn:ConditionalEventDefinition"])&&y(t,"bpmn:SubProcess")&&i.replacements.push({oldElementId:r.id,newElementType:"bpmn:StartEvent"})),y(t,"bpmn:Transaction")||qn(r,"bpmn:CancelEventDefinition")&&r.type!=="label"&&(y(r,"bpmn:EndEvent")&&Yr(r,t)&&i.replacements.push({oldElementId:r.id,newElementType:"bpmn:EndEvent"}),y(r,"bpmn:BoundaryEvent")&&jo(r,t,null,n)&&i.replacements.push({oldElementId:r.id,newElementType:"bpmn:BoundaryEvent"}))}),i.replacements.length?i:!1}function Om(e,t){return bi(e,bR)?!1:t===void 0?!0:t===null?!1:e.every(function(n){return Yr(n,t)})}function Ml(e,t,n,i){return t?_e(e)||Tl(e)?!0:Yr(e,t)||xs(e,t):!1}function Im(e,t,n){return y(e,"bpmn:SubProcess")?Re(e)&&(!t||t.width>=100&&t.height>=80):y(e,"bpmn:Lane")||y(e,"bpmn:Participant")?!0:Al(e)?n?n==="e"||n==="w":!0:Tl(e)?!0:_e(e)?n?n==="e"||n==="w":!0:!1}function wR(e,t){var n=Al(e),i=Al(t);return(n||i)&&n!==i}function Lm(e,t){return Pm(t,e)||Pm(e,t)?!1:wR(e,t)?!0:!!kl(e,t)}function Bm(e,t){return Rm(e,t)&&wm(e)&&y(t,"bpmn:Activity")&&!RR(t,e)&&!jt(t)}function Nm(e,t){return Hm(e)&&!Hm(t)?!1:dR(e)&&hR(t)&&!fR(e,t)}function $m(e,t){return mR(e)&&gR(t)&&Rm(e,t)&&!(y(e,"bpmn:EventBasedGateway")&&!vR(t))}function kl(e,t){return xe(e,["bpmn:DataObjectReference","bpmn:DataStoreReference"])&&xe(t,["bpmn:Activity","bpmn:ThrowEvent"])?{type:"bpmn:DataInputAssociation"}:xe(t,["bpmn:DataObjectReference","bpmn:DataStoreReference"])&&xe(e,["bpmn:Activity","bpmn:CatchEvent"])?{type:"bpmn:DataOutputAssociation"}:!1}function xs(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:xe(t,["bpmn:SequenceFlow","bpmn:MessageFlow"])&&!_e(t)&&y(e,"bpmn:FlowNode")&&!y(e,"bpmn:BoundaryEvent")&&Yr(e,t.parent)}function Dl(e,t){return e&&t&&e.indexOf(t)!==-1}function jm(e,t){return _e(t)?!0:!(y(t,"bpmn:Lane")&&!Dl(e,t.parent)||y(t,"bpmn:MessageFlow")&&!SR(e,t))}function SR(e,t){var n=Fm(t.source),i=Fm(t.target);return Dl(e,n)&&Dl(e,i)}function Fm(e){for(;e;e=e.parent)if(y(e,"bpmn:Participant"))return e;return null}function Hm(e){return Hr(e,"bpmn:Process")||Hr(e,"bpmn:Collaboration")}function RR(e,t){return e.attachers.includes(t)}const CR={__depends__:[Un],__init__:["bpmnRules"],bpmnRules:["type",Mt]};var PR=2e3;function zm(e,t){e.on("saveXML.start",PR,n);function n(){var i=t.getRootElements();T(i,function(r){var o=Me(r),a,s;a=Eo([r]),a=we(a,function(c){return c!==r&&!c.labelTarget}),s=It(a,Me),o.set("planeElement",s)})}}zm.$inject=["eventBus","canvas"];const AR={__init__:["bpmnDiOrdering"],bpmnDiOrdering:["type",zm]};function Es(e){W.call(this,e);var t=this;this.preExecute(["shape.create","connection.create"],function(n){var i=n.context,r=i.shape||i.connection,o=i.parent,a=t.getOrdering(r,o);a&&(a.parent!==void 0&&(i.parent=a.parent),i.parentIndex=a.index)}),this.preExecute(["shape.move","connection.move"],function(n){var i=n.context,r=i.shape||i.connection,o=i.newParent||r.parent,a=t.getOrdering(r,o);a&&(a.parent!==void 0&&(i.newParent=a.parent),i.newParentIndex=a.index)})}Es.prototype.getOrdering=function(e,t){return null},Q(Es,W);function Ol(e,t){Es.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=He(n,function(c){return xe(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&&!xe(u,c);)u=u.parent;if(!u)throw new Error(`no parent for <${a.id}> in <${s&&s.id}>`);return u}this.getOrdering=function(a,s){if(a.labelTarget||y(a,"bpmn:TextAnnotation"))return{parent:t.findRoot(s)||t.getRootElement(),index:-1};var c=r(a);c.containers&&(s=o(a,s,c.containers));var u=s.children.indexOf(a),l=sf(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}}}Ol.$inject=["eventBus","canvas"],Q(Ol,Es);const TR={__init__:["bpmnOrderingProvider"],bpmnOrderingProvider:["type",Ol]};function Fo(){}Fo.prototype.get=function(){return this._data},Fo.prototype.set=function(e){this._data=e},Fo.prototype.clear=function(){var e=this._data;return delete this._data,e},Fo.prototype.isEmpty=function(){return!this._data};const MR={clipboard:["type",Fo]};var Vm=1500;function Gm(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",Vm,function(s){o(s)})}),(function(){var a,s;t.on("element.hover",function(c){a=c.gfx,s=c.element}),t.on("element.hover",Vm,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=hr(a),c=document.elementFromPoint(s.x,s.y),kR(c)}}Gm.$inject=["elementRegistry","eventBus","injector"];function kR(e){return cr(e,"svg, .djs-element",!0)}const DR={__init__:["hoverFix"],hoverFix:["type",Gm]};function OR(e){return!0}function ws(e){return Ni(e)||$S(e)}var Wm=500;function Um(e,t,n){var i=this;function r(C,$,j){if(!s(C,$)){var L,F,re;j?F=t.getGraphics(j):(L=$.delegateTarget||$.target,L&&(F=L,j=t.get(F))),!(!F||!j)&&(re=e.fire(C,{element:j,gfx:F,originalEvent:$}),re===!1&&($.stopPropagation(),$.preventDefault()))}}var o={};function a(C){return o[C]}function s(C,$){var j=u[C]||Ni;return!j($)}var c={click:"element.click",contextmenu:"element.contextmenu",dblclick:"element.dblclick",mousedown:"element.mousedown",mousemove:"element.mousemove",mouseover:"element.hover",mouseout:"element.out",mouseup:"element.mouseup"},u={"element.contextmenu":OR,"element.mousedown":ws,"element.mouseup":ws,"element.click":ws,"element.dblclick":ws};function l(C,$,j){var L=c[C];if(!L)throw new Error("unmapped DOM event name <"+C+">");return r(L,$,j)}var p="svg, .djs-element";function f(C,$,j,L){var F=o[j]=function(re){r(j,re)};L&&(u[j]=L),F.$delegate=tn.bind(C,p,$,F)}function d(C,$,j){var L=a(j);L&&tn.unbind(C,$,L.$delegate)}function h(C){T(c,function($,j){f(C,j,$)})}function m(C){T(c,function($,j){d(C,j,$)})}e.on("canvas.destroy",function(C){m(C.svg)}),e.on("canvas.init",function(C){h(C.svg)}),e.on(["shape.added","connection.added"],function(C){var $=C.element,j=C.gfx;e.fire("interactionEvents.createHit",{element:$,gfx:j})}),e.on(["shape.changed","connection.changed"],Wm,function(C){var $=C.element,j=C.gfx;e.fire("interactionEvents.updateHit",{element:$,gfx:j})}),e.on("interactionEvents.createHit",Wm,function(C){var $=C.element,j=C.gfx;i.createDefaultHit($,j)}),e.on("interactionEvents.updateHit",function(C){var $=C.element,j=C.gfx;i.updateDefaultHit($,j)});var g=S("djs-hit djs-hit-stroke"),w=S("djs-hit djs-hit-click-stroke"),E=S("djs-hit djs-hit-all"),b=S("djs-hit djs-hit-no-move"),x={all:E,"click-stroke":w,stroke:g,"no-move":b};function S(C,$){return $=k({stroke:"white",strokeWidth:15},$||{}),n.cls(C,["no-fill","no-border"],$)}function A(C,$){var j=x[$];if(!j)throw new Error("invalid hit type <"+$+">");return J(C,j),C}function I(C,$){ge(C,$)}this.removeHits=function(C){var $=Ia(".djs-hit",C);T($,vt)},this.createDefaultHit=function(C,$){var j=C.waypoints,L=C.isFrame,F;return j?this.createWaypointsHit($,j):(F=L?"stroke":"all",this.createBoxHit($,F,{width:C.width,height:C.height}))},this.createWaypointsHit=function(C,$){var j=xo($);return A(j,"stroke"),I(C,j),j},this.createBoxHit=function(C,$,j){j=k({x:0,y:0},j);var L=se("rect");return A(L,$),J(L,j),I(C,L),L},this.updateDefaultHit=function(C,$){var j=Be(".djs-hit",$);if(j)return C.waypoints?_u(j,C.waypoints):J(j,{width:C.width,height:C.height}),j},this.fire=r,this.triggerMouseEvent=l,this.mouseHandler=a,this.registerEvent=f,this.unregisterEvent=d}Um.$inject=["eventBus","elementRegistry","styles"];const Ss={__init__:["interactionEvents"],interactionEvents:["type",Um]};function Kr(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)})}Kr.$inject=["eventBus","canvas"],Kr.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()})}},Kr.prototype.get=function(){return Array.from(this._selectedElements)},Kr.prototype.isSelected=function(e){return this._selectedElements.has(e)},Kr.prototype.select=function(e,t){var n=this.get();pe(e)||(e=e?[e]:[]);var i=this._canvas,r=i.getRootElement();e=e.filter(function(o){var a=i.findRoot(o);return r===a}),t?T(e,o=>{this._selectedElements.add(o)}):this._selectedElements=new Set(e),this._eventBus.fire("selection.changed",{oldSelection:n,newSelection:this.get()})};var qm="hover",Ym="selected";function Km(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,qm)}),t.on("element.out",function(r){i(r.element,qm)}),t.on("selection.changed",function(r){function o(u){i(u,Ym)}function a(u){n(u,Ym)}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)})}Km.$inject=["canvas","eventBus"];function Xm(e,t,n,i){e.on("create.end",500,function(r){var o=r.context,a=o.canExecute,s=o.elements,c=o.hints||{},u=c.autoSelect;if(a){if(u===!1)return;pe(u)?t.select(u):t.select(s.filter(IR))}}),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=He(o,function(c){return a.id===c.id});s||t.select(a)}),e.on("element.click",function(r){if(Ni(r)){var o=r.element;o===n.getRootElement()&&(o=null);var a=t.isSelected(o),s=t.get().length>1,c=vs(r);if(a&&s)return c?t.deselect(o):t.select(o);a?t.deselect(o):t.select(o,c)}})}Xm.$inject=["eventBus","selection","canvas","elementRegistry"];function IR(e){return!e.hidden}const En={__init__:["selectionVisuals","selectionBehavior"],__depends__:[Ss],selection:["type",Kr],selectionVisuals:["type",Km],selectionBehavior:["type",Xm]};var LR=/^djs-cursor-.*$/;function Rs(e){var t=Ye(document.body);t.removeMatching(LR),e&&t.add("djs-cursor-"+e)}function Zm(){Rs(null)}var BR=5e3;function Qm(e,t){t=t||"element.click";function n(){return!1}return e.once(t,BR,n),function(){e.off(t,n)}}var NR=["c","C"],$R=["v","V"],jR=["d","D"],FR=["x","X"],HR=["y","Y"],Jm=["z","Z"];function zR(e){return e.ctrlKey||e.metaKey||e.shiftKey||e.altKey}function on(e){return e.altKey?!1:e.ctrlKey||e.metaKey}function yt(e,t){return e=pe(e)?e:[e],e.indexOf(t.key)!==-1||e.indexOf(t.code)!==-1}function Il(e){return e.shiftKey}function VR(e){return on(e)&&yt(NR,e)}function GR(e){return on(e)&&yt($R,e)}function WR(e){return on(e)&&yt(jR,e)}function UR(e){return on(e)&&yt(FR,e)}function qR(e){return on(e)&&!Il(e)&&yt(Jm,e)}function YR(e){return on(e)&&(yt(HR,e)||yt(Jm,e)&&Il(e))}var Xr=Math.round,eg="djs-drag-active";function gr(e){e.preventDefault()}function KR(e){return typeof TouchEvent<"u"&&e instanceof TouchEvent}function XR(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}function tg(e,t,n,i){var r={threshold:5,trapClick:!0},o;function a(b){var x=t.viewbox(),S=t._container.getBoundingClientRect();return{x:x.x+(b.x-S.left)/x.scale,y:x.y+(b.y-S.top)/x.scale}}function s(b,x){x=x||o;var S=e.createEvent(k({},x.payload,x.data,{isTouch:x.isTouch}));return e.fire("drag."+b,S)===!1?!1:e.fire(x.prefix+"."+b,S)}function c(b){var x=b.filter(function(S){return i.get(S.id)});x.length&&n.select(x)}function u(b,x){var S=o.payload,A=o.displacement,I=o.globalStart,C=hr(b),$=kn(C,I),j=o.localStart,L=a(C),F=kn(L,j);if(!o.active&&(x||XR($)>o.threshold)){if(k(S,{x:Xr(j.x+A.x),y:Xr(j.y+A.y),dx:0,dy:0},{originalEvent:b}),s("start")===!1)return g();o.active=!0,o.keepSelection||(S.previousSelection=n.get(),n.select(null)),o.cursor&&Rs(o.cursor),t.addMarker(t.getRootElement(),eg)}dl(b),o.active&&(k(S,{x:Xr(L.x+A.x),y:Xr(L.y+A.y),dx:Xr(F.x),dy:Xr(F.y)},{originalEvent:b}),s("move"))}function l(b){var x,S=!0;o.active&&(b&&(o.payload.originalEvent=b,dl(b)),S=s("end")),S===!1&&s("rejected"),x=w(S!==!0),s("ended",x)}function p(b){yt("Escape",b)&&(gr(b),g())}function f(b){var x;o.active&&(x=Qm(e),setTimeout(x,400),gr(b)),l(b)}function d(b){u(b)}function h(b){var x=o.payload;x.hoverGfx=b.gfx,x.hover=b.element,s("hover")}function m(b){s("out");var x=o.payload;x.hoverGfx=null,x.hover=null}function g(b){var x;if(o){var S=o.active;S&&s("cancel"),x=w(b),S&&s("canceled",x)}}function w(b){var x,S;s("cleanup"),Zm(),o.trapClick?S=f:S=l,me.unbind(document,"mousemove",u),me.unbind(document,"dragstart",gr),me.unbind(document,"selectstart",gr),me.unbind(document,"mousedown",S,!0),me.unbind(document,"mouseup",S,!0),me.unbind(document,"keyup",p),me.unbind(document,"touchstart",d,!0),me.unbind(document,"touchcancel",g,!0),me.unbind(document,"touchmove",u,!0),me.unbind(document,"touchend",l,!0),e.off("element.hover",h),e.off("element.out",m),t.removeMarker(t.getRootElement(),eg);var A=o.payload.previousSelection;return b!==!1&&A&&!n.get().length&&c(A),x=o,o=null,x}function E(b,x,S,A){o&&g(!1),typeof x=="string"&&(A=S,S=x,x=null),A=k({},r,A||{});var I=A.data||{},C,$,j,L,F;if(A.trapClick?L=f:L=l,b?(C=qr(b)||b,$=hr(b),dl(b),C.type==="dragstart"&&gr(C)):(C=null,$={x:0,y:0}),j=a($),x||(x=j),F=KR(C),o=k({prefix:S,data:I,payload:{},globalStart:$,displacement:kn(x,j),localStart:j,isTouch:F},A),A.manual||(F?(me.bind(document,"touchstart",d,!0),me.bind(document,"touchcancel",g,!0),me.bind(document,"touchmove",u,!0),me.bind(document,"touchend",l,!0)):(me.bind(document,"mousemove",u),me.bind(document,"dragstart",gr),me.bind(document,"selectstart",gr),me.bind(document,"mousedown",L,!0),me.bind(document,"mouseup",L,!0)),me.bind(document,"keyup",p),e.on("element.hover",h),e.on("element.out",m)),s("init")===!1)return g(),!1;A.autoActivate&&u(b,!0)}e.on("diagram.destroy",g),this.init=E,this.move=u,this.hover=h,this.out=m,this.end=l,this.cancel=g,this.context=function(){return o},this.setOptions=function(b){k(r,b)}}tg.$inject=["eventBus","canvas","selection","elementRegistry"];const ci={__depends__:[DR,En],dragging:["type",tg]};function Zr(e){this._counter=0,this._prefix=(e?e+"-":"")+Math.floor(Math.random()*1e9)+"-"}Zr.prototype.next=function(){return this._prefix+ ++this._counter};const ZR=new Zr("ps");var QR=["marker-start","marker-mid","marker-end"],JR=["circle","ellipse","line","path","polygon","polyline","path","rect"];function $i(e,t,n,i){this._elementRegistry=e,this._canvas=n,this._styles=i}$i.$inject=["elementRegistry","eventBus","canvas","styles"],$i.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")},$i.prototype.getGfx=function(e){return this._elementRegistry.getGraphics(e)},$i.prototype.addDragger=function(e,t,n,i="djs-dragger"){n=n||this.getGfx(e);var r=hd(n);return this._cloneMarkers(pr(r),i),J(r,this._styles.cls(i,[])),ge(t,r),J(r,"data-preview-support-element-id",e.id),r},$i.prototype.addFrame=function(e,t){var n=se("rect",{class:"djs-resize-overlay",width:e.width,height:e.height,x:e.x,y:e.y});return ge(t,n),J(n,"data-preview-support-element-id",e.id),n},$i.prototype._cloneMarkers=function(e,t="djs-dragger",n=e){var i=this;e.childNodes&&e.childNodes.forEach(r=>{i._cloneMarkers(r,t,n)}),iC(e)&&QR.forEach(function(r){if(J(e,r)){var o=eC(e,r,i._canvas.getContainer());o&&i._cloneMarker(n,e,o,r,t)}})},$i.prototype._cloneMarker=function(e,t,n,i,r="djs-dragger"){var o=[n.id,r,ZR.next()].join("-"),a=Be("marker#"+n.id,e);e=e||this._canvas._svg;var s=a||hd(n);s.id=o,Pe(s).add(r);var c=Be(":scope > defs",e);c||(c=se("defs"),ge(e,c)),ge(c,s);var u=nC(s.id);J(t,i,u)};function eC(e,t,n){var i=tC(J(e,t));return Be("marker#"+i,n||document)}function tC(e){return e.match(/url\(['"]?#([^'"]*)['"]?\)/)[1]}function nC(e){return"url(#"+e+")"}function iC(e){return JR.indexOf(e.nodeName)!==-1}const Qr={__init__:["previewSupport"],previewSupport:["type",$i]};var rC="drop-ok",ng="drop-not-ok",ig="attach-ok",rg="new-parent",og="create",oC=2e3;function ag(e,t,n,i,r){function o(c,u,l,p,f){if(!u)return!1;c=we(c,function(E){var b=E.labelTarget;return!E.parent&&!(_e(E)&&c.indexOf(b)!==-1)});var d=He(c,function(E){return!$e(E)}),h=!1,m=!1,g=!1;cg(c)&&(h=r.allowed("shape.attach",{position:l,shape:d,target:u})),h||(cg(c)?g=r.allowed("shape.create",{position:l,shape:d,source:p,target:u}):g=r.allowed("elements.create",{elements:c,position:l,target:u}));var w=f.connectionTarget;return g||h?(d&&p&&(m=r.allowed("connection.create",{source:w===p?d:p,target:w===p?p:d,hints:{targetParent:u,targetAttach:h}})),{attach:h,connect:m}):g===null||h===null?null:!1}function a(c,u){[ig,rC,ng,rg].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}sg(c);var h={x:c.x,y:c.y},m=u.canExecute=p&&o(l,p,h,f,d);p&&m!==null&&(u.target=p,m&&m.attach?a(p,ig):a(p,m?rg:ng))}),n.on(["create.end","create.out","create.cleanup"],function(c){var u=c.hover;u&&a(u,null)}),n.on("create.end",function(c){var u=c.context,l=u.source,p=u.shape,f=u.elements,d=u.target,h=u.canExecute,m=h&&h.attach,g=h&&h.connect,w=u.hints||{};if(h===!1||!d)return!1;sg(c);var E={x:c.x,y:c.y};g?p=i.appendShape(l,p,E,d,{attach:m,connection:g===!0?{}:g,connectionTarget:w.connectionTarget}):(f=i.createElements(f,E,d,k({},w,{attach:m})),p=He(f,function(b){return!$e(b)})),k(u,{elements:f,shape:p}),k(c,{elements:f,shape:p})});function s(){var c=t.context();c&&c.prefix===og&&t.cancel()}n.on("create.init",function(){n.on("elements.changed",s),n.once(["create.cancel","create.end"],oC,function(){n.off("elements.changed",s)})}),this.start=function(c,u,l){pe(u)||(u=[u]);var p=He(u,function(h){return!$e(h)});if(p){l=k({elements:u,hints:{},shape:p},l||{}),T(u,function(h){he(h.x)||(h.x=0),he(h.y)||(h.y=0)});var f=we(u,function(h){return!h.hidden}),d=at(f);T(u,function(h){$e(h)&&(h.waypoints=It(h.waypoints,function(m){return{x:m.x-d.x-d.width/2,y:m.y-d.y-d.height/2}})),k(h,{x:h.x-d.x-d.width/2,y:h.y-d.y-d.height/2})}),t.init(c,og,{cursor:"grabbing",autoActivate:!0,data:{shape:p,elements:u,context:l}})}}}ag.$inject=["canvas","dragging","eventBus","modeling","rules"];function sg(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 cg(e){return e&&e.length===1&&!$e(e[0])}var aC=750;function ug(e,t,n,i,r){function o(a){var s=se("g");J(s,r.cls("djs-drag-group",["no-events"]));var c=se("g");return a.forEach(function(u){var l;u.hidden||(u.waypoints?(l=n._createContainer("connection",c),n.drawConnection(pr(l),u)):(l=n._createContainer("shape",c),n.drawShape(pr(l),u),Tt(l,u.x,u.y)),i.addDragger(u,s,l))}),s}t.on("create.move",aC,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(),ge(p,l)),Tt(l,a.x,a.y)):vt(l)}),t.on("create.cleanup",function(a){var s=a.context,c=s.dragGroup;c&&vt(c)})}ug.$inject=["canvas","eventBus","graphicsFactory","previewSupport","styles"];const Cs={__depends__:[ci,Qr,Un,En],__init__:["create","createPreview"],create:["type",ag],createPreview:["type",ug]};function Ll(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)})}Ll.$inject=["eventBus"],Ll.prototype.getLastMoveEvent=function(){return this._lastMoveEvent||sC(0,0)};function sC(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 Ho={__init__:["mouse"],mouse:["type",Ll]};var lg=2e3;function an(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),cC(l)&&(u.priority=2,u.host=l.host.id),$e(l)&&(u.priority=3,u.source=l.source.id,u.target=l.target.id,u.waypoints=uC(l)),_e(l)&&(u.priority=4,u.labelTarget=l.labelTarget.id),T(["x","y","width","height"],function(f){he(l[f])&&(u[f]=l[f])}),u.hidden=l.hidden,u.collapsed=l.collapsed}),r.on("copyPaste.elementsCopied",lg,function(c){var u;((u=c.hints)==null?void 0:u.clip)!==!1&&n.set(c.tree)}),r.on("copyPaste.pasteElements",lg,function(c){c.tree||(c.tree=n.get())}),r.on("copyPaste.pasteElements",function(c){var u=c.hints;k(u,{createElementsBehavior:!1})})}an.$inject=["canvas","create","clipboard","elementFactory","eventBus","modeling","mouse","rules"],an.prototype.copy=function(e,t={}){var n,i;return pe(e)||(e=e?[e]:[]),n=this._eventBus.fire("copyPaste.canCopyElements",{elements:e}),n===!1?i={}:i=this.createTree(pe(n)?n:e),this._eventBus.fire("copyPaste.elementsCopied",{elements:e,tree:i,hints:t}),i},an.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})}}},an.prototype.duplicate=function(e,t={}){var n=this.copy(e,{clip:!1});return this.paste({...t,tree:n})},an.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},an.prototype._getElementIdsFromTree=function(e){var t={};return T(e,function(n){T(n,function(i){i.id&&(t[i.id]=!0)})}),t},an.prototype._paste=function(e,t,n,i){T(e,function(o){he(o.x)||(o.x=0),he(o.y)||(o.y=0)});var r=at(e);return T(e,function(o){$e(o)&&(o.waypoints=It(o.waypoints,function(a){return{x:a.x-r.x-r.width/2,y:a.y-r.y-r.height/2}})),k(o,{x:o.x-r.x-r.width/2,y:o.y-r.y-r.height/2})}),this._modeling.createElements(e,n,t,k({},i))},an.prototype._createElements=function(e){var t=this,n=this._eventBus,i={},r=[];return T(e,function(o,a){o=In(o,"priority"),T(o,function(s){var c=k({},Ln(s,["priority"]));i[s.parent]?c.parent=i[s.parent]:delete c.parent,n.fire("copyPaste.pasteElement",{cache:i,descriptor:c});var u;if($e(c)){c.source=i[s.source],c.target=i[s.target],u=i[s.id]=t.createConnection(c),r.push(u);return}if(_e(c)){c.labelTarget=i[c.labelTarget],u=i[s.id]=t.createLabel(c),r.push(u);return}c.host&&(c.host=i[c.host]),u=i[s.id]=t.createShape(c),r.push(u)})}),r},an.prototype.createConnection=function(e){var t=this._elementFactory.createConnection(Ln(e,["id"]));return t},an.prototype.createLabel=function(e){var t=this._elementFactory.createLabel(Ln(e,["id"]));return t},an.prototype.createShape=function(e){var t=this._elementFactory.createShape(Ln(e,["id"]));return t},an.prototype.hasRelations=function(e,t,n){return n||(n=new Set(t)),!($e(e)&&(!n.has(e.source)||!n.has(e.target))||_e(e)&&!n.has(e.labelTarget))},an.prototype.createTree=function(e){var t=this._rules,n=this,i={},r=[],o=new Map,a=$a(e);function s(p,f){return t.allowed("element.copy",{element:p,elements:f})}function c(p,f){var d=o.get(p);if(!d){var h={element:p,depth:f};r.push(h),o.set(p,h);return}if(d.depth<f){r=u(d,r);var m={element:d.element,depth:f};r.push(m),o.set(p,m)}}function u(p,f){var d=f.indexOf(p);return d!==-1&&f.splice(d,1),f}lr(a,function(p,f,d){if(_e(p))return;T(p.labels,function(g){c(g,d)});function h(g){g&&g.length&&T(g,function(w){T(w.labels,function(E){c(E,d)}),c(w,d)})}T([p.attachers,p.incoming,p.outgoing],h),c(p,d);var m=[];return p.children&&(m=p.children.slice()),n._eventBus.fire("copyPaste.createTree",{element:p,children:m}),m}),e=It(r,function(p){return p.element});var l=new Set(e);return r=It(r,function(p){return p.descriptor={},n._eventBus.fire("copyPaste.copyElement",{descriptor:p.descriptor,element:p.element,elements:e,elementsSet:l}),p}),r=In(r,function(p){return p.descriptor.priority}),e=It(r,function(p){return p.element}),T(r,function(p){var f=p.depth;if(!n.hasRelations(p.element,e,l)){fg(p.element,e),l.delete(p.element);return}if(!s(p.element,e)){fg(p.element,e),l.delete(p.element);return}i[f]||(i[f]=[]),i[f].push(p.descriptor)}),i};function cC(e){return!!e.host}function uC(e){return It(e.waypoints,function(t){return t=pg(t),t.original&&(t.original=pg(t.original)),t})}function pg(e){return k({},e)}function fg(e,t){var n=t.indexOf(e);return n===-1?t:t.splice(n,1)}const lC={__depends__:[MR,Cs,Ho,Un],__init__:["copyPaste"],copyPaste:["type",an]};function Bl(e,t,n){pe(n)||(n=[n]),T(n,function(i){er(e[i])||(t[i]=e[i])})}var Nl=750;function dg(e,t,n){function i(c,u){var l=e.create(c.$type);return n.copyElement(c,l,null,u)}t.on("copyPaste.copyElement",Nl,function(c){var u=c.descriptor,l=c.element,p=U(l);if(_e(l))return u;var f=u.businessObject=i(p,!0),d=u.di=i(Me(l),!0);d.bpmnElement=f,Bl(f,u,"name"),Bl(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=U(c);return c.default&&(l[c.default]={element:p,property:"default"}),c.host&&(U(c).attachedToRef=U(u[c.host])),Ln(l,en(l,function(f,d,h){var m=d.element,g=d.property;return h===c.id&&(m.set(g,p),f.push(c.id)),f},[]))}t.on("copyPaste.pasteElement",function(c){var u=c.cache,l=c.descriptor,p=l.businessObject,f=l.di;if(_e(l)){l.businessObject=U(u[l.labelTarget]),l.di=Me(u[l.labelTarget]);return}p=l.businessObject=i(p),f=l.di=i(f),f.bpmnElement=p,Bl(l,p,["isExpanded","name"]),l.type=p.$type}),t.on("copyPaste.copyElement",Nl,function(c){var u=c.descriptor,l=c.element;if(y(l,"bpmn:Participant")){var p=U(l);p.processRef&&(u.processRef=i(p.processRef,!0))}}),t.on("copyPaste.pasteElement",function(c){var u=c.descriptor,l=u.processRef;l&&(u.processRef=i(l))}),t.on("copyPaste.createTree",function(c){var u=c.element,l=c.children;y(u,"bpmn:SubProcess")&&T(Ao(l),p=>{l.push(p.annotation)})}),t.on("copyPaste.pasteElement",Nl,function(c){var u=c.cache,l=c.descriptor;a(u,s(l,u,o(u)))})}dg.$inject=["bpmnFactory","eventBus","moddleCopy"];const pC=["artifacts","dataInputAssociations","dataOutputAssociations","default","flowElements","lanes","incoming","outgoing","categoryValue"],fC=["errorRef","escalationRef","messageRef","signalRef","dataObjectRef"];function zo(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 In(r,o=>o==="extensionElements")}),e.on("moddleCopy.canCopyProperty",i=>{const{parent:r,property:o,propertyName:a}=i,s=xt(r)&&r.$descriptor;if(a&&fC.includes(a))return o;if(a&&pC.includes(a)||a&&s&&!He(s.properties,Mr({name:a})))return!1}),e.on("moddleCopy.canSetCopiedProperty",i=>{const{property:r}=i;if(y(r,"bpmn:ExtensionElements")&&(!r.values||!r.values.length))return!1})}zo.$inject=["eventBus","bpmnFactory","moddle"],zo.prototype.copyElement=function(e,t,n,i=!1){n&&!pe(n)&&(n=[n]),n=n||$l(e.$descriptor);const r=this._eventBus.fire("moddleCopy.canCopyProperties",{propertyNames:n,sourceElement:e,targetElement:t,clone:i});return r===!1||(pe(r)&&(n=r),T(n,o=>{let a;Jt(e,o)&&(a=e.get(o));const s=this.copyProperty(a,t,o,i);!mt(s)||this._eventBus.fire("moddleCopy.canSetCopiedProperty",{parent:t,property:s,propertyName:o})===!1||t.set(o,s)})),t},zo.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 xt(r)&&r.$type&&!r.$parent&&(r.$parent=t),r;const o=this._moddle.getPropertyDescriptor(t,n);if(!o.isReference)return o.isId?e&&this._copyId(e,t,i):pe(e)?en(e,(a,s)=>{const c=this.copyProperty(s,t,n,i);return c?a.concat(c):a},[]):xt(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},zo.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 $l(e,t){return en(e.properties,(n,i)=>t&&i.default?n:n.concat(i.name),[])}const hg={__depends__:[lC],__init__:["bpmnCopyPaste","moddleCopy"],bpmnCopyPaste:["type",dg],moddleCopy:["type",zo]};var mg=Math.round;function jl(e,t){this._modeling=e,this._eventBus=t}jl.$inject=["modeling","eventBus"],jl.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=mg(s+o/2),l=mg(c+a/2),p=i.replaceShape(e,k({},t,{x:u,y:l,width:o,height:a}),n);return r.fire("replace.end",{element:e,newElement:p,hints:n}),p};function gg(e,t){t.on("replace.end",500,function(n){const{newElement:i,hints:r={}}=n;r.select!==!1&&e.select(i)})}gg.$inject=["selection","eventBus"];const dC={__init__:["replace","replaceSelectionBehavior"],replaceSelectionBehavior:["type",gg],replace:["type",jl]};function hC(e,t,n){pe(n)||(n=[n]),T(n,function(i){er(e[i])||(t[i]=e[i])})}var mC=["cancelActivity","instantiate","eventGatewayType","triggeredByEvent","isInterrupting"];function gC(e,t){var n=e&&Jt(e,"collapsed")?e.collapsed:!Re(e),i;return t&&(Jt(t,"collapsed")||Jt(t,"isExpanded"))?i=Jt(t,"collapsed")?t.collapsed:!t.isExpanded:i=n,n!==i}function vg(e,t,n,i,r,o){function a(s,c,u){u=u||{};var l=c.type,p=s.businessObject;if(Ps(p)&&(l==="bpmn:SubProcess"||l==="bpmn:AdHocSubProcess")&&gC(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),hC(s.di,d.di,["fill","stroke","background-color","border-color","color"]);var h=$l(p.$descriptor),m=$l(f.$descriptor,!0),g=vC(h,m);k(f,Mn(c,mC));var w=we(g,function(x){return x==="eventDefinitions"?yg(s,c.eventDefinitionType):x==="loopCharacteristics"?!jt(f):Jt(f,x)||x==="processRef"&&c.isExpanded===!1||x==="triggeredByEvent"?!1:x==="isForCompensation"?!jt(f):!0});if(f=n.copyElement(p,f,w),c.eventDefinitionType&&(yg(f,c.eventDefinitionType)||(d.eventDefinitionType=c.eventDefinitionType,d.eventDefinitionAttrs=c.eventDefinitionAttrs)),y(p,"bpmn:Activity")){if(Ps(p))d.isExpanded=Re(s);else if(c&&Jt(c,"isExpanded")){d.isExpanded=c.isExpanded;var E=t.getDefaultSize(f,{isExpanded:d.isExpanded});d.width=E.width,d.height=E.height,d.x=s.x-(d.width-s.width)/2,d.y=s.y-(d.height-s.height)/2}Re(s)&&!y(p,"bpmn:Task")&&d.isExpanded&&(d.width=s.width,d.height=s.height)}if(Ps(p)&&!Ps(f)&&(u.moveChildren=!1),y(p,"bpmn:Participant")){c.isExpanded===!0?f.processRef=e.create("bpmn:Process"):u.moveChildren=!1;var b=St(s);Me(s).isHorizontal||(Me(d).isHorizontal=b),d.width=b?s.width:t.getDefaultSize(d).width,d.height=b?t.getDefaultSize(d).height:s.height}return o.allowed("shape.resize",{shape:f})||(d.height=t.getDefaultSize(d).height,d.width=t.getDefaultSize(d).width),f.name=p.name,xe(p,["bpmn:ExclusiveGateway","bpmn:InclusiveGateway","bpmn:Activity"])&&xe(f,["bpmn:ExclusiveGateway","bpmn:InclusiveGateway","bpmn:Activity"])&&(f.default=p.default),c.host&&!y(p,"bpmn:BoundaryEvent")&&y(f,"bpmn:BoundaryEvent")&&(d.host=c.host),(d.type==="bpmn:DataStoreReference"||d.type==="bpmn:DataObjectReference")&&(d.x=s.x+(s.width-d.width)/2),r.replaceElement(s,d,{...u,targetElement:c})}this.replaceElement=a}vg.$inject=["bpmnFactory","elementFactory","moddleCopy","modeling","replace","rules"];function Ps(e){return y(e,"bpmn:SubProcess")}function yg(e,t){var n=U(e);return t&&n.get("eventDefinitions").some(function(i){return y(i,t)})}function vC(e,t){return e.filter(function(n){return t.includes(n)})}const _g={__depends__:[hg,dC,En],bpmnReplace:["type",vg]};var yC=250;function vr(e){this._eventBus=e,this._tools=[],this._active=null}vr.$inject=["eventBus"],vr.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)},vr.prototype.isActive=function(e){return e&&this._active===e},vr.prototype.length=function(e){return this._tools.length},vr.prototype.setActive=function(e){var t=this._eventBus;this._active!==e&&(this._active=e,t.fire("tool-manager.update",{tool:e}))},vr.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),T(t,function(r){i.push(r+".ended"),i.push(r+".canceled")}),n.on(i,yC,function(r){this._active&&(_C(r)||this.setActive(null))},this)};function _C(e){var t=e.originalEvent&&e.originalEvent.target;return t&&cr(t,'.group[data-group="tools"]')}const As={__depends__:[ci],__init__:["toolManager"],toolManager:["type",vr]};function bC(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 xC(e,t){var n=[],i=new Set(e);T(t,function(o){i.add(o)});var r=new Set;return i.forEach(function(o){var a=o.incoming,s=o.outgoing;T(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 EC(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 Fl=Math.abs,wC=Math.round,ui={x:"width",y:"height"},bg="crosshair",ji={n:"top",w:"left",s:"bottom",e:"right"},SC=1500,Ts={n:"s",w:"e",s:"n",e:"w"},Ms=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",SC,function(c){var u=c.context,l=u.initialized;l||(l=u.initialized=s.init(c,u)),l&&Eg(c)}),n.on("spaceTool.end",function(c){var u=c.context,l=u.axis,p=u.direction,f=u.movingShapes,d=u.resizingShapes,h=u.start;if(u.initialized){Eg(c);var m={x:0,y:0};m[l]=wC(c["d"+l]),s.makeSpace(f,d,m,p,h),n.once("spaceTool.ended",function(g){s.activateSelection(g.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:bg,data:{context:{reactivate:n}},trapClick:!1})},wn.prototype.activateMakeSpace=function(e){this._dragging.init(e,"spaceTool",{autoActivate:!0,cursor:bg,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=Fl(e.dx)>Fl(e.dy)?"x":"y",i=e["d"+n],r=e[n]-i;if(Fl(i)<5)return!1;i<0&&(i*=-1),$o(e)&&(i*=-1);var o=bC(n,i),a=this._canvas.getRootElement();!vs(e)&&e.hover&&(a=e.hover);var s=[...Eo(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=RC(c,n,o,r,u);return k(t,c,{axis:n,direction:o,spaceToolConstraints:l,start:r}),Rs("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 h=d.label;h&&!s.has(h)&&(s.add(h),o.push(h))}function f(d){c.has(d)||(c.add(d),a.push(d))}return T(e,function(d){if(!(!d.parent||_e(d))){if($e(d)){l.push(d);return}var h=d[t],m=h+d[ui[t]];if(CC(d)&&(n>0&&fe(d)[t]>i||n<0&&fe(d)[t]<i)){u.push(d);return}if(n>0&&h>i||n<0&&m<i){p(d);return}if(h<i&&m>i&&r.allowed("shape.resize",{shape:d})){f(d);return}}}),T(o,function(d){var h=d.attachers;h&&T(h,function(m){p(m)})}),T(u,function(d){var h=d.host;(s.has(h)||c.has(h))&&p(d)}),T(l,function(d){var h=d.source,m=d.target,g=d.label;(s.has(h)||c.has(h))&&(s.has(m)||c.has(m))&&g&&p(g)}),{movingShapes:o,resizingShapes:a}},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 xg(e){return{top:e.top-Ms,right:e.right+Ms,bottom:e.bottom+Ms,left:e.left-Ms}}function Eg(e){var t=e.context,n=t.spaceToolConstraints;if(n){var i,r;he(n.left)&&(i=Math.max(e.x,n.left),e.dx=e.dx+i-e.x,e.x=i),he(n.right)&&(i=Math.min(e.x,n.right),e.dx=e.dx+i-e.x,e.x=i),he(n.top)&&(r=Math.max(e.y,n.top),e.dy=e.dy+r-e.y,e.y=r),he(n.bottom)&&(r=Math.min(e.y,n.bottom),e.dy=e.dy+r-e.y,e.y=r)}}function RC(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 T(a,function(f){var d=f.attachers,h=f.children,m=le(f),g=we(h,function(F){return!$e(F)&&!_e(F)&&!l.has(F)&&!p.has(F)}),w=we(h,function(F){return!$e(F)&&!_e(F)&&l.has(F)}),E,b,x,S=[],A=[],I,C,$,j;g.length&&(b=xg(le(at(g))),E=i-m[ji[n]]+b[ji[n]],n==="n"?s.bottom=u=he(u)?Math.min(u,E):E:n==="w"?s.right=u=he(u)?Math.min(u,E):E:n==="s"?s.top=c=he(c)?Math.max(c,E):E:n==="e"&&(s.left=c=he(c)?Math.max(c,E):E)),w.length&&(x=xg(le(at(w))),E=i-x[ji[Ts[n]]]+m[ji[Ts[n]]],n==="n"?s.bottom=u=he(u)?Math.min(u,E):E:n==="w"?s.right=u=he(u)?Math.min(u,E):E:n==="s"?s.top=c=he(c)?Math.max(c,E):E:n==="e"&&(s.left=c=he(c)?Math.max(c,E):E)),d&&d.length&&(d.forEach(function(F){l.has(F)?S.push(F):A.push(F)}),S.length&&(I=le(at(S.map(fe))),C=m[ji[Ts[n]]]-(I[ji[Ts[n]]]-i)),A.length&&($=le(at(A.map(fe))),j=$[ji[n]]-(m[ji[n]]-i)),n==="n"?(E=Math.min(C||1/0,j||1/0),s.bottom=u=he(u)?Math.min(u,E):E):n==="w"?(E=Math.min(C||1/0,j||1/0),s.right=u=he(u)?Math.min(u,E):E):n==="s"?(E=Math.max(C||-1/0,j||-1/0),s.top=c=he(c)?Math.max(c,E):E):n==="e"&&(E=Math.max(C||-1/0,j||-1/0),s.left=c=he(c)?Math.max(c,E):E));var L=r&&r[f.id];L&&(n==="n"?(E=i+f[ui[t]]-L[ui[t]],s.bottom=u=he(u)?Math.min(u,E):E):n==="w"?(E=i+f[ui[t]]-L[ui[t]],s.right=u=he(u)?Math.min(u,E):E):n==="s"?(E=i-f[ui[t]]+L[ui[t]],s.top=c=he(c)?Math.max(c,E):E):n==="e"&&(E=i-f[ui[t]]+L[ui[t]],s.left=c=he(c)?Math.max(c,E):E))}),s}}function CC(e){return!!e.host}var Hl="djs-dragging",wg="djs-resizing",PC=250,ks=Math.max;function Sg(e,t,n,i,r){function o(a,s){T(a,function(c){r.addDragger(c,s),n.addMarker(c,Hl)})}e.on("spaceTool.selection.start",function(a){var s=n.getLayer("space"),c=a.context,u={x:"M 0,-10000 L 0,10000",y:"M -10000,0 L 10000,0"},l=se("g");J(l,i.cls("djs-crosshair-group",["no-events"])),ge(s,l);var p=se("path");J(p,"d",u.x),Pe(p).add("djs-crosshair"),ge(l,p);var f=se("path");J(f,"d",u.y),Pe(f).add("djs-crosshair"),ge(l,f),c.crosshairGroup=l}),e.on("spaceTool.selection.move",function(a){var s=a.context.crosshairGroup;Tt(s,a.x,a.y)}),e.on("spaceTool.selection.cleanup",function(a){var s=a.context,c=s.crosshairGroup;c&&vt(c)}),e.on("spaceTool.move",PC,function(a){var s=a.context,c=s.line,u=s.axis,l=s.movingShapes,p=s.resizingShapes;if(s.initialized){if(!s.dragGroup){var f=n.getLayer("space");c=se("path"),J(c,"d","M0,0 L0,0"),Pe(c).add("djs-crosshair"),ge(f,c),s.line=c;var d=se("g");J(d,i.cls("djs-drag-group",["no-events"])),ge(n.getActiveLayer(),d),o(l,d);var h=new Set(l);T(p,function(A){h.add(A)});var m=new Set,g=s.movingConnections=[];h.forEach(function(A){T(A.outgoing,function(I){m.has(I)||!$e(I)||!h.has(I.target)||(m.add(I),g.push(I))})}),o(g,d),s.dragGroup=d}if(!s.frameGroup){var w=se("g");J(w,i.cls("djs-frame-group",["no-events"])),ge(n.getActiveLayer(),w);var E=[];T(p,function(A){var I=r.addFrame(A,w),C=I.getBBox();E.push({element:I,initialBounds:C}),n.addMarker(A,wg)}),s.frameGroup=w,s.frames=E}var b={x:"M"+a.x+", -10000 L"+a.x+", 10000",y:"M -10000, "+a.y+" L 10000, "+a.y};J(c,{d:b[u]});var x={x:"y",y:"x"},S={x:a.dx,y:a.dy};S[x[s.axis]]=0,Tt(s.dragGroup,S.x,S.y),T(s.frames,function(A){var I=A.element,C=A.initialBounds,$,j;s.direction==="e"?J(I,{width:ks(C.width+S.x,5)}):($=ks(C.width-S.x,5),J(I,{width:$,x:C.x+C.width-$})),s.direction==="s"?J(I,{height:ks(C.height+S.y,5)}):(j=ks(C.height-S.y,5),J(I,{height:j,y:C.y+C.height-j}))})}}),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;T(c,function(h){n.removeMarker(h,Hl)}),T(u,function(h){n.removeMarker(h,Hl)}),f&&(vt(p),vt(f)),T(l,function(h){n.removeMarker(h,wg)}),d&&vt(d)})}Sg.$inject=["eventBus","elementRegistry","canvas","styles","previewSupport"];const AC={__init__:["spaceToolPreview"],__depends__:[ci,Un,As,Qr,Ho],spaceTool:["type",wn],spaceToolPreview:["type",Sg]};function Ds(e,t){e.invoke(wn,this),this._canvas=t}Ds.$inject=["injector","canvas"],Q(Ds,wn),Ds.prototype.calculateAdjustments=function(e,t,n,i){var r=this._canvas.getRootElement(),o=e[0]===r?null:e[0],a=[];o&&(a=Ar(Ir(r.children.filter(u=>y(u,"bpmn:Artifact")),at(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!(y(u,"bpmn:TextAnnotation")||TC(u)&&(t==="y"&&St(u)||t==="x"&&!St(u)))}),c};function TC(e){return y(e,"bpmn:Participant")&&!U(e).processRef}const Rg={__depends__:[AC],spaceTool:["type",Ds]};function Xe(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)}Xe.$inject=["eventBus","injector"],Xe.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()},Xe.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},Xe.prototype.clear=function(e){this._stack.length=0,this._stackIdx=-1,e!==!1&&this._fire("changed",{trigger:"clear"})},Xe.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()}},Xe.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()}},Xe.prototype.register=function(e,t){this._setHandler(e,t)},Xe.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)},Xe.prototype.canUndo=function(){return!!this._getUndoAction()},Xe.prototype.canRedo=function(){return!!this._getRedoAction()},Xe.prototype._getRedoAction=function(){return this._stack[this._stackIdx+1]},Xe.prototype._getUndoAction=function(){return this._stack[this._stackIdx]},Xe.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)})},Xe.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},Xe.prototype._createId=function(){return this._uid++},Xe.prototype._atomicDo=function(e){const t=this._currentExecution;t.atomic=!0;try{e()}finally{t.atomic=!1}},Xe.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()},Xe.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)},Xe.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:cf("id",i.reverse())}),i.length=0,this._fire("changed",{trigger:t}),e.trigger=null)},Xe.prototype._markDirty=function(e){const t=this._currentExecution;e&&(e=pe(e)?e:[e],t.dirty=t.dirty.concat(e))},Xe.prototype._executedAction=function(e,t){const n=++this._stackIdx;t||this._stack.splice(n,this._stack.length,e)},Xe.prototype._revertedAction=function(e){this._stackIdx--},Xe.prototype._getHandler=function(e){return this._handlerMap[e]},Xe.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 MC={commandStack:["type",Xe]};function Fi(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 kC=250,Cg=1400;function zl(e,t,n){W.call(this,t);var i=e.get("movePreview",!1);t.on("shape.move.start",Cg,function(r){var o=r.context,a=o.shapes,s=o.validatedShapes;o.shapes=Pg(a),o.validatedShapes=Pg(s)}),i&&t.on("shape.move.start",kC,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",Cg,function(r){var o=r.context,a=o.closure,s=a.enclosedElements,c=[];T(s,function(u){T(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;Fi(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=xu(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&&(it(s.labels,a,c),a.labelTarget=s)})}Q(zl,W),zl.$inject=["injector","eventBus","modeling"];function Pg(e){var t=new Set(e);return we(e,function(n){return!t.has(n.labelTarget)})}const DC={__init__:["labelSupport"],labelSupport:["type",zl]};var OC=251,Ag=1401,Tg="attach-ok";function Vl(e,t,n,i,r){W.call(this,t);var o=e.get("movePreview",!1);t.on("shape.move.start",Ag,function(a){var s=a.context,c=s.shapes,u=s.validatedShapes;s.shapes=IC(c),s.validatedShapes=LC(u)}),o&&t.on("shape.move.start",OC,function(a){var s=a.context,c=s.shapes,u=Gl(c);T(u,function(l){o.makeDraggable(s,l,!0),T(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,Tg),t.once(["shape.move.out","shape.move.cleanup"],function(){n.removeMarker(l,Tg)}))}}),this.preExecuted("elements.move",Ag,function(a){var s=a.context,c=s.closure,u=s.shapes,l=Gl(u);T(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=we(c,function(p){var f=p.host;return BC(p)&&!NC(c,f)}),T(l,function(p){r.updateAttachment(p,u)}))}),this.postExecuted("elements.move",function(a){var s=a.context.shapes;T(s,function(c){T(c.attachers,function(u){T(u.outgoing.slice(),function(l){var p=i.allowed("connection.reconnect",{connection:l,source:l.source,target:l.target});p||r.removeConnection(l)}),T(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;Fi(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&&T(u.attachers,function(l){var p=qh(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&&T(p,function(d){var h=qh(d,u,l);r.moveShape(d,h,d.parent),T(d.labels,function(m){r.moveShape(m,h,m.parent)})})}),this.preExecute("shape.delete",function(a){var s=a.context.shape;Fi(s.attachers,function(c){r.removeShape(c)}),s.host&&r.updateAttachment(s,null)})}Q(Vl,W),Vl.$inject=["injector","eventBus","canvas","rules","modeling"];function Gl(e){return jc(It(e,function(t){return t.attachers||[]}))}function IC(e){var t=Gl(e);return Ib("id",e,t)}function LC(e){var t=Tr(e,"id");return we(e,function(n){for(;n;){if(n.host&&t[n.host.id])return!1;n=n.parent}return!0})}function BC(e){return!!e.host}function NC(e,t){return e.indexOf(t)!==-1}const $C={__depends__:[Un],__init__:["attachSupport"],attachSupport:["type",Vl]};function Mg(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(Ed(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)})}Mg.$inject=["eventBus","canvas","elementRegistry","graphicsFactory"];const Wl={__init__:["changeSupport"],changeSupport:["type",Mg]};function Sn(e){this._model=e}Sn.$inject=["moddle"],Sn.prototype._needsId=function(e){return xe(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"])},Sn.prototype._ensureId=function(e){if(e.id){this._model.ids.claim(e.id,e);return}var t;y(e,"bpmn:Activity")?t="Activity":y(e,"bpmn:Event")?t="Event":y(e,"bpmn:Gateway")?t="Gateway":xe(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))},Sn.prototype.create=function(e,t){var n=this._model.create(e,t||{});return this._ensureId(n),n},Sn.prototype.createDiLabel=function(){return this.create("bpmndi:BPMNLabel",{bounds:this.createDiBounds()})},Sn.prototype.createDiShape=function(e,t){return this.create("bpmndi:BPMNShape",k({bpmnElement:e,bounds:this.createDiBounds()},t))},Sn.prototype.createDiBounds=function(e){return this.create("dc:Bounds",e)},Sn.prototype.createDiWaypoints=function(e){var t=this;return It(e,function(n){return t.createDiWaypoint(n)})},Sn.prototype.createDiWaypoint=function(e){return this.create("dc:Point",Mn(e,["x","y"]))},Sn.prototype.createDiEdge=function(e,t){return this.create("bpmndi:BPMNEdge",k({bpmnElement:e,waypoint:this.createDiWaypoints([])},t))},Sn.prototype.createDiPlane=function(e,t){return this.create("bpmndi:BPMNPlane",k({bpmnElement:e},t))};function sn(e,t,n){W.call(this,e),this._bpmnFactory=t;var i=this;function r(d){var h=d.context,m=h.hints||{},g;!h.cropped&&m.createElementsBehavior!==!1&&(g=h.connection,g.waypoints=n.getCroppedWaypoints(g),h.cropped=!0)}this.executed(["connection.layout","connection.create"],r),this.reverted(["connection.layout"],function(d){delete d.context.cropped});function o(d){var h=d.context;i.updateParent(h.shape||h.connection,h.oldParent)}function a(d){var h=d.context,m=h.shape||h.connection,g=h.parent||h.newParent;i.updateParent(m,g)}this.executed(["shape.move","shape.create","shape.delete","connection.create","connection.move","connection.delete"],cn(o)),this.reverted(["shape.move","shape.create","shape.delete","connection.create","connection.move","connection.delete"],cn(a));function s(d){var h=d.context,m=h.oldRoot,g=m.children;T(g,function(w){y(w,"bpmn:BaseElement")&&i.updateParent(w)})}this.executed(["canvas.updateRoot"],s),this.reverted(["canvas.updateRoot"],s);function c(d){var h=d.context.shape;y(h,"bpmn:BaseElement")&&i.updateBounds(h)}this.executed(["shape.move","shape.create","shape.resize"],cn(function(d){d.context.shape.type!=="label"&&c(d)})),this.reverted(["shape.move","shape.create","shape.resize"],cn(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"],cn(u)),this.reverted(["connection.create","connection.move","connection.delete","connection.reconnect"],cn(u));function l(d){i.updateConnectionWaypoints(d.context.connection)}this.executed(["connection.layout","connection.move","connection.updateWaypoints"],cn(l)),this.reverted(["connection.layout","connection.move","connection.updateWaypoints"],cn(l)),this.executed("connection.reconnect",cn(function(d){var h=d.context,m=h.connection,g=h.oldSource,w=h.newSource,E=U(m),b=U(g),x=U(w);E.conditionExpression&&!xe(x,["bpmn:Activity","bpmn:ExclusiveGateway","bpmn:InclusiveGateway"])&&(h.oldConditionExpression=E.conditionExpression,delete E.conditionExpression),g!==w&&b.default===E&&(h.oldDefault=b.default,delete b.default)})),this.reverted("connection.reconnect",cn(function(d){var h=d.context,m=h.connection,g=h.oldSource,w=h.newSource,E=U(m),b=U(g),x=U(w);h.oldConditionExpression&&(E.conditionExpression=h.oldConditionExpression),h.oldDefault&&(b.default=h.oldDefault,delete x.default)}));function p(d){i.updateAttachment(d.context)}this.executed(["element.updateAttachment"],cn(p)),this.reverted(["element.updateAttachment"],cn(p)),this.executed("element.updateLabel",cn(f)),this.reverted("element.updateLabel",cn(f));function f(d){const{element:h}=d.context,m=hn(h),g=Me(h),w=g&&g.get("label");Oi(h)||ys(h)||(m&&!w?g.set("label",t.create("bpmndi:BPMNLabel")):!m&&w&&g.set("label",void 0))}}Q(sn,W),sn.$inject=["eventBus","bpmnFactory","connectionDocking"],sn.prototype.updateAttachment=function(e){var t=e.shape,n=t.businessObject,i=t.host;n.attachedToRef=i&&i.businessObject},sn.prototype.updateParent=function(e,t){if(!_e(e)&&!(y(e,"bpmn:DataStoreReference")&&e.parent&&y(e.parent,"bpmn:Collaboration"))){var n=e.parent,i=e.businessObject,r=Me(e),o=n&&n.businessObject,a=Me(n);y(e,"bpmn:FlowNode")&&this.updateFlowNodeRefs(i,o,t&&t.businessObject),y(e,"bpmn:DataOutputAssociation")&&(e.source?o=e.source.businessObject:o=null),y(e,"bpmn:DataInputAssociation")&&(e.target?o=e.target.businessObject:o=null),this.updateSemanticParent(i,o),y(e,"bpmn:DataObjectReference")&&i.dataObjectRef&&this.updateSemanticParent(i.dataObjectRef,o),this.updateDiParent(r,a)}},sn.prototype.updateBounds=function(e){var t=Me(e),n=FC(e);if(n){var i=kn(n,t.get("bounds"));k(n,{x:e.x+i.x,y:e.y+i.y})}var r=_e(e)?this._getLabel(t):t,o=r.bounds;o||(o=this._bpmnFactory.createDiBounds(),r.set("bounds",o)),k(o,{x:e.x,y:e.y,width:e.width,height:e.height})},sn.prototype.updateFlowNodeRefs=function(e,t,n){if(n!==t){var i,r;y(n,"bpmn:Lane")&&(i=n.get("flowNodeRef"),tt(i,e)),y(t,"bpmn:Lane")&&(r=t.get("flowNodeRef"),it(r,e))}},sn.prototype.updateDiConnection=function(e,t,n){var i=Me(e),r=Me(t),o=Me(n);i.sourceElement&&i.sourceElement.bpmnElement!==U(t)&&(i.sourceElement=t&&r),i.targetElement&&i.targetElement.bpmnElement!==U(n)&&(i.targetElement=n&&o)},sn.prototype.updateDiParent=function(e,t){if(t&&!y(t,"bpmndi:BPMNPlane")&&(t=t.$parent),e.$parent!==t){var n=(t||e.$parent).get("planeElement");t?(n.push(e),e.$parent=t):(tt(n,e),e.$parent=null)}};function jC(e){for(;e&&!y(e,"bpmn:Definitions");)e=e.$parent;return e}sn.prototype.getLaneSet=function(e){var t,n;return y(e,"bpmn:Lane")?(t=e.childLaneSet,t||(t=this._bpmnFactory.create("bpmn:LaneSet"),e.childLaneSet=t,t.$parent=e),t):(y(e,"bpmn:Participant")&&(e=e.processRef),n=e.get("laneSets"),t=n[0],t||(t=this._bpmnFactory.create("bpmn:LaneSet"),t.$parent=e,n.push(t)),t)},sn.prototype.updateSemanticParent=function(e,t,n){var i;if(e.$parent!==t&&!((y(e,"bpmn:DataInput")||y(e,"bpmn:DataOutput"))&&(y(t,"bpmn:Participant")&&"processRef"in t&&(t=t.processRef),"ioSpecification"in t&&t.ioSpecification===e.$parent))){if(y(e,"bpmn:Lane"))t&&(t=this.getLaneSet(t)),i="lanes";else if(y(e,"bpmn:FlowElement")){if(t){if(y(t,"bpmn:Participant"))t=t.processRef;else if(y(t,"bpmn:Lane"))do t=t.$parent.$parent;while(y(t,"bpmn:Lane"))}i="flowElements"}else if(y(e,"bpmn:Artifact")){for(;t&&!y(t,"bpmn:Process")&&!y(t,"bpmn:SubProcess")&&!y(t,"bpmn:Collaboration");)if(y(t,"bpmn:Participant")){t=t.processRef;break}else t=t.$parent;i="artifacts"}else if(y(e,"bpmn:MessageFlow"))i="messageFlows";else if(y(e,"bpmn:Participant")){i="participants";var r=e.processRef,o;r&&(o=jC(e.$parent||t),e.$parent&&(tt(o.get("rootElements"),r),r.$parent=null),t&&(it(o.get("rootElements"),r),r.$parent=o))}else y(e,"bpmn:DataOutputAssociation")?i="dataOutputAssociations":y(e,"bpmn:DataInputAssociation")&&(i="dataInputAssociations");if(!i)throw new Error(`no parent for <${e.id}> in <${t.id}>`);var a;if(e.$parent&&(a=e.$parent.get(i),tt(a,e)),t?(a=t.get(i),a.push(e),e.$parent=t):e.$parent=null,n){var s=n.get(i);tt(a,e),t&&(s||(s=[],t.set(i,s)),s.push(e))}}},sn.prototype.updateConnectionWaypoints=function(e){var t=Me(e);t.set("waypoint",this._bpmnFactory.createDiWaypoints(e.waypoints))},sn.prototype.updateConnection=function(e){var t=e.connection,n=U(t),i=t.source,r=U(i),o=t.target,a=U(t.target),s;if(y(n,"bpmn:DataAssociation"))y(n,"bpmn:DataInputAssociation")?(n.get("sourceRef")[0]=r,s=e.parent||e.newParent||a,this.updateSemanticParent(n,a,s)):y(n,"bpmn:DataOutputAssociation")&&(s=e.parent||e.newParent||r,this.updateSemanticParent(n,r,s),n.targetRef=a);else{var c=y(n,"bpmn:SequenceFlow");n.sourceRef!==r&&(c&&(tt(n.sourceRef&&n.sourceRef.get("outgoing"),n),r&&r.get("outgoing")&&r.get("outgoing").push(n)),n.sourceRef=r),n.targetRef!==a&&(c&&(tt(n.targetRef&&n.targetRef.get("incoming"),n),a&&a.get("incoming")&&a.get("incoming").push(n)),n.targetRef=a)}this.updateConnectionWaypoints(t),this.updateDiConnection(t,i,o)},sn.prototype._getLabel=function(e){return e.label||(e.label=this._bpmnFactory.createDiLabel()),e.label};function cn(e){return function(t){var n=t.context,i=n.shape||n.connection||n.element;y(i,"bpmn:BaseElement")&&e(t)}}function FC(e){if(y(e,"bpmn:Activity")){var t=Me(e);if(t){var n=t.get("label");if(n)return n.get("bounds")}}}function Hi(e,t){ri.call(this),this._bpmnFactory=e,this._moddle=t}Q(Hi,ri),Hi.$inject=["bpmnFactory","moddle"],Hi.prototype._baseCreate=ri.prototype.create,Hi.prototype.create=function(e,t){if(e==="label"){var n=t.di||this._bpmnFactory.createDiLabel();return this._baseCreate(e,k({type:"label",di:n},fr,t))}return this.createElement(e,t)},Hi.prototype.createElement=function(e,t){t=k({},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(!zC(r)){var o=k({},r||{},{id:i.id+"_di"});e==="root"?r=this._bpmnFactory.createDiPlane(i,o):e==="connection"?r=this._bpmnFactory.createDiEdge(i,o):r=this._bpmnFactory.createDiShape(i,o)}y(i,"bpmn:Group")&&(t=k({isFrame:!0},t)),t=HC(i,t,["processRef","isInterrupting","associationDirection","isForCompensation"]),t.isExpanded&&(t=Ul(r,t,"isExpanded")),xe(i,["bpmn:Lane","bpmn:Participant"])&&(t=Ul(r,t,"isHorizontal")),y(i,"bpmn:SubProcess")&&(t.collapsed=!Re(i,r)),y(i,"bpmn:ExclusiveGateway")&&(Jt(r,"isMarkerVisible")?r.isMarkerVisible===void 0&&(r.isMarkerVisible=!1):r.isMarkerVisible=!0),mt(t.triggeredByEvent)&&(i.triggeredByEvent=t.triggeredByEvent,delete t.triggeredByEvent),mt(t.cancelActivity)&&(i.cancelActivity=t.cancelActivity,delete t.cancelActivity);var a,s;return t.eventDefinitionType&&(a=i.get("eventDefinitions")||[],s=this._bpmnFactory.create(t.eventDefinitionType,t.eventDefinitionAttrs),t.eventDefinitionType==="bpmn:ConditionalEventDefinition"&&(s.condition=this._bpmnFactory.create("bpmn:FormalExpression")),a.push(s),s.$parent=i,i.eventDefinitions=a,delete t.eventDefinitionType),n=this.getDefaultSize(i,r),t=k({id:i.id},n,t,{businessObject:i,di:r}),this._baseCreate(e,t)},Hi.prototype.getDefaultSize=function(e,t){var n=U(e);if(t=t||Me(e),y(n,"bpmn:SubProcess"))return Re(n,t)?{width:350,height:200}:{width:100,height:80};if(y(n,"bpmn:Task"))return{width:100,height:80};if(y(n,"bpmn:Gateway"))return{width:50,height:50};if(y(n,"bpmn:Event"))return{width:36,height:36};if(y(n,"bpmn:Participant")){var i=t.isHorizontal===void 0||t.isHorizontal===!0;return Re(n,t)?i?{width:600,height:250}:{width:250,height:600}:i?{width:400,height:60}:{width:60,height:400}}return y(n,"bpmn:Lane")?{width:400,height:100}:y(n,"bpmn:DataObjectReference")?{width:36,height:50}:y(n,"bpmn:DataStoreReference")?{width:50,height:50}:y(n,"bpmn:TextAnnotation")?{width:100,height:40}:y(n,"bpmn:Group")?{width:300,height:300}:{width:100,height:80}},Hi.prototype.createParticipantShape=function(e){return xt(e)||(e={isExpanded:e}),e=k({type:"bpmn:Participant"},e||{}),e.isExpanded!==!1&&(e.processRef=this._bpmnFactory.create("bpmn:Process")),this.createShape(e)};function HC(e,t,n){return T(n,function(i){t=Ul(e,t,i)}),t}function Ul(e,t,n){return t[n]===void 0?t:(e[n]=t[n],Ln(t,[n]))}function zC(e){return xe(e,["bpmndi:BPMNShape","bpmndi:BPMNEdge","bpmndi:BPMNDiagram","bpmndi:BPMNPlane"])}function Os(e,t){this._modeling=e,this._canvas=t}Os.$inject=["modeling","canvas"],Os.prototype.preExecute=function(e){var t=this._modeling,n=e.elements,i=e.alignment;T(n,function(r){var o={x:0,y:0};mt(i.left)?o.x=i.left-r.x:mt(i.right)?o.x=i.right-r.width-r.x:mt(i.center)?o.x=i.center-Math.round(r.width/2)-r.x:mt(i.top)?o.y=i.top-r.y:mt(i.bottom)?o.y=i.bottom-r.height-r.y:mt(i.middle)&&(o.y=i.middle-Math.round(r.height/2)-r.y),t.moveElements([r],o,r.parent)})},Os.prototype.postExecute=function(e){};function Is(e){this._modeling=e}Is.$inject=["modeling"],Is.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},Is.prototype.postExecute=function(e){var t=e.hints||{};VC(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 VC(e,t){return bi(e.outgoing,function(n){return n.target===t})}function Ls(e,t){this._canvas=e,this._layouter=t}Ls.$inject=["canvas","layouter"],Ls.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},Ls.prototype.revert=function(e){var t=e.connection;return this._canvas.removeConnection(t),t.source=null,t.target=null,t};var Bs=Math.round;function ql(e){this._modeling=e}ql.$inject=["modeling"],ql.prototype.preExecute=function(e){var t=e.elements,n=e.parent,i=e.parentIndex,r=e.position,o=e.hints,a=this._modeling;T(t,function(p){he(p.x)||(p.x=0),he(p.y)||(p.y=0)});var s=we(t,function(p){return!p.hidden}),c=at(s);T(t,function(p){$e(p)&&(p.waypoints=It(p.waypoints,function(f){return{x:Bs(f.x-c.x-c.width/2+r.x),y:Bs(f.y-c.y-c.height/2+r.y)}})),k(p,{x:Bs(p.x-c.x-c.width/2+r.x),y:Bs(p.y-c.y-c.height/2+r.y)})});var u=new Set($a(t)),l={};T(t,function(p){if($e(p)){l[p.id]=he(i)?a.createConnection(l[p.source.id],l[p.target.id],i,p,p.parent||n,o):a.createConnection(l[p.source.id],l[p.target.id],p,p.parent||n,o);return}var f=k({},o);u.has(p)||(f.autoResize=!1),_e(p)&&(f=Ln(f,["attach"])),l[p.id]=he(i)?a.createShape(p,Mn(p,["x","y","width","height"]),p.parent||n,i,f):a.createShape(p,Mn(p,["x","y","width","height"]),p.parent||n,f)}),e.elements=Ar(l)};var kg=Math.round;function zi(e){this._canvas=e}zi.$inject=["canvas"],zi.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?k(t,n):k(t,{x:n.x-kg(t.width/2),y:n.y-kg(t.height/2)}),this._canvas.addShape(t,i,r),t},zi.prototype.revert=function(e){var t=e.shape;return this._canvas.removeShape(t),t};function Vo(e){zi.call(this,e)}Q(Vo,zi),Vo.$inject=["canvas"];var GC=zi.prototype.execute;Vo.prototype.execute=function(e){var t=e.shape;return UC(t),t.labelTarget=e.labelTarget,GC.call(this,e)};var WC=zi.prototype.revert;Vo.prototype.revert=function(e){return e.shape.labelTarget=null,WC.call(this,e)};function UC(e){["width","height"].forEach(function(t){typeof e[t]>"u"&&(e[t]=0)})}function Go(e,t){this._canvas=e,this._modeling=t}Go.$inject=["canvas","modeling"],Go.prototype.preExecute=function(e){var t=this._modeling,n=e.connection;Fi(n.incoming,function(i){t.removeConnection(i,{nested:!0})}),Fi(n.outgoing,function(i){t.removeConnection(i,{nested:!0})})},Go.prototype.execute=function(e){var t=e.connection,n=t.parent;return e.parent=n,e.parentIndex=xu(n.children,t),e.source=t.source,e.target=t.target,this._canvas.removeConnection(t),t.source=null,t.target=null,t},Go.prototype.revert=function(e){var t=e.connection,n=e.parent,i=e.parentIndex;return t.source=e.source,t.target=e.target,it(n.children,t,i),this._canvas.addConnection(t,n),t};function Yl(e,t){this._modeling=e,this._elementRegistry=t}Yl.$inject=["modeling","elementRegistry"],Yl.prototype.postExecute=function(e){var t=this._modeling,n=this._elementRegistry,i=e.elements;T(i,function(r){n.get(r.id)&&(r.waypoints?t.removeConnection(r):t.removeShape(r))})};function Wo(e,t){this._canvas=e,this._modeling=t}Wo.$inject=["canvas","modeling"],Wo.prototype.preExecute=function(e){var t=this._modeling,n=e.shape;Fi(n.incoming,function(i){t.removeConnection(i,{nested:!0})}),Fi(n.outgoing,function(i){t.removeConnection(i,{nested:!0})}),Fi(n.children,function(i){$e(i)?t.removeConnection(i,{nested:!0}):t.removeShape(i,{nested:!0})})},Wo.prototype.execute=function(e){var t=this._canvas,n=e.shape,i=n.parent;return e.oldParent=i,e.oldParentIndex=xu(i.children,n),t.removeShape(n),n},Wo.prototype.revert=function(e){var t=this._canvas,n=e.shape,i=e.oldParent,r=e.oldParentIndex;return it(i.children,n,r),t.addShape(n,i),n};function Ns(e){this._modeling=e}Ns.$inject=["modeling"];var Dg={x:"y",y:"x"};Ns.prototype.preExecute=function(e){var t=this._modeling,n=e.groups,i=e.axis,r=e.dimension;function o(g,w){g.range.min=Math.min(w[i],g.range.min),g.range.max=Math.max(w[i]+w[r],g.range.max)}function a(g){return g[i]+g[r]/2}function s(g){return g.length-1}function c(g){return g.max-g.min}function u(g,w){var E={y:0};E[i]=g-a(w),E[i]&&(E[Dg[i]]=0,t.moveElements([w],E,w.parent))}var l=n[0],p=s(n),f=n[p],d,h,m=0;T(n,function(g,w){var E,b,x;if(g.elements.length<2){w&&w!==n.length-1&&(o(g,g.elements[0]),m+=c(g.range));return}E=In(g.elements,i),b=E[0],w===p&&(b=E[s(E)]),x=a(b),g.range=null,T(E,function(S){if(u(x,S),g.range===null){g.range={min:S[i],max:S[i]+S[r]};return}o(g,S)}),w&&w!==n.length-1&&(m+=c(g.range))}),h=Math.abs(f.range.min-l.range.max),d=Math.round((h-m)/(n.length-1)),!(d<n.length-1)&&T(n,function(g,w){var E={},b;g===l||g===f||(b=n[w-1],g.range.max=0,T(g.elements,function(x,S){E[Dg[i]]=0,E[i]=b.range.max-x[i]+d,g.range.min!==x[i]&&(E[i]+=x[i]-g.range.min),E[i]&&t.moveElements([x],E,x.parent),g.range.max=Math.max(x[i]+x[r],S?g.range.max:0)}))})},Ns.prototype.postExecute=function(e){};function $s(e,t){this._layouter=e,this._canvas=t}$s.$inject=["layouter","canvas"],$s.prototype.execute=function(e){var t=e.connection,n=t.waypoints;return k(e,{oldWaypoints:n}),t.waypoints=this._layouter.layoutConnection(t,e.hints),t},$s.prototype.revert=function(e){var t=e.connection;return t.waypoints=e.oldWaypoints,t};function Kl(){}Kl.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=tt(o.children,t),it(i.children,t,r),t.parent=i,T(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},Kl.prototype.revert=function(e){var t=e.connection,n=t.parent,i=e.oldParent,r=e.oldParentIndex,o=e.delta;return tt(n.children,t),it(i.children,t,r),t.parent=i,T(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 Xl(){this.allShapes={},this.allConnections={},this.enclosedElements={},this.enclosedConnections={},this.topLevel={}}Xl.prototype.add=function(e,t){return this.addAll([e],t)},Xl.prototype.addAll=function(e,t){var n=EE(e,!!t,this);return k(this,n),this};function Uo(e){this._modeling=e}Uo.prototype.moveRecursive=function(e,t,n){return e?this.moveClosure(this.getClosure(e),t,n):[]},Uo.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),T(a,function(p){o.moveShape(p,t,u[p.id]&&!l&&n,{recurse:!1,layout:!1})}),T(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&&il(p,p.source,t),connectionEnd:d&&rl(p,p.target,t)})})},Uo.prototype.getClosure=function(e){return new Xl().addAll(e,!0)};function js(e){this._helper=new Uo(e)}js.$inject=["modeling"],js.prototype.preExecute=function(e){e.closure=this._helper.getClosure(e.shapes)},js.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 yr(e){this._modeling=e,this._helper=new Uo(e)}yr.$inject=["modeling"],yr.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=Mn(t,["x","y","width","height"]),e.oldParent=o,e.oldParentIndex=tt(o.children,t),it(i.children,t,r),k(t,{parent:i,x:t.x+n.x,y:t.y+n.y}),t},yr.prototype.postExecute=function(e){var t=e.shape,n=e.delta,i=e.hints,r=this._modeling;i.layout!==!1&&(T(t.incoming,function(o){r.layoutConnection(o,{connectionEnd:rl(o,t,n)})}),T(t.outgoing,function(o){r.layoutConnection(o,{connectionStart:il(o,t,n)})})),i.recurse!==!1&&this.moveChildren(e)},yr.prototype.revert=function(e){var t=e.shape,n=e.oldParent,i=e.oldParentIndex,r=e.delta;return it(n.children,t,i),k(t,{parent:n,x:t.x-r.x,y:t.y-r.y}),t},yr.prototype.moveChildren=function(e){var t=e.delta,n=e.shape;this._helper.moveRecursive(n.children,t,null)},yr.prototype.getNewParent=function(e){return e.newParent||e.shape.parent};function qo(e){this._modeling=e}qo.$inject=["modeling"],qo.prototype.execute=function(e){var t=e.newSource,n=e.newTarget,i=e.connection,r=e.dockingOrPoints;if(!t&&!n)throw new Error("newSource or newTarget required");return pe(r)&&(e.oldWaypoints=i.waypoints,i.waypoints=r),t&&(e.oldSource=i.source,i.source=t),n&&(e.oldTarget=i.target,i.target=n),i},qo.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||Og(pe(r)?r[0]:r)),i&&(!n||o.docking==="target")&&(a.connectionEnd=a.connectionEnd||Og(pe(r)?r[r.length-1]:r)),o.newWaypoints&&(a.waypoints=o.newWaypoints),this._modeling.layoutConnection(t,a))},qo.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 Og(e){return e.original||e}function li(e,t){this._modeling=e,this._rules=t}li.$inject=["modeling","rules"],li.prototype.preExecute=function(e){var t=this,n=this._modeling,i=this._rules,r=e.oldShape,o=e.newData,a=e.hints||{},s;function c(h,m,g){return i.allowed("connection.reconnect",{connection:g,source:h,target:m})}var u={x:o.x,y:o.y},l={x:r.x,y:r.y,width:r.width,height:r.height};s=e.newShape=e.newShape||t.createShape(o,u,r.parent,a),r.host&&n.updateAttachment(s,r.host);var p;a.moveChildren!==!1&&(p=r.children.slice(),n.moveElements(p,{x:0,y:0},s,a));var f=r.incoming.slice(),d=r.outgoing.slice();T(f,function(h){var m=h.source,g=c(m,s,h);g&&t.reconnectEnd(h,s,fs(h,s,l),a)}),T(d,function(h){var m=h.target,g=c(s,m,h);g&&t.reconnectStart(h,s,ps(h,s,l),a)})},li.prototype.postExecute=function(e){var t=e.oldShape;this._modeling.removeShape(t)},li.prototype.execute=function(e){},li.prototype.revert=function(e){},li.prototype.createShape=function(e,t,n,i){return this._modeling.createShape(e,t,n,i)},li.prototype.reconnectStart=function(e,t,n,i){this._modeling.reconnectStart(e,t,n,i)},li.prototype.reconnectEnd=function(e,t,n,i){this._modeling.reconnectEnd(e,t,n,i)};function Yo(e){this._modeling=e}Yo.$inject=["modeling"],Yo.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},k(t,{width:n.width,height:n.height,x:n.x,y:n.y}),t},Yo.prototype.postExecute=function(e){var t=this._modeling,n=e.shape,i=e.oldBounds,r=e.hints||{};r.layout!==!1&&(T(n.incoming,function(o){t.layoutConnection(o,{connectionEnd:fs(o,n,i)})}),T(n.outgoing,function(o){t.layoutConnection(o,{connectionStart:ps(o,n,i)})}))},Yo.prototype.revert=function(e){var t=e.shape,n=e.oldBounds;return k(t,{width:n.width,height:n.height,x:n.x,y:n.y}),t};function Vi(e){this._modeling=e}Vi.$inject=["modeling"],Vi.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),T(r,function(s){a[s.id]=YC(s)}),this.resizeShapes(r,t,n),this.updateConnectionWaypoints(xC(i,r),t,n,o,i,r,a)},Vi.prototype.execute=function(){},Vi.prototype.revert=function(){},Vi.prototype.moveShapes=function(e,t){var n=this;T(e,function(i){n._modeling.moveShape(i,t,null,{autoResize:!1,layout:!1,recurse:!1})})},Vi.prototype.resizeShapes=function(e,t,n){var i=this;T(e,function(r){var o=EC(r,n,t);i._modeling.resizeShape(r,o,null,{attachSupport:!1,autoResize:!1,layout:!1})})},Vi.prototype.updateConnectionWaypoints=function(e,t,n,i,r,o,a){var s=this,c=new Set(r),u=new Set(o);T(e,function(l){var p=l.source,f=l.target,d=qC(l),h=Lg(n),m={},g=c.has(p)||u.has(p),w=c.has(f)||u.has(f);g&&w?(d=It(d,function(E){return Bg(E,i,n)&&(E[h]=E[h]+t[h]),E.original&&Bg(E.original,i,n)&&(E.original[h]=E.original[h]+t[h]),E}),s._modeling.updateWaypoints(l,d,{labelBehavior:!1})):(g||w)&&(c.has(p)?m.connectionStart=il(l,p,t):c.has(f)?m.connectionEnd=rl(l,f,t):u.has(p)?m.connectionStart=ps(l,p,a[p.id]):u.has(f)&&(m.connectionEnd=fs(l,f,a[f.id])),s._modeling.layoutConnection(l,m))})};function Ig(e){return k({},e)}function qC(e){return It(e.waypoints,function(t){return t=Ig(t),t.original&&(t.original=Ig(t.original)),t})}function Lg(e){switch(e){case"n":return"y";case"w":return"x";case"s":return"y";case"e":return"x"}}function Bg(e,t,n){var i=Lg(n);if(/e|s/.test(n))return e[i]>t;if(/n|w/.test(n))return e[i]<t}function YC(e){return{x:e.x,y:e.y,height:e.height,width:e.width}}function Fs(e){this._modeling=e}Fs.$inject=["modeling"],Fs.prototype.execute=function(e){var t=e.shape,n=t.children;e.oldChildrenVisibility=Ng(n),t.collapsed=!t.collapsed;var i=$g(n,t.collapsed);return[t].concat(i)},Fs.prototype.revert=function(e){var t=e.shape,n=e.oldChildrenVisibility,i=t.children,r=jg(i,n);return t.collapsed=!t.collapsed,[t].concat(r)};function Ng(e){var t={};return T(e,function(n){t[n.id]=n.hidden,n.children&&(t=k({},t,Ng(n.children)))}),t}function $g(e,t){var n=[];return T(e,function(i){i.hidden=t,n=n.concat(i),i.children&&(n=n.concat($g(i.children,i.collapsed||t)))}),n}function jg(e,t){var n=[];return T(e,function(i){i.hidden=t[i.id],n=n.concat(i),i.children&&(n=n.concat(jg(i.children,t)))}),n}function Hs(e){this._modeling=e}Hs.$inject=["modeling"],Hs.prototype.execute=function(e){var t=e.shape,n=e.newHost,i=t.host;return e.oldHost=i,e.attacherIdx=Fg(i,t),Hg(n,t),t.host=n,t},Hs.prototype.revert=function(e){var t=e.shape,n=e.newHost,i=e.oldHost,r=e.attacherIdx;return t.host=i,Fg(n,t),Hg(i,t,r),t};function Fg(e,t){return tt(e&&e.attachers,t)}function Hg(e,t,n){if(e){var i=e.attachers;i||(e.attachers=i=[]),it(i,t,n)}}function Zl(){}Zl.prototype.execute=function(e){var t=e.connection,n=e.newWaypoints;return e.oldWaypoints=t.waypoints,t.waypoints=n,t},Zl.prototype.revert=function(e){var t=e.connection,n=e.oldWaypoints;return t.waypoints=n,t};function je(e,t,n){this._eventBus=e,this._elementFactory=t,this._commandStack=n;var i=this;e.on("diagram.init",function(){i.registerHandlers(n)})}je.$inject=["eventBus","elementFactory","commandStack"],je.prototype.getHandlers=function(){return{"shape.append":Is,"shape.create":zi,"shape.delete":Wo,"shape.move":yr,"shape.resize":Yo,"shape.replace":li,"shape.toggleCollapse":Fs,spaceTool:Vi,"label.create":Vo,"connection.create":Ls,"connection.delete":Go,"connection.move":Kl,"connection.layout":$s,"connection.updateWaypoints":Zl,"connection.reconnect":qo,"elements.create":ql,"elements.move":js,"elements.delete":Yl,"elements.distribute":Ns,"elements.align":Os,"element.updateAttachment":Hs}},je.prototype.registerHandlers=function(e){T(this.getHandlers(),function(t,n){e.registerHandler(n,t)})},je.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)},je.prototype.updateAttachment=function(e,t){var n={shape:e,newHost:t};this._commandStack.execute("element.updateAttachment",n)},je.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)},je.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)},je.prototype.layoutConnection=function(e,t){var n={connection:e,hints:t||{}};this._commandStack.execute("connection.layout",n)},je.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},je.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},je.prototype.createElements=function(e,t,n,i,r){pe(e)||(e=[e]),typeof i!="number"&&(r=i,i=void 0),r=r||{};var o={position:t,elements:e,parent:n,parentIndex:i,hints:r};return this._commandStack.execute("elements.create",o),o.elements},je.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},je.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},je.prototype.removeElements=function(e){var t={elements:e};this._commandStack.execute("elements.delete",t)},je.prototype.distributeElements=function(e,t,n){var i={groups:e,axis:t,dimension:n};this._commandStack.execute("elements.distribute",i)},je.prototype.removeShape=function(e,t){var n={shape:e,hints:t||{}};this._commandStack.execute("shape.delete",n)},je.prototype.removeConnection=function(e,t){var n={connection:e,hints:t||{}};this._commandStack.execute("connection.delete",n)},je.prototype.replaceShape=function(e,t,n){var i={oldShape:e,newData:t,hints:n||{}};return this._commandStack.execute("shape.replace",i),i.newShape},je.prototype.alignElements=function(e,t){var n={elements:e,alignment:t};this._commandStack.execute("elements.align",n)},je.prototype.resizeShape=function(e,t,n,i){var r={shape:e,newBounds:t,minBounds:n,hints:i};this._commandStack.execute("shape.resize",r)},je.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)},je.prototype.updateWaypoints=function(e,t,n){var i={connection:e,newWaypoints:t,hints:n||{}};this._commandStack.execute("connection.updateWaypoints",i)},je.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)},je.prototype.reconnectStart=function(e,t,n,i){i||(i={}),this.reconnect(e,t,e.target,n,k(i,{docking:"source"}))},je.prototype.reconnectEnd=function(e,t,n,i){i||(i={}),this.reconnect(e,e.source,t,n,k(i,{docking:"target"}))},je.prototype.connect=function(e,t,n,i){return this.createConnection(e,t,n||{},e.parent,i)},je.prototype._create=function(e,t){return sw(t)?t:this._elementFactory.create(e,t)},je.prototype.toggleCollapse=function(e,t){var n={shape:e,hints:t||{}};this._commandStack.execute("shape.toggleCollapse",n)};function Ko(e){this._elementRegistry=e}Ko.$inject=["elementRegistry"],Ko.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||KC(n,ba(i));return zg(n,i),e.oldProperties=o,e.changed=r,r},Ko.prototype.revert=function(e){var t=e.oldProperties,n=e.moddleElement,i=e.changed;return zg(n,t),i},Ko.prototype._getVisualReferences=function(e){var t=this._elementRegistry;return y(e,"bpmn:DataObject")?XC(e,t):[]};function KC(e,t){return en(t,function(n,i){return n[i]=e.get(i),n},{})}function zg(e,t){T(t,function(n,i){e.set(i,n)})}function XC(e,t){return t.filter(function(n){return y(n,"bpmn:DataObjectReference")&&U(n).dataObjectRef===e})}var Xo="default",pi="id",Vg="di",ZC={width:0,height:0};function Zo(e,t,n,i){this._elementRegistry=e,this._moddle=t,this._modeling=n,this._textRenderer=i}Zo.$inject=["elementRegistry","moddle","modeling","textRenderer"],Zo.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=nP(e.properties),s=e.oldProperties||QC(t,a);return Gg(a,o)&&(r.unclaim(o[pi]),i.updateId(t,a[pi]),r.claim(a[pi],o)),Xo in a&&(a[Xo]&&n.push(i.get(a[Xo].id)),o[Xo]&&n.push(i.get(o[Xo].id))),Wg(t,a),e.oldProperties=s,e.changed=n,n},Zo.prototype.postExecute=function(e){var t=e.element,n=t.label,i=n&&U(n).name;if(i){var r=this._textRenderer.getExternalLabelBounds(n,i);this._modeling.resizeShape(n,r,ZC)}},Zo.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 Wg(t,i),Gg(n,r)&&(a.unclaim(n[pi]),o.updateId(t,i[pi]),a.claim(i[pi],r)),e.changed};function Gg(e,t){return pi in e&&e[pi]!==t[pi]}function QC(e,t){var n=ba(t),i=e.businessObject,r=Me(e);return en(n,function(o,a){return a!==Vg?o[a]=i.get(a):o[a]=JC(r,ba(t.di)),o},{})}function JC(e,t){return en(t,function(n,i){return n[i]=e&&e.get(i),n},{})}function Wg(e,t){var n=e.businessObject,i=Me(e);T(t,function(r,o){o!==Vg?n.set(o,r):i&&eP(i,r)})}function eP(e,t){T(t,function(n,i){e.set(i,n)})}var tP=["default"];function nP(e){var t=k({},e);return tP.forEach(function(n){n in e&&(t[n]=U(t[n]))}),t}function zs(e,t){this._canvas=e,this._modeling=t}zs.$inject=["canvas","modeling"],zs.prototype.execute=function(e){var t=this._canvas,n=e.newRoot,i=n.businessObject,r=t.getRootElement(),o=r.businessObject,a=o.$parent,s=Me(r);return t.setRootElement(n),t.removeRootElement(r),it(a.rootElements,i),i.$parent=a,tt(a.rootElements,o),o.$parent=null,r.di=null,s.bpmnElement=i,n.di=s,e.oldRoot=r,[]},zs.prototype.revert=function(e){var t=this._canvas,n=e.newRoot,i=n.businessObject,r=e.oldRoot,o=r.businessObject,a=i.$parent,s=Me(n);return t.setRootElement(r),t.removeRootElement(n),tt(a.rootElements,i),i.$parent=null,it(a.rootElements,o),o.$parent=a,n.di=null,s.bpmnElement=o,r.di=s,[]};function Ql(e,t){this._modeling=e,this._spaceTool=t}Ql.$inject=["modeling","spaceTool"],Ql.prototype.preExecute=function(e){var t=this._spaceTool,n=this._modeling,i=e.shape,r=e.location,o=bn(i),a=o===i,s=a?i:i.parent,c=Li(s),u=St(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+_n,y:i.y,width:i.width-_n,height:i.height}:{x:i.x,y:i.y+_n,width:i.width,height:i.height-_n};n.createShape({type:"bpmn:Lane",isHorizontal:u},l,s)}var p=[];lr(o,function(x){return p.push(x),x.label&&p.push(x.label),x===i?[]:we(x.children,function(S){return S!==i})});var f,d,h,m,g;r==="top"?(f=-120,d=i.y,h=d+10,m="n",g="y"):r==="left"?(f=-120,d=i.x,h=d+10,m="w",g="x"):r==="bottom"?(f=120,d=i.y+i.height,h=d-10,m="s",g="y"):r==="right"&&(f=120,d=i.x+i.width,h=d-10,m="e",g="x");var w=t.calculateAdjustments(p,g,f,h),E=u?{x:0,y:f}:{x:f,y:0};t.makeSpace(w.movingShapes,w.resizingShapes,E,m,h);var b=u?{x:i.x+(a?_n:0),y:d-(r==="top"?120:0),width:i.width-(a?_n:0),height:120}:{x:d-(r==="left"?120:0),y:i.y+(a?_n:0),width:120,height:i.height-(a?_n:0)};e.newLane=n.createShape({type:"bpmn:Lane",isHorizontal:u},b,s)};function Jl(e){this._modeling=e}Jl.$inject=["modeling"],Jl.prototype.preExecute=function(e){var t=this._modeling,n=e.shape,i=e.count,r=Li(n),o=r.length;if(o>i)throw new Error(`more than <${i}> child lanes`);var a=St(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+_n,y:n.y+f*c,width:n.width-_n,height:u}:{x:n.x+f*c,y:n.y+_n,width:u,height:n.height-_n},f<o?t.resizeShape(r[f],l):(p={type:"bpmn:Lane",isHorizontal:a},t.createShape(p,l,n))};function Qo(e,t){this._modeling=e,this._spaceTool=t}Qo.$inject=["modeling","spaceTool"],Qo.prototype.preExecute=function(e){var t=e.shape,n=e.newBounds,i=e.balanced;i!==!1?this.resizeBalanced(t,n):this.resizeSpace(t,n)},Qo.prototype.resizeBalanced=function(e,t){var n=this._modeling,i=X1(e,t);n.resizeShape(e,t),i.forEach(function(r){n.resizeShape(r.shape,r.newBounds)})},Qo.prototype.resizeSpace=function(e,t){var n=this._spaceTool,i=le(e),r=le(t),o=wh(r,i),a=bn(e),s=[],c=[];lr(a,function(h){return s.push(h),(y(h,"bpmn:Lane")||y(h,"bpmn:Participant"))&&c.push(h),h.children});var u,l,p,f,d;(o.bottom||o.top)&&(u=o.bottom||o.top,l=e.y+(o.bottom?e.height:0)+(o.bottom?-10:10),p=o.bottom?"s":"n",f=o.top>0||o.bottom<0?-u:u,d=n.calculateAdjustments(s,"y",f,l),n.makeSpace(d.movingShapes,d.resizingShapes,{x:0,y:u},p)),(o.left||o.right)&&(u=o.right||o.left,l=e.x+(o.right?e.width:0)+(o.right?-10:100),p=o.right?"e":"w",f=o.left>0||o.right<0?-u:u,d=n.calculateAdjustments(c,"x",f,l),n.makeSpace(d.movingShapes,d.resizingShapes,{x:u,y:0},p))};var Jo="flowNodeRef",ep="lanes";function Vs(){}Vs.prototype._computeUpdates=function(e,t){var n=[],i=[],r={},o=[];function a(l,p){var f=le(p),d={x:l.x+l.width/2,y:l.y+l.height/2};return d.x>f.left&&d.x<f.right&&d.y>f.top&&d.y<f.bottom}function s(l){n.indexOf(l)===-1&&(o.push(l),n.push(l))}function c(l){var p=bn(l);return r[p.id]||(r[p.id]=as(p)),r[p.id]}function u(l){if(!l.parent)return[];var p=c(l);return p.filter(function(f){return a(l,f)}).map(function(f){return f.businessObject})}return t.forEach(function(l){var p=bn(l);if(!(!p||n.indexOf(p)!==-1)){var f=p.children.filter(function(d){return y(d,"bpmn:FlowNode")});f.forEach(s),n.push(p)}}),e.forEach(s),o.forEach(function(l){var p=l.businessObject,f=p.get(ep),d=f.slice(),h=u(l);i.push({flowNode:p,remove:d,add:h})}),t.forEach(function(l){var p=l.businessObject;l.parent||p.get(Jo).forEach(function(f){i.push({flowNode:f,remove:[p],add:[]})})}),i},Vs.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(ep);n.remove.forEach(function(o){tt(r,o),tt(o.get(Jo),i)}),n.add.forEach(function(o){it(r,o),it(o.get(Jo),i)})}),[]},Vs.prototype.revert=function(e){var t=e.updates;return t.forEach(function(n){var i=n.flowNode,r=i.get(ep);n.add.forEach(function(o){tt(r,o),tt(o.get(Jo),i)}),n.remove.forEach(function(o){it(r,o),it(o.get(Jo),i)})}),[]};var tp="categoryValueRef";function ea(e,t){this._bpmnFactory=e,this._elementRegistry=t}ea.$inject=["bpmnFactory","elementRegistry"],ea.prototype._computeUpdates=function(e,t){var n=this._elementRegistry,i=this._bpmnFactory,r=new Map,o=[],a=new Map;function s(E,b,x){if(b){var S=a.get(E);S||(S={},a.set(E,S)),!(x&&S.present)&&(!x&&S.past||(x?S.present={categoryValue:b,root:np(E)}:S.past={categoryValue:b}))}}function c(E){r.set(E,U(E))}function u(){n.filter(function(E){return y(E,"bpmn:FlowElement")&&!_e(E)&&E.parent}).forEach(c)}function l(E){var b=U(E),x=b.get("categoryValueRef");return x||(x=yh(i,b),o.push(iP(E,x))),x}function p(E){return E.reduce(function(b,x){var S=np(x),A=b.get(S);return A||(A=[],b.set(S,A)),A.push(x),b},new Map)}e=Array.from(e||[]);var f=p(e);t.length&&u(),e.forEach(c),n.filter(function(E){return y(E,"bpmn:Group")&&!_e(E)&&E.parent}).forEach(function(E){var b=U(E).get("categoryValueRef");if(!b){var x=np(E),S=f.get(x)||[],A=Ir(S,E),I=Object.keys(A).length>0;I&&(b=l(E))}s(E,b,!0)}),t.forEach(function(E){s(E.groupShape,E.categoryValue,!1)}),o.length&&u();var d=Array.from(r.keys()),h=Array.from(a.values()).reduce(function(E,b){return b.present&&E.add(b.present.categoryValue),b.past&&E.add(b.past.categoryValue),E},new Set),m=new Map,g=p(d);a.forEach(function(E,b){var x=E.present;if(x){var S=g.get(x.root)||[],A=Ir(S,b);S.forEach(function(I){if(A[I.id]){var C=m.get(I);C||(C=new Set,m.set(I,C)),C.add(x.categoryValue)}})}});var w=d.reduce(function(E,b){var x=r.get(b),S=x.get(tp),A=new Set(S),I=m.get(b)||new Set,C=Array.from(I).filter(function(j){return!A.has(j)}),$=S.filter(function(j){return h.has(j)&&!I.has(j)});return(C.length||$.length)&&E.push({businessObject:x,categoryValuesToAdd:C,categoryValuesToRemove:$}),E},[]);return{flowElements:w,groups:o}},ea.prototype.execute=function(e){var t=e.updates;return t||(t=e.updates=this._computeUpdates(e.affectedFlowElements,e.affectedGroupEntries)),rP(t.groups),aP(t.flowElements),[]},ea.prototype.revert=function(e){var t=e.updates;return sP(t.flowElements),oP(t.groups),[]};function iP(e,t){return{groupShape:e,categoryValue:t,category:t.$parent}}function rP(e){e.forEach(function(t){U(t.groupShape).categoryValueRef=t.categoryValue,t.categoryValue.$parent=t.category})}function oP(e){e.forEach(function(t){U(t.groupShape).categoryValueRef=null})}function aP(e){e.forEach(function(t){var n=t.businessObject,i=n.get(tp);t.categoryValuesToRemove.forEach(function(r){tt(i,r)}),t.categoryValuesToAdd.forEach(function(r){it(i,r,!0)})})}function sP(e){e.forEach(function(t){var n=t.businessObject,i=n.get(tp);t.categoryValuesToAdd.forEach(function(r){tt(i,r)}),t.categoryValuesToRemove.forEach(function(r){it(i,r,!0)})})}function np(e){for(;e.parent;)e=e.parent;return e}function Gs(e){this._moddle=e}Gs.$inject=["moddle"],Gs.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),[]},Gs.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 cP={fill:void 0,stroke:void 0};function ip(e){this._commandStack=e,this._normalizeColor=function(t){if(t){if(Qt(t)){var n=uP(t);if(n)return n}throw new Error(`invalid color value: ${t}`)}}}ip.$inject=["commandStack"],ip.prototype.postExecute=function(e){var t=e.elements,n=e.colors||cP,i=this,r={};"fill"in n&&k(r,{"background-color":this._normalizeColor(n.fill)}),"stroke"in n&&k(r,{"border-color":this._normalizeColor(n.stroke)}),T(t,function(o){var a=$e(o)?Mn(r,["border-color"]):r,s=Me(o);if(lP(a),_e(o)){if(!s||!y(s.label,"bpmndi:BPMNLabel"))return;i._commandStack.execute("element.updateModdleProperties",{element:o,moddleElement:s.label,properties:{color:r["border-color"]}})}else{if(!xe(s,["bpmndi:BPMNEdge","bpmndi:BPMNShape"]))return;i._commandStack.execute("element.updateProperties",{element:o,properties:{di:a}})}})};function uP(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 lP(e){"border-color"in e&&(e.stroke=e["border-color"]),"background-color"in e&&(e.fill=e["background-color"])}var pP={width:0,height:0};function Ug(e,t,n){function i(c,u){var l=c.label||c,p=c.labelTarget||c;return jw(l,u),[l,p]}function r(c){var u=c.element,l=u.businessObject,p=c.newLabel;if(!_e(u)&&Oi(u)&&!qa(u)&&!qg(p)){var f=7,d=Pu(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=hn(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(!(!_e(l)&&!y(l,"bpmn:TextAnnotation"))){if(_e(l)&&qg(p)){d.removeShape!==!1&&e.removeShape(l,{unsetLabel:!1});return}var h=hn(u);typeof f>"u"&&(f=t.getExternalLabelBounds(l,h)),f&&e.resizeShape(l,f,pP)}}this.preExecute=r,this.execute=o,this.revert=a,this.postExecute=s}Ug.$inject=["modeling","textRenderer","bpmnFactory"];function qg(e){return!e||!e.trim()}function kt(e,t,n,i){je.call(this,e,t,n),this._bpmnRules=i}Q(kt,je),kt.$inject=["eventBus","elementFactory","commandStack","bpmnRules"],kt.prototype.getHandlers=function(){var e=je.prototype.getHandlers.call(this);return e["element.updateModdleProperties"]=Ko,e["element.updateProperties"]=Zo,e["canvas.updateRoot"]=zs,e["lane.add"]=Ql,e["lane.resize"]=Qo,e["lane.split"]=Jl,e["lane.updateRefs"]=Vs,e["group.updateRefs"]=ea,e["id.updateClaim"]=Gs,e["element.setColor"]=ip,e["element.updateLabel"]=Ug,e},kt.prototype.updateLabel=function(e,t,n,i){this._commandStack.execute("element.updateLabel",{element:e,newLabel:t,newBounds:n,hints:i||{}})},kt.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)},kt.prototype.updateModdleProperties=function(e,t,n){this._commandStack.execute("element.updateModdleProperties",{element:e,moddleElement:t,properties:n})},kt.prototype.updateProperties=function(e,t){this._commandStack.execute("element.updateProperties",{element:e,properties:t})},kt.prototype.resizeLane=function(e,t,n){this._commandStack.execute("lane.resize",{shape:e,newBounds:t,balanced:n})},kt.prototype.addLane=function(e,t){var n={shape:e,location:t};return this._commandStack.execute("lane.add",n),n.newLane},kt.prototype.splitLane=function(e,t){this._commandStack.execute("lane.split",{shape:e,count:t})},kt.prototype.makeCollaboration=function(){var e=this._create("root",{type:"bpmn:Collaboration"}),t={newRoot:e};return this._commandStack.execute("canvas.updateRoot",t),e},kt.prototype.makeProcess=function(){var e=this._create("root",{type:"bpmn:Process"}),t={newRoot:e};return this._commandStack.execute("canvas.updateRoot",t),e},kt.prototype.updateLaneRefs=function(e,t){this._commandStack.execute("lane.updateRefs",{flowNodeShapes:e,laneShapes:t})},kt.prototype.updateCategoryValueRefs=function(e,t){this._commandStack.execute("group.updateRefs",{affectedFlowElements:e,affectedGroupEntries:t})},kt.prototype.claimId=function(e,t){this._commandStack.execute("id.updateClaim",{id:e,element:t,claiming:!0})},kt.prototype.unclaimId=function(e,t){this._commandStack.execute("id.updateClaim",{id:e,element:t})},kt.prototype.setColor=function(e,t){e.length||(e=[e]),this._commandStack.execute("element.setColor",{elements:e,colors:t})};function Yg(){}Yg.prototype.layoutConnection=function(e,t){return t=t||{},[t.connectionStart||fe(t.source||e.source),t.connectionEnd||fe(t.target||e.target)]};var Ws=20,fP=5,Us=Math.round,Kg=20,dP={"h:h":20,"v:v":20,"h:v":-10,"v:h":-10};function hP(e,t){return!{t:/top/,r:/right/,b:/bottom/,l:/left/,h:/./,v:/./}[t].test(e)}function mP(e,t){return{t:/top/,r:/right/,b:/bottom/,l:/left/,h:/left|right/,v:/top|bottom/}[e].test(t)}function Xg(e,t,n){var i=At(t,e,fP),r=n.split(":")[0],o=Us((t.x-e.x)/2+e.x),a=Us((t.y-e.y)/2+e.y),s,c,u=mP(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=hP(i,r),c=l?"h:v":"v:h",p?l?(f=a===e.y,s={x:e.x+Ws*(/l/.test(r)?-1:1),y:f?a+Ws:a}):(f=o===e.x,s={x:f?o+Ws:o,y:e.y+Ws*(/t/.test(r)?-1:1)}):s={x:o,y:a}),{waypoints:rp(e,s,c).concat(s),directions:c,turnNextDirections:f}}function gP(e,t,n){return Xg(e,t,n)}function vP(e,t,n){var i=Xg(t,e,Zg(n));return{waypoints:i.waypoints.slice().reverse(),directions:Zg(i.directions),turnNextDirections:i.turnNextDirections}}function yP(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=rp(e.waypoints[e.waypoints.length-1],t.waypoints[0],r);return{waypoints:o,directions:r}}function Zg(e){return e.split(":").reverse().join(":")}function _P(e,t,n){var i=Us((t.x-e.x)/2+e.x),r=Us((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 rp(e,t,n){if(n=n||"h:h",!AP(n))throw new Error("unknown directions: <"+n+">: must be specified as <start>:<end> with start/end in { h,v,t,r,b,l }");if(Jg(n)){var i=gP(e,t,n),r=vP(e,t,n),o=yP(i,r);return[].concat(i.waypoints,o.waypoints,r.waypoints)}return _P(e,t,n)}function bP(e,t,n){var i=rp(e,t,n);return i.unshift(e),i.push(t),tv(i)}function xP(e,t,n,i,r){var o=r&&r.preferredLayouts||[],a=Db(o,"straight")[0]||"h:h",s=dP[a]||0,c=At(e,t,s),u=PP(c,a);n=n||fe(e),i=i||fe(t);var l=u.split(":"),p=ev(n,e,l[0],TP(c)),f=ev(i,t,l[1],c);return bP(p,f,u)}function EP(e,t,n,i,r,o){pe(n)&&(r=n,o=i,n=fe(e),i=fe(t)),o=k({preferredLayouts:[]},o),r=r||[];var a=o.preferredLayouts,s=a.indexOf("straight")!==-1,c;return c=s&&SP(e,t,n,i,o),c||(c=o.connectionEnd&&CP(t,e,i,r),c)||(c=o.connectionStart&&RP(e,t,n,r),c)?c:!o.connectionStart&&!o.connectionEnd&&r&&r.length?r:xP(e,t,n,i,o)}function wP(e,t,n){return e>=t&&e<=n}function Qg(e,t,n){var i={x:"width",y:"height"};return wP(t[e],n[e],n[e]+n[i[e]])}function SP(e,t,n,i,r){var o={},a,s;return s=At(e,t),/^(top|bottom|left|right)$/.test(s)?(/top|bottom/.test(s)&&(a="x"),/left|right/.test(s)&&(a="y"),r.preserveDocking==="target"?Qg(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:Qg(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 RP(e,t,n,i){return op(e,t,n,i)}function CP(e,t,n,i){var r=i.slice().reverse();return r=op(e,t,n,r),r?r.reverse():null}function op(e,t,n,i){function r(l){return l.length<3?!0:l.length>4?!1:!!He(l,function(p,f){var d=l[f-1];return d&&So(p,d)<3})}function o(l,p,f){var d=ni(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(Sd(l[d],p,Kg)||Sd(l[d],f,Kg))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=op(e,t,n,u)),c&&ni(c)?null:c}function PP(e,t){if(Jg(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 AP(e){return e&&/^h|v|t|r|b|l:h|v|t|r|b|l$/.test(e)}function Jg(e){return e&&/t|r|b|l/.test(e)}function TP(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 ev(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 tv(e){return e.reduce(function(t,n,i){var r=t[t.length-1],o=e[i+1];return Eu(r,o,n,0)||t.push(n),t},[])}var MP=-10,kP=40,DP={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},OP={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},ap={top:"bottom","top-right":"bottom-left","top-left":"bottom-right",right:"left",bottom:"top","bottom-right":"top-left","bottom-left":"top-right",left:"right"},ta={top:"t",right:"r",bottom:"b",left:"l"};function qs(e){this._elementRegistry=e}Q(qs,Yg),qs.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=nv(r&&r[0],n)),a||(a=nv(r&&r[r.length-1],i)),(y(e,"bpmn:Association")||y(e,"bpmn:DataAssociation"))&&r&&!iv(n,i))return[].concat([o],r.slice(1,-1),[a]);var l=hh(n,s)?DP:OP;return y(e,"bpmn:MessageFlow")?c=LP(n,i,l):(y(e,"bpmn:SequenceFlow")||iv(n,i))&&(n===i?c={preferredLayouts:HP(n,e,l)}:y(n,"bpmn:BoundaryEvent")?c={preferredLayouts:zP(n,i,a,l)}:na(n)||na(i)?c={preferredLayouts:l.subProcess,preserveDocking:NP(n)}:y(n,"bpmn:Gateway")?c={preferredLayouts:l.fromGateway}:y(i,"bpmn:Gateway")?c={preferredLayouts:l.toGateway}:c={preferredLayouts:l.default}),c&&(c=k(c,t),u=tv(EP(n,i,o,a,r,c))),u||[o,a]};function IP(e){var t=e.host;return At(fe(e),t,MP)}function LP(e,t,n){return{preferredLayouts:n.messageFlow,preserveDocking:BP(e,t)}}function BP(e,t){return y(t,"bpmn:Participant")?"source":y(e,"bpmn:Participant")?"target":na(t)?"source":na(e)||y(t,"bpmn:Event")?"target":y(e,"bpmn:Event")?"source":null}function NP(e){return na(e)?"target":"source"}function nv(e,t){return e?e.original||e:fe(t)}function iv(e,t){return y(t,"bpmn:Activity")&&y(e,"bpmn:BoundaryEvent")&&t.businessObject.isForCompensation}function na(e){return y(e,"bpmn:SubProcess")&&Re(e)}function _r(e,t){return e===t}function $P(e,t){return t.indexOf(e)!==-1}function Jr(e){var t=/right|left/.exec(e);return t&&t[0]}function eo(e){var t=/top|bottom/.exec(e);return t&&t[0]}function rv(e,t){return ap[e]===t}function jP(e,t){var n=Jr(e),i=ap[n];return t.indexOf(i)!==-1}function FP(e,t){var n=eo(e),i=ap[n];return t.indexOf(i)!==-1}function ov(e){return e==="right"||e==="left"}function HP(e,t,n){var i=t.waypoints,r=i&&i.length&&At(i[0],e);return r==="top"?n.loop.fromTop:r==="right"?n.loop.fromRight:r==="left"?n.loop.fromLeft:n.loop.fromBottom}function zP(e,t,n,i){var r=fe(e),o=fe(t),a=IP(e),s,c,u=_r(e.host,t),l=$P(a,["top","right","bottom","left"]),p=At(o,r,{x:e.width/2+t.width/2,y:e.height/2+t.height/2});return u?VP(a,l,e,t,n,i):(s=GP(a,p,l,i.isHorizontal),c=WP(a,p,l,i.isHorizontal),[s+":"+c])}function VP(e,t,n,i,r,o){var a=t?e:o.isHorizontal?eo(e):Jr(e),s=ta[a],c;return t?ov(e)?c=av("y",n,i,r)?"h":o.boundaryLoop.alternateHorizontalSide:c=av("x",n,i,r)?"v":o.boundaryLoop.alternateVerticalSide:c=o.boundaryLoop.default,[s+":"+c]}function av(e,t,n,i){var r=kP;return!(sp(e,i,n,r)||sp(e,i,{x:n.x+n.width,y:n.y+n.height},r)||sp(e,i,fe(t),r))}function sp(e,t,n,i){return Math.abs(t[e]-n[e])<i}function GP(e,t,n,i){if(n)return ta[e];var r=eo(e),o=Jr(e),a=eo(t),s=Jr(t);if(i){if(_r(r,a)||rv(o,s))return ta[r]}else if(_r(o,s)||rv(r,a))return ta[o];return ta[i?o:r]}function WP(e,t,n,i){if(n)return ov(e)?jP(e,t)||_r(e,t)?"h":"v":FP(e,t)||_r(e,t)?"v":"h";var r=eo(e),o=Jr(e),a=eo(t),s=Jr(t);return a&&!s?"v":s&&!a?"h":i?_r(r,a)?"h":"v":_r(o,s)?"v":"h"}qs.$inject=["elementRegistry"];function sv(e){return k({original:e.point.original||e.point},e.actual)}function Gi(e,t){this._elementRegistry=e,this._graphicsFactory=t}Gi.$inject=["elementRegistry","graphicsFactory"],Gi.prototype.getCroppedWaypoints=function(e,t,n){t=t||e.source,n=n||e.target;var i=this.getDockingPoint(e,t,!0),r=this.getDockingPoint(e,n),o=e.waypoints.slice(i.idx+1,r.idx);return o.unshift(sv(i)),o.push(sv(r)),o},Gi.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}},Gi.prototype._getIntersection=function(e,t,n){var i=this._getShapePath(e),r=this._getConnectionPath(t);return Ro(i,r,n)},Gi.prototype._getConnectionPath=function(e){return this._graphicsFactory.getConnectionPath(e)},Gi.prototype._getShapePath=function(e){return this._graphicsFactory.getShapePath(e)},Gi.prototype._getGfx=function(e){return this._elementRegistry.getGraphics(e)};const cp={__init__:["modeling","bpmnUpdater"],__depends__:[lR,CR,AR,TR,_g,MC,DC,$C,En,Wl,Rg],bpmnFactory:["type",Sn],bpmnUpdater:["type",sn],elementFactory:["type",Hi],modeling:["type",kt],layouter:["type",qs],connectionDocking:["type",Gi]};var UP=10,cv=50,qP=250;function up(e,t,n,i){for(var r;r=YP(e,n,t);)n=i(t,n,r);return n}function lp(e){return function(t,n,i){var r={x:n.x,y:n.y};return["x","y"].forEach(function(o){var a=e[o];if(a){var s=o==="x"?"width":"height",c=a.margin,u=a.minDistance;c<0?r[o]=Math.min(i[o]+c-t[s]/2,n[o]-u+c):r[o]=Math.max(i[o]+i[s]+c+t[s]/2,n[o]+u+c)}}),r}}function YP(e,t,n){var i={x:t.x-n.width/2,y:t.y-n.height/2,width:n.width,height:n.height},r=XP(e);return He(r,function(o){if(o===n)return!1;var a=At(o,i,UP);return a==="intersect"})}function KP(e,t){t||(t={});function n(h){return h.source===e?1:-1}var i=t.defaultDistance||cv,r=t.direction||"e",o=t.filter,a=t.getWeight||n,s=t.maxDistance||qP,c=t.reference||"start";o||(o=JP);function u(h,m){return r==="n"?c==="start"?le(h).top-le(m).bottom:c==="center"?le(h).top-fe(m).y:le(h).top-le(m).top:r==="w"?c==="start"?le(h).left-le(m).right:c==="center"?le(h).left-fe(m).x:le(h).left-le(m).left:r==="s"?c==="start"?le(m).top-le(h).bottom:c==="center"?fe(m).y-le(h).bottom:le(m).bottom-le(h).bottom:c==="start"?le(m).left-le(h).right:c==="center"?fe(m).x-le(h).right:le(m).right-le(h).right}var l=e.incoming.filter(o).map(function(h){var m=a(h),g=m<0?u(h.source,e):u(e,h.source);return{id:h.source.id,distance:g,weight:m}}),p=e.outgoing.filter(o).map(function(h){var m=a(h),g=m>0?u(e,h.target):u(h.target,e);return{id:h.target.id,distance:g,weight:m}}),f=l.concat(p).reduce(function(h,m){return h[m.id+"__weight_"+m.weight]=m,h},{}),d=en(f,function(h,m){var g=m.distance,w=m.weight;return g<0||g>s||(h[String(g)]||(h[String(g)]=0),h[String(g)]+=1*w,(!h.distance||h[h.distance]<h[String(g)])&&(h.distance=g)),h},{});return d.distance||i}function XP(e){var t=pp(e);return e.host&&(t=t.concat(pp(e.host))),e.attachers&&(t=t.concat(e.attachers.reduce(function(n,i){return n.concat(pp(i))},[]))),t}function pp(e){return QP(e).concat(ZP(e))}function ZP(e){return e.incoming.map(function(t){return t.source})}function QP(e){return e.outgoing.map(function(t){return t.target})}function JP(){return!0}var eA=100;function uv(e,t,n){e.on("autoPlace",eA,function(i){var r=i.shape,o=i.source;return tA(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}}uv.$inject=["eventBus","modeling","canvas"];function tA(e,t,n){n||(n={});var i=n.defaultDistance||cv,r=fe(e),o=le(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 nA={__init__:["autoPlaceSelectionBehavior"],autoPlace:["type",uv],autoPlaceSelectionBehavior:["type",lv]};function pv(e,t,n){var i=hh(e,n);if(y(t,"bpmn:TextAnnotation"))return rA(e,t,i);if(xe(t,["bpmn:DataObjectReference","bpmn:DataStoreReference"]))return oA(e,t,i);if(y(t,"bpmn:FlowNode"))return iA(e,t,i)}function iA(e,t,n){var i=le(e),r=fe(e),o=n?{directionHint:"e",minDistance:80,baseOrientation:"left",boundaryOrientation:"top",start:"top",end:"bottom"}:{directionHint:"s",minDistance:90,baseOrientation:"top",boundaryOrientation:"left",start:"left",end:"right"},a=KP(e,{filter:function(d){return y(d,"bpmn:SequenceFlow")},direction:o.directionHint}),s=30,c=o.minDistance,u=o.baseOrientation;y(e,"bpmn:BoundaryEvent")&&(u=At(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},p={margin:s,minDistance:c},f=n?{y:p}:{x:p};return up(e,t,l,lp(f))}function fv(e,t,n){return e.includes(n.start)?-1*t:e.includes(n.end)?t:0}function rA(e,t,n){var i=le(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};$e(e)&&(r=fe(e),n?(r.x+=100,r.y-=50):(r.x+=100,r.y+=50));var o={margin:n?-30:30,minDistance:20},a=n?{y:o}:{x:o};return up(e,t,r,lp(a))}function oA(e,t,n){var i=le(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 up(e,t,r,lp(a))}function dv(e,t){e.on("autoPlace",function(n){var i=n.shape,r=n.source;return pv(r,i,t)})}dv.$inject=["eventBus","elementRegistry"];const Ys={__depends__:[nA],__init__:["bpmnAutoPlace"],bpmnAutoPlace:["type",dv]},to={cjkEm:.865,upperEm:.68,lowerEm:.5,digitEm:.556,spaceEm:.278,otherEm:.35,ascentEm:.9,descentEm:.25},aA=/[ᄀ-ᇿ -〿぀-ヿ㐀-鿿가-힯＀-⦆]/;function sA(e){const t=to;return aA.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 fp(e,t){let n=0;for(const i of e)n+=t*sA(i);return n}function hv(e=globalThis,{textMeasurement:t="approximate"}={}){if(!(e!=null&&e.SVGElement))throw new Error("installHeadlessBpmnDom: DOM 전역이 없다 — jsdom window 를 전역에 올린 뒤 호출할 것");t==="approximate"&&cA(e),uA(e),lA(e),pA(e)}function cA(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:fp(r,o),fontBoundingBoxAscent:o*to.ascentEm,fontBoundingBoxDescent:o*to.descentEm,actualBoundingBoxAscent:o*to.ascentEm,actualBoundingBoxDescent:o*to.descentEm}}};t.getContext=()=>n}function uA(e){if(e.SVGMatrix)return;class t{constructor(){Cr(this,"a",1);Cr(this,"b",0);Cr(this,"c",0);Cr(this,"d",1);Cr(this,"e",0);Cr(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 lA(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 pA(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:fp(n,12),height:14}})}const mv=[fh,ko,cp,Ys];function fA(e={}){hv(globalThis,e.dom);const t=document.createElement("div");return document.body.appendChild(t),new Nr({container:t,moddleExtensions:e.moddleExtensions??Pa,additionalModules:[...mv,...e.additionalModules??[]]})}var dA=new Zr("ov"),hA=500;function Ct(e,t,n,i){this._eventBus=t,this._canvas=n,this._elementRegistry=i,this._ids=dA,this._overlayDefaults=k({show:null,scale:!0},e&&e.defaults),this._overlays={},this._overlayContainers=[],this._overlayRoot=mA(n.getContainer()),this._init()}Ct.$inject=["config.overlays","eventBus","canvas","elementRegistry"],Ct.prototype.get=function(e){if(Qt(e)&&(e={id:e}),Qt(e.element)&&(e.element=this._elementRegistry.get(e.element)),e.element){var t=this._getOverlayContainer(e.element,!0);return t?e.type?we(t.overlays,Mr({type:e.type})):t.overlays.slice():[]}else return e.type?we(this._overlays,Mr({type:e.type})):e.id?this._overlays[e.id]:null},Ct.prototype.add=function(e,t,n){if(xt(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=k({},this._overlayDefaults,n,{id:i,type:t,element:e,html:n.html}),this._addOverlay(n),i},Ct.prototype.remove=function(e){var t=this.get(e)||[];pe(t)||(t=[t]);var n=this;T(t,function(i){var r=n._getOverlayContainer(i.element,!0);if(i&&(Fn(i.html),Fn(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)}})},Ct.prototype.isShown=function(){return this._overlayRoot.style.display!=="none"},Ct.prototype.show=function(){Ks(this._overlayRoot)},Ct.prototype.hide=function(){Ks(this._overlayRoot,!1)},Ct.prototype.clear=function(){this._overlays={},this._overlayContainers=[],Da(this._overlayRoot)},Ct.prototype._updateOverlayContainer=function(e){var t=e.element,n=e.html,i=t.x,r=t.y;if(t.waypoints){var o=at(t);i=o.x,r=o.y}gv(n,i,r),Nt(e.html,"data-container-id",t.id)},Ct.prototype._updateOverlay=function(e){var t=e.position,n=e.htmlContainer,i=e.element,r=t.left,o=t.top;if(t.right!==void 0){var a;i.waypoints?a=at(i).width:a=i.width,r=t.right*-1+a}if(t.bottom!==void 0){var s;i.waypoints?s=at(i).height:s=i.height,o=t.bottom*-1+s}gv(n,r||0,o||0),this._updateOverlayVisibilty(e,this._canvas.viewbox())},Ct.prototype._createOverlayContainer=function(e){var t=Ge('<div class="djs-overlays" />');Wt(t,{position:"absolute"}),this._overlayRoot.appendChild(t);var n={html:t,element:e,overlays:[]};return this._updateOverlayContainer(n),this._overlayContainers.push(n),n},Ct.prototype._updateRoot=function(e){var t=e.scale||1,n="matrix("+[t,0,0,t,-1*e.x*t,-1*e.y*t].join(",")+")";vv(this._overlayRoot,n)},Ct.prototype._getOverlayContainer=function(e,t){var n=He(this._overlayContainers,function(i){return i.element===e});return!n&&!t?this._createOverlayContainer(e):n},Ct.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)),Qt(i)&&(i=Ge(i)),o=this._getOverlayContainer(n),r=Ge('<div class="djs-overlay" data-overlay-id="'+t+'">'),Wt(r,{position:"absolute"}),r.appendChild(i),e.type&&Ye(r).add("djs-overlay-"+e.type);var a=this._canvas.findRoot(n),s=this._canvas.getRootElement();Ks(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())},Ct.prototype._updateOverlayVisibilty=function(e,t){var n=e.show,i=this._canvas.findRoot(e.element),r=n&&n.minZoom,o=n&&n.maxZoom,a=e.htmlContainer,s=this._canvas.getRootElement(),c=!0;(i!==s||n&&(mt(r)&&r>t.scale||mt(o)&&o<t.scale))&&(c=!1),Ks(a,c),this._updateOverlayScale(e,t)},Ct.prototype._updateOverlayScale=function(e,t){var n=e.scale,i,r,o=e.htmlContainer,a,s="";n!==!0&&(n===!1?(i=1,r=1):(i=n.min,r=n.max),mt(i)&&t.scale<i&&(a=(1/t.scale||1)*i),mt(r)&&t.scale>r&&(a=(1/t.scale||1)*r)),mt(a)&&(s="scale("+a+","+a+")"),vv(o,s)},Ct.prototype._updateOverlaysVisibilty=function(e){var t=this;T(this._overlays,function(n){t._updateOverlayVisibilty(n,e)})},Ct.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});T(o,function(c){t.remove(c.id)});var a=t._getOverlayContainer(r);if(a){Fn(a.html);var s=t._overlayContainers.indexOf(a);s!==-1&&t._overlayContainers.splice(s,1)}}),e.on("element.changed",hA,function(i){var r=i.element,o=t._getOverlayContainer(r,!0);o&&(T(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&&Ye(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 mA(e){var t=Ge('<div class="djs-overlay-container" />');return Wt(t,{position:"absolute",width:0,height:0}),e.insertBefore(t,e.firstChild),t}function gv(e,t,n){Wt(e,{left:t+"px",top:n+"px"})}function Ks(e,t){e.style.display=t===!1?"none":""}function vv(e,t){e.style["transform-origin"]="top left",["","-ms-","-webkit-"].forEach(function(n){e.style[n+"transform"]=t})}const Xs={__init__:["overlays"],overlays:["type",Ct]};function dp(e,t){t.invoke(W,this),this.executed(function(n){var i=n.context;i.rootElement?e.setRootElement(i.rootElement):i.rootElement=e.getRootElement()}),this.revert(function(n){var i=n.context;i.rootElement&&e.setRootElement(i.rootElement)})}Q(dp,W),dp.$inject=["canvas","injector"];const gA={__init__:["rootElementsBehavior"],rootElementsBehavior:["type",dp]};function ia(e){return CSS.escape(e)}var vA={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"};function yv(e){return e=""+e,e&&e.replace(/[&<>"']/g,function(t){return vA[t]})}var yA="bjs-breadcrumbs-shown";function _v(e,t,n){var i=Ge('<ul class="bjs-breadcrumbs"></ul>'),r=n.getContainer(),o=Ye(r);r.appendChild(i);var a=[];e.on("element.changed",function(c){var u=c.element,l=U(u),p=He(a,function(f){return f===l});p&&s()});function s(c){c&&(a=_A(c));var u=a.flatMap(function(p){var f=n.findRoot(Wn(p))||n.findRoot(p.id);if(!f&&y(p,"bpmn:Process")){var d=t.find(function(g){var w=U(g);return w&&w.get("processRef")===p});f=d&&n.findRoot(d.id)}if(!f)return[];var h=yv(p.name||p.id),m=Ge('<li><span class="bjs-crumb"><a title="'+h+'">'+h+"</a></span></li>");return m.addEventListener("click",function(){n.setRootElement(f)}),m});i.innerHTML="";var l=u.length>1;o.toggle(yA,l),u.forEach(function(p){i.appendChild(p)})}e.on("root.set",function(c){s(c.element)})}_v.$inject=["eventBus","elementRegistry","canvas"];function _A(e){for(var t=U(e),n=[],i=t;i;i=i.$parent)(y(i,"bpmn:SubProcess")||y(i,"bpmn:Process"))&&n.push(i);return n.reverse()}function bv(e,t){var n=null,i=new bA;e.on("root.set",function(r){var o=r.element,a=t.viewbox(),s=i.get(o);if(i.set(n,{x:a.x,y:a.y,zoom:a.scale}),n=o,!(!y(o,"bpmn:SubProcess")&&!s)){s=s||{x:0,y:0,zoom:1};var c=(a.x-s.x)*a.scale,u=(a.y-s.y)*a.scale;(c!==0||u!==0)&&t.scroll({dx:c,dy:u}),s.zoom!==a.scale&&t.zoom(s.zoom,{x:0,y:0})}}),e.on("diagram.clear",function(){i.clear(),n=null})}bv.$inject=["eventBus","canvas"];function bA(){this._entries=[],this.set=function(e,t){var n=!1;for(var i in this._entries)if(this._entries[i][0]===e){this._entries[i][1]=t,n=!0;break}n||this._entries.push([e,t])},this.get=function(e){for(var t in this._entries)if(this._entries[t][0]===e)return this._entries[t][1];return null},this.clear=function(){this._entries.length=0},this.remove=function(e){var t=-1;for(var n in this._entries)if(this._entries[n][0]===e){t=n;break}t!==-1&&this._entries.splice(t,1)}}var xv={x:180,y:160};function br(e,t){this._eventBus=e,this._moddle=t;var n=this;e.on("import.render.start",1500,function(i,r){n._handleImport(r.definitions)})}br.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)})}},br.prototype._createNewDiagrams=function(e){var t=this,n=[],i=[];e.get("planeElement").forEach(function(o){var a=o.bpmnElement;if(a){var s=a.$parent;y(a,"bpmn:SubProcess")&&!o.isExpanded&&n.push(a),EA(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},br.prototype._movePlaneElementsToOrigin=function(e){var t=e.get("planeElement"),n=xA(e),i={x:n.x-xv.x,y:n.y-xv.y};t.forEach(function(r){r.waypoint?r.waypoint.forEach(function(o){o.x=o.x-i.x,o.y=o.y-i.y}):r.bounds&&(r.bounds.x=r.bounds.x-i.x,r.bounds.y=r.bounds.y-i.y)})},br.prototype._moveToDiPlane=function(e,t){var n=Ev(e),i=n.plane.get("planeElement");i.splice(i.indexOf(e),1),t.get("planeElement").push(e)},br.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},br.$inject=["eventBus","moddle"];function Ev(e){return y(e,"bpmndi:BPMNDiagram")?e:Ev(e.$parent)}function xA(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=le(n.bounds);t.top=Math.min(i.top,t.top),t.left=Math.min(i.left,t.left)}}),Ha(t)}function EA(e,t){var n=e.$parent;return!(!y(n,"bpmn:SubProcess")||n===t.bpmnElement||xe(e,["bpmn:DataInputAssociation","bpmn:DataOutputAssociation"]))}var Zs=250,wA='<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>',SA="bjs-drilldown-empty";function Wi(e,t,n,i,r){W.call(this,t),this._canvas=e,this._eventBus=t,this._elementRegistry=n,this._overlays=i,this._translate=r;var o=this;this.executed("shape.toggleCollapse",Zs,function(a){var s=a.shape;o._canDrillDown(s)?o._addOverlay(s):o._removeOverlay(s)},!0),this.reverted("shape.toggleCollapse",Zs,function(a){var s=a.shape;o._canDrillDown(s)?o._addOverlay(s):o._removeOverlay(s)},!0),this.executed(["shape.create","shape.move","shape.delete"],Zs,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"],Zs,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)})})}Q(Wi,W),Wi.prototype._updateDrilldownOverlay=function(e){var t=this._canvas;if(e){var n=t.findRoot(e);n&&this._updateOverlayVisibility(n)}},Wi.prototype._canDrillDown=function(e){var t=this._canvas;return y(e,"bpmn:SubProcess")&&t.findRoot(Wn(e))},Wi.prototype._updateOverlayVisibility=function(e){var t=this._overlays,n=U(e),i=t.get({element:n.id,type:"drilldown"})[0];if(i){var r=n&&n.get("flowElements")&&n.get("flowElements").length;Ye(i.html).toggle(SA,!r)}},Wi.prototype._addOverlay=function(e){var t=this._canvas,n=this._overlays,i=U(e),r=n.get({element:e,type:"drilldown"});r.length&&this._removeOverlay(e);var o=Ge('<button type="button" class="bjs-drilldown">'+wA+"</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(Wn(e)))}),n.add(e,"drilldown",{position:{bottom:-7,right:-8},html:o}),this._updateOverlayVisibility(e)},Wi.prototype._removeOverlay=function(e){var t=this._overlays;t.remove({element:e,type:"drilldown"})},Wi.$inject=["canvas","eventBus","elementRegistry","overlays","translate"];const RA={__depends__:[Xs,Wl,gA],__init__:["drilldownBreadcrumbs","drilldownOverlayBehavior","drilldownCentering","subprocessCompatibility"],drilldownBreadcrumbs:["type",_v],drilldownCentering:["type",bv],drilldownOverlayBehavior:["type",Wi],subprocessCompatibility:["type",br]};function Ui(e){Ke.call(this,e)}Q(Ui,Ke),Ui.prototype._modules=[fh,RA,Xs,En,ko],Ui.prototype._moddleExtensions={};var Qs="keyboard.keydown",CA="keyboard.keyup",PA=1e3,wv="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 Ut(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(wv));var i=e&&e.bind!==!1;t.on("canvas.init",function(r){n._target=r.svg,i&&n.bind(),n._fire("init")})}Ut.$inject=["config.keyboard","eventBus"],Ut.prototype._keydownHandler=function(e){this._keyHandler(e,Qs)},Ut.prototype._keyupHandler=function(e){this._keyHandler(e,CA)},Ut.prototype._keyHandler=function(e,t){var n;if(!this._isEventIgnored(e)){var i={keyEvent:e};n=this._eventBus.fire(t||Qs,i),n&&e.preventDefault()}},Ut.prototype._isEventIgnored=function(e){return!1},Ut.prototype.bind=function(e){e&&console.error("unsupported argument <node>",new Error(wv)),this.unbind(),e=this._node=this._target,me.bind(e,"keydown",this._keydownHandler),me.bind(e,"keyup",this._keyupHandler),this._fire("bind")},Ut.prototype.getBinding=function(){return this._node},Ut.prototype.unbind=function(){var e=this._node;e&&(this._fire("unbind"),me.unbind(e,"keydown",this._keydownHandler),me.unbind(e,"keyup",this._keyupHandler)),this._node=null},Ut.prototype._fire=function(e){this._eventBus.fire("keyboard."+e,{node:this._node})},Ut.prototype.addListener=function(e,t,n){Et(e)&&(n=t,t=e,e=PA),this._eventBus.on(n||Qs,e,t)},Ut.prototype.removeListener=function(e,t){this._eventBus.off(t||Qs,e)},Ut.prototype.hasModifier=zR,Ut.prototype.isCmd=on,Ut.prototype.isShift=Il,Ut.prototype.isKey=yt;var AA=500;function no(e,t){var n=this;e.on("editorActions.init",AA,function(i){var r=i.editorActions;n.registerBindings(t,r)})}no.$inject=["eventBus","keyboard"],no.prototype.registerBindings=function(e,t){function n(i,r){t.isRegistered(i)&&e.addListener(r)}n("undo",function(i){var r=i.keyEvent;if(qR(r))return t.trigger("undo"),!0}),n("redo",function(i){var r=i.keyEvent;if(YR(r))return t.trigger("redo"),!0}),n("copy",function(i){var r=i.keyEvent;if(VR(r))return t.trigger("copy"),!0}),n("paste",function(i){var r=i.keyEvent;if(GR(r))return t.trigger("paste"),!0}),n("duplicate",function(i){var r=i.keyEvent;if(WR(r))return t.trigger("duplicate"),!0}),n("cut",function(i){var r=i.keyEvent;if(UR(r))return t.trigger("cut"),!0}),n("stepZoom",function(i){var r=i.keyEvent;if(yt(["+","Add","="],r)&&on(r))return t.trigger("stepZoom",{value:1}),!0}),n("stepZoom",function(i){var r=i.keyEvent;if(yt(["-","Subtract"],r)&&on(r))return t.trigger("stepZoom",{value:-1}),!0}),n("zoom",function(i){var r=i.keyEvent;if(yt("0",r)&&on(r))return t.trigger("zoom",{value:1}),!0}),n("removeSelection",function(i){var r=i.keyEvent;if(yt(["Backspace","Delete","Del"],r))return t.trigger("removeSelection"),!0})};const hp={__init__:["keyboard","keyboardBindings"],keyboard:["type",Ut],keyboardBindings:["type",no]};var TA={moveSpeed:50,moveSpeedAccelerated:200};function Sv(e,t,n){var i=this;this._config=k({},TA,e||{}),t.addListener(r);function r(o){var a=o.keyEvent,s=i._config;if(t.isCmd(a)&&t.isKey(["ArrowLeft","Left","ArrowUp","Up","ArrowDown","Down","ArrowRight","Right"],a)){var c=t.isShift(a)?s.moveSpeedAccelerated:s.moveSpeed,u;switch(a.key){case"ArrowLeft":case"Left":u="left";break;case"ArrowUp":case"Up":u="up";break;case"ArrowRight":case"Right":u="right";break;case"ArrowDown":case"Down":u="down";break}return i.moveCanvas({speed:c,direction:u}),!0}}this.moveCanvas=function(o){var a=0,s=0,c=o.speed,u=c/Math.min(Math.sqrt(n.viewbox().scale),1);switch(o.direction){case"left":a=u;break;case"up":s=u;break;case"right":a=-u;break;case"down":s=-u;break}n.scroll({dx:a,dy:s})}}Sv.$inject=["config.keyboardMove","keyboard","canvas"];const Rv={__depends__:[hp],__init__:["keyboardMove"],keyboardMove:["type",Sv]};var MA=15;function Cv(e,t){var n;function i(s){return a(s.originalEvent)}e.on("canvas.focus.changed",function(s){s.focused?e.on("element.mousedown",500,i):e.off("element.mousedown",i)});function r(s){var c=n.start,u=n.button,l=hr(s),p=kn(l,c);if(!n.dragging&&kA(p)>MA&&(n.dragging=!0,u===0&&Qm(e),Rs("grab")),n.dragging){var f=n.last||n.start;p=kn(l,f),t.scroll({dx:p.x,dy:p.y}),n.last=l}s.preventDefault()}function o(s){me.unbind(document,"mousemove",r),me.unbind(document,"mouseup",o),n=null,Zm()}function a(s){if(!cr(s.target,".djs-draggable")){var c=s.button;if(!(c>=2||s.ctrlKey||s.shiftKey||s.altKey))return n={button:c,start:hr(s)},me.bind(document,"mousemove",r),me.bind(document,"mouseup",o),!0}}this.isActive=function(){return!!n}}Cv.$inject=["eventBus","canvas"];function kA(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}const Pv={__init__:["moveCanvas"],moveCanvas:["type",Cv]};function Av(e,t){var n=ku(e.min),i=ku(e.max),r=Math.abs(n)+Math.abs(i);return r/t}function DA(e,t){return Math.max(e.min,Math.min(e.max,t))}var OA=Math.sign||function(e){return e>=0?1:-1},mp={min:.2,max:4},Tv=10,IA=.1,LA=.75;function Yn(e,t,n){e=e||{},this._enabled=!1,this._canvas=n,this._container=n._container,this._handleWheel=Yt(this._handleWheel,this),this._totalDelta=0,this._scale=e.scale||LA;var i=this;t.on("canvas.mouseover",function(){i._init(e.enabled!==!1)}),t.on("canvas.mouseout",function(){i._init(!1)})}Yn.$inject=["config.zoomScroll","eventBus","canvas"],Yn.prototype.scroll=function(t){this._canvas.scroll(t)},Yn.prototype.reset=function(){this._canvas.zoom("fit-viewport")},Yn.prototype.zoom=function(t,n){var i=Av(mp,Tv*2);this._totalDelta+=t,Math.abs(this._totalDelta)>IA&&(this._zoom(t,n,i),this._totalDelta=0)},Yn.prototype._handleWheel=function(t){if(this._enabled){var n=this._container;t.preventDefault();var i=t.ctrlKey||om()&&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))*OA(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)}},Yn.prototype.stepZoom=function(t,n){var i=Av(mp,Tv);this._zoom(t,n,i)},Yn.prototype._zoom=function(e,t,n){var i=this._canvas,r=e>0?1:-1,o=ku(i.zoom()),a=Math.round(o/n)*n;a+=n*r;var s=Math.pow(10,a);i.zoom(DA(mp,s),t)},Yn.prototype.toggle=function(t){var n=this._container,i=this._handleWheel,r=this._enabled;return typeof t>"u"&&(t=!r),r!==t&&me[t?"bind":"unbind"](n,"wheel",i,!1),this._enabled=t,t},Yn.prototype._init=function(e){this.toggle(e)};const Mv={__init__:["zoomScroll"],zoomScroll:["type",Yn]};function ra(e){Ui.call(this,e)}Q(ra,Ui),ra.prototype._navigationModules=[Rv,Pv,Mv],ra.prototype._modules=[].concat(Ui.prototype._modules,ra.prototype._navigationModules);function gp(e){return e&&e[e.length-1]}function kv(e){return e.y}function Dv(e){return e.x}var BA={left:Dv,center:Dv,right:function(e){return e.x+e.width},top:kv,middle:kv,bottom:function(e){return e.y+e.height}};function io(e,t){this._modeling=e,this._rules=t}io.$inject=["modeling","rules"],io.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}},io.prototype._isType=function(e,t){return t.indexOf(e)!==-1},io.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=gp(t),o[e]=l[i]+l[r];else if(this._isType(e,["center","middle"])){if(T(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=In(a,function(f){return f.elements.length>1&&(s=!0),f.elements.length}),s)return o[e]=gp(c).center,o;u=t[0],t=In(t,function(f){return f[i]+f[r]}),l=gp(t),o[e]=p(u,l)}return o},io.prototype.trigger=function(e,t){var n=this._modeling,i,r=we(e,function(c){return!(c.waypoints||c.host||c.labelTarget)});if(i=this._rules.allowed("elements.align",{elements:r}),pe(i)&&(r=i),!(r.length<2||!i)){var o=BA[t],a=In(r,o),s=this._alignmentPosition(t,a);n.alignElements(a,s)}};const NA={__init__:["alignElements"],alignElements:["type",io]},$A=new Zr;function ro(e){this._scheduled={},e.on("diagram.destroy",()=>{Object.keys(this._scheduled).forEach(t=>{this.cancel(t)})})}ro.$inject=["eventBus"],ro.prototype.schedule=function(e,t=$A.next()){this.cancel(t);const n=this._schedule(e,t);return this._scheduled[t]=n,n.promise},ro.prototype._schedule=function(e,t){const n=jA();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}},ro.prototype.cancel=function(e){const t=this._scheduled[e];t&&(this._cancel(t),this._scheduled[e]=null)},ro.prototype._cancel=function(e){clearTimeout(e.executionId)};function jA(){const e={};return e.promise=new Promise((t,n)=>{e.resolve=t,e.reject=n}),e}const FA={scheduler:["type",ro]};var HA="djs-element-hidden",Js=".entry",zA=1e3,Ov=8,VA=300;function ct(e,t,n,i){this._canvas=e,this._elementRegistry=t,this._eventBus=n,this._scheduler=i,this._current=null,this._init()}ct.$inject=["canvas","elementRegistry","eventBus","scheduler"],ct.prototype._init=function(){var e=this;this._eventBus.on("selection.changed",function(t){var n=t.newSelection,i=n.length?n.length===1?n[0]:n:null;i?e.open(i,!0):e.close()}),this._eventBus.on("elements.changed",function(t){var n=t.elements,i=e._current;if(i){var r=i.target,o=pe(r)?r:[r],a=o.filter(function(c){return n.includes(c)});if(a.length){e.close();var s=o.filter(function(c){return e._elementRegistry.get(c.id)});s.length&&e._updateAndOpen(s.length>1?s:s[0])}}}),this._eventBus.on("canvas.viewbox.changed",function(){e._updatePosition()}),this._eventBus.on("element.marker.update",function(t){if(e.isOpen()){var n=t.element,i=e._current,r=pe(i.target)?i.target:[i.target];r.includes(n)&&e._updateVisibility()}}),this._container=this._createContainer()},ct.prototype._createContainer=function(){var e=Ge('<div class="djs-context-pad-parent"></div>');return this._canvas.getContainer().appendChild(e),e},ct.prototype.registerProvider=function(e,t){t||(t=e,e=zA),this._eventBus.on("contextPad.getProviders",e,function(n){n.providers.push(t)})},ct.prototype.getEntries=function(e){var t=this._getProviders(),n=pe(e)?"getMultiElementContextPadEntries":"getContextPadEntries",i={};return T(t,function(r){if(Et(r[n])){var o=r[n](e);Et(o)?i=o(i):T(o,function(a,s){i[s]=a})}}),i},ct.prototype.trigger=function(e,t,n){var i=this,r,o,a=t.delegateTarget||t.target;if(!a)return t.preventDefault();if(r=Nt(a,"data-action"),o=t.originalEvent||t,e==="mouseover"){this._timeout=setTimeout(function(){i._mouseout=i.triggerEntry(r,"hover",o,n)},VA);return}else if(e==="mouseout"){clearTimeout(this._timeout),this._mouseout&&(this._mouseout(),this._mouseout=null);return}return this.triggerEntry(r,e,o,n)},ct.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(Et(s)){if(t==="click")return s(n,r,i)}else if(s[t])return s[t](n,r,i);n.preventDefault()}}}},ct.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))}},ct.prototype._getProviders=function(){var e=this._eventBus.createEvent({type:"contextPad.getProviders",providers:[]});return this._eventBus.fire(e),e.providers},ct.prototype._updateAndOpen=function(e){var t=this.getEntries(e),n=this._createHtml(e),i;T(t,function(r,o){var a=r.group||"default",s=Ge(r.html||'<div class="entry" draggable="true"></div>'),c;Nt(s,"data-action",o),c=Be("[data-group="+ia(a)+"]",n),c||(c=Ge('<div class="group"></div>'),Nt(c,"data-group",a),n.appendChild(c)),c.appendChild(s),r.className&&GA(s,r.className),r.title&&Nt(s,"title",r.title),r.imageUrl&&(i=Ge("<img>"),Nt(i,"src",r.imageUrl),i.style.width="100%",i.style.height="100%",s.appendChild(i))}),Ye(n).add("open"),this._current={entries:t,html:n,target:e},this._updatePosition(),this._updateVisibility(),this._eventBus.fire("contextPad.open",{current:this._current})},ct.prototype._createHtml=function(e){var t=this,n=Ge('<div class="djs-context-pad"></div>');return tn.bind(n,Js,"click",function(i){t.trigger("click",i)}),tn.bind(n,Js,"dragstart",function(i){t.trigger("dragstart",i)}),tn.bind(n,Js,"mouseover",function(i){t.trigger("mouseover",i)}),tn.bind(n,Js,"mouseout",function(i){t.trigger("mouseout",i)}),me.bind(n,"mousedown",function(i){i.stopPropagation()}),this._container.appendChild(n),this._eventBus.fire("contextPad.create",{target:e,pad:n}),n},ct.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()&&UA(this._current.target,e)?t=this._current.html:t=this._createHtml(e),{html:t}},ct.prototype.close=function(){this.isOpen()&&(clearTimeout(this._timeout),this._container.innerHTML="",this._eventBus.fire("contextPad.close",{current:this._current}),this._current=null)},ct.prototype.isOpen=function(e){var t=this._current;if(!t)return!1;if(!e)return!0;var n=t.target;return pe(e)!==pe(n)?!1:pe(e)?e.length===n.length&&tr(e,function(i){return n.includes(i)}):n===e},ct.prototype.isShown=function(){return this.isOpen()&&Ye(this._current.html).has("open")},ct.prototype.show=function(){this.isOpen()&&(Ye(this._current.html).add("open"),this._updatePosition(),this._eventBus.fire("contextPad.show",{current:this._current}))},ct.prototype.hide=function(){this.isOpen()&&(Ye(this._current.html).remove("open"),this._eventBus.fire("contextPad.hide",{current:this._current}))},ct.prototype._getPosition=function(e){if(!pe(e)&&$e(e)){var t=this._canvas.viewbox(),n=WA(e),i=n.x*t.scale-t.x*t.scale,r=n.y*t.scale-t.y*t.scale;return{left:i+Ov*this._canvas.zoom(),top:r}}var o=this._canvas.getContainer(),a=o.getBoundingClientRect(),s=this._getTargetBounds(e);return{left:s.right-a.left+Ov*this._canvas.zoom(),top:s.top-a.top}},ct.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")},ct.prototype._updateVisibility=function(){const e=()=>{if(this.isOpen()){var t=this,n=this._current.target,i=pe(n)?n:[n],r=i.some(function(o){return t._canvas.hasMarker(o,HA)});r?t.hide():t.show()}};this._scheduler.schedule(e,"ContextPad#_updateVisibility")},ct.prototype._getTargetBounds=function(e){var t=this,n=pe(e)?e:[e],i=n.map(function(r){return t._canvas.getGraphics(r)});return i.reduce(function(r,o){const a=o.getBoundingClientRect();return r.top=Math.min(r.top,a.top),r.right=Math.max(r.right,a.right),r.bottom=Math.max(r.bottom,a.bottom),r.left=Math.min(r.left,a.left),r.x=r.left,r.y=r.top,r.width=r.right-r.left,r.height=r.bottom-r.top,r},{top:1/0,right:-1/0,bottom:-1/0,left:1/0})};function GA(e,t){var n=Ye(e);t=pe(t)?t:t.split(/\s+/g),t.forEach(function(i){n.add(i)})}function WA(e){return e.waypoints[e.waypoints.length-1]}function UA(e,t){return e=pe(e)?e:[e],t=pe(t)?t:[t],e.length===t.length&&tr(e,function(n){return t.includes(n)})}const Iv={__depends__:[Ss,FA,Xs],contextPad:["type",ct]};var ec,Ze,Lv,qi,Bv,Nv,$v,vp,tc,oa,jv,yp,_p,bp,nc={},ic=[],qA=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,rc=Array.isArray;function fi(e,t){for(var n in t)e[n]=t[n];return e}function xp(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function Fv(e,t,n){var i,r,o,a={};for(o in t)o=="key"?i=t[o]:o=="ref"?r=t[o]:a[o]=t[o];if(arguments.length>2&&(a.children=arguments.length>3?ec.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 oc(e,a,i,r,null)}function oc(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??++Lv,__i:-1,__u:0};return r==null&&Ze.vnode!=null&&Ze.vnode(o),o}function ac(e){return e.children}function sc(e,t){this.props=e,this.context=t}function xr(e,t){if(t==null)return e.__?xr(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"?xr(e):null}function YA(e){if(e.__P&&e.__d){var t=e.__v,n=t.__e,i=[],r=[],o=fi({},t);o.__v=t.__v+1,Ze.vnode&&Ze.vnode(o),Ep(e.__P,o,t,e.__n,e.__P.namespaceURI,32&t.__u?[n]:null,i,n??xr(t),!!(32&t.__u),r),o.__v=t.__v,o.__.__k[o.__i]=o,Yv(i,o,r),t.__e=t.__=null,o.__e!=n&&Hv(o)}}function Hv(e){if((e=e.__)!=null&&e.__c!=null)return e.__e=e.__c.base=null,e.__k.some(function(t){if(t!=null&&t.__e!=null)return e.__e=e.__c.base=t.__e}),Hv(e)}function zv(e){(!e.__d&&(e.__d=!0)&&qi.push(e)&&!cc.__r++||Bv!=Ze.debounceRendering)&&((Bv=Ze.debounceRendering)||Nv)(cc)}function cc(){try{for(var e,t=1;qi.length;)qi.length>t&&qi.sort($v),e=qi.shift(),t=qi.length,YA(e)}finally{qi.length=cc.__r=0}}function Vv(e,t,n,i,r,o,a,s,c,u,l){var p,f,d,h,m,g,w=i&&i.__k||ic,E=t.length;for(c=KA(n,t,w,c,E),p=0;p<E;p++)(d=n.__k[p])!=null&&(f=d.__i!=-1&&w[d.__i]||nc,d.__i=p,g=Ep(e,d,f,r,o,a,s,c,u,l),h=d.__e,d.ref&&f.ref!=d.ref&&(f.ref&&wp(f.ref,null,d),l.push(d.ref,d.__c||h,d)),m==null&&h!=null&&(m=h),4&d.__u?(c=Gv(d,c,e),f.__e&&(f.__e=null)):typeof d.type=="function"&&g!==void 0?c=g:h&&(c=h.nextSibling),d.__u&=-7);return n.__e=m,c}function KA(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]=oc(null,a,null,null,null):rc(a)?a=e.__k[o]=oc(ac,{children:a},null,null,null):a.constructor===void 0&&a.__b>0?a=e.__k[o]=oc(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=XA(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=xr(s)),Xv(s,s));return i}function Gv(e,t,n){var i,r;if(typeof e.type=="function"){for(i=e.__k,r=0;i&&r<i.length;r++)i[r]&&(i[r].__=e,t=Gv(i[r],t,n));return t}e.__e!=t&&(t&&e.type&&!t.parentNode&&(t=xr(e)),t=n.insertBefore(e.__e,t||null));do t=t&&t.nextSibling;while(t!=null&&t.nodeType==8);return t}function XA(e,t,n,i){var r,o,a,s=e.key,c=e.type,u=t[n],l=u!=null&&(2&u.__u)==0;if(u===null&&s==null||l&&s==u.key&&c==u.type)return n;if(i>(l?1:0)){for(r=n-1,o=n+1;r>=0||o<t.length;)if((u=t[a=r>=0?r--:o++])!=null&&(2&u.__u)==0&&s==u.key&&c==u.type)return a}return-1}function Wv(e,t,n){t[0]=="-"?e.setProperty(t,n??""):e[t]=n==null?"":typeof n!="number"||qA.test(t)?n:n+"px"}function uc(e,t,n,i,r){var o,a;e:if(t=="style")if(typeof n=="string")e.style.cssText=n;else{if(typeof i=="string"&&(e.style.cssText=i=""),i)for(t in i)n&&t in n||Wv(e.style,t,"");if(n)for(t in n)i&&n[t]==i[t]||Wv(e.style,t,n[t])}else if(t[0]=="o"&&t[1]=="n")o=t!=(t=t.replace(jv,"$1")),a=t.toLowerCase(),t=a in e||t=="onFocusOut"||t=="onFocusIn"?a.slice(2):t.slice(2),e.l||(e.l={}),e.l[t+o]=n,n?i?n[oa]=i[oa]:(n[oa]=yp,e.addEventListener(t,o?bp:_p,o)):e.removeEventListener(t,o?bp:_p,o);else{if(r=="http://www.w3.org/2000/svg")t=t.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(t!="width"&&t!="height"&&t!="href"&&t!="list"&&t!="form"&&t!="tabIndex"&&t!="download"&&t!="rowSpan"&&t!="colSpan"&&t!="role"&&t!="popover"&&t in e)try{e[t]=n??"";break e}catch{}typeof n=="function"||(n==null||n===!1&&t[4]!="-"?e.removeAttribute(t):e.setAttribute(t,t=="popover"&&n==1?"":n))}}function Uv(e){return function(t){if(this.l){var n=this.l[t.type+e];if(t[tc]==null)t[tc]=yp++;else if(t[tc]<n[oa])return;return n(Ze.event?Ze.event(t):t)}}}function Ep(e,t,n,i,r,o,a,s,c,u){var l,p,f,d,h,m,g,w,E,b,x,S,A,I,C,$,j=t.type;if(t.constructor!==void 0)return null;128&n.__u&&(c=!!(32&n.__u),o=[s=t.__e=n.__e]),(l=Ze.__b)&&l(t);e:if(typeof j=="function"){p=a.length;try{if(E=t.props,b=j.prototype&&j.prototype.render,x=(l=j.contextType)&&i[l.__c],S=l?x?x.props.value:l.__:i,n.__c?w=(f=t.__c=n.__c).__=f.__E:(b?t.__c=f=new j(E,S):(t.__c=f=new sc(E,S),f.constructor=j,f.render=QA),x&&x.sub(f),f.state||(f.state={}),f.__n=i,d=f.__d=!0,f.__h=[],f._sb=[]),b&&f.__s==null&&(f.__s=f.state),b&&j.getDerivedStateFromProps!=null&&(f.__s==f.state&&(f.__s=fi({},f.__s)),fi(f.__s,j.getDerivedStateFromProps(E,f.__s))),h=f.props,m=f.state,f.__v=t,d)b&&j.getDerivedStateFromProps==null&&f.componentWillMount!=null&&f.componentWillMount(),b&&f.componentDidMount!=null&&f.__h.push(f.componentDidMount);else{if(b&&j.getDerivedStateFromProps==null&&E!==h&&f.componentWillReceiveProps!=null&&f.componentWillReceiveProps(E,S),t.__v==n.__v||!f.__e&&f.shouldComponentUpdate!=null&&f.shouldComponentUpdate(E,f.__s,S)===!1){t.__v!=n.__v&&(f.props=E,f.state=f.__s,f.__d=!1),t.__e=n.__e,t.__k=n.__k,t.__k.some(function(L){L&&(L.__=t)}),ic.push.apply(f.__h,f._sb),f._sb=[],f.__h.length&&a.push(f),s=xr(n);break e}f.componentWillUpdate!=null&&f.componentWillUpdate(E,f.__s,S),b&&f.componentDidUpdate!=null&&f.__h.push(function(){f.componentDidUpdate(h,m,g)})}if(f.context=S,f.props=E,f.__P=e,f.__e=!1,A=Ze.__r,I=0,b)f.state=f.__s,f.__d=!1,A&&A(t),l=f.render(f.props,f.state,f.context),ic.push.apply(f.__h,f._sb),f._sb=[];else do f.__d=!1,A&&A(t),l=f.render(f.props,f.state,f.context),f.state=f.__s;while(f.__d&&++I<25);f.state=f.__s,f.getChildContext!=null&&(i=fi(fi({},i),f.getChildContext())),b&&!d&&f.getSnapshotBeforeUpdate!=null&&(g=f.getSnapshotBeforeUpdate(h,m)),C=l!=null&&l.type===ac&&l.key==null?Kv(l.props.children):l,s=Vv(e,rc(C)?C:[C],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(L){if(a.length=p,t.__v=null,c||o!=null){if(L.then){for(t.__u|=c?160:128;s&&s.nodeType==8&&s.nextSibling;)s=s.nextSibling;o!=null&&(o[o.indexOf(s)]=null),t.__e=s}else if(o!=null)for($=o.length;$--;)xp(o[$])}else t.__e=n.__e;t.__k==null&&(t.__k=n.__k||[]),L.then||qv(t),Ze.__e(L,t,n)}}else o==null&&t.__v==n.__v?(t.__k=n.__k,t.__e=n.__e):s=t.__e=ZA(n.__e,t,n,i,r,o,a,c,u);return(l=Ze.diffed)&&l(t),128&t.__u?void 0:s}function qv(e){e&&(e.__c&&(e.__c.__e=!0),e.__k&&e.__k.some(qv))}function Yv(e,t,n){for(var i=0;i<n.length;i++)wp(n[i],n[++i],n[++i]);Ze.__c&&Ze.__c(t,e),e.some(function(r){try{e=r.__h,r.__h=[],e.some(function(o){o.call(r)})}catch(o){Ze.__e(o,r.__v)}})}function Kv(e){return typeof e!="object"||e==null||e.__b>0?e:rc(e)?e.map(Kv):e.constructor!==void 0?null:fi({},e)}function ZA(e,t,n,i,r,o,a,s,c){var u,l,p,f,d,h,m,g=n.props||nc,w=t.props,E=t.type;if(E=="svg"?r="http://www.w3.org/2000/svg":E=="math"?r="http://www.w3.org/1998/Math/MathML":r||(r="http://www.w3.org/1999/xhtml"),o!=null){for(u=0;u<o.length;u++)if((d=o[u])&&"setAttribute"in d==!!E&&(E?d.localName==E:d.nodeType==3)){e=d,o[u]=null;break}}if(e==null){if(E==null)return document.createTextNode(w);e=document.createElementNS(r,E,w.is&&w),s&&(Ze.__m&&Ze.__m(t,o),s=!1),o=null}if(E==null)g===w||s&&e.data==w||(e.data=w);else{if(o=E=="textarea"&&w.defaultValue!=null?null:o&&ec.call(e.childNodes),!s&&o!=null)for(g={},u=0;u<e.attributes.length;u++)g[(d=e.attributes[u]).name]=d.value;for(u in g)d=g[u],u=="dangerouslySetInnerHTML"?p=d:u=="children"||u in w||u=="value"&&"defaultValue"in w||u=="checked"&&"defaultChecked"in w||uc(e,u,null,d,r);for(u in w)d=w[u],u=="children"?f=d:u=="dangerouslySetInnerHTML"?l=d:u=="value"?h=d:u=="checked"?m=d:s&&typeof d!="function"||g[u]===d||uc(e,u,d,g[u],r);if(l)s||p&&(l.__html==p.__html||l.__html==e.innerHTML)||(e.innerHTML=l.__html),t.__k=[];else if(p&&(e.innerHTML=""),Vv(t.type=="template"?e.content:e,rc(f)?f:[f],t,n,i,E=="foreignObject"?"http://www.w3.org/1999/xhtml":r,o,a,o?o[0]:n.__k&&xr(n,0),s,c),o!=null)for(u=o.length;u--;)xp(o[u]);s&&E!="textarea"||(u="value",E=="progress"&&h==null?e.removeAttribute("value"):h!=null&&(h!==e[u]||E=="progress"&&!h||E=="option"&&h!=g[u])&&uc(e,u,h,g[u],r),u="checked",m!=null&&m!=e[u]&&uc(e,u,m,g[u],r))}return e}function wp(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){Ze.__e(r,n)}}function Xv(e,t,n){var i,r;if(Ze.unmount&&Ze.unmount(e),(i=e.ref)&&(i.current&&i.current!=e.__e||wp(i,null,t)),(i=e.__c)!=null){if(i.componentWillUnmount)try{i.componentWillUnmount()}catch(o){Ze.__e(o,t)}i.base=i.__P=i.__n=null}if(i=e.__k)for(r=0;r<i.length;r++)i[r]&&Xv(i[r],t,n||typeof e.type!="function");n||xp(e.__e),e.__c=e.__=e.__e=void 0}function QA(e,t,n){return this.constructor(e,n)}function Zv(e,t,n){var i,r,o,a;t==document&&(t=document.documentElement),Ze.__&&Ze.__(e,t),r=(i=!1)?null:t.__k,o=[],a=[],Ep(t,e=t.__k=Fv(ac,null,[e]),r||nc,nc,t.namespaceURI,r?null:t.firstChild?ec.call(t.childNodes):null,o,r?r.__e:t.firstChild,i,a),Yv(o,e,a),e.props.children=null}ec=ic.slice,Ze={__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}},Lv=0,sc.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),zv(this))},sc.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),zv(this))},sc.prototype.render=ac,qi=[],Nv=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,$v=function(e,t){return e.__v.__b-t.__v.__b},cc.__r=0,vp=Math.random().toString(8),tc="__d"+vp,oa="__a"+vp,jv=/(PointerCapture)$|Capture$/i,yp=0,_p=Uv(!1),bp=Uv(!0);var Qv=function(e,t,n,i){var r;t[0]=0;for(var o=1;o<t.length;o++){var a=t[o++],s=t[o]?(t[0]|=a?1:2,n[t[o++]]):t[++o];a===3?i[0]=s:a===4?i[1]=Object.assign(i[1]||{},s):a===5?(i[1]=i[1]||{})[t[++o]]=s:a===6?i[1][t[++o]]+=s+"":a?(r=e.apply(s,Qv(e,s,n,["",null])),i.push(r),s[0]?t[0]|=2:(t[o-2]=0,t[o]=r)):i.push(s)}return i},Jv=new Map;function JA(e){var t=Jv.get(this);return t||(t=new Map,Jv.set(this,t)),(t=Qv(this,t.get(e)||(t.set(e,t=(function(n){for(var i,r,o=1,a="",s="",c=[0],u=function(f){o===1&&(f||(a=a.replace(/^\s*\n\s*|\s*\n\s*$/g,"")))?c.push(0,f,a):o===3&&(f||a)?(c.push(3,f,a),o=2):o===2&&a==="..."&&f?c.push(4,f,0):o===2&&a&&!f?c.push(5,0,!0,a):o>=5&&((a||!f&&o===5)&&(c.push(o,0,a,r),o=6),f&&(c.push(o,f,0,r),o=6)),a=""},l=0;l<n.length;l++){l&&(o===1&&u(),u(l));for(var p=0;p<n[l].length;p++)i=n[l][p],o===1?i==="<"?(u(),c=[c],o=3):a+=i:o===4?a==="--"&&i===">"?(o=1,a=""):a=i+a[0]:s?i===s?s="":a+=i:i==='"'||i==="'"?s=i:i===">"?(u(),o=1):o&&(i==="="?(o=5,r=a,a=""):i==="/"&&(o<5||n[l][p+1]===">")?(u(),o===3&&(c=c[0]),o=c,(c=c[0]).push(2,0,o),o=0):i===" "||i===" "||i===`
10
+ `||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 Fe=JA.bind(Fv),oo,ut,Sp,ey,aa=0,ty=[],_t=Ze,ny=_t.__b,iy=_t.__r,ry=_t.diffed,oy=_t.__c,ay=_t.unmount,sy=_t.__;function lc(e,t){_t.__h&&_t.__h(ut,e,aa||t),aa=0;var n=ut.__H||(ut.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({}),n.__[e]}function Rp(e){return aa=1,eT(uy,e)}function eT(e,t,n){var i=lc(oo++,2);if(i.t=e,!i.__c&&(i.__=[uy(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=ut,!ut.__f)){var r=function(s,c,u){if(!i.__c.__H)return!0;var l=!1,p=i.__c.props!==s;if(i.__c.__H.__.some(function(d){if(d.__N){l=!0;var h=d.__[0];d.__=d.__N,d.__N=void 0,h!==d.__[0]&&(p=!0)}}),o){var f=o.call(this,s,c,u);return l?f||p:f}return!l||p};ut.__f=!0;var o=ut.shouldComponentUpdate,a=ut.componentWillUpdate;ut.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)},ut.shouldComponentUpdate=r}return i.__N||i.__}function pc(e,t){var n=lc(oo++,3);!_t.__s&&Ap(n.__H,t)&&(n.__=e,n.u=t,ut.__H.__h.push(n))}function Cp(e,t){var n=lc(oo++,4);!_t.__s&&Ap(n.__H,t)&&(n.__=e,n.u=t,ut.__h.push(n))}function fc(e){return aa=5,di(function(){return{current:e}},[])}function di(e,t){var n=lc(oo++,7);return Ap(n.__H,t)&&(n.__=e(),n.__H=t,n.__h=e),n.__}function sa(e,t){return aa=8,di(function(){return e},t)}function tT(){for(var e;e=ty.shift();){var t=e.__H;if(e.__P&&t)try{t.__h.some(dc),t.__h.some(Pp),t.__h=[]}catch(n){t.__h=[],_t.__e(n,e.__v)}}}_t.__b=function(e){ut=null,ny&&ny(e)},_t.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),sy&&sy(e,t)},_t.__r=function(e){iy&&iy(e),oo=0;var t=(ut=e.__c).__H;t&&(Sp===ut?(t.__h=[],ut.__h=[],t.__.some(function(n){n.__N&&(n.__=n.__N),n.u=n.__N=void 0})):(t.__h.some(dc),t.__h.some(Pp),t.__h=[],oo=0)),Sp=ut},_t.diffed=function(e){ry&&ry(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(ty.push(t)!==1&&ey===_t.requestAnimationFrame||((ey=_t.requestAnimationFrame)||nT)(tT)),t.__H.__.some(function(n){n.u&&(n.__H=n.u,n.u=void 0)})),Sp=ut=null},_t.__c=function(e,t){t.some(function(n){try{n.__h.some(dc),n.__h=n.__h.filter(function(i){return!i.__||Pp(i)})}catch(i){t.some(function(r){r.__h&&(r.__h=[])}),t=[],_t.__e(i,n.__v)}}),oy&&oy(e,t)},_t.unmount=function(e){ay&&ay(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.some(function(i){try{dc(i)}catch(r){t=r}}),n.__H=void 0,t&&_t.__e(t,n.__v))};var cy=typeof requestAnimationFrame=="function";function nT(e){var t,n=function(){clearTimeout(i),cy&&cancelAnimationFrame(t),setTimeout(e)},i=setTimeout(n,35);cy&&(t=requestAnimationFrame(n))}function dc(e){var t=ut,n=e.__c;typeof n=="function"&&(e.__c=void 0,n()),ut=t}function Pp(e){var t=ut;e.__c=e.__(),ut=t}function Ap(e,t){return!e||e.length!==t.length||t.some(function(n,i){return n!==e[i]})}function uy(e,t){return typeof t=="function"?t(e):t}function iT(e){const{navigationStack:t,setNavigationStack:n}=e,i=di(()=>t.length<=1?[]:t.slice(0,-1).map((a,s)=>({label:a.label,onClick:()=>n(c=>c.slice(0,s+1))})),[t,n]),r=t.length>0?()=>n([]):null,o=t.length>0?t[t.length-1].label:null;return Fe`
11
11
  <div class="djs-popup-breadcrumbs">
12
- ${r&&Oe`
12
+ ${r&&Fe`
13
13
  <button
14
14
  type="button"
15
15
  class="djs-popup-breadcrumbs-item djs-popup-breadcrumbs-item--back"
@@ -22,7 +22,7 @@
22
22
  </svg>
23
23
  </button>
24
24
  `}
25
- ${i.map((a,s)=>Oe`
25
+ ${i.map((a,s)=>Fe`
26
26
  <button
27
27
  key=${s}
28
28
  type="button"
@@ -34,22 +34,22 @@
34
34
  </button>
35
35
  <span class="djs-popup-breadcrumbs-item--separator" aria-hidden="true"></span>
36
36
  `)}
37
- ${o&&Oe`
37
+ ${o&&Fe`
38
38
  <span class="djs-popup-breadcrumbs-item djs-popup-breadcrumbs-item--current" title=${o}>
39
39
  ${o}
40
40
  </span>
41
41
  `}
42
42
  </div>
43
- `}function _v(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=_v(e[t]))&&(i&&(i+=" "),i+=n)}else for(n in e)e[n]&&(i&&(i+=" "),i+=n);return i}function js(){for(var e,t,n=0,i="",r=arguments.length;n<r;n++)(e=arguments[n])&&(t=_v(e))&&(i&&(i+=" "),i+=t);return i}function nA(e){const{headerEntries:t,onSelect:n,selectedEntry:i,setSelectedEntry:r,title:o}=e,a=Wn(()=>iA(t),[t]),s=u=>u.action&&!u.disabled,c=(u,l)=>{if(s(l))return n(u,l)};return Oe`
43
+ `}function ly(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=ly(e[t]))&&(i&&(i+=" "),i+=n)}else for(n in e)e[n]&&(i&&(i+=" "),i+=n);return i}function hc(){for(var e,t,n=0,i="",r=arguments.length;n<r;n++)(e=arguments[n])&&(t=ly(e))&&(i&&(i+=" "),i+=t);return i}function rT(e){const{headerEntries:t,onSelect:n,selectedEntry:i,setSelectedEntry:r,title:o}=e,a=di(()=>oT(t),[t]),s=u=>u.action&&!u.disabled,c=(u,l)=>{if(s(l))return n(u,l)};return Fe`
44
44
  <div class="djs-popup-header">
45
45
  <h3 class="djs-popup-title" title=${o}>${o}</h3>
46
- ${a.map(u=>Oe`
46
+ ${a.map(u=>Fe`
47
47
  <ul key=${u.id} class="djs-popup-header-group" data-header-group=${u.id}>
48
48
 
49
- ${u.entries.map(l=>Oe`
49
+ ${u.entries.map(l=>Fe`
50
50
  <li key=${l.id}>
51
51
  <${s(l)?"button":"span"}
52
- class=${rA(l,l===i)}
52
+ class=${aT(l,l===i)}
53
53
  onClick=${p=>c(p,l)}
54
54
  title=${l.title||l.label}
55
55
  data-id=${l.id}
@@ -59,8 +59,8 @@
59
59
  onFocus=${()=>s(l)&&r(l)}
60
60
  onBlur=${()=>s(l)&&r(null)}
61
61
  >
62
- ${l.imageUrl&&Oe`<img class="djs-popup-entry-icon" src=${l.imageUrl} alt="" />`||l.imageHtml&&Oe`<div class="djs-popup-entry-icon" dangerouslySetInnerHTML=${{__html:l.imageHtml}} />`}
63
- ${l.label?Oe`
62
+ ${l.imageUrl&&Fe`<img class="djs-popup-entry-icon" src=${l.imageUrl} alt="" />`||l.imageHtml&&Fe`<div class="djs-popup-entry-icon" dangerouslySetInnerHTML=${{__html:l.imageHtml}} />`}
63
+ ${l.label?Fe`
64
64
  <span class="djs-popup-label">${l.label}</span>
65
65
  `:null}
66
66
  </${l.action?"button":"span"}>
@@ -69,11 +69,11 @@
69
69
  </ul>
70
70
  `)}
71
71
  </div>
72
- `}function iA(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 rA(e,t){return js("entry",e.className,e.active?"active":"",e.disabled?"disabled":"",t?"selected":"")}function bv(e,t){return`${e}-entry-${t.id}`}function oA(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 Oe`
72
+ `}function oT(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 aT(e,t){return hc("entry",e.className,e.active?"active":"",e.disabled?"disabled":"",t?"selected":"")}function py(e,t){return`${e}-entry-${t.id}`}function sT(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 Fe`
73
73
  <li
74
- class=${js("entry",{selected:i,disabled:n.disabled})}
74
+ class=${hc("entry",{selected:i,disabled:n.disabled})}
75
75
  data-id=${n.id}
76
- id=${bv(t,n)}
76
+ id=${py(t,n)}
77
77
  role="option"
78
78
  aria-selected=${i||void 0}
79
79
  aria-haspopup=${n.entries?"true":void 0}
@@ -87,17 +87,17 @@
87
87
  >
88
88
  <div class="djs-popup-entry-content">
89
89
  <span
90
- class=${js("djs-popup-entry-name",n.className)}
90
+ class=${hc("djs-popup-entry-name",n.className)}
91
91
  >
92
- ${n.imageUrl&&Oe`<img class="djs-popup-entry-icon" src=${n.imageUrl} alt="" />`||n.imageHtml&&Oe`<div class="djs-popup-entry-icon" dangerouslySetInnerHTML=${{__html:n.imageHtml}} />`}
92
+ ${n.imageUrl&&Fe`<img class="djs-popup-entry-icon" src=${n.imageUrl} alt="" />`||n.imageHtml&&Fe`<div class="djs-popup-entry-icon" dangerouslySetInnerHTML=${{__html:n.imageHtml}} />`}
93
93
 
94
- ${n.label?Oe`
94
+ ${n.label?Fe`
95
95
  <span class="djs-popup-label">
96
96
  ${n.label}
97
97
  </span>
98
98
  `:null}
99
99
 
100
- ${n.documentationRef&&Oe`
100
+ ${n.documentationRef&&Fe`
101
101
  <a
102
102
  class="djs-popup-entry-docs"
103
103
  href=${n.documentationRef}
@@ -114,7 +114,7 @@
114
114
  </a>
115
115
  `}
116
116
  </span>
117
- ${n.description&&Oe`
117
+ ${n.description&&Fe`
118
118
  <span
119
119
  class="djs-popup-entry-description"
120
120
  >
@@ -122,7 +122,7 @@
122
122
  </span>
123
123
  `}
124
124
  </div>
125
- ${n.entries&&Oe`
125
+ ${n.entries&&Fe`
126
126
  <div class="djs-popup-entry-chevron" aria-hidden="true">
127
127
  <svg width="12" height="12" viewBox="0 0 12 12" fill="none" xmlns="http://www.w3.org/2000/svg">
128
128
  <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"/>
@@ -130,7 +130,7 @@
130
130
  </div>
131
131
  `}
132
132
  </li>
133
- `}function aA(e){const{selectedEntry:t,setSelectedEntry:n,groupedEntries:i,keyboardSelection:r,idPrefix:o,id:a,ariaLabel:s,tabIndex:c,ariaActivedescendant:u,...l}=e,p=Ns();Ul(()=>{if(!r||!r.current)return;const g=p.current;if(!g)return;const y=g.querySelector(".selected");y&&sA(y)},[t]);const f=()=>{r.current=!1},d=g=>{r.current||n(g)},h=()=>{r.current||n(null)};return Oe`
133
+ `}function cT(e){const{selectedEntry:t,setSelectedEntry:n,groupedEntries:i,keyboardSelection:r,idPrefix:o,id:a,ariaLabel:s,tabIndex:c,ariaActivedescendant:u,...l}=e,p=fc();Cp(()=>{if(!r||!r.current)return;const m=p.current;if(!m)return;const g=m.querySelector(".selected");g&&uT(g)},[t]);const f=()=>{r.current=!1},d=m=>{r.current||n(m)},h=()=>{r.current||n(null)};return Fe`
134
134
  <div
135
135
  class="djs-popup-results"
136
136
  ref=${p}
@@ -141,25 +141,25 @@
141
141
  aria-activedescendant=${u}
142
142
  onMouseMove=${f}
143
143
  >
144
- ${i.map(g=>Oe`
145
- ${g.name&&Oe`
146
- <div key=${g.id} id=${Ev(o,g)} class="entry-header" title=${g.name}>
147
- ${g.name}
144
+ ${i.map(m=>Fe`
145
+ ${m.name&&Fe`
146
+ <div key=${m.id} id=${fy(o,m)} class="entry-header" title=${m.name}>
147
+ ${m.name}
148
148
  </div>
149
149
  `}
150
150
  <ul
151
151
  class="djs-popup-group"
152
- data-group=${g.id}
152
+ data-group=${m.id}
153
153
  role="group"
154
- aria-labelledby=${g.name?Ev(o,g):void 0}
154
+ aria-labelledby=${m.name?fy(o,m):void 0}
155
155
  >
156
- ${g.entries.map(y=>Oe`
157
- <${oA}
158
- key=${y.id}
156
+ ${m.entries.map(g=>Fe`
157
+ <${sT}
158
+ key=${g.id}
159
159
  idPrefix=${o}
160
- entry=${y}
161
- selected=${y===t}
162
- onMouseEnter=${()=>d(y)}
160
+ entry=${g}
161
+ selected=${g===t}
162
+ onMouseEnter=${()=>d(g)}
163
163
  onMouseLeave=${h}
164
164
  ...${l}
165
165
  />
@@ -167,36 +167,36 @@
167
167
  </ul>
168
168
  `)}
169
169
  </div>
170
- `}function Ev(e,t){return`${e}-group-${t.id}`}function sA(e){typeof e.scrollIntoViewIfNeeded=="function"?e.scrollIntoViewIfNeeded():e.scrollIntoView({scrollMode:"if-needed",block:"nearest"})}const cA=new Er("djs-popup");function uA(e){const{onClose:t,onSelect:n,className:i,headerEntries:r,position:o,title:a,width:s,scale:c,search:u,emptyPlaceholder:l,searchFn:p,entries:f,onOpened:d,onClosed:h}=e,[g,y]=Wl([]);Bs(()=>{y([])},[f]);const[S,w]=Wl(""),E=S.trim().length>0,x=Wn(()=>fA(f),[f]),R=Wn(()=>it(u)?x.length>5:!1,[u,x]),M=Wn(()=>{const N=g.length?g[g.length-1].entries:f;return R?E?p(x.filter(({searchable:B})=>B!==!1),S,{keys:["label","search","description"]}).map(({item:B})=>B):N.filter(({rank:B=0})=>B>=0):N},[R,E,x,S,p,g,f]),O=Wn(()=>E?M.length?[{id:"default",entries:M}]:[]:dA(M),[M,E]),[P,j]=Wl(M[0]),$=Ns(null),I=Ns(!1),G=Wn(()=>cA.next(),[]),ie=`${G}-results`,Te=P&&bv(G,P);Bs(()=>{const N=$.current;N&&M.includes(N)?j(N):j(M[0]),$.current=null},[M]);const tt=ko(N=>{const B=pA(O);let ge=B.indexOf(P)+N;ge<0&&(ge=B.length-1),ge>=B.length&&(ge=0),I.current=!0,j(B[ge])},[O,P]),W=ko(N=>{N>0&&P&&P.entries&&(I.current=!0,y(B=>[...B,P])),N<0&&g.length>0&&(I.current=!0,$.current=g[g.length+N],y(B=>B.slice(0,N)))},[P,g]),J=ko((N,B,F)=>{if(!(!B||B.disabled))return B.entries?(N.preventDefault(),W(1)):n(N,B,F)},[n,W]),re=ko(N=>{if(N.key==="Enter"&&P){const B=N.target;return!!Di(B,"a, button",!0)||P.disabled?void 0:J(N,P)}if(N.key==="Backspace"){const B=N.target;if(!(Mc(B,"input")&&B.value!==""))return W(-1),N.preventDefault()}if(N.key==="ArrowUp")return tt(-1),N.preventDefault();if(N.key==="ArrowDown")return tt(1),N.preventDefault();if(N.key==="ArrowRight")return W(1),N.preventDefault();if(N.key==="ArrowLeft")return W(-1),N.preventDefault()},[P,tt,W,J]),Q=ko(N=>{Mc(N.target,"input")&&w(()=>N.target.value)},[w]);Bs(()=>(d(),()=>{h()}),[]);const ee=!E&&g.length>0,q=(a||r.length>0)&&!ee;return Oe`
171
- <${xv}
170
+ `}function fy(e,t){return`${e}-group-${t.id}`}function uT(e){typeof e.scrollIntoViewIfNeeded=="function"?e.scrollIntoViewIfNeeded():e.scrollIntoView({scrollMode:"if-needed",block:"nearest"})}const lT=new Zr("djs-popup");function pT(e){const{onClose:t,onSelect:n,className:i,headerEntries:r,position:o,title:a,width:s,scale:c,search:u,emptyPlaceholder:l,searchFn:p,entries:f,onOpened:d,onClosed:h}=e,[m,g]=Rp([]);pc(()=>{g([])},[f]);const[w,E]=Rp(""),b=w.trim().length>0,x=di(()=>hT(f),[f]),S=di(()=>mt(u)?x.length>5:!1,[u,x]),A=di(()=>{const B=m.length?m[m.length-1].entries:f;return S?b?p(x.filter(({searchable:N})=>N!==!1),w,{keys:["label","search","description"]}).map(({item:N})=>N):B.filter(({rank:N=0})=>N>=0):B},[S,b,x,w,p,m,f]),I=di(()=>b?A.length?[{id:"default",entries:A}]:[]:mT(A),[A,b]),[C,$]=Rp(A[0]),j=fc(null),L=fc(!1),F=di(()=>lT.next(),[]),re=`${F}-results`,Ae=C&&py(F,C);pc(()=>{const B=j.current;B&&A.includes(B)?$(B):$(A[0]),j.current=null},[A]);const Je=sa(B=>{const N=dT(I);let be=N.indexOf(C)+B;be<0&&(be=N.length-1),be>=N.length&&(be=0),L.current=!0,$(N[be])},[I,C]),q=sa(B=>{B>0&&C&&C.entries&&(L.current=!0,g(N=>[...N,C])),B<0&&m.length>0&&(L.current=!0,j.current=m[m.length+B],g(N=>N.slice(0,B)))},[C,m]),ae=sa((B,N,V)=>{if(!(!N||N.disabled))return N.entries?(B.preventDefault(),q(1)):n(B,N,V)},[n,q]),ue=sa(B=>{if(B.key==="Enter"&&C){const N=B.target;return!!cr(N,"a, button",!0)||C.disabled?void 0:ae(B,C)}if(B.key==="Backspace"){const N=B.target;if(!(lu(N,"input")&&N.value!==""))return q(-1),B.preventDefault()}if(B.key==="ArrowUp")return Je(-1),B.preventDefault();if(B.key==="ArrowDown")return Je(1),B.preventDefault();if(B.key==="ArrowRight")return q(1),B.preventDefault();if(B.key==="ArrowLeft")return q(-1),B.preventDefault()},[C,Je,q,ae]),oe=sa(B=>{lu(B.target,"input")&&E(()=>B.target.value)},[E]);pc(()=>(d(),()=>{h()}),[]);const ce=!b&&m.length>0,X=(a||r.length>0)&&!ce;return Fe`
171
+ <${dy}
172
172
  onClose=${t}
173
- onKeyup=${Q}
174
- onKeydown=${re}
173
+ onKeyup=${oe}
174
+ onKeydown=${ue}
175
175
  className=${i}
176
176
  position=${o}
177
177
  width=${s}
178
178
  scale=${c}
179
- navigationStack=${g}
179
+ navigationStack=${m}
180
180
  >
181
- ${q&&Oe`
182
- <${nA}
181
+ ${X&&Fe`
182
+ <${rT}
183
183
  headerEntries=${r}
184
184
  onSelect=${n}
185
- selectedEntry=${P}
186
- setSelectedEntry=${j}
185
+ selectedEntry=${C}
186
+ setSelectedEntry=${$}
187
187
  title=${a}
188
188
  />
189
189
  `}
190
- ${ee&&Oe`
191
- <${tA}
192
- navigationStack=${g}
193
- setNavigationStack=${y}
190
+ ${ce&&Fe`
191
+ <${iT}
192
+ navigationStack=${m}
193
+ setNavigationStack=${g}
194
194
  />
195
195
  `}
196
- ${f.length>0&&Oe`
196
+ ${f.length>0&&Fe`
197
197
  <div class="djs-popup-body">
198
198
 
199
- ${R&&Oe`
199
+ ${S&&Fe`
200
200
  <div class="djs-popup-search">
201
201
  <svg class="djs-popup-search-icon" width="14" height="14" viewBox="0 0 14 14" fill="none" xmlns="http://www.w3.org/2000/svg">
202
202
  <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"/>
@@ -207,39 +207,39 @@
207
207
  role="combobox"
208
208
  aria-label="${a||"Search"}"
209
209
  aria-expanded="true"
210
- aria-controls=${ie}
211
- aria-activedescendant=${Te||void 0}
210
+ aria-controls=${re}
211
+ aria-activedescendant=${Ae||void 0}
212
212
  aria-autocomplete="list"
213
213
  />
214
214
  </div>
215
215
  `}
216
216
 
217
- ${E&&Oe`
217
+ ${b&&Fe`
218
218
  <div class="djs-popup-search-count" aria-live="polite">
219
- ${M.length} ${M.length===1?"result":"results"} found
219
+ ${A.length} ${A.length===1?"result":"results"} found
220
220
  </div>
221
221
  `}
222
222
 
223
- <${aA}
224
- groupedEntries=${O}
225
- selectedEntry=${P}
226
- setSelectedEntry=${j}
227
- keyboardSelection=${I}
228
- onAction=${J}
229
- idPrefix=${G}
230
- id=${ie}
223
+ <${cT}
224
+ groupedEntries=${I}
225
+ selectedEntry=${C}
226
+ setSelectedEntry=${$}
227
+ keyboardSelection=${L}
228
+ onAction=${ae}
229
+ idPrefix=${F}
230
+ id=${re}
231
231
  ariaLabel=${a||"Results"}
232
- tabIndex=${R?-1:0}
233
- ariaActivedescendant=${R?void 0:Te||void 0}
232
+ tabIndex=${S?-1:0}
233
+ ariaActivedescendant=${S?void 0:Ae||void 0}
234
234
  />
235
235
 
236
- ${P&&P.documentationRef&&Oe`
236
+ ${C&&C.documentationRef&&Fe`
237
237
  <div class="djs-popup-footer">
238
238
  <a
239
239
  class="djs-popup-footer-docs"
240
- href=${P.documentationRef}
241
- onClick=${N=>N.stopPropagation()}
242
- aria-label=${P.label?`Open entry documentation for ${P.label}`:"Open entry documentation"}
240
+ href=${C.documentationRef}
241
+ onClick=${B=>B.stopPropagation()}
242
+ aria-label=${C.label?`Open entry documentation for ${C.label}`:"Open entry documentation"}
243
243
  target="_blank"
244
244
  rel="noopener"
245
245
  >
@@ -253,14 +253,14 @@
253
253
  `}
254
254
  </div>
255
255
  `}
256
- ${l&&M.length===0&&Oe`
257
- <div class="djs-popup-no-results">${lt(l)?l(S):l}</div>
256
+ ${l&&A.length===0&&Fe`
257
+ <div class="djs-popup-no-results">${Et(l)?l(w):l}</div>
258
258
  `}
259
- </${xv}>
260
- `}function xv(e){const{onClose:t,onKeydown:n,onKeyup:i,className:r,children:o,navigationStack:a,position:s}=e,c=Ns();return Ul(()=>{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]),Ul(()=>{const u=c.current;if(!u)return;(u.querySelector("input")||u.querySelector('[role="listbox"]')||u).focus()},[a]),Bs(()=>{const u=p=>{if(p.key==="Escape")return p.preventDefault(),t()},l=p=>{if(!Di(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)}},[]),Oe`
259
+ </${dy}>
260
+ `}function dy(e){const{onClose:t,onKeydown:n,onKeyup:i,className:r,children:o,navigationStack:a,position:s}=e,c=fc();return Cp(()=>{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]),Cp(()=>{const u=c.current;if(!u)return;(u.querySelector("input")||u.querySelector('[role="listbox"]')||u).focus()},[a]),pc(()=>{const u=p=>{if(p.key==="Escape")return p.preventDefault(),t()},l=p=>{if(!cr(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)}},[]),Fe`
261
261
  <div
262
- class=${js("djs-popup",r)}
263
- style=${lA(e)}
262
+ class=${hc("djs-popup",r)}
263
+ style=${fT(e)}
264
264
  onKeydown=${n}
265
265
  onKeyup=${i}
266
266
  ref=${c}
@@ -268,8 +268,8 @@
268
268
  >
269
269
  ${o}
270
270
  </div>
271
- `}function lA(e){const{width:t}=e,n=typeof t=="number"?`${t}px`:t;return{transform:`scale(${e.scale})`,width:it(t)?n:void 0,maxWidth:it(t)?"unset":void 0,"transform-origin":"top left"}}function pA(e){const t=[];return e.forEach(n=>{n.entries.forEach(i=>{t.push(i)})}),t}function fA(e){const t=[];function n(i){i.forEach(r=>{if(r.entries){n(r.entries);return}t.push(r)})}return n(e),t}function dA(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 hA="data-id",wv=["contextPad.close","canvas.viewbox.changing","commandStack.changed"],mA=1e3;function We(e,t,n,i){this._eventBus=t,this._canvas=n,this._search=i,this._current=null;var r=it(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()})}We.$inject=["config.popupMenu","eventBus","canvas","search"],We.prototype._render=function(){const{position:e,providerId:t,entries:n,headerEntries:i,emptyPlaceholder:r,options:o}=this._current,a=Sv(n),s=Object.entries(i).map(([f,d])=>({id:f,...d})),c=e&&(f=>this._ensureVisible(f,e)),u=this._updateScale(this._current.container);av(Oe`
272
- <${uA}
271
+ `}function fT(e){const{width:t}=e,n=typeof t=="number"?`${t}px`:t;return{transform:`scale(${e.scale})`,width:mt(t)?n:void 0,maxWidth:mt(t)?"unset":void 0,"transform-origin":"top left"}}function dT(e){const t=[];return e.forEach(n=>{n.entries.forEach(i=>{t.push(i)})}),t}function hT(e){const t=[];function n(i){i.forEach(r=>{if(r.entries){n(r.entries);return}t.push(r)})}return n(e),t}function mT(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 gT="data-id",hy=["contextPad.close","canvas.viewbox.changing","commandStack.changed"],vT=1e3;function Qe(e,t,n,i){this._eventBus=t,this._canvas=n,this._search=i,this._current=null;var r=mt(e&&e.scale)?e.scale:{min:1,max:1};this._config={scale:r},t.on("diagram.destroy",()=>{this.close()}),t.on("element.changed",o=>{const a=this.isOpen()&&this._current.target;o.element===a&&this.refresh()})}Qe.$inject=["config.popupMenu","eventBus","canvas","search"],Qe.prototype._render=function(){const{position:e,providerId:t,entries:n,headerEntries:i,emptyPlaceholder:r,options:o}=this._current,a=my(n),s=Object.entries(i).map(([f,d])=>({id:f,...d})),c=e&&(f=>this._ensureVisible(f,e)),u=this._updateScale(this._current.container);Zv(Fe`
272
+ <${pT}
273
273
  onClose=${f=>this.close(f)}
274
274
  onSelect=${(f,d,h)=>this.trigger(f,d,h)}
275
275
  position=${c}
@@ -283,7 +283,7 @@
283
283
  searchFn=${this._search}
284
284
  ...${{...o}}
285
285
  />
286
- `,this._current.container)},We.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()},We.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()},We.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)}},We.prototype.close=function(){this.isOpen()&&(this._emit("close"),this.reset(),this._canvas.restoreFocus(),this._current=null)},We.prototype.reset=function(){const e=this._current.container;av(null,e),_n(e)},We.prototype._emit=function(e,t){this._eventBus.fire(`popupMenu.${e}`,t)},We.prototype._onOpened=function(){this._emit("opened")},We.prototype._onClosed=function(){this._emit("closed")},We.prototype._createContainer=function(e){var t=this._canvas,n=t.getContainer();const i=Ne(`<div class="djs-popup-parent djs-scrollable" data-popup=${e.provider}></div>`);return n.appendChild(i),i},We.prototype._bindAutoClose=function(){this._eventBus.once(wv,this.close,this)},We.prototype._unbindAutoClose=function(){this._eventBus.off(wv,this.close,this)},We.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),it(n)&&e<n&&(r=n),it(i)&&e>i&&(r=i)),r},We.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}},We.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},We.prototype.registerProvider=function(e,t,n){n||(n=t,t=mA),this._eventBus.on("popupMenu.getProviders."+e,t,function(i){i.providers.push(n)})},We.prototype._getProviders=function(e){var t=this._eventBus.createEvent({type:"popupMenu.getProviders."+e,providers:[]});return this._eventBus.fire(t),t.providers},We.prototype._getEntries=function(e,t){var n={};return A(t,function(i){if(!i.getPopupMenuEntries){A(i.getEntries(e),function(o){var a=o.id;if(!a)throw new Error("entry ID is missing");n[a]=hn(o,["id"])});return}var r=i.getPopupMenuEntries(e);lt(r)?n=r(n):A(r,function(o,a){n[a]=o})}),n},We.prototype._getHeaderEntries=function(e,t){var n={};return A(t,function(i){if(!i.getPopupMenuHeaderEntries){if(!i.getHeaderEntries)return;A(i.getHeaderEntries(e),function(o){var a=o.id;if(!a)throw new Error("entry ID is missing");n[a]=hn(o,["id"])});return}var r=i.getPopupMenuHeaderEntries(e);lt(r)?n=r(n):A(r,function(o,a){n[a]=o})}),n},We.prototype._getEmptyPlaceholder=function(e){const t=e.find(n=>lt(n.getEmptyPlaceholder));return t&&t.getEmptyPlaceholder()},We.prototype.isOpen=function(){return!!this._current},We.prototype.trigger=function(e,t,n="click"){if(e.preventDefault(),!t){let r=Di(e.delegateTarget||e.target,".entry",!0),o=Et(r,hA);t={id:o,...this._getEntry(o)}}const i=t.action;if(this._emit("trigger",{entry:t,event:e})!==!1){if(lt(i)){if(n==="click")return i(e,t)}else if(i[n])return i[n](e,t)}},We.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 Sv(e,t=[]){return Object.entries(e).map(([n,i])=>{const r={id:n,...i};return r.entries?r.entries=Sv(r.entries,[...t,...Rv(r.search)]):t.length&&(r.search=[...t,...Rv(r.search)]),r})}function Rv(e){return e?se(e)?e:[e]:[]}function gA(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=vA(o,r,i);return a?{item:o,tokens:a}:[]}).sort(yA(i))}function vA(e,t,n){const{matchedWords:i,tokens:r}=n.reduce((o,a)=>{const s=e[a],{tokens:c,matchedWords:u}=se(s)?s.reduce((l,p)=>{const{tokens:f,matchedWords:d}=Mv(p,t);return{tokens:[...l.tokens,f],matchedWords:{...l.matchedWords,...d}}},{matchedWords:{},tokens:[]}):Mv(s,t);return{tokens:{...o.tokens,[a]:c},matchedWords:{...o.matchedWords,...u}}},{matchedWords:{},tokens:{}});return Object.keys(i).length!==t.length?null:r}function yA(e){return(t,n)=>{let i=0,r=1;for(const o of e){const a=_A(t.tokens[o],n.tokens[o]);if(a!==0){i+=a*r,r*=Cv;continue}const s=bA(t.item[o],n.item[o]);if(s!==0){i+=s*r,r*=Cv;continue}}return i}}function _A(e,t){return Pv(t)-Pv(e)}const Cv=.5,Mr={FULL:131.9,START_FULL_WORD:8,START_WORD_PART:7.87,WORD_START:2.19,WORD_PART:1,NO_MATCH:-.07};function Pv(e){const t=e.reduce((s,c)=>s+Av(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 Av(e){if(se(e))return Math.max(...e.map(Av));const t=Math.log(e.value.length);return e.match?(e.start?e.end?Mr.FULL:e.wordEnd?Mr.START_FULL_WORD:Mr.START_WORD_PART:e.wordStart?Mr.WORD_START:Mr.WORD_PART)*t:Mr.NO_MATCH*t}function Tv(e=""){return se(e)?e.join(", "):e}function bA(e,t){return Tv(e).localeCompare(Tv(t))}function Mv(e,t){var u;if(!e)return{tokens:[],matchedWords:{}};const n=[],i={},r=t.map(EA),o=[`(?<all>${r.join("\\s+")})`,...r].join("|"),a=new RegExp(o,"ig");let s,c=0;for(;s=a.exec(e);){const[l]=s,p=s.index,f=s.index+l.length,d=p===0,h=f===e.length,g=!!((u=s.groups)!=null&&u.all),y=d||/\s/.test(e.charAt(p-1)),S=h||/\s/.test(e.charAt(f));s.index>c&&n.push({value:e.slice(c,s.index),index:c}),n.push({value:l,index:s.index,match:!0,wordStart:y,wordEnd:S,start:d,end:h,all:g});const w=g?t:[l];for(const E of w)i[E.toLowerCase()]=!0;c=s.index+l.length}return c<e.length&&n.push({value:e.slice(c),index:c}),{tokens:n,matchedWords:i}}function EA(e){return e.replace(/[/\-\\^$*+?.()|[\]{}]/g,"\\$&")}const kv={search:["value",gA]},Kl={__depends__:[kv],__init__:["popupMenu"],popupMenu:["type",We]};var Dv={align:`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 2000 2000">
286
+ `,this._current.container)},Qe.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()},Qe.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()},Qe.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)}},Qe.prototype.close=function(){this.isOpen()&&(this._emit("close"),this.reset(),this._canvas.restoreFocus(),this._current=null)},Qe.prototype.reset=function(){const e=this._current.container;Zv(null,e),Fn(e)},Qe.prototype._emit=function(e,t){this._eventBus.fire(`popupMenu.${e}`,t)},Qe.prototype._onOpened=function(){this._emit("opened")},Qe.prototype._onClosed=function(){this._emit("closed")},Qe.prototype._createContainer=function(e){var t=this._canvas,n=t.getContainer();const i=Ge(`<div class="djs-popup-parent djs-scrollable" data-popup=${e.provider}></div>`);return n.appendChild(i),i},Qe.prototype._bindAutoClose=function(){this._eventBus.once(hy,this.close,this)},Qe.prototype._unbindAutoClose=function(){this._eventBus.off(hy,this.close,this)},Qe.prototype._updateScale=function(){var e=this._canvas.zoom(),t=this._config.scale,n,i,r=e;return t!==!0&&(t===!1?(n=1,i=1):(n=t.min,i=t.max),mt(n)&&e<n&&(r=n),mt(i)&&e>i&&(r=i)),r},Qe.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}},Qe.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},Qe.prototype.registerProvider=function(e,t,n){n||(n=t,t=vT),this._eventBus.on("popupMenu.getProviders."+e,t,function(i){i.providers.push(n)})},Qe.prototype._getProviders=function(e){var t=this._eventBus.createEvent({type:"popupMenu.getProviders."+e,providers:[]});return this._eventBus.fire(t),t.providers},Qe.prototype._getEntries=function(e,t){var n={};return T(t,function(i){if(!i.getPopupMenuEntries){T(i.getEntries(e),function(o){var a=o.id;if(!a)throw new Error("entry ID is missing");n[a]=Ln(o,["id"])});return}var r=i.getPopupMenuEntries(e);Et(r)?n=r(n):T(r,function(o,a){n[a]=o})}),n},Qe.prototype._getHeaderEntries=function(e,t){var n={};return T(t,function(i){if(!i.getPopupMenuHeaderEntries){if(!i.getHeaderEntries)return;T(i.getHeaderEntries(e),function(o){var a=o.id;if(!a)throw new Error("entry ID is missing");n[a]=Ln(o,["id"])});return}var r=i.getPopupMenuHeaderEntries(e);Et(r)?n=r(n):T(r,function(o,a){n[a]=o})}),n},Qe.prototype._getEmptyPlaceholder=function(e){const t=e.find(n=>Et(n.getEmptyPlaceholder));return t&&t.getEmptyPlaceholder()},Qe.prototype.isOpen=function(){return!!this._current},Qe.prototype.trigger=function(e,t,n="click"){if(e.preventDefault(),!t){let r=cr(e.delegateTarget||e.target,".entry",!0),o=Nt(r,gT);t={id:o,...this._getEntry(o)}}const i=t.action;if(this._emit("trigger",{entry:t,event:e})!==!1){if(Et(i)){if(n==="click")return i(e,t)}else if(i[n])return i[n](e,t)}},Qe.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 my(e,t=[]){return Object.entries(e).map(([n,i])=>{const r={id:n,...i};return r.entries?r.entries=my(r.entries,[...t,...gy(r.search)]):t.length&&(r.search=[...t,...gy(r.search)]),r})}function gy(e){return e?pe(e)?e:[e]:[]}function yT(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=_T(o,r,i);return a?{item:o,tokens:a}:[]}).sort(bT(i))}function _T(e,t,n){const{matchedWords:i,tokens:r}=n.reduce((o,a)=>{const s=e[a],{tokens:c,matchedWords:u}=pe(s)?s.reduce((l,p)=>{const{tokens:f,matchedWords:d}=xy(p,t);return{tokens:[...l.tokens,f],matchedWords:{...l.matchedWords,...d}}},{matchedWords:{},tokens:[]}):xy(s,t);return{tokens:{...o.tokens,[a]:c},matchedWords:{...o.matchedWords,...u}}},{matchedWords:{},tokens:{}});return Object.keys(i).length!==t.length?null:r}function bT(e){return(t,n)=>{let i=0,r=1;for(const o of e){const a=xT(t.tokens[o],n.tokens[o]);if(a!==0){i+=a*r,r*=vy;continue}const s=ET(t.item[o],n.item[o]);if(s!==0){i+=s*r,r*=vy;continue}}return i}}function xT(e,t){return yy(t)-yy(e)}const vy=.5,ao={FULL:131.9,START_FULL_WORD:8,START_WORD_PART:7.87,WORD_START:2.19,WORD_PART:1,NO_MATCH:-.07};function yy(e){const t=e.reduce((s,c)=>s+_y(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 _y(e){if(pe(e))return Math.max(...e.map(_y));const t=Math.log(e.value.length);return e.match?(e.start?e.end?ao.FULL:e.wordEnd?ao.START_FULL_WORD:ao.START_WORD_PART:e.wordStart?ao.WORD_START:ao.WORD_PART)*t:ao.NO_MATCH*t}function by(e=""){return pe(e)?e.join(", "):e}function ET(e,t){return by(e).localeCompare(by(t))}function xy(e,t){var u;if(!e)return{tokens:[],matchedWords:{}};const n=[],i={},r=t.map(wT),o=[`(?<all>${r.join("\\s+")})`,...r].join("|"),a=new RegExp(o,"ig");let s,c=0;for(;s=a.exec(e);){const[l]=s,p=s.index,f=s.index+l.length,d=p===0,h=f===e.length,m=!!((u=s.groups)!=null&&u.all),g=d||/\s/.test(e.charAt(p-1)),w=h||/\s/.test(e.charAt(f));s.index>c&&n.push({value:e.slice(c,s.index),index:c}),n.push({value:l,index:s.index,match:!0,wordStart:g,wordEnd:w,start:d,end:h,all:m});const E=m?t:[l];for(const b of E)i[b.toLowerCase()]=!0;c=s.index+l.length}return c<e.length&&n.push({value:e.slice(c),index:c}),{tokens:n,matchedWords:i}}function wT(e){return e.replace(/[/\-\\^$*+?.()|[\]{}]/g,"\\$&")}const Ey={search:["value",yT]},Tp={__depends__:[Ey],__init__:["popupMenu"],popupMenu:["type",Qe]};var wy={align:`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 2000 2000">
287
287
  <line x1="200" y1="150" x2="200" y2="1850" style="stroke:currentColor;stroke-width:100;stroke-linecap:round;"/>
288
288
  <rect x="500" y="150" width="1300" height="700" rx="1" style="fill:none;stroke:currentColor;stroke-width:100;"></rect>
289
289
  <rect x="500" y="1150" width="700" height="700" rx="1" style="fill:currentColor;stroke:currentColor;stroke-width:100;opacity:.5;"></rect>
@@ -311,8 +311,8 @@
311
311
  <line x1="150" y1="900" x2="1650" y2="900" style="stroke:currentColor;stroke-width:100;stroke-linecap:round;"/>
312
312
  <rect x="150" y="250" width="600" height="1300" rx="1" style="fill:none;stroke:currentColor;stroke-width:100;"></rect>
313
313
  <rect x="1050" y="500" width="600" height="800" rx="1" style="fill:currentColor;stroke:currentColor;stroke-width:100;opacity:.5;"></rect>
314
- </svg>`},xA=900;function kr(e,t,n,i){e.registerProvider(xA,this),this._contextPad=e,this._popupMenu=t,this._translate=n,this._canvas=i}kr.$inject=["contextPad","popupMenu","translate","canvas"],kr.prototype.getMultiElementContextPadEntries=function(e){var t={};return this._isAllowed(e)&&k(t,this._getEntries(e)),t},kr.prototype._isAllowed=function(e){return!this._popupMenu.isEmpty(e,"align-elements")},kr.prototype._getEntries=function(){var e=this;return{"align-elements":{group:"align-elements",title:e._translate("Align elements"),html:`<div class="entry">${Dv.align}</div>`,action:{click:function(t,n){var i=e._getMenuPosition(n);k(i,{cursor:{x:t.x,y:t.y}}),e._popupMenu.open(n,"align-elements",i)}}}}},kr.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 wA=["left","center","right","top","middle","bottom"];function Do(e,t,n,i){this._alignElements=t,this._translate=n,this._popupMenu=e,this._rules=i,e.registerProvider("align-elements",this)}Do.$inject=["popupMenu","alignElements","translate","rules"],Do.prototype.getPopupMenuEntries=function(e){var t={};return this._isAllowed(e)&&k(t,this._getEntries(e)),t},Do.prototype._isAllowed=function(e){return this._rules.allowed("elements.align",{elements:e})},Do.prototype._getEntries=function(e){var t=this._alignElements,n=this._translate,i=this._popupMenu,r={};return A(wA,function(o){r["align-elements-"+o]={group:"align",title:n("Align elements "+o),className:"bjs-align-elements-menu-entry",imageHtml:Dv[o],action:function(){t.trigger(e,o),i.close()}}}),r};function Fs(e){Jt.call(this,e)}Fs.$inject=["eventBus"],X(Fs,Jt),Fs.prototype.init=function(){this.addRule("elements.align",function(e){var t=e.elements,n=ye(t,function(i){return!(i.waypoints||i.host||i.labelTarget)});return n=ua(n),n.length<2?!1:n})};const SA={__depends__:[LP,Vg,Kl],__init__:["alignElementsContextPadProvider","alignElementsMenuProvider","bpmnAlignElements"],alignElementsContextPadProvider:["type",kr],alignElementsMenuProvider:["type",Do],bpmnAlignElements:["type",Fs]};function Un(e,t,n,i){z.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=lc(Qi(a.closure.topLevel)),c=a.hints,u=c?c.autoResize:!0;if(u!==!1){var l=Ji(s,function(p){return p.parent.id});A(l,function(p,f){se(u)&&(p=p.filter(function(d){return Le(u,er({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)})}Un.$inject=["eventBus","elementRegistry","modeling","rules"],X(Un,z),Un.prototype._getOptimalBounds=function(e,t){var n=this.getOffset(t),i=this.getPadding(t),r=ne(Ke(e)),o=ne(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),fa(k({},o,a))},Un.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(RA(i,t)){var r=CA(cn(t,["x","y","width","height"]),i);this.resize(t,i,{autoResize:r});var o=t.parent;o&&this._expand([t],o)}}},Un.prototype.getOffset=function(e){return{top:60,bottom:60,left:100,right:100}},Un.prototype.getPadding=function(e){return{top:2,bottom:2,left:15,right:15}},Un.prototype.resize=function(e,t,n){this._modeling.resizeShape(e,t,null,n)};function RA(e,t){return e.x!==t.x||e.y!==t.y||e.width!==t.width||e.height!==t.height}function CA(e,t){var n="";return e=ne(e),t=ne(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 Hs(e){e.invoke(Un,this)}Hs.$inject=["injector"],X(Hs,Un),Hs.prototype.resize=function(e,t,n){_(e,"bpmn:Participant")?this._modeling.resizeLane(e,t,null,n):this._modeling.resizeShape(e,t,null,n)};function Oo(e){Jt.call(this,e);var t=this;this.addRule("element.autoResize",function(n){return t.canResize(n.elements,n.target)})}Oo.$inject=["eventBus"],X(Oo,Jt),Oo.prototype.canResize=function(e,t){return!1};function zs(e,t){Oo.call(this,e),this._modeling=t}X(zs,Oo),zs.$inject=["eventBus","modeling"],zs.prototype.canResize=function(e,t){if(_(t.di,"bpmndi:BPMNPlane")||!_(t,"bpmn:Participant")&&!_(t,"bpmn:Lane")&&!_(t,"bpmn:SubProcess"))return!1;var n=!0;return A(e,function(i){if(_(i,"bpmn:Lane")||me(i)){n=!1;return}}),n};const PA={__init__:["bpmnAutoResize","bpmnAutoResizeProvider"],bpmnAutoResize:["type",Hs],bpmnAutoResizeProvider:["type",zs]};function Dr(e,t,n){this._canvas=n,this._opts=k({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()})}Dr.$inject=["config.autoScroll","eventBus","canvas"],Dr.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++)AA(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 AA(e,t,n){return t<e&&e<n}Dr.prototype.stopScroll=function(){clearTimeout(this._scrolling)},Dr.prototype.setOptions=function(e){this._opts=k({},this._opts,e)},Dr.prototype._toBorderPoint=function(e){var t=this._canvas._container.getBoundingClientRect(),n=$i(e.originalEvent);return{x:n.x-t.left,y:n.y-t.top}};const TA={__depends__:[Fn],__init__:["autoScroll"],autoScroll:["type",Dr]};var Ov="djs-bendpoint",Iv="djs-segment-dragger";function MA(e,t){var n=$i(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 Xl(e,t,n){var i=MA(e,n),r=hu(t,i);return r}function Zl(e,t){var n=te("g");xe(n).add(Ov),fe(e,n);var i=te("circle");Z(i,{cx:0,cy:0,r:4}),xe(i).add("djs-visual"),fe(n,i);var r=te("circle");return Z(r,{cx:0,cy:0,r:10}),xe(r).add("djs-hit"),fe(n,r),t&&xe(n).add(t),n}function kA(e,t,n,i){var r=te("g");fe(e,r);var o=18,a=6,s=11,c=OA(t,n,i),u=a+s,l=te("rect");Z(l,{x:-o/2,y:-a/2,width:o,height:a}),xe(l).add("djs-visual"),fe(r,l);var p=te("rect");return Z(p,{x:-c/2,y:-u/2,width:c,height:u}),xe(p).add("djs-hit"),fe(r,p),ad(r,i==="v"?90:0),r}function Lv(e,t,n){var i=te("g"),r=Vc(t,n),o=In(t,n);return fe(e,i),kA(i,t,n,o),xe(i).add(Iv),xe(i).add(o==="h"?"horizontal":"vertical"),mt(i,r.x,r.y),i}function Ql(e){return Math.abs(Math.round(e*2/3))}function DA(e,t){var n=IA(e,t);return bu(e,n)}function OA(e,t,n){var i=t.x-e.x,r=t.y-e.y;return Ql(n==="h"?i:r)}function IA(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=Ud(e,[a,s]);c<i&&(i=c,r=o)}return[n[r],n[r+1]]}function Bv(e,t,n,i,r){function o(E,x,R){var M=E.index,O=E.point,P,j,$,I,G,ie;return M<=0||E.bendpoint?!1:(P=x[M-1],j=x[M],$=Vc(P,j),I=In(P,j),G=Math.abs(O.x-$.x),ie=Math.abs(O.y-$.y),I&&G<=R&&ie<=R)}function a(E,x){var R=E.waypoints,M,O,P,j;return x.index<=0||x.bendpoint||(M={start:R[x.index-1],end:R[x.index]},O=In(M.start,M.end),!O)?null:(O==="h"?P=M.end.x-M.start.x:P=M.end.y-M.start.y,j=Ql(P)/2,j)}function s(E,x){var R=x.waypoints,M=Xl(t,R,E),O;if(M){O=a(x,M);var P;if(o(M,R,O)?P=r.start(E,x,M.index):P=i.start(E,x,M.index,!M.bendpoint),P!==!1)return!0}}function c(E,x,R){pe.bind(E,x,function(M){n.triggerMouseEvent(x,M,R),M.stopPropagation()})}function u(E,x){var R=t.getLayer("overlays"),M=Me('.djs-bendpoints[data-element-id="'+Po(E.id)+'"]',R);return!M&&x&&(M=te("g"),Z(M,{"data-element-id":E.id}),xe(M).add("djs-bendpoints"),fe(R,M),c(M,"mousedown",E),c(M,"click",E),c(M,"dblclick",E)),M}function l(E,x){return Me('.djs-segment-dragger[data-segment-idx="'+E+'"]',x)}function p(E,x){x.waypoints.forEach(function(R,M){var O=Zl(E);fe(E,O),mt(O,R.x,R.y)}),Zl(E,"floating")}function f(E,x){for(var R=x.waypoints,M,O,P,j=1;j<R.length;j++)M=R[j-1],O=R[j],In(M,O)&&(P=Lv(E,M,O),Z(P,{"data-segment-idx":j}),c(P,"mousemove",x))}function d(E){A(oa("."+Ov,E),function(x){ot(x)})}function h(E){A(oa("."+Iv,E),function(x){ot(x)})}function g(E){var x=u(E);return x||(x=u(E,!0),p(x,E),f(x,E)),x}function y(E){var x=u(E);x&&(h(x),d(x),f(x,E),p(x,E))}function S(E,x){var R=Me(".floating",E),M=x.point;R&&(mt(R,M.x,M.y),xe(R).add("positioned"))}function w(E,x,R){var M=l(x.index,E),O=R[x.index-1],P=R[x.index],j=x.point,$=Vc(O,P),I=In(O,P),G,ie;M&&(G=LA(M),ie={x:j.x-$.x,y:j.y-$.y},I==="v"&&(ie={x:ie.y,y:ie.x}),mt(G,ie.x,ie.y))}e.on("connection.changed",function(E){y(E.element)}),e.on("connection.remove",function(E){var x=u(E.element);x&&ot(x)}),e.on("element.marker.update",function(E){var x=E.element,R;x.waypoints&&(R=g(x),E.add?xe(R).add(E.marker):xe(R).remove(E.marker))}),e.on("element.mousemove",function(E){var x=E.element,R=x.waypoints,M,O;if(R){if(M=u(x,!0),O=Xl(t,R,E.originalEvent),!O)return;S(M,O),O.bendpoint||w(M,O,R)}}),e.on("element.mousedown",function(E){if(li(E)){var x=E.originalEvent,R=E.element;if(R.waypoints)return s(x,R)}}),e.on("selection.changed",function(E){var x=E.newSelection,R=x[0];R&&R.waypoints&&g(R)}),e.on("element.hover",function(E){var x=E.element;x.waypoints&&g(x)}),e.on("element.out",function(E){var x=E.element;if(x.waypoints){var R=u(x);if(R){var M=Me(".floating",R);M&&xe(M).remove("positioned")}}}),e.on("element.updateId",function(E){var x=E.element,R=E.newId;if(x.waypoints){var M=u(x);M&&Z(M,{"data-element-id":R})}}),this.addHandles=g,this.updateHandles=y,this.getBendpointsContainer=u,this.getSegmentDragger=l}Bv.$inject=["eventBus","canvas","interactionEvents","bendpointMove","connectionSegmentMove"];function LA(e){return Me(".djs-visual",e)}var Nv=Math.round,Ui="reconnectStart",qi="reconnectEnd",Io="updateWaypoints";function Jl(e,t,n,i,r,o){this._injector=e,this.start=function(a,s,c,u){var l=n.getGraphics(s),p=s.source,f=s.target,d=s.waypoints,h;!u&&c===0?h=Ui:!u&&c===d.length-1?h=qi:h=Io;var g=h===Io?"connection.updateWaypoints":"connection.reconnect",y=r.allowed(g,{connection:s,source:p,target:f});if(y===!1&&(y=r.allowed(g,{connection:s,source:f,target:p})),y!==!1)return i.init(a,"bendpoint.move",{data:{connection:s,connectionGfx:l,context:{allowed:y,bendpointIndex:c,connection:s,source:p,target:f,insert:u,type:h}}})},t.on("bendpoint.move.hover",function(a){var s=a.context,c=s.connection,u=c.source,l=c.target,p=a.hover,f=s.type;s.hover=p;var d;if(p){var h=f===Io?"connection.updateWaypoints":"connection.reconnect";if(d=s.allowed=r.allowed(h,{connection:c,source:f===Ui?p:u,target:f===qi?p:l}),d){s.source=f===Ui?p:u,s.target=f===qi?p:l;return}d===!1&&(d=s.allowed=r.allowed(h,{connection:c,source:f===qi?p:l,target:f===Ui?p:u})),d&&(s.source=f===qi?p:l,s.target=f===Ui?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!==Io&&(s.allowed=!1)}),t.on("bendpoint.move.end",function(a){var s=a.context,c=s.allowed,u=s.bendpointIndex,l=s.connection,p=s.insert,f=l.waypoints.slice(),d=s.source,h=s.target,g=s.type,y=s.hints||{},S={x:Nv(a.x),y:Nv(a.y)};if(!c)return!1;g===Io?(p?f.splice(u,0,S):f[u]=S,y.bendpointMove={insert:p,bendpointIndex:u},f=this.cropWaypoints(l,f),o.updateWaypoints(l,UE(f),y)):(g===Ui?(y.docking="source",Vs(s)&&(y.docking="target",y.newWaypoints=f.reverse())):g===qi&&(y.docking="target",Vs(s)&&(y.docking="source",y.newWaypoints=f.reverse())),o.reconnect(l,d,h,S,y))},this)}Jl.$inject=["injector","eventBus","canvas","dragging","rules","modeling"],Jl.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 Vs(e){var t=e.hover,n=e.source,i=e.target,r=e.type;if(r===Ui)return t&&i&&t===i&&n!==i;if(r===qi)return t&&n&&t===n&&n!==i}var BA="reconnectStart",NA="reconnectEnd",$v="updateWaypoints",Lo="connect-ok",Gs="connect-not-ok",jv="connect-hover",Fv="djs-updating",Hv="djs-dragging",zv=1100;function Vv(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=Zl(i.getLayer("overlays"));xe(f).add("djs-dragging"),i.addMarker(c,Hv),i.addMarker(c,Fv)}),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,jv),u===$v)return;s?(i.removeMarker(c,Gs),i.addMarker(c,Lo)):s===!1&&(i.removeMarker(c,Lo),i.addMarker(c,Gs))}}),n.on(["bendpoint.move.out","bendpoint.move.cleanup"],zv,function(o){var a=o.context,s=a.hover,c=a.target;s&&(i.removeMarker(s,jv),i.removeMarker(s,c?Lo:Gs))}),n.on("bendpoint.move.move",function(o){var a=o.context,s=a.allowed,c=a.bendpointIndex,u=a.draggerGfx,l=a.hover,p=a.type,f=a.connection,d=f.source,h=f.target,g=f.waypoints.slice(),y={x:o.x,y:o.y},S=a.hints||{},w={};r&&(S.connectionStart&&(w.connectionStart=S.connectionStart),S.connectionEnd&&(w.connectionEnd=S.connectionEnd),p===BA?Vs(a)?(w.connectionEnd=w.connectionEnd||y,w.source=h,w.target=l||d,g=g.reverse()):(w.connectionStart=w.connectionStart||y,w.source=l||d,w.target=h):p===NA?Vs(a)?(w.connectionStart=w.connectionStart||y,w.source=l||h,w.target=d,g=g.reverse()):(w.connectionEnd=w.connectionEnd||y,w.source=d,w.target=l||h):(w.noCropping=!0,w.noLayout=!0,g[c]=y),p===$v&&(g=e.cropWaypoints(f,g)),w.waypoints=g,r.drawPreview(a,s,w)),mt(u,o.x,o.y)},this),n.on(["bendpoint.move.end","bendpoint.move.cancel"],zv,function(o){var a=o.context,s=a.connection,c=a.draggerGfx,u=a.hover,l=a.target,p=a.waypoints;s.waypoints=p,ot(c),i.removeMarker(s,Fv),i.removeMarker(s,Hv),u&&(i.removeMarker(u,Lo),i.removeMarker(u,l?Lo:Gs)),r&&r.cleanUp(a)})}Vv.$inject=["bendpointMove","injector","eventBus","canvas"];var Gv="connect-hover",Wv="djs-updating";function Uv(e,t,n){return ep(e,t,e[t]+n)}function ep(e,t,n){return{x:t==="x"?n:e.x,y:t==="y"?n:e.y}}function $A(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 ep(t,i,s)}function qv(e){return e==="x"?"y":"x"}function Yv(e,t,n){var i,r;return e.original?e.original:(i=ce(t),r=qv(n),ep(e,r,i[r]))}function Kv(e,t,n,i,r,o){var a=e.get("connectionDocking",!1);this.start=function(p,f,d){var h,g=n.getGraphics(f),y=d-1,S=d,w=f.waypoints,E=w[y],x=w[S],R=Xl(n,w,p),M,O,P;if(M=In(E,x),!!M)return O=M==="v"?"x":"y",y===0&&(E=Yv(E,f.source,O)),S===w.length-1&&(x=Yv(x,f.target,O)),R?P=R.point:P={x:(E.x+x.x)/2,y:(E.y+x.y)/2},h={connection:f,segmentStartIndex:y,segmentEndIndex:S,segmentStart:E,segmentEnd:x,axis:O,dragPosition:P},i.init(p,P,"connectionSegment.move",{cursor:O==="x"?"resize-ew":"resize-ns",data:{connection:f,connectionGfx:g,context:h}})};function s(p,f){if(!a)return f;var d=p.waypoints,h;return p.waypoints=f,h=a.getCroppedWaypoints(p),p.waypoints=d,h}function c(p){r.update("connection",p.connection,p.connectionGfx)}function u(p,f,d){var h=p.newWaypoints,g=p.segmentStartIndex+f,y=h[g],S=p.segmentEndIndex+f,w=h[S],E=qv(p.axis),x=$A(d,y,w,E);mt(p.draggerGfx,x.x,x.y)}function l(p,f){var d=0,h=p.filter(function(g,y){return zc(p[y-1],p[y+1],g)?(d=y<=f?d-1:d,!1):!0});return{waypoints:h,segmentOffset:d}}t.on("connectionSegment.move.start",function(p){var f=p.context,d=p.connection,h=n.getLayer("overlays");f.originalWaypoints=d.waypoints.slice(),f.draggerGfx=Lv(h,f.segmentStart,f.segmentEnd),xe(f.draggerGfx).add("djs-dragging"),n.addMarker(d,Wv)}),t.on("connectionSegment.move.move",function(p){var f=p.context,d=f.connection,h=f.segmentStartIndex,g=f.segmentEndIndex,y=f.segmentStart,S=f.segmentEnd,w=f.axis,E=f.originalWaypoints.slice(),x=Uv(y,w,p["d"+w]),R=Uv(S,w,p["d"+w]),M=E.length,O=0;E[h]=x,E[g]=R;var P,j;h<2&&(P=ht(d.source,x),h===1?P==="intersect"&&(E.shift(),E[0]=x,O--):P!=="intersect"&&(E.unshift(y),O++)),g>M-3&&(j=ht(d.target,R),g===M-2?j==="intersect"&&(E.pop(),E[E.length-1]=R):j!=="intersect"&&E.push(S)),f.newWaypoints=d.waypoints=s(d,E),u(f,O,p),f.newSegmentStartIndex=h+O,c(p)}),t.on("connectionSegment.move.hover",function(p){p.context.hover=p.hover,n.addMarker(p.hover,Gv)}),t.on(["connectionSegment.move.out","connectionSegment.move.cleanup"],function(p){var f=p.context.hover;f&&n.removeMarker(f,Gv)}),t.on("connectionSegment.move.cleanup",function(p){var f=p.context,d=f.connection;f.draggerGfx&&ot(f.draggerGfx),n.removeMarker(d,Wv)}),t.on(["connectionSegment.move.cancel","connectionSegment.move.end"],function(p){var f=p.context,d=f.connection;d.waypoints=f.originalWaypoints,c(p)}),t.on("connectionSegment.move.end",function(p){var f=p.context,d=f.connection,h=f.newWaypoints,g=f.newSegmentStartIndex;h=h.map(function(R){return{original:R.original,x:Math.round(R.x),y:Math.round(R.y)}});var y=l(h,g),S=y.waypoints,w=s(d,S),E=y.segmentOffset,x={segmentMove:{segmentStartIndex:f.segmentStartIndex,newSegmentStartIndex:g+E}};o.updateWaypoints(d,w,x)})}Kv.$inject=["injector","eventBus","canvas","dragging","graphicsFactory","modeling"];var jA=Math.abs,Xv=Math.round;function FA(e,t,n){n=n===void 0?10:n;var i,r;for(i=0;i<t.length;i++)if(r=t[i],jA(r-e)<=n)return r}function Zv(e){return{x:e.x,y:e.y}}function Qv(e){return{x:e.x+e.width,y:e.y+e.height}}function rn(e,t){return!e||isNaN(e.x)||isNaN(e.y)?t:{x:Xv(e.x+e.width/2),y:Xv(e.y+e.height/2)}}function Or(e,t){var n=e.snapped;return n?typeof t=="string"?n[t]:n.x&&n.y:!1}function Je(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 Jv(e){return e.children||[]}var HA=Math.abs,ey=Math.round,tp=10;function ty(e){function t(o,a){if(se(o)){for(var s=o.length;s--;)if(HA(o[s]-a)<=tp)return o[s]}else{o=+o;var c=a%o;if(c<tp)return a-c;if(c>o-tp)return a-c+o}return a}function n(o,a){if(o.waypoints)return DA(a,o);if(o.width)return{x:ey(o.width/2+o.x),y:ey(o.height/2+o.y)}}function i(o){var a=o.context,s=a.snapPoints,c=a.connection,u=c.waypoints,l=a.segmentStart,p=a.segmentStartIndex,f=a.segmentEnd,d=a.segmentEndIndex,h=a.axis;if(s)return s;var g=[u[p-1],l,f,u[d+1]];return p<2&&g.unshift(n(c.source,o)),d>u.length-3&&g.unshift(n(c.target,o)),a.snapPoints=s={horizontal:[],vertical:[]},A(g,function(y){y&&(y=y.original||y,h==="y"&&s.horizontal.push(y.y),h==="x"&&s.vertical.push(y.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;k(o,{dx:o.dx-p,dy:o.dy-f,x:u,y:l}),(p||a.vertical.indexOf(s)!==-1)&&Je(o,"x",u),(f||a.horizontal.indexOf(c)!==-1)&&Je(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:[]},A(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);!ke(s)||!c||!c.x||!c.y||(Je(o,"x",c.x),Je(o,"y",c.y))}),e.on(["bendpoint.move.move","bendpoint.move.end"],1500,function(o){var a=o.context,s=r(a),c=a.hover,u=c&&n(c,o),l=o.x,p=o.y,f,d;if(s){f=t(u?s.vertical.concat([u.x]):s.vertical,l),d=t(u?s.horizontal.concat([u.y]):s.horizontal,p);var h=l-f,g=p-d;k(o,{dx:o.dx-h,dy:o.dy-g,x:o.x-h,y:o.y-g}),(h||s.vertical.indexOf(l)!==-1)&&Je(o,"x",f),(g||s.horizontal.indexOf(p)!==-1)&&Je(o,"y",d)}})}ty.$inject=["eventBus"];const zA={__depends__:[Fn,Rn],__init__:["bendpoints","bendpointSnapping","bendpointMovePreview"],bendpoints:["type",Bv],bendpointMove:["type",Jl],bendpointMovePreview:["type",Vv],connectionSegmentMove:["type",Kv],bendpointSnapping:["type",ty]};function ny(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),!Zi(l)){if(l!==!1){s.source=c,s.target=u;return}l=s.canExecute=o(c,u),!Zi(l)&&l!==!1&&(s.source=u,s.target=c)}}),e.on(["connect.out","connect.cleanup"],function(a){var s=a.context;s.hover=null,s.source=null,s.target=null,s.canExecute=!1}),e.on("connect.end",function(a){var s=a.context,c=s.canExecute,u=s.connectionStart,l={x:a.x,y:a.y},p=s.source,f=s.target;if(!c)return!1;var d=null,h={connectionStart:np(s)?l:u,connectionEnd:np(s)?u:l};ut(c)&&(d=c),s.connection=n.connect(p,f,d,h)}),this.start=function(a,s,c,u){ut(c)||(u=c,c=ce(s)),t.init(a,"connect",{autoActivate:u,data:{shape:s,context:{start:s,connectionStart:c}}})}}ny.$inject=["eventBus","dragging","modeling","rules"];function np(e){var t=e.hover,n=e.source,i=e.target;return t&&n&&t===n&&n!==i}var VA=1100,GA=900,iy="connect-ok",ry="connect-not-ok";function oy(e,t,n){var i=e.get("connectionPreview",!1);i&&t.on("connect.move",function(r){var o=r.context,a=o.canExecute,s=o.hover,c=o.source,u=o.start,l=o.startPosition,p=o.target,f=o.connectionStart||l,d=o.connectionEnd||{x:r.x,y:r.y},h=f,g=d;np(o)&&(h=d,g=f),i.drawPreview(o,a,{source:c||u,target:p||s,connectionStart:h,connectionEnd:g})}),t.on("connect.hover",GA,function(r){var o=r.context,a=r.hover,s=o.canExecute;s!==null&&n.addMarker(a,s?iy:ry)}),t.on(["connect.out","connect.cleanup"],VA,function(r){var o=r.hover;o&&(n.removeMarker(o,iy),n.removeMarker(o,ry))}),i&&t.on("connect.cleanup",function(r){i.cleanUp(r.context)})}oy.$inject=["injector","eventBus","canvas"];const ip={__depends__:[en,Rn,Fn],__init__:["connectPreview"],connect:["type",ny],connectPreview:["type",oy]};var WA="djs-dragger";function qn(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)}qn.$inject=["injector","canvas","graphicsFactory","elementFactory"],qn.prototype.drawPreview=function(e,t,n){n=n||{};var i=e.connectionPreviewGfx,r=e.getConnection,o=n.source,a=n.target,s=n.waypoints,c=n.connectionStart,u=n.connectionEnd,l=n.noLayout,p=n.noCropping,f=n.noNoop,d,h=this;if(i||(i=e.connectionPreviewGfx=this.createConnectionPreviewGfx()),aa(i),r||(r=e.getConnection=UA(function(g,y,S){return h.getConnection(g,y,S)})),t&&(d=r(t,o,a)),!d){!f&&this.drawNoopPreview(i,n);return}d.waypoints=s||[],this._layouter&&!l&&(d.waypoints=this._layouter.layoutConnection(d,{source:o,target:a,connectionStart:c,connectionEnd:u,waypoints:n.waypoints||d.waypoints})),(!d.waypoints||!d.waypoints.length)&&(d.waypoints=[o?ce(o):c,a?ce(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)"})},qn.prototype.drawNoopPreview=function(e,t){var n=t.source,i=t.target,r=t.connectionStart||ce(n),o=t.connectionEnd||ce(i),a=this.cropWaypoints(r,o,n,i),s=this.createNoopConnection(a[0],a[1]);fe(e,s)},qn.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&&Yr(o,s,!0)||e,t=i&&Yr(a,s,!1)||t,[e,t]},qn.prototype.cleanUp=function(e){e&&e.connectionPreviewGfx&&ot(e.connectionPreviewGfx)},qn.prototype.getConnection=function(e){var t=qA(e);return this._elementFactory.createConnection(t)},qn.prototype.createConnectionPreviewGfx=function(){var e=te("g");return Z(e,{pointerEvents:"none"}),xe(e).add(WA),fe(this._canvas.getActiveLayer(),e),e},qn.prototype.createNoopConnection=function(e,t){return Gr([e,t],{stroke:"#333",strokeDasharray:[1],strokeWidth:2,"pointer-events":"none"})};function UA(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 qA(e){return ut(e)?e:{}}const YA={__init__:["connectionPreview"],connectionPreview:["type",qn]},Ws="complex-preview";class ay{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(Ws);n.filter(s=>!KA(s)).forEach(s=>{let c;ke(s)?(c=this._graphicsFactory._createContainer("connection",te("g")),this._graphicsFactory.drawConnection(Li(c),s)):(c=this._graphicsFactory._createContainer("shape",te("g")),this._graphicsFactory.drawShape(Li(c),s),mt(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);ke(s)?mt(u,c.x,c.y):mt(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",te("g"));this._graphicsFactory.drawShape(Li(u),s,{width:c.width,height:c.height}),mt(u,c.x,c.y),this._previewSupport.addDragger(s,a,u)})}cleanUp(){aa(this._canvas.getLayer(Ws)),this._markers.forEach(([t,n])=>this._canvas.removeMarker(t,n)),this._markers=[]}show(){this._canvas.showLayer(Ws)}hide(){this._canvas.hideLayer(Ws)}}ay.$inject=["canvas","graphicsFactory","previewSupport"];function KA(e){return e.hidden}const XA={__depends__:[xr],__init__:["complexPreview"],complexPreview:["type",ay]},sy=Math.round;function Us(e,t,n,i,r,o){this._complexPreview=e,this._connectionDocking=t,this._elementFactory=n,this._eventBus=i,this._layouter=r,this._rules=o}Us.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(k({type:t},n)),l=a.fire("autoPlace",{source:e,shape:u});if(!l)return;k(u,{x:l.x-sy(u.width/2),y:l.y-sy(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=>!Zi(d))})},Us.prototype.cleanUp=function(){this._complexPreview.cleanUp()},Us.$inject=["complexPreview","connectionDocking","elementFactory","eventBus","layouter","rules"];const ZA={__depends__:[_s,XA,Al],__init__:["appendPreview"],appendPreview:["type",Us]};var cy=Math.min,uy=Math.max;function rp(e){e.preventDefault()}function Bo(e){e.stopPropagation()}function QA(e){return e.nodeType===Node.TEXT_NODE}function JA(e){return[].slice.call(e)}function pn(e){this.container=e.container,this.parent=Ne('<div class="djs-direct-editing-parent"><div class="djs-direct-editing-content" contenteditable="true"></div></div>'),this.content=Me("[contenteditable]",this.parent),this.keyHandler=e.keyHandler||function(){},this.resizeHandler=e.resizeHandler||function(){},this.focusoutHandler=e.focusoutHandler||function(){},this.autoResize=At(this.autoResize,this),this.handlePaste=At(this.handlePaste,this)}pn.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=cn(t,["width","height","maxWidth","maxHeight","minWidth","minHeight","left","top","backgroundColor","position","overflow","border","wordWrap","textAlign","outline","transform"]);k(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=cn(t,["fontFamily","fontSize","fontWeight","lineHeight","padding","paddingTop","paddingRight","paddingBottom","paddingLeft"]);return k(a.style,{boxSizing:"border-box",width:"100%",outline:"none",wordWrap:"break-word"},u),i.centerVertically&&k(a.style,{position:"absolute",top:"50%",transform:"translate(0, -50%)"},u),a.innerText=n,pe.bind(a,"keydown",this.keyHandler),pe.bind(a,"mousedown",Bo),pe.bind(a,"paste",r.handlePaste),pe.bind(a,"focusout",this.focusoutHandler),i.autoResize&&pe.bind(a,"input",this.autoResize),i.resizable&&this.resizable(t),s.appendChild(o),this.setSelection(a.lastChild,a.lastChild&&a.lastChild.length),o},pn.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)}},pn.prototype.insertText=function(e){e=eT(e);var t=document.execCommand("insertText",!1,e);t||this._insertTextIE(e)},pn.prototype._insertTextIE=function(e){var t=this.getSelection(),n=t.startContainer,i=t.endContainer,r=t.startOffset,o=t.endOffset,a=t.commonAncestorContainer,s=JA(a.childNodes),c,u;if(QA(a)){var l=n.textContent;n.textContent=l.substring(0,r)+e+l.substring(o),c=n,u=r+e.length}else if(n===this.content&&i===this.content){var p=document.createTextNode(e);this.content.insertBefore(p,s[r]),c=p,u=p.textContent.length}else{var f=s.indexOf(n),d=s.indexOf(i);s.forEach(function(h,g){g===f?h.textContent=n.textContent.substring(0,r)+e+i.textContent.substring(o):g>f&&g<=d&&_n(h)}),c=n,u=r+e.length}c&&u!==void 0&&setTimeout(function(){self.setSelection(c,u)})},pn.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})}},pn.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=Ne('<div class="djs-direct-editing-resize-handle"></div>');var s,c,u,l,p=function(h){rp(h),Bo(h),s=h.clientX,c=h.clientY;var g=t.getBoundingClientRect();u=g.width,l=g.height,pe.bind(document,"mousemove",f),pe.bind(document,"mouseup",d)},f=function(h){rp(h),Bo(h);var g=cy(uy(u+h.clientX-s,i),o),y=cy(uy(l+h.clientY-c,r),a);t.style.width=g+"px",t.style.height=y+"px",e.resizeHandler({width:u,height:l,dx:h.clientX-s,dy:h.clientY-c})},d=function(h){rp(h),Bo(h),pe.unbind(document,"mousemove",f,!1),pe.unbind(document,"mouseup",d,!1)};pe.bind(n,"mousedown",p)}k(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)},pn.prototype.destroy=function(){var e=this.parent,t=this.content,n=this.resizeHandle;t.innerText="",e.removeAttribute("style"),t.removeAttribute("style"),pe.unbind(t,"keydown",this.keyHandler),pe.unbind(t,"mousedown",Bo),pe.unbind(t,"input",this.autoResize),pe.unbind(t,"paste",this.handlePaste),pe.unbind(t,"focusout",this.focusoutHandler),n&&(n.removeAttribute("style"),_n(n)),_n(e)},pn.prototype.getValue=function(){return this.content.innerText.trim()},pn.prototype.getSelection=function(){var e=window.getSelection(),t=e.getRangeAt(0);return t},pn.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 eT(e){return e.replace(/\r\n|\r|\n/g,`
315
- `)}function Ht(e,t){this._eventBus=e,this._canvas=t,this._providers=[],this._textbox=new pn({container:t.getContainer(),keyHandler:At(this._handleKey,this),resizeHandler:At(this._handleResize,this),focusoutHandler:At(this._handleFocusout,this)}),e.on(["diagram.clear","diagram.destroy"],()=>this._cleanup())}Ht.$inject=["eventBus","canvas"],Ht.prototype.registerProvider=function(e){this._providers.push(e)},Ht.prototype.isActive=function(e){return!!(this._active&&(!e||this._active.element===e))},Ht.prototype.cancel=function(){this._active&&(this._fire("cancel"),this.close())},Ht.prototype._fire=function(e,t){this._eventBus.fire("directEditing."+e,t||{active:this._active})},Ht.prototype.close=function(){this._fire("deactivate"),this._cleanup(),this._canvas.restoreFocus&&this._canvas.restoreFocus()},Ht.prototype._cleanup=function(){this._active&&(this._textbox.destroy(),this._active=null,this.resizable=void 0)},Ht.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()}},Ht.prototype.getValue=function(){return this._textbox.getValue()},Ht.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()},Ht.prototype._handleResize=function(e){this._fire("resize",e)},Ht.prototype._handleFocusout=function(e){e.relatedTarget&&this._textbox.parent.contains(e.relatedTarget)||this.complete()},Ht.prototype.activate=function(e){if(this.isActive()&&this.cancel(),this._eventBus.fire("directEditing.activate.allowed",{element:e})===!1)return!1;var t,n=Le(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 ly={__depends__:[Ka],__init__:["directEditing"],directEditing:["type",Ht]};function tT(e){return function(t){var n=t.target,i=V(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===Ee(e);return!o||!a||!s||!c}}const nT={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 H(e,t={}){var n=nT[e];if(!n)throw new Error("unknown popup entry <"+e+">");return{...n,actionName:"replace-with-"+e,...t}}var iT=[H("none-start-event",{actionName:"replace-with-none-start"}),H("none-intermediate-throwing"),H("none-end-event",{actionName:"replace-with-none-end"}),H("message-start"),H("timer-start"),H("conditional-start"),H("signal-start")],rT=[H("none-start-event",{actionName:"replace-with-none-start"}),H("none-intermediate-throwing"),H("none-end-event",{actionName:"replace-with-none-end"})],oT=[H("none-start-event",{actionName:"replace-with-none-start"}),H("none-intermediate-throwing",{actionName:"replace-with-none-intermediate-throw"}),H("none-end-event",{actionName:"replace-with-none-end"}),H("message-intermediate-catch"),H("message-intermediate-throw"),H("timer-intermediate-catch"),H("escalation-intermediate-throw"),H("conditional-intermediate-catch"),H("link-intermediate-catch"),H("link-intermediate-throw"),H("compensation-intermediate-throw"),H("signal-intermediate-catch"),H("signal-intermediate-throw")],aT=[H("none-start-event",{actionName:"replace-with-none-start"}),H("none-intermediate-throwing",{actionName:"replace-with-none-intermediate-throw"}),H("none-end-event",{actionName:"replace-with-none-end"}),H("message-end"),H("escalation-end"),H("error-end"),H("cancel-end"),H("compensation-end"),H("signal-end"),H("terminate-end")],sT=[H("exclusive-gateway"),H("parallel-gateway"),H("inclusive-gateway"),H("complex-gateway"),H("event-based-gateway")],cT=[H("transaction"),H("event-subprocess"),H("expanded-ad-hoc-subprocess",{actionName:"replace-with-ad-hoc-subprocess",label:"Ad-hoc sub-process"}),H("collapsed-subprocess")],uT=[H("expanded-subprocess",{actionName:"replace-with-subprocess",label:"Sub-process"}),H("transaction"),H("event-subprocess"),H("collapsed-ad-hoc-subprocess")],py=[H("transaction"),H("expanded-subprocess",{actionName:"replace-with-subprocess",label:"Sub-process"}),H("expanded-ad-hoc-subprocess",{actionName:"replace-with-ad-hoc-subprocess",label:"Ad-hoc sub-process"}),H("event-subprocess")],lT=py,fy=[H("task"),H("user-task"),H("service-task"),H("send-task"),H("receive-task"),H("manual-task"),H("rule-task"),H("script-task"),H("call-activity"),H("collapsed-subprocess"),H("expanded-subprocess"),H("collapsed-ad-hoc-subprocess"),H("expanded-ad-hoc-subprocess",{actionName:"replace-with-ad-hoc-subprocess"})],pT=[H("data-store-reference")],fT=[H("data-object-reference")],dT=[H("message-boundary"),H("timer-boundary"),H("escalation-boundary"),H("conditional-boundary"),H("error-boundary"),H("cancel-boundary"),H("signal-boundary"),H("compensation-boundary"),H("non-interrupting-message-boundary"),H("non-interrupting-timer-boundary"),H("non-interrupting-escalation-boundary"),H("non-interrupting-conditional-boundary"),H("non-interrupting-signal-boundary")],hT=[H("message-start"),H("timer-start"),H("conditional-start"),H("signal-start"),H("error-start"),H("escalation-start"),H("compensation-start"),H("non-interrupting-message-start"),H("non-interrupting-timer-start"),H("non-interrupting-conditional-start"),H("non-interrupting-signal-start"),H("non-interrupting-escalation-start")],mT=[{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"}],gT=[H("expanded-pool"),H("collapsed-pool",{label:function(e){var t="Empty pool/participant";return e.children&&e.children.length&&(t+=" (removes content)"),t}})],vT={"bpmn:MessageEventDefinition":[H("message-start"),H("message-intermediate-catch"),H("message-intermediate-throw"),H("message-end")],"bpmn:TimerEventDefinition":[H("timer-start"),H("timer-intermediate-catch")],"bpmn:ConditionalEventDefinition":[H("conditional-start"),H("conditional-intermediate-catch")],"bpmn:SignalEventDefinition":[H("signal-start"),H("signal-intermediate-catch"),H("signal-intermediate-throw"),H("signal-end")],"bpmn:ErrorEventDefinition":[H("error-start"),H("error-end")],"bpmn:EscalationEventDefinition":[H("escalation-start"),H("escalation-intermediate-throw"),H("escalation-end")],"bpmn:CompensateEventDefinition":[H("compensation-start"),H("compensation-intermediate-throw"),H("compensation-end")]};const dy={"start-event-non-interrupting":`
314
+ </svg>`},ST=900;function so(e,t,n,i){e.registerProvider(ST,this),this._contextPad=e,this._popupMenu=t,this._translate=n,this._canvas=i}so.$inject=["contextPad","popupMenu","translate","canvas"],so.prototype.getMultiElementContextPadEntries=function(e){var t={};return this._isAllowed(e)&&k(t,this._getEntries(e)),t},so.prototype._isAllowed=function(e){return!this._popupMenu.isEmpty(e,"align-elements")},so.prototype._getEntries=function(){var e=this;return{"align-elements":{group:"align-elements",title:e._translate("Align elements"),html:`<div class="entry">${wy.align}</div>`,action:{click:function(t,n){var i=e._getMenuPosition(n);k(i,{cursor:{x:t.x,y:t.y}}),e._popupMenu.open(n,"align-elements",i)}}}}},so.prototype._getMenuPosition=function(e){var t=5,n=this._contextPad.getPad(e).html,i=n.getBoundingClientRect(),r={x:i.left,y:i.bottom+t};return r};var RT=["left","center","right","top","middle","bottom"];function ca(e,t,n,i){this._alignElements=t,this._translate=n,this._popupMenu=e,this._rules=i,e.registerProvider("align-elements",this)}ca.$inject=["popupMenu","alignElements","translate","rules"],ca.prototype.getPopupMenuEntries=function(e){var t={};return this._isAllowed(e)&&k(t,this._getEntries(e)),t},ca.prototype._isAllowed=function(e){return this._rules.allowed("elements.align",{elements:e})},ca.prototype._getEntries=function(e){var t=this._alignElements,n=this._translate,i=this._popupMenu,r={};return T(RT,function(o){r["align-elements-"+o]={group:"align",title:n("Align elements "+o),className:"bjs-align-elements-menu-entry",imageHtml:wy[o],action:function(){t.trigger(e,o),i.close()}}}),r};function mc(e){xn.call(this,e)}mc.$inject=["eventBus"],Q(mc,xn),mc.prototype.init=function(){this.addRule("elements.align",function(e){var t=e.elements,n=we(t,function(i){return!(i.waypoints||i.host||i.labelTarget)});return n=$a(n),n.length<2?!1:n})};const CT={__depends__:[NA,Iv,Tp],__init__:["alignElementsContextPadProvider","alignElementsMenuProvider","bpmnAlignElements"],alignElementsContextPadProvider:["type",so],alignElementsMenuProvider:["type",ca],bpmnAlignElements:["type",mc]};function hi(e,t,n,i){W.call(this,e),this._elementRegistry=t,this._modeling=n,this._rules=i;var r=this;this.postExecuted(["shape.create"],function(o){var a=o.context,s=a.hints||{},c=a.shape,u=a.parent||a.newParent;s.autoResize!==!1&&r._expand([c],u)}),this.postExecuted(["elements.move"],function(o){var a=o.context,s=jc(Ar(a.closure.topLevel)),c=a.hints,u=c?c.autoResize:!0;if(u!==!1){var l=Tr(s,function(p){return p.parent.id});T(l,function(p,f){pe(u)&&(p=p.filter(function(d){return He(u,Mr({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)})}hi.$inject=["eventBus","elementRegistry","modeling","rules"],Q(hi,W),hi.prototype._getOptimalBounds=function(e,t){var n=this.getOffset(t),i=this.getPadding(t),r=le(at(e)),o=le(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),Ha(k({},o,a))},hi.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(PT(i,t)){var r=AT(Mn(t,["x","y","width","height"]),i);this.resize(t,i,{autoResize:r});var o=t.parent;o&&this._expand([t],o)}}},hi.prototype.getOffset=function(e){return{top:60,bottom:60,left:100,right:100}},hi.prototype.getPadding=function(e){return{top:2,bottom:2,left:15,right:15}},hi.prototype.resize=function(e,t,n){this._modeling.resizeShape(e,t,null,n)};function PT(e,t){return e.x!==t.x||e.y!==t.y||e.width!==t.width||e.height!==t.height}function AT(e,t){var n="";return e=le(e),t=le(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 gc(e){e.invoke(hi,this)}gc.$inject=["injector"],Q(gc,hi),gc.prototype.resize=function(e,t,n){y(e,"bpmn:Participant")?this._modeling.resizeLane(e,t,null,n):this._modeling.resizeShape(e,t,null,n)};function ua(e){xn.call(this,e);var t=this;this.addRule("element.autoResize",function(n){return t.canResize(n.elements,n.target)})}ua.$inject=["eventBus"],Q(ua,xn),ua.prototype.canResize=function(e,t){return!1};function vc(e,t){ua.call(this,e),this._modeling=t}Q(vc,ua),vc.$inject=["eventBus","modeling"],vc.prototype.canResize=function(e,t){if(y(t.di,"bpmndi:BPMNPlane")||!y(t,"bpmn:Participant")&&!y(t,"bpmn:Lane")&&!y(t,"bpmn:SubProcess"))return!1;var n=!0;return T(e,function(i){if(y(i,"bpmn:Lane")||_e(i)){n=!1;return}}),n};const TT={__init__:["bpmnAutoResize","bpmnAutoResizeProvider"],bpmnAutoResize:["type",gc],bpmnAutoResizeProvider:["type",vc]};function co(e,t,n){this._canvas=n,this._opts=k({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()})}co.$inject=["config.autoScroll","eventBus","canvas"],co.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++)MT(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 MT(e,t,n){return t<e&&e<n}co.prototype.stopScroll=function(){clearTimeout(this._scrolling)},co.prototype.setOptions=function(e){this._opts=k({},this._opts,e)},co.prototype._toBorderPoint=function(e){var t=this._canvas._container.getBoundingClientRect(),n=hr(e.originalEvent);return{x:n.x-t.left,y:n.y-t.top}};const kT={__depends__:[ci],__init__:["autoScroll"],autoScroll:["type",co]};var Sy="djs-bendpoint",Ry="djs-segment-dragger";function DT(e,t){var n=hr(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 Mp(e,t,n){var i=DT(e,n),r=Yu(t,i);return r}function kp(e,t){var n=se("g");Pe(n).add(Sy),ge(e,n);var i=se("circle");J(i,{cx:0,cy:0,r:4}),Pe(i).add("djs-visual"),ge(n,i);var r=se("circle");return J(r,{cx:0,cy:0,r:10}),Pe(r).add("djs-hit"),ge(n,r),t&&Pe(n).add(t),n}function OT(e,t,n,i){var r=se("g");ge(e,r);var o=18,a=6,s=11,c=LT(t,n,i),u=a+s,l=se("rect");J(l,{x:-o/2,y:-a/2,width:o,height:a}),Pe(l).add("djs-visual"),ge(r,l);var p=se("rect");return J(p,{x:-c/2,y:-u/2,width:c,height:u}),Pe(p).add("djs-hit"),ge(r,p),Zd(r,i==="v"?90:0),r}function Cy(e,t,n){var i=se("g"),r=wu(t,n),o=ni(t,n);return ge(e,i),OT(i,t,n,o),Pe(i).add(Ry),Pe(i).add(o==="h"?"horizontal":"vertical"),Tt(i,r.x,r.y),i}function Dp(e){return Math.abs(Math.round(e*2/3))}function IT(e,t){var n=BT(e,t);return el(e,n)}function LT(e,t,n){var i=t.x-e.x,r=t.y-e.y;return Dp(n==="h"?i:r)}function BT(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=Nh(e,[a,s]);c<i&&(i=c,r=o)}return[n[r],n[r+1]]}function Py(e,t,n,i,r){function o(b,x,S){var A=b.index,I=b.point,C,$,j,L,F,re;return A<=0||b.bendpoint?!1:(C=x[A-1],$=x[A],j=wu(C,$),L=ni(C,$),F=Math.abs(I.x-j.x),re=Math.abs(I.y-j.y),L&&F<=S&&re<=S)}function a(b,x){var S=b.waypoints,A,I,C,$;return x.index<=0||x.bendpoint||(A={start:S[x.index-1],end:S[x.index]},I=ni(A.start,A.end),!I)?null:(I==="h"?C=A.end.x-A.start.x:C=A.end.y-A.start.y,$=Dp(C)/2,$)}function s(b,x){var S=x.waypoints,A=Mp(t,S,b),I;if(A){I=a(x,A);var C;if(o(A,S,I)?C=r.start(b,x,A.index):C=i.start(b,x,A.index,!A.bendpoint),C!==!1)return!0}}function c(b,x,S){me.bind(b,x,function(A){n.triggerMouseEvent(x,A,S),A.stopPropagation()})}function u(b,x){var S=t.getLayer("overlays"),A=Be('.djs-bendpoints[data-element-id="'+ia(b.id)+'"]',S);return!A&&x&&(A=se("g"),J(A,{"data-element-id":b.id}),Pe(A).add("djs-bendpoints"),ge(S,A),c(A,"mousedown",b),c(A,"click",b),c(A,"dblclick",b)),A}function l(b,x){return Be('.djs-segment-dragger[data-segment-idx="'+b+'"]',x)}function p(b,x){x.waypoints.forEach(function(S,A){var I=kp(b);ge(b,I),Tt(I,S.x,S.y)}),kp(b,"floating")}function f(b,x){for(var S=x.waypoints,A,I,C,$=1;$<S.length;$++)A=S[$-1],I=S[$],ni(A,I)&&(C=Cy(b,A,I),J(C,{"data-segment-idx":$}),c(C,"mousemove",x))}function d(b){T(Ia("."+Sy,b),function(x){vt(x)})}function h(b){T(Ia("."+Ry,b),function(x){vt(x)})}function m(b){var x=u(b);return x||(x=u(b,!0),p(x,b),f(x,b)),x}function g(b){var x=u(b);x&&(h(x),d(x),f(x,b),p(x,b))}function w(b,x){var S=Be(".floating",b),A=x.point;S&&(Tt(S,A.x,A.y),Pe(S).add("positioned"))}function E(b,x,S){var A=l(x.index,b),I=S[x.index-1],C=S[x.index],$=x.point,j=wu(I,C),L=ni(I,C),F,re;A&&(F=NT(A),re={x:$.x-j.x,y:$.y-j.y},L==="v"&&(re={x:re.y,y:re.x}),Tt(F,re.x,re.y))}e.on("connection.changed",function(b){g(b.element)}),e.on("connection.remove",function(b){var x=u(b.element);x&&vt(x)}),e.on("element.marker.update",function(b){var x=b.element,S;x.waypoints&&(S=m(x),b.add?Pe(S).add(b.marker):Pe(S).remove(b.marker))}),e.on("element.mousemove",function(b){var x=b.element,S=x.waypoints,A,I;if(S){if(A=u(x,!0),I=Mp(t,S,b.originalEvent),!I)return;w(A,I),I.bendpoint||E(A,I,S)}}),e.on("element.mousedown",function(b){if(Ni(b)){var x=b.originalEvent,S=b.element;if(S.waypoints)return s(x,S)}}),e.on("selection.changed",function(b){var x=b.newSelection,S=x[0];S&&S.waypoints&&m(S)}),e.on("element.hover",function(b){var x=b.element;x.waypoints&&m(x)}),e.on("element.out",function(b){var x=b.element;if(x.waypoints){var S=u(x);if(S){var A=Be(".floating",S);A&&Pe(A).remove("positioned")}}}),e.on("element.updateId",function(b){var x=b.element,S=b.newId;if(x.waypoints){var A=u(x);A&&J(A,{"data-element-id":S})}}),this.addHandles=m,this.updateHandles=g,this.getBendpointsContainer=u,this.getSegmentDragger=l}Py.$inject=["eventBus","canvas","interactionEvents","bendpointMove","connectionSegmentMove"];function NT(e){return Be(".djs-visual",e)}var Ay=Math.round,Er="reconnectStart",wr="reconnectEnd",la="updateWaypoints";function Op(e,t,n,i,r,o){this._injector=e,this.start=function(a,s,c,u){var l=n.getGraphics(s),p=s.source,f=s.target,d=s.waypoints,h;!u&&c===0?h=Er:!u&&c===d.length-1?h=wr:h=la;var m=h===la?"connection.updateWaypoints":"connection.reconnect",g=r.allowed(m,{connection:s,source:p,target:f});if(g===!1&&(g=r.allowed(m,{connection:s,source:f,target:p})),g!==!1)return i.init(a,"bendpoint.move",{data:{connection:s,connectionGfx:l,context:{allowed:g,bendpointIndex:c,connection:s,source:p,target:f,insert:u,type:h}}})},t.on("bendpoint.move.hover",function(a){var s=a.context,c=s.connection,u=c.source,l=c.target,p=a.hover,f=s.type;s.hover=p;var d;if(p){var h=f===la?"connection.updateWaypoints":"connection.reconnect";if(d=s.allowed=r.allowed(h,{connection:c,source:f===Er?p:u,target:f===wr?p:l}),d){s.source=f===Er?p:u,s.target=f===wr?p:l;return}d===!1&&(d=s.allowed=r.allowed(h,{connection:c,source:f===wr?p:l,target:f===Er?p:u})),d&&(s.source=f===wr?p:l,s.target=f===Er?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!==la&&(s.allowed=!1)}),t.on("bendpoint.move.end",function(a){var s=a.context,c=s.allowed,u=s.bendpointIndex,l=s.connection,p=s.insert,f=l.waypoints.slice(),d=s.source,h=s.target,m=s.type,g=s.hints||{},w={x:Ay(a.x),y:Ay(a.y)};if(!c)return!1;m===la?(p?f.splice(u,0,w):f[u]=w,g.bendpointMove={insert:p,bendpointIndex:u},f=this.cropWaypoints(l,f),o.updateWaypoints(l,YE(f),g)):(m===Er?(g.docking="source",yc(s)&&(g.docking="target",g.newWaypoints=f.reverse())):m===wr&&(g.docking="target",yc(s)&&(g.docking="source",g.newWaypoints=f.reverse())),o.reconnect(l,d,h,w,g))},this)}Op.$inject=["injector","eventBus","canvas","dragging","rules","modeling"],Op.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 yc(e){var t=e.hover,n=e.source,i=e.target,r=e.type;if(r===Er)return t&&i&&t===i&&n!==i;if(r===wr)return t&&n&&t===n&&n!==i}var $T="reconnectStart",jT="reconnectEnd",Ty="updateWaypoints",pa="connect-ok",_c="connect-not-ok",My="connect-hover",ky="djs-updating",Dy="djs-dragging",Oy=1100;function Iy(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=kp(i.getLayer("overlays"));Pe(f).add("djs-dragging"),i.addMarker(c,Dy),i.addMarker(c,ky)}),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,My),u===Ty)return;s?(i.removeMarker(c,_c),i.addMarker(c,pa)):s===!1&&(i.removeMarker(c,pa),i.addMarker(c,_c))}}),n.on(["bendpoint.move.out","bendpoint.move.cleanup"],Oy,function(o){var a=o.context,s=a.hover,c=a.target;s&&(i.removeMarker(s,My),i.removeMarker(s,c?pa:_c))}),n.on("bendpoint.move.move",function(o){var a=o.context,s=a.allowed,c=a.bendpointIndex,u=a.draggerGfx,l=a.hover,p=a.type,f=a.connection,d=f.source,h=f.target,m=f.waypoints.slice(),g={x:o.x,y:o.y},w=a.hints||{},E={};r&&(w.connectionStart&&(E.connectionStart=w.connectionStart),w.connectionEnd&&(E.connectionEnd=w.connectionEnd),p===$T?yc(a)?(E.connectionEnd=E.connectionEnd||g,E.source=h,E.target=l||d,m=m.reverse()):(E.connectionStart=E.connectionStart||g,E.source=l||d,E.target=h):p===jT?yc(a)?(E.connectionStart=E.connectionStart||g,E.source=l||h,E.target=d,m=m.reverse()):(E.connectionEnd=E.connectionEnd||g,E.source=d,E.target=l||h):(E.noCropping=!0,E.noLayout=!0,m[c]=g),p===Ty&&(m=e.cropWaypoints(f,m)),E.waypoints=m,r.drawPreview(a,s,E)),Tt(u,o.x,o.y)},this),n.on(["bendpoint.move.end","bendpoint.move.cancel"],Oy,function(o){var a=o.context,s=a.connection,c=a.draggerGfx,u=a.hover,l=a.target,p=a.waypoints;s.waypoints=p,vt(c),i.removeMarker(s,ky),i.removeMarker(s,Dy),u&&(i.removeMarker(u,pa),i.removeMarker(u,l?pa:_c)),r&&r.cleanUp(a)})}Iy.$inject=["bendpointMove","injector","eventBus","canvas"];var Ly="connect-hover",By="djs-updating";function Ny(e,t,n){return Ip(e,t,e[t]+n)}function Ip(e,t,n){return{x:t==="x"?n:e.x,y:t==="y"?n:e.y}}function FT(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 Ip(t,i,s)}function $y(e){return e==="x"?"y":"x"}function jy(e,t,n){var i,r;return e.original?e.original:(i=fe(t),r=$y(n),Ip(e,r,i[r]))}function Fy(e,t,n,i,r,o){var a=e.get("connectionDocking",!1);this.start=function(p,f,d){var h,m=n.getGraphics(f),g=d-1,w=d,E=f.waypoints,b=E[g],x=E[w],S=Mp(n,E,p),A,I,C;if(A=ni(b,x),!!A)return I=A==="v"?"x":"y",g===0&&(b=jy(b,f.source,I)),w===E.length-1&&(x=jy(x,f.target,I)),S?C=S.point:C={x:(b.x+x.x)/2,y:(b.y+x.y)/2},h={connection:f,segmentStartIndex:g,segmentEndIndex:w,segmentStart:b,segmentEnd:x,axis:I,dragPosition:C},i.init(p,C,"connectionSegment.move",{cursor:I==="x"?"resize-ew":"resize-ns",data:{connection:f,connectionGfx:m,context:h}})};function s(p,f){if(!a)return f;var d=p.waypoints,h;return p.waypoints=f,h=a.getCroppedWaypoints(p),p.waypoints=d,h}function c(p){r.update("connection",p.connection,p.connectionGfx)}function u(p,f,d){var h=p.newWaypoints,m=p.segmentStartIndex+f,g=h[m],w=p.segmentEndIndex+f,E=h[w],b=$y(p.axis),x=FT(d,g,E,b);Tt(p.draggerGfx,x.x,x.y)}function l(p,f){var d=0,h=p.filter(function(m,g){return Eu(p[g-1],p[g+1],m)?(d=g<=f?d-1:d,!1):!0});return{waypoints:h,segmentOffset:d}}t.on("connectionSegment.move.start",function(p){var f=p.context,d=p.connection,h=n.getLayer("overlays");f.originalWaypoints=d.waypoints.slice(),f.draggerGfx=Cy(h,f.segmentStart,f.segmentEnd),Pe(f.draggerGfx).add("djs-dragging"),n.addMarker(d,By)}),t.on("connectionSegment.move.move",function(p){var f=p.context,d=f.connection,h=f.segmentStartIndex,m=f.segmentEndIndex,g=f.segmentStart,w=f.segmentEnd,E=f.axis,b=f.originalWaypoints.slice(),x=Ny(g,E,p["d"+E]),S=Ny(w,E,p["d"+E]),A=b.length,I=0;b[h]=x,b[m]=S;var C,$;h<2&&(C=At(d.source,x),h===1?C==="intersect"&&(b.shift(),b[0]=x,I--):C!=="intersect"&&(b.unshift(g),I++)),m>A-3&&($=At(d.target,S),m===A-2?$==="intersect"&&(b.pop(),b[b.length-1]=S):$!=="intersect"&&b.push(w)),f.newWaypoints=d.waypoints=s(d,b),u(f,I,p),f.newSegmentStartIndex=h+I,c(p)}),t.on("connectionSegment.move.hover",function(p){p.context.hover=p.hover,n.addMarker(p.hover,Ly)}),t.on(["connectionSegment.move.out","connectionSegment.move.cleanup"],function(p){var f=p.context.hover;f&&n.removeMarker(f,Ly)}),t.on("connectionSegment.move.cleanup",function(p){var f=p.context,d=f.connection;f.draggerGfx&&vt(f.draggerGfx),n.removeMarker(d,By)}),t.on(["connectionSegment.move.cancel","connectionSegment.move.end"],function(p){var f=p.context,d=f.connection;d.waypoints=f.originalWaypoints,c(p)}),t.on("connectionSegment.move.end",function(p){var f=p.context,d=f.connection,h=f.newWaypoints,m=f.newSegmentStartIndex;h=h.map(function(S){return{original:S.original,x:Math.round(S.x),y:Math.round(S.y)}});var g=l(h,m),w=g.waypoints,E=s(d,w),b=g.segmentOffset,x={segmentMove:{segmentStartIndex:f.segmentStartIndex,newSegmentStartIndex:m+b}};o.updateWaypoints(d,E,x)})}Fy.$inject=["injector","eventBus","canvas","dragging","graphicsFactory","modeling"];var HT=Math.abs,Hy=Math.round;function zT(e,t,n){n=n===void 0?10:n;var i,r;for(i=0;i<t.length;i++)if(r=t[i],HT(r-e)<=n)return r}function zy(e){return{x:e.x,y:e.y}}function Vy(e){return{x:e.x+e.width,y:e.y+e.height}}function Rn(e,t){return!e||isNaN(e.x)||isNaN(e.y)?t:{x:Hy(e.x+e.width/2),y:Hy(e.y+e.height/2)}}function uo(e,t){var n=e.snapped;return n?typeof t=="string"?n[t]:n.x&&n.y:!1}function lt(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 Gy(e){return e.children||[]}var VT=Math.abs,Wy=Math.round,Lp=10;function Uy(e){function t(o,a){if(pe(o)){for(var s=o.length;s--;)if(VT(o[s]-a)<=Lp)return o[s]}else{o=+o;var c=a%o;if(c<Lp)return a-c;if(c>o-Lp)return a-c+o}return a}function n(o,a){if(o.waypoints)return IT(a,o);if(o.width)return{x:Wy(o.width/2+o.x),y:Wy(o.height/2+o.y)}}function i(o){var a=o.context,s=a.snapPoints,c=a.connection,u=c.waypoints,l=a.segmentStart,p=a.segmentStartIndex,f=a.segmentEnd,d=a.segmentEndIndex,h=a.axis;if(s)return s;var m=[u[p-1],l,f,u[d+1]];return p<2&&m.unshift(n(c.source,o)),d>u.length-3&&m.unshift(n(c.target,o)),a.snapPoints=s={horizontal:[],vertical:[]},T(m,function(g){g&&(g=g.original||g,h==="y"&&s.horizontal.push(g.y),h==="x"&&s.vertical.push(g.x))}),s}e.on("connectionSegment.move.move",1500,function(o){var a=i(o),s=o.x,c=o.y,u,l;if(a){u=t(a.vertical,s),l=t(a.horizontal,c);var p=s-u,f=c-l;k(o,{dx:o.dx-p,dy:o.dy-f,x:u,y:l}),(p||a.vertical.indexOf(s)!==-1)&&lt(o,"x",u),(f||a.horizontal.indexOf(c)!==-1)&&lt(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:[]},T(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);!$e(s)||!c||!c.x||!c.y||(lt(o,"x",c.x),lt(o,"y",c.y))}),e.on(["bendpoint.move.move","bendpoint.move.end"],1500,function(o){var a=o.context,s=r(a),c=a.hover,u=c&&n(c,o),l=o.x,p=o.y,f,d;if(s){f=t(u?s.vertical.concat([u.x]):s.vertical,l),d=t(u?s.horizontal.concat([u.y]):s.horizontal,p);var h=l-f,m=p-d;k(o,{dx:o.dx-h,dy:o.dy-m,x:o.x-h,y:o.y-m}),(h||s.vertical.indexOf(l)!==-1)&&lt(o,"x",f),(m||s.horizontal.indexOf(p)!==-1)&&lt(o,"y",d)}})}Uy.$inject=["eventBus"];const GT={__depends__:[ci,Un],__init__:["bendpoints","bendpointSnapping","bendpointMovePreview"],bendpoints:["type",Py],bendpointMove:["type",Op],bendpointMovePreview:["type",Iy],connectionSegmentMove:["type",Fy],bendpointSnapping:["type",Uy]};function qy(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),!Pr(l)){if(l!==!1){s.source=c,s.target=u;return}l=s.canExecute=o(c,u),!Pr(l)&&l!==!1&&(s.source=u,s.target=c)}}),e.on(["connect.out","connect.cleanup"],function(a){var s=a.context;s.hover=null,s.source=null,s.target=null,s.canExecute=!1}),e.on("connect.end",function(a){var s=a.context,c=s.canExecute,u=s.connectionStart,l={x:a.x,y:a.y},p=s.source,f=s.target;if(!c)return!1;var d=null,h={connectionStart:Bp(s)?l:u,connectionEnd:Bp(s)?u:l};xt(c)&&(d=c),s.connection=n.connect(p,f,d,h)}),this.start=function(a,s,c,u){xt(c)||(u=c,c=fe(s)),t.init(a,"connect",{autoActivate:u,data:{shape:s,context:{start:s,connectionStart:c}}})}}qy.$inject=["eventBus","dragging","modeling","rules"];function Bp(e){var t=e.hover,n=e.source,i=e.target;return t&&n&&t===n&&n!==i}var WT=1100,UT=900,Yy="connect-ok",Ky="connect-not-ok";function Xy(e,t,n){var i=e.get("connectionPreview",!1);i&&t.on("connect.move",function(r){var o=r.context,a=o.canExecute,s=o.hover,c=o.source,u=o.start,l=o.startPosition,p=o.target,f=o.connectionStart||l,d=o.connectionEnd||{x:r.x,y:r.y},h=f,m=d;Bp(o)&&(h=d,m=f),i.drawPreview(o,a,{source:c||u,target:p||s,connectionStart:h,connectionEnd:m})}),t.on("connect.hover",UT,function(r){var o=r.context,a=r.hover,s=o.canExecute;s!==null&&n.addMarker(a,s?Yy:Ky)}),t.on(["connect.out","connect.cleanup"],WT,function(r){var o=r.hover;o&&(n.removeMarker(o,Yy),n.removeMarker(o,Ky))}),i&&t.on("connect.cleanup",function(r){i.cleanUp(r.context)})}Xy.$inject=["injector","eventBus","canvas"];const Np={__depends__:[En,Un,ci],__init__:["connectPreview"],connect:["type",qy],connectPreview:["type",Xy]};var qT="djs-dragger";function mi(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)}mi.$inject=["injector","canvas","graphicsFactory","elementFactory"],mi.prototype.drawPreview=function(e,t,n){n=n||{};var i=e.connectionPreviewGfx,r=e.getConnection,o=n.source,a=n.target,s=n.waypoints,c=n.connectionStart,u=n.connectionEnd,l=n.noLayout,p=n.noCropping,f=n.noNoop,d,h=this;if(i||(i=e.connectionPreviewGfx=this.createConnectionPreviewGfx()),La(i),r||(r=e.getConnection=YT(function(m,g,w){return h.getConnection(m,g,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?fe(o):c,a?fe(a):u]),this._connectionDocking&&(o||a)&&!p&&(d.waypoints=this._connectionDocking.getCroppedWaypoints(d,o,a)),this._graphicsFactory.drawConnection(i,d,{stroke:"var(--element-dragger-color)"})},mi.prototype.drawNoopPreview=function(e,t){var n=t.source,i=t.target,r=t.connectionStart||fe(n),o=t.connectionEnd||fe(i),a=this.cropWaypoints(r,o,n,i),s=this.createNoopConnection(a[0],a[1]);ge(e,s)},mi.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&&Ro(o,s,!0)||e,t=i&&Ro(a,s,!1)||t,[e,t]},mi.prototype.cleanUp=function(e){e&&e.connectionPreviewGfx&&vt(e.connectionPreviewGfx)},mi.prototype.getConnection=function(e){var t=KT(e);return this._elementFactory.createConnection(t)},mi.prototype.createConnectionPreviewGfx=function(){var e=se("g");return J(e,{pointerEvents:"none"}),Pe(e).add(qT),ge(this._canvas.getActiveLayer(),e),e},mi.prototype.createNoopConnection=function(e,t){return xo([e,t],{stroke:"#333",strokeDasharray:[1],strokeWidth:2,"pointer-events":"none"})};function YT(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 KT(e){return xt(e)?e:{}}const XT={__init__:["connectionPreview"],connectionPreview:["type",mi]},bc="complex-preview";class Zy{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(bc);n.filter(s=>!ZT(s)).forEach(s=>{let c;$e(s)?(c=this._graphicsFactory._createContainer("connection",se("g")),this._graphicsFactory.drawConnection(pr(c),s)):(c=this._graphicsFactory._createContainer("shape",se("g")),this._graphicsFactory.drawShape(pr(c),s),Tt(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);$e(s)?Tt(u,c.x,c.y):Tt(u,s.x+c.x,s.y+c.y)}),r.forEach(s=>{this._previewSupport.addDragger(s,a,void 0,"djs-dragging"),this._canvas.addMarker(s,"djs-element-hidden"),this._markers.push([s,"djs-element-hidden"])}),o.forEach(({shape:s,bounds:c})=>{this._canvas.addMarker(s,"djs-hidden"),this._markers.push([s,"djs-hidden"]),this._previewSupport.addDragger(s,a,void 0,"djs-dragging");const u=this._graphicsFactory._createContainer("shape",se("g"));this._graphicsFactory.drawShape(pr(u),s,{width:c.width,height:c.height}),Tt(u,c.x,c.y),this._previewSupport.addDragger(s,a,u)})}cleanUp(){La(this._canvas.getLayer(bc)),this._markers.forEach(([t,n])=>this._canvas.removeMarker(t,n)),this._markers=[]}show(){this._canvas.showLayer(bc)}hide(){this._canvas.hideLayer(bc)}}Zy.$inject=["canvas","graphicsFactory","previewSupport"];function ZT(e){return e.hidden}const QT={__depends__:[Qr],__init__:["complexPreview"],complexPreview:["type",Zy]},Qy=Math.round;function xc(e,t,n,i,r,o){this._complexPreview=e,this._connectionDocking=t,this._elementFactory=n,this._eventBus=i,this._layouter=r,this._rules=o}xc.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(k({type:t},n)),l=a.fire("autoPlace",{source:e,shape:u});if(!l)return;k(u,{x:l.x-Qy(u.width/2),y:l.y-Qy(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=>!Pr(d))})},xc.prototype.cleanUp=function(){this._complexPreview.cleanUp()},xc.$inject=["complexPreview","connectionDocking","elementFactory","eventBus","layouter","rules"];const JT={__depends__:[Ys,QT,cp],__init__:["appendPreview"],appendPreview:["type",xc]};var Jy=Math.min,e_=Math.max;function $p(e){e.preventDefault()}function fa(e){e.stopPropagation()}function eM(e){return e.nodeType===Node.TEXT_NODE}function tM(e){return[].slice.call(e)}function Dn(e){this.container=e.container,this.parent=Ge('<div class="djs-direct-editing-parent"><div class="djs-direct-editing-content" contenteditable="true"></div></div>'),this.content=Be("[contenteditable]",this.parent),this.keyHandler=e.keyHandler||function(){},this.resizeHandler=e.resizeHandler||function(){},this.focusoutHandler=e.focusoutHandler||function(){},this.autoResize=Yt(this.autoResize,this),this.handlePaste=Yt(this.handlePaste,this)}Dn.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=Mn(t,["width","height","maxWidth","maxHeight","minWidth","minHeight","left","top","backgroundColor","position","overflow","border","wordWrap","textAlign","outline","transform"]);k(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=Mn(t,["fontFamily","fontSize","fontWeight","lineHeight","padding","paddingTop","paddingRight","paddingBottom","paddingLeft"]);return k(a.style,{boxSizing:"border-box",width:"100%",outline:"none",wordWrap:"break-word"},u),i.centerVertically&&k(a.style,{position:"absolute",top:"50%",transform:"translate(0, -50%)"},u),a.innerText=n,me.bind(a,"keydown",this.keyHandler),me.bind(a,"mousedown",fa),me.bind(a,"paste",r.handlePaste),me.bind(a,"focusout",this.focusoutHandler),i.autoResize&&me.bind(a,"input",this.autoResize),i.resizable&&this.resizable(t),s.appendChild(o),this.setSelection(a.lastChild,a.lastChild&&a.lastChild.length),o},Dn.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)}},Dn.prototype.insertText=function(e){e=nM(e);var t=document.execCommand("insertText",!1,e);t||this._insertTextIE(e)},Dn.prototype._insertTextIE=function(e){var t=this.getSelection(),n=t.startContainer,i=t.endContainer,r=t.startOffset,o=t.endOffset,a=t.commonAncestorContainer,s=tM(a.childNodes),c,u;if(eM(a)){var l=n.textContent;n.textContent=l.substring(0,r)+e+l.substring(o),c=n,u=r+e.length}else if(n===this.content&&i===this.content){var p=document.createTextNode(e);this.content.insertBefore(p,s[r]),c=p,u=p.textContent.length}else{var f=s.indexOf(n),d=s.indexOf(i);s.forEach(function(h,m){m===f?h.textContent=n.textContent.substring(0,r)+e+i.textContent.substring(o):m>f&&m<=d&&Fn(h)}),c=n,u=r+e.length}c&&u!==void 0&&setTimeout(function(){self.setSelection(c,u)})},Dn.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})}},Dn.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=Ge('<div class="djs-direct-editing-resize-handle"></div>');var s,c,u,l,p=function(h){$p(h),fa(h),s=h.clientX,c=h.clientY;var m=t.getBoundingClientRect();u=m.width,l=m.height,me.bind(document,"mousemove",f),me.bind(document,"mouseup",d)},f=function(h){$p(h),fa(h);var m=Jy(e_(u+h.clientX-s,i),o),g=Jy(e_(l+h.clientY-c,r),a);t.style.width=m+"px",t.style.height=g+"px",e.resizeHandler({width:u,height:l,dx:h.clientX-s,dy:h.clientY-c})},d=function(h){$p(h),fa(h),me.unbind(document,"mousemove",f,!1),me.unbind(document,"mouseup",d,!1)};me.bind(n,"mousedown",p)}k(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)},Dn.prototype.destroy=function(){var e=this.parent,t=this.content,n=this.resizeHandle;t.innerText="",e.removeAttribute("style"),t.removeAttribute("style"),me.unbind(t,"keydown",this.keyHandler),me.unbind(t,"mousedown",fa),me.unbind(t,"input",this.autoResize),me.unbind(t,"paste",this.handlePaste),me.unbind(t,"focusout",this.focusoutHandler),n&&(n.removeAttribute("style"),Fn(n)),Fn(e)},Dn.prototype.getValue=function(){return this.content.innerText.trim()},Dn.prototype.getSelection=function(){var e=window.getSelection(),t=e.getRangeAt(0);return t},Dn.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 nM(e){return e.replace(/\r\n|\r|\n/g,`
315
+ `)}function un(e,t){this._eventBus=e,this._canvas=t,this._providers=[],this._textbox=new Dn({container:t.getContainer(),keyHandler:Yt(this._handleKey,this),resizeHandler:Yt(this._handleResize,this),focusoutHandler:Yt(this._handleFocusout,this)}),e.on(["diagram.clear","diagram.destroy"],()=>this._cleanup())}un.$inject=["eventBus","canvas"],un.prototype.registerProvider=function(e){this._providers.push(e)},un.prototype.isActive=function(e){return!!(this._active&&(!e||this._active.element===e))},un.prototype.cancel=function(){this._active&&(this._fire("cancel"),this.close())},un.prototype._fire=function(e,t){this._eventBus.fire("directEditing."+e,t||{active:this._active})},un.prototype.close=function(){this._fire("deactivate"),this._cleanup(),this._canvas.restoreFocus&&this._canvas.restoreFocus()},un.prototype._cleanup=function(){this._active&&(this._textbox.destroy(),this._active=null,this.resizable=void 0)},un.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()}},un.prototype.getValue=function(){return this._textbox.getValue()},un.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()},un.prototype._handleResize=function(e){this._fire("resize",e)},un.prototype._handleFocusout=function(e){e.relatedTarget&&this._textbox.parent.contains(e.relatedTarget)||this.complete()},un.prototype.activate=function(e){if(this.isActive()&&this.cancel(),this._eventBus.fire("directEditing.activate.allowed",{element:e})===!1)return!1;var t,n=He(this._providers,function(i){return(t=i.activate(e))?i:null});return t&&(this.$textbox=this._textbox.create(t.bounds,t.style,t.text,t.options),this._active={element:e,context:t,provider:n},t.options&&t.options.resizable&&(this.resizable=!0),this._fire("activate")),!!t};const t_={__depends__:[Ss],__init__:["directEditing"],directEditing:["type",un]};function iM(e){return function(t){var n=t.target,i=U(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===Re(e);return!o||!a||!s||!c}}const rM={task:{label:"Task",className:"bpmn-icon-task",target:{type:"bpmn:Task"}},"user-task":{label:"User task",className:"bpmn-icon-user",target:{type:"bpmn:UserTask"}},"service-task":{label:"Service task",className:"bpmn-icon-service",target:{type:"bpmn:ServiceTask"}},"send-task":{label:"Send task",className:"bpmn-icon-send",target:{type:"bpmn:SendTask"}},"receive-task":{label:"Receive task",className:"bpmn-icon-receive",target:{type:"bpmn:ReceiveTask"}},"manual-task":{label:"Manual task",className:"bpmn-icon-manual",target:{type:"bpmn:ManualTask"}},"rule-task":{label:"Business rule task",className:"bpmn-icon-business-rule",target:{type:"bpmn:BusinessRuleTask"}},"script-task":{label:"Script task",className:"bpmn-icon-script",target:{type:"bpmn:ScriptTask"}},"call-activity":{label:"Call activity",className:"bpmn-icon-call-activity",target:{type:"bpmn:CallActivity"}},transaction:{label:"Transaction",className:"bpmn-icon-transaction",target:{type:"bpmn:Transaction",isExpanded:!0}},"event-subprocess":{label:"Event sub-process",className:"bpmn-icon-event-subprocess-expanded",target:{type:"bpmn:SubProcess",triggeredByEvent:!0,isExpanded:!0}},"collapsed-subprocess":{label:"Sub-process (collapsed)",className:"bpmn-icon-subprocess-collapsed",target:{type:"bpmn:SubProcess",isExpanded:!1}},"expanded-subprocess":{label:"Sub-process (expanded)",className:"bpmn-icon-subprocess-expanded",target:{type:"bpmn:SubProcess",isExpanded:!0}},"collapsed-ad-hoc-subprocess":{label:"Ad-hoc sub-process (collapsed)",className:"bpmn-icon-subprocess-collapsed",target:{type:"bpmn:AdHocSubProcess",isExpanded:!1}},"expanded-ad-hoc-subprocess":{label:"Ad-hoc sub-process (expanded)",className:"bpmn-icon-subprocess-expanded",target:{type:"bpmn:AdHocSubProcess",isExpanded:!0}},"exclusive-gateway":{label:"Exclusive gateway",className:"bpmn-icon-gateway-xor",target:{type:"bpmn:ExclusiveGateway"}},"parallel-gateway":{label:"Parallel gateway",className:"bpmn-icon-gateway-parallel",target:{type:"bpmn:ParallelGateway"}},"inclusive-gateway":{label:"Inclusive gateway",className:"bpmn-icon-gateway-or",target:{type:"bpmn:InclusiveGateway"}},"complex-gateway":{label:"Complex gateway",className:"bpmn-icon-gateway-complex",target:{type:"bpmn:ComplexGateway"}},"event-based-gateway":{label:"Event-based gateway",className:"bpmn-icon-gateway-eventbased",target:{type:"bpmn:EventBasedGateway",instantiate:!1,eventGatewayType:"Exclusive"}},"data-store-reference":{label:"Data store reference",className:"bpmn-icon-data-store",target:{type:"bpmn:DataStoreReference"}},"data-object-reference":{label:"Data object reference",className:"bpmn-icon-data-object",target:{type:"bpmn:DataObjectReference"}},"expanded-pool":{label:"Expanded pool/participant",className:"bpmn-icon-participant",target:{type:"bpmn:Participant",isExpanded:!0}},"collapsed-pool":{label:"Empty pool/participant",className:"bpmn-icon-lane",target:{type:"bpmn:Participant",isExpanded:!1}},"none-start-event":{label:"Start event",className:"bpmn-icon-start-event-none",target:{type:"bpmn:StartEvent"}},"none-intermediate-throwing":{label:"Intermediate throw event",className:"bpmn-icon-intermediate-event-none",target:{type:"bpmn:IntermediateThrowEvent"}},"none-boundary-event":{label:"Boundary event",className:"bpmn-icon-intermediate-event-none",target:{type:"bpmn:BoundaryEvent"}},"none-end-event":{label:"End event",className:"bpmn-icon-end-event-none",target:{type:"bpmn:EndEvent"}},"message-start":{label:"Message start event",className:"bpmn-icon-start-event-message",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:MessageEventDefinition",isInterrupting:!0}},"timer-start":{label:"Timer start event",className:"bpmn-icon-start-event-timer",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:TimerEventDefinition",isInterrupting:!0}},"conditional-start":{label:"Conditional start event",className:"bpmn-icon-start-event-condition",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:ConditionalEventDefinition",isInterrupting:!0}},"signal-start":{label:"Signal start event",className:"bpmn-icon-start-event-signal",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:SignalEventDefinition",isInterrupting:!0}},"error-start":{label:"Error start event",className:"bpmn-icon-start-event-error",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:ErrorEventDefinition",isInterrupting:!0}},"escalation-start":{label:"Escalation start event",className:"bpmn-icon-start-event-escalation",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:EscalationEventDefinition",isInterrupting:!0}},"compensation-start":{label:"Compensation start event",className:"bpmn-icon-start-event-compensation",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:CompensateEventDefinition",isInterrupting:!0}},"non-interrupting-message-start":{label:"Message start event (non-interrupting)",className:"bpmn-icon-start-event-non-interrupting-message",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:MessageEventDefinition",isInterrupting:!1}},"non-interrupting-timer-start":{label:"Timer start event (non-interrupting)",className:"bpmn-icon-start-event-non-interrupting-timer",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:TimerEventDefinition",isInterrupting:!1}},"non-interrupting-conditional-start":{label:"Conditional start event (non-interrupting)",className:"bpmn-icon-start-event-non-interrupting-condition",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:ConditionalEventDefinition",isInterrupting:!1}},"non-interrupting-signal-start":{label:"Signal start event (non-interrupting)",className:"bpmn-icon-start-event-non-interrupting-signal",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:SignalEventDefinition",isInterrupting:!1}},"non-interrupting-escalation-start":{label:"Escalation start event (non-interrupting)",className:"bpmn-icon-start-event-non-interrupting-escalation",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:EscalationEventDefinition",isInterrupting:!1}},"message-intermediate-catch":{label:"Message intermediate catch event",className:"bpmn-icon-intermediate-event-catch-message",target:{type:"bpmn:IntermediateCatchEvent",eventDefinitionType:"bpmn:MessageEventDefinition"}},"message-intermediate-throw":{label:"Message intermediate throw event",className:"bpmn-icon-intermediate-event-throw-message",target:{type:"bpmn:IntermediateThrowEvent",eventDefinitionType:"bpmn:MessageEventDefinition"}},"timer-intermediate-catch":{label:"Timer intermediate catch event",className:"bpmn-icon-intermediate-event-catch-timer",target:{type:"bpmn:IntermediateCatchEvent",eventDefinitionType:"bpmn:TimerEventDefinition"}},"escalation-intermediate-throw":{label:"Escalation intermediate throw event",className:"bpmn-icon-intermediate-event-throw-escalation",target:{type:"bpmn:IntermediateThrowEvent",eventDefinitionType:"bpmn:EscalationEventDefinition"}},"conditional-intermediate-catch":{label:"Conditional intermediate catch event",className:"bpmn-icon-intermediate-event-catch-condition",target:{type:"bpmn:IntermediateCatchEvent",eventDefinitionType:"bpmn:ConditionalEventDefinition"}},"link-intermediate-catch":{label:"Link intermediate catch event",className:"bpmn-icon-intermediate-event-catch-link",target:{type:"bpmn:IntermediateCatchEvent",eventDefinitionType:"bpmn:LinkEventDefinition",eventDefinitionAttrs:{name:""}}},"link-intermediate-throw":{label:"Link intermediate throw event",className:"bpmn-icon-intermediate-event-throw-link",target:{type:"bpmn:IntermediateThrowEvent",eventDefinitionType:"bpmn:LinkEventDefinition",eventDefinitionAttrs:{name:""}}},"compensation-intermediate-throw":{label:"Compensation intermediate throw event",className:"bpmn-icon-intermediate-event-throw-compensation",target:{type:"bpmn:IntermediateThrowEvent",eventDefinitionType:"bpmn:CompensateEventDefinition"}},"signal-intermediate-catch":{label:"Signal intermediate catch event",className:"bpmn-icon-intermediate-event-catch-signal",target:{type:"bpmn:IntermediateCatchEvent",eventDefinitionType:"bpmn:SignalEventDefinition"}},"signal-intermediate-throw":{label:"Signal intermediate throw event",className:"bpmn-icon-intermediate-event-throw-signal",target:{type:"bpmn:IntermediateThrowEvent",eventDefinitionType:"bpmn:SignalEventDefinition"}},"message-boundary":{label:"Message boundary event",className:"bpmn-icon-intermediate-event-catch-message",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:MessageEventDefinition",cancelActivity:!0}},"timer-boundary":{label:"Timer boundary event",className:"bpmn-icon-intermediate-event-catch-timer",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:TimerEventDefinition",cancelActivity:!0}},"escalation-boundary":{label:"Escalation boundary event",className:"bpmn-icon-intermediate-event-catch-escalation",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:EscalationEventDefinition",cancelActivity:!0}},"conditional-boundary":{label:"Conditional boundary event",className:"bpmn-icon-intermediate-event-catch-condition",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:ConditionalEventDefinition",cancelActivity:!0}},"error-boundary":{label:"Error boundary event",className:"bpmn-icon-intermediate-event-catch-error",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:ErrorEventDefinition",cancelActivity:!0}},"cancel-boundary":{label:"Cancel boundary event",className:"bpmn-icon-intermediate-event-catch-cancel",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:CancelEventDefinition",cancelActivity:!0}},"signal-boundary":{label:"Signal boundary event",className:"bpmn-icon-intermediate-event-catch-signal",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:SignalEventDefinition",cancelActivity:!0}},"compensation-boundary":{label:"Compensation boundary event",className:"bpmn-icon-intermediate-event-catch-compensation",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:CompensateEventDefinition",cancelActivity:!0}},"non-interrupting-message-boundary":{label:"Message boundary event (non-interrupting)",className:"bpmn-icon-intermediate-event-catch-non-interrupting-message",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:MessageEventDefinition",cancelActivity:!1}},"non-interrupting-timer-boundary":{label:"Timer boundary event (non-interrupting)",className:"bpmn-icon-intermediate-event-catch-non-interrupting-timer",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:TimerEventDefinition",cancelActivity:!1}},"non-interrupting-escalation-boundary":{label:"Escalation boundary event (non-interrupting)",className:"bpmn-icon-intermediate-event-catch-non-interrupting-escalation",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:EscalationEventDefinition",cancelActivity:!1}},"non-interrupting-conditional-boundary":{label:"Conditional boundary event (non-interrupting)",className:"bpmn-icon-intermediate-event-catch-non-interrupting-condition",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:ConditionalEventDefinition",cancelActivity:!1}},"non-interrupting-signal-boundary":{label:"Signal boundary event (non-interrupting)",className:"bpmn-icon-intermediate-event-catch-non-interrupting-signal",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:SignalEventDefinition",cancelActivity:!1}},"message-end":{label:"Message end event",className:"bpmn-icon-end-event-message",target:{type:"bpmn:EndEvent",eventDefinitionType:"bpmn:MessageEventDefinition"}},"escalation-end":{label:"Escalation end event",className:"bpmn-icon-end-event-escalation",target:{type:"bpmn:EndEvent",eventDefinitionType:"bpmn:EscalationEventDefinition"}},"error-end":{label:"Error end event",className:"bpmn-icon-end-event-error",target:{type:"bpmn:EndEvent",eventDefinitionType:"bpmn:ErrorEventDefinition"}},"cancel-end":{label:"Cancel end event",className:"bpmn-icon-end-event-cancel",target:{type:"bpmn:EndEvent",eventDefinitionType:"bpmn:CancelEventDefinition"}},"compensation-end":{label:"Compensation end event",className:"bpmn-icon-end-event-compensation",target:{type:"bpmn:EndEvent",eventDefinitionType:"bpmn:CompensateEventDefinition"}},"signal-end":{label:"Signal end event",className:"bpmn-icon-end-event-signal",target:{type:"bpmn:EndEvent",eventDefinitionType:"bpmn:SignalEventDefinition"}},"terminate-end":{label:"Terminate end event",className:"bpmn-icon-end-event-terminate",target:{type:"bpmn:EndEvent",eventDefinitionType:"bpmn:TerminateEventDefinition"}}};function G(e,t={}){var n=rM[e];if(!n)throw new Error("unknown popup entry <"+e+">");return{...n,actionName:"replace-with-"+e,...t}}var oM=[G("none-start-event",{actionName:"replace-with-none-start"}),G("none-intermediate-throwing"),G("none-end-event",{actionName:"replace-with-none-end"}),G("message-start"),G("timer-start"),G("conditional-start"),G("signal-start")],aM=[G("none-start-event",{actionName:"replace-with-none-start"}),G("none-intermediate-throwing"),G("none-end-event",{actionName:"replace-with-none-end"})],sM=[G("none-start-event",{actionName:"replace-with-none-start"}),G("none-intermediate-throwing",{actionName:"replace-with-none-intermediate-throw"}),G("none-end-event",{actionName:"replace-with-none-end"}),G("message-intermediate-catch"),G("message-intermediate-throw"),G("timer-intermediate-catch"),G("escalation-intermediate-throw"),G("conditional-intermediate-catch"),G("link-intermediate-catch"),G("link-intermediate-throw"),G("compensation-intermediate-throw"),G("signal-intermediate-catch"),G("signal-intermediate-throw")],cM=[G("none-start-event",{actionName:"replace-with-none-start"}),G("none-intermediate-throwing",{actionName:"replace-with-none-intermediate-throw"}),G("none-end-event",{actionName:"replace-with-none-end"}),G("message-end"),G("escalation-end"),G("error-end"),G("cancel-end"),G("compensation-end"),G("signal-end"),G("terminate-end")],uM=[G("exclusive-gateway"),G("parallel-gateway"),G("inclusive-gateway"),G("complex-gateway"),G("event-based-gateway")],lM=[G("transaction"),G("event-subprocess"),G("expanded-ad-hoc-subprocess",{actionName:"replace-with-ad-hoc-subprocess",label:"Ad-hoc sub-process"}),G("collapsed-subprocess")],pM=[G("expanded-subprocess",{actionName:"replace-with-subprocess",label:"Sub-process"}),G("transaction"),G("event-subprocess"),G("collapsed-ad-hoc-subprocess")],n_=[G("transaction"),G("expanded-subprocess",{actionName:"replace-with-subprocess",label:"Sub-process"}),G("expanded-ad-hoc-subprocess",{actionName:"replace-with-ad-hoc-subprocess",label:"Ad-hoc sub-process"}),G("event-subprocess")],fM=n_,i_=[G("task"),G("user-task"),G("service-task"),G("send-task"),G("receive-task"),G("manual-task"),G("rule-task"),G("script-task"),G("call-activity"),G("collapsed-subprocess"),G("expanded-subprocess"),G("collapsed-ad-hoc-subprocess"),G("expanded-ad-hoc-subprocess",{actionName:"replace-with-ad-hoc-subprocess"})],dM=[G("data-store-reference")],hM=[G("data-object-reference")],mM=[G("message-boundary"),G("timer-boundary"),G("escalation-boundary"),G("conditional-boundary"),G("error-boundary"),G("cancel-boundary"),G("signal-boundary"),G("compensation-boundary"),G("non-interrupting-message-boundary"),G("non-interrupting-timer-boundary"),G("non-interrupting-escalation-boundary"),G("non-interrupting-conditional-boundary"),G("non-interrupting-signal-boundary")],gM=[G("message-start"),G("timer-start"),G("conditional-start"),G("signal-start"),G("error-start"),G("escalation-start"),G("compensation-start"),G("non-interrupting-message-start"),G("non-interrupting-timer-start"),G("non-interrupting-conditional-start"),G("non-interrupting-signal-start"),G("non-interrupting-escalation-start")],vM=[{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"}],yM=[G("expanded-pool"),G("collapsed-pool",{label:function(e){var t="Empty pool/participant";return e.children&&e.children.length&&(t+=" (removes content)"),t}})],_M={"bpmn:MessageEventDefinition":[G("message-start"),G("message-intermediate-catch"),G("message-intermediate-throw"),G("message-end")],"bpmn:TimerEventDefinition":[G("timer-start"),G("timer-intermediate-catch")],"bpmn:ConditionalEventDefinition":[G("conditional-start"),G("conditional-intermediate-catch")],"bpmn:SignalEventDefinition":[G("signal-start"),G("signal-intermediate-catch"),G("signal-intermediate-throw"),G("signal-end")],"bpmn:ErrorEventDefinition":[G("error-start"),G("error-end")],"bpmn:EscalationEventDefinition":[G("escalation-start"),G("escalation-intermediate-throw"),G("escalation-end")],"bpmn:CompensateEventDefinition":[G("compensation-start"),G("compensation-intermediate-throw"),G("compensation-end")]};const r_={"start-event-non-interrupting":`
316
316
  <svg viewBox="0 0 2048 2048" xmlns="http://www.w3.org/2000/svg">
317
317
  <g transform="translate(0 995.64)">
318
318
  <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"/>
@@ -323,7 +323,7 @@
323
323
  <circle cx="1024" cy="28.357" r="875" stroke-dasharray="418.310422, 361.2328165" stroke-width="100"/>
324
324
  <circle cx="1024" cy="28.357" r="685" stroke-dasharray="348.31044857,261.23283643" stroke-dashoffset="500" stroke-width="100"/>
325
325
  </g>
326
- </svg>`};function on(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()}on.$inject=["bpmnFactory","popupMenu","modeling","moddle","bpmnReplace","rules","translate","moddleCopy"],on.prototype._register=function(){this._popupMenu.registerProvider("bpmn-replace",this)},on.prototype.getPopupMenuEntries=function(e){var s;var t=e.businessObject,n=this._rules,i=[],r,o=[];if(se(e)||!n.allowed("shape.replace",{element:e}))return{};var a=tT(e);return _(t,"bpmn:DataObjectReference")?this._createEntries(e,pT):_(t,"bpmn:DataStoreReference")&&!_(e.parent,"bpmn:Collaboration")?this._createEntries(e,fT):(_(t,"bpmn:Event")&&!_(t,"bpmn:BoundaryEvent")&&(r=(s=t.get("eventDefinitions")[0])==null?void 0:s.$type,i=vT[r]||[],!wt(t.$parent)&&_(t.$parent,"bpmn:SubProcess")&&(i=ye(i,function(c){return c.target.type!=="bpmn:StartEvent"}))),_(t,"bpmn:StartEvent")&&!_(t.$parent,"bpmn:SubProcess")?(o=ye(iT.concat(i),a),this._createEntries(e,o)):_(t,"bpmn:Participant")?(o=ye(gT,function(c){return Ee(e)!==c.target.isExpanded}),this._createEntries(e,o)):_(t,"bpmn:StartEvent")&&wt(t.$parent)?(o=ye(hT.concat(i),function(c){var u=c.target,l=u.isInterrupting!==!1,p=t.isInterrupting===l;return a(c)||!a(c)&&!p}),this._createEntries(e,o)):_(t,"bpmn:StartEvent")&&!wt(t.$parent)&&_(t.$parent,"bpmn:SubProcess")?(o=ye(rT.concat(i),a),this._createEntries(e,o)):_(t,"bpmn:EndEvent")?(o=ye(aT.concat(i),function(c){var u=c.target;return u.eventDefinitionType=="bpmn:CancelEventDefinition"&&!_(t.$parent,"bpmn:Transaction")?!1:a(c)}),this._createEntries(e,o)):_(t,"bpmn:BoundaryEvent")?(o=ye(dT,function(c){var u=c.target;if(u.eventDefinitionType=="bpmn:CancelEventDefinition"&&!_(t.attachedToRef,"bpmn:Transaction"))return!1;var l=u.cancelActivity!==!1,p=t.cancelActivity==l;return a(c)||!a(c)&&!p}),this._createEntries(e,o)):_(t,"bpmn:IntermediateCatchEvent")||_(t,"bpmn:IntermediateThrowEvent")?(o=ye(oT.concat(i),a),this._createEntries(e,o)):_(t,"bpmn:Gateway")?(o=ye(sT,a),this._createEntries(e,o)):_(t,"bpmn:Transaction")?(o=ye(py,a),this._createEntries(e,o)):wt(t)&&Ee(e)?(o=ye(lT,a),this._createEntries(e,o)):_(t,"bpmn:AdHocSubProcess")&&Ee(e)?(o=ye(uT,a),this._createEntries(e,o)):_(t,"bpmn:SubProcess")&&Ee(e)?(o=ye(cT,a),this._createEntries(e,o)):_(t,"bpmn:SubProcess")&&!Ee(e)?(o=ye(fy,function(c){var u=c.target.type===e.type,l=c.target.isExpanded===!0;return u===l}),this._createEntries(e,o)):_(t,"bpmn:SequenceFlow")?this._createSequenceFlowEntries(e,mT):_(t,"bpmn:FlowNode")?(o=ye(fy,a),this._createEntries(e,o)):{})},on.prototype.getPopupMenuHeaderEntries=function(e){var t={};return _(e,"bpmn:Activity")&&!wt(e)&&(t={...t,...this._getLoopCharacteristicsHeaderEntries(e)}),_(e,"bpmn:DataObjectReference")&&(t={...t,...this._getCollectionHeaderEntries(e)}),_(e,"bpmn:Participant")&&(t={...t,...this._getParticipantMultiplicityHeaderEntries(e)}),sh(e)&&(t={...t,...this._getNonInterruptingHeaderEntries(e)}),t},on.prototype._createEntries=function(e,t){var n={},i=this;return A(t,function(r){n[r.actionName]=i._createEntry(r,e)}),n},on.prototype._createSequenceFlowEntries=function(e,t){var n=V(e),i={},r=this._modeling,o=this._moddle,a=this;return A(t,function(s){switch(s.actionName){case"replace-with-default-flow":n.sourceRef.default!==n&&(_(n.sourceRef,"bpmn:ExclusiveGateway")||_(n.sourceRef,"bpmn:InclusiveGateway")||_(n.sourceRef,"bpmn:ComplexGateway")||_(n.sourceRef,"bpmn:Activity"))&&(i={...i,[s.actionName]:a._createEntry(s,e,function(){r.updateProperties(e.source,{default:n})})});break;case"replace-with-conditional-flow":!n.conditionExpression&&_(n.sourceRef,"bpmn:Activity")&&(i={...i,[s.actionName]:a._createEntry(s,e,function(){var c=o.create("bpmn:FormalExpression",{body:""});r.updateProperties(e,{conditionExpression:c})})});break;default:_(n.sourceRef,"bpmn:Activity")&&n.conditionExpression&&(i={...i,[s.actionName]:a._createEntry(s,e,function(){r.updateProperties(e,{conditionExpression:void 0})})}),(_(n.sourceRef,"bpmn:ExclusiveGateway")||_(n.sourceRef,"bpmn:InclusiveGateway")||_(n.sourceRef,"bpmn:ComplexGateway")||_(n.sourceRef,"bpmn:Activity"))&&n.sourceRef.default===n&&(i={...i,[s.actionName]:a._createEntry(s,e,function(){r.updateProperties(e.source,{default:void 0})})})}}),i},on.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}},on.prototype._getLoopCharacteristicsHeaderEntries=function(e){var t=this,n=this._translate;function i(u,l){if(l.active){t._modeling.updateProperties(e,{loopCharacteristics:void 0});return}var p=e.businessObject.get("loopCharacteristics");p&&_(p,l.options.loopCharacteristics)?t._modeling.updateModdleProperties(e,p,{isSequential:l.options.isSequential}):(p=t._moddle.create(l.options.loopCharacteristics,{isSequential:l.options.isSequential}),t._modeling.updateProperties(e,{loopCharacteristics:p}))}var r=V(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"}}}},on.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}}},on.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}}},on.prototype._getNonInterruptingHeaderEntries=function(e){const t=this._translate,n=V(e),i=this,r=ch(e),o=_(e,"bpmn:BoundaryEvent")?dy["intermediate-event-non-interrupting"]:dy["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 yT={__depends__:[Kl,Am,_s],__init__:["replaceMenuProvider"],replaceMenuProvider:["type",on]};function No(e,t,n,i,r,o,a,s,c,u,l,p,f){e=e||{},i.registerProvider(this),this._contextPad=i,this._modeling=r,this._elementFactory=o,this._connect=a,this._create=s,this._popupMenu=c,this._canvas=u,this._rules=l,this._translate=p,this._eventBus=n,this._appendPreview=f,e.autoPlace!==!1&&(this._autoPlace=t.get("autoPlace",!1)),n.on("create.end",250,function(d){var h=d.context,g=h.shape;if(!(!so(d)||!i.isOpen(g))){var y=i.getEntries(g);y.replace&&y.replace.action.click(d,g)}}),n.on("contextPad.close",function(){f.cleanUp()})}No.$inject=["config.contextPad","injector","eventBus","contextPad","modeling","elementFactory","connect","create","popupMenu","canvas","rules","translate","appendPreview"],No.prototype.getMultiElementContextPadEntries=function(e){var t=this._modeling,n={};return this._isDeleteAllowed(e)&&k(n,{delete:{group:"edit",className:"bpmn-icon-trash",title:this._translate("Delete"),action:{click:function(i,r){t.removeElements(r.slice())}}}}),n},No.prototype._isDeleteAllowed=function(e){var t=this._rules.allowed("elements.delete",{elements:e});return se(t)?Ai(e,n=>t.includes(n)):t},No.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])&&k(l,h()),l;var p=e.businessObject;function f(E,x){r.start(E,x)}function d(E,x){n.removeElements([x])}function h(){return{delete:{group:"edit",className:"bpmn-icon-trash",title:c("Delete"),action:{click:d}}}}function g(E){var x=5,R=t.getPad(E).html,M=R.getBoundingClientRect(),O={x:M.left,y:M.bottom+x};return O}function y(E,x,R,M){function O($,I){var G=i.createShape(k({type:E},M));o.start($,G,{source:I})}var P=s?function($,I){var G=i.createShape(k({type:E},M));s.append(I,G)}:O,j=s?function($,I){return u.create(I,E,M),()=>{u.cleanUp()}}:null;return{group:"model",className:x,title:R,action:{dragstart:O,click:P,hover:j}}}function S(E){return function(x,R){n.splitLane(R,E),t.open(R,!0)}}if(ve(p,["bpmn:Lane","bpmn:Participant"])&&Ee(e)){var w=ci(e);k(l,{"lane-insert-above":{group:"lane-insert-above",className:"bpmn-icon-lane-insert-above",title:c("Add lane above"),action:{click:function(E,x){n.addLane(x,"top")}}}}),w.length<2&&((pt(e)?e.height>=120:e.width>=120)&&k(l,{"lane-divide-two":{group:"lane-divide",className:"bpmn-icon-lane-divide-two",title:c("Divide into two lanes"),action:{click:S(2)}}}),(pt(e)?e.height>=180:e.width>=180)&&k(l,{"lane-divide-three":{group:"lane-divide",className:"bpmn-icon-lane-divide-three",title:c("Divide into three lanes"),action:{click:S(3)}}})),k(l,{"lane-insert-below":{group:"lane-insert-below",className:"bpmn-icon-lane-insert-below",title:c("Add lane below"),action:{click:function(E,x){n.addLane(x,"bottom")}}}})}return _(p,"bpmn:FlowNode")&&(_(p,"bpmn:EventBasedGateway")?k(l,{"append.receive-task":y("bpmn:ReceiveTask","bpmn-icon-receive-task",c("Append receive task")),"append.message-intermediate-event":y("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-message",c("Append message intermediate catch event"),{eventDefinitionType:"bpmn:MessageEventDefinition"}),"append.timer-intermediate-event":y("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-timer",c("Append timer intermediate catch event"),{eventDefinitionType:"bpmn:TimerEventDefinition"}),"append.condition-intermediate-event":y("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-condition",c("Append conditional intermediate catch event"),{eventDefinitionType:"bpmn:ConditionalEventDefinition"}),"append.signal-intermediate-event":y("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-signal",c("Append signal intermediate catch event"),{eventDefinitionType:"bpmn:SignalEventDefinition"})}):hy(p,"bpmn:BoundaryEvent","bpmn:CompensateEventDefinition")?k(l,{"append.compensation-activity":y("bpmn:Task","bpmn-icon-task",c("Append compensation activity"),{isForCompensation:!0})}):!_(p,"bpmn:EndEvent")&&!p.isForCompensation&&!hy(p,"bpmn:IntermediateThrowEvent","bpmn:LinkEventDefinition")&&!wt(p)&&k(l,{"append.end-event":y("bpmn:EndEvent","bpmn-icon-end-event-none",c("Append end event")),"append.gateway":y("bpmn:ExclusiveGateway","bpmn-icon-gateway-none",c("Append gateway")),"append.append-task":y("bpmn:Task","bpmn-icon-task",c("Append task")),"append.intermediate-event":y("bpmn:IntermediateThrowEvent","bpmn-icon-intermediate-event-none",c("Append intermediate/boundary event"))})),a.isEmpty(e,"bpmn-replace")||k(l,{replace:{group:"edit",className:"bpmn-icon-screw-wrench",title:c("Change element"),action:{click:function(E,x){var R=k(g(x),{cursor:{x:E.x,y:E.y}});a.open(x,"bpmn-replace",R,{title:c("Change element"),width:"var(--bpmn-replace-popup-width, 300px)",search:!0})}}}}),_(p,"bpmn:SequenceFlow")&&k(l,{"append.text-annotation":y("bpmn:TextAnnotation","bpmn-icon-text-annotation",c("Add text annotation"))}),_(p,"bpmn:MessageFlow")&&k(l,{"append.text-annotation":y("bpmn:TextAnnotation","bpmn-icon-text-annotation",c("Add text annotation"))}),ve(p,["bpmn:FlowNode","bpmn:InteractionNode","bpmn:DataObjectReference","bpmn:DataStoreReference"])&&k(l,{"append.text-annotation":y("bpmn:TextAnnotation","bpmn-icon-text-annotation",c("Add text annotation")),connect:{group:"connect",className:"bpmn-icon-connection-multi",title:c("Connect to other element"),action:{click:f,dragstart:f}}}),_(p,"bpmn:TextAnnotation")&&k(l,{connect:{group:"connect",className:"bpmn-icon-connection-multi",title:c("Connect using association"),action:{click:f,dragstart:f}}}),ve(p,["bpmn:DataObjectReference","bpmn:DataStoreReference"])&&k(l,{connect:{group:"connect",className:"bpmn-icon-connection-multi",title:c("Connect using data input association"),action:{click:f,dragstart:f}}}),_(p,"bpmn:Group")&&k(l,{"append.text-annotation":y("bpmn:TextAnnotation","bpmn-icon-text-annotation",c("Add text annotation"))}),this._isDeleteAllowed([e])&&k(l,h()),l};function hy(e,t,n){var i=e.$instanceOf(t),r=!1,o=e.eventDefinitions||[];return A(o,function(a){a.$type===n&&(r=!0)}),i&&r}const _T={__depends__:[ZA,ly,Vg,en,ip,Za,yT],__init__:["contextPadProvider"],contextPadProvider:["type",No]};var bT={horizontal:["x","width"],vertical:["y","height"]},my=5;function Yn(e,t){this._modeling=e,this._filters=[],this.registerFilter(function(n){var i=t.allowed("elements.distribute",{elements:n});return se(i)?i:i?n:[]})}Yn.$inject=["modeling","rules"],Yn.prototype.registerFilter=function(e){if(typeof e!="function")throw new Error("the filter has to be a function");this._filters.push(e)},Yn.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},Yn.prototype._filterElements=function(e){var t=this._filters,n=this._axis,i=this._dimension,r=[].concat(e);return t.length?(A(t,function(o){r=o(r,n,i)}),r):e},Yn.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=dn(e,i);return A(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},Yn.prototype._setOrientation=function(e){var t=bT[e];this._axis=t[0],this._dimension=t[1]},Yn.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)},Yn.prototype._findRange=function(e){var t=e[this._axis],n=e[this._dimension];return{min:t+my,max:t+n-my}};const ET={__init__:["distributeElements"],distributeElements:["type",Yn]};function qs(e){Jt.call(this,e)}qs.$inject=["eventBus"],X(qs,Jt),qs.prototype.init=function(){this.addRule("elements.distribute",function(e){var t=e.elements;return t=ye(t,function(n){var i=ve(n,["bpmn:Association","bpmn:BoundaryEvent","bpmn:DataInputAssociation","bpmn:DataOutputAssociation","bpmn:Lane","bpmn:MessageFlow","bpmn:SequenceFlow","bpmn:TextAnnotation"]);return!(n.labelTarget||i)}),t=ua(t),t.length<3?!1:t})};var gy={horizontal:`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1800 1800">
326
+ </svg>`};function Cn(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()}Cn.$inject=["bpmnFactory","popupMenu","modeling","moddle","bpmnReplace","rules","translate","moddleCopy"],Cn.prototype._register=function(){this._popupMenu.registerProvider("bpmn-replace",this)},Cn.prototype.getPopupMenuEntries=function(e){var s;var t=e.businessObject,n=this._rules,i=[],r,o=[];if(pe(e)||!n.allowed("shape.replace",{element:e}))return{};var a=iM(e);return y(t,"bpmn:DataObjectReference")?this._createEntries(e,dM):y(t,"bpmn:DataStoreReference")&&!y(e.parent,"bpmn:Collaboration")?this._createEntries(e,hM):(y(t,"bpmn:Event")&&!y(t,"bpmn:BoundaryEvent")&&(r=(s=t.get("eventDefinitions")[0])==null?void 0:s.$type,i=_M[r]||[],!jt(t.$parent)&&y(t.$parent,"bpmn:SubProcess")&&(i=we(i,function(c){return c.target.type!=="bpmn:StartEvent"}))),y(t,"bpmn:StartEvent")&&!y(t.$parent,"bpmn:SubProcess")?(o=we(oM.concat(i),a),this._createEntries(e,o)):y(t,"bpmn:Participant")?(o=we(yM,function(c){return Re(e)!==c.target.isExpanded}),this._createEntries(e,o)):y(t,"bpmn:StartEvent")&&jt(t.$parent)?(o=we(gM.concat(i),function(c){var u=c.target,l=u.isInterrupting!==!1,p=t.isInterrupting===l;return a(c)||!a(c)&&!p}),this._createEntries(e,o)):y(t,"bpmn:StartEvent")&&!jt(t.$parent)&&y(t.$parent,"bpmn:SubProcess")?(o=we(aM.concat(i),a),this._createEntries(e,o)):y(t,"bpmn:EndEvent")?(o=we(cM.concat(i),function(c){var u=c.target;return u.eventDefinitionType=="bpmn:CancelEventDefinition"&&!y(t.$parent,"bpmn:Transaction")?!1:a(c)}),this._createEntries(e,o)):y(t,"bpmn:BoundaryEvent")?(o=we(mM,function(c){var u=c.target;if(u.eventDefinitionType=="bpmn:CancelEventDefinition"&&!y(t.attachedToRef,"bpmn:Transaction"))return!1;var l=u.cancelActivity!==!1,p=t.cancelActivity==l;return a(c)||!a(c)&&!p}),this._createEntries(e,o)):y(t,"bpmn:IntermediateCatchEvent")||y(t,"bpmn:IntermediateThrowEvent")?(o=we(sM.concat(i),a),this._createEntries(e,o)):y(t,"bpmn:Gateway")?(o=we(uM,a),this._createEntries(e,o)):y(t,"bpmn:Transaction")?(o=we(n_,a),this._createEntries(e,o)):jt(t)&&Re(e)?(o=we(fM,a),this._createEntries(e,o)):y(t,"bpmn:AdHocSubProcess")&&Re(e)?(o=we(pM,a),this._createEntries(e,o)):y(t,"bpmn:SubProcess")&&Re(e)?(o=we(lM,a),this._createEntries(e,o)):y(t,"bpmn:SubProcess")&&!Re(e)?(o=we(i_,function(c){var u=c.target.type===e.type,l=c.target.isExpanded===!0;return u===l}),this._createEntries(e,o)):y(t,"bpmn:SequenceFlow")?this._createSequenceFlowEntries(e,vM):y(t,"bpmn:FlowNode")?(o=we(i_,a),this._createEntries(e,o)):{})},Cn.prototype.getPopupMenuHeaderEntries=function(e){var t={};return y(e,"bpmn:Activity")&&!jt(e)&&(t={...t,...this._getLoopCharacteristicsHeaderEntries(e)}),y(e,"bpmn:DataObjectReference")&&(t={...t,...this._getCollectionHeaderEntries(e)}),y(e,"bpmn:Participant")&&(t={...t,...this._getParticipantMultiplicityHeaderEntries(e)}),Qh(e)&&(t={...t,...this._getNonInterruptingHeaderEntries(e)}),t},Cn.prototype._createEntries=function(e,t){var n={},i=this;return T(t,function(r){n[r.actionName]=i._createEntry(r,e)}),n},Cn.prototype._createSequenceFlowEntries=function(e,t){var n=U(e),i={},r=this._modeling,o=this._moddle,a=this;return T(t,function(s){switch(s.actionName){case"replace-with-default-flow":n.sourceRef.default!==n&&(y(n.sourceRef,"bpmn:ExclusiveGateway")||y(n.sourceRef,"bpmn:InclusiveGateway")||y(n.sourceRef,"bpmn:ComplexGateway")||y(n.sourceRef,"bpmn:Activity"))&&(i={...i,[s.actionName]:a._createEntry(s,e,function(){r.updateProperties(e.source,{default:n})})});break;case"replace-with-conditional-flow":!n.conditionExpression&&y(n.sourceRef,"bpmn:Activity")&&(i={...i,[s.actionName]:a._createEntry(s,e,function(){var c=o.create("bpmn:FormalExpression",{body:""});r.updateProperties(e,{conditionExpression:c})})});break;default:y(n.sourceRef,"bpmn:Activity")&&n.conditionExpression&&(i={...i,[s.actionName]:a._createEntry(s,e,function(){r.updateProperties(e,{conditionExpression:void 0})})}),(y(n.sourceRef,"bpmn:ExclusiveGateway")||y(n.sourceRef,"bpmn:InclusiveGateway")||y(n.sourceRef,"bpmn:ComplexGateway")||y(n.sourceRef,"bpmn:Activity"))&&n.sourceRef.default===n&&(i={...i,[s.actionName]:a._createEntry(s,e,function(){r.updateProperties(e.source,{default:void 0})})})}}),i},Cn.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}},Cn.prototype._getLoopCharacteristicsHeaderEntries=function(e){var t=this,n=this._translate;function i(u,l){if(l.active){t._modeling.updateProperties(e,{loopCharacteristics:void 0});return}var p=e.businessObject.get("loopCharacteristics");p&&y(p,l.options.loopCharacteristics)?t._modeling.updateModdleProperties(e,p,{isSequential:l.options.isSequential}):(p=t._moddle.create(l.options.loopCharacteristics,{isSequential:l.options.isSequential}),t._modeling.updateProperties(e,{loopCharacteristics:p}))}var r=U(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"}}}},Cn.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}}},Cn.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}}},Cn.prototype._getNonInterruptingHeaderEntries=function(e){const t=this._translate,n=U(e),i=this,r=Jh(e),o=y(e,"bpmn:BoundaryEvent")?r_["intermediate-event-non-interrupting"]:r_["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 bM={__depends__:[Tp,_g,Ys],__init__:["replaceMenuProvider"],replaceMenuProvider:["type",Cn]};function da(e,t,n,i,r,o,a,s,c,u,l,p,f){e=e||{},i.registerProvider(this),this._contextPad=i,this._modeling=r,this._elementFactory=o,this._connect=a,this._create=s,this._popupMenu=c,this._canvas=u,this._rules=l,this._translate=p,this._eventBus=n,this._appendPreview=f,e.autoPlace!==!1&&(this._autoPlace=t.get("autoPlace",!1)),n.on("create.end",250,function(d){var h=d.context,m=h.shape;if(!(!$o(d)||!i.isOpen(m))){var g=i.getEntries(m);g.replace&&g.replace.action.click(d,m)}}),n.on("contextPad.close",function(){f.cleanUp()})}da.$inject=["config.contextPad","injector","eventBus","contextPad","modeling","elementFactory","connect","create","popupMenu","canvas","rules","translate","appendPreview"],da.prototype.getMultiElementContextPadEntries=function(e){var t=this._modeling,n={};return this._isDeleteAllowed(e)&&k(n,{delete:{group:"edit",className:"bpmn-icon-trash",title:this._translate("Delete"),action:{click:function(i,r){t.removeElements(r.slice())}}}}),n},da.prototype._isDeleteAllowed=function(e){var t=this._rules.allowed("elements.delete",{elements:e});return pe(t)?tr(e,n=>t.includes(n)):t},da.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])&&k(l,h()),l;var p=e.businessObject;function f(b,x){r.start(b,x)}function d(b,x){n.removeElements([x])}function h(){return{delete:{group:"edit",className:"bpmn-icon-trash",title:c("Delete"),action:{click:d}}}}function m(b){var x=5,S=t.getPad(b).html,A=S.getBoundingClientRect(),I={x:A.left,y:A.bottom+x};return I}function g(b,x,S,A){function I(j,L){var F=i.createShape(k({type:b},A));o.start(j,F,{source:L})}var C=s?function(j,L){var F=i.createShape(k({type:b},A));s.append(L,F)}:I,$=s?function(j,L){return u.create(L,b,A),()=>{u.cleanUp()}}:null;return{group:"model",className:x,title:S,action:{dragstart:I,click:C,hover:$}}}function w(b){return function(x,S){n.splitLane(S,b),t.open(S,!0)}}if(xe(p,["bpmn:Lane","bpmn:Participant"])&&Re(e)){var E=Li(e);k(l,{"lane-insert-above":{group:"lane-insert-above",className:"bpmn-icon-lane-insert-above",title:c("Add lane above"),action:{click:function(b,x){n.addLane(x,"top")}}}}),E.length<2&&((St(e)?e.height>=120:e.width>=120)&&k(l,{"lane-divide-two":{group:"lane-divide",className:"bpmn-icon-lane-divide-two",title:c("Divide into two lanes"),action:{click:w(2)}}}),(St(e)?e.height>=180:e.width>=180)&&k(l,{"lane-divide-three":{group:"lane-divide",className:"bpmn-icon-lane-divide-three",title:c("Divide into three lanes"),action:{click:w(3)}}})),k(l,{"lane-insert-below":{group:"lane-insert-below",className:"bpmn-icon-lane-insert-below",title:c("Add lane below"),action:{click:function(b,x){n.addLane(x,"bottom")}}}})}return y(p,"bpmn:FlowNode")&&(y(p,"bpmn:EventBasedGateway")?k(l,{"append.receive-task":g("bpmn:ReceiveTask","bpmn-icon-receive-task",c("Append receive task")),"append.message-intermediate-event":g("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-message",c("Append message intermediate catch event"),{eventDefinitionType:"bpmn:MessageEventDefinition"}),"append.timer-intermediate-event":g("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-timer",c("Append timer intermediate catch event"),{eventDefinitionType:"bpmn:TimerEventDefinition"}),"append.condition-intermediate-event":g("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-condition",c("Append conditional intermediate catch event"),{eventDefinitionType:"bpmn:ConditionalEventDefinition"}),"append.signal-intermediate-event":g("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-signal",c("Append signal intermediate catch event"),{eventDefinitionType:"bpmn:SignalEventDefinition"})}):o_(p,"bpmn:BoundaryEvent","bpmn:CompensateEventDefinition")?k(l,{"append.compensation-activity":g("bpmn:Task","bpmn-icon-task",c("Append compensation activity"),{isForCompensation:!0})}):!y(p,"bpmn:EndEvent")&&!p.isForCompensation&&!o_(p,"bpmn:IntermediateThrowEvent","bpmn:LinkEventDefinition")&&!jt(p)&&k(l,{"append.end-event":g("bpmn:EndEvent","bpmn-icon-end-event-none",c("Append end event")),"append.gateway":g("bpmn:ExclusiveGateway","bpmn-icon-gateway-none",c("Append gateway")),"append.append-task":g("bpmn:Task","bpmn-icon-task",c("Append task")),"append.intermediate-event":g("bpmn:IntermediateThrowEvent","bpmn-icon-intermediate-event-none",c("Append intermediate/boundary event"))})),a.isEmpty(e,"bpmn-replace")||k(l,{replace:{group:"edit",className:"bpmn-icon-screw-wrench",title:c("Change element"),action:{click:function(b,x){var S=k(m(x),{cursor:{x:b.x,y:b.y}});a.open(x,"bpmn-replace",S,{title:c("Change element"),width:"var(--bpmn-replace-popup-width, 300px)",search:!0})}}}}),y(p,"bpmn:SequenceFlow")&&k(l,{"append.text-annotation":g("bpmn:TextAnnotation","bpmn-icon-text-annotation",c("Add text annotation"))}),y(p,"bpmn:MessageFlow")&&k(l,{"append.text-annotation":g("bpmn:TextAnnotation","bpmn-icon-text-annotation",c("Add text annotation"))}),xe(p,["bpmn:FlowNode","bpmn:InteractionNode","bpmn:DataObjectReference","bpmn:DataStoreReference"])&&k(l,{"append.text-annotation":g("bpmn:TextAnnotation","bpmn-icon-text-annotation",c("Add text annotation")),connect:{group:"connect",className:"bpmn-icon-connection-multi",title:c("Connect to other element"),action:{click:f,dragstart:f}}}),y(p,"bpmn:TextAnnotation")&&k(l,{connect:{group:"connect",className:"bpmn-icon-connection-multi",title:c("Connect using association"),action:{click:f,dragstart:f}}}),xe(p,["bpmn:DataObjectReference","bpmn:DataStoreReference"])&&k(l,{connect:{group:"connect",className:"bpmn-icon-connection-multi",title:c("Connect using data input association"),action:{click:f,dragstart:f}}}),y(p,"bpmn:Group")&&k(l,{"append.text-annotation":g("bpmn:TextAnnotation","bpmn-icon-text-annotation",c("Add text annotation"))}),this._isDeleteAllowed([e])&&k(l,h()),l};function o_(e,t,n){var i=e.$instanceOf(t),r=!1,o=e.eventDefinitions||[];return T(o,function(a){a.$type===n&&(r=!0)}),i&&r}const xM={__depends__:[JT,t_,Iv,En,Np,Cs,bM],__init__:["contextPadProvider"],contextPadProvider:["type",da]};var EM={horizontal:["x","width"],vertical:["y","height"]},a_=5;function gi(e,t){this._modeling=e,this._filters=[],this.registerFilter(function(n){var i=t.allowed("elements.distribute",{elements:n});return pe(i)?i:i?n:[]})}gi.$inject=["modeling","rules"],gi.prototype.registerFilter=function(e){if(typeof e!="function")throw new Error("the filter has to be a function");this._filters.push(e)},gi.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},gi.prototype._filterElements=function(e){var t=this._filters,n=this._axis,i=this._dimension,r=[].concat(e);return t.length?(T(t,function(o){r=o(r,n,i)}),r):e},gi.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=In(e,i);return T(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},gi.prototype._setOrientation=function(e){var t=EM[e];this._axis=t[0],this._dimension=t[1]},gi.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)},gi.prototype._findRange=function(e){var t=e[this._axis],n=e[this._dimension];return{min:t+a_,max:t+n-a_}};const wM={__init__:["distributeElements"],distributeElements:["type",gi]};function Ec(e){xn.call(this,e)}Ec.$inject=["eventBus"],Q(Ec,xn),Ec.prototype.init=function(){this.addRule("elements.distribute",function(e){var t=e.elements;return t=we(t,function(n){var i=xe(n,["bpmn:Association","bpmn:BoundaryEvent","bpmn:DataInputAssociation","bpmn:DataOutputAssociation","bpmn:Lane","bpmn:MessageFlow","bpmn:SequenceFlow","bpmn:TextAnnotation"]);return!(n.labelTarget||i)}),t=$a(t),t.length<3?!1:t})};var s_={horizontal:`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1800 1800">
327
327
  <polyline points="450 400 450 150 1350 150 1350 400" style="fill:none;stroke:currentColor;stroke-width:100;stroke-linejoin:round;"/>
328
328
  <rect x="150" y="450" width="600" height="1200" rx="1" style="fill:none;stroke:currentColor;stroke-width:100;"></rect>
329
329
  <rect x="1050" y="450" width="600" height="800" rx="1" style="fill:currentColor;stroke:currentColor;stroke-width:100;opacity:.5;"></rect>
@@ -331,7 +331,7 @@
331
331
  <polyline points="400 1350 150 1350 150 450 400 450" style="fill:none;stroke:currentColor;stroke-width:100;stroke-linejoin:round;"/>
332
332
  <rect x="450" y="150" width="1200" height="600" rx="1" style="fill:none;stroke:currentColor;stroke-width:100;"></rect>
333
333
  <rect x="450" y="1050" width="800" height="600" rx="1" style="fill:currentColor;stroke:currentColor;stroke-width:100;opacity:.5;"></rect>
334
- </svg>`},xT=900;function $o(e,t,n,i){this._distributeElements=t,this._translate=n,this._popupMenu=e,this._rules=i,e.registerProvider("align-elements",xT,this)}$o.$inject=["popupMenu","distributeElements","translate","rules"],$o.prototype.getPopupMenuEntries=function(e){var t={};return this._isAllowed(e)&&k(t,this._getEntries(e)),t},$o.prototype._isAllowed=function(e){return this._rules.allowed("elements.distribute",{elements:e})},$o.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:gy.horizontal,action:function(o,a){t.trigger(e,"horizontal"),i.close()}},"distribute-elements-vertical":{group:"distribute",title:n("Distribute elements vertically"),imageHtml:gy.vertical,action:function(o,a){t.trigger(e,"vertical"),i.close()}}};return r};const wT={__depends__:[Kl,ET],__init__:["bpmnDistributeElements","distributeElementsMenuProvider"],bpmnDistributeElements:["type",qs],distributeElementsMenuProvider:["type",$o]};var vy="is not a registered action",ST="is already registered";function an(e,t){this._eventBus=e,this._actions={};var n=this;e.on("diagram.init",function(){n._registerDefaultActions(t),e.fire("editorActions.init",{editorActions:n})})}an.$inject=["eventBus","injector"],an.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=se(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&&(se(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)})},an.prototype.trigger=function(e,t){if(!this._actions[e])throw op(e,vy);var n=this._eventBus.fire("editorActions.allowed",{action:e,opts:t});if(n!==!1)return this._actions[e](t)},an.prototype.register=function(e,t){var n=this;if(typeof e=="string")return this._registerAction(e,t);A(e,function(i,r){n._registerAction(r,i)})},an.prototype._registerAction=function(e,t){if(this.isRegistered(e))throw op(e,ST);this._actions[e]=t},an.prototype.unregister=function(e){if(!this.isRegistered(e))throw op(e,vy);this._actions[e]=void 0},an.prototype.getActions=function(){return Object.keys(this._actions)},an.prototype.isRegistered=function(e){return!!this._actions[e]};function op(e,t){return new Error(e+" "+t)}const RT={__init__:["editorActions"],editorActions:["type",an]};function Ys(e){e.invoke(an,this)}X(Ys,an),Ys.$inject=["injector"],Ys.prototype._registerDefaultActions=function(e){an.prototype._registerDefaultActions.call(this,e);var t=e.get("canvas",!1),n=e.get("elementRegistry",!1),i=e.get("selection",!1),r=e.get("spaceTool",!1),o=e.get("lassoTool",!1),a=e.get("handTool",!1),s=e.get("globalConnect",!1),c=e.get("distributeElements",!1),u=e.get("alignElements",!1),l=e.get("directEditing",!1),p=e.get("searchPad",!1),f=e.get("modeling",!1),d=e.get("contextPad",!1);t&&n&&i&&this._registerAction("selectElements",function(){var h=t.getRootElement(),g=n.filter(function(y){return y!==h});return i.select(g),g}),r&&this._registerAction("spaceTool",function(){r.toggle()}),o&&this._registerAction("lassoTool",function(){o.toggle()}),a&&this._registerAction("handTool",function(){a.toggle()}),s&&this._registerAction("globalConnectTool",function(){s.toggle()}),i&&c&&this._registerAction("distributeElements",function(h){var g=i.get(),y=h.type;g.length&&c.trigger(g,y)}),i&&u&&this._registerAction("alignElements",function(h){var g=i.get(),y=[],S=h.type;g.length&&(y=ye(g,function(w){return!_(w,"bpmn:Lane")}),u.trigger(y,S))}),i&&f&&this._registerAction("setColor",function(h){var g=i.get();g.length&&f.setColor(g,h)}),i&&l&&this._registerAction("directEditing",function(){var h=i.get();h.length&&l.activate(h[0])}),p&&this._registerAction("find",function(){p.toggle()}),t&&f&&this._registerAction("moveToOrigin",function(){var h=t.getRootElement(),g,y;_(h,"bpmn:Collaboration")?y=n.filter(function(S){return _(S.parent,"bpmn:Collaboration")}):y=n.filter(function(S){return S!==h&&!_(S.parent,"bpmn:SubProcess")}),g=Ke(y),f.moveElements(y,{x:-g.x,y:-g.y},h)}),i&&d&&this._registerAction("replaceElement",function(h){d.triggerEntry("replace","click",h)})};const CT={__depends__:[RT],editorActions:["type",Ys]};function yy(e){e.on(["create.init","shape.move.init"],function(t){var n=t.context,i=t.shape;ve(i,["bpmn:Participant","bpmn:SubProcess","bpmn:TextAnnotation"])&&(n.gridSnappingContext||(n.gridSnappingContext={}),n.gridSnappingContext.snapLocation="top-left")})}yy.$inject=["eventBus"];function Yi(e,t){z.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;kt(a)?r.newBounds=n.snapComplex(c,a):r.newBounds=n.snapSimple(s,c)}})}Yi.$inject=["eventBus","gridSnapping","modeling"],X(Yi,z),Yi.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},Yi.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},Yi.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),k(e,o),e},Yi.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),k(e,o),e};var PT=2e3;function _y(e,t){e.on(["spaceTool.move","spaceTool.end"],PT,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)}})}_y.$inject=["eventBus","gridSnapping"];const AT={__init__:["gridSnappingResizeBehavior","gridSnappingSpaceToolBehavior"],gridSnappingResizeBehavior:["type",Yi],gridSnappingSpaceToolBehavior:["type",_y]};var Ks=10;function ap(e,t,n){return n||(n="round"),Math[n](e/t)*t}var TT=1200,MT=800;function Ei(e,t,n){var i=!n||n.active!==!1;this._eventBus=t;var r=this;t.on("diagram.init",MT,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"],TT,function(o){var a=o.originalEvent;if(!(!r.active||a&&Nt(a))){var s=o.context,c=s.gridSnappingContext;c||(c=s.gridSnappingContext={}),["x","y"].forEach(function(u){var l={},p=DT(o,u,e);p&&(l.offset=p);var f=kT(o,u);f&&k(l,f),Or(o,u)||r.snapEvent(o,u,l)})}})}Ei.prototype.snapEvent=function(e,t,n){var i=this.snapValue(e[t],n);Je(e,t,i)},Ei.prototype.getGridSpacing=function(){return Ks},Ei.prototype.snapValue=function(e,t){var n=0;t&&t.offset&&(n=t.offset),e+=n,e=ap(e,Ks);var i,r;return t&&t.min&&(i=t.min,le(i)&&(i=ap(i+n,Ks,"ceil"),e=Math.max(e,i))),t&&t.max&&(r=t.max,le(r)&&(r=ap(r+n,Ks,"floor"),e=Math.min(e,r))),e-=n,e},Ei.prototype.isActive=function(){return this.active},Ei.prototype.setActive=function(e){this.active=e,this._eventBus.fire("gridSnapping.toggle",{active:e})},Ei.prototype.toggleActive=function(){this.setActive(!this.active)},Ei.$inject=["elementRegistry","eventBus","config.gridSnapping"];function kT(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&&(Xs(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&&(Xs(t)?Ey(s)?a.x.max=c.left:a.x.min=c.right:by(s)?a.y.max=c.top:a.y.min=c.bottom),u&&(Xs(t)?Ey(s)?a.x.min=u.left:a.x.max=u.right:by(s)?a.y.min=u.top:a.y.max=u.bottom),a[t]}function DT(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)||(Xs(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 Xs(e){return e==="x"}function by(e){return e.indexOf("n")!==-1}function Ey(e){return e.indexOf("w")!==-1}const OT={__depends__:[AT],__init__:["gridSnapping"],gridSnapping:["type",Ei]};var IT=2e3;function xy(e,t,n){e.on("autoPlace",IT,function(i){var r=i.source,o=ce(r),a=i.shape,s=bg(r,a,n);return["x","y"].forEach(function(c){var u={};s[c]!==o[c]&&(s[c]>o[c]?u.min=s[c]:u.max=s[c],_(a,"bpmn:TextAnnotation")&&(LT(c)?u.offset=-a.width/2:u.offset=-a.height/2),s[c]=t.snapValue(s[c],u))}),s})}xy.$inject=["eventBus","gridSnapping","elementRegistry"];function LT(e){return e==="x"}var BT=1750;function wy(e,t,n){t.on(["create.start","shape.move.start"],BT,function(i){var r=i.context,o=r.shape,a=e.getRootElement();if(!(!_(o,"bpmn:Participant")||!_(a,"bpmn:Process")||!a.children.length)){var s=r.createConstraints;s&&(o.width=n.snapValue(o.width,{min:o.width}),o.height=n.snapValue(o.height,{min:o.height}))}})}wy.$inject=["canvas","eventBus","gridSnapping"];var NT=3e3;function Zs(e,t,n){z.call(this,e),this._gridSnapping=t;var i=this;this.postExecuted(["connection.create","connection.layout"],NT,function(r){var o=r.context,a=o.connection,s=o.hints||{},c=a.waypoints;s.connectionStart||s.connectionEnd||s.createElementsBehavior===!1||$T(c)&&n.updateWaypoints(a,i.snapMiddleSegments(c))})}Zs.$inject=["eventBus","gridSnapping","modeling"],X(Zs,z),Zs.prototype.snapMiddleSegments=function(e){var t=this._gridSnapping,n;e=e.slice();for(var i=1;i<e.length-2;i++)n=HT(t,e[i],e[i+1]),e[i]=n[0],e[i+1]=n[1];return e};function $T(e){return e.length>3}function jT(e){return e==="h"}function FT(e){return e==="v"}function HT(e,t,n){var i=In(t,n),r={};return jT(i)&&(r.y=e.snapValue(t.y)),FT(i)&&(r.x=e.snapValue(t.x)),("x"in r||"y"in r)&&(t=k({},t,r),n=k({},n,r)),[t,n]}const zT={__depends__:[OT,{__init__:["gridSnappingAutoPlaceBehavior","gridSnappingParticipantBehavior","gridSnappingLayoutConnectionBehavior"],gridSnappingAutoPlaceBehavior:["type",xy],gridSnappingParticipantBehavior:["type",wy],gridSnappingLayoutConnectionBehavior:["type",Zs]}],__init__:["bpmnGridSnapping"],bpmnGridSnapping:["type",yy]};var VT=30,Sy=30;function jo(e,t){this._interactionEvents=t;var n=this;e.on(["interactionEvents.createHit","interactionEvents.updateHit"],function(i){var r=i.element,o=i.gfx;if(_(r,"bpmn:Lane"))return n._createParticipantHit(r,o);if(_(r,"bpmn:Participant"))return Ee(r)?n._createParticipantHit(r,o):n._createDefaultHit(r,o);if(_(r,"bpmn:SubProcess"))return Ee(r)?n._createSubProcessHit(r,o):n._createDefaultHit(r,o)})}jo.$inject=["eventBus","interactionEvents"],jo.prototype._createDefaultHit=function(e,t){return this._interactionEvents.removeHits(t),this._interactionEvents.createDefaultHit(e,t),!0},jo.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=pt(e)?{width:VT,height:e.height}:{width:e.width,height:Sy};return this._interactionEvents.createBoxHit(t,"all",n),!0},jo.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:Sy}),!0};const GT={__init__:["bpmnInteractionEvents"],bpmnInteractionEvents:["type",jo]};function Qs(e){e.invoke(Cr,this)}X(Qs,Cr),Qs.$inject=["injector"],Qs.prototype.registerBindings=function(e,t){Cr.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 WT={__depends__:[Il],__init__:["keyboardBindings"],keyboardBindings:["type",Qs]};var UT={moveSpeed:1,moveSpeedAccelerated:10},qT=1500,Ry="left",Cy="up",Py="right",Ay="down",YT={ArrowLeft:Ry,Left:Ry,ArrowUp:Cy,Up:Cy,ArrowRight:Py,Right:Py,ArrowDown:Ay,Down:Ay},KT={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 Ty(e,t,n,i,r){var o=this;this._config=k({},UT,e||{}),t.addListener(qT,function(a){var s=a.keyEvent,c=YT[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=KT[a](u),p=i.allowed("elements.move",{shapes:c,hints:{keyboardMove:!0}});p&&n.moveElements(c,l)}}}Ty.$inject=["config.keyboardMoveSelection","keyboard","modeling","rules","selection"];const XT={__depends__:[Il,en],__init__:["keyboardMoveSelection"],keyboardMoveSelection:["type",Ty]};var My=10;function Fo(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=Fw(l,p,u),c.newBounds=zw(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:ne(l)})}function s(c){var u=c.shape,l=c.canExecute,p=c.newBounds;if(l){if(p=Uf(p),!ZT(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)})}Fo.prototype.canResize=function(e){var t=this._rules,n=cn(e,["newBounds","shape","delta","direction"]);return t.allowed("shape.resize",n)},Fo.prototype.activate=function(e,t,n){var i=this._dragging,r,o;if(typeof n=="string"&&(n={direction:n}),r=k({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,ky(t,o),"resize",{autoActivate:!0,cursor:QT(o),data:{shape:t,context:r}})},Fo.prototype.computeMinResizeBox=function(e){var t=e.shape,n=e.direction,i,r;return i=e.minDimensions||{width:My,height:My},r=Od(t,e.childrenBoxPadding),Vw(n,t,i,r)},Fo.$inject=["eventBus","rules","modeling","dragging"];function ZT(e,t){return e.x!==t.x||e.y!==t.y||e.width!==t.width||e.height!==t.height}function ky(e,t){var n=ce(e),i=ne(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 QT(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 Dy="djs-resizing",Oy="resize-not-ok",JT=500;function Iy(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,Dy)),s.width>5&&Z(c,{x:s.x,width:s.width}),s.height>5&&Z(c,{y:s.y,height:s.height}),o.canExecute?xe(c).remove(Oy):xe(c).add(Oy)}function r(o){var a=o.shape,s=o.frame;s&&ot(o.frame),t.removeMarker(a,Dy)}e.on("resize.move",JT,function(o){i(o.context)}),e.on("resize.cleanup",function(o){r(o.context)})}Iy.$inject=["eventBus","canvas","previewSupport"];var Js=-6,ec=8,tc=20,Ho="djs-resizer",eM=["n","w","s","e","nw","ne","se","sw"];function xi(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&&A(a,At(r.addResizer,r))}),e.on("shape.changed",function(o){var a=o.element;n.isSelected(a)&&(r.removeResizers(),r.addResizer(a))})}xi.prototype.makeDraggable=function(e,t,n){var i=this._resize;function r(o){li(o)&&i.activate(o,e,n)}pe.bind(t,"mousedown",r),pe.bind(t,"touchstart",r)},xi.prototype._createResizer=function(e,t,n,i){var r=this._getResizersParent(),o=tM(i),a=te("g");xe(a).add(Ho),xe(a).add(Ho+"-"+e.id),xe(a).add(Ho+"-"+i),fe(r,a);var s=te("rect");Z(s,{x:-ec/2+o.x,y:-ec/2+o.y,width:ec,height:ec}),xe(s).add(Ho+"-visual"),fe(a,s);var c=te("rect");return Z(c,{x:-tc/2+o.x,y:-tc/2+o.y,width:tc,height:tc}),xe(c).add(Ho+"-hit"),fe(a,c),ma(a,t,n),a},xi.prototype.createResizer=function(e,t){var n=ky(e,t),i=this._createResizer(e,n.x,n.y,t);this.makeDraggable(e,i,t)},xi.prototype.addResizer=function(e){var t=this;ke(e)||A(eM,function(n){t._resize.canResize({shape:e,direction:n})&&t.createResizer(e,n)})},xi.prototype.removeResizers=function(){var e=this._getResizersParent();aa(e)},xi.prototype._getResizersParent=function(){return this._canvas.getLayer("resizers")},xi.$inject=["eventBus","canvas","selection","resize"];function tM(e){var t={x:0,y:0};return e.indexOf("e")!==-1?t.x=-Js:e.indexOf("w")!==-1&&(t.x=Js),e.indexOf("s")!==-1?t.y=-Js:e.indexOf("n")!==-1&&(t.y=Js),t}const Ly={__depends__:[Rn,Fn,xr],__init__:["resize","resizePreview","resizeHandles"],resize:["type",Fo],resizePreview:["type",Iy],resizeHandles:["type",xi]};var nM=2e3;function zo(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"],nM,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||ve(c,["bpmn:Activity","bpmn:Event","bpmn:TextAnnotation","bpmn:Participant"]))&&i.activate(c)}}zo.$inject=["eventBus","bpmnFactory","canvas","directEditing","modeling","resizeHandles","textRenderer"],zo.prototype.activate=function(e){var t=Ut(e);if(t!==void 0){var n={text:t},i=this.getEditingBBox(e);k(n,i);var r={},o=n.style||{};return k(o,{backgroundColor:null,border:null}),(ve(e,["bpmn:Task","bpmn:Participant","bpmn:Lane","bpmn:CallActivity"])||By(e))&&k(r,{centerVertically:!0}),ai(e)&&(k(r,{resizable:!0,autoResize:!0}),k(o,{backgroundColor:"#ffffff",border:"1px solid #ccc"})),_(e,"bpmn:TextAnnotation")&&(k(r,{resizable:!0,autoResize:!0}),k(o,{backgroundColor:"#ffffff",border:"1px solid #ccc"})),k(n,{options:r,style:o}),n}},zo.prototype.getEditingBBox=function(e){var t=this._canvas,n=e.label||e,i=t.getAbsoluteBBox(n),r={x:i.x+i.width/2,y:i.y+i.height/2},o={x:i.x,y:i.y},a=t.zoom(),s=this._textRenderer.getDefaultStyle(),c=this._textRenderer.getExternalStyle(),u=c.fontSize*a,l=c.lineHeight,p=s.fontSize*a,f=s.lineHeight,d={fontFamily:this._textRenderer.getDefaultStyle().fontFamily,fontWeight:this._textRenderer.getDefaultStyle().fontWeight};if(_(e,"bpmn:Lane")||oM(e)){var h=pt(e),g=h?{width:i.height,height:30*a,x:i.x-i.height/2+15*a,y:r.y-30*a/2}:{width:i.width,height:30*a};k(o,g),k(d,{fontSize:p+"px",lineHeight:f,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px",transform:h?"rotate(-90deg)":null})}if(rM(e)){var y=pt(e),S=y?{width:i.width,height:i.height}:{width:i.height,height:i.width,x:r.x-i.height/2,y:r.y-i.width/2};k(o,S),k(d,{fontSize:p+"px",lineHeight:f,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px",transform:y?null:"rotate(-90deg)"})}(ve(e,["bpmn:Task","bpmn:CallActivity"])||By(e))&&(k(o,{width:i.width,height:i.height}),k(d,{fontSize:p+"px",lineHeight:f,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px"})),iM(e)&&(k(o,{width:i.width,x:i.x}),k(d,{fontSize:p+"px",lineHeight:f,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px"}));var w=1,E=i.width+2*w;if(n.labelTarget&&(k(o,{width:E,height:i.height+2*w,x:i.x-w,y:i.y-w}),k(d,{fontSize:u+"px",lineHeight:l})),ai(n)&&!ya(n)&&!me(n)){var x=qc(e),R=t.getAbsoluteBBox({x:x.x,y:x.y,width:0,height:0}),M=u,O=Bi.width*a+2*w;k(o,{width:O,height:M+2*w,x:R.x-O/2,y:R.y-M/2-w}),k(d,{fontSize:u+"px",lineHeight:l})}return _(e,"bpmn:TextAnnotation")&&(k(o,{width:i.width+2*w,height:i.height+2*w,x:i.x-w,y:i.y-w,minWidth:30*a,minHeight:10*a}),k(d,{textAlign:"left",paddingTop:ur*a+"px",paddingBottom:ur*a+"px",paddingLeft:ur*a+"px",paddingRight:ur*a+"px",fontSize:p+"px",lineHeight:f})),{bounds:o,style:d}},zo.prototype.update=function(e,t,n,i){var r,o;_(e,"bpmn:TextAnnotation")&&(o=this._canvas.getAbsoluteBBox(e),r={x:e.x,y:e.y,width:e.width/o.width*i.width,height:e.height/o.height*i.height}),aM(t)&&(t=null),this._modeling.updateLabel(e,t,r)};function By(e){return _(e,"bpmn:SubProcess")&&!Ee(e)}function iM(e){return _(e,"bpmn:SubProcess")&&Ee(e)}function rM(e){return _(e,"bpmn:Participant")&&!Ee(e)}function oM(e){return _(e,"bpmn:Participant")&&Ee(e)}function aM(e){return!e||!e.trim()}var Ny="djs-element-hidden",$y="djs-label-hidden";function jy(e,t,n){var i=this,r=t.getDefaultLayer(),o,a,s;e.on("directEditing.activate",function(c){var u=c.active;if(o=u.element.label||u.element,_(o,"bpmn:TextAnnotation")){a=t.getAbsoluteBBox(o),s=te("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=te("path");Z(p,{d:l,strokeWidth:2,stroke:sM(o)}),fe(s,p),fe(r,s),mt(s,o.x,o.y)}_(o,"bpmn:TextAnnotation")||o.labelTarget?t.addMarker(o,Ny):(_(o,"bpmn:Task")||_(o,"bpmn:CallActivity")||_(o,"bpmn:SubProcess")||_(o,"bpmn:Participant")||_(o,"bpmn:Lane"))&&t.addMarker(o,$y)}),e.on("directEditing.resize",function(c){if(_(o,"bpmn:TextAnnotation")){var u=c.height,l=c.dy,p=Math.max(o.height/a.height*(u+l),0),f=n.getScaledPath("TEXT_ANNOTATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:o.width,containerHeight:p,position:{mx:0,my:0}});Z(i.path,{d:f})}}),e.on(["directEditing.complete","directEditing.cancel"],function(c){var u=c.active;u&&(t.removeMarker(u.element.label||u.element,Ny),t.removeMarker(o,$y)),o=void 0,a=void 0,s&&(ot(s),s=void 0)})}jy.$inject=["eventBus","canvas","pathMap"];function sM(e,t){var n=Se(e);return n.get("stroke")||t||"black"}const cM={__depends__:[pl,Ly,ly],__init__:["labelEditingProvider","labelEditingPreview"],labelEditingProvider:["type",zo],labelEditingPreview:["type",jy]};var uM=500,lM=1e3;function An(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){zE(o)||i.createOutline(o)}e.on("element.hover",function(o){r(o.element)}),e.on("selection.changed",function(o){A(o.newSelection,r)}),e.on(["shape.changed","connection.changed"],uM,function(o){var a=o.element,s=o.gfx,c=Me(".djs-outline",s);c&&i.updateOutline(a,c)})}An.prototype.createOutline=function(e){var t=this._elementRegistry.getGraphics(e);if(!t)throw new Error("cannot create outline for non-rendered element");var n=Me(".djs-outline",t);return n||(n=this.getOutline(e)||this._createOutlineGfx(),fe(t,n),this.updateOutline(e,n)),n},An.prototype._createOutlineGfx=function(){var e=te("rect");return Z(e,k({x:0,y:0,rx:4,width:100,height:100},this._outlineStyle)),e},An.prototype.updateOutline=function(e,t){e.waypoints?this.updateConnectionOutline(t,e):this.updateShapeOutline(t,e)},An.prototype.updateShapeOutline=function(e,t){var n=!1,i=this._getProviders();i.length&&A(i,function(r){n=n||r.updateOutline(t,e)}),n||Z(e,{x:-this._outlineOffset,y:-this._outlineOffset,width:t.width+this._outlineOffset*2,height:t.height+this._outlineOffset*2})},An.prototype.updateConnectionOutline=function(e,t){var n=Ke(t);Z(e,{x:n.x-this._outlineOffset,y:n.y-this._outlineOffset,width:n.width+this._outlineOffset*2,height:n.height+this._outlineOffset*2})},An.prototype.registerProvider=function(e,t){t||(t=e,e=lM),this._eventBus.on("outline.getProviders",e,function(n){n.providers.push(t)})},An.prototype._getProviders=function(){var e=this._eventBus.createEvent({type:"outline.getProviders",providers:[]});return this._eventBus.fire(e),e.providers},An.prototype.getOutline=function(e){var t,n=this._getProviders();return A(n,function(i){lt(i.getOutline)&&(t=t||i.getOutline(e))}),t},An.$inject=["eventBus","styles","elementRegistry"];var nc=6;function sp(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)})}sp.prototype._updateMultiSelectionOutline=function(e){var t=this._canvas.getLayer("selectionOutline");aa(t);var n=e.length>1,i=this._canvas.getContainer();if(xe(i)[n?"add":"remove"]("djs-multi-select"),!!n){var r=pM(Ke(e)),o=te("rect");Z(o,k({rx:3},r)),xe(o).add("djs-selection-outline"),fe(t,o)}},sp.$inject=["eventBus","canvas","selection"];function pM(e){return{x:e.x-nc,y:e.y-nc,width:e.width+nc*2,height:e.height+nc*2}}const cp={__depends__:[en],__init__:["outline","multiSelectionOutline"],outline:["type",An],multiSelectionOutline:["type",sp]},Fy=["bpmn:Event","bpmn:SequenceFlow","bpmn:Gateway"],Hy={class:"bjs-label-link",stroke:"var(--element-selected-outline-secondary-stroke-color)",strokeDasharray:"5, 5"},fM=15,ic=2;function zy(e,t,n,i,r){const o=t.getLayer("overlays");e.on(["selection.changed","shape.changed"],function(){s()}),e.on("selection.changed",function({newSelection:p}){var d;const f=p.filter(h=>ve(h,Fy));if(f.length===1){const h=f[0];me(h)?a(h,h.labelTarget):(d=h.labels)!=null&&d.length&&a(h.labels[0],h)}if(f.length===2){const h=f.find(me),g=f.find(y=>{var S;return(S=y.labels)==null?void 0:S.includes(h)});h&&g&&a(h,g)}}),e.on("shape.changed",function({element:p}){var f;!ve(p,Fy)||!l(p)||(me(p)?a(p,p.labelTarget):(f=p.labels)!=null&&f.length&&a(p.labels[0],p))});function a(p,f){const d=Gr([ce(f),ce(p)],Hy),h=d.getAttribute("d"),y=r.isSelected(p)?c(p):u(p),S=Yr(y,h);if(!S)return;const E=r.isSelected(f)?c(f):u(f),x=Yr(E,h)||ce(f);ro(x,S)<fM||(jc(d,[x,S]),fe(o,d))}function s(){oa(`.${Hy.class}`,o).forEach(ot)}function c(p){const f=i.getOutline(p);if(!f)return u(p);if(f.x){const d={x:p.x+wi(f,"x")-ic,y:p.y+wi(f,"y")-ic,width:wi(f,"width")+ic*2,height:wi(f,"height")+ic*2};return Kc(d,wi(f,"rx"))}if(f.cx){const d=wi(f,"r"),h={x:p.x+wi(f,"cx")-d,y:p.y+wi(f,"cy")-d,width:d*2,height:d*2};return gd(h)}}function u(p){return n.getShapePath(p)}function l(p){return r.isSelected(p)}}zy.$inject=["eventBus","canvas","graphicsFactory","outline","selection"];function wi(e,t){return parseFloat(Z(e,t)||0)}const dM={__depends__:[en,cp],__init__:["labelLink"],labelLink:["type",zy]};var hM=new Er("tt");function mM(e){var t=Ne('<div class="djs-tooltip-container" />');return Ct(t,{position:"absolute",width:"0",height:"0"}),e.insertBefore(t,e.firstChild),t}function gM(e,t,n){Ct(e,{left:t+"px",top:n+"px"})}function up(e,t){e.style.display=t===!1?"none":""}var Vy="djs-tooltip",lp="."+Vy;function Mt(e,t){this._eventBus=e,this._canvas=t,this._ids=hM,this._tooltipDefaults={show:{minZoom:.7,maxZoom:5}},this._tooltips={},this._tooltipRoot=mM(t.getContainer());var n=this;It.bind(this._tooltipRoot,lp,"mousedown",function(i){i.stopPropagation()}),It.bind(this._tooltipRoot,lp,"mouseover",function(i){n.trigger("mouseover",i)}),It.bind(this._tooltipRoot,lp,"mouseout",function(i){n.trigger("mouseout",i)}),this._init()}Mt.$inject=["eventBus","canvas"],Mt.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=k({},this._tooltipDefaults,e,{id:t}),this._addTooltip(e),e.timeout&&this.setTimeout(e),t},Mt.prototype.trigger=function(e,t){var n=t.delegateTarget||t.target,i=this.get(Et(n,"data-tooltip-id"));i&&(e==="mouseover"&&i.timeout&&this.clearTimeout(i),e==="mouseout"&&i.timeout&&(i.timeout=1e3,this.setTimeout(i)))},Mt.prototype.get=function(e){return typeof e!="string"&&(e=e.id),this._tooltips[e]},Mt.prototype.clearTimeout=function(e){if(e=this.get(e),!!e){var t=e.removeTimer;t&&(clearTimeout(t),e.removeTimer=null)}},Mt.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)}},Mt.prototype.remove=function(e){var t=this.get(e);t&&(_n(t.html),_n(t.htmlContainer),delete t.htmlContainer,delete this._tooltips[t.id])},Mt.prototype.show=function(){up(this._tooltipRoot)},Mt.prototype.hide=function(){up(this._tooltipRoot,!1)},Mt.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},Mt.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)),kt(n)&&(n=Ne(n)),i=Ne('<div data-tooltip-id="'+t+'" class="'+Vy+'">'),Ct(i,{position:"absolute"}),i.appendChild(n),e.type&&He(i).add("djs-tooltip-"+e.type),e.className&&He(i).add(e.className),e.htmlContainer=i,r.appendChild(i),this._tooltips[t]=e,this._updateTooltip(e)},Mt.prototype._updateTooltip=function(e){var t=e.position,n=e.htmlContainer;gM(n,t.x,t.y)},Mt.prototype._updateTooltipVisibilty=function(e){A(this._tooltips,function(t){var n=t.show,i=t.htmlContainer,r=!0;n&&((n.minZoom>e.scale||n.maxZoom<e.scale)&&(r=!1),up(i,r))})},Mt.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 vM={__init__:["tooltips"],tooltips:["type",Mt]};var yM="flow elements must be children of pools/participants",_M="Data object must be placed within a pool/participant.";function Gy(e,t,n){function i(r,o,a){t.add({position:{x:r.x+5,y:r.y+5},type:"error",timeout:2e3,html:"<div>"+o+"</div>"})}e.on(["shape.move.rejected","create.rejected"],function(r){var o=r.context,a=o.shape,s=o.target;_(s,"bpmn:Collaboration")&&(_(a,"bpmn:FlowNode")?i(r,n(yM)):_(a,"bpmn:DataObjectReference")&&i(r,n(_M)))})}Gy.$inject=["eventBus","tooltips","translate"];const bM={__depends__:[vM],__init__:["modelingFeedback"],modelingFeedback:["type",Gy]};var EM=500,xM=1250,wM=1500,rc=Math.round;function SM(e){return{x:e.x+rc(e.width/2),y:e.y+rc(e.height/2)}}function Wy(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",wM,function(s){var c=s.context,u=s.shape,l=i.get().slice();l.indexOf(u)===-1&&(l=[u]),l=RM(l),k(c,{shapes:l,validatedShapes:l,shape:u})}),e.on("shape.move.start",xM,function(s){var c=s.context,u=c.validatedShapes,l;if(l=c.canExecute=o(u),!l)return!1}),e.on("shape.move.move",EM,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=rc(u.x),u.y=rc(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(li(s)){var c=vr(s);if(!c)throw new Error("must supply DOM mousedown event");return a(c,s.element)}});function a(s,c,u,l){if(ut(u)&&(l=u,u=!1),!(c.waypoints||!c.parent)&&!xe(s.target).has("djs-hit-no-move")){var p=SM(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}Wy.$inject=["eventBus","dragging","modeling","selection","rules"];function RM(e){var t=Ji(e,"id");return ye(e,function(n){for(;n=n.parent;)if(t[n.id])return!1;return!0})}var Uy=499,pp="djs-dragging",qy="drop-ok",Yy="drop-not-ok",Ky="new-parent",Xy="attach-ok";function Zy(e,t,n,i){function r(c){var u=o(c),l=CM(u);return l}function o(c){var u=Wr(c),l=u.flatMap(d=>(d.incoming||[]).concat(d.outgoing||[])),p=u.concat(l),f=[...new Set(p)];return f}function a(c,u){[Xy,qy,Yy,Ky].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,pp),c.allDraggedElements?c.allDraggedElements.push(u):c.allDraggedElements=[u]}e.on("shape.move.start",Uy,function(c){var u=c.context,l=u.shapes,p=u.allDraggedElements,f=r(l);if(!u.dragGroup){var d=te("g");Z(d,n.cls("djs-drag-group",["no-events"]));var h=t.getActiveLayer();fe(h,d),u.dragGroup=d}f.forEach(function(g){i.addDragger(g,u.dragGroup)}),p?p=lc([p,o(l)]):p=o(l),A(p,function(g){t.addMarker(g,pp)}),u.allDraggedElements=p,u.differentParents=PM(l)}),e.on("shape.move.move",Uy,function(c){var u=c.context,l=u.dragGroup,p=u.target,f=u.shape.parent,d=u.canExecute;p&&(d==="attach"?a(p,Xy):u.canExecute&&f&&p.id!==f.id?a(p,Ky):a(p,u.canExecute?qy:Yy)),mt(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;A(l,function(f){t.removeMarker(f,pp)}),p&&ot(p)}),this.makeDraggable=s}Zy.$inject=["eventBus","canvas","styles","previewSupport"];function CM(e){var t=new Set;e.forEach(function(i){t.add(i.id)});var n=ye(e,function(i){return ke(i)?t.has(i.source.id)&&t.has(i.target.id):!0});return n}function PM(e){return z_(Ji(e,function(t){return t.parent&&t.parent.id}))!==1}const AM={__depends__:[Ka,en,cp,Rn,Fn,xr],__init__:["move","movePreview"],move:["type",Wy],movePreview:["type",Zy]};var Qy=".djs-palette-toggle",Jy=".entry",TM=Qy+", "+Jy,fp="djs-palette-",MM="shown",dp="open",e_="two-column",kM=1e3;function et(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()})}et.$inject=["eventBus","canvas"],et.prototype.registerProvider=function(e,t){t||(t=e,e=kM),this._eventBus.on("palette.getProviders",e,function(n){n.providers.push(t)}),this._rebuild()},et.prototype.getEntries=function(){var e=this._getProviders();return e.reduce(OM,{})},et.prototype._rebuild=function(){if(this._diagramInitialized){var e=this._getProviders();e.length&&(this._container||this._init(),this._update())}},et.prototype._init=function(){var e=this,t=this._eventBus,n=this._getParentContainer(),i=this._container=Ne(et.HTML_MARKUP);n.appendChild(i),He(n).add(fp+MM),It.bind(i,TM,"click",function(r){var o=r.delegateTarget;if(Mc(o,Qy))return e.toggle();e.trigger("click",r)}),pe.bind(i,"mousedown",function(r){r.stopPropagation()}),It.bind(i,Jy,"dragstart",function(r){e.trigger("dragstart",r)}),t.on("canvas.resized",this._layoutChanged,this),t.fire("palette.create",{container:i})},et.prototype._getProviders=function(e){var t=this._eventBus.createEvent({type:"palette.getProviders",providers:[]});return this._eventBus.fire(t),t.providers},et.prototype._toggleState=function(e){e=e||{};var t=this._getParentContainer(),n=this._container,i=this._eventBus,r,o=He(n),a=He(t);"twoColumn"in e?r=e.twoColumn:r=this._needsCollapse(t.clientHeight,this._entries||{}),o.toggle(e_,r),a.toggle(fp+e_,r),"open"in e&&(o.toggle(dp,e.open),a.toggle(fp+dp,e.open)),i.fire("palette.changed",{twoColumn:r,open:this.isOpen()})},et.prototype._update=function(){var e=Me(".djs-palette-entries",this._container),t=this._entries=this.getEntries();ia(e),A(t,function(n,i){var r=n.group||"default",o=Me("[data-group="+Po(r)+"]",e);o||(o=Ne('<div class="group"></div>'),Et(o,"data-group",r),e.appendChild(o));var a=n.html||(n.separator?'<hr class="separator" />':'<div class="entry" draggable="true"></div>'),s=Ne(a);if(o.appendChild(s),!n.separator&&(Et(s,"data-action",i),n.title&&Et(s,"title",n.title),n.className&&DM(s,n.className),n.imageUrl)){var c=Ne("<img>");Et(c,"src",n.imageUrl),s.appendChild(c)}}),this.open()},et.prototype.trigger=function(e,t,n){var i,r,o=t.delegateTarget||t.target;return o?(i=Et(o,"data-action"),r=t.originalEvent||t,this.triggerEntry(i,e,r,n)):t.preventDefault()},et.prototype.triggerEntry=function(e,t,n,i){var r=this._entries,o,a;if(o=r[e],!!o&&(a=o.action,this._eventBus.fire("palette.trigger",{entry:o,event:n})!==!1)){if(lt(a)){if(t==="click")return a(n,i)}else if(a[t])return a[t](n,i);n.preventDefault()}},et.prototype._layoutChanged=function(){this._toggleState({})},et.prototype._needsCollapse=function(e,t){var n=50,i=Object.keys(t).length*46;return e<i+n},et.prototype.close=function(){this._toggleState({open:!1,twoColumn:!1})},et.prototype.open=function(){this._toggleState({open:!0})},et.prototype.toggle=function(){this.isOpen()?this.close():this.open()},et.prototype.isActiveTool=function(e){return e&&this._activeTool===e},et.prototype.updateToolHighlight=function(e){var t,n;this._toolsContainer||(t=Me(".djs-palette-entries",this._container),this._toolsContainer=Me("[data-group=tools]",t)),n=this._toolsContainer,A(n.children,function(i){var r=i.getAttribute("data-action");if(r){var o=He(i);r=r.replace("-tool",""),o.contains("entry")&&r===e?o.add("highlighted-entry"):o.remove("highlighted-entry")}})},et.prototype.isOpen=function(){return He(this._container).has(dp)},et.prototype._getParentContainer=function(){return this._canvas.getContainer()},et.HTML_MARKUP='<div class="djs-palette"><div class="djs-palette-entries"></div><div class="djs-palette-toggle"></div></div>';function DM(e,t){var n=He(e),i=se(t)?t:t.split(/\s+/g);i.forEach(function(r){n.add(r)})}function OM(e,t){var n=t.getPaletteEntries();return lt(n)?n(e):(A(n,function(i,r){e[r]=i}),e)}const IM={__init__:["palette"],palette:["type",et]};var t_="crosshair",n_="selected",LM="djs-dragging-active-lasso";function Si(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=te("rect");Z(d,{class:"djs-lasso-overlay",width:1,height:1,x:0,y:0}),fe(f,d),u(!0),this.update(p)},update:function(p){var f=p.frame,d=p.bbox;f&&d&&Z(f,{x:d.x,y:d.y,width:d.width,height:d.height});var h=p.marked,g=p.lastMarked;if(h&&g){for(const y of g)h.has(y)||t.removeMarker(y,n_);for(const y of h)g.has(y)||t.addMarker(y,n_)}},remove:function(p){this.update(p),p.frame&&ot(p.frame),u(!1)}};function u(p){xe(t.getContainer()).toggle(LM,p)}function l(p){var f=i.getAll();return new Set(Qi(rr(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=i_(p),f.add=za(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=i_(p),h=l(d),g=f.initialMarked.union(h);f.lastMarked=f.marked,f.marked=g,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(za(p))return s.activateLasso(p.originalEvent),!0})}Si.$inject=["eventBus","canvas","dragging","elementRegistry","selection","toolManager","mouse"],Si.prototype.activateLasso=function(e,t){this._dragging.init(e,"lasso",{autoActivate:t,cursor:t_,data:{context:{}},keepSelection:!0})},Si.prototype.activateSelection=function(e,t){this._dragging.init(e,"lasso.selection",{trapClick:!1,autoActivate:t,cursor:t_,data:{context:{}},keepSelection:!0})},Si.prototype._select=function(e){this._selection.select(e)},Si.prototype.select=function(e,t,n=[]){var i=Qi(rr(e,t));this._select([...n,...i])},Si.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateSelection(e,!!e)},Si.prototype.isActive=function(){var e=this._dragging.context();return e&&/^lasso/.test(e.prefix)};function i_(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 BM={__depends__:[Ja,lo],__init__:["lassoTool"],lassoTool:["type",Si]};var hp=1500,r_="grab";function Ir(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",hp,function(c){if(so(c))return a.activateMove(c.originalEvent,!0),!1}),s&&s.addListener(hp,function(c){if(!(!o_(c.keyEvent)||a.isActive())){var u=a._mouse.getLastMoveEvent();a.activateMove(u,!!u)}},"keyboard.keydown"),s&&s.addListener(hp,function(c){!o_(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!so(c)&&l&&e.once("hand.move.ended",function(p){a.activateHand(p.originalEvent,!0,!0)}),!1})}Ir.$inject=["eventBus","canvas","dragging","injector","toolManager","mouse"],Ir.prototype.activateMove=function(e,t,n){typeof t=="object"&&(n=t,t=!1),this._dragging.init(e,"hand.move",{autoActivate:t,cursor:r_,data:{context:n||{}}})},Ir.prototype.activateHand=function(e,t,n){this._dragging.init(e,"hand",{trapClick:!1,autoActivate:t,cursor:r_,data:{context:{reactivate:n}}})},Ir.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateHand(e,!!e)},Ir.prototype.isActive=function(){var e=this._dragging.context();return e?/^(hand|hand\.move)$/.test(e.prefix):!1};function o_(e){return at("Space",e)}const NM={__depends__:[Ja,lo],__init__:["handTool"],handTool:["type",Ir]};var a_="connect-ok",s_="connect-not-ok";function Lr(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?a_:s_))}),e.on(["global-connect.out","global-connect.cleanup"],function(c){var u=c.context.startTarget,l=c.context.canStartConnect;u&&i.removeMarker(u,l?a_:s_)}),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})}Lr.$inject=["eventBus","dragging","connect","canvas","toolManager","rules","mouse"],Lr.prototype.start=function(e,t){this._dragging.init(e,"global-connect",{autoActivate:t,trapClick:!1,data:{context:{}}})},Lr.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();return this.start(e,!!e)},Lr.prototype.isActive=function(){var e=this._dragging.context();return e&&/^global-connect/.test(e.prefix)},Lr.prototype.canStartConnect=function(e){return this._rules.allowed("connection.start",{source:e})};const $M={__depends__:[ip,Rn,Fn,Ja,lo],globalConnect:["type",Lr]};function mp(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)}mp.$inject=["palette","create","elementFactory","spaceTool","lassoTool","handTool","globalConnect","translate"],mp.prototype.getPaletteEntries=function(){var e={},t=this._create,n=this._elementFactory,i=this._spaceTool,r=this._lassoTool,o=this._handTool,a=this._globalConnect,s=this._translate;function c(p,f,d,h,g){function y(S){var w=n.createShape(k({type:p},g));t.start(S,w)}return{group:f,className:d,title:h,action:{dragstart:y,click:y}}}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 k(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 jM={__depends__:[IM,Za,Im,BM,NM,$M,eo],__init__:["paletteProvider"],paletteProvider:["type",mp]};var FM=250;function gp(e,t,n,i,r){z.call(this,e);function o(s){var c=s.canExecute.replacements;A(c,function(u){var l=u.oldElementId,p={type:u.newElementType};if(!s.visualReplacements[l]){var f=t.get(l);k(p,{x:f.x,y:f.y});var d=n.createShape(p);i.addShape(d,f.parent);var h=Me('[data-element-id="'+Po(f.id)+'"]',s.dragGroup);h&&Z(h,{display:"none"});var g=r.addDragger(d,s.dragGroup);s.visualReplacements[l]=g,i.removeShape(d)}})}function a(s){var c=s.visualReplacements;A(c,function(u,l){var p=Me('[data-element-id="'+Po(l)+'"]',s.dragGroup);p&&Z(p,{display:"inline"}),u.remove(),c[l]&&delete c[l]})}e.on("shape.move.move",FM,function(s){var c=s.context,u=c.canExecute;c.visualReplacements||(c.visualReplacements={}),u&&u.replacements?o(c):a(c)})}gp.$inject=["eventBus","elementRegistry","elementFactory","canvas","previewSupport"],X(gp,z);const HM={__depends__:[xr],__init__:["bpmnReplacePreview"],bpmnReplacePreview:["type",gp]};var zM=1250,vp=40,VM=20,GM=10,c_=20,u_=["x","y"],WM=Math.abs;function l_(e){e.on(["connect.hover","connect.move","connect.end"],zM,function(t){var n=t.context,i=n.canExecute,r=n.start,o=n.hover,a=n.source,s=n.target;t.originalEvent&&Nt(t.originalEvent)||(n.initialConnectionStart||(n.initialConnectionStart=n.connectionStart),i&&o&&UM(t,o,XM(o)),o&&KM(i,["bpmn:Association","bpmn:DataInputAssociation","bpmn:DataOutputAssociation","bpmn:SequenceFlow"])?(n.connectionStart=rn(r),ve(o,["bpmn:Event","bpmn:Gateway"])&&p_(t,rn(o)),ve(o,["bpmn:Task","bpmn:SubProcess"])&&qM(t,o),_(a,"bpmn:BoundaryEvent")&&s===a.host&&YM(t)):f_(i,"bpmn:MessageFlow")?(_(r,"bpmn:Event")&&(n.connectionStart=rn(r)),_(o,"bpmn:Event")&&p_(t,rn(o))):n.connectionStart=n.initialConnectionStart)})}l_.$inject=["eventBus"];function UM(e,t,n){u_.forEach(function(i){var r=d_(i,t);e[i]<t[i]+n?Je(e,i,t[i]+n):e[i]>t[i]+r-n&&Je(e,i,t[i]+r-n)})}function qM(e,t){var n=rn(t);u_.forEach(function(i){ZM(e,t,i)&&Je(e,i,n[i])})}function YM(e){var t=e.context,n=t.source,i=t.target;if(!QM(t)){var r=rn(n),o=ht(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;WM(c-r[s])<vp&&(c>r[s]?u=r[s]+vp:u=r[s]-vp,Je(e,s,u))})}}function p_(e,t){Je(e,"x",t.x),Je(e,"y",t.y)}function f_(e,t){return e&&e.type===t}function KM(e,t){return Kn(t,function(n){return f_(e,n)})}function d_(e,t){return e==="x"?t.width:t.height}function XM(e){return _(e,"bpmn:Task")?GM:VM}function ZM(e,t,n){return e[n]>t[n]+c_&&e[n]<t[n]+d_(n,t)-c_}function QM(e){var t=e.hover,n=e.source;return t&&n&&t===n}function Ri(){this._targets={},this._snapOrigins={},this._snapLocations=[],this._defaultSnaps={}}Ri.prototype.getSnapOrigin=function(e){return this._snapOrigins[e]},Ri.prototype.setSnapOrigin=function(e,t){this._snapOrigins[e]=t,this._snapLocations.indexOf(e)===-1&&this._snapLocations.push(e)},Ri.prototype.addDefaultSnap=function(e,t){var n=this._defaultSnaps[e];n||(n=this._defaultSnaps[e]=[]),n.push(t)},Ri.prototype.getSnapLocations=function(){return this._snapLocations},Ri.prototype.setSnapLocations=function(e){this._snapLocations=e},Ri.prototype.pointsForTarget=function(e){var t=e.id||e,n=this._targets[t];return n||(n=this._targets[t]=new oc,n.initDefaults(this._defaultSnaps)),n};function oc(){this._snapValues={}}oc.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)},oc.prototype.snap=function(e,t,n,i){var r=this._snapValues[t];return r&&FA(e[n],r[n],i)},oc.prototype.initDefaults=function(e){var t=this;A(e||{},function(n,i){A(n,function(r){t.add(i,r)})})};var JM=1250;function Tn(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"],JM,function(r){var o=r.context,a=o.shape,s=o.snapContext,c=o.target;if(!(r.originalEvent&&Nt(r.originalEvent))&&!(Or(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()})}Tn.$inject=["elementRegistry","eventBus","snapping"],Tn.prototype.initSnap=function(e){var t=this._elementRegistry,n=e.context,i=n.shape,r=n.snapContext;r||(r=n.snapContext=new Ri);var o;t.get(i.id)?o=rn(i,e):o={x:e.x+rn(i).x,y:e.y+rn(i).y};var a={x:o.x-i.width/2,y:o.y-i.height/2},s={x:o.x+i.width/2,y:o.y+i.height/2};return r.setSnapOrigin("mid",{x:o.x-e.x,y:o.y-e.y}),me(i)||(r.setSnapOrigin("top-left",{x:a.x-e.x,y:a.y-e.y}),r.setSnapOrigin("bottom-right",{x:s.x-e.x,y:s.y-e.y})),r},Tn.prototype.addSnapTargetPoints=function(e,t,n){var i=this.getSnapTargets(t,n);return A(i,function(r){if(me(r)){me(t)&&e.add("mid",rn(r));return}if(ke(r)){if(r.waypoints.length<3)return;var o=r.waypoints.slice(1,-1);A(o,function(a){e.add("mid",a)});return}e.add("mid",rn(r))}),!le(t.x)||!le(t.y)||this._elementRegistry.get(t.id)&&e.add("mid",rn(t)),e},Tn.prototype.getSnapTargets=function(e,t){return Jv(t).filter(function(n){return!e2(n)})};function e2(e){return!!e.hidden}var h_=1500;function Br(e,t){t.invoke(Tn,this),e.on(["create.move","create.end"],h_,r2),e.on(["create.move","create.end","shape.move.move","shape.move.end"],h_,function(n){var i=n.context,r=i.canExecute,o=i.target,a=r&&(r==="attach"||r.attach);a&&!Or(n)&&t2(n,o)})}X(Br,Tn),Br.$inject=["eventBus","injector"],Br.prototype.initSnap=function(e){var t=Tn.prototype.initSnap.call(this,e),n=e.shape,i=!!this._elementRegistry.get(n.id);return A(n.outgoing,function(r){var o=r.waypoints[0];o=o.original||o,t.setSnapOrigin(r.id+"-docking",g_(o,i,e))}),A(n.incoming,function(r){var o=r.waypoints[r.waypoints.length-1];o=o.original||o,t.setSnapOrigin(r.id+"-docking",g_(o,i,e))}),_(n,"bpmn:Participant")&&t.setSnapLocations(["top-left","bottom-right","mid"]),t},Br.prototype.addSnapTargetPoints=function(e,t,n){Tn.prototype.addSnapTargetPoints.call(this,e,t,n);var i=this.getSnapTargets(t,n);A(i,function(o){(i2(o)||n2([t,o],"bpmn:TextAnnotation"))&&(e.add("top-left",Zv(o)),e.add("bottom-right",Qv(o)))});var r=this._elementRegistry;return A(t.incoming,function(o){if(r.get(t.id)){m_(i,o.source)||e.add("mid",ce(o.source));var a=o.waypoints[0];e.add(o.id+"-docking",a.original||a)}}),A(t.outgoing,function(o){if(r.get(t.id)){m_(i,o.target)||e.add("mid",ce(o.target));var a=o.waypoints[o.waypoints.length-1];e.add(o.id+"-docking",a.original||a)}}),_(n,"bpmn:SequenceFlow")&&(e=this.addSnapTargetPoints(e,t,n.parent)),e},Br.prototype.getSnapTargets=function(e,t){return Tn.prototype.getSnapTargets.call(this,e,t).filter(function(n){return!_(n,"bpmn:Lane")})};function t2(e,t){var n=ne(t),i=Mh(e,t),r=e.context,o=r.shape,a;o.parent?a={x:0,y:0}:a=ce(o),/top/.test(i)?Je(e,"y",n.top-a.y):/bottom/.test(i)&&Je(e,"y",n.bottom-a.y),/left/.test(i)?Je(e,"x",n.left-a.x):/right/.test(i)&&Je(e,"x",n.right-a.x)}function n2(e,t){return e.every(function(n){return _(n,t)})}function i2(e){return _(e,"bpmn:SubProcess")&&Ee(e)?!0:_(e,"bpmn:Participant")}function r2(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)&&Je(e,"x",e.x),(i&&i>=e.y||o&&o<=e.y)&&Je(e,"y",e.y)}}function m_(e,t){return e.indexOf(t)!==-1}function g_(e,t,n){return t?{x:e.x-n.x,y:e.y-n.y}:{x:e.x,y:e.y}}var o2=1250;function Vo(e,t){var n=this;e.on(["resize.start"],function(i){n.initSnap(i)}),e.on(["resize.move","resize.end"],o2,function(i){var r=i.context,o=r.shape,a=o.parent,s=r.direction,c=r.snapContext;if(!(i.originalEvent&&Nt(i.originalEvent))&&!Or(i)){var u=c.pointsForTarget(a);u.initialized||(u=n.addSnapTargetPoints(u,o,a,s),u.initialized=!0),c2(s)&&Je(i,"x",i.x),u2(s)&&Je(i,"y",i.y),t.snap(i,u)}}),e.on(["resize.cleanup"],function(){t.hide()})}Vo.prototype.initSnap=function(e){var t=e.context,n=t.shape,i=t.direction,r=t.snapContext;r||(r=t.snapContext=new Ri);var o=v_(n,i);return r.setSnapOrigin("corner",{x:o.x-e.x,y:o.y-e.y}),r},Vo.prototype.addSnapTargetPoints=function(e,t,n,i){var r=this.getSnapTargets(t,n);return A(r,function(o){e.add("corner",Qv(o)),e.add("corner",Zv(o))}),e.add("corner",v_(t,i)),e},Vo.$inject=["eventBus","snapping"],Vo.prototype.getSnapTargets=function(e,t){return Jv(t).filter(function(n){return!a2(n,e)&&!ke(n)&&!s2(n)&&!me(n)})};function v_(e,t){var n=ce(e),i=ne(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 a2(e,t){return e.host===t}function s2(e){return!!e.hidden}function c2(e){return e==="n"||e==="s"}function u2(e){return e==="e"||e==="w"}var l2=7,p2=1e3;function Ci(e){this._canvas=e,this._asyncHide=fc(At(this.hide,this),p2)}Ci.$inject=["canvas"],Ci.prototype.snap=function(e,t){var n=e.context,i=n.snapContext,r=i.getSnapLocations(),o={x:Or(e,"x"),y:Or(e,"y")};A(r,function(a){var s=i.getSnapOrigin(a),c={x:e.x+s.x,y:e.y+s.y};if(A(["x","y"],function(u){var l;o[u]||(l=t.snap(c,a,u,l2),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),A(["x","y"],function(a){var s=o[a];ut(s)&&Je(e,a,s.originValue)})},Ci.prototype._createLine=function(e){var t=this._canvas.getLayer("snap"),n=te("path");return Z(n,{d:"M0,0 L0,0"}),xe(n).add("djs-snap-line"),fe(t,n),{update:function(i){le(i)?e==="horizontal"?Z(n,{d:"M-100000,"+i+" L+100000,"+i,display:""}):Z(n,{d:"M "+i+",-100000 L "+i+", +100000",display:""}):Z(n,{display:"none"})}}},Ci.prototype._createSnapLines=function(){this._snapLines={horizontal:this._createLine("horizontal"),vertical:this._createLine("vertical")}},Ci.prototype.showSnapLine=function(e,t){var n=this.getSnapLine(e);n&&n.update(t),this._asyncHide()},Ci.prototype.getSnapLine=function(e){return this._snapLines||this._createSnapLines(),this._snapLines[e]},Ci.prototype.hide=function(){A(this._snapLines,function(e){e.update()})};const f2={__depends__:[{__init__:["createMoveSnapping","resizeSnapping","snapping"],createMoveSnapping:["type",Tn],resizeSnapping:["type",Vo],snapping:["type",Ci]}],__init__:["connectSnapping","createMoveSnapping"],connectSnapping:["type",l_],createMoveSnapping:["type",Br]};var y_=300;function de(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=Me(de.INPUT_SELECTOR,this._container),this._resultsContainer=Me(de.RESULTS_CONTAINER_SELECTOR,this._container),this._canvas.getContainer().appendChild(this._container),t.on(["canvas.destroy","diagram.destroy","drag.init","elements.changed"],this.close,this)}de.$inject=["canvas","eventBus","selection","translate"],de.prototype._bindEvents=function(){var e=this;function t(n,i,r,o){e._eventMaps.push({el:n,type:r,listener:It.bind(n,i,r,o)})}t(document,"html","click",function(n){e.close(!1)}),t(this._container,de.INPUT_SELECTOR,"click",function(n){n.stopPropagation(),n.delegateTarget.focus()}),t(this._container,de.RESULT_SELECTOR,"mouseover",function(n){n.stopPropagation(),e._scrollToNode(n.delegateTarget),e._preselect(n.delegateTarget)}),t(this._container,de.RESULT_SELECTOR,"click",function(n){n.stopPropagation(),e._select(n.delegateTarget)}),t(this._container,de.INPUT_SELECTOR,"keydown",function(n){at("ArrowUp",n)&&n.preventDefault(),at("ArrowDown",n)&&n.preventDefault()}),t(this._container,de.INPUT_SELECTOR,"keyup",function(n){if(at("Escape",n))return e.close();if(at("Enter",n)){var i=e._getCurrentResult();return i?e._select(i):e.close(!1)}if(at("ArrowUp",n))return e._scrollToDirection(!0);if(at("ArrowDown",n))return e._scrollToDirection();at(["ArrowLeft","ArrowRight"],n)||e._search(n.delegateTarget.value)})},de.prototype._unbindEvents=function(){this._eventMaps.forEach(function(e){It.unbind(e.el,e.type,e.listener)})},de.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=Me(de.RESULT_SELECTOR,this._resultsContainer);this._scrollToNode(i),this._preselect(i)}},de.prototype._scrollToDirection=function(e){var t=this._getCurrentResult();if(t){var n=e?t.previousElementSibling:t.nextElementSibling;n&&(this._scrollToNode(n),this._preselect(n))}},de.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)}},de.prototype._clearResults=function(){ia(this._resultsContainer),this._results={},this._eventBus.fire("searchPad.cleared")},de.prototype._getCurrentResult=function(){return Me(de.RESULT_SELECTED_SELECTOR,this._resultsContainer)},de.prototype._createResultNode=function(e,t){var n=Ne(de.RESULT_HTML);return e.primaryTokens.length>0&&__(n,e.primaryTokens,de.RESULT_PRIMARY_HTML),__(n,e.secondaryTokens,de.RESULT_SECONDARY_HTML),Et(n,de.RESULT_ID_ATTRIBUTE,t),this._resultsContainer.appendChild(n),n},de.prototype.registerProvider=function(e){this._searchProvider=e},de.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,He(this._canvas.getContainer()).add("djs-search-open"),He(this._container).add("open"),this._searchInput.focus(),this._eventBus.fire("searchPad.opened"))},de.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,He(this._canvas.getContainer()).remove("djs-search-open"),He(this._container).remove("open"),this._clearResults(),this._searchInput.value="",this._searchInput.blur(),this._eventBus.fire("searchPad.closed"),this._canvas.restoreFocus())},de.prototype.toggle=function(){this.isOpen()?this.close():this.open()},de.prototype.isOpen=function(){return this._open},de.prototype._preselect=function(e){var t=this._getCurrentResult();if(e!==t){t&&He(t).remove(de.RESULT_SELECTED_CLASS);var n=Et(e,de.RESULT_ID_ATTRIBUTE),i=this._results[n].element;He(e).add(de.RESULT_SELECTED_CLASS),this._canvas.scrollToElement(i,{top:y_}),this._selection.select(i),this._eventBus.fire("searchPad.preselected",i)}},de.prototype._select=function(e){var t=Et(e,de.RESULT_ID_ATTRIBUTE),n=this._results[t].element;this._cachedSelection=null,this._cachedViewbox=null,this.close(!1),this._canvas.scrollToElement(n,{top:y_}),this._selection.select(n),this._eventBus.fire("searchPad.selected",n)},de.prototype._getBoxHtml=function(){const e=Ne(de.BOX_HTML),t=Me(de.INPUT_SELECTOR,e);return t&&t.setAttribute("aria-label",this._translate("Search in diagram")),e};function __(e,t,n){var i=d2(t),r=Ne(n);r.innerHTML=i,e.appendChild(r)}function d2(e){var t="";return e.forEach(function(n){var i=Pg(n.value||n.matched||n.normal),r=n.match||n.matched;r?t+='<b class="'+de.RESULT_HIGHLIGHT_CLASS+'">'+i+"</b>":t+=i}),t!==""?t:null}de.CONTAINER_SELECTOR=".djs-search-container",de.INPUT_SELECTOR=".djs-search-input input",de.RESULTS_CONTAINER_SELECTOR=".djs-search-results",de.RESULT_SELECTOR=".djs-search-result",de.RESULT_SELECTED_CLASS="djs-search-result-selected",de.RESULT_SELECTED_SELECTOR="."+de.RESULT_SELECTED_CLASS,de.RESULT_ID_ATTRIBUTE="data-result-id",de.RESULT_HIGHLIGHT_CLASS="djs-search-highlight",de.BOX_HTML=`<div class="djs-search-container djs-scrollable">
334
+ </svg>`},SM=900;function ha(e,t,n,i){this._distributeElements=t,this._translate=n,this._popupMenu=e,this._rules=i,e.registerProvider("align-elements",SM,this)}ha.$inject=["popupMenu","distributeElements","translate","rules"],ha.prototype.getPopupMenuEntries=function(e){var t={};return this._isAllowed(e)&&k(t,this._getEntries(e)),t},ha.prototype._isAllowed=function(e){return this._rules.allowed("elements.distribute",{elements:e})},ha.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:s_.horizontal,action:function(o,a){t.trigger(e,"horizontal"),i.close()}},"distribute-elements-vertical":{group:"distribute",title:n("Distribute elements vertically"),imageHtml:s_.vertical,action:function(o,a){t.trigger(e,"vertical"),i.close()}}};return r};const RM={__depends__:[Tp,wM],__init__:["bpmnDistributeElements","distributeElementsMenuProvider"],bpmnDistributeElements:["type",Ec],distributeElementsMenuProvider:["type",ha]};var c_="is not a registered action",CM="is already registered";function Pn(e,t){this._eventBus=e,this._actions={};var n=this;e.on("diagram.init",function(){n._registerDefaultActions(t),e.fire("editorActions.init",{editorActions:n})})}Pn.$inject=["eventBus","injector"],Pn.prototype._registerDefaultActions=function(e){var t=e.get("commandStack",!1),n=e.get("modeling",!1),i=e.get("selection",!1),r=e.get("zoomScroll",!1),o=e.get("copyPaste",!1),a=e.get("canvas",!1),s=e.get("rules",!1),c=e.get("keyboardMove",!1),u=e.get("keyboardMoveSelection",!1);t&&(this.register("undo",function(){t.undo()}),this.register("redo",function(){t.redo()})),o&&i&&this.register("copy",function(){var l=i.get();if(l.length)return o.copy(l)}),o&&i&&this.register("duplicate",function(){var l=i.get();if(l.length)return o.duplicate(l)}),o&&this.register("paste",function(){o.paste()}),o&&i&&s&&this.register("cut",function(){var l=i.get();if(l.length){var p=s.allowed("elements.delete",{elements:l});if(p!==!1){var f=pe(p)?p:l;return o.cut(f.slice())}}}),r&&this.register("stepZoom",function(l){r.stepZoom(l.value)}),a&&this.register("zoom",function(l){a.zoom(l.value)}),n&&i&&s&&this.register("removeSelection",function(){var l=i.get();if(l.length){var p=s.allowed("elements.delete",{elements:l}),f;p!==!1&&(pe(p)?f=p:f=l,f.length&&n.removeElements(f.slice()))}}),c&&this.register("moveCanvas",function(l){c.moveCanvas(l)}),u&&this.register("moveSelection",function(l){u.moveSelection(l.direction,l.accelerated)})},Pn.prototype.trigger=function(e,t){if(!this._actions[e])throw jp(e,c_);var n=this._eventBus.fire("editorActions.allowed",{action:e,opts:t});if(n!==!1)return this._actions[e](t)},Pn.prototype.register=function(e,t){var n=this;if(typeof e=="string")return this._registerAction(e,t);T(e,function(i,r){n._registerAction(r,i)})},Pn.prototype._registerAction=function(e,t){if(this.isRegistered(e))throw jp(e,CM);this._actions[e]=t},Pn.prototype.unregister=function(e){if(!this.isRegistered(e))throw jp(e,c_);this._actions[e]=void 0},Pn.prototype.getActions=function(){return Object.keys(this._actions)},Pn.prototype.isRegistered=function(e){return!!this._actions[e]};function jp(e,t){return new Error(e+" "+t)}const PM={__init__:["editorActions"],editorActions:["type",Pn]};function wc(e){e.invoke(Pn,this)}Q(wc,Pn),wc.$inject=["injector"],wc.prototype._registerDefaultActions=function(e){Pn.prototype._registerDefaultActions.call(this,e);var t=e.get("canvas",!1),n=e.get("elementRegistry",!1),i=e.get("selection",!1),r=e.get("spaceTool",!1),o=e.get("lassoTool",!1),a=e.get("handTool",!1),s=e.get("globalConnect",!1),c=e.get("distributeElements",!1),u=e.get("alignElements",!1),l=e.get("directEditing",!1),p=e.get("searchPad",!1),f=e.get("modeling",!1),d=e.get("contextPad",!1);t&&n&&i&&this._registerAction("selectElements",function(){var h=t.getRootElement(),m=n.filter(function(g){return g!==h});return i.select(m),m}),r&&this._registerAction("spaceTool",function(){r.toggle()}),o&&this._registerAction("lassoTool",function(){o.toggle()}),a&&this._registerAction("handTool",function(){a.toggle()}),s&&this._registerAction("globalConnectTool",function(){s.toggle()}),i&&c&&this._registerAction("distributeElements",function(h){var m=i.get(),g=h.type;m.length&&c.trigger(m,g)}),i&&u&&this._registerAction("alignElements",function(h){var m=i.get(),g=[],w=h.type;m.length&&(g=we(m,function(E){return!y(E,"bpmn:Lane")}),u.trigger(g,w))}),i&&f&&this._registerAction("setColor",function(h){var m=i.get();m.length&&f.setColor(m,h)}),i&&l&&this._registerAction("directEditing",function(){var h=i.get();h.length&&l.activate(h[0])}),p&&this._registerAction("find",function(){p.toggle()}),t&&f&&this._registerAction("moveToOrigin",function(){var h=t.getRootElement(),m,g;y(h,"bpmn:Collaboration")?g=n.filter(function(w){return y(w.parent,"bpmn:Collaboration")}):g=n.filter(function(w){return w!==h&&!y(w.parent,"bpmn:SubProcess")}),m=at(g),f.moveElements(g,{x:-m.x,y:-m.y},h)}),i&&d&&this._registerAction("replaceElement",function(h){d.triggerEntry("replace","click",h)})};const AM={__depends__:[PM],editorActions:["type",wc]};function u_(e){e.on(["create.init","shape.move.init"],function(t){var n=t.context,i=t.shape;xe(i,["bpmn:Participant","bpmn:SubProcess","bpmn:TextAnnotation"])&&(n.gridSnappingContext||(n.gridSnappingContext={}),n.gridSnappingContext.snapLocation="top-left")})}u_.$inject=["eventBus"];function Sr(e,t){W.call(this,e),this._gridSnapping=t;var n=this;this.preExecute("shape.resize",function(i){var r=i.context,o=r.hints||{},a=o.autoResize;if(a){var s=r.shape,c=r.newBounds;Qt(a)?r.newBounds=n.snapComplex(c,a):r.newBounds=n.snapSimple(s,c)}})}Sr.$inject=["eventBus","gridSnapping","modeling"],Q(Sr,W),Sr.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},Sr.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},Sr.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),k(e,o),e},Sr.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),k(e,o),e};var TM=2e3;function l_(e,t){e.on(["spaceTool.move","spaceTool.end"],TM,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)}})}l_.$inject=["eventBus","gridSnapping"];const MM={__init__:["gridSnappingResizeBehavior","gridSnappingSpaceToolBehavior"],gridSnappingResizeBehavior:["type",Sr],gridSnappingSpaceToolBehavior:["type",l_]};var Sc=10;function Fp(e,t,n){return n||(n="round"),Math[n](e/t)*t}var kM=1200,DM=800;function Yi(e,t,n){var i=!n||n.active!==!1;this._eventBus=t;var r=this;t.on("diagram.init",DM,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"],kM,function(o){var a=o.originalEvent;if(!(!r.active||a&&on(a))){var s=o.context,c=s.gridSnappingContext;c||(c=s.gridSnappingContext={}),["x","y"].forEach(function(u){var l={},p=IM(o,u,e);p&&(l.offset=p);var f=OM(o,u);f&&k(l,f),uo(o,u)||r.snapEvent(o,u,l)})}})}Yi.prototype.snapEvent=function(e,t,n){var i=this.snapValue(e[t],n);lt(e,t,i)},Yi.prototype.getGridSpacing=function(){return Sc},Yi.prototype.snapValue=function(e,t){var n=0;t&&t.offset&&(n=t.offset),e+=n,e=Fp(e,Sc);var i,r;return t&&t.min&&(i=t.min,he(i)&&(i=Fp(i+n,Sc,"ceil"),e=Math.max(e,i))),t&&t.max&&(r=t.max,he(r)&&(r=Fp(r+n,Sc,"floor"),e=Math.min(e,r))),e-=n,e},Yi.prototype.isActive=function(){return this.active},Yi.prototype.setActive=function(e){this.active=e,this._eventBus.fire("gridSnapping.toggle",{active:e})},Yi.prototype.toggleActive=function(){this.setActive(!this.active)},Yi.$inject=["elementRegistry","eventBus","config.gridSnapping"];function OM(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&&(Rc(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&&(Rc(t)?f_(s)?a.x.max=c.left:a.x.min=c.right:p_(s)?a.y.max=c.top:a.y.min=c.bottom),u&&(Rc(t)?f_(s)?a.x.min=u.left:a.x.max=u.right:p_(s)?a.y.min=u.top:a.y.max=u.bottom),a[t]}function IM(e,t,n){var i=e.context,r=e.shape,o=i.gridSnappingContext,a=o.snapLocation,s=o.snapOffset;return s&&he(s[t])||(s||(s=o.snapOffset={}),he(s[t])||(s[t]=0),!r)||(n.get(r.id)||(Rc(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 Rc(e){return e==="x"}function p_(e){return e.indexOf("n")!==-1}function f_(e){return e.indexOf("w")!==-1}const LM={__depends__:[MM],__init__:["gridSnapping"],gridSnapping:["type",Yi]};var BM=2e3;function d_(e,t,n){e.on("autoPlace",BM,function(i){var r=i.source,o=fe(r),a=i.shape,s=pv(r,a,n);return["x","y"].forEach(function(c){var u={};s[c]!==o[c]&&(s[c]>o[c]?u.min=s[c]:u.max=s[c],y(a,"bpmn:TextAnnotation")&&(NM(c)?u.offset=-a.width/2:u.offset=-a.height/2),s[c]=t.snapValue(s[c],u))}),s})}d_.$inject=["eventBus","gridSnapping","elementRegistry"];function NM(e){return e==="x"}var $M=1750;function h_(e,t,n){t.on(["create.start","shape.move.start"],$M,function(i){var r=i.context,o=r.shape,a=e.getRootElement();if(!(!y(o,"bpmn:Participant")||!y(a,"bpmn:Process")||!a.children.length)){var s=r.createConstraints;s&&(o.width=n.snapValue(o.width,{min:o.width}),o.height=n.snapValue(o.height,{min:o.height}))}})}h_.$inject=["canvas","eventBus","gridSnapping"];var jM=3e3;function Cc(e,t,n){W.call(this,e),this._gridSnapping=t;var i=this;this.postExecuted(["connection.create","connection.layout"],jM,function(r){var o=r.context,a=o.connection,s=o.hints||{},c=a.waypoints;s.connectionStart||s.connectionEnd||s.createElementsBehavior===!1||FM(c)&&n.updateWaypoints(a,i.snapMiddleSegments(c))})}Cc.$inject=["eventBus","gridSnapping","modeling"],Q(Cc,W),Cc.prototype.snapMiddleSegments=function(e){var t=this._gridSnapping,n;e=e.slice();for(var i=1;i<e.length-2;i++)n=VM(t,e[i],e[i+1]),e[i]=n[0],e[i+1]=n[1];return e};function FM(e){return e.length>3}function HM(e){return e==="h"}function zM(e){return e==="v"}function VM(e,t,n){var i=ni(t,n),r={};return HM(i)&&(r.y=e.snapValue(t.y)),zM(i)&&(r.x=e.snapValue(t.x)),("x"in r||"y"in r)&&(t=k({},t,r),n=k({},n,r)),[t,n]}const GM={__depends__:[LM,{__init__:["gridSnappingAutoPlaceBehavior","gridSnappingParticipantBehavior","gridSnappingLayoutConnectionBehavior"],gridSnappingAutoPlaceBehavior:["type",d_],gridSnappingParticipantBehavior:["type",h_],gridSnappingLayoutConnectionBehavior:["type",Cc]}],__init__:["bpmnGridSnapping"],bpmnGridSnapping:["type",u_]};var WM=30,m_=30;function ma(e,t){this._interactionEvents=t;var n=this;e.on(["interactionEvents.createHit","interactionEvents.updateHit"],function(i){var r=i.element,o=i.gfx;if(y(r,"bpmn:Lane"))return n._createParticipantHit(r,o);if(y(r,"bpmn:Participant"))return Re(r)?n._createParticipantHit(r,o):n._createDefaultHit(r,o);if(y(r,"bpmn:SubProcess"))return Re(r)?n._createSubProcessHit(r,o):n._createDefaultHit(r,o)})}ma.$inject=["eventBus","interactionEvents"],ma.prototype._createDefaultHit=function(e,t){return this._interactionEvents.removeHits(t),this._interactionEvents.createDefaultHit(e,t),!0},ma.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=St(e)?{width:WM,height:e.height}:{width:e.width,height:m_};return this._interactionEvents.createBoxHit(t,"all",n),!0},ma.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:m_}),!0};const UM={__init__:["bpmnInteractionEvents"],bpmnInteractionEvents:["type",ma]};function Pc(e){e.invoke(no,this)}Q(Pc,no),Pc.$inject=["injector"],Pc.prototype.registerBindings=function(e,t){no.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 qM={__depends__:[hp],__init__:["keyboardBindings"],keyboardBindings:["type",Pc]};var YM={moveSpeed:1,moveSpeedAccelerated:10},KM=1500,g_="left",v_="up",y_="right",__="down",XM={ArrowLeft:g_,Left:g_,ArrowUp:v_,Up:v_,ArrowRight:y_,Right:y_,ArrowDown:__,Down:__},ZM={left:function(e){return{x:-e,y:0}},up:function(e){return{x:0,y:-e}},right:function(e){return{x:e,y:0}},down:function(e){return{x:0,y:e}}};function b_(e,t,n,i,r){var o=this;this._config=k({},YM,e||{}),t.addListener(KM,function(a){var s=a.keyEvent,c=XM[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=ZM[a](u),p=i.allowed("elements.move",{shapes:c,hints:{keyboardMove:!0}});p&&n.moveElements(c,l)}}}b_.$inject=["config.keyboardMoveSelection","keyboard","modeling","rules","selection"];const QM={__depends__:[hp,En],__init__:["keyboardMoveSelection"],keyboardMoveSelection:["type",b_]};var x_=10;function ga(e,t,n,i){this._dragging=i,this._rules=t;var r=this;function o(c,u){var l=c.shape,p=c.direction,f=c.resizeConstraints,d;c.delta=u,d=z1(l,p,u),c.newBounds=G1(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:le(l)})}function s(c){var u=c.shape,l=c.canExecute,p=c.newBounds;if(l){if(p=Nd(p),!JM(u,p))return;n.resizeShape(u,p)}}e.on("resize.start",function(c){a(c.context)}),e.on("resize.move",function(c){var u={x:c.dx,y:c.dy};o(c.context,u)}),e.on("resize.end",function(c){s(c.context)})}ga.prototype.canResize=function(e){var t=this._rules,n=Mn(e,["newBounds","shape","delta","direction"]);return t.allowed("shape.resize",n)},ga.prototype.activate=function(e,t,n){var i=this._dragging,r,o;if(typeof n=="string"&&(n={direction:n}),r=k({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,E_(t,o),"resize",{autoActivate:!0,cursor:e2(o),data:{shape:t,context:r}})},ga.prototype.computeMinResizeBox=function(e){var t=e.shape,n=e.direction,i,r;return i=e.minDimensions||{width:x_,height:x_},r=Sh(t,e.childrenBoxPadding),W1(n,t,i,r)},ga.$inject=["eventBus","rules","modeling","dragging"];function JM(e,t){return e.x!==t.x||e.y!==t.y||e.width!==t.width||e.height!==t.height}function E_(e,t){var n=fe(e),i=le(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 e2(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 w_="djs-resizing",S_="resize-not-ok",t2=500;function R_(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,w_)),s.width>5&&J(c,{x:s.x,width:s.width}),s.height>5&&J(c,{y:s.y,height:s.height}),o.canExecute?Pe(c).remove(S_):Pe(c).add(S_)}function r(o){var a=o.shape,s=o.frame;s&&vt(o.frame),t.removeMarker(a,w_)}e.on("resize.move",t2,function(o){i(o.context)}),e.on("resize.cleanup",function(o){r(o.context)})}R_.$inject=["eventBus","canvas","previewSupport"];var Ac=-6,Tc=8,Mc=20,va="djs-resizer",n2=["n","w","s","e","nw","ne","se","sw"];function Ki(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&&T(a,Yt(r.addResizer,r))}),e.on("shape.changed",function(o){var a=o.element;n.isSelected(a)&&(r.removeResizers(),r.addResizer(a))})}Ki.prototype.makeDraggable=function(e,t,n){var i=this._resize;function r(o){Ni(o)&&i.activate(o,e,n)}me.bind(t,"mousedown",r),me.bind(t,"touchstart",r)},Ki.prototype._createResizer=function(e,t,n,i){var r=this._getResizersParent(),o=i2(i),a=se("g");Pe(a).add(va),Pe(a).add(va+"-"+e.id),Pe(a).add(va+"-"+i),ge(r,a);var s=se("rect");J(s,{x:-Tc/2+o.x,y:-Tc/2+o.y,width:Tc,height:Tc}),Pe(s).add(va+"-visual"),ge(a,s);var c=se("rect");return J(c,{x:-Mc/2+o.x,y:-Mc/2+o.y,width:Mc,height:Mc}),Pe(c).add(va+"-hit"),ge(a,c),Ga(a,t,n),a},Ki.prototype.createResizer=function(e,t){var n=E_(e,t),i=this._createResizer(e,n.x,n.y,t);this.makeDraggable(e,i,t)},Ki.prototype.addResizer=function(e){var t=this;$e(e)||T(n2,function(n){t._resize.canResize({shape:e,direction:n})&&t.createResizer(e,n)})},Ki.prototype.removeResizers=function(){var e=this._getResizersParent();La(e)},Ki.prototype._getResizersParent=function(){return this._canvas.getLayer("resizers")},Ki.$inject=["eventBus","canvas","selection","resize"];function i2(e){var t={x:0,y:0};return e.indexOf("e")!==-1?t.x=-Ac:e.indexOf("w")!==-1&&(t.x=Ac),e.indexOf("s")!==-1?t.y=-Ac:e.indexOf("n")!==-1&&(t.y=Ac),t}const C_={__depends__:[Un,ci,Qr],__init__:["resize","resizePreview","resizeHandles"],resize:["type",ga],resizePreview:["type",R_],resizeHandles:["type",Ki]};var r2=2e3;function ya(e,t,n,i,r,o,a){this._bpmnFactory=t,this._canvas=n,this._modeling=r,this._textRenderer=a,i.registerProvider(this),e.on("element.dblclick",function(c){s(c.element,!0)}),e.on(["autoPlace.start","canvas.viewbox.changing","drag.init","element.mousedown","popupMenu.open","root.set","selection.changed"],function(){i.isActive()&&i.complete()}),e.on(["shape.remove","connection.remove"],r2,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||xe(c,["bpmn:Activity","bpmn:Event","bpmn:TextAnnotation","bpmn:Participant"]))&&i.activate(c)}}ya.$inject=["eventBus","bpmnFactory","canvas","directEditing","modeling","resizeHandles","textRenderer"],ya.prototype.activate=function(e){var t=hn(e);if(t!==void 0){var n={text:t},i=this.getEditingBBox(e);k(n,i);var r={},o=n.style||{};return k(o,{backgroundColor:null,border:null}),(xe(e,["bpmn:Task","bpmn:Participant","bpmn:Lane","bpmn:CallActivity"])||P_(e))&&k(r,{centerVertically:!0}),Oi(e)&&(k(r,{resizable:!0,autoResize:!0}),k(o,{backgroundColor:"#ffffff",border:"1px solid #ccc"})),y(e,"bpmn:TextAnnotation")&&(k(r,{resizable:!0,autoResize:!0}),k(o,{backgroundColor:"#ffffff",border:"1px solid #ccc"})),k(n,{options:r,style:o}),n}},ya.prototype.getEditingBBox=function(e){var t=this._canvas,n=e.label||e,i=t.getAbsoluteBBox(n),r={x:i.x+i.width/2,y:i.y+i.height/2},o={x:i.x,y:i.y},a=t.zoom(),s=this._textRenderer.getDefaultStyle(),c=this._textRenderer.getExternalStyle(),u=c.fontSize*a,l=c.lineHeight,p=s.fontSize*a,f=s.lineHeight,d={fontFamily:this._textRenderer.getDefaultStyle().fontFamily,fontWeight:this._textRenderer.getDefaultStyle().fontWeight};if(y(e,"bpmn:Lane")||s2(e)){var h=St(e),m=h?{width:i.height,height:30*a,x:i.x-i.height/2+15*a,y:r.y-30*a/2}:{width:i.width,height:30*a};k(o,m),k(d,{fontSize:p+"px",lineHeight:f,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px",transform:h?"rotate(-90deg)":null})}if(a2(e)){var g=St(e),w=g?{width:i.width,height:i.height}:{width:i.height,height:i.width,x:r.x-i.height/2,y:r.y-i.width/2};k(o,w),k(d,{fontSize:p+"px",lineHeight:f,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px",transform:g?null:"rotate(-90deg)"})}(xe(e,["bpmn:Task","bpmn:CallActivity"])||P_(e))&&(k(o,{width:i.width,height:i.height}),k(d,{fontSize:p+"px",lineHeight:f,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px"})),o2(e)&&(k(o,{width:i.width,x:i.x}),k(d,{fontSize:p+"px",lineHeight:f,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px"}));var E=1,b=i.width+2*E;if(n.labelTarget&&(k(o,{width:b,height:i.height+2*E,x:i.x-E,y:i.y-E}),k(d,{fontSize:u+"px",lineHeight:l})),Oi(n)&&!qa(n)&&!_e(n)){var x=Pu(e),S=t.getAbsoluteBBox({x:x.x,y:x.y,width:0,height:0}),A=u,I=fr.width*a+2*E;k(o,{width:I,height:A+2*E,x:S.x-I/2,y:S.y-A/2-E}),k(d,{fontSize:u+"px",lineHeight:l})}return y(e,"bpmn:TextAnnotation")&&(k(o,{width:i.width+2*E,height:i.height+2*E,x:i.x-E,y:i.y-E,minWidth:30*a,minHeight:10*a}),k(d,{textAlign:"left",paddingTop:jr*a+"px",paddingBottom:jr*a+"px",paddingLeft:jr*a+"px",paddingRight:jr*a+"px",fontSize:p+"px",lineHeight:f})),{bounds:o,style:d}},ya.prototype.update=function(e,t,n,i){var r,o;y(e,"bpmn:TextAnnotation")&&(o=this._canvas.getAbsoluteBBox(e),r={x:e.x,y:e.y,width:e.width/o.width*i.width,height:e.height/o.height*i.height}),c2(t)&&(t=null),this._modeling.updateLabel(e,t,r)};function P_(e){return y(e,"bpmn:SubProcess")&&!Re(e)}function o2(e){return y(e,"bpmn:SubProcess")&&Re(e)}function a2(e){return y(e,"bpmn:Participant")&&!Re(e)}function s2(e){return y(e,"bpmn:Participant")&&Re(e)}function c2(e){return!e||!e.trim()}var A_="djs-element-hidden",T_="djs-label-hidden";function M_(e,t,n){var i=this,r=t.getDefaultLayer(),o,a,s;e.on("directEditing.activate",function(c){var u=c.active;if(o=u.element.label||u.element,y(o,"bpmn:TextAnnotation")){a=t.getAbsoluteBBox(o),s=se("g");var l=n.getScaledPath("TEXT_ANNOTATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:o.width,containerHeight:o.height,position:{mx:0,my:0}}),p=i.path=se("path");J(p,{d:l,strokeWidth:2,stroke:u2(o)}),ge(s,p),ge(r,s),Tt(s,o.x,o.y)}y(o,"bpmn:TextAnnotation")||o.labelTarget?t.addMarker(o,A_):(y(o,"bpmn:Task")||y(o,"bpmn:CallActivity")||y(o,"bpmn:SubProcess")||y(o,"bpmn:Participant")||y(o,"bpmn:Lane"))&&t.addMarker(o,T_)}),e.on("directEditing.resize",function(c){if(y(o,"bpmn:TextAnnotation")){var u=c.height,l=c.dy,p=Math.max(o.height/a.height*(u+l),0),f=n.getScaledPath("TEXT_ANNOTATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:o.width,containerHeight:p,position:{mx:0,my:0}});J(i.path,{d:f})}}),e.on(["directEditing.complete","directEditing.cancel"],function(c){var u=c.active;u&&(t.removeMarker(u.element.label||u.element,A_),t.removeMarker(o,T_)),o=void 0,a=void 0,s&&(vt(s),s=void 0)})}M_.$inject=["eventBus","canvas","pathMap"];function u2(e,t){var n=Me(e);return n.get("stroke")||t||"black"}const l2={__depends__:[Wl,C_,t_],__init__:["labelEditingProvider","labelEditingPreview"],labelEditingProvider:["type",ya],labelEditingPreview:["type",M_]};var p2=500,f2=1e3;function Kn(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){GE(o)||i.createOutline(o)}e.on("element.hover",function(o){r(o.element)}),e.on("selection.changed",function(o){T(o.newSelection,r)}),e.on(["shape.changed","connection.changed"],p2,function(o){var a=o.element,s=o.gfx,c=Be(".djs-outline",s);c&&i.updateOutline(a,c)})}Kn.prototype.createOutline=function(e){var t=this._elementRegistry.getGraphics(e);if(!t)throw new Error("cannot create outline for non-rendered element");var n=Be(".djs-outline",t);return n||(n=this.getOutline(e)||this._createOutlineGfx(),ge(t,n),this.updateOutline(e,n)),n},Kn.prototype._createOutlineGfx=function(){var e=se("rect");return J(e,k({x:0,y:0,rx:4,width:100,height:100},this._outlineStyle)),e},Kn.prototype.updateOutline=function(e,t){e.waypoints?this.updateConnectionOutline(t,e):this.updateShapeOutline(t,e)},Kn.prototype.updateShapeOutline=function(e,t){var n=!1,i=this._getProviders();i.length&&T(i,function(r){n=n||r.updateOutline(t,e)}),n||J(e,{x:-this._outlineOffset,y:-this._outlineOffset,width:t.width+this._outlineOffset*2,height:t.height+this._outlineOffset*2})},Kn.prototype.updateConnectionOutline=function(e,t){var n=at(t);J(e,{x:n.x-this._outlineOffset,y:n.y-this._outlineOffset,width:n.width+this._outlineOffset*2,height:n.height+this._outlineOffset*2})},Kn.prototype.registerProvider=function(e,t){t||(t=e,e=f2),this._eventBus.on("outline.getProviders",e,function(n){n.providers.push(t)})},Kn.prototype._getProviders=function(){var e=this._eventBus.createEvent({type:"outline.getProviders",providers:[]});return this._eventBus.fire(e),e.providers},Kn.prototype.getOutline=function(e){var t,n=this._getProviders();return T(n,function(i){Et(i.getOutline)&&(t=t||i.getOutline(e))}),t},Kn.$inject=["eventBus","styles","elementRegistry"];var kc=6;function Hp(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)})}Hp.prototype._updateMultiSelectionOutline=function(e){var t=this._canvas.getLayer("selectionOutline");La(t);var n=e.length>1,i=this._canvas.getContainer();if(Pe(i)[n?"add":"remove"]("djs-multi-select"),!!n){var r=d2(at(e)),o=se("rect");J(o,k({rx:3},r)),Pe(o).add("djs-selection-outline"),ge(t,o)}},Hp.$inject=["eventBus","canvas","selection"];function d2(e){return{x:e.x-kc,y:e.y-kc,width:e.width+kc*2,height:e.height+kc*2}}const zp={__depends__:[En],__init__:["outline","multiSelectionOutline"],outline:["type",Kn],multiSelectionOutline:["type",Hp]},k_=["bpmn:Event","bpmn:SequenceFlow","bpmn:Gateway"],D_={class:"bjs-label-link",stroke:"var(--element-selected-outline-secondary-stroke-color)",strokeDasharray:"5, 5"},h2=15,Dc=2;function O_(e,t,n,i,r){const o=t.getLayer("overlays");e.on(["selection.changed","shape.changed"],function(){s()}),e.on("selection.changed",function({newSelection:p}){var d;const f=p.filter(h=>xe(h,k_));if(f.length===1){const h=f[0];_e(h)?a(h,h.labelTarget):(d=h.labels)!=null&&d.length&&a(h.labels[0],h)}if(f.length===2){const h=f.find(_e),m=f.find(g=>{var w;return(w=g.labels)==null?void 0:w.includes(h)});h&&m&&a(h,m)}}),e.on("shape.changed",function({element:p}){var f;!xe(p,k_)||!l(p)||(_e(p)?a(p,p.labelTarget):(f=p.labels)!=null&&f.length&&a(p.labels[0],p))});function a(p,f){const d=xo([fe(f),fe(p)],D_),h=d.getAttribute("d"),g=r.isSelected(p)?c(p):u(p),w=Ro(g,h);if(!w)return;const b=r.isSelected(f)?c(f):u(f),x=Ro(b,h)||fe(f);Lo(x,w)<h2||(_u(d,[x,w]),ge(o,d))}function s(){Ia(`.${D_.class}`,o).forEach(vt)}function c(p){const f=i.getOutline(p);if(!f)return u(p);if(f.x){const d={x:p.x+Xi(f,"x")-Dc,y:p.y+Xi(f,"y")-Dc,width:Xi(f,"width")+Dc*2,height:Xi(f,"height")+Dc*2};return Tu(d,Xi(f,"rx"))}if(f.cx){const d=Xi(f,"r"),h={x:p.x+Xi(f,"cx")-d,y:p.y+Xi(f,"cy")-d,width:d*2,height:d*2};return sh(h)}}function u(p){return n.getShapePath(p)}function l(p){return r.isSelected(p)}}O_.$inject=["eventBus","canvas","graphicsFactory","outline","selection"];function Xi(e,t){return parseFloat(J(e,t)||0)}const m2={__depends__:[En,zp],__init__:["labelLink"],labelLink:["type",O_]};var g2=new Zr("tt");function v2(e){var t=Ge('<div class="djs-tooltip-container" />');return Wt(t,{position:"absolute",width:"0",height:"0"}),e.insertBefore(t,e.firstChild),t}function y2(e,t,n){Wt(e,{left:t+"px",top:n+"px"})}function Vp(e,t){e.style.display=t===!1?"none":""}var I_="djs-tooltip",Gp="."+I_;function Xt(e,t){this._eventBus=e,this._canvas=t,this._ids=g2,this._tooltipDefaults={show:{minZoom:.7,maxZoom:5}},this._tooltips={},this._tooltipRoot=v2(t.getContainer());var n=this;tn.bind(this._tooltipRoot,Gp,"mousedown",function(i){i.stopPropagation()}),tn.bind(this._tooltipRoot,Gp,"mouseover",function(i){n.trigger("mouseover",i)}),tn.bind(this._tooltipRoot,Gp,"mouseout",function(i){n.trigger("mouseout",i)}),this._init()}Xt.$inject=["eventBus","canvas"],Xt.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=k({},this._tooltipDefaults,e,{id:t}),this._addTooltip(e),e.timeout&&this.setTimeout(e),t},Xt.prototype.trigger=function(e,t){var n=t.delegateTarget||t.target,i=this.get(Nt(n,"data-tooltip-id"));i&&(e==="mouseover"&&i.timeout&&this.clearTimeout(i),e==="mouseout"&&i.timeout&&(i.timeout=1e3,this.setTimeout(i)))},Xt.prototype.get=function(e){return typeof e!="string"&&(e=e.id),this._tooltips[e]},Xt.prototype.clearTimeout=function(e){if(e=this.get(e),!!e){var t=e.removeTimer;t&&(clearTimeout(t),e.removeTimer=null)}},Xt.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)}},Xt.prototype.remove=function(e){var t=this.get(e);t&&(Fn(t.html),Fn(t.htmlContainer),delete t.htmlContainer,delete this._tooltips[t.id])},Xt.prototype.show=function(){Vp(this._tooltipRoot)},Xt.prototype.hide=function(){Vp(this._tooltipRoot,!1)},Xt.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},Xt.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)),Qt(n)&&(n=Ge(n)),i=Ge('<div data-tooltip-id="'+t+'" class="'+I_+'">'),Wt(i,{position:"absolute"}),i.appendChild(n),e.type&&Ye(i).add("djs-tooltip-"+e.type),e.className&&Ye(i).add(e.className),e.htmlContainer=i,r.appendChild(i),this._tooltips[t]=e,this._updateTooltip(e)},Xt.prototype._updateTooltip=function(e){var t=e.position,n=e.htmlContainer;y2(n,t.x,t.y)},Xt.prototype._updateTooltipVisibilty=function(e){T(this._tooltips,function(t){var n=t.show,i=t.htmlContainer,r=!0;n&&((n.minZoom>e.scale||n.maxZoom<e.scale)&&(r=!1),Vp(i,r))})},Xt.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 _2={__init__:["tooltips"],tooltips:["type",Xt]};var b2="flow elements must be children of pools/participants",x2="Data object must be placed within a pool/participant.";function L_(e,t,n){function i(r,o,a){t.add({position:{x:r.x+5,y:r.y+5},type:"error",timeout:2e3,html:"<div>"+o+"</div>"})}e.on(["shape.move.rejected","create.rejected"],function(r){var o=r.context,a=o.shape,s=o.target;y(s,"bpmn:Collaboration")&&(y(a,"bpmn:FlowNode")?i(r,n(b2)):y(a,"bpmn:DataObjectReference")&&i(r,n(x2)))})}L_.$inject=["eventBus","tooltips","translate"];const E2={__depends__:[_2],__init__:["modelingFeedback"],modelingFeedback:["type",L_]};var w2=500,S2=1250,R2=1500,Oc=Math.round;function C2(e){return{x:e.x+Oc(e.width/2),y:e.y+Oc(e.height/2)}}function B_(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",R2,function(s){var c=s.context,u=s.shape,l=i.get().slice();l.indexOf(u)===-1&&(l=[u]),l=P2(l),k(c,{shapes:l,validatedShapes:l,shape:u})}),e.on("shape.move.start",S2,function(s){var c=s.context,u=c.validatedShapes,l;if(l=c.canExecute=o(u),!l)return!1}),e.on("shape.move.move",w2,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=Oc(u.x),u.y=Oc(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(Ni(s)){var c=qr(s);if(!c)throw new Error("must supply DOM mousedown event");return a(c,s.element)}});function a(s,c,u,l){if(xt(u)&&(l=u,u=!1),!(c.waypoints||!c.parent)&&!Pe(s.target).has("djs-hit-no-move")){var p=C2(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}B_.$inject=["eventBus","dragging","modeling","selection","rules"];function P2(e){var t=Tr(e,"id");return we(e,function(n){for(;n=n.parent;)if(t[n.id])return!1;return!0})}var N_=499,Wp="djs-dragging",$_="drop-ok",j_="drop-not-ok",F_="new-parent",H_="attach-ok";function z_(e,t,n,i){function r(c){var u=o(c),l=A2(u);return l}function o(c){var u=Eo(c),l=u.flatMap(d=>(d.incoming||[]).concat(d.outgoing||[])),p=u.concat(l),f=[...new Set(p)];return f}function a(c,u){[H_,$_,j_,F_].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,Wp),c.allDraggedElements?c.allDraggedElements.push(u):c.allDraggedElements=[u]}e.on("shape.move.start",N_,function(c){var u=c.context,l=u.shapes,p=u.allDraggedElements,f=r(l);if(!u.dragGroup){var d=se("g");J(d,n.cls("djs-drag-group",["no-events"]));var h=t.getActiveLayer();ge(h,d),u.dragGroup=d}f.forEach(function(m){i.addDragger(m,u.dragGroup)}),p?p=jc([p,o(l)]):p=o(l),T(p,function(m){t.addMarker(m,Wp)}),u.allDraggedElements=p,u.differentParents=T2(l)}),e.on("shape.move.move",N_,function(c){var u=c.context,l=u.dragGroup,p=u.target,f=u.shape.parent,d=u.canExecute;p&&(d==="attach"?a(p,H_):u.canExecute&&f&&p.id!==f.id?a(p,F_):a(p,u.canExecute?$_:j_)),Tt(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;T(l,function(f){t.removeMarker(f,Wp)}),p&&vt(p)}),this.makeDraggable=s}z_.$inject=["eventBus","canvas","styles","previewSupport"];function A2(e){var t=new Set;e.forEach(function(i){t.add(i.id)});var n=we(e,function(i){return $e(i)?t.has(i.source.id)&&t.has(i.target.id):!0});return n}function T2(e){return Ob(Tr(e,function(t){return t.parent&&t.parent.id}))!==1}const M2={__depends__:[Ss,En,zp,Un,ci,Qr],__init__:["move","movePreview"],move:["type",B_],movePreview:["type",z_]};var V_=".djs-palette-toggle",G_=".entry",k2=V_+", "+G_,Up="djs-palette-",D2="shown",qp="open",W_="two-column",O2=1e3;function pt(e,t){this._eventBus=e,this._canvas=t;var n=this;e.on("tool-manager.update",function(i){var r=i.tool;n.updateToolHighlight(r)}),e.on("i18n.changed",function(){n._update()}),e.on("diagram.init",function(){n._diagramInitialized=!0,n._rebuild()})}pt.$inject=["eventBus","canvas"],pt.prototype.registerProvider=function(e,t){t||(t=e,e=O2),this._eventBus.on("palette.getProviders",e,function(n){n.providers.push(t)}),this._rebuild()},pt.prototype.getEntries=function(){var e=this._getProviders();return e.reduce(L2,{})},pt.prototype._rebuild=function(){if(this._diagramInitialized){var e=this._getProviders();e.length&&(this._container||this._init(),this._update())}},pt.prototype._init=function(){var e=this,t=this._eventBus,n=this._getParentContainer(),i=this._container=Ge(pt.HTML_MARKUP);n.appendChild(i),Ye(n).add(Up+D2),tn.bind(i,k2,"click",function(r){var o=r.delegateTarget;if(lu(o,V_))return e.toggle();e.trigger("click",r)}),me.bind(i,"mousedown",function(r){r.stopPropagation()}),tn.bind(i,G_,"dragstart",function(r){e.trigger("dragstart",r)}),t.on("canvas.resized",this._layoutChanged,this),t.fire("palette.create",{container:i})},pt.prototype._getProviders=function(e){var t=this._eventBus.createEvent({type:"palette.getProviders",providers:[]});return this._eventBus.fire(t),t.providers},pt.prototype._toggleState=function(e){e=e||{};var t=this._getParentContainer(),n=this._container,i=this._eventBus,r,o=Ye(n),a=Ye(t);"twoColumn"in e?r=e.twoColumn:r=this._needsCollapse(t.clientHeight,this._entries||{}),o.toggle(W_,r),a.toggle(Up+W_,r),"open"in e&&(o.toggle(qp,e.open),a.toggle(Up+qp,e.open)),i.fire("palette.changed",{twoColumn:r,open:this.isOpen()})},pt.prototype._update=function(){var e=Be(".djs-palette-entries",this._container),t=this._entries=this.getEntries();Da(e),T(t,function(n,i){var r=n.group||"default",o=Be("[data-group="+ia(r)+"]",e);o||(o=Ge('<div class="group"></div>'),Nt(o,"data-group",r),e.appendChild(o));var a=n.html||(n.separator?'<hr class="separator" />':'<div class="entry" draggable="true"></div>'),s=Ge(a);if(o.appendChild(s),!n.separator&&(Nt(s,"data-action",i),n.title&&Nt(s,"title",n.title),n.className&&I2(s,n.className),n.imageUrl)){var c=Ge("<img>");Nt(c,"src",n.imageUrl),s.appendChild(c)}}),this.open()},pt.prototype.trigger=function(e,t,n){var i,r,o=t.delegateTarget||t.target;return o?(i=Nt(o,"data-action"),r=t.originalEvent||t,this.triggerEntry(i,e,r,n)):t.preventDefault()},pt.prototype.triggerEntry=function(e,t,n,i){var r=this._entries,o,a;if(o=r[e],!!o&&(a=o.action,this._eventBus.fire("palette.trigger",{entry:o,event:n})!==!1)){if(Et(a)){if(t==="click")return a(n,i)}else if(a[t])return a[t](n,i);n.preventDefault()}},pt.prototype._layoutChanged=function(){this._toggleState({})},pt.prototype._needsCollapse=function(e,t){var n=50,i=Object.keys(t).length*46;return e<i+n},pt.prototype.close=function(){this._toggleState({open:!1,twoColumn:!1})},pt.prototype.open=function(){this._toggleState({open:!0})},pt.prototype.toggle=function(){this.isOpen()?this.close():this.open()},pt.prototype.isActiveTool=function(e){return e&&this._activeTool===e},pt.prototype.updateToolHighlight=function(e){var t,n;this._toolsContainer||(t=Be(".djs-palette-entries",this._container),this._toolsContainer=Be("[data-group=tools]",t)),n=this._toolsContainer,T(n.children,function(i){var r=i.getAttribute("data-action");if(r){var o=Ye(i);r=r.replace("-tool",""),o.contains("entry")&&r===e?o.add("highlighted-entry"):o.remove("highlighted-entry")}})},pt.prototype.isOpen=function(){return Ye(this._container).has(qp)},pt.prototype._getParentContainer=function(){return this._canvas.getContainer()},pt.HTML_MARKUP='<div class="djs-palette"><div class="djs-palette-entries"></div><div class="djs-palette-toggle"></div></div>';function I2(e,t){var n=Ye(e),i=pe(t)?t:t.split(/\s+/g);i.forEach(function(r){n.add(r)})}function L2(e,t){var n=t.getPaletteEntries();return Et(n)?n(e):(T(n,function(i,r){e[r]=i}),e)}const B2={__init__:["palette"],palette:["type",pt]};var U_="crosshair",q_="selected",N2="djs-dragging-active-lasso";function Zi(e,t,n,i,r,o,a){this._selection=r,this._dragging=n,this._mouse=a;var s=this,c={create:function(p){var f=t.getActiveLayer(),d=p.frame=se("rect");J(d,{class:"djs-lasso-overlay",width:1,height:1,x:0,y:0}),ge(f,d),u(!0),this.update(p)},update:function(p){var f=p.frame,d=p.bbox;f&&d&&J(f,{x:d.x,y:d.y,width:d.width,height:d.height});var h=p.marked,m=p.lastMarked;if(h&&m){for(const g of m)h.has(g)||t.removeMarker(g,q_);for(const g of h)m.has(g)||t.addMarker(g,q_)}},remove:function(p){this.update(p),p.frame&&vt(p.frame),u(!1)}};function u(p){Pe(t.getContainer()).toggle(N2,p)}function l(p){var f=i.getAll();return new Set(Ar(Ir(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=Y_(p),f.add=vs(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=Y_(p),h=l(d),m=f.initialMarked.union(h);f.lastMarked=f.marked,f.marked=m,c.update(f)}),e.on("lasso.cleanup",function(p){var f=p.context;f.lastMarked=f.marked,f.marked=new Set(r.get()),c.remove(p.context)}),e.on("element.mousedown",1500,function(p){if(vs(p))return s.activateLasso(p.originalEvent),!0})}Zi.$inject=["eventBus","canvas","dragging","elementRegistry","selection","toolManager","mouse"],Zi.prototype.activateLasso=function(e,t){this._dragging.init(e,"lasso",{autoActivate:t,cursor:U_,data:{context:{}},keepSelection:!0})},Zi.prototype.activateSelection=function(e,t){this._dragging.init(e,"lasso.selection",{trapClick:!1,autoActivate:t,cursor:U_,data:{context:{}},keepSelection:!0})},Zi.prototype._select=function(e){this._selection.select(e)},Zi.prototype.select=function(e,t,n=[]){var i=Ar(Ir(e,t));this._select([...n,...i])},Zi.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateSelection(e,!!e)},Zi.prototype.isActive=function(){var e=this._dragging.context();return e&&/^lasso/.test(e.prefix)};function Y_(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 $2={__depends__:[As,Ho],__init__:["lassoTool"],lassoTool:["type",Zi]};var Yp=1500,K_="grab";function lo(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",Yp,function(c){if($o(c))return a.activateMove(c.originalEvent,!0),!1}),s&&s.addListener(Yp,function(c){if(!(!X_(c.keyEvent)||a.isActive())){var u=a._mouse.getLastMoveEvent();a.activateMove(u,!!u)}},"keyboard.keydown"),s&&s.addListener(Yp,function(c){!X_(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!$o(c)&&l&&e.once("hand.move.ended",function(p){a.activateHand(p.originalEvent,!0,!0)}),!1})}lo.$inject=["eventBus","canvas","dragging","injector","toolManager","mouse"],lo.prototype.activateMove=function(e,t,n){typeof t=="object"&&(n=t,t=!1),this._dragging.init(e,"hand.move",{autoActivate:t,cursor:K_,data:{context:n||{}}})},lo.prototype.activateHand=function(e,t,n){this._dragging.init(e,"hand",{trapClick:!1,autoActivate:t,cursor:K_,data:{context:{reactivate:n}}})},lo.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateHand(e,!!e)},lo.prototype.isActive=function(){var e=this._dragging.context();return e?/^(hand|hand\.move)$/.test(e.prefix):!1};function X_(e){return yt("Space",e)}const j2={__depends__:[As,Ho],__init__:["handTool"],handTool:["type",lo]};var Z_="connect-ok",Q_="connect-not-ok";function po(e,t,n,i,r,o,a){var s=this;this._dragging=t,this._rules=o,this._mouse=a,r.registerTool("global-connect",{tool:"global-connect",dragging:"global-connect.drag"}),e.on("global-connect.hover",function(c){var u=c.context,l=c.hover,p=u.canStartConnect=s.canStartConnect(l);p!==null&&(u.startTarget=l,i.addMarker(l,p?Z_:Q_))}),e.on(["global-connect.out","global-connect.cleanup"],function(c){var u=c.context.startTarget,l=c.context.canStartConnect;u&&i.removeMarker(u,l?Z_:Q_)}),e.on(["global-connect.ended"],function(c){var u=c.context,l=u.startTarget,p={x:c.x,y:c.y},f=s.canStartConnect(l);if(f)return e.once("element.out",function(){e.once(["connect.ended","connect.canceled"],function(){e.fire("global-connect.drag.ended")}),n.start(null,l,p)}),!1})}po.$inject=["eventBus","dragging","connect","canvas","toolManager","rules","mouse"],po.prototype.start=function(e,t){this._dragging.init(e,"global-connect",{autoActivate:t,trapClick:!1,data:{context:{}}})},po.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();return this.start(e,!!e)},po.prototype.isActive=function(){var e=this._dragging.context();return e&&/^global-connect/.test(e.prefix)},po.prototype.canStartConnect=function(e){return this._rules.allowed("connection.start",{source:e})};const F2={__depends__:[Np,Un,ci,As,Ho],globalConnect:["type",po]};function Kp(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)}Kp.$inject=["palette","create","elementFactory","spaceTool","lassoTool","handTool","globalConnect","translate"],Kp.prototype.getPaletteEntries=function(){var e={},t=this._create,n=this._elementFactory,i=this._spaceTool,r=this._lassoTool,o=this._handTool,a=this._globalConnect,s=this._translate;function c(p,f,d,h,m){function g(w){var E=n.createShape(k({type:p},m));t.start(w,E)}return{group:f,className:d,title:h,action:{dragstart:g,click:g}}}function u(p){var f=n.createShape({type:"bpmn:SubProcess",x:0,y:0,isExpanded:!0}),d=n.createShape({type:"bpmn:StartEvent",x:40,y:82,parent:f});t.start(p,[f,d],{hints:{autoSelect:[f]}})}function l(p){t.start(p,n.createParticipantShape())}return k(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 H2={__depends__:[B2,Cs,Rg,$2,j2,F2,ko],__init__:["paletteProvider"],paletteProvider:["type",Kp]};var z2=250;function Xp(e,t,n,i,r){W.call(this,e);function o(s){var c=s.canExecute.replacements;T(c,function(u){var l=u.oldElementId,p={type:u.newElementType};if(!s.visualReplacements[l]){var f=t.get(l);k(p,{x:f.x,y:f.y});var d=n.createShape(p);i.addShape(d,f.parent);var h=Be('[data-element-id="'+ia(f.id)+'"]',s.dragGroup);h&&J(h,{display:"none"});var m=r.addDragger(d,s.dragGroup);s.visualReplacements[l]=m,i.removeShape(d)}})}function a(s){var c=s.visualReplacements;T(c,function(u,l){var p=Be('[data-element-id="'+ia(l)+'"]',s.dragGroup);p&&J(p,{display:"inline"}),u.remove(),c[l]&&delete c[l]})}e.on("shape.move.move",z2,function(s){var c=s.context,u=c.canExecute;c.visualReplacements||(c.visualReplacements={}),u&&u.replacements?o(c):a(c)})}Xp.$inject=["eventBus","elementRegistry","elementFactory","canvas","previewSupport"],Q(Xp,W);const V2={__depends__:[Qr],__init__:["bpmnReplacePreview"],bpmnReplacePreview:["type",Xp]};var G2=1250,Zp=40,W2=20,U2=10,J_=20,eb=["x","y"],q2=Math.abs;function tb(e){e.on(["connect.hover","connect.move","connect.end"],G2,function(t){var n=t.context,i=n.canExecute,r=n.start,o=n.hover,a=n.source,s=n.target;t.originalEvent&&on(t.originalEvent)||(n.initialConnectionStart||(n.initialConnectionStart=n.connectionStart),i&&o&&Y2(t,o,Q2(o)),o&&Z2(i,["bpmn:Association","bpmn:DataInputAssociation","bpmn:DataOutputAssociation","bpmn:SequenceFlow"])?(n.connectionStart=Rn(r),xe(o,["bpmn:Event","bpmn:Gateway"])&&nb(t,Rn(o)),xe(o,["bpmn:Task","bpmn:SubProcess"])&&K2(t,o),y(a,"bpmn:BoundaryEvent")&&s===a.host&&X2(t)):ib(i,"bpmn:MessageFlow")?(y(r,"bpmn:Event")&&(n.connectionStart=Rn(r)),y(o,"bpmn:Event")&&nb(t,Rn(o))):n.connectionStart=n.initialConnectionStart)})}tb.$inject=["eventBus"];function Y2(e,t,n){eb.forEach(function(i){var r=rb(i,t);e[i]<t[i]+n?lt(e,i,t[i]+n):e[i]>t[i]+r-n&&lt(e,i,t[i]+r-n)})}function K2(e,t){var n=Rn(t);eb.forEach(function(i){J2(e,t,i)&&lt(e,i,n[i])})}function X2(e){var t=e.context,n=t.source,i=t.target;if(!ek(t)){var r=Rn(n),o=At(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;q2(c-r[s])<Zp&&(c>r[s]?u=r[s]+Zp:u=r[s]-Zp,lt(e,s,u))})}}function nb(e,t){lt(e,"x",t.x),lt(e,"y",t.y)}function ib(e,t){return e&&e.type===t}function Z2(e,t){return bi(t,function(n){return ib(e,n)})}function rb(e,t){return e==="x"?t.width:t.height}function Q2(e){return y(e,"bpmn:Task")?U2:W2}function J2(e,t,n){return e[n]>t[n]+J_&&e[n]<t[n]+rb(n,t)-J_}function ek(e){var t=e.hover,n=e.source;return t&&n&&t===n}function Qi(){this._targets={},this._snapOrigins={},this._snapLocations=[],this._defaultSnaps={}}Qi.prototype.getSnapOrigin=function(e){return this._snapOrigins[e]},Qi.prototype.setSnapOrigin=function(e,t){this._snapOrigins[e]=t,this._snapLocations.indexOf(e)===-1&&this._snapLocations.push(e)},Qi.prototype.addDefaultSnap=function(e,t){var n=this._defaultSnaps[e];n||(n=this._defaultSnaps[e]=[]),n.push(t)},Qi.prototype.getSnapLocations=function(){return this._snapLocations},Qi.prototype.setSnapLocations=function(e){this._snapLocations=e},Qi.prototype.pointsForTarget=function(e){var t=e.id||e,n=this._targets[t];return n||(n=this._targets[t]=new Ic,n.initDefaults(this._defaultSnaps)),n};function Ic(){this._snapValues={}}Ic.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)},Ic.prototype.snap=function(e,t,n,i){var r=this._snapValues[t];return r&&zT(e[n],r[n],i)},Ic.prototype.initDefaults=function(e){var t=this;T(e||{},function(n,i){T(n,function(r){t.add(i,r)})})};var tk=1250;function Xn(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"],tk,function(r){var o=r.context,a=o.shape,s=o.snapContext,c=o.target;if(!(r.originalEvent&&on(r.originalEvent))&&!(uo(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()})}Xn.$inject=["elementRegistry","eventBus","snapping"],Xn.prototype.initSnap=function(e){var t=this._elementRegistry,n=e.context,i=n.shape,r=n.snapContext;r||(r=n.snapContext=new Qi);var o;t.get(i.id)?o=Rn(i,e):o={x:e.x+Rn(i).x,y:e.y+Rn(i).y};var a={x:o.x-i.width/2,y:o.y-i.height/2},s={x:o.x+i.width/2,y:o.y+i.height/2};return r.setSnapOrigin("mid",{x:o.x-e.x,y:o.y-e.y}),_e(i)||(r.setSnapOrigin("top-left",{x:a.x-e.x,y:a.y-e.y}),r.setSnapOrigin("bottom-right",{x:s.x-e.x,y:s.y-e.y})),r},Xn.prototype.addSnapTargetPoints=function(e,t,n){var i=this.getSnapTargets(t,n);return T(i,function(r){if(_e(r)){_e(t)&&e.add("mid",Rn(r));return}if($e(r)){if(r.waypoints.length<3)return;var o=r.waypoints.slice(1,-1);T(o,function(a){e.add("mid",a)});return}e.add("mid",Rn(r))}),!he(t.x)||!he(t.y)||this._elementRegistry.get(t.id)&&e.add("mid",Rn(t)),e},Xn.prototype.getSnapTargets=function(e,t){return Gy(t).filter(function(n){return!nk(n)})};function nk(e){return!!e.hidden}var ob=1500;function fo(e,t){t.invoke(Xn,this),e.on(["create.move","create.end"],ob,ak),e.on(["create.move","create.end","shape.move.move","shape.move.end"],ob,function(n){var i=n.context,r=i.canExecute,o=i.target,a=r&&(r==="attach"||r.attach);a&&!uo(n)&&ik(n,o)})}Q(fo,Xn),fo.$inject=["eventBus","injector"],fo.prototype.initSnap=function(e){var t=Xn.prototype.initSnap.call(this,e),n=e.shape,i=!!this._elementRegistry.get(n.id);return T(n.outgoing,function(r){var o=r.waypoints[0];o=o.original||o,t.setSnapOrigin(r.id+"-docking",sb(o,i,e))}),T(n.incoming,function(r){var o=r.waypoints[r.waypoints.length-1];o=o.original||o,t.setSnapOrigin(r.id+"-docking",sb(o,i,e))}),y(n,"bpmn:Participant")&&t.setSnapLocations(["top-left","bottom-right","mid"]),t},fo.prototype.addSnapTargetPoints=function(e,t,n){Xn.prototype.addSnapTargetPoints.call(this,e,t,n);var i=this.getSnapTargets(t,n);T(i,function(o){(ok(o)||rk([t,o],"bpmn:TextAnnotation"))&&(e.add("top-left",zy(o)),e.add("bottom-right",Vy(o)))});var r=this._elementRegistry;return T(t.incoming,function(o){if(r.get(t.id)){ab(i,o.source)||e.add("mid",fe(o.source));var a=o.waypoints[0];e.add(o.id+"-docking",a.original||a)}}),T(t.outgoing,function(o){if(r.get(t.id)){ab(i,o.target)||e.add("mid",fe(o.target));var a=o.waypoints[o.waypoints.length-1];e.add(o.id+"-docking",a.original||a)}}),y(n,"bpmn:SequenceFlow")&&(e=this.addSnapTargetPoints(e,t,n.parent)),e},fo.prototype.getSnapTargets=function(e,t){return Xn.prototype.getSnapTargets.call(this,e,t).filter(function(n){return!y(n,"bpmn:Lane")})};function ik(e,t){var n=le(t),i=xm(e,t),r=e.context,o=r.shape,a;o.parent?a={x:0,y:0}:a=fe(o),/top/.test(i)?lt(e,"y",n.top-a.y):/bottom/.test(i)&&lt(e,"y",n.bottom-a.y),/left/.test(i)?lt(e,"x",n.left-a.x):/right/.test(i)&&lt(e,"x",n.right-a.x)}function rk(e,t){return e.every(function(n){return y(n,t)})}function ok(e){return y(e,"bpmn:SubProcess")&&Re(e)?!0:y(e,"bpmn:Participant")}function ak(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)&&lt(e,"x",e.x),(i&&i>=e.y||o&&o<=e.y)&&lt(e,"y",e.y)}}function ab(e,t){return e.indexOf(t)!==-1}function sb(e,t,n){return t?{x:e.x-n.x,y:e.y-n.y}:{x:e.x,y:e.y}}var sk=1250;function _a(e,t){var n=this;e.on(["resize.start"],function(i){n.initSnap(i)}),e.on(["resize.move","resize.end"],sk,function(i){var r=i.context,o=r.shape,a=o.parent,s=r.direction,c=r.snapContext;if(!(i.originalEvent&&on(i.originalEvent))&&!uo(i)){var u=c.pointsForTarget(a);u.initialized||(u=n.addSnapTargetPoints(u,o,a,s),u.initialized=!0),lk(s)&&lt(i,"x",i.x),pk(s)&&lt(i,"y",i.y),t.snap(i,u)}}),e.on(["resize.cleanup"],function(){t.hide()})}_a.prototype.initSnap=function(e){var t=e.context,n=t.shape,i=t.direction,r=t.snapContext;r||(r=t.snapContext=new Qi);var o=cb(n,i);return r.setSnapOrigin("corner",{x:o.x-e.x,y:o.y-e.y}),r},_a.prototype.addSnapTargetPoints=function(e,t,n,i){var r=this.getSnapTargets(t,n);return T(r,function(o){e.add("corner",Vy(o)),e.add("corner",zy(o))}),e.add("corner",cb(t,i)),e},_a.$inject=["eventBus","snapping"],_a.prototype.getSnapTargets=function(e,t){return Gy(t).filter(function(n){return!ck(n,e)&&!$e(n)&&!uk(n)&&!_e(n)})};function cb(e,t){var n=fe(e),i=le(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 ck(e,t){return e.host===t}function uk(e){return!!e.hidden}function lk(e){return e==="n"||e==="s"}function pk(e){return e==="e"||e==="w"}var fk=7,dk=1e3;function Ji(e){this._canvas=e,this._asyncHide=Hc(Yt(this.hide,this),dk)}Ji.$inject=["canvas"],Ji.prototype.snap=function(e,t){var n=e.context,i=n.snapContext,r=i.getSnapLocations(),o={x:uo(e,"x"),y:uo(e,"y")};T(r,function(a){var s=i.getSnapOrigin(a),c={x:e.x+s.x,y:e.y+s.y};if(T(["x","y"],function(u){var l;o[u]||(l=t.snap(c,a,u,fk),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),T(["x","y"],function(a){var s=o[a];xt(s)&&lt(e,a,s.originValue)})},Ji.prototype._createLine=function(e){var t=this._canvas.getLayer("snap"),n=se("path");return J(n,{d:"M0,0 L0,0"}),Pe(n).add("djs-snap-line"),ge(t,n),{update:function(i){he(i)?e==="horizontal"?J(n,{d:"M-100000,"+i+" L+100000,"+i,display:""}):J(n,{d:"M "+i+",-100000 L "+i+", +100000",display:""}):J(n,{display:"none"})}}},Ji.prototype._createSnapLines=function(){this._snapLines={horizontal:this._createLine("horizontal"),vertical:this._createLine("vertical")}},Ji.prototype.showSnapLine=function(e,t){var n=this.getSnapLine(e);n&&n.update(t),this._asyncHide()},Ji.prototype.getSnapLine=function(e){return this._snapLines||this._createSnapLines(),this._snapLines[e]},Ji.prototype.hide=function(){T(this._snapLines,function(e){e.update()})};const hk={__depends__:[{__init__:["createMoveSnapping","resizeSnapping","snapping"],createMoveSnapping:["type",Xn],resizeSnapping:["type",_a],snapping:["type",Ji]}],__init__:["connectSnapping","createMoveSnapping"],connectSnapping:["type",tb],createMoveSnapping:["type",fo]};var ub=300;function ve(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=Be(ve.INPUT_SELECTOR,this._container),this._resultsContainer=Be(ve.RESULTS_CONTAINER_SELECTOR,this._container),this._canvas.getContainer().appendChild(this._container),t.on(["canvas.destroy","diagram.destroy","drag.init","elements.changed"],this.close,this)}ve.$inject=["canvas","eventBus","selection","translate"],ve.prototype._bindEvents=function(){var e=this;function t(n,i,r,o){e._eventMaps.push({el:n,type:r,listener:tn.bind(n,i,r,o)})}t(document,"html","click",function(n){e.close(!1)}),t(this._container,ve.INPUT_SELECTOR,"click",function(n){n.stopPropagation(),n.delegateTarget.focus()}),t(this._container,ve.RESULT_SELECTOR,"mouseover",function(n){n.stopPropagation(),e._scrollToNode(n.delegateTarget),e._preselect(n.delegateTarget)}),t(this._container,ve.RESULT_SELECTOR,"click",function(n){n.stopPropagation(),e._select(n.delegateTarget)}),t(this._container,ve.INPUT_SELECTOR,"keydown",function(n){yt("ArrowUp",n)&&n.preventDefault(),yt("ArrowDown",n)&&n.preventDefault()}),t(this._container,ve.INPUT_SELECTOR,"keyup",function(n){if(yt("Escape",n))return e.close();if(yt("Enter",n)){var i=e._getCurrentResult();return i?e._select(i):e.close(!1)}if(yt("ArrowUp",n))return e._scrollToDirection(!0);if(yt("ArrowDown",n))return e._scrollToDirection();yt(["ArrowLeft","ArrowRight"],n)||e._search(n.delegateTarget.value)})},ve.prototype._unbindEvents=function(){this._eventMaps.forEach(function(e){tn.unbind(e.el,e.type,e.listener)})},ve.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=Be(ve.RESULT_SELECTOR,this._resultsContainer);this._scrollToNode(i),this._preselect(i)}},ve.prototype._scrollToDirection=function(e){var t=this._getCurrentResult();if(t){var n=e?t.previousElementSibling:t.nextElementSibling;n&&(this._scrollToNode(n),this._preselect(n))}},ve.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)}},ve.prototype._clearResults=function(){Da(this._resultsContainer),this._results={},this._eventBus.fire("searchPad.cleared")},ve.prototype._getCurrentResult=function(){return Be(ve.RESULT_SELECTED_SELECTOR,this._resultsContainer)},ve.prototype._createResultNode=function(e,t){var n=Ge(ve.RESULT_HTML);return e.primaryTokens.length>0&&lb(n,e.primaryTokens,ve.RESULT_PRIMARY_HTML),lb(n,e.secondaryTokens,ve.RESULT_SECONDARY_HTML),Nt(n,ve.RESULT_ID_ATTRIBUTE,t),this._resultsContainer.appendChild(n),n},ve.prototype.registerProvider=function(e){this._searchProvider=e},ve.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,Ye(this._canvas.getContainer()).add("djs-search-open"),Ye(this._container).add("open"),this._searchInput.focus(),this._eventBus.fire("searchPad.opened"))},ve.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,Ye(this._canvas.getContainer()).remove("djs-search-open"),Ye(this._container).remove("open"),this._clearResults(),this._searchInput.value="",this._searchInput.blur(),this._eventBus.fire("searchPad.closed"),this._canvas.restoreFocus())},ve.prototype.toggle=function(){this.isOpen()?this.close():this.open()},ve.prototype.isOpen=function(){return this._open},ve.prototype._preselect=function(e){var t=this._getCurrentResult();if(e!==t){t&&Ye(t).remove(ve.RESULT_SELECTED_CLASS);var n=Nt(e,ve.RESULT_ID_ATTRIBUTE),i=this._results[n].element;Ye(e).add(ve.RESULT_SELECTED_CLASS),this._canvas.scrollToElement(i,{top:ub}),this._selection.select(i),this._eventBus.fire("searchPad.preselected",i)}},ve.prototype._select=function(e){var t=Nt(e,ve.RESULT_ID_ATTRIBUTE),n=this._results[t].element;this._cachedSelection=null,this._cachedViewbox=null,this.close(!1),this._canvas.scrollToElement(n,{top:ub}),this._selection.select(n),this._eventBus.fire("searchPad.selected",n)},ve.prototype._getBoxHtml=function(){const e=Ge(ve.BOX_HTML),t=Be(ve.INPUT_SELECTOR,e);return t&&t.setAttribute("aria-label",this._translate("Search in diagram")),e};function lb(e,t,n){var i=mk(t),r=Ge(n);r.innerHTML=i,e.appendChild(r)}function mk(e){var t="";return e.forEach(function(n){var i=yv(n.value||n.matched||n.normal),r=n.match||n.matched;r?t+='<b class="'+ve.RESULT_HIGHLIGHT_CLASS+'">'+i+"</b>":t+=i}),t!==""?t:null}ve.CONTAINER_SELECTOR=".djs-search-container",ve.INPUT_SELECTOR=".djs-search-input input",ve.RESULTS_CONTAINER_SELECTOR=".djs-search-results",ve.RESULT_SELECTOR=".djs-search-result",ve.RESULT_SELECTED_CLASS="djs-search-result-selected",ve.RESULT_SELECTED_SELECTOR="."+ve.RESULT_SELECTED_CLASS,ve.RESULT_ID_ATTRIBUTE="data-result-id",ve.RESULT_HIGHLIGHT_CLASS="djs-search-highlight",ve.BOX_HTML=`<div class="djs-search-container djs-scrollable">
335
335
  <div class="djs-search-input">
336
336
  <svg class="djs-search-icon" width="14" height="14" viewBox="0 0 14 14" fill="none" xmlns="http://www.w3.org/2000/svg">
337
337
  <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"/>
@@ -339,4 +339,4 @@
339
339
  <input type="text" spellcheck="false" />
340
340
  </div>
341
341
  <div class="djs-search-results" />
342
- </div>`,de.RESULT_HTML='<div class="djs-search-result"></div>',de.RESULT_PRIMARY_HTML='<div class="djs-search-result-primary"></div>',de.RESULT_SECONDARY_HTML='<p class="djs-search-result-secondary"></p>';const h2={__depends__:[eo,Es,en],searchPad:["type",de]};function yp(e,t,n,i){this._elementRegistry=e,this._canvas=n,this._search=i,t.registerProvider(this)}yp.$inject=["elementRegistry","searchPad","canvas","search"],yp.prototype.find=function(e){var t=this._canvas.getRootElements(),n=this._elementRegistry.filter(function(i){return!me(i)&&!t.includes(i)});return this._search(n.map(i=>({element:i,label:Ut(i),id:i.id})),e,{keys:["label","id"]}).map(m2)};function m2(e){const{item:{element:t},tokens:n}=e;return{element:t,primaryTokens:n.label,secondaryTokens:n.id}}const g2={__depends__:[h2,kv],__init__:["bpmnSearch"],bpmnSearch:["type",yp]},v2="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",y2="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",_2={width:36,height:50},b2={width:50,height:50};function b_(e,t,n){return te("path",{d:e,strokeWidth:2,transform:`translate(${t.x}, ${t.y})`,...n})}const sn=5;function ac(e,t){this._styles=t,e.registerProvider(this)}ac.$inject=["outline","styles"],ac.prototype.getOutline=function(e){const t=this._styles.cls("djs-outline",["no-fill"]);var n;if($x(e))return n=te("rect"),Z(n,k({x:-sn,y:-sn,rx:4,width:e.width+sn*2,height:e.height+sn*2},t)),n;if(!me(e))return _(e,"bpmn:Gateway")?(n=te("rect"),k(n.style,{"transform-box":"fill-box",transform:"rotate(45deg)","transform-origin":"center"}),Z(n,k({x:2,y:2,rx:4,width:e.width-4,height:e.height-4},t))):ve(e,["bpmn:Task","bpmn:SubProcess","bpmn:Group","bpmn:CallActivity"])?(n=te("rect"),Z(n,k({x:-sn,y:-sn,rx:14,width:e.width+sn*2,height:e.height+sn*2},t))):_(e,"bpmn:EndEvent")?(n=te("circle"),Z(n,k({cx:e.width/2,cy:e.height/2,r:e.width/2+sn+1},t))):_(e,"bpmn:Event")?(n=te("circle"),Z(n,k({cx:e.width/2,cy:e.height/2,r:e.width/2+sn},t))):_(e,"bpmn:DataObjectReference")&&E_(e,"bpmn:DataObjectReference")?n=b_(v2,{x:-6,y:-6},t):_(e,"bpmn:DataStoreReference")&&E_(e,"bpmn:DataStoreReference")&&(n=b_(y2,{x:-6,y:-6},t)),n},ac.prototype.updateOutline=function(e,t){if(!me(e))return ve(e,["bpmn:SubProcess","bpmn:Group"])?(Z(t,{width:e.width+sn*2,height:e.height+sn*2}),!0):!!ve(e,["bpmn:Event","bpmn:Gateway","bpmn:DataStoreReference","bpmn:DataObjectReference"])};function E_(e,t){var n;return t==="bpmn:DataObjectReference"?n=_2:t==="bpmn:DataStoreReference"&&(n=b2),e.width===n.width&&e.height===n.height}const E2={__depends__:[cp],__init__:["outlineProvider"],outlineProvider:["type",ac]};var x2='<?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 Mn(e){sr.call(this,e)}X(Mn,sr),Mn.Viewer=_i,Mn.NavigatedViewer=Ao,Mn.prototype.createDiagram=function(){return this.importXML(x2)},Mn.prototype._interactionModules=[Ig,Bg,jg],Mn.prototype._modelingModules=[SA,_s,TA,PA,zA,ip,YA,_T,wm,Za,wT,CT,zT,GT,WT,XT,cM,dM,Al,bM,AM,jM,HM,Ly,f2,g2,E2],Mn.prototype._modules=[].concat(_i.prototype._modules,Mn.prototype._interactionModules,Mn.prototype._modelingModules);const w2=((e,t)=>{const n=e.__vccOpts||e;for(const[i,r]of t)n[i]=r;return n})(Ye.defineComponent({__name:"BpmnModelerView",props:{xml:{}},emits:["ready","imported","import-error"],setup(e,{expose:t,emit:n}){const i=e,r=n,o=Ye.ref();let a;async function s(u){if(!a)throw new Error("modeler not mounted");try{const{warnings:l}=await a.importXML(u),p=Cc(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 Ye.onMounted(async()=>{a=new Mn({container:o.value,moddleExtensions:Zo}),i.xml&&await s(i.xml),r("ready")}),Ye.watch(()=>i.xml,u=>{u&&a&&s(u)}),Ye.onBeforeUnmount(()=>{a==null||a.destroy(),a=void 0}),t({importXml:s,saveXml:c,getModeler:()=>a}),(u,l)=>(Ye.openBlock(),Ye.createElementBlock("div",{ref_key:"container",ref:o,class:"bpmn-modeler-view"},null,512))}}),[["__scopeId","data-v-a9b41c97"]]);oe.APPLY_BPMN_OPS_SCHEMA=$_,oe.BPMN_MODDLE_EXTENSIONS=Zo,oe.BWL_MODDLE_SCHEMA=Ep,oe.BWL_NS=bp,oe.BWL_PREFIX=sc,oe.BWL_SIDES=cc,oe.BpmnModelerView=w2,oe.EDITOR=N0,oe.HEADLESS_BPMN_MODULES=Sg,oe.HEADLESS_TEXT_METRICS=Rr,oe.I18N_NS=g0,oe.I18N_PREFIX=Up,oe.MVP_FLOW_NODE_TYPES=kn,oe.SYMBOLIC_OP_KINDS=Sp,oe.SYMBOLIC_OP_SCHEMA=Rp,oe.UNDO_EPISODE_COMMAND=uc,oe.applyBpmnOpBatch=gf,oe.applyBpmnOps=ff,oe.approximateTextWidth=Dl,oe.auditBpmnGeometry=Qp,oe.auditBpmnGeometryXml=S0,oe.auditGeometry=Hr,oe.auditTargetsOf=Xp,oe.buildBpmnOpBatch=B0,oe.buildRegistryIndex=ef,oe.createBpmnEditorController=$0,oe.createBpmnModdle=qp,oe.createHeadlessBpmnModeler=lP,oe.crossedShapesOf=Qo,oe.describeProcess=mf,oe.describeProcessXml=L0,oe.executeAsUndoEpisode=wp,oe.geometryFindingKey=ir,oe.installHeadlessBpmnDom=wg,oe.isMvpFlowNodeType=_p,oe.loadBpmnXml=Rc,oe.lowerOps=pf,oe.planEdgeRepair=rf,oe.planSegmentDetours=tf,oe.repairIntroducedCrossings=of,oe.resolverServicesOf=uf,oe.saveBpmnXml=v0,oe.sceneFromDefinitions=Zp,oe.sceneFromRegistry=Jo,oe.validateOps=cf,oe.warningMessages=Cc,Object.defineProperty(oe,Symbol.toStringTag,{value:"Module"})}));
342
+ </div>`,ve.RESULT_HTML='<div class="djs-search-result"></div>',ve.RESULT_PRIMARY_HTML='<div class="djs-search-result-primary"></div>',ve.RESULT_SECONDARY_HTML='<p class="djs-search-result-secondary"></p>';const gk={__depends__:[ko,Xs,En],searchPad:["type",ve]};function Qp(e,t,n,i){this._elementRegistry=e,this._canvas=n,this._search=i,t.registerProvider(this)}Qp.$inject=["elementRegistry","searchPad","canvas","search"],Qp.prototype.find=function(e){var t=this._canvas.getRootElements(),n=this._elementRegistry.filter(function(i){return!_e(i)&&!t.includes(i)});return this._search(n.map(i=>({element:i,label:hn(i),id:i.id})),e,{keys:["label","id"]}).map(vk)};function vk(e){const{item:{element:t},tokens:n}=e;return{element:t,primaryTokens:n.label,secondaryTokens:n.id}}const yk={__depends__:[gk,Ey],__init__:["bpmnSearch"],bpmnSearch:["type",Qp]},_k="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",bk="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",xk={width:36,height:50},Ek={width:50,height:50};function pb(e,t,n){return se("path",{d:e,strokeWidth:2,transform:`translate(${t.x}, ${t.y})`,...n})}const An=5;function Lc(e,t){this._styles=t,e.registerProvider(this)}Lc.$inject=["outline","styles"],Lc.prototype.getOutline=function(e){const t=this._styles.cls("djs-outline",["no-fill"]);var n;if(Fw(e))return n=se("rect"),J(n,k({x:-An,y:-An,rx:4,width:e.width+An*2,height:e.height+An*2},t)),n;if(!_e(e))return y(e,"bpmn:Gateway")?(n=se("rect"),k(n.style,{"transform-box":"fill-box",transform:"rotate(45deg)","transform-origin":"center"}),J(n,k({x:2,y:2,rx:4,width:e.width-4,height:e.height-4},t))):xe(e,["bpmn:Task","bpmn:SubProcess","bpmn:Group","bpmn:CallActivity"])?(n=se("rect"),J(n,k({x:-An,y:-An,rx:14,width:e.width+An*2,height:e.height+An*2},t))):y(e,"bpmn:EndEvent")?(n=se("circle"),J(n,k({cx:e.width/2,cy:e.height/2,r:e.width/2+An+1},t))):y(e,"bpmn:Event")?(n=se("circle"),J(n,k({cx:e.width/2,cy:e.height/2,r:e.width/2+An},t))):y(e,"bpmn:DataObjectReference")&&fb(e,"bpmn:DataObjectReference")?n=pb(_k,{x:-6,y:-6},t):y(e,"bpmn:DataStoreReference")&&fb(e,"bpmn:DataStoreReference")&&(n=pb(bk,{x:-6,y:-6},t)),n},Lc.prototype.updateOutline=function(e,t){if(!_e(e))return xe(e,["bpmn:SubProcess","bpmn:Group"])?(J(t,{width:e.width+An*2,height:e.height+An*2}),!0):!!xe(e,["bpmn:Event","bpmn:Gateway","bpmn:DataStoreReference","bpmn:DataObjectReference"])};function fb(e,t){var n;return t==="bpmn:DataObjectReference"?n=xk:t==="bpmn:DataStoreReference"&&(n=Ek),e.width===n.width&&e.height===n.height}const wk={__depends__:[zp],__init__:["outlineProvider"],outlineProvider:["type",Lc]};var Sk='<?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 Zn(e){Nr.call(this,e)}Q(Zn,Nr),Zn.Viewer=Ui,Zn.NavigatedViewer=ra,Zn.prototype.createDiagram=function(){return this.importXML(Sk)},Zn.prototype._interactionModules=[Rv,Pv,Mv],Zn.prototype._modelingModules=[CT,Ys,kT,TT,GT,Np,XT,xM,hg,Cs,RM,AM,GM,UM,qM,QM,l2,m2,cp,E2,M2,H2,V2,C_,hk,yk,wk],Zn.prototype._modules=[].concat(Ui.prototype._modules,Zn.prototype._interactionModules,Zn.prototype._modelingModules);const Rk=((e,t)=>{const n=e.__vccOpts||e;for(const[i,r]of t)n[i]=r;return n})(ot.defineComponent({__name:"BpmnModelerView",props:{xml:{}},emits:["ready","imported","import-error"],setup(e,{expose:t,emit:n}){const i=e,r=n,o=ot.ref();let a;async function s(u){if(!a)throw new Error("modeler not mounted");try{const{warnings:l}=await a.importXML(u),p=tu(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 ot.onMounted(async()=>{a=new Zn({container:o.value,moddleExtensions:Pa}),i.xml&&await s(i.xml),r("ready")}),ot.watch(()=>i.xml,u=>{u&&a&&s(u)}),ot.onBeforeUnmount(()=>{a==null||a.destroy(),a=void 0}),t({importXml:s,saveXml:c,getModeler:()=>a}),(u,l)=>(ot.openBlock(),ot.createElementBlock("div",{ref_key:"container",ref:o,class:"bpmn-modeler-view"},null,512))}}),[["__scopeId","data-v-a9b41c97"]]);ee.APPLY_BPMN_OPS_SCHEMA=Tb,ee.BPMN_MODDLE_EXTENSIONS=Pa,ee.BWL_MODDLE_SCHEMA=tf,ee.BWL_NS=ef,ee.BWL_PREFIX=Bc,ee.BWL_SIDES=Nc,ee.BpmnModelerView=Rk,ee.EDITOR=jx,ee.FLOW_LABEL_INDENT=ru,ee.HEADLESS_BPMN_MODULES=mv,ee.HEADLESS_TEXT_METRICS=to,ee.I18N_NS=sx,ee.I18N_PREFIX=Pf,ee.LABEL_FORK_MARGIN=ou,ee.MVP_FLOW_NODE_TYPES=Jn,ee.SYMBOLIC_OP_KINDS=of,ee.SYMBOLIC_OP_SCHEMA=af,ee.UNDO_EPISODE_COMMAND=$c,ee.applyBpmnOpBatch=sd,ee.applyBpmnOps=id,ee.approximateTextWidth=fp,ee.auditBpmnGeometry=If,ee.auditBpmnGeometryXml=xx,ee.auditGeometry=Ri,ee.auditTargetsOf=yo,ee.axisSegmentsOf=or,ee.buildBpmnOpBatch=$x,ee.buildRegistryIndex=Bf,ee.createBpmnEditorController=Fx,ee.createBpmnModdle=Af,ee.createHeadlessBpmnModeler=fA,ee.crossedShapesOf=ar,ee.describeProcess=ad,ee.describeProcessXml=Nx,ee.edgeCrossCount=Or,ee.edgeCrossingPairsOf=su,ee.executeAsUndoEpisode=rf,ee.geometryFindingKey=Si,ee.installHeadlessBpmnDom=hv,ee.isMvpFlowNodeType=Jp,ee.loadBpmnXml=eu,ee.lowerOps=nd,ee.oppositeOverlapCount=iu,ee.oppositeOverlapOf=nu,ee.planCrossPoolRoute=Gf,ee.planEdgeRepair=Hf,ee.planLabelPlacement=Kf,ee.planMiddleSegmentShifts=jf,ee.planOppositeOverlapRepair=qf,ee.planSegmentDetours=$f,ee.repairIntroducedCrossings=zf,ee.repairIntroducedOppositeOverlaps=Yf,ee.repairIntroducedSharedSegmentLabels=Xf,ee.rerouteIntroducedCrossPoolEdges=Wf,ee.resolverServicesOf=ed,ee.saveBpmnXml=cx,ee.sceneFromDefinitions=Of,ee.sceneFromRegistry=Nn,ee.sharedSegmentUnderLabel=Ta,ee.sharedSpansOf=au,ee.validateOps=Jf,ee.warningMessages=tu,Object.defineProperty(ee,Symbol.toStringTag,{value:"Module"})}));