@g1cloud/bpmn-modeler-next 5.0.0-alpha.7 → 5.0.0-alpha.9

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(ie,ot){typeof exports=="object"&&typeof module<"u"?ot(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],ot):(ie=typeof globalThis<"u"?globalThis:ie||self,ot(ie.BpmnModeler={},ie.Vue))})(this,(function(ie,ot){"use strict";var pk=Object.defineProperty;var fk=(ie,ot,Un)=>ot in ie?pk(ie,ot,{enumerable:!0,configurable:!0,writable:!0,value:Un}):ie[ot]=Un;var vr=(ie,ot,Un)=>fk(ie,typeof ot!="symbol"?ot+"":ot,Un);const Un=["startEvent","endEvent","userTask","serviceTask","task","sendTask","receiveTask","exclusiveGateway","parallelGateway"];function Hp(e){return Un.includes(e)}const zp="http://g1project.net/spec/bpmn/bwl/1.0",Pc="bwl",Ac=["top-left","top","top-right","right","bottom-right","bottom","bottom-left","left"],Vp={name:"bwl-hints",uri:zp,prefix:Pc,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"}]}]},Tc="bwl.undoEpisode",Gp=new WeakSet;function Q_(e){Gp.has(e)||(e.register(Tc,{preExecute(t){try{t.run()}catch(n){t.error=n}}}),Gp.add(e))}function Wp(e,t){Q_(e);const n={run:t};if(e.execute(Tc,n),n.error!==void 0)throw e.canUndo()&&e.undo(),n.error}const Up=["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"],J_={description:"생략 = 보존, null = 제거.",anyOf:[{type:"string"},{type:"null"}]},eb={type:"object",description:"레인. 배열 선언 순서 = 풀 내 상→하 순서.",properties:{id:{type:"string"},name:{type:"string"}},required:["id"],additionalProperties:!1},tb={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},nb={type:"object",description:"플로우 노드. 좌표는 지정하지 않는다 — 배치는 resolver 가 결정한다.",properties:{id:{type:"string"},type:{type:"string",enum:[...Un]},name:{type:"string"},participant:{type:"string",description:"소속 풀 id(협업 문서)."},lane:{type:"string",description:"소속 레인 id(풀 정의에 선언된 것)."}},required:["id","type"],additionalProperties:!1},ib={type:"object",description:"분기 조건 — 게이트웨이가 아닌 플로우에 붙인다. MVP 는 label 만.",properties:{label:{type:"string"}},required:["label"],additionalProperties:!1},rb={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},ob={type:"object",description:"메시지 플로우(풀 경계를 넘는 연결 — 노드 또는 블랙박스 풀 자체가 끝점).",properties:{id:{type:"string"},source:{type:"string"},target:{type:"string"},name:{type:"string"}},required:["id","source","target"],additionalProperties:!1},ab={type:"object",properties:{id:{type:"string"},name:{type:"string"}},required:["id"],additionalProperties:!1},sb={type:"object",description:"데이터 입출력 연관. 방향 = source→target(태스크→스토어 = 쓰기, 스토어→태스크 = 읽기).",properties:{id:{type:"string"},source:{type:"string"},target:{type:"string"}},required:["source","target"],additionalProperties:!1},cb={type:"object",properties:{id:{type:"string"},text:{type:"string"}},required:["id","text"],additionalProperties:!1},ub={type:"object",description:"연관선(주석 ↔ 요소).",properties:{id:{type:"string"},source:{type:"string"},target:{type:"string"}},required:["source","target"],additionalProperties:!1},lb={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:[...Ac]},offset:{type:"number"}},required:["anchor","side"],additionalProperties:!1};function kt(e,t){return{type:"object",description:t.description,properties:{kind:{const:e},...t.properties},required:["kind",...t.required??[]],additionalProperties:!1}}const fb={"participant.add":kt("participant.add",{description:"풀 추가. order = 풀 세로 순서 힌트(생략 시 op 순서가 곧 배치 순서).",properties:{participant:{$ref:"#/$defs/irParticipant"},order:{type:"integer"}},required:["participant"]}),"participant.update":kt("participant.update",{description:"풀 이름/레인 갱신. lanes 는 전체 재선언(생략 = 보존) — 기존 레인을 유지하려면 함께 다시 나열한다.",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"},lanes:{type:"array",items:{$ref:"#/$defs/irLane"}}},required:["id"]}),"node.add":kt("node.add",{description:"플로우 노드 추가. band = 가로 밴드 순번 힌트(주 흐름 0, 보조 스트랜드 1…). 레인이 있으면 그 레인 안의 밴드다 — 한 레인 안에서 게이트웨이 출구를 갈라 놓을 때 쓴다. 컨테이너(풀·레인)는 밴드 수만큼 자란다.",properties:{node:{$ref:"#/$defs/irNode"},band:{type:"integer"}},required:["node"]}),"node.update":kt("node.update",{description:"노드 이름/레인/타입 갱신. lane = 레인 재배정(이동), type = 태스크·이벤트 타입 전환.",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"},lane:{type:"string"},type:{type:"string",enum:[...Un]}},required:["id"]}),"sequenceFlow.add":kt("sequenceFlow.add",{description:"시퀀스 플로우 추가. 분기 조건은 게이트웨이가 아닌 플로우의 condition 에 싣는다.",properties:{flow:{$ref:"#/$defs/irSequenceFlow"}},required:["flow"]}),"sequenceFlow.update":kt("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":kt("messageFlow.add",{description:"메시지 플로우 추가(풀 경계를 넘는 연결).",properties:{flow:{$ref:"#/$defs/irMessageFlow"}},required:["flow"]}),"messageFlow.update":kt("messageFlow.update",{description:"메시지 플로우 이름 갱신.",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"}},required:["id"]}),"dataStore.add":kt("dataStore.add",{description:"데이터 스토어 추가(+ 입출력 연관 동반 가능).",properties:{dataStore:{$ref:"#/$defs/irDataStore"},associations:{type:"array",items:{$ref:"#/$defs/irDataAssociation"}}},required:["dataStore"]}),"dataStore.update":kt("dataStore.update",{description:"데이터 스토어 이름 갱신.",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"}},required:["id"]}),"dataAssociation.add":kt("dataAssociation.add",{description:"기존 노드 ↔ 기존 데이터 스토어의 입출력 연관 추가.",properties:{association:{$ref:"#/$defs/irDataAssociation"}},required:["association"]}),"association.add":kt("association.add",{description:"주석 ↔ 요소 연관 추가(한쪽 끝은 주석). 주석 신설과 함께면 annotation.add 의 association 을 쓰고, 이 op 는 추가 연관(한 주석에 여러 연관)용.",properties:{association:{$ref:"#/$defs/irAssociation"}},required:["association"]}),"annotation.add":kt("annotation.add",{description:"텍스트 주석 추가. association 으로 대상 요소와 연결하고, placement 로 방위를 지정하면 결정적 배치된다.",properties:{annotation:{$ref:"#/$defs/irTextAnnotation"},association:{$ref:"#/$defs/irAssociation"},placement:{$ref:"#/$defs/bwlPlacement"}},required:["annotation"]}),"annotation.update":kt("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":kt("group.add",{description:"그룹 추가 — 바운즈는 members 의 bbox 로 산출되므로 좌표를 지정하지 않는다.",properties:{group:{$ref:"#/$defs/irGroup"}},required:["group"]}),"group.update":kt("group.update",{description:"그룹 이름/멤버 갱신. members 는 전체 재선언(생략 = 보존).",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"},members:{type:"array",items:{type:"string"}}},required:["id"]}),"element.remove":kt("element.remove",{description:"요소 제거(카테고리 무관). 부착된 연결선은 함께 제거된다.",properties:{id:{type:"string"}},required:["id"]})},qp={anyOf:Up.map(e=>fb[e])},db={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:eb,irParticipant:tb,irNode:nb,irFlowCondition:ib,irSequenceFlow:rb,irMessageFlow:ob,irDataStore:ab,irDataAssociation:sb,irTextAnnotation:cb,irAssociation:ub,irGroup:lb,bwlPlacement:pb,nullableString:J_,symbolicOp:qp}};function Mc(e){return Array.prototype.concat.apply([],e)}const oo=Object.prototype.toString,hb=Object.prototype.hasOwnProperty;function Ui(e){return e===void 0}function ht(e){return e!==void 0}function yr(e){return e==null}function pe(e){return oo.call(e)==="[object Array]"}function bt(e){return oo.call(e)==="[object Object]"}function me(e){return oo.call(e)==="[object Number]"}function xt(e){const t=oo.call(e);return t==="[object Function]"||t==="[object AsyncFunction]"||t==="[object GeneratorFunction]"||t==="[object AsyncGeneratorFunction]"||t==="[object Proxy]"}function qt(e){return oo.call(e)==="[object String]"}function mb(e){if(!pe(e))throw new Error("must supply array")}function Yt(e,t){return!yr(e)&&hb.call(e,t)}function ze(e,t){const n=fa(t);let i;return P(e,function(r,o){if(n(r,o))return i=r,!1}),i}function Yp(e,t){const n=fa(t);let i=pe(e)?-1:void 0;return P(e,function(r,o){if(n(r,o))return i=o,!1}),i}function Re(e,t){const n=fa(t);let i=[];return P(e,function(r,o){n(r,o)&&i.push(r)}),i}function P(e,t){let n,i;if(Ui(e))return;const r=pe(e)?bb:_b;for(let o in e)if(Yt(e,o)&&(n=e[o],i=t(n,r(o)),i===!1))return n}function gb(e,t){if(Ui(e))return[];mb(e);const n=fa(t);return e.filter(function(i,r){return!n(i,r)})}function Kt(e,t,n){return P(e,function(i,r){n=t(n,i,r)}),n}function qi(e,t){return!!Kt(e,function(n,i,r){return n&&t(i,r)},!0)}function di(e,t){return!!ze(e,t)}function Dt(e,t){let n=[];return P(e,function(i,r){n.push(t(i,r))}),n}function pa(e){return e&&Object.keys(e)||[]}function vb(e){return pa(e).length}function _r(e){return Dt(e,t=>t)}function br(e,t,n={}){return t=kc(t),P(e,function(i){let r=t(i)||"_",o=n[r];o||(o=n[r]=[]),o.push(i)}),n}function Kp(e,...t){e=kc(e);let n={};return P(t,r=>br(r,e,n)),Dt(n,function(r,o){return r[0]})}const yb=Kp;function Pn(e,t){t=kc(t);let n=[];return P(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)}),Dt(n,i=>i.v)}function xr(e){return function(t){return qi(e,function(n,i){return t[i]===n})}}function kc(e){return xt(e)?e:t=>t[e]}function fa(e){return xt(e)?e:t=>t===e}function _b(e){return e}function bb(e){return Number(e)}function Dc(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 Gt(e,t){return e.bind(t)}function k(e,...t){return Object.assign(e,...t)}function xb(e,t,n){let i=e;return P(t,function(r,o){if(typeof r!="number"&&typeof r!="string")throw new Error("illegal key type: "+typeof r+". Key should be of type number or string.");if(r==="constructor")throw new Error("illegal key: constructor");if(r==="__proto__")throw new Error("illegal key: __proto__");let a=t[o+1],s=i[r];ht(a)&&yr(s)&&(s=i[r]=isNaN(+a)?{}:[]),Ui(a)?Ui(n)?delete i[r]:i[r]=n:i=s}),e}function Sn(e,t){let n={},i=Object(e);return P(t,function(r){r in i&&(n[r]=e[r])}),n}function An(e,t){let n={},i=Object(e);return P(i,function(r,o){t.indexOf(o)===-1&&(n[o]=r)}),n}function Oc(){}Oc.prototype.get=function(e){return this.$model.properties.get(this,e)},Oc.prototype.set=function(e,t){this.$model.properties.set(this,e,t)};function Xp(e,t){this.model=e,this.properties=t}Xp.prototype.createType=function(e){var t=this.model,n=this.properties,i=Object.create(Oc.prototype);P(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}),P(a,Gt(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 Eb=k(Object.create(null),{String:!0,Boolean:!0,Integer:!0,Real:!0,Element:!0}),Zp=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 Ic(e,t){var n=Zp[e];return n?n(t):t}function Lc(e){return!!Eb[e]}function Qp(e){return!!Zp[e]}function Ot(e,t){var n=e.split(/:/),i,r;if(n.length===1)i=e,r=t;else if(n.length===2)i=n[1],r=n[0];else throw new Error("expected <prefix:localName> or <localName>, got "+e);return e=(r?r+":":"")+i,{name:e,prefix:r,localName:i}}function an(e){this.ns=e,this.name=e.name,this.allTypes=[],this.allTypesByName=Object.create(null),this.properties=[],this.propertiesByName=Object.create(null)}an.prototype.build=function(){return Sn(this,["ns","name","allTypes","allTypesByName","properties","propertiesByName","bodyProperty","idProperty"])},an.prototype.addProperty=function(e,t,n){typeof t=="boolean"&&(n=t,t=void 0),this.addNamedProperty(e,n!==!1);var i=this.properties;t!==void 0?i.splice(t,0,e):i.push(e)},an.prototype.replaceProperty=function(e,t,n){var i=e.ns,r=this.properties,o=this.propertiesByName,a=e.name!==t.name;if(e.isId){if(!t.isId)throw new Error("property <"+t.ns.name+"> must be id property to refine <"+e.ns.name+">");this.setIdProperty(t,!1)}if(e.isBody){if(!t.isBody)throw new Error("property <"+t.ns.name+"> must be body property to refine <"+e.ns.name+">");this.setBodyProperty(t,!1)}var s=r.indexOf(e);if(s===-1)throw new Error("property <"+i.name+"> not found in property list");r.splice(s,1),this.addProperty(t,n?void 0:s,a),o[i.name]=o[i.localName]=t},an.prototype.redefineProperty=function(e,t,n){var i=e.ns.prefix,r=t.split("#"),o=Ot(r[0],i),a=Ot(r[1],o.prefix).name,s=this.propertiesByName[a];if(s)this.replaceProperty(s,e,n);else throw new Error("refined property <"+a+"> not found");delete e.redefines},an.prototype.addNamedProperty=function(e,t){var n=e.ns,i=this.propertiesByName;t&&(this.assertNotDefined(e,n.name),this.assertNotDefined(e,n.localName)),i[n.name]=i[n.localName]=e},an.prototype.removeNamedProperty=function(e){var t=e.ns,n=this.propertiesByName;delete n[t.name],delete n[t.localName]},an.prototype.setBodyProperty=function(e,t){if(t&&this.bodyProperty)throw new Error("body property defined multiple times (<"+this.bodyProperty.ns.name+">, <"+e.ns.name+">)");this.bodyProperty=e},an.prototype.setIdProperty=function(e,t){if(t&&this.idProperty)throw new Error("id property defined multiple times (<"+this.idProperty.ns.name+">, <"+e.ns.name+">)");this.idProperty=e},an.prototype.assertNotTrait=function(e){if((e.extends||[]).length)throw new Error(`cannot create <${e.name}> extending <${e.extends}>`)},an.prototype.assertNotDefined=function(e,t){var n=e.name,i=this.propertiesByName[n];if(i)throw new Error("property <"+n+"> already defined; override of <"+i.definedBy.ns.name+"#"+i.ns.name+"> by <"+e.definedBy.ns.name+"#"+e.ns.name+"> not allowed without redefines")},an.prototype.hasProperty=function(e){return this.propertiesByName[e]},an.prototype.addTrait=function(e,t){t&&this.assertNotTrait(e);var n=this.allTypesByName,i=this.allTypes,r=e.name;r in n||(P(e.properties,Gt(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 hi(e,t){this.packageMap=Object.create(null),this.typeMap=Object.create(null),this.packages=[],this.properties=t,P(e,Gt(this.registerPackage,this))}hi.prototype.getPackage=function(e){return this.packageMap[e]},hi.prototype.getPackages=function(){return this.packages},hi.prototype.registerPackage=function(e){e=k({},e);var t=this.packageMap;Jp(t,e,"prefix"),Jp(t,e,"uri"),P(e.types,Gt(function(n){this.registerType(n,e)},this)),t[e.uri]=t[e.prefix]=e,this.packages.push(e)},hi.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=Ot(e.name,t.prefix),i=n.name,r=Object.create(null);P(e.properties,Gt(function(o){var a=Ot(o.name,n.prefix),s=a.name;Lc(o.type)||(o.type=Ot(o.type,a.prefix).name),k(o,{ns:a,name:s}),r[s]=o},this)),k(e,{ns:n,name:i,propertiesByName:r}),P(e.extends,Gt(function(o){var a=Ot(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},hi.prototype.mapTypes=function(e,t,n){var i=Lc(e.name)?{name:e.name}:this.typeMap[e.name],r=this;function o(c,u){var l=Ot(c,Lc(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+">");P(i.superClass,n?a:s),t(i,!n),P(i.traits,a)},hi.prototype.getEffectiveDescriptor=function(e){var t=Ot(e),n=new an(t);this.mapTypes(t,function(r,o){n.addTrait(r,o)});var i=n.build();return this.definePackage(i,i.allTypes[i.allTypes.length-1].$pkg),i},hi.prototype.definePackage=function(e,t){this.properties.define(e,"$pkg",{value:t})};function Jp(e,t,n){var i=t[n];if(i in e)throw new Error("package with "+n+" <"+i+"> already defined")}function Yi(e){this.model=e}Yi.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;wb(n)?i?delete e[r]:delete e.$attrs[Bc(t)]:i?r in e?e[r]=n:ef(e,i,n):e.$attrs[Bc(t)]=n},Yi.prototype.get=function(e,t){var n=this.getProperty(e,t);if(!n)return e.$attrs[Bc(t)];var i=n.name;return!e[i]&&n.isMany&&ef(e,n,[]),e[i]},Yi.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)},Yi.prototype.defineDescriptor=function(e,t){this.define(e,"$descriptor",{value:t})},Yi.prototype.defineModel=function(e,t){this.define(e,"$model",{value:t})},Yi.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 wb(e){return typeof e>"u"}function ef(e,t,n){Object.defineProperty(e,t.name,{enumerable:!t.isReference,writable:!0,value:n,configurable:!0})}function Bc(e){return e.replace(/^:/,"")}function ln(e,t={}){this.properties=new Yi(this),this.factory=new Xp(this,this.properties),this.registry=new hi(e,this.properties),this.typeCache=Object.create(null),this.config=t}ln.prototype.create=function(e,t){var n=this.getType(e);if(!n)throw new Error("unknown type <"+e+">");return new n(t)},ln.prototype.getType=function(e){var t=this.typeCache,n=qt(e)?e:e.ns.name,i=t[n];return i||(e=this.registry.getEffectiveDescriptor(n),i=t[n]=this.factory.createType(e)),i},ln.prototype.createAny=function(e,t,n){var i=Ot(e),r={$type:e,$instanceOf:function(a){return a===this.$type},get:function(a){return this[a]},set:function(a,s){xb(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}),P(n,function(a,s){bt(a)&&a.value!==void 0?r[a.name]=a.value:r[s]=a}),r},ln.prototype.getPackage=function(e){return this.registry.getPackage(e)},ln.prototype.getPackages=function(){return this.registry.getPackages()},ln.prototype.getElementDescriptor=function(e){return e.$descriptor},ln.prototype.hasType=function(e,t){t===void 0&&(t=e,e=this);var n=e.$model.getElementDescriptor(e);return t in n.allTypesByName},ln.prototype.getPropertyDescriptor=function(e,t){return this.getElementDescriptor(e).propertiesByName[t]},ln.prototype.getTypeDescriptor=function(e){return this.registry.typeMap[e]};var tf=String.fromCharCode,Sb=Object.prototype.hasOwnProperty,Rb=/&#(\d+);|&#x([0-9a-f]+);|&(\w+);/ig,ao={amp:"&",apos:"'",gt:">",lt:"<",quot:'"'};Object.keys(ao).forEach(function(e){ao[e.toUpperCase()]=ao[e]});function Cb(e,t,n,i){return i?Sb.call(ao,i)?ao[i]:"&"+i+";":tf(t||parseInt(n,16))}function Ki(e){return e.length>3&&e.indexOf("&")!==-1?e.replace(Rb,Cb):e}var nf="non-whitespace outside of root node";function mi(e){return new Error(e)}function Pb(e){return"missing namespace for prefix <"+e+">"}function da(e){return{get:e,enumerable:!0}}function Ab(e){var t=Object.create(null),n;for(n in e)t[n]=e[n];return t}var rf=Symbol("nameCache");function Nc(e){return e+"$uri"}function Tb(e){var t=Object.create(null),n,i;for(n in e)i=e[n],t[i]=i,t[Nc(i)]=n;return t}function ha(){return{line:0,column:0}}function Mb(e){throw e}function of(e){if(!this)return new of(e);var t=e&&e.proxy,n,i,r,o,a=Mb,s,c,u,l,p=ha,f=!1,d=!1,h="",m=!1,g=!1,w=null,E=!1,b,x,S,A;function I(L){L instanceof Error||(L=mi(L)),w=L,a(L,p)}function C(L){s&&(L instanceof Error||(L=mi(L)),s(L,p))}this.on=function(L,F){if(typeof F!="function")throw mi("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 mi("unsupported event: "+L)}return this},this.ns=function(L){if(typeof L>"u"&&(L={}),typeof L!="object")throw mi("required args <nsMap={}>");var F=Object.create(null),te;for(te in L)F[te]=L[te];return g=!0,A=F,this};function $(){b=g?[]:null,x=g?Tb(A):null,S=[],p=ha,E=!1,w=null,d=!1,h=""}this.parse=function(L){if(typeof L!="string")throw mi("required args <xml=string>");if(f)throw mi("parse during stream; call end() first");return $(),j(L),p=ha,E=!1,w},this.write=function(L){if(typeof L!="string")throw mi("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=ha,E=!1,w},this.stop=function(){E=!0};function j(L,F=!1){var te=null,ke=null,Je,q=0,ne=!1,ce=!1,ee=0,ae=0,Y,B,N,V,Ee,_t,R,_,v,M="",O=0,z;function J(Ne,ft){var Tt=Ne.indexOf(":");if(Tt===-1)return Ne;var T=x[Ne.substring(0,Tt)];return T?ft===T?Ne.substr(Tt+1):T+Ne.substr(Tt):(C(Pb(Ne.substring(0,Tt))),null)}function ge(){if(z!==null)return z;var Ne,ft,Tt=g&&x.xmlns,T=g&&m?[]:null,D=O,H=M,Q=H.length,le,re,he,Ve,we,Ue={},$t=new Set,dt,be,se;e:for(;D<Q;D++)if(dt=!1,be=H.charCodeAt(D),!(be===32||be<14&&be>8)){for((be<65||be>122||be>90&&be<97)&&be!==95&&be!==58&&(C("illegal first char attribute name"),dt=!0),se=D+1;se<Q;se++)if(be=H.charCodeAt(se),!(be>96&&be<123||be>64&&be<91||be>47&&be<59||be===46||be===45||be===95)){if(be===32||be<14&&be>8){C("missing attribute value"),D=se;continue e}if(be===61)break;C("illegal attribute name char"),dt=!0}if(we=H.substring(D,se),we==="xmlns:xmlns"&&(C("illegal declaration of xmlns"),dt=!0),be=H.charCodeAt(se+1),be===34)se=H.indexOf('"',D=se+2),se===-1&&(se=H.indexOf("'",D),se!==-1&&(C("attribute value quote missmatch"),dt=!0));else if(be===39)se=H.indexOf("'",D=se+2),se===-1&&(se=H.indexOf('"',D),se!==-1&&(C("attribute value quote missmatch"),dt=!0));else for(C("missing attribute value quotes"),dt=!0,se=se+1;se<Q&&(be=H.charCodeAt(se+1),!(be===32||be<14&&be>8));se++);for(se===-1&&(C("missing closing quotes"),se=Q,dt=!0),dt||(he=H.substring(D,se)),D=se;se+1<Q&&(be=H.charCodeAt(se+1),!(be===32||be<14&&be>8));se++)D===se&&(C("illegal character after attribute end"),dt=!0);if(D=se+1,dt)continue e;if($t.has(we)){C("attribute <"+we+"> already defined");continue}if($t.add(we),!g){Ue[we]=he;continue}if(m){if(re=we==="xmlns"?"xmlns":we.charCodeAt(0)===120&&we.substr(0,6)==="xmlns:"?we.substr(6):null,re!==null){if(Ne=Ki(he),ft=Nc(re),Ve=A[Ne],!Ve){if(re==="xmlns"||ft in x&&x[ft]!==Ne)do Ve="ns"+q++;while(typeof x[Ve]<"u");else Ve=re;A[Ne]=Ve}x[re]!==Ve&&(le||(x=Ab(x),le=!0),x[re]=Ve,re==="xmlns"&&(x[Nc(Ve)]=Ne,Tt=Ve),x[ft]=Ne),Ue[we]=he;continue}T.push(we,he);continue}we=J(we,Tt),we!==null&&(Ue[we]=he)}if(m)for(D=0,Q=T.length;D<Q;D++)we=J(T[D++],Tt),he=T[D],we!==null&&(Ue[we]=he);return z=Ue}function Ie(){for(var Ne=/(\r\n|\r|\n)/g,ft=0,Tt=0,T=0,D=ae,H,Q;ee>=T&&(H=Ne.exec(L),!(!H||(D=H[0].length+H.index,D>ee)));)ft+=1,T=D;return ee==-1?(Tt=D,Q=L.substring(ae)):ae===0?Q=L.substring(ae,ee):(Tt=ee-T,Q=ae==-1?L.substring(ee):L.substring(ee,ae+1)),{data:Q,line:ft,column:Tt}}for(p=Ie,t&&(v=Object.create({},{name:da(function(){return R}),originalName:da(function(){return _}),attrs:da(ge),ns:da(function(){return x})}));ae!==-1;){if(L.charCodeAt(ae)===60?ee=ae:ee=L.indexOf("<",ae),ee===-1){if(F)return L.substring(ae);if(S.length)return I("unexpected end of file");if(!d)return I("missing start tag");ae<L.length&&L.substring(ae).trim()&&C(nf);return}if(d||(d=!0),ae!==ee){if(S.length){if(n&&(n(L.substring(ae,ee),Ki,p),E))return}else if(L.substring(ae,ee).trim()&&(C(nf),E))return}if(V=L.charCodeAt(ee+1),V===33){if(N=L.charCodeAt(ee+2),N===91&&L.substr(ee+3,6)==="CDATA["){if(ae=L.indexOf("]]>",ee),ae===-1)return F?L.substring(ee):I("unclosed cdata");if(o&&(o(L.substring(ee+9,ae),p),E))return;ae+=3;continue}if(N===45&&L.charCodeAt(ee+3)===45){if(ae=L.indexOf("-->",ee),ae===-1)return F?L.substring(ee):I("unclosed comment");if(c&&(c(L.substring(ee+4,ae),Ki,p),E))return;ae+=3;continue}}if(V===63){if(ae=L.indexOf("?>",ee),ae===-1)return F?L.substring(ee):I("unclosed question");if(u&&(u(L.substring(ee,ae+2),p),E))return;ae+=2;continue}for(Y=ee+1;;Y++){if(Ee=L.charCodeAt(Y),isNaN(Ee))return F?L.substring(ee):(ae=-1,I("unclosed tag"));if(Ee===34)N=L.indexOf('"',Y+1),Y=N!==-1?N:Y;else if(Ee===39)N=L.indexOf("'",Y+1),Y=N!==-1?N:Y;else if(Ee===62){ae=Y;break}}if(V===33){if(l&&(l(L.substring(ee,ae+1),Ki,p),E))return;ae+=1;continue}if(z={},V===47){if(ne=!1,ce=!0,!S.length)return I("missing open tag");if(Y=R=S.pop(),N=ee+2+Y.length,L.substring(ee+2,N)!==Y)return I("closing tag mismatch");for(;N<ae;N++)if(V=L.charCodeAt(N),!(V===32||V>8&&V<14))return I("close tag")}else{if(L.charCodeAt(ae-1)===47?(Y=R=L.substring(ee+1,ae-1),ne=!0,ce=!0):(Y=R=L.substring(ee+1,ae),ne=!0,ce=!1),!(V>96&&V<123||V>64&&V<91||V===95||V===58))return I("illegal first char nodeName");for(N=1,B=Y.length;N<B;N++)if(V=Y.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=Y.substring(0,N),z=null;break}return I("invalid nodeName")}ce||S.push(R)}if(g){Je=x,ne&&(ce||b.push(Je),z===null&&(m=Y.indexOf("xmlns",N)!==-1)&&(O=N,M=Y,ge(),m=!1)),_=R,ke!==x&&(te=x[rf],te===void 0&&(te=x[rf]=Object.create(null)),ke=x);var tt=te[R];if(tt!==void 0)R=tt;else{if(V=R.indexOf(":"),V!==-1){if(_t=x[R.substring(0,V)],!_t)return I("missing namespace on <"+_+">");R=R.substr(V+1)}else _t=x.xmlns;_t&&(R=_t+":"+R),te[_]=R}}if(ne&&(O=N,M=Y,i&&(t?i(v,Ki,ce,p):i(R,ge,Ki,ce,p),E)))return;if(ce){if(r&&(r(t?v:R,Ki,ne,p),E))return;g&&(ne?x=Je:x=b.pop())}ae+=1}}}function af(e){return e.xml&&e.xml.tagAlias==="lowerCase"}var $c={xsi:"http://www.w3.org/2001/XMLSchema-instance",xml:"http://www.w3.org/XML/1998/namespace"},sf="property";function cf(e){return e.xml&&e.xml.serialize}function kb(e){const t=cf(e);return t!==sf&&(t||null)}function Db(e){return e.charAt(0).toUpperCase()+e.slice(1)}function uf(e,t){return af(t)?e.prefix+":"+Db(e.localName):e.name}function Ob(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 Ib(e,t,n){const i=Ot(e,t.xmlns),r=`${t[i.prefix]||i.prefix}:${i.localName}`,o=Ot(r);var a=n.getPackage(o.prefix);return Ob(o,a)}function gi(e){return new Error(e)}function qn(e){return e.$descriptor}function Lb(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 gi("expected element");var n=this.elementsById,i=qn(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 gi("duplicate ID <"+o+">");n[o]=t}},this.addWarning=function(t){this.warnings.push(t)}}function so(){}so.prototype.handleEnd=function(){},so.prototype.handleText=function(){},so.prototype.handleNode=function(){};function jc(){}jc.prototype=Object.create(so.prototype),jc.prototype.handleNode=function(){return this};function Er(){}Er.prototype=Object.create(so.prototype),Er.prototype.handleText=function(e){this.body=(this.body||"")+e};function co(e,t){this.property=e,this.context=t}co.prototype=Object.create(Er.prototype),co.prototype.handleNode=function(e){if(this.element)throw gi("expected no sub nodes");return this.element=this.createReference(e),this},co.prototype.handleEnd=function(){this.element.id=this.body},co.prototype.createReference=function(e){return{property:this.property.ns.name,id:""}};function Fc(e,t){this.element=t,this.propertyDesc=e}Fc.prototype=Object.create(Er.prototype),Fc.prototype.handleEnd=function(){var e=this.body||"",t=this.element,n=this.propertyDesc;e=Ic(n.type,e),n.isMany?t.get(n.name).push(e):t.set(n.name,e)};function ma(){}ma.prototype=Object.create(Er.prototype),ma.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 Ft(e,t,n){this.model=e,this.type=e.getType(t),this.context=n}Ft.prototype=Object.create(ma.prototype),Ft.prototype.addReference=function(e){this.context.addReference(e)},Ft.prototype.handleText=function(e){var t=this.element,n=qn(t),i=n.bodyProperty;if(!i)throw gi("unexpected body text <"+e+">");Er.prototype.handleText.call(this,e)},Ft.prototype.handleEnd=function(){var e=this.body,t=this.element,n=qn(t),i=n.bodyProperty;i&&e!==void 0&&(e=Ic(i.type,e),t.set(i.name,e))},Ft.prototype.createElement=function(e){var t=e.attributes,n=this.type,i=qn(n),r=this.context,o=new n({}),a=this.model,s;return P(t,function(c,u){var l=i.propertiesByName[u],p;l&&l.isReference?l.isMany?(p=c.split(" "),P(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=Ic(l.type,c):u==="xmlns"?u=":"+u:(s=Ot(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},Ft.prototype.getPropertyForNode=function(e){var t=e.name,n=Ot(t),i=this.type,r=this.model,o=qn(i),a=n.name,s=o.propertiesByName[a];if(s&&!s.isAttr){const u=kb(s);if(u){const l=e.attributes[u];if(l){const p=Ib(l,e.ns,r),f=r.getType(p);return k({},s,{effectiveType:qn(f).name})}}return s}var c=r.getPackage(n.prefix);if(c){const u=uf(n,c),l=r.getType(u);if(s=ze(o.properties,function(p){return!p.isVirtual&&!p.isReference&&!p.isAttribute&&l.hasType(p.type)}),s)return k({},s,{effectiveType:qn(l).name})}else if(s=ze(o.properties,function(u){return!u.isReference&&!u.isAttribute&&u.type==="Element"}),s)return s;throw gi("unrecognized element <"+n.name+">")},Ft.prototype.toString=function(){return"ElementDescriptor["+qn(this.type).name+"]"},Ft.prototype.valueHandler=function(e,t){return new Fc(e,t)},Ft.prototype.referenceHandler=function(e){return new co(e,this.context)},Ft.prototype.handler=function(e){return e==="Element"?new wr(this.model,e,this.context):new Ft(this.model,e,this.context)},Ft.prototype.handleChild=function(e){var t,n,i,r;if(t=this.getPropertyForNode(e),i=this.element,n=t.effectiveType||t.type,Qp(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 Hc(e,t,n){Ft.call(this,e,t,n)}Hc.prototype=Object.create(Ft.prototype),Hc.prototype.createElement=function(e){var t=e.name,n=Ot(t),i=this.model,r=this.type,o=i.getPackage(n.prefix),a=o&&uf(n,o)||t;if(!r.hasType(a))throw gi("unexpected element <"+e.originalName+">");return Ft.prototype.createElement.call(this,e)};function wr(e,t,n){this.model=e,this.context=n}wr.prototype=Object.create(ma.prototype),wr.prototype.createElement=function(e){var t=e.name,n=Ot(t),i=n.prefix,r=e.ns[i+"$uri"],o=e.attributes;return this.model.createAny(t,r,o)},wr.prototype.handleChild=function(e){var t=new wr(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},wr.prototype.handleEnd=function(){this.body&&(this.element.$body=this.body)};function zc(e){e instanceof ln&&(e={model:e}),k(this,{lax:!1},e)}zc.prototype.fromXML=function(e,t,n){var i=t.rootHandler;t instanceof Ft?(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 Lb(k({},t,{rootHandler:i})),s=new of({proxy:!0}),c=Bb();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
1
+ (function(te,ct){typeof exports=="object"&&typeof module<"u"?ct(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],ct):(te=typeof globalThis<"u"?globalThis:te||self,ct(te.BpmnModeler={},te.Vue))})(this,(function(te,ct){"use strict";var jk=Object.defineProperty;var Fk=(te,ct,ai)=>ct in te?jk(te,ct,{enumerable:!0,configurable:!0,writable:!0,value:ai}):te[ct]=ai;var Or=(te,ct,ai)=>Fk(te,typeof ct!="symbol"?ct+"":ct,ai);const ai=["startEvent","endEvent","userTask","serviceTask","task","sendTask","receiveTask","exclusiveGateway","parallelGateway"];function pf(e){return ai.includes(e)}const ff="http://g1project.net/spec/bpmn/bwl/1.0",qc="bwl",Yc=["top-left","top","top-right","right","bottom-right","bottom","bottom-left","left"],df={name:"bwl-hints",uri:ff,prefix:qc,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"}]}]},Kc="bwl.undoEpisode",hf=new WeakSet;function Cb(e){hf.has(e)||(e.register(Kc,{preExecute(t){try{t.run()}catch(n){t.error=n}}}),hf.add(e))}function mf(e,t){Cb(e);const n={run:t};if(e.execute(Kc,n),n.error!==void 0)throw e.canUndo()&&e.undo(),n.error}const gf=["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"],Pb={description:"생략 = 보존, null = 제거.",anyOf:[{type:"string"},{type:"null"}]},Ab={type:"object",description:"레인. 배열 선언 순서 = 풀 내 상→하 순서.",properties:{id:{type:"string"},name:{type:"string"}},required:["id"],additionalProperties:!1},Tb={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},Mb={type:"object",description:"플로우 노드. 좌표는 지정하지 않는다 — 배치는 resolver 가 결정한다.",properties:{id:{type:"string"},type:{type:"string",enum:[...ai]},name:{type:"string"},participant:{type:"string",description:"소속 풀 id(협업 문서)."},lane:{type:"string",description:"소속 레인 id(풀 정의에 선언된 것)."}},required:["id","type"],additionalProperties:!1},kb={type:"object",description:"분기 조건 — 게이트웨이가 아닌 플로우에 붙인다. MVP 는 label 만.",properties:{label:{type:"string"}},required:["label"],additionalProperties:!1},Db={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},Ob={type:"object",description:"메시지 플로우(풀 경계를 넘는 연결 — 노드 또는 블랙박스 풀 자체가 끝점).",properties:{id:{type:"string"},source:{type:"string"},target:{type:"string"},name:{type:"string"}},required:["id","source","target"],additionalProperties:!1},Ib={type:"object",properties:{id:{type:"string"},name:{type:"string"}},required:["id"],additionalProperties:!1},Lb={type:"object",description:"데이터 입출력 연관. 방향 = source→target(태스크→스토어 = 쓰기, 스토어→태스크 = 읽기).",properties:{id:{type:"string"},source:{type:"string"},target:{type:"string"}},required:["source","target"],additionalProperties:!1},Nb={type:"object",properties:{id:{type:"string"},text:{type:"string"}},required:["id","text"],additionalProperties:!1},Bb={type:"object",description:"연관선(주석 ↔ 요소).",properties:{id:{type:"string"},source:{type:"string"},target:{type:"string"}},required:["source","target"],additionalProperties:!1},$b={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},jb={type:"object",description:"주석 방위 힌트 — 앵커 요소 기준 상대 배치. 있으면 결정적 배치, 없으면 휴리스틱.",properties:{anchor:{type:"string",description:"기준 요소 id."},side:{type:"string",enum:[...Yc]},offset:{type:"number"}},required:["anchor","side"],additionalProperties:!1};function $t(e,t){return{type:"object",description:t.description,properties:{kind:{const:e},...t.properties},required:["kind",...t.required??[]],additionalProperties:!1}}const Fb={"participant.add":$t("participant.add",{description:"풀 추가. order = 풀 세로 순서 힌트(생략 시 op 순서가 곧 배치 순서).",properties:{participant:{$ref:"#/$defs/irParticipant"},order:{type:"integer"}},required:["participant"]}),"participant.update":$t("participant.update",{description:"풀 이름/레인 갱신. lanes 는 전체 재선언(생략 = 보존) — 기존 레인을 유지하려면 함께 다시 나열한다.",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"},lanes:{type:"array",items:{$ref:"#/$defs/irLane"}}},required:["id"]}),"node.add":$t("node.add",{description:"플로우 노드 추가. band = 가로 밴드 순번 힌트(주 흐름 0, 보조 스트랜드 1…). 레인이 있으면 그 레인 안의 밴드다 — 한 레인 안에서 게이트웨이 출구를 갈라 놓을 때 쓴다. 컨테이너(풀·레인)는 밴드 수만큼 자란다.",properties:{node:{$ref:"#/$defs/irNode"},band:{type:"integer"}},required:["node"]}),"node.update":$t("node.update",{description:"노드 이름/레인/타입 갱신. lane = 레인 재배정(이동), type = 태스크·이벤트 타입 전환.",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"},lane:{type:"string"},type:{type:"string",enum:[...ai]}},required:["id"]}),"sequenceFlow.add":$t("sequenceFlow.add",{description:"시퀀스 플로우 추가. 분기 조건은 게이트웨이가 아닌 플로우의 condition 에 싣는다.",properties:{flow:{$ref:"#/$defs/irSequenceFlow"}},required:["flow"]}),"sequenceFlow.update":$t("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":$t("messageFlow.add",{description:"메시지 플로우 추가(풀 경계를 넘는 연결).",properties:{flow:{$ref:"#/$defs/irMessageFlow"}},required:["flow"]}),"messageFlow.update":$t("messageFlow.update",{description:"메시지 플로우 이름 갱신.",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"}},required:["id"]}),"dataStore.add":$t("dataStore.add",{description:"데이터 스토어 추가(+ 입출력 연관 동반 가능).",properties:{dataStore:{$ref:"#/$defs/irDataStore"},associations:{type:"array",items:{$ref:"#/$defs/irDataAssociation"}}},required:["dataStore"]}),"dataStore.update":$t("dataStore.update",{description:"데이터 스토어 이름 갱신.",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"}},required:["id"]}),"dataAssociation.add":$t("dataAssociation.add",{description:"기존 노드 ↔ 기존 데이터 스토어의 입출력 연관 추가.",properties:{association:{$ref:"#/$defs/irDataAssociation"}},required:["association"]}),"association.add":$t("association.add",{description:"주석 ↔ 요소 연관 추가(한쪽 끝은 주석). 주석 신설과 함께면 annotation.add 의 association 을 쓰고, 이 op 는 추가 연관(한 주석에 여러 연관)용.",properties:{association:{$ref:"#/$defs/irAssociation"}},required:["association"]}),"annotation.add":$t("annotation.add",{description:"텍스트 주석 추가. association 으로 대상 요소와 연결하고, placement 로 방위를 지정하면 결정적 배치된다.",properties:{annotation:{$ref:"#/$defs/irTextAnnotation"},association:{$ref:"#/$defs/irAssociation"},placement:{$ref:"#/$defs/bwlPlacement"}},required:["annotation"]}),"annotation.update":$t("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":$t("group.add",{description:"그룹 추가 — 바운즈는 members 의 bbox 로 산출되므로 좌표를 지정하지 않는다.",properties:{group:{$ref:"#/$defs/irGroup"}},required:["group"]}),"group.update":$t("group.update",{description:"그룹 이름/멤버 갱신. members 는 전체 재선언(생략 = 보존).",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"},members:{type:"array",items:{type:"string"}}},required:["id"]}),"element.remove":$t("element.remove",{description:"요소 제거(카테고리 무관). 부착된 연결선은 함께 제거된다.",properties:{id:{type:"string"}},required:["id"]})},vf={anyOf:gf.map(e=>Fb[e])},Hb={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:Ab,irParticipant:Tb,irNode:Mb,irFlowCondition:kb,irSequenceFlow:Db,irMessageFlow:Ob,irDataStore:Ib,irDataAssociation:Lb,irTextAnnotation:Nb,irAssociation:Bb,irGroup:$b,bwlPlacement:jb,nullableString:Pb,symbolicOp:vf}};function Xc(e){return Array.prototype.concat.apply([],e)}const Eo=Object.prototype.toString,zb=Object.prototype.hasOwnProperty;function cr(e){return e===void 0}function yt(e){return e!==void 0}function Ir(e){return e==null}function le(e){return Eo.call(e)==="[object Array]"}function Rt(e){return Eo.call(e)==="[object Object]"}function de(e){return Eo.call(e)==="[object Number]"}function Ct(e){const t=Eo.call(e);return t==="[object Function]"||t==="[object AsyncFunction]"||t==="[object GeneratorFunction]"||t==="[object AsyncGeneratorFunction]"||t==="[object Proxy]"}function en(e){return Eo.call(e)==="[object String]"}function Vb(e){if(!le(e))throw new Error("must supply array")}function tn(e,t){return!Ir(e)&&zb.call(e,t)}function Ge(e,t){const n=Ta(t);let i;return T(e,function(r,o){if(n(r,o))return i=r,!1}),i}function yf(e,t){const n=Ta(t);let i=le(e)?-1:void 0;return T(e,function(r,o){if(n(r,o))return i=o,!1}),i}function Ee(e,t){const n=Ta(t);let i=[];return T(e,function(r,o){n(r,o)&&i.push(r)}),i}function T(e,t){let n,i;if(cr(e))return;const r=le(e)?Yb:qb;for(let o in e)if(tn(e,o)&&(n=e[o],i=t(n,r(o)),i===!1))return n}function Gb(e,t){if(cr(e))return[];Vb(e);const n=Ta(t);return e.filter(function(i,r){return!n(i,r)})}function nn(e,t,n){return T(e,function(i,r){n=t(n,i,r)}),n}function ur(e,t){return!!nn(e,function(n,i,r){return n&&t(i,r)},!0)}function Ci(e,t){return!!Ge(e,t)}function jt(e,t){let n=[];return T(e,function(i,r){n.push(t(i,r))}),n}function Aa(e){return e&&Object.keys(e)||[]}function Wb(e){return Aa(e).length}function Lr(e){return jt(e,t=>t)}function Nr(e,t,n={}){return t=Zc(t),T(e,function(i){let r=t(i)||"_",o=n[r];o||(o=n[r]=[]),o.push(i)}),n}function _f(e,...t){e=Zc(e);let n={};return T(t,r=>Nr(r,e,n)),jt(n,function(r,o){return r[0]})}const Ub=_f;function Hn(e,t){t=Zc(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)}),jt(n,i=>i.v)}function Br(e){return function(t){return ur(e,function(n,i){return t[i]===n})}}function Zc(e){return Ct(e)?e:t=>t[e]}function Ta(e){return Ct(e)?e:t=>t===e}function qb(e){return e}function Yb(e){return Number(e)}function Qc(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 Zt(e,t){return e.bind(t)}function D(e,...t){return Object.assign(e,...t)}function Kb(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];yt(a)&&Ir(s)&&(s=i[r]=isNaN(+a)?{}:[]),cr(a)?cr(n)?delete i[r]:i[r]=n:i=s}),e}function In(e,t){let n={},i=Object(e);return T(t,function(r){r in i&&(n[r]=e[r])}),n}function zn(e,t){let n={},i=Object(e);return T(i,function(r,o){t.indexOf(o)===-1&&(n[o]=r)}),n}function Jc(){}Jc.prototype.get=function(e){return this.$model.properties.get(this,e)},Jc.prototype.set=function(e,t){this.$model.properties.set(this,e,t)};function bf(e,t){this.model=e,this.properties=t}bf.prototype.createType=function(e){var t=this.model,n=this.properties,i=Object.create(Jc.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,Zt(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 Xb=D(Object.create(null),{String:!0,Boolean:!0,Integer:!0,Real:!0,Element:!0}),xf=D(Object.create(null),{String:function(e){return e},Boolean:function(e){return e==="true"},Integer:function(e){return parseInt(e,10)},Real:function(e){return parseFloat(e)}});function eu(e,t){var n=xf[e];return n?n(t):t}function tu(e){return!!Xb[e]}function Ef(e){return!!xf[e]}function Ft(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 hn(e){this.ns=e,this.name=e.name,this.allTypes=[],this.allTypesByName=Object.create(null),this.properties=[],this.propertiesByName=Object.create(null)}hn.prototype.build=function(){return In(this,["ns","name","allTypes","allTypesByName","properties","propertiesByName","bodyProperty","idProperty"])},hn.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)},hn.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},hn.prototype.redefineProperty=function(e,t,n){var i=e.ns.prefix,r=t.split("#"),o=Ft(r[0],i),a=Ft(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},hn.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},hn.prototype.removeNamedProperty=function(e){var t=e.ns,n=this.propertiesByName;delete n[t.name],delete n[t.localName]},hn.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},hn.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},hn.prototype.assertNotTrait=function(e){if((e.extends||[]).length)throw new Error(`cannot create <${e.name}> extending <${e.extends}>`)},hn.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")},hn.prototype.hasProperty=function(e){return this.propertiesByName[e]},hn.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,Zt(function(o){o=D({},o,{name:o.ns.localName,inherited:t}),Object.defineProperty(o,"definedBy",{value:e});var a=o.replaces,s=o.redefines;a||s?this.redefineProperty(o,a||s,a):(o.isBody&&this.setBodyProperty(o),o.isId&&this.setIdProperty(o),this.addProperty(o))},this)),i.push(e),n[r]=e)};function Pi(e,t){this.packageMap=Object.create(null),this.typeMap=Object.create(null),this.packages=[],this.properties=t,T(e,Zt(this.registerPackage,this))}Pi.prototype.getPackage=function(e){return this.packageMap[e]},Pi.prototype.getPackages=function(){return this.packages},Pi.prototype.registerPackage=function(e){e=D({},e);var t=this.packageMap;wf(t,e,"prefix"),wf(t,e,"uri"),T(e.types,Zt(function(n){this.registerType(n,e)},this)),t[e.uri]=t[e.prefix]=e,this.packages.push(e)},Pi.prototype.registerType=function(e,t){e=D({},e,{superClass:(e.superClass||[]).slice(),extends:(e.extends||[]).slice(),properties:(e.properties||[]).slice(),meta:D({},e.meta||{})});var n=Ft(e.name,t.prefix),i=n.name,r=Object.create(null);T(e.properties,Zt(function(o){var a=Ft(o.name,n.prefix),s=a.name;tu(o.type)||(o.type=Ft(o.type,a.prefix).name),D(o,{ns:a,name:s}),r[s]=o},this)),D(e,{ns:n,name:i,propertiesByName:r}),T(e.extends,Zt(function(o){var a=Ft(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},Pi.prototype.mapTypes=function(e,t,n){var i=tu(e.name)?{name:e.name}:this.typeMap[e.name],r=this;function o(c,u){var l=Ft(c,tu(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)},Pi.prototype.getEffectiveDescriptor=function(e){var t=Ft(e),n=new hn(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},Pi.prototype.definePackage=function(e,t){this.properties.define(e,"$pkg",{value:t})};function wf(e,t,n){var i=t[n];if(i in e)throw new Error("package with "+n+" <"+i+"> already defined")}function lr(e){this.model=e}lr.prototype.set=function(e,t,n){if(!en(t)||!t.length)throw new TypeError("property name must be a non-empty string");var i=this.getProperty(e,t),r=i&&i.name;Zb(n)?i?delete e[r]:delete e.$attrs[nu(t)]:i?r in e?e[r]=n:Sf(e,i,n):e.$attrs[nu(t)]=n},lr.prototype.get=function(e,t){var n=this.getProperty(e,t);if(!n)return e.$attrs[nu(t)];var i=n.name;return!e[i]&&n.isMany&&Sf(e,n,[]),e[i]},lr.prototype.define=function(e,t,n){if(!n.writable){var i=n.value;n=D({},n,{get:function(){return i}}),delete n.value}Object.defineProperty(e,t,n)},lr.prototype.defineDescriptor=function(e,t){this.define(e,"$descriptor",{value:t})},lr.prototype.defineModel=function(e,t){this.define(e,"$model",{value:t})},lr.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 Zb(e){return typeof e>"u"}function Sf(e,t,n){Object.defineProperty(e,t.name,{enumerable:!t.isReference,writable:!0,value:n,configurable:!0})}function nu(e){return e.replace(/^:/,"")}function bn(e,t={}){this.properties=new lr(this),this.factory=new bf(this,this.properties),this.registry=new Pi(e,this.properties),this.typeCache=Object.create(null),this.config=t}bn.prototype.create=function(e,t){var n=this.getType(e);if(!n)throw new Error("unknown type <"+e+">");return new n(t)},bn.prototype.getType=function(e){var t=this.typeCache,n=en(e)?e:e.ns.name,i=t[n];return i||(e=this.registry.getEffectiveDescriptor(n),i=t[n]=this.factory.createType(e)),i},bn.prototype.createAny=function(e,t,n){var i=Ft(e),r={$type:e,$instanceOf:function(a){return a===this.$type},get:function(a){return this[a]},set:function(a,s){Kb(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){Rt(a)&&a.value!==void 0?r[a.name]=a.value:r[s]=a}),r},bn.prototype.getPackage=function(e){return this.registry.getPackage(e)},bn.prototype.getPackages=function(){return this.registry.getPackages()},bn.prototype.getElementDescriptor=function(e){return e.$descriptor},bn.prototype.hasType=function(e,t){t===void 0&&(t=e,e=this);var n=e.$model.getElementDescriptor(e);return t in n.allTypesByName},bn.prototype.getPropertyDescriptor=function(e,t){return this.getElementDescriptor(e).propertiesByName[t]},bn.prototype.getTypeDescriptor=function(e){return this.registry.typeMap[e]};var Rf=String.fromCharCode,Qb=Object.prototype.hasOwnProperty,Jb=/&#(\d+);|&#x([0-9a-f]+);|&(\w+);/ig,wo={amp:"&",apos:"'",gt:">",lt:"<",quot:'"'};Object.keys(wo).forEach(function(e){wo[e.toUpperCase()]=wo[e]});function e0(e,t,n,i){return i?Qb.call(wo,i)?wo[i]:"&"+i+";":Rf(t||parseInt(n,16))}function pr(e){return e.length>3&&e.indexOf("&")!==-1?e.replace(Jb,e0):e}var Cf="non-whitespace outside of root node";function Ai(e){return new Error(e)}function t0(e){return"missing namespace for prefix <"+e+">"}function Ma(e){return{get:e,enumerable:!0}}function n0(e){var t=Object.create(null),n;for(n in e)t[n]=e[n];return t}var Pf=Symbol("nameCache");function iu(e){return e+"$uri"}function i0(e){var t=Object.create(null),n,i;for(n in e)i=e[n],t[i]=i,t[iu(i)]=n;return t}function ka(){return{line:0,column:0}}function r0(e){throw e}function Af(e){if(!this)return new Af(e);var t=e&&e.proxy,n,i,r,o,a=r0,s,c,u,l,p=ka,f=!1,d=!1,h="",m=!1,g=!1,w=null,E=!1,b,x,S,A;function I(L){L instanceof Error||(L=Ai(L)),w=L,a(L,p)}function P(L){s&&(L instanceof Error||(L=Ai(L)),s(L,p))}this.on=function(L,F){if(typeof F!="function")throw Ai("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 Ai("unsupported event: "+L)}return this},this.ns=function(L){if(typeof L>"u"&&(L={}),typeof L!="object")throw Ai("required args <nsMap={}>");var F=Object.create(null),ie;for(ie in L)F[ie]=L[ie];return g=!0,A=F,this};function $(){b=g?[]:null,x=g?i0(A):null,S=[],p=ka,E=!1,w=null,d=!1,h=""}this.parse=function(L){if(typeof L!="string")throw Ai("required args <xml=string>");if(f)throw Ai("parse during stream; call end() first");return $(),j(L),p=ka,E=!1,w},this.write=function(L){if(typeof L!="string")throw Ai("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=ka,E=!1,w},this.stop=function(){E=!0};function j(L,F=!1){var ie=null,Pe=null,nt,q=0,re=!1,ce=!1,oe=0,se=0,K,N,B,V,be,wt,R,_,v,k="",O=0,z;function ne(Fe,ot){var Nt=Fe.indexOf(":");if(Nt===-1)return Fe;var Wt=x[Fe.substring(0,Nt)];return Wt?ot===Wt?Fe.substr(Nt+1):Wt+Fe.substr(Nt):(P(t0(Fe.substring(0,Nt))),null)}function ye(){if(z!==null)return z;var Fe,ot,Nt=g&&x.xmlns,Wt=g&&m?[]:null,We=O,mt=k,Mt=mt.length,Dr,yn,$n,_n,gt,jn={},Pa=new Set,fn,De,Be;e:for(;We<Mt;We++)if(fn=!1,De=mt.charCodeAt(We),!(De===32||De<14&&De>8)){for((De<65||De>122||De>90&&De<97)&&De!==95&&De!==58&&(P("illegal first char attribute name"),fn=!0),Be=We+1;Be<Mt;Be++)if(De=mt.charCodeAt(Be),!(De>96&&De<123||De>64&&De<91||De>47&&De<59||De===46||De===45||De===95)){if(De===32||De<14&&De>8){P("missing attribute value"),We=Be;continue e}if(De===61)break;P("illegal attribute name char"),fn=!0}if(gt=mt.substring(We,Be),gt==="xmlns:xmlns"&&(P("illegal declaration of xmlns"),fn=!0),De=mt.charCodeAt(Be+1),De===34)Be=mt.indexOf('"',We=Be+2),Be===-1&&(Be=mt.indexOf("'",We),Be!==-1&&(P("attribute value quote missmatch"),fn=!0));else if(De===39)Be=mt.indexOf("'",We=Be+2),Be===-1&&(Be=mt.indexOf('"',We),Be!==-1&&(P("attribute value quote missmatch"),fn=!0));else for(P("missing attribute value quotes"),fn=!0,Be=Be+1;Be<Mt&&(De=mt.charCodeAt(Be+1),!(De===32||De<14&&De>8));Be++);for(Be===-1&&(P("missing closing quotes"),Be=Mt,fn=!0),fn||($n=mt.substring(We,Be)),We=Be;Be+1<Mt&&(De=mt.charCodeAt(Be+1),!(De===32||De<14&&De>8));Be++)We===Be&&(P("illegal character after attribute end"),fn=!0);if(We=Be+1,fn)continue e;if(Pa.has(gt)){P("attribute <"+gt+"> already defined");continue}if(Pa.add(gt),!g){jn[gt]=$n;continue}if(m){if(yn=gt==="xmlns"?"xmlns":gt.charCodeAt(0)===120&&gt.substr(0,6)==="xmlns:"?gt.substr(6):null,yn!==null){if(Fe=pr($n),ot=iu(yn),_n=A[Fe],!_n){if(yn==="xmlns"||ot in x&&x[ot]!==Fe)do _n="ns"+q++;while(typeof x[_n]<"u");else _n=yn;A[Fe]=_n}x[yn]!==_n&&(Dr||(x=n0(x),Dr=!0),x[yn]=_n,yn==="xmlns"&&(x[iu(_n)]=Fe,Nt=_n),x[ot]=Fe),jn[gt]=$n;continue}Wt.push(gt,$n);continue}gt=ne(gt,Nt),gt!==null&&(jn[gt]=$n)}if(m)for(We=0,Mt=Wt.length;We<Mt;We++)gt=ne(Wt[We++],Nt),$n=Wt[We],gt!==null&&(jn[gt]=$n);return z=jn}function Ie(){for(var Fe=/(\r\n|\r|\n)/g,ot=0,Nt=0,Wt=0,We=se,mt,Mt;oe>=Wt&&(mt=Fe.exec(L),!(!mt||(We=mt[0].length+mt.index,We>oe)));)ot+=1,Wt=We;return oe==-1?(Nt=We,Mt=L.substring(se)):se===0?Mt=L.substring(se,oe):(Nt=oe-Wt,Mt=se==-1?L.substring(oe):L.substring(oe,se+1)),{data:Mt,line:ot,column:Nt}}for(p=Ie,t&&(v=Object.create({},{name:Ma(function(){return R}),originalName:Ma(function(){return _}),attrs:Ma(ye),ns:Ma(function(){return x})}));se!==-1;){if(L.charCodeAt(se)===60?oe=se:oe=L.indexOf("<",se),oe===-1){if(F)return L.substring(se);if(S.length)return I("unexpected end of file");if(!d)return I("missing start tag");se<L.length&&L.substring(se).trim()&&P(Cf);return}if(d||(d=!0),se!==oe){if(S.length){if(n&&(n(L.substring(se,oe),pr,p),E))return}else if(L.substring(se,oe).trim()&&(P(Cf),E))return}if(V=L.charCodeAt(oe+1),V===33){if(B=L.charCodeAt(oe+2),B===91&&L.substr(oe+3,6)==="CDATA["){if(se=L.indexOf("]]>",oe),se===-1)return F?L.substring(oe):I("unclosed cdata");if(o&&(o(L.substring(oe+9,se),p),E))return;se+=3;continue}if(B===45&&L.charCodeAt(oe+3)===45){if(se=L.indexOf("-->",oe),se===-1)return F?L.substring(oe):I("unclosed comment");if(c&&(c(L.substring(oe+4,se),pr,p),E))return;se+=3;continue}}if(V===63){if(se=L.indexOf("?>",oe),se===-1)return F?L.substring(oe):I("unclosed question");if(u&&(u(L.substring(oe,se+2),p),E))return;se+=2;continue}for(K=oe+1;;K++){if(be=L.charCodeAt(K),isNaN(be))return F?L.substring(oe):(se=-1,I("unclosed tag"));if(be===34)B=L.indexOf('"',K+1),K=B!==-1?B:K;else if(be===39)B=L.indexOf("'",K+1),K=B!==-1?B:K;else if(be===62){se=K;break}}if(V===33){if(l&&(l(L.substring(oe,se+1),pr,p),E))return;se+=1;continue}if(z={},V===47){if(re=!1,ce=!0,!S.length)return I("missing open tag");if(K=R=S.pop(),B=oe+2+K.length,L.substring(oe+2,B)!==K)return I("closing tag mismatch");for(;B<se;B++)if(V=L.charCodeAt(B),!(V===32||V>8&&V<14))return I("close tag")}else{if(L.charCodeAt(se-1)===47?(K=R=L.substring(oe+1,se-1),re=!0,ce=!0):(K=R=L.substring(oe+1,se),re=!0,ce=!1),!(V>96&&V<123||V>64&&V<91||V===95||V===58))return I("illegal first char nodeName");for(B=1,N=K.length;B<N;B++)if(V=K.charCodeAt(B),!(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=K.substring(0,B),z=null;break}return I("invalid nodeName")}ce||S.push(R)}if(g){nt=x,re&&(ce||b.push(nt),z===null&&(m=K.indexOf("xmlns",B)!==-1)&&(O=B,k=K,ye(),m=!1)),_=R,Pe!==x&&(ie=x[Pf],ie===void 0&&(ie=x[Pf]=Object.create(null)),Pe=x);var it=ie[R];if(it!==void 0)R=it;else{if(V=R.indexOf(":"),V!==-1){if(wt=x[R.substring(0,V)],!wt)return I("missing namespace on <"+_+">");R=R.substr(V+1)}else wt=x.xmlns;wt&&(R=wt+":"+R),ie[_]=R}}if(re&&(O=B,k=K,i&&(t?i(v,pr,ce,p):i(R,ye,pr,ce,p),E)))return;if(ce){if(r&&(r(t?v:R,pr,re,p),E))return;g&&(re?x=nt:x=b.pop())}se+=1}}}function Tf(e){return e.xml&&e.xml.tagAlias==="lowerCase"}var ru={xsi:"http://www.w3.org/2001/XMLSchema-instance",xml:"http://www.w3.org/XML/1998/namespace"},Mf="property";function kf(e){return e.xml&&e.xml.serialize}function o0(e){const t=kf(e);return t!==Mf&&(t||null)}function a0(e){return e.charAt(0).toUpperCase()+e.slice(1)}function Df(e,t){return Tf(t)?e.prefix+":"+a0(e.localName):e.name}function s0(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 c0(e,t,n){const i=Ft(e,t.xmlns),r=`${t[i.prefix]||i.prefix}:${i.localName}`,o=Ft(r);var a=n.getPackage(o.prefix);return s0(o,a)}function Ti(e){return new Error(e)}function si(e){return e.$descriptor}function u0(e){D(this,e),this.elementsById={},this.references=[],this.warnings=[],this.addReference=function(t){this.references.push(t)},this.addElement=function(t){if(!t)throw Ti("expected element");var n=this.elementsById,i=si(t),r=i.idProperty,o;if(r&&(o=t.get(r.name),o)){if(!/^([a-z][\w-.]*:)?[a-z_][\w-.]*$/i.test(o))throw new Error("illegal ID <"+o+">");if(n[o])throw Ti("duplicate ID <"+o+">");n[o]=t}},this.addWarning=function(t){this.warnings.push(t)}}function So(){}So.prototype.handleEnd=function(){},So.prototype.handleText=function(){},So.prototype.handleNode=function(){};function ou(){}ou.prototype=Object.create(So.prototype),ou.prototype.handleNode=function(){return this};function $r(){}$r.prototype=Object.create(So.prototype),$r.prototype.handleText=function(e){this.body=(this.body||"")+e};function Ro(e,t){this.property=e,this.context=t}Ro.prototype=Object.create($r.prototype),Ro.prototype.handleNode=function(e){if(this.element)throw Ti("expected no sub nodes");return this.element=this.createReference(e),this},Ro.prototype.handleEnd=function(){this.element.id=this.body},Ro.prototype.createReference=function(e){return{property:this.property.ns.name,id:""}};function au(e,t){this.element=t,this.propertyDesc=e}au.prototype=Object.create($r.prototype),au.prototype.handleEnd=function(){var e=this.body||"",t=this.element,n=this.propertyDesc;e=eu(n.type,e),n.isMany?t.get(n.name).push(e):t.set(n.name,e)};function Da(){}Da.prototype=Object.create($r.prototype),Da.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 Ut(e,t,n){this.model=e,this.type=e.getType(t),this.context=n}Ut.prototype=Object.create(Da.prototype),Ut.prototype.addReference=function(e){this.context.addReference(e)},Ut.prototype.handleText=function(e){var t=this.element,n=si(t),i=n.bodyProperty;if(!i)throw Ti("unexpected body text <"+e+">");$r.prototype.handleText.call(this,e)},Ut.prototype.handleEnd=function(){var e=this.body,t=this.element,n=si(t),i=n.bodyProperty;i&&e!==void 0&&(e=eu(i.type,e),t.set(i.name,e))},Ut.prototype.createElement=function(e){var t=e.attributes,n=this.type,i=si(n),r=this.context,o=new n({}),a=this.model,s;return 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=eu(l.type,c):u==="xmlns"?u=":"+u:(s=Ft(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},Ut.prototype.getPropertyForNode=function(e){var t=e.name,n=Ft(t),i=this.type,r=this.model,o=si(i),a=n.name,s=o.propertiesByName[a];if(s&&!s.isAttr){const u=o0(s);if(u){const l=e.attributes[u];if(l){const p=c0(l,e.ns,r),f=r.getType(p);return D({},s,{effectiveType:si(f).name})}}return s}var c=r.getPackage(n.prefix);if(c){const u=Df(n,c),l=r.getType(u);if(s=Ge(o.properties,function(p){return!p.isVirtual&&!p.isReference&&!p.isAttribute&&l.hasType(p.type)}),s)return D({},s,{effectiveType:si(l).name})}else if(s=Ge(o.properties,function(u){return!u.isReference&&!u.isAttribute&&u.type==="Element"}),s)return s;throw Ti("unrecognized element <"+n.name+">")},Ut.prototype.toString=function(){return"ElementDescriptor["+si(this.type).name+"]"},Ut.prototype.valueHandler=function(e,t){return new au(e,t)},Ut.prototype.referenceHandler=function(e){return new Ro(e,this.context)},Ut.prototype.handler=function(e){return e==="Element"?new jr(this.model,e,this.context):new Ut(this.model,e,this.context)},Ut.prototype.handleChild=function(e){var t,n,i,r;if(t=this.getPropertyForNode(e),i=this.element,n=t.effectiveType||t.type,Ef(n))return this.valueHandler(t,i);t.isReference?r=this.referenceHandler(t).handleNode(e):r=this.handler(n).handleNode(e);var o=r.element;return o!==void 0&&(t.isMany?i.get(t.name).push(o):i.set(t.name,o),t.isReference?(D(o,{element:i}),this.context.addReference(o)):o.$parent=i),r};function su(e,t,n){Ut.call(this,e,t,n)}su.prototype=Object.create(Ut.prototype),su.prototype.createElement=function(e){var t=e.name,n=Ft(t),i=this.model,r=this.type,o=i.getPackage(n.prefix),a=o&&Df(n,o)||t;if(!r.hasType(a))throw Ti("unexpected element <"+e.originalName+">");return Ut.prototype.createElement.call(this,e)};function jr(e,t,n){this.model=e,this.context=n}jr.prototype=Object.create(Da.prototype),jr.prototype.createElement=function(e){var t=e.name,n=Ft(t),i=n.prefix,r=e.ns[i+"$uri"],o=e.attributes;return this.model.createAny(t,r,o)},jr.prototype.handleChild=function(e){var t=new jr(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},jr.prototype.handleEnd=function(){this.body&&(this.element.$body=this.body)};function cu(e){e instanceof bn&&(e={model:e}),D(this,{lax:!1},e)}cu.prototype.fromXML=function(e,t,n){var i=t.rootHandler;t instanceof Ut?(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 u0(D({},t,{rootHandler:i})),s=new Af({proxy:!0}),c=l0();i.context=a,c.push(i);function u(S,A,I){var P=A(),$=P.line,j=P.column,L=P.data;L.charAt(0)==="<"&&L.indexOf(" ")!==-1&&(L=L.slice(0,L.indexOf(" "))+">");var F="unparsable content "+(L?L+" ":"")+`detected
2
2
  line: `+$+`
3
3
  column: `+j+`
4
- nested error: `+S.message;if(I)return a.addWarning({message:F,error:S}),!0;throw gi(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=qn($).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),te=F.indexOf(C);te===-1&&(te=F.length),j?F[te]=j:F.splice(te,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 jc)}}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($c).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,te){var ke=A($[te]);return F[te]=ke,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=gi("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 Hc(this.model,e)};function Bb(){var e=[];return Object.defineProperty(e,"peek",{value:function(){return this[this.length-1]}}),e}var Nb=`<?xml version="1.0" encoding="UTF-8"?>
5
- `,$b=/<|>|'|"|&|\n\r|\n/g,lf=/<|>|&/g;function Tn(e){this.prefixMap={},this.uriMap={},this.used={},this.wellknown=[],this.custom=[],this.parent=e,this.defaultPrefixMap=e&&e.defaultPrefixMap||{}}Tn.prototype.mapDefaultPrefixes=function(e){this.defaultPrefixMap=e},Tn.prototype.defaultUriByPrefix=function(e){return this.defaultPrefixMap[e]},Tn.prototype.byUri=function(e){return this.uriMap[e]||this.parent&&this.parent.byUri(e)},Tn.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)},Tn.prototype.uriByPrefix=function(e){return this.prefixMap[e||"xmlns"]||this.parent&&this.parent.uriByPrefix(e)},Tn.prototype.mapPrefix=function(e,t){this.prefixMap[e||"xmlns"]=t},Tn.prototype.getNSKey=function(e){return e.prefix!==void 0?e.uri+"|"+e.prefix:e.uri},Tn.prototype.logUsed=function(e){var t=e.uri,n=this.getNSKey(e);this.used[n]=this.byUri(t),this.parent&&this.parent.logUsed(e)},Tn.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 jb(e){return e.charAt(0).toLowerCase()+e.slice(1)}function Fb(e,t){return af(t)?jb(e):e}function pf(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})}function ff(e){return qt(e)?e:(e.prefix?e.prefix+":":"")+e.localName}function Hb(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 zb(e,t){return t.isGeneric?k({localName:t.ns.localName},e):k({localName:Fb(t.ns.localName,t.$pkg)},e)}function Vb(e,t){return k({localName:t.ns.localName},e)}function Gb(e){var t=e.$descriptor;return Re(t.properties,function(n){var i=n.name;if(n.isVirtual||!Yt(e,i))return!1;var r=e[i];return r===n.default||r===null?!1:n.isMany?r.length:!0})}var Wb={"\n":"#10","\n\r":"#10",'"':"#34","'":"#39","<":"#60",">":"#62","&":"#38"},Ub={"<":"lt",">":"gt","&":"amp"};function df(e,t,n){return e=qt(e)?e:""+e,e.replace(t,function(i){return"&"+n[i]+";"})}function qb(e){return df(e,$b,Wb)}function Yb(e){return df(e,lf,Ub)}function Kb(e){return Re(e,function(t){return t.isAttr})}function Xb(e){return Re(e,function(t){return!t.isAttr})}function Vc(e){this.tagName=e}Vc.prototype.build=function(e){return this.element=e,this},Vc.prototype.serializeTo=function(e){e.appendIndent().append("<"+this.tagName+">"+this.element.id+"</"+this.tagName+">").appendNewLine()};function Xi(){}Xi.prototype.serializeValue=Xi.prototype.serializeTo=function(e){e.append(this.escape?Yb(this.value):this.value)},Xi.prototype.build=function(e,t){return this.value=t,e.type==="String"&&t.search(lf)!==-1&&(this.escape=!0),this};function Gc(e){this.tagName=e}pf(Gc,Xi),Gc.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=Gb(e),this.parseAttributes(Kb(r)),this.parseContainments(Xb(r))),this.parseGenericAttributes(e,i),this},qe.prototype.nsTagName=function(e){var t=this.logNamespaceUsed(e.ns);return zb(t,e)},qe.prototype.nsPropertyTagName=function(e){var t=this.logNamespaceUsed(e.ns);return Vb(t,e)},qe.prototype.isLocalNs=function(e){return e.uri===this.ns.uri},qe.prototype.nsAttributeName=function(e){var t;if(qt(e)?t=Ot(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 Xi().build({type:"String"},t));var n=e.$children;n&&P(n,i=>{this.body.push(new qe(this).build(i))})},qe.prototype.parseNsAttribute=function(e,t,n){var i=e.$model,r=Ot(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 P(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;P(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;P(e,function(r){var o=i.get(r.name),a=r.isReference,s=r.isMany;if(s||(o=[o]),r.isBody)n.push(new Xi().build(r,o[0]));else if(Qp(r.type))P(o,function(u){n.push(new Gc(t.addTagName(t.nsPropertyTagName(r))).build(r,u))});else if(a)P(o,function(u){n.push(new Vc(t.addTagName(t.nsPropertyTagName(r))).build(u))});else{var c=cf(r);P(o,function(u){var l;c?c===sf?l=new qe(t,r):l=new ga(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 Tn(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;P(e,function(i){var r=n.get(i.name);if(i.isReference)if(!i.isMany)r=r.id;else{var o=[];P(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),ff(e)},qe.prototype.addAttribute=function(e,t){var n=this.attrs;qt(t)&&(t=qb(t));var i=Yp(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=Hb(n).concat(t)),P(t,function(i){e.append(" ").append(ff(i.name)).append('="').append(i.value).append('"')})},qe.prototype.serializeTo=function(e){var t=this.body[0],n=t&&t.constructor!==Xi;e.appendIndent().append("<"+this.tagName),this.serializeAttributes(e),e.append(t?">":" />"),t&&(n&&e.appendNewLine().indent(),P(this.body,function(i){i.serializeTo(e)}),n&&e.unindent().appendIndent(),e.append("</"+this.tagName+">")),e.appendNewLine()};function ga(e,t,n){qe.call(this,e,t),this.serialization=n}pf(ga,qe),ga.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},ga.prototype.isLocalNs=function(e){return e.uri===(this.typeNs||this.ns).uri};function Zb(){this.value="",this.write=function(e){this.value+=e}}function Qb(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 Jb(e){e=k({format:!1,preamble:!0},e||{});function t(n,i){var r=i||new Zb,o=new Qb(r,e.format);e.preamble&&o.append(Nb);var a=new qe,s=n.$model;if(a.getNamespaces().mapDefaultPrefixes(e0(s)),a.build(n).serializeTo(o),!i)return r.value}return{toXML:t}}function e0(e){const t=e.config&&e.config.nsMap||{},n={};for(const i in $c)n[i]=$c[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 va(e,t){ln.call(this,e,t)}va.prototype=Object.create(ln.prototype),va.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)},va.prototype.toXML=function(e,t){var n=new Jb(t);return new Promise(function(i,r){try{var o=n.toXML(e);return i({xml:o})}catch(a){return r(a)}})};var t0="BPMN20",n0="http://www.omg.org/spec/BPMN/20100524/MODEL",i0="bpmn",r0=[],o0=[{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"}]}],a0=[{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"}]}],s0={tagAlias:"lowerCase",typePrefix:"t"},c0={name:t0,uri:n0,prefix:i0,associations:r0,types:o0,enumerations:a0,xml:s0},u0="BPMNDI",l0="http://www.omg.org/spec/BPMN/20100524/DI",p0="bpmndi",f0=[{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"]}],d0=[{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"}]}],h0=[],m0={name:u0,uri:l0,prefix:p0,types:f0,enumerations:d0,associations:h0},g0="DC",v0="http://www.omg.org/spec/DD/20100524/DC",y0="dc",_0=[{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=[],x0={name:g0,uri:v0,prefix:y0,types:_0,associations:b0},E0="DI",w0="http://www.omg.org/spec/DD/20100524/DI",S0="di",R0=[{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"}]}],C0=[],P0={tagAlias:"lowerCase"},A0={name:E0,uri:w0,prefix:S0,types:R0,associations:C0,xml:P0},T0="bpmn.io colors for BPMN",M0="http://bpmn.io/schema/bpmn/biocolor/1.0",k0="bioc",D0=[{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"}]}],O0=[],I0=[],L0={name:T0,uri:M0,prefix:k0,types:D0,enumerations:O0,associations:I0},B0="BPMN in Color",N0="http://www.omg.org/spec/BPMN/non-normative/color/1.0",$0="color",j0=[{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"}]}],F0=[],H0=[],z0={name:B0,uri:N0,prefix:$0,types:j0,enumerations:F0,associations:H0};const V0={bpmn:c0,bpmndi:m0,dc:x0,di:A0,bioc:L0,color:z0};function hf(e,t){const n=k({},V0,e);return new va(n,t)}const G0={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"}},W0="http://www.omg.org/spec/BPMN/non-normative/extensions/i18n/1.0",mf="i18n",ya={[mf]:G0,[Pc]:Vp};function gf(){return hf(ya)}const vf=gf();async function Wc(e){const{rootElement:t,warnings:n}=await vf.fromXML(e,"bpmn:Definitions");return{definitions:t,warnings:n}}async function U0(e){const{xml:t}=await vf.toXML(e,{format:!0});return t}function Uc(e){return e.map(t=>typeof t=="string"?t:t.message??String(t))}const _a=new Set(["bpmn:Participant","bpmn:Lane","bpmn:Group","bpmn:SubProcess","bpmn:AdHocSubProcess","bpmn:Transaction"]),q0=1,Y0=2;function Zi(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]}`}}const K0=20,X0=1;function yf(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 qc(e,t){let n=null;for(const i of yf(e))for(const r of yf(t)){if(i.axis!==r.axis||i.dir===r.dir||Math.abs(i.at-r.at)>X0)continue;const o=Math.min(i.hi,r.hi)-Math.max(i.lo,r.lo);o>=K0&&(!n||o>n.length)&&(n={axis:i.axis,length:o})}return n}function Yc(e,t){let n=0;for(const i of t)i.id!==e.id&&qc(e,i)&&n++;return n}const Z0=1,Q0=(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 J0(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 ex(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 tx=(e,t)=>e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height;function Qi(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(J0(e.waypoints[o],e.waypoints[o+1],r,Y0)){i.push(r);break}}return i}function nx(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 ix=(e,t)=>e.endpoints.some(n=>t.endpoints.includes(n));function Sr(e,t){let n=0;for(const i of t){if(i.id===e.id||ix(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++)nx(e.waypoints[o],e.waypoints[o+1],i.waypoints[a],i.waypoints[a+1])&&(r=!0);r&&n++}return n}function Kc(e){const t=[],n=e.edges;for(let i=0;i<n.length;i++)for(let r=i+1;r<n.length;r++)if(Sr(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 ba=e=>e.shapes.filter(t=>!t.container);function Rr(e){const t=[],n=e.shapes.filter(o=>!o.container);for(const o of e.edges)for(const a of Qi(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(!ex(s,c,q0))continue;const u=s.id<c.id?[s.id,c.id]:[c.id,s.id];t.push({kind:"shape-overlap",shapes:u,identical:tx(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=qc(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)})}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||Q0(a,o,Z0)||t.push({kind:"shape-outside-container",shape:o.id,container:a.id})}return t.sort((o,a)=>Zi(o).localeCompare(Zi(a)))}const It=e=>typeof e=="object"&&e!==null?e:void 0,Mn=e=>typeof e=="number"?e:0,Ji=e=>{const t=It(e);return typeof(t==null?void 0:t.id)=="string"?t.id:void 0};function rx(e){const t=It(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=Ji(o);a&&n.push(a)}}return n}function ox(e,t){const n=It(e.$parent);if(!n)return;const i=typeof n.$type=="string"?n.$type:"";if(i==="bpmn:Process"){const r=Ji(n);return r?t.get(r):void 0}if(_a.has(i)&&i!=="bpmn:Lane"&&i!=="bpmn:Group")return Ji(n)}function _f(e){var o,a,s;const t=[],n=[],i=((o=It(e))==null?void 0:o.diagrams)??[],r=new Map;for(const c of((a=It(e))==null?void 0:a.rootElements)??[]){const u=It(c);if((u==null?void 0:u.$type)==="bpmn:Collaboration")for(const l of u.participants??[]){const p=It(l),f=Ji(p),d=Ji(p==null?void 0:p.processRef);f&&d&&r.set(d,f)}}for(const c of i){const u=It((s=It(c))==null?void 0:s.plane),l=(u==null?void 0:u.planeElement)??[];for(const p of l){const f=It(p);if(!f)continue;const d=It(f.bpmnElement),h=typeof(d==null?void 0:d.id)=="string"?d.id:void 0;if(!h)continue;const m=typeof(d==null?void 0:d.$type)=="string"?d.$type:"",g=It(f.bounds);if(g){const E=f.isExpanded===!1;t.push({id:h,type:m,x:Mn(g.x),y:Mn(g.y),width:Mn(g.width),height:Mn(g.height),container:_a.has(m)&&!E,attached:(d==null?void 0:d.attachedToRef)!==void 0,...d?{parent:ox(d,r)}:{}});continue}const w=f.waypoint;Array.isArray(w)&&n.push({id:h,type:m,waypoints:w.map(E=>{var b,x;return{x:Mn((b=It(E))==null?void 0:b.x),y:Mn((x=It(E))==null?void 0:x.y)}}),endpoints:rx(d)})}}return{shapes:t,edges:n}}function bf(e){return Rr(_f(e))}async function ax(e){const{definitions:t,warnings:n}=await Wc(e);return{findings:bf(t),warnings:n}}function vi(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(p=>({x:Mn(p.x),y:Mn(p.y)})),endpoints:[Ji(r.source),Ji(r.target)].filter(p=>!!p)});continue}if(typeof r.x!="number"||typeof r.y!="number")continue;const s=It(r.businessObject);let c=It(r.parent);for(;c&&c.type==="bpmn:Lane";)c=It(c.parent);const u=typeof(c==null?void 0:c.type)=="string"?c.type:"",l=c&&_a.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:Mn(r.width),height:Mn(r.height),container:_a.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 sx={"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 cx(e,t){const n=sx[e];return n||(e==="label"||e.startsWith("bpmndi:")?"other":e.startsWith("bpmn:")&&!("waypoints"in t&&t.waypoints)?"flowNode":"other")}function xf(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 cx(i.type,i)},lanesOf:n=>t().filter(i=>i.type==="bpmn:Lane"&&xf(i)===n).sort((i,r)=>i.y-r.y).map(i=>i.id),participantOf:n=>{const i=e.get(n);return i?xf(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 wf=20,ux=4,Ht=(e,t)=>Math.abs(e-t)<.5;function Sf(e,t,n,i=wf){if(Ht(e.y,t.y)&&!Ht(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(Ht(e.x,t.x)&&!Ht(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 Rf(e,t,n=wf){if(e.length!==4)return null;const[i,r,o,a]=e;if(Ht(i.y,r.y)&&Ht(r.x,o.x)&&Ht(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(Ht(i.x,r.x)&&Ht(r.y,o.y)&&Ht(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 lx=(e,t,n)=>[...e.slice(0,t+1),...n,...e.slice(t+1)],Cf=(e,t,n)=>Qi({...e,waypoints:t},n).length;function Pf(e,t,n){let i=[...e.waypoints],r=Cf(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<ux&&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)||Qi({...e,waypoints:[l,p]},[f]).length===0)continue;const d=Sf(l,p,f),h=d?d.map(g=>lx(i,u,g)):Rf(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=Cf(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 Af(e,t){const{elementRegistry:n}=e,i=e.modeling,r=vi(n),o=ba(r),a=Rr(r).filter(c=>c.kind==="edge-crosses-shape"&&!t.has(Zi(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=Pf(u,o,f);d&&i.updateWaypoints(l,d)}}const px=10;function Tf(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 Mf(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=Tf(i,n),a=Tf(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,te)=>F.y-te.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=ba(t),x=t.edges.filter(F=>F.id!==e.id),S=Sr(e,x),A=Qi(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((te,ke)=>ke===0||!(Ht(te.x,F[ke-1].x)&&Ht(te.y,F[ke-1].y)));let L;for(let F=I;F<=C;F+=px){const te=j([w,{x:w.x,y:m},{x:F,y:m},{x:F,y:g},{x:E.x,y:g},E]),ke={...e,waypoints:te};if(Qi(ke,b).length>0)continue;const Je=Sr(ke,x),q=Math.abs(F-$);(!L||Je<L.cross||Je===L.cross&&q<L.detour)&&(L={pts:te,cross:Je,detour:q})}return L&&(A>0?L.cross<=S:L.cross<S)?L.pts:null}function kf(e,t){const{elementRegistry:n}=e,i=e.modeling,r=vi(n);for(const o of r.edges){if(o.type!=="bpmn:MessageFlow"||t.has(o.id))continue;const a=vi(n),s=a.edges.find(l=>l.id===o.id);if(!s)continue;const c=Mf(s,a);if(!c)continue;const u=n.get(o.id);u&&i.updateWaypoints(u,c)}}const fx=[25,-25,40,-40],Df=35;function dx(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-Df:n.y+n.height+Df;return[u,[{x:a,y:l},{x:a,y:p},{x:o,y:p},{x:o,y:c}]]}function hx(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=Ht(n[0].x,n[1].x)&&!Ht(n[0].y,n[1].y),s=Ht(n[n.length-1].x,n[n.length-2].x)&&!Ht(n[n.length-1].y,n[n.length-2].y);for(const c of fx){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 Of(e,t){const n=new Map(t.shapes.map(u=>[u.id,u])),i=ba(t),r=t.edges.filter(u=>u.id!==e.id),o=Yc(e,r);if(o===0)return null;const a=Sr(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[...dx(e,n),...hx(e,n)]){const l={...e,waypoints:u};if(Qi(l,i).length>0)continue;const p=Yc(l,r),f=Sr(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 If(e,t,n){const{elementRegistry:i}=e,r=e.modeling,o=vi(i),a=Rr(o).filter(c=>c.kind==="edge-overlap-opposite"&&!t.has(Zi(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=vi(i),l=u.edges.find(d=>d.id===c);if(!l)continue;const p=Of(l,u);if(!p)continue;const f=i.get(c);f&&r.updateWaypoints(f,p)}}const mx=/^[\p{L}_][\p{L}\p{N}_.\-]*$/u,Lf=new Set(["sequenceFlow","messageFlow","dataAssociation","association"]),Bf={"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}]},xa=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),Xc=e=>typeof e=="string"&&e!=="";function gx(e){const t=[];function n(i,r,o,a){if(a===null){Xc(o)||t.push({kind:"payload-invalid",opIndex:i,field:r});return}if(!xa(o)){t.push({kind:"payload-invalid",opIndex:i,field:r});return}for(const s of a)Xc(o[s])||t.push({kind:"payload-invalid",opIndex:i,field:`${r}.${s}`})}return e.forEach((i,r)=>{if(!xa(i)||!Xc(i.kind)||!(i.kind in Bf)){t.push({kind:"payload-invalid",opIndex:r,field:"kind"});return}for(const o of Bf[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(!xa(u))break;u=u[p]}if(!xa(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 Nf(e,t){const n=gx(e);if(n.length>0)return n;const i=[],r=new Map,o=new Map;function a(f,d,h){if(!mx.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&&Lf.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&&Lf.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 $f(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 Ea(e){return`bpmn:${e[0].toUpperCase()}${e.slice(1)}`}const jf={"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 St(e,t){return e.filter(n=>n.kind===t)}function Ff(e,t){var tt,Ne,ft,Tt;const{modeling:n,bpmnFactory:i,elementFactory:r,elementRegistry:o,canvas:a,autoPlace:s,bpmnReplace:c}=t,u=()=>a.getRootElement(),l=T=>o.get(T),p=T=>{const D=l(T);if(!D)throw new Error(`하강 참조 해소 실패: ${T}`);return D},f=T=>{let D=T.parent;for(;D;){if(D.type==="bpmn:Participant")return D;D=D.parent}},d=St(e,"participant.add"),h=St(e,"node.add"),m=St(e,"sequenceFlow.add"),g=St(e,"messageFlow.add"),w=St(e,"dataStore.add"),E=St(e,"dataAssociation.add"),b=St(e,"annotation.add"),x=St(e,"group.add"),S=new Map(h.map(T=>[T.node.id,T])),A=(T,D,H)=>{var Ve;const Q=T.businessObject,le=(((Ve=Q.extensionElements)==null?void 0:Ve.values)??[]).filter(we=>we.$type!==D),re=H?[...le,i.create(D,H)]:le;if(!re.length){Q.extensionElements&&n.updateProperties(T,{extensionElements:void 0});return}const he=i.create("bpmn:ExtensionElements",{values:re});re.forEach(we=>{we.$parent=he}),n.updateProperties(T,{extensionElements:he})},I=T=>({anchor:T.anchor,side:T.side,...T.offset!==void 0?{offset:T.offset}:{}});for(const T of St(e,"element.remove")){const D=l(T.id);D&&n.removeElements([D])}const C=T=>o.filter(D=>{var H;return D.type==="bpmn:Lane"&&((H=f(D))==null?void 0:H.id)===T}).sort((D,H)=>D.y-H.y);for(const T of St(e,"participant.update")){const D=p(T.id);if(T.name!==void 0&&n.updateProperties(D,{name:T.name??void 0}),!T.lanes)continue;const H=C(T.id);if(!H.length){n.splitLane(D,T.lanes.length),C(T.id).forEach((le,re)=>{const he=T.lanes[re];he&&n.updateProperties(le,{id:he.id,name:he.name})});continue}const Q=new Set(H.map(le=>le.id));T.lanes.forEach((le,re)=>{if(Q.has(le.id)){n.updateProperties(p(le.id),{name:le.name});return}const he=re===0?n.addLane(C(T.id)[0],"top"):n.addLane(p(T.lanes[re-1].id),"bottom");n.updateProperties(he,{id:le.id,name:le.name})})}const $=150,j=80,L=90,F=180,te=new Set;for(const T of d){te.add(`pool:${T.participant.id}`);for(const D of T.participant.lanes??[])te.add(D.id)}const ke=new Map;for(const T of h){const D=T.node.lane??`pool:${T.node.participant??""}`;let H=ke.get(D);H||ke.set(D,H=new Set([0])),T.band!==void 0&&H.add(T.band)}const Je=new Map;for(const[T,D]of ke){if(!te.has(T))continue;const H=[...D].sort((re,he)=>re-he),Q=H.map((re,he)=>he===0?0:he%2===1?Math.ceil(he/2):-(he/2)),le=Math.min(...Q);Je.set(T,new Map(H.map((re,he)=>[re,Q[he]-le])))}const q=T=>{var D;return(((D=ke.get(T))==null?void 0:D.size)??0)>1},ne=T=>T.band??(T.node.lane||!q(`pool:${T.node.participant??""}`)?void 0:0),ce=(T,D)=>{var H;return((H=Je.get(T))==null?void 0:H.get(D))??D},ee=new Map;for(const[T,D]of ke){let H=0;for(const Q of D)H=Math.max(H,ce(T,Q));ee.set(T,H)}const ae=T=>F+$*T,Y=d.map((T,D)=>({op:T,declared:D}));Y.sort((T,D)=>{const H=T.op.order??Number.POSITIVE_INFINITY,Q=D.op.order??Number.POSITIVE_INFINITY;return H!==Q?H-Q:T.declared-D.declared});let B=80;for(const T of o.getAll())T.parent===u()&&"height"in T&&typeof T.y=="number"&&(B=Math.max(B,T.y+T.height+60));for(const{op:T}of Y){const D=T.participant,H=h.filter(be=>be.node.participant===D.id).length,Q=((tt=D.lanes)==null?void 0:tt.length)??0,le=Math.max(1200,H*160+300),re=(D.lanes??[]).map(be=>ae(ee.get(be.id)??0)),he=re.reduce((be,se)=>be+se,0);Q&&he<300&&(re[Q-1]+=300-he);const Ve=Math.max(300,$*((ee.get(`pool:${D.id}`)??0)+1)),we=D.blackBox||H+Q===0?120:Q?Math.max(300,he):Ve,Ue=r.createShape({type:"bpmn:Participant",businessObject:i.create("bpmn:Participant",{id:D.id,name:D.name,...T.order!==void 0?{"bwl:poolOrder":T.order}:{},...D.blackBox?{}:{processRef:i.create("bpmn:Process")}}),width:le,height:we,isExpanded:!0}),$t=n.createShape(Ue,{x:100+le/2,y:B+we/2},u()),dt=D.lanes??[];if(dt.length&&n.splitLane($t,dt.length),dt.length){const be=o.filter(se=>{var Mt;return se.type==="bpmn:Lane"&&((Mt=f(se))==null?void 0:Mt.id)===D.id}).sort((se,Mt)=>se.y-Mt.y);if(be.forEach((se,Mt)=>{const on=dt[Mt];on&&n.updateProperties(se,{id:on.id,name:on.name})}),re.some(se=>se!==$t.height/Q)){let se=$t.y;be.forEach((Mt,on)=>{const wn=re[on];n.resizeShape(Mt,{x:Mt.x,y:se,width:Mt.width,height:wn}),se+=wn})}}B=$t.y+$t.height+60}const N=T=>{var Q;const D=S.get(T);if(D)return D.node.participant??"";const H=l(T);return H?H.type==="bpmn:Participant"?H.id:((Q=f(H))==null?void 0:Q.id)??"":""},V=new Map,Ee=T=>{let D=V.get(T);return D||V.set(T,D={nodes:[],flows:[]}),D};for(const T of h)Ee(T.node.participant??"").nodes.push(T);for(const T of m)Ee(N(T.flow.source)).flows.push(T);const _t=T=>{var D;return i.create("bpmn:SequenceFlow",{id:T.id,name:T.name??((D=T.condition)==null?void 0:D.label)})},R=(T,D)=>r.createShape({type:Ea(T.type),businessObject:i.create(Ea(T.type),{id:T.id,name:T.name,...D!==void 0?{"bwl:band":D}:{}})}),_=[...Y.map(({op:T})=>T.participant.id).filter(T=>V.has(T)),...[...V.keys()].filter(T=>!d.some(D=>D.participant.id===T))],v=200;for(const T of _){const D=V.get(T),H=T?p(T):void 0;if(H&&d.some(Ae=>Ae.participant.id===T)){const Ae=new Set(D.flows.map(Le=>Le.flow.target)),Te=D.nodes.filter(Le=>!Ae.has(Le.node.id)).map(Le=>Le.node.id),Be=g.find(Le=>Te.includes(Le.flow.target)&&l(Le.flow.source));if(Be){const Le=l(Be.flow.source),Ge=Le.x+Le.width/2-(H.x+150);Ge>=v&&n.moveElements([H],{x:Ge,y:0})}}const Q=H?H.x+150:250;let le=H?H.y+80:120;const re=(Ae,Te,Be)=>{const Le=u().children.filter(rt=>!("waypoints"in rt&&rt.waypoints)&&rt.id!==Te&&typeof rt.y=="number"&&rt.y>=Ae);Le.length&&n.moveElements(Le,{x:0,y:Be})},he=(Ae,Te)=>{if(Ae){const Ge=p(Ae),nt=ae(Te);if(Ge.height>=nt)return;const li=nt-Ge.height,jt=f(Ge),pi=jt?jt.y+jt.height:Ge.y+Ge.height;n.resizeLane(Ge,{x:Ge.x,y:Ge.y,width:Ge.width,height:nt},!1),re(pi,jt==null?void 0:jt.id,li);return}if(!H)return;const Be=$*(Te+1);if(H.height>=Be)return;const Le=Be-H.height,rt=H.y+H.height;n.resizeShape(H,{x:H.x,y:H.y,width:H.width,height:Be}),re(rt,H.id,Le)},Ve=(Ae,Te,Be)=>{if(Ae){const Le=p(Ae);return Le.y+Math.min(Le.height/2,L)+ce(Ae,Te??0)*$}return Te!==void 0&&H?H.y+j+ce(`pool:${T}`,Te)*$:Be},we=(Ae,Te,Be)=>{if(Ae){const Le=p(Ae);return Le.y+Math.min(Le.height/2,L)+Te*$}return H?H.y+j+Te*$:Be},Ue=Ae=>Ae.participant?p(Ae.participant):u(),$t=30,dt=(Ae,Te,Be,Le)=>{const rt=Be-Te.width/2,Ge=Le-Te.height/2;return(Ae.children??[]).find(nt=>!("waypoints"in nt&&nt.waypoints)&&nt.type!=="bpmn:Lane"&&nt.type!=="label"&&typeof nt.x=="number"&&rt<nt.x+nt.width+$t&&rt+Te.width+$t>nt.x&&Ge<nt.y+nt.height&&Ge+Te.height>nt.y)},be=(Ae,Te,Be,Le,rt,Ge)=>{const nt=Be!==void 0||Le!==void 0,li=ce(Be??`pool:${T}`,Le??0);if(nt)for(let Wn=0;Wn<4;Wn++){const fi=we(Be,li+Wn,Ge);if(!dt(Ae,Te,rt,fi))return he(Be,li+Wn),{x:rt,y:fi}}const jt=Ve(Be,Le,Ge);nt&&he(Be,li);let pi=rt;for(let Wn=0;Wn<64;Wn++){const fi=dt(Ae,Te,pi,jt);if(!fi)break;pi=fi.x+fi.width+130+Te.width/2}return{x:pi,y:jt}},se=new Set(D.flows.map(Ae=>Ae.flow.target)),Mt=new Map;for(const Ae of D.nodes){if(se.has(Ae.node.id))continue;const Te=R(Ae.node,Ae.band),Be=ne(Ae),Le=Ae.node.lane?`${Ae.node.lane}|${Be??""}`:Be!==void 0?`band:${Be}`:"",rt=Ue(Ae.node),Ge=be(rt,Te,Ae.node.lane,Be,Mt.get(Le)??Q,le);n.createShape(Te,Ge,rt),Mt.set(Le,Ge.x+Te.width+130),!Ae.node.lane&&Be===void 0&&(le+=160)}const on=new Set;let wn=0;for(;wn++<D.nodes.length+2;){for(let Be=0;Be<D.nodes.length+D.flows.length+2;Be++){let Le=!1;for(const rt of D.flows){const Ge=rt.flow;if(on.has(Ge.id))continue;const nt=l(Ge.source);if(!nt)continue;const li=l(Ge.target),jt=S.get(Ge.target);if(!li&&jt){const pi=R(jt.node,jt.band),Wn=ne(jt);if(jt.node.lane||Wn!==void 0){const fi=Ue(jt.node),Z_=nt,uk=be(fi,pi,jt.node.lane,Wn,Z_.x+Z_.width+130,Number.NaN),lk=n.createShape(pi,uk,fi);n.connect(nt,lk,{type:"bpmn:SequenceFlow",businessObject:_t(Ge)})}else s.append(nt,pi,{connection:{type:"bpmn:SequenceFlow",businessObject:_t(Ge)}})}else if(li)n.connect(nt,li,{type:"bpmn:SequenceFlow",businessObject:_t(Ge)});else continue;on.add(Ge.id),Le=!0}if(!Le)break}const Ae=D.nodes.filter(Be=>!l(Be.node.id));if(!Ae.length)break;const Te=Ae[0];{const Be=R(Te.node,Te.band),Le=Ue(Te.node),rt=ne(Te);n.createShape(Be,be(Le,Be,Te.node.lane,rt,Q,le),Le),!Te.node.lane&&rt===void 0&&(le+=160)}}}const M=40;for(const T of St(e,"sequenceFlow.update")){if(T.target===void 0)continue;const D=S.get(T.target);if(!D)continue;const H=l(T.target),Q=l(T.id);if(!H||!Q)continue;const le=T.source!==void 0?l(T.source):Q.source,re=Q.target;if(!le||!re||re.id===H.id)continue;const he=[H],Ve=new Set([T.target]);for(let se=0;se<he.length;se++){const Mt=he[se].id;for(const on of m){const wn=on.flow.target;if(on.flow.source!==Mt||Ve.has(wn)||!S.has(wn))continue;Ve.add(wn);const Ae=l(wn);Ae&&he.push(Ae)}}const we=Math.min(...he.map(se=>se.x)),Ue=Math.max(...he.map(se=>se.x+se.width)),$t=le.x+le.width,dt=Ue-we+M*2-(re.x-$t);if(dt>0){const se=f(H),Mt=(se==null?void 0:se.children)??[],on=Te=>Te.type==="bpmn:Lane",wn=Mt.filter(Te=>!("waypoints"in Te&&Te.waypoints)&&!on(Te)&&!Ve.has(Te.id)&&Te.x>=re.x),Ae=se?[se,...Mt.filter(Te=>on(Te))]:[];wn.length&&n.createSpace(wn,Ae,{x:dt,y:0},"e",re.x-1)}const be=D.node.lane||D.band!==void 0?H.y+H.height/2:le.y+le.height/2;n.moveElements(he,{x:$t+M-we,y:be-(H.y+H.height/2)})}const O=(T,D)=>{const H=D.target===T,Q=p(D.source),le=p(D.target),re=H?"bpmn:DataOutputAssociation":"bpmn:DataInputAssociation";n.connect(Q,le,D.id?{type:re,businessObject:i.create(re,{id:D.id})}:{type:re})};for(const T of w){const D=T.associations??[],H=D.map(re=>re.source===T.dataStore.id?re.target:re.source).map(l).find(Boolean),Q=H?f(H)??u():u(),le=H?{x:H.x+H.width/2,y:H.y+H.height+110}:{x:200,y:B+60};n.createShape({type:"bpmn:DataStoreReference",businessObject:i.create("bpmn:DataStoreReference",{id:T.dataStore.id,name:T.dataStore.name})},le,Q);for(const re of D)O(T.dataStore.id,re)}for(const T of E){const H=p(T.association.target).type==="bpmn:DataStoreReference"?T.association.target:T.association.source;O(H,T.association)}for(const T of g){const D=T.flow;n.connect(p(D.source),p(D.target),{type:"bpmn:MessageFlow",businessObject:i.create("bpmn:MessageFlow",{id:D.id,name:D.name})})}let z=0;for(const T of x){const D=(T.group.members??[]).map(l).filter(re=>!!re),H=40;let Q;if(D.length){const re=Math.min(...D.map(Ue=>Ue.x))-H,he=Math.min(...D.map(Ue=>Ue.y))-H,Ve=Math.max(...D.map(Ue=>Ue.x+Ue.width))+H,we=Math.max(...D.map(Ue=>Ue.y+Ue.height))+H;Q={x:re,y:he,width:Ve-re,height:we-he}}else Q={x:300+z*350,y:40,width:300,height:200},z++;const le=n.createShape({type:"bpmn:Group",businessObject:i.create("bpmn:Group",{id:T.group.id}),width:Q.width,height:Q.height},{x:Q.x+Q.width/2,y:Q.y+Q.height/2},u());T.group.name&&n.updateLabel(le,T.group.name),(Ne=T.group.members)!=null&&Ne.length&&A(le,"bwl:Members",{refs:T.group.members.join(" ")})}const J=T=>{const D=T.waypoints;if(D!=null&&D.length){const Q=D[Math.floor((D.length-1)/2)];return{x:Q.x,y:Q.y,width:0,height:0}}const H=T;return{x:H.x,y:H.y,width:H.width,height:H.height}};let ge=0;const Ie={width:100,height:30};for(const T of b){const D=T.association,H=((ft=T.placement)==null?void 0:ft.anchor)??(D?D.source===T.annotation.id?D.target:D.source:void 0),Q=H?l(H):void 0,le=Q?J(Q):void 0;let re;if(le&&T.placement){const[we,Ue]=jf[T.placement.side],$t=T.placement.offset??50;re={x:le.x+le.width/2+we*(le.width/2+Ie.width/2+$t),y:le.y+le.height/2+Ue*(le.height/2+Ie.height/2+$t)}}else le?(re={x:le.x+le.width/2+180+ge%3*260,y:le.y-110-ge%2*95},ge++):(re={x:300+ge*260,y:60},ge++);const he=Q?f(Q)??u():u(),Ve=n.createShape({type:"bpmn:TextAnnotation",businessObject:i.create("bpmn:TextAnnotation",{id:T.annotation.id,text:T.annotation.text})},re,he);if(D){const we=Ue=>Ue===T.annotation.id?Ve:p(Ue);n.connect(we(D.source),we(D.target),D.id?{type:"bpmn:Association",businessObject:i.create("bpmn:Association",{id:D.id})}:{type:"bpmn:Association"})}T.placement&&A(Ve,"bwl:Placement",I(T.placement))}for(const T of St(e,"association.add")){const D=T.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 T of St(e,"node.update")){let D=p(T.id);if(T.type&&Ea(T.type)!==D.type&&(D=c.replaceElement(D,{type:Ea(T.type)})),T.name!==void 0&&n.updateProperties(D,{name:T.name??void 0}),T.lane){const H=p(T.lane),Q=H.y+H.height/2-(D.y+D.height/2);Q!==0&&n.moveElements([D],{x:0,y:Q})}}for(const T of St(e,"sequenceFlow.update")){const D=p(T.id);if(T.source!==void 0||T.target!==void 0){const H=D,Q=T.source!==void 0?p(T.source):H.source,le=T.target!==void 0?p(T.target):H.target,re=he=>({x:he.x+he.width/2,y:he.y+he.height/2});n.reconnect(H,Q,le,[re(Q),re(le)])}T.name!==void 0&&n.updateProperties(D,{name:T.name??void 0}),T.condition!==void 0&&n.updateProperties(D,{name:((Tt=T.condition)==null?void 0:Tt.label)??void 0})}for(const T of St(e,"messageFlow.update"))T.name!==void 0&&n.updateProperties(p(T.id),{name:T.name??void 0});for(const T of St(e,"dataStore.update"))T.name!==void 0&&n.updateProperties(p(T.id),{name:T.name??void 0});for(const T of St(e,"annotation.update")){const D=p(T.id);if(T.text!==void 0&&n.updateProperties(D,{text:T.text}),T.placement===null)A(D,"bwl:Placement",null);else if(T.placement){const H=J(p(T.placement.anchor)),[Q,le]=jf[T.placement.side],re=T.placement.offset??50,he=H.x+H.width/2+Q*(H.width/2+D.width/2+re),Ve=H.y+H.height/2+le*(H.height/2+D.height/2+re);n.moveElements([D],{x:he-(D.x+D.width/2),y:Ve-(D.y+D.height/2)}),A(D,"bwl:Placement",I(T.placement))}}for(const T of St(e,"group.update")){const D=p(T.id);if(T.name!==void 0&&n.updateLabel(D,T.name??""),T.members){const H=T.members.map(l).filter(Q=>!!Q);if(H.length){const le=Math.min(...H.map(we=>we.x))-40,re=Math.min(...H.map(we=>we.y))-40,he=Math.max(...H.map(we=>we.x+we.width))+40,Ve=Math.max(...H.map(we=>we.y+we.height))+40;n.resizeShape(D,{x:le,y:re,width:he-le,height:Ve-re})}A(D,"bwl:Members",{refs:T.members.join(" ")})}}}function Hf(e,t,n=Ff){const i=$f(e),r=Nf(t,Ef(i.elementRegistry)),o={edgeCrossings:{before:0,after:0}};if(r.length)return{ok:!1,issues:r,findings:[],stats:o};const a=vi(i.elementRegistry),s=new Set(Rr(a).map(Zi)),c=new Set(a.edges.map(d=>d.id)),u=Kc(a).length,l=e.get("commandStack");try{Wp(l,()=>{n(t,i),kf(i,c),Af(i,s),If(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=vi(i.elementRegistry),f=Rr(p).filter(d=>!s.has(Zi(d)));return{ok:!0,issues:[],findings:f,stats:{edgeCrossings:{before:u,after:Kc(p).length}}}}function vx(e){const t=e.slice(e.indexOf(":")+1);return t.charAt(0).toLowerCase()+t.slice(1)}function yx(e,t){return typeof e.get=="function"?e.get(t):e[t]}function zf(e,t){const n=yx(e,t);return typeof n=="number"&&Number.isFinite(n)?n:void 0}function Vf(e,t){var i;return(((i=e.extensionElements)==null?void 0:i.values)??[]).find(r=>(r==null?void 0:r.$type)===t)}function _x(e){return typeof e=="string"&&Ac.includes(e)}function kn(e){if(typeof e=="string")return e;const t=e==null?void 0:e.id;return typeof t=="string"?t:void 0}function Gf(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 ne=Vf(q,"bwl:Placement");if(!ne)return;const ce=typeof ne.anchor=="string"?ne.anchor:void 0;if(!ce||!_x(ne.side))return;const ee=typeof ne.offset=="number"?ne.offset:void 0;m.push({owner:q.id,anchor:ce,side:ne.side,...ee!==void 0?{offset:ee}:{}})},A=q=>{const ne=Vf(q,"bwl:Members"),ce=typeof(ne==null?void 0:ne.refs)=="string"?ne.refs.split(/\s+/).filter(Boolean):[];ce.length&&g.push({owner:q.id,refs:ce})},I=q=>{var ne;for(const ce of q)switch(b(ce.id),ce.$type){case"bpmn:TextAnnotation":x(ce.id),s.push({id:ce.id,text:typeof ce.text=="string"?ce.text:""}),S(ce);break;case"bpmn:Association":d.push({id:ce.id,type:ce.$type,source:kn(ce.sourceRef),target:kn(ce.targetRef)});break;case"bpmn:Group":{x(ce.id);const ee=(ne=ce.categoryValueRef)==null?void 0:ne.value;c.push({id:ce.id,...typeof ee=="string"&&ee?{name:ee}:{}}),A(ce);break}default:u.push({id:ce.id,type:ce.$type,reason:"type-outside-mvp"})}},C=(q,ne)=>{const ce=q.flowElements??[],ee=(q.laneSets??[]).flatMap(Y=>Y.lanes??[]),ae=new Map;for(const Y of ee){b(Y.id);for(const B of Y.flowNodeRef??[]){const N=kn(B);N&&ae.set(N,Y.id)}}for(const Y of ce){if(b(Y.id),Y.$type==="bpmn:SequenceFlow"){p.push({id:Y.id,source:kn(Y.sourceRef),target:kn(Y.targetRef),...typeof Y.name=="string"&&Y.name?{name:Y.name}:{}});continue}if(Y.$type==="bpmn:DataStoreReference"){x(Y.id),a.push({id:Y.id,...Y.name?{name:Y.name}:{}});continue}const B=vx(Y.$type);if(!Hp(B)){u.push({id:Y.id,type:Y.$type,reason:"type-outside-mvp"});continue}x(Y.id),o.push({id:Y.id,type:B,...Y.name?{name:Y.name}:{},...ne?{participant:ne}:{},...ae.has(Y.id)?{lane:ae.get(Y.id)}:{}});const N=zf(Y,"bwl:band");N!==void 0&&(l.bands[Y.id]=N);for(const V of Y.dataOutputAssociations??[])b(V.id),h.push({id:V.id,type:V.$type,source:Y.id,target:kn(V.targetRef)});for(const V of Y.dataInputAssociations??[])b(V.id),h.push({id:V.id,type:V.$type,source:kn((V.sourceRef??[])[0]),target:Y.id})}I(q.artifacts??[])};if(n){const q=new Set;for(const ne of n.participants??[]){x(ne.id);const ce=kn(ne.processRef);ce&&q.add(ce);const ee=ce?i.get(ce):void 0,ae=((ee==null?void 0:ee.laneSets)??[]).flatMap(V=>V.lanes??[]),Y=ae.map(V=>({id:V.id,...V.name?{name:V.name}:{}}));for(const V of Y)x(V.id);const B=!ee||(ee.flowElements??[]).length===0&&ae.length===0&&(ee.artifacts??[]).length===0;r.push({id:ne.id,...ne.name?{name:ne.name}:{},...B?{blackBox:!0}:{},...Y.length?{lanes:Y}:{}});const N=zf(ne,"bwl:poolOrder");N!==void 0&&(l.poolOrders[ne.id]=N),ee&&C(ee,ne.id)}for(const ne of n.messageFlows??[])b(ne.id),f.push({id:ne.id,source:kn(ne.sourceRef),target:kn(ne.targetRef),...typeof ne.name=="string"&&ne.name?{name:ne.name}:{}});I(n.artifacts??[]);for(const[ne,ce]of i)!q.has(ne)&&(ce.flowElements??[]).length>0&&u.push({id:ne,type:ce.$type,reason:"unreachable-process"})}else for(const q of i.values())C(q);const $=[],j=[],L=[],F=[],te=(q,ne)=>!!q&&!!ne&&E.has(q)&&E.has(ne);for(const q of p){if(!te(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(!te(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(!te(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(!te(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 ke=new Map(c.map(q=>[q.id,q]));for(const{owner:q,refs:ne}of g){const ce=ne.filter(ae=>w.has(ae)),ee=ke.get(q);ee&&ce.length&&(ee.members=ce)}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 bx(e){const{definitions:t,warnings:n}=await Wc(e);return{...Gf(t),warnings:n}}function xx(e,t,n,i={}){return{documentId:e,baseVersion:t,ops:[...n],origin:i.origin??"agent",clientOpId:(i.mkClientOpId??(()=>crypto.randomUUID()))()}}async function Wf(e,t,{currentVersion:n}){if(t.baseVersion!==n)return{status:"conflict",baseVersion:t.baseVersion,currentVersion:n};const i=Hf(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 Ex=Symbol("bpmn-editor");function wx(){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 Wf(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:Uc(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 Sx(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Zc={exports:{}},Uf;function Rx(){if(Uf)return Zc.exports;Uf=1;var e=Zc.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},Zc.exports}var Cx=Rx(),Px=Sx(Cx);function Dn(e){if(!(this instanceof Dn))return new Dn(e);e=e||[128,36,1],this._seed=e.length?Px.rack(e[0],e[1],e[2]):e}Dn.prototype.next=function(e){return this._seed(e||!0)},Dn.prototype.nextPrefixed=function(e,t){var n;do n=e+this.next(!0);while(this.assigned(n));return this.claim(n,t),n},Dn.prototype.claim=function(e,t){this._seed.set(e,t||!0)},Dn.prototype.assigned=function(e){return this._seed.get(e)||!1},Dn.prototype.unclaim=function(e){delete this._seed.hats[e]},Dn.prototype.clear=function(){var e=this._seed.hats,t;for(t in e)this.unclaim(t)};const mt={legend:[1,"<fieldset>","</fieldset>"],tr:[2,"<table><tbody>","</tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],_default:[0,"",""]};mt.td=mt.th=[3,"<table><tbody><tr>","</tr></tbody></table>"],mt.option=mt.optgroup=[1,'<select multiple="multiple">',"</select>"],mt.thead=mt.tbody=mt.colgroup=mt.caption=mt.tfoot=[1,"<table>","</table>"],mt.polyline=mt.ellipse=mt.polygon=mt.circle=mt.text=mt.line=mt.path=mt.rect=mt.g=[1,'<svg xmlns="http://www.w3.org/2000/svg" version="1.1">',"</svg>"];function We(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(mt,i)?mt[i]:mt._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 Ax(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 zt(e,...t){const n=e.style;return P(t,function(i){i&&P(i,function(r,o){n[o]=r})}),e}function Lt(e,t,n){return arguments.length==2?e.getAttribute(t):n===null?e.removeAttribute(t):(e.setAttribute(t,n),e)}const Tx=Object.prototype.toString;function Ye(e){return new yi(e)}function yi(e){if(!e||!e.nodeType)throw new Error("A DOM element reference is required");this.el=e,this.list=e.classList}yi.prototype.add=function(e){return this.list.add(e),this},yi.prototype.remove=function(e){return Tx.call(e)=="[object RegExp]"?this.removeMatching(e):(this.list.remove(e),this)},yi.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},yi.prototype.toggle=function(e,t){return typeof t<"u"?t!==this.list.toggle(e,t)&&this.list.toggle(e):this.list.toggle(e),this},yi.prototype.array=function(){return Array.from(this.list)},yi.prototype.has=yi.prototype.contains=function(e){return this.list.contains(e)};function wa(e){for(var t;t=e.firstChild;)e.removeChild(t);return e}function er(e,t,n){var i=n?e:e.parentNode;return i&&typeof i.closest=="function"&&i.closest(t)||null}function Mx(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Sa={},qf;function kx(){if(qf)return Sa;qf=1;var e,t,n;function i(){e=window.addEventListener?"addEventListener":"attachEvent",t=window.removeEventListener?"removeEventListener":"detachEvent",n=e!=="addEventListener"?"on":""}return Sa.bind=function(r,o,a,s){return e||i(),r[e](n+o,a,s||!1),a},Sa.unbind=function(r,o,a,s){return t||i(),r[t](n+o,a,s||!1),a},Sa}var Yf=kx(),Dx=Mx(Yf),ve=Ax({__proto__:null,default:Dx},[Yf]),Kf=["focus","blur"];function Ox(e,t,n,i,r){return Kf.indexOf(n)!==-1&&(r=!0),ve.bind(e,n,function(o){var a=o.target||o.srcElement;o.delegateTarget=er(a,t,!0),o.delegateTarget&&i.call(e,o)},r)}function Ix(e,t,n,i){return Kf.indexOf(t)!==-1&&(i=!0),ve.unbind(e,t,n,i)}var Xt={bind:Ox,unbind:Ix};function Qc(e,t){return e&&typeof e.matches=="function"&&e.matches(t)||!1}function $e(e,t){return t=t||document,t.querySelector(e)}function Ra(e,t){return t=t||document,t.querySelectorAll(e)}function On(e){e.parentNode&&e.parentNode.removeChild(e)}function Lx(e,t){if(e.ownerDocument!==t.ownerDocument)try{return t.ownerDocument.importNode(e,!0)}catch{}return e}function Bx(e,t){return t.appendChild(Lx(e,t))}function ye(e,t){return Bx(t,e),e}var Jc=2,Xf={"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":Jc,"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":Jc,"text-anchor":1,"text-decoration":1,"text-rendering":1,"unicode-bidi":1,visibility:1,"word-spacing":1,"writing-mode":1};function Nx(e,t){return Xf[t]?e.style[t]:e.getAttributeNS(null,t)}function Zf(e,t,n){var i=t.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase(),r=Xf[i];r?(r===Jc&&typeof n=="number"&&(n=String(n)+"px"),e.style[i]=n):e.setAttributeNS(null,t,n)}function $x(e,t){var n=Object.keys(t),i,r;for(i=0,r;r=n[i];i++)Zf(e,r,t[r])}function Z(e,t,n){if(typeof t=="string")if(n!==void 0)Zf(e,t,n);else return Nx(e,t);else $x(e,t);return e}const jx=Object.prototype.toString;function Me(e){return new _i(e)}function _i(e){if(!e||!e.nodeType)throw new Error("A DOM element reference is required");this.el=e,this.list=e.classList}_i.prototype.add=function(e){return this.list.add(e),this},_i.prototype.remove=function(e){return jx.call(e)=="[object RegExp]"?this.removeMatching(e):(this.list.remove(e),this)},_i.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},_i.prototype.toggle=function(e,t){return typeof t<"u"?t!==this.list.toggle(e,t)&&this.list.toggle(e):this.list.toggle(e),this},_i.prototype.array=function(){return Array.from(this.list)},_i.prototype.has=_i.prototype.contains=function(e){return this.list.contains(e)};function Ca(e){for(var t;t=e.firstChild;)e.removeChild(t);return e}function Qf(e){return e.cloneNode(!0)}var eu={svg:"http://www.w3.org/2000/svg"},Jf='<svg xmlns="'+eu.svg+'"';function Fx(e){var t=!1;e.substring(0,4)==="<svg"?e.indexOf(eu.svg)===-1&&(e=Jf+e.substring(4)):(e=Jf+">"+e+"</svg>",t=!0);var n=Hx(e);if(!t)return n;for(var i=document.createDocumentFragment(),r=n.firstChild;r.firstChild;)i.appendChild(r.firstChild);return i}function Hx(e){var t;return t=new DOMParser,t.async=!1,t.parseFromString(e,"text/xml")}function oe(e,t){var n;return e=e.trim(),e.charAt(0)==="<"?(n=Fx(e).firstChild,n=document.importNode(n,!0)):n=document.createElementNS(eu.svg,e),t&&Z(n,t),n}var tu=null;function ed(){return tu===null&&(tu=oe("svg")),tu}function td(e,t){var n,i,r=Object.keys(t);for(n=0;i=r[n];n++)e[i]=t[i];return e}function zx(e,t,n,i,r,o){var a=ed().createSVGMatrix();switch(arguments.length){case 0:return a;case 1:return td(a,e);case 6:return td(a,{a:e,b:t,c:n,d:i,e:r,f:o})}}function uo(e){return ed().createSVGTransform()}var nd=/([&<>]{1})/g,Vx=/([&<>\n\r"]{1})/g,Gx={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"'"};function nu(e,t){function n(i,r){return Gx[r]||r}return e.replace(t,n)}function id(e,t){var n,i,r,o,a;switch(e.nodeType){case 3:t.push(nu(e.textContent,nd));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,'="',nu(o.value,Vx),'"');if(e.hasChildNodes()){for(t.push(">"),a=e.childNodes,n=0,i=a.length;n<i;++n)id(a.item(n),t);t.push("</",e.tagName,">")}else t.push("/>");break;case 8:t.push("<!--",nu(e.nodeValue,nd),"-->");break;case 4:t.push("<![CDATA[",e.nodeValue,"]]>");break;default:throw new Error("unable to handle node "+e.nodeType)}return t}function Wx(e){for(var t=e.firstChild,n=[];t;)id(t,n),t=t.nextSibling;return n.join("")}function rd(e,t){return Wx(e)}function gt(e){var t=e.parentNode;return t&&t.removeChild(e),e}function Ux(e,t){return t instanceof SVGMatrix?e.createSVGTransformFromMatrix(t):t}function qx(e,t){var n,i;for(e.clear(),n=0;i=t[n];n++)e.appendItem(Ux(e,i))}function lo(e,t){var n=e.transform.baseVal;return t&&(Array.isArray(t)||(t=[t]),qx(n,t)),n.consolidate()}const Yx=/^class[ {]/;function Kx(e){return Yx.test(e.toString())}function iu(e){return Array.isArray(e)}function ru(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function Pa(...e){e.length===1&&iu(e[0])&&(e=e[0]),e=[...e];const t=e.pop();return t.$inject=e,t}const Xx=/constructor\s*[^(]*\(\s*([^)]*)\)/m,Zx=/^(?:async\s+)?(?:function\s*[^(]*)?(?:\(\s*([^)]*)\)|(\w+))/m,Qx=/\/\*([^*]*)\*\//m;function Jx(e){if(typeof e!="function")throw new Error(`Cannot annotate "${e}". Expected a function!`);const t=e.toString().match(Kx(e)?Xx:Zx);if(!t)return[];const n=t[1]||t[2];return n&&n.split(",").map(i=>{const r=i.match(Qx);return(r&&r[1]||i).trim()})||[]}function od(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(ru(o,b))return o[b];if(ru(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(iu(b))b=Pa(b.slice());else throw s(`Cannot invoke "${b}". Expected a function!`);const A=(b.$inject||Jx(b)).map(I=>ru(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 Pa(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,te;for(let ke in r)j=r[ke],x.indexOf(ke)!==-1&&(j[2]==="private"?(L=I.indexOf(j[3]),L===-1?(F=j[3].createChild([],x),te=f(F),I.push(j[3]),C.push(F),$.push(te),S[ke]=[te,ke,"private",F]):S[ke]=[$[L],ke,"private",C[L]]):S[ke]=[j[2],j[1]],A[ke]=!0),(j[2]==="factory"||j[2]==="type")&&j[1].$scope&&x.forEach(Je=>{j[1].$scope.indexOf(Je)!==-1&&(S[ke]=[j[2],j[1]],A[Je]=!0)});x.forEach(ke=>{if(!A[ke])throw new Error('No provider for "'+ke+'". Cannot use provider from the parent!')}),b.unshift(S)}return new od(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),$=Pa(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],eE(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 eE(e,t){return e!=="value"&&iu(t)&&(t=Pa(t.slice())),t}var tE=1e3;function Yn(e,t){var n=this;t=t||tE,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)})}Yn.prototype.canRender=function(e){},Yn.prototype.drawShape=function(e,t){},Yn.prototype.drawConnection=function(e,t){},Yn.prototype.getShapePath=function(e){},Yn.prototype.getConnectionPath=function(e){};function tr(e){return e.flat().join(",").replace(/,?([A-Za-z]),?/g,"$1")}function nE(e){return["M",e.x,e.y]}function ou(e){return["L",e.x,e.y]}function iE(e,t,n){return["C",e.x,e.y,t.x,t.y,n.x,n.y]}function rE(e,t){const n=e.length,i=[nE(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(ou(a));continue}const c=Math.min(t,au(a.x-o.x,a.y-o.y),au(s.x-a.x,s.y-a.y));if(!c){i.push(ou(a));continue}const u=Aa(a,o,c),l=Aa(a,o,c*.5),p=Aa(a,s,c),f=Aa(a,s,c*.5);i.push(ou(u)),i.push(iE(l,f,p))}return i}function Aa(e,t,n){const i=t.x-e.x,r=t.y-e.y,o=au(i,r),a=n/o;return{x:e.x+i*a,y:e.y+r*a}}function au(e,t){return Math.sqrt(Math.pow(e,2)+Math.pow(t,2))}function po(e,t,n){me(t)&&(n=t,t=null),t||(t={});const i=oe("path",t);return me(n)&&(i.dataset.cornerRadius=String(n)),su(i,e)}function su(e,t){const n=parseInt(e.dataset.cornerRadius,10)||0;return Z(e,{d:tr(rE(t,n))}),e}function Ta(e){var t=new Set(e);return Re(e,function(n){for(var i=n.parent;i;){if(t.has(i))return!1;i=i.parent}return!0})}function nr(e,t,n){n=n||0,pe(e)||(e=[e]),P(e,function(i,r){var o=t(i,r,n);pe(o)&&o.length&&nr(o,t,n+1)})}function cu(e,t,n){var i=new Set,r=new Set;return nr(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 fo(e,t){return cu(e)}function oE(e,t,n){Ui(t)&&(t=!0),bt(t)&&(n=t,t=!0),n=n||{};var i=ho(n.allShapes),r=ho(n.allConnections),o=ho(n.enclosedElements),a=ho(n.enclosedConnections),s=ho(n.topLevel,t&&br(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,P(l.incoming,c),P(l.outgoing,c),l.children}return nr(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 P(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 Cr(e,t){var n={};return P(e,function(i){var r=i;r.waypoints&&(r=at(r)),!me(t.y)&&r.x>t.x&&(n[i.id]=i),!me(t.x)&&r.y>t.y&&(n[i.id]=i),r.x>t.x&&r.y>t.y&&(me(t.width)&&me(t.height)&&r.width+r.x<t.width+t.x&&r.height+r.y<t.height+t.y||!me(t.width)||!me(t.height))&&(n[i.id]=i)}),n}function ad(e){return"waypoints"in e?"connection":"x"in e?"shape":"root"}function sd(e){return!!(e&&e.isFrame)}function ho(e,t){return k({},e||{},t||{})}var aE=1;function bi(e,t){Yn.call(this,e,aE),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(bi,Yn),bi.prototype.canRender=function(){return!0},bi.prototype.drawShape=function(t,n,i){var r=oe("rect");return Z(r,{x:0,y:0,width:n.width||0,height:n.height||0}),sd(n)?Z(r,k({},this.FRAME_STYLE,i||{})):Z(r,k({},this.SHAPE_STYLE,i||{})),ye(t,r),r},bi.prototype.drawConnection=function(t,n,i){var r=po(n.waypoints,k({},this.CONNECTION_STYLE,i||{}));return ye(t,r),r},bi.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 tr(a)},bi.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 tr(o)},bi.$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=Kt(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 cE={__init__:["defaultRenderer"],defaultRenderer:["type",bi],styles:["type",sE]};function et(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 uu(e,t){return!e||!t?-1:e.indexOf(t)}function mo(e,t){return!e||!t?-1:Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function lu(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=mo(e,t);return Math.abs(r/o)<=i}var uE=2;function Kn(e,t){var n=Array.from(arguments).flat();const i={x:"v",y:"h"};for(const[r,o]of Object.entries(i))if(lE(r,n))return o;return!1}function lE(e,t){const n=t[0];return qi(t,function(i){return Math.abs(n[e]-i[e])<=uE})}function cd(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 pu(e,t){return{x:Math.round(e.x+(t.x-e.x)/2),y:Math.round(e.y+(t.y-e.y)/2)}}var pE=/,?([a-z]),?/gi,ud=parseFloat,st=Math,xi=st.PI,In=st.min,Ln=st.max,ld=st.pow,Ei=st.abs,fE=/([a-z])[\s,]*((-?\d*\.?\d*(?:e[-+]?\d+)?[\s]*,?[\s]*)+)/ig,dE=/(-?\d*\.?\d*(?:e[-+]?\d+)?)[\s]*,?[\s]*/ig,pd=Array.isArray||function(e){return e instanceof Array};function hE(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 gE(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 hE(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 vE(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(fE,function(i,r,o){var a=[],s=r.toLowerCase();for(o.replace(dE,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=du,n}function yE(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 _E(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 fu(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 du(){return this.join(",").replace(pE,"$1")}function bE(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=du,t}function fd(e,t,n,i,r,o,a,s,c){var u=1-c,l=ld(u,3),p=ld(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:Ma(h),y:Ma(m)}}function dd(e){var t=CE(...e);return fu(t.x0,t.y0,t.x1-t.x0,t.y1-t.y0)}function wi(e,t,n){return t>=e.x&&t<=e.x+e.width&&n>=e.y&&n<=e.y+e.height}function xE(e,t){return e=fu(e),t=fu(t),wi(t,e.x,e.y)||wi(t,e.x2,e.y)||wi(t,e.x,e.y2)||wi(t,e.x2,e.y2)||wi(e,t.x,t.y)||wi(e,t.x2,t.y)||wi(e,t.x,t.y2)||wi(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 hd(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 md(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=hd(m,e,n,r,a),w=hd(m,t,i,o,s),E=g*g+w*w;d+=f[h]*st.sqrt(E)}return u*d}function EE(e,t,n,i,r,o,a,s){if(!(Ln(e,n)<In(r,a)||In(e,n)>Ln(r,a)||Ln(t,i)<In(o,s)||In(t,i)>Ln(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=Ma(c/l),f=Ma(u/l),d=+p.toFixed(2),h=+f.toFixed(2);if(!(d<+In(e,n).toFixed(2)||d>+Ln(e,n).toFixed(2)||d<+In(r,a).toFixed(2)||d>+Ln(r,a).toFixed(2)||h<+In(t,i).toFixed(2)||h>+Ln(t,i).toFixed(2)||h<+In(o,s).toFixed(2)||h>+Ln(o,s).toFixed(2)))return{x:p,y:f}}}}function Ma(e){return Math.round(e*1e11)/1e11}function wE(e,t,n){var i=dd(e),r=dd(t);if(!xE(i,r))return[];var o=md(...e),a=md(...t),s=vd(e)?1:~~(o/5)||1,c=vd(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=fd(...e,d/s);u[d]={x:m.x,y:m.y,t:d/s}}for(d=0;d<c+1;d++)m=fd(...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=Ei(w.x-g.x)<.01?"y":"x",S=Ei(b.x-E.x)<.01?"y":"x",A=EE(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+Ei((A[x]-g[x])/(w[x]-g[x]))*(w.t-g.t),$=E.t+Ei((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 gd(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=wE(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 SE(e){return pd(e)&&pd(e[0])}function RE(e){if(yE(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=du,t}function vd(e){return e[0]===e[2]&&e[1]===e[3]&&e[4]===e[6]&&e[5]===e[7]}function ka(e,t,n,i){return[e,t,n,i,n,i]}function yd(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 _d(e,t,n,i,r,o,a,s,c,u){var l=xi*120/180,p=xi/180*(+r||0),f=[],d,h=gE(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(Ei((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?xi-I:I,C=s<S?xi-C:C,I<0&&(I=xi*2+I),C<0&&(C=xi*2+C),a&&I>C&&(I=I-xi*2),!a&&C>I&&(C=C-xi*2)}var $=C-I;if(Ei($)>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=_d(s,c,n,i,r,0,a,L,F,[C,j,S,A])}$=C-I;var te=st.cos(I),ke=st.sin(I),Je=st.cos(C),q=st.sin(C),ne=st.tan($/4),ce=4/3*n*ne,ee=4/3*i*ne,ae=[e,t],Y=[e+ce*ke,t-ee*te],B=[s+ce*q,c-ee*Je],N=[s,c];if(Y[0]=2*ae[0]-Y[0],Y[1]=2*ae[1]-Y[1],u)return[Y,B,N].concat(f);f=[Y,B,N].concat(f).join().split(",");for(var V=[],Ee=0,_t=f.length;Ee<_t;Ee++)V[Ee]=Ee%2?h(f[Ee-1],f[Ee],p).y:h(f[Ee],f[Ee+1],p).x;return V}function CE(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),Ei(l)<1e-12){if(Ei(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:In(...u[0]),y0:In(...u[1]),x1:Ln(...u[0]),y1:Ln(...u[1])}}function bd(e){if(SE(e)||(e=vE(e)),_E(e))return e;for(var t=bE(RE(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",..._d(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",...yd(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",...yd(d.x,d.y,f[1],f[2],f[3],f[4])];break;case"L":f=["C",...ka(d.x,d.y,f[1],f[2])];break;case"H":f=["C",...ka(d.x,d.y,f[1],d.y)];break;case"V":f=["C",...ka(d.x,d.y,d.x,f[1])];break;case"Z":f=["C",...ka(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=ud(l[p-4])||n.x,n.by=ud(l[p-3])||n.y}return t}function je(e){return bt(e)&&Yt(e,"waypoints")}function xe(e){return bt(e)&&Yt(e,"labelTarget")}function PE(e){return bt(e)&&yr(e.parent)}function xd(e){return{x:Math.round(e.x),y:Math.round(e.y),width:Math.round(e.width),height:Math.round(e.height)}}function Xn(e){return{x:Math.round(e.x),y:Math.round(e.y)}}function ue(e){return{top:e.y,right:e.x+(e.width||0),bottom:e.y+(e.height||0),left:e.x}}function Da(e){return{x:e.left,y:e.top,width:e.right-e.left,height:e.bottom-e.top}}function AE(e){return Xn({x:e.x+(e.width||0)/2,y:e.y+(e.height||0)/2})}function TE(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=DE(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 je(e)?TE(e):AE(e)}function Rt(e,t,n){n=n||0,bt(n)||(n={x:n,y:n});var i=ue(e),r=ue(t),o=i.bottom+n.y<=r.top,a=i.left-n.x>=r.right,s=i.top-n.y>=r.bottom,c=i.right+n.x<=r.left,u=o?"top":s?"bottom":null,l=c?"left":a?"right":null;return l&&u?u+"-"+l:l||u||"intersect"}function go(e,t,n){var i=ME(e,t);return i.length===1||i.length===2&&mo(i[0],i[1])<1?Xn(i[0]):i.length>1?(i=Pn(i,function(r){var o=Math.floor(r.t2*100)||1;return o=100-o,o=(o<10?"0":"")+o,r.segment2+"#"+o}),Xn(i[n?0:i.length-1])):null}function ME(e,t){return gd(e,t)}function kE(e){e=e.slice();for(var t=0,n,i,r;e[t];)n=e[t],i=e[t-1],r=e[t+1],mo(n,r)===0||lu(i,r,n)?e.splice(t,1):t++;return e}function DE(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function Oa(e,t){return Math.round(e*t)/t}function Ed(e){return me(e)?e+"px":e}function OE(e){for(;e.parent;)e=e.parent;return e}function IE(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"),zt(n,{position:"relative",overflow:"hidden",width:Ed(e.width),height:Ed(e.height)}),t.appendChild(n),n}function wd(e,t,n){const i=oe("g");Me(i).add(t);const r=n!==void 0?n:e.childNodes.length-1;return e.insertBefore(i,e.childNodes[r]||null),i}const LE="base",Sd=0,BE=1,NE={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=IE(e),i=this._svg=oe("svg");Z(i,{width:"100%",height:"100%"}),Lt(i,"tabindex",0),e.autoFocus&&t.on("element.hover",()=>{this.restoreFocus()}),t.on("element.mousedown",500,o=>{this.focus()}),i.addEventListener("focusin",()=>{this._setFocused(!0)}),i.addEventListener("focusout",()=>{this._setFocused(!1)}),i.addEventListener("mouseover",()=>{this._eventBus.fire("canvas.mouseover")}),i.addEventListener("mouseout",()=>{this._eventBus.fire("canvas.mouseout")}),ye(n,i);const r=this._viewport=wd(i,"viewport");e.deferUpdate&&(this._viewboxChanged=Dc(this._viewboxChanged,300)),this._restoreFocus=Dc(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=ad(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(LE,Sd)},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 Kt(this._layers,function(t,n){return n.visible&&e>=n.index&&t++,t},0)},de.prototype._createLayer=function(e,t){typeof t>"u"&&(t=BE);const n=this._getChildIndex(t);return{group:wd(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&&(gt(n),t.visible=!1),n},de.prototype._removeLayer=function(e){const t=this._layers[e];t&&(delete this._layers[e],gt(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(OE(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 ze(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&&(P([i.gfx,i.secondaryGfx],function(r){r&&(n?(e.markers.add(t),Me(r).add(t)):(e.markers.delete(t),Me(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,Sd);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=NE[e];if(!qi(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),et(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);lo(t,l)});else return o=this._rootElement?this.getActiveLayer():null,i=o&&o.getBBox()||{},a=lo(t),r=a?a.matrix:zx(),s=Oa(r.a,1e3),c=Oa(-r.e||0,1e3),u=Oa(-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),Rd(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=ue(a),c=this.viewbox(),u=this.zoom();let l,p;c.y+=t.top/u,c.x+=t.left/u,c.width-=(t.right+t.left)/u,c.height-=(t.bottom+t.top)/u;const f=ue(c);if(!(a.width<c.width&&a.height<c.height))l=a.x-c.x,p=a.y-c.y;else{const h=Math.max(0,s.right-f.right),m=Math.min(0,s.left-f.left),g=Math.max(0,s.bottom-f.bottom),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)}),Oa(i.a,1e3)};function Rd(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),Rd(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 Pr="data-element-id";function sn(e){this._elements={},this._eventBus=e}sn.$inject=["eventBus"],sn.prototype.add=function(e,t,n){var i=e.id;this._validateId(i),Z(t,Pr,i),n&&Z(n,Pr,i),this._elements[i]={element:e,gfx:t,secondaryGfx:n}},sn.prototype.remove=function(e){var t=this._elements,n=e.id||e,i=n&&t[n];i&&(Z(i.gfx,Pr,""),i.secondaryGfx&&Z(i.secondaryGfx,Pr,""),delete t[n])},sn.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)},sn.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,Pr,i),t},sn.prototype.get=function(e){var t;typeof e=="string"?t=e:t=e&&Z(e,Pr);var n=this._elements[t];return n&&n.element},sn.prototype.filter=function(e){var t=[];return this.forEach(function(n,i){e(n,i)&&t.push(n)}),t},sn.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}},sn.prototype.getAll=function(){return this.filter(function(e){return e})},sn.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)})},sn.prototype.getGraphics=function(e,t){var n=e.id||e,i=this._elements[n];return i&&(t?i.secondaryGfx:i.gfx)},sn.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 $E(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 jE(e){return e.__refs_collection===!0}function FE(e,t){return Object.prototype.hasOwnProperty.call(e,t.name||t)}function Cd(e,t,n){var i=$E(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 HE(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 pn(e,t){if(!(this instanceof pn))return new pn(e,t);e.inverse=t,t.inverse=e,this.props={},this.props[e.name]=e,this.props[t.name]=t}pn.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?Cd(this,t,e):HE(this,t,e)},pn.prototype.ensureRefsCollection=function(e,t){var n=e[t.name];return jE(n)||Cd(this,t,e),n},pn.prototype.ensureBound=function(e,t){FE(e,t)||this.bind(e,t)},pn.prototype.unset=function(e,t,n){e&&(this.ensureBound(e,t),t.collection?this.ensureRefsCollection(e,t).remove(n):e[t.name]=void 0)},pn.prototype.set=function(e,t,n){e&&(this.ensureBound(e,t),t.collection?this.ensureRefsCollection(e,t).add(n):e[t.name]=n)};var hu=new pn({name:"children",enumerable:!0,collection:!0},{name:"parent"}),Pd=new pn({name:"labels",enumerable:!0,collection:!0},{name:"labelTarget"}),Ad=new pn({name:"attachers",collection:!0},{name:"host"}),Td=new pn({name:"outgoing",collection:!0},{name:"source"}),Md=new pn({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)}}),hu.bind(this,"parent"),Pd.bind(this,"labels"),Td.bind(this,"outgoing"),Md.bind(this,"incoming")}function vo(){Ar.call(this),hu.bind(this,"children"),Ad.bind(this,"host"),Ad.bind(this,"attachers")}X(vo,Ar);function kd(){Ar.call(this),hu.bind(this,"children")}X(kd,vo);function Dd(){vo.call(this),Pd.bind(this,"labelTarget")}X(Dd,vo);function Od(){Ar.call(this),Td.bind(this,"source"),Md.bind(this,"target")}X(Od,Ar);var zE={connection:Od,shape:vo,label:Dd,root:kd};function VE(e,t){var n=zE[e];if(!n)throw new Error("unknown type: <"+e+">");return k(new n,t)}function GE(e){return e instanceof Ar}function Zn(){this._uid=12}Zn.prototype.createRoot=function(e){return this.create("root",e)},Zn.prototype.createLabel=function(e){return this.create("label",e)},Zn.prototype.createShape=function(e){return this.create("shape",e)},Zn.prototype.createConnection=function(e){return this.create("connection",e)},Zn.prototype.create=function(e,t){return t=k({},t||{}),t.id||(t.id=e+"_"+this._uid++),VE(e,t)};var Ia="__fn",Id=1e3,WE=Array.prototype.slice;function Zt(){this._listeners={},this.on("diagram.destroy",1,this._destroy,this)}Zt.prototype.on=function(e,t,n,i){if(e=pe(e)?e:[e],xt(t)&&(i=n,n=t,t=Id),!me(t))throw new Error("priority must be a number");var r=n;i&&(r=Gt(n,i),r[Ia]=n[Ia]||n);var o=this;e.forEach(function(a){o._addListener(a,{priority:t,callback:r,next:null})})},Zt.prototype.once=function(e,t,n,i){var r=this;if(xt(t)&&(i=n,n=t,t=Id),!me(t))throw new Error("priority must be a number");function o(){o.__isTomb=!0;var a=n.apply(i,arguments);return r.off(e,o),a}o[Ia]=n,this.on(e,t,o)},Zt.prototype.off=function(e,t){e=pe(e)?e:[e];var n=this;e.forEach(function(i){n._removeListener(i,t)})},Zt.prototype.createEvent=function(e){var t=new yo;return t.init(e),t},Zt.prototype.fire=function(e,t){var n,i,r,o;if(o=WE.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 yo?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}},Zt.prototype.handleError=function(e){return this.fire("error",{error:e})===!1},Zt.prototype._destroy=function(){this._listeners={}},Zt.prototype._invokeListeners=function(e,t,n){for(var i;n&&!e.cancelBubble;)i=this._invokeListener(e,t,n),n=n.next;return i},Zt.prototype._invokeListener=function(e,t,n){var i;if(n.callback.__isTomb)return i;try{i=UE(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},Zt.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},Zt.prototype._getListeners=function(e){return this._listeners[e]},Zt.prototype._setListeners=function(e,t){this._listeners[e]=t},Zt.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[Ia]===t)&&(r?r.next=i:this._setListeners(e,i)),r=n,n=i};function yo(){}yo.prototype.stopPropagation=function(){this.cancelBubble=!0},yo.prototype.preventDefault=function(){this.defaultPrevented=!0},yo.prototype.init=function(e){k(this,e||{})};function UE(e,t){return e.apply(null,t)}function ir(e){return e.childNodes[0]}function qE(e){return e.parentNode.childNodes[1]}function La(e,t,n,i,r){var o=uo();o.setTranslate(t,n);var a=uo();a.setRotate(i||0,0,0);var s=uo();s.setScale(1,1),lo(e,[o,a,s])}function Ct(e,t,n){var i=uo();i.setTranslate(t,n),lo(e,i)}function Ld(e,t){var n=uo();n.setRotate(t,0,0),lo(e,n)}function cn(e,t){this._eventBus=e,this._elementRegistry=t}cn.$inject=["eventBus","elementRegistry"],cn.prototype._getChildrenContainer=function(e){var t=this._elementRegistry.getGraphics(e),n;return e.parent?(n=qE(t),n||(n=oe("g"),Me(n).add("djs-children"),ye(t.parentNode,n))):n=t,n},cn.prototype._clear=function(e){var t=ir(e);return wa(t),t},cn.prototype._createContainer=function(e,t,n,i){var r=oe("g");Me(r).add("djs-group"),typeof n<"u"?YE(r,t,t.childNodes[n]):ye(t,r);var o=oe("g");Me(o).add("djs-element"),Me(o).add("djs-"+e),i&&Me(o).add("djs-frame"),ye(r,o);var a=oe("g");return Me(a).add("djs-visual"),ye(o,a),o},cn.prototype.create=function(e,t,n){var i=this._getChildrenContainer(t.parent);return this._createContainer(e,i,n,sd(t))},cn.prototype.updateContainments=function(e){var t=this,n=this._elementRegistry,i;i=Kt(e,function(r,o){return o.parent&&(r[o.parent.id]=o.parent),r},{}),P(i,function(r){var o=r.children;if(o){var a=t._getChildrenContainer(r),s=a.firstChild;P(o,function(c){var u=n.getGraphics(c).parentNode;u===s?s=s.nextSibling:a.insertBefore(u,s)})}})},cn.prototype.drawShape=function(e,t,n={}){var i=this._eventBus;return i.fire("render.shape",{gfx:e,element:t,attrs:n})},cn.prototype.getShapePath=function(e){var t=this._eventBus;return t.fire("render.getShapePath",e)},cn.prototype.drawConnection=function(e,t,n={}){var i=this._eventBus;return i.fire("render.connection",{gfx:e,element:t,attrs:n})},cn.prototype.getConnectionPath=function(e){var t=this._eventBus;return t.fire("render.getConnectionPath",e)},cn.prototype.update=function(e,t,n){if(t.parent){var i=this._clear(n);if(e==="shape")this.drawShape(i,t),Ct(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")}},cn.prototype.remove=function(e){var t=this._elementRegistry.getGraphics(e);gt(t.parentNode)};function YE(e,t,n){var i=n||t.firstChild;e!==i&&t.insertBefore(e,i)}const KE={__depends__:[cE],__init__:["canvas"],canvas:["type",de],elementRegistry:["type",sn],elementFactory:["type",Zn],eventBus:["type",Zt],graphicsFactory:["type",cn]};function XE(e){var t=new od(e);return t.init(),t}function ZE(e){e=e||{};var t={config:["value",e]},n=[t,KE].concat(e.modules||[]);return XE(n)}function Si(e,t){this._injector=t||ZE(e),this.get("eventBus").fire("diagram.init")}Si.prototype.get=function(e,t){return this._injector.get(e,t)},Si.prototype.invoke=function(e,t,n){return this._injector.invoke(e,t,n)},Si.prototype.destroy=function(){this.get("eventBus").fire("diagram.destroy")},Si.prototype.clear=function(){this.get("eventBus").fire("diagram.clear")};function Bt(e){return e?"<"+e.$type+(e.id?' id="'+e.id:"")+'" />':"<null>"}function Wt(e,t){return e.$instanceOf(t)}function QE(e){return ze(e.rootElements,function(t){return Wt(t,"bpmn:Process")||Wt(t,"bpmn:Collaboration")})}function JE(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 ${Bt(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(Ee){l(Ee.message,{element:B,error:Ee}),console.error(`failed to import ${Bt(B)}`,Ee)}}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 ${Bt(V)}`,{element:V}):i[V.id]=N:l(`no bpmnElement referenced in ${Bt(N)}`,{element:N})};function f(B){d(B.plane)}function d(B){p(B),P(B.planeElement,h)}function h(B){p(B)}this.handleDefinitions=function(N,V){var Ee=N.diagrams;if(V&&Ee.indexOf(V)===-1)throw new Error("diagram not part of <bpmn:Definitions />");if(!V&&Ee&&Ee.length&&(V=Ee[0]),!V)throw new Error("no diagram to display");i={},f(V);var _t=V.plane;if(!_t)throw new Error(`no plane for ${Bt(V)}`);var R=_t.bpmnElement;if(!R)if(R=QE(N),R)l(`correcting missing bpmnElement on ${Bt(_t)} to ${Bt(R)}`),_t.bpmnElement=R,p(_t);else throw new Error("no process or collaboration to display");var _=c(R,_t);if(Wt(R,"bpmn:Process")||Wt(R,"bpmn:SubProcess"))g(R,_);else if(Wt(R,"bpmn:Collaboration"))ae(R,_),w(N.rootElements,_);else throw new Error(`unsupported bpmnElement for ${Bt(_t)}: ${Bt(R)}`);m(n)};var m=this.handleDeferred=function(){for(var N;n.length;)N=n.shift(),N()};function g(B,N){ne(B,N),$(B.ioSpecification,N),C(B.artifacts,N),o(B)}function w(B,N){var V=Re(B,function(Ee){return!a(Ee)&&Wt(Ee,"bpmn:Process")&&Ee.laneSets});V.forEach(r(g,N))}function E(B,N){u(B,N)}function b(B,N){P(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){P(B,function(V){Wt(V,"bpmn:Association")?n.push(function(){I(V,N)}):I(V,N)})}function $(B,N){B&&(P(B.dataInputs,r(S,N)),P(B.dataOutputs,r(A,N)))}var j=this.handleSubProcess=function(N,V){ne(N,V),C(N.artifacts,V)};function L(B,N){var V=u(B,N);Wt(B,"bpmn:SubProcess")&&j(B,V||N),Wt(B,"bpmn:Activity")&&$(B.ioSpecification,N),n.push(function(){P(B.dataInputAssociations,r(x,N)),P(B.dataOutputAssociations,r(x,N))})}function F(B,N){u(B,N)}function te(B,N){u(B,N)}function ke(B,N){n.push(function(){var V=u(B,N);B.childLaneSet&&Je(B.childLaneSet,V||N),Y(B)})}function Je(B,N){P(B.lanes,r(ke,N))}function q(B,N){P(B,r(Je,N))}function ne(B,N){ce(B.flowElements,N),B.laneSets&&q(B.laneSets,N)}function ce(B,N){P(B,function(V){Wt(V,"bpmn:SequenceFlow")?n.push(function(){F(V,N)}):Wt(V,"bpmn:BoundaryEvent")?n.unshift(function(){L(V,N)}):Wt(V,"bpmn:FlowNode")?L(V,N):Wt(V,"bpmn:DataObject")||(Wt(V,"bpmn:DataStoreReference")||Wt(V,"bpmn:DataObjectReference")?te(V,N):l(`unrecognized flowElement ${Bt(V)} in context ${Bt(N&&N.businessObject)}`,{element:V,context:N}))})}function ee(B,N){var V=u(B,N),Ee=B.processRef;Ee&&g(Ee,V||N)}function ae(B,N){P(B.participants,r(ee,N)),n.push(function(){b(B.messageFlows,N)}),C(B.artifacts,N)}function Y(B){P(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 Se(e,t){return di(t,function(n){return y(e,n)})}function U(e){return e&&e.businessObject||e}function De(e){return e&&e.di}function ew(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 JE(p);l=l||u.diagrams&&u.diagrams[0];var d=tw(u,l);if(!d)throw new Error("no diagram to display");P(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 tw(e,t){if(!(!t||!t.plane)){var n=t.plane.bpmnElement,i=n;!y(n,"bpmn:Process")&&!y(n,"bpmn:Collaboration")&&(i=nw(n));var r;y(i,"bpmn:Collaboration")?r=i:r=ze(e.rootElements,function(u){if(y(u,"bpmn:Collaboration"))return ze(u.participants,function(l){return l.processRef===i})});var o=[i];r&&(o=Dt(r.participants,function(u){return u.processRef}),o.push(r));var a=Bd(o),s=[t],c=[n];return P(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 Bd(e){var t=[];return P(e,function(n){n&&(t.push(n),t=t.concat(Bd(n.flowElements)))}),t}function nw(e){for(var t=e;t;){if(y(t,"bpmn:Process"))return t;t=t.$parent}}var iw='<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>',Nd=iw,$d={verticalAlign:"middle"},jd={color:"#404040"},rw={zIndex:"1001",position:"fixed",top:"0",left:"0",right:"0",bottom:"0"},ow={width:"100%",height:"100%",background:"rgba(40,40,40,0.2)"},aw={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">'+Nd+'</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>',Bn;function cw(){Bn=We(sw),zt(Bn,rw),zt($e("svg",Bn),$d),zt($e(".backdrop",Bn),ow),zt($e(".notice",Bn),aw),zt($e(".link",Bn),jd,{margin:"15px 20px 15px 10px",alignSelf:"center"})}function uw(){Bn||(cw(),Xt.bind(Bn,".backdrop","click",function(e){document.body.removeChild(Bn)})),document.body.appendChild(Bn)}const Ba=5,Fd="djs-outline-hidden";function Ke(e){e=k({},pw,e),this._moddle=this._createModdle(e),this._container=this._createContainer(e),this._init(this._container,this._moddle,e),dw(this._container)}X(Ke,Si),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||[]),Na(s,o),s=lw(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 Na(o,[]),o}if(typeof t=="string"&&(i=fw(n,t),!i)){const o=new Error("BPMNDiagram <"+t+"> not found");throw Na(o,[]),o}try{this.clear()}catch(o){throw Na(o,[]),o}const{warnings:r}=await ew(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=$e(":scope > defs",i._svg),a=rd(r),s=o?"<defs>"+rd(o)+"</defs>":"",c=i.getContainer();Ye(c).add(Fd);let u;try{u=r.getBBox()}finally{Ye(c).remove(Fd)}const l=u.x-Ba,p=u.y-Ba,f=u.width+Ba*2,d=u.height+Ba*2;t=`<?xml version="1.0" encoding="utf-8"?>
4
+ nested error: `+S.message;if(I)return a.addWarning({message:F,error:S}),!0;throw Ti(F)}function l(S,A){return u(S,A,!0)}function p(){var S=a.elementsById,A=a.references,I,P;for(I=0;P=A[I];I++){var $=P.element,j=S[P.id],L=si($).propertiesByName[P.property];if(j||a.addWarning({message:"unresolved reference <"+P.id+">",element:P.element,property:P.property,value:P.id}),L.isMany){var F=$.get(L.name),ie=F.indexOf(P);ie===-1&&(ie=F.length),j?F[ie]=j:F.splice(ie,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(P){u(P,A,o)&&c.push(new ou)}}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(ru).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,P){var $=S.attrs||{},j=Object.keys($).reduce(function(F,ie){var Pe=A($[ie]);return F[ie]=Pe,F},{}),L={name:S.name,originalName:S.originalName,attributes:j,ns:S.ns};w(L,P)}).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 P=i.element;!I&&!P&&(I=Ti("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:P,elementsById:L,references:j,warnings:$})})},cu.prototype.handler=function(e){return new su(this.model,e)};function l0(){var e=[];return Object.defineProperty(e,"peek",{value:function(){return this[this.length-1]}}),e}var p0=`<?xml version="1.0" encoding="UTF-8"?>
5
+ `,f0=/<|>|'|"|&|\n\r|\n/g,Of=/<|>|&/g;function Vn(e){this.prefixMap={},this.uriMap={},this.used={},this.wellknown=[],this.custom=[],this.parent=e,this.defaultPrefixMap=e&&e.defaultPrefixMap||{}}Vn.prototype.mapDefaultPrefixes=function(e){this.defaultPrefixMap=e},Vn.prototype.defaultUriByPrefix=function(e){return this.defaultPrefixMap[e]},Vn.prototype.byUri=function(e){return this.uriMap[e]||this.parent&&this.parent.byUri(e)},Vn.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)},Vn.prototype.uriByPrefix=function(e){return this.prefixMap[e||"xmlns"]||this.parent&&this.parent.uriByPrefix(e)},Vn.prototype.mapPrefix=function(e,t){this.prefixMap[e||"xmlns"]=t},Vn.prototype.getNSKey=function(e){return e.prefix!==void 0?e.uri+"|"+e.prefix:e.uri},Vn.prototype.logUsed=function(e){var t=e.uri,n=this.getNSKey(e);this.used[n]=this.byUri(t),this.parent&&this.parent.logUsed(e)},Vn.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 d0(e){return e.charAt(0).toLowerCase()+e.slice(1)}function h0(e,t){return Tf(t)?d0(e):e}function If(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})}function Lf(e){return en(e)?e:(e.prefix?e.prefix+":":"")+e.localName}function m0(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 g0(e,t){return t.isGeneric?D({localName:t.ns.localName},e):D({localName:h0(t.ns.localName,t.$pkg)},e)}function v0(e,t){return D({localName:t.ns.localName},e)}function y0(e){var t=e.$descriptor;return Ee(t.properties,function(n){var i=n.name;if(n.isVirtual||!tn(e,i))return!1;var r=e[i];return r===n.default||r===null?!1:n.isMany?r.length:!0})}var _0={"\n":"#10","\n\r":"#10",'"':"#34","'":"#39","<":"#60",">":"#62","&":"#38"},b0={"<":"lt",">":"gt","&":"amp"};function Nf(e,t,n){return e=en(e)?e:""+e,e.replace(t,function(i){return"&"+n[i]+";"})}function x0(e){return Nf(e,f0,_0)}function E0(e){return Nf(e,Of,b0)}function w0(e){return Ee(e,function(t){return t.isAttr})}function S0(e){return Ee(e,function(t){return!t.isAttr})}function uu(e){this.tagName=e}uu.prototype.build=function(e){return this.element=e,this},uu.prototype.serializeTo=function(e){e.appendIndent().append("<"+this.tagName+">"+this.element.id+"</"+this.tagName+">").appendNewLine()};function fr(){}fr.prototype.serializeValue=fr.prototype.serializeTo=function(e){e.append(this.escape?E0(this.value):this.value)},fr.prototype.build=function(e,t){return this.value=t,e.type==="String"&&t.search(Of)!==-1&&(this.escape=!0),this};function lu(e){this.tagName=e}If(lu,fr),lu.prototype.serializeTo=function(e){e.appendIndent().append("<"+this.tagName+">"),this.serializeValue(e),e.append("</"+this.tagName+">").appendNewLine()};function Ke(e,t){this.body=[],this.attrs=[],this.parent=e,this.propertyDescriptor=t}Ke.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=y0(e),this.parseAttributes(w0(r)),this.parseContainments(S0(r))),this.parseGenericAttributes(e,i),this},Ke.prototype.nsTagName=function(e){var t=this.logNamespaceUsed(e.ns);return g0(t,e)},Ke.prototype.nsPropertyTagName=function(e){var t=this.logNamespaceUsed(e.ns);return v0(t,e)},Ke.prototype.isLocalNs=function(e){return e.uri===this.ns.uri},Ke.prototype.nsAttributeName=function(e){var t;if(en(e)?t=Ft(e):t=e.ns,e.inherited)return{localName:t.localName};var n=this.logNamespaceUsed(t);return this.getNamespaces().logUsed(n),this.isLocalNs(n)?{localName:t.localName}:D({localName:t.localName},n)},Ke.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}))},Ke.prototype.parseGenericContainments=function(e){var t=e.$body;t&&this.body.push(new fr().build({type:"String"},t));var n=e.$children;n&&T(n,i=>{this.body.push(new Ke(this).build(i))})},Ke.prototype.parseNsAttribute=function(e,t,n){var i=e.$model,r=Ft(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)}},Ke.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},Ke.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)}})},Ke.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 fr().build(r,o[0]));else if(Ef(r.type))T(o,function(u){n.push(new lu(t.addTagName(t.nsPropertyTagName(r))).build(r,u))});else if(a)T(o,function(u){n.push(new uu(t.addTagName(t.nsPropertyTagName(r))).build(u))});else{var c=kf(r);T(o,function(u){var l;c?c===Mf?l=new Ke(t,r):l=new Oa(t,r,c):l=new Ke(t),n.push(l.build(u))})}})},Ke.prototype.getNamespaces=function(e){var t=this.namespaces,n=this.parent,i;return t||(i=n&&n.getNamespaces(),e||!i?this.namespaces=t=new Vn(i):t=i),t},Ke.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},Ke.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},Ke.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)})},Ke.prototype.addTagName=function(e){var t=this.logNamespaceUsed(e);return this.getNamespaces().logUsed(t),Lf(e)},Ke.prototype.addAttribute=function(e,t){var n=this.attrs;en(t)&&(t=x0(t));var i=yf(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)},Ke.prototype.serializeAttributes=function(e){var t=this.attrs,n=this.namespaces;n&&(t=m0(n).concat(t)),T(t,function(i){e.append(" ").append(Lf(i.name)).append('="').append(i.value).append('"')})},Ke.prototype.serializeTo=function(e){var t=this.body[0],n=t&&t.constructor!==fr;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 Oa(e,t,n){Ke.call(this,e,t),this.serialization=n}If(Oa,Ke),Oa.prototype.parseNsAttributes=function(e){var t=Ke.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},Oa.prototype.isLocalNs=function(e){return e.uri===(this.typeNs||this.ns).uri};function R0(){this.value="",this.write=function(e){this.value+=e}}function C0(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 P0(e){e=D({format:!1,preamble:!0},e||{});function t(n,i){var r=i||new R0,o=new C0(r,e.format);e.preamble&&o.append(p0);var a=new Ke,s=n.$model;if(a.getNamespaces().mapDefaultPrefixes(A0(s)),a.build(n).serializeTo(o),!i)return r.value}return{toXML:t}}function A0(e){const t=e.config&&e.config.nsMap||{},n={};for(const i in ru)n[i]=ru[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 Ia(e,t){bn.call(this,e,t)}Ia.prototype=Object.create(bn.prototype),Ia.prototype.fromXML=function(e,t,n){en(t)||(n=t,t="bpmn:Definitions");var i=new cu(D({model:this,lax:!0},n)),r=i.handler(t);return i.fromXML(e,r)},Ia.prototype.toXML=function(e,t){var n=new P0(t);return new Promise(function(i,r){try{var o=n.toXML(e);return i({xml:o})}catch(a){return r(a)}})};var T0="BPMN20",M0="http://www.omg.org/spec/BPMN/20100524/MODEL",k0="bpmn",D0=[],O0=[{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"}]}],I0=[{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"}]}],L0={tagAlias:"lowerCase",typePrefix:"t"},N0={name:T0,uri:M0,prefix:k0,associations:D0,types:O0,enumerations:I0,xml:L0},B0="BPMNDI",$0="http://www.omg.org/spec/BPMN/20100524/DI",j0="bpmndi",F0=[{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"]}],H0=[{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"}]}],z0=[],V0={name:B0,uri:$0,prefix:j0,types:F0,enumerations:H0,associations:z0},G0="DC",W0="http://www.omg.org/spec/DD/20100524/DC",U0="dc",q0=[{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}]}],Y0=[],K0={name:G0,uri:W0,prefix:U0,types:q0,associations:Y0},X0="DI",Z0="http://www.omg.org/spec/DD/20100524/DI",Q0="di",J0=[{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"}]}],ex=[],tx={tagAlias:"lowerCase"},nx={name:X0,uri:Z0,prefix:Q0,types:J0,associations:ex,xml:tx},ix="bpmn.io colors for BPMN",rx="http://bpmn.io/schema/bpmn/biocolor/1.0",ox="bioc",ax=[{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"}]}],sx=[],cx=[],ux={name:ix,uri:rx,prefix:ox,types:ax,enumerations:sx,associations:cx},lx="BPMN in Color",px="http://www.omg.org/spec/BPMN/non-normative/color/1.0",fx="color",dx=[{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"}]}],hx=[],mx=[],gx={name:lx,uri:px,prefix:fx,types:dx,enumerations:hx,associations:mx};const vx={bpmn:N0,bpmndi:V0,dc:K0,di:nx,bioc:ux,color:gx};function Bf(e,t){const n=D({},vx,e);return new Ia(n,t)}const yx={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"}},_x="http://www.omg.org/spec/BPMN/non-normative/extensions/i18n/1.0",$f="i18n",La={[$f]:yx,[qc]:df};function jf(){return Bf(La)}const Ff=jf();async function pu(e){const{rootElement:t,warnings:n}=await Ff.fromXML(e,"bpmn:Definitions");return{definitions:t,warnings:n}}async function bx(e){const{xml:t}=await Ff.toXML(e,{format:!0});return t}function fu(e){return e.map(t=>typeof t=="string"?t:t.message??String(t))}const Na=new Set(["bpmn:Participant","bpmn:Lane","bpmn:Group","bpmn:SubProcess","bpmn:AdHocSubProcess","bpmn:Transaction"]),xx=1,Ex=2;function Mi(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 Hf=20,zf=1;function dr(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 du(e,t){let n=null;for(const i of dr(e))for(const r of dr(t)){if(i.axis!==r.axis||i.dir===r.dir||Math.abs(i.at-r.at)>zf)continue;const o=Math.min(i.hi,r.hi)-Math.max(i.lo,r.lo);o>=Hf&&(!n||o>n.length)&&(n={axis:i.axis,length:o})}return n}function hu(e,t){let n=0;for(const i of t)i.id!==e.id&&du(e,i)&&n++;return n}const mu=15,Vf=20;function wx(e,t){const n=t.axis==="v"?[e.x,e.x+e.width]:[e.y,e.y+e.height];if(t.at<n[0]-Vf||t.at>n[1]+Vf)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 gu=20;function vu(e,t){const n=[];for(const i of t){if(i.axis!==e.axis||Math.abs(i.at-e.at)>zf)continue;const r=Math.max(e.lo,i.lo),o=Math.min(e.hi,i.hi);o-r<Hf||n.push([r-gu,o+gu])}return n}function Ba(e,t){const n=e.label;if(!n)return null;let i=null;for(const r of dr(e)){const o=wx(n,r);if(o){for(const a of t)if(a.id!==e.id&&!(i&&a.id>=i.other)){for(const[s,c]of vu(r,dr(a)))if(Math.min(c,o[1])>Math.max(s,o[0])){i={other:a.id,axis:r.axis};break}}}}return i}const Sx=1,Rx=(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 Cx(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 Px(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 Ax=(e,t)=>e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height;function ki(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(Cx(e.waypoints[o],e.waypoints[o+1],r,Ex)){i.push(r);break}}return i}function Tx(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 Mx=(e,t)=>e.endpoints.some(n=>t.endpoints.includes(n));function Fr(e,t){let n=0;for(const i of t){if(i.id===e.id||Mx(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++)Tx(e.waypoints[o],e.waypoints[o+1],i.waypoints[a],i.waypoints[a+1])&&(r=!0);r&&n++}return n}function $a(e){const t=[],n=e.edges;for(let i=0;i<n.length;i++)for(let r=i+1;r<n.length;r++)if(Fr(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 Hr=e=>e.shapes.filter(t=>!t.container);function Di(e){const t=[],n=e.shapes.filter(o=>!o.container);for(const o of e.edges)for(const a of ki(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(!Px(s,c,xx))continue;const u=s.id<c.id?[s.id,c.id]:[c.id,s.id];t.push({kind:"shape-overlap",shapes:u,identical:Ax(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=du(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=Ba(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||Rx(a,o,Sx)||t.push({kind:"shape-outside-container",shape:o.id,container:a.id})}return t.sort((o,a)=>Mi(o).localeCompare(Mi(a)))}const Pt=e=>typeof e=="object"&&e!==null?e:void 0,Ht=e=>typeof e=="number"?e:0,hr=e=>{const t=Pt(e);return typeof(t==null?void 0:t.id)=="string"?t.id:void 0};function kx(e){const t=Pt(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=hr(o);a&&n.push(a)}}return n}function Dx(e,t){const n=Pt(e.$parent);if(!n)return;const i=typeof n.$type=="string"?n.$type:"";if(i==="bpmn:Process"){const r=hr(n);return r?t.get(r):void 0}if(Na.has(i)&&i!=="bpmn:Lane"&&i!=="bpmn:Group")return hr(n)}function Gf(e){var o,a,s,c;const t=[],n=[],i=((o=Pt(e))==null?void 0:o.diagrams)??[],r=new Map;for(const u of((a=Pt(e))==null?void 0:a.rootElements)??[]){const l=Pt(u);if((l==null?void 0:l.$type)==="bpmn:Collaboration")for(const p of l.participants??[]){const f=Pt(p),d=hr(f),h=hr(f==null?void 0:f.processRef);d&&h&&r.set(h,d)}}for(const u of i){const l=Pt((s=Pt(u))==null?void 0:s.plane),p=(l==null?void 0:l.planeElement)??[];for(const f of p){const d=Pt(f);if(!d)continue;const h=Pt(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=Pt(d.bounds);if(w){const b=d.isExpanded===!1;t.push({id:m,type:g,x:Ht(w.x),y:Ht(w.y),width:Ht(w.width),height:Ht(w.height),container:Na.has(g)&&!b,attached:(h==null?void 0:h.attachedToRef)!==void 0,...h?{parent:Dx(h,r)}:{}});continue}const E=d.waypoint;if(Array.isArray(E)){const b=Pt((c=Pt(d.label))==null?void 0:c.bounds);n.push({id:m,type:g,waypoints:E.map(x=>{var S,A;return{x:Ht((S=Pt(x))==null?void 0:S.x),y:Ht((A=Pt(x))==null?void 0:A.y)}}),endpoints:kx(h),...b?{label:{x:Ht(b.x),y:Ht(b.y),width:Ht(b.width),height:Ht(b.height)}}:{}})}}}return{shapes:t,edges:n}}function Wf(e){return Di(Gf(e))}async function Ox(e){const{definitions:t,warnings:n}=await pu(e);return{findings:Wf(t),warnings:n}}function Ln(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=Pt(r.label);n.push({id:r.id,type:o,waypoints:a.map(f=>({x:Ht(f.x),y:Ht(f.y)})),endpoints:[hr(r.source),hr(r.target)].filter(f=>!!f),...p&&typeof p.x=="number"?{label:{x:p.x,y:Ht(p.y),width:Ht(p.width),height:Ht(p.height)}}:{}});continue}if(typeof r.x!="number"||typeof r.y!="number")continue;const s=Pt(r.businessObject);let c=Pt(r.parent);for(;c&&c.type==="bpmn:Lane";)c=Pt(c.parent);const u=typeof(c==null?void 0:c.type)=="string"?c.type:"",l=c&&Na.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:Ht(r.width),height:Ht(r.height),container:Na.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 Ix={"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 Lx(e,t){const n=Ix[e];return n||(e==="label"||e.startsWith("bpmndi:")?"other":e.startsWith("bpmn:")&&!("waypoints"in t&&t.waypoints)?"flowNode":"other")}function Uf(e){let t=e.parent;for(;t;){if(t.type==="bpmn:Participant")return t.id;t=t.parent}}function qf(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 Lx(i.type,i)},lanesOf:n=>t().filter(i=>i.type==="bpmn:Lane"&&Uf(i)===n).sort((i,r)=>i.y-r.y).map(i=>i.id),participantOf:n=>{const i=e.get(n);return i?Uf(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 Yf=20,Nx=4,qt=(e,t)=>Math.abs(e-t)<.5;function Kf(e,t,n,i=Yf){if(qt(e.y,t.y)&&!qt(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(qt(e.x,t.x)&&!qt(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 Xf(e,t,n=Yf){if(e.length!==4)return null;const[i,r,o,a]=e;if(qt(i.y,r.y)&&qt(r.x,o.x)&&qt(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(qt(i.x,r.x)&&qt(r.y,o.y)&&qt(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 Bx=(e,t,n)=>[...e.slice(0,t+1),...n,...e.slice(t+1)],Zf=(e,t,n)=>ki({...e,waypoints:t},n).length;function Qf(e,t,n){let i=[...e.waypoints],r=Zf(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<Nx&&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)||ki({...e,waypoints:[l,p]},[f]).length===0)continue;const d=Kf(l,p,f),h=d?d.map(g=>Bx(i,u,g)):Xf(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=Zf(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 Jf(e,t){const{elementRegistry:n}=e,i=e.modeling,r=Ln(n),o=Hr(r),a=Di(r).filter(c=>c.kind==="edge-crosses-shape"&&!t.has(Mi(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=Qf(u,o,f);d&&i.updateWaypoints(l,d)}}const $x=10;function ed(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 td(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=ed(i,n),a=ed(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,ie)=>F.y-ie.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=Hr(t),x=t.edges.filter(F=>F.id!==e.id),S=Fr(e,x),A=ki(e,b).length;if(S===0&&A===0)return null;const I=Math.min(...l.map(F=>F.x)),P=Math.max(...l.map(F=>F.x+F.width)),$=(w.x+E.x)/2,j=F=>F.filter((ie,Pe)=>Pe===0||!(qt(ie.x,F[Pe-1].x)&&qt(ie.y,F[Pe-1].y)));let L;for(let F=I;F<=P;F+=$x){const ie=j([w,{x:w.x,y:m},{x:F,y:m},{x:F,y:g},{x:E.x,y:g},E]),Pe={...e,waypoints:ie};if(ki(Pe,b).length>0)continue;const nt=Fr(Pe,x),q=Math.abs(F-$);(!L||nt<L.cross||nt===L.cross&&q<L.detour)&&(L={pts:ie,cross:nt,detour:q})}return L&&(A>0?L.cross<=S:L.cross<S)?L.pts:null}function nd(e,t){const{elementRegistry:n}=e,i=e.modeling,r=Ln(n);for(const o of r.edges){if(o.type!=="bpmn:MessageFlow"||t.has(o.id))continue;const a=Ln(n),s=a.edges.find(l=>l.id===o.id);if(!s)continue;const c=td(s,a);if(!c)continue;const u=n.get(o.id);u&&i.updateWaypoints(u,c)}}const jx=[25,-25,40,-40],id=35;function Fx(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-id:n.y+n.height+id;return[u,[{x:a,y:l},{x:a,y:p},{x:o,y:p},{x:o,y:c}]]}function Hx(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=qt(n[0].x,n[1].x)&&!qt(n[0].y,n[1].y),s=qt(n[n.length-1].x,n[n.length-2].x)&&!qt(n[n.length-1].y,n[n.length-2].y);for(const c of jx){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 rd(e,t){const n=new Map(t.shapes.map(u=>[u.id,u])),i=Hr(t),r=t.edges.filter(u=>u.id!==e.id),o=hu(e,r);if(o===0)return null;const a=Fr(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[...Fx(e,n),...Hx(e,n)]){const l={...e,waypoints:u};if(ki(l,i).length>0)continue;const p=hu(l,r),f=Fr(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 od(e,t,n){const{elementRegistry:i}=e,r=e.modeling,o=Ln(i),a=Di(o).filter(c=>c.kind==="edge-overlap-opposite"&&!t.has(Mi(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=Ln(i),l=u.edges.find(d=>d.id===c);if(!l)continue;const p=rd(l,u);if(!p)continue;const f=i.get(c);f&&r.updateWaypoints(f,p)}}const zx=10,Vx=(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 ad(e,t){const n=e.label;if(!n)return null;const i=t.edges.filter(a=>a.id!==e.id);if(!Ba(e,i))return null;const r=Hr(t),o=i.flatMap(dr);for(const a of dr(e)){let s=[[a.lo,a.hi]];for(const[d,h]of vu(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+zx*2);if(!u)continue;const l=(u[0]+u[1])/2,p=a.axis==="h"?{x:l,y:a.at-mu}:{x:a.at+mu,y:l},f={x:p.x-n.width/2,y:p.y-n.height/2,width:n.width,height:n.height};if(!Ba({...e,label:f},i)&&!r.some(d=>!e.endpoints.includes(d.id)&&Vx(f,d)))return f}return null}function sd(e,t,n){const{elementRegistry:i}=e,r=e.modeling,o=Ln(i),a=Di(o).filter(s=>s.kind==="label-on-shared-segment"&&!t.has(Mi(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=ad(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 Gx=/^[\p{L}_][\p{L}\p{N}_.\-]*$/u,cd=new Set(["sequenceFlow","messageFlow","dataAssociation","association"]),ud={"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}]},ja=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),yu=e=>typeof e=="string"&&e!=="";function Wx(e){const t=[];function n(i,r,o,a){if(a===null){yu(o)||t.push({kind:"payload-invalid",opIndex:i,field:r});return}if(!ja(o)){t.push({kind:"payload-invalid",opIndex:i,field:r});return}for(const s of a)yu(o[s])||t.push({kind:"payload-invalid",opIndex:i,field:`${r}.${s}`})}return e.forEach((i,r)=>{if(!ja(i)||!yu(i.kind)||!(i.kind in ud)){t.push({kind:"payload-invalid",opIndex:r,field:"kind"});return}for(const o of ud[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(!ja(u))break;u=u[p]}if(!ja(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 ld(e,t){const n=Wx(e);if(n.length>0)return n;const i=[],r=new Map,o=new Map;function a(f,d,h){if(!Gx.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&&cd.has(g)&&i.push({kind:"ref-category",opIndex:d,ref:m,role:"member",expected:"shape",actual:g})}break}case"participant.update":{if(p(d,f.id,"participant")===void 0)break;if(f.lanes){const m=t.lanesOf(f.id),g=f.lanes.map(E=>E.id);for(const E of m)g.includes(E)||i.push({kind:"lane-shrink-unsupported",opIndex:d,participant:f.id,lane:E});for(const E of g)t.categoryOf(E)!==void 0&&!m.includes(E)&&i.push({kind:"id-duplicate",opIndex:d,id:E});const 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&&cd.has(g)&&i.push({kind:"ref-category",opIndex:d,ref:m,role:"member",expected:"shape",actual:g})}break}case"element.remove":{p(d,f.id)==="lane"&&i.push({kind:"ref-category",opIndex:d,ref:f.id,role:"target",expected:"removable",actual:"lane"});break}}}),i;function p(f,d,h){if(r.has(d)){i.push({kind:"target-added-in-batch",opIndex:f,id:d});return}const m=t.categoryOf(d);if(m===void 0){i.push({kind:"ref-missing",opIndex:f,ref:d,role:"target"});return}if(h&&m!==h){i.push({kind:"ref-category",opIndex:f,ref:d,role:"target",expected:h,actual:m});return}return m}}function pd(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 Fa(e){return`bpmn:${e[0].toUpperCase()}${e.slice(1)}`}const fd={"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 kt(e,t){return e.filter(n=>n.kind===t)}function dd(e,t){var fn,De,Be,Sb;const{modeling:n,bpmnFactory:i,elementFactory:r,elementRegistry:o,canvas:a,autoPlace:s,bpmnReplace:c}=t,u=()=>a.getRootElement(),l=C=>o.get(C),p=C=>{const M=l(C);if(!M)throw new Error(`하강 참조 해소 실패: ${C}`);return M},f=C=>{let M=C.parent;for(;M;){if(M.type==="bpmn:Participant")return M;M=M.parent}},d=kt(e,"participant.add"),h=kt(e,"node.add"),m=kt(e,"sequenceFlow.add"),g=kt(e,"messageFlow.add"),w=kt(e,"dataStore.add"),E=kt(e,"dataAssociation.add"),b=kt(e,"annotation.add"),x=kt(e,"group.add"),S=new Map(h.map(C=>[C.node.id,C])),A=(C,M,H)=>{var vt;const X=C.businessObject,ee=(((vt=X.extensionElements)==null?void 0:vt.values)??[]).filter(Le=>Le.$type!==M),Y=H?[...ee,i.create(M,H)]:ee;if(!Y.length){X.extensionElements&&n.updateProperties(C,{extensionElements:void 0});return}const me=i.create("bpmn:ExtensionElements",{values:Y});Y.forEach(Le=>{Le.$parent=me}),n.updateProperties(C,{extensionElements:me})},I=C=>({anchor:C.anchor,side:C.side,...C.offset!==void 0?{offset:C.offset}:{}});for(const C of kt(e,"element.remove")){const M=l(C.id);M&&n.removeElements([M])}const P=C=>o.filter(M=>{var H;return M.type==="bpmn:Lane"&&((H=f(M))==null?void 0:H.id)===C}).sort((M,H)=>M.y-H.y);for(const C of kt(e,"participant.update")){const M=p(C.id);if(C.name!==void 0&&n.updateProperties(M,{name:C.name??void 0}),!C.lanes)continue;const H=P(C.id);if(!H.length){n.splitLane(M,C.lanes.length),P(C.id).forEach((ee,Y)=>{const me=C.lanes[Y];me&&n.updateProperties(ee,{id:me.id,name:me.name})});continue}const X=new Set(H.map(ee=>ee.id));C.lanes.forEach((ee,Y)=>{if(X.has(ee.id)){n.updateProperties(p(ee.id),{name:ee.name});return}const me=Y===0?n.addLane(P(C.id)[0],"top"):n.addLane(p(C.lanes[Y-1].id),"bottom");n.updateProperties(me,{id:ee.id,name:ee.name})})}const $=150,j=80,L=90,F=180,ie=new Set;for(const C of d){ie.add(`pool:${C.participant.id}`);for(const M of C.participant.lanes??[])ie.add(M.id)}const Pe=new Map;for(const C of h){const M=C.node.lane??`pool:${C.node.participant??""}`;let H=Pe.get(M);H||Pe.set(M,H=new Set([0])),C.band!==void 0&&H.add(C.band)}const nt=new Map;for(const[C,M]of Pe){if(!ie.has(C))continue;const H=[...M].sort((Y,me)=>Y-me),X=H.map((Y,me)=>me===0?0:me%2===1?Math.ceil(me/2):-(me/2)),ee=Math.min(...X);nt.set(C,new Map(H.map((Y,me)=>[Y,X[me]-ee])))}const q=C=>{var M;return(((M=Pe.get(C))==null?void 0:M.size)??0)>1},re=C=>C.band??(C.node.lane||!q(`pool:${C.node.participant??""}`)?void 0:0),ce=(C,M)=>{var H;return((H=nt.get(C))==null?void 0:H.get(M))??M},oe=new Map;for(const[C,M]of Pe){let H=0;for(const X of M)H=Math.max(H,ce(C,X));oe.set(C,H)}const se=C=>F+$*C,K=d.map((C,M)=>({op:C,declared:M}));K.sort((C,M)=>{const H=C.op.order??Number.POSITIVE_INFINITY,X=M.op.order??Number.POSITIVE_INFINITY;return H!==X?H-X:C.declared-M.declared});let N=80;for(const C of o.getAll())C.parent===u()&&"height"in C&&typeof C.y=="number"&&(N=Math.max(N,C.y+C.height+60));for(const{op:C}of K){const M=C.participant,H=h.filter(dn=>dn.node.participant===M.id).length,X=((fn=M.lanes)==null?void 0:fn.length)??0,ee=Math.max(1200,H*160+300),Y=(M.lanes??[]).map(dn=>se(oe.get(dn.id)??0)),me=Y.reduce((dn,qe)=>dn+qe,0);X&&me<300&&(Y[X-1]+=300-me);const vt=Math.max(300,$*((oe.get(`pool:${M.id}`)??0)+1)),Le=M.blackBox||H+X===0?120:X?Math.max(300,me):vt,Te=r.createShape({type:"bpmn:Participant",businessObject:i.create("bpmn:Participant",{id:M.id,name:M.name,...C.order!==void 0?{"bwl:poolOrder":C.order}:{},...M.blackBox?{}:{processRef:i.create("bpmn:Process")}}),width:ee,height:Le,isExpanded:!0}),St=n.createShape(Te,{x:100+ee/2,y:N+Le/2},u()),ri=M.lanes??[];if(ri.length&&n.splitLane(St,ri.length),ri.length){const dn=o.filter(qe=>{var Xt;return qe.type==="bpmn:Lane"&&((Xt=f(qe))==null?void 0:Xt.id)===M.id}).sort((qe,Xt)=>qe.y-Xt.y);if(dn.forEach((qe,Xt)=>{const On=ri[Xt];On&&n.updateProperties(qe,{id:On.id,name:On.name})}),Y.some(qe=>qe!==St.height/X)){let qe=St.y;dn.forEach((Xt,On)=>{const sr=Y[On];n.resizeShape(Xt,{x:Xt.x,y:qe,width:Xt.width,height:sr}),qe+=sr})}}N=St.y+St.height+60}const B=C=>{var X;const M=S.get(C);if(M)return M.node.participant??"";const H=l(C);return H?H.type==="bpmn:Participant"?H.id:((X=f(H))==null?void 0:X.id)??"":""},V=new Map,be=C=>{let M=V.get(C);return M||V.set(C,M={nodes:[],flows:[]}),M};for(const C of h)be(C.node.participant??"").nodes.push(C);for(const C of m)be(B(C.flow.source)).flows.push(C);const wt=C=>{var M;return i.create("bpmn:SequenceFlow",{id:C.id,name:C.name??((M=C.condition)==null?void 0:M.label)})},R=(C,M)=>r.createShape({type:Fa(C.type),businessObject:i.create(Fa(C.type),{id:C.id,name:C.name,...M!==void 0?{"bwl:band":M}:{}})}),_=[...K.map(({op:C})=>C.participant.id).filter(C=>V.has(C)),...[...V.keys()].filter(C=>!d.some(M=>M.participant.id===C))],v=C=>C.endsWith("Gateway");for(const C of _){const M=V.get(C),H=C?p(C):void 0,X=H?H.x+150:250;let ee=H?H.y+80:120;const Y=(Oe,$e,Re)=>{const Ye=u().children.filter(st=>!("waypoints"in st&&st.waypoints)&&st.id!==$e&&typeof st.y=="number"&&st.y>=Oe);Ye.length&&n.moveElements(Ye,{x:0,y:Re})},me=(Oe,$e)=>{if(Oe){const Ae=p(Oe),Ne=se($e);if(Ae.height>=Ne)return;const Bt=Ne-Ae.height,Ze=f(Ae),Si=Ze?Ze.y+Ze.height:Ae.y+Ae.height;n.resizeLane(Ae,{x:Ae.x,y:Ae.y,width:Ae.width,height:Ne},!1),Y(Si,Ze==null?void 0:Ze.id,Bt);return}if(!H)return;const Re=$*($e+1);if(H.height>=Re)return;const Ye=Re-H.height,st=H.y+H.height;n.resizeShape(H,{x:H.x,y:H.y,width:H.width,height:Re}),Y(st,H.id,Ye)},vt=(Oe,$e,Re)=>{if(Oe){const Ye=p(Oe);return Ye.y+Math.min(Ye.height/2,L)+ce(Oe,$e??0)*$}return $e!==void 0&&H?H.y+j+ce(`pool:${C}`,$e)*$:Re},Le=(Oe,$e,Re)=>{if(Oe){const Ye=p(Oe);return Ye.y+Math.min(Ye.height/2,L)+$e*$}return H?H.y+j+$e*$:Re},Te=Oe=>Oe.participant?p(Oe.participant):u(),St=30,ri=(Oe,$e,Re,Ye)=>{const st=Re-$e.width/2,Ae=Ye-$e.height/2;return(Oe.children??[]).find(Ne=>!("waypoints"in Ne&&Ne.waypoints)&&Ne.type!=="bpmn:Lane"&&Ne.type!=="label"&&typeof Ne.x=="number"&&st<Ne.x+Ne.width+St&&st+$e.width+St>Ne.x&&Ae<Ne.y+Ne.height&&Ae+$e.height>Ne.y)},dn=(Oe,$e,Re,Ye,st,Ae)=>{const Ne=Re!==void 0||Ye!==void 0,Bt=ce(Re??`pool:${C}`,Ye??0);if(Ne)for(let oi=0;oi<4;oi++){const Ri=Le(Re,Bt+oi,Ae);if(!ri(Oe,$e,st,Ri))return me(Re,Bt+oi),{x:st,y:Ri}}const Ze=vt(Re,Ye,Ae);Ne&&me(Re,Bt);let Si=st;for(let oi=0;oi<64;oi++){const Ri=ri(Oe,$e,Si,Ze);if(!Ri)break;Si=Ri.x+Ri.width+130+$e.width/2}return{x:Si,y:Ze}},qe=new Set(M.flows.map(Oe=>Oe.flow.target)),Xt=new Map;for(const Oe of M.nodes){if(qe.has(Oe.node.id))continue;const $e=R(Oe.node,Oe.band),Re=re(Oe),Ye=Oe.node.lane?`${Oe.node.lane}|${Re??""}`:Re!==void 0?`band:${Re}`:"",st=Te(Oe.node),Ae=dn(st,$e,Oe.node.lane,Re,Xt.get(Ye)??X,ee);n.createShape($e,Ae,st),Xt.set(Ye,Ae.x+$e.width+130),!Oe.node.lane&&Re===void 0&&(ee+=160)}const On=new Set,sr=new Map;if(C&&ie.has(`pool:${C}`)){const Oe=new Map;for(const Re of M.flows)Oe.set(Re.flow.target,(Oe.get(Re.flow.target)??0)+1);const $e=Re=>vt(Re.node.lane,re(Re),Number.NaN);for(const Re of M.nodes){if(!v(Re.node.type))continue;const Ye=$e(Re);if(Number.isNaN(Ye)||b.some(Ne=>{var Bt,Ze;return(((Bt=Ne.placement)==null?void 0:Bt.anchor)??(Ne.association?Ne.association.source===Ne.annotation.id?Ne.association.target:Ne.association.source:void 0))===Re.node.id&&((Ze=Ne.placement)==null?void 0:Ze.side.startsWith("bottom"))}))continue;let Ae;for(const Ne of M.flows){if(Ne.flow.source!==Re.node.id)continue;const Bt=S.get(Ne.flow.target);if(!Bt||!Bt.node.lane&&re(Bt)===void 0)continue;const Ze=$e(Bt);Number.isNaN(Ze)||Ze<=Ye||(!Ae||Ze>Ae.row?Ae={id:Bt.node.id,row:Ze,count:1}:Ze===Ae.row&&Ae.count++)}Ae&&Ae.count===1&&(Oe.get(Ae.id)??0)===1&&On.add(Ae.id)}}const Wc=new Set;let Fn=0;for(;Fn++<M.nodes.length+2;){for(let Re=0;Re<M.nodes.length+M.flows.length+2;Re++){let Ye=!1;for(const st of M.flows){const Ae=st.flow;if(Wc.has(Ae.id))continue;const Ne=l(Ae.source);if(!Ne)continue;const Bt=l(Ae.target),Ze=S.get(Ae.target);if(!Bt&&Ze){const Si=R(Ze.node,Ze.band),oi=re(Ze);if(Ze.node.lane||oi!==void 0){const Ri=Te(Ze.node),Uc=Ne,Rb=Uc.x+(sr.get(Ae.source)??0)+Uc.width+130,$k=dn(Ri,Si,Ze.node.lane,oi,On.has(Ae.target)?Uc.x+Uc.width/2:Rb,Number.NaN),lf=n.createShape(Si,$k,Ri);On.has(Ae.target)&&sr.set(Ae.target,Rb-(lf.x+lf.width/2)),n.connect(Ne,lf,{type:"bpmn:SequenceFlow",businessObject:wt(Ae)})}else s.append(Ne,Si,{connection:{type:"bpmn:SequenceFlow",businessObject:wt(Ae)}})}else if(Bt)n.connect(Ne,Bt,{type:"bpmn:SequenceFlow",businessObject:wt(Ae)});else continue;Wc.add(Ae.id),Ye=!0}if(!Ye)break}const Oe=M.nodes.filter(Re=>!l(Re.node.id));if(!Oe.length)break;const $e=Oe[0];{const Re=R($e.node,$e.band),Ye=Te($e.node),st=re($e);n.createShape(Re,dn(Ye,Re,$e.node.lane,st,X,ee),Ye),!$e.node.lane&&st===void 0&&(ee+=160)}}}const k=40,O=(C,M=()=>!0)=>{const H=l(C);if(!H)return[];const X=[H],ee=new Set([C]);for(let Y=0;Y<X.length;Y++){const me=X[Y].id;for(const vt of m){const Le=vt.flow.target;if(vt.flow.source!==me||ee.has(Le)||!S.has(Le))continue;ee.add(Le);const Te=l(Le);Te&&M(Te)&&X.push(Te)}}return X};for(const C of kt(e,"sequenceFlow.update")){if(C.target===void 0)continue;const M=S.get(C.target);if(!M)continue;const H=l(C.target),X=l(C.id);if(!H||!X)continue;const ee=C.source!==void 0?l(C.source):X.source,Y=X.target;if(!ee||!Y||Y.id===H.id)continue;const me=O(C.target),vt=new Set(me.map(qe=>qe.id)),Le=Math.min(...me.map(qe=>qe.x)),Te=Math.max(...me.map(qe=>qe.x+qe.width)),St=ee.x+ee.width,ri=Te-Le+k*2-(Y.x-St);if(ri>0){const qe=f(H),Xt=(qe==null?void 0:qe.children)??[],On=Fn=>Fn.type==="bpmn:Lane",sr=Xt.filter(Fn=>!("waypoints"in Fn&&Fn.waypoints)&&!On(Fn)&&!vt.has(Fn.id)&&Fn.x>=Y.x),Wc=qe?[qe,...Xt.filter(Fn=>On(Fn))]:[];sr.length&&n.createSpace(sr,Wc,{x:ri,y:0},"e",Y.x-1)}const dn=M.node.lane||M.band!==void 0?H.y+H.height/2:ee.y+ee.height/2;n.moveElements(me,{x:St+k-Le,y:dn-(H.y+H.height/2)})}const z=(C,M)=>{const H=M.target===C,X=p(M.source),ee=p(M.target),Y=H?"bpmn:DataOutputAssociation":"bpmn:DataInputAssociation";n.connect(X,ee,M.id?{type:Y,businessObject:i.create(Y,{id:M.id})}:{type:Y})};for(const C of w){const M=C.associations??[],H=M.map(Y=>Y.source===C.dataStore.id?Y.target:Y.source).map(l).find(Boolean),X=H?f(H)??u():u(),ee=H?{x:H.x+H.width/2,y:H.y+H.height+110}:{x:200,y:N+60};n.createShape({type:"bpmn:DataStoreReference",businessObject:i.create("bpmn:DataStoreReference",{id:C.dataStore.id,name:C.dataStore.name})},ee,X);for(const Y of M)z(C.dataStore.id,Y)}for(const C of E){const H=p(C.association.target).type==="bpmn:DataStoreReference"?C.association.target:C.association.source;z(H,C.association)}for(const C of g){const M=C.flow;n.connect(p(M.source),p(M.target),{type:"bpmn:MessageFlow",businessObject:i.create("bpmn:MessageFlow",{id:M.id,name:M.name})})}const ne=100,ye=30,Ie=4,it=new Map;for(const C of g)it.set(C.flow.target,(it.get(C.flow.target)??0)+1);const Fe=C=>!("waypoints"in C&&C.waypoints)&&C.type!=="bpmn:Lane"&&C.type!=="label"&&typeof C.x=="number",ot=()=>{const C=Ln(o);return{bad:Di(C).filter(M=>M.kind==="edge-crosses-shape"||M.kind==="edge-overlap-opposite").length,crossings:$a(C).length}},Nt=C=>{const M=Ln(o),H=M.edges.find(X=>X.id===C);return!!H&&ki(H,Hr(M)).length>0},Wt=(C,M,H)=>{const X=new Set(C.map(Te=>Te.id)),ee=(M.children??[]).filter(Fe).filter(Te=>!X.has(Te.id));if(C.some(Te=>ee.some(St=>Te.x+H<St.x+St.width+ye&&Te.x+H+Te.width+ye>St.x&&Te.y<St.y+St.height&&Te.y+Te.height>St.y)))return null;const me=M.width;n.moveElements(C,{x:H,y:0});const Le=Math.max(...C.map(Te=>Te.x+Te.width))+150-(M.x+M.width);return Le>0&&n.resizeShape(M,{x:M.x,y:M.y,width:M.width+Le,height:M.height}),()=>{n.moveElements(C,{x:-H,y:0}),Le>0&&n.resizeShape(M,{x:M.x,y:M.y,width:me,height:M.height})}},We=(C,M)=>M.bad>C.bad||M.crossings>C.crossings,mt=(C,M,H,X=()=>!0)=>{const ee=ot(),Y=Wt(C,M,H);if(!Y)return!1;const me=ot();return We(ee,me)||!X()?(Y(),!1):!0},Mt=g.filter(C=>{const M=S.get(C.flow.target),H=M==null?void 0:M.node.participant;return!!M&&!!H&&ie.has(`pool:${H}`)&&(it.get(C.flow.target)??0)===1}),Dr=new Set(m.map(C=>C.flow.target)),yn=C=>K.findIndex(({op:M})=>M.participant.id===C);Mt.sort((C,M)=>{var ee,Y;const H=Dr.has(C.flow.target)?1:0,X=Dr.has(M.flow.target)?1:0;return H!==X?H-X:yn((ee=S.get(C.flow.target))==null?void 0:ee.node.participant)-yn((Y=S.get(M.flow.target))==null?void 0:Y.node.participant)});const $n=C=>{const M=l(C.flow.target),H=l(C.flow.source);if(!M||!H)return null;const X=H.x+H.width/2-(M.x+M.width/2);if(X<ne)return null;const ee=p(S.get(C.flow.target).node.participant);return{subtree:O(C.flow.target,Y=>Y.x>=M.x),pool:ee,dx:X}};for(let C=0;C<3;C++){const M=ot(),H=[];for(const ee of Mt){const Y=$n(ee);if(!Y)continue;const me=Wt(Y.subtree,Y.pool,Y.dx);me&&H.push(me)}if(!H.length)break;if(!We(M,ot()))continue;for(const ee of H.reverse())ee();let X=!1;for(const ee of Mt){const Y=$n(ee);Y&&mt(Y.subtree,Y.pool,Y.dx)&&(X=!0)}if(!X)break}for(const C of Mt){if(!Nt(C.flow.id))continue;const M=l(C.flow.target);if(!M)continue;const H=p(S.get(C.flow.target).node.participant),X=O(C.flow.target,Y=>Y.x>=M.x),ee=M.width+130;for(let Y=1;Y<=Ie&&!mt(X,H,ee*Y,()=>!Nt(C.flow.id));Y++);}let _n=0;for(const C of x){const M=(C.group.members??[]).map(l).filter(Y=>!!Y),H=40;let X;if(M.length){const Y=Math.min(...M.map(Te=>Te.x))-H,me=Math.min(...M.map(Te=>Te.y))-H,vt=Math.max(...M.map(Te=>Te.x+Te.width))+H,Le=Math.max(...M.map(Te=>Te.y+Te.height))+H;X={x:Y,y:me,width:vt-Y,height:Le-me}}else X={x:300+_n*350,y:40,width:300,height:200},_n++;const ee=n.createShape({type:"bpmn:Group",businessObject:i.create("bpmn:Group",{id:C.group.id}),width:X.width,height:X.height},{x:X.x+X.width/2,y:X.y+X.height/2},u());C.group.name&&n.updateLabel(ee,C.group.name),(De=C.group.members)!=null&&De.length&&A(ee,"bwl:Members",{refs:C.group.members.join(" ")})}const gt=C=>{const M=C.waypoints;if(M!=null&&M.length){const X=M[Math.floor((M.length-1)/2)];return{x:X.x,y:X.y,width:0,height:0}}const H=C;return{x:H.x,y:H.y,width:H.width,height:H.height}};let jn=0;const Pa={width:100,height:30};for(const C of b){const M=C.association,H=((Be=C.placement)==null?void 0:Be.anchor)??(M?M.source===C.annotation.id?M.target:M.source:void 0),X=H?l(H):void 0,ee=X?gt(X):void 0;let Y;if(ee&&C.placement){const[Le,Te]=fd[C.placement.side],St=C.placement.offset??50;Y={x:ee.x+ee.width/2+Le*(ee.width/2+Pa.width/2+St),y:ee.y+ee.height/2+Te*(ee.height/2+Pa.height/2+St)}}else ee?(Y={x:ee.x+ee.width/2+180+jn%3*260,y:ee.y-110-jn%2*95},jn++):(Y={x:300+jn*260,y:60},jn++);const me=X?f(X)??u():u(),vt=n.createShape({type:"bpmn:TextAnnotation",businessObject:i.create("bpmn:TextAnnotation",{id:C.annotation.id,text:C.annotation.text})},Y,me);if(M){const Le=Te=>Te===C.annotation.id?vt:p(Te);n.connect(Le(M.source),Le(M.target),M.id?{type:"bpmn:Association",businessObject:i.create("bpmn:Association",{id:M.id})}:{type:"bpmn:Association"})}C.placement&&A(vt,"bwl:Placement",I(C.placement))}for(const C of kt(e,"association.add")){const M=C.association;n.connect(p(M.source),p(M.target),M.id?{type:"bpmn:Association",businessObject:i.create("bpmn:Association",{id:M.id})}:{type:"bpmn:Association"})}for(const C of kt(e,"node.update")){let M=p(C.id);if(C.type&&Fa(C.type)!==M.type&&(M=c.replaceElement(M,{type:Fa(C.type)})),C.name!==void 0&&n.updateProperties(M,{name:C.name??void 0}),C.lane){const H=p(C.lane),X=H.y+H.height/2-(M.y+M.height/2);X!==0&&n.moveElements([M],{x:0,y:X})}}for(const C of kt(e,"sequenceFlow.update")){const M=p(C.id);if(C.source!==void 0||C.target!==void 0){const H=M,X=C.source!==void 0?p(C.source):H.source,ee=C.target!==void 0?p(C.target):H.target,Y=me=>({x:me.x+me.width/2,y:me.y+me.height/2});n.reconnect(H,X,ee,[Y(X),Y(ee)])}C.name!==void 0&&n.updateProperties(M,{name:C.name??void 0}),C.condition!==void 0&&n.updateProperties(M,{name:((Sb=C.condition)==null?void 0:Sb.label)??void 0})}for(const C of kt(e,"messageFlow.update"))C.name!==void 0&&n.updateProperties(p(C.id),{name:C.name??void 0});for(const C of kt(e,"dataStore.update"))C.name!==void 0&&n.updateProperties(p(C.id),{name:C.name??void 0});for(const C of kt(e,"annotation.update")){const M=p(C.id);if(C.text!==void 0&&n.updateProperties(M,{text:C.text}),C.placement===null)A(M,"bwl:Placement",null);else if(C.placement){const H=gt(p(C.placement.anchor)),[X,ee]=fd[C.placement.side],Y=C.placement.offset??50,me=H.x+H.width/2+X*(H.width/2+M.width/2+Y),vt=H.y+H.height/2+ee*(H.height/2+M.height/2+Y);n.moveElements([M],{x:me-(M.x+M.width/2),y:vt-(M.y+M.height/2)}),A(M,"bwl:Placement",I(C.placement))}}for(const C of kt(e,"group.update")){const M=p(C.id);if(C.name!==void 0&&n.updateLabel(M,C.name??""),C.members){const H=C.members.map(l).filter(X=>!!X);if(H.length){const ee=Math.min(...H.map(Le=>Le.x))-40,Y=Math.min(...H.map(Le=>Le.y))-40,me=Math.max(...H.map(Le=>Le.x+Le.width))+40,vt=Math.max(...H.map(Le=>Le.y+Le.height))+40;n.resizeShape(M,{x:ee,y:Y,width:me-ee,height:vt-Y})}A(M,"bwl:Members",{refs:C.members.join(" ")})}}}function hd(e,t,n=dd){const i=pd(e),r=ld(t,qf(i.elementRegistry)),o={edgeCrossings:{before:0,after:0}};if(r.length)return{ok:!1,issues:r,findings:[],stats:o};const a=Ln(i.elementRegistry),s=new Set(Di(a).map(Mi)),c=new Set(a.edges.map(d=>d.id)),u=$a(a).length,l=e.get("commandStack");try{mf(l,()=>{n(t,i),nd(i,c),Jf(i,s),od(i,s,c),sd(i,s,c)})}catch(d){return{ok:!1,issues:[{kind:"lower-failed",message:d instanceof Error?d.message:String(d)}],findings:[],stats:o}}const p=Ln(i.elementRegistry),f=Di(p).filter(d=>!s.has(Mi(d)));return{ok:!0,issues:[],findings:f,stats:{edgeCrossings:{before:u,after:$a(p).length}}}}function Ux(e){const t=e.slice(e.indexOf(":")+1);return t.charAt(0).toLowerCase()+t.slice(1)}function qx(e,t){return typeof e.get=="function"?e.get(t):e[t]}function md(e,t){const n=qx(e,t);return typeof n=="number"&&Number.isFinite(n)?n:void 0}function gd(e,t){var i;return(((i=e.extensionElements)==null?void 0:i.values)??[]).find(r=>(r==null?void 0:r.$type)===t)}function Yx(e){return typeof e=="string"&&Yc.includes(e)}function Gn(e){if(typeof e=="string")return e;const t=e==null?void 0:e.id;return typeof t=="string"?t:void 0}function vd(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 re=gd(q,"bwl:Placement");if(!re)return;const ce=typeof re.anchor=="string"?re.anchor:void 0;if(!ce||!Yx(re.side))return;const oe=typeof re.offset=="number"?re.offset:void 0;m.push({owner:q.id,anchor:ce,side:re.side,...oe!==void 0?{offset:oe}:{}})},A=q=>{const re=gd(q,"bwl:Members"),ce=typeof(re==null?void 0:re.refs)=="string"?re.refs.split(/\s+/).filter(Boolean):[];ce.length&&g.push({owner:q.id,refs:ce})},I=q=>{var re;for(const ce of q)switch(b(ce.id),ce.$type){case"bpmn:TextAnnotation":x(ce.id),s.push({id:ce.id,text:typeof ce.text=="string"?ce.text:""}),S(ce);break;case"bpmn:Association":d.push({id:ce.id,type:ce.$type,source:Gn(ce.sourceRef),target:Gn(ce.targetRef)});break;case"bpmn:Group":{x(ce.id);const oe=(re=ce.categoryValueRef)==null?void 0:re.value;c.push({id:ce.id,...typeof oe=="string"&&oe?{name:oe}:{}}),A(ce);break}default:u.push({id:ce.id,type:ce.$type,reason:"type-outside-mvp"})}},P=(q,re)=>{const ce=q.flowElements??[],oe=(q.laneSets??[]).flatMap(K=>K.lanes??[]),se=new Map;for(const K of oe){b(K.id);for(const N of K.flowNodeRef??[]){const B=Gn(N);B&&se.set(B,K.id)}}for(const K of ce){if(b(K.id),K.$type==="bpmn:SequenceFlow"){p.push({id:K.id,source:Gn(K.sourceRef),target:Gn(K.targetRef),...typeof K.name=="string"&&K.name?{name:K.name}:{}});continue}if(K.$type==="bpmn:DataStoreReference"){x(K.id),a.push({id:K.id,...K.name?{name:K.name}:{}});continue}const N=Ux(K.$type);if(!pf(N)){u.push({id:K.id,type:K.$type,reason:"type-outside-mvp"});continue}x(K.id),o.push({id:K.id,type:N,...K.name?{name:K.name}:{},...re?{participant:re}:{},...se.has(K.id)?{lane:se.get(K.id)}:{}});const B=md(K,"bwl:band");B!==void 0&&(l.bands[K.id]=B);for(const V of K.dataOutputAssociations??[])b(V.id),h.push({id:V.id,type:V.$type,source:K.id,target:Gn(V.targetRef)});for(const V of K.dataInputAssociations??[])b(V.id),h.push({id:V.id,type:V.$type,source:Gn((V.sourceRef??[])[0]),target:K.id})}I(q.artifacts??[])};if(n){const q=new Set;for(const re of n.participants??[]){x(re.id);const ce=Gn(re.processRef);ce&&q.add(ce);const oe=ce?i.get(ce):void 0,se=((oe==null?void 0:oe.laneSets)??[]).flatMap(V=>V.lanes??[]),K=se.map(V=>({id:V.id,...V.name?{name:V.name}:{}}));for(const V of K)x(V.id);const N=!oe||(oe.flowElements??[]).length===0&&se.length===0&&(oe.artifacts??[]).length===0;r.push({id:re.id,...re.name?{name:re.name}:{},...N?{blackBox:!0}:{},...K.length?{lanes:K}:{}});const B=md(re,"bwl:poolOrder");B!==void 0&&(l.poolOrders[re.id]=B),oe&&P(oe,re.id)}for(const re of n.messageFlows??[])b(re.id),f.push({id:re.id,source:Gn(re.sourceRef),target:Gn(re.targetRef),...typeof re.name=="string"&&re.name?{name:re.name}:{}});I(n.artifacts??[]);for(const[re,ce]of i)!q.has(re)&&(ce.flowElements??[]).length>0&&u.push({id:re,type:ce.$type,reason:"unreachable-process"})}else for(const q of i.values())P(q);const $=[],j=[],L=[],F=[],ie=(q,re)=>!!q&&!!re&&E.has(q)&&E.has(re);for(const q of p){if(!ie(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(!ie(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(!ie(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(!ie(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 Pe=new Map(c.map(q=>[q.id,q]));for(const{owner:q,refs:re}of g){const ce=re.filter(se=>w.has(se)),oe=Pe.get(q);oe&&ce.length&&(oe.members=ce)}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 Kx(e){const{definitions:t,warnings:n}=await pu(e);return{...vd(t),warnings:n}}function Xx(e,t,n,i={}){return{documentId:e,baseVersion:t,ops:[...n],origin:i.origin??"agent",clientOpId:(i.mkClientOpId??(()=>crypto.randomUUID()))()}}async function yd(e,t,{currentVersion:n}){if(t.baseVersion!==n)return{status:"conflict",baseVersion:t.baseVersion,currentVersion:n};const i=hd(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 Zx=Symbol("bpmn-editor");function Qx(){const e=ct.ref(!1),t=ct.ref(!0),n=ct.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 yd(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:fu(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 Jx(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var _u={exports:{}},_d;function eE(){if(_d)return _u.exports;_d=1;var e=_u.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},_u.exports}var tE=eE(),nE=Jx(tE);function Wn(e){if(!(this instanceof Wn))return new Wn(e);e=e||[128,36,1],this._seed=e.length?nE.rack(e[0],e[1],e[2]):e}Wn.prototype.next=function(e){return this._seed(e||!0)},Wn.prototype.nextPrefixed=function(e,t){var n;do n=e+this.next(!0);while(this.assigned(n));return this.claim(n,t),n},Wn.prototype.claim=function(e,t){this._seed.set(e,t||!0)},Wn.prototype.assigned=function(e){return this._seed.get(e)||!1},Wn.prototype.unclaim=function(e){delete this._seed.hats[e]},Wn.prototype.clear=function(){var e=this._seed.hats,t;for(t in e)this.unclaim(t)};const _t={legend:[1,"<fieldset>","</fieldset>"],tr:[2,"<table><tbody>","</tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],_default:[0,"",""]};_t.td=_t.th=[3,"<table><tbody><tr>","</tr></tbody></table>"],_t.option=_t.optgroup=[1,'<select multiple="multiple">',"</select>"],_t.thead=_t.tbody=_t.colgroup=_t.caption=_t.tfoot=[1,"<table>","</table>"],_t.polyline=_t.ellipse=_t.polygon=_t.circle=_t.text=_t.line=_t.path=_t.rect=_t.g=[1,'<svg xmlns="http://www.w3.org/2000/svg" version="1.1">',"</svg>"];function Ue(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(_t,i)?_t[i]:_t._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 iE(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 Yt(e,...t){const n=e.style;return T(t,function(i){i&&T(i,function(r,o){n[o]=r})}),e}function zt(e,t,n){return arguments.length==2?e.getAttribute(t):n===null?e.removeAttribute(t):(e.setAttribute(t,n),e)}const rE=Object.prototype.toString;function Xe(e){return new Oi(e)}function Oi(e){if(!e||!e.nodeType)throw new Error("A DOM element reference is required");this.el=e,this.list=e.classList}Oi.prototype.add=function(e){return this.list.add(e),this},Oi.prototype.remove=function(e){return rE.call(e)=="[object RegExp]"?this.removeMatching(e):(this.list.remove(e),this)},Oi.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},Oi.prototype.toggle=function(e,t){return typeof t<"u"?t!==this.list.toggle(e,t)&&this.list.toggle(e):this.list.toggle(e),this},Oi.prototype.array=function(){return Array.from(this.list)},Oi.prototype.has=Oi.prototype.contains=function(e){return this.list.contains(e)};function Ha(e){for(var t;t=e.firstChild;)e.removeChild(t);return e}function mr(e,t,n){var i=n?e:e.parentNode;return i&&typeof i.closest=="function"&&i.closest(t)||null}function oE(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var za={},bd;function aE(){if(bd)return za;bd=1;var e,t,n;function i(){e=window.addEventListener?"addEventListener":"attachEvent",t=window.removeEventListener?"removeEventListener":"detachEvent",n=e!=="addEventListener"?"on":""}return za.bind=function(r,o,a,s){return e||i(),r[e](n+o,a,s||!1),a},za.unbind=function(r,o,a,s){return t||i(),r[t](n+o,a,s||!1),a},za}var xd=aE(),sE=oE(xd),he=iE({__proto__:null,default:sE},[xd]),Ed=["focus","blur"];function cE(e,t,n,i,r){return Ed.indexOf(n)!==-1&&(r=!0),he.bind(e,n,function(o){var a=o.target||o.srcElement;o.delegateTarget=mr(a,t,!0),o.delegateTarget&&i.call(e,o)},r)}function uE(e,t,n,i){return Ed.indexOf(t)!==-1&&(i=!0),he.unbind(e,t,n,i)}var rn={bind:cE,unbind:uE};function bu(e,t){return e&&typeof e.matches=="function"&&e.matches(t)||!1}function je(e,t){return t=t||document,t.querySelector(e)}function Va(e,t){return t=t||document,t.querySelectorAll(e)}function Un(e){e.parentNode&&e.parentNode.removeChild(e)}function lE(e,t){if(e.ownerDocument!==t.ownerDocument)try{return t.ownerDocument.importNode(e,!0)}catch{}return e}function pE(e,t){return t.appendChild(lE(e,t))}function ge(e,t){return pE(t,e),e}var xu=2,wd={"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":xu,"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":xu,"text-anchor":1,"text-decoration":1,"text-rendering":1,"unicode-bidi":1,visibility:1,"word-spacing":1,"writing-mode":1};function fE(e,t){return wd[t]?e.style[t]:e.getAttributeNS(null,t)}function Sd(e,t,n){var i=t.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase(),r=wd[i];r?(r===xu&&typeof n=="number"&&(n=String(n)+"px"),e.style[i]=n):e.setAttributeNS(null,t,n)}function dE(e,t){var n=Object.keys(t),i,r;for(i=0,r;r=n[i];i++)Sd(e,r,t[r])}function J(e,t,n){if(typeof t=="string")if(n!==void 0)Sd(e,t,n);else return fE(e,t);else dE(e,t);return e}const hE=Object.prototype.toString;function Ce(e){return new Ii(e)}function Ii(e){if(!e||!e.nodeType)throw new Error("A DOM element reference is required");this.el=e,this.list=e.classList}Ii.prototype.add=function(e){return this.list.add(e),this},Ii.prototype.remove=function(e){return hE.call(e)=="[object RegExp]"?this.removeMatching(e):(this.list.remove(e),this)},Ii.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},Ii.prototype.toggle=function(e,t){return typeof t<"u"?t!==this.list.toggle(e,t)&&this.list.toggle(e):this.list.toggle(e),this},Ii.prototype.array=function(){return Array.from(this.list)},Ii.prototype.has=Ii.prototype.contains=function(e){return this.list.contains(e)};function Ga(e){for(var t;t=e.firstChild;)e.removeChild(t);return e}function Rd(e){return e.cloneNode(!0)}var Eu={svg:"http://www.w3.org/2000/svg"},Cd='<svg xmlns="'+Eu.svg+'"';function mE(e){var t=!1;e.substring(0,4)==="<svg"?e.indexOf(Eu.svg)===-1&&(e=Cd+e.substring(4)):(e=Cd+">"+e+"</svg>",t=!0);var n=gE(e);if(!t)return n;for(var i=document.createDocumentFragment(),r=n.firstChild;r.firstChild;)i.appendChild(r.firstChild);return i}function gE(e){var t;return t=new DOMParser,t.async=!1,t.parseFromString(e,"text/xml")}function ae(e,t){var n;return e=e.trim(),e.charAt(0)==="<"?(n=mE(e).firstChild,n=document.importNode(n,!0)):n=document.createElementNS(Eu.svg,e),t&&J(n,t),n}var wu=null;function Pd(){return wu===null&&(wu=ae("svg")),wu}function Ad(e,t){var n,i,r=Object.keys(t);for(n=0;i=r[n];n++)e[i]=t[i];return e}function vE(e,t,n,i,r,o){var a=Pd().createSVGMatrix();switch(arguments.length){case 0:return a;case 1:return Ad(a,e);case 6:return Ad(a,{a:e,b:t,c:n,d:i,e:r,f:o})}}function Co(e){return Pd().createSVGTransform()}var Td=/([&<>]{1})/g,yE=/([&<>\n\r"]{1})/g,_E={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"'"};function Su(e,t){function n(i,r){return _E[r]||r}return e.replace(t,n)}function Md(e,t){var n,i,r,o,a;switch(e.nodeType){case 3:t.push(Su(e.textContent,Td));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,'="',Su(o.value,yE),'"');if(e.hasChildNodes()){for(t.push(">"),a=e.childNodes,n=0,i=a.length;n<i;++n)Md(a.item(n),t);t.push("</",e.tagName,">")}else t.push("/>");break;case 8:t.push("<!--",Su(e.nodeValue,Td),"-->");break;case 4:t.push("<![CDATA[",e.nodeValue,"]]>");break;default:throw new Error("unable to handle node "+e.nodeType)}return t}function bE(e){for(var t=e.firstChild,n=[];t;)Md(t,n),t=t.nextSibling;return n.join("")}function kd(e,t){return bE(e)}function bt(e){var t=e.parentNode;return t&&t.removeChild(e),e}function xE(e,t){return t instanceof SVGMatrix?e.createSVGTransformFromMatrix(t):t}function EE(e,t){var n,i;for(e.clear(),n=0;i=t[n];n++)e.appendItem(xE(e,i))}function Po(e,t){var n=e.transform.baseVal;return t&&(Array.isArray(t)||(t=[t]),EE(n,t)),n.consolidate()}const wE=/^class[ {]/;function SE(e){return wE.test(e.toString())}function Ru(e){return Array.isArray(e)}function Cu(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function Wa(...e){e.length===1&&Ru(e[0])&&(e=e[0]),e=[...e];const t=e.pop();return t.$inject=e,t}const RE=/constructor\s*[^(]*\(\s*([^)]*)\)/m,CE=/^(?:async\s+)?(?:function\s*[^(]*)?(?:\(\s*([^)]*)\)|(\w+))/m,PE=/\/\*([^*]*)\*\//m;function AE(e){if(typeof e!="function")throw new Error(`Cannot annotate "${e}". Expected a function!`);const t=e.toString().match(SE(e)?RE:CE);if(!t)return[];const n=t[1]||t[2];return n&&n.split(",").map(i=>{const r=i.match(PE);return(r&&r[1]||i).trim()})||[]}function Dd(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(Cu(o,b))return o[b];if(Cu(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(Ru(b))b=Wa(b.slice());else throw s(`Cannot invoke "${b}". Expected a function!`);const A=(b.$inject||AE(b)).map(I=>Cu(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 Wa(x=>b.get(x))}function d(b,x){if(x&&x.length){const S=Object.create(null),A=Object.create(null),I=[],P=[],$=[];let j,L,F,ie;for(let Pe in r)j=r[Pe],x.indexOf(Pe)!==-1&&(j[2]==="private"?(L=I.indexOf(j[3]),L===-1?(F=j[3].createChild([],x),ie=f(F),I.push(j[3]),P.push(F),$.push(ie),S[Pe]=[ie,Pe,"private",F]):S[Pe]=[$[L],Pe,"private",P[L]]):S[Pe]=[j[2],j[1]],A[Pe]=!0),(j[2]==="factory"||j[2]==="type")&&j[1].$scope&&x.forEach(nt=>{j[1].$scope.indexOf(nt)!==-1&&(S[Pe]=[j[2],j[1]],A[nt]=!0)});x.forEach(Pe=>{if(!A[Pe])throw new Error('No provider for "'+Pe+'". Cannot use provider from the parent!')}),b.unshift(S)}return new Dd(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),P=d(I),$=Wa(function(L){return P.get(L)});x.forEach(function(L){r[L]=[$,L,"private",P]});const j=(b.__init__||[]).slice();return j.unshift(function(){P.init()}),b=Object.assign({},b,{__init__:j}),m(b,P)}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],P=A[1];r[S]=[h[I],TE(I,P),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 TE(e,t){return e!=="value"&&Ru(t)&&(t=Wa(t.slice())),t}var ME=1e3;function ci(e,t){var n=this;t=t||ME,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)})}ci.prototype.canRender=function(e){},ci.prototype.drawShape=function(e,t){},ci.prototype.drawConnection=function(e,t){},ci.prototype.getShapePath=function(e){},ci.prototype.getConnectionPath=function(e){};function gr(e){return e.flat().join(",").replace(/,?([A-Za-z]),?/g,"$1")}function kE(e){return["M",e.x,e.y]}function Pu(e){return["L",e.x,e.y]}function DE(e,t,n){return["C",e.x,e.y,t.x,t.y,n.x,n.y]}function OE(e,t){const n=e.length,i=[kE(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(Pu(a));continue}const c=Math.min(t,Au(a.x-o.x,a.y-o.y),Au(s.x-a.x,s.y-a.y));if(!c){i.push(Pu(a));continue}const u=Ua(a,o,c),l=Ua(a,o,c*.5),p=Ua(a,s,c),f=Ua(a,s,c*.5);i.push(Pu(u)),i.push(DE(l,f,p))}return i}function Ua(e,t,n){const i=t.x-e.x,r=t.y-e.y,o=Au(i,r),a=n/o;return{x:e.x+i*a,y:e.y+r*a}}function Au(e,t){return Math.sqrt(Math.pow(e,2)+Math.pow(t,2))}function Ao(e,t,n){de(t)&&(n=t,t=null),t||(t={});const i=ae("path",t);return de(n)&&(i.dataset.cornerRadius=String(n)),Tu(i,e)}function Tu(e,t){const n=parseInt(e.dataset.cornerRadius,10)||0;return J(e,{d:gr(OE(t,n))}),e}function qa(e){var t=new Set(e);return Ee(e,function(n){for(var i=n.parent;i;){if(t.has(i))return!1;i=i.parent}return!0})}function vr(e,t,n){n=n||0,le(e)||(e=[e]),T(e,function(i,r){var o=t(i,r,n);le(o)&&o.length&&vr(o,t,n+1)})}function Mu(e,t,n){var i=new Set,r=new Set;return vr(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 To(e,t){return Mu(e)}function IE(e,t,n){cr(t)&&(t=!0),Rt(t)&&(n=t,t=!0),n=n||{};var i=Mo(n.allShapes),r=Mo(n.allConnections),o=Mo(n.enclosedElements),a=Mo(n.enclosedConnections),s=Mo(n.topLevel,t&&Nr(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 vr(e,u),{allShapes:i,allConnections:r,topLevel:s,enclosedConnections:a,enclosedElements:o}}function ut(e,t){t=!!t,le(e)||(e=[e]);var n,i,r,o;return T(e,function(a){var s=a;a.waypoints&&!t&&(s=ut(a.waypoints,!0));var c=s.x,u=s.y,l=s.height||0,p=s.width||0;(c<n||n===void 0)&&(n=c),(u<i||i===void 0)&&(i=u),(c+p>r||r===void 0)&&(r=c+p),(u+l>o||o===void 0)&&(o=u+l)}),{x:n,y:i,height:o-i,width:r-n}}function zr(e,t){var n={};return T(e,function(i){var r=i;r.waypoints&&(r=ut(r)),!de(t.y)&&r.x>t.x&&(n[i.id]=i),!de(t.x)&&r.y>t.y&&(n[i.id]=i),r.x>t.x&&r.y>t.y&&(de(t.width)&&de(t.height)&&r.width+r.x<t.width+t.x&&r.height+r.y<t.height+t.y||!de(t.width)||!de(t.height))&&(n[i.id]=i)}),n}function Od(e){return"waypoints"in e?"connection":"x"in e?"shape":"root"}function Id(e){return!!(e&&e.isFrame)}function Mo(e,t){return D({},e||{},t||{})}var LE=1;function Li(e,t){ci.call(this,e,LE),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(Li,ci),Li.prototype.canRender=function(){return!0},Li.prototype.drawShape=function(t,n,i){var r=ae("rect");return J(r,{x:0,y:0,width:n.width||0,height:n.height||0}),Id(n)?J(r,D({},this.FRAME_STYLE,i||{})):J(r,D({},this.SHAPE_STYLE,i||{})),ge(t,r),r},Li.prototype.drawConnection=function(t,n,i){var r=Ao(n.waypoints,D({},this.CONNECTION_STYLE,i||{}));return ge(t,r),r},Li.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 gr(a)},Li.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 gr(o)},Li.$inject=["eventBus","styles"];function NE(){var e={"no-fill":{fill:"none"},"no-border":{strokeOpacity:0},"no-events":{pointerEvents:"none"}},t=this;this.cls=function(n,i,r){var o=this.style(i,r);return D(o,{class:n})},this.style=function(n,i){!le(n)&&!i&&(i=n,n=[]);var r=nn(n,function(o,a){return D(o,e[a]||{})},{});return i?D(r,i):r},this.computeStyle=function(n,i,r){return le(i)||(r=i,i=[]),t.style(i||[],D({},r,n||{}))}}const BE={__init__:["defaultRenderer"],defaultRenderer:["type",Li],styles:["type",NE]};function rt(e,t){if(!e||!t)return-1;var n=e.indexOf(t);return n!==-1&&e.splice(n,1),n}function at(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 ku(e,t){return!e||!t?-1:e.indexOf(t)}function ko(e,t){return!e||!t?-1:Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function Du(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=ko(e,t);return Math.abs(r/o)<=i}var $E=2;function ui(e,t){var n=Array.from(arguments).flat();const i={x:"v",y:"h"};for(const[r,o]of Object.entries(i))if(jE(r,n))return o;return!1}function jE(e,t){const n=t[0];return ur(t,function(i){return Math.abs(n[e]-i[e])<=$E})}function Ld(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 Ou(e,t){return{x:Math.round(e.x+(t.x-e.x)/2),y:Math.round(e.y+(t.y-e.y)/2)}}var FE=/,?([a-z]),?/gi,Nd=parseFloat,lt=Math,Ni=lt.PI,qn=lt.min,Yn=lt.max,Bd=lt.pow,Bi=lt.abs,HE=/([a-z])[\s,]*((-?\d*\.?\d*(?:e[-+]?\d+)?[\s]*,?[\s]*)+)/ig,zE=/(-?\d*\.?\d*(?:e[-+]?\d+)?)[\s]*,?[\s]*/ig,$d=Array.isArray||function(e){return e instanceof Array};function VE(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function GE(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 WE(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 VE(r,i)?(GE(o,i),r[i]):(o.length>=1e3&&delete r[o.shift()],o.push(i),r[i]=e(...arguments),r[i])}return t}function UE(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(HE,function(i,r,o){var a=[],s=r.toLowerCase();for(o.replace(zE,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=Lu,n}function qE(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 YE(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 Iu(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 Lu(){return this.join(",").replace(FE,"$1")}function KE(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=Lu,t}function jd(e,t,n,i,r,o,a,s,c){var u=1-c,l=Bd(u,3),p=Bd(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:Ya(h),y:Ya(m)}}function Fd(e){var t=tw(...e);return Iu(t.x0,t.y0,t.x1-t.x0,t.y1-t.y0)}function $i(e,t,n){return t>=e.x&&t<=e.x+e.width&&n>=e.y&&n<=e.y+e.height}function XE(e,t){return e=Iu(e),t=Iu(t),$i(t,e.x,e.y)||$i(t,e.x2,e.y)||$i(t,e.x,e.y2)||$i(t,e.x2,e.y2)||$i(e,t.x,t.y)||$i(e,t.x2,t.y)||$i(e,t.x,t.y2)||$i(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 Hd(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 zd(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=Hd(m,e,n,r,a),w=Hd(m,t,i,o,s),E=g*g+w*w;d+=f[h]*lt.sqrt(E)}return u*d}function ZE(e,t,n,i,r,o,a,s){if(!(Yn(e,n)<qn(r,a)||qn(e,n)>Yn(r,a)||Yn(t,i)<qn(o,s)||qn(t,i)>Yn(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=Ya(c/l),f=Ya(u/l),d=+p.toFixed(2),h=+f.toFixed(2);if(!(d<+qn(e,n).toFixed(2)||d>+Yn(e,n).toFixed(2)||d<+qn(r,a).toFixed(2)||d>+Yn(r,a).toFixed(2)||h<+qn(t,i).toFixed(2)||h>+Yn(t,i).toFixed(2)||h<+qn(o,s).toFixed(2)||h>+Yn(o,s).toFixed(2)))return{x:p,y:f}}}}function Ya(e){return Math.round(e*1e11)/1e11}function QE(e,t,n){var i=Fd(e),r=Fd(t);if(!XE(i,r))return[];var o=zd(...e),a=zd(...t),s=Gd(e)?1:~~(o/5)||1,c=Gd(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=jd(...e,d/s);u[d]={x:m.x,y:m.y,t:d/s}}for(d=0;d<c+1;d++)m=jd(...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=Bi(w.x-g.x)<.01?"y":"x",S=Bi(b.x-E.x)<.01?"y":"x",A=ZE(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 P=g.t+Bi((A[x]-g[x])/(w[x]-g[x]))*(w.t-g.t),$=E.t+Bi((A[S]-E[S])/(b[S]-E[S]))*(b.t-E.t);P>=0&&P<=1&&$>=0&&$<=1&&f.push({x:A.x,y:A.y,t1:P,t2:$})}}return f}function Vd(e,t,n){e=qd(e),t=qd(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=QE(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 JE(e){return $d(e)&&$d(e[0])}function ew(e){if(qE(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=Lu,t}function Gd(e){return e[0]===e[2]&&e[1]===e[3]&&e[4]===e[6]&&e[5]===e[7]}function Ka(e,t,n,i){return[e,t,n,i,n,i]}function Wd(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 Ud(e,t,n,i,r,o,a,s,c,u){var l=Ni*120/180,p=Ni/180*(+r||0),f=[],d,h=WE(function(R,_,v){var k=R*lt.cos(v)-_*lt.sin(v),O=R*lt.sin(v)+_*lt.cos(v);return{x:k,y:O}});if(u)I=u[0],P=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=lt.sqrt(w),n=w*n,i=w*i);var E=n*n,b=i*i,x=(o==a?-1:1)*lt.sqrt(Bi((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=lt.asin(((t-A)/i).toFixed(9)),P=lt.asin(((c-A)/i).toFixed(9));I=e<S?Ni-I:I,P=s<S?Ni-P:P,I<0&&(I=Ni*2+I),P<0&&(P=Ni*2+P),a&&I>P&&(I=I-Ni*2),!a&&P>I&&(P=P-Ni*2)}var $=P-I;if(Bi($)>l){var j=P,L=s,F=c;P=I+l*(a&&P>I?1:-1),s=S+n*lt.cos(P),c=A+i*lt.sin(P),f=Ud(s,c,n,i,r,0,a,L,F,[P,j,S,A])}$=P-I;var ie=lt.cos(I),Pe=lt.sin(I),nt=lt.cos(P),q=lt.sin(P),re=lt.tan($/4),ce=4/3*n*re,oe=4/3*i*re,se=[e,t],K=[e+ce*Pe,t-oe*ie],N=[s+ce*q,c-oe*nt],B=[s,c];if(K[0]=2*se[0]-K[0],K[1]=2*se[1]-K[1],u)return[K,N,B].concat(f);f=[K,N,B].concat(f).join().split(",");for(var V=[],be=0,wt=f.length;be<wt;be++)V[be]=be%2?h(f[be-1],f[be],p).y:h(f[be],f[be+1],p).x;return V}function tw(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),Bi(l)<1e-12){if(Bi(p)<1e-12)continue;d=-f/p,0<d&&d<1&&c.push(d);continue}g=p*p-4*f*l,w=lt.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:qn(...u[0]),y0:qn(...u[1]),x1:Yn(...u[0]),y1:Yn(...u[1])}}function qd(e){if(JE(e)||(e=UE(e)),YE(e))return e;for(var t=KE(ew(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",...Ud(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",...Wd(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",...Wd(d.x,d.y,f[1],f[2],f[3],f[4])];break;case"L":f=["C",...Ka(d.x,d.y,f[1],f[2])];break;case"H":f=["C",...Ka(d.x,d.y,f[1],d.y)];break;case"V":f=["C",...Ka(d.x,d.y,d.x,f[1])];break;case"Z":f=["C",...Ka(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=Nd(l[p-4])||n.x,n.by=Nd(l[p-3])||n.y}return t}function He(e){return Rt(e)&&tn(e,"waypoints")}function _e(e){return Rt(e)&&tn(e,"labelTarget")}function nw(e){return Rt(e)&&Ir(e.parent)}function Yd(e){return{x:Math.round(e.x),y:Math.round(e.y),width:Math.round(e.width),height:Math.round(e.height)}}function li(e){return{x:Math.round(e.x),y:Math.round(e.y)}}function ue(e){return{top:e.y,right:e.x+(e.width||0),bottom:e.y+(e.height||0),left:e.x}}function Xa(e){return{x:e.left,y:e.top,width:e.right-e.left,height:e.bottom-e.top}}function iw(e){return li({x:e.x+(e.width||0)/2,y:e.y+(e.height||0)/2})}function rw(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=sw(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 pe(e){return He(e)?rw(e):iw(e)}function Dt(e,t,n){n=n||0,Rt(n)||(n={x:n,y:n});var i=ue(e),r=ue(t),o=i.bottom+n.y<=r.top,a=i.left-n.x>=r.right,s=i.top-n.y>=r.bottom,c=i.right+n.x<=r.left,u=o?"top":s?"bottom":null,l=c?"left":a?"right":null;return l&&u?u+"-"+l:l||u||"intersect"}function Do(e,t,n){var i=ow(e,t);return i.length===1||i.length===2&&ko(i[0],i[1])<1?li(i[0]):i.length>1?(i=Hn(i,function(r){var o=Math.floor(r.t2*100)||1;return o=100-o,o=(o<10?"0":"")+o,r.segment2+"#"+o}),li(i[n?0:i.length-1])):null}function ow(e,t){return Vd(e,t)}function aw(e){e=e.slice();for(var t=0,n,i,r;e[t];)n=e[t],i=e[t-1],r=e[t+1],ko(n,r)===0||Du(i,r,n)?e.splice(t,1):t++;return e}function sw(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 Kd(e){return de(e)?e+"px":e}function cw(e){for(;e.parent;)e=e.parent;return e}function uw(e){e=D({},{width:"100%",height:"100%"},e);const t=e.container||document.body,n=document.createElement("div");return n.setAttribute("class","djs-container djs-parent"),Yt(n,{position:"relative",overflow:"hidden",width:Kd(e.width),height:Kd(e.height)}),t.appendChild(n),n}function Xd(e,t,n){const i=ae("g");Ce(i).add(t);const r=n!==void 0?n:e.childNodes.length-1;return e.insertBefore(i,e.childNodes[r]||null),i}const lw="base",Zd=0,pw=1,fw={shape:["x","y","width","height"],connection:["waypoints"]};function fe(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||{})}fe.$inject=["config.canvas","eventBus","graphicsFactory","elementRegistry"],fe.prototype._init=function(e){const t=this._eventBus,n=this._container=uw(e),i=this._svg=ae("svg");J(i,{width:"100%",height:"100%"}),zt(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=Xd(i,"viewport");e.deferUpdate&&(this._viewboxChanged=Qc(this._viewboxChanged,300)),this._restoreFocus=Qc(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)},fe.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},fe.prototype._setFocused=function(e){e!=this._focused&&(this._focused=e,this._eventBus.fire("canvas.focus.changed",{focused:e}))},fe.prototype._clear=function(){this._elementRegistry.getAll().forEach(t=>{const n=Od(t);n==="root"?this.removeRootElement(t):this._removeElement(t,n)}),this._planes=[],this._rootElement=null,delete this._cachedViewbox},fe.prototype.focus=function(){this._svg.focus({preventScroll:!0}),this._setFocused(!0)},fe.prototype.restoreFocus=function(){this._restoreFocus()},fe.prototype._restoreFocus=function(){document.activeElement===document.body&&this.focus()},fe.prototype.isFocused=function(){return this._focused},fe.prototype.getDefaultLayer=function(){return this.getLayer(lw,Zd)},fe.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},fe.prototype._getChildIndex=function(e){return nn(this._layers,function(t,n){return n.visible&&e>=n.index&&t++,t},0)},fe.prototype._createLayer=function(e,t){typeof t>"u"&&(t=pw);const n=this._getChildIndex(t);return{group:Xd(this._viewport,"layer-"+e,n),index:t,visible:!0}},fe.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},fe.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&&(bt(n),t.visible=!1),n},fe.prototype._removeLayer=function(e){const t=this._layers[e];t&&(delete this._layers[e],bt(t.group))},fe.prototype.getActiveLayer=function(){const e=this._findPlaneForRoot(this.getRootElement());return e?e.layer:null},fe.prototype.findRoot=function(e){const t=this._resolveElements(e);let n;for(const i of t){const r=this._findPlaneForRoot(cw(i));if(!r||n&&r.rootElement!==n)return;n=r.rootElement}return n},fe.prototype.getRootElements=function(){return this._planes.map(function(e){return e.rootElement})},fe.prototype._findPlaneForRoot=function(e){return Ge(this._planes,function(t){return t.rootElement===e})},fe.prototype._resolveElement=function(e){return typeof e=="string"?this._elementRegistry.get(e):e},fe.prototype._resolveElements=function(e){return le(e)||(e=[e]),e.map(t=>this._resolveElement(t)).filter(Boolean)},fe.prototype.getContainer=function(){return this._container},fe.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),Ce(r).add(t)):(e.markers.delete(t),Ce(r).remove(t)))}),this._eventBus.fire("element.marker.update",{element:e,gfx:i.gfx,marker:t,add:!!n}))},fe.prototype.addMarker=function(e,t){this._updateMarker(e,t,!0)},fe.prototype.removeMarker=function(e,t){this._updateMarker(e,t,!1)},fe.prototype.hasMarker=function(e,t){return e=this._resolveElement(e),e.markers?e.markers.has(t):!1},fe.prototype.toggleMarker=function(e,t){this.hasMarker(e,t)?this.removeMarker(e,t):this.addMarker(e,t)},fe.prototype.getRootElement=function(){const e=this._rootElement;return e||this._planes.length?e:this.setRootElement(this.addRootElement(null))},fe.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,Zd);return this.hideLayer(n),this._addRoot(e,i),this._planes.push({rootElement:e,layer:i}),e},fe.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},fe.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},fe.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)},fe.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})},fe.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})},fe.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=fw[e];if(!ur(n,function(r){return typeof t[r]<"u"}))throw new Error("must supply { "+n.join(", ")+" } with "+e)},fe.prototype._setParent=function(e,t,n){at(t.children,e,n),e.parent=t},fe.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},fe.prototype.addShape=function(e,t,n){return this._addElement("shape",e,t,n)},fe.prototype.addConnection=function(e,t,n){return this._addElement("connection",e,t,n)},fe.prototype._removeElement=function(e,t){const n=this._elementRegistry,i=this._graphicsFactory,r=this._eventBus;if(e=n.get(e.id||e),!!e)return r.fire(t+".remove",{element:e}),i.remove(e),rt(e.parent&&e.parent.children,e),e.parent=null,r.fire(t+".removed",{element:e}),n.remove(e),e},fe.prototype.removeShape=function(e){return this._removeElement(e,"shape")},fe.prototype.removeConnection=function(e){return this._removeElement(e,"connection")},fe.prototype.getGraphics=function(e,t){return this._elementRegistry.getGraphics(e,t)},fe.prototype._changeViewbox=function(e){this._eventBus.fire("canvas.viewbox.changing"),e.apply(this),this._cachedViewbox=null,this._viewboxChanged()},fe.prototype._viewboxChanged=function(){this._eventBus.fire("canvas.viewbox.changed",{viewbox:this.viewbox()})},fe.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);Po(t,l)});else return o=this._rootElement?this.getActiveLayer():null,i=o&&o.getBBox()||{},a=Po(t),r=a?a.matrix:vE(),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},fe.prototype.scroll=function(e){const t=this._viewport;let n=t.getCTM();return e&&this._changeViewbox(function(){e=D({dx:0,dy:0},e||{}),n=this._svg.createSVGMatrix().translate(e.dx,e.dy).multiply(n),Qd(t,n)}),{x:n.e,y:n.f}},fe.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=ut(o),s=ue(a),c=this.viewbox(),u=this.zoom();let l,p;c.y+=t.top/u,c.x+=t.left/u,c.width-=(t.right+t.left)/u,c.height-=(t.bottom+t.top)/u;const f=ue(c);if(!(a.width<c.width&&a.height<c.height))l=a.x-c.x,p=a.y-c.y;else{const h=Math.max(0,s.right-f.right),m=Math.min(0,s.left-f.left),g=Math.max(0,s.bottom-f.bottom),w=Math.min(0,s.top-f.top);l=h||m,p=g||w}this.scroll({dx:-l*u,dy:-p*u})},fe.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 Qd(e,t){const n="matrix("+t.a+","+t.b+","+t.c+","+t.d+","+t.e+","+t.f+")";e.setAttribute("transform",n)}fe.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},fe.prototype._setZoom=function(e,t){const n=this._svg,i=this._viewport,r=n.createSVGMatrix(),o=n.createSVGPoint();let a,s,c,u,l;c=i.getCTM();const p=c.a;return t?(a=D(o,t),s=a.matrixTransform(c.inverse()),u=r.translate(s.x,s.y).scale(1/p*e).translate(-s.x,-s.y),l=c.multiply(u)):l=r.scale(e),Qd(this._viewport,l),l},fe.prototype.getSize=function(){return{width:this._container.clientWidth,height:this._container.clientHeight}},fe.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}},fe.prototype.resized=function(){delete this._cachedViewbox,this._eventBus.fire("canvas.resized")};var Vr="data-element-id";function mn(e){this._elements={},this._eventBus=e}mn.$inject=["eventBus"],mn.prototype.add=function(e,t,n){var i=e.id;this._validateId(i),J(t,Vr,i),n&&J(n,Vr,i),this._elements[i]={element:e,gfx:t,secondaryGfx:n}},mn.prototype.remove=function(e){var t=this._elements,n=e.id||e,i=n&&t[n];i&&(J(i.gfx,Vr,""),i.secondaryGfx&&J(i.secondaryGfx,Vr,""),delete t[n])},mn.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)},mn.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,Vr,i),t},mn.prototype.get=function(e){var t;typeof e=="string"?t=e:t=e&&J(e,Vr);var n=this._elements[t];return n&&n.element},mn.prototype.filter=function(e){var t=[];return this.forEach(function(n,i){e(n,i)&&t.push(n)}),t},mn.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}},mn.prototype.getAll=function(){return this.filter(function(e){return e})},mn.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)})},mn.prototype.getGraphics=function(e,t){var n=e.id||e,i=this._elements[n];return i&&(t?i.secondaryGfx:i.gfx)},mn.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 dw(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 hw(e){return e.__refs_collection===!0}function mw(e,t){return Object.prototype.hasOwnProperty.call(e,t.name||t)}function Jd(e,t,n){var i=dw(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 gw(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 xn(e,t){if(!(this instanceof xn))return new xn(e,t);e.inverse=t,t.inverse=e,this.props={},this.props[e.name]=e,this.props[t.name]=t}xn.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?Jd(this,t,e):gw(this,t,e)},xn.prototype.ensureRefsCollection=function(e,t){var n=e[t.name];return hw(n)||Jd(this,t,e),n},xn.prototype.ensureBound=function(e,t){mw(e,t)||this.bind(e,t)},xn.prototype.unset=function(e,t,n){e&&(this.ensureBound(e,t),t.collection?this.ensureRefsCollection(e,t).remove(n):e[t.name]=void 0)},xn.prototype.set=function(e,t,n){e&&(this.ensureBound(e,t),t.collection?this.ensureRefsCollection(e,t).add(n):e[t.name]=n)};var Nu=new xn({name:"children",enumerable:!0,collection:!0},{name:"parent"}),eh=new xn({name:"labels",enumerable:!0,collection:!0},{name:"labelTarget"}),th=new xn({name:"attachers",collection:!0},{name:"host"}),nh=new xn({name:"outgoing",collection:!0},{name:"source"}),ih=new xn({name:"incoming",collection:!0},{name:"target"});function Gr(){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)}}),Nu.bind(this,"parent"),eh.bind(this,"labels"),nh.bind(this,"outgoing"),ih.bind(this,"incoming")}function Oo(){Gr.call(this),Nu.bind(this,"children"),th.bind(this,"host"),th.bind(this,"attachers")}Q(Oo,Gr);function rh(){Gr.call(this),Nu.bind(this,"children")}Q(rh,Oo);function oh(){Oo.call(this),eh.bind(this,"labelTarget")}Q(oh,Oo);function ah(){Gr.call(this),nh.bind(this,"source"),ih.bind(this,"target")}Q(ah,Gr);var vw={connection:ah,shape:Oo,label:oh,root:rh};function yw(e,t){var n=vw[e];if(!n)throw new Error("unknown type: <"+e+">");return D(new n,t)}function _w(e){return e instanceof Gr}function pi(){this._uid=12}pi.prototype.createRoot=function(e){return this.create("root",e)},pi.prototype.createLabel=function(e){return this.create("label",e)},pi.prototype.createShape=function(e){return this.create("shape",e)},pi.prototype.createConnection=function(e){return this.create("connection",e)},pi.prototype.create=function(e,t){return t=D({},t||{}),t.id||(t.id=e+"_"+this._uid++),yw(e,t)};var Qa="__fn",sh=1e3,bw=Array.prototype.slice;function on(){this._listeners={},this.on("diagram.destroy",1,this._destroy,this)}on.prototype.on=function(e,t,n,i){if(e=le(e)?e:[e],Ct(t)&&(i=n,n=t,t=sh),!de(t))throw new Error("priority must be a number");var r=n;i&&(r=Zt(n,i),r[Qa]=n[Qa]||n);var o=this;e.forEach(function(a){o._addListener(a,{priority:t,callback:r,next:null})})},on.prototype.once=function(e,t,n,i){var r=this;if(Ct(t)&&(i=n,n=t,t=sh),!de(t))throw new Error("priority must be a number");function o(){o.__isTomb=!0;var a=n.apply(i,arguments);return r.off(e,o),a}o[Qa]=n,this.on(e,t,o)},on.prototype.off=function(e,t){e=le(e)?e:[e];var n=this;e.forEach(function(i){n._removeListener(i,t)})},on.prototype.createEvent=function(e){var t=new Io;return t.init(e),t},on.prototype.fire=function(e,t){var n,i,r,o;if(o=bw.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 Io?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}},on.prototype.handleError=function(e){return this.fire("error",{error:e})===!1},on.prototype._destroy=function(){this._listeners={}},on.prototype._invokeListeners=function(e,t,n){for(var i;n&&!e.cancelBubble;)i=this._invokeListener(e,t,n),n=n.next;return i},on.prototype._invokeListener=function(e,t,n){var i;if(n.callback.__isTomb)return i;try{i=xw(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},on.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},on.prototype._getListeners=function(e){return this._listeners[e]},on.prototype._setListeners=function(e,t){this._listeners[e]=t},on.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[Qa]===t)&&(r?r.next=i:this._setListeners(e,i)),r=n,n=i};function Io(){}Io.prototype.stopPropagation=function(){this.cancelBubble=!0},Io.prototype.preventDefault=function(){this.defaultPrevented=!0},Io.prototype.init=function(e){D(this,e||{})};function xw(e,t){return e.apply(null,t)}function yr(e){return e.childNodes[0]}function Ew(e){return e.parentNode.childNodes[1]}function Ja(e,t,n,i,r){var o=Co();o.setTranslate(t,n);var a=Co();a.setRotate(i||0,0,0);var s=Co();s.setScale(1,1),Po(e,[o,a,s])}function Ot(e,t,n){var i=Co();i.setTranslate(t,n),Po(e,i)}function ch(e,t){var n=Co();n.setRotate(t,0,0),Po(e,n)}function gn(e,t){this._eventBus=e,this._elementRegistry=t}gn.$inject=["eventBus","elementRegistry"],gn.prototype._getChildrenContainer=function(e){var t=this._elementRegistry.getGraphics(e),n;return e.parent?(n=Ew(t),n||(n=ae("g"),Ce(n).add("djs-children"),ge(t.parentNode,n))):n=t,n},gn.prototype._clear=function(e){var t=yr(e);return Ha(t),t},gn.prototype._createContainer=function(e,t,n,i){var r=ae("g");Ce(r).add("djs-group"),typeof n<"u"?ww(r,t,t.childNodes[n]):ge(t,r);var o=ae("g");Ce(o).add("djs-element"),Ce(o).add("djs-"+e),i&&Ce(o).add("djs-frame"),ge(r,o);var a=ae("g");return Ce(a).add("djs-visual"),ge(o,a),o},gn.prototype.create=function(e,t,n){var i=this._getChildrenContainer(t.parent);return this._createContainer(e,i,n,Id(t))},gn.prototype.updateContainments=function(e){var t=this,n=this._elementRegistry,i;i=nn(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)})}})},gn.prototype.drawShape=function(e,t,n={}){var i=this._eventBus;return i.fire("render.shape",{gfx:e,element:t,attrs:n})},gn.prototype.getShapePath=function(e){var t=this._eventBus;return t.fire("render.getShapePath",e)},gn.prototype.drawConnection=function(e,t,n={}){var i=this._eventBus;return i.fire("render.connection",{gfx:e,element:t,attrs:n})},gn.prototype.getConnectionPath=function(e){var t=this._eventBus;return t.fire("render.getConnectionPath",e)},gn.prototype.update=function(e,t,n){if(t.parent){var i=this._clear(n);if(e==="shape")this.drawShape(i,t),Ot(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")}},gn.prototype.remove=function(e){var t=this._elementRegistry.getGraphics(e);bt(t.parentNode)};function ww(e,t,n){var i=n||t.firstChild;e!==i&&t.insertBefore(e,i)}const Sw={__depends__:[BE],__init__:["canvas"],canvas:["type",fe],elementRegistry:["type",mn],elementFactory:["type",pi],eventBus:["type",on],graphicsFactory:["type",gn]};function Rw(e){var t=new Dd(e);return t.init(),t}function Cw(e){e=e||{};var t={config:["value",e]},n=[t,Sw].concat(e.modules||[]);return Rw(n)}function ji(e,t){this._injector=t||Cw(e),this.get("eventBus").fire("diagram.init")}ji.prototype.get=function(e,t){return this._injector.get(e,t)},ji.prototype.invoke=function(e,t,n){return this._injector.invoke(e,t,n)},ji.prototype.destroy=function(){this.get("eventBus").fire("diagram.destroy")},ji.prototype.clear=function(){this.get("eventBus").fire("diagram.clear")};function Vt(e){return e?"<"+e.$type+(e.id?' id="'+e.id:"")+'" />':"<null>"}function Qt(e,t){return e.$instanceOf(t)}function Pw(e){return Ge(e.rootElements,function(t){return Qt(t,"bpmn:Process")||Qt(t,"bpmn:Collaboration")})}function Aw(e){var t={},n=[],i={};function r(N,B){return function(V){N(V,B)}}function o(N){t[N.id]=N}function a(N){return t[N.id]}function s(N,B){var V=N.gfx;if(V)throw new Error(`already rendered ${Vt(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 V=i[N.id]&&s(N,B);return o(N),V}catch(be){l(be.message,{element:N,error:be}),console.error(`failed to import ${Vt(N)}`,be)}}function l(N,B){e.error(N,B)}var p=this.registerDi=function(B){var V=B.bpmnElement;V?i[V.id]?l(`multiple DI elements defined for ${Vt(V)}`,{element:V}):i[V.id]=B:l(`no bpmnElement referenced in ${Vt(B)}`,{element:B})};function f(N){d(N.plane)}function d(N){p(N),T(N.planeElement,h)}function h(N){p(N)}this.handleDefinitions=function(B,V){var be=B.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 wt=V.plane;if(!wt)throw new Error(`no plane for ${Vt(V)}`);var R=wt.bpmnElement;if(!R)if(R=Pw(B),R)l(`correcting missing bpmnElement on ${Vt(wt)} to ${Vt(R)}`),wt.bpmnElement=R,p(wt);else throw new Error("no process or collaboration to display");var _=c(R,wt);if(Qt(R,"bpmn:Process")||Qt(R,"bpmn:SubProcess"))g(R,_);else if(Qt(R,"bpmn:Collaboration"))se(R,_),w(B.rootElements,_);else throw new Error(`unsupported bpmnElement for ${Vt(wt)}: ${Vt(R)}`);m(n)};var m=this.handleDeferred=function(){for(var B;n.length;)B=n.shift(),B()};function g(N,B){re(N,B),$(N.ioSpecification,B),P(N.artifacts,B),o(N)}function w(N,B){var V=Ee(N,function(be){return!a(be)&&Qt(be,"bpmn:Process")&&be.laneSets});V.forEach(r(g,B))}function E(N,B){u(N,B)}function b(N,B){T(N,r(E,B))}function x(N,B){u(N,B)}function S(N,B){u(N,B)}function A(N,B){u(N,B)}function I(N,B){u(N,B)}function P(N,B){T(N,function(V){Qt(V,"bpmn:Association")?n.push(function(){I(V,B)}):I(V,B)})}function $(N,B){N&&(T(N.dataInputs,r(S,B)),T(N.dataOutputs,r(A,B)))}var j=this.handleSubProcess=function(B,V){re(B,V),P(B.artifacts,V)};function L(N,B){var V=u(N,B);Qt(N,"bpmn:SubProcess")&&j(N,V||B),Qt(N,"bpmn:Activity")&&$(N.ioSpecification,B),n.push(function(){T(N.dataInputAssociations,r(x,B)),T(N.dataOutputAssociations,r(x,B))})}function F(N,B){u(N,B)}function ie(N,B){u(N,B)}function Pe(N,B){n.push(function(){var V=u(N,B);N.childLaneSet&&nt(N.childLaneSet,V||B),K(N)})}function nt(N,B){T(N.lanes,r(Pe,B))}function q(N,B){T(N,r(nt,B))}function re(N,B){ce(N.flowElements,B),N.laneSets&&q(N.laneSets,B)}function ce(N,B){T(N,function(V){Qt(V,"bpmn:SequenceFlow")?n.push(function(){F(V,B)}):Qt(V,"bpmn:BoundaryEvent")?n.unshift(function(){L(V,B)}):Qt(V,"bpmn:FlowNode")?L(V,B):Qt(V,"bpmn:DataObject")||(Qt(V,"bpmn:DataStoreReference")||Qt(V,"bpmn:DataObjectReference")?ie(V,B):l(`unrecognized flowElement ${Vt(V)} in context ${Vt(B&&B.businessObject)}`,{element:V,context:B}))})}function oe(N,B){var V=u(N,B),be=N.processRef;be&&g(be,V||B)}function se(N,B){T(N.participants,r(oe,B)),n.push(function(){b(N.messageFlows,B)}),P(N.artifacts,B)}function K(N){T(N.flowNodeRef,function(B){var V=B.get("lanes");V&&V.push(N)})}}function y(e,t){var n=U(e);return n&&typeof n.$instanceOf=="function"&&n.$instanceOf(t)}function xe(e,t){return Ci(t,function(n){return y(e,n)})}function U(e){return e&&e.businessObject||e}function Me(e){return e&&e.di}function Tw(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 Aw(p);l=l||u.diagrams&&u.diagrams[0];var d=Mw(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 Mw(e,t){if(!(!t||!t.plane)){var n=t.plane.bpmnElement,i=n;!y(n,"bpmn:Process")&&!y(n,"bpmn:Collaboration")&&(i=kw(n));var r;y(i,"bpmn:Collaboration")?r=i:r=Ge(e.rootElements,function(u){if(y(u,"bpmn:Collaboration"))return Ge(u.participants,function(l){return l.processRef===i})});var o=[i];r&&(o=jt(r.participants,function(u){return u.processRef}),o.push(r));var a=uh(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 uh(e){var t=[];return T(e,function(n){n&&(t.push(n),t=t.concat(uh(n.flowElements)))}),t}function kw(e){for(var t=e;t;){if(y(t,"bpmn:Process"))return t;t=t.$parent}}var Dw='<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>',lh=Dw,ph={verticalAlign:"middle"},fh={color:"#404040"},Ow={zIndex:"1001",position:"fixed",top:"0",left:"0",right:"0",bottom:"0"},Iw={width:"100%",height:"100%",background:"rgba(40,40,40,0.2)"},Lw={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"},Nw='<div class="bjs-powered-by-lightbox"><div class="backdrop"></div><div class="notice"><a href="https://bpmn.io" target="_blank" rel="noopener" class="link">'+lh+'</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>',Kn;function Bw(){Kn=Ue(Nw),Yt(Kn,Ow),Yt(je("svg",Kn),ph),Yt(je(".backdrop",Kn),Iw),Yt(je(".notice",Kn),Lw),Yt(je(".link",Kn),fh,{margin:"15px 20px 15px 10px",alignSelf:"center"})}function $w(){Kn||(Bw(),rn.bind(Kn,".backdrop","click",function(e){document.body.removeChild(Kn)})),document.body.appendChild(Kn)}const es=5,dh="djs-outline-hidden";function Qe(e){e=D({},Fw,e),this._moddle=this._createModdle(e),this._container=this._createContainer(e),this._init(this._container,this._moddle,e),zw(this._container)}Q(Qe,ji),Qe.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||[]),ts(s,o),s=jw(s),this._emit("import.done",{error:s,warnings:s.warnings}),s}},Qe.prototype.importDefinitions=async function(t,n){return this._setDefinitions(t),{warnings:(await this.open(n)).warnings}},Qe.prototype.open=async function(t){const n=this._definitions;let i=t;if(!n){const o=new Error("no XML imported");throw ts(o,[]),o}if(typeof t=="string"&&(i=Hw(n,t),!i)){const o=new Error("BPMNDiagram <"+t+"> not found");throw ts(o,[]),o}try{this.clear()}catch(o){throw ts(o,[]),o}const{warnings:r}=await Tw(this,n,i);return{warnings:r}},Qe.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},Qe.prototype.saveSVG=async function(){this._emit("saveSVG.start");let t,n;try{const i=this.get("canvas"),r=i.getActiveLayer(),o=je(":scope > defs",i._svg),a=kd(r),s=o?"<defs>"+kd(o)+"</defs>":"",c=i.getContainer();Xe(c).add(dh);let u;try{u=r.getBBox()}finally{Xe(c).remove(dh)}const l=u.x-es,p=u.y-es,f=u.width+es*2,d=u.height+es*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}},Ke.prototype._setDefinitions=function(e){this._definitions=e},Ke.prototype.getModules=function(){return this._modules},Ke.prototype.clear=function(){this.getDefinitions()&&Si.prototype.clear.call(this)},Ke.prototype.destroy=function(){Si.prototype.destroy.call(this),On(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=$e(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(An(n,["additionalModules"]),{canvas:k({},n.canvas,{container:e}),modules:a});Si.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=We('<div class="bjs-container"></div>');return zt(t,{width:Hd(e.width),height:Hd(e.height),position:e.position}),t},Ke.prototype._createModdle=function(e){const t=k({},this._moddleExtensions,e.moddleExtensions);return new hf(t)},Ke.prototype._modules=[];function Na(e,t){return e.warnings=t,e}function lw(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 pw={width:"100%",height:"100%",position:"relative"};function Hd(e){return e+(me(e)?"px":"")}function fw(e,t){return t&&ze(e.diagrams,function(n){return n.id===t})||null}function dw(e){const n='<a href="http://bpmn.io" target="_blank" class="bjs-powered-by" title="Powered by bpmn.io" >'+Nd+"</a>",i=We(n);zt($e("svg",i),$d),zt(i,jd,{position:"absolute",bottom:"15px",right:"15px",zIndex:"100"}),e.appendChild(i),ve.bind(i,"click",function(r){uw(),r.preventDefault()})}function Tr(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)}X(Tr,Ke),Tr.prototype._createModdle=function(e){var t=Ke.prototype._createModdle.call(this,e);return t.ids=new Dn([32,36,1]),t},Tr.prototype._collectIds=function(e,t){var n=e.$model,i=n.ids,r;i.clear();for(r in t)i.claim(r,t[r])};function Pe(e,t){return y(e,"bpmn:CallActivity")?!1:y(e,"bpmn:SubProcess")?(t=t||De(e),t&&y(t,"bpmndi:BPMNPlane")?!0:t&&!!t.isExpanded):y(e,"bpmn:Participant")?!!U(e).processRef:!0}function Et(e){if(!(!y(e,"bpmn:Participant")&&!y(e,"bpmn:Lane"))){var t=De(e).isHorizontal;return t===void 0?!0:t}}function hw(e){return e&&U(e).isInterrupting!==!1}function Nt(e){return e&&!!U(e).triggeredByEvent}function Mr(e,t){var n=U(e).eventDefinitions;return di(n,function(i){return y(i,t)})}function mw(e){return Mr(e,"bpmn:ErrorEventDefinition")}function gw(e){return Mr(e,"bpmn:EscalationEventDefinition")}function vw(e){return Mr(e,"bpmn:CompensateEventDefinition")}var rr={width:90,height:20},zd=15;function Ri(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 $a(e){return xe(e.label)}function yw(e){var t=e.length/2-1,n=e[Math.floor(t)],i=e[Math.ceil(t+.01)],r=_w(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-=zd:a+=zd,{x:a,y:s}}function _w(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 mu(e){return e.waypoints?yw(e.waypoints):y(e,"bpmn:Group")?{x:e.x+e.width/2,y:e.y+rr.height/2}:{x:e.x+e.width/2,y:e.y+e.height+rr.height/2}}function bw(e,t){var n,i,r,o=e.label;return o&&o.bounds?(r=o.bounds,i={width:Math.max(rr.width,r.width),height:r.height},n={x:r.x+r.width/2,y:r.y+r.height/2}):(n=mu(t),i=rr),k({x:n.x-i.width/2,y:n.y-i.height/2},i)}function Vd(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 xw(e){var t=e.categoryValueRef;return t&&t.value||""}function un(e){var t=e.businessObject,n=Vd(t);if(n)return n==="categoryValueRef"?xw(t):t[n]||""}function Ew(e,t){var n=e.businessObject,i=Vd(n);if(i)if(i==="categoryValueRef"){if(!n[i])return e;n[i].value=t}else n[i]=t;return e}function ww(e){return xe(e)&&Ri(e.labelTarget)}var kr=7;function Gd(e){let t=[];return P(e.incoming,n=>{y(n,"bpmn:Association")&&y(n.source,"bpmn:TextAnnotation")&&t.push({annotation:n.source,association:n})}),P(e.outgoing,n=>{y(n,"bpmn:Association")&&y(n.target,"bpmn:TextAnnotation")&&t.push({annotation:n.target,association:n})}),t}function _o(e){const t=new Map;return P(cu(e),n=>{P(Gd(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 gu="hsl(225, 10%, 15%)",Sw="white";function Nn(e,t){return di(e.eventDefinitions,function(n){return n.$type===t})}function Rw(e){return e.$type==="bpmn:IntermediateThrowEvent"||e.$type==="bpmn:EndEvent"}function Cw(e){var t=e.dataObjectRef;return e.isCollection||t&&t.isCollection}function Ce(e,t,n){var i=De(e);return n||i.get("color:background-color")||i.get("bioc:fill")||t||Sw}function K(e,t,n){var i=De(e);return n||i.get("color:border-color")||i.get("bioc:stroke")||t||gu}function bo(e,t,n,i){var r=De(e),o=r.get("label");return i||o&&o.get("color:color")||t||K(e,n)}function Wd(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 tr(r)}function vu(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 tr(a)}function Pw(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 tr(s)}function Aw(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 tr(o)}function xo(e,t={}){return{width:fn(e,t),height:Qt(e,t)}}function fn(e,t={}){return Yt(t,"width")?t.width:e.width}function Qt(e,t={}){return Yt(t,"height")?t.height:e.height}var Tw=new Dn,Mw=10,ja=3,kw=1.5,Fa=10,Dw=4,Dr=.95,Ow=1,Iw=.25;function or(e,t,n,i,r,o,a){Yn.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:gu,strokeWidth:2,fill:"white"})}function p(R){return n.computeStyle(R,["no-fill"],{strokeLinecap:"round",strokeLinejoin:"round",stroke:gu,strokeWidth:2})}function f(R,_){var{ref:v={x:0,y:0},scale:M=1,element:O,parentGfx:z=r._svg}=_,J=oe("marker",{id:R,viewBox:"0 0 20 20",refX:v.x,refY:v.y,markerWidth:20*M,markerHeight:20*M,orient:"auto"});ye(J,O);var ge=$e(":scope > defs",z);ge||(ge=oe("defs"),ye(z,ge)),ye(ge,J)}function d(R,_,v,M){var O=Tw.nextPrefixed("marker-");return h(R,O,_,v,M),"url(#"+O+")"}function h(R,_,v,M,O){if(v==="sequenceflow-end"){var z=oe("path",{d:"M 1 5 L 11 10 L 1 15 Z",...l({fill:O,stroke:O,strokeWidth:1})});f(_,{element:z,ref:{x:11,y:10},scale:.5,parentGfx:R})}if(v==="messageflow-start"){var J=oe("circle",{cx:6,cy:6,r:3.5,...l({fill:M,stroke:O,strokeWidth:1,strokeDasharray:[1e4,1]})});f(_,{element:J,ref:{x:6,y:6},parentGfx:R})}if(v==="messageflow-end"){var ge=oe("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:ge,ref:{x:8.5,y:5},parentGfx:R})}if(v==="association-start"){var Ie=oe("path",{d:"M 11 5 L 1 10 L 11 15",...p({fill:"none",stroke:O,strokeWidth:1.5,strokeDasharray:[1e4,1]})});f(_,{element:Ie,ref:{x:1,y:10},scale:.5,parentGfx:R})}if(v==="association-end"){var tt=oe("path",{d:"M 1 5 L 11 10 L 1 15",...p({fill:"none",stroke:O,strokeWidth:1.5,strokeDasharray:[1e4,1]})});f(_,{element:tt,ref:{x:11,y:10},scale:.5,parentGfx:R})}if(v==="conditional-flow-marker"){var Ne=oe("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=oe("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={}){bt(M)&&(O=M,M=0),M=M||0,O=l(O);var z=_/2,J=v/2,ge=oe("circle",{cx:z,cy:J,r:Math.round((_+v)/4-M),...O});return ye(R,ge),ge}function g(R,_,v,M,O,z){bt(O)&&(z=O,O=0),O=O||0,z=l(z);var J=oe("rect",{x:O,y:O,width:_-O*2,height:v-O*2,rx:M,ry:M,...z});return ye(R,J),J}function w(R,_,v,M){var O=_/2,z=v/2,J=[{x:O,y:0},{x:_,y:z},{x:O,y:v},{x:0,y:z}],ge=J.map(function(tt){return tt.x+","+tt.y}).join(" ");M=l(M);var Ie=oe("polygon",{...M,points:ge});return ye(R,Ie),Ie}function E(R,_,v,M){v=p(v);var O=po(_,v,M);return ye(R,O),O}function b(R,_,v){return E(R,_,v,5)}function x(R,_,v){v=p(v);var M=oe("path",{...v,d:_});return ye(R,M),M}function S(R,_,v,M){return x(_,v,k({"data-marker":R},M))}function A(R){return _t[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}}),z=M?K(_,c,v.stroke):Ce(_,s,v.fill),J=M?Ce(_,s,v.fill):K(_,c,v.stroke),ge=x(R,O,{fill:z,stroke:J,strokeWidth:1});return ge},"bpmn:TimerEventDefinition":function(R,_,v={}){var M=v.width||_.width,O=v.height||_.height,z=v.width?1:2,J=m(R,M,O,.2*O,{fill:Ce(_,s,v.fill),stroke:K(_,c,v.stroke),strokeWidth:z}),ge=i.getScaledPath("EVENT_TIMER_WH",{xScaleFactor:.75,yScaleFactor:.75,containerWidth:M,containerHeight:O,position:{mx:.5,my:.5}});x(R,ge,{stroke:K(_,c,v.stroke),strokeWidth:z});for(var Ie=0;Ie<12;Ie++){var tt=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,tt,{strokeWidth:1,stroke:K(_,c,v.stroke),transform:"rotate("+Ie*30+","+ft+","+Ne+")"})}return J},"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}}),z=M?K(_,c,v.stroke):Ce(_,s,v.fill);return x(R,O,{fill:z,stroke:K(_,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:Ce(_,s,v.fill),stroke:K(_,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}}),z=M?K(_,c,v.stroke):Ce(_,s,v.fill);return x(R,O,{fill:z,stroke:K(_,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}}),z=M?K(_,c,v.stroke):Ce(_,s,v.fill);return x(R,O,{fill:z,stroke:K(_,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}}),z=M?K(_,c,v.stroke):"none",J=x(R,O,{fill:z,stroke:K(_,c,v.stroke),strokeWidth:1});return Ld(J,45),J},"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}}),z=M?K(_,c,v.stroke):Ce(_,s,v.fill);return x(R,O,{fill:z,stroke:K(_,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}}),z=M?K(_,c,v.stroke):Ce(_,s,v.fill);return x(R,O,{strokeWidth:1,fill:z,stroke:K(_,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}}),z=M?K(_,c,v.stroke):Ce(_,s,v.fill);return x(R,O,{fill:z,stroke:K(_,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:Ce(_,s,v.fill),stroke:K(_,c,v.stroke),strokeWidth:1})},"bpmn:TerminateEventDefinition":function(R,_,v={}){var M=m(R,_.width,_.height,8,{fill:K(_,c,v.stroke),stroke:K(_,c,v.stroke),strokeWidth:4});return M}};function $(R,_,v={},M){var O=U(R),z=Rw(O),J=M||R;return O.get("eventDefinitions")&&O.get("eventDefinitions").length>1?O.get("parallelMultiple")?C["bpmn:ParallelMultipleEventDefinition"](_,J,v,z):C["bpmn:MultipleEventDefinition"](_,J,v,z):Nn(O,"bpmn:MessageEventDefinition")?C["bpmn:MessageEventDefinition"](_,J,v,z):Nn(O,"bpmn:TimerEventDefinition")?C["bpmn:TimerEventDefinition"](_,J,v,z):Nn(O,"bpmn:ConditionalEventDefinition")?C["bpmn:ConditionalEventDefinition"](_,J,v,z):Nn(O,"bpmn:SignalEventDefinition")?C["bpmn:SignalEventDefinition"](_,J,v,z):Nn(O,"bpmn:EscalationEventDefinition")?C["bpmn:EscalationEventDefinition"](_,J,v,z):Nn(O,"bpmn:LinkEventDefinition")?C["bpmn:LinkEventDefinition"](_,J,v,z):Nn(O,"bpmn:ErrorEventDefinition")?C["bpmn:ErrorEventDefinition"](_,J,v,z):Nn(O,"bpmn:CancelEventDefinition")?C["bpmn:CancelEventDefinition"](_,J,v,z):Nn(O,"bpmn:CompensateEventDefinition")?C["bpmn:CompensateEventDefinition"](_,J,v,z):Nn(O,"bpmn:TerminateEventDefinition")?C["bpmn:TerminateEventDefinition"](_,J,v,z):null}var j={ParticipantMultiplicityMarker:function(R,_,v={}){var M=fn(_,v),O=Qt(_,v),z=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,z,{strokeWidth:2,fill:Ce(_,s,v.fill),stroke:K(_,c,v.stroke)})},SubProcessMarker:function(R,_,v={}){var M=g(R,14,14,0,{strokeWidth:1,fill:Ce(_,s,v.fill),stroke:K(_,c,v.stroke)});Ct(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:Ce(_,s,v.fill),stroke:K(_,c,v.stroke)})},ParallelMarker:function(R,_,v){var M=fn(_,v),O=Qt(_,v),z=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,z,{fill:Ce(_,s,v.fill),stroke:K(_,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:Ce(_,s,v.fill),stroke:K(_,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:Ce(_,s,v.fill),stroke:K(_,c,v.stroke)})},LoopMarker:function(R,_,v){var M=fn(_,v),O=Qt(_,v),z=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,z,{strokeWidth:1.5,fill:"none",stroke:K(_,c,v.stroke),strokeMiterlimit:.5})},AdhocMarker:function(R,_,v){var M=fn(_,v),O=Qt(_,v),z=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,z,{strokeWidth:1,fill:K(_,c,v.stroke),stroke:K(_,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:fn(_,M),height:Qt(_,M)};var O=U(_),z=v.includes("SubProcessMarker");z?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"),z||k(M,{compensation:M.compensation-18}));var J=O.get("loopCharacteristics"),ge=J&&J.get("isSequential");J&&(k(M,{compensation:M.compensation-18}),v.includes("AdhocMarker")&&k(M,{seq:-23,loop:-18,parallel:-24}),ge===void 0&&v.push("LoopMarker"),ge===!1&&v.push("ParallelMarker"),ge===!0&&v.push("SequentialMarker")),v.includes("CompensationMarker")&&v.length===1&&k(M,{compensation:-8}),P(v,function(Ie){L(Ie,R,_,M)})}function te(R,_,v={}){v=k({size:{width:100}},v);var M=o.createText(_||"",v);return Me(M).add("djs-label"),ye(R,M),M}function ke(R,_,v,M={}){var O=U(_),z=xo({x:_.x,y:_.y,width:_.width,height:_.height},M);return te(R,O.name,{align:v,box:z,padding:7,style:{fill:bo(_,u,c,M.stroke)}})}function Je(R,_,v={}){var M={width:_.width,height:_.height,x:_.width/2+_.x,y:_.height/2+_.y};return te(R,un(_),{box:M,style:k({},o.getExternalStyle(),{fill:bo(_,u,c,v.stroke)})})}function q(R,_,v,M={}){var O=Et(v),z=te(R,_,{box:{height:30,width:O?Qt(v,M):fn(v,M)},align:"center-middle",style:{fill:bo(v,u,c,M.stroke)}});if(O){var J=-1*Qt(v,M);La(z,0,-J,270)}}function ne(R,_,v={}){var{width:M,height:O}=xo(_,v);return g(R,M,O,Fa,{...v,fill:Ce(_,s,v.fill),fillOpacity:Dr,stroke:K(_,c,v.stroke)})}function ce(R,_,v={}){var M=U(_),O=Ce(_,s,v.fill),z=K(_,c,v.stroke);return(M.get("associationDirection")==="One"||M.get("associationDirection")==="Both")&&(v.markerEnd=d(R,"association-end",O,z)),M.get("associationDirection")==="Both"&&(v.markerStart=d(R,"association-start",O,z)),v=Oe(v,["markerStart","markerEnd"]),b(R,_.waypoints,{...v,stroke:z,strokeDasharray:"0, 5"})}function ee(R,_,v={}){var M=Ce(_,s,v.fill),O=K(_,c,v.stroke),z=i.getScaledPath("DATA_OBJECT_PATH",{xScaleFactor:1,yScaleFactor:1,containerWidth:_.width,containerHeight:_.height,position:{mx:.474,my:.296}}),J=x(R,z,{fill:M,fillOpacity:Dr,stroke:O}),ge=U(_);if(Cw(ge)){var Ie=i.getScaledPath("DATA_OBJECT_COLLECTION_PATH",{xScaleFactor:1,yScaleFactor:1,containerWidth:_.width,containerHeight:_.height,position:{mx:.33,my:(_.height-18)/_.height}});x(R,Ie,{strokeWidth:2,fill:M,stroke:O})}return J}function ae(R,_,v={}){return m(R,_.width,_.height,{fillOpacity:Dr,...v,fill:Ce(_,s,v.fill),stroke:K(_,c,v.stroke)})}function Y(R,_,v={}){return w(R,_.width,_.height,{fill:Ce(_,s,v.fill),fillOpacity:Dr,stroke:K(_,c,v.stroke)})}function B(R,_,v={}){var M=g(R,fn(_,v),Qt(_,v),0,{fill:Ce(_,s,v.fill),fillOpacity:v.fillOpacity||Dr,stroke:K(_,c,v.stroke),strokeWidth:1.5}),O=U(_);if(y(O,"bpmn:Lane")){var z=O.get("name");q(R,z,_,v)}return M}function N(R,_,v={}){var M=ne(R,_,v),O=Pe(_);if(Nt(_)&&(Z(M,{strokeDasharray:"0, 5.5",strokeWidth:2.5}),!O)){var z=U(_).flowElements||[],J=z.filter(ge=>y(ge,"bpmn:StartEvent"));J.length===1&&V(J[0],R,v,_)}return ke(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,z={fill:Ce(M,s,v.fill),stroke:K(M,c,v.stroke),width:O,height:O},J=U(R).isInterrupting,ge=J?0:3,Ie=J?1:1.2,tt=20,Ne=(O-tt)/2,ft="translate("+Ne+","+Ne+")";m(_,tt,tt,{fill:z.fill,stroke:z.stroke,strokeWidth:Ie,strokeDasharray:ge,transform:ft}),$(R,_,z,M)}function Ee(R,_,v={}){var M=ne(R,_,v);return ke(R,_,"center-middle",v),F(R,_,void 0,v),M}var _t=this.handlers={"bpmn:AdHocSubProcess":function(R,_,v={}){return Pe(_)?v=Oe(v,["fill","stroke","width","height"]):v=Oe(v,["fill","stroke"]),N(R,_,v)},"bpmn:Association":function(R,_,v={}){return v=Oe(v,["fill","stroke"]),ce(R,_,v)},"bpmn:BoundaryEvent":function(R,_,v={}){var{renderIcon:M=!0}=v;v=Oe(v,["fill","stroke"]);var O=U(_),z=O.get("cancelActivity");v={strokeWidth:1.5,fill:Ce(_,s,v.fill),fillOpacity:Ow,stroke:K(_,c,v.stroke)},z||(v.strokeDasharray="6");var J=ae(R,_,v);return m(R,_.width,_.height,ja,{...v,fill:"none"}),M&&$(_,R,v),J},"bpmn:BusinessRuleTask":function(R,_,v={}){v=Oe(v,["fill","stroke"]);var M=Ee(R,_,v),O=i.getScaledPath("TASK_TYPE_BUSINESS_RULE_MAIN",{abspos:{x:8,y:8}}),z=x(R,O);Z(z,{fill:Ce(_,s,v.fill),stroke:K(_,c,v.stroke),strokeWidth:1});var J=i.getScaledPath("TASK_TYPE_BUSINESS_RULE_HEADER",{abspos:{x:8,y:8}}),ge=x(R,J);return Z(ge,{fill:K(_,c,v.stroke),stroke:K(_,c,v.stroke),strokeWidth:1}),M},"bpmn:CallActivity":function(R,_,v={}){return v=Oe(v,["fill","stroke"]),N(R,_,{strokeWidth:5,...v})},"bpmn:ComplexGateway":function(R,_,v={}){v=Oe(v,["fill","stroke"]);var M=Y(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:K(_,c,v.stroke),stroke:K(_,c,v.stroke),strokeWidth:1}),M},"bpmn:DataInput":function(R,_,v={}){v=Oe(v,["fill","stroke"]);var M=i.getRawPath("DATA_ARROW"),O=ee(R,_,v);return x(R,M,{fill:"none",stroke:K(_,c,v.stroke),strokeWidth:1}),O},"bpmn:DataInputAssociation":function(R,_,v={}){return v=Oe(v,["fill","stroke"]),ce(R,_,{...v,markerEnd:d(R,"association-end",Ce(_,s,v.fill),K(_,c,v.stroke))})},"bpmn:DataObject":function(R,_,v={}){return v=Oe(v,["fill","stroke"]),ee(R,_,v)},"bpmn:DataObjectReference":I("bpmn:DataObject"),"bpmn:DataOutput":function(R,_,v={}){v=Oe(v,["fill","stroke"]);var M=i.getRawPath("DATA_ARROW"),O=ee(R,_,v);return x(R,M,{strokeWidth:1,fill:K(_,c,v.stroke),stroke:K(_,c,v.stroke)}),O},"bpmn:DataOutputAssociation":function(R,_,v={}){return v=Oe(v,["fill","stroke"]),ce(R,_,{...v,markerEnd:d(R,"association-end",Ce(_,s,v.fill),K(_,c,v.stroke))})},"bpmn:DataStoreReference":function(R,_,v={}){v=Oe(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:Ce(_,s,v.fill),fillOpacity:Dr,stroke:K(_,c,v.stroke),strokeWidth:2})},"bpmn:EndEvent":function(R,_,v={}){var{renderIcon:M=!0}=v;v=Oe(v,["fill","stroke"]);var O=ae(R,_,{...v,strokeWidth:4});return M&&$(_,R,v),O},"bpmn:EventBasedGateway":function(R,_,v={}){v=Oe(v,["fill","stroke"]);var M=U(_),O=Y(R,_,v);m(R,_.width,_.height,_.height*.2,{fill:Ce(_,"none",v.fill),stroke:K(_,c,v.stroke),strokeWidth:1});var z=M.get("eventGatewayType"),J=!!M.get("instantiate");function ge(){var tt=i.getScaledPath("GATEWAY_EVENT_BASED",{xScaleFactor:.18,yScaleFactor:.18,containerWidth:_.width,containerHeight:_.height,position:{mx:.36,my:.44}});x(R,tt,{fill:"none",stroke:K(_,c,v.stroke),strokeWidth:2})}if(z==="Parallel"){var Ie=i.getScaledPath("GATEWAY_PARALLEL",{xScaleFactor:.4,yScaleFactor:.4,containerWidth:_.width,containerHeight:_.height,position:{mx:.474,my:.296}});x(R,Ie,{fill:"none",stroke:K(_,c,v.stroke),strokeWidth:1})}else z==="Exclusive"&&(J||m(R,_.width,_.height,_.height*.26,{fill:"none",stroke:K(_,c,v.stroke),strokeWidth:1}),ge());return O},"bpmn:ExclusiveGateway":function(R,_,v={}){v=Oe(v,["fill","stroke"]);var M=Y(R,_,v),O=i.getScaledPath("GATEWAY_EXCLUSIVE",{xScaleFactor:.4,yScaleFactor:.4,containerWidth:_.width,containerHeight:_.height,position:{mx:.32,my:.3}}),z=De(_);return z.get("isMarkerVisible")&&x(R,O,{fill:K(_,c,v.stroke),stroke:K(_,c,v.stroke),strokeWidth:1}),M},"bpmn:Gateway":function(R,_,v={}){return v=Oe(v,["fill","stroke"]),Y(R,_,v)},"bpmn:Group":function(R,_,v={}){return v=Oe(v,["fill","stroke","width","height"]),g(R,_.width,_.height,Fa,{stroke:K(_,c,v.stroke),strokeWidth:1.5,strokeDasharray:"10, 6, 0, 6",fill:"none",pointerEvents:"none",width:fn(_,v),height:Qt(_,v)})},"bpmn:InclusiveGateway":function(R,_,v={}){v=Oe(v,["fill","stroke"]);var M=Y(R,_,v);return m(R,_.width,_.height,_.height*.24,{fill:Ce(_,s,v.fill),stroke:K(_,c,v.stroke),strokeWidth:2.5}),M},"bpmn:IntermediateEvent":function(R,_,v={}){var{renderIcon:M=!0}=v;v=Oe(v,["fill","stroke"]);var O=ae(R,_,{...v,strokeWidth:1.5});return m(R,_.width,_.height,ja,{fill:"none",stroke:K(_,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=Oe(v,["fill","stroke","width","height"]),B(R,_,{...v,fillOpacity:Iw})},"bpmn:ManualTask":function(R,_,v={}){v=Oe(v,["fill","stroke"]);var M=Ee(R,_,v),O=i.getScaledPath("TASK_TYPE_MANUAL",{abspos:{x:17,y:15}});return x(R,O,{fill:Ce(_,s,v.fill),stroke:K(_,c,v.stroke),strokeWidth:.5}),M},"bpmn:MessageFlow":function(R,_,v={}){v=Oe(v,["fill","stroke"]);var M=U(_),O=De(_),z=Ce(_,s,v.fill),J=K(_,c,v.stroke),ge=b(R,_.waypoints,{markerEnd:d(R,"messageflow-end",z,J),markerStart:d(R,"messageflow-start",z,J),stroke:J,strokeDasharray:"10, 11",strokeWidth:1.5});if(M.get("messageRef")){var Ie=ge.getPointAtLength(ge.getTotalLength()/2),tt=i.getScaledPath("MESSAGE_FLOW_MARKER",{abspos:{x:Ie.x,y:Ie.y}}),Ne={strokeWidth:1};O.get("messageVisibleKind")==="initiating"?(Ne.fill=z,Ne.stroke=J):(Ne.fill=J,Ne.stroke=z);var ft=x(R,tt,Ne),Tt=M.get("messageRef"),T=Tt.get("name"),D=te(R,T,{align:"center-top",fitBox:!0,style:{fill:J}}),H=ft.getBBox(),Q=D.getBBox(),le=Ie.x-Q.width/2,re=Ie.y+H.height/2+Mw;La(D,le,re,0)}return ge},"bpmn:ParallelGateway":function(R,_,v={}){v=Oe(v,["fill","stroke"]);var M=Y(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:K(_,c,v.stroke),stroke:K(_,c,v.stroke),strokeWidth:1}),M},"bpmn:Participant":function(R,_,v={}){v=Oe(v,["fill","stroke","width","height"]);var M=B(R,_,v),O=Pe(_),z=Et(_),J=U(_),ge=J.get("name");if(O){var Ie=z?[{x:30,y:0},{x:30,y:Qt(_,v)}]:[{x:0,y:30},{x:fn(_,v),y:30}];E(R,Ie,{stroke:K(_,c,v.stroke),strokeWidth:kw}),q(R,ge,_,v)}else{var tt=xo(_,v);z||(tt.height=fn(_,v),tt.width=Qt(_,v));var Ne=te(R,ge,{box:tt,align:"center-middle",style:{fill:bo(_,u,c,v.stroke)}});if(!z){var ft=-1*Qt(_,v);La(Ne,0,-ft,270)}}return J.get("participantMultiplicity")&&L("ParticipantMultiplicityMarker",R,_,v),M},"bpmn:ReceiveTask":function(R,_,v={}){v=Oe(v,["fill","stroke"]);var M=U(_),O=Ee(R,_,v),z;return M.get("instantiate")?(m(R,28,28,20*.22,{fill:Ce(_,s,v.fill),stroke:K(_,c,v.stroke),strokeWidth:1}),z=i.getScaledPath("TASK_TYPE_INSTANTIATING_SEND",{abspos:{x:7.77,y:9.52}})):z=i.getScaledPath("TASK_TYPE_SEND",{xScaleFactor:.9,yScaleFactor:.9,containerWidth:21,containerHeight:14,position:{mx:.3,my:.4}}),x(R,z,{fill:Ce(_,s,v.fill),stroke:K(_,c,v.stroke),strokeWidth:1}),O},"bpmn:ScriptTask":function(R,_,v={}){v=Oe(v,["fill","stroke"]);var M=Ee(R,_,v),O=i.getScaledPath("TASK_TYPE_SCRIPT",{abspos:{x:15,y:20}});return x(R,O,{fill:Ce(_,s,v.fill),stroke:K(_,c,v.stroke),strokeWidth:1}),M},"bpmn:SendTask":function(R,_,v={}){v=Oe(v,["fill","stroke"]);var M=Ee(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:K(_,c,v.stroke),stroke:Ce(_,s,v.fill),strokeWidth:1}),M},"bpmn:SequenceFlow":function(R,_,v={}){v=Oe(v,["fill","stroke"]);var M=Ce(_,s,v.fill),O=K(_,c,v.stroke),z=b(R,_.waypoints,{markerEnd:d(R,"sequenceflow-end",M,O),stroke:O}),J=U(_),{source:ge}=_;if(ge){var Ie=U(ge);J.get("conditionExpression")&&y(Ie,"bpmn:Activity")&&Z(z,{markerStart:d(R,"conditional-flow-marker",M,O)}),Ie.get("default")&&(y(Ie,"bpmn:Gateway")||y(Ie,"bpmn:Activity"))&&Ie.get("default")===J&&Z(z,{markerStart:d(R,"conditional-default-flow-marker",M,O)})}return z},"bpmn:ServiceTask":function(R,_,v={}){v=Oe(v,["fill","stroke"]);var M=Ee(R,_,v);m(R,10,10,{fill:Ce(_,s,v.fill),stroke:"none",transform:"translate(6, 6)"});var O=i.getScaledPath("TASK_TYPE_SERVICE",{abspos:{x:12,y:18}});x(R,O,{fill:Ce(_,s,v.fill),stroke:K(_,c,v.stroke),strokeWidth:1}),m(R,10,10,{fill:Ce(_,s,v.fill),stroke:"none",transform:"translate(11, 10)"});var z=i.getScaledPath("TASK_TYPE_SERVICE",{abspos:{x:17,y:22}});return x(R,z,{fill:Ce(_,s,v.fill),stroke:K(_,c,v.stroke),strokeWidth:1}),M},"bpmn:StartEvent":function(R,_,v={}){var{renderIcon:M=!0}=v;v=Oe(v,["fill","stroke"]);var O=U(_);O.get("isInterrupting")||(v={...v,strokeDasharray:"6"});var z=ae(R,_,v);return M&&$(_,R,v),z},"bpmn:SubProcess":function(R,_,v={}){return Pe(_)?v=Oe(v,["fill","stroke","width","height"]):v=Oe(v,["fill","stroke"]),N(R,_,v)},"bpmn:Task":function(R,_,v={}){return v=Oe(v,["fill","stroke"]),Ee(R,_,v)},"bpmn:TextAnnotation":function(R,_,v={}){v=Oe(v,["fill","stroke"]);var{width:M,height:O}=xo(_,v),z=g(R,M,O,0,0,{fill:"none",stroke:"none"}),J=i.getScaledPath("TEXT_ANNOTATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:M,containerHeight:O,position:{mx:0,my:0}});x(R,J,{stroke:K(_,c,v.stroke)});var ge=U(_),Ie=ge.get("text")||"";return te(R,Ie,{align:"left-top",box:xo(_,v),padding:kr,style:{fill:bo(_,u,c,v.stroke)}}),z},"bpmn:Transaction":function(R,_,v={}){Pe(_)?v=Oe(v,["fill","stroke","width","height"]):v=Oe(v,["fill","stroke"]);var M=N(R,_,{strokeWidth:1.5,...v}),O=n.style(["no-fill","no-events"],{stroke:K(_,c,v.stroke),strokeWidth:1.5}),z=Pe(_);return z||(v={}),g(R,fn(_,v),Qt(_,v),Fa-ja,ja,O),M},"bpmn:UserTask":function(R,_,v={}){v=Oe(v,["fill","stroke"]);var M=Ee(R,_,v),O=15,z=12,J=i.getScaledPath("TASK_TYPE_USER_1",{abspos:{x:O,y:z}});x(R,J,{fill:Ce(_,s,v.fill),stroke:K(_,c,v.stroke),strokeWidth:.5});var ge=i.getScaledPath("TASK_TYPE_USER_2",{abspos:{x:O,y:z}});x(R,ge,{fill:Ce(_,s,v.fill),stroke:K(_,c,v.stroke),strokeWidth:.5});var Ie=i.getScaledPath("TASK_TYPE_USER_3",{abspos:{x:O,y:z}});return x(R,Ie,{fill:K(_,c,v.stroke),stroke:K(_,c,v.stroke),strokeWidth:.5}),M},label:function(R,_,v={}){return Je(R,_,v)}};this._drawPath=x,this._renderer=A}X(or,Yn),or.$inject=["config.bpmnRenderer","eventBus","styles","pathMap","canvas","textRenderer"],or.prototype.canRender=function(e){return y(e,"bpmn:BaseElement")},or.prototype.drawShape=function(e,t,n={}){var{type:i}=t,r=this._renderer(i);return r(e,t,n)},or.prototype.drawConnection=function(e,t,n={}){var{type:i}=t,r=this._renderer(i);return r(e,t,n)},or.prototype.getShapePath=function(e){return xe(e)?vu(e,Dw):y(e,"bpmn:Event")?Wd(e):y(e,"bpmn:Activity")?vu(e,Fa):y(e,"bpmn:Gateway")?Pw(e):Aw(e)};function Oe(e,t=[]){return t.reduce((n,i)=>(e[i]&&(n[i]=e[i]),n),{})}var Lw=0,Bw={width:150,height:50};function Nw(e){var t=e.split("-");return{horizontal:t[0]||"center",vertical:t[1]||"top"}}function $w(e){return bt(e)?k({top:0,left:0,right:0,bottom:0},e):{top:e,left:e,right:e,bottom:e}}var yu=null;function jw(){return yu||(yu=document.createElement("canvas").getContext("2d")),yu}function Fw(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(Ud(e.fontSize)||"12px"),t.push(e.fontFamily||"sans-serif"),t.join(" ")}function Ud(e){if(e!=null)return typeof e=="number"||/^-?\d+(\.\d+)?$/.test(e)?e+"px":e}function Hw(e,t){var n=jw();if(!n)return{width:0,height:0};n.font=Fw(t),"letterSpacing"in n&&(n.letterSpacing=Ud(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 zw(e,t,n){for(var i=e.shift(),r=i,o;;){if(o=Hw(r,n),o.width=r?o.width:0,r===" "||r===""||o.width<Math.round(t)||r.length<2)return Vw(e,r,i,o);r=Ww(r,o.width,t)}}function Vw(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 qd="­";function Gw(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===qd)&&r.pop();break}var a=r[r.length-1];return a&&a===qd&&(r[r.length-1]="-"),r.join("")}function Ww(e,t,n){var i=Math.max(e.length*(n/t),1),r=Gw(e,i);return r||(r=e.slice(0,Math.max(Math.round(i-1),1))),r}function Ha(e){this._config=k({},{size:Bw,padding:Lw,style:{},align:"center-top"},e||{})}Ha.prototype.createText=function(e,t){return this.layoutText(e,t).element},Ha.prototype.getDimensions=function(e,t){return this.layoutText(e,t).dimensions},Ha.prototype.layoutText=function(e,t){for(var n=k({},this._config.size,t.box),i=k({},this._config.style,t.style),r=Nw(t.align||this._config.align),o=$w(t.padding!==void 0?t.padding:this._config.padding),a=t.fitBox||!1,s=Uw(i),c=e.split(/\u00AD?\r?\n/),u=[],l=n.width-o.left-o.right;c.length;)u.push(zw(c,l,i));r.vertical==="middle"&&(o.top=o.bottom=0);var p=Kt(u,function(g,w,E){return g+(s||w.height)},0)+o.top+o.bottom,f=Kt(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=oe("text");Z(h,i),P(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=oe("tspan");Z(E,{x:w,y:d}),E.textContent=g.text,ye(h,E)});var m={width:f,height:p};return{dimensions:m,element:h}};function Uw(e){if("fontSize"in e&&"lineHeight"in e)return e.lineHeight*parseInt(e.fontSize,10)}var qw=12,Yw=1.2,Kw=40;function Yd(e){var t=k({fontFamily:"Arial, sans-serif",fontSize:qw,fontWeight:"normal",lineHeight:Yw},e&&e.defaultStyle||{}),n=parseInt(t.fontSize,10)-1,i=k({},t,{fontSize:n},e&&e.externalStyle||{}),r=new Ha({style:t});this.getExternalLabelBounds=function(a,s){var c={width:Math.max(a.width,rr.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:kr});return{x:a.x,y:a.y,width:a.width,height:Math.max(Kw,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}}Yd.$inject=["config.textRenderer"];function Xw(){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=e1(i.d,{mx:r,my:o,e:a});return p}}var Zw=/\{([^{}]+)\}/g,Qw=/(?:(?:^|\.)(.+?)(?=\[|\.|$|\()|\[('|")(.+?)\2\])(\(\))?/g;function Jw(e,t,n){var i=n;return t.replace(Qw,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 e1(e,t){return String(e).replace(Zw,function(n,i){return Jw(n,i,t)})}const t1={__init__:["bpmnRenderer"],bpmnRenderer:["type",or],textRenderer:["type",Yd],pathMap:["type",Xw]};function n1(e,t){return t=t||{},e.replace(/{([^}]+)}/g,function(n,i){return t[i]||"{"+i+"}"})}const Eo={translate:["value",n1]};function za(e,t,n){return k({id:e.id,type:e.$type,businessObject:e,di:t},n)}function i1(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 Kd(e,t,n){return new Error(`element ${Bt(t)} referenced by ${Bt(e)}#${n} not yet drawn`)}function Qn(e,t,n,i,r){this._eventBus=e,this._canvas=t,this._elementFactory=n,this._elementRegistry=i,this._textRenderer=r}Qn.$inject=["eventBus","canvas","elementFactory","elementRegistry","textRenderer"],Qn.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=!Pe(e,t),c=o1(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")&&(r1(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:i1(t,l,p)})),y(e,"bpmn:DataAssociation")&&(n=this._canvas.findRoot(n)),this._canvas.addConnection(i,n,o)}else throw new Error(`unknown di ${Bt(t)} for element ${Bt(e)}`);return Ri(e)&&un(i)&&this.addLabel(e,t,i),this._eventBus.fire("bpmnElement.added",{element:i}),i},Qn.prototype._attachBoundary=function(e,t){var n=e.attachedToRef;if(!n)throw new Error(`missing ${Bt(e)}#attachedToRef`);var i=this._elementRegistry.get(n.id),r=i&&i.attachers;if(!i)throw Kd(e,n,"attachedToRef");t.host=i,r||(i.attachers=r=[]),r.indexOf(t)===-1&&r.push(t)},Qn.prototype.addLabel=function(e,t,n){var i,r,o;return i=bw(t,n),r=un(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||!un(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)},Qn.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?Kd(e,i,t+"Ref"):new Error(`${Bt(e)}#${t} Ref not specified`)},Qn.prototype._getSource=function(e){return this._getConnectedElement(e,"source")},Qn.prototype._getTarget=function(e){return this._getConnectedElement(e,"target")},Qn.prototype._getElement=function(e){return this._elementRegistry.get(e.id)};function r1(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 o1(e){return y(e,"bpmn:Group")}const Xd={__depends__:[t1,{__depends__:[Eo],bpmnImporter:["type",Qn]}]};function wo(e){return{x:e.x+e.width/2,y:e.y+e.height/2}}function Rn(e,t){return{x:e.x-t.x,y:e.y-t.y}}function _u(e){return Math.log(e)/Math.log(10)}var a1=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((xt(t)||me(t))&&(o=r,r=i,i=n,n=t,t=null),xt(n)&&(o=r,r=i,i=n,n=a1),bt(r)&&(o=r,r=!1),!xt(i))throw new Error("handlerFn must be a function");pe(e)||(e=[e]);var a=this._eventBus;P(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=Jn("canExecute"),W.prototype.preExecute=Jn("preExecute"),W.prototype.preExecuted=Jn("preExecuted"),W.prototype.execute=Jn("execute"),W.prototype.executed=Jn("executed"),W.prototype.postExecute=Jn("postExecute"),W.prototype.postExecuted=Jn("postExecuted"),W.prototype.revert=Jn("revert"),W.prototype.reverted=Jn("reverted");function Jn(e){return function(n,i,r,o,a){(xt(n)||me(n))&&(a=o,o=r,r=i,i=n,n=null),this.on(n,e,i,r,o,a)}}var bu=["top","bottom","left","right"],Va=10;function xu(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($a(r)&&!je(r)){var o=l1(r);o&&i(r,o)}}function i(r,o){var a=fe(r),s=r.label,c=fe(s);if(s.parent){var u=ue(r),l;switch(o){case"top":l={x:a.x,y:u.top-Va-s.height/2};break;case"left":l={x:u.left-Va-s.width/2,y:a.y};break;case"bottom":l={x:a.x,y:u.bottom+Va+s.height/2};break;case"right":l={x:u.right+Va+s.width/2,y:a.y};break}var p=Rn(l,c);t.moveShape(s,p)}}}X(xu,W),xu.$inject=["eventBus","modeling"];function c1(e){var t=e.host,n=fe(e),i=Rt(n,t),r;i.indexOf("-")>=0?r=i.split("-"):r=[i];var o=bu.filter(function(a){return r.indexOf(a)===-1});return o}function u1(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 Zd(t,i)});return n}function l1(e){var t=fe(e.label),n=fe(e),i=Zd(n,t);if(p1(i)){var r=u1(e);if(e.host){var o=c1(e);r=r.concat(o)}var a=bu.filter(function(s){return r.indexOf(s)===-1});return a.indexOf(i)!==-1?Rt(e.label,e)!=="intersect"?void 0:i:a[0]}}function Zd(e,t){return Rt(t,e,5)}function p1(e){return bu.indexOf(e)!==-1}function Eu(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)}X(Eu,W),Eu.$inject=["eventBus"];var f1=1500;function wu(e,t,n){e.invoke(W,this),this.preExecute("elements.delete",f1,function(r){var o=r.context,a=o.elements,s=i(a);s.length&&(o.elements=a.concat(s))}),t.on("shape.move.start",function(r){var o=r.context.shapes,a=i(o);a.length&&(r.context.shapes=o.concat(a))});function i(r){var o=Re(r,u=>y(u,"bpmn:Participant")||y(u,"bpmn:SubProcess"));if(!o.length)return[];var a=n.getRootElement(),s=new Set(a.children.filter(u=>y(u,"bpmn:Artifact"))),c=new Set;return P(o,u=>{const l=new Set(_r(Cr(Array.from(s),at(u))));c=c.union(l),s=s.difference(l)}),Array.from(c)}}X(wu,W),wu.$inject=["injector","eventBus","canvas"];function Su(e,t){e.invoke(W,this),this.postExecute("shape.move",function(n){var i=n.newParent,r=n.shape,o=Re(r.incoming.concat(r.outgoing),function(a){return y(a,"bpmn:Association")});P(o,function(a){t.moveConnection(a,{x:0,y:0},i)})},!0)}X(Su,W),Su.$inject=["injector","modeling"];function Or(e,t){for(qt(t)&&(t=[t]);e=e.parent;)if(Se(e,t))return e;return null}function Qd(e,t){var n=Or(e,"bpmn:Process");if(n)return!0;var i=["bpmn:Participant","bpmn:Lane"];if(n=Or(e,i),n)return Et(n);if(Se(e,i))return Et(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?Et(o):!0}var Jd=500;function Ga(e,t){t.invoke(W,this),this._bpmnReplace=e;var n=this;this.postExecuted("elements.create",Jd,function(i){var r=i.elements;r=r.filter(function(o){var a=o.host;return eh(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",Jd,function(i){var r=i.shapes,o=i.newHost;if(r.length===1){var a=r[0];eh(a,o)&&(i.shapes=[n._replaceShape(a,o)])}},!0)}Ga.$inject=["bpmnReplace","injector"],X(Ga,W),Ga.prototype._replaceShape=function(e,t){var n=d1(e),i={type:"bpmn:BoundaryEvent",host:t};return n&&(i.eventDefinitionType=n.$type),this._bpmnReplace.replaceElement(e,i,{layoutConnection:!1})};function d1(e){var t=U(e),n=t.eventDefinitions;return n&&n[0]}function eh(e,t){return!xe(e)&&Se(e,["bpmn:IntermediateThrowEvent","bpmn:IntermediateCatchEvent"])&&!!t}function Ru(e,t){W.call(this,e);function n(i){return Re(i.attachers,function(r){return y(r,"bpmn:BoundaryEvent")})}this.postExecute("connection.create",function(i){var r=i.context.source,o=i.context.target,a=n(o);y(r,"bpmn:EventBasedGateway")&&y(o,"bpmn:ReceiveTask")&&a.length>0&&t.removeElements(a)}),this.postExecute("connection.reconnect",function(i){var r=i.context.oldSource,o=i.context.newSource;y(r,"bpmn:Gateway")&&y(o,"bpmn:EventBasedGateway")&&P(o.outgoing,function(a){var s=a.target,c=n(s);y(s,"bpmn:ReceiveTask")&&c.length>0&&t.removeElements(c)})})}Ru.$inject=["eventBus","modeling"],X(Ru,W);function th(e){return e.create("bpmn:Category")}function h1(e){return e.create("bpmn:CategoryValue")}function nh(e,t){var n=t.get("categoryValueRef");return n||(n=t.categoryValueRef=h1(e)),n.$parent||(n.$parent=th(e)),n}function m1(e,t,n){return it(t.get("categoryValue"),e),e.$parent=t,it(n.get("rootElements"),t),t.$parent=n,e}function g1(e){var t=e.$parent;return t&&(et(t.get("categoryValue"),e),e.$parent=null),e}function v1(e){var t=e.$parent;return t&&(et(t.get("rootElements"),e),e.$parent=null),e}var y1=500;function Cu(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&&m1(c,u,e.getDefinitions())}function s(c,u,l){u&&!o(u,l)&&v1(u),c&&!r(c,l)&&g1(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"],y1,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){ih(c).forEach(function(u){a(u.categoryValue,u.category)})},!0),this.reverted("group.updateRefs",function(c){ih(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)}Cu.$inject=["bpmnjs","elementRegistry","injector"],X(Cu,W);function ih(e){var t;return((t=e.updates)==null?void 0:t.groups)||[]}function Pu(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;Ir(w)&&So(E)&&l(E)}function r(g){const w=g.connection,E=g.source,b=g.target;Ir(E)&&Wa(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;So(b)&&l(b),Ir(x)&&Wa(w)&&u(w)}}function a(g){const{element:w}=g;So(w)?(p(w),d(w)):Wa(w)&&h(w)}function s(g){const{newData:w,oldShape:E}=g;if(Ir(g.oldShape)&&w.eventDefinitionType!=="bpmn:CompensateEventDefinition"||w.type!=="bpmn:BoundaryEvent"){const b=E.outgoing.find(({target:x})=>So(x));b&&b.target&&(g._connectionTarget=b.target)}else if(!Ir(g.oldShape)&&w.eventDefinitionType==="bpmn:CompensateEventDefinition"&&w.type==="bpmn:BoundaryEvent"){const b=E.outgoing.find(({target:x})=>Wa(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=>So(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=>Ir(E.source));t.removeElements(w)}function m(g){const w=g.outgoing.filter(E=>y(E,"bpmn:SequenceFlow"));t.removeElements(w)}}X(Pu,W),Pu.$inject=["eventBus","modeling","bpmnRules"];function So(e){const t=U(e);return t&&t.get("isForCompensation")}function Ir(e){return e&&y(e,"bpmn:BoundaryEvent")&&Mr(e,"bpmn:CompensateEventDefinition")}function Wa(e){return e&&y(e,"bpmn:Activity")&&!Nt(e)}function Au(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=Or(i,"bpmn:Participant"))})}Au.$inject=["injector"],X(Au,W);function Tu(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}})}Tu.$inject=["eventBus","bpmnFactory"],X(Tu,W);var Mu=20,ku=20,rh=30,Ua=2e3;function Du(e,t,n){W.call(this,t),t.on(["create.start","shape.move.start"],Ua,function(r){var o=r.context,a=o.shape,s=e.getRootElement();if(!(!y(a,"bpmn:Participant")||!y(s,"bpmn:Process")||!s.children.length)){var c=s.children.filter(function(p){return!y(p,"bpmn:Group")&&!xe(p)&&!je(p)});if(c.length){var u=at(c),l=_1(a,u);k(a,l),o.createConstraints=b1(a,u)}}}),t.on("create.start",Ua,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",Ua,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",Ua,function(r){var o=r.elements,a=r.parent,s=x1(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)}Du.$inject=["canvas","eventBus","modeling"],X(Du,W);function _1(e,t){t={width:t.width+Mu*2+rh,height:t.height+ku*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 b1(e,t){return t=ue(t),{bottom:t.top+e.height/2-ku,left:t.right-e.width/2+Mu,top:t.bottom-e.height/2+ku,right:t.left+e.width/2-Mu-rh}}function x1(e){return ze(e,function(t){return y(t,"bpmn:Participant")})}var oh="__targetRef_placeholder";function Ou(e,t){W.call(this,e),this.executed(["connection.create","connection.delete","connection.move","connection.reconnect"],ah(o)),this.reverted(["connection.create","connection.delete","connection.move","connection.reconnect"],ah(o));function n(a,s,c){var u=a.get("dataInputAssociations");return ze(u,function(l){return l!==c&&l.targetRef===s})}function i(a,s){var c=a.get("properties"),u=ze(c,function(l){return l.name===oh});return!u&&s&&(u=t.create("bpmn:Property",{name:oh}),it(c,u)),u}function r(a,s){var c=i(a);c&&(n(a,c,s)||et(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}}Ou.$inject=["eventBus","bpmnFactory"],X(Ou,W);function ah(e){return function(t){var n=t.context,i=n.connection;if(y(i,"bpmn:DataInputAssociation"))return e(t)}}function qa(e){this._bpmnUpdater=e}qa.$inject=["bpmnUpdater"],qa.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),[]},qa.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 Iu(e,t,n,i){W.call(this,i),t.registerHandler("dataStore.updateContainment",qa);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:De(s),newSemanticParent:l.processRef||l,newDiParent:De(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:w1(l,"bpmn:Participant");a(u,f)}}),this.postExecute("shape.delete",function(s){var c=s.context,u=c.shape,l=e.getRootElement();Se(u,["bpmn:Participant","bpmn:SubProcess"])&&y(l,"bpmn:Collaboration")&&o(l).filter(function(p){return E1(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)})})}Iu.$inject=["canvas","commandStack","elementRegistry","eventBus"],X(Iu,W);function E1(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 w1(e,t){for(;e.parent;){if(y(e.parent,t))return e.parent;e=e.parent}}var Ya=Math.max,Ka=Math.min,S1=20;function sh(e,t){return{top:e.top-t.top,right:e.right-t.right,bottom:e.bottom-t.bottom,left:e.left-t.left}}function R1(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 C1(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 Xa(e,t,n){var i=t[e],r=n.min&&n.min[e],o=n.max&&n.max[e];return me(r)&&(i=(/top|left/.test(e)?Ka:Ya)(i,r)),me(o)&&(i=(/top|left/.test(e)?Ya:Ka)(i,o)),i}function P1(e,t){if(!t)return e;var n=ue(e);return Da({top:Xa("top",n,t),right:Xa("right",n,t),bottom:Xa("bottom",n,t),left:Xa("left",n,t)})}function A1(e,t,n,i){var r=ue(t),o={top:/n/.test(e)?r.bottom-n.height:r.top,left:/w/.test(e)?r.right-n.width:r.left,bottom:/s/.test(e)?r.top+n.height:r.bottom,right:/e/.test(e)?r.left+n.width:r.right},a=i?ue(i):o,s={top:Ka(o.top,a.top),left:Ka(o.left,a.left),bottom:Ya(o.bottom,a.bottom),right:Ya(o.right,a.right)};return Da(s)}function Ro(e,t){return typeof e<"u"?e:S1}function T1(e,t){var n,i,r,o;return typeof t=="object"?(n=Ro(t.left),i=Ro(t.right),r=Ro(t.top),o=Ro(t.bottom)):n=i=r=o=Ro(t),{x:e.x-n,y:e.y-r,width:e.width+n+i,height:e.height+r+o}}function M1(e){return!(e.waypoints||e.type==="label")}function ch(e,t){var n;if(e.length===void 0?n=Re(e.children,M1):n=e,n.length)return T1(at(n),t)}var Ci=Math.abs;function k1(e,t){return sh(ue(t),ue(e))}var D1=["bpmn:Participant","bpmn:Process","bpmn:SubProcess"],dn=30;function Za(e,t){return t=t||[],e.children.filter(function(n){y(n,"bpmn:Lane")&&(Za(n,t),t.push(n))}),t}function Pi(e){return e.children.filter(function(t){return y(t,"bpmn:Lane")})}function hn(e){return Or(e,D1)||e}function O1(e,t){var n=hn(e),i=y(n,"bpmn:Process")?[]:[n],r=Za(n,i),o=ue(e),a=ue(t),s=k1(e,t),c=[],u=Et(e);return r.forEach(function(l){if(l!==e){var p=u?0:s.top,f=u?s.right:0,d=u?0:s.bottom,h=u?s.left:0,m=ue(l);s.top&&(Ci(m.bottom-o.top)<10&&(d=a.top-m.bottom),Ci(m.top-o.top)<5&&(p=a.top-m.top)),s.left&&(Ci(m.right-o.left)<10&&(f=a.left-m.right),Ci(m.left-o.left)<5&&(h=a.left-m.left)),s.bottom&&(Ci(m.top-o.bottom)<10&&(p=a.bottom-m.top),Ci(m.bottom-o.bottom)<5&&(d=a.bottom-m.bottom)),s.right&&(Ci(m.left-o.right)<10&&(h=a.right-m.left),Ci(m.right-o.right)<5&&(f=a.right-m.right)),(p||f||d||h)&&c.push({shape:l,newBounds:C1(l,{top:p,right:f,bottom:d,left:h})})}}),c}var I1=500;function Lu(e,t){W.call(this,e);function n(i,r){var o=Et(i),a=Pi(r),s=[],c=[],u=[],l=[];if(nr(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",I1,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))})}Lu.$inject=["eventBus","spaceTool"],X(Lu,W);var uh=500;function Qa(e,t){t.invoke(W,this),this._bpmnReplace=e;var n=this;this.postExecuted("elements.create",uh,function(i){var r=i.elements;r.filter(function(o){var a=o.host;return lh(o,a)}).map(function(o){return r.indexOf(o)}).forEach(function(o){i.elements[o]=n._replaceShape(r[o])})},!0),this.preExecute("elements.move",uh,function(i){var r=i.shapes,o=i.newHost;r.forEach(function(a,s){var c=a.host;lh(a,B1(r,c)?c:o)&&(r[s]=n._replaceShape(a))})},!0)}Qa.$inject=["bpmnReplace","injector"],X(Qa,W),Qa.prototype._replaceShape=function(e){var t=L1(e),n;return t?n={type:"bpmn:IntermediateCatchEvent",eventDefinitionType:t.$type}:n={type:"bpmn:IntermediateThrowEvent"},this._bpmnReplace.replaceElement(e,n,{layoutConnection:!1})};function L1(e){var t=U(e),n=t.eventDefinitions;return n&&n[0]}function lh(e,t){return!xe(e)&&y(e,"bpmn:BoundaryEvent")&&!t}function B1(e,t){return e.indexOf(t)!==-1}var Ja=Math.round,N1=Math.max;function $1(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 j1(e){var t=[];return e.forEach(function(n,i){t.push([i===0?"M":"L",n.x,n.y])}),t}var ph=10;function F1(e,t){var n,i;for(n=0;i=e[n];n++)if(mo(i,t)<=ph)return{point:e[n],bendpoint:!0,index:n};return null}function H1(e,t){var n=gd($1(t,ph),j1(e)),i=n[0],r=n[n.length-1],o;return i?i!==r?i.segment2!==r.segment2?(o=N1(i.segment2,r.segment2)-1,{point:e[o],bendpoint:!0,index:o}):{point:{x:Ja(i.x+r.x)/2,y:Ja(i.y+r.y)/2},index:i.segment2}:{point:{x:Ja(i.x),y:Ja(i.y)},index:i.segment2}:null}function Bu(e,t){return F1(e,t)||H1(e,t)}function Nu(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;me(a.width)?w=fe(a):w=a;var E=Bu(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||!fh(r,c[c.length-1]))&&c.push(dh(l)),(u.length===1||!fh(r,u[0]))&&u.unshift(dh(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&&Re(g,function(x){return x.source===d.source})||[],h&&Re(m,function(x){return x.target===h.target})||[]);b.length&&n.removeElements(b)}this.preExecute("elements.move",function(r){var o=r.newParent,a=r.shapes,s=r.delta,c=a[0];if(!(!c||!o)){o&&o.waypoints&&(r.newParent=o=o.parent);var u=fe(c),l={x:u.x+s.x,y:u.y+s.y},p=ze(o.children,function(f){var d=t.canInsert(a,f);return d&&Bu(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(Nu,W),Nu.$inject=["eventBus","bpmnRules","modeling"];function fh(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 dh(e){return k({},e)}function $u(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)&&Lr(r)){var c=[];y(o,"bpmn:EventBasedGateway")?c=a.incoming.filter(u=>u!==r&&Lr(u)):c=a.incoming.filter(u=>u!==r&&Lr(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(Lr).reduce(function(a,s){return a.includes(s.target)?a:a.concat(s.target)},[]);o.forEach(function(a){a.incoming.filter(Lr).forEach(function(s){const c=a.incoming.filter(Lr).filter(function(u){return u.source===r});(s.source!==r||c.length>1)&&t.removeConnection(s)})})}})}$u.$inject=["eventBus","modeling"],X($u,W);function Lr(e){return y(e,"bpmn:SequenceFlow")}var es=1500,hh=2e3;function mh(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"],es,function(i){var r=i.context,o=r.shape||i.shape,a=i.hover;y(a,"bpmn:Lane")&&!Se(o,["bpmn:Lane","bpmn:Participant"])&&(i.hover=hn(a),i.hoverGfx=e.getGraphics(i.hover));var s=n.getRootElement();a&&a!==s&&(o.labelTarget||Se(o,["bpmn:Group","bpmn:TextAnnotation"]))&&(i.hover=s,i.hoverGfx=e.getGraphics(i.hover))}),t.on(["connect.hover","connect.out","connect.end","connect.cleanup","global-connect.hover","global-connect.out","global-connect.end","global-connect.cleanup"],es,function(i){var r=i.hover;y(r,"bpmn:Lane")&&(i.hover=hn(r)||r,i.hoverGfx=e.getGraphics(i.hover))}),t.on(["bendpoint.move.hover"],es,function(i){var r=i.context,o=i.hover,a=r.type;y(o,"bpmn:Lane")&&/reconnect/.test(a)&&(i.hover=hn(o)||o,i.hoverGfx=e.getGraphics(i.hover))}),t.on(["connect.start"],es,function(i){var r=i.context,o=r.start;y(o,"bpmn:Lane")&&(r.start=hn(o)||o)}),t.on("shape.move.start",hh,function(i){var r=i.shape;y(r,"bpmn:Lane")&&(i.shape=hn(r)||r)}),t.on("spaceTool.move",hh,function(i){var r=i.hover;r&&y(r,"bpmn:Lane")&&(i.hover=hn(r))})}mh.$inject=["elementRegistry","eventBus","canvas"];var gh=770;function ju(e,t,n,i){n.invoke(W,this);function r(s,c){var u=U(s),l=c.categoryValue||u.categoryValueRef;l||(l=nh(e,u));var p=c.category||l.$parent||th(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",gh,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",gh,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})}ju.$inject=["bpmnFactory","eventBus","injector","moddleCopy"],X(ju,W);function Fu(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 vh(e){function t(i,r,o){var a={x:o.x,y:o.y-50},s={x:o.x-50,y:o.y},c=Fu(i,r,o,a),u=Fu(i,r,o,s),l;c&&u?yh(c,o)>yh(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)})}vh.$inject=["eventBus"];function yh(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function Hu(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=De(i);if(Se(r,t)){var a=o.get("isHorizontal");a===void 0&&(a=!0),o.set("isHorizontal",a)}})}Hu.$inject=["eventBus"],X(Hu,W);function _h(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 z1(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 V1(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 zu(e,t){var n=t[0],i=t[1],r={x:i.x-n.x,y:i.y-n.y},o=V1([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 xh(e,t){var n=zu(e,t),i={x:n.x-e.x,y:n.y-e.y};return _h(i)}function Co(e,t){return _h({x:e.x-t.x,y:e.y-t.y})}var Eh=Math.sqrt,wh=Math.min,G1=Math.max,Sh=Math.abs;function Rh(e){return Math.pow(e,2)}function Po(e,t){return Eh(Rh(e.x-t.x)+Rh(e.y-t.y))}function W1(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],Ph(i,r)?u=[i]:(o=Po(e,i),a=Po(e,r),c=wh(o,a),u=U1(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:Ph(i,u[0])?n:n+1}),u.length===2&&(s=Y1(u[0],u[1]),l={type:"segment",position:s,segmentIndex:n,relativeLocation:Po(i,s)/Po(i,r)}),p=Po(l.position,e),(!d||f>p)&&(d=l,f=p)}return d}function U1(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=Eh(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 q1(b,e,t)})}function q1(e,t,n){return Ch(e.x,t.x,n.x)&&Ch(e.y,t.y,n.y)}function Ch(e,t,n){return e>=wh(t,n)-ts&&e<=G1(t,n)+ts}function Y1(e,t){return{x:(e.x+t.x)/2,y:(e.y+t.y)/2}}var ts=.1;function Ph(e,t){return Sh(e.x-t.x)<=ts&&Sh(e.y-t.y)<=ts}function K1(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=Th(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 Ah(e,t,n,i){var r=0,o=0,a={point:e,delta:{x:0,y:0}},s=W1(e,n),c=s.segmentIndex,u=K1(n,t,s,i);if(u<0||u>t.length-2||u===null)return a;var l=Mh(n,c),p=Mh(t,u),f=s.position,d=Z1(l,f),h=X1(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=Th(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=z1({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:Xn(b),delta:Xn({x:r,y:o})}}function Th(e,t){var n=Co(e[t-1],e[t]),i=Co(e[t],e[t+1]),r=n/(n+i);return r}function X1(e,t){var n=bh(e),i=bh(t);return i-n}function Mh(e,t){return[e[t],e[t+1]]}function Z1(e,t){var n=Co(e[0],e[1]),i=Co(e[0],t);return n===0?0:i/n}function Q1(e,t,n,i){var r=fe(e);return Ah(r,t,n,i).delta}function Ao(e,t,n){var i=wo(t),r=wo(n),o=Rn(e,i),a={x:o.x*(n.width/t.width),y:o.y*(n.height/t.height)};return Xn({x:r.x+a.x,y:r.y+a.y})}function kh(e,t,n){var i=wo(e),r=wo(t),o=wo(n),a=Rn(e,i),s=Rn(i,r),c=J1(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 Xn({x:l.x+a.x-e.x,y:l.y+a.y-e.y})}function J1(e,t,n){var i=ue(t),r=ue(n);if(eS(i,r))return null;var o=Rt(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=Rt(n,s),c!==o?null:a}function eS(e,t){return tS(e,t)||nS(e,t)}function tS(e,t){return e.right!==t.right&&e.left!==t.left}function nS(e,t){return e.top!==t.top&&e.bottom!==t.bottom}var Dh="name",Oh="text";function Vu(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(Dh in u&&t.updateLabel(c,u[Dh]),Oh in u&&y(c,"bpmn:TextAnnotation")){var l=i.getTextAnnotationBounds({x:c.x,y:c.y,width:c.width,height:c.height},u[Oh]||"");t.updateLabel(c,u.text,l)}}this.postExecute(["shape.create","connection.create"],function(a){var s=a.context,c=s.hints||{};if(c.createElementsBehavior!==!1){var u=s.shape||s.connection;xe(u)||!Ri(u)||un(u)&&t.updateLabel(u,un(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),Q1(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&&Ri(l)&&u.label&&c.label&&(c.label.x=u.label.x,c.label.y=u.label.y)}),this.preExecute("shape.resize",function(a){var s=a.context,c=s.shape,u=s.hints||{};if(!(!xe(c)||u.autoResize)){var l=s.newBounds,p=i.getDimensions(un(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($a(c)){var p=c.label,f=fe(p),d=oS(l),h=rS(f,d),m=iS(h,l,u);t.moveShape(p,m)}})}X(Vu,W),Vu.$inject=["eventBus","modeling","bpmnFactory","textRenderer"];function iS(e,t,n){var i=Ao(e,t,n);return Xn(Rn(i,e))}function rS(e,t){if(t.length){var n=aS(e,t);return zu(e,n)}}function oS(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 aS(e,t){var n=t.map(function(r){return{line:r,distance:xh(e,r)}}),i=Pn(n,"distance");return i[0].line}function sS(e,t,n,i){return Ah(e,t,n,i).point}function Gu(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)})})}X(Gu,W),Gu.$inject=["eventBus","modeling"];function ns(e,t,n){var i=rs(e),r=Lh(i,t),o=i[0];return r.length?r[r.length-1]:Ao(o.original||o,n,t)}function is(e,t,n){var i=rs(e),r=Lh(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=rs(e),r=Ih(t,n),o=i[0];return Ao(o.original||o,r,t)}function Uu(e,t,n){var i=rs(e),r=Ih(t,n),o=i[i.length-1];return Ao(o.original||o,r,t)}function Ih(e,t){return{x:e.x-t.x,y:e.y-t.y,width:e.width,height:e.height}}function rs(e){var t=e.waypoints;if(!t.length)throw new Error("connection#"+e.id+": no waypoints");return t}function Lh(e,t){var n=Dt(e,uS);return Re(n,function(i){return cS(i,t)})}function cS(e,t){return Rt(t,e,1)==="intersect"}function uS(e){return e.original||e}function qu(e,t){W.call(this,e),this.postExecute("shape.replace",function(n){var i=n.oldShape,r=n.newShape;if(lS(i,r)){var o=pS(i);o.incoming.forEach(function(a){var s=is(a,r,i);t.reconnectEnd(a,r,s)}),o.outgoing.forEach(function(a){var s=ns(a,r,i);t.reconnectStart(a,r,s)})}},!0)}qu.$inject=["eventBus","modeling"],X(qu,W);function lS(e,t){return y(e,"bpmn:Participant")&&Pe(e)&&y(t,"bpmn:Participant")&&!Pe(t)}function pS(e){var t=fo([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 fS=["bpmn:MessageEventDefinition","bpmn:TimerEventDefinition","bpmn:EscalationEventDefinition","bpmn:ConditionalEventDefinition","bpmn:SignalEventDefinition"];function Bh(e){const t=U(e);if(!y(t,"bpmn:BoundaryEvent")&&!(y(t,"bpmn:StartEvent")&&Nt(t.$parent)))return!1;const n=t.get("eventDefinitions");return!n||!n.length?!1:fS.some(i=>y(n[0],i))}function Nh(e){return y(e,"bpmn:BoundaryEvent")?"cancelActivity":"isInterrupting"}function Yu(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(!Bh(r))return;const a=Nh(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})})}Yu.$inject=["injector","modeling"],X(Yu,W);function Ku(e,t){W.call(this,e),this.preExecute("shape.resize",function(n){var i=n.shape,r=De(i),o=r&&r.get("label"),a=o&&o.get("bounds");a&&t.updateModdleProperties(i,o,{bounds:void 0})},!0)}X(Ku,W),Ku.$inject=["eventBus","modeling"];function Xu(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=dS(o.waypoints,a.waypoints);n.reconnectEnd(o,a.target,s)}}})}X(Xu,W),Xu.$inject=["eventBus","bpmnRules","modeling"];function Br(e){return e.original||e}function dS(e,t){var n=Fu(Br(e[e.length-2]),Br(e[e.length-1]),Br(t[1]),Br(t[0]));return n?[].concat(e.slice(0,e.length-1),[n],t.slice(1)):[Br(e[0]),Br(t[t.length-1])]}function Zu(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)}Zu.$inject=["eventBus","modeling"],X(Zu,W);function Qu(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;P(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=ze(p.outgoing,xr({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(Qu,W),Qu.$inject=["eventBus","modeling","bpmnRules","injector"];function os(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=Kt(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=[];P(s.closure.topLevel,function(f){Nt(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(os,W),os.prototype._replaceElements=function(e,t){var n=this._elementRegistry,i=this._bpmnReplace,r=this._selection;P(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)},os.$inject=["bpmnReplace","bpmnRules","elementRegistry","injector","modeling","selection"];var hS=1500,mS={width:140,height:120},Ju={width:300,height:60},el={width:60,height:300},as={width:300,height:150},ss={width:150,height:300},$h={width:140,height:120},jh={width:100,height:40};function Fh(e){e.on("resize.start",hS,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=bS(i,r,o)),y(i,"bpmn:SubProcess")&&Pe(i)&&(n.minDimensions=$h),y(i,"bpmn:TextAnnotation")&&(n.minDimensions=jh)})}Fh.$inject=["eventBus"];var Ai=Math.abs,gS=Math.min,vS=Math.max;function Hh(e,t,n,i){var r=e[t];e[t]=r===void 0?n:i(n,r)}function Nr(e,t,n){return Hh(e,t,n,gS)}function $r(e,t,n){return Hh(e,t,n,vS)}var yS={top:20,left:50,right:20,bottom:20},_S={top:50,left:20,right:20,bottom:20};function bS(e,t,n){var i=hn(e),r=!0,o=!0,a=Za(i,[i]),s=ue(e),c={},u={},l=Et(e),p=l?Ju:el;/n/.test(t)?u.top=s.bottom-p.height:/e/.test(t)?u.right=s.left+p.width:/s/.test(t)?u.bottom=s.top+p.height:/w/.test(t)&&(u.left=s.right-p.width),a.forEach(function(h){var m=ue(h);l?(m.top<s.top-10&&(r=!1),m.bottom>s.bottom+10&&(o=!1)):(m.left<s.left-10&&(r=!1),m.right>s.right+10&&(o=!1)),/n/.test(t)&&(n&&Ai(s.top-m.bottom)<10&&$r(c,"top",m.top+p.height),Ai(s.top-m.top)<5&&Nr(u,"top",m.bottom-p.height)),/e/.test(t)&&(n&&Ai(s.right-m.left)<10&&Nr(c,"right",m.right-p.width),Ai(s.right-m.right)<5&&$r(u,"right",m.left+p.width)),/s/.test(t)&&(n&&Ai(s.bottom-m.top)<10&&Nr(c,"bottom",m.bottom-p.height),Ai(s.bottom-m.bottom)<5&&$r(u,"bottom",m.top+p.height)),/w/.test(t)&&(n&&Ai(s.left-m.right)<10&&$r(c,"left",m.left+p.width),Ai(s.left-m.left)<5&&Nr(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?yS:_S;return f.forEach(function(h){var m=ue(h);/n/.test(t)&&(!l||r)&&Nr(u,"top",m.top-d.top),/e/.test(t)&&(l||o)&&$r(u,"right",m.right+d.right),/s/.test(t)&&(!l||o)&&$r(u,"bottom",m.bottom+d.bottom),/w/.test(t)&&(l||r)&&Nr(u,"left",m.left-d.left)}),{min:u,max:c}}function zh(e){!e||typeof e.stopPropagation!="function"||e.stopPropagation()}function jr(e){return e.originalEvent||e.srcEvent}function tl(e){zh(e),zh(jr(e))}function ar(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 Vh(){return/mac/i.test(navigator.platform)}function Gh(e,t){return(jr(e)||e).button===t}function Ti(e){return Gh(e,0)}function xS(e){return Gh(e,1)}function To(e){var t=jr(e)||e;return Ti(e)?Vh()?t.metaKey:t.ctrlKey:!1}function cs(e){var t=jr(e)||e;return Ti(e)&&t.shiftKey}var Wh=1001;function Uh(e,t){e.on("resize.start",Wh+500,function(n){var i=n.context,r=i.shape;(y(r,"bpmn:Lane")||y(r,"bpmn:Participant"))&&(i.balanced=!To(n))}),e.on("resize.end",Wh,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=xd(a),t.resizeLane(r,a,i.balanced)),!1})}Uh.$inject=["eventBus","modeling"];var ES=500;function nl(e,t,n,i,r){n.invoke(W,this);function o(l){return Se(l,["bpmn:ReceiveTask","bpmn:SendTask"])||wS(l,["bpmn:ErrorEventDefinition","bpmn:EscalationEventDefinition","bpmn:MessageEventDefinition","bpmn:SignalEventDefinition"])}function a(l){var p=e.getDefinitions(),f=p.get("rootElements");return!!ze(f,xr({id:l.id}))}function s(l){if(y(l,"bpmn:ErrorEventDefinition"))return"errorRef";if(y(l,"bpmn:EscalationEventDefinition"))return"escalationRef";if(y(l,"bpmn:MessageEventDefinition"))return"messageRef";if(y(l,"bpmn:SignalEventDefinition"))return"signalRef"}function c(l){if(Se(l,["bpmn:ReceiveTask","bpmn:SendTask"]))return l.get("messageRef");var p=l.get("eventDefinitions"),f=p[0];return f.get(s(f))}function u(l,p){if(Se(l,["bpmn:ReceiveTask","bpmn:SendTask"]))return l.set("messageRef",p);var f=l.get("eventDefinitions"),d=f[0];return d.set(s(d),p)}this.executed(["shape.create","element.updateProperties","element.updateModdleProperties"],function(l){var p=l.shape||l.element;if(o(p)){var f=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");et(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",ES,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)})}nl.$inject=["bpmnjs","eventBus","injector","moddleCopy","bpmnFactory"],X(nl,W);function wS(e,t){return pe(t)||(t=[t]),di(t,function(n){return Mr(e,n)})}var qh=Math.max;function Yh(e){e.on("spaceTool.getMinDimensions",function(t){var n=t.shapes,i=t.axis,r=t.start,o={};return P(n,function(a){var s=a.id;y(a,"bpmn:Participant")&&(o[s]=RS(a,i,r)),y(a,"bpmn:Lane")&&(o[s]=Et(a)?Ju:el),y(a,"bpmn:SubProcess")&&Pe(a)&&(o[s]=$h),y(a,"bpmn:TextAnnotation")&&(o[s]=jh),y(a,"bpmn:Group")&&(o[s]=mS)}),o})}Yh.$inject=["eventBus"];function SS(e){return e==="x"}function RS(e,t,n){var i=Et(e);if(!AS(e))return i?as:ss;var r=SS(t),o={};return r?i?o=as:o={width:PS(e,n,r),height:ss.height}:i?o={width:as.width,height:CS(e,n,r)}:o=ss,o}function CS(e,t,n){var i;return i=TS(e,t,n),qh(as.height,i)}function PS(e,t,n){var i;return i=MS(e,t,n),qh(ss.width,i)}function AS(e){return!!Pi(e).length}function TS(e,t,n){var i=Pi(e),r;return r=il(i,t,n),e.height-r.height+Ju.height}function MS(e,t,n){var i=Pi(e),r;return r=il(i,t,n),e.width-r.width+el.width}function il(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=Pi(r),o.length?il(o,t,n):r}var Kh="_plane";function Xh(e){var t=e.id;return kS(t)}function $n(e){var t=e.id;return y(e,"bpmn:SubProcess")?Zh(t):t}function sr(e){return Zh(e)}function us(e){var t=De(e);return y(t,"bpmndi:BPMNPlane")}function Zh(e){return e+Kh}function kS(e){return e.replace(new RegExp(Kh+"$"),"")}var Qh=400,DS=600,Jh={x:180,y:160};function ei(e,t,n,i,r,o,a){W.call(this,t),this._canvas=e,this._eventBus=t,this._modeling=n,this._elementFactory=i,this._bpmnFactory=r,this._bpmnjs=o,this._elementRegistry=a;var s=this;function c(p){return y(p,"bpmn:SubProcess")&&!Pe(p)}function u(p){var f=p.shape,d=p.newRootElement,h=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($n(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;P(f,function(d){if(c(d)){var h=a.get($n(d));if(!(!h||!d.children||!d.children.length)){var m=em(d);s._showRecursively(m),s._moveChildrenToShape(m,h)}}})},!0),this.reverted("shape.create",function(p){var f=p.shape;c(f)&&l(p)},!0),this.preExecute("shape.delete",function(p){var f=p.shape;!y(f,"bpmn:SubProcess")||!Pe(f)||P(_o([f]),d=>{n.removeShape(d.annotation)})},!0),this.preExecuted("shape.delete",function(p){var f=p.shape;if(c(f)){var d=a.get($n(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($n(f)))},!0),this.postExecuted("shape.replace",function(p){var f=p.newShape,d=p.oldRoot,h=e.findRoot($n(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(us(f)){a.updateId(f,sr(g)),a.updateId(m,g);return}var w=a.get(sr(m));w&&a.updateId(sr(m),sr(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(us(f)){a.updateId(f,sr(m)),a.updateId(g,m);return}var w=a.get(sr(g));w&&a.updateId(w,sr(m))}}},!0),t.on("element.changed",function(p){var f=p.element;if(us(f)){var d=f,h=a.get(Xh(d));!h||h===d||t.fire("element.changed",{element:h})}}),this.executed("shape.toggleCollapse",Qh,function(p){var f=p.shape;y(f,"bpmn:SubProcess")&&(Pe(f)?l(p):(u(p),s._showRecursively(f.children)))},!0),this.reverted("shape.toggleCollapse",Qh,function(p){var f=p.shape;y(f,"bpmn:SubProcess")&&(Pe(f)?l(p):(u(p),s._showRecursively(f.children)))},!0),this.postExecuted("shape.toggleCollapse",DS,function(p){var f=p.shape;if(y(f,"bpmn:SubProcess")){var d=p.newRootElement;if(d)if(Pe(f))s._moveChildrenToShape(d.children.slice(),f),P(_o(f.children),m=>{n.moveShape(m.annotation,{x:0,y:0},f.parent),P(m.associations,g=>{n.moveConnection(g,{x:0,y:0},f.parent)})});else{s._disconnectSharedAnnotations(f);var h=em(f);s._moveChildrenToShape(h,d)}}},!0),t.on("copyPaste.createTree",function(p){var f=p.element,d=p.children;if(c(f)){var h=$n(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(De(m),"bpmndi:BPMNPlane");if(g){var w=Xh(m),E=ze(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)})}X(ei,W),ei.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:Jh.x-r.x,y:Jh.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})}},ei.prototype._disconnectSharedAnnotations=function(e){var t=this._modeling,n=new Set(Gd(e).map(i=>i.annotation));n.size&&P(_o(e.children),i=>{n.has(i.annotation)&&P(i.associations,r=>{t.removeConnection(r)})})},ei.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},ei.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},ei.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:$n(e),type:e.$type,di:i,businessObject:e,collapsed:!0});return o},ei.prototype._removeDiagram=function(e){var t=this._bpmnjs,n=t.getDefinitions().diagrams,i=ze(n,function(r){return r.plane.bpmnElement.id===e.id});return n.splice(n.indexOf(i),1),i},ei.$inject=["canvas","eventBus","modeling","elementFactory","bpmnFactory","bpmnjs","elementRegistry"];function OS(e){var t=[];return P(_o(e),n=>{t.push(n.annotation),t.push.apply(t,n.associations)}),t}function em(e){return e.children.slice().concat(OS(e.children)).concat(IS(e))}function IS(e){return cu(e.children||[]).reduce(function(t,n){return n.label&&n.label.parent!==e&&t.push(n.label),t},[])}function rl(e,t){e.invoke(W,this),this.postExecuted("shape.replace",function(n){var i=n.context.oldShape,r=n.context.newShape;if(!(!y(r,"bpmn:SubProcess")||y(r,"bpmn:AdHocSubProcess")||!(y(i,"bpmn:Task")||y(i,"bpmn:CallActivity"))||!Pe(r))){var o=LS(r);t.createShape({type:"bpmn:StartEvent"},o,r)}})}rl.$inject=["injector","modeling"],X(rl,W);function LS(e){return{x:e.x+e.width/6,y:e.y+e.height/2}}function ol(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,un(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(ol,W),ol.$inject=["eventBus","textRenderer"];function al(e,t){W.call(this,e),this.postExecuted("shape.toggleCollapse",1500,function(n){var i=n.shape;if(Pe(i))return;var r=fo(i);r.forEach(function(a){var s=a.incoming.slice(),c=a.outgoing.slice();P(s,function(u){o(u,!0)}),P(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)}X(al,W),al.$inject=["eventBus","modeling"];var sl=500;function cl(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=BS(c).concat([a]),p=ch(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"],sl,function(a){var s=a.context,c=s.shape;y(c,"bpmn:SubProcess")&&(c.collapsed?De(c).isExpanded=!1:(i(c.children),De(c).isExpanded=!0))}),this.reverted(["shape.toggleCollapse"],sl,function(a){var s=a.context,c=s.shape;c.collapsed?De(c).isExpanded=!1:De(c).isExpanded=!0}),this.postExecuted(["shape.toggleCollapse"],sl,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(cl,W),cl.$inject=["eventBus","elementFactory","modeling"];function BS(e){return e.filter(function(t){return!t.hidden})}function ul(e,t,n,i){t.invoke(W,this),this.preExecute("shape.delete",function(r){var o=r.context,a=o.shape,s=a.businessObject;xe(a)||(y(a,"bpmn:Participant")&&Pe(a)&&n.ids.unclaim(s.processRef.id),i.unclaimId(s.id,s))}),this.preExecute("connection.delete",function(r){var o=r.context,a=o.connection,s=a.businessObject;i.unclaimId(s.id,s)}),this.preExecute("canvas.updateRoot",function(){var r=e.getRootElement(),o=r.businessObject;y(r,"bpmn:Collaboration")&&n.ids.unclaim(o.id)})}X(ul,W),ul.$inject=["canvas","injector","moddle","modeling"];function ll(e,t){W.call(this,e),this.preExecute("connection.delete",function(n){var i=n.context,r=i.connection,o=r.source;NS(r,o)&&t.updateProperties(o,{default:null})})}X(ll,W),ll.$inject=["eventBus","modeling"];function NS(e,t){if(!y(e,"bpmn:SequenceFlow"))return!1;var n=U(t),i=U(e);return n.get("default")===i}var $S=500,jS=5e3,tm=["shape.create","shape.delete","shape.move","shape.resize"],nm=[...tm,"spaceTool","lane.add","lane.resize","lane.split","elements.create","elements.delete","elements.move"];function pl(e,t){W.call(this,e);var n;function i(){return n=n||new FS,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(nm,jS,function(){i()}),this.postExecuted(nm,$S,function(){o()}),this.preExecute(tm,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))})}pl.$inject=["eventBus","modeling"],X(pl,W);function FS(){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 HS=500,zS=5e3,im=["connection.create","connection.delete","connection.layout","connection.move","connection.reconnect","connection.updateWaypoints","shape.create","shape.delete","shape.move","shape.resize"],rm=[...im,"elements.create","elements.delete","elements.move","label.create","spaceTool"];function fl(e,t){W.call(this,e);var n;function i(){return n=n||new VS,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(rm,zS,function(){i()}),this.postExecuted(rm,HS,function(){o()}),this.preExecute(im,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)})}fl.$inject=["eventBus","modeling"],X(fl,W);function VS(){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 dl(e,t){W.call(this,e),this.postExecuted("elements.create",function(n){const i=n.context,r=i.elements;for(const o of r)GS(o)&&!US(o)&&t.updateProperties(o,{isForCompensation:void 0})})}X(dl,W),dl.$inject=["eventBus","modeling"];function GS(e){const t=U(e);return t&&t.isForCompensation}function WS(e){return e&&y(e,"bpmn:BoundaryEvent")&&Mr(e,"bpmn:CompensateEventDefinition")}function US(e){return e.incoming.filter(n=>WS(n.source)).length>0}const qS={__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",xu],appendBehavior:["type",Eu],associationBehavior:["type",Su],attachEventBehavior:["type",Ga],artifactBehavior:["type",wu],boundaryEventBehavior:["type",Ru],categoryRootElementReferenceBehavior:["type",Cu],compensateBoundaryEventBehaviour:["type",Pu],createBehavior:["type",Au],createDataObjectBehavior:["type",Tu],createParticipantBehavior:["type",Du],dataInputAssociationBehavior:["type",Ou],dataStoreBehavior:["type",Iu],deleteLaneBehavior:["type",Lu],detachEventBehavior:["type",Qa],dropOnFlowBehavior:["type",Nu],eventBasedGatewayBehavior:["type",$u],fixHoverBehavior:["type",mh],groupBehavior:["type",ju],importDockingFix:["type",vh],isHorizontalFix:["type",Hu],labelBehavior:["type",Vu],layoutConnectionBehavior:["type",Gu],messageFlowBehavior:["type",qu],nonInterruptingBehavior:["type",Yu],removeElementBehavior:["type",Xu],removeEmbeddedLabelBoundsBehavior:["type",Ku],removeParticipantBehavior:["type",Zu],replaceConnectionBehavior:["type",Qu],replaceElementBehaviour:["type",os],resizeBehavior:["type",Fh],resizeLaneBehavior:["type",Uh],rootElementReferenceBehavior:["type",nl],spaceToolBehavior:["type",Yh],subProcessPlaneBehavior:["type",ei],subProcessStartEventBehavior:["type",rl],textAnnotationBehavior:["type",ol],toggleCollapseConnectionBehaviour:["type",al],toggleElementCollapseBehaviour:["type",cl],unclaimIdBehavior:["type",ul],unsetDefaultFlowBehavior:["type",ll],updateFlowNodeRefsBehavior:["type",pl],updateCategoryValueRefsBehavior:["type",fl],setCompensationActivityAfterPasteBehavior:["type",dl]};function hl(e){this._commandStack=e.get("commandStack",!1)}hl.$inject=["injector"],hl.prototype.allowed=function(e,t){var n=!0,i=this._commandStack;return i&&(n=i.canExecute(e,t)),n===void 0?!0:n};const jn={__init__:["rules"],rules:["type",hl]};function mn(e){W.call(this,e),this.init()}mn.$inject=["eventBus"],X(mn,W),mn.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)})},mn.prototype.init=function(){};function om(e,t){var n=Rt(e,t,-15);return n!=="intersect"?n:null}function Pt(e){mn.call(this,e)}X(Pt,mn),Pt.$inject=["eventBus"],Pt.prototype.init=function(){this.addRule("connection.start",function(e){var t=e.source;return YS(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 ps(t,n)}finally{r&&(n.parent=null)}}),this.addRule("connection.reconnect",function(e){var t=e.connection,n=e.source,i=e.target;return ps(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 ym(t,n,i)}),this.addRule("elements.create",function(e){var t=e.elements,n=e.position,i=e.target;return je(i)&&!fs(t,i)?!1:qi(t,function(r){return je(r)?ps(r.source,r.target,r):r.host?Mo(r,r.host,null,n):yl(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 fm(a)&&!n.includes(a.host)})?!1:Mo(n,t,null,i)||gm(n,t,i)||vm(n,t)||fs(n,t)}),this.addRule("shape.create",function(e){return yl(e.shape,e.target,e.source,e.position)}),this.addRule("shape.attach",function(e){return Mo(e.shape,e.target,null,e.position)}),this.addRule("element.copy",function(e){var t=e.element,n=e.elements;return wm(n,t)})},Pt.prototype.canConnectMessageFlow=xm,Pt.prototype.canConnectSequenceFlow=Em,Pt.prototype.canConnectDataAssociation=_l,Pt.prototype.canConnectAssociation=_m,Pt.prototype.canConnectCompensationAssociation=bm,Pt.prototype.canMove=vm,Pt.prototype.canAttach=Mo,Pt.prototype.canReplace=gm,Pt.prototype.canDrop=Fr,Pt.prototype.canInsert=fs,Pt.prototype.canCreate=yl,Pt.prototype.canConnect=ps,Pt.prototype.canResize=ym,Pt.prototype.canCopy=wm;function YS(e){return ml(e)?null:Se(e,["bpmn:FlowNode","bpmn:InteractionNode","bpmn:DataObjectReference","bpmn:DataStoreReference","bpmn:Group","bpmn:TextAnnotation"])}function ml(e){return!e||xe(e)}function am(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 gl(e){return y(e,"bpmn:TextAnnotation")}function vl(e){return y(e,"bpmn:Group")&&!e.labelTarget}function sm(e){return y(e,"bpmn:BoundaryEvent")&&Fn(e,"bpmn:CompensateEventDefinition")}function ls(e){return U(e).isForCompensation}function KS(e,t){var n=am(e),i=am(t);return n===i}function XS(e){return y(e,"bpmn:InteractionNode")&&!y(e,"bpmn:BoundaryEvent")&&(!y(e,"bpmn:Event")||y(e,"bpmn:ThrowEvent")&&lm(e,"bpmn:MessageEventDefinition"))}function ZS(e){return y(e,"bpmn:InteractionNode")&&!ls(e)&&(!y(e,"bpmn:Event")||y(e,"bpmn:CatchEvent")&&lm(e,"bpmn:MessageEventDefinition"))&&!(y(e,"bpmn:BoundaryEvent")&&!Fn(e,"bpmn:MessageEventDefinition"))}function cm(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 um(e,t){var n=cm(e),i=cm(t);return n===i}function Fn(e,t){var n=U(e);return!!ze(n.eventDefinitions||[],function(i){return y(i,t)})}function lm(e,t){var n=U(e);return(n.eventDefinitions||[]).every(function(i){return y(i,t)})}function QS(e){return y(e,"bpmn:FlowNode")&&!y(e,"bpmn:EndEvent")&&!Nt(e)&&!(y(e,"bpmn:IntermediateThrowEvent")&&Fn(e,"bpmn:LinkEventDefinition"))&&!sm(e)&&!ls(e)}function JS(e){return y(e,"bpmn:FlowNode")&&!y(e,"bpmn:StartEvent")&&!y(e,"bpmn:BoundaryEvent")&&!Nt(e)&&!(y(e,"bpmn:IntermediateCatchEvent")&&Fn(e,"bpmn:LinkEventDefinition"))&&!ls(e)}function eR(e){return y(e,"bpmn:ReceiveTask")||y(e,"bpmn:IntermediateCatchEvent")&&(Fn(e,"bpmn:MessageEventDefinition")||Fn(e,"bpmn:TimerEventDefinition")||Fn(e,"bpmn:ConditionalEventDefinition")||Fn(e,"bpmn:SignalEventDefinition"))}function tR(e){for(var t=[];e;)e=e.parent,e&&t.push(e);return t}function pm(e,t){var n=tR(t);return n.indexOf(e)!==-1}function ps(e,t,n){if(ml(e)||ml(t))return null;if(!y(n,"bpmn:DataAssociation")){if(xm(e,t))return{type:"bpmn:MessageFlow"};if(Em(e,t))return{type:"bpmn:SequenceFlow"}}var i=_l(e,t);return i||(bm(e,t)?{type:"bpmn:Association",associationDirection:"One"}:_m(e,t)?{type:"bpmn:Association",associationDirection:"None"}:!1)}function Fr(e,t){return xe(e)||vl(e)?!0:y(t,"bpmn:Participant")&&!Pe(t)?!1:y(e,"bpmn:Participant")?y(t,"bpmn:Process")||y(t,"bpmn:Collaboration"):Se(e,["bpmn:DataInput","bpmn:DataOutput"])&&e.parent?t===e.parent:y(e,"bpmn:Lane")?y(t,"bpmn:Participant")||y(t,"bpmn:Lane"):y(e,"bpmn:BoundaryEvent")&&!nR(e)?!1:y(e,"bpmn:FlowElement")&&!y(e,"bpmn:DataStoreReference")?y(t,"bpmn:FlowElementsContainer")?Pe(t):Se(t,["bpmn:Participant","bpmn:Lane"]):y(e,"bpmn:DataStoreReference")&&y(t,"bpmn:Collaboration")?di(U(t).get("participants"),function(n){return!!n.get("processRef")}):Se(e,["bpmn:Artifact","bpmn:DataAssociation","bpmn:DataStoreReference"])?Se(t,["bpmn:Collaboration","bpmn:Lane","bpmn:Participant","bpmn:Process","bpmn:SubProcess"]):y(e,"bpmn:MessageFlow")?y(t,"bpmn:Collaboration")||e.source.parent==t||e.target.parent==t:!1}function nR(e){return U(e).cancelActivity&&(dm(e)||hm(e))}function fm(e){return!xe(e)&&y(e,"bpmn:BoundaryEvent")}function iR(e){return y(e,"bpmn:Lane")}function rR(e){return fm(e)||y(e,"bpmn:IntermediateThrowEvent")&&dm(e)?!0:y(e,"bpmn:IntermediateCatchEvent")&&hm(e)}function dm(e){var t=U(e);return t&&!(t.eventDefinitions&&t.eventDefinitions.length)}function hm(e){return mm(e,["bpmn:MessageEventDefinition","bpmn:TimerEventDefinition","bpmn:SignalEventDefinition","bpmn:ConditionalEventDefinition"])}function mm(e,t){return t.some(function(n){return Fn(e,n)})}function oR(e){return y(e,"bpmn:ReceiveTask")&&ze(e.incoming,function(t){return y(t.source,"bpmn:EventBasedGateway")})}function Mo(e,t,n,i){if(Array.isArray(e)||(e=[e]),e.length!==1)return!1;var r=e[0];return xe(r)||!rR(r)||Nt(t)||!y(t,"bpmn:Activity")||ls(t)||i&&!om(i,t)||oR(t)?!1:"attach"}function gm(e,t,n){if(!t)return!1;var i={replacements:[]};return P(e,function(r){Nt(t)||y(r,"bpmn:StartEvent")&&r.type!=="label"&&Fr(r,t)&&(hw(r)||i.replacements.push({oldElementId:r.id,newElementType:"bpmn:StartEvent"}),(mw(r)||gw(r)||vw(r))&&i.replacements.push({oldElementId:r.id,newElementType:"bpmn:StartEvent"}),mm(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")||Fn(r,"bpmn:CancelEventDefinition")&&r.type!=="label"&&(y(r,"bpmn:EndEvent")&&Fr(r,t)&&i.replacements.push({oldElementId:r.id,newElementType:"bpmn:EndEvent"}),y(r,"bpmn:BoundaryEvent")&&Mo(r,t,null,n)&&i.replacements.push({oldElementId:r.id,newElementType:"bpmn:BoundaryEvent"}))}),i.replacements.length?i:!1}function vm(e,t){return di(e,iR)?!1:t===void 0?!0:t===null?!1:e.every(function(n){return Fr(n,t)})}function yl(e,t,n,i){return t?xe(e)||vl(e)?!0:Fr(e,t)||fs(e,t):!1}function ym(e,t,n){return y(e,"bpmn:SubProcess")?Pe(e)&&(!t||t.width>=100&&t.height>=80):y(e,"bpmn:Lane")||y(e,"bpmn:Participant")?!0:gl(e)?n?n==="e"||n==="w":!0:vl(e)?!0:xe(e)?n?n==="e"||n==="w":!0:!1}function aR(e,t){var n=gl(e),i=gl(t);return(n||i)&&n!==i}function _m(e,t){return pm(t,e)||pm(e,t)?!1:aR(e,t)?!0:!!_l(e,t)}function bm(e,t){return um(e,t)&&sm(e)&&y(t,"bpmn:Activity")&&!cR(t,e)&&!Nt(t)}function xm(e,t){return Rm(e)&&!Rm(t)?!1:XS(e)&&ZS(t)&&!KS(e,t)}function Em(e,t){return QS(e)&&JS(t)&&um(e,t)&&!(y(e,"bpmn:EventBasedGateway")&&!eR(t))}function _l(e,t){return Se(e,["bpmn:DataObjectReference","bpmn:DataStoreReference"])&&Se(t,["bpmn:Activity","bpmn:ThrowEvent"])?{type:"bpmn:DataInputAssociation"}:Se(t,["bpmn:DataObjectReference","bpmn:DataStoreReference"])&&Se(e,["bpmn:Activity","bpmn:CatchEvent"])?{type:"bpmn:DataOutputAssociation"}:!1}function fs(e,t,n){if(!t)return!1;if(Array.isArray(e)){if(e.length!==1)return!1;e=e[0]}return t.source===e||t.target===e?!1:Se(t,["bpmn:SequenceFlow","bpmn:MessageFlow"])&&!xe(t)&&y(e,"bpmn:FlowNode")&&!y(e,"bpmn:BoundaryEvent")&&Fr(e,t.parent)}function bl(e,t){return e&&t&&e.indexOf(t)!==-1}function wm(e,t){return xe(t)?!0:!(y(t,"bpmn:Lane")&&!bl(e,t.parent)||y(t,"bpmn:MessageFlow")&&!sR(e,t))}function sR(e,t){var n=Sm(t.source),i=Sm(t.target);return bl(e,n)&&bl(e,i)}function Sm(e){for(;e;e=e.parent)if(y(e,"bpmn:Participant"))return e;return null}function Rm(e){return Or(e,"bpmn:Process")||Or(e,"bpmn:Collaboration")}function cR(e,t){return e.attachers.includes(t)}const uR={__depends__:[jn],__init__:["bpmnRules"],bpmnRules:["type",Pt]};var lR=2e3;function Cm(e,t){e.on("saveXML.start",lR,n);function n(){var i=t.getRootElements();P(i,function(r){var o=De(r),a,s;a=fo([r]),a=Re(a,function(c){return c!==r&&!c.labelTarget}),s=Dt(a,De),o.set("planeElement",s)})}}Cm.$inject=["eventBus","canvas"];const pR={__init__:["bpmnDiOrdering"],bpmnDiOrdering:["type",Cm]};function ds(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)})}ds.prototype.getOrdering=function(e,t){return null},X(ds,W);function xl(e,t){ds.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=ze(n,function(c){return Se(a,[c.type])});return s&&s.order||{level:1}}function r(a){var s=a.order;if(s||(a.order=s=i(a)),!s)throw new Error(`no order for <${a.id}>`);return s}function o(a,s,c){for(var u=s;u&&!Se(u,c);)u=u.parent;if(!u)throw new Error(`no parent for <${a.id}> in <${s&&s.id}>`);return u}this.getOrdering=function(a,s){if(a.labelTarget||y(a,"bpmn:TextAnnotation"))return{parent:t.findRoot(s)||t.getRootElement(),index:-1};var c=r(a);c.containers&&(s=o(a,s,c.containers));var u=s.children.indexOf(a),l=Yp(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}}}xl.$inject=["eventBus","canvas"],X(xl,ds);const fR={__init__:["bpmnOrderingProvider"],bpmnOrderingProvider:["type",xl]};function ko(){}ko.prototype.get=function(){return this._data},ko.prototype.set=function(e){this._data=e},ko.prototype.clear=function(){var e=this._data;return delete this._data,e},ko.prototype.isEmpty=function(){return!this._data};const dR={clipboard:["type",ko]};var Pm=1500;function Am(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",Pm,function(s){o(s)})}),(function(){var a,s;t.on("element.hover",function(c){a=c.gfx,s=c.element}),t.on("element.hover",Pm,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=ar(a),c=document.elementFromPoint(s.x,s.y),hR(c)}}Am.$inject=["elementRegistry","eventBus","injector"];function hR(e){return er(e,"svg, .djs-element",!0)}const mR={__init__:["hoverFix"],hoverFix:["type",Am]};function gR(e){return!0}function hs(e){return Ti(e)||xS(e)}var Tm=500;function Mm(e,t,n){var i=this;function r(C,$,j){if(!s(C,$)){var L,F,te;j?F=t.getGraphics(j):(L=$.delegateTarget||$.target,L&&(F=L,j=t.get(F))),!(!F||!j)&&(te=e.fire(C,{element:j,gfx:F,originalEvent:$}),te===!1&&($.stopPropagation(),$.preventDefault()))}}var o={};function a(C){return o[C]}function s(C,$){var j=u[C]||Ti;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":gR,"element.mousedown":hs,"element.mouseup":hs,"element.click":hs,"element.dblclick":hs};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(te){r(j,te)};L&&(u[j]=L),F.$delegate=Xt.bind(C,p,$,F)}function d(C,$,j){var L=a(j);L&&Xt.unbind(C,$,L.$delegate)}function h(C){P(c,function($,j){f(C,j,$)})}function m(C){P(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"],Tm,function(C){var $=C.element,j=C.gfx;e.fire("interactionEvents.updateHit",{element:$,gfx:j})}),e.on("interactionEvents.createHit",Tm,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 Z(C,j),C}function I(C,$){ye(C,$)}this.removeHits=function(C){var $=Ra(".djs-hit",C);P($,gt)},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=po($);return A(j,"stroke"),I(C,j),j},this.createBoxHit=function(C,$,j){j=k({x:0,y:0},j);var L=oe("rect");return A(L,$),Z(L,j),I(C,L),L},this.updateDefaultHit=function(C,$){var j=$e(".djs-hit",$);if(j)return C.waypoints?su(j,C.waypoints):Z(j,{width:C.width,height:C.height}),j},this.fire=r,this.triggerMouseEvent=l,this.mouseHandler=a,this.registerEvent=f,this.unregisterEvent=d}Mm.$inject=["eventBus","elementRegistry","styles"];const ms={__init__:["interactionEvents"],interactionEvents:["type",Mm]};function Hr(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)})}Hr.$inject=["eventBus","canvas"],Hr.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()})}},Hr.prototype.get=function(){return Array.from(this._selectedElements)},Hr.prototype.isSelected=function(e){return this._selectedElements.has(e)},Hr.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?P(e,o=>{this._selectedElements.add(o)}):this._selectedElements=new Set(e),this._eventBus.fire("selection.changed",{oldSelection:n,newSelection:this.get()})};var km="hover",Dm="selected";function Om(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,km)}),t.on("element.out",function(r){i(r.element,km)}),t.on("selection.changed",function(r){function o(u){i(u,Dm)}function a(u){n(u,Dm)}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)})}Om.$inject=["canvas","eventBus"];function Im(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(vR))}}),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=ze(o,function(c){return a.id===c.id});s||t.select(a)}),e.on("element.click",function(r){if(Ti(r)){var o=r.element;o===n.getRootElement()&&(o=null);var a=t.isSelected(o),s=t.get().length>1,c=cs(r);if(a&&s)return c?t.deselect(o):t.select(o);a?t.deselect(o):t.select(o,c)}})}Im.$inject=["eventBus","selection","canvas","elementRegistry"];function vR(e){return!e.hidden}const gn={__init__:["selectionVisuals","selectionBehavior"],__depends__:[ms],selection:["type",Hr],selectionVisuals:["type",Om],selectionBehavior:["type",Im]};var yR=/^djs-cursor-.*$/;function gs(e){var t=Ye(document.body);t.removeMatching(yR),e&&t.add("djs-cursor-"+e)}function Lm(){gs(null)}var _R=5e3;function Bm(e,t){t=t||"element.click";function n(){return!1}return e.once(t,_R,n),function(){e.off(t,n)}}var bR=["c","C"],xR=["v","V"],ER=["d","D"],wR=["x","X"],SR=["y","Y"],Nm=["z","Z"];function RR(e){return e.ctrlKey||e.metaKey||e.shiftKey||e.altKey}function Jt(e){return e.altKey?!1:e.ctrlKey||e.metaKey}function vt(e,t){return e=pe(e)?e:[e],e.indexOf(t.key)!==-1||e.indexOf(t.code)!==-1}function El(e){return e.shiftKey}function CR(e){return Jt(e)&&vt(bR,e)}function PR(e){return Jt(e)&&vt(xR,e)}function AR(e){return Jt(e)&&vt(ER,e)}function TR(e){return Jt(e)&&vt(wR,e)}function MR(e){return Jt(e)&&!El(e)&&vt(Nm,e)}function kR(e){return Jt(e)&&(vt(SR,e)||vt(Nm,e)&&El(e))}var zr=Math.round,$m="djs-drag-active";function cr(e){e.preventDefault()}function DR(e){return typeof TouchEvent<"u"&&e instanceof TouchEvent}function OR(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}function jm(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=ar(b),$=Rn(C,I),j=o.localStart,L=a(C),F=Rn(L,j);if(!o.active&&(x||OR($)>o.threshold)){if(k(S,{x:zr(j.x+A.x),y:zr(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&&gs(o.cursor),t.addMarker(t.getRootElement(),$m)}tl(b),o.active&&(k(S,{x:zr(L.x+A.x),y:zr(L.y+A.y),dx:zr(F.x),dy:zr(F.y)},{originalEvent:b}),s("move"))}function l(b){var x,S=!0;o.active&&(b&&(o.payload.originalEvent=b,tl(b)),S=s("end")),S===!1&&s("rejected"),x=w(S!==!0),s("ended",x)}function p(b){vt("Escape",b)&&(cr(b),g())}function f(b){var x;o.active&&(x=Bm(e),setTimeout(x,400),cr(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"),Lm(),o.trapClick?S=f:S=l,ve.unbind(document,"mousemove",u),ve.unbind(document,"dragstart",cr),ve.unbind(document,"selectstart",cr),ve.unbind(document,"mousedown",S,!0),ve.unbind(document,"mouseup",S,!0),ve.unbind(document,"keyup",p),ve.unbind(document,"touchstart",d,!0),ve.unbind(document,"touchcancel",g,!0),ve.unbind(document,"touchmove",u,!0),ve.unbind(document,"touchend",l,!0),e.off("element.hover",h),e.off("element.out",m),t.removeMarker(t.getRootElement(),$m);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=jr(b)||b,$=ar(b),tl(b),C.type==="dragstart"&&cr(C)):(C=null,$={x:0,y:0}),j=a($),x||(x=j),F=DR(C),o=k({prefix:S,data:I,payload:{},globalStart:$,displacement:Rn(x,j),localStart:j,isTouch:F},A),A.manual||(F?(ve.bind(document,"touchstart",d,!0),ve.bind(document,"touchcancel",g,!0),ve.bind(document,"touchmove",u,!0),ve.bind(document,"touchend",l,!0)):(ve.bind(document,"mousemove",u),ve.bind(document,"dragstart",cr),ve.bind(document,"selectstart",cr),ve.bind(document,"mousedown",L,!0),ve.bind(document,"mouseup",L,!0)),ve.bind(document,"keyup",p),e.on("element.hover",h),e.on("element.out",m)),s("init")===!1)return g(),!1;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)}}jm.$inject=["eventBus","canvas","selection","elementRegistry"];const ti={__depends__:[mR,gn],dragging:["type",jm]};function Vr(e){this._counter=0,this._prefix=(e?e+"-":"")+Math.floor(Math.random()*1e9)+"-"}Vr.prototype.next=function(){return this._prefix+ ++this._counter};const IR=new Vr("ps");var LR=["marker-start","marker-mid","marker-end"],BR=["circle","ellipse","line","path","polygon","polyline","path","rect"];function Mi(e,t,n,i){this._elementRegistry=e,this._canvas=n,this._styles=i}Mi.$inject=["elementRegistry","eventBus","canvas","styles"],Mi.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")},Mi.prototype.getGfx=function(e){return this._elementRegistry.getGraphics(e)},Mi.prototype.addDragger=function(e,t,n,i="djs-dragger"){n=n||this.getGfx(e);var r=Qf(n);return this._cloneMarkers(ir(r),i),Z(r,this._styles.cls(i,[])),ye(t,r),Z(r,"data-preview-support-element-id",e.id),r},Mi.prototype.addFrame=function(e,t){var n=oe("rect",{class:"djs-resize-overlay",width:e.width,height:e.height,x:e.x,y:e.y});return ye(t,n),Z(n,"data-preview-support-element-id",e.id),n},Mi.prototype._cloneMarkers=function(e,t="djs-dragger",n=e){var i=this;e.childNodes&&e.childNodes.forEach(r=>{i._cloneMarkers(r,t,n)}),FR(e)&&LR.forEach(function(r){if(Z(e,r)){var o=NR(e,r,i._canvas.getContainer());o&&i._cloneMarker(n,e,o,r,t)}})},Mi.prototype._cloneMarker=function(e,t,n,i,r="djs-dragger"){var o=[n.id,r,IR.next()].join("-"),a=$e("marker#"+n.id,e);e=e||this._canvas._svg;var s=a||Qf(n);s.id=o,Me(s).add(r);var c=$e(":scope > defs",e);c||(c=oe("defs"),ye(e,c)),ye(c,s);var u=jR(s.id);Z(t,i,u)};function NR(e,t,n){var i=$R(Z(e,t));return $e("marker#"+i,n||document)}function $R(e){return e.match(/url\(['"]?#([^'"]*)['"]?\)/)[1]}function jR(e){return"url(#"+e+")"}function FR(e){return BR.indexOf(e.nodeName)!==-1}const Gr={__init__:["previewSupport"],previewSupport:["type",Mi]};var HR="drop-ok",Fm="drop-not-ok",Hm="attach-ok",zm="new-parent",Vm="create",zR=2e3;function Gm(e,t,n,i,r){function o(c,u,l,p,f){if(!u)return!1;c=Re(c,function(E){var b=E.labelTarget;return!E.parent&&!(xe(E)&&c.indexOf(b)!==-1)});var d=ze(c,function(E){return!je(E)}),h=!1,m=!1,g=!1;Um(c)&&(h=r.allowed("shape.attach",{position:l,shape:d,target:u})),h||(Um(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){[Hm,HR,Fm,zm].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}Wm(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,Hm):a(p,m?zm:Fm))}),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;Wm(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=ze(f,function(b){return!je(b)})),k(u,{elements:f,shape:p}),k(c,{elements:f,shape:p})});function s(){var c=t.context();c&&c.prefix===Vm&&t.cancel()}n.on("create.init",function(){n.on("elements.changed",s),n.once(["create.cancel","create.end"],zR,function(){n.off("elements.changed",s)})}),this.start=function(c,u,l){pe(u)||(u=[u]);var p=ze(u,function(h){return!je(h)});if(p){l=k({elements:u,hints:{},shape:p},l||{}),P(u,function(h){me(h.x)||(h.x=0),me(h.y)||(h.y=0)});var f=Re(u,function(h){return!h.hidden}),d=at(f);P(u,function(h){je(h)&&(h.waypoints=Dt(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,Vm,{cursor:"grabbing",autoActivate:!0,data:{shape:p,elements:u,context:l}})}}}Gm.$inject=["canvas","dragging","eventBus","modeling","rules"];function Wm(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 Um(e){return e&&e.length===1&&!je(e[0])}var VR=750;function qm(e,t,n,i,r){function o(a){var s=oe("g");Z(s,r.cls("djs-drag-group",["no-events"]));var c=oe("g");return a.forEach(function(u){var l;u.hidden||(u.waypoints?(l=n._createContainer("connection",c),n.drawConnection(ir(l),u)):(l=n._createContainer("shape",c),n.drawShape(ir(l),u),Ct(l,u.x,u.y)),i.addDragger(u,s,l))}),s}t.on("create.move",VR,function(a){var s=a.hover,c=a.context,u=c.elements,l=c.dragGroup;l||(l=c.dragGroup=o(u));var p;s?(l.parentNode||(p=e.getActiveLayer(),ye(p,l)),Ct(l,a.x,a.y)):gt(l)}),t.on("create.cleanup",function(a){var s=a.context,c=s.dragGroup;c&&gt(c)})}qm.$inject=["canvas","eventBus","graphicsFactory","previewSupport","styles"];const vs={__depends__:[ti,Gr,jn,gn],__init__:["create","createPreview"],create:["type",Gm],createPreview:["type",qm]};function wl(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)})}wl.$inject=["eventBus"],wl.prototype.getLastMoveEvent=function(){return this._lastMoveEvent||GR(0,0)};function GR(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 Do={__init__:["mouse"],mouse:["type",wl]};var Ym=2e3;function en(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),WR(l)&&(u.priority=2,u.host=l.host.id),je(l)&&(u.priority=3,u.source=l.source.id,u.target=l.target.id,u.waypoints=UR(l)),xe(l)&&(u.priority=4,u.labelTarget=l.labelTarget.id),P(["x","y","width","height"],function(f){me(l[f])&&(u[f]=l[f])}),u.hidden=l.hidden,u.collapsed=l.collapsed}),r.on("copyPaste.elementsCopied",Ym,function(c){var u;((u=c.hints)==null?void 0:u.clip)!==!1&&n.set(c.tree)}),r.on("copyPaste.pasteElements",Ym,function(c){c.tree||(c.tree=n.get())}),r.on("copyPaste.pasteElements",function(c){var u=c.hints;k(u,{createElementsBehavior:!1})})}en.$inject=["canvas","create","clipboard","elementFactory","eventBus","modeling","mouse","rules"],en.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},en.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})}}},en.prototype.duplicate=function(e,t={}){var n=this.copy(e,{clip:!1});return this.paste({...t,tree:n})},en.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},en.prototype._getElementIdsFromTree=function(e){var t={};return P(e,function(n){P(n,function(i){i.id&&(t[i.id]=!0)})}),t},en.prototype._paste=function(e,t,n,i){P(e,function(o){me(o.x)||(o.x=0),me(o.y)||(o.y=0)});var r=at(e);return P(e,function(o){je(o)&&(o.waypoints=Dt(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))},en.prototype._createElements=function(e){var t=this,n=this._eventBus,i={},r=[];return P(e,function(o,a){o=Pn(o,"priority"),P(o,function(s){var c=k({},An(s,["priority"]));i[s.parent]?c.parent=i[s.parent]:delete c.parent,n.fire("copyPaste.pasteElement",{cache:i,descriptor:c});var u;if(je(c)){c.source=i[s.source],c.target=i[s.target],u=i[s.id]=t.createConnection(c),r.push(u);return}if(xe(c)){c.labelTarget=i[c.labelTarget],u=i[s.id]=t.createLabel(c),r.push(u);return}c.host&&(c.host=i[c.host]),u=i[s.id]=t.createShape(c),r.push(u)})}),r},en.prototype.createConnection=function(e){var t=this._elementFactory.createConnection(An(e,["id"]));return t},en.prototype.createLabel=function(e){var t=this._elementFactory.createLabel(An(e,["id"]));return t},en.prototype.createShape=function(e){var t=this._elementFactory.createShape(An(e,["id"]));return t},en.prototype.hasRelations=function(e,t,n){return n||(n=new Set(t)),!(je(e)&&(!n.has(e.source)||!n.has(e.target))||xe(e)&&!n.has(e.labelTarget))},en.prototype.createTree=function(e){var t=this._rules,n=this,i={},r=[],o=new Map,a=Ta(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}nr(a,function(p,f,d){if(xe(p))return;P(p.labels,function(g){c(g,d)});function h(g){g&&g.length&&P(g,function(w){P(w.labels,function(E){c(E,d)}),c(w,d)})}P([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=Dt(r,function(p){return p.element});var l=new Set(e);return r=Dt(r,function(p){return p.descriptor={},n._eventBus.fire("copyPaste.copyElement",{descriptor:p.descriptor,element:p.element,elements:e,elementsSet:l}),p}),r=Pn(r,function(p){return p.descriptor.priority}),e=Dt(r,function(p){return p.element}),P(r,function(p){var f=p.depth;if(!n.hasRelations(p.element,e,l)){Xm(p.element,e),l.delete(p.element);return}if(!s(p.element,e)){Xm(p.element,e),l.delete(p.element);return}i[f]||(i[f]=[]),i[f].push(p.descriptor)}),i};function WR(e){return!!e.host}function UR(e){return Dt(e.waypoints,function(t){return t=Km(t),t.original&&(t.original=Km(t.original)),t})}function Km(e){return k({},e)}function Xm(e,t){var n=t.indexOf(e);return n===-1?t:t.splice(n,1)}const qR={__depends__:[dR,vs,Do,jn],__init__:["copyPaste"],copyPaste:["type",en]};function Sl(e,t,n){pe(n)||(n=[n]),P(n,function(i){Ui(e[i])||(t[i]=e[i])})}var Rl=750;function Zm(e,t,n){function i(c,u){var l=e.create(c.$type);return n.copyElement(c,l,null,u)}t.on("copyPaste.copyElement",Rl,function(c){var u=c.descriptor,l=c.element,p=U(l);if(xe(l))return u;var f=u.businessObject=i(p,!0),d=u.di=i(De(l),!0);d.bpmnElement=f,Sl(f,u,"name"),Sl(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])),An(l,Kt(l,function(f,d,h){var m=d.element,g=d.property;return h===c.id&&(m.set(g,p),f.push(c.id)),f},[]))}t.on("copyPaste.pasteElement",function(c){var u=c.cache,l=c.descriptor,p=l.businessObject,f=l.di;if(xe(l)){l.businessObject=U(u[l.labelTarget]),l.di=De(u[l.labelTarget]);return}p=l.businessObject=i(p),f=l.di=i(f),f.bpmnElement=p,Sl(l,p,["isExpanded","name"]),l.type=p.$type}),t.on("copyPaste.copyElement",Rl,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")&&P(_o(l),p=>{l.push(p.annotation)})}),t.on("copyPaste.pasteElement",Rl,function(c){var u=c.cache,l=c.descriptor;a(u,s(l,u,o(u)))})}Zm.$inject=["bpmnFactory","eventBus","moddleCopy"];const YR=["artifacts","dataInputAssociations","dataOutputAssociations","default","flowElements","lanes","incoming","outgoing","categoryValue"],KR=["errorRef","escalationRef","messageRef","signalRef","dataObjectRef"];function Oo(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 Pn(r,o=>o==="extensionElements")}),e.on("moddleCopy.canCopyProperty",i=>{const{parent:r,property:o,propertyName:a}=i,s=bt(r)&&r.$descriptor;if(a&&KR.includes(a))return o;if(a&&YR.includes(a)||a&&s&&!ze(s.properties,xr({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})}Oo.$inject=["eventBus","bpmnFactory","moddle"],Oo.prototype.copyElement=function(e,t,n,i=!1){n&&!pe(n)&&(n=[n]),n=n||Cl(e.$descriptor);const r=this._eventBus.fire("moddleCopy.canCopyProperties",{propertyNames:n,sourceElement:e,targetElement:t,clone:i});return r===!1||(pe(r)&&(n=r),P(n,o=>{let a;Yt(e,o)&&(a=e.get(o));const s=this.copyProperty(a,t,o,i);!ht(s)||this._eventBus.fire("moddleCopy.canSetCopiedProperty",{parent:t,property:s,propertyName:o})===!1||t.set(o,s)})),t},Oo.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 bt(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)?Kt(e,(a,s)=>{const c=this.copyProperty(s,t,n,i);return c?a.concat(c):a},[]):bt(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},Oo.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 Cl(e,t){return Kt(e.properties,(n,i)=>t&&i.default?n:n.concat(i.name),[])}const Qm={__depends__:[qR],__init__:["bpmnCopyPaste","moddleCopy"],bpmnCopyPaste:["type",Zm],moddleCopy:["type",Oo]};var Jm=Math.round;function Pl(e,t){this._modeling=e,this._eventBus=t}Pl.$inject=["modeling","eventBus"],Pl.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=Jm(s+o/2),l=Jm(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 eg(e,t){t.on("replace.end",500,function(n){const{newElement:i,hints:r={}}=n;r.select!==!1&&e.select(i)})}eg.$inject=["selection","eventBus"];const XR={__init__:["replace","replaceSelectionBehavior"],replaceSelectionBehavior:["type",eg],replace:["type",Pl]};function ZR(e,t,n){pe(n)||(n=[n]),P(n,function(i){Ui(e[i])||(t[i]=e[i])})}var QR=["cancelActivity","instantiate","eventGatewayType","triggeredByEvent","isInterrupting"];function JR(e,t){var n=e&&Yt(e,"collapsed")?e.collapsed:!Pe(e),i;return t&&(Yt(t,"collapsed")||Yt(t,"isExpanded"))?i=Yt(t,"collapsed")?t.collapsed:!t.isExpanded:i=n,n!==i}function tg(e,t,n,i,r,o){function a(s,c,u){u=u||{};var l=c.type,p=s.businessObject;if(ys(p)&&(l==="bpmn:SubProcess"||l==="bpmn:AdHocSubProcess")&&JR(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),ZR(s.di,d.di,["fill","stroke","background-color","border-color","color"]);var h=Cl(p.$descriptor),m=Cl(f.$descriptor,!0),g=eC(h,m);k(f,Sn(c,QR));var w=Re(g,function(x){return x==="eventDefinitions"?ng(s,c.eventDefinitionType):x==="loopCharacteristics"?!Nt(f):Yt(f,x)||x==="processRef"&&c.isExpanded===!1||x==="triggeredByEvent"?!1:x==="isForCompensation"?!Nt(f):!0});if(f=n.copyElement(p,f,w),c.eventDefinitionType&&(ng(f,c.eventDefinitionType)||(d.eventDefinitionType=c.eventDefinitionType,d.eventDefinitionAttrs=c.eventDefinitionAttrs)),y(p,"bpmn:Activity")){if(ys(p))d.isExpanded=Pe(s);else if(c&&Yt(c,"isExpanded")){d.isExpanded=c.isExpanded;var E=t.getDefaultSize(f,{isExpanded:d.isExpanded});d.width=E.width,d.height=E.height,d.x=s.x-(d.width-s.width)/2,d.y=s.y-(d.height-s.height)/2}Pe(s)&&!y(p,"bpmn:Task")&&d.isExpanded&&(d.width=s.width,d.height=s.height)}if(ys(p)&&!ys(f)&&(u.moveChildren=!1),y(p,"bpmn:Participant")){c.isExpanded===!0?f.processRef=e.create("bpmn:Process"):u.moveChildren=!1;var b=Et(s);De(s).isHorizontal||(De(d).isHorizontal=b),d.width=b?s.width:t.getDefaultSize(d).width,d.height=b?t.getDefaultSize(d).height:s.height}return o.allowed("shape.resize",{shape:f})||(d.height=t.getDefaultSize(d).height,d.width=t.getDefaultSize(d).width),f.name=p.name,Se(p,["bpmn:ExclusiveGateway","bpmn:InclusiveGateway","bpmn:Activity"])&&Se(f,["bpmn:ExclusiveGateway","bpmn:InclusiveGateway","bpmn:Activity"])&&(f.default=p.default),c.host&&!y(p,"bpmn:BoundaryEvent")&&y(f,"bpmn:BoundaryEvent")&&(d.host=c.host),(d.type==="bpmn:DataStoreReference"||d.type==="bpmn:DataObjectReference")&&(d.x=s.x+(s.width-d.width)/2),r.replaceElement(s,d,{...u,targetElement:c})}this.replaceElement=a}tg.$inject=["bpmnFactory","elementFactory","moddleCopy","modeling","replace","rules"];function ys(e){return y(e,"bpmn:SubProcess")}function ng(e,t){var n=U(e);return t&&n.get("eventDefinitions").some(function(i){return y(i,t)})}function eC(e,t){return e.filter(function(n){return t.includes(n)})}const ig={__depends__:[Qm,XR,gn],bpmnReplace:["type",tg]};var tC=250;function ur(e){this._eventBus=e,this._tools=[],this._active=null}ur.$inject=["eventBus"],ur.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)},ur.prototype.isActive=function(e){return e&&this._active===e},ur.prototype.length=function(e){return this._tools.length},ur.prototype.setActive=function(e){var t=this._eventBus;this._active!==e&&(this._active=e,t.fire("tool-manager.update",{tool:e}))},ur.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),P(t,function(r){i.push(r+".ended"),i.push(r+".canceled")}),n.on(i,tC,function(r){this._active&&(nC(r)||this.setActive(null))},this)};function nC(e){var t=e.originalEvent&&e.originalEvent.target;return t&&er(t,'.group[data-group="tools"]')}const _s={__depends__:[ti],__init__:["toolManager"],toolManager:["type",ur]};function iC(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 rC(e,t){var n=[],i=new Set(e);P(t,function(o){i.add(o)});var r=new Set;return i.forEach(function(o){var a=o.incoming,s=o.outgoing;P(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 oC(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,aC=Math.round,ni={x:"width",y:"height"},rg="crosshair",ki={n:"top",w:"left",s:"bottom",e:"right"},sC=1500,bs={n:"s",w:"e",s:"n",e:"w"},xs=20;function vn(e,t,n,i,r,o,a){this._canvas=e,this._dragging=t,this._eventBus=n,this._modeling=i,this._rules=r,this._toolManager=o,this._mouse=a;var s=this;o.registerTool("space",{tool:"spaceTool.selection",dragging:"spaceTool"}),n.on("spaceTool.selection.end",function(c){n.once("spaceTool.selection.ended",function(){s.activateMakeSpace(c.originalEvent)})}),n.on("spaceTool.move",sC,function(c){var u=c.context,l=u.initialized;l||(l=u.initialized=s.init(c,u)),l&&ag(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){ag(c);var m={x:0,y:0};m[l]=aC(c["d"+l]),s.makeSpace(f,d,m,p,h),n.once("spaceTool.ended",function(g){s.activateSelection(g.originalEvent,!0,!0)})}})}vn.$inject=["canvas","dragging","eventBus","modeling","rules","toolManager","mouse"],vn.prototype.activateSelection=function(e,t,n){this._dragging.init(e,"spaceTool.selection",{autoActivate:t,cursor:rg,data:{context:{reactivate:n}},trapClick:!1})},vn.prototype.activateMakeSpace=function(e){this._dragging.init(e,"spaceTool",{autoActivate:!0,cursor:rg,data:{context:{}}})},vn.prototype.makeSpace=function(e,t,n,i,r){return this._modeling.createSpace(e,t,n,i,r)},vn.prototype.init=function(e,t){var n=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),To(e)&&(i*=-1);var o=iC(n,i),a=this._canvas.getRootElement();!cs(e)&&e.hover&&(a=e.hover);var s=[...fo(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=cC(c,n,o,r,u);return k(t,c,{axis:n,direction:o,spaceToolConstraints:l,start:r}),gs("resize-"+(n==="x"?"ew":"ns")),!0},vn.prototype.calculateAdjustments=function(e,t,n,i){var r=this._rules,o=[],a=[],s=new Set,c=new Set,u=[],l=[];function p(d){s.has(d)||(s.add(d),o.push(d));var h=d.label;h&&!s.has(h)&&(s.add(h),o.push(h))}function f(d){c.has(d)||(c.add(d),a.push(d))}return P(e,function(d){if(!(!d.parent||xe(d))){if(je(d)){l.push(d);return}var h=d[t],m=h+d[ni[t]];if(uC(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}}}),P(o,function(d){var h=d.attachers;h&&P(h,function(m){p(m)})}),P(u,function(d){var h=d.host;(s.has(h)||c.has(h))&&p(d)}),P(l,function(d){var h=d.source,m=d.target,g=d.label;(s.has(h)||c.has(h))&&(s.has(m)||c.has(m))&&g&&p(g)}),{movingShapes:o,resizingShapes:a}},vn.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateSelection(e,!!e)},vn.prototype.isActive=function(){var e=this._dragging.context();return e?/^spaceTool/.test(e.prefix):!1};function og(e){return{top:e.top-xs,right:e.right+xs,bottom:e.bottom+xs,left:e.left-xs}}function ag(e){var t=e.context,n=t.spaceToolConstraints;if(n){var i,r;me(n.left)&&(i=Math.max(e.x,n.left),e.dx=e.dx+i-e.x,e.x=i),me(n.right)&&(i=Math.min(e.x,n.right),e.dx=e.dx+i-e.x,e.x=i),me(n.top)&&(r=Math.max(e.y,n.top),e.dy=e.dy+r-e.y,e.y=r),me(n.bottom)&&(r=Math.min(e.y,n.bottom),e.dy=e.dy+r-e.y,e.y=r)}}function cC(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 P(a,function(f){var d=f.attachers,h=f.children,m=ue(f),g=Re(h,function(F){return!je(F)&&!xe(F)&&!l.has(F)&&!p.has(F)}),w=Re(h,function(F){return!je(F)&&!xe(F)&&l.has(F)}),E,b,x,S=[],A=[],I,C,$,j;g.length&&(b=og(ue(at(g))),E=i-m[ki[n]]+b[ki[n]],n==="n"?s.bottom=u=me(u)?Math.min(u,E):E:n==="w"?s.right=u=me(u)?Math.min(u,E):E:n==="s"?s.top=c=me(c)?Math.max(c,E):E:n==="e"&&(s.left=c=me(c)?Math.max(c,E):E)),w.length&&(x=og(ue(at(w))),E=i-x[ki[bs[n]]]+m[ki[bs[n]]],n==="n"?s.bottom=u=me(u)?Math.min(u,E):E:n==="w"?s.right=u=me(u)?Math.min(u,E):E:n==="s"?s.top=c=me(c)?Math.max(c,E):E:n==="e"&&(s.left=c=me(c)?Math.max(c,E):E)),d&&d.length&&(d.forEach(function(F){l.has(F)?S.push(F):A.push(F)}),S.length&&(I=ue(at(S.map(fe))),C=m[ki[bs[n]]]-(I[ki[bs[n]]]-i)),A.length&&($=ue(at(A.map(fe))),j=$[ki[n]]-(m[ki[n]]-i)),n==="n"?(E=Math.min(C||1/0,j||1/0),s.bottom=u=me(u)?Math.min(u,E):E):n==="w"?(E=Math.min(C||1/0,j||1/0),s.right=u=me(u)?Math.min(u,E):E):n==="s"?(E=Math.max(C||-1/0,j||-1/0),s.top=c=me(c)?Math.max(c,E):E):n==="e"&&(E=Math.max(C||-1/0,j||-1/0),s.left=c=me(c)?Math.max(c,E):E));var L=r&&r[f.id];L&&(n==="n"?(E=i+f[ni[t]]-L[ni[t]],s.bottom=u=me(u)?Math.min(u,E):E):n==="w"?(E=i+f[ni[t]]-L[ni[t]],s.right=u=me(u)?Math.min(u,E):E):n==="s"?(E=i-f[ni[t]]+L[ni[t]],s.top=c=me(c)?Math.max(c,E):E):n==="e"&&(E=i-f[ni[t]]+L[ni[t]],s.left=c=me(c)?Math.max(c,E):E))}),s}}function uC(e){return!!e.host}var Tl="djs-dragging",sg="djs-resizing",lC=250,Es=Math.max;function cg(e,t,n,i,r){function o(a,s){P(a,function(c){r.addDragger(c,s),n.addMarker(c,Tl)})}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=oe("g");Z(l,i.cls("djs-crosshair-group",["no-events"])),ye(s,l);var p=oe("path");Z(p,"d",u.x),Me(p).add("djs-crosshair"),ye(l,p);var f=oe("path");Z(f,"d",u.y),Me(f).add("djs-crosshair"),ye(l,f),c.crosshairGroup=l}),e.on("spaceTool.selection.move",function(a){var s=a.context.crosshairGroup;Ct(s,a.x,a.y)}),e.on("spaceTool.selection.cleanup",function(a){var s=a.context,c=s.crosshairGroup;c&&gt(c)}),e.on("spaceTool.move",lC,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=oe("path"),Z(c,"d","M0,0 L0,0"),Me(c).add("djs-crosshair"),ye(f,c),s.line=c;var d=oe("g");Z(d,i.cls("djs-drag-group",["no-events"])),ye(n.getActiveLayer(),d),o(l,d);var h=new Set(l);P(p,function(A){h.add(A)});var m=new Set,g=s.movingConnections=[];h.forEach(function(A){P(A.outgoing,function(I){m.has(I)||!je(I)||!h.has(I.target)||(m.add(I),g.push(I))})}),o(g,d),s.dragGroup=d}if(!s.frameGroup){var w=oe("g");Z(w,i.cls("djs-frame-group",["no-events"])),ye(n.getActiveLayer(),w);var E=[];P(p,function(A){var I=r.addFrame(A,w),C=I.getBBox();E.push({element:I,initialBounds:C}),n.addMarker(A,sg)}),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};Z(c,{d:b[u]});var x={x:"y",y:"x"},S={x:a.dx,y:a.dy};S[x[s.axis]]=0,Ct(s.dragGroup,S.x,S.y),P(s.frames,function(A){var I=A.element,C=A.initialBounds,$,j;s.direction==="e"?Z(I,{width:Es(C.width+S.x,5)}):($=Es(C.width-S.x,5),Z(I,{width:$,x:C.x+C.width-$})),s.direction==="s"?Z(I,{height:Es(C.height+S.y,5)}):(j=Es(C.height-S.y,5),Z(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;P(c,function(h){n.removeMarker(h,Tl)}),P(u,function(h){n.removeMarker(h,Tl)}),f&&(gt(p),gt(f)),P(l,function(h){n.removeMarker(h,sg)}),d&&gt(d)})}cg.$inject=["eventBus","elementRegistry","canvas","styles","previewSupport"];const pC={__init__:["spaceToolPreview"],__depends__:[ti,jn,_s,Gr,Do],spaceTool:["type",vn],spaceToolPreview:["type",cg]};function ws(e,t){e.invoke(vn,this),this._canvas=t}ws.$inject=["injector","canvas"],X(ws,vn),ws.prototype.calculateAdjustments=function(e,t,n,i){var r=this._canvas.getRootElement(),o=e[0]===r?null:e[0],a=[];o&&(a=_r(Cr(r.children.filter(u=>y(u,"bpmn:Artifact")),at(o))));const s=[...e,...a];var c=vn.prototype.calculateAdjustments.call(this,s,t,n,i);return c.resizingShapes=c.resizingShapes.filter(function(u){return!(y(u,"bpmn:TextAnnotation")||fC(u)&&(t==="y"&&Et(u)||t==="x"&&!Et(u)))}),c};function fC(e){return y(e,"bpmn:Participant")&&!U(e).processRef}const ug={__depends__:[pC],spaceTool:["type",ws]};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:Kp("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 dC={commandStack:["type",Xe]};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 hC=250,lg=1400;function Ml(e,t,n){W.call(this,t);var i=e.get("movePreview",!1);t.on("shape.move.start",lg,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",hC,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",lg,function(r){var o=r.context,a=o.closure,s=a.enclosedElements,c=[];P(s,function(u){P(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=uu(s.labels,a),o.labelTarget=s,a.labelTarget=null)}),this.revert("shape.delete",function(r){var o=r.context,a=o.shape,s=o.labelTarget,c=o.labelTargetIndex;s&&(it(s.labels,a,c),a.labelTarget=s)})}X(Ml,W),Ml.$inject=["injector","eventBus","modeling"];function pg(e){var t=new Set(e);return Re(e,function(n){return!t.has(n.labelTarget)})}const mC={__init__:["labelSupport"],labelSupport:["type",Ml]};var gC=251,fg=1401,dg="attach-ok";function kl(e,t,n,i,r){W.call(this,t);var o=e.get("movePreview",!1);t.on("shape.move.start",fg,function(a){var s=a.context,c=s.shapes,u=s.validatedShapes;s.shapes=vC(c),s.validatedShapes=yC(u)}),o&&t.on("shape.move.start",gC,function(a){var s=a.context,c=s.shapes,u=Dl(c);P(u,function(l){o.makeDraggable(s,l,!0),P(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,dg),t.once(["shape.move.out","shape.move.cleanup"],function(){n.removeMarker(l,dg)}))}}),this.preExecuted("elements.move",fg,function(a){var s=a.context,c=s.closure,u=s.shapes,l=Dl(u);P(l,function(p){c.add(p,c.topLevel[p.host.id])})}),this.postExecuted("elements.move",function(a){var s=a.context,c=s.shapes,u=s.newHost,l;u&&c.length!==1||(u?l=c:l=Re(c,function(p){var f=p.host;return _C(p)&&!bC(c,f)}),P(l,function(p){r.updateAttachment(p,u)}))}),this.postExecuted("elements.move",function(a){var s=a.context.shapes;P(s,function(c){P(c.attachers,function(u){P(u.outgoing.slice(),function(l){var p=i.allowed("connection.reconnect",{connection:l,source:l.source,target:l.target});p||r.removeConnection(l)}),P(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&&P(u.attachers,function(l){var p=kh(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&&P(p,function(d){var h=kh(d,u,l);r.moveShape(d,h,d.parent),P(d.labels,function(m){r.moveShape(m,h,m.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(kl,W),kl.$inject=["injector","eventBus","canvas","rules","modeling"];function Dl(e){return Mc(Dt(e,function(t){return t.attachers||[]}))}function vC(e){var t=Dl(e);return yb("id",e,t)}function yC(e){var t=br(e,"id");return Re(e,function(n){for(;n;){if(n.host&&t[n.host.id])return!1;n=n.parent}return!0})}function _C(e){return!!e.host}function bC(e,t){return e.indexOf(t)!==-1}const xC={__depends__:[jn],__init__:["attachSupport"],attachSupport:["type",kl]};function hg(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(ad(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)})}hg.$inject=["eventBus","canvas","elementRegistry","graphicsFactory"];const Ol={__init__:["changeSupport"],changeSupport:["type",hg]};function yn(e){this._model=e}yn.$inject=["moddle"],yn.prototype._needsId=function(e){return Se(e,["bpmn:RootElement","bpmn:FlowElement","bpmn:MessageFlow","bpmn:DataAssociation","bpmn:Artifact","bpmn:Participant","bpmn:Lane","bpmn:LaneSet","bpmn:Process","bpmn:Collaboration","bpmndi:BPMNShape","bpmndi:BPMNEdge","bpmndi:BPMNDiagram","bpmndi:BPMNPlane","bpmn:Property","bpmn:CategoryValue"])},yn.prototype._ensureId=function(e){if(e.id){this._model.ids.claim(e.id,e);return}var t;y(e,"bpmn:Activity")?t="Activity":y(e,"bpmn:Event")?t="Event":y(e,"bpmn:Gateway")?t="Gateway":Se(e,["bpmn:SequenceFlow","bpmn:MessageFlow"])?t="Flow":t=(e.$type||"").replace(/^[^:]*:/g,""),t+="_",!e.id&&this._needsId(e)&&(e.id=this._model.ids.nextPrefixed(t,e))},yn.prototype.create=function(e,t){var n=this._model.create(e,t||{});return this._ensureId(n),n},yn.prototype.createDiLabel=function(){return this.create("bpmndi:BPMNLabel",{bounds:this.createDiBounds()})},yn.prototype.createDiShape=function(e,t){return this.create("bpmndi:BPMNShape",k({bpmnElement:e,bounds:this.createDiBounds()},t))},yn.prototype.createDiBounds=function(e){return this.create("dc:Bounds",e)},yn.prototype.createDiWaypoints=function(e){var t=this;return Dt(e,function(n){return t.createDiWaypoint(n)})},yn.prototype.createDiWaypoint=function(e){return this.create("dc:Point",Sn(e,["x","y"]))},yn.prototype.createDiEdge=function(e,t){return this.create("bpmndi:BPMNEdge",k({bpmnElement:e,waypoint:this.createDiWaypoints([])},t))},yn.prototype.createDiPlane=function(e,t){return this.create("bpmndi:BPMNPlane",k({bpmnElement:e},t))};function tn(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"],nn(o)),this.reverted(["shape.move","shape.create","shape.delete","connection.create","connection.move","connection.delete"],nn(a));function s(d){var h=d.context,m=h.oldRoot,g=m.children;P(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"],nn(function(d){d.context.shape.type!=="label"&&c(d)})),this.reverted(["shape.move","shape.create","shape.resize"],nn(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"],nn(u)),this.reverted(["connection.create","connection.move","connection.delete","connection.reconnect"],nn(u));function l(d){i.updateConnectionWaypoints(d.context.connection)}this.executed(["connection.layout","connection.move","connection.updateWaypoints"],nn(l)),this.reverted(["connection.layout","connection.move","connection.updateWaypoints"],nn(l)),this.executed("connection.reconnect",nn(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&&!Se(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",nn(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"],nn(p)),this.reverted(["element.updateAttachment"],nn(p)),this.executed("element.updateLabel",nn(f)),this.reverted("element.updateLabel",nn(f));function f(d){const{element:h}=d.context,m=un(h),g=De(h),w=g&&g.get("label");Ri(h)||us(h)||(m&&!w?g.set("label",t.create("bpmndi:BPMNLabel")):!m&&w&&g.set("label",void 0))}}X(tn,W),tn.$inject=["eventBus","bpmnFactory","connectionDocking"],tn.prototype.updateAttachment=function(e){var t=e.shape,n=t.businessObject,i=t.host;n.attachedToRef=i&&i.businessObject},tn.prototype.updateParent=function(e,t){if(!xe(e)&&!(y(e,"bpmn:DataStoreReference")&&e.parent&&y(e.parent,"bpmn:Collaboration"))){var n=e.parent,i=e.businessObject,r=De(e),o=n&&n.businessObject,a=De(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)}},tn.prototype.updateBounds=function(e){var t=De(e),n=wC(e);if(n){var i=Rn(n,t.get("bounds"));k(n,{x:e.x+i.x,y:e.y+i.y})}var r=xe(e)?this._getLabel(t):t,o=r.bounds;o||(o=this._bpmnFactory.createDiBounds(),r.set("bounds",o)),k(o,{x:e.x,y:e.y,width:e.width,height:e.height})},tn.prototype.updateFlowNodeRefs=function(e,t,n){if(n!==t){var i,r;y(n,"bpmn:Lane")&&(i=n.get("flowNodeRef"),et(i,e)),y(t,"bpmn:Lane")&&(r=t.get("flowNodeRef"),it(r,e))}},tn.prototype.updateDiConnection=function(e,t,n){var i=De(e),r=De(t),o=De(n);i.sourceElement&&i.sourceElement.bpmnElement!==U(t)&&(i.sourceElement=t&&r),i.targetElement&&i.targetElement.bpmnElement!==U(n)&&(i.targetElement=n&&o)},tn.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):(et(n,e),e.$parent=null)}};function EC(e){for(;e&&!y(e,"bpmn:Definitions");)e=e.$parent;return e}tn.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)},tn.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=EC(e.$parent||t),e.$parent&&(et(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),et(a,e)),t?(a=t.get(i),a.push(e),e.$parent=t):e.$parent=null,n){var s=n.get(i);et(a,e),t&&(s||(s=[],t.set(i,s)),s.push(e))}}},tn.prototype.updateConnectionWaypoints=function(e){var t=De(e);t.set("waypoint",this._bpmnFactory.createDiWaypoints(e.waypoints))},tn.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&&(et(n.sourceRef&&n.sourceRef.get("outgoing"),n),r&&r.get("outgoing")&&r.get("outgoing").push(n)),n.sourceRef=r),n.targetRef!==a&&(c&&(et(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)},tn.prototype._getLabel=function(e){return e.label||(e.label=this._bpmnFactory.createDiLabel()),e.label};function nn(e){return function(t){var n=t.context,i=n.shape||n.connection||n.element;y(i,"bpmn:BaseElement")&&e(t)}}function wC(e){if(y(e,"bpmn:Activity")){var t=De(e);if(t){var n=t.get("label");if(n)return n.get("bounds")}}}function Oi(e,t){Zn.call(this),this._bpmnFactory=e,this._moddle=t}X(Oi,Zn),Oi.$inject=["bpmnFactory","moddle"],Oi.prototype._baseCreate=Zn.prototype.create,Oi.prototype.create=function(e,t){if(e==="label"){var n=t.di||this._bpmnFactory.createDiLabel();return this._baseCreate(e,k({type:"label",di:n},rr,t))}return this.createElement(e,t)},Oi.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(!RC(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=SC(i,t,["processRef","isInterrupting","associationDirection","isForCompensation"]),t.isExpanded&&(t=Il(r,t,"isExpanded")),Se(i,["bpmn:Lane","bpmn:Participant"])&&(t=Il(r,t,"isHorizontal")),y(i,"bpmn:SubProcess")&&(t.collapsed=!Pe(i,r)),y(i,"bpmn:ExclusiveGateway")&&(Yt(r,"isMarkerVisible")?r.isMarkerVisible===void 0&&(r.isMarkerVisible=!1):r.isMarkerVisible=!0),ht(t.triggeredByEvent)&&(i.triggeredByEvent=t.triggeredByEvent,delete t.triggeredByEvent),ht(t.cancelActivity)&&(i.cancelActivity=t.cancelActivity,delete t.cancelActivity);var a,s;return t.eventDefinitionType&&(a=i.get("eventDefinitions")||[],s=this._bpmnFactory.create(t.eventDefinitionType,t.eventDefinitionAttrs),t.eventDefinitionType==="bpmn:ConditionalEventDefinition"&&(s.condition=this._bpmnFactory.create("bpmn:FormalExpression")),a.push(s),s.$parent=i,i.eventDefinitions=a,delete t.eventDefinitionType),n=this.getDefaultSize(i,r),t=k({id:i.id},n,t,{businessObject:i,di:r}),this._baseCreate(e,t)},Oi.prototype.getDefaultSize=function(e,t){var n=U(e);if(t=t||De(e),y(n,"bpmn:SubProcess"))return Pe(n,t)?{width:350,height:200}:{width:100,height:80};if(y(n,"bpmn:Task"))return{width:100,height:80};if(y(n,"bpmn:Gateway"))return{width:50,height:50};if(y(n,"bpmn:Event"))return{width:36,height:36};if(y(n,"bpmn:Participant")){var i=t.isHorizontal===void 0||t.isHorizontal===!0;return Pe(n,t)?i?{width:600,height:250}:{width:250,height:600}:i?{width:400,height:60}:{width:60,height:400}}return y(n,"bpmn:Lane")?{width:400,height:100}:y(n,"bpmn:DataObjectReference")?{width:36,height:50}:y(n,"bpmn:DataStoreReference")?{width:50,height:50}:y(n,"bpmn:TextAnnotation")?{width:100,height:40}:y(n,"bpmn:Group")?{width:300,height:300}:{width:100,height:80}},Oi.prototype.createParticipantShape=function(e){return bt(e)||(e={isExpanded:e}),e=k({type:"bpmn:Participant"},e||{}),e.isExpanded!==!1&&(e.processRef=this._bpmnFactory.create("bpmn:Process")),this.createShape(e)};function SC(e,t,n){return P(n,function(i){t=Il(e,t,i)}),t}function Il(e,t,n){return t[n]===void 0?t:(e[n]=t[n],An(t,[n]))}function RC(e){return Se(e,["bpmndi:BPMNShape","bpmndi:BPMNEdge","bpmndi:BPMNDiagram","bpmndi:BPMNPlane"])}function Ss(e,t){this._modeling=e,this._canvas=t}Ss.$inject=["modeling","canvas"],Ss.prototype.preExecute=function(e){var t=this._modeling,n=e.elements,i=e.alignment;P(n,function(r){var o={x:0,y:0};ht(i.left)?o.x=i.left-r.x:ht(i.right)?o.x=i.right-r.width-r.x:ht(i.center)?o.x=i.center-Math.round(r.width/2)-r.x:ht(i.top)?o.y=i.top-r.y:ht(i.bottom)?o.y=i.bottom-r.height-r.y:ht(i.middle)&&(o.y=i.middle-Math.round(r.height/2)-r.y),t.moveElements([r],o,r.parent)})},Ss.prototype.postExecute=function(e){};function Rs(e){this._modeling=e}Rs.$inject=["modeling"],Rs.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},Rs.prototype.postExecute=function(e){var t=e.hints||{};CC(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 CC(e,t){return di(e.outgoing,function(n){return n.target===t})}function Cs(e,t){this._canvas=e,this._layouter=t}Cs.$inject=["canvas","layouter"],Cs.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},Cs.prototype.revert=function(e){var t=e.connection;return this._canvas.removeConnection(t),t.source=null,t.target=null,t};var Ps=Math.round;function Ll(e){this._modeling=e}Ll.$inject=["modeling"],Ll.prototype.preExecute=function(e){var t=e.elements,n=e.parent,i=e.parentIndex,r=e.position,o=e.hints,a=this._modeling;P(t,function(p){me(p.x)||(p.x=0),me(p.y)||(p.y=0)});var s=Re(t,function(p){return!p.hidden}),c=at(s);P(t,function(p){je(p)&&(p.waypoints=Dt(p.waypoints,function(f){return{x:Ps(f.x-c.x-c.width/2+r.x),y:Ps(f.y-c.y-c.height/2+r.y)}})),k(p,{x:Ps(p.x-c.x-c.width/2+r.x),y:Ps(p.y-c.y-c.height/2+r.y)})});var u=new Set(Ta(t)),l={};P(t,function(p){if(je(p)){l[p.id]=me(i)?a.createConnection(l[p.source.id],l[p.target.id],i,p,p.parent||n,o):a.createConnection(l[p.source.id],l[p.target.id],p,p.parent||n,o);return}var f=k({},o);u.has(p)||(f.autoResize=!1),xe(p)&&(f=An(f,["attach"])),l[p.id]=me(i)?a.createShape(p,Sn(p,["x","y","width","height"]),p.parent||n,i,f):a.createShape(p,Sn(p,["x","y","width","height"]),p.parent||n,f)}),e.elements=_r(l)};var mg=Math.round;function Ii(e){this._canvas=e}Ii.$inject=["canvas"],Ii.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-mg(t.width/2),y:n.y-mg(t.height/2)}),this._canvas.addShape(t,i,r),t},Ii.prototype.revert=function(e){var t=e.shape;return this._canvas.removeShape(t),t};function Io(e){Ii.call(this,e)}X(Io,Ii),Io.$inject=["canvas"];var PC=Ii.prototype.execute;Io.prototype.execute=function(e){var t=e.shape;return TC(t),t.labelTarget=e.labelTarget,PC.call(this,e)};var AC=Ii.prototype.revert;Io.prototype.revert=function(e){return e.shape.labelTarget=null,AC.call(this,e)};function TC(e){["width","height"].forEach(function(t){typeof e[t]>"u"&&(e[t]=0)})}function Lo(e,t){this._canvas=e,this._modeling=t}Lo.$inject=["canvas","modeling"],Lo.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})})},Lo.prototype.execute=function(e){var t=e.connection,n=t.parent;return e.parent=n,e.parentIndex=uu(n.children,t),e.source=t.source,e.target=t.target,this._canvas.removeConnection(t),t.source=null,t.target=null,t},Lo.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 Bl(e,t){this._modeling=e,this._elementRegistry=t}Bl.$inject=["modeling","elementRegistry"],Bl.prototype.postExecute=function(e){var t=this._modeling,n=this._elementRegistry,i=e.elements;P(i,function(r){n.get(r.id)&&(r.waypoints?t.removeConnection(r):t.removeShape(r))})};function Bo(e,t){this._canvas=e,this._modeling=t}Bo.$inject=["canvas","modeling"],Bo.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){je(i)?t.removeConnection(i,{nested:!0}):t.removeShape(i,{nested:!0})})},Bo.prototype.execute=function(e){var t=this._canvas,n=e.shape,i=n.parent;return e.oldParent=i,e.oldParentIndex=uu(i.children,n),t.removeShape(n),n},Bo.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 As(e){this._modeling=e}As.$inject=["modeling"];var gg={x:"y",y:"x"};As.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[gg[i]]=0,t.moveElements([w],E,w.parent))}var l=n[0],p=s(n),f=n[p],d,h,m=0;P(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=Pn(g.elements,i),b=E[0],w===p&&(b=E[s(E)]),x=a(b),g.range=null,P(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)&&P(n,function(g,w){var E={},b;g===l||g===f||(b=n[w-1],g.range.max=0,P(g.elements,function(x,S){E[gg[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)}))})},As.prototype.postExecute=function(e){};function Ts(e,t){this._layouter=e,this._canvas=t}Ts.$inject=["layouter","canvas"],Ts.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},Ts.prototype.revert=function(e){var t=e.connection;return t.waypoints=e.oldWaypoints,t};function Nl(){}Nl.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=et(o.children,t),it(i.children,t,r),t.parent=i,P(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},Nl.prototype.revert=function(e){var t=e.connection,n=t.parent,i=e.oldParent,r=e.oldParentIndex,o=e.delta;return et(n.children,t),it(i.children,t,r),t.parent=i,P(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 $l(){this.allShapes={},this.allConnections={},this.enclosedElements={},this.enclosedConnections={},this.topLevel={}}$l.prototype.add=function(e,t){return this.addAll([e],t)},$l.prototype.addAll=function(e,t){var n=oE(e,!!t,this);return k(this,n),this};function No(e){this._modeling=e}No.prototype.moveRecursive=function(e,t,n){return e?this.moveClosure(this.getClosure(e),t,n):[]},No.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),P(a,function(p){o.moveShape(p,t,u[p.id]&&!l&&n,{recurse:!1,layout:!1})}),P(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&&Uu(p,p.target,t)})})},No.prototype.getClosure=function(e){return new $l().addAll(e,!0)};function Ms(e){this._helper=new No(e)}Ms.$inject=["modeling"],Ms.prototype.preExecute=function(e){e.closure=this._helper.getClosure(e.shapes)},Ms.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 lr(e){this._modeling=e,this._helper=new No(e)}lr.$inject=["modeling"],lr.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=Sn(t,["x","y","width","height"]),e.oldParent=o,e.oldParentIndex=et(o.children,t),it(i.children,t,r),k(t,{parent:i,x:t.x+n.x,y:t.y+n.y}),t},lr.prototype.postExecute=function(e){var t=e.shape,n=e.delta,i=e.hints,r=this._modeling;i.layout!==!1&&(P(t.incoming,function(o){r.layoutConnection(o,{connectionEnd:Uu(o,t,n)})}),P(t.outgoing,function(o){r.layoutConnection(o,{connectionStart:Wu(o,t,n)})})),i.recurse!==!1&&this.moveChildren(e)},lr.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},lr.prototype.moveChildren=function(e){var t=e.delta,n=e.shape;this._helper.moveRecursive(n.children,t,null)},lr.prototype.getNewParent=function(e){return e.newParent||e.shape.parent};function $o(e){this._modeling=e}$o.$inject=["modeling"],$o.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},$o.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||vg(pe(r)?r[0]:r)),i&&(!n||o.docking==="target")&&(a.connectionEnd=a.connectionEnd||vg(pe(r)?r[r.length-1]:r)),o.newWaypoints&&(a.waypoints=o.newWaypoints),this._modeling.layoutConnection(t,a))},$o.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 vg(e){return e.original||e}function ii(e,t){this._modeling=e,this._rules=t}ii.$inject=["modeling","rules"],ii.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();P(f,function(h){var m=h.source,g=c(m,s,h);g&&t.reconnectEnd(h,s,is(h,s,l),a)}),P(d,function(h){var m=h.target,g=c(s,m,h);g&&t.reconnectStart(h,s,ns(h,s,l),a)})},ii.prototype.postExecute=function(e){var t=e.oldShape;this._modeling.removeShape(t)},ii.prototype.execute=function(e){},ii.prototype.revert=function(e){},ii.prototype.createShape=function(e,t,n,i){return this._modeling.createShape(e,t,n,i)},ii.prototype.reconnectStart=function(e,t,n,i){this._modeling.reconnectStart(e,t,n,i)},ii.prototype.reconnectEnd=function(e,t,n,i){this._modeling.reconnectEnd(e,t,n,i)};function jo(e){this._modeling=e}jo.$inject=["modeling"],jo.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},jo.prototype.postExecute=function(e){var t=this._modeling,n=e.shape,i=e.oldBounds,r=e.hints||{};r.layout!==!1&&(P(n.incoming,function(o){t.layoutConnection(o,{connectionEnd:is(o,n,i)})}),P(n.outgoing,function(o){t.layoutConnection(o,{connectionStart:ns(o,n,i)})}))},jo.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 Li(e){this._modeling=e}Li.$inject=["modeling"],Li.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),P(r,function(s){a[s.id]=kC(s)}),this.resizeShapes(r,t,n),this.updateConnectionWaypoints(rC(i,r),t,n,o,i,r,a)},Li.prototype.execute=function(){},Li.prototype.revert=function(){},Li.prototype.moveShapes=function(e,t){var n=this;P(e,function(i){n._modeling.moveShape(i,t,null,{autoResize:!1,layout:!1,recurse:!1})})},Li.prototype.resizeShapes=function(e,t,n){var i=this;P(e,function(r){var o=oC(r,n,t);i._modeling.resizeShape(r,o,null,{attachSupport:!1,autoResize:!1,layout:!1})})},Li.prototype.updateConnectionWaypoints=function(e,t,n,i,r,o,a){var s=this,c=new Set(r),u=new Set(o);P(e,function(l){var p=l.source,f=l.target,d=MC(l),h=_g(n),m={},g=c.has(p)||u.has(p),w=c.has(f)||u.has(f);g&&w?(d=Dt(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=Wu(l,p,t):c.has(f)?m.connectionEnd=Uu(l,f,t):u.has(p)?m.connectionStart=ns(l,p,a[p.id]):u.has(f)&&(m.connectionEnd=is(l,f,a[f.id])),s._modeling.layoutConnection(l,m))})};function yg(e){return k({},e)}function MC(e){return Dt(e.waypoints,function(t){return t=yg(t),t.original&&(t.original=yg(t.original)),t})}function _g(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=_g(n);if(/e|s/.test(n))return e[i]>t;if(/n|w/.test(n))return e[i]<t}function kC(e){return{x:e.x,y:e.y,height:e.height,width:e.width}}function ks(e){this._modeling=e}ks.$inject=["modeling"],ks.prototype.execute=function(e){var t=e.shape,n=t.children;e.oldChildrenVisibility=xg(n),t.collapsed=!t.collapsed;var i=Eg(n,t.collapsed);return[t].concat(i)},ks.prototype.revert=function(e){var t=e.shape,n=e.oldChildrenVisibility,i=t.children,r=wg(i,n);return t.collapsed=!t.collapsed,[t].concat(r)};function xg(e){var t={};return P(e,function(n){t[n.id]=n.hidden,n.children&&(t=k({},t,xg(n.children)))}),t}function Eg(e,t){var n=[];return P(e,function(i){i.hidden=t,n=n.concat(i),i.children&&(n=n.concat(Eg(i.children,i.collapsed||t)))}),n}function wg(e,t){var n=[];return P(e,function(i){i.hidden=t[i.id],n=n.concat(i),i.children&&(n=n.concat(wg(i.children,t)))}),n}function Ds(e){this._modeling=e}Ds.$inject=["modeling"],Ds.prototype.execute=function(e){var t=e.shape,n=e.newHost,i=t.host;return e.oldHost=i,e.attacherIdx=Sg(i,t),Rg(n,t),t.host=n,t},Ds.prototype.revert=function(e){var t=e.shape,n=e.newHost,i=e.oldHost,r=e.attacherIdx;return t.host=i,Sg(n,t),Rg(i,t,r),t};function Sg(e,t){return et(e&&e.attachers,t)}function Rg(e,t,n){if(e){var i=e.attachers;i||(e.attachers=i=[]),it(i,t,n)}}function jl(){}jl.prototype.execute=function(e){var t=e.connection,n=e.newWaypoints;return e.oldWaypoints=t.waypoints,t.waypoints=n,t},jl.prototype.revert=function(e){var t=e.connection,n=e.oldWaypoints;return t.waypoints=n,t};function Fe(e,t,n){this._eventBus=e,this._elementFactory=t,this._commandStack=n;var i=this;e.on("diagram.init",function(){i.registerHandlers(n)})}Fe.$inject=["eventBus","elementFactory","commandStack"],Fe.prototype.getHandlers=function(){return{"shape.append":Rs,"shape.create":Ii,"shape.delete":Bo,"shape.move":lr,"shape.resize":jo,"shape.replace":ii,"shape.toggleCollapse":ks,spaceTool:Li,"label.create":Io,"connection.create":Cs,"connection.delete":Lo,"connection.move":Nl,"connection.layout":Ts,"connection.updateWaypoints":jl,"connection.reconnect":$o,"elements.create":Ll,"elements.move":Ms,"elements.delete":Bl,"elements.distribute":As,"elements.align":Ss,"element.updateAttachment":Ds}},Fe.prototype.registerHandlers=function(e){P(this.getHandlers(),function(t,n){e.registerHandler(n,t)})},Fe.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)},Fe.prototype.updateAttachment=function(e,t){var n={shape:e,newHost:t};this._commandStack.execute("element.updateAttachment",n)},Fe.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)},Fe.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)},Fe.prototype.layoutConnection=function(e,t){var n={connection:e,hints:t||{}};this._commandStack.execute("connection.layout",n)},Fe.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},Fe.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},Fe.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},Fe.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},Fe.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},Fe.prototype.removeElements=function(e){var t={elements:e};this._commandStack.execute("elements.delete",t)},Fe.prototype.distributeElements=function(e,t,n){var i={groups:e,axis:t,dimension:n};this._commandStack.execute("elements.distribute",i)},Fe.prototype.removeShape=function(e,t){var n={shape:e,hints:t||{}};this._commandStack.execute("shape.delete",n)},Fe.prototype.removeConnection=function(e,t){var n={connection:e,hints:t||{}};this._commandStack.execute("connection.delete",n)},Fe.prototype.replaceShape=function(e,t,n){var i={oldShape:e,newData:t,hints:n||{}};return this._commandStack.execute("shape.replace",i),i.newShape},Fe.prototype.alignElements=function(e,t){var n={elements:e,alignment:t};this._commandStack.execute("elements.align",n)},Fe.prototype.resizeShape=function(e,t,n,i){var r={shape:e,newBounds:t,minBounds:n,hints:i};this._commandStack.execute("shape.resize",r)},Fe.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)},Fe.prototype.updateWaypoints=function(e,t,n){var i={connection:e,newWaypoints:t,hints:n||{}};this._commandStack.execute("connection.updateWaypoints",i)},Fe.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)},Fe.prototype.reconnectStart=function(e,t,n,i){i||(i={}),this.reconnect(e,t,e.target,n,k(i,{docking:"source"}))},Fe.prototype.reconnectEnd=function(e,t,n,i){i||(i={}),this.reconnect(e,e.source,t,n,k(i,{docking:"target"}))},Fe.prototype.connect=function(e,t,n,i){return this.createConnection(e,t,n||{},e.parent,i)},Fe.prototype._create=function(e,t){return GE(t)?t:this._elementFactory.create(e,t)},Fe.prototype.toggleCollapse=function(e,t){var n={shape:e,hints:t||{}};this._commandStack.execute("shape.toggleCollapse",n)};function Fo(e){this._elementRegistry=e}Fo.$inject=["elementRegistry"],Fo.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||DC(n,pa(i));return Cg(n,i),e.oldProperties=o,e.changed=r,r},Fo.prototype.revert=function(e){var t=e.oldProperties,n=e.moddleElement,i=e.changed;return Cg(n,t),i},Fo.prototype._getVisualReferences=function(e){var t=this._elementRegistry;return y(e,"bpmn:DataObject")?OC(e,t):[]};function DC(e,t){return Kt(t,function(n,i){return n[i]=e.get(i),n},{})}function Cg(e,t){P(t,function(n,i){e.set(i,n)})}function OC(e,t){return t.filter(function(n){return y(n,"bpmn:DataObjectReference")&&U(n).dataObjectRef===e})}var Ho="default",ri="id",Pg="di",IC={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=jC(e.properties),s=e.oldProperties||LC(t,a);return Ag(a,o)&&(r.unclaim(o[ri]),i.updateId(t,a[ri]),r.claim(a[ri],o)),Ho in a&&(a[Ho]&&n.push(i.get(a[Ho].id)),o[Ho]&&n.push(i.get(o[Ho].id))),Tg(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,IC)}},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 Tg(t,i),Ag(n,r)&&(a.unclaim(n[ri]),o.updateId(t,i[ri]),a.claim(i[ri],r)),e.changed};function Ag(e,t){return ri in e&&e[ri]!==t[ri]}function LC(e,t){var n=pa(t),i=e.businessObject,r=De(e);return Kt(n,function(o,a){return a!==Pg?o[a]=i.get(a):o[a]=BC(r,pa(t.di)),o},{})}function BC(e,t){return Kt(t,function(n,i){return n[i]=e&&e.get(i),n},{})}function Tg(e,t){var n=e.businessObject,i=De(e);P(t,function(r,o){o!==Pg?n.set(o,r):i&&NC(i,r)})}function NC(e,t){P(t,function(n,i){e.set(i,n)})}var $C=["default"];function jC(e){var t=k({},e);return $C.forEach(function(n){n in e&&(t[n]=U(t[n]))}),t}function Os(e,t){this._canvas=e,this._modeling=t}Os.$inject=["canvas","modeling"],Os.prototype.execute=function(e){var t=this._canvas,n=e.newRoot,i=n.businessObject,r=t.getRootElement(),o=r.businessObject,a=o.$parent,s=De(r);return t.setRootElement(n),t.removeRootElement(r),it(a.rootElements,i),i.$parent=a,et(a.rootElements,o),o.$parent=null,r.di=null,s.bpmnElement=i,n.di=s,e.oldRoot=r,[]},Os.prototype.revert=function(e){var t=this._canvas,n=e.newRoot,i=n.businessObject,r=e.oldRoot,o=r.businessObject,a=i.$parent,s=De(n);return t.setRootElement(r),t.removeRootElement(n),et(a.rootElements,i),i.$parent=null,it(a.rootElements,o),o.$parent=a,n.di=null,s.bpmnElement=o,r.di=s,[]};function Fl(e,t){this._modeling=e,this._spaceTool=t}Fl.$inject=["modeling","spaceTool"],Fl.prototype.preExecute=function(e){var t=this._spaceTool,n=this._modeling,i=e.shape,r=e.location,o=hn(i),a=o===i,s=a?i:i.parent,c=Pi(s),u=Et(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+dn,y:i.y,width:i.width-dn,height:i.height}:{x:i.x,y:i.y+dn,width:i.width,height:i.height-dn};n.createShape({type:"bpmn:Lane",isHorizontal:u},l,s)}var p=[];nr(o,function(x){return p.push(x),x.label&&p.push(x.label),x===i?[]:Re(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?dn:0),y:d-(r==="top"?120:0),width:i.width-(a?dn:0),height:120}:{x:d-(r==="left"?120:0),y:i.y+(a?dn:0),width:120,height:i.height-(a?dn:0)};e.newLane=n.createShape({type:"bpmn:Lane",isHorizontal:u},b,s)};function Hl(e){this._modeling=e}Hl.$inject=["modeling"],Hl.prototype.preExecute=function(e){var t=this._modeling,n=e.shape,i=e.count,r=Pi(n),o=r.length;if(o>i)throw new Error(`more than <${i}> child lanes`);var a=Et(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+dn,y:n.y+f*c,width:n.width-dn,height:u}:{x:n.x+f*c,y:n.y+dn,width:u,height:n.height-dn},f<o?t.resizeShape(r[f],l):(p={type:"bpmn:Lane",isHorizontal:a},t.createShape(p,l,n))};function Vo(e,t){this._modeling=e,this._spaceTool=t}Vo.$inject=["modeling","spaceTool"],Vo.prototype.preExecute=function(e){var t=e.shape,n=e.newBounds,i=e.balanced;i!==!1?this.resizeBalanced(t,n):this.resizeSpace(t,n)},Vo.prototype.resizeBalanced=function(e,t){var n=this._modeling,i=O1(e,t);n.resizeShape(e,t),i.forEach(function(r){n.resizeShape(r.shape,r.newBounds)})},Vo.prototype.resizeSpace=function(e,t){var n=this._spaceTool,i=ue(e),r=ue(t),o=sh(r,i),a=hn(e),s=[],c=[];nr(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 Go="flowNodeRef",zl="lanes";function Is(){}Is.prototype._computeUpdates=function(e,t){var n=[],i=[],r={},o=[];function a(l,p){var f=ue(p),d={x:l.x+l.width/2,y:l.y+l.height/2};return d.x>f.left&&d.x<f.right&&d.y>f.top&&d.y<f.bottom}function s(l){n.indexOf(l)===-1&&(o.push(l),n.push(l))}function c(l){var p=hn(l);return r[p.id]||(r[p.id]=Za(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=hn(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(zl),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(Go).forEach(function(f){i.push({flowNode:f,remove:[p],add:[]})})}),i},Is.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(zl);n.remove.forEach(function(o){et(r,o),et(o.get(Go),i)}),n.add.forEach(function(o){it(r,o),it(o.get(Go),i)})}),[]},Is.prototype.revert=function(e){var t=e.updates;return t.forEach(function(n){var i=n.flowNode,r=i.get(zl);n.add.forEach(function(o){et(r,o),et(o.get(Go),i)}),n.remove.forEach(function(o){it(r,o),it(o.get(Go),i)})}),[]};var Vl="categoryValueRef";function Wo(e,t){this._bpmnFactory=e,this._elementRegistry=t}Wo.$inject=["bpmnFactory","elementRegistry"],Wo.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:Gl(E)}:S.past={categoryValue:b}))}}function c(E){r.set(E,U(E))}function u(){n.filter(function(E){return y(E,"bpmn:FlowElement")&&!xe(E)&&E.parent}).forEach(c)}function l(E){var b=U(E),x=b.get("categoryValueRef");return x||(x=nh(i,b),o.push(FC(E,x))),x}function p(E){return E.reduce(function(b,x){var S=Gl(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")&&!xe(E)&&E.parent}).forEach(function(E){var b=U(E).get("categoryValueRef");if(!b){var x=Gl(E),S=f.get(x)||[],A=Cr(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=Cr(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(Vl),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}},Wo.prototype.execute=function(e){var t=e.updates;return t||(t=e.updates=this._computeUpdates(e.affectedFlowElements,e.affectedGroupEntries)),HC(t.groups),VC(t.flowElements),[]},Wo.prototype.revert=function(e){var t=e.updates;return GC(t.flowElements),zC(t.groups),[]};function FC(e,t){return{groupShape:e,categoryValue:t,category:t.$parent}}function HC(e){e.forEach(function(t){U(t.groupShape).categoryValueRef=t.categoryValue,t.categoryValue.$parent=t.category})}function zC(e){e.forEach(function(t){U(t.groupShape).categoryValueRef=null})}function VC(e){e.forEach(function(t){var n=t.businessObject,i=n.get(Vl);t.categoryValuesToRemove.forEach(function(r){et(i,r)}),t.categoryValuesToAdd.forEach(function(r){it(i,r,!0)})})}function GC(e){e.forEach(function(t){var n=t.businessObject,i=n.get(Vl);t.categoryValuesToAdd.forEach(function(r){et(i,r)}),t.categoryValuesToRemove.forEach(function(r){it(i,r,!0)})})}function Gl(e){for(;e.parent;)e=e.parent;return e}function Ls(e){this._moddle=e}Ls.$inject=["moddle"],Ls.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),[]},Ls.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 WC={fill:void 0,stroke:void 0};function Wl(e){this._commandStack=e,this._normalizeColor=function(t){if(t){if(qt(t)){var n=UC(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||WC,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)}),P(t,function(o){var a=je(o)?Sn(r,["border-color"]):r,s=De(o);if(qC(a),xe(o)){if(!s||!y(s.label,"bpmndi:BPMNLabel"))return;i._commandStack.execute("element.updateModdleProperties",{element:o,moddleElement:s.label,properties:{color:r["border-color"]}})}else{if(!Se(s,["bpmndi:BPMNEdge","bpmndi:BPMNShape"]))return;i._commandStack.execute("element.updateProperties",{element:o,properties:{di:a}})}})};function UC(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 qC(e){"border-color"in e&&(e.stroke=e["border-color"]),"background-color"in e&&(e.fill=e["background-color"])}var YC={width:0,height:0};function Mg(e,t,n){function i(c,u){var l=c.label||c,p=c.labelTarget||c;return Ew(l,u),[l,p]}function r(c){var u=c.element,l=u.businessObject,p=c.newLabel;if(!xe(u)&&Ri(u)&&!$a(u)&&!kg(p)){var f=7,d=mu(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=un(c.element),i(c.element,c.newLabel)}function a(c){return i(c.element,c.oldLabel)}function s(c){var u=c.element,l=u.label||u,p=c.newLabel,f=c.newBounds,d=c.hints||{};if(!(!xe(l)&&!y(l,"bpmn:TextAnnotation"))){if(xe(l)&&kg(p)){d.removeShape!==!1&&e.removeShape(l,{unsetLabel:!1});return}var h=un(u);typeof f>"u"&&(f=t.getExternalLabelBounds(l,h)),f&&e.resizeShape(l,f,YC)}}this.preExecute=r,this.execute=o,this.revert=a,this.postExecute=s}Mg.$inject=["modeling","textRenderer","bpmnFactory"];function kg(e){return!e||!e.trim()}function At(e,t,n,i){Fe.call(this,e,t,n),this._bpmnRules=i}X(At,Fe),At.$inject=["eventBus","elementFactory","commandStack","bpmnRules"],At.prototype.getHandlers=function(){var e=Fe.prototype.getHandlers.call(this);return e["element.updateModdleProperties"]=Fo,e["element.updateProperties"]=zo,e["canvas.updateRoot"]=Os,e["lane.add"]=Fl,e["lane.resize"]=Vo,e["lane.split"]=Hl,e["lane.updateRefs"]=Is,e["group.updateRefs"]=Wo,e["id.updateClaim"]=Ls,e["element.setColor"]=Wl,e["element.updateLabel"]=Mg,e},At.prototype.updateLabel=function(e,t,n,i){this._commandStack.execute("element.updateLabel",{element:e,newLabel:t,newBounds:n,hints:i||{}})},At.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)},At.prototype.updateModdleProperties=function(e,t,n){this._commandStack.execute("element.updateModdleProperties",{element:e,moddleElement:t,properties:n})},At.prototype.updateProperties=function(e,t){this._commandStack.execute("element.updateProperties",{element:e,properties:t})},At.prototype.resizeLane=function(e,t,n){this._commandStack.execute("lane.resize",{shape:e,newBounds:t,balanced:n})},At.prototype.addLane=function(e,t){var n={shape:e,location:t};return this._commandStack.execute("lane.add",n),n.newLane},At.prototype.splitLane=function(e,t){this._commandStack.execute("lane.split",{shape:e,count:t})},At.prototype.makeCollaboration=function(){var e=this._create("root",{type:"bpmn:Collaboration"}),t={newRoot:e};return this._commandStack.execute("canvas.updateRoot",t),e},At.prototype.makeProcess=function(){var e=this._create("root",{type:"bpmn:Process"}),t={newRoot:e};return this._commandStack.execute("canvas.updateRoot",t),e},At.prototype.updateLaneRefs=function(e,t){this._commandStack.execute("lane.updateRefs",{flowNodeShapes:e,laneShapes:t})},At.prototype.updateCategoryValueRefs=function(e,t){this._commandStack.execute("group.updateRefs",{affectedFlowElements:e,affectedGroupEntries:t})},At.prototype.claimId=function(e,t){this._commandStack.execute("id.updateClaim",{id:e,element:t,claiming:!0})},At.prototype.unclaimId=function(e,t){this._commandStack.execute("id.updateClaim",{id:e,element:t})},At.prototype.setColor=function(e,t){e.length||(e=[e]),this._commandStack.execute("element.setColor",{elements:e,colors:t})};function Dg(){}Dg.prototype.layoutConnection=function(e,t){return t=t||{},[t.connectionStart||fe(t.source||e.source),t.connectionEnd||fe(t.target||e.target)]};var Bs=20,KC=5,Ns=Math.round,Og=20,XC={"h:h":20,"v:v":20,"h:v":-10,"v:h":-10};function ZC(e,t){return!{t:/top/,r:/right/,b:/bottom/,l:/left/,h:/./,v:/./}[t].test(e)}function QC(e,t){return{t:/top/,r:/right/,b:/bottom/,l:/left/,h:/left|right/,v:/top|bottom/}[e].test(t)}function Ig(e,t,n){var i=Rt(t,e,KC),r=n.split(":")[0],o=Ns((t.x-e.x)/2+e.x),a=Ns((t.y-e.y)/2+e.y),s,c,u=QC(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=ZC(i,r),c=l?"h:v":"v:h",p?l?(f=a===e.y,s={x:e.x+Bs*(/l/.test(r)?-1:1),y:f?a+Bs:a}):(f=o===e.x,s={x:f?o+Bs:o,y:e.y+Bs*(/t/.test(r)?-1:1)}):s={x:o,y:a}),{waypoints:Ul(e,s,c).concat(s),directions:c,turnNextDirections:f}}function JC(e,t,n){return Ig(e,t,n)}function eP(e,t,n){var i=Ig(t,e,Lg(n));return{waypoints:i.waypoints.slice().reverse(),directions:Lg(i.directions),turnNextDirections:i.turnNextDirections}}function tP(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=Ul(e.waypoints[e.waypoints.length-1],t.waypoints[0],r);return{waypoints:o,directions:r}}function Lg(e){return e.split(":").reverse().join(":")}function nP(e,t,n){var i=Ns((t.x-e.x)/2+e.x),r=Ns((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 Ul(e,t,n){if(n=n||"h:h",!pP(n))throw new Error("unknown directions: <"+n+">: must be specified as <start>:<end> with start/end in { h,v,t,r,b,l }");if(Ng(n)){var i=JC(e,t,n),r=eP(e,t,n),o=tP(i,r);return[].concat(i.waypoints,o.waypoints,r.waypoints)}return nP(e,t,n)}function iP(e,t,n){var i=Ul(e,t,n);return i.unshift(e),i.push(t),jg(i)}function rP(e,t,n,i,r){var o=r&&r.preferredLayouts||[],a=gb(o,"straight")[0]||"h:h",s=XC[a]||0,c=Rt(e,t,s),u=lP(c,a);n=n||fe(e),i=i||fe(t);var l=u.split(":"),p=$g(n,e,l[0],fP(c)),f=$g(i,t,l[1],c);return iP(p,f,u)}function oP(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&&uP(t,e,i,r),c)||(c=o.connectionStart&&cP(e,t,n,r),c)?c:!o.connectionStart&&!o.connectionEnd&&r&&r.length?r:rP(e,t,n,i,o)}function aP(e,t,n){return e>=t&&e<=n}function Bg(e,t,n){var i={x:"width",y:"height"};return aP(t[e],n[e],n[e]+n[i[e]])}function sP(e,t,n,i,r){var o={},a,s;return s=Rt(e,t),/^(top|bottom|left|right)$/.test(s)?(/top|bottom/.test(s)&&(a="x"),/left|right/.test(s)&&(a="y"),r.preserveDocking==="target"?Bg(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:Bg(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 cP(e,t,n,i){return ql(e,t,n,i)}function uP(e,t,n,i){var r=i.slice().reverse();return r=ql(e,t,n,r),r?r.reverse():null}function ql(e,t,n,i){function r(l){return l.length<3?!0:l.length>4?!1:!!ze(l,function(p,f){var d=l[f-1];return d&&mo(p,d)<3})}function o(l,p,f){var d=Kn(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(cd(l[d],p,Og)||cd(l[d],f,Og))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=ql(e,t,n,u)),c&&Kn(c)?null:c}function lP(e,t){if(Ng(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 pP(e){return e&&/^h|v|t|r|b|l:h|v|t|r|b|l$/.test(e)}function Ng(e){return e&&/t|r|b|l/.test(e)}function fP(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 $g(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 jg(e){return e.reduce(function(t,n,i){var r=t[t.length-1],o=e[i+1];return lu(r,o,n,0)||t.push(n),t},[])}var dP=-10,hP=40,mP={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},gP={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},Yl={top:"bottom","top-right":"bottom-left","top-left":"bottom-right",right:"left",bottom:"top","bottom-right":"top-left","bottom-left":"top-right",left:"right"},Uo={top:"t",right:"r",bottom:"b",left:"l"};function $s(e){this._elementRegistry=e}X($s,Dg),$s.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=Fg(r&&r[0],n)),a||(a=Fg(r&&r[r.length-1],i)),(y(e,"bpmn:Association")||y(e,"bpmn:DataAssociation"))&&r&&!Hg(n,i))return[].concat([o],r.slice(1,-1),[a]);var l=Qd(n,s)?mP:gP;return y(e,"bpmn:MessageFlow")?c=yP(n,i,l):(y(e,"bpmn:SequenceFlow")||Hg(n,i))&&(n===i?c={preferredLayouts:SP(n,e,l)}:y(n,"bpmn:BoundaryEvent")?c={preferredLayouts:RP(n,i,a,l)}:qo(n)||qo(i)?c={preferredLayouts:l.subProcess,preserveDocking:bP(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=jg(oP(n,i,o,a,r,c))),u||[o,a]};function vP(e){var t=e.host;return Rt(fe(e),t,dP)}function yP(e,t,n){return{preferredLayouts:n.messageFlow,preserveDocking:_P(e,t)}}function _P(e,t){return y(t,"bpmn:Participant")?"source":y(e,"bpmn:Participant")?"target":qo(t)?"source":qo(e)||y(t,"bpmn:Event")?"target":y(e,"bpmn:Event")?"source":null}function bP(e){return qo(e)?"target":"source"}function Fg(e,t){return e?e.original||e:fe(t)}function Hg(e,t){return y(t,"bpmn:Activity")&&y(e,"bpmn:BoundaryEvent")&&t.businessObject.isForCompensation}function qo(e){return y(e,"bpmn:SubProcess")&&Pe(e)}function pr(e,t){return e===t}function xP(e,t){return t.indexOf(e)!==-1}function Wr(e){var t=/right|left/.exec(e);return t&&t[0]}function Ur(e){var t=/top|bottom/.exec(e);return t&&t[0]}function zg(e,t){return Yl[e]===t}function EP(e,t){var n=Wr(e),i=Yl[n];return t.indexOf(i)!==-1}function wP(e,t){var n=Ur(e),i=Yl[n];return t.indexOf(i)!==-1}function Vg(e){return e==="right"||e==="left"}function SP(e,t,n){var i=t.waypoints,r=i&&i.length&&Rt(i[0],e);return r==="top"?n.loop.fromTop:r==="right"?n.loop.fromRight:r==="left"?n.loop.fromLeft:n.loop.fromBottom}function RP(e,t,n,i){var r=fe(e),o=fe(t),a=vP(e),s,c,u=pr(e.host,t),l=xP(a,["top","right","bottom","left"]),p=Rt(o,r,{x:e.width/2+t.width/2,y:e.height/2+t.height/2});return u?CP(a,l,e,t,n,i):(s=PP(a,p,l,i.isHorizontal),c=AP(a,p,l,i.isHorizontal),[s+":"+c])}function CP(e,t,n,i,r,o){var a=t?e:o.isHorizontal?Ur(e):Wr(e),s=Uo[a],c;return t?Vg(e)?c=Gg("y",n,i,r)?"h":o.boundaryLoop.alternateHorizontalSide:c=Gg("x",n,i,r)?"v":o.boundaryLoop.alternateVerticalSide:c=o.boundaryLoop.default,[s+":"+c]}function Gg(e,t,n,i){var r=hP;return!(Kl(e,i,n,r)||Kl(e,i,{x:n.x+n.width,y:n.y+n.height},r)||Kl(e,i,fe(t),r))}function Kl(e,t,n,i){return Math.abs(t[e]-n[e])<i}function PP(e,t,n,i){if(n)return Uo[e];var r=Ur(e),o=Wr(e),a=Ur(t),s=Wr(t);if(i){if(pr(r,a)||zg(o,s))return Uo[r]}else if(pr(o,s)||zg(r,a))return Uo[o];return Uo[i?o:r]}function AP(e,t,n,i){if(n)return Vg(e)?EP(e,t)||pr(e,t)?"h":"v":wP(e,t)||pr(e,t)?"v":"h";var r=Ur(e),o=Wr(e),a=Ur(t),s=Wr(t);return a&&!s?"v":s&&!a?"h":i?pr(r,a)?"h":"v":pr(o,s)?"v":"h"}$s.$inject=["elementRegistry"];function Wg(e){return k({original:e.point.original||e.point},e.actual)}function Bi(e,t){this._elementRegistry=e,this._graphicsFactory=t}Bi.$inject=["elementRegistry","graphicsFactory"],Bi.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(Wg(i)),o.push(Wg(r)),o},Bi.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}},Bi.prototype._getIntersection=function(e,t,n){var i=this._getShapePath(e),r=this._getConnectionPath(t);return go(i,r,n)},Bi.prototype._getConnectionPath=function(e){return this._graphicsFactory.getConnectionPath(e)},Bi.prototype._getShapePath=function(e){return this._graphicsFactory.getShapePath(e)},Bi.prototype._getGfx=function(e){return this._elementRegistry.getGraphics(e)};const Xl={__init__:["modeling","bpmnUpdater"],__depends__:[qS,uR,pR,fR,ig,dC,mC,xC,gn,Ol,ug],bpmnFactory:["type",yn],bpmnUpdater:["type",tn],elementFactory:["type",Oi],modeling:["type",At],layouter:["type",$s],connectionDocking:["type",Bi]};var TP=10,Ug=50,MP=250;function Zl(e,t,n,i){for(var r;r=kP(e,n,t);)n=i(t,n,r);return n}function Ql(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 kP(e,t,n){var i={x:t.x-n.width/2,y:t.y-n.height/2,width:n.width,height:n.height},r=OP(e);return ze(r,function(o){if(o===n)return!1;var a=Rt(o,i,TP);return a==="intersect"})}function DP(e,t){t||(t={});function n(h){return h.source===e?1:-1}var i=t.defaultDistance||Ug,r=t.direction||"e",o=t.filter,a=t.getWeight||n,s=t.maxDistance||MP,c=t.reference||"start";o||(o=BP);function u(h,m){return r==="n"?c==="start"?ue(h).top-ue(m).bottom:c==="center"?ue(h).top-fe(m).y:ue(h).top-ue(m).top:r==="w"?c==="start"?ue(h).left-ue(m).right:c==="center"?ue(h).left-fe(m).x:ue(h).left-ue(m).left:r==="s"?c==="start"?ue(m).top-ue(h).bottom:c==="center"?fe(m).y-ue(h).bottom:ue(m).bottom-ue(h).bottom:c==="start"?ue(m).left-ue(h).right:c==="center"?fe(m).x-ue(h).right:ue(m).right-ue(h).right}var l=e.incoming.filter(o).map(function(h){var m=a(h),g=m<0?u(h.source,e):u(e,h.source);return{id:h.source.id,distance:g,weight:m}}),p=e.outgoing.filter(o).map(function(h){var m=a(h),g=m>0?u(e,h.target):u(h.target,e);return{id:h.target.id,distance:g,weight:m}}),f=l.concat(p).reduce(function(h,m){return h[m.id+"__weight_"+m.weight]=m,h},{}),d=Kt(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 OP(e){var t=Jl(e);return e.host&&(t=t.concat(Jl(e.host))),e.attachers&&(t=t.concat(e.attachers.reduce(function(n,i){return n.concat(Jl(i))},[]))),t}function Jl(e){return LP(e).concat(IP(e))}function IP(e){return e.incoming.map(function(t){return t.source})}function LP(e){return e.outgoing.map(function(t){return t.target})}function BP(){return!0}var NP=100;function qg(e,t,n){e.on("autoPlace",NP,function(i){var r=i.shape,o=i.source;return $P(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}}qg.$inject=["eventBus","modeling","canvas"];function $P(e,t,n){n||(n={});var i=n.defaultDistance||Ug,r=fe(e),o=ue(e);return{x:o.right+i+t.width/2,y:r.y}}function Yg(e,t){e.on("autoPlace.end",500,function(n){t.select(n.shape)})}Yg.$inject=["eventBus","selection"];const jP={__init__:["autoPlaceSelectionBehavior"],autoPlace:["type",qg],autoPlaceSelectionBehavior:["type",Yg]};function Kg(e,t,n){var i=Qd(e,n);if(y(t,"bpmn:TextAnnotation"))return HP(e,t,i);if(Se(t,["bpmn:DataObjectReference","bpmn:DataStoreReference"]))return zP(e,t,i);if(y(t,"bpmn:FlowNode"))return FP(e,t,i)}function FP(e,t,n){var i=ue(e),r=fe(e),o=n?{directionHint:"e",minDistance:80,baseOrientation:"left",boundaryOrientation:"top",start:"top",end:"bottom"}:{directionHint:"s",minDistance:90,baseOrientation:"top",boundaryOrientation:"left",start:"left",end:"right"},a=DP(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=Rt(e,e.host,-25),u.indexOf(o.boundaryOrientation)!==-1&&(s*=-1));var l=n?{x:i.right+a+t.width/2,y:r.y+Xg(u,c,o)}:{x:r.x+Xg(u,c,o),y:i.bottom+a+t.height/2},p={margin:s,minDistance:c},f=n?{y:p}:{x:p};return Zl(e,t,l,Ql(f))}function Xg(e,t,n){return e.includes(n.start)?-1*t:e.includes(n.end)?t:0}function HP(e,t,n){var i=ue(e),r=n?{x:i.right+t.width/2,y:i.top-50-t.height/2}:{x:i.right+50+t.width/2,y:i.bottom+t.height/2};je(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 Zl(e,t,r,Ql(a))}function zP(e,t,n){var i=ue(e),r=n?{x:i.right-10+t.width/2,y:i.bottom+40+t.width/2}:{x:i.left-40-t.width/2,y:i.bottom-10+t.height/2},o={margin:30,minDistance:30},a=n?{x:o}:{y:o};return Zl(e,t,r,Ql(a))}function Zg(e,t){e.on("autoPlace",function(n){var i=n.shape,r=n.source;return Kg(r,i,t)})}Zg.$inject=["eventBus","elementRegistry"];const js={__depends__:[jP],__init__:["bpmnAutoPlace"],bpmnAutoPlace:["type",Zg]},qr={cjkEm:.865,upperEm:.68,lowerEm:.5,digitEm:.556,spaceEm:.278,otherEm:.35,ascentEm:.9,descentEm:.25},VP=/[ᄀ-ᇿ -〿぀-ヿ㐀-鿿가-힯＀-⦆]/;function GP(e){const t=qr;return VP.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 ep(e,t){let n=0;for(const i of e)n+=t*GP(i);return n}function Qg(e=globalThis,{textMeasurement:t="approximate"}={}){if(!(e!=null&&e.SVGElement))throw new Error("installHeadlessBpmnDom: DOM 전역이 없다 — jsdom window 를 전역에 올린 뒤 호출할 것");t==="approximate"&&WP(e),UP(e),qP(e),YP(e)}function WP(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:ep(r,o),fontBoundingBoxAscent:o*qr.ascentEm,fontBoundingBoxDescent:o*qr.descentEm,actualBoundingBoxAscent:o*qr.ascentEm,actualBoundingBoxDescent:o*qr.descentEm}}};t.getContext=()=>n}function UP(e){if(e.SVGMatrix)return;class t{constructor(){vr(this,"a",1);vr(this,"b",0);vr(this,"c",0);vr(this,"d",1);vr(this,"e",0);vr(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 qP(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 YP(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:ep(n,12),height:14}})}const Jg=[Xd,Eo,Xl,js];function KP(e={}){Qg(globalThis,e.dom);const t=document.createElement("div");return document.body.appendChild(t),new Tr({container:t,moddleExtensions:e.moddleExtensions??ya,additionalModules:[...Jg,...e.additionalModules??[]]})}var XP=new Vr("ov"),ZP=500;function wt(e,t,n,i){this._eventBus=t,this._canvas=n,this._elementRegistry=i,this._ids=XP,this._overlayDefaults=k({show:null,scale:!0},e&&e.defaults),this._overlays={},this._overlayContainers=[],this._overlayRoot=QP(n.getContainer()),this._init()}wt.$inject=["config.overlays","eventBus","canvas","elementRegistry"],wt.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?Re(t.overlays,xr({type:e.type})):t.overlays.slice():[]}else return e.type?Re(this._overlays,xr({type:e.type})):e.id?this._overlays[e.id]:null},wt.prototype.add=function(e,t,n){if(bt(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},wt.prototype.remove=function(e){var t=this.get(e)||[];pe(t)||(t=[t]);var n=this;P(t,function(i){var r=n._getOverlayContainer(i.element,!0);if(i&&(On(i.html),On(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)}})},wt.prototype.isShown=function(){return this._overlayRoot.style.display!=="none"},wt.prototype.show=function(){Fs(this._overlayRoot)},wt.prototype.hide=function(){Fs(this._overlayRoot,!1)},wt.prototype.clear=function(){this._overlays={},this._overlayContainers=[],wa(this._overlayRoot)},wt.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}ev(n,i,r),Lt(e.html,"data-container-id",t.id)},wt.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}ev(n,r||0,o||0),this._updateOverlayVisibilty(e,this._canvas.viewbox())},wt.prototype._createOverlayContainer=function(e){var t=We('<div class="djs-overlays" />');zt(t,{position:"absolute"}),this._overlayRoot.appendChild(t);var n={html:t,element:e,overlays:[]};return this._updateOverlayContainer(n),this._overlayContainers.push(n),n},wt.prototype._updateRoot=function(e){var t=e.scale||1,n="matrix("+[t,0,0,t,-1*e.x*t,-1*e.y*t].join(",")+")";tv(this._overlayRoot,n)},wt.prototype._getOverlayContainer=function(e,t){var n=ze(this._overlayContainers,function(i){return i.element===e});return!n&&!t?this._createOverlayContainer(e):n},wt.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=We(i)),o=this._getOverlayContainer(n),r=We('<div class="djs-overlay" data-overlay-id="'+t+'">'),zt(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();Fs(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())},wt.prototype._updateOverlayVisibilty=function(e,t){var n=e.show,i=this._canvas.findRoot(e.element),r=n&&n.minZoom,o=n&&n.maxZoom,a=e.htmlContainer,s=this._canvas.getRootElement(),c=!0;(i!==s||n&&(ht(r)&&r>t.scale||ht(o)&&o<t.scale))&&(c=!1),Fs(a,c),this._updateOverlayScale(e,t)},wt.prototype._updateOverlayScale=function(e,t){var n=e.scale,i,r,o=e.htmlContainer,a,s="";n!==!0&&(n===!1?(i=1,r=1):(i=n.min,r=n.max),ht(i)&&t.scale<i&&(a=(1/t.scale||1)*i),ht(r)&&t.scale>r&&(a=(1/t.scale||1)*r)),ht(a)&&(s="scale("+a+","+a+")"),tv(o,s)},wt.prototype._updateOverlaysVisibilty=function(e){var t=this;P(this._overlays,function(n){t._updateOverlayVisibilty(n,e)})},wt.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});P(o,function(c){t.remove(c.id)});var a=t._getOverlayContainer(r);if(a){On(a.html);var s=t._overlayContainers.indexOf(a);s!==-1&&t._overlayContainers.splice(s,1)}}),e.on("element.changed",ZP,function(i){var r=i.element,o=t._getOverlayContainer(r,!0);o&&(P(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 QP(e){var t=We('<div class="djs-overlay-container" />');return zt(t,{position:"absolute",width:0,height:0}),e.insertBefore(t,e.firstChild),t}function ev(e,t,n){zt(e,{left:t+"px",top:n+"px"})}function Fs(e,t){e.style.display=t===!1?"none":""}function tv(e,t){e.style["transform-origin"]="top left",["","-ms-","-webkit-"].forEach(function(n){e.style[n+"transform"]=t})}const Hs={__init__:["overlays"],overlays:["type",wt]};function tp(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)})}X(tp,W),tp.$inject=["canvas","injector"];const JP={__init__:["rootElementsBehavior"],rootElementsBehavior:["type",tp]};function Yo(e){return CSS.escape(e)}var eA={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"};function nv(e){return e=""+e,e&&e.replace(/[&<>"']/g,function(t){return eA[t]})}var tA="bjs-breadcrumbs-shown";function iv(e,t,n){var i=We('<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=ze(a,function(f){return f===l});p&&s()});function s(c){c&&(a=nA(c));var u=a.flatMap(function(p){var f=n.findRoot($n(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=nv(p.name||p.id),m=We('<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(tA,l),u.forEach(function(p){i.appendChild(p)})}e.on("root.set",function(c){s(c.element)})}iv.$inject=["eventBus","elementRegistry","canvas"];function nA(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 rv(e,t){var n=null,i=new iA;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})}rv.$inject=["eventBus","canvas"];function iA(){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 ov={x:180,y:160};function fr(e,t){this._eventBus=e,this._moddle=t;var n=this;e.on("import.render.start",1500,function(i,r){n._handleImport(r.definitions)})}fr.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)})}},fr.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),oA(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},fr.prototype._movePlaneElementsToOrigin=function(e){var t=e.get("planeElement"),n=rA(e),i={x:n.x-ov.x,y:n.y-ov.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)})},fr.prototype._moveToDiPlane=function(e,t){var n=av(e),i=n.plane.get("planeElement");i.splice(i.indexOf(e),1),t.get("planeElement").push(e)},fr.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},fr.$inject=["eventBus","moddle"];function av(e){return y(e,"bpmndi:BPMNDiagram")?e:av(e.$parent)}function rA(e){var t={top:1/0,right:-1/0,bottom:-1/0,left:1/0};return e.planeElement.forEach(function(n){if(n.bounds){var i=ue(n.bounds);t.top=Math.min(i.top,t.top),t.left=Math.min(i.left,t.left)}}),Da(t)}function oA(e,t){var n=e.$parent;return!(!y(n,"bpmn:SubProcess")||n===t.bpmnElement||Se(e,["bpmn:DataInputAssociation","bpmn:DataOutputAssociation"]))}var zs=250,aA='<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 Ni(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)})})}X(Ni,W),Ni.prototype._updateDrilldownOverlay=function(e){var t=this._canvas;if(e){var n=t.findRoot(e);n&&this._updateOverlayVisibility(n)}},Ni.prototype._canDrillDown=function(e){var t=this._canvas;return y(e,"bpmn:SubProcess")&&t.findRoot($n(e))},Ni.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)}},Ni.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=We('<button type="button" class="bjs-drilldown">'+aA+"</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($n(e)))}),n.add(e,"drilldown",{position:{bottom:-7,right:-8},html:o}),this._updateOverlayVisibility(e)},Ni.prototype._removeOverlay=function(e){var t=this._overlays;t.remove({element:e,type:"drilldown"})},Ni.$inject=["canvas","eventBus","elementRegistry","overlays","translate"];const cA={__depends__:[Hs,Ol,JP],__init__:["drilldownBreadcrumbs","drilldownOverlayBehavior","drilldownCentering","subprocessCompatibility"],drilldownBreadcrumbs:["type",iv],drilldownCentering:["type",rv],drilldownOverlayBehavior:["type",Ni],subprocessCompatibility:["type",fr]};function $i(e){Ke.call(this,e)}X($i,Ke),$i.prototype._modules=[Xd,cA,Hs,gn,Eo],$i.prototype._moddleExtensions={};var Vs="keyboard.keydown",uA="keyboard.keyup",lA=1e3,sv="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 Vt(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(sv));var i=e&&e.bind!==!1;t.on("canvas.init",function(r){n._target=r.svg,i&&n.bind(),n._fire("init")})}Vt.$inject=["config.keyboard","eventBus"],Vt.prototype._keydownHandler=function(e){this._keyHandler(e,Vs)},Vt.prototype._keyupHandler=function(e){this._keyHandler(e,uA)},Vt.prototype._keyHandler=function(e,t){var n;if(!this._isEventIgnored(e)){var i={keyEvent:e};n=this._eventBus.fire(t||Vs,i),n&&e.preventDefault()}},Vt.prototype._isEventIgnored=function(e){return!1},Vt.prototype.bind=function(e){e&&console.error("unsupported argument <node>",new Error(sv)),this.unbind(),e=this._node=this._target,ve.bind(e,"keydown",this._keydownHandler),ve.bind(e,"keyup",this._keyupHandler),this._fire("bind")},Vt.prototype.getBinding=function(){return this._node},Vt.prototype.unbind=function(){var e=this._node;e&&(this._fire("unbind"),ve.unbind(e,"keydown",this._keydownHandler),ve.unbind(e,"keyup",this._keyupHandler)),this._node=null},Vt.prototype._fire=function(e){this._eventBus.fire("keyboard."+e,{node:this._node})},Vt.prototype.addListener=function(e,t,n){xt(e)&&(n=t,t=e,e=lA),this._eventBus.on(n||Vs,e,t)},Vt.prototype.removeListener=function(e,t){this._eventBus.off(t||Vs,e)},Vt.prototype.hasModifier=RR,Vt.prototype.isCmd=Jt,Vt.prototype.isShift=El,Vt.prototype.isKey=vt;var pA=500;function Yr(e,t){var n=this;e.on("editorActions.init",pA,function(i){var r=i.editorActions;n.registerBindings(t,r)})}Yr.$inject=["eventBus","keyboard"],Yr.prototype.registerBindings=function(e,t){function n(i,r){t.isRegistered(i)&&e.addListener(r)}n("undo",function(i){var r=i.keyEvent;if(MR(r))return t.trigger("undo"),!0}),n("redo",function(i){var r=i.keyEvent;if(kR(r))return t.trigger("redo"),!0}),n("copy",function(i){var r=i.keyEvent;if(CR(r))return t.trigger("copy"),!0}),n("paste",function(i){var r=i.keyEvent;if(PR(r))return t.trigger("paste"),!0}),n("duplicate",function(i){var r=i.keyEvent;if(AR(r))return t.trigger("duplicate"),!0}),n("cut",function(i){var r=i.keyEvent;if(TR(r))return t.trigger("cut"),!0}),n("stepZoom",function(i){var r=i.keyEvent;if(vt(["+","Add","="],r)&&Jt(r))return t.trigger("stepZoom",{value:1}),!0}),n("stepZoom",function(i){var r=i.keyEvent;if(vt(["-","Subtract"],r)&&Jt(r))return t.trigger("stepZoom",{value:-1}),!0}),n("zoom",function(i){var r=i.keyEvent;if(vt("0",r)&&Jt(r))return t.trigger("zoom",{value:1}),!0}),n("removeSelection",function(i){var r=i.keyEvent;if(vt(["Backspace","Delete","Del"],r))return t.trigger("removeSelection"),!0})};const np={__init__:["keyboard","keyboardBindings"],keyboard:["type",Vt],keyboardBindings:["type",Yr]};var fA={moveSpeed:50,moveSpeedAccelerated:200};function cv(e,t,n){var i=this;this._config=k({},fA,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})}}cv.$inject=["config.keyboardMove","keyboard","canvas"];const uv={__depends__:[np],__init__:["keyboardMove"],keyboardMove:["type",cv]};var dA=15;function lv(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=ar(s),p=Rn(l,c);if(!n.dragging&&hA(p)>dA&&(n.dragging=!0,u===0&&Bm(e),gs("grab")),n.dragging){var f=n.last||n.start;p=Rn(l,f),t.scroll({dx:p.x,dy:p.y}),n.last=l}s.preventDefault()}function o(s){ve.unbind(document,"mousemove",r),ve.unbind(document,"mouseup",o),n=null,Lm()}function a(s){if(!er(s.target,".djs-draggable")){var c=s.button;if(!(c>=2||s.ctrlKey||s.shiftKey||s.altKey))return n={button:c,start:ar(s)},ve.bind(document,"mousemove",r),ve.bind(document,"mouseup",o),!0}}this.isActive=function(){return!!n}}lv.$inject=["eventBus","canvas"];function hA(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}const pv={__init__:["moveCanvas"],moveCanvas:["type",lv]};function fv(e,t){var n=_u(e.min),i=_u(e.max),r=Math.abs(n)+Math.abs(i);return r/t}function mA(e,t){return Math.max(e.min,Math.min(e.max,t))}var gA=Math.sign||function(e){return e>=0?1:-1},ip={min:.2,max:4},dv=10,vA=.1,yA=.75;function Hn(e,t,n){e=e||{},this._enabled=!1,this._canvas=n,this._container=n._container,this._handleWheel=Gt(this._handleWheel,this),this._totalDelta=0,this._scale=e.scale||yA;var i=this;t.on("canvas.mouseover",function(){i._init(e.enabled!==!1)}),t.on("canvas.mouseout",function(){i._init(!1)})}Hn.$inject=["config.zoomScroll","eventBus","canvas"],Hn.prototype.scroll=function(t){this._canvas.scroll(t)},Hn.prototype.reset=function(){this._canvas.zoom("fit-viewport")},Hn.prototype.zoom=function(t,n){var i=fv(ip,dv*2);this._totalDelta+=t,Math.abs(this._totalDelta)>vA&&(this._zoom(t,n,i),this._totalDelta=0)},Hn.prototype._handleWheel=function(t){if(this._enabled){var n=this._container;t.preventDefault();var i=t.ctrlKey||Vh()&&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))*gA(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)}},Hn.prototype.stepZoom=function(t,n){var i=fv(ip,dv);this._zoom(t,n,i)},Hn.prototype._zoom=function(e,t,n){var i=this._canvas,r=e>0?1:-1,o=_u(i.zoom()),a=Math.round(o/n)*n;a+=n*r;var s=Math.pow(10,a);i.zoom(mA(ip,s),t)},Hn.prototype.toggle=function(t){var n=this._container,i=this._handleWheel,r=this._enabled;return typeof t>"u"&&(t=!r),r!==t&&ve[t?"bind":"unbind"](n,"wheel",i,!1),this._enabled=t,t},Hn.prototype._init=function(e){this.toggle(e)};const hv={__init__:["zoomScroll"],zoomScroll:["type",Hn]};function Ko(e){$i.call(this,e)}X(Ko,$i),Ko.prototype._navigationModules=[uv,pv,hv],Ko.prototype._modules=[].concat($i.prototype._modules,Ko.prototype._navigationModules);function rp(e){return e&&e[e.length-1]}function mv(e){return e.y}function gv(e){return e.x}var _A={left:gv,center:gv,right:function(e){return e.x+e.width},top:mv,middle:mv,bottom:function(e){return e.y+e.height}};function Kr(e,t){this._modeling=e,this._rules=t}Kr.$inject=["modeling","rules"],Kr.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}},Kr.prototype._isType=function(e,t){return t.indexOf(e)!==-1},Kr.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=rp(t),o[e]=l[i]+l[r];else if(this._isType(e,["center","middle"])){if(P(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=Pn(a,function(f){return f.elements.length>1&&(s=!0),f.elements.length}),s)return o[e]=rp(c).center,o;u=t[0],t=Pn(t,function(f){return f[i]+f[r]}),l=rp(t),o[e]=p(u,l)}return o},Kr.prototype.trigger=function(e,t){var n=this._modeling,i,r=Re(e,function(c){return!(c.waypoints||c.host||c.labelTarget)});if(i=this._rules.allowed("elements.align",{elements:r}),pe(i)&&(r=i),!(r.length<2||!i)){var o=_A[t],a=Pn(r,o),s=this._alignmentPosition(t,a);n.alignElements(a,s)}};const bA={__init__:["alignElements"],alignElements:["type",Kr]},xA=new Vr;function Xr(e){this._scheduled={},e.on("diagram.destroy",()=>{Object.keys(this._scheduled).forEach(t=>{this.cancel(t)})})}Xr.$inject=["eventBus"],Xr.prototype.schedule=function(e,t=xA.next()){this.cancel(t);const n=this._schedule(e,t);return this._scheduled[t]=n,n.promise},Xr.prototype._schedule=function(e,t){const n=EA();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}},Xr.prototype.cancel=function(e){const t=this._scheduled[e];t&&(this._cancel(t),this._scheduled[e]=null)},Xr.prototype._cancel=function(e){clearTimeout(e.executionId)};function EA(){const e={};return e.promise=new Promise((t,n)=>{e.resolve=t,e.reject=n}),e}const wA={scheduler:["type",Xr]};var SA="djs-element-hidden",Gs=".entry",RA=1e3,vv=8,CA=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=We('<div class="djs-context-pad-parent"></div>');return this._canvas.getContainer().appendChild(e),e},ct.prototype.registerProvider=function(e,t){t||(t=e,e=RA),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 P(t,function(r){if(xt(r[n])){var o=r[n](e);xt(o)?i=o(i):P(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=Lt(a,"data-action"),o=t.originalEvent||t,e==="mouseover"){this._timeout=setTimeout(function(){i._mouseout=i.triggerEntry(r,"hover",o,n)},CA);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(xt(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;P(t,function(r,o){var a=r.group||"default",s=We(r.html||'<div class="entry" draggable="true"></div>'),c;Lt(s,"data-action",o),c=$e("[data-group="+Yo(a)+"]",n),c||(c=We('<div class="group"></div>'),Lt(c,"data-group",a),n.appendChild(c)),c.appendChild(s),r.className&&PA(s,r.className),r.title&&Lt(s,"title",r.title),r.imageUrl&&(i=We("<img>"),Lt(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=We('<div class="djs-context-pad"></div>');return Xt.bind(n,Gs,"click",function(i){t.trigger("click",i)}),Xt.bind(n,Gs,"dragstart",function(i){t.trigger("dragstart",i)}),Xt.bind(n,Gs,"mouseover",function(i){t.trigger("mouseover",i)}),Xt.bind(n,Gs,"mouseout",function(i){t.trigger("mouseout",i)}),ve.bind(n,"mousedown",function(i){i.stopPropagation()}),this._container.appendChild(n),this._eventBus.fire("contextPad.create",{target:e,pad:n}),n},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()&&TA(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&&qi(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)&&je(e)){var t=this._canvas.viewbox(),n=AA(e),i=n.x*t.scale-t.x*t.scale,r=n.y*t.scale-t.y*t.scale;return{left:i+vv*this._canvas.zoom(),top:r}}var o=this._canvas.getContainer(),a=o.getBoundingClientRect(),s=this._getTargetBounds(e);return{left:s.right-a.left+vv*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,SA)});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 PA(e,t){var n=Ye(e);t=pe(t)?t:t.split(/\s+/g),t.forEach(function(i){n.add(i)})}function AA(e){return e.waypoints[e.waypoints.length-1]}function TA(e,t){return e=pe(e)?e:[e],t=pe(t)?t:[t],e.length===t.length&&qi(e,function(n){return t.includes(n)})}const yv={__depends__:[ms,wA,Hs],contextPad:["type",ct]};var Ws,Ze,_v,ji,bv,xv,Ev,op,Us,Xo,wv,ap,sp,cp,qs={},Ys=[],MA=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,Ks=Array.isArray;function oi(e,t){for(var n in t)e[n]=t[n];return e}function up(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function Sv(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?Ws.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 Xs(e,a,i,r,null)}function Xs(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??++_v,__i:-1,__u:0};return r==null&&Ze.vnode!=null&&Ze.vnode(o),o}function Zs(e){return e.children}function Qs(e,t){this.props=e,this.context=t}function dr(e,t){if(t==null)return e.__?dr(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"?dr(e):null}function kA(e){if(e.__P&&e.__d){var t=e.__v,n=t.__e,i=[],r=[],o=oi({},t);o.__v=t.__v+1,Ze.vnode&&Ze.vnode(o),lp(e.__P,o,t,e.__n,e.__P.namespaceURI,32&t.__u?[n]:null,i,n??dr(t),!!(32&t.__u),r),o.__v=t.__v,o.__.__k[o.__i]=o,Dv(i,o,r),t.__e=t.__=null,o.__e!=n&&Rv(o)}}function Rv(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}),Rv(e)}function Cv(e){(!e.__d&&(e.__d=!0)&&ji.push(e)&&!Js.__r++||bv!=Ze.debounceRendering)&&((bv=Ze.debounceRendering)||xv)(Js)}function Js(){try{for(var e,t=1;ji.length;)ji.length>t&&ji.sort(Ev),e=ji.shift(),t=ji.length,kA(e)}finally{ji.length=Js.__r=0}}function Pv(e,t,n,i,r,o,a,s,c,u,l){var p,f,d,h,m,g,w=i&&i.__k||Ys,E=t.length;for(c=DA(n,t,w,c,E),p=0;p<E;p++)(d=n.__k[p])!=null&&(f=d.__i!=-1&&w[d.__i]||qs,d.__i=p,g=lp(e,d,f,r,o,a,s,c,u,l),h=d.__e,d.ref&&f.ref!=d.ref&&(f.ref&&pp(f.ref,null,d),l.push(d.ref,d.__c||h,d)),m==null&&h!=null&&(m=h),4&d.__u?(c=Av(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 DA(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]=Xs(null,a,null,null,null):Ks(a)?a=e.__k[o]=Xs(Zs,{children:a},null,null,null):a.constructor===void 0&&a.__b>0?a=e.__k[o]=Xs(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=OA(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=dr(s)),Iv(s,s));return i}function Av(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=Av(i[r],t,n));return t}e.__e!=t&&(t&&e.type&&!t.parentNode&&(t=dr(e)),t=n.insertBefore(e.__e,t||null));do t=t&&t.nextSibling;while(t!=null&&t.nodeType==8);return t}function OA(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 Tv(e,t,n){t[0]=="-"?e.setProperty(t,n??""):e[t]=n==null?"":typeof n!="number"||MA.test(t)?n:n+"px"}function ec(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||Tv(e.style,t,"");if(n)for(t in n)i&&n[t]==i[t]||Tv(e.style,t,n[t])}else if(t[0]=="o"&&t[1]=="n")o=t!=(t=t.replace(wv,"$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[Xo]=i[Xo]:(n[Xo]=ap,e.addEventListener(t,o?cp:sp,o)):e.removeEventListener(t,o?cp:sp,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 Mv(e){return function(t){if(this.l){var n=this.l[t.type+e];if(t[Us]==null)t[Us]=ap++;else if(t[Us]<n[Xo])return;return n(Ze.event?Ze.event(t):t)}}}function lp(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 Qs(E,S),f.constructor=j,f.render=LA),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=oi({},f.__s)),oi(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)}),Ys.push.apply(f.__h,f._sb),f._sb=[],f.__h.length&&a.push(f),s=dr(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),Ys.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=oi(oi({},i),f.getChildContext())),b&&!d&&f.getSnapshotBeforeUpdate!=null&&(g=f.getSnapshotBeforeUpdate(h,m)),C=l!=null&&l.type===Zs&&l.key==null?Ov(l.props.children):l,s=Pv(e,Ks(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;$--;)up(o[$])}else t.__e=n.__e;t.__k==null&&(t.__k=n.__k||[]),L.then||kv(t),Ze.__e(L,t,n)}}else o==null&&t.__v==n.__v?(t.__k=n.__k,t.__e=n.__e):s=t.__e=IA(n.__e,t,n,i,r,o,a,c,u);return(l=Ze.diffed)&&l(t),128&t.__u?void 0:s}function kv(e){e&&(e.__c&&(e.__c.__e=!0),e.__k&&e.__k.some(kv))}function Dv(e,t,n){for(var i=0;i<n.length;i++)pp(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 Ov(e){return typeof e!="object"||e==null||e.__b>0?e:Ks(e)?e.map(Ov):e.constructor!==void 0?null:oi({},e)}function IA(e,t,n,i,r,o,a,s,c){var u,l,p,f,d,h,m,g=n.props||qs,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&&Ws.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||ec(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||ec(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=""),Pv(t.type=="template"?e.content:e,Ks(f)?f:[f],t,n,i,E=="foreignObject"?"http://www.w3.org/1999/xhtml":r,o,a,o?o[0]:n.__k&&dr(n,0),s,c),o!=null)for(u=o.length;u--;)up(o[u]);s&&E!="textarea"||(u="value",E=="progress"&&h==null?e.removeAttribute("value"):h!=null&&(h!==e[u]||E=="progress"&&!h||E=="option"&&h!=g[u])&&ec(e,u,h,g[u],r),u="checked",m!=null&&m!=e[u]&&ec(e,u,m,g[u],r))}return e}function pp(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 Iv(e,t,n){var i,r;if(Ze.unmount&&Ze.unmount(e),(i=e.ref)&&(i.current&&i.current!=e.__e||pp(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]&&Iv(i[r],t,n||typeof e.type!="function");n||up(e.__e),e.__c=e.__=e.__e=void 0}function LA(e,t,n){return this.constructor(e,n)}function Lv(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=[],lp(t,e=t.__k=Sv(Zs,null,[e]),r||qs,qs,t.namespaceURI,r?null:t.firstChild?Ws.call(t.childNodes):null,o,r?r.__e:t.firstChild,i,a),Dv(o,e,a),e.props.children=null}Ws=Ys.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}},_v=0,Qs.prototype.setState=function(e,t){var n;n=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=oi({},this.state),typeof e=="function"&&(e=e(oi({},n),this.props)),e&&oi(n,e),e!=null&&this.__v&&(t&&this._sb.push(t),Cv(this))},Qs.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),Cv(this))},Qs.prototype.render=Zs,ji=[],xv=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,Ev=function(e,t){return e.__v.__b-t.__v.__b},Js.__r=0,op=Math.random().toString(8),Us="__d"+op,Xo="__a"+op,wv=/(PointerCapture)$|Capture$/i,ap=0,sp=Mv(!1),cp=Mv(!0);var Bv=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,Bv(e,s,n,["",null])),i.push(r),s[0]?t[0]|=2:(t[o-2]=0,t[o]=r)):i.push(s)}return i},Nv=new Map;function BA(e){var t=Nv.get(this);return t||(t=new Map,Nv.set(this,t)),(t=Bv(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 He=BA.bind(Sv),Zr,ut,fp,$v,Zo=0,jv=[],yt=Ze,Fv=yt.__b,Hv=yt.__r,zv=yt.diffed,Vv=yt.__c,Gv=yt.unmount,Wv=yt.__;function tc(e,t){yt.__h&&yt.__h(ut,e,Zo||t),Zo=0;var n=ut.__H||(ut.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({}),n.__[e]}function dp(e){return Zo=1,NA(qv,e)}function NA(e,t,n){var i=tc(Zr++,2);if(i.t=e,!i.__c&&(i.__=[qv(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 nc(e,t){var n=tc(Zr++,3);!yt.__s&&gp(n.__H,t)&&(n.__=e,n.u=t,ut.__H.__h.push(n))}function hp(e,t){var n=tc(Zr++,4);!yt.__s&&gp(n.__H,t)&&(n.__=e,n.u=t,ut.__h.push(n))}function ic(e){return Zo=5,ai(function(){return{current:e}},[])}function ai(e,t){var n=tc(Zr++,7);return gp(n.__H,t)&&(n.__=e(),n.__H=t,n.__h=e),n.__}function Qo(e,t){return Zo=8,ai(function(){return e},t)}function $A(){for(var e;e=jv.shift();){var t=e.__H;if(e.__P&&t)try{t.__h.some(rc),t.__h.some(mp),t.__h=[]}catch(n){t.__h=[],yt.__e(n,e.__v)}}}yt.__b=function(e){ut=null,Fv&&Fv(e)},yt.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),Wv&&Wv(e,t)},yt.__r=function(e){Hv&&Hv(e),Zr=0;var t=(ut=e.__c).__H;t&&(fp===ut?(t.__h=[],ut.__h=[],t.__.some(function(n){n.__N&&(n.__=n.__N),n.u=n.__N=void 0})):(t.__h.some(rc),t.__h.some(mp),t.__h=[],Zr=0)),fp=ut},yt.diffed=function(e){zv&&zv(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(jv.push(t)!==1&&$v===yt.requestAnimationFrame||(($v=yt.requestAnimationFrame)||jA)($A)),t.__H.__.some(function(n){n.u&&(n.__H=n.u,n.u=void 0)})),fp=ut=null},yt.__c=function(e,t){t.some(function(n){try{n.__h.some(rc),n.__h=n.__h.filter(function(i){return!i.__||mp(i)})}catch(i){t.some(function(r){r.__h&&(r.__h=[])}),t=[],yt.__e(i,n.__v)}}),Vv&&Vv(e,t)},yt.unmount=function(e){Gv&&Gv(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.some(function(i){try{rc(i)}catch(r){t=r}}),n.__H=void 0,t&&yt.__e(t,n.__v))};var Uv=typeof requestAnimationFrame=="function";function jA(e){var t,n=function(){clearTimeout(i),Uv&&cancelAnimationFrame(t),setTimeout(e)},i=setTimeout(n,35);Uv&&(t=requestAnimationFrame(n))}function rc(e){var t=ut,n=e.__c;typeof n=="function"&&(e.__c=void 0,n()),ut=t}function mp(e){var t=ut;e.__c=e.__(),ut=t}function gp(e,t){return!e||e.length!==t.length||t.some(function(n,i){return n!==e[i]})}function qv(e,t){return typeof t=="function"?t(e):t}function FA(e){const{navigationStack:t,setNavigationStack:n}=e,i=ai(()=>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 He`
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}},Qe.prototype._setDefinitions=function(e){this._definitions=e},Qe.prototype.getModules=function(){return this._modules},Qe.prototype.clear=function(){this.getDefinitions()&&ji.prototype.clear.call(this)},Qe.prototype.destroy=function(){ji.prototype.destroy.call(this),Un(this._container)},Qe.prototype.on=function(e,t,n,i){return this.get("eventBus").on(e,t,n,i)},Qe.prototype.off=function(e,t){this.get("eventBus").off(e,t)},Qe.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=je(e)),e.appendChild(this._container),this._emit("attach",{}),this.get("canvas").resized()},Qe.prototype.getDefinitions=function(){return this._definitions},Qe.prototype.detach=function(){const e=this._container,t=e.parentNode;t&&(this._emit("detach",{}),t.removeChild(e))},Qe.prototype._init=function(e,t,n){const i=n.modules||this.getModules(n),r=n.additionalModules||[],o=[{bpmnjs:["value",this],moddle:["value",t]}],a=[].concat(o,i,r),s=D(zn(n,["additionalModules"]),{canvas:D({},n.canvas,{container:e}),modules:a});ji.call(this,s),n&&n.container&&this.attachTo(n.container)},Qe.prototype._emit=function(e,t){return this.get("eventBus").fire(e,t)},Qe.prototype._createContainer=function(e){const t=Ue('<div class="bjs-container"></div>');return Yt(t,{width:hh(e.width),height:hh(e.height),position:e.position}),t},Qe.prototype._createModdle=function(e){const t=D({},this._moddleExtensions,e.moddleExtensions);return new Bf(t)},Qe.prototype._modules=[];function ts(e,t){return e.warnings=t,e}function jw(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 Fw={width:"100%",height:"100%",position:"relative"};function hh(e){return e+(de(e)?"px":"")}function Hw(e,t){return t&&Ge(e.diagrams,function(n){return n.id===t})||null}function zw(e){const n='<a href="http://bpmn.io" target="_blank" class="bjs-powered-by" title="Powered by bpmn.io" >'+lh+"</a>",i=Ue(n);Yt(je("svg",i),ph),Yt(i,fh,{position:"absolute",bottom:"15px",right:"15px",zIndex:"100"}),e.appendChild(i),he.bind(i,"click",function(r){$w(),r.preventDefault()})}function Wr(e){Qe.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(Wr,Qe),Wr.prototype._createModdle=function(e){var t=Qe.prototype._createModdle.call(this,e);return t.ids=new Wn([32,36,1]),t},Wr.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 Se(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 At(e){if(!(!y(e,"bpmn:Participant")&&!y(e,"bpmn:Lane"))){var t=Me(e).isHorizontal;return t===void 0?!0:t}}function Vw(e){return e&&U(e).isInterrupting!==!1}function Gt(e){return e&&!!U(e).triggeredByEvent}function Ur(e,t){var n=U(e).eventDefinitions;return Ci(n,function(i){return y(i,t)})}function Gw(e){return Ur(e,"bpmn:ErrorEventDefinition")}function Ww(e){return Ur(e,"bpmn:EscalationEventDefinition")}function Uw(e){return Ur(e,"bpmn:CompensateEventDefinition")}var _r={width:90,height:20},mh=15;function Fi(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 ns(e){return _e(e.label)}function qw(e){var t=e.length/2-1,n=e[Math.floor(t)],i=e[Math.ceil(t+.01)],r=Yw(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-=mh:a+=mh,{x:a,y:s}}function Yw(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 Bu(e){return e.waypoints?qw(e.waypoints):y(e,"bpmn:Group")?{x:e.x+e.width/2,y:e.y+_r.height/2}:{x:e.x+e.width/2,y:e.y+e.height+_r.height/2}}function Kw(e,t){var n,i,r,o=e.label;return o&&o.bounds?(r=o.bounds,i={width:Math.max(_r.width,r.width),height:r.height},n={x:r.x+r.width/2,y:r.y+r.height/2}):(n=Bu(t),i=_r),D({x:n.x-i.width/2,y:n.y-i.height/2},i)}function gh(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 Xw(e){var t=e.categoryValueRef;return t&&t.value||""}function vn(e){var t=e.businessObject,n=gh(t);if(n)return n==="categoryValueRef"?Xw(t):t[n]||""}function Zw(e,t){var n=e.businessObject,i=gh(n);if(i)if(i==="categoryValueRef"){if(!n[i])return e;n[i].value=t}else n[i]=t;return e}function Qw(e){return _e(e)&&Fi(e.labelTarget)}var qr=7;function vh(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 Lo(e){const t=new Map;return T(Mu(e),n=>{T(vh(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 $u="hsl(225, 10%, 15%)",Jw="white";function Xn(e,t){return Ci(e.eventDefinitions,function(n){return n.$type===t})}function e1(e){return e.$type==="bpmn:IntermediateThrowEvent"||e.$type==="bpmn:EndEvent"}function t1(e){var t=e.dataObjectRef;return e.isCollection||t&&t.isCollection}function we(e,t,n){var i=Me(e);return n||i.get("color:background-color")||i.get("bioc:fill")||t||Jw}function Z(e,t,n){var i=Me(e);return n||i.get("color:border-color")||i.get("bioc:stroke")||t||$u}function No(e,t,n,i){var r=Me(e),o=r.get("label");return i||o&&o.get("color:color")||t||Z(e,n)}function yh(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 gr(r)}function ju(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 gr(a)}function n1(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 gr(s)}function i1(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 gr(o)}function Bo(e,t={}){return{width:En(e,t),height:an(e,t)}}function En(e,t={}){return tn(t,"width")?t.width:e.width}function an(e,t={}){return tn(t,"height")?t.height:e.height}var r1=new Wn,o1=10,is=3,a1=1.5,rs=10,s1=4,Yr=.95,c1=1,u1=.25;function br(e,t,n,i,r,o,a){ci.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:$u,strokeWidth:2,fill:"white"})}function p(R){return n.computeStyle(R,["no-fill"],{strokeLinecap:"round",strokeLinejoin:"round",stroke:$u,strokeWidth:2})}function f(R,_){var{ref:v={x:0,y:0},scale:k=1,element:O,parentGfx:z=r._svg}=_,ne=ae("marker",{id:R,viewBox:"0 0 20 20",refX:v.x,refY:v.y,markerWidth:20*k,markerHeight:20*k,orient:"auto"});ge(ne,O);var ye=je(":scope > defs",z);ye||(ye=ae("defs"),ge(z,ye)),ge(ye,ne)}function d(R,_,v,k){var O=r1.nextPrefixed("marker-");return h(R,O,_,v,k),"url(#"+O+")"}function h(R,_,v,k,O){if(v==="sequenceflow-end"){var z=ae("path",{d:"M 1 5 L 11 10 L 1 15 Z",...l({fill:O,stroke:O,strokeWidth:1})});f(_,{element:z,ref:{x:11,y:10},scale:.5,parentGfx:R})}if(v==="messageflow-start"){var ne=ae("circle",{cx:6,cy:6,r:3.5,...l({fill:k,stroke:O,strokeWidth:1,strokeDasharray:[1e4,1]})});f(_,{element:ne,ref:{x:6,y:6},parentGfx:R})}if(v==="messageflow-end"){var ye=ae("path",{d:"m 1 5 l 0 -3 l 7 3 l -7 3 z",...l({fill:k,stroke:O,strokeWidth:1,strokeDasharray:[1e4,1]})});f(_,{element:ye,ref:{x:8.5,y:5},parentGfx:R})}if(v==="association-start"){var Ie=ae("path",{d:"M 11 5 L 1 10 L 11 15",...p({fill:"none",stroke:O,strokeWidth:1.5,strokeDasharray:[1e4,1]})});f(_,{element:Ie,ref:{x:1,y:10},scale:.5,parentGfx:R})}if(v==="association-end"){var it=ae("path",{d:"M 1 5 L 11 10 L 1 15",...p({fill:"none",stroke:O,strokeWidth:1.5,strokeDasharray:[1e4,1]})});f(_,{element:it,ref:{x:11,y:10},scale:.5,parentGfx:R})}if(v==="conditional-flow-marker"){var Fe=ae("path",{d:"M 0 10 L 8 6 L 16 10 L 8 14 Z",...l({fill:k,stroke:O})});f(_,{element:Fe,ref:{x:-1,y:10},scale:.5,parentGfx:R})}if(v==="conditional-default-flow-marker"){var ot=ae("path",{d:"M 6 4 L 10 16",...l({stroke:O,fill:"none"})});f(_,{element:ot,ref:{x:0,y:10},scale:.5,parentGfx:R})}}function m(R,_,v,k,O={}){Rt(k)&&(O=k,k=0),k=k||0,O=l(O);var z=_/2,ne=v/2,ye=ae("circle",{cx:z,cy:ne,r:Math.round((_+v)/4-k),...O});return ge(R,ye),ye}function g(R,_,v,k,O,z){Rt(O)&&(z=O,O=0),O=O||0,z=l(z);var ne=ae("rect",{x:O,y:O,width:_-O*2,height:v-O*2,rx:k,ry:k,...z});return ge(R,ne),ne}function w(R,_,v,k){var O=_/2,z=v/2,ne=[{x:O,y:0},{x:_,y:z},{x:O,y:v},{x:0,y:z}],ye=ne.map(function(it){return it.x+","+it.y}).join(" ");k=l(k);var Ie=ae("polygon",{...k,points:ye});return ge(R,Ie),Ie}function E(R,_,v,k){v=p(v);var O=Ao(_,v,k);return ge(R,O),O}function b(R,_,v){return E(R,_,v,5)}function x(R,_,v){v=p(v);var k=ae("path",{...v,d:_});return ge(R,k),k}function S(R,_,v,k){return x(_,v,D({"data-marker":R},k))}function A(R){return wt[R]}function I(R){return function(_,v,k){return A(R)(_,v,k)}}var P={"bpmn:MessageEventDefinition":function(R,_,v={},k){var O=i.getScaledPath("EVENT_MESSAGE",{xScaleFactor:.9,yScaleFactor:.9,containerWidth:v.width||_.width,containerHeight:v.height||_.height,position:{mx:.235,my:.315}}),z=k?Z(_,c,v.stroke):we(_,s,v.fill),ne=k?we(_,s,v.fill):Z(_,c,v.stroke),ye=x(R,O,{fill:z,stroke:ne,strokeWidth:1});return ye},"bpmn:TimerEventDefinition":function(R,_,v={}){var k=v.width||_.width,O=v.height||_.height,z=v.width?1:2,ne=m(R,k,O,.2*O,{fill:we(_,s,v.fill),stroke:Z(_,c,v.stroke),strokeWidth:z}),ye=i.getScaledPath("EVENT_TIMER_WH",{xScaleFactor:.75,yScaleFactor:.75,containerWidth:k,containerHeight:O,position:{mx:.5,my:.5}});x(R,ye,{stroke:Z(_,c,v.stroke),strokeWidth:z});for(var Ie=0;Ie<12;Ie++){var it=i.getScaledPath("EVENT_TIMER_LINE",{xScaleFactor:.75,yScaleFactor:.75,containerWidth:k,containerHeight:O,position:{mx:.5,my:.5}}),Fe=k/2,ot=O/2;x(R,it,{strokeWidth:1,stroke:Z(_,c,v.stroke),transform:"rotate("+Ie*30+","+ot+","+Fe+")"})}return ne},"bpmn:EscalationEventDefinition":function(R,_,v={},k){var O=i.getScaledPath("EVENT_ESCALATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:v.width||_.width,containerHeight:v.height||_.height,position:{mx:.5,my:.2}}),z=k?Z(_,c,v.stroke):we(_,s,v.fill);return x(R,O,{fill:z,stroke:Z(_,c,v.stroke),strokeWidth:1})},"bpmn:ConditionalEventDefinition":function(R,_,v={}){var k=i.getScaledPath("EVENT_CONDITIONAL",{xScaleFactor:1,yScaleFactor:1,containerWidth:v.width||_.width,containerHeight:v.height||_.height,position:{mx:.5,my:.222}});return x(R,k,{fill:we(_,s,v.fill),stroke:Z(_,c,v.stroke),strokeWidth:1})},"bpmn:LinkEventDefinition":function(R,_,v={},k){var O=i.getScaledPath("EVENT_LINK",{xScaleFactor:1,yScaleFactor:1,containerWidth:_.width,containerHeight:_.height,position:{mx:.57,my:.263}}),z=k?Z(_,c,v.stroke):we(_,s,v.fill);return x(R,O,{fill:z,stroke:Z(_,c,v.stroke),strokeWidth:1})},"bpmn:ErrorEventDefinition":function(R,_,v={},k){var O=i.getScaledPath("EVENT_ERROR",{xScaleFactor:1.1,yScaleFactor:1.1,containerWidth:v.width||_.width,containerHeight:v.height||_.height,position:{mx:.2,my:.722}}),z=k?Z(_,c,v.stroke):we(_,s,v.fill);return x(R,O,{fill:z,stroke:Z(_,c,v.stroke),strokeWidth:1})},"bpmn:CancelEventDefinition":function(R,_,v={},k){var O=i.getScaledPath("EVENT_CANCEL_45",{xScaleFactor:1,yScaleFactor:1,containerWidth:_.width,containerHeight:_.height,position:{mx:.638,my:-.055}}),z=k?Z(_,c,v.stroke):"none",ne=x(R,O,{fill:z,stroke:Z(_,c,v.stroke),strokeWidth:1});return ch(ne,45),ne},"bpmn:CompensateEventDefinition":function(R,_,v={},k){var O=i.getScaledPath("EVENT_COMPENSATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:v.width||_.width,containerHeight:v.height||_.height,position:{mx:.22,my:.5}}),z=k?Z(_,c,v.stroke):we(_,s,v.fill);return x(R,O,{fill:z,stroke:Z(_,c,v.stroke),strokeWidth:1})},"bpmn:SignalEventDefinition":function(R,_,v={},k){var O=i.getScaledPath("EVENT_SIGNAL",{xScaleFactor:.9,yScaleFactor:.9,containerWidth:v.width||_.width,containerHeight:v.height||_.height,position:{mx:.5,my:.2}}),z=k?Z(_,c,v.stroke):we(_,s,v.fill);return x(R,O,{strokeWidth:1,fill:z,stroke:Z(_,c,v.stroke)})},"bpmn:MultipleEventDefinition":function(R,_,v={},k){var O=i.getScaledPath("EVENT_MULTIPLE",{xScaleFactor:1.1,yScaleFactor:1.1,containerWidth:v.width||_.width,containerHeight:v.height||_.height,position:{mx:.211,my:.36}}),z=k?Z(_,c,v.stroke):we(_,s,v.fill);return x(R,O,{fill:z,stroke:Z(_,c,v.stroke),strokeWidth:1})},"bpmn:ParallelMultipleEventDefinition":function(R,_,v={}){var k=i.getScaledPath("EVENT_PARALLEL_MULTIPLE",{xScaleFactor:1.2,yScaleFactor:1.2,containerWidth:v.width||_.width,containerHeight:v.height||_.height,position:{mx:.458,my:.194}});return x(R,k,{fill:we(_,s,v.fill),stroke:Z(_,c,v.stroke),strokeWidth:1})},"bpmn:TerminateEventDefinition":function(R,_,v={}){var k=m(R,_.width,_.height,8,{fill:Z(_,c,v.stroke),stroke:Z(_,c,v.stroke),strokeWidth:4});return k}};function $(R,_,v={},k){var O=U(R),z=e1(O),ne=k||R;return O.get("eventDefinitions")&&O.get("eventDefinitions").length>1?O.get("parallelMultiple")?P["bpmn:ParallelMultipleEventDefinition"](_,ne,v,z):P["bpmn:MultipleEventDefinition"](_,ne,v,z):Xn(O,"bpmn:MessageEventDefinition")?P["bpmn:MessageEventDefinition"](_,ne,v,z):Xn(O,"bpmn:TimerEventDefinition")?P["bpmn:TimerEventDefinition"](_,ne,v,z):Xn(O,"bpmn:ConditionalEventDefinition")?P["bpmn:ConditionalEventDefinition"](_,ne,v,z):Xn(O,"bpmn:SignalEventDefinition")?P["bpmn:SignalEventDefinition"](_,ne,v,z):Xn(O,"bpmn:EscalationEventDefinition")?P["bpmn:EscalationEventDefinition"](_,ne,v,z):Xn(O,"bpmn:LinkEventDefinition")?P["bpmn:LinkEventDefinition"](_,ne,v,z):Xn(O,"bpmn:ErrorEventDefinition")?P["bpmn:ErrorEventDefinition"](_,ne,v,z):Xn(O,"bpmn:CancelEventDefinition")?P["bpmn:CancelEventDefinition"](_,ne,v,z):Xn(O,"bpmn:CompensateEventDefinition")?P["bpmn:CompensateEventDefinition"](_,ne,v,z):Xn(O,"bpmn:TerminateEventDefinition")?P["bpmn:TerminateEventDefinition"](_,ne,v,z):null}var j={ParticipantMultiplicityMarker:function(R,_,v={}){var k=En(_,v),O=an(_,v),z=i.getScaledPath("MARKER_PARALLEL",{xScaleFactor:1,yScaleFactor:1,containerWidth:k,containerHeight:O,position:{mx:(k/2-6)/k,my:(O-15)/O}});S("participant-multiplicity",R,z,{strokeWidth:2,fill:we(_,s,v.fill),stroke:Z(_,c,v.stroke)})},SubProcessMarker:function(R,_,v={}){var k=g(R,14,14,0,{strokeWidth:1,fill:we(_,s,v.fill),stroke:Z(_,c,v.stroke)});Ot(k,_.width/2-7.5,_.height-20);var O=i.getScaledPath("MARKER_SUB_PROCESS",{xScaleFactor:1.5,yScaleFactor:1.5,containerWidth:_.width,containerHeight:_.height,position:{mx:(_.width/2-7.5)/_.width,my:(_.height-20)/_.height}});S("sub-process",R,O,{fill:we(_,s,v.fill),stroke:Z(_,c,v.stroke)})},ParallelMarker:function(R,_,v){var k=En(_,v),O=an(_,v),z=i.getScaledPath("MARKER_PARALLEL",{xScaleFactor:1,yScaleFactor:1,containerWidth:k,containerHeight:O,position:{mx:(k/2+v.parallel)/k,my:(O-20)/O}});S("parallel",R,z,{fill:we(_,s,v.fill),stroke:Z(_,c,v.stroke)})},SequentialMarker:function(R,_,v){var k=i.getScaledPath("MARKER_SEQUENTIAL",{xScaleFactor:1,yScaleFactor:1,containerWidth:_.width,containerHeight:_.height,position:{mx:(_.width/2+v.seq)/_.width,my:(_.height-19)/_.height}});S("sequential",R,k,{fill:we(_,s,v.fill),stroke:Z(_,c,v.stroke)})},CompensationMarker:function(R,_,v){var k=i.getScaledPath("MARKER_COMPENSATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:_.width,containerHeight:_.height,position:{mx:(_.width/2+v.compensation)/_.width,my:(_.height-13)/_.height}});S("compensation",R,k,{strokeWidth:1,fill:we(_,s,v.fill),stroke:Z(_,c,v.stroke)})},LoopMarker:function(R,_,v){var k=En(_,v),O=an(_,v),z=i.getScaledPath("MARKER_LOOP",{xScaleFactor:1,yScaleFactor:1,containerWidth:k,containerHeight:O,position:{mx:(k/2+v.loop)/k,my:(O-7)/O}});S("loop",R,z,{strokeWidth:1.5,fill:"none",stroke:Z(_,c,v.stroke),strokeMiterlimit:.5})},AdhocMarker:function(R,_,v){var k=En(_,v),O=an(_,v),z=i.getScaledPath("MARKER_ADHOC",{xScaleFactor:1,yScaleFactor:1,containerWidth:k,containerHeight:O,position:{mx:(k/2+v.adhoc)/k,my:(O-15)/O}});S("adhoc",R,z,{strokeWidth:1,fill:Z(_,c,v.stroke),stroke:Z(_,c,v.stroke)})}};function L(R,_,v,k){j[R](_,v,k)}function F(R,_,v=[],k={}){k={fill:k.fill,stroke:k.stroke,width:En(_,k),height:an(_,k)};var O=U(_),z=v.includes("SubProcessMarker");z?k={...k,seq:-21,parallel:-22,compensation:-25,loop:-18,adhoc:10}:k={...k,seq:-5,parallel:-6,compensation:-7,loop:0,adhoc:-8},O.get("isForCompensation")&&v.push("CompensationMarker"),y(O,"bpmn:AdHocSubProcess")&&(v.push("AdhocMarker"),z||D(k,{compensation:k.compensation-18}));var ne=O.get("loopCharacteristics"),ye=ne&&ne.get("isSequential");ne&&(D(k,{compensation:k.compensation-18}),v.includes("AdhocMarker")&&D(k,{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&&D(k,{compensation:-8}),T(v,function(Ie){L(Ie,R,_,k)})}function ie(R,_,v={}){v=D({size:{width:100}},v);var k=o.createText(_||"",v);return Ce(k).add("djs-label"),ge(R,k),k}function Pe(R,_,v,k={}){var O=U(_),z=Bo({x:_.x,y:_.y,width:_.width,height:_.height},k);return ie(R,O.name,{align:v,box:z,padding:7,style:{fill:No(_,u,c,k.stroke)}})}function nt(R,_,v={}){var k={width:_.width,height:_.height,x:_.width/2+_.x,y:_.height/2+_.y};return ie(R,vn(_),{box:k,style:D({},o.getExternalStyle(),{fill:No(_,u,c,v.stroke)})})}function q(R,_,v,k={}){var O=At(v),z=ie(R,_,{box:{height:30,width:O?an(v,k):En(v,k)},align:"center-middle",style:{fill:No(v,u,c,k.stroke)}});if(O){var ne=-1*an(v,k);Ja(z,0,-ne,270)}}function re(R,_,v={}){var{width:k,height:O}=Bo(_,v);return g(R,k,O,rs,{...v,fill:we(_,s,v.fill),fillOpacity:Yr,stroke:Z(_,c,v.stroke)})}function ce(R,_,v={}){var k=U(_),O=we(_,s,v.fill),z=Z(_,c,v.stroke);return(k.get("associationDirection")==="One"||k.get("associationDirection")==="Both")&&(v.markerEnd=d(R,"association-end",O,z)),k.get("associationDirection")==="Both"&&(v.markerStart=d(R,"association-start",O,z)),v=ke(v,["markerStart","markerEnd"]),b(R,_.waypoints,{...v,stroke:z,strokeDasharray:"0, 5"})}function oe(R,_,v={}){var k=we(_,s,v.fill),O=Z(_,c,v.stroke),z=i.getScaledPath("DATA_OBJECT_PATH",{xScaleFactor:1,yScaleFactor:1,containerWidth:_.width,containerHeight:_.height,position:{mx:.474,my:.296}}),ne=x(R,z,{fill:k,fillOpacity:Yr,stroke:O}),ye=U(_);if(t1(ye)){var Ie=i.getScaledPath("DATA_OBJECT_COLLECTION_PATH",{xScaleFactor:1,yScaleFactor:1,containerWidth:_.width,containerHeight:_.height,position:{mx:.33,my:(_.height-18)/_.height}});x(R,Ie,{strokeWidth:2,fill:k,stroke:O})}return ne}function se(R,_,v={}){return m(R,_.width,_.height,{fillOpacity:Yr,...v,fill:we(_,s,v.fill),stroke:Z(_,c,v.stroke)})}function K(R,_,v={}){return w(R,_.width,_.height,{fill:we(_,s,v.fill),fillOpacity:Yr,stroke:Z(_,c,v.stroke)})}function N(R,_,v={}){var k=g(R,En(_,v),an(_,v),0,{fill:we(_,s,v.fill),fillOpacity:v.fillOpacity||Yr,stroke:Z(_,c,v.stroke),strokeWidth:1.5}),O=U(_);if(y(O,"bpmn:Lane")){var z=O.get("name");q(R,z,_,v)}return k}function B(R,_,v={}){var k=re(R,_,v),O=Se(_);if(Gt(_)&&(J(k,{strokeDasharray:"0, 5.5",strokeWidth:2.5}),!O)){var z=U(_).flowElements||[],ne=z.filter(ye=>y(ye,"bpmn:StartEvent"));ne.length===1&&V(ne[0],R,v,_)}return Pe(R,_,O?"center-top":"center-middle",v),O?F(R,_,void 0,v):F(R,_,["SubProcessMarker"],v),k}function V(R,_,v,k){var O=22,z={fill:we(k,s,v.fill),stroke:Z(k,c,v.stroke),width:O,height:O},ne=U(R).isInterrupting,ye=ne?0:3,Ie=ne?1:1.2,it=20,Fe=(O-it)/2,ot="translate("+Fe+","+Fe+")";m(_,it,it,{fill:z.fill,stroke:z.stroke,strokeWidth:Ie,strokeDasharray:ye,transform:ot}),$(R,_,z,k)}function be(R,_,v={}){var k=re(R,_,v);return Pe(R,_,"center-middle",v),F(R,_,void 0,v),k}var wt=this.handlers={"bpmn:AdHocSubProcess":function(R,_,v={}){return Se(_)?v=ke(v,["fill","stroke","width","height"]):v=ke(v,["fill","stroke"]),B(R,_,v)},"bpmn:Association":function(R,_,v={}){return v=ke(v,["fill","stroke"]),ce(R,_,v)},"bpmn:BoundaryEvent":function(R,_,v={}){var{renderIcon:k=!0}=v;v=ke(v,["fill","stroke"]);var O=U(_),z=O.get("cancelActivity");v={strokeWidth:1.5,fill:we(_,s,v.fill),fillOpacity:c1,stroke:Z(_,c,v.stroke)},z||(v.strokeDasharray="6");var ne=se(R,_,v);return m(R,_.width,_.height,is,{...v,fill:"none"}),k&&$(_,R,v),ne},"bpmn:BusinessRuleTask":function(R,_,v={}){v=ke(v,["fill","stroke"]);var k=be(R,_,v),O=i.getScaledPath("TASK_TYPE_BUSINESS_RULE_MAIN",{abspos:{x:8,y:8}}),z=x(R,O);J(z,{fill:we(_,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}),k},"bpmn:CallActivity":function(R,_,v={}){return v=ke(v,["fill","stroke"]),B(R,_,{strokeWidth:5,...v})},"bpmn:ComplexGateway":function(R,_,v={}){v=ke(v,["fill","stroke"]);var k=K(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}),k},"bpmn:DataInput":function(R,_,v={}){v=ke(v,["fill","stroke"]);var k=i.getRawPath("DATA_ARROW"),O=oe(R,_,v);return x(R,k,{fill:"none",stroke:Z(_,c,v.stroke),strokeWidth:1}),O},"bpmn:DataInputAssociation":function(R,_,v={}){return v=ke(v,["fill","stroke"]),ce(R,_,{...v,markerEnd:d(R,"association-end",we(_,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 k=i.getRawPath("DATA_ARROW"),O=oe(R,_,v);return x(R,k,{strokeWidth:1,fill:Z(_,c,v.stroke),stroke:Z(_,c,v.stroke)}),O},"bpmn:DataOutputAssociation":function(R,_,v={}){return v=ke(v,["fill","stroke"]),ce(R,_,{...v,markerEnd:d(R,"association-end",we(_,s,v.fill),Z(_,c,v.stroke))})},"bpmn:DataStoreReference":function(R,_,v={}){v=ke(v,["fill","stroke"]);var k=i.getScaledPath("DATA_STORE",{xScaleFactor:1,yScaleFactor:1,containerWidth:_.width,containerHeight:_.height,position:{mx:0,my:.133}});return x(R,k,{fill:we(_,s,v.fill),fillOpacity:Yr,stroke:Z(_,c,v.stroke),strokeWidth:2})},"bpmn:EndEvent":function(R,_,v={}){var{renderIcon:k=!0}=v;v=ke(v,["fill","stroke"]);var O=se(R,_,{...v,strokeWidth:4});return k&&$(_,R,v),O},"bpmn:EventBasedGateway":function(R,_,v={}){v=ke(v,["fill","stroke"]);var k=U(_),O=K(R,_,v);m(R,_.width,_.height,_.height*.2,{fill:we(_,"none",v.fill),stroke:Z(_,c,v.stroke),strokeWidth:1});var z=k.get("eventGatewayType"),ne=!!k.get("instantiate");function ye(){var it=i.getScaledPath("GATEWAY_EVENT_BASED",{xScaleFactor:.18,yScaleFactor:.18,containerWidth:_.width,containerHeight:_.height,position:{mx:.36,my:.44}});x(R,it,{fill:"none",stroke:Z(_,c,v.stroke),strokeWidth:2})}if(z==="Parallel"){var Ie=i.getScaledPath("GATEWAY_PARALLEL",{xScaleFactor:.4,yScaleFactor:.4,containerWidth:_.width,containerHeight:_.height,position:{mx:.474,my:.296}});x(R,Ie,{fill:"none",stroke:Z(_,c,v.stroke),strokeWidth:1})}else z==="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 k=K(R,_,v),O=i.getScaledPath("GATEWAY_EXCLUSIVE",{xScaleFactor:.4,yScaleFactor:.4,containerWidth:_.width,containerHeight:_.height,position:{mx:.32,my:.3}}),z=Me(_);return z.get("isMarkerVisible")&&x(R,O,{fill:Z(_,c,v.stroke),stroke:Z(_,c,v.stroke),strokeWidth:1}),k},"bpmn:Gateway":function(R,_,v={}){return v=ke(v,["fill","stroke"]),K(R,_,v)},"bpmn:Group":function(R,_,v={}){return v=ke(v,["fill","stroke","width","height"]),g(R,_.width,_.height,rs,{stroke:Z(_,c,v.stroke),strokeWidth:1.5,strokeDasharray:"10, 6, 0, 6",fill:"none",pointerEvents:"none",width:En(_,v),height:an(_,v)})},"bpmn:InclusiveGateway":function(R,_,v={}){v=ke(v,["fill","stroke"]);var k=K(R,_,v);return m(R,_.width,_.height,_.height*.24,{fill:we(_,s,v.fill),stroke:Z(_,c,v.stroke),strokeWidth:2.5}),k},"bpmn:IntermediateEvent":function(R,_,v={}){var{renderIcon:k=!0}=v;v=ke(v,["fill","stroke"]);var O=se(R,_,{...v,strokeWidth:1.5});return m(R,_.width,_.height,is,{fill:"none",stroke:Z(_,c,v.stroke),strokeWidth:1.5}),k&&$(_,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"]),N(R,_,{...v,fillOpacity:u1})},"bpmn:ManualTask":function(R,_,v={}){v=ke(v,["fill","stroke"]);var k=be(R,_,v),O=i.getScaledPath("TASK_TYPE_MANUAL",{abspos:{x:17,y:15}});return x(R,O,{fill:we(_,s,v.fill),stroke:Z(_,c,v.stroke),strokeWidth:.5}),k},"bpmn:MessageFlow":function(R,_,v={}){v=ke(v,["fill","stroke"]);var k=U(_),O=Me(_),z=we(_,s,v.fill),ne=Z(_,c,v.stroke),ye=b(R,_.waypoints,{markerEnd:d(R,"messageflow-end",z,ne),markerStart:d(R,"messageflow-start",z,ne),stroke:ne,strokeDasharray:"10, 11",strokeWidth:1.5});if(k.get("messageRef")){var Ie=ye.getPointAtLength(ye.getTotalLength()/2),it=i.getScaledPath("MESSAGE_FLOW_MARKER",{abspos:{x:Ie.x,y:Ie.y}}),Fe={strokeWidth:1};O.get("messageVisibleKind")==="initiating"?(Fe.fill=z,Fe.stroke=ne):(Fe.fill=ne,Fe.stroke=z);var ot=x(R,it,Fe),Nt=k.get("messageRef"),Wt=Nt.get("name"),We=ie(R,Wt,{align:"center-top",fitBox:!0,style:{fill:ne}}),mt=ot.getBBox(),Mt=We.getBBox(),Dr=Ie.x-Mt.width/2,yn=Ie.y+mt.height/2+o1;Ja(We,Dr,yn,0)}return ye},"bpmn:ParallelGateway":function(R,_,v={}){v=ke(v,["fill","stroke"]);var k=K(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}),k},"bpmn:Participant":function(R,_,v={}){v=ke(v,["fill","stroke","width","height"]);var k=N(R,_,v),O=Se(_),z=At(_),ne=U(_),ye=ne.get("name");if(O){var Ie=z?[{x:30,y:0},{x:30,y:an(_,v)}]:[{x:0,y:30},{x:En(_,v),y:30}];E(R,Ie,{stroke:Z(_,c,v.stroke),strokeWidth:a1}),q(R,ye,_,v)}else{var it=Bo(_,v);z||(it.height=En(_,v),it.width=an(_,v));var Fe=ie(R,ye,{box:it,align:"center-middle",style:{fill:No(_,u,c,v.stroke)}});if(!z){var ot=-1*an(_,v);Ja(Fe,0,-ot,270)}}return ne.get("participantMultiplicity")&&L("ParticipantMultiplicityMarker",R,_,v),k},"bpmn:ReceiveTask":function(R,_,v={}){v=ke(v,["fill","stroke"]);var k=U(_),O=be(R,_,v),z;return k.get("instantiate")?(m(R,28,28,20*.22,{fill:we(_,s,v.fill),stroke:Z(_,c,v.stroke),strokeWidth:1}),z=i.getScaledPath("TASK_TYPE_INSTANTIATING_SEND",{abspos:{x:7.77,y:9.52}})):z=i.getScaledPath("TASK_TYPE_SEND",{xScaleFactor:.9,yScaleFactor:.9,containerWidth:21,containerHeight:14,position:{mx:.3,my:.4}}),x(R,z,{fill:we(_,s,v.fill),stroke:Z(_,c,v.stroke),strokeWidth:1}),O},"bpmn:ScriptTask":function(R,_,v={}){v=ke(v,["fill","stroke"]);var k=be(R,_,v),O=i.getScaledPath("TASK_TYPE_SCRIPT",{abspos:{x:15,y:20}});return x(R,O,{fill:we(_,s,v.fill),stroke:Z(_,c,v.stroke),strokeWidth:1}),k},"bpmn:SendTask":function(R,_,v={}){v=ke(v,["fill","stroke"]);var k=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:we(_,s,v.fill),strokeWidth:1}),k},"bpmn:SequenceFlow":function(R,_,v={}){v=ke(v,["fill","stroke"]);var k=we(_,s,v.fill),O=Z(_,c,v.stroke),z=b(R,_.waypoints,{markerEnd:d(R,"sequenceflow-end",k,O),stroke:O}),ne=U(_),{source:ye}=_;if(ye){var Ie=U(ye);ne.get("conditionExpression")&&y(Ie,"bpmn:Activity")&&J(z,{markerStart:d(R,"conditional-flow-marker",k,O)}),Ie.get("default")&&(y(Ie,"bpmn:Gateway")||y(Ie,"bpmn:Activity"))&&Ie.get("default")===ne&&J(z,{markerStart:d(R,"conditional-default-flow-marker",k,O)})}return z},"bpmn:ServiceTask":function(R,_,v={}){v=ke(v,["fill","stroke"]);var k=be(R,_,v);m(R,10,10,{fill:we(_,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:we(_,s,v.fill),stroke:Z(_,c,v.stroke),strokeWidth:1}),m(R,10,10,{fill:we(_,s,v.fill),stroke:"none",transform:"translate(11, 10)"});var z=i.getScaledPath("TASK_TYPE_SERVICE",{abspos:{x:17,y:22}});return x(R,z,{fill:we(_,s,v.fill),stroke:Z(_,c,v.stroke),strokeWidth:1}),k},"bpmn:StartEvent":function(R,_,v={}){var{renderIcon:k=!0}=v;v=ke(v,["fill","stroke"]);var O=U(_);O.get("isInterrupting")||(v={...v,strokeDasharray:"6"});var z=se(R,_,v);return k&&$(_,R,v),z},"bpmn:SubProcess":function(R,_,v={}){return Se(_)?v=ke(v,["fill","stroke","width","height"]):v=ke(v,["fill","stroke"]),B(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:k,height:O}=Bo(_,v),z=g(R,k,O,0,0,{fill:"none",stroke:"none"}),ne=i.getScaledPath("TEXT_ANNOTATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:k,containerHeight:O,position:{mx:0,my:0}});x(R,ne,{stroke:Z(_,c,v.stroke)});var ye=U(_),Ie=ye.get("text")||"";return ie(R,Ie,{align:"left-top",box:Bo(_,v),padding:qr,style:{fill:No(_,u,c,v.stroke)}}),z},"bpmn:Transaction":function(R,_,v={}){Se(_)?v=ke(v,["fill","stroke","width","height"]):v=ke(v,["fill","stroke"]);var k=B(R,_,{strokeWidth:1.5,...v}),O=n.style(["no-fill","no-events"],{stroke:Z(_,c,v.stroke),strokeWidth:1.5}),z=Se(_);return z||(v={}),g(R,En(_,v),an(_,v),rs-is,is,O),k},"bpmn:UserTask":function(R,_,v={}){v=ke(v,["fill","stroke"]);var k=be(R,_,v),O=15,z=12,ne=i.getScaledPath("TASK_TYPE_USER_1",{abspos:{x:O,y:z}});x(R,ne,{fill:we(_,s,v.fill),stroke:Z(_,c,v.stroke),strokeWidth:.5});var ye=i.getScaledPath("TASK_TYPE_USER_2",{abspos:{x:O,y:z}});x(R,ye,{fill:we(_,s,v.fill),stroke:Z(_,c,v.stroke),strokeWidth:.5});var Ie=i.getScaledPath("TASK_TYPE_USER_3",{abspos:{x:O,y:z}});return x(R,Ie,{fill:Z(_,c,v.stroke),stroke:Z(_,c,v.stroke),strokeWidth:.5}),k},label:function(R,_,v={}){return nt(R,_,v)}};this._drawPath=x,this._renderer=A}Q(br,ci),br.$inject=["config.bpmnRenderer","eventBus","styles","pathMap","canvas","textRenderer"],br.prototype.canRender=function(e){return y(e,"bpmn:BaseElement")},br.prototype.drawShape=function(e,t,n={}){var{type:i}=t,r=this._renderer(i);return r(e,t,n)},br.prototype.drawConnection=function(e,t,n={}){var{type:i}=t,r=this._renderer(i);return r(e,t,n)},br.prototype.getShapePath=function(e){return _e(e)?ju(e,s1):y(e,"bpmn:Event")?yh(e):y(e,"bpmn:Activity")?ju(e,rs):y(e,"bpmn:Gateway")?n1(e):i1(e)};function ke(e,t=[]){return t.reduce((n,i)=>(e[i]&&(n[i]=e[i]),n),{})}var l1=0,p1={width:150,height:50};function f1(e){var t=e.split("-");return{horizontal:t[0]||"center",vertical:t[1]||"top"}}function d1(e){return Rt(e)?D({top:0,left:0,right:0,bottom:0},e):{top:e,left:e,right:e,bottom:e}}var Fu=null;function h1(){return Fu||(Fu=document.createElement("canvas").getContext("2d")),Fu}function m1(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(_h(e.fontSize)||"12px"),t.push(e.fontFamily||"sans-serif"),t.join(" ")}function _h(e){if(e!=null)return typeof e=="number"||/^-?\d+(\.\d+)?$/.test(e)?e+"px":e}function g1(e,t){var n=h1();if(!n)return{width:0,height:0};n.font=m1(t),"letterSpacing"in n&&(n.letterSpacing=_h(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 v1(e,t,n){for(var i=e.shift(),r=i,o;;){if(o=g1(r,n),o.width=r?o.width:0,r===" "||r===""||o.width<Math.round(t)||r.length<2)return y1(e,r,i,o);r=b1(r,o.width,t)}}function y1(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 bh="­";function _1(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===bh)&&r.pop();break}var a=r[r.length-1];return a&&a===bh&&(r[r.length-1]="-"),r.join("")}function b1(e,t,n){var i=Math.max(e.length*(n/t),1),r=_1(e,i);return r||(r=e.slice(0,Math.max(Math.round(i-1),1))),r}function os(e){this._config=D({},{size:p1,padding:l1,style:{},align:"center-top"},e||{})}os.prototype.createText=function(e,t){return this.layoutText(e,t).element},os.prototype.getDimensions=function(e,t){return this.layoutText(e,t).dimensions},os.prototype.layoutText=function(e,t){for(var n=D({},this._config.size,t.box),i=D({},this._config.style,t.style),r=f1(t.align||this._config.align),o=d1(t.padding!==void 0?t.padding:this._config.padding),a=t.fitBox||!1,s=x1(i),c=e.split(/\u00AD?\r?\n/),u=[],l=n.width-o.left-o.right;c.length;)u.push(v1(c,l,i));r.vertical==="middle"&&(o.top=o.bottom=0);var p=nn(u,function(g,w,E){return g+(s||w.height)},0)+o.top+o.bottom,f=nn(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=ae("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=ae("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 x1(e){if("fontSize"in e&&"lineHeight"in e)return e.lineHeight*parseInt(e.fontSize,10)}var E1=12,w1=1.2,S1=40;function xh(e){var t=D({fontFamily:"Arial, sans-serif",fontSize:E1,fontWeight:"normal",lineHeight:w1},e&&e.defaultStyle||{}),n=parseInt(t.fontSize,10)-1,i=D({},t,{fontSize:n},e&&e.externalStyle||{}),r=new os({style:t});this.getExternalLabelBounds=function(a,s){var c={width:Math.max(a.width,_r.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:qr});return{x:a.x,y:a.y,width:a.width,height:Math.max(S1,Math.round(c.height))}},this.getDimensions=function(a,s){return r.getDimensions(a,s||{})};function o(a,s,c){return r.getDimensions(a,D({box:s},c))}this.createText=function(a,s){return r.createText(a,s||{})},this.getDefaultStyle=function(){return t},this.getExternalStyle=function(){return i}}xh.$inject=["config.textRenderer"];function R1(){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=T1(i.d,{mx:r,my:o,e:a});return p}}var C1=/\{([^{}]+)\}/g,P1=/(?:(?:^|\.)(.+?)(?=\[|\.|$|\()|\[('|")(.+?)\2\])(\(\))?/g;function A1(e,t,n){var i=n;return t.replace(P1,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 T1(e,t){return String(e).replace(C1,function(n,i){return A1(n,i,t)})}const M1={__init__:["bpmnRenderer"],bpmnRenderer:["type",br],textRenderer:["type",xh],pathMap:["type",R1]};function k1(e,t){return t=t||{},e.replace(/{([^}]+)}/g,function(n,i){return t[i]||"{"+i+"}"})}const $o={translate:["value",k1]};function as(e,t,n){return D({id:e.id,type:e.$type,businessObject:e,di:t},n)}function D1(e,t,n){var i=e.waypoint;return!i||i.length<2?[pe(t),pe(n)]:i.map(function(r){return{x:r.x,y:r.y}})}function Eh(e,t,n){return new Error(`element ${Vt(t)} referenced by ${Vt(e)}#${n} not yet drawn`)}function fi(e,t,n,i,r){this._eventBus=e,this._canvas=t,this._elementFactory=n,this._elementRegistry=i,this._textRenderer=r}fi.$inject=["eventBus","canvas","elementFactory","elementRegistry","textRenderer"],fi.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(as(e,t,a)),this._canvas.addRootElement(i)}else if(y(t,"bpmndi:BPMNShape")){var s=!Se(e,t),c=I1(e);r=n&&(n.hidden||n.collapsed);var u=t.bounds;i=this._elementFactory.createShape(as(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")&&(O1(n,pe(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(as(e,t,{hidden:r,source:l,target:p,waypoints:D1(t,l,p)})),y(e,"bpmn:DataAssociation")&&(n=this._canvas.findRoot(n)),this._canvas.addConnection(i,n,o)}else throw new Error(`unknown di ${Vt(t)} for element ${Vt(e)}`);return Fi(e)&&vn(i)&&this.addLabel(e,t,i),this._eventBus.fire("bpmnElement.added",{element:i}),i},fi.prototype._attachBoundary=function(e,t){var n=e.attachedToRef;if(!n)throw new Error(`missing ${Vt(e)}#attachedToRef`);var i=this._elementRegistry.get(n.id),r=i&&i.attachers;if(!i)throw Eh(e,n,"attachedToRef");t.host=i,r||(i.attachers=r=[]),r.indexOf(t)===-1&&r.push(t)},fi.prototype.addLabel=function(e,t,n){var i,r,o;return i=Kw(t,n),r=vn(n),r&&(i=this._textRenderer.getExternalLabelBounds(i,r)),o=this._elementFactory.createLabel(as(e,t,{id:e.id+"_label",labelTarget:n,type:"label",hidden:n.hidden||!vn(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)},fi.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?Eh(e,i,t+"Ref"):new Error(`${Vt(e)}#${t} Ref not specified`)},fi.prototype._getSource=function(e){return this._getConnectedElement(e,"source")},fi.prototype._getTarget=function(e){return this._getConnectedElement(e,"target")},fi.prototype._getElement=function(e){return this._elementRegistry.get(e.id)};function O1(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 I1(e){return y(e,"bpmn:Group")}const wh={__depends__:[M1,{__depends__:[$o],bpmnImporter:["type",fi]}]};function jo(e){return{x:e.x+e.width/2,y:e.y+e.height/2}}function Nn(e,t){return{x:e.x-t.x,y:e.y-t.y}}function Hu(e){return Math.log(e)/Math.log(10)}var L1=1e3;function W(e){this._eventBus=e}W.$inject=["eventBus"];function N1(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((Ct(t)||de(t))&&(o=r,r=i,i=n,n=t,t=null),Ct(n)&&(o=r,r=i,i=n,n=L1),Rt(r)&&(o=r,r=!1),!Ct(i))throw new Error("handlerFn must be a function");le(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?N1(i,o):i,o)})},W.prototype.canExecute=di("canExecute"),W.prototype.preExecute=di("preExecute"),W.prototype.preExecuted=di("preExecuted"),W.prototype.execute=di("execute"),W.prototype.executed=di("executed"),W.prototype.postExecute=di("postExecute"),W.prototype.postExecuted=di("postExecuted"),W.prototype.revert=di("revert"),W.prototype.reverted=di("reverted");function di(e){return function(n,i,r,o,a){(Ct(n)||de(n))&&(a=o,o=r,r=i,i=n,n=null),this.on(n,e,i,r,o,a)}}var zu=["top","bottom","left","right"],ss=10;function Vu(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(ns(r)&&!He(r)){var o=j1(r);o&&i(r,o)}}function i(r,o){var a=pe(r),s=r.label,c=pe(s);if(s.parent){var u=ue(r),l;switch(o){case"top":l={x:a.x,y:u.top-ss-s.height/2};break;case"left":l={x:u.left-ss-s.width/2,y:a.y};break;case"bottom":l={x:a.x,y:u.bottom+ss+s.height/2};break;case"right":l={x:u.right+ss+s.width/2,y:a.y};break}var p=Nn(l,c);t.moveShape(s,p)}}}Q(Vu,W),Vu.$inject=["eventBus","modeling"];function B1(e){var t=e.host,n=pe(e),i=Dt(n,t),r;i.indexOf("-")>=0?r=i.split("-"):r=[i];var o=zu.filter(function(a){return r.indexOf(a)===-1});return o}function $1(e){var t=pe(e),n=[].concat(e.incoming.map(function(i){return i.waypoints[i.waypoints.length-2]}),e.outgoing.map(function(i){return i.waypoints[1]})).map(function(i){return Sh(t,i)});return n}function j1(e){var t=pe(e.label),n=pe(e),i=Sh(n,t);if(F1(i)){var r=$1(e);if(e.host){var o=B1(e);r=r.concat(o)}var a=zu.filter(function(s){return r.indexOf(s)===-1});return a.indexOf(i)!==-1?Dt(e.label,e)!=="intersect"?void 0:i:a[0]}}function Sh(e,t){return Dt(t,e,5)}function F1(e){return zu.indexOf(e)!==-1}function Gu(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(Gu,W),Gu.$inject=["eventBus"];var H1=1500;function Wu(e,t,n){e.invoke(W,this),this.preExecute("elements.delete",H1,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=Ee(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(Lr(zr(Array.from(s),ut(u))));c=c.union(l),s=s.difference(l)}),Array.from(c)}}Q(Wu,W),Wu.$inject=["injector","eventBus","canvas"];function Uu(e,t){e.invoke(W,this),this.postExecute("shape.move",function(n){var i=n.newParent,r=n.shape,o=Ee(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(Uu,W),Uu.$inject=["injector","modeling"];function Kr(e,t){for(en(t)&&(t=[t]);e=e.parent;)if(xe(e,t))return e;return null}function Rh(e,t){var n=Kr(e,"bpmn:Process");if(n)return!0;var i=["bpmn:Participant","bpmn:Lane"];if(n=Kr(e,i),n)return At(n);if(xe(e,i))return At(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?At(o):!0}var Ch=500;function cs(e,t){t.invoke(W,this),this._bpmnReplace=e;var n=this;this.postExecuted("elements.create",Ch,function(i){var r=i.elements;r=r.filter(function(o){var a=o.host;return Ph(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",Ch,function(i){var r=i.shapes,o=i.newHost;if(r.length===1){var a=r[0];Ph(a,o)&&(i.shapes=[n._replaceShape(a,o)])}},!0)}cs.$inject=["bpmnReplace","injector"],Q(cs,W),cs.prototype._replaceShape=function(e,t){var n=z1(e),i={type:"bpmn:BoundaryEvent",host:t};return n&&(i.eventDefinitionType=n.$type),this._bpmnReplace.replaceElement(e,i,{layoutConnection:!1})};function z1(e){var t=U(e),n=t.eventDefinitions;return n&&n[0]}function Ph(e,t){return!_e(e)&&xe(e,["bpmn:IntermediateThrowEvent","bpmn:IntermediateCatchEvent"])&&!!t}function qu(e,t){W.call(this,e);function n(i){return Ee(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)})})}qu.$inject=["eventBus","modeling"],Q(qu,W);function Ah(e){return e.create("bpmn:Category")}function V1(e){return e.create("bpmn:CategoryValue")}function Th(e,t){var n=t.get("categoryValueRef");return n||(n=t.categoryValueRef=V1(e)),n.$parent||(n.$parent=Ah(e)),n}function G1(e,t,n){return at(t.get("categoryValue"),e),e.$parent=t,at(n.get("rootElements"),t),t.$parent=n,e}function W1(e){var t=e.$parent;return t&&(rt(t.get("categoryValue"),e),e.$parent=null),e}function U1(e){var t=e.$parent;return t&&(rt(t.get("rootElements"),e),e.$parent=null),e}var q1=500;function Yu(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&&G1(c,u,e.getDefinitions())}function s(c,u,l){u&&!o(u,l)&&U1(u),c&&!r(c,l)&&W1(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"],q1,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){Mh(c).forEach(function(u){a(u.categoryValue,u.category)})},!0),this.reverted("group.updateRefs",function(c){Mh(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)}Yu.$inject=["bpmnjs","elementRegistry","injector"],Q(Yu,W);function Mh(e){var t;return((t=e.updates)==null?void 0:t.groups)||[]}function Ku(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;Xr(w)&&Fo(E)&&l(E)}function r(g){const w=g.connection,E=g.source,b=g.target;Xr(E)&&us(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;Fo(b)&&l(b),Xr(x)&&us(w)&&u(w)}}function a(g){const{element:w}=g;Fo(w)?(p(w),d(w)):us(w)&&h(w)}function s(g){const{newData:w,oldShape:E}=g;if(Xr(g.oldShape)&&w.eventDefinitionType!=="bpmn:CompensateEventDefinition"||w.type!=="bpmn:BoundaryEvent"){const b=E.outgoing.find(({target:x})=>Fo(x));b&&b.target&&(g._connectionTarget=b.target)}else if(!Xr(g.oldShape)&&w.eventDefinitionType==="bpmn:CompensateEventDefinition"&&w.type==="bpmn:BoundaryEvent"){const b=E.outgoing.find(({target:x})=>us(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=>Fo(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=>Xr(E.source));t.removeElements(w)}function m(g){const w=g.outgoing.filter(E=>y(E,"bpmn:SequenceFlow"));t.removeElements(w)}}Q(Ku,W),Ku.$inject=["eventBus","modeling","bpmnRules"];function Fo(e){const t=U(e);return t&&t.get("isForCompensation")}function Xr(e){return e&&y(e,"bpmn:BoundaryEvent")&&Ur(e,"bpmn:CompensateEventDefinition")}function us(e){return e&&y(e,"bpmn:Activity")&&!Gt(e)}function Xu(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=Kr(i,"bpmn:Participant"))})}Xu.$inject=["injector"],Q(Xu,W);function Zu(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}})}Zu.$inject=["eventBus","bpmnFactory"],Q(Zu,W);var Qu=20,Ju=20,kh=30,ls=2e3;function el(e,t,n){W.call(this,t),t.on(["create.start","shape.move.start"],ls,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)&&!He(p)});if(c.length){var u=ut(c),l=Y1(a,u);D(a,l),o.createConstraints=K1(a,u)}}}),t.on("create.start",ls,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",ls,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",ls,function(r){var o=r.elements,a=r.parent,s=X1(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)}el.$inject=["canvas","eventBus","modeling"],Q(el,W);function Y1(e,t){t={width:t.width+Qu*2+kh,height:t.height+Ju*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 K1(e,t){return t=ue(t),{bottom:t.top+e.height/2-Ju,left:t.right-e.width/2+Qu,top:t.bottom-e.height/2+Ju,right:t.left+e.width/2-Qu-kh}}function X1(e){return Ge(e,function(t){return y(t,"bpmn:Participant")})}var Dh="__targetRef_placeholder";function tl(e,t){W.call(this,e),this.executed(["connection.create","connection.delete","connection.move","connection.reconnect"],Oh(o)),this.reverted(["connection.create","connection.delete","connection.move","connection.reconnect"],Oh(o));function n(a,s,c){var u=a.get("dataInputAssociations");return Ge(u,function(l){return l!==c&&l.targetRef===s})}function i(a,s){var c=a.get("properties"),u=Ge(c,function(l){return l.name===Dh});return!u&&s&&(u=t.create("bpmn:Property",{name:Dh}),at(c,u)),u}function r(a,s){var c=i(a);c&&(n(a,c,s)||rt(a.get("properties"),c))}function o(a){var s=a.context,c=s.connection,u=c.businessObject,l=c.target,p=l&&l.businessObject,f=s.newTarget,d=f&&f.businessObject,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}}tl.$inject=["eventBus","bpmnFactory"],Q(tl,W);function Oh(e){return function(t){var n=t.context,i=n.connection;if(y(i,"bpmn:DataInputAssociation"))return e(t)}}function ps(e){this._bpmnUpdater=e}ps.$inject=["bpmnUpdater"],ps.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),[]},ps.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 nl(e,t,n,i){W.call(this,i),t.registerHandler("dataStore.updateContainment",ps);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:Q1(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 Z1(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)})})}nl.$inject=["canvas","commandStack","elementRegistry","eventBus"],Q(nl,W);function Z1(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 Q1(e,t){for(;e.parent;){if(y(e.parent,t))return e.parent;e=e.parent}}var fs=Math.max,ds=Math.min,J1=20;function Ih(e,t){return{top:e.top-t.top,right:e.right-t.right,bottom:e.bottom-t.bottom,left:e.left-t.left}}function eS(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 tS(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 hs(e,t,n){var i=t[e],r=n.min&&n.min[e],o=n.max&&n.max[e];return de(r)&&(i=(/top|left/.test(e)?ds:fs)(i,r)),de(o)&&(i=(/top|left/.test(e)?fs:ds)(i,o)),i}function nS(e,t){if(!t)return e;var n=ue(e);return Xa({top:hs("top",n,t),right:hs("right",n,t),bottom:hs("bottom",n,t),left:hs("left",n,t)})}function iS(e,t,n,i){var r=ue(t),o={top:/n/.test(e)?r.bottom-n.height:r.top,left:/w/.test(e)?r.right-n.width:r.left,bottom:/s/.test(e)?r.top+n.height:r.bottom,right:/e/.test(e)?r.left+n.width:r.right},a=i?ue(i):o,s={top:ds(o.top,a.top),left:ds(o.left,a.left),bottom:fs(o.bottom,a.bottom),right:fs(o.right,a.right)};return Xa(s)}function Ho(e,t){return typeof e<"u"?e:J1}function rS(e,t){var n,i,r,o;return typeof t=="object"?(n=Ho(t.left),i=Ho(t.right),r=Ho(t.top),o=Ho(t.bottom)):n=i=r=o=Ho(t),{x:e.x-n,y:e.y-r,width:e.width+n+i,height:e.height+r+o}}function oS(e){return!(e.waypoints||e.type==="label")}function Lh(e,t){var n;if(e.length===void 0?n=Ee(e.children,oS):n=e,n.length)return rS(ut(n),t)}var Hi=Math.abs;function aS(e,t){return Ih(ue(t),ue(e))}var sS=["bpmn:Participant","bpmn:Process","bpmn:SubProcess"],wn=30;function ms(e,t){return t=t||[],e.children.filter(function(n){y(n,"bpmn:Lane")&&(ms(n,t),t.push(n))}),t}function zi(e){return e.children.filter(function(t){return y(t,"bpmn:Lane")})}function Sn(e){return Kr(e,sS)||e}function cS(e,t){var n=Sn(e),i=y(n,"bpmn:Process")?[]:[n],r=ms(n,i),o=ue(e),a=ue(t),s=aS(e,t),c=[],u=At(e);return r.forEach(function(l){if(l!==e){var p=u?0:s.top,f=u?s.right:0,d=u?0:s.bottom,h=u?s.left:0,m=ue(l);s.top&&(Hi(m.bottom-o.top)<10&&(d=a.top-m.bottom),Hi(m.top-o.top)<5&&(p=a.top-m.top)),s.left&&(Hi(m.right-o.left)<10&&(f=a.left-m.right),Hi(m.left-o.left)<5&&(h=a.left-m.left)),s.bottom&&(Hi(m.top-o.bottom)<10&&(p=a.bottom-m.top),Hi(m.bottom-o.bottom)<5&&(d=a.bottom-m.bottom)),s.right&&(Hi(m.left-o.right)<10&&(h=a.right-m.left),Hi(m.right-o.right)<5&&(f=a.right-m.right)),(p||f||d||h)&&c.push({shape:l,newBounds:tS(l,{top:p,right:f,bottom:d,left:h})})}}),c}var uS=500;function il(e,t){W.call(this,e);function n(i,r){var o=At(i),a=zi(r),s=[],c=[],u=[],l=[];if(vr(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",uS,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))})}il.$inject=["eventBus","spaceTool"],Q(il,W);var Nh=500;function gs(e,t){t.invoke(W,this),this._bpmnReplace=e;var n=this;this.postExecuted("elements.create",Nh,function(i){var r=i.elements;r.filter(function(o){var a=o.host;return Bh(o,a)}).map(function(o){return r.indexOf(o)}).forEach(function(o){i.elements[o]=n._replaceShape(r[o])})},!0),this.preExecute("elements.move",Nh,function(i){var r=i.shapes,o=i.newHost;r.forEach(function(a,s){var c=a.host;Bh(a,pS(r,c)?c:o)&&(r[s]=n._replaceShape(a))})},!0)}gs.$inject=["bpmnReplace","injector"],Q(gs,W),gs.prototype._replaceShape=function(e){var t=lS(e),n;return t?n={type:"bpmn:IntermediateCatchEvent",eventDefinitionType:t.$type}:n={type:"bpmn:IntermediateThrowEvent"},this._bpmnReplace.replaceElement(e,n,{layoutConnection:!1})};function lS(e){var t=U(e),n=t.eventDefinitions;return n&&n[0]}function Bh(e,t){return!_e(e)&&y(e,"bpmn:BoundaryEvent")&&!t}function pS(e,t){return e.indexOf(t)!==-1}var vs=Math.round,fS=Math.max;function dS(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 hS(e){var t=[];return e.forEach(function(n,i){t.push([i===0?"M":"L",n.x,n.y])}),t}var $h=10;function mS(e,t){var n,i;for(n=0;i=e[n];n++)if(ko(i,t)<=$h)return{point:e[n],bendpoint:!0,index:n};return null}function gS(e,t){var n=Vd(dS(t,$h),hS(e)),i=n[0],r=n[n.length-1],o;return i?i!==r?i.segment2!==r.segment2?(o=fS(i.segment2,r.segment2)-1,{point:e[o],bendpoint:!0,index:o}):{point:{x:vs(i.x+r.x)/2,y:vs(i.y+r.y)/2},index:i.segment2}:{point:{x:vs(i.x),y:vs(i.y)},index:i.segment2}:null}function rl(e,t){return mS(e,t)||gS(e,t)}function ol(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;de(a.width)?w=pe(a):w=a;var E=rl(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||!jh(r,c[c.length-1]))&&c.push(Fh(l)),(u.length===1||!jh(r,u[0]))&&u.unshift(Fh(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&&Ee(g,function(x){return x.source===d.source})||[],h&&Ee(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=pe(c),l={x:u.x+s.x,y:u.y+s.y},p=Ge(o.children,function(f){var d=t.canInsert(a,f);return d&&rl(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(ol,W),ol.$inject=["eventBus","bpmnRules","modeling"];function jh(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 Fh(e){return D({},e)}function al(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)&&Zr(r)){var c=[];y(o,"bpmn:EventBasedGateway")?c=a.incoming.filter(u=>u!==r&&Zr(u)):c=a.incoming.filter(u=>u!==r&&Zr(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(Zr).reduce(function(a,s){return a.includes(s.target)?a:a.concat(s.target)},[]);o.forEach(function(a){a.incoming.filter(Zr).forEach(function(s){const c=a.incoming.filter(Zr).filter(function(u){return u.source===r});(s.source!==r||c.length>1)&&t.removeConnection(s)})})}})}al.$inject=["eventBus","modeling"],Q(al,W);function Zr(e){return y(e,"bpmn:SequenceFlow")}var ys=1500,Hh=2e3;function zh(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"],ys,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=Sn(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"],ys,function(i){var r=i.hover;y(r,"bpmn:Lane")&&(i.hover=Sn(r)||r,i.hoverGfx=e.getGraphics(i.hover))}),t.on(["bendpoint.move.hover"],ys,function(i){var r=i.context,o=i.hover,a=r.type;y(o,"bpmn:Lane")&&/reconnect/.test(a)&&(i.hover=Sn(o)||o,i.hoverGfx=e.getGraphics(i.hover))}),t.on(["connect.start"],ys,function(i){var r=i.context,o=r.start;y(o,"bpmn:Lane")&&(r.start=Sn(o)||o)}),t.on("shape.move.start",Hh,function(i){var r=i.shape;y(r,"bpmn:Lane")&&(i.shape=Sn(r)||r)}),t.on("spaceTool.move",Hh,function(i){var r=i.hover;r&&y(r,"bpmn:Lane")&&(i.hover=Sn(r))})}zh.$inject=["elementRegistry","eventBus","canvas"];var Vh=770;function sl(e,t,n,i){n.invoke(W,this);function r(s,c){var u=U(s),l=c.categoryValue||u.categoryValueRef;l||(l=Th(e,u));var p=c.category||l.$parent||Ah(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",Vh,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",Vh,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})}sl.$inject=["bpmnFactory","eventBus","injector","moddleCopy"],Q(sl,W);function cl(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 Gh(e){function t(i,r,o){var a={x:o.x,y:o.y-50},s={x:o.x-50,y:o.y},c=cl(i,r,o,a),u=cl(i,r,o,s),l;c&&u?Wh(c,o)>Wh(u,o)?l=u:l=c:l=c||u,i.original=l}function n(i){var r=i.waypoints;t(r[0],r[1],pe(i.source)),t(r[r.length-1],r[r.length-2],pe(i.target))}e.on("bpmnElement.added",function(i){var r=i.element;r.waypoints&&n(r)})}Gh.$inject=["eventBus"];function Wh(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function ul(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)}})}ul.$inject=["eventBus"],Q(ul,W);function Uh(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}function qh(e){return Math.atan((e[1].y-e[0].y)/(e[1].x-e[0].x))}function vS(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 yS(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 ll(e,t){var n=t[0],i=t[1],r={x:i.x-n.x,y:i.y-n.y},o=yS([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 Yh(e,t){var n=ll(e,t),i={x:n.x-e.x,y:n.y-e.y};return Uh(i)}function zo(e,t){return Uh({x:e.x-t.x,y:e.y-t.y})}var Kh=Math.sqrt,Xh=Math.min,_S=Math.max,Zh=Math.abs;function Qh(e){return Math.pow(e,2)}function Vo(e,t){return Kh(Qh(e.x-t.x)+Qh(e.y-t.y))}function bS(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],em(i,r)?u=[i]:(o=Vo(e,i),a=Vo(e,r),c=Xh(o,a),u=xS(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:em(i,u[0])?n:n+1}),u.length===2&&(s=wS(u[0],u[1]),l={type:"segment",position:s,segmentIndex:n,relativeLocation:Vo(i,s)/Vo(i,r)}),p=Vo(l.position,e),(!d||f>p)&&(d=l,f=p)}return d}function xS(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=Kh(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 ES(b,e,t)})}function ES(e,t,n){return Jh(e.x,t.x,n.x)&&Jh(e.y,t.y,n.y)}function Jh(e,t,n){return e>=Xh(t,n)-_s&&e<=_S(t,n)+_s}function wS(e,t){return{x:(e.x+t.x)/2,y:(e.y+t.y)/2}}var _s=.1;function em(e,t){return Zh(e.x-t.x)<=_s&&Zh(e.y-t.y)<=_s}function SS(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=nm(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 tm(e,t,n,i){var r=0,o=0,a={point:e,delta:{x:0,y:0}},s=bS(e,n),c=s.segmentIndex,u=SS(n,t,s,i);if(u<0||u>t.length-2||u===null)return a;var l=im(n,c),p=im(t,u),f=s.position,d=CS(l,f),h=RS(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=nm(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=vS({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:li(b),delta:li({x:r,y:o})}}function nm(e,t){var n=zo(e[t-1],e[t]),i=zo(e[t],e[t+1]),r=n/(n+i);return r}function RS(e,t){var n=qh(e),i=qh(t);return i-n}function im(e,t){return[e[t],e[t+1]]}function CS(e,t){var n=zo(e[0],e[1]),i=zo(e[0],t);return n===0?0:i/n}function PS(e,t,n,i){var r=pe(e);return tm(r,t,n,i).delta}function Go(e,t,n){var i=jo(t),r=jo(n),o=Nn(e,i),a={x:o.x*(n.width/t.width),y:o.y*(n.height/t.height)};return li({x:r.x+a.x,y:r.y+a.y})}function rm(e,t,n){var i=jo(e),r=jo(t),o=jo(n),a=Nn(e,i),s=Nn(i,r),c=AS(i,t,n);if(c)return c;var u={x:s.x*(n.width/t.width),y:s.y*(n.height/t.height)},l={x:o.x+u.x,y:o.y+u.y};return li({x:l.x+a.x-e.x,y:l.y+a.y-e.y})}function AS(e,t,n){var i=ue(t),r=ue(n);if(TS(i,r))return null;var o=Dt(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=Dt(n,s),c!==o?null:a}function TS(e,t){return MS(e,t)||kS(e,t)}function MS(e,t){return e.right!==t.right&&e.left!==t.left}function kS(e,t){return e.top!==t.top&&e.bottom!==t.bottom}var om="name",am="text";function pl(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(om in u&&t.updateLabel(c,u[om]),am in u&&y(c,"bpmn:TextAnnotation")){var l=i.getTextAnnotationBounds({x:c.x,y:c.y,width:c.width,height:c.height},u[am]||"");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)||!Fi(u)||vn(u)&&t.updateLabel(u,vn(u))}}),this.postExecute("shape.delete",function(a){var s=a.context,c=s.labelTarget,u=s.hints||{};c&&u.unsetLabel!==!1&&t.updateLabel(c,null,null,{removeShape:!1})});function o(a){var s=a.context,c=s.connection,u=c.label,l=D({},s.hints),p=s.newWaypoints||c.waypoints,f=s.oldWaypoints;return typeof l.startChanged>"u"&&(l.startChanged=!!l.connectionStart),typeof l.endChanged>"u"&&(l.endChanged=!!l.connectionEnd),PS(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&&Fi(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(vn(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(ns(c)){var p=c.label,f=pe(p),d=IS(l),h=OS(f,d),m=DS(h,l,u);t.moveShape(p,m)}})}Q(pl,W),pl.$inject=["eventBus","modeling","bpmnFactory","textRenderer"];function DS(e,t,n){var i=Go(e,t,n);return li(Nn(i,e))}function OS(e,t){if(t.length){var n=LS(e,t);return ll(e,n)}}function IS(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 LS(e,t){var n=t.map(function(r){return{line:r,distance:Yh(e,r)}}),i=Hn(n,"distance");return i[0].line}function NS(e,t,n,i){return tm(e,t,n,i).point}function fl(e,t){W.call(this,e);function n(i,r){var o=i.context,a=o.connection,s=D({},o.hints),c=o.newWaypoints||a.waypoints,u=o.oldWaypoints;return typeof s.startChanged>"u"&&(s.startChanged=!!s.connectionStart),typeof s.endChanged>"u"&&(s.endChanged=!!s.connectionEnd),NS(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(fl,W),fl.$inject=["eventBus","modeling"];function bs(e,t,n){var i=Es(e),r=cm(i,t),o=i[0];return r.length?r[r.length-1]:Go(o.original||o,n,t)}function xs(e,t,n){var i=Es(e),r=cm(i,t),o=i[i.length-1];return r.length?r[0]:Go(o.original||o,n,t)}function dl(e,t,n){var i=Es(e),r=sm(t,n),o=i[0];return Go(o.original||o,r,t)}function hl(e,t,n){var i=Es(e),r=sm(t,n),o=i[i.length-1];return Go(o.original||o,r,t)}function sm(e,t){return{x:e.x-t.x,y:e.y-t.y,width:e.width,height:e.height}}function Es(e){var t=e.waypoints;if(!t.length)throw new Error("connection#"+e.id+": no waypoints");return t}function cm(e,t){var n=jt(e,$S);return Ee(n,function(i){return BS(i,t)})}function BS(e,t){return Dt(t,e,1)==="intersect"}function $S(e){return e.original||e}function ml(e,t){W.call(this,e),this.postExecute("shape.replace",function(n){var i=n.oldShape,r=n.newShape;if(jS(i,r)){var o=FS(i);o.incoming.forEach(function(a){var s=xs(a,r,i);t.reconnectEnd(a,r,s)}),o.outgoing.forEach(function(a){var s=bs(a,r,i);t.reconnectStart(a,r,s)})}},!0)}ml.$inject=["eventBus","modeling"],Q(ml,W);function jS(e,t){return y(e,"bpmn:Participant")&&Se(e)&&y(t,"bpmn:Participant")&&!Se(t)}function FS(e){var t=To([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 HS=["bpmn:MessageEventDefinition","bpmn:TimerEventDefinition","bpmn:EscalationEventDefinition","bpmn:ConditionalEventDefinition","bpmn:SignalEventDefinition"];function um(e){const t=U(e);if(!y(t,"bpmn:BoundaryEvent")&&!(y(t,"bpmn:StartEvent")&&Gt(t.$parent)))return!1;const n=t.get("eventDefinitions");return!n||!n.length?!1:HS.some(i=>y(n[0],i))}function lm(e){return y(e,"bpmn:BoundaryEvent")?"cancelActivity":"isInterrupting"}function gl(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(!um(r))return;const a=lm(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})})}gl.$inject=["injector","modeling"],Q(gl,W);function vl(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(vl,W),vl.$inject=["eventBus","modeling"];function yl(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=zS(o.waypoints,a.waypoints);n.reconnectEnd(o,a.target,s)}}})}Q(yl,W),yl.$inject=["eventBus","bpmnRules","modeling"];function Qr(e){return e.original||e}function zS(e,t){var n=cl(Qr(e[e.length-2]),Qr(e[e.length-1]),Qr(t[1]),Qr(t[0]));return n?[].concat(e.slice(0,e.length-1),[n],t.slice(1)):[Qr(e[0]),Qr(t[t.length-1])]}function _l(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)}_l.$inject=["eventBus","modeling"],Q(_l,W);function bl(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=Ge(p.outgoing,Br({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(bl,W),bl.$inject=["eventBus","modeling","bpmnRules","injector"];function ws(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=nn(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){Gt(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(ws,W),ws.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)},ws.$inject=["bpmnReplace","bpmnRules","elementRegistry","injector","modeling","selection"];var VS=1500,GS={width:140,height:120},xl={width:300,height:60},El={width:60,height:300},Ss={width:300,height:150},Rs={width:150,height:300},pm={width:140,height:120},fm={width:100,height:40};function dm(e){e.on("resize.start",VS,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=KS(i,r,o)),y(i,"bpmn:SubProcess")&&Se(i)&&(n.minDimensions=pm),y(i,"bpmn:TextAnnotation")&&(n.minDimensions=fm)})}dm.$inject=["eventBus"];var Vi=Math.abs,WS=Math.min,US=Math.max;function hm(e,t,n,i){var r=e[t];e[t]=r===void 0?n:i(n,r)}function Jr(e,t,n){return hm(e,t,n,WS)}function eo(e,t,n){return hm(e,t,n,US)}var qS={top:20,left:50,right:20,bottom:20},YS={top:50,left:20,right:20,bottom:20};function KS(e,t,n){var i=Sn(e),r=!0,o=!0,a=ms(i,[i]),s=ue(e),c={},u={},l=At(e),p=l?xl:El;/n/.test(t)?u.top=s.bottom-p.height:/e/.test(t)?u.right=s.left+p.width:/s/.test(t)?u.bottom=s.top+p.height:/w/.test(t)&&(u.left=s.right-p.width),a.forEach(function(h){var m=ue(h);l?(m.top<s.top-10&&(r=!1),m.bottom>s.bottom+10&&(o=!1)):(m.left<s.left-10&&(r=!1),m.right>s.right+10&&(o=!1)),/n/.test(t)&&(n&&Vi(s.top-m.bottom)<10&&eo(c,"top",m.top+p.height),Vi(s.top-m.top)<5&&Jr(u,"top",m.bottom-p.height)),/e/.test(t)&&(n&&Vi(s.right-m.left)<10&&Jr(c,"right",m.right-p.width),Vi(s.right-m.right)<5&&eo(u,"right",m.left+p.width)),/s/.test(t)&&(n&&Vi(s.bottom-m.top)<10&&Jr(c,"bottom",m.bottom-p.height),Vi(s.bottom-m.bottom)<5&&eo(u,"bottom",m.top+p.height)),/w/.test(t)&&(n&&Vi(s.left-m.right)<10&&eo(c,"left",m.left+p.width),Vi(s.left-m.left)<5&&Jr(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?qS:YS;return f.forEach(function(h){var m=ue(h);/n/.test(t)&&(!l||r)&&Jr(u,"top",m.top-d.top),/e/.test(t)&&(l||o)&&eo(u,"right",m.right+d.right),/s/.test(t)&&(!l||o)&&eo(u,"bottom",m.bottom+d.bottom),/w/.test(t)&&(l||r)&&Jr(u,"left",m.left-d.left)}),{min:u,max:c}}function mm(e){!e||typeof e.stopPropagation!="function"||e.stopPropagation()}function to(e){return e.originalEvent||e.srcEvent}function wl(e){mm(e),mm(to(e))}function xr(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 gm(){return/mac/i.test(navigator.platform)}function vm(e,t){return(to(e)||e).button===t}function Gi(e){return vm(e,0)}function XS(e){return vm(e,1)}function Wo(e){var t=to(e)||e;return Gi(e)?gm()?t.metaKey:t.ctrlKey:!1}function Cs(e){var t=to(e)||e;return Gi(e)&&t.shiftKey}var ym=1001;function _m(e,t){e.on("resize.start",ym+500,function(n){var i=n.context,r=i.shape;(y(r,"bpmn:Lane")||y(r,"bpmn:Participant"))&&(i.balanced=!Wo(n))}),e.on("resize.end",ym,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=Yd(a),t.resizeLane(r,a,i.balanced)),!1})}_m.$inject=["eventBus","modeling"];var ZS=500;function Sl(e,t,n,i,r){n.invoke(W,this);function o(l){return xe(l,["bpmn:ReceiveTask","bpmn:SendTask"])||QS(l,["bpmn:ErrorEventDefinition","bpmn:EscalationEventDefinition","bpmn:MessageEventDefinition","bpmn:SignalEventDefinition"])}function a(l){var p=e.getDefinitions(),f=p.get("rootElements");return!!Ge(f,Br({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"),at(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");rt(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",ZS,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)})}Sl.$inject=["bpmnjs","eventBus","injector","moddleCopy","bpmnFactory"],Q(Sl,W);function QS(e,t){return le(t)||(t=[t]),Ci(t,function(n){return Ur(e,n)})}var bm=Math.max;function xm(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]=eR(a,i,r)),y(a,"bpmn:Lane")&&(o[s]=At(a)?xl:El),y(a,"bpmn:SubProcess")&&Se(a)&&(o[s]=pm),y(a,"bpmn:TextAnnotation")&&(o[s]=fm),y(a,"bpmn:Group")&&(o[s]=GS)}),o})}xm.$inject=["eventBus"];function JS(e){return e==="x"}function eR(e,t,n){var i=At(e);if(!iR(e))return i?Ss:Rs;var r=JS(t),o={};return r?i?o=Ss:o={width:nR(e,n,r),height:Rs.height}:i?o={width:Ss.width,height:tR(e,n,r)}:o=Rs,o}function tR(e,t,n){var i;return i=rR(e,t,n),bm(Ss.height,i)}function nR(e,t,n){var i;return i=oR(e,t,n),bm(Rs.width,i)}function iR(e){return!!zi(e).length}function rR(e,t,n){var i=zi(e),r;return r=Rl(i,t,n),e.height-r.height+xl.height}function oR(e,t,n){var i=zi(e),r;return r=Rl(i,t,n),e.width-r.width+El.width}function Rl(e,t,n){var i,r,o;for(i=0;i<e.length;i++)if(r=e[i],!n&&t>=r.y&&t<=r.y+r.height||n&&t>=r.x&&t<=r.x+r.width)return o=zi(r),o.length?Rl(o,t,n):r}var Em="_plane";function wm(e){var t=e.id;return aR(t)}function Zn(e){var t=e.id;return y(e,"bpmn:SubProcess")?Sm(t):t}function Er(e){return Sm(e)}function Ps(e){var t=Me(e);return y(t,"bpmndi:BPMNPlane")}function Sm(e){return e+Em}function aR(e){return e.replace(new RegExp(Em+"$"),"")}var Rm=400,sR=600,Cm={x:180,y:160};function hi(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")&&!Se(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(Zn(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(Zn(d));if(!(!h||!d.children||!d.children.length)){var m=Pm(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")||!Se(f)||T(Lo([f]),d=>{n.removeShape(d.annotation)})},!0),this.preExecuted("shape.delete",function(p){var f=p.shape;if(c(f)){var d=a.get(Zn(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(Zn(f)))},!0),this.postExecuted("shape.replace",function(p){var f=p.newShape,d=p.oldRoot,h=e.findRoot(Zn(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(Ps(f)){a.updateId(f,Er(g)),a.updateId(m,g);return}var w=a.get(Er(m));w&&a.updateId(Er(m),Er(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(Ps(f)){a.updateId(f,Er(m)),a.updateId(g,m);return}var w=a.get(Er(g));w&&a.updateId(w,Er(m))}}},!0),t.on("element.changed",function(p){var f=p.element;if(Ps(f)){var d=f,h=a.get(wm(d));!h||h===d||t.fire("element.changed",{element:h})}}),this.executed("shape.toggleCollapse",Rm,function(p){var f=p.shape;y(f,"bpmn:SubProcess")&&(Se(f)?l(p):(u(p),s._showRecursively(f.children)))},!0),this.reverted("shape.toggleCollapse",Rm,function(p){var f=p.shape;y(f,"bpmn:SubProcess")&&(Se(f)?l(p):(u(p),s._showRecursively(f.children)))},!0),this.postExecuted("shape.toggleCollapse",sR,function(p){var f=p.shape;if(y(f,"bpmn:SubProcess")){var d=p.newRootElement;if(d)if(Se(f))s._moveChildrenToShape(d.children.slice(),f),T(Lo(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=Pm(f);s._moveChildrenToShape(h,d)}}},!0),t.on("copyPaste.createTree",function(p){var f=p.element,d=p.children;if(c(f)){var h=Zn(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=wm(m),E=Ge(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(hi,W),hi.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=ut(i),o;if(!t.x)o={x:Cm.x-r.x,y:Cm.y-r.y};else{var a=pe(t),s=pe(r);o={x:a.x-s.x,y:a.y-s.y}}n.moveElements(e,o,t,{autoResize:!1})}},hi.prototype._disconnectSharedAnnotations=function(e){var t=this._modeling,n=new Set(vh(e).map(i=>i.annotation));n.size&&T(Lo(e.children),i=>{n.has(i.annotation)&&T(i.associations,r=>{t.removeConnection(r)})})},hi.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},hi.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},hi.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:Zn(e),type:e.$type,di:i,businessObject:e,collapsed:!0});return o},hi.prototype._removeDiagram=function(e){var t=this._bpmnjs,n=t.getDefinitions().diagrams,i=Ge(n,function(r){return r.plane.bpmnElement.id===e.id});return n.splice(n.indexOf(i),1),i},hi.$inject=["canvas","eventBus","modeling","elementFactory","bpmnFactory","bpmnjs","elementRegistry"];function cR(e){var t=[];return T(Lo(e),n=>{t.push(n.annotation),t.push.apply(t,n.associations)}),t}function Pm(e){return e.children.slice().concat(cR(e.children)).concat(uR(e))}function uR(e){return Mu(e.children||[]).reduce(function(t,n){return n.label&&n.label.parent!==e&&t.push(n.label),t},[])}function Cl(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"))||!Se(r))){var o=lR(r);t.createShape({type:"bpmn:StartEvent"},o,r)}})}Cl.$inject=["injector","modeling"],Q(Cl,W);function lR(e){return{x:e.x+e.width/6,y:e.y+e.height/2}}function Pl(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,vn(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(Pl,W),Pl.$inject=["eventBus","textRenderer"];function Al(e,t){W.call(this,e),this.postExecuted("shape.toggleCollapse",1500,function(n){var i=n.shape;if(Se(i))return;var r=To(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,pe(i)):t.reconnectStart(a,i,pe(i)))}},!0)}Q(Al,W),Al.$inject=["eventBus","modeling"];var Tl=500;function Ml(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=pR(c).concat([a]),p=Lh(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"],Tl,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"],Tl,function(a){var s=a.context,c=s.shape;c.collapsed?Me(c).isExpanded=!1:Me(c).isExpanded=!0}),this.postExecuted(["shape.toggleCollapse"],Tl,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(Ml,W),Ml.$inject=["eventBus","elementFactory","modeling"];function pR(e){return e.filter(function(t){return!t.hidden})}function kl(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")&&Se(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(kl,W),kl.$inject=["canvas","injector","moddle","modeling"];function Dl(e,t){W.call(this,e),this.preExecute("connection.delete",function(n){var i=n.context,r=i.connection,o=r.source;fR(r,o)&&t.updateProperties(o,{default:null})})}Q(Dl,W),Dl.$inject=["eventBus","modeling"];function fR(e,t){if(!y(e,"bpmn:SequenceFlow"))return!1;var n=U(t),i=U(e);return n.get("default")===i}var dR=500,hR=5e3,Am=["shape.create","shape.delete","shape.move","shape.resize"],Tm=[...Am,"spaceTool","lane.add","lane.resize","lane.split","elements.create","elements.delete","elements.move"];function Ol(e,t){W.call(this,e);var n;function i(){return n=n||new mR,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(Tm,hR,function(){i()}),this.postExecuted(Tm,dR,function(){o()}),this.preExecute(Am,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))})}Ol.$inject=["eventBus","modeling"],Q(Ol,W);function mR(){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 gR=500,vR=5e3,Mm=["connection.create","connection.delete","connection.layout","connection.move","connection.reconnect","connection.updateWaypoints","shape.create","shape.delete","shape.move","shape.resize"],km=[...Mm,"elements.create","elements.delete","elements.move","label.create","spaceTool"];function Il(e,t){W.call(this,e);var n;function i(){return n=n||new yR,n.enter(),n}function r(){if(!n)throw new Error("out of bounds release");return n}function o(){if(!n)throw new Error("out of bounds release");var a=n.leave();return a&&(t.updateCategoryValueRefs(Array.from(n.affectedFlowElements),Array.from(n.affectedGroupEntries.values())),n=null),a}this.preExecute(km,vR,function(){i()}),this.postExecuted(km,gR,function(){o()}),this.preExecute(Mm,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)})}Il.$inject=["eventBus","modeling"],Q(Il,W);function yR(){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 Ll(e,t){W.call(this,e),this.postExecuted("elements.create",function(n){const i=n.context,r=i.elements;for(const o of r)_R(o)&&!xR(o)&&t.updateProperties(o,{isForCompensation:void 0})})}Q(Ll,W),Ll.$inject=["eventBus","modeling"];function _R(e){const t=U(e);return t&&t.isForCompensation}function bR(e){return e&&y(e,"bpmn:BoundaryEvent")&&Ur(e,"bpmn:CompensateEventDefinition")}function xR(e){return e.incoming.filter(n=>bR(n.source)).length>0}const ER={__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",Vu],appendBehavior:["type",Gu],associationBehavior:["type",Uu],attachEventBehavior:["type",cs],artifactBehavior:["type",Wu],boundaryEventBehavior:["type",qu],categoryRootElementReferenceBehavior:["type",Yu],compensateBoundaryEventBehaviour:["type",Ku],createBehavior:["type",Xu],createDataObjectBehavior:["type",Zu],createParticipantBehavior:["type",el],dataInputAssociationBehavior:["type",tl],dataStoreBehavior:["type",nl],deleteLaneBehavior:["type",il],detachEventBehavior:["type",gs],dropOnFlowBehavior:["type",ol],eventBasedGatewayBehavior:["type",al],fixHoverBehavior:["type",zh],groupBehavior:["type",sl],importDockingFix:["type",Gh],isHorizontalFix:["type",ul],labelBehavior:["type",pl],layoutConnectionBehavior:["type",fl],messageFlowBehavior:["type",ml],nonInterruptingBehavior:["type",gl],removeElementBehavior:["type",yl],removeEmbeddedLabelBoundsBehavior:["type",vl],removeParticipantBehavior:["type",_l],replaceConnectionBehavior:["type",bl],replaceElementBehaviour:["type",ws],resizeBehavior:["type",dm],resizeLaneBehavior:["type",_m],rootElementReferenceBehavior:["type",Sl],spaceToolBehavior:["type",xm],subProcessPlaneBehavior:["type",hi],subProcessStartEventBehavior:["type",Cl],textAnnotationBehavior:["type",Pl],toggleCollapseConnectionBehaviour:["type",Al],toggleElementCollapseBehaviour:["type",Ml],unclaimIdBehavior:["type",kl],unsetDefaultFlowBehavior:["type",Dl],updateFlowNodeRefsBehavior:["type",Ol],updateCategoryValueRefsBehavior:["type",Il],setCompensationActivityAfterPasteBehavior:["type",Ll]};function Nl(e){this._commandStack=e.get("commandStack",!1)}Nl.$inject=["injector"],Nl.prototype.allowed=function(e,t){var n=!0,i=this._commandStack;return i&&(n=i.canExecute(e,t)),n===void 0?!0:n};const Qn={__init__:["rules"],rules:["type",Nl]};function Rn(e){W.call(this,e),this.init()}Rn.$inject=["eventBus"],Q(Rn,W),Rn.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)})},Rn.prototype.init=function(){};function Dm(e,t){var n=Dt(e,t,-15);return n!=="intersect"?n:null}function It(e){Rn.call(this,e)}Q(It,Rn),It.$inject=["eventBus"],It.prototype.init=function(){this.addRule("connection.start",function(e){var t=e.source;return wR(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 Ts(t,n)}finally{r&&(n.parent=null)}}),this.addRule("connection.reconnect",function(e){var t=e.connection,n=e.source,i=e.target;return Ts(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 Wm(t,n,i)}),this.addRule("elements.create",function(e){var t=e.elements,n=e.position,i=e.target;return He(i)&&!Ms(t,i)?!1:ur(t,function(r){return He(r)?Ts(r.source,r.target,r):r.host?Uo(r,r.host,null,n):Fl(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 jm(a)&&!n.includes(a.host)})?!1:Uo(n,t,null,i)||Vm(n,t,i)||Gm(n,t)||Ms(n,t)}),this.addRule("shape.create",function(e){return Fl(e.shape,e.target,e.source,e.position)}),this.addRule("shape.attach",function(e){return Uo(e.shape,e.target,null,e.position)}),this.addRule("element.copy",function(e){var t=e.element,n=e.elements;return Xm(n,t)})},It.prototype.canConnectMessageFlow=Ym,It.prototype.canConnectSequenceFlow=Km,It.prototype.canConnectDataAssociation=Hl,It.prototype.canConnectAssociation=Um,It.prototype.canConnectCompensationAssociation=qm,It.prototype.canMove=Gm,It.prototype.canAttach=Uo,It.prototype.canReplace=Vm,It.prototype.canDrop=no,It.prototype.canInsert=Ms,It.prototype.canCreate=Fl,It.prototype.canConnect=Ts,It.prototype.canResize=Wm,It.prototype.canCopy=Xm;function wR(e){return Bl(e)?null:xe(e,["bpmn:FlowNode","bpmn:InteractionNode","bpmn:DataObjectReference","bpmn:DataStoreReference","bpmn:Group","bpmn:TextAnnotation"])}function Bl(e){return!e||_e(e)}function Om(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 $l(e){return y(e,"bpmn:TextAnnotation")}function jl(e){return y(e,"bpmn:Group")&&!e.labelTarget}function Im(e){return y(e,"bpmn:BoundaryEvent")&&Jn(e,"bpmn:CompensateEventDefinition")}function As(e){return U(e).isForCompensation}function SR(e,t){var n=Om(e),i=Om(t);return n===i}function RR(e){return y(e,"bpmn:InteractionNode")&&!y(e,"bpmn:BoundaryEvent")&&(!y(e,"bpmn:Event")||y(e,"bpmn:ThrowEvent")&&Bm(e,"bpmn:MessageEventDefinition"))}function CR(e){return y(e,"bpmn:InteractionNode")&&!As(e)&&(!y(e,"bpmn:Event")||y(e,"bpmn:CatchEvent")&&Bm(e,"bpmn:MessageEventDefinition"))&&!(y(e,"bpmn:BoundaryEvent")&&!Jn(e,"bpmn:MessageEventDefinition"))}function Lm(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 Nm(e,t){var n=Lm(e),i=Lm(t);return n===i}function Jn(e,t){var n=U(e);return!!Ge(n.eventDefinitions||[],function(i){return y(i,t)})}function Bm(e,t){var n=U(e);return(n.eventDefinitions||[]).every(function(i){return y(i,t)})}function PR(e){return y(e,"bpmn:FlowNode")&&!y(e,"bpmn:EndEvent")&&!Gt(e)&&!(y(e,"bpmn:IntermediateThrowEvent")&&Jn(e,"bpmn:LinkEventDefinition"))&&!Im(e)&&!As(e)}function AR(e){return y(e,"bpmn:FlowNode")&&!y(e,"bpmn:StartEvent")&&!y(e,"bpmn:BoundaryEvent")&&!Gt(e)&&!(y(e,"bpmn:IntermediateCatchEvent")&&Jn(e,"bpmn:LinkEventDefinition"))&&!As(e)}function TR(e){return y(e,"bpmn:ReceiveTask")||y(e,"bpmn:IntermediateCatchEvent")&&(Jn(e,"bpmn:MessageEventDefinition")||Jn(e,"bpmn:TimerEventDefinition")||Jn(e,"bpmn:ConditionalEventDefinition")||Jn(e,"bpmn:SignalEventDefinition"))}function MR(e){for(var t=[];e;)e=e.parent,e&&t.push(e);return t}function $m(e,t){var n=MR(t);return n.indexOf(e)!==-1}function Ts(e,t,n){if(Bl(e)||Bl(t))return null;if(!y(n,"bpmn:DataAssociation")){if(Ym(e,t))return{type:"bpmn:MessageFlow"};if(Km(e,t))return{type:"bpmn:SequenceFlow"}}var i=Hl(e,t);return i||(qm(e,t)?{type:"bpmn:Association",associationDirection:"One"}:Um(e,t)?{type:"bpmn:Association",associationDirection:"None"}:!1)}function no(e,t){return _e(e)||jl(e)?!0:y(t,"bpmn:Participant")&&!Se(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")&&!kR(e)?!1:y(e,"bpmn:FlowElement")&&!y(e,"bpmn:DataStoreReference")?y(t,"bpmn:FlowElementsContainer")?Se(t):xe(t,["bpmn:Participant","bpmn:Lane"]):y(e,"bpmn:DataStoreReference")&&y(t,"bpmn:Collaboration")?Ci(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 kR(e){return U(e).cancelActivity&&(Fm(e)||Hm(e))}function jm(e){return!_e(e)&&y(e,"bpmn:BoundaryEvent")}function DR(e){return y(e,"bpmn:Lane")}function OR(e){return jm(e)||y(e,"bpmn:IntermediateThrowEvent")&&Fm(e)?!0:y(e,"bpmn:IntermediateCatchEvent")&&Hm(e)}function Fm(e){var t=U(e);return t&&!(t.eventDefinitions&&t.eventDefinitions.length)}function Hm(e){return zm(e,["bpmn:MessageEventDefinition","bpmn:TimerEventDefinition","bpmn:SignalEventDefinition","bpmn:ConditionalEventDefinition"])}function zm(e,t){return t.some(function(n){return Jn(e,n)})}function IR(e){return y(e,"bpmn:ReceiveTask")&&Ge(e.incoming,function(t){return y(t.source,"bpmn:EventBasedGateway")})}function Uo(e,t,n,i){if(Array.isArray(e)||(e=[e]),e.length!==1)return!1;var r=e[0];return _e(r)||!OR(r)||Gt(t)||!y(t,"bpmn:Activity")||As(t)||i&&!Dm(i,t)||IR(t)?!1:"attach"}function Vm(e,t,n){if(!t)return!1;var i={replacements:[]};return T(e,function(r){Gt(t)||y(r,"bpmn:StartEvent")&&r.type!=="label"&&no(r,t)&&(Vw(r)||i.replacements.push({oldElementId:r.id,newElementType:"bpmn:StartEvent"}),(Gw(r)||Ww(r)||Uw(r))&&i.replacements.push({oldElementId:r.id,newElementType:"bpmn:StartEvent"}),zm(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")||Jn(r,"bpmn:CancelEventDefinition")&&r.type!=="label"&&(y(r,"bpmn:EndEvent")&&no(r,t)&&i.replacements.push({oldElementId:r.id,newElementType:"bpmn:EndEvent"}),y(r,"bpmn:BoundaryEvent")&&Uo(r,t,null,n)&&i.replacements.push({oldElementId:r.id,newElementType:"bpmn:BoundaryEvent"}))}),i.replacements.length?i:!1}function Gm(e,t){return Ci(e,DR)?!1:t===void 0?!0:t===null?!1:e.every(function(n){return no(n,t)})}function Fl(e,t,n,i){return t?_e(e)||jl(e)?!0:no(e,t)||Ms(e,t):!1}function Wm(e,t,n){return y(e,"bpmn:SubProcess")?Se(e)&&(!t||t.width>=100&&t.height>=80):y(e,"bpmn:Lane")||y(e,"bpmn:Participant")?!0:$l(e)?n?n==="e"||n==="w":!0:jl(e)?!0:_e(e)?n?n==="e"||n==="w":!0:!1}function LR(e,t){var n=$l(e),i=$l(t);return(n||i)&&n!==i}function Um(e,t){return $m(t,e)||$m(e,t)?!1:LR(e,t)?!0:!!Hl(e,t)}function qm(e,t){return Nm(e,t)&&Im(e)&&y(t,"bpmn:Activity")&&!BR(t,e)&&!Gt(t)}function Ym(e,t){return Qm(e)&&!Qm(t)?!1:RR(e)&&CR(t)&&!SR(e,t)}function Km(e,t){return PR(e)&&AR(t)&&Nm(e,t)&&!(y(e,"bpmn:EventBasedGateway")&&!TR(t))}function Hl(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 Ms(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")&&no(e,t.parent)}function zl(e,t){return e&&t&&e.indexOf(t)!==-1}function Xm(e,t){return _e(t)?!0:!(y(t,"bpmn:Lane")&&!zl(e,t.parent)||y(t,"bpmn:MessageFlow")&&!NR(e,t))}function NR(e,t){var n=Zm(t.source),i=Zm(t.target);return zl(e,n)&&zl(e,i)}function Zm(e){for(;e;e=e.parent)if(y(e,"bpmn:Participant"))return e;return null}function Qm(e){return Kr(e,"bpmn:Process")||Kr(e,"bpmn:Collaboration")}function BR(e,t){return e.attachers.includes(t)}const $R={__depends__:[Qn],__init__:["bpmnRules"],bpmnRules:["type",It]};var jR=2e3;function Jm(e,t){e.on("saveXML.start",jR,n);function n(){var i=t.getRootElements();T(i,function(r){var o=Me(r),a,s;a=To([r]),a=Ee(a,function(c){return c!==r&&!c.labelTarget}),s=jt(a,Me),o.set("planeElement",s)})}}Jm.$inject=["eventBus","canvas"];const FR={__init__:["bpmnDiOrdering"],bpmnDiOrdering:["type",Jm]};function ks(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)})}ks.prototype.getOrdering=function(e,t){return null},Q(ks,W);function Vl(e,t){ks.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=Ge(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=yf(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}}}Vl.$inject=["eventBus","canvas"],Q(Vl,ks);const HR={__init__:["bpmnOrderingProvider"],bpmnOrderingProvider:["type",Vl]};function qo(){}qo.prototype.get=function(){return this._data},qo.prototype.set=function(e){this._data=e},qo.prototype.clear=function(){var e=this._data;return delete this._data,e},qo.prototype.isEmpty=function(){return!this._data};const zR={clipboard:["type",qo]};var eg=1500;function tg(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",eg,function(s){o(s)})}),(function(){var a,s;t.on("element.hover",function(c){a=c.gfx,s=c.element}),t.on("element.hover",eg,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=xr(a),c=document.elementFromPoint(s.x,s.y),VR(c)}}tg.$inject=["elementRegistry","eventBus","injector"];function VR(e){return mr(e,"svg, .djs-element",!0)}const GR={__init__:["hoverFix"],hoverFix:["type",tg]};function WR(e){return!0}function Ds(e){return Gi(e)||XS(e)}var ng=500;function ig(e,t,n){var i=this;function r(P,$,j){if(!s(P,$)){var L,F,ie;j?F=t.getGraphics(j):(L=$.delegateTarget||$.target,L&&(F=L,j=t.get(F))),!(!F||!j)&&(ie=e.fire(P,{element:j,gfx:F,originalEvent:$}),ie===!1&&($.stopPropagation(),$.preventDefault()))}}var o={};function a(P){return o[P]}function s(P,$){var j=u[P]||Gi;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":WR,"element.mousedown":Ds,"element.mouseup":Ds,"element.click":Ds,"element.dblclick":Ds};function l(P,$,j){var L=c[P];if(!L)throw new Error("unmapped DOM event name <"+P+">");return r(L,$,j)}var p="svg, .djs-element";function f(P,$,j,L){var F=o[j]=function(ie){r(j,ie)};L&&(u[j]=L),F.$delegate=rn.bind(P,p,$,F)}function d(P,$,j){var L=a(j);L&&rn.unbind(P,$,L.$delegate)}function h(P){T(c,function($,j){f(P,j,$)})}function m(P){T(c,function($,j){d(P,j,$)})}e.on("canvas.destroy",function(P){m(P.svg)}),e.on("canvas.init",function(P){h(P.svg)}),e.on(["shape.added","connection.added"],function(P){var $=P.element,j=P.gfx;e.fire("interactionEvents.createHit",{element:$,gfx:j})}),e.on(["shape.changed","connection.changed"],ng,function(P){var $=P.element,j=P.gfx;e.fire("interactionEvents.updateHit",{element:$,gfx:j})}),e.on("interactionEvents.createHit",ng,function(P){var $=P.element,j=P.gfx;i.createDefaultHit($,j)}),e.on("interactionEvents.updateHit",function(P){var $=P.element,j=P.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(P,$){return $=D({stroke:"white",strokeWidth:15},$||{}),n.cls(P,["no-fill","no-border"],$)}function A(P,$){var j=x[$];if(!j)throw new Error("invalid hit type <"+$+">");return J(P,j),P}function I(P,$){ge(P,$)}this.removeHits=function(P){var $=Va(".djs-hit",P);T($,bt)},this.createDefaultHit=function(P,$){var j=P.waypoints,L=P.isFrame,F;return j?this.createWaypointsHit($,j):(F=L?"stroke":"all",this.createBoxHit($,F,{width:P.width,height:P.height}))},this.createWaypointsHit=function(P,$){var j=Ao($);return A(j,"stroke"),I(P,j),j},this.createBoxHit=function(P,$,j){j=D({x:0,y:0},j);var L=ae("rect");return A(L,$),J(L,j),I(P,L),L},this.updateDefaultHit=function(P,$){var j=je(".djs-hit",$);if(j)return P.waypoints?Tu(j,P.waypoints):J(j,{width:P.width,height:P.height}),j},this.fire=r,this.triggerMouseEvent=l,this.mouseHandler=a,this.registerEvent=f,this.unregisterEvent=d}ig.$inject=["eventBus","elementRegistry","styles"];const Os={__init__:["interactionEvents"],interactionEvents:["type",ig]};function io(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)})}io.$inject=["eventBus","canvas"],io.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()})}},io.prototype.get=function(){return Array.from(this._selectedElements)},io.prototype.isSelected=function(e){return this._selectedElements.has(e)},io.prototype.select=function(e,t){var n=this.get();le(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 rg="hover",og="selected";function ag(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,rg)}),t.on("element.out",function(r){i(r.element,rg)}),t.on("selection.changed",function(r){function o(u){i(u,og)}function a(u){n(u,og)}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)})}ag.$inject=["canvas","eventBus"];function sg(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;le(u)?t.select(u):t.select(s.filter(UR))}}),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=Ge(o,function(c){return a.id===c.id});s||t.select(a)}),e.on("element.click",function(r){if(Gi(r)){var o=r.element;o===n.getRootElement()&&(o=null);var a=t.isSelected(o),s=t.get().length>1,c=Cs(r);if(a&&s)return c?t.deselect(o):t.select(o);a?t.deselect(o):t.select(o,c)}})}sg.$inject=["eventBus","selection","canvas","elementRegistry"];function UR(e){return!e.hidden}const Cn={__init__:["selectionVisuals","selectionBehavior"],__depends__:[Os],selection:["type",io],selectionVisuals:["type",ag],selectionBehavior:["type",sg]};var qR=/^djs-cursor-.*$/;function Is(e){var t=Xe(document.body);t.removeMatching(qR),e&&t.add("djs-cursor-"+e)}function cg(){Is(null)}var YR=5e3;function ug(e,t){t=t||"element.click";function n(){return!1}return e.once(t,YR,n),function(){e.off(t,n)}}var KR=["c","C"],XR=["v","V"],ZR=["d","D"],QR=["x","X"],JR=["y","Y"],lg=["z","Z"];function eC(e){return e.ctrlKey||e.metaKey||e.shiftKey||e.altKey}function sn(e){return e.altKey?!1:e.ctrlKey||e.metaKey}function xt(e,t){return e=le(e)?e:[e],e.indexOf(t.key)!==-1||e.indexOf(t.code)!==-1}function Gl(e){return e.shiftKey}function tC(e){return sn(e)&&xt(KR,e)}function nC(e){return sn(e)&&xt(XR,e)}function iC(e){return sn(e)&&xt(ZR,e)}function rC(e){return sn(e)&&xt(QR,e)}function oC(e){return sn(e)&&!Gl(e)&&xt(lg,e)}function aC(e){return sn(e)&&(xt(JR,e)||xt(lg,e)&&Gl(e))}var ro=Math.round,pg="djs-drag-active";function wr(e){e.preventDefault()}function sC(e){return typeof TouchEvent<"u"&&e instanceof TouchEvent}function cC(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}function fg(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(D({},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,P=xr(b),$=Nn(P,I),j=o.localStart,L=a(P),F=Nn(L,j);if(!o.active&&(x||cC($)>o.threshold)){if(D(S,{x:ro(j.x+A.x),y:ro(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&&Is(o.cursor),t.addMarker(t.getRootElement(),pg)}wl(b),o.active&&(D(S,{x:ro(L.x+A.x),y:ro(L.y+A.y),dx:ro(F.x),dy:ro(F.y)},{originalEvent:b}),s("move"))}function l(b){var x,S=!0;o.active&&(b&&(o.payload.originalEvent=b,wl(b)),S=s("end")),S===!1&&s("rejected"),x=w(S!==!0),s("ended",x)}function p(b){xt("Escape",b)&&(wr(b),g())}function f(b){var x;o.active&&(x=ug(e),setTimeout(x,400),wr(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"),cg(),o.trapClick?S=f:S=l,he.unbind(document,"mousemove",u),he.unbind(document,"dragstart",wr),he.unbind(document,"selectstart",wr),he.unbind(document,"mousedown",S,!0),he.unbind(document,"mouseup",S,!0),he.unbind(document,"keyup",p),he.unbind(document,"touchstart",d,!0),he.unbind(document,"touchcancel",g,!0),he.unbind(document,"touchmove",u,!0),he.unbind(document,"touchend",l,!0),e.off("element.hover",h),e.off("element.out",m),t.removeMarker(t.getRootElement(),pg);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=D({},r,A||{});var I=A.data||{},P,$,j,L,F;if(A.trapClick?L=f:L=l,b?(P=to(b)||b,$=xr(b),wl(b),P.type==="dragstart"&&wr(P)):(P=null,$={x:0,y:0}),j=a($),x||(x=j),F=sC(P),o=D({prefix:S,data:I,payload:{},globalStart:$,displacement:Nn(x,j),localStart:j,isTouch:F},A),A.manual||(F?(he.bind(document,"touchstart",d,!0),he.bind(document,"touchcancel",g,!0),he.bind(document,"touchmove",u,!0),he.bind(document,"touchend",l,!0)):(he.bind(document,"mousemove",u),he.bind(document,"dragstart",wr),he.bind(document,"selectstart",wr),he.bind(document,"mousedown",L,!0),he.bind(document,"mouseup",L,!0)),he.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){D(r,b)}}fg.$inject=["eventBus","canvas","selection","elementRegistry"];const mi={__depends__:[GR,Cn],dragging:["type",fg]};function oo(e){this._counter=0,this._prefix=(e?e+"-":"")+Math.floor(Math.random()*1e9)+"-"}oo.prototype.next=function(){return this._prefix+ ++this._counter};const uC=new oo("ps");var lC=["marker-start","marker-mid","marker-end"],pC=["circle","ellipse","line","path","polygon","polyline","path","rect"];function Wi(e,t,n,i){this._elementRegistry=e,this._canvas=n,this._styles=i}Wi.$inject=["elementRegistry","eventBus","canvas","styles"],Wi.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")},Wi.prototype.getGfx=function(e){return this._elementRegistry.getGraphics(e)},Wi.prototype.addDragger=function(e,t,n,i="djs-dragger"){n=n||this.getGfx(e);var r=Rd(n);return this._cloneMarkers(yr(r),i),J(r,this._styles.cls(i,[])),ge(t,r),J(r,"data-preview-support-element-id",e.id),r},Wi.prototype.addFrame=function(e,t){var n=ae("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},Wi.prototype._cloneMarkers=function(e,t="djs-dragger",n=e){var i=this;e.childNodes&&e.childNodes.forEach(r=>{i._cloneMarkers(r,t,n)}),mC(e)&&lC.forEach(function(r){if(J(e,r)){var o=fC(e,r,i._canvas.getContainer());o&&i._cloneMarker(n,e,o,r,t)}})},Wi.prototype._cloneMarker=function(e,t,n,i,r="djs-dragger"){var o=[n.id,r,uC.next()].join("-"),a=je("marker#"+n.id,e);e=e||this._canvas._svg;var s=a||Rd(n);s.id=o,Ce(s).add(r);var c=je(":scope > defs",e);c||(c=ae("defs"),ge(e,c)),ge(c,s);var u=hC(s.id);J(t,i,u)};function fC(e,t,n){var i=dC(J(e,t));return je("marker#"+i,n||document)}function dC(e){return e.match(/url\(['"]?#([^'"]*)['"]?\)/)[1]}function hC(e){return"url(#"+e+")"}function mC(e){return pC.indexOf(e.nodeName)!==-1}const ao={__init__:["previewSupport"],previewSupport:["type",Wi]};var gC="drop-ok",dg="drop-not-ok",hg="attach-ok",mg="new-parent",gg="create",vC=2e3;function vg(e,t,n,i,r){function o(c,u,l,p,f){if(!u)return!1;c=Ee(c,function(E){var b=E.labelTarget;return!E.parent&&!(_e(E)&&c.indexOf(b)!==-1)});var d=Ge(c,function(E){return!He(E)}),h=!1,m=!1,g=!1;_g(c)&&(h=r.allowed("shape.attach",{position:l,shape:d,target:u})),h||(_g(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){[hg,gC,dg,mg].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}yg(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,hg):a(p,m?mg:dg))}),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;yg(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,D({},w,{attach:m})),p=Ge(f,function(b){return!He(b)})),D(u,{elements:f,shape:p}),D(c,{elements:f,shape:p})});function s(){var c=t.context();c&&c.prefix===gg&&t.cancel()}n.on("create.init",function(){n.on("elements.changed",s),n.once(["create.cancel","create.end"],vC,function(){n.off("elements.changed",s)})}),this.start=function(c,u,l){le(u)||(u=[u]);var p=Ge(u,function(h){return!He(h)});if(p){l=D({elements:u,hints:{},shape:p},l||{}),T(u,function(h){de(h.x)||(h.x=0),de(h.y)||(h.y=0)});var f=Ee(u,function(h){return!h.hidden}),d=ut(f);T(u,function(h){He(h)&&(h.waypoints=jt(h.waypoints,function(m){return{x:m.x-d.x-d.width/2,y:m.y-d.y-d.height/2}})),D(h,{x:h.x-d.x-d.width/2,y:h.y-d.y-d.height/2})}),t.init(c,gg,{cursor:"grabbing",autoActivate:!0,data:{shape:p,elements:u,context:l}})}}}vg.$inject=["canvas","dragging","eventBus","modeling","rules"];function yg(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 _g(e){return e&&e.length===1&&!He(e[0])}var yC=750;function bg(e,t,n,i,r){function o(a){var s=ae("g");J(s,r.cls("djs-drag-group",["no-events"]));var c=ae("g");return a.forEach(function(u){var l;u.hidden||(u.waypoints?(l=n._createContainer("connection",c),n.drawConnection(yr(l),u)):(l=n._createContainer("shape",c),n.drawShape(yr(l),u),Ot(l,u.x,u.y)),i.addDragger(u,s,l))}),s}t.on("create.move",yC,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)),Ot(l,a.x,a.y)):bt(l)}),t.on("create.cleanup",function(a){var s=a.context,c=s.dragGroup;c&&bt(c)})}bg.$inject=["canvas","eventBus","graphicsFactory","previewSupport","styles"];const Ls={__depends__:[mi,ao,Qn,Cn],__init__:["create","createPreview"],create:["type",vg],createPreview:["type",bg]};function Wl(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)})}Wl.$inject=["eventBus"],Wl.prototype.getLastMoveEvent=function(){return this._lastMoveEvent||_C(0,0)};function _C(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 Yo={__init__:["mouse"],mouse:["type",Wl]};var xg=2e3;function cn(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),bC(l)&&(u.priority=2,u.host=l.host.id),He(l)&&(u.priority=3,u.source=l.source.id,u.target=l.target.id,u.waypoints=xC(l)),_e(l)&&(u.priority=4,u.labelTarget=l.labelTarget.id),T(["x","y","width","height"],function(f){de(l[f])&&(u[f]=l[f])}),u.hidden=l.hidden,u.collapsed=l.collapsed}),r.on("copyPaste.elementsCopied",xg,function(c){var u;((u=c.hints)==null?void 0:u.clip)!==!1&&n.set(c.tree)}),r.on("copyPaste.pasteElements",xg,function(c){c.tree||(c.tree=n.get())}),r.on("copyPaste.pasteElements",function(c){var u=c.hints;D(u,{createElementsBehavior:!1})})}cn.$inject=["canvas","create","clipboard","elementFactory","eventBus","modeling","mouse","rules"],cn.prototype.copy=function(e,t={}){var n,i;return le(e)||(e=e?[e]:[]),n=this._eventBus.fire("copyPaste.canCopyElements",{elements:e}),n===!1?i={}:i=this.createTree(le(n)?n:e),this._eventBus.fire("copyPaste.elementsCopied",{elements:e,tree:i,hints:t}),i},cn.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})}}},cn.prototype.duplicate=function(e,t={}){var n=this.copy(e,{clip:!1});return this.paste({...t,tree:n})},cn.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},cn.prototype._getElementIdsFromTree=function(e){var t={};return T(e,function(n){T(n,function(i){i.id&&(t[i.id]=!0)})}),t},cn.prototype._paste=function(e,t,n,i){T(e,function(o){de(o.x)||(o.x=0),de(o.y)||(o.y=0)});var r=ut(e);return T(e,function(o){He(o)&&(o.waypoints=jt(o.waypoints,function(a){return{x:a.x-r.x-r.width/2,y:a.y-r.y-r.height/2}})),D(o,{x:o.x-r.x-r.width/2,y:o.y-r.y-r.height/2})}),this._modeling.createElements(e,n,t,D({},i))},cn.prototype._createElements=function(e){var t=this,n=this._eventBus,i={},r=[];return T(e,function(o,a){o=Hn(o,"priority"),T(o,function(s){var c=D({},zn(s,["priority"]));i[s.parent]?c.parent=i[s.parent]:delete c.parent,n.fire("copyPaste.pasteElement",{cache:i,descriptor:c});var u;if(He(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},cn.prototype.createConnection=function(e){var t=this._elementFactory.createConnection(zn(e,["id"]));return t},cn.prototype.createLabel=function(e){var t=this._elementFactory.createLabel(zn(e,["id"]));return t},cn.prototype.createShape=function(e){var t=this._elementFactory.createShape(zn(e,["id"]));return t},cn.prototype.hasRelations=function(e,t,n){return n||(n=new Set(t)),!(He(e)&&(!n.has(e.source)||!n.has(e.target))||_e(e)&&!n.has(e.labelTarget))},cn.prototype.createTree=function(e){var t=this._rules,n=this,i={},r=[],o=new Map,a=qa(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}vr(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=jt(r,function(p){return p.element});var l=new Set(e);return r=jt(r,function(p){return p.descriptor={},n._eventBus.fire("copyPaste.copyElement",{descriptor:p.descriptor,element:p.element,elements:e,elementsSet:l}),p}),r=Hn(r,function(p){return p.descriptor.priority}),e=jt(r,function(p){return p.element}),T(r,function(p){var f=p.depth;if(!n.hasRelations(p.element,e,l)){wg(p.element,e),l.delete(p.element);return}if(!s(p.element,e)){wg(p.element,e),l.delete(p.element);return}i[f]||(i[f]=[]),i[f].push(p.descriptor)}),i};function bC(e){return!!e.host}function xC(e){return jt(e.waypoints,function(t){return t=Eg(t),t.original&&(t.original=Eg(t.original)),t})}function Eg(e){return D({},e)}function wg(e,t){var n=t.indexOf(e);return n===-1?t:t.splice(n,1)}const EC={__depends__:[zR,Ls,Yo,Qn],__init__:["copyPaste"],copyPaste:["type",cn]};function Ul(e,t,n){le(n)||(n=[n]),T(n,function(i){cr(e[i])||(t[i]=e[i])})}var ql=750;function Sg(e,t,n){function i(c,u){var l=e.create(c.$type);return n.copyElement(c,l,null,u)}t.on("copyPaste.copyElement",ql,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,Ul(f,u,"name"),Ul(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])),zn(l,nn(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,Ul(l,p,["isExpanded","name"]),l.type=p.$type}),t.on("copyPaste.copyElement",ql,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(Lo(l),p=>{l.push(p.annotation)})}),t.on("copyPaste.pasteElement",ql,function(c){var u=c.cache,l=c.descriptor;a(u,s(l,u,o(u)))})}Sg.$inject=["bpmnFactory","eventBus","moddleCopy"];const wC=["artifacts","dataInputAssociations","dataOutputAssociations","default","flowElements","lanes","incoming","outgoing","categoryValue"],SC=["errorRef","escalationRef","messageRef","signalRef","dataObjectRef"];function Ko(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 Hn(r,o=>o==="extensionElements")}),e.on("moddleCopy.canCopyProperty",i=>{const{parent:r,property:o,propertyName:a}=i,s=Rt(r)&&r.$descriptor;if(a&&SC.includes(a))return o;if(a&&wC.includes(a)||a&&s&&!Ge(s.properties,Br({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})}Ko.$inject=["eventBus","bpmnFactory","moddle"],Ko.prototype.copyElement=function(e,t,n,i=!1){n&&!le(n)&&(n=[n]),n=n||Yl(e.$descriptor);const r=this._eventBus.fire("moddleCopy.canCopyProperties",{propertyNames:n,sourceElement:e,targetElement:t,clone:i});return r===!1||(le(r)&&(n=r),T(n,o=>{let a;tn(e,o)&&(a=e.get(o));const s=this.copyProperty(a,t,o,i);!yt(s)||this._eventBus.fire("moddleCopy.canSetCopiedProperty",{parent:t,property:s,propertyName:o})===!1||t.set(o,s)})),t},Ko.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 Rt(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):le(e)?nn(e,(a,s)=>{const c=this.copyProperty(s,t,n,i);return c?a.concat(c):a},[]):Rt(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},Ko.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 Yl(e,t){return nn(e.properties,(n,i)=>t&&i.default?n:n.concat(i.name),[])}const Rg={__depends__:[EC],__init__:["bpmnCopyPaste","moddleCopy"],bpmnCopyPaste:["type",Sg],moddleCopy:["type",Ko]};var Cg=Math.round;function Kl(e,t){this._modeling=e,this._eventBus=t}Kl.$inject=["modeling","eventBus"],Kl.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=Cg(s+o/2),l=Cg(c+a/2),p=i.replaceShape(e,D({},t,{x:u,y:l,width:o,height:a}),n);return r.fire("replace.end",{element:e,newElement:p,hints:n}),p};function Pg(e,t){t.on("replace.end",500,function(n){const{newElement:i,hints:r={}}=n;r.select!==!1&&e.select(i)})}Pg.$inject=["selection","eventBus"];const RC={__init__:["replace","replaceSelectionBehavior"],replaceSelectionBehavior:["type",Pg],replace:["type",Kl]};function CC(e,t,n){le(n)||(n=[n]),T(n,function(i){cr(e[i])||(t[i]=e[i])})}var PC=["cancelActivity","instantiate","eventGatewayType","triggeredByEvent","isInterrupting"];function AC(e,t){var n=e&&tn(e,"collapsed")?e.collapsed:!Se(e),i;return t&&(tn(t,"collapsed")||tn(t,"isExpanded"))?i=tn(t,"collapsed")?t.collapsed:!t.isExpanded:i=n,n!==i}function Ag(e,t,n,i,r,o){function a(s,c,u){u=u||{};var l=c.type,p=s.businessObject;if(Ns(p)&&(l==="bpmn:SubProcess"||l==="bpmn:AdHocSubProcess")&&AC(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),CC(s.di,d.di,["fill","stroke","background-color","border-color","color"]);var h=Yl(p.$descriptor),m=Yl(f.$descriptor,!0),g=TC(h,m);D(f,In(c,PC));var w=Ee(g,function(x){return x==="eventDefinitions"?Tg(s,c.eventDefinitionType):x==="loopCharacteristics"?!Gt(f):tn(f,x)||x==="processRef"&&c.isExpanded===!1||x==="triggeredByEvent"?!1:x==="isForCompensation"?!Gt(f):!0});if(f=n.copyElement(p,f,w),c.eventDefinitionType&&(Tg(f,c.eventDefinitionType)||(d.eventDefinitionType=c.eventDefinitionType,d.eventDefinitionAttrs=c.eventDefinitionAttrs)),y(p,"bpmn:Activity")){if(Ns(p))d.isExpanded=Se(s);else if(c&&tn(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}Se(s)&&!y(p,"bpmn:Task")&&d.isExpanded&&(d.width=s.width,d.height=s.height)}if(Ns(p)&&!Ns(f)&&(u.moveChildren=!1),y(p,"bpmn:Participant")){c.isExpanded===!0?f.processRef=e.create("bpmn:Process"):u.moveChildren=!1;var b=At(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}Ag.$inject=["bpmnFactory","elementFactory","moddleCopy","modeling","replace","rules"];function Ns(e){return y(e,"bpmn:SubProcess")}function Tg(e,t){var n=U(e);return t&&n.get("eventDefinitions").some(function(i){return y(i,t)})}function TC(e,t){return e.filter(function(n){return t.includes(n)})}const Mg={__depends__:[Rg,RC,Cn],bpmnReplace:["type",Ag]};var MC=250;function Sr(e){this._eventBus=e,this._tools=[],this._active=null}Sr.$inject=["eventBus"],Sr.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)},Sr.prototype.isActive=function(e){return e&&this._active===e},Sr.prototype.length=function(e){return this._tools.length},Sr.prototype.setActive=function(e){var t=this._eventBus;this._active!==e&&(this._active=e,t.fire("tool-manager.update",{tool:e}))},Sr.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,MC,function(r){this._active&&(kC(r)||this.setActive(null))},this)};function kC(e){var t=e.originalEvent&&e.originalEvent.target;return t&&mr(t,'.group[data-group="tools"]')}const Bs={__depends__:[mi],__init__:["toolManager"],toolManager:["type",Sr]};function DC(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 OC(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 IC(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 Xl=Math.abs,LC=Math.round,gi={x:"width",y:"height"},kg="crosshair",Ui={n:"top",w:"left",s:"bottom",e:"right"},NC=1500,$s={n:"s",w:"e",s:"n",e:"w"},js=20;function Pn(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",NC,function(c){var u=c.context,l=u.initialized;l||(l=u.initialized=s.init(c,u)),l&&Og(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){Og(c);var m={x:0,y:0};m[l]=LC(c["d"+l]),s.makeSpace(f,d,m,p,h),n.once("spaceTool.ended",function(g){s.activateSelection(g.originalEvent,!0,!0)})}})}Pn.$inject=["canvas","dragging","eventBus","modeling","rules","toolManager","mouse"],Pn.prototype.activateSelection=function(e,t,n){this._dragging.init(e,"spaceTool.selection",{autoActivate:t,cursor:kg,data:{context:{reactivate:n}},trapClick:!1})},Pn.prototype.activateMakeSpace=function(e){this._dragging.init(e,"spaceTool",{autoActivate:!0,cursor:kg,data:{context:{}}})},Pn.prototype.makeSpace=function(e,t,n,i,r){return this._modeling.createSpace(e,t,n,i,r)},Pn.prototype.init=function(e,t){var n=Xl(e.dx)>Xl(e.dy)?"x":"y",i=e["d"+n],r=e[n]-i;if(Xl(i)<5)return!1;i<0&&(i*=-1),Wo(e)&&(i*=-1);var o=DC(n,i),a=this._canvas.getRootElement();!Cs(e)&&e.hover&&(a=e.hover);var s=[...To(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=BC(c,n,o,r,u);return D(t,c,{axis:n,direction:o,spaceToolConstraints:l,start:r}),Is("resize-"+(n==="x"?"ew":"ns")),!0},Pn.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(He(d)){l.push(d);return}var h=d[t],m=h+d[gi[t]];if($C(d)&&(n>0&&pe(d)[t]>i||n<0&&pe(d)[t]<i)){u.push(d);return}if(n>0&&h>i||n<0&&m<i){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}},Pn.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateSelection(e,!!e)},Pn.prototype.isActive=function(){var e=this._dragging.context();return e?/^spaceTool/.test(e.prefix):!1};function Dg(e){return{top:e.top-js,right:e.right+js,bottom:e.bottom+js,left:e.left-js}}function Og(e){var t=e.context,n=t.spaceToolConstraints;if(n){var i,r;de(n.left)&&(i=Math.max(e.x,n.left),e.dx=e.dx+i-e.x,e.x=i),de(n.right)&&(i=Math.min(e.x,n.right),e.dx=e.dx+i-e.x,e.x=i),de(n.top)&&(r=Math.max(e.y,n.top),e.dy=e.dy+r-e.y,e.y=r),de(n.bottom)&&(r=Math.min(e.y,n.bottom),e.dy=e.dy+r-e.y,e.y=r)}}function BC(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=ue(f),g=Ee(h,function(F){return!He(F)&&!_e(F)&&!l.has(F)&&!p.has(F)}),w=Ee(h,function(F){return!He(F)&&!_e(F)&&l.has(F)}),E,b,x,S=[],A=[],I,P,$,j;g.length&&(b=Dg(ue(ut(g))),E=i-m[Ui[n]]+b[Ui[n]],n==="n"?s.bottom=u=de(u)?Math.min(u,E):E:n==="w"?s.right=u=de(u)?Math.min(u,E):E:n==="s"?s.top=c=de(c)?Math.max(c,E):E:n==="e"&&(s.left=c=de(c)?Math.max(c,E):E)),w.length&&(x=Dg(ue(ut(w))),E=i-x[Ui[$s[n]]]+m[Ui[$s[n]]],n==="n"?s.bottom=u=de(u)?Math.min(u,E):E:n==="w"?s.right=u=de(u)?Math.min(u,E):E:n==="s"?s.top=c=de(c)?Math.max(c,E):E:n==="e"&&(s.left=c=de(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=ue(ut(S.map(pe))),P=m[Ui[$s[n]]]-(I[Ui[$s[n]]]-i)),A.length&&($=ue(ut(A.map(pe))),j=$[Ui[n]]-(m[Ui[n]]-i)),n==="n"?(E=Math.min(P||1/0,j||1/0),s.bottom=u=de(u)?Math.min(u,E):E):n==="w"?(E=Math.min(P||1/0,j||1/0),s.right=u=de(u)?Math.min(u,E):E):n==="s"?(E=Math.max(P||-1/0,j||-1/0),s.top=c=de(c)?Math.max(c,E):E):n==="e"&&(E=Math.max(P||-1/0,j||-1/0),s.left=c=de(c)?Math.max(c,E):E));var L=r&&r[f.id];L&&(n==="n"?(E=i+f[gi[t]]-L[gi[t]],s.bottom=u=de(u)?Math.min(u,E):E):n==="w"?(E=i+f[gi[t]]-L[gi[t]],s.right=u=de(u)?Math.min(u,E):E):n==="s"?(E=i-f[gi[t]]+L[gi[t]],s.top=c=de(c)?Math.max(c,E):E):n==="e"&&(E=i-f[gi[t]]+L[gi[t]],s.left=c=de(c)?Math.max(c,E):E))}),s}}function $C(e){return!!e.host}var Zl="djs-dragging",Ig="djs-resizing",jC=250,Fs=Math.max;function Lg(e,t,n,i,r){function o(a,s){T(a,function(c){r.addDragger(c,s),n.addMarker(c,Zl)})}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=ae("g");J(l,i.cls("djs-crosshair-group",["no-events"])),ge(s,l);var p=ae("path");J(p,"d",u.x),Ce(p).add("djs-crosshair"),ge(l,p);var f=ae("path");J(f,"d",u.y),Ce(f).add("djs-crosshair"),ge(l,f),c.crosshairGroup=l}),e.on("spaceTool.selection.move",function(a){var s=a.context.crosshairGroup;Ot(s,a.x,a.y)}),e.on("spaceTool.selection.cleanup",function(a){var s=a.context,c=s.crosshairGroup;c&&bt(c)}),e.on("spaceTool.move",jC,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=ae("path"),J(c,"d","M0,0 L0,0"),Ce(c).add("djs-crosshair"),ge(f,c),s.line=c;var d=ae("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)||!He(I)||!h.has(I.target)||(m.add(I),g.push(I))})}),o(g,d),s.dragGroup=d}if(!s.frameGroup){var w=ae("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),P=I.getBBox();E.push({element:I,initialBounds:P}),n.addMarker(A,Ig)}),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,Ot(s.dragGroup,S.x,S.y),T(s.frames,function(A){var I=A.element,P=A.initialBounds,$,j;s.direction==="e"?J(I,{width:Fs(P.width+S.x,5)}):($=Fs(P.width-S.x,5),J(I,{width:$,x:P.x+P.width-$})),s.direction==="s"?J(I,{height:Fs(P.height+S.y,5)}):(j=Fs(P.height-S.y,5),J(I,{height:j,y:P.y+P.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,Zl)}),T(u,function(h){n.removeMarker(h,Zl)}),f&&(bt(p),bt(f)),T(l,function(h){n.removeMarker(h,Ig)}),d&&bt(d)})}Lg.$inject=["eventBus","elementRegistry","canvas","styles","previewSupport"];const FC={__init__:["spaceToolPreview"],__depends__:[mi,Qn,Bs,ao,Yo],spaceTool:["type",Pn],spaceToolPreview:["type",Lg]};function Hs(e,t){e.invoke(Pn,this),this._canvas=t}Hs.$inject=["injector","canvas"],Q(Hs,Pn),Hs.prototype.calculateAdjustments=function(e,t,n,i){var r=this._canvas.getRootElement(),o=e[0]===r?null:e[0],a=[];o&&(a=Lr(zr(r.children.filter(u=>y(u,"bpmn:Artifact")),ut(o))));const s=[...e,...a];var c=Pn.prototype.calculateAdjustments.call(this,s,t,n,i);return c.resizingShapes=c.resizingShapes.filter(function(u){return!(y(u,"bpmn:TextAnnotation")||HC(u)&&(t==="y"&&At(u)||t==="x"&&!At(u)))}),c};function HC(e){return y(e,"bpmn:Participant")&&!U(e).processRef}const Ng={__depends__:[FC],spaceTool:["type",Hs]};function Je(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)}Je.$inject=["eventBus","injector"],Je.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()},Je.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},Je.prototype.clear=function(e){this._stack.length=0,this._stackIdx=-1,e!==!1&&this._fire("changed",{trigger:"clear"})},Je.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()}},Je.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()}},Je.prototype.register=function(e,t){this._setHandler(e,t)},Je.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)},Je.prototype.canUndo=function(){return!!this._getUndoAction()},Je.prototype.canRedo=function(){return!!this._getRedoAction()},Je.prototype._getRedoAction=function(){return this._stack[this._stackIdx+1]},Je.prototype._getUndoAction=function(){return this._stack[this._stackIdx]},Je.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)})},Je.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},Je.prototype._createId=function(){return this._uid++},Je.prototype._atomicDo=function(e){const t=this._currentExecution;t.atomic=!0;try{e()}finally{t.atomic=!1}},Je.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()},Je.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)},Je.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:_f("id",i.reverse())}),i.length=0,this._fire("changed",{trigger:t}),e.trigger=null)},Je.prototype._markDirty=function(e){const t=this._currentExecution;e&&(e=le(e)?e:[e],t.dirty=t.dirty.concat(e))},Je.prototype._executedAction=function(e,t){const n=++this._stackIdx;t||this._stack.splice(n,this._stack.length,e)},Je.prototype._revertedAction=function(e){this._stackIdx--},Je.prototype._getHandler=function(e){return this._handlerMap[e]},Je.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 zC={commandStack:["type",Je]};function qi(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 VC=250,Bg=1400;function Ql(e,t,n){W.call(this,t);var i=e.get("movePreview",!1);t.on("shape.move.start",Bg,function(r){var o=r.context,a=o.shapes,s=o.validatedShapes;o.shapes=$g(a),o.validatedShapes=$g(s)}),i&&t.on("shape.move.start",VC,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",Bg,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;qi(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=ku(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&&(at(s.labels,a,c),a.labelTarget=s)})}Q(Ql,W),Ql.$inject=["injector","eventBus","modeling"];function $g(e){var t=new Set(e);return Ee(e,function(n){return!t.has(n.labelTarget)})}const GC={__init__:["labelSupport"],labelSupport:["type",Ql]};var WC=251,jg=1401,Fg="attach-ok";function Jl(e,t,n,i,r){W.call(this,t);var o=e.get("movePreview",!1);t.on("shape.move.start",jg,function(a){var s=a.context,c=s.shapes,u=s.validatedShapes;s.shapes=UC(c),s.validatedShapes=qC(u)}),o&&t.on("shape.move.start",WC,function(a){var s=a.context,c=s.shapes,u=ep(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,Fg),t.once(["shape.move.out","shape.move.cleanup"],function(){n.removeMarker(l,Fg)}))}}),this.preExecuted("elements.move",jg,function(a){var s=a.context,c=s.closure,u=s.shapes,l=ep(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=Ee(c,function(p){var f=p.host;return YC(p)&&!KC(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;qi(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=rm(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=rm(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;qi(s.attachers,function(c){r.removeShape(c)}),s.host&&r.updateAttachment(s,null)})}Q(Jl,W),Jl.$inject=["injector","eventBus","canvas","rules","modeling"];function ep(e){return Xc(jt(e,function(t){return t.attachers||[]}))}function UC(e){var t=ep(e);return Ub("id",e,t)}function qC(e){var t=Nr(e,"id");return Ee(e,function(n){for(;n;){if(n.host&&t[n.host.id])return!1;n=n.parent}return!0})}function YC(e){return!!e.host}function KC(e,t){return e.indexOf(t)!==-1}const XC={__depends__:[Qn],__init__:["attachSupport"],attachSupport:["type",Jl]};function Hg(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(Od(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)})}Hg.$inject=["eventBus","canvas","elementRegistry","graphicsFactory"];const tp={__init__:["changeSupport"],changeSupport:["type",Hg]};function An(e){this._model=e}An.$inject=["moddle"],An.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"])},An.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))},An.prototype.create=function(e,t){var n=this._model.create(e,t||{});return this._ensureId(n),n},An.prototype.createDiLabel=function(){return this.create("bpmndi:BPMNLabel",{bounds:this.createDiBounds()})},An.prototype.createDiShape=function(e,t){return this.create("bpmndi:BPMNShape",D({bpmnElement:e,bounds:this.createDiBounds()},t))},An.prototype.createDiBounds=function(e){return this.create("dc:Bounds",e)},An.prototype.createDiWaypoints=function(e){var t=this;return jt(e,function(n){return t.createDiWaypoint(n)})},An.prototype.createDiWaypoint=function(e){return this.create("dc:Point",In(e,["x","y"]))},An.prototype.createDiEdge=function(e,t){return this.create("bpmndi:BPMNEdge",D({bpmnElement:e,waypoint:this.createDiWaypoints([])},t))},An.prototype.createDiPlane=function(e,t){return this.create("bpmndi:BPMNPlane",D({bpmnElement:e},t))};function un(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"],ln(o)),this.reverted(["shape.move","shape.create","shape.delete","connection.create","connection.move","connection.delete"],ln(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"],ln(function(d){d.context.shape.type!=="label"&&c(d)})),this.reverted(["shape.move","shape.create","shape.resize"],ln(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"],ln(u)),this.reverted(["connection.create","connection.move","connection.delete","connection.reconnect"],ln(u));function l(d){i.updateConnectionWaypoints(d.context.connection)}this.executed(["connection.layout","connection.move","connection.updateWaypoints"],ln(l)),this.reverted(["connection.layout","connection.move","connection.updateWaypoints"],ln(l)),this.executed("connection.reconnect",ln(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",ln(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"],ln(p)),this.reverted(["element.updateAttachment"],ln(p)),this.executed("element.updateLabel",ln(f)),this.reverted("element.updateLabel",ln(f));function f(d){const{element:h}=d.context,m=vn(h),g=Me(h),w=g&&g.get("label");Fi(h)||Ps(h)||(m&&!w?g.set("label",t.create("bpmndi:BPMNLabel")):!m&&w&&g.set("label",void 0))}}Q(un,W),un.$inject=["eventBus","bpmnFactory","connectionDocking"],un.prototype.updateAttachment=function(e){var t=e.shape,n=t.businessObject,i=t.host;n.attachedToRef=i&&i.businessObject},un.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)}},un.prototype.updateBounds=function(e){var t=Me(e),n=QC(e);if(n){var i=Nn(n,t.get("bounds"));D(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)),D(o,{x:e.x,y:e.y,width:e.width,height:e.height})},un.prototype.updateFlowNodeRefs=function(e,t,n){if(n!==t){var i,r;y(n,"bpmn:Lane")&&(i=n.get("flowNodeRef"),rt(i,e)),y(t,"bpmn:Lane")&&(r=t.get("flowNodeRef"),at(r,e))}},un.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)},un.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):(rt(n,e),e.$parent=null)}};function ZC(e){for(;e&&!y(e,"bpmn:Definitions");)e=e.$parent;return e}un.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)},un.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=ZC(e.$parent||t),e.$parent&&(rt(o.get("rootElements"),r),r.$parent=null),t&&(at(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),rt(a,e)),t?(a=t.get(i),a.push(e),e.$parent=t):e.$parent=null,n){var s=n.get(i);rt(a,e),t&&(s||(s=[],t.set(i,s)),s.push(e))}}},un.prototype.updateConnectionWaypoints=function(e){var t=Me(e);t.set("waypoint",this._bpmnFactory.createDiWaypoints(e.waypoints))},un.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&&(rt(n.sourceRef&&n.sourceRef.get("outgoing"),n),r&&r.get("outgoing")&&r.get("outgoing").push(n)),n.sourceRef=r),n.targetRef!==a&&(c&&(rt(n.targetRef&&n.targetRef.get("incoming"),n),a&&a.get("incoming")&&a.get("incoming").push(n)),n.targetRef=a)}this.updateConnectionWaypoints(t),this.updateDiConnection(t,i,o)},un.prototype._getLabel=function(e){return e.label||(e.label=this._bpmnFactory.createDiLabel()),e.label};function ln(e){return function(t){var n=t.context,i=n.shape||n.connection||n.element;y(i,"bpmn:BaseElement")&&e(t)}}function QC(e){if(y(e,"bpmn:Activity")){var t=Me(e);if(t){var n=t.get("label");if(n)return n.get("bounds")}}}function Yi(e,t){pi.call(this),this._bpmnFactory=e,this._moddle=t}Q(Yi,pi),Yi.$inject=["bpmnFactory","moddle"],Yi.prototype._baseCreate=pi.prototype.create,Yi.prototype.create=function(e,t){if(e==="label"){var n=t.di||this._bpmnFactory.createDiLabel();return this._baseCreate(e,D({type:"label",di:n},_r,t))}return this.createElement(e,t)},Yi.prototype.createElement=function(e,t){t=D({},t||{});var n,i=t.businessObject,r=t.di;if(!i){if(!t.type)throw new Error("no shape type specified");i=this._bpmnFactory.create(t.type)}if(!eP(r)){var o=D({},r||{},{id:i.id+"_di"});e==="root"?r=this._bpmnFactory.createDiPlane(i,o):e==="connection"?r=this._bpmnFactory.createDiEdge(i,o):r=this._bpmnFactory.createDiShape(i,o)}y(i,"bpmn:Group")&&(t=D({isFrame:!0},t)),t=JC(i,t,["processRef","isInterrupting","associationDirection","isForCompensation"]),t.isExpanded&&(t=np(r,t,"isExpanded")),xe(i,["bpmn:Lane","bpmn:Participant"])&&(t=np(r,t,"isHorizontal")),y(i,"bpmn:SubProcess")&&(t.collapsed=!Se(i,r)),y(i,"bpmn:ExclusiveGateway")&&(tn(r,"isMarkerVisible")?r.isMarkerVisible===void 0&&(r.isMarkerVisible=!1):r.isMarkerVisible=!0),yt(t.triggeredByEvent)&&(i.triggeredByEvent=t.triggeredByEvent,delete t.triggeredByEvent),yt(t.cancelActivity)&&(i.cancelActivity=t.cancelActivity,delete t.cancelActivity);var a,s;return t.eventDefinitionType&&(a=i.get("eventDefinitions")||[],s=this._bpmnFactory.create(t.eventDefinitionType,t.eventDefinitionAttrs),t.eventDefinitionType==="bpmn:ConditionalEventDefinition"&&(s.condition=this._bpmnFactory.create("bpmn:FormalExpression")),a.push(s),s.$parent=i,i.eventDefinitions=a,delete t.eventDefinitionType),n=this.getDefaultSize(i,r),t=D({id:i.id},n,t,{businessObject:i,di:r}),this._baseCreate(e,t)},Yi.prototype.getDefaultSize=function(e,t){var n=U(e);if(t=t||Me(e),y(n,"bpmn:SubProcess"))return Se(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 Se(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}},Yi.prototype.createParticipantShape=function(e){return Rt(e)||(e={isExpanded:e}),e=D({type:"bpmn:Participant"},e||{}),e.isExpanded!==!1&&(e.processRef=this._bpmnFactory.create("bpmn:Process")),this.createShape(e)};function JC(e,t,n){return T(n,function(i){t=np(e,t,i)}),t}function np(e,t,n){return t[n]===void 0?t:(e[n]=t[n],zn(t,[n]))}function eP(e){return xe(e,["bpmndi:BPMNShape","bpmndi:BPMNEdge","bpmndi:BPMNDiagram","bpmndi:BPMNPlane"])}function zs(e,t){this._modeling=e,this._canvas=t}zs.$inject=["modeling","canvas"],zs.prototype.preExecute=function(e){var t=this._modeling,n=e.elements,i=e.alignment;T(n,function(r){var o={x:0,y:0};yt(i.left)?o.x=i.left-r.x:yt(i.right)?o.x=i.right-r.width-r.x:yt(i.center)?o.x=i.center-Math.round(r.width/2)-r.x:yt(i.top)?o.y=i.top-r.y:yt(i.bottom)?o.y=i.bottom-r.height-r.y:yt(i.middle)&&(o.y=i.middle-Math.round(r.height/2)-r.y),t.moveElements([r],o,r.parent)})},zs.prototype.postExecute=function(e){};function Vs(e){this._modeling=e}Vs.$inject=["modeling"],Vs.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},Vs.prototype.postExecute=function(e){var t=e.hints||{};tP(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 tP(e,t){return Ci(e.outgoing,function(n){return n.target===t})}function Gs(e,t){this._canvas=e,this._layouter=t}Gs.$inject=["canvas","layouter"],Gs.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},Gs.prototype.revert=function(e){var t=e.connection;return this._canvas.removeConnection(t),t.source=null,t.target=null,t};var Ws=Math.round;function ip(e){this._modeling=e}ip.$inject=["modeling"],ip.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){de(p.x)||(p.x=0),de(p.y)||(p.y=0)});var s=Ee(t,function(p){return!p.hidden}),c=ut(s);T(t,function(p){He(p)&&(p.waypoints=jt(p.waypoints,function(f){return{x:Ws(f.x-c.x-c.width/2+r.x),y:Ws(f.y-c.y-c.height/2+r.y)}})),D(p,{x:Ws(p.x-c.x-c.width/2+r.x),y:Ws(p.y-c.y-c.height/2+r.y)})});var u=new Set(qa(t)),l={};T(t,function(p){if(He(p)){l[p.id]=de(i)?a.createConnection(l[p.source.id],l[p.target.id],i,p,p.parent||n,o):a.createConnection(l[p.source.id],l[p.target.id],p,p.parent||n,o);return}var f=D({},o);u.has(p)||(f.autoResize=!1),_e(p)&&(f=zn(f,["attach"])),l[p.id]=de(i)?a.createShape(p,In(p,["x","y","width","height"]),p.parent||n,i,f):a.createShape(p,In(p,["x","y","width","height"]),p.parent||n,f)}),e.elements=Lr(l)};var zg=Math.round;function Ki(e){this._canvas=e}Ki.$inject=["canvas"],Ki.prototype.execute=function(e){var t=e.shape,n=e.position,i=e.parent,r=e.parentIndex;if(!i)throw new Error("parent required");if(!n)throw new Error("position required");return n.width!==void 0?D(t,n):D(t,{x:n.x-zg(t.width/2),y:n.y-zg(t.height/2)}),this._canvas.addShape(t,i,r),t},Ki.prototype.revert=function(e){var t=e.shape;return this._canvas.removeShape(t),t};function Xo(e){Ki.call(this,e)}Q(Xo,Ki),Xo.$inject=["canvas"];var nP=Ki.prototype.execute;Xo.prototype.execute=function(e){var t=e.shape;return rP(t),t.labelTarget=e.labelTarget,nP.call(this,e)};var iP=Ki.prototype.revert;Xo.prototype.revert=function(e){return e.shape.labelTarget=null,iP.call(this,e)};function rP(e){["width","height"].forEach(function(t){typeof e[t]>"u"&&(e[t]=0)})}function Zo(e,t){this._canvas=e,this._modeling=t}Zo.$inject=["canvas","modeling"],Zo.prototype.preExecute=function(e){var t=this._modeling,n=e.connection;qi(n.incoming,function(i){t.removeConnection(i,{nested:!0})}),qi(n.outgoing,function(i){t.removeConnection(i,{nested:!0})})},Zo.prototype.execute=function(e){var t=e.connection,n=t.parent;return e.parent=n,e.parentIndex=ku(n.children,t),e.source=t.source,e.target=t.target,this._canvas.removeConnection(t),t.source=null,t.target=null,t},Zo.prototype.revert=function(e){var t=e.connection,n=e.parent,i=e.parentIndex;return t.source=e.source,t.target=e.target,at(n.children,t,i),this._canvas.addConnection(t,n),t};function rp(e,t){this._modeling=e,this._elementRegistry=t}rp.$inject=["modeling","elementRegistry"],rp.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 Qo(e,t){this._canvas=e,this._modeling=t}Qo.$inject=["canvas","modeling"],Qo.prototype.preExecute=function(e){var t=this._modeling,n=e.shape;qi(n.incoming,function(i){t.removeConnection(i,{nested:!0})}),qi(n.outgoing,function(i){t.removeConnection(i,{nested:!0})}),qi(n.children,function(i){He(i)?t.removeConnection(i,{nested:!0}):t.removeShape(i,{nested:!0})})},Qo.prototype.execute=function(e){var t=this._canvas,n=e.shape,i=n.parent;return e.oldParent=i,e.oldParentIndex=ku(i.children,n),t.removeShape(n),n},Qo.prototype.revert=function(e){var t=this._canvas,n=e.shape,i=e.oldParent,r=e.oldParentIndex;return at(i.children,n,r),t.addShape(n,i),n};function Us(e){this._modeling=e}Us.$inject=["modeling"];var Vg={x:"y",y:"x"};Us.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[Vg[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=Hn(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[Vg[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)}))})},Us.prototype.postExecute=function(e){};function qs(e,t){this._layouter=e,this._canvas=t}qs.$inject=["layouter","canvas"],qs.prototype.execute=function(e){var t=e.connection,n=t.waypoints;return D(e,{oldWaypoints:n}),t.waypoints=this._layouter.layoutConnection(t,e.hints),t},qs.prototype.revert=function(e){var t=e.connection;return t.waypoints=e.oldWaypoints,t};function op(){}op.prototype.execute=function(e){var t=e.connection,n=e.delta,i=e.newParent||t.parent,r=e.newParentIndex,o=t.parent;return e.oldParent=o,e.oldParentIndex=rt(o.children,t),at(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},op.prototype.revert=function(e){var t=e.connection,n=t.parent,i=e.oldParent,r=e.oldParentIndex,o=e.delta;return rt(n.children,t),at(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 ap(){this.allShapes={},this.allConnections={},this.enclosedElements={},this.enclosedConnections={},this.topLevel={}}ap.prototype.add=function(e,t){return this.addAll([e],t)},ap.prototype.addAll=function(e,t){var n=IE(e,!!t,this);return D(this,n),this};function Jo(e){this._modeling=e}Jo.prototype.moveRecursive=function(e,t,n){return e?this.moveClosure(this.getClosure(e),t,n):[]},Jo.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&&dl(p,p.source,t),connectionEnd:d&&hl(p,p.target,t)})})},Jo.prototype.getClosure=function(e){return new ap().addAll(e,!0)};function Ys(e){this._helper=new Jo(e)}Ys.$inject=["modeling"],Ys.prototype.preExecute=function(e){e.closure=this._helper.getClosure(e.shapes)},Ys.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 Rr(e){this._modeling=e,this._helper=new Jo(e)}Rr.$inject=["modeling"],Rr.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=In(t,["x","y","width","height"]),e.oldParent=o,e.oldParentIndex=rt(o.children,t),at(i.children,t,r),D(t,{parent:i,x:t.x+n.x,y:t.y+n.y}),t},Rr.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:hl(o,t,n)})}),T(t.outgoing,function(o){r.layoutConnection(o,{connectionStart:dl(o,t,n)})})),i.recurse!==!1&&this.moveChildren(e)},Rr.prototype.revert=function(e){var t=e.shape,n=e.oldParent,i=e.oldParentIndex,r=e.delta;return at(n.children,t,i),D(t,{parent:n,x:t.x-r.x,y:t.y-r.y}),t},Rr.prototype.moveChildren=function(e){var t=e.delta,n=e.shape;this._helper.moveRecursive(n.children,t,null)},Rr.prototype.getNewParent=function(e){return e.newParent||e.shape.parent};function ea(e){this._modeling=e}ea.$inject=["modeling"],ea.prototype.execute=function(e){var t=e.newSource,n=e.newTarget,i=e.connection,r=e.dockingOrPoints;if(!t&&!n)throw new Error("newSource or newTarget required");return le(r)&&(e.oldWaypoints=i.waypoints,i.waypoints=r),t&&(e.oldSource=i.source,i.source=t),n&&(e.oldTarget=i.target,i.target=n),i},ea.prototype.postExecute=function(e){var t=e.connection,n=e.newSource,i=e.newTarget,r=e.dockingOrPoints,o=e.hints||{},a={};o.connectionStart&&(a.connectionStart=o.connectionStart),o.connectionEnd&&(a.connectionEnd=o.connectionEnd),o.layoutConnection!==!1&&(n&&(!i||o.docking==="source")&&(a.connectionStart=a.connectionStart||Gg(le(r)?r[0]:r)),i&&(!n||o.docking==="target")&&(a.connectionEnd=a.connectionEnd||Gg(le(r)?r[r.length-1]:r)),o.newWaypoints&&(a.waypoints=o.newWaypoints),this._modeling.layoutConnection(t,a))},ea.prototype.revert=function(e){var t=e.oldSource,n=e.oldTarget,i=e.oldWaypoints,r=e.connection;return t&&(r.source=t),n&&(r.target=n),i&&(r.waypoints=i),r};function Gg(e){return e.original||e}function vi(e,t){this._modeling=e,this._rules=t}vi.$inject=["modeling","rules"],vi.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,xs(h,s,l),a)}),T(d,function(h){var m=h.target,g=c(s,m,h);g&&t.reconnectStart(h,s,bs(h,s,l),a)})},vi.prototype.postExecute=function(e){var t=e.oldShape;this._modeling.removeShape(t)},vi.prototype.execute=function(e){},vi.prototype.revert=function(e){},vi.prototype.createShape=function(e,t,n,i){return this._modeling.createShape(e,t,n,i)},vi.prototype.reconnectStart=function(e,t,n,i){this._modeling.reconnectStart(e,t,n,i)},vi.prototype.reconnectEnd=function(e,t,n,i){this._modeling.reconnectEnd(e,t,n,i)};function ta(e){this._modeling=e}ta.$inject=["modeling"],ta.prototype.execute=function(e){var t=e.shape,n=e.newBounds,i=e.minBounds;if(n.x===void 0||n.y===void 0||n.width===void 0||n.height===void 0)throw new Error("newBounds must have {x, y, width, height} properties");if(i&&(n.width<i.width||n.height<i.height))throw new Error("width and height cannot be less than minimum height and width");if(!i&&n.width<10||n.height<10)throw new Error("width and height cannot be less than 10px");return e.oldBounds={width:t.width,height:t.height,x:t.x,y:t.y},D(t,{width:n.width,height:n.height,x:n.x,y:n.y}),t},ta.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:xs(o,n,i)})}),T(n.outgoing,function(o){t.layoutConnection(o,{connectionStart:bs(o,n,i)})}))},ta.prototype.revert=function(e){var t=e.shape,n=e.oldBounds;return D(t,{width:n.width,height:n.height,x:n.x,y:n.y}),t};function Xi(e){this._modeling=e}Xi.$inject=["modeling"],Xi.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]=aP(s)}),this.resizeShapes(r,t,n),this.updateConnectionWaypoints(OC(i,r),t,n,o,i,r,a)},Xi.prototype.execute=function(){},Xi.prototype.revert=function(){},Xi.prototype.moveShapes=function(e,t){var n=this;T(e,function(i){n._modeling.moveShape(i,t,null,{autoResize:!1,layout:!1,recurse:!1})})},Xi.prototype.resizeShapes=function(e,t,n){var i=this;T(e,function(r){var o=IC(r,n,t);i._modeling.resizeShape(r,o,null,{attachSupport:!1,autoResize:!1,layout:!1})})},Xi.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=oP(l),h=Ug(n),m={},g=c.has(p)||u.has(p),w=c.has(f)||u.has(f);g&&w?(d=jt(d,function(E){return qg(E,i,n)&&(E[h]=E[h]+t[h]),E.original&&qg(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=dl(l,p,t):c.has(f)?m.connectionEnd=hl(l,f,t):u.has(p)?m.connectionStart=bs(l,p,a[p.id]):u.has(f)&&(m.connectionEnd=xs(l,f,a[f.id])),s._modeling.layoutConnection(l,m))})};function Wg(e){return D({},e)}function oP(e){return jt(e.waypoints,function(t){return t=Wg(t),t.original&&(t.original=Wg(t.original)),t})}function Ug(e){switch(e){case"n":return"y";case"w":return"x";case"s":return"y";case"e":return"x"}}function qg(e,t,n){var i=Ug(n);if(/e|s/.test(n))return e[i]>t;if(/n|w/.test(n))return e[i]<t}function aP(e){return{x:e.x,y:e.y,height:e.height,width:e.width}}function Ks(e){this._modeling=e}Ks.$inject=["modeling"],Ks.prototype.execute=function(e){var t=e.shape,n=t.children;e.oldChildrenVisibility=Yg(n),t.collapsed=!t.collapsed;var i=Kg(n,t.collapsed);return[t].concat(i)},Ks.prototype.revert=function(e){var t=e.shape,n=e.oldChildrenVisibility,i=t.children,r=Xg(i,n);return t.collapsed=!t.collapsed,[t].concat(r)};function Yg(e){var t={};return T(e,function(n){t[n.id]=n.hidden,n.children&&(t=D({},t,Yg(n.children)))}),t}function Kg(e,t){var n=[];return T(e,function(i){i.hidden=t,n=n.concat(i),i.children&&(n=n.concat(Kg(i.children,i.collapsed||t)))}),n}function Xg(e,t){var n=[];return T(e,function(i){i.hidden=t[i.id],n=n.concat(i),i.children&&(n=n.concat(Xg(i.children,t)))}),n}function Xs(e){this._modeling=e}Xs.$inject=["modeling"],Xs.prototype.execute=function(e){var t=e.shape,n=e.newHost,i=t.host;return e.oldHost=i,e.attacherIdx=Zg(i,t),Qg(n,t),t.host=n,t},Xs.prototype.revert=function(e){var t=e.shape,n=e.newHost,i=e.oldHost,r=e.attacherIdx;return t.host=i,Zg(n,t),Qg(i,t,r),t};function Zg(e,t){return rt(e&&e.attachers,t)}function Qg(e,t,n){if(e){var i=e.attachers;i||(e.attachers=i=[]),at(i,t,n)}}function sp(){}sp.prototype.execute=function(e){var t=e.connection,n=e.newWaypoints;return e.oldWaypoints=t.waypoints,t.waypoints=n,t},sp.prototype.revert=function(e){var t=e.connection,n=e.oldWaypoints;return t.waypoints=n,t};function ze(e,t,n){this._eventBus=e,this._elementFactory=t,this._commandStack=n;var i=this;e.on("diagram.init",function(){i.registerHandlers(n)})}ze.$inject=["eventBus","elementFactory","commandStack"],ze.prototype.getHandlers=function(){return{"shape.append":Vs,"shape.create":Ki,"shape.delete":Qo,"shape.move":Rr,"shape.resize":ta,"shape.replace":vi,"shape.toggleCollapse":Ks,spaceTool:Xi,"label.create":Xo,"connection.create":Gs,"connection.delete":Zo,"connection.move":op,"connection.layout":qs,"connection.updateWaypoints":sp,"connection.reconnect":ea,"elements.create":ip,"elements.move":Ys,"elements.delete":rp,"elements.distribute":Us,"elements.align":zs,"element.updateAttachment":Xs}},ze.prototype.registerHandlers=function(e){T(this.getHandlers(),function(t,n){e.registerHandler(n,t)})},ze.prototype.moveShape=function(e,t,n,i,r){typeof i=="object"&&(r=i,i=null);var o={shape:e,delta:t,newParent:n,newParentIndex:i,hints:r||{}};this._commandStack.execute("shape.move",o)},ze.prototype.updateAttachment=function(e,t){var n={shape:e,newHost:t};this._commandStack.execute("element.updateAttachment",n)},ze.prototype.moveElements=function(e,t,n,i){i=i||{};var r=i.attach,o=n,a;r===!0?(a=n,o=n.parent):r===!1&&(a=null);var s={shapes:e,delta:t,newParent:o,newHost:a,hints:i};this._commandStack.execute("elements.move",s)},ze.prototype.moveConnection=function(e,t,n,i,r){typeof i=="object"&&(r=i,i=void 0);var o={connection:e,delta:t,newParent:n,newParentIndex:i,hints:r||{}};this._commandStack.execute("connection.move",o)},ze.prototype.layoutConnection=function(e,t){var n={connection:e,hints:t||{}};this._commandStack.execute("connection.layout",n)},ze.prototype.createConnection=function(e,t,n,i,r,o){typeof n=="object"&&(o=r,r=i,i=n,n=void 0),i=this._create("connection",i);var a={source:e,target:t,parent:r,parentIndex:n,connection:i,hints:o};return this._commandStack.execute("connection.create",a),a.connection},ze.prototype.createShape=function(e,t,n,i,r){typeof i!="number"&&(r=i,i=void 0),r=r||{};var o=r.attach,a,s;e=this._create("shape",e),o?(a=n.parent,s=n):a=n;var c={position:t,shape:e,parent:a,parentIndex:i,host:s,hints:r};return this._commandStack.execute("shape.create",c),c.shape},ze.prototype.createElements=function(e,t,n,i,r){le(e)||(e=[e]),typeof i!="number"&&(r=i,i=void 0),r=r||{};var o={position:t,elements:e,parent:n,parentIndex:i,hints:r};return this._commandStack.execute("elements.create",o),o.elements},ze.prototype.createLabel=function(e,t,n,i){n=this._create("label",n);var r={labelTarget:e,position:t,parent:i||e.parent,shape:n};return this._commandStack.execute("label.create",r),r.shape},ze.prototype.appendShape=function(e,t,n,i,r){r=r||{},t=this._create("shape",t);var o={source:e,position:n,target:i,shape:t,connection:r.connection,connectionParent:r.connectionParent,hints:r};return this._commandStack.execute("shape.append",o),o.shape},ze.prototype.removeElements=function(e){var t={elements:e};this._commandStack.execute("elements.delete",t)},ze.prototype.distributeElements=function(e,t,n){var i={groups:e,axis:t,dimension:n};this._commandStack.execute("elements.distribute",i)},ze.prototype.removeShape=function(e,t){var n={shape:e,hints:t||{}};this._commandStack.execute("shape.delete",n)},ze.prototype.removeConnection=function(e,t){var n={connection:e,hints:t||{}};this._commandStack.execute("connection.delete",n)},ze.prototype.replaceShape=function(e,t,n){var i={oldShape:e,newData:t,hints:n||{}};return this._commandStack.execute("shape.replace",i),i.newShape},ze.prototype.alignElements=function(e,t){var n={elements:e,alignment:t};this._commandStack.execute("elements.align",n)},ze.prototype.resizeShape=function(e,t,n,i){var r={shape:e,newBounds:t,minBounds:n,hints:i};this._commandStack.execute("shape.resize",r)},ze.prototype.createSpace=function(e,t,n,i,r){var o={delta:n,direction:i,movingShapes:e,resizingShapes:t,start:r};this._commandStack.execute("spaceTool",o)},ze.prototype.updateWaypoints=function(e,t,n){var i={connection:e,newWaypoints:t,hints:n||{}};this._commandStack.execute("connection.updateWaypoints",i)},ze.prototype.reconnect=function(e,t,n,i,r){var o={connection:e,newSource:t,newTarget:n,dockingOrPoints:i,hints:r||{}};this._commandStack.execute("connection.reconnect",o)},ze.prototype.reconnectStart=function(e,t,n,i){i||(i={}),this.reconnect(e,t,e.target,n,D(i,{docking:"source"}))},ze.prototype.reconnectEnd=function(e,t,n,i){i||(i={}),this.reconnect(e,e.source,t,n,D(i,{docking:"target"}))},ze.prototype.connect=function(e,t,n,i){return this.createConnection(e,t,n||{},e.parent,i)},ze.prototype._create=function(e,t){return _w(t)?t:this._elementFactory.create(e,t)},ze.prototype.toggleCollapse=function(e,t){var n={shape:e,hints:t||{}};this._commandStack.execute("shape.toggleCollapse",n)};function na(e){this._elementRegistry=e}na.$inject=["elementRegistry"],na.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||sP(n,Aa(i));return Jg(n,i),e.oldProperties=o,e.changed=r,r},na.prototype.revert=function(e){var t=e.oldProperties,n=e.moddleElement,i=e.changed;return Jg(n,t),i},na.prototype._getVisualReferences=function(e){var t=this._elementRegistry;return y(e,"bpmn:DataObject")?cP(e,t):[]};function sP(e,t){return nn(t,function(n,i){return n[i]=e.get(i),n},{})}function Jg(e,t){T(t,function(n,i){e.set(i,n)})}function cP(e,t){return t.filter(function(n){return y(n,"bpmn:DataObjectReference")&&U(n).dataObjectRef===e})}var ia="default",yi="id",ev="di",uP={width:0,height:0};function ra(e,t,n,i){this._elementRegistry=e,this._moddle=t,this._modeling=n,this._textRenderer=i}ra.$inject=["elementRegistry","moddle","modeling","textRenderer"],ra.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=hP(e.properties),s=e.oldProperties||lP(t,a);return tv(a,o)&&(r.unclaim(o[yi]),i.updateId(t,a[yi]),r.claim(a[yi],o)),ia in a&&(a[ia]&&n.push(i.get(a[ia].id)),o[ia]&&n.push(i.get(o[ia].id))),nv(t,a),e.oldProperties=s,e.changed=n,n},ra.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,uP)}},ra.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 nv(t,i),tv(n,r)&&(a.unclaim(n[yi]),o.updateId(t,i[yi]),a.claim(i[yi],r)),e.changed};function tv(e,t){return yi in e&&e[yi]!==t[yi]}function lP(e,t){var n=Aa(t),i=e.businessObject,r=Me(e);return nn(n,function(o,a){return a!==ev?o[a]=i.get(a):o[a]=pP(r,Aa(t.di)),o},{})}function pP(e,t){return nn(t,function(n,i){return n[i]=e&&e.get(i),n},{})}function nv(e,t){var n=e.businessObject,i=Me(e);T(t,function(r,o){o!==ev?n.set(o,r):i&&fP(i,r)})}function fP(e,t){T(t,function(n,i){e.set(i,n)})}var dP=["default"];function hP(e){var t=D({},e);return dP.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),at(a.rootElements,i),i.$parent=a,rt(a.rootElements,o),o.$parent=null,r.di=null,s.bpmnElement=i,n.di=s,e.oldRoot=r,[]},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),rt(a.rootElements,i),i.$parent=null,at(a.rootElements,o),o.$parent=a,n.di=null,s.bpmnElement=o,r.di=s,[]};function cp(e,t){this._modeling=e,this._spaceTool=t}cp.$inject=["modeling","spaceTool"],cp.prototype.preExecute=function(e){var t=this._spaceTool,n=this._modeling,i=e.shape,r=e.location,o=Sn(i),a=o===i,s=a?i:i.parent,c=zi(s),u=At(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+wn,y:i.y,width:i.width-wn,height:i.height}:{x:i.x,y:i.y+wn,width:i.width,height:i.height-wn};n.createShape({type:"bpmn:Lane",isHorizontal:u},l,s)}var p=[];vr(o,function(x){return p.push(x),x.label&&p.push(x.label),x===i?[]:Ee(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?wn:0),y:d-(r==="top"?120:0),width:i.width-(a?wn:0),height:120}:{x:d-(r==="left"?120:0),y:i.y+(a?wn:0),width:120,height:i.height-(a?wn:0)};e.newLane=n.createShape({type:"bpmn:Lane",isHorizontal:u},b,s)};function up(e){this._modeling=e}up.$inject=["modeling"],up.prototype.preExecute=function(e){var t=this._modeling,n=e.shape,i=e.count,r=zi(n),o=r.length;if(o>i)throw new Error(`more than <${i}> child lanes`);var a=At(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+wn,y:n.y+f*c,width:n.width-wn,height:u}:{x:n.x+f*c,y:n.y+wn,width:u,height:n.height-wn},f<o?t.resizeShape(r[f],l):(p={type:"bpmn:Lane",isHorizontal:a},t.createShape(p,l,n))};function oa(e,t){this._modeling=e,this._spaceTool=t}oa.$inject=["modeling","spaceTool"],oa.prototype.preExecute=function(e){var t=e.shape,n=e.newBounds,i=e.balanced;i!==!1?this.resizeBalanced(t,n):this.resizeSpace(t,n)},oa.prototype.resizeBalanced=function(e,t){var n=this._modeling,i=cS(e,t);n.resizeShape(e,t),i.forEach(function(r){n.resizeShape(r.shape,r.newBounds)})},oa.prototype.resizeSpace=function(e,t){var n=this._spaceTool,i=ue(e),r=ue(t),o=Ih(r,i),a=Sn(e),s=[],c=[];vr(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 aa="flowNodeRef",lp="lanes";function Qs(){}Qs.prototype._computeUpdates=function(e,t){var n=[],i=[],r={},o=[];function a(l,p){var f=ue(p),d={x:l.x+l.width/2,y:l.y+l.height/2};return d.x>f.left&&d.x<f.right&&d.y>f.top&&d.y<f.bottom}function s(l){n.indexOf(l)===-1&&(o.push(l),n.push(l))}function c(l){var p=Sn(l);return r[p.id]||(r[p.id]=ms(p)),r[p.id]}function u(l){if(!l.parent)return[];var p=c(l);return p.filter(function(f){return a(l,f)}).map(function(f){return f.businessObject})}return t.forEach(function(l){var p=Sn(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(lp),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(aa).forEach(function(f){i.push({flowNode:f,remove:[p],add:[]})})}),i},Qs.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(lp);n.remove.forEach(function(o){rt(r,o),rt(o.get(aa),i)}),n.add.forEach(function(o){at(r,o),at(o.get(aa),i)})}),[]},Qs.prototype.revert=function(e){var t=e.updates;return t.forEach(function(n){var i=n.flowNode,r=i.get(lp);n.add.forEach(function(o){rt(r,o),rt(o.get(aa),i)}),n.remove.forEach(function(o){at(r,o),at(o.get(aa),i)})}),[]};var pp="categoryValueRef";function sa(e,t){this._bpmnFactory=e,this._elementRegistry=t}sa.$inject=["bpmnFactory","elementRegistry"],sa.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:fp(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=Th(i,b),o.push(mP(E,x))),x}function p(E){return E.reduce(function(b,x){var S=fp(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=fp(E),S=f.get(x)||[],A=zr(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=zr(S,b);S.forEach(function(I){if(A[I.id]){var P=m.get(I);P||(P=new Set,m.set(I,P)),P.add(x.categoryValue)}})}});var w=d.reduce(function(E,b){var x=r.get(b),S=x.get(pp),A=new Set(S),I=m.get(b)||new Set,P=Array.from(I).filter(function(j){return!A.has(j)}),$=S.filter(function(j){return h.has(j)&&!I.has(j)});return(P.length||$.length)&&E.push({businessObject:x,categoryValuesToAdd:P,categoryValuesToRemove:$}),E},[]);return{flowElements:w,groups:o}},sa.prototype.execute=function(e){var t=e.updates;return t||(t=e.updates=this._computeUpdates(e.affectedFlowElements,e.affectedGroupEntries)),gP(t.groups),yP(t.flowElements),[]},sa.prototype.revert=function(e){var t=e.updates;return _P(t.flowElements),vP(t.groups),[]};function mP(e,t){return{groupShape:e,categoryValue:t,category:t.$parent}}function gP(e){e.forEach(function(t){U(t.groupShape).categoryValueRef=t.categoryValue,t.categoryValue.$parent=t.category})}function vP(e){e.forEach(function(t){U(t.groupShape).categoryValueRef=null})}function yP(e){e.forEach(function(t){var n=t.businessObject,i=n.get(pp);t.categoryValuesToRemove.forEach(function(r){rt(i,r)}),t.categoryValuesToAdd.forEach(function(r){at(i,r,!0)})})}function _P(e){e.forEach(function(t){var n=t.businessObject,i=n.get(pp);t.categoryValuesToAdd.forEach(function(r){rt(i,r)}),t.categoryValuesToRemove.forEach(function(r){at(i,r,!0)})})}function fp(e){for(;e.parent;)e=e.parent;return e}function Js(e){this._moddle=e}Js.$inject=["moddle"],Js.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),[]},Js.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 bP={fill:void 0,stroke:void 0};function dp(e){this._commandStack=e,this._normalizeColor=function(t){if(t){if(en(t)){var n=xP(t);if(n)return n}throw new Error(`invalid color value: ${t}`)}}}dp.$inject=["commandStack"],dp.prototype.postExecute=function(e){var t=e.elements,n=e.colors||bP,i=this,r={};"fill"in n&&D(r,{"background-color":this._normalizeColor(n.fill)}),"stroke"in n&&D(r,{"border-color":this._normalizeColor(n.stroke)}),T(t,function(o){var a=He(o)?In(r,["border-color"]):r,s=Me(o);if(EP(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 xP(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 EP(e){"border-color"in e&&(e.stroke=e["border-color"]),"background-color"in e&&(e.fill=e["background-color"])}var wP={width:0,height:0};function iv(e,t,n){function i(c,u){var l=c.label||c,p=c.labelTarget||c;return Zw(l,u),[l,p]}function r(c){var u=c.element,l=u.businessObject,p=c.newLabel;if(!_e(u)&&Fi(u)&&!ns(u)&&!rv(p)){var f=7,d=Bu(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=vn(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)&&rv(p)){d.removeShape!==!1&&e.removeShape(l,{unsetLabel:!1});return}var h=vn(u);typeof f>"u"&&(f=t.getExternalLabelBounds(l,h)),f&&e.resizeShape(l,f,wP)}}this.preExecute=r,this.execute=o,this.revert=a,this.postExecute=s}iv.$inject=["modeling","textRenderer","bpmnFactory"];function rv(e){return!e||!e.trim()}function Lt(e,t,n,i){ze.call(this,e,t,n),this._bpmnRules=i}Q(Lt,ze),Lt.$inject=["eventBus","elementFactory","commandStack","bpmnRules"],Lt.prototype.getHandlers=function(){var e=ze.prototype.getHandlers.call(this);return e["element.updateModdleProperties"]=na,e["element.updateProperties"]=ra,e["canvas.updateRoot"]=Zs,e["lane.add"]=cp,e["lane.resize"]=oa,e["lane.split"]=up,e["lane.updateRefs"]=Qs,e["group.updateRefs"]=sa,e["id.updateClaim"]=Js,e["element.setColor"]=dp,e["element.updateLabel"]=iv,e},Lt.prototype.updateLabel=function(e,t,n,i){this._commandStack.execute("element.updateLabel",{element:e,newLabel:t,newBounds:n,hints:i||{}})},Lt.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)},Lt.prototype.updateModdleProperties=function(e,t,n){this._commandStack.execute("element.updateModdleProperties",{element:e,moddleElement:t,properties:n})},Lt.prototype.updateProperties=function(e,t){this._commandStack.execute("element.updateProperties",{element:e,properties:t})},Lt.prototype.resizeLane=function(e,t,n){this._commandStack.execute("lane.resize",{shape:e,newBounds:t,balanced:n})},Lt.prototype.addLane=function(e,t){var n={shape:e,location:t};return this._commandStack.execute("lane.add",n),n.newLane},Lt.prototype.splitLane=function(e,t){this._commandStack.execute("lane.split",{shape:e,count:t})},Lt.prototype.makeCollaboration=function(){var e=this._create("root",{type:"bpmn:Collaboration"}),t={newRoot:e};return this._commandStack.execute("canvas.updateRoot",t),e},Lt.prototype.makeProcess=function(){var e=this._create("root",{type:"bpmn:Process"}),t={newRoot:e};return this._commandStack.execute("canvas.updateRoot",t),e},Lt.prototype.updateLaneRefs=function(e,t){this._commandStack.execute("lane.updateRefs",{flowNodeShapes:e,laneShapes:t})},Lt.prototype.updateCategoryValueRefs=function(e,t){this._commandStack.execute("group.updateRefs",{affectedFlowElements:e,affectedGroupEntries:t})},Lt.prototype.claimId=function(e,t){this._commandStack.execute("id.updateClaim",{id:e,element:t,claiming:!0})},Lt.prototype.unclaimId=function(e,t){this._commandStack.execute("id.updateClaim",{id:e,element:t})},Lt.prototype.setColor=function(e,t){e.length||(e=[e]),this._commandStack.execute("element.setColor",{elements:e,colors:t})};function ov(){}ov.prototype.layoutConnection=function(e,t){return t=t||{},[t.connectionStart||pe(t.source||e.source),t.connectionEnd||pe(t.target||e.target)]};var ec=20,SP=5,tc=Math.round,av=20,RP={"h:h":20,"v:v":20,"h:v":-10,"v:h":-10};function CP(e,t){return!{t:/top/,r:/right/,b:/bottom/,l:/left/,h:/./,v:/./}[t].test(e)}function PP(e,t){return{t:/top/,r:/right/,b:/bottom/,l:/left/,h:/left|right/,v:/top|bottom/}[e].test(t)}function sv(e,t,n){var i=Dt(t,e,SP),r=n.split(":")[0],o=tc((t.x-e.x)/2+e.x),a=tc((t.y-e.y)/2+e.y),s,c,u=PP(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=CP(i,r),c=l?"h:v":"v:h",p?l?(f=a===e.y,s={x:e.x+ec*(/l/.test(r)?-1:1),y:f?a+ec:a}):(f=o===e.x,s={x:f?o+ec:o,y:e.y+ec*(/t/.test(r)?-1:1)}):s={x:o,y:a}),{waypoints:hp(e,s,c).concat(s),directions:c,turnNextDirections:f}}function AP(e,t,n){return sv(e,t,n)}function TP(e,t,n){var i=sv(t,e,cv(n));return{waypoints:i.waypoints.slice().reverse(),directions:cv(i.directions),turnNextDirections:i.turnNextDirections}}function MP(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=hp(e.waypoints[e.waypoints.length-1],t.waypoints[0],r);return{waypoints:o,directions:r}}function cv(e){return e.split(":").reverse().join(":")}function kP(e,t,n){var i=tc((t.x-e.x)/2+e.x),r=tc((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 hp(e,t,n){if(n=n||"h:h",!FP(n))throw new Error("unknown directions: <"+n+">: must be specified as <start>:<end> with start/end in { h,v,t,r,b,l }");if(lv(n)){var i=AP(e,t,n),r=TP(e,t,n),o=MP(i,r);return[].concat(i.waypoints,o.waypoints,r.waypoints)}return kP(e,t,n)}function DP(e,t,n){var i=hp(e,t,n);return i.unshift(e),i.push(t),fv(i)}function OP(e,t,n,i,r){var o=r&&r.preferredLayouts||[],a=Gb(o,"straight")[0]||"h:h",s=RP[a]||0,c=Dt(e,t,s),u=jP(c,a);n=n||pe(e),i=i||pe(t);var l=u.split(":"),p=pv(n,e,l[0],HP(c)),f=pv(i,t,l[1],c);return DP(p,f,u)}function IP(e,t,n,i,r,o){le(n)&&(r=n,o=i,n=pe(e),i=pe(t)),o=D({preferredLayouts:[]},o),r=r||[];var a=o.preferredLayouts,s=a.indexOf("straight")!==-1,c;return c=s&&NP(e,t,n,i,o),c||(c=o.connectionEnd&&$P(t,e,i,r),c)||(c=o.connectionStart&&BP(e,t,n,r),c)?c:!o.connectionStart&&!o.connectionEnd&&r&&r.length?r:OP(e,t,n,i,o)}function LP(e,t,n){return e>=t&&e<=n}function uv(e,t,n){var i={x:"width",y:"height"};return LP(t[e],n[e],n[e]+n[i[e]])}function NP(e,t,n,i,r){var o={},a,s;return s=Dt(e,t),/^(top|bottom|left|right)$/.test(s)?(/top|bottom/.test(s)&&(a="x"),/left|right/.test(s)&&(a="y"),r.preserveDocking==="target"?uv(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:uv(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 BP(e,t,n,i){return mp(e,t,n,i)}function $P(e,t,n,i){var r=i.slice().reverse();return r=mp(e,t,n,r),r?r.reverse():null}function mp(e,t,n,i){function r(l){return l.length<3?!0:l.length>4?!1:!!Ge(l,function(p,f){var d=l[f-1];return d&&ko(p,d)<3})}function o(l,p,f){var d=ui(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(Ld(l[d],p,av)||Ld(l[d],f,av))return l.slice(d);return l}if(r(i))return null;var s=i[0],c=i.slice(),u;return c[0]=n,c[1]=o(c[1],s,n),u=a(c,e,t),u!==c&&(c=mp(e,t,n,u)),c&&ui(c)?null:c}function jP(e,t){if(lv(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 FP(e){return e&&/^h|v|t|r|b|l:h|v|t|r|b|l$/.test(e)}function lv(e){return e&&/t|r|b|l/.test(e)}function HP(e){return{top:"bottom",bottom:"top",left:"right",right:"left","top-left":"bottom-right","bottom-right":"top-left","top-right":"bottom-left","bottom-left":"top-right"}[e]}function pv(e,t,n,i){if(n==="h"&&(n=/left/.test(i)?"l":"r"),n==="v"&&(n=/top/.test(i)?"t":"b"),n==="t")return{original:e,x:e.x,y:t.y};if(n==="r")return{original:e,x:t.x+t.width,y:e.y};if(n==="b")return{original:e,x:e.x,y:t.y+t.height};if(n==="l")return{original:e,x:t.x,y:e.y};throw new Error("unexpected dockingDirection: <"+n+">")}function fv(e){return e.reduce(function(t,n,i){var r=t[t.length-1],o=e[i+1];return Du(r,o,n,0)||t.push(n),t},[])}var zP=-10,VP=40,GP={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},WP={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},gp={top:"bottom","top-right":"bottom-left","top-left":"bottom-right",right:"left",bottom:"top","bottom-right":"top-left","bottom-left":"top-right",left:"right"},ca={top:"t",right:"r",bottom:"b",left:"l"};function nc(e){this._elementRegistry=e}Q(nc,ov),nc.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=dv(r&&r[0],n)),a||(a=dv(r&&r[r.length-1],i)),(y(e,"bpmn:Association")||y(e,"bpmn:DataAssociation"))&&r&&!hv(n,i))return[].concat([o],r.slice(1,-1),[a]);var l=Rh(n,s)?GP:WP;return y(e,"bpmn:MessageFlow")?c=qP(n,i,l):(y(e,"bpmn:SequenceFlow")||hv(n,i))&&(n===i?c={preferredLayouts:JP(n,e,l)}:y(n,"bpmn:BoundaryEvent")?c={preferredLayouts:eA(n,i,a,l)}:ua(n)||ua(i)?c={preferredLayouts:l.subProcess,preserveDocking:KP(n)}:y(n,"bpmn:Gateway")?c={preferredLayouts:l.fromGateway}:y(i,"bpmn:Gateway")?c={preferredLayouts:l.toGateway}:c={preferredLayouts:l.default}),c&&(c=D(c,t),u=fv(IP(n,i,o,a,r,c))),u||[o,a]};function UP(e){var t=e.host;return Dt(pe(e),t,zP)}function qP(e,t,n){return{preferredLayouts:n.messageFlow,preserveDocking:YP(e,t)}}function YP(e,t){return y(t,"bpmn:Participant")?"source":y(e,"bpmn:Participant")?"target":ua(t)?"source":ua(e)||y(t,"bpmn:Event")?"target":y(e,"bpmn:Event")?"source":null}function KP(e){return ua(e)?"target":"source"}function dv(e,t){return e?e.original||e:pe(t)}function hv(e,t){return y(t,"bpmn:Activity")&&y(e,"bpmn:BoundaryEvent")&&t.businessObject.isForCompensation}function ua(e){return y(e,"bpmn:SubProcess")&&Se(e)}function Cr(e,t){return e===t}function XP(e,t){return t.indexOf(e)!==-1}function so(e){var t=/right|left/.exec(e);return t&&t[0]}function co(e){var t=/top|bottom/.exec(e);return t&&t[0]}function mv(e,t){return gp[e]===t}function ZP(e,t){var n=so(e),i=gp[n];return t.indexOf(i)!==-1}function QP(e,t){var n=co(e),i=gp[n];return t.indexOf(i)!==-1}function gv(e){return e==="right"||e==="left"}function JP(e,t,n){var i=t.waypoints,r=i&&i.length&&Dt(i[0],e);return r==="top"?n.loop.fromTop:r==="right"?n.loop.fromRight:r==="left"?n.loop.fromLeft:n.loop.fromBottom}function eA(e,t,n,i){var r=pe(e),o=pe(t),a=UP(e),s,c,u=Cr(e.host,t),l=XP(a,["top","right","bottom","left"]),p=Dt(o,r,{x:e.width/2+t.width/2,y:e.height/2+t.height/2});return u?tA(a,l,e,t,n,i):(s=nA(a,p,l,i.isHorizontal),c=iA(a,p,l,i.isHorizontal),[s+":"+c])}function tA(e,t,n,i,r,o){var a=t?e:o.isHorizontal?co(e):so(e),s=ca[a],c;return t?gv(e)?c=vv("y",n,i,r)?"h":o.boundaryLoop.alternateHorizontalSide:c=vv("x",n,i,r)?"v":o.boundaryLoop.alternateVerticalSide:c=o.boundaryLoop.default,[s+":"+c]}function vv(e,t,n,i){var r=VP;return!(vp(e,i,n,r)||vp(e,i,{x:n.x+n.width,y:n.y+n.height},r)||vp(e,i,pe(t),r))}function vp(e,t,n,i){return Math.abs(t[e]-n[e])<i}function nA(e,t,n,i){if(n)return ca[e];var r=co(e),o=so(e),a=co(t),s=so(t);if(i){if(Cr(r,a)||mv(o,s))return ca[r]}else if(Cr(o,s)||mv(r,a))return ca[o];return ca[i?o:r]}function iA(e,t,n,i){if(n)return gv(e)?ZP(e,t)||Cr(e,t)?"h":"v":QP(e,t)||Cr(e,t)?"v":"h";var r=co(e),o=so(e),a=co(t),s=so(t);return a&&!s?"v":s&&!a?"h":i?Cr(r,a)?"h":"v":Cr(o,s)?"v":"h"}nc.$inject=["elementRegistry"];function yv(e){return D({original:e.point.original||e.point},e.actual)}function Zi(e,t){this._elementRegistry=e,this._graphicsFactory=t}Zi.$inject=["elementRegistry","graphicsFactory"],Zi.prototype.getCroppedWaypoints=function(e,t,n){t=t||e.source,n=n||e.target;var i=this.getDockingPoint(e,t,!0),r=this.getDockingPoint(e,n),o=e.waypoints.slice(i.idx+1,r.idx);return o.unshift(yv(i)),o.push(yv(r)),o},Zi.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}},Zi.prototype._getIntersection=function(e,t,n){var i=this._getShapePath(e),r=this._getConnectionPath(t);return Do(i,r,n)},Zi.prototype._getConnectionPath=function(e){return this._graphicsFactory.getConnectionPath(e)},Zi.prototype._getShapePath=function(e){return this._graphicsFactory.getShapePath(e)},Zi.prototype._getGfx=function(e){return this._elementRegistry.getGraphics(e)};const yp={__init__:["modeling","bpmnUpdater"],__depends__:[ER,$R,FR,HR,Mg,zC,GC,XC,Cn,tp,Ng],bpmnFactory:["type",An],bpmnUpdater:["type",un],elementFactory:["type",Yi],modeling:["type",Lt],layouter:["type",nc],connectionDocking:["type",Zi]};var rA=10,_v=50,oA=250;function _p(e,t,n,i){for(var r;r=aA(e,n,t);)n=i(t,n,r);return n}function bp(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 aA(e,t,n){var i={x:t.x-n.width/2,y:t.y-n.height/2,width:n.width,height:n.height},r=cA(e);return Ge(r,function(o){if(o===n)return!1;var a=Dt(o,i,rA);return a==="intersect"})}function sA(e,t){t||(t={});function n(h){return h.source===e?1:-1}var i=t.defaultDistance||_v,r=t.direction||"e",o=t.filter,a=t.getWeight||n,s=t.maxDistance||oA,c=t.reference||"start";o||(o=pA);function u(h,m){return r==="n"?c==="start"?ue(h).top-ue(m).bottom:c==="center"?ue(h).top-pe(m).y:ue(h).top-ue(m).top:r==="w"?c==="start"?ue(h).left-ue(m).right:c==="center"?ue(h).left-pe(m).x:ue(h).left-ue(m).left:r==="s"?c==="start"?ue(m).top-ue(h).bottom:c==="center"?pe(m).y-ue(h).bottom:ue(m).bottom-ue(h).bottom:c==="start"?ue(m).left-ue(h).right:c==="center"?pe(m).x-ue(h).right:ue(m).right-ue(h).right}var l=e.incoming.filter(o).map(function(h){var m=a(h),g=m<0?u(h.source,e):u(e,h.source);return{id:h.source.id,distance:g,weight:m}}),p=e.outgoing.filter(o).map(function(h){var m=a(h),g=m>0?u(e,h.target):u(h.target,e);return{id:h.target.id,distance:g,weight:m}}),f=l.concat(p).reduce(function(h,m){return h[m.id+"__weight_"+m.weight]=m,h},{}),d=nn(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 cA(e){var t=xp(e);return e.host&&(t=t.concat(xp(e.host))),e.attachers&&(t=t.concat(e.attachers.reduce(function(n,i){return n.concat(xp(i))},[]))),t}function xp(e){return lA(e).concat(uA(e))}function uA(e){return e.incoming.map(function(t){return t.source})}function lA(e){return e.outgoing.map(function(t){return t.target})}function pA(){return!0}var fA=100;function bv(e,t,n){e.on("autoPlace",fA,function(i){var r=i.shape,o=i.source;return dA(o,r)}),e.on("autoPlace.end",function(i){n.scrollToElement(i.shape)}),this.append=function(i,r,o){e.fire("autoPlace.start",{source:i,shape:r});var a=e.fire("autoPlace",{source:i,shape:r}),s=t.appendShape(i,r,a,i.parent,o);return e.fire("autoPlace.end",{source:i,shape:s}),s}}bv.$inject=["eventBus","modeling","canvas"];function dA(e,t,n){n||(n={});var i=n.defaultDistance||_v,r=pe(e),o=ue(e);return{x:o.right+i+t.width/2,y:r.y}}function xv(e,t){e.on("autoPlace.end",500,function(n){t.select(n.shape)})}xv.$inject=["eventBus","selection"];const hA={__init__:["autoPlaceSelectionBehavior"],autoPlace:["type",bv],autoPlaceSelectionBehavior:["type",xv]};function Ev(e,t,n){var i=Rh(e,n);if(y(t,"bpmn:TextAnnotation"))return gA(e,t,i);if(xe(t,["bpmn:DataObjectReference","bpmn:DataStoreReference"]))return vA(e,t,i);if(y(t,"bpmn:FlowNode"))return mA(e,t,i)}function mA(e,t,n){var i=ue(e),r=pe(e),o=n?{directionHint:"e",minDistance:80,baseOrientation:"left",boundaryOrientation:"top",start:"top",end:"bottom"}:{directionHint:"s",minDistance:90,baseOrientation:"top",boundaryOrientation:"left",start:"left",end:"right"},a=sA(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=Dt(e,e.host,-25),u.indexOf(o.boundaryOrientation)!==-1&&(s*=-1));var l=n?{x:i.right+a+t.width/2,y:r.y+wv(u,c,o)}:{x:r.x+wv(u,c,o),y:i.bottom+a+t.height/2},p={margin:s,minDistance:c},f=n?{y:p}:{x:p};return _p(e,t,l,bp(f))}function wv(e,t,n){return e.includes(n.start)?-1*t:e.includes(n.end)?t:0}function gA(e,t,n){var i=ue(e),r=n?{x:i.right+t.width/2,y:i.top-50-t.height/2}:{x:i.right+50+t.width/2,y:i.bottom+t.height/2};He(e)&&(r=pe(e),n?(r.x+=100,r.y-=50):(r.x+=100,r.y+=50));var o={margin:n?-30:30,minDistance:20},a=n?{y:o}:{x:o};return _p(e,t,r,bp(a))}function vA(e,t,n){var i=ue(e),r=n?{x:i.right-10+t.width/2,y:i.bottom+40+t.width/2}:{x:i.left-40-t.width/2,y:i.bottom-10+t.height/2},o={margin:30,minDistance:30},a=n?{x:o}:{y:o};return _p(e,t,r,bp(a))}function Sv(e,t){e.on("autoPlace",function(n){var i=n.shape,r=n.source;return Ev(r,i,t)})}Sv.$inject=["eventBus","elementRegistry"];const ic={__depends__:[hA],__init__:["bpmnAutoPlace"],bpmnAutoPlace:["type",Sv]},uo={cjkEm:.865,upperEm:.68,lowerEm:.5,digitEm:.556,spaceEm:.278,otherEm:.35,ascentEm:.9,descentEm:.25},yA=/[ᄀ-ᇿ -〿぀-ヿ㐀-鿿가-힯＀-⦆]/;function _A(e){const t=uo;return yA.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 Ep(e,t){let n=0;for(const i of e)n+=t*_A(i);return n}function Rv(e=globalThis,{textMeasurement:t="approximate"}={}){if(!(e!=null&&e.SVGElement))throw new Error("installHeadlessBpmnDom: DOM 전역이 없다 — jsdom window 를 전역에 올린 뒤 호출할 것");t==="approximate"&&bA(e),xA(e),EA(e),wA(e)}function bA(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:Ep(r,o),fontBoundingBoxAscent:o*uo.ascentEm,fontBoundingBoxDescent:o*uo.descentEm,actualBoundingBoxAscent:o*uo.ascentEm,actualBoundingBoxDescent:o*uo.descentEm}}};t.getContext=()=>n}function xA(e){if(e.SVGMatrix)return;class t{constructor(){Or(this,"a",1);Or(this,"b",0);Or(this,"c",0);Or(this,"d",1);Or(this,"e",0);Or(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 EA(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 wA(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:Ep(n,12),height:14}})}const Cv=[wh,$o,yp,ic];function SA(e={}){Rv(globalThis,e.dom);const t=document.createElement("div");return document.body.appendChild(t),new Wr({container:t,moddleExtensions:e.moddleExtensions??La,additionalModules:[...Cv,...e.additionalModules??[]]})}var RA=new oo("ov"),CA=500;function Tt(e,t,n,i){this._eventBus=t,this._canvas=n,this._elementRegistry=i,this._ids=RA,this._overlayDefaults=D({show:null,scale:!0},e&&e.defaults),this._overlays={},this._overlayContainers=[],this._overlayRoot=PA(n.getContainer()),this._init()}Tt.$inject=["config.overlays","eventBus","canvas","elementRegistry"],Tt.prototype.get=function(e){if(en(e)&&(e={id:e}),en(e.element)&&(e.element=this._elementRegistry.get(e.element)),e.element){var t=this._getOverlayContainer(e.element,!0);return t?e.type?Ee(t.overlays,Br({type:e.type})):t.overlays.slice():[]}else return e.type?Ee(this._overlays,Br({type:e.type})):e.id?this._overlays[e.id]:null},Tt.prototype.add=function(e,t,n){if(Rt(t)&&(n=t,t=null),e.id||(e=this._elementRegistry.get(e)),!n.position)throw new Error("must specifiy overlay position");if(!n.html)throw new Error("must specifiy overlay html");if(!e)throw new Error("invalid element specified");var i=this._ids.next();return n=D({},this._overlayDefaults,n,{id:i,type:t,element:e,html:n.html}),this._addOverlay(n),i},Tt.prototype.remove=function(e){var t=this.get(e)||[];le(t)||(t=[t]);var n=this;T(t,function(i){var r=n._getOverlayContainer(i.element,!0);if(i&&(Un(i.html),Un(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)}})},Tt.prototype.isShown=function(){return this._overlayRoot.style.display!=="none"},Tt.prototype.show=function(){rc(this._overlayRoot)},Tt.prototype.hide=function(){rc(this._overlayRoot,!1)},Tt.prototype.clear=function(){this._overlays={},this._overlayContainers=[],Ha(this._overlayRoot)},Tt.prototype._updateOverlayContainer=function(e){var t=e.element,n=e.html,i=t.x,r=t.y;if(t.waypoints){var o=ut(t);i=o.x,r=o.y}Pv(n,i,r),zt(e.html,"data-container-id",t.id)},Tt.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=ut(i).width:a=i.width,r=t.right*-1+a}if(t.bottom!==void 0){var s;i.waypoints?s=ut(i).height:s=i.height,o=t.bottom*-1+s}Pv(n,r||0,o||0),this._updateOverlayVisibilty(e,this._canvas.viewbox())},Tt.prototype._createOverlayContainer=function(e){var t=Ue('<div class="djs-overlays" />');Yt(t,{position:"absolute"}),this._overlayRoot.appendChild(t);var n={html:t,element:e,overlays:[]};return this._updateOverlayContainer(n),this._overlayContainers.push(n),n},Tt.prototype._updateRoot=function(e){var t=e.scale||1,n="matrix("+[t,0,0,t,-1*e.x*t,-1*e.y*t].join(",")+")";Av(this._overlayRoot,n)},Tt.prototype._getOverlayContainer=function(e,t){var n=Ge(this._overlayContainers,function(i){return i.element===e});return!n&&!t?this._createOverlayContainer(e):n},Tt.prototype._addOverlay=function(e){var t=e.id,n=e.element,i=e.html,r,o;i.get&&i.constructor.prototype.jquery&&(i=i.get(0)),en(i)&&(i=Ue(i)),o=this._getOverlayContainer(n),r=Ue('<div class="djs-overlay" data-overlay-id="'+t+'">'),Yt(r,{position:"absolute"}),r.appendChild(i),e.type&&Xe(r).add("djs-overlay-"+e.type);var a=this._canvas.findRoot(n),s=this._canvas.getRootElement();rc(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())},Tt.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&&(yt(r)&&r>t.scale||yt(o)&&o<t.scale))&&(c=!1),rc(a,c),this._updateOverlayScale(e,t)},Tt.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),yt(i)&&t.scale<i&&(a=(1/t.scale||1)*i),yt(r)&&t.scale>r&&(a=(1/t.scale||1)*r)),yt(a)&&(s="scale("+a+","+a+")"),Av(o,s)},Tt.prototype._updateOverlaysVisibilty=function(e){var t=this;T(this._overlays,function(n){t._updateOverlayVisibilty(n,e)})},Tt.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){Un(a.html);var s=t._overlayContainers.indexOf(a);s!==-1&&t._overlayContainers.splice(s,1)}}),e.on("element.changed",CA,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&&Xe(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 PA(e){var t=Ue('<div class="djs-overlay-container" />');return Yt(t,{position:"absolute",width:0,height:0}),e.insertBefore(t,e.firstChild),t}function Pv(e,t,n){Yt(e,{left:t+"px",top:n+"px"})}function rc(e,t){e.style.display=t===!1?"none":""}function Av(e,t){e.style["transform-origin"]="top left",["","-ms-","-webkit-"].forEach(function(n){e.style[n+"transform"]=t})}const oc={__init__:["overlays"],overlays:["type",Tt]};function wp(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(wp,W),wp.$inject=["canvas","injector"];const AA={__init__:["rootElementsBehavior"],rootElementsBehavior:["type",wp]};function la(e){return CSS.escape(e)}var TA={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"};function Tv(e){return e=""+e,e&&e.replace(/[&<>"']/g,function(t){return TA[t]})}var MA="bjs-breadcrumbs-shown";function Mv(e,t,n){var i=Ue('<ul class="bjs-breadcrumbs"></ul>'),r=n.getContainer(),o=Xe(r);r.appendChild(i);var a=[];e.on("element.changed",function(c){var u=c.element,l=U(u),p=Ge(a,function(f){return f===l});p&&s()});function s(c){c&&(a=kA(c));var u=a.flatMap(function(p){var f=n.findRoot(Zn(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=Tv(p.name||p.id),m=Ue('<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(MA,l),u.forEach(function(p){i.appendChild(p)})}e.on("root.set",function(c){s(c.element)})}Mv.$inject=["eventBus","elementRegistry","canvas"];function kA(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 kv(e,t){var n=null,i=new DA;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})}kv.$inject=["eventBus","canvas"];function DA(){this._entries=[],this.set=function(e,t){var n=!1;for(var i in this._entries)if(this._entries[i][0]===e){this._entries[i][1]=t,n=!0;break}n||this._entries.push([e,t])},this.get=function(e){for(var t in this._entries)if(this._entries[t][0]===e)return this._entries[t][1];return null},this.clear=function(){this._entries.length=0},this.remove=function(e){var t=-1;for(var n in this._entries)if(this._entries[n][0]===e){t=n;break}t!==-1&&this._entries.splice(t,1)}}var Dv={x:180,y:160};function Pr(e,t){this._eventBus=e,this._moddle=t;var n=this;e.on("import.render.start",1500,function(i,r){n._handleImport(r.definitions)})}Pr.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)})}},Pr.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),IA(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},Pr.prototype._movePlaneElementsToOrigin=function(e){var t=e.get("planeElement"),n=OA(e),i={x:n.x-Dv.x,y:n.y-Dv.y};t.forEach(function(r){r.waypoint?r.waypoint.forEach(function(o){o.x=o.x-i.x,o.y=o.y-i.y}):r.bounds&&(r.bounds.x=r.bounds.x-i.x,r.bounds.y=r.bounds.y-i.y)})},Pr.prototype._moveToDiPlane=function(e,t){var n=Ov(e),i=n.plane.get("planeElement");i.splice(i.indexOf(e),1),t.get("planeElement").push(e)},Pr.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},Pr.$inject=["eventBus","moddle"];function Ov(e){return y(e,"bpmndi:BPMNDiagram")?e:Ov(e.$parent)}function OA(e){var t={top:1/0,right:-1/0,bottom:-1/0,left:1/0};return e.planeElement.forEach(function(n){if(n.bounds){var i=ue(n.bounds);t.top=Math.min(i.top,t.top),t.left=Math.min(i.left,t.left)}}),Xa(t)}function IA(e,t){var n=e.$parent;return!(!y(n,"bpmn:SubProcess")||n===t.bpmnElement||xe(e,["bpmn:DataInputAssociation","bpmn:DataOutputAssociation"]))}var ac=250,LA='<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>',NA="bjs-drilldown-empty";function Qi(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",ac,function(a){var s=a.shape;o._canDrillDown(s)?o._addOverlay(s):o._removeOverlay(s)},!0),this.reverted("shape.toggleCollapse",ac,function(a){var s=a.shape;o._canDrillDown(s)?o._addOverlay(s):o._removeOverlay(s)},!0),this.executed(["shape.create","shape.move","shape.delete"],ac,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"],ac,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(Qi,W),Qi.prototype._updateDrilldownOverlay=function(e){var t=this._canvas;if(e){var n=t.findRoot(e);n&&this._updateOverlayVisibility(n)}},Qi.prototype._canDrillDown=function(e){var t=this._canvas;return y(e,"bpmn:SubProcess")&&t.findRoot(Zn(e))},Qi.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;Xe(i.html).toggle(NA,!r)}},Qi.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=Ue('<button type="button" class="bjs-drilldown">'+LA+"</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(Zn(e)))}),n.add(e,"drilldown",{position:{bottom:-7,right:-8},html:o}),this._updateOverlayVisibility(e)},Qi.prototype._removeOverlay=function(e){var t=this._overlays;t.remove({element:e,type:"drilldown"})},Qi.$inject=["canvas","eventBus","elementRegistry","overlays","translate"];const BA={__depends__:[oc,tp,AA],__init__:["drilldownBreadcrumbs","drilldownOverlayBehavior","drilldownCentering","subprocessCompatibility"],drilldownBreadcrumbs:["type",Mv],drilldownCentering:["type",kv],drilldownOverlayBehavior:["type",Qi],subprocessCompatibility:["type",Pr]};function Ji(e){Qe.call(this,e)}Q(Ji,Qe),Ji.prototype._modules=[wh,BA,oc,Cn,$o],Ji.prototype._moddleExtensions={};var sc="keyboard.keydown",$A="keyboard.keyup",jA=1e3,Iv="Keyboard binding is now implicit; explicit binding to an element got removed. For more information, see https://github.com/bpmn-io/diagram-js/issues/661";function Kt(e,t){var n=this;this._config=e=e||{},this._eventBus=t,this._keydownHandler=this._keydownHandler.bind(this),this._keyupHandler=this._keyupHandler.bind(this),t.on("diagram.destroy",function(){n._fire("destroy"),n.unbind()}),e.bindTo&&console.error("unsupported configuration <keyboard.bindTo>",new Error(Iv));var i=e&&e.bind!==!1;t.on("canvas.init",function(r){n._target=r.svg,i&&n.bind(),n._fire("init")})}Kt.$inject=["config.keyboard","eventBus"],Kt.prototype._keydownHandler=function(e){this._keyHandler(e,sc)},Kt.prototype._keyupHandler=function(e){this._keyHandler(e,$A)},Kt.prototype._keyHandler=function(e,t){var n;if(!this._isEventIgnored(e)){var i={keyEvent:e};n=this._eventBus.fire(t||sc,i),n&&e.preventDefault()}},Kt.prototype._isEventIgnored=function(e){return!1},Kt.prototype.bind=function(e){e&&console.error("unsupported argument <node>",new Error(Iv)),this.unbind(),e=this._node=this._target,he.bind(e,"keydown",this._keydownHandler),he.bind(e,"keyup",this._keyupHandler),this._fire("bind")},Kt.prototype.getBinding=function(){return this._node},Kt.prototype.unbind=function(){var e=this._node;e&&(this._fire("unbind"),he.unbind(e,"keydown",this._keydownHandler),he.unbind(e,"keyup",this._keyupHandler)),this._node=null},Kt.prototype._fire=function(e){this._eventBus.fire("keyboard."+e,{node:this._node})},Kt.prototype.addListener=function(e,t,n){Ct(e)&&(n=t,t=e,e=jA),this._eventBus.on(n||sc,e,t)},Kt.prototype.removeListener=function(e,t){this._eventBus.off(t||sc,e)},Kt.prototype.hasModifier=eC,Kt.prototype.isCmd=sn,Kt.prototype.isShift=Gl,Kt.prototype.isKey=xt;var FA=500;function lo(e,t){var n=this;e.on("editorActions.init",FA,function(i){var r=i.editorActions;n.registerBindings(t,r)})}lo.$inject=["eventBus","keyboard"],lo.prototype.registerBindings=function(e,t){function n(i,r){t.isRegistered(i)&&e.addListener(r)}n("undo",function(i){var r=i.keyEvent;if(oC(r))return t.trigger("undo"),!0}),n("redo",function(i){var r=i.keyEvent;if(aC(r))return t.trigger("redo"),!0}),n("copy",function(i){var r=i.keyEvent;if(tC(r))return t.trigger("copy"),!0}),n("paste",function(i){var r=i.keyEvent;if(nC(r))return t.trigger("paste"),!0}),n("duplicate",function(i){var r=i.keyEvent;if(iC(r))return t.trigger("duplicate"),!0}),n("cut",function(i){var r=i.keyEvent;if(rC(r))return t.trigger("cut"),!0}),n("stepZoom",function(i){var r=i.keyEvent;if(xt(["+","Add","="],r)&&sn(r))return t.trigger("stepZoom",{value:1}),!0}),n("stepZoom",function(i){var r=i.keyEvent;if(xt(["-","Subtract"],r)&&sn(r))return t.trigger("stepZoom",{value:-1}),!0}),n("zoom",function(i){var r=i.keyEvent;if(xt("0",r)&&sn(r))return t.trigger("zoom",{value:1}),!0}),n("removeSelection",function(i){var r=i.keyEvent;if(xt(["Backspace","Delete","Del"],r))return t.trigger("removeSelection"),!0})};const Sp={__init__:["keyboard","keyboardBindings"],keyboard:["type",Kt],keyboardBindings:["type",lo]};var HA={moveSpeed:50,moveSpeedAccelerated:200};function Lv(e,t,n){var i=this;this._config=D({},HA,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})}}Lv.$inject=["config.keyboardMove","keyboard","canvas"];const Nv={__depends__:[Sp],__init__:["keyboardMove"],keyboardMove:["type",Lv]};var zA=15;function Bv(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=xr(s),p=Nn(l,c);if(!n.dragging&&VA(p)>zA&&(n.dragging=!0,u===0&&ug(e),Is("grab")),n.dragging){var f=n.last||n.start;p=Nn(l,f),t.scroll({dx:p.x,dy:p.y}),n.last=l}s.preventDefault()}function o(s){he.unbind(document,"mousemove",r),he.unbind(document,"mouseup",o),n=null,cg()}function a(s){if(!mr(s.target,".djs-draggable")){var c=s.button;if(!(c>=2||s.ctrlKey||s.shiftKey||s.altKey))return n={button:c,start:xr(s)},he.bind(document,"mousemove",r),he.bind(document,"mouseup",o),!0}}this.isActive=function(){return!!n}}Bv.$inject=["eventBus","canvas"];function VA(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}const $v={__init__:["moveCanvas"],moveCanvas:["type",Bv]};function jv(e,t){var n=Hu(e.min),i=Hu(e.max),r=Math.abs(n)+Math.abs(i);return r/t}function GA(e,t){return Math.max(e.min,Math.min(e.max,t))}var WA=Math.sign||function(e){return e>=0?1:-1},Rp={min:.2,max:4},Fv=10,UA=.1,qA=.75;function ei(e,t,n){e=e||{},this._enabled=!1,this._canvas=n,this._container=n._container,this._handleWheel=Zt(this._handleWheel,this),this._totalDelta=0,this._scale=e.scale||qA;var i=this;t.on("canvas.mouseover",function(){i._init(e.enabled!==!1)}),t.on("canvas.mouseout",function(){i._init(!1)})}ei.$inject=["config.zoomScroll","eventBus","canvas"],ei.prototype.scroll=function(t){this._canvas.scroll(t)},ei.prototype.reset=function(){this._canvas.zoom("fit-viewport")},ei.prototype.zoom=function(t,n){var i=jv(Rp,Fv*2);this._totalDelta+=t,Math.abs(this._totalDelta)>UA&&(this._zoom(t,n,i),this._totalDelta=0)},ei.prototype._handleWheel=function(t){if(this._enabled){var n=this._container;t.preventDefault();var i=t.ctrlKey||gm()&&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))*WA(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)}},ei.prototype.stepZoom=function(t,n){var i=jv(Rp,Fv);this._zoom(t,n,i)},ei.prototype._zoom=function(e,t,n){var i=this._canvas,r=e>0?1:-1,o=Hu(i.zoom()),a=Math.round(o/n)*n;a+=n*r;var s=Math.pow(10,a);i.zoom(GA(Rp,s),t)},ei.prototype.toggle=function(t){var n=this._container,i=this._handleWheel,r=this._enabled;return typeof t>"u"&&(t=!r),r!==t&&he[t?"bind":"unbind"](n,"wheel",i,!1),this._enabled=t,t},ei.prototype._init=function(e){this.toggle(e)};const Hv={__init__:["zoomScroll"],zoomScroll:["type",ei]};function pa(e){Ji.call(this,e)}Q(pa,Ji),pa.prototype._navigationModules=[Nv,$v,Hv],pa.prototype._modules=[].concat(Ji.prototype._modules,pa.prototype._navigationModules);function Cp(e){return e&&e[e.length-1]}function zv(e){return e.y}function Vv(e){return e.x}var YA={left:Vv,center:Vv,right:function(e){return e.x+e.width},top:zv,middle:zv,bottom:function(e){return e.y+e.height}};function po(e,t){this._modeling=e,this._rules=t}po.$inject=["modeling","rules"],po.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}},po.prototype._isType=function(e,t){return t.indexOf(e)!==-1},po.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=Cp(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=Hn(a,function(f){return f.elements.length>1&&(s=!0),f.elements.length}),s)return o[e]=Cp(c).center,o;u=t[0],t=Hn(t,function(f){return f[i]+f[r]}),l=Cp(t),o[e]=p(u,l)}return o},po.prototype.trigger=function(e,t){var n=this._modeling,i,r=Ee(e,function(c){return!(c.waypoints||c.host||c.labelTarget)});if(i=this._rules.allowed("elements.align",{elements:r}),le(i)&&(r=i),!(r.length<2||!i)){var o=YA[t],a=Hn(r,o),s=this._alignmentPosition(t,a);n.alignElements(a,s)}};const KA={__init__:["alignElements"],alignElements:["type",po]},XA=new oo;function fo(e){this._scheduled={},e.on("diagram.destroy",()=>{Object.keys(this._scheduled).forEach(t=>{this.cancel(t)})})}fo.$inject=["eventBus"],fo.prototype.schedule=function(e,t=XA.next()){this.cancel(t);const n=this._schedule(e,t);return this._scheduled[t]=n,n.promise},fo.prototype._schedule=function(e,t){const n=ZA();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}},fo.prototype.cancel=function(e){const t=this._scheduled[e];t&&(this._cancel(t),this._scheduled[e]=null)},fo.prototype._cancel=function(e){clearTimeout(e.executionId)};function ZA(){const e={};return e.promise=new Promise((t,n)=>{e.resolve=t,e.reject=n}),e}const QA={scheduler:["type",fo]};var JA="djs-element-hidden",cc=".entry",eT=1e3,Gv=8,tT=300;function pt(e,t,n,i){this._canvas=e,this._elementRegistry=t,this._eventBus=n,this._scheduler=i,this._current=null,this._init()}pt.$inject=["canvas","elementRegistry","eventBus","scheduler"],pt.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=le(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=le(i.target)?i.target:[i.target];r.includes(n)&&e._updateVisibility()}}),this._container=this._createContainer()},pt.prototype._createContainer=function(){var e=Ue('<div class="djs-context-pad-parent"></div>');return this._canvas.getContainer().appendChild(e),e},pt.prototype.registerProvider=function(e,t){t||(t=e,e=eT),this._eventBus.on("contextPad.getProviders",e,function(n){n.providers.push(t)})},pt.prototype.getEntries=function(e){var t=this._getProviders(),n=le(e)?"getMultiElementContextPadEntries":"getContextPadEntries",i={};return T(t,function(r){if(Ct(r[n])){var o=r[n](e);Ct(o)?i=o(i):T(o,function(a,s){i[s]=a})}}),i},pt.prototype.trigger=function(e,t,n){var i=this,r,o,a=t.delegateTarget||t.target;if(!a)return t.preventDefault();if(r=zt(a,"data-action"),o=t.originalEvent||t,e==="mouseover"){this._timeout=setTimeout(function(){i._mouseout=i.triggerEntry(r,"hover",o,n)},tT);return}else if(e==="mouseout"){clearTimeout(this._timeout),this._mouseout&&(this._mouseout(),this._mouseout=null);return}return this.triggerEntry(r,e,o,n)},pt.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(Ct(s)){if(t==="click")return s(n,r,i)}else if(s[t])return s[t](n,r,i);n.preventDefault()}}}},pt.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))}},pt.prototype._getProviders=function(){var e=this._eventBus.createEvent({type:"contextPad.getProviders",providers:[]});return this._eventBus.fire(e),e.providers},pt.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=Ue(r.html||'<div class="entry" draggable="true"></div>'),c;zt(s,"data-action",o),c=je("[data-group="+la(a)+"]",n),c||(c=Ue('<div class="group"></div>'),zt(c,"data-group",a),n.appendChild(c)),c.appendChild(s),r.className&&nT(s,r.className),r.title&&zt(s,"title",r.title),r.imageUrl&&(i=Ue("<img>"),zt(i,"src",r.imageUrl),i.style.width="100%",i.style.height="100%",s.appendChild(i))}),Xe(n).add("open"),this._current={entries:t,html:n,target:e},this._updatePosition(),this._updateVisibility(),this._eventBus.fire("contextPad.open",{current:this._current})},pt.prototype._createHtml=function(e){var t=this,n=Ue('<div class="djs-context-pad"></div>');return rn.bind(n,cc,"click",function(i){t.trigger("click",i)}),rn.bind(n,cc,"dragstart",function(i){t.trigger("dragstart",i)}),rn.bind(n,cc,"mouseover",function(i){t.trigger("mouseover",i)}),rn.bind(n,cc,"mouseout",function(i){t.trigger("mouseout",i)}),he.bind(n,"mousedown",function(i){i.stopPropagation()}),this._container.appendChild(n),this._eventBus.fire("contextPad.create",{target:e,pad:n}),n},pt.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()&&rT(this._current.target,e)?t=this._current.html:t=this._createHtml(e),{html:t}},pt.prototype.close=function(){this.isOpen()&&(clearTimeout(this._timeout),this._container.innerHTML="",this._eventBus.fire("contextPad.close",{current:this._current}),this._current=null)},pt.prototype.isOpen=function(e){var t=this._current;if(!t)return!1;if(!e)return!0;var n=t.target;return le(e)!==le(n)?!1:le(e)?e.length===n.length&&ur(e,function(i){return n.includes(i)}):n===e},pt.prototype.isShown=function(){return this.isOpen()&&Xe(this._current.html).has("open")},pt.prototype.show=function(){this.isOpen()&&(Xe(this._current.html).add("open"),this._updatePosition(),this._eventBus.fire("contextPad.show",{current:this._current}))},pt.prototype.hide=function(){this.isOpen()&&(Xe(this._current.html).remove("open"),this._eventBus.fire("contextPad.hide",{current:this._current}))},pt.prototype._getPosition=function(e){if(!le(e)&&He(e)){var t=this._canvas.viewbox(),n=iT(e),i=n.x*t.scale-t.x*t.scale,r=n.y*t.scale-t.y*t.scale;return{left:i+Gv*this._canvas.zoom(),top:r}}var o=this._canvas.getContainer(),a=o.getBoundingClientRect(),s=this._getTargetBounds(e);return{left:s.right-a.left+Gv*this._canvas.zoom(),top:s.top-a.top}},pt.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")},pt.prototype._updateVisibility=function(){const e=()=>{if(this.isOpen()){var t=this,n=this._current.target,i=le(n)?n:[n],r=i.some(function(o){return t._canvas.hasMarker(o,JA)});r?t.hide():t.show()}};this._scheduler.schedule(e,"ContextPad#_updateVisibility")},pt.prototype._getTargetBounds=function(e){var t=this,n=le(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 nT(e,t){var n=Xe(e);t=le(t)?t:t.split(/\s+/g),t.forEach(function(i){n.add(i)})}function iT(e){return e.waypoints[e.waypoints.length-1]}function rT(e,t){return e=le(e)?e:[e],t=le(t)?t:[t],e.length===t.length&&ur(e,function(n){return t.includes(n)})}const Wv={__depends__:[Os,QA,oc],contextPad:["type",pt]};var uc,et,Uv,er,qv,Yv,Kv,Pp,lc,fa,Xv,Ap,Tp,Mp,pc={},fc=[],oT=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,dc=Array.isArray;function _i(e,t){for(var n in t)e[n]=t[n];return e}function kp(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function Zv(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?uc.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 hc(e,a,i,r,null)}function hc(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??++Uv,__i:-1,__u:0};return r==null&&et.vnode!=null&&et.vnode(o),o}function mc(e){return e.children}function gc(e,t){this.props=e,this.context=t}function Ar(e,t){if(t==null)return e.__?Ar(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"?Ar(e):null}function aT(e){if(e.__P&&e.__d){var t=e.__v,n=t.__e,i=[],r=[],o=_i({},t);o.__v=t.__v+1,et.vnode&&et.vnode(o),Dp(e.__P,o,t,e.__n,e.__P.namespaceURI,32&t.__u?[n]:null,i,n??Ar(t),!!(32&t.__u),r),o.__v=t.__v,o.__.__k[o.__i]=o,oy(i,o,r),t.__e=t.__=null,o.__e!=n&&Qv(o)}}function Qv(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}),Qv(e)}function Jv(e){(!e.__d&&(e.__d=!0)&&er.push(e)&&!vc.__r++||qv!=et.debounceRendering)&&((qv=et.debounceRendering)||Yv)(vc)}function vc(){try{for(var e,t=1;er.length;)er.length>t&&er.sort(Kv),e=er.shift(),t=er.length,aT(e)}finally{er.length=vc.__r=0}}function ey(e,t,n,i,r,o,a,s,c,u,l){var p,f,d,h,m,g,w=i&&i.__k||fc,E=t.length;for(c=sT(n,t,w,c,E),p=0;p<E;p++)(d=n.__k[p])!=null&&(f=d.__i!=-1&&w[d.__i]||pc,d.__i=p,g=Dp(e,d,f,r,o,a,s,c,u,l),h=d.__e,d.ref&&f.ref!=d.ref&&(f.ref&&Op(f.ref,null,d),l.push(d.ref,d.__c||h,d)),m==null&&h!=null&&(m=h),4&d.__u?(c=ty(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 sT(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]=hc(null,a,null,null,null):dc(a)?a=e.__k[o]=hc(mc,{children:a},null,null,null):a.constructor===void 0&&a.__b>0?a=e.__k[o]=hc(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=cT(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=Ar(s)),sy(s,s));return i}function ty(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=ty(i[r],t,n));return t}e.__e!=t&&(t&&e.type&&!t.parentNode&&(t=Ar(e)),t=n.insertBefore(e.__e,t||null));do t=t&&t.nextSibling;while(t!=null&&t.nodeType==8);return t}function cT(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 ny(e,t,n){t[0]=="-"?e.setProperty(t,n??""):e[t]=n==null?"":typeof n!="number"||oT.test(t)?n:n+"px"}function yc(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||ny(e.style,t,"");if(n)for(t in n)i&&n[t]==i[t]||ny(e.style,t,n[t])}else if(t[0]=="o"&&t[1]=="n")o=t!=(t=t.replace(Xv,"$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[fa]=i[fa]:(n[fa]=Ap,e.addEventListener(t,o?Mp:Tp,o)):e.removeEventListener(t,o?Mp:Tp,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 iy(e){return function(t){if(this.l){var n=this.l[t.type+e];if(t[lc]==null)t[lc]=Ap++;else if(t[lc]<n[fa])return;return n(et.event?et.event(t):t)}}}function Dp(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,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=et.__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 gc(E,S),f.constructor=j,f.render=lT),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=_i({},f.__s)),_i(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)}),fc.push.apply(f.__h,f._sb),f._sb=[],f.__h.length&&a.push(f),s=Ar(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=et.__r,I=0,b)f.state=f.__s,f.__d=!1,A&&A(t),l=f.render(f.props,f.state,f.context),fc.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=_i(_i({},i),f.getChildContext())),b&&!d&&f.getSnapshotBeforeUpdate!=null&&(g=f.getSnapshotBeforeUpdate(h,m)),P=l!=null&&l.type===mc&&l.key==null?ay(l.props.children):l,s=ey(e,dc(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),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;$--;)kp(o[$])}else t.__e=n.__e;t.__k==null&&(t.__k=n.__k||[]),L.then||ry(t),et.__e(L,t,n)}}else o==null&&t.__v==n.__v?(t.__k=n.__k,t.__e=n.__e):s=t.__e=uT(n.__e,t,n,i,r,o,a,c,u);return(l=et.diffed)&&l(t),128&t.__u?void 0:s}function ry(e){e&&(e.__c&&(e.__c.__e=!0),e.__k&&e.__k.some(ry))}function oy(e,t,n){for(var i=0;i<n.length;i++)Op(n[i],n[++i],n[++i]);et.__c&&et.__c(t,e),e.some(function(r){try{e=r.__h,r.__h=[],e.some(function(o){o.call(r)})}catch(o){et.__e(o,r.__v)}})}function ay(e){return typeof e!="object"||e==null||e.__b>0?e:dc(e)?e.map(ay):e.constructor!==void 0?null:_i({},e)}function uT(e,t,n,i,r,o,a,s,c){var u,l,p,f,d,h,m,g=n.props||pc,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&&(et.__m&&et.__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&&uc.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||yc(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||yc(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=""),ey(t.type=="template"?e.content:e,dc(f)?f:[f],t,n,i,E=="foreignObject"?"http://www.w3.org/1999/xhtml":r,o,a,o?o[0]:n.__k&&Ar(n,0),s,c),o!=null)for(u=o.length;u--;)kp(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])&&yc(e,u,h,g[u],r),u="checked",m!=null&&m!=e[u]&&yc(e,u,m,g[u],r))}return e}function Op(e,t,n){try{if(typeof e=="function"){var i=typeof e.__u=="function";i&&e.__u(),i&&t==null||(e.__u=e(t))}else e.current=t}catch(r){et.__e(r,n)}}function sy(e,t,n){var i,r;if(et.unmount&&et.unmount(e),(i=e.ref)&&(i.current&&i.current!=e.__e||Op(i,null,t)),(i=e.__c)!=null){if(i.componentWillUnmount)try{i.componentWillUnmount()}catch(o){et.__e(o,t)}i.base=i.__P=i.__n=null}if(i=e.__k)for(r=0;r<i.length;r++)i[r]&&sy(i[r],t,n||typeof e.type!="function");n||kp(e.__e),e.__c=e.__=e.__e=void 0}function lT(e,t,n){return this.constructor(e,n)}function cy(e,t,n){var i,r,o,a;t==document&&(t=document.documentElement),et.__&&et.__(e,t),r=(i=!1)?null:t.__k,o=[],a=[],Dp(t,e=t.__k=Zv(mc,null,[e]),r||pc,pc,t.namespaceURI,r?null:t.firstChild?uc.call(t.childNodes):null,o,r?r.__e:t.firstChild,i,a),oy(o,e,a),e.props.children=null}uc=fc.slice,et={__e:function(e,t,n,i){for(var r,o,a;t=t.__;)if((r=t.__c)&&!r.__)try{if((o=r.constructor)&&o.getDerivedStateFromError!=null&&(r.setState(o.getDerivedStateFromError(e)),a=r.__d),r.componentDidCatch!=null&&(r.componentDidCatch(e,i||{}),a=r.__d),a)return r.__E=r}catch(s){e=s}throw e}},Uv=0,gc.prototype.setState=function(e,t){var n;n=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=_i({},this.state),typeof e=="function"&&(e=e(_i({},n),this.props)),e&&_i(n,e),e!=null&&this.__v&&(t&&this._sb.push(t),Jv(this))},gc.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),Jv(this))},gc.prototype.render=mc,er=[],Yv=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,Kv=function(e,t){return e.__v.__b-t.__v.__b},vc.__r=0,Pp=Math.random().toString(8),lc="__d"+Pp,fa="__a"+Pp,Xv=/(PointerCapture)$|Capture$/i,Ap=0,Tp=iy(!1),Mp=iy(!0);var uy=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,uy(e,s,n,["",null])),i.push(r),s[0]?t[0]|=2:(t[o-2]=0,t[o]=r)):i.push(s)}return i},ly=new Map;function pT(e){var t=ly.get(this);return t||(t=new Map,ly.set(this,t)),(t=uy(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 Ve=pT.bind(Zv),ho,ft,Ip,py,da=0,fy=[],Et=et,dy=Et.__b,hy=Et.__r,my=Et.diffed,gy=Et.__c,vy=Et.unmount,yy=Et.__;function _c(e,t){Et.__h&&Et.__h(ft,e,da||t),da=0;var n=ft.__H||(ft.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({}),n.__[e]}function Lp(e){return da=1,fT(by,e)}function fT(e,t,n){var i=_c(ho++,2);if(i.t=e,!i.__c&&(i.__=[by(void 0,t),function(s){var c=i.__N?i.__N[0]:i.__[0],u=i.t(c,s);c!==u&&(i.__N=[u,i.__[1]],i.__c.setState({}))}],i.__c=ft,!ft.__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};ft.__f=!0;var o=ft.shouldComponentUpdate,a=ft.componentWillUpdate;ft.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)},ft.shouldComponentUpdate=r}return i.__N||i.__}function bc(e,t){var n=_c(ho++,3);!Et.__s&&$p(n.__H,t)&&(n.__=e,n.u=t,ft.__H.__h.push(n))}function Np(e,t){var n=_c(ho++,4);!Et.__s&&$p(n.__H,t)&&(n.__=e,n.u=t,ft.__h.push(n))}function xc(e){return da=5,bi(function(){return{current:e}},[])}function bi(e,t){var n=_c(ho++,7);return $p(n.__H,t)&&(n.__=e(),n.__H=t,n.__h=e),n.__}function ha(e,t){return da=8,bi(function(){return e},t)}function dT(){for(var e;e=fy.shift();){var t=e.__H;if(e.__P&&t)try{t.__h.some(Ec),t.__h.some(Bp),t.__h=[]}catch(n){t.__h=[],Et.__e(n,e.__v)}}}Et.__b=function(e){ft=null,dy&&dy(e)},Et.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),yy&&yy(e,t)},Et.__r=function(e){hy&&hy(e),ho=0;var t=(ft=e.__c).__H;t&&(Ip===ft?(t.__h=[],ft.__h=[],t.__.some(function(n){n.__N&&(n.__=n.__N),n.u=n.__N=void 0})):(t.__h.some(Ec),t.__h.some(Bp),t.__h=[],ho=0)),Ip=ft},Et.diffed=function(e){my&&my(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(fy.push(t)!==1&&py===Et.requestAnimationFrame||((py=Et.requestAnimationFrame)||hT)(dT)),t.__H.__.some(function(n){n.u&&(n.__H=n.u,n.u=void 0)})),Ip=ft=null},Et.__c=function(e,t){t.some(function(n){try{n.__h.some(Ec),n.__h=n.__h.filter(function(i){return!i.__||Bp(i)})}catch(i){t.some(function(r){r.__h&&(r.__h=[])}),t=[],Et.__e(i,n.__v)}}),gy&&gy(e,t)},Et.unmount=function(e){vy&&vy(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.some(function(i){try{Ec(i)}catch(r){t=r}}),n.__H=void 0,t&&Et.__e(t,n.__v))};var _y=typeof requestAnimationFrame=="function";function hT(e){var t,n=function(){clearTimeout(i),_y&&cancelAnimationFrame(t),setTimeout(e)},i=setTimeout(n,35);_y&&(t=requestAnimationFrame(n))}function Ec(e){var t=ft,n=e.__c;typeof n=="function"&&(e.__c=void 0,n()),ft=t}function Bp(e){var t=ft;e.__c=e.__(),ft=t}function $p(e,t){return!e||e.length!==t.length||t.some(function(n,i){return n!==e[i]})}function by(e,t){return typeof t=="function"?t(e):t}function mT(e){const{navigationStack:t,setNavigationStack:n}=e,i=bi(()=>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 Ve`
11
11
  <div class="djs-popup-breadcrumbs">
12
- ${r&&He`
12
+ ${r&&Ve`
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)=>He`
25
+ ${i.map((a,s)=>Ve`
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&&He`
37
+ ${o&&Ve`
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 Yv(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=Yv(e[t]))&&(i&&(i+=" "),i+=n)}else for(n in e)e[n]&&(i&&(i+=" "),i+=n);return i}function oc(){for(var e,t,n=0,i="",r=arguments.length;n<r;n++)(e=arguments[n])&&(t=Yv(e))&&(i&&(i+=" "),i+=t);return i}function HA(e){const{headerEntries:t,onSelect:n,selectedEntry:i,setSelectedEntry:r,title:o}=e,a=ai(()=>zA(t),[t]),s=u=>u.action&&!u.disabled,c=(u,l)=>{if(s(l))return n(u,l)};return He`
43
+ `}function xy(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=xy(e[t]))&&(i&&(i+=" "),i+=n)}else for(n in e)e[n]&&(i&&(i+=" "),i+=n);return i}function wc(){for(var e,t,n=0,i="",r=arguments.length;n<r;n++)(e=arguments[n])&&(t=xy(e))&&(i&&(i+=" "),i+=t);return i}function gT(e){const{headerEntries:t,onSelect:n,selectedEntry:i,setSelectedEntry:r,title:o}=e,a=bi(()=>vT(t),[t]),s=u=>u.action&&!u.disabled,c=(u,l)=>{if(s(l))return n(u,l)};return Ve`
44
44
  <div class="djs-popup-header">
45
45
  <h3 class="djs-popup-title" title=${o}>${o}</h3>
46
- ${a.map(u=>He`
46
+ ${a.map(u=>Ve`
47
47
  <ul key=${u.id} class="djs-popup-header-group" data-header-group=${u.id}>
48
48
 
49
- ${u.entries.map(l=>He`
49
+ ${u.entries.map(l=>Ve`
50
50
  <li key=${l.id}>
51
51
  <${s(l)?"button":"span"}
52
- class=${VA(l,l===i)}
52
+ class=${yT(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&&He`<img class="djs-popup-entry-icon" src=${l.imageUrl} alt="" />`||l.imageHtml&&He`<div class="djs-popup-entry-icon" dangerouslySetInnerHTML=${{__html:l.imageHtml}} />`}
63
- ${l.label?He`
62
+ ${l.imageUrl&&Ve`<img class="djs-popup-entry-icon" src=${l.imageUrl} alt="" />`||l.imageHtml&&Ve`<div class="djs-popup-entry-icon" dangerouslySetInnerHTML=${{__html:l.imageHtml}} />`}
63
+ ${l.label?Ve`
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 zA(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 VA(e,t){return oc("entry",e.className,e.active?"active":"",e.disabled?"disabled":"",t?"selected":"")}function Kv(e,t){return`${e}-entry-${t.id}`}function GA(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 He`
72
+ `}function vT(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 yT(e,t){return wc("entry",e.className,e.active?"active":"",e.disabled?"disabled":"",t?"selected":"")}function Ey(e,t){return`${e}-entry-${t.id}`}function _T(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 Ve`
73
73
  <li
74
- class=${oc("entry",{selected:i,disabled:n.disabled})}
74
+ class=${wc("entry",{selected:i,disabled:n.disabled})}
75
75
  data-id=${n.id}
76
- id=${Kv(t,n)}
76
+ id=${Ey(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=${oc("djs-popup-entry-name",n.className)}
90
+ class=${wc("djs-popup-entry-name",n.className)}
91
91
  >
92
- ${n.imageUrl&&He`<img class="djs-popup-entry-icon" src=${n.imageUrl} alt="" />`||n.imageHtml&&He`<div class="djs-popup-entry-icon" dangerouslySetInnerHTML=${{__html:n.imageHtml}} />`}
92
+ ${n.imageUrl&&Ve`<img class="djs-popup-entry-icon" src=${n.imageUrl} alt="" />`||n.imageHtml&&Ve`<div class="djs-popup-entry-icon" dangerouslySetInnerHTML=${{__html:n.imageHtml}} />`}
93
93
 
94
- ${n.label?He`
94
+ ${n.label?Ve`
95
95
  <span class="djs-popup-label">
96
96
  ${n.label}
97
97
  </span>
98
98
  `:null}
99
99
 
100
- ${n.documentationRef&&He`
100
+ ${n.documentationRef&&Ve`
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&&He`
117
+ ${n.description&&Ve`
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&&He`
125
+ ${n.entries&&Ve`
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 WA(e){const{selectedEntry:t,setSelectedEntry:n,groupedEntries:i,keyboardSelection:r,idPrefix:o,id:a,ariaLabel:s,tabIndex:c,ariaActivedescendant:u,...l}=e,p=ic();hp(()=>{if(!r||!r.current)return;const m=p.current;if(!m)return;const g=m.querySelector(".selected");g&&UA(g)},[t]);const f=()=>{r.current=!1},d=m=>{r.current||n(m)},h=()=>{r.current||n(null)};return He`
133
+ `}function bT(e){const{selectedEntry:t,setSelectedEntry:n,groupedEntries:i,keyboardSelection:r,idPrefix:o,id:a,ariaLabel:s,tabIndex:c,ariaActivedescendant:u,...l}=e,p=xc();Np(()=>{if(!r||!r.current)return;const m=p.current;if(!m)return;const g=m.querySelector(".selected");g&&xT(g)},[t]);const f=()=>{r.current=!1},d=m=>{r.current||n(m)},h=()=>{r.current||n(null)};return Ve`
134
134
  <div
135
135
  class="djs-popup-results"
136
136
  ref=${p}
@@ -141,9 +141,9 @@
141
141
  aria-activedescendant=${u}
142
142
  onMouseMove=${f}
143
143
  >
144
- ${i.map(m=>He`
145
- ${m.name&&He`
146
- <div key=${m.id} id=${Xv(o,m)} class="entry-header" title=${m.name}>
144
+ ${i.map(m=>Ve`
145
+ ${m.name&&Ve`
146
+ <div key=${m.id} id=${wy(o,m)} class="entry-header" title=${m.name}>
147
147
  ${m.name}
148
148
  </div>
149
149
  `}
@@ -151,10 +151,10 @@
151
151
  class="djs-popup-group"
152
152
  data-group=${m.id}
153
153
  role="group"
154
- aria-labelledby=${m.name?Xv(o,m):void 0}
154
+ aria-labelledby=${m.name?wy(o,m):void 0}
155
155
  >
156
- ${m.entries.map(g=>He`
157
- <${GA}
156
+ ${m.entries.map(g=>Ve`
157
+ <${_T}
158
158
  key=${g.id}
159
159
  idPrefix=${o}
160
160
  entry=${g}
@@ -167,10 +167,10 @@
167
167
  </ul>
168
168
  `)}
169
169
  </div>
170
- `}function Xv(e,t){return`${e}-group-${t.id}`}function UA(e){typeof e.scrollIntoViewIfNeeded=="function"?e.scrollIntoViewIfNeeded():e.scrollIntoView({scrollMode:"if-needed",block:"nearest"})}const qA=new Vr("djs-popup");function YA(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]=dp([]);nc(()=>{g([])},[f]);const[w,E]=dp(""),b=w.trim().length>0,x=ai(()=>ZA(f),[f]),S=ai(()=>ht(u)?x.length>5:!1,[u,x]),A=ai(()=>{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=ai(()=>b?A.length?[{id:"default",entries:A}]:[]:QA(A),[A,b]),[C,$]=dp(A[0]),j=ic(null),L=ic(!1),F=ai(()=>qA.next(),[]),te=`${F}-results`,ke=C&&Kv(F,C);nc(()=>{const B=j.current;B&&A.includes(B)?$(B):$(A[0]),j.current=null},[A]);const Je=Qo(B=>{const N=XA(I);let Ee=N.indexOf(C)+B;Ee<0&&(Ee=N.length-1),Ee>=N.length&&(Ee=0),L.current=!0,$(N[Ee])},[I,C]),q=Qo(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]),ne=Qo((B,N,V)=>{if(!(!N||N.disabled))return N.entries?(B.preventDefault(),q(1)):n(B,N,V)},[n,q]),ce=Qo(B=>{if(B.key==="Enter"&&C){const N=B.target;return!!er(N,"a, button",!0)||C.disabled?void 0:ne(B,C)}if(B.key==="Backspace"){const N=B.target;if(!(Qc(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,ne]),ee=Qo(B=>{Qc(B.target,"input")&&E(()=>B.target.value)},[E]);nc(()=>(d(),()=>{h()}),[]);const ae=!b&&m.length>0,Y=(a||r.length>0)&&!ae;return He`
171
- <${Zv}
170
+ `}function wy(e,t){return`${e}-group-${t.id}`}function xT(e){typeof e.scrollIntoViewIfNeeded=="function"?e.scrollIntoViewIfNeeded():e.scrollIntoView({scrollMode:"if-needed",block:"nearest"})}const ET=new oo("djs-popup");function wT(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]=Lp([]);bc(()=>{g([])},[f]);const[w,E]=Lp(""),b=w.trim().length>0,x=bi(()=>CT(f),[f]),S=bi(()=>yt(u)?x.length>5:!1,[u,x]),A=bi(()=>{const N=m.length?m[m.length-1].entries:f;return S?b?p(x.filter(({searchable:B})=>B!==!1),w,{keys:["label","search","description"]}).map(({item:B})=>B):N.filter(({rank:B=0})=>B>=0):N},[S,b,x,w,p,m,f]),I=bi(()=>b?A.length?[{id:"default",entries:A}]:[]:PT(A),[A,b]),[P,$]=Lp(A[0]),j=xc(null),L=xc(!1),F=bi(()=>ET.next(),[]),ie=`${F}-results`,Pe=P&&Ey(F,P);bc(()=>{const N=j.current;N&&A.includes(N)?$(N):$(A[0]),j.current=null},[A]);const nt=ha(N=>{const B=RT(I);let be=B.indexOf(P)+N;be<0&&(be=B.length-1),be>=B.length&&(be=0),L.current=!0,$(B[be])},[I,P]),q=ha(N=>{N>0&&P&&P.entries&&(L.current=!0,g(B=>[...B,P])),N<0&&m.length>0&&(L.current=!0,j.current=m[m.length+N],g(B=>B.slice(0,N)))},[P,m]),re=ha((N,B,V)=>{if(!(!B||B.disabled))return B.entries?(N.preventDefault(),q(1)):n(N,B,V)},[n,q]),ce=ha(N=>{if(N.key==="Enter"&&P){const B=N.target;return!!mr(B,"a, button",!0)||P.disabled?void 0:re(N,P)}if(N.key==="Backspace"){const B=N.target;if(!(bu(B,"input")&&B.value!==""))return q(-1),N.preventDefault()}if(N.key==="ArrowUp")return nt(-1),N.preventDefault();if(N.key==="ArrowDown")return nt(1),N.preventDefault();if(N.key==="ArrowRight")return q(1),N.preventDefault();if(N.key==="ArrowLeft")return q(-1),N.preventDefault()},[P,nt,q,re]),oe=ha(N=>{bu(N.target,"input")&&E(()=>N.target.value)},[E]);bc(()=>(d(),()=>{h()}),[]);const se=!b&&m.length>0,K=(a||r.length>0)&&!se;return Ve`
171
+ <${Sy}
172
172
  onClose=${t}
173
- onKeyup=${ee}
173
+ onKeyup=${oe}
174
174
  onKeydown=${ce}
175
175
  className=${i}
176
176
  position=${o}
@@ -178,25 +178,25 @@
178
178
  scale=${c}
179
179
  navigationStack=${m}
180
180
  >
181
- ${Y&&He`
182
- <${HA}
181
+ ${K&&Ve`
182
+ <${gT}
183
183
  headerEntries=${r}
184
184
  onSelect=${n}
185
- selectedEntry=${C}
185
+ selectedEntry=${P}
186
186
  setSelectedEntry=${$}
187
187
  title=${a}
188
188
  />
189
189
  `}
190
- ${ae&&He`
191
- <${FA}
190
+ ${se&&Ve`
191
+ <${mT}
192
192
  navigationStack=${m}
193
193
  setNavigationStack=${g}
194
194
  />
195
195
  `}
196
- ${f.length>0&&He`
196
+ ${f.length>0&&Ve`
197
197
  <div class="djs-popup-body">
198
198
 
199
- ${S&&He`
199
+ ${S&&Ve`
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=${te}
211
- aria-activedescendant=${ke||void 0}
210
+ aria-controls=${ie}
211
+ aria-activedescendant=${Pe||void 0}
212
212
  aria-autocomplete="list"
213
213
  />
214
214
  </div>
215
215
  `}
216
216
 
217
- ${b&&He`
217
+ ${b&&Ve`
218
218
  <div class="djs-popup-search-count" aria-live="polite">
219
219
  ${A.length} ${A.length===1?"result":"results"} found
220
220
  </div>
221
221
  `}
222
222
 
223
- <${WA}
223
+ <${bT}
224
224
  groupedEntries=${I}
225
- selectedEntry=${C}
225
+ selectedEntry=${P}
226
226
  setSelectedEntry=${$}
227
227
  keyboardSelection=${L}
228
- onAction=${ne}
228
+ onAction=${re}
229
229
  idPrefix=${F}
230
- id=${te}
230
+ id=${ie}
231
231
  ariaLabel=${a||"Results"}
232
232
  tabIndex=${S?-1:0}
233
- ariaActivedescendant=${S?void 0:ke||void 0}
233
+ ariaActivedescendant=${S?void 0:Pe||void 0}
234
234
  />
235
235
 
236
- ${C&&C.documentationRef&&He`
236
+ ${P&&P.documentationRef&&Ve`
237
237
  <div class="djs-popup-footer">
238
238
  <a
239
239
  class="djs-popup-footer-docs"
240
- href=${C.documentationRef}
241
- onClick=${B=>B.stopPropagation()}
242
- aria-label=${C.label?`Open entry documentation for ${C.label}`:"Open entry documentation"}
240
+ href=${P.documentationRef}
241
+ onClick=${N=>N.stopPropagation()}
242
+ aria-label=${P.label?`Open entry documentation for ${P.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&&A.length===0&&He`
257
- <div class="djs-popup-no-results">${xt(l)?l(w):l}</div>
256
+ ${l&&A.length===0&&Ve`
257
+ <div class="djs-popup-no-results">${Ct(l)?l(w):l}</div>
258
258
  `}
259
- </${Zv}>
260
- `}function Zv(e){const{onClose:t,onKeydown:n,onKeyup:i,className:r,children:o,navigationStack:a,position:s}=e,c=ic();return hp(()=>{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]),hp(()=>{const u=c.current;if(!u)return;(u.querySelector("input")||u.querySelector('[role="listbox"]')||u).focus()},[a]),nc(()=>{const u=p=>{if(p.key==="Escape")return p.preventDefault(),t()},l=p=>{if(!er(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)}},[]),He`
259
+ </${Sy}>
260
+ `}function Sy(e){const{onClose:t,onKeydown:n,onKeyup:i,className:r,children:o,navigationStack:a,position:s}=e,c=xc();return Np(()=>{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]),Np(()=>{const u=c.current;if(!u)return;(u.querySelector("input")||u.querySelector('[role="listbox"]')||u).focus()},[a]),bc(()=>{const u=p=>{if(p.key==="Escape")return p.preventDefault(),t()},l=p=>{if(!mr(p.target,".djs-popup",!0))return t()};return document.documentElement.addEventListener("keydown",u),document.body.addEventListener("click",l,!0),()=>{document.documentElement.removeEventListener("keydown",u),document.body.removeEventListener("click",l,!0)}},[]),Ve`
261
261
  <div
262
- class=${oc("djs-popup",r)}
263
- style=${KA(e)}
262
+ class=${wc("djs-popup",r)}
263
+ style=${ST(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 KA(e){const{width:t}=e,n=typeof t=="number"?`${t}px`:t;return{transform:`scale(${e.scale})`,width:ht(t)?n:void 0,maxWidth:ht(t)?"unset":void 0,"transform-origin":"top left"}}function XA(e){const t=[];return e.forEach(n=>{n.entries.forEach(i=>{t.push(i)})}),t}function ZA(e){const t=[];function n(i){i.forEach(r=>{if(r.entries){n(r.entries);return}t.push(r)})}return n(e),t}function QA(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 JA="data-id",Qv=["contextPad.close","canvas.viewbox.changing","commandStack.changed"],eT=1e3;function Qe(e,t,n,i){this._eventBus=t,this._canvas=n,this._search=i,this._current=null;var r=ht(e&&e.scale)?e.scale:{min:1,max:1};this._config={scale:r},t.on("diagram.destroy",()=>{this.close()}),t.on("element.changed",o=>{const a=this.isOpen()&&this._current.target;o.element===a&&this.refresh()})}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=Jv(n),s=Object.entries(i).map(([f,d])=>({id:f,...d})),c=e&&(f=>this._ensureVisible(f,e)),u=this._updateScale(this._current.container);Lv(He`
272
- <${YA}
271
+ `}function ST(e){const{width:t}=e,n=typeof t=="number"?`${t}px`:t;return{transform:`scale(${e.scale})`,width:yt(t)?n:void 0,maxWidth:yt(t)?"unset":void 0,"transform-origin":"top left"}}function RT(e){const t=[];return e.forEach(n=>{n.entries.forEach(i=>{t.push(i)})}),t}function CT(e){const t=[];function n(i){i.forEach(r=>{if(r.entries){n(r.entries);return}t.push(r)})}return n(e),t}function PT(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 AT="data-id",Ry=["contextPad.close","canvas.viewbox.changing","commandStack.changed"],TT=1e3;function tt(e,t,n,i){this._eventBus=t,this._canvas=n,this._search=i,this._current=null;var r=yt(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()})}tt.$inject=["config.popupMenu","eventBus","canvas","search"],tt.prototype._render=function(){const{position:e,providerId:t,entries:n,headerEntries:i,emptyPlaceholder:r,options:o}=this._current,a=Cy(n),s=Object.entries(i).map(([f,d])=>({id:f,...d})),c=e&&(f=>this._ensureVisible(f,e)),u=this._updateScale(this._current.container);cy(Ve`
272
+ <${wT}
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)},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;Lv(null,e),On(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=We(`<div class="djs-popup-parent djs-scrollable" data-popup=${e.provider}></div>`);return n.appendChild(i),i},Qe.prototype._bindAutoClose=function(){this._eventBus.once(Qv,this.close,this)},Qe.prototype._unbindAutoClose=function(){this._eventBus.off(Qv,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),ht(n)&&e<n&&(r=n),ht(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=eT),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 P(t,function(i){if(!i.getPopupMenuEntries){P(i.getEntries(e),function(o){var a=o.id;if(!a)throw new Error("entry ID is missing");n[a]=An(o,["id"])});return}var r=i.getPopupMenuEntries(e);xt(r)?n=r(n):P(r,function(o,a){n[a]=o})}),n},Qe.prototype._getHeaderEntries=function(e,t){var n={};return P(t,function(i){if(!i.getPopupMenuHeaderEntries){if(!i.getHeaderEntries)return;P(i.getHeaderEntries(e),function(o){var a=o.id;if(!a)throw new Error("entry ID is missing");n[a]=An(o,["id"])});return}var r=i.getPopupMenuHeaderEntries(e);xt(r)?n=r(n):P(r,function(o,a){n[a]=o})}),n},Qe.prototype._getEmptyPlaceholder=function(e){const t=e.find(n=>xt(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=er(e.delegateTarget||e.target,".entry",!0),o=Lt(r,JA);t={id:o,...this._getEntry(o)}}const i=t.action;if(this._emit("trigger",{entry:t,event:e})!==!1){if(xt(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 Jv(e,t=[]){return Object.entries(e).map(([n,i])=>{const r={id:n,...i};return r.entries?r.entries=Jv(r.entries,[...t,...ey(r.search)]):t.length&&(r.search=[...t,...ey(r.search)]),r})}function ey(e){return e?pe(e)?e:[e]:[]}function tT(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=nT(o,r,i);return a?{item:o,tokens:a}:[]}).sort(iT(i))}function nT(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}=oy(p,t);return{tokens:[...l.tokens,f],matchedWords:{...l.matchedWords,...d}}},{matchedWords:{},tokens:[]}):oy(s,t);return{tokens:{...o.tokens,[a]:c},matchedWords:{...o.matchedWords,...u}}},{matchedWords:{},tokens:{}});return Object.keys(i).length!==t.length?null:r}function iT(e){return(t,n)=>{let i=0,r=1;for(const o of e){const a=rT(t.tokens[o],n.tokens[o]);if(a!==0){i+=a*r,r*=ty;continue}const s=oT(t.item[o],n.item[o]);if(s!==0){i+=s*r,r*=ty;continue}}return i}}function rT(e,t){return ny(t)-ny(e)}const ty=.5,Qr={FULL:131.9,START_FULL_WORD:8,START_WORD_PART:7.87,WORD_START:2.19,WORD_PART:1,NO_MATCH:-.07};function ny(e){const t=e.reduce((s,c)=>s+iy(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 iy(e){if(pe(e))return Math.max(...e.map(iy));const t=Math.log(e.value.length);return e.match?(e.start?e.end?Qr.FULL:e.wordEnd?Qr.START_FULL_WORD:Qr.START_WORD_PART:e.wordStart?Qr.WORD_START:Qr.WORD_PART)*t:Qr.NO_MATCH*t}function ry(e=""){return pe(e)?e.join(", "):e}function oT(e,t){return ry(e).localeCompare(ry(t))}function oy(e,t){var u;if(!e)return{tokens:[],matchedWords:{}};const n=[],i={},r=t.map(aT),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 aT(e){return e.replace(/[/\-\\^$*+?.()|[\]{}]/g,"\\$&")}const ay={search:["value",tT]},vp={__depends__:[ay],__init__:["popupMenu"],popupMenu:["type",Qe]};var sy={align:`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 2000 2000">
286
+ `,this._current.container)},tt.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()},tt.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()},tt.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)}},tt.prototype.close=function(){this.isOpen()&&(this._emit("close"),this.reset(),this._canvas.restoreFocus(),this._current=null)},tt.prototype.reset=function(){const e=this._current.container;cy(null,e),Un(e)},tt.prototype._emit=function(e,t){this._eventBus.fire(`popupMenu.${e}`,t)},tt.prototype._onOpened=function(){this._emit("opened")},tt.prototype._onClosed=function(){this._emit("closed")},tt.prototype._createContainer=function(e){var t=this._canvas,n=t.getContainer();const i=Ue(`<div class="djs-popup-parent djs-scrollable" data-popup=${e.provider}></div>`);return n.appendChild(i),i},tt.prototype._bindAutoClose=function(){this._eventBus.once(Ry,this.close,this)},tt.prototype._unbindAutoClose=function(){this._eventBus.off(Ry,this.close,this)},tt.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),yt(n)&&e<n&&(r=n),yt(i)&&e>i&&(r=i)),r},tt.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}},tt.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},tt.prototype.registerProvider=function(e,t,n){n||(n=t,t=TT),this._eventBus.on("popupMenu.getProviders."+e,t,function(i){i.providers.push(n)})},tt.prototype._getProviders=function(e){var t=this._eventBus.createEvent({type:"popupMenu.getProviders."+e,providers:[]});return this._eventBus.fire(t),t.providers},tt.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]=zn(o,["id"])});return}var r=i.getPopupMenuEntries(e);Ct(r)?n=r(n):T(r,function(o,a){n[a]=o})}),n},tt.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]=zn(o,["id"])});return}var r=i.getPopupMenuHeaderEntries(e);Ct(r)?n=r(n):T(r,function(o,a){n[a]=o})}),n},tt.prototype._getEmptyPlaceholder=function(e){const t=e.find(n=>Ct(n.getEmptyPlaceholder));return t&&t.getEmptyPlaceholder()},tt.prototype.isOpen=function(){return!!this._current},tt.prototype.trigger=function(e,t,n="click"){if(e.preventDefault(),!t){let r=mr(e.delegateTarget||e.target,".entry",!0),o=zt(r,AT);t={id:o,...this._getEntry(o)}}const i=t.action;if(this._emit("trigger",{entry:t,event:e})!==!1){if(Ct(i)){if(n==="click")return i(e,t)}else if(i[n])return i[n](e,t)}},tt.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 Cy(e,t=[]){return Object.entries(e).map(([n,i])=>{const r={id:n,...i};return r.entries?r.entries=Cy(r.entries,[...t,...Py(r.search)]):t.length&&(r.search=[...t,...Py(r.search)]),r})}function Py(e){return e?le(e)?e:[e]:[]}function MT(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=kT(o,r,i);return a?{item:o,tokens:a}:[]}).sort(DT(i))}function kT(e,t,n){const{matchedWords:i,tokens:r}=n.reduce((o,a)=>{const s=e[a],{tokens:c,matchedWords:u}=le(s)?s.reduce((l,p)=>{const{tokens:f,matchedWords:d}=Dy(p,t);return{tokens:[...l.tokens,f],matchedWords:{...l.matchedWords,...d}}},{matchedWords:{},tokens:[]}):Dy(s,t);return{tokens:{...o.tokens,[a]:c},matchedWords:{...o.matchedWords,...u}}},{matchedWords:{},tokens:{}});return Object.keys(i).length!==t.length?null:r}function DT(e){return(t,n)=>{let i=0,r=1;for(const o of e){const a=OT(t.tokens[o],n.tokens[o]);if(a!==0){i+=a*r,r*=Ay;continue}const s=IT(t.item[o],n.item[o]);if(s!==0){i+=s*r,r*=Ay;continue}}return i}}function OT(e,t){return Ty(t)-Ty(e)}const Ay=.5,mo={FULL:131.9,START_FULL_WORD:8,START_WORD_PART:7.87,WORD_START:2.19,WORD_PART:1,NO_MATCH:-.07};function Ty(e){const t=e.reduce((s,c)=>s+My(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 My(e){if(le(e))return Math.max(...e.map(My));const t=Math.log(e.value.length);return e.match?(e.start?e.end?mo.FULL:e.wordEnd?mo.START_FULL_WORD:mo.START_WORD_PART:e.wordStart?mo.WORD_START:mo.WORD_PART)*t:mo.NO_MATCH*t}function ky(e=""){return le(e)?e.join(", "):e}function IT(e,t){return ky(e).localeCompare(ky(t))}function Dy(e,t){var u;if(!e)return{tokens:[],matchedWords:{}};const n=[],i={},r=t.map(LT),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 LT(e){return e.replace(/[/\-\\^$*+?.()|[\]{}]/g,"\\$&")}const Oy={search:["value",MT]},jp={__depends__:[Oy],__init__:["popupMenu"],popupMenu:["type",tt]};var Iy={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>`},sT=900;function Jr(e,t,n,i){e.registerProvider(sT,this),this._contextPad=e,this._popupMenu=t,this._translate=n,this._canvas=i}Jr.$inject=["contextPad","popupMenu","translate","canvas"],Jr.prototype.getMultiElementContextPadEntries=function(e){var t={};return this._isAllowed(e)&&k(t,this._getEntries(e)),t},Jr.prototype._isAllowed=function(e){return!this._popupMenu.isEmpty(e,"align-elements")},Jr.prototype._getEntries=function(){var e=this;return{"align-elements":{group:"align-elements",title:e._translate("Align elements"),html:`<div class="entry">${sy.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)}}}}},Jr.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 cT=["left","center","right","top","middle","bottom"];function Jo(e,t,n,i){this._alignElements=t,this._translate=n,this._popupMenu=e,this._rules=i,e.registerProvider("align-elements",this)}Jo.$inject=["popupMenu","alignElements","translate","rules"],Jo.prototype.getPopupMenuEntries=function(e){var t={};return this._isAllowed(e)&&k(t,this._getEntries(e)),t},Jo.prototype._isAllowed=function(e){return this._rules.allowed("elements.align",{elements:e})},Jo.prototype._getEntries=function(e){var t=this._alignElements,n=this._translate,i=this._popupMenu,r={};return P(cT,function(o){r["align-elements-"+o]={group:"align",title:n("Align elements "+o),className:"bjs-align-elements-menu-entry",imageHtml:sy[o],action:function(){t.trigger(e,o),i.close()}}}),r};function ac(e){mn.call(this,e)}ac.$inject=["eventBus"],X(ac,mn),ac.prototype.init=function(){this.addRule("elements.align",function(e){var t=e.elements,n=Re(t,function(i){return!(i.waypoints||i.host||i.labelTarget)});return n=Ta(n),n.length<2?!1:n})};const uT={__depends__:[bA,yv,vp],__init__:["alignElementsContextPadProvider","alignElementsMenuProvider","bpmnAlignElements"],alignElementsContextPadProvider:["type",Jr],alignElementsMenuProvider:["type",Jo],bpmnAlignElements:["type",ac]};function si(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=Mc(_r(a.closure.topLevel)),c=a.hints,u=c?c.autoResize:!0;if(u!==!1){var l=br(s,function(p){return p.parent.id});P(l,function(p,f){pe(u)&&(p=p.filter(function(d){return ze(u,xr({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)})}si.$inject=["eventBus","elementRegistry","modeling","rules"],X(si,W),si.prototype._getOptimalBounds=function(e,t){var n=this.getOffset(t),i=this.getPadding(t),r=ue(at(e)),o=ue(t),a={};return r.top-o.top<i.top&&(a.top=r.top-n.top),r.left-o.left<i.left&&(a.left=r.left-n.left),o.right-r.right<i.right&&(a.right=r.right+n.right),o.bottom-r.bottom<i.bottom&&(a.bottom=r.bottom+n.bottom),Da(k({},o,a))},si.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(lT(i,t)){var r=pT(Sn(t,["x","y","width","height"]),i);this.resize(t,i,{autoResize:r});var o=t.parent;o&&this._expand([t],o)}}},si.prototype.getOffset=function(e){return{top:60,bottom:60,left:100,right:100}},si.prototype.getPadding=function(e){return{top:2,bottom:2,left:15,right:15}},si.prototype.resize=function(e,t,n){this._modeling.resizeShape(e,t,null,n)};function lT(e,t){return e.x!==t.x||e.y!==t.y||e.width!==t.width||e.height!==t.height}function pT(e,t){var n="";return e=ue(e),t=ue(t),e.top>t.top&&(n=n.concat("n")),e.right<t.right&&(n=n.concat("w")),e.bottom<t.bottom&&(n=n.concat("s")),e.left>t.left&&(n=n.concat("e")),n}function sc(e){e.invoke(si,this)}sc.$inject=["injector"],X(sc,si),sc.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 ea(e){mn.call(this,e);var t=this;this.addRule("element.autoResize",function(n){return t.canResize(n.elements,n.target)})}ea.$inject=["eventBus"],X(ea,mn),ea.prototype.canResize=function(e,t){return!1};function cc(e,t){ea.call(this,e),this._modeling=t}X(cc,ea),cc.$inject=["eventBus","modeling"],cc.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 P(e,function(i){if(y(i,"bpmn:Lane")||xe(i)){n=!1;return}}),n};const fT={__init__:["bpmnAutoResize","bpmnAutoResizeProvider"],bpmnAutoResize:["type",sc],bpmnAutoResizeProvider:["type",cc]};function eo(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()})}eo.$inject=["config.autoScroll","eventBus","canvas"],eo.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++)dT(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 dT(e,t,n){return t<e&&e<n}eo.prototype.stopScroll=function(){clearTimeout(this._scrolling)},eo.prototype.setOptions=function(e){this._opts=k({},this._opts,e)},eo.prototype._toBorderPoint=function(e){var t=this._canvas._container.getBoundingClientRect(),n=ar(e.originalEvent);return{x:n.x-t.left,y:n.y-t.top}};const hT={__depends__:[ti],__init__:["autoScroll"],autoScroll:["type",eo]};var cy="djs-bendpoint",uy="djs-segment-dragger";function mT(e,t){var n=ar(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 yp(e,t,n){var i=mT(e,n),r=Bu(t,i);return r}function _p(e,t){var n=oe("g");Me(n).add(cy),ye(e,n);var i=oe("circle");Z(i,{cx:0,cy:0,r:4}),Me(i).add("djs-visual"),ye(n,i);var r=oe("circle");return Z(r,{cx:0,cy:0,r:10}),Me(r).add("djs-hit"),ye(n,r),t&&Me(n).add(t),n}function gT(e,t,n,i){var r=oe("g");ye(e,r);var o=18,a=6,s=11,c=yT(t,n,i),u=a+s,l=oe("rect");Z(l,{x:-o/2,y:-a/2,width:o,height:a}),Me(l).add("djs-visual"),ye(r,l);var p=oe("rect");return Z(p,{x:-c/2,y:-u/2,width:c,height:u}),Me(p).add("djs-hit"),ye(r,p),Ld(r,i==="v"?90:0),r}function ly(e,t,n){var i=oe("g"),r=pu(t,n),o=Kn(t,n);return ye(e,i),gT(i,t,n,o),Me(i).add(uy),Me(i).add(o==="h"?"horizontal":"vertical"),Ct(i,r.x,r.y),i}function bp(e){return Math.abs(Math.round(e*2/3))}function vT(e,t){var n=_T(e,t);return zu(e,n)}function yT(e,t,n){var i=t.x-e.x,r=t.y-e.y;return bp(n==="h"?i:r)}function _T(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=xh(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,te;return A<=0||b.bendpoint?!1:(C=x[A-1],$=x[A],j=pu(C,$),L=Kn(C,$),F=Math.abs(I.x-j.x),te=Math.abs(I.y-j.y),L&&F<=S&&te<=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=Kn(A.start,A.end),!I)?null:(I==="h"?C=A.end.x-A.start.x:C=A.end.y-A.start.y,$=bp(C)/2,$)}function s(b,x){var S=x.waypoints,A=yp(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){ve.bind(b,x,function(A){n.triggerMouseEvent(x,A,S),A.stopPropagation()})}function u(b,x){var S=t.getLayer("overlays"),A=$e('.djs-bendpoints[data-element-id="'+Yo(b.id)+'"]',S);return!A&&x&&(A=oe("g"),Z(A,{"data-element-id":b.id}),Me(A).add("djs-bendpoints"),ye(S,A),c(A,"mousedown",b),c(A,"click",b),c(A,"dblclick",b)),A}function l(b,x){return $e('.djs-segment-dragger[data-segment-idx="'+b+'"]',x)}function p(b,x){x.waypoints.forEach(function(S,A){var I=_p(b);ye(b,I),Ct(I,S.x,S.y)}),_p(b,"floating")}function f(b,x){for(var S=x.waypoints,A,I,C,$=1;$<S.length;$++)A=S[$-1],I=S[$],Kn(A,I)&&(C=ly(b,A,I),Z(C,{"data-segment-idx":$}),c(C,"mousemove",x))}function d(b){P(Ra("."+cy,b),function(x){gt(x)})}function h(b){P(Ra("."+uy,b),function(x){gt(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=$e(".floating",b),A=x.point;S&&(Ct(S,A.x,A.y),Me(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=pu(I,C),L=Kn(I,C),F,te;A&&(F=bT(A),te={x:$.x-j.x,y:$.y-j.y},L==="v"&&(te={x:te.y,y:te.x}),Ct(F,te.x,te.y))}e.on("connection.changed",function(b){g(b.element)}),e.on("connection.remove",function(b){var x=u(b.element);x&&gt(x)}),e.on("element.marker.update",function(b){var x=b.element,S;x.waypoints&&(S=m(x),b.add?Me(S).add(b.marker):Me(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=yp(t,S,b.originalEvent),!I)return;w(A,I),I.bendpoint||E(A,I,S)}}),e.on("element.mousedown",function(b){if(Ti(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=$e(".floating",S);A&&Me(A).remove("positioned")}}}),e.on("element.updateId",function(b){var x=b.element,S=b.newId;if(x.waypoints){var A=u(x);A&&Z(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 bT(e){return $e(".djs-visual",e)}var fy=Math.round,hr="reconnectStart",mr="reconnectEnd",ta="updateWaypoints";function xp(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=hr:!u&&c===d.length-1?h=mr:h=ta;var m=h===ta?"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===ta?"connection.updateWaypoints":"connection.reconnect";if(d=s.allowed=r.allowed(h,{connection:c,source:f===hr?p:u,target:f===mr?p:l}),d){s.source=f===hr?p:u,s.target=f===mr?p:l;return}d===!1&&(d=s.allowed=r.allowed(h,{connection:c,source:f===mr?p:l,target:f===hr?p:u})),d&&(s.source=f===mr?p:l,s.target=f===hr?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!==ta&&(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:fy(a.x),y:fy(a.y)};if(!c)return!1;m===ta?(p?f.splice(u,0,w):f[u]=w,g.bendpointMove={insert:p,bendpointIndex:u},f=this.cropWaypoints(l,f),o.updateWaypoints(l,kE(f),g)):(m===hr?(g.docking="source",uc(s)&&(g.docking="target",g.newWaypoints=f.reverse())):m===mr&&(g.docking="target",uc(s)&&(g.docking="source",g.newWaypoints=f.reverse())),o.reconnect(l,d,h,w,g))},this)}xp.$inject=["injector","eventBus","canvas","dragging","rules","modeling"],xp.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 uc(e){var t=e.hover,n=e.source,i=e.target,r=e.type;if(r===hr)return t&&i&&t===i&&n!==i;if(r===mr)return t&&n&&t===n&&n!==i}var xT="reconnectStart",ET="reconnectEnd",dy="updateWaypoints",na="connect-ok",lc="connect-not-ok",hy="connect-hover",my="djs-updating",gy="djs-dragging",vy=1100;function yy(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=_p(i.getLayer("overlays"));Me(f).add("djs-dragging"),i.addMarker(c,gy),i.addMarker(c,my)}),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,hy),u===dy)return;s?(i.removeMarker(c,lc),i.addMarker(c,na)):s===!1&&(i.removeMarker(c,na),i.addMarker(c,lc))}}),n.on(["bendpoint.move.out","bendpoint.move.cleanup"],vy,function(o){var a=o.context,s=a.hover,c=a.target;s&&(i.removeMarker(s,hy),i.removeMarker(s,c?na:lc))}),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===xT?uc(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===ET?uc(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===dy&&(m=e.cropWaypoints(f,m)),E.waypoints=m,r.drawPreview(a,s,E)),Ct(u,o.x,o.y)},this),n.on(["bendpoint.move.end","bendpoint.move.cancel"],vy,function(o){var a=o.context,s=a.connection,c=a.draggerGfx,u=a.hover,l=a.target,p=a.waypoints;s.waypoints=p,gt(c),i.removeMarker(s,my),i.removeMarker(s,gy),u&&(i.removeMarker(u,na),i.removeMarker(u,l?na:lc)),r&&r.cleanUp(a)})}yy.$inject=["bendpointMove","injector","eventBus","canvas"];var _y="connect-hover",by="djs-updating";function xy(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 wT(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 Ey(e){return e==="x"?"y":"x"}function wy(e,t,n){var i,r;return e.original?e.original:(i=fe(t),r=Ey(n),Ep(e,r,i[r]))}function Sy(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=yp(n,E,p),A,I,C;if(A=Kn(b,x),!!A)return I=A==="v"?"x":"y",g===0&&(b=wy(b,f.source,I)),w===E.length-1&&(x=wy(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=Ey(p.axis),x=wT(d,g,E,b);Ct(p.draggerGfx,x.x,x.y)}function l(p,f){var d=0,h=p.filter(function(m,g){return lu(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=ly(h,f.segmentStart,f.segmentEnd),Me(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=xy(g,E,p["d"+E]),S=xy(w,E,p["d"+E]),A=b.length,I=0;b[h]=x,b[m]=S;var C,$;h<2&&(C=Rt(d.source,x),h===1?C==="intersect"&&(b.shift(),b[0]=x,I--):C!=="intersect"&&(b.unshift(g),I++)),m>A-3&&($=Rt(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,_y)}),t.on(["connectionSegment.move.out","connectionSegment.move.cleanup"],function(p){var f=p.context.hover;f&&n.removeMarker(f,_y)}),t.on("connectionSegment.move.cleanup",function(p){var f=p.context,d=f.connection;f.draggerGfx&&gt(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)})}Sy.$inject=["injector","eventBus","canvas","dragging","graphicsFactory","modeling"];var ST=Math.abs,Ry=Math.round;function RT(e,t,n){n=n===void 0?10:n;var i,r;for(i=0;i<t.length;i++)if(r=t[i],ST(r-e)<=n)return r}function Cy(e){return{x:e.x,y:e.y}}function Py(e){return{x:e.x+e.width,y:e.y+e.height}}function _n(e,t){return!e||isNaN(e.x)||isNaN(e.y)?t:{x:Ry(e.x+e.width/2),y:Ry(e.y+e.height/2)}}function to(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 Ay(e){return e.children||[]}var CT=Math.abs,Ty=Math.round,wp=10;function My(e){function t(o,a){if(pe(o)){for(var s=o.length;s--;)if(CT(o[s]-a)<=wp)return o[s]}else{o=+o;var c=a%o;if(c<wp)return a-c;if(c>o-wp)return a-c+o}return a}function n(o,a){if(o.waypoints)return vT(a,o);if(o.width)return{x:Ty(o.width/2+o.x),y:Ty(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:[]},P(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:[]},P(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);!je(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)}})}My.$inject=["eventBus"];const PT={__depends__:[ti,jn],__init__:["bendpoints","bendpointSnapping","bendpointMovePreview"],bendpoints:["type",py],bendpointMove:["type",xp],bendpointMovePreview:["type",yy],connectionSegmentMove:["type",Sy],bendpointSnapping:["type",My]};function ky(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),!yr(l)){if(l!==!1){s.source=c,s.target=u;return}l=s.canExecute=o(c,u),!yr(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:Sp(s)?l:u,connectionEnd:Sp(s)?u:l};bt(c)&&(d=c),s.connection=n.connect(p,f,d,h)}),this.start=function(a,s,c,u){bt(c)||(u=c,c=fe(s)),t.init(a,"connect",{autoActivate:u,data:{shape:s,context:{start:s,connectionStart:c}}})}}ky.$inject=["eventBus","dragging","modeling","rules"];function Sp(e){var t=e.hover,n=e.source,i=e.target;return t&&n&&t===n&&n!==i}var AT=1100,TT=900,Dy="connect-ok",Oy="connect-not-ok";function Iy(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;Sp(o)&&(h=d,m=f),i.drawPreview(o,a,{source:c||u,target:p||s,connectionStart:h,connectionEnd:m})}),t.on("connect.hover",TT,function(r){var o=r.context,a=r.hover,s=o.canExecute;s!==null&&n.addMarker(a,s?Dy:Oy)}),t.on(["connect.out","connect.cleanup"],AT,function(r){var o=r.hover;o&&(n.removeMarker(o,Dy),n.removeMarker(o,Oy))}),i&&t.on("connect.cleanup",function(r){i.cleanUp(r.context)})}Iy.$inject=["injector","eventBus","canvas"];const Rp={__depends__:[gn,jn,ti],__init__:["connectPreview"],connect:["type",ky],connectPreview:["type",Iy]};var MT="djs-dragger";function ci(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)}ci.$inject=["injector","canvas","graphicsFactory","elementFactory"],ci.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()),Ca(i),r||(r=e.getConnection=kT(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)"})},ci.prototype.drawNoopPreview=function(e,t){var n=t.source,i=t.target,r=t.connectionStart||fe(n),o=t.connectionEnd||fe(i),a=this.cropWaypoints(r,o,n,i),s=this.createNoopConnection(a[0],a[1]);ye(e,s)},ci.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&&go(o,s,!0)||e,t=i&&go(a,s,!1)||t,[e,t]},ci.prototype.cleanUp=function(e){e&&e.connectionPreviewGfx&&gt(e.connectionPreviewGfx)},ci.prototype.getConnection=function(e){var t=DT(e);return this._elementFactory.createConnection(t)},ci.prototype.createConnectionPreviewGfx=function(){var e=oe("g");return Z(e,{pointerEvents:"none"}),Me(e).add(MT),ye(this._canvas.getActiveLayer(),e),e},ci.prototype.createNoopConnection=function(e,t){return po([e,t],{stroke:"#333",strokeDasharray:[1],strokeWidth:2,"pointer-events":"none"})};function kT(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 DT(e){return bt(e)?e:{}}const OT={__init__:["connectionPreview"],connectionPreview:["type",ci]},pc="complex-preview";class Ly{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(pc);n.filter(s=>!IT(s)).forEach(s=>{let c;je(s)?(c=this._graphicsFactory._createContainer("connection",oe("g")),this._graphicsFactory.drawConnection(ir(c),s)):(c=this._graphicsFactory._createContainer("shape",oe("g")),this._graphicsFactory.drawShape(ir(c),s),Ct(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);je(s)?Ct(u,c.x,c.y):Ct(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",oe("g"));this._graphicsFactory.drawShape(ir(u),s,{width:c.width,height:c.height}),Ct(u,c.x,c.y),this._previewSupport.addDragger(s,a,u)})}cleanUp(){Ca(this._canvas.getLayer(pc)),this._markers.forEach(([t,n])=>this._canvas.removeMarker(t,n)),this._markers=[]}show(){this._canvas.showLayer(pc)}hide(){this._canvas.hideLayer(pc)}}Ly.$inject=["canvas","graphicsFactory","previewSupport"];function IT(e){return e.hidden}const LT={__depends__:[Gr],__init__:["complexPreview"],complexPreview:["type",Ly]},By=Math.round;function fc(e,t,n,i,r,o){this._complexPreview=e,this._connectionDocking=t,this._elementFactory=n,this._eventBus=i,this._layouter=r,this._rules=o}fc.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-By(u.width/2),y:l.y-By(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=>!yr(d))})},fc.prototype.cleanUp=function(){this._complexPreview.cleanUp()},fc.$inject=["complexPreview","connectionDocking","elementFactory","eventBus","layouter","rules"];const BT={__depends__:[js,LT,Xl],__init__:["appendPreview"],appendPreview:["type",fc]};var Ny=Math.min,$y=Math.max;function Cp(e){e.preventDefault()}function ia(e){e.stopPropagation()}function NT(e){return e.nodeType===Node.TEXT_NODE}function $T(e){return[].slice.call(e)}function Cn(e){this.container=e.container,this.parent=We('<div class="djs-direct-editing-parent"><div class="djs-direct-editing-content" contenteditable="true"></div></div>'),this.content=$e("[contenteditable]",this.parent),this.keyHandler=e.keyHandler||function(){},this.resizeHandler=e.resizeHandler||function(){},this.focusoutHandler=e.focusoutHandler||function(){},this.autoResize=Gt(this.autoResize,this),this.handlePaste=Gt(this.handlePaste,this)}Cn.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=Sn(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=Sn(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,ve.bind(a,"keydown",this.keyHandler),ve.bind(a,"mousedown",ia),ve.bind(a,"paste",r.handlePaste),ve.bind(a,"focusout",this.focusoutHandler),i.autoResize&&ve.bind(a,"input",this.autoResize),i.resizable&&this.resizable(t),s.appendChild(o),this.setSelection(a.lastChild,a.lastChild&&a.lastChild.length),o},Cn.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)}},Cn.prototype.insertText=function(e){e=jT(e);var t=document.execCommand("insertText",!1,e);t||this._insertTextIE(e)},Cn.prototype._insertTextIE=function(e){var t=this.getSelection(),n=t.startContainer,i=t.endContainer,r=t.startOffset,o=t.endOffset,a=t.commonAncestorContainer,s=$T(a.childNodes),c,u;if(NT(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&&On(h)}),c=n,u=r+e.length}c&&u!==void 0&&setTimeout(function(){self.setSelection(c,u)})},Cn.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})}},Cn.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=We('<div class="djs-direct-editing-resize-handle"></div>');var s,c,u,l,p=function(h){Cp(h),ia(h),s=h.clientX,c=h.clientY;var m=t.getBoundingClientRect();u=m.width,l=m.height,ve.bind(document,"mousemove",f),ve.bind(document,"mouseup",d)},f=function(h){Cp(h),ia(h);var m=Ny($y(u+h.clientX-s,i),o),g=Ny($y(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){Cp(h),ia(h),ve.unbind(document,"mousemove",f,!1),ve.unbind(document,"mouseup",d,!1)};ve.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)},Cn.prototype.destroy=function(){var e=this.parent,t=this.content,n=this.resizeHandle;t.innerText="",e.removeAttribute("style"),t.removeAttribute("style"),ve.unbind(t,"keydown",this.keyHandler),ve.unbind(t,"mousedown",ia),ve.unbind(t,"input",this.autoResize),ve.unbind(t,"paste",this.handlePaste),ve.unbind(t,"focusout",this.focusoutHandler),n&&(n.removeAttribute("style"),On(n)),On(e)},Cn.prototype.getValue=function(){return this.content.innerText.trim()},Cn.prototype.getSelection=function(){var e=window.getSelection(),t=e.getRangeAt(0);return t},Cn.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 jT(e){return e.replace(/\r\n|\r|\n/g,`
315
- `)}function rn(e,t){this._eventBus=e,this._canvas=t,this._providers=[],this._textbox=new Cn({container:t.getContainer(),keyHandler:Gt(this._handleKey,this),resizeHandler:Gt(this._handleResize,this),focusoutHandler:Gt(this._handleFocusout,this)}),e.on(["diagram.clear","diagram.destroy"],()=>this._cleanup())}rn.$inject=["eventBus","canvas"],rn.prototype.registerProvider=function(e){this._providers.push(e)},rn.prototype.isActive=function(e){return!!(this._active&&(!e||this._active.element===e))},rn.prototype.cancel=function(){this._active&&(this._fire("cancel"),this.close())},rn.prototype._fire=function(e,t){this._eventBus.fire("directEditing."+e,t||{active:this._active})},rn.prototype.close=function(){this._fire("deactivate"),this._cleanup(),this._canvas.restoreFocus&&this._canvas.restoreFocus()},rn.prototype._cleanup=function(){this._active&&(this._textbox.destroy(),this._active=null,this.resizable=void 0)},rn.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()}},rn.prototype.getValue=function(){return this._textbox.getValue()},rn.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()},rn.prototype._handleResize=function(e){this._fire("resize",e)},rn.prototype._handleFocusout=function(e){e.relatedTarget&&this._textbox.parent.contains(e.relatedTarget)||this.complete()},rn.prototype.activate=function(e){if(this.isActive()&&this.cancel(),this._eventBus.fire("directEditing.activate.allowed",{element:e})===!1)return!1;var t,n=ze(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 jy={__depends__:[ms],__init__:["directEditing"],directEditing:["type",rn]};function FT(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===Pe(e);return!o||!a||!s||!c}}const HT={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=HT[e];if(!n)throw new Error("unknown popup entry <"+e+">");return{...n,actionName:"replace-with-"+e,...t}}var zT=[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")],VT=[G("none-start-event",{actionName:"replace-with-none-start"}),G("none-intermediate-throwing"),G("none-end-event",{actionName:"replace-with-none-end"})],GT=[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")],WT=[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")],UT=[G("exclusive-gateway"),G("parallel-gateway"),G("inclusive-gateway"),G("complex-gateway"),G("event-based-gateway")],qT=[G("transaction"),G("event-subprocess"),G("expanded-ad-hoc-subprocess",{actionName:"replace-with-ad-hoc-subprocess",label:"Ad-hoc sub-process"}),G("collapsed-subprocess")],YT=[G("expanded-subprocess",{actionName:"replace-with-subprocess",label:"Sub-process"}),G("transaction"),G("event-subprocess"),G("collapsed-ad-hoc-subprocess")],Fy=[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")],KT=Fy,Hy=[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"})],XT=[G("data-store-reference")],ZT=[G("data-object-reference")],QT=[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")],JT=[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")],eM=[{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"}],tM=[G("expanded-pool"),G("collapsed-pool",{label:function(e){var t="Empty pool/participant";return e.children&&e.children.length&&(t+=" (removes content)"),t}})],nM={"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 zy={"start-event-non-interrupting":`
314
+ </svg>`},NT=900;function go(e,t,n,i){e.registerProvider(NT,this),this._contextPad=e,this._popupMenu=t,this._translate=n,this._canvas=i}go.$inject=["contextPad","popupMenu","translate","canvas"],go.prototype.getMultiElementContextPadEntries=function(e){var t={};return this._isAllowed(e)&&D(t,this._getEntries(e)),t},go.prototype._isAllowed=function(e){return!this._popupMenu.isEmpty(e,"align-elements")},go.prototype._getEntries=function(){var e=this;return{"align-elements":{group:"align-elements",title:e._translate("Align elements"),html:`<div class="entry">${Iy.align}</div>`,action:{click:function(t,n){var i=e._getMenuPosition(n);D(i,{cursor:{x:t.x,y:t.y}}),e._popupMenu.open(n,"align-elements",i)}}}}},go.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 BT=["left","center","right","top","middle","bottom"];function ma(e,t,n,i){this._alignElements=t,this._translate=n,this._popupMenu=e,this._rules=i,e.registerProvider("align-elements",this)}ma.$inject=["popupMenu","alignElements","translate","rules"],ma.prototype.getPopupMenuEntries=function(e){var t={};return this._isAllowed(e)&&D(t,this._getEntries(e)),t},ma.prototype._isAllowed=function(e){return this._rules.allowed("elements.align",{elements:e})},ma.prototype._getEntries=function(e){var t=this._alignElements,n=this._translate,i=this._popupMenu,r={};return T(BT,function(o){r["align-elements-"+o]={group:"align",title:n("Align elements "+o),className:"bjs-align-elements-menu-entry",imageHtml:Iy[o],action:function(){t.trigger(e,o),i.close()}}}),r};function Sc(e){Rn.call(this,e)}Sc.$inject=["eventBus"],Q(Sc,Rn),Sc.prototype.init=function(){this.addRule("elements.align",function(e){var t=e.elements,n=Ee(t,function(i){return!(i.waypoints||i.host||i.labelTarget)});return n=qa(n),n.length<2?!1:n})};const $T={__depends__:[KA,Wv,jp],__init__:["alignElementsContextPadProvider","alignElementsMenuProvider","bpmnAlignElements"],alignElementsContextPadProvider:["type",go],alignElementsMenuProvider:["type",ma],bpmnAlignElements:["type",Sc]};function xi(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=Xc(Lr(a.closure.topLevel)),c=a.hints,u=c?c.autoResize:!0;if(u!==!1){var l=Nr(s,function(p){return p.parent.id});T(l,function(p,f){le(u)&&(p=p.filter(function(d){return Ge(u,Br({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)})}xi.$inject=["eventBus","elementRegistry","modeling","rules"],Q(xi,W),xi.prototype._getOptimalBounds=function(e,t){var n=this.getOffset(t),i=this.getPadding(t),r=ue(ut(e)),o=ue(t),a={};return r.top-o.top<i.top&&(a.top=r.top-n.top),r.left-o.left<i.left&&(a.left=r.left-n.left),o.right-r.right<i.right&&(a.right=r.right+n.right),o.bottom-r.bottom<i.bottom&&(a.bottom=r.bottom+n.bottom),Xa(D({},o,a))},xi.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(jT(i,t)){var r=FT(In(t,["x","y","width","height"]),i);this.resize(t,i,{autoResize:r});var o=t.parent;o&&this._expand([t],o)}}},xi.prototype.getOffset=function(e){return{top:60,bottom:60,left:100,right:100}},xi.prototype.getPadding=function(e){return{top:2,bottom:2,left:15,right:15}},xi.prototype.resize=function(e,t,n){this._modeling.resizeShape(e,t,null,n)};function jT(e,t){return e.x!==t.x||e.y!==t.y||e.width!==t.width||e.height!==t.height}function FT(e,t){var n="";return e=ue(e),t=ue(t),e.top>t.top&&(n=n.concat("n")),e.right<t.right&&(n=n.concat("w")),e.bottom<t.bottom&&(n=n.concat("s")),e.left>t.left&&(n=n.concat("e")),n}function Rc(e){e.invoke(xi,this)}Rc.$inject=["injector"],Q(Rc,xi),Rc.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 ga(e){Rn.call(this,e);var t=this;this.addRule("element.autoResize",function(n){return t.canResize(n.elements,n.target)})}ga.$inject=["eventBus"],Q(ga,Rn),ga.prototype.canResize=function(e,t){return!1};function Cc(e,t){ga.call(this,e),this._modeling=t}Q(Cc,ga),Cc.$inject=["eventBus","modeling"],Cc.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 HT={__init__:["bpmnAutoResize","bpmnAutoResizeProvider"],bpmnAutoResize:["type",Rc],bpmnAutoResizeProvider:["type",Cc]};function vo(e,t,n){this._canvas=n,this._opts=D({scrollThresholdIn:[20,20,20,20],scrollThresholdOut:[0,0,0,0],scrollRepeatTimeout:15,scrollStep:10},e);var i=this;t.on("drag.move",function(r){var o=i._toBorderPoint(r);i.startScroll(o)}),t.on(["drag.cleanup"],function(){i.stopScroll()})}vo.$inject=["config.autoScroll","eventBus","canvas"],vo.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++)zT(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 zT(e,t,n){return t<e&&e<n}vo.prototype.stopScroll=function(){clearTimeout(this._scrolling)},vo.prototype.setOptions=function(e){this._opts=D({},this._opts,e)},vo.prototype._toBorderPoint=function(e){var t=this._canvas._container.getBoundingClientRect(),n=xr(e.originalEvent);return{x:n.x-t.left,y:n.y-t.top}};const VT={__depends__:[mi],__init__:["autoScroll"],autoScroll:["type",vo]};var Ly="djs-bendpoint",Ny="djs-segment-dragger";function GT(e,t){var n=xr(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 Fp(e,t,n){var i=GT(e,n),r=rl(t,i);return r}function Hp(e,t){var n=ae("g");Ce(n).add(Ly),ge(e,n);var i=ae("circle");J(i,{cx:0,cy:0,r:4}),Ce(i).add("djs-visual"),ge(n,i);var r=ae("circle");return J(r,{cx:0,cy:0,r:10}),Ce(r).add("djs-hit"),ge(n,r),t&&Ce(n).add(t),n}function WT(e,t,n,i){var r=ae("g");ge(e,r);var o=18,a=6,s=11,c=qT(t,n,i),u=a+s,l=ae("rect");J(l,{x:-o/2,y:-a/2,width:o,height:a}),Ce(l).add("djs-visual"),ge(r,l);var p=ae("rect");return J(p,{x:-c/2,y:-u/2,width:c,height:u}),Ce(p).add("djs-hit"),ge(r,p),ch(r,i==="v"?90:0),r}function By(e,t,n){var i=ae("g"),r=Ou(t,n),o=ui(t,n);return ge(e,i),WT(i,t,n,o),Ce(i).add(Ny),Ce(i).add(o==="h"?"horizontal":"vertical"),Ot(i,r.x,r.y),i}function zp(e){return Math.abs(Math.round(e*2/3))}function UT(e,t){var n=YT(e,t);return ll(e,n)}function qT(e,t,n){var i=t.x-e.x,r=t.y-e.y;return zp(n==="h"?i:r)}function YT(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=Yh(e,[a,s]);c<i&&(i=c,r=o)}return[n[r],n[r+1]]}function $y(e,t,n,i,r){function o(b,x,S){var A=b.index,I=b.point,P,$,j,L,F,ie;return A<=0||b.bendpoint?!1:(P=x[A-1],$=x[A],j=Ou(P,$),L=ui(P,$),F=Math.abs(I.x-j.x),ie=Math.abs(I.y-j.y),L&&F<=S&&ie<=S)}function a(b,x){var S=b.waypoints,A,I,P,$;return x.index<=0||x.bendpoint||(A={start:S[x.index-1],end:S[x.index]},I=ui(A.start,A.end),!I)?null:(I==="h"?P=A.end.x-A.start.x:P=A.end.y-A.start.y,$=zp(P)/2,$)}function s(b,x){var S=x.waypoints,A=Fp(t,S,b),I;if(A){I=a(x,A);var P;if(o(A,S,I)?P=r.start(b,x,A.index):P=i.start(b,x,A.index,!A.bendpoint),P!==!1)return!0}}function c(b,x,S){he.bind(b,x,function(A){n.triggerMouseEvent(x,A,S),A.stopPropagation()})}function u(b,x){var S=t.getLayer("overlays"),A=je('.djs-bendpoints[data-element-id="'+la(b.id)+'"]',S);return!A&&x&&(A=ae("g"),J(A,{"data-element-id":b.id}),Ce(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 je('.djs-segment-dragger[data-segment-idx="'+b+'"]',x)}function p(b,x){x.waypoints.forEach(function(S,A){var I=Hp(b);ge(b,I),Ot(I,S.x,S.y)}),Hp(b,"floating")}function f(b,x){for(var S=x.waypoints,A,I,P,$=1;$<S.length;$++)A=S[$-1],I=S[$],ui(A,I)&&(P=By(b,A,I),J(P,{"data-segment-idx":$}),c(P,"mousemove",x))}function d(b){T(Va("."+Ly,b),function(x){bt(x)})}function h(b){T(Va("."+Ny,b),function(x){bt(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=je(".floating",b),A=x.point;S&&(Ot(S,A.x,A.y),Ce(S).add("positioned"))}function E(b,x,S){var A=l(x.index,b),I=S[x.index-1],P=S[x.index],$=x.point,j=Ou(I,P),L=ui(I,P),F,ie;A&&(F=KT(A),ie={x:$.x-j.x,y:$.y-j.y},L==="v"&&(ie={x:ie.y,y:ie.x}),Ot(F,ie.x,ie.y))}e.on("connection.changed",function(b){g(b.element)}),e.on("connection.remove",function(b){var x=u(b.element);x&&bt(x)}),e.on("element.marker.update",function(b){var x=b.element,S;x.waypoints&&(S=m(x),b.add?Ce(S).add(b.marker):Ce(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=Fp(t,S,b.originalEvent),!I)return;w(A,I),I.bendpoint||E(A,I,S)}}),e.on("element.mousedown",function(b){if(Gi(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=je(".floating",S);A&&Ce(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}$y.$inject=["eventBus","canvas","interactionEvents","bendpointMove","connectionSegmentMove"];function KT(e){return je(".djs-visual",e)}var jy=Math.round,Tr="reconnectStart",Mr="reconnectEnd",va="updateWaypoints";function Vp(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=Tr:!u&&c===d.length-1?h=Mr:h=va;var m=h===va?"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===va?"connection.updateWaypoints":"connection.reconnect";if(d=s.allowed=r.allowed(h,{connection:c,source:f===Tr?p:u,target:f===Mr?p:l}),d){s.source=f===Tr?p:u,s.target=f===Mr?p:l;return}d===!1&&(d=s.allowed=r.allowed(h,{connection:c,source:f===Mr?p:l,target:f===Tr?p:u})),d&&(s.source=f===Mr?p:l,s.target=f===Tr?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!==va&&(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:jy(a.x),y:jy(a.y)};if(!c)return!1;m===va?(p?f.splice(u,0,w):f[u]=w,g.bendpointMove={insert:p,bendpointIndex:u},f=this.cropWaypoints(l,f),o.updateWaypoints(l,aw(f),g)):(m===Tr?(g.docking="source",Pc(s)&&(g.docking="target",g.newWaypoints=f.reverse())):m===Mr&&(g.docking="target",Pc(s)&&(g.docking="source",g.newWaypoints=f.reverse())),o.reconnect(l,d,h,w,g))},this)}Vp.$inject=["injector","eventBus","canvas","dragging","rules","modeling"],Vp.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 Pc(e){var t=e.hover,n=e.source,i=e.target,r=e.type;if(r===Tr)return t&&i&&t===i&&n!==i;if(r===Mr)return t&&n&&t===n&&n!==i}var XT="reconnectStart",ZT="reconnectEnd",Fy="updateWaypoints",ya="connect-ok",Ac="connect-not-ok",Hy="connect-hover",zy="djs-updating",Vy="djs-dragging",Gy=1100;function Wy(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=Hp(i.getLayer("overlays"));Ce(f).add("djs-dragging"),i.addMarker(c,Vy),i.addMarker(c,zy)}),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,Hy),u===Fy)return;s?(i.removeMarker(c,Ac),i.addMarker(c,ya)):s===!1&&(i.removeMarker(c,ya),i.addMarker(c,Ac))}}),n.on(["bendpoint.move.out","bendpoint.move.cleanup"],Gy,function(o){var a=o.context,s=a.hover,c=a.target;s&&(i.removeMarker(s,Hy),i.removeMarker(s,c?ya:Ac))}),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===XT?Pc(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===ZT?Pc(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===Fy&&(m=e.cropWaypoints(f,m)),E.waypoints=m,r.drawPreview(a,s,E)),Ot(u,o.x,o.y)},this),n.on(["bendpoint.move.end","bendpoint.move.cancel"],Gy,function(o){var a=o.context,s=a.connection,c=a.draggerGfx,u=a.hover,l=a.target,p=a.waypoints;s.waypoints=p,bt(c),i.removeMarker(s,zy),i.removeMarker(s,Vy),u&&(i.removeMarker(u,ya),i.removeMarker(u,l?ya:Ac)),r&&r.cleanUp(a)})}Wy.$inject=["bendpointMove","injector","eventBus","canvas"];var Uy="connect-hover",qy="djs-updating";function Yy(e,t,n){return Gp(e,t,e[t]+n)}function Gp(e,t,n){return{x:t==="x"?n:e.x,y:t==="y"?n:e.y}}function QT(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 Gp(t,i,s)}function Ky(e){return e==="x"?"y":"x"}function Xy(e,t,n){var i,r;return e.original?e.original:(i=pe(t),r=Ky(n),Gp(e,r,i[r]))}function Zy(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=Fp(n,E,p),A,I,P;if(A=ui(b,x),!!A)return I=A==="v"?"x":"y",g===0&&(b=Xy(b,f.source,I)),w===E.length-1&&(x=Xy(x,f.target,I)),S?P=S.point:P={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:P},i.init(p,P,"connectionSegment.move",{cursor:I==="x"?"resize-ew":"resize-ns",data:{connection:f,connectionGfx:m,context:h}})};function s(p,f){if(!a)return f;var d=p.waypoints,h;return p.waypoints=f,h=a.getCroppedWaypoints(p),p.waypoints=d,h}function c(p){r.update("connection",p.connection,p.connectionGfx)}function u(p,f,d){var h=p.newWaypoints,m=p.segmentStartIndex+f,g=h[m],w=p.segmentEndIndex+f,E=h[w],b=Ky(p.axis),x=QT(d,g,E,b);Ot(p.draggerGfx,x.x,x.y)}function l(p,f){var d=0,h=p.filter(function(m,g){return Du(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=By(h,f.segmentStart,f.segmentEnd),Ce(f.draggerGfx).add("djs-dragging"),n.addMarker(d,qy)}),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=Yy(g,E,p["d"+E]),S=Yy(w,E,p["d"+E]),A=b.length,I=0;b[h]=x,b[m]=S;var P,$;h<2&&(P=Dt(d.source,x),h===1?P==="intersect"&&(b.shift(),b[0]=x,I--):P!=="intersect"&&(b.unshift(g),I++)),m>A-3&&($=Dt(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,Uy)}),t.on(["connectionSegment.move.out","connectionSegment.move.cleanup"],function(p){var f=p.context.hover;f&&n.removeMarker(f,Uy)}),t.on("connectionSegment.move.cleanup",function(p){var f=p.context,d=f.connection;f.draggerGfx&&bt(f.draggerGfx),n.removeMarker(d,qy)}),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)})}Zy.$inject=["injector","eventBus","canvas","dragging","graphicsFactory","modeling"];var JT=Math.abs,Qy=Math.round;function eM(e,t,n){n=n===void 0?10:n;var i,r;for(i=0;i<t.length;i++)if(r=t[i],JT(r-e)<=n)return r}function Jy(e){return{x:e.x,y:e.y}}function e_(e){return{x:e.x+e.width,y:e.y+e.height}}function Tn(e,t){return!e||isNaN(e.x)||isNaN(e.y)?t:{x:Qy(e.x+e.width/2),y:Qy(e.y+e.height/2)}}function yo(e,t){var n=e.snapped;return n?typeof t=="string"?n[t]:n.x&&n.y:!1}function dt(e,t,n){if(typeof t!="string")throw new Error("axis must be in [x, y]");if(typeof n!="number"&&n!==!1)throw new Error("value must be Number or false");var i,r=e[t],o=e.snapped=e.snapped||{};return n===!1?o[t]=!1:(o[t]=!0,i=n-r,e[t]+=i,e["d"+t]+=i),r}function t_(e){return e.children||[]}var tM=Math.abs,n_=Math.round,Wp=10;function i_(e){function t(o,a){if(le(o)){for(var s=o.length;s--;)if(tM(o[s]-a)<=Wp)return o[s]}else{o=+o;var c=a%o;if(c<Wp)return a-c;if(c>o-Wp)return a-c+o}return a}function n(o,a){if(o.waypoints)return UT(a,o);if(o.width)return{x:n_(o.width/2+o.x),y:n_(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;D(o,{dx:o.dx-p,dy:o.dy-f,x:u,y:l}),(p||a.vertical.indexOf(s)!==-1)&&dt(o,"x",u),(f||a.horizontal.indexOf(c)!==-1)&&dt(o,"y",l)}});function r(o){var a=o.snapPoints,s=o.connection.waypoints,c=o.bendpointIndex;if(a)return a;var u=[s[c-1],s[c+1]];return o.snapPoints=a={horizontal:[],vertical:[]},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);!He(s)||!c||!c.x||!c.y||(dt(o,"x",c.x),dt(o,"y",c.y))}),e.on(["bendpoint.move.move","bendpoint.move.end"],1500,function(o){var a=o.context,s=r(a),c=a.hover,u=c&&n(c,o),l=o.x,p=o.y,f,d;if(s){f=t(u?s.vertical.concat([u.x]):s.vertical,l),d=t(u?s.horizontal.concat([u.y]):s.horizontal,p);var h=l-f,m=p-d;D(o,{dx:o.dx-h,dy:o.dy-m,x:o.x-h,y:o.y-m}),(h||s.vertical.indexOf(l)!==-1)&&dt(o,"x",f),(m||s.horizontal.indexOf(p)!==-1)&&dt(o,"y",d)}})}i_.$inject=["eventBus"];const nM={__depends__:[mi,Qn],__init__:["bendpoints","bendpointSnapping","bendpointMovePreview"],bendpoints:["type",$y],bendpointMove:["type",Vp],bendpointMovePreview:["type",Wy],connectionSegmentMove:["type",Zy],bendpointSnapping:["type",i_]};function r_(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),!Ir(l)){if(l!==!1){s.source=c,s.target=u;return}l=s.canExecute=o(c,u),!Ir(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:Up(s)?l:u,connectionEnd:Up(s)?u:l};Rt(c)&&(d=c),s.connection=n.connect(p,f,d,h)}),this.start=function(a,s,c,u){Rt(c)||(u=c,c=pe(s)),t.init(a,"connect",{autoActivate:u,data:{shape:s,context:{start:s,connectionStart:c}}})}}r_.$inject=["eventBus","dragging","modeling","rules"];function Up(e){var t=e.hover,n=e.source,i=e.target;return t&&n&&t===n&&n!==i}var iM=1100,rM=900,o_="connect-ok",a_="connect-not-ok";function s_(e,t,n){var i=e.get("connectionPreview",!1);i&&t.on("connect.move",function(r){var o=r.context,a=o.canExecute,s=o.hover,c=o.source,u=o.start,l=o.startPosition,p=o.target,f=o.connectionStart||l,d=o.connectionEnd||{x:r.x,y:r.y},h=f,m=d;Up(o)&&(h=d,m=f),i.drawPreview(o,a,{source:c||u,target:p||s,connectionStart:h,connectionEnd:m})}),t.on("connect.hover",rM,function(r){var o=r.context,a=r.hover,s=o.canExecute;s!==null&&n.addMarker(a,s?o_:a_)}),t.on(["connect.out","connect.cleanup"],iM,function(r){var o=r.hover;o&&(n.removeMarker(o,o_),n.removeMarker(o,a_))}),i&&t.on("connect.cleanup",function(r){i.cleanUp(r.context)})}s_.$inject=["injector","eventBus","canvas"];const qp={__depends__:[Cn,Qn,mi],__init__:["connectPreview"],connect:["type",r_],connectPreview:["type",s_]};var oM="djs-dragger";function Ei(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)}Ei.$inject=["injector","canvas","graphicsFactory","elementFactory"],Ei.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()),Ga(i),r||(r=e.getConnection=aM(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?pe(o):c,a?pe(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)"})},Ei.prototype.drawNoopPreview=function(e,t){var n=t.source,i=t.target,r=t.connectionStart||pe(n),o=t.connectionEnd||pe(i),a=this.cropWaypoints(r,o,n,i),s=this.createNoopConnection(a[0],a[1]);ge(e,s)},Ei.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&&Do(o,s,!0)||e,t=i&&Do(a,s,!1)||t,[e,t]},Ei.prototype.cleanUp=function(e){e&&e.connectionPreviewGfx&&bt(e.connectionPreviewGfx)},Ei.prototype.getConnection=function(e){var t=sM(e);return this._elementFactory.createConnection(t)},Ei.prototype.createConnectionPreviewGfx=function(){var e=ae("g");return J(e,{pointerEvents:"none"}),Ce(e).add(oM),ge(this._canvas.getActiveLayer(),e),e},Ei.prototype.createNoopConnection=function(e,t){return Ao([e,t],{stroke:"#333",strokeDasharray:[1],strokeWidth:2,"pointer-events":"none"})};function aM(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 sM(e){return Rt(e)?e:{}}const cM={__init__:["connectionPreview"],connectionPreview:["type",Ei]},Tc="complex-preview";class c_{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(Tc);n.filter(s=>!uM(s)).forEach(s=>{let c;He(s)?(c=this._graphicsFactory._createContainer("connection",ae("g")),this._graphicsFactory.drawConnection(yr(c),s)):(c=this._graphicsFactory._createContainer("shape",ae("g")),this._graphicsFactory.drawShape(yr(c),s),Ot(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);He(s)?Ot(u,c.x,c.y):Ot(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",ae("g"));this._graphicsFactory.drawShape(yr(u),s,{width:c.width,height:c.height}),Ot(u,c.x,c.y),this._previewSupport.addDragger(s,a,u)})}cleanUp(){Ga(this._canvas.getLayer(Tc)),this._markers.forEach(([t,n])=>this._canvas.removeMarker(t,n)),this._markers=[]}show(){this._canvas.showLayer(Tc)}hide(){this._canvas.hideLayer(Tc)}}c_.$inject=["canvas","graphicsFactory","previewSupport"];function uM(e){return e.hidden}const lM={__depends__:[ao],__init__:["complexPreview"],complexPreview:["type",c_]},u_=Math.round;function Mc(e,t,n,i,r,o){this._complexPreview=e,this._connectionDocking=t,this._elementFactory=n,this._eventBus=i,this._layouter=r,this._rules=o}Mc.prototype.create=function(e,t,n){const i=this._complexPreview,r=this._connectionDocking,o=this._elementFactory,a=this._eventBus,s=this._layouter,c=this._rules,u=o.createShape(D({type:t},n)),l=a.fire("autoPlace",{source:e,shape:u});if(!l)return;D(u,{x:l.x-u_(u.width/2),y:l.y-u_(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=>!Ir(d))})},Mc.prototype.cleanUp=function(){this._complexPreview.cleanUp()},Mc.$inject=["complexPreview","connectionDocking","elementFactory","eventBus","layouter","rules"];const pM={__depends__:[ic,lM,yp],__init__:["appendPreview"],appendPreview:["type",Mc]};var l_=Math.min,p_=Math.max;function Yp(e){e.preventDefault()}function _a(e){e.stopPropagation()}function fM(e){return e.nodeType===Node.TEXT_NODE}function dM(e){return[].slice.call(e)}function Bn(e){this.container=e.container,this.parent=Ue('<div class="djs-direct-editing-parent"><div class="djs-direct-editing-content" contenteditable="true"></div></div>'),this.content=je("[contenteditable]",this.parent),this.keyHandler=e.keyHandler||function(){},this.resizeHandler=e.resizeHandler||function(){},this.focusoutHandler=e.focusoutHandler||function(){},this.autoResize=Zt(this.autoResize,this),this.handlePaste=Zt(this.handlePaste,this)}Bn.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=In(t,["width","height","maxWidth","maxHeight","minWidth","minHeight","left","top","backgroundColor","position","overflow","border","wordWrap","textAlign","outline","transform"]);D(o.style,{width:e.width+"px",height:e.height+"px",maxWidth:e.maxWidth+"px",maxHeight:e.maxHeight+"px",minWidth:e.minWidth+"px",minHeight:e.minHeight+"px",left:e.x+"px",top:e.y+"px",backgroundColor:"#ffffff",position:"absolute",overflow:"visible",border:"1px solid #ccc",boxSizing:"border-box",wordWrap:"normal",textAlign:"center",outline:"none"},c);var u=In(t,["fontFamily","fontSize","fontWeight","lineHeight","padding","paddingTop","paddingRight","paddingBottom","paddingLeft"]);return D(a.style,{boxSizing:"border-box",width:"100%",outline:"none",wordWrap:"break-word"},u),i.centerVertically&&D(a.style,{position:"absolute",top:"50%",transform:"translate(0, -50%)"},u),a.innerText=n,he.bind(a,"keydown",this.keyHandler),he.bind(a,"mousedown",_a),he.bind(a,"paste",r.handlePaste),he.bind(a,"focusout",this.focusoutHandler),i.autoResize&&he.bind(a,"input",this.autoResize),i.resizable&&this.resizable(t),s.appendChild(o),this.setSelection(a.lastChild,a.lastChild&&a.lastChild.length),o},Bn.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)}},Bn.prototype.insertText=function(e){e=hM(e);var t=document.execCommand("insertText",!1,e);t||this._insertTextIE(e)},Bn.prototype._insertTextIE=function(e){var t=this.getSelection(),n=t.startContainer,i=t.endContainer,r=t.startOffset,o=t.endOffset,a=t.commonAncestorContainer,s=dM(a.childNodes),c,u;if(fM(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&&Un(h)}),c=n,u=r+e.length}c&&u!==void 0&&setTimeout(function(){self.setSelection(c,u)})},Bn.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})}},Bn.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=Ue('<div class="djs-direct-editing-resize-handle"></div>');var s,c,u,l,p=function(h){Yp(h),_a(h),s=h.clientX,c=h.clientY;var m=t.getBoundingClientRect();u=m.width,l=m.height,he.bind(document,"mousemove",f),he.bind(document,"mouseup",d)},f=function(h){Yp(h),_a(h);var m=l_(p_(u+h.clientX-s,i),o),g=l_(p_(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){Yp(h),_a(h),he.unbind(document,"mousemove",f,!1),he.unbind(document,"mouseup",d,!1)};he.bind(n,"mousedown",p)}D(n.style,{position:"absolute",bottom:"0px",right:"0px",cursor:"nwse-resize",width:"0",height:"0",borderTop:(parseInt(this.style.fontSize)/4||3)+"px solid transparent",borderRight:(parseInt(this.style.fontSize)/4||3)+"px solid #ccc",borderBottom:(parseInt(this.style.fontSize)/4||3)+"px solid #ccc",borderLeft:(parseInt(this.style.fontSize)/4||3)+"px solid transparent"}),t.appendChild(n)},Bn.prototype.destroy=function(){var e=this.parent,t=this.content,n=this.resizeHandle;t.innerText="",e.removeAttribute("style"),t.removeAttribute("style"),he.unbind(t,"keydown",this.keyHandler),he.unbind(t,"mousedown",_a),he.unbind(t,"input",this.autoResize),he.unbind(t,"paste",this.handlePaste),he.unbind(t,"focusout",this.focusoutHandler),n&&(n.removeAttribute("style"),Un(n)),Un(e)},Bn.prototype.getValue=function(){return this.content.innerText.trim()},Bn.prototype.getSelection=function(){var e=window.getSelection(),t=e.getRangeAt(0);return t},Bn.prototype.setSelection=function(e,t){var n=document.createRange();e===null?n.selectNodeContents(this.content):(n.setStart(e,t),n.setEnd(e,t));var i=window.getSelection();i.removeAllRanges(),i.addRange(n)};function hM(e){return e.replace(/\r\n|\r|\n/g,`
315
+ `)}function pn(e,t){this._eventBus=e,this._canvas=t,this._providers=[],this._textbox=new Bn({container:t.getContainer(),keyHandler:Zt(this._handleKey,this),resizeHandler:Zt(this._handleResize,this),focusoutHandler:Zt(this._handleFocusout,this)}),e.on(["diagram.clear","diagram.destroy"],()=>this._cleanup())}pn.$inject=["eventBus","canvas"],pn.prototype.registerProvider=function(e){this._providers.push(e)},pn.prototype.isActive=function(e){return!!(this._active&&(!e||this._active.element===e))},pn.prototype.cancel=function(){this._active&&(this._fire("cancel"),this.close())},pn.prototype._fire=function(e,t){this._eventBus.fire("directEditing."+e,t||{active:this._active})},pn.prototype.close=function(){this._fire("deactivate"),this._cleanup(),this._canvas.restoreFocus&&this._canvas.restoreFocus()},pn.prototype._cleanup=function(){this._active&&(this._textbox.destroy(),this._active=null,this.resizable=void 0)},pn.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()}},pn.prototype.getValue=function(){return this._textbox.getValue()},pn.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()},pn.prototype._handleResize=function(e){this._fire("resize",e)},pn.prototype._handleFocusout=function(e){e.relatedTarget&&this._textbox.parent.contains(e.relatedTarget)||this.complete()},pn.prototype.activate=function(e){if(this.isActive()&&this.cancel(),this._eventBus.fire("directEditing.activate.allowed",{element:e})===!1)return!1;var t,n=Ge(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 f_={__depends__:[Os],__init__:["directEditing"],directEditing:["type",pn]};function mM(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===Se(e);return!o||!a||!s||!c}}const gM={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=gM[e];if(!n)throw new Error("unknown popup entry <"+e+">");return{...n,actionName:"replace-with-"+e,...t}}var vM=[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")],yM=[G("none-start-event",{actionName:"replace-with-none-start"}),G("none-intermediate-throwing"),G("none-end-event",{actionName:"replace-with-none-end"})],_M=[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")],bM=[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")],xM=[G("exclusive-gateway"),G("parallel-gateway"),G("inclusive-gateway"),G("complex-gateway"),G("event-based-gateway")],EM=[G("transaction"),G("event-subprocess"),G("expanded-ad-hoc-subprocess",{actionName:"replace-with-ad-hoc-subprocess",label:"Ad-hoc sub-process"}),G("collapsed-subprocess")],wM=[G("expanded-subprocess",{actionName:"replace-with-subprocess",label:"Sub-process"}),G("transaction"),G("event-subprocess"),G("collapsed-ad-hoc-subprocess")],d_=[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")],SM=d_,h_=[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"})],RM=[G("data-store-reference")],CM=[G("data-object-reference")],PM=[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")],AM=[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")],TM=[{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"}],MM=[G("expanded-pool"),G("collapsed-pool",{label:function(e){var t="Empty pool/participant";return e.children&&e.children.length&&(t+=" (removes content)"),t}})],kM={"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 m_={"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 bn(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()}bn.$inject=["bpmnFactory","popupMenu","modeling","moddle","bpmnReplace","rules","translate","moddleCopy"],bn.prototype._register=function(){this._popupMenu.registerProvider("bpmn-replace",this)},bn.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=FT(e);return y(t,"bpmn:DataObjectReference")?this._createEntries(e,XT):y(t,"bpmn:DataStoreReference")&&!y(e.parent,"bpmn:Collaboration")?this._createEntries(e,ZT):(y(t,"bpmn:Event")&&!y(t,"bpmn:BoundaryEvent")&&(r=(s=t.get("eventDefinitions")[0])==null?void 0:s.$type,i=nM[r]||[],!Nt(t.$parent)&&y(t.$parent,"bpmn:SubProcess")&&(i=Re(i,function(c){return c.target.type!=="bpmn:StartEvent"}))),y(t,"bpmn:StartEvent")&&!y(t.$parent,"bpmn:SubProcess")?(o=Re(zT.concat(i),a),this._createEntries(e,o)):y(t,"bpmn:Participant")?(o=Re(tM,function(c){return Pe(e)!==c.target.isExpanded}),this._createEntries(e,o)):y(t,"bpmn:StartEvent")&&Nt(t.$parent)?(o=Re(JT.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")&&!Nt(t.$parent)&&y(t.$parent,"bpmn:SubProcess")?(o=Re(VT.concat(i),a),this._createEntries(e,o)):y(t,"bpmn:EndEvent")?(o=Re(WT.concat(i),function(c){var u=c.target;return u.eventDefinitionType=="bpmn:CancelEventDefinition"&&!y(t.$parent,"bpmn:Transaction")?!1:a(c)}),this._createEntries(e,o)):y(t,"bpmn:BoundaryEvent")?(o=Re(QT,function(c){var u=c.target;if(u.eventDefinitionType=="bpmn:CancelEventDefinition"&&!y(t.attachedToRef,"bpmn:Transaction"))return!1;var l=u.cancelActivity!==!1,p=t.cancelActivity==l;return a(c)||!a(c)&&!p}),this._createEntries(e,o)):y(t,"bpmn:IntermediateCatchEvent")||y(t,"bpmn:IntermediateThrowEvent")?(o=Re(GT.concat(i),a),this._createEntries(e,o)):y(t,"bpmn:Gateway")?(o=Re(UT,a),this._createEntries(e,o)):y(t,"bpmn:Transaction")?(o=Re(Fy,a),this._createEntries(e,o)):Nt(t)&&Pe(e)?(o=Re(KT,a),this._createEntries(e,o)):y(t,"bpmn:AdHocSubProcess")&&Pe(e)?(o=Re(YT,a),this._createEntries(e,o)):y(t,"bpmn:SubProcess")&&Pe(e)?(o=Re(qT,a),this._createEntries(e,o)):y(t,"bpmn:SubProcess")&&!Pe(e)?(o=Re(Hy,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,eM):y(t,"bpmn:FlowNode")?(o=Re(Hy,a),this._createEntries(e,o)):{})},bn.prototype.getPopupMenuHeaderEntries=function(e){var t={};return y(e,"bpmn:Activity")&&!Nt(e)&&(t={...t,...this._getLoopCharacteristicsHeaderEntries(e)}),y(e,"bpmn:DataObjectReference")&&(t={...t,...this._getCollectionHeaderEntries(e)}),y(e,"bpmn:Participant")&&(t={...t,...this._getParticipantMultiplicityHeaderEntries(e)}),Bh(e)&&(t={...t,...this._getNonInterruptingHeaderEntries(e)}),t},bn.prototype._createEntries=function(e,t){var n={},i=this;return P(t,function(r){n[r.actionName]=i._createEntry(r,e)}),n},bn.prototype._createSequenceFlowEntries=function(e,t){var n=U(e),i={},r=this._modeling,o=this._moddle,a=this;return P(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},bn.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}},bn.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"}}}},bn.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}}},bn.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}}},bn.prototype._getNonInterruptingHeaderEntries=function(e){const t=this._translate,n=U(e),i=this,r=Nh(e),o=y(e,"bpmn:BoundaryEvent")?zy["intermediate-event-non-interrupting"]:zy["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 iM={__depends__:[vp,ig,js],__init__:["replaceMenuProvider"],replaceMenuProvider:["type",bn]};function ra(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(!(!To(d)||!i.isOpen(m))){var g=i.getEntries(m);g.replace&&g.replace.action.click(d,m)}}),n.on("contextPad.close",function(){f.cleanUp()})}ra.$inject=["config.contextPad","injector","eventBus","contextPad","modeling","elementFactory","connect","create","popupMenu","canvas","rules","translate","appendPreview"],ra.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},ra.prototype._isDeleteAllowed=function(e){var t=this._rules.allowed("elements.delete",{elements:e});return pe(t)?qi(e,n=>t.includes(n)):t},ra.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(Se(p,["bpmn:Lane","bpmn:Participant"])&&Pe(e)){var E=Pi(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&&((Et(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)}}}),(Et(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"})}):Vy(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&&!Vy(p,"bpmn:IntermediateThrowEvent","bpmn:LinkEventDefinition")&&!Nt(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"))}),Se(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}}}),Se(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 Vy(e,t,n){var i=e.$instanceOf(t),r=!1,o=e.eventDefinitions||[];return P(o,function(a){a.$type===n&&(r=!0)}),i&&r}const rM={__depends__:[BT,jy,yv,gn,Rp,vs,iM],__init__:["contextPadProvider"],contextPadProvider:["type",ra]};var oM={horizontal:["x","width"],vertical:["y","height"]},Gy=5;function ui(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:[]})}ui.$inject=["modeling","rules"],ui.prototype.registerFilter=function(e){if(typeof e!="function")throw new Error("the filter has to be a function");this._filters.push(e)},ui.prototype.trigger=function(e,t){var n=this._modeling,i,r;if(!(e.length<3)&&(this._setOrientation(t),r=this._filterElements(e),i=this._createGroups(r),!(i.length<=2)))return n.distributeElements(i,this._axis,this._dimension),i},ui.prototype._filterElements=function(e){var t=this._filters,n=this._axis,i=this._dimension,r=[].concat(e);return t.length?(P(t,function(o){r=o(r,n,i)}),r):e},ui.prototype._createGroups=function(e){var t=[],n=this,i=this._axis,r=this._dimension;if(!i)throw new Error('must have a defined "axis" and "dimension"');var o=Pn(e,i);return P(o,function(a,s){var c=n._findRange(a,i,r),u,l=t[t.length-1];l&&n._hasIntersection(l.range,c)?t[t.length-1].elements.push(a):(u={range:c,elements:[a]},t.push(u))}),t},ui.prototype._setOrientation=function(e){var t=oM[e];this._axis=t[0],this._dimension=t[1]},ui.prototype._hasIntersection=function(e,t){return Math.max(e.min,e.max)>=Math.min(t.min,t.max)&&Math.min(e.min,e.max)<=Math.max(t.min,t.max)},ui.prototype._findRange=function(e){var t=e[this._axis],n=e[this._dimension];return{min:t+Gy,max:t+n-Gy}};const aM={__init__:["distributeElements"],distributeElements:["type",ui]};function dc(e){mn.call(this,e)}dc.$inject=["eventBus"],X(dc,mn),dc.prototype.init=function(){this.addRule("elements.distribute",function(e){var t=e.elements;return t=Re(t,function(n){var i=Se(n,["bpmn:Association","bpmn:BoundaryEvent","bpmn:DataInputAssociation","bpmn:DataOutputAssociation","bpmn:Lane","bpmn:MessageFlow","bpmn:SequenceFlow","bpmn:TextAnnotation"]);return!(n.labelTarget||i)}),t=Ta(t),t.length<3?!1:t})};var Wy={horizontal:`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1800 1800">
326
+ </svg>`};function Mn(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()}Mn.$inject=["bpmnFactory","popupMenu","modeling","moddle","bpmnReplace","rules","translate","moddleCopy"],Mn.prototype._register=function(){this._popupMenu.registerProvider("bpmn-replace",this)},Mn.prototype.getPopupMenuEntries=function(e){var s;var t=e.businessObject,n=this._rules,i=[],r,o=[];if(le(e)||!n.allowed("shape.replace",{element:e}))return{};var a=mM(e);return y(t,"bpmn:DataObjectReference")?this._createEntries(e,RM):y(t,"bpmn:DataStoreReference")&&!y(e.parent,"bpmn:Collaboration")?this._createEntries(e,CM):(y(t,"bpmn:Event")&&!y(t,"bpmn:BoundaryEvent")&&(r=(s=t.get("eventDefinitions")[0])==null?void 0:s.$type,i=kM[r]||[],!Gt(t.$parent)&&y(t.$parent,"bpmn:SubProcess")&&(i=Ee(i,function(c){return c.target.type!=="bpmn:StartEvent"}))),y(t,"bpmn:StartEvent")&&!y(t.$parent,"bpmn:SubProcess")?(o=Ee(vM.concat(i),a),this._createEntries(e,o)):y(t,"bpmn:Participant")?(o=Ee(MM,function(c){return Se(e)!==c.target.isExpanded}),this._createEntries(e,o)):y(t,"bpmn:StartEvent")&&Gt(t.$parent)?(o=Ee(AM.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")&&!Gt(t.$parent)&&y(t.$parent,"bpmn:SubProcess")?(o=Ee(yM.concat(i),a),this._createEntries(e,o)):y(t,"bpmn:EndEvent")?(o=Ee(bM.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=Ee(PM,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=Ee(_M.concat(i),a),this._createEntries(e,o)):y(t,"bpmn:Gateway")?(o=Ee(xM,a),this._createEntries(e,o)):y(t,"bpmn:Transaction")?(o=Ee(d_,a),this._createEntries(e,o)):Gt(t)&&Se(e)?(o=Ee(SM,a),this._createEntries(e,o)):y(t,"bpmn:AdHocSubProcess")&&Se(e)?(o=Ee(wM,a),this._createEntries(e,o)):y(t,"bpmn:SubProcess")&&Se(e)?(o=Ee(EM,a),this._createEntries(e,o)):y(t,"bpmn:SubProcess")&&!Se(e)?(o=Ee(h_,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,TM):y(t,"bpmn:FlowNode")?(o=Ee(h_,a),this._createEntries(e,o)):{})},Mn.prototype.getPopupMenuHeaderEntries=function(e){var t={};return y(e,"bpmn:Activity")&&!Gt(e)&&(t={...t,...this._getLoopCharacteristicsHeaderEntries(e)}),y(e,"bpmn:DataObjectReference")&&(t={...t,...this._getCollectionHeaderEntries(e)}),y(e,"bpmn:Participant")&&(t={...t,...this._getParticipantMultiplicityHeaderEntries(e)}),um(e)&&(t={...t,...this._getNonInterruptingHeaderEntries(e)}),t},Mn.prototype._createEntries=function(e,t){var n={},i=this;return T(t,function(r){n[r.actionName]=i._createEntry(r,e)}),n},Mn.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},Mn.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}},Mn.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"}}}},Mn.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}}},Mn.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}}},Mn.prototype._getNonInterruptingHeaderEntries=function(e){const t=this._translate,n=U(e),i=this,r=lm(e),o=y(e,"bpmn:BoundaryEvent")?m_["intermediate-event-non-interrupting"]:m_["start-event-non-interrupting"],a=!n[r];return{"toggle-non-interrupting":{imageHtml:o,title:t("Toggle non-interrupting"),active:a,action:function(){i._modeling.updateProperties(e,{[r]:!!a})}}}};const DM={__depends__:[jp,Mg,ic],__init__:["replaceMenuProvider"],replaceMenuProvider:["type",Mn]};function ba(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(!(!Wo(d)||!i.isOpen(m))){var g=i.getEntries(m);g.replace&&g.replace.action.click(d,m)}}),n.on("contextPad.close",function(){f.cleanUp()})}ba.$inject=["config.contextPad","injector","eventBus","contextPad","modeling","elementFactory","connect","create","popupMenu","canvas","rules","translate","appendPreview"],ba.prototype.getMultiElementContextPadEntries=function(e){var t=this._modeling,n={};return this._isDeleteAllowed(e)&&D(n,{delete:{group:"edit",className:"bpmn-icon-trash",title:this._translate("Delete"),action:{click:function(i,r){t.removeElements(r.slice())}}}}),n},ba.prototype._isDeleteAllowed=function(e){var t=this._rules.allowed("elements.delete",{elements:e});return le(t)?ur(e,n=>t.includes(n)):t},ba.prototype.getContextPadEntries=function(e){var t=this._contextPad,n=this._modeling,i=this._elementFactory,r=this._connect,o=this._create,a=this._popupMenu,s=this._autoPlace,c=this._translate,u=this._appendPreview,l={};if(e.type==="label")return this._isDeleteAllowed([e])&&D(l,h()),l;var p=e.businessObject;function f(b,x){r.start(b,x)}function d(b,x){n.removeElements([x])}function h(){return{delete:{group:"edit",className:"bpmn-icon-trash",title:c("Delete"),action:{click:d}}}}function m(b){var x=5,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(D({type:b},A));o.start(j,F,{source:L})}var P=s?function(j,L){var F=i.createShape(D({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:P,hover:$}}}function w(b){return function(x,S){n.splitLane(S,b),t.open(S,!0)}}if(xe(p,["bpmn:Lane","bpmn:Participant"])&&Se(e)){var E=zi(e);D(l,{"lane-insert-above":{group:"lane-insert-above",className:"bpmn-icon-lane-insert-above",title:c("Add lane above"),action:{click:function(b,x){n.addLane(x,"top")}}}}),E.length<2&&((At(e)?e.height>=120:e.width>=120)&&D(l,{"lane-divide-two":{group:"lane-divide",className:"bpmn-icon-lane-divide-two",title:c("Divide into two lanes"),action:{click:w(2)}}}),(At(e)?e.height>=180:e.width>=180)&&D(l,{"lane-divide-three":{group:"lane-divide",className:"bpmn-icon-lane-divide-three",title:c("Divide into three lanes"),action:{click:w(3)}}})),D(l,{"lane-insert-below":{group:"lane-insert-below",className:"bpmn-icon-lane-insert-below",title:c("Add lane below"),action:{click:function(b,x){n.addLane(x,"bottom")}}}})}return y(p,"bpmn:FlowNode")&&(y(p,"bpmn:EventBasedGateway")?D(l,{"append.receive-task":g("bpmn:ReceiveTask","bpmn-icon-receive-task",c("Append receive task")),"append.message-intermediate-event":g("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-message",c("Append message intermediate catch event"),{eventDefinitionType:"bpmn:MessageEventDefinition"}),"append.timer-intermediate-event":g("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-timer",c("Append timer intermediate catch event"),{eventDefinitionType:"bpmn:TimerEventDefinition"}),"append.condition-intermediate-event":g("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-condition",c("Append conditional intermediate catch event"),{eventDefinitionType:"bpmn:ConditionalEventDefinition"}),"append.signal-intermediate-event":g("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-signal",c("Append signal intermediate catch event"),{eventDefinitionType:"bpmn:SignalEventDefinition"})}):g_(p,"bpmn:BoundaryEvent","bpmn:CompensateEventDefinition")?D(l,{"append.compensation-activity":g("bpmn:Task","bpmn-icon-task",c("Append compensation activity"),{isForCompensation:!0})}):!y(p,"bpmn:EndEvent")&&!p.isForCompensation&&!g_(p,"bpmn:IntermediateThrowEvent","bpmn:LinkEventDefinition")&&!Gt(p)&&D(l,{"append.end-event":g("bpmn:EndEvent","bpmn-icon-end-event-none",c("Append end event")),"append.gateway":g("bpmn:ExclusiveGateway","bpmn-icon-gateway-none",c("Append gateway")),"append.append-task":g("bpmn:Task","bpmn-icon-task",c("Append task")),"append.intermediate-event":g("bpmn:IntermediateThrowEvent","bpmn-icon-intermediate-event-none",c("Append intermediate/boundary event"))})),a.isEmpty(e,"bpmn-replace")||D(l,{replace:{group:"edit",className:"bpmn-icon-screw-wrench",title:c("Change element"),action:{click:function(b,x){var S=D(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")&&D(l,{"append.text-annotation":g("bpmn:TextAnnotation","bpmn-icon-text-annotation",c("Add text annotation"))}),y(p,"bpmn:MessageFlow")&&D(l,{"append.text-annotation":g("bpmn:TextAnnotation","bpmn-icon-text-annotation",c("Add text annotation"))}),xe(p,["bpmn:FlowNode","bpmn:InteractionNode","bpmn:DataObjectReference","bpmn:DataStoreReference"])&&D(l,{"append.text-annotation":g("bpmn:TextAnnotation","bpmn-icon-text-annotation",c("Add text annotation")),connect:{group:"connect",className:"bpmn-icon-connection-multi",title:c("Connect to other element"),action:{click:f,dragstart:f}}}),y(p,"bpmn:TextAnnotation")&&D(l,{connect:{group:"connect",className:"bpmn-icon-connection-multi",title:c("Connect using association"),action:{click:f,dragstart:f}}}),xe(p,["bpmn:DataObjectReference","bpmn:DataStoreReference"])&&D(l,{connect:{group:"connect",className:"bpmn-icon-connection-multi",title:c("Connect using data input association"),action:{click:f,dragstart:f}}}),y(p,"bpmn:Group")&&D(l,{"append.text-annotation":g("bpmn:TextAnnotation","bpmn-icon-text-annotation",c("Add text annotation"))}),this._isDeleteAllowed([e])&&D(l,h()),l};function g_(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 OM={__depends__:[pM,f_,Wv,Cn,qp,Ls,DM],__init__:["contextPadProvider"],contextPadProvider:["type",ba]};var IM={horizontal:["x","width"],vertical:["y","height"]},v_=5;function wi(e,t){this._modeling=e,this._filters=[],this.registerFilter(function(n){var i=t.allowed("elements.distribute",{elements:n});return le(i)?i:i?n:[]})}wi.$inject=["modeling","rules"],wi.prototype.registerFilter=function(e){if(typeof e!="function")throw new Error("the filter has to be a function");this._filters.push(e)},wi.prototype.trigger=function(e,t){var n=this._modeling,i,r;if(!(e.length<3)&&(this._setOrientation(t),r=this._filterElements(e),i=this._createGroups(r),!(i.length<=2)))return n.distributeElements(i,this._axis,this._dimension),i},wi.prototype._filterElements=function(e){var t=this._filters,n=this._axis,i=this._dimension,r=[].concat(e);return t.length?(T(t,function(o){r=o(r,n,i)}),r):e},wi.prototype._createGroups=function(e){var t=[],n=this,i=this._axis,r=this._dimension;if(!i)throw new Error('must have a defined "axis" and "dimension"');var o=Hn(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},wi.prototype._setOrientation=function(e){var t=IM[e];this._axis=t[0],this._dimension=t[1]},wi.prototype._hasIntersection=function(e,t){return Math.max(e.min,e.max)>=Math.min(t.min,t.max)&&Math.min(e.min,e.max)<=Math.max(t.min,t.max)},wi.prototype._findRange=function(e){var t=e[this._axis],n=e[this._dimension];return{min:t+v_,max:t+n-v_}};const LM={__init__:["distributeElements"],distributeElements:["type",wi]};function kc(e){Rn.call(this,e)}kc.$inject=["eventBus"],Q(kc,Rn),kc.prototype.init=function(){this.addRule("elements.distribute",function(e){var t=e.elements;return t=Ee(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=qa(t),t.length<3?!1:t})};var y_={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>`},sM=900;function oa(e,t,n,i){this._distributeElements=t,this._translate=n,this._popupMenu=e,this._rules=i,e.registerProvider("align-elements",sM,this)}oa.$inject=["popupMenu","distributeElements","translate","rules"],oa.prototype.getPopupMenuEntries=function(e){var t={};return this._isAllowed(e)&&k(t,this._getEntries(e)),t},oa.prototype._isAllowed=function(e){return this._rules.allowed("elements.distribute",{elements:e})},oa.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:Wy.horizontal,action:function(o,a){t.trigger(e,"horizontal"),i.close()}},"distribute-elements-vertical":{group:"distribute",title:n("Distribute elements vertically"),imageHtml:Wy.vertical,action:function(o,a){t.trigger(e,"vertical"),i.close()}}};return r};const cM={__depends__:[vp,aM],__init__:["bpmnDistributeElements","distributeElementsMenuProvider"],bpmnDistributeElements:["type",dc],distributeElementsMenuProvider:["type",oa]};var Uy="is not a registered action",uM="is already registered";function xn(e,t){this._eventBus=e,this._actions={};var n=this;e.on("diagram.init",function(){n._registerDefaultActions(t),e.fire("editorActions.init",{editorActions:n})})}xn.$inject=["eventBus","injector"],xn.prototype._registerDefaultActions=function(e){var t=e.get("commandStack",!1),n=e.get("modeling",!1),i=e.get("selection",!1),r=e.get("zoomScroll",!1),o=e.get("copyPaste",!1),a=e.get("canvas",!1),s=e.get("rules",!1),c=e.get("keyboardMove",!1),u=e.get("keyboardMoveSelection",!1);t&&(this.register("undo",function(){t.undo()}),this.register("redo",function(){t.redo()})),o&&i&&this.register("copy",function(){var l=i.get();if(l.length)return o.copy(l)}),o&&i&&this.register("duplicate",function(){var l=i.get();if(l.length)return o.duplicate(l)}),o&&this.register("paste",function(){o.paste()}),o&&i&&s&&this.register("cut",function(){var l=i.get();if(l.length){var p=s.allowed("elements.delete",{elements:l});if(p!==!1){var f=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)})},xn.prototype.trigger=function(e,t){if(!this._actions[e])throw Pp(e,Uy);var n=this._eventBus.fire("editorActions.allowed",{action:e,opts:t});if(n!==!1)return this._actions[e](t)},xn.prototype.register=function(e,t){var n=this;if(typeof e=="string")return this._registerAction(e,t);P(e,function(i,r){n._registerAction(r,i)})},xn.prototype._registerAction=function(e,t){if(this.isRegistered(e))throw Pp(e,uM);this._actions[e]=t},xn.prototype.unregister=function(e){if(!this.isRegistered(e))throw Pp(e,Uy);this._actions[e]=void 0},xn.prototype.getActions=function(){return Object.keys(this._actions)},xn.prototype.isRegistered=function(e){return!!this._actions[e]};function Pp(e,t){return new Error(e+" "+t)}const lM={__init__:["editorActions"],editorActions:["type",xn]};function hc(e){e.invoke(xn,this)}X(hc,xn),hc.$inject=["injector"],hc.prototype._registerDefaultActions=function(e){xn.prototype._registerDefaultActions.call(this,e);var t=e.get("canvas",!1),n=e.get("elementRegistry",!1),i=e.get("selection",!1),r=e.get("spaceTool",!1),o=e.get("lassoTool",!1),a=e.get("handTool",!1),s=e.get("globalConnect",!1),c=e.get("distributeElements",!1),u=e.get("alignElements",!1),l=e.get("directEditing",!1),p=e.get("searchPad",!1),f=e.get("modeling",!1),d=e.get("contextPad",!1);t&&n&&i&&this._registerAction("selectElements",function(){var 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=Re(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 pM={__depends__:[lM],editorActions:["type",hc]};function qy(e){e.on(["create.init","shape.move.init"],function(t){var n=t.context,i=t.shape;Se(i,["bpmn:Participant","bpmn:SubProcess","bpmn:TextAnnotation"])&&(n.gridSnappingContext||(n.gridSnappingContext={}),n.gridSnappingContext.snapLocation="top-left")})}qy.$inject=["eventBus"];function gr(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)}})}gr.$inject=["eventBus","gridSnapping","modeling"],X(gr,W),gr.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},gr.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},gr.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},gr.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 fM=2e3;function Yy(e,t){e.on(["spaceTool.move","spaceTool.end"],fM,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)}})}Yy.$inject=["eventBus","gridSnapping"];const dM={__init__:["gridSnappingResizeBehavior","gridSnappingSpaceToolBehavior"],gridSnappingResizeBehavior:["type",gr],gridSnappingSpaceToolBehavior:["type",Yy]};var mc=10;function Ap(e,t,n){return n||(n="round"),Math[n](e/t)*t}var hM=1200,mM=800;function Fi(e,t,n){var i=!n||n.active!==!1;this._eventBus=t;var r=this;t.on("diagram.init",mM,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"],hM,function(o){var a=o.originalEvent;if(!(!r.active||a&&Jt(a))){var s=o.context,c=s.gridSnappingContext;c||(c=s.gridSnappingContext={}),["x","y"].forEach(function(u){var l={},p=vM(o,u,e);p&&(l.offset=p);var f=gM(o,u);f&&k(l,f),to(o,u)||r.snapEvent(o,u,l)})}})}Fi.prototype.snapEvent=function(e,t,n){var i=this.snapValue(e[t],n);lt(e,t,i)},Fi.prototype.getGridSpacing=function(){return mc},Fi.prototype.snapValue=function(e,t){var n=0;t&&t.offset&&(n=t.offset),e+=n,e=Ap(e,mc);var i,r;return t&&t.min&&(i=t.min,me(i)&&(i=Ap(i+n,mc,"ceil"),e=Math.max(e,i))),t&&t.max&&(r=t.max,me(r)&&(r=Ap(r+n,mc,"floor"),e=Math.min(e,r))),e-=n,e},Fi.prototype.isActive=function(){return this.active},Fi.prototype.setActive=function(e){this.active=e,this._eventBus.fire("gridSnapping.toggle",{active:e})},Fi.prototype.toggleActive=function(){this.setActive(!this.active)},Fi.$inject=["elementRegistry","eventBus","config.gridSnapping"];function gM(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&&(gc(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&&(gc(t)?Xy(s)?a.x.max=c.left:a.x.min=c.right:Ky(s)?a.y.max=c.top:a.y.min=c.bottom),u&&(gc(t)?Xy(s)?a.x.min=u.left:a.x.max=u.right:Ky(s)?a.y.min=u.top:a.y.max=u.bottom),a[t]}function vM(e,t,n){var i=e.context,r=e.shape,o=i.gridSnappingContext,a=o.snapLocation,s=o.snapOffset;return s&&me(s[t])||(s||(s=o.snapOffset={}),me(s[t])||(s[t]=0),!r)||(n.get(r.id)||(gc(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 gc(e){return e==="x"}function Ky(e){return e.indexOf("n")!==-1}function Xy(e){return e.indexOf("w")!==-1}const yM={__depends__:[dM],__init__:["gridSnapping"],gridSnapping:["type",Fi]};var _M=2e3;function Zy(e,t,n){e.on("autoPlace",_M,function(i){var r=i.source,o=fe(r),a=i.shape,s=Kg(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")&&(bM(c)?u.offset=-a.width/2:u.offset=-a.height/2),s[c]=t.snapValue(s[c],u))}),s})}Zy.$inject=["eventBus","gridSnapping","elementRegistry"];function bM(e){return e==="x"}var xM=1750;function Qy(e,t,n){t.on(["create.start","shape.move.start"],xM,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}))}})}Qy.$inject=["canvas","eventBus","gridSnapping"];var EM=3e3;function vc(e,t,n){W.call(this,e),this._gridSnapping=t;var i=this;this.postExecuted(["connection.create","connection.layout"],EM,function(r){var o=r.context,a=o.connection,s=o.hints||{},c=a.waypoints;s.connectionStart||s.connectionEnd||s.createElementsBehavior===!1||wM(c)&&n.updateWaypoints(a,i.snapMiddleSegments(c))})}vc.$inject=["eventBus","gridSnapping","modeling"],X(vc,W),vc.prototype.snapMiddleSegments=function(e){var t=this._gridSnapping,n;e=e.slice();for(var i=1;i<e.length-2;i++)n=CM(t,e[i],e[i+1]),e[i]=n[0],e[i+1]=n[1];return e};function wM(e){return e.length>3}function SM(e){return e==="h"}function RM(e){return e==="v"}function CM(e,t,n){var i=Kn(t,n),r={};return SM(i)&&(r.y=e.snapValue(t.y)),RM(i)&&(r.x=e.snapValue(t.x)),("x"in r||"y"in r)&&(t=k({},t,r),n=k({},n,r)),[t,n]}const PM={__depends__:[yM,{__init__:["gridSnappingAutoPlaceBehavior","gridSnappingParticipantBehavior","gridSnappingLayoutConnectionBehavior"],gridSnappingAutoPlaceBehavior:["type",Zy],gridSnappingParticipantBehavior:["type",Qy],gridSnappingLayoutConnectionBehavior:["type",vc]}],__init__:["bpmnGridSnapping"],bpmnGridSnapping:["type",qy]};var AM=30,Jy=30;function aa(e,t){this._interactionEvents=t;var n=this;e.on(["interactionEvents.createHit","interactionEvents.updateHit"],function(i){var r=i.element,o=i.gfx;if(y(r,"bpmn:Lane"))return n._createParticipantHit(r,o);if(y(r,"bpmn:Participant"))return Pe(r)?n._createParticipantHit(r,o):n._createDefaultHit(r,o);if(y(r,"bpmn:SubProcess"))return Pe(r)?n._createSubProcessHit(r,o):n._createDefaultHit(r,o)})}aa.$inject=["eventBus","interactionEvents"],aa.prototype._createDefaultHit=function(e,t){return this._interactionEvents.removeHits(t),this._interactionEvents.createDefaultHit(e,t),!0},aa.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=Et(e)?{width:AM,height:e.height}:{width:e.width,height:Jy};return this._interactionEvents.createBoxHit(t,"all",n),!0},aa.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:Jy}),!0};const TM={__init__:["bpmnInteractionEvents"],bpmnInteractionEvents:["type",aa]};function yc(e){e.invoke(Yr,this)}X(yc,Yr),yc.$inject=["injector"],yc.prototype.registerBindings=function(e,t){Yr.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 MM={__depends__:[np],__init__:["keyboardBindings"],keyboardBindings:["type",yc]};var kM={moveSpeed:1,moveSpeedAccelerated:10},DM=1500,e_="left",t_="up",n_="right",i_="down",OM={ArrowLeft:e_,Left:e_,ArrowUp:t_,Up:t_,ArrowRight:n_,Right:n_,ArrowDown:i_,Down:i_},IM={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 r_(e,t,n,i,r){var o=this;this._config=k({},kM,e||{}),t.addListener(DM,function(a){var s=a.keyEvent,c=OM[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=IM[a](u),p=i.allowed("elements.move",{shapes:c,hints:{keyboardMove:!0}});p&&n.moveElements(c,l)}}}r_.$inject=["config.keyboardMoveSelection","keyboard","modeling","rules","selection"];const LM={__depends__:[np,gn],__init__:["keyboardMoveSelection"],keyboardMoveSelection:["type",r_]};var o_=10;function sa(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=R1(l,p,u),c.newBounds=P1(d,f),c.canExecute=r.canResize(c)}function a(c){var u=c.resizeConstraints,l=c.minBounds;u===void 0&&(l===void 0&&(l=r.computeMinResizeBox(c)),c.resizeConstraints={min:ue(l)})}function s(c){var u=c.shape,l=c.canExecute,p=c.newBounds;if(l){if(p=xd(p),!BM(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)})}sa.prototype.canResize=function(e){var t=this._rules,n=Sn(e,["newBounds","shape","delta","direction"]);return t.allowed("shape.resize",n)},sa.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,a_(t,o),"resize",{autoActivate:!0,cursor:NM(o),data:{shape:t,context:r}})},sa.prototype.computeMinResizeBox=function(e){var t=e.shape,n=e.direction,i,r;return i=e.minDimensions||{width:o_,height:o_},r=ch(t,e.childrenBoxPadding),A1(n,t,i,r)},sa.$inject=["eventBus","rules","modeling","dragging"];function BM(e,t){return e.x!==t.x||e.y!==t.y||e.width!==t.width||e.height!==t.height}function a_(e,t){var n=fe(e),i=ue(e),r={x:n.x,y:n.y};return t.indexOf("n")!==-1?r.y=i.top:t.indexOf("s")!==-1&&(r.y=i.bottom),t.indexOf("e")!==-1?r.x=i.right:t.indexOf("w")!==-1&&(r.x=i.left),r}function NM(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 s_="djs-resizing",c_="resize-not-ok",$M=500;function u_(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,s_)),s.width>5&&Z(c,{x:s.x,width:s.width}),s.height>5&&Z(c,{y:s.y,height:s.height}),o.canExecute?Me(c).remove(c_):Me(c).add(c_)}function r(o){var a=o.shape,s=o.frame;s&&gt(o.frame),t.removeMarker(a,s_)}e.on("resize.move",$M,function(o){i(o.context)}),e.on("resize.cleanup",function(o){r(o.context)})}u_.$inject=["eventBus","canvas","previewSupport"];var _c=-6,bc=8,xc=20,ca="djs-resizer",jM=["n","w","s","e","nw","ne","se","sw"];function Hi(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&&P(a,Gt(r.addResizer,r))}),e.on("shape.changed",function(o){var a=o.element;n.isSelected(a)&&(r.removeResizers(),r.addResizer(a))})}Hi.prototype.makeDraggable=function(e,t,n){var i=this._resize;function r(o){Ti(o)&&i.activate(o,e,n)}ve.bind(t,"mousedown",r),ve.bind(t,"touchstart",r)},Hi.prototype._createResizer=function(e,t,n,i){var r=this._getResizersParent(),o=FM(i),a=oe("g");Me(a).add(ca),Me(a).add(ca+"-"+e.id),Me(a).add(ca+"-"+i),ye(r,a);var s=oe("rect");Z(s,{x:-bc/2+o.x,y:-bc/2+o.y,width:bc,height:bc}),Me(s).add(ca+"-visual"),ye(a,s);var c=oe("rect");return Z(c,{x:-xc/2+o.x,y:-xc/2+o.y,width:xc,height:xc}),Me(c).add(ca+"-hit"),ye(a,c),La(a,t,n),a},Hi.prototype.createResizer=function(e,t){var n=a_(e,t),i=this._createResizer(e,n.x,n.y,t);this.makeDraggable(e,i,t)},Hi.prototype.addResizer=function(e){var t=this;je(e)||P(jM,function(n){t._resize.canResize({shape:e,direction:n})&&t.createResizer(e,n)})},Hi.prototype.removeResizers=function(){var e=this._getResizersParent();Ca(e)},Hi.prototype._getResizersParent=function(){return this._canvas.getLayer("resizers")},Hi.$inject=["eventBus","canvas","selection","resize"];function FM(e){var t={x:0,y:0};return e.indexOf("e")!==-1?t.x=-_c:e.indexOf("w")!==-1&&(t.x=_c),e.indexOf("s")!==-1?t.y=-_c:e.indexOf("n")!==-1&&(t.y=_c),t}const l_={__depends__:[jn,ti,Gr],__init__:["resize","resizePreview","resizeHandles"],resize:["type",sa],resizePreview:["type",u_],resizeHandles:["type",Hi]};var HM=2e3;function ua(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"],HM,function(c){i.isActive(c.element)&&i.cancel()}),e.on(["commandStack.changed"],function(c){i.isActive()&&i.cancel()}),e.on("directEditing.activate",function(c){o.removeResizers()}),e.on("create.end",500,function(c){var u=c.context,l=u.shape,p=c.context.canExecute,f=c.isTouch;f||p&&(u.hints&&u.hints.createElementsBehavior===!1||s(l))}),e.on("autoPlace.end",500,function(c){s(c.shape)});function s(c,u){(u||Se(c,["bpmn:Activity","bpmn:Event","bpmn:TextAnnotation","bpmn:Participant"]))&&i.activate(c)}}ua.$inject=["eventBus","bpmnFactory","canvas","directEditing","modeling","resizeHandles","textRenderer"],ua.prototype.activate=function(e){var t=un(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}),(Se(e,["bpmn:Task","bpmn:Participant","bpmn:Lane","bpmn:CallActivity"])||p_(e))&&k(r,{centerVertically:!0}),Ri(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}},ua.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")||GM(e)){var h=Et(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(VM(e)){var g=Et(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)"})}(Se(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"})),zM(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})),Ri(n)&&!$a(n)&&!xe(n)){var x=mu(e),S=t.getAbsoluteBBox({x:x.x,y:x.y,width:0,height:0}),A=u,I=rr.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:kr*a+"px",paddingBottom:kr*a+"px",paddingLeft:kr*a+"px",paddingRight:kr*a+"px",fontSize:p+"px",lineHeight:f})),{bounds:o,style:d}},ua.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}),WM(t)&&(t=null),this._modeling.updateLabel(e,t,r)};function p_(e){return y(e,"bpmn:SubProcess")&&!Pe(e)}function zM(e){return y(e,"bpmn:SubProcess")&&Pe(e)}function VM(e){return y(e,"bpmn:Participant")&&!Pe(e)}function GM(e){return y(e,"bpmn:Participant")&&Pe(e)}function WM(e){return!e||!e.trim()}var f_="djs-element-hidden",d_="djs-label-hidden";function h_(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=oe("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=oe("path");Z(p,{d:l,strokeWidth:2,stroke:UM(o)}),ye(s,p),ye(r,s),Ct(s,o.x,o.y)}y(o,"bpmn:TextAnnotation")||o.labelTarget?t.addMarker(o,f_):(y(o,"bpmn:Task")||y(o,"bpmn:CallActivity")||y(o,"bpmn:SubProcess")||y(o,"bpmn:Participant")||y(o,"bpmn:Lane"))&&t.addMarker(o,d_)}),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}});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,f_),t.removeMarker(o,d_)),o=void 0,a=void 0,s&&(gt(s),s=void 0)})}h_.$inject=["eventBus","canvas","pathMap"];function UM(e,t){var n=De(e);return n.get("stroke")||t||"black"}const qM={__depends__:[Ol,l_,jy],__init__:["labelEditingProvider","labelEditingPreview"],labelEditingProvider:["type",ua],labelEditingPreview:["type",h_]};var YM=500,KM=1e3;function zn(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){PE(o)||i.createOutline(o)}e.on("element.hover",function(o){r(o.element)}),e.on("selection.changed",function(o){P(o.newSelection,r)}),e.on(["shape.changed","connection.changed"],YM,function(o){var a=o.element,s=o.gfx,c=$e(".djs-outline",s);c&&i.updateOutline(a,c)})}zn.prototype.createOutline=function(e){var t=this._elementRegistry.getGraphics(e);if(!t)throw new Error("cannot create outline for non-rendered element");var n=$e(".djs-outline",t);return n||(n=this.getOutline(e)||this._createOutlineGfx(),ye(t,n),this.updateOutline(e,n)),n},zn.prototype._createOutlineGfx=function(){var e=oe("rect");return Z(e,k({x:0,y:0,rx:4,width:100,height:100},this._outlineStyle)),e},zn.prototype.updateOutline=function(e,t){e.waypoints?this.updateConnectionOutline(t,e):this.updateShapeOutline(t,e)},zn.prototype.updateShapeOutline=function(e,t){var n=!1,i=this._getProviders();i.length&&P(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})},zn.prototype.updateConnectionOutline=function(e,t){var n=at(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})},zn.prototype.registerProvider=function(e,t){t||(t=e,e=KM),this._eventBus.on("outline.getProviders",e,function(n){n.providers.push(t)})},zn.prototype._getProviders=function(){var e=this._eventBus.createEvent({type:"outline.getProviders",providers:[]});return this._eventBus.fire(e),e.providers},zn.prototype.getOutline=function(e){var t,n=this._getProviders();return P(n,function(i){xt(i.getOutline)&&(t=t||i.getOutline(e))}),t},zn.$inject=["eventBus","styles","elementRegistry"];var Ec=6;function Tp(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)})}Tp.prototype._updateMultiSelectionOutline=function(e){var t=this._canvas.getLayer("selectionOutline");Ca(t);var n=e.length>1,i=this._canvas.getContainer();if(Me(i)[n?"add":"remove"]("djs-multi-select"),!!n){var r=XM(at(e)),o=oe("rect");Z(o,k({rx:3},r)),Me(o).add("djs-selection-outline"),ye(t,o)}},Tp.$inject=["eventBus","canvas","selection"];function XM(e){return{x:e.x-Ec,y:e.y-Ec,width:e.width+Ec*2,height:e.height+Ec*2}}const Mp={__depends__:[gn],__init__:["outline","multiSelectionOutline"],outline:["type",zn],multiSelectionOutline:["type",Tp]},m_=["bpmn:Event","bpmn:SequenceFlow","bpmn:Gateway"],g_={class:"bjs-label-link",stroke:"var(--element-selected-outline-secondary-stroke-color)",strokeDasharray:"5, 5"},ZM=15,wc=2;function v_(e,t,n,i,r){const o=t.getLayer("overlays");e.on(["selection.changed","shape.changed"],function(){s()}),e.on("selection.changed",function({newSelection:p}){var d;const f=p.filter(h=>Se(h,m_));if(f.length===1){const h=f[0];xe(h)?a(h,h.labelTarget):(d=h.labels)!=null&&d.length&&a(h.labels[0],h)}if(f.length===2){const h=f.find(xe),m=f.find(g=>{var 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;!Se(p,m_)||!l(p)||(xe(p)?a(p,p.labelTarget):(f=p.labels)!=null&&f.length&&a(p.labels[0],p))});function a(p,f){const d=po([fe(f),fe(p)],g_),h=d.getAttribute("d"),g=r.isSelected(p)?c(p):u(p),w=go(g,h);if(!w)return;const b=r.isSelected(f)?c(f):u(f),x=go(b,h)||fe(f);Co(x,w)<ZM||(su(d,[x,w]),ye(o,d))}function s(){Ra(`.${g_.class}`,o).forEach(gt)}function c(p){const f=i.getOutline(p);if(!f)return u(p);if(f.x){const d={x:p.x+zi(f,"x")-wc,y:p.y+zi(f,"y")-wc,width:zi(f,"width")+wc*2,height:zi(f,"height")+wc*2};return vu(d,zi(f,"rx"))}if(f.cx){const d=zi(f,"r"),h={x:p.x+zi(f,"cx")-d,y:p.y+zi(f,"cy")-d,width:d*2,height:d*2};return Wd(h)}}function u(p){return n.getShapePath(p)}function l(p){return r.isSelected(p)}}v_.$inject=["eventBus","canvas","graphicsFactory","outline","selection"];function zi(e,t){return parseFloat(Z(e,t)||0)}const QM={__depends__:[gn,Mp],__init__:["labelLink"],labelLink:["type",v_]};var JM=new Vr("tt");function e2(e){var t=We('<div class="djs-tooltip-container" />');return zt(t,{position:"absolute",width:"0",height:"0"}),e.insertBefore(t,e.firstChild),t}function t2(e,t,n){zt(e,{left:t+"px",top:n+"px"})}function kp(e,t){e.style.display=t===!1?"none":""}var y_="djs-tooltip",Dp="."+y_;function Ut(e,t){this._eventBus=e,this._canvas=t,this._ids=JM,this._tooltipDefaults={show:{minZoom:.7,maxZoom:5}},this._tooltips={},this._tooltipRoot=e2(t.getContainer());var n=this;Xt.bind(this._tooltipRoot,Dp,"mousedown",function(i){i.stopPropagation()}),Xt.bind(this._tooltipRoot,Dp,"mouseover",function(i){n.trigger("mouseover",i)}),Xt.bind(this._tooltipRoot,Dp,"mouseout",function(i){n.trigger("mouseout",i)}),this._init()}Ut.$inject=["eventBus","canvas"],Ut.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},Ut.prototype.trigger=function(e,t){var n=t.delegateTarget||t.target,i=this.get(Lt(n,"data-tooltip-id"));i&&(e==="mouseover"&&i.timeout&&this.clearTimeout(i),e==="mouseout"&&i.timeout&&(i.timeout=1e3,this.setTimeout(i)))},Ut.prototype.get=function(e){return typeof e!="string"&&(e=e.id),this._tooltips[e]},Ut.prototype.clearTimeout=function(e){if(e=this.get(e),!!e){var t=e.removeTimer;t&&(clearTimeout(t),e.removeTimer=null)}},Ut.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)}},Ut.prototype.remove=function(e){var t=this.get(e);t&&(On(t.html),On(t.htmlContainer),delete t.htmlContainer,delete this._tooltips[t.id])},Ut.prototype.show=function(){kp(this._tooltipRoot)},Ut.prototype.hide=function(){kp(this._tooltipRoot,!1)},Ut.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},Ut.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=We(n)),i=We('<div data-tooltip-id="'+t+'" class="'+y_+'">'),zt(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)},Ut.prototype._updateTooltip=function(e){var t=e.position,n=e.htmlContainer;t2(n,t.x,t.y)},Ut.prototype._updateTooltipVisibilty=function(e){P(this._tooltips,function(t){var n=t.show,i=t.htmlContainer,r=!0;n&&((n.minZoom>e.scale||n.maxZoom<e.scale)&&(r=!1),kp(i,r))})},Ut.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 n2={__init__:["tooltips"],tooltips:["type",Ut]};var i2="flow elements must be children of pools/participants",r2="Data object must be placed within a pool/participant.";function __(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(i2)):y(a,"bpmn:DataObjectReference")&&i(r,n(r2)))})}__.$inject=["eventBus","tooltips","translate"];const o2={__depends__:[n2],__init__:["modelingFeedback"],modelingFeedback:["type",__]};var a2=500,s2=1250,c2=1500,Sc=Math.round;function u2(e){return{x:e.x+Sc(e.width/2),y:e.y+Sc(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",c2,function(s){var c=s.context,u=s.shape,l=i.get().slice();l.indexOf(u)===-1&&(l=[u]),l=l2(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",a2,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=Sc(u.x),u.y=Sc(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(Ti(s)){var c=jr(s);if(!c)throw new Error("must supply DOM mousedown event");return a(c,s.element)}});function a(s,c,u,l){if(bt(u)&&(l=u,u=!1),!(c.waypoints||!c.parent)&&!Me(s.target).has("djs-hit-no-move")){var p=u2(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 l2(e){var t=br(e,"id");return Re(e,function(n){for(;n=n.parent;)if(t[n.id])return!1;return!0})}var x_=499,Op="djs-dragging",E_="drop-ok",w_="drop-not-ok",S_="new-parent",R_="attach-ok";function C_(e,t,n,i){function r(c){var u=o(c),l=p2(u);return l}function o(c){var u=fo(c),l=u.flatMap(d=>(d.incoming||[]).concat(d.outgoing||[])),p=u.concat(l),f=[...new Set(p)];return f}function a(c,u){[R_,E_,w_,S_].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,Op),c.allDraggedElements?c.allDraggedElements.push(u):c.allDraggedElements=[u]}e.on("shape.move.start",x_,function(c){var u=c.context,l=u.shapes,p=u.allDraggedElements,f=r(l);if(!u.dragGroup){var d=oe("g");Z(d,n.cls("djs-drag-group",["no-events"]));var h=t.getActiveLayer();ye(h,d),u.dragGroup=d}f.forEach(function(m){i.addDragger(m,u.dragGroup)}),p?p=Mc([p,o(l)]):p=o(l),P(p,function(m){t.addMarker(m,Op)}),u.allDraggedElements=p,u.differentParents=f2(l)}),e.on("shape.move.move",x_,function(c){var u=c.context,l=u.dragGroup,p=u.target,f=u.shape.parent,d=u.canExecute;p&&(d==="attach"?a(p,R_):u.canExecute&&f&&p.id!==f.id?a(p,S_):a(p,u.canExecute?E_:w_)),Ct(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;P(l,function(f){t.removeMarker(f,Op)}),p&&gt(p)}),this.makeDraggable=s}C_.$inject=["eventBus","canvas","styles","previewSupport"];function p2(e){var t=new Set;e.forEach(function(i){t.add(i.id)});var n=Re(e,function(i){return je(i)?t.has(i.source.id)&&t.has(i.target.id):!0});return n}function f2(e){return vb(br(e,function(t){return t.parent&&t.parent.id}))!==1}const d2={__depends__:[ms,gn,Mp,jn,ti,Gr],__init__:["move","movePreview"],move:["type",b_],movePreview:["type",C_]};var P_=".djs-palette-toggle",A_=".entry",h2=P_+", "+A_,Ip="djs-palette-",m2="shown",Lp="open",T_="two-column",g2=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=g2),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(y2,{})},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=We(pt.HTML_MARKUP);n.appendChild(i),Ye(n).add(Ip+m2),Xt.bind(i,h2,"click",function(r){var o=r.delegateTarget;if(Qc(o,P_))return e.toggle();e.trigger("click",r)}),ve.bind(i,"mousedown",function(r){r.stopPropagation()}),Xt.bind(i,A_,"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(T_,r),a.toggle(Ip+T_,r),"open"in e&&(o.toggle(Lp,e.open),a.toggle(Ip+Lp,e.open)),i.fire("palette.changed",{twoColumn:r,open:this.isOpen()})},pt.prototype._update=function(){var e=$e(".djs-palette-entries",this._container),t=this._entries=this.getEntries();wa(e),P(t,function(n,i){var r=n.group||"default",o=$e("[data-group="+Yo(r)+"]",e);o||(o=We('<div class="group"></div>'),Lt(o,"data-group",r),e.appendChild(o));var a=n.html||(n.separator?'<hr class="separator" />':'<div class="entry" draggable="true"></div>'),s=We(a);if(o.appendChild(s),!n.separator&&(Lt(s,"data-action",i),n.title&&Lt(s,"title",n.title),n.className&&v2(s,n.className),n.imageUrl)){var c=We("<img>");Lt(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=Lt(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(xt(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=$e(".djs-palette-entries",this._container),this._toolsContainer=$e("[data-group=tools]",t)),n=this._toolsContainer,P(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(Lp)},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 v2(e,t){var n=Ye(e),i=pe(t)?t:t.split(/\s+/g);i.forEach(function(r){n.add(r)})}function y2(e,t){var n=t.getPaletteEntries();return xt(n)?n(e):(P(n,function(i,r){e[r]=i}),e)}const _2={__init__:["palette"],palette:["type",pt]};var M_="crosshair",k_="selected",b2="djs-dragging-active-lasso";function Vi(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=oe("rect");Z(d,{class:"djs-lasso-overlay",width:1,height:1,x:0,y:0}),ye(f,d),u(!0),this.update(p)},update:function(p){var f=p.frame,d=p.bbox;f&&d&&Z(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,k_);for(const g of h)m.has(g)||t.addMarker(g,k_)}},remove:function(p){this.update(p),p.frame&&gt(p.frame),u(!1)}};function u(p){Me(t.getContainer()).toggle(b2,p)}function l(p){var f=i.getAll();return new Set(_r(Cr(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=D_(p),f.add=cs(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=D_(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(cs(p))return s.activateLasso(p.originalEvent),!0})}Vi.$inject=["eventBus","canvas","dragging","elementRegistry","selection","toolManager","mouse"],Vi.prototype.activateLasso=function(e,t){this._dragging.init(e,"lasso",{autoActivate:t,cursor:M_,data:{context:{}},keepSelection:!0})},Vi.prototype.activateSelection=function(e,t){this._dragging.init(e,"lasso.selection",{trapClick:!1,autoActivate:t,cursor:M_,data:{context:{}},keepSelection:!0})},Vi.prototype._select=function(e){this._selection.select(e)},Vi.prototype.select=function(e,t,n=[]){var i=_r(Cr(e,t));this._select([...n,...i])},Vi.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateSelection(e,!!e)},Vi.prototype.isActive=function(){var e=this._dragging.context();return e&&/^lasso/.test(e.prefix)};function D_(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 x2={__depends__:[_s,Do],__init__:["lassoTool"],lassoTool:["type",Vi]};var Bp=1500,O_="grab";function no(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",Bp,function(c){if(To(c))return a.activateMove(c.originalEvent,!0),!1}),s&&s.addListener(Bp,function(c){if(!(!I_(c.keyEvent)||a.isActive())){var u=a._mouse.getLastMoveEvent();a.activateMove(u,!!u)}},"keyboard.keydown"),s&&s.addListener(Bp,function(c){!I_(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!To(c)&&l&&e.once("hand.move.ended",function(p){a.activateHand(p.originalEvent,!0,!0)}),!1})}no.$inject=["eventBus","canvas","dragging","injector","toolManager","mouse"],no.prototype.activateMove=function(e,t,n){typeof t=="object"&&(n=t,t=!1),this._dragging.init(e,"hand.move",{autoActivate:t,cursor:O_,data:{context:n||{}}})},no.prototype.activateHand=function(e,t,n){this._dragging.init(e,"hand",{trapClick:!1,autoActivate:t,cursor:O_,data:{context:{reactivate:n}}})},no.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateHand(e,!!e)},no.prototype.isActive=function(){var e=this._dragging.context();return e?/^(hand|hand\.move)$/.test(e.prefix):!1};function I_(e){return vt("Space",e)}const E2={__depends__:[_s,Do],__init__:["handTool"],handTool:["type",no]};var L_="connect-ok",B_="connect-not-ok";function io(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?L_:B_))}),e.on(["global-connect.out","global-connect.cleanup"],function(c){var u=c.context.startTarget,l=c.context.canStartConnect;u&&i.removeMarker(u,l?L_:B_)}),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})}io.$inject=["eventBus","dragging","connect","canvas","toolManager","rules","mouse"],io.prototype.start=function(e,t){this._dragging.init(e,"global-connect",{autoActivate:t,trapClick:!1,data:{context:{}}})},io.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();return this.start(e,!!e)},io.prototype.isActive=function(){var e=this._dragging.context();return e&&/^global-connect/.test(e.prefix)},io.prototype.canStartConnect=function(e){return this._rules.allowed("connection.start",{source:e})};const w2={__depends__:[Rp,jn,ti,_s,Do],globalConnect:["type",io]};function Np(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)}Np.$inject=["palette","create","elementFactory","spaceTool","lassoTool","handTool","globalConnect","translate"],Np.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 S2={__depends__:[_2,vs,ug,x2,E2,w2,Eo],__init__:["paletteProvider"],paletteProvider:["type",Np]};var R2=250;function $p(e,t,n,i,r){W.call(this,e);function o(s){var c=s.canExecute.replacements;P(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=$e('[data-element-id="'+Yo(f.id)+'"]',s.dragGroup);h&&Z(h,{display:"none"});var m=r.addDragger(d,s.dragGroup);s.visualReplacements[l]=m,i.removeShape(d)}})}function a(s){var c=s.visualReplacements;P(c,function(u,l){var p=$e('[data-element-id="'+Yo(l)+'"]',s.dragGroup);p&&Z(p,{display:"inline"}),u.remove(),c[l]&&delete c[l]})}e.on("shape.move.move",R2,function(s){var c=s.context,u=c.canExecute;c.visualReplacements||(c.visualReplacements={}),u&&u.replacements?o(c):a(c)})}$p.$inject=["eventBus","elementRegistry","elementFactory","canvas","previewSupport"],X($p,W);const C2={__depends__:[Gr],__init__:["bpmnReplacePreview"],bpmnReplacePreview:["type",$p]};var P2=1250,jp=40,A2=20,T2=10,N_=20,$_=["x","y"],M2=Math.abs;function j_(e){e.on(["connect.hover","connect.move","connect.end"],P2,function(t){var n=t.context,i=n.canExecute,r=n.start,o=n.hover,a=n.source,s=n.target;t.originalEvent&&Jt(t.originalEvent)||(n.initialConnectionStart||(n.initialConnectionStart=n.connectionStart),i&&o&&k2(t,o,L2(o)),o&&I2(i,["bpmn:Association","bpmn:DataInputAssociation","bpmn:DataOutputAssociation","bpmn:SequenceFlow"])?(n.connectionStart=_n(r),Se(o,["bpmn:Event","bpmn:Gateway"])&&F_(t,_n(o)),Se(o,["bpmn:Task","bpmn:SubProcess"])&&D2(t,o),y(a,"bpmn:BoundaryEvent")&&s===a.host&&O2(t)):H_(i,"bpmn:MessageFlow")?(y(r,"bpmn:Event")&&(n.connectionStart=_n(r)),y(o,"bpmn:Event")&&F_(t,_n(o))):n.connectionStart=n.initialConnectionStart)})}j_.$inject=["eventBus"];function k2(e,t,n){$_.forEach(function(i){var r=z_(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 D2(e,t){var n=_n(t);$_.forEach(function(i){B2(e,t,i)&&lt(e,i,n[i])})}function O2(e){var t=e.context,n=t.source,i=t.target;if(!N2(t)){var r=_n(n),o=Rt(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;M2(c-r[s])<jp&&(c>r[s]?u=r[s]+jp:u=r[s]-jp,lt(e,s,u))})}}function F_(e,t){lt(e,"x",t.x),lt(e,"y",t.y)}function H_(e,t){return e&&e.type===t}function I2(e,t){return di(t,function(n){return H_(e,n)})}function z_(e,t){return e==="x"?t.width:t.height}function L2(e){return y(e,"bpmn:Task")?T2:A2}function B2(e,t,n){return e[n]>t[n]+N_&&e[n]<t[n]+z_(n,t)-N_}function N2(e){var t=e.hover,n=e.source;return t&&n&&t===n}function Gi(){this._targets={},this._snapOrigins={},this._snapLocations=[],this._defaultSnaps={}}Gi.prototype.getSnapOrigin=function(e){return this._snapOrigins[e]},Gi.prototype.setSnapOrigin=function(e,t){this._snapOrigins[e]=t,this._snapLocations.indexOf(e)===-1&&this._snapLocations.push(e)},Gi.prototype.addDefaultSnap=function(e,t){var n=this._defaultSnaps[e];n||(n=this._defaultSnaps[e]=[]),n.push(t)},Gi.prototype.getSnapLocations=function(){return this._snapLocations},Gi.prototype.setSnapLocations=function(e){this._snapLocations=e},Gi.prototype.pointsForTarget=function(e){var t=e.id||e,n=this._targets[t];return n||(n=this._targets[t]=new Rc,n.initDefaults(this._defaultSnaps)),n};function Rc(){this._snapValues={}}Rc.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)},Rc.prototype.snap=function(e,t,n,i){var r=this._snapValues[t];return r&&RT(e[n],r[n],i)},Rc.prototype.initDefaults=function(e){var t=this;P(e||{},function(n,i){P(n,function(r){t.add(i,r)})})};var $2=1250;function Vn(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"],$2,function(r){var o=r.context,a=o.shape,s=o.snapContext,c=o.target;if(!(r.originalEvent&&Jt(r.originalEvent))&&!(to(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()})}Vn.$inject=["elementRegistry","eventBus","snapping"],Vn.prototype.initSnap=function(e){var t=this._elementRegistry,n=e.context,i=n.shape,r=n.snapContext;r||(r=n.snapContext=new Gi);var o;t.get(i.id)?o=_n(i,e):o={x:e.x+_n(i).x,y:e.y+_n(i).y};var a={x:o.x-i.width/2,y:o.y-i.height/2},s={x:o.x+i.width/2,y:o.y+i.height/2};return r.setSnapOrigin("mid",{x:o.x-e.x,y:o.y-e.y}),xe(i)||(r.setSnapOrigin("top-left",{x:a.x-e.x,y:a.y-e.y}),r.setSnapOrigin("bottom-right",{x:s.x-e.x,y:s.y-e.y})),r},Vn.prototype.addSnapTargetPoints=function(e,t,n){var i=this.getSnapTargets(t,n);return P(i,function(r){if(xe(r)){xe(t)&&e.add("mid",_n(r));return}if(je(r)){if(r.waypoints.length<3)return;var o=r.waypoints.slice(1,-1);P(o,function(a){e.add("mid",a)});return}e.add("mid",_n(r))}),!me(t.x)||!me(t.y)||this._elementRegistry.get(t.id)&&e.add("mid",_n(t)),e},Vn.prototype.getSnapTargets=function(e,t){return Ay(t).filter(function(n){return!j2(n)})};function j2(e){return!!e.hidden}var V_=1500;function ro(e,t){t.invoke(Vn,this),e.on(["create.move","create.end"],V_,V2),e.on(["create.move","create.end","shape.move.move","shape.move.end"],V_,function(n){var i=n.context,r=i.canExecute,o=i.target,a=r&&(r==="attach"||r.attach);a&&!to(n)&&F2(n,o)})}X(ro,Vn),ro.$inject=["eventBus","injector"],ro.prototype.initSnap=function(e){var t=Vn.prototype.initSnap.call(this,e),n=e.shape,i=!!this._elementRegistry.get(n.id);return P(n.outgoing,function(r){var o=r.waypoints[0];o=o.original||o,t.setSnapOrigin(r.id+"-docking",W_(o,i,e))}),P(n.incoming,function(r){var o=r.waypoints[r.waypoints.length-1];o=o.original||o,t.setSnapOrigin(r.id+"-docking",W_(o,i,e))}),y(n,"bpmn:Participant")&&t.setSnapLocations(["top-left","bottom-right","mid"]),t},ro.prototype.addSnapTargetPoints=function(e,t,n){Vn.prototype.addSnapTargetPoints.call(this,e,t,n);var i=this.getSnapTargets(t,n);P(i,function(o){(z2(o)||H2([t,o],"bpmn:TextAnnotation"))&&(e.add("top-left",Cy(o)),e.add("bottom-right",Py(o)))});var r=this._elementRegistry;return P(t.incoming,function(o){if(r.get(t.id)){G_(i,o.source)||e.add("mid",fe(o.source));var a=o.waypoints[0];e.add(o.id+"-docking",a.original||a)}}),P(t.outgoing,function(o){if(r.get(t.id)){G_(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},ro.prototype.getSnapTargets=function(e,t){return Vn.prototype.getSnapTargets.call(this,e,t).filter(function(n){return!y(n,"bpmn:Lane")})};function F2(e,t){var n=ue(t),i=om(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 H2(e,t){return e.every(function(n){return y(n,t)})}function z2(e){return y(e,"bpmn:SubProcess")&&Pe(e)?!0:y(e,"bpmn:Participant")}function V2(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 G_(e,t){return e.indexOf(t)!==-1}function W_(e,t,n){return t?{x:e.x-n.x,y:e.y-n.y}:{x:e.x,y:e.y}}var G2=1250;function la(e,t){var n=this;e.on(["resize.start"],function(i){n.initSnap(i)}),e.on(["resize.move","resize.end"],G2,function(i){var r=i.context,o=r.shape,a=o.parent,s=r.direction,c=r.snapContext;if(!(i.originalEvent&&Jt(i.originalEvent))&&!to(i)){var u=c.pointsForTarget(a);u.initialized||(u=n.addSnapTargetPoints(u,o,a,s),u.initialized=!0),q2(s)&&lt(i,"x",i.x),Y2(s)&&lt(i,"y",i.y),t.snap(i,u)}}),e.on(["resize.cleanup"],function(){t.hide()})}la.prototype.initSnap=function(e){var t=e.context,n=t.shape,i=t.direction,r=t.snapContext;r||(r=t.snapContext=new Gi);var o=U_(n,i);return r.setSnapOrigin("corner",{x:o.x-e.x,y:o.y-e.y}),r},la.prototype.addSnapTargetPoints=function(e,t,n,i){var r=this.getSnapTargets(t,n);return P(r,function(o){e.add("corner",Py(o)),e.add("corner",Cy(o))}),e.add("corner",U_(t,i)),e},la.$inject=["eventBus","snapping"],la.prototype.getSnapTargets=function(e,t){return Ay(t).filter(function(n){return!W2(n,e)&&!je(n)&&!U2(n)&&!xe(n)})};function U_(e,t){var n=fe(e),i=ue(e),r={x:n.x,y:n.y};return t.indexOf("n")!==-1?r.y=i.top:t.indexOf("s")!==-1&&(r.y=i.bottom),t.indexOf("e")!==-1?r.x=i.right:t.indexOf("w")!==-1&&(r.x=i.left),r}function W2(e,t){return e.host===t}function U2(e){return!!e.hidden}function q2(e){return e==="n"||e==="s"}function Y2(e){return e==="e"||e==="w"}var K2=7,X2=1e3;function Wi(e){this._canvas=e,this._asyncHide=Dc(Gt(this.hide,this),X2)}Wi.$inject=["canvas"],Wi.prototype.snap=function(e,t){var n=e.context,i=n.snapContext,r=i.getSnapLocations(),o={x:to(e,"x"),y:to(e,"y")};P(r,function(a){var s=i.getSnapOrigin(a),c={x:e.x+s.x,y:e.y+s.y};if(P(["x","y"],function(u){var l;o[u]||(l=t.snap(c,a,u,K2),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),P(["x","y"],function(a){var s=o[a];bt(s)&&lt(e,a,s.originValue)})},Wi.prototype._createLine=function(e){var t=this._canvas.getLayer("snap"),n=oe("path");return Z(n,{d:"M0,0 L0,0"}),Me(n).add("djs-snap-line"),ye(t,n),{update:function(i){me(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"})}}},Wi.prototype._createSnapLines=function(){this._snapLines={horizontal:this._createLine("horizontal"),vertical:this._createLine("vertical")}},Wi.prototype.showSnapLine=function(e,t){var n=this.getSnapLine(e);n&&n.update(t),this._asyncHide()},Wi.prototype.getSnapLine=function(e){return this._snapLines||this._createSnapLines(),this._snapLines[e]},Wi.prototype.hide=function(){P(this._snapLines,function(e){e.update()})};const Z2={__depends__:[{__init__:["createMoveSnapping","resizeSnapping","snapping"],createMoveSnapping:["type",Vn],resizeSnapping:["type",la],snapping:["type",Wi]}],__init__:["connectSnapping","createMoveSnapping"],connectSnapping:["type",j_],createMoveSnapping:["type",ro]};var q_=300;function _e(e,t,n,i){this._open=!1,this._results={},this._eventMaps=[],this._cachedRootElement=null,this._cachedSelection=null,this._cachedViewbox=null,this._canvas=e,this._eventBus=t,this._selection=n,this._translate=i,this._container=this._getBoxHtml(),this._searchInput=$e(_e.INPUT_SELECTOR,this._container),this._resultsContainer=$e(_e.RESULTS_CONTAINER_SELECTOR,this._container),this._canvas.getContainer().appendChild(this._container),t.on(["canvas.destroy","diagram.destroy","drag.init","elements.changed"],this.close,this)}_e.$inject=["canvas","eventBus","selection","translate"],_e.prototype._bindEvents=function(){var e=this;function t(n,i,r,o){e._eventMaps.push({el:n,type:r,listener:Xt.bind(n,i,r,o)})}t(document,"html","click",function(n){e.close(!1)}),t(this._container,_e.INPUT_SELECTOR,"click",function(n){n.stopPropagation(),n.delegateTarget.focus()}),t(this._container,_e.RESULT_SELECTOR,"mouseover",function(n){n.stopPropagation(),e._scrollToNode(n.delegateTarget),e._preselect(n.delegateTarget)}),t(this._container,_e.RESULT_SELECTOR,"click",function(n){n.stopPropagation(),e._select(n.delegateTarget)}),t(this._container,_e.INPUT_SELECTOR,"keydown",function(n){vt("ArrowUp",n)&&n.preventDefault(),vt("ArrowDown",n)&&n.preventDefault()}),t(this._container,_e.INPUT_SELECTOR,"keyup",function(n){if(vt("Escape",n))return e.close();if(vt("Enter",n)){var i=e._getCurrentResult();return i?e._select(i):e.close(!1)}if(vt("ArrowUp",n))return e._scrollToDirection(!0);if(vt("ArrowDown",n))return e._scrollToDirection();vt(["ArrowLeft","ArrowRight"],n)||e._search(n.delegateTarget.value)})},_e.prototype._unbindEvents=function(){this._eventMaps.forEach(function(e){Xt.unbind(e.el,e.type,e.listener)})},_e.prototype._search=function(e){var t=this;if(this._clearResults(),!!e.trim()){var n=this._searchProvider.find(e);if(n=n.filter(function(r){return!t._canvas.getRootElements().includes(r.element)}),!n.length){this._selection.select(null);return}n.forEach(function(r){var o=r.element.id,a=t._createResultNode(r,o);t._results[o]={element:r.element,node:a}});var i=$e(_e.RESULT_SELECTOR,this._resultsContainer);this._scrollToNode(i),this._preselect(i)}},_e.prototype._scrollToDirection=function(e){var t=this._getCurrentResult();if(t){var n=e?t.previousElementSibling:t.nextElementSibling;n&&(this._scrollToNode(n),this._preselect(n))}},_e.prototype._scrollToNode=function(e){if(!(!e||e===this._getCurrentResult())){var t=e.offsetTop,n=this._resultsContainer.scrollTop,i=t-this._resultsContainer.clientHeight+e.clientHeight;t<n?this._resultsContainer.scrollTop=t:n<i&&(this._resultsContainer.scrollTop=i)}},_e.prototype._clearResults=function(){wa(this._resultsContainer),this._results={},this._eventBus.fire("searchPad.cleared")},_e.prototype._getCurrentResult=function(){return $e(_e.RESULT_SELECTED_SELECTOR,this._resultsContainer)},_e.prototype._createResultNode=function(e,t){var n=We(_e.RESULT_HTML);return e.primaryTokens.length>0&&Y_(n,e.primaryTokens,_e.RESULT_PRIMARY_HTML),Y_(n,e.secondaryTokens,_e.RESULT_SECONDARY_HTML),Lt(n,_e.RESULT_ID_ATTRIBUTE,t),this._resultsContainer.appendChild(n),n},_e.prototype.registerProvider=function(e){this._searchProvider=e},_e.prototype.open=function(){if(!this._searchProvider)throw new Error("no search provider registered");this.isOpen()||(this._cachedRootElement=this._canvas.getRootElement(),this._cachedSelection=this._selection.get(),this._cachedViewbox=this._canvas.viewbox(),this._selection.select(null),this._bindEvents(),this._open=!0,Ye(this._canvas.getContainer()).add("djs-search-open"),Ye(this._container).add("open"),this._searchInput.focus(),this._eventBus.fire("searchPad.opened"))},_e.prototype.close=function(e=!0){this.isOpen()&&(e&&(this._cachedRootElement&&this._canvas.setRootElement(this._cachedRootElement),this._cachedSelection&&this._selection.select(this._cachedSelection),this._cachedViewbox&&this._canvas.viewbox(this._cachedViewbox),this._eventBus.fire("searchPad.restored")),this._cachedRootElement=null,this._cachedSelection=null,this._cachedViewbox=null,this._unbindEvents(),this._open=!1,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())},_e.prototype.toggle=function(){this.isOpen()?this.close():this.open()},_e.prototype.isOpen=function(){return this._open},_e.prototype._preselect=function(e){var t=this._getCurrentResult();if(e!==t){t&&Ye(t).remove(_e.RESULT_SELECTED_CLASS);var n=Lt(e,_e.RESULT_ID_ATTRIBUTE),i=this._results[n].element;Ye(e).add(_e.RESULT_SELECTED_CLASS),this._canvas.scrollToElement(i,{top:q_}),this._selection.select(i),this._eventBus.fire("searchPad.preselected",i)}},_e.prototype._select=function(e){var t=Lt(e,_e.RESULT_ID_ATTRIBUTE),n=this._results[t].element;this._cachedSelection=null,this._cachedViewbox=null,this.close(!1),this._canvas.scrollToElement(n,{top:q_}),this._selection.select(n),this._eventBus.fire("searchPad.selected",n)},_e.prototype._getBoxHtml=function(){const e=We(_e.BOX_HTML),t=$e(_e.INPUT_SELECTOR,e);return t&&t.setAttribute("aria-label",this._translate("Search in diagram")),e};function Y_(e,t,n){var i=Q2(t),r=We(n);r.innerHTML=i,e.appendChild(r)}function Q2(e){var t="";return e.forEach(function(n){var i=nv(n.value||n.matched||n.normal),r=n.match||n.matched;r?t+='<b class="'+_e.RESULT_HIGHLIGHT_CLASS+'">'+i+"</b>":t+=i}),t!==""?t:null}_e.CONTAINER_SELECTOR=".djs-search-container",_e.INPUT_SELECTOR=".djs-search-input input",_e.RESULTS_CONTAINER_SELECTOR=".djs-search-results",_e.RESULT_SELECTOR=".djs-search-result",_e.RESULT_SELECTED_CLASS="djs-search-result-selected",_e.RESULT_SELECTED_SELECTOR="."+_e.RESULT_SELECTED_CLASS,_e.RESULT_ID_ATTRIBUTE="data-result-id",_e.RESULT_HIGHLIGHT_CLASS="djs-search-highlight",_e.BOX_HTML=`<div class="djs-search-container djs-scrollable">
334
+ </svg>`},NM=900;function xa(e,t,n,i){this._distributeElements=t,this._translate=n,this._popupMenu=e,this._rules=i,e.registerProvider("align-elements",NM,this)}xa.$inject=["popupMenu","distributeElements","translate","rules"],xa.prototype.getPopupMenuEntries=function(e){var t={};return this._isAllowed(e)&&D(t,this._getEntries(e)),t},xa.prototype._isAllowed=function(e){return this._rules.allowed("elements.distribute",{elements:e})},xa.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:y_.horizontal,action:function(o,a){t.trigger(e,"horizontal"),i.close()}},"distribute-elements-vertical":{group:"distribute",title:n("Distribute elements vertically"),imageHtml:y_.vertical,action:function(o,a){t.trigger(e,"vertical"),i.close()}}};return r};const BM={__depends__:[jp,LM],__init__:["bpmnDistributeElements","distributeElementsMenuProvider"],bpmnDistributeElements:["type",kc],distributeElementsMenuProvider:["type",xa]};var __="is not a registered action",$M="is already registered";function kn(e,t){this._eventBus=e,this._actions={};var n=this;e.on("diagram.init",function(){n._registerDefaultActions(t),e.fire("editorActions.init",{editorActions:n})})}kn.$inject=["eventBus","injector"],kn.prototype._registerDefaultActions=function(e){var t=e.get("commandStack",!1),n=e.get("modeling",!1),i=e.get("selection",!1),r=e.get("zoomScroll",!1),o=e.get("copyPaste",!1),a=e.get("canvas",!1),s=e.get("rules",!1),c=e.get("keyboardMove",!1),u=e.get("keyboardMoveSelection",!1);t&&(this.register("undo",function(){t.undo()}),this.register("redo",function(){t.redo()})),o&&i&&this.register("copy",function(){var l=i.get();if(l.length)return o.copy(l)}),o&&i&&this.register("duplicate",function(){var l=i.get();if(l.length)return o.duplicate(l)}),o&&this.register("paste",function(){o.paste()}),o&&i&&s&&this.register("cut",function(){var l=i.get();if(l.length){var p=s.allowed("elements.delete",{elements:l});if(p!==!1){var f=le(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&&(le(p)?f=p:f=l,f.length&&n.removeElements(f.slice()))}}),c&&this.register("moveCanvas",function(l){c.moveCanvas(l)}),u&&this.register("moveSelection",function(l){u.moveSelection(l.direction,l.accelerated)})},kn.prototype.trigger=function(e,t){if(!this._actions[e])throw Kp(e,__);var n=this._eventBus.fire("editorActions.allowed",{action:e,opts:t});if(n!==!1)return this._actions[e](t)},kn.prototype.register=function(e,t){var n=this;if(typeof e=="string")return this._registerAction(e,t);T(e,function(i,r){n._registerAction(r,i)})},kn.prototype._registerAction=function(e,t){if(this.isRegistered(e))throw Kp(e,$M);this._actions[e]=t},kn.prototype.unregister=function(e){if(!this.isRegistered(e))throw Kp(e,__);this._actions[e]=void 0},kn.prototype.getActions=function(){return Object.keys(this._actions)},kn.prototype.isRegistered=function(e){return!!this._actions[e]};function Kp(e,t){return new Error(e+" "+t)}const jM={__init__:["editorActions"],editorActions:["type",kn]};function Dc(e){e.invoke(kn,this)}Q(Dc,kn),Dc.$inject=["injector"],Dc.prototype._registerDefaultActions=function(e){kn.prototype._registerDefaultActions.call(this,e);var t=e.get("canvas",!1),n=e.get("elementRegistry",!1),i=e.get("selection",!1),r=e.get("spaceTool",!1),o=e.get("lassoTool",!1),a=e.get("handTool",!1),s=e.get("globalConnect",!1),c=e.get("distributeElements",!1),u=e.get("alignElements",!1),l=e.get("directEditing",!1),p=e.get("searchPad",!1),f=e.get("modeling",!1),d=e.get("contextPad",!1);t&&n&&i&&this._registerAction("selectElements",function(){var 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=Ee(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=ut(g),f.moveElements(g,{x:-m.x,y:-m.y},h)}),i&&d&&this._registerAction("replaceElement",function(h){d.triggerEntry("replace","click",h)})};const FM={__depends__:[jM],editorActions:["type",Dc]};function b_(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")})}b_.$inject=["eventBus"];function kr(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;en(a)?r.newBounds=n.snapComplex(c,a):r.newBounds=n.snapSimple(s,c)}})}kr.$inject=["eventBus","gridSnapping","modeling"],Q(kr,W),kr.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},kr.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},kr.prototype.snapHorizontally=function(e,t){var n=this._gridSnapping,i=/w/.test(t),r=/e/.test(t),o={};return o.width=n.snapValue(e.width,{min:e.width}),r&&(i?(o.x=n.snapValue(e.x,{max:e.x}),o.width+=n.snapValue(e.x-o.x,{min:e.x-o.x})):e.x=e.x+e.width-o.width),D(e,o),e},kr.prototype.snapVertically=function(e,t){var n=this._gridSnapping,i=/n/.test(t),r=/s/.test(t),o={};return o.height=n.snapValue(e.height,{min:e.height}),i&&(r?(o.y=n.snapValue(e.y,{max:e.y}),o.height+=n.snapValue(e.y-o.y,{min:e.y-o.y})):e.y=e.y+e.height-o.height),D(e,o),e};var HM=2e3;function x_(e,t){e.on(["spaceTool.move","spaceTool.end"],HM,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)}})}x_.$inject=["eventBus","gridSnapping"];const zM={__init__:["gridSnappingResizeBehavior","gridSnappingSpaceToolBehavior"],gridSnappingResizeBehavior:["type",kr],gridSnappingSpaceToolBehavior:["type",x_]};var Oc=10;function Xp(e,t,n){return n||(n="round"),Math[n](e/t)*t}var VM=1200,GM=800;function tr(e,t,n){var i=!n||n.active!==!1;this._eventBus=t;var r=this;t.on("diagram.init",GM,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"],VM,function(o){var a=o.originalEvent;if(!(!r.active||a&&sn(a))){var s=o.context,c=s.gridSnappingContext;c||(c=s.gridSnappingContext={}),["x","y"].forEach(function(u){var l={},p=UM(o,u,e);p&&(l.offset=p);var f=WM(o,u);f&&D(l,f),yo(o,u)||r.snapEvent(o,u,l)})}})}tr.prototype.snapEvent=function(e,t,n){var i=this.snapValue(e[t],n);dt(e,t,i)},tr.prototype.getGridSpacing=function(){return Oc},tr.prototype.snapValue=function(e,t){var n=0;t&&t.offset&&(n=t.offset),e+=n,e=Xp(e,Oc);var i,r;return t&&t.min&&(i=t.min,de(i)&&(i=Xp(i+n,Oc,"ceil"),e=Math.max(e,i))),t&&t.max&&(r=t.max,de(r)&&(r=Xp(r+n,Oc,"floor"),e=Math.min(e,r))),e-=n,e},tr.prototype.isActive=function(){return this.active},tr.prototype.setActive=function(e){this.active=e,this._eventBus.fire("gridSnapping.toggle",{active:e})},tr.prototype.toggleActive=function(){this.setActive(!this.active)},tr.$inject=["elementRegistry","eventBus","config.gridSnapping"];function WM(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&&(Ic(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&&(Ic(t)?w_(s)?a.x.max=c.left:a.x.min=c.right:E_(s)?a.y.max=c.top:a.y.min=c.bottom),u&&(Ic(t)?w_(s)?a.x.min=u.left:a.x.max=u.right:E_(s)?a.y.min=u.top:a.y.max=u.bottom),a[t]}function UM(e,t,n){var i=e.context,r=e.shape,o=i.gridSnappingContext,a=o.snapLocation,s=o.snapOffset;return s&&de(s[t])||(s||(s=o.snapOffset={}),de(s[t])||(s[t]=0),!r)||(n.get(r.id)||(Ic(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 Ic(e){return e==="x"}function E_(e){return e.indexOf("n")!==-1}function w_(e){return e.indexOf("w")!==-1}const qM={__depends__:[zM],__init__:["gridSnapping"],gridSnapping:["type",tr]};var YM=2e3;function S_(e,t,n){e.on("autoPlace",YM,function(i){var r=i.source,o=pe(r),a=i.shape,s=Ev(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")&&(KM(c)?u.offset=-a.width/2:u.offset=-a.height/2),s[c]=t.snapValue(s[c],u))}),s})}S_.$inject=["eventBus","gridSnapping","elementRegistry"];function KM(e){return e==="x"}var XM=1750;function R_(e,t,n){t.on(["create.start","shape.move.start"],XM,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}))}})}R_.$inject=["canvas","eventBus","gridSnapping"];var ZM=3e3;function Lc(e,t,n){W.call(this,e),this._gridSnapping=t;var i=this;this.postExecuted(["connection.create","connection.layout"],ZM,function(r){var o=r.context,a=o.connection,s=o.hints||{},c=a.waypoints;s.connectionStart||s.connectionEnd||s.createElementsBehavior===!1||QM(c)&&n.updateWaypoints(a,i.snapMiddleSegments(c))})}Lc.$inject=["eventBus","gridSnapping","modeling"],Q(Lc,W),Lc.prototype.snapMiddleSegments=function(e){var t=this._gridSnapping,n;e=e.slice();for(var i=1;i<e.length-2;i++)n=t2(t,e[i],e[i+1]),e[i]=n[0],e[i+1]=n[1];return e};function QM(e){return e.length>3}function JM(e){return e==="h"}function e2(e){return e==="v"}function t2(e,t,n){var i=ui(t,n),r={};return JM(i)&&(r.y=e.snapValue(t.y)),e2(i)&&(r.x=e.snapValue(t.x)),("x"in r||"y"in r)&&(t=D({},t,r),n=D({},n,r)),[t,n]}const n2={__depends__:[qM,{__init__:["gridSnappingAutoPlaceBehavior","gridSnappingParticipantBehavior","gridSnappingLayoutConnectionBehavior"],gridSnappingAutoPlaceBehavior:["type",S_],gridSnappingParticipantBehavior:["type",R_],gridSnappingLayoutConnectionBehavior:["type",Lc]}],__init__:["bpmnGridSnapping"],bpmnGridSnapping:["type",b_]};var i2=30,C_=30;function Ea(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 Se(r)?n._createParticipantHit(r,o):n._createDefaultHit(r,o);if(y(r,"bpmn:SubProcess"))return Se(r)?n._createSubProcessHit(r,o):n._createDefaultHit(r,o)})}Ea.$inject=["eventBus","interactionEvents"],Ea.prototype._createDefaultHit=function(e,t){return this._interactionEvents.removeHits(t),this._interactionEvents.createDefaultHit(e,t),!0},Ea.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=At(e)?{width:i2,height:e.height}:{width:e.width,height:C_};return this._interactionEvents.createBoxHit(t,"all",n),!0},Ea.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:C_}),!0};const r2={__init__:["bpmnInteractionEvents"],bpmnInteractionEvents:["type",Ea]};function Nc(e){e.invoke(lo,this)}Q(Nc,lo),Nc.$inject=["injector"],Nc.prototype.registerBindings=function(e,t){lo.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 o2={__depends__:[Sp],__init__:["keyboardBindings"],keyboardBindings:["type",Nc]};var a2={moveSpeed:1,moveSpeedAccelerated:10},s2=1500,P_="left",A_="up",T_="right",M_="down",c2={ArrowLeft:P_,Left:P_,ArrowUp:A_,Up:A_,ArrowRight:T_,Right:T_,ArrowDown:M_,Down:M_},u2={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 k_(e,t,n,i,r){var o=this;this._config=D({},a2,e||{}),t.addListener(s2,function(a){var s=a.keyEvent,c=c2[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=u2[a](u),p=i.allowed("elements.move",{shapes:c,hints:{keyboardMove:!0}});p&&n.moveElements(c,l)}}}k_.$inject=["config.keyboardMoveSelection","keyboard","modeling","rules","selection"];const l2={__depends__:[Sp,Cn],__init__:["keyboardMoveSelection"],keyboardMoveSelection:["type",k_]};var D_=10;function wa(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=eS(l,p,u),c.newBounds=nS(d,f),c.canExecute=r.canResize(c)}function a(c){var u=c.resizeConstraints,l=c.minBounds;u===void 0&&(l===void 0&&(l=r.computeMinResizeBox(c)),c.resizeConstraints={min:ue(l)})}function s(c){var u=c.shape,l=c.canExecute,p=c.newBounds;if(l){if(p=Yd(p),!p2(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)})}wa.prototype.canResize=function(e){var t=this._rules,n=In(e,["newBounds","shape","delta","direction"]);return t.allowed("shape.resize",n)},wa.prototype.activate=function(e,t,n){var i=this._dragging,r,o;if(typeof n=="string"&&(n={direction:n}),r=D({shape:t},n),o=r.direction,!o)throw new Error("must provide a direction (n|w|s|e|nw|se|ne|sw)");i.init(e,O_(t,o),"resize",{autoActivate:!0,cursor:f2(o),data:{shape:t,context:r}})},wa.prototype.computeMinResizeBox=function(e){var t=e.shape,n=e.direction,i,r;return i=e.minDimensions||{width:D_,height:D_},r=Lh(t,e.childrenBoxPadding),iS(n,t,i,r)},wa.$inject=["eventBus","rules","modeling","dragging"];function p2(e,t){return e.x!==t.x||e.y!==t.y||e.width!==t.width||e.height!==t.height}function O_(e,t){var n=pe(e),i=ue(e),r={x:n.x,y:n.y};return t.indexOf("n")!==-1?r.y=i.top:t.indexOf("s")!==-1&&(r.y=i.bottom),t.indexOf("e")!==-1?r.x=i.right:t.indexOf("w")!==-1&&(r.x=i.left),r}function f2(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 I_="djs-resizing",L_="resize-not-ok",d2=500;function N_(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,I_)),s.width>5&&J(c,{x:s.x,width:s.width}),s.height>5&&J(c,{y:s.y,height:s.height}),o.canExecute?Ce(c).remove(L_):Ce(c).add(L_)}function r(o){var a=o.shape,s=o.frame;s&&bt(o.frame),t.removeMarker(a,I_)}e.on("resize.move",d2,function(o){i(o.context)}),e.on("resize.cleanup",function(o){r(o.context)})}N_.$inject=["eventBus","canvas","previewSupport"];var Bc=-6,$c=8,jc=20,Sa="djs-resizer",h2=["n","w","s","e","nw","ne","se","sw"];function nr(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,Zt(r.addResizer,r))}),e.on("shape.changed",function(o){var a=o.element;n.isSelected(a)&&(r.removeResizers(),r.addResizer(a))})}nr.prototype.makeDraggable=function(e,t,n){var i=this._resize;function r(o){Gi(o)&&i.activate(o,e,n)}he.bind(t,"mousedown",r),he.bind(t,"touchstart",r)},nr.prototype._createResizer=function(e,t,n,i){var r=this._getResizersParent(),o=m2(i),a=ae("g");Ce(a).add(Sa),Ce(a).add(Sa+"-"+e.id),Ce(a).add(Sa+"-"+i),ge(r,a);var s=ae("rect");J(s,{x:-$c/2+o.x,y:-$c/2+o.y,width:$c,height:$c}),Ce(s).add(Sa+"-visual"),ge(a,s);var c=ae("rect");return J(c,{x:-jc/2+o.x,y:-jc/2+o.y,width:jc,height:jc}),Ce(c).add(Sa+"-hit"),ge(a,c),Ja(a,t,n),a},nr.prototype.createResizer=function(e,t){var n=O_(e,t),i=this._createResizer(e,n.x,n.y,t);this.makeDraggable(e,i,t)},nr.prototype.addResizer=function(e){var t=this;He(e)||T(h2,function(n){t._resize.canResize({shape:e,direction:n})&&t.createResizer(e,n)})},nr.prototype.removeResizers=function(){var e=this._getResizersParent();Ga(e)},nr.prototype._getResizersParent=function(){return this._canvas.getLayer("resizers")},nr.$inject=["eventBus","canvas","selection","resize"];function m2(e){var t={x:0,y:0};return e.indexOf("e")!==-1?t.x=-Bc:e.indexOf("w")!==-1&&(t.x=Bc),e.indexOf("s")!==-1?t.y=-Bc:e.indexOf("n")!==-1&&(t.y=Bc),t}const B_={__depends__:[Qn,mi,ao],__init__:["resize","resizePreview","resizeHandles"],resize:["type",wa],resizePreview:["type",N_],resizeHandles:["type",nr]};var g2=2e3;function Ra(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"],g2,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)}}Ra.$inject=["eventBus","bpmnFactory","canvas","directEditing","modeling","resizeHandles","textRenderer"],Ra.prototype.activate=function(e){var t=vn(e);if(t!==void 0){var n={text:t},i=this.getEditingBBox(e);D(n,i);var r={},o=n.style||{};return D(o,{backgroundColor:null,border:null}),(xe(e,["bpmn:Task","bpmn:Participant","bpmn:Lane","bpmn:CallActivity"])||$_(e))&&D(r,{centerVertically:!0}),Fi(e)&&(D(r,{resizable:!0,autoResize:!0}),D(o,{backgroundColor:"#ffffff",border:"1px solid #ccc"})),y(e,"bpmn:TextAnnotation")&&(D(r,{resizable:!0,autoResize:!0}),D(o,{backgroundColor:"#ffffff",border:"1px solid #ccc"})),D(n,{options:r,style:o}),n}},Ra.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")||_2(e)){var h=At(e),m=h?{width:i.height,height:30*a,x:i.x-i.height/2+15*a,y:r.y-30*a/2}:{width:i.width,height:30*a};D(o,m),D(d,{fontSize:p+"px",lineHeight:f,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px",transform:h?"rotate(-90deg)":null})}if(y2(e)){var g=At(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};D(o,w),D(d,{fontSize:p+"px",lineHeight:f,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px",transform:g?null:"rotate(-90deg)"})}(xe(e,["bpmn:Task","bpmn:CallActivity"])||$_(e))&&(D(o,{width:i.width,height:i.height}),D(d,{fontSize:p+"px",lineHeight:f,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px"})),v2(e)&&(D(o,{width:i.width,x:i.x}),D(d,{fontSize:p+"px",lineHeight:f,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px"}));var E=1,b=i.width+2*E;if(n.labelTarget&&(D(o,{width:b,height:i.height+2*E,x:i.x-E,y:i.y-E}),D(d,{fontSize:u+"px",lineHeight:l})),Fi(n)&&!ns(n)&&!_e(n)){var x=Bu(e),S=t.getAbsoluteBBox({x:x.x,y:x.y,width:0,height:0}),A=u,I=_r.width*a+2*E;D(o,{width:I,height:A+2*E,x:S.x-I/2,y:S.y-A/2-E}),D(d,{fontSize:u+"px",lineHeight:l})}return y(e,"bpmn:TextAnnotation")&&(D(o,{width:i.width+2*E,height:i.height+2*E,x:i.x-E,y:i.y-E,minWidth:30*a,minHeight:10*a}),D(d,{textAlign:"left",paddingTop:qr*a+"px",paddingBottom:qr*a+"px",paddingLeft:qr*a+"px",paddingRight:qr*a+"px",fontSize:p+"px",lineHeight:f})),{bounds:o,style:d}},Ra.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}),b2(t)&&(t=null),this._modeling.updateLabel(e,t,r)};function $_(e){return y(e,"bpmn:SubProcess")&&!Se(e)}function v2(e){return y(e,"bpmn:SubProcess")&&Se(e)}function y2(e){return y(e,"bpmn:Participant")&&!Se(e)}function _2(e){return y(e,"bpmn:Participant")&&Se(e)}function b2(e){return!e||!e.trim()}var j_="djs-element-hidden",F_="djs-label-hidden";function H_(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=ae("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=ae("path");J(p,{d:l,strokeWidth:2,stroke:x2(o)}),ge(s,p),ge(r,s),Ot(s,o.x,o.y)}y(o,"bpmn:TextAnnotation")||o.labelTarget?t.addMarker(o,j_):(y(o,"bpmn:Task")||y(o,"bpmn:CallActivity")||y(o,"bpmn:SubProcess")||y(o,"bpmn:Participant")||y(o,"bpmn:Lane"))&&t.addMarker(o,F_)}),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,j_),t.removeMarker(o,F_)),o=void 0,a=void 0,s&&(bt(s),s=void 0)})}H_.$inject=["eventBus","canvas","pathMap"];function x2(e,t){var n=Me(e);return n.get("stroke")||t||"black"}const E2={__depends__:[tp,B_,f_],__init__:["labelEditingProvider","labelEditingPreview"],labelEditingProvider:["type",Ra],labelEditingPreview:["type",H_]};var w2=500,S2=1e3;function ti(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){nw(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"],w2,function(o){var a=o.element,s=o.gfx,c=je(".djs-outline",s);c&&i.updateOutline(a,c)})}ti.prototype.createOutline=function(e){var t=this._elementRegistry.getGraphics(e);if(!t)throw new Error("cannot create outline for non-rendered element");var n=je(".djs-outline",t);return n||(n=this.getOutline(e)||this._createOutlineGfx(),ge(t,n),this.updateOutline(e,n)),n},ti.prototype._createOutlineGfx=function(){var e=ae("rect");return J(e,D({x:0,y:0,rx:4,width:100,height:100},this._outlineStyle)),e},ti.prototype.updateOutline=function(e,t){e.waypoints?this.updateConnectionOutline(t,e):this.updateShapeOutline(t,e)},ti.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})},ti.prototype.updateConnectionOutline=function(e,t){var n=ut(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})},ti.prototype.registerProvider=function(e,t){t||(t=e,e=S2),this._eventBus.on("outline.getProviders",e,function(n){n.providers.push(t)})},ti.prototype._getProviders=function(){var e=this._eventBus.createEvent({type:"outline.getProviders",providers:[]});return this._eventBus.fire(e),e.providers},ti.prototype.getOutline=function(e){var t,n=this._getProviders();return T(n,function(i){Ct(i.getOutline)&&(t=t||i.getOutline(e))}),t},ti.$inject=["eventBus","styles","elementRegistry"];var Fc=6;function Zp(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)})}Zp.prototype._updateMultiSelectionOutline=function(e){var t=this._canvas.getLayer("selectionOutline");Ga(t);var n=e.length>1,i=this._canvas.getContainer();if(Ce(i)[n?"add":"remove"]("djs-multi-select"),!!n){var r=R2(ut(e)),o=ae("rect");J(o,D({rx:3},r)),Ce(o).add("djs-selection-outline"),ge(t,o)}},Zp.$inject=["eventBus","canvas","selection"];function R2(e){return{x:e.x-Fc,y:e.y-Fc,width:e.width+Fc*2,height:e.height+Fc*2}}const Qp={__depends__:[Cn],__init__:["outline","multiSelectionOutline"],outline:["type",ti],multiSelectionOutline:["type",Zp]},z_=["bpmn:Event","bpmn:SequenceFlow","bpmn:Gateway"],V_={class:"bjs-label-link",stroke:"var(--element-selected-outline-secondary-stroke-color)",strokeDasharray:"5, 5"},C2=15,Hc=2;function G_(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,z_));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,z_)||!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=Ao([pe(f),pe(p)],V_),h=d.getAttribute("d"),g=r.isSelected(p)?c(p):u(p),w=Do(g,h);if(!w)return;const b=r.isSelected(f)?c(f):u(f),x=Do(b,h)||pe(f);zo(x,w)<C2||(Tu(d,[x,w]),ge(o,d))}function s(){Va(`.${V_.class}`,o).forEach(bt)}function c(p){const f=i.getOutline(p);if(!f)return u(p);if(f.x){const d={x:p.x+ir(f,"x")-Hc,y:p.y+ir(f,"y")-Hc,width:ir(f,"width")+Hc*2,height:ir(f,"height")+Hc*2};return ju(d,ir(f,"rx"))}if(f.cx){const d=ir(f,"r"),h={x:p.x+ir(f,"cx")-d,y:p.y+ir(f,"cy")-d,width:d*2,height:d*2};return yh(h)}}function u(p){return n.getShapePath(p)}function l(p){return r.isSelected(p)}}G_.$inject=["eventBus","canvas","graphicsFactory","outline","selection"];function ir(e,t){return parseFloat(J(e,t)||0)}const P2={__depends__:[Cn,Qp],__init__:["labelLink"],labelLink:["type",G_]};var A2=new oo("tt");function T2(e){var t=Ue('<div class="djs-tooltip-container" />');return Yt(t,{position:"absolute",width:"0",height:"0"}),e.insertBefore(t,e.firstChild),t}function M2(e,t,n){Yt(e,{left:t+"px",top:n+"px"})}function Jp(e,t){e.style.display=t===!1?"none":""}var W_="djs-tooltip",ef="."+W_;function Jt(e,t){this._eventBus=e,this._canvas=t,this._ids=A2,this._tooltipDefaults={show:{minZoom:.7,maxZoom:5}},this._tooltips={},this._tooltipRoot=T2(t.getContainer());var n=this;rn.bind(this._tooltipRoot,ef,"mousedown",function(i){i.stopPropagation()}),rn.bind(this._tooltipRoot,ef,"mouseover",function(i){n.trigger("mouseover",i)}),rn.bind(this._tooltipRoot,ef,"mouseout",function(i){n.trigger("mouseout",i)}),this._init()}Jt.$inject=["eventBus","canvas"],Jt.prototype.add=function(e){if(!e.position)throw new Error("must specifiy tooltip position");if(!e.html)throw new Error("must specifiy tooltip html");var t=this._ids.next();return e=D({},this._tooltipDefaults,e,{id:t}),this._addTooltip(e),e.timeout&&this.setTimeout(e),t},Jt.prototype.trigger=function(e,t){var n=t.delegateTarget||t.target,i=this.get(zt(n,"data-tooltip-id"));i&&(e==="mouseover"&&i.timeout&&this.clearTimeout(i),e==="mouseout"&&i.timeout&&(i.timeout=1e3,this.setTimeout(i)))},Jt.prototype.get=function(e){return typeof e!="string"&&(e=e.id),this._tooltips[e]},Jt.prototype.clearTimeout=function(e){if(e=this.get(e),!!e){var t=e.removeTimer;t&&(clearTimeout(t),e.removeTimer=null)}},Jt.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)}},Jt.prototype.remove=function(e){var t=this.get(e);t&&(Un(t.html),Un(t.htmlContainer),delete t.htmlContainer,delete this._tooltips[t.id])},Jt.prototype.show=function(){Jp(this._tooltipRoot)},Jt.prototype.hide=function(){Jp(this._tooltipRoot,!1)},Jt.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},Jt.prototype._addTooltip=function(e){var t=e.id,n=e.html,i,r=this._tooltipRoot;n.get&&n.constructor.prototype.jquery&&(n=n.get(0)),en(n)&&(n=Ue(n)),i=Ue('<div data-tooltip-id="'+t+'" class="'+W_+'">'),Yt(i,{position:"absolute"}),i.appendChild(n),e.type&&Xe(i).add("djs-tooltip-"+e.type),e.className&&Xe(i).add(e.className),e.htmlContainer=i,r.appendChild(i),this._tooltips[t]=e,this._updateTooltip(e)},Jt.prototype._updateTooltip=function(e){var t=e.position,n=e.htmlContainer;M2(n,t.x,t.y)},Jt.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),Jp(i,r))})},Jt.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 k2={__init__:["tooltips"],tooltips:["type",Jt]};var D2="flow elements must be children of pools/participants",O2="Data object must be placed within a pool/participant.";function U_(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(D2)):y(a,"bpmn:DataObjectReference")&&i(r,n(O2)))})}U_.$inject=["eventBus","tooltips","translate"];const I2={__depends__:[k2],__init__:["modelingFeedback"],modelingFeedback:["type",U_]};var L2=500,N2=1250,B2=1500,zc=Math.round;function $2(e){return{x:e.x+zc(e.width/2),y:e.y+zc(e.height/2)}}function q_(e,t,n,i,r){function o(s,c,u,l){return r.allowed("elements.move",{shapes:s,delta:c,position:u,target:l})}e.on("shape.move.start",B2,function(s){var c=s.context,u=s.shape,l=i.get().slice();l.indexOf(u)===-1&&(l=[u]),l=j2(l),D(c,{shapes:l,validatedShapes:l,shape:u})}),e.on("shape.move.start",N2,function(s){var c=s.context,u=c.validatedShapes,l;if(l=c.canExecute=o(u),!l)return!1}),e.on("shape.move.move",L2,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=zc(u.x),u.y=zc(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(Gi(s)){var c=to(s);if(!c)throw new Error("must supply DOM mousedown event");return a(c,s.element)}});function a(s,c,u,l){if(Rt(u)&&(l=u,u=!1),!(c.waypoints||!c.parent)&&!Ce(s.target).has("djs-hit-no-move")){var p=$2(c),f=t.init(s,p,"shape.move",{cursor:"grabbing",autoActivate:u,data:{shape:c,context:l||{}}});if(f!==!1)return!0}}this.start=a}q_.$inject=["eventBus","dragging","modeling","selection","rules"];function j2(e){var t=Nr(e,"id");return Ee(e,function(n){for(;n=n.parent;)if(t[n.id])return!1;return!0})}var Y_=499,tf="djs-dragging",K_="drop-ok",X_="drop-not-ok",Z_="new-parent",Q_="attach-ok";function J_(e,t,n,i){function r(c){var u=o(c),l=F2(u);return l}function o(c){var u=To(c),l=u.flatMap(d=>(d.incoming||[]).concat(d.outgoing||[])),p=u.concat(l),f=[...new Set(p)];return f}function a(c,u){[Q_,K_,X_,Z_].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,tf),c.allDraggedElements?c.allDraggedElements.push(u):c.allDraggedElements=[u]}e.on("shape.move.start",Y_,function(c){var u=c.context,l=u.shapes,p=u.allDraggedElements,f=r(l);if(!u.dragGroup){var d=ae("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=Xc([p,o(l)]):p=o(l),T(p,function(m){t.addMarker(m,tf)}),u.allDraggedElements=p,u.differentParents=H2(l)}),e.on("shape.move.move",Y_,function(c){var u=c.context,l=u.dragGroup,p=u.target,f=u.shape.parent,d=u.canExecute;p&&(d==="attach"?a(p,Q_):u.canExecute&&f&&p.id!==f.id?a(p,Z_):a(p,u.canExecute?K_:X_)),Ot(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,tf)}),p&&bt(p)}),this.makeDraggable=s}J_.$inject=["eventBus","canvas","styles","previewSupport"];function F2(e){var t=new Set;e.forEach(function(i){t.add(i.id)});var n=Ee(e,function(i){return He(i)?t.has(i.source.id)&&t.has(i.target.id):!0});return n}function H2(e){return Wb(Nr(e,function(t){return t.parent&&t.parent.id}))!==1}const z2={__depends__:[Os,Cn,Qp,Qn,mi,ao],__init__:["move","movePreview"],move:["type",q_],movePreview:["type",J_]};var eb=".djs-palette-toggle",tb=".entry",V2=eb+", "+tb,nf="djs-palette-",G2="shown",rf="open",nb="two-column",W2=1e3;function ht(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()})}ht.$inject=["eventBus","canvas"],ht.prototype.registerProvider=function(e,t){t||(t=e,e=W2),this._eventBus.on("palette.getProviders",e,function(n){n.providers.push(t)}),this._rebuild()},ht.prototype.getEntries=function(){var e=this._getProviders();return e.reduce(q2,{})},ht.prototype._rebuild=function(){if(this._diagramInitialized){var e=this._getProviders();e.length&&(this._container||this._init(),this._update())}},ht.prototype._init=function(){var e=this,t=this._eventBus,n=this._getParentContainer(),i=this._container=Ue(ht.HTML_MARKUP);n.appendChild(i),Xe(n).add(nf+G2),rn.bind(i,V2,"click",function(r){var o=r.delegateTarget;if(bu(o,eb))return e.toggle();e.trigger("click",r)}),he.bind(i,"mousedown",function(r){r.stopPropagation()}),rn.bind(i,tb,"dragstart",function(r){e.trigger("dragstart",r)}),t.on("canvas.resized",this._layoutChanged,this),t.fire("palette.create",{container:i})},ht.prototype._getProviders=function(e){var t=this._eventBus.createEvent({type:"palette.getProviders",providers:[]});return this._eventBus.fire(t),t.providers},ht.prototype._toggleState=function(e){e=e||{};var t=this._getParentContainer(),n=this._container,i=this._eventBus,r,o=Xe(n),a=Xe(t);"twoColumn"in e?r=e.twoColumn:r=this._needsCollapse(t.clientHeight,this._entries||{}),o.toggle(nb,r),a.toggle(nf+nb,r),"open"in e&&(o.toggle(rf,e.open),a.toggle(nf+rf,e.open)),i.fire("palette.changed",{twoColumn:r,open:this.isOpen()})},ht.prototype._update=function(){var e=je(".djs-palette-entries",this._container),t=this._entries=this.getEntries();Ha(e),T(t,function(n,i){var r=n.group||"default",o=je("[data-group="+la(r)+"]",e);o||(o=Ue('<div class="group"></div>'),zt(o,"data-group",r),e.appendChild(o));var a=n.html||(n.separator?'<hr class="separator" />':'<div class="entry" draggable="true"></div>'),s=Ue(a);if(o.appendChild(s),!n.separator&&(zt(s,"data-action",i),n.title&&zt(s,"title",n.title),n.className&&U2(s,n.className),n.imageUrl)){var c=Ue("<img>");zt(c,"src",n.imageUrl),s.appendChild(c)}}),this.open()},ht.prototype.trigger=function(e,t,n){var i,r,o=t.delegateTarget||t.target;return o?(i=zt(o,"data-action"),r=t.originalEvent||t,this.triggerEntry(i,e,r,n)):t.preventDefault()},ht.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(Ct(a)){if(t==="click")return a(n,i)}else if(a[t])return a[t](n,i);n.preventDefault()}},ht.prototype._layoutChanged=function(){this._toggleState({})},ht.prototype._needsCollapse=function(e,t){var n=50,i=Object.keys(t).length*46;return e<i+n},ht.prototype.close=function(){this._toggleState({open:!1,twoColumn:!1})},ht.prototype.open=function(){this._toggleState({open:!0})},ht.prototype.toggle=function(){this.isOpen()?this.close():this.open()},ht.prototype.isActiveTool=function(e){return e&&this._activeTool===e},ht.prototype.updateToolHighlight=function(e){var t,n;this._toolsContainer||(t=je(".djs-palette-entries",this._container),this._toolsContainer=je("[data-group=tools]",t)),n=this._toolsContainer,T(n.children,function(i){var r=i.getAttribute("data-action");if(r){var o=Xe(i);r=r.replace("-tool",""),o.contains("entry")&&r===e?o.add("highlighted-entry"):o.remove("highlighted-entry")}})},ht.prototype.isOpen=function(){return Xe(this._container).has(rf)},ht.prototype._getParentContainer=function(){return this._canvas.getContainer()},ht.HTML_MARKUP='<div class="djs-palette"><div class="djs-palette-entries"></div><div class="djs-palette-toggle"></div></div>';function U2(e,t){var n=Xe(e),i=le(t)?t:t.split(/\s+/g);i.forEach(function(r){n.add(r)})}function q2(e,t){var n=t.getPaletteEntries();return Ct(n)?n(e):(T(n,function(i,r){e[r]=i}),e)}const Y2={__init__:["palette"],palette:["type",ht]};var ib="crosshair",rb="selected",K2="djs-dragging-active-lasso";function rr(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=ae("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,rb);for(const g of h)m.has(g)||t.addMarker(g,rb)}},remove:function(p){this.update(p),p.frame&&bt(p.frame),u(!1)}};function u(p){Ce(t.getContainer()).toggle(K2,p)}function l(p){var f=i.getAll();return new Set(Lr(zr(f,p)))}o.registerTool("lasso",{tool:"lasso.selection",dragging:"lasso"}),e.on("lasso.selection.end",function(p){var f=p.originalEvent.target;!p.hover&&!(f instanceof SVGElement)||e.once("lasso.selection.ended",function(){s.activateLasso(p.originalEvent,!0)})}),e.on("lasso.end",0,function(p){var f=p.context;s._select(Array.from(f.marked))}),e.on("lasso.start",function(p){var f=p.context;f.bbox=ob(p),f.add=Cs(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=ob(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(Cs(p))return s.activateLasso(p.originalEvent),!0})}rr.$inject=["eventBus","canvas","dragging","elementRegistry","selection","toolManager","mouse"],rr.prototype.activateLasso=function(e,t){this._dragging.init(e,"lasso",{autoActivate:t,cursor:ib,data:{context:{}},keepSelection:!0})},rr.prototype.activateSelection=function(e,t){this._dragging.init(e,"lasso.selection",{trapClick:!1,autoActivate:t,cursor:ib,data:{context:{}},keepSelection:!0})},rr.prototype._select=function(e){this._selection.select(e)},rr.prototype.select=function(e,t,n=[]){var i=Lr(zr(e,t));this._select([...n,...i])},rr.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateSelection(e,!!e)},rr.prototype.isActive=function(){var e=this._dragging.context();return e&&/^lasso/.test(e.prefix)};function ob(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 X2={__depends__:[Bs,Yo],__init__:["lassoTool"],lassoTool:["type",rr]};var of=1500,ab="grab";function _o(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",of,function(c){if(Wo(c))return a.activateMove(c.originalEvent,!0),!1}),s&&s.addListener(of,function(c){if(!(!sb(c.keyEvent)||a.isActive())){var u=a._mouse.getLastMoveEvent();a.activateMove(u,!!u)}},"keyboard.keydown"),s&&s.addListener(of,function(c){!sb(c.keyEvent)||!a.isActive()||a.toggle()},"keyboard.keyup"),e.on("hand.end",function(c){var u=c.originalEvent.target;if(!c.hover&&!(u instanceof SVGElement))return!1;e.once("hand.ended",function(){a.activateMove(c.originalEvent,{reactivate:!0})})}),e.on("hand.move.move",function(c){var u=t.viewbox().scale;t.scroll({dx:c.dx*u,dy:c.dy*u})}),e.on("hand.move.end",function(c){var u=c.context,l=u.reactivate;return!Wo(c)&&l&&e.once("hand.move.ended",function(p){a.activateHand(p.originalEvent,!0,!0)}),!1})}_o.$inject=["eventBus","canvas","dragging","injector","toolManager","mouse"],_o.prototype.activateMove=function(e,t,n){typeof t=="object"&&(n=t,t=!1),this._dragging.init(e,"hand.move",{autoActivate:t,cursor:ab,data:{context:n||{}}})},_o.prototype.activateHand=function(e,t,n){this._dragging.init(e,"hand",{trapClick:!1,autoActivate:t,cursor:ab,data:{context:{reactivate:n}}})},_o.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateHand(e,!!e)},_o.prototype.isActive=function(){var e=this._dragging.context();return e?/^(hand|hand\.move)$/.test(e.prefix):!1};function sb(e){return xt("Space",e)}const Z2={__depends__:[Bs,Yo],__init__:["handTool"],handTool:["type",_o]};var cb="connect-ok",ub="connect-not-ok";function bo(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?cb:ub))}),e.on(["global-connect.out","global-connect.cleanup"],function(c){var u=c.context.startTarget,l=c.context.canStartConnect;u&&i.removeMarker(u,l?cb:ub)}),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})}bo.$inject=["eventBus","dragging","connect","canvas","toolManager","rules","mouse"],bo.prototype.start=function(e,t){this._dragging.init(e,"global-connect",{autoActivate:t,trapClick:!1,data:{context:{}}})},bo.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();return this.start(e,!!e)},bo.prototype.isActive=function(){var e=this._dragging.context();return e&&/^global-connect/.test(e.prefix)},bo.prototype.canStartConnect=function(e){return this._rules.allowed("connection.start",{source:e})};const Q2={__depends__:[qp,Qn,mi,Bs,Yo],globalConnect:["type",bo]};function af(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)}af.$inject=["palette","create","elementFactory","spaceTool","lassoTool","handTool","globalConnect","translate"],af.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(D({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 D(e,{"hand-tool":{group:"tools",className:"bpmn-icon-hand-tool",title:s("Activate hand tool"),action:{click:function(p){o.activateHand(p)}}},"lasso-tool":{group:"tools",className:"bpmn-icon-lasso-tool",title:s("Activate lasso tool"),action:{click:function(p){r.activateSelection(p)}}},"space-tool":{group:"tools",className:"bpmn-icon-space-tool",title:s("Activate create/remove space tool"),action:{click:function(p){i.activateSelection(p)}}},"global-connect-tool":{group:"tools",className:"bpmn-icon-connection-multi",title:s("Activate global connect tool"),action:{click:function(p){a.start(p)}}},"tool-separator":{group:"tools",separator:!0},"create.start-event":c("bpmn:StartEvent","event","bpmn-icon-start-event-none",s("Create start event")),"create.intermediate-event":c("bpmn:IntermediateThrowEvent","event","bpmn-icon-intermediate-event-none",s("Create intermediate/boundary event")),"create.end-event":c("bpmn:EndEvent","event","bpmn-icon-end-event-none",s("Create end event")),"create.exclusive-gateway":c("bpmn:ExclusiveGateway","gateway","bpmn-icon-gateway-none",s("Create gateway")),"create.task":c("bpmn:Task","activity","bpmn-icon-task",s("Create task")),"create.data-object":c("bpmn:DataObjectReference","data-object","bpmn-icon-data-object",s("Create data object reference")),"create.data-store":c("bpmn:DataStoreReference","data-store","bpmn-icon-data-store",s("Create data store reference")),"create.subprocess-expanded":{group:"activity",className:"bpmn-icon-subprocess-expanded",title:s("Create expanded sub-process"),action:{dragstart:u,click:u}},"create.participant-expanded":{group:"collaboration",className:"bpmn-icon-participant",title:s("Create pool/participant"),action:{dragstart:l,click:l}},"create.group":c("bpmn:Group","artifact","bpmn-icon-group",s("Create group"))}),e};const J2={__depends__:[Y2,Ls,Ng,X2,Z2,Q2,$o],__init__:["paletteProvider"],paletteProvider:["type",af]};var ek=250;function sf(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);D(p,{x:f.x,y:f.y});var d=n.createShape(p);i.addShape(d,f.parent);var h=je('[data-element-id="'+la(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=je('[data-element-id="'+la(l)+'"]',s.dragGroup);p&&J(p,{display:"inline"}),u.remove(),c[l]&&delete c[l]})}e.on("shape.move.move",ek,function(s){var c=s.context,u=c.canExecute;c.visualReplacements||(c.visualReplacements={}),u&&u.replacements?o(c):a(c)})}sf.$inject=["eventBus","elementRegistry","elementFactory","canvas","previewSupport"],Q(sf,W);const tk={__depends__:[ao],__init__:["bpmnReplacePreview"],bpmnReplacePreview:["type",sf]};var nk=1250,cf=40,ik=20,rk=10,lb=20,pb=["x","y"],ok=Math.abs;function fb(e){e.on(["connect.hover","connect.move","connect.end"],nk,function(t){var n=t.context,i=n.canExecute,r=n.start,o=n.hover,a=n.source,s=n.target;t.originalEvent&&sn(t.originalEvent)||(n.initialConnectionStart||(n.initialConnectionStart=n.connectionStart),i&&o&&ak(t,o,lk(o)),o&&uk(i,["bpmn:Association","bpmn:DataInputAssociation","bpmn:DataOutputAssociation","bpmn:SequenceFlow"])?(n.connectionStart=Tn(r),xe(o,["bpmn:Event","bpmn:Gateway"])&&db(t,Tn(o)),xe(o,["bpmn:Task","bpmn:SubProcess"])&&sk(t,o),y(a,"bpmn:BoundaryEvent")&&s===a.host&&ck(t)):hb(i,"bpmn:MessageFlow")?(y(r,"bpmn:Event")&&(n.connectionStart=Tn(r)),y(o,"bpmn:Event")&&db(t,Tn(o))):n.connectionStart=n.initialConnectionStart)})}fb.$inject=["eventBus"];function ak(e,t,n){pb.forEach(function(i){var r=mb(i,t);e[i]<t[i]+n?dt(e,i,t[i]+n):e[i]>t[i]+r-n&&dt(e,i,t[i]+r-n)})}function sk(e,t){var n=Tn(t);pb.forEach(function(i){pk(e,t,i)&&dt(e,i,n[i])})}function ck(e){var t=e.context,n=t.source,i=t.target;if(!fk(t)){var r=Tn(n),o=Dt(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;ok(c-r[s])<cf&&(c>r[s]?u=r[s]+cf:u=r[s]-cf,dt(e,s,u))})}}function db(e,t){dt(e,"x",t.x),dt(e,"y",t.y)}function hb(e,t){return e&&e.type===t}function uk(e,t){return Ci(t,function(n){return hb(e,n)})}function mb(e,t){return e==="x"?t.width:t.height}function lk(e){return y(e,"bpmn:Task")?rk:ik}function pk(e,t,n){return e[n]>t[n]+lb&&e[n]<t[n]+mb(n,t)-lb}function fk(e){var t=e.hover,n=e.source;return t&&n&&t===n}function or(){this._targets={},this._snapOrigins={},this._snapLocations=[],this._defaultSnaps={}}or.prototype.getSnapOrigin=function(e){return this._snapOrigins[e]},or.prototype.setSnapOrigin=function(e,t){this._snapOrigins[e]=t,this._snapLocations.indexOf(e)===-1&&this._snapLocations.push(e)},or.prototype.addDefaultSnap=function(e,t){var n=this._defaultSnaps[e];n||(n=this._defaultSnaps[e]=[]),n.push(t)},or.prototype.getSnapLocations=function(){return this._snapLocations},or.prototype.setSnapLocations=function(e){this._snapLocations=e},or.prototype.pointsForTarget=function(e){var t=e.id||e,n=this._targets[t];return n||(n=this._targets[t]=new Vc,n.initDefaults(this._defaultSnaps)),n};function Vc(){this._snapValues={}}Vc.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)},Vc.prototype.snap=function(e,t,n,i){var r=this._snapValues[t];return r&&eM(e[n],r[n],i)},Vc.prototype.initDefaults=function(e){var t=this;T(e||{},function(n,i){T(n,function(r){t.add(i,r)})})};var dk=1250;function ni(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"],dk,function(r){var o=r.context,a=o.shape,s=o.snapContext,c=o.target;if(!(r.originalEvent&&sn(r.originalEvent))&&!(yo(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()})}ni.$inject=["elementRegistry","eventBus","snapping"],ni.prototype.initSnap=function(e){var t=this._elementRegistry,n=e.context,i=n.shape,r=n.snapContext;r||(r=n.snapContext=new or);var o;t.get(i.id)?o=Tn(i,e):o={x:e.x+Tn(i).x,y:e.y+Tn(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},ni.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",Tn(r));return}if(He(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",Tn(r))}),!de(t.x)||!de(t.y)||this._elementRegistry.get(t.id)&&e.add("mid",Tn(t)),e},ni.prototype.getSnapTargets=function(e,t){return t_(t).filter(function(n){return!hk(n)})};function hk(e){return!!e.hidden}var gb=1500;function xo(e,t){t.invoke(ni,this),e.on(["create.move","create.end"],gb,yk),e.on(["create.move","create.end","shape.move.move","shape.move.end"],gb,function(n){var i=n.context,r=i.canExecute,o=i.target,a=r&&(r==="attach"||r.attach);a&&!yo(n)&&mk(n,o)})}Q(xo,ni),xo.$inject=["eventBus","injector"],xo.prototype.initSnap=function(e){var t=ni.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",yb(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",yb(o,i,e))}),y(n,"bpmn:Participant")&&t.setSnapLocations(["top-left","bottom-right","mid"]),t},xo.prototype.addSnapTargetPoints=function(e,t,n){ni.prototype.addSnapTargetPoints.call(this,e,t,n);var i=this.getSnapTargets(t,n);T(i,function(o){(vk(o)||gk([t,o],"bpmn:TextAnnotation"))&&(e.add("top-left",Jy(o)),e.add("bottom-right",e_(o)))});var r=this._elementRegistry;return T(t.incoming,function(o){if(r.get(t.id)){vb(i,o.source)||e.add("mid",pe(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)){vb(i,o.target)||e.add("mid",pe(o.target));var a=o.waypoints[o.waypoints.length-1];e.add(o.id+"-docking",a.original||a)}}),y(n,"bpmn:SequenceFlow")&&(e=this.addSnapTargetPoints(e,t,n.parent)),e},xo.prototype.getSnapTargets=function(e,t){return ni.prototype.getSnapTargets.call(this,e,t).filter(function(n){return!y(n,"bpmn:Lane")})};function mk(e,t){var n=ue(t),i=Dm(e,t),r=e.context,o=r.shape,a;o.parent?a={x:0,y:0}:a=pe(o),/top/.test(i)?dt(e,"y",n.top-a.y):/bottom/.test(i)&&dt(e,"y",n.bottom-a.y),/left/.test(i)?dt(e,"x",n.left-a.x):/right/.test(i)&&dt(e,"x",n.right-a.x)}function gk(e,t){return e.every(function(n){return y(n,t)})}function vk(e){return y(e,"bpmn:SubProcess")&&Se(e)?!0:y(e,"bpmn:Participant")}function yk(e){var t=e.context,n=t.createConstraints;if(n){var i=n.top,r=n.right,o=n.bottom,a=n.left;(a&&a>=e.x||r&&r<=e.x)&&dt(e,"x",e.x),(i&&i>=e.y||o&&o<=e.y)&&dt(e,"y",e.y)}}function vb(e,t){return e.indexOf(t)!==-1}function yb(e,t,n){return t?{x:e.x-n.x,y:e.y-n.y}:{x:e.x,y:e.y}}var _k=1250;function Ca(e,t){var n=this;e.on(["resize.start"],function(i){n.initSnap(i)}),e.on(["resize.move","resize.end"],_k,function(i){var r=i.context,o=r.shape,a=o.parent,s=r.direction,c=r.snapContext;if(!(i.originalEvent&&sn(i.originalEvent))&&!yo(i)){var u=c.pointsForTarget(a);u.initialized||(u=n.addSnapTargetPoints(u,o,a,s),u.initialized=!0),Ek(s)&&dt(i,"x",i.x),wk(s)&&dt(i,"y",i.y),t.snap(i,u)}}),e.on(["resize.cleanup"],function(){t.hide()})}Ca.prototype.initSnap=function(e){var t=e.context,n=t.shape,i=t.direction,r=t.snapContext;r||(r=t.snapContext=new or);var o=_b(n,i);return r.setSnapOrigin("corner",{x:o.x-e.x,y:o.y-e.y}),r},Ca.prototype.addSnapTargetPoints=function(e,t,n,i){var r=this.getSnapTargets(t,n);return T(r,function(o){e.add("corner",e_(o)),e.add("corner",Jy(o))}),e.add("corner",_b(t,i)),e},Ca.$inject=["eventBus","snapping"],Ca.prototype.getSnapTargets=function(e,t){return t_(t).filter(function(n){return!bk(n,e)&&!He(n)&&!xk(n)&&!_e(n)})};function _b(e,t){var n=pe(e),i=ue(e),r={x:n.x,y:n.y};return t.indexOf("n")!==-1?r.y=i.top:t.indexOf("s")!==-1&&(r.y=i.bottom),t.indexOf("e")!==-1?r.x=i.right:t.indexOf("w")!==-1&&(r.x=i.left),r}function bk(e,t){return e.host===t}function xk(e){return!!e.hidden}function Ek(e){return e==="n"||e==="s"}function wk(e){return e==="e"||e==="w"}var Sk=7,Rk=1e3;function ar(e){this._canvas=e,this._asyncHide=Qc(Zt(this.hide,this),Rk)}ar.$inject=["canvas"],ar.prototype.snap=function(e,t){var n=e.context,i=n.snapContext,r=i.getSnapLocations(),o={x:yo(e,"x"),y:yo(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,Sk),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];Rt(s)&&dt(e,a,s.originValue)})},ar.prototype._createLine=function(e){var t=this._canvas.getLayer("snap"),n=ae("path");return J(n,{d:"M0,0 L0,0"}),Ce(n).add("djs-snap-line"),ge(t,n),{update:function(i){de(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"})}}},ar.prototype._createSnapLines=function(){this._snapLines={horizontal:this._createLine("horizontal"),vertical:this._createLine("vertical")}},ar.prototype.showSnapLine=function(e,t){var n=this.getSnapLine(e);n&&n.update(t),this._asyncHide()},ar.prototype.getSnapLine=function(e){return this._snapLines||this._createSnapLines(),this._snapLines[e]},ar.prototype.hide=function(){T(this._snapLines,function(e){e.update()})};const Ck={__depends__:[{__init__:["createMoveSnapping","resizeSnapping","snapping"],createMoveSnapping:["type",ni],resizeSnapping:["type",Ca],snapping:["type",ar]}],__init__:["connectSnapping","createMoveSnapping"],connectSnapping:["type",fb],createMoveSnapping:["type",xo]};var bb=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=je(ve.INPUT_SELECTOR,this._container),this._resultsContainer=je(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:rn.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){xt("ArrowUp",n)&&n.preventDefault(),xt("ArrowDown",n)&&n.preventDefault()}),t(this._container,ve.INPUT_SELECTOR,"keyup",function(n){if(xt("Escape",n))return e.close();if(xt("Enter",n)){var i=e._getCurrentResult();return i?e._select(i):e.close(!1)}if(xt("ArrowUp",n))return e._scrollToDirection(!0);if(xt("ArrowDown",n))return e._scrollToDirection();xt(["ArrowLeft","ArrowRight"],n)||e._search(n.delegateTarget.value)})},ve.prototype._unbindEvents=function(){this._eventMaps.forEach(function(e){rn.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=je(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(){Ha(this._resultsContainer),this._results={},this._eventBus.fire("searchPad.cleared")},ve.prototype._getCurrentResult=function(){return je(ve.RESULT_SELECTED_SELECTOR,this._resultsContainer)},ve.prototype._createResultNode=function(e,t){var n=Ue(ve.RESULT_HTML);return e.primaryTokens.length>0&&xb(n,e.primaryTokens,ve.RESULT_PRIMARY_HTML),xb(n,e.secondaryTokens,ve.RESULT_SECONDARY_HTML),zt(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,Xe(this._canvas.getContainer()).add("djs-search-open"),Xe(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,Xe(this._canvas.getContainer()).remove("djs-search-open"),Xe(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&&Xe(t).remove(ve.RESULT_SELECTED_CLASS);var n=zt(e,ve.RESULT_ID_ATTRIBUTE),i=this._results[n].element;Xe(e).add(ve.RESULT_SELECTED_CLASS),this._canvas.scrollToElement(i,{top:bb}),this._selection.select(i),this._eventBus.fire("searchPad.preselected",i)}},ve.prototype._select=function(e){var t=zt(e,ve.RESULT_ID_ATTRIBUTE),n=this._results[t].element;this._cachedSelection=null,this._cachedViewbox=null,this.close(!1),this._canvas.scrollToElement(n,{top:bb}),this._selection.select(n),this._eventBus.fire("searchPad.selected",n)},ve.prototype._getBoxHtml=function(){const e=Ue(ve.BOX_HTML),t=je(ve.INPUT_SELECTOR,e);return t&&t.setAttribute("aria-label",this._translate("Search in diagram")),e};function xb(e,t,n){var i=Pk(t),r=Ue(n);r.innerHTML=i,e.appendChild(r)}function Pk(e){var t="";return e.forEach(function(n){var i=Tv(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>`,_e.RESULT_HTML='<div class="djs-search-result"></div>',_e.RESULT_PRIMARY_HTML='<div class="djs-search-result-primary"></div>',_e.RESULT_SECONDARY_HTML='<p class="djs-search-result-secondary"></p>';const J2={__depends__:[Eo,Hs,gn],searchPad:["type",_e]};function Fp(e,t,n,i){this._elementRegistry=e,this._canvas=n,this._search=i,t.registerProvider(this)}Fp.$inject=["elementRegistry","searchPad","canvas","search"],Fp.prototype.find=function(e){var t=this._canvas.getRootElements(),n=this._elementRegistry.filter(function(i){return!xe(i)&&!t.includes(i)});return this._search(n.map(i=>({element:i,label:un(i),id:i.id})),e,{keys:["label","id"]}).map(ek)};function ek(e){const{item:{element:t},tokens:n}=e;return{element:t,primaryTokens:n.label,secondaryTokens:n.id}}const tk={__depends__:[J2,ay],__init__:["bpmnSearch"],bpmnSearch:["type",Fp]},nk="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",ik="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",rk={width:36,height:50},ok={width:50,height:50};function K_(e,t,n){return oe("path",{d:e,strokeWidth:2,transform:`translate(${t.x}, ${t.y})`,...n})}const En=5;function Cc(e,t){this._styles=t,e.registerProvider(this)}Cc.$inject=["outline","styles"],Cc.prototype.getOutline=function(e){const t=this._styles.cls("djs-outline",["no-fill"]);var n;if(ww(e))return n=oe("rect"),Z(n,k({x:-En,y:-En,rx:4,width:e.width+En*2,height:e.height+En*2},t)),n;if(!xe(e))return y(e,"bpmn:Gateway")?(n=oe("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))):Se(e,["bpmn:Task","bpmn:SubProcess","bpmn:Group","bpmn:CallActivity"])?(n=oe("rect"),Z(n,k({x:-En,y:-En,rx:14,width:e.width+En*2,height:e.height+En*2},t))):y(e,"bpmn:EndEvent")?(n=oe("circle"),Z(n,k({cx:e.width/2,cy:e.height/2,r:e.width/2+En+1},t))):y(e,"bpmn:Event")?(n=oe("circle"),Z(n,k({cx:e.width/2,cy:e.height/2,r:e.width/2+En},t))):y(e,"bpmn:DataObjectReference")&&X_(e,"bpmn:DataObjectReference")?n=K_(nk,{x:-6,y:-6},t):y(e,"bpmn:DataStoreReference")&&X_(e,"bpmn:DataStoreReference")&&(n=K_(ik,{x:-6,y:-6},t)),n},Cc.prototype.updateOutline=function(e,t){if(!xe(e))return Se(e,["bpmn:SubProcess","bpmn:Group"])?(Z(t,{width:e.width+En*2,height:e.height+En*2}),!0):!!Se(e,["bpmn:Event","bpmn:Gateway","bpmn:DataStoreReference","bpmn:DataObjectReference"])};function X_(e,t){var n;return t==="bpmn:DataObjectReference"?n=rk:t==="bpmn:DataStoreReference"&&(n=ok),e.width===n.width&&e.height===n.height}const ak={__depends__:[Mp],__init__:["outlineProvider"],outlineProvider:["type",Cc]};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 Gn(e){Tr.call(this,e)}X(Gn,Tr),Gn.Viewer=$i,Gn.NavigatedViewer=Ko,Gn.prototype.createDiagram=function(){return this.importXML(sk)},Gn.prototype._interactionModules=[uv,pv,hv],Gn.prototype._modelingModules=[uT,js,hT,fT,PT,Rp,OT,rM,Qm,vs,cM,pM,PM,TM,MM,LM,qM,QM,Xl,o2,d2,S2,C2,l_,Z2,tk,ak],Gn.prototype._modules=[].concat($i.prototype._modules,Gn.prototype._interactionModules,Gn.prototype._modelingModules);const ck=((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=Uc(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 Gn({container:o.value,moddleExtensions:ya}),i.xml&&await s(i.xml),r("ready")}),ot.watch(()=>i.xml,u=>{u&&a&&s(u)}),ot.onBeforeUnmount(()=>{a==null||a.destroy(),a=void 0}),t({importXml:s,saveXml:c,getModeler:()=>a}),(u,l)=>(ot.openBlock(),ot.createElementBlock("div",{ref_key:"container",ref:o,class:"bpmn-modeler-view"},null,512))}}),[["__scopeId","data-v-a9b41c97"]]);ie.APPLY_BPMN_OPS_SCHEMA=db,ie.BPMN_MODDLE_EXTENSIONS=ya,ie.BWL_MODDLE_SCHEMA=Vp,ie.BWL_NS=zp,ie.BWL_PREFIX=Pc,ie.BWL_SIDES=Ac,ie.BpmnModelerView=ck,ie.EDITOR=Ex,ie.HEADLESS_BPMN_MODULES=Jg,ie.HEADLESS_TEXT_METRICS=qr,ie.I18N_NS=W0,ie.I18N_PREFIX=mf,ie.MVP_FLOW_NODE_TYPES=Un,ie.SYMBOLIC_OP_KINDS=Up,ie.SYMBOLIC_OP_SCHEMA=qp,ie.UNDO_EPISODE_COMMAND=Tc,ie.applyBpmnOpBatch=Wf,ie.applyBpmnOps=Hf,ie.approximateTextWidth=ep,ie.auditBpmnGeometry=bf,ie.auditBpmnGeometryXml=ax,ie.auditGeometry=Rr,ie.auditTargetsOf=ba,ie.buildBpmnOpBatch=xx,ie.buildRegistryIndex=Ef,ie.createBpmnEditorController=wx,ie.createBpmnModdle=gf,ie.createHeadlessBpmnModeler=KP,ie.crossedShapesOf=Qi,ie.describeProcess=Gf,ie.describeProcessXml=bx,ie.edgeCrossCount=Sr,ie.edgeCrossingPairsOf=Kc,ie.executeAsUndoEpisode=Wp,ie.geometryFindingKey=Zi,ie.installHeadlessBpmnDom=Qg,ie.isMvpFlowNodeType=Hp,ie.loadBpmnXml=Wc,ie.lowerOps=Ff,ie.oppositeOverlapCount=Yc,ie.oppositeOverlapOf=qc,ie.planCrossPoolRoute=Mf,ie.planEdgeRepair=Pf,ie.planMiddleSegmentShifts=Rf,ie.planOppositeOverlapRepair=Of,ie.planSegmentDetours=Sf,ie.repairIntroducedCrossings=Af,ie.repairIntroducedOppositeOverlaps=If,ie.rerouteIntroducedCrossPoolEdges=kf,ie.resolverServicesOf=$f,ie.saveBpmnXml=U0,ie.sceneFromDefinitions=_f,ie.sceneFromRegistry=vi,ie.validateOps=Nf,ie.warningMessages=Uc,Object.defineProperty(ie,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 Ak={__depends__:[$o,oc,Cn],searchPad:["type",ve]};function uf(e,t,n,i){this._elementRegistry=e,this._canvas=n,this._search=i,t.registerProvider(this)}uf.$inject=["elementRegistry","searchPad","canvas","search"],uf.prototype.find=function(e){var t=this._canvas.getRootElements(),n=this._elementRegistry.filter(function(i){return!_e(i)&&!t.includes(i)});return this._search(n.map(i=>({element:i,label:vn(i),id:i.id})),e,{keys:["label","id"]}).map(Tk)};function Tk(e){const{item:{element:t},tokens:n}=e;return{element:t,primaryTokens:n.label,secondaryTokens:n.id}}const Mk={__depends__:[Ak,Oy],__init__:["bpmnSearch"],bpmnSearch:["type",uf]},kk="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",Dk="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",Ok={width:36,height:50},Ik={width:50,height:50};function Eb(e,t,n){return ae("path",{d:e,strokeWidth:2,transform:`translate(${t.x}, ${t.y})`,...n})}const Dn=5;function Gc(e,t){this._styles=t,e.registerProvider(this)}Gc.$inject=["outline","styles"],Gc.prototype.getOutline=function(e){const t=this._styles.cls("djs-outline",["no-fill"]);var n;if(Qw(e))return n=ae("rect"),J(n,D({x:-Dn,y:-Dn,rx:4,width:e.width+Dn*2,height:e.height+Dn*2},t)),n;if(!_e(e))return y(e,"bpmn:Gateway")?(n=ae("rect"),D(n.style,{"transform-box":"fill-box",transform:"rotate(45deg)","transform-origin":"center"}),J(n,D({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=ae("rect"),J(n,D({x:-Dn,y:-Dn,rx:14,width:e.width+Dn*2,height:e.height+Dn*2},t))):y(e,"bpmn:EndEvent")?(n=ae("circle"),J(n,D({cx:e.width/2,cy:e.height/2,r:e.width/2+Dn+1},t))):y(e,"bpmn:Event")?(n=ae("circle"),J(n,D({cx:e.width/2,cy:e.height/2,r:e.width/2+Dn},t))):y(e,"bpmn:DataObjectReference")&&wb(e,"bpmn:DataObjectReference")?n=Eb(kk,{x:-6,y:-6},t):y(e,"bpmn:DataStoreReference")&&wb(e,"bpmn:DataStoreReference")&&(n=Eb(Dk,{x:-6,y:-6},t)),n},Gc.prototype.updateOutline=function(e,t){if(!_e(e))return xe(e,["bpmn:SubProcess","bpmn:Group"])?(J(t,{width:e.width+Dn*2,height:e.height+Dn*2}),!0):!!xe(e,["bpmn:Event","bpmn:Gateway","bpmn:DataStoreReference","bpmn:DataObjectReference"])};function wb(e,t){var n;return t==="bpmn:DataObjectReference"?n=Ok:t==="bpmn:DataStoreReference"&&(n=Ik),e.width===n.width&&e.height===n.height}const Lk={__depends__:[Qp],__init__:["outlineProvider"],outlineProvider:["type",Gc]};var Nk='<?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 ii(e){Wr.call(this,e)}Q(ii,Wr),ii.Viewer=Ji,ii.NavigatedViewer=pa,ii.prototype.createDiagram=function(){return this.importXML(Nk)},ii.prototype._interactionModules=[Nv,$v,Hv],ii.prototype._modelingModules=[$T,ic,VT,HT,nM,qp,cM,OM,Rg,Ls,BM,FM,n2,r2,o2,l2,E2,P2,yp,I2,z2,J2,tk,B_,Ck,Mk,Lk],ii.prototype._modules=[].concat(Ji.prototype._modules,ii.prototype._interactionModules,ii.prototype._modelingModules);const Bk=((e,t)=>{const n=e.__vccOpts||e;for(const[i,r]of t)n[i]=r;return n})(ct.defineComponent({__name:"BpmnModelerView",props:{xml:{}},emits:["ready","imported","import-error"],setup(e,{expose:t,emit:n}){const i=e,r=n,o=ct.ref();let a;async function s(u){if(!a)throw new Error("modeler not mounted");try{const{warnings:l}=await a.importXML(u),p=fu(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 ct.onMounted(async()=>{a=new ii({container:o.value,moddleExtensions:La}),i.xml&&await s(i.xml),r("ready")}),ct.watch(()=>i.xml,u=>{u&&a&&s(u)}),ct.onBeforeUnmount(()=>{a==null||a.destroy(),a=void 0}),t({importXml:s,saveXml:c,getModeler:()=>a}),(u,l)=>(ct.openBlock(),ct.createElementBlock("div",{ref_key:"container",ref:o,class:"bpmn-modeler-view"},null,512))}}),[["__scopeId","data-v-a9b41c97"]]);te.APPLY_BPMN_OPS_SCHEMA=Hb,te.BPMN_MODDLE_EXTENSIONS=La,te.BWL_MODDLE_SCHEMA=df,te.BWL_NS=ff,te.BWL_PREFIX=qc,te.BWL_SIDES=Yc,te.BpmnModelerView=Bk,te.EDITOR=Zx,te.FLOW_LABEL_INDENT=mu,te.HEADLESS_BPMN_MODULES=Cv,te.HEADLESS_TEXT_METRICS=uo,te.I18N_NS=_x,te.I18N_PREFIX=$f,te.LABEL_FORK_MARGIN=gu,te.MVP_FLOW_NODE_TYPES=ai,te.SYMBOLIC_OP_KINDS=gf,te.SYMBOLIC_OP_SCHEMA=vf,te.UNDO_EPISODE_COMMAND=Kc,te.applyBpmnOpBatch=yd,te.applyBpmnOps=hd,te.approximateTextWidth=Ep,te.auditBpmnGeometry=Wf,te.auditBpmnGeometryXml=Ox,te.auditGeometry=Di,te.auditTargetsOf=Hr,te.axisSegmentsOf=dr,te.buildBpmnOpBatch=Xx,te.buildRegistryIndex=qf,te.createBpmnEditorController=Qx,te.createBpmnModdle=jf,te.createHeadlessBpmnModeler=SA,te.crossedShapesOf=ki,te.describeProcess=vd,te.describeProcessXml=Kx,te.edgeCrossCount=Fr,te.edgeCrossingPairsOf=$a,te.executeAsUndoEpisode=mf,te.geometryFindingKey=Mi,te.installHeadlessBpmnDom=Rv,te.isMvpFlowNodeType=pf,te.loadBpmnXml=pu,te.lowerOps=dd,te.oppositeOverlapCount=hu,te.oppositeOverlapOf=du,te.planCrossPoolRoute=td,te.planEdgeRepair=Qf,te.planLabelPlacement=ad,te.planMiddleSegmentShifts=Xf,te.planOppositeOverlapRepair=rd,te.planSegmentDetours=Kf,te.repairIntroducedCrossings=Jf,te.repairIntroducedOppositeOverlaps=od,te.repairIntroducedSharedSegmentLabels=sd,te.rerouteIntroducedCrossPoolEdges=nd,te.resolverServicesOf=pd,te.saveBpmnXml=bx,te.sceneFromDefinitions=Gf,te.sceneFromRegistry=Ln,te.sharedSegmentUnderLabel=Ba,te.sharedSpansOf=vu,te.validateOps=ld,te.warningMessages=fu,Object.defineProperty(te,Symbol.toStringTag,{value:"Module"})}));