@g1cloud/bpmn-modeler-next 5.0.0-alpha.33 → 5.0.0-alpha.34

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,14 +1,14 @@
1
- (function(te,Pt){typeof exports=="object"&&typeof module<"u"?Pt(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],Pt):(te=typeof globalThis<"u"?globalThis:te||self,Pt(te.BpmnModeler={},te.Vue))})(this,(function(te,Pt){"use strict";var sO=Object.defineProperty;var cO=(te,Pt,Ei)=>Pt in te?sO(te,Pt,{enumerable:!0,configurable:!0,writable:!0,value:Ei}):te[Pt]=Ei;var Xr=(te,Pt,Ei)=>cO(te,typeof Pt!="symbol"?Pt+"":Pt,Ei);const Ei=["startEvent","endEvent","userTask","serviceTask","task","sendTask","receiveTask","exclusiveGateway","parallelGateway"];function zf(e){return Ei.includes(e)}const Vf="http://g1project.net/spec/bpmn/bwl/1.0",wu="bwl",Eu=["top-left","top","top-right","right","bottom-right","bottom","bottom-left","left"],Gf={name:"bwl-hints",uri:Vf,prefix:wu,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"}]}]},Su="bwl.undoEpisode",Wf=new WeakSet;function jx(e){Wf.has(e)||(e.register(Su,{preExecute(t){try{t.run()}catch(n){t.error=n}}}),Wf.add(e))}function Uf(e,t){jx(e);const n={run:t};if(e.execute(Su,n),n.error!==void 0)throw e.canUndo()&&e.undo(),n.error}const Yf=["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"],Fx={description:"생략 = 보존, null = 제거.",anyOf:[{type:"string"},{type:"null"}]},Hx={type:"object",description:"레인. 배열 선언 순서 = 풀 내 상→하 순서.",properties:{id:{type:"string"},name:{type:"string"}},required:["id"],additionalProperties:!1},zx={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},Vx={type:"object",description:"플로우 노드. 좌표는 지정하지 않는다 — 배치는 resolver 가 결정한다.",properties:{id:{type:"string"},type:{type:"string",enum:[...Ei]},name:{type:"string"},participant:{type:"string",description:"소속 풀 id(협업 문서)."},lane:{type:"string",description:"소속 레인 id(풀 정의에 선언된 것)."}},required:["id","type"],additionalProperties:!1},Gx={type:"object",description:"분기 조건 — 게이트웨이가 아닌 플로우에 붙인다. MVP 는 label 만.",properties:{label:{type:"string"}},required:["label"],additionalProperties:!1},Wx={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},Ux={type:"object",description:"메시지 플로우(풀 경계를 넘는 연결 — 노드 또는 블랙박스 풀 자체가 끝점).",properties:{id:{type:"string"},source:{type:"string"},target:{type:"string"},name:{type:"string"}},required:["id","source","target"],additionalProperties:!1},Yx={type:"object",properties:{id:{type:"string"},name:{type:"string"}},required:["id"],additionalProperties:!1},qx={type:"object",description:"데이터 입출력 연관. 방향 = source→target(태스크→스토어 = 쓰기, 스토어→태스크 = 읽기).",properties:{id:{type:"string"},source:{type:"string"},target:{type:"string"}},required:["source","target"],additionalProperties:!1},Kx={type:"object",properties:{id:{type:"string"},text:{type:"string"}},required:["id","text"],additionalProperties:!1},Xx={type:"object",description:"연관선(주석 ↔ 요소).",properties:{id:{type:"string"},source:{type:"string"},target:{type:"string"}},required:["source","target"],additionalProperties:!1},Zx={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},Qx={type:"object",description:"주석 방위 힌트 — 앵커 요소 기준 상대 배치. 있으면 결정적 배치, 없으면 휴리스틱.",properties:{anchor:{type:"string",description:"기준 요소 id."},side:{type:"string",enum:[...Eu]},offset:{type:"number",description:"앵커 가장자리 → 주석 가장자리 간격(px). 생략 시 50."}},required:["anchor","side"],additionalProperties:!1};function rn(e,t){return{type:"object",description:t.description,properties:{kind:{const:e},...t.properties},required:["kind",...t.required??[]],additionalProperties:!1}}const Jx={"participant.add":rn("participant.add",{description:"풀 추가. order = 풀 세로 순서 힌트 — **작을수록 위**(생략 시 op 순서가 곧 배치 순서). 값은 상대 순서만 쓰므로 1,2,3… 연속이든 10,20,30 간격이든 같다.",properties:{participant:{$ref:"#/$defs/irParticipant"},order:{type:"integer"}},required:["participant"]}),"participant.update":rn("participant.update",{description:"풀 이름/레인 갱신. lanes 는 전체 재선언(생략 = 보존) — 기존 레인을 유지하려면 함께 다시 나열한다.",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"},lanes:{type:"array",items:{$ref:"#/$defs/irLane"}}},required:["id"]}),"node.add":rn("node.add",{description:'플로우 노드 추가. band = 가로 밴드 순번 힌트(주 흐름 0, 갈래 1, 2…) — 위/아래가 아니라 "주 흐름에서 몇 번째 갈래"다. 행 배치(어느 갈래가 위/아래인지)는 호스트가 정한다(대칭·메시지 방향). 레인이 있으면 그 레인 안의 밴드다 — 한 레인 안에서 게이트웨이 출구를 갈라 놓을 때 쓴다. 컨테이너(풀·레인)는 밴드 수만큼 자란다.',properties:{node:{$ref:"#/$defs/irNode"},band:{type:"integer",description:"0 이상 정수(음수는 payload-invalid 로 거부)."}},required:["node"]}),"node.update":rn("node.update",{description:"노드 이름/레인/타입 갱신. lane = 레인 재배정(이동), type = 태스크·이벤트 타입 전환.",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"},lane:{type:"string"},type:{type:"string",enum:[...Ei]}},required:["id"]}),"sequenceFlow.add":rn("sequenceFlow.add",{description:"시퀀스 플로우 추가. 분기 조건은 게이트웨이가 아닌 플로우의 condition 에 싣는다.",properties:{flow:{$ref:"#/$defs/irSequenceFlow"}},required:["flow"]}),"sequenceFlow.update":rn("sequenceFlow.update",{description:"시퀀스 플로우 이름/조건/끝점 갱신. condition: null = 조건 제거. source/target = 끝점 재배선 — 중간 삽입은 기존 플로우를 지우지 말고 이것으로 한쪽 끝을 옮긴 뒤 새 플로우를 추가한다.",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"},condition:{description:"생략 = 보존, null = 제거.",anyOf:[{$ref:"#/$defs/irFlowCondition"},{type:"null"}]},source:{description:"새 출발 노드 id(생략 = 보존). 같은 배치에서 추가한 노드도 지목할 수 있다.",type:"string"},target:{description:"새 도착 노드 id(생략 = 보존). 같은 배치에서 추가한 노드도 지목할 수 있다.",type:"string"}},required:["id"]}),"messageFlow.add":rn("messageFlow.add",{description:"메시지 플로우 추가(풀 경계를 넘는 연결).",properties:{flow:{$ref:"#/$defs/irMessageFlow"}},required:["flow"]}),"messageFlow.update":rn("messageFlow.update",{description:"메시지 플로우 이름 갱신.",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"}},required:["id"]}),"dataStore.add":rn("dataStore.add",{description:"데이터 스토어 추가(+ 입출력 연관 동반 가능).",properties:{dataStore:{$ref:"#/$defs/irDataStore"},associations:{type:"array",items:{$ref:"#/$defs/irDataAssociation"}}},required:["dataStore"]}),"dataStore.update":rn("dataStore.update",{description:"데이터 스토어 이름 갱신.",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"}},required:["id"]}),"dataAssociation.add":rn("dataAssociation.add",{description:"기존 노드 ↔ 기존 데이터 스토어의 입출력 연관 추가.",properties:{association:{$ref:"#/$defs/irDataAssociation"}},required:["association"]}),"association.add":rn("association.add",{description:"주석 ↔ 요소 연관 추가(한쪽 끝은 주석). 주석 신설과 함께면 annotation.add 의 association 을 쓰고, 이 op 는 추가 연관(한 주석에 여러 연관)용.",properties:{association:{$ref:"#/$defs/irAssociation"}},required:["association"]}),"annotation.add":rn("annotation.add",{description:"텍스트 주석 추가. association 으로 대상 요소와 연결하고, placement 로 방위를 지정하면 결정적 배치된다.",properties:{annotation:{$ref:"#/$defs/irTextAnnotation"},association:{$ref:"#/$defs/irAssociation"},placement:{$ref:"#/$defs/bwlPlacement"}},required:["annotation"]}),"annotation.update":rn("annotation.update",{description:"주석 본문/방위 힌트 갱신. placement: null = 힌트 제거(휴리스틱 복귀). 주석 삭제는 element.remove.",properties:{id:{type:"string"},text:{type:"string"},placement:{description:"생략 = 보존, null = 힌트 제거.",anyOf:[{$ref:"#/$defs/bwlPlacement"},{type:"null"}]}},required:["id"]}),"group.add":rn("group.add",{description:"그룹 추가 — 바운즈는 members 의 bbox 로 산출되므로 좌표를 지정하지 않는다.",properties:{group:{$ref:"#/$defs/irGroup"}},required:["group"]}),"group.update":rn("group.update",{description:"그룹 이름/멤버 갱신. members 는 전체 재선언(생략 = 보존).",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"},members:{type:"array",items:{type:"string"}}},required:["id"]}),"element.remove":rn("element.remove",{description:"요소 제거(카테고리 무관). 부착된 연결선은 함께 제거된다.",properties:{id:{type:"string"}},required:["id"]})},qf={anyOf:Yf.map(e=>Jx[e])},e0={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:Hx,irParticipant:zx,irNode:Vx,irFlowCondition:Gx,irSequenceFlow:Wx,irMessageFlow:Ux,irDataStore:Yx,irDataAssociation:qx,irTextAnnotation:Kx,irAssociation:Xx,irGroup:Zx,bwlPlacement:Qx,nullableString:Fx,symbolicOp:qf}};function Ru(e){return Array.prototype.concat.apply([],e)}const Ho=Object.prototype.toString,t0=Object.prototype.hasOwnProperty;function Rr(e){return e===void 0}function jt(e){return e!==void 0}function Zr(e){return e==null}function xe(e){return Ho.call(e)==="[object Array]"}function Ut(e){return Ho.call(e)==="[object Object]"}function Ce(e){return Ho.call(e)==="[object Number]"}function Yt(e){const t=Ho.call(e);return t==="[object Function]"||t==="[object AsyncFunction]"||t==="[object GeneratorFunction]"||t==="[object AsyncGeneratorFunction]"||t==="[object Proxy]"}function wn(e){return Ho.call(e)==="[object String]"}function n0(e){if(!xe(e))throw new Error("must supply array")}function En(e,t){return!Zr(e)&&t0.call(e,t)}function ut(e,t){const n=Za(t);let i;return k(e,function(r,o){if(n(r,o))return i=r,!1}),i}function Kf(e,t){const n=Za(t);let i=xe(e)?-1:void 0;return k(e,function(r,o){if(n(r,o))return i=o,!1}),i}function Ie(e,t){const n=Za(t);let i=[];return k(e,function(r,o){n(r,o)&&i.push(r)}),i}function k(e,t){let n,i;if(Rr(e))return;const r=xe(e)?s0:a0;for(let o in e)if(En(e,o)&&(n=e[o],i=t(n,r(o)),i===!1))return n}function i0(e,t){if(Rr(e))return[];n0(e);const n=Za(t);return e.filter(function(i,r){return!n(i,r)})}function Sn(e,t,n){return k(e,function(i,r){n=t(n,i,r)}),n}function Cr(e,t){return!!Sn(e,function(n,i,r){return n&&t(i,r)},!0)}function Wi(e,t){return!!ut(e,t)}function on(e,t){let n=[];return k(e,function(i,r){n.push(t(i,r))}),n}function Xa(e){return e&&Object.keys(e)||[]}function r0(e){return Xa(e).length}function Qr(e){return on(e,t=>t)}function Jr(e,t,n={}){return t=Cu(t),k(e,function(i){let r=t(i)||"_",o=n[r];o||(o=n[r]=[]),o.push(i)}),n}function Xf(e,...t){e=Cu(e);let n={};return k(t,r=>Jr(r,e,n)),on(n,function(r,o){return r[0]})}const o0=Xf;function ai(e,t){t=Cu(t);let n=[];return k(e,function(i,r){let o=t(i,r),a={d:o,v:i};for(var s=0;s<n.length;s++){let{d:c}=n[s];if(o<c){n.splice(s,0,a);return}}n.push(a)}),on(n,i=>i.v)}function eo(e){return function(t){return Cr(e,function(n,i){return t[i]===n})}}function Cu(e){return Yt(e)?e:t=>t[e]}function Za(e){return Yt(e)?e:t=>t===e}function a0(e){return e}function s0(e){return Number(e)}function Pu(e,t){let n,i,r,o;function a(f){let p=Date.now(),d=f?0:o+t-p;if(d>0)return s(d);e.apply(r,i),c()}function s(f){n=setTimeout(a,f)}function c(){n&&clearTimeout(n),n=o=i=r=void 0}function u(){n&&a(!0),c()}function l(...f){o=Date.now(),i=f,r=this,n||s(t)}return l.flush=u,l.cancel=c,l}function _n(e,t){return e.bind(t)}function L(e,...t){return Object.assign(e,...t)}function c0(e,t,n){let i=e;return k(t,function(r,o){if(typeof r!="number"&&typeof r!="string")throw new Error("illegal key type: "+typeof r+". Key should be of type number or string.");if(r==="constructor")throw new Error("illegal key: constructor");if(r==="__proto__")throw new Error("illegal key: __proto__");let a=t[o+1],s=i[r];jt(a)&&Zr(s)&&(s=i[r]=isNaN(+a)?{}:[]),Rr(a)?Rr(n)?delete i[r]:i[r]=n:i=s}),e}function ii(e,t){let n={},i=Object(e);return k(t,function(r){r in i&&(n[r]=e[r])}),n}function si(e,t){let n={},i=Object(e);return k(i,function(r,o){t.indexOf(o)===-1&&(n[o]=r)}),n}function Au(){}Au.prototype.get=function(e){return this.$model.properties.get(this,e)},Au.prototype.set=function(e,t){this.$model.properties.set(this,e,t)};function Zf(e,t){this.model=e,this.properties=t}Zf.prototype.createType=function(e){var t=this.model,n=this.properties,i=Object.create(Au.prototype);k(e.properties,function(a){!a.isMany&&a.default!==void 0&&(i[a.name]=a.default)}),n.defineModel(i,t),n.defineDescriptor(i,e);var r=e.ns.name;function o(a){n.define(this,"$type",{value:r,enumerable:!0}),n.define(this,"$attrs",{value:{}}),n.define(this,"$parent",{writable:!0}),k(a,_n(function(s,c){this.set(c,s)},this))}return o.prototype=i,o.hasType=i.$instanceOf=this.model.hasType,n.defineModel(o,t),n.defineDescriptor(o,e),o};var u0=L(Object.create(null),{String:!0,Boolean:!0,Integer:!0,Real:!0,Element:!0}),Qf=L(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 Tu(e,t){var n=Qf[e];return n?n(t):t}function Mu(e){return!!u0[e]}function Jf(e){return!!Qf[e]}function an(e,t){var n=e.split(/:/),i,r;if(n.length===1)i=e,r=t;else if(n.length===2)i=n[1],r=n[0];else throw new Error("expected <prefix:localName> or <localName>, got "+e);return e=(r?r+":":"")+i,{name:e,prefix:r,localName:i}}function $n(e){this.ns=e,this.name=e.name,this.allTypes=[],this.allTypesByName=Object.create(null),this.properties=[],this.propertiesByName=Object.create(null)}$n.prototype.build=function(){return ii(this,["ns","name","allTypes","allTypesByName","properties","propertiesByName","bodyProperty","idProperty"])},$n.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)},$n.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},$n.prototype.redefineProperty=function(e,t,n){var i=e.ns.prefix,r=t.split("#"),o=an(r[0],i),a=an(r[1],o.prefix).name,s=this.propertiesByName[a];if(s)this.replaceProperty(s,e,n);else throw new Error("refined property <"+a+"> not found");delete e.redefines},$n.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},$n.prototype.removeNamedProperty=function(e){var t=e.ns,n=this.propertiesByName;delete n[t.name],delete n[t.localName]},$n.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},$n.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},$n.prototype.assertNotTrait=function(e){if((e.extends||[]).length)throw new Error(`cannot create <${e.name}> extending <${e.extends}>`)},$n.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")},$n.prototype.hasProperty=function(e){return this.propertiesByName[e]},$n.prototype.addTrait=function(e,t){t&&this.assertNotTrait(e);var n=this.allTypesByName,i=this.allTypes,r=e.name;r in n||(k(e.properties,_n(function(o){o=L({},o,{name:o.ns.localName,inherited:t}),Object.defineProperty(o,"definedBy",{value:e});var a=o.replaces,s=o.redefines;a||s?this.redefineProperty(o,a||s,a):(o.isBody&&this.setBodyProperty(o),o.isId&&this.setIdProperty(o),this.addProperty(o))},this)),i.push(e),n[r]=e)};function Ui(e,t){this.packageMap=Object.create(null),this.typeMap=Object.create(null),this.packages=[],this.properties=t,k(e,_n(this.registerPackage,this))}Ui.prototype.getPackage=function(e){return this.packageMap[e]},Ui.prototype.getPackages=function(){return this.packages},Ui.prototype.registerPackage=function(e){e=L({},e);var t=this.packageMap;ed(t,e,"prefix"),ed(t,e,"uri"),k(e.types,_n(function(n){this.registerType(n,e)},this)),t[e.uri]=t[e.prefix]=e,this.packages.push(e)},Ui.prototype.registerType=function(e,t){e=L({},e,{superClass:(e.superClass||[]).slice(),extends:(e.extends||[]).slice(),properties:(e.properties||[]).slice(),meta:L({},e.meta||{})});var n=an(e.name,t.prefix),i=n.name,r=Object.create(null);k(e.properties,_n(function(o){var a=an(o.name,n.prefix),s=a.name;Mu(o.type)||(o.type=an(o.type,a.prefix).name),L(o,{ns:a,name:s}),r[s]=o},this)),L(e,{ns:n,name:i,propertiesByName:r}),k(e.extends,_n(function(o){var a=an(o,n.prefix),s=this.typeMap[a.name];s.traits=s.traits||[],s.traits.push(i)},this)),this.definePackage(e,t),this.typeMap[i]=e},Ui.prototype.mapTypes=function(e,t,n){var i=Mu(e.name)?{name:e.name}:this.typeMap[e.name],r=this;function o(c,u){var l=an(c,Mu(c)?"":e.prefix);r.mapTypes(l,t,u)}function a(c){return o(c,!0)}function s(c){return o(c,!1)}if(!i)throw new Error("unknown type <"+e.name+">");k(i.superClass,n?a:s),t(i,!n),k(i.traits,a)},Ui.prototype.getEffectiveDescriptor=function(e){var t=an(e),n=new $n(t);this.mapTypes(t,function(r,o){n.addTrait(r,o)});var i=n.build();return this.definePackage(i,i.allTypes[i.allTypes.length-1].$pkg),i},Ui.prototype.definePackage=function(e,t){this.properties.define(e,"$pkg",{value:t})};function ed(e,t,n){var i=t[n];if(i in e)throw new Error("package with "+n+" <"+i+"> already defined")}function Pr(e){this.model=e}Pr.prototype.set=function(e,t,n){if(!wn(t)||!t.length)throw new TypeError("property name must be a non-empty string");var i=this.getProperty(e,t),r=i&&i.name;l0(n)?i?delete e[r]:delete e.$attrs[ku(t)]:i?r in e?e[r]=n:td(e,i,n):e.$attrs[ku(t)]=n},Pr.prototype.get=function(e,t){var n=this.getProperty(e,t);if(!n)return e.$attrs[ku(t)];var i=n.name;return!e[i]&&n.isMany&&td(e,n,[]),e[i]},Pr.prototype.define=function(e,t,n){if(!n.writable){var i=n.value;n=L({},n,{get:function(){return i}}),delete n.value}Object.defineProperty(e,t,n)},Pr.prototype.defineDescriptor=function(e,t){this.define(e,"$descriptor",{value:t})},Pr.prototype.defineModel=function(e,t){this.define(e,"$model",{value:t})},Pr.prototype.getProperty=function(e,t){var n=this.model,i=n.getPropertyDescriptor(e,t);if(i)return i;if(t.includes(":"))return null;const r=n.config.strict;if(typeof r<"u"){const o=new TypeError(`unknown property <${t}> on <${e.$type}>`);if(r)throw o;typeof console<"u"&&console.warn(o)}return null};function l0(e){return typeof e>"u"}function td(e,t,n){Object.defineProperty(e,t.name,{enumerable:!t.isReference,writable:!0,value:n,configurable:!0})}function ku(e){return e.replace(/^:/,"")}function zn(e,t={}){this.properties=new Pr(this),this.factory=new Zf(this,this.properties),this.registry=new Ui(e,this.properties),this.typeCache=Object.create(null),this.config=t}zn.prototype.create=function(e,t){var n=this.getType(e);if(!n)throw new Error("unknown type <"+e+">");return new n(t)},zn.prototype.getType=function(e){var t=this.typeCache,n=wn(e)?e:e.ns.name,i=t[n];return i||(e=this.registry.getEffectiveDescriptor(n),i=t[n]=this.factory.createType(e)),i},zn.prototype.createAny=function(e,t,n){var i=an(e),r={$type:e,$instanceOf:function(a){return a===this.$type},get:function(a){return this[a]},set:function(a,s){c0(this,[a],s)}},o={name:e,isGeneric:!0,ns:{prefix:i.prefix,localName:i.localName,uri:t}};return this.properties.defineDescriptor(r,o),this.properties.defineModel(r,this),this.properties.define(r,"get",{enumerable:!1,writable:!0}),this.properties.define(r,"set",{enumerable:!1,writable:!0}),this.properties.define(r,"$parent",{enumerable:!1,writable:!0}),this.properties.define(r,"$instanceOf",{enumerable:!1,writable:!0}),k(n,function(a,s){Ut(a)&&a.value!==void 0?r[a.name]=a.value:r[s]=a}),r},zn.prototype.getPackage=function(e){return this.registry.getPackage(e)},zn.prototype.getPackages=function(){return this.registry.getPackages()},zn.prototype.getElementDescriptor=function(e){return e.$descriptor},zn.prototype.hasType=function(e,t){t===void 0&&(t=e,e=this);var n=e.$model.getElementDescriptor(e);return t in n.allTypesByName},zn.prototype.getPropertyDescriptor=function(e,t){return this.getElementDescriptor(e).propertiesByName[t]},zn.prototype.getTypeDescriptor=function(e){return this.registry.typeMap[e]};var nd=String.fromCharCode,p0=Object.prototype.hasOwnProperty,f0=/&#(\d+);|&#x([0-9a-f]+);|&(\w+);/ig,zo={amp:"&",apos:"'",gt:">",lt:"<",quot:'"'};Object.keys(zo).forEach(function(e){zo[e.toUpperCase()]=zo[e]});function d0(e,t,n,i){return i?p0.call(zo,i)?zo[i]:"&"+i+";":nd(t||parseInt(n,16))}function Ar(e){return e.length>3&&e.indexOf("&")!==-1?e.replace(f0,d0):e}var id="non-whitespace outside of root node";function Yi(e){return new Error(e)}function h0(e){return"missing namespace for prefix <"+e+">"}function Qa(e){return{get:e,enumerable:!0}}function m0(e){var t=Object.create(null),n;for(n in e)t[n]=e[n];return t}var rd=Symbol("nameCache");function Du(e){return e+"$uri"}function g0(e){var t=Object.create(null),n,i;for(n in e)i=e[n],t[i]=i,t[Du(i)]=n;return t}function Ja(){return{line:0,column:0}}function y0(e){throw e}function od(e){if(!this)return new od(e);var t=e&&e.proxy,n,i,r,o,a=y0,s,c,u,l,f=Ja,p=!1,d=!1,h="",m=!1,g=!1,R=null,w=!1,b,x,S,M;function N($){$ instanceof Error||($=Yi($)),R=$,a($,f)}function T($){s&&($ instanceof Error||($=Yi($)),s($,f))}this.on=function($,G){if(typeof G!="function")throw Yi("required args <name, cb>");switch($){case"openTag":i=G;break;case"text":n=G;break;case"closeTag":r=G;break;case"error":a=G;break;case"warn":s=G;break;case"cdata":o=G;break;case"attention":l=G;break;case"question":u=G;break;case"comment":c=G;break;default:throw Yi("unsupported event: "+$)}return this},this.ns=function($){if(typeof $>"u"&&($={}),typeof $!="object")throw Yi("required args <nsMap={}>");var G=Object.create(null),he;for(he in $)G[he]=$[he];return g=!0,M=G,this};function H(){b=g?[]:null,x=g?g0(M):null,S=[],f=Ja,w=!1,R=null,d=!1,h=""}this.parse=function($){if(typeof $!="string")throw Yi("required args <xml=string>");if(p)throw Yi("parse during stream; call end() first");return H(),V($),f=Ja,w=!1,R},this.write=function($){if(typeof $!="string")throw Yi("required args <xml=string>");return p||(H(),p=!0),R||(h=V(h+$,!0)||""),this},this.end=function(){return p||H(),p=!1,R||V(h),h="",f=Ja,w=!1,R},this.stop=function(){w=!0};function V($,G=!1){var he=null,Fe=null,pt,q=0,me=!1,ge=!1,pe=0,fe=0,ie,z,F,U,Oe,It,P,_,y,D="",B=0,W;function le(it,Nt){var ln=it.indexOf(":");if(ln===-1)return it;var pn=x[it.substring(0,ln)];return pn?Nt===pn?it.substr(ln+1):pn+it.substr(ln):(T(h0(it.substring(0,ln))),null)}function Me(){if(W!==null)return W;var it,Nt,ln=g&&x.xmlns,pn=g&&m?[]:null,ct=B,Bt=D,fn=Bt.length,Fo,dn,Ln,In,St,Gi={},_u=new Set,Nn,qe,Je;e:for(;ct<fn;ct++)if(Nn=!1,qe=Bt.charCodeAt(ct),!(qe===32||qe<14&&qe>8)){for((qe<65||qe>122||qe>90&&qe<97)&&qe!==95&&qe!==58&&(T("illegal first char attribute name"),Nn=!0),Je=ct+1;Je<fn;Je++)if(qe=Bt.charCodeAt(Je),!(qe>96&&qe<123||qe>64&&qe<91||qe>47&&qe<59||qe===46||qe===45||qe===95)){if(qe===32||qe<14&&qe>8){T("missing attribute value"),ct=Je;continue e}if(qe===61)break;T("illegal attribute name char"),Nn=!0}if(St=Bt.substring(ct,Je),St==="xmlns:xmlns"&&(T("illegal declaration of xmlns"),Nn=!0),qe=Bt.charCodeAt(Je+1),qe===34)Je=Bt.indexOf('"',ct=Je+2),Je===-1&&(Je=Bt.indexOf("'",ct),Je!==-1&&(T("attribute value quote missmatch"),Nn=!0));else if(qe===39)Je=Bt.indexOf("'",ct=Je+2),Je===-1&&(Je=Bt.indexOf('"',ct),Je!==-1&&(T("attribute value quote missmatch"),Nn=!0));else for(T("missing attribute value quotes"),Nn=!0,Je=Je+1;Je<fn&&(qe=Bt.charCodeAt(Je+1),!(qe===32||qe<14&&qe>8));Je++);for(Je===-1&&(T("missing closing quotes"),Je=fn,Nn=!0),Nn||(Ln=Bt.substring(ct,Je)),ct=Je;Je+1<fn&&(qe=Bt.charCodeAt(Je+1),!(qe===32||qe<14&&qe>8));Je++)ct===Je&&(T("illegal character after attribute end"),Nn=!0);if(ct=Je+1,Nn)continue e;if(_u.has(St)){T("attribute <"+St+"> already defined");continue}if(_u.add(St),!g){Gi[St]=Ln;continue}if(m){if(dn=St==="xmlns"?"xmlns":St.charCodeAt(0)===120&&St.substr(0,6)==="xmlns:"?St.substr(6):null,dn!==null){if(it=Ar(Ln),Nt=Du(dn),In=M[it],!In){if(dn==="xmlns"||Nt in x&&x[Nt]!==it)do In="ns"+q++;while(typeof x[In]<"u");else In=dn;M[it]=In}x[dn]!==In&&(Fo||(x=m0(x),Fo=!0),x[dn]=In,dn==="xmlns"&&(x[Du(In)]=it,ln=In),x[Nt]=it),Gi[St]=Ln;continue}pn.push(St,Ln);continue}St=le(St,ln),St!==null&&(Gi[St]=Ln)}if(m)for(ct=0,fn=pn.length;ct<fn;ct++)St=le(pn[ct++],ln),Ln=pn[ct],St!==null&&(Gi[St]=Ln);return W=Gi}function Ye(){for(var it=/(\r\n|\r|\n)/g,Nt=0,ln=0,pn=0,ct=fe,Bt,fn;pe>=pn&&(Bt=it.exec($),!(!Bt||(ct=Bt[0].length+Bt.index,ct>pe)));)Nt+=1,pn=ct;return pe==-1?(ln=ct,fn=$.substring(fe)):fe===0?fn=$.substring(fe,pe):(ln=pe-pn,fn=fe==-1?$.substring(pe):$.substring(pe,fe+1)),{data:fn,line:Nt,column:ln}}for(f=Ye,t&&(y=Object.create({},{name:Qa(function(){return P}),originalName:Qa(function(){return _}),attrs:Qa(Me),ns:Qa(function(){return x})}));fe!==-1;){if($.charCodeAt(fe)===60?pe=fe:pe=$.indexOf("<",fe),pe===-1){if(G)return $.substring(fe);if(S.length)return N("unexpected end of file");if(!d)return N("missing start tag");fe<$.length&&$.substring(fe).trim()&&T(id);return}if(d||(d=!0),fe!==pe){if(S.length){if(n&&(n($.substring(fe,pe),Ar,f),w))return}else if($.substring(fe,pe).trim()&&(T(id),w))return}if(U=$.charCodeAt(pe+1),U===33){if(F=$.charCodeAt(pe+2),F===91&&$.substr(pe+3,6)==="CDATA["){if(fe=$.indexOf("]]>",pe),fe===-1)return G?$.substring(pe):N("unclosed cdata");if(o&&(o($.substring(pe+9,fe),f),w))return;fe+=3;continue}if(F===45&&$.charCodeAt(pe+3)===45){if(fe=$.indexOf("-->",pe),fe===-1)return G?$.substring(pe):N("unclosed comment");if(c&&(c($.substring(pe+4,fe),Ar,f),w))return;fe+=3;continue}}if(U===63){if(fe=$.indexOf("?>",pe),fe===-1)return G?$.substring(pe):N("unclosed question");if(u&&(u($.substring(pe,fe+2),f),w))return;fe+=2;continue}for(ie=pe+1;;ie++){if(Oe=$.charCodeAt(ie),isNaN(Oe))return G?$.substring(pe):(fe=-1,N("unclosed tag"));if(Oe===34)F=$.indexOf('"',ie+1),ie=F!==-1?F:ie;else if(Oe===39)F=$.indexOf("'",ie+1),ie=F!==-1?F:ie;else if(Oe===62){fe=ie;break}}if(U===33){if(l&&(l($.substring(pe,fe+1),Ar,f),w))return;fe+=1;continue}if(W={},U===47){if(me=!1,ge=!0,!S.length)return N("missing open tag");if(ie=P=S.pop(),F=pe+2+ie.length,$.substring(pe+2,F)!==ie)return N("closing tag mismatch");for(;F<fe;F++)if(U=$.charCodeAt(F),!(U===32||U>8&&U<14))return N("close tag")}else{if($.charCodeAt(fe-1)===47?(ie=P=$.substring(pe+1,fe-1),me=!0,ge=!0):(ie=P=$.substring(pe+1,fe),me=!0,ge=!1),!(U>96&&U<123||U>64&&U<91||U===95||U===58))return N("illegal first char nodeName");for(F=1,z=ie.length;F<z;F++)if(U=ie.charCodeAt(F),!(U>96&&U<123||U>64&&U<91||U>47&&U<59||U===45||U===95||U==46)){if(U===32||U<14&&U>8){P=ie.substring(0,F),W=null;break}return N("invalid nodeName")}ge||S.push(P)}if(g){pt=x,me&&(ge||b.push(pt),W===null&&(m=ie.indexOf("xmlns",F)!==-1)&&(B=F,D=ie,Me(),m=!1)),_=P,Fe!==x&&(he=x[rd],he===void 0&&(he=x[rd]=Object.create(null)),Fe=x);var ft=he[P];if(ft!==void 0)P=ft;else{if(U=P.indexOf(":"),U!==-1){if(It=x[P.substring(0,U)],!It)return N("missing namespace on <"+_+">");P=P.substr(U+1)}else It=x.xmlns;It&&(P=It+":"+P),he[_]=P}}if(me&&(B=F,D=ie,i&&(t?i(y,Ar,ge,f):i(P,Me,Ar,ge,f),w)))return;if(ge){if(r&&(r(t?y:P,Ar,me,f),w))return;g&&(me?x=pt:x=b.pop())}fe+=1}}}function ad(e){return e.xml&&e.xml.tagAlias==="lowerCase"}var Ou={xsi:"http://www.w3.org/2001/XMLSchema-instance",xml:"http://www.w3.org/XML/1998/namespace"},sd="property";function cd(e){return e.xml&&e.xml.serialize}function v0(e){const t=cd(e);return t!==sd&&(t||null)}function _0(e){return e.charAt(0).toUpperCase()+e.slice(1)}function ud(e,t){return ad(t)?e.prefix+":"+_0(e.localName):e.name}function b0(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 x0(e,t,n){const i=an(e,t.xmlns),r=`${t[i.prefix]||i.prefix}:${i.localName}`,o=an(r);var a=n.getPackage(o.prefix);return b0(o,a)}function qi(e){return new Error(e)}function Si(e){return e.$descriptor}function w0(e){L(this,e),this.elementsById={},this.references=[],this.warnings=[],this.addReference=function(t){this.references.push(t)},this.addElement=function(t){if(!t)throw qi("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 qi("duplicate ID <"+o+">");n[o]=t}},this.addWarning=function(t){this.warnings.push(t)}}function Vo(){}Vo.prototype.handleEnd=function(){},Vo.prototype.handleText=function(){},Vo.prototype.handleNode=function(){};function Lu(){}Lu.prototype=Object.create(Vo.prototype),Lu.prototype.handleNode=function(){return this};function to(){}to.prototype=Object.create(Vo.prototype),to.prototype.handleText=function(e){this.body=(this.body||"")+e};function Go(e,t){this.property=e,this.context=t}Go.prototype=Object.create(to.prototype),Go.prototype.handleNode=function(e){if(this.element)throw qi("expected no sub nodes");return this.element=this.createReference(e),this},Go.prototype.handleEnd=function(){this.element.id=this.body},Go.prototype.createReference=function(e){return{property:this.property.ns.name,id:""}};function Iu(e,t){this.element=t,this.propertyDesc=e}Iu.prototype=Object.create(to.prototype),Iu.prototype.handleEnd=function(){var e=this.body||"",t=this.element,n=this.propertyDesc;e=Tu(n.type,e),n.isMany?t.get(n.name).push(e):t.set(n.name,e)};function es(){}es.prototype=Object.create(to.prototype),es.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 hn(e,t,n){this.model=e,this.type=e.getType(t),this.context=n}hn.prototype=Object.create(es.prototype),hn.prototype.addReference=function(e){this.context.addReference(e)},hn.prototype.handleText=function(e){var t=this.element,n=Si(t),i=n.bodyProperty;if(!i)throw qi("unexpected body text <"+e+">");to.prototype.handleText.call(this,e)},hn.prototype.handleEnd=function(){var e=this.body,t=this.element,n=Si(t),i=n.bodyProperty;i&&e!==void 0&&(e=Tu(i.type,e),t.set(i.name,e))},hn.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 k(t,function(c,u){var l=i.propertiesByName[u],f;l&&l.isReference?l.isMany?(f=c.split(" "),k(f,function(p){r.addReference({element:o,property:l.ns.name,id:p})})):r.addReference({element:o,property:l.ns.name,id:c}):(l?c=Tu(l.type,c):u==="xmlns"?u=":"+u:(s=an(u,i.ns.prefix),a.getPackage(s.prefix)&&r.addWarning({message:"unknown attribute <"+u+">",element:o,property:u,value:c})),o.set(u,c))}),o},hn.prototype.getPropertyForNode=function(e){var t=e.name,n=an(t),i=this.type,r=this.model,o=Si(i),a=n.name,s=o.propertiesByName[a];if(s&&!s.isAttr){const u=v0(s);if(u){const l=e.attributes[u];if(l){const f=x0(l,e.ns,r),p=r.getType(f);return L({},s,{effectiveType:Si(p).name})}}return s}var c=r.getPackage(n.prefix);if(c){const u=ud(n,c),l=r.getType(u);if(s=ut(o.properties,function(f){return!f.isVirtual&&!f.isReference&&!f.isAttribute&&l.hasType(f.type)}),s)return L({},s,{effectiveType:Si(l).name})}else if(s=ut(o.properties,function(u){return!u.isReference&&!u.isAttribute&&u.type==="Element"}),s)return s;throw qi("unrecognized element <"+n.name+">")},hn.prototype.toString=function(){return"ElementDescriptor["+Si(this.type).name+"]"},hn.prototype.valueHandler=function(e,t){return new Iu(e,t)},hn.prototype.referenceHandler=function(e){return new Go(e,this.context)},hn.prototype.handler=function(e){return e==="Element"?new no(this.model,e,this.context):new hn(this.model,e,this.context)},hn.prototype.handleChild=function(e){var t,n,i,r;if(t=this.getPropertyForNode(e),i=this.element,n=t.effectiveType||t.type,Jf(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?(L(o,{element:i}),this.context.addReference(o)):o.$parent=i),r};function Nu(e,t,n){hn.call(this,e,t,n)}Nu.prototype=Object.create(hn.prototype),Nu.prototype.createElement=function(e){var t=e.name,n=an(t),i=this.model,r=this.type,o=i.getPackage(n.prefix),a=o&&ud(n,o)||t;if(!r.hasType(a))throw qi("unexpected element <"+e.originalName+">");return hn.prototype.createElement.call(this,e)};function no(e,t,n){this.model=e,this.context=n}no.prototype=Object.create(es.prototype),no.prototype.createElement=function(e){var t=e.name,n=an(t),i=n.prefix,r=e.ns[i+"$uri"],o=e.attributes;return this.model.createAny(t,r,o)},no.prototype.handleChild=function(e){var t=new no(this.model,"Element",this.context).handleNode(e),n=this.element,i=t.element,r;return i!==void 0&&(r=n.$children=n.$children||[],r.push(i),i.$parent=n),t},no.prototype.handleEnd=function(){this.body&&(this.element.$body=this.body)};function Bu(e){e instanceof zn&&(e={model:e}),L(this,{lax:!1},e)}Bu.prototype.fromXML=function(e,t,n){var i=t.rootHandler;t instanceof hn?(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 w0(L({},t,{rootHandler:i})),s=new od({proxy:!0}),c=E0();i.context=a,c.push(i);function u(S,M,N){var T=M(),H=T.line,V=T.column,$=T.data;$.charAt(0)==="<"&&$.indexOf(" ")!==-1&&($=$.slice(0,$.indexOf(" "))+">");var G="unparsable content "+($?$+" ":"")+`detected
1
+ (function(te,Pt){typeof exports=="object"&&typeof module<"u"?Pt(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],Pt):(te=typeof globalThis<"u"?globalThis:te||self,Pt(te.BpmnModeler={},te.Vue))})(this,(function(te,Pt){"use strict";var dD=Object.defineProperty;var hD=(te,Pt,Ri)=>Pt in te?dD(te,Pt,{enumerable:!0,configurable:!0,writable:!0,value:Ri}):te[Pt]=Ri;var Qr=(te,Pt,Ri)=>hD(te,typeof Pt!="symbol"?Pt+"":Pt,Ri);const Ri=["startEvent","endEvent","userTask","serviceTask","task","sendTask","receiveTask","exclusiveGateway","parallelGateway"];function Vf(e){return Ri.includes(e)}const Wf="http://g1project.net/spec/bpmn/bwl/1.0",wu="bwl",Eu=["top-left","top","top-right","right","bottom-right","bottom","bottom-left","left"],Uf={name:"bwl-hints",uri:Wf,prefix:wu,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"}]}]},Su="bwl.undoEpisode",Yf=new WeakSet;function Wx(e){Yf.has(e)||(e.register(Su,{preExecute(t){try{t.run()}catch(n){t.error=n}}}),Yf.add(e))}function qf(e,t){Wx(e);const n={run:t};if(e.execute(Su,n),n.error!==void 0)throw e.canUndo()&&e.undo(),n.error}const Kf=["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"],Ux={description:"생략 = 보존, null = 제거.",anyOf:[{type:"string"},{type:"null"}]},Yx={type:"object",description:"레인. 배열 선언 순서 = 풀 내 상→하 순서.",properties:{id:{type:"string"},name:{type:"string"}},required:["id"],additionalProperties:!1},qx={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},Kx={type:"object",description:"플로우 노드. 좌표는 지정하지 않는다 — 배치는 resolver 가 결정한다.",properties:{id:{type:"string"},type:{type:"string",enum:[...Ri]},name:{type:"string"},participant:{type:"string",description:"소속 풀 id(협업 문서)."},lane:{type:"string",description:"소속 레인 id(풀 정의에 선언된 것)."}},required:["id","type"],additionalProperties:!1},Xx={type:"object",description:"분기 조건 — 게이트웨이가 아닌 플로우에 붙인다. MVP 는 label 만.",properties:{label:{type:"string"}},required:["label"],additionalProperties:!1},Zx={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},Qx={type:"object",description:"메시지 플로우(풀 경계를 넘는 연결 — 노드 또는 블랙박스 풀 자체가 끝점).",properties:{id:{type:"string"},source:{type:"string"},target:{type:"string"},name:{type:"string"}},required:["id","source","target"],additionalProperties:!1},Jx={type:"object",properties:{id:{type:"string"},name:{type:"string"}},required:["id"],additionalProperties:!1},e0={type:"object",description:"데이터 입출력 연관. 방향 = source→target(태스크→스토어 = 쓰기, 스토어→태스크 = 읽기).",properties:{id:{type:"string"},source:{type:"string"},target:{type:"string"}},required:["source","target"],additionalProperties:!1},t0={type:"object",properties:{id:{type:"string"},text:{type:"string"}},required:["id","text"],additionalProperties:!1},n0={type:"object",description:"연관선(주석 ↔ 요소).",properties:{id:{type:"string"},source:{type:"string"},target:{type:"string"}},required:["source","target"],additionalProperties:!1},i0={type:"object",description:"그룹 — members(요소 id 목록)가 bwl:members 힌트로 기록되고 바운즈는 멤버 bbox 로 산출된다.",properties:{id:{type:"string"},name:{type:"string"},members:{type:"array",items:{type:"string"}}},required:["id"],additionalProperties:!1},r0={type:"object",description:"주석 방위 힌트 — 앵커 요소 기준 상대 배치. 있으면 결정적 배치, 없으면 휴리스틱.",properties:{anchor:{type:"string",description:"기준 요소 id."},side:{type:"string",enum:[...Eu]},offset:{type:"number",description:"앵커 가장자리 → 주석 가장자리 간격(px). 생략 시 50."}},required:["anchor","side"],additionalProperties:!1};function on(e,t){return{type:"object",description:t.description,properties:{kind:{const:e},...t.properties},required:["kind",...t.required??[]],additionalProperties:!1}}const o0={"participant.add":on("participant.add",{description:"풀 추가. order = 풀 세로 순서 힌트 — **작을수록 위**(생략 시 op 순서가 곧 배치 순서). 값은 상대 순서만 쓰므로 1,2,3… 연속이든 10,20,30 간격이든 같다.",properties:{participant:{$ref:"#/$defs/irParticipant"},order:{type:"integer"}},required:["participant"]}),"participant.update":on("participant.update",{description:"풀 이름/레인 갱신. lanes 는 전체 재선언(생략 = 보존) — 기존 레인을 유지하려면 함께 다시 나열한다.",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"},lanes:{type:"array",items:{$ref:"#/$defs/irLane"}}},required:["id"]}),"node.add":on("node.add",{description:'플로우 노드 추가. band = 가로 밴드 순번 힌트(주 흐름 0, 갈래 1, 2…) — 위/아래가 아니라 "주 흐름에서 몇 번째 갈래"다. 행 배치(어느 갈래가 위/아래인지)는 호스트가 정한다(대칭·메시지 방향). 레인이 있으면 그 레인 안의 밴드다 — 한 레인 안에서 게이트웨이 출구를 갈라 놓을 때 쓴다. 컨테이너(풀·레인)는 밴드 수만큼 자란다.',properties:{node:{$ref:"#/$defs/irNode"},band:{type:"integer",description:"0 이상 정수(음수는 payload-invalid 로 거부)."}},required:["node"]}),"node.update":on("node.update",{description:"노드 이름/레인/타입 갱신. lane = 레인 재배정(이동), type = 태스크·이벤트 타입 전환.",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"},lane:{type:"string"},type:{type:"string",enum:[...Ri]}},required:["id"]}),"sequenceFlow.add":on("sequenceFlow.add",{description:"시퀀스 플로우 추가. 분기 조건은 게이트웨이가 아닌 플로우의 condition 에 싣는다.",properties:{flow:{$ref:"#/$defs/irSequenceFlow"}},required:["flow"]}),"sequenceFlow.update":on("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":on("messageFlow.add",{description:"메시지 플로우 추가(풀 경계를 넘는 연결).",properties:{flow:{$ref:"#/$defs/irMessageFlow"}},required:["flow"]}),"messageFlow.update":on("messageFlow.update",{description:"메시지 플로우 이름 갱신.",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"}},required:["id"]}),"dataStore.add":on("dataStore.add",{description:"데이터 스토어 추가(+ 입출력 연관 동반 가능).",properties:{dataStore:{$ref:"#/$defs/irDataStore"},associations:{type:"array",items:{$ref:"#/$defs/irDataAssociation"}}},required:["dataStore"]}),"dataStore.update":on("dataStore.update",{description:"데이터 스토어 이름 갱신.",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"}},required:["id"]}),"dataAssociation.add":on("dataAssociation.add",{description:"기존 노드 ↔ 기존 데이터 스토어의 입출력 연관 추가.",properties:{association:{$ref:"#/$defs/irDataAssociation"}},required:["association"]}),"association.add":on("association.add",{description:"주석 ↔ 요소 연관 추가(한쪽 끝은 주석). 주석 신설과 함께면 annotation.add 의 association 을 쓰고, 이 op 는 추가 연관(한 주석에 여러 연관)용.",properties:{association:{$ref:"#/$defs/irAssociation"}},required:["association"]}),"annotation.add":on("annotation.add",{description:"텍스트 주석 추가. association 으로 대상 요소와 연결하고, placement 로 방위를 지정하면 결정적 배치된다.",properties:{annotation:{$ref:"#/$defs/irTextAnnotation"},association:{$ref:"#/$defs/irAssociation"},placement:{$ref:"#/$defs/bwlPlacement"}},required:["annotation"]}),"annotation.update":on("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":on("group.add",{description:"그룹 추가 — 바운즈는 members 의 bbox 로 산출되므로 좌표를 지정하지 않는다.",properties:{group:{$ref:"#/$defs/irGroup"}},required:["group"]}),"group.update":on("group.update",{description:"그룹 이름/멤버 갱신. members 는 전체 재선언(생략 = 보존).",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"},members:{type:"array",items:{type:"string"}}},required:["id"]}),"element.remove":on("element.remove",{description:"요소 제거(카테고리 무관). 부착된 연결선은 함께 제거된다.",properties:{id:{type:"string"}},required:["id"]})},Xf={anyOf:Kf.map(e=>o0[e])},a0={type:"object",description:"BPMN 문서에 요소를 추가·수정·삭제할 때 호출한다. 기존 요소는 describeProcess 가 노출하는 id 로 지정하고, 신규 요소 id 는 문서 내 유일한 XML NCName(공백 없이 문자/밑줄 시작)으로 짓는다. 좌표는 지정하지 않는다 — 배치는 서버가 결정하며, 필요하면 힌트(placement/band/order)로 의도만 전달하라.",properties:{ops:{type:"array",items:{$ref:"#/$defs/symbolicOp"}}},required:["ops"],additionalProperties:!1,$defs:{irLane:Yx,irParticipant:qx,irNode:Kx,irFlowCondition:Xx,irSequenceFlow:Zx,irMessageFlow:Qx,irDataStore:Jx,irDataAssociation:e0,irTextAnnotation:t0,irAssociation:n0,irGroup:i0,bwlPlacement:r0,nullableString:Ux,symbolicOp:Xf}};function Ru(e){return Array.prototype.concat.apply([],e)}const Vo=Object.prototype.toString,s0=Object.prototype.hasOwnProperty;function Rr(e){return e===void 0}function Ft(e){return e!==void 0}function Jr(e){return e==null}function we(e){return Vo.call(e)==="[object Array]"}function Ut(e){return Vo.call(e)==="[object Object]"}function Pe(e){return Vo.call(e)==="[object Number]"}function Yt(e){const t=Vo.call(e);return t==="[object Function]"||t==="[object AsyncFunction]"||t==="[object GeneratorFunction]"||t==="[object AsyncGeneratorFunction]"||t==="[object Proxy]"}function Sn(e){return Vo.call(e)==="[object String]"}function c0(e){if(!we(e))throw new Error("must supply array")}function Rn(e,t){return!Jr(e)&&s0.call(e,t)}function ut(e,t){const n=es(t);let i;return k(e,function(r,o){if(n(r,o))return i=r,!1}),i}function Zf(e,t){const n=es(t);let i=we(e)?-1:void 0;return k(e,function(r,o){if(n(r,o))return i=o,!1}),i}function Be(e,t){const n=es(t);let i=[];return k(e,function(r,o){n(r,o)&&i.push(r)}),i}function k(e,t){let n,i;if(Rr(e))return;const r=we(e)?d0:f0;for(let o in e)if(Rn(e,o)&&(n=e[o],i=t(n,r(o)),i===!1))return n}function u0(e,t){if(Rr(e))return[];c0(e);const n=es(t);return e.filter(function(i,r){return!n(i,r)})}function Cn(e,t,n){return k(e,function(i,r){n=t(n,i,r)}),n}function Cr(e,t){return!!Cn(e,function(n,i,r){return n&&t(i,r)},!0)}function Wi(e,t){return!!ut(e,t)}function an(e,t){let n=[];return k(e,function(i,r){n.push(t(i,r))}),n}function Ja(e){return e&&Object.keys(e)||[]}function l0(e){return Ja(e).length}function eo(e){return an(e,t=>t)}function to(e,t,n={}){return t=Cu(t),k(e,function(i){let r=t(i)||"_",o=n[r];o||(o=n[r]=[]),o.push(i)}),n}function Qf(e,...t){e=Cu(e);let n={};return k(t,r=>to(r,e,n)),an(n,function(r,o){return r[0]})}const p0=Qf;function oi(e,t){t=Cu(t);let n=[];return k(e,function(i,r){let o=t(i,r),a={d:o,v:i};for(var s=0;s<n.length;s++){let{d:c}=n[s];if(o<c){n.splice(s,0,a);return}}n.push(a)}),an(n,i=>i.v)}function no(e){return function(t){return Cr(e,function(n,i){return t[i]===n})}}function Cu(e){return Yt(e)?e:t=>t[e]}function es(e){return Yt(e)?e:t=>t===e}function f0(e){return e}function d0(e){return Number(e)}function Pu(e,t){let n,i,r,o;function a(f){let p=Date.now(),d=f?0:o+t-p;if(d>0)return s(d);e.apply(r,i),c()}function s(f){n=setTimeout(a,f)}function c(){n&&clearTimeout(n),n=o=i=r=void 0}function u(){n&&a(!0),c()}function l(...f){o=Date.now(),i=f,r=this,n||s(t)}return l.flush=u,l.cancel=c,l}function bn(e,t){return e.bind(t)}function I(e,...t){return Object.assign(e,...t)}function h0(e,t,n){let i=e;return k(t,function(r,o){if(typeof r!="number"&&typeof r!="string")throw new Error("illegal key type: "+typeof r+". Key should be of type number or string.");if(r==="constructor")throw new Error("illegal key: constructor");if(r==="__proto__")throw new Error("illegal key: __proto__");let a=t[o+1],s=i[r];Ft(a)&&Jr(s)&&(s=i[r]=isNaN(+a)?{}:[]),Rr(a)?Rr(n)?delete i[r]:i[r]=n:i=s}),e}function ni(e,t){let n={},i=Object(e);return k(t,function(r){r in i&&(n[r]=e[r])}),n}function ai(e,t){let n={},i=Object(e);return k(i,function(r,o){t.indexOf(o)===-1&&(n[o]=r)}),n}function Au(){}Au.prototype.get=function(e){return this.$model.properties.get(this,e)},Au.prototype.set=function(e,t){this.$model.properties.set(this,e,t)};function Jf(e,t){this.model=e,this.properties=t}Jf.prototype.createType=function(e){var t=this.model,n=this.properties,i=Object.create(Au.prototype);k(e.properties,function(a){!a.isMany&&a.default!==void 0&&(i[a.name]=a.default)}),n.defineModel(i,t),n.defineDescriptor(i,e);var r=e.ns.name;function o(a){n.define(this,"$type",{value:r,enumerable:!0}),n.define(this,"$attrs",{value:{}}),n.define(this,"$parent",{writable:!0}),k(a,bn(function(s,c){this.set(c,s)},this))}return o.prototype=i,o.hasType=i.$instanceOf=this.model.hasType,n.defineModel(o,t),n.defineDescriptor(o,e),o};var m0=I(Object.create(null),{String:!0,Boolean:!0,Integer:!0,Real:!0,Element:!0}),ed=I(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 Tu(e,t){var n=ed[e];return n?n(t):t}function Mu(e){return!!m0[e]}function td(e){return!!ed[e]}function sn(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 Nn(e){this.ns=e,this.name=e.name,this.allTypes=[],this.allTypesByName=Object.create(null),this.properties=[],this.propertiesByName=Object.create(null)}Nn.prototype.build=function(){return ni(this,["ns","name","allTypes","allTypesByName","properties","propertiesByName","bodyProperty","idProperty"])},Nn.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)},Nn.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},Nn.prototype.redefineProperty=function(e,t,n){var i=e.ns.prefix,r=t.split("#"),o=sn(r[0],i),a=sn(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},Nn.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},Nn.prototype.removeNamedProperty=function(e){var t=e.ns,n=this.propertiesByName;delete n[t.name],delete n[t.localName]},Nn.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},Nn.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},Nn.prototype.assertNotTrait=function(e){if((e.extends||[]).length)throw new Error(`cannot create <${e.name}> extending <${e.extends}>`)},Nn.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")},Nn.prototype.hasProperty=function(e){return this.propertiesByName[e]},Nn.prototype.addTrait=function(e,t){t&&this.assertNotTrait(e);var n=this.allTypesByName,i=this.allTypes,r=e.name;r in n||(k(e.properties,bn(function(o){o=I({},o,{name:o.ns.localName,inherited:t}),Object.defineProperty(o,"definedBy",{value:e});var a=o.replaces,s=o.redefines;a||s?this.redefineProperty(o,a||s,a):(o.isBody&&this.setBodyProperty(o),o.isId&&this.setIdProperty(o),this.addProperty(o))},this)),i.push(e),n[r]=e)};function Ui(e,t){this.packageMap=Object.create(null),this.typeMap=Object.create(null),this.packages=[],this.properties=t,k(e,bn(this.registerPackage,this))}Ui.prototype.getPackage=function(e){return this.packageMap[e]},Ui.prototype.getPackages=function(){return this.packages},Ui.prototype.registerPackage=function(e){e=I({},e);var t=this.packageMap;nd(t,e,"prefix"),nd(t,e,"uri"),k(e.types,bn(function(n){this.registerType(n,e)},this)),t[e.uri]=t[e.prefix]=e,this.packages.push(e)},Ui.prototype.registerType=function(e,t){e=I({},e,{superClass:(e.superClass||[]).slice(),extends:(e.extends||[]).slice(),properties:(e.properties||[]).slice(),meta:I({},e.meta||{})});var n=sn(e.name,t.prefix),i=n.name,r=Object.create(null);k(e.properties,bn(function(o){var a=sn(o.name,n.prefix),s=a.name;Mu(o.type)||(o.type=sn(o.type,a.prefix).name),I(o,{ns:a,name:s}),r[s]=o},this)),I(e,{ns:n,name:i,propertiesByName:r}),k(e.extends,bn(function(o){var a=sn(o,n.prefix),s=this.typeMap[a.name];s.traits=s.traits||[],s.traits.push(i)},this)),this.definePackage(e,t),this.typeMap[i]=e},Ui.prototype.mapTypes=function(e,t,n){var i=Mu(e.name)?{name:e.name}:this.typeMap[e.name],r=this;function o(c,u){var l=sn(c,Mu(c)?"":e.prefix);r.mapTypes(l,t,u)}function a(c){return o(c,!0)}function s(c){return o(c,!1)}if(!i)throw new Error("unknown type <"+e.name+">");k(i.superClass,n?a:s),t(i,!n),k(i.traits,a)},Ui.prototype.getEffectiveDescriptor=function(e){var t=sn(e),n=new Nn(t);this.mapTypes(t,function(r,o){n.addTrait(r,o)});var i=n.build();return this.definePackage(i,i.allTypes[i.allTypes.length-1].$pkg),i},Ui.prototype.definePackage=function(e,t){this.properties.define(e,"$pkg",{value:t})};function nd(e,t,n){var i=t[n];if(i in e)throw new Error("package with "+n+" <"+i+"> already defined")}function Pr(e){this.model=e}Pr.prototype.set=function(e,t,n){if(!Sn(t)||!t.length)throw new TypeError("property name must be a non-empty string");var i=this.getProperty(e,t),r=i&&i.name;g0(n)?i?delete e[r]:delete e.$attrs[ku(t)]:i?r in e?e[r]=n:id(e,i,n):e.$attrs[ku(t)]=n},Pr.prototype.get=function(e,t){var n=this.getProperty(e,t);if(!n)return e.$attrs[ku(t)];var i=n.name;return!e[i]&&n.isMany&&id(e,n,[]),e[i]},Pr.prototype.define=function(e,t,n){if(!n.writable){var i=n.value;n=I({},n,{get:function(){return i}}),delete n.value}Object.defineProperty(e,t,n)},Pr.prototype.defineDescriptor=function(e,t){this.define(e,"$descriptor",{value:t})},Pr.prototype.defineModel=function(e,t){this.define(e,"$model",{value:t})},Pr.prototype.getProperty=function(e,t){var n=this.model,i=n.getPropertyDescriptor(e,t);if(i)return i;if(t.includes(":"))return null;const r=n.config.strict;if(typeof r<"u"){const o=new TypeError(`unknown property <${t}> on <${e.$type}>`);if(r)throw o;typeof console<"u"&&console.warn(o)}return null};function g0(e){return typeof e>"u"}function id(e,t,n){Object.defineProperty(e,t.name,{enumerable:!t.isReference,writable:!0,value:n,configurable:!0})}function ku(e){return e.replace(/^:/,"")}function Fn(e,t={}){this.properties=new Pr(this),this.factory=new Jf(this,this.properties),this.registry=new Ui(e,this.properties),this.typeCache=Object.create(null),this.config=t}Fn.prototype.create=function(e,t){var n=this.getType(e);if(!n)throw new Error("unknown type <"+e+">");return new n(t)},Fn.prototype.getType=function(e){var t=this.typeCache,n=Sn(e)?e:e.ns.name,i=t[n];return i||(e=this.registry.getEffectiveDescriptor(n),i=t[n]=this.factory.createType(e)),i},Fn.prototype.createAny=function(e,t,n){var i=sn(e),r={$type:e,$instanceOf:function(a){return a===this.$type},get:function(a){return this[a]},set:function(a,s){h0(this,[a],s)}},o={name:e,isGeneric:!0,ns:{prefix:i.prefix,localName:i.localName,uri:t}};return this.properties.defineDescriptor(r,o),this.properties.defineModel(r,this),this.properties.define(r,"get",{enumerable:!1,writable:!0}),this.properties.define(r,"set",{enumerable:!1,writable:!0}),this.properties.define(r,"$parent",{enumerable:!1,writable:!0}),this.properties.define(r,"$instanceOf",{enumerable:!1,writable:!0}),k(n,function(a,s){Ut(a)&&a.value!==void 0?r[a.name]=a.value:r[s]=a}),r},Fn.prototype.getPackage=function(e){return this.registry.getPackage(e)},Fn.prototype.getPackages=function(){return this.registry.getPackages()},Fn.prototype.getElementDescriptor=function(e){return e.$descriptor},Fn.prototype.hasType=function(e,t){t===void 0&&(t=e,e=this);var n=e.$model.getElementDescriptor(e);return t in n.allTypesByName},Fn.prototype.getPropertyDescriptor=function(e,t){return this.getElementDescriptor(e).propertiesByName[t]},Fn.prototype.getTypeDescriptor=function(e){return this.registry.typeMap[e]};var rd=String.fromCharCode,y0=Object.prototype.hasOwnProperty,v0=/&#(\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 _0(e,t,n,i){return i?y0.call(Wo,i)?Wo[i]:"&"+i+";":rd(t||parseInt(n,16))}function Ar(e){return e.length>3&&e.indexOf("&")!==-1?e.replace(v0,_0):e}var od="non-whitespace outside of root node";function Yi(e){return new Error(e)}function b0(e){return"missing namespace for prefix <"+e+">"}function ts(e){return{get:e,enumerable:!0}}function x0(e){var t=Object.create(null),n;for(n in e)t[n]=e[n];return t}var ad=Symbol("nameCache");function Ou(e){return e+"$uri"}function w0(e){var t=Object.create(null),n,i;for(n in e)i=e[n],t[i]=i,t[Ou(i)]=n;return t}function ns(){return{line:0,column:0}}function E0(e){throw e}function sd(e){if(!this)return new sd(e);var t=e&&e.proxy,n,i,r,o,a=E0,s,c,u,l,f=ns,p=!1,d=!1,h="",m=!1,g=!1,R=null,E=!1,x,w,S,M;function N($){$ instanceof Error||($=Yi($)),R=$,a($,f)}function T($){s&&($ instanceof Error||($=Yi($)),s($,f))}this.on=function($,V){if(typeof V!="function")throw Yi("required args <name, cb>");switch($){case"openTag":i=V;break;case"text":n=V;break;case"closeTag":r=V;break;case"error":a=V;break;case"warn":s=V;break;case"cdata":o=V;break;case"attention":l=V;break;case"question":u=V;break;case"comment":c=V;break;default:throw Yi("unsupported event: "+$)}return this},this.ns=function($){if(typeof $>"u"&&($={}),typeof $!="object")throw Yi("required args <nsMap={}>");var V=Object.create(null),de;for(de in $)V[de]=$[de];return g=!0,M=V,this};function H(){x=g?[]:null,w=g?w0(M):null,S=[],f=ns,E=!1,R=null,d=!1,h=""}this.parse=function($){if(typeof $!="string")throw Yi("required args <xml=string>");if(p)throw Yi("parse during stream; call end() first");return H(),G($),f=ns,E=!1,R},this.write=function($){if(typeof $!="string")throw Yi("required args <xml=string>");return p||(H(),p=!0),R||(h=G(h+$,!0)||""),this},this.end=function(){return p||H(),p=!1,R||G(h),h="",f=ns,E=!1,R},this.stop=function(){E=!0};function G($,V=!1){var de=null,Ge=null,ft,q=0,he=!1,ge=!1,pe=0,fe=0,ne,z,F,Y,Le,Nt,P,_,y,D="",B=0,W;function le(it,Bt){var pn=it.indexOf(":");if(pn===-1)return it;var fn=w[it.substring(0,pn)];return fn?Bt===fn?it.substr(pn+1):fn+it.substr(pn):(T(b0(it.substring(0,pn))),null)}function ke(){if(W!==null)return W;var it,Bt,pn=g&&w.xmlns,fn=g&&m?[]:null,ct=B,$t=D,dn=$t.length,zo,ei,Ei,hn,vt,Si={},Kr=new Set,En,Qe,et;e:for(;ct<dn;ct++)if(En=!1,Qe=$t.charCodeAt(ct),!(Qe===32||Qe<14&&Qe>8)){for((Qe<65||Qe>122||Qe>90&&Qe<97)&&Qe!==95&&Qe!==58&&(T("illegal first char attribute name"),En=!0),et=ct+1;et<dn;et++)if(Qe=$t.charCodeAt(et),!(Qe>96&&Qe<123||Qe>64&&Qe<91||Qe>47&&Qe<59||Qe===46||Qe===45||Qe===95)){if(Qe===32||Qe<14&&Qe>8){T("missing attribute value"),ct=et;continue e}if(Qe===61)break;T("illegal attribute name char"),En=!0}if(vt=$t.substring(ct,et),vt==="xmlns:xmlns"&&(T("illegal declaration of xmlns"),En=!0),Qe=$t.charCodeAt(et+1),Qe===34)et=$t.indexOf('"',ct=et+2),et===-1&&(et=$t.indexOf("'",ct),et!==-1&&(T("attribute value quote missmatch"),En=!0));else if(Qe===39)et=$t.indexOf("'",ct=et+2),et===-1&&(et=$t.indexOf('"',ct),et!==-1&&(T("attribute value quote missmatch"),En=!0));else for(T("missing attribute value quotes"),En=!0,et=et+1;et<dn&&(Qe=$t.charCodeAt(et+1),!(Qe===32||Qe<14&&Qe>8));et++);for(et===-1&&(T("missing closing quotes"),et=dn,En=!0),En||(Ei=$t.substring(ct,et)),ct=et;et+1<dn&&(Qe=$t.charCodeAt(et+1),!(Qe===32||Qe<14&&Qe>8));et++)ct===et&&(T("illegal character after attribute end"),En=!0);if(ct=et+1,En)continue e;if(Kr.has(vt)){T("attribute <"+vt+"> already defined");continue}if(Kr.add(vt),!g){Si[vt]=Ei;continue}if(m){if(ei=vt==="xmlns"?"xmlns":vt.charCodeAt(0)===120&&vt.substr(0,6)==="xmlns:"?vt.substr(6):null,ei!==null){if(it=Ar(Ei),Bt=Ou(ei),hn=M[it],!hn){if(ei==="xmlns"||Bt in w&&w[Bt]!==it)do hn="ns"+q++;while(typeof w[hn]<"u");else hn=ei;M[it]=hn}w[ei]!==hn&&(zo||(w=x0(w),zo=!0),w[ei]=hn,ei==="xmlns"&&(w[Ou(hn)]=it,pn=hn),w[Bt]=it),Si[vt]=Ei;continue}fn.push(vt,Ei);continue}vt=le(vt,pn),vt!==null&&(Si[vt]=Ei)}if(m)for(ct=0,dn=fn.length;ct<dn;ct++)vt=le(fn[ct++],pn),Ei=fn[ct],vt!==null&&(Si[vt]=Ei);return W=Si}function Ke(){for(var it=/(\r\n|\r|\n)/g,Bt=0,pn=0,fn=0,ct=fe,$t,dn;pe>=fn&&($t=it.exec($),!(!$t||(ct=$t[0].length+$t.index,ct>pe)));)Bt+=1,fn=ct;return pe==-1?(pn=ct,dn=$.substring(fe)):fe===0?dn=$.substring(fe,pe):(pn=pe-fn,dn=fe==-1?$.substring(pe):$.substring(pe,fe+1)),{data:dn,line:Bt,column:pn}}for(f=Ke,t&&(y=Object.create({},{name:ts(function(){return P}),originalName:ts(function(){return _}),attrs:ts(ke),ns:ts(function(){return w})}));fe!==-1;){if($.charCodeAt(fe)===60?pe=fe:pe=$.indexOf("<",fe),pe===-1){if(V)return $.substring(fe);if(S.length)return N("unexpected end of file");if(!d)return N("missing start tag");fe<$.length&&$.substring(fe).trim()&&T(od);return}if(d||(d=!0),fe!==pe){if(S.length){if(n&&(n($.substring(fe,pe),Ar,f),E))return}else if($.substring(fe,pe).trim()&&(T(od),E))return}if(Y=$.charCodeAt(pe+1),Y===33){if(F=$.charCodeAt(pe+2),F===91&&$.substr(pe+3,6)==="CDATA["){if(fe=$.indexOf("]]>",pe),fe===-1)return V?$.substring(pe):N("unclosed cdata");if(o&&(o($.substring(pe+9,fe),f),E))return;fe+=3;continue}if(F===45&&$.charCodeAt(pe+3)===45){if(fe=$.indexOf("-->",pe),fe===-1)return V?$.substring(pe):N("unclosed comment");if(c&&(c($.substring(pe+4,fe),Ar,f),E))return;fe+=3;continue}}if(Y===63){if(fe=$.indexOf("?>",pe),fe===-1)return V?$.substring(pe):N("unclosed question");if(u&&(u($.substring(pe,fe+2),f),E))return;fe+=2;continue}for(ne=pe+1;;ne++){if(Le=$.charCodeAt(ne),isNaN(Le))return V?$.substring(pe):(fe=-1,N("unclosed tag"));if(Le===34)F=$.indexOf('"',ne+1),ne=F!==-1?F:ne;else if(Le===39)F=$.indexOf("'",ne+1),ne=F!==-1?F:ne;else if(Le===62){fe=ne;break}}if(Y===33){if(l&&(l($.substring(pe,fe+1),Ar,f),E))return;fe+=1;continue}if(W={},Y===47){if(he=!1,ge=!0,!S.length)return N("missing open tag");if(ne=P=S.pop(),F=pe+2+ne.length,$.substring(pe+2,F)!==ne)return N("closing tag mismatch");for(;F<fe;F++)if(Y=$.charCodeAt(F),!(Y===32||Y>8&&Y<14))return N("close tag")}else{if($.charCodeAt(fe-1)===47?(ne=P=$.substring(pe+1,fe-1),he=!0,ge=!0):(ne=P=$.substring(pe+1,fe),he=!0,ge=!1),!(Y>96&&Y<123||Y>64&&Y<91||Y===95||Y===58))return N("illegal first char nodeName");for(F=1,z=ne.length;F<z;F++)if(Y=ne.charCodeAt(F),!(Y>96&&Y<123||Y>64&&Y<91||Y>47&&Y<59||Y===45||Y===95||Y==46)){if(Y===32||Y<14&&Y>8){P=ne.substring(0,F),W=null;break}return N("invalid nodeName")}ge||S.push(P)}if(g){ft=w,he&&(ge||x.push(ft),W===null&&(m=ne.indexOf("xmlns",F)!==-1)&&(B=F,D=ne,ke(),m=!1)),_=P,Ge!==w&&(de=w[ad],de===void 0&&(de=w[ad]=Object.create(null)),Ge=w);var lt=de[P];if(lt!==void 0)P=lt;else{if(Y=P.indexOf(":"),Y!==-1){if(Nt=w[P.substring(0,Y)],!Nt)return N("missing namespace on <"+_+">");P=P.substr(Y+1)}else Nt=w.xmlns;Nt&&(P=Nt+":"+P),de[_]=P}}if(he&&(B=F,D=ne,i&&(t?i(y,Ar,ge,f):i(P,ke,Ar,ge,f),E)))return;if(ge){if(r&&(r(t?y:P,Ar,he,f),E))return;g&&(he?w=ft:w=x.pop())}fe+=1}}}function cd(e){return e.xml&&e.xml.tagAlias==="lowerCase"}var Du={xsi:"http://www.w3.org/2001/XMLSchema-instance",xml:"http://www.w3.org/XML/1998/namespace"},ud="property";function ld(e){return e.xml&&e.xml.serialize}function S0(e){const t=ld(e);return t!==ud&&(t||null)}function R0(e){return e.charAt(0).toUpperCase()+e.slice(1)}function pd(e,t){return cd(t)?e.prefix+":"+R0(e.localName):e.name}function C0(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 P0(e,t,n){const i=sn(e,t.xmlns),r=`${t[i.prefix]||i.prefix}:${i.localName}`,o=sn(r);var a=n.getPackage(o.prefix);return C0(o,a)}function qi(e){return new Error(e)}function Ci(e){return e.$descriptor}function A0(e){I(this,e),this.elementsById={},this.references=[],this.warnings=[],this.addReference=function(t){this.references.push(t)},this.addElement=function(t){if(!t)throw qi("expected element");var n=this.elementsById,i=Ci(t),r=i.idProperty,o;if(r&&(o=t.get(r.name),o)){if(!/^([a-z][\w-.]*:)?[a-z_][\w-.]*$/i.test(o))throw new Error("illegal ID <"+o+">");if(n[o])throw qi("duplicate ID <"+o+">");n[o]=t}},this.addWarning=function(t){this.warnings.push(t)}}function Uo(){}Uo.prototype.handleEnd=function(){},Uo.prototype.handleText=function(){},Uo.prototype.handleNode=function(){};function Lu(){}Lu.prototype=Object.create(Uo.prototype),Lu.prototype.handleNode=function(){return this};function io(){}io.prototype=Object.create(Uo.prototype),io.prototype.handleText=function(e){this.body=(this.body||"")+e};function Yo(e,t){this.property=e,this.context=t}Yo.prototype=Object.create(io.prototype),Yo.prototype.handleNode=function(e){if(this.element)throw qi("expected no sub nodes");return this.element=this.createReference(e),this},Yo.prototype.handleEnd=function(){this.element.id=this.body},Yo.prototype.createReference=function(e){return{property:this.property.ns.name,id:""}};function Iu(e,t){this.element=t,this.propertyDesc=e}Iu.prototype=Object.create(io.prototype),Iu.prototype.handleEnd=function(){var e=this.body||"",t=this.element,n=this.propertyDesc;e=Tu(n.type,e),n.isMany?t.get(n.name).push(e):t.set(n.name,e)};function is(){}is.prototype=Object.create(io.prototype),is.prototype.handleNode=function(e){var t=this,n=this.element;return n?t=this.handleChild(e):(n=this.element=this.createElement(e),this.context.addElement(n)),t};function mn(e,t,n){this.model=e,this.type=e.getType(t),this.context=n}mn.prototype=Object.create(is.prototype),mn.prototype.addReference=function(e){this.context.addReference(e)},mn.prototype.handleText=function(e){var t=this.element,n=Ci(t),i=n.bodyProperty;if(!i)throw qi("unexpected body text <"+e+">");io.prototype.handleText.call(this,e)},mn.prototype.handleEnd=function(){var e=this.body,t=this.element,n=Ci(t),i=n.bodyProperty;i&&e!==void 0&&(e=Tu(i.type,e),t.set(i.name,e))},mn.prototype.createElement=function(e){var t=e.attributes,n=this.type,i=Ci(n),r=this.context,o=new n({}),a=this.model,s;return k(t,function(c,u){var l=i.propertiesByName[u],f;l&&l.isReference?l.isMany?(f=c.split(" "),k(f,function(p){r.addReference({element:o,property:l.ns.name,id:p})})):r.addReference({element:o,property:l.ns.name,id:c}):(l?c=Tu(l.type,c):u==="xmlns"?u=":"+u:(s=sn(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},mn.prototype.getPropertyForNode=function(e){var t=e.name,n=sn(t),i=this.type,r=this.model,o=Ci(i),a=n.name,s=o.propertiesByName[a];if(s&&!s.isAttr){const u=S0(s);if(u){const l=e.attributes[u];if(l){const f=P0(l,e.ns,r),p=r.getType(f);return I({},s,{effectiveType:Ci(p).name})}}return s}var c=r.getPackage(n.prefix);if(c){const u=pd(n,c),l=r.getType(u);if(s=ut(o.properties,function(f){return!f.isVirtual&&!f.isReference&&!f.isAttribute&&l.hasType(f.type)}),s)return I({},s,{effectiveType:Ci(l).name})}else if(s=ut(o.properties,function(u){return!u.isReference&&!u.isAttribute&&u.type==="Element"}),s)return s;throw qi("unrecognized element <"+n.name+">")},mn.prototype.toString=function(){return"ElementDescriptor["+Ci(this.type).name+"]"},mn.prototype.valueHandler=function(e,t){return new Iu(e,t)},mn.prototype.referenceHandler=function(e){return new Yo(e,this.context)},mn.prototype.handler=function(e){return e==="Element"?new ro(this.model,e,this.context):new mn(this.model,e,this.context)},mn.prototype.handleChild=function(e){var t,n,i,r;if(t=this.getPropertyForNode(e),i=this.element,n=t.effectiveType||t.type,td(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?(I(o,{element:i}),this.context.addReference(o)):o.$parent=i),r};function Nu(e,t,n){mn.call(this,e,t,n)}Nu.prototype=Object.create(mn.prototype),Nu.prototype.createElement=function(e){var t=e.name,n=sn(t),i=this.model,r=this.type,o=i.getPackage(n.prefix),a=o&&pd(n,o)||t;if(!r.hasType(a))throw qi("unexpected element <"+e.originalName+">");return mn.prototype.createElement.call(this,e)};function ro(e,t,n){this.model=e,this.context=n}ro.prototype=Object.create(is.prototype),ro.prototype.createElement=function(e){var t=e.name,n=sn(t),i=n.prefix,r=e.ns[i+"$uri"],o=e.attributes;return this.model.createAny(t,r,o)},ro.prototype.handleChild=function(e){var t=new ro(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},ro.prototype.handleEnd=function(){this.body&&(this.element.$body=this.body)};function Bu(e){e instanceof Fn&&(e={model:e}),I(this,{lax:!1},e)}Bu.prototype.fromXML=function(e,t,n){var i=t.rootHandler;t instanceof mn?(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 A0(I({},t,{rootHandler:i})),s=new sd({proxy:!0}),c=T0();i.context=a,c.push(i);function u(S,M,N){var T=M(),H=T.line,G=T.column,$=T.data;$.charAt(0)==="<"&&$.indexOf(" ")!==-1&&($=$.slice(0,$.indexOf(" "))+">");var V="unparsable content "+($?$+" ":"")+`detected
2
2
  line: `+H+`
3
- column: `+V+`
4
- nested error: `+S.message;if(N)return a.addWarning({message:G,error:S}),!0;throw qi(G)}function l(S,M){return u(S,M,!0)}function f(){var S=a.elementsById,M=a.references,N,T;for(N=0;T=M[N];N++){var H=T.element,V=S[T.id],$=Si(H).propertiesByName[T.property];if(V||a.addWarning({message:"unresolved reference <"+T.id+">",element:T.element,property:T.property,value:T.id}),$.isMany){var G=H.get($.name),he=G.indexOf(T);he===-1&&(he=G.length),V?G[he]=V:G.splice(he,1)}else H.set($.name,V)}}function p(){c.pop().handleEnd()}var d=/^<\?xml /i,h=/ encoding="([^"]+)"/i,m=/^utf-8$/i;function g(S){if(d.test(S)){var M=h.exec(S),N=M&&M[1];!N||m.test(N)||a.addWarning({message:"unsupported document encoding <"+N+">, falling back to UTF-8"})}}function R(S,M){var N=c.peek();try{c.push(N.handleNode(S))}catch(T){u(T,M,o)&&c.push(new Lu)}}function w(S,M){try{c.peek().handleText(S)}catch(N){l(N,M)}}function b(S,M){S.trim()&&w(S,M)}var x=r.getPackages().reduce(function(S,M){return S[M.uri]=M.prefix,S},Object.entries(Ou).reduce(function(S,[M,N]){return S[N]=M,S},r.config&&r.config.nsMap||{}));return s.ns(x).on("openTag",function(S,M,N,T){var H=S.attrs||{},V=Object.keys(H).reduce(function(G,he){var Fe=M(H[he]);return G[he]=Fe,G},{}),$={name:S.name,originalName:S.originalName,attributes:V,ns:S.ns};R($,T)}).on("question",g).on("closeTag",p).on("cdata",w).on("text",function(S,M,N){b(M(S),N)}).on("error",u).on("warn",l),new Promise(function(S,M){var N;try{s.parse(e),f()}catch(G){N=G}var T=i.element;!N&&!T&&(N=qi("failed to parse document as <"+i.type.$descriptor.name+">"));var H=a.warnings,V=a.references,$=a.elementsById;return N?(N.warnings=H,M(N)):S({rootElement:T,elementsById:$,references:V,warnings:H})})},Bu.prototype.handler=function(e){return new Nu(this.model,e)};function E0(){var e=[];return Object.defineProperty(e,"peek",{value:function(){return this[this.length-1]}}),e}var S0=`<?xml version="1.0" encoding="UTF-8"?>
5
- `,R0=/<|>|'|"|&|\n\r|\n/g,ld=/<|>|&/g;function ci(e){this.prefixMap={},this.uriMap={},this.used={},this.wellknown=[],this.custom=[],this.parent=e,this.defaultPrefixMap=e&&e.defaultPrefixMap||{}}ci.prototype.mapDefaultPrefixes=function(e){this.defaultPrefixMap=e},ci.prototype.defaultUriByPrefix=function(e){return this.defaultPrefixMap[e]},ci.prototype.byUri=function(e){return this.uriMap[e]||this.parent&&this.parent.byUri(e)},ci.prototype.add=function(e,t){this.uriMap[e.uri]=e,t?this.wellknown.push(e):this.custom.push(e),this.mapPrefix(e.prefix,e.uri)},ci.prototype.uriByPrefix=function(e){return this.prefixMap[e||"xmlns"]||this.parent&&this.parent.uriByPrefix(e)},ci.prototype.mapPrefix=function(e,t){this.prefixMap[e||"xmlns"]=t},ci.prototype.getNSKey=function(e){return e.prefix!==void 0?e.uri+"|"+e.prefix:e.uri},ci.prototype.logUsed=function(e){var t=e.uri,n=this.getNSKey(e);this.used[n]=this.byUri(t),this.parent&&this.parent.logUsed(e)},ci.prototype.getUsed=function(e){var t=[].concat(this.wellknown,this.custom);return t.filter(n=>{var i=this.getNSKey(n);return this.used[i]})};function C0(e){return e.charAt(0).toLowerCase()+e.slice(1)}function P0(e,t){return ad(t)?C0(e):e}function pd(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})}function fd(e){return wn(e)?e:(e.prefix?e.prefix+":":"")+e.localName}function A0(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 T0(e,t){return t.isGeneric?L({localName:t.ns.localName},e):L({localName:P0(t.ns.localName,t.$pkg)},e)}function M0(e,t){return L({localName:t.ns.localName},e)}function k0(e){var t=e.$descriptor;return Ie(t.properties,function(n){var i=n.name;if(n.isVirtual||!En(e,i))return!1;var r=e[i];return r===n.default||r===null?!1:n.isMany?r.length:!0})}var D0={"\n":"#10","\n\r":"#10",'"':"#34","'":"#39","<":"#60",">":"#62","&":"#38"},O0={"<":"lt",">":"gt","&":"amp"};function dd(e,t,n){return e=wn(e)?e:""+e,e.replace(t,function(i){return"&"+n[i]+";"})}function L0(e){return dd(e,R0,D0)}function I0(e){return dd(e,ld,O0)}function N0(e){return Ie(e,function(t){return t.isAttr})}function B0(e){return Ie(e,function(t){return!t.isAttr})}function $u(e){this.tagName=e}$u.prototype.build=function(e){return this.element=e,this},$u.prototype.serializeTo=function(e){e.appendIndent().append("<"+this.tagName+">"+this.element.id+"</"+this.tagName+">").appendNewLine()};function Tr(){}Tr.prototype.serializeValue=Tr.prototype.serializeTo=function(e){e.append(this.escape?I0(this.value):this.value)},Tr.prototype.build=function(e,t){return this.value=t,e.type==="String"&&t.search(ld)!==-1&&(this.escape=!0),this};function ju(e){this.tagName=e}pd(ju,Tr),ju.prototype.serializeTo=function(e){e.appendIndent().append("<"+this.tagName+">"),this.serializeValue(e),e.append("</"+this.tagName+">").appendNewLine()};function dt(e,t){this.body=[],this.attrs=[],this.parent=e,this.propertyDescriptor=t}dt.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=k0(e),this.parseAttributes(N0(r)),this.parseContainments(B0(r))),this.parseGenericAttributes(e,i),this},dt.prototype.nsTagName=function(e){var t=this.logNamespaceUsed(e.ns);return T0(t,e)},dt.prototype.nsPropertyTagName=function(e){var t=this.logNamespaceUsed(e.ns);return M0(t,e)},dt.prototype.isLocalNs=function(e){return e.uri===this.ns.uri},dt.prototype.nsAttributeName=function(e){var t;if(wn(e)?t=an(e):t=e.ns,e.inherited)return{localName:t.localName};var n=this.logNamespaceUsed(t);return this.getNamespaces().logUsed(n),this.isLocalNs(n)?{localName:t.localName}:L({localName:t.localName},n)},dt.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}))},dt.prototype.parseGenericContainments=function(e){var t=e.$body;t&&this.body.push(new Tr().build({type:"String"},t));var n=e.$children;n&&k(n,i=>{this.body.push(new dt(this).build(i))})},dt.prototype.parseNsAttribute=function(e,t,n){var i=e.$model,r=an(t),o;if(r.prefix==="xmlns"&&(o={prefix:r.localName,uri:n}),!r.prefix&&r.localName==="xmlns"&&(o={uri:n}),!o)return{name:t,value:n};if(i&&i.getPackage(n))this.logNamespace(o,!0,!0);else{var a=this.logNamespaceUsed(o,!0);this.getNamespaces().logUsed(a)}},dt.prototype.parseNsAttributes=function(e){var t=this,n=e.$attrs,i=[];return k(n,function(r,o){var a=t.parseNsAttribute(e,o,r);a&&i.push(a)}),i},dt.prototype.parseGenericAttributes=function(e,t){var n=this;k(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)}})},dt.prototype.parseContainments=function(e){var t=this,n=this.body,i=this.element;k(e,function(r){var o=i.get(r.name),a=r.isReference,s=r.isMany;if(s||(o=[o]),r.isBody)n.push(new Tr().build(r,o[0]));else if(Jf(r.type))k(o,function(u){n.push(new ju(t.addTagName(t.nsPropertyTagName(r))).build(r,u))});else if(a)k(o,function(u){n.push(new $u(t.addTagName(t.nsPropertyTagName(r))).build(u))});else{var c=cd(r);k(o,function(u){var l;c?c===sd?l=new dt(t,r):l=new ts(t,r,c):l=new dt(t),n.push(l.build(u))})}})},dt.prototype.getNamespaces=function(e){var t=this.namespaces,n=this.parent,i;return t||(i=n&&n.getNamespaces(),e||!i?this.namespaces=t=new ci(i):t=i),t},dt.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},dt.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},dt.prototype.parseAttributes=function(e){var t=this,n=this.element;k(e,function(i){var r=n.get(i.name);if(i.isReference)if(!i.isMany)r=r.id;else{var o=[];k(r,function(a){o.push(a.id)}),r=o.join(" ")}t.addAttribute(t.nsAttributeName(i),r)})},dt.prototype.addTagName=function(e){var t=this.logNamespaceUsed(e);return this.getNamespaces().logUsed(t),fd(e)},dt.prototype.addAttribute=function(e,t){var n=this.attrs;wn(t)&&(t=L0(t));var i=Kf(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)},dt.prototype.serializeAttributes=function(e){var t=this.attrs,n=this.namespaces;n&&(t=A0(n).concat(t)),k(t,function(i){e.append(" ").append(fd(i.name)).append('="').append(i.value).append('"')})},dt.prototype.serializeTo=function(e){var t=this.body[0],n=t&&t.constructor!==Tr;e.appendIndent().append("<"+this.tagName),this.serializeAttributes(e),e.append(t?">":" />"),t&&(n&&e.appendNewLine().indent(),k(this.body,function(i){i.serializeTo(e)}),n&&e.unindent().appendIndent(),e.append("</"+this.tagName+">")),e.appendNewLine()};function ts(e,t,n){dt.call(this,e,t),this.serialization=n}pd(ts,dt),ts.prototype.parseNsAttributes=function(e){var t=dt.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},ts.prototype.isLocalNs=function(e){return e.uri===(this.typeNs||this.ns).uri};function $0(){this.value="",this.write=function(e){this.value+=e}}function j0(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 F0(e){e=L({format:!1,preamble:!0},e||{});function t(n,i){var r=i||new $0,o=new j0(r,e.format);e.preamble&&o.append(S0);var a=new dt,s=n.$model;if(a.getNamespaces().mapDefaultPrefixes(H0(s)),a.build(n).serializeTo(o),!i)return r.value}return{toXML:t}}function H0(e){const t=e.config&&e.config.nsMap||{},n={};for(const i in Ou)n[i]=Ou[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 ns(e,t){zn.call(this,e,t)}ns.prototype=Object.create(zn.prototype),ns.prototype.fromXML=function(e,t,n){wn(t)||(n=t,t="bpmn:Definitions");var i=new Bu(L({model:this,lax:!0},n)),r=i.handler(t);return i.fromXML(e,r)},ns.prototype.toXML=function(e,t){var n=new F0(t);return new Promise(function(i,r){try{var o=n.toXML(e);return i({xml:o})}catch(a){return r(a)}})};var z0="BPMN20",V0="http://www.omg.org/spec/BPMN/20100524/MODEL",G0="bpmn",W0=[],U0=[{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"}]}],Y0=[{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"}]}],q0={tagAlias:"lowerCase",typePrefix:"t"},K0={name:z0,uri:V0,prefix:G0,associations:W0,types:U0,enumerations:Y0,xml:q0},X0="BPMNDI",Z0="http://www.omg.org/spec/BPMN/20100524/DI",Q0="bpmndi",J0=[{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"]}],ew=[{name:"ParticipantBandKind",literalValues:[{name:"top_initiating"},{name:"middle_initiating"},{name:"bottom_initiating"},{name:"top_non_initiating"},{name:"middle_non_initiating"},{name:"bottom_non_initiating"}]},{name:"MessageVisibleKind",literalValues:[{name:"initiating"},{name:"non_initiating"}]}],tw=[],nw={name:X0,uri:Z0,prefix:Q0,types:J0,enumerations:ew,associations:tw},iw="DC",rw="http://www.omg.org/spec/DD/20100524/DC",ow="dc",aw=[{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}]}],sw=[],cw={name:iw,uri:rw,prefix:ow,types:aw,associations:sw},uw="DI",lw="http://www.omg.org/spec/DD/20100524/DI",pw="di",fw=[{name:"DiagramElement",isAbstract:!0,properties:[{name:"id",isAttr:!0,isId:!0,type:"String"},{name:"extension",type:"Extension"},{name:"owningDiagram",type:"Diagram",isReadOnly:!0,isVirtual:!0,isReference:!0},{name:"owningElement",type:"DiagramElement",isReadOnly:!0,isVirtual:!0,isReference:!0},{name:"modelElement",isReadOnly:!0,isVirtual:!0,isReference:!0,type:"Element"},{name:"style",type:"Style",isReadOnly:!0,isVirtual:!0,isReference:!0},{name:"ownedElement",type:"DiagramElement",isReadOnly:!0,isMany:!0,isVirtual:!0}]},{name:"Node",isAbstract:!0,superClass:["DiagramElement"]},{name:"Edge",isAbstract:!0,superClass:["DiagramElement"],properties:[{name:"source",type:"DiagramElement",isReadOnly:!0,isVirtual:!0,isReference:!0},{name:"target",type:"DiagramElement",isReadOnly:!0,isVirtual:!0,isReference:!0},{name:"waypoint",isUnique:!1,isMany:!0,type:"dc:Point",xml:{serialize:"xsi:type"}}]},{name:"Diagram",isAbstract:!0,properties:[{name:"id",isAttr:!0,isId:!0,type:"String"},{name:"rootElement",type:"DiagramElement",isReadOnly:!0,isVirtual:!0},{name:"name",isAttr:!0,type:"String"},{name:"documentation",isAttr:!0,type:"String"},{name:"resolution",isAttr:!0,type:"Real"},{name:"ownedStyle",type:"Style",isReadOnly:!0,isMany:!0,isVirtual:!0}]},{name:"Shape",isAbstract:!0,superClass:["Node"],properties:[{name:"bounds",type:"dc:Bounds"}]},{name:"Plane",isAbstract:!0,superClass:["Node"],properties:[{name:"planeElement",type:"DiagramElement",subsettedProperty:"DiagramElement-ownedElement",isMany:!0}]},{name:"LabeledEdge",isAbstract:!0,superClass:["Edge"],properties:[{name:"ownedLabel",type:"Label",isReadOnly:!0,subsettedProperty:"DiagramElement-ownedElement",isMany:!0,isVirtual:!0}]},{name:"LabeledShape",isAbstract:!0,superClass:["Shape"],properties:[{name:"ownedLabel",type:"Label",isReadOnly:!0,subsettedProperty:"DiagramElement-ownedElement",isMany:!0,isVirtual:!0}]},{name:"Label",isAbstract:!0,superClass:["Node"],properties:[{name:"bounds",type:"dc:Bounds"}]},{name:"Style",isAbstract:!0,properties:[{name:"id",isAttr:!0,isId:!0,type:"String"}]},{name:"Extension",properties:[{name:"values",isMany:!0,type:"Element"}]}],dw=[],hw={tagAlias:"lowerCase"},mw={name:uw,uri:lw,prefix:pw,types:fw,associations:dw,xml:hw},gw="bpmn.io colors for BPMN",yw="http://bpmn.io/schema/bpmn/biocolor/1.0",vw="bioc",_w=[{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"}]}],bw=[],xw=[],ww={name:gw,uri:yw,prefix:vw,types:_w,enumerations:bw,associations:xw},Ew="BPMN in Color",Sw="http://www.omg.org/spec/BPMN/non-normative/color/1.0",Rw="color",Cw=[{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"}]}],Pw=[],Aw=[],Tw={name:Ew,uri:Sw,prefix:Rw,types:Cw,enumerations:Pw,associations:Aw};const Mw={bpmn:K0,bpmndi:nw,dc:cw,di:mw,bioc:ww,color:Tw};function hd(e,t){const n=L({},Mw,e);return new ns(n,t)}const kw={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"}},Dw="http://www.omg.org/spec/BPMN/non-normative/extensions/i18n/1.0",md="i18n",is={[md]:kw,[wu]:Gf};function gd(){return hd(is)}const yd=gd();async function Fu(e){const{rootElement:t,warnings:n}=await yd.fromXML(e,"bpmn:Definitions");return{definitions:t,warnings:n}}async function Ow(e){const{xml:t}=await yd.toXML(e,{format:!0});return t}function Hu(e){return e.map(t=>typeof t=="string"?t:t.message??String(t))}const io={cjkEm:.865,upperEm:.68,lowerEm:.5,digitEm:.556,spaceEm:.278,otherEm:.35,ascentEm:.9,descentEm:.25},Lw=/[ᄀ-ᇿ -〿぀-ヿ㐀-鿿가-힯＀-⦆]/;function Iw(e){const t=io;return Lw.test(e)?t.cjkEm:e===" "?t.spaceEm:e>="0"&&e<="9"?t.digitEm:e>="A"&&e<="Z"?t.upperEm:e>="a"&&e<="z"?t.lowerEm:t.otherEm}function ro(e,t){let n=0;for(const i of e)n+=t*Iw(i);return n}function vd(e=globalThis,{textMeasurement:t="approximate"}={}){if(!(e!=null&&e.SVGElement))throw new Error("installHeadlessBpmnDom: DOM 전역이 없다 — jsdom window 를 전역에 올린 뒤 호출할 것");t==="approximate"&&Nw(e),Bw(e),$w(e),jw(e)}function Nw(e){var i;const t=(i=e.HTMLCanvasElement)==null?void 0:i.prototype;if(!t||t.__headlessTextMeasurement)return;t.__headlessTextMeasurement=!0;const n={font:"12px sans-serif",letterSpacing:"0px",measureText(r){var a;const o=Number.parseFloat(((a=String(n.font).match(/(\d+(?:\.\d+)?)px/))==null?void 0:a[1])??"12");return{width:ro(r,o),fontBoundingBoxAscent:o*io.ascentEm,fontBoundingBoxDescent:o*io.descentEm,actualBoundingBoxAscent:o*io.ascentEm,actualBoundingBoxDescent:o*io.descentEm}}};t.getContext=()=>n}function Bw(e){if(e.SVGMatrix)return;class t{constructor(){Xr(this,"a",1);Xr(this,"b",0);Xr(this,"c",0);Xr(this,"d",1);Xr(this,"e",0);Xr(this,"f",0)}static of(i,r,o,a,s,c){return Object.assign(new t,{a:i,b:r,c:o,d:a,e:s,f:c})}multiply(i){return t.of(this.a*i.a+this.c*i.b,this.b*i.a+this.d*i.b,this.a*i.c+this.c*i.d,this.b*i.c+this.d*i.d,this.a*i.e+this.c*i.f+this.e,this.b*i.e+this.d*i.f+this.f)}translate(i,r){return this.multiply(t.of(1,0,0,1,i,r))}scale(i,r=i){return this.multiply(t.of(i,0,0,r,0,0))}inverse(){const i=this.a*this.d-this.b*this.c;return t.of(this.d/i,-this.b/i,-this.c/i,this.a/i,(this.c*this.f-this.d*this.e)/i,(this.b*this.e-this.a*this.f)/i)}}e.SVGMatrix=t}function $w(e){var o;const t=()=>{const a=new e.SVGMatrix;return{type:0,matrix:a,setTranslate(s,c){a.e=s,a.f=c},setScale(s,c){a.a=s,a.d=c},setRotate(s,c=0,u=0){const l=s*Math.PI/180,f=Math.cos(l),p=Math.sin(l);a.a=f,a.b=p,a.c=-p,a.d=f,a.e=c-f*c+p*u,a.f=u-p*c-f*u},setMatrix(s){Object.assign(a,s)}}},n=a=>{const s=t();return Object.assign(s.matrix,a),s},i=(o=e.SVGSVGElement)==null?void 0:o.prototype;i&&!i.createSVGTransform&&(i.createSVGTransform=t,i.createSVGTransformFromMatrix=n,i.createSVGMatrix=()=>new e.SVGMatrix,i.createSVGPoint=()=>({x:0,y:0,matrixTransform:()=>({x:0,y:0})}));const r=e.SVGElement.prototype;Object.getOwnPropertyDescriptor(r,"transform")||Object.defineProperty(r,"transform",{configurable:!0,get(){if(!this.__headlessTransformList){const a=[];this.__headlessTransformList={baseVal:{get numberOfItems(){return a.length},clear:()=>{a.length=0},appendItem:s=>(a.push(s),s),getItem:s=>a[s],createSVGTransformFromMatrix:n,consolidate:()=>a[a.length-1]??null}}}return this.__headlessTransformList}})}function jw(e){const t=e.SVGElement.prototype;if(!t.getCTM){const n=()=>new e.SVGMatrix;t.getCTM=n,t.getScreenCTM=n}t.getBBox||(t.getBBox=function(){const n=String(this.textContent??"");return{x:0,y:0,width:ro(n,12),height:14}})}const rs=new Set(["bpmn:Participant","bpmn:Lane","bpmn:Group","bpmn:SubProcess","bpmn:AdHocSubProcess","bpmn:Transaction"]),Fw=1,Hw=2;function Ki(e){switch(e.kind){case"label-over-line":return`L|${e.edge}|${e.line}`;case"edge-crosses-shape":return`x|${e.edge}|${e.shape}`;case"shape-overlap":return`o|${e.shapes[0]}|${e.shapes[1]}`;case"shape-outside-container":return`c|${e.shape}|${e.container}`;case"edge-overlap-opposite":return`p|${e.edges[0]}|${e.edges[1]}`;case"edge-overlap-mixed":return`m|${e.edges[0]}|${e.edges[1]}`;case"label-on-shared-segment":return`l|${e.edge}|${e.other}`;case"annotation-over-label":return`a|${e.annotation}|${e.label}`;case"group-overlap-unintended":return`g|${e.groups[0]}|${e.groups[1]}`;case"group-on-container-boundary":return`gb|${e.group}|${e.container}|${e.side}`;case"group-on-group-boundary":return`gg|${e.groups[0]}|${e.groups[1]}|${e.axis}`;case"pool-name-over-label":return`pn|${e.pool}|${e.label}`}}const _d=20,bd=5,xd=3,wd=12,zw=wd*1.2;function zu(e,t){const n=t.split(/\r?\n/),i=Math.max(...n.map(o=>ro(o,wd))),r=n.length*zw;return{x:e.x+e.width/2-i/2,y:e.y+e.height/2-r/2,width:i,height:r}}const Ed=1;function mn(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 os(e,t){let n=null;const i=e.type!==t.type;for(const r of mn(e))for(const o of mn(t)){if(r.axis!==o.axis||Math.abs(r.at-o.at)>Ed)continue;const a=r.dir!==o.dir?"opposite":i?"mixed":null;if(!a)continue;const s=Math.min(r.hi,o.hi)-Math.max(r.lo,o.lo);s>=_d&&(!n||s>n.length)&&(n={axis:r.axis,length:s,kind:a})}return n}function Sd(e,t){const n=os(e,t);return n&&n.kind==="opposite"?{axis:n.axis,length:n.length}:null}function Vw(e,t){let n=0;for(const i of t)i.id!==e.id&&Sd(e,i)&&n++;return n}function Mr(e,t){let n=0;for(const i of t)i.id!==e.id&&os(e,i)&&n++;return n}const Rd=15,Cd=20;function Gw(e,t){const n=t.axis==="v"?[e.x,e.x+e.width]:[e.y,e.y+e.height];if(t.at<n[0]-Cd||t.at>n[1]+Cd)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 Vu=20;function as(e,t){const n=[];for(const i of t){if(i.axis!==e.axis||Math.abs(i.at-e.at)>Ed)continue;const r=Math.max(e.lo,i.lo),o=Math.min(e.hi,i.hi);o-r<_d||n.push([r-Vu,o+Vu])}return n}function ss(e,t){const n=e.label;if(!n)return null;let i=null;for(const r of mn(e)){const o=Gw(n,r);if(o){for(const a of t)if(a.id!==e.id&&!(i&&a.id>=i.other)){for(const[s,c]of as(r,mn(a)))if(Math.min(c,o[1])>Math.max(s,o[0])){i={other:a.id,axis:r.axis};break}}}}return i}const Ww=1,Uw=(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 Yw(e,t,n,i){const r=n.x+i,o=n.y+i,a=n.x+n.width-i,s=n.y+n.height-i;if(a<=r||s<=o)return!1;const c=t.x-e.x,u=t.y-e.y;let l=0,f=1;const p=(d,h)=>{if(h===0)return d<=0;const m=d/h;if(h>0){if(m>f)return!1;m>l&&(l=m)}else{if(m<l)return!1;m<f&&(f=m)}return!0};return p(r-e.x,c)&&p(e.x-a,-c)&&p(o-e.y,u)&&p(e.y-s,-u)&&f>l}function Gu(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 qw=(e,t)=>e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height,oo=1;function Ri(e,t){const n=e.x+oo,i=e.x+e.width-oo,r=e.y+oo,o=e.y+e.height-oo;return t.axis==="h"?t.at>r&&t.at<o&&t.lo<i&&t.hi>n:t.at>n&&t.at<i&&t.lo<o&&t.hi>r}function Wo(e){return[{axis:"h",at:e.y,lo:e.x,hi:e.x+e.width,dir:1},{axis:"h",at:e.y+e.height,lo:e.x,hi:e.x+e.width,dir:1},{axis:"v",at:e.x,lo:e.y,hi:e.y+e.height,dir:1},{axis:"v",at:e.x+e.width,lo:e.y,hi:e.y+e.height,dir:1}]}function Pd(e,t){const n=e.label;if(!n)return null;if(mn(e).some(i=>Ri(n,i)))return e.id;for(const i of[...t.edges].filter(r=>r.id!==e.id).sort((r,o)=>r.id.localeCompare(o.id)))if(mn(i).some(r=>Ri(n,r)))return i.id;for(const i of t.shapes.filter(r=>r.container).sort((r,o)=>r.id.localeCompare(o.id)))if(Wo(i).some(r=>Ri(n,r)))return i.id;return null}function Vn(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(Yw(e.waypoints[o],e.waypoints[o+1],r,Hw)){i.push(r);break}}return i}function Kw(e,t,n,i){const r=(u,l,f)=>(l.x-u.x)*(f.y-u.y)-(l.y-u.y)*(f.x-u.x),o=r(n,i,e),a=r(n,i,t),s=r(e,t,n),c=r(e,t,i);return o*a<0&&s*c<0}const Ad=(e,t)=>e.endpoints.some(n=>t.endpoints.includes(n));function cs(e,t){let n=0;for(const i of t){if(i.id===e.id||Ad(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++)Kw(e.waypoints[o],e.waypoints[o+1],i.waypoints[a],i.waypoints[a+1])&&(r=!0);r&&n++}return n}function Ci(e,t){let n=0;for(const i of t)i.id===e.id||Ad(e,i)||cs(e,[i])>0&&(n+=i.type===e.type?2:1);return n}function Td(e){let t=0;const n=e.edges;for(let i=0;i<n.length;i++)for(let r=i+1;r<n.length;r++)cs(n[i],[n[r]])>0&&(t+=n[i].type===n[r].type?2:1);return t}function Wu(e){const t=[],n=e.edges;for(let i=0;i<n.length;i++)for(let r=i+1;r<n.length;r++)if(cs(n[i],[n[r]])>0){const o=n[i].id,a=n[r].id;t.push(o<a?[o,a]:[a,o])}return t.sort((i,r)=>`${i[0]}|${i[1]}`.localeCompare(`${r[0]}|${r[1]}`))}function Md(e){var n;const t=(n=ht(e==null?void 0:e.extensionElements))==null?void 0:n.values;if(Array.isArray(t))for(const i of t){const r=ht(i);if((r==null?void 0:r.$type)!=="bwl:Members"||typeof r.refs!="string")continue;const o=r.refs.split(/\s+/).filter(Boolean);return o.length?o:void 0}}const kd=e=>e?{members:e}:{},Pi=e=>e.shapes.filter(t=>!t.container);function Xw(e,t,n){if(e.type==="bpmn:TextAnnotation")for(const i of t.edges){if(!/Association$/.test(i.type)||!i.endpoints.includes(e.id))continue;const r=i.endpoints.find(a=>a!==e.id),o=r?n.get(r):void 0;if(o){if(o.container)return o.id;if(o.parent)return o.parent}}}function Dd(e,t){const n=e.label;if(!n)return null;for(const i of[...t.edges].sort((r,o)=>r.id.localeCompare(o.id)))if(mn(i).some(r=>Ri(n,r)))return i.id;for(const i of[...t.shapes].filter(r=>r.container).sort((r,o)=>r.id.localeCompare(o.id)))if(Wo(i).some(r=>Ri(n,r)))return i.id;return null}function Uo(e){const t=[];for(const n of e.shapes)n.label&&t.push({owner:n.id,rect:n.label});for(const n of e.edges)n.label&&t.push({owner:n.id,rect:n.label});return t}function Xi(e){const t=[],n=e.shapes.filter(p=>!p.container);for(const p of e.edges)for(const d of Vn(p,n))t.push({kind:"edge-crosses-shape",edge:p.id,shape:d.id});const i=n.filter(p=>!p.attached);for(let p=0;p<i.length;p++)for(let d=p+1;d<i.length;d++){const h=i[p],m=i[d];if(!Gu(h,m,Fw))continue;const g=h.id<m.id?[h.id,m.id]:[m.id,h.id];t.push({kind:"shape-overlap",shapes:g,identical:qw(h,m)})}const r=e.shapes.filter(p=>p.type==="bpmn:Group"&&Array.isArray(p.members)&&p.members.length>0);for(let p=0;p<r.length;p++)for(let d=p+1;d<r.length;d++){const h=r[p],m=r[d],g=Math.min(h.x+h.width,m.x+m.width)-Math.max(h.x,m.x),R=Math.min(h.y+h.height,m.y+m.height)-Math.max(h.y,m.y);if(g<=bd||R<=bd)continue;const w=new Set(m.members);h.members.some(b=>w.has(b))||t.push({kind:"group-overlap-unintended",groups:h.id<m.id?[h.id,m.id]:[m.id,h.id]})}const o=e.shapes.filter(p=>p.container&&p.type!=="bpmn:Group"&&p.type!=="bpmn:Lane");for(const p of e.shapes.filter(d=>d.type==="bpmn:Group"))for(const d of o){const h=p.x<d.x+d.width&&d.x<p.x+p.width,m=p.y<d.y+d.height&&d.y<p.y+p.height,g=[["top",p.y,d.y,h],["bottom",p.y+p.height,d.y+d.height,h],["left",p.x,d.x,m],["right",p.x+p.width,d.x+d.width,m]];for(const[R,w,b,x]of g)x&&Math.abs(w-b)<=xd&&t.push({kind:"group-on-container-boundary",group:p.id,container:d.id,side:R})}const a=e.shapes.filter(p=>p.type==="bpmn:Group");for(let p=0;p<a.length;p++)for(let d=p+1;d<a.length;d++){const h=a[p],m=a[d],g=h.x<m.x+m.width&&m.x<h.x+h.width,R=h.y<m.y+m.height&&m.y<h.y+h.height,w=[["x",h.x+h.width,m.x,R],["x",m.x+m.width,h.x,R],["y",h.y+h.height,m.y,g],["y",m.y+m.height,h.y,g]];for(const[b,x,S,M]of w)if(M&&Math.abs(x-S)<=xd){t.push({kind:"group-on-group-boundary",groups:h.id<m.id?[h.id,m.id]:[m.id,h.id],axis:b});break}}for(let p=0;p<e.edges.length;p++)for(let d=p+1;d<e.edges.length;d++){const h=e.edges[p],m=e.edges[d],g=os(h,m);if(!g)continue;const R=h.id<m.id?[h.id,m.id]:[m.id,h.id];t.push({kind:g.kind==="opposite"?"edge-overlap-opposite":"edge-overlap-mixed",edges:R,axis:g.axis,length:Math.round(g.length)})}for(const p of e.edges){if(!p.label)continue;const d=ss(p,e.edges);d&&t.push({kind:"label-on-shared-segment",edge:p.id,other:d.other,axis:d.axis})}for(const p of e.edges){if(!p.label)continue;const d=Pd(p,e);d&&t.push({kind:"label-over-line",edge:p.id,line:d})}const s=new Set(n.map(p=>p.id)),c=e.shapes.filter(p=>p.type==="bpmn:Participant"&&p.label);for(const p of[...n,...c.filter(d=>!s.has(d.id))]){if(!p.label)continue;const d=Dd(p,e);d&&t.push({kind:"label-over-line",edge:p.id,line:d})}const u=new Set(e.shapes.filter(p=>p.type==="bpmn:TextAnnotation").map(p=>p.id));for(const p of c)for(const{owner:d,rect:h}of Uo(e))d===p.id||u.has(d)||Gu(p.label,h,oo)&&t.push({kind:"pool-name-over-label",pool:p.id,label:d});const l=Uo(e);for(const p of n)if(p.type==="bpmn:TextAnnotation")for(const{owner:d,rect:h}of l)d!==p.id&&Gu(p,h,oo)&&t.push({kind:"annotation-over-label",annotation:p.id,label:d});const f=new Map(e.shapes.map(p=>[p.id,p]));for(const p of n){const d=p.parent??Xw(p,e,f);if(!d)continue;const h=f.get(d);!h||!h.container||Uw(h,p,Ww)||t.push({kind:"shape-outside-container",shape:p.id,container:h.id})}return t.sort((p,d)=>Ki(p).localeCompare(Ki(d)))}const ht=e=>typeof e=="object"&&e!==null?e:void 0,wt=e=>typeof e=="number"?e:0,kr=e=>{const t=ht(e);return typeof(t==null?void 0:t.id)=="string"?t.id:void 0};function Zw(e){const t=ht(e);if(!t)return[];const n=[];for(const i of["sourceRef","targetRef"]){const r=t[i];for(const o of Array.isArray(r)?r:[r]){const a=kr(o);a&&n.push(a)}}return n}function Qw(e,t){const n=ht(e.$parent);if(!n)return;const i=typeof n.$type=="string"?n.$type:"";if(i==="bpmn:Process"){const r=kr(n);return r?t.get(r):void 0}if(rs.has(i)&&i!=="bpmn:Lane"&&i!=="bpmn:Group")return kr(n)}function Od(e){var a,s,c,u,l;const t=[],n=[],i=((a=ht(e))==null?void 0:a.diagrams)??[],r=new Map,o=new Set;for(const f of((s=ht(e))==null?void 0:s.rootElements)??[]){const p=ht(f);if((p==null?void 0:p.$type)==="bpmn:Collaboration")for(const d of p.participants??[]){const h=ht(d),m=kr(h),g=kr(h==null?void 0:h.processRef);m&&g?r.set(g,m):m&&o.add(m)}}for(const f of i){const p=ht((c=ht(f))==null?void 0:c.plane),d=(p==null?void 0:p.planeElement)??[];for(const h of d){const m=ht(h);if(!m)continue;const g=ht(m.bpmnElement),R=typeof(g==null?void 0:g.id)=="string"?g.id:void 0;if(!R)continue;const w=typeof(g==null?void 0:g.$type)=="string"?g.$type:"",b=ht(m.bounds);if(b){const S=m.isExpanded===!1&&w!=="bpmn:Participant",M=ht((u=ht(m.label))==null?void 0:u.bounds),N={id:R,type:w,x:wt(b.x),y:wt(b.y),width:wt(b.width),height:wt(b.height),container:rs.has(w)&&!S,attached:(g==null?void 0:g.attachedToRef)!==void 0,...g?{parent:Qw(g,r)}:{},...M?{label:{x:wt(M.x),y:wt(M.y),width:wt(M.width),height:wt(M.height)}}:{},...w==="bpmn:Group"?kd(Md(g)):{}},T=m.isHorizontal!==!1,H=typeof(g==null?void 0:g.name)=="string"?g.name:"";o.has(R)&&T&&H&&(N.label=zu(N,H)),t.push(N);continue}const x=m.waypoint;if(Array.isArray(x)){const S=ht((l=ht(m.label))==null?void 0:l.bounds);n.push({id:R,type:w,waypoints:x.map(M=>{var N,T;return{x:wt((N=ht(M))==null?void 0:N.x),y:wt((T=ht(M))==null?void 0:T.y)}}),endpoints:Zw(g),...S?{label:{x:wt(S.x),y:wt(S.y),width:wt(S.width),height:wt(S.height)}}:{}})}}}return{shapes:t,edges:n}}function Ld(e){return Xi(Od(e))}async function Jw(e){const{definitions:t,warnings:n}=await Fu(e);return{findings:Ld(t),warnings:n}}function Ft(e){var i;const t=[],n=[];for(const r of e.getAll()){const o=r;if(o.type==="label"||o.labelTarget)continue;const a=typeof o.type=="string"?o.type:"";if(a==="bpmn:Definitions"||a.startsWith("bpmndi:"))continue;const s=o.waypoints;if(s){const m=ht(o.label);n.push({id:o.id,type:a,waypoints:s.map(g=>({x:wt(g.x),y:wt(g.y)})),endpoints:[kr(o.source),kr(o.target)].filter(g=>!!g),...m&&typeof m.x=="number"?{label:{x:m.x,y:wt(m.y),width:wt(m.width),height:wt(m.height)}}:{}});continue}if(typeof o.x!="number"||typeof o.y!="number")continue;const c=ht(o.businessObject),u=ht(o.label);let l=ht(o.parent);for(;l&&l.type==="bpmn:Lane";)l=ht(l.parent);const f=typeof(l==null?void 0:l.type)=="string"?l.type:"",p=l&&rs.has(f)&&f!=="bpmn:Group"&&typeof l.id=="string"?l.id:void 0,d={id:o.id,type:a,x:o.x,y:o.y,width:wt(o.width),height:wt(o.height),container:rs.has(a)&&(a==="bpmn:Participant"||o.collapsed!==!0),attached:(c==null?void 0:c.attachedToRef)!==void 0,...p!==void 0?{parent:p}:{},...u&&typeof u.x=="number"?{label:{x:u.x,y:wt(u.y),width:wt(u.width),height:wt(u.height)}}:{},...a==="bpmn:Group"?kd(Md(c)):{}},h=typeof(c==null?void 0:c.name)=="string"?c.name:"";a==="bpmn:Participant"&&!(c!=null&&c.processRef)&&h&&((i=ht(o.di))==null?void 0:i.isHorizontal)!==!1&&(d.label=zu(d,h)),t.push(d)}return{shapes:t,edges:n}}const eE={"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 tE(e,t){const n=eE[e];return n||(e==="label"||e.startsWith("bpmndi:")?"other":e.startsWith("bpmn:")&&!("waypoints"in t&&t.waypoints)?"flowNode":"other")}function Id(e){let t=e.parent;for(;t;){if(t.type==="bpmn:Participant")return t.id;t=t.parent}}function Nd(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 tE(i.type,i)},lanesOf:n=>t().filter(i=>i.type==="bpmn:Lane"&&Id(i)===n).sort((i,r)=>i.y-r.y).map(i=>i.id),participantOf:n=>{const i=e.get(n);return i?Id(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 Bd=20,nE=4,At=(e,t)=>Math.abs(e-t)<.5;function $d(e,t,n,i=Bd){if(At(e.y,t.y)&&!At(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(At(e.x,t.x)&&!At(e.y,t.y)){const r=Math.min(e.y,t.y),o=Math.max(e.y,t.y);if(!(r<n.y-i&&n.y+n.height+i<o))return null;const a=e.y<t.y?n.y-i:n.y+n.height+i,s=e.y<t.y?n.y+n.height+i:n.y-i,c=u=>[{x:e.x,y:a},{x:u,y:a},{x:u,y:s},{x:e.x,y:s}];return[c(n.x-i),c(n.x+n.width+i)]}return null}function jd(e,t,n=Bd){if(e.length!==4)return null;const[i,r,o,a]=e;if(At(i.y,r.y)&&At(r.x,o.x)&&At(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(At(i.x,r.x)&&At(r.y,o.y)&&At(o.x,a.x)){const s=c=>[i,{x:i.x,y:c},{x:a.x,y:c},a];return[s(t.y-n),s(t.y+t.height+n)]}return null}function Uu(e,t){if(e.endpoints.length!==2)return[];const n=t.find(f=>f.id===e.endpoints[0]),i=t.find(f=>f.id===e.endpoints[1]);if(!n||!i)return[];if(i.x<=n.x+n.width)return[];const r=n.y+n.height/2,o=i.y+i.height/2;if(r>=i.y&&r<=i.y+i.height)return[];const a=i.x+i.width/2,s=n.x+n.width/2,c=r>o,u=[{x:n.x+n.width,y:r},{x:a,y:r},{x:a,y:c?i.y+i.height:i.y}],l=[{x:s,y:c?n.y:n.y+n.height},{x:s,y:o},{x:i.x,y:o}];return[u,l]}const Fd=30,iE=[0,-25,25,-40,40];function rE(e,t){if(e.type!=="bpmn:MessageFlow"||e.endpoints.length!==2)return[];const n=t.find(p=>p.id===e.endpoints[0]),i=t.find(p=>p.id===e.endpoints[1]);if(!n||!i)return[];const r=n.y+n.height/2,o=i.y+i.height/2;if(i.y<n.y+n.height&&i.y+i.height>n.y)return[];const a=o<r,s=a?n.y+n.height:n.y,c=a?s+Fd:s-Fd,u=a?i.y+i.height:i.y,l=n.x+n.width/2,f=i.x+i.width/2;return iE.map(p=>[{x:l,y:s},{x:l,y:c},{x:f+p,y:c},{x:f+p,y:u}])}const oE=(e,t,n)=>[...e.slice(0,t+1),...n,...e.slice(t+1)],us=(e,t,n)=>Vn({...e,waypoints:t},n).length;function Hd(e,t,n,i){let r=[...e.waypoints],o=us(e,r,t);if(o===0)return null;let a=!1;for(const f of Uu(e,t))if(us(e,f,t)===0)return f;const s=(i??[]).filter(f=>f.id!==e.id).flatMap(mn),c=f=>mn({...e,waypoints:f}).some(p=>as(p,s).length>0),u=rE(e,t).filter(f=>us(e,f,t)===0);if(u.length)return u.find(f=>!c(f))??u[0];const l=f=>!n||f.every(p=>p.x>=n.x&&p.x<=n.x+n.width&&p.y>=n.y&&p.y<=n.y+n.height);for(let f=0;f<nE&&o>0;f++){let p=!1;for(let d=0;d+1<r.length&&!p;d++){const h=r[d],m=r[d+1];for(const g of t){if(e.endpoints.includes(g.id)||Vn({...e,waypoints:[h,m]},[g]).length===0)continue;const R=$d(h,m,g),w=R?R.map(x=>oE(r,d,x)):jd(r,g)??[];if(!w.length)continue;const b=[...w].sort((x,S)=>Number(l(S))-Number(l(x)));for(const x of b){const S=us(e,x,t);if(S<o){r=x,o=S,p=!0,a=!0;break}}if(p)break}}if(!p)break}return a&&o===0?r:null}function zd(e,t){const{elementRegistry:n}=e,i=e.modeling,r=Ft(n),o=Pi(r),a=Xi(r).filter(c=>c.kind==="edge-crosses-shape"&&!t.has(Ki(c)));if(!a.length)return;const s=new Map;for(const c of a){if(c.kind!=="edge-crosses-shape"||s.has(c.edge))continue;const u=r.edges.find(l=>l.id===c.edge);u&&s.set(c.edge,u)}for(const[c,u]of s){const l=n.get(c);if(!l)continue;const f=l.parent,p=f&&typeof f.x=="number"&&typeof f.width=="number"?{x:f.x,y:f.y,width:f.width,height:f.height}:void 0,d=Hd(u,o,p,r.edges);d&&i.updateWaypoints(l,d)}}const aE=10;function Vd(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 Gd(e,t){if(e.waypoints.length<2||e.endpoints.length!==2)return null;const n=t.shapes.filter(G=>G.type==="bpmn:Participant"&&G.container),i=t.shapes.find(G=>G.id===e.endpoints[0]),r=t.shapes.find(G=>G.id===e.endpoints[1]);if(!i||!r)return null;const o=Vd(i,n),a=Vd(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(G=>G.id!==o.id&&G.id!==a.id&&G.y>=c.y+c.height&&G.y+G.height<=u.y).sort((G,he)=>G.y-he.y);if(!l.length)return null;const f=l[0],p=l[l.length-1],d=(c.y+c.height+f.y)/2,h=(p.y+p.height+u.y)/2,m=s?d:h,g=s?h:d,R=e.waypoints[0],w=e.waypoints[e.waypoints.length-1],b=Pi(t),x=t.edges.filter(G=>G.id!==e.id),S=Ci(e,x),M=Vn(e,b).length;if(S===0&&M===0||M===0&&e.waypoints.length===2)return null;const N=Math.min(...l.map(G=>G.x)),T=Math.max(...l.map(G=>G.x+G.width)),H=(R.x+w.x)/2,V=G=>G.filter((he,Fe)=>Fe===0||!(At(he.x,G[Fe-1].x)&&At(he.y,G[Fe-1].y)));let $;for(let G=N;G<=T;G+=aE){const he=V([R,{x:R.x,y:m},{x:G,y:m},{x:G,y:g},{x:w.x,y:g},w]),Fe={...e,waypoints:he};if(Vn(Fe,b).length>0)continue;const pt=Ci(Fe,x),q=Math.abs(G-H);(!$||pt<$.cross||pt===$.cross&&q<$.detour)&&($={pts:he,cross:pt,detour:q})}return $&&(M>0?$.cross<=S:$.cross<S)?$.pts:null}function Wd(e,t){const{elementRegistry:n}=e,i=e.modeling,r=Ft(n);for(const o of r.edges){if(o.type!=="bpmn:MessageFlow"||t.has(o.id))continue;const a=Ft(n),s=a.edges.find(l=>l.id===o.id);if(!s)continue;const c=Gd(s,a);if(!c)continue;const u=n.get(o.id);u&&i.updateWaypoints(u,c)}}const ao=[25,-25,40,-40],ls=35;function Ud(e,t){if(e.type!=="bpmn:SequenceFlow")return[];const n=t.get(e.endpoints[0]??""),i=t.get(e.endpoints[1]??"");if(!n||!i)return[];if(i.x+i.width>n.x)return[];const r=n.y+n.height/2;if(r>=i.y&&r<=i.y+i.height)return[];const o=i.x+i.width/2,a=n.x+n.width/2,s=r<i.y,c=s?i.y:i.y+i.height,u=s?n.y:n.y+n.height,l=s?n.y-ls:n.y+n.height+ls,f=[];for(const w of[0,...ao]){if(Math.abs(w)>=i.width/2-5)continue;const b=o+w;f.push({pts:[{x:n.x,y:r},{x:b,y:r},{x:b,y:c}],cost:Math.abs(w)});for(const x of[0,...ao]){if(Math.abs(x)>=n.width/2-5)continue;const S=a+x;f.push({pts:[{x:S,y:u},{x:S,y:l},{x:b,y:l},{x:b,y:c}],cost:Math.abs(w)+Math.abs(x)})}}const p=50,d=i.y+i.height/2,h=s?n.y+n.height:n.y;for(const w of[0,...ao]){if(Math.abs(w)>=n.width/2-5)continue;const b=a+w;f.push({pts:[{x:b,y:h},{x:b,y:d},{x:i.x+i.width,y:d}],cost:p+Math.abs(w)})}const m=60,g=s?i.y+i.height:i.y,R=s?i.y+i.height+ls:i.y-ls;for(const w of[0,...ao]){if(Math.abs(w)>=i.width/2-5)continue;const b=o+w;for(const x of[0,...ao]){if(Math.abs(x)>=n.width/2-5)continue;const S=a+x;f.push({pts:[{x:S,y:h},{x:S,y:R},{x:b,y:R},{x:b,y:g}],cost:m+Math.abs(w)+Math.abs(x)})}}return f}const ps=30;function Yd(e,t){for(let n=1;n<e.length-2;n++){const i=e[n],r=e[n+1],o=At(i.y,r.y)&&!At(i.x,r.x),a=At(i.x,r.x)&&!At(i.y,r.y);if(!(!o&&!a))for(const s of t)if(o){const c=Math.min(i.x,r.x);if(Math.max(i.x,r.x)<=s.x||c>=s.x+s.width)continue;if(Math.abs(i.y-s.y)<ps||Math.abs(i.y-(s.y+s.height))<ps)return!0}else{const c=Math.min(i.y,r.y);if(Math.max(i.y,r.y)<=s.y||c>=s.y+s.height)continue;if(Math.abs(i.x-s.x)<ps||Math.abs(i.x-(s.x+s.width))<ps)return!0}}return!1}const fs=40;function sE(e,t,n){let i=0;for(const r of t){if(r.container||n.includes(r.id))continue;const o=r.x-fs,a=r.x+r.width+fs,s=r.y-fs,c=r.y+r.height+fs;for(let u=1;u<e.length-2;u++){const l=e[u],f=e[u+1],p={x:Math.min(l.x,f.x),y:Math.min(l.y,f.y)},d={x:Math.max(l.x,f.x),y:Math.max(l.y,f.y)};if(p.x<a&&d.x>o&&p.y<c&&d.y>s){i++;break}}}return i}function qd(e,t){if(e.type!=="bpmn:SequenceFlow")return null;const n=t.shapes.filter(w=>w.container),i=new Map(t.shapes.map(w=>[w.id,w])),r=Pi(t),o=t.edges.filter(w=>w.id!==e.id),a=Mr(e,o),s=Ci(e,o),c=w=>sE(w,t.shapes,e.endpoints)+(Yd(w,n)?1:0),u=c(e.waypoints),l=w=>{if(!w)return;const b=w.x+w.width/2,x=w.y+w.height/2;return n.find(S=>S.type==="bpmn:Lane"&&b>=S.x&&b<=S.x+S.width&&x>=S.y&&x<=S.y+S.height)},f=l(i.get(e.endpoints[0]??"")),p=l(i.get(e.endpoints[1]??"")),d=!!f&&!!p&&f.id!==p.id,h=w=>{if(!d||!p)return!1;for(let b=1;b<w.length-2;b++){const x=w[b],S=w[b+1];if(At(x.y,S.y)&&!At(x.x,S.x)&&x.y>p.y&&x.y<p.y+p.height)return!0}return!1},m=h(e.waypoints);if(!Yd(e.waypoints,n)&&!(d&&!m))return null;const g=w=>w.reduce((b,x,S)=>S?b+Math.abs(x.x-w[S-1].x)+Math.abs(x.y-w[S-1].y):0,0);let R;for(const{pts:w,cost:b}of Ud(e,i)){const x={...e,waypoints:w};if(Vn(x,r).length>0||Mr(x,o)>a||Ci(x,o)>s)continue;const S=c(w),M=h(w);if(!(M&&!m)&&S>=u)continue;const T=M?0:1,H=g(w);(!R||T<R.lane||T===R.lane&&(S<R.sc||S===R.sc&&(b<R.cost||b===R.cost&&H<R.len)))&&(R={pts:w,sc:S,lane:T,cost:b,len:H})}return(R==null?void 0:R.pts)??null}function cE(e,t){const{elementRegistry:n}=e,i=e.modeling,r=Ft(n).edges.filter(o=>!t.has(o.id)&&o.waypoints.length>=4).map(o=>o.id).sort();for(const o of r){const a=Ft(n),s=a.edges.find(d=>d.id===o);if(!s||s.waypoints.length<4)continue;const c=Pi(a),u=a.edges.filter(d=>d.id!==o),l=Vn(s,c).length,f=Mr(s,u),p=Ci(s,u);for(const d of Uu(s,a.shapes)){if(d.length>=s.waypoints.length)continue;const h={...s,waypoints:d};if(Vn(h,c).length>l||Mr(h,u)>f||Ci(h,u)>p)continue;const m=n.get(o);m&&i.updateWaypoints(m,d);break}}}function Kd(e,t){const{elementRegistry:n}=e,i=e.modeling,r=Ft(n).edges.filter(o=>o.type==="bpmn:SequenceFlow"&&!t.has(o.id)).map(o=>o.id).sort();for(const o of r){const a=Ft(n),s=a.edges.find(l=>l.id===o);if(!s)continue;const c=qd(s,a);if(!c)continue;const u=n.get(o);u&&i.updateWaypoints(u,c)}}function uE(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=At(n[0].x,n[1].x)&&!At(n[0].y,n[1].y),s=At(n[n.length-1].x,n[n.length-2].x)&&!At(n[n.length-1].y,n[n.length-2].y);for(const c of ao){if(a&&r&&Math.abs(c)<r.width/2-5){const u=n.map(l=>({...l}));u[0].x+=c,u[1].x+=c,i.push({pts:u,cost:Math.abs(c)})}if(s&&o&&Math.abs(c)<o.width/2-5){const u=n.map(l=>({...l}));u[u.length-1].x+=c,u[u.length-2].x+=c,i.push({pts:u,cost:Math.abs(c)})}}return i}function Xd(e,t){const n=new Map(t.shapes.map(l=>[l.id,l])),i=Pi(t),r=t.edges.filter(l=>l.id!==e.id),o=Mr(e,r);if(o===0)return null;const a=Ci(e,r);let s;const c=l=>l.reduce((f,p,d)=>d?f+Math.abs(p.x-l[d-1].x)+Math.abs(p.y-l[d-1].y):0,0),u=[...Ud(e,n),...uE(e,n)];for(const{pts:l,cost:f}of u){const p={...e,waypoints:l};if(Vn(p,i).length>0)continue;const d=Mr(p,r),h=Ci(p,r);if(d>=o||h-a>o-d)continue;const m=c(l);(!s||d<s.opposite||d===s.opposite&&(h<s.cross||h===s.cross&&(f<s.cost||f===s.cost&&m<s.len)))&&(s={pts:l,opposite:d,cross:h,cost:f,len:m})}return(s==null?void 0:s.pts)??null}function Zd(e,t,n){const{elementRegistry:i}=e,r=e.modeling,o=Ft(i),a=Xi(o).filter(l=>(l.kind==="edge-overlap-opposite"||l.kind==="edge-overlap-mixed")&&!t.has(Ki(l)));if(!a.length)return;const s=new Set;for(const l of a)if(!(l.kind!=="edge-overlap-opposite"&&l.kind!=="edge-overlap-mixed"))for(const f of l.edges)n.has(f)||s.add(f);const c=l=>{var f;return((f=o.edges.find(p=>p.id===l))==null?void 0:f.type)??""},u=[...s].sort((l,f)=>{const p=c(l)==="bpmn:SequenceFlow"?0:1,d=c(f)==="bpmn:SequenceFlow"?0:1;return p!==d?p-d:l.localeCompare(f)});for(const l of u){const f=Ft(i),p=f.edges.find(m=>m.id===l);if(!p)continue;const d=Xd(p,f);if(!d)continue;const h=i.get(l);h&&r.updateWaypoints(h,d)}}const lE=10,pE=(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 Qd(e,t){const n=e.label;if(!n)return null;const i=t.edges.filter(a=>a.id!==e.id);if(!ss(e,i))return null;const r=Pi(t),o=i.flatMap(mn);for(const a of mn(e)){let s=[[a.lo,a.hi]];for(const[d,h]of as(a,o))s=s.flatMap(([m,g])=>{const R=[];return d>m&&R.push([m,Math.min(g,d)]),h<g&&R.push([Math.max(m,h),g]),R.filter(([w,b])=>b>w)});const c=a.axis==="h"?n.width:n.height,u=s.find(([d,h])=>h-d>=c+lE*2);if(!u)continue;const l=(u[0]+u[1])/2,f=a.axis==="h"?{x:l,y:a.at-Rd}:{x:a.at+Rn+n.width/2,y:l},p={x:f.x-n.width/2,y:f.y-n.height/2,width:n.width,height:n.height};if(!ss({...e,label:p},i)&&!r.some(d=>!e.endpoints.includes(d.id)&&pE(p,d)))return p}return null}const Rn=8;function Jd(e,t){const n=e.label;if(!n)return null;const i=mn(e);if(!i.length)return null;const r=n.x+n.width/2,o=n.y+n.height/2,a=p=>{const d=p.axis==="h"?r:o,h=p.axis==="h"?o-p.at:r-p.at,m=d<p.lo?p.lo-d:d>p.hi?d-p.hi:0;return Math.hypot(h,m)},s=i.reduce((p,d)=>a(d)<a(p)?d:p,i[0]),c=[...i,...t.edges.filter(p=>p.id!==e.id).flatMap(mn),...t.shapes.filter(p=>p.container).flatMap(Wo)],u=p=>!c.some(d=>Ri(p,d));if(u(n))return null;const l=(s.axis==="v"?n.height:n.width)+Rn,f=[0,-l,l,-2*l,2*l];if(s.axis==="v")for(const p of[s.at+Rn,s.at-Rn-n.width])for(const d of f){const h=n.y+d;if(h<s.lo||h+n.height>s.hi)continue;const m={...n,x:p,y:h};if(u(m))return m}else for(const p of[s.at-Rn-n.height,s.at+Rn])for(const d of f){const h=n.x+d;if(h<s.lo||h+n.width>s.hi)continue;const m={...n,x:h,y:p};if(u(m))return m}return null}function eh(e,t){const{elementRegistry:n}=e,i=e.modeling,r=Ft(n);for(const o of r.edges){if(!o.label||t.has(o.id))continue;const a=Jd(o,r);if(!a)continue;const s=n.get(o.id),c=s==null?void 0:s.label;c&&i.moveElements([c],{x:a.x-c.x,y:a.y-c.y})}}function th(e,t,n){const{elementRegistry:i}=e,r=e.modeling,o=Ft(i),a=Xi(o).filter(s=>s.kind==="label-on-shared-segment"&&!t.has(Ki(s)));for(const s of a){if(s.kind!=="label-on-shared-segment"||n.has(s.edge))continue;const c=o.edges.find(p=>p.id===s.edge);if(!c)continue;const u=Qd(c,o);if(!u)continue;const l=i.get(s.edge),f=l==null?void 0:l.label;f&&r.moveElements([f],{x:u.x-f.x,y:u.y-f.y})}}function nh(e,t){const n=e.label;if(!n)return null;const i=[...t.edges.flatMap(mn),...t.shapes.filter(p=>p.container).flatMap(Wo)],r=i.filter(p=>Ri(n,p));if(!r.length)return null;const o=t.shapes.filter(p=>!p.container&&p.id!==e.id),a=Uo(t).filter(p=>p.owner!==e.id).map(p=>p.rect),s=(p,d)=>p.x<d.x+d.width&&d.x<p.x+p.width&&p.y<d.y+d.height&&d.y<p.y+p.height,c=p=>!i.some(d=>Ri(p,d))&&!o.some(d=>s(p,d))&&!a.some(d=>s(p,d)),u=[];for(const p of r)p.axis==="h"?u.push({...n,y:p.at-Rn-n.height},{...n,y:p.at+Rn}):u.push({...n,x:p.at-Rn-n.width},{...n,x:p.at+Rn});const l=e.x+e.width/2,f=e.y+e.height/2;return u.push({...n,x:l-n.width/2,y:e.y+e.height+Rn},{...n,x:l-n.width/2,y:e.y-Rn-n.height},{...n,x:e.x+e.width+Rn,y:f-n.height/2},{...n,x:e.x-Rn-n.width,y:f-n.height/2}),u.find(c)??null}function ih(e,t){const{elementRegistry:n}=e,i=e.modeling,r=Ft(n);for(const o of r.shapes){if(o.container||!o.label||t.has(o.id))continue;const a=nh(o,Ft(n));if(!a)continue;const s=n.get(o.id),c=s==null?void 0:s.label;c&&i.moveElements([c],{x:a.x-c.x,y:a.y-c.y})}}const fE=/^[\p{L}_][\p{L}\p{N}_.\-]*$/u,rh=new Set(["sequenceFlow","messageFlow","dataAssociation","association"]),oh={"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}]},ds=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),Yu=e=>typeof e=="string"&&e!=="";function dE(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(!ds(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(!ds(i)||!Yu(i.kind)||!(i.kind in oh)){t.push({kind:"payload-invalid",opIndex:r,field:"kind"});return}for(const o of oh[i.kind]){const a=o.path.endsWith("[]"),s=a?o.path.slice(0,-2):o.path,c=s.split(".");let u=i;for(const f of c.slice(0,-1)){if(!ds(u))break;u=u[f]}if(!ds(u))continue;const l=u[c[c.length-1]];if(!(l===void 0&&o.optional)&&!(l===null&&o.optional)){if(!a){n(r,o.path,l,o.shape);continue}if(!Array.isArray(l)){t.push({kind:"payload-invalid",opIndex:r,field:o.path});continue}l.forEach((f,p)=>n(r,`${s}[${p}]`,f,o.shape))}}if(i.kind==="node.add"){const o=i.band;o!==void 0&&(!Number.isInteger(o)||o<0)&&t.push({kind:"payload-invalid",opIndex:r,field:"band"})}}),t}function ah(e,t){const n=dE(e);if(n.length>0)return n;const i=[],r=new Map,o=new Map;function a(p,d,h){if(!fE.test(d)){i.push({kind:"id-invalid",opIndex:p,id:d});return}if(t.categoryOf(d)!==void 0||r.has(d)){i.push({kind:"id-duplicate",opIndex:p,id:d});return}r.set(d,{...h,opIndex:p})}e.forEach((p,d)=>{var h;switch(p.kind){case"participant.add":a(d,p.participant.id,{category:"participant",lanes:(p.participant.lanes??[]).map(m=>m.id)});for(const m of p.participant.lanes??[])a(d,m.id,{category:"lane"});break;case"node.add":a(d,p.node.id,{category:"flowNode",participant:p.node.participant});break;case"sequenceFlow.add":a(d,p.flow.id,{category:"sequenceFlow"});break;case"messageFlow.add":a(d,p.flow.id,{category:"messageFlow"});break;case"dataStore.add":a(d,p.dataStore.id,{category:"dataStore"});for(const m of p.associations??[])m.id&&a(d,m.id,{category:"dataAssociation"});break;case"dataAssociation.add":p.association.id&&a(d,p.association.id,{category:"dataAssociation"});break;case"association.add":p.association.id&&a(d,p.association.id,{category:"association"});break;case"annotation.add":a(d,p.annotation.id,{category:"annotation"}),(h=p.association)!=null&&h.id&&a(d,p.association.id,{category:"association"});break;case"group.add":a(d,p.group.id,{category:"group"});break;case"participant.update":if(p.lanes){o.set(p.id,p.lanes.map(m=>m.id));for(const m of p.lanes)t.categoryOf(m.id)===void 0&&a(d,m.id,{category:"lane"})}break}});const s=p=>{var d;return((d=r.get(p))==null?void 0:d.category)??t.categoryOf(p)},c=p=>{const d=r.get(p);return d?d.category==="participant"?p:d.participant:t.categoryOf(p)==="participant"?p:t.participantOf(p)};function u(p,d,h,m){const g=s(d);if(g===void 0){i.push({kind:"ref-missing",opIndex:p,ref:d,role:h});return}if(m&&!m.includes(g)){i.push({kind:"ref-category",opIndex:p,ref:d,role:h,expected:m.join("|"),actual:g});return}return g}const l=t.isCollaboration()||e.some(p=>p.kind==="participant.add");return e.forEach((p,d)=>{var h;switch(p.kind){case"participant.add":break;case"node.add":{const{participant:m,lane:g}=p.node;if(m===void 0){(l||g!==void 0)&&i.push({kind:"participant-required",opIndex:d,id:p.node.id});break}if(u(d,m,"participant",["participant"])===void 0)break;g!==void 0&&((((h=r.get(m))==null?void 0:h.lanes)??o.get(m)??t.lanesOf(m)).includes(g)||i.push({kind:"lane-unknown",opIndex:d,lane:g,participant:m}));break}case"sequenceFlow.add":{const{id:m,source:g,target:R,name:w,condition:b}=p.flow,x=u(d,g,"source",["flowNode"]),S=u(d,R,"target",["flowNode"]);x&&S&&c(g)!==c(R)&&i.push({kind:"flow-cross-pool",opIndex:d,id:m}),w!==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:R}=p.flow,w=u(d,g,"source",["flowNode","participant"]),b=u(d,R,"target",["flowNode","participant"]);if(w&&b){const x=c(g),S=c(R);x!==void 0&&x===S&&i.push({kind:"message-flow-same-pool",opIndex:d,id:m})}break}case"dataStore.add":{for(const m of p.associations??[]){if([m.source,m.target].filter(w=>w===p.dataStore.id).length!==1){i.push({kind:"data-association-ends",opIndex:d,source:m.source,target:m.target});continue}const R=m.source===p.dataStore.id?m.target:m.source;u(d,R,"dataAssociation",["flowNode"])}break}case"dataAssociation.add":{const{source:m,target:g}=p.association,R=u(d,m,"source"),w=u(d,g,"target");if(R&&w){const b=new Set([R,w]);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:R}=p.association,w=u(d,g,"source"),b=u(d,R,"target");w&&b&&w!=="annotation"&&b!=="annotation"&&i.push({kind:"association-detached",opIndex:d,annotation:m??`${g}->${R}`});break}case"annotation.add":{if(p.association){const{source:m,target:g}=p.association;if(m!==p.annotation.id&&g!==p.annotation.id)i.push({kind:"association-detached",opIndex:d,annotation:p.annotation.id});else{const R=m===p.annotation.id?g:m;u(d,R,"association")}}p.placement&&u(d,p.placement.anchor,"anchor");break}case"group.add":{for(const m of p.group.members??[]){const g=u(d,m,"member");g&&rh.has(g)&&i.push({kind:"ref-category",opIndex:d,ref:m,role:"member",expected:"shape",actual:g})}break}case"participant.update":{if(f(d,p.id,"participant")===void 0)break;if(p.lanes){const m=t.lanesOf(p.id),g=p.lanes.map(w=>w.id);for(const w of m)g.includes(w)||i.push({kind:"lane-shrink-unsupported",opIndex:d,participant:p.id,lane:w});for(const w of g)t.categoryOf(w)!==void 0&&!m.includes(w)&&i.push({kind:"id-duplicate",opIndex:d,id:w});const R=g.filter(w=>m.includes(w));R.length===m.length&&R.some((w,b)=>w!==m[b])&&i.push({kind:"lane-reorder-unsupported",opIndex:d,participant:p.id})}break}case"node.update":{if(f(d,p.id,"flowNode")===void 0)break;if(p.lane!==void 0){const m=t.participantOf(p.id);(m?o.get(m)??t.lanesOf(m):[]).includes(p.lane)||i.push({kind:"lane-unknown",opIndex:d,lane:p.lane,participant:m??""})}break}case"sequenceFlow.update":{if(f(d,p.id,"sequenceFlow")===void 0)break;if(p.name!==void 0&&p.condition!==void 0&&i.push({kind:"condition-name-conflict",opIndex:d,id:p.id}),p.source!==void 0||p.target!==void 0){const m=p.source===void 0||u(d,p.source,"source",["flowNode"])!==void 0,g=p.target===void 0||u(d,p.target,"target",["flowNode"])!==void 0,R=t.endpointsOf(p.id),w=p.source??(R==null?void 0:R.source),b=p.target??(R==null?void 0:R.target);m&&g&&w!==void 0&&b!==void 0&&new Set([c(w),c(b),c(p.id)]).size>1&&i.push({kind:"flow-cross-pool",opIndex:d,id:p.id})}break}case"messageFlow.update":f(d,p.id,"messageFlow");break;case"dataStore.update":f(d,p.id,"dataStore");break;case"annotation.update":{if(f(d,p.id,"annotation")===void 0)break;p.placement&&u(d,p.placement.anchor,"anchor");break}case"group.update":{if(f(d,p.id,"group")===void 0)break;for(const m of p.members??[]){const g=u(d,m,"member");g&&rh.has(g)&&i.push({kind:"ref-category",opIndex:d,ref:m,role:"member",expected:"shape",actual:g})}break}case"element.remove":{f(d,p.id)==="lane"&&i.push({kind:"ref-category",opIndex:d,ref:p.id,role:"target",expected:"removable",actual:"lane"});break}}}),i;function f(p,d,h){if(r.has(d)){i.push({kind:"target-added-in-batch",opIndex:p,id:d});return}const m=t.categoryOf(d);if(m===void 0){i.push({kind:"ref-missing",opIndex:p,ref:d,role:"target"});return}if(h&&m!==h){i.push({kind:"ref-category",opIndex:p,ref:d,role:"target",expected:h,actual:m});return}return m}}function sh(e){return{modeling:e.get("modeling"),bpmnFactory:e.get("bpmnFactory"),elementFactory:e.get("elementFactory"),elementRegistry:e.get("elementRegistry"),canvas:e.get("canvas"),autoPlace:e.get("autoPlace"),bpmnReplace:e.get("bpmnReplace")}}function hs(e){return`bpmn:${e[0].toUpperCase()}${e.slice(1)}`}const qu={"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 Zt(e,t){return e.filter(n=>n.kind===t)}function ch(e,t){var Dx,Ox,Lx,Ix,Nx,Bx;const{modeling:n,bpmnFactory:i,elementFactory:r,elementRegistry:o,canvas:a,autoPlace:s,bpmnReplace:c}=t,u=()=>a.getRootElement(),l=E=>o.get(E),f=E=>{const C=l(E);if(!C)throw new Error(`하강 참조 해소 실패: ${E}`);return C},p=E=>{let C=E.parent;for(;C;){if(C.type==="bpmn:Participant")return C;C=C.parent}},d=Zt(e,"participant.add"),h=Zt(e,"node.add"),m=Zt(e,"sequenceFlow.add"),g=Zt(e,"messageFlow.add"),R=Zt(e,"dataStore.add"),w=Zt(e,"dataAssociation.add"),b=Zt(e,"annotation.add"),x=Zt(e,"group.add"),S=new Map(h.map(E=>[E.node.id,E])),M=(E,C,A)=>{var J;const I=E.businessObject,j=(((J=I.extensionElements)==null?void 0:J.values)??[]).filter(Q=>Q.$type!==C),O=A?[...j,i.create(C,A)]:j;if(!O.length){I.extensionElements&&n.updateProperties(E,{extensionElements:void 0});return}const Y=i.create("bpmn:ExtensionElements",{values:O});O.forEach(Q=>{Q.$parent=Y}),n.updateProperties(E,{extensionElements:Y})},N=E=>({anchor:E.anchor,side:E.side,...E.offset!==void 0?{offset:E.offset}:{}});for(const E of Zt(e,"element.remove")){const C=l(E.id);C&&n.removeElements([C])}const T=E=>o.filter(C=>{var A;return C.type==="bpmn:Lane"&&((A=p(C))==null?void 0:A.id)===E}).sort((C,A)=>C.y-A.y);for(const E of Zt(e,"participant.update")){const C=f(E.id);if(E.name!==void 0&&n.updateProperties(C,{name:E.name??void 0}),!E.lanes)continue;const A=T(E.id);if(!A.length){n.splitLane(C,E.lanes.length),T(E.id).forEach((j,O)=>{const Y=E.lanes[O];Y&&n.updateProperties(j,{id:Y.id,name:Y.name})});continue}const I=new Set(A.map(j=>j.id));E.lanes.forEach((j,O)=>{if(I.has(j.id)){n.updateProperties(f(j.id),{name:j.name});return}const Y=O===0?n.addLane(T(E.id)[0],"top"):n.addLane(f(E.lanes[O-1].id),"bottom");n.updateProperties(Y,{id:j.id,name:j.name})})}const H=150,V=130,$=80,G=90,he=180,Fe=new Set;for(const E of d){Fe.add(`pool:${E.participant.id}`);for(const C of E.participant.lanes??[])Fe.add(C.id)}const pt=new Map;for(const E of h){const C=E.node.lane??`pool:${E.node.participant??""}`;let A=pt.get(C);A||pt.set(C,A=new Set([0])),E.band!==void 0&&A.add(E.band)}const q=new Map;for(const[E,C]of pt){if(!Fe.has(E))continue;const A=[...C].sort((O,Y)=>O-Y),I=A.map((O,Y)=>Y===0?0:Y%2===1?Math.ceil(Y/2):-(Y/2)),j=Math.min(...I);q.set(E,new Map(A.map((O,Y)=>[O,I[Y]-j])))}{const E=new Map;for(const C of d)(C.participant.lanes??[]).forEach((A,I)=>E.set(A.id,I));for(const[C,A]of q){if(!E.has(C)||A.size<2)continue;const I=E.get(C),j=A.get(0)??0,O=new Set;for(const de of h){if(de.node.lane!==C||(de.band??0)!==0||!de.node.type.endsWith("Gateway"))continue;const Se={in:new Set,out:new Set,cross:new Set};for(const _e of m){const et=_e.flow.source===de.node.id;if(!et&&_e.flow.target!==de.node.id)continue;const gt=S.get(et?_e.flow.target:_e.flow.source);if(!gt||gt.node.participant!==de.node.participant||!gt.node.lane)continue;let xt,Wt=!1;if(gt.node.lane!==C){const Ct=E.get(gt.node.lane);if(Ct===void 0)continue;xt=Ct>I?"down":"up",Wt=!0}else{const Ct=A.get(gt.band??0)??j;xt=Ct>j?"down":Ct<j?"up":void 0}xt&&(Se[et?"out":"in"].add(xt),Wt&&Se.cross.add(xt))}for(const _e of["up","down"])Se.in.has(_e)&&Se.out.has(_e)&&Se.cross.has(_e)&&O.add(_e)}if(O.size!==1)continue;const[Y]=O,J=Math.max(...A.values()),Q=Y==="down"?J:0;if(j===Q)continue;const ne=[...A.entries()].filter(([de])=>de!==0).sort((de,Se)=>de[1]-Se[1]),Ue=[...Array(J+1).keys()].filter(de=>de!==Q),Ke=new Map([[0,Q]]);ne.forEach(([de],Se)=>Ke.set(de,Ue[Se])),q.set(C,Ke)}}const me=E=>{var C;return(((C=pt.get(E))==null?void 0:C.size)??0)>1},ge=E=>E.band??(E.node.lane||!me(`pool:${E.node.participant??""}`)?void 0:0),pe=new Map,fe=E=>pe.get(E.node.id)??ge(E),ie=new Set,z=new Set;{const E=new Map;for(const I of m)E.set(I.flow.target,(E.get(I.flow.target)??0)+1);const C=I=>{const j=[],O=new Set([I]),Y=[I];for(;Y.length;){const J=Y.shift();j.push(J);for(const Q of m)Q.flow.source!==J||O.has(Q.flow.target)||(E.get(Q.flow.target)??0)!==1||(O.add(Q.flow.target),Y.push(Q.flow.target))}return j},A=(I,j)=>{var O;return((O=q.get(I))==null?void 0:O.get(j))??j};for(const I of h){if(!I.node.type.endsWith("Gateway"))continue;const j=I.node.lane??`pool:${I.node.participant??""}`,O=q.get(j);if(!O||O.size<2)continue;const Y=fe(I);if(Y===void 0||A(j,Y)!==A(j,0))continue;const J=A(j,Y),Q=m.filter(_e=>_e.flow.source===I.node.id).map(_e=>S.get(_e.flow.target)).filter(_e=>!!_e&&(_e.node.lane??`pool:${_e.node.participant??""}`)===j),ne=Q.filter(_e=>{const et=fe(_e);return et!==void 0&&A(j,et)===J&&(E.get(_e.node.id)??0)===1}),Ue=Q.some(_e=>{const et=fe(_e);return et!==void 0&&A(j,et)>J});if(ne.length!==1||!Ue)continue;const Ke=new Set(Q.flatMap(_e=>C(_e.node.id)));if(!m.some(_e=>_e.flow.target===I.node.id&&Ke.has(_e.flow.source)))continue;const Se=new Map;for(const[_e,et]of O)Se.set(_e,et+1);Se.set(-1,0),q.set(j,Se);for(const _e of C(ne[0].node.id))S.has(_e)&&(pe.set(_e,-1),z.add(_e));ie.add(I.node.id)}}const F=(E,C)=>{var A;return((A=q.get(E))==null?void 0:A.get(C))??C},U=new Map;for(const[E,C]of pt){let A=0;for(const I of C)A=Math.max(A,F(E,I));U.set(E,A)}const Oe=E=>he+H*E,It=d.map((E,C)=>({op:E,declared:C}));It.sort((E,C)=>{const A=E.op.order??Number.POSITIVE_INFINITY,I=C.op.order??Number.POSITIVE_INFINITY;return A!==I?A-I:E.declared-C.declared});let P=80;for(const E of o.getAll())E.parent===u()&&"height"in E&&typeof E.y=="number"&&(P=Math.max(P,E.y+E.height+60));for(const{op:E}of It){const C=E.participant,A=h.filter(de=>de.node.participant===C.id).length,I=((Dx=C.lanes)==null?void 0:Dx.length)??0,j=Math.max(1200,A*160+300),O=(C.lanes??[]).map(de=>Oe(U.get(de.id)??0)),Y=O.reduce((de,Se)=>de+Se,0);I&&Y<300&&(O[I-1]+=300-Y);const J=Math.max(300,H*((U.get(`pool:${C.id}`)??0)+1)),Q=C.blackBox||A+I===0?120:I?Math.max(300,Y):J,ne=r.createShape({type:"bpmn:Participant",businessObject:i.create("bpmn:Participant",{id:C.id,name:C.name,...E.order!==void 0?{"bwl:poolOrder":E.order}:{},...C.blackBox?{}:{processRef:i.create("bpmn:Process")}}),width:j,height:Q,isExpanded:!0}),Ue=n.createShape(ne,{x:100+j/2,y:P+Q/2},u()),Ke=C.lanes??[];if(Ke.length&&n.splitLane(Ue,Ke.length),Ke.length){const de=o.filter(Se=>{var _e;return Se.type==="bpmn:Lane"&&((_e=p(Se))==null?void 0:_e.id)===C.id}).sort((Se,_e)=>Se.y-_e.y);if(de.forEach((Se,_e)=>{const et=Ke[_e];et&&n.updateProperties(Se,{id:et.id,name:et.name})}),O.some(Se=>Se!==Ue.height/I)){let Se=Ue.y;de.forEach((_e,et)=>{const gt=O[et];n.resizeShape(_e,{x:_e.x,y:Se,width:_e.width,height:gt}),Se+=gt})}}P=Ue.y+Ue.height+60}const _=E=>{var I;const C=S.get(E);if(C)return C.node.participant??"";const A=l(E);return A?A.type==="bpmn:Participant"?A.id:((I=p(A))==null?void 0:I.id)??"":""},y=new Map,D=E=>{let C=y.get(E);return C||y.set(E,C={nodes:[],flows:[]}),C};for(const E of h)D(E.node.participant??"").nodes.push(E);for(const E of m)D(_(E.flow.source)).flows.push(E);const B=E=>{var C;return i.create("bpmn:SequenceFlow",{id:E.id,name:E.name??((C=E.condition)==null?void 0:C.label)})},W=(E,C)=>r.createShape({type:hs(E.type),businessObject:i.create(hs(E.type),{id:E.id,name:E.name,...C!==void 0?{"bwl:band":C}:{}})}),le=[...It.map(({op:E})=>E.participant.id).filter(E=>y.has(E)),...[...y.keys()].filter(E=>!d.some(C=>C.participant.id===E))],Me=E=>E.endsWith("Gateway");for(const E of le){const C=y.get(E),A=E?f(E):void 0,I=A?A.x+150:250;let j=A?A.y+80:120;const O=(Ne,Qe,Xe)=>{const ze=u().children.filter(ee=>!("waypoints"in ee&&ee.waypoints)&&ee.id!==Qe&&typeof ee.y=="number"&&ee.y>=Ne);ze.length&&n.moveElements(ze,{x:0,y:Xe})},Y=(Ne,Qe)=>{if(Ne){const ce=f(Ne),ue=Oe(Qe);if(ce.height>=ue)return;const $t=ue-ce.height,re=p(ce),Ze=re?re.y+re.height:ce.y+ce.height;n.resizeLane(ce,{x:ce.x,y:ce.y,width:ce.width,height:ue},!1),O(Ze,re==null?void 0:re.id,$t);return}if(!A)return;const Xe=H*(Qe+1);if(A.height>=Xe)return;const ze=Xe-A.height,ee=A.y+A.height;n.resizeShape(A,{x:A.x,y:A.y,width:A.width,height:Xe}),O(ee,A.id,ze)},J=(Ne,Qe,Xe)=>{if(Ne){const ze=f(Ne);return ze.y+Math.min(ze.height/2,G)+F(Ne,Qe??0)*H}return Qe!==void 0&&A?A.y+$+F(`pool:${E}`,Qe)*H:Xe},Q=(Ne,Qe,Xe)=>{if(Ne){const ze=f(Ne);return ze.y+Math.min(ze.height/2,G)+Qe*H}return A?A.y+$+Qe*H:Xe},ne=Ne=>Ne.participant?f(Ne.participant):u(),Ue=30,Ke=(Ne,Qe,Xe,ze)=>{const ee=Xe-Qe.width/2,ce=ze-Qe.height/2;return(Ne.children??[]).find(ue=>!("waypoints"in ue&&ue.waypoints)&&ue.type!=="bpmn:Lane"&&ue.type!=="label"&&typeof ue.x=="number"&&ee<ue.x+ue.width+Ue&&ee+Qe.width+Ue>ue.x&&ce<ue.y+ue.height&&ce+Qe.height>ue.y)},de=(Ne,Qe,Xe,ze,ee,ce)=>{const ue=Xe!==void 0||ze!==void 0,$t=F(Xe??`pool:${E}`,ze??0);if(ue)for(let be=0;be<4;be++){const ke=Q(Xe,$t+be,ce);if(!Ke(Ne,Qe,ee,ke))return Y(Xe,$t+be),{x:ee,y:ke}}const re=J(Xe,ze,ce);ue&&Y(Xe,$t);let Ze=ee;for(let be=0;be<64;be++){const ke=Ke(Ne,Qe,Ze,re);if(!ke)break;Ze=ke.x+ke.width+V+Qe.width/2}return{x:Ze,y:re}},Se=new Set(C.flows.map(Ne=>Ne.flow.target)),_e=new Map;for(const Ne of C.nodes){if(Se.has(Ne.node.id))continue;const Qe=W(Ne.node,Ne.band),Xe=ge(Ne),ze=Ne.node.lane?`${Ne.node.lane}|${Xe??""}`:Xe!==void 0?`band:${Xe}`:"",ee=ne(Ne.node),ce=de(ee,Qe,Ne.node.lane,Xe,_e.get(ze)??I,j);n.createShape(Qe,ce,ee),_e.set(ze,ce.x+Qe.width+V),!Ne.node.lane&&Xe===void 0&&(j+=160)}const et=new Set,gt=new Map,xt=new Map,Wt=new Map;if(E&&Fe.has(`pool:${E}`)){const Ne=new Map;for(const re of C.flows)Ne.set(re.flow.target,(Ne.get(re.flow.target)??0)+1);const Qe=re=>J(re.node.lane,fe(re),Number.NaN),Xe=new Set,ze=re=>{var ke;const Ze=(ke=S.get(re))==null?void 0:ke.node.participant;if(Ze)return l(Ze);const be=l(re);if(be)return be.type==="bpmn:Participant"?be:p(be)},ee=re=>{const Ze=[],be=new Set([re]),ke=[re];for(;ke.length;){const rt=ke.shift(),He=S.get(rt);He&&Ze.push(He);for(const Re of C.flows)Re.flow.source!==rt||be.has(Re.flow.target)||(Ne.get(Re.flow.target)??0)!==1||(be.add(Re.flow.target),ke.push(Re.flow.target))}return Ze},ce=re=>{if(!A)return;const Ze=new Set(re.map(rt=>rt.node.id));let be=!1,ke=!1;for(const rt of g){if(!Ze.has(rt.flow.source))continue;const He=ze(rt.flow.target);!He||He.id===A.id||(He.y<A.y?be=!0:ke=!0)}return be&&!ke?"up":ke&&!be?"down":void 0};for(const re of C.nodes){if(!Me(re.node.type))continue;const Ze=J(re.node.lane,ge(re),Number.NaN);if(Number.isNaN(Ze))continue;const be=[];for(const Re of C.flows){if(Re.flow.source!==re.node.id)continue;const Ve=S.get(Re.flow.target);if(!Ve||Ve.node.lane!==re.node.lane||(Ne.get(Ve.node.id)??0)!==1)continue;const tt=ge(Ve);if(tt===void 0)continue;const vn=J(Ve.node.lane,tt,Number.NaN);if(Number.isNaN(vn))continue;const Kr=ee(Ve.node.id),Xt=ce(Kr);Xt&&be.push({subtree:Kr,band:tt,row:vn,dir:Xt})}if(!be.some(Re=>Re.dir==="up")||!be.some(Re=>Re.dir==="down")||!be.some(Re=>Re.dir==="up"&&be.some(Ve=>Ve.dir==="down"&&Ve.row<Re.row)))continue;const rt=[...be].sort((Re,Ve)=>Re.row-Ve.row);[...be.filter(Re=>Re.dir==="up"),...be.filter(Re=>Re.dir==="down")].sort((Re,Ve)=>Re.dir===Ve.dir?Re.row-Ve.row:Re.dir==="up"?-1:1).forEach((Re,Ve)=>{const tt=rt[Ve].band;if(tt!==Re.band){Xe.add(re.node.id);for(const vn of Re.subtree)ge(vn)===Re.band&&pe.set(vn.node.id,tt)}})}const ue=re=>{if(!A)return;const Ze=new Set(re.map(rt=>rt.node.id));let be=!1,ke=!1;for(const rt of g){if(!Ze.has(rt.flow.target))continue;const He=ze(rt.flow.source);!He||He.id===A.id||(He.y<A.y?be=!0:ke=!0)}return be&&!ke?"up":ke&&!be?"down":void 0};for(const re of C.nodes){if(!Me(re.node.type))continue;const Ze=re.node.lane??`pool:${E}`,be=q.get(Ze);if(!be||be.size<2)continue;const ke=be.get(0);if(ke===void 0)continue;const rt=Math.max(...be.values()),He=ke===rt&&ke!==0?"down":void 0;if(!He)continue;const Re=[];for(const Xt of C.flows){if(Xt.flow.source!==re.node.id)continue;const ni=S.get(Xt.flow.target);if(!ni||ni.node.lane!==re.node.lane||(Ne.get(ni.node.id)??0)!==1)continue;const $x=fe(ni);$x!==void 0&&Re.push({t:ni,subtree:ee(ni.node.id),band:$x})}const Ve=Re.find(Xt=>(be.get(Xt.band)??Xt.band)===ke);if(!Ve||ue(Ve.subtree)===He||ce(Ve.subtree)===He)continue;const tt=Re.find(Xt=>Xt!==Ve&&ue(Xt.subtree)===He);if(!tt)continue;const vn=Ve.band,Kr=tt.band;for(const Xt of Ve.subtree)fe(Xt)===vn&&pe.set(Xt.node.id,Kr);for(const Xt of tt.subtree)fe(Xt)===Kr&&pe.set(Xt.node.id,vn);Xe.add(re.node.id)}for(const re of C.nodes){if(!Me(re.node.type))continue;const Ze=Qe(re);if(Number.isNaN(Ze)||b.some(Re=>{var Ve,tt;return(((Ve=Re.placement)==null?void 0:Ve.anchor)??(Re.association?Re.association.source===Re.annotation.id?Re.association.target:Re.association.source:void 0))===re.node.id&&((tt=Re.placement)==null?void 0:tt.side.startsWith("bottom"))}))continue;let ke,rt=!1,He;for(const Re of C.flows){if(Re.flow.source!==re.node.id)continue;const Ve=S.get(Re.flow.target);if(!Ve||!Ve.node.lane&&ge(Ve)===void 0)continue;const tt=Qe(Ve);Number.isNaN(tt)||(Math.abs(tt-Ze)<.5&&(rt=!0),tt>Ze?!ke||tt>ke.row?ke={id:Ve.node.id,row:tt,count:1}:tt===ke.row&&ke.count++:tt<Ze&&Ve.node.lane===re.node.lane&&(!He||tt>He.row?He={op:Ve,row:tt,count:1}:tt===He.row&&He.count++))}ke&&ke.count===1&&(Ne.get(ke.id)??0)===1&&!Xe.has(re.node.id)&&et.add(ke.id),!rt&&He&&He.count===1&&(Ne.get(He.op.node.id)??0)===1&&!ie.has(re.node.id)&&gt.set(He.op.node.id,{lane:re.node.lane,band:fe(re)})}const $t=new Map;for(const re of g)$t.set(re.flow.target,[...$t.get(re.flow.target)??[],re]);for(const re of C.nodes){const Ze=$t.get(re.node.id);if(!Ze||Ze.length!==1||!Ne.get(re.node.id)||!re.node.lane&&ge(re)===void 0||z.has(re.node.id))continue;const be=(Ox=S.get(Ze[0].flow.source))==null?void 0:Ox.node.participant,ke=be?l(be):void 0;if(!ke||!A||ke.id===A.id)continue;const rt=re.node.lane??`pool:${E}`,He=q.get(rt);if(!He)continue;const Re=He.get(0)??0,Ve=(He.get(fe(re)??0)??Re)-Re;if(Ve===0)continue;const tt=ke.y<A.y;if(tt&&Ve<0||!tt&&Ve>0)continue;let vn;for(const[Kr,Xt]of He){const ni=Xt-Re;(tt&&ni<0&&(!vn||ni<vn.row)||!tt&&ni>0&&(!vn||ni>vn.row))&&(vn={band:Kr,row:ni})}vn&&xt.set(re.node.id,{lane:re.node.lane,band:vn.band})}}const Ct=new Set;let Bn=0;for(;Bn++<C.nodes.length+2;){for(let Xe=0;Xe<C.nodes.length+C.flows.length+2;Xe++){let ze=!1;for(const ee of C.flows){const ce=ee.flow;if(Ct.has(ce.id))continue;const ue=l(ce.source);if(!ue)continue;const $t=l(ce.target),re=S.get(ce.target);if(!$t&&re){const Ze=W(re.node,re.band),be=fe(re);if(re.node.lane||be!==void 0){const ke=ne(re.node),rt=ue,He=rt.x+(Wt.get(ce.source)??0)+rt.width+V,Re=gt.get(ce.target)??xt.get(ce.target),Ve=de(ke,Ze,Re?Re.lane:re.node.lane,Re?Re.band:be,et.has(ce.target)?rt.x+rt.width/2:He,Number.NaN),tt=n.createShape(Ze,Ve,ke);et.has(ce.target)&&Wt.set(ce.target,He-(tt.x+tt.width/2)),n.connect(ue,tt,{type:"bpmn:SequenceFlow",businessObject:B(ce)})}else s.append(ue,Ze,{connection:{type:"bpmn:SequenceFlow",businessObject:B(ce)}})}else if($t)n.connect(ue,$t,{type:"bpmn:SequenceFlow",businessObject:B(ce)});else continue;Ct.add(ce.id),ze=!0}if(!ze)break}const Ne=C.nodes.filter(Xe=>!l(Xe.node.id));if(!Ne.length)break;const Qe=Ne[0];{const Xe=W(Qe.node,Qe.band),ze=ne(Qe.node),ee=ge(Qe);n.createShape(Xe,de(ze,Xe,Qe.node.lane,ee,I,j),ze),!Qe.node.lane&&ee===void 0&&(j+=160)}}}const Ye=40,ft=(E,C=()=>!0)=>{const A=l(E);if(!A)return[];const I=[A],j=new Set([E]);for(let O=0;O<I.length;O++){const Y=I[O].id;for(const J of m){const Q=J.flow.target;if(J.flow.source!==Y||j.has(Q)||!S.has(Q))continue;j.add(Q);const ne=l(Q);ne&&C(ne)&&I.push(ne)}}return I},it=(E,C=()=>!0)=>{const A=l(E);if(!A)return[];const I=[A],j=new Set([E]);for(let O=0;O<I.length;O++){const Y=I[O].id;for(const J of m){const Q=J.flow.source;if(J.flow.target!==Y||j.has(Q)||!S.has(Q))continue;j.add(Q);const ne=l(Q);ne&&C(ne)&&I.push(ne)}}return I};for(const E of Zt(e,"sequenceFlow.update")){if(E.target===void 0)continue;const C=S.get(E.target);if(!C)continue;const A=l(E.target),I=l(E.id);if(!A||!I)continue;const j=E.source!==void 0?l(E.source):I.source,O=I.target;if(!j||!O||O.id===A.id)continue;const Y=ft(E.target),J=new Set(Y.map(Se=>Se.id)),Q=Math.min(...Y.map(Se=>Se.x)),ne=Math.max(...Y.map(Se=>Se.x+Se.width)),Ue=j.x+j.width,Ke=ne-Q+Ye*2-(O.x-Ue);if(Ke>0){const Se=p(A),_e=(Se==null?void 0:Se.children)??[],et=Wt=>Wt.type==="bpmn:Lane",gt=_e.filter(Wt=>!("waypoints"in Wt&&Wt.waypoints)&&!et(Wt)&&!J.has(Wt.id)&&Wt.x>=O.x),xt=Se?[Se,..._e.filter(Wt=>et(Wt))]:[];gt.length&&n.createSpace(gt,xt,{x:Ke,y:0},"e",O.x-1)}const de=C.node.lane||C.band!==void 0?A.y+A.height/2:j.y+j.height/2;n.moveElements(Y,{x:Ue+Ye-Q,y:de-(A.y+A.height/2)})}const Nt=(E,C)=>{const A=C.target===E,I=f(C.source),j=f(C.target),O=A?"bpmn:DataOutputAssociation":"bpmn:DataInputAssociation";n.connect(I,j,C.id?{type:O,businessObject:i.create(O,{id:C.id})}:{type:O})},ln=100,pn=E=>{for(const C of d){if(!C.participant.blackBox)continue;const A=l(C.participant.id);if(!A)continue;const I=[];for(const O of g){const Y=O.flow.source===C.participant.id?O.flow.target:O.flow.target===C.participant.id?O.flow.source:void 0,J=Y?l(Y):void 0;J&&typeof J.x=="number"&&J.type!=="bpmn:Participant"&&I.push(J)}if(!I.length)continue;const j=Math.max(...I.map(O=>O.x+O.width/2))+ln;if(j>A.x+A.width&&n.resizeShape(A,{x:A.x,y:A.y,width:j-A.x,height:A.height}),!!E)for(const O of g){const Y=l(O.flow.id),J=O.flow.source===C.participant.id?O.flow.target:O.flow.target===C.participant.id?O.flow.source:void 0,Q=J?l(J):void 0;if(!Y||!Q||Q.type==="bpmn:Participant")continue;const ne=Q.x+Q.width/2;if(ne<A.x+10||ne>A.x+A.width-10)continue;const Ue=A.y>Q.y,Ke=Ue?Q.y+Q.height:Q.y,de=Ue?A.y:A.y+A.height,Se=O.flow.source===C.participant.id?[{x:ne,y:de},{x:ne,y:Ke}]:[{x:ne,y:Ke},{x:ne,y:de}],_e=Ft(o),et={..._e.edges.find(gt=>gt.id===O.flow.id),waypoints:Se};Vn(et,Pi(_e)).length||n.updateWaypoints(Y,Se)}}};pn(!1);for(const E of g){const C=E.flow;n.connect(f(C.source),f(C.target),{type:"bpmn:MessageFlow",businessObject:i.create("bpmn:MessageFlow",{id:C.id,name:C.name})})}const ct=20,Bt=30,fn=4,Fo=E=>!("waypoints"in E&&E.waypoints)&&E.type!=="bpmn:Lane"&&E.type!=="label"&&typeof E.x=="number",dn=()=>{const E=Ft(o);return{bad:Xi(E).filter(C=>C.kind==="edge-crosses-shape"||C.kind==="edge-overlap-opposite"||C.kind==="edge-overlap-mixed").length,crossings:Td(E),straight:E.edges.filter(C=>C.type==="bpmn:MessageFlow"&&C.waypoints.length===2).length}},Ln=E=>{const C=Ft(o),A=C.edges.find(I=>I.id===E);return A?Vn(A,Pi(C)).length:0},In=E=>Ln(E)>0,St=E=>Ft(o).edges.filter(C=>C.type==="bpmn:MessageFlow"&&C.id!==E&&C.waypoints.length===2).length,Gi=(E,C)=>{const A=new Set(E.flatMap(O=>O.subtree.map(Y=>Y.id)));for(const O of E){const Y=(O.pool.children??[]).filter(Fo).filter(Q=>!A.has(Q.id));if(O.subtree.some(Q=>Y.some(ne=>Q.x+C<ne.x+ne.width+Bt&&Q.x+C+Q.width+Bt>ne.x&&Q.y<ne.y+ne.height&&Q.y+Q.height>ne.y)))return null}const I=E.map(O=>O.pool.width);n.moveElements(E.flatMap(O=>O.subtree),{x:C,y:0});const j=E.map(O=>{const J=Math.max(...O.subtree.map(Q=>Q.x+Q.width))+150-(O.pool.x+O.pool.width);return J>0&&n.resizeShape(O.pool,{x:O.pool.x,y:O.pool.y,width:O.pool.width+J,height:O.pool.height}),J});return()=>{n.moveElements(E.flatMap(O=>O.subtree),{x:-C,y:0}),E.forEach((O,Y)=>{j[Y]>0&&n.resizeShape(O.pool,{x:O.pool.x,y:O.pool.y,width:I[Y],height:O.pool.height})})}},_u=(E,C,A)=>Gi([{subtree:E,pool:C}],A),Nn=(E,C)=>C.bad>E.bad||C.crossings>E.crossings&&C.straight<=E.straight&&C.bad>=E.bad,qe=(E,C)=>Nn(E,C)||C.straight<E.straight,Je=(E,C,A=()=>!0,I=Nn)=>{const j=dn(),O=Gi(E,C);if(!O)return!1;const Y=dn();return I(j,Y)||!A()?(O(),!1):!0},vx=(E,C,A,I=()=>!0)=>Je([{subtree:E,pool:C}],A,I),bu=E=>{var C;return!!((C=S.get(E))!=null&&C.node.participant)},qa=new Map;for(const E of g){if(!bu(E.flow.target))continue;const C=qa.get(E.flow.target)??[];C.push(E),qa.set(E.flow.target,C)}const jf=[...qa.keys()],_x=new Set(m.map(E=>E.flow.target)),bx=E=>It.findIndex(({op:C})=>C.participant.id===E);jf.sort((E,C)=>{var j,O;const A=_x.has(E)?1:0,I=_x.has(C)?1:0;return A!==I?A-I:bx((j=S.get(E))==null?void 0:j.node.participant)-bx((O=S.get(C))==null?void 0:O.node.participant)});const xu=E=>E.x+E.width/2,eO=E=>{const C=new Map;for(const j of o.getAll()){const O=j;if(!O.waypoints||!O.source||!O.target)continue;(C.get(O.source.id)??C.set(O.source.id,[]).get(O.source.id)).push(O.target.id)}const A=new Set([E]),I=[E];for(let j=0;j<I.length;j++)for(const O of C.get(I[j])??[])A.has(O)||(A.add(O),I.push(O));return A},tO=(E,C)=>{const A=eO(C);let I;for(const j of o.getAll()){const O=j;if(O.type!=="bpmn:MessageFlow"||!O.source||!O.target||O.target.id!==E||A.has(O.source.id))continue;const Y=O.source;if(typeof Y.x!="number"||Y.type==="bpmn:Participant")continue;const J=xu(Y);(I===void 0||J>I)&&(I=J)}return I},Ff=(E,C)=>{const A=l(E.flow.source);if(A)return A.type==="bpmn:Participant"?tO(A.id,C):xu(A)},xx=E=>{let C;for(const A of qa.get(E)??[]){const I=Ff(A,E);I!==void 0&&(!C||I>C.cx)&&(C={op:A,cx:I})}return C==null?void 0:C.op},nO=E=>{const C=xx(E),A=l(E),I=C?Ff(C,E):void 0;return A&&I!==void 0?I-xu(A):void 0},iO=E=>{const C=nO(E);return C!==void 0&&Math.abs(C)<ct},wx=(E,C,A,I,j)=>{var J;const O=new Map([[C,[...E]]]),Y=new Set(E.map(Q=>Q.id));for(let Q=!0;Q;){Q=!1;for(const ne of g){if(ne.flow.id===I)continue;const Ue=Y.has(ne.flow.source),Ke=Y.has(ne.flow.target);if(Ue===Ke||(Ue?ne.flow.source:ne.flow.target)===A)continue;const de=Ue?ne.flow.target:ne.flow.source;if(de===j||!bu(de))continue;const Se=l(ne.flow.id);if(!(Se!=null&&Se.waypoints)||Se.waypoints.length!==2)continue;const _e=l(de),et=(J=S.get(de))==null?void 0:J.node.participant;if(!_e||!et)continue;const gt=ft(de,xt=>xt.x>=_e.x).filter(xt=>!Y.has(xt.id));if(!(!gt.length||gt.some(xt=>xt.id===j))){for(const xt of gt)Y.add(xt.id);O.set(et,[...O.get(et)??[],...gt]),Q=!0}}}return[...O].map(([Q,ne])=>({subtree:ne,pool:f(Q)}))},Hf=E=>{const C=xx(E);if(!C)return null;const A=l(E),I=l(C.flow.source),j=Ff(C,E);if(!A||!I||j===void 0)return null;const O=j-xu(A);if(O>=ct){const Y=S.get(E).node.participant,J=ft(E,Q=>Q.x>=A.x);return{groups:wx(J,Y,E,C.flow.id,C.flow.source),dx:O}}if(-O>=ct&&bu(C.flow.source)){const Y=S.get(C.flow.source).node.participant,J=ft(C.flow.source,Q=>Q.x>=I.x&&!iO(Q.id));return{groups:wx(J,Y,C.flow.source,C.flow.id,E),dx:-O}}return null},Ex=()=>jf.map(E=>({id:E,plan:Hf(E)})).filter(E=>!!E.plan).sort((E,C)=>Math.min(...E.plan.groups.flatMap(A=>A.subtree.map(I=>I.x)))-Math.min(...C.plan.groups.flatMap(A=>A.subtree.map(I=>I.x)))).map(E=>E.id);for(let E=0;E<3;E++){const C=dn(),A=[];for(const j of Ex()){const O=Hf(j);if(!O)continue;const Y=Gi(O.groups,O.dx);Y&&A.push(Y)}if(!A.length)break;if(!qe(C,dn()))continue;for(const j of A.reverse())j();let I=!1;for(const j of Ex()){const O=Hf(j);O&&Je(O.groups,O.dx,()=>!0,qe)&&(I=!0)}if(!I)break}for(const E of jf.flatMap(C=>qa.get(C)??[])){if(!In(E.flow.id))continue;const C=l(E.flow.target);if(!C)continue;const A=f(S.get(E.flow.target).node.participant),I=ft(E.flow.target,J=>J.x>=C.x),j=C.width+V,O=Ln(E.flow.id),Y=St(E.flow.id);for(let J=1;J<=fn;J++){const Q=()=>Ln(E.flow.id)<O&&St(E.flow.id)>=Y;if(vx(I,A,j*J,Q))break}}for(const E of g){if(!In(E.flow.id))continue;const C=l(E.flow.source),A=l(E.flow.target);if(!C||!A||C.type==="bpmn:Participant"||A.type==="bpmn:Participant")continue;const I=C.x+C.width/2;if(Math.abs(I-(A.x+A.width/2))>15)continue;const[j,O]=C.y<A.y?[C.y+C.height,A.y]:[A.y+A.height,C.y],Y=[...S.values()].map(J=>l(J.node.id)).filter(J=>!!J&&J.id!==C.id&&J.id!==A.id).filter(J=>J.x<=I&&I<=J.x+J.width&&J.y+J.height>j&&J.y<O).sort((J,Q)=>J.x-Q.x);for(const J of Y){const Q=(Lx=S.get(J.id))==null?void 0:Lx.node.participant,ne=Q?l(Q):void 0;if(!ne)continue;const Ue=[...S.values()].filter(Ct=>Ct.node.participant===Q).map(Ct=>Ct.node.id),Ke=Ct=>Ct.map(Bn=>l(Bn)).filter(Bn=>!!Bn),Se=[it(J.id,Ct=>{var Bn;return((Bn=S.get(Ct.id))==null?void 0:Bn.node.participant)===Q}),Ke(Ue)].filter(Ct=>Ct.length),_e=J.width+V,et=Ln(E.flow.id),gt=St(E.flow.id),xt=()=>Ln(E.flow.id)<et&&St(E.flow.id)>=gt;let Wt=!1;for(const Ct of Se){for(let Bn=1;Bn<=fn;Bn++)if(vx(Ct,ne,_e*Bn,xt)){Wt=!0;break}if(Wt)break}if(!In(E.flow.id))break}}{const E=A=>A.y+A.height/2,C=[];for(const A of S.keys()){if(!bu(A))continue;const I=m.filter(Y=>Y.flow.target===A);if(I.length!==1)continue;const j=l(I[0].flow.source),O=l(A);!j||!O||!S.has(j.id)||Math.abs(E(j)-E(O))>1||O.x-(j.x+j.width)<=V+1||C.push({id:A,pred:j,node:O})}C.sort((A,I)=>A.node.x-I.node.x);for(const{id:A}of C){const I=S.get(A),j=l(A),O=l(m.find(de=>de.flow.target===A).flow.source);if(!j||!O)continue;const Y=j.x-(O.x+O.width);if(Y<=V+1)continue;const J=f(I.node.participant),Q=ft(A,de=>de.x>=j.x),ne=dn(),Ue=_u(Q,J,-(Y-V));if(!Ue)continue;const Ke=dn();(Ke.bad>ne.bad||Ke.crossings>=ne.crossings||Ke.straight<ne.straight)&&Ue()}}pn(!0);for(const E of R){const C=E.associations??[],A=C.map(O=>O.source===E.dataStore.id?O.target:O.source).map(l).find(Boolean),I=A?p(A)??u():u(),j=A?{x:A.x+A.width/2,y:A.y+A.height+110}:{x:200,y:P+60};n.createShape({type:"bpmn:DataStoreReference",businessObject:i.create("bpmn:DataStoreReference",{id:E.dataStore.id,name:E.dataStore.name})},j,I);for(const O of C)Nt(E.dataStore.id,O)}for(const E of w){const A=f(E.association.target).type==="bpmn:DataStoreReference"?E.association.target:E.association.source;Nt(A,E.association)}let Sx=0;const Rx=10,Cx=(E,C)=>{for(const A of C.map(I=>p(I)).filter(I=>!!I)){const I=Rx,j=A.y,O=A.y+A.height,Y=A.x,J=A.x+A.width;if(Math.abs(E.y-j)<I){const Q=j+I-E.y;E.y+=Q,E.height-=Q}if(Math.abs(E.y+E.height-O)<I&&(E.height=O-I-E.y),Math.abs(E.x-Y)<I){const Q=Y+I-E.x;E.x+=Q,E.width-=Q}Math.abs(E.x+E.width-J)<I&&(E.width=J-I-E.x)}},Px=(E,C)=>{const A=Rx,I=30,j=o.filter(O=>O.type==="bpmn:Group"&&O.id!==C);for(const O of j){const Y=O.x,J=O.x+O.width,Q=O.y,ne=O.y+O.height,Ue=E.y<ne&&Q<E.y+E.height,Ke=E.x<J&&Y<E.x+E.width;if(Ue){if(Math.abs(E.x-J)<A){const de=Math.min(J+A-E.x,I);de>0&&E.width-de>0&&(E.x+=de,E.width-=de)}if(Math.abs(E.x+E.width-Y)<A){const de=Math.min(E.x+E.width-(Y-A),I);de>0&&E.width-de>0&&(E.width-=de)}}if(Ke){if(Math.abs(E.y-ne)<A){const de=Math.min(ne+A-E.y,I);de>0&&E.height-de>0&&(E.y+=de,E.height-=de)}if(Math.abs(E.y+E.height-Q)<A){const de=Math.min(E.y+E.height-(Q-A),I);de>0&&E.height-de>0&&(E.height-=de)}}}};for(const E of x){const C=(E.group.members??[]).map(l).filter(O=>!!O),A=40;let I;if(C.length){const O=Math.min(...C.map(ne=>ne.x))-A,Y=Math.min(...C.map(ne=>ne.y))-A,J=Math.max(...C.map(ne=>ne.x+ne.width))+A,Q=Math.max(...C.map(ne=>ne.y+ne.height))+A;I={x:O,y:Y,width:J-O,height:Q-Y},Cx(I,C),Px(I,E.group.id)}else I={x:300+Sx*350,y:40,width:300,height:200},Sx++;const j=n.createShape({type:"bpmn:Group",businessObject:i.create("bpmn:Group",{id:E.group.id}),width:I.width,height:I.height},{x:I.x+I.width/2,y:I.y+I.height/2},u());E.group.name&&n.updateLabel(j,E.group.name),(Ix=E.group.members)!=null&&Ix.length&&M(j,"bwl:Members",{refs:E.group.members.join(" ")})}const Ax=E=>{const C=E.waypoints;if(C!=null&&C.length){const I=C[Math.floor((C.length-1)/2)];return{x:I.x,y:I.y,width:0,height:0}}const A=E;return{x:A.x,y:A.y,width:A.width,height:A.height}},Tx=(E,C,A,I)=>{const j=C,O=(ee,ce)=>{const[ue,$t]=qu[ee];let re={x:E.x+E.width/2+ue*(E.width/2+j.width/2+ce),y:E.y+E.height/2+$t*(E.height/2+j.height/2+ce)};const Ze=A.x+nn+j.width/2,be=A.x+A.width-nn-j.width/2,ke=A.y+nn+j.height/2,rt=A.y+A.height-nn-j.height/2,He={x:Math.min(be,Math.max(Ze,re.x)),y:Math.min(rt,Math.max(ke,re.y))};return(He.x!==re.x||He.y!==re.y)&&(re=Math.abs(He.x-(E.x+E.width/2))<(E.width+j.width)/2+nn&&Math.abs(He.y-(E.y+E.height/2))<(E.height+j.height)/2+nn?{x:E.x+E.width+nn+j.width/2,y:He.y}:He),re},Y=(A.children??[]).filter(ee=>!("waypoints"in ee&&ee.waypoints)&&ee.type!=="bpmn:Lane"&&ee.type!=="label"&&typeof ee.x=="number"&&ee.id!==I.selfId),J=Ft(o),Q=ee=>{var ue,$t;if(!I.selfId)return!1;const ce=o.get(ee);return!!ce&&(((ue=ce.source)==null?void 0:ue.id)===I.selfId||(($t=ce.target)==null?void 0:$t.id)===I.selfId)},ne=J.edges.filter(ee=>!Q(ee.id)).flatMap(mn),Ue=Uo(J).filter(ee=>ee.owner!==I.selfId).map(ee=>ee.rect),Ke=ee=>({x0:ee.x-j.width/2-nn,x1:ee.x+j.width/2+nn,y0:ee.y-j.height/2-nn,y1:ee.y+j.height/2+nn}),de=ee=>{const ce=Ke(ee);return Y.some(ue=>ce.x0<ue.x+ue.width&&ce.x1>ue.x&&ce.y0<ue.y+ue.height&&ce.y1>ue.y)},Se=ee=>{const ce=Ke(ee);return ne.some(ue=>ue.axis==="h"?ue.at>ce.y0&&ue.at<ce.y1&&ue.lo<ce.x1&&ue.hi>ce.x0:ue.at>ce.x0&&ue.at<ce.x1&&ue.lo<ce.y1&&ue.hi>ce.y0)},_e=ee=>{const ce=Ke(ee);return Ue.some(ue=>ce.x0<ue.x+ue.width&&ce.x1>ue.x&&ce.y0<ue.y+ue.height&&ce.y1>ue.y)},et=J.shapes.filter(ee=>ee.type==="bpmn:Group").flatMap(ee=>[{axis:"h",at:ee.y,lo:ee.x,hi:ee.x+ee.width},{axis:"h",at:ee.y+ee.height,lo:ee.x,hi:ee.x+ee.width},{axis:"v",at:ee.x,lo:ee.y,hi:ee.y+ee.height},{axis:"v",at:ee.x+ee.width,lo:ee.y,hi:ee.y+ee.height}]),gt=ee=>{const ce=Ke(ee);return et.some(ue=>ue.axis==="h"?ue.at>ce.y0&&ue.at<ce.y1&&ue.lo<ce.x1&&ue.hi>ce.x0:ue.at>ce.x0&&ue.at<ce.x1&&ue.lo<ce.y1&&ue.hi>ce.y0)},xt=ee=>de(ee)||Se(ee)||_e(ee)||gt(ee),Wt=ee=>ee.x-j.width/2>=A.x&&ee.x+j.width/2<=A.x+A.width&&ee.y-j.height/2>=A.y&&ee.y+j.height/2<=A.y+A.height;if(I.placement){const ee=be=>be.startsWith("top")?be.replace(/^top/,"bottom"):be.replace(/^bottom/,"top"),ce=be=>be.endsWith("left")?be.replace(/left$/,"right"):be.replace(/right$/,"left"),ue=I.placement.side,$t=[ue,ee(ue),ce(ue),ee(ce(ue)),"top","bottom","left","right","top-left","top-right","bottom-left","bottom-right"],re=I.placement.offset??50;let Ze=O(ue,re);if(xt(Ze)){const be=new Set;for(const ke of $t){if(be.has(ke))continue;be.add(ke);const rt=O(ke,re);if(Wt(rt)&&!xt(rt)){Ze=rt;break}}}return Ze}const Ct=I.from,Bn=A.x+nn+j.width/2,Ne=A.x+A.width-nn-j.width/2,Qe=A.y+nn+j.height/2,Xe=A.y+A.height-nn-j.height/2;let ze={x:Math.min(Ne,Math.max(Bn,Ct.x)),y:Math.min(Xe,Math.max(Qe,Ct.y))};if(xt(ze)){const ee=(E.width+j.width)/2+nn,ue=[{x:ze.x+ee,y:ze.y},{x:ze.x-ee,y:ze.y},{x:ze.x,y:ze.y-j.height-nn},{x:ze.x,y:ze.y+j.height+nn}].filter(Wt).find($t=>!xt($t));ue&&(ze=ue)}return ze};let Ka=0;const Mx=12,kx=14,rO=15,oO=300,aO=E=>{const C=E.split(`
7
- `),A=Math.max(...C.map(O=>ro(O,Mx))),I=Math.max(100,Math.min(oO,Math.ceil(A)+kx)),j=C.reduce((O,Y)=>O+Math.max(1,Math.ceil((ro(Y,Mx)+kx)/I)),0);return{width:I,height:Math.max(30,j*rO+10)}},nn=10;for(const E of b){const C=E.association,A=((Nx=E.placement)==null?void 0:Nx.anchor)??(C?C.source===E.annotation.id?C.target:C.source:void 0),I=A?l(A):void 0,j=I?Ax(I):void 0,O=aO(E.annotation.text??"");let Y;if(j&&E.placement){const[Ue,Ke]=qu[E.placement.side],de=E.placement.offset??50;Y={x:j.x+j.width/2+Ue*(j.width/2+O.width/2+de),y:j.y+j.height/2+Ke*(j.height/2+O.height/2+de)}}else j?(Y={x:j.x+j.width/2+180+Ka%3*260,y:j.y-110-Ka%2*95},Ka++):(Y={x:300+Ka*260,y:60},Ka++);const J=I?p(I)??u():u(),Q=J;j&&typeof Q.x=="number"&&typeof Q.width=="number"&&Q.type==="bpmn:Participant"&&(Y=Tx(j,O,Q,E.placement?{placement:E.placement}:{from:Y}));const ne=n.createShape({type:"bpmn:TextAnnotation",width:O.width,height:O.height,businessObject:i.create("bpmn:TextAnnotation",{id:E.annotation.id,text:E.annotation.text})},Y,J);if(C){const Ue=Ke=>Ke===E.annotation.id?ne:f(Ke);n.connect(Ue(C.source),Ue(C.target),C.id?{type:"bpmn:Association",businessObject:i.create("bpmn:Association",{id:C.id})}:{type:"bpmn:Association"})}E.placement&&M(ne,"bwl:Placement",N(E.placement))}for(const E of Zt(e,"association.add")){const C=E.association;n.connect(f(C.source),f(C.target),C.id?{type:"bpmn:Association",businessObject:i.create("bpmn:Association",{id:C.id})}:{type:"bpmn:Association"})}for(const E of Zt(e,"node.update")){let C=f(E.id);if(E.type&&hs(E.type)!==C.type&&(C=c.replaceElement(C,{type:hs(E.type)})),E.name!==void 0&&n.updateProperties(C,{name:E.name??void 0}),E.lane){const A=f(E.lane),I=A.y+A.height/2-(C.y+C.height/2);I!==0&&n.moveElements([C],{x:0,y:I})}}for(const E of Zt(e,"sequenceFlow.update")){const C=f(E.id);if(E.source!==void 0||E.target!==void 0){const A=C,I=E.source!==void 0?f(E.source):A.source,j=E.target!==void 0?f(E.target):A.target,O=Y=>({x:Y.x+Y.width/2,y:Y.y+Y.height/2});n.reconnect(A,I,j,[O(I),O(j)])}E.name!==void 0&&n.updateProperties(C,{name:E.name??void 0}),E.condition!==void 0&&n.updateProperties(C,{name:((Bx=E.condition)==null?void 0:Bx.label)??void 0})}for(const E of Zt(e,"messageFlow.update"))E.name!==void 0&&n.updateProperties(f(E.id),{name:E.name??void 0});for(const E of Zt(e,"dataStore.update"))E.name!==void 0&&n.updateProperties(f(E.id),{name:E.name??void 0});for(const E of Zt(e,"annotation.update")){const C=f(E.id);if(E.text!==void 0&&n.updateProperties(C,{text:E.text}),E.placement===null)M(C,"bwl:Placement",null);else if(E.placement){const A=f(E.placement.anchor),I=Ax(A),j=p(A)??u(),O=typeof j.x=="number"&&typeof j.width=="number"&&j.type==="bpmn:Participant",[Y,J]=qu[E.placement.side],Q=E.placement.offset??50,ne={x:I.x+I.width/2+Y*(I.width/2+C.width/2+Q),y:I.y+I.height/2+J*(I.height/2+C.height/2+Q)},Ue=O?Tx(I,{width:C.width,height:C.height},j,{placement:E.placement,selfId:E.id}):ne;n.moveElements([C],{x:Ue.x-(C.x+C.width/2),y:Ue.y-(C.y+C.height/2)}),M(C,"bwl:Placement",N(E.placement))}}for(const E of Zt(e,"group.update")){const C=f(E.id);if(E.name!==void 0&&n.updateLabel(C,E.name??""),E.members){const A=E.members.map(l).filter(I=>!!I);if(A.length){const j=Math.min(...A.map(ne=>ne.x))-40,O=Math.min(...A.map(ne=>ne.y))-40,Y=Math.max(...A.map(ne=>ne.x+ne.width))+40,J=Math.max(...A.map(ne=>ne.y+ne.height))+40,Q={x:j,y:O,width:Y-j,height:J-O};Cx(Q,A),Px(Q,E.id),n.resizeShape(C,Q)}M(C,"bwl:Members",{refs:E.members.join(" ")})}}}function uh(e,t,n=ch){const i=sh(e),r=ah(t,Nd(i.elementRegistry)),o={edgeCrossings:{before:0,after:0,pairs:[]}};if(r.length)return{ok:!1,issues:r,findings:[],stats:o};const a=Ft(i.elementRegistry),s=new Set(Xi(a).map(Ki)),c=new Set(a.edges.map(m=>m.id)),u=new Set(a.shapes.map(m=>m.id)),l=Wu(a).length,f=e.get("commandStack");try{Uf(f,()=>{n(t,i),Wd(i,c),zd(i,s),Zd(i,s,c),Kd(i,c),cE(i,c),th(i,s,c),eh(i,c),ih(i,u)})}catch(m){return{ok:!1,issues:[{kind:"lower-failed",message:m instanceof Error?m.message:String(m)}],findings:[],stats:o}}const p=Ft(i.elementRegistry),d=Xi(p).filter(m=>!s.has(Ki(m))),h=Wu(p);return{ok:!0,issues:[],findings:d,stats:{edgeCrossings:{before:l,after:h.length,pairs:h}}}}function hE(e){const t=e.slice(e.indexOf(":")+1);return t.charAt(0).toLowerCase()+t.slice(1)}function mE(e,t){return typeof e.get=="function"?e.get(t):e[t]}function lh(e,t){const n=mE(e,t);return typeof n=="number"&&Number.isFinite(n)?n:void 0}function ph(e,t){var i;return(((i=e.extensionElements)==null?void 0:i.values)??[]).find(r=>(r==null?void 0:r.$type)===t)}function gE(e){return typeof e=="string"&&Eu.includes(e)}function ui(e){if(typeof e=="string")return e;const t=e==null?void 0:e.id;return typeof t=="string"?t:void 0}function fh(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:{}},f=[],p=[],d=[],h=[],m=[],g=[],R=new Set,w=new Set,b=q=>{q&&R.add(q)},x=q=>{R.add(q),w.add(q)},S=q=>{const me=ph(q,"bwl:Placement");if(!me)return;const ge=typeof me.anchor=="string"?me.anchor:void 0;if(!ge||!gE(me.side))return;const pe=typeof me.offset=="number"?me.offset:void 0;m.push({owner:q.id,anchor:ge,side:me.side,...pe!==void 0?{offset:pe}:{}})},M=q=>{const me=ph(q,"bwl:Members"),ge=typeof(me==null?void 0:me.refs)=="string"?me.refs.split(/\s+/).filter(Boolean):[];ge.length&&g.push({owner:q.id,refs:ge})},N=q=>{var me;for(const ge of q)switch(b(ge.id),ge.$type){case"bpmn:TextAnnotation":x(ge.id),s.push({id:ge.id,text:typeof ge.text=="string"?ge.text:""}),S(ge);break;case"bpmn:Association":d.push({id:ge.id,type:ge.$type,source:ui(ge.sourceRef),target:ui(ge.targetRef)});break;case"bpmn:Group":{x(ge.id);const pe=(me=ge.categoryValueRef)==null?void 0:me.value;c.push({id:ge.id,...typeof pe=="string"&&pe?{name:pe}:{}}),M(ge);break}default:u.push({id:ge.id,type:ge.$type,reason:"type-outside-mvp"})}},T=(q,me)=>{const ge=q.flowElements??[],pe=(q.laneSets??[]).flatMap(ie=>ie.lanes??[]),fe=new Map;for(const ie of pe){b(ie.id);for(const z of ie.flowNodeRef??[]){const F=ui(z);F&&fe.set(F,ie.id)}}for(const ie of ge){if(b(ie.id),ie.$type==="bpmn:SequenceFlow"){f.push({id:ie.id,source:ui(ie.sourceRef),target:ui(ie.targetRef),...typeof ie.name=="string"&&ie.name?{name:ie.name}:{}});continue}if(ie.$type==="bpmn:DataStoreReference"){x(ie.id),a.push({id:ie.id,...ie.name?{name:ie.name}:{}});continue}const z=hE(ie.$type);if(!zf(z)){u.push({id:ie.id,type:ie.$type,reason:"type-outside-mvp"});continue}x(ie.id),o.push({id:ie.id,type:z,...ie.name?{name:ie.name}:{},...me?{participant:me}:{},...fe.has(ie.id)?{lane:fe.get(ie.id)}:{}});const F=lh(ie,"bwl:band");F!==void 0&&(l.bands[ie.id]=F);for(const U of ie.dataOutputAssociations??[])b(U.id),h.push({id:U.id,type:U.$type,source:ie.id,target:ui(U.targetRef)});for(const U of ie.dataInputAssociations??[])b(U.id),h.push({id:U.id,type:U.$type,source:ui((U.sourceRef??[])[0]),target:ie.id})}N(q.artifacts??[])};if(n){const q=new Set;for(const me of n.participants??[]){x(me.id);const ge=ui(me.processRef);ge&&q.add(ge);const pe=ge?i.get(ge):void 0,fe=((pe==null?void 0:pe.laneSets)??[]).flatMap(U=>U.lanes??[]),ie=fe.map(U=>({id:U.id,...U.name?{name:U.name}:{}}));for(const U of ie)x(U.id);const z=!pe||(pe.flowElements??[]).length===0&&fe.length===0&&(pe.artifacts??[]).length===0;r.push({id:me.id,...me.name?{name:me.name}:{},...z?{blackBox:!0}:{},...ie.length?{lanes:ie}:{}});const F=lh(me,"bwl:poolOrder");F!==void 0&&(l.poolOrders[me.id]=F),pe&&T(pe,me.id)}for(const me of n.messageFlows??[])b(me.id),p.push({id:me.id,source:ui(me.sourceRef),target:ui(me.targetRef),...typeof me.name=="string"&&me.name?{name:me.name}:{}});N(n.artifacts??[]);for(const[me,ge]of i)!q.has(me)&&(ge.flowElements??[]).length>0&&u.push({id:me,type:ge.$type,reason:"unreachable-process"})}else for(const q of i.values())T(q);const H=[],V=[],$=[],G=[],he=(q,me)=>!!q&&!!me&&w.has(q)&&w.has(me);for(const q of f){if(!he(q.source,q.target)){u.push({id:q.id,type:"bpmn:SequenceFlow",reason:"endpoint-outside-mvp"});continue}H.push({id:q.id,source:q.source,target:q.target,...q.name?{name:q.name}:{}}),w.add(q.id)}for(const q of p){if(!he(q.source,q.target)){u.push({id:q.id,type:"bpmn:MessageFlow",reason:"endpoint-outside-mvp"});continue}V.push({id:q.id,source:q.source,target:q.target,...q.name?{name:q.name}:{}}),w.add(q.id)}for(const q of h){if(!he(q.source,q.target)){u.push({id:q.id??"",type:q.type,reason:"endpoint-outside-mvp"});continue}G.push({...q.id?{id:q.id}:{},source:q.source,target:q.target}),q.id&&w.add(q.id)}for(const q of d){if(!he(q.source,q.target)){u.push({id:q.id??"",type:q.type,reason:"endpoint-outside-mvp"});continue}$.push({...q.id?{id:q.id}:{},source:q.source,target:q.target})}const Fe=new Map(c.map(q=>[q.id,q]));for(const{owner:q,refs:me}of g){const ge=me.filter(fe=>R.has(fe)),pe=Fe.get(q);pe&&ge.length&&(pe.members=ge)}for(const q of m)R.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:H,...V.length?{messageFlows:V}:{},...a.length?{dataStores:a}:{},...G.length?{dataAssociations:G}:{},...s.length?{annotations:s}:{},...$.length?{associations:$}:{},...c.length?{groups:c}:{}},hints:l,omitted:u}}async function yE(e){const{definitions:t,warnings:n}=await Fu(e);return{...fh(t),warnings:n}}function vE(e,t,n,i={}){return{documentId:e,baseVersion:t,ops:[...n],origin:i.origin??"agent",clientOpId:(i.mkClientOpId??(()=>crypto.randomUUID()))()}}async function dh(e,t,{currentVersion:n}){if(t.baseVersion!==n)return{status:"conflict",baseVersion:t.baseVersion,currentVersion:n};const i=uh(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 _E=Symbol("bpmn-editor");function bE(){const e=Pt.ref(!1),t=Pt.ref(!0),n=Pt.ref(!1);let i,r;const o=()=>{e.value=!0};function a(u,l){u.get("canvas").getContainer().style.pointerEvents=l?"":"none";const f=u.get("keyboard");l?(r&&f.bind(r),r=void 0):r||(r=f.getBinding(),f.unbind())}function s(){if(!i)throw new Error("modeler not attached — 뷰 @ready 후 attach() 필요");return i}function c(){return i==null?void 0:i.get("commandStack")}return{dirty:e,editable:t,agentBusy:n,attach(u){i&&this.detach(),i=u,i.get("eventBus").on("commandStack.changed",o),t.value||a(i,!1)},detach(){i==null||i.get("eventBus").off("commandStack.changed",o),i&&!t.value&&a(i,!0),r=void 0,i=void 0},setEditable(u){t.value=u,i&&a(i,u)},async applyAgentBatch(u,l){const f=s();n.value=!0;try{const p=await dh(f,u,{currentVersion:l});return p.status==="applied"&&(e.value=!1),p}finally{n.value=!1}},async importXml(u){const{warnings:l}=await s().importXML(u);return e.value=!1,{warnings:Hu(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 ae(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}function xE(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Ku={exports:{}},hh;function wE(){if(hh)return Ku.exports;hh=1;var e=Ku.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},Ku.exports}var EE=wE(),SE=xE(EE);function li(e){if(!(this instanceof li))return new li(e);e=e||[128,36,1],this._seed=e.length?SE.rack(e[0],e[1],e[2]):e}li.prototype.next=function(e){return this._seed(e||!0)},li.prototype.nextPrefixed=function(e,t){var n;do n=e+this.next(!0);while(this.assigned(n));return this.claim(n,t),n},li.prototype.claim=function(e,t){this._seed.set(e,t||!0)},li.prototype.assigned=function(e){return this._seed.get(e)||!1},li.prototype.unclaim=function(e){delete this._seed.hats[e]},li.prototype.clear=function(){var e=this._seed.hats,t;for(t in e)this.unclaim(t)};const Ht={legend:[1,"<fieldset>","</fieldset>"],tr:[2,"<table><tbody>","</tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],_default:[0,"",""]};Ht.td=Ht.th=[3,"<table><tbody><tr>","</tr></tbody></table>"],Ht.option=Ht.optgroup=[1,'<select multiple="multiple">',"</select>"],Ht.thead=Ht.tbody=Ht.colgroup=Ht.caption=Ht.tfoot=[1,"<table>","</table>"],Ht.polyline=Ht.ellipse=Ht.polygon=Ht.circle=Ht.text=Ht.line=Ht.path=Ht.rect=Ht.g=[1,'<svg xmlns="http://www.w3.org/2000/svg" version="1.1">',"</svg>"];function lt(e,t=globalThis.document){var u;if(typeof e!="string")throw new TypeError("String expected");const n=/^<!--(.*?)-->$/s.exec(e);if(n)return t.createComment(n[1]);const i=(u=/<([\w:]+)/.exec(e))==null?void 0:u[1];if(!i)return t.createTextNode(e);if(e=e.trim(),i==="body"){const l=t.createElement("html");l.innerHTML=e;const{lastChild:f}=l;return f.remove(),f}let[r,o,a]=Object.hasOwn(Ht,i)?Ht[i]:Ht._default,s=t.createElement("div");for(s.innerHTML=o+e+a;r--;)s=s.lastChild;if(s.firstChild===s.lastChild){const{firstChild:l}=s;return l.remove(),l}const c=t.createDocumentFragment();return c.append(...s.childNodes),c}function RE(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 gn(e,...t){const n=e.style;return k(t,function(i){i&&k(i,function(r,o){n[o]=r})}),e}function sn(e,t,n){return arguments.length==2?e.getAttribute(t):n===null?e.removeAttribute(t):(e.setAttribute(t,n),e)}const CE=Object.prototype.toString;function mt(e){return new Zi(e)}function Zi(e){if(!e||!e.nodeType)throw new Error("A DOM element reference is required");this.el=e,this.list=e.classList}Zi.prototype.add=function(e){return this.list.add(e),this},Zi.prototype.remove=function(e){return CE.call(e)=="[object RegExp]"?this.removeMatching(e):(this.list.remove(e),this)},Zi.prototype.removeMatching=function(e){const t=this.array();for(let n=0;n<t.length;n++)e.test(t[n])&&this.remove(t[n]);return this},Zi.prototype.toggle=function(e,t){return typeof t<"u"?t!==this.list.toggle(e,t)&&this.list.toggle(e):this.list.toggle(e),this},Zi.prototype.array=function(){return Array.from(this.list)},Zi.prototype.has=Zi.prototype.contains=function(e){return this.list.contains(e)};function ms(e){for(var t;t=e.firstChild;)e.removeChild(t);return e}function Dr(e,t,n){var i=n?e:e.parentNode;return i&&typeof i.closest=="function"&&i.closest(t)||null}function PE(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var gs={},mh;function AE(){if(mh)return gs;mh=1;var e,t,n;function i(){e=window.addEventListener?"addEventListener":"attachEvent",t=window.removeEventListener?"removeEventListener":"detachEvent",n=e!=="addEventListener"?"on":""}return gs.bind=function(r,o,a,s){return e||i(),r[e](n+o,a,s||!1),a},gs.unbind=function(r,o,a,s){return t||i(),r[t](n+o,a,s||!1),a},gs}var gh=AE(),TE=PE(gh),Pe=RE({__proto__:null,default:TE},[gh]),yh=["focus","blur"];function ME(e,t,n,i,r){return yh.indexOf(n)!==-1&&(r=!0),Pe.bind(e,n,function(o){var a=o.target||o.srcElement;o.delegateTarget=Dr(a,t,!0),o.delegateTarget&&i.call(e,o)},r)}function kE(e,t,n,i){return yh.indexOf(t)!==-1&&(i=!0),Pe.unbind(e,t,n,i)}var Cn={bind:ME,unbind:kE};function Xu(e,t){return e&&typeof e.matches=="function"&&e.matches(t)||!1}function nt(e,t){return t=t||document,t.querySelector(e)}function ys(e,t){return t=t||document,t.querySelectorAll(e)}function pi(e){e.parentNode&&e.parentNode.removeChild(e)}function DE(e,t){if(e.ownerDocument!==t.ownerDocument)try{return t.ownerDocument.importNode(e,!0)}catch{}return e}function OE(e,t){return t.appendChild(DE(e,t))}function Ae(e,t){return OE(t,e),e}var Zu=2,vh={"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":Zu,"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":Zu,"text-anchor":1,"text-decoration":1,"text-rendering":1,"unicode-bidi":1,visibility:1,"word-spacing":1,"writing-mode":1};function LE(e,t){return vh[t]?e.style[t]:e.getAttributeNS(null,t)}function _h(e,t,n){var i=t.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase(),r=vh[i];r?(r===Zu&&typeof n=="number"&&(n=String(n)+"px"),e.style[i]=n):e.setAttributeNS(null,t,n)}function IE(e,t){var n=Object.keys(t),i,r;for(i=0,r;r=n[i];i++)_h(e,r,t[r])}function se(e,t,n){if(typeof t=="string")if(n!==void 0)_h(e,t,n);else return LE(e,t);else IE(e,t);return e}const NE=Object.prototype.toString;function je(e){return new Qi(e)}function Qi(e){if(!e||!e.nodeType)throw new Error("A DOM element reference is required");this.el=e,this.list=e.classList}Qi.prototype.add=function(e){return this.list.add(e),this},Qi.prototype.remove=function(e){return NE.call(e)=="[object RegExp]"?this.removeMatching(e):(this.list.remove(e),this)},Qi.prototype.removeMatching=function(e){const t=this.array();for(let n=0;n<t.length;n++)e.test(t[n])&&this.remove(t[n]);return this},Qi.prototype.toggle=function(e,t){return typeof t<"u"?t!==this.list.toggle(e,t)&&this.list.toggle(e):this.list.toggle(e),this},Qi.prototype.array=function(){return Array.from(this.list)},Qi.prototype.has=Qi.prototype.contains=function(e){return this.list.contains(e)};function vs(e){for(var t;t=e.firstChild;)e.removeChild(t);return e}function bh(e){return e.cloneNode(!0)}var Qu={svg:"http://www.w3.org/2000/svg"},xh='<svg xmlns="'+Qu.svg+'"';function BE(e){var t=!1;e.substring(0,4)==="<svg"?e.indexOf(Qu.svg)===-1&&(e=xh+e.substring(4)):(e=xh+">"+e+"</svg>",t=!0);var n=$E(e);if(!t)return n;for(var i=document.createDocumentFragment(),r=n.firstChild;r.firstChild;)i.appendChild(r.firstChild);return i}function $E(e){var t;return t=new DOMParser,t.async=!1,t.parseFromString(e,"text/xml")}function ye(e,t){var n;return e=e.trim(),e.charAt(0)==="<"?(n=BE(e).firstChild,n=document.importNode(n,!0)):n=document.createElementNS(Qu.svg,e),t&&se(n,t),n}var Ju=null;function wh(){return Ju===null&&(Ju=ye("svg")),Ju}function Eh(e,t){var n,i,r=Object.keys(t);for(n=0;i=r[n];n++)e[i]=t[i];return e}function jE(e,t,n,i,r,o){var a=wh().createSVGMatrix();switch(arguments.length){case 0:return a;case 1:return Eh(a,e);case 6:return Eh(a,{a:e,b:t,c:n,d:i,e:r,f:o})}}function Yo(e){return wh().createSVGTransform()}var Sh=/([&<>]{1})/g,FE=/([&<>\n\r"]{1})/g,HE={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"'"};function el(e,t){function n(i,r){return HE[r]||r}return e.replace(t,n)}function Rh(e,t){var n,i,r,o,a;switch(e.nodeType){case 3:t.push(el(e.textContent,Sh));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,'="',el(o.value,FE),'"');if(e.hasChildNodes()){for(t.push(">"),a=e.childNodes,n=0,i=a.length;n<i;++n)Rh(a.item(n),t);t.push("</",e.tagName,">")}else t.push("/>");break;case 8:t.push("<!--",el(e.nodeValue,Sh),"-->");break;case 4:t.push("<![CDATA[",e.nodeValue,"]]>");break;default:throw new Error("unable to handle node "+e.nodeType)}return t}function zE(e){for(var t=e.firstChild,n=[];t;)Rh(t,n),t=t.nextSibling;return n.join("")}function Ch(e,t){return zE(e)}function zt(e){var t=e.parentNode;return t&&t.removeChild(e),e}function VE(e,t){return t instanceof SVGMatrix?e.createSVGTransformFromMatrix(t):t}function GE(e,t){var n,i;for(e.clear(),n=0;i=t[n];n++)e.appendItem(VE(e,i))}function qo(e,t){var n=e.transform.baseVal;return t&&(Array.isArray(t)||(t=[t]),GE(n,t)),n.consolidate()}const WE=/^class[ {]/;function UE(e){return WE.test(e.toString())}function tl(e){return Array.isArray(e)}function nl(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function _s(...e){e.length===1&&tl(e[0])&&(e=e[0]),e=[...e];const t=e.pop();return t.$inject=e,t}const YE=/constructor\s*[^(]*\(\s*([^)]*)\)/m,qE=/^(?:async\s+)?(?:function\s*[^(]*)?(?:\(\s*([^)]*)\)|(\w+))/m,KE=/\/\*([^*]*)\*\//m;function XE(e){if(typeof e!="function")throw new Error(`Cannot annotate "${e}". Expected a function!`);const t=e.toString().match(UE(e)?YE:qE);if(!t)return[];const n=t[1]||t[2];return n&&n.split(",").map(i=>{const r=i.match(KE);return(r&&r[1]||i).trim()})||[]}function Ph(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 M=c(S.shift());for(;S.length;)M=M[S.shift()];return M}if(nl(o,b))return o[b];if(nl(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(tl(b))b=_s(b.slice());else throw s(`Cannot invoke "${b}". Expected a function!`);const M=(b.$inject||XE(b)).map(N=>nl(x,N)?x[N]:c(N));return{fn:b,dependencies:M}}function l(b){const{fn:x,dependencies:S}=u(b),M=Function.prototype.bind.call(x,null,...S);return new M}function f(b,x,S){const{fn:M,dependencies:N}=u(b,S);return M.apply(x,N)}function p(b){return _s(x=>b.get(x))}function d(b,x){if(x&&x.length){const S=Object.create(null),M=Object.create(null),N=[],T=[],H=[];let V,$,G,he;for(let Fe in r)V=r[Fe],x.indexOf(Fe)!==-1&&(V[2]==="private"?($=N.indexOf(V[3]),$===-1?(G=V[3].createChild([],x),he=p(G),N.push(V[3]),T.push(G),H.push(he),S[Fe]=[he,Fe,"private",G]):S[Fe]=[H[$],Fe,"private",T[$]]):S[Fe]=[V[2],V[1]],M[Fe]=!0),(V[2]==="factory"||V[2]==="type")&&V[1].$scope&&x.forEach(pt=>{V[1].$scope.indexOf(pt)!==-1&&(S[Fe]=[V[2],V[1]],M[pt]=!0)});x.forEach(Fe=>{if(!M[Fe])throw new Error('No provider for "'+Fe+'". Cannot use provider from the parent!')}),b.unshift(S)}return new Ph(b,a)}const h={factory:f,type:l,value:function(b){return b}};function m(b,x){const S=b.__init__||[];return function(){S.forEach(M=>{typeof M=="string"?x.get(M):x.invoke(M)})}}function g(b){const x=b.__exports__;if(x){const S=b.__modules__,M=Object.keys(b).reduce(($,G)=>(G!=="__exports__"&&G!=="__modules__"&&G!=="__init__"&&G!=="__depends__"&&($[G]=b[G]),$),Object.create(null)),N=(S||[]).concat(M),T=d(N),H=_s(function($){return T.get($)});x.forEach(function($){r[$]=[H,$,"private",T]});const V=(b.__init__||[]).slice();return V.unshift(function(){T.init()}),b=Object.assign({},b,{__init__:V}),m(b,T)}return Object.keys(b).forEach(function(S){if(S==="__init__"||S==="__depends__")return;const M=b[S];if(M[2]==="private"){r[S]=M;return}const N=M[0],T=M[1];r[S]=[h[N],ZE(N,T),N]}),m(b,a)}function R(b,x){return b.indexOf(x)!==-1||(b=(x.__depends__||[]).reduce(R,b),b.indexOf(x)!==-1)?b:b.concat(x)}function w(b){const x=b.reduce(R,[]).map(g);let S=!1;return function(){S||(S=!0,x.forEach(M=>M()))}}this.get=c,this.invoke=f,this.instantiate=l,this.createChild=d,this.init=w(e)}function ZE(e,t){return e!=="value"&&tl(t)&&(t=_s(t.slice())),t}var QE=1e3;function Ai(e,t){var n=this;t=t||QE,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)})}Ai.prototype.canRender=function(e){},Ai.prototype.drawShape=function(e,t){},Ai.prototype.drawConnection=function(e,t){},Ai.prototype.getShapePath=function(e){},Ai.prototype.getConnectionPath=function(e){};function Or(e){return e.flat().join(",").replace(/,?([A-Za-z]),?/g,"$1")}function JE(e){return["M",e.x,e.y]}function il(e){return["L",e.x,e.y]}function e1(e,t,n){return["C",e.x,e.y,t.x,t.y,n.x,n.y]}function t1(e,t){const n=e.length,i=[JE(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(il(a));continue}const c=Math.min(t,rl(a.x-o.x,a.y-o.y),rl(s.x-a.x,s.y-a.y));if(!c){i.push(il(a));continue}const u=bs(a,o,c),l=bs(a,o,c*.5),f=bs(a,s,c),p=bs(a,s,c*.5);i.push(il(u)),i.push(e1(l,p,f))}return i}function bs(e,t,n){const i=t.x-e.x,r=t.y-e.y,o=rl(i,r),a=n/o;return{x:e.x+i*a,y:e.y+r*a}}function rl(e,t){return Math.sqrt(Math.pow(e,2)+Math.pow(t,2))}function Ko(e,t,n){Ce(t)&&(n=t,t=null),t||(t={});const i=ye("path",t);return Ce(n)&&(i.dataset.cornerRadius=String(n)),ol(i,e)}function ol(e,t){const n=parseInt(e.dataset.cornerRadius,10)||0;return se(e,{d:Or(t1(t,n))}),e}function xs(e){var t=new Set(e);return Ie(e,function(n){for(var i=n.parent;i;){if(t.has(i))return!1;i=i.parent}return!0})}function Lr(e,t,n){n=n||0,xe(e)||(e=[e]),k(e,function(i,r){var o=t(i,r,n);xe(o)&&o.length&&Lr(o,t,n+1)})}function al(e,t,n){var i=new Set,r=new Set;return Lr(e,function(o,a,s){i.add(o);var c=o.children;if(c&&!r.has(c))return r.add(c),c}),Array.from(i)}function Xo(e,t){return al(e)}function n1(e,t,n){Rr(t)&&(t=!0),Ut(t)&&(n=t,t=!0),n=n||{};var i=Zo(n.allShapes),r=Zo(n.allConnections),o=Zo(n.enclosedElements),a=Zo(n.enclosedConnections),s=Zo(n.topLevel,t&&Jr(e,function(l){return l.id}));function c(l){s[l.source.id]&&s[l.target.id]&&(s[l.id]=[l]),i[l.source.id]&&i[l.target.id]&&(a[l.id]=o[l.id]=l),r[l.id]=l}function u(l){if(o[l.id]=l,l.waypoints)a[l.id]=r[l.id]=l;else return i[l.id]=l,k(l.incoming,c),k(l.outgoing,c),l.children}return Lr(e,u),{allShapes:i,allConnections:r,topLevel:s,enclosedConnections:a,enclosedElements:o}}function Tt(e,t){t=!!t,xe(e)||(e=[e]);var n,i,r,o;return k(e,function(a){var s=a;a.waypoints&&!t&&(s=Tt(a.waypoints,!0));var c=s.x,u=s.y,l=s.height||0,f=s.width||0;(c<n||n===void 0)&&(n=c),(u<i||i===void 0)&&(i=u),(c+f>r||r===void 0)&&(r=c+f),(u+l>o||o===void 0)&&(o=u+l)}),{x:n,y:i,height:o-i,width:r-n}}function so(e,t){var n={};return k(e,function(i){var r=i;r.waypoints&&(r=Tt(r)),!Ce(t.y)&&r.x>t.x&&(n[i.id]=i),!Ce(t.x)&&r.y>t.y&&(n[i.id]=i),r.x>t.x&&r.y>t.y&&(Ce(t.width)&&Ce(t.height)&&r.width+r.x<t.width+t.x&&r.height+r.y<t.height+t.y||!Ce(t.width)||!Ce(t.height))&&(n[i.id]=i)}),n}function Ah(e){return"waypoints"in e?"connection":"x"in e?"shape":"root"}function Th(e){return!!(e&&e.isFrame)}function Zo(e,t){return L({},e||{},t||{})}var i1=1;function Ji(e,t){Ai.call(this,e,i1),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})}ae(Ji,Ai),Ji.prototype.canRender=function(){return!0},Ji.prototype.drawShape=function(t,n,i){var r=ye("rect");return se(r,{x:0,y:0,width:n.width||0,height:n.height||0}),Th(n)?se(r,L({},this.FRAME_STYLE,i||{})):se(r,L({},this.SHAPE_STYLE,i||{})),Ae(t,r),r},Ji.prototype.drawConnection=function(t,n,i){var r=Ko(n.waypoints,L({},this.CONNECTION_STYLE,i||{}));return Ae(t,r),r},Ji.prototype.getShapePath=function(t){var n=t.x,i=t.y,r=t.width,o=t.height,a=[["M",n,i],["l",r,0],["l",0,o],["l",-r,0],["z"]];return Or(a)},Ji.prototype.getConnectionPath=function(t){var n=t.waypoints,i,r,o=[];for(i=0;r=n[i];i++)r=r.original||r,o.push([i===0?"M":"L",r.x,r.y]);return Or(o)},Ji.$inject=["eventBus","styles"];function r1(){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 L(o,{class:n})},this.style=function(n,i){!xe(n)&&!i&&(i=n,n=[]);var r=Sn(n,function(o,a){return L(o,e[a]||{})},{});return i?L(r,i):r},this.computeStyle=function(n,i,r){return xe(i)||(r=i,i=[]),t.style(i||[],L({},r,n||{}))}}const o1={__init__:["defaultRenderer"],defaultRenderer:["type",Ji],styles:["type",r1]};function Et(e,t){if(!e||!t)return-1;var n=e.indexOf(t);return n!==-1&&e.splice(n,1),n}function Rt(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 sl(e,t){return!e||!t?-1:e.indexOf(t)}function Qo(e,t){return!e||!t?-1:Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function cl(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=Qo(e,t);return Math.abs(r/o)<=i}var a1=2;function Ti(e,t){var n=Array.from(arguments).flat();const i={x:"v",y:"h"};for(const[r,o]of Object.entries(i))if(s1(r,n))return o;return!1}function s1(e,t){const n=t[0];return Cr(t,function(i){return Math.abs(n[e]-i[e])<=a1})}function Mh(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 ul(e,t){return{x:Math.round(e.x+(t.x-e.x)/2),y:Math.round(e.y+(t.y-e.y)/2)}}var c1=/,?([a-z]),?/gi,kh=parseFloat,Mt=Math,er=Mt.PI,fi=Mt.min,di=Mt.max,Dh=Mt.pow,tr=Mt.abs,u1=/([a-z])[\s,]*((-?\d*\.?\d*(?:e[-+]?\d+)?[\s]*,?[\s]*)+)/ig,l1=/(-?\d*\.?\d*(?:e[-+]?\d+)?)[\s]*,?[\s]*/ig,Oh=Array.isArray||function(e){return e instanceof Array};function p1(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function f1(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 d1(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 p1(r,i)?(f1(o,i),r[i]):(o.length>=1e3&&delete r[o.shift()],o.push(i),r[i]=e(...arguments),r[i])}return t}function h1(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(u1,function(i,r,o){var a=[],s=r.toLowerCase();for(o.replace(l1,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=pl,n}function m1(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 g1(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 ll(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 pl(){return this.join(",").replace(c1,"$1")}function y1(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=pl,t}function Lh(e,t,n,i,r,o,a,s,c){var u=1-c,l=Dh(u,3),f=Dh(u,2),p=c*c,d=p*c,h=l*e+f*3*c*n+u*3*c*c*r+d*a,m=l*t+f*3*c*i+u*3*c*c*o+d*s;return{x:ws(h),y:ws(m)}}function Ih(e){var t=E1(...e);return ll(t.x0,t.y0,t.x1-t.x0,t.y1-t.y0)}function nr(e,t,n){return t>=e.x&&t<=e.x+e.width&&n>=e.y&&n<=e.y+e.height}function v1(e,t){return e=ll(e),t=ll(t),nr(t,e.x,e.y)||nr(t,e.x2,e.y)||nr(t,e.x,e.y2)||nr(t,e.x2,e.y2)||nr(e,t.x,t.y)||nr(e,t.x2,t.y)||nr(e,t.x,t.y2)||nr(e,t.x2,t.y2)||(e.x<t.x2&&e.x>t.x||t.x<e.x2&&t.x>e.x)&&(e.y<t.y2&&e.y>t.y||t.y<e.y2&&t.y>e.y)}function Nh(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 Bh(e,t,n,i,r,o,a,s,c){c==null&&(c=1),c=c>1?1:c<0?0:c;for(var u=c/2,l=12,f=[-.1252,.1252,-.3678,.3678,-.5873,.5873,-.7699,.7699,-.9041,.9041,-.9816,.9816],p=[.2491,.2491,.2335,.2335,.2032,.2032,.1601,.1601,.1069,.1069,.0472,.0472],d=0,h=0;h<l;h++){var m=u*f[h]+u,g=Nh(m,e,n,r,a),R=Nh(m,t,i,o,s),w=g*g+R*R;d+=p[h]*Mt.sqrt(w)}return u*d}function _1(e,t,n,i,r,o,a,s){if(!(di(e,n)<fi(r,a)||fi(e,n)>di(r,a)||di(t,i)<fi(o,s)||fi(t,i)>di(o,s))){var c=(e*i-t*n)*(r-a)-(e-n)*(r*s-o*a),u=(e*i-t*n)*(o-s)-(t-i)*(r*s-o*a),l=(e-n)*(o-s)-(t-i)*(r-a);if(l){var f=ws(c/l),p=ws(u/l),d=+f.toFixed(2),h=+p.toFixed(2);if(!(d<+fi(e,n).toFixed(2)||d>+di(e,n).toFixed(2)||d<+fi(r,a).toFixed(2)||d>+di(r,a).toFixed(2)||h<+fi(t,i).toFixed(2)||h>+di(t,i).toFixed(2)||h<+fi(o,s).toFixed(2)||h>+di(o,s).toFixed(2)))return{x:f,y:p}}}}function ws(e){return Math.round(e*1e11)/1e11}function b1(e,t,n){var i=Ih(e),r=Ih(t);if(!v1(i,r))return[];var o=Bh(...e),a=Bh(...t),s=jh(e)?1:~~(o/5)||1,c=jh(t)?1:~~(a/5)||1,u=new Array(s+1),l=new Array(c+1),f={},p=[],d,h;for(d=0;d<s+1;d++){var m=Lh(...e,d/s);u[d]={x:m.x,y:m.y,t:d/s}}for(d=0;d<c+1;d++)m=Lh(...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],R=u[d+1],w=l[h],b=l[h+1],x=tr(R.x-g.x)<.01?"y":"x",S=tr(b.x-w.x)<.01?"y":"x",M=_1(g.x,g.y,R.x,R.y,w.x,w.y,b.x,b.y),N;if(M){if(N=M.x.toFixed(9)+"#"+M.y.toFixed(9),f[N])continue;f[N]=!0;var T=g.t+tr((M[x]-g[x])/(R[x]-g[x]))*(R.t-g.t),H=w.t+tr((M[S]-w[S])/(b[S]-w[S]))*(b.t-w.t);T>=0&&T<=1&&H>=0&&H<=1&&p.push({x:M.x,y:M.y,t1:T,t2:H})}}return p}function $h(e,t,n){e=zh(e),t=zh(t);for(var i,r,o,a,s,c,u,l,f,p,d=n?0:[],h=0,m=e.length;h<m;h++){var g=e[h];if(g[0]=="M")i=s=g[1],r=c=g[2];else{g[0]=="C"?(f=[i,r,...g.slice(1)],i=f[6],r=f[7]):(f=[i,r,i,r,s,c,s,c],i=s,r=c);for(var R=0,w=t.length;R<w;R++){var b=t[R];if(b[0]=="M")o=u=b[1],a=l=b[2];else{b[0]=="C"?(p=[o,a,...b.slice(1)],o=p[6],a=p[7]):(p=[o,a,o,a,u,l,u,l],o=u,a=l);var x=b1(f,p);{for(var S=0,M=x.length;S<M;S++)x[S].segment1=h,x[S].segment2=R,x[S].bez1=f,x[S].bez2=p;d=d.concat(x)}}}}}return d}function x1(e){return Oh(e)&&Oh(e[0])}function w1(e){if(m1(e))return e;var t=new Array(e.length),n=0,i=0,r=0,o=0,a=0,s;e[0][0]=="M"&&(n=+e[0][1],i=+e[0][2],r=n,o=i,a++,t[0]=["M",n,i]);for(var c,u,l=a,f=e.length;l<f;l++){if(u=e[l],s=u[0],t[l]=c=new Array(u.length),s!=s.toUpperCase())switch(c[0]=s.toUpperCase(),c[0]){case"A":c[1]=u[1],c[2]=u[2],c[3]=u[3],c[4]=u[4],c[5]=u[5],c[6]=+u[6]+n,c[7]=+u[7]+i;break;case"V":c[1]=+u[1]+i;break;case"H":c[1]=+u[1]+n;break;case"M":r=+u[1]+n,o=+u[2]+i;default:for(var p=1,d=u.length;p<d;p++)c[p]=+u[p]+(p%2?n:i)}else for(var h=0,m=u.length;h<m;h++)c[h]=u[h];switch(s=s.toUpperCase(),c[0]){case"Z":n=+r,i=+o;break;case"H":n=c[1];break;case"V":i=c[1];break;case"M":r=c[c.length-2],o=c[c.length-1];default:n=c[c.length-2],i=c[c.length-1]}}return t.toString=pl,t}function jh(e){return e[0]===e[2]&&e[1]===e[3]&&e[4]===e[6]&&e[5]===e[7]}function Es(e,t,n,i){return[e,t,n,i,n,i]}function Fh(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 Hh(e,t,n,i,r,o,a,s,c,u){var l=er*120/180,f=er/180*(+r||0),p=[],d,h=d1(function(P,_,y){var D=P*Mt.cos(y)-_*Mt.sin(y),B=P*Mt.sin(y)+_*Mt.cos(y);return{x:D,y:B}});if(u)N=u[0],T=u[1],S=u[2],M=u[3];else{d=h(e,t,-f),e=d.x,t=d.y,d=h(s,c,-f),s=d.x,c=d.y;var m=(e-s)/2,g=(t-c)/2,R=m*m/(n*n)+g*g/(i*i);R>1&&(R=Mt.sqrt(R),n=R*n,i=R*i);var w=n*n,b=i*i,x=(o==a?-1:1)*Mt.sqrt(tr((w*b-w*g*g-b*m*m)/(w*g*g+b*m*m))),S=x*n*g/i+(e+s)/2,M=x*-i*m/n+(t+c)/2,N=Mt.asin(((t-M)/i).toFixed(9)),T=Mt.asin(((c-M)/i).toFixed(9));N=e<S?er-N:N,T=s<S?er-T:T,N<0&&(N=er*2+N),T<0&&(T=er*2+T),a&&N>T&&(N=N-er*2),!a&&T>N&&(T=T-er*2)}var H=T-N;if(tr(H)>l){var V=T,$=s,G=c;T=N+l*(a&&T>N?1:-1),s=S+n*Mt.cos(T),c=M+i*Mt.sin(T),p=Hh(s,c,n,i,r,0,a,$,G,[T,V,S,M])}H=T-N;var he=Mt.cos(N),Fe=Mt.sin(N),pt=Mt.cos(T),q=Mt.sin(T),me=Mt.tan(H/4),ge=4/3*n*me,pe=4/3*i*me,fe=[e,t],ie=[e+ge*Fe,t-pe*he],z=[s+ge*q,c-pe*pt],F=[s,c];if(ie[0]=2*fe[0]-ie[0],ie[1]=2*fe[1]-ie[1],u)return[ie,z,F].concat(p);p=[ie,z,F].concat(p).join().split(",");for(var U=[],Oe=0,It=p.length;Oe<It;Oe++)U[Oe]=Oe%2?h(p[Oe-1],p[Oe],f).y:h(p[Oe],p[Oe+1],f).x;return U}function E1(e,t,n,i,r,o,a,s){for(var c=[],u=[[],[]],l,f,p,d,h,m,g,R,w=0;w<2;++w){if(w==0?(f=6*e-12*n+6*r,l=-3*e+9*n-9*r+3*a,p=3*n-3*e):(f=6*t-12*i+6*o,l=-3*t+9*i-9*o+3*s,p=3*i-3*t),tr(l)<1e-12){if(tr(f)<1e-12)continue;d=-p/f,0<d&&d<1&&c.push(d);continue}g=f*f-4*p*l,R=Mt.sqrt(g),!(g<0)&&(h=(-f+R)/(2*l),0<h&&h<1&&c.push(h),m=(-f-R)/(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:fi(...u[0]),y0:fi(...u[1]),x1:di(...u[0]),y1:di(...u[1])}}function zh(e){if(x1(e)||(e=h1(e)),g1(e))return e;for(var t=y1(w1(e)),n={x:0,y:0,bx:0,by:0,X:0,Y:0,qx:null,qy:null},i=function(p,d,h){var m,g;if(!p)return["C",d.x,d.y,d.x,d.y,d.x,d.y];switch(!(p[0]in{T:1,Q:1})&&(d.qx=d.qy=null),p[0]){case"M":d.X=p[1],d.Y=p[2];break;case"A":p=["C",...Hh(d.x,d.y,...p.slice(1))];break;case"S":h=="C"||h=="S"?(m=d.x*2-d.bx,g=d.y*2-d.by):(m=d.x,g=d.y),p=["C",m,g,...p.slice(1)];break;case"T":h=="Q"||h=="T"?(d.qx=d.x*2-d.qx,d.qy=d.y*2-d.qy):(d.qx=d.x,d.qy=d.y),p=["C",...Fh(d.x,d.y,d.qx,d.qy,p[1],p[2])];break;case"Q":d.qx=p[1],d.qy=p[2],p=["C",...Fh(d.x,d.y,p[1],p[2],p[3],p[4])];break;case"L":p=["C",...Es(d.x,d.y,p[1],p[2])];break;case"H":p=["C",...Es(d.x,d.y,p[1],d.y)];break;case"V":p=["C",...Es(d.x,d.y,d.x,p[1])];break;case"Z":p=["C",...Es(d.x,d.y,d.X,d.Y)];break}return p},r=function(p,d){if(p[d].length>7){p[d].shift();for(var h=p[d];h.length;)o[d]="A",p.splice(d++,0,["C",...h.splice(0,6)]);p.splice(d,1),u=t.length}},o=[],a="",s="",c=0,u=t.length;c<u;c++){t[c]&&(a=t[c][0]),a!="C"&&(o[c]=a,c&&(s=o[c-1])),t[c]=i(t[c],n,s),o[c]!="A"&&a=="C"&&(o[c]="C"),r(t,c);var l=t[c],f=l.length;n.x=l[f-2],n.y=l[f-1],n.bx=kh(l[f-4])||n.x,n.by=kh(l[f-3])||n.y}return t}function ot(e){return Ut(e)&&En(e,"waypoints")}function De(e){return Ut(e)&&En(e,"labelTarget")}function S1(e){return Ut(e)&&Zr(e.parent)}function Vh(e){return{x:Math.round(e.x),y:Math.round(e.y),width:Math.round(e.width),height:Math.round(e.height)}}function Mi(e){return{x:Math.round(e.x),y:Math.round(e.y)}}function ve(e){return{top:e.y,right:e.x+(e.width||0),bottom:e.y+(e.height||0),left:e.x}}function Ss(e){return{x:e.left,y:e.top,width:e.right-e.left,height:e.bottom-e.top}}function R1(e){return Mi({x:e.x+(e.width||0)/2,y:e.y+(e.height||0)/2})}function C1(e){for(var t=e.waypoints,n=t.reduce(function(u,l,f){var p=t[f-1];if(p){var d=u[u.length-1],h=d&&d.endLength||0,m=T1(p,l);u.push({start:p,end:l,startLength:h,endLength:h+m,length:m})}return u},[]),i=n.reduce(function(u,l){return u+l.length},0),r=i/2,o=0,a=n[o];a.endLength<r;)a=n[++o];var s=(r-a.startLength)/a.length,c={x:a.start.x+(a.end.x-a.start.x)*s,y:a.start.y+(a.end.y-a.start.y)*s};return c}function we(e){return ot(e)?C1(e):R1(e)}function Qt(e,t,n){n=n||0,Ut(n)||(n={x:n,y:n});var i=ve(e),r=ve(t),o=i.bottom+n.y<=r.top,a=i.left-n.x>=r.right,s=i.top-n.y>=r.bottom,c=i.right+n.x<=r.left,u=o?"top":s?"bottom":null,l=c?"left":a?"right":null;return l&&u?u+"-"+l:l||u||"intersect"}function Jo(e,t,n){var i=P1(e,t);return i.length===1||i.length===2&&Qo(i[0],i[1])<1?Mi(i[0]):i.length>1?(i=ai(i,function(r){var o=Math.floor(r.t2*100)||1;return o=100-o,o=(o<10?"0":"")+o,r.segment2+"#"+o}),Mi(i[n?0:i.length-1])):null}function P1(e,t){return $h(e,t)}function A1(e){e=e.slice();for(var t=0,n,i,r;e[t];)n=e[t],i=e[t-1],r=e[t+1],Qo(n,r)===0||cl(i,r,n)?e.splice(t,1):t++;return e}function T1(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function Rs(e,t){return Math.round(e*t)/t}function Gh(e){return Ce(e)?e+"px":e}function M1(e){for(;e.parent;)e=e.parent;return e}function k1(e){e=L({},{width:"100%",height:"100%"},e);const t=e.container||document.body,n=document.createElement("div");return n.setAttribute("class","djs-container djs-parent"),gn(n,{position:"relative",overflow:"hidden",width:Gh(e.width),height:Gh(e.height)}),t.appendChild(n),n}function Wh(e,t,n){const i=ye("g");je(i).add(t);const r=n!==void 0?n:e.childNodes.length-1;return e.insertBefore(i,e.childNodes[r]||null),i}const D1="base",Uh=0,O1=1,L1={shape:["x","y","width","height"],connection:["waypoints"]};function Ee(e,t,n,i){this._eventBus=t,this._elementRegistry=i,this._graphicsFactory=n,this._rootsIdx=0,this._layers={},this._planes=[],this._rootElement=null,this._focused=!1,this._init(e||{})}Ee.$inject=["config.canvas","eventBus","graphicsFactory","elementRegistry"],Ee.prototype._init=function(e){const t=this._eventBus,n=this._container=k1(e),i=this._svg=ye("svg");se(i,{width:"100%",height:"100%"}),sn(i,"tabindex",0),e.autoFocus&&t.on("element.hover",()=>{this.restoreFocus()}),t.on("element.mousedown",500,o=>{this.focus()}),i.addEventListener("focusin",()=>{this._setFocused(!0)}),i.addEventListener("focusout",()=>{this._setFocused(!1)}),i.addEventListener("mouseover",()=>{this._eventBus.fire("canvas.mouseover")}),i.addEventListener("mouseout",()=>{this._eventBus.fire("canvas.mouseout")}),Ae(n,i);const r=this._viewport=Wh(i,"viewport");e.deferUpdate&&(this._viewboxChanged=Pu(this._viewboxChanged,300)),this._restoreFocus=Pu(this._restoreFocus,0),t.on("diagram.init",()=>{t.fire("canvas.init",{svg:i,viewport:r})}),t.on(["shape.added","connection.added","shape.removed","connection.removed","elements.changed","root.set"],()=>{delete this._cachedViewbox}),t.on("diagram.destroy",500,this._destroy,this),t.on("diagram.clear",500,this._clear,this)},Ee.prototype._destroy=function(){this._restoreFocus.cancel(),this._eventBus.fire("canvas.destroy",{svg:this._svg,viewport:this._viewport});const e=this._container.parentNode;e&&e.removeChild(this._container),delete this._svg,delete this._container,delete this._layers,delete this._planes,delete this._rootElement,delete this._viewport},Ee.prototype._setFocused=function(e){e!=this._focused&&(this._focused=e,this._eventBus.fire("canvas.focus.changed",{focused:e}))},Ee.prototype._clear=function(){this._elementRegistry.getAll().forEach(t=>{const n=Ah(t);n==="root"?this.removeRootElement(t):this._removeElement(t,n)}),this._planes=[],this._rootElement=null,delete this._cachedViewbox},Ee.prototype.focus=function(){this._svg.focus({preventScroll:!0}),this._setFocused(!0)},Ee.prototype.restoreFocus=function(){this._restoreFocus()},Ee.prototype._restoreFocus=function(){document.activeElement===document.body&&this.focus()},Ee.prototype.isFocused=function(){return this._focused},Ee.prototype.getDefaultLayer=function(){return this.getLayer(D1,Uh)},Ee.prototype.getLayer=function(e,t){if(!e)throw new Error("must specify a name");let n=this._layers[e];if(n||(n=this._layers[e]=this._createLayer(e,t)),typeof t<"u"&&n.index!==t)throw new Error("layer <"+e+"> already created at index <"+t+">");return n.group},Ee.prototype._getChildIndex=function(e){return Sn(this._layers,function(t,n){return n.visible&&e>=n.index&&t++,t},0)},Ee.prototype._createLayer=function(e,t){typeof t>"u"&&(t=O1);const n=this._getChildIndex(t);return{group:Wh(this._viewport,"layer-"+e,n),index:t,visible:!0}},Ee.prototype.showLayer=function(e){if(!e)throw new Error("must specify a name");const t=this._layers[e];if(!t)throw new Error("layer <"+e+"> does not exist");const n=this._viewport,i=t.group,r=t.index;if(t.visible)return i;const o=this._getChildIndex(r);return n.insertBefore(i,n.childNodes[o]||null),t.visible=!0,i},Ee.prototype.hideLayer=function(e){if(!e)throw new Error("must specify a name");const t=this._layers[e];if(!t)throw new Error("layer <"+e+"> does not exist");const n=t.group;return t.visible&&(zt(n),t.visible=!1),n},Ee.prototype._removeLayer=function(e){const t=this._layers[e];t&&(delete this._layers[e],zt(t.group))},Ee.prototype.getActiveLayer=function(){const e=this._findPlaneForRoot(this.getRootElement());return e?e.layer:null},Ee.prototype.findRoot=function(e){const t=this._resolveElements(e);let n;for(const i of t){const r=this._findPlaneForRoot(M1(i));if(!r||n&&r.rootElement!==n)return;n=r.rootElement}return n},Ee.prototype.getRootElements=function(){return this._planes.map(function(e){return e.rootElement})},Ee.prototype._findPlaneForRoot=function(e){return ut(this._planes,function(t){return t.rootElement===e})},Ee.prototype._resolveElement=function(e){return typeof e=="string"?this._elementRegistry.get(e):e},Ee.prototype._resolveElements=function(e){return xe(e)||(e=[e]),e.map(t=>this._resolveElement(t)).filter(Boolean)},Ee.prototype.getContainer=function(){return this._container},Ee.prototype._updateMarker=function(e,t,n){let i;e=this._resolveElement(e),e.markers=e.markers||new Set,i=this._elementRegistry._elements[e.id],i&&(k([i.gfx,i.secondaryGfx],function(r){r&&(n?(e.markers.add(t),je(r).add(t)):(e.markers.delete(t),je(r).remove(t)))}),this._eventBus.fire("element.marker.update",{element:e,gfx:i.gfx,marker:t,add:!!n}))},Ee.prototype.addMarker=function(e,t){this._updateMarker(e,t,!0)},Ee.prototype.removeMarker=function(e,t){this._updateMarker(e,t,!1)},Ee.prototype.hasMarker=function(e,t){return e=this._resolveElement(e),e.markers?e.markers.has(t):!1},Ee.prototype.toggleMarker=function(e,t){this.hasMarker(e,t)?this.removeMarker(e,t):this.addMarker(e,t)},Ee.prototype.getRootElement=function(){const e=this._rootElement;return e||this._planes.length?e:this.setRootElement(this.addRootElement(null))},Ee.prototype.addRootElement=function(e){const t=this._rootsIdx++;e||(e={id:"__implicitroot_"+t,children:[],isImplicit:!0});const n=e.layer="root-"+t;this._ensureValid("root",e);const i=this.getLayer(n,Uh);return this.hideLayer(n),this._addRoot(e,i),this._planes.push({rootElement:e,layer:i}),e},Ee.prototype.removeRootElement=function(e){if(e=this._resolveElement(e),!!this._findPlaneForRoot(e))return this._removeRoot(e),this._removeLayer(e.layer),this._planes=this._planes.filter(function(n){return n.rootElement!==e}),this._rootElement===e&&(this._rootElement=null),e},Ee.prototype.setRootElement=function(e){if(e===this._rootElement)return e;let t;if(!e)throw new Error("rootElement required");return t=this._findPlaneForRoot(e),t||(e=this.addRootElement(e)),this._setRoot(e),e},Ee.prototype._removeRoot=function(e){const t=this._elementRegistry,n=this._eventBus;n.fire("root.remove",{element:e}),n.fire("root.removed",{element:e}),t.remove(e)},Ee.prototype._addRoot=function(e,t){const n=this._elementRegistry,i=this._eventBus;i.fire("root.add",{element:e}),n.add(e,t),i.fire("root.added",{element:e,gfx:t})},Ee.prototype._setRoot=function(e,t){const n=this._rootElement;n&&(this._elementRegistry.updateGraphics(n,null,!0),this.hideLayer(n.layer)),e&&(t||(t=this._findPlaneForRoot(e).layer),this._elementRegistry.updateGraphics(e,this._svg,!0),this.showLayer(e.layer)),this._rootElement=e,this._eventBus.fire("root.set",{element:e})},Ee.prototype._ensureValid=function(e,t){if(!t.id)throw new Error("element must have an id");if(this._elementRegistry.get(t.id))throw new Error("element <"+t.id+"> already exists");const n=L1[e];if(!Cr(n,function(r){return typeof t[r]<"u"}))throw new Error("must supply { "+n.join(", ")+" } with "+e)},Ee.prototype._setParent=function(e,t,n){Rt(t.children,e,n),e.parent=t},Ee.prototype._addElement=function(e,t,n,i){n=n||this.getRootElement();const r=this._eventBus,o=this._graphicsFactory;this._ensureValid(e,t),r.fire(e+".add",{element:t,parent:n}),this._setParent(t,n,i);const a=o.create(e,t,i);return this._elementRegistry.add(t,a),o.update(e,t,a),r.fire(e+".added",{element:t,gfx:a}),t},Ee.prototype.addShape=function(e,t,n){return this._addElement("shape",e,t,n)},Ee.prototype.addConnection=function(e,t,n){return this._addElement("connection",e,t,n)},Ee.prototype._removeElement=function(e,t){const n=this._elementRegistry,i=this._graphicsFactory,r=this._eventBus;if(e=n.get(e.id||e),!!e)return r.fire(t+".remove",{element:e}),i.remove(e),Et(e.parent&&e.parent.children,e),e.parent=null,r.fire(t+".removed",{element:e}),n.remove(e),e},Ee.prototype.removeShape=function(e){return this._removeElement(e,"shape")},Ee.prototype.removeConnection=function(e){return this._removeElement(e,"connection")},Ee.prototype.getGraphics=function(e,t){return this._elementRegistry.getGraphics(e,t)},Ee.prototype._changeViewbox=function(e){this._eventBus.fire("canvas.viewbox.changing"),e.apply(this),this._cachedViewbox=null,this._viewboxChanged()},Ee.prototype._viewboxChanged=function(){this._eventBus.fire("canvas.viewbox.changed",{viewbox:this.viewbox()})},Ee.prototype.viewbox=function(e){if(e===void 0&&this._cachedViewbox)return structuredClone(this._cachedViewbox);const t=this._viewport,n=this.getSize();let i,r,o,a,s,c,u;if(e)this._changeViewbox(function(){s=Math.min(n.width/e.width,n.height/e.height);const l=this._svg.createSVGMatrix().scale(s).translate(-e.x,-e.y);qo(t,l)});else return o=this._rootElement?this.getActiveLayer():null,i=o&&o.getBBox()||{},a=qo(t),r=a?a.matrix:jE(),s=Rs(r.a,1e3),c=Rs(-r.e||0,1e3),u=Rs(-r.f||0,1e3),e=this._cachedViewbox={x:c?c/s:0,y:u?u/s:0,width:n.width/s,height:n.height/s,scale:s,inner:{width:i.width||0,height:i.height||0,x:i.x||0,y:i.y||0},outer:n},e;return e},Ee.prototype.scroll=function(e){const t=this._viewport;let n=t.getCTM();return e&&this._changeViewbox(function(){e=L({dx:0,dy:0},e||{}),n=this._svg.createSVGMatrix().translate(e.dx,e.dy).multiply(n),Yh(t,n)}),{x:n.e,y:n.f}},Ee.prototype.scrollToElement=function(e,t){let n=100;const i=this._resolveElements(e);if(!i.length)return;const r=this.findRoot(i);if(!r)return;r!==this.getRootElement()&&this.setRootElement(r);const o=i.filter(h=>h!=r);if(!o.length)return;t||(t={}),typeof t=="number"&&(n=t),t={top:t.top||n,right:t.right||n,bottom:t.bottom||n,left:t.left||n};const a=Tt(o),s=ve(a),c=this.viewbox(),u=this.zoom();let l,f;c.y+=t.top/u,c.x+=t.left/u,c.width-=(t.right+t.left)/u,c.height-=(t.bottom+t.top)/u;const p=ve(c);if(!(a.width<c.width&&a.height<c.height))l=a.x-c.x,f=a.y-c.y;else{const h=Math.max(0,s.right-p.right),m=Math.min(0,s.left-p.left),g=Math.max(0,s.bottom-p.bottom),R=Math.min(0,s.top-p.top);l=h||m,f=g||R}this.scroll({dx:-l*u,dy:-f*u})},Ee.prototype.zoom=function(e,t){if(!e)return this.viewbox(e).scale;if(e==="fit-viewport")return this._fitViewport(t);let n,i;return this._changeViewbox(function(){typeof t!="object"&&(n=this.viewbox().outer,t={x:n.width/2,y:n.height/2}),i=this._setZoom(e,t)}),Rs(i.a,1e3)};function Yh(e,t){const n="matrix("+t.a+","+t.b+","+t.c+","+t.d+","+t.e+","+t.f+")";e.setAttribute("transform",n)}Ee.prototype._fitViewport=function(e){const t=this.viewbox(),n=t.outer,i=t.inner;let r,o;return i.x>=0&&i.y>=0&&i.x+i.width<=n.width&&i.y+i.height<=n.height&&!e?o={x:0,y:0,width:Math.max(i.width+i.x,n.width),height:Math.max(i.height+i.y,n.height)}:(r=Math.min(1,n.width/i.width,n.height/i.height),o={x:i.x+(e?i.width/2-n.width/r/2:0),y:i.y+(e?i.height/2-n.height/r/2:0),width:n.width/r,height:n.height/r}),this.viewbox(o),this.viewbox(!1).scale},Ee.prototype._setZoom=function(e,t){const n=this._svg,i=this._viewport,r=n.createSVGMatrix(),o=n.createSVGPoint();let a,s,c,u,l;c=i.getCTM();const f=c.a;return t?(a=L(o,t),s=a.matrixTransform(c.inverse()),u=r.translate(s.x,s.y).scale(1/f*e).translate(-s.x,-s.y),l=c.multiply(u)):l=r.scale(e),Yh(this._viewport,l),l},Ee.prototype.getSize=function(){return{width:this._container.clientWidth,height:this._container.clientHeight}},Ee.prototype.getAbsoluteBBox=function(e){const t=this.viewbox();let n;e.waypoints?n=this.getGraphics(e).getBBox():n=e;const i=n.x*t.scale-t.x*t.scale,r=n.y*t.scale-t.y*t.scale,o=n.width*t.scale,a=n.height*t.scale;return{x:i,y:r,width:o,height:a}},Ee.prototype.resized=function(){delete this._cachedViewbox,this._eventBus.fire("canvas.resized")};var co="data-element-id";function jn(e){this._elements={},this._eventBus=e}jn.$inject=["eventBus"],jn.prototype.add=function(e,t,n){var i=e.id;this._validateId(i),se(t,co,i),n&&se(n,co,i),this._elements[i]={element:e,gfx:t,secondaryGfx:n}},jn.prototype.remove=function(e){var t=this._elements,n=e.id||e,i=n&&t[n];i&&(se(i.gfx,co,""),i.secondaryGfx&&se(i.secondaryGfx,co,""),delete t[n])},jn.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)},jn.prototype.updateGraphics=function(e,t,n){var i=e.id||e,r=this._elements[i];return n?r.secondaryGfx=t:r.gfx=t,t&&se(t,co,i),t},jn.prototype.get=function(e){var t;typeof e=="string"?t=e:t=e&&se(e,co);var n=this._elements[t];return n&&n.element},jn.prototype.filter=function(e){var t=[];return this.forEach(function(n,i){e(n,i)&&t.push(n)}),t},jn.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}},jn.prototype.getAll=function(){return this.filter(function(e){return e})},jn.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)})},jn.prototype.getGraphics=function(e,t){var n=e.id||e,i=this._elements[n];return i&&(t?i.secondaryGfx:i.gfx)},jn.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 I1(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 N1(e){return e.__refs_collection===!0}function B1(e,t){return Object.prototype.hasOwnProperty.call(e,t.name||t)}function qh(e,t,n){var i=I1(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 $1(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 Gn(e,t){if(!(this instanceof Gn))return new Gn(e,t);e.inverse=t,t.inverse=e,this.props={},this.props[e.name]=e,this.props[t.name]=t}Gn.prototype.bind=function(e,t){if(typeof t=="string"){if(!this.props[t])throw new Error("no property <"+t+"> in ref");t=this.props[t]}t.collection?qh(this,t,e):$1(this,t,e)},Gn.prototype.ensureRefsCollection=function(e,t){var n=e[t.name];return N1(n)||qh(this,t,e),n},Gn.prototype.ensureBound=function(e,t){B1(e,t)||this.bind(e,t)},Gn.prototype.unset=function(e,t,n){e&&(this.ensureBound(e,t),t.collection?this.ensureRefsCollection(e,t).remove(n):e[t.name]=void 0)},Gn.prototype.set=function(e,t,n){e&&(this.ensureBound(e,t),t.collection?this.ensureRefsCollection(e,t).add(n):e[t.name]=n)};var fl=new Gn({name:"children",enumerable:!0,collection:!0},{name:"parent"}),Kh=new Gn({name:"labels",enumerable:!0,collection:!0},{name:"labelTarget"}),Xh=new Gn({name:"attachers",collection:!0},{name:"host"}),Zh=new Gn({name:"outgoing",collection:!0},{name:"source"}),Qh=new Gn({name:"incoming",collection:!0},{name:"target"});function uo(){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)}}),fl.bind(this,"parent"),Kh.bind(this,"labels"),Zh.bind(this,"outgoing"),Qh.bind(this,"incoming")}function ea(){uo.call(this),fl.bind(this,"children"),Xh.bind(this,"host"),Xh.bind(this,"attachers")}ae(ea,uo);function Jh(){uo.call(this),fl.bind(this,"children")}ae(Jh,ea);function em(){ea.call(this),Kh.bind(this,"labelTarget")}ae(em,ea);function tm(){uo.call(this),Zh.bind(this,"source"),Qh.bind(this,"target")}ae(tm,uo);var j1={connection:tm,shape:ea,label:em,root:Jh};function F1(e,t){var n=j1[e];if(!n)throw new Error("unknown type: <"+e+">");return L(new n,t)}function H1(e){return e instanceof uo}function ki(){this._uid=12}ki.prototype.createRoot=function(e){return this.create("root",e)},ki.prototype.createLabel=function(e){return this.create("label",e)},ki.prototype.createShape=function(e){return this.create("shape",e)},ki.prototype.createConnection=function(e){return this.create("connection",e)},ki.prototype.create=function(e,t){return t=L({},t||{}),t.id||(t.id=e+"_"+this._uid++),F1(e,t)};var Cs="__fn",nm=1e3,z1=Array.prototype.slice;function Pn(){this._listeners={},this.on("diagram.destroy",1,this._destroy,this)}Pn.prototype.on=function(e,t,n,i){if(e=xe(e)?e:[e],Yt(t)&&(i=n,n=t,t=nm),!Ce(t))throw new Error("priority must be a number");var r=n;i&&(r=_n(n,i),r[Cs]=n[Cs]||n);var o=this;e.forEach(function(a){o._addListener(a,{priority:t,callback:r,next:null})})},Pn.prototype.once=function(e,t,n,i){var r=this;if(Yt(t)&&(i=n,n=t,t=nm),!Ce(t))throw new Error("priority must be a number");function o(){o.__isTomb=!0;var a=n.apply(i,arguments);return r.off(e,o),a}o[Cs]=n,this.on(e,t,o)},Pn.prototype.off=function(e,t){e=xe(e)?e:[e];var n=this;e.forEach(function(i){n._removeListener(i,t)})},Pn.prototype.createEvent=function(e){var t=new ta;return t.init(e),t},Pn.prototype.fire=function(e,t){var n,i,r,o;if(o=z1.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 ta?n=t:n=this.createEvent(t),o[0]=n;var a=n.type;e!==a&&(n.type=e);try{r=this._invokeListeners(n,o,i)}finally{e!==a&&(n.type=a)}return r===void 0&&n.defaultPrevented&&(r=!1),r}},Pn.prototype.handleError=function(e){return this.fire("error",{error:e})===!1},Pn.prototype._destroy=function(){this._listeners={}},Pn.prototype._invokeListeners=function(e,t,n){for(var i;n&&!e.cancelBubble;)i=this._invokeListener(e,t,n),n=n.next;return i},Pn.prototype._invokeListener=function(e,t,n){var i;if(n.callback.__isTomb)return i;try{i=V1(n.callback,t),i!==void 0&&(e.returnValue=i,e.stopPropagation()),i===!1&&e.preventDefault()}catch(r){if(!this.handleError(r))throw console.error("unhandled error in event listener",r),r}return i},Pn.prototype._addListener=function(e,t){var n=this._getListeners(e),i;if(!n){this._setListeners(e,t);return}for(;n;){if(n.priority<t.priority){t.next=n,i?i.next=t:this._setListeners(e,t);return}i=n,n=n.next}i.next=t},Pn.prototype._getListeners=function(e){return this._listeners[e]},Pn.prototype._setListeners=function(e,t){this._listeners[e]=t},Pn.prototype._removeListener=function(e,t){var n=this._getListeners(e),i,r,o;if(!t){this._setListeners(e,null);return}for(;n;)i=n.next,o=n.callback,(o===t||o[Cs]===t)&&(r?r.next=i:this._setListeners(e,i)),r=n,n=i};function ta(){}ta.prototype.stopPropagation=function(){this.cancelBubble=!0},ta.prototype.preventDefault=function(){this.defaultPrevented=!0},ta.prototype.init=function(e){L(this,e||{})};function V1(e,t){return e.apply(null,t)}function Ir(e){return e.childNodes[0]}function G1(e){return e.parentNode.childNodes[1]}function Ps(e,t,n,i,r){var o=Yo();o.setTranslate(t,n);var a=Yo();a.setRotate(i||0,0,0);var s=Yo();s.setScale(1,1),qo(e,[o,a,s])}function Jt(e,t,n){var i=Yo();i.setTranslate(t,n),qo(e,i)}function im(e,t){var n=Yo();n.setRotate(t,0,0),qo(e,n)}function Fn(e,t){this._eventBus=e,this._elementRegistry=t}Fn.$inject=["eventBus","elementRegistry"],Fn.prototype._getChildrenContainer=function(e){var t=this._elementRegistry.getGraphics(e),n;return e.parent?(n=G1(t),n||(n=ye("g"),je(n).add("djs-children"),Ae(t.parentNode,n))):n=t,n},Fn.prototype._clear=function(e){var t=Ir(e);return ms(t),t},Fn.prototype._createContainer=function(e,t,n,i){var r=ye("g");je(r).add("djs-group"),typeof n<"u"?W1(r,t,t.childNodes[n]):Ae(t,r);var o=ye("g");je(o).add("djs-element"),je(o).add("djs-"+e),i&&je(o).add("djs-frame"),Ae(r,o);var a=ye("g");return je(a).add("djs-visual"),Ae(o,a),o},Fn.prototype.create=function(e,t,n){var i=this._getChildrenContainer(t.parent);return this._createContainer(e,i,n,Th(t))},Fn.prototype.updateContainments=function(e){var t=this,n=this._elementRegistry,i;i=Sn(e,function(r,o){return o.parent&&(r[o.parent.id]=o.parent),r},{}),k(i,function(r){var o=r.children;if(o){var a=t._getChildrenContainer(r),s=a.firstChild;k(o,function(c){var u=n.getGraphics(c).parentNode;u===s?s=s.nextSibling:a.insertBefore(u,s)})}})},Fn.prototype.drawShape=function(e,t,n={}){var i=this._eventBus;return i.fire("render.shape",{gfx:e,element:t,attrs:n})},Fn.prototype.getShapePath=function(e){var t=this._eventBus;return t.fire("render.getShapePath",e)},Fn.prototype.drawConnection=function(e,t,n={}){var i=this._eventBus;return i.fire("render.connection",{gfx:e,element:t,attrs:n})},Fn.prototype.getConnectionPath=function(e){var t=this._eventBus;return t.fire("render.getConnectionPath",e)},Fn.prototype.update=function(e,t,n){if(t.parent){var i=this._clear(n);if(e==="shape")this.drawShape(i,t),Jt(n,t.x,t.y);else if(e==="connection")this.drawConnection(i,t);else throw new Error("unknown type: "+e);t.hidden?se(n,"display","none"):se(n,"display","block")}},Fn.prototype.remove=function(e){var t=this._elementRegistry.getGraphics(e);zt(t.parentNode)};function W1(e,t,n){var i=n||t.firstChild;e!==i&&t.insertBefore(e,i)}const U1={__depends__:[o1],__init__:["canvas"],canvas:["type",Ee],elementRegistry:["type",jn],elementFactory:["type",ki],eventBus:["type",Pn],graphicsFactory:["type",Fn]};function Y1(e){var t=new Ph(e);return t.init(),t}function q1(e){e=e||{};var t={config:["value",e]},n=[t,U1].concat(e.modules||[]);return Y1(n)}function ir(e,t){this._injector=t||q1(e),this.get("eventBus").fire("diagram.init")}ir.prototype.get=function(e,t){return this._injector.get(e,t)},ir.prototype.invoke=function(e,t,n){return this._injector.invoke(e,t,n)},ir.prototype.destroy=function(){this.get("eventBus").fire("diagram.destroy")},ir.prototype.clear=function(){this.get("eventBus").fire("diagram.clear")};function cn(e){return e?"<"+e.$type+(e.id?' id="'+e.id:"")+'" />':"<null>"}function bn(e,t){return e.$instanceOf(t)}function K1(e){return ut(e.rootElements,function(t){return bn(t,"bpmn:Process")||bn(t,"bpmn:Collaboration")})}function X1(e){var t={},n=[],i={};function r(z,F){return function(U){z(U,F)}}function o(z){t[z.id]=z}function a(z){return t[z.id]}function s(z,F){var U=z.gfx;if(U)throw new Error(`already rendered ${cn(z)}`);return e.element(z,i[z.id],F)}function c(z,F){return e.root(z,i[z.id],F)}function u(z,F){try{var U=i[z.id]&&s(z,F);return o(z),U}catch(Oe){l(Oe.message,{element:z,error:Oe}),console.error(`failed to import ${cn(z)}`,Oe)}}function l(z,F){e.error(z,F)}var f=this.registerDi=function(F){var U=F.bpmnElement;U?i[U.id]?l(`multiple DI elements defined for ${cn(U)}`,{element:U}):i[U.id]=F:l(`no bpmnElement referenced in ${cn(F)}`,{element:F})};function p(z){d(z.plane)}function d(z){f(z),k(z.planeElement,h)}function h(z){f(z)}this.handleDefinitions=function(F,U){var Oe=F.diagrams;if(U&&Oe.indexOf(U)===-1)throw new Error("diagram not part of <bpmn:Definitions />");if(!U&&Oe&&Oe.length&&(U=Oe[0]),!U)throw new Error("no diagram to display");i={},p(U);var It=U.plane;if(!It)throw new Error(`no plane for ${cn(U)}`);var P=It.bpmnElement;if(!P)if(P=K1(F),P)l(`correcting missing bpmnElement on ${cn(It)} to ${cn(P)}`),It.bpmnElement=P,f(It);else throw new Error("no process or collaboration to display");var _=c(P,It);if(bn(P,"bpmn:Process")||bn(P,"bpmn:SubProcess"))g(P,_);else if(bn(P,"bpmn:Collaboration"))fe(P,_),R(F.rootElements,_);else throw new Error(`unsupported bpmnElement for ${cn(It)}: ${cn(P)}`);m(n)};var m=this.handleDeferred=function(){for(var F;n.length;)F=n.shift(),F()};function g(z,F){me(z,F),H(z.ioSpecification,F),T(z.artifacts,F),o(z)}function R(z,F){var U=Ie(z,function(Oe){return!a(Oe)&&bn(Oe,"bpmn:Process")&&Oe.laneSets});U.forEach(r(g,F))}function w(z,F){u(z,F)}function b(z,F){k(z,r(w,F))}function x(z,F){u(z,F)}function S(z,F){u(z,F)}function M(z,F){u(z,F)}function N(z,F){u(z,F)}function T(z,F){k(z,function(U){bn(U,"bpmn:Association")?n.push(function(){N(U,F)}):N(U,F)})}function H(z,F){z&&(k(z.dataInputs,r(S,F)),k(z.dataOutputs,r(M,F)))}var V=this.handleSubProcess=function(F,U){me(F,U),T(F.artifacts,U)};function $(z,F){var U=u(z,F);bn(z,"bpmn:SubProcess")&&V(z,U||F),bn(z,"bpmn:Activity")&&H(z.ioSpecification,F),n.push(function(){k(z.dataInputAssociations,r(x,F)),k(z.dataOutputAssociations,r(x,F))})}function G(z,F){u(z,F)}function he(z,F){u(z,F)}function Fe(z,F){n.push(function(){var U=u(z,F);z.childLaneSet&&pt(z.childLaneSet,U||F),ie(z)})}function pt(z,F){k(z.lanes,r(Fe,F))}function q(z,F){k(z,r(pt,F))}function me(z,F){ge(z.flowElements,F),z.laneSets&&q(z.laneSets,F)}function ge(z,F){k(z,function(U){bn(U,"bpmn:SequenceFlow")?n.push(function(){G(U,F)}):bn(U,"bpmn:BoundaryEvent")?n.unshift(function(){$(U,F)}):bn(U,"bpmn:FlowNode")?$(U,F):bn(U,"bpmn:DataObject")||(bn(U,"bpmn:DataStoreReference")||bn(U,"bpmn:DataObjectReference")?he(U,F):l(`unrecognized flowElement ${cn(U)} in context ${cn(F&&F.businessObject)}`,{element:U,context:F}))})}function pe(z,F){var U=u(z,F),Oe=z.processRef;Oe&&g(Oe,U||F)}function fe(z,F){k(z.participants,r(pe,F)),n.push(function(){b(z.messageFlows,F)}),T(z.artifacts,F)}function ie(z){k(z.flowNodeRef,function(F){var U=F.get("lanes");U&&U.push(z)})}}function v(e,t){var n=Z(e);return n&&typeof n.$instanceOf=="function"&&n.$instanceOf(t)}function Le(e,t){return Wi(t,function(n){return v(e,n)})}function Z(e){return e&&e.businessObject||e}function Ge(e){return e&&e.di}function Z1(e,t,n){var i,r,o,a,s=[];function c(u,l){var f={root:function(m,g){return i.add(m,g)},element:function(m,g,R){return i.add(m,g,R)},error:function(m,g){s.push({message:m,context:g})}},p=new X1(f);l=l||u.diagrams&&u.diagrams[0];var d=Q1(u,l);if(!d)throw new Error("no diagram to display");k(d,function(m){p.handleDefinitions(u,m)});var h=l.plane.bpmnElement.id;o.setRootElement(o.findRoot(h+"_plane")||o.findRoot(h))}return new Promise(function(u,l){try{return i=e.get("bpmnImporter"),r=e.get("eventBus"),o=e.get("canvas"),r.fire("import.render.start",{definitions:t}),c(t,n),r.fire("import.render.complete",{error:a,warnings:s}),u({warnings:s})}catch(f){return f.warnings=s,l(f)}})}function Q1(e,t){if(!(!t||!t.plane)){var n=t.plane.bpmnElement,i=n;!v(n,"bpmn:Process")&&!v(n,"bpmn:Collaboration")&&(i=J1(n));var r;v(i,"bpmn:Collaboration")?r=i:r=ut(e.rootElements,function(u){if(v(u,"bpmn:Collaboration"))return ut(u.participants,function(l){return l.processRef===i})});var o=[i];r&&(o=on(r.participants,function(u){return u.processRef}),o.push(r));var a=rm(o),s=[t],c=[n];return k(e.diagrams,function(u){if(u.plane){var l=u.plane.bpmnElement;a.indexOf(l)!==-1&&c.indexOf(l)===-1&&(s.push(u),c.push(l))}}),s}}function rm(e){var t=[];return k(e,function(n){n&&(t.push(n),t=t.concat(rm(n.flowElements)))}),t}function J1(e){for(var t=e;t;){if(v(t,"bpmn:Process"))return t;t=t.$parent}}var eS='<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>',om=eS,am={verticalAlign:"middle"},sm={color:"#404040"},tS={zIndex:"1001",position:"fixed",top:"0",left:"0",right:"0",bottom:"0"},nS={width:"100%",height:"100%",background:"rgba(40,40,40,0.2)"},iS={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"},rS='<div class="bjs-powered-by-lightbox"><div class="backdrop"></div><div class="notice"><a href="https://bpmn.io" target="_blank" rel="noopener" class="link">'+om+'</a><span>Web-based tooling for BPMN, DMN and forms powered by <a href="https://bpmn.io" target="_blank" rel="noopener">bpmn.io</a>.</span></div></div>',hi;function oS(){hi=lt(rS),gn(hi,tS),gn(nt("svg",hi),am),gn(nt(".backdrop",hi),nS),gn(nt(".notice",hi),iS),gn(nt(".link",hi),sm,{margin:"15px 20px 15px 10px",alignSelf:"center"})}function aS(){hi||(oS(),Cn.bind(hi,".backdrop","click",function(e){document.body.removeChild(hi)})),document.body.appendChild(hi)}const As=5,cm="djs-outline-hidden";function yt(e){e=L({},cS,e),this._moddle=this._createModdle(e),this._container=this._createContainer(e),this._init(this._container,this._moddle,e),lS(this._container)}ae(yt,ir),yt.prototype.importXML=async function(t,n){const i=this;function r(a){return i.get("eventBus").createEvent(a)}let o=[];try{t=this._emit("import.parse.start",{xml:t})||t;let a;try{a=await this._moddle.fromXML(t,"bpmn:Definitions")}catch(p){throw this._emit("import.parse.complete",{error:p}),p}let s=a.rootElement;const c=a.references,u=a.warnings,l=a.elementsById;o=o.concat(u),s=this._emit("import.parse.complete",r({error:null,definitions:s,elementsById:l,references:c,warnings:o}))||s;const f=await this.importDefinitions(s,n);return o=o.concat(f.warnings),this._emit("import.done",{error:null,warnings:o}),{warnings:o}}catch(a){let s=a;throw o=o.concat(s.warnings||[]),Ts(s,o),s=sS(s),this._emit("import.done",{error:s,warnings:s.warnings}),s}},yt.prototype.importDefinitions=async function(t,n){return this._setDefinitions(t),{warnings:(await this.open(n)).warnings}},yt.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=uS(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 Z1(this,n,i);return{warnings:r}},yt.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},yt.prototype.saveSVG=async function(){this._emit("saveSVG.start");let t,n;try{const i=this.get("canvas"),r=i.getActiveLayer(),o=nt(":scope > defs",i._svg),a=Ch(r),s=o?"<defs>"+Ch(o)+"</defs>":"",c=i.getContainer();mt(c).add(cm);let u;try{u=r.getBBox()}finally{mt(c).remove(cm)}const l=u.x-As,f=u.y-As,p=u.width+As*2,d=u.height+As*2;t=`<?xml version="1.0" encoding="utf-8"?>
3
+ column: `+G+`
4
+ nested error: `+S.message;if(N)return a.addWarning({message:V,error:S}),!0;throw qi(V)}function l(S,M){return u(S,M,!0)}function f(){var S=a.elementsById,M=a.references,N,T;for(N=0;T=M[N];N++){var H=T.element,G=S[T.id],$=Ci(H).propertiesByName[T.property];if(G||a.addWarning({message:"unresolved reference <"+T.id+">",element:T.element,property:T.property,value:T.id}),$.isMany){var V=H.get($.name),de=V.indexOf(T);de===-1&&(de=V.length),G?V[de]=G:V.splice(de,1)}else H.set($.name,G)}}function p(){c.pop().handleEnd()}var d=/^<\?xml /i,h=/ encoding="([^"]+)"/i,m=/^utf-8$/i;function g(S){if(d.test(S)){var M=h.exec(S),N=M&&M[1];!N||m.test(N)||a.addWarning({message:"unsupported document encoding <"+N+">, falling back to UTF-8"})}}function R(S,M){var N=c.peek();try{c.push(N.handleNode(S))}catch(T){u(T,M,o)&&c.push(new Lu)}}function E(S,M){try{c.peek().handleText(S)}catch(N){l(N,M)}}function x(S,M){S.trim()&&E(S,M)}var w=r.getPackages().reduce(function(S,M){return S[M.uri]=M.prefix,S},Object.entries(Du).reduce(function(S,[M,N]){return S[N]=M,S},r.config&&r.config.nsMap||{}));return s.ns(w).on("openTag",function(S,M,N,T){var H=S.attrs||{},G=Object.keys(H).reduce(function(V,de){var Ge=M(H[de]);return V[de]=Ge,V},{}),$={name:S.name,originalName:S.originalName,attributes:G,ns:S.ns};R($,T)}).on("question",g).on("closeTag",p).on("cdata",E).on("text",function(S,M,N){x(M(S),N)}).on("error",u).on("warn",l),new Promise(function(S,M){var N;try{s.parse(e),f()}catch(V){N=V}var T=i.element;!N&&!T&&(N=qi("failed to parse document as <"+i.type.$descriptor.name+">"));var H=a.warnings,G=a.references,$=a.elementsById;return N?(N.warnings=H,M(N)):S({rootElement:T,elementsById:$,references:G,warnings:H})})},Bu.prototype.handler=function(e){return new Nu(this.model,e)};function T0(){var e=[];return Object.defineProperty(e,"peek",{value:function(){return this[this.length-1]}}),e}var M0=`<?xml version="1.0" encoding="UTF-8"?>
5
+ `,k0=/<|>|'|"|&|\n\r|\n/g,fd=/<|>|&/g;function si(e){this.prefixMap={},this.uriMap={},this.used={},this.wellknown=[],this.custom=[],this.parent=e,this.defaultPrefixMap=e&&e.defaultPrefixMap||{}}si.prototype.mapDefaultPrefixes=function(e){this.defaultPrefixMap=e},si.prototype.defaultUriByPrefix=function(e){return this.defaultPrefixMap[e]},si.prototype.byUri=function(e){return this.uriMap[e]||this.parent&&this.parent.byUri(e)},si.prototype.add=function(e,t){this.uriMap[e.uri]=e,t?this.wellknown.push(e):this.custom.push(e),this.mapPrefix(e.prefix,e.uri)},si.prototype.uriByPrefix=function(e){return this.prefixMap[e||"xmlns"]||this.parent&&this.parent.uriByPrefix(e)},si.prototype.mapPrefix=function(e,t){this.prefixMap[e||"xmlns"]=t},si.prototype.getNSKey=function(e){return e.prefix!==void 0?e.uri+"|"+e.prefix:e.uri},si.prototype.logUsed=function(e){var t=e.uri,n=this.getNSKey(e);this.used[n]=this.byUri(t),this.parent&&this.parent.logUsed(e)},si.prototype.getUsed=function(e){var t=[].concat(this.wellknown,this.custom);return t.filter(n=>{var i=this.getNSKey(n);return this.used[i]})};function O0(e){return e.charAt(0).toLowerCase()+e.slice(1)}function D0(e,t){return cd(t)?O0(e):e}function dd(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})}function hd(e){return Sn(e)?e:(e.prefix?e.prefix+":":"")+e.localName}function L0(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 I0(e,t){return t.isGeneric?I({localName:t.ns.localName},e):I({localName:D0(t.ns.localName,t.$pkg)},e)}function N0(e,t){return I({localName:t.ns.localName},e)}function B0(e){var t=e.$descriptor;return Be(t.properties,function(n){var i=n.name;if(n.isVirtual||!Rn(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"},j0={"<":"lt",">":"gt","&":"amp"};function md(e,t,n){return e=Sn(e)?e:""+e,e.replace(t,function(i){return"&"+n[i]+";"})}function F0(e){return md(e,k0,$0)}function H0(e){return md(e,fd,j0)}function z0(e){return Be(e,function(t){return t.isAttr})}function G0(e){return Be(e,function(t){return!t.isAttr})}function $u(e){this.tagName=e}$u.prototype.build=function(e){return this.element=e,this},$u.prototype.serializeTo=function(e){e.appendIndent().append("<"+this.tagName+">"+this.element.id+"</"+this.tagName+">").appendNewLine()};function Tr(){}Tr.prototype.serializeValue=Tr.prototype.serializeTo=function(e){e.append(this.escape?H0(this.value):this.value)},Tr.prototype.build=function(e,t){return this.value=t,e.type==="String"&&t.search(fd)!==-1&&(this.escape=!0),this};function ju(e){this.tagName=e}dd(ju,Tr),ju.prototype.serializeTo=function(e){e.appendIndent().append("<"+this.tagName+">"),this.serializeValue(e),e.append("</"+this.tagName+">").appendNewLine()};function mt(e,t){this.body=[],this.attrs=[],this.parent=e,this.propertyDescriptor=t}mt.prototype.build=function(e){this.element=e;var t=e.$descriptor,n=this.propertyDescriptor,i,r,o=t.isGeneric;return o?i=this.parseGenericNsAttributes(e):i=this.parseNsAttributes(e),n?this.ns=this.nsPropertyTagName(n):this.ns=this.nsTagName(t),this.tagName=this.addTagName(this.ns),o?this.parseGenericContainments(e):(r=B0(e),this.parseAttributes(z0(r)),this.parseContainments(G0(r))),this.parseGenericAttributes(e,i),this},mt.prototype.nsTagName=function(e){var t=this.logNamespaceUsed(e.ns);return I0(t,e)},mt.prototype.nsPropertyTagName=function(e){var t=this.logNamespaceUsed(e.ns);return N0(t,e)},mt.prototype.isLocalNs=function(e){return e.uri===this.ns.uri},mt.prototype.nsAttributeName=function(e){var t;if(Sn(e)?t=sn(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}:I({localName:t.localName},n)},mt.prototype.parseGenericNsAttributes=function(e){return Object.entries(e).filter(([t,n])=>!t.startsWith("$")&&this.parseNsAttribute(e,t,n)).map(([t,n])=>({name:t,value:n}))},mt.prototype.parseGenericContainments=function(e){var t=e.$body;t&&this.body.push(new Tr().build({type:"String"},t));var n=e.$children;n&&k(n,i=>{this.body.push(new mt(this).build(i))})},mt.prototype.parseNsAttribute=function(e,t,n){var i=e.$model,r=sn(t),o;if(r.prefix==="xmlns"&&(o={prefix:r.localName,uri:n}),!r.prefix&&r.localName==="xmlns"&&(o={uri:n}),!o)return{name:t,value:n};if(i&&i.getPackage(n))this.logNamespace(o,!0,!0);else{var a=this.logNamespaceUsed(o,!0);this.getNamespaces().logUsed(a)}},mt.prototype.parseNsAttributes=function(e){var t=this,n=e.$attrs,i=[];return k(n,function(r,o){var a=t.parseNsAttribute(e,o,r);a&&i.push(a)}),i},mt.prototype.parseGenericAttributes=function(e,t){var n=this;k(t,function(i){try{n.addAttribute(n.nsAttributeName(i.name),i.value)}catch(r){typeof console<"u"&&console.warn(`missing namespace information for <${i.name}=${i.value}> on`,e,r)}})},mt.prototype.parseContainments=function(e){var t=this,n=this.body,i=this.element;k(e,function(r){var o=i.get(r.name),a=r.isReference,s=r.isMany;if(s||(o=[o]),r.isBody)n.push(new Tr().build(r,o[0]));else if(td(r.type))k(o,function(u){n.push(new ju(t.addTagName(t.nsPropertyTagName(r))).build(r,u))});else if(a)k(o,function(u){n.push(new $u(t.addTagName(t.nsPropertyTagName(r))).build(u))});else{var c=ld(r);k(o,function(u){var l;c?c===ud?l=new mt(t,r):l=new rs(t,r,c):l=new mt(t),n.push(l.build(u))})}})},mt.prototype.getNamespaces=function(e){var t=this.namespaces,n=this.parent,i;return t||(i=n&&n.getNamespaces(),e||!i?this.namespaces=t=new si(i):t=i),t},mt.prototype.logNamespace=function(e,t,n){var i=this.getNamespaces(n),r=e.uri,o=e.prefix,a=i.byUri(r);return(!a||n)&&i.add(e,t),i.mapPrefix(o,r),e},mt.prototype.logNamespaceUsed=function(e,t){var n=this.getNamespaces(t),i=e.prefix,r=e.uri,o,a,s;if(!i&&!r)return{localName:e.localName};if(s=n.defaultUriByPrefix(i),r=r||s||n.uriByPrefix(i),!r)throw new Error("no namespace uri given for prefix <"+i+">");if(e=n.byUri(r),!e&&!i&&(e=this.logNamespace({uri:r},s===r,!0)),!e){for(o=i,a=1;n.uriByPrefix(o);)o=i+"_"+a++;e=this.logNamespace({prefix:o,uri:r},s===r)}return i&&n.mapPrefix(i,r),e},mt.prototype.parseAttributes=function(e){var t=this,n=this.element;k(e,function(i){var r=n.get(i.name);if(i.isReference)if(!i.isMany)r=r.id;else{var o=[];k(r,function(a){o.push(a.id)}),r=o.join(" ")}t.addAttribute(t.nsAttributeName(i),r)})},mt.prototype.addTagName=function(e){var t=this.logNamespaceUsed(e);return this.getNamespaces().logUsed(t),hd(e)},mt.prototype.addAttribute=function(e,t){var n=this.attrs;Sn(t)&&(t=F0(t));var i=Zf(n,function(o){return o.name.localName===e.localName&&o.name.uri===e.uri&&o.name.prefix===e.prefix}),r={name:e,value:t};i!==-1?n.splice(i,1,r):n.push(r)},mt.prototype.serializeAttributes=function(e){var t=this.attrs,n=this.namespaces;n&&(t=L0(n).concat(t)),k(t,function(i){e.append(" ").append(hd(i.name)).append('="').append(i.value).append('"')})},mt.prototype.serializeTo=function(e){var t=this.body[0],n=t&&t.constructor!==Tr;e.appendIndent().append("<"+this.tagName),this.serializeAttributes(e),e.append(t?">":" />"),t&&(n&&e.appendNewLine().indent(),k(this.body,function(i){i.serializeTo(e)}),n&&e.unindent().appendIndent(),e.append("</"+this.tagName+">")),e.appendNewLine()};function rs(e,t,n){mt.call(this,e,t),this.serialization=n}dd(rs,mt),rs.prototype.parseNsAttributes=function(e){var t=mt.prototype.parseNsAttributes.call(this,e).filter(a=>a.name!==this.serialization),n=e.$descriptor;if(n.name===this.propertyDescriptor.type)return t;var i=this.typeNs=this.nsTagName(n);this.getNamespaces().logUsed(this.typeNs);var r=e.$model.getPackage(i.uri),o=r.xml&&r.xml.typePrefix||"";return this.addAttribute(this.nsAttributeName(this.serialization),(i.prefix?i.prefix+":":"")+o+n.ns.localName),t},rs.prototype.isLocalNs=function(e){return e.uri===(this.typeNs||this.ns).uri};function V0(){this.value="",this.write=function(e){this.value+=e}}function W0(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 U0(e){e=I({format:!1,preamble:!0},e||{});function t(n,i){var r=i||new V0,o=new W0(r,e.format);e.preamble&&o.append(M0);var a=new mt,s=n.$model;if(a.getNamespaces().mapDefaultPrefixes(Y0(s)),a.build(n).serializeTo(o),!i)return r.value}return{toXML:t}}function Y0(e){const t=e.config&&e.config.nsMap||{},n={};for(const i in Du)n[i]=Du[i];for(const i in t){const r=t[i];n[r]=i}for(const i of e.getPackages())n[i.prefix]=i.uri;return n}function os(e,t){Fn.call(this,e,t)}os.prototype=Object.create(Fn.prototype),os.prototype.fromXML=function(e,t,n){Sn(t)||(n=t,t="bpmn:Definitions");var i=new Bu(I({model:this,lax:!0},n)),r=i.handler(t);return i.fromXML(e,r)},os.prototype.toXML=function(e,t){var n=new U0(t);return new Promise(function(i,r){try{var o=n.toXML(e);return i({xml:o})}catch(a){return r(a)}})};var q0="BPMN20",K0="http://www.omg.org/spec/BPMN/20100524/MODEL",X0="bpmn",Z0=[],Q0=[{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"}]}],J0=[{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"}]}],ew={tagAlias:"lowerCase",typePrefix:"t"},tw={name:q0,uri:K0,prefix:X0,associations:Z0,types:Q0,enumerations:J0,xml:ew},nw="BPMNDI",iw="http://www.omg.org/spec/BPMN/20100524/DI",rw="bpmndi",ow=[{name:"BPMNDiagram",properties:[{name:"plane",type:"BPMNPlane",redefines:"di:Diagram#rootElement"},{name:"labelStyle",type:"BPMNLabelStyle",isMany:!0}],superClass:["di:Diagram"]},{name:"BPMNPlane",properties:[{name:"bpmnElement",isAttr:!0,isReference:!0,type:"bpmn:BaseElement",redefines:"di:DiagramElement#modelElement"}],superClass:["di:Plane"]},{name:"BPMNShape",properties:[{name:"bpmnElement",isAttr:!0,isReference:!0,type:"bpmn:BaseElement",redefines:"di:DiagramElement#modelElement"},{name:"isHorizontal",isAttr:!0,type:"Boolean"},{name:"isExpanded",isAttr:!0,type:"Boolean"},{name:"isMarkerVisible",isAttr:!0,type:"Boolean"},{name:"label",type:"BPMNLabel"},{name:"isMessageVisible",isAttr:!0,type:"Boolean"},{name:"participantBandKind",type:"ParticipantBandKind",isAttr:!0},{name:"choreographyActivityShape",type:"BPMNShape",isAttr:!0,isReference:!0}],superClass:["di:LabeledShape"]},{name:"BPMNEdge",properties:[{name:"label",type:"BPMNLabel"},{name:"bpmnElement",isAttr:!0,isReference:!0,type:"bpmn:BaseElement",redefines:"di:DiagramElement#modelElement"},{name:"sourceElement",isAttr:!0,isReference:!0,type:"di:DiagramElement",redefines:"di:Edge#source"},{name:"targetElement",isAttr:!0,isReference:!0,type:"di:DiagramElement",redefines:"di:Edge#target"},{name:"messageVisibleKind",type:"MessageVisibleKind",isAttr:!0,default:"initiating"}],superClass:["di:LabeledEdge"]},{name:"BPMNLabel",properties:[{name:"labelStyle",type:"BPMNLabelStyle",isAttr:!0,isReference:!0,redefines:"di:DiagramElement#style"}],superClass:["di:Label"]},{name:"BPMNLabelStyle",properties:[{name:"font",type:"dc:Font"}],superClass:["di:Style"]}],aw=[{name:"ParticipantBandKind",literalValues:[{name:"top_initiating"},{name:"middle_initiating"},{name:"bottom_initiating"},{name:"top_non_initiating"},{name:"middle_non_initiating"},{name:"bottom_non_initiating"}]},{name:"MessageVisibleKind",literalValues:[{name:"initiating"},{name:"non_initiating"}]}],sw=[],cw={name:nw,uri:iw,prefix:rw,types:ow,enumerations:aw,associations:sw},uw="DC",lw="http://www.omg.org/spec/DD/20100524/DC",pw="dc",fw=[{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}]}],dw=[],hw={name:uw,uri:lw,prefix:pw,types:fw,associations:dw},mw="DI",gw="http://www.omg.org/spec/DD/20100524/DI",yw="di",vw=[{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"}]}],_w=[],bw={tagAlias:"lowerCase"},xw={name:mw,uri:gw,prefix:yw,types:vw,associations:_w,xml:bw},ww="bpmn.io colors for BPMN",Ew="http://bpmn.io/schema/bpmn/biocolor/1.0",Sw="bioc",Rw=[{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"}]}],Cw=[],Pw=[],Aw={name:ww,uri:Ew,prefix:Sw,types:Rw,enumerations:Cw,associations:Pw},Tw="BPMN in Color",Mw="http://www.omg.org/spec/BPMN/non-normative/color/1.0",kw="color",Ow=[{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"}]}],Dw=[],Lw=[],Iw={name:Tw,uri:Mw,prefix:kw,types:Ow,enumerations:Dw,associations:Lw};const Nw={bpmn:tw,bpmndi:cw,dc:hw,di:xw,bioc:Aw,color:Iw};function gd(e,t){const n=I({},Nw,e);return new os(n,t)}const Bw={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"}},$w="http://www.omg.org/spec/BPMN/non-normative/extensions/i18n/1.0",yd="i18n",as={[yd]:Bw,[wu]:Uf};function vd(){return gd(as)}const _d=vd();async function Fu(e){const{rootElement:t,warnings:n}=await _d.fromXML(e,"bpmn:Definitions");return{definitions:t,warnings:n}}async function jw(e){const{xml:t}=await _d.toXML(e,{format:!0});return t}function Hu(e){return e.map(t=>typeof t=="string"?t:t.message??String(t))}const oo={cjkEm:.865,upperEm:.68,lowerEm:.5,digitEm:.556,spaceEm:.278,otherEm:.35,ascentEm:.9,descentEm:.25},Fw=/[ᄀ-ᇿ -〿぀-ヿ㐀-鿿가-힯＀-⦆]/;function Hw(e){const t=oo;return Fw.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 ao(e,t){let n=0;for(const i of e)n+=t*Hw(i);return n}function bd(e=globalThis,{textMeasurement:t="approximate"}={}){if(!(e!=null&&e.SVGElement))throw new Error("installHeadlessBpmnDom: DOM 전역이 없다 — jsdom window 를 전역에 올린 뒤 호출할 것");t==="approximate"&&zw(e),Gw(e),Vw(e),Ww(e)}function zw(e){var i;const t=(i=e.HTMLCanvasElement)==null?void 0:i.prototype;if(!t||t.__headlessTextMeasurement)return;t.__headlessTextMeasurement=!0;const n={font:"12px sans-serif",letterSpacing:"0px",measureText(r){var a;const o=Number.parseFloat(((a=String(n.font).match(/(\d+(?:\.\d+)?)px/))==null?void 0:a[1])??"12");return{width:ao(r,o),fontBoundingBoxAscent:o*oo.ascentEm,fontBoundingBoxDescent:o*oo.descentEm,actualBoundingBoxAscent:o*oo.ascentEm,actualBoundingBoxDescent:o*oo.descentEm}}};t.getContext=()=>n}function Gw(e){if(e.SVGMatrix)return;class t{constructor(){Qr(this,"a",1);Qr(this,"b",0);Qr(this,"c",0);Qr(this,"d",1);Qr(this,"e",0);Qr(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 Vw(e){var o;const t=()=>{const a=new e.SVGMatrix;return{type:0,matrix:a,setTranslate(s,c){a.e=s,a.f=c},setScale(s,c){a.a=s,a.d=c},setRotate(s,c=0,u=0){const l=s*Math.PI/180,f=Math.cos(l),p=Math.sin(l);a.a=f,a.b=p,a.c=-p,a.d=f,a.e=c-f*c+p*u,a.f=u-p*c-f*u},setMatrix(s){Object.assign(a,s)}}},n=a=>{const s=t();return Object.assign(s.matrix,a),s},i=(o=e.SVGSVGElement)==null?void 0:o.prototype;i&&!i.createSVGTransform&&(i.createSVGTransform=t,i.createSVGTransformFromMatrix=n,i.createSVGMatrix=()=>new e.SVGMatrix,i.createSVGPoint=()=>({x:0,y:0,matrixTransform:()=>({x:0,y:0})}));const r=e.SVGElement.prototype;Object.getOwnPropertyDescriptor(r,"transform")||Object.defineProperty(r,"transform",{configurable:!0,get(){if(!this.__headlessTransformList){const a=[];this.__headlessTransformList={baseVal:{get numberOfItems(){return a.length},clear:()=>{a.length=0},appendItem:s=>(a.push(s),s),getItem:s=>a[s],createSVGTransformFromMatrix:n,consolidate:()=>a[a.length-1]??null}}}return this.__headlessTransformList}})}function Ww(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:ao(n,12),height:14}})}const ss=new Set(["bpmn:Participant","bpmn:Lane","bpmn:Group","bpmn:SubProcess","bpmn:AdHocSubProcess","bpmn:Transaction"]),Uw=1,Yw=2;function Ki(e){switch(e.kind){case"label-over-line":return`L|${e.edge}|${e.line}`;case"edge-crosses-shape":return`x|${e.edge}|${e.shape}`;case"shape-overlap":return`o|${e.shapes[0]}|${e.shapes[1]}`;case"shape-outside-container":return`c|${e.shape}|${e.container}`;case"edge-overlap-opposite":return`p|${e.edges[0]}|${e.edges[1]}`;case"edge-overlap-mixed":return`m|${e.edges[0]}|${e.edges[1]}`;case"label-on-shared-segment":return`l|${e.edge}|${e.other}`;case"annotation-over-label":return`a|${e.annotation}|${e.label}`;case"group-overlap-unintended":return`g|${e.groups[0]}|${e.groups[1]}`;case"group-on-container-boundary":return`gb|${e.group}|${e.container}|${e.side}`;case"group-on-group-boundary":return`gg|${e.groups[0]}|${e.groups[1]}|${e.axis}`;case"pool-name-over-label":return`pn|${e.pool}|${e.label}`}}const xd=20,wd=5,Ed=3,Sd=12,qw=Sd*1.2;function zu(e,t){const n=t.split(/\r?\n/),i=Math.max(...n.map(o=>ao(o,Sd))),r=n.length*qw;return{x:e.x+e.width/2-i/2,y:e.y+e.height/2-r/2,width:i,height:r}}const Rd=1;function gn(e){const t=[];for(let n=0;n+1<e.waypoints.length;n++){const i=e.waypoints[n],r=e.waypoints[n+1];Math.abs(i.y-r.y)<.5&&Math.abs(i.x-r.x)>=.5?t.push({axis:"h",at:i.y,lo:Math.min(i.x,r.x),hi:Math.max(i.x,r.x),dir:r.x>i.x?1:-1}):Math.abs(i.x-r.x)<.5&&Math.abs(i.y-r.y)>=.5&&t.push({axis:"v",at:i.x,lo:Math.min(i.y,r.y),hi:Math.max(i.y,r.y),dir:r.y>i.y?1:-1})}return t}function cs(e,t){let n=null;const i=e.type!==t.type;for(const r of gn(e))for(const o of gn(t)){if(r.axis!==o.axis||Math.abs(r.at-o.at)>Rd)continue;const a=r.dir!==o.dir?"opposite":i?"mixed":null;if(!a)continue;const s=Math.min(r.hi,o.hi)-Math.max(r.lo,o.lo);s>=xd&&(!n||s>n.length)&&(n={axis:r.axis,length:s,kind:a})}return n}function Cd(e,t){const n=cs(e,t);return n&&n.kind==="opposite"?{axis:n.axis,length:n.length}:null}function Kw(e,t){let n=0;for(const i of t)i.id!==e.id&&Cd(e,i)&&n++;return n}function Mr(e,t){let n=0;for(const i of t)i.id!==e.id&&cs(e,i)&&n++;return n}const Pd=15,Ad=20;function Xw(e,t){const n=t.axis==="v"?[e.x,e.x+e.width]:[e.y,e.y+e.height];if(t.at<n[0]-Ad||t.at>n[1]+Ad)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 us(e,t){const n=[];for(const i of t){if(i.axis!==e.axis||Math.abs(i.at-e.at)>Rd)continue;const r=Math.max(e.lo,i.lo),o=Math.min(e.hi,i.hi);o-r<xd||n.push([r-Gu,o+Gu])}return n}function ls(e,t){const n=e.label;if(!n)return null;let i=null;for(const r of gn(e)){const o=Xw(n,r);if(o){for(const a of t)if(a.id!==e.id&&!(i&&a.id>=i.other)){for(const[s,c]of us(r,gn(a)))if(Math.min(c,o[1])>Math.max(s,o[0])){i={other:a.id,axis:r.axis};break}}}}return i}const Zw=1,Qw=(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 Jw(e,t,n,i){const r=n.x+i,o=n.y+i,a=n.x+n.width-i,s=n.y+n.height-i;if(a<=r||s<=o)return!1;const c=t.x-e.x,u=t.y-e.y;let l=0,f=1;const p=(d,h)=>{if(h===0)return d<=0;const m=d/h;if(h>0){if(m>f)return!1;m>l&&(l=m)}else{if(m<l)return!1;m<f&&(f=m)}return!0};return p(r-e.x,c)&&p(e.x-a,-c)&&p(o-e.y,u)&&p(e.y-s,-u)&&f>l}function Vu(e,t,n){return e.x+n<t.x+t.width-n&&t.x+n<e.x+e.width-n&&e.y+n<t.y+t.height-n&&t.y+n<e.y+e.height-n}const eE=(e,t)=>e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height,so=1;function Pi(e,t){const n=e.x+so,i=e.x+e.width-so,r=e.y+so,o=e.y+e.height-so;return t.axis==="h"?t.at>r&&t.at<o&&t.lo<i&&t.hi>n:t.at>n&&t.at<i&&t.lo<o&&t.hi>r}function qo(e){return[{axis:"h",at:e.y,lo:e.x,hi:e.x+e.width,dir:1},{axis:"h",at:e.y+e.height,lo:e.x,hi:e.x+e.width,dir:1},{axis:"v",at:e.x,lo:e.y,hi:e.y+e.height,dir:1},{axis:"v",at:e.x+e.width,lo:e.y,hi:e.y+e.height,dir:1}]}function Td(e,t){const n=e.label;if(!n)return null;if(gn(e).some(i=>Pi(n,i)))return e.id;for(const i of[...t.edges].filter(r=>r.id!==e.id).sort((r,o)=>r.id.localeCompare(o.id)))if(gn(i).some(r=>Pi(n,r)))return i.id;for(const i of t.shapes.filter(r=>r.container).sort((r,o)=>r.id.localeCompare(o.id)))if(qo(i).some(r=>Pi(n,r)))return i.id;return null}function Hn(e,t){const n=new Set(e.endpoints),i=[];for(const r of t)if(!n.has(r.id)){for(let o=0;o+1<e.waypoints.length;o++)if(Jw(e.waypoints[o],e.waypoints[o+1],r,Yw)){i.push(r);break}}return i}function tE(e,t,n,i){const r=(u,l,f)=>(l.x-u.x)*(f.y-u.y)-(l.y-u.y)*(f.x-u.x),o=r(n,i,e),a=r(n,i,t),s=r(e,t,n),c=r(e,t,i);return o*a<0&&s*c<0}const Md=(e,t)=>e.endpoints.some(n=>t.endpoints.includes(n));function ps(e,t){let n=0;for(const i of t){if(i.id===e.id||Md(e,i))continue;let r=!1;for(let o=0;o+1<e.waypoints.length&&!r;o++)for(let a=0;a+1<i.waypoints.length&&!r;a++)tE(e.waypoints[o],e.waypoints[o+1],i.waypoints[a],i.waypoints[a+1])&&(r=!0);r&&n++}return n}function Ai(e,t){let n=0;for(const i of t)i.id===e.id||Md(e,i)||ps(e,[i])>0&&(n+=i.type===e.type?2:1);return n}function kd(e){let t=0;const n=e.edges;for(let i=0;i<n.length;i++)for(let r=i+1;r<n.length;r++)ps(n[i],[n[r]])>0&&(t+=n[i].type===n[r].type?2:1);return t}function Wu(e){const t=[],n=e.edges;for(let i=0;i<n.length;i++)for(let r=i+1;r<n.length;r++)if(ps(n[i],[n[r]])>0){const o=n[i].id,a=n[r].id;t.push(o<a?[o,a]:[a,o])}return t.sort((i,r)=>`${i[0]}|${i[1]}`.localeCompare(`${r[0]}|${r[1]}`))}function Od(e){var n;const t=(n=gt(e==null?void 0:e.extensionElements))==null?void 0:n.values;if(Array.isArray(t))for(const i of t){const r=gt(i);if((r==null?void 0:r.$type)!=="bwl:Members"||typeof r.refs!="string")continue;const o=r.refs.split(/\s+/).filter(Boolean);return o.length?o:void 0}}const Dd=e=>e?{members:e}:{},ci=e=>e.shapes.filter(t=>!t.container);function nE(e,t,n){if(e.type==="bpmn:TextAnnotation")for(const i of t.edges){if(!/Association$/.test(i.type)||!i.endpoints.includes(e.id))continue;const r=i.endpoints.find(a=>a!==e.id),o=r?n.get(r):void 0;if(o){if(o.container)return o.id;if(o.parent)return o.parent}}}function Ld(e,t){const n=e.label;if(!n)return null;for(const i of[...t.edges].sort((r,o)=>r.id.localeCompare(o.id)))if(gn(i).some(r=>Pi(n,r)))return i.id;for(const i of[...t.shapes].filter(r=>r.container).sort((r,o)=>r.id.localeCompare(o.id)))if(qo(i).some(r=>Pi(n,r)))return i.id;return null}function Ko(e){const t=[];for(const n of e.shapes)n.label&&t.push({owner:n.id,rect:n.label});for(const n of e.edges)n.label&&t.push({owner:n.id,rect:n.label});return t}function Xi(e){const t=[],n=e.shapes.filter(p=>!p.container);for(const p of e.edges)for(const d of Hn(p,n))t.push({kind:"edge-crosses-shape",edge:p.id,shape:d.id});const i=n.filter(p=>!p.attached);for(let p=0;p<i.length;p++)for(let d=p+1;d<i.length;d++){const h=i[p],m=i[d];if(!Vu(h,m,Uw))continue;const g=h.id<m.id?[h.id,m.id]:[m.id,h.id];t.push({kind:"shape-overlap",shapes:g,identical:eE(h,m)})}const r=e.shapes.filter(p=>p.type==="bpmn:Group"&&Array.isArray(p.members)&&p.members.length>0);for(let p=0;p<r.length;p++)for(let d=p+1;d<r.length;d++){const h=r[p],m=r[d],g=Math.min(h.x+h.width,m.x+m.width)-Math.max(h.x,m.x),R=Math.min(h.y+h.height,m.y+m.height)-Math.max(h.y,m.y);if(g<=wd||R<=wd)continue;const E=new Set(m.members);h.members.some(x=>E.has(x))||t.push({kind:"group-overlap-unintended",groups:h.id<m.id?[h.id,m.id]:[m.id,h.id]})}const o=e.shapes.filter(p=>p.container&&p.type!=="bpmn:Group"&&p.type!=="bpmn:Lane");for(const p of e.shapes.filter(d=>d.type==="bpmn:Group"))for(const d of o){const h=p.x<d.x+d.width&&d.x<p.x+p.width,m=p.y<d.y+d.height&&d.y<p.y+p.height,g=[["top",p.y,d.y,h],["bottom",p.y+p.height,d.y+d.height,h],["left",p.x,d.x,m],["right",p.x+p.width,d.x+d.width,m]];for(const[R,E,x,w]of g)w&&Math.abs(E-x)<=Ed&&t.push({kind:"group-on-container-boundary",group:p.id,container:d.id,side:R})}const a=e.shapes.filter(p=>p.type==="bpmn:Group");for(let p=0;p<a.length;p++)for(let d=p+1;d<a.length;d++){const h=a[p],m=a[d],g=h.x<m.x+m.width&&m.x<h.x+h.width,R=h.y<m.y+m.height&&m.y<h.y+h.height,E=[["x",h.x+h.width,m.x,R],["x",m.x+m.width,h.x,R],["y",h.y+h.height,m.y,g],["y",m.y+m.height,h.y,g]];for(const[x,w,S,M]of E)if(M&&Math.abs(w-S)<=Ed){t.push({kind:"group-on-group-boundary",groups:h.id<m.id?[h.id,m.id]:[m.id,h.id],axis:x});break}}for(let p=0;p<e.edges.length;p++)for(let d=p+1;d<e.edges.length;d++){const h=e.edges[p],m=e.edges[d],g=cs(h,m);if(!g)continue;const R=h.id<m.id?[h.id,m.id]:[m.id,h.id];t.push({kind:g.kind==="opposite"?"edge-overlap-opposite":"edge-overlap-mixed",edges:R,axis:g.axis,length:Math.round(g.length)})}for(const p of e.edges){if(!p.label)continue;const d=ls(p,e.edges);d&&t.push({kind:"label-on-shared-segment",edge:p.id,other:d.other,axis:d.axis})}for(const p of e.edges){if(!p.label)continue;const d=Td(p,e);d&&t.push({kind:"label-over-line",edge:p.id,line:d})}const s=new Set(n.map(p=>p.id)),c=e.shapes.filter(p=>p.type==="bpmn:Participant"&&p.label);for(const p of[...n,...c.filter(d=>!s.has(d.id))]){if(!p.label)continue;const d=Ld(p,e);d&&t.push({kind:"label-over-line",edge:p.id,line:d})}const u=new Set(e.shapes.filter(p=>p.type==="bpmn:TextAnnotation").map(p=>p.id));for(const p of c)for(const{owner:d,rect:h}of Ko(e))d===p.id||u.has(d)||Vu(p.label,h,so)&&t.push({kind:"pool-name-over-label",pool:p.id,label:d});const l=Ko(e);for(const p of n)if(p.type==="bpmn:TextAnnotation")for(const{owner:d,rect:h}of l)d!==p.id&&Vu(p,h,so)&&t.push({kind:"annotation-over-label",annotation:p.id,label:d});const f=new Map(e.shapes.map(p=>[p.id,p]));for(const p of n){const d=p.parent??nE(p,e,f);if(!d)continue;const h=f.get(d);!h||!h.container||Qw(h,p,Zw)||t.push({kind:"shape-outside-container",shape:p.id,container:h.id})}return t.sort((p,d)=>Ki(p).localeCompare(Ki(d)))}const gt=e=>typeof e=="object"&&e!==null?e:void 0,St=e=>typeof e=="number"?e:0,kr=e=>{const t=gt(e);return typeof(t==null?void 0:t.id)=="string"?t.id:void 0};function iE(e){const t=gt(e);if(!t)return[];const n=[];for(const i of["sourceRef","targetRef"]){const r=t[i];for(const o of Array.isArray(r)?r:[r]){const a=kr(o);a&&n.push(a)}}return n}function rE(e,t){const n=gt(e.$parent);if(!n)return;const i=typeof n.$type=="string"?n.$type:"";if(i==="bpmn:Process"){const r=kr(n);return r?t.get(r):void 0}if(ss.has(i)&&i!=="bpmn:Lane"&&i!=="bpmn:Group")return kr(n)}function Id(e){var a,s,c,u,l;const t=[],n=[],i=((a=gt(e))==null?void 0:a.diagrams)??[],r=new Map,o=new Set;for(const f of((s=gt(e))==null?void 0:s.rootElements)??[]){const p=gt(f);if((p==null?void 0:p.$type)==="bpmn:Collaboration")for(const d of p.participants??[]){const h=gt(d),m=kr(h),g=kr(h==null?void 0:h.processRef);m&&g?r.set(g,m):m&&o.add(m)}}for(const f of i){const p=gt((c=gt(f))==null?void 0:c.plane),d=(p==null?void 0:p.planeElement)??[];for(const h of d){const m=gt(h);if(!m)continue;const g=gt(m.bpmnElement),R=typeof(g==null?void 0:g.id)=="string"?g.id:void 0;if(!R)continue;const E=typeof(g==null?void 0:g.$type)=="string"?g.$type:"",x=gt(m.bounds);if(x){const S=m.isExpanded===!1&&E!=="bpmn:Participant",M=gt((u=gt(m.label))==null?void 0:u.bounds),N={id:R,type:E,x:St(x.x),y:St(x.y),width:St(x.width),height:St(x.height),container:ss.has(E)&&!S,attached:(g==null?void 0:g.attachedToRef)!==void 0,...g?{parent:rE(g,r)}:{},...M?{label:{x:St(M.x),y:St(M.y),width:St(M.width),height:St(M.height)}}:{},...E==="bpmn:Group"?Dd(Od(g)):{}},T=m.isHorizontal!==!1,H=typeof(g==null?void 0:g.name)=="string"?g.name:"";o.has(R)&&T&&H&&(N.label=zu(N,H)),t.push(N);continue}const w=m.waypoint;if(Array.isArray(w)){const S=gt((l=gt(m.label))==null?void 0:l.bounds);n.push({id:R,type:E,waypoints:w.map(M=>{var N,T;return{x:St((N=gt(M))==null?void 0:N.x),y:St((T=gt(M))==null?void 0:T.y)}}),endpoints:iE(g),...S?{label:{x:St(S.x),y:St(S.y),width:St(S.width),height:St(S.height)}}:{}})}}}return{shapes:t,edges:n}}function Nd(e){return Xi(Id(e))}async function oE(e){const{definitions:t,warnings:n}=await Fu(e);return{findings:Nd(t),warnings:n}}function At(e){var i;const t=[],n=[];for(const r of e.getAll()){const o=r;if(o.type==="label"||o.labelTarget)continue;const a=typeof o.type=="string"?o.type:"";if(a==="bpmn:Definitions"||a.startsWith("bpmndi:"))continue;const s=o.waypoints;if(s){const m=gt(o.label);n.push({id:o.id,type:a,waypoints:s.map(g=>({x:St(g.x),y:St(g.y)})),endpoints:[kr(o.source),kr(o.target)].filter(g=>!!g),...m&&typeof m.x=="number"?{label:{x:m.x,y:St(m.y),width:St(m.width),height:St(m.height)}}:{}});continue}if(typeof o.x!="number"||typeof o.y!="number")continue;const c=gt(o.businessObject),u=gt(o.label);let l=gt(o.parent);for(;l&&l.type==="bpmn:Lane";)l=gt(l.parent);const f=typeof(l==null?void 0:l.type)=="string"?l.type:"",p=l&&ss.has(f)&&f!=="bpmn:Group"&&typeof l.id=="string"?l.id:void 0,d={id:o.id,type:a,x:o.x,y:o.y,width:St(o.width),height:St(o.height),container:ss.has(a)&&(a==="bpmn:Participant"||o.collapsed!==!0),attached:(c==null?void 0:c.attachedToRef)!==void 0,...p!==void 0?{parent:p}:{},...u&&typeof u.x=="number"?{label:{x:u.x,y:St(u.y),width:St(u.width),height:St(u.height)}}:{},...a==="bpmn:Group"?Dd(Od(c)):{}},h=typeof(c==null?void 0:c.name)=="string"?c.name:"";a==="bpmn:Participant"&&!(c!=null&&c.processRef)&&h&&((i=gt(o.di))==null?void 0:i.isHorizontal)!==!1&&(d.label=zu(d,h)),t.push(d)}return{shapes:t,edges:n}}const aE={"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 sE(e,t){const n=aE[e];return n||(e==="label"||e.startsWith("bpmndi:")?"other":e.startsWith("bpmn:")&&!("waypoints"in t&&t.waypoints)?"flowNode":"other")}function Bd(e){let t=e.parent;for(;t;){if(t.type==="bpmn:Participant")return t.id;t=t.parent}}function $d(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 sE(i.type,i)},lanesOf:n=>t().filter(i=>i.type==="bpmn:Lane"&&Bd(i)===n).sort((i,r)=>i.y-r.y).map(i=>i.id),participantOf:n=>{const i=e.get(n);return i?Bd(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 jd=20,cE=4,Tt=(e,t)=>Math.abs(e-t)<.5;function Fd(e,t,n,i=jd){if(Tt(e.y,t.y)&&!Tt(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(Tt(e.x,t.x)&&!Tt(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 Hd(e,t,n=jd){if(e.length!==4)return null;const[i,r,o,a]=e;if(Tt(i.y,r.y)&&Tt(r.x,o.x)&&Tt(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(Tt(i.x,r.x)&&Tt(r.y,o.y)&&Tt(o.x,a.x)){const s=c=>[i,{x:i.x,y:c},{x:a.x,y:c},a];return[s(t.y-n),s(t.y+t.height+n)]}return null}function Uu(e,t){if(e.endpoints.length!==2)return[];const n=t.find(f=>f.id===e.endpoints[0]),i=t.find(f=>f.id===e.endpoints[1]);if(!n||!i)return[];if(i.x<=n.x+n.width)return[];const r=n.y+n.height/2,o=i.y+i.height/2;if(r>=i.y&&r<=i.y+i.height)return[];const a=i.x+i.width/2,s=n.x+n.width/2,c=r>o,u=[{x:n.x+n.width,y:r},{x:a,y:r},{x:a,y:c?i.y+i.height:i.y}],l=[{x:s,y:c?n.y:n.y+n.height},{x:s,y:o},{x:i.x,y:o}];return[u,l]}const zd=30,uE=[0,-25,25,-40,40];function lE(e,t){if(e.type!=="bpmn:MessageFlow"||e.endpoints.length!==2)return[];const n=t.find(p=>p.id===e.endpoints[0]),i=t.find(p=>p.id===e.endpoints[1]);if(!n||!i)return[];const r=n.y+n.height/2,o=i.y+i.height/2;if(i.y<n.y+n.height&&i.y+i.height>n.y)return[];const a=o<r,s=a?n.y+n.height:n.y,c=a?s+zd:s-zd,u=a?i.y+i.height:i.y,l=n.x+n.width/2,f=i.x+i.width/2;return uE.map(p=>[{x:l,y:s},{x:l,y:c},{x:f+p,y:c},{x:f+p,y:u}])}const pE=(e,t,n)=>[...e.slice(0,t+1),...n,...e.slice(t+1)],fs=(e,t,n)=>Hn({...e,waypoints:t},n).length;function Gd(e,t,n,i){let r=[...e.waypoints],o=fs(e,r,t);if(o===0)return null;let a=!1;for(const f of Uu(e,t))if(fs(e,f,t)===0)return f;const s=(i??[]).filter(f=>f.id!==e.id).flatMap(gn),c=f=>gn({...e,waypoints:f}).some(p=>us(p,s).length>0),u=lE(e,t).filter(f=>fs(e,f,t)===0);if(u.length)return u.find(f=>!c(f))??u[0];const l=f=>!n||f.every(p=>p.x>=n.x&&p.x<=n.x+n.width&&p.y>=n.y&&p.y<=n.y+n.height);for(let f=0;f<cE&&o>0;f++){let p=!1;for(let d=0;d+1<r.length&&!p;d++){const h=r[d],m=r[d+1];for(const g of t){if(e.endpoints.includes(g.id)||Hn({...e,waypoints:[h,m]},[g]).length===0)continue;const R=Fd(h,m,g),E=R?R.map(w=>pE(r,d,w)):Hd(r,g)??[];if(!E.length)continue;const x=[...E].sort((w,S)=>Number(l(S))-Number(l(w)));for(const w of x){const S=fs(e,w,t);if(S<o){r=w,o=S,p=!0,a=!0;break}}if(p)break}}if(!p)break}return a&&o===0?r:null}function Vd(e,t){const{elementRegistry:n}=e,i=e.modeling,r=At(n),o=ci(r),a=Xi(r).filter(c=>c.kind==="edge-crosses-shape"&&!t.has(Ki(c)));if(!a.length)return;const s=new Map;for(const c of a){if(c.kind!=="edge-crosses-shape"||s.has(c.edge))continue;const u=r.edges.find(l=>l.id===c.edge);u&&s.set(c.edge,u)}for(const[c,u]of s){const l=n.get(c);if(!l)continue;const f=l.parent,p=f&&typeof f.x=="number"&&typeof f.width=="number"?{x:f.x,y:f.y,width:f.width,height:f.height}:void 0,d=Gd(u,o,p,r.edges);d&&i.updateWaypoints(l,d)}}const fE=10;function Wd(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 Ud(e,t){if(e.waypoints.length<2||e.endpoints.length!==2)return null;const n=t.shapes.filter(V=>V.type==="bpmn:Participant"&&V.container),i=t.shapes.find(V=>V.id===e.endpoints[0]),r=t.shapes.find(V=>V.id===e.endpoints[1]);if(!i||!r)return null;const o=Wd(i,n),a=Wd(r,n);if(!o||!a||o.id===a.id)return null;const s=a.y>o.y,c=s?o:a,u=s?a:o,l=n.filter(V=>V.id!==o.id&&V.id!==a.id&&V.y>=c.y+c.height&&V.y+V.height<=u.y).sort((V,de)=>V.y-de.y);if(!l.length)return null;const f=l[0],p=l[l.length-1],d=(c.y+c.height+f.y)/2,h=(p.y+p.height+u.y)/2,m=s?d:h,g=s?h:d,R=e.waypoints[0],E=e.waypoints[e.waypoints.length-1],x=ci(t),w=t.edges.filter(V=>V.id!==e.id),S=Ai(e,w),M=Hn(e,x).length;if(S===0&&M===0||M===0&&e.waypoints.length===2)return null;const N=Math.min(...l.map(V=>V.x)),T=Math.max(...l.map(V=>V.x+V.width)),H=(R.x+E.x)/2,G=V=>V.filter((de,Ge)=>Ge===0||!(Tt(de.x,V[Ge-1].x)&&Tt(de.y,V[Ge-1].y)));let $;for(let V=N;V<=T;V+=fE){const de=G([R,{x:R.x,y:m},{x:V,y:m},{x:V,y:g},{x:E.x,y:g},E]),Ge={...e,waypoints:de};if(Hn(Ge,x).length>0)continue;const ft=Ai(Ge,w),q=Math.abs(V-H);(!$||ft<$.cross||ft===$.cross&&q<$.detour)&&($={pts:de,cross:ft,detour:q})}return $&&(M>0?$.cross<=S:$.cross<S)?$.pts:null}function Yd(e,t){const{elementRegistry:n}=e,i=e.modeling,r=At(n);for(const o of r.edges){if(o.type!=="bpmn:MessageFlow"||t.has(o.id))continue;const a=At(n),s=a.edges.find(l=>l.id===o.id);if(!s)continue;const c=Ud(s,a);if(!c)continue;const u=n.get(o.id);u&&i.updateWaypoints(u,c)}}const co=[25,-25,40,-40],ds=35;function qd(e,t){if(e.type!=="bpmn:SequenceFlow")return[];const n=t.get(e.endpoints[0]??""),i=t.get(e.endpoints[1]??"");if(!n||!i)return[];if(i.x+i.width>n.x)return[];const r=n.y+n.height/2;if(r>=i.y&&r<=i.y+i.height)return[];const o=i.x+i.width/2,a=n.x+n.width/2,s=r<i.y,c=s?i.y:i.y+i.height,u=s?n.y:n.y+n.height,l=s?n.y-ds:n.y+n.height+ds,f=[];for(const E of[0,...co]){if(Math.abs(E)>=i.width/2-5)continue;const x=o+E;f.push({pts:[{x:n.x,y:r},{x,y:r},{x,y:c}],cost:Math.abs(E)});for(const w of[0,...co]){if(Math.abs(w)>=n.width/2-5)continue;const S=a+w;f.push({pts:[{x:S,y:u},{x:S,y:l},{x,y:l},{x,y:c}],cost:Math.abs(E)+Math.abs(w)})}}const p=50,d=i.y+i.height/2,h=s?n.y+n.height:n.y;for(const E of[0,...co]){if(Math.abs(E)>=n.width/2-5)continue;const x=a+E;f.push({pts:[{x,y:h},{x,y:d},{x:i.x+i.width,y:d}],cost:p+Math.abs(E)})}const m=60,g=s?i.y+i.height:i.y,R=s?i.y+i.height+ds:i.y-ds;for(const E of[0,...co]){if(Math.abs(E)>=i.width/2-5)continue;const x=o+E;for(const w of[0,...co]){if(Math.abs(w)>=n.width/2-5)continue;const S=a+w;f.push({pts:[{x:S,y:h},{x:S,y:R},{x,y:R},{x,y:g}],cost:m+Math.abs(E)+Math.abs(w)})}}return f}const hs=30;function Kd(e,t){for(let n=1;n<e.length-2;n++){const i=e[n],r=e[n+1],o=Tt(i.y,r.y)&&!Tt(i.x,r.x),a=Tt(i.x,r.x)&&!Tt(i.y,r.y);if(!(!o&&!a))for(const s of t)if(o){const c=Math.min(i.x,r.x);if(Math.max(i.x,r.x)<=s.x||c>=s.x+s.width)continue;if(Math.abs(i.y-s.y)<hs||Math.abs(i.y-(s.y+s.height))<hs)return!0}else{const c=Math.min(i.y,r.y);if(Math.max(i.y,r.y)<=s.y||c>=s.y+s.height)continue;if(Math.abs(i.x-s.x)<hs||Math.abs(i.x-(s.x+s.width))<hs)return!0}}return!1}const ms=40;function dE(e,t,n){let i=0;for(const r of t){if(r.container||n.includes(r.id))continue;const o=r.x-ms,a=r.x+r.width+ms,s=r.y-ms,c=r.y+r.height+ms;for(let u=1;u<e.length-2;u++){const l=e[u],f=e[u+1],p={x:Math.min(l.x,f.x),y:Math.min(l.y,f.y)},d={x:Math.max(l.x,f.x),y:Math.max(l.y,f.y)};if(p.x<a&&d.x>o&&p.y<c&&d.y>s){i++;break}}}return i}function Xd(e,t){if(e.type!=="bpmn:SequenceFlow")return null;const n=t.shapes.filter(E=>E.container),i=new Map(t.shapes.map(E=>[E.id,E])),r=ci(t),o=t.edges.filter(E=>E.id!==e.id),a=Mr(e,o),s=Ai(e,o),c=E=>dE(E,t.shapes,e.endpoints)+(Kd(E,n)?1:0),u=c(e.waypoints),l=E=>{if(!E)return;const x=E.x+E.width/2,w=E.y+E.height/2;return n.find(S=>S.type==="bpmn:Lane"&&x>=S.x&&x<=S.x+S.width&&w>=S.y&&w<=S.y+S.height)},f=l(i.get(e.endpoints[0]??"")),p=l(i.get(e.endpoints[1]??"")),d=!!f&&!!p&&f.id!==p.id,h=E=>{if(!d||!p)return!1;for(let x=1;x<E.length-2;x++){const w=E[x],S=E[x+1];if(Tt(w.y,S.y)&&!Tt(w.x,S.x)&&w.y>p.y&&w.y<p.y+p.height)return!0}return!1},m=h(e.waypoints);if(!Kd(e.waypoints,n)&&!(d&&!m))return null;const g=E=>E.reduce((x,w,S)=>S?x+Math.abs(w.x-E[S-1].x)+Math.abs(w.y-E[S-1].y):0,0);let R;for(const{pts:E,cost:x}of qd(e,i)){const w={...e,waypoints:E};if(Hn(w,r).length>0||Mr(w,o)>a||Ai(w,o)>s)continue;const S=c(E),M=h(E);if(!(M&&!m)&&S>=u)continue;const T=M?0:1,H=g(E);(!R||T<R.lane||T===R.lane&&(S<R.sc||S===R.sc&&(x<R.cost||x===R.cost&&H<R.len)))&&(R={pts:E,sc:S,lane:T,cost:x,len:H})}return(R==null?void 0:R.pts)??null}function hE(e,t){const{elementRegistry:n}=e,i=e.modeling,r=At(n).edges.filter(o=>!t.has(o.id)&&o.waypoints.length>=4).map(o=>o.id).sort();for(const o of r){const a=At(n),s=a.edges.find(d=>d.id===o);if(!s||s.waypoints.length<4)continue;const c=ci(a),u=a.edges.filter(d=>d.id!==o),l=Hn(s,c).length,f=Mr(s,u),p=Ai(s,u);for(const d of Uu(s,a.shapes)){if(d.length>=s.waypoints.length)continue;const h={...s,waypoints:d};if(Hn(h,c).length>l||Mr(h,u)>f||Ai(h,u)>p)continue;const m=n.get(o);m&&i.updateWaypoints(m,d);break}}}function Zd(e,t){const{elementRegistry:n}=e,i=e.modeling,r=At(n).edges.filter(o=>o.type==="bpmn:SequenceFlow"&&!t.has(o.id)).map(o=>o.id).sort();for(const o of r){const a=At(n),s=a.edges.find(l=>l.id===o);if(!s)continue;const c=Xd(s,a);if(!c)continue;const u=n.get(o);u&&i.updateWaypoints(u,c)}}function mE(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=Tt(n[0].x,n[1].x)&&!Tt(n[0].y,n[1].y),s=Tt(n[n.length-1].x,n[n.length-2].x)&&!Tt(n[n.length-1].y,n[n.length-2].y);for(const c of co){if(a&&r&&Math.abs(c)<r.width/2-5){const u=n.map(l=>({...l}));u[0].x+=c,u[1].x+=c,i.push({pts:u,cost:Math.abs(c)})}if(s&&o&&Math.abs(c)<o.width/2-5){const u=n.map(l=>({...l}));u[u.length-1].x+=c,u[u.length-2].x+=c,i.push({pts:u,cost:Math.abs(c)})}}return i}function Qd(e,t){const n=new Map(t.shapes.map(l=>[l.id,l])),i=ci(t),r=t.edges.filter(l=>l.id!==e.id),o=Mr(e,r);if(o===0)return null;const a=Ai(e,r);let s;const c=l=>l.reduce((f,p,d)=>d?f+Math.abs(p.x-l[d-1].x)+Math.abs(p.y-l[d-1].y):0,0),u=[...qd(e,n),...mE(e,n)];for(const{pts:l,cost:f}of u){const p={...e,waypoints:l};if(Hn(p,i).length>0)continue;const d=Mr(p,r),h=Ai(p,r);if(d>=o||h-a>o-d)continue;const m=c(l);(!s||d<s.opposite||d===s.opposite&&(h<s.cross||h===s.cross&&(f<s.cost||f===s.cost&&m<s.len)))&&(s={pts:l,opposite:d,cross:h,cost:f,len:m})}return(s==null?void 0:s.pts)??null}function Jd(e,t,n){const{elementRegistry:i}=e,r=e.modeling,o=At(i),a=Xi(o).filter(l=>(l.kind==="edge-overlap-opposite"||l.kind==="edge-overlap-mixed")&&!t.has(Ki(l)));if(!a.length)return;const s=new Set;for(const l of a)if(!(l.kind!=="edge-overlap-opposite"&&l.kind!=="edge-overlap-mixed"))for(const f of l.edges)n.has(f)||s.add(f);const c=l=>{var f;return((f=o.edges.find(p=>p.id===l))==null?void 0:f.type)??""},u=[...s].sort((l,f)=>{const p=c(l)==="bpmn:SequenceFlow"?0:1,d=c(f)==="bpmn:SequenceFlow"?0:1;return p!==d?p-d:l.localeCompare(f)});for(const l of u){const f=At(i),p=f.edges.find(m=>m.id===l);if(!p)continue;const d=Qd(p,f);if(!d)continue;const h=i.get(l);h&&r.updateWaypoints(h,d)}}const gE=10,yE=(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 eh(e,t){const n=e.label;if(!n)return null;const i=t.edges.filter(a=>a.id!==e.id);if(!ls(e,i))return null;const r=ci(t),o=i.flatMap(gn);for(const a of gn(e)){let s=[[a.lo,a.hi]];for(const[d,h]of us(a,o))s=s.flatMap(([m,g])=>{const R=[];return d>m&&R.push([m,Math.min(g,d)]),h<g&&R.push([Math.max(m,h),g]),R.filter(([E,x])=>x>E)});const c=a.axis==="h"?n.width:n.height,u=s.find(([d,h])=>h-d>=c+gE*2);if(!u)continue;const l=(u[0]+u[1])/2,f=a.axis==="h"?{x:l,y:a.at-Pd}:{x:a.at+Pn+n.width/2,y:l},p={x:f.x-n.width/2,y:f.y-n.height/2,width:n.width,height:n.height};if(!ls({...e,label:p},i)&&!r.some(d=>!e.endpoints.includes(d.id)&&yE(p,d)))return p}return null}const Pn=8;function th(e,t){const n=e.label;if(!n)return null;const i=gn(e);if(!i.length)return null;const r=n.x+n.width/2,o=n.y+n.height/2,a=p=>{const d=p.axis==="h"?r:o,h=p.axis==="h"?o-p.at:r-p.at,m=d<p.lo?p.lo-d:d>p.hi?d-p.hi:0;return Math.hypot(h,m)},s=i.reduce((p,d)=>a(d)<a(p)?d:p,i[0]),c=[...i,...t.edges.filter(p=>p.id!==e.id).flatMap(gn),...t.shapes.filter(p=>p.container).flatMap(qo)],u=p=>!c.some(d=>Pi(p,d));if(u(n))return null;const l=(s.axis==="v"?n.height:n.width)+Pn,f=[0,-l,l,-2*l,2*l];if(s.axis==="v")for(const p of[s.at+Pn,s.at-Pn-n.width])for(const d of f){const h=n.y+d;if(h<s.lo||h+n.height>s.hi)continue;const m={...n,x:p,y:h};if(u(m))return m}else for(const p of[s.at-Pn-n.height,s.at+Pn])for(const d of f){const h=n.x+d;if(h<s.lo||h+n.width>s.hi)continue;const m={...n,x:h,y:p};if(u(m))return m}return null}function nh(e,t){const{elementRegistry:n}=e,i=e.modeling,r=At(n);for(const o of r.edges){if(!o.label||t.has(o.id))continue;const a=th(o,r);if(!a)continue;const s=n.get(o.id),c=s==null?void 0:s.label;c&&i.moveElements([c],{x:a.x-c.x,y:a.y-c.y})}}function ih(e,t,n){const{elementRegistry:i}=e,r=e.modeling,o=At(i),a=Xi(o).filter(s=>s.kind==="label-on-shared-segment"&&!t.has(Ki(s)));for(const s of a){if(s.kind!=="label-on-shared-segment"||n.has(s.edge))continue;const c=o.edges.find(p=>p.id===s.edge);if(!c)continue;const u=eh(c,o);if(!u)continue;const l=i.get(s.edge),f=l==null?void 0:l.label;f&&r.moveElements([f],{x:u.x-f.x,y:u.y-f.y})}}function rh(e,t){const n=e.label;if(!n)return null;const i=[...t.edges.flatMap(gn),...t.shapes.filter(p=>p.container).flatMap(qo)],r=i.filter(p=>Pi(n,p));if(!r.length)return null;const o=t.shapes.filter(p=>!p.container&&p.id!==e.id),a=Ko(t).filter(p=>p.owner!==e.id).map(p=>p.rect),s=(p,d)=>p.x<d.x+d.width&&d.x<p.x+p.width&&p.y<d.y+d.height&&d.y<p.y+p.height,c=p=>!i.some(d=>Pi(p,d))&&!o.some(d=>s(p,d))&&!a.some(d=>s(p,d)),u=[];for(const p of r)p.axis==="h"?u.push({...n,y:p.at-Pn-n.height},{...n,y:p.at+Pn}):u.push({...n,x:p.at-Pn-n.width},{...n,x:p.at+Pn});const l=e.x+e.width/2,f=e.y+e.height/2;return u.push({...n,x:l-n.width/2,y:e.y+e.height+Pn},{...n,x:l-n.width/2,y:e.y-Pn-n.height},{...n,x:e.x+e.width+Pn,y:f-n.height/2},{...n,x:e.x-Pn-n.width,y:f-n.height/2}),u.find(c)??null}function oh(e,t){const{elementRegistry:n}=e,i=e.modeling,r=At(n);for(const o of r.shapes){if(o.container||!o.label||t.has(o.id))continue;const a=rh(o,At(n));if(!a)continue;const s=n.get(o.id),c=s==null?void 0:s.label;c&&i.moveElements([c],{x:a.x-c.x,y:a.y-c.y})}}const vE=/^[\p{L}_][\p{L}\p{N}_.\-]*$/u,ah=new Set(["sequenceFlow","messageFlow","dataAssociation","association"]),sh={"participant.add":[{path:"participant",shape:["id"]},{path:"participant.lanes[]",shape:["id"],optional:!0}],"participant.update":[{path:"id",shape:null},{path:"lanes[]",shape:["id"],optional:!0}],"node.add":[{path:"node",shape:["id","type"]}],"node.update":[{path:"id",shape:null}],"sequenceFlow.add":[{path:"flow",shape:["id","source","target"]}],"sequenceFlow.update":[{path:"id",shape:null}],"messageFlow.add":[{path:"flow",shape:["id","source","target"]}],"messageFlow.update":[{path:"id",shape:null}],"dataStore.add":[{path:"dataStore",shape:["id"]},{path:"associations[]",shape:["source","target"],optional:!0}],"dataStore.update":[{path:"id",shape:null}],"dataAssociation.add":[{path:"association",shape:["source","target"]}],"association.add":[{path:"association",shape:["source","target"]}],"annotation.add":[{path:"annotation",shape:["id","text"]},{path:"association",shape:["source","target"],optional:!0},{path:"placement",shape:["anchor","side"],optional:!0}],"annotation.update":[{path:"id",shape:null},{path:"placement",shape:["anchor","side"],optional:!0}],"group.add":[{path:"group",shape:["id"]},{path:"group.members[]",shape:null,optional:!0}],"group.update":[{path:"id",shape:null},{path:"members[]",shape:null,optional:!0}],"element.remove":[{path:"id",shape:null}]},gs=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),Yu=e=>typeof e=="string"&&e!=="";function _E(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(!gs(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(!gs(i)||!Yu(i.kind)||!(i.kind in sh)){t.push({kind:"payload-invalid",opIndex:r,field:"kind"});return}for(const o of sh[i.kind]){const a=o.path.endsWith("[]"),s=a?o.path.slice(0,-2):o.path,c=s.split(".");let u=i;for(const f of c.slice(0,-1)){if(!gs(u))break;u=u[f]}if(!gs(u))continue;const l=u[c[c.length-1]];if(!(l===void 0&&o.optional)&&!(l===null&&o.optional)){if(!a){n(r,o.path,l,o.shape);continue}if(!Array.isArray(l)){t.push({kind:"payload-invalid",opIndex:r,field:o.path});continue}l.forEach((f,p)=>n(r,`${s}[${p}]`,f,o.shape))}}if(i.kind==="node.add"){const o=i.band;o!==void 0&&(!Number.isInteger(o)||o<0)&&t.push({kind:"payload-invalid",opIndex:r,field:"band"})}}),t}function ch(e,t){const n=_E(e);if(n.length>0)return n;const i=[],r=new Map,o=new Map;function a(p,d,h){if(!vE.test(d)){i.push({kind:"id-invalid",opIndex:p,id:d});return}if(t.categoryOf(d)!==void 0||r.has(d)){i.push({kind:"id-duplicate",opIndex:p,id:d});return}r.set(d,{...h,opIndex:p})}e.forEach((p,d)=>{var h;switch(p.kind){case"participant.add":a(d,p.participant.id,{category:"participant",lanes:(p.participant.lanes??[]).map(m=>m.id)});for(const m of p.participant.lanes??[])a(d,m.id,{category:"lane"});break;case"node.add":a(d,p.node.id,{category:"flowNode",participant:p.node.participant});break;case"sequenceFlow.add":a(d,p.flow.id,{category:"sequenceFlow"});break;case"messageFlow.add":a(d,p.flow.id,{category:"messageFlow"});break;case"dataStore.add":a(d,p.dataStore.id,{category:"dataStore"});for(const m of p.associations??[])m.id&&a(d,m.id,{category:"dataAssociation"});break;case"dataAssociation.add":p.association.id&&a(d,p.association.id,{category:"dataAssociation"});break;case"association.add":p.association.id&&a(d,p.association.id,{category:"association"});break;case"annotation.add":a(d,p.annotation.id,{category:"annotation"}),(h=p.association)!=null&&h.id&&a(d,p.association.id,{category:"association"});break;case"group.add":a(d,p.group.id,{category:"group"});break;case"participant.update":if(p.lanes){o.set(p.id,p.lanes.map(m=>m.id));for(const m of p.lanes)t.categoryOf(m.id)===void 0&&a(d,m.id,{category:"lane"})}break}});const s=p=>{var d;return((d=r.get(p))==null?void 0:d.category)??t.categoryOf(p)},c=p=>{const d=r.get(p);return d?d.category==="participant"?p:d.participant:t.categoryOf(p)==="participant"?p:t.participantOf(p)};function u(p,d,h,m){const g=s(d);if(g===void 0){i.push({kind:"ref-missing",opIndex:p,ref:d,role:h});return}if(m&&!m.includes(g)){i.push({kind:"ref-category",opIndex:p,ref:d,role:h,expected:m.join("|"),actual:g});return}return g}const l=t.isCollaboration()||e.some(p=>p.kind==="participant.add");return e.forEach((p,d)=>{var h;switch(p.kind){case"participant.add":break;case"node.add":{const{participant:m,lane:g}=p.node;if(m===void 0){(l||g!==void 0)&&i.push({kind:"participant-required",opIndex:d,id:p.node.id});break}if(u(d,m,"participant",["participant"])===void 0)break;g!==void 0&&((((h=r.get(m))==null?void 0:h.lanes)??o.get(m)??t.lanesOf(m)).includes(g)||i.push({kind:"lane-unknown",opIndex:d,lane:g,participant:m}));break}case"sequenceFlow.add":{const{id:m,source:g,target:R,name:E,condition:x}=p.flow,w=u(d,g,"source",["flowNode"]),S=u(d,R,"target",["flowNode"]);w&&S&&c(g)!==c(R)&&i.push({kind:"flow-cross-pool",opIndex:d,id:m}),E!==void 0&&x!==void 0&&i.push({kind:"condition-name-conflict",opIndex:d,id:m});break}case"messageFlow.add":{const{id:m,source:g,target:R}=p.flow,E=u(d,g,"source",["flowNode","participant"]),x=u(d,R,"target",["flowNode","participant"]);if(E&&x){const w=c(g),S=c(R);w!==void 0&&w===S&&i.push({kind:"message-flow-same-pool",opIndex:d,id:m})}break}case"dataStore.add":{for(const m of p.associations??[]){if([m.source,m.target].filter(E=>E===p.dataStore.id).length!==1){i.push({kind:"data-association-ends",opIndex:d,source:m.source,target:m.target});continue}const R=m.source===p.dataStore.id?m.target:m.source;u(d,R,"dataAssociation",["flowNode"])}break}case"dataAssociation.add":{const{source:m,target:g}=p.association,R=u(d,m,"source"),E=u(d,g,"target");if(R&&E){const x=new Set([R,E]);x.has("dataStore")&&x.has("flowNode")||i.push({kind:"data-association-ends",opIndex:d,source:m,target:g})}break}case"association.add":{const{id:m,source:g,target:R}=p.association,E=u(d,g,"source"),x=u(d,R,"target");E&&x&&E!=="annotation"&&x!=="annotation"&&i.push({kind:"association-detached",opIndex:d,annotation:m??`${g}->${R}`});break}case"annotation.add":{if(p.association){const{source:m,target:g}=p.association;if(m!==p.annotation.id&&g!==p.annotation.id)i.push({kind:"association-detached",opIndex:d,annotation:p.annotation.id});else{const R=m===p.annotation.id?g:m;u(d,R,"association")}}p.placement&&u(d,p.placement.anchor,"anchor");break}case"group.add":{for(const m of p.group.members??[]){const g=u(d,m,"member");g&&ah.has(g)&&i.push({kind:"ref-category",opIndex:d,ref:m,role:"member",expected:"shape",actual:g})}break}case"participant.update":{if(f(d,p.id,"participant")===void 0)break;if(p.lanes){const m=t.lanesOf(p.id),g=p.lanes.map(E=>E.id);for(const E of m)g.includes(E)||i.push({kind:"lane-shrink-unsupported",opIndex:d,participant:p.id,lane:E});for(const E of g)t.categoryOf(E)!==void 0&&!m.includes(E)&&i.push({kind:"id-duplicate",opIndex:d,id:E});const R=g.filter(E=>m.includes(E));R.length===m.length&&R.some((E,x)=>E!==m[x])&&i.push({kind:"lane-reorder-unsupported",opIndex:d,participant:p.id})}break}case"node.update":{if(f(d,p.id,"flowNode")===void 0)break;if(p.lane!==void 0){const m=t.participantOf(p.id);(m?o.get(m)??t.lanesOf(m):[]).includes(p.lane)||i.push({kind:"lane-unknown",opIndex:d,lane:p.lane,participant:m??""})}break}case"sequenceFlow.update":{if(f(d,p.id,"sequenceFlow")===void 0)break;if(p.name!==void 0&&p.condition!==void 0&&i.push({kind:"condition-name-conflict",opIndex:d,id:p.id}),p.source!==void 0||p.target!==void 0){const m=p.source===void 0||u(d,p.source,"source",["flowNode"])!==void 0,g=p.target===void 0||u(d,p.target,"target",["flowNode"])!==void 0,R=t.endpointsOf(p.id),E=p.source??(R==null?void 0:R.source),x=p.target??(R==null?void 0:R.target);m&&g&&E!==void 0&&x!==void 0&&new Set([c(E),c(x),c(p.id)]).size>1&&i.push({kind:"flow-cross-pool",opIndex:d,id:p.id})}break}case"messageFlow.update":f(d,p.id,"messageFlow");break;case"dataStore.update":f(d,p.id,"dataStore");break;case"annotation.update":{if(f(d,p.id,"annotation")===void 0)break;p.placement&&u(d,p.placement.anchor,"anchor");break}case"group.update":{if(f(d,p.id,"group")===void 0)break;for(const m of p.members??[]){const g=u(d,m,"member");g&&ah.has(g)&&i.push({kind:"ref-category",opIndex:d,ref:m,role:"member",expected:"shape",actual:g})}break}case"element.remove":{f(d,p.id)==="lane"&&i.push({kind:"ref-category",opIndex:d,ref:p.id,role:"target",expected:"removable",actual:"lane"});break}}}),i;function f(p,d,h){if(r.has(d)){i.push({kind:"target-added-in-batch",opIndex:p,id:d});return}const m=t.categoryOf(d);if(m===void 0){i.push({kind:"ref-missing",opIndex:p,ref:d,role:"target"});return}if(h&&m!==h){i.push({kind:"ref-category",opIndex:p,ref:d,role:"target",expected:h,actual:m});return}return m}}function uh(e){return{modeling:e.get("modeling"),bpmnFactory:e.get("bpmnFactory"),elementFactory:e.get("elementFactory"),elementRegistry:e.get("elementRegistry"),canvas:e.get("canvas"),autoPlace:e.get("autoPlace"),bpmnReplace:e.get("bpmnReplace")}}function ys(e){return`bpmn:${e[0].toUpperCase()}${e.slice(1)}`}const qu={"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 Zt(e,t){return e.filter(n=>n.kind===t)}function lh(e,t){var Ix,Nx,Bx,$x,jx,Fx,Hx,zx,Gx;const{modeling:n,bpmnFactory:i,elementFactory:r,elementRegistry:o,canvas:a,autoPlace:s,bpmnReplace:c}=t,u=()=>a.getRootElement(),l=b=>o.get(b),f=b=>{const C=l(b);if(!C)throw new Error(`하강 참조 해소 실패: ${b}`);return C},p=b=>{let C=b.parent;for(;C;){if(C.type==="bpmn:Participant")return C;C=C.parent}},d=Zt(e,"participant.add"),h=Zt(e,"node.add"),m=Zt(e,"sequenceFlow.add"),g=Zt(e,"messageFlow.add"),R=Zt(e,"dataStore.add"),E=Zt(e,"dataAssociation.add"),x=Zt(e,"annotation.add"),w=Zt(e,"group.add"),S=new Map(h.map(b=>[b.node.id,b])),M=(b,C,A)=>{var Q;const L=b.businessObject,j=(((Q=L.extensionElements)==null?void 0:Q.values)??[]).filter(J=>J.$type!==C),O=A?[...j,i.create(C,A)]:j;if(!O.length){L.extensionElements&&n.updateProperties(b,{extensionElements:void 0});return}const U=i.create("bpmn:ExtensionElements",{values:O});O.forEach(J=>{J.$parent=U}),n.updateProperties(b,{extensionElements:U})},N=b=>({anchor:b.anchor,side:b.side,...b.offset!==void 0?{offset:b.offset}:{}});for(const b of Zt(e,"element.remove")){const C=l(b.id);C&&n.removeElements([C])}const T=b=>o.filter(C=>{var A;return C.type==="bpmn:Lane"&&((A=p(C))==null?void 0:A.id)===b}).sort((C,A)=>C.y-A.y);for(const b of Zt(e,"participant.update")){const C=f(b.id);if(b.name!==void 0&&n.updateProperties(C,{name:b.name??void 0}),!b.lanes)continue;const A=T(b.id);if(!A.length){n.splitLane(C,b.lanes.length),T(b.id).forEach((j,O)=>{const U=b.lanes[O];U&&n.updateProperties(j,{id:U.id,name:U.name})});continue}const L=new Set(A.map(j=>j.id));b.lanes.forEach((j,O)=>{if(L.has(j.id)){n.updateProperties(f(j.id),{name:j.name});return}const U=O===0?n.addLane(T(b.id)[0],"top"):n.addLane(f(b.lanes[O-1].id),"bottom");n.updateProperties(U,{id:j.id,name:j.name})})}const H=150,G=130,$=80,V=90,de=180,Ge=new Set;for(const b of d){Ge.add(`pool:${b.participant.id}`);for(const C of b.participant.lanes??[])Ge.add(C.id)}const ft=new Map;for(const b of h){const C=b.node.lane??`pool:${b.node.participant??""}`;let A=ft.get(C);A||ft.set(C,A=new Set([0])),b.band!==void 0&&A.add(b.band)}const q=new Map;for(const[b,C]of ft){if(!Ge.has(b))continue;const A=[...C].sort((O,U)=>O-U),L=A.map((O,U)=>U===0?0:U%2===1?Math.ceil(U/2):-(U/2)),j=Math.min(...L);q.set(b,new Map(A.map((O,U)=>[O,L[U]-j])))}{const b=new Map;for(const C of d)(C.participant.lanes??[]).forEach((A,L)=>b.set(A.id,L));for(const[C,A]of q){if(!b.has(C)||A.size<2)continue;const L=b.get(C),j=A.get(0)??0,O=new Set;for(const me of h){if(me.node.lane!==C||(me.band??0)!==0||!me.node.type.endsWith("Gateway"))continue;const Re={in:new Set,out:new Set,cross:new Set};for(const ye of m){const _e=ye.flow.source===me.node.id;if(!_e&&ye.flow.target!==me.node.id)continue;const _t=S.get(_e?ye.flow.target:ye.flow.source);if(!_t||_t.node.participant!==me.node.participant||!_t.node.lane)continue;let Wt,ht=!1;if(_t.node.lane!==C){const dt=b.get(_t.node.lane);if(dt===void 0)continue;Wt=dt>L?"down":"up",ht=!0}else{const dt=A.get(_t.band??0)??j;Wt=dt>j?"down":dt<j?"up":void 0}Wt&&(Re[_e?"out":"in"].add(Wt),ht&&Re.cross.add(Wt))}for(const ye of["up","down"])Re.in.has(ye)&&Re.out.has(ye)&&Re.cross.has(ye)&&O.add(ye)}if(O.size!==1)continue;const[U]=O,Q=Math.max(...A.values()),J=U==="down"?Q:0;if(j===J)continue;const oe=[...A.entries()].filter(([me])=>me!==0).sort((me,Re)=>me[1]-Re[1]),Fe=[...Array(Q+1).keys()].filter(me=>me!==J),$e=new Map([[0,J]]);oe.forEach(([me],Re)=>$e.set(me,Fe[Re])),q.set(C,$e)}}const he=b=>{var C;return(((C=ft.get(b))==null?void 0:C.size)??0)>1},ge=b=>b.band??(b.node.lane||!he(`pool:${b.node.participant??""}`)?void 0:0),pe=new Map,fe=b=>pe.get(b.node.id)??ge(b),ne=new Set,z=new Set;{const b=new Map;for(const L of m)b.set(L.flow.target,(b.get(L.flow.target)??0)+1);const C=L=>{const j=[],O=new Set([L]),U=[L];for(;U.length;){const Q=U.shift();j.push(Q);for(const J of m)J.flow.source!==Q||O.has(J.flow.target)||(b.get(J.flow.target)??0)!==1||(O.add(J.flow.target),U.push(J.flow.target))}return j},A=(L,j)=>{var O;return((O=q.get(L))==null?void 0:O.get(j))??j};for(const L of h){if(!L.node.type.endsWith("Gateway"))continue;const j=L.node.lane??`pool:${L.node.participant??""}`,O=q.get(j);if(!O||O.size<2)continue;const U=fe(L);if(U===void 0||A(j,U)!==A(j,0))continue;const Q=A(j,U),J=m.filter(ye=>ye.flow.source===L.node.id).map(ye=>S.get(ye.flow.target)).filter(ye=>!!ye&&(ye.node.lane??`pool:${ye.node.participant??""}`)===j),oe=J.filter(ye=>{const _e=fe(ye);return _e!==void 0&&A(j,_e)===Q&&(b.get(ye.node.id)??0)===1}),Fe=J.some(ye=>{const _e=fe(ye);return _e!==void 0&&A(j,_e)>Q});if(oe.length!==1||!Fe)continue;const $e=new Set(J.flatMap(ye=>C(ye.node.id)));if(!m.some(ye=>ye.flow.target===L.node.id&&$e.has(ye.flow.source)))continue;const Re=new Map;for(const[ye,_e]of O)Re.set(ye,_e+1);Re.set(-1,0),q.set(j,Re);for(const ye of C(oe[0].node.id))S.has(ye)&&(pe.set(ye,-1),z.add(ye));ne.add(L.node.id)}}const F=(b,C)=>{var A;return((A=q.get(b))==null?void 0:A.get(C))??C},Y=new Map;for(const[b,C]of ft){let A=0;for(const L of C)A=Math.max(A,F(b,L));Y.set(b,A)}const Le=b=>de+H*b,Nt=d.map((b,C)=>({op:b,declared:C}));Nt.sort((b,C)=>{const A=b.op.order??Number.POSITIVE_INFINITY,L=C.op.order??Number.POSITIVE_INFINITY;return A!==L?A-L:b.declared-C.declared});let P=80;for(const b of o.getAll())b.parent===u()&&"height"in b&&typeof b.y=="number"&&(P=Math.max(P,b.y+b.height+60));for(const{op:b}of Nt){const C=b.participant,A=h.filter(me=>me.node.participant===C.id).length,L=((Ix=C.lanes)==null?void 0:Ix.length)??0,j=Math.max(1200,A*160+300),O=(C.lanes??[]).map(me=>Le(Y.get(me.id)??0)),U=O.reduce((me,Re)=>me+Re,0);L&&U<300&&(O[L-1]+=300-U);const Q=Math.max(300,H*((Y.get(`pool:${C.id}`)??0)+1)),J=C.blackBox||A+L===0?120:L?Math.max(300,U):Q,oe=r.createShape({type:"bpmn:Participant",businessObject:i.create("bpmn:Participant",{id:C.id,name:C.name,...b.order!==void 0?{"bwl:poolOrder":b.order}:{},...C.blackBox?{}:{processRef:i.create("bpmn:Process")}}),width:j,height:J,isExpanded:!0}),Fe=n.createShape(oe,{x:100+j/2,y:P+J/2},u()),$e=C.lanes??[];if($e.length&&n.splitLane(Fe,$e.length),$e.length){const me=o.filter(Re=>{var ye;return Re.type==="bpmn:Lane"&&((ye=p(Re))==null?void 0:ye.id)===C.id}).sort((Re,ye)=>Re.y-ye.y);if(me.forEach((Re,ye)=>{const _e=$e[ye];_e&&n.updateProperties(Re,{id:_e.id,name:_e.name})}),O.some(Re=>Re!==Fe.height/L)){let Re=Fe.y;me.forEach((ye,_e)=>{const _t=O[_e];n.resizeShape(ye,{x:ye.x,y:Re,width:ye.width,height:_t}),Re+=_t})}}P=Fe.y+Fe.height+60}const _=b=>{var L;const C=S.get(b);if(C)return C.node.participant??"";const A=l(b);return A?A.type==="bpmn:Participant"?A.id:((L=p(A))==null?void 0:L.id)??"":""},y=new Map,D=b=>{let C=y.get(b);return C||y.set(b,C={nodes:[],flows:[]}),C};for(const b of h)D(b.node.participant??"").nodes.push(b);for(const b of m)D(_(b.flow.source)).flows.push(b);const B=b=>{var C;return i.create("bpmn:SequenceFlow",{id:b.id,name:b.name??((C=b.condition)==null?void 0:C.label)})},W=(b,C)=>r.createShape({type:ys(b.type),businessObject:i.create(ys(b.type),{id:b.id,name:b.name,...C!==void 0?{"bwl:band":C}:{}})}),le=[...Nt.map(({op:b})=>b.participant.id).filter(b=>y.has(b)),...[...y.keys()].filter(b=>!d.some(C=>C.participant.id===b))],ke=b=>b.endsWith("Gateway");for(const b of le){const C=y.get(b),A=b?f(b):void 0,L=A?A.x+150:250;let j=A?A.y+80:120;const O=(Ne,Je,Xe)=>{const We=u().children.filter(ee=>!("waypoints"in ee&&ee.waypoints)&&ee.id!==Je&&typeof ee.y=="number"&&ee.y>=Ne);We.length&&n.moveElements(We,{x:0,y:Xe})},U=(Ne,Je)=>{if(Ne){const ce=f(Ne),ue=Le(Je);if(ce.height>=ue)return;const jt=ue-ce.height,ie=p(ce),Ze=ie?ie.y+ie.height:ce.y+ce.height;n.resizeLane(ce,{x:ce.x,y:ce.y,width:ce.width,height:ue},!1),O(Ze,ie==null?void 0:ie.id,jt);return}if(!A)return;const Xe=H*(Je+1);if(A.height>=Xe)return;const We=Xe-A.height,ee=A.y+A.height;n.resizeShape(A,{x:A.x,y:A.y,width:A.width,height:Xe}),O(ee,A.id,We)},Q=(Ne,Je,Xe)=>{if(Ne){const We=f(Ne);return We.y+Math.min(We.height/2,V)+F(Ne,Je??0)*H}return Je!==void 0&&A?A.y+$+F(`pool:${b}`,Je)*H:Xe},J=(Ne,Je,Xe)=>{if(Ne){const We=f(Ne);return We.y+Math.min(We.height/2,V)+Je*H}return A?A.y+$+Je*H:Xe},oe=Ne=>Ne.participant?f(Ne.participant):u(),Fe=30,$e=(Ne,Je,Xe,We)=>{const ee=Xe-Je.width/2,ce=We-Je.height/2;return(Ne.children??[]).find(ue=>!("waypoints"in ue&&ue.waypoints)&&ue.type!=="bpmn:Lane"&&ue.type!=="label"&&typeof ue.x=="number"&&ee<ue.x+ue.width+Fe&&ee+Je.width+Fe>ue.x&&ce<ue.y+ue.height&&ce+Je.height>ue.y)},me=(Ne,Je,Xe,We,ee,ce)=>{const ue=Xe!==void 0||We!==void 0,jt=F(Xe??`pool:${b}`,We??0);if(ue)for(let xe=0;xe<4;xe++){const Oe=J(Xe,jt+xe,ce);if(!$e(Ne,Je,ee,Oe))return U(Xe,jt+xe),{x:ee,y:Oe}}const ie=Q(Xe,We,ce);ue&&U(Xe,jt);let Ze=ee;for(let xe=0;xe<64;xe++){const Oe=$e(Ne,Je,Ze,ie);if(!Oe)break;Ze=Oe.x+Oe.width+G+Je.width/2}return{x:Ze,y:ie}},Re=new Set(C.flows.map(Ne=>Ne.flow.target)),ye=new Map;for(const Ne of C.nodes){if(Re.has(Ne.node.id))continue;const Je=W(Ne.node,Ne.band),Xe=ge(Ne),We=Ne.node.lane?`${Ne.node.lane}|${Xe??""}`:Xe!==void 0?`band:${Xe}`:"",ee=oe(Ne.node),ce=me(ee,Je,Ne.node.lane,Xe,ye.get(We)??L,j);n.createShape(Je,ce,ee),ye.set(We,ce.x+Je.width+G),!Ne.node.lane&&Xe===void 0&&(j+=160)}const _e=new Set,_t=new Map,Wt=new Map,ht=new Map;if(b&&Ge.has(`pool:${b}`)){const Ne=new Map;for(const ie of C.flows)Ne.set(ie.flow.target,(Ne.get(ie.flow.target)??0)+1);const Je=ie=>Q(ie.node.lane,fe(ie),Number.NaN),Xe=new Set,We=ie=>{var Oe;const Ze=(Oe=S.get(ie))==null?void 0:Oe.node.participant;if(Ze)return l(Ze);const xe=l(ie);if(xe)return xe.type==="bpmn:Participant"?xe:p(xe)},ee=ie=>{const Ze=[],xe=new Set([ie]),Oe=[ie];for(;Oe.length;){const rt=Oe.shift(),Ve=S.get(rt);Ve&&Ze.push(Ve);for(const Ce of C.flows)Ce.flow.source!==rt||xe.has(Ce.flow.target)||(Ne.get(Ce.flow.target)??0)!==1||(xe.add(Ce.flow.target),Oe.push(Ce.flow.target))}return Ze},ce=ie=>{if(!A)return;const Ze=new Set(ie.map(rt=>rt.node.id));let xe=!1,Oe=!1;for(const rt of g){if(!Ze.has(rt.flow.source))continue;const Ve=We(rt.flow.target);!Ve||Ve.id===A.id||(Ve.y<A.y?xe=!0:Oe=!0)}return xe&&!Oe?"up":Oe&&!xe?"down":void 0};for(const ie of C.nodes){if(!ke(ie.node.type))continue;const Ze=Q(ie.node.lane,ge(ie),Number.NaN);if(Number.isNaN(Ze))continue;const xe=[];for(const Ce of C.flows){if(Ce.flow.source!==ie.node.id)continue;const Ue=S.get(Ce.flow.target);if(!Ue||Ue.node.lane!==ie.node.lane||(Ne.get(Ue.node.id)??0)!==1)continue;const tt=ge(Ue);if(tt===void 0)continue;const _n=Q(Ue.node.lane,tt,Number.NaN);if(Number.isNaN(_n))continue;const Zr=ee(Ue.node.id),Xt=ce(Zr);Xt&&xe.push({subtree:Zr,band:tt,row:_n,dir:Xt})}if(!xe.some(Ce=>Ce.dir==="up")||!xe.some(Ce=>Ce.dir==="down")||!xe.some(Ce=>Ce.dir==="up"&&xe.some(Ue=>Ue.dir==="down"&&Ue.row<Ce.row)))continue;const rt=[...xe].sort((Ce,Ue)=>Ce.row-Ue.row);[...xe.filter(Ce=>Ce.dir==="up"),...xe.filter(Ce=>Ce.dir==="down")].sort((Ce,Ue)=>Ce.dir===Ue.dir?Ce.row-Ue.row:Ce.dir==="up"?-1:1).forEach((Ce,Ue)=>{const tt=rt[Ue].band;if(tt!==Ce.band){Xe.add(ie.node.id);for(const _n of Ce.subtree)ge(_n)===Ce.band&&pe.set(_n.node.id,tt)}})}const ue=ie=>{if(!A)return;const Ze=new Set(ie.map(rt=>rt.node.id));let xe=!1,Oe=!1;for(const rt of g){if(!Ze.has(rt.flow.target))continue;const Ve=We(rt.flow.source);!Ve||Ve.id===A.id||(Ve.y<A.y?xe=!0:Oe=!0)}return xe&&!Oe?"up":Oe&&!xe?"down":void 0};for(const ie of C.nodes){if(!ke(ie.node.type))continue;const Ze=ie.node.lane??`pool:${b}`,xe=q.get(Ze);if(!xe||xe.size<2)continue;const Oe=xe.get(0);if(Oe===void 0)continue;const rt=Math.max(...xe.values()),Ve=Oe===rt&&Oe!==0?"down":void 0;if(!Ve)continue;const Ce=[];for(const Xt of C.flows){if(Xt.flow.source!==ie.node.id)continue;const ti=S.get(Xt.flow.target);if(!ti||ti.node.lane!==ie.node.lane||(Ne.get(ti.node.id)??0)!==1)continue;const Vx=fe(ti);Vx!==void 0&&Ce.push({t:ti,subtree:ee(ti.node.id),band:Vx})}const Ue=Ce.find(Xt=>(xe.get(Xt.band)??Xt.band)===Oe);if(!Ue||ue(Ue.subtree)===Ve||ce(Ue.subtree)===Ve)continue;const tt=Ce.find(Xt=>Xt!==Ue&&ue(Xt.subtree)===Ve);if(!tt)continue;const _n=Ue.band,Zr=tt.band;for(const Xt of Ue.subtree)fe(Xt)===_n&&pe.set(Xt.node.id,Zr);for(const Xt of tt.subtree)fe(Xt)===Zr&&pe.set(Xt.node.id,_n);Xe.add(ie.node.id)}for(const ie of C.nodes){if(!ke(ie.node.type))continue;const Ze=Je(ie);if(Number.isNaN(Ze)||x.some(Ce=>{var Ue,tt;return(((Ue=Ce.placement)==null?void 0:Ue.anchor)??(Ce.association?Ce.association.source===Ce.annotation.id?Ce.association.target:Ce.association.source:void 0))===ie.node.id&&((tt=Ce.placement)==null?void 0:tt.side.startsWith("bottom"))}))continue;let Oe,rt=!1,Ve;for(const Ce of C.flows){if(Ce.flow.source!==ie.node.id)continue;const Ue=S.get(Ce.flow.target);if(!Ue||!Ue.node.lane&&ge(Ue)===void 0)continue;const tt=Je(Ue);Number.isNaN(tt)||(Math.abs(tt-Ze)<.5&&(rt=!0),tt>Ze?!Oe||tt>Oe.row?Oe={id:Ue.node.id,row:tt,count:1}:tt===Oe.row&&Oe.count++:tt<Ze&&Ue.node.lane===ie.node.lane&&(!Ve||tt>Ve.row?Ve={op:Ue,row:tt,count:1}:tt===Ve.row&&Ve.count++))}Oe&&Oe.count===1&&(Ne.get(Oe.id)??0)===1&&!Xe.has(ie.node.id)&&_e.add(Oe.id),!rt&&Ve&&Ve.count===1&&(Ne.get(Ve.op.node.id)??0)===1&&!ne.has(ie.node.id)&&_t.set(Ve.op.node.id,{lane:ie.node.lane,band:fe(ie)})}const jt=new Map;for(const ie of g)jt.set(ie.flow.target,[...jt.get(ie.flow.target)??[],ie]);for(const ie of C.nodes){const Ze=jt.get(ie.node.id);if(!Ze||Ze.length!==1||!Ne.get(ie.node.id)||!ie.node.lane&&ge(ie)===void 0||z.has(ie.node.id))continue;const xe=(Nx=S.get(Ze[0].flow.source))==null?void 0:Nx.node.participant,Oe=xe?l(xe):void 0;if(!Oe||!A||Oe.id===A.id)continue;const rt=ie.node.lane??`pool:${b}`,Ve=q.get(rt);if(!Ve)continue;const Ce=Ve.get(0)??0,Ue=(Ve.get(fe(ie)??0)??Ce)-Ce;if(Ue===0)continue;const tt=Oe.y<A.y;if(tt&&Ue<0||!tt&&Ue>0)continue;let _n;for(const[Zr,Xt]of Ve){const ti=Xt-Ce;(tt&&ti<0&&(!_n||ti<_n.row)||!tt&&ti>0&&(!_n||ti>_n.row))&&(_n={band:Zr,row:ti})}_n&&Wt.set(ie.node.id,{lane:ie.node.lane,band:_n.band})}}const dt=new Set;let rn=0;for(;rn++<C.nodes.length+2;){for(let Xe=0;Xe<C.nodes.length+C.flows.length+2;Xe++){let We=!1;for(const ee of C.flows){const ce=ee.flow;if(dt.has(ce.id))continue;const ue=l(ce.source);if(!ue)continue;const jt=l(ce.target),ie=S.get(ce.target);if(!jt&&ie){const Ze=W(ie.node,ie.band),xe=fe(ie);if(ie.node.lane||xe!==void 0){const Oe=oe(ie.node),rt=ue,Ve=rt.x+(ht.get(ce.source)??0)+rt.width+G,Ce=_t.get(ce.target)??Wt.get(ce.target),Ue=me(Oe,Ze,Ce?Ce.lane:ie.node.lane,Ce?Ce.band:xe,_e.has(ce.target)?rt.x+rt.width/2:Ve,Number.NaN),tt=n.createShape(Ze,Ue,Oe);_e.has(ce.target)&&ht.set(ce.target,Ve-(tt.x+tt.width/2)),n.connect(ue,tt,{type:"bpmn:SequenceFlow",businessObject:B(ce)})}else s.append(ue,Ze,{connection:{type:"bpmn:SequenceFlow",businessObject:B(ce)}})}else if(jt)n.connect(ue,jt,{type:"bpmn:SequenceFlow",businessObject:B(ce)});else continue;dt.add(ce.id),We=!0}if(!We)break}const Ne=C.nodes.filter(Xe=>!l(Xe.node.id));if(!Ne.length)break;const Je=Ne[0];{const Xe=W(Je.node,Je.band),We=oe(Je.node),ee=ge(Je);n.createShape(Xe,me(We,Xe,Je.node.lane,ee,L,j),We),!Je.node.lane&&ee===void 0&&(j+=160)}}}const Ke=40,lt=(b,C=()=>!0)=>{const A=l(b);if(!A)return[];const L=[A],j=new Set([b]);for(let O=0;O<L.length;O++){const U=L[O].id;for(const Q of m){const J=Q.flow.target;if(Q.flow.source!==U||j.has(J)||!S.has(J))continue;j.add(J);const oe=l(J);oe&&C(oe)&&L.push(oe)}}return L},it=(b,C=()=>!0)=>{const A=l(b);if(!A)return[];const L=[A],j=new Set([b]);for(let O=0;O<L.length;O++){const U=L[O].id;for(const Q of m){const J=Q.flow.source;if(Q.flow.target!==U||j.has(J)||!S.has(J))continue;j.add(J);const oe=l(J);oe&&C(oe)&&L.push(oe)}}return L};for(const b of Zt(e,"sequenceFlow.update")){if(b.target===void 0)continue;const C=S.get(b.target);if(!C)continue;const A=l(b.target),L=l(b.id);if(!A||!L)continue;const j=b.source!==void 0?l(b.source):L.source,O=L.target;if(!j||!O||O.id===A.id)continue;const U=lt(b.target),Q=new Set(U.map(Re=>Re.id)),J=Math.min(...U.map(Re=>Re.x)),oe=Math.max(...U.map(Re=>Re.x+Re.width)),Fe=j.x+j.width,$e=oe-J+Ke*2-(O.x-Fe);if($e>0){const Re=p(A),ye=(Re==null?void 0:Re.children)??[],_e=ht=>ht.type==="bpmn:Lane",_t=ye.filter(ht=>!("waypoints"in ht&&ht.waypoints)&&!_e(ht)&&!Q.has(ht.id)&&ht.x>=O.x),Wt=Re?[Re,...ye.filter(ht=>_e(ht))]:[];_t.length&&n.createSpace(_t,Wt,{x:$e,y:0},"e",O.x-1)}const me=C.node.lane||C.band!==void 0?A.y+A.height/2:j.y+j.height/2;n.moveElements(U,{x:Fe+Ke-J,y:me-(A.y+A.height/2)})}const Bt=(b,C)=>{const A=C.target===b,L=f(C.source),j=f(C.target),O=A?"bpmn:DataOutputAssociation":"bpmn:DataInputAssociation";n.connect(L,j,C.id?{type:O,businessObject:i.create(O,{id:C.id})}:{type:O})},pn=100,fn=b=>{for(const C of d){if(!C.participant.blackBox)continue;const A=l(C.participant.id);if(!A)continue;const L=[];for(const O of g){const U=O.flow.source===C.participant.id?O.flow.target:O.flow.target===C.participant.id?O.flow.source:void 0,Q=U?l(U):void 0;Q&&typeof Q.x=="number"&&Q.type!=="bpmn:Participant"&&L.push(Q)}if(!L.length)continue;const j=Math.max(...L.map(O=>O.x+O.width/2))+pn;if(j>A.x+A.width&&n.resizeShape(A,{x:A.x,y:A.y,width:j-A.x,height:A.height}),!!b)for(const O of g){const U=l(O.flow.id),Q=O.flow.source===C.participant.id?O.flow.target:O.flow.target===C.participant.id?O.flow.source:void 0,J=Q?l(Q):void 0;if(!U||!J||J.type==="bpmn:Participant")continue;const oe=J.x+J.width/2;if(oe<A.x+10||oe>A.x+A.width-10)continue;const Fe=A.y>J.y,$e=Fe?J.y+J.height:J.y,me=Fe?A.y:A.y+A.height,Re=O.flow.source===C.participant.id?[{x:oe,y:me},{x:oe,y:$e}]:[{x:oe,y:$e},{x:oe,y:me}],ye=At(o),_e={...ye.edges.find(_t=>_t.id===O.flow.id),waypoints:Re};Hn(_e,ci(ye)).length||n.updateWaypoints(U,Re)}}};fn(!1);for(const b of g){const C=b.flow;n.connect(f(C.source),f(C.target),{type:"bpmn:MessageFlow",businessObject:i.create("bpmn:MessageFlow",{id:C.id,name:C.name})})}const ct=20,$t=30,dn=4,zo=2,ei=[10,30,80],Ei=b=>!("waypoints"in b&&b.waypoints)&&b.type!=="bpmn:Lane"&&b.type!=="label"&&typeof b.x=="number",hn=()=>{const b=At(o);return{bad:Xi(b).filter(C=>C.kind==="edge-crosses-shape"||C.kind==="edge-overlap-opposite"||C.kind==="edge-overlap-mixed").length,crossings:kd(b),straight:b.edges.filter(C=>C.type==="bpmn:MessageFlow"&&C.waypoints.length===2).length}},vt=b=>{const C=At(o),A=C.edges.find(L=>L.id===b);return A?Hn(A,ci(C)).length:0},Si=b=>vt(b)>0,Kr=b=>At(o).edges.filter(C=>C.type==="bpmn:MessageFlow"&&C.id!==b&&C.waypoints.length===2).length,En=(b,C)=>{const A=new Set(b.flatMap(O=>O.subtree.map(U=>U.id)));for(const O of b){const U=(O.pool.children??[]).filter(Ei).filter(J=>!A.has(J.id));if(O.subtree.some(J=>U.some(oe=>J.x+C<oe.x+oe.width+$t&&J.x+C+J.width+$t>oe.x&&J.y<oe.y+oe.height&&J.y+J.height>oe.y)))return null}const L=b.map(O=>O.pool.width);n.moveElements(b.flatMap(O=>O.subtree),{x:C,y:0});const j=b.map(O=>{const Q=Math.max(...O.subtree.map(J=>J.x+J.width))+150-(O.pool.x+O.pool.width);return Q>0&&n.resizeShape(O.pool,{x:O.pool.x,y:O.pool.y,width:O.pool.width+Q,height:O.pool.height}),Q});return()=>{n.moveElements(b.flatMap(O=>O.subtree),{x:-C,y:0}),b.forEach((O,U)=>{j[U]>0&&n.resizeShape(O.pool,{x:O.pool.x,y:O.pool.y,width:L[U],height:O.pool.height})})}},Qe=(b,C,A)=>En([{subtree:b,pool:C}],A),et=(b,C)=>C.bad>b.bad||C.crossings>b.crossings&&C.straight<=b.straight&&C.bad>=b.bad,jf=(b,C)=>et(b,C)||C.straight<b.straight,Ff=(b,C,A=()=>!0,L=et)=>{const j=hn(),O=En(b,C);if(!O)return!1;const U=hn();return L(j,U)||!A()?(O(),!1):!0},bx=(b,C,A,L=()=>!0)=>Ff([{subtree:b,pool:C}],A,L),Go=b=>{var C;return!!((C=S.get(b))!=null&&C.node.participant)},Za=new Map;for(const b of g){if(!Go(b.flow.target))continue;const C=Za.get(b.flow.target)??[];C.push(b),Za.set(b.flow.target,C)}const Hf=[...Za.keys()],xx=new Set(m.map(b=>b.flow.target)),wx=b=>Nt.findIndex(({op:C})=>C.participant.id===b);Hf.sort((b,C)=>{var j,O;const A=xx.has(b)?1:0,L=xx.has(C)?1:0;return A!==L?A-L:wx((j=S.get(b))==null?void 0:j.node.participant)-wx((O=S.get(C))==null?void 0:O.node.participant)});const Xr=b=>b.x+b.width/2,aD=b=>{const C=new Map;for(const j of o.getAll()){const O=j;if(!O.waypoints||!O.source||!O.target)continue;(C.get(O.source.id)??C.set(O.source.id,[]).get(O.source.id)).push(O.target.id)}const A=new Set([b]),L=[b];for(let j=0;j<L.length;j++)for(const O of C.get(L[j])??[])A.has(O)||(A.add(O),L.push(O));return A},sD=(b,C)=>{const A=aD(C);let L;for(const j of o.getAll()){const O=j;if(O.type!=="bpmn:MessageFlow"||!O.source||!O.target||O.target.id!==b||A.has(O.source.id))continue;const U=O.source;if(typeof U.x!="number"||U.type==="bpmn:Participant")continue;const Q=Xr(U);(L===void 0||Q>L)&&(L=Q)}return L},zf=(b,C)=>{const A=l(b.flow.source);if(A)return A.type==="bpmn:Participant"?sD(A.id,C):Xr(A)},Ex=b=>{let C;for(const A of Za.get(b)??[]){const L=zf(A,b);L!==void 0&&(!C||L>C.cx)&&(C={op:A,cx:L})}return C==null?void 0:C.op},cD=b=>{const C=Ex(b),A=l(b),L=C?zf(C,b):void 0;return A&&L!==void 0?L-Xr(A):void 0},uD=b=>{const C=cD(b);return C!==void 0&&Math.abs(C)<ct},Sx=(b,C,A,L,j)=>{var O;for(let U=!0;U;){U=!1;for(const Q of g){if(Q.flow.id===A)continue;const J=C.has(Q.flow.source),oe=C.has(Q.flow.target);if(J===oe||L(J?Q.flow.source:Q.flow.target))continue;const Fe=J?Q.flow.target:Q.flow.source;if(j(Fe)||!Go(Fe))continue;const $e=l(Q.flow.id);if(!($e!=null&&$e.waypoints)||$e.waypoints.length!==2)continue;const me=l(Fe),Re=(O=S.get(Fe))==null?void 0:O.node.participant;if(!me||!Re)continue;const ye=lt(Fe,_e=>_e.x>=me.x).filter(_e=>!C.has(_e.id));if(!(!ye.length||ye.some(_e=>j(_e.id)))){for(const _e of ye)C.add(_e.id);b.set(Re,[...b.get(Re)??[],...ye]),U=!0}}}return[...b].map(([U,Q])=>({subtree:Q,pool:f(U)}))},Rx=(b,C,A,L,j)=>Sx(new Map([[C,[...b]]]),new Set(b.map(O=>O.id)),L,O=>O===A,O=>O===j),Gf=b=>{const C=Ex(b);if(!C)return null;const A=l(b),L=l(C.flow.source),j=zf(C,b);if(!A||!L||j===void 0)return null;const O=j-Xr(A);if(O>=ct){const U=S.get(b).node.participant,Q=lt(b,J=>J.x>=A.x);return{groups:Rx(Q,U,b,C.flow.id,C.flow.source),dx:O}}if(-O>=ct&&Go(C.flow.source)){const U=S.get(C.flow.source).node.participant,Q=lt(C.flow.source,J=>J.x>=L.x&&!uD(J.id));return{groups:Rx(Q,U,C.flow.source,C.flow.id,b),dx:-O}}return null},Cx=()=>Hf.map(b=>({id:b,plan:Gf(b)})).filter(b=>!!b.plan).sort((b,C)=>Math.min(...b.plan.groups.flatMap(A=>A.subtree.map(L=>L.x)))-Math.min(...C.plan.groups.flatMap(A=>A.subtree.map(L=>L.x)))).map(b=>b.id);for(let b=0;b<3;b++){const C=hn(),A=[];for(const j of Cx()){const O=Gf(j);if(!O)continue;const U=En(O.groups,O.dx);U&&A.push(U)}if(!A.length)break;if(!jf(C,hn()))continue;for(const j of A.reverse())j();let L=!1;for(const j of Cx()){const O=Gf(j);O&&Ff(O.groups,O.dx,()=>!0,jf)&&(L=!0)}if(!L)break}for(const b of Hf.flatMap(C=>Za.get(C)??[])){if(!Si(b.flow.id))continue;const C=l(b.flow.target);if(!C)continue;const A=f(S.get(b.flow.target).node.participant),L=lt(b.flow.target,Q=>Q.x>=C.x),j=C.width+G,O=vt(b.flow.id),U=Kr(b.flow.id);for(let Q=1;Q<=dn;Q++){const J=()=>vt(b.flow.id)<O&&Kr(b.flow.id)>=U;if(bx(L,A,j*Q,J))break}}for(const b of g){if(!Si(b.flow.id))continue;const C=l(b.flow.source),A=l(b.flow.target);if(!C||!A||C.type==="bpmn:Participant"||A.type==="bpmn:Participant")continue;const L=C.x+C.width/2;if(Math.abs(L-(A.x+A.width/2))>15)continue;const[j,O]=C.y<A.y?[C.y+C.height,A.y]:[A.y+A.height,C.y],U=[...S.values()].map(Q=>l(Q.node.id)).filter(Q=>!!Q&&Q.id!==C.id&&Q.id!==A.id).filter(Q=>Q.x<=L&&L<=Q.x+Q.width&&Q.y+Q.height>j&&Q.y<O).sort((Q,J)=>Q.x-J.x);for(const Q of U){const J=(Bx=S.get(Q.id))==null?void 0:Bx.node.participant,oe=J?l(J):void 0;if(!oe)continue;const Fe=[...S.values()].filter(dt=>dt.node.participant===J).map(dt=>dt.node.id),$e=dt=>dt.map(rn=>l(rn)).filter(rn=>!!rn),Re=[it(Q.id,dt=>{var rn;return((rn=S.get(dt.id))==null?void 0:rn.node.participant)===J}),$e(Fe)].filter(dt=>dt.length),ye=Q.width+G,_e=vt(b.flow.id),_t=Kr(b.flow.id),Wt=()=>vt(b.flow.id)<_e&&Kr(b.flow.id)>=_t;let ht=!1;for(const dt of Re){for(let rn=1;rn<=dn;rn++)if(bx(dt,oe,ye*rn,Wt)){ht=!0;break}if(ht)break}if(!Si(b.flow.id))break}}for(const b of g){if(!Si(b.flow.id))continue;const C=l(b.flow.id);if((($x=C==null?void 0:C.waypoints)==null?void 0:$x.length)!==2)continue;const A=l(b.flow.source),L=l(b.flow.target);if(!A||!L||A.type==="bpmn:Participant"||L.type==="bpmn:Participant"||!Go(b.flow.source)||!Go(b.flow.target)||Math.abs(Xr(A)-Xr(L))>zo)continue;const j=Xr(A),O=C.waypoints.map(_e=>_e.y),[U,Q]=[Math.min(...O),Math.max(...O)],J=ci(At(o)).filter(_e=>_e.id!==A.id&&_e.id!==L.id&&_e.x<j&&j<_e.x+_e.width&&U<_e.y+_e.height&&_e.y<Q);if(!J.length)continue;const oe=(jx=S.get(b.flow.source))==null?void 0:jx.node.participant,Fe=(Fx=S.get(b.flow.target))==null?void 0:Fx.node.participant;if(!oe||!Fe)continue;const $e=new Map;for(const[_e,_t,Wt]of[[b.flow.source,A,oe],[b.flow.target,L,Fe]]){const ht=$e.get(Wt)??[],dt=lt(_e,rn=>rn.x>=_t.x).filter(rn=>!ht.some(Ne=>Ne.id===rn.id));$e.set(Wt,[...ht,...dt])}const me=new Set([...$e.values()].flat().map(_e=>_e.id)),Re=Sx($e,me,b.flow.id,_e=>_e===b.flow.source||_e===b.flow.target,()=>!1),ye=Math.max(...J.map(_e=>_e.x+_e.width));for(const _e of ei){const _t=ye+_e-j;if(_t<=0)continue;if(Ff(Re,_t,()=>{var ht,dt;return vt(b.flow.id)===0&&((dt=(ht=l(b.flow.id))==null?void 0:ht.waypoints)==null?void 0:dt.length)===2},jf))break}}{const b=A=>A.y+A.height/2,C=[];for(const A of S.keys()){if(!Go(A))continue;const L=m.filter(U=>U.flow.target===A);if(L.length!==1)continue;const j=l(L[0].flow.source),O=l(A);!j||!O||!S.has(j.id)||Math.abs(b(j)-b(O))>1||O.x-(j.x+j.width)<=G+1||C.push({id:A,pred:j,node:O})}C.sort((A,L)=>A.node.x-L.node.x);for(const{id:A}of C){const L=S.get(A),j=l(A),O=l(m.find(me=>me.flow.target===A).flow.source);if(!j||!O)continue;const U=j.x-(O.x+O.width);if(U<=G+1)continue;const Q=f(L.node.participant),J=lt(A,me=>me.x>=j.x),oe=hn(),Fe=Qe(J,Q,-(U-G));if(!Fe)continue;const $e=hn();($e.bad>oe.bad||$e.crossings>=oe.crossings||$e.straight<oe.straight)&&Fe()}}fn(!0);for(const b of R){const C=b.associations??[],A=C.map(O=>O.source===b.dataStore.id?O.target:O.source).map(l).find(Boolean),L=A?p(A)??u():u(),j=A?{x:A.x+A.width/2,y:A.y+A.height+110}:{x:200,y:P+60};n.createShape({type:"bpmn:DataStoreReference",businessObject:i.create("bpmn:DataStoreReference",{id:b.dataStore.id,name:b.dataStore.name})},j,L);for(const O of C)Bt(b.dataStore.id,O)}for(const b of E){const A=f(b.association.target).type==="bpmn:DataStoreReference"?b.association.target:b.association.source;Bt(A,b.association)}let Px=0;const Ax=10,Tx=(b,C)=>{for(const A of C.map(L=>p(L)).filter(L=>!!L)){const L=Ax,j=A.y,O=A.y+A.height,U=A.x,Q=A.x+A.width;if(Math.abs(b.y-j)<L){const J=j+L-b.y;b.y+=J,b.height-=J}if(Math.abs(b.y+b.height-O)<L&&(b.height=O-L-b.y),Math.abs(b.x-U)<L){const J=U+L-b.x;b.x+=J,b.width-=J}Math.abs(b.x+b.width-Q)<L&&(b.width=Q-L-b.x)}},Mx=(b,C)=>{const A=Ax,L=30,j=o.filter(O=>O.type==="bpmn:Group"&&O.id!==C);for(const O of j){const U=O.x,Q=O.x+O.width,J=O.y,oe=O.y+O.height,Fe=b.y<oe&&J<b.y+b.height,$e=b.x<Q&&U<b.x+b.width;if(Fe){if(Math.abs(b.x-Q)<A){const me=Math.min(Q+A-b.x,L);me>0&&b.width-me>0&&(b.x+=me,b.width-=me)}if(Math.abs(b.x+b.width-U)<A){const me=Math.min(b.x+b.width-(U-A),L);me>0&&b.width-me>0&&(b.width-=me)}}if($e){if(Math.abs(b.y-oe)<A){const me=Math.min(oe+A-b.y,L);me>0&&b.height-me>0&&(b.y+=me,b.height-=me)}if(Math.abs(b.y+b.height-J)<A){const me=Math.min(b.y+b.height-(J-A),L);me>0&&b.height-me>0&&(b.height-=me)}}}};for(const b of w){const C=(b.group.members??[]).map(l).filter(O=>!!O),A=40;let L;if(C.length){const O=Math.min(...C.map(oe=>oe.x))-A,U=Math.min(...C.map(oe=>oe.y))-A,Q=Math.max(...C.map(oe=>oe.x+oe.width))+A,J=Math.max(...C.map(oe=>oe.y+oe.height))+A;L={x:O,y:U,width:Q-O,height:J-U},Tx(L,C),Mx(L,b.group.id)}else L={x:300+Px*350,y:40,width:300,height:200},Px++;const j=n.createShape({type:"bpmn:Group",businessObject:i.create("bpmn:Group",{id:b.group.id}),width:L.width,height:L.height},{x:L.x+L.width/2,y:L.y+L.height/2},u());b.group.name&&n.updateLabel(j,b.group.name),(Hx=b.group.members)!=null&&Hx.length&&M(j,"bwl:Members",{refs:b.group.members.join(" ")})}const kx=b=>{const C=b.waypoints;if(C!=null&&C.length){const L=C[Math.floor((C.length-1)/2)];return{x:L.x,y:L.y,width:0,height:0}}const A=b;return{x:A.x,y:A.y,width:A.width,height:A.height}},Ox=(b,C,A,L)=>{const j=C,O=(ee,ce)=>{const[ue,jt]=qu[ee];let ie={x:b.x+b.width/2+ue*(b.width/2+j.width/2+ce),y:b.y+b.height/2+jt*(b.height/2+j.height/2+ce)};const Ze=A.x+nn+j.width/2,xe=A.x+A.width-nn-j.width/2,Oe=A.y+nn+j.height/2,rt=A.y+A.height-nn-j.height/2,Ve={x:Math.min(xe,Math.max(Ze,ie.x)),y:Math.min(rt,Math.max(Oe,ie.y))};return(Ve.x!==ie.x||Ve.y!==ie.y)&&(ie=Math.abs(Ve.x-(b.x+b.width/2))<(b.width+j.width)/2+nn&&Math.abs(Ve.y-(b.y+b.height/2))<(b.height+j.height)/2+nn?{x:b.x+b.width+nn+j.width/2,y:Ve.y}:Ve),ie},U=(A.children??[]).filter(ee=>!("waypoints"in ee&&ee.waypoints)&&ee.type!=="bpmn:Lane"&&ee.type!=="label"&&typeof ee.x=="number"&&ee.id!==L.selfId),Q=At(o),J=ee=>{var ue,jt;if(!L.selfId)return!1;const ce=o.get(ee);return!!ce&&(((ue=ce.source)==null?void 0:ue.id)===L.selfId||((jt=ce.target)==null?void 0:jt.id)===L.selfId)},oe=Q.edges.filter(ee=>!J(ee.id)).flatMap(gn),Fe=Ko(Q).filter(ee=>ee.owner!==L.selfId).map(ee=>ee.rect),$e=ee=>({x0:ee.x-j.width/2-nn,x1:ee.x+j.width/2+nn,y0:ee.y-j.height/2-nn,y1:ee.y+j.height/2+nn}),me=ee=>{const ce=$e(ee);return U.some(ue=>ce.x0<ue.x+ue.width&&ce.x1>ue.x&&ce.y0<ue.y+ue.height&&ce.y1>ue.y)},Re=ee=>{const ce=$e(ee);return oe.some(ue=>ue.axis==="h"?ue.at>ce.y0&&ue.at<ce.y1&&ue.lo<ce.x1&&ue.hi>ce.x0:ue.at>ce.x0&&ue.at<ce.x1&&ue.lo<ce.y1&&ue.hi>ce.y0)},ye=ee=>{const ce=$e(ee);return Fe.some(ue=>ce.x0<ue.x+ue.width&&ce.x1>ue.x&&ce.y0<ue.y+ue.height&&ce.y1>ue.y)},_e=Q.shapes.filter(ee=>ee.type==="bpmn:Group").flatMap(ee=>[{axis:"h",at:ee.y,lo:ee.x,hi:ee.x+ee.width},{axis:"h",at:ee.y+ee.height,lo:ee.x,hi:ee.x+ee.width},{axis:"v",at:ee.x,lo:ee.y,hi:ee.y+ee.height},{axis:"v",at:ee.x+ee.width,lo:ee.y,hi:ee.y+ee.height}]),_t=ee=>{const ce=$e(ee);return _e.some(ue=>ue.axis==="h"?ue.at>ce.y0&&ue.at<ce.y1&&ue.lo<ce.x1&&ue.hi>ce.x0:ue.at>ce.x0&&ue.at<ce.x1&&ue.lo<ce.y1&&ue.hi>ce.y0)},Wt=ee=>me(ee)||Re(ee)||ye(ee)||_t(ee),ht=ee=>ee.x-j.width/2>=A.x&&ee.x+j.width/2<=A.x+A.width&&ee.y-j.height/2>=A.y&&ee.y+j.height/2<=A.y+A.height;if(L.placement){const ee=xe=>xe.startsWith("top")?xe.replace(/^top/,"bottom"):xe.replace(/^bottom/,"top"),ce=xe=>xe.endsWith("left")?xe.replace(/left$/,"right"):xe.replace(/right$/,"left"),ue=L.placement.side,jt=[ue,ee(ue),ce(ue),ee(ce(ue)),"top","bottom","left","right","top-left","top-right","bottom-left","bottom-right"],ie=L.placement.offset??50;let Ze=O(ue,ie);if(Wt(Ze)){const xe=new Set;for(const Oe of jt){if(xe.has(Oe))continue;xe.add(Oe);const rt=O(Oe,ie);if(ht(rt)&&!Wt(rt)){Ze=rt;break}}}return Ze}const dt=L.from,rn=A.x+nn+j.width/2,Ne=A.x+A.width-nn-j.width/2,Je=A.y+nn+j.height/2,Xe=A.y+A.height-nn-j.height/2;let We={x:Math.min(Ne,Math.max(rn,dt.x)),y:Math.min(Xe,Math.max(Je,dt.y))};if(Wt(We)){const ee=(b.width+j.width)/2+nn,ue=[{x:We.x+ee,y:We.y},{x:We.x-ee,y:We.y},{x:We.x,y:We.y-j.height-nn},{x:We.x,y:We.y+j.height+nn}].filter(ht).find(jt=>!Wt(jt));ue&&(We=ue)}return We};let Qa=0;const Dx=12,Lx=14,lD=15,pD=300,fD=b=>{const C=b.split(`
7
+ `),A=Math.max(...C.map(O=>ao(O,Dx))),L=Math.max(100,Math.min(pD,Math.ceil(A)+Lx)),j=C.reduce((O,U)=>O+Math.max(1,Math.ceil((ao(U,Dx)+Lx)/L)),0);return{width:L,height:Math.max(30,j*lD+10)}},nn=10;for(const b of x){const C=b.association,A=((zx=b.placement)==null?void 0:zx.anchor)??(C?C.source===b.annotation.id?C.target:C.source:void 0),L=A?l(A):void 0,j=L?kx(L):void 0,O=fD(b.annotation.text??"");let U;if(j&&b.placement){const[Fe,$e]=qu[b.placement.side],me=b.placement.offset??50;U={x:j.x+j.width/2+Fe*(j.width/2+O.width/2+me),y:j.y+j.height/2+$e*(j.height/2+O.height/2+me)}}else j?(U={x:j.x+j.width/2+180+Qa%3*260,y:j.y-110-Qa%2*95},Qa++):(U={x:300+Qa*260,y:60},Qa++);const Q=L?p(L)??u():u(),J=Q;j&&typeof J.x=="number"&&typeof J.width=="number"&&J.type==="bpmn:Participant"&&(U=Ox(j,O,J,b.placement?{placement:b.placement}:{from:U}));const oe=n.createShape({type:"bpmn:TextAnnotation",width:O.width,height:O.height,businessObject:i.create("bpmn:TextAnnotation",{id:b.annotation.id,text:b.annotation.text})},U,Q);if(C){const Fe=$e=>$e===b.annotation.id?oe:f($e);n.connect(Fe(C.source),Fe(C.target),C.id?{type:"bpmn:Association",businessObject:i.create("bpmn:Association",{id:C.id})}:{type:"bpmn:Association"})}b.placement&&M(oe,"bwl:Placement",N(b.placement))}for(const b of Zt(e,"association.add")){const C=b.association;n.connect(f(C.source),f(C.target),C.id?{type:"bpmn:Association",businessObject:i.create("bpmn:Association",{id:C.id})}:{type:"bpmn:Association"})}for(const b of Zt(e,"node.update")){let C=f(b.id);if(b.type&&ys(b.type)!==C.type&&(C=c.replaceElement(C,{type:ys(b.type)})),b.name!==void 0&&n.updateProperties(C,{name:b.name??void 0}),b.lane){const A=f(b.lane),L=A.y+A.height/2-(C.y+C.height/2);L!==0&&n.moveElements([C],{x:0,y:L})}}for(const b of Zt(e,"sequenceFlow.update")){const C=f(b.id);if(b.source!==void 0||b.target!==void 0){const A=C,L=b.source!==void 0?f(b.source):A.source,j=b.target!==void 0?f(b.target):A.target,O=U=>({x:U.x+U.width/2,y:U.y+U.height/2});n.reconnect(A,L,j,[O(L),O(j)])}b.name!==void 0&&n.updateProperties(C,{name:b.name??void 0}),b.condition!==void 0&&n.updateProperties(C,{name:((Gx=b.condition)==null?void 0:Gx.label)??void 0})}for(const b of Zt(e,"messageFlow.update"))b.name!==void 0&&n.updateProperties(f(b.id),{name:b.name??void 0});for(const b of Zt(e,"dataStore.update"))b.name!==void 0&&n.updateProperties(f(b.id),{name:b.name??void 0});for(const b of Zt(e,"annotation.update")){const C=f(b.id);if(b.text!==void 0&&n.updateProperties(C,{text:b.text}),b.placement===null)M(C,"bwl:Placement",null);else if(b.placement){const A=f(b.placement.anchor),L=kx(A),j=p(A)??u(),O=typeof j.x=="number"&&typeof j.width=="number"&&j.type==="bpmn:Participant",[U,Q]=qu[b.placement.side],J=b.placement.offset??50,oe={x:L.x+L.width/2+U*(L.width/2+C.width/2+J),y:L.y+L.height/2+Q*(L.height/2+C.height/2+J)},Fe=O?Ox(L,{width:C.width,height:C.height},j,{placement:b.placement,selfId:b.id}):oe;n.moveElements([C],{x:Fe.x-(C.x+C.width/2),y:Fe.y-(C.y+C.height/2)}),M(C,"bwl:Placement",N(b.placement))}}for(const b of Zt(e,"group.update")){const C=f(b.id);if(b.name!==void 0&&n.updateLabel(C,b.name??""),b.members){const A=b.members.map(l).filter(L=>!!L);if(A.length){const j=Math.min(...A.map(oe=>oe.x))-40,O=Math.min(...A.map(oe=>oe.y))-40,U=Math.max(...A.map(oe=>oe.x+oe.width))+40,Q=Math.max(...A.map(oe=>oe.y+oe.height))+40,J={x:j,y:O,width:U-j,height:Q-O};Tx(J,A),Mx(J,b.id),n.resizeShape(C,J)}M(C,"bwl:Members",{refs:b.members.join(" ")})}}}function ph(e,t,n=lh){const i=uh(e),r=ch(t,$d(i.elementRegistry)),o={edgeCrossings:{before:0,after:0,pairs:[]}};if(r.length)return{ok:!1,issues:r,findings:[],stats:o};const a=At(i.elementRegistry),s=new Set(Xi(a).map(Ki)),c=new Set(a.edges.map(m=>m.id)),u=new Set(a.shapes.map(m=>m.id)),l=Wu(a).length,f=e.get("commandStack");try{qf(f,()=>{n(t,i),Yd(i,c),Vd(i,s),Jd(i,s,c),Zd(i,c),hE(i,c),ih(i,s,c),nh(i,c),oh(i,u)})}catch(m){return{ok:!1,issues:[{kind:"lower-failed",message:m instanceof Error?m.message:String(m)}],findings:[],stats:o}}const p=At(i.elementRegistry),d=Xi(p).filter(m=>!s.has(Ki(m))),h=Wu(p);return{ok:!0,issues:[],findings:d,stats:{edgeCrossings:{before:l,after:h.length,pairs:h}}}}function bE(e){const t=e.slice(e.indexOf(":")+1);return t.charAt(0).toLowerCase()+t.slice(1)}function xE(e,t){return typeof e.get=="function"?e.get(t):e[t]}function fh(e,t){const n=xE(e,t);return typeof n=="number"&&Number.isFinite(n)?n:void 0}function dh(e,t){var i;return(((i=e.extensionElements)==null?void 0:i.values)??[]).find(r=>(r==null?void 0:r.$type)===t)}function wE(e){return typeof e=="string"&&Eu.includes(e)}function ui(e){if(typeof e=="string")return e;const t=e==null?void 0:e.id;return typeof t=="string"?t:void 0}function hh(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:{}},f=[],p=[],d=[],h=[],m=[],g=[],R=new Set,E=new Set,x=q=>{q&&R.add(q)},w=q=>{R.add(q),E.add(q)},S=q=>{const he=dh(q,"bwl:Placement");if(!he)return;const ge=typeof he.anchor=="string"?he.anchor:void 0;if(!ge||!wE(he.side))return;const pe=typeof he.offset=="number"?he.offset:void 0;m.push({owner:q.id,anchor:ge,side:he.side,...pe!==void 0?{offset:pe}:{}})},M=q=>{const he=dh(q,"bwl:Members"),ge=typeof(he==null?void 0:he.refs)=="string"?he.refs.split(/\s+/).filter(Boolean):[];ge.length&&g.push({owner:q.id,refs:ge})},N=q=>{var he;for(const ge of q)switch(x(ge.id),ge.$type){case"bpmn:TextAnnotation":w(ge.id),s.push({id:ge.id,text:typeof ge.text=="string"?ge.text:""}),S(ge);break;case"bpmn:Association":d.push({id:ge.id,type:ge.$type,source:ui(ge.sourceRef),target:ui(ge.targetRef)});break;case"bpmn:Group":{w(ge.id);const pe=(he=ge.categoryValueRef)==null?void 0:he.value;c.push({id:ge.id,...typeof pe=="string"&&pe?{name:pe}:{}}),M(ge);break}default:u.push({id:ge.id,type:ge.$type,reason:"type-outside-mvp"})}},T=(q,he)=>{const ge=q.flowElements??[],pe=(q.laneSets??[]).flatMap(ne=>ne.lanes??[]),fe=new Map;for(const ne of pe){x(ne.id);for(const z of ne.flowNodeRef??[]){const F=ui(z);F&&fe.set(F,ne.id)}}for(const ne of ge){if(x(ne.id),ne.$type==="bpmn:SequenceFlow"){f.push({id:ne.id,source:ui(ne.sourceRef),target:ui(ne.targetRef),...typeof ne.name=="string"&&ne.name?{name:ne.name}:{}});continue}if(ne.$type==="bpmn:DataStoreReference"){w(ne.id),a.push({id:ne.id,...ne.name?{name:ne.name}:{}});continue}const z=bE(ne.$type);if(!Vf(z)){u.push({id:ne.id,type:ne.$type,reason:"type-outside-mvp"});continue}w(ne.id),o.push({id:ne.id,type:z,...ne.name?{name:ne.name}:{},...he?{participant:he}:{},...fe.has(ne.id)?{lane:fe.get(ne.id)}:{}});const F=fh(ne,"bwl:band");F!==void 0&&(l.bands[ne.id]=F);for(const Y of ne.dataOutputAssociations??[])x(Y.id),h.push({id:Y.id,type:Y.$type,source:ne.id,target:ui(Y.targetRef)});for(const Y of ne.dataInputAssociations??[])x(Y.id),h.push({id:Y.id,type:Y.$type,source:ui((Y.sourceRef??[])[0]),target:ne.id})}N(q.artifacts??[])};if(n){const q=new Set;for(const he of n.participants??[]){w(he.id);const ge=ui(he.processRef);ge&&q.add(ge);const pe=ge?i.get(ge):void 0,fe=((pe==null?void 0:pe.laneSets)??[]).flatMap(Y=>Y.lanes??[]),ne=fe.map(Y=>({id:Y.id,...Y.name?{name:Y.name}:{}}));for(const Y of ne)w(Y.id);const z=!pe||(pe.flowElements??[]).length===0&&fe.length===0&&(pe.artifacts??[]).length===0;r.push({id:he.id,...he.name?{name:he.name}:{},...z?{blackBox:!0}:{},...ne.length?{lanes:ne}:{}});const F=fh(he,"bwl:poolOrder");F!==void 0&&(l.poolOrders[he.id]=F),pe&&T(pe,he.id)}for(const he of n.messageFlows??[])x(he.id),p.push({id:he.id,source:ui(he.sourceRef),target:ui(he.targetRef),...typeof he.name=="string"&&he.name?{name:he.name}:{}});N(n.artifacts??[]);for(const[he,ge]of i)!q.has(he)&&(ge.flowElements??[]).length>0&&u.push({id:he,type:ge.$type,reason:"unreachable-process"})}else for(const q of i.values())T(q);const H=[],G=[],$=[],V=[],de=(q,he)=>!!q&&!!he&&E.has(q)&&E.has(he);for(const q of f){if(!de(q.source,q.target)){u.push({id:q.id,type:"bpmn:SequenceFlow",reason:"endpoint-outside-mvp"});continue}H.push({id:q.id,source:q.source,target:q.target,...q.name?{name:q.name}:{}}),E.add(q.id)}for(const q of p){if(!de(q.source,q.target)){u.push({id:q.id,type:"bpmn:MessageFlow",reason:"endpoint-outside-mvp"});continue}G.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(!de(q.source,q.target)){u.push({id:q.id??"",type:q.type,reason:"endpoint-outside-mvp"});continue}V.push({...q.id?{id:q.id}:{},source:q.source,target:q.target}),q.id&&E.add(q.id)}for(const q of d){if(!de(q.source,q.target)){u.push({id:q.id??"",type:q.type,reason:"endpoint-outside-mvp"});continue}$.push({...q.id?{id:q.id}:{},source:q.source,target:q.target})}const Ge=new Map(c.map(q=>[q.id,q]));for(const{owner:q,refs:he}of g){const ge=he.filter(fe=>R.has(fe)),pe=Ge.get(q);pe&&ge.length&&(pe.members=ge)}for(const q of m)R.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:H,...G.length?{messageFlows:G}:{},...a.length?{dataStores:a}:{},...V.length?{dataAssociations:V}:{},...s.length?{annotations:s}:{},...$.length?{associations:$}:{},...c.length?{groups:c}:{}},hints:l,omitted:u}}async function EE(e){const{definitions:t,warnings:n}=await Fu(e);return{...hh(t),warnings:n}}function SE(e,t,n,i={}){return{documentId:e,baseVersion:t,ops:[...n],origin:i.origin??"agent",clientOpId:(i.mkClientOpId??(()=>crypto.randomUUID()))()}}async function mh(e,t,{currentVersion:n}){if(t.baseVersion!==n)return{status:"conflict",baseVersion:t.baseVersion,currentVersion:n};const i=ph(e,t.ops);if(!i.ok)return{status:"rejected",issues:i.issues};const{xml:r}=await e.saveXML({format:!0});return{status:"applied",version:n+1,xml:r??"",findings:i.findings,stats:i.stats}}const RE=Symbol("bpmn-editor");function CE(){const e=Pt.ref(!1),t=Pt.ref(!0),n=Pt.ref(!1);let i,r;const o=()=>{e.value=!0};function a(u,l){u.get("canvas").getContainer().style.pointerEvents=l?"":"none";const f=u.get("keyboard");l?(r&&f.bind(r),r=void 0):r||(r=f.getBinding(),f.unbind())}function s(){if(!i)throw new Error("modeler not attached — 뷰 @ready 후 attach() 필요");return i}function c(){return i==null?void 0:i.get("commandStack")}return{dirty:e,editable:t,agentBusy:n,attach(u){i&&this.detach(),i=u,i.get("eventBus").on("commandStack.changed",o),t.value||a(i,!1)},detach(){i==null||i.get("eventBus").off("commandStack.changed",o),i&&!t.value&&a(i,!0),r=void 0,i=void 0},setEditable(u){t.value=u,i&&a(i,u)},async applyAgentBatch(u,l){const f=s();n.value=!0;try{const p=await mh(f,u,{currentVersion:l});return p.status==="applied"&&(e.value=!1),p}finally{n.value=!1}},async importXml(u){const{warnings:l}=await s().importXML(u);return e.value=!1,{warnings:Hu(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 ae(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}function PE(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Ku={exports:{}},gh;function AE(){if(gh)return Ku.exports;gh=1;var e=Ku.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},Ku.exports}var TE=AE(),ME=PE(TE);function li(e){if(!(this instanceof li))return new li(e);e=e||[128,36,1],this._seed=e.length?ME.rack(e[0],e[1],e[2]):e}li.prototype.next=function(e){return this._seed(e||!0)},li.prototype.nextPrefixed=function(e,t){var n;do n=e+this.next(!0);while(this.assigned(n));return this.claim(n,t),n},li.prototype.claim=function(e,t){this._seed.set(e,t||!0)},li.prototype.assigned=function(e){return this._seed.get(e)||!1},li.prototype.unclaim=function(e){delete this._seed.hats[e]},li.prototype.clear=function(){var e=this._seed.hats,t;for(t in e)this.unclaim(t)};const Ht={legend:[1,"<fieldset>","</fieldset>"],tr:[2,"<table><tbody>","</tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],_default:[0,"",""]};Ht.td=Ht.th=[3,"<table><tbody><tr>","</tr></tbody></table>"],Ht.option=Ht.optgroup=[1,'<select multiple="multiple">',"</select>"],Ht.thead=Ht.tbody=Ht.colgroup=Ht.caption=Ht.tfoot=[1,"<table>","</table>"],Ht.polyline=Ht.ellipse=Ht.polygon=Ht.circle=Ht.text=Ht.line=Ht.path=Ht.rect=Ht.g=[1,'<svg xmlns="http://www.w3.org/2000/svg" version="1.1">',"</svg>"];function pt(e,t=globalThis.document){var u;if(typeof e!="string")throw new TypeError("String expected");const n=/^<!--(.*?)-->$/s.exec(e);if(n)return t.createComment(n[1]);const i=(u=/<([\w:]+)/.exec(e))==null?void 0:u[1];if(!i)return t.createTextNode(e);if(e=e.trim(),i==="body"){const l=t.createElement("html");l.innerHTML=e;const{lastChild:f}=l;return f.remove(),f}let[r,o,a]=Object.hasOwn(Ht,i)?Ht[i]:Ht._default,s=t.createElement("div");for(s.innerHTML=o+e+a;r--;)s=s.lastChild;if(s.firstChild===s.lastChild){const{firstChild:l}=s;return l.remove(),l}const c=t.createDocumentFragment();return c.append(...s.childNodes),c}function kE(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 yn(e,...t){const n=e.style;return k(t,function(i){i&&k(i,function(r,o){n[o]=r})}),e}function cn(e,t,n){return arguments.length==2?e.getAttribute(t):n===null?e.removeAttribute(t):(e.setAttribute(t,n),e)}const OE=Object.prototype.toString;function yt(e){return new Zi(e)}function Zi(e){if(!e||!e.nodeType)throw new Error("A DOM element reference is required");this.el=e,this.list=e.classList}Zi.prototype.add=function(e){return this.list.add(e),this},Zi.prototype.remove=function(e){return OE.call(e)=="[object RegExp]"?this.removeMatching(e):(this.list.remove(e),this)},Zi.prototype.removeMatching=function(e){const t=this.array();for(let n=0;n<t.length;n++)e.test(t[n])&&this.remove(t[n]);return this},Zi.prototype.toggle=function(e,t){return typeof t<"u"?t!==this.list.toggle(e,t)&&this.list.toggle(e):this.list.toggle(e),this},Zi.prototype.array=function(){return Array.from(this.list)},Zi.prototype.has=Zi.prototype.contains=function(e){return this.list.contains(e)};function vs(e){for(var t;t=e.firstChild;)e.removeChild(t);return e}function Or(e,t,n){var i=n?e:e.parentNode;return i&&typeof i.closest=="function"&&i.closest(t)||null}function DE(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var _s={},yh;function LE(){if(yh)return _s;yh=1;var e,t,n;function i(){e=window.addEventListener?"addEventListener":"attachEvent",t=window.removeEventListener?"removeEventListener":"detachEvent",n=e!=="addEventListener"?"on":""}return _s.bind=function(r,o,a,s){return e||i(),r[e](n+o,a,s||!1),a},_s.unbind=function(r,o,a,s){return t||i(),r[t](n+o,a,s||!1),a},_s}var vh=LE(),IE=DE(vh),Ae=kE({__proto__:null,default:IE},[vh]),_h=["focus","blur"];function NE(e,t,n,i,r){return _h.indexOf(n)!==-1&&(r=!0),Ae.bind(e,n,function(o){var a=o.target||o.srcElement;o.delegateTarget=Or(a,t,!0),o.delegateTarget&&i.call(e,o)},r)}function BE(e,t,n,i){return _h.indexOf(t)!==-1&&(i=!0),Ae.unbind(e,t,n,i)}var An={bind:NE,unbind:BE};function Xu(e,t){return e&&typeof e.matches=="function"&&e.matches(t)||!1}function nt(e,t){return t=t||document,t.querySelector(e)}function bs(e,t){return t=t||document,t.querySelectorAll(e)}function pi(e){e.parentNode&&e.parentNode.removeChild(e)}function $E(e,t){if(e.ownerDocument!==t.ownerDocument)try{return t.ownerDocument.importNode(e,!0)}catch{}return e}function jE(e,t){return t.appendChild($E(e,t))}function Te(e,t){return jE(t,e),e}var Zu=2,bh={"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":Zu,"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":Zu,"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 bh[t]?e.style[t]:e.getAttributeNS(null,t)}function xh(e,t,n){var i=t.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase(),r=bh[i];r?(r===Zu&&typeof n=="number"&&(n=String(n)+"px"),e.style[i]=n):e.setAttributeNS(null,t,n)}function HE(e,t){var n=Object.keys(t),i,r;for(i=0,r;r=n[i];i++)xh(e,r,t[r])}function se(e,t,n){if(typeof t=="string")if(n!==void 0)xh(e,t,n);else return FE(e,t);else HE(e,t);return e}const zE=Object.prototype.toString;function ze(e){return new Qi(e)}function Qi(e){if(!e||!e.nodeType)throw new Error("A DOM element reference is required");this.el=e,this.list=e.classList}Qi.prototype.add=function(e){return this.list.add(e),this},Qi.prototype.remove=function(e){return zE.call(e)=="[object RegExp]"?this.removeMatching(e):(this.list.remove(e),this)},Qi.prototype.removeMatching=function(e){const t=this.array();for(let n=0;n<t.length;n++)e.test(t[n])&&this.remove(t[n]);return this},Qi.prototype.toggle=function(e,t){return typeof t<"u"?t!==this.list.toggle(e,t)&&this.list.toggle(e):this.list.toggle(e),this},Qi.prototype.array=function(){return Array.from(this.list)},Qi.prototype.has=Qi.prototype.contains=function(e){return this.list.contains(e)};function xs(e){for(var t;t=e.firstChild;)e.removeChild(t);return e}function wh(e){return e.cloneNode(!0)}var Qu={svg:"http://www.w3.org/2000/svg"},Eh='<svg xmlns="'+Qu.svg+'"';function GE(e){var t=!1;e.substring(0,4)==="<svg"?e.indexOf(Qu.svg)===-1&&(e=Eh+e.substring(4)):(e=Eh+">"+e+"</svg>",t=!0);var n=VE(e);if(!t)return n;for(var i=document.createDocumentFragment(),r=n.firstChild;r.firstChild;)i.appendChild(r.firstChild);return i}function VE(e){var t;return t=new DOMParser,t.async=!1,t.parseFromString(e,"text/xml")}function ve(e,t){var n;return e=e.trim(),e.charAt(0)==="<"?(n=GE(e).firstChild,n=document.importNode(n,!0)):n=document.createElementNS(Qu.svg,e),t&&se(n,t),n}var Ju=null;function Sh(){return Ju===null&&(Ju=ve("svg")),Ju}function Rh(e,t){var n,i,r=Object.keys(t);for(n=0;i=r[n];n++)e[i]=t[i];return e}function WE(e,t,n,i,r,o){var a=Sh().createSVGMatrix();switch(arguments.length){case 0:return a;case 1:return Rh(a,e);case 6:return Rh(a,{a:e,b:t,c:n,d:i,e:r,f:o})}}function Xo(e){return Sh().createSVGTransform()}var Ch=/([&<>]{1})/g,UE=/([&<>\n\r"]{1})/g,YE={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"'"};function el(e,t){function n(i,r){return YE[r]||r}return e.replace(t,n)}function Ph(e,t){var n,i,r,o,a;switch(e.nodeType){case 3:t.push(el(e.textContent,Ch));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,'="',el(o.value,UE),'"');if(e.hasChildNodes()){for(t.push(">"),a=e.childNodes,n=0,i=a.length;n<i;++n)Ph(a.item(n),t);t.push("</",e.tagName,">")}else t.push("/>");break;case 8:t.push("<!--",el(e.nodeValue,Ch),"-->");break;case 4:t.push("<![CDATA[",e.nodeValue,"]]>");break;default:throw new Error("unable to handle node "+e.nodeType)}return t}function qE(e){for(var t=e.firstChild,n=[];t;)Ph(t,n),t=t.nextSibling;return n.join("")}function Ah(e,t){return qE(e)}function zt(e){var t=e.parentNode;return t&&t.removeChild(e),e}function KE(e,t){return t instanceof SVGMatrix?e.createSVGTransformFromMatrix(t):t}function XE(e,t){var n,i;for(e.clear(),n=0;i=t[n];n++)e.appendItem(KE(e,i))}function Zo(e,t){var n=e.transform.baseVal;return t&&(Array.isArray(t)||(t=[t]),XE(n,t)),n.consolidate()}const ZE=/^class[ {]/;function QE(e){return ZE.test(e.toString())}function tl(e){return Array.isArray(e)}function nl(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function ws(...e){e.length===1&&tl(e[0])&&(e=e[0]),e=[...e];const t=e.pop();return t.$inject=e,t}const JE=/constructor\s*[^(]*\(\s*([^)]*)\)/m,e1=/^(?:async\s+)?(?:function\s*[^(]*)?(?:\(\s*([^)]*)\)|(\w+))/m,t1=/\/\*([^*]*)\*\//m;function n1(e){if(typeof e!="function")throw new Error(`Cannot annotate "${e}". Expected a function!`);const t=e.toString().match(QE(e)?JE:e1);if(!t)return[];const n=t[1]||t[2];return n&&n.split(",").map(i=>{const r=i.match(t1);return(r&&r[1]||i).trim()})||[]}function Th(e,t){const n=t||{get:function(x,w){if(i.push(x),w===!1)return null;throw s(`No provider for "${x}"!`)}},i=[],r=this._providers=Object.create(n._providers||null),o=this._instances=Object.create(null),a=o.injector=this,s=function(x){const w=i.join(" -> ");return i.length=0,new Error(w?`${x} (Resolving: ${w})`:x)};function c(x,w){if(!r[x]&&x.includes(".")){const S=x.split(".");let M=c(S.shift());for(;S.length;)M=M[S.shift()];return M}if(nl(o,x))return o[x];if(nl(r,x)){if(i.indexOf(x)!==-1)throw i.push(x),s("Cannot resolve circular dependency!");return i.push(x),o[x]=r[x][0](r[x][1]),i.pop(),o[x]}return n.get(x,w)}function u(x,w){if(typeof w>"u"&&(w={}),typeof x!="function")if(tl(x))x=ws(x.slice());else throw s(`Cannot invoke "${x}". Expected a function!`);const M=(x.$inject||n1(x)).map(N=>nl(w,N)?w[N]:c(N));return{fn:x,dependencies:M}}function l(x){const{fn:w,dependencies:S}=u(x),M=Function.prototype.bind.call(w,null,...S);return new M}function f(x,w,S){const{fn:M,dependencies:N}=u(x,S);return M.apply(w,N)}function p(x){return ws(w=>x.get(w))}function d(x,w){if(w&&w.length){const S=Object.create(null),M=Object.create(null),N=[],T=[],H=[];let G,$,V,de;for(let Ge in r)G=r[Ge],w.indexOf(Ge)!==-1&&(G[2]==="private"?($=N.indexOf(G[3]),$===-1?(V=G[3].createChild([],w),de=p(V),N.push(G[3]),T.push(V),H.push(de),S[Ge]=[de,Ge,"private",V]):S[Ge]=[H[$],Ge,"private",T[$]]):S[Ge]=[G[2],G[1]],M[Ge]=!0),(G[2]==="factory"||G[2]==="type")&&G[1].$scope&&w.forEach(ft=>{G[1].$scope.indexOf(ft)!==-1&&(S[Ge]=[G[2],G[1]],M[ft]=!0)});w.forEach(Ge=>{if(!M[Ge])throw new Error('No provider for "'+Ge+'". Cannot use provider from the parent!')}),x.unshift(S)}return new Th(x,a)}const h={factory:f,type:l,value:function(x){return x}};function m(x,w){const S=x.__init__||[];return function(){S.forEach(M=>{typeof M=="string"?w.get(M):w.invoke(M)})}}function g(x){const w=x.__exports__;if(w){const S=x.__modules__,M=Object.keys(x).reduce(($,V)=>(V!=="__exports__"&&V!=="__modules__"&&V!=="__init__"&&V!=="__depends__"&&($[V]=x[V]),$),Object.create(null)),N=(S||[]).concat(M),T=d(N),H=ws(function($){return T.get($)});w.forEach(function($){r[$]=[H,$,"private",T]});const G=(x.__init__||[]).slice();return G.unshift(function(){T.init()}),x=Object.assign({},x,{__init__:G}),m(x,T)}return Object.keys(x).forEach(function(S){if(S==="__init__"||S==="__depends__")return;const M=x[S];if(M[2]==="private"){r[S]=M;return}const N=M[0],T=M[1];r[S]=[h[N],i1(N,T),N]}),m(x,a)}function R(x,w){return x.indexOf(w)!==-1||(x=(w.__depends__||[]).reduce(R,x),x.indexOf(w)!==-1)?x:x.concat(w)}function E(x){const w=x.reduce(R,[]).map(g);let S=!1;return function(){S||(S=!0,w.forEach(M=>M()))}}this.get=c,this.invoke=f,this.instantiate=l,this.createChild=d,this.init=E(e)}function i1(e,t){return e!=="value"&&tl(t)&&(t=ws(t.slice())),t}var r1=1e3;function Ti(e,t){var n=this;t=t||r1,e.on(["render.shape","render.connection"],t,function(i,r){var o=i.type,a=r.element,s=r.gfx,c=r.attrs;if(n.canRender(a))return o==="render.shape"?n.drawShape(s,a,c):n.drawConnection(s,a,c)}),e.on(["render.getShapePath","render.getConnectionPath"],t,function(i,r){if(n.canRender(r))return i.type==="render.getShapePath"?n.getShapePath(r):n.getConnectionPath(r)})}Ti.prototype.canRender=function(e){},Ti.prototype.drawShape=function(e,t){},Ti.prototype.drawConnection=function(e,t){},Ti.prototype.getShapePath=function(e){},Ti.prototype.getConnectionPath=function(e){};function Dr(e){return e.flat().join(",").replace(/,?([A-Za-z]),?/g,"$1")}function o1(e){return["M",e.x,e.y]}function il(e){return["L",e.x,e.y]}function a1(e,t,n){return["C",e.x,e.y,t.x,t.y,n.x,n.y]}function s1(e,t){const n=e.length,i=[o1(e[0])];for(let r=1;r<n;r++){const o=e[r-1],a=e[r],s=e[r+1];if(!s||!t){i.push(il(a));continue}const c=Math.min(t,rl(a.x-o.x,a.y-o.y),rl(s.x-a.x,s.y-a.y));if(!c){i.push(il(a));continue}const u=Es(a,o,c),l=Es(a,o,c*.5),f=Es(a,s,c),p=Es(a,s,c*.5);i.push(il(u)),i.push(a1(l,p,f))}return i}function Es(e,t,n){const i=t.x-e.x,r=t.y-e.y,o=rl(i,r),a=n/o;return{x:e.x+i*a,y:e.y+r*a}}function rl(e,t){return Math.sqrt(Math.pow(e,2)+Math.pow(t,2))}function Qo(e,t,n){Pe(t)&&(n=t,t=null),t||(t={});const i=ve("path",t);return Pe(n)&&(i.dataset.cornerRadius=String(n)),ol(i,e)}function ol(e,t){const n=parseInt(e.dataset.cornerRadius,10)||0;return se(e,{d:Dr(s1(t,n))}),e}function Ss(e){var t=new Set(e);return Be(e,function(n){for(var i=n.parent;i;){if(t.has(i))return!1;i=i.parent}return!0})}function Lr(e,t,n){n=n||0,we(e)||(e=[e]),k(e,function(i,r){var o=t(i,r,n);we(o)&&o.length&&Lr(o,t,n+1)})}function al(e,t,n){var i=new Set,r=new Set;return Lr(e,function(o,a,s){i.add(o);var c=o.children;if(c&&!r.has(c))return r.add(c),c}),Array.from(i)}function Jo(e,t){return al(e)}function c1(e,t,n){Rr(t)&&(t=!0),Ut(t)&&(n=t,t=!0),n=n||{};var i=ea(n.allShapes),r=ea(n.allConnections),o=ea(n.enclosedElements),a=ea(n.enclosedConnections),s=ea(n.topLevel,t&&to(e,function(l){return l.id}));function c(l){s[l.source.id]&&s[l.target.id]&&(s[l.id]=[l]),i[l.source.id]&&i[l.target.id]&&(a[l.id]=o[l.id]=l),r[l.id]=l}function u(l){if(o[l.id]=l,l.waypoints)a[l.id]=r[l.id]=l;else return i[l.id]=l,k(l.incoming,c),k(l.outgoing,c),l.children}return Lr(e,u),{allShapes:i,allConnections:r,topLevel:s,enclosedConnections:a,enclosedElements:o}}function Mt(e,t){t=!!t,we(e)||(e=[e]);var n,i,r,o;return k(e,function(a){var s=a;a.waypoints&&!t&&(s=Mt(a.waypoints,!0));var c=s.x,u=s.y,l=s.height||0,f=s.width||0;(c<n||n===void 0)&&(n=c),(u<i||i===void 0)&&(i=u),(c+f>r||r===void 0)&&(r=c+f),(u+l>o||o===void 0)&&(o=u+l)}),{x:n,y:i,height:o-i,width:r-n}}function uo(e,t){var n={};return k(e,function(i){var r=i;r.waypoints&&(r=Mt(r)),!Pe(t.y)&&r.x>t.x&&(n[i.id]=i),!Pe(t.x)&&r.y>t.y&&(n[i.id]=i),r.x>t.x&&r.y>t.y&&(Pe(t.width)&&Pe(t.height)&&r.width+r.x<t.width+t.x&&r.height+r.y<t.height+t.y||!Pe(t.width)||!Pe(t.height))&&(n[i.id]=i)}),n}function Mh(e){return"waypoints"in e?"connection":"x"in e?"shape":"root"}function kh(e){return!!(e&&e.isFrame)}function ea(e,t){return I({},e||{},t||{})}var u1=1;function Ji(e,t){Ti.call(this,e,u1),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})}ae(Ji,Ti),Ji.prototype.canRender=function(){return!0},Ji.prototype.drawShape=function(t,n,i){var r=ve("rect");return se(r,{x:0,y:0,width:n.width||0,height:n.height||0}),kh(n)?se(r,I({},this.FRAME_STYLE,i||{})):se(r,I({},this.SHAPE_STYLE,i||{})),Te(t,r),r},Ji.prototype.drawConnection=function(t,n,i){var r=Qo(n.waypoints,I({},this.CONNECTION_STYLE,i||{}));return Te(t,r),r},Ji.prototype.getShapePath=function(t){var n=t.x,i=t.y,r=t.width,o=t.height,a=[["M",n,i],["l",r,0],["l",0,o],["l",-r,0],["z"]];return Dr(a)},Ji.prototype.getConnectionPath=function(t){var n=t.waypoints,i,r,o=[];for(i=0;r=n[i];i++)r=r.original||r,o.push([i===0?"M":"L",r.x,r.y]);return Dr(o)},Ji.$inject=["eventBus","styles"];function l1(){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 I(o,{class:n})},this.style=function(n,i){!we(n)&&!i&&(i=n,n=[]);var r=Cn(n,function(o,a){return I(o,e[a]||{})},{});return i?I(r,i):r},this.computeStyle=function(n,i,r){return we(i)||(r=i,i=[]),t.style(i||[],I({},r,n||{}))}}const p1={__init__:["defaultRenderer"],defaultRenderer:["type",Ji],styles:["type",l1]};function Rt(e,t){if(!e||!t)return-1;var n=e.indexOf(t);return n!==-1&&e.splice(n,1),n}function Ct(e,t,n){if(!(!e||!t)){typeof n!="number"&&(n=-1);var i=e.indexOf(t);if(i!==-1){if(i===n)return;if(n!==-1)e.splice(i,1);else return}n!==-1?e.splice(n,0,t):e.push(t)}}function sl(e,t){return!e||!t?-1:e.indexOf(t)}function ta(e,t){return!e||!t?-1:Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function cl(e,t,n,i){if(typeof i>"u"&&(i=5),!e||!t||!n)return!1;var r=(t.x-e.x)*(n.y-e.y)-(t.y-e.y)*(n.x-e.x),o=ta(e,t);return Math.abs(r/o)<=i}var f1=2;function Mi(e,t){var n=Array.from(arguments).flat();const i={x:"v",y:"h"};for(const[r,o]of Object.entries(i))if(d1(r,n))return o;return!1}function d1(e,t){const n=t[0];return Cr(t,function(i){return Math.abs(n[e]-i[e])<=f1})}function Oh(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 ul(e,t){return{x:Math.round(e.x+(t.x-e.x)/2),y:Math.round(e.y+(t.y-e.y)/2)}}var h1=/,?([a-z]),?/gi,Dh=parseFloat,kt=Math,er=kt.PI,fi=kt.min,di=kt.max,Lh=kt.pow,tr=kt.abs,m1=/([a-z])[\s,]*((-?\d*\.?\d*(?:e[-+]?\d+)?[\s]*,?[\s]*)+)/ig,g1=/(-?\d*\.?\d*(?:e[-+]?\d+)?)[\s]*,?[\s]*/ig,Ih=Array.isArray||function(e){return e instanceof Array};function y1(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function v1(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 _1(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 y1(r,i)?(v1(o,i),r[i]):(o.length>=1e3&&delete r[o.shift()],o.push(i),r[i]=e(...arguments),r[i])}return t}function b1(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(m1,function(i,r,o){var a=[],s=r.toLowerCase();for(o.replace(g1,function(c,u){u&&a.push(+u)}),s=="m"&&a.length>2&&(n.push([r,...a.splice(0,2)]),s="l",r=r=="m"?"l":"L");a.length>=t[s]&&(n.push([r,...a.splice(0,t[s])]),!!t[s]););}),n.toString=pl,n}function x1(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 w1(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 ll(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 pl(){return this.join(",").replace(h1,"$1")}function E1(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=pl,t}function Nh(e,t,n,i,r,o,a,s,c){var u=1-c,l=Lh(u,3),f=Lh(u,2),p=c*c,d=p*c,h=l*e+f*3*c*n+u*3*c*c*r+d*a,m=l*t+f*3*c*i+u*3*c*c*o+d*s;return{x:Rs(h),y:Rs(m)}}function Bh(e){var t=T1(...e);return ll(t.x0,t.y0,t.x1-t.x0,t.y1-t.y0)}function nr(e,t,n){return t>=e.x&&t<=e.x+e.width&&n>=e.y&&n<=e.y+e.height}function S1(e,t){return e=ll(e),t=ll(t),nr(t,e.x,e.y)||nr(t,e.x2,e.y)||nr(t,e.x,e.y2)||nr(t,e.x2,e.y2)||nr(e,t.x,t.y)||nr(e,t.x2,t.y)||nr(e,t.x,t.y2)||nr(e,t.x2,t.y2)||(e.x<t.x2&&e.x>t.x||t.x<e.x2&&t.x>e.x)&&(e.y<t.y2&&e.y>t.y||t.y<e.y2&&t.y>e.y)}function $h(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 jh(e,t,n,i,r,o,a,s,c){c==null&&(c=1),c=c>1?1:c<0?0:c;for(var u=c/2,l=12,f=[-.1252,.1252,-.3678,.3678,-.5873,.5873,-.7699,.7699,-.9041,.9041,-.9816,.9816],p=[.2491,.2491,.2335,.2335,.2032,.2032,.1601,.1601,.1069,.1069,.0472,.0472],d=0,h=0;h<l;h++){var m=u*f[h]+u,g=$h(m,e,n,r,a),R=$h(m,t,i,o,s),E=g*g+R*R;d+=p[h]*kt.sqrt(E)}return u*d}function R1(e,t,n,i,r,o,a,s){if(!(di(e,n)<fi(r,a)||fi(e,n)>di(r,a)||di(t,i)<fi(o,s)||fi(t,i)>di(o,s))){var c=(e*i-t*n)*(r-a)-(e-n)*(r*s-o*a),u=(e*i-t*n)*(o-s)-(t-i)*(r*s-o*a),l=(e-n)*(o-s)-(t-i)*(r-a);if(l){var f=Rs(c/l),p=Rs(u/l),d=+f.toFixed(2),h=+p.toFixed(2);if(!(d<+fi(e,n).toFixed(2)||d>+di(e,n).toFixed(2)||d<+fi(r,a).toFixed(2)||d>+di(r,a).toFixed(2)||h<+fi(t,i).toFixed(2)||h>+di(t,i).toFixed(2)||h<+fi(o,s).toFixed(2)||h>+di(o,s).toFixed(2)))return{x:f,y:p}}}}function Rs(e){return Math.round(e*1e11)/1e11}function C1(e,t,n){var i=Bh(e),r=Bh(t);if(!S1(i,r))return[];var o=jh(...e),a=jh(...t),s=Hh(e)?1:~~(o/5)||1,c=Hh(t)?1:~~(a/5)||1,u=new Array(s+1),l=new Array(c+1),f={},p=[],d,h;for(d=0;d<s+1;d++){var m=Nh(...e,d/s);u[d]={x:m.x,y:m.y,t:d/s}}for(d=0;d<c+1;d++)m=Nh(...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],R=u[d+1],E=l[h],x=l[h+1],w=tr(R.x-g.x)<.01?"y":"x",S=tr(x.x-E.x)<.01?"y":"x",M=R1(g.x,g.y,R.x,R.y,E.x,E.y,x.x,x.y),N;if(M){if(N=M.x.toFixed(9)+"#"+M.y.toFixed(9),f[N])continue;f[N]=!0;var T=g.t+tr((M[w]-g[w])/(R[w]-g[w]))*(R.t-g.t),H=E.t+tr((M[S]-E[S])/(x[S]-E[S]))*(x.t-E.t);T>=0&&T<=1&&H>=0&&H<=1&&p.push({x:M.x,y:M.y,t1:T,t2:H})}}return p}function Fh(e,t,n){e=Vh(e),t=Vh(t);for(var i,r,o,a,s,c,u,l,f,p,d=n?0:[],h=0,m=e.length;h<m;h++){var g=e[h];if(g[0]=="M")i=s=g[1],r=c=g[2];else{g[0]=="C"?(f=[i,r,...g.slice(1)],i=f[6],r=f[7]):(f=[i,r,i,r,s,c,s,c],i=s,r=c);for(var R=0,E=t.length;R<E;R++){var x=t[R];if(x[0]=="M")o=u=x[1],a=l=x[2];else{x[0]=="C"?(p=[o,a,...x.slice(1)],o=p[6],a=p[7]):(p=[o,a,o,a,u,l,u,l],o=u,a=l);var w=C1(f,p);{for(var S=0,M=w.length;S<M;S++)w[S].segment1=h,w[S].segment2=R,w[S].bez1=f,w[S].bez2=p;d=d.concat(w)}}}}}return d}function P1(e){return Ih(e)&&Ih(e[0])}function A1(e){if(x1(e))return e;var t=new Array(e.length),n=0,i=0,r=0,o=0,a=0,s;e[0][0]=="M"&&(n=+e[0][1],i=+e[0][2],r=n,o=i,a++,t[0]=["M",n,i]);for(var c,u,l=a,f=e.length;l<f;l++){if(u=e[l],s=u[0],t[l]=c=new Array(u.length),s!=s.toUpperCase())switch(c[0]=s.toUpperCase(),c[0]){case"A":c[1]=u[1],c[2]=u[2],c[3]=u[3],c[4]=u[4],c[5]=u[5],c[6]=+u[6]+n,c[7]=+u[7]+i;break;case"V":c[1]=+u[1]+i;break;case"H":c[1]=+u[1]+n;break;case"M":r=+u[1]+n,o=+u[2]+i;default:for(var p=1,d=u.length;p<d;p++)c[p]=+u[p]+(p%2?n:i)}else for(var h=0,m=u.length;h<m;h++)c[h]=u[h];switch(s=s.toUpperCase(),c[0]){case"Z":n=+r,i=+o;break;case"H":n=c[1];break;case"V":i=c[1];break;case"M":r=c[c.length-2],o=c[c.length-1];default:n=c[c.length-2],i=c[c.length-1]}}return t.toString=pl,t}function Hh(e){return e[0]===e[2]&&e[1]===e[3]&&e[4]===e[6]&&e[5]===e[7]}function Cs(e,t,n,i){return[e,t,n,i,n,i]}function zh(e,t,n,i,r,o){var a=.3333333333333333,s=2/3;return[a*e+s*n,a*t+s*i,a*r+s*n,a*o+s*i,r,o]}function Gh(e,t,n,i,r,o,a,s,c,u){var l=er*120/180,f=er/180*(+r||0),p=[],d,h=_1(function(P,_,y){var D=P*kt.cos(y)-_*kt.sin(y),B=P*kt.sin(y)+_*kt.cos(y);return{x:D,y:B}});if(u)N=u[0],T=u[1],S=u[2],M=u[3];else{d=h(e,t,-f),e=d.x,t=d.y,d=h(s,c,-f),s=d.x,c=d.y;var m=(e-s)/2,g=(t-c)/2,R=m*m/(n*n)+g*g/(i*i);R>1&&(R=kt.sqrt(R),n=R*n,i=R*i);var E=n*n,x=i*i,w=(o==a?-1:1)*kt.sqrt(tr((E*x-E*g*g-x*m*m)/(E*g*g+x*m*m))),S=w*n*g/i+(e+s)/2,M=w*-i*m/n+(t+c)/2,N=kt.asin(((t-M)/i).toFixed(9)),T=kt.asin(((c-M)/i).toFixed(9));N=e<S?er-N:N,T=s<S?er-T:T,N<0&&(N=er*2+N),T<0&&(T=er*2+T),a&&N>T&&(N=N-er*2),!a&&T>N&&(T=T-er*2)}var H=T-N;if(tr(H)>l){var G=T,$=s,V=c;T=N+l*(a&&T>N?1:-1),s=S+n*kt.cos(T),c=M+i*kt.sin(T),p=Gh(s,c,n,i,r,0,a,$,V,[T,G,S,M])}H=T-N;var de=kt.cos(N),Ge=kt.sin(N),ft=kt.cos(T),q=kt.sin(T),he=kt.tan(H/4),ge=4/3*n*he,pe=4/3*i*he,fe=[e,t],ne=[e+ge*Ge,t-pe*de],z=[s+ge*q,c-pe*ft],F=[s,c];if(ne[0]=2*fe[0]-ne[0],ne[1]=2*fe[1]-ne[1],u)return[ne,z,F].concat(p);p=[ne,z,F].concat(p).join().split(",");for(var Y=[],Le=0,Nt=p.length;Le<Nt;Le++)Y[Le]=Le%2?h(p[Le-1],p[Le],f).y:h(p[Le],p[Le+1],f).x;return Y}function T1(e,t,n,i,r,o,a,s){for(var c=[],u=[[],[]],l,f,p,d,h,m,g,R,E=0;E<2;++E){if(E==0?(f=6*e-12*n+6*r,l=-3*e+9*n-9*r+3*a,p=3*n-3*e):(f=6*t-12*i+6*o,l=-3*t+9*i-9*o+3*s,p=3*i-3*t),tr(l)<1e-12){if(tr(f)<1e-12)continue;d=-p/f,0<d&&d<1&&c.push(d);continue}g=f*f-4*p*l,R=kt.sqrt(g),!(g<0)&&(h=(-f+R)/(2*l),0<h&&h<1&&c.push(h),m=(-f-R)/(2*l),0<m&&m<1&&c.push(m))}for(var x=c.length,w=x,S;x--;)d=c[x],S=1-d,u[0][x]=S*S*S*e+3*S*S*d*n+3*S*d*d*r+d*d*d*a,u[1][x]=S*S*S*t+3*S*S*d*i+3*S*d*d*o+d*d*d*s;return u[0][w]=e,u[1][w]=t,u[0][w+1]=a,u[1][w+1]=s,u[0].length=u[1].length=w+2,{x0:fi(...u[0]),y0:fi(...u[1]),x1:di(...u[0]),y1:di(...u[1])}}function Vh(e){if(P1(e)||(e=b1(e)),w1(e))return e;for(var t=E1(A1(e)),n={x:0,y:0,bx:0,by:0,X:0,Y:0,qx:null,qy:null},i=function(p,d,h){var m,g;if(!p)return["C",d.x,d.y,d.x,d.y,d.x,d.y];switch(!(p[0]in{T:1,Q:1})&&(d.qx=d.qy=null),p[0]){case"M":d.X=p[1],d.Y=p[2];break;case"A":p=["C",...Gh(d.x,d.y,...p.slice(1))];break;case"S":h=="C"||h=="S"?(m=d.x*2-d.bx,g=d.y*2-d.by):(m=d.x,g=d.y),p=["C",m,g,...p.slice(1)];break;case"T":h=="Q"||h=="T"?(d.qx=d.x*2-d.qx,d.qy=d.y*2-d.qy):(d.qx=d.x,d.qy=d.y),p=["C",...zh(d.x,d.y,d.qx,d.qy,p[1],p[2])];break;case"Q":d.qx=p[1],d.qy=p[2],p=["C",...zh(d.x,d.y,p[1],p[2],p[3],p[4])];break;case"L":p=["C",...Cs(d.x,d.y,p[1],p[2])];break;case"H":p=["C",...Cs(d.x,d.y,p[1],d.y)];break;case"V":p=["C",...Cs(d.x,d.y,d.x,p[1])];break;case"Z":p=["C",...Cs(d.x,d.y,d.X,d.Y)];break}return p},r=function(p,d){if(p[d].length>7){p[d].shift();for(var h=p[d];h.length;)o[d]="A",p.splice(d++,0,["C",...h.splice(0,6)]);p.splice(d,1),u=t.length}},o=[],a="",s="",c=0,u=t.length;c<u;c++){t[c]&&(a=t[c][0]),a!="C"&&(o[c]=a,c&&(s=o[c-1])),t[c]=i(t[c],n,s),o[c]!="A"&&a=="C"&&(o[c]="C"),r(t,c);var l=t[c],f=l.length;n.x=l[f-2],n.y=l[f-1],n.bx=Dh(l[f-4])||n.x,n.by=Dh(l[f-3])||n.y}return t}function ot(e){return Ut(e)&&Rn(e,"waypoints")}function De(e){return Ut(e)&&Rn(e,"labelTarget")}function M1(e){return Ut(e)&&Jr(e.parent)}function Wh(e){return{x:Math.round(e.x),y:Math.round(e.y),width:Math.round(e.width),height:Math.round(e.height)}}function ki(e){return{x:Math.round(e.x),y:Math.round(e.y)}}function be(e){return{top:e.y,right:e.x+(e.width||0),bottom:e.y+(e.height||0),left:e.x}}function Ps(e){return{x:e.left,y:e.top,width:e.right-e.left,height:e.bottom-e.top}}function k1(e){return ki({x:e.x+(e.width||0)/2,y:e.y+(e.height||0)/2})}function O1(e){for(var t=e.waypoints,n=t.reduce(function(u,l,f){var p=t[f-1];if(p){var d=u[u.length-1],h=d&&d.endLength||0,m=I1(p,l);u.push({start:p,end:l,startLength:h,endLength:h+m,length:m})}return u},[]),i=n.reduce(function(u,l){return u+l.length},0),r=i/2,o=0,a=n[o];a.endLength<r;)a=n[++o];var s=(r-a.startLength)/a.length,c={x:a.start.x+(a.end.x-a.start.x)*s,y:a.start.y+(a.end.y-a.start.y)*s};return c}function Ee(e){return ot(e)?O1(e):k1(e)}function Qt(e,t,n){n=n||0,Ut(n)||(n={x:n,y:n});var i=be(e),r=be(t),o=i.bottom+n.y<=r.top,a=i.left-n.x>=r.right,s=i.top-n.y>=r.bottom,c=i.right+n.x<=r.left,u=o?"top":s?"bottom":null,l=c?"left":a?"right":null;return l&&u?u+"-"+l:l||u||"intersect"}function na(e,t,n){var i=D1(e,t);return i.length===1||i.length===2&&ta(i[0],i[1])<1?ki(i[0]):i.length>1?(i=oi(i,function(r){var o=Math.floor(r.t2*100)||1;return o=100-o,o=(o<10?"0":"")+o,r.segment2+"#"+o}),ki(i[n?0:i.length-1])):null}function D1(e,t){return Fh(e,t)}function L1(e){e=e.slice();for(var t=0,n,i,r;e[t];)n=e[t],i=e[t-1],r=e[t+1],ta(n,r)===0||cl(i,r,n)?e.splice(t,1):t++;return e}function I1(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function As(e,t){return Math.round(e*t)/t}function Uh(e){return Pe(e)?e+"px":e}function N1(e){for(;e.parent;)e=e.parent;return e}function B1(e){e=I({},{width:"100%",height:"100%"},e);const t=e.container||document.body,n=document.createElement("div");return n.setAttribute("class","djs-container djs-parent"),yn(n,{position:"relative",overflow:"hidden",width:Uh(e.width),height:Uh(e.height)}),t.appendChild(n),n}function Yh(e,t,n){const i=ve("g");ze(i).add(t);const r=n!==void 0?n:e.childNodes.length-1;return e.insertBefore(i,e.childNodes[r]||null),i}const $1="base",qh=0,j1=1,F1={shape:["x","y","width","height"],connection:["waypoints"]};function Se(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||{})}Se.$inject=["config.canvas","eventBus","graphicsFactory","elementRegistry"],Se.prototype._init=function(e){const t=this._eventBus,n=this._container=B1(e),i=this._svg=ve("svg");se(i,{width:"100%",height:"100%"}),cn(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")}),Te(n,i);const r=this._viewport=Yh(i,"viewport");e.deferUpdate&&(this._viewboxChanged=Pu(this._viewboxChanged,300)),this._restoreFocus=Pu(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)},Se.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},Se.prototype._setFocused=function(e){e!=this._focused&&(this._focused=e,this._eventBus.fire("canvas.focus.changed",{focused:e}))},Se.prototype._clear=function(){this._elementRegistry.getAll().forEach(t=>{const n=Mh(t);n==="root"?this.removeRootElement(t):this._removeElement(t,n)}),this._planes=[],this._rootElement=null,delete this._cachedViewbox},Se.prototype.focus=function(){this._svg.focus({preventScroll:!0}),this._setFocused(!0)},Se.prototype.restoreFocus=function(){this._restoreFocus()},Se.prototype._restoreFocus=function(){document.activeElement===document.body&&this.focus()},Se.prototype.isFocused=function(){return this._focused},Se.prototype.getDefaultLayer=function(){return this.getLayer($1,qh)},Se.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},Se.prototype._getChildIndex=function(e){return Cn(this._layers,function(t,n){return n.visible&&e>=n.index&&t++,t},0)},Se.prototype._createLayer=function(e,t){typeof t>"u"&&(t=j1);const n=this._getChildIndex(t);return{group:Yh(this._viewport,"layer-"+e,n),index:t,visible:!0}},Se.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},Se.prototype.hideLayer=function(e){if(!e)throw new Error("must specify a name");const t=this._layers[e];if(!t)throw new Error("layer <"+e+"> does not exist");const n=t.group;return t.visible&&(zt(n),t.visible=!1),n},Se.prototype._removeLayer=function(e){const t=this._layers[e];t&&(delete this._layers[e],zt(t.group))},Se.prototype.getActiveLayer=function(){const e=this._findPlaneForRoot(this.getRootElement());return e?e.layer:null},Se.prototype.findRoot=function(e){const t=this._resolveElements(e);let n;for(const i of t){const r=this._findPlaneForRoot(N1(i));if(!r||n&&r.rootElement!==n)return;n=r.rootElement}return n},Se.prototype.getRootElements=function(){return this._planes.map(function(e){return e.rootElement})},Se.prototype._findPlaneForRoot=function(e){return ut(this._planes,function(t){return t.rootElement===e})},Se.prototype._resolveElement=function(e){return typeof e=="string"?this._elementRegistry.get(e):e},Se.prototype._resolveElements=function(e){return we(e)||(e=[e]),e.map(t=>this._resolveElement(t)).filter(Boolean)},Se.prototype.getContainer=function(){return this._container},Se.prototype._updateMarker=function(e,t,n){let i;e=this._resolveElement(e),e.markers=e.markers||new Set,i=this._elementRegistry._elements[e.id],i&&(k([i.gfx,i.secondaryGfx],function(r){r&&(n?(e.markers.add(t),ze(r).add(t)):(e.markers.delete(t),ze(r).remove(t)))}),this._eventBus.fire("element.marker.update",{element:e,gfx:i.gfx,marker:t,add:!!n}))},Se.prototype.addMarker=function(e,t){this._updateMarker(e,t,!0)},Se.prototype.removeMarker=function(e,t){this._updateMarker(e,t,!1)},Se.prototype.hasMarker=function(e,t){return e=this._resolveElement(e),e.markers?e.markers.has(t):!1},Se.prototype.toggleMarker=function(e,t){this.hasMarker(e,t)?this.removeMarker(e,t):this.addMarker(e,t)},Se.prototype.getRootElement=function(){const e=this._rootElement;return e||this._planes.length?e:this.setRootElement(this.addRootElement(null))},Se.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,qh);return this.hideLayer(n),this._addRoot(e,i),this._planes.push({rootElement:e,layer:i}),e},Se.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},Se.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},Se.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)},Se.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})},Se.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})},Se.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=F1[e];if(!Cr(n,function(r){return typeof t[r]<"u"}))throw new Error("must supply { "+n.join(", ")+" } with "+e)},Se.prototype._setParent=function(e,t,n){Ct(t.children,e,n),e.parent=t},Se.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},Se.prototype.addShape=function(e,t,n){return this._addElement("shape",e,t,n)},Se.prototype.addConnection=function(e,t,n){return this._addElement("connection",e,t,n)},Se.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},Se.prototype.removeShape=function(e){return this._removeElement(e,"shape")},Se.prototype.removeConnection=function(e){return this._removeElement(e,"connection")},Se.prototype.getGraphics=function(e,t){return this._elementRegistry.getGraphics(e,t)},Se.prototype._changeViewbox=function(e){this._eventBus.fire("canvas.viewbox.changing"),e.apply(this),this._cachedViewbox=null,this._viewboxChanged()},Se.prototype._viewboxChanged=function(){this._eventBus.fire("canvas.viewbox.changed",{viewbox:this.viewbox()})},Se.prototype.viewbox=function(e){if(e===void 0&&this._cachedViewbox)return structuredClone(this._cachedViewbox);const t=this._viewport,n=this.getSize();let i,r,o,a,s,c,u;if(e)this._changeViewbox(function(){s=Math.min(n.width/e.width,n.height/e.height);const l=this._svg.createSVGMatrix().scale(s).translate(-e.x,-e.y);Zo(t,l)});else return o=this._rootElement?this.getActiveLayer():null,i=o&&o.getBBox()||{},a=Zo(t),r=a?a.matrix:WE(),s=As(r.a,1e3),c=As(-r.e||0,1e3),u=As(-r.f||0,1e3),e=this._cachedViewbox={x:c?c/s:0,y:u?u/s:0,width:n.width/s,height:n.height/s,scale:s,inner:{width:i.width||0,height:i.height||0,x:i.x||0,y:i.y||0},outer:n},e;return e},Se.prototype.scroll=function(e){const t=this._viewport;let n=t.getCTM();return e&&this._changeViewbox(function(){e=I({dx:0,dy:0},e||{}),n=this._svg.createSVGMatrix().translate(e.dx,e.dy).multiply(n),Kh(t,n)}),{x:n.e,y:n.f}},Se.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=Mt(o),s=be(a),c=this.viewbox(),u=this.zoom();let l,f;c.y+=t.top/u,c.x+=t.left/u,c.width-=(t.right+t.left)/u,c.height-=(t.bottom+t.top)/u;const p=be(c);if(!(a.width<c.width&&a.height<c.height))l=a.x-c.x,f=a.y-c.y;else{const h=Math.max(0,s.right-p.right),m=Math.min(0,s.left-p.left),g=Math.max(0,s.bottom-p.bottom),R=Math.min(0,s.top-p.top);l=h||m,f=g||R}this.scroll({dx:-l*u,dy:-f*u})},Se.prototype.zoom=function(e,t){if(!e)return this.viewbox(e).scale;if(e==="fit-viewport")return this._fitViewport(t);let n,i;return this._changeViewbox(function(){typeof t!="object"&&(n=this.viewbox().outer,t={x:n.width/2,y:n.height/2}),i=this._setZoom(e,t)}),As(i.a,1e3)};function Kh(e,t){const n="matrix("+t.a+","+t.b+","+t.c+","+t.d+","+t.e+","+t.f+")";e.setAttribute("transform",n)}Se.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},Se.prototype._setZoom=function(e,t){const n=this._svg,i=this._viewport,r=n.createSVGMatrix(),o=n.createSVGPoint();let a,s,c,u,l;c=i.getCTM();const f=c.a;return t?(a=I(o,t),s=a.matrixTransform(c.inverse()),u=r.translate(s.x,s.y).scale(1/f*e).translate(-s.x,-s.y),l=c.multiply(u)):l=r.scale(e),Kh(this._viewport,l),l},Se.prototype.getSize=function(){return{width:this._container.clientWidth,height:this._container.clientHeight}},Se.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}},Se.prototype.resized=function(){delete this._cachedViewbox,this._eventBus.fire("canvas.resized")};var lo="data-element-id";function Bn(e){this._elements={},this._eventBus=e}Bn.$inject=["eventBus"],Bn.prototype.add=function(e,t,n){var i=e.id;this._validateId(i),se(t,lo,i),n&&se(n,lo,i),this._elements[i]={element:e,gfx:t,secondaryGfx:n}},Bn.prototype.remove=function(e){var t=this._elements,n=e.id||e,i=n&&t[n];i&&(se(i.gfx,lo,""),i.secondaryGfx&&se(i.secondaryGfx,lo,""),delete t[n])},Bn.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)},Bn.prototype.updateGraphics=function(e,t,n){var i=e.id||e,r=this._elements[i];return n?r.secondaryGfx=t:r.gfx=t,t&&se(t,lo,i),t},Bn.prototype.get=function(e){var t;typeof e=="string"?t=e:t=e&&se(e,lo);var n=this._elements[t];return n&&n.element},Bn.prototype.filter=function(e){var t=[];return this.forEach(function(n,i){e(n,i)&&t.push(n)}),t},Bn.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}},Bn.prototype.getAll=function(){return this.filter(function(e){return e})},Bn.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)})},Bn.prototype.getGraphics=function(e,t){var n=e.id||e,i=this._elements[n];return i&&(t?i.secondaryGfx:i.gfx)},Bn.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 H1(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 z1(e){return e.__refs_collection===!0}function G1(e,t){return Object.prototype.hasOwnProperty.call(e,t.name||t)}function Xh(e,t,n){var i=H1(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 V1(e,t,n){var i=t.inverse,r=n[t.name];Object.defineProperty(n,t.name,{configurable:t.configurable,enumerable:t.enumerable,get:function(){return r},set:function(o){if(o!==r){var a=r;r=null,a&&e.unset(a,i,n),r=o,e.set(r,i,n)}}})}function zn(e,t){if(!(this instanceof zn))return new zn(e,t);e.inverse=t,t.inverse=e,this.props={},this.props[e.name]=e,this.props[t.name]=t}zn.prototype.bind=function(e,t){if(typeof t=="string"){if(!this.props[t])throw new Error("no property <"+t+"> in ref");t=this.props[t]}t.collection?Xh(this,t,e):V1(this,t,e)},zn.prototype.ensureRefsCollection=function(e,t){var n=e[t.name];return z1(n)||Xh(this,t,e),n},zn.prototype.ensureBound=function(e,t){G1(e,t)||this.bind(e,t)},zn.prototype.unset=function(e,t,n){e&&(this.ensureBound(e,t),t.collection?this.ensureRefsCollection(e,t).remove(n):e[t.name]=void 0)},zn.prototype.set=function(e,t,n){e&&(this.ensureBound(e,t),t.collection?this.ensureRefsCollection(e,t).add(n):e[t.name]=n)};var fl=new zn({name:"children",enumerable:!0,collection:!0},{name:"parent"}),Zh=new zn({name:"labels",enumerable:!0,collection:!0},{name:"labelTarget"}),Qh=new zn({name:"attachers",collection:!0},{name:"host"}),Jh=new zn({name:"outgoing",collection:!0},{name:"source"}),em=new zn({name:"incoming",collection:!0},{name:"target"});function po(){Object.defineProperty(this,"businessObject",{writable:!0}),Object.defineProperty(this,"label",{get:function(){return this.labels[0]},set:function(e){var t=this.label,n=this.labels;!e&&t?n.remove(t):n.add(e,0)}}),fl.bind(this,"parent"),Zh.bind(this,"labels"),Jh.bind(this,"outgoing"),em.bind(this,"incoming")}function ia(){po.call(this),fl.bind(this,"children"),Qh.bind(this,"host"),Qh.bind(this,"attachers")}ae(ia,po);function tm(){po.call(this),fl.bind(this,"children")}ae(tm,ia);function nm(){ia.call(this),Zh.bind(this,"labelTarget")}ae(nm,ia);function im(){po.call(this),Jh.bind(this,"source"),em.bind(this,"target")}ae(im,po);var W1={connection:im,shape:ia,label:nm,root:tm};function U1(e,t){var n=W1[e];if(!n)throw new Error("unknown type: <"+e+">");return I(new n,t)}function Y1(e){return e instanceof po}function Oi(){this._uid=12}Oi.prototype.createRoot=function(e){return this.create("root",e)},Oi.prototype.createLabel=function(e){return this.create("label",e)},Oi.prototype.createShape=function(e){return this.create("shape",e)},Oi.prototype.createConnection=function(e){return this.create("connection",e)},Oi.prototype.create=function(e,t){return t=I({},t||{}),t.id||(t.id=e+"_"+this._uid++),U1(e,t)};var Ts="__fn",rm=1e3,q1=Array.prototype.slice;function Tn(){this._listeners={},this.on("diagram.destroy",1,this._destroy,this)}Tn.prototype.on=function(e,t,n,i){if(e=we(e)?e:[e],Yt(t)&&(i=n,n=t,t=rm),!Pe(t))throw new Error("priority must be a number");var r=n;i&&(r=bn(n,i),r[Ts]=n[Ts]||n);var o=this;e.forEach(function(a){o._addListener(a,{priority:t,callback:r,next:null})})},Tn.prototype.once=function(e,t,n,i){var r=this;if(Yt(t)&&(i=n,n=t,t=rm),!Pe(t))throw new Error("priority must be a number");function o(){o.__isTomb=!0;var a=n.apply(i,arguments);return r.off(e,o),a}o[Ts]=n,this.on(e,t,o)},Tn.prototype.off=function(e,t){e=we(e)?e:[e];var n=this;e.forEach(function(i){n._removeListener(i,t)})},Tn.prototype.createEvent=function(e){var t=new ra;return t.init(e),t},Tn.prototype.fire=function(e,t){var n,i,r,o;if(o=q1.call(arguments),typeof e=="object"&&(t=e,e=t.type),!e)throw new Error("no event type specified");if(i=this._listeners[e],!!i){t instanceof ra?n=t:n=this.createEvent(t),o[0]=n;var a=n.type;e!==a&&(n.type=e);try{r=this._invokeListeners(n,o,i)}finally{e!==a&&(n.type=a)}return r===void 0&&n.defaultPrevented&&(r=!1),r}},Tn.prototype.handleError=function(e){return this.fire("error",{error:e})===!1},Tn.prototype._destroy=function(){this._listeners={}},Tn.prototype._invokeListeners=function(e,t,n){for(var i;n&&!e.cancelBubble;)i=this._invokeListener(e,t,n),n=n.next;return i},Tn.prototype._invokeListener=function(e,t,n){var i;if(n.callback.__isTomb)return i;try{i=K1(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},Tn.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},Tn.prototype._getListeners=function(e){return this._listeners[e]},Tn.prototype._setListeners=function(e,t){this._listeners[e]=t},Tn.prototype._removeListener=function(e,t){var n=this._getListeners(e),i,r,o;if(!t){this._setListeners(e,null);return}for(;n;)i=n.next,o=n.callback,(o===t||o[Ts]===t)&&(r?r.next=i:this._setListeners(e,i)),r=n,n=i};function ra(){}ra.prototype.stopPropagation=function(){this.cancelBubble=!0},ra.prototype.preventDefault=function(){this.defaultPrevented=!0},ra.prototype.init=function(e){I(this,e||{})};function K1(e,t){return e.apply(null,t)}function Ir(e){return e.childNodes[0]}function X1(e){return e.parentNode.childNodes[1]}function Ms(e,t,n,i,r){var o=Xo();o.setTranslate(t,n);var a=Xo();a.setRotate(i||0,0,0);var s=Xo();s.setScale(1,1),Zo(e,[o,a,s])}function Jt(e,t,n){var i=Xo();i.setTranslate(t,n),Zo(e,i)}function om(e,t){var n=Xo();n.setRotate(t,0,0),Zo(e,n)}function $n(e,t){this._eventBus=e,this._elementRegistry=t}$n.$inject=["eventBus","elementRegistry"],$n.prototype._getChildrenContainer=function(e){var t=this._elementRegistry.getGraphics(e),n;return e.parent?(n=X1(t),n||(n=ve("g"),ze(n).add("djs-children"),Te(t.parentNode,n))):n=t,n},$n.prototype._clear=function(e){var t=Ir(e);return vs(t),t},$n.prototype._createContainer=function(e,t,n,i){var r=ve("g");ze(r).add("djs-group"),typeof n<"u"?Z1(r,t,t.childNodes[n]):Te(t,r);var o=ve("g");ze(o).add("djs-element"),ze(o).add("djs-"+e),i&&ze(o).add("djs-frame"),Te(r,o);var a=ve("g");return ze(a).add("djs-visual"),Te(o,a),o},$n.prototype.create=function(e,t,n){var i=this._getChildrenContainer(t.parent);return this._createContainer(e,i,n,kh(t))},$n.prototype.updateContainments=function(e){var t=this,n=this._elementRegistry,i;i=Cn(e,function(r,o){return o.parent&&(r[o.parent.id]=o.parent),r},{}),k(i,function(r){var o=r.children;if(o){var a=t._getChildrenContainer(r),s=a.firstChild;k(o,function(c){var u=n.getGraphics(c).parentNode;u===s?s=s.nextSibling:a.insertBefore(u,s)})}})},$n.prototype.drawShape=function(e,t,n={}){var i=this._eventBus;return i.fire("render.shape",{gfx:e,element:t,attrs:n})},$n.prototype.getShapePath=function(e){var t=this._eventBus;return t.fire("render.getShapePath",e)},$n.prototype.drawConnection=function(e,t,n={}){var i=this._eventBus;return i.fire("render.connection",{gfx:e,element:t,attrs:n})},$n.prototype.getConnectionPath=function(e){var t=this._eventBus;return t.fire("render.getConnectionPath",e)},$n.prototype.update=function(e,t,n){if(t.parent){var i=this._clear(n);if(e==="shape")this.drawShape(i,t),Jt(n,t.x,t.y);else if(e==="connection")this.drawConnection(i,t);else throw new Error("unknown type: "+e);t.hidden?se(n,"display","none"):se(n,"display","block")}},$n.prototype.remove=function(e){var t=this._elementRegistry.getGraphics(e);zt(t.parentNode)};function Z1(e,t,n){var i=n||t.firstChild;e!==i&&t.insertBefore(e,i)}const Q1={__depends__:[p1],__init__:["canvas"],canvas:["type",Se],elementRegistry:["type",Bn],elementFactory:["type",Oi],eventBus:["type",Tn],graphicsFactory:["type",$n]};function J1(e){var t=new Th(e);return t.init(),t}function eS(e){e=e||{};var t={config:["value",e]},n=[t,Q1].concat(e.modules||[]);return J1(n)}function ir(e,t){this._injector=t||eS(e),this.get("eventBus").fire("diagram.init")}ir.prototype.get=function(e,t){return this._injector.get(e,t)},ir.prototype.invoke=function(e,t,n){return this._injector.invoke(e,t,n)},ir.prototype.destroy=function(){this.get("eventBus").fire("diagram.destroy")},ir.prototype.clear=function(){this.get("eventBus").fire("diagram.clear")};function un(e){return e?"<"+e.$type+(e.id?' id="'+e.id:"")+'" />':"<null>"}function xn(e,t){return e.$instanceOf(t)}function tS(e){return ut(e.rootElements,function(t){return xn(t,"bpmn:Process")||xn(t,"bpmn:Collaboration")})}function nS(e){var t={},n=[],i={};function r(z,F){return function(Y){z(Y,F)}}function o(z){t[z.id]=z}function a(z){return t[z.id]}function s(z,F){var Y=z.gfx;if(Y)throw new Error(`already rendered ${un(z)}`);return e.element(z,i[z.id],F)}function c(z,F){return e.root(z,i[z.id],F)}function u(z,F){try{var Y=i[z.id]&&s(z,F);return o(z),Y}catch(Le){l(Le.message,{element:z,error:Le}),console.error(`failed to import ${un(z)}`,Le)}}function l(z,F){e.error(z,F)}var f=this.registerDi=function(F){var Y=F.bpmnElement;Y?i[Y.id]?l(`multiple DI elements defined for ${un(Y)}`,{element:Y}):i[Y.id]=F:l(`no bpmnElement referenced in ${un(F)}`,{element:F})};function p(z){d(z.plane)}function d(z){f(z),k(z.planeElement,h)}function h(z){f(z)}this.handleDefinitions=function(F,Y){var Le=F.diagrams;if(Y&&Le.indexOf(Y)===-1)throw new Error("diagram not part of <bpmn:Definitions />");if(!Y&&Le&&Le.length&&(Y=Le[0]),!Y)throw new Error("no diagram to display");i={},p(Y);var Nt=Y.plane;if(!Nt)throw new Error(`no plane for ${un(Y)}`);var P=Nt.bpmnElement;if(!P)if(P=tS(F),P)l(`correcting missing bpmnElement on ${un(Nt)} to ${un(P)}`),Nt.bpmnElement=P,f(Nt);else throw new Error("no process or collaboration to display");var _=c(P,Nt);if(xn(P,"bpmn:Process")||xn(P,"bpmn:SubProcess"))g(P,_);else if(xn(P,"bpmn:Collaboration"))fe(P,_),R(F.rootElements,_);else throw new Error(`unsupported bpmnElement for ${un(Nt)}: ${un(P)}`);m(n)};var m=this.handleDeferred=function(){for(var F;n.length;)F=n.shift(),F()};function g(z,F){he(z,F),H(z.ioSpecification,F),T(z.artifacts,F),o(z)}function R(z,F){var Y=Be(z,function(Le){return!a(Le)&&xn(Le,"bpmn:Process")&&Le.laneSets});Y.forEach(r(g,F))}function E(z,F){u(z,F)}function x(z,F){k(z,r(E,F))}function w(z,F){u(z,F)}function S(z,F){u(z,F)}function M(z,F){u(z,F)}function N(z,F){u(z,F)}function T(z,F){k(z,function(Y){xn(Y,"bpmn:Association")?n.push(function(){N(Y,F)}):N(Y,F)})}function H(z,F){z&&(k(z.dataInputs,r(S,F)),k(z.dataOutputs,r(M,F)))}var G=this.handleSubProcess=function(F,Y){he(F,Y),T(F.artifacts,Y)};function $(z,F){var Y=u(z,F);xn(z,"bpmn:SubProcess")&&G(z,Y||F),xn(z,"bpmn:Activity")&&H(z.ioSpecification,F),n.push(function(){k(z.dataInputAssociations,r(w,F)),k(z.dataOutputAssociations,r(w,F))})}function V(z,F){u(z,F)}function de(z,F){u(z,F)}function Ge(z,F){n.push(function(){var Y=u(z,F);z.childLaneSet&&ft(z.childLaneSet,Y||F),ne(z)})}function ft(z,F){k(z.lanes,r(Ge,F))}function q(z,F){k(z,r(ft,F))}function he(z,F){ge(z.flowElements,F),z.laneSets&&q(z.laneSets,F)}function ge(z,F){k(z,function(Y){xn(Y,"bpmn:SequenceFlow")?n.push(function(){V(Y,F)}):xn(Y,"bpmn:BoundaryEvent")?n.unshift(function(){$(Y,F)}):xn(Y,"bpmn:FlowNode")?$(Y,F):xn(Y,"bpmn:DataObject")||(xn(Y,"bpmn:DataStoreReference")||xn(Y,"bpmn:DataObjectReference")?de(Y,F):l(`unrecognized flowElement ${un(Y)} in context ${un(F&&F.businessObject)}`,{element:Y,context:F}))})}function pe(z,F){var Y=u(z,F),Le=z.processRef;Le&&g(Le,Y||F)}function fe(z,F){k(z.participants,r(pe,F)),n.push(function(){x(z.messageFlows,F)}),T(z.artifacts,F)}function ne(z){k(z.flowNodeRef,function(F){var Y=F.get("lanes");Y&&Y.push(z)})}}function v(e,t){var n=Z(e);return n&&typeof n.$instanceOf=="function"&&n.$instanceOf(t)}function Ie(e,t){return Wi(t,function(n){return v(e,n)})}function Z(e){return e&&e.businessObject||e}function Ye(e){return e&&e.di}function iS(e,t,n){var i,r,o,a,s=[];function c(u,l){var f={root:function(m,g){return i.add(m,g)},element:function(m,g,R){return i.add(m,g,R)},error:function(m,g){s.push({message:m,context:g})}},p=new nS(f);l=l||u.diagrams&&u.diagrams[0];var d=rS(u,l);if(!d)throw new Error("no diagram to display");k(d,function(m){p.handleDefinitions(u,m)});var h=l.plane.bpmnElement.id;o.setRootElement(o.findRoot(h+"_plane")||o.findRoot(h))}return new Promise(function(u,l){try{return i=e.get("bpmnImporter"),r=e.get("eventBus"),o=e.get("canvas"),r.fire("import.render.start",{definitions:t}),c(t,n),r.fire("import.render.complete",{error:a,warnings:s}),u({warnings:s})}catch(f){return f.warnings=s,l(f)}})}function rS(e,t){if(!(!t||!t.plane)){var n=t.plane.bpmnElement,i=n;!v(n,"bpmn:Process")&&!v(n,"bpmn:Collaboration")&&(i=oS(n));var r;v(i,"bpmn:Collaboration")?r=i:r=ut(e.rootElements,function(u){if(v(u,"bpmn:Collaboration"))return ut(u.participants,function(l){return l.processRef===i})});var o=[i];r&&(o=an(r.participants,function(u){return u.processRef}),o.push(r));var a=am(o),s=[t],c=[n];return k(e.diagrams,function(u){if(u.plane){var l=u.plane.bpmnElement;a.indexOf(l)!==-1&&c.indexOf(l)===-1&&(s.push(u),c.push(l))}}),s}}function am(e){var t=[];return k(e,function(n){n&&(t.push(n),t=t.concat(am(n.flowElements)))}),t}function oS(e){for(var t=e;t;){if(v(t,"bpmn:Process"))return t;t=t.$parent}}var aS='<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>',sm=aS,cm={verticalAlign:"middle"},um={color:"#404040"},sS={zIndex:"1001",position:"fixed",top:"0",left:"0",right:"0",bottom:"0"},cS={width:"100%",height:"100%",background:"rgba(40,40,40,0.2)"},uS={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"},lS='<div class="bjs-powered-by-lightbox"><div class="backdrop"></div><div class="notice"><a href="https://bpmn.io" target="_blank" rel="noopener" class="link">'+sm+'</a><span>Web-based tooling for BPMN, DMN and forms powered by <a href="https://bpmn.io" target="_blank" rel="noopener">bpmn.io</a>.</span></div></div>',hi;function pS(){hi=pt(lS),yn(hi,sS),yn(nt("svg",hi),cm),yn(nt(".backdrop",hi),cS),yn(nt(".notice",hi),uS),yn(nt(".link",hi),um,{margin:"15px 20px 15px 10px",alignSelf:"center"})}function fS(){hi||(pS(),An.bind(hi,".backdrop","click",function(e){document.body.removeChild(hi)})),document.body.appendChild(hi)}const ks=5,lm="djs-outline-hidden";function bt(e){e=I({},hS,e),this._moddle=this._createModdle(e),this._container=this._createContainer(e),this._init(this._container,this._moddle,e),gS(this._container)}ae(bt,ir),bt.prototype.importXML=async function(t,n){const i=this;function r(a){return i.get("eventBus").createEvent(a)}let o=[];try{t=this._emit("import.parse.start",{xml:t})||t;let a;try{a=await this._moddle.fromXML(t,"bpmn:Definitions")}catch(p){throw this._emit("import.parse.complete",{error:p}),p}let s=a.rootElement;const c=a.references,u=a.warnings,l=a.elementsById;o=o.concat(u),s=this._emit("import.parse.complete",r({error:null,definitions:s,elementsById:l,references:c,warnings:o}))||s;const f=await this.importDefinitions(s,n);return o=o.concat(f.warnings),this._emit("import.done",{error:null,warnings:o}),{warnings:o}}catch(a){let s=a;throw o=o.concat(s.warnings||[]),Os(s,o),s=dS(s),this._emit("import.done",{error:s,warnings:s.warnings}),s}},bt.prototype.importDefinitions=async function(t,n){return this._setDefinitions(t),{warnings:(await this.open(n)).warnings}},bt.prototype.open=async function(t){const n=this._definitions;let i=t;if(!n){const o=new Error("no XML imported");throw Os(o,[]),o}if(typeof t=="string"&&(i=mS(n,t),!i)){const o=new Error("BPMNDiagram <"+t+"> not found");throw Os(o,[]),o}try{this.clear()}catch(o){throw Os(o,[]),o}const{warnings:r}=await iS(this,n,i);return{warnings:r}},bt.prototype.saveXML=async function(t){t=t||{};let n=this._definitions,i,r;try{if(!n)throw new Error("no definitions loaded");n=this._emit("saveXML.start",{definitions:n})||n,r=(await this._moddle.toXML(n,t)).xml,r=this._emit("saveXML.serialized",{xml:r})||r}catch(a){i=a}const o=i?{error:i}:{xml:r};if(this._emit("saveXML.done",o),i)throw i;return o},bt.prototype.saveSVG=async function(){this._emit("saveSVG.start");let t,n;try{const i=this.get("canvas"),r=i.getActiveLayer(),o=nt(":scope > defs",i._svg),a=Ah(r),s=o?"<defs>"+Ah(o)+"</defs>":"",c=i.getContainer();yt(c).add(lm);let u;try{u=r.getBBox()}finally{yt(c).remove(lm)}const l=u.x-ks,f=u.y-ks,p=u.width+ks*2,d=u.height+ks*2;t=`<?xml version="1.0" encoding="utf-8"?>
8
8
  <!-- created with bpmn-js / http://bpmn.io -->
9
9
  <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
10
- <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="`+p+'" height="'+d+'" viewBox="'+l+" "+f+" "+p+" "+d+'" version="1.1">'+s+a+"</svg>"}catch(i){n=i}if(this._emit("saveSVG.done",{error:n,svg:t}),n)throw n;return{svg:t}},yt.prototype._setDefinitions=function(e){this._definitions=e},yt.prototype.getModules=function(){return this._modules},yt.prototype.clear=function(){this.getDefinitions()&&ir.prototype.clear.call(this)},yt.prototype.destroy=function(){ir.prototype.destroy.call(this),pi(this._container)},yt.prototype.on=function(e,t,n,i){return this.get("eventBus").on(e,t,n,i)},yt.prototype.off=function(e,t){this.get("eventBus").off(e,t)},yt.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=nt(e)),e.appendChild(this._container),this._emit("attach",{}),this.get("canvas").resized()},yt.prototype.getDefinitions=function(){return this._definitions},yt.prototype.detach=function(){const e=this._container,t=e.parentNode;t&&(this._emit("detach",{}),t.removeChild(e))},yt.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=L(si(n,["additionalModules"]),{canvas:L({},n.canvas,{container:e}),modules:a});ir.call(this,s),n&&n.container&&this.attachTo(n.container)},yt.prototype._emit=function(e,t){return this.get("eventBus").fire(e,t)},yt.prototype._createContainer=function(e){const t=lt('<div class="bjs-container"></div>');return gn(t,{width:um(e.width),height:um(e.height),position:e.position}),t},yt.prototype._createModdle=function(e){const t=L({},this._moddleExtensions,e.moddleExtensions);return new hd(t)},yt.prototype._modules=[];function Ts(e,t){return e.warnings=t,e}function sS(e){const n=/unparsable content <([^>]+)> detected([\s\S]*)$/.exec(e.message);return n&&(e.message="unparsable content <"+n[1]+"> detected; this may indicate an invalid BPMN 2.0 diagram file"+n[2]),e}const cS={width:"100%",height:"100%",position:"relative"};function um(e){return e+(Ce(e)?"px":"")}function uS(e,t){return t&&ut(e.diagrams,function(n){return n.id===t})||null}function lS(e){const n='<a href="http://bpmn.io" target="_blank" class="bjs-powered-by" title="Powered by bpmn.io" >'+om+"</a>",i=lt(n);gn(nt("svg",i),am),gn(i,sm,{position:"absolute",bottom:"15px",right:"15px",zIndex:"100"}),e.appendChild(i),Pe.bind(i,"click",function(r){aS(),r.preventDefault()})}function lo(e){yt.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)}ae(lo,yt),lo.prototype._createModdle=function(e){var t=yt.prototype._createModdle.call(this,e);return t.ids=new li([32,36,1]),t},lo.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 $e(e,t){return v(e,"bpmn:CallActivity")?!1:v(e,"bpmn:SubProcess")?(t=t||Ge(e),t&&v(t,"bpmndi:BPMNPlane")?!0:t&&!!t.isExpanded):v(e,"bpmn:Participant")?!!Z(e).processRef:!0}function qt(e){if(!(!v(e,"bpmn:Participant")&&!v(e,"bpmn:Lane"))){var t=Ge(e).isHorizontal;return t===void 0?!0:t}}function pS(e){return e&&Z(e).isInterrupting!==!1}function un(e){return e&&!!Z(e).triggeredByEvent}function po(e,t){var n=Z(e).eventDefinitions;return Wi(n,function(i){return v(i,t)})}function fS(e){return po(e,"bpmn:ErrorEventDefinition")}function dS(e){return po(e,"bpmn:EscalationEventDefinition")}function hS(e){return po(e,"bpmn:CompensateEventDefinition")}var Nr={width:90,height:20},lm=15;function rr(e){return v(e,"bpmn:Event")||v(e,"bpmn:Gateway")||v(e,"bpmn:DataStoreReference")||v(e,"bpmn:DataObjectReference")||v(e,"bpmn:DataInput")||v(e,"bpmn:DataOutput")||v(e,"bpmn:SequenceFlow")||v(e,"bpmn:MessageFlow")||v(e,"bpmn:Group")}function Ms(e){return De(e.label)}function mS(e){var t=e.length/2-1,n=e[Math.floor(t)],i=e[Math.ceil(t+.01)],r=gS(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-=lm:a+=lm,{x:a,y:s}}function gS(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 dl(e){return e.waypoints?mS(e.waypoints):v(e,"bpmn:Group")?{x:e.x+e.width/2,y:e.y+Nr.height/2}:{x:e.x+e.width/2,y:e.y+e.height+Nr.height/2}}function yS(e,t){var n,i,r,o=e.label;return o&&o.bounds?(r=o.bounds,i={width:Math.max(Nr.width,r.width),height:r.height},n={x:r.x+r.width/2,y:r.y+r.height/2}):(n=dl(t),i=Nr),L({x:n.x-i.width/2,y:n.y-i.height/2},i)}function pm(e){if(v(e,"bpmn:FlowElement")||v(e,"bpmn:Participant")||v(e,"bpmn:Lane")||v(e,"bpmn:SequenceFlow")||v(e,"bpmn:MessageFlow")||v(e,"bpmn:DataInput")||v(e,"bpmn:DataOutput"))return"name";if(v(e,"bpmn:TextAnnotation"))return"text";if(v(e,"bpmn:Group"))return"categoryValueRef"}function vS(e){var t=e.categoryValueRef;return t&&t.value||""}function Hn(e){var t=e.businessObject,n=pm(t);if(n)return n==="categoryValueRef"?vS(t):t[n]||""}function _S(e,t){var n=e.businessObject,i=pm(n);if(i)if(i==="categoryValueRef"){if(!n[i])return e;n[i].value=t}else n[i]=t;return e}function bS(e){return De(e)&&rr(e.labelTarget)}var fo=7;function fm(e){let t=[];return k(e.incoming,n=>{v(n,"bpmn:Association")&&v(n.source,"bpmn:TextAnnotation")&&t.push({annotation:n.source,association:n})}),k(e.outgoing,n=>{v(n,"bpmn:Association")&&v(n.target,"bpmn:TextAnnotation")&&t.push({annotation:n.target,association:n})}),t}function na(e){const t=new Map;return k(al(e),n=>{k(fm(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 hl="hsl(225, 10%, 15%)",xS="white";function mi(e,t){return Wi(e.eventDefinitions,function(n){return n.$type===t})}function wS(e){return e.$type==="bpmn:IntermediateThrowEvent"||e.$type==="bpmn:EndEvent"}function ES(e){var t=e.dataObjectRef;return e.isCollection||t&&t.isCollection}function Be(e,t,n){var i=Ge(e);return n||i.get("color:background-color")||i.get("bioc:fill")||t||xS}function oe(e,t,n){var i=Ge(e);return n||i.get("color:border-color")||i.get("bioc:stroke")||t||hl}function ia(e,t,n,i){var r=Ge(e),o=r.get("label");return i||o&&o.get("color:color")||t||oe(e,n)}function dm(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 Or(r)}function ml(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 Or(a)}function SS(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 Or(s)}function RS(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 Or(o)}function ra(e,t={}){return{width:Wn(e,t),height:An(e,t)}}function Wn(e,t={}){return En(t,"width")?t.width:e.width}function An(e,t={}){return En(t,"height")?t.height:e.height}var CS=new li,PS=10,ks=3,AS=1.5,Ds=10,TS=4,ho=.95,MS=1,kS=.25;function Br(e,t,n,i,r,o,a){Ai.call(this,t,a);var s=e&&e.defaultFillColor,c=e&&e.defaultStrokeColor,u=e&&e.defaultLabelColor;function l(P){return n.computeStyle(P,{strokeLinecap:"round",strokeLinejoin:"round",stroke:hl,strokeWidth:2,fill:"white"})}function f(P){return n.computeStyle(P,["no-fill"],{strokeLinecap:"round",strokeLinejoin:"round",stroke:hl,strokeWidth:2})}function p(P,_){var{ref:y={x:0,y:0},scale:D=1,element:B,parentGfx:W=r._svg}=_,le=ye("marker",{id:P,viewBox:"0 0 20 20",refX:y.x,refY:y.y,markerWidth:20*D,markerHeight:20*D,orient:"auto"});Ae(le,B);var Me=nt(":scope > defs",W);Me||(Me=ye("defs"),Ae(W,Me)),Ae(Me,le)}function d(P,_,y,D){var B=CS.nextPrefixed("marker-");return h(P,B,_,y,D),"url(#"+B+")"}function h(P,_,y,D,B){if(y==="sequenceflow-end"){var W=ye("path",{d:"M 1 5 L 11 10 L 1 15 Z",...l({fill:B,stroke:B,strokeWidth:1})});p(_,{element:W,ref:{x:11,y:10},scale:.5,parentGfx:P})}if(y==="messageflow-start"){var le=ye("circle",{cx:6,cy:6,r:3.5,...l({fill:D,stroke:B,strokeWidth:1,strokeDasharray:[1e4,1]})});p(_,{element:le,ref:{x:6,y:6},parentGfx:P})}if(y==="messageflow-end"){var Me=ye("path",{d:"m 1 5 l 0 -3 l 7 3 l -7 3 z",...l({fill:D,stroke:B,strokeWidth:1,strokeDasharray:[1e4,1]})});p(_,{element:Me,ref:{x:8.5,y:5},parentGfx:P})}if(y==="association-start"){var Ye=ye("path",{d:"M 11 5 L 1 10 L 11 15",...f({fill:"none",stroke:B,strokeWidth:1.5,strokeDasharray:[1e4,1]})});p(_,{element:Ye,ref:{x:1,y:10},scale:.5,parentGfx:P})}if(y==="association-end"){var ft=ye("path",{d:"M 1 5 L 11 10 L 1 15",...f({fill:"none",stroke:B,strokeWidth:1.5,strokeDasharray:[1e4,1]})});p(_,{element:ft,ref:{x:11,y:10},scale:.5,parentGfx:P})}if(y==="conditional-flow-marker"){var it=ye("path",{d:"M 0 10 L 8 6 L 16 10 L 8 14 Z",...l({fill:D,stroke:B})});p(_,{element:it,ref:{x:-1,y:10},scale:.5,parentGfx:P})}if(y==="conditional-default-flow-marker"){var Nt=ye("path",{d:"M 6 4 L 10 16",...l({stroke:B,fill:"none"})});p(_,{element:Nt,ref:{x:0,y:10},scale:.5,parentGfx:P})}}function m(P,_,y,D,B={}){Ut(D)&&(B=D,D=0),D=D||0,B=l(B);var W=_/2,le=y/2,Me=ye("circle",{cx:W,cy:le,r:Math.round((_+y)/4-D),...B});return Ae(P,Me),Me}function g(P,_,y,D,B,W){Ut(B)&&(W=B,B=0),B=B||0,W=l(W);var le=ye("rect",{x:B,y:B,width:_-B*2,height:y-B*2,rx:D,ry:D,...W});return Ae(P,le),le}function R(P,_,y,D){var B=_/2,W=y/2,le=[{x:B,y:0},{x:_,y:W},{x:B,y},{x:0,y:W}],Me=le.map(function(ft){return ft.x+","+ft.y}).join(" ");D=l(D);var Ye=ye("polygon",{...D,points:Me});return Ae(P,Ye),Ye}function w(P,_,y,D){y=f(y);var B=Ko(_,y,D);return Ae(P,B),B}function b(P,_,y){return w(P,_,y,5)}function x(P,_,y){y=f(y);var D=ye("path",{...y,d:_});return Ae(P,D),D}function S(P,_,y,D){return x(_,y,L({"data-marker":P},D))}function M(P){return It[P]}function N(P){return function(_,y,D){return M(P)(_,y,D)}}var T={"bpmn:MessageEventDefinition":function(P,_,y={},D){var B=i.getScaledPath("EVENT_MESSAGE",{xScaleFactor:.9,yScaleFactor:.9,containerWidth:y.width||_.width,containerHeight:y.height||_.height,position:{mx:.235,my:.315}}),W=D?oe(_,c,y.stroke):Be(_,s,y.fill),le=D?Be(_,s,y.fill):oe(_,c,y.stroke),Me=x(P,B,{fill:W,stroke:le,strokeWidth:1});return Me},"bpmn:TimerEventDefinition":function(P,_,y={}){var D=y.width||_.width,B=y.height||_.height,W=y.width?1:2,le=m(P,D,B,.2*B,{fill:Be(_,s,y.fill),stroke:oe(_,c,y.stroke),strokeWidth:W}),Me=i.getScaledPath("EVENT_TIMER_WH",{xScaleFactor:.75,yScaleFactor:.75,containerWidth:D,containerHeight:B,position:{mx:.5,my:.5}});x(P,Me,{stroke:oe(_,c,y.stroke),strokeWidth:W});for(var Ye=0;Ye<12;Ye++){var ft=i.getScaledPath("EVENT_TIMER_LINE",{xScaleFactor:.75,yScaleFactor:.75,containerWidth:D,containerHeight:B,position:{mx:.5,my:.5}}),it=D/2,Nt=B/2;x(P,ft,{strokeWidth:1,stroke:oe(_,c,y.stroke),transform:"rotate("+Ye*30+","+Nt+","+it+")"})}return le},"bpmn:EscalationEventDefinition":function(P,_,y={},D){var B=i.getScaledPath("EVENT_ESCALATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:y.width||_.width,containerHeight:y.height||_.height,position:{mx:.5,my:.2}}),W=D?oe(_,c,y.stroke):Be(_,s,y.fill);return x(P,B,{fill:W,stroke:oe(_,c,y.stroke),strokeWidth:1})},"bpmn:ConditionalEventDefinition":function(P,_,y={}){var D=i.getScaledPath("EVENT_CONDITIONAL",{xScaleFactor:1,yScaleFactor:1,containerWidth:y.width||_.width,containerHeight:y.height||_.height,position:{mx:.5,my:.222}});return x(P,D,{fill:Be(_,s,y.fill),stroke:oe(_,c,y.stroke),strokeWidth:1})},"bpmn:LinkEventDefinition":function(P,_,y={},D){var B=i.getScaledPath("EVENT_LINK",{xScaleFactor:1,yScaleFactor:1,containerWidth:_.width,containerHeight:_.height,position:{mx:.57,my:.263}}),W=D?oe(_,c,y.stroke):Be(_,s,y.fill);return x(P,B,{fill:W,stroke:oe(_,c,y.stroke),strokeWidth:1})},"bpmn:ErrorEventDefinition":function(P,_,y={},D){var B=i.getScaledPath("EVENT_ERROR",{xScaleFactor:1.1,yScaleFactor:1.1,containerWidth:y.width||_.width,containerHeight:y.height||_.height,position:{mx:.2,my:.722}}),W=D?oe(_,c,y.stroke):Be(_,s,y.fill);return x(P,B,{fill:W,stroke:oe(_,c,y.stroke),strokeWidth:1})},"bpmn:CancelEventDefinition":function(P,_,y={},D){var B=i.getScaledPath("EVENT_CANCEL_45",{xScaleFactor:1,yScaleFactor:1,containerWidth:_.width,containerHeight:_.height,position:{mx:.638,my:-.055}}),W=D?oe(_,c,y.stroke):"none",le=x(P,B,{fill:W,stroke:oe(_,c,y.stroke),strokeWidth:1});return im(le,45),le},"bpmn:CompensateEventDefinition":function(P,_,y={},D){var B=i.getScaledPath("EVENT_COMPENSATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:y.width||_.width,containerHeight:y.height||_.height,position:{mx:.22,my:.5}}),W=D?oe(_,c,y.stroke):Be(_,s,y.fill);return x(P,B,{fill:W,stroke:oe(_,c,y.stroke),strokeWidth:1})},"bpmn:SignalEventDefinition":function(P,_,y={},D){var B=i.getScaledPath("EVENT_SIGNAL",{xScaleFactor:.9,yScaleFactor:.9,containerWidth:y.width||_.width,containerHeight:y.height||_.height,position:{mx:.5,my:.2}}),W=D?oe(_,c,y.stroke):Be(_,s,y.fill);return x(P,B,{strokeWidth:1,fill:W,stroke:oe(_,c,y.stroke)})},"bpmn:MultipleEventDefinition":function(P,_,y={},D){var B=i.getScaledPath("EVENT_MULTIPLE",{xScaleFactor:1.1,yScaleFactor:1.1,containerWidth:y.width||_.width,containerHeight:y.height||_.height,position:{mx:.211,my:.36}}),W=D?oe(_,c,y.stroke):Be(_,s,y.fill);return x(P,B,{fill:W,stroke:oe(_,c,y.stroke),strokeWidth:1})},"bpmn:ParallelMultipleEventDefinition":function(P,_,y={}){var D=i.getScaledPath("EVENT_PARALLEL_MULTIPLE",{xScaleFactor:1.2,yScaleFactor:1.2,containerWidth:y.width||_.width,containerHeight:y.height||_.height,position:{mx:.458,my:.194}});return x(P,D,{fill:Be(_,s,y.fill),stroke:oe(_,c,y.stroke),strokeWidth:1})},"bpmn:TerminateEventDefinition":function(P,_,y={}){var D=m(P,_.width,_.height,8,{fill:oe(_,c,y.stroke),stroke:oe(_,c,y.stroke),strokeWidth:4});return D}};function H(P,_,y={},D){var B=Z(P),W=wS(B),le=D||P;return B.get("eventDefinitions")&&B.get("eventDefinitions").length>1?B.get("parallelMultiple")?T["bpmn:ParallelMultipleEventDefinition"](_,le,y,W):T["bpmn:MultipleEventDefinition"](_,le,y,W):mi(B,"bpmn:MessageEventDefinition")?T["bpmn:MessageEventDefinition"](_,le,y,W):mi(B,"bpmn:TimerEventDefinition")?T["bpmn:TimerEventDefinition"](_,le,y,W):mi(B,"bpmn:ConditionalEventDefinition")?T["bpmn:ConditionalEventDefinition"](_,le,y,W):mi(B,"bpmn:SignalEventDefinition")?T["bpmn:SignalEventDefinition"](_,le,y,W):mi(B,"bpmn:EscalationEventDefinition")?T["bpmn:EscalationEventDefinition"](_,le,y,W):mi(B,"bpmn:LinkEventDefinition")?T["bpmn:LinkEventDefinition"](_,le,y,W):mi(B,"bpmn:ErrorEventDefinition")?T["bpmn:ErrorEventDefinition"](_,le,y,W):mi(B,"bpmn:CancelEventDefinition")?T["bpmn:CancelEventDefinition"](_,le,y,W):mi(B,"bpmn:CompensateEventDefinition")?T["bpmn:CompensateEventDefinition"](_,le,y,W):mi(B,"bpmn:TerminateEventDefinition")?T["bpmn:TerminateEventDefinition"](_,le,y,W):null}var V={ParticipantMultiplicityMarker:function(P,_,y={}){var D=Wn(_,y),B=An(_,y),W=i.getScaledPath("MARKER_PARALLEL",{xScaleFactor:1,yScaleFactor:1,containerWidth:D,containerHeight:B,position:{mx:(D/2-6)/D,my:(B-15)/B}});S("participant-multiplicity",P,W,{strokeWidth:2,fill:Be(_,s,y.fill),stroke:oe(_,c,y.stroke)})},SubProcessMarker:function(P,_,y={}){var D=g(P,14,14,0,{strokeWidth:1,fill:Be(_,s,y.fill),stroke:oe(_,c,y.stroke)});Jt(D,_.width/2-7.5,_.height-20);var B=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",P,B,{fill:Be(_,s,y.fill),stroke:oe(_,c,y.stroke)})},ParallelMarker:function(P,_,y){var D=Wn(_,y),B=An(_,y),W=i.getScaledPath("MARKER_PARALLEL",{xScaleFactor:1,yScaleFactor:1,containerWidth:D,containerHeight:B,position:{mx:(D/2+y.parallel)/D,my:(B-20)/B}});S("parallel",P,W,{fill:Be(_,s,y.fill),stroke:oe(_,c,y.stroke)})},SequentialMarker:function(P,_,y){var D=i.getScaledPath("MARKER_SEQUENTIAL",{xScaleFactor:1,yScaleFactor:1,containerWidth:_.width,containerHeight:_.height,position:{mx:(_.width/2+y.seq)/_.width,my:(_.height-19)/_.height}});S("sequential",P,D,{fill:Be(_,s,y.fill),stroke:oe(_,c,y.stroke)})},CompensationMarker:function(P,_,y){var D=i.getScaledPath("MARKER_COMPENSATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:_.width,containerHeight:_.height,position:{mx:(_.width/2+y.compensation)/_.width,my:(_.height-13)/_.height}});S("compensation",P,D,{strokeWidth:1,fill:Be(_,s,y.fill),stroke:oe(_,c,y.stroke)})},LoopMarker:function(P,_,y){var D=Wn(_,y),B=An(_,y),W=i.getScaledPath("MARKER_LOOP",{xScaleFactor:1,yScaleFactor:1,containerWidth:D,containerHeight:B,position:{mx:(D/2+y.loop)/D,my:(B-7)/B}});S("loop",P,W,{strokeWidth:1.5,fill:"none",stroke:oe(_,c,y.stroke),strokeMiterlimit:.5})},AdhocMarker:function(P,_,y){var D=Wn(_,y),B=An(_,y),W=i.getScaledPath("MARKER_ADHOC",{xScaleFactor:1,yScaleFactor:1,containerWidth:D,containerHeight:B,position:{mx:(D/2+y.adhoc)/D,my:(B-15)/B}});S("adhoc",P,W,{strokeWidth:1,fill:oe(_,c,y.stroke),stroke:oe(_,c,y.stroke)})}};function $(P,_,y,D){V[P](_,y,D)}function G(P,_,y=[],D={}){D={fill:D.fill,stroke:D.stroke,width:Wn(_,D),height:An(_,D)};var B=Z(_),W=y.includes("SubProcessMarker");W?D={...D,seq:-21,parallel:-22,compensation:-25,loop:-18,adhoc:10}:D={...D,seq:-5,parallel:-6,compensation:-7,loop:0,adhoc:-8},B.get("isForCompensation")&&y.push("CompensationMarker"),v(B,"bpmn:AdHocSubProcess")&&(y.push("AdhocMarker"),W||L(D,{compensation:D.compensation-18}));var le=B.get("loopCharacteristics"),Me=le&&le.get("isSequential");le&&(L(D,{compensation:D.compensation-18}),y.includes("AdhocMarker")&&L(D,{seq:-23,loop:-18,parallel:-24}),Me===void 0&&y.push("LoopMarker"),Me===!1&&y.push("ParallelMarker"),Me===!0&&y.push("SequentialMarker")),y.includes("CompensationMarker")&&y.length===1&&L(D,{compensation:-8}),k(y,function(Ye){$(Ye,P,_,D)})}function he(P,_,y={}){y=L({size:{width:100}},y);var D=o.createText(_||"",y);return je(D).add("djs-label"),Ae(P,D),D}function Fe(P,_,y,D={}){var B=Z(_),W=ra({x:_.x,y:_.y,width:_.width,height:_.height},D);return he(P,B.name,{align:y,box:W,padding:7,style:{fill:ia(_,u,c,D.stroke)}})}function pt(P,_,y={}){var D={width:_.width,height:_.height,x:_.width/2+_.x,y:_.height/2+_.y};return he(P,Hn(_),{box:D,style:L({},o.getExternalStyle(),{fill:ia(_,u,c,y.stroke)})})}function q(P,_,y,D={}){var B=qt(y),W=he(P,_,{box:{height:30,width:B?An(y,D):Wn(y,D)},align:"center-middle",style:{fill:ia(y,u,c,D.stroke)}});if(B){var le=-1*An(y,D);Ps(W,0,-le,270)}}function me(P,_,y={}){var{width:D,height:B}=ra(_,y);return g(P,D,B,Ds,{...y,fill:Be(_,s,y.fill),fillOpacity:ho,stroke:oe(_,c,y.stroke)})}function ge(P,_,y={}){var D=Z(_),B=Be(_,s,y.fill),W=oe(_,c,y.stroke);return(D.get("associationDirection")==="One"||D.get("associationDirection")==="Both")&&(y.markerEnd=d(P,"association-end",B,W)),D.get("associationDirection")==="Both"&&(y.markerStart=d(P,"association-start",B,W)),y=We(y,["markerStart","markerEnd"]),b(P,_.waypoints,{...y,stroke:W,strokeDasharray:"0, 5"})}function pe(P,_,y={}){var D=Be(_,s,y.fill),B=oe(_,c,y.stroke),W=i.getScaledPath("DATA_OBJECT_PATH",{xScaleFactor:1,yScaleFactor:1,containerWidth:_.width,containerHeight:_.height,position:{mx:.474,my:.296}}),le=x(P,W,{fill:D,fillOpacity:ho,stroke:B}),Me=Z(_);if(ES(Me)){var Ye=i.getScaledPath("DATA_OBJECT_COLLECTION_PATH",{xScaleFactor:1,yScaleFactor:1,containerWidth:_.width,containerHeight:_.height,position:{mx:.33,my:(_.height-18)/_.height}});x(P,Ye,{strokeWidth:2,fill:D,stroke:B})}return le}function fe(P,_,y={}){return m(P,_.width,_.height,{fillOpacity:ho,...y,fill:Be(_,s,y.fill),stroke:oe(_,c,y.stroke)})}function ie(P,_,y={}){return R(P,_.width,_.height,{fill:Be(_,s,y.fill),fillOpacity:ho,stroke:oe(_,c,y.stroke)})}function z(P,_,y={}){var D=g(P,Wn(_,y),An(_,y),0,{fill:Be(_,s,y.fill),fillOpacity:y.fillOpacity||ho,stroke:oe(_,c,y.stroke),strokeWidth:1.5}),B=Z(_);if(v(B,"bpmn:Lane")){var W=B.get("name");q(P,W,_,y)}return D}function F(P,_,y={}){var D=me(P,_,y),B=$e(_);if(un(_)&&(se(D,{strokeDasharray:"0, 5.5",strokeWidth:2.5}),!B)){var W=Z(_).flowElements||[],le=W.filter(Me=>v(Me,"bpmn:StartEvent"));le.length===1&&U(le[0],P,y,_)}return Fe(P,_,B?"center-top":"center-middle",y),B?G(P,_,void 0,y):G(P,_,["SubProcessMarker"],y),D}function U(P,_,y,D){var B=22,W={fill:Be(D,s,y.fill),stroke:oe(D,c,y.stroke),width:B,height:B},le=Z(P).isInterrupting,Me=le?0:3,Ye=le?1:1.2,ft=20,it=(B-ft)/2,Nt="translate("+it+","+it+")";m(_,ft,ft,{fill:W.fill,stroke:W.stroke,strokeWidth:Ye,strokeDasharray:Me,transform:Nt}),H(P,_,W,D)}function Oe(P,_,y={}){var D=me(P,_,y);return Fe(P,_,"center-middle",y),G(P,_,void 0,y),D}var It=this.handlers={"bpmn:AdHocSubProcess":function(P,_,y={}){return $e(_)?y=We(y,["fill","stroke","width","height"]):y=We(y,["fill","stroke"]),F(P,_,y)},"bpmn:Association":function(P,_,y={}){return y=We(y,["fill","stroke"]),ge(P,_,y)},"bpmn:BoundaryEvent":function(P,_,y={}){var{renderIcon:D=!0}=y;y=We(y,["fill","stroke"]);var B=Z(_),W=B.get("cancelActivity");y={strokeWidth:1.5,fill:Be(_,s,y.fill),fillOpacity:MS,stroke:oe(_,c,y.stroke)},W||(y.strokeDasharray="6");var le=fe(P,_,y);return m(P,_.width,_.height,ks,{...y,fill:"none"}),D&&H(_,P,y),le},"bpmn:BusinessRuleTask":function(P,_,y={}){y=We(y,["fill","stroke"]);var D=Oe(P,_,y),B=i.getScaledPath("TASK_TYPE_BUSINESS_RULE_MAIN",{abspos:{x:8,y:8}}),W=x(P,B);se(W,{fill:Be(_,s,y.fill),stroke:oe(_,c,y.stroke),strokeWidth:1});var le=i.getScaledPath("TASK_TYPE_BUSINESS_RULE_HEADER",{abspos:{x:8,y:8}}),Me=x(P,le);return se(Me,{fill:oe(_,c,y.stroke),stroke:oe(_,c,y.stroke),strokeWidth:1}),D},"bpmn:CallActivity":function(P,_,y={}){return y=We(y,["fill","stroke"]),F(P,_,{strokeWidth:5,...y})},"bpmn:ComplexGateway":function(P,_,y={}){y=We(y,["fill","stroke"]);var D=ie(P,_,y),B=i.getScaledPath("GATEWAY_COMPLEX",{xScaleFactor:.5,yScaleFactor:.5,containerWidth:_.width,containerHeight:_.height,position:{mx:.46,my:.26}});return x(P,B,{fill:oe(_,c,y.stroke),stroke:oe(_,c,y.stroke),strokeWidth:1}),D},"bpmn:DataInput":function(P,_,y={}){y=We(y,["fill","stroke"]);var D=i.getRawPath("DATA_ARROW"),B=pe(P,_,y);return x(P,D,{fill:"none",stroke:oe(_,c,y.stroke),strokeWidth:1}),B},"bpmn:DataInputAssociation":function(P,_,y={}){return y=We(y,["fill","stroke"]),ge(P,_,{...y,markerEnd:d(P,"association-end",Be(_,s,y.fill),oe(_,c,y.stroke))})},"bpmn:DataObject":function(P,_,y={}){return y=We(y,["fill","stroke"]),pe(P,_,y)},"bpmn:DataObjectReference":N("bpmn:DataObject"),"bpmn:DataOutput":function(P,_,y={}){y=We(y,["fill","stroke"]);var D=i.getRawPath("DATA_ARROW"),B=pe(P,_,y);return x(P,D,{strokeWidth:1,fill:oe(_,c,y.stroke),stroke:oe(_,c,y.stroke)}),B},"bpmn:DataOutputAssociation":function(P,_,y={}){return y=We(y,["fill","stroke"]),ge(P,_,{...y,markerEnd:d(P,"association-end",Be(_,s,y.fill),oe(_,c,y.stroke))})},"bpmn:DataStoreReference":function(P,_,y={}){y=We(y,["fill","stroke"]);var D=i.getScaledPath("DATA_STORE",{xScaleFactor:1,yScaleFactor:1,containerWidth:_.width,containerHeight:_.height,position:{mx:0,my:.133}});return x(P,D,{fill:Be(_,s,y.fill),fillOpacity:ho,stroke:oe(_,c,y.stroke),strokeWidth:2})},"bpmn:EndEvent":function(P,_,y={}){var{renderIcon:D=!0}=y;y=We(y,["fill","stroke"]);var B=fe(P,_,{...y,strokeWidth:4});return D&&H(_,P,y),B},"bpmn:EventBasedGateway":function(P,_,y={}){y=We(y,["fill","stroke"]);var D=Z(_),B=ie(P,_,y);m(P,_.width,_.height,_.height*.2,{fill:Be(_,"none",y.fill),stroke:oe(_,c,y.stroke),strokeWidth:1});var W=D.get("eventGatewayType"),le=!!D.get("instantiate");function Me(){var ft=i.getScaledPath("GATEWAY_EVENT_BASED",{xScaleFactor:.18,yScaleFactor:.18,containerWidth:_.width,containerHeight:_.height,position:{mx:.36,my:.44}});x(P,ft,{fill:"none",stroke:oe(_,c,y.stroke),strokeWidth:2})}if(W==="Parallel"){var Ye=i.getScaledPath("GATEWAY_PARALLEL",{xScaleFactor:.4,yScaleFactor:.4,containerWidth:_.width,containerHeight:_.height,position:{mx:.474,my:.296}});x(P,Ye,{fill:"none",stroke:oe(_,c,y.stroke),strokeWidth:1})}else W==="Exclusive"&&(le||m(P,_.width,_.height,_.height*.26,{fill:"none",stroke:oe(_,c,y.stroke),strokeWidth:1}),Me());return B},"bpmn:ExclusiveGateway":function(P,_,y={}){y=We(y,["fill","stroke"]);var D=ie(P,_,y),B=i.getScaledPath("GATEWAY_EXCLUSIVE",{xScaleFactor:.4,yScaleFactor:.4,containerWidth:_.width,containerHeight:_.height,position:{mx:.32,my:.3}}),W=Ge(_);return W.get("isMarkerVisible")&&x(P,B,{fill:oe(_,c,y.stroke),stroke:oe(_,c,y.stroke),strokeWidth:1}),D},"bpmn:Gateway":function(P,_,y={}){return y=We(y,["fill","stroke"]),ie(P,_,y)},"bpmn:Group":function(P,_,y={}){return y=We(y,["fill","stroke","width","height"]),g(P,_.width,_.height,Ds,{stroke:oe(_,c,y.stroke),strokeWidth:1.5,strokeDasharray:"10, 6, 0, 6",fill:"none",pointerEvents:"none",width:Wn(_,y),height:An(_,y)})},"bpmn:InclusiveGateway":function(P,_,y={}){y=We(y,["fill","stroke"]);var D=ie(P,_,y);return m(P,_.width,_.height,_.height*.24,{fill:Be(_,s,y.fill),stroke:oe(_,c,y.stroke),strokeWidth:2.5}),D},"bpmn:IntermediateEvent":function(P,_,y={}){var{renderIcon:D=!0}=y;y=We(y,["fill","stroke"]);var B=fe(P,_,{...y,strokeWidth:1.5});return m(P,_.width,_.height,ks,{fill:"none",stroke:oe(_,c,y.stroke),strokeWidth:1.5}),D&&H(_,P,y),B},"bpmn:IntermediateCatchEvent":N("bpmn:IntermediateEvent"),"bpmn:IntermediateThrowEvent":N("bpmn:IntermediateEvent"),"bpmn:Lane":function(P,_,y={}){return y=We(y,["fill","stroke","width","height"]),z(P,_,{...y,fillOpacity:kS})},"bpmn:ManualTask":function(P,_,y={}){y=We(y,["fill","stroke"]);var D=Oe(P,_,y),B=i.getScaledPath("TASK_TYPE_MANUAL",{abspos:{x:17,y:15}});return x(P,B,{fill:Be(_,s,y.fill),stroke:oe(_,c,y.stroke),strokeWidth:.5}),D},"bpmn:MessageFlow":function(P,_,y={}){y=We(y,["fill","stroke"]);var D=Z(_),B=Ge(_),W=Be(_,s,y.fill),le=oe(_,c,y.stroke),Me=b(P,_.waypoints,{markerEnd:d(P,"messageflow-end",W,le),markerStart:d(P,"messageflow-start",W,le),stroke:le,strokeDasharray:"10, 11",strokeWidth:1.5});if(D.get("messageRef")){var Ye=Me.getPointAtLength(Me.getTotalLength()/2),ft=i.getScaledPath("MESSAGE_FLOW_MARKER",{abspos:{x:Ye.x,y:Ye.y}}),it={strokeWidth:1};B.get("messageVisibleKind")==="initiating"?(it.fill=W,it.stroke=le):(it.fill=le,it.stroke=W);var Nt=x(P,ft,it),ln=D.get("messageRef"),pn=ln.get("name"),ct=he(P,pn,{align:"center-top",fitBox:!0,style:{fill:le}}),Bt=Nt.getBBox(),fn=ct.getBBox(),Fo=Ye.x-fn.width/2,dn=Ye.y+Bt.height/2+PS;Ps(ct,Fo,dn,0)}return Me},"bpmn:ParallelGateway":function(P,_,y={}){y=We(y,["fill","stroke"]);var D=ie(P,_,y),B=i.getScaledPath("GATEWAY_PARALLEL",{xScaleFactor:.6,yScaleFactor:.6,containerWidth:_.width,containerHeight:_.height,position:{mx:.46,my:.2}});return x(P,B,{fill:oe(_,c,y.stroke),stroke:oe(_,c,y.stroke),strokeWidth:1}),D},"bpmn:Participant":function(P,_,y={}){y=We(y,["fill","stroke","width","height"]);var D=z(P,_,y),B=$e(_),W=qt(_),le=Z(_),Me=le.get("name");if(B){var Ye=W?[{x:30,y:0},{x:30,y:An(_,y)}]:[{x:0,y:30},{x:Wn(_,y),y:30}];w(P,Ye,{stroke:oe(_,c,y.stroke),strokeWidth:AS}),q(P,Me,_,y)}else{var ft=ra(_,y);W||(ft.height=Wn(_,y),ft.width=An(_,y));var it=he(P,Me,{box:ft,align:"center-middle",style:{fill:ia(_,u,c,y.stroke)}});if(!W){var Nt=-1*An(_,y);Ps(it,0,-Nt,270)}}return le.get("participantMultiplicity")&&$("ParticipantMultiplicityMarker",P,_,y),D},"bpmn:ReceiveTask":function(P,_,y={}){y=We(y,["fill","stroke"]);var D=Z(_),B=Oe(P,_,y),W;return D.get("instantiate")?(m(P,28,28,20*.22,{fill:Be(_,s,y.fill),stroke:oe(_,c,y.stroke),strokeWidth:1}),W=i.getScaledPath("TASK_TYPE_INSTANTIATING_SEND",{abspos:{x:7.77,y:9.52}})):W=i.getScaledPath("TASK_TYPE_SEND",{xScaleFactor:.9,yScaleFactor:.9,containerWidth:21,containerHeight:14,position:{mx:.3,my:.4}}),x(P,W,{fill:Be(_,s,y.fill),stroke:oe(_,c,y.stroke),strokeWidth:1}),B},"bpmn:ScriptTask":function(P,_,y={}){y=We(y,["fill","stroke"]);var D=Oe(P,_,y),B=i.getScaledPath("TASK_TYPE_SCRIPT",{abspos:{x:15,y:20}});return x(P,B,{fill:Be(_,s,y.fill),stroke:oe(_,c,y.stroke),strokeWidth:1}),D},"bpmn:SendTask":function(P,_,y={}){y=We(y,["fill","stroke"]);var D=Oe(P,_,y),B=i.getScaledPath("TASK_TYPE_SEND",{xScaleFactor:1,yScaleFactor:1,containerWidth:21,containerHeight:14,position:{mx:.285,my:.357}});return x(P,B,{fill:oe(_,c,y.stroke),stroke:Be(_,s,y.fill),strokeWidth:1}),D},"bpmn:SequenceFlow":function(P,_,y={}){y=We(y,["fill","stroke"]);var D=Be(_,s,y.fill),B=oe(_,c,y.stroke),W=b(P,_.waypoints,{markerEnd:d(P,"sequenceflow-end",D,B),stroke:B}),le=Z(_),{source:Me}=_;if(Me){var Ye=Z(Me);le.get("conditionExpression")&&v(Ye,"bpmn:Activity")&&se(W,{markerStart:d(P,"conditional-flow-marker",D,B)}),Ye.get("default")&&(v(Ye,"bpmn:Gateway")||v(Ye,"bpmn:Activity"))&&Ye.get("default")===le&&se(W,{markerStart:d(P,"conditional-default-flow-marker",D,B)})}return W},"bpmn:ServiceTask":function(P,_,y={}){y=We(y,["fill","stroke"]);var D=Oe(P,_,y);m(P,10,10,{fill:Be(_,s,y.fill),stroke:"none",transform:"translate(6, 6)"});var B=i.getScaledPath("TASK_TYPE_SERVICE",{abspos:{x:12,y:18}});x(P,B,{fill:Be(_,s,y.fill),stroke:oe(_,c,y.stroke),strokeWidth:1}),m(P,10,10,{fill:Be(_,s,y.fill),stroke:"none",transform:"translate(11, 10)"});var W=i.getScaledPath("TASK_TYPE_SERVICE",{abspos:{x:17,y:22}});return x(P,W,{fill:Be(_,s,y.fill),stroke:oe(_,c,y.stroke),strokeWidth:1}),D},"bpmn:StartEvent":function(P,_,y={}){var{renderIcon:D=!0}=y;y=We(y,["fill","stroke"]);var B=Z(_);B.get("isInterrupting")||(y={...y,strokeDasharray:"6"});var W=fe(P,_,y);return D&&H(_,P,y),W},"bpmn:SubProcess":function(P,_,y={}){return $e(_)?y=We(y,["fill","stroke","width","height"]):y=We(y,["fill","stroke"]),F(P,_,y)},"bpmn:Task":function(P,_,y={}){return y=We(y,["fill","stroke"]),Oe(P,_,y)},"bpmn:TextAnnotation":function(P,_,y={}){y=We(y,["fill","stroke"]);var{width:D,height:B}=ra(_,y),W=g(P,D,B,0,0,{fill:"none",stroke:"none"}),le=i.getScaledPath("TEXT_ANNOTATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:D,containerHeight:B,position:{mx:0,my:0}});x(P,le,{stroke:oe(_,c,y.stroke)});var Me=Z(_),Ye=Me.get("text")||"";return he(P,Ye,{align:"left-top",box:ra(_,y),padding:fo,style:{fill:ia(_,u,c,y.stroke)}}),W},"bpmn:Transaction":function(P,_,y={}){$e(_)?y=We(y,["fill","stroke","width","height"]):y=We(y,["fill","stroke"]);var D=F(P,_,{strokeWidth:1.5,...y}),B=n.style(["no-fill","no-events"],{stroke:oe(_,c,y.stroke),strokeWidth:1.5}),W=$e(_);return W||(y={}),g(P,Wn(_,y),An(_,y),Ds-ks,ks,B),D},"bpmn:UserTask":function(P,_,y={}){y=We(y,["fill","stroke"]);var D=Oe(P,_,y),B=15,W=12,le=i.getScaledPath("TASK_TYPE_USER_1",{abspos:{x:B,y:W}});x(P,le,{fill:Be(_,s,y.fill),stroke:oe(_,c,y.stroke),strokeWidth:.5});var Me=i.getScaledPath("TASK_TYPE_USER_2",{abspos:{x:B,y:W}});x(P,Me,{fill:Be(_,s,y.fill),stroke:oe(_,c,y.stroke),strokeWidth:.5});var Ye=i.getScaledPath("TASK_TYPE_USER_3",{abspos:{x:B,y:W}});return x(P,Ye,{fill:oe(_,c,y.stroke),stroke:oe(_,c,y.stroke),strokeWidth:.5}),D},label:function(P,_,y={}){return pt(P,_,y)}};this._drawPath=x,this._renderer=M}ae(Br,Ai),Br.$inject=["config.bpmnRenderer","eventBus","styles","pathMap","canvas","textRenderer"],Br.prototype.canRender=function(e){return v(e,"bpmn:BaseElement")},Br.prototype.drawShape=function(e,t,n={}){var{type:i}=t,r=this._renderer(i);return r(e,t,n)},Br.prototype.drawConnection=function(e,t,n={}){var{type:i}=t,r=this._renderer(i);return r(e,t,n)},Br.prototype.getShapePath=function(e){return De(e)?ml(e,TS):v(e,"bpmn:Event")?dm(e):v(e,"bpmn:Activity")?ml(e,Ds):v(e,"bpmn:Gateway")?SS(e):RS(e)};function We(e,t=[]){return t.reduce((n,i)=>(e[i]&&(n[i]=e[i]),n),{})}var DS=0,OS={width:150,height:50};function LS(e){var t=e.split("-");return{horizontal:t[0]||"center",vertical:t[1]||"top"}}function IS(e){return Ut(e)?L({top:0,left:0,right:0,bottom:0},e):{top:e,left:e,right:e,bottom:e}}var gl=null;function NS(){return gl||(gl=document.createElement("canvas").getContext("2d")),gl}function BS(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(hm(e.fontSize)||"12px"),t.push(e.fontFamily||"sans-serif"),t.join(" ")}function hm(e){if(e!=null)return typeof e=="number"||/^-?\d+(\.\d+)?$/.test(e)?e+"px":e}function $S(e,t){var n=NS();if(!n)return{width:0,height:0};n.font=BS(t),"letterSpacing"in n&&(n.letterSpacing=hm(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 jS(e,t,n){for(var i=e.shift(),r=i,o;;){if(o=$S(r,n),o.width=r?o.width:0,r===" "||r===""||o.width<Math.round(t)||r.length<2)return FS(e,r,i,o);r=zS(r,o.width,t)}}function FS(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 mm="­";function HS(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===mm)&&r.pop();break}var a=r[r.length-1];return a&&a===mm&&(r[r.length-1]="-"),r.join("")}function zS(e,t,n){var i=Math.max(e.length*(n/t),1),r=HS(e,i);return r||(r=e.slice(0,Math.max(Math.round(i-1),1))),r}function Os(e){this._config=L({},{size:OS,padding:DS,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=L({},this._config.size,t.box),i=L({},this._config.style,t.style),r=LS(t.align||this._config.align),o=IS(t.padding!==void 0?t.padding:this._config.padding),a=t.fitBox||!1,s=VS(i),c=e.split(/\u00AD?\r?\n/),u=[],l=n.width-o.left-o.right;c.length;)u.push(jS(c,l,i));r.vertical==="middle"&&(o.top=o.bottom=0);var f=Sn(u,function(g,R,w){return g+(s||R.height)},0)+o.top+o.bottom,p=Sn(u,function(g,R,w){return R.width>g?R.width:g},0),d=o.top;r.vertical==="middle"&&(d+=(n.height-f)/2),d-=(s||u[0].height)/4;var h=ye("text");se(h,i),k(u,function(g){var R;switch(d+=s||g.height,r.horizontal){case"left":R=o.left;break;case"right":R=(a?p:l)-o.right-g.width;break;default:R=Math.max(((a?p:l)-g.width)/2+o.left,0)}var w=ye("tspan");se(w,{x:R,y:d}),w.textContent=g.text,Ae(h,w)});var m={width:p,height:f};return{dimensions:m,element:h}};function VS(e){if("fontSize"in e&&"lineHeight"in e)return e.lineHeight*parseInt(e.fontSize,10)}var GS=12,WS=1.2,US=40;function gm(e){var t=L({fontFamily:"Arial, sans-serif",fontSize:GS,fontWeight:"normal",lineHeight:WS},e&&e.defaultStyle||{}),n=parseInt(t.fontSize,10)-1,i=L({},t,{fontSize:n},e&&e.externalStyle||{}),r=new Os({style:t});this.getExternalLabelBounds=function(a,s){var c={width:Math.max(a.width,Nr.width),height:30},u=o(s,c,{style:i});return{x:Math.round(a.x+a.width/2-u.width/2),y:a.y,width:Math.ceil(u.width),height:Math.ceil(u.height)}},this.getTextAnnotationBounds=function(a,s){var c=o(s,a,{style:t,align:"left-top",padding:fo});return{x:a.x,y:a.y,width:a.width,height:Math.max(US,Math.round(c.height))}},this.getDimensions=function(a,s){return r.getDimensions(a,s||{})};function o(a,s,c){return r.getDimensions(a,L({box:s},c))}this.createText=function(a,s){return r.createText(a,s||{})},this.getDefaultStyle=function(){return t},this.getExternalStyle=function(){return i}}gm.$inject=["config.textRenderer"];function YS(){this.pathMap={EVENT_MESSAGE:{d:"m {mx},{my} l 0,{e.y1} l {e.x1},0 l 0,-{e.y1} z l {e.x0},{e.y0} l {e.x0},-{e.y0}",height:36,width:36,heightElements:[6,14],widthElements:[10.5,21]},EVENT_SIGNAL:{d:"M {mx},{my} l {e.x0},{e.y0} l -{e.x1},0 Z",height:36,width:36,heightElements:[18],widthElements:[10,20]},EVENT_ESCALATION:{d:"M {mx},{my} l {e.x0},{e.y0} l -{e.x0},-{e.y1} l -{e.x0},{e.y1} Z",height:36,width:36,heightElements:[20,7],widthElements:[8]},EVENT_CONDITIONAL:{d:"M {e.x0},{e.y0} l {e.x1},0 l 0,{e.y2} l -{e.x1},0 Z M {e.x2},{e.y3} l {e.x0},0 M {e.x2},{e.y4} l {e.x0},0 M {e.x2},{e.y5} l {e.x0},0 M {e.x2},{e.y6} l {e.x0},0 M {e.x2},{e.y7} l {e.x0},0 M {e.x2},{e.y8} l {e.x0},0 ",height:36,width:36,heightElements:[8.5,14.5,18,11.5,14.5,17.5,20.5,23.5,26.5],widthElements:[10.5,14.5,12.5]},EVENT_LINK:{d:"m {mx},{my} 0,{e.y0} -{e.x1},0 0,{e.y1} {e.x1},0 0,{e.y0} {e.x0},-{e.y2} -{e.x0},-{e.y2} z",height:36,width:36,heightElements:[4.4375,6.75,7.8125],widthElements:[9.84375,13.5]},EVENT_ERROR:{d:"m {mx},{my} {e.x0},-{e.y0} {e.x1},-{e.y1} {e.x2},{e.y2} {e.x3},-{e.y3} -{e.x4},{e.y4} -{e.x5},-{e.y5} z",height:36,width:36,heightElements:[.023,8.737,8.151,16.564,10.591,8.714],widthElements:[.085,6.672,6.97,4.273,5.337,6.636]},EVENT_CANCEL_45:{d:"m {mx},{my} -{e.x1},0 0,{e.x0} {e.x1},0 0,{e.y1} {e.x0},0 0,-{e.y1} {e.x1},0 0,-{e.y0} -{e.x1},0 0,-{e.y1} -{e.x0},0 z",height:36,width:36,heightElements:[4.75,8.5],widthElements:[4.75,8.5]},EVENT_COMPENSATION:{d:"m {mx},{my} {e.x0},-{e.y0} 0,{e.y1} z m {e.x1},-{e.y2} {e.x2},-{e.y3} 0,{e.y1} -{e.x2},-{e.y3} z",height:36,width:36,heightElements:[6.5,13,.4,6.1],widthElements:[9,9.3,8.7]},EVENT_TIMER_WH:{d:"M {mx},{my} l {e.x0},-{e.y0} m -{e.x0},{e.y0} l {e.x1},{e.y1} ",height:36,width:36,heightElements:[10,2],widthElements:[3,7]},EVENT_TIMER_LINE:{d:"M {mx},{my} m {e.x0},{e.y0} l -{e.x1},{e.y1} ",height:36,width:36,heightElements:[10,3],widthElements:[0,0]},EVENT_MULTIPLE:{d:"m {mx},{my} {e.x1},-{e.y0} {e.x1},{e.y0} -{e.x0},{e.y1} -{e.x2},0 z",height:36,width:36,heightElements:[6.28099,12.56199],widthElements:[3.1405,9.42149,12.56198]},EVENT_PARALLEL_MULTIPLE:{d:"m {mx},{my} {e.x0},0 0,{e.y1} {e.x1},0 0,{e.y0} -{e.x1},0 0,{e.y1} -{e.x0},0 0,-{e.y1} -{e.x1},0 0,-{e.y0} {e.x1},0 z",height:36,width:36,heightElements:[2.56228,7.68683],widthElements:[2.56228,7.68683]},GATEWAY_EXCLUSIVE:{d:"m {mx},{my} {e.x0},{e.y0} {e.x1},{e.y0} {e.x2},0 {e.x4},{e.y2} {e.x4},{e.y1} {e.x2},0 {e.x1},{e.y3} {e.x0},{e.y3} {e.x3},0 {e.x5},{e.y1} {e.x5},{e.y2} {e.x3},0 z",height:17.5,width:17.5,heightElements:[8.5,6.5312,-6.5312,-8.5],widthElements:[6.5,-6.5,3,-3,5,-5]},GATEWAY_PARALLEL:{d:"m {mx},{my} 0,{e.y1} -{e.x1},0 0,{e.y0} {e.x1},0 0,{e.y1} {e.x0},0 0,-{e.y1} {e.x1},0 0,-{e.y0} -{e.x1},0 0,-{e.y1} -{e.x0},0 z",height:30,width:30,heightElements:[5,12.5],widthElements:[5,12.5]},GATEWAY_EVENT_BASED:{d:"m {mx},{my} {e.x0},{e.y0} {e.x0},{e.y1} {e.x1},{e.y2} {e.x2},0 z",height:11,width:11,heightElements:[-6,6,12,-12],widthElements:[9,-3,-12]},GATEWAY_COMPLEX:{d:"m {mx},{my} 0,{e.y0} -{e.x0},-{e.y1} -{e.x1},{e.y2} {e.x0},{e.y1} -{e.x2},0 0,{e.y3} {e.x2},0 -{e.x0},{e.y1} l {e.x1},{e.y2} {e.x0},-{e.y1} 0,{e.y0} {e.x3},0 0,-{e.y0} {e.x0},{e.y1} {e.x1},-{e.y2} -{e.x0},-{e.y1} {e.x2},0 0,-{e.y3} -{e.x2},0 {e.x0},-{e.y1} -{e.x1},-{e.y2} -{e.x0},{e.y1} 0,-{e.y0} -{e.x3},0 z",height:17.125,width:17.125,heightElements:[4.875,3.4375,2.125,3],widthElements:[3.4375,2.125,4.875,3]},DATA_OBJECT_PATH:{d:"m 0,0 {e.x1},0 {e.x0},{e.y0} 0,{e.y1} -{e.x2},0 0,-{e.y2} {e.x1},0 0,{e.y0} {e.x0},0",height:61,width:51,heightElements:[10,50,60],widthElements:[10,40,50,60]},DATA_OBJECT_COLLECTION_PATH:{d:"m{mx},{my} m 3,2 l 0,10 m 3,-10 l 0,10 m 3,-10 l 0,10",height:10,width:10,heightElements:[],widthElements:[]},DATA_ARROW:{d:"m 5,9 9,0 0,-3 5,5 -5,5 0,-3 -9,0 z",height:61,width:51,heightElements:[],widthElements:[]},DATA_STORE:{d:"m {mx},{my} l 0,{e.y2} c {e.x0},{e.y1} {e.x1},{e.y1} {e.x2},0 l 0,-{e.y2} c -{e.x0},-{e.y1} -{e.x1},-{e.y1} -{e.x2},0c {e.x0},{e.y1} {e.x1},{e.y1} {e.x2},0 m -{e.x2},{e.y0}c {e.x0},{e.y1} {e.x1},{e.y1} {e.x2},0m -{e.x2},{e.y0}c {e.x0},{e.y1} {e.x1},{e.y1} {e.x2},0",height:61,width:61,heightElements:[7,10,45],widthElements:[2,58,60]},TEXT_ANNOTATION:{d:"m {mx}, {my} m 10,0 l -10,0 l 0,{e.y0} l 10,0",height:30,width:10,heightElements:[30],widthElements:[10]},MARKER_SUB_PROCESS:{d:"m{mx},{my} m 7,2 l 0,10 m -5,-5 l 10,0",height:10,width:10,heightElements:[],widthElements:[]},MARKER_PARALLEL:{d:"m{mx},{my} m 3,2 l 0,10 m 3,-10 l 0,10 m 3,-10 l 0,10",height:10,width:10,heightElements:[],widthElements:[]},MARKER_SEQUENTIAL:{d:"m{mx},{my} m 0,3 l 10,0 m -10,3 l 10,0 m -10,3 l 10,0",height:10,width:10,heightElements:[],widthElements:[]},MARKER_COMPENSATION:{d:"m {mx},{my} 7,-5 0,10 z m 7.1,-0.3 6.9,-4.7 0,10 -6.9,-4.7 z",height:10,width:21,heightElements:[],widthElements:[]},MARKER_LOOP:{d:"m {mx},{my} c 3.526979,0 6.386161,-2.829858 6.386161,-6.320661 0,-3.490806 -2.859182,-6.320661 -6.386161,-6.320661 -3.526978,0 -6.38616,2.829855 -6.38616,6.320661 0,1.745402 0.714797,3.325567 1.870463,4.469381 0.577834,0.571908 1.265885,1.034728 2.029916,1.35457 l -0.718163,-3.909793 m 0.718163,3.909793 -3.885211,0.802902",height:13.9,width:13.7,heightElements:[],widthElements:[]},MARKER_ADHOC:{d:"m {mx},{my} m 0.84461,2.64411 c 1.05533,-1.23780996 2.64337,-2.07882 4.29653,-1.97997996 2.05163,0.0805 3.85579,1.15803 5.76082,1.79107 1.06385,0.34139996 2.24454,0.1438 3.18759,-0.43767 0.61743,-0.33642 1.2775,-0.64078 1.7542,-1.17511 0,0.56023 0,1.12046 0,1.6807 -0.98706,0.96237996 -2.29792,1.62393996 -3.6918,1.66181996 -1.24459,0.0927 -2.46671,-0.2491 -3.59505,-0.74812 -1.35789,-0.55965 -2.75133,-1.33436996 -4.27027,-1.18121996 -1.37741,0.14601 -2.41842,1.13685996 -3.44288,1.96782996 z",height:4,width:15,heightElements:[],widthElements:[]},TASK_TYPE_SEND:{d:"m {mx},{my} l 0,{e.y1} l {e.x1},0 l 0,-{e.y1} z l {e.x0},{e.y0} l {e.x0},-{e.y0}",height:14,width:21,heightElements:[6,14],widthElements:[10.5,21]},TASK_TYPE_SCRIPT:{d:"m {mx},{my} c 9.966553,-6.27276 -8.000926,-7.91932 2.968968,-14.938 l -8.802728,0 c -10.969894,7.01868 6.997585,8.66524 -2.968967,14.938 z m -7,-12 l 5,0 m -4.5,3 l 4.5,0 m -3,3 l 5,0m -4,3 l 5,0",height:15,width:12.6,heightElements:[6,14],widthElements:[10.5,21]},TASK_TYPE_USER_1:{d:"m {mx},{my} c 0.909,-0.845 1.594,-2.049 1.594,-3.385 0,-2.554 -1.805,-4.62199999 -4.357,-4.62199999 -2.55199998,0 -4.28799998,2.06799999 -4.28799998,4.62199999 0,1.348 0.974,2.562 1.89599998,3.405 -0.52899998,0.187 -5.669,2.097 -5.794,4.7560005 v 6.718 h 17 v -6.718 c 0,-2.2980005 -5.5279996,-4.5950005 -6.0509996,-4.7760005 zm -8,6 l 0,5.5 m 11,0 l 0,-5"},TASK_TYPE_USER_2:{d:"m {mx},{my} m 2.162,1.009 c 0,2.4470005 -2.158,4.4310005 -4.821,4.4310005 -2.66499998,0 -4.822,-1.981 -4.822,-4.4310005 "},TASK_TYPE_USER_3:{d:"m {mx},{my} m -6.9,-3.80 c 0,0 2.25099998,-2.358 4.27399998,-1.177 2.024,1.181 4.221,1.537 4.124,0.965 -0.098,-0.57 -0.117,-3.79099999 -4.191,-4.13599999 -3.57499998,0.001 -4.20799998,3.36699999 -4.20699998,4.34799999 z"},TASK_TYPE_MANUAL:{d:"m {mx},{my} c 0.234,-0.01 5.604,0.008 8.029,0.004 0.808,0 1.271,-0.172 1.417,-0.752 0.227,-0.898 -0.334,-1.314 -1.338,-1.316 -2.467,-0.01 -7.886,-0.004 -8.108,-0.004 -0.014,-0.079 0.016,-0.533 0,-0.61 0.195,-0.042 8.507,0.006 9.616,0.002 0.877,-0.007 1.35,-0.438 1.353,-1.208 0.003,-0.768 -0.479,-1.09 -1.35,-1.091 -2.968,-0.002 -9.619,-0.013 -9.619,-0.013 v -0.591 c 0,0 5.052,-0.016 7.225,-0.016 0.888,-0.002 1.354,-0.416 1.351,-1.193 -0.006,-0.761 -0.492,-1.196 -1.361,-1.196 -3.473,-0.005 -10.86,-0.003 -11.0829995,-0.003 -0.022,-0.047 -0.045,-0.094 -0.069,-0.139 0.3939995,-0.319 2.0409995,-1.626 2.4149995,-2.017 0.469,-0.4870005 0.519,-1.1650005 0.162,-1.6040005 -0.414,-0.511 -0.973,-0.5 -1.48,-0.236 -1.4609995,0.764 -6.5999995,3.6430005 -7.7329995,4.2710005 -0.9,0.499 -1.516,1.253 -1.882,2.19 -0.37000002,0.95 -0.17,2.01 -0.166,2.979 0.004,0.718 -0.27300002,1.345 -0.055,2.063 0.629,2.087 2.425,3.312 4.859,3.318 4.6179995,0.014 9.2379995,-0.139 13.8569995,-0.158 0.755,-0.004 1.171,-0.301 1.182,-1.033 0.012,-0.754 -0.423,-0.969 -1.183,-0.973 -1.778,-0.01 -5.824,-0.004 -6.04,-0.004 10e-4,-0.084 0.003,-0.586 10e-4,-0.67 z"},TASK_TYPE_INSTANTIATING_SEND:{d:"m {mx},{my} l 0,8.4 l 12.6,0 l 0,-8.4 z l 6.3,3.6 l 6.3,-3.6"},TASK_TYPE_SERVICE:{d:"m {mx},{my} v -1.71335 c 0.352326,-0.0705 0.703932,-0.17838 1.047628,-0.32133 0.344416,-0.14465 0.665822,-0.32133 0.966377,-0.52145 l 1.19431,1.18005 1.567487,-1.57688 -1.195028,-1.18014 c 0.403376,-0.61394 0.683079,-1.29908 0.825447,-2.01824 l 1.622133,-0.01 v -2.2196 l -1.636514,0.01 c -0.07333,-0.35153 -0.178319,-0.70024 -0.323564,-1.04372 -0.145244,-0.34406 -0.321407,-0.6644 -0.522735,-0.96217 l 1.131035,-1.13631 -1.583305,-1.56293 -1.129598,1.13589 c -0.614052,-0.40108 -1.302883,-0.68093 -2.022633,-0.82247 l 0.0093,-1.61852 h -2.241173 l 0.0042,1.63124 c -0.353763,0.0736 -0.705369,0.17977 -1.049785,0.32371 -0.344415,0.14437 -0.665102,0.32092 -0.9635006,0.52046 l -1.1698628,-1.15823 -1.5667691,1.5792 1.1684265,1.15669 c -0.4026573,0.61283 -0.68308,1.29797 -0.8247287,2.01713 l -1.6588041,0.003 v 2.22174 l 1.6724648,-0.006 c 0.073327,0.35077 0.1797598,0.70243 0.3242851,1.04472 0.1452428,0.34448 0.3214064,0.6644 0.5227339,0.96066 l -1.1993431,1.19723 1.5840256,1.56011 1.1964668,-1.19348 c 0.6140517,0.40346 1.3028827,0.68232 2.0233517,0.82331 l 7.19e-4,1.69892 h 2.226848 z m 0.221462,-3.9957 c -1.788948,0.7502 -3.8576,-0.0928 -4.6097055,-1.87438 -0.7521065,-1.78321 0.090598,-3.84627 1.8802645,-4.59604 1.78823,-0.74936 3.856881,0.0929 4.608987,1.87437 0.752106,1.78165 -0.0906,3.84612 -1.879546,4.59605 z"},TASK_TYPE_SERVICE_FILL:{d:"m {mx},{my} c -1.788948,0.7502 -3.8576,-0.0928 -4.6097055,-1.87438 -0.7521065,-1.78321 0.090598,-3.84627 1.8802645,-4.59604 1.78823,-0.74936 3.856881,0.0929 4.608987,1.87437 0.752106,1.78165 -0.0906,3.84612 -1.879546,4.59605 z"},TASK_TYPE_BUSINESS_RULE_HEADER:{d:"m {mx},{my} 0,4 20,0 0,-4 z"},TASK_TYPE_BUSINESS_RULE_MAIN:{d:"m {mx},{my} 0,12 20,0 0,-12 zm 0,8 l 20,0 m -13,-4 l 0,8"},MESSAGE_FLOW_MARKER:{d:"m {mx},{my} m -10.5 ,-7 l 0,14 l 21,0 l 0,-14 z l 10.5,6 l 10.5,-6"}},this.getRawPath=function(t){return this.pathMap[t].d},this.getScaledPath=function(t,n){var i=this.pathMap[t],r,o;n.abspos?(r=n.abspos.x,o=n.abspos.y):(r=n.containerWidth*n.position.mx,o=n.containerHeight*n.position.my);var a={};if(n.position){for(var s=n.containerHeight/i.height*n.yScaleFactor,c=n.containerWidth/i.width*n.xScaleFactor,u=0;u<i.heightElements.length;u++)a["y"+u]=i.heightElements[u]*s;for(var l=0;l<i.widthElements.length;l++)a["x"+l]=i.widthElements[l]*c}var f=ZS(i.d,{mx:r,my:o,e:a});return f}}var qS=/\{([^{}]+)\}/g,KS=/(?:(?:^|\.)(.+?)(?=\[|\.|$|\()|\[('|")(.+?)\2\])(\(\))?/g;function XS(e,t,n){var i=n;return t.replace(KS,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 ZS(e,t){return String(e).replace(qS,function(n,i){return XS(n,i,t)})}const QS={__init__:["bpmnRenderer"],bpmnRenderer:["type",Br],textRenderer:["type",gm],pathMap:["type",YS]};function JS(e,t){return t=t||{},e.replace(/{([^}]+)}/g,function(n,i){return t[i]||"{"+i+"}"})}const oa={translate:["value",JS]};function Ls(e,t,n){return L({id:e.id,type:e.$type,businessObject:e,di:t},n)}function eR(e,t,n){var i=e.waypoint;return!i||i.length<2?[we(t),we(n)]:i.map(function(r){return{x:r.x,y:r.y}})}function ym(e,t,n){return new Error(`element ${cn(t)} referenced by ${cn(e)}#${n} not yet drawn`)}function Di(e,t,n,i,r){this._eventBus=e,this._canvas=t,this._elementFactory=n,this._elementRegistry=i,this._textRenderer=r}Di.$inject=["eventBus","canvas","elementFactory","elementRegistry","textRenderer"],Di.prototype.add=function(e,t,n){var i,r,o;if(v(t,"bpmndi:BPMNPlane")){var a=v(e,"bpmn:SubProcess")?{id:e.id+"_plane"}:{};i=this._elementFactory.createRoot(Ls(e,t,a)),this._canvas.addRootElement(i)}else if(v(t,"bpmndi:BPMNShape")){var s=!$e(e,t),c=nR(e);r=n&&(n.hidden||n.collapsed);var u=t.bounds;i=this._elementFactory.createShape(Ls(e,t,{collapsed:s,hidden:r,x:Math.round(u.x),y:Math.round(u.y),width:Math.round(u.width),height:Math.round(u.height),isFrame:c})),v(e,"bpmn:BoundaryEvent")&&this._attachBoundary(e,i),v(e,"bpmn:Lane")&&(o=0),v(e,"bpmn:DataStoreReference")&&(tR(n,we(u))||(n=this._canvas.findRoot(n))),this._canvas.addShape(i,n,o)}else if(v(t,"bpmndi:BPMNEdge")){var l=this._getSource(e),f=this._getTarget(e);r=n&&(n.hidden||n.collapsed),i=this._elementFactory.createConnection(Ls(e,t,{hidden:r,source:l,target:f,waypoints:eR(t,l,f)})),v(e,"bpmn:DataAssociation")&&(n=this._canvas.findRoot(n)),this._canvas.addConnection(i,n,o)}else throw new Error(`unknown di ${cn(t)} for element ${cn(e)}`);return rr(e)&&Hn(i)&&this.addLabel(e,t,i),this._eventBus.fire("bpmnElement.added",{element:i}),i},Di.prototype._attachBoundary=function(e,t){var n=e.attachedToRef;if(!n)throw new Error(`missing ${cn(e)}#attachedToRef`);var i=this._elementRegistry.get(n.id),r=i&&i.attachers;if(!i)throw ym(e,n,"attachedToRef");t.host=i,r||(i.attachers=r=[]),r.indexOf(t)===-1&&r.push(t)},Di.prototype.addLabel=function(e,t,n){var i,r,o;return i=yS(t,n),r=Hn(n),r&&(i=this._textRenderer.getExternalLabelBounds(i,r)),o=this._elementFactory.createLabel(Ls(e,t,{id:e.id+"_label",labelTarget:n,type:"label",hidden:n.hidden||!Hn(n),x:Math.round(i.x),y:Math.round(i.y),width:Math.round(i.width),height:Math.round(i.height)})),this._canvas.addShape(o,n.parent)},Di.prototype._getConnectedElement=function(e,t){var n,i,r=e.$type;if(i=e[t+"Ref"],t==="source"&&r==="bpmn:DataInputAssociation"&&(i=i&&i[0]),(t==="source"&&r==="bpmn:DataOutputAssociation"||t==="target"&&r==="bpmn:DataInputAssociation")&&(i=e.$parent),n=i&&this._getElement(i),n)return n;throw i?ym(e,i,t+"Ref"):new Error(`${cn(e)}#${t} Ref not specified`)},Di.prototype._getSource=function(e){return this._getConnectedElement(e,"source")},Di.prototype._getTarget=function(e){return this._getConnectedElement(e,"target")},Di.prototype._getElement=function(e){return this._elementRegistry.get(e.id)};function tR(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 nR(e){return v(e,"bpmn:Group")}const vm={__depends__:[QS,{__depends__:[oa],bpmnImporter:["type",Di]}]};function aa(e){return{x:e.x+e.width/2,y:e.y+e.height/2}}function ri(e,t){return{x:e.x-t.x,y:e.y-t.y}}function yl(e){return Math.log(e)/Math.log(10)}var iR=1e3;function X(e){this._eventBus=e}X.$inject=["eventBus"];function rR(e,t){return function(n){return e.call(t||null,n.context,n.command,n)}}X.prototype.on=function(e,t,n,i,r,o){if((Yt(t)||Ce(t))&&(o=r,r=i,i=n,n=t,t=null),Yt(n)&&(o=r,r=i,i=n,n=iR),Ut(r)&&(o=r,r=!1),!Yt(i))throw new Error("handlerFn must be a function");xe(e)||(e=[e]);var a=this._eventBus;k(e,function(s){var c=["commandStack",s,t].filter(function(u){return u}).join(".");a.on(c,n,r?rR(i,o):i,o)})},X.prototype.canExecute=Oi("canExecute"),X.prototype.preExecute=Oi("preExecute"),X.prototype.preExecuted=Oi("preExecuted"),X.prototype.execute=Oi("execute"),X.prototype.executed=Oi("executed"),X.prototype.postExecute=Oi("postExecute"),X.prototype.postExecuted=Oi("postExecuted"),X.prototype.revert=Oi("revert"),X.prototype.reverted=Oi("reverted");function Oi(e){return function(n,i,r,o,a){(Yt(n)||Ce(n))&&(a=o,o=r,r=i,i=n,n=null),this.on(n,e,i,r,o,a)}}var vl=["top","bottom","left","right"],Is=10;function _l(e,t){X.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(Ms(r)&&!ot(r)){var o=sR(r);o&&i(r,o)}}function i(r,o){var a=we(r),s=r.label,c=we(s);if(s.parent){var u=ve(r),l;switch(o){case"top":l={x:a.x,y:u.top-Is-s.height/2};break;case"left":l={x:u.left-Is-s.width/2,y:a.y};break;case"bottom":l={x:a.x,y:u.bottom+Is+s.height/2};break;case"right":l={x:u.right+Is+s.width/2,y:a.y};break}var f=ri(l,c);t.moveShape(s,f)}}}ae(_l,X),_l.$inject=["eventBus","modeling"];function oR(e){var t=e.host,n=we(e),i=Qt(n,t),r;i.indexOf("-")>=0?r=i.split("-"):r=[i];var o=vl.filter(function(a){return r.indexOf(a)===-1});return o}function aR(e){var t=we(e),n=[].concat(e.incoming.map(function(i){return i.waypoints[i.waypoints.length-2]}),e.outgoing.map(function(i){return i.waypoints[1]})).map(function(i){return _m(t,i)});return n}function sR(e){var t=we(e.label),n=we(e),i=_m(n,t);if(cR(i)){var r=aR(e);if(e.host){var o=oR(e);r=r.concat(o)}var a=vl.filter(function(s){return r.indexOf(s)===-1});return a.indexOf(i)!==-1?Qt(e.label,e)!=="intersect"?void 0:i:a[0]}}function _m(e,t){return Qt(t,e,5)}function cR(e){return vl.indexOf(e)!==-1}function bl(e){X.call(this,e),this.preExecute("shape.append",function(t){var n=t.source,i=t.shape;t.position||(v(i,"bpmn:TextAnnotation")?t.position={x:n.x+n.width/2+75,y:n.y-50-i.height/2}:t.position={x:n.x+n.width+80+i.width/2,y:n.y+n.height/2})},!0)}ae(bl,X),bl.$inject=["eventBus"];var uR=1500;function xl(e,t,n){e.invoke(X,this),this.preExecute("elements.delete",uR,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=Ie(r,u=>v(u,"bpmn:Participant")||v(u,"bpmn:SubProcess"));if(!o.length)return[];var a=n.getRootElement(),s=new Set(a.children.filter(u=>v(u,"bpmn:Artifact"))),c=new Set;return k(o,u=>{const l=new Set(Qr(so(Array.from(s),Tt(u))));c=c.union(l),s=s.difference(l)}),Array.from(c)}}ae(xl,X),xl.$inject=["injector","eventBus","canvas"];function wl(e,t){e.invoke(X,this),this.postExecute("shape.move",function(n){var i=n.newParent,r=n.shape,o=Ie(r.incoming.concat(r.outgoing),function(a){return v(a,"bpmn:Association")});k(o,function(a){t.moveConnection(a,{x:0,y:0},i)})},!0)}ae(wl,X),wl.$inject=["injector","modeling"];function mo(e,t){for(wn(t)&&(t=[t]);e=e.parent;)if(Le(e,t))return e;return null}function bm(e,t){var n=mo(e,"bpmn:Process");if(n)return!0;var i=["bpmn:Participant","bpmn:Lane"];if(n=mo(e,i),n)return qt(n);if(Le(e,i))return qt(e);var r;for(r=Z(e);r&&!v(r,"bpmn:Process");r=r.$parent);if(!t)return!0;var o=t.find(function(a){var s=Z(a);return s&&s.get("processRef")===r});return o?qt(o):!0}var xm=500;function Ns(e,t){t.invoke(X,this),this._bpmnReplace=e;var n=this;this.postExecuted("elements.create",xm,function(i){var r=i.elements;r=r.filter(function(o){var a=o.host;return wm(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",xm,function(i){var r=i.shapes,o=i.newHost;if(r.length===1){var a=r[0];wm(a,o)&&(i.shapes=[n._replaceShape(a,o)])}},!0)}Ns.$inject=["bpmnReplace","injector"],ae(Ns,X),Ns.prototype._replaceShape=function(e,t){var n=lR(e),i={type:"bpmn:BoundaryEvent",host:t};return n&&(i.eventDefinitionType=n.$type),this._bpmnReplace.replaceElement(e,i,{layoutConnection:!1})};function lR(e){var t=Z(e),n=t.eventDefinitions;return n&&n[0]}function wm(e,t){return!De(e)&&Le(e,["bpmn:IntermediateThrowEvent","bpmn:IntermediateCatchEvent"])&&!!t}function El(e,t){X.call(this,e);function n(i){return Ie(i.attachers,function(r){return v(r,"bpmn:BoundaryEvent")})}this.postExecute("connection.create",function(i){var r=i.context.source,o=i.context.target,a=n(o);v(r,"bpmn:EventBasedGateway")&&v(o,"bpmn:ReceiveTask")&&a.length>0&&t.removeElements(a)}),this.postExecute("connection.reconnect",function(i){var r=i.context.oldSource,o=i.context.newSource;v(r,"bpmn:Gateway")&&v(o,"bpmn:EventBasedGateway")&&k(o.outgoing,function(a){var s=a.target,c=n(s);v(s,"bpmn:ReceiveTask")&&c.length>0&&t.removeElements(c)})})}El.$inject=["eventBus","modeling"],ae(El,X);function Em(e){return e.create("bpmn:Category")}function pR(e){return e.create("bpmn:CategoryValue")}function Sm(e,t){var n=t.get("categoryValueRef");return n||(n=t.categoryValueRef=pR(e)),n.$parent||(n.$parent=Em(e)),n}function fR(e,t,n){return Rt(t.get("categoryValue"),e),e.$parent=t,Rt(n.get("rootElements"),t),t.$parent=n,e}function dR(e){var t=e.$parent;return t&&(Et(t.get("categoryValue"),e),e.$parent=null),e}function hR(e){var t=e.$parent;return t&&(Et(t.get("rootElements"),e),e.$parent=null),e}var mR=500;function Sl(e,t,n){n.invoke(X,this);function i(c){return t.filter(function(u){return v(u,"bpmn:Group")&&!u.labelTarget}).map(Z).filter(function(u){return u!==c})}function r(c,u){return i(u).some(function(l){return l.get("categoryValueRef")===c})}function o(c,u){return i(u).some(function(l){var f=l.get("categoryValueRef");return f&&f.$parent===c})}function a(c,u){c&&u&&fR(c,u,e.getDefinitions())}function s(c,u,l){u&&!o(u,l)&&hR(u),c&&!r(c,l)&&dR(c)}this.executed(["shape.create","label.create"],function(c){var u=c.labelTarget||c.shape;!v(u,"bpmn:Group")||u.labelTarget||a(c.categoryValue,c.category)},!0),this.reverted(["shape.create","label.create"],function(c){var u=c.labelTarget||c.shape;!v(u,"bpmn:Group")||u.labelTarget||s(c.categoryValue,c.category,Z(u))},!0),this.executed(["shape.move","shape.resize"],mR,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,Z(u))},!0),this.executed("group.updateRefs",function(c){Rm(c).forEach(function(u){a(u.categoryValue,u.category)})},!0),this.reverted("group.updateRefs",function(c){Rm(c).forEach(function(u){s(u.categoryValue,u.category,Z(u.groupShape))})},!0),this.executed("shape.delete",function(c){var u=c.shape;!v(u,"bpmn:Group")||u.labelTarget||s(c.categoryValue,c.category,Z(u))},!0),this.reverted("shape.delete",function(c){var u=c.shape;!v(u,"bpmn:Group")||u.labelTarget||a(c.categoryValue,c.category)},!0)}Sl.$inject=["bpmnjs","elementRegistry","injector"],ae(Sl,X);function Rm(e){var t;return((t=e.updates)==null?void 0:t.groups)||[]}function Rl(e,t,n){X.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 R=g.source,w=g.target;go(R)&&sa(w)&&l(w)}function r(g){const R=g.connection,w=g.source,b=g.target;go(w)&&Bs(b)&&(u(b),p(w,[R]))}function o(g){const R=g.newTarget,w=g.oldSource,b=g.oldTarget;if(b!==R){const x=w;sa(b)&&l(b),go(x)&&Bs(R)&&u(R)}}function a(g){const{element:R}=g;sa(R)?(f(R),d(R)):Bs(R)&&h(R)}function s(g){const{newData:R,oldShape:w}=g;if(go(g.oldShape)&&R.eventDefinitionType!=="bpmn:CompensateEventDefinition"||R.type!=="bpmn:BoundaryEvent"){const b=w.outgoing.find(({target:x})=>sa(x));b&&b.target&&(g._connectionTarget=b.target)}else if(!go(g.oldShape)&&R.eventDefinitionType==="bpmn:CompensateEventDefinition"&&R.type==="bpmn:BoundaryEvent"){const b=w.outgoing.find(({target:x})=>Bs(x));b&&b.target&&(g._connectionTarget=b.target),m(w)}}function c(g){const{_connectionTarget:R,newShape:w}=g;R&&t.connect(w,R)}function u(g){t.updateProperties(g,{isForCompensation:!0})}function l(g){t.updateProperties(g,{isForCompensation:void 0})}function f(g){for(const R of g.incoming)n.canConnect(R.source,g)||t.removeConnection(R);for(const R of g.outgoing)n.canConnect(g,R.target)||t.removeConnection(R)}function p(g,R){g.outgoing.filter(x=>v(x,"bpmn:Association")).filter(x=>sa(x.target)&&!R.includes(x)).forEach(x=>t.removeConnection(x))}function d(g){const R=g.attachers.slice();R.length&&t.removeElements(R)}function h(g){const R=g.incoming.filter(w=>go(w.source));t.removeElements(R)}function m(g){const R=g.outgoing.filter(w=>v(w,"bpmn:SequenceFlow"));t.removeElements(R)}}ae(Rl,X),Rl.$inject=["eventBus","modeling","bpmnRules"];function sa(e){const t=Z(e);return t&&t.get("isForCompensation")}function go(e){return e&&v(e,"bpmn:BoundaryEvent")&&po(e,"bpmn:CompensateEventDefinition")}function Bs(e){return e&&v(e,"bpmn:Activity")&&!un(e)}function Cl(e){e.invoke(X,this),this.preExecute("shape.create",1500,function(t){var n=t.context,i=n.parent,r=n.shape;v(i,"bpmn:Lane")&&!v(r,"bpmn:Lane")&&(n.parent=mo(i,"bpmn:Participant"))})}Cl.$inject=["injector"],ae(Cl,X);function Pl(e,t){X.call(this,e),this.preExecute("shape.create",function(n){var a;var i=n.context,r=i.shape;if(v(r,"bpmn:DataObjectReference")&&r.type!=="label"){var o=t.create("bpmn:DataObject");o.isCollection=((a=r.businessObject.dataObjectRef)==null?void 0:a.isCollection)||!1,r.businessObject.dataObjectRef=o}})}Pl.$inject=["eventBus","bpmnFactory"],ae(Pl,X);var Al=20,Tl=20,Cm=30,$s=2e3;function Ml(e,t,n){X.call(this,t),t.on(["create.start","shape.move.start"],$s,function(r){var o=r.context,a=o.shape,s=e.getRootElement();if(!(!v(a,"bpmn:Participant")||!v(s,"bpmn:Process")||!s.children.length)){var c=s.children.filter(function(f){return!v(f,"bpmn:Group")&&!De(f)&&!ot(f)});if(c.length){var u=Tt(c),l=gR(a,u);L(a,l),o.createConstraints=yR(a,u)}}}),t.on("create.start",$s,function(r){var o=r.context,a=o.shape,s=e.getRootElement(),c=e.getGraphics(s);function u(l){l.element=s,l.gfx=c}v(a,"bpmn:Participant")&&v(s,"bpmn:Process")&&(t.on("element.hover",$s,u),t.once("create.cleanup",function(){t.off("element.hover",u)}))});function i(){var r=e.getRootElement();return v(r,"bpmn:Collaboration")?r:n.makeCollaboration()}this.preExecute("elements.create",$s,function(r){var o=r.elements,a=r.parent,s=vR(o),c;s&&v(a,"bpmn:Process")&&(r.parent=i(),c=r.hints=r.hints||{},c.participant=s,c.process=a,c.processRef=Z(s).get("processRef"))},!0),this.preExecute("shape.create",function(r){var o=r.parent,a=r.shape;v(a,"bpmn:Participant")&&v(o,"bpmn:Process")&&(r.parent=i(),r.process=o,r.processRef=Z(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)&&Z(s).set("processRef",Z(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)&&Z(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)}Ml.$inject=["canvas","eventBus","modeling"],ae(Ml,X);function gR(e,t){t={width:t.width+Al*2+Cm,height:t.height+Tl*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 yR(e,t){return t=ve(t),{bottom:t.top+e.height/2-Tl,left:t.right-e.width/2+Al,top:t.bottom-e.height/2+Tl,right:t.left+e.width/2-Al-Cm}}function vR(e){return ut(e,function(t){return v(t,"bpmn:Participant")})}var Pm="__targetRef_placeholder";function kl(e,t){X.call(this,e),this.executed(["connection.create","connection.delete","connection.move","connection.reconnect"],Am(o)),this.reverted(["connection.create","connection.delete","connection.move","connection.reconnect"],Am(o));function n(a,s,c){var u=a.get("dataInputAssociations");return ut(u,function(l){return l!==c&&l.targetRef===s})}function i(a,s){var c=a.get("properties"),u=ut(c,function(l){return l.name===Pm});return!u&&s&&(u=t.create("bpmn:Property",{name:Pm}),Rt(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,f=l&&l.businessObject,p=s.newTarget,d=p&&p.businessObject,h=s.oldTarget||s.target,m=h&&h.businessObject,g=c.businessObject,R;m&&m!==f&&r(m,u),d&&d!==f&&r(d,u),f?(R=i(f,!0),g.targetRef=R):g.targetRef=null}}kl.$inject=["eventBus","bpmnFactory"],ae(kl,X);function Am(e){return function(t){var n=t.context,i=n.connection;if(v(i,"bpmn:DataInputAssociation"))return e(t)}}function js(e){this._bpmnUpdater=e}js.$inject=["bpmnUpdater"],js.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),[]},js.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 Dl(e,t,n,i){X.call(this,i),t.registerHandler("dataStore.updateContainment",js);function r(){return n.filter(function(s){return v(s,"bpmn:Participant")&&Z(s).processRef})[0]}function o(s){return s.children.filter(function(c){return v(c,"bpmn:DataStoreReference")&&!c.labelTarget})}function a(s,c){var u=s.businessObject||s;if(c=c||r(),c){var l=c.businessObject||c;t.execute("dataStore.updateContainment",{dataStoreBo:u,dataStoreDi:Ge(s),newSemanticParent:l.processRef||l,newDiParent:Ge(c)})}}this.preExecute("shape.create",function(s){var c=s.context,u=c.shape;v(u,"bpmn:DataStoreReference")&&u.type!=="label"&&(c.hints||(c.hints={}),c.hints.autoResize=!1)}),this.preExecute("elements.move",function(s){var c=s.context,u=c.shapes,l=u.filter(function(f){return v(f,"bpmn:DataStoreReference")});l.length&&(c.hints||(c.hints={}),c.hints.autoResize=u.filter(function(f){return!v(f,"bpmn:DataStoreReference")}))}),this.postExecute("shape.create",function(s){var c=s.context,u=c.shape,l=u.parent;v(u,"bpmn:DataStoreReference")&&u.type!=="label"&&v(l,"bpmn:Collaboration")&&a(u)}),this.postExecute("shape.move",function(s){var c=s.context,u=c.shape,l=c.oldParent,f=u.parent;if(!v(l,"bpmn:Collaboration")&&v(u,"bpmn:DataStoreReference")&&u.type!=="label"&&v(f,"bpmn:Collaboration")){var p=v(l,"bpmn:Participant")?l:bR(l,"bpmn:Participant");a(u,p)}}),this.postExecute("shape.delete",function(s){var c=s.context,u=c.shape,l=e.getRootElement();Le(u,["bpmn:Participant","bpmn:SubProcess"])&&v(l,"bpmn:Collaboration")&&o(l).filter(function(f){return _R(f,u)}).forEach(function(f){a(f)})}),this.postExecute("canvas.updateRoot",function(s){var c=s.context,u=c.oldRoot,l=c.newRoot,f=o(u);f.forEach(function(p){v(l,"bpmn:Process")&&a(p,l)})})}Dl.$inject=["canvas","commandStack","elementRegistry","eventBus"],ae(Dl,X);function _R(e,t){for(var n=e.businessObject||e,i=t.businessObject||t;n.$parent;){if(n.$parent===i.processRef||i)return!0;n=n.$parent}return!1}function bR(e,t){for(;e.parent;){if(v(e.parent,t))return e.parent;e=e.parent}}var Fs=Math.max,Hs=Math.min,xR=20;function Tm(e,t){return{top:e.top-t.top,right:e.right-t.right,bottom:e.bottom-t.bottom,left:e.left-t.left}}function wR(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 ER(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 zs(e,t,n){var i=t[e],r=n.min&&n.min[e],o=n.max&&n.max[e];return Ce(r)&&(i=(/top|left/.test(e)?Hs:Fs)(i,r)),Ce(o)&&(i=(/top|left/.test(e)?Fs:Hs)(i,o)),i}function SR(e,t){if(!t)return e;var n=ve(e);return Ss({top:zs("top",n,t),right:zs("right",n,t),bottom:zs("bottom",n,t),left:zs("left",n,t)})}function RR(e,t,n,i){var r=ve(t),o={top:/n/.test(e)?r.bottom-n.height:r.top,left:/w/.test(e)?r.right-n.width:r.left,bottom:/s/.test(e)?r.top+n.height:r.bottom,right:/e/.test(e)?r.left+n.width:r.right},a=i?ve(i):o,s={top:Hs(o.top,a.top),left:Hs(o.left,a.left),bottom:Fs(o.bottom,a.bottom),right:Fs(o.right,a.right)};return Ss(s)}function ca(e,t){return typeof e<"u"?e:xR}function CR(e,t){var n,i,r,o;return typeof t=="object"?(n=ca(t.left),i=ca(t.right),r=ca(t.top),o=ca(t.bottom)):n=i=r=o=ca(t),{x:e.x-n,y:e.y-r,width:e.width+n+i,height:e.height+r+o}}function PR(e){return!(e.waypoints||e.type==="label")}function Mm(e,t){var n;if(e.length===void 0?n=Ie(e.children,PR):n=e,n.length)return CR(Tt(n),t)}var or=Math.abs;function AR(e,t){return Tm(ve(t),ve(e))}var TR=["bpmn:Participant","bpmn:Process","bpmn:SubProcess"],Un=30;function Vs(e,t){return t=t||[],e.children.filter(function(n){v(n,"bpmn:Lane")&&(Vs(n,t),t.push(n))}),t}function ar(e){return e.children.filter(function(t){return v(t,"bpmn:Lane")})}function Yn(e){return mo(e,TR)||e}function MR(e,t){var n=Yn(e),i=v(n,"bpmn:Process")?[]:[n],r=Vs(n,i),o=ve(e),a=ve(t),s=AR(e,t),c=[],u=qt(e);return r.forEach(function(l){if(l!==e){var f=u?0:s.top,p=u?s.right:0,d=u?0:s.bottom,h=u?s.left:0,m=ve(l);s.top&&(or(m.bottom-o.top)<10&&(d=a.top-m.bottom),or(m.top-o.top)<5&&(f=a.top-m.top)),s.left&&(or(m.right-o.left)<10&&(p=a.left-m.right),or(m.left-o.left)<5&&(h=a.left-m.left)),s.bottom&&(or(m.top-o.bottom)<10&&(f=a.bottom-m.top),or(m.bottom-o.bottom)<5&&(d=a.bottom-m.bottom)),s.right&&(or(m.left-o.right)<10&&(h=a.right-m.left),or(m.right-o.right)<5&&(p=a.right-m.right)),(f||p||d||h)&&c.push({shape:l,newBounds:ER(l,{top:f,right:p,bottom:d,left:h})})}}),c}var kR=500;function Ol(e,t){X.call(this,e);function n(i,r){var o=qt(i),a=ar(r),s=[],c=[],u=[],l=[];if(Lr(a,function(g){return o?g.y>i.y?c.push(g):s.push(g):g.x>i.x?l.push(g):u.push(g),g.children}),!!a.length){var f;o?c.length&&s.length?f=i.height/2:f=i.height:l.length&&u.length?f=i.width/2:f=i.width;var p,d,h,m;s.length&&(p=t.calculateAdjustments(s,"y",f,i.y-10),t.makeSpace(p.movingShapes,p.resizingShapes,{x:0,y:f},"s")),c.length&&(d=t.calculateAdjustments(c,"y",-f,i.y+i.height+10),t.makeSpace(d.movingShapes,d.resizingShapes,{x:0,y:-f},"n")),u.length&&(h=t.calculateAdjustments(u,"x",f,i.x-10),t.makeSpace(h.movingShapes,h.resizingShapes,{x:f,y:0},"e")),l.length&&(m=t.calculateAdjustments(l,"x",-f,i.x+i.width+10),t.makeSpace(m.movingShapes,m.resizingShapes,{x:-f,y:0},"w"))}}this.postExecuted("shape.delete",kR,function(i){var r=i.context,o=r.hints,a=r.shape,s=r.oldParent;v(a,"bpmn:Lane")&&(o&&o.nested||n(a,s))})}Ol.$inject=["eventBus","spaceTool"],ae(Ol,X);var km=500;function Gs(e,t){t.invoke(X,this),this._bpmnReplace=e;var n=this;this.postExecuted("elements.create",km,function(i){var r=i.elements;r.filter(function(o){var a=o.host;return Dm(o,a)}).map(function(o){return r.indexOf(o)}).forEach(function(o){i.elements[o]=n._replaceShape(r[o])})},!0),this.preExecute("elements.move",km,function(i){var r=i.shapes,o=i.newHost;r.forEach(function(a,s){var c=a.host;Dm(a,OR(r,c)?c:o)&&(r[s]=n._replaceShape(a))})},!0)}Gs.$inject=["bpmnReplace","injector"],ae(Gs,X),Gs.prototype._replaceShape=function(e){var t=DR(e),n;return t?n={type:"bpmn:IntermediateCatchEvent",eventDefinitionType:t.$type}:n={type:"bpmn:IntermediateThrowEvent"},this._bpmnReplace.replaceElement(e,n,{layoutConnection:!1})};function DR(e){var t=Z(e),n=t.eventDefinitions;return n&&n[0]}function Dm(e,t){return!De(e)&&v(e,"bpmn:BoundaryEvent")&&!t}function OR(e,t){return e.indexOf(t)!==-1}var Ws=Math.round,LR=Math.max;function IR(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 NR(e){var t=[];return e.forEach(function(n,i){t.push([i===0?"M":"L",n.x,n.y])}),t}var Om=10;function BR(e,t){var n,i;for(n=0;i=e[n];n++)if(Qo(i,t)<=Om)return{point:e[n],bendpoint:!0,index:n};return null}function $R(e,t){var n=$h(IR(t,Om),NR(e)),i=n[0],r=n[n.length-1],o;return i?i!==r?i.segment2!==r.segment2?(o=LR(i.segment2,r.segment2)-1,{point:e[o],bendpoint:!0,index:o}):{point:{x:Ws(i.x+r.x)/2,y:Ws(i.y+r.y)/2},index:i.segment2}:{point:{x:Ws(i.x),y:Ws(i.y)},index:i.segment2}:null}function Ll(e,t){return BR(e,t)||$R(e,t)}function Il(e,t,n){X.call(this,e);function i(r,o,a){var s=o.waypoints,c,u,l,f,p,d,h,m=r.outgoing.slice(),g=r.incoming.slice(),R;Ce(a.width)?R=we(a):R=a;var w=Ll(s,R);if(w){if(c=s.slice(0,w.index),u=s.slice(w.index+(w.bendpoint?1:0)),!c.length||!u.length)return;l=w.bendpoint?s[w.index]:R,(c.length===1||!Lm(r,c[c.length-1]))&&c.push(Im(l)),(u.length===1||!Lm(r,u[0]))&&u.unshift(Im(l))}f=o.source,p=o.target,t.canConnect(f,r,o)&&(n.reconnectEnd(o,r,c||R),d=o),t.canConnect(r,p,o)&&(d?h=n.connect(r,p,{type:o.type,waypoints:u}):(n.reconnectStart(o,r,u||R),h=o));var b=[].concat(d&&Ie(g,function(x){return x.source===d.source})||[],h&&Ie(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=we(c),l={x:u.x+s.x,y:u.y+s.y},f=ut(o.children,function(p){var d=t.canInsert(a,p);return d&&Ll(p.waypoints,l)});f&&(r.targetFlow=f,r.position=l)}},!0),this.postExecuted("elements.move",function(r){var o=r.shapes,a=r.targetFlow,s=r.position;a&&i(o[0],a,s)},!0),this.preExecute("shape.create",function(r){var o=r.parent,a=r.shape;t.canInsert(a,o)&&(r.targetFlow=o,r.parent=o.parent)},!0),this.postExecuted("shape.create",function(r){var o=r.shape,a=r.targetFlow,s=r.position;a&&i(o,a,s)},!0)}ae(Il,X),Il.$inject=["eventBus","bpmnRules","modeling"];function Lm(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 Im(e){return L({},e)}function Nl(e,t){X.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)&&yo(r)){var c=[];v(o,"bpmn:EventBasedGateway")?c=a.incoming.filter(u=>u!==r&&yo(u)):c=a.incoming.filter(u=>u!==r&&yo(u)&&v(u.source,"bpmn:EventBasedGateway")),c.forEach(function(u){t.removeConnection(u)})}}),this.preExecuted("shape.replace",function(n){var i=n.context,r=i.newShape;if(v(r,"bpmn:EventBasedGateway")){var o=r.outgoing.filter(yo).reduce(function(a,s){return a.includes(s.target)?a:a.concat(s.target)},[]);o.forEach(function(a){a.incoming.filter(yo).forEach(function(s){const c=a.incoming.filter(yo).filter(function(u){return u.source===r});(s.source!==r||c.length>1)&&t.removeConnection(s)})})}})}Nl.$inject=["eventBus","modeling"],ae(Nl,X);function yo(e){return v(e,"bpmn:SequenceFlow")}var Us=1500,Nm=2e3;function Bm(e,t,n){t.on(["create.hover","create.move","create.out","create.end","shape.move.hover","shape.move.move","shape.move.out","shape.move.end"],Us,function(i){var r=i.context,o=r.shape||i.shape,a=i.hover;v(a,"bpmn:Lane")&&!Le(o,["bpmn:Lane","bpmn:Participant"])&&(i.hover=Yn(a),i.hoverGfx=e.getGraphics(i.hover));var s=n.getRootElement();a&&a!==s&&(o.labelTarget||Le(o,["bpmn:Group","bpmn:TextAnnotation"]))&&(i.hover=s,i.hoverGfx=e.getGraphics(i.hover))}),t.on(["connect.hover","connect.out","connect.end","connect.cleanup","global-connect.hover","global-connect.out","global-connect.end","global-connect.cleanup"],Us,function(i){var r=i.hover;v(r,"bpmn:Lane")&&(i.hover=Yn(r)||r,i.hoverGfx=e.getGraphics(i.hover))}),t.on(["bendpoint.move.hover"],Us,function(i){var r=i.context,o=i.hover,a=r.type;v(o,"bpmn:Lane")&&/reconnect/.test(a)&&(i.hover=Yn(o)||o,i.hoverGfx=e.getGraphics(i.hover))}),t.on(["connect.start"],Us,function(i){var r=i.context,o=r.start;v(o,"bpmn:Lane")&&(r.start=Yn(o)||o)}),t.on("shape.move.start",Nm,function(i){var r=i.shape;v(r,"bpmn:Lane")&&(i.shape=Yn(r)||r)}),t.on("spaceTool.move",Nm,function(i){var r=i.hover;r&&v(r,"bpmn:Lane")&&(i.hover=Yn(r))})}Bm.$inject=["elementRegistry","eventBus","canvas"];var $m=770;function Bl(e,t,n,i){n.invoke(X,this);function r(s,c){var u=Z(s),l=c.categoryValue||u.categoryValueRef;l||(l=Sm(e,u));var f=c.category||l.$parent||Em(e);u.categoryValueRef=l,l.$parent=f,c.categoryValue=l,c.category=f}function o(s,c){var u=Z(s),l=c.categoryValue||u.categoryValueRef,f=c.category||l&&l.$parent;l&&(c.categoryValue=l,c.category=f,u.categoryValueRef=null)}this.execute("label.create",function(s){var c=s.context,u=c.labelTarget;v(u,"bpmn:Group")&&r(u,c)}),this.revert("label.create",function(s){var c=s.context,u=c.labelTarget;v(u,"bpmn:Group")&&o(u,c)}),this.execute("shape.delete",function(s){var c=s.context,u=c.shape,l=Z(u);if(!(!v(u,"bpmn:Group")||u.labelTarget)){var f=c.categoryValue=l.categoryValueRef;f&&(c.category=f.$parent,l.categoryValueRef=null)}}),this.reverted("shape.delete",function(s){var c=s.context,u=c.shape;if(!(!v(u,"bpmn:Group")||u.labelTarget)){var l=c.category,f=c.categoryValue,p=Z(u);f&&(p.categoryValueRef=f,f.$parent=l)}}),this.execute("shape.create",function(s){var c=s.context,u=c.shape,l=c.hints||{};!v(u,"bpmn:Group")||u.labelTarget||l.createElementsBehavior===!1&&!Z(u).categoryValueRef&&!c.categoryValue||r(u,c)}),this.reverted("shape.create",function(s){var c=s.context,u=c.shape,l=c.hints||{};!v(u,"bpmn:Group")||u.labelTarget||l.createElementsBehavior===!1&&!Z(u).categoryValueRef&&!c.categoryValue||o(u,c)}),this.executed(["shape.move","shape.resize"],function(s){var c=s.context,u=c.shape;!v(u,"bpmn:Group")||u.labelTarget||Z(u).categoryValueRef||r(u,c)}),this.reverted(["shape.move","shape.resize"],function(s){var c=s.context,u=c.shape;!v(u,"bpmn:Group")||u.labelTarget||!c.categoryValue||o(u,c)});function a(s,c){var u=e.create(s.$type);return i.copyElement(s,u,null,c)}t.on("copyPaste.copyElement",$m,function(s){var c=s.descriptor,u=s.element;if(!(!v(u,"bpmn:Group")||u.labelTarget)){var l=Z(u);if(l.categoryValueRef){var f=l.categoryValueRef;c.categoryValue=a(f,!0),f.$parent&&(c.category=a(f.$parent,!0))}}}),t.on("copyPaste.pasteElement",$m,function(s){var c=s.descriptor,u=c.businessObject,l=c.categoryValue,f=c.category;l&&(l=u.categoryValueRef=a(l)),f&&(l.$parent=a(f)),delete c.category,delete c.categoryValue})}Bl.$inject=["bpmnFactory","eventBus","injector","moddleCopy"],ae(Bl,X);function $l(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 jm(e){function t(i,r,o){var a={x:o.x,y:o.y-50},s={x:o.x-50,y:o.y},c=$l(i,r,o,a),u=$l(i,r,o,s),l;c&&u?Fm(c,o)>Fm(u,o)?l=u:l=c:l=c||u,i.original=l}function n(i){var r=i.waypoints;t(r[0],r[1],we(i.source)),t(r[r.length-1],r[r.length-2],we(i.target))}e.on("bpmnElement.added",function(i){var r=i.element;r.waypoints&&n(r)})}jm.$inject=["eventBus"];function Fm(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function jl(e){X.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=Z(i),o=Ge(i);if(Le(r,t)){var a=o.get("isHorizontal");a===void 0&&(a=!0),o.set("isHorizontal",a)}})}jl.$inject=["eventBus"],ae(jl,X);function Hm(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}function zm(e){return Math.atan((e[1].y-e[0].y)/(e[1].x-e[0].x))}function jR(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 FR(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 Fl(e,t){var n=t[0],i=t[1],r={x:i.x-n.x,y:i.y-n.y},o=FR([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 Vm(e,t){var n=Fl(e,t),i={x:n.x-e.x,y:n.y-e.y};return Hm(i)}function ua(e,t){return Hm({x:e.x-t.x,y:e.y-t.y})}var Gm=Math.sqrt,Wm=Math.min,HR=Math.max,Um=Math.abs;function Ym(e){return Math.pow(e,2)}function la(e,t){return Gm(Ym(e.x-t.x)+Ym(e.y-t.y))}function zR(e,t){var n=0,i,r,o,a,s,c,u,l,f,p,d;for(n=0;n<t.length-1;n++){if(i=t[n],r=t[n+1],Km(i,r)?u=[i]:(o=la(e,i),a=la(e,r),c=Wm(o,a),u=VR(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:Km(i,u[0])?n:n+1}),u.length===2&&(s=WR(u[0],u[1]),l={type:"segment",position:s,segmentIndex:n,relativeLocation:la(i,s)/la(i,r)}),f=la(l.position,e),(!d||p>f)&&(d=l,p=f)}return d}function VR(e,t,n,i){var r=t.x-e.x,o=t.y-e.y,a=n.x-e.x,s=n.y-e.y,c=r*r+o*o,u=r*a+o*s,l=a*a+s*s-i*i,f=u/c,p=l/c,d=f*f-p;if(d<0&&d>-1e-6&&(d=0),d<0)return[];var h=Gm(d),m=-f+h,g=-f-h,R={x:e.x-r*m,y:e.y-o*m};if(d===0)return[R];var w={x:e.x-r*g,y:e.y-o*g};return[R,w].filter(function(b){return GR(b,e,t)})}function GR(e,t,n){return qm(e.x,t.x,n.x)&&qm(e.y,t.y,n.y)}function qm(e,t,n){return e>=Wm(t,n)-Ys&&e<=HR(t,n)+Ys}function WR(e,t){return{x:(e.x+t.x)/2,y:(e.y+t.y)/2}}var Ys=.1;function Km(e,t){return Um(e.x-t.x)<=Ys&&Um(e.y-t.y)<=Ys}function UR(e,t,n,i){var r=n.segmentIndex,o=t.length-e.length;if(i.segmentMove){var a=i.segmentMove.segmentStartIndex,s=i.segmentMove.newSegmentStartIndex;return r===a?s:r>=s?r+o<s?s:r+o:r}if(i.bendpointMove){var c=i.bendpointMove.insert,u=i.bendpointMove.bendpointIndex,l;if(o===0)return r;if(r>=u&&(l=c?r+1:r-1),r<u&&(l=r,c&&n.type!=="bendpoint"&&u-1===r)){var f=Zm(t,u);f<n.relativeLocation&&l++}return l}return o===0?r:i.connectionStart&&r===0?0:i.connectionEnd&&r===e.length-2?t.length-2:Math.floor((t.length-2)/2)}function Xm(e,t,n,i){var r=0,o=0,a={point:e,delta:{x:0,y:0}},s=zR(e,n),c=s.segmentIndex,u=UR(n,t,s,i);if(u<0||u>t.length-2||u===null)return a;var l=Qm(n,c),f=Qm(t,u),p=s.position,d=qR(l,p),h=YR(l,f);if(s.type==="bendpoint"){var m=t.length-n.length,g=s.bendpointIndex,R=n[g];if(t.indexOf(R)!==-1)return a;if(m===0){var w=t[g];return r=w.x-s.position.x,o=w.y-s.position.y,{delta:{x:r,y:o},point:{x:e.x+r,y:e.y+o}}}m<0&&g!==0&&g<n.length-1&&(d=Zm(n,g))}var b={x:(f[1].x-f[0].x)*d+f[0].x,y:(f[1].y-f[0].y)*d+f[0].y},x=jR({x:e.x-p.x,y:e.y-p.y},h);return r=b.x+x.x-e.x,o=b.y+x.y-e.y,{point:Mi(b),delta:Mi({x:r,y:o})}}function Zm(e,t){var n=ua(e[t-1],e[t]),i=ua(e[t],e[t+1]),r=n/(n+i);return r}function YR(e,t){var n=zm(e),i=zm(t);return i-n}function Qm(e,t){return[e[t],e[t+1]]}function qR(e,t){var n=ua(e[0],e[1]),i=ua(e[0],t);return n===0?0:i/n}function KR(e,t,n,i){var r=we(e);return Xm(r,t,n,i).delta}function pa(e,t,n){var i=aa(t),r=aa(n),o=ri(e,i),a={x:o.x*(n.width/t.width),y:o.y*(n.height/t.height)};return Mi({x:r.x+a.x,y:r.y+a.y})}function Jm(e,t,n){var i=aa(e),r=aa(t),o=aa(n),a=ri(e,i),s=ri(i,r),c=XR(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 Mi({x:l.x+a.x-e.x,y:l.y+a.y-e.y})}function XR(e,t,n){var i=ve(t),r=ve(n);if(ZR(i,r))return null;var o=Qt(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=Qt(n,s),c!==o?null:a}function ZR(e,t){return QR(e,t)||JR(e,t)}function QR(e,t){return e.right!==t.right&&e.left!==t.left}function JR(e,t){return e.top!==t.top&&e.bottom!==t.bottom}var eg="name",tg="text";function Hl(e,t,n,i){X.call(this,e),this.postExecute("element.updateProperties",r),this.postExecute("element.updateModdleProperties",a=>{Z(a.context.element)===a.context.moddleElement&&r(a)});function r(a){var s=a.context,c=s.element,u=s.properties;if(eg in u&&t.updateLabel(c,u[eg]),tg in u&&v(c,"bpmn:TextAnnotation")){var l=i.getTextAnnotationBounds({x:c.x,y:c.y,width:c.width,height:c.height},u[tg]||"");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;De(u)||!rr(u)||Hn(u)&&t.updateLabel(u,Hn(u))}}),this.postExecute("shape.delete",function(a){var s=a.context,c=s.labelTarget,u=s.hints||{};c&&u.unsetLabel!==!1&&t.updateLabel(c,null,null,{removeShape:!1})});function o(a){var s=a.context,c=s.connection,u=c.label,l=L({},s.hints),f=s.newWaypoints||c.waypoints,p=s.oldWaypoints;return typeof l.startChanged>"u"&&(l.startChanged=!!l.connectionStart),typeof l.endChanged>"u"&&(l.endChanged=!!l.connectionEnd),KR(u,f,p,l)}this.postExecute(["connection.layout","connection.updateWaypoints"],function(a){var s=a.context,c=s.hints||{};if(c.labelBehavior!==!1){var u=s.connection,l=u.label,f;!l||!l.parent||(f=o(a),t.moveShape(l,f))}}),this.postExecute(["shape.replace"],function(a){var s=a.context,c=s.newShape,u=s.oldShape,l=Z(c);l&&rr(l)&&u.label&&c.label&&(c.label.x=u.label.x,c.label.y=u.label.y)}),this.preExecute("shape.resize",function(a){var s=a.context,c=s.shape,u=s.hints||{};if(!(!De(c)||u.autoResize)){var l=s.newBounds,f=i.getDimensions(Hn(c)||"",{box:l,style:i.getExternalStyle()}),p=Math.ceil(f.height),d=l.y!==c.y,h=c.y+c.height;s.newBounds={width:l.width,height:p,x:l.x,y:d?h-p:l.y}}}),this.postExecute("shape.resize",function(a){var s=a.context,c=s.shape,u=s.newBounds,l=s.oldBounds;if(Ms(c)){var f=c.label,p=we(f),d=nC(l),h=tC(p,d),m=eC(h,l,u);t.moveShape(f,m)}})}ae(Hl,X),Hl.$inject=["eventBus","modeling","bpmnFactory","textRenderer"];function eC(e,t,n){var i=pa(e,t,n);return Mi(ri(i,e))}function tC(e,t){if(t.length){var n=iC(e,t);return Fl(e,n)}}function nC(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 iC(e,t){var n=t.map(function(r){return{line:r,distance:Vm(e,r)}}),i=ai(n,"distance");return i[0].line}function rC(e,t,n,i){return Xm(e,t,n,i).point}function zl(e,t){X.call(this,e);function n(i,r){var o=i.context,a=o.connection,s=L({},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),rC(r,c,u,s)}this.postExecute(["connection.layout","connection.updateWaypoints"],function(i){var r=i.context,o=r.connection,a=o.outgoing,s=o.incoming;s.forEach(function(c){var u=c.waypoints[c.waypoints.length-1],l=n(i,u),f=[].concat(c.waypoints.slice(0,-1),[l]);t.updateWaypoints(c,f)}),a.forEach(function(c){var u=c.waypoints[0],l=n(i,u),f=[].concat([l],c.waypoints.slice(1));t.updateWaypoints(c,f)})}),this.postExecute(["connection.move"],function(i){var r=i.context,o=r.connection,a=o.outgoing,s=o.incoming,c=r.delta;s.forEach(function(u){var l=u.waypoints[u.waypoints.length-1],f={x:l.x+c.x,y:l.y+c.y},p=[].concat(u.waypoints.slice(0,-1),[f]);t.updateWaypoints(u,p)}),a.forEach(function(u){var l=u.waypoints[0],f={x:l.x+c.x,y:l.y+c.y},p=[].concat([f],u.waypoints.slice(1));t.updateWaypoints(u,p)})})}ae(zl,X),zl.$inject=["eventBus","modeling"];function qs(e,t,n){var i=Xs(e),r=ig(i,t),o=i[0];return r.length?r[r.length-1]:pa(o.original||o,n,t)}function Ks(e,t,n){var i=Xs(e),r=ig(i,t),o=i[i.length-1];return r.length?r[0]:pa(o.original||o,n,t)}function Vl(e,t,n){var i=Xs(e),r=ng(t,n),o=i[0];return pa(o.original||o,r,t)}function Gl(e,t,n){var i=Xs(e),r=ng(t,n),o=i[i.length-1];return pa(o.original||o,r,t)}function ng(e,t){return{x:e.x-t.x,y:e.y-t.y,width:e.width,height:e.height}}function Xs(e){var t=e.waypoints;if(!t.length)throw new Error("connection#"+e.id+": no waypoints");return t}function ig(e,t){var n=on(e,aC);return Ie(n,function(i){return oC(i,t)})}function oC(e,t){return Qt(t,e,1)==="intersect"}function aC(e){return e.original||e}function Wl(e,t){X.call(this,e),this.postExecute("shape.replace",function(n){var i=n.oldShape,r=n.newShape;if(sC(i,r)){var o=cC(i);o.incoming.forEach(function(a){var s=Ks(a,r,i);t.reconnectEnd(a,r,s)}),o.outgoing.forEach(function(a){var s=qs(a,r,i);t.reconnectStart(a,r,s)})}},!0)}Wl.$inject=["eventBus","modeling"],ae(Wl,X);function sC(e,t){return v(e,"bpmn:Participant")&&$e(e)&&v(t,"bpmn:Participant")&&!$e(t)}function cC(e){var t=Xo([e]),n=[],i=[];return t.forEach(function(r){r!==e&&(r.incoming.forEach(function(o){v(o,"bpmn:MessageFlow")&&n.push(o)}),r.outgoing.forEach(function(o){v(o,"bpmn:MessageFlow")&&i.push(o)}))},[]),{incoming:n,outgoing:i}}const uC=["bpmn:MessageEventDefinition","bpmn:TimerEventDefinition","bpmn:EscalationEventDefinition","bpmn:ConditionalEventDefinition","bpmn:SignalEventDefinition"];function rg(e){const t=Z(e);if(!v(t,"bpmn:BoundaryEvent")&&!(v(t,"bpmn:StartEvent")&&un(t.$parent)))return!1;const n=t.get("eventDefinitions");return!n||!n.length?!1:uC.some(i=>v(n[0],i))}function og(e){return v(e,"bpmn:BoundaryEvent")?"cancelActivity":"isInterrupting"}function Ul(e,t){e.invoke(X,this),this.postExecuted("shape.replace",function(n){const i=n.context.oldShape,r=n.context.newShape,o=n.context.hints;if(!rg(r))return;const a=og(r);if(o.targetElement&&o.targetElement[a]!==void 0)return;const c=Z(i).get(a),u=Z(r).get(a);c!==u&&t.updateProperties(r,{[a]:c})})}Ul.$inject=["injector","modeling"],ae(Ul,X);function Yl(e,t){X.call(this,e),this.preExecute("shape.resize",function(n){var i=n.shape,r=Ge(i),o=r&&r.get("label"),a=o&&o.get("bounds");a&&t.updateModdleProperties(i,o,{bounds:void 0})},!0)}ae(Yl,X),Yl.$inject=["eventBus","modeling"];function ql(e,t,n){X.call(this,e),this.preExecute("shape.delete",function(i){var r=i.context.shape;if(!(r.incoming.length!==1||r.outgoing.length!==1)){var o=r.incoming[0],a=r.outgoing[0];if(!(!v(o,"bpmn:SequenceFlow")||!v(a,"bpmn:SequenceFlow"))&&t.canConnect(o.source,a.target,o)){var s=lC(o.waypoints,a.waypoints);n.reconnectEnd(o,a.target,s)}}})}ae(ql,X),ql.$inject=["eventBus","bpmnRules","modeling"];function vo(e){return e.original||e}function lC(e,t){var n=$l(vo(e[e.length-2]),vo(e[e.length-1]),vo(t[1]),vo(t[0]));return n?[].concat(e.slice(0,e.length-1),[n],t.slice(1)):[vo(e[0]),vo(t[t.length-1])]}function Kl(e,t){X.call(this,e),this.preExecute("shape.delete",function(n){var i=n.shape,r=i.parent;v(i,"bpmn:Participant")&&(n.collaborationRoot=r)},!0),this.postExecute("shape.delete",function(n){var i=n.collaborationRoot;if(i&&!i.businessObject.participants.length){var r=t.makeProcess(),o=i.children.slice();t.moveElements(o,{x:0,y:0},r)}},!0)}Kl.$inject=["eventBus","modeling"],ae(Kl,X);function Xl(e,t,n,i){X.call(this,e);var r=i.get("dragging",!1);function o(c){var u=c.source,l=c.target,f=c.parent;if(f){var p,d;v(c,"bpmn:SequenceFlow")&&(n.canConnectSequenceFlow(u,l)||(d=!0),n.canConnectMessageFlow(u,l)&&(p="bpmn:MessageFlow")),v(c,"bpmn:MessageFlow")&&(n.canConnectMessageFlow(u,l)||(d=!0),n.canConnectSequenceFlow(u,l)&&(p="bpmn:SequenceFlow")),d&&t.removeConnection(c),p&&t.connect(u,l,{type:p,waypoints:c.waypoints.slice()})}}function a(c){var u=c.context,l=u.connection,f=u.newSource||l.source,p=u.newTarget||l.target,d,h;d=n.canConnect(f,p),!(!d||d.type===l.type)&&(h=t.connect(f,p,{type:d.type,associationDirection:d.associationDirection,waypoints:l.waypoints.slice()}),l.parent&&t.removeConnection(l),u.connection=h,r&&s(l,h))}function s(c,u){var l=r.context(),f=l&&l.payload.previousSelection,p;!f||!f.length||(p=f.indexOf(c),p!==-1&&f.splice(p,1,u))}this.postExecuted("elements.move",function(c){var u=c.closure,l=u.allConnections;k(l,o)},!0),this.preExecute("connection.reconnect",a),this.postExecuted("element.updateProperties",function(c){var u=c.context,l=u.properties,f=u.element,p=f.businessObject,d;l.default&&(d=ut(f.outgoing,eo({id:f.businessObject.default.id})),d&&t.updateProperties(d,{conditionExpression:void 0})),l.conditionExpression&&p.sourceRef.default===p&&t.updateProperties(f.source,{default:void 0})})}ae(Xl,X),Xl.$inject=["eventBus","modeling","bpmnRules","injector"];function Zs(e,t,n,i,r,o){i.invoke(X,this),this._bpmnReplace=e,this._elementRegistry=n,this._selection=o,this.postExecuted(["elements.create"],500,function(a){var s=a.context,c=s.parent,u=s.elements,l=Sn(u,function(f,p){var d=t.canReplace([p],p.host||p.parent||c);return d?f.concat(d.replacements):f},[]);l.length&&this._replaceElements(u,l)},this),this.postExecuted(["elements.move"],500,function(a){var s=a.context,c=s.newParent,u=s.newHost,l=[];k(s.closure.topLevel,function(p){un(p)?l=l.concat(p.children):l=l.concat(p)}),l.length===1&&u&&(c=u);var f=t.canReplace(l,c);f&&this._replaceElements(l,f.replacements,u)},this),this.postExecute(["shape.replace"],1500,function(a){var s=a.context,c=s.oldShape,u=s.newShape,l=c.attachers,f;l&&l.length&&(f=t.canReplace(l,u),this._replaceElements(l,f.replacements))},this),this.postExecuted(["shape.replace"],1500,function(a){var s=a.context,c=s.oldShape,u=s.newShape;r.unclaimId(c.businessObject.id,c.businessObject),r.updateProperties(u,{id:c.id})})}ae(Zs,X),Zs.prototype._replaceElements=function(e,t){var n=this._elementRegistry,i=this._bpmnReplace,r=this._selection;k(t,function(o){var a={type:o.newElementType},s=n.get(o.oldElementId),c=e.indexOf(s);e[c]=i.replaceElement(s,a,{select:!1})}),t&&r.select(e)},Zs.$inject=["bpmnReplace","bpmnRules","elementRegistry","injector","modeling","selection"];var pC=1500,fC={width:140,height:120},Zl={width:300,height:60},Ql={width:60,height:300},Qs={width:300,height:150},Js={width:150,height:300},ag={width:140,height:120},sg={width:100,height:40};function cg(e){e.on("resize.start",pC,function(t){var n=t.context,i=n.shape,r=n.direction,o=n.balanced;(v(i,"bpmn:Lane")||v(i,"bpmn:Participant"))&&(n.resizeConstraints=yC(i,r,o)),v(i,"bpmn:SubProcess")&&$e(i)&&(n.minDimensions=ag),v(i,"bpmn:TextAnnotation")&&(n.minDimensions=sg)})}cg.$inject=["eventBus"];var sr=Math.abs,dC=Math.min,hC=Math.max;function ug(e,t,n,i){var r=e[t];e[t]=r===void 0?n:i(n,r)}function _o(e,t,n){return ug(e,t,n,dC)}function bo(e,t,n){return ug(e,t,n,hC)}var mC={top:20,left:50,right:20,bottom:20},gC={top:50,left:20,right:20,bottom:20};function yC(e,t,n){var i=Yn(e),r=!0,o=!0,a=Vs(i,[i]),s=ve(e),c={},u={},l=qt(e),f=l?Zl:Ql;/n/.test(t)?u.top=s.bottom-f.height:/e/.test(t)?u.right=s.left+f.width:/s/.test(t)?u.bottom=s.top+f.height:/w/.test(t)&&(u.left=s.right-f.width),a.forEach(function(h){var m=ve(h);l?(m.top<s.top-10&&(r=!1),m.bottom>s.bottom+10&&(o=!1)):(m.left<s.left-10&&(r=!1),m.right>s.right+10&&(o=!1)),/n/.test(t)&&(n&&sr(s.top-m.bottom)<10&&bo(c,"top",m.top+f.height),sr(s.top-m.top)<5&&_o(u,"top",m.bottom-f.height)),/e/.test(t)&&(n&&sr(s.right-m.left)<10&&_o(c,"right",m.right-f.width),sr(s.right-m.right)<5&&bo(u,"right",m.left+f.width)),/s/.test(t)&&(n&&sr(s.bottom-m.top)<10&&_o(c,"bottom",m.bottom-f.height),sr(s.bottom-m.bottom)<5&&bo(u,"bottom",m.top+f.height)),/w/.test(t)&&(n&&sr(s.left-m.right)<10&&bo(c,"left",m.left+f.width),sr(s.left-m.left)<5&&_o(u,"left",m.right-f.width))});var p=i.children.filter(function(h){return!h.hidden&&!h.waypoints&&(v(h,"bpmn:FlowElement")||v(h,"bpmn:Artifact"))}),d=l?mC:gC;return p.forEach(function(h){var m=ve(h);/n/.test(t)&&(!l||r)&&_o(u,"top",m.top-d.top),/e/.test(t)&&(l||o)&&bo(u,"right",m.right+d.right),/s/.test(t)&&(!l||o)&&bo(u,"bottom",m.bottom+d.bottom),/w/.test(t)&&(l||r)&&_o(u,"left",m.left-d.left)}),{min:u,max:c}}function lg(e){!e||typeof e.stopPropagation!="function"||e.stopPropagation()}function xo(e){return e.originalEvent||e.srcEvent}function Jl(e){lg(e),lg(xo(e))}function $r(e){return e.pointers&&e.pointers.length&&(e=e.pointers[0]),e.touches&&e.touches.length&&(e=e.touches[0]),e?{x:e.clientX,y:e.clientY}:null}function pg(){return/mac/i.test(navigator.platform)}function fg(e,t){return(xo(e)||e).button===t}function cr(e){return fg(e,0)}function vC(e){return fg(e,1)}function fa(e){var t=xo(e)||e;return cr(e)?pg()?t.metaKey:t.ctrlKey:!1}function ec(e){var t=xo(e)||e;return cr(e)&&t.shiftKey}var dg=1001;function hg(e,t){e.on("resize.start",dg+500,function(n){var i=n.context,r=i.shape;(v(r,"bpmn:Lane")||v(r,"bpmn:Participant"))&&(i.balanced=!fa(n))}),e.on("resize.end",dg,function(n){var i=n.context,r=i.shape,o=i.canExecute,a=i.newBounds;if(v(r,"bpmn:Lane")||v(r,"bpmn:Participant"))return o&&(a=Vh(a),t.resizeLane(r,a,i.balanced)),!1})}hg.$inject=["eventBus","modeling"];var _C=500;function ep(e,t,n,i,r){n.invoke(X,this);function o(l){return Le(l,["bpmn:ReceiveTask","bpmn:SendTask"])||bC(l,["bpmn:ErrorEventDefinition","bpmn:EscalationEventDefinition","bpmn:MessageEventDefinition","bpmn:SignalEventDefinition"])}function a(l){var f=e.getDefinitions(),p=f.get("rootElements");return!!ut(p,eo({id:l.id}))}function s(l){if(v(l,"bpmn:ErrorEventDefinition"))return"errorRef";if(v(l,"bpmn:EscalationEventDefinition"))return"escalationRef";if(v(l,"bpmn:MessageEventDefinition"))return"messageRef";if(v(l,"bpmn:SignalEventDefinition"))return"signalRef"}function c(l){if(Le(l,["bpmn:ReceiveTask","bpmn:SendTask"]))return l.get("messageRef");var f=l.get("eventDefinitions"),p=f[0];return p.get(s(p))}function u(l,f){if(Le(l,["bpmn:ReceiveTask","bpmn:SendTask"]))return l.set("messageRef",f);var p=l.get("eventDefinitions"),d=p[0];return d.set(s(d),f)}this.executed(["shape.create","element.updateProperties","element.updateModdleProperties"],function(l){var f=l.shape||l.element;if(o(f)){var p=Z(f),d=c(p),h;d&&!a(d)&&(h=e.getDefinitions().get("rootElements"),Rt(h,d),l.addedRootElement=d)}},!0),this.reverted(["shape.create","element.updateProperties","element.updateModdleProperties"],function(l){var f=l.addedRootElement;if(f){var p=e.getDefinitions().get("rootElements");Et(p,f)}},!0),t.on("copyPaste.copyElement",function(l){var f=l.descriptor,p=l.element;if(!(p.labelTarget||!o(p))){var d=Z(p),h=c(d);h&&(f.referencedRootElement=h)}}),t.on("copyPaste.pasteElement",_C,function(l){var f=l.descriptor,p=f.businessObject,d=f.referencedRootElement;d&&(a(d)||(d=i.copyElement(d,r.create(d.$type))),u(p,d),delete f.referencedRootElement)})}ep.$inject=["bpmnjs","eventBus","injector","moddleCopy","bpmnFactory"],ae(ep,X);function bC(e,t){return xe(t)||(t=[t]),Wi(t,function(n){return po(e,n)})}var mg=Math.max;function gg(e){e.on("spaceTool.getMinDimensions",function(t){var n=t.shapes,i=t.axis,r=t.start,o={};return k(n,function(a){var s=a.id;v(a,"bpmn:Participant")&&(o[s]=wC(a,i,r)),v(a,"bpmn:Lane")&&(o[s]=qt(a)?Zl:Ql),v(a,"bpmn:SubProcess")&&$e(a)&&(o[s]=ag),v(a,"bpmn:TextAnnotation")&&(o[s]=sg),v(a,"bpmn:Group")&&(o[s]=fC)}),o})}gg.$inject=["eventBus"];function xC(e){return e==="x"}function wC(e,t,n){var i=qt(e);if(!RC(e))return i?Qs:Js;var r=xC(t),o={};return r?i?o=Qs:o={width:SC(e,n,r),height:Js.height}:i?o={width:Qs.width,height:EC(e,n,r)}:o=Js,o}function EC(e,t,n){var i;return i=CC(e,t,n),mg(Qs.height,i)}function SC(e,t,n){var i;return i=PC(e,t,n),mg(Js.width,i)}function RC(e){return!!ar(e).length}function CC(e,t,n){var i=ar(e),r;return r=tp(i,t,n),e.height-r.height+Zl.height}function PC(e,t,n){var i=ar(e),r;return r=tp(i,t,n),e.width-r.width+Ql.width}function tp(e,t,n){var i,r,o;for(i=0;i<e.length;i++)if(r=e[i],!n&&t>=r.y&&t<=r.y+r.height||n&&t>=r.x&&t<=r.x+r.width)return o=ar(r),o.length?tp(o,t,n):r}var yg="_plane";function vg(e){var t=e.id;return AC(t)}function gi(e){var t=e.id;return v(e,"bpmn:SubProcess")?_g(t):t}function jr(e){return _g(e)}function tc(e){var t=Ge(e);return v(t,"bpmndi:BPMNPlane")}function _g(e){return e+yg}function AC(e){return e.replace(new RegExp(yg+"$"),"")}var bg=400,TC=600,xg={x:180,y:160};function Li(e,t,n,i,r,o,a){X.call(this,t),this._canvas=e,this._eventBus=t,this._modeling=n,this._elementFactory=i,this._bpmnFactory=r,this._bpmnjs=o,this._elementRegistry=a;var s=this;function c(f){return v(f,"bpmn:SubProcess")&&!$e(f)}function u(f){var p=f.shape,d=f.newRootElement,h=Z(p);d=s._addDiagram(d||h),f.newRootElement=e.addRootElement(d)}function l(f){var p=f.shape,d=Z(p);s._removeDiagram(d);var h=f.newRootElement=a.get(gi(d));e.removeRootElement(h)}this.executed("shape.create",function(f){var p=f.shape;c(p)&&u(f)},!0),this.postExecuted("elements.create",function(f){var p=f.elements;k(p,function(d){if(c(d)){var h=a.get(gi(d));if(!(!h||!d.children||!d.children.length)){var m=wg(d);s._showRecursively(m),s._moveChildrenToShape(m,h)}}})},!0),this.reverted("shape.create",function(f){var p=f.shape;c(p)&&l(f)},!0),this.preExecute("shape.delete",function(f){var p=f.shape;!v(p,"bpmn:SubProcess")||!$e(p)||k(na([p]),d=>{n.removeShape(d.annotation)})},!0),this.preExecuted("shape.delete",function(f){var p=f.shape;if(c(p)){var d=a.get(gi(p));d&&n.removeElements(d.children.slice())}},!0),this.executed("shape.delete",function(f){var p=f.shape;c(p)&&l(f)},!0),this.reverted("shape.delete",function(f){var p=f.shape;c(p)&&u(f)},!0),this.preExecuted("shape.replace",function(f){var p=f.oldShape,d=f.newShape;!c(p)||!c(d)||(f.oldRoot=e.removeRootElement(gi(p)))},!0),this.postExecuted("shape.replace",function(f){var p=f.newShape,d=f.oldRoot,h=e.findRoot(gi(p));if(!(!d||!h)){var m=d.children;n.moveElements(m,{x:0,y:0},h)}},!0),this.executed("element.updateProperties",function(f){var p=f.element;if(v(p,"bpmn:SubProcess")){var d=f.properties,h=f.oldProperties,m=h.id,g=d.id;if(m!==g){if(tc(p)){a.updateId(p,jr(g)),a.updateId(m,g);return}var R=a.get(jr(m));R&&a.updateId(jr(m),jr(g))}}},!0),this.reverted("element.updateProperties",function(f){var p=f.element;if(v(p,"bpmn:SubProcess")){var d=f.properties,h=f.oldProperties,m=h.id,g=d.id;if(m!==g){if(tc(p)){a.updateId(p,jr(m)),a.updateId(g,m);return}var R=a.get(jr(g));R&&a.updateId(R,jr(m))}}},!0),t.on("element.changed",function(f){var p=f.element;if(tc(p)){var d=p,h=a.get(vg(d));!h||h===d||t.fire("element.changed",{element:h})}}),this.executed("shape.toggleCollapse",bg,function(f){var p=f.shape;v(p,"bpmn:SubProcess")&&($e(p)?l(f):(u(f),s._showRecursively(p.children)))},!0),this.reverted("shape.toggleCollapse",bg,function(f){var p=f.shape;v(p,"bpmn:SubProcess")&&($e(p)?l(f):(u(f),s._showRecursively(p.children)))},!0),this.postExecuted("shape.toggleCollapse",TC,function(f){var p=f.shape;if(v(p,"bpmn:SubProcess")){var d=f.newRootElement;if(d)if($e(p))s._moveChildrenToShape(d.children.slice(),p),k(na(p.children),m=>{n.moveShape(m.annotation,{x:0,y:0},p.parent),k(m.associations,g=>{n.moveConnection(g,{x:0,y:0},p.parent)})});else{s._disconnectSharedAnnotations(p);var h=wg(p);s._moveChildrenToShape(h,d)}}},!0),t.on("copyPaste.createTree",function(f){var p=f.element,d=f.children;if(c(p)){var h=gi(p),m=a.get(h);m&&d.push.apply(d,m.children)}}),t.on("copyPaste.copyElement",function(f){var p=f.descriptor,d=f.element,h=f.elements,m=d.parent,g=v(Ge(m),"bpmndi:BPMNPlane");if(g){var R=vg(m),w=ut(h,function(b){return b.id===R});w&&(p.parent=w.id)}}),t.on("copyPaste.pasteElement",function(f){var p=f.descriptor;p.parent&&(c(p.parent)||p.parent.hidden)&&(p.hidden=!0)})}ae(Li,X),Li.prototype._moveChildrenToShape=function(e,t){var n=this._modeling;if(e.length){var i=e.filter(function(c){return!c.hidden});if(!i.length){n.moveElements(e,{x:0,y:0},t,{autoResize:!1});return}var r=Tt(i),o;if(!t.x)o={x:xg.x-r.x,y:xg.y-r.y};else{var a=we(t),s=we(r);o={x:a.x-s.x,y:a.y-s.y}}n.moveElements(e,o,t,{autoResize:!1})}},Li.prototype._disconnectSharedAnnotations=function(e){var t=this._modeling,n=new Set(fm(e).map(i=>i.annotation));n.size&&k(na(e.children),i=>{n.has(i.annotation)&&k(i.associations,r=>{t.removeConnection(r)})})},Li.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},Li.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},Li.prototype._createNewDiagram=function(e){var t=this._bpmnFactory,n=this._elementFactory,i=t.create("bpmndi:BPMNPlane",{bpmnElement:e}),r=t.create("bpmndi:BPMNDiagram",{plane:i});i.$parent=r;var o=n.createRoot({id:gi(e),type:e.$type,di:i,businessObject:e,collapsed:!0});return o},Li.prototype._removeDiagram=function(e){var t=this._bpmnjs,n=t.getDefinitions().diagrams,i=ut(n,function(r){return r.plane.bpmnElement.id===e.id});return n.splice(n.indexOf(i),1),i},Li.$inject=["canvas","eventBus","modeling","elementFactory","bpmnFactory","bpmnjs","elementRegistry"];function MC(e){var t=[];return k(na(e),n=>{t.push(n.annotation),t.push.apply(t,n.associations)}),t}function wg(e){return e.children.slice().concat(MC(e.children)).concat(kC(e))}function kC(e){return al(e.children||[]).reduce(function(t,n){return n.label&&n.label.parent!==e&&t.push(n.label),t},[])}function np(e,t){e.invoke(X,this),this.postExecuted("shape.replace",function(n){var i=n.context.oldShape,r=n.context.newShape;if(!(!v(r,"bpmn:SubProcess")||v(r,"bpmn:AdHocSubProcess")||!(v(i,"bpmn:Task")||v(i,"bpmn:CallActivity"))||!$e(r))){var o=DC(r);t.createShape({type:"bpmn:StartEvent"},o,r)}})}np.$inject=["injector","modeling"],ae(np,X);function DC(e){return{x:e.x+e.width/6,y:e.y+e.height/2}}function ip(e,t){X.call(this,e),this.preExecute("connection.create",function(n){const{target:i}=n;v(i,"bpmn:TextAnnotation")&&(n.parent=i.parent)},!0),this.preExecute(["shape.create","shape.resize","elements.move"],function(n){const i=n.shapes||[n.shape];i.length===1&&v(i[0],"bpmn:TextAnnotation")&&(n.hints=n.hints||{},n.hints.autoResize=!1)},!0),this.preExecute("shape.resize",function(n){var i=n.context,r=i.shape,o=i.hints||{};if(!(!v(r,"bpmn:TextAnnotation")||o.autoResize)){var a=i.newBounds,s=t.getTextAnnotationBounds(a,Hn(r)||""),c=a.y!==r.y&&Math.abs(a.y+a.height-(r.y+r.height))<=1,u=r.y+r.height;i.newBounds={width:a.width,height:s.height,x:a.x,y:c?u-s.height:a.y}}})}ae(ip,X),ip.$inject=["eventBus","textRenderer"];function rp(e,t){X.call(this,e),this.postExecuted("shape.toggleCollapse",1500,function(n){var i=n.shape;if($e(i))return;var r=Xo(i);r.forEach(function(a){var s=a.incoming.slice(),c=a.outgoing.slice();k(s,function(u){o(u,!0)}),k(c,function(u){o(u,!1)})});function o(a,s){r.indexOf(a.source)!==-1&&r.indexOf(a.target)!==-1||v(a,"bpmn:Association")&&(v(a.source,"bpmn:TextAnnotation")||v(a.target,"bpmn:TextAnnotation"))||(s?t.reconnectEnd(a,i,we(i)):t.reconnectStart(a,i,we(i)))}},!0)}ae(rp,X),rp.$inject=["eventBus","modeling"];var op=500;function ap(e,t,n){X.call(this,e);function i(a){a.length&&a.forEach(function(s){s.type==="label"&&!s.businessObject.name&&(s.hidden=!0)})}function r(a,s){var c=a.children,u=s,l,f;return l=OC(c).concat([a]),f=Mm(l),f?(u.width=Math.max(f.width,u.width),u.height=Math.max(f.height,u.height),u.x=f.x+(f.width-u.width)/2,u.y=f.y+(f.height-u.height)/2):(u.x=a.x+(a.width-u.width)/2,u.y=a.y+(a.height-u.height)/2),u}function o(a,s){return{x:a.x+(a.width-s.width)/2,y:a.y+(a.height-s.height)/2,width:s.width,height:s.height}}this.executed(["shape.toggleCollapse"],op,function(a){var s=a.context,c=s.shape;v(c,"bpmn:SubProcess")&&(c.collapsed?Ge(c).isExpanded=!1:(i(c.children),Ge(c).isExpanded=!0))}),this.reverted(["shape.toggleCollapse"],op,function(a){var s=a.context,c=s.shape;c.collapsed?Ge(c).isExpanded=!1:Ge(c).isExpanded=!0}),this.postExecuted(["shape.toggleCollapse"],op,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"})})}ae(ap,X),ap.$inject=["eventBus","elementFactory","modeling"];function OC(e){return e.filter(function(t){return!t.hidden})}function sp(e,t,n,i){t.invoke(X,this),this.preExecute("shape.delete",function(r){var o=r.context,a=o.shape,s=a.businessObject;De(a)||(v(a,"bpmn:Participant")&&$e(a)&&n.ids.unclaim(s.processRef.id),i.unclaimId(s.id,s))}),this.preExecute("connection.delete",function(r){var o=r.context,a=o.connection,s=a.businessObject;i.unclaimId(s.id,s)}),this.preExecute("canvas.updateRoot",function(){var r=e.getRootElement(),o=r.businessObject;v(r,"bpmn:Collaboration")&&n.ids.unclaim(o.id)})}ae(sp,X),sp.$inject=["canvas","injector","moddle","modeling"];function cp(e,t){X.call(this,e),this.preExecute("connection.delete",function(n){var i=n.context,r=i.connection,o=r.source;LC(r,o)&&t.updateProperties(o,{default:null})})}ae(cp,X),cp.$inject=["eventBus","modeling"];function LC(e,t){if(!v(e,"bpmn:SequenceFlow"))return!1;var n=Z(t),i=Z(e);return n.get("default")===i}var IC=500,NC=5e3,Eg=["shape.create","shape.delete","shape.move","shape.resize"],Sg=[...Eg,"spaceTool","lane.add","lane.resize","lane.split","elements.create","elements.delete","elements.move"];function up(e,t){X.call(this,e);var n;function i(){return n=n||new BC,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(Sg,NC,function(){i()}),this.postExecuted(Sg,IC,function(){o()}),this.preExecute(Eg,function(a){var s=a.context,c=s.shape,u=r();!c||c.labelTarget||(v(c,"bpmn:Lane")&&u.addLane(c),v(c,"bpmn:FlowNode")&&u.addFlowNode(c))})}up.$inject=["eventBus","modeling"],ae(up,X);function BC(){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 $C=500,jC=5e3,Rg=["connection.create","connection.delete","connection.layout","connection.move","connection.reconnect","connection.updateWaypoints","shape.create","shape.delete","shape.move","shape.resize"],Cg=[...Rg,"elements.create","elements.delete","elements.move","label.create","spaceTool"];function lp(e,t){X.call(this,e);var n;function i(){return n=n||new FC,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(Cg,jC,function(){i()}),this.postExecuted(Cg,$C,function(){o()}),this.preExecute(Rg,function(a){var s=a.context.connection||a.context.shape,c=r();!s||s.labelTarget||(v(s,"bpmn:FlowElement")&&c.addFlowElement(s),v(s,"bpmn:Group")&&c.addGroup(s))}),this.preExecute("label.create",function(a){var s=a.context.labelTarget;v(s,"bpmn:Group")&&r().addGroup(s)})}lp.$inject=["eventBus","modeling"],ae(lp,X);function FC(){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 pp(e,t){X.call(this,e),this.postExecuted("elements.create",function(n){const i=n.context,r=i.elements;for(const o of r)HC(o)&&!VC(o)&&t.updateProperties(o,{isForCompensation:void 0})})}ae(pp,X),pp.$inject=["eventBus","modeling"];function HC(e){const t=Z(e);return t&&t.isForCompensation}function zC(e){return e&&v(e,"bpmn:BoundaryEvent")&&po(e,"bpmn:CompensateEventDefinition")}function VC(e){return e.incoming.filter(n=>zC(n.source)).length>0}const GC={__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",_l],appendBehavior:["type",bl],associationBehavior:["type",wl],attachEventBehavior:["type",Ns],artifactBehavior:["type",xl],boundaryEventBehavior:["type",El],categoryRootElementReferenceBehavior:["type",Sl],compensateBoundaryEventBehaviour:["type",Rl],createBehavior:["type",Cl],createDataObjectBehavior:["type",Pl],createParticipantBehavior:["type",Ml],dataInputAssociationBehavior:["type",kl],dataStoreBehavior:["type",Dl],deleteLaneBehavior:["type",Ol],detachEventBehavior:["type",Gs],dropOnFlowBehavior:["type",Il],eventBasedGatewayBehavior:["type",Nl],fixHoverBehavior:["type",Bm],groupBehavior:["type",Bl],importDockingFix:["type",jm],isHorizontalFix:["type",jl],labelBehavior:["type",Hl],layoutConnectionBehavior:["type",zl],messageFlowBehavior:["type",Wl],nonInterruptingBehavior:["type",Ul],removeElementBehavior:["type",ql],removeEmbeddedLabelBoundsBehavior:["type",Yl],removeParticipantBehavior:["type",Kl],replaceConnectionBehavior:["type",Xl],replaceElementBehaviour:["type",Zs],resizeBehavior:["type",cg],resizeLaneBehavior:["type",hg],rootElementReferenceBehavior:["type",ep],spaceToolBehavior:["type",gg],subProcessPlaneBehavior:["type",Li],subProcessStartEventBehavior:["type",np],textAnnotationBehavior:["type",ip],toggleCollapseConnectionBehaviour:["type",rp],toggleElementCollapseBehaviour:["type",ap],unclaimIdBehavior:["type",sp],unsetDefaultFlowBehavior:["type",cp],updateFlowNodeRefsBehavior:["type",up],updateCategoryValueRefsBehavior:["type",lp],setCompensationActivityAfterPasteBehavior:["type",pp]};function fp(e){this._commandStack=e.get("commandStack",!1)}fp.$inject=["injector"],fp.prototype.allowed=function(e,t){var n=!0,i=this._commandStack;return i&&(n=i.canExecute(e,t)),n===void 0?!0:n};const yi={__init__:["rules"],rules:["type",fp]};function qn(e){X.call(this,e),this.init()}qn.$inject=["eventBus"],ae(qn,X),qn.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)})},qn.prototype.init=function(){};function Pg(e,t){var n=Qt(e,t,-15);return n!=="intersect"?n:null}function en(e){qn.call(this,e)}ae(en,qn),en.$inject=["eventBus"],en.prototype.init=function(){this.addRule("connection.start",function(e){var t=e.source;return WC(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 ic(t,n)}finally{r&&(n.parent=null)}}),this.addRule("connection.reconnect",function(e){var t=e.connection,n=e.source,i=e.target;return ic(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 Fg(t,n,i)}),this.addRule("elements.create",function(e){var t=e.elements,n=e.position,i=e.target;return ot(i)&&!rc(t,i)?!1:Cr(t,function(r){return ot(r)?ic(r.source,r.target,r):r.host?da(r,r.host,null,n):gp(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 Lg(a)&&!n.includes(a.host)})?!1:da(n,t,null,i)||$g(n,t,i)||jg(n,t)||rc(n,t)}),this.addRule("shape.create",function(e){return gp(e.shape,e.target,e.source,e.position)}),this.addRule("shape.attach",function(e){return da(e.shape,e.target,null,e.position)}),this.addRule("element.copy",function(e){var t=e.element,n=e.elements;return Wg(n,t)})},en.prototype.canConnectMessageFlow=Vg,en.prototype.canConnectSequenceFlow=Gg,en.prototype.canConnectDataAssociation=yp,en.prototype.canConnectAssociation=Hg,en.prototype.canConnectCompensationAssociation=zg,en.prototype.canMove=jg,en.prototype.canAttach=da,en.prototype.canReplace=$g,en.prototype.canDrop=wo,en.prototype.canInsert=rc,en.prototype.canCreate=gp,en.prototype.canConnect=ic,en.prototype.canResize=Fg,en.prototype.canCopy=Wg;function WC(e){return dp(e)?null:Le(e,["bpmn:FlowNode","bpmn:InteractionNode","bpmn:DataObjectReference","bpmn:DataStoreReference","bpmn:Group","bpmn:TextAnnotation"])}function dp(e){return!e||De(e)}function Ag(e){do{if(v(e,"bpmn:Process"))return Z(e);if(v(e,"bpmn:Participant"))return Z(e).processRef||Z(e)}while(e=e.parent)}function hp(e){return v(e,"bpmn:TextAnnotation")}function mp(e){return v(e,"bpmn:Group")&&!e.labelTarget}function Tg(e){return v(e,"bpmn:BoundaryEvent")&&vi(e,"bpmn:CompensateEventDefinition")}function nc(e){return Z(e).isForCompensation}function UC(e,t){var n=Ag(e),i=Ag(t);return n===i}function YC(e){return v(e,"bpmn:InteractionNode")&&!v(e,"bpmn:BoundaryEvent")&&(!v(e,"bpmn:Event")||v(e,"bpmn:ThrowEvent")&&Dg(e,"bpmn:MessageEventDefinition"))}function qC(e){return v(e,"bpmn:InteractionNode")&&!nc(e)&&(!v(e,"bpmn:Event")||v(e,"bpmn:CatchEvent")&&Dg(e,"bpmn:MessageEventDefinition"))&&!(v(e,"bpmn:BoundaryEvent")&&!vi(e,"bpmn:MessageEventDefinition"))}function Mg(e){for(var t=e;t=t.parent;){if(v(t,"bpmn:FlowElementsContainer"))return Z(t);if(v(t,"bpmn:Participant"))return Z(t).processRef}return null}function kg(e,t){var n=Mg(e),i=Mg(t);return n===i}function vi(e,t){var n=Z(e);return!!ut(n.eventDefinitions||[],function(i){return v(i,t)})}function Dg(e,t){var n=Z(e);return(n.eventDefinitions||[]).every(function(i){return v(i,t)})}function KC(e){return v(e,"bpmn:FlowNode")&&!v(e,"bpmn:EndEvent")&&!un(e)&&!(v(e,"bpmn:IntermediateThrowEvent")&&vi(e,"bpmn:LinkEventDefinition"))&&!Tg(e)&&!nc(e)}function XC(e){return v(e,"bpmn:FlowNode")&&!v(e,"bpmn:StartEvent")&&!v(e,"bpmn:BoundaryEvent")&&!un(e)&&!(v(e,"bpmn:IntermediateCatchEvent")&&vi(e,"bpmn:LinkEventDefinition"))&&!nc(e)}function ZC(e){return v(e,"bpmn:ReceiveTask")||v(e,"bpmn:IntermediateCatchEvent")&&(vi(e,"bpmn:MessageEventDefinition")||vi(e,"bpmn:TimerEventDefinition")||vi(e,"bpmn:ConditionalEventDefinition")||vi(e,"bpmn:SignalEventDefinition"))}function QC(e){for(var t=[];e;)e=e.parent,e&&t.push(e);return t}function Og(e,t){var n=QC(t);return n.indexOf(e)!==-1}function ic(e,t,n){if(dp(e)||dp(t))return null;if(!v(n,"bpmn:DataAssociation")){if(Vg(e,t))return{type:"bpmn:MessageFlow"};if(Gg(e,t))return{type:"bpmn:SequenceFlow"}}var i=yp(e,t);return i||(zg(e,t)?{type:"bpmn:Association",associationDirection:"One"}:Hg(e,t)?{type:"bpmn:Association",associationDirection:"None"}:!1)}function wo(e,t){return De(e)||mp(e)?!0:v(t,"bpmn:Participant")&&!$e(t)?!1:v(e,"bpmn:Participant")?v(t,"bpmn:Process")||v(t,"bpmn:Collaboration"):Le(e,["bpmn:DataInput","bpmn:DataOutput"])&&e.parent?t===e.parent:v(e,"bpmn:Lane")?v(t,"bpmn:Participant")||v(t,"bpmn:Lane"):v(e,"bpmn:BoundaryEvent")&&!JC(e)?!1:v(e,"bpmn:FlowElement")&&!v(e,"bpmn:DataStoreReference")?v(t,"bpmn:FlowElementsContainer")?$e(t):Le(t,["bpmn:Participant","bpmn:Lane"]):v(e,"bpmn:DataStoreReference")&&v(t,"bpmn:Collaboration")?Wi(Z(t).get("participants"),function(n){return!!n.get("processRef")}):Le(e,["bpmn:Artifact","bpmn:DataAssociation","bpmn:DataStoreReference"])?Le(t,["bpmn:Collaboration","bpmn:Lane","bpmn:Participant","bpmn:Process","bpmn:SubProcess"]):v(e,"bpmn:MessageFlow")?v(t,"bpmn:Collaboration")||e.source.parent==t||e.target.parent==t:!1}function JC(e){return Z(e).cancelActivity&&(Ig(e)||Ng(e))}function Lg(e){return!De(e)&&v(e,"bpmn:BoundaryEvent")}function eP(e){return v(e,"bpmn:Lane")}function tP(e){return Lg(e)||v(e,"bpmn:IntermediateThrowEvent")&&Ig(e)?!0:v(e,"bpmn:IntermediateCatchEvent")&&Ng(e)}function Ig(e){var t=Z(e);return t&&!(t.eventDefinitions&&t.eventDefinitions.length)}function Ng(e){return Bg(e,["bpmn:MessageEventDefinition","bpmn:TimerEventDefinition","bpmn:SignalEventDefinition","bpmn:ConditionalEventDefinition"])}function Bg(e,t){return t.some(function(n){return vi(e,n)})}function nP(e){return v(e,"bpmn:ReceiveTask")&&ut(e.incoming,function(t){return v(t.source,"bpmn:EventBasedGateway")})}function da(e,t,n,i){if(Array.isArray(e)||(e=[e]),e.length!==1)return!1;var r=e[0];return De(r)||!tP(r)||un(t)||!v(t,"bpmn:Activity")||nc(t)||i&&!Pg(i,t)||nP(t)?!1:"attach"}function $g(e,t,n){if(!t)return!1;var i={replacements:[]};return k(e,function(r){un(t)||v(r,"bpmn:StartEvent")&&r.type!=="label"&&wo(r,t)&&(pS(r)||i.replacements.push({oldElementId:r.id,newElementType:"bpmn:StartEvent"}),(fS(r)||dS(r)||hS(r))&&i.replacements.push({oldElementId:r.id,newElementType:"bpmn:StartEvent"}),Bg(r,["bpmn:MessageEventDefinition","bpmn:TimerEventDefinition","bpmn:SignalEventDefinition","bpmn:ConditionalEventDefinition"])&&v(t,"bpmn:SubProcess")&&i.replacements.push({oldElementId:r.id,newElementType:"bpmn:StartEvent"})),v(t,"bpmn:Transaction")||vi(r,"bpmn:CancelEventDefinition")&&r.type!=="label"&&(v(r,"bpmn:EndEvent")&&wo(r,t)&&i.replacements.push({oldElementId:r.id,newElementType:"bpmn:EndEvent"}),v(r,"bpmn:BoundaryEvent")&&da(r,t,null,n)&&i.replacements.push({oldElementId:r.id,newElementType:"bpmn:BoundaryEvent"}))}),i.replacements.length?i:!1}function jg(e,t){return Wi(e,eP)?!1:t===void 0?!0:t===null?!1:e.every(function(n){return wo(n,t)})}function gp(e,t,n,i){return t?De(e)||mp(e)?!0:wo(e,t)||rc(e,t):!1}function Fg(e,t,n){return v(e,"bpmn:SubProcess")?$e(e)&&(!t||t.width>=100&&t.height>=80):v(e,"bpmn:Lane")||v(e,"bpmn:Participant")?!0:hp(e)?n?n==="e"||n==="w":!0:mp(e)?!0:De(e)?n?n==="e"||n==="w":!0:!1}function iP(e,t){var n=hp(e),i=hp(t);return(n||i)&&n!==i}function Hg(e,t){return Og(t,e)||Og(e,t)?!1:iP(e,t)?!0:!!yp(e,t)}function zg(e,t){return kg(e,t)&&Tg(e)&&v(t,"bpmn:Activity")&&!oP(t,e)&&!un(t)}function Vg(e,t){return Yg(e)&&!Yg(t)?!1:YC(e)&&qC(t)&&!UC(e,t)}function Gg(e,t){return KC(e)&&XC(t)&&kg(e,t)&&!(v(e,"bpmn:EventBasedGateway")&&!ZC(t))}function yp(e,t){return Le(e,["bpmn:DataObjectReference","bpmn:DataStoreReference"])&&Le(t,["bpmn:Activity","bpmn:ThrowEvent"])?{type:"bpmn:DataInputAssociation"}:Le(t,["bpmn:DataObjectReference","bpmn:DataStoreReference"])&&Le(e,["bpmn:Activity","bpmn:CatchEvent"])?{type:"bpmn:DataOutputAssociation"}:!1}function rc(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:Le(t,["bpmn:SequenceFlow","bpmn:MessageFlow"])&&!De(t)&&v(e,"bpmn:FlowNode")&&!v(e,"bpmn:BoundaryEvent")&&wo(e,t.parent)}function vp(e,t){return e&&t&&e.indexOf(t)!==-1}function Wg(e,t){return De(t)?!0:!(v(t,"bpmn:Lane")&&!vp(e,t.parent)||v(t,"bpmn:MessageFlow")&&!rP(e,t))}function rP(e,t){var n=Ug(t.source),i=Ug(t.target);return vp(e,n)&&vp(e,i)}function Ug(e){for(;e;e=e.parent)if(v(e,"bpmn:Participant"))return e;return null}function Yg(e){return mo(e,"bpmn:Process")||mo(e,"bpmn:Collaboration")}function oP(e,t){return e.attachers.includes(t)}const aP={__depends__:[yi],__init__:["bpmnRules"],bpmnRules:["type",en]};var sP=2e3;function qg(e,t){e.on("saveXML.start",sP,n);function n(){var i=t.getRootElements();k(i,function(r){var o=Ge(r),a,s;a=Xo([r]),a=Ie(a,function(c){return c!==r&&!c.labelTarget}),s=on(a,Ge),o.set("planeElement",s)})}}qg.$inject=["eventBus","canvas"];const cP={__init__:["bpmnDiOrdering"],bpmnDiOrdering:["type",qg]};function oc(e){X.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)})}oc.prototype.getOrdering=function(e,t){return null},ae(oc,X);function _p(e,t){oc.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=ut(n,function(c){return Le(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&&!Le(u,c);)u=u.parent;if(!u)throw new Error(`no parent for <${a.id}> in <${s&&s.id}>`);return u}this.getOrdering=function(a,s){if(a.labelTarget||v(a,"bpmn:TextAnnotation"))return{parent:t.findRoot(s)||t.getRootElement(),index:-1};var c=r(a);c.containers&&(s=o(a,s,c.containers));var u=s.children.indexOf(a),l=Kf(s.children,function(f){return!a.labelTarget&&f.labelTarget?!1:c.level<r(f).level});return l!==-1&&u!==-1&&u<l&&(l-=1),{index:l,parent:s}}}_p.$inject=["eventBus","canvas"],ae(_p,oc);const uP={__init__:["bpmnOrderingProvider"],bpmnOrderingProvider:["type",_p]};function ha(){}ha.prototype.get=function(){return this._data},ha.prototype.set=function(e){this._data=e},ha.prototype.clear=function(){var e=this._data;return delete this._data,e},ha.prototype.isEmpty=function(){return!this._data};const lP={clipboard:["type",ha]};var Kg=1500;function Xg(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",Kg,function(s){o(s)})}),(function(){var a,s;t.on("element.hover",function(c){a=c.gfx,s=c.element}),t.on("element.hover",Kg,function(c){s&&t.fire("element.out",{element:s,gfx:a})}),t.on("element.out",function(){a=null,s=null})})(),this._findTargetGfx=function(a){var s,c;if(a instanceof MouseEvent)return s=$r(a),c=document.elementFromPoint(s.x,s.y),pP(c)}}Xg.$inject=["elementRegistry","eventBus","injector"];function pP(e){return Dr(e,"svg, .djs-element",!0)}const fP={__init__:["hoverFix"],hoverFix:["type",Xg]};function dP(e){return!0}function ac(e){return cr(e)||vC(e)}var Zg=500;function Qg(e,t,n){var i=this;function r(T,H,V){if(!s(T,H)){var $,G,he;V?G=t.getGraphics(V):($=H.delegateTarget||H.target,$&&(G=$,V=t.get(G))),!(!G||!V)&&(he=e.fire(T,{element:V,gfx:G,originalEvent:H}),he===!1&&(H.stopPropagation(),H.preventDefault()))}}var o={};function a(T){return o[T]}function s(T,H){var V=u[T]||cr;return!V(H)}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":dP,"element.mousedown":ac,"element.mouseup":ac,"element.click":ac,"element.dblclick":ac};function l(T,H,V){var $=c[T];if(!$)throw new Error("unmapped DOM event name <"+T+">");return r($,H,V)}var f="svg, .djs-element";function p(T,H,V,$){var G=o[V]=function(he){r(V,he)};$&&(u[V]=$),G.$delegate=Cn.bind(T,f,H,G)}function d(T,H,V){var $=a(V);$&&Cn.unbind(T,H,$.$delegate)}function h(T){k(c,function(H,V){p(T,V,H)})}function m(T){k(c,function(H,V){d(T,V,H)})}e.on("canvas.destroy",function(T){m(T.svg)}),e.on("canvas.init",function(T){h(T.svg)}),e.on(["shape.added","connection.added"],function(T){var H=T.element,V=T.gfx;e.fire("interactionEvents.createHit",{element:H,gfx:V})}),e.on(["shape.changed","connection.changed"],Zg,function(T){var H=T.element,V=T.gfx;e.fire("interactionEvents.updateHit",{element:H,gfx:V})}),e.on("interactionEvents.createHit",Zg,function(T){var H=T.element,V=T.gfx;i.createDefaultHit(H,V)}),e.on("interactionEvents.updateHit",function(T){var H=T.element,V=T.gfx;i.updateDefaultHit(H,V)});var g=S("djs-hit djs-hit-stroke"),R=S("djs-hit djs-hit-click-stroke"),w=S("djs-hit djs-hit-all"),b=S("djs-hit djs-hit-no-move"),x={all:w,"click-stroke":R,stroke:g,"no-move":b};function S(T,H){return H=L({stroke:"white",strokeWidth:15},H||{}),n.cls(T,["no-fill","no-border"],H)}function M(T,H){var V=x[H];if(!V)throw new Error("invalid hit type <"+H+">");return se(T,V),T}function N(T,H){Ae(T,H)}this.removeHits=function(T){var H=ys(".djs-hit",T);k(H,zt)},this.createDefaultHit=function(T,H){var V=T.waypoints,$=T.isFrame,G;return V?this.createWaypointsHit(H,V):(G=$?"stroke":"all",this.createBoxHit(H,G,{width:T.width,height:T.height}))},this.createWaypointsHit=function(T,H){var V=Ko(H);return M(V,"stroke"),N(T,V),V},this.createBoxHit=function(T,H,V){V=L({x:0,y:0},V);var $=ye("rect");return M($,H),se($,V),N(T,$),$},this.updateDefaultHit=function(T,H){var V=nt(".djs-hit",H);if(V)return T.waypoints?ol(V,T.waypoints):se(V,{width:T.width,height:T.height}),V},this.fire=r,this.triggerMouseEvent=l,this.mouseHandler=a,this.registerEvent=p,this.unregisterEvent=d}Qg.$inject=["eventBus","elementRegistry","styles"];const sc={__init__:["interactionEvents"],interactionEvents:["type",Qg]};function Eo(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)})}Eo.$inject=["eventBus","canvas"],Eo.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()})}},Eo.prototype.get=function(){return Array.from(this._selectedElements)},Eo.prototype.isSelected=function(e){return this._selectedElements.has(e)},Eo.prototype.select=function(e,t){var n=this.get();xe(e)||(e=e?[e]:[]);var i=this._canvas,r=i.getRootElement();e=e.filter(function(o){var a=i.findRoot(o);return r===a}),t?k(e,o=>{this._selectedElements.add(o)}):this._selectedElements=new Set(e),this._eventBus.fire("selection.changed",{oldSelection:n,newSelection:this.get()})};var Jg="hover",ey="selected";function ty(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,Jg)}),t.on("element.out",function(r){i(r.element,Jg)}),t.on("selection.changed",function(r){function o(u){i(u,ey)}function a(u){n(u,ey)}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)})}ty.$inject=["canvas","eventBus"];function ny(e,t,n,i){e.on("create.end",500,function(r){var o=r.context,a=o.canExecute,s=o.elements,c=o.hints||{},u=c.autoSelect;if(a){if(u===!1)return;xe(u)?t.select(u):t.select(s.filter(hP))}}),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=ut(o,function(c){return a.id===c.id});s||t.select(a)}),e.on("element.click",function(r){if(cr(r)){var o=r.element;o===n.getRootElement()&&(o=null);var a=t.isSelected(o),s=t.get().length>1,c=ec(r);if(a&&s)return c?t.deselect(o):t.select(o);a?t.deselect(o):t.select(o,c)}})}ny.$inject=["eventBus","selection","canvas","elementRegistry"];function hP(e){return!e.hidden}const Kn={__init__:["selectionVisuals","selectionBehavior"],__depends__:[sc],selection:["type",Eo],selectionVisuals:["type",ty],selectionBehavior:["type",ny]};var mP=/^djs-cursor-.*$/;function cc(e){var t=mt(document.body);t.removeMatching(mP),e&&t.add("djs-cursor-"+e)}function iy(){cc(null)}var gP=5e3;function ry(e,t){t=t||"element.click";function n(){return!1}return e.once(t,gP,n),function(){e.off(t,n)}}var yP=["c","C"],vP=["v","V"],_P=["d","D"],bP=["x","X"],xP=["y","Y"],oy=["z","Z"];function wP(e){return e.ctrlKey||e.metaKey||e.shiftKey||e.altKey}function Tn(e){return e.altKey?!1:e.ctrlKey||e.metaKey}function Vt(e,t){return e=xe(e)?e:[e],e.indexOf(t.key)!==-1||e.indexOf(t.code)!==-1}function bp(e){return e.shiftKey}function EP(e){return Tn(e)&&Vt(yP,e)}function SP(e){return Tn(e)&&Vt(vP,e)}function RP(e){return Tn(e)&&Vt(_P,e)}function CP(e){return Tn(e)&&Vt(bP,e)}function PP(e){return Tn(e)&&!bp(e)&&Vt(oy,e)}function AP(e){return Tn(e)&&(Vt(xP,e)||Vt(oy,e)&&bp(e))}var So=Math.round,ay="djs-drag-active";function Fr(e){e.preventDefault()}function TP(e){return typeof TouchEvent<"u"&&e instanceof TouchEvent}function MP(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}function sy(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(L({},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,M=o.displacement,N=o.globalStart,T=$r(b),H=ri(T,N),V=o.localStart,$=a(T),G=ri($,V);if(!o.active&&(x||MP(H)>o.threshold)){if(L(S,{x:So(V.x+M.x),y:So(V.y+M.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&&cc(o.cursor),t.addMarker(t.getRootElement(),ay)}Jl(b),o.active&&(L(S,{x:So($.x+M.x),y:So($.y+M.y),dx:So(G.x),dy:So(G.y)},{originalEvent:b}),s("move"))}function l(b){var x,S=!0;o.active&&(b&&(o.payload.originalEvent=b,Jl(b)),S=s("end")),S===!1&&s("rejected"),x=R(S!==!0),s("ended",x)}function f(b){Vt("Escape",b)&&(Fr(b),g())}function p(b){var x;o.active&&(x=ry(e),setTimeout(x,400),Fr(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=R(b),S&&s("canceled",x)}}function R(b){var x,S;s("cleanup"),iy(),o.trapClick?S=p:S=l,Pe.unbind(document,"mousemove",u),Pe.unbind(document,"dragstart",Fr),Pe.unbind(document,"selectstart",Fr),Pe.unbind(document,"mousedown",S,!0),Pe.unbind(document,"mouseup",S,!0),Pe.unbind(document,"keyup",f),Pe.unbind(document,"touchstart",d,!0),Pe.unbind(document,"touchcancel",g,!0),Pe.unbind(document,"touchmove",u,!0),Pe.unbind(document,"touchend",l,!0),e.off("element.hover",h),e.off("element.out",m),t.removeMarker(t.getRootElement(),ay);var M=o.payload.previousSelection;return b!==!1&&M&&!n.get().length&&c(M),x=o,o=null,x}function w(b,x,S,M){o&&g(!1),typeof x=="string"&&(M=S,S=x,x=null),M=L({},r,M||{});var N=M.data||{},T,H,V,$,G;if(M.trapClick?$=p:$=l,b?(T=xo(b)||b,H=$r(b),Jl(b),T.type==="dragstart"&&Fr(T)):(T=null,H={x:0,y:0}),V=a(H),x||(x=V),G=TP(T),o=L({prefix:S,data:N,payload:{},globalStart:H,displacement:ri(x,V),localStart:V,isTouch:G},M),M.manual||(G?(Pe.bind(document,"touchstart",d,!0),Pe.bind(document,"touchcancel",g,!0),Pe.bind(document,"touchmove",u,!0),Pe.bind(document,"touchend",l,!0)):(Pe.bind(document,"mousemove",u),Pe.bind(document,"dragstart",Fr),Pe.bind(document,"selectstart",Fr),Pe.bind(document,"mousedown",$,!0),Pe.bind(document,"mouseup",$,!0)),Pe.bind(document,"keyup",f),e.on("element.hover",h),e.on("element.out",m)),s("init")===!1)return g(),!1;M.autoActivate&&u(b,!0)}e.on("diagram.destroy",g),this.init=w,this.move=u,this.hover=h,this.out=m,this.end=l,this.cancel=g,this.context=function(){return o},this.setOptions=function(b){L(r,b)}}sy.$inject=["eventBus","canvas","selection","elementRegistry"];const Ii={__depends__:[fP,Kn],dragging:["type",sy]};function Ro(e){this._counter=0,this._prefix=(e?e+"-":"")+Math.floor(Math.random()*1e9)+"-"}Ro.prototype.next=function(){return this._prefix+ ++this._counter};const kP=new Ro("ps");var DP=["marker-start","marker-mid","marker-end"],OP=["circle","ellipse","line","path","polygon","polyline","path","rect"];function ur(e,t,n,i){this._elementRegistry=e,this._canvas=n,this._styles=i}ur.$inject=["elementRegistry","eventBus","canvas","styles"],ur.prototype.cleanUp=function(){console.warn("PreviewSupport#cleanUp is deprecated and will be removed in future versions. You do not need to manually clean up previews anymore. cf. https://github.com/bpmn-io/diagram-js/pull/906")},ur.prototype.getGfx=function(e){return this._elementRegistry.getGraphics(e)},ur.prototype.addDragger=function(e,t,n,i="djs-dragger"){n=n||this.getGfx(e);var r=bh(n);return this._cloneMarkers(Ir(r),i),se(r,this._styles.cls(i,[])),Ae(t,r),se(r,"data-preview-support-element-id",e.id),r},ur.prototype.addFrame=function(e,t){var n=ye("rect",{class:"djs-resize-overlay",width:e.width,height:e.height,x:e.x,y:e.y});return Ae(t,n),se(n,"data-preview-support-element-id",e.id),n},ur.prototype._cloneMarkers=function(e,t="djs-dragger",n=e){var i=this;e.childNodes&&e.childNodes.forEach(r=>{i._cloneMarkers(r,t,n)}),BP(e)&&DP.forEach(function(r){if(se(e,r)){var o=LP(e,r,i._canvas.getContainer());o&&i._cloneMarker(n,e,o,r,t)}})},ur.prototype._cloneMarker=function(e,t,n,i,r="djs-dragger"){var o=[n.id,r,kP.next()].join("-"),a=nt("marker#"+n.id,e);e=e||this._canvas._svg;var s=a||bh(n);s.id=o,je(s).add(r);var c=nt(":scope > defs",e);c||(c=ye("defs"),Ae(e,c)),Ae(c,s);var u=NP(s.id);se(t,i,u)};function LP(e,t,n){var i=IP(se(e,t));return nt("marker#"+i,n||document)}function IP(e){return e.match(/url\(['"]?#([^'"]*)['"]?\)/)[1]}function NP(e){return"url(#"+e+")"}function BP(e){return OP.indexOf(e.nodeName)!==-1}const Co={__init__:["previewSupport"],previewSupport:["type",ur]};var $P="drop-ok",cy="drop-not-ok",uy="attach-ok",ly="new-parent",py="create",jP=2e3;function fy(e,t,n,i,r){function o(c,u,l,f,p){if(!u)return!1;c=Ie(c,function(w){var b=w.labelTarget;return!w.parent&&!(De(w)&&c.indexOf(b)!==-1)});var d=ut(c,function(w){return!ot(w)}),h=!1,m=!1,g=!1;hy(c)&&(h=r.allowed("shape.attach",{position:l,shape:d,target:u})),h||(hy(c)?g=r.allowed("shape.create",{position:l,shape:d,source:f,target:u}):g=r.allowed("elements.create",{elements:c,position:l,target:u}));var R=p.connectionTarget;return g||h?(d&&f&&(m=r.allowed("connection.create",{source:R===f?d:f,target:R===f?f:d,hints:{targetParent:u,targetAttach:h}})),{attach:h,connect:m}):g===null||h===null?null:!1}function a(c,u){[uy,$P,cy,ly].forEach(function(l){l===u?e.addMarker(c,l):e.removeMarker(c,l)})}n.on(["create.move","create.hover"],function(c){var u=c.context,l=u.elements,f=c.hover,p=u.source,d=u.hints||{};if(!f){u.canExecute=!1,u.target=null;return}dy(c);var h={x:c.x,y:c.y},m=u.canExecute=f&&o(l,f,h,p,d);f&&m!==null&&(u.target=f,m&&m.attach?a(f,uy):a(f,m?ly:cy))}),n.on(["create.end","create.out","create.cleanup"],function(c){var u=c.hover;u&&a(u,null)}),n.on("create.end",function(c){var u=c.context,l=u.source,f=u.shape,p=u.elements,d=u.target,h=u.canExecute,m=h&&h.attach,g=h&&h.connect,R=u.hints||{};if(h===!1||!d)return!1;dy(c);var w={x:c.x,y:c.y};g?f=i.appendShape(l,f,w,d,{attach:m,connection:g===!0?{}:g,connectionTarget:R.connectionTarget}):(p=i.createElements(p,w,d,L({},R,{attach:m})),f=ut(p,function(b){return!ot(b)})),L(u,{elements:p,shape:f}),L(c,{elements:p,shape:f})});function s(){var c=t.context();c&&c.prefix===py&&t.cancel()}n.on("create.init",function(){n.on("elements.changed",s),n.once(["create.cancel","create.end"],jP,function(){n.off("elements.changed",s)})}),this.start=function(c,u,l){xe(u)||(u=[u]);var f=ut(u,function(h){return!ot(h)});if(f){l=L({elements:u,hints:{},shape:f},l||{}),k(u,function(h){Ce(h.x)||(h.x=0),Ce(h.y)||(h.y=0)});var p=Ie(u,function(h){return!h.hidden}),d=Tt(p);k(u,function(h){ot(h)&&(h.waypoints=on(h.waypoints,function(m){return{x:m.x-d.x-d.width/2,y:m.y-d.y-d.height/2}})),L(h,{x:h.x-d.x-d.width/2,y:h.y-d.y-d.height/2})}),t.init(c,py,{cursor:"grabbing",autoActivate:!0,data:{shape:f,elements:u,context:l}})}}}fy.$inject=["canvas","dragging","eventBus","modeling","rules"];function dy(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 hy(e){return e&&e.length===1&&!ot(e[0])}var FP=750;function my(e,t,n,i,r){function o(a){var s=ye("g");se(s,r.cls("djs-drag-group",["no-events"]));var c=ye("g");return a.forEach(function(u){var l;u.hidden||(u.waypoints?(l=n._createContainer("connection",c),n.drawConnection(Ir(l),u)):(l=n._createContainer("shape",c),n.drawShape(Ir(l),u),Jt(l,u.x,u.y)),i.addDragger(u,s,l))}),s}t.on("create.move",FP,function(a){var s=a.hover,c=a.context,u=c.elements,l=c.dragGroup;l||(l=c.dragGroup=o(u));var f;s?(l.parentNode||(f=e.getActiveLayer(),Ae(f,l)),Jt(l,a.x,a.y)):zt(l)}),t.on("create.cleanup",function(a){var s=a.context,c=s.dragGroup;c&&zt(c)})}my.$inject=["canvas","eventBus","graphicsFactory","previewSupport","styles"];const uc={__depends__:[Ii,Co,yi,Kn],__init__:["create","createPreview"],create:["type",fy],createPreview:["type",my]};function xp(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)})}xp.$inject=["eventBus"],xp.prototype.getLastMoveEvent=function(){return this._lastMoveEvent||HP(0,0)};function HP(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 ma={__init__:["mouse"],mouse:["type",xp]};var gy=2e3;function Mn(e,t,n,i,r,o,a,s){this._canvas=e,this._create=t,this._elementFactory=i,this._eventBus=r,this._modeling=o,this._mouse=a,this._rules=s,r.on("copyPaste.copyElement",function(c){var u=c.descriptor,l=c.element,f=c.elementsSet;u.priority=1,u.id=l.id,f.has(l.parent)&&(u.parent=l.parent.id),zP(l)&&(u.priority=2,u.host=l.host.id),ot(l)&&(u.priority=3,u.source=l.source.id,u.target=l.target.id,u.waypoints=VP(l)),De(l)&&(u.priority=4,u.labelTarget=l.labelTarget.id),k(["x","y","width","height"],function(p){Ce(l[p])&&(u[p]=l[p])}),u.hidden=l.hidden,u.collapsed=l.collapsed}),r.on("copyPaste.elementsCopied",gy,function(c){var u;((u=c.hints)==null?void 0:u.clip)!==!1&&n.set(c.tree)}),r.on("copyPaste.pasteElements",gy,function(c){c.tree||(c.tree=n.get())}),r.on("copyPaste.pasteElements",function(c){var u=c.hints;L(u,{createElementsBehavior:!1})})}Mn.$inject=["canvas","create","clipboard","elementFactory","eventBus","modeling","mouse","rules"],Mn.prototype.copy=function(e,t={}){var n,i;return xe(e)||(e=e?[e]:[]),n=this._eventBus.fire("copyPaste.canCopyElements",{elements:e}),n===!1?i={}:i=this.createTree(xe(n)?n:e),this._eventBus.fire("copyPaste.elementsCopied",{elements:e,tree:i,hints:t}),i},Mn.prototype.paste=function(e={}){var t=this._eventBus.createEvent({type:"copyPaste.pasteElements",hints:{},...e}),n=this._eventBus.fire(t);if(n!==!1){var i=t.tree;if(i){var r=t.hints,o=this._createElements(i);if(t.element&&t.point)return this._paste(o,t.element,t.point,r);this._create.start(this._mouse.getLastMoveEvent(),o,{hints:r})}}},Mn.prototype.duplicate=function(e,t={}){var n=this.copy(e,{clip:!1});return this.paste({...t,tree:n})},Mn.prototype.cut=function(e){var t=this.copy(e),n=this._getElementIdsFromTree(t),i=e.filter(function(r){return n[r.id]});return i.length>0&&this._modeling.removeElements(i),t},Mn.prototype._getElementIdsFromTree=function(e){var t={};return k(e,function(n){k(n,function(i){i.id&&(t[i.id]=!0)})}),t},Mn.prototype._paste=function(e,t,n,i){k(e,function(o){Ce(o.x)||(o.x=0),Ce(o.y)||(o.y=0)});var r=Tt(e);return k(e,function(o){ot(o)&&(o.waypoints=on(o.waypoints,function(a){return{x:a.x-r.x-r.width/2,y:a.y-r.y-r.height/2}})),L(o,{x:o.x-r.x-r.width/2,y:o.y-r.y-r.height/2})}),this._modeling.createElements(e,n,t,L({},i))},Mn.prototype._createElements=function(e){var t=this,n=this._eventBus,i={},r=[];return k(e,function(o,a){o=ai(o,"priority"),k(o,function(s){var c=L({},si(s,["priority"]));i[s.parent]?c.parent=i[s.parent]:delete c.parent,n.fire("copyPaste.pasteElement",{cache:i,descriptor:c});var u;if(ot(c)){c.source=i[s.source],c.target=i[s.target],u=i[s.id]=t.createConnection(c),r.push(u);return}if(De(c)){c.labelTarget=i[c.labelTarget],u=i[s.id]=t.createLabel(c),r.push(u);return}c.host&&(c.host=i[c.host]),u=i[s.id]=t.createShape(c),r.push(u)})}),r},Mn.prototype.createConnection=function(e){var t=this._elementFactory.createConnection(si(e,["id"]));return t},Mn.prototype.createLabel=function(e){var t=this._elementFactory.createLabel(si(e,["id"]));return t},Mn.prototype.createShape=function(e){var t=this._elementFactory.createShape(si(e,["id"]));return t},Mn.prototype.hasRelations=function(e,t,n){return n||(n=new Set(t)),!(ot(e)&&(!n.has(e.source)||!n.has(e.target))||De(e)&&!n.has(e.labelTarget))},Mn.prototype.createTree=function(e){var t=this._rules,n=this,i={},r=[],o=new Map,a=xs(e);function s(f,p){return t.allowed("element.copy",{element:f,elements:p})}function c(f,p){var d=o.get(f);if(!d){var h={element:f,depth:p};r.push(h),o.set(f,h);return}if(d.depth<p){r=u(d,r);var m={element:d.element,depth:p};r.push(m),o.set(f,m)}}function u(f,p){var d=p.indexOf(f);return d!==-1&&p.splice(d,1),p}Lr(a,function(f,p,d){if(De(f))return;k(f.labels,function(g){c(g,d)});function h(g){g&&g.length&&k(g,function(R){k(R.labels,function(w){c(w,d)}),c(R,d)})}k([f.attachers,f.incoming,f.outgoing],h),c(f,d);var m=[];return f.children&&(m=f.children.slice()),n._eventBus.fire("copyPaste.createTree",{element:f,children:m}),m}),e=on(r,function(f){return f.element});var l=new Set(e);return r=on(r,function(f){return f.descriptor={},n._eventBus.fire("copyPaste.copyElement",{descriptor:f.descriptor,element:f.element,elements:e,elementsSet:l}),f}),r=ai(r,function(f){return f.descriptor.priority}),e=on(r,function(f){return f.element}),k(r,function(f){var p=f.depth;if(!n.hasRelations(f.element,e,l)){vy(f.element,e),l.delete(f.element);return}if(!s(f.element,e)){vy(f.element,e),l.delete(f.element);return}i[p]||(i[p]=[]),i[p].push(f.descriptor)}),i};function zP(e){return!!e.host}function VP(e){return on(e.waypoints,function(t){return t=yy(t),t.original&&(t.original=yy(t.original)),t})}function yy(e){return L({},e)}function vy(e,t){var n=t.indexOf(e);return n===-1?t:t.splice(n,1)}const GP={__depends__:[lP,uc,ma,yi],__init__:["copyPaste"],copyPaste:["type",Mn]};function wp(e,t,n){xe(n)||(n=[n]),k(n,function(i){Rr(e[i])||(t[i]=e[i])})}var Ep=750;function _y(e,t,n){function i(c,u){var l=e.create(c.$type);return n.copyElement(c,l,null,u)}t.on("copyPaste.copyElement",Ep,function(c){var u=c.descriptor,l=c.element,f=Z(l);if(De(l))return u;var p=u.businessObject=i(f,!0),d=u.di=i(Ge(l),!0);d.bpmnElement=p,wp(p,u,"name"),wp(d,u,"isExpanded"),f.default&&(u.default=f.default.id)});var r="-bpmn-js-refs";function o(c){return c[r]=c[r]||{}}function a(c,u){c[r]=u}function s(c,u,l){var f=Z(c);return c.default&&(l[c.default]={element:f,property:"default"}),c.host&&(Z(c).attachedToRef=Z(u[c.host])),si(l,Sn(l,function(p,d,h){var m=d.element,g=d.property;return h===c.id&&(m.set(g,f),p.push(c.id)),p},[]))}t.on("copyPaste.pasteElement",function(c){var u=c.cache,l=c.descriptor,f=l.businessObject,p=l.di;if(De(l)){l.businessObject=Z(u[l.labelTarget]),l.di=Ge(u[l.labelTarget]);return}f=l.businessObject=i(f),p=l.di=i(p),p.bpmnElement=f,wp(l,f,["isExpanded","name"]),l.type=f.$type}),t.on("copyPaste.copyElement",Ep,function(c){var u=c.descriptor,l=c.element;if(v(l,"bpmn:Participant")){var f=Z(l);f.processRef&&(u.processRef=i(f.processRef,!0))}}),t.on("copyPaste.pasteElement",function(c){var u=c.descriptor,l=u.processRef;l&&(u.processRef=i(l))}),t.on("copyPaste.createTree",function(c){var u=c.element,l=c.children;v(u,"bpmn:SubProcess")&&k(na(l),f=>{l.push(f.annotation)})}),t.on("copyPaste.pasteElement",Ep,function(c){var u=c.cache,l=c.descriptor;a(u,s(l,u,o(u)))})}_y.$inject=["bpmnFactory","eventBus","moddleCopy"];const WP=["artifacts","dataInputAssociations","dataOutputAssociations","default","flowElements","lanes","incoming","outgoing","categoryValue"],UP=["errorRef","escalationRef","messageRef","signalRef","dataObjectRef"];function ga(e,t,n){this._bpmnFactory=t,this._eventBus=e,this._moddle=n,e.on("moddleCopy.canCopyProperties",i=>{const{propertyNames:r}=i;if(!(!r||!r.length))return ai(r,o=>o==="extensionElements")}),e.on("moddleCopy.canCopyProperty",i=>{const{parent:r,property:o,propertyName:a}=i,s=Ut(r)&&r.$descriptor;if(a&&UP.includes(a))return o;if(a&&WP.includes(a)||a&&s&&!ut(s.properties,eo({name:a})))return!1}),e.on("moddleCopy.canSetCopiedProperty",i=>{const{property:r}=i;if(v(r,"bpmn:ExtensionElements")&&(!r.values||!r.values.length))return!1})}ga.$inject=["eventBus","bpmnFactory","moddle"],ga.prototype.copyElement=function(e,t,n,i=!1){n&&!xe(n)&&(n=[n]),n=n||Sp(e.$descriptor);const r=this._eventBus.fire("moddleCopy.canCopyProperties",{propertyNames:n,sourceElement:e,targetElement:t,clone:i});return r===!1||(xe(r)&&(n=r),k(n,o=>{let a;En(e,o)&&(a=e.get(o));const s=this.copyProperty(a,t,o,i);!jt(s)||this._eventBus.fire("moddleCopy.canSetCopiedProperty",{parent:t,property:s,propertyName:o})===!1||t.set(o,s)})),t},ga.prototype.copyProperty=function(e,t,n,i=!1){let r=this._eventBus.fire("moddleCopy.canCopyProperty",{parent:t,property:e,propertyName:n,clone:i});if(r===!1)return;if(r)return Ut(r)&&r.$type&&!r.$parent&&(r.$parent=t),r;const o=this._moddle.getPropertyDescriptor(t,n);if(!o.isReference)return o.isId?e&&this._copyId(e,t,i):xe(e)?Sn(e,(a,s)=>{const c=this.copyProperty(s,t,n,i);return c?a.concat(c):a},[]):Ut(e)&&e.$type?this._moddle.getElementDescriptor(e).isGeneric?void 0:(r=this._bpmnFactory.create(e.$type),r.$parent=t,r=this.copyElement(e,r,null,i),r):e},ga.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 Sp(e,t){return Sn(e.properties,(n,i)=>t&&i.default?n:n.concat(i.name),[])}const by={__depends__:[GP],__init__:["bpmnCopyPaste","moddleCopy"],bpmnCopyPaste:["type",_y],moddleCopy:["type",ga]};var xy=Math.round;function Rp(e,t){this._modeling=e,this._eventBus=t}Rp.$inject=["modeling","eventBus"],Rp.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=xy(s+o/2),l=xy(c+a/2),f=i.replaceShape(e,L({},t,{x:u,y:l,width:o,height:a}),n);return r.fire("replace.end",{element:e,newElement:f,hints:n}),f};function wy(e,t){t.on("replace.end",500,function(n){const{newElement:i,hints:r={}}=n;r.select!==!1&&e.select(i)})}wy.$inject=["selection","eventBus"];const YP={__init__:["replace","replaceSelectionBehavior"],replaceSelectionBehavior:["type",wy],replace:["type",Rp]};function qP(e,t,n){xe(n)||(n=[n]),k(n,function(i){Rr(e[i])||(t[i]=e[i])})}var KP=["cancelActivity","instantiate","eventGatewayType","triggeredByEvent","isInterrupting"];function XP(e,t){var n=e&&En(e,"collapsed")?e.collapsed:!$e(e),i;return t&&(En(t,"collapsed")||En(t,"isExpanded"))?i=En(t,"collapsed")?t.collapsed:!t.isExpanded:i=n,n!==i}function Ey(e,t,n,i,r,o){function a(s,c,u){u=u||{};var l=c.type,f=s.businessObject;if(lc(f)&&(l==="bpmn:SubProcess"||l==="bpmn:AdHocSubProcess")&&XP(s,c))return i.toggleCollapse(s),s;var p=e.create(l),d={type:l,businessObject:p};d.di={},l==="bpmn:ExclusiveGateway"&&(d.di.isMarkerVisible=!0),qP(s.di,d.di,["fill","stroke","background-color","border-color","color"]);var h=Sp(f.$descriptor),m=Sp(p.$descriptor,!0),g=ZP(h,m);L(p,ii(c,KP));var R=Ie(g,function(x){return x==="eventDefinitions"?Sy(s,c.eventDefinitionType):x==="loopCharacteristics"?!un(p):En(p,x)||x==="processRef"&&c.isExpanded===!1||x==="triggeredByEvent"?!1:x==="isForCompensation"?!un(p):!0});if(p=n.copyElement(f,p,R),c.eventDefinitionType&&(Sy(p,c.eventDefinitionType)||(d.eventDefinitionType=c.eventDefinitionType,d.eventDefinitionAttrs=c.eventDefinitionAttrs)),v(f,"bpmn:Activity")){if(lc(f))d.isExpanded=$e(s);else if(c&&En(c,"isExpanded")){d.isExpanded=c.isExpanded;var w=t.getDefaultSize(p,{isExpanded:d.isExpanded});d.width=w.width,d.height=w.height,d.x=s.x-(d.width-s.width)/2,d.y=s.y-(d.height-s.height)/2}$e(s)&&!v(f,"bpmn:Task")&&d.isExpanded&&(d.width=s.width,d.height=s.height)}if(lc(f)&&!lc(p)&&(u.moveChildren=!1),v(f,"bpmn:Participant")){c.isExpanded===!0?p.processRef=e.create("bpmn:Process"):u.moveChildren=!1;var b=qt(s);Ge(s).isHorizontal||(Ge(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:p})||(d.height=t.getDefaultSize(d).height,d.width=t.getDefaultSize(d).width),p.name=f.name,Le(f,["bpmn:ExclusiveGateway","bpmn:InclusiveGateway","bpmn:Activity"])&&Le(p,["bpmn:ExclusiveGateway","bpmn:InclusiveGateway","bpmn:Activity"])&&(p.default=f.default),c.host&&!v(f,"bpmn:BoundaryEvent")&&v(p,"bpmn:BoundaryEvent")&&(d.host=c.host),(d.type==="bpmn:DataStoreReference"||d.type==="bpmn:DataObjectReference")&&(d.x=s.x+(s.width-d.width)/2),r.replaceElement(s,d,{...u,targetElement:c})}this.replaceElement=a}Ey.$inject=["bpmnFactory","elementFactory","moddleCopy","modeling","replace","rules"];function lc(e){return v(e,"bpmn:SubProcess")}function Sy(e,t){var n=Z(e);return t&&n.get("eventDefinitions").some(function(i){return v(i,t)})}function ZP(e,t){return e.filter(function(n){return t.includes(n)})}const Ry={__depends__:[by,YP,Kn],bpmnReplace:["type",Ey]};var QP=250;function Hr(e){this._eventBus=e,this._tools=[],this._active=null}Hr.$inject=["eventBus"],Hr.prototype.registerTool=function(e,t){var n=this._tools;if(!t)throw new Error(`A tool has to be registered with it's "events"`);n.push(e),this.bindEvents(e,t)},Hr.prototype.isActive=function(e){return e&&this._active===e},Hr.prototype.length=function(e){return this._tools.length},Hr.prototype.setActive=function(e){var t=this._eventBus;this._active!==e&&(this._active=e,t.fire("tool-manager.update",{tool:e}))},Hr.prototype.bindEvents=function(e,t){var n=this._eventBus,i=[];n.on(t.tool+".init",function(r){var o=r.context;if(!o.reactivate&&this.isActive(e)){this.setActive(null);return}this.setActive(e)},this),k(t,function(r){i.push(r+".ended"),i.push(r+".canceled")}),n.on(i,QP,function(r){this._active&&(JP(r)||this.setActive(null))},this)};function JP(e){var t=e.originalEvent&&e.originalEvent.target;return t&&Dr(t,'.group[data-group="tools"]')}const pc={__depends__:[Ii],__init__:["toolManager"],toolManager:["type",Hr]};function eA(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 tA(e,t){var n=[],i=new Set(e);k(t,function(o){i.add(o)});var r=new Set;return i.forEach(function(o){var a=o.incoming,s=o.outgoing;k(a.concat(s),function(c){var u=c.source,l=c.target;(i.has(u)||i.has(l))&&(r.has(c)||(r.add(c),n.push(c)))})}),n}function nA(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 Cp=Math.abs,iA=Math.round,Ni={x:"width",y:"height"},Cy="crosshair",lr={n:"top",w:"left",s:"bottom",e:"right"},rA=1500,fc={n:"s",w:"e",s:"n",e:"w"},dc=20;function Xn(e,t,n,i,r,o,a){this._canvas=e,this._dragging=t,this._eventBus=n,this._modeling=i,this._rules=r,this._toolManager=o,this._mouse=a;var s=this;o.registerTool("space",{tool:"spaceTool.selection",dragging:"spaceTool"}),n.on("spaceTool.selection.end",function(c){n.once("spaceTool.selection.ended",function(){s.activateMakeSpace(c.originalEvent)})}),n.on("spaceTool.move",rA,function(c){var u=c.context,l=u.initialized;l||(l=u.initialized=s.init(c,u)),l&&Ay(c)}),n.on("spaceTool.end",function(c){var u=c.context,l=u.axis,f=u.direction,p=u.movingShapes,d=u.resizingShapes,h=u.start;if(u.initialized){Ay(c);var m={x:0,y:0};m[l]=iA(c["d"+l]),s.makeSpace(p,d,m,f,h),n.once("spaceTool.ended",function(g){s.activateSelection(g.originalEvent,!0,!0)})}})}Xn.$inject=["canvas","dragging","eventBus","modeling","rules","toolManager","mouse"],Xn.prototype.activateSelection=function(e,t,n){this._dragging.init(e,"spaceTool.selection",{autoActivate:t,cursor:Cy,data:{context:{reactivate:n}},trapClick:!1})},Xn.prototype.activateMakeSpace=function(e){this._dragging.init(e,"spaceTool",{autoActivate:!0,cursor:Cy,data:{context:{}}})},Xn.prototype.makeSpace=function(e,t,n,i,r){return this._modeling.createSpace(e,t,n,i,r)},Xn.prototype.init=function(e,t){var n=Cp(e.dx)>Cp(e.dy)?"x":"y",i=e["d"+n],r=e[n]-i;if(Cp(i)<5)return!1;i<0&&(i*=-1),fa(e)&&(i*=-1);var o=eA(n,i),a=this._canvas.getRootElement();!ec(e)&&e.hover&&(a=e.hover);var s=[...Xo(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=oA(c,n,o,r,u);return L(t,c,{axis:n,direction:o,spaceToolConstraints:l,start:r}),cc("resize-"+(n==="x"?"ew":"ns")),!0},Xn.prototype.calculateAdjustments=function(e,t,n,i){var r=this._rules,o=[],a=[],s=new Set,c=new Set,u=[],l=[];function f(d){s.has(d)||(s.add(d),o.push(d));var h=d.label;h&&!s.has(h)&&(s.add(h),o.push(h))}function p(d){c.has(d)||(c.add(d),a.push(d))}return k(e,function(d){if(!(!d.parent||De(d))){if(ot(d)){l.push(d);return}var h=d[t],m=h+d[Ni[t]];if(aA(d)&&(n>0&&we(d)[t]>i||n<0&&we(d)[t]<i)){u.push(d);return}if(n>0&&h>i||n<0&&m<i){f(d);return}if(h<i&&m>i&&r.allowed("shape.resize",{shape:d})){p(d);return}}}),k(o,function(d){var h=d.attachers;h&&k(h,function(m){f(m)})}),k(u,function(d){var h=d.host;(s.has(h)||c.has(h))&&f(d)}),k(l,function(d){var h=d.source,m=d.target,g=d.label;(s.has(h)||c.has(h))&&(s.has(m)||c.has(m))&&g&&f(g)}),{movingShapes:o,resizingShapes:a}},Xn.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateSelection(e,!!e)},Xn.prototype.isActive=function(){var e=this._dragging.context();return e?/^spaceTool/.test(e.prefix):!1};function Py(e){return{top:e.top-dc,right:e.right+dc,bottom:e.bottom+dc,left:e.left-dc}}function Ay(e){var t=e.context,n=t.spaceToolConstraints;if(n){var i,r;Ce(n.left)&&(i=Math.max(e.x,n.left),e.dx=e.dx+i-e.x,e.x=i),Ce(n.right)&&(i=Math.min(e.x,n.right),e.dx=e.dx+i-e.x,e.x=i),Ce(n.top)&&(r=Math.max(e.y,n.top),e.dy=e.dy+r-e.y,e.y=r),Ce(n.bottom)&&(r=Math.min(e.y,n.bottom),e.dy=e.dy+r-e.y,e.y=r)}}function oA(e,t,n,i,r){var o=e.movingShapes,a=e.resizingShapes;if(a.length){var s={},c,u,l=new Set(o),f=new Set(a);return k(a,function(p){var d=p.attachers,h=p.children,m=ve(p),g=Ie(h,function(G){return!ot(G)&&!De(G)&&!l.has(G)&&!f.has(G)}),R=Ie(h,function(G){return!ot(G)&&!De(G)&&l.has(G)}),w,b,x,S=[],M=[],N,T,H,V;g.length&&(b=Py(ve(Tt(g))),w=i-m[lr[n]]+b[lr[n]],n==="n"?s.bottom=u=Ce(u)?Math.min(u,w):w:n==="w"?s.right=u=Ce(u)?Math.min(u,w):w:n==="s"?s.top=c=Ce(c)?Math.max(c,w):w:n==="e"&&(s.left=c=Ce(c)?Math.max(c,w):w)),R.length&&(x=Py(ve(Tt(R))),w=i-x[lr[fc[n]]]+m[lr[fc[n]]],n==="n"?s.bottom=u=Ce(u)?Math.min(u,w):w:n==="w"?s.right=u=Ce(u)?Math.min(u,w):w:n==="s"?s.top=c=Ce(c)?Math.max(c,w):w:n==="e"&&(s.left=c=Ce(c)?Math.max(c,w):w)),d&&d.length&&(d.forEach(function(G){l.has(G)?S.push(G):M.push(G)}),S.length&&(N=ve(Tt(S.map(we))),T=m[lr[fc[n]]]-(N[lr[fc[n]]]-i)),M.length&&(H=ve(Tt(M.map(we))),V=H[lr[n]]-(m[lr[n]]-i)),n==="n"?(w=Math.min(T||1/0,V||1/0),s.bottom=u=Ce(u)?Math.min(u,w):w):n==="w"?(w=Math.min(T||1/0,V||1/0),s.right=u=Ce(u)?Math.min(u,w):w):n==="s"?(w=Math.max(T||-1/0,V||-1/0),s.top=c=Ce(c)?Math.max(c,w):w):n==="e"&&(w=Math.max(T||-1/0,V||-1/0),s.left=c=Ce(c)?Math.max(c,w):w));var $=r&&r[p.id];$&&(n==="n"?(w=i+p[Ni[t]]-$[Ni[t]],s.bottom=u=Ce(u)?Math.min(u,w):w):n==="w"?(w=i+p[Ni[t]]-$[Ni[t]],s.right=u=Ce(u)?Math.min(u,w):w):n==="s"?(w=i-p[Ni[t]]+$[Ni[t]],s.top=c=Ce(c)?Math.max(c,w):w):n==="e"&&(w=i-p[Ni[t]]+$[Ni[t]],s.left=c=Ce(c)?Math.max(c,w):w))}),s}}function aA(e){return!!e.host}var Pp="djs-dragging",Ty="djs-resizing",sA=250,hc=Math.max;function My(e,t,n,i,r){function o(a,s){k(a,function(c){r.addDragger(c,s),n.addMarker(c,Pp)})}e.on("spaceTool.selection.start",function(a){var s=n.getLayer("space"),c=a.context,u={x:"M 0,-10000 L 0,10000",y:"M -10000,0 L 10000,0"},l=ye("g");se(l,i.cls("djs-crosshair-group",["no-events"])),Ae(s,l);var f=ye("path");se(f,"d",u.x),je(f).add("djs-crosshair"),Ae(l,f);var p=ye("path");se(p,"d",u.y),je(p).add("djs-crosshair"),Ae(l,p),c.crosshairGroup=l}),e.on("spaceTool.selection.move",function(a){var s=a.context.crosshairGroup;Jt(s,a.x,a.y)}),e.on("spaceTool.selection.cleanup",function(a){var s=a.context,c=s.crosshairGroup;c&&zt(c)}),e.on("spaceTool.move",sA,function(a){var s=a.context,c=s.line,u=s.axis,l=s.movingShapes,f=s.resizingShapes;if(s.initialized){if(!s.dragGroup){var p=n.getLayer("space");c=ye("path"),se(c,"d","M0,0 L0,0"),je(c).add("djs-crosshair"),Ae(p,c),s.line=c;var d=ye("g");se(d,i.cls("djs-drag-group",["no-events"])),Ae(n.getActiveLayer(),d),o(l,d);var h=new Set(l);k(f,function(M){h.add(M)});var m=new Set,g=s.movingConnections=[];h.forEach(function(M){k(M.outgoing,function(N){m.has(N)||!ot(N)||!h.has(N.target)||(m.add(N),g.push(N))})}),o(g,d),s.dragGroup=d}if(!s.frameGroup){var R=ye("g");se(R,i.cls("djs-frame-group",["no-events"])),Ae(n.getActiveLayer(),R);var w=[];k(f,function(M){var N=r.addFrame(M,R),T=N.getBBox();w.push({element:N,initialBounds:T}),n.addMarker(M,Ty)}),s.frameGroup=R,s.frames=w}var b={x:"M"+a.x+", -10000 L"+a.x+", 10000",y:"M -10000, "+a.y+" L 10000, "+a.y};se(c,{d:b[u]});var x={x:"y",y:"x"},S={x:a.dx,y:a.dy};S[x[s.axis]]=0,Jt(s.dragGroup,S.x,S.y),k(s.frames,function(M){var N=M.element,T=M.initialBounds,H,V;s.direction==="e"?se(N,{width:hc(T.width+S.x,5)}):(H=hc(T.width-S.x,5),se(N,{width:H,x:T.x+T.width-H})),s.direction==="s"?se(N,{height:hc(T.height+S.y,5)}):(V=hc(T.height-S.y,5),se(N,{height:V,y:T.y+T.height-V}))})}}),e.on("spaceTool.cleanup",function(a){var s=a.context,c=s.movingShapes,u=s.movingConnections,l=s.resizingShapes,f=s.line,p=s.dragGroup,d=s.frameGroup;k(c,function(h){n.removeMarker(h,Pp)}),k(u,function(h){n.removeMarker(h,Pp)}),p&&(zt(f),zt(p)),k(l,function(h){n.removeMarker(h,Ty)}),d&&zt(d)})}My.$inject=["eventBus","elementRegistry","canvas","styles","previewSupport"];const cA={__init__:["spaceToolPreview"],__depends__:[Ii,yi,pc,Co,ma],spaceTool:["type",Xn],spaceToolPreview:["type",My]};function mc(e,t){e.invoke(Xn,this),this._canvas=t}mc.$inject=["injector","canvas"],ae(mc,Xn),mc.prototype.calculateAdjustments=function(e,t,n,i){var r=this._canvas.getRootElement(),o=e[0]===r?null:e[0],a=[];o&&(a=Qr(so(r.children.filter(u=>v(u,"bpmn:Artifact")),Tt(o))));const s=[...e,...a];var c=Xn.prototype.calculateAdjustments.call(this,s,t,n,i);return c.resizingShapes=c.resizingShapes.filter(function(u){return!(v(u,"bpmn:TextAnnotation")||uA(u)&&(t==="y"&&qt(u)||t==="x"&&!qt(u)))}),c};function uA(e){return v(e,"bpmn:Participant")&&!Z(e).processRef}const ky={__depends__:[cA],spaceTool:["type",mc]};function vt(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)}vt.$inject=["eventBus","injector"],vt.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()},vt.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},vt.prototype.clear=function(e){this._stack.length=0,this._stackIdx=-1,e!==!1&&this._fire("changed",{trigger:"clear"})},vt.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()}},vt.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()}},vt.prototype.register=function(e,t){this._setHandler(e,t)},vt.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)},vt.prototype.canUndo=function(){return!!this._getUndoAction()},vt.prototype.canRedo=function(){return!!this._getRedoAction()},vt.prototype._getRedoAction=function(){return this._stack[this._stackIdx+1]},vt.prototype._getUndoAction=function(){return this._stack[this._stackIdx]},vt.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)})},vt.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},vt.prototype._createId=function(){return this._uid++},vt.prototype._atomicDo=function(e){const t=this._currentExecution;t.atomic=!0;try{e()}finally{t.atomic=!1}},vt.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()},vt.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)},vt.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:Xf("id",i.reverse())}),i.length=0,this._fire("changed",{trigger:t}),e.trigger=null)},vt.prototype._markDirty=function(e){const t=this._currentExecution;e&&(e=xe(e)?e:[e],t.dirty=t.dirty.concat(e))},vt.prototype._executedAction=function(e,t){const n=++this._stackIdx;t||this._stack.splice(n,this._stack.length,e)},vt.prototype._revertedAction=function(e){this._stackIdx--},vt.prototype._getHandler=function(e){return this._handlerMap[e]},vt.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 lA={commandStack:["type",vt]};function pr(e,t){if(typeof t!="function")throw new Error("removeFn iterator must be a function");if(!e)return[];for(var n;n=e[0];)t(n);return e}var pA=250,Dy=1400;function Ap(e,t,n){X.call(this,t);var i=e.get("movePreview",!1);t.on("shape.move.start",Dy,function(r){var o=r.context,a=o.shapes,s=o.validatedShapes;o.shapes=Oy(a),o.validatedShapes=Oy(s)}),i&&t.on("shape.move.start",pA,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",Dy,function(r){var o=r.context,a=o.closure,s=a.enclosedElements,c=[];k(s,function(u){k(u.labels,function(l){s[l.id]||c.push(l)})}),a.addAll(c)}),this.preExecute(["connection.delete","shape.delete"],function(r){var o=r.context,a=o.connection||o.shape;pr(a.labels,function(s){n.removeShape(s,{nested:!0})})}),this.execute("shape.delete",function(r){var o=r.context,a=o.shape,s=a.labelTarget;s&&(o.labelTargetIndex=sl(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&&(Rt(s.labels,a,c),a.labelTarget=s)})}ae(Ap,X),Ap.$inject=["injector","eventBus","modeling"];function Oy(e){var t=new Set(e);return Ie(e,function(n){return!t.has(n.labelTarget)})}const fA={__init__:["labelSupport"],labelSupport:["type",Ap]};var dA=251,Ly=1401,Iy="attach-ok";function Tp(e,t,n,i,r){X.call(this,t);var o=e.get("movePreview",!1);t.on("shape.move.start",Ly,function(a){var s=a.context,c=s.shapes,u=s.validatedShapes;s.shapes=hA(c),s.validatedShapes=mA(u)}),o&&t.on("shape.move.start",dA,function(a){var s=a.context,c=s.shapes,u=Mp(c);k(u,function(l){o.makeDraggable(s,l,!0),k(l.labels,function(f){o.makeDraggable(s,f,!0)})})}),o&&t.on("shape.move.start",function(a){var s=a.context,c=s.shapes;if(c.length===1){var u=c[0],l=u.host;l&&(n.addMarker(l,Iy),t.once(["shape.move.out","shape.move.cleanup"],function(){n.removeMarker(l,Iy)}))}}),this.preExecuted("elements.move",Ly,function(a){var s=a.context,c=s.closure,u=s.shapes,l=Mp(u);k(l,function(f){c.add(f,c.topLevel[f.host.id])})}),this.postExecuted("elements.move",function(a){var s=a.context,c=s.shapes,u=s.newHost,l;u&&c.length!==1||(u?l=c:l=Ie(c,function(f){var p=f.host;return gA(f)&&!yA(c,p)}),k(l,function(f){r.updateAttachment(f,u)}))}),this.postExecuted("elements.move",function(a){var s=a.context.shapes;k(s,function(c){k(c.attachers,function(u){k(u.outgoing.slice(),function(l){var f=i.allowed("connection.reconnect",{connection:l,source:l.source,target:l.target});f||r.removeConnection(l)}),k(u.incoming.slice(),function(l){var f=i.allowed("connection.reconnect",{connection:l,source:l.source,target:l.target});f||r.removeConnection(l)})})})}),this.postExecute("shape.create",function(a){var s=a.context,c=s.shape,u=s.host;u&&r.updateAttachment(c,u)}),this.postExecute("shape.replace",function(a){var s=a.context,c=s.oldShape,u=s.newShape;pr(c.attachers,function(l){var f=i.allowed("elements.move",{target:u,shapes:[l]});f==="attach"?r.updateAttachment(l,u):r.removeShape(l)}),u.attachers.length&&k(u.attachers,function(l){var f=Jm(l,c,u);r.moveShape(l,f,l.parent)})}),this.postExecute("shape.resize",function(a){var s=a.context,c=s.shape,u=s.oldBounds,l=s.newBounds,f=c.attachers,p=s.hints||{};p.attachSupport!==!1&&k(f,function(d){var h=Jm(d,u,l);r.moveShape(d,h,d.parent),k(d.labels,function(m){r.moveShape(m,h,m.parent)})})}),this.preExecute("shape.delete",function(a){var s=a.context.shape;pr(s.attachers,function(c){r.removeShape(c)}),s.host&&r.updateAttachment(s,null)})}ae(Tp,X),Tp.$inject=["injector","eventBus","canvas","rules","modeling"];function Mp(e){return Ru(on(e,function(t){return t.attachers||[]}))}function hA(e){var t=Mp(e);return o0("id",e,t)}function mA(e){var t=Jr(e,"id");return Ie(e,function(n){for(;n;){if(n.host&&t[n.host.id])return!1;n=n.parent}return!0})}function gA(e){return!!e.host}function yA(e,t){return e.indexOf(t)!==-1}const vA={__depends__:[yi],__init__:["attachSupport"],attachSupport:["type",Tp]};function Ny(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(Ah(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)})}Ny.$inject=["eventBus","canvas","elementRegistry","graphicsFactory"];const kp={__init__:["changeSupport"],changeSupport:["type",Ny]};function Zn(e){this._model=e}Zn.$inject=["moddle"],Zn.prototype._needsId=function(e){return Le(e,["bpmn:RootElement","bpmn:FlowElement","bpmn:MessageFlow","bpmn:DataAssociation","bpmn:Artifact","bpmn:Participant","bpmn:Lane","bpmn:LaneSet","bpmn:Process","bpmn:Collaboration","bpmndi:BPMNShape","bpmndi:BPMNEdge","bpmndi:BPMNDiagram","bpmndi:BPMNPlane","bpmn:Property","bpmn:CategoryValue"])},Zn.prototype._ensureId=function(e){if(e.id){this._model.ids.claim(e.id,e);return}var t;v(e,"bpmn:Activity")?t="Activity":v(e,"bpmn:Event")?t="Event":v(e,"bpmn:Gateway")?t="Gateway":Le(e,["bpmn:SequenceFlow","bpmn:MessageFlow"])?t="Flow":t=(e.$type||"").replace(/^[^:]*:/g,""),t+="_",!e.id&&this._needsId(e)&&(e.id=this._model.ids.nextPrefixed(t,e))},Zn.prototype.create=function(e,t){var n=this._model.create(e,t||{});return this._ensureId(n),n},Zn.prototype.createDiLabel=function(){return this.create("bpmndi:BPMNLabel",{bounds:this.createDiBounds()})},Zn.prototype.createDiShape=function(e,t){return this.create("bpmndi:BPMNShape",L({bpmnElement:e,bounds:this.createDiBounds()},t))},Zn.prototype.createDiBounds=function(e){return this.create("dc:Bounds",e)},Zn.prototype.createDiWaypoints=function(e){var t=this;return on(e,function(n){return t.createDiWaypoint(n)})},Zn.prototype.createDiWaypoint=function(e){return this.create("dc:Point",ii(e,["x","y"]))},Zn.prototype.createDiEdge=function(e,t){return this.create("bpmndi:BPMNEdge",L({bpmnElement:e,waypoint:this.createDiWaypoints([])},t))},Zn.prototype.createDiPlane=function(e,t){return this.create("bpmndi:BPMNPlane",L({bpmnElement:e},t))};function kn(e,t,n){X.call(this,e),this._bpmnFactory=t;var i=this;function r(d){var h=d.context,m=h.hints||{},g;!h.cropped&&m.createElementsBehavior!==!1&&(g=h.connection,g.waypoints=n.getCroppedWaypoints(g),h.cropped=!0)}this.executed(["connection.layout","connection.create"],r),this.reverted(["connection.layout"],function(d){delete d.context.cropped});function o(d){var h=d.context;i.updateParent(h.shape||h.connection,h.oldParent)}function a(d){var h=d.context,m=h.shape||h.connection,g=h.parent||h.newParent;i.updateParent(m,g)}this.executed(["shape.move","shape.create","shape.delete","connection.create","connection.move","connection.delete"],Dn(o)),this.reverted(["shape.move","shape.create","shape.delete","connection.create","connection.move","connection.delete"],Dn(a));function s(d){var h=d.context,m=h.oldRoot,g=m.children;k(g,function(R){v(R,"bpmn:BaseElement")&&i.updateParent(R)})}this.executed(["canvas.updateRoot"],s),this.reverted(["canvas.updateRoot"],s);function c(d){var h=d.context.shape;v(h,"bpmn:BaseElement")&&i.updateBounds(h)}this.executed(["shape.move","shape.create","shape.resize"],Dn(function(d){d.context.shape.type!=="label"&&c(d)})),this.reverted(["shape.move","shape.create","shape.resize"],Dn(function(d){d.context.shape.type!=="label"&&c(d)})),e.on("shape.changed",function(d){d.element.type==="label"&&c({context:{shape:d.element}})});function u(d){i.updateConnection(d.context)}this.executed(["connection.create","connection.move","connection.delete","connection.reconnect"],Dn(u)),this.reverted(["connection.create","connection.move","connection.delete","connection.reconnect"],Dn(u));function l(d){i.updateConnectionWaypoints(d.context.connection)}this.executed(["connection.layout","connection.move","connection.updateWaypoints"],Dn(l)),this.reverted(["connection.layout","connection.move","connection.updateWaypoints"],Dn(l)),this.executed("connection.reconnect",Dn(function(d){var h=d.context,m=h.connection,g=h.oldSource,R=h.newSource,w=Z(m),b=Z(g),x=Z(R);w.conditionExpression&&!Le(x,["bpmn:Activity","bpmn:ExclusiveGateway","bpmn:InclusiveGateway"])&&(h.oldConditionExpression=w.conditionExpression,delete w.conditionExpression),g!==R&&b.default===w&&(h.oldDefault=b.default,delete b.default)})),this.reverted("connection.reconnect",Dn(function(d){var h=d.context,m=h.connection,g=h.oldSource,R=h.newSource,w=Z(m),b=Z(g),x=Z(R);h.oldConditionExpression&&(w.conditionExpression=h.oldConditionExpression),h.oldDefault&&(b.default=h.oldDefault,delete x.default)}));function f(d){i.updateAttachment(d.context)}this.executed(["element.updateAttachment"],Dn(f)),this.reverted(["element.updateAttachment"],Dn(f)),this.executed("element.updateLabel",Dn(p)),this.reverted("element.updateLabel",Dn(p));function p(d){const{element:h}=d.context,m=Hn(h),g=Ge(h),R=g&&g.get("label");rr(h)||tc(h)||(m&&!R?g.set("label",t.create("bpmndi:BPMNLabel")):!m&&R&&g.set("label",void 0))}}ae(kn,X),kn.$inject=["eventBus","bpmnFactory","connectionDocking"],kn.prototype.updateAttachment=function(e){var t=e.shape,n=t.businessObject,i=t.host;n.attachedToRef=i&&i.businessObject},kn.prototype.updateParent=function(e,t){if(!De(e)&&!(v(e,"bpmn:DataStoreReference")&&e.parent&&v(e.parent,"bpmn:Collaboration"))){var n=e.parent,i=e.businessObject,r=Ge(e),o=n&&n.businessObject,a=Ge(n);v(e,"bpmn:FlowNode")&&this.updateFlowNodeRefs(i,o,t&&t.businessObject),v(e,"bpmn:DataOutputAssociation")&&(e.source?o=e.source.businessObject:o=null),v(e,"bpmn:DataInputAssociation")&&(e.target?o=e.target.businessObject:o=null),this.updateSemanticParent(i,o),v(e,"bpmn:DataObjectReference")&&i.dataObjectRef&&this.updateSemanticParent(i.dataObjectRef,o),this.updateDiParent(r,a)}},kn.prototype.updateBounds=function(e){var t=Ge(e),n=bA(e);if(n){var i=ri(n,t.get("bounds"));L(n,{x:e.x+i.x,y:e.y+i.y})}var r=De(e)?this._getLabel(t):t,o=r.bounds;o||(o=this._bpmnFactory.createDiBounds(),r.set("bounds",o)),L(o,{x:e.x,y:e.y,width:e.width,height:e.height})},kn.prototype.updateFlowNodeRefs=function(e,t,n){if(n!==t){var i,r;v(n,"bpmn:Lane")&&(i=n.get("flowNodeRef"),Et(i,e)),v(t,"bpmn:Lane")&&(r=t.get("flowNodeRef"),Rt(r,e))}},kn.prototype.updateDiConnection=function(e,t,n){var i=Ge(e),r=Ge(t),o=Ge(n);i.sourceElement&&i.sourceElement.bpmnElement!==Z(t)&&(i.sourceElement=t&&r),i.targetElement&&i.targetElement.bpmnElement!==Z(n)&&(i.targetElement=n&&o)},kn.prototype.updateDiParent=function(e,t){if(t&&!v(t,"bpmndi:BPMNPlane")&&(t=t.$parent),e.$parent!==t){var n=(t||e.$parent).get("planeElement");t?(n.push(e),e.$parent=t):(Et(n,e),e.$parent=null)}};function _A(e){for(;e&&!v(e,"bpmn:Definitions");)e=e.$parent;return e}kn.prototype.getLaneSet=function(e){var t,n;return v(e,"bpmn:Lane")?(t=e.childLaneSet,t||(t=this._bpmnFactory.create("bpmn:LaneSet"),e.childLaneSet=t,t.$parent=e),t):(v(e,"bpmn:Participant")&&(e=e.processRef),n=e.get("laneSets"),t=n[0],t||(t=this._bpmnFactory.create("bpmn:LaneSet"),t.$parent=e,n.push(t)),t)},kn.prototype.updateSemanticParent=function(e,t,n){var i;if(e.$parent!==t&&!((v(e,"bpmn:DataInput")||v(e,"bpmn:DataOutput"))&&(v(t,"bpmn:Participant")&&"processRef"in t&&(t=t.processRef),"ioSpecification"in t&&t.ioSpecification===e.$parent))){if(v(e,"bpmn:Lane"))t&&(t=this.getLaneSet(t)),i="lanes";else if(v(e,"bpmn:FlowElement")){if(t){if(v(t,"bpmn:Participant"))t=t.processRef;else if(v(t,"bpmn:Lane"))do t=t.$parent.$parent;while(v(t,"bpmn:Lane"))}i="flowElements"}else if(v(e,"bpmn:Artifact")){for(;t&&!v(t,"bpmn:Process")&&!v(t,"bpmn:SubProcess")&&!v(t,"bpmn:Collaboration");)if(v(t,"bpmn:Participant")){t=t.processRef;break}else t=t.$parent;i="artifacts"}else if(v(e,"bpmn:MessageFlow"))i="messageFlows";else if(v(e,"bpmn:Participant")){i="participants";var r=e.processRef,o;r&&(o=_A(e.$parent||t),e.$parent&&(Et(o.get("rootElements"),r),r.$parent=null),t&&(Rt(o.get("rootElements"),r),r.$parent=o))}else v(e,"bpmn:DataOutputAssociation")?i="dataOutputAssociations":v(e,"bpmn:DataInputAssociation")&&(i="dataInputAssociations");if(!i)throw new Error(`no parent for <${e.id}> in <${t.id}>`);var a;if(e.$parent&&(a=e.$parent.get(i),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))}}},kn.prototype.updateConnectionWaypoints=function(e){var t=Ge(e);t.set("waypoint",this._bpmnFactory.createDiWaypoints(e.waypoints))},kn.prototype.updateConnection=function(e){var t=e.connection,n=Z(t),i=t.source,r=Z(i),o=t.target,a=Z(t.target),s;if(v(n,"bpmn:DataAssociation"))v(n,"bpmn:DataInputAssociation")?(n.get("sourceRef")[0]=r,s=e.parent||e.newParent||a,this.updateSemanticParent(n,a,s)):v(n,"bpmn:DataOutputAssociation")&&(s=e.parent||e.newParent||r,this.updateSemanticParent(n,r,s),n.targetRef=a);else{var c=v(n,"bpmn:SequenceFlow");n.sourceRef!==r&&(c&&(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)},kn.prototype._getLabel=function(e){return e.label||(e.label=this._bpmnFactory.createDiLabel()),e.label};function Dn(e){return function(t){var n=t.context,i=n.shape||n.connection||n.element;v(i,"bpmn:BaseElement")&&e(t)}}function bA(e){if(v(e,"bpmn:Activity")){var t=Ge(e);if(t){var n=t.get("label");if(n)return n.get("bounds")}}}function fr(e,t){ki.call(this),this._bpmnFactory=e,this._moddle=t}ae(fr,ki),fr.$inject=["bpmnFactory","moddle"],fr.prototype._baseCreate=ki.prototype.create,fr.prototype.create=function(e,t){if(e==="label"){var n=t.di||this._bpmnFactory.createDiLabel();return this._baseCreate(e,L({type:"label",di:n},Nr,t))}return this.createElement(e,t)},fr.prototype.createElement=function(e,t){t=L({},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(!wA(r)){var o=L({},r||{},{id:i.id+"_di"});e==="root"?r=this._bpmnFactory.createDiPlane(i,o):e==="connection"?r=this._bpmnFactory.createDiEdge(i,o):r=this._bpmnFactory.createDiShape(i,o)}v(i,"bpmn:Group")&&(t=L({isFrame:!0},t)),t=xA(i,t,["processRef","isInterrupting","associationDirection","isForCompensation"]),t.isExpanded&&(t=Dp(r,t,"isExpanded")),Le(i,["bpmn:Lane","bpmn:Participant"])&&(t=Dp(r,t,"isHorizontal")),v(i,"bpmn:SubProcess")&&(t.collapsed=!$e(i,r)),v(i,"bpmn:ExclusiveGateway")&&(En(r,"isMarkerVisible")?r.isMarkerVisible===void 0&&(r.isMarkerVisible=!1):r.isMarkerVisible=!0),jt(t.triggeredByEvent)&&(i.triggeredByEvent=t.triggeredByEvent,delete t.triggeredByEvent),jt(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=L({id:i.id},n,t,{businessObject:i,di:r}),this._baseCreate(e,t)},fr.prototype.getDefaultSize=function(e,t){var n=Z(e);if(t=t||Ge(e),v(n,"bpmn:SubProcess"))return $e(n,t)?{width:350,height:200}:{width:100,height:80};if(v(n,"bpmn:Task"))return{width:100,height:80};if(v(n,"bpmn:Gateway"))return{width:50,height:50};if(v(n,"bpmn:Event"))return{width:36,height:36};if(v(n,"bpmn:Participant")){var i=t.isHorizontal===void 0||t.isHorizontal===!0;return $e(n,t)?i?{width:600,height:250}:{width:250,height:600}:i?{width:400,height:60}:{width:60,height:400}}return v(n,"bpmn:Lane")?{width:400,height:100}:v(n,"bpmn:DataObjectReference")?{width:36,height:50}:v(n,"bpmn:DataStoreReference")?{width:50,height:50}:v(n,"bpmn:TextAnnotation")?{width:100,height:40}:v(n,"bpmn:Group")?{width:300,height:300}:{width:100,height:80}},fr.prototype.createParticipantShape=function(e){return Ut(e)||(e={isExpanded:e}),e=L({type:"bpmn:Participant"},e||{}),e.isExpanded!==!1&&(e.processRef=this._bpmnFactory.create("bpmn:Process")),this.createShape(e)};function xA(e,t,n){return k(n,function(i){t=Dp(e,t,i)}),t}function Dp(e,t,n){return t[n]===void 0?t:(e[n]=t[n],si(t,[n]))}function wA(e){return Le(e,["bpmndi:BPMNShape","bpmndi:BPMNEdge","bpmndi:BPMNDiagram","bpmndi:BPMNPlane"])}function gc(e,t){this._modeling=e,this._canvas=t}gc.$inject=["modeling","canvas"],gc.prototype.preExecute=function(e){var t=this._modeling,n=e.elements,i=e.alignment;k(n,function(r){var o={x:0,y:0};jt(i.left)?o.x=i.left-r.x:jt(i.right)?o.x=i.right-r.width-r.x:jt(i.center)?o.x=i.center-Math.round(r.width/2)-r.x:jt(i.top)?o.y=i.top-r.y:jt(i.bottom)?o.y=i.bottom-r.height-r.y:jt(i.middle)&&(o.y=i.middle-Math.round(r.height/2)-r.y),t.moveElements([r],o,r.parent)})},gc.prototype.postExecute=function(e){};function yc(e){this._modeling=e}yc.$inject=["modeling"],yc.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},yc.prototype.postExecute=function(e){var t=e.hints||{};EA(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 EA(e,t){return Wi(e.outgoing,function(n){return n.target===t})}function vc(e,t){this._canvas=e,this._layouter=t}vc.$inject=["canvas","layouter"],vc.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},vc.prototype.revert=function(e){var t=e.connection;return this._canvas.removeConnection(t),t.source=null,t.target=null,t};var _c=Math.round;function Op(e){this._modeling=e}Op.$inject=["modeling"],Op.prototype.preExecute=function(e){var t=e.elements,n=e.parent,i=e.parentIndex,r=e.position,o=e.hints,a=this._modeling;k(t,function(f){Ce(f.x)||(f.x=0),Ce(f.y)||(f.y=0)});var s=Ie(t,function(f){return!f.hidden}),c=Tt(s);k(t,function(f){ot(f)&&(f.waypoints=on(f.waypoints,function(p){return{x:_c(p.x-c.x-c.width/2+r.x),y:_c(p.y-c.y-c.height/2+r.y)}})),L(f,{x:_c(f.x-c.x-c.width/2+r.x),y:_c(f.y-c.y-c.height/2+r.y)})});var u=new Set(xs(t)),l={};k(t,function(f){if(ot(f)){l[f.id]=Ce(i)?a.createConnection(l[f.source.id],l[f.target.id],i,f,f.parent||n,o):a.createConnection(l[f.source.id],l[f.target.id],f,f.parent||n,o);return}var p=L({},o);u.has(f)||(p.autoResize=!1),De(f)&&(p=si(p,["attach"])),l[f.id]=Ce(i)?a.createShape(f,ii(f,["x","y","width","height"]),f.parent||n,i,p):a.createShape(f,ii(f,["x","y","width","height"]),f.parent||n,p)}),e.elements=Qr(l)};var By=Math.round;function dr(e){this._canvas=e}dr.$inject=["canvas"],dr.prototype.execute=function(e){var t=e.shape,n=e.position,i=e.parent,r=e.parentIndex;if(!i)throw new Error("parent required");if(!n)throw new Error("position required");return n.width!==void 0?L(t,n):L(t,{x:n.x-By(t.width/2),y:n.y-By(t.height/2)}),this._canvas.addShape(t,i,r),t},dr.prototype.revert=function(e){var t=e.shape;return this._canvas.removeShape(t),t};function ya(e){dr.call(this,e)}ae(ya,dr),ya.$inject=["canvas"];var SA=dr.prototype.execute;ya.prototype.execute=function(e){var t=e.shape;return CA(t),t.labelTarget=e.labelTarget,SA.call(this,e)};var RA=dr.prototype.revert;ya.prototype.revert=function(e){return e.shape.labelTarget=null,RA.call(this,e)};function CA(e){["width","height"].forEach(function(t){typeof e[t]>"u"&&(e[t]=0)})}function va(e,t){this._canvas=e,this._modeling=t}va.$inject=["canvas","modeling"],va.prototype.preExecute=function(e){var t=this._modeling,n=e.connection;pr(n.incoming,function(i){t.removeConnection(i,{nested:!0})}),pr(n.outgoing,function(i){t.removeConnection(i,{nested:!0})})},va.prototype.execute=function(e){var t=e.connection,n=t.parent;return e.parent=n,e.parentIndex=sl(n.children,t),e.source=t.source,e.target=t.target,this._canvas.removeConnection(t),t.source=null,t.target=null,t},va.prototype.revert=function(e){var t=e.connection,n=e.parent,i=e.parentIndex;return t.source=e.source,t.target=e.target,Rt(n.children,t,i),this._canvas.addConnection(t,n),t};function Lp(e,t){this._modeling=e,this._elementRegistry=t}Lp.$inject=["modeling","elementRegistry"],Lp.prototype.postExecute=function(e){var t=this._modeling,n=this._elementRegistry,i=e.elements;k(i,function(r){n.get(r.id)&&(r.waypoints?t.removeConnection(r):t.removeShape(r))})};function _a(e,t){this._canvas=e,this._modeling=t}_a.$inject=["canvas","modeling"],_a.prototype.preExecute=function(e){var t=this._modeling,n=e.shape;pr(n.incoming,function(i){t.removeConnection(i,{nested:!0})}),pr(n.outgoing,function(i){t.removeConnection(i,{nested:!0})}),pr(n.children,function(i){ot(i)?t.removeConnection(i,{nested:!0}):t.removeShape(i,{nested:!0})})},_a.prototype.execute=function(e){var t=this._canvas,n=e.shape,i=n.parent;return e.oldParent=i,e.oldParentIndex=sl(i.children,n),t.removeShape(n),n},_a.prototype.revert=function(e){var t=this._canvas,n=e.shape,i=e.oldParent,r=e.oldParentIndex;return Rt(i.children,n,r),t.addShape(n,i),n};function bc(e){this._modeling=e}bc.$inject=["modeling"];var $y={x:"y",y:"x"};bc.prototype.preExecute=function(e){var t=this._modeling,n=e.groups,i=e.axis,r=e.dimension;function o(g,R){g.range.min=Math.min(R[i],g.range.min),g.range.max=Math.max(R[i]+R[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,R){var w={y:0};w[i]=g-a(R),w[i]&&(w[$y[i]]=0,t.moveElements([R],w,R.parent))}var l=n[0],f=s(n),p=n[f],d,h,m=0;k(n,function(g,R){var w,b,x;if(g.elements.length<2){R&&R!==n.length-1&&(o(g,g.elements[0]),m+=c(g.range));return}w=ai(g.elements,i),b=w[0],R===f&&(b=w[s(w)]),x=a(b),g.range=null,k(w,function(S){if(u(x,S),g.range===null){g.range={min:S[i],max:S[i]+S[r]};return}o(g,S)}),R&&R!==n.length-1&&(m+=c(g.range))}),h=Math.abs(p.range.min-l.range.max),d=Math.round((h-m)/(n.length-1)),!(d<n.length-1)&&k(n,function(g,R){var w={},b;g===l||g===p||(b=n[R-1],g.range.max=0,k(g.elements,function(x,S){w[$y[i]]=0,w[i]=b.range.max-x[i]+d,g.range.min!==x[i]&&(w[i]+=x[i]-g.range.min),w[i]&&t.moveElements([x],w,x.parent),g.range.max=Math.max(x[i]+x[r],S?g.range.max:0)}))})},bc.prototype.postExecute=function(e){};function xc(e,t){this._layouter=e,this._canvas=t}xc.$inject=["layouter","canvas"],xc.prototype.execute=function(e){var t=e.connection,n=t.waypoints;return L(e,{oldWaypoints:n}),t.waypoints=this._layouter.layoutConnection(t,e.hints),t},xc.prototype.revert=function(e){var t=e.connection;return t.waypoints=e.oldWaypoints,t};function Ip(){}Ip.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),Rt(i.children,t,r),t.parent=i,k(t.waypoints,function(a){a.x+=n.x,a.y+=n.y,a.original&&(a.original.x+=n.x,a.original.y+=n.y)}),t},Ip.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),Rt(i.children,t,r),t.parent=i,k(t.waypoints,function(a){a.x-=o.x,a.y-=o.y,a.original&&(a.original.x-=o.x,a.original.y-=o.y)}),t};function Np(){this.allShapes={},this.allConnections={},this.enclosedElements={},this.enclosedConnections={},this.topLevel={}}Np.prototype.add=function(e,t){return this.addAll([e],t)},Np.prototype.addAll=function(e,t){var n=n1(e,!!t,this);return L(this,n),this};function ba(e){this._modeling=e}ba.prototype.moveRecursive=function(e,t,n){return e?this.moveClosure(this.getClosure(e),t,n):[]},ba.prototype.moveClosure=function(e,t,n,i,r){var o=this._modeling,a=e.allShapes,s=e.allConnections,c=e.enclosedConnections,u=e.topLevel,l=!1;r&&r.parent===n&&(l=!0),k(a,function(f){o.moveShape(f,t,u[f.id]&&!l&&n,{recurse:!1,layout:!1})}),k(s,function(f){var p=!!a[f.source.id],d=!!a[f.target.id];c[f.id]&&p&&d?o.moveConnection(f,t,u[f.id]&&!l&&n):o.layoutConnection(f,{connectionStart:p&&Vl(f,f.source,t),connectionEnd:d&&Gl(f,f.target,t)})})},ba.prototype.getClosure=function(e){return new Np().addAll(e,!0)};function wc(e){this._helper=new ba(e)}wc.$inject=["modeling"],wc.prototype.preExecute=function(e){e.closure=this._helper.getClosure(e.shapes)},wc.prototype.postExecute=function(e){var t=e.hints,n;t&&t.primaryShape&&(n=t.primaryShape,t.oldParent=n.parent),this._helper.moveClosure(e.closure,e.delta,e.newParent,e.newHost,n)};function zr(e){this._modeling=e,this._helper=new ba(e)}zr.$inject=["modeling"],zr.prototype.execute=function(e){var t=e.shape,n=e.delta,i=e.newParent||t.parent,r=e.newParentIndex,o=t.parent;return e.oldBounds=ii(t,["x","y","width","height"]),e.oldParent=o,e.oldParentIndex=Et(o.children,t),Rt(i.children,t,r),L(t,{parent:i,x:t.x+n.x,y:t.y+n.y}),t},zr.prototype.postExecute=function(e){var t=e.shape,n=e.delta,i=e.hints,r=this._modeling;i.layout!==!1&&(k(t.incoming,function(o){r.layoutConnection(o,{connectionEnd:Gl(o,t,n)})}),k(t.outgoing,function(o){r.layoutConnection(o,{connectionStart:Vl(o,t,n)})})),i.recurse!==!1&&this.moveChildren(e)},zr.prototype.revert=function(e){var t=e.shape,n=e.oldParent,i=e.oldParentIndex,r=e.delta;return Rt(n.children,t,i),L(t,{parent:n,x:t.x-r.x,y:t.y-r.y}),t},zr.prototype.moveChildren=function(e){var t=e.delta,n=e.shape;this._helper.moveRecursive(n.children,t,null)},zr.prototype.getNewParent=function(e){return e.newParent||e.shape.parent};function xa(e){this._modeling=e}xa.$inject=["modeling"],xa.prototype.execute=function(e){var t=e.newSource,n=e.newTarget,i=e.connection,r=e.dockingOrPoints;if(!t&&!n)throw new Error("newSource or newTarget required");return xe(r)&&(e.oldWaypoints=i.waypoints,i.waypoints=r),t&&(e.oldSource=i.source,i.source=t),n&&(e.oldTarget=i.target,i.target=n),i},xa.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||jy(xe(r)?r[0]:r)),i&&(!n||o.docking==="target")&&(a.connectionEnd=a.connectionEnd||jy(xe(r)?r[r.length-1]:r)),o.newWaypoints&&(a.waypoints=o.newWaypoints),this._modeling.layoutConnection(t,a))},xa.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 jy(e){return e.original||e}function Bi(e,t){this._modeling=e,this._rules=t}Bi.$inject=["modeling","rules"],Bi.prototype.preExecute=function(e){var t=this,n=this._modeling,i=this._rules,r=e.oldShape,o=e.newData,a=e.hints||{},s;function c(h,m,g){return i.allowed("connection.reconnect",{connection:g,source:h,target:m})}var u={x:o.x,y:o.y},l={x:r.x,y:r.y,width:r.width,height:r.height};s=e.newShape=e.newShape||t.createShape(o,u,r.parent,a),r.host&&n.updateAttachment(s,r.host);var f;a.moveChildren!==!1&&(f=r.children.slice(),n.moveElements(f,{x:0,y:0},s,a));var p=r.incoming.slice(),d=r.outgoing.slice();k(p,function(h){var m=h.source,g=c(m,s,h);g&&t.reconnectEnd(h,s,Ks(h,s,l),a)}),k(d,function(h){var m=h.target,g=c(s,m,h);g&&t.reconnectStart(h,s,qs(h,s,l),a)})},Bi.prototype.postExecute=function(e){var t=e.oldShape;this._modeling.removeShape(t)},Bi.prototype.execute=function(e){},Bi.prototype.revert=function(e){},Bi.prototype.createShape=function(e,t,n,i){return this._modeling.createShape(e,t,n,i)},Bi.prototype.reconnectStart=function(e,t,n,i){this._modeling.reconnectStart(e,t,n,i)},Bi.prototype.reconnectEnd=function(e,t,n,i){this._modeling.reconnectEnd(e,t,n,i)};function wa(e){this._modeling=e}wa.$inject=["modeling"],wa.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},L(t,{width:n.width,height:n.height,x:n.x,y:n.y}),t},wa.prototype.postExecute=function(e){var t=this._modeling,n=e.shape,i=e.oldBounds,r=e.hints||{};r.layout!==!1&&(k(n.incoming,function(o){t.layoutConnection(o,{connectionEnd:Ks(o,n,i)})}),k(n.outgoing,function(o){t.layoutConnection(o,{connectionStart:qs(o,n,i)})}))},wa.prototype.revert=function(e){var t=e.shape,n=e.oldBounds;return L(t,{width:n.width,height:n.height,x:n.x,y:n.y}),t};function hr(e){this._modeling=e}hr.$inject=["modeling"],hr.prototype.preExecute=function(e){var t=e.delta,n=e.direction,i=e.movingShapes,r=e.resizingShapes,o=e.start,a={};this.moveShapes(i,t),k(r,function(s){a[s.id]=AA(s)}),this.resizeShapes(r,t,n),this.updateConnectionWaypoints(tA(i,r),t,n,o,i,r,a)},hr.prototype.execute=function(){},hr.prototype.revert=function(){},hr.prototype.moveShapes=function(e,t){var n=this;k(e,function(i){n._modeling.moveShape(i,t,null,{autoResize:!1,layout:!1,recurse:!1})})},hr.prototype.resizeShapes=function(e,t,n){var i=this;k(e,function(r){var o=nA(r,n,t);i._modeling.resizeShape(r,o,null,{attachSupport:!1,autoResize:!1,layout:!1})})},hr.prototype.updateConnectionWaypoints=function(e,t,n,i,r,o,a){var s=this,c=new Set(r),u=new Set(o);k(e,function(l){var f=l.source,p=l.target,d=PA(l),h=Hy(n),m={},g=c.has(f)||u.has(f),R=c.has(p)||u.has(p);g&&R?(d=on(d,function(w){return zy(w,i,n)&&(w[h]=w[h]+t[h]),w.original&&zy(w.original,i,n)&&(w.original[h]=w.original[h]+t[h]),w}),s._modeling.updateWaypoints(l,d,{labelBehavior:!1})):(g||R)&&(c.has(f)?m.connectionStart=Vl(l,f,t):c.has(p)?m.connectionEnd=Gl(l,p,t):u.has(f)?m.connectionStart=qs(l,f,a[f.id]):u.has(p)&&(m.connectionEnd=Ks(l,p,a[p.id])),s._modeling.layoutConnection(l,m))})};function Fy(e){return L({},e)}function PA(e){return on(e.waypoints,function(t){return t=Fy(t),t.original&&(t.original=Fy(t.original)),t})}function Hy(e){switch(e){case"n":return"y";case"w":return"x";case"s":return"y";case"e":return"x"}}function zy(e,t,n){var i=Hy(n);if(/e|s/.test(n))return e[i]>t;if(/n|w/.test(n))return e[i]<t}function AA(e){return{x:e.x,y:e.y,height:e.height,width:e.width}}function Ec(e){this._modeling=e}Ec.$inject=["modeling"],Ec.prototype.execute=function(e){var t=e.shape,n=t.children;e.oldChildrenVisibility=Vy(n),t.collapsed=!t.collapsed;var i=Gy(n,t.collapsed);return[t].concat(i)},Ec.prototype.revert=function(e){var t=e.shape,n=e.oldChildrenVisibility,i=t.children,r=Wy(i,n);return t.collapsed=!t.collapsed,[t].concat(r)};function Vy(e){var t={};return k(e,function(n){t[n.id]=n.hidden,n.children&&(t=L({},t,Vy(n.children)))}),t}function Gy(e,t){var n=[];return k(e,function(i){i.hidden=t,n=n.concat(i),i.children&&(n=n.concat(Gy(i.children,i.collapsed||t)))}),n}function Wy(e,t){var n=[];return k(e,function(i){i.hidden=t[i.id],n=n.concat(i),i.children&&(n=n.concat(Wy(i.children,t)))}),n}function Sc(e){this._modeling=e}Sc.$inject=["modeling"],Sc.prototype.execute=function(e){var t=e.shape,n=e.newHost,i=t.host;return e.oldHost=i,e.attacherIdx=Uy(i,t),Yy(n,t),t.host=n,t},Sc.prototype.revert=function(e){var t=e.shape,n=e.newHost,i=e.oldHost,r=e.attacherIdx;return t.host=i,Uy(n,t),Yy(i,t,r),t};function Uy(e,t){return Et(e&&e.attachers,t)}function Yy(e,t,n){if(e){var i=e.attachers;i||(e.attachers=i=[]),Rt(i,t,n)}}function Bp(){}Bp.prototype.execute=function(e){var t=e.connection,n=e.newWaypoints;return e.oldWaypoints=t.waypoints,t.waypoints=n,t},Bp.prototype.revert=function(e){var t=e.connection,n=e.oldWaypoints;return t.waypoints=n,t};function at(e,t,n){this._eventBus=e,this._elementFactory=t,this._commandStack=n;var i=this;e.on("diagram.init",function(){i.registerHandlers(n)})}at.$inject=["eventBus","elementFactory","commandStack"],at.prototype.getHandlers=function(){return{"shape.append":yc,"shape.create":dr,"shape.delete":_a,"shape.move":zr,"shape.resize":wa,"shape.replace":Bi,"shape.toggleCollapse":Ec,spaceTool:hr,"label.create":ya,"connection.create":vc,"connection.delete":va,"connection.move":Ip,"connection.layout":xc,"connection.updateWaypoints":Bp,"connection.reconnect":xa,"elements.create":Op,"elements.move":wc,"elements.delete":Lp,"elements.distribute":bc,"elements.align":gc,"element.updateAttachment":Sc}},at.prototype.registerHandlers=function(e){k(this.getHandlers(),function(t,n){e.registerHandler(n,t)})},at.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)},at.prototype.updateAttachment=function(e,t){var n={shape:e,newHost:t};this._commandStack.execute("element.updateAttachment",n)},at.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)},at.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)},at.prototype.layoutConnection=function(e,t){var n={connection:e,hints:t||{}};this._commandStack.execute("connection.layout",n)},at.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},at.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},at.prototype.createElements=function(e,t,n,i,r){xe(e)||(e=[e]),typeof i!="number"&&(r=i,i=void 0),r=r||{};var o={position:t,elements:e,parent:n,parentIndex:i,hints:r};return this._commandStack.execute("elements.create",o),o.elements},at.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},at.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},at.prototype.removeElements=function(e){var t={elements:e};this._commandStack.execute("elements.delete",t)},at.prototype.distributeElements=function(e,t,n){var i={groups:e,axis:t,dimension:n};this._commandStack.execute("elements.distribute",i)},at.prototype.removeShape=function(e,t){var n={shape:e,hints:t||{}};this._commandStack.execute("shape.delete",n)},at.prototype.removeConnection=function(e,t){var n={connection:e,hints:t||{}};this._commandStack.execute("connection.delete",n)},at.prototype.replaceShape=function(e,t,n){var i={oldShape:e,newData:t,hints:n||{}};return this._commandStack.execute("shape.replace",i),i.newShape},at.prototype.alignElements=function(e,t){var n={elements:e,alignment:t};this._commandStack.execute("elements.align",n)},at.prototype.resizeShape=function(e,t,n,i){var r={shape:e,newBounds:t,minBounds:n,hints:i};this._commandStack.execute("shape.resize",r)},at.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)},at.prototype.updateWaypoints=function(e,t,n){var i={connection:e,newWaypoints:t,hints:n||{}};this._commandStack.execute("connection.updateWaypoints",i)},at.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)},at.prototype.reconnectStart=function(e,t,n,i){i||(i={}),this.reconnect(e,t,e.target,n,L(i,{docking:"source"}))},at.prototype.reconnectEnd=function(e,t,n,i){i||(i={}),this.reconnect(e,e.source,t,n,L(i,{docking:"target"}))},at.prototype.connect=function(e,t,n,i){return this.createConnection(e,t,n||{},e.parent,i)},at.prototype._create=function(e,t){return H1(t)?t:this._elementFactory.create(e,t)},at.prototype.toggleCollapse=function(e,t){var n={shape:e,hints:t||{}};this._commandStack.execute("shape.toggleCollapse",n)};function Ea(e){this._elementRegistry=e}Ea.$inject=["elementRegistry"],Ea.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||TA(n,Xa(i));return qy(n,i),e.oldProperties=o,e.changed=r,r},Ea.prototype.revert=function(e){var t=e.oldProperties,n=e.moddleElement,i=e.changed;return qy(n,t),i},Ea.prototype._getVisualReferences=function(e){var t=this._elementRegistry;return v(e,"bpmn:DataObject")?MA(e,t):[]};function TA(e,t){return Sn(t,function(n,i){return n[i]=e.get(i),n},{})}function qy(e,t){k(t,function(n,i){e.set(i,n)})}function MA(e,t){return t.filter(function(n){return v(n,"bpmn:DataObjectReference")&&Z(n).dataObjectRef===e})}var Sa="default",$i="id",Ky="di",kA={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=NA(e.properties),s=e.oldProperties||DA(t,a);return Xy(a,o)&&(r.unclaim(o[$i]),i.updateId(t,a[$i]),r.claim(a[$i],o)),Sa in a&&(a[Sa]&&n.push(i.get(a[Sa].id)),o[Sa]&&n.push(i.get(o[Sa].id))),Zy(t,a),e.oldProperties=s,e.changed=n,n},Ra.prototype.postExecute=function(e){var t=e.element,n=t.label,i=n&&Z(n).name;if(i){var r=this._textRenderer.getExternalLabelBounds(n,i);this._modeling.resizeShape(n,r,kA)}},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 Zy(t,i),Xy(n,r)&&(a.unclaim(n[$i]),o.updateId(t,i[$i]),a.claim(i[$i],r)),e.changed};function Xy(e,t){return $i in e&&e[$i]!==t[$i]}function DA(e,t){var n=Xa(t),i=e.businessObject,r=Ge(e);return Sn(n,function(o,a){return a!==Ky?o[a]=i.get(a):o[a]=OA(r,Xa(t.di)),o},{})}function OA(e,t){return Sn(t,function(n,i){return n[i]=e&&e.get(i),n},{})}function Zy(e,t){var n=e.businessObject,i=Ge(e);k(t,function(r,o){o!==Ky?n.set(o,r):i&&LA(i,r)})}function LA(e,t){k(t,function(n,i){e.set(i,n)})}var IA=["default"];function NA(e){var t=L({},e);return IA.forEach(function(n){n in e&&(t[n]=Z(t[n]))}),t}function Rc(e,t){this._canvas=e,this._modeling=t}Rc.$inject=["canvas","modeling"],Rc.prototype.execute=function(e){var t=this._canvas,n=e.newRoot,i=n.businessObject,r=t.getRootElement(),o=r.businessObject,a=o.$parent,s=Ge(r);return t.setRootElement(n),t.removeRootElement(r),Rt(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,[]},Rc.prototype.revert=function(e){var t=this._canvas,n=e.newRoot,i=n.businessObject,r=e.oldRoot,o=r.businessObject,a=i.$parent,s=Ge(n);return t.setRootElement(r),t.removeRootElement(n),Et(a.rootElements,i),i.$parent=null,Rt(a.rootElements,o),o.$parent=a,n.di=null,s.bpmnElement=o,r.di=s,[]};function $p(e,t){this._modeling=e,this._spaceTool=t}$p.$inject=["modeling","spaceTool"],$p.prototype.preExecute=function(e){var t=this._spaceTool,n=this._modeling,i=e.shape,r=e.location,o=Yn(i),a=o===i,s=a?i:i.parent,c=ar(s),u=qt(i);if(u?r==="left"?r="top":r==="right"&&(r="bottom"):r==="top"?r="left":r==="bottom"&&(r="right"),!c.length){var l=u?{x:i.x+Un,y:i.y,width:i.width-Un,height:i.height}:{x:i.x,y:i.y+Un,width:i.width,height:i.height-Un};n.createShape({type:"bpmn:Lane",isHorizontal:u},l,s)}var f=[];Lr(o,function(x){return f.push(x),x.label&&f.push(x.label),x===i?[]:Ie(x.children,function(S){return S!==i})});var p,d,h,m,g;r==="top"?(p=-120,d=i.y,h=d+10,m="n",g="y"):r==="left"?(p=-120,d=i.x,h=d+10,m="w",g="x"):r==="bottom"?(p=120,d=i.y+i.height,h=d-10,m="s",g="y"):r==="right"&&(p=120,d=i.x+i.width,h=d-10,m="e",g="x");var R=t.calculateAdjustments(f,g,p,h),w=u?{x:0,y:p}:{x:p,y:0};t.makeSpace(R.movingShapes,R.resizingShapes,w,m,h);var b=u?{x:i.x+(a?Un:0),y:d-(r==="top"?120:0),width:i.width-(a?Un:0),height:120}:{x:d-(r==="left"?120:0),y:i.y+(a?Un:0),width:120,height:i.height-(a?Un:0)};e.newLane=n.createShape({type:"bpmn:Lane",isHorizontal:u},b,s)};function jp(e){this._modeling=e}jp.$inject=["modeling"],jp.prototype.preExecute=function(e){var t=this._modeling,n=e.shape,i=e.count,r=ar(n),o=r.length;if(o>i)throw new Error(`more than <${i}> child lanes`);var a=qt(n),s=a?n.height:n.width,c=Math.round(s/i),u,l,f,p;for(p=0;p<i;p++)p===i-1?u=s-c*p:u=c,l=a?{x:n.x+Un,y:n.y+p*c,width:n.width-Un,height:u}:{x:n.x+p*c,y:n.y+Un,width:u,height:n.height-Un},p<o?t.resizeShape(r[p],l):(f={type:"bpmn:Lane",isHorizontal:a},t.createShape(f,l,n))};function Ca(e,t){this._modeling=e,this._spaceTool=t}Ca.$inject=["modeling","spaceTool"],Ca.prototype.preExecute=function(e){var t=e.shape,n=e.newBounds,i=e.balanced;i!==!1?this.resizeBalanced(t,n):this.resizeSpace(t,n)},Ca.prototype.resizeBalanced=function(e,t){var n=this._modeling,i=MR(e,t);n.resizeShape(e,t),i.forEach(function(r){n.resizeShape(r.shape,r.newBounds)})},Ca.prototype.resizeSpace=function(e,t){var n=this._spaceTool,i=ve(e),r=ve(t),o=Tm(r,i),a=Yn(e),s=[],c=[];Lr(a,function(h){return s.push(h),(v(h,"bpmn:Lane")||v(h,"bpmn:Participant"))&&c.push(h),h.children});var u,l,f,p,d;(o.bottom||o.top)&&(u=o.bottom||o.top,l=e.y+(o.bottom?e.height:0)+(o.bottom?-10:10),f=o.bottom?"s":"n",p=o.top>0||o.bottom<0?-u:u,d=n.calculateAdjustments(s,"y",p,l),n.makeSpace(d.movingShapes,d.resizingShapes,{x:0,y:u},f)),(o.left||o.right)&&(u=o.right||o.left,l=e.x+(o.right?e.width:0)+(o.right?-10:100),f=o.right?"e":"w",p=o.left>0||o.right<0?-u:u,d=n.calculateAdjustments(c,"x",p,l),n.makeSpace(d.movingShapes,d.resizingShapes,{x:u,y:0},f))};var Pa="flowNodeRef",Fp="lanes";function Cc(){}Cc.prototype._computeUpdates=function(e,t){var n=[],i=[],r={},o=[];function a(l,f){var p=ve(f),d={x:l.x+l.width/2,y:l.y+l.height/2};return d.x>p.left&&d.x<p.right&&d.y>p.top&&d.y<p.bottom}function s(l){n.indexOf(l)===-1&&(o.push(l),n.push(l))}function c(l){var f=Yn(l);return r[f.id]||(r[f.id]=Vs(f)),r[f.id]}function u(l){if(!l.parent)return[];var f=c(l);return f.filter(function(p){return a(l,p)}).map(function(p){return p.businessObject})}return t.forEach(function(l){var f=Yn(l);if(!(!f||n.indexOf(f)!==-1)){var p=f.children.filter(function(d){return v(d,"bpmn:FlowNode")});p.forEach(s),n.push(f)}}),e.forEach(s),o.forEach(function(l){var f=l.businessObject,p=f.get(Fp),d=p.slice(),h=u(l);i.push({flowNode:f,remove:d,add:h})}),t.forEach(function(l){var f=l.businessObject;l.parent||f.get(Pa).forEach(function(p){i.push({flowNode:p,remove:[f],add:[]})})}),i},Cc.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(Fp);n.remove.forEach(function(o){Et(r,o),Et(o.get(Pa),i)}),n.add.forEach(function(o){Rt(r,o),Rt(o.get(Pa),i)})}),[]},Cc.prototype.revert=function(e){var t=e.updates;return t.forEach(function(n){var i=n.flowNode,r=i.get(Fp);n.add.forEach(function(o){Et(r,o),Et(o.get(Pa),i)}),n.remove.forEach(function(o){Rt(r,o),Rt(o.get(Pa),i)})}),[]};var Hp="categoryValueRef";function Aa(e,t){this._bpmnFactory=e,this._elementRegistry=t}Aa.$inject=["bpmnFactory","elementRegistry"],Aa.prototype._computeUpdates=function(e,t){var n=this._elementRegistry,i=this._bpmnFactory,r=new Map,o=[],a=new Map;function s(w,b,x){if(b){var S=a.get(w);S||(S={},a.set(w,S)),!(x&&S.present)&&(!x&&S.past||(x?S.present={categoryValue:b,root:zp(w)}:S.past={categoryValue:b}))}}function c(w){r.set(w,Z(w))}function u(){n.filter(function(w){return v(w,"bpmn:FlowElement")&&!De(w)&&w.parent}).forEach(c)}function l(w){var b=Z(w),x=b.get("categoryValueRef");return x||(x=Sm(i,b),o.push(BA(w,x))),x}function f(w){return w.reduce(function(b,x){var S=zp(x),M=b.get(S);return M||(M=[],b.set(S,M)),M.push(x),b},new Map)}e=Array.from(e||[]);var p=f(e);t.length&&u(),e.forEach(c),n.filter(function(w){return v(w,"bpmn:Group")&&!De(w)&&w.parent}).forEach(function(w){var b=Z(w).get("categoryValueRef");if(!b){var x=zp(w),S=p.get(x)||[],M=so(S,w),N=Object.keys(M).length>0;N&&(b=l(w))}s(w,b,!0)}),t.forEach(function(w){s(w.groupShape,w.categoryValue,!1)}),o.length&&u();var d=Array.from(r.keys()),h=Array.from(a.values()).reduce(function(w,b){return b.present&&w.add(b.present.categoryValue),b.past&&w.add(b.past.categoryValue),w},new Set),m=new Map,g=f(d);a.forEach(function(w,b){var x=w.present;if(x){var S=g.get(x.root)||[],M=so(S,b);S.forEach(function(N){if(M[N.id]){var T=m.get(N);T||(T=new Set,m.set(N,T)),T.add(x.categoryValue)}})}});var R=d.reduce(function(w,b){var x=r.get(b),S=x.get(Hp),M=new Set(S),N=m.get(b)||new Set,T=Array.from(N).filter(function(V){return!M.has(V)}),H=S.filter(function(V){return h.has(V)&&!N.has(V)});return(T.length||H.length)&&w.push({businessObject:x,categoryValuesToAdd:T,categoryValuesToRemove:H}),w},[]);return{flowElements:R,groups:o}},Aa.prototype.execute=function(e){var t=e.updates;return t||(t=e.updates=this._computeUpdates(e.affectedFlowElements,e.affectedGroupEntries)),$A(t.groups),FA(t.flowElements),[]},Aa.prototype.revert=function(e){var t=e.updates;return HA(t.flowElements),jA(t.groups),[]};function BA(e,t){return{groupShape:e,categoryValue:t,category:t.$parent}}function $A(e){e.forEach(function(t){Z(t.groupShape).categoryValueRef=t.categoryValue,t.categoryValue.$parent=t.category})}function jA(e){e.forEach(function(t){Z(t.groupShape).categoryValueRef=null})}function FA(e){e.forEach(function(t){var n=t.businessObject,i=n.get(Hp);t.categoryValuesToRemove.forEach(function(r){Et(i,r)}),t.categoryValuesToAdd.forEach(function(r){Rt(i,r,!0)})})}function HA(e){e.forEach(function(t){var n=t.businessObject,i=n.get(Hp);t.categoryValuesToAdd.forEach(function(r){Et(i,r)}),t.categoryValuesToRemove.forEach(function(r){Rt(i,r,!0)})})}function zp(e){for(;e.parent;)e=e.parent;return e}function Pc(e){this._moddle=e}Pc.$inject=["moddle"],Pc.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),[]},Pc.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 zA={fill:void 0,stroke:void 0};function Vp(e){this._commandStack=e,this._normalizeColor=function(t){if(t){if(wn(t)){var n=VA(t);if(n)return n}throw new Error(`invalid color value: ${t}`)}}}Vp.$inject=["commandStack"],Vp.prototype.postExecute=function(e){var t=e.elements,n=e.colors||zA,i=this,r={};"fill"in n&&L(r,{"background-color":this._normalizeColor(n.fill)}),"stroke"in n&&L(r,{"border-color":this._normalizeColor(n.stroke)}),k(t,function(o){var a=ot(o)?ii(r,["border-color"]):r,s=Ge(o);if(GA(a),De(o)){if(!s||!v(s.label,"bpmndi:BPMNLabel"))return;i._commandStack.execute("element.updateModdleProperties",{element:o,moddleElement:s.label,properties:{color:r["border-color"]}})}else{if(!Le(s,["bpmndi:BPMNEdge","bpmndi:BPMNShape"]))return;i._commandStack.execute("element.updateProperties",{element:o,properties:{di:a}})}})};function VA(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 GA(e){"border-color"in e&&(e.stroke=e["border-color"]),"background-color"in e&&(e.fill=e["background-color"])}var WA={width:0,height:0};function Qy(e,t,n){function i(c,u){var l=c.label||c,f=c.labelTarget||c;return _S(l,u),[l,f]}function r(c){var u=c.element,l=u.businessObject,f=c.newLabel;if(!De(u)&&rr(u)&&!Ms(u)&&!Jy(f)){var p=7,d=dl(u);d={x:d.x,y:d.y+p},e.createLabel(u,d,{id:l.id+"_label",businessObject:l,di:u.di})}}function o(c){return c.oldLabel=Hn(c.element),i(c.element,c.newLabel)}function a(c){return i(c.element,c.oldLabel)}function s(c){var u=c.element,l=u.label||u,f=c.newLabel,p=c.newBounds,d=c.hints||{};if(!(!De(l)&&!v(l,"bpmn:TextAnnotation"))){if(De(l)&&Jy(f)){d.removeShape!==!1&&e.removeShape(l,{unsetLabel:!1});return}var h=Hn(u);typeof p>"u"&&(p=t.getExternalLabelBounds(l,h)),p&&e.resizeShape(l,p,WA)}}this.preExecute=r,this.execute=o,this.revert=a,this.postExecute=s}Qy.$inject=["modeling","textRenderer","bpmnFactory"];function Jy(e){return!e||!e.trim()}function tn(e,t,n,i){at.call(this,e,t,n),this._bpmnRules=i}ae(tn,at),tn.$inject=["eventBus","elementFactory","commandStack","bpmnRules"],tn.prototype.getHandlers=function(){var e=at.prototype.getHandlers.call(this);return e["element.updateModdleProperties"]=Ea,e["element.updateProperties"]=Ra,e["canvas.updateRoot"]=Rc,e["lane.add"]=$p,e["lane.resize"]=Ca,e["lane.split"]=jp,e["lane.updateRefs"]=Cc,e["group.updateRefs"]=Aa,e["id.updateClaim"]=Pc,e["element.setColor"]=Vp,e["element.updateLabel"]=Qy,e},tn.prototype.updateLabel=function(e,t,n,i){this._commandStack.execute("element.updateLabel",{element:e,newLabel:t,newBounds:n,hints:i||{}})},tn.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)},tn.prototype.updateModdleProperties=function(e,t,n){this._commandStack.execute("element.updateModdleProperties",{element:e,moddleElement:t,properties:n})},tn.prototype.updateProperties=function(e,t){this._commandStack.execute("element.updateProperties",{element:e,properties:t})},tn.prototype.resizeLane=function(e,t,n){this._commandStack.execute("lane.resize",{shape:e,newBounds:t,balanced:n})},tn.prototype.addLane=function(e,t){var n={shape:e,location:t};return this._commandStack.execute("lane.add",n),n.newLane},tn.prototype.splitLane=function(e,t){this._commandStack.execute("lane.split",{shape:e,count:t})},tn.prototype.makeCollaboration=function(){var e=this._create("root",{type:"bpmn:Collaboration"}),t={newRoot:e};return this._commandStack.execute("canvas.updateRoot",t),e},tn.prototype.makeProcess=function(){var e=this._create("root",{type:"bpmn:Process"}),t={newRoot:e};return this._commandStack.execute("canvas.updateRoot",t),e},tn.prototype.updateLaneRefs=function(e,t){this._commandStack.execute("lane.updateRefs",{flowNodeShapes:e,laneShapes:t})},tn.prototype.updateCategoryValueRefs=function(e,t){this._commandStack.execute("group.updateRefs",{affectedFlowElements:e,affectedGroupEntries:t})},tn.prototype.claimId=function(e,t){this._commandStack.execute("id.updateClaim",{id:e,element:t,claiming:!0})},tn.prototype.unclaimId=function(e,t){this._commandStack.execute("id.updateClaim",{id:e,element:t})},tn.prototype.setColor=function(e,t){e.length||(e=[e]),this._commandStack.execute("element.setColor",{elements:e,colors:t})};function ev(){}ev.prototype.layoutConnection=function(e,t){return t=t||{},[t.connectionStart||we(t.source||e.source),t.connectionEnd||we(t.target||e.target)]};var Ac=20,UA=5,Tc=Math.round,tv=20,YA={"h:h":20,"v:v":20,"h:v":-10,"v:h":-10};function qA(e,t){return!{t:/top/,r:/right/,b:/bottom/,l:/left/,h:/./,v:/./}[t].test(e)}function KA(e,t){return{t:/top/,r:/right/,b:/bottom/,l:/left/,h:/left|right/,v:/top|bottom/}[e].test(t)}function nv(e,t,n){var i=Qt(t,e,UA),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=KA(r,i),l=/h|r|l/.test(r),f=!1,p=!1;return u?(s=l?{x:o,y:e.y}:{x:e.x,y:a},c=l?"h:h":"v:v"):(f=qA(i,r),c=l?"h:v":"v:h",f?l?(p=a===e.y,s={x:e.x+Ac*(/l/.test(r)?-1:1),y:p?a+Ac:a}):(p=o===e.x,s={x:p?o+Ac:o,y:e.y+Ac*(/t/.test(r)?-1:1)}):s={x:o,y:a}),{waypoints:Gp(e,s,c).concat(s),directions:c,turnNextDirections:p}}function XA(e,t,n){return nv(e,t,n)}function ZA(e,t,n){var i=nv(t,e,iv(n));return{waypoints:i.waypoints.slice().reverse(),directions:iv(i.directions),turnNextDirections:i.turnNextDirections}}function QA(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=Gp(e.waypoints[e.waypoints.length-1],t.waypoints[0],r);return{waypoints:o,directions:r}}function iv(e){return e.split(":").reverse().join(":")}function JA(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 Gp(e,t,n){if(n=n||"h:h",!cT(n))throw new Error("unknown directions: <"+n+">: must be specified as <start>:<end> with start/end in { h,v,t,r,b,l }");if(ov(n)){var i=XA(e,t,n),r=ZA(e,t,n),o=QA(i,r);return[].concat(i.waypoints,o.waypoints,r.waypoints)}return JA(e,t,n)}function eT(e,t,n){var i=Gp(e,t,n);return i.unshift(e),i.push(t),sv(i)}function tT(e,t,n,i,r){var o=r&&r.preferredLayouts||[],a=i0(o,"straight")[0]||"h:h",s=YA[a]||0,c=Qt(e,t,s),u=sT(c,a);n=n||we(e),i=i||we(t);var l=u.split(":"),f=av(n,e,l[0],uT(c)),p=av(i,t,l[1],c);return eT(f,p,u)}function nT(e,t,n,i,r,o){xe(n)&&(r=n,o=i,n=we(e),i=we(t)),o=L({preferredLayouts:[]},o),r=r||[];var a=o.preferredLayouts,s=a.indexOf("straight")!==-1,c;return c=s&&rT(e,t,n,i,o),c||(c=o.connectionEnd&&aT(t,e,i,r),c)||(c=o.connectionStart&&oT(e,t,n,r),c)?c:!o.connectionStart&&!o.connectionEnd&&r&&r.length?r:tT(e,t,n,i,o)}function iT(e,t,n){return e>=t&&e<=n}function rv(e,t,n){var i={x:"width",y:"height"};return iT(t[e],n[e],n[e]+n[i[e]])}function rT(e,t,n,i,r){var o={},a,s;return s=Qt(e,t),/^(top|bottom|left|right)$/.test(s)?(/top|bottom/.test(s)&&(a="x"),/left|right/.test(s)&&(a="y"),r.preserveDocking==="target"?rv(a,i,e)?(o[a]=i[a],[{x:o.x!==void 0?o.x:n.x,y:o.y!==void 0?o.y:n.y,original:{x:o.x!==void 0?o.x:n.x,y:o.y!==void 0?o.y:n.y}},{x:i.x,y:i.y}]):null:rv(a,n,t)?(o[a]=n[a],[{x:n.x,y:n.y},{x:o.x!==void 0?o.x:i.x,y:o.y!==void 0?o.y:i.y,original:{x:o.x!==void 0?o.x:i.x,y:o.y!==void 0?o.y:i.y}}]):null):null}function oT(e,t,n,i){return Wp(e,t,n,i)}function aT(e,t,n,i){var r=i.slice().reverse();return r=Wp(e,t,n,r),r?r.reverse():null}function Wp(e,t,n,i){function r(l){return l.length<3?!0:l.length>4?!1:!!ut(l,function(f,p){var d=l[p-1];return d&&Qo(f,d)<3})}function o(l,f,p){var d=Ti(f,l);switch(d){case"v":return{x:p.x,y:l.y};case"h":return{x:l.x,y:p.y}}return{x:l.x,y:l.y}}function a(l,f,p){var d;for(d=l.length-2;d!==0;d--)if(Mh(l[d],f,tv)||Mh(l[d],p,tv))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=Wp(e,t,n,u)),c&&Ti(c)?null:c}function sT(e,t){if(ov(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 cT(e){return e&&/^h|v|t|r|b|l:h|v|t|r|b|l$/.test(e)}function ov(e){return e&&/t|r|b|l/.test(e)}function uT(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 av(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 sv(e){return e.reduce(function(t,n,i){var r=t[t.length-1],o=e[i+1];return cl(r,o,n,0)||t.push(n),t},[])}var lT=-10,pT=40,fT={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},dT={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},Up={top:"bottom","top-right":"bottom-left","top-left":"bottom-right",right:"left",bottom:"top","bottom-right":"top-left","bottom-left":"top-right",left:"right"},Ta={top:"t",right:"r",bottom:"b",left:"l"};function Mc(e){this._elementRegistry=e}ae(Mc,ev),Mc.prototype.layoutConnection=function(e,t){t||(t={});var n=t.source||e.source,i=t.target||e.target,r=t.waypoints||e.waypoints,o=t.connectionStart,a=t.connectionEnd,s=this._elementRegistry,c,u;if(o||(o=cv(r&&r[0],n)),a||(a=cv(r&&r[r.length-1],i)),(v(e,"bpmn:Association")||v(e,"bpmn:DataAssociation"))&&r&&!uv(n,i))return[].concat([o],r.slice(1,-1),[a]);var l=bm(n,s)?fT:dT;return v(e,"bpmn:MessageFlow")?c=mT(n,i,l):(v(e,"bpmn:SequenceFlow")||uv(n,i))&&(n===i?c={preferredLayouts:xT(n,e,l)}:v(n,"bpmn:BoundaryEvent")?c={preferredLayouts:wT(n,i,a,l)}:Ma(n)||Ma(i)?c={preferredLayouts:l.subProcess,preserveDocking:yT(n)}:v(n,"bpmn:Gateway")?c={preferredLayouts:l.fromGateway}:v(i,"bpmn:Gateway")?c={preferredLayouts:l.toGateway}:c={preferredLayouts:l.default}),c&&(c=L(c,t),u=sv(nT(n,i,o,a,r,c))),u||[o,a]};function hT(e){var t=e.host;return Qt(we(e),t,lT)}function mT(e,t,n){return{preferredLayouts:n.messageFlow,preserveDocking:gT(e,t)}}function gT(e,t){return v(t,"bpmn:Participant")?"source":v(e,"bpmn:Participant")?"target":Ma(t)?"source":Ma(e)||v(t,"bpmn:Event")?"target":v(e,"bpmn:Event")?"source":null}function yT(e){return Ma(e)?"target":"source"}function cv(e,t){return e?e.original||e:we(t)}function uv(e,t){return v(t,"bpmn:Activity")&&v(e,"bpmn:BoundaryEvent")&&t.businessObject.isForCompensation}function Ma(e){return v(e,"bpmn:SubProcess")&&$e(e)}function Vr(e,t){return e===t}function vT(e,t){return t.indexOf(e)!==-1}function Po(e){var t=/right|left/.exec(e);return t&&t[0]}function Ao(e){var t=/top|bottom/.exec(e);return t&&t[0]}function lv(e,t){return Up[e]===t}function _T(e,t){var n=Po(e),i=Up[n];return t.indexOf(i)!==-1}function bT(e,t){var n=Ao(e),i=Up[n];return t.indexOf(i)!==-1}function pv(e){return e==="right"||e==="left"}function xT(e,t,n){var i=t.waypoints,r=i&&i.length&&Qt(i[0],e);return r==="top"?n.loop.fromTop:r==="right"?n.loop.fromRight:r==="left"?n.loop.fromLeft:n.loop.fromBottom}function wT(e,t,n,i){var r=we(e),o=we(t),a=hT(e),s,c,u=Vr(e.host,t),l=vT(a,["top","right","bottom","left"]),f=Qt(o,r,{x:e.width/2+t.width/2,y:e.height/2+t.height/2});return u?ET(a,l,e,t,n,i):(s=ST(a,f,l,i.isHorizontal),c=RT(a,f,l,i.isHorizontal),[s+":"+c])}function ET(e,t,n,i,r,o){var a=t?e:o.isHorizontal?Ao(e):Po(e),s=Ta[a],c;return t?pv(e)?c=fv("y",n,i,r)?"h":o.boundaryLoop.alternateHorizontalSide:c=fv("x",n,i,r)?"v":o.boundaryLoop.alternateVerticalSide:c=o.boundaryLoop.default,[s+":"+c]}function fv(e,t,n,i){var r=pT;return!(Yp(e,i,n,r)||Yp(e,i,{x:n.x+n.width,y:n.y+n.height},r)||Yp(e,i,we(t),r))}function Yp(e,t,n,i){return Math.abs(t[e]-n[e])<i}function ST(e,t,n,i){if(n)return Ta[e];var r=Ao(e),o=Po(e),a=Ao(t),s=Po(t);if(i){if(Vr(r,a)||lv(o,s))return Ta[r]}else if(Vr(o,s)||lv(r,a))return Ta[o];return Ta[i?o:r]}function RT(e,t,n,i){if(n)return pv(e)?_T(e,t)||Vr(e,t)?"h":"v":bT(e,t)||Vr(e,t)?"v":"h";var r=Ao(e),o=Po(e),a=Ao(t),s=Po(t);return a&&!s?"v":s&&!a?"h":i?Vr(r,a)?"h":"v":Vr(o,s)?"v":"h"}Mc.$inject=["elementRegistry"];function dv(e){return L({original:e.point.original||e.point},e.actual)}function mr(e,t){this._elementRegistry=e,this._graphicsFactory=t}mr.$inject=["elementRegistry","graphicsFactory"],mr.prototype.getCroppedWaypoints=function(e,t,n){t=t||e.source,n=n||e.target;var i=this.getDockingPoint(e,t,!0),r=this.getDockingPoint(e,n),o=e.waypoints.slice(i.idx+1,r.idx);return o.unshift(dv(i)),o.push(dv(r)),o},mr.prototype.getDockingPoint=function(e,t,n){var i=e.waypoints,r,o,a;return r=n?0:i.length-1,o=i[r],a=this._getIntersection(t,e,n),{point:o,actual:a||o,idx:r}},mr.prototype._getIntersection=function(e,t,n){var i=this._getShapePath(e),r=this._getConnectionPath(t);return Jo(i,r,n)},mr.prototype._getConnectionPath=function(e){return this._graphicsFactory.getConnectionPath(e)},mr.prototype._getShapePath=function(e){return this._graphicsFactory.getShapePath(e)},mr.prototype._getGfx=function(e){return this._elementRegistry.getGraphics(e)};const qp={__init__:["modeling","bpmnUpdater"],__depends__:[GC,aP,cP,uP,Ry,lA,fA,vA,Kn,kp,ky],bpmnFactory:["type",Zn],bpmnUpdater:["type",kn],elementFactory:["type",fr],modeling:["type",tn],layouter:["type",Mc],connectionDocking:["type",mr]};var CT=10,hv=50,PT=250;function Kp(e,t,n,i){for(var r;r=AT(e,n,t);)n=i(t,n,r);return n}function Xp(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 AT(e,t,n){var i={x:t.x-n.width/2,y:t.y-n.height/2,width:n.width,height:n.height},r=MT(e);return ut(r,function(o){if(o===n)return!1;var a=Qt(o,i,CT);return a==="intersect"})}function TT(e,t){t||(t={});function n(h){return h.source===e?1:-1}var i=t.defaultDistance||hv,r=t.direction||"e",o=t.filter,a=t.getWeight||n,s=t.maxDistance||PT,c=t.reference||"start";o||(o=OT);function u(h,m){return r==="n"?c==="start"?ve(h).top-ve(m).bottom:c==="center"?ve(h).top-we(m).y:ve(h).top-ve(m).top:r==="w"?c==="start"?ve(h).left-ve(m).right:c==="center"?ve(h).left-we(m).x:ve(h).left-ve(m).left:r==="s"?c==="start"?ve(m).top-ve(h).bottom:c==="center"?we(m).y-ve(h).bottom:ve(m).bottom-ve(h).bottom:c==="start"?ve(m).left-ve(h).right:c==="center"?we(m).x-ve(h).right:ve(m).right-ve(h).right}var l=e.incoming.filter(o).map(function(h){var m=a(h),g=m<0?u(h.source,e):u(e,h.source);return{id:h.source.id,distance:g,weight:m}}),f=e.outgoing.filter(o).map(function(h){var m=a(h),g=m>0?u(e,h.target):u(h.target,e);return{id:h.target.id,distance:g,weight:m}}),p=l.concat(f).reduce(function(h,m){return h[m.id+"__weight_"+m.weight]=m,h},{}),d=Sn(p,function(h,m){var g=m.distance,R=m.weight;return g<0||g>s||(h[String(g)]||(h[String(g)]=0),h[String(g)]+=1*R,(!h.distance||h[h.distance]<h[String(g)])&&(h.distance=g)),h},{});return d.distance||i}function MT(e){var t=Zp(e);return e.host&&(t=t.concat(Zp(e.host))),e.attachers&&(t=t.concat(e.attachers.reduce(function(n,i){return n.concat(Zp(i))},[]))),t}function Zp(e){return DT(e).concat(kT(e))}function kT(e){return e.incoming.map(function(t){return t.source})}function DT(e){return e.outgoing.map(function(t){return t.target})}function OT(){return!0}var LT=100;function mv(e,t,n){e.on("autoPlace",LT,function(i){var r=i.shape,o=i.source;return IT(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}}mv.$inject=["eventBus","modeling","canvas"];function IT(e,t,n){n||(n={});var i=n.defaultDistance||hv,r=we(e),o=ve(e);return{x:o.right+i+t.width/2,y:r.y}}function gv(e,t){e.on("autoPlace.end",500,function(n){t.select(n.shape)})}gv.$inject=["eventBus","selection"];const NT={__init__:["autoPlaceSelectionBehavior"],autoPlace:["type",mv],autoPlaceSelectionBehavior:["type",gv]};function yv(e,t,n){var i=bm(e,n);if(v(t,"bpmn:TextAnnotation"))return $T(e,t,i);if(Le(t,["bpmn:DataObjectReference","bpmn:DataStoreReference"]))return jT(e,t,i);if(v(t,"bpmn:FlowNode"))return BT(e,t,i)}function BT(e,t,n){var i=ve(e),r=we(e),o=n?{directionHint:"e",minDistance:80,baseOrientation:"left",boundaryOrientation:"top",start:"top",end:"bottom"}:{directionHint:"s",minDistance:90,baseOrientation:"top",boundaryOrientation:"left",start:"left",end:"right"},a=TT(e,{filter:function(d){return v(d,"bpmn:SequenceFlow")},direction:o.directionHint}),s=30,c=o.minDistance,u=o.baseOrientation;v(e,"bpmn:BoundaryEvent")&&(u=Qt(e,e.host,-25),u.indexOf(o.boundaryOrientation)!==-1&&(s*=-1));var l=n?{x:i.right+a+t.width/2,y:r.y+vv(u,c,o)}:{x:r.x+vv(u,c,o),y:i.bottom+a+t.height/2},f={margin:s,minDistance:c},p=n?{y:f}:{x:f};return Kp(e,t,l,Xp(p))}function vv(e,t,n){return e.includes(n.start)?-1*t:e.includes(n.end)?t:0}function $T(e,t,n){var i=ve(e),r=n?{x:i.right+t.width/2,y:i.top-50-t.height/2}:{x:i.right+50+t.width/2,y:i.bottom+t.height/2};ot(e)&&(r=we(e),n?(r.x+=100,r.y-=50):(r.x+=100,r.y+=50));var o={margin:n?-30:30,minDistance:20},a=n?{y:o}:{x:o};return Kp(e,t,r,Xp(a))}function jT(e,t,n){var i=ve(e),r=n?{x:i.right-10+t.width/2,y:i.bottom+40+t.width/2}:{x:i.left-40-t.width/2,y:i.bottom-10+t.height/2},o={margin:30,minDistance:30},a=n?{x:o}:{y:o};return Kp(e,t,r,Xp(a))}function _v(e,t){e.on("autoPlace",function(n){var i=n.shape,r=n.source;return yv(r,i,t)})}_v.$inject=["eventBus","elementRegistry"];const kc={__depends__:[NT],__init__:["bpmnAutoPlace"],bpmnAutoPlace:["type",_v]},bv=[vm,oa,qp,kc];function FT(e={}){vd(globalThis,e.dom);const t=document.createElement("div");return document.body.appendChild(t),new lo({container:t,moddleExtensions:e.moddleExtensions??is,additionalModules:[...bv,...e.additionalModules??[]]})}var HT=new Ro("ov"),zT=500;function Kt(e,t,n,i){this._eventBus=t,this._canvas=n,this._elementRegistry=i,this._ids=HT,this._overlayDefaults=L({show:null,scale:!0},e&&e.defaults),this._overlays={},this._overlayContainers=[],this._overlayRoot=VT(n.getContainer()),this._init()}Kt.$inject=["config.overlays","eventBus","canvas","elementRegistry"],Kt.prototype.get=function(e){if(wn(e)&&(e={id:e}),wn(e.element)&&(e.element=this._elementRegistry.get(e.element)),e.element){var t=this._getOverlayContainer(e.element,!0);return t?e.type?Ie(t.overlays,eo({type:e.type})):t.overlays.slice():[]}else return e.type?Ie(this._overlays,eo({type:e.type})):e.id?this._overlays[e.id]:null},Kt.prototype.add=function(e,t,n){if(Ut(t)&&(n=t,t=null),e.id||(e=this._elementRegistry.get(e)),!n.position)throw new Error("must specifiy overlay position");if(!n.html)throw new Error("must specifiy overlay html");if(!e)throw new Error("invalid element specified");var i=this._ids.next();return n=L({},this._overlayDefaults,n,{id:i,type:t,element:e,html:n.html}),this._addOverlay(n),i},Kt.prototype.remove=function(e){var t=this.get(e)||[];xe(t)||(t=[t]);var n=this;k(t,function(i){var r=n._getOverlayContainer(i.element,!0);if(i&&(pi(i.html),pi(i.htmlContainer),delete i.htmlContainer,delete i.element,delete n._overlays[i.id]),r){var o=r.overlays.indexOf(i);o!==-1&&r.overlays.splice(o,1)}})},Kt.prototype.isShown=function(){return this._overlayRoot.style.display!=="none"},Kt.prototype.show=function(){Dc(this._overlayRoot)},Kt.prototype.hide=function(){Dc(this._overlayRoot,!1)},Kt.prototype.clear=function(){this._overlays={},this._overlayContainers=[],ms(this._overlayRoot)},Kt.prototype._updateOverlayContainer=function(e){var t=e.element,n=e.html,i=t.x,r=t.y;if(t.waypoints){var o=Tt(t);i=o.x,r=o.y}xv(n,i,r),sn(e.html,"data-container-id",t.id)},Kt.prototype._updateOverlay=function(e){var t=e.position,n=e.htmlContainer,i=e.element,r=t.left,o=t.top;if(t.right!==void 0){var a;i.waypoints?a=Tt(i).width:a=i.width,r=t.right*-1+a}if(t.bottom!==void 0){var s;i.waypoints?s=Tt(i).height:s=i.height,o=t.bottom*-1+s}xv(n,r||0,o||0),this._updateOverlayVisibilty(e,this._canvas.viewbox())},Kt.prototype._createOverlayContainer=function(e){var t=lt('<div class="djs-overlays" />');gn(t,{position:"absolute"}),this._overlayRoot.appendChild(t);var n={html:t,element:e,overlays:[]};return this._updateOverlayContainer(n),this._overlayContainers.push(n),n},Kt.prototype._updateRoot=function(e){var t=e.scale||1,n="matrix("+[t,0,0,t,-1*e.x*t,-1*e.y*t].join(",")+")";wv(this._overlayRoot,n)},Kt.prototype._getOverlayContainer=function(e,t){var n=ut(this._overlayContainers,function(i){return i.element===e});return!n&&!t?this._createOverlayContainer(e):n},Kt.prototype._addOverlay=function(e){var t=e.id,n=e.element,i=e.html,r,o;i.get&&i.constructor.prototype.jquery&&(i=i.get(0)),wn(i)&&(i=lt(i)),o=this._getOverlayContainer(n),r=lt('<div class="djs-overlay" data-overlay-id="'+t+'">'),gn(r,{position:"absolute"}),r.appendChild(i),e.type&&mt(r).add("djs-overlay-"+e.type);var a=this._canvas.findRoot(n),s=this._canvas.getRootElement();Dc(r,a===s),e.htmlContainer=r,o.overlays.push(e),o.html.appendChild(r),this._overlays[t]=e,this._updateOverlay(e),this._updateOverlayVisibilty(e,this._canvas.viewbox())},Kt.prototype._updateOverlayVisibilty=function(e,t){var n=e.show,i=this._canvas.findRoot(e.element),r=n&&n.minZoom,o=n&&n.maxZoom,a=e.htmlContainer,s=this._canvas.getRootElement(),c=!0;(i!==s||n&&(jt(r)&&r>t.scale||jt(o)&&o<t.scale))&&(c=!1),Dc(a,c),this._updateOverlayScale(e,t)},Kt.prototype._updateOverlayScale=function(e,t){var n=e.scale,i,r,o=e.htmlContainer,a,s="";n!==!0&&(n===!1?(i=1,r=1):(i=n.min,r=n.max),jt(i)&&t.scale<i&&(a=(1/t.scale||1)*i),jt(r)&&t.scale>r&&(a=(1/t.scale||1)*r)),jt(a)&&(s="scale("+a+","+a+")"),wv(o,s)},Kt.prototype._updateOverlaysVisibilty=function(e){var t=this;k(this._overlays,function(n){t._updateOverlayVisibilty(n,e)})},Kt.prototype._init=function(){var e=this._eventBus,t=this;function n(i){t._updateRoot(i),t._updateOverlaysVisibilty(i),t.show()}e.on("canvas.viewbox.changing",function(i){t.hide()}),e.on("canvas.viewbox.changed",function(i){n(i.viewbox)}),e.on(["shape.remove","connection.remove"],function(i){var r=i.element,o=t.get({element:r});k(o,function(c){t.remove(c.id)});var a=t._getOverlayContainer(r);if(a){pi(a.html);var s=t._overlayContainers.indexOf(a);s!==-1&&t._overlayContainers.splice(s,1)}}),e.on("element.changed",zT,function(i){var r=i.element,o=t._getOverlayContainer(r,!0);o&&(k(o.overlays,function(a){t._updateOverlay(a)}),t._updateOverlayContainer(o))}),e.on("element.marker.update",function(i){var r=t._getOverlayContainer(i.element,!0);r&&mt(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 VT(e){var t=lt('<div class="djs-overlay-container" />');return gn(t,{position:"absolute",width:0,height:0}),e.insertBefore(t,e.firstChild),t}function xv(e,t,n){gn(e,{left:t+"px",top:n+"px"})}function Dc(e,t){e.style.display=t===!1?"none":""}function wv(e,t){e.style["transform-origin"]="top left",["","-ms-","-webkit-"].forEach(function(n){e.style[n+"transform"]=t})}const Oc={__init__:["overlays"],overlays:["type",Kt]};function Qp(e,t){t.invoke(X,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)})}ae(Qp,X),Qp.$inject=["canvas","injector"];const GT={__init__:["rootElementsBehavior"],rootElementsBehavior:["type",Qp]};function ka(e){return CSS.escape(e)}var WT={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"};function Ev(e){return e=""+e,e&&e.replace(/[&<>"']/g,function(t){return WT[t]})}var UT="bjs-breadcrumbs-shown";function Sv(e,t,n){var i=lt('<ul class="bjs-breadcrumbs"></ul>'),r=n.getContainer(),o=mt(r);r.appendChild(i);var a=[];e.on("element.changed",function(c){var u=c.element,l=Z(u),f=ut(a,function(p){return p===l});f&&s()});function s(c){c&&(a=YT(c));var u=a.flatMap(function(f){var p=n.findRoot(gi(f))||n.findRoot(f.id);if(!p&&v(f,"bpmn:Process")){var d=t.find(function(g){var R=Z(g);return R&&R.get("processRef")===f});p=d&&n.findRoot(d.id)}if(!p)return[];var h=Ev(f.name||f.id),m=lt('<li><span class="bjs-crumb"><a title="'+h+'">'+h+"</a></span></li>");return m.addEventListener("click",function(){n.setRootElement(p)}),m});i.innerHTML="";var l=u.length>1;o.toggle(UT,l),u.forEach(function(f){i.appendChild(f)})}e.on("root.set",function(c){s(c.element)})}Sv.$inject=["eventBus","elementRegistry","canvas"];function YT(e){for(var t=Z(e),n=[],i=t;i;i=i.$parent)(v(i,"bpmn:SubProcess")||v(i,"bpmn:Process"))&&n.push(i);return n.reverse()}function Rv(e,t){var n=null,i=new qT;e.on("root.set",function(r){var o=r.element,a=t.viewbox(),s=i.get(o);if(i.set(n,{x:a.x,y:a.y,zoom:a.scale}),n=o,!(!v(o,"bpmn:SubProcess")&&!s)){s=s||{x:0,y:0,zoom:1};var c=(a.x-s.x)*a.scale,u=(a.y-s.y)*a.scale;(c!==0||u!==0)&&t.scroll({dx:c,dy:u}),s.zoom!==a.scale&&t.zoom(s.zoom,{x:0,y:0})}}),e.on("diagram.clear",function(){i.clear(),n=null})}Rv.$inject=["eventBus","canvas"];function qT(){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 Cv={x:180,y:160};function Gr(e,t){this._eventBus=e,this._moddle=t;var n=this;e.on("import.render.start",1500,function(i,r){n._handleImport(r.definitions)})}Gr.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)})}},Gr.prototype._createNewDiagrams=function(e){var t=this,n=[],i=[];e.get("planeElement").forEach(function(o){var a=o.bpmnElement;if(a){var s=a.$parent;v(a,"bpmn:SubProcess")&&!o.isExpanded&&n.push(a),XT(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},Gr.prototype._movePlaneElementsToOrigin=function(e){var t=e.get("planeElement"),n=KT(e),i={x:n.x-Cv.x,y:n.y-Cv.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)})},Gr.prototype._moveToDiPlane=function(e,t){var n=Pv(e),i=n.plane.get("planeElement");i.splice(i.indexOf(e),1),t.get("planeElement").push(e)},Gr.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},Gr.$inject=["eventBus","moddle"];function Pv(e){return v(e,"bpmndi:BPMNDiagram")?e:Pv(e.$parent)}function KT(e){var t={top:1/0,right:-1/0,bottom:-1/0,left:1/0};return e.planeElement.forEach(function(n){if(n.bounds){var i=ve(n.bounds);t.top=Math.min(i.top,t.top),t.left=Math.min(i.left,t.left)}}),Ss(t)}function XT(e,t){var n=e.$parent;return!(!v(n,"bpmn:SubProcess")||n===t.bpmnElement||Le(e,["bpmn:DataInputAssociation","bpmn:DataOutputAssociation"]))}var Lc=250,ZT='<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>',QT="bjs-drilldown-empty";function gr(e,t,n,i,r){X.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",Lc,function(a){var s=a.shape;o._canDrillDown(s)?o._addOverlay(s):o._removeOverlay(s)},!0),this.reverted("shape.toggleCollapse",Lc,function(a){var s=a.shape;o._canDrillDown(s)?o._addOverlay(s):o._removeOverlay(s)},!0),this.executed(["shape.create","shape.move","shape.delete"],Lc,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"],Lc,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)})})}ae(gr,X),gr.prototype._updateDrilldownOverlay=function(e){var t=this._canvas;if(e){var n=t.findRoot(e);n&&this._updateOverlayVisibility(n)}},gr.prototype._canDrillDown=function(e){var t=this._canvas;return v(e,"bpmn:SubProcess")&&t.findRoot(gi(e))},gr.prototype._updateOverlayVisibility=function(e){var t=this._overlays,n=Z(e),i=t.get({element:n.id,type:"drilldown"})[0];if(i){var r=n&&n.get("flowElements")&&n.get("flowElements").length;mt(i.html).toggle(QT,!r)}},gr.prototype._addOverlay=function(e){var t=this._canvas,n=this._overlays,i=Z(e),r=n.get({element:e,type:"drilldown"});r.length&&this._removeOverlay(e);var o=lt('<button type="button" class="bjs-drilldown">'+ZT+"</button>"),a=i.get("name")||i.get("id"),s=this._translate("Open {element}",{element:a});o.setAttribute("title",s),o.addEventListener("click",function(){t.setRootElement(t.findRoot(gi(e)))}),n.add(e,"drilldown",{position:{bottom:-7,right:-8},html:o}),this._updateOverlayVisibility(e)},gr.prototype._removeOverlay=function(e){var t=this._overlays;t.remove({element:e,type:"drilldown"})},gr.$inject=["canvas","eventBus","elementRegistry","overlays","translate"];const JT={__depends__:[Oc,kp,GT],__init__:["drilldownBreadcrumbs","drilldownOverlayBehavior","drilldownCentering","subprocessCompatibility"],drilldownBreadcrumbs:["type",Sv],drilldownCentering:["type",Rv],drilldownOverlayBehavior:["type",gr],subprocessCompatibility:["type",Gr]};function yr(e){yt.call(this,e)}ae(yr,yt),yr.prototype._modules=[vm,JT,Oc,Kn,oa],yr.prototype._moddleExtensions={};var Ic="keyboard.keydown",eM="keyboard.keyup",tM=1e3,Av="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 yn(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(Av));var i=e&&e.bind!==!1;t.on("canvas.init",function(r){n._target=r.svg,i&&n.bind(),n._fire("init")})}yn.$inject=["config.keyboard","eventBus"],yn.prototype._keydownHandler=function(e){this._keyHandler(e,Ic)},yn.prototype._keyupHandler=function(e){this._keyHandler(e,eM)},yn.prototype._keyHandler=function(e,t){var n;if(!this._isEventIgnored(e)){var i={keyEvent:e};n=this._eventBus.fire(t||Ic,i),n&&e.preventDefault()}},yn.prototype._isEventIgnored=function(e){return!1},yn.prototype.bind=function(e){e&&console.error("unsupported argument <node>",new Error(Av)),this.unbind(),e=this._node=this._target,Pe.bind(e,"keydown",this._keydownHandler),Pe.bind(e,"keyup",this._keyupHandler),this._fire("bind")},yn.prototype.getBinding=function(){return this._node},yn.prototype.unbind=function(){var e=this._node;e&&(this._fire("unbind"),Pe.unbind(e,"keydown",this._keydownHandler),Pe.unbind(e,"keyup",this._keyupHandler)),this._node=null},yn.prototype._fire=function(e){this._eventBus.fire("keyboard."+e,{node:this._node})},yn.prototype.addListener=function(e,t,n){Yt(e)&&(n=t,t=e,e=tM),this._eventBus.on(n||Ic,e,t)},yn.prototype.removeListener=function(e,t){this._eventBus.off(t||Ic,e)},yn.prototype.hasModifier=wP,yn.prototype.isCmd=Tn,yn.prototype.isShift=bp,yn.prototype.isKey=Vt;var nM=500;function To(e,t){var n=this;e.on("editorActions.init",nM,function(i){var r=i.editorActions;n.registerBindings(t,r)})}To.$inject=["eventBus","keyboard"],To.prototype.registerBindings=function(e,t){function n(i,r){t.isRegistered(i)&&e.addListener(r)}n("undo",function(i){var r=i.keyEvent;if(PP(r))return t.trigger("undo"),!0}),n("redo",function(i){var r=i.keyEvent;if(AP(r))return t.trigger("redo"),!0}),n("copy",function(i){var r=i.keyEvent;if(EP(r))return t.trigger("copy"),!0}),n("paste",function(i){var r=i.keyEvent;if(SP(r))return t.trigger("paste"),!0}),n("duplicate",function(i){var r=i.keyEvent;if(RP(r))return t.trigger("duplicate"),!0}),n("cut",function(i){var r=i.keyEvent;if(CP(r))return t.trigger("cut"),!0}),n("stepZoom",function(i){var r=i.keyEvent;if(Vt(["+","Add","="],r)&&Tn(r))return t.trigger("stepZoom",{value:1}),!0}),n("stepZoom",function(i){var r=i.keyEvent;if(Vt(["-","Subtract"],r)&&Tn(r))return t.trigger("stepZoom",{value:-1}),!0}),n("zoom",function(i){var r=i.keyEvent;if(Vt("0",r)&&Tn(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 Jp={__init__:["keyboard","keyboardBindings"],keyboard:["type",yn],keyboardBindings:["type",To]};var iM={moveSpeed:50,moveSpeedAccelerated:200};function Tv(e,t,n){var i=this;this._config=L({},iM,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})}}Tv.$inject=["config.keyboardMove","keyboard","canvas"];const Mv={__depends__:[Jp],__init__:["keyboardMove"],keyboardMove:["type",Tv]};var rM=15;function kv(e,t){var n;function i(s){return a(s.originalEvent)}e.on("canvas.focus.changed",function(s){s.focused?e.on("element.mousedown",500,i):e.off("element.mousedown",i)});function r(s){var c=n.start,u=n.button,l=$r(s),f=ri(l,c);if(!n.dragging&&oM(f)>rM&&(n.dragging=!0,u===0&&ry(e),cc("grab")),n.dragging){var p=n.last||n.start;f=ri(l,p),t.scroll({dx:f.x,dy:f.y}),n.last=l}s.preventDefault()}function o(s){Pe.unbind(document,"mousemove",r),Pe.unbind(document,"mouseup",o),n=null,iy()}function a(s){if(!Dr(s.target,".djs-draggable")){var c=s.button;if(!(c>=2||s.ctrlKey||s.shiftKey||s.altKey))return n={button:c,start:$r(s)},Pe.bind(document,"mousemove",r),Pe.bind(document,"mouseup",o),!0}}this.isActive=function(){return!!n}}kv.$inject=["eventBus","canvas"];function oM(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}const Dv={__init__:["moveCanvas"],moveCanvas:["type",kv]};function Ov(e,t){var n=yl(e.min),i=yl(e.max),r=Math.abs(n)+Math.abs(i);return r/t}function aM(e,t){return Math.max(e.min,Math.min(e.max,t))}var sM=Math.sign||function(e){return e>=0?1:-1},ef={min:.2,max:4},Lv=10,cM=.1,uM=.75;function _i(e,t,n){e=e||{},this._enabled=!1,this._canvas=n,this._container=n._container,this._handleWheel=_n(this._handleWheel,this),this._totalDelta=0,this._scale=e.scale||uM;var i=this;t.on("canvas.mouseover",function(){i._init(e.enabled!==!1)}),t.on("canvas.mouseout",function(){i._init(!1)})}_i.$inject=["config.zoomScroll","eventBus","canvas"],_i.prototype.scroll=function(t){this._canvas.scroll(t)},_i.prototype.reset=function(){this._canvas.zoom("fit-viewport")},_i.prototype.zoom=function(t,n){var i=Ov(ef,Lv*2);this._totalDelta+=t,Math.abs(this._totalDelta)>cM&&(this._zoom(t,n,i),this._totalDelta=0)},_i.prototype._handleWheel=function(t){if(this._enabled){var n=this._container;t.preventDefault();var i=t.ctrlKey||pg()&&t.metaKey,r=t.shiftKey,o=-1*this._scale,a;if(i?o*=t.deltaMode===0?.02:.32:o*=t.deltaMode===0?1:16,i){var s=n.getBoundingClientRect(),c={x:t.clientX-s.left,y:t.clientY-s.top};a=Math.sqrt(Math.pow(t.deltaY,2)+Math.pow(t.deltaX,2))*sM(t.deltaY)*o,this.zoom(a,c)}else r?a={dx:o*t.deltaY,dy:0}:a={dx:o*t.deltaX,dy:o*t.deltaY},this.scroll(a)}},_i.prototype.stepZoom=function(t,n){var i=Ov(ef,Lv);this._zoom(t,n,i)},_i.prototype._zoom=function(e,t,n){var i=this._canvas,r=e>0?1:-1,o=yl(i.zoom()),a=Math.round(o/n)*n;a+=n*r;var s=Math.pow(10,a);i.zoom(aM(ef,s),t)},_i.prototype.toggle=function(t){var n=this._container,i=this._handleWheel,r=this._enabled;return typeof t>"u"&&(t=!r),r!==t&&Pe[t?"bind":"unbind"](n,"wheel",i,!1),this._enabled=t,t},_i.prototype._init=function(e){this.toggle(e)};const Iv={__init__:["zoomScroll"],zoomScroll:["type",_i]};function Da(e){yr.call(this,e)}ae(Da,yr),Da.prototype._navigationModules=[Mv,Dv,Iv],Da.prototype._modules=[].concat(yr.prototype._modules,Da.prototype._navigationModules);function tf(e){return e&&e[e.length-1]}function Nv(e){return e.y}function Bv(e){return e.x}var lM={left:Bv,center:Bv,right:function(e){return e.x+e.width},top:Nv,middle:Nv,bottom:function(e){return e.y+e.height}};function Mo(e,t){this._modeling=e,this._rules=t}Mo.$inject=["modeling","rules"],Mo.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}},Mo.prototype._isType=function(e,t){return t.indexOf(e)!==-1},Mo.prototype._alignmentPosition=function(e,t){var n=this._getOrientationDetails(e),i=n.axis,r=n.dimension,o={},a={},s=!1,c,u,l;function f(p,d){return Math.round((p[i]+d[i]+d[r])/2)}if(this._isType(e,["left","top"]))o[e]=t[0][i];else if(this._isType(e,["right","bottom"]))l=tf(t),o[e]=l[i]+l[r];else if(this._isType(e,["center","middle"])){if(k(t,function(p){var d=p[i]+Math.round(p[r]/2);a[d]?a[d].elements.push(p):a[d]={elements:[p],center:d}}),c=ai(a,function(p){return p.elements.length>1&&(s=!0),p.elements.length}),s)return o[e]=tf(c).center,o;u=t[0],t=ai(t,function(p){return p[i]+p[r]}),l=tf(t),o[e]=f(u,l)}return o},Mo.prototype.trigger=function(e,t){var n=this._modeling,i,r=Ie(e,function(c){return!(c.waypoints||c.host||c.labelTarget)});if(i=this._rules.allowed("elements.align",{elements:r}),xe(i)&&(r=i),!(r.length<2||!i)){var o=lM[t],a=ai(r,o),s=this._alignmentPosition(t,a);n.alignElements(a,s)}};const pM={__init__:["alignElements"],alignElements:["type",Mo]},fM=new Ro;function ko(e){this._scheduled={},e.on("diagram.destroy",()=>{Object.keys(this._scheduled).forEach(t=>{this.cancel(t)})})}ko.$inject=["eventBus"],ko.prototype.schedule=function(e,t=fM.next()){this.cancel(t);const n=this._schedule(e,t);return this._scheduled[t]=n,n.promise},ko.prototype._schedule=function(e,t){const n=dM();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}},ko.prototype.cancel=function(e){const t=this._scheduled[e];t&&(this._cancel(t),this._scheduled[e]=null)},ko.prototype._cancel=function(e){clearTimeout(e.executionId)};function dM(){const e={};return e.promise=new Promise((t,n)=>{e.resolve=t,e.reject=n}),e}const hM={scheduler:["type",ko]};var mM="djs-element-hidden",Nc=".entry",gM=1e3,$v=8,yM=300;function kt(e,t,n,i){this._canvas=e,this._elementRegistry=t,this._eventBus=n,this._scheduler=i,this._current=null,this._init()}kt.$inject=["canvas","elementRegistry","eventBus","scheduler"],kt.prototype._init=function(){var e=this;this._eventBus.on("selection.changed",function(t){var n=t.newSelection,i=n.length?n.length===1?n[0]:n:null;i?e.open(i,!0):e.close()}),this._eventBus.on("elements.changed",function(t){var n=t.elements,i=e._current;if(i){var r=i.target,o=xe(r)?r:[r],a=o.filter(function(c){return n.includes(c)});if(a.length){e.close();var s=o.filter(function(c){return e._elementRegistry.get(c.id)});s.length&&e._updateAndOpen(s.length>1?s:s[0])}}}),this._eventBus.on("canvas.viewbox.changed",function(){e._updatePosition()}),this._eventBus.on("element.marker.update",function(t){if(e.isOpen()){var n=t.element,i=e._current,r=xe(i.target)?i.target:[i.target];r.includes(n)&&e._updateVisibility()}}),this._container=this._createContainer()},kt.prototype._createContainer=function(){var e=lt('<div class="djs-context-pad-parent"></div>');return this._canvas.getContainer().appendChild(e),e},kt.prototype.registerProvider=function(e,t){t||(t=e,e=gM),this._eventBus.on("contextPad.getProviders",e,function(n){n.providers.push(t)})},kt.prototype.getEntries=function(e){var t=this._getProviders(),n=xe(e)?"getMultiElementContextPadEntries":"getContextPadEntries",i={};return k(t,function(r){if(Yt(r[n])){var o=r[n](e);Yt(o)?i=o(i):k(o,function(a,s){i[s]=a})}}),i},kt.prototype.trigger=function(e,t,n){var i=this,r,o,a=t.delegateTarget||t.target;if(!a)return t.preventDefault();if(r=sn(a,"data-action"),o=t.originalEvent||t,e==="mouseover"){this._timeout=setTimeout(function(){i._mouseout=i.triggerEntry(r,"hover",o,n)},yM);return}else if(e==="mouseout"){clearTimeout(this._timeout),this._mouseout&&(this._mouseout(),this._mouseout=null);return}return this.triggerEntry(r,e,o,n)},kt.prototype.triggerEntry=function(e,t,n,i){if(this.isShown()){var r=this._current.target,o=this._current.entries,a=o[e];if(a){var s=a.action;if(this._eventBus.fire("contextPad.trigger",{entry:a,event:n})!==!1){if(Yt(s)){if(t==="click")return s(n,r,i)}else if(s[t])return s[t](n,r,i);n.preventDefault()}}}},kt.prototype.open=function(e,t){if(!(!t&&this.isOpen(e))){var n=this._eventBus.fire("contextPad.open.allowed",{target:e});n!==!1&&(this.close(),this._updateAndOpen(e))}},kt.prototype._getProviders=function(){var e=this._eventBus.createEvent({type:"contextPad.getProviders",providers:[]});return this._eventBus.fire(e),e.providers},kt.prototype._updateAndOpen=function(e){var t=this.getEntries(e),n=this._createHtml(e),i;k(t,function(r,o){var a=r.group||"default",s=lt(r.html||'<div class="entry" draggable="true"></div>'),c;sn(s,"data-action",o),c=nt("[data-group="+ka(a)+"]",n),c||(c=lt('<div class="group"></div>'),sn(c,"data-group",a),n.appendChild(c)),c.appendChild(s),r.className&&vM(s,r.className),r.title&&sn(s,"title",r.title),r.imageUrl&&(i=lt("<img>"),sn(i,"src",r.imageUrl),i.style.width="100%",i.style.height="100%",s.appendChild(i))}),mt(n).add("open"),this._current={entries:t,html:n,target:e},this._updatePosition(),this._updateVisibility(),this._eventBus.fire("contextPad.open",{current:this._current})},kt.prototype._createHtml=function(e){var t=this,n=lt('<div class="djs-context-pad"></div>');return Cn.bind(n,Nc,"click",function(i){t.trigger("click",i)}),Cn.bind(n,Nc,"dragstart",function(i){t.trigger("dragstart",i)}),Cn.bind(n,Nc,"mouseover",function(i){t.trigger("mouseover",i)}),Cn.bind(n,Nc,"mouseout",function(i){t.trigger("mouseout",i)}),Pe.bind(n,"mousedown",function(i){i.stopPropagation()}),this._container.appendChild(n),this._eventBus.fire("contextPad.create",{target:e,pad:n}),n},kt.prototype.getPad=function(e){console.warn(new Error("ContextPad#getPad is deprecated and will be removed in future library versions, cf. https://github.com/bpmn-io/diagram-js/pull/888"));let t;return this.isOpen()&&bM(this._current.target,e)?t=this._current.html:t=this._createHtml(e),{html:t}},kt.prototype.close=function(){this.isOpen()&&(clearTimeout(this._timeout),this._container.innerHTML="",this._eventBus.fire("contextPad.close",{current:this._current}),this._current=null)},kt.prototype.isOpen=function(e){var t=this._current;if(!t)return!1;if(!e)return!0;var n=t.target;return xe(e)!==xe(n)?!1:xe(e)?e.length===n.length&&Cr(e,function(i){return n.includes(i)}):n===e},kt.prototype.isShown=function(){return this.isOpen()&&mt(this._current.html).has("open")},kt.prototype.show=function(){this.isOpen()&&(mt(this._current.html).add("open"),this._updatePosition(),this._eventBus.fire("contextPad.show",{current:this._current}))},kt.prototype.hide=function(){this.isOpen()&&(mt(this._current.html).remove("open"),this._eventBus.fire("contextPad.hide",{current:this._current}))},kt.prototype._getPosition=function(e){if(!xe(e)&&ot(e)){var t=this._canvas.viewbox(),n=_M(e),i=n.x*t.scale-t.x*t.scale,r=n.y*t.scale-t.y*t.scale;return{left:i+$v*this._canvas.zoom(),top:r}}var o=this._canvas.getContainer(),a=o.getBoundingClientRect(),s=this._getTargetBounds(e);return{left:s.right-a.left+$v*this._canvas.zoom(),top:s.top-a.top}},kt.prototype._updatePosition=function(){const e=()=>{if(this.isOpen()){var t=this._current.html,n=this._getPosition(this._current.target);"x"in n&&"y"in n?(t.style.left=n.x+"px",t.style.top=n.y+"px"):["top","right","bottom","left"].forEach(function(i){i in n&&(t.style[i]=n[i]+"px")})}};this._scheduler.schedule(e,"ContextPad#_updatePosition")},kt.prototype._updateVisibility=function(){const e=()=>{if(this.isOpen()){var t=this,n=this._current.target,i=xe(n)?n:[n],r=i.some(function(o){return t._canvas.hasMarker(o,mM)});r?t.hide():t.show()}};this._scheduler.schedule(e,"ContextPad#_updateVisibility")},kt.prototype._getTargetBounds=function(e){var t=this,n=xe(e)?e:[e],i=n.map(function(r){return t._canvas.getGraphics(r)});return i.reduce(function(r,o){const a=o.getBoundingClientRect();return r.top=Math.min(r.top,a.top),r.right=Math.max(r.right,a.right),r.bottom=Math.max(r.bottom,a.bottom),r.left=Math.min(r.left,a.left),r.x=r.left,r.y=r.top,r.width=r.right-r.left,r.height=r.bottom-r.top,r},{top:1/0,right:-1/0,bottom:-1/0,left:1/0})};function vM(e,t){var n=mt(e);t=xe(t)?t:t.split(/\s+/g),t.forEach(function(i){n.add(i)})}function _M(e){return e.waypoints[e.waypoints.length-1]}function bM(e,t){return e=xe(e)?e:[e],t=xe(t)?t:[t],e.length===t.length&&Cr(e,function(n){return t.includes(n)})}const jv={__depends__:[sc,hM,Oc],contextPad:["type",kt]};var Bc,_t,Fv,vr,Hv,zv,Vv,nf,$c,Oa,Gv,rf,of,af,jc={},Fc=[],xM=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,Hc=Array.isArray;function ji(e,t){for(var n in t)e[n]=t[n];return e}function sf(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function Wv(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?Bc.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 zc(e,a,i,r,null)}function zc(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??++Fv,__i:-1,__u:0};return r==null&&_t.vnode!=null&&_t.vnode(o),o}function Vc(e){return e.children}function Gc(e,t){this.props=e,this.context=t}function Wr(e,t){if(t==null)return e.__?Wr(e.__,e.__i+1):null;for(var n;t<e.__k.length;t++)if((n=e.__k[t])!=null&&n.__e!=null)return n.__e;return typeof e.type=="function"?Wr(e):null}function wM(e){if(e.__P&&e.__d){var t=e.__v,n=t.__e,i=[],r=[],o=ji({},t);o.__v=t.__v+1,_t.vnode&&_t.vnode(o),cf(e.__P,o,t,e.__n,e.__P.namespaceURI,32&t.__u?[n]:null,i,n??Wr(t),!!(32&t.__u),r),o.__v=t.__v,o.__.__k[o.__i]=o,Jv(i,o,r),t.__e=t.__=null,o.__e!=n&&Uv(o)}}function Uv(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}),Uv(e)}function Yv(e){(!e.__d&&(e.__d=!0)&&vr.push(e)&&!Wc.__r++||Hv!=_t.debounceRendering)&&((Hv=_t.debounceRendering)||zv)(Wc)}function Wc(){try{for(var e,t=1;vr.length;)vr.length>t&&vr.sort(Vv),e=vr.shift(),t=vr.length,wM(e)}finally{vr.length=Wc.__r=0}}function qv(e,t,n,i,r,o,a,s,c,u,l){var f,p,d,h,m,g,R=i&&i.__k||Fc,w=t.length;for(c=EM(n,t,R,c,w),f=0;f<w;f++)(d=n.__k[f])!=null&&(p=d.__i!=-1&&R[d.__i]||jc,d.__i=f,g=cf(e,d,p,r,o,a,s,c,u,l),h=d.__e,d.ref&&p.ref!=d.ref&&(p.ref&&uf(p.ref,null,d),l.push(d.ref,d.__c||h,d)),m==null&&h!=null&&(m=h),4&d.__u?(c=Kv(d,c,e),p.__e&&(p.__e=null)):typeof d.type=="function"&&g!==void 0?c=g:h&&(c=h.nextSibling),d.__u&=-7);return n.__e=m,c}function EM(e,t,n,i,r){var o,a,s,c,u,l=n.length,f=l,p=0;for(e.__k=new Array(r),o=0;o<r;o++)(a=t[o])!=null&&typeof a!="boolean"&&typeof a!="function"?(typeof a=="string"||typeof a=="number"||typeof a=="bigint"||a.constructor==String?a=e.__k[o]=zc(null,a,null,null,null):Hc(a)?a=e.__k[o]=zc(Vc,{children:a},null,null,null):a.constructor===void 0&&a.__b>0?a=e.__k[o]=zc(a.type,a.props,a.key,a.ref?a.ref:null,a.__v):e.__k[o]=a,c=o+p,a.__=e,a.__b=e.__b+1,s=null,(u=a.__i=SM(a,n,c,f))!=-1&&(f--,(s=n[u])&&(s.__u|=2)),s==null||s.__v==null?(u==-1&&(r>l?p--:r<l&&p++),typeof a.type!="function"&&(a.__u|=4)):u!=c&&(u==c-1?p--:u==c+1?p++:(u>c?p--:p++,a.__u|=4))):e.__k[o]=null;if(f)for(o=0;o<l;o++)(s=n[o])!=null&&(2&s.__u)==0&&(s.__e==i&&(i=Wr(s)),t_(s,s));return i}function Kv(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=Kv(i[r],t,n));return t}e.__e!=t&&(t&&e.type&&!t.parentNode&&(t=Wr(e)),t=n.insertBefore(e.__e,t||null));do t=t&&t.nextSibling;while(t!=null&&t.nodeType==8);return t}function SM(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 Xv(e,t,n){t[0]=="-"?e.setProperty(t,n??""):e[t]=n==null?"":typeof n!="number"||xM.test(t)?n:n+"px"}function Uc(e,t,n,i,r){var o,a;e:if(t=="style")if(typeof n=="string")e.style.cssText=n;else{if(typeof i=="string"&&(e.style.cssText=i=""),i)for(t in i)n&&t in n||Xv(e.style,t,"");if(n)for(t in n)i&&n[t]==i[t]||Xv(e.style,t,n[t])}else if(t[0]=="o"&&t[1]=="n")o=t!=(t=t.replace(Gv,"$1")),a=t.toLowerCase(),t=a in e||t=="onFocusOut"||t=="onFocusIn"?a.slice(2):t.slice(2),e.l||(e.l={}),e.l[t+o]=n,n?i?n[Oa]=i[Oa]:(n[Oa]=rf,e.addEventListener(t,o?af:of,o)):e.removeEventListener(t,o?af:of,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 Zv(e){return function(t){if(this.l){var n=this.l[t.type+e];if(t[$c]==null)t[$c]=rf++;else if(t[$c]<n[Oa])return;return n(_t.event?_t.event(t):t)}}}function cf(e,t,n,i,r,o,a,s,c,u){var l,f,p,d,h,m,g,R,w,b,x,S,M,N,T,H,V=t.type;if(t.constructor!==void 0)return null;128&n.__u&&(c=!!(32&n.__u),o=[s=t.__e=n.__e]),(l=_t.__b)&&l(t);e:if(typeof V=="function"){f=a.length;try{if(w=t.props,b=V.prototype&&V.prototype.render,x=(l=V.contextType)&&i[l.__c],S=l?x?x.props.value:l.__:i,n.__c?R=(p=t.__c=n.__c).__=p.__E:(b?t.__c=p=new V(w,S):(t.__c=p=new Gc(w,S),p.constructor=V,p.render=CM),x&&x.sub(p),p.state||(p.state={}),p.__n=i,d=p.__d=!0,p.__h=[],p._sb=[]),b&&p.__s==null&&(p.__s=p.state),b&&V.getDerivedStateFromProps!=null&&(p.__s==p.state&&(p.__s=ji({},p.__s)),ji(p.__s,V.getDerivedStateFromProps(w,p.__s))),h=p.props,m=p.state,p.__v=t,d)b&&V.getDerivedStateFromProps==null&&p.componentWillMount!=null&&p.componentWillMount(),b&&p.componentDidMount!=null&&p.__h.push(p.componentDidMount);else{if(b&&V.getDerivedStateFromProps==null&&w!==h&&p.componentWillReceiveProps!=null&&p.componentWillReceiveProps(w,S),t.__v==n.__v||!p.__e&&p.shouldComponentUpdate!=null&&p.shouldComponentUpdate(w,p.__s,S)===!1){t.__v!=n.__v&&(p.props=w,p.state=p.__s,p.__d=!1),t.__e=n.__e,t.__k=n.__k,t.__k.some(function($){$&&($.__=t)}),Fc.push.apply(p.__h,p._sb),p._sb=[],p.__h.length&&a.push(p),s=Wr(n);break e}p.componentWillUpdate!=null&&p.componentWillUpdate(w,p.__s,S),b&&p.componentDidUpdate!=null&&p.__h.push(function(){p.componentDidUpdate(h,m,g)})}if(p.context=S,p.props=w,p.__P=e,p.__e=!1,M=_t.__r,N=0,b)p.state=p.__s,p.__d=!1,M&&M(t),l=p.render(p.props,p.state,p.context),Fc.push.apply(p.__h,p._sb),p._sb=[];else do p.__d=!1,M&&M(t),l=p.render(p.props,p.state,p.context),p.state=p.__s;while(p.__d&&++N<25);p.state=p.__s,p.getChildContext!=null&&(i=ji(ji({},i),p.getChildContext())),b&&!d&&p.getSnapshotBeforeUpdate!=null&&(g=p.getSnapshotBeforeUpdate(h,m)),T=l!=null&&l.type===Vc&&l.key==null?e_(l.props.children):l,s=qv(e,Hc(T)?T:[T],t,n,i,r,o,a,s,c,u),p.base=t.__e,t.__u&=-161,p.__h.length&&a.push(p),R&&(p.__E=p.__=null)}catch($){if(a.length=f,t.__v=null,c||o!=null){if($.then){for(t.__u|=c?160:128;s&&s.nodeType==8&&s.nextSibling;)s=s.nextSibling;o!=null&&(o[o.indexOf(s)]=null),t.__e=s}else if(o!=null)for(H=o.length;H--;)sf(o[H])}else t.__e=n.__e;t.__k==null&&(t.__k=n.__k||[]),$.then||Qv(t),_t.__e($,t,n)}}else o==null&&t.__v==n.__v?(t.__k=n.__k,t.__e=n.__e):s=t.__e=RM(n.__e,t,n,i,r,o,a,c,u);return(l=_t.diffed)&&l(t),128&t.__u?void 0:s}function Qv(e){e&&(e.__c&&(e.__c.__e=!0),e.__k&&e.__k.some(Qv))}function Jv(e,t,n){for(var i=0;i<n.length;i++)uf(n[i],n[++i],n[++i]);_t.__c&&_t.__c(t,e),e.some(function(r){try{e=r.__h,r.__h=[],e.some(function(o){o.call(r)})}catch(o){_t.__e(o,r.__v)}})}function e_(e){return typeof e!="object"||e==null||e.__b>0?e:Hc(e)?e.map(e_):e.constructor!==void 0?null:ji({},e)}function RM(e,t,n,i,r,o,a,s,c){var u,l,f,p,d,h,m,g=n.props||jc,R=t.props,w=t.type;if(w=="svg"?r="http://www.w3.org/2000/svg":w=="math"?r="http://www.w3.org/1998/Math/MathML":r||(r="http://www.w3.org/1999/xhtml"),o!=null){for(u=0;u<o.length;u++)if((d=o[u])&&"setAttribute"in d==!!w&&(w?d.localName==w:d.nodeType==3)){e=d,o[u]=null;break}}if(e==null){if(w==null)return document.createTextNode(R);e=document.createElementNS(r,w,R.is&&R),s&&(_t.__m&&_t.__m(t,o),s=!1),o=null}if(w==null)g===R||s&&e.data==R||(e.data=R);else{if(o=w=="textarea"&&R.defaultValue!=null?null:o&&Bc.call(e.childNodes),!s&&o!=null)for(g={},u=0;u<e.attributes.length;u++)g[(d=e.attributes[u]).name]=d.value;for(u in g)d=g[u],u=="dangerouslySetInnerHTML"?f=d:u=="children"||u in R||u=="value"&&"defaultValue"in R||u=="checked"&&"defaultChecked"in R||Uc(e,u,null,d,r);for(u in R)d=R[u],u=="children"?p=d:u=="dangerouslySetInnerHTML"?l=d:u=="value"?h=d:u=="checked"?m=d:s&&typeof d!="function"||g[u]===d||Uc(e,u,d,g[u],r);if(l)s||f&&(l.__html==f.__html||l.__html==e.innerHTML)||(e.innerHTML=l.__html),t.__k=[];else if(f&&(e.innerHTML=""),qv(t.type=="template"?e.content:e,Hc(p)?p:[p],t,n,i,w=="foreignObject"?"http://www.w3.org/1999/xhtml":r,o,a,o?o[0]:n.__k&&Wr(n,0),s,c),o!=null)for(u=o.length;u--;)sf(o[u]);s&&w!="textarea"||(u="value",w=="progress"&&h==null?e.removeAttribute("value"):h!=null&&(h!==e[u]||w=="progress"&&!h||w=="option"&&h!=g[u])&&Uc(e,u,h,g[u],r),u="checked",m!=null&&m!=e[u]&&Uc(e,u,m,g[u],r))}return e}function uf(e,t,n){try{if(typeof e=="function"){var i=typeof e.__u=="function";i&&e.__u(),i&&t==null||(e.__u=e(t))}else e.current=t}catch(r){_t.__e(r,n)}}function t_(e,t,n){var i,r;if(_t.unmount&&_t.unmount(e),(i=e.ref)&&(i.current&&i.current!=e.__e||uf(i,null,t)),(i=e.__c)!=null){if(i.componentWillUnmount)try{i.componentWillUnmount()}catch(o){_t.__e(o,t)}i.base=i.__P=i.__n=null}if(i=e.__k)for(r=0;r<i.length;r++)i[r]&&t_(i[r],t,n||typeof e.type!="function");n||sf(e.__e),e.__c=e.__=e.__e=void 0}function CM(e,t,n){return this.constructor(e,n)}function n_(e,t,n){var i,r,o,a;t==document&&(t=document.documentElement),_t.__&&_t.__(e,t),r=(i=!1)?null:t.__k,o=[],a=[],cf(t,e=t.__k=Wv(Vc,null,[e]),r||jc,jc,t.namespaceURI,r?null:t.firstChild?Bc.call(t.childNodes):null,o,r?r.__e:t.firstChild,i,a),Jv(o,e,a),e.props.children=null}Bc=Fc.slice,_t={__e:function(e,t,n,i){for(var r,o,a;t=t.__;)if((r=t.__c)&&!r.__)try{if((o=r.constructor)&&o.getDerivedStateFromError!=null&&(r.setState(o.getDerivedStateFromError(e)),a=r.__d),r.componentDidCatch!=null&&(r.componentDidCatch(e,i||{}),a=r.__d),a)return r.__E=r}catch(s){e=s}throw e}},Fv=0,Gc.prototype.setState=function(e,t){var n;n=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=ji({},this.state),typeof e=="function"&&(e=e(ji({},n),this.props)),e&&ji(n,e),e!=null&&this.__v&&(t&&this._sb.push(t),Yv(this))},Gc.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),Yv(this))},Gc.prototype.render=Vc,vr=[],zv=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,Vv=function(e,t){return e.__v.__b-t.__v.__b},Wc.__r=0,nf=Math.random().toString(8),$c="__d"+nf,Oa="__a"+nf,Gv=/(PointerCapture)$|Capture$/i,rf=0,of=Zv(!1),af=Zv(!0);var i_=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,i_(e,s,n,["",null])),i.push(r),s[0]?t[0]|=2:(t[o-2]=0,t[o]=r)):i.push(s)}return i},r_=new Map;function PM(e){var t=r_.get(this);return t||(t=new Map,r_.set(this,t)),(t=i_(this,t.get(e)||(t.set(e,t=(function(n){for(var i,r,o=1,a="",s="",c=[0],u=function(p){o===1&&(p||(a=a.replace(/^\s*\n\s*|\s*\n\s*$/g,"")))?c.push(0,p,a):o===3&&(p||a)?(c.push(3,p,a),o=2):o===2&&a==="..."&&p?c.push(4,p,0):o===2&&a&&!p?c.push(5,0,!0,a):o>=5&&((a||!p&&o===5)&&(c.push(o,0,a,r),o=6),p&&(c.push(o,p,0,r),o=6)),a=""},l=0;l<n.length;l++){l&&(o===1&&u(),u(l));for(var f=0;f<n[l].length;f++)i=n[l][f],o===1?i==="<"?(u(),c=[c],o=3):a+=i:o===4?a==="--"&&i===">"?(o=1,a=""):a=i+a[0]:s?i===s?s="":a+=i:i==='"'||i==="'"?s=i:i===">"?(u(),o=1):o&&(i==="="?(o=5,r=a,a=""):i==="/"&&(o<5||n[l][f+1]===">")?(u(),o===3&&(c=c[0]),o=c,(c=c[0]).push(2,0,o),o=0):i===" "||i===" "||i===`
11
- `||i==="\r"?(u(),o=2):a+=i),o===3&&a==="!--"&&(o=4,c=c[0])}return u(),c})(e)),t),arguments,[])).length>1?t:t[0]}var st=PM.bind(Wv),Do,Dt,lf,o_,La=0,a_=[],Gt=_t,s_=Gt.__b,c_=Gt.__r,u_=Gt.diffed,l_=Gt.__c,p_=Gt.unmount,f_=Gt.__;function Yc(e,t){Gt.__h&&Gt.__h(Dt,e,La||t),La=0;var n=Dt.__H||(Dt.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({}),n.__[e]}function pf(e){return La=1,AM(h_,e)}function AM(e,t,n){var i=Yc(Do++,2);if(i.t=e,!i.__c&&(i.__=[h_(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=Dt,!Dt.__f)){var r=function(s,c,u){if(!i.__c.__H)return!0;var l=!1,f=i.__c.props!==s;if(i.__c.__H.__.some(function(d){if(d.__N){l=!0;var h=d.__[0];d.__=d.__N,d.__N=void 0,h!==d.__[0]&&(f=!0)}}),o){var p=o.call(this,s,c,u);return l?p||f:p}return!l||f};Dt.__f=!0;var o=Dt.shouldComponentUpdate,a=Dt.componentWillUpdate;Dt.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)},Dt.shouldComponentUpdate=r}return i.__N||i.__}function qc(e,t){var n=Yc(Do++,3);!Gt.__s&&hf(n.__H,t)&&(n.__=e,n.u=t,Dt.__H.__h.push(n))}function ff(e,t){var n=Yc(Do++,4);!Gt.__s&&hf(n.__H,t)&&(n.__=e,n.u=t,Dt.__h.push(n))}function Kc(e){return La=5,Fi(function(){return{current:e}},[])}function Fi(e,t){var n=Yc(Do++,7);return hf(n.__H,t)&&(n.__=e(),n.__H=t,n.__h=e),n.__}function Ia(e,t){return La=8,Fi(function(){return e},t)}function TM(){for(var e;e=a_.shift();){var t=e.__H;if(e.__P&&t)try{t.__h.some(Xc),t.__h.some(df),t.__h=[]}catch(n){t.__h=[],Gt.__e(n,e.__v)}}}Gt.__b=function(e){Dt=null,s_&&s_(e)},Gt.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),f_&&f_(e,t)},Gt.__r=function(e){c_&&c_(e),Do=0;var t=(Dt=e.__c).__H;t&&(lf===Dt?(t.__h=[],Dt.__h=[],t.__.some(function(n){n.__N&&(n.__=n.__N),n.u=n.__N=void 0})):(t.__h.some(Xc),t.__h.some(df),t.__h=[],Do=0)),lf=Dt},Gt.diffed=function(e){u_&&u_(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(a_.push(t)!==1&&o_===Gt.requestAnimationFrame||((o_=Gt.requestAnimationFrame)||MM)(TM)),t.__H.__.some(function(n){n.u&&(n.__H=n.u,n.u=void 0)})),lf=Dt=null},Gt.__c=function(e,t){t.some(function(n){try{n.__h.some(Xc),n.__h=n.__h.filter(function(i){return!i.__||df(i)})}catch(i){t.some(function(r){r.__h&&(r.__h=[])}),t=[],Gt.__e(i,n.__v)}}),l_&&l_(e,t)},Gt.unmount=function(e){p_&&p_(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.some(function(i){try{Xc(i)}catch(r){t=r}}),n.__H=void 0,t&&Gt.__e(t,n.__v))};var d_=typeof requestAnimationFrame=="function";function MM(e){var t,n=function(){clearTimeout(i),d_&&cancelAnimationFrame(t),setTimeout(e)},i=setTimeout(n,35);d_&&(t=requestAnimationFrame(n))}function Xc(e){var t=Dt,n=e.__c;typeof n=="function"&&(e.__c=void 0,n()),Dt=t}function df(e){var t=Dt;e.__c=e.__(),Dt=t}function hf(e,t){return!e||e.length!==t.length||t.some(function(n,i){return n!==e[i]})}function h_(e,t){return typeof t=="function"?t(e):t}function kM(e){const{navigationStack:t,setNavigationStack:n}=e,i=Fi(()=>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 st`
10
+ <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="`+p+'" height="'+d+'" viewBox="'+l+" "+f+" "+p+" "+d+'" version="1.1">'+s+a+"</svg>"}catch(i){n=i}if(this._emit("saveSVG.done",{error:n,svg:t}),n)throw n;return{svg:t}},bt.prototype._setDefinitions=function(e){this._definitions=e},bt.prototype.getModules=function(){return this._modules},bt.prototype.clear=function(){this.getDefinitions()&&ir.prototype.clear.call(this)},bt.prototype.destroy=function(){ir.prototype.destroy.call(this),pi(this._container)},bt.prototype.on=function(e,t,n,i){return this.get("eventBus").on(e,t,n,i)},bt.prototype.off=function(e,t){this.get("eventBus").off(e,t)},bt.prototype.attachTo=function(e){if(!e)throw new Error("parentNode required");this.detach(),e.get&&e.constructor.prototype.jquery&&(e=e.get(0)),typeof e=="string"&&(e=nt(e)),e.appendChild(this._container),this._emit("attach",{}),this.get("canvas").resized()},bt.prototype.getDefinitions=function(){return this._definitions},bt.prototype.detach=function(){const e=this._container,t=e.parentNode;t&&(this._emit("detach",{}),t.removeChild(e))},bt.prototype._init=function(e,t,n){const i=n.modules||this.getModules(n),r=n.additionalModules||[],o=[{bpmnjs:["value",this],moddle:["value",t]}],a=[].concat(o,i,r),s=I(ai(n,["additionalModules"]),{canvas:I({},n.canvas,{container:e}),modules:a});ir.call(this,s),n&&n.container&&this.attachTo(n.container)},bt.prototype._emit=function(e,t){return this.get("eventBus").fire(e,t)},bt.prototype._createContainer=function(e){const t=pt('<div class="bjs-container"></div>');return yn(t,{width:pm(e.width),height:pm(e.height),position:e.position}),t},bt.prototype._createModdle=function(e){const t=I({},this._moddleExtensions,e.moddleExtensions);return new gd(t)},bt.prototype._modules=[];function Os(e,t){return e.warnings=t,e}function dS(e){const n=/unparsable content <([^>]+)> detected([\s\S]*)$/.exec(e.message);return n&&(e.message="unparsable content <"+n[1]+"> detected; this may indicate an invalid BPMN 2.0 diagram file"+n[2]),e}const hS={width:"100%",height:"100%",position:"relative"};function pm(e){return e+(Pe(e)?"px":"")}function mS(e,t){return t&&ut(e.diagrams,function(n){return n.id===t})||null}function gS(e){const n='<a href="http://bpmn.io" target="_blank" class="bjs-powered-by" title="Powered by bpmn.io" >'+sm+"</a>",i=pt(n);yn(nt("svg",i),cm),yn(i,um,{position:"absolute",bottom:"15px",right:"15px",zIndex:"100"}),e.appendChild(i),Ae.bind(i,"click",function(r){fS(),r.preventDefault()})}function fo(e){bt.call(this,e),this.on("import.parse.complete",function(t){t.error||this._collectIds(t.definitions,t.elementsById)},this),this.on("diagram.destroy",function(){this.get("moddle").ids.clear()},this)}ae(fo,bt),fo.prototype._createModdle=function(e){var t=bt.prototype._createModdle.call(this,e);return t.ids=new li([32,36,1]),t},fo.prototype._collectIds=function(e,t){var n=e.$model,i=n.ids,r;i.clear();for(r in t)i.claim(r,t[r])};function He(e,t){return v(e,"bpmn:CallActivity")?!1:v(e,"bpmn:SubProcess")?(t=t||Ye(e),t&&v(t,"bpmndi:BPMNPlane")?!0:t&&!!t.isExpanded):v(e,"bpmn:Participant")?!!Z(e).processRef:!0}function qt(e){if(!(!v(e,"bpmn:Participant")&&!v(e,"bpmn:Lane"))){var t=Ye(e).isHorizontal;return t===void 0?!0:t}}function yS(e){return e&&Z(e).isInterrupting!==!1}function ln(e){return e&&!!Z(e).triggeredByEvent}function ho(e,t){var n=Z(e).eventDefinitions;return Wi(n,function(i){return v(i,t)})}function vS(e){return ho(e,"bpmn:ErrorEventDefinition")}function _S(e){return ho(e,"bpmn:EscalationEventDefinition")}function bS(e){return ho(e,"bpmn:CompensateEventDefinition")}var Nr={width:90,height:20},fm=15;function rr(e){return v(e,"bpmn:Event")||v(e,"bpmn:Gateway")||v(e,"bpmn:DataStoreReference")||v(e,"bpmn:DataObjectReference")||v(e,"bpmn:DataInput")||v(e,"bpmn:DataOutput")||v(e,"bpmn:SequenceFlow")||v(e,"bpmn:MessageFlow")||v(e,"bpmn:Group")}function Ds(e){return De(e.label)}function xS(e){var t=e.length/2-1,n=e[Math.floor(t)],i=e[Math.ceil(t+.01)],r=wS(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-=fm:a+=fm,{x:a,y:s}}function wS(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 dl(e){return e.waypoints?xS(e.waypoints):v(e,"bpmn:Group")?{x:e.x+e.width/2,y:e.y+Nr.height/2}:{x:e.x+e.width/2,y:e.y+e.height+Nr.height/2}}function ES(e,t){var n,i,r,o=e.label;return o&&o.bounds?(r=o.bounds,i={width:Math.max(Nr.width,r.width),height:r.height},n={x:r.x+r.width/2,y:r.y+r.height/2}):(n=dl(t),i=Nr),I({x:n.x-i.width/2,y:n.y-i.height/2},i)}function dm(e){if(v(e,"bpmn:FlowElement")||v(e,"bpmn:Participant")||v(e,"bpmn:Lane")||v(e,"bpmn:SequenceFlow")||v(e,"bpmn:MessageFlow")||v(e,"bpmn:DataInput")||v(e,"bpmn:DataOutput"))return"name";if(v(e,"bpmn:TextAnnotation"))return"text";if(v(e,"bpmn:Group"))return"categoryValueRef"}function SS(e){var t=e.categoryValueRef;return t&&t.value||""}function jn(e){var t=e.businessObject,n=dm(t);if(n)return n==="categoryValueRef"?SS(t):t[n]||""}function RS(e,t){var n=e.businessObject,i=dm(n);if(i)if(i==="categoryValueRef"){if(!n[i])return e;n[i].value=t}else n[i]=t;return e}function CS(e){return De(e)&&rr(e.labelTarget)}var mo=7;function hm(e){let t=[];return k(e.incoming,n=>{v(n,"bpmn:Association")&&v(n.source,"bpmn:TextAnnotation")&&t.push({annotation:n.source,association:n})}),k(e.outgoing,n=>{v(n,"bpmn:Association")&&v(n.target,"bpmn:TextAnnotation")&&t.push({annotation:n.target,association:n})}),t}function oa(e){const t=new Map;return k(al(e),n=>{k(hm(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 hl="hsl(225, 10%, 15%)",PS="white";function mi(e,t){return Wi(e.eventDefinitions,function(n){return n.$type===t})}function AS(e){return e.$type==="bpmn:IntermediateThrowEvent"||e.$type==="bpmn:EndEvent"}function TS(e){var t=e.dataObjectRef;return e.isCollection||t&&t.isCollection}function je(e,t,n){var i=Ye(e);return n||i.get("color:background-color")||i.get("bioc:fill")||t||PS}function re(e,t,n){var i=Ye(e);return n||i.get("color:border-color")||i.get("bioc:stroke")||t||hl}function aa(e,t,n,i){var r=Ye(e),o=r.get("label");return i||o&&o.get("color:color")||t||re(e,n)}function mm(e){var t=e.x+e.width/2,n=e.y+e.height/2,i=e.width/2,r=[["M",t,n],["m",0,-i],["a",i,i,0,1,1,0,2*i],["a",i,i,0,1,1,0,-2*i],["z"]];return Dr(r)}function ml(e,t){var n=e.x,i=e.y,r=e.width,o=e.height,a=[["M",n+t,i],["l",r-t*2,0],["a",t,t,0,0,1,t,t],["l",0,o-t*2],["a",t,t,0,0,1,-t,t],["l",t*2-r,0],["a",t,t,0,0,1,-t,-t],["l",0,t*2-o],["a",t,t,0,0,1,t,-t],["z"]];return Dr(a)}function MS(e){var t=e.width,n=e.height,i=e.x,r=e.y,o=t/2,a=n/2,s=[["M",i+o,r],["l",o,a],["l",-o,a],["l",-o,-a],["z"]];return Dr(s)}function kS(e){var t=e.x,n=e.y,i=e.width,r=e.height,o=[["M",t,n],["l",i,0],["l",0,r],["l",-i,0],["z"]];return Dr(o)}function sa(e,t={}){return{width:Gn(e,t),height:Mn(e,t)}}function Gn(e,t={}){return Rn(t,"width")?t.width:e.width}function Mn(e,t={}){return Rn(t,"height")?t.height:e.height}var OS=new li,DS=10,Ls=3,LS=1.5,Is=10,IS=4,go=.95,NS=1,BS=.25;function Br(e,t,n,i,r,o,a){Ti.call(this,t,a);var s=e&&e.defaultFillColor,c=e&&e.defaultStrokeColor,u=e&&e.defaultLabelColor;function l(P){return n.computeStyle(P,{strokeLinecap:"round",strokeLinejoin:"round",stroke:hl,strokeWidth:2,fill:"white"})}function f(P){return n.computeStyle(P,["no-fill"],{strokeLinecap:"round",strokeLinejoin:"round",stroke:hl,strokeWidth:2})}function p(P,_){var{ref:y={x:0,y:0},scale:D=1,element:B,parentGfx:W=r._svg}=_,le=ve("marker",{id:P,viewBox:"0 0 20 20",refX:y.x,refY:y.y,markerWidth:20*D,markerHeight:20*D,orient:"auto"});Te(le,B);var ke=nt(":scope > defs",W);ke||(ke=ve("defs"),Te(W,ke)),Te(ke,le)}function d(P,_,y,D){var B=OS.nextPrefixed("marker-");return h(P,B,_,y,D),"url(#"+B+")"}function h(P,_,y,D,B){if(y==="sequenceflow-end"){var W=ve("path",{d:"M 1 5 L 11 10 L 1 15 Z",...l({fill:B,stroke:B,strokeWidth:1})});p(_,{element:W,ref:{x:11,y:10},scale:.5,parentGfx:P})}if(y==="messageflow-start"){var le=ve("circle",{cx:6,cy:6,r:3.5,...l({fill:D,stroke:B,strokeWidth:1,strokeDasharray:[1e4,1]})});p(_,{element:le,ref:{x:6,y:6},parentGfx:P})}if(y==="messageflow-end"){var ke=ve("path",{d:"m 1 5 l 0 -3 l 7 3 l -7 3 z",...l({fill:D,stroke:B,strokeWidth:1,strokeDasharray:[1e4,1]})});p(_,{element:ke,ref:{x:8.5,y:5},parentGfx:P})}if(y==="association-start"){var Ke=ve("path",{d:"M 11 5 L 1 10 L 11 15",...f({fill:"none",stroke:B,strokeWidth:1.5,strokeDasharray:[1e4,1]})});p(_,{element:Ke,ref:{x:1,y:10},scale:.5,parentGfx:P})}if(y==="association-end"){var lt=ve("path",{d:"M 1 5 L 11 10 L 1 15",...f({fill:"none",stroke:B,strokeWidth:1.5,strokeDasharray:[1e4,1]})});p(_,{element:lt,ref:{x:11,y:10},scale:.5,parentGfx:P})}if(y==="conditional-flow-marker"){var it=ve("path",{d:"M 0 10 L 8 6 L 16 10 L 8 14 Z",...l({fill:D,stroke:B})});p(_,{element:it,ref:{x:-1,y:10},scale:.5,parentGfx:P})}if(y==="conditional-default-flow-marker"){var Bt=ve("path",{d:"M 6 4 L 10 16",...l({stroke:B,fill:"none"})});p(_,{element:Bt,ref:{x:0,y:10},scale:.5,parentGfx:P})}}function m(P,_,y,D,B={}){Ut(D)&&(B=D,D=0),D=D||0,B=l(B);var W=_/2,le=y/2,ke=ve("circle",{cx:W,cy:le,r:Math.round((_+y)/4-D),...B});return Te(P,ke),ke}function g(P,_,y,D,B,W){Ut(B)&&(W=B,B=0),B=B||0,W=l(W);var le=ve("rect",{x:B,y:B,width:_-B*2,height:y-B*2,rx:D,ry:D,...W});return Te(P,le),le}function R(P,_,y,D){var B=_/2,W=y/2,le=[{x:B,y:0},{x:_,y:W},{x:B,y},{x:0,y:W}],ke=le.map(function(lt){return lt.x+","+lt.y}).join(" ");D=l(D);var Ke=ve("polygon",{...D,points:ke});return Te(P,Ke),Ke}function E(P,_,y,D){y=f(y);var B=Qo(_,y,D);return Te(P,B),B}function x(P,_,y){return E(P,_,y,5)}function w(P,_,y){y=f(y);var D=ve("path",{...y,d:_});return Te(P,D),D}function S(P,_,y,D){return w(_,y,I({"data-marker":P},D))}function M(P){return Nt[P]}function N(P){return function(_,y,D){return M(P)(_,y,D)}}var T={"bpmn:MessageEventDefinition":function(P,_,y={},D){var B=i.getScaledPath("EVENT_MESSAGE",{xScaleFactor:.9,yScaleFactor:.9,containerWidth:y.width||_.width,containerHeight:y.height||_.height,position:{mx:.235,my:.315}}),W=D?re(_,c,y.stroke):je(_,s,y.fill),le=D?je(_,s,y.fill):re(_,c,y.stroke),ke=w(P,B,{fill:W,stroke:le,strokeWidth:1});return ke},"bpmn:TimerEventDefinition":function(P,_,y={}){var D=y.width||_.width,B=y.height||_.height,W=y.width?1:2,le=m(P,D,B,.2*B,{fill:je(_,s,y.fill),stroke:re(_,c,y.stroke),strokeWidth:W}),ke=i.getScaledPath("EVENT_TIMER_WH",{xScaleFactor:.75,yScaleFactor:.75,containerWidth:D,containerHeight:B,position:{mx:.5,my:.5}});w(P,ke,{stroke:re(_,c,y.stroke),strokeWidth:W});for(var Ke=0;Ke<12;Ke++){var lt=i.getScaledPath("EVENT_TIMER_LINE",{xScaleFactor:.75,yScaleFactor:.75,containerWidth:D,containerHeight:B,position:{mx:.5,my:.5}}),it=D/2,Bt=B/2;w(P,lt,{strokeWidth:1,stroke:re(_,c,y.stroke),transform:"rotate("+Ke*30+","+Bt+","+it+")"})}return le},"bpmn:EscalationEventDefinition":function(P,_,y={},D){var B=i.getScaledPath("EVENT_ESCALATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:y.width||_.width,containerHeight:y.height||_.height,position:{mx:.5,my:.2}}),W=D?re(_,c,y.stroke):je(_,s,y.fill);return w(P,B,{fill:W,stroke:re(_,c,y.stroke),strokeWidth:1})},"bpmn:ConditionalEventDefinition":function(P,_,y={}){var D=i.getScaledPath("EVENT_CONDITIONAL",{xScaleFactor:1,yScaleFactor:1,containerWidth:y.width||_.width,containerHeight:y.height||_.height,position:{mx:.5,my:.222}});return w(P,D,{fill:je(_,s,y.fill),stroke:re(_,c,y.stroke),strokeWidth:1})},"bpmn:LinkEventDefinition":function(P,_,y={},D){var B=i.getScaledPath("EVENT_LINK",{xScaleFactor:1,yScaleFactor:1,containerWidth:_.width,containerHeight:_.height,position:{mx:.57,my:.263}}),W=D?re(_,c,y.stroke):je(_,s,y.fill);return w(P,B,{fill:W,stroke:re(_,c,y.stroke),strokeWidth:1})},"bpmn:ErrorEventDefinition":function(P,_,y={},D){var B=i.getScaledPath("EVENT_ERROR",{xScaleFactor:1.1,yScaleFactor:1.1,containerWidth:y.width||_.width,containerHeight:y.height||_.height,position:{mx:.2,my:.722}}),W=D?re(_,c,y.stroke):je(_,s,y.fill);return w(P,B,{fill:W,stroke:re(_,c,y.stroke),strokeWidth:1})},"bpmn:CancelEventDefinition":function(P,_,y={},D){var B=i.getScaledPath("EVENT_CANCEL_45",{xScaleFactor:1,yScaleFactor:1,containerWidth:_.width,containerHeight:_.height,position:{mx:.638,my:-.055}}),W=D?re(_,c,y.stroke):"none",le=w(P,B,{fill:W,stroke:re(_,c,y.stroke),strokeWidth:1});return om(le,45),le},"bpmn:CompensateEventDefinition":function(P,_,y={},D){var B=i.getScaledPath("EVENT_COMPENSATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:y.width||_.width,containerHeight:y.height||_.height,position:{mx:.22,my:.5}}),W=D?re(_,c,y.stroke):je(_,s,y.fill);return w(P,B,{fill:W,stroke:re(_,c,y.stroke),strokeWidth:1})},"bpmn:SignalEventDefinition":function(P,_,y={},D){var B=i.getScaledPath("EVENT_SIGNAL",{xScaleFactor:.9,yScaleFactor:.9,containerWidth:y.width||_.width,containerHeight:y.height||_.height,position:{mx:.5,my:.2}}),W=D?re(_,c,y.stroke):je(_,s,y.fill);return w(P,B,{strokeWidth:1,fill:W,stroke:re(_,c,y.stroke)})},"bpmn:MultipleEventDefinition":function(P,_,y={},D){var B=i.getScaledPath("EVENT_MULTIPLE",{xScaleFactor:1.1,yScaleFactor:1.1,containerWidth:y.width||_.width,containerHeight:y.height||_.height,position:{mx:.211,my:.36}}),W=D?re(_,c,y.stroke):je(_,s,y.fill);return w(P,B,{fill:W,stroke:re(_,c,y.stroke),strokeWidth:1})},"bpmn:ParallelMultipleEventDefinition":function(P,_,y={}){var D=i.getScaledPath("EVENT_PARALLEL_MULTIPLE",{xScaleFactor:1.2,yScaleFactor:1.2,containerWidth:y.width||_.width,containerHeight:y.height||_.height,position:{mx:.458,my:.194}});return w(P,D,{fill:je(_,s,y.fill),stroke:re(_,c,y.stroke),strokeWidth:1})},"bpmn:TerminateEventDefinition":function(P,_,y={}){var D=m(P,_.width,_.height,8,{fill:re(_,c,y.stroke),stroke:re(_,c,y.stroke),strokeWidth:4});return D}};function H(P,_,y={},D){var B=Z(P),W=AS(B),le=D||P;return B.get("eventDefinitions")&&B.get("eventDefinitions").length>1?B.get("parallelMultiple")?T["bpmn:ParallelMultipleEventDefinition"](_,le,y,W):T["bpmn:MultipleEventDefinition"](_,le,y,W):mi(B,"bpmn:MessageEventDefinition")?T["bpmn:MessageEventDefinition"](_,le,y,W):mi(B,"bpmn:TimerEventDefinition")?T["bpmn:TimerEventDefinition"](_,le,y,W):mi(B,"bpmn:ConditionalEventDefinition")?T["bpmn:ConditionalEventDefinition"](_,le,y,W):mi(B,"bpmn:SignalEventDefinition")?T["bpmn:SignalEventDefinition"](_,le,y,W):mi(B,"bpmn:EscalationEventDefinition")?T["bpmn:EscalationEventDefinition"](_,le,y,W):mi(B,"bpmn:LinkEventDefinition")?T["bpmn:LinkEventDefinition"](_,le,y,W):mi(B,"bpmn:ErrorEventDefinition")?T["bpmn:ErrorEventDefinition"](_,le,y,W):mi(B,"bpmn:CancelEventDefinition")?T["bpmn:CancelEventDefinition"](_,le,y,W):mi(B,"bpmn:CompensateEventDefinition")?T["bpmn:CompensateEventDefinition"](_,le,y,W):mi(B,"bpmn:TerminateEventDefinition")?T["bpmn:TerminateEventDefinition"](_,le,y,W):null}var G={ParticipantMultiplicityMarker:function(P,_,y={}){var D=Gn(_,y),B=Mn(_,y),W=i.getScaledPath("MARKER_PARALLEL",{xScaleFactor:1,yScaleFactor:1,containerWidth:D,containerHeight:B,position:{mx:(D/2-6)/D,my:(B-15)/B}});S("participant-multiplicity",P,W,{strokeWidth:2,fill:je(_,s,y.fill),stroke:re(_,c,y.stroke)})},SubProcessMarker:function(P,_,y={}){var D=g(P,14,14,0,{strokeWidth:1,fill:je(_,s,y.fill),stroke:re(_,c,y.stroke)});Jt(D,_.width/2-7.5,_.height-20);var B=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",P,B,{fill:je(_,s,y.fill),stroke:re(_,c,y.stroke)})},ParallelMarker:function(P,_,y){var D=Gn(_,y),B=Mn(_,y),W=i.getScaledPath("MARKER_PARALLEL",{xScaleFactor:1,yScaleFactor:1,containerWidth:D,containerHeight:B,position:{mx:(D/2+y.parallel)/D,my:(B-20)/B}});S("parallel",P,W,{fill:je(_,s,y.fill),stroke:re(_,c,y.stroke)})},SequentialMarker:function(P,_,y){var D=i.getScaledPath("MARKER_SEQUENTIAL",{xScaleFactor:1,yScaleFactor:1,containerWidth:_.width,containerHeight:_.height,position:{mx:(_.width/2+y.seq)/_.width,my:(_.height-19)/_.height}});S("sequential",P,D,{fill:je(_,s,y.fill),stroke:re(_,c,y.stroke)})},CompensationMarker:function(P,_,y){var D=i.getScaledPath("MARKER_COMPENSATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:_.width,containerHeight:_.height,position:{mx:(_.width/2+y.compensation)/_.width,my:(_.height-13)/_.height}});S("compensation",P,D,{strokeWidth:1,fill:je(_,s,y.fill),stroke:re(_,c,y.stroke)})},LoopMarker:function(P,_,y){var D=Gn(_,y),B=Mn(_,y),W=i.getScaledPath("MARKER_LOOP",{xScaleFactor:1,yScaleFactor:1,containerWidth:D,containerHeight:B,position:{mx:(D/2+y.loop)/D,my:(B-7)/B}});S("loop",P,W,{strokeWidth:1.5,fill:"none",stroke:re(_,c,y.stroke),strokeMiterlimit:.5})},AdhocMarker:function(P,_,y){var D=Gn(_,y),B=Mn(_,y),W=i.getScaledPath("MARKER_ADHOC",{xScaleFactor:1,yScaleFactor:1,containerWidth:D,containerHeight:B,position:{mx:(D/2+y.adhoc)/D,my:(B-15)/B}});S("adhoc",P,W,{strokeWidth:1,fill:re(_,c,y.stroke),stroke:re(_,c,y.stroke)})}};function $(P,_,y,D){G[P](_,y,D)}function V(P,_,y=[],D={}){D={fill:D.fill,stroke:D.stroke,width:Gn(_,D),height:Mn(_,D)};var B=Z(_),W=y.includes("SubProcessMarker");W?D={...D,seq:-21,parallel:-22,compensation:-25,loop:-18,adhoc:10}:D={...D,seq:-5,parallel:-6,compensation:-7,loop:0,adhoc:-8},B.get("isForCompensation")&&y.push("CompensationMarker"),v(B,"bpmn:AdHocSubProcess")&&(y.push("AdhocMarker"),W||I(D,{compensation:D.compensation-18}));var le=B.get("loopCharacteristics"),ke=le&&le.get("isSequential");le&&(I(D,{compensation:D.compensation-18}),y.includes("AdhocMarker")&&I(D,{seq:-23,loop:-18,parallel:-24}),ke===void 0&&y.push("LoopMarker"),ke===!1&&y.push("ParallelMarker"),ke===!0&&y.push("SequentialMarker")),y.includes("CompensationMarker")&&y.length===1&&I(D,{compensation:-8}),k(y,function(Ke){$(Ke,P,_,D)})}function de(P,_,y={}){y=I({size:{width:100}},y);var D=o.createText(_||"",y);return ze(D).add("djs-label"),Te(P,D),D}function Ge(P,_,y,D={}){var B=Z(_),W=sa({x:_.x,y:_.y,width:_.width,height:_.height},D);return de(P,B.name,{align:y,box:W,padding:7,style:{fill:aa(_,u,c,D.stroke)}})}function ft(P,_,y={}){var D={width:_.width,height:_.height,x:_.width/2+_.x,y:_.height/2+_.y};return de(P,jn(_),{box:D,style:I({},o.getExternalStyle(),{fill:aa(_,u,c,y.stroke)})})}function q(P,_,y,D={}){var B=qt(y),W=de(P,_,{box:{height:30,width:B?Mn(y,D):Gn(y,D)},align:"center-middle",style:{fill:aa(y,u,c,D.stroke)}});if(B){var le=-1*Mn(y,D);Ms(W,0,-le,270)}}function he(P,_,y={}){var{width:D,height:B}=sa(_,y);return g(P,D,B,Is,{...y,fill:je(_,s,y.fill),fillOpacity:go,stroke:re(_,c,y.stroke)})}function ge(P,_,y={}){var D=Z(_),B=je(_,s,y.fill),W=re(_,c,y.stroke);return(D.get("associationDirection")==="One"||D.get("associationDirection")==="Both")&&(y.markerEnd=d(P,"association-end",B,W)),D.get("associationDirection")==="Both"&&(y.markerStart=d(P,"association-start",B,W)),y=qe(y,["markerStart","markerEnd"]),x(P,_.waypoints,{...y,stroke:W,strokeDasharray:"0, 5"})}function pe(P,_,y={}){var D=je(_,s,y.fill),B=re(_,c,y.stroke),W=i.getScaledPath("DATA_OBJECT_PATH",{xScaleFactor:1,yScaleFactor:1,containerWidth:_.width,containerHeight:_.height,position:{mx:.474,my:.296}}),le=w(P,W,{fill:D,fillOpacity:go,stroke:B}),ke=Z(_);if(TS(ke)){var Ke=i.getScaledPath("DATA_OBJECT_COLLECTION_PATH",{xScaleFactor:1,yScaleFactor:1,containerWidth:_.width,containerHeight:_.height,position:{mx:.33,my:(_.height-18)/_.height}});w(P,Ke,{strokeWidth:2,fill:D,stroke:B})}return le}function fe(P,_,y={}){return m(P,_.width,_.height,{fillOpacity:go,...y,fill:je(_,s,y.fill),stroke:re(_,c,y.stroke)})}function ne(P,_,y={}){return R(P,_.width,_.height,{fill:je(_,s,y.fill),fillOpacity:go,stroke:re(_,c,y.stroke)})}function z(P,_,y={}){var D=g(P,Gn(_,y),Mn(_,y),0,{fill:je(_,s,y.fill),fillOpacity:y.fillOpacity||go,stroke:re(_,c,y.stroke),strokeWidth:1.5}),B=Z(_);if(v(B,"bpmn:Lane")){var W=B.get("name");q(P,W,_,y)}return D}function F(P,_,y={}){var D=he(P,_,y),B=He(_);if(ln(_)&&(se(D,{strokeDasharray:"0, 5.5",strokeWidth:2.5}),!B)){var W=Z(_).flowElements||[],le=W.filter(ke=>v(ke,"bpmn:StartEvent"));le.length===1&&Y(le[0],P,y,_)}return Ge(P,_,B?"center-top":"center-middle",y),B?V(P,_,void 0,y):V(P,_,["SubProcessMarker"],y),D}function Y(P,_,y,D){var B=22,W={fill:je(D,s,y.fill),stroke:re(D,c,y.stroke),width:B,height:B},le=Z(P).isInterrupting,ke=le?0:3,Ke=le?1:1.2,lt=20,it=(B-lt)/2,Bt="translate("+it+","+it+")";m(_,lt,lt,{fill:W.fill,stroke:W.stroke,strokeWidth:Ke,strokeDasharray:ke,transform:Bt}),H(P,_,W,D)}function Le(P,_,y={}){var D=he(P,_,y);return Ge(P,_,"center-middle",y),V(P,_,void 0,y),D}var Nt=this.handlers={"bpmn:AdHocSubProcess":function(P,_,y={}){return He(_)?y=qe(y,["fill","stroke","width","height"]):y=qe(y,["fill","stroke"]),F(P,_,y)},"bpmn:Association":function(P,_,y={}){return y=qe(y,["fill","stroke"]),ge(P,_,y)},"bpmn:BoundaryEvent":function(P,_,y={}){var{renderIcon:D=!0}=y;y=qe(y,["fill","stroke"]);var B=Z(_),W=B.get("cancelActivity");y={strokeWidth:1.5,fill:je(_,s,y.fill),fillOpacity:NS,stroke:re(_,c,y.stroke)},W||(y.strokeDasharray="6");var le=fe(P,_,y);return m(P,_.width,_.height,Ls,{...y,fill:"none"}),D&&H(_,P,y),le},"bpmn:BusinessRuleTask":function(P,_,y={}){y=qe(y,["fill","stroke"]);var D=Le(P,_,y),B=i.getScaledPath("TASK_TYPE_BUSINESS_RULE_MAIN",{abspos:{x:8,y:8}}),W=w(P,B);se(W,{fill:je(_,s,y.fill),stroke:re(_,c,y.stroke),strokeWidth:1});var le=i.getScaledPath("TASK_TYPE_BUSINESS_RULE_HEADER",{abspos:{x:8,y:8}}),ke=w(P,le);return se(ke,{fill:re(_,c,y.stroke),stroke:re(_,c,y.stroke),strokeWidth:1}),D},"bpmn:CallActivity":function(P,_,y={}){return y=qe(y,["fill","stroke"]),F(P,_,{strokeWidth:5,...y})},"bpmn:ComplexGateway":function(P,_,y={}){y=qe(y,["fill","stroke"]);var D=ne(P,_,y),B=i.getScaledPath("GATEWAY_COMPLEX",{xScaleFactor:.5,yScaleFactor:.5,containerWidth:_.width,containerHeight:_.height,position:{mx:.46,my:.26}});return w(P,B,{fill:re(_,c,y.stroke),stroke:re(_,c,y.stroke),strokeWidth:1}),D},"bpmn:DataInput":function(P,_,y={}){y=qe(y,["fill","stroke"]);var D=i.getRawPath("DATA_ARROW"),B=pe(P,_,y);return w(P,D,{fill:"none",stroke:re(_,c,y.stroke),strokeWidth:1}),B},"bpmn:DataInputAssociation":function(P,_,y={}){return y=qe(y,["fill","stroke"]),ge(P,_,{...y,markerEnd:d(P,"association-end",je(_,s,y.fill),re(_,c,y.stroke))})},"bpmn:DataObject":function(P,_,y={}){return y=qe(y,["fill","stroke"]),pe(P,_,y)},"bpmn:DataObjectReference":N("bpmn:DataObject"),"bpmn:DataOutput":function(P,_,y={}){y=qe(y,["fill","stroke"]);var D=i.getRawPath("DATA_ARROW"),B=pe(P,_,y);return w(P,D,{strokeWidth:1,fill:re(_,c,y.stroke),stroke:re(_,c,y.stroke)}),B},"bpmn:DataOutputAssociation":function(P,_,y={}){return y=qe(y,["fill","stroke"]),ge(P,_,{...y,markerEnd:d(P,"association-end",je(_,s,y.fill),re(_,c,y.stroke))})},"bpmn:DataStoreReference":function(P,_,y={}){y=qe(y,["fill","stroke"]);var D=i.getScaledPath("DATA_STORE",{xScaleFactor:1,yScaleFactor:1,containerWidth:_.width,containerHeight:_.height,position:{mx:0,my:.133}});return w(P,D,{fill:je(_,s,y.fill),fillOpacity:go,stroke:re(_,c,y.stroke),strokeWidth:2})},"bpmn:EndEvent":function(P,_,y={}){var{renderIcon:D=!0}=y;y=qe(y,["fill","stroke"]);var B=fe(P,_,{...y,strokeWidth:4});return D&&H(_,P,y),B},"bpmn:EventBasedGateway":function(P,_,y={}){y=qe(y,["fill","stroke"]);var D=Z(_),B=ne(P,_,y);m(P,_.width,_.height,_.height*.2,{fill:je(_,"none",y.fill),stroke:re(_,c,y.stroke),strokeWidth:1});var W=D.get("eventGatewayType"),le=!!D.get("instantiate");function ke(){var lt=i.getScaledPath("GATEWAY_EVENT_BASED",{xScaleFactor:.18,yScaleFactor:.18,containerWidth:_.width,containerHeight:_.height,position:{mx:.36,my:.44}});w(P,lt,{fill:"none",stroke:re(_,c,y.stroke),strokeWidth:2})}if(W==="Parallel"){var Ke=i.getScaledPath("GATEWAY_PARALLEL",{xScaleFactor:.4,yScaleFactor:.4,containerWidth:_.width,containerHeight:_.height,position:{mx:.474,my:.296}});w(P,Ke,{fill:"none",stroke:re(_,c,y.stroke),strokeWidth:1})}else W==="Exclusive"&&(le||m(P,_.width,_.height,_.height*.26,{fill:"none",stroke:re(_,c,y.stroke),strokeWidth:1}),ke());return B},"bpmn:ExclusiveGateway":function(P,_,y={}){y=qe(y,["fill","stroke"]);var D=ne(P,_,y),B=i.getScaledPath("GATEWAY_EXCLUSIVE",{xScaleFactor:.4,yScaleFactor:.4,containerWidth:_.width,containerHeight:_.height,position:{mx:.32,my:.3}}),W=Ye(_);return W.get("isMarkerVisible")&&w(P,B,{fill:re(_,c,y.stroke),stroke:re(_,c,y.stroke),strokeWidth:1}),D},"bpmn:Gateway":function(P,_,y={}){return y=qe(y,["fill","stroke"]),ne(P,_,y)},"bpmn:Group":function(P,_,y={}){return y=qe(y,["fill","stroke","width","height"]),g(P,_.width,_.height,Is,{stroke:re(_,c,y.stroke),strokeWidth:1.5,strokeDasharray:"10, 6, 0, 6",fill:"none",pointerEvents:"none",width:Gn(_,y),height:Mn(_,y)})},"bpmn:InclusiveGateway":function(P,_,y={}){y=qe(y,["fill","stroke"]);var D=ne(P,_,y);return m(P,_.width,_.height,_.height*.24,{fill:je(_,s,y.fill),stroke:re(_,c,y.stroke),strokeWidth:2.5}),D},"bpmn:IntermediateEvent":function(P,_,y={}){var{renderIcon:D=!0}=y;y=qe(y,["fill","stroke"]);var B=fe(P,_,{...y,strokeWidth:1.5});return m(P,_.width,_.height,Ls,{fill:"none",stroke:re(_,c,y.stroke),strokeWidth:1.5}),D&&H(_,P,y),B},"bpmn:IntermediateCatchEvent":N("bpmn:IntermediateEvent"),"bpmn:IntermediateThrowEvent":N("bpmn:IntermediateEvent"),"bpmn:Lane":function(P,_,y={}){return y=qe(y,["fill","stroke","width","height"]),z(P,_,{...y,fillOpacity:BS})},"bpmn:ManualTask":function(P,_,y={}){y=qe(y,["fill","stroke"]);var D=Le(P,_,y),B=i.getScaledPath("TASK_TYPE_MANUAL",{abspos:{x:17,y:15}});return w(P,B,{fill:je(_,s,y.fill),stroke:re(_,c,y.stroke),strokeWidth:.5}),D},"bpmn:MessageFlow":function(P,_,y={}){y=qe(y,["fill","stroke"]);var D=Z(_),B=Ye(_),W=je(_,s,y.fill),le=re(_,c,y.stroke),ke=x(P,_.waypoints,{markerEnd:d(P,"messageflow-end",W,le),markerStart:d(P,"messageflow-start",W,le),stroke:le,strokeDasharray:"10, 11",strokeWidth:1.5});if(D.get("messageRef")){var Ke=ke.getPointAtLength(ke.getTotalLength()/2),lt=i.getScaledPath("MESSAGE_FLOW_MARKER",{abspos:{x:Ke.x,y:Ke.y}}),it={strokeWidth:1};B.get("messageVisibleKind")==="initiating"?(it.fill=W,it.stroke=le):(it.fill=le,it.stroke=W);var Bt=w(P,lt,it),pn=D.get("messageRef"),fn=pn.get("name"),ct=de(P,fn,{align:"center-top",fitBox:!0,style:{fill:le}}),$t=Bt.getBBox(),dn=ct.getBBox(),zo=Ke.x-dn.width/2,ei=Ke.y+$t.height/2+DS;Ms(ct,zo,ei,0)}return ke},"bpmn:ParallelGateway":function(P,_,y={}){y=qe(y,["fill","stroke"]);var D=ne(P,_,y),B=i.getScaledPath("GATEWAY_PARALLEL",{xScaleFactor:.6,yScaleFactor:.6,containerWidth:_.width,containerHeight:_.height,position:{mx:.46,my:.2}});return w(P,B,{fill:re(_,c,y.stroke),stroke:re(_,c,y.stroke),strokeWidth:1}),D},"bpmn:Participant":function(P,_,y={}){y=qe(y,["fill","stroke","width","height"]);var D=z(P,_,y),B=He(_),W=qt(_),le=Z(_),ke=le.get("name");if(B){var Ke=W?[{x:30,y:0},{x:30,y:Mn(_,y)}]:[{x:0,y:30},{x:Gn(_,y),y:30}];E(P,Ke,{stroke:re(_,c,y.stroke),strokeWidth:LS}),q(P,ke,_,y)}else{var lt=sa(_,y);W||(lt.height=Gn(_,y),lt.width=Mn(_,y));var it=de(P,ke,{box:lt,align:"center-middle",style:{fill:aa(_,u,c,y.stroke)}});if(!W){var Bt=-1*Mn(_,y);Ms(it,0,-Bt,270)}}return le.get("participantMultiplicity")&&$("ParticipantMultiplicityMarker",P,_,y),D},"bpmn:ReceiveTask":function(P,_,y={}){y=qe(y,["fill","stroke"]);var D=Z(_),B=Le(P,_,y),W;return D.get("instantiate")?(m(P,28,28,20*.22,{fill:je(_,s,y.fill),stroke:re(_,c,y.stroke),strokeWidth:1}),W=i.getScaledPath("TASK_TYPE_INSTANTIATING_SEND",{abspos:{x:7.77,y:9.52}})):W=i.getScaledPath("TASK_TYPE_SEND",{xScaleFactor:.9,yScaleFactor:.9,containerWidth:21,containerHeight:14,position:{mx:.3,my:.4}}),w(P,W,{fill:je(_,s,y.fill),stroke:re(_,c,y.stroke),strokeWidth:1}),B},"bpmn:ScriptTask":function(P,_,y={}){y=qe(y,["fill","stroke"]);var D=Le(P,_,y),B=i.getScaledPath("TASK_TYPE_SCRIPT",{abspos:{x:15,y:20}});return w(P,B,{fill:je(_,s,y.fill),stroke:re(_,c,y.stroke),strokeWidth:1}),D},"bpmn:SendTask":function(P,_,y={}){y=qe(y,["fill","stroke"]);var D=Le(P,_,y),B=i.getScaledPath("TASK_TYPE_SEND",{xScaleFactor:1,yScaleFactor:1,containerWidth:21,containerHeight:14,position:{mx:.285,my:.357}});return w(P,B,{fill:re(_,c,y.stroke),stroke:je(_,s,y.fill),strokeWidth:1}),D},"bpmn:SequenceFlow":function(P,_,y={}){y=qe(y,["fill","stroke"]);var D=je(_,s,y.fill),B=re(_,c,y.stroke),W=x(P,_.waypoints,{markerEnd:d(P,"sequenceflow-end",D,B),stroke:B}),le=Z(_),{source:ke}=_;if(ke){var Ke=Z(ke);le.get("conditionExpression")&&v(Ke,"bpmn:Activity")&&se(W,{markerStart:d(P,"conditional-flow-marker",D,B)}),Ke.get("default")&&(v(Ke,"bpmn:Gateway")||v(Ke,"bpmn:Activity"))&&Ke.get("default")===le&&se(W,{markerStart:d(P,"conditional-default-flow-marker",D,B)})}return W},"bpmn:ServiceTask":function(P,_,y={}){y=qe(y,["fill","stroke"]);var D=Le(P,_,y);m(P,10,10,{fill:je(_,s,y.fill),stroke:"none",transform:"translate(6, 6)"});var B=i.getScaledPath("TASK_TYPE_SERVICE",{abspos:{x:12,y:18}});w(P,B,{fill:je(_,s,y.fill),stroke:re(_,c,y.stroke),strokeWidth:1}),m(P,10,10,{fill:je(_,s,y.fill),stroke:"none",transform:"translate(11, 10)"});var W=i.getScaledPath("TASK_TYPE_SERVICE",{abspos:{x:17,y:22}});return w(P,W,{fill:je(_,s,y.fill),stroke:re(_,c,y.stroke),strokeWidth:1}),D},"bpmn:StartEvent":function(P,_,y={}){var{renderIcon:D=!0}=y;y=qe(y,["fill","stroke"]);var B=Z(_);B.get("isInterrupting")||(y={...y,strokeDasharray:"6"});var W=fe(P,_,y);return D&&H(_,P,y),W},"bpmn:SubProcess":function(P,_,y={}){return He(_)?y=qe(y,["fill","stroke","width","height"]):y=qe(y,["fill","stroke"]),F(P,_,y)},"bpmn:Task":function(P,_,y={}){return y=qe(y,["fill","stroke"]),Le(P,_,y)},"bpmn:TextAnnotation":function(P,_,y={}){y=qe(y,["fill","stroke"]);var{width:D,height:B}=sa(_,y),W=g(P,D,B,0,0,{fill:"none",stroke:"none"}),le=i.getScaledPath("TEXT_ANNOTATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:D,containerHeight:B,position:{mx:0,my:0}});w(P,le,{stroke:re(_,c,y.stroke)});var ke=Z(_),Ke=ke.get("text")||"";return de(P,Ke,{align:"left-top",box:sa(_,y),padding:mo,style:{fill:aa(_,u,c,y.stroke)}}),W},"bpmn:Transaction":function(P,_,y={}){He(_)?y=qe(y,["fill","stroke","width","height"]):y=qe(y,["fill","stroke"]);var D=F(P,_,{strokeWidth:1.5,...y}),B=n.style(["no-fill","no-events"],{stroke:re(_,c,y.stroke),strokeWidth:1.5}),W=He(_);return W||(y={}),g(P,Gn(_,y),Mn(_,y),Is-Ls,Ls,B),D},"bpmn:UserTask":function(P,_,y={}){y=qe(y,["fill","stroke"]);var D=Le(P,_,y),B=15,W=12,le=i.getScaledPath("TASK_TYPE_USER_1",{abspos:{x:B,y:W}});w(P,le,{fill:je(_,s,y.fill),stroke:re(_,c,y.stroke),strokeWidth:.5});var ke=i.getScaledPath("TASK_TYPE_USER_2",{abspos:{x:B,y:W}});w(P,ke,{fill:je(_,s,y.fill),stroke:re(_,c,y.stroke),strokeWidth:.5});var Ke=i.getScaledPath("TASK_TYPE_USER_3",{abspos:{x:B,y:W}});return w(P,Ke,{fill:re(_,c,y.stroke),stroke:re(_,c,y.stroke),strokeWidth:.5}),D},label:function(P,_,y={}){return ft(P,_,y)}};this._drawPath=w,this._renderer=M}ae(Br,Ti),Br.$inject=["config.bpmnRenderer","eventBus","styles","pathMap","canvas","textRenderer"],Br.prototype.canRender=function(e){return v(e,"bpmn:BaseElement")},Br.prototype.drawShape=function(e,t,n={}){var{type:i}=t,r=this._renderer(i);return r(e,t,n)},Br.prototype.drawConnection=function(e,t,n={}){var{type:i}=t,r=this._renderer(i);return r(e,t,n)},Br.prototype.getShapePath=function(e){return De(e)?ml(e,IS):v(e,"bpmn:Event")?mm(e):v(e,"bpmn:Activity")?ml(e,Is):v(e,"bpmn:Gateway")?MS(e):kS(e)};function qe(e,t=[]){return t.reduce((n,i)=>(e[i]&&(n[i]=e[i]),n),{})}var $S=0,jS={width:150,height:50};function FS(e){var t=e.split("-");return{horizontal:t[0]||"center",vertical:t[1]||"top"}}function HS(e){return Ut(e)?I({top:0,left:0,right:0,bottom:0},e):{top:e,left:e,right:e,bottom:e}}var gl=null;function zS(){return gl||(gl=document.createElement("canvas").getContext("2d")),gl}function GS(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(gm(e.fontSize)||"12px"),t.push(e.fontFamily||"sans-serif"),t.join(" ")}function gm(e){if(e!=null)return typeof e=="number"||/^-?\d+(\.\d+)?$/.test(e)?e+"px":e}function VS(e,t){var n=zS();if(!n)return{width:0,height:0};n.font=GS(t),"letterSpacing"in n&&(n.letterSpacing=gm(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 WS(e,t,n){for(var i=e.shift(),r=i,o;;){if(o=VS(r,n),o.width=r?o.width:0,r===" "||r===""||o.width<Math.round(t)||r.length<2)return US(e,r,i,o);r=qS(r,o.width,t)}}function US(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 ym="­";function YS(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===ym)&&r.pop();break}var a=r[r.length-1];return a&&a===ym&&(r[r.length-1]="-"),r.join("")}function qS(e,t,n){var i=Math.max(e.length*(n/t),1),r=YS(e,i);return r||(r=e.slice(0,Math.max(Math.round(i-1),1))),r}function Ns(e){this._config=I({},{size:jS,padding:$S,style:{},align:"center-top"},e||{})}Ns.prototype.createText=function(e,t){return this.layoutText(e,t).element},Ns.prototype.getDimensions=function(e,t){return this.layoutText(e,t).dimensions},Ns.prototype.layoutText=function(e,t){for(var n=I({},this._config.size,t.box),i=I({},this._config.style,t.style),r=FS(t.align||this._config.align),o=HS(t.padding!==void 0?t.padding:this._config.padding),a=t.fitBox||!1,s=KS(i),c=e.split(/\u00AD?\r?\n/),u=[],l=n.width-o.left-o.right;c.length;)u.push(WS(c,l,i));r.vertical==="middle"&&(o.top=o.bottom=0);var f=Cn(u,function(g,R,E){return g+(s||R.height)},0)+o.top+o.bottom,p=Cn(u,function(g,R,E){return R.width>g?R.width:g},0),d=o.top;r.vertical==="middle"&&(d+=(n.height-f)/2),d-=(s||u[0].height)/4;var h=ve("text");se(h,i),k(u,function(g){var R;switch(d+=s||g.height,r.horizontal){case"left":R=o.left;break;case"right":R=(a?p:l)-o.right-g.width;break;default:R=Math.max(((a?p:l)-g.width)/2+o.left,0)}var E=ve("tspan");se(E,{x:R,y:d}),E.textContent=g.text,Te(h,E)});var m={width:p,height:f};return{dimensions:m,element:h}};function KS(e){if("fontSize"in e&&"lineHeight"in e)return e.lineHeight*parseInt(e.fontSize,10)}var XS=12,ZS=1.2,QS=40;function vm(e){var t=I({fontFamily:"Arial, sans-serif",fontSize:XS,fontWeight:"normal",lineHeight:ZS},e&&e.defaultStyle||{}),n=parseInt(t.fontSize,10)-1,i=I({},t,{fontSize:n},e&&e.externalStyle||{}),r=new Ns({style:t});this.getExternalLabelBounds=function(a,s){var c={width:Math.max(a.width,Nr.width),height:30},u=o(s,c,{style:i});return{x:Math.round(a.x+a.width/2-u.width/2),y:a.y,width:Math.ceil(u.width),height:Math.ceil(u.height)}},this.getTextAnnotationBounds=function(a,s){var c=o(s,a,{style:t,align:"left-top",padding:mo});return{x:a.x,y:a.y,width:a.width,height:Math.max(QS,Math.round(c.height))}},this.getDimensions=function(a,s){return r.getDimensions(a,s||{})};function o(a,s,c){return r.getDimensions(a,I({box:s},c))}this.createText=function(a,s){return r.createText(a,s||{})},this.getDefaultStyle=function(){return t},this.getExternalStyle=function(){return i}}vm.$inject=["config.textRenderer"];function JS(){this.pathMap={EVENT_MESSAGE:{d:"m {mx},{my} l 0,{e.y1} l {e.x1},0 l 0,-{e.y1} z l {e.x0},{e.y0} l {e.x0},-{e.y0}",height:36,width:36,heightElements:[6,14],widthElements:[10.5,21]},EVENT_SIGNAL:{d:"M {mx},{my} l {e.x0},{e.y0} l -{e.x1},0 Z",height:36,width:36,heightElements:[18],widthElements:[10,20]},EVENT_ESCALATION:{d:"M {mx},{my} l {e.x0},{e.y0} l -{e.x0},-{e.y1} l -{e.x0},{e.y1} Z",height:36,width:36,heightElements:[20,7],widthElements:[8]},EVENT_CONDITIONAL:{d:"M {e.x0},{e.y0} l {e.x1},0 l 0,{e.y2} l -{e.x1},0 Z M {e.x2},{e.y3} l {e.x0},0 M {e.x2},{e.y4} l {e.x0},0 M {e.x2},{e.y5} l {e.x0},0 M {e.x2},{e.y6} l {e.x0},0 M {e.x2},{e.y7} l {e.x0},0 M {e.x2},{e.y8} l {e.x0},0 ",height:36,width:36,heightElements:[8.5,14.5,18,11.5,14.5,17.5,20.5,23.5,26.5],widthElements:[10.5,14.5,12.5]},EVENT_LINK:{d:"m {mx},{my} 0,{e.y0} -{e.x1},0 0,{e.y1} {e.x1},0 0,{e.y0} {e.x0},-{e.y2} -{e.x0},-{e.y2} z",height:36,width:36,heightElements:[4.4375,6.75,7.8125],widthElements:[9.84375,13.5]},EVENT_ERROR:{d:"m {mx},{my} {e.x0},-{e.y0} {e.x1},-{e.y1} {e.x2},{e.y2} {e.x3},-{e.y3} -{e.x4},{e.y4} -{e.x5},-{e.y5} z",height:36,width:36,heightElements:[.023,8.737,8.151,16.564,10.591,8.714],widthElements:[.085,6.672,6.97,4.273,5.337,6.636]},EVENT_CANCEL_45:{d:"m {mx},{my} -{e.x1},0 0,{e.x0} {e.x1},0 0,{e.y1} {e.x0},0 0,-{e.y1} {e.x1},0 0,-{e.y0} -{e.x1},0 0,-{e.y1} -{e.x0},0 z",height:36,width:36,heightElements:[4.75,8.5],widthElements:[4.75,8.5]},EVENT_COMPENSATION:{d:"m {mx},{my} {e.x0},-{e.y0} 0,{e.y1} z m {e.x1},-{e.y2} {e.x2},-{e.y3} 0,{e.y1} -{e.x2},-{e.y3} z",height:36,width:36,heightElements:[6.5,13,.4,6.1],widthElements:[9,9.3,8.7]},EVENT_TIMER_WH:{d:"M {mx},{my} l {e.x0},-{e.y0} m -{e.x0},{e.y0} l {e.x1},{e.y1} ",height:36,width:36,heightElements:[10,2],widthElements:[3,7]},EVENT_TIMER_LINE:{d:"M {mx},{my} m {e.x0},{e.y0} l -{e.x1},{e.y1} ",height:36,width:36,heightElements:[10,3],widthElements:[0,0]},EVENT_MULTIPLE:{d:"m {mx},{my} {e.x1},-{e.y0} {e.x1},{e.y0} -{e.x0},{e.y1} -{e.x2},0 z",height:36,width:36,heightElements:[6.28099,12.56199],widthElements:[3.1405,9.42149,12.56198]},EVENT_PARALLEL_MULTIPLE:{d:"m {mx},{my} {e.x0},0 0,{e.y1} {e.x1},0 0,{e.y0} -{e.x1},0 0,{e.y1} -{e.x0},0 0,-{e.y1} -{e.x1},0 0,-{e.y0} {e.x1},0 z",height:36,width:36,heightElements:[2.56228,7.68683],widthElements:[2.56228,7.68683]},GATEWAY_EXCLUSIVE:{d:"m {mx},{my} {e.x0},{e.y0} {e.x1},{e.y0} {e.x2},0 {e.x4},{e.y2} {e.x4},{e.y1} {e.x2},0 {e.x1},{e.y3} {e.x0},{e.y3} {e.x3},0 {e.x5},{e.y1} {e.x5},{e.y2} {e.x3},0 z",height:17.5,width:17.5,heightElements:[8.5,6.5312,-6.5312,-8.5],widthElements:[6.5,-6.5,3,-3,5,-5]},GATEWAY_PARALLEL:{d:"m {mx},{my} 0,{e.y1} -{e.x1},0 0,{e.y0} {e.x1},0 0,{e.y1} {e.x0},0 0,-{e.y1} {e.x1},0 0,-{e.y0} -{e.x1},0 0,-{e.y1} -{e.x0},0 z",height:30,width:30,heightElements:[5,12.5],widthElements:[5,12.5]},GATEWAY_EVENT_BASED:{d:"m {mx},{my} {e.x0},{e.y0} {e.x0},{e.y1} {e.x1},{e.y2} {e.x2},0 z",height:11,width:11,heightElements:[-6,6,12,-12],widthElements:[9,-3,-12]},GATEWAY_COMPLEX:{d:"m {mx},{my} 0,{e.y0} -{e.x0},-{e.y1} -{e.x1},{e.y2} {e.x0},{e.y1} -{e.x2},0 0,{e.y3} {e.x2},0 -{e.x0},{e.y1} l {e.x1},{e.y2} {e.x0},-{e.y1} 0,{e.y0} {e.x3},0 0,-{e.y0} {e.x0},{e.y1} {e.x1},-{e.y2} -{e.x0},-{e.y1} {e.x2},0 0,-{e.y3} -{e.x2},0 {e.x0},-{e.y1} -{e.x1},-{e.y2} -{e.x0},{e.y1} 0,-{e.y0} -{e.x3},0 z",height:17.125,width:17.125,heightElements:[4.875,3.4375,2.125,3],widthElements:[3.4375,2.125,4.875,3]},DATA_OBJECT_PATH:{d:"m 0,0 {e.x1},0 {e.x0},{e.y0} 0,{e.y1} -{e.x2},0 0,-{e.y2} {e.x1},0 0,{e.y0} {e.x0},0",height:61,width:51,heightElements:[10,50,60],widthElements:[10,40,50,60]},DATA_OBJECT_COLLECTION_PATH:{d:"m{mx},{my} m 3,2 l 0,10 m 3,-10 l 0,10 m 3,-10 l 0,10",height:10,width:10,heightElements:[],widthElements:[]},DATA_ARROW:{d:"m 5,9 9,0 0,-3 5,5 -5,5 0,-3 -9,0 z",height:61,width:51,heightElements:[],widthElements:[]},DATA_STORE:{d:"m {mx},{my} l 0,{e.y2} c {e.x0},{e.y1} {e.x1},{e.y1} {e.x2},0 l 0,-{e.y2} c -{e.x0},-{e.y1} -{e.x1},-{e.y1} -{e.x2},0c {e.x0},{e.y1} {e.x1},{e.y1} {e.x2},0 m -{e.x2},{e.y0}c {e.x0},{e.y1} {e.x1},{e.y1} {e.x2},0m -{e.x2},{e.y0}c {e.x0},{e.y1} {e.x1},{e.y1} {e.x2},0",height:61,width:61,heightElements:[7,10,45],widthElements:[2,58,60]},TEXT_ANNOTATION:{d:"m {mx}, {my} m 10,0 l -10,0 l 0,{e.y0} l 10,0",height:30,width:10,heightElements:[30],widthElements:[10]},MARKER_SUB_PROCESS:{d:"m{mx},{my} m 7,2 l 0,10 m -5,-5 l 10,0",height:10,width:10,heightElements:[],widthElements:[]},MARKER_PARALLEL:{d:"m{mx},{my} m 3,2 l 0,10 m 3,-10 l 0,10 m 3,-10 l 0,10",height:10,width:10,heightElements:[],widthElements:[]},MARKER_SEQUENTIAL:{d:"m{mx},{my} m 0,3 l 10,0 m -10,3 l 10,0 m -10,3 l 10,0",height:10,width:10,heightElements:[],widthElements:[]},MARKER_COMPENSATION:{d:"m {mx},{my} 7,-5 0,10 z m 7.1,-0.3 6.9,-4.7 0,10 -6.9,-4.7 z",height:10,width:21,heightElements:[],widthElements:[]},MARKER_LOOP:{d:"m {mx},{my} c 3.526979,0 6.386161,-2.829858 6.386161,-6.320661 0,-3.490806 -2.859182,-6.320661 -6.386161,-6.320661 -3.526978,0 -6.38616,2.829855 -6.38616,6.320661 0,1.745402 0.714797,3.325567 1.870463,4.469381 0.577834,0.571908 1.265885,1.034728 2.029916,1.35457 l -0.718163,-3.909793 m 0.718163,3.909793 -3.885211,0.802902",height:13.9,width:13.7,heightElements:[],widthElements:[]},MARKER_ADHOC:{d:"m {mx},{my} m 0.84461,2.64411 c 1.05533,-1.23780996 2.64337,-2.07882 4.29653,-1.97997996 2.05163,0.0805 3.85579,1.15803 5.76082,1.79107 1.06385,0.34139996 2.24454,0.1438 3.18759,-0.43767 0.61743,-0.33642 1.2775,-0.64078 1.7542,-1.17511 0,0.56023 0,1.12046 0,1.6807 -0.98706,0.96237996 -2.29792,1.62393996 -3.6918,1.66181996 -1.24459,0.0927 -2.46671,-0.2491 -3.59505,-0.74812 -1.35789,-0.55965 -2.75133,-1.33436996 -4.27027,-1.18121996 -1.37741,0.14601 -2.41842,1.13685996 -3.44288,1.96782996 z",height:4,width:15,heightElements:[],widthElements:[]},TASK_TYPE_SEND:{d:"m {mx},{my} l 0,{e.y1} l {e.x1},0 l 0,-{e.y1} z l {e.x0},{e.y0} l {e.x0},-{e.y0}",height:14,width:21,heightElements:[6,14],widthElements:[10.5,21]},TASK_TYPE_SCRIPT:{d:"m {mx},{my} c 9.966553,-6.27276 -8.000926,-7.91932 2.968968,-14.938 l -8.802728,0 c -10.969894,7.01868 6.997585,8.66524 -2.968967,14.938 z m -7,-12 l 5,0 m -4.5,3 l 4.5,0 m -3,3 l 5,0m -4,3 l 5,0",height:15,width:12.6,heightElements:[6,14],widthElements:[10.5,21]},TASK_TYPE_USER_1:{d:"m {mx},{my} c 0.909,-0.845 1.594,-2.049 1.594,-3.385 0,-2.554 -1.805,-4.62199999 -4.357,-4.62199999 -2.55199998,0 -4.28799998,2.06799999 -4.28799998,4.62199999 0,1.348 0.974,2.562 1.89599998,3.405 -0.52899998,0.187 -5.669,2.097 -5.794,4.7560005 v 6.718 h 17 v -6.718 c 0,-2.2980005 -5.5279996,-4.5950005 -6.0509996,-4.7760005 zm -8,6 l 0,5.5 m 11,0 l 0,-5"},TASK_TYPE_USER_2:{d:"m {mx},{my} m 2.162,1.009 c 0,2.4470005 -2.158,4.4310005 -4.821,4.4310005 -2.66499998,0 -4.822,-1.981 -4.822,-4.4310005 "},TASK_TYPE_USER_3:{d:"m {mx},{my} m -6.9,-3.80 c 0,0 2.25099998,-2.358 4.27399998,-1.177 2.024,1.181 4.221,1.537 4.124,0.965 -0.098,-0.57 -0.117,-3.79099999 -4.191,-4.13599999 -3.57499998,0.001 -4.20799998,3.36699999 -4.20699998,4.34799999 z"},TASK_TYPE_MANUAL:{d:"m {mx},{my} c 0.234,-0.01 5.604,0.008 8.029,0.004 0.808,0 1.271,-0.172 1.417,-0.752 0.227,-0.898 -0.334,-1.314 -1.338,-1.316 -2.467,-0.01 -7.886,-0.004 -8.108,-0.004 -0.014,-0.079 0.016,-0.533 0,-0.61 0.195,-0.042 8.507,0.006 9.616,0.002 0.877,-0.007 1.35,-0.438 1.353,-1.208 0.003,-0.768 -0.479,-1.09 -1.35,-1.091 -2.968,-0.002 -9.619,-0.013 -9.619,-0.013 v -0.591 c 0,0 5.052,-0.016 7.225,-0.016 0.888,-0.002 1.354,-0.416 1.351,-1.193 -0.006,-0.761 -0.492,-1.196 -1.361,-1.196 -3.473,-0.005 -10.86,-0.003 -11.0829995,-0.003 -0.022,-0.047 -0.045,-0.094 -0.069,-0.139 0.3939995,-0.319 2.0409995,-1.626 2.4149995,-2.017 0.469,-0.4870005 0.519,-1.1650005 0.162,-1.6040005 -0.414,-0.511 -0.973,-0.5 -1.48,-0.236 -1.4609995,0.764 -6.5999995,3.6430005 -7.7329995,4.2710005 -0.9,0.499 -1.516,1.253 -1.882,2.19 -0.37000002,0.95 -0.17,2.01 -0.166,2.979 0.004,0.718 -0.27300002,1.345 -0.055,2.063 0.629,2.087 2.425,3.312 4.859,3.318 4.6179995,0.014 9.2379995,-0.139 13.8569995,-0.158 0.755,-0.004 1.171,-0.301 1.182,-1.033 0.012,-0.754 -0.423,-0.969 -1.183,-0.973 -1.778,-0.01 -5.824,-0.004 -6.04,-0.004 10e-4,-0.084 0.003,-0.586 10e-4,-0.67 z"},TASK_TYPE_INSTANTIATING_SEND:{d:"m {mx},{my} l 0,8.4 l 12.6,0 l 0,-8.4 z l 6.3,3.6 l 6.3,-3.6"},TASK_TYPE_SERVICE:{d:"m {mx},{my} v -1.71335 c 0.352326,-0.0705 0.703932,-0.17838 1.047628,-0.32133 0.344416,-0.14465 0.665822,-0.32133 0.966377,-0.52145 l 1.19431,1.18005 1.567487,-1.57688 -1.195028,-1.18014 c 0.403376,-0.61394 0.683079,-1.29908 0.825447,-2.01824 l 1.622133,-0.01 v -2.2196 l -1.636514,0.01 c -0.07333,-0.35153 -0.178319,-0.70024 -0.323564,-1.04372 -0.145244,-0.34406 -0.321407,-0.6644 -0.522735,-0.96217 l 1.131035,-1.13631 -1.583305,-1.56293 -1.129598,1.13589 c -0.614052,-0.40108 -1.302883,-0.68093 -2.022633,-0.82247 l 0.0093,-1.61852 h -2.241173 l 0.0042,1.63124 c -0.353763,0.0736 -0.705369,0.17977 -1.049785,0.32371 -0.344415,0.14437 -0.665102,0.32092 -0.9635006,0.52046 l -1.1698628,-1.15823 -1.5667691,1.5792 1.1684265,1.15669 c -0.4026573,0.61283 -0.68308,1.29797 -0.8247287,2.01713 l -1.6588041,0.003 v 2.22174 l 1.6724648,-0.006 c 0.073327,0.35077 0.1797598,0.70243 0.3242851,1.04472 0.1452428,0.34448 0.3214064,0.6644 0.5227339,0.96066 l -1.1993431,1.19723 1.5840256,1.56011 1.1964668,-1.19348 c 0.6140517,0.40346 1.3028827,0.68232 2.0233517,0.82331 l 7.19e-4,1.69892 h 2.226848 z m 0.221462,-3.9957 c -1.788948,0.7502 -3.8576,-0.0928 -4.6097055,-1.87438 -0.7521065,-1.78321 0.090598,-3.84627 1.8802645,-4.59604 1.78823,-0.74936 3.856881,0.0929 4.608987,1.87437 0.752106,1.78165 -0.0906,3.84612 -1.879546,4.59605 z"},TASK_TYPE_SERVICE_FILL:{d:"m {mx},{my} c -1.788948,0.7502 -3.8576,-0.0928 -4.6097055,-1.87438 -0.7521065,-1.78321 0.090598,-3.84627 1.8802645,-4.59604 1.78823,-0.74936 3.856881,0.0929 4.608987,1.87437 0.752106,1.78165 -0.0906,3.84612 -1.879546,4.59605 z"},TASK_TYPE_BUSINESS_RULE_HEADER:{d:"m {mx},{my} 0,4 20,0 0,-4 z"},TASK_TYPE_BUSINESS_RULE_MAIN:{d:"m {mx},{my} 0,12 20,0 0,-12 zm 0,8 l 20,0 m -13,-4 l 0,8"},MESSAGE_FLOW_MARKER:{d:"m {mx},{my} m -10.5 ,-7 l 0,14 l 21,0 l 0,-14 z l 10.5,6 l 10.5,-6"}},this.getRawPath=function(t){return this.pathMap[t].d},this.getScaledPath=function(t,n){var i=this.pathMap[t],r,o;n.abspos?(r=n.abspos.x,o=n.abspos.y):(r=n.containerWidth*n.position.mx,o=n.containerHeight*n.position.my);var a={};if(n.position){for(var s=n.containerHeight/i.height*n.yScaleFactor,c=n.containerWidth/i.width*n.xScaleFactor,u=0;u<i.heightElements.length;u++)a["y"+u]=i.heightElements[u]*s;for(var l=0;l<i.widthElements.length;l++)a["x"+l]=i.widthElements[l]*c}var f=iR(i.d,{mx:r,my:o,e:a});return f}}var eR=/\{([^{}]+)\}/g,tR=/(?:(?:^|\.)(.+?)(?=\[|\.|$|\()|\[('|")(.+?)\2\])(\(\))?/g;function nR(e,t,n){var i=n;return t.replace(tR,function(r,o,a,s,c){o=o||s,i&&(o in i&&(i=i[o]),typeof i=="function"&&c&&(i=i()))}),i=(i==null||i==n?e:i)+"",i}function iR(e,t){return String(e).replace(eR,function(n,i){return nR(n,i,t)})}const rR={__init__:["bpmnRenderer"],bpmnRenderer:["type",Br],textRenderer:["type",vm],pathMap:["type",JS]};function oR(e,t){return t=t||{},e.replace(/{([^}]+)}/g,function(n,i){return t[i]||"{"+i+"}"})}const ca={translate:["value",oR]};function Bs(e,t,n){return I({id:e.id,type:e.$type,businessObject:e,di:t},n)}function aR(e,t,n){var i=e.waypoint;return!i||i.length<2?[Ee(t),Ee(n)]:i.map(function(r){return{x:r.x,y:r.y}})}function _m(e,t,n){return new Error(`element ${un(t)} referenced by ${un(e)}#${n} not yet drawn`)}function Di(e,t,n,i,r){this._eventBus=e,this._canvas=t,this._elementFactory=n,this._elementRegistry=i,this._textRenderer=r}Di.$inject=["eventBus","canvas","elementFactory","elementRegistry","textRenderer"],Di.prototype.add=function(e,t,n){var i,r,o;if(v(t,"bpmndi:BPMNPlane")){var a=v(e,"bpmn:SubProcess")?{id:e.id+"_plane"}:{};i=this._elementFactory.createRoot(Bs(e,t,a)),this._canvas.addRootElement(i)}else if(v(t,"bpmndi:BPMNShape")){var s=!He(e,t),c=cR(e);r=n&&(n.hidden||n.collapsed);var u=t.bounds;i=this._elementFactory.createShape(Bs(e,t,{collapsed:s,hidden:r,x:Math.round(u.x),y:Math.round(u.y),width:Math.round(u.width),height:Math.round(u.height),isFrame:c})),v(e,"bpmn:BoundaryEvent")&&this._attachBoundary(e,i),v(e,"bpmn:Lane")&&(o=0),v(e,"bpmn:DataStoreReference")&&(sR(n,Ee(u))||(n=this._canvas.findRoot(n))),this._canvas.addShape(i,n,o)}else if(v(t,"bpmndi:BPMNEdge")){var l=this._getSource(e),f=this._getTarget(e);r=n&&(n.hidden||n.collapsed),i=this._elementFactory.createConnection(Bs(e,t,{hidden:r,source:l,target:f,waypoints:aR(t,l,f)})),v(e,"bpmn:DataAssociation")&&(n=this._canvas.findRoot(n)),this._canvas.addConnection(i,n,o)}else throw new Error(`unknown di ${un(t)} for element ${un(e)}`);return rr(e)&&jn(i)&&this.addLabel(e,t,i),this._eventBus.fire("bpmnElement.added",{element:i}),i},Di.prototype._attachBoundary=function(e,t){var n=e.attachedToRef;if(!n)throw new Error(`missing ${un(e)}#attachedToRef`);var i=this._elementRegistry.get(n.id),r=i&&i.attachers;if(!i)throw _m(e,n,"attachedToRef");t.host=i,r||(i.attachers=r=[]),r.indexOf(t)===-1&&r.push(t)},Di.prototype.addLabel=function(e,t,n){var i,r,o;return i=ES(t,n),r=jn(n),r&&(i=this._textRenderer.getExternalLabelBounds(i,r)),o=this._elementFactory.createLabel(Bs(e,t,{id:e.id+"_label",labelTarget:n,type:"label",hidden:n.hidden||!jn(n),x:Math.round(i.x),y:Math.round(i.y),width:Math.round(i.width),height:Math.round(i.height)})),this._canvas.addShape(o,n.parent)},Di.prototype._getConnectedElement=function(e,t){var n,i,r=e.$type;if(i=e[t+"Ref"],t==="source"&&r==="bpmn:DataInputAssociation"&&(i=i&&i[0]),(t==="source"&&r==="bpmn:DataOutputAssociation"||t==="target"&&r==="bpmn:DataInputAssociation")&&(i=e.$parent),n=i&&this._getElement(i),n)return n;throw i?_m(e,i,t+"Ref"):new Error(`${un(e)}#${t} Ref not specified`)},Di.prototype._getSource=function(e){return this._getConnectedElement(e,"source")},Di.prototype._getTarget=function(e){return this._getConnectedElement(e,"target")},Di.prototype._getElement=function(e){return this._elementRegistry.get(e.id)};function sR(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 cR(e){return v(e,"bpmn:Group")}const bm={__depends__:[rR,{__depends__:[ca],bpmnImporter:["type",Di]}]};function ua(e){return{x:e.x+e.width/2,y:e.y+e.height/2}}function ii(e,t){return{x:e.x-t.x,y:e.y-t.y}}function yl(e){return Math.log(e)/Math.log(10)}var uR=1e3;function X(e){this._eventBus=e}X.$inject=["eventBus"];function lR(e,t){return function(n){return e.call(t||null,n.context,n.command,n)}}X.prototype.on=function(e,t,n,i,r,o){if((Yt(t)||Pe(t))&&(o=r,r=i,i=n,n=t,t=null),Yt(n)&&(o=r,r=i,i=n,n=uR),Ut(r)&&(o=r,r=!1),!Yt(i))throw new Error("handlerFn must be a function");we(e)||(e=[e]);var a=this._eventBus;k(e,function(s){var c=["commandStack",s,t].filter(function(u){return u}).join(".");a.on(c,n,r?lR(i,o):i,o)})},X.prototype.canExecute=Li("canExecute"),X.prototype.preExecute=Li("preExecute"),X.prototype.preExecuted=Li("preExecuted"),X.prototype.execute=Li("execute"),X.prototype.executed=Li("executed"),X.prototype.postExecute=Li("postExecute"),X.prototype.postExecuted=Li("postExecuted"),X.prototype.revert=Li("revert"),X.prototype.reverted=Li("reverted");function Li(e){return function(n,i,r,o,a){(Yt(n)||Pe(n))&&(a=o,o=r,r=i,i=n,n=null),this.on(n,e,i,r,o,a)}}var vl=["top","bottom","left","right"],$s=10;function _l(e,t){X.call(this,e),this.postExecuted(["connection.create","connection.layout","connection.updateWaypoints"],function(r){var o=r.context,a=o.connection,s=a.source,c=a.target,u=o.hints||{};u.createElementsBehavior!==!1&&(n(s),n(c))}),this.postExecuted(["label.create"],function(r){var o=r.context,a=o.shape,s=o.hints||{};s.createElementsBehavior!==!1&&n(a.labelTarget)}),this.postExecuted(["elements.create"],function(r){var o=r.context,a=o.elements,s=o.hints||{};s.createElementsBehavior!==!1&&a.forEach(function(c){n(c)})});function n(r){if(Ds(r)&&!ot(r)){var o=dR(r);o&&i(r,o)}}function i(r,o){var a=Ee(r),s=r.label,c=Ee(s);if(s.parent){var u=be(r),l;switch(o){case"top":l={x:a.x,y:u.top-$s-s.height/2};break;case"left":l={x:u.left-$s-s.width/2,y:a.y};break;case"bottom":l={x:a.x,y:u.bottom+$s+s.height/2};break;case"right":l={x:u.right+$s+s.width/2,y:a.y};break}var f=ii(l,c);t.moveShape(s,f)}}}ae(_l,X),_l.$inject=["eventBus","modeling"];function pR(e){var t=e.host,n=Ee(e),i=Qt(n,t),r;i.indexOf("-")>=0?r=i.split("-"):r=[i];var o=vl.filter(function(a){return r.indexOf(a)===-1});return o}function fR(e){var t=Ee(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 xm(t,i)});return n}function dR(e){var t=Ee(e.label),n=Ee(e),i=xm(n,t);if(hR(i)){var r=fR(e);if(e.host){var o=pR(e);r=r.concat(o)}var a=vl.filter(function(s){return r.indexOf(s)===-1});return a.indexOf(i)!==-1?Qt(e.label,e)!=="intersect"?void 0:i:a[0]}}function xm(e,t){return Qt(t,e,5)}function hR(e){return vl.indexOf(e)!==-1}function bl(e){X.call(this,e),this.preExecute("shape.append",function(t){var n=t.source,i=t.shape;t.position||(v(i,"bpmn:TextAnnotation")?t.position={x:n.x+n.width/2+75,y:n.y-50-i.height/2}:t.position={x:n.x+n.width+80+i.width/2,y:n.y+n.height/2})},!0)}ae(bl,X),bl.$inject=["eventBus"];var mR=1500;function xl(e,t,n){e.invoke(X,this),this.preExecute("elements.delete",mR,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=Be(r,u=>v(u,"bpmn:Participant")||v(u,"bpmn:SubProcess"));if(!o.length)return[];var a=n.getRootElement(),s=new Set(a.children.filter(u=>v(u,"bpmn:Artifact"))),c=new Set;return k(o,u=>{const l=new Set(eo(uo(Array.from(s),Mt(u))));c=c.union(l),s=s.difference(l)}),Array.from(c)}}ae(xl,X),xl.$inject=["injector","eventBus","canvas"];function wl(e,t){e.invoke(X,this),this.postExecute("shape.move",function(n){var i=n.newParent,r=n.shape,o=Be(r.incoming.concat(r.outgoing),function(a){return v(a,"bpmn:Association")});k(o,function(a){t.moveConnection(a,{x:0,y:0},i)})},!0)}ae(wl,X),wl.$inject=["injector","modeling"];function yo(e,t){for(Sn(t)&&(t=[t]);e=e.parent;)if(Ie(e,t))return e;return null}function wm(e,t){var n=yo(e,"bpmn:Process");if(n)return!0;var i=["bpmn:Participant","bpmn:Lane"];if(n=yo(e,i),n)return qt(n);if(Ie(e,i))return qt(e);var r;for(r=Z(e);r&&!v(r,"bpmn:Process");r=r.$parent);if(!t)return!0;var o=t.find(function(a){var s=Z(a);return s&&s.get("processRef")===r});return o?qt(o):!0}var Em=500;function js(e,t){t.invoke(X,this),this._bpmnReplace=e;var n=this;this.postExecuted("elements.create",Em,function(i){var r=i.elements;r=r.filter(function(o){var a=o.host;return Sm(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",Em,function(i){var r=i.shapes,o=i.newHost;if(r.length===1){var a=r[0];Sm(a,o)&&(i.shapes=[n._replaceShape(a,o)])}},!0)}js.$inject=["bpmnReplace","injector"],ae(js,X),js.prototype._replaceShape=function(e,t){var n=gR(e),i={type:"bpmn:BoundaryEvent",host:t};return n&&(i.eventDefinitionType=n.$type),this._bpmnReplace.replaceElement(e,i,{layoutConnection:!1})};function gR(e){var t=Z(e),n=t.eventDefinitions;return n&&n[0]}function Sm(e,t){return!De(e)&&Ie(e,["bpmn:IntermediateThrowEvent","bpmn:IntermediateCatchEvent"])&&!!t}function El(e,t){X.call(this,e);function n(i){return Be(i.attachers,function(r){return v(r,"bpmn:BoundaryEvent")})}this.postExecute("connection.create",function(i){var r=i.context.source,o=i.context.target,a=n(o);v(r,"bpmn:EventBasedGateway")&&v(o,"bpmn:ReceiveTask")&&a.length>0&&t.removeElements(a)}),this.postExecute("connection.reconnect",function(i){var r=i.context.oldSource,o=i.context.newSource;v(r,"bpmn:Gateway")&&v(o,"bpmn:EventBasedGateway")&&k(o.outgoing,function(a){var s=a.target,c=n(s);v(s,"bpmn:ReceiveTask")&&c.length>0&&t.removeElements(c)})})}El.$inject=["eventBus","modeling"],ae(El,X);function Rm(e){return e.create("bpmn:Category")}function yR(e){return e.create("bpmn:CategoryValue")}function Cm(e,t){var n=t.get("categoryValueRef");return n||(n=t.categoryValueRef=yR(e)),n.$parent||(n.$parent=Rm(e)),n}function vR(e,t,n){return Ct(t.get("categoryValue"),e),e.$parent=t,Ct(n.get("rootElements"),t),t.$parent=n,e}function _R(e){var t=e.$parent;return t&&(Rt(t.get("categoryValue"),e),e.$parent=null),e}function bR(e){var t=e.$parent;return t&&(Rt(t.get("rootElements"),e),e.$parent=null),e}var xR=500;function Sl(e,t,n){n.invoke(X,this);function i(c){return t.filter(function(u){return v(u,"bpmn:Group")&&!u.labelTarget}).map(Z).filter(function(u){return u!==c})}function r(c,u){return i(u).some(function(l){return l.get("categoryValueRef")===c})}function o(c,u){return i(u).some(function(l){var f=l.get("categoryValueRef");return f&&f.$parent===c})}function a(c,u){c&&u&&vR(c,u,e.getDefinitions())}function s(c,u,l){u&&!o(u,l)&&bR(u),c&&!r(c,l)&&_R(c)}this.executed(["shape.create","label.create"],function(c){var u=c.labelTarget||c.shape;!v(u,"bpmn:Group")||u.labelTarget||a(c.categoryValue,c.category)},!0),this.reverted(["shape.create","label.create"],function(c){var u=c.labelTarget||c.shape;!v(u,"bpmn:Group")||u.labelTarget||s(c.categoryValue,c.category,Z(u))},!0),this.executed(["shape.move","shape.resize"],xR,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,Z(u))},!0),this.executed("group.updateRefs",function(c){Pm(c).forEach(function(u){a(u.categoryValue,u.category)})},!0),this.reverted("group.updateRefs",function(c){Pm(c).forEach(function(u){s(u.categoryValue,u.category,Z(u.groupShape))})},!0),this.executed("shape.delete",function(c){var u=c.shape;!v(u,"bpmn:Group")||u.labelTarget||s(c.categoryValue,c.category,Z(u))},!0),this.reverted("shape.delete",function(c){var u=c.shape;!v(u,"bpmn:Group")||u.labelTarget||a(c.categoryValue,c.category)},!0)}Sl.$inject=["bpmnjs","elementRegistry","injector"],ae(Sl,X);function Pm(e){var t;return((t=e.updates)==null?void 0:t.groups)||[]}function Rl(e,t,n){X.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 R=g.source,E=g.target;vo(R)&&la(E)&&l(E)}function r(g){const R=g.connection,E=g.source,x=g.target;vo(E)&&Fs(x)&&(u(x),p(E,[R]))}function o(g){const R=g.newTarget,E=g.oldSource,x=g.oldTarget;if(x!==R){const w=E;la(x)&&l(x),vo(w)&&Fs(R)&&u(R)}}function a(g){const{element:R}=g;la(R)?(f(R),d(R)):Fs(R)&&h(R)}function s(g){const{newData:R,oldShape:E}=g;if(vo(g.oldShape)&&R.eventDefinitionType!=="bpmn:CompensateEventDefinition"||R.type!=="bpmn:BoundaryEvent"){const x=E.outgoing.find(({target:w})=>la(w));x&&x.target&&(g._connectionTarget=x.target)}else if(!vo(g.oldShape)&&R.eventDefinitionType==="bpmn:CompensateEventDefinition"&&R.type==="bpmn:BoundaryEvent"){const x=E.outgoing.find(({target:w})=>Fs(w));x&&x.target&&(g._connectionTarget=x.target),m(E)}}function c(g){const{_connectionTarget:R,newShape:E}=g;R&&t.connect(E,R)}function u(g){t.updateProperties(g,{isForCompensation:!0})}function l(g){t.updateProperties(g,{isForCompensation:void 0})}function f(g){for(const R of g.incoming)n.canConnect(R.source,g)||t.removeConnection(R);for(const R of g.outgoing)n.canConnect(g,R.target)||t.removeConnection(R)}function p(g,R){g.outgoing.filter(w=>v(w,"bpmn:Association")).filter(w=>la(w.target)&&!R.includes(w)).forEach(w=>t.removeConnection(w))}function d(g){const R=g.attachers.slice();R.length&&t.removeElements(R)}function h(g){const R=g.incoming.filter(E=>vo(E.source));t.removeElements(R)}function m(g){const R=g.outgoing.filter(E=>v(E,"bpmn:SequenceFlow"));t.removeElements(R)}}ae(Rl,X),Rl.$inject=["eventBus","modeling","bpmnRules"];function la(e){const t=Z(e);return t&&t.get("isForCompensation")}function vo(e){return e&&v(e,"bpmn:BoundaryEvent")&&ho(e,"bpmn:CompensateEventDefinition")}function Fs(e){return e&&v(e,"bpmn:Activity")&&!ln(e)}function Cl(e){e.invoke(X,this),this.preExecute("shape.create",1500,function(t){var n=t.context,i=n.parent,r=n.shape;v(i,"bpmn:Lane")&&!v(r,"bpmn:Lane")&&(n.parent=yo(i,"bpmn:Participant"))})}Cl.$inject=["injector"],ae(Cl,X);function Pl(e,t){X.call(this,e),this.preExecute("shape.create",function(n){var a;var i=n.context,r=i.shape;if(v(r,"bpmn:DataObjectReference")&&r.type!=="label"){var o=t.create("bpmn:DataObject");o.isCollection=((a=r.businessObject.dataObjectRef)==null?void 0:a.isCollection)||!1,r.businessObject.dataObjectRef=o}})}Pl.$inject=["eventBus","bpmnFactory"],ae(Pl,X);var Al=20,Tl=20,Am=30,Hs=2e3;function Ml(e,t,n){X.call(this,t),t.on(["create.start","shape.move.start"],Hs,function(r){var o=r.context,a=o.shape,s=e.getRootElement();if(!(!v(a,"bpmn:Participant")||!v(s,"bpmn:Process")||!s.children.length)){var c=s.children.filter(function(f){return!v(f,"bpmn:Group")&&!De(f)&&!ot(f)});if(c.length){var u=Mt(c),l=wR(a,u);I(a,l),o.createConstraints=ER(a,u)}}}),t.on("create.start",Hs,function(r){var o=r.context,a=o.shape,s=e.getRootElement(),c=e.getGraphics(s);function u(l){l.element=s,l.gfx=c}v(a,"bpmn:Participant")&&v(s,"bpmn:Process")&&(t.on("element.hover",Hs,u),t.once("create.cleanup",function(){t.off("element.hover",u)}))});function i(){var r=e.getRootElement();return v(r,"bpmn:Collaboration")?r:n.makeCollaboration()}this.preExecute("elements.create",Hs,function(r){var o=r.elements,a=r.parent,s=SR(o),c;s&&v(a,"bpmn:Process")&&(r.parent=i(),c=r.hints=r.hints||{},c.participant=s,c.process=a,c.processRef=Z(s).get("processRef"))},!0),this.preExecute("shape.create",function(r){var o=r.parent,a=r.shape;v(a,"bpmn:Participant")&&v(o,"bpmn:Process")&&(r.parent=i(),r.process=o,r.processRef=Z(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)&&Z(s).set("processRef",Z(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)&&Z(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)}Ml.$inject=["canvas","eventBus","modeling"],ae(Ml,X);function wR(e,t){t={width:t.width+Al*2+Am,height:t.height+Tl*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 ER(e,t){return t=be(t),{bottom:t.top+e.height/2-Tl,left:t.right-e.width/2+Al,top:t.bottom-e.height/2+Tl,right:t.left+e.width/2-Al-Am}}function SR(e){return ut(e,function(t){return v(t,"bpmn:Participant")})}var Tm="__targetRef_placeholder";function kl(e,t){X.call(this,e),this.executed(["connection.create","connection.delete","connection.move","connection.reconnect"],Mm(o)),this.reverted(["connection.create","connection.delete","connection.move","connection.reconnect"],Mm(o));function n(a,s,c){var u=a.get("dataInputAssociations");return ut(u,function(l){return l!==c&&l.targetRef===s})}function i(a,s){var c=a.get("properties"),u=ut(c,function(l){return l.name===Tm});return!u&&s&&(u=t.create("bpmn:Property",{name:Tm}),Ct(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,f=l&&l.businessObject,p=s.newTarget,d=p&&p.businessObject,h=s.oldTarget||s.target,m=h&&h.businessObject,g=c.businessObject,R;m&&m!==f&&r(m,u),d&&d!==f&&r(d,u),f?(R=i(f,!0),g.targetRef=R):g.targetRef=null}}kl.$inject=["eventBus","bpmnFactory"],ae(kl,X);function Mm(e){return function(t){var n=t.context,i=n.connection;if(v(i,"bpmn:DataInputAssociation"))return e(t)}}function zs(e){this._bpmnUpdater=e}zs.$inject=["bpmnUpdater"],zs.prototype.execute=function(e){var t=e.dataStoreBo,n=e.dataStoreDi,i=e.newSemanticParent,r=e.newDiParent;return e.oldSemanticParent=t.$parent,e.oldDiParent=n.$parent,this._bpmnUpdater.updateSemanticParent(t,i),this._bpmnUpdater.updateDiParent(n,r),[]},zs.prototype.revert=function(e){var t=e.dataStoreBo,n=e.dataStoreDi,i=e.oldSemanticParent,r=e.oldDiParent;return this._bpmnUpdater.updateSemanticParent(t,i),this._bpmnUpdater.updateDiParent(n,r),[]};function Ol(e,t,n,i){X.call(this,i),t.registerHandler("dataStore.updateContainment",zs);function r(){return n.filter(function(s){return v(s,"bpmn:Participant")&&Z(s).processRef})[0]}function o(s){return s.children.filter(function(c){return v(c,"bpmn:DataStoreReference")&&!c.labelTarget})}function a(s,c){var u=s.businessObject||s;if(c=c||r(),c){var l=c.businessObject||c;t.execute("dataStore.updateContainment",{dataStoreBo:u,dataStoreDi:Ye(s),newSemanticParent:l.processRef||l,newDiParent:Ye(c)})}}this.preExecute("shape.create",function(s){var c=s.context,u=c.shape;v(u,"bpmn:DataStoreReference")&&u.type!=="label"&&(c.hints||(c.hints={}),c.hints.autoResize=!1)}),this.preExecute("elements.move",function(s){var c=s.context,u=c.shapes,l=u.filter(function(f){return v(f,"bpmn:DataStoreReference")});l.length&&(c.hints||(c.hints={}),c.hints.autoResize=u.filter(function(f){return!v(f,"bpmn:DataStoreReference")}))}),this.postExecute("shape.create",function(s){var c=s.context,u=c.shape,l=u.parent;v(u,"bpmn:DataStoreReference")&&u.type!=="label"&&v(l,"bpmn:Collaboration")&&a(u)}),this.postExecute("shape.move",function(s){var c=s.context,u=c.shape,l=c.oldParent,f=u.parent;if(!v(l,"bpmn:Collaboration")&&v(u,"bpmn:DataStoreReference")&&u.type!=="label"&&v(f,"bpmn:Collaboration")){var p=v(l,"bpmn:Participant")?l:CR(l,"bpmn:Participant");a(u,p)}}),this.postExecute("shape.delete",function(s){var c=s.context,u=c.shape,l=e.getRootElement();Ie(u,["bpmn:Participant","bpmn:SubProcess"])&&v(l,"bpmn:Collaboration")&&o(l).filter(function(f){return RR(f,u)}).forEach(function(f){a(f)})}),this.postExecute("canvas.updateRoot",function(s){var c=s.context,u=c.oldRoot,l=c.newRoot,f=o(u);f.forEach(function(p){v(l,"bpmn:Process")&&a(p,l)})})}Ol.$inject=["canvas","commandStack","elementRegistry","eventBus"],ae(Ol,X);function RR(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 CR(e,t){for(;e.parent;){if(v(e.parent,t))return e.parent;e=e.parent}}var Gs=Math.max,Vs=Math.min,PR=20;function km(e,t){return{top:e.top-t.top,right:e.right-t.right,bottom:e.bottom-t.bottom,left:e.left-t.left}}function AR(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 TR(e,t){return{x:e.x+(t.left||0),y:e.y+(t.top||0),width:e.width-(t.left||0)+(t.right||0),height:e.height-(t.top||0)+(t.bottom||0)}}function Ws(e,t,n){var i=t[e],r=n.min&&n.min[e],o=n.max&&n.max[e];return Pe(r)&&(i=(/top|left/.test(e)?Vs:Gs)(i,r)),Pe(o)&&(i=(/top|left/.test(e)?Gs:Vs)(i,o)),i}function MR(e,t){if(!t)return e;var n=be(e);return Ps({top:Ws("top",n,t),right:Ws("right",n,t),bottom:Ws("bottom",n,t),left:Ws("left",n,t)})}function kR(e,t,n,i){var r=be(t),o={top:/n/.test(e)?r.bottom-n.height:r.top,left:/w/.test(e)?r.right-n.width:r.left,bottom:/s/.test(e)?r.top+n.height:r.bottom,right:/e/.test(e)?r.left+n.width:r.right},a=i?be(i):o,s={top:Vs(o.top,a.top),left:Vs(o.left,a.left),bottom:Gs(o.bottom,a.bottom),right:Gs(o.right,a.right)};return Ps(s)}function pa(e,t){return typeof e<"u"?e:PR}function OR(e,t){var n,i,r,o;return typeof t=="object"?(n=pa(t.left),i=pa(t.right),r=pa(t.top),o=pa(t.bottom)):n=i=r=o=pa(t),{x:e.x-n,y:e.y-r,width:e.width+n+i,height:e.height+r+o}}function DR(e){return!(e.waypoints||e.type==="label")}function Om(e,t){var n;if(e.length===void 0?n=Be(e.children,DR):n=e,n.length)return OR(Mt(n),t)}var or=Math.abs;function LR(e,t){return km(be(t),be(e))}var IR=["bpmn:Participant","bpmn:Process","bpmn:SubProcess"],Vn=30;function Us(e,t){return t=t||[],e.children.filter(function(n){v(n,"bpmn:Lane")&&(Us(n,t),t.push(n))}),t}function ar(e){return e.children.filter(function(t){return v(t,"bpmn:Lane")})}function Wn(e){return yo(e,IR)||e}function NR(e,t){var n=Wn(e),i=v(n,"bpmn:Process")?[]:[n],r=Us(n,i),o=be(e),a=be(t),s=LR(e,t),c=[],u=qt(e);return r.forEach(function(l){if(l!==e){var f=u?0:s.top,p=u?s.right:0,d=u?0:s.bottom,h=u?s.left:0,m=be(l);s.top&&(or(m.bottom-o.top)<10&&(d=a.top-m.bottom),or(m.top-o.top)<5&&(f=a.top-m.top)),s.left&&(or(m.right-o.left)<10&&(p=a.left-m.right),or(m.left-o.left)<5&&(h=a.left-m.left)),s.bottom&&(or(m.top-o.bottom)<10&&(f=a.bottom-m.top),or(m.bottom-o.bottom)<5&&(d=a.bottom-m.bottom)),s.right&&(or(m.left-o.right)<10&&(h=a.right-m.left),or(m.right-o.right)<5&&(p=a.right-m.right)),(f||p||d||h)&&c.push({shape:l,newBounds:TR(l,{top:f,right:p,bottom:d,left:h})})}}),c}var BR=500;function Dl(e,t){X.call(this,e);function n(i,r){var o=qt(i),a=ar(r),s=[],c=[],u=[],l=[];if(Lr(a,function(g){return o?g.y>i.y?c.push(g):s.push(g):g.x>i.x?l.push(g):u.push(g),g.children}),!!a.length){var f;o?c.length&&s.length?f=i.height/2:f=i.height:l.length&&u.length?f=i.width/2:f=i.width;var p,d,h,m;s.length&&(p=t.calculateAdjustments(s,"y",f,i.y-10),t.makeSpace(p.movingShapes,p.resizingShapes,{x:0,y:f},"s")),c.length&&(d=t.calculateAdjustments(c,"y",-f,i.y+i.height+10),t.makeSpace(d.movingShapes,d.resizingShapes,{x:0,y:-f},"n")),u.length&&(h=t.calculateAdjustments(u,"x",f,i.x-10),t.makeSpace(h.movingShapes,h.resizingShapes,{x:f,y:0},"e")),l.length&&(m=t.calculateAdjustments(l,"x",-f,i.x+i.width+10),t.makeSpace(m.movingShapes,m.resizingShapes,{x:-f,y:0},"w"))}}this.postExecuted("shape.delete",BR,function(i){var r=i.context,o=r.hints,a=r.shape,s=r.oldParent;v(a,"bpmn:Lane")&&(o&&o.nested||n(a,s))})}Dl.$inject=["eventBus","spaceTool"],ae(Dl,X);var Dm=500;function Ys(e,t){t.invoke(X,this),this._bpmnReplace=e;var n=this;this.postExecuted("elements.create",Dm,function(i){var r=i.elements;r.filter(function(o){var a=o.host;return Lm(o,a)}).map(function(o){return r.indexOf(o)}).forEach(function(o){i.elements[o]=n._replaceShape(r[o])})},!0),this.preExecute("elements.move",Dm,function(i){var r=i.shapes,o=i.newHost;r.forEach(function(a,s){var c=a.host;Lm(a,jR(r,c)?c:o)&&(r[s]=n._replaceShape(a))})},!0)}Ys.$inject=["bpmnReplace","injector"],ae(Ys,X),Ys.prototype._replaceShape=function(e){var t=$R(e),n;return t?n={type:"bpmn:IntermediateCatchEvent",eventDefinitionType:t.$type}:n={type:"bpmn:IntermediateThrowEvent"},this._bpmnReplace.replaceElement(e,n,{layoutConnection:!1})};function $R(e){var t=Z(e),n=t.eventDefinitions;return n&&n[0]}function Lm(e,t){return!De(e)&&v(e,"bpmn:BoundaryEvent")&&!t}function jR(e,t){return e.indexOf(t)!==-1}var qs=Math.round,FR=Math.max;function HR(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 zR(e){var t=[];return e.forEach(function(n,i){t.push([i===0?"M":"L",n.x,n.y])}),t}var Im=10;function GR(e,t){var n,i;for(n=0;i=e[n];n++)if(ta(i,t)<=Im)return{point:e[n],bendpoint:!0,index:n};return null}function VR(e,t){var n=Fh(HR(t,Im),zR(e)),i=n[0],r=n[n.length-1],o;return i?i!==r?i.segment2!==r.segment2?(o=FR(i.segment2,r.segment2)-1,{point:e[o],bendpoint:!0,index:o}):{point:{x:qs(i.x+r.x)/2,y:qs(i.y+r.y)/2},index:i.segment2}:{point:{x:qs(i.x),y:qs(i.y)},index:i.segment2}:null}function Ll(e,t){return GR(e,t)||VR(e,t)}function Il(e,t,n){X.call(this,e);function i(r,o,a){var s=o.waypoints,c,u,l,f,p,d,h,m=r.outgoing.slice(),g=r.incoming.slice(),R;Pe(a.width)?R=Ee(a):R=a;var E=Ll(s,R);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]:R,(c.length===1||!Nm(r,c[c.length-1]))&&c.push(Bm(l)),(u.length===1||!Nm(r,u[0]))&&u.unshift(Bm(l))}f=o.source,p=o.target,t.canConnect(f,r,o)&&(n.reconnectEnd(o,r,c||R),d=o),t.canConnect(r,p,o)&&(d?h=n.connect(r,p,{type:o.type,waypoints:u}):(n.reconnectStart(o,r,u||R),h=o));var x=[].concat(d&&Be(g,function(w){return w.source===d.source})||[],h&&Be(m,function(w){return w.target===h.target})||[]);x.length&&n.removeElements(x)}this.preExecute("elements.move",function(r){var o=r.newParent,a=r.shapes,s=r.delta,c=a[0];if(!(!c||!o)){o&&o.waypoints&&(r.newParent=o=o.parent);var u=Ee(c),l={x:u.x+s.x,y:u.y+s.y},f=ut(o.children,function(p){var d=t.canInsert(a,p);return d&&Ll(p.waypoints,l)});f&&(r.targetFlow=f,r.position=l)}},!0),this.postExecuted("elements.move",function(r){var o=r.shapes,a=r.targetFlow,s=r.position;a&&i(o[0],a,s)},!0),this.preExecute("shape.create",function(r){var o=r.parent,a=r.shape;t.canInsert(a,o)&&(r.targetFlow=o,r.parent=o.parent)},!0),this.postExecuted("shape.create",function(r){var o=r.shape,a=r.targetFlow,s=r.position;a&&i(o,a,s)},!0)}ae(Il,X),Il.$inject=["eventBus","bpmnRules","modeling"];function Nm(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 Bm(e){return I({},e)}function Nl(e,t){X.call(this,e),this.preExecuted("connection.create",function(n){var i=n.context,r=i.connection,o=i.source,a=i.target,s=i.hints;if(!(s&&s.createElementsBehavior===!1)&&_o(r)){var c=[];v(o,"bpmn:EventBasedGateway")?c=a.incoming.filter(u=>u!==r&&_o(u)):c=a.incoming.filter(u=>u!==r&&_o(u)&&v(u.source,"bpmn:EventBasedGateway")),c.forEach(function(u){t.removeConnection(u)})}}),this.preExecuted("shape.replace",function(n){var i=n.context,r=i.newShape;if(v(r,"bpmn:EventBasedGateway")){var o=r.outgoing.filter(_o).reduce(function(a,s){return a.includes(s.target)?a:a.concat(s.target)},[]);o.forEach(function(a){a.incoming.filter(_o).forEach(function(s){const c=a.incoming.filter(_o).filter(function(u){return u.source===r});(s.source!==r||c.length>1)&&t.removeConnection(s)})})}})}Nl.$inject=["eventBus","modeling"],ae(Nl,X);function _o(e){return v(e,"bpmn:SequenceFlow")}var Ks=1500,$m=2e3;function jm(e,t,n){t.on(["create.hover","create.move","create.out","create.end","shape.move.hover","shape.move.move","shape.move.out","shape.move.end"],Ks,function(i){var r=i.context,o=r.shape||i.shape,a=i.hover;v(a,"bpmn:Lane")&&!Ie(o,["bpmn:Lane","bpmn:Participant"])&&(i.hover=Wn(a),i.hoverGfx=e.getGraphics(i.hover));var s=n.getRootElement();a&&a!==s&&(o.labelTarget||Ie(o,["bpmn:Group","bpmn:TextAnnotation"]))&&(i.hover=s,i.hoverGfx=e.getGraphics(i.hover))}),t.on(["connect.hover","connect.out","connect.end","connect.cleanup","global-connect.hover","global-connect.out","global-connect.end","global-connect.cleanup"],Ks,function(i){var r=i.hover;v(r,"bpmn:Lane")&&(i.hover=Wn(r)||r,i.hoverGfx=e.getGraphics(i.hover))}),t.on(["bendpoint.move.hover"],Ks,function(i){var r=i.context,o=i.hover,a=r.type;v(o,"bpmn:Lane")&&/reconnect/.test(a)&&(i.hover=Wn(o)||o,i.hoverGfx=e.getGraphics(i.hover))}),t.on(["connect.start"],Ks,function(i){var r=i.context,o=r.start;v(o,"bpmn:Lane")&&(r.start=Wn(o)||o)}),t.on("shape.move.start",$m,function(i){var r=i.shape;v(r,"bpmn:Lane")&&(i.shape=Wn(r)||r)}),t.on("spaceTool.move",$m,function(i){var r=i.hover;r&&v(r,"bpmn:Lane")&&(i.hover=Wn(r))})}jm.$inject=["elementRegistry","eventBus","canvas"];var Fm=770;function Bl(e,t,n,i){n.invoke(X,this);function r(s,c){var u=Z(s),l=c.categoryValue||u.categoryValueRef;l||(l=Cm(e,u));var f=c.category||l.$parent||Rm(e);u.categoryValueRef=l,l.$parent=f,c.categoryValue=l,c.category=f}function o(s,c){var u=Z(s),l=c.categoryValue||u.categoryValueRef,f=c.category||l&&l.$parent;l&&(c.categoryValue=l,c.category=f,u.categoryValueRef=null)}this.execute("label.create",function(s){var c=s.context,u=c.labelTarget;v(u,"bpmn:Group")&&r(u,c)}),this.revert("label.create",function(s){var c=s.context,u=c.labelTarget;v(u,"bpmn:Group")&&o(u,c)}),this.execute("shape.delete",function(s){var c=s.context,u=c.shape,l=Z(u);if(!(!v(u,"bpmn:Group")||u.labelTarget)){var f=c.categoryValue=l.categoryValueRef;f&&(c.category=f.$parent,l.categoryValueRef=null)}}),this.reverted("shape.delete",function(s){var c=s.context,u=c.shape;if(!(!v(u,"bpmn:Group")||u.labelTarget)){var l=c.category,f=c.categoryValue,p=Z(u);f&&(p.categoryValueRef=f,f.$parent=l)}}),this.execute("shape.create",function(s){var c=s.context,u=c.shape,l=c.hints||{};!v(u,"bpmn:Group")||u.labelTarget||l.createElementsBehavior===!1&&!Z(u).categoryValueRef&&!c.categoryValue||r(u,c)}),this.reverted("shape.create",function(s){var c=s.context,u=c.shape,l=c.hints||{};!v(u,"bpmn:Group")||u.labelTarget||l.createElementsBehavior===!1&&!Z(u).categoryValueRef&&!c.categoryValue||o(u,c)}),this.executed(["shape.move","shape.resize"],function(s){var c=s.context,u=c.shape;!v(u,"bpmn:Group")||u.labelTarget||Z(u).categoryValueRef||r(u,c)}),this.reverted(["shape.move","shape.resize"],function(s){var c=s.context,u=c.shape;!v(u,"bpmn:Group")||u.labelTarget||!c.categoryValue||o(u,c)});function a(s,c){var u=e.create(s.$type);return i.copyElement(s,u,null,c)}t.on("copyPaste.copyElement",Fm,function(s){var c=s.descriptor,u=s.element;if(!(!v(u,"bpmn:Group")||u.labelTarget)){var l=Z(u);if(l.categoryValueRef){var f=l.categoryValueRef;c.categoryValue=a(f,!0),f.$parent&&(c.category=a(f.$parent,!0))}}}),t.on("copyPaste.pasteElement",Fm,function(s){var c=s.descriptor,u=c.businessObject,l=c.categoryValue,f=c.category;l&&(l=u.categoryValueRef=a(l)),f&&(l.$parent=a(f)),delete c.category,delete c.categoryValue})}Bl.$inject=["bpmnFactory","eventBus","injector","moddleCopy"],ae(Bl,X);function $l(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 Hm(e){function t(i,r,o){var a={x:o.x,y:o.y-50},s={x:o.x-50,y:o.y},c=$l(i,r,o,a),u=$l(i,r,o,s),l;c&&u?zm(c,o)>zm(u,o)?l=u:l=c:l=c||u,i.original=l}function n(i){var r=i.waypoints;t(r[0],r[1],Ee(i.source)),t(r[r.length-1],r[r.length-2],Ee(i.target))}e.on("bpmnElement.added",function(i){var r=i.element;r.waypoints&&n(r)})}Hm.$inject=["eventBus"];function zm(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function jl(e){X.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=Z(i),o=Ye(i);if(Ie(r,t)){var a=o.get("isHorizontal");a===void 0&&(a=!0),o.set("isHorizontal",a)}})}jl.$inject=["eventBus"],ae(jl,X);function Gm(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}function Vm(e){return Math.atan((e[1].y-e[0].y)/(e[1].x-e[0].x))}function WR(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 UR(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 Fl(e,t){var n=t[0],i=t[1],r={x:i.x-n.x,y:i.y-n.y},o=UR([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 Wm(e,t){var n=Fl(e,t),i={x:n.x-e.x,y:n.y-e.y};return Gm(i)}function fa(e,t){return Gm({x:e.x-t.x,y:e.y-t.y})}var Um=Math.sqrt,Ym=Math.min,YR=Math.max,qm=Math.abs;function Km(e){return Math.pow(e,2)}function da(e,t){return Um(Km(e.x-t.x)+Km(e.y-t.y))}function qR(e,t){var n=0,i,r,o,a,s,c,u,l,f,p,d;for(n=0;n<t.length-1;n++){if(i=t[n],r=t[n+1],Zm(i,r)?u=[i]:(o=da(e,i),a=da(e,r),c=Ym(o,a),u=KR(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:Zm(i,u[0])?n:n+1}),u.length===2&&(s=ZR(u[0],u[1]),l={type:"segment",position:s,segmentIndex:n,relativeLocation:da(i,s)/da(i,r)}),f=da(l.position,e),(!d||p>f)&&(d=l,p=f)}return d}function KR(e,t,n,i){var r=t.x-e.x,o=t.y-e.y,a=n.x-e.x,s=n.y-e.y,c=r*r+o*o,u=r*a+o*s,l=a*a+s*s-i*i,f=u/c,p=l/c,d=f*f-p;if(d<0&&d>-1e-6&&(d=0),d<0)return[];var h=Um(d),m=-f+h,g=-f-h,R={x:e.x-r*m,y:e.y-o*m};if(d===0)return[R];var E={x:e.x-r*g,y:e.y-o*g};return[R,E].filter(function(x){return XR(x,e,t)})}function XR(e,t,n){return Xm(e.x,t.x,n.x)&&Xm(e.y,t.y,n.y)}function Xm(e,t,n){return e>=Ym(t,n)-Xs&&e<=YR(t,n)+Xs}function ZR(e,t){return{x:(e.x+t.x)/2,y:(e.y+t.y)/2}}var Xs=.1;function Zm(e,t){return qm(e.x-t.x)<=Xs&&qm(e.y-t.y)<=Xs}function QR(e,t,n,i){var r=n.segmentIndex,o=t.length-e.length;if(i.segmentMove){var a=i.segmentMove.segmentStartIndex,s=i.segmentMove.newSegmentStartIndex;return r===a?s:r>=s?r+o<s?s:r+o:r}if(i.bendpointMove){var c=i.bendpointMove.insert,u=i.bendpointMove.bendpointIndex,l;if(o===0)return r;if(r>=u&&(l=c?r+1:r-1),r<u&&(l=r,c&&n.type!=="bendpoint"&&u-1===r)){var f=Jm(t,u);f<n.relativeLocation&&l++}return l}return o===0?r:i.connectionStart&&r===0?0:i.connectionEnd&&r===e.length-2?t.length-2:Math.floor((t.length-2)/2)}function Qm(e,t,n,i){var r=0,o=0,a={point:e,delta:{x:0,y:0}},s=qR(e,n),c=s.segmentIndex,u=QR(n,t,s,i);if(u<0||u>t.length-2||u===null)return a;var l=eg(n,c),f=eg(t,u),p=s.position,d=eC(l,p),h=JR(l,f);if(s.type==="bendpoint"){var m=t.length-n.length,g=s.bendpointIndex,R=n[g];if(t.indexOf(R)!==-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=Jm(n,g))}var x={x:(f[1].x-f[0].x)*d+f[0].x,y:(f[1].y-f[0].y)*d+f[0].y},w=WR({x:e.x-p.x,y:e.y-p.y},h);return r=x.x+w.x-e.x,o=x.y+w.y-e.y,{point:ki(x),delta:ki({x:r,y:o})}}function Jm(e,t){var n=fa(e[t-1],e[t]),i=fa(e[t],e[t+1]),r=n/(n+i);return r}function JR(e,t){var n=Vm(e),i=Vm(t);return i-n}function eg(e,t){return[e[t],e[t+1]]}function eC(e,t){var n=fa(e[0],e[1]),i=fa(e[0],t);return n===0?0:i/n}function tC(e,t,n,i){var r=Ee(e);return Qm(r,t,n,i).delta}function ha(e,t,n){var i=ua(t),r=ua(n),o=ii(e,i),a={x:o.x*(n.width/t.width),y:o.y*(n.height/t.height)};return ki({x:r.x+a.x,y:r.y+a.y})}function tg(e,t,n){var i=ua(e),r=ua(t),o=ua(n),a=ii(e,i),s=ii(i,r),c=nC(i,t,n);if(c)return c;var u={x:s.x*(n.width/t.width),y:s.y*(n.height/t.height)},l={x:o.x+u.x,y:o.y+u.y};return ki({x:l.x+a.x-e.x,y:l.y+a.y-e.y})}function nC(e,t,n){var i=be(t),r=be(n);if(iC(i,r))return null;var o=Qt(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=Qt(n,s),c!==o?null:a}function iC(e,t){return rC(e,t)||oC(e,t)}function rC(e,t){return e.right!==t.right&&e.left!==t.left}function oC(e,t){return e.top!==t.top&&e.bottom!==t.bottom}var ng="name",ig="text";function Hl(e,t,n,i){X.call(this,e),this.postExecute("element.updateProperties",r),this.postExecute("element.updateModdleProperties",a=>{Z(a.context.element)===a.context.moddleElement&&r(a)});function r(a){var s=a.context,c=s.element,u=s.properties;if(ng in u&&t.updateLabel(c,u[ng]),ig in u&&v(c,"bpmn:TextAnnotation")){var l=i.getTextAnnotationBounds({x:c.x,y:c.y,width:c.width,height:c.height},u[ig]||"");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;De(u)||!rr(u)||jn(u)&&t.updateLabel(u,jn(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=I({},s.hints),f=s.newWaypoints||c.waypoints,p=s.oldWaypoints;return typeof l.startChanged>"u"&&(l.startChanged=!!l.connectionStart),typeof l.endChanged>"u"&&(l.endChanged=!!l.connectionEnd),tC(u,f,p,l)}this.postExecute(["connection.layout","connection.updateWaypoints"],function(a){var s=a.context,c=s.hints||{};if(c.labelBehavior!==!1){var u=s.connection,l=u.label,f;!l||!l.parent||(f=o(a),t.moveShape(l,f))}}),this.postExecute(["shape.replace"],function(a){var s=a.context,c=s.newShape,u=s.oldShape,l=Z(c);l&&rr(l)&&u.label&&c.label&&(c.label.x=u.label.x,c.label.y=u.label.y)}),this.preExecute("shape.resize",function(a){var s=a.context,c=s.shape,u=s.hints||{};if(!(!De(c)||u.autoResize)){var l=s.newBounds,f=i.getDimensions(jn(c)||"",{box:l,style:i.getExternalStyle()}),p=Math.ceil(f.height),d=l.y!==c.y,h=c.y+c.height;s.newBounds={width:l.width,height:p,x:l.x,y:d?h-p:l.y}}}),this.postExecute("shape.resize",function(a){var s=a.context,c=s.shape,u=s.newBounds,l=s.oldBounds;if(Ds(c)){var f=c.label,p=Ee(f),d=cC(l),h=sC(p,d),m=aC(h,l,u);t.moveShape(f,m)}})}ae(Hl,X),Hl.$inject=["eventBus","modeling","bpmnFactory","textRenderer"];function aC(e,t,n){var i=ha(e,t,n);return ki(ii(i,e))}function sC(e,t){if(t.length){var n=uC(e,t);return Fl(e,n)}}function cC(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 uC(e,t){var n=t.map(function(r){return{line:r,distance:Wm(e,r)}}),i=oi(n,"distance");return i[0].line}function lC(e,t,n,i){return Qm(e,t,n,i).point}function zl(e,t){X.call(this,e);function n(i,r){var o=i.context,a=o.connection,s=I({},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),lC(r,c,u,s)}this.postExecute(["connection.layout","connection.updateWaypoints"],function(i){var r=i.context,o=r.connection,a=o.outgoing,s=o.incoming;s.forEach(function(c){var u=c.waypoints[c.waypoints.length-1],l=n(i,u),f=[].concat(c.waypoints.slice(0,-1),[l]);t.updateWaypoints(c,f)}),a.forEach(function(c){var u=c.waypoints[0],l=n(i,u),f=[].concat([l],c.waypoints.slice(1));t.updateWaypoints(c,f)})}),this.postExecute(["connection.move"],function(i){var r=i.context,o=r.connection,a=o.outgoing,s=o.incoming,c=r.delta;s.forEach(function(u){var l=u.waypoints[u.waypoints.length-1],f={x:l.x+c.x,y:l.y+c.y},p=[].concat(u.waypoints.slice(0,-1),[f]);t.updateWaypoints(u,p)}),a.forEach(function(u){var l=u.waypoints[0],f={x:l.x+c.x,y:l.y+c.y},p=[].concat([f],u.waypoints.slice(1));t.updateWaypoints(u,p)})})}ae(zl,X),zl.$inject=["eventBus","modeling"];function Zs(e,t,n){var i=Js(e),r=og(i,t),o=i[0];return r.length?r[r.length-1]:ha(o.original||o,n,t)}function Qs(e,t,n){var i=Js(e),r=og(i,t),o=i[i.length-1];return r.length?r[0]:ha(o.original||o,n,t)}function Gl(e,t,n){var i=Js(e),r=rg(t,n),o=i[0];return ha(o.original||o,r,t)}function Vl(e,t,n){var i=Js(e),r=rg(t,n),o=i[i.length-1];return ha(o.original||o,r,t)}function rg(e,t){return{x:e.x-t.x,y:e.y-t.y,width:e.width,height:e.height}}function Js(e){var t=e.waypoints;if(!t.length)throw new Error("connection#"+e.id+": no waypoints");return t}function og(e,t){var n=an(e,fC);return Be(n,function(i){return pC(i,t)})}function pC(e,t){return Qt(t,e,1)==="intersect"}function fC(e){return e.original||e}function Wl(e,t){X.call(this,e),this.postExecute("shape.replace",function(n){var i=n.oldShape,r=n.newShape;if(dC(i,r)){var o=hC(i);o.incoming.forEach(function(a){var s=Qs(a,r,i);t.reconnectEnd(a,r,s)}),o.outgoing.forEach(function(a){var s=Zs(a,r,i);t.reconnectStart(a,r,s)})}},!0)}Wl.$inject=["eventBus","modeling"],ae(Wl,X);function dC(e,t){return v(e,"bpmn:Participant")&&He(e)&&v(t,"bpmn:Participant")&&!He(t)}function hC(e){var t=Jo([e]),n=[],i=[];return t.forEach(function(r){r!==e&&(r.incoming.forEach(function(o){v(o,"bpmn:MessageFlow")&&n.push(o)}),r.outgoing.forEach(function(o){v(o,"bpmn:MessageFlow")&&i.push(o)}))},[]),{incoming:n,outgoing:i}}const mC=["bpmn:MessageEventDefinition","bpmn:TimerEventDefinition","bpmn:EscalationEventDefinition","bpmn:ConditionalEventDefinition","bpmn:SignalEventDefinition"];function ag(e){const t=Z(e);if(!v(t,"bpmn:BoundaryEvent")&&!(v(t,"bpmn:StartEvent")&&ln(t.$parent)))return!1;const n=t.get("eventDefinitions");return!n||!n.length?!1:mC.some(i=>v(n[0],i))}function sg(e){return v(e,"bpmn:BoundaryEvent")?"cancelActivity":"isInterrupting"}function Ul(e,t){e.invoke(X,this),this.postExecuted("shape.replace",function(n){const i=n.context.oldShape,r=n.context.newShape,o=n.context.hints;if(!ag(r))return;const a=sg(r);if(o.targetElement&&o.targetElement[a]!==void 0)return;const c=Z(i).get(a),u=Z(r).get(a);c!==u&&t.updateProperties(r,{[a]:c})})}Ul.$inject=["injector","modeling"],ae(Ul,X);function Yl(e,t){X.call(this,e),this.preExecute("shape.resize",function(n){var i=n.shape,r=Ye(i),o=r&&r.get("label"),a=o&&o.get("bounds");a&&t.updateModdleProperties(i,o,{bounds:void 0})},!0)}ae(Yl,X),Yl.$inject=["eventBus","modeling"];function ql(e,t,n){X.call(this,e),this.preExecute("shape.delete",function(i){var r=i.context.shape;if(!(r.incoming.length!==1||r.outgoing.length!==1)){var o=r.incoming[0],a=r.outgoing[0];if(!(!v(o,"bpmn:SequenceFlow")||!v(a,"bpmn:SequenceFlow"))&&t.canConnect(o.source,a.target,o)){var s=gC(o.waypoints,a.waypoints);n.reconnectEnd(o,a.target,s)}}})}ae(ql,X),ql.$inject=["eventBus","bpmnRules","modeling"];function bo(e){return e.original||e}function gC(e,t){var n=$l(bo(e[e.length-2]),bo(e[e.length-1]),bo(t[1]),bo(t[0]));return n?[].concat(e.slice(0,e.length-1),[n],t.slice(1)):[bo(e[0]),bo(t[t.length-1])]}function Kl(e,t){X.call(this,e),this.preExecute("shape.delete",function(n){var i=n.shape,r=i.parent;v(i,"bpmn:Participant")&&(n.collaborationRoot=r)},!0),this.postExecute("shape.delete",function(n){var i=n.collaborationRoot;if(i&&!i.businessObject.participants.length){var r=t.makeProcess(),o=i.children.slice();t.moveElements(o,{x:0,y:0},r)}},!0)}Kl.$inject=["eventBus","modeling"],ae(Kl,X);function Xl(e,t,n,i){X.call(this,e);var r=i.get("dragging",!1);function o(c){var u=c.source,l=c.target,f=c.parent;if(f){var p,d;v(c,"bpmn:SequenceFlow")&&(n.canConnectSequenceFlow(u,l)||(d=!0),n.canConnectMessageFlow(u,l)&&(p="bpmn:MessageFlow")),v(c,"bpmn:MessageFlow")&&(n.canConnectMessageFlow(u,l)||(d=!0),n.canConnectSequenceFlow(u,l)&&(p="bpmn:SequenceFlow")),d&&t.removeConnection(c),p&&t.connect(u,l,{type:p,waypoints:c.waypoints.slice()})}}function a(c){var u=c.context,l=u.connection,f=u.newSource||l.source,p=u.newTarget||l.target,d,h;d=n.canConnect(f,p),!(!d||d.type===l.type)&&(h=t.connect(f,p,{type:d.type,associationDirection:d.associationDirection,waypoints:l.waypoints.slice()}),l.parent&&t.removeConnection(l),u.connection=h,r&&s(l,h))}function s(c,u){var l=r.context(),f=l&&l.payload.previousSelection,p;!f||!f.length||(p=f.indexOf(c),p!==-1&&f.splice(p,1,u))}this.postExecuted("elements.move",function(c){var u=c.closure,l=u.allConnections;k(l,o)},!0),this.preExecute("connection.reconnect",a),this.postExecuted("element.updateProperties",function(c){var u=c.context,l=u.properties,f=u.element,p=f.businessObject,d;l.default&&(d=ut(f.outgoing,no({id:f.businessObject.default.id})),d&&t.updateProperties(d,{conditionExpression:void 0})),l.conditionExpression&&p.sourceRef.default===p&&t.updateProperties(f.source,{default:void 0})})}ae(Xl,X),Xl.$inject=["eventBus","modeling","bpmnRules","injector"];function ec(e,t,n,i,r,o){i.invoke(X,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=Cn(u,function(f,p){var d=t.canReplace([p],p.host||p.parent||c);return d?f.concat(d.replacements):f},[]);l.length&&this._replaceElements(u,l)},this),this.postExecuted(["elements.move"],500,function(a){var s=a.context,c=s.newParent,u=s.newHost,l=[];k(s.closure.topLevel,function(p){ln(p)?l=l.concat(p.children):l=l.concat(p)}),l.length===1&&u&&(c=u);var f=t.canReplace(l,c);f&&this._replaceElements(l,f.replacements,u)},this),this.postExecute(["shape.replace"],1500,function(a){var s=a.context,c=s.oldShape,u=s.newShape,l=c.attachers,f;l&&l.length&&(f=t.canReplace(l,u),this._replaceElements(l,f.replacements))},this),this.postExecuted(["shape.replace"],1500,function(a){var s=a.context,c=s.oldShape,u=s.newShape;r.unclaimId(c.businessObject.id,c.businessObject),r.updateProperties(u,{id:c.id})})}ae(ec,X),ec.prototype._replaceElements=function(e,t){var n=this._elementRegistry,i=this._bpmnReplace,r=this._selection;k(t,function(o){var a={type:o.newElementType},s=n.get(o.oldElementId),c=e.indexOf(s);e[c]=i.replaceElement(s,a,{select:!1})}),t&&r.select(e)},ec.$inject=["bpmnReplace","bpmnRules","elementRegistry","injector","modeling","selection"];var yC=1500,vC={width:140,height:120},Zl={width:300,height:60},Ql={width:60,height:300},tc={width:300,height:150},nc={width:150,height:300},cg={width:140,height:120},ug={width:100,height:40};function lg(e){e.on("resize.start",yC,function(t){var n=t.context,i=n.shape,r=n.direction,o=n.balanced;(v(i,"bpmn:Lane")||v(i,"bpmn:Participant"))&&(n.resizeConstraints=EC(i,r,o)),v(i,"bpmn:SubProcess")&&He(i)&&(n.minDimensions=cg),v(i,"bpmn:TextAnnotation")&&(n.minDimensions=ug)})}lg.$inject=["eventBus"];var sr=Math.abs,_C=Math.min,bC=Math.max;function pg(e,t,n,i){var r=e[t];e[t]=r===void 0?n:i(n,r)}function xo(e,t,n){return pg(e,t,n,_C)}function wo(e,t,n){return pg(e,t,n,bC)}var xC={top:20,left:50,right:20,bottom:20},wC={top:50,left:20,right:20,bottom:20};function EC(e,t,n){var i=Wn(e),r=!0,o=!0,a=Us(i,[i]),s=be(e),c={},u={},l=qt(e),f=l?Zl:Ql;/n/.test(t)?u.top=s.bottom-f.height:/e/.test(t)?u.right=s.left+f.width:/s/.test(t)?u.bottom=s.top+f.height:/w/.test(t)&&(u.left=s.right-f.width),a.forEach(function(h){var m=be(h);l?(m.top<s.top-10&&(r=!1),m.bottom>s.bottom+10&&(o=!1)):(m.left<s.left-10&&(r=!1),m.right>s.right+10&&(o=!1)),/n/.test(t)&&(n&&sr(s.top-m.bottom)<10&&wo(c,"top",m.top+f.height),sr(s.top-m.top)<5&&xo(u,"top",m.bottom-f.height)),/e/.test(t)&&(n&&sr(s.right-m.left)<10&&xo(c,"right",m.right-f.width),sr(s.right-m.right)<5&&wo(u,"right",m.left+f.width)),/s/.test(t)&&(n&&sr(s.bottom-m.top)<10&&xo(c,"bottom",m.bottom-f.height),sr(s.bottom-m.bottom)<5&&wo(u,"bottom",m.top+f.height)),/w/.test(t)&&(n&&sr(s.left-m.right)<10&&wo(c,"left",m.left+f.width),sr(s.left-m.left)<5&&xo(u,"left",m.right-f.width))});var p=i.children.filter(function(h){return!h.hidden&&!h.waypoints&&(v(h,"bpmn:FlowElement")||v(h,"bpmn:Artifact"))}),d=l?xC:wC;return p.forEach(function(h){var m=be(h);/n/.test(t)&&(!l||r)&&xo(u,"top",m.top-d.top),/e/.test(t)&&(l||o)&&wo(u,"right",m.right+d.right),/s/.test(t)&&(!l||o)&&wo(u,"bottom",m.bottom+d.bottom),/w/.test(t)&&(l||r)&&xo(u,"left",m.left-d.left)}),{min:u,max:c}}function fg(e){!e||typeof e.stopPropagation!="function"||e.stopPropagation()}function Eo(e){return e.originalEvent||e.srcEvent}function Jl(e){fg(e),fg(Eo(e))}function $r(e){return e.pointers&&e.pointers.length&&(e=e.pointers[0]),e.touches&&e.touches.length&&(e=e.touches[0]),e?{x:e.clientX,y:e.clientY}:null}function dg(){return/mac/i.test(navigator.platform)}function hg(e,t){return(Eo(e)||e).button===t}function cr(e){return hg(e,0)}function SC(e){return hg(e,1)}function ma(e){var t=Eo(e)||e;return cr(e)?dg()?t.metaKey:t.ctrlKey:!1}function ic(e){var t=Eo(e)||e;return cr(e)&&t.shiftKey}var mg=1001;function gg(e,t){e.on("resize.start",mg+500,function(n){var i=n.context,r=i.shape;(v(r,"bpmn:Lane")||v(r,"bpmn:Participant"))&&(i.balanced=!ma(n))}),e.on("resize.end",mg,function(n){var i=n.context,r=i.shape,o=i.canExecute,a=i.newBounds;if(v(r,"bpmn:Lane")||v(r,"bpmn:Participant"))return o&&(a=Wh(a),t.resizeLane(r,a,i.balanced)),!1})}gg.$inject=["eventBus","modeling"];var RC=500;function ep(e,t,n,i,r){n.invoke(X,this);function o(l){return Ie(l,["bpmn:ReceiveTask","bpmn:SendTask"])||CC(l,["bpmn:ErrorEventDefinition","bpmn:EscalationEventDefinition","bpmn:MessageEventDefinition","bpmn:SignalEventDefinition"])}function a(l){var f=e.getDefinitions(),p=f.get("rootElements");return!!ut(p,no({id:l.id}))}function s(l){if(v(l,"bpmn:ErrorEventDefinition"))return"errorRef";if(v(l,"bpmn:EscalationEventDefinition"))return"escalationRef";if(v(l,"bpmn:MessageEventDefinition"))return"messageRef";if(v(l,"bpmn:SignalEventDefinition"))return"signalRef"}function c(l){if(Ie(l,["bpmn:ReceiveTask","bpmn:SendTask"]))return l.get("messageRef");var f=l.get("eventDefinitions"),p=f[0];return p.get(s(p))}function u(l,f){if(Ie(l,["bpmn:ReceiveTask","bpmn:SendTask"]))return l.set("messageRef",f);var p=l.get("eventDefinitions"),d=p[0];return d.set(s(d),f)}this.executed(["shape.create","element.updateProperties","element.updateModdleProperties"],function(l){var f=l.shape||l.element;if(o(f)){var p=Z(f),d=c(p),h;d&&!a(d)&&(h=e.getDefinitions().get("rootElements"),Ct(h,d),l.addedRootElement=d)}},!0),this.reverted(["shape.create","element.updateProperties","element.updateModdleProperties"],function(l){var f=l.addedRootElement;if(f){var p=e.getDefinitions().get("rootElements");Rt(p,f)}},!0),t.on("copyPaste.copyElement",function(l){var f=l.descriptor,p=l.element;if(!(p.labelTarget||!o(p))){var d=Z(p),h=c(d);h&&(f.referencedRootElement=h)}}),t.on("copyPaste.pasteElement",RC,function(l){var f=l.descriptor,p=f.businessObject,d=f.referencedRootElement;d&&(a(d)||(d=i.copyElement(d,r.create(d.$type))),u(p,d),delete f.referencedRootElement)})}ep.$inject=["bpmnjs","eventBus","injector","moddleCopy","bpmnFactory"],ae(ep,X);function CC(e,t){return we(t)||(t=[t]),Wi(t,function(n){return ho(e,n)})}var yg=Math.max;function vg(e){e.on("spaceTool.getMinDimensions",function(t){var n=t.shapes,i=t.axis,r=t.start,o={};return k(n,function(a){var s=a.id;v(a,"bpmn:Participant")&&(o[s]=AC(a,i,r)),v(a,"bpmn:Lane")&&(o[s]=qt(a)?Zl:Ql),v(a,"bpmn:SubProcess")&&He(a)&&(o[s]=cg),v(a,"bpmn:TextAnnotation")&&(o[s]=ug),v(a,"bpmn:Group")&&(o[s]=vC)}),o})}vg.$inject=["eventBus"];function PC(e){return e==="x"}function AC(e,t,n){var i=qt(e);if(!kC(e))return i?tc:nc;var r=PC(t),o={};return r?i?o=tc:o={width:MC(e,n,r),height:nc.height}:i?o={width:tc.width,height:TC(e,n,r)}:o=nc,o}function TC(e,t,n){var i;return i=OC(e,t,n),yg(tc.height,i)}function MC(e,t,n){var i;return i=DC(e,t,n),yg(nc.width,i)}function kC(e){return!!ar(e).length}function OC(e,t,n){var i=ar(e),r;return r=tp(i,t,n),e.height-r.height+Zl.height}function DC(e,t,n){var i=ar(e),r;return r=tp(i,t,n),e.width-r.width+Ql.width}function tp(e,t,n){var i,r,o;for(i=0;i<e.length;i++)if(r=e[i],!n&&t>=r.y&&t<=r.y+r.height||n&&t>=r.x&&t<=r.x+r.width)return o=ar(r),o.length?tp(o,t,n):r}var _g="_plane";function bg(e){var t=e.id;return LC(t)}function gi(e){var t=e.id;return v(e,"bpmn:SubProcess")?xg(t):t}function jr(e){return xg(e)}function rc(e){var t=Ye(e);return v(t,"bpmndi:BPMNPlane")}function xg(e){return e+_g}function LC(e){return e.replace(new RegExp(_g+"$"),"")}var wg=400,IC=600,Eg={x:180,y:160};function Ii(e,t,n,i,r,o,a){X.call(this,t),this._canvas=e,this._eventBus=t,this._modeling=n,this._elementFactory=i,this._bpmnFactory=r,this._bpmnjs=o,this._elementRegistry=a;var s=this;function c(f){return v(f,"bpmn:SubProcess")&&!He(f)}function u(f){var p=f.shape,d=f.newRootElement,h=Z(p);d=s._addDiagram(d||h),f.newRootElement=e.addRootElement(d)}function l(f){var p=f.shape,d=Z(p);s._removeDiagram(d);var h=f.newRootElement=a.get(gi(d));e.removeRootElement(h)}this.executed("shape.create",function(f){var p=f.shape;c(p)&&u(f)},!0),this.postExecuted("elements.create",function(f){var p=f.elements;k(p,function(d){if(c(d)){var h=a.get(gi(d));if(!(!h||!d.children||!d.children.length)){var m=Sg(d);s._showRecursively(m),s._moveChildrenToShape(m,h)}}})},!0),this.reverted("shape.create",function(f){var p=f.shape;c(p)&&l(f)},!0),this.preExecute("shape.delete",function(f){var p=f.shape;!v(p,"bpmn:SubProcess")||!He(p)||k(oa([p]),d=>{n.removeShape(d.annotation)})},!0),this.preExecuted("shape.delete",function(f){var p=f.shape;if(c(p)){var d=a.get(gi(p));d&&n.removeElements(d.children.slice())}},!0),this.executed("shape.delete",function(f){var p=f.shape;c(p)&&l(f)},!0),this.reverted("shape.delete",function(f){var p=f.shape;c(p)&&u(f)},!0),this.preExecuted("shape.replace",function(f){var p=f.oldShape,d=f.newShape;!c(p)||!c(d)||(f.oldRoot=e.removeRootElement(gi(p)))},!0),this.postExecuted("shape.replace",function(f){var p=f.newShape,d=f.oldRoot,h=e.findRoot(gi(p));if(!(!d||!h)){var m=d.children;n.moveElements(m,{x:0,y:0},h)}},!0),this.executed("element.updateProperties",function(f){var p=f.element;if(v(p,"bpmn:SubProcess")){var d=f.properties,h=f.oldProperties,m=h.id,g=d.id;if(m!==g){if(rc(p)){a.updateId(p,jr(g)),a.updateId(m,g);return}var R=a.get(jr(m));R&&a.updateId(jr(m),jr(g))}}},!0),this.reverted("element.updateProperties",function(f){var p=f.element;if(v(p,"bpmn:SubProcess")){var d=f.properties,h=f.oldProperties,m=h.id,g=d.id;if(m!==g){if(rc(p)){a.updateId(p,jr(m)),a.updateId(g,m);return}var R=a.get(jr(g));R&&a.updateId(R,jr(m))}}},!0),t.on("element.changed",function(f){var p=f.element;if(rc(p)){var d=p,h=a.get(bg(d));!h||h===d||t.fire("element.changed",{element:h})}}),this.executed("shape.toggleCollapse",wg,function(f){var p=f.shape;v(p,"bpmn:SubProcess")&&(He(p)?l(f):(u(f),s._showRecursively(p.children)))},!0),this.reverted("shape.toggleCollapse",wg,function(f){var p=f.shape;v(p,"bpmn:SubProcess")&&(He(p)?l(f):(u(f),s._showRecursively(p.children)))},!0),this.postExecuted("shape.toggleCollapse",IC,function(f){var p=f.shape;if(v(p,"bpmn:SubProcess")){var d=f.newRootElement;if(d)if(He(p))s._moveChildrenToShape(d.children.slice(),p),k(oa(p.children),m=>{n.moveShape(m.annotation,{x:0,y:0},p.parent),k(m.associations,g=>{n.moveConnection(g,{x:0,y:0},p.parent)})});else{s._disconnectSharedAnnotations(p);var h=Sg(p);s._moveChildrenToShape(h,d)}}},!0),t.on("copyPaste.createTree",function(f){var p=f.element,d=f.children;if(c(p)){var h=gi(p),m=a.get(h);m&&d.push.apply(d,m.children)}}),t.on("copyPaste.copyElement",function(f){var p=f.descriptor,d=f.element,h=f.elements,m=d.parent,g=v(Ye(m),"bpmndi:BPMNPlane");if(g){var R=bg(m),E=ut(h,function(x){return x.id===R});E&&(p.parent=E.id)}}),t.on("copyPaste.pasteElement",function(f){var p=f.descriptor;p.parent&&(c(p.parent)||p.parent.hidden)&&(p.hidden=!0)})}ae(Ii,X),Ii.prototype._moveChildrenToShape=function(e,t){var n=this._modeling;if(e.length){var i=e.filter(function(c){return!c.hidden});if(!i.length){n.moveElements(e,{x:0,y:0},t,{autoResize:!1});return}var r=Mt(i),o;if(!t.x)o={x:Eg.x-r.x,y:Eg.y-r.y};else{var a=Ee(t),s=Ee(r);o={x:a.x-s.x,y:a.y-s.y}}n.moveElements(e,o,t,{autoResize:!1})}},Ii.prototype._disconnectSharedAnnotations=function(e){var t=this._modeling,n=new Set(hm(e).map(i=>i.annotation));n.size&&k(oa(e.children),i=>{n.has(i.annotation)&&k(i.associations,r=>{t.removeConnection(r)})})},Ii.prototype._showRecursively=function(e,t){var n=this,i=[];return e.forEach(function(r){r.hidden=!!t,i=i.concat(r),r.children&&(i=i.concat(n._showRecursively(r.children,r.collapsed||t)))}),i},Ii.prototype._addDiagram=function(e){var t=this._bpmnjs,n=t.getDefinitions().diagrams;return e.businessObject||(e=this._createNewDiagram(e)),n.push(e.di.$parent),e},Ii.prototype._createNewDiagram=function(e){var t=this._bpmnFactory,n=this._elementFactory,i=t.create("bpmndi:BPMNPlane",{bpmnElement:e}),r=t.create("bpmndi:BPMNDiagram",{plane:i});i.$parent=r;var o=n.createRoot({id:gi(e),type:e.$type,di:i,businessObject:e,collapsed:!0});return o},Ii.prototype._removeDiagram=function(e){var t=this._bpmnjs,n=t.getDefinitions().diagrams,i=ut(n,function(r){return r.plane.bpmnElement.id===e.id});return n.splice(n.indexOf(i),1),i},Ii.$inject=["canvas","eventBus","modeling","elementFactory","bpmnFactory","bpmnjs","elementRegistry"];function NC(e){var t=[];return k(oa(e),n=>{t.push(n.annotation),t.push.apply(t,n.associations)}),t}function Sg(e){return e.children.slice().concat(NC(e.children)).concat(BC(e))}function BC(e){return al(e.children||[]).reduce(function(t,n){return n.label&&n.label.parent!==e&&t.push(n.label),t},[])}function np(e,t){e.invoke(X,this),this.postExecuted("shape.replace",function(n){var i=n.context.oldShape,r=n.context.newShape;if(!(!v(r,"bpmn:SubProcess")||v(r,"bpmn:AdHocSubProcess")||!(v(i,"bpmn:Task")||v(i,"bpmn:CallActivity"))||!He(r))){var o=$C(r);t.createShape({type:"bpmn:StartEvent"},o,r)}})}np.$inject=["injector","modeling"],ae(np,X);function $C(e){return{x:e.x+e.width/6,y:e.y+e.height/2}}function ip(e,t){X.call(this,e),this.preExecute("connection.create",function(n){const{target:i}=n;v(i,"bpmn:TextAnnotation")&&(n.parent=i.parent)},!0),this.preExecute(["shape.create","shape.resize","elements.move"],function(n){const i=n.shapes||[n.shape];i.length===1&&v(i[0],"bpmn:TextAnnotation")&&(n.hints=n.hints||{},n.hints.autoResize=!1)},!0),this.preExecute("shape.resize",function(n){var i=n.context,r=i.shape,o=i.hints||{};if(!(!v(r,"bpmn:TextAnnotation")||o.autoResize)){var a=i.newBounds,s=t.getTextAnnotationBounds(a,jn(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}}})}ae(ip,X),ip.$inject=["eventBus","textRenderer"];function rp(e,t){X.call(this,e),this.postExecuted("shape.toggleCollapse",1500,function(n){var i=n.shape;if(He(i))return;var r=Jo(i);r.forEach(function(a){var s=a.incoming.slice(),c=a.outgoing.slice();k(s,function(u){o(u,!0)}),k(c,function(u){o(u,!1)})});function o(a,s){r.indexOf(a.source)!==-1&&r.indexOf(a.target)!==-1||v(a,"bpmn:Association")&&(v(a.source,"bpmn:TextAnnotation")||v(a.target,"bpmn:TextAnnotation"))||(s?t.reconnectEnd(a,i,Ee(i)):t.reconnectStart(a,i,Ee(i)))}},!0)}ae(rp,X),rp.$inject=["eventBus","modeling"];var op=500;function ap(e,t,n){X.call(this,e);function i(a){a.length&&a.forEach(function(s){s.type==="label"&&!s.businessObject.name&&(s.hidden=!0)})}function r(a,s){var c=a.children,u=s,l,f;return l=jC(c).concat([a]),f=Om(l),f?(u.width=Math.max(f.width,u.width),u.height=Math.max(f.height,u.height),u.x=f.x+(f.width-u.width)/2,u.y=f.y+(f.height-u.height)/2):(u.x=a.x+(a.width-u.width)/2,u.y=a.y+(a.height-u.height)/2),u}function o(a,s){return{x:a.x+(a.width-s.width)/2,y:a.y+(a.height-s.height)/2,width:s.width,height:s.height}}this.executed(["shape.toggleCollapse"],op,function(a){var s=a.context,c=s.shape;v(c,"bpmn:SubProcess")&&(c.collapsed?Ye(c).isExpanded=!1:(i(c.children),Ye(c).isExpanded=!0))}),this.reverted(["shape.toggleCollapse"],op,function(a){var s=a.context,c=s.shape;c.collapsed?Ye(c).isExpanded=!1:Ye(c).isExpanded=!0}),this.postExecuted(["shape.toggleCollapse"],op,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"})})}ae(ap,X),ap.$inject=["eventBus","elementFactory","modeling"];function jC(e){return e.filter(function(t){return!t.hidden})}function sp(e,t,n,i){t.invoke(X,this),this.preExecute("shape.delete",function(r){var o=r.context,a=o.shape,s=a.businessObject;De(a)||(v(a,"bpmn:Participant")&&He(a)&&n.ids.unclaim(s.processRef.id),i.unclaimId(s.id,s))}),this.preExecute("connection.delete",function(r){var o=r.context,a=o.connection,s=a.businessObject;i.unclaimId(s.id,s)}),this.preExecute("canvas.updateRoot",function(){var r=e.getRootElement(),o=r.businessObject;v(r,"bpmn:Collaboration")&&n.ids.unclaim(o.id)})}ae(sp,X),sp.$inject=["canvas","injector","moddle","modeling"];function cp(e,t){X.call(this,e),this.preExecute("connection.delete",function(n){var i=n.context,r=i.connection,o=r.source;FC(r,o)&&t.updateProperties(o,{default:null})})}ae(cp,X),cp.$inject=["eventBus","modeling"];function FC(e,t){if(!v(e,"bpmn:SequenceFlow"))return!1;var n=Z(t),i=Z(e);return n.get("default")===i}var HC=500,zC=5e3,Rg=["shape.create","shape.delete","shape.move","shape.resize"],Cg=[...Rg,"spaceTool","lane.add","lane.resize","lane.split","elements.create","elements.delete","elements.move"];function up(e,t){X.call(this,e);var n;function i(){return n=n||new GC,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(Cg,zC,function(){i()}),this.postExecuted(Cg,HC,function(){o()}),this.preExecute(Rg,function(a){var s=a.context,c=s.shape,u=r();!c||c.labelTarget||(v(c,"bpmn:Lane")&&u.addLane(c),v(c,"bpmn:FlowNode")&&u.addFlowNode(c))})}up.$inject=["eventBus","modeling"],ae(up,X);function GC(){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 VC=500,WC=5e3,Pg=["connection.create","connection.delete","connection.layout","connection.move","connection.reconnect","connection.updateWaypoints","shape.create","shape.delete","shape.move","shape.resize"],Ag=[...Pg,"elements.create","elements.delete","elements.move","label.create","spaceTool"];function lp(e,t){X.call(this,e);var n;function i(){return n=n||new UC,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(Ag,WC,function(){i()}),this.postExecuted(Ag,VC,function(){o()}),this.preExecute(Pg,function(a){var s=a.context.connection||a.context.shape,c=r();!s||s.labelTarget||(v(s,"bpmn:FlowElement")&&c.addFlowElement(s),v(s,"bpmn:Group")&&c.addGroup(s))}),this.preExecute("label.create",function(a){var s=a.context.labelTarget;v(s,"bpmn:Group")&&r().addGroup(s)})}lp.$inject=["eventBus","modeling"],ae(lp,X);function UC(){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 pp(e,t){X.call(this,e),this.postExecuted("elements.create",function(n){const i=n.context,r=i.elements;for(const o of r)YC(o)&&!KC(o)&&t.updateProperties(o,{isForCompensation:void 0})})}ae(pp,X),pp.$inject=["eventBus","modeling"];function YC(e){const t=Z(e);return t&&t.isForCompensation}function qC(e){return e&&v(e,"bpmn:BoundaryEvent")&&ho(e,"bpmn:CompensateEventDefinition")}function KC(e){return e.incoming.filter(n=>qC(n.source)).length>0}const XC={__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",_l],appendBehavior:["type",bl],associationBehavior:["type",wl],attachEventBehavior:["type",js],artifactBehavior:["type",xl],boundaryEventBehavior:["type",El],categoryRootElementReferenceBehavior:["type",Sl],compensateBoundaryEventBehaviour:["type",Rl],createBehavior:["type",Cl],createDataObjectBehavior:["type",Pl],createParticipantBehavior:["type",Ml],dataInputAssociationBehavior:["type",kl],dataStoreBehavior:["type",Ol],deleteLaneBehavior:["type",Dl],detachEventBehavior:["type",Ys],dropOnFlowBehavior:["type",Il],eventBasedGatewayBehavior:["type",Nl],fixHoverBehavior:["type",jm],groupBehavior:["type",Bl],importDockingFix:["type",Hm],isHorizontalFix:["type",jl],labelBehavior:["type",Hl],layoutConnectionBehavior:["type",zl],messageFlowBehavior:["type",Wl],nonInterruptingBehavior:["type",Ul],removeElementBehavior:["type",ql],removeEmbeddedLabelBoundsBehavior:["type",Yl],removeParticipantBehavior:["type",Kl],replaceConnectionBehavior:["type",Xl],replaceElementBehaviour:["type",ec],resizeBehavior:["type",lg],resizeLaneBehavior:["type",gg],rootElementReferenceBehavior:["type",ep],spaceToolBehavior:["type",vg],subProcessPlaneBehavior:["type",Ii],subProcessStartEventBehavior:["type",np],textAnnotationBehavior:["type",ip],toggleCollapseConnectionBehaviour:["type",rp],toggleElementCollapseBehaviour:["type",ap],unclaimIdBehavior:["type",sp],unsetDefaultFlowBehavior:["type",cp],updateFlowNodeRefsBehavior:["type",up],updateCategoryValueRefsBehavior:["type",lp],setCompensationActivityAfterPasteBehavior:["type",pp]};function fp(e){this._commandStack=e.get("commandStack",!1)}fp.$inject=["injector"],fp.prototype.allowed=function(e,t){var n=!0,i=this._commandStack;return i&&(n=i.canExecute(e,t)),n===void 0?!0:n};const yi={__init__:["rules"],rules:["type",fp]};function Un(e){X.call(this,e),this.init()}Un.$inject=["eventBus"],ae(Un,X),Un.prototype.addRule=function(e,t,n){var i=this;typeof e=="string"&&(e=[e]),e.forEach(function(r){i.canExecute(r,t,function(o,a,s){return n(o)},!0)})},Un.prototype.init=function(){};function Tg(e,t){var n=Qt(e,t,-15);return n!=="intersect"?n:null}function en(e){Un.call(this,e)}ae(en,Un),en.$inject=["eventBus"],en.prototype.init=function(){this.addRule("connection.start",function(e){var t=e.source;return ZC(t)}),this.addRule("connection.create",function(e){var t=e.source,n=e.target,i=e.hints||{},r=i.targetParent,o=i.targetAttach;if(o)return!1;r&&(n.parent=r);try{return ac(t,n)}finally{r&&(n.parent=null)}}),this.addRule("connection.reconnect",function(e){var t=e.connection,n=e.source,i=e.target;return ac(n,i,t)}),this.addRule("connection.updateWaypoints",function(e){return{type:e.connection.type}}),this.addRule("shape.resize",function(e){var t=e.shape,n=e.newBounds,i=e.direction;return zg(t,n,i)}),this.addRule("elements.create",function(e){var t=e.elements,n=e.position,i=e.target;return ot(i)&&!sc(t,i)?!1:Cr(t,function(r){return ot(r)?ac(r.source,r.target,r):r.host?ga(r,r.host,null,n):gp(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 Ng(a)&&!n.includes(a.host)})?!1:ga(n,t,null,i)||Fg(n,t,i)||Hg(n,t)||sc(n,t)}),this.addRule("shape.create",function(e){return gp(e.shape,e.target,e.source,e.position)}),this.addRule("shape.attach",function(e){return ga(e.shape,e.target,null,e.position)}),this.addRule("element.copy",function(e){var t=e.element,n=e.elements;return Yg(n,t)})},en.prototype.canConnectMessageFlow=Wg,en.prototype.canConnectSequenceFlow=Ug,en.prototype.canConnectDataAssociation=yp,en.prototype.canConnectAssociation=Gg,en.prototype.canConnectCompensationAssociation=Vg,en.prototype.canMove=Hg,en.prototype.canAttach=ga,en.prototype.canReplace=Fg,en.prototype.canDrop=So,en.prototype.canInsert=sc,en.prototype.canCreate=gp,en.prototype.canConnect=ac,en.prototype.canResize=zg,en.prototype.canCopy=Yg;function ZC(e){return dp(e)?null:Ie(e,["bpmn:FlowNode","bpmn:InteractionNode","bpmn:DataObjectReference","bpmn:DataStoreReference","bpmn:Group","bpmn:TextAnnotation"])}function dp(e){return!e||De(e)}function Mg(e){do{if(v(e,"bpmn:Process"))return Z(e);if(v(e,"bpmn:Participant"))return Z(e).processRef||Z(e)}while(e=e.parent)}function hp(e){return v(e,"bpmn:TextAnnotation")}function mp(e){return v(e,"bpmn:Group")&&!e.labelTarget}function kg(e){return v(e,"bpmn:BoundaryEvent")&&vi(e,"bpmn:CompensateEventDefinition")}function oc(e){return Z(e).isForCompensation}function QC(e,t){var n=Mg(e),i=Mg(t);return n===i}function JC(e){return v(e,"bpmn:InteractionNode")&&!v(e,"bpmn:BoundaryEvent")&&(!v(e,"bpmn:Event")||v(e,"bpmn:ThrowEvent")&&Lg(e,"bpmn:MessageEventDefinition"))}function eP(e){return v(e,"bpmn:InteractionNode")&&!oc(e)&&(!v(e,"bpmn:Event")||v(e,"bpmn:CatchEvent")&&Lg(e,"bpmn:MessageEventDefinition"))&&!(v(e,"bpmn:BoundaryEvent")&&!vi(e,"bpmn:MessageEventDefinition"))}function Og(e){for(var t=e;t=t.parent;){if(v(t,"bpmn:FlowElementsContainer"))return Z(t);if(v(t,"bpmn:Participant"))return Z(t).processRef}return null}function Dg(e,t){var n=Og(e),i=Og(t);return n===i}function vi(e,t){var n=Z(e);return!!ut(n.eventDefinitions||[],function(i){return v(i,t)})}function Lg(e,t){var n=Z(e);return(n.eventDefinitions||[]).every(function(i){return v(i,t)})}function tP(e){return v(e,"bpmn:FlowNode")&&!v(e,"bpmn:EndEvent")&&!ln(e)&&!(v(e,"bpmn:IntermediateThrowEvent")&&vi(e,"bpmn:LinkEventDefinition"))&&!kg(e)&&!oc(e)}function nP(e){return v(e,"bpmn:FlowNode")&&!v(e,"bpmn:StartEvent")&&!v(e,"bpmn:BoundaryEvent")&&!ln(e)&&!(v(e,"bpmn:IntermediateCatchEvent")&&vi(e,"bpmn:LinkEventDefinition"))&&!oc(e)}function iP(e){return v(e,"bpmn:ReceiveTask")||v(e,"bpmn:IntermediateCatchEvent")&&(vi(e,"bpmn:MessageEventDefinition")||vi(e,"bpmn:TimerEventDefinition")||vi(e,"bpmn:ConditionalEventDefinition")||vi(e,"bpmn:SignalEventDefinition"))}function rP(e){for(var t=[];e;)e=e.parent,e&&t.push(e);return t}function Ig(e,t){var n=rP(t);return n.indexOf(e)!==-1}function ac(e,t,n){if(dp(e)||dp(t))return null;if(!v(n,"bpmn:DataAssociation")){if(Wg(e,t))return{type:"bpmn:MessageFlow"};if(Ug(e,t))return{type:"bpmn:SequenceFlow"}}var i=yp(e,t);return i||(Vg(e,t)?{type:"bpmn:Association",associationDirection:"One"}:Gg(e,t)?{type:"bpmn:Association",associationDirection:"None"}:!1)}function So(e,t){return De(e)||mp(e)?!0:v(t,"bpmn:Participant")&&!He(t)?!1:v(e,"bpmn:Participant")?v(t,"bpmn:Process")||v(t,"bpmn:Collaboration"):Ie(e,["bpmn:DataInput","bpmn:DataOutput"])&&e.parent?t===e.parent:v(e,"bpmn:Lane")?v(t,"bpmn:Participant")||v(t,"bpmn:Lane"):v(e,"bpmn:BoundaryEvent")&&!oP(e)?!1:v(e,"bpmn:FlowElement")&&!v(e,"bpmn:DataStoreReference")?v(t,"bpmn:FlowElementsContainer")?He(t):Ie(t,["bpmn:Participant","bpmn:Lane"]):v(e,"bpmn:DataStoreReference")&&v(t,"bpmn:Collaboration")?Wi(Z(t).get("participants"),function(n){return!!n.get("processRef")}):Ie(e,["bpmn:Artifact","bpmn:DataAssociation","bpmn:DataStoreReference"])?Ie(t,["bpmn:Collaboration","bpmn:Lane","bpmn:Participant","bpmn:Process","bpmn:SubProcess"]):v(e,"bpmn:MessageFlow")?v(t,"bpmn:Collaboration")||e.source.parent==t||e.target.parent==t:!1}function oP(e){return Z(e).cancelActivity&&(Bg(e)||$g(e))}function Ng(e){return!De(e)&&v(e,"bpmn:BoundaryEvent")}function aP(e){return v(e,"bpmn:Lane")}function sP(e){return Ng(e)||v(e,"bpmn:IntermediateThrowEvent")&&Bg(e)?!0:v(e,"bpmn:IntermediateCatchEvent")&&$g(e)}function Bg(e){var t=Z(e);return t&&!(t.eventDefinitions&&t.eventDefinitions.length)}function $g(e){return jg(e,["bpmn:MessageEventDefinition","bpmn:TimerEventDefinition","bpmn:SignalEventDefinition","bpmn:ConditionalEventDefinition"])}function jg(e,t){return t.some(function(n){return vi(e,n)})}function cP(e){return v(e,"bpmn:ReceiveTask")&&ut(e.incoming,function(t){return v(t.source,"bpmn:EventBasedGateway")})}function ga(e,t,n,i){if(Array.isArray(e)||(e=[e]),e.length!==1)return!1;var r=e[0];return De(r)||!sP(r)||ln(t)||!v(t,"bpmn:Activity")||oc(t)||i&&!Tg(i,t)||cP(t)?!1:"attach"}function Fg(e,t,n){if(!t)return!1;var i={replacements:[]};return k(e,function(r){ln(t)||v(r,"bpmn:StartEvent")&&r.type!=="label"&&So(r,t)&&(yS(r)||i.replacements.push({oldElementId:r.id,newElementType:"bpmn:StartEvent"}),(vS(r)||_S(r)||bS(r))&&i.replacements.push({oldElementId:r.id,newElementType:"bpmn:StartEvent"}),jg(r,["bpmn:MessageEventDefinition","bpmn:TimerEventDefinition","bpmn:SignalEventDefinition","bpmn:ConditionalEventDefinition"])&&v(t,"bpmn:SubProcess")&&i.replacements.push({oldElementId:r.id,newElementType:"bpmn:StartEvent"})),v(t,"bpmn:Transaction")||vi(r,"bpmn:CancelEventDefinition")&&r.type!=="label"&&(v(r,"bpmn:EndEvent")&&So(r,t)&&i.replacements.push({oldElementId:r.id,newElementType:"bpmn:EndEvent"}),v(r,"bpmn:BoundaryEvent")&&ga(r,t,null,n)&&i.replacements.push({oldElementId:r.id,newElementType:"bpmn:BoundaryEvent"}))}),i.replacements.length?i:!1}function Hg(e,t){return Wi(e,aP)?!1:t===void 0?!0:t===null?!1:e.every(function(n){return So(n,t)})}function gp(e,t,n,i){return t?De(e)||mp(e)?!0:So(e,t)||sc(e,t):!1}function zg(e,t,n){return v(e,"bpmn:SubProcess")?He(e)&&(!t||t.width>=100&&t.height>=80):v(e,"bpmn:Lane")||v(e,"bpmn:Participant")?!0:hp(e)?n?n==="e"||n==="w":!0:mp(e)?!0:De(e)?n?n==="e"||n==="w":!0:!1}function uP(e,t){var n=hp(e),i=hp(t);return(n||i)&&n!==i}function Gg(e,t){return Ig(t,e)||Ig(e,t)?!1:uP(e,t)?!0:!!yp(e,t)}function Vg(e,t){return Dg(e,t)&&kg(e)&&v(t,"bpmn:Activity")&&!pP(t,e)&&!ln(t)}function Wg(e,t){return Kg(e)&&!Kg(t)?!1:JC(e)&&eP(t)&&!QC(e,t)}function Ug(e,t){return tP(e)&&nP(t)&&Dg(e,t)&&!(v(e,"bpmn:EventBasedGateway")&&!iP(t))}function yp(e,t){return Ie(e,["bpmn:DataObjectReference","bpmn:DataStoreReference"])&&Ie(t,["bpmn:Activity","bpmn:ThrowEvent"])?{type:"bpmn:DataInputAssociation"}:Ie(t,["bpmn:DataObjectReference","bpmn:DataStoreReference"])&&Ie(e,["bpmn:Activity","bpmn:CatchEvent"])?{type:"bpmn:DataOutputAssociation"}:!1}function sc(e,t,n){if(!t)return!1;if(Array.isArray(e)){if(e.length!==1)return!1;e=e[0]}return t.source===e||t.target===e?!1:Ie(t,["bpmn:SequenceFlow","bpmn:MessageFlow"])&&!De(t)&&v(e,"bpmn:FlowNode")&&!v(e,"bpmn:BoundaryEvent")&&So(e,t.parent)}function vp(e,t){return e&&t&&e.indexOf(t)!==-1}function Yg(e,t){return De(t)?!0:!(v(t,"bpmn:Lane")&&!vp(e,t.parent)||v(t,"bpmn:MessageFlow")&&!lP(e,t))}function lP(e,t){var n=qg(t.source),i=qg(t.target);return vp(e,n)&&vp(e,i)}function qg(e){for(;e;e=e.parent)if(v(e,"bpmn:Participant"))return e;return null}function Kg(e){return yo(e,"bpmn:Process")||yo(e,"bpmn:Collaboration")}function pP(e,t){return e.attachers.includes(t)}const fP={__depends__:[yi],__init__:["bpmnRules"],bpmnRules:["type",en]};var dP=2e3;function Xg(e,t){e.on("saveXML.start",dP,n);function n(){var i=t.getRootElements();k(i,function(r){var o=Ye(r),a,s;a=Jo([r]),a=Be(a,function(c){return c!==r&&!c.labelTarget}),s=an(a,Ye),o.set("planeElement",s)})}}Xg.$inject=["eventBus","canvas"];const hP={__init__:["bpmnDiOrdering"],bpmnDiOrdering:["type",Xg]};function cc(e){X.call(this,e);var t=this;this.preExecute(["shape.create","connection.create"],function(n){var i=n.context,r=i.shape||i.connection,o=i.parent,a=t.getOrdering(r,o);a&&(a.parent!==void 0&&(i.parent=a.parent),i.parentIndex=a.index)}),this.preExecute(["shape.move","connection.move"],function(n){var i=n.context,r=i.shape||i.connection,o=i.newParent||r.parent,a=t.getOrdering(r,o);a&&(a.parent!==void 0&&(i.newParent=a.parent),i.newParentIndex=a.index)})}cc.prototype.getOrdering=function(e,t){return null},ae(cc,X);function _p(e,t){cc.call(this,e);var n=[{type:"bpmn:SubProcess",order:{level:6}},{type:"bpmn:SequenceFlow",order:{level:9,containers:["bpmn:Participant","bpmn:FlowElementsContainer"]}},{type:"bpmn:DataAssociation",order:{level:9,containers:["bpmn:Collaboration","bpmn:FlowElementsContainer"]}},{type:"bpmn:TextAnnotation",order:{level:9}},{type:"bpmn:MessageFlow",order:{level:9,containers:["bpmn:Collaboration"]}},{type:"bpmn:Association",order:{level:6,containers:["bpmn:Participant","bpmn:FlowElementsContainer","bpmn:Collaboration"]}},{type:"bpmn:BoundaryEvent",order:{level:8}},{type:"bpmn:Group",order:{level:10,containers:["bpmn:Collaboration","bpmn:FlowElementsContainer"]}},{type:"bpmn:FlowElement",order:{level:5}},{type:"bpmn:Participant",order:{level:-2}},{type:"bpmn:Lane",order:{level:-1}}];function i(a){if(a.labelTarget)return{level:10};var s=ut(n,function(c){return Ie(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&&!Ie(u,c);)u=u.parent;if(!u)throw new Error(`no parent for <${a.id}> in <${s&&s.id}>`);return u}this.getOrdering=function(a,s){if(a.labelTarget||v(a,"bpmn:TextAnnotation"))return{parent:t.findRoot(s)||t.getRootElement(),index:-1};var c=r(a);c.containers&&(s=o(a,s,c.containers));var u=s.children.indexOf(a),l=Zf(s.children,function(f){return!a.labelTarget&&f.labelTarget?!1:c.level<r(f).level});return l!==-1&&u!==-1&&u<l&&(l-=1),{index:l,parent:s}}}_p.$inject=["eventBus","canvas"],ae(_p,cc);const mP={__init__:["bpmnOrderingProvider"],bpmnOrderingProvider:["type",_p]};function ya(){}ya.prototype.get=function(){return this._data},ya.prototype.set=function(e){this._data=e},ya.prototype.clear=function(){var e=this._data;return delete this._data,e},ya.prototype.isEmpty=function(){return!this._data};const gP={clipboard:["type",ya]};var Zg=1500;function Qg(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",Zg,function(s){o(s)})}),(function(){var a,s;t.on("element.hover",function(c){a=c.gfx,s=c.element}),t.on("element.hover",Zg,function(c){s&&t.fire("element.out",{element:s,gfx:a})}),t.on("element.out",function(){a=null,s=null})})(),this._findTargetGfx=function(a){var s,c;if(a instanceof MouseEvent)return s=$r(a),c=document.elementFromPoint(s.x,s.y),yP(c)}}Qg.$inject=["elementRegistry","eventBus","injector"];function yP(e){return Or(e,"svg, .djs-element",!0)}const vP={__init__:["hoverFix"],hoverFix:["type",Qg]};function _P(e){return!0}function uc(e){return cr(e)||SC(e)}var Jg=500;function ey(e,t,n){var i=this;function r(T,H,G){if(!s(T,H)){var $,V,de;G?V=t.getGraphics(G):($=H.delegateTarget||H.target,$&&(V=$,G=t.get(V))),!(!V||!G)&&(de=e.fire(T,{element:G,gfx:V,originalEvent:H}),de===!1&&(H.stopPropagation(),H.preventDefault()))}}var o={};function a(T){return o[T]}function s(T,H){var G=u[T]||cr;return!G(H)}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":_P,"element.mousedown":uc,"element.mouseup":uc,"element.click":uc,"element.dblclick":uc};function l(T,H,G){var $=c[T];if(!$)throw new Error("unmapped DOM event name <"+T+">");return r($,H,G)}var f="svg, .djs-element";function p(T,H,G,$){var V=o[G]=function(de){r(G,de)};$&&(u[G]=$),V.$delegate=An.bind(T,f,H,V)}function d(T,H,G){var $=a(G);$&&An.unbind(T,H,$.$delegate)}function h(T){k(c,function(H,G){p(T,G,H)})}function m(T){k(c,function(H,G){d(T,G,H)})}e.on("canvas.destroy",function(T){m(T.svg)}),e.on("canvas.init",function(T){h(T.svg)}),e.on(["shape.added","connection.added"],function(T){var H=T.element,G=T.gfx;e.fire("interactionEvents.createHit",{element:H,gfx:G})}),e.on(["shape.changed","connection.changed"],Jg,function(T){var H=T.element,G=T.gfx;e.fire("interactionEvents.updateHit",{element:H,gfx:G})}),e.on("interactionEvents.createHit",Jg,function(T){var H=T.element,G=T.gfx;i.createDefaultHit(H,G)}),e.on("interactionEvents.updateHit",function(T){var H=T.element,G=T.gfx;i.updateDefaultHit(H,G)});var g=S("djs-hit djs-hit-stroke"),R=S("djs-hit djs-hit-click-stroke"),E=S("djs-hit djs-hit-all"),x=S("djs-hit djs-hit-no-move"),w={all:E,"click-stroke":R,stroke:g,"no-move":x};function S(T,H){return H=I({stroke:"white",strokeWidth:15},H||{}),n.cls(T,["no-fill","no-border"],H)}function M(T,H){var G=w[H];if(!G)throw new Error("invalid hit type <"+H+">");return se(T,G),T}function N(T,H){Te(T,H)}this.removeHits=function(T){var H=bs(".djs-hit",T);k(H,zt)},this.createDefaultHit=function(T,H){var G=T.waypoints,$=T.isFrame,V;return G?this.createWaypointsHit(H,G):(V=$?"stroke":"all",this.createBoxHit(H,V,{width:T.width,height:T.height}))},this.createWaypointsHit=function(T,H){var G=Qo(H);return M(G,"stroke"),N(T,G),G},this.createBoxHit=function(T,H,G){G=I({x:0,y:0},G);var $=ve("rect");return M($,H),se($,G),N(T,$),$},this.updateDefaultHit=function(T,H){var G=nt(".djs-hit",H);if(G)return T.waypoints?ol(G,T.waypoints):se(G,{width:T.width,height:T.height}),G},this.fire=r,this.triggerMouseEvent=l,this.mouseHandler=a,this.registerEvent=p,this.unregisterEvent=d}ey.$inject=["eventBus","elementRegistry","styles"];const lc={__init__:["interactionEvents"],interactionEvents:["type",ey]};function Ro(e,t){this._eventBus=e,this._canvas=t,this._selectedElements=new Set;var n=this;e.on(["shape.remove","connection.remove"],function(i){var r=i.element;n.deselect(r)}),e.on(["diagram.clear","root.set"],function(i){n.select(null)})}Ro.$inject=["eventBus","canvas"],Ro.prototype.deselect=function(e){if(this._selectedElements.has(e)){var t=this.get();this._selectedElements.delete(e),this._eventBus.fire("selection.changed",{oldSelection:t,newSelection:this.get()})}},Ro.prototype.get=function(){return Array.from(this._selectedElements)},Ro.prototype.isSelected=function(e){return this._selectedElements.has(e)},Ro.prototype.select=function(e,t){var n=this.get();we(e)||(e=e?[e]:[]);var i=this._canvas,r=i.getRootElement();e=e.filter(function(o){var a=i.findRoot(o);return r===a}),t?k(e,o=>{this._selectedElements.add(o)}):this._selectedElements=new Set(e),this._eventBus.fire("selection.changed",{oldSelection:n,newSelection:this.get()})};var ty="hover",ny="selected";function iy(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,ty)}),t.on("element.out",function(r){i(r.element,ty)}),t.on("selection.changed",function(r){function o(u){i(u,ny)}function a(u){n(u,ny)}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)})}iy.$inject=["canvas","eventBus"];function ry(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;we(u)?t.select(u):t.select(s.filter(bP))}}),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=ut(o,function(c){return a.id===c.id});s||t.select(a)}),e.on("element.click",function(r){if(cr(r)){var o=r.element;o===n.getRootElement()&&(o=null);var a=t.isSelected(o),s=t.get().length>1,c=ic(r);if(a&&s)return c?t.deselect(o):t.select(o);a?t.deselect(o):t.select(o,c)}})}ry.$inject=["eventBus","selection","canvas","elementRegistry"];function bP(e){return!e.hidden}const Yn={__init__:["selectionVisuals","selectionBehavior"],__depends__:[lc],selection:["type",Ro],selectionVisuals:["type",iy],selectionBehavior:["type",ry]};var xP=/^djs-cursor-.*$/;function pc(e){var t=yt(document.body);t.removeMatching(xP),e&&t.add("djs-cursor-"+e)}function oy(){pc(null)}var wP=5e3;function ay(e,t){t=t||"element.click";function n(){return!1}return e.once(t,wP,n),function(){e.off(t,n)}}var EP=["c","C"],SP=["v","V"],RP=["d","D"],CP=["x","X"],PP=["y","Y"],sy=["z","Z"];function AP(e){return e.ctrlKey||e.metaKey||e.shiftKey||e.altKey}function kn(e){return e.altKey?!1:e.ctrlKey||e.metaKey}function Gt(e,t){return e=we(e)?e:[e],e.indexOf(t.key)!==-1||e.indexOf(t.code)!==-1}function bp(e){return e.shiftKey}function TP(e){return kn(e)&&Gt(EP,e)}function MP(e){return kn(e)&&Gt(SP,e)}function kP(e){return kn(e)&&Gt(RP,e)}function OP(e){return kn(e)&&Gt(CP,e)}function DP(e){return kn(e)&&!bp(e)&&Gt(sy,e)}function LP(e){return kn(e)&&(Gt(PP,e)||Gt(sy,e)&&bp(e))}var Co=Math.round,cy="djs-drag-active";function Fr(e){e.preventDefault()}function IP(e){return typeof TouchEvent<"u"&&e instanceof TouchEvent}function NP(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}function uy(e,t,n,i){var r={threshold:5,trapClick:!0},o;function a(x){var w=t.viewbox(),S=t._container.getBoundingClientRect();return{x:w.x+(x.x-S.left)/w.scale,y:w.y+(x.y-S.top)/w.scale}}function s(x,w){w=w||o;var S=e.createEvent(I({},w.payload,w.data,{isTouch:w.isTouch}));return e.fire("drag."+x,S)===!1?!1:e.fire(w.prefix+"."+x,S)}function c(x){var w=x.filter(function(S){return i.get(S.id)});w.length&&n.select(w)}function u(x,w){var S=o.payload,M=o.displacement,N=o.globalStart,T=$r(x),H=ii(T,N),G=o.localStart,$=a(T),V=ii($,G);if(!o.active&&(w||NP(H)>o.threshold)){if(I(S,{x:Co(G.x+M.x),y:Co(G.y+M.y),dx:0,dy:0},{originalEvent:x}),s("start")===!1)return g();o.active=!0,o.keepSelection||(S.previousSelection=n.get(),n.select(null)),o.cursor&&pc(o.cursor),t.addMarker(t.getRootElement(),cy)}Jl(x),o.active&&(I(S,{x:Co($.x+M.x),y:Co($.y+M.y),dx:Co(V.x),dy:Co(V.y)},{originalEvent:x}),s("move"))}function l(x){var w,S=!0;o.active&&(x&&(o.payload.originalEvent=x,Jl(x)),S=s("end")),S===!1&&s("rejected"),w=R(S!==!0),s("ended",w)}function f(x){Gt("Escape",x)&&(Fr(x),g())}function p(x){var w;o.active&&(w=ay(e),setTimeout(w,400),Fr(x)),l(x)}function d(x){u(x)}function h(x){var w=o.payload;w.hoverGfx=x.gfx,w.hover=x.element,s("hover")}function m(x){s("out");var w=o.payload;w.hoverGfx=null,w.hover=null}function g(x){var w;if(o){var S=o.active;S&&s("cancel"),w=R(x),S&&s("canceled",w)}}function R(x){var w,S;s("cleanup"),oy(),o.trapClick?S=p:S=l,Ae.unbind(document,"mousemove",u),Ae.unbind(document,"dragstart",Fr),Ae.unbind(document,"selectstart",Fr),Ae.unbind(document,"mousedown",S,!0),Ae.unbind(document,"mouseup",S,!0),Ae.unbind(document,"keyup",f),Ae.unbind(document,"touchstart",d,!0),Ae.unbind(document,"touchcancel",g,!0),Ae.unbind(document,"touchmove",u,!0),Ae.unbind(document,"touchend",l,!0),e.off("element.hover",h),e.off("element.out",m),t.removeMarker(t.getRootElement(),cy);var M=o.payload.previousSelection;return x!==!1&&M&&!n.get().length&&c(M),w=o,o=null,w}function E(x,w,S,M){o&&g(!1),typeof w=="string"&&(M=S,S=w,w=null),M=I({},r,M||{});var N=M.data||{},T,H,G,$,V;if(M.trapClick?$=p:$=l,x?(T=Eo(x)||x,H=$r(x),Jl(x),T.type==="dragstart"&&Fr(T)):(T=null,H={x:0,y:0}),G=a(H),w||(w=G),V=IP(T),o=I({prefix:S,data:N,payload:{},globalStart:H,displacement:ii(w,G),localStart:G,isTouch:V},M),M.manual||(V?(Ae.bind(document,"touchstart",d,!0),Ae.bind(document,"touchcancel",g,!0),Ae.bind(document,"touchmove",u,!0),Ae.bind(document,"touchend",l,!0)):(Ae.bind(document,"mousemove",u),Ae.bind(document,"dragstart",Fr),Ae.bind(document,"selectstart",Fr),Ae.bind(document,"mousedown",$,!0),Ae.bind(document,"mouseup",$,!0)),Ae.bind(document,"keyup",f),e.on("element.hover",h),e.on("element.out",m)),s("init")===!1)return g(),!1;M.autoActivate&&u(x,!0)}e.on("diagram.destroy",g),this.init=E,this.move=u,this.hover=h,this.out=m,this.end=l,this.cancel=g,this.context=function(){return o},this.setOptions=function(x){I(r,x)}}uy.$inject=["eventBus","canvas","selection","elementRegistry"];const Ni={__depends__:[vP,Yn],dragging:["type",uy]};function Po(e){this._counter=0,this._prefix=(e?e+"-":"")+Math.floor(Math.random()*1e9)+"-"}Po.prototype.next=function(){return this._prefix+ ++this._counter};const BP=new Po("ps");var $P=["marker-start","marker-mid","marker-end"],jP=["circle","ellipse","line","path","polygon","polyline","path","rect"];function ur(e,t,n,i){this._elementRegistry=e,this._canvas=n,this._styles=i}ur.$inject=["elementRegistry","eventBus","canvas","styles"],ur.prototype.cleanUp=function(){console.warn("PreviewSupport#cleanUp is deprecated and will be removed in future versions. You do not need to manually clean up previews anymore. cf. https://github.com/bpmn-io/diagram-js/pull/906")},ur.prototype.getGfx=function(e){return this._elementRegistry.getGraphics(e)},ur.prototype.addDragger=function(e,t,n,i="djs-dragger"){n=n||this.getGfx(e);var r=wh(n);return this._cloneMarkers(Ir(r),i),se(r,this._styles.cls(i,[])),Te(t,r),se(r,"data-preview-support-element-id",e.id),r},ur.prototype.addFrame=function(e,t){var n=ve("rect",{class:"djs-resize-overlay",width:e.width,height:e.height,x:e.x,y:e.y});return Te(t,n),se(n,"data-preview-support-element-id",e.id),n},ur.prototype._cloneMarkers=function(e,t="djs-dragger",n=e){var i=this;e.childNodes&&e.childNodes.forEach(r=>{i._cloneMarkers(r,t,n)}),GP(e)&&$P.forEach(function(r){if(se(e,r)){var o=FP(e,r,i._canvas.getContainer());o&&i._cloneMarker(n,e,o,r,t)}})},ur.prototype._cloneMarker=function(e,t,n,i,r="djs-dragger"){var o=[n.id,r,BP.next()].join("-"),a=nt("marker#"+n.id,e);e=e||this._canvas._svg;var s=a||wh(n);s.id=o,ze(s).add(r);var c=nt(":scope > defs",e);c||(c=ve("defs"),Te(e,c)),Te(c,s);var u=zP(s.id);se(t,i,u)};function FP(e,t,n){var i=HP(se(e,t));return nt("marker#"+i,n||document)}function HP(e){return e.match(/url\(['"]?#([^'"]*)['"]?\)/)[1]}function zP(e){return"url(#"+e+")"}function GP(e){return jP.indexOf(e.nodeName)!==-1}const Ao={__init__:["previewSupport"],previewSupport:["type",ur]};var VP="drop-ok",ly="drop-not-ok",py="attach-ok",fy="new-parent",dy="create",WP=2e3;function hy(e,t,n,i,r){function o(c,u,l,f,p){if(!u)return!1;c=Be(c,function(E){var x=E.labelTarget;return!E.parent&&!(De(E)&&c.indexOf(x)!==-1)});var d=ut(c,function(E){return!ot(E)}),h=!1,m=!1,g=!1;gy(c)&&(h=r.allowed("shape.attach",{position:l,shape:d,target:u})),h||(gy(c)?g=r.allowed("shape.create",{position:l,shape:d,source:f,target:u}):g=r.allowed("elements.create",{elements:c,position:l,target:u}));var R=p.connectionTarget;return g||h?(d&&f&&(m=r.allowed("connection.create",{source:R===f?d:f,target:R===f?f:d,hints:{targetParent:u,targetAttach:h}})),{attach:h,connect:m}):g===null||h===null?null:!1}function a(c,u){[py,VP,ly,fy].forEach(function(l){l===u?e.addMarker(c,l):e.removeMarker(c,l)})}n.on(["create.move","create.hover"],function(c){var u=c.context,l=u.elements,f=c.hover,p=u.source,d=u.hints||{};if(!f){u.canExecute=!1,u.target=null;return}my(c);var h={x:c.x,y:c.y},m=u.canExecute=f&&o(l,f,h,p,d);f&&m!==null&&(u.target=f,m&&m.attach?a(f,py):a(f,m?fy:ly))}),n.on(["create.end","create.out","create.cleanup"],function(c){var u=c.hover;u&&a(u,null)}),n.on("create.end",function(c){var u=c.context,l=u.source,f=u.shape,p=u.elements,d=u.target,h=u.canExecute,m=h&&h.attach,g=h&&h.connect,R=u.hints||{};if(h===!1||!d)return!1;my(c);var E={x:c.x,y:c.y};g?f=i.appendShape(l,f,E,d,{attach:m,connection:g===!0?{}:g,connectionTarget:R.connectionTarget}):(p=i.createElements(p,E,d,I({},R,{attach:m})),f=ut(p,function(x){return!ot(x)})),I(u,{elements:p,shape:f}),I(c,{elements:p,shape:f})});function s(){var c=t.context();c&&c.prefix===dy&&t.cancel()}n.on("create.init",function(){n.on("elements.changed",s),n.once(["create.cancel","create.end"],WP,function(){n.off("elements.changed",s)})}),this.start=function(c,u,l){we(u)||(u=[u]);var f=ut(u,function(h){return!ot(h)});if(f){l=I({elements:u,hints:{},shape:f},l||{}),k(u,function(h){Pe(h.x)||(h.x=0),Pe(h.y)||(h.y=0)});var p=Be(u,function(h){return!h.hidden}),d=Mt(p);k(u,function(h){ot(h)&&(h.waypoints=an(h.waypoints,function(m){return{x:m.x-d.x-d.width/2,y:m.y-d.y-d.height/2}})),I(h,{x:h.x-d.x-d.width/2,y:h.y-d.y-d.height/2})}),t.init(c,dy,{cursor:"grabbing",autoActivate:!0,data:{shape:f,elements:u,context:l}})}}}hy.$inject=["canvas","dragging","eventBus","modeling","rules"];function my(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 gy(e){return e&&e.length===1&&!ot(e[0])}var UP=750;function yy(e,t,n,i,r){function o(a){var s=ve("g");se(s,r.cls("djs-drag-group",["no-events"]));var c=ve("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),Jt(l,u.x,u.y)),i.addDragger(u,s,l))}),s}t.on("create.move",UP,function(a){var s=a.hover,c=a.context,u=c.elements,l=c.dragGroup;l||(l=c.dragGroup=o(u));var f;s?(l.parentNode||(f=e.getActiveLayer(),Te(f,l)),Jt(l,a.x,a.y)):zt(l)}),t.on("create.cleanup",function(a){var s=a.context,c=s.dragGroup;c&&zt(c)})}yy.$inject=["canvas","eventBus","graphicsFactory","previewSupport","styles"];const fc={__depends__:[Ni,Ao,yi,Yn],__init__:["create","createPreview"],create:["type",hy],createPreview:["type",yy]};function xp(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)})}xp.$inject=["eventBus"],xp.prototype.getLastMoveEvent=function(){return this._lastMoveEvent||YP(0,0)};function YP(e,t){var n=document.createEvent("MouseEvent"),i=e,r=t,o=e,a=t;return n.initMouseEvent&&n.initMouseEvent("mousemove",!0,!0,window,0,i,r,o,a,!1,!1,!1,!1,0,null),n}const va={__init__:["mouse"],mouse:["type",xp]};var vy=2e3;function On(e,t,n,i,r,o,a,s){this._canvas=e,this._create=t,this._elementFactory=i,this._eventBus=r,this._modeling=o,this._mouse=a,this._rules=s,r.on("copyPaste.copyElement",function(c){var u=c.descriptor,l=c.element,f=c.elementsSet;u.priority=1,u.id=l.id,f.has(l.parent)&&(u.parent=l.parent.id),qP(l)&&(u.priority=2,u.host=l.host.id),ot(l)&&(u.priority=3,u.source=l.source.id,u.target=l.target.id,u.waypoints=KP(l)),De(l)&&(u.priority=4,u.labelTarget=l.labelTarget.id),k(["x","y","width","height"],function(p){Pe(l[p])&&(u[p]=l[p])}),u.hidden=l.hidden,u.collapsed=l.collapsed}),r.on("copyPaste.elementsCopied",vy,function(c){var u;((u=c.hints)==null?void 0:u.clip)!==!1&&n.set(c.tree)}),r.on("copyPaste.pasteElements",vy,function(c){c.tree||(c.tree=n.get())}),r.on("copyPaste.pasteElements",function(c){var u=c.hints;I(u,{createElementsBehavior:!1})})}On.$inject=["canvas","create","clipboard","elementFactory","eventBus","modeling","mouse","rules"],On.prototype.copy=function(e,t={}){var n,i;return we(e)||(e=e?[e]:[]),n=this._eventBus.fire("copyPaste.canCopyElements",{elements:e}),n===!1?i={}:i=this.createTree(we(n)?n:e),this._eventBus.fire("copyPaste.elementsCopied",{elements:e,tree:i,hints:t}),i},On.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})}}},On.prototype.duplicate=function(e,t={}){var n=this.copy(e,{clip:!1});return this.paste({...t,tree:n})},On.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},On.prototype._getElementIdsFromTree=function(e){var t={};return k(e,function(n){k(n,function(i){i.id&&(t[i.id]=!0)})}),t},On.prototype._paste=function(e,t,n,i){k(e,function(o){Pe(o.x)||(o.x=0),Pe(o.y)||(o.y=0)});var r=Mt(e);return k(e,function(o){ot(o)&&(o.waypoints=an(o.waypoints,function(a){return{x:a.x-r.x-r.width/2,y:a.y-r.y-r.height/2}})),I(o,{x:o.x-r.x-r.width/2,y:o.y-r.y-r.height/2})}),this._modeling.createElements(e,n,t,I({},i))},On.prototype._createElements=function(e){var t=this,n=this._eventBus,i={},r=[];return k(e,function(o,a){o=oi(o,"priority"),k(o,function(s){var c=I({},ai(s,["priority"]));i[s.parent]?c.parent=i[s.parent]:delete c.parent,n.fire("copyPaste.pasteElement",{cache:i,descriptor:c});var u;if(ot(c)){c.source=i[s.source],c.target=i[s.target],u=i[s.id]=t.createConnection(c),r.push(u);return}if(De(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},On.prototype.createConnection=function(e){var t=this._elementFactory.createConnection(ai(e,["id"]));return t},On.prototype.createLabel=function(e){var t=this._elementFactory.createLabel(ai(e,["id"]));return t},On.prototype.createShape=function(e){var t=this._elementFactory.createShape(ai(e,["id"]));return t},On.prototype.hasRelations=function(e,t,n){return n||(n=new Set(t)),!(ot(e)&&(!n.has(e.source)||!n.has(e.target))||De(e)&&!n.has(e.labelTarget))},On.prototype.createTree=function(e){var t=this._rules,n=this,i={},r=[],o=new Map,a=Ss(e);function s(f,p){return t.allowed("element.copy",{element:f,elements:p})}function c(f,p){var d=o.get(f);if(!d){var h={element:f,depth:p};r.push(h),o.set(f,h);return}if(d.depth<p){r=u(d,r);var m={element:d.element,depth:p};r.push(m),o.set(f,m)}}function u(f,p){var d=p.indexOf(f);return d!==-1&&p.splice(d,1),p}Lr(a,function(f,p,d){if(De(f))return;k(f.labels,function(g){c(g,d)});function h(g){g&&g.length&&k(g,function(R){k(R.labels,function(E){c(E,d)}),c(R,d)})}k([f.attachers,f.incoming,f.outgoing],h),c(f,d);var m=[];return f.children&&(m=f.children.slice()),n._eventBus.fire("copyPaste.createTree",{element:f,children:m}),m}),e=an(r,function(f){return f.element});var l=new Set(e);return r=an(r,function(f){return f.descriptor={},n._eventBus.fire("copyPaste.copyElement",{descriptor:f.descriptor,element:f.element,elements:e,elementsSet:l}),f}),r=oi(r,function(f){return f.descriptor.priority}),e=an(r,function(f){return f.element}),k(r,function(f){var p=f.depth;if(!n.hasRelations(f.element,e,l)){by(f.element,e),l.delete(f.element);return}if(!s(f.element,e)){by(f.element,e),l.delete(f.element);return}i[p]||(i[p]=[]),i[p].push(f.descriptor)}),i};function qP(e){return!!e.host}function KP(e){return an(e.waypoints,function(t){return t=_y(t),t.original&&(t.original=_y(t.original)),t})}function _y(e){return I({},e)}function by(e,t){var n=t.indexOf(e);return n===-1?t:t.splice(n,1)}const XP={__depends__:[gP,fc,va,yi],__init__:["copyPaste"],copyPaste:["type",On]};function wp(e,t,n){we(n)||(n=[n]),k(n,function(i){Rr(e[i])||(t[i]=e[i])})}var Ep=750;function xy(e,t,n){function i(c,u){var l=e.create(c.$type);return n.copyElement(c,l,null,u)}t.on("copyPaste.copyElement",Ep,function(c){var u=c.descriptor,l=c.element,f=Z(l);if(De(l))return u;var p=u.businessObject=i(f,!0),d=u.di=i(Ye(l),!0);d.bpmnElement=p,wp(p,u,"name"),wp(d,u,"isExpanded"),f.default&&(u.default=f.default.id)});var r="-bpmn-js-refs";function o(c){return c[r]=c[r]||{}}function a(c,u){c[r]=u}function s(c,u,l){var f=Z(c);return c.default&&(l[c.default]={element:f,property:"default"}),c.host&&(Z(c).attachedToRef=Z(u[c.host])),ai(l,Cn(l,function(p,d,h){var m=d.element,g=d.property;return h===c.id&&(m.set(g,f),p.push(c.id)),p},[]))}t.on("copyPaste.pasteElement",function(c){var u=c.cache,l=c.descriptor,f=l.businessObject,p=l.di;if(De(l)){l.businessObject=Z(u[l.labelTarget]),l.di=Ye(u[l.labelTarget]);return}f=l.businessObject=i(f),p=l.di=i(p),p.bpmnElement=f,wp(l,f,["isExpanded","name"]),l.type=f.$type}),t.on("copyPaste.copyElement",Ep,function(c){var u=c.descriptor,l=c.element;if(v(l,"bpmn:Participant")){var f=Z(l);f.processRef&&(u.processRef=i(f.processRef,!0))}}),t.on("copyPaste.pasteElement",function(c){var u=c.descriptor,l=u.processRef;l&&(u.processRef=i(l))}),t.on("copyPaste.createTree",function(c){var u=c.element,l=c.children;v(u,"bpmn:SubProcess")&&k(oa(l),f=>{l.push(f.annotation)})}),t.on("copyPaste.pasteElement",Ep,function(c){var u=c.cache,l=c.descriptor;a(u,s(l,u,o(u)))})}xy.$inject=["bpmnFactory","eventBus","moddleCopy"];const ZP=["artifacts","dataInputAssociations","dataOutputAssociations","default","flowElements","lanes","incoming","outgoing","categoryValue"],QP=["errorRef","escalationRef","messageRef","signalRef","dataObjectRef"];function _a(e,t,n){this._bpmnFactory=t,this._eventBus=e,this._moddle=n,e.on("moddleCopy.canCopyProperties",i=>{const{propertyNames:r}=i;if(!(!r||!r.length))return oi(r,o=>o==="extensionElements")}),e.on("moddleCopy.canCopyProperty",i=>{const{parent:r,property:o,propertyName:a}=i,s=Ut(r)&&r.$descriptor;if(a&&QP.includes(a))return o;if(a&&ZP.includes(a)||a&&s&&!ut(s.properties,no({name:a})))return!1}),e.on("moddleCopy.canSetCopiedProperty",i=>{const{property:r}=i;if(v(r,"bpmn:ExtensionElements")&&(!r.values||!r.values.length))return!1})}_a.$inject=["eventBus","bpmnFactory","moddle"],_a.prototype.copyElement=function(e,t,n,i=!1){n&&!we(n)&&(n=[n]),n=n||Sp(e.$descriptor);const r=this._eventBus.fire("moddleCopy.canCopyProperties",{propertyNames:n,sourceElement:e,targetElement:t,clone:i});return r===!1||(we(r)&&(n=r),k(n,o=>{let a;Rn(e,o)&&(a=e.get(o));const s=this.copyProperty(a,t,o,i);!Ft(s)||this._eventBus.fire("moddleCopy.canSetCopiedProperty",{parent:t,property:s,propertyName:o})===!1||t.set(o,s)})),t},_a.prototype.copyProperty=function(e,t,n,i=!1){let r=this._eventBus.fire("moddleCopy.canCopyProperty",{parent:t,property:e,propertyName:n,clone:i});if(r===!1)return;if(r)return Ut(r)&&r.$type&&!r.$parent&&(r.$parent=t),r;const o=this._moddle.getPropertyDescriptor(t,n);if(!o.isReference)return o.isId?e&&this._copyId(e,t,i):we(e)?Cn(e,(a,s)=>{const c=this.copyProperty(s,t,n,i);return c?a.concat(c):a},[]):Ut(e)&&e.$type?this._moddle.getElementDescriptor(e).isGeneric?void 0:(r=this._bpmnFactory.create(e.$type),r.$parent=t,r=this.copyElement(e,r,null,i),r):e},_a.prototype._copyId=function(e,t,n=!1){if(n)return e;if(!this._moddle.ids.assigned(e))return this._moddle.ids.claim(e,t),e};function Sp(e,t){return Cn(e.properties,(n,i)=>t&&i.default?n:n.concat(i.name),[])}const wy={__depends__:[XP],__init__:["bpmnCopyPaste","moddleCopy"],bpmnCopyPaste:["type",xy],moddleCopy:["type",_a]};var Ey=Math.round;function Rp(e,t){this._modeling=e,this._eventBus=t}Rp.$inject=["modeling","eventBus"],Rp.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=Ey(s+o/2),l=Ey(c+a/2),f=i.replaceShape(e,I({},t,{x:u,y:l,width:o,height:a}),n);return r.fire("replace.end",{element:e,newElement:f,hints:n}),f};function Sy(e,t){t.on("replace.end",500,function(n){const{newElement:i,hints:r={}}=n;r.select!==!1&&e.select(i)})}Sy.$inject=["selection","eventBus"];const JP={__init__:["replace","replaceSelectionBehavior"],replaceSelectionBehavior:["type",Sy],replace:["type",Rp]};function eA(e,t,n){we(n)||(n=[n]),k(n,function(i){Rr(e[i])||(t[i]=e[i])})}var tA=["cancelActivity","instantiate","eventGatewayType","triggeredByEvent","isInterrupting"];function nA(e,t){var n=e&&Rn(e,"collapsed")?e.collapsed:!He(e),i;return t&&(Rn(t,"collapsed")||Rn(t,"isExpanded"))?i=Rn(t,"collapsed")?t.collapsed:!t.isExpanded:i=n,n!==i}function Ry(e,t,n,i,r,o){function a(s,c,u){u=u||{};var l=c.type,f=s.businessObject;if(dc(f)&&(l==="bpmn:SubProcess"||l==="bpmn:AdHocSubProcess")&&nA(s,c))return i.toggleCollapse(s),s;var p=e.create(l),d={type:l,businessObject:p};d.di={},l==="bpmn:ExclusiveGateway"&&(d.di.isMarkerVisible=!0),eA(s.di,d.di,["fill","stroke","background-color","border-color","color"]);var h=Sp(f.$descriptor),m=Sp(p.$descriptor,!0),g=iA(h,m);I(p,ni(c,tA));var R=Be(g,function(w){return w==="eventDefinitions"?Cy(s,c.eventDefinitionType):w==="loopCharacteristics"?!ln(p):Rn(p,w)||w==="processRef"&&c.isExpanded===!1||w==="triggeredByEvent"?!1:w==="isForCompensation"?!ln(p):!0});if(p=n.copyElement(f,p,R),c.eventDefinitionType&&(Cy(p,c.eventDefinitionType)||(d.eventDefinitionType=c.eventDefinitionType,d.eventDefinitionAttrs=c.eventDefinitionAttrs)),v(f,"bpmn:Activity")){if(dc(f))d.isExpanded=He(s);else if(c&&Rn(c,"isExpanded")){d.isExpanded=c.isExpanded;var E=t.getDefaultSize(p,{isExpanded:d.isExpanded});d.width=E.width,d.height=E.height,d.x=s.x-(d.width-s.width)/2,d.y=s.y-(d.height-s.height)/2}He(s)&&!v(f,"bpmn:Task")&&d.isExpanded&&(d.width=s.width,d.height=s.height)}if(dc(f)&&!dc(p)&&(u.moveChildren=!1),v(f,"bpmn:Participant")){c.isExpanded===!0?p.processRef=e.create("bpmn:Process"):u.moveChildren=!1;var x=qt(s);Ye(s).isHorizontal||(Ye(d).isHorizontal=x),d.width=x?s.width:t.getDefaultSize(d).width,d.height=x?t.getDefaultSize(d).height:s.height}return o.allowed("shape.resize",{shape:p})||(d.height=t.getDefaultSize(d).height,d.width=t.getDefaultSize(d).width),p.name=f.name,Ie(f,["bpmn:ExclusiveGateway","bpmn:InclusiveGateway","bpmn:Activity"])&&Ie(p,["bpmn:ExclusiveGateway","bpmn:InclusiveGateway","bpmn:Activity"])&&(p.default=f.default),c.host&&!v(f,"bpmn:BoundaryEvent")&&v(p,"bpmn:BoundaryEvent")&&(d.host=c.host),(d.type==="bpmn:DataStoreReference"||d.type==="bpmn:DataObjectReference")&&(d.x=s.x+(s.width-d.width)/2),r.replaceElement(s,d,{...u,targetElement:c})}this.replaceElement=a}Ry.$inject=["bpmnFactory","elementFactory","moddleCopy","modeling","replace","rules"];function dc(e){return v(e,"bpmn:SubProcess")}function Cy(e,t){var n=Z(e);return t&&n.get("eventDefinitions").some(function(i){return v(i,t)})}function iA(e,t){return e.filter(function(n){return t.includes(n)})}const Py={__depends__:[wy,JP,Yn],bpmnReplace:["type",Ry]};var rA=250;function Hr(e){this._eventBus=e,this._tools=[],this._active=null}Hr.$inject=["eventBus"],Hr.prototype.registerTool=function(e,t){var n=this._tools;if(!t)throw new Error(`A tool has to be registered with it's "events"`);n.push(e),this.bindEvents(e,t)},Hr.prototype.isActive=function(e){return e&&this._active===e},Hr.prototype.length=function(e){return this._tools.length},Hr.prototype.setActive=function(e){var t=this._eventBus;this._active!==e&&(this._active=e,t.fire("tool-manager.update",{tool:e}))},Hr.prototype.bindEvents=function(e,t){var n=this._eventBus,i=[];n.on(t.tool+".init",function(r){var o=r.context;if(!o.reactivate&&this.isActive(e)){this.setActive(null);return}this.setActive(e)},this),k(t,function(r){i.push(r+".ended"),i.push(r+".canceled")}),n.on(i,rA,function(r){this._active&&(oA(r)||this.setActive(null))},this)};function oA(e){var t=e.originalEvent&&e.originalEvent.target;return t&&Or(t,'.group[data-group="tools"]')}const hc={__depends__:[Ni],__init__:["toolManager"],toolManager:["type",Hr]};function aA(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 sA(e,t){var n=[],i=new Set(e);k(t,function(o){i.add(o)});var r=new Set;return i.forEach(function(o){var a=o.incoming,s=o.outgoing;k(a.concat(s),function(c){var u=c.source,l=c.target;(i.has(u)||i.has(l))&&(r.has(c)||(r.add(c),n.push(c)))})}),n}function cA(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 Cp=Math.abs,uA=Math.round,Bi={x:"width",y:"height"},Ay="crosshair",lr={n:"top",w:"left",s:"bottom",e:"right"},lA=1500,mc={n:"s",w:"e",s:"n",e:"w"},gc=20;function qn(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",lA,function(c){var u=c.context,l=u.initialized;l||(l=u.initialized=s.init(c,u)),l&&My(c)}),n.on("spaceTool.end",function(c){var u=c.context,l=u.axis,f=u.direction,p=u.movingShapes,d=u.resizingShapes,h=u.start;if(u.initialized){My(c);var m={x:0,y:0};m[l]=uA(c["d"+l]),s.makeSpace(p,d,m,f,h),n.once("spaceTool.ended",function(g){s.activateSelection(g.originalEvent,!0,!0)})}})}qn.$inject=["canvas","dragging","eventBus","modeling","rules","toolManager","mouse"],qn.prototype.activateSelection=function(e,t,n){this._dragging.init(e,"spaceTool.selection",{autoActivate:t,cursor:Ay,data:{context:{reactivate:n}},trapClick:!1})},qn.prototype.activateMakeSpace=function(e){this._dragging.init(e,"spaceTool",{autoActivate:!0,cursor:Ay,data:{context:{}}})},qn.prototype.makeSpace=function(e,t,n,i,r){return this._modeling.createSpace(e,t,n,i,r)},qn.prototype.init=function(e,t){var n=Cp(e.dx)>Cp(e.dy)?"x":"y",i=e["d"+n],r=e[n]-i;if(Cp(i)<5)return!1;i<0&&(i*=-1),ma(e)&&(i*=-1);var o=aA(n,i),a=this._canvas.getRootElement();!ic(e)&&e.hover&&(a=e.hover);var s=[...Jo(a),...a.attachers||[]],c=this.calculateAdjustments(s,n,i,r),u=this._eventBus.fire("spaceTool.getMinDimensions",{axis:n,direction:o,shapes:c.resizingShapes,start:r}),l=pA(c,n,o,r,u);return I(t,c,{axis:n,direction:o,spaceToolConstraints:l,start:r}),pc("resize-"+(n==="x"?"ew":"ns")),!0},qn.prototype.calculateAdjustments=function(e,t,n,i){var r=this._rules,o=[],a=[],s=new Set,c=new Set,u=[],l=[];function f(d){s.has(d)||(s.add(d),o.push(d));var h=d.label;h&&!s.has(h)&&(s.add(h),o.push(h))}function p(d){c.has(d)||(c.add(d),a.push(d))}return k(e,function(d){if(!(!d.parent||De(d))){if(ot(d)){l.push(d);return}var h=d[t],m=h+d[Bi[t]];if(fA(d)&&(n>0&&Ee(d)[t]>i||n<0&&Ee(d)[t]<i)){u.push(d);return}if(n>0&&h>i||n<0&&m<i){f(d);return}if(h<i&&m>i&&r.allowed("shape.resize",{shape:d})){p(d);return}}}),k(o,function(d){var h=d.attachers;h&&k(h,function(m){f(m)})}),k(u,function(d){var h=d.host;(s.has(h)||c.has(h))&&f(d)}),k(l,function(d){var h=d.source,m=d.target,g=d.label;(s.has(h)||c.has(h))&&(s.has(m)||c.has(m))&&g&&f(g)}),{movingShapes:o,resizingShapes:a}},qn.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateSelection(e,!!e)},qn.prototype.isActive=function(){var e=this._dragging.context();return e?/^spaceTool/.test(e.prefix):!1};function Ty(e){return{top:e.top-gc,right:e.right+gc,bottom:e.bottom+gc,left:e.left-gc}}function My(e){var t=e.context,n=t.spaceToolConstraints;if(n){var i,r;Pe(n.left)&&(i=Math.max(e.x,n.left),e.dx=e.dx+i-e.x,e.x=i),Pe(n.right)&&(i=Math.min(e.x,n.right),e.dx=e.dx+i-e.x,e.x=i),Pe(n.top)&&(r=Math.max(e.y,n.top),e.dy=e.dy+r-e.y,e.y=r),Pe(n.bottom)&&(r=Math.min(e.y,n.bottom),e.dy=e.dy+r-e.y,e.y=r)}}function pA(e,t,n,i,r){var o=e.movingShapes,a=e.resizingShapes;if(a.length){var s={},c,u,l=new Set(o),f=new Set(a);return k(a,function(p){var d=p.attachers,h=p.children,m=be(p),g=Be(h,function(V){return!ot(V)&&!De(V)&&!l.has(V)&&!f.has(V)}),R=Be(h,function(V){return!ot(V)&&!De(V)&&l.has(V)}),E,x,w,S=[],M=[],N,T,H,G;g.length&&(x=Ty(be(Mt(g))),E=i-m[lr[n]]+x[lr[n]],n==="n"?s.bottom=u=Pe(u)?Math.min(u,E):E:n==="w"?s.right=u=Pe(u)?Math.min(u,E):E:n==="s"?s.top=c=Pe(c)?Math.max(c,E):E:n==="e"&&(s.left=c=Pe(c)?Math.max(c,E):E)),R.length&&(w=Ty(be(Mt(R))),E=i-w[lr[mc[n]]]+m[lr[mc[n]]],n==="n"?s.bottom=u=Pe(u)?Math.min(u,E):E:n==="w"?s.right=u=Pe(u)?Math.min(u,E):E:n==="s"?s.top=c=Pe(c)?Math.max(c,E):E:n==="e"&&(s.left=c=Pe(c)?Math.max(c,E):E)),d&&d.length&&(d.forEach(function(V){l.has(V)?S.push(V):M.push(V)}),S.length&&(N=be(Mt(S.map(Ee))),T=m[lr[mc[n]]]-(N[lr[mc[n]]]-i)),M.length&&(H=be(Mt(M.map(Ee))),G=H[lr[n]]-(m[lr[n]]-i)),n==="n"?(E=Math.min(T||1/0,G||1/0),s.bottom=u=Pe(u)?Math.min(u,E):E):n==="w"?(E=Math.min(T||1/0,G||1/0),s.right=u=Pe(u)?Math.min(u,E):E):n==="s"?(E=Math.max(T||-1/0,G||-1/0),s.top=c=Pe(c)?Math.max(c,E):E):n==="e"&&(E=Math.max(T||-1/0,G||-1/0),s.left=c=Pe(c)?Math.max(c,E):E));var $=r&&r[p.id];$&&(n==="n"?(E=i+p[Bi[t]]-$[Bi[t]],s.bottom=u=Pe(u)?Math.min(u,E):E):n==="w"?(E=i+p[Bi[t]]-$[Bi[t]],s.right=u=Pe(u)?Math.min(u,E):E):n==="s"?(E=i-p[Bi[t]]+$[Bi[t]],s.top=c=Pe(c)?Math.max(c,E):E):n==="e"&&(E=i-p[Bi[t]]+$[Bi[t]],s.left=c=Pe(c)?Math.max(c,E):E))}),s}}function fA(e){return!!e.host}var Pp="djs-dragging",ky="djs-resizing",dA=250,yc=Math.max;function Oy(e,t,n,i,r){function o(a,s){k(a,function(c){r.addDragger(c,s),n.addMarker(c,Pp)})}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=ve("g");se(l,i.cls("djs-crosshair-group",["no-events"])),Te(s,l);var f=ve("path");se(f,"d",u.x),ze(f).add("djs-crosshair"),Te(l,f);var p=ve("path");se(p,"d",u.y),ze(p).add("djs-crosshair"),Te(l,p),c.crosshairGroup=l}),e.on("spaceTool.selection.move",function(a){var s=a.context.crosshairGroup;Jt(s,a.x,a.y)}),e.on("spaceTool.selection.cleanup",function(a){var s=a.context,c=s.crosshairGroup;c&&zt(c)}),e.on("spaceTool.move",dA,function(a){var s=a.context,c=s.line,u=s.axis,l=s.movingShapes,f=s.resizingShapes;if(s.initialized){if(!s.dragGroup){var p=n.getLayer("space");c=ve("path"),se(c,"d","M0,0 L0,0"),ze(c).add("djs-crosshair"),Te(p,c),s.line=c;var d=ve("g");se(d,i.cls("djs-drag-group",["no-events"])),Te(n.getActiveLayer(),d),o(l,d);var h=new Set(l);k(f,function(M){h.add(M)});var m=new Set,g=s.movingConnections=[];h.forEach(function(M){k(M.outgoing,function(N){m.has(N)||!ot(N)||!h.has(N.target)||(m.add(N),g.push(N))})}),o(g,d),s.dragGroup=d}if(!s.frameGroup){var R=ve("g");se(R,i.cls("djs-frame-group",["no-events"])),Te(n.getActiveLayer(),R);var E=[];k(f,function(M){var N=r.addFrame(M,R),T=N.getBBox();E.push({element:N,initialBounds:T}),n.addMarker(M,ky)}),s.frameGroup=R,s.frames=E}var x={x:"M"+a.x+", -10000 L"+a.x+", 10000",y:"M -10000, "+a.y+" L 10000, "+a.y};se(c,{d:x[u]});var w={x:"y",y:"x"},S={x:a.dx,y:a.dy};S[w[s.axis]]=0,Jt(s.dragGroup,S.x,S.y),k(s.frames,function(M){var N=M.element,T=M.initialBounds,H,G;s.direction==="e"?se(N,{width:yc(T.width+S.x,5)}):(H=yc(T.width-S.x,5),se(N,{width:H,x:T.x+T.width-H})),s.direction==="s"?se(N,{height:yc(T.height+S.y,5)}):(G=yc(T.height-S.y,5),se(N,{height:G,y:T.y+T.height-G}))})}}),e.on("spaceTool.cleanup",function(a){var s=a.context,c=s.movingShapes,u=s.movingConnections,l=s.resizingShapes,f=s.line,p=s.dragGroup,d=s.frameGroup;k(c,function(h){n.removeMarker(h,Pp)}),k(u,function(h){n.removeMarker(h,Pp)}),p&&(zt(f),zt(p)),k(l,function(h){n.removeMarker(h,ky)}),d&&zt(d)})}Oy.$inject=["eventBus","elementRegistry","canvas","styles","previewSupport"];const hA={__init__:["spaceToolPreview"],__depends__:[Ni,yi,hc,Ao,va],spaceTool:["type",qn],spaceToolPreview:["type",Oy]};function vc(e,t){e.invoke(qn,this),this._canvas=t}vc.$inject=["injector","canvas"],ae(vc,qn),vc.prototype.calculateAdjustments=function(e,t,n,i){var r=this._canvas.getRootElement(),o=e[0]===r?null:e[0],a=[];o&&(a=eo(uo(r.children.filter(u=>v(u,"bpmn:Artifact")),Mt(o))));const s=[...e,...a];var c=qn.prototype.calculateAdjustments.call(this,s,t,n,i);return c.resizingShapes=c.resizingShapes.filter(function(u){return!(v(u,"bpmn:TextAnnotation")||mA(u)&&(t==="y"&&qt(u)||t==="x"&&!qt(u)))}),c};function mA(e){return v(e,"bpmn:Participant")&&!Z(e).processRef}const Dy={__depends__:[hA],spaceTool:["type",vc]};function xt(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)}xt.$inject=["eventBus","injector"],xt.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()},xt.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},xt.prototype.clear=function(e){this._stack.length=0,this._stackIdx=-1,e!==!1&&this._fire("changed",{trigger:"clear"})},xt.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()}},xt.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()}},xt.prototype.register=function(e,t){this._setHandler(e,t)},xt.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)},xt.prototype.canUndo=function(){return!!this._getUndoAction()},xt.prototype.canRedo=function(){return!!this._getRedoAction()},xt.prototype._getRedoAction=function(){return this._stack[this._stackIdx+1]},xt.prototype._getUndoAction=function(){return this._stack[this._stackIdx]},xt.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)})},xt.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},xt.prototype._createId=function(){return this._uid++},xt.prototype._atomicDo=function(e){const t=this._currentExecution;t.atomic=!0;try{e()}finally{t.atomic=!1}},xt.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()},xt.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)},xt.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:Qf("id",i.reverse())}),i.length=0,this._fire("changed",{trigger:t}),e.trigger=null)},xt.prototype._markDirty=function(e){const t=this._currentExecution;e&&(e=we(e)?e:[e],t.dirty=t.dirty.concat(e))},xt.prototype._executedAction=function(e,t){const n=++this._stackIdx;t||this._stack.splice(n,this._stack.length,e)},xt.prototype._revertedAction=function(e){this._stackIdx--},xt.prototype._getHandler=function(e){return this._handlerMap[e]},xt.prototype._setHandler=function(e,t){if(!e||!t)throw new Error("command and handler required");if(this._handlerMap[e])throw new Error("overriding handler for command <"+e+">");this._handlerMap[e]=t};const gA={commandStack:["type",xt]};function pr(e,t){if(typeof t!="function")throw new Error("removeFn iterator must be a function");if(!e)return[];for(var n;n=e[0];)t(n);return e}var yA=250,Ly=1400;function Ap(e,t,n){X.call(this,t);var i=e.get("movePreview",!1);t.on("shape.move.start",Ly,function(r){var o=r.context,a=o.shapes,s=o.validatedShapes;o.shapes=Iy(a),o.validatedShapes=Iy(s)}),i&&t.on("shape.move.start",yA,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",Ly,function(r){var o=r.context,a=o.closure,s=a.enclosedElements,c=[];k(s,function(u){k(u.labels,function(l){s[l.id]||c.push(l)})}),a.addAll(c)}),this.preExecute(["connection.delete","shape.delete"],function(r){var o=r.context,a=o.connection||o.shape;pr(a.labels,function(s){n.removeShape(s,{nested:!0})})}),this.execute("shape.delete",function(r){var o=r.context,a=o.shape,s=a.labelTarget;s&&(o.labelTargetIndex=sl(s.labels,a),o.labelTarget=s,a.labelTarget=null)}),this.revert("shape.delete",function(r){var o=r.context,a=o.shape,s=o.labelTarget,c=o.labelTargetIndex;s&&(Ct(s.labels,a,c),a.labelTarget=s)})}ae(Ap,X),Ap.$inject=["injector","eventBus","modeling"];function Iy(e){var t=new Set(e);return Be(e,function(n){return!t.has(n.labelTarget)})}const vA={__init__:["labelSupport"],labelSupport:["type",Ap]};var _A=251,Ny=1401,By="attach-ok";function Tp(e,t,n,i,r){X.call(this,t);var o=e.get("movePreview",!1);t.on("shape.move.start",Ny,function(a){var s=a.context,c=s.shapes,u=s.validatedShapes;s.shapes=bA(c),s.validatedShapes=xA(u)}),o&&t.on("shape.move.start",_A,function(a){var s=a.context,c=s.shapes,u=Mp(c);k(u,function(l){o.makeDraggable(s,l,!0),k(l.labels,function(f){o.makeDraggable(s,f,!0)})})}),o&&t.on("shape.move.start",function(a){var s=a.context,c=s.shapes;if(c.length===1){var u=c[0],l=u.host;l&&(n.addMarker(l,By),t.once(["shape.move.out","shape.move.cleanup"],function(){n.removeMarker(l,By)}))}}),this.preExecuted("elements.move",Ny,function(a){var s=a.context,c=s.closure,u=s.shapes,l=Mp(u);k(l,function(f){c.add(f,c.topLevel[f.host.id])})}),this.postExecuted("elements.move",function(a){var s=a.context,c=s.shapes,u=s.newHost,l;u&&c.length!==1||(u?l=c:l=Be(c,function(f){var p=f.host;return wA(f)&&!EA(c,p)}),k(l,function(f){r.updateAttachment(f,u)}))}),this.postExecuted("elements.move",function(a){var s=a.context.shapes;k(s,function(c){k(c.attachers,function(u){k(u.outgoing.slice(),function(l){var f=i.allowed("connection.reconnect",{connection:l,source:l.source,target:l.target});f||r.removeConnection(l)}),k(u.incoming.slice(),function(l){var f=i.allowed("connection.reconnect",{connection:l,source:l.source,target:l.target});f||r.removeConnection(l)})})})}),this.postExecute("shape.create",function(a){var s=a.context,c=s.shape,u=s.host;u&&r.updateAttachment(c,u)}),this.postExecute("shape.replace",function(a){var s=a.context,c=s.oldShape,u=s.newShape;pr(c.attachers,function(l){var f=i.allowed("elements.move",{target:u,shapes:[l]});f==="attach"?r.updateAttachment(l,u):r.removeShape(l)}),u.attachers.length&&k(u.attachers,function(l){var f=tg(l,c,u);r.moveShape(l,f,l.parent)})}),this.postExecute("shape.resize",function(a){var s=a.context,c=s.shape,u=s.oldBounds,l=s.newBounds,f=c.attachers,p=s.hints||{};p.attachSupport!==!1&&k(f,function(d){var h=tg(d,u,l);r.moveShape(d,h,d.parent),k(d.labels,function(m){r.moveShape(m,h,m.parent)})})}),this.preExecute("shape.delete",function(a){var s=a.context.shape;pr(s.attachers,function(c){r.removeShape(c)}),s.host&&r.updateAttachment(s,null)})}ae(Tp,X),Tp.$inject=["injector","eventBus","canvas","rules","modeling"];function Mp(e){return Ru(an(e,function(t){return t.attachers||[]}))}function bA(e){var t=Mp(e);return p0("id",e,t)}function xA(e){var t=to(e,"id");return Be(e,function(n){for(;n;){if(n.host&&t[n.host.id])return!1;n=n.parent}return!0})}function wA(e){return!!e.host}function EA(e,t){return e.indexOf(t)!==-1}const SA={__depends__:[yi],__init__:["attachSupport"],attachSupport:["type",Tp]};function $y(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(Mh(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)})}$y.$inject=["eventBus","canvas","elementRegistry","graphicsFactory"];const kp={__init__:["changeSupport"],changeSupport:["type",$y]};function Kn(e){this._model=e}Kn.$inject=["moddle"],Kn.prototype._needsId=function(e){return Ie(e,["bpmn:RootElement","bpmn:FlowElement","bpmn:MessageFlow","bpmn:DataAssociation","bpmn:Artifact","bpmn:Participant","bpmn:Lane","bpmn:LaneSet","bpmn:Process","bpmn:Collaboration","bpmndi:BPMNShape","bpmndi:BPMNEdge","bpmndi:BPMNDiagram","bpmndi:BPMNPlane","bpmn:Property","bpmn:CategoryValue"])},Kn.prototype._ensureId=function(e){if(e.id){this._model.ids.claim(e.id,e);return}var t;v(e,"bpmn:Activity")?t="Activity":v(e,"bpmn:Event")?t="Event":v(e,"bpmn:Gateway")?t="Gateway":Ie(e,["bpmn:SequenceFlow","bpmn:MessageFlow"])?t="Flow":t=(e.$type||"").replace(/^[^:]*:/g,""),t+="_",!e.id&&this._needsId(e)&&(e.id=this._model.ids.nextPrefixed(t,e))},Kn.prototype.create=function(e,t){var n=this._model.create(e,t||{});return this._ensureId(n),n},Kn.prototype.createDiLabel=function(){return this.create("bpmndi:BPMNLabel",{bounds:this.createDiBounds()})},Kn.prototype.createDiShape=function(e,t){return this.create("bpmndi:BPMNShape",I({bpmnElement:e,bounds:this.createDiBounds()},t))},Kn.prototype.createDiBounds=function(e){return this.create("dc:Bounds",e)},Kn.prototype.createDiWaypoints=function(e){var t=this;return an(e,function(n){return t.createDiWaypoint(n)})},Kn.prototype.createDiWaypoint=function(e){return this.create("dc:Point",ni(e,["x","y"]))},Kn.prototype.createDiEdge=function(e,t){return this.create("bpmndi:BPMNEdge",I({bpmnElement:e,waypoint:this.createDiWaypoints([])},t))},Kn.prototype.createDiPlane=function(e,t){return this.create("bpmndi:BPMNPlane",I({bpmnElement:e},t))};function Dn(e,t,n){X.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;k(g,function(R){v(R,"bpmn:BaseElement")&&i.updateParent(R)})}this.executed(["canvas.updateRoot"],s),this.reverted(["canvas.updateRoot"],s);function c(d){var h=d.context.shape;v(h,"bpmn:BaseElement")&&i.updateBounds(h)}this.executed(["shape.move","shape.create","shape.resize"],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,R=h.newSource,E=Z(m),x=Z(g),w=Z(R);E.conditionExpression&&!Ie(w,["bpmn:Activity","bpmn:ExclusiveGateway","bpmn:InclusiveGateway"])&&(h.oldConditionExpression=E.conditionExpression,delete E.conditionExpression),g!==R&&x.default===E&&(h.oldDefault=x.default,delete x.default)})),this.reverted("connection.reconnect",Ln(function(d){var h=d.context,m=h.connection,g=h.oldSource,R=h.newSource,E=Z(m),x=Z(g),w=Z(R);h.oldConditionExpression&&(E.conditionExpression=h.oldConditionExpression),h.oldDefault&&(x.default=h.oldDefault,delete w.default)}));function f(d){i.updateAttachment(d.context)}this.executed(["element.updateAttachment"],Ln(f)),this.reverted(["element.updateAttachment"],Ln(f)),this.executed("element.updateLabel",Ln(p)),this.reverted("element.updateLabel",Ln(p));function p(d){const{element:h}=d.context,m=jn(h),g=Ye(h),R=g&&g.get("label");rr(h)||rc(h)||(m&&!R?g.set("label",t.create("bpmndi:BPMNLabel")):!m&&R&&g.set("label",void 0))}}ae(Dn,X),Dn.$inject=["eventBus","bpmnFactory","connectionDocking"],Dn.prototype.updateAttachment=function(e){var t=e.shape,n=t.businessObject,i=t.host;n.attachedToRef=i&&i.businessObject},Dn.prototype.updateParent=function(e,t){if(!De(e)&&!(v(e,"bpmn:DataStoreReference")&&e.parent&&v(e.parent,"bpmn:Collaboration"))){var n=e.parent,i=e.businessObject,r=Ye(e),o=n&&n.businessObject,a=Ye(n);v(e,"bpmn:FlowNode")&&this.updateFlowNodeRefs(i,o,t&&t.businessObject),v(e,"bpmn:DataOutputAssociation")&&(e.source?o=e.source.businessObject:o=null),v(e,"bpmn:DataInputAssociation")&&(e.target?o=e.target.businessObject:o=null),this.updateSemanticParent(i,o),v(e,"bpmn:DataObjectReference")&&i.dataObjectRef&&this.updateSemanticParent(i.dataObjectRef,o),this.updateDiParent(r,a)}},Dn.prototype.updateBounds=function(e){var t=Ye(e),n=CA(e);if(n){var i=ii(n,t.get("bounds"));I(n,{x:e.x+i.x,y:e.y+i.y})}var r=De(e)?this._getLabel(t):t,o=r.bounds;o||(o=this._bpmnFactory.createDiBounds(),r.set("bounds",o)),I(o,{x:e.x,y:e.y,width:e.width,height:e.height})},Dn.prototype.updateFlowNodeRefs=function(e,t,n){if(n!==t){var i,r;v(n,"bpmn:Lane")&&(i=n.get("flowNodeRef"),Rt(i,e)),v(t,"bpmn:Lane")&&(r=t.get("flowNodeRef"),Ct(r,e))}},Dn.prototype.updateDiConnection=function(e,t,n){var i=Ye(e),r=Ye(t),o=Ye(n);i.sourceElement&&i.sourceElement.bpmnElement!==Z(t)&&(i.sourceElement=t&&r),i.targetElement&&i.targetElement.bpmnElement!==Z(n)&&(i.targetElement=n&&o)},Dn.prototype.updateDiParent=function(e,t){if(t&&!v(t,"bpmndi:BPMNPlane")&&(t=t.$parent),e.$parent!==t){var n=(t||e.$parent).get("planeElement");t?(n.push(e),e.$parent=t):(Rt(n,e),e.$parent=null)}};function RA(e){for(;e&&!v(e,"bpmn:Definitions");)e=e.$parent;return e}Dn.prototype.getLaneSet=function(e){var t,n;return v(e,"bpmn:Lane")?(t=e.childLaneSet,t||(t=this._bpmnFactory.create("bpmn:LaneSet"),e.childLaneSet=t,t.$parent=e),t):(v(e,"bpmn:Participant")&&(e=e.processRef),n=e.get("laneSets"),t=n[0],t||(t=this._bpmnFactory.create("bpmn:LaneSet"),t.$parent=e,n.push(t)),t)},Dn.prototype.updateSemanticParent=function(e,t,n){var i;if(e.$parent!==t&&!((v(e,"bpmn:DataInput")||v(e,"bpmn:DataOutput"))&&(v(t,"bpmn:Participant")&&"processRef"in t&&(t=t.processRef),"ioSpecification"in t&&t.ioSpecification===e.$parent))){if(v(e,"bpmn:Lane"))t&&(t=this.getLaneSet(t)),i="lanes";else if(v(e,"bpmn:FlowElement")){if(t){if(v(t,"bpmn:Participant"))t=t.processRef;else if(v(t,"bpmn:Lane"))do t=t.$parent.$parent;while(v(t,"bpmn:Lane"))}i="flowElements"}else if(v(e,"bpmn:Artifact")){for(;t&&!v(t,"bpmn:Process")&&!v(t,"bpmn:SubProcess")&&!v(t,"bpmn:Collaboration");)if(v(t,"bpmn:Participant")){t=t.processRef;break}else t=t.$parent;i="artifacts"}else if(v(e,"bpmn:MessageFlow"))i="messageFlows";else if(v(e,"bpmn:Participant")){i="participants";var r=e.processRef,o;r&&(o=RA(e.$parent||t),e.$parent&&(Rt(o.get("rootElements"),r),r.$parent=null),t&&(Ct(o.get("rootElements"),r),r.$parent=o))}else v(e,"bpmn:DataOutputAssociation")?i="dataOutputAssociations":v(e,"bpmn:DataInputAssociation")&&(i="dataInputAssociations");if(!i)throw new Error(`no parent for <${e.id}> in <${t.id}>`);var a;if(e.$parent&&(a=e.$parent.get(i),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))}}},Dn.prototype.updateConnectionWaypoints=function(e){var t=Ye(e);t.set("waypoint",this._bpmnFactory.createDiWaypoints(e.waypoints))},Dn.prototype.updateConnection=function(e){var t=e.connection,n=Z(t),i=t.source,r=Z(i),o=t.target,a=Z(t.target),s;if(v(n,"bpmn:DataAssociation"))v(n,"bpmn:DataInputAssociation")?(n.get("sourceRef")[0]=r,s=e.parent||e.newParent||a,this.updateSemanticParent(n,a,s)):v(n,"bpmn:DataOutputAssociation")&&(s=e.parent||e.newParent||r,this.updateSemanticParent(n,r,s),n.targetRef=a);else{var c=v(n,"bpmn:SequenceFlow");n.sourceRef!==r&&(c&&(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)},Dn.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;v(i,"bpmn:BaseElement")&&e(t)}}function CA(e){if(v(e,"bpmn:Activity")){var t=Ye(e);if(t){var n=t.get("label");if(n)return n.get("bounds")}}}function fr(e,t){Oi.call(this),this._bpmnFactory=e,this._moddle=t}ae(fr,Oi),fr.$inject=["bpmnFactory","moddle"],fr.prototype._baseCreate=Oi.prototype.create,fr.prototype.create=function(e,t){if(e==="label"){var n=t.di||this._bpmnFactory.createDiLabel();return this._baseCreate(e,I({type:"label",di:n},Nr,t))}return this.createElement(e,t)},fr.prototype.createElement=function(e,t){t=I({},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(!AA(r)){var o=I({},r||{},{id:i.id+"_di"});e==="root"?r=this._bpmnFactory.createDiPlane(i,o):e==="connection"?r=this._bpmnFactory.createDiEdge(i,o):r=this._bpmnFactory.createDiShape(i,o)}v(i,"bpmn:Group")&&(t=I({isFrame:!0},t)),t=PA(i,t,["processRef","isInterrupting","associationDirection","isForCompensation"]),t.isExpanded&&(t=Op(r,t,"isExpanded")),Ie(i,["bpmn:Lane","bpmn:Participant"])&&(t=Op(r,t,"isHorizontal")),v(i,"bpmn:SubProcess")&&(t.collapsed=!He(i,r)),v(i,"bpmn:ExclusiveGateway")&&(Rn(r,"isMarkerVisible")?r.isMarkerVisible===void 0&&(r.isMarkerVisible=!1):r.isMarkerVisible=!0),Ft(t.triggeredByEvent)&&(i.triggeredByEvent=t.triggeredByEvent,delete t.triggeredByEvent),Ft(t.cancelActivity)&&(i.cancelActivity=t.cancelActivity,delete t.cancelActivity);var a,s;return t.eventDefinitionType&&(a=i.get("eventDefinitions")||[],s=this._bpmnFactory.create(t.eventDefinitionType,t.eventDefinitionAttrs),t.eventDefinitionType==="bpmn:ConditionalEventDefinition"&&(s.condition=this._bpmnFactory.create("bpmn:FormalExpression")),a.push(s),s.$parent=i,i.eventDefinitions=a,delete t.eventDefinitionType),n=this.getDefaultSize(i,r),t=I({id:i.id},n,t,{businessObject:i,di:r}),this._baseCreate(e,t)},fr.prototype.getDefaultSize=function(e,t){var n=Z(e);if(t=t||Ye(e),v(n,"bpmn:SubProcess"))return He(n,t)?{width:350,height:200}:{width:100,height:80};if(v(n,"bpmn:Task"))return{width:100,height:80};if(v(n,"bpmn:Gateway"))return{width:50,height:50};if(v(n,"bpmn:Event"))return{width:36,height:36};if(v(n,"bpmn:Participant")){var i=t.isHorizontal===void 0||t.isHorizontal===!0;return He(n,t)?i?{width:600,height:250}:{width:250,height:600}:i?{width:400,height:60}:{width:60,height:400}}return v(n,"bpmn:Lane")?{width:400,height:100}:v(n,"bpmn:DataObjectReference")?{width:36,height:50}:v(n,"bpmn:DataStoreReference")?{width:50,height:50}:v(n,"bpmn:TextAnnotation")?{width:100,height:40}:v(n,"bpmn:Group")?{width:300,height:300}:{width:100,height:80}},fr.prototype.createParticipantShape=function(e){return Ut(e)||(e={isExpanded:e}),e=I({type:"bpmn:Participant"},e||{}),e.isExpanded!==!1&&(e.processRef=this._bpmnFactory.create("bpmn:Process")),this.createShape(e)};function PA(e,t,n){return k(n,function(i){t=Op(e,t,i)}),t}function Op(e,t,n){return t[n]===void 0?t:(e[n]=t[n],ai(t,[n]))}function AA(e){return Ie(e,["bpmndi:BPMNShape","bpmndi:BPMNEdge","bpmndi:BPMNDiagram","bpmndi:BPMNPlane"])}function _c(e,t){this._modeling=e,this._canvas=t}_c.$inject=["modeling","canvas"],_c.prototype.preExecute=function(e){var t=this._modeling,n=e.elements,i=e.alignment;k(n,function(r){var o={x:0,y:0};Ft(i.left)?o.x=i.left-r.x:Ft(i.right)?o.x=i.right-r.width-r.x:Ft(i.center)?o.x=i.center-Math.round(r.width/2)-r.x:Ft(i.top)?o.y=i.top-r.y:Ft(i.bottom)?o.y=i.bottom-r.height-r.y:Ft(i.middle)&&(o.y=i.middle-Math.round(r.height/2)-r.y),t.moveElements([r],o,r.parent)})},_c.prototype.postExecute=function(e){};function bc(e){this._modeling=e}bc.$inject=["modeling"],bc.prototype.preExecute=function(e){var t=e.source;if(!t)throw new Error("source required");var n=e.target||t.parent,i=e.shape,r=e.hints||{};i=e.shape=this._modeling.createShape(i,e.position,n,{attach:r.attach}),e.shape=i},bc.prototype.postExecute=function(e){var t=e.hints||{};TA(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 TA(e,t){return Wi(e.outgoing,function(n){return n.target===t})}function xc(e,t){this._canvas=e,this._layouter=t}xc.$inject=["canvas","layouter"],xc.prototype.execute=function(e){var t=e.connection,n=e.source,i=e.target,r=e.parent,o=e.parentIndex,a=e.hints;if(!n||!i)throw new Error("source and target required");if(!r)throw new Error("parent required");return t.source=n,t.target=i,t.waypoints||(t.waypoints=this._layouter.layoutConnection(t,a)),this._canvas.addConnection(t,r,o),t},xc.prototype.revert=function(e){var t=e.connection;return this._canvas.removeConnection(t),t.source=null,t.target=null,t};var wc=Math.round;function Dp(e){this._modeling=e}Dp.$inject=["modeling"],Dp.prototype.preExecute=function(e){var t=e.elements,n=e.parent,i=e.parentIndex,r=e.position,o=e.hints,a=this._modeling;k(t,function(f){Pe(f.x)||(f.x=0),Pe(f.y)||(f.y=0)});var s=Be(t,function(f){return!f.hidden}),c=Mt(s);k(t,function(f){ot(f)&&(f.waypoints=an(f.waypoints,function(p){return{x:wc(p.x-c.x-c.width/2+r.x),y:wc(p.y-c.y-c.height/2+r.y)}})),I(f,{x:wc(f.x-c.x-c.width/2+r.x),y:wc(f.y-c.y-c.height/2+r.y)})});var u=new Set(Ss(t)),l={};k(t,function(f){if(ot(f)){l[f.id]=Pe(i)?a.createConnection(l[f.source.id],l[f.target.id],i,f,f.parent||n,o):a.createConnection(l[f.source.id],l[f.target.id],f,f.parent||n,o);return}var p=I({},o);u.has(f)||(p.autoResize=!1),De(f)&&(p=ai(p,["attach"])),l[f.id]=Pe(i)?a.createShape(f,ni(f,["x","y","width","height"]),f.parent||n,i,p):a.createShape(f,ni(f,["x","y","width","height"]),f.parent||n,p)}),e.elements=eo(l)};var jy=Math.round;function dr(e){this._canvas=e}dr.$inject=["canvas"],dr.prototype.execute=function(e){var t=e.shape,n=e.position,i=e.parent,r=e.parentIndex;if(!i)throw new Error("parent required");if(!n)throw new Error("position required");return n.width!==void 0?I(t,n):I(t,{x:n.x-jy(t.width/2),y:n.y-jy(t.height/2)}),this._canvas.addShape(t,i,r),t},dr.prototype.revert=function(e){var t=e.shape;return this._canvas.removeShape(t),t};function ba(e){dr.call(this,e)}ae(ba,dr),ba.$inject=["canvas"];var MA=dr.prototype.execute;ba.prototype.execute=function(e){var t=e.shape;return OA(t),t.labelTarget=e.labelTarget,MA.call(this,e)};var kA=dr.prototype.revert;ba.prototype.revert=function(e){return e.shape.labelTarget=null,kA.call(this,e)};function OA(e){["width","height"].forEach(function(t){typeof e[t]>"u"&&(e[t]=0)})}function xa(e,t){this._canvas=e,this._modeling=t}xa.$inject=["canvas","modeling"],xa.prototype.preExecute=function(e){var t=this._modeling,n=e.connection;pr(n.incoming,function(i){t.removeConnection(i,{nested:!0})}),pr(n.outgoing,function(i){t.removeConnection(i,{nested:!0})})},xa.prototype.execute=function(e){var t=e.connection,n=t.parent;return e.parent=n,e.parentIndex=sl(n.children,t),e.source=t.source,e.target=t.target,this._canvas.removeConnection(t),t.source=null,t.target=null,t},xa.prototype.revert=function(e){var t=e.connection,n=e.parent,i=e.parentIndex;return t.source=e.source,t.target=e.target,Ct(n.children,t,i),this._canvas.addConnection(t,n),t};function Lp(e,t){this._modeling=e,this._elementRegistry=t}Lp.$inject=["modeling","elementRegistry"],Lp.prototype.postExecute=function(e){var t=this._modeling,n=this._elementRegistry,i=e.elements;k(i,function(r){n.get(r.id)&&(r.waypoints?t.removeConnection(r):t.removeShape(r))})};function wa(e,t){this._canvas=e,this._modeling=t}wa.$inject=["canvas","modeling"],wa.prototype.preExecute=function(e){var t=this._modeling,n=e.shape;pr(n.incoming,function(i){t.removeConnection(i,{nested:!0})}),pr(n.outgoing,function(i){t.removeConnection(i,{nested:!0})}),pr(n.children,function(i){ot(i)?t.removeConnection(i,{nested:!0}):t.removeShape(i,{nested:!0})})},wa.prototype.execute=function(e){var t=this._canvas,n=e.shape,i=n.parent;return e.oldParent=i,e.oldParentIndex=sl(i.children,n),t.removeShape(n),n},wa.prototype.revert=function(e){var t=this._canvas,n=e.shape,i=e.oldParent,r=e.oldParentIndex;return Ct(i.children,n,r),t.addShape(n,i),n};function Ec(e){this._modeling=e}Ec.$inject=["modeling"];var Fy={x:"y",y:"x"};Ec.prototype.preExecute=function(e){var t=this._modeling,n=e.groups,i=e.axis,r=e.dimension;function o(g,R){g.range.min=Math.min(R[i],g.range.min),g.range.max=Math.max(R[i]+R[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,R){var E={y:0};E[i]=g-a(R),E[i]&&(E[Fy[i]]=0,t.moveElements([R],E,R.parent))}var l=n[0],f=s(n),p=n[f],d,h,m=0;k(n,function(g,R){var E,x,w;if(g.elements.length<2){R&&R!==n.length-1&&(o(g,g.elements[0]),m+=c(g.range));return}E=oi(g.elements,i),x=E[0],R===f&&(x=E[s(E)]),w=a(x),g.range=null,k(E,function(S){if(u(w,S),g.range===null){g.range={min:S[i],max:S[i]+S[r]};return}o(g,S)}),R&&R!==n.length-1&&(m+=c(g.range))}),h=Math.abs(p.range.min-l.range.max),d=Math.round((h-m)/(n.length-1)),!(d<n.length-1)&&k(n,function(g,R){var E={},x;g===l||g===p||(x=n[R-1],g.range.max=0,k(g.elements,function(w,S){E[Fy[i]]=0,E[i]=x.range.max-w[i]+d,g.range.min!==w[i]&&(E[i]+=w[i]-g.range.min),E[i]&&t.moveElements([w],E,w.parent),g.range.max=Math.max(w[i]+w[r],S?g.range.max:0)}))})},Ec.prototype.postExecute=function(e){};function Sc(e,t){this._layouter=e,this._canvas=t}Sc.$inject=["layouter","canvas"],Sc.prototype.execute=function(e){var t=e.connection,n=t.waypoints;return I(e,{oldWaypoints:n}),t.waypoints=this._layouter.layoutConnection(t,e.hints),t},Sc.prototype.revert=function(e){var t=e.connection;return t.waypoints=e.oldWaypoints,t};function Ip(){}Ip.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),Ct(i.children,t,r),t.parent=i,k(t.waypoints,function(a){a.x+=n.x,a.y+=n.y,a.original&&(a.original.x+=n.x,a.original.y+=n.y)}),t},Ip.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),Ct(i.children,t,r),t.parent=i,k(t.waypoints,function(a){a.x-=o.x,a.y-=o.y,a.original&&(a.original.x-=o.x,a.original.y-=o.y)}),t};function Np(){this.allShapes={},this.allConnections={},this.enclosedElements={},this.enclosedConnections={},this.topLevel={}}Np.prototype.add=function(e,t){return this.addAll([e],t)},Np.prototype.addAll=function(e,t){var n=c1(e,!!t,this);return I(this,n),this};function Ea(e){this._modeling=e}Ea.prototype.moveRecursive=function(e,t,n){return e?this.moveClosure(this.getClosure(e),t,n):[]},Ea.prototype.moveClosure=function(e,t,n,i,r){var o=this._modeling,a=e.allShapes,s=e.allConnections,c=e.enclosedConnections,u=e.topLevel,l=!1;r&&r.parent===n&&(l=!0),k(a,function(f){o.moveShape(f,t,u[f.id]&&!l&&n,{recurse:!1,layout:!1})}),k(s,function(f){var p=!!a[f.source.id],d=!!a[f.target.id];c[f.id]&&p&&d?o.moveConnection(f,t,u[f.id]&&!l&&n):o.layoutConnection(f,{connectionStart:p&&Gl(f,f.source,t),connectionEnd:d&&Vl(f,f.target,t)})})},Ea.prototype.getClosure=function(e){return new Np().addAll(e,!0)};function Rc(e){this._helper=new Ea(e)}Rc.$inject=["modeling"],Rc.prototype.preExecute=function(e){e.closure=this._helper.getClosure(e.shapes)},Rc.prototype.postExecute=function(e){var t=e.hints,n;t&&t.primaryShape&&(n=t.primaryShape,t.oldParent=n.parent),this._helper.moveClosure(e.closure,e.delta,e.newParent,e.newHost,n)};function zr(e){this._modeling=e,this._helper=new Ea(e)}zr.$inject=["modeling"],zr.prototype.execute=function(e){var t=e.shape,n=e.delta,i=e.newParent||t.parent,r=e.newParentIndex,o=t.parent;return e.oldBounds=ni(t,["x","y","width","height"]),e.oldParent=o,e.oldParentIndex=Rt(o.children,t),Ct(i.children,t,r),I(t,{parent:i,x:t.x+n.x,y:t.y+n.y}),t},zr.prototype.postExecute=function(e){var t=e.shape,n=e.delta,i=e.hints,r=this._modeling;i.layout!==!1&&(k(t.incoming,function(o){r.layoutConnection(o,{connectionEnd:Vl(o,t,n)})}),k(t.outgoing,function(o){r.layoutConnection(o,{connectionStart:Gl(o,t,n)})})),i.recurse!==!1&&this.moveChildren(e)},zr.prototype.revert=function(e){var t=e.shape,n=e.oldParent,i=e.oldParentIndex,r=e.delta;return Ct(n.children,t,i),I(t,{parent:n,x:t.x-r.x,y:t.y-r.y}),t},zr.prototype.moveChildren=function(e){var t=e.delta,n=e.shape;this._helper.moveRecursive(n.children,t,null)},zr.prototype.getNewParent=function(e){return e.newParent||e.shape.parent};function Sa(e){this._modeling=e}Sa.$inject=["modeling"],Sa.prototype.execute=function(e){var t=e.newSource,n=e.newTarget,i=e.connection,r=e.dockingOrPoints;if(!t&&!n)throw new Error("newSource or newTarget required");return we(r)&&(e.oldWaypoints=i.waypoints,i.waypoints=r),t&&(e.oldSource=i.source,i.source=t),n&&(e.oldTarget=i.target,i.target=n),i},Sa.prototype.postExecute=function(e){var t=e.connection,n=e.newSource,i=e.newTarget,r=e.dockingOrPoints,o=e.hints||{},a={};o.connectionStart&&(a.connectionStart=o.connectionStart),o.connectionEnd&&(a.connectionEnd=o.connectionEnd),o.layoutConnection!==!1&&(n&&(!i||o.docking==="source")&&(a.connectionStart=a.connectionStart||Hy(we(r)?r[0]:r)),i&&(!n||o.docking==="target")&&(a.connectionEnd=a.connectionEnd||Hy(we(r)?r[r.length-1]:r)),o.newWaypoints&&(a.waypoints=o.newWaypoints),this._modeling.layoutConnection(t,a))},Sa.prototype.revert=function(e){var t=e.oldSource,n=e.oldTarget,i=e.oldWaypoints,r=e.connection;return t&&(r.source=t),n&&(r.target=n),i&&(r.waypoints=i),r};function Hy(e){return e.original||e}function $i(e,t){this._modeling=e,this._rules=t}$i.$inject=["modeling","rules"],$i.prototype.preExecute=function(e){var t=this,n=this._modeling,i=this._rules,r=e.oldShape,o=e.newData,a=e.hints||{},s;function c(h,m,g){return i.allowed("connection.reconnect",{connection:g,source:h,target:m})}var u={x:o.x,y:o.y},l={x:r.x,y:r.y,width:r.width,height:r.height};s=e.newShape=e.newShape||t.createShape(o,u,r.parent,a),r.host&&n.updateAttachment(s,r.host);var f;a.moveChildren!==!1&&(f=r.children.slice(),n.moveElements(f,{x:0,y:0},s,a));var p=r.incoming.slice(),d=r.outgoing.slice();k(p,function(h){var m=h.source,g=c(m,s,h);g&&t.reconnectEnd(h,s,Qs(h,s,l),a)}),k(d,function(h){var m=h.target,g=c(s,m,h);g&&t.reconnectStart(h,s,Zs(h,s,l),a)})},$i.prototype.postExecute=function(e){var t=e.oldShape;this._modeling.removeShape(t)},$i.prototype.execute=function(e){},$i.prototype.revert=function(e){},$i.prototype.createShape=function(e,t,n,i){return this._modeling.createShape(e,t,n,i)},$i.prototype.reconnectStart=function(e,t,n,i){this._modeling.reconnectStart(e,t,n,i)},$i.prototype.reconnectEnd=function(e,t,n,i){this._modeling.reconnectEnd(e,t,n,i)};function Ra(e){this._modeling=e}Ra.$inject=["modeling"],Ra.prototype.execute=function(e){var t=e.shape,n=e.newBounds,i=e.minBounds;if(n.x===void 0||n.y===void 0||n.width===void 0||n.height===void 0)throw new Error("newBounds must have {x, y, width, height} properties");if(i&&(n.width<i.width||n.height<i.height))throw new Error("width and height cannot be less than minimum height and width");if(!i&&n.width<10||n.height<10)throw new Error("width and height cannot be less than 10px");return e.oldBounds={width:t.width,height:t.height,x:t.x,y:t.y},I(t,{width:n.width,height:n.height,x:n.x,y:n.y}),t},Ra.prototype.postExecute=function(e){var t=this._modeling,n=e.shape,i=e.oldBounds,r=e.hints||{};r.layout!==!1&&(k(n.incoming,function(o){t.layoutConnection(o,{connectionEnd:Qs(o,n,i)})}),k(n.outgoing,function(o){t.layoutConnection(o,{connectionStart:Zs(o,n,i)})}))},Ra.prototype.revert=function(e){var t=e.shape,n=e.oldBounds;return I(t,{width:n.width,height:n.height,x:n.x,y:n.y}),t};function hr(e){this._modeling=e}hr.$inject=["modeling"],hr.prototype.preExecute=function(e){var t=e.delta,n=e.direction,i=e.movingShapes,r=e.resizingShapes,o=e.start,a={};this.moveShapes(i,t),k(r,function(s){a[s.id]=LA(s)}),this.resizeShapes(r,t,n),this.updateConnectionWaypoints(sA(i,r),t,n,o,i,r,a)},hr.prototype.execute=function(){},hr.prototype.revert=function(){},hr.prototype.moveShapes=function(e,t){var n=this;k(e,function(i){n._modeling.moveShape(i,t,null,{autoResize:!1,layout:!1,recurse:!1})})},hr.prototype.resizeShapes=function(e,t,n){var i=this;k(e,function(r){var o=cA(r,n,t);i._modeling.resizeShape(r,o,null,{attachSupport:!1,autoResize:!1,layout:!1})})},hr.prototype.updateConnectionWaypoints=function(e,t,n,i,r,o,a){var s=this,c=new Set(r),u=new Set(o);k(e,function(l){var f=l.source,p=l.target,d=DA(l),h=Gy(n),m={},g=c.has(f)||u.has(f),R=c.has(p)||u.has(p);g&&R?(d=an(d,function(E){return Vy(E,i,n)&&(E[h]=E[h]+t[h]),E.original&&Vy(E.original,i,n)&&(E.original[h]=E.original[h]+t[h]),E}),s._modeling.updateWaypoints(l,d,{labelBehavior:!1})):(g||R)&&(c.has(f)?m.connectionStart=Gl(l,f,t):c.has(p)?m.connectionEnd=Vl(l,p,t):u.has(f)?m.connectionStart=Zs(l,f,a[f.id]):u.has(p)&&(m.connectionEnd=Qs(l,p,a[p.id])),s._modeling.layoutConnection(l,m))})};function zy(e){return I({},e)}function DA(e){return an(e.waypoints,function(t){return t=zy(t),t.original&&(t.original=zy(t.original)),t})}function Gy(e){switch(e){case"n":return"y";case"w":return"x";case"s":return"y";case"e":return"x"}}function Vy(e,t,n){var i=Gy(n);if(/e|s/.test(n))return e[i]>t;if(/n|w/.test(n))return e[i]<t}function LA(e){return{x:e.x,y:e.y,height:e.height,width:e.width}}function Cc(e){this._modeling=e}Cc.$inject=["modeling"],Cc.prototype.execute=function(e){var t=e.shape,n=t.children;e.oldChildrenVisibility=Wy(n),t.collapsed=!t.collapsed;var i=Uy(n,t.collapsed);return[t].concat(i)},Cc.prototype.revert=function(e){var t=e.shape,n=e.oldChildrenVisibility,i=t.children,r=Yy(i,n);return t.collapsed=!t.collapsed,[t].concat(r)};function Wy(e){var t={};return k(e,function(n){t[n.id]=n.hidden,n.children&&(t=I({},t,Wy(n.children)))}),t}function Uy(e,t){var n=[];return k(e,function(i){i.hidden=t,n=n.concat(i),i.children&&(n=n.concat(Uy(i.children,i.collapsed||t)))}),n}function Yy(e,t){var n=[];return k(e,function(i){i.hidden=t[i.id],n=n.concat(i),i.children&&(n=n.concat(Yy(i.children,t)))}),n}function Pc(e){this._modeling=e}Pc.$inject=["modeling"],Pc.prototype.execute=function(e){var t=e.shape,n=e.newHost,i=t.host;return e.oldHost=i,e.attacherIdx=qy(i,t),Ky(n,t),t.host=n,t},Pc.prototype.revert=function(e){var t=e.shape,n=e.newHost,i=e.oldHost,r=e.attacherIdx;return t.host=i,qy(n,t),Ky(i,t,r),t};function qy(e,t){return Rt(e&&e.attachers,t)}function Ky(e,t,n){if(e){var i=e.attachers;i||(e.attachers=i=[]),Ct(i,t,n)}}function Bp(){}Bp.prototype.execute=function(e){var t=e.connection,n=e.newWaypoints;return e.oldWaypoints=t.waypoints,t.waypoints=n,t},Bp.prototype.revert=function(e){var t=e.connection,n=e.oldWaypoints;return t.waypoints=n,t};function at(e,t,n){this._eventBus=e,this._elementFactory=t,this._commandStack=n;var i=this;e.on("diagram.init",function(){i.registerHandlers(n)})}at.$inject=["eventBus","elementFactory","commandStack"],at.prototype.getHandlers=function(){return{"shape.append":bc,"shape.create":dr,"shape.delete":wa,"shape.move":zr,"shape.resize":Ra,"shape.replace":$i,"shape.toggleCollapse":Cc,spaceTool:hr,"label.create":ba,"connection.create":xc,"connection.delete":xa,"connection.move":Ip,"connection.layout":Sc,"connection.updateWaypoints":Bp,"connection.reconnect":Sa,"elements.create":Dp,"elements.move":Rc,"elements.delete":Lp,"elements.distribute":Ec,"elements.align":_c,"element.updateAttachment":Pc}},at.prototype.registerHandlers=function(e){k(this.getHandlers(),function(t,n){e.registerHandler(n,t)})},at.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)},at.prototype.updateAttachment=function(e,t){var n={shape:e,newHost:t};this._commandStack.execute("element.updateAttachment",n)},at.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)},at.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)},at.prototype.layoutConnection=function(e,t){var n={connection:e,hints:t||{}};this._commandStack.execute("connection.layout",n)},at.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},at.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},at.prototype.createElements=function(e,t,n,i,r){we(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},at.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},at.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},at.prototype.removeElements=function(e){var t={elements:e};this._commandStack.execute("elements.delete",t)},at.prototype.distributeElements=function(e,t,n){var i={groups:e,axis:t,dimension:n};this._commandStack.execute("elements.distribute",i)},at.prototype.removeShape=function(e,t){var n={shape:e,hints:t||{}};this._commandStack.execute("shape.delete",n)},at.prototype.removeConnection=function(e,t){var n={connection:e,hints:t||{}};this._commandStack.execute("connection.delete",n)},at.prototype.replaceShape=function(e,t,n){var i={oldShape:e,newData:t,hints:n||{}};return this._commandStack.execute("shape.replace",i),i.newShape},at.prototype.alignElements=function(e,t){var n={elements:e,alignment:t};this._commandStack.execute("elements.align",n)},at.prototype.resizeShape=function(e,t,n,i){var r={shape:e,newBounds:t,minBounds:n,hints:i};this._commandStack.execute("shape.resize",r)},at.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)},at.prototype.updateWaypoints=function(e,t,n){var i={connection:e,newWaypoints:t,hints:n||{}};this._commandStack.execute("connection.updateWaypoints",i)},at.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)},at.prototype.reconnectStart=function(e,t,n,i){i||(i={}),this.reconnect(e,t,e.target,n,I(i,{docking:"source"}))},at.prototype.reconnectEnd=function(e,t,n,i){i||(i={}),this.reconnect(e,e.source,t,n,I(i,{docking:"target"}))},at.prototype.connect=function(e,t,n,i){return this.createConnection(e,t,n||{},e.parent,i)},at.prototype._create=function(e,t){return Y1(t)?t:this._elementFactory.create(e,t)},at.prototype.toggleCollapse=function(e,t){var n={shape:e,hints:t||{}};this._commandStack.execute("shape.toggleCollapse",n)};function Ca(e){this._elementRegistry=e}Ca.$inject=["elementRegistry"],Ca.prototype.execute=function(e){var t=e.element,n=e.moddleElement,i=e.properties;if(!n)throw new Error("<moddleElement> required");var r=e.changed||this._getVisualReferences(n).concat(t),o=e.oldProperties||IA(n,Ja(i));return Xy(n,i),e.oldProperties=o,e.changed=r,r},Ca.prototype.revert=function(e){var t=e.oldProperties,n=e.moddleElement,i=e.changed;return Xy(n,t),i},Ca.prototype._getVisualReferences=function(e){var t=this._elementRegistry;return v(e,"bpmn:DataObject")?NA(e,t):[]};function IA(e,t){return Cn(t,function(n,i){return n[i]=e.get(i),n},{})}function Xy(e,t){k(t,function(n,i){e.set(i,n)})}function NA(e,t){return t.filter(function(n){return v(n,"bpmn:DataObjectReference")&&Z(n).dataObjectRef===e})}var Pa="default",ji="id",Zy="di",BA={width:0,height:0};function Aa(e,t,n,i){this._elementRegistry=e,this._moddle=t,this._modeling=n,this._textRenderer=i}Aa.$inject=["elementRegistry","moddle","modeling","textRenderer"],Aa.prototype.execute=function(e){var t=e.element,n=[t];if(!t)throw new Error("element required");var i=this._elementRegistry,r=this._moddle.ids,o=t.businessObject,a=zA(e.properties),s=e.oldProperties||$A(t,a);return Qy(a,o)&&(r.unclaim(o[ji]),i.updateId(t,a[ji]),r.claim(a[ji],o)),Pa in a&&(a[Pa]&&n.push(i.get(a[Pa].id)),o[Pa]&&n.push(i.get(o[Pa].id))),Jy(t,a),e.oldProperties=s,e.changed=n,n},Aa.prototype.postExecute=function(e){var t=e.element,n=t.label,i=n&&Z(n).name;if(i){var r=this._textRenderer.getExternalLabelBounds(n,i);this._modeling.resizeShape(n,r,BA)}},Aa.prototype.revert=function(e){var t=e.element,n=e.properties,i=e.oldProperties,r=t.businessObject,o=this._elementRegistry,a=this._moddle.ids;return Jy(t,i),Qy(n,r)&&(a.unclaim(n[ji]),o.updateId(t,i[ji]),a.claim(i[ji],r)),e.changed};function Qy(e,t){return ji in e&&e[ji]!==t[ji]}function $A(e,t){var n=Ja(t),i=e.businessObject,r=Ye(e);return Cn(n,function(o,a){return a!==Zy?o[a]=i.get(a):o[a]=jA(r,Ja(t.di)),o},{})}function jA(e,t){return Cn(t,function(n,i){return n[i]=e&&e.get(i),n},{})}function Jy(e,t){var n=e.businessObject,i=Ye(e);k(t,function(r,o){o!==Zy?n.set(o,r):i&&FA(i,r)})}function FA(e,t){k(t,function(n,i){e.set(i,n)})}var HA=["default"];function zA(e){var t=I({},e);return HA.forEach(function(n){n in e&&(t[n]=Z(t[n]))}),t}function Ac(e,t){this._canvas=e,this._modeling=t}Ac.$inject=["canvas","modeling"],Ac.prototype.execute=function(e){var t=this._canvas,n=e.newRoot,i=n.businessObject,r=t.getRootElement(),o=r.businessObject,a=o.$parent,s=Ye(r);return t.setRootElement(n),t.removeRootElement(r),Ct(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,[]},Ac.prototype.revert=function(e){var t=this._canvas,n=e.newRoot,i=n.businessObject,r=e.oldRoot,o=r.businessObject,a=i.$parent,s=Ye(n);return t.setRootElement(r),t.removeRootElement(n),Rt(a.rootElements,i),i.$parent=null,Ct(a.rootElements,o),o.$parent=a,n.di=null,s.bpmnElement=o,r.di=s,[]};function $p(e,t){this._modeling=e,this._spaceTool=t}$p.$inject=["modeling","spaceTool"],$p.prototype.preExecute=function(e){var t=this._spaceTool,n=this._modeling,i=e.shape,r=e.location,o=Wn(i),a=o===i,s=a?i:i.parent,c=ar(s),u=qt(i);if(u?r==="left"?r="top":r==="right"&&(r="bottom"):r==="top"?r="left":r==="bottom"&&(r="right"),!c.length){var l=u?{x:i.x+Vn,y:i.y,width:i.width-Vn,height:i.height}:{x:i.x,y:i.y+Vn,width:i.width,height:i.height-Vn};n.createShape({type:"bpmn:Lane",isHorizontal:u},l,s)}var f=[];Lr(o,function(w){return f.push(w),w.label&&f.push(w.label),w===i?[]:Be(w.children,function(S){return S!==i})});var p,d,h,m,g;r==="top"?(p=-120,d=i.y,h=d+10,m="n",g="y"):r==="left"?(p=-120,d=i.x,h=d+10,m="w",g="x"):r==="bottom"?(p=120,d=i.y+i.height,h=d-10,m="s",g="y"):r==="right"&&(p=120,d=i.x+i.width,h=d-10,m="e",g="x");var R=t.calculateAdjustments(f,g,p,h),E=u?{x:0,y:p}:{x:p,y:0};t.makeSpace(R.movingShapes,R.resizingShapes,E,m,h);var x=u?{x:i.x+(a?Vn:0),y:d-(r==="top"?120:0),width:i.width-(a?Vn:0),height:120}:{x:d-(r==="left"?120:0),y:i.y+(a?Vn:0),width:120,height:i.height-(a?Vn:0)};e.newLane=n.createShape({type:"bpmn:Lane",isHorizontal:u},x,s)};function jp(e){this._modeling=e}jp.$inject=["modeling"],jp.prototype.preExecute=function(e){var t=this._modeling,n=e.shape,i=e.count,r=ar(n),o=r.length;if(o>i)throw new Error(`more than <${i}> child lanes`);var a=qt(n),s=a?n.height:n.width,c=Math.round(s/i),u,l,f,p;for(p=0;p<i;p++)p===i-1?u=s-c*p:u=c,l=a?{x:n.x+Vn,y:n.y+p*c,width:n.width-Vn,height:u}:{x:n.x+p*c,y:n.y+Vn,width:u,height:n.height-Vn},p<o?t.resizeShape(r[p],l):(f={type:"bpmn:Lane",isHorizontal:a},t.createShape(f,l,n))};function Ta(e,t){this._modeling=e,this._spaceTool=t}Ta.$inject=["modeling","spaceTool"],Ta.prototype.preExecute=function(e){var t=e.shape,n=e.newBounds,i=e.balanced;i!==!1?this.resizeBalanced(t,n):this.resizeSpace(t,n)},Ta.prototype.resizeBalanced=function(e,t){var n=this._modeling,i=NR(e,t);n.resizeShape(e,t),i.forEach(function(r){n.resizeShape(r.shape,r.newBounds)})},Ta.prototype.resizeSpace=function(e,t){var n=this._spaceTool,i=be(e),r=be(t),o=km(r,i),a=Wn(e),s=[],c=[];Lr(a,function(h){return s.push(h),(v(h,"bpmn:Lane")||v(h,"bpmn:Participant"))&&c.push(h),h.children});var u,l,f,p,d;(o.bottom||o.top)&&(u=o.bottom||o.top,l=e.y+(o.bottom?e.height:0)+(o.bottom?-10:10),f=o.bottom?"s":"n",p=o.top>0||o.bottom<0?-u:u,d=n.calculateAdjustments(s,"y",p,l),n.makeSpace(d.movingShapes,d.resizingShapes,{x:0,y:u},f)),(o.left||o.right)&&(u=o.right||o.left,l=e.x+(o.right?e.width:0)+(o.right?-10:100),f=o.right?"e":"w",p=o.left>0||o.right<0?-u:u,d=n.calculateAdjustments(c,"x",p,l),n.makeSpace(d.movingShapes,d.resizingShapes,{x:u,y:0},f))};var Ma="flowNodeRef",Fp="lanes";function Tc(){}Tc.prototype._computeUpdates=function(e,t){var n=[],i=[],r={},o=[];function a(l,f){var p=be(f),d={x:l.x+l.width/2,y:l.y+l.height/2};return d.x>p.left&&d.x<p.right&&d.y>p.top&&d.y<p.bottom}function s(l){n.indexOf(l)===-1&&(o.push(l),n.push(l))}function c(l){var f=Wn(l);return r[f.id]||(r[f.id]=Us(f)),r[f.id]}function u(l){if(!l.parent)return[];var f=c(l);return f.filter(function(p){return a(l,p)}).map(function(p){return p.businessObject})}return t.forEach(function(l){var f=Wn(l);if(!(!f||n.indexOf(f)!==-1)){var p=f.children.filter(function(d){return v(d,"bpmn:FlowNode")});p.forEach(s),n.push(f)}}),e.forEach(s),o.forEach(function(l){var f=l.businessObject,p=f.get(Fp),d=p.slice(),h=u(l);i.push({flowNode:f,remove:d,add:h})}),t.forEach(function(l){var f=l.businessObject;l.parent||f.get(Ma).forEach(function(p){i.push({flowNode:p,remove:[f],add:[]})})}),i},Tc.prototype.execute=function(e){var t=e.updates;return t||(t=e.updates=this._computeUpdates(e.flowNodeShapes,e.laneShapes)),t.forEach(function(n){var i=n.flowNode,r=i.get(Fp);n.remove.forEach(function(o){Rt(r,o),Rt(o.get(Ma),i)}),n.add.forEach(function(o){Ct(r,o),Ct(o.get(Ma),i)})}),[]},Tc.prototype.revert=function(e){var t=e.updates;return t.forEach(function(n){var i=n.flowNode,r=i.get(Fp);n.add.forEach(function(o){Rt(r,o),Rt(o.get(Ma),i)}),n.remove.forEach(function(o){Ct(r,o),Ct(o.get(Ma),i)})}),[]};var Hp="categoryValueRef";function ka(e,t){this._bpmnFactory=e,this._elementRegistry=t}ka.$inject=["bpmnFactory","elementRegistry"],ka.prototype._computeUpdates=function(e,t){var n=this._elementRegistry,i=this._bpmnFactory,r=new Map,o=[],a=new Map;function s(E,x,w){if(x){var S=a.get(E);S||(S={},a.set(E,S)),!(w&&S.present)&&(!w&&S.past||(w?S.present={categoryValue:x,root:zp(E)}:S.past={categoryValue:x}))}}function c(E){r.set(E,Z(E))}function u(){n.filter(function(E){return v(E,"bpmn:FlowElement")&&!De(E)&&E.parent}).forEach(c)}function l(E){var x=Z(E),w=x.get("categoryValueRef");return w||(w=Cm(i,x),o.push(GA(E,w))),w}function f(E){return E.reduce(function(x,w){var S=zp(w),M=x.get(S);return M||(M=[],x.set(S,M)),M.push(w),x},new Map)}e=Array.from(e||[]);var p=f(e);t.length&&u(),e.forEach(c),n.filter(function(E){return v(E,"bpmn:Group")&&!De(E)&&E.parent}).forEach(function(E){var x=Z(E).get("categoryValueRef");if(!x){var w=zp(E),S=p.get(w)||[],M=uo(S,E),N=Object.keys(M).length>0;N&&(x=l(E))}s(E,x,!0)}),t.forEach(function(E){s(E.groupShape,E.categoryValue,!1)}),o.length&&u();var d=Array.from(r.keys()),h=Array.from(a.values()).reduce(function(E,x){return x.present&&E.add(x.present.categoryValue),x.past&&E.add(x.past.categoryValue),E},new Set),m=new Map,g=f(d);a.forEach(function(E,x){var w=E.present;if(w){var S=g.get(w.root)||[],M=uo(S,x);S.forEach(function(N){if(M[N.id]){var T=m.get(N);T||(T=new Set,m.set(N,T)),T.add(w.categoryValue)}})}});var R=d.reduce(function(E,x){var w=r.get(x),S=w.get(Hp),M=new Set(S),N=m.get(x)||new Set,T=Array.from(N).filter(function(G){return!M.has(G)}),H=S.filter(function(G){return h.has(G)&&!N.has(G)});return(T.length||H.length)&&E.push({businessObject:w,categoryValuesToAdd:T,categoryValuesToRemove:H}),E},[]);return{flowElements:R,groups:o}},ka.prototype.execute=function(e){var t=e.updates;return t||(t=e.updates=this._computeUpdates(e.affectedFlowElements,e.affectedGroupEntries)),VA(t.groups),UA(t.flowElements),[]},ka.prototype.revert=function(e){var t=e.updates;return YA(t.flowElements),WA(t.groups),[]};function GA(e,t){return{groupShape:e,categoryValue:t,category:t.$parent}}function VA(e){e.forEach(function(t){Z(t.groupShape).categoryValueRef=t.categoryValue,t.categoryValue.$parent=t.category})}function WA(e){e.forEach(function(t){Z(t.groupShape).categoryValueRef=null})}function UA(e){e.forEach(function(t){var n=t.businessObject,i=n.get(Hp);t.categoryValuesToRemove.forEach(function(r){Rt(i,r)}),t.categoryValuesToAdd.forEach(function(r){Ct(i,r,!0)})})}function YA(e){e.forEach(function(t){var n=t.businessObject,i=n.get(Hp);t.categoryValuesToAdd.forEach(function(r){Rt(i,r)}),t.categoryValuesToRemove.forEach(function(r){Ct(i,r,!0)})})}function zp(e){for(;e.parent;)e=e.parent;return e}function Mc(e){this._moddle=e}Mc.$inject=["moddle"],Mc.prototype.execute=function(e){var t=this._moddle.ids,n=e.id,i=e.element,r=e.claiming;return r?t.claim(n,i):t.unclaim(n),[]},Mc.prototype.revert=function(e){var t=this._moddle.ids,n=e.id,i=e.element,r=e.claiming;return r?t.unclaim(n):t.claim(n,i),[]};var qA={fill:void 0,stroke:void 0};function Gp(e){this._commandStack=e,this._normalizeColor=function(t){if(t){if(Sn(t)){var n=KA(t);if(n)return n}throw new Error(`invalid color value: ${t}`)}}}Gp.$inject=["commandStack"],Gp.prototype.postExecute=function(e){var t=e.elements,n=e.colors||qA,i=this,r={};"fill"in n&&I(r,{"background-color":this._normalizeColor(n.fill)}),"stroke"in n&&I(r,{"border-color":this._normalizeColor(n.stroke)}),k(t,function(o){var a=ot(o)?ni(r,["border-color"]):r,s=Ye(o);if(XA(a),De(o)){if(!s||!v(s.label,"bpmndi:BPMNLabel"))return;i._commandStack.execute("element.updateModdleProperties",{element:o,moddleElement:s.label,properties:{color:r["border-color"]}})}else{if(!Ie(s,["bpmndi:BPMNEdge","bpmndi:BPMNShape"]))return;i._commandStack.execute("element.updateProperties",{element:o,properties:{di:a}})}})};function KA(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 XA(e){"border-color"in e&&(e.stroke=e["border-color"]),"background-color"in e&&(e.fill=e["background-color"])}var ZA={width:0,height:0};function ev(e,t,n){function i(c,u){var l=c.label||c,f=c.labelTarget||c;return RS(l,u),[l,f]}function r(c){var u=c.element,l=u.businessObject,f=c.newLabel;if(!De(u)&&rr(u)&&!Ds(u)&&!tv(f)){var p=7,d=dl(u);d={x:d.x,y:d.y+p},e.createLabel(u,d,{id:l.id+"_label",businessObject:l,di:u.di})}}function o(c){return c.oldLabel=jn(c.element),i(c.element,c.newLabel)}function a(c){return i(c.element,c.oldLabel)}function s(c){var u=c.element,l=u.label||u,f=c.newLabel,p=c.newBounds,d=c.hints||{};if(!(!De(l)&&!v(l,"bpmn:TextAnnotation"))){if(De(l)&&tv(f)){d.removeShape!==!1&&e.removeShape(l,{unsetLabel:!1});return}var h=jn(u);typeof p>"u"&&(p=t.getExternalLabelBounds(l,h)),p&&e.resizeShape(l,p,ZA)}}this.preExecute=r,this.execute=o,this.revert=a,this.postExecute=s}ev.$inject=["modeling","textRenderer","bpmnFactory"];function tv(e){return!e||!e.trim()}function tn(e,t,n,i){at.call(this,e,t,n),this._bpmnRules=i}ae(tn,at),tn.$inject=["eventBus","elementFactory","commandStack","bpmnRules"],tn.prototype.getHandlers=function(){var e=at.prototype.getHandlers.call(this);return e["element.updateModdleProperties"]=Ca,e["element.updateProperties"]=Aa,e["canvas.updateRoot"]=Ac,e["lane.add"]=$p,e["lane.resize"]=Ta,e["lane.split"]=jp,e["lane.updateRefs"]=Tc,e["group.updateRefs"]=ka,e["id.updateClaim"]=Mc,e["element.setColor"]=Gp,e["element.updateLabel"]=ev,e},tn.prototype.updateLabel=function(e,t,n,i){this._commandStack.execute("element.updateLabel",{element:e,newLabel:t,newBounds:n,hints:i||{}})},tn.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)},tn.prototype.updateModdleProperties=function(e,t,n){this._commandStack.execute("element.updateModdleProperties",{element:e,moddleElement:t,properties:n})},tn.prototype.updateProperties=function(e,t){this._commandStack.execute("element.updateProperties",{element:e,properties:t})},tn.prototype.resizeLane=function(e,t,n){this._commandStack.execute("lane.resize",{shape:e,newBounds:t,balanced:n})},tn.prototype.addLane=function(e,t){var n={shape:e,location:t};return this._commandStack.execute("lane.add",n),n.newLane},tn.prototype.splitLane=function(e,t){this._commandStack.execute("lane.split",{shape:e,count:t})},tn.prototype.makeCollaboration=function(){var e=this._create("root",{type:"bpmn:Collaboration"}),t={newRoot:e};return this._commandStack.execute("canvas.updateRoot",t),e},tn.prototype.makeProcess=function(){var e=this._create("root",{type:"bpmn:Process"}),t={newRoot:e};return this._commandStack.execute("canvas.updateRoot",t),e},tn.prototype.updateLaneRefs=function(e,t){this._commandStack.execute("lane.updateRefs",{flowNodeShapes:e,laneShapes:t})},tn.prototype.updateCategoryValueRefs=function(e,t){this._commandStack.execute("group.updateRefs",{affectedFlowElements:e,affectedGroupEntries:t})},tn.prototype.claimId=function(e,t){this._commandStack.execute("id.updateClaim",{id:e,element:t,claiming:!0})},tn.prototype.unclaimId=function(e,t){this._commandStack.execute("id.updateClaim",{id:e,element:t})},tn.prototype.setColor=function(e,t){e.length||(e=[e]),this._commandStack.execute("element.setColor",{elements:e,colors:t})};function nv(){}nv.prototype.layoutConnection=function(e,t){return t=t||{},[t.connectionStart||Ee(t.source||e.source),t.connectionEnd||Ee(t.target||e.target)]};var kc=20,QA=5,Oc=Math.round,iv=20,JA={"h:h":20,"v:v":20,"h:v":-10,"v:h":-10};function eT(e,t){return!{t:/top/,r:/right/,b:/bottom/,l:/left/,h:/./,v:/./}[t].test(e)}function tT(e,t){return{t:/top/,r:/right/,b:/bottom/,l:/left/,h:/left|right/,v:/top|bottom/}[e].test(t)}function rv(e,t,n){var i=Qt(t,e,QA),r=n.split(":")[0],o=Oc((t.x-e.x)/2+e.x),a=Oc((t.y-e.y)/2+e.y),s,c,u=tT(r,i),l=/h|r|l/.test(r),f=!1,p=!1;return u?(s=l?{x:o,y:e.y}:{x:e.x,y:a},c=l?"h:h":"v:v"):(f=eT(i,r),c=l?"h:v":"v:h",f?l?(p=a===e.y,s={x:e.x+kc*(/l/.test(r)?-1:1),y:p?a+kc:a}):(p=o===e.x,s={x:p?o+kc:o,y:e.y+kc*(/t/.test(r)?-1:1)}):s={x:o,y:a}),{waypoints:Vp(e,s,c).concat(s),directions:c,turnNextDirections:p}}function nT(e,t,n){return rv(e,t,n)}function iT(e,t,n){var i=rv(t,e,ov(n));return{waypoints:i.waypoints.slice().reverse(),directions:ov(i.directions),turnNextDirections:i.turnNextDirections}}function rT(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=Vp(e.waypoints[e.waypoints.length-1],t.waypoints[0],r);return{waypoints:o,directions:r}}function ov(e){return e.split(":").reverse().join(":")}function oT(e,t,n){var i=Oc((t.x-e.x)/2+e.x),r=Oc((t.y-e.y)/2+e.y);if(n==="h:v")return[{x:t.x,y:e.y}];if(n==="v:h")return[{x:e.x,y:t.y}];if(n==="h:h")return[{x:i,y:e.y},{x:i,y:t.y}];if(n==="v:v")return[{x:e.x,y:r},{x:t.x,y:r}];throw new Error("invalid directions: can only handle varians of [hv]:[hv]")}function Vp(e,t,n){if(n=n||"h:h",!hT(n))throw new Error("unknown directions: <"+n+">: must be specified as <start>:<end> with start/end in { h,v,t,r,b,l }");if(sv(n)){var i=nT(e,t,n),r=iT(e,t,n),o=rT(i,r);return[].concat(i.waypoints,o.waypoints,r.waypoints)}return oT(e,t,n)}function aT(e,t,n){var i=Vp(e,t,n);return i.unshift(e),i.push(t),uv(i)}function sT(e,t,n,i,r){var o=r&&r.preferredLayouts||[],a=u0(o,"straight")[0]||"h:h",s=JA[a]||0,c=Qt(e,t,s),u=dT(c,a);n=n||Ee(e),i=i||Ee(t);var l=u.split(":"),f=cv(n,e,l[0],mT(c)),p=cv(i,t,l[1],c);return aT(f,p,u)}function cT(e,t,n,i,r,o){we(n)&&(r=n,o=i,n=Ee(e),i=Ee(t)),o=I({preferredLayouts:[]},o),r=r||[];var a=o.preferredLayouts,s=a.indexOf("straight")!==-1,c;return c=s&&lT(e,t,n,i,o),c||(c=o.connectionEnd&&fT(t,e,i,r),c)||(c=o.connectionStart&&pT(e,t,n,r),c)?c:!o.connectionStart&&!o.connectionEnd&&r&&r.length?r:sT(e,t,n,i,o)}function uT(e,t,n){return e>=t&&e<=n}function av(e,t,n){var i={x:"width",y:"height"};return uT(t[e],n[e],n[e]+n[i[e]])}function lT(e,t,n,i,r){var o={},a,s;return s=Qt(e,t),/^(top|bottom|left|right)$/.test(s)?(/top|bottom/.test(s)&&(a="x"),/left|right/.test(s)&&(a="y"),r.preserveDocking==="target"?av(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:av(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 pT(e,t,n,i){return Wp(e,t,n,i)}function fT(e,t,n,i){var r=i.slice().reverse();return r=Wp(e,t,n,r),r?r.reverse():null}function Wp(e,t,n,i){function r(l){return l.length<3?!0:l.length>4?!1:!!ut(l,function(f,p){var d=l[p-1];return d&&ta(f,d)<3})}function o(l,f,p){var d=Mi(f,l);switch(d){case"v":return{x:p.x,y:l.y};case"h":return{x:l.x,y:p.y}}return{x:l.x,y:l.y}}function a(l,f,p){var d;for(d=l.length-2;d!==0;d--)if(Oh(l[d],f,iv)||Oh(l[d],p,iv))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=Wp(e,t,n,u)),c&&Mi(c)?null:c}function dT(e,t){if(sv(t))return t;switch(e){case"intersect":return"t:t";case"top":case"bottom":return"v:v";case"left":case"right":return"h:h";default:return t}}function hT(e){return e&&/^h|v|t|r|b|l:h|v|t|r|b|l$/.test(e)}function sv(e){return e&&/t|r|b|l/.test(e)}function mT(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 cv(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 uv(e){return e.reduce(function(t,n,i){var r=t[t.length-1],o=e[i+1];return cl(r,o,n,0)||t.push(n),t},[])}var gT=-10,yT=40,vT={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},_T={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},Up={top:"bottom","top-right":"bottom-left","top-left":"bottom-right",right:"left",bottom:"top","bottom-right":"top-left","bottom-left":"top-right",left:"right"},Oa={top:"t",right:"r",bottom:"b",left:"l"};function Dc(e){this._elementRegistry=e}ae(Dc,nv),Dc.prototype.layoutConnection=function(e,t){t||(t={});var n=t.source||e.source,i=t.target||e.target,r=t.waypoints||e.waypoints,o=t.connectionStart,a=t.connectionEnd,s=this._elementRegistry,c,u;if(o||(o=lv(r&&r[0],n)),a||(a=lv(r&&r[r.length-1],i)),(v(e,"bpmn:Association")||v(e,"bpmn:DataAssociation"))&&r&&!pv(n,i))return[].concat([o],r.slice(1,-1),[a]);var l=wm(n,s)?vT:_T;return v(e,"bpmn:MessageFlow")?c=xT(n,i,l):(v(e,"bpmn:SequenceFlow")||pv(n,i))&&(n===i?c={preferredLayouts:PT(n,e,l)}:v(n,"bpmn:BoundaryEvent")?c={preferredLayouts:AT(n,i,a,l)}:Da(n)||Da(i)?c={preferredLayouts:l.subProcess,preserveDocking:ET(n)}:v(n,"bpmn:Gateway")?c={preferredLayouts:l.fromGateway}:v(i,"bpmn:Gateway")?c={preferredLayouts:l.toGateway}:c={preferredLayouts:l.default}),c&&(c=I(c,t),u=uv(cT(n,i,o,a,r,c))),u||[o,a]};function bT(e){var t=e.host;return Qt(Ee(e),t,gT)}function xT(e,t,n){return{preferredLayouts:n.messageFlow,preserveDocking:wT(e,t)}}function wT(e,t){return v(t,"bpmn:Participant")?"source":v(e,"bpmn:Participant")?"target":Da(t)?"source":Da(e)||v(t,"bpmn:Event")?"target":v(e,"bpmn:Event")?"source":null}function ET(e){return Da(e)?"target":"source"}function lv(e,t){return e?e.original||e:Ee(t)}function pv(e,t){return v(t,"bpmn:Activity")&&v(e,"bpmn:BoundaryEvent")&&t.businessObject.isForCompensation}function Da(e){return v(e,"bpmn:SubProcess")&&He(e)}function Gr(e,t){return e===t}function ST(e,t){return t.indexOf(e)!==-1}function To(e){var t=/right|left/.exec(e);return t&&t[0]}function Mo(e){var t=/top|bottom/.exec(e);return t&&t[0]}function fv(e,t){return Up[e]===t}function RT(e,t){var n=To(e),i=Up[n];return t.indexOf(i)!==-1}function CT(e,t){var n=Mo(e),i=Up[n];return t.indexOf(i)!==-1}function dv(e){return e==="right"||e==="left"}function PT(e,t,n){var i=t.waypoints,r=i&&i.length&&Qt(i[0],e);return r==="top"?n.loop.fromTop:r==="right"?n.loop.fromRight:r==="left"?n.loop.fromLeft:n.loop.fromBottom}function AT(e,t,n,i){var r=Ee(e),o=Ee(t),a=bT(e),s,c,u=Gr(e.host,t),l=ST(a,["top","right","bottom","left"]),f=Qt(o,r,{x:e.width/2+t.width/2,y:e.height/2+t.height/2});return u?TT(a,l,e,t,n,i):(s=MT(a,f,l,i.isHorizontal),c=kT(a,f,l,i.isHorizontal),[s+":"+c])}function TT(e,t,n,i,r,o){var a=t?e:o.isHorizontal?Mo(e):To(e),s=Oa[a],c;return t?dv(e)?c=hv("y",n,i,r)?"h":o.boundaryLoop.alternateHorizontalSide:c=hv("x",n,i,r)?"v":o.boundaryLoop.alternateVerticalSide:c=o.boundaryLoop.default,[s+":"+c]}function hv(e,t,n,i){var r=yT;return!(Yp(e,i,n,r)||Yp(e,i,{x:n.x+n.width,y:n.y+n.height},r)||Yp(e,i,Ee(t),r))}function Yp(e,t,n,i){return Math.abs(t[e]-n[e])<i}function MT(e,t,n,i){if(n)return Oa[e];var r=Mo(e),o=To(e),a=Mo(t),s=To(t);if(i){if(Gr(r,a)||fv(o,s))return Oa[r]}else if(Gr(o,s)||fv(r,a))return Oa[o];return Oa[i?o:r]}function kT(e,t,n,i){if(n)return dv(e)?RT(e,t)||Gr(e,t)?"h":"v":CT(e,t)||Gr(e,t)?"v":"h";var r=Mo(e),o=To(e),a=Mo(t),s=To(t);return a&&!s?"v":s&&!a?"h":i?Gr(r,a)?"h":"v":Gr(o,s)?"v":"h"}Dc.$inject=["elementRegistry"];function mv(e){return I({original:e.point.original||e.point},e.actual)}function mr(e,t){this._elementRegistry=e,this._graphicsFactory=t}mr.$inject=["elementRegistry","graphicsFactory"],mr.prototype.getCroppedWaypoints=function(e,t,n){t=t||e.source,n=n||e.target;var i=this.getDockingPoint(e,t,!0),r=this.getDockingPoint(e,n),o=e.waypoints.slice(i.idx+1,r.idx);return o.unshift(mv(i)),o.push(mv(r)),o},mr.prototype.getDockingPoint=function(e,t,n){var i=e.waypoints,r,o,a;return r=n?0:i.length-1,o=i[r],a=this._getIntersection(t,e,n),{point:o,actual:a||o,idx:r}},mr.prototype._getIntersection=function(e,t,n){var i=this._getShapePath(e),r=this._getConnectionPath(t);return na(i,r,n)},mr.prototype._getConnectionPath=function(e){return this._graphicsFactory.getConnectionPath(e)},mr.prototype._getShapePath=function(e){return this._graphicsFactory.getShapePath(e)},mr.prototype._getGfx=function(e){return this._elementRegistry.getGraphics(e)};const qp={__init__:["modeling","bpmnUpdater"],__depends__:[XC,fP,hP,mP,Py,gA,vA,SA,Yn,kp,Dy],bpmnFactory:["type",Kn],bpmnUpdater:["type",Dn],elementFactory:["type",fr],modeling:["type",tn],layouter:["type",Dc],connectionDocking:["type",mr]};var OT=10,gv=50,DT=250;function Kp(e,t,n,i){for(var r;r=LT(e,n,t);)n=i(t,n,r);return n}function Xp(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 LT(e,t,n){var i={x:t.x-n.width/2,y:t.y-n.height/2,width:n.width,height:n.height},r=NT(e);return ut(r,function(o){if(o===n)return!1;var a=Qt(o,i,OT);return a==="intersect"})}function IT(e,t){t||(t={});function n(h){return h.source===e?1:-1}var i=t.defaultDistance||gv,r=t.direction||"e",o=t.filter,a=t.getWeight||n,s=t.maxDistance||DT,c=t.reference||"start";o||(o=jT);function u(h,m){return r==="n"?c==="start"?be(h).top-be(m).bottom:c==="center"?be(h).top-Ee(m).y:be(h).top-be(m).top:r==="w"?c==="start"?be(h).left-be(m).right:c==="center"?be(h).left-Ee(m).x:be(h).left-be(m).left:r==="s"?c==="start"?be(m).top-be(h).bottom:c==="center"?Ee(m).y-be(h).bottom:be(m).bottom-be(h).bottom:c==="start"?be(m).left-be(h).right:c==="center"?Ee(m).x-be(h).right:be(m).right-be(h).right}var l=e.incoming.filter(o).map(function(h){var m=a(h),g=m<0?u(h.source,e):u(e,h.source);return{id:h.source.id,distance:g,weight:m}}),f=e.outgoing.filter(o).map(function(h){var m=a(h),g=m>0?u(e,h.target):u(h.target,e);return{id:h.target.id,distance:g,weight:m}}),p=l.concat(f).reduce(function(h,m){return h[m.id+"__weight_"+m.weight]=m,h},{}),d=Cn(p,function(h,m){var g=m.distance,R=m.weight;return g<0||g>s||(h[String(g)]||(h[String(g)]=0),h[String(g)]+=1*R,(!h.distance||h[h.distance]<h[String(g)])&&(h.distance=g)),h},{});return d.distance||i}function NT(e){var t=Zp(e);return e.host&&(t=t.concat(Zp(e.host))),e.attachers&&(t=t.concat(e.attachers.reduce(function(n,i){return n.concat(Zp(i))},[]))),t}function Zp(e){return $T(e).concat(BT(e))}function BT(e){return e.incoming.map(function(t){return t.source})}function $T(e){return e.outgoing.map(function(t){return t.target})}function jT(){return!0}var FT=100;function yv(e,t,n){e.on("autoPlace",FT,function(i){var r=i.shape,o=i.source;return HT(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}}yv.$inject=["eventBus","modeling","canvas"];function HT(e,t,n){n||(n={});var i=n.defaultDistance||gv,r=Ee(e),o=be(e);return{x:o.right+i+t.width/2,y:r.y}}function vv(e,t){e.on("autoPlace.end",500,function(n){t.select(n.shape)})}vv.$inject=["eventBus","selection"];const zT={__init__:["autoPlaceSelectionBehavior"],autoPlace:["type",yv],autoPlaceSelectionBehavior:["type",vv]};function _v(e,t,n){var i=wm(e,n);if(v(t,"bpmn:TextAnnotation"))return VT(e,t,i);if(Ie(t,["bpmn:DataObjectReference","bpmn:DataStoreReference"]))return WT(e,t,i);if(v(t,"bpmn:FlowNode"))return GT(e,t,i)}function GT(e,t,n){var i=be(e),r=Ee(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=IT(e,{filter:function(d){return v(d,"bpmn:SequenceFlow")},direction:o.directionHint}),s=30,c=o.minDistance,u=o.baseOrientation;v(e,"bpmn:BoundaryEvent")&&(u=Qt(e,e.host,-25),u.indexOf(o.boundaryOrientation)!==-1&&(s*=-1));var l=n?{x:i.right+a+t.width/2,y:r.y+bv(u,c,o)}:{x:r.x+bv(u,c,o),y:i.bottom+a+t.height/2},f={margin:s,minDistance:c},p=n?{y:f}:{x:f};return Kp(e,t,l,Xp(p))}function bv(e,t,n){return e.includes(n.start)?-1*t:e.includes(n.end)?t:0}function VT(e,t,n){var i=be(e),r=n?{x:i.right+t.width/2,y:i.top-50-t.height/2}:{x:i.right+50+t.width/2,y:i.bottom+t.height/2};ot(e)&&(r=Ee(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 Kp(e,t,r,Xp(a))}function WT(e,t,n){var i=be(e),r=n?{x:i.right-10+t.width/2,y:i.bottom+40+t.width/2}:{x:i.left-40-t.width/2,y:i.bottom-10+t.height/2},o={margin:30,minDistance:30},a=n?{x:o}:{y:o};return Kp(e,t,r,Xp(a))}function xv(e,t){e.on("autoPlace",function(n){var i=n.shape,r=n.source;return _v(r,i,t)})}xv.$inject=["eventBus","elementRegistry"];const Lc={__depends__:[zT],__init__:["bpmnAutoPlace"],bpmnAutoPlace:["type",xv]},wv=[bm,ca,qp,Lc];function UT(e={}){bd(globalThis,e.dom);const t=document.createElement("div");return document.body.appendChild(t),new fo({container:t,moddleExtensions:e.moddleExtensions??as,additionalModules:[...wv,...e.additionalModules??[]]})}var YT=new Po("ov"),qT=500;function Kt(e,t,n,i){this._eventBus=t,this._canvas=n,this._elementRegistry=i,this._ids=YT,this._overlayDefaults=I({show:null,scale:!0},e&&e.defaults),this._overlays={},this._overlayContainers=[],this._overlayRoot=KT(n.getContainer()),this._init()}Kt.$inject=["config.overlays","eventBus","canvas","elementRegistry"],Kt.prototype.get=function(e){if(Sn(e)&&(e={id:e}),Sn(e.element)&&(e.element=this._elementRegistry.get(e.element)),e.element){var t=this._getOverlayContainer(e.element,!0);return t?e.type?Be(t.overlays,no({type:e.type})):t.overlays.slice():[]}else return e.type?Be(this._overlays,no({type:e.type})):e.id?this._overlays[e.id]:null},Kt.prototype.add=function(e,t,n){if(Ut(t)&&(n=t,t=null),e.id||(e=this._elementRegistry.get(e)),!n.position)throw new Error("must specifiy overlay position");if(!n.html)throw new Error("must specifiy overlay html");if(!e)throw new Error("invalid element specified");var i=this._ids.next();return n=I({},this._overlayDefaults,n,{id:i,type:t,element:e,html:n.html}),this._addOverlay(n),i},Kt.prototype.remove=function(e){var t=this.get(e)||[];we(t)||(t=[t]);var n=this;k(t,function(i){var r=n._getOverlayContainer(i.element,!0);if(i&&(pi(i.html),pi(i.htmlContainer),delete i.htmlContainer,delete i.element,delete n._overlays[i.id]),r){var o=r.overlays.indexOf(i);o!==-1&&r.overlays.splice(o,1)}})},Kt.prototype.isShown=function(){return this._overlayRoot.style.display!=="none"},Kt.prototype.show=function(){Ic(this._overlayRoot)},Kt.prototype.hide=function(){Ic(this._overlayRoot,!1)},Kt.prototype.clear=function(){this._overlays={},this._overlayContainers=[],vs(this._overlayRoot)},Kt.prototype._updateOverlayContainer=function(e){var t=e.element,n=e.html,i=t.x,r=t.y;if(t.waypoints){var o=Mt(t);i=o.x,r=o.y}Ev(n,i,r),cn(e.html,"data-container-id",t.id)},Kt.prototype._updateOverlay=function(e){var t=e.position,n=e.htmlContainer,i=e.element,r=t.left,o=t.top;if(t.right!==void 0){var a;i.waypoints?a=Mt(i).width:a=i.width,r=t.right*-1+a}if(t.bottom!==void 0){var s;i.waypoints?s=Mt(i).height:s=i.height,o=t.bottom*-1+s}Ev(n,r||0,o||0),this._updateOverlayVisibilty(e,this._canvas.viewbox())},Kt.prototype._createOverlayContainer=function(e){var t=pt('<div class="djs-overlays" />');yn(t,{position:"absolute"}),this._overlayRoot.appendChild(t);var n={html:t,element:e,overlays:[]};return this._updateOverlayContainer(n),this._overlayContainers.push(n),n},Kt.prototype._updateRoot=function(e){var t=e.scale||1,n="matrix("+[t,0,0,t,-1*e.x*t,-1*e.y*t].join(",")+")";Sv(this._overlayRoot,n)},Kt.prototype._getOverlayContainer=function(e,t){var n=ut(this._overlayContainers,function(i){return i.element===e});return!n&&!t?this._createOverlayContainer(e):n},Kt.prototype._addOverlay=function(e){var t=e.id,n=e.element,i=e.html,r,o;i.get&&i.constructor.prototype.jquery&&(i=i.get(0)),Sn(i)&&(i=pt(i)),o=this._getOverlayContainer(n),r=pt('<div class="djs-overlay" data-overlay-id="'+t+'">'),yn(r,{position:"absolute"}),r.appendChild(i),e.type&&yt(r).add("djs-overlay-"+e.type);var a=this._canvas.findRoot(n),s=this._canvas.getRootElement();Ic(r,a===s),e.htmlContainer=r,o.overlays.push(e),o.html.appendChild(r),this._overlays[t]=e,this._updateOverlay(e),this._updateOverlayVisibilty(e,this._canvas.viewbox())},Kt.prototype._updateOverlayVisibilty=function(e,t){var n=e.show,i=this._canvas.findRoot(e.element),r=n&&n.minZoom,o=n&&n.maxZoom,a=e.htmlContainer,s=this._canvas.getRootElement(),c=!0;(i!==s||n&&(Ft(r)&&r>t.scale||Ft(o)&&o<t.scale))&&(c=!1),Ic(a,c),this._updateOverlayScale(e,t)},Kt.prototype._updateOverlayScale=function(e,t){var n=e.scale,i,r,o=e.htmlContainer,a,s="";n!==!0&&(n===!1?(i=1,r=1):(i=n.min,r=n.max),Ft(i)&&t.scale<i&&(a=(1/t.scale||1)*i),Ft(r)&&t.scale>r&&(a=(1/t.scale||1)*r)),Ft(a)&&(s="scale("+a+","+a+")"),Sv(o,s)},Kt.prototype._updateOverlaysVisibilty=function(e){var t=this;k(this._overlays,function(n){t._updateOverlayVisibilty(n,e)})},Kt.prototype._init=function(){var e=this._eventBus,t=this;function n(i){t._updateRoot(i),t._updateOverlaysVisibilty(i),t.show()}e.on("canvas.viewbox.changing",function(i){t.hide()}),e.on("canvas.viewbox.changed",function(i){n(i.viewbox)}),e.on(["shape.remove","connection.remove"],function(i){var r=i.element,o=t.get({element:r});k(o,function(c){t.remove(c.id)});var a=t._getOverlayContainer(r);if(a){pi(a.html);var s=t._overlayContainers.indexOf(a);s!==-1&&t._overlayContainers.splice(s,1)}}),e.on("element.changed",qT,function(i){var r=i.element,o=t._getOverlayContainer(r,!0);o&&(k(o.overlays,function(a){t._updateOverlay(a)}),t._updateOverlayContainer(o))}),e.on("element.marker.update",function(i){var r=t._getOverlayContainer(i.element,!0);r&&yt(r.html)[i.add?"add":"remove"](i.marker)}),e.on("root.set",function(){t._updateOverlaysVisibilty(t._canvas.viewbox())}),e.on("diagram.clear",this.clear,this)};function KT(e){var t=pt('<div class="djs-overlay-container" />');return yn(t,{position:"absolute",width:0,height:0}),e.insertBefore(t,e.firstChild),t}function Ev(e,t,n){yn(e,{left:t+"px",top:n+"px"})}function Ic(e,t){e.style.display=t===!1?"none":""}function Sv(e,t){e.style["transform-origin"]="top left",["","-ms-","-webkit-"].forEach(function(n){e.style[n+"transform"]=t})}const Nc={__init__:["overlays"],overlays:["type",Kt]};function Qp(e,t){t.invoke(X,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)})}ae(Qp,X),Qp.$inject=["canvas","injector"];const XT={__init__:["rootElementsBehavior"],rootElementsBehavior:["type",Qp]};function La(e){return CSS.escape(e)}var ZT={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"};function Rv(e){return e=""+e,e&&e.replace(/[&<>"']/g,function(t){return ZT[t]})}var QT="bjs-breadcrumbs-shown";function Cv(e,t,n){var i=pt('<ul class="bjs-breadcrumbs"></ul>'),r=n.getContainer(),o=yt(r);r.appendChild(i);var a=[];e.on("element.changed",function(c){var u=c.element,l=Z(u),f=ut(a,function(p){return p===l});f&&s()});function s(c){c&&(a=JT(c));var u=a.flatMap(function(f){var p=n.findRoot(gi(f))||n.findRoot(f.id);if(!p&&v(f,"bpmn:Process")){var d=t.find(function(g){var R=Z(g);return R&&R.get("processRef")===f});p=d&&n.findRoot(d.id)}if(!p)return[];var h=Rv(f.name||f.id),m=pt('<li><span class="bjs-crumb"><a title="'+h+'">'+h+"</a></span></li>");return m.addEventListener("click",function(){n.setRootElement(p)}),m});i.innerHTML="";var l=u.length>1;o.toggle(QT,l),u.forEach(function(f){i.appendChild(f)})}e.on("root.set",function(c){s(c.element)})}Cv.$inject=["eventBus","elementRegistry","canvas"];function JT(e){for(var t=Z(e),n=[],i=t;i;i=i.$parent)(v(i,"bpmn:SubProcess")||v(i,"bpmn:Process"))&&n.push(i);return n.reverse()}function Pv(e,t){var n=null,i=new eM;e.on("root.set",function(r){var o=r.element,a=t.viewbox(),s=i.get(o);if(i.set(n,{x:a.x,y:a.y,zoom:a.scale}),n=o,!(!v(o,"bpmn:SubProcess")&&!s)){s=s||{x:0,y:0,zoom:1};var c=(a.x-s.x)*a.scale,u=(a.y-s.y)*a.scale;(c!==0||u!==0)&&t.scroll({dx:c,dy:u}),s.zoom!==a.scale&&t.zoom(s.zoom,{x:0,y:0})}}),e.on("diagram.clear",function(){i.clear(),n=null})}Pv.$inject=["eventBus","canvas"];function eM(){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 Av={x:180,y:160};function Vr(e,t){this._eventBus=e,this._moddle=t;var n=this;e.on("import.render.start",1500,function(i,r){n._handleImport(r.definitions)})}Vr.prototype._handleImport=function(e){if(e.diagrams){var t=this;this._definitions=e,this._processToDiagramMap={},e.diagrams.forEach(function(i){!i.plane||!i.plane.bpmnElement||(t._processToDiagramMap[i.plane.bpmnElement.id]=i)});var n=e.diagrams.filter(i=>i.plane).flatMap(i=>t._createNewDiagrams(i.plane));n.forEach(function(i){t._movePlaneElementsToOrigin(i.plane)})}},Vr.prototype._createNewDiagrams=function(e){var t=this,n=[],i=[];e.get("planeElement").forEach(function(o){var a=o.bpmnElement;if(a){var s=a.$parent;v(a,"bpmn:SubProcess")&&!o.isExpanded&&n.push(a),nM(a,e)&&i.push({diElement:o,parent:s})}});var r=[];return n.forEach(function(o){if(!t._processToDiagramMap[o.id]){var a=t._createDiagram(o);t._processToDiagramMap[o.id]=a,r.push(a)}}),i.forEach(function(o){for(var a=o.diElement,s=o.parent;s&&n.indexOf(s)===-1;)s=s.$parent;if(s){var c=t._processToDiagramMap[s.id];t._moveToDiPlane(a,c.plane)}}),r},Vr.prototype._movePlaneElementsToOrigin=function(e){var t=e.get("planeElement"),n=tM(e),i={x:n.x-Av.x,y:n.y-Av.y};t.forEach(function(r){r.waypoint?r.waypoint.forEach(function(o){o.x=o.x-i.x,o.y=o.y-i.y}):r.bounds&&(r.bounds.x=r.bounds.x-i.x,r.bounds.y=r.bounds.y-i.y)})},Vr.prototype._moveToDiPlane=function(e,t){var n=Tv(e),i=n.plane.get("planeElement");i.splice(i.indexOf(e),1),t.get("planeElement").push(e)},Vr.prototype._createDiagram=function(e){var t=this._moddle.create("bpmndi:BPMNPlane",{bpmnElement:e}),n=this._moddle.create("bpmndi:BPMNDiagram",{plane:t});return t.$parent=n,t.bpmnElement=e,n.$parent=this._definitions,this._definitions.diagrams.push(n),n},Vr.$inject=["eventBus","moddle"];function Tv(e){return v(e,"bpmndi:BPMNDiagram")?e:Tv(e.$parent)}function tM(e){var t={top:1/0,right:-1/0,bottom:-1/0,left:1/0};return e.planeElement.forEach(function(n){if(n.bounds){var i=be(n.bounds);t.top=Math.min(i.top,t.top),t.left=Math.min(i.left,t.left)}}),Ps(t)}function nM(e,t){var n=e.$parent;return!(!v(n,"bpmn:SubProcess")||n===t.bpmnElement||Ie(e,["bpmn:DataInputAssociation","bpmn:DataOutputAssociation"]))}var Bc=250,iM='<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 16 16"><path fill-rule="evenodd" d="M4.81801948,3.50735931 L10.4996894,9.1896894 L10.5,4 L12,4 L12,12 L4,12 L4,10.5 L9.6896894,10.4996894 L3.75735931,4.56801948 C3.46446609,4.27512627 3.46446609,3.80025253 3.75735931,3.50735931 C4.05025253,3.21446609 4.52512627,3.21446609 4.81801948,3.50735931 Z"/></svg>',rM="bjs-drilldown-empty";function gr(e,t,n,i,r){X.call(this,t),this._canvas=e,this._eventBus=t,this._elementRegistry=n,this._overlays=i,this._translate=r;var o=this;this.executed("shape.toggleCollapse",Bc,function(a){var s=a.shape;o._canDrillDown(s)?o._addOverlay(s):o._removeOverlay(s)},!0),this.reverted("shape.toggleCollapse",Bc,function(a){var s=a.shape;o._canDrillDown(s)?o._addOverlay(s):o._removeOverlay(s)},!0),this.executed(["shape.create","shape.move","shape.delete"],Bc,function(a){var s=a.oldParent,c=a.newParent||a.parent,u=a.shape;o._canDrillDown(u)&&o._addOverlay(u),o._updateDrilldownOverlay(s),o._updateDrilldownOverlay(c),o._updateDrilldownOverlay(u)},!0),this.reverted(["shape.create","shape.move","shape.delete"],Bc,function(a){var s=a.oldParent,c=a.newParent||a.parent,u=a.shape;o._canDrillDown(u)&&o._addOverlay(u),o._updateDrilldownOverlay(s),o._updateDrilldownOverlay(c),o._updateDrilldownOverlay(u)},!0),t.on("import.render.complete",function(){n.filter(function(a){return o._canDrillDown(a)}).map(function(a){o._addOverlay(a)})})}ae(gr,X),gr.prototype._updateDrilldownOverlay=function(e){var t=this._canvas;if(e){var n=t.findRoot(e);n&&this._updateOverlayVisibility(n)}},gr.prototype._canDrillDown=function(e){var t=this._canvas;return v(e,"bpmn:SubProcess")&&t.findRoot(gi(e))},gr.prototype._updateOverlayVisibility=function(e){var t=this._overlays,n=Z(e),i=t.get({element:n.id,type:"drilldown"})[0];if(i){var r=n&&n.get("flowElements")&&n.get("flowElements").length;yt(i.html).toggle(rM,!r)}},gr.prototype._addOverlay=function(e){var t=this._canvas,n=this._overlays,i=Z(e),r=n.get({element:e,type:"drilldown"});r.length&&this._removeOverlay(e);var o=pt('<button type="button" class="bjs-drilldown">'+iM+"</button>"),a=i.get("name")||i.get("id"),s=this._translate("Open {element}",{element:a});o.setAttribute("title",s),o.addEventListener("click",function(){t.setRootElement(t.findRoot(gi(e)))}),n.add(e,"drilldown",{position:{bottom:-7,right:-8},html:o}),this._updateOverlayVisibility(e)},gr.prototype._removeOverlay=function(e){var t=this._overlays;t.remove({element:e,type:"drilldown"})},gr.$inject=["canvas","eventBus","elementRegistry","overlays","translate"];const oM={__depends__:[Nc,kp,XT],__init__:["drilldownBreadcrumbs","drilldownOverlayBehavior","drilldownCentering","subprocessCompatibility"],drilldownBreadcrumbs:["type",Cv],drilldownCentering:["type",Pv],drilldownOverlayBehavior:["type",gr],subprocessCompatibility:["type",Vr]};function yr(e){bt.call(this,e)}ae(yr,bt),yr.prototype._modules=[bm,oM,Nc,Yn,ca],yr.prototype._moddleExtensions={};var $c="keyboard.keydown",aM="keyboard.keyup",sM=1e3,Mv="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 vn(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(Mv));var i=e&&e.bind!==!1;t.on("canvas.init",function(r){n._target=r.svg,i&&n.bind(),n._fire("init")})}vn.$inject=["config.keyboard","eventBus"],vn.prototype._keydownHandler=function(e){this._keyHandler(e,$c)},vn.prototype._keyupHandler=function(e){this._keyHandler(e,aM)},vn.prototype._keyHandler=function(e,t){var n;if(!this._isEventIgnored(e)){var i={keyEvent:e};n=this._eventBus.fire(t||$c,i),n&&e.preventDefault()}},vn.prototype._isEventIgnored=function(e){return!1},vn.prototype.bind=function(e){e&&console.error("unsupported argument <node>",new Error(Mv)),this.unbind(),e=this._node=this._target,Ae.bind(e,"keydown",this._keydownHandler),Ae.bind(e,"keyup",this._keyupHandler),this._fire("bind")},vn.prototype.getBinding=function(){return this._node},vn.prototype.unbind=function(){var e=this._node;e&&(this._fire("unbind"),Ae.unbind(e,"keydown",this._keydownHandler),Ae.unbind(e,"keyup",this._keyupHandler)),this._node=null},vn.prototype._fire=function(e){this._eventBus.fire("keyboard."+e,{node:this._node})},vn.prototype.addListener=function(e,t,n){Yt(e)&&(n=t,t=e,e=sM),this._eventBus.on(n||$c,e,t)},vn.prototype.removeListener=function(e,t){this._eventBus.off(t||$c,e)},vn.prototype.hasModifier=AP,vn.prototype.isCmd=kn,vn.prototype.isShift=bp,vn.prototype.isKey=Gt;var cM=500;function ko(e,t){var n=this;e.on("editorActions.init",cM,function(i){var r=i.editorActions;n.registerBindings(t,r)})}ko.$inject=["eventBus","keyboard"],ko.prototype.registerBindings=function(e,t){function n(i,r){t.isRegistered(i)&&e.addListener(r)}n("undo",function(i){var r=i.keyEvent;if(DP(r))return t.trigger("undo"),!0}),n("redo",function(i){var r=i.keyEvent;if(LP(r))return t.trigger("redo"),!0}),n("copy",function(i){var r=i.keyEvent;if(TP(r))return t.trigger("copy"),!0}),n("paste",function(i){var r=i.keyEvent;if(MP(r))return t.trigger("paste"),!0}),n("duplicate",function(i){var r=i.keyEvent;if(kP(r))return t.trigger("duplicate"),!0}),n("cut",function(i){var r=i.keyEvent;if(OP(r))return t.trigger("cut"),!0}),n("stepZoom",function(i){var r=i.keyEvent;if(Gt(["+","Add","="],r)&&kn(r))return t.trigger("stepZoom",{value:1}),!0}),n("stepZoom",function(i){var r=i.keyEvent;if(Gt(["-","Subtract"],r)&&kn(r))return t.trigger("stepZoom",{value:-1}),!0}),n("zoom",function(i){var r=i.keyEvent;if(Gt("0",r)&&kn(r))return t.trigger("zoom",{value:1}),!0}),n("removeSelection",function(i){var r=i.keyEvent;if(Gt(["Backspace","Delete","Del"],r))return t.trigger("removeSelection"),!0})};const Jp={__init__:["keyboard","keyboardBindings"],keyboard:["type",vn],keyboardBindings:["type",ko]};var uM={moveSpeed:50,moveSpeedAccelerated:200};function kv(e,t,n){var i=this;this._config=I({},uM,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})}}kv.$inject=["config.keyboardMove","keyboard","canvas"];const Ov={__depends__:[Jp],__init__:["keyboardMove"],keyboardMove:["type",kv]};var lM=15;function Dv(e,t){var n;function i(s){return a(s.originalEvent)}e.on("canvas.focus.changed",function(s){s.focused?e.on("element.mousedown",500,i):e.off("element.mousedown",i)});function r(s){var c=n.start,u=n.button,l=$r(s),f=ii(l,c);if(!n.dragging&&pM(f)>lM&&(n.dragging=!0,u===0&&ay(e),pc("grab")),n.dragging){var p=n.last||n.start;f=ii(l,p),t.scroll({dx:f.x,dy:f.y}),n.last=l}s.preventDefault()}function o(s){Ae.unbind(document,"mousemove",r),Ae.unbind(document,"mouseup",o),n=null,oy()}function a(s){if(!Or(s.target,".djs-draggable")){var c=s.button;if(!(c>=2||s.ctrlKey||s.shiftKey||s.altKey))return n={button:c,start:$r(s)},Ae.bind(document,"mousemove",r),Ae.bind(document,"mouseup",o),!0}}this.isActive=function(){return!!n}}Dv.$inject=["eventBus","canvas"];function pM(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}const Lv={__init__:["moveCanvas"],moveCanvas:["type",Dv]};function Iv(e,t){var n=yl(e.min),i=yl(e.max),r=Math.abs(n)+Math.abs(i);return r/t}function fM(e,t){return Math.max(e.min,Math.min(e.max,t))}var dM=Math.sign||function(e){return e>=0?1:-1},ef={min:.2,max:4},Nv=10,hM=.1,mM=.75;function _i(e,t,n){e=e||{},this._enabled=!1,this._canvas=n,this._container=n._container,this._handleWheel=bn(this._handleWheel,this),this._totalDelta=0,this._scale=e.scale||mM;var i=this;t.on("canvas.mouseover",function(){i._init(e.enabled!==!1)}),t.on("canvas.mouseout",function(){i._init(!1)})}_i.$inject=["config.zoomScroll","eventBus","canvas"],_i.prototype.scroll=function(t){this._canvas.scroll(t)},_i.prototype.reset=function(){this._canvas.zoom("fit-viewport")},_i.prototype.zoom=function(t,n){var i=Iv(ef,Nv*2);this._totalDelta+=t,Math.abs(this._totalDelta)>hM&&(this._zoom(t,n,i),this._totalDelta=0)},_i.prototype._handleWheel=function(t){if(this._enabled){var n=this._container;t.preventDefault();var i=t.ctrlKey||dg()&&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))*dM(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)}},_i.prototype.stepZoom=function(t,n){var i=Iv(ef,Nv);this._zoom(t,n,i)},_i.prototype._zoom=function(e,t,n){var i=this._canvas,r=e>0?1:-1,o=yl(i.zoom()),a=Math.round(o/n)*n;a+=n*r;var s=Math.pow(10,a);i.zoom(fM(ef,s),t)},_i.prototype.toggle=function(t){var n=this._container,i=this._handleWheel,r=this._enabled;return typeof t>"u"&&(t=!r),r!==t&&Ae[t?"bind":"unbind"](n,"wheel",i,!1),this._enabled=t,t},_i.prototype._init=function(e){this.toggle(e)};const Bv={__init__:["zoomScroll"],zoomScroll:["type",_i]};function Ia(e){yr.call(this,e)}ae(Ia,yr),Ia.prototype._navigationModules=[Ov,Lv,Bv],Ia.prototype._modules=[].concat(yr.prototype._modules,Ia.prototype._navigationModules);function tf(e){return e&&e[e.length-1]}function $v(e){return e.y}function jv(e){return e.x}var gM={left:jv,center:jv,right:function(e){return e.x+e.width},top:$v,middle:$v,bottom:function(e){return e.y+e.height}};function Oo(e,t){this._modeling=e,this._rules=t}Oo.$inject=["modeling","rules"],Oo.prototype._getOrientationDetails=function(e){var t=["top","bottom","middle"],n="x",i="width";return t.indexOf(e)!==-1&&(n="y",i="height"),{axis:n,dimension:i}},Oo.prototype._isType=function(e,t){return t.indexOf(e)!==-1},Oo.prototype._alignmentPosition=function(e,t){var n=this._getOrientationDetails(e),i=n.axis,r=n.dimension,o={},a={},s=!1,c,u,l;function f(p,d){return Math.round((p[i]+d[i]+d[r])/2)}if(this._isType(e,["left","top"]))o[e]=t[0][i];else if(this._isType(e,["right","bottom"]))l=tf(t),o[e]=l[i]+l[r];else if(this._isType(e,["center","middle"])){if(k(t,function(p){var d=p[i]+Math.round(p[r]/2);a[d]?a[d].elements.push(p):a[d]={elements:[p],center:d}}),c=oi(a,function(p){return p.elements.length>1&&(s=!0),p.elements.length}),s)return o[e]=tf(c).center,o;u=t[0],t=oi(t,function(p){return p[i]+p[r]}),l=tf(t),o[e]=f(u,l)}return o},Oo.prototype.trigger=function(e,t){var n=this._modeling,i,r=Be(e,function(c){return!(c.waypoints||c.host||c.labelTarget)});if(i=this._rules.allowed("elements.align",{elements:r}),we(i)&&(r=i),!(r.length<2||!i)){var o=gM[t],a=oi(r,o),s=this._alignmentPosition(t,a);n.alignElements(a,s)}};const yM={__init__:["alignElements"],alignElements:["type",Oo]},vM=new Po;function Do(e){this._scheduled={},e.on("diagram.destroy",()=>{Object.keys(this._scheduled).forEach(t=>{this.cancel(t)})})}Do.$inject=["eventBus"],Do.prototype.schedule=function(e,t=vM.next()){this.cancel(t);const n=this._schedule(e,t);return this._scheduled[t]=n,n.promise},Do.prototype._schedule=function(e,t){const n=_M();return{executionId:setTimeout(()=>{try{this._scheduled[t]=null;try{n.resolve(e())}catch(r){n.reject(r)}}catch(r){console.error("Scheduler#_schedule execution failed",r)}}),promise:n.promise}},Do.prototype.cancel=function(e){const t=this._scheduled[e];t&&(this._cancel(t),this._scheduled[e]=null)},Do.prototype._cancel=function(e){clearTimeout(e.executionId)};function _M(){const e={};return e.promise=new Promise((t,n)=>{e.resolve=t,e.reject=n}),e}const bM={scheduler:["type",Do]};var xM="djs-element-hidden",jc=".entry",wM=1e3,Fv=8,EM=300;function Ot(e,t,n,i){this._canvas=e,this._elementRegistry=t,this._eventBus=n,this._scheduler=i,this._current=null,this._init()}Ot.$inject=["canvas","elementRegistry","eventBus","scheduler"],Ot.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=we(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=we(i.target)?i.target:[i.target];r.includes(n)&&e._updateVisibility()}}),this._container=this._createContainer()},Ot.prototype._createContainer=function(){var e=pt('<div class="djs-context-pad-parent"></div>');return this._canvas.getContainer().appendChild(e),e},Ot.prototype.registerProvider=function(e,t){t||(t=e,e=wM),this._eventBus.on("contextPad.getProviders",e,function(n){n.providers.push(t)})},Ot.prototype.getEntries=function(e){var t=this._getProviders(),n=we(e)?"getMultiElementContextPadEntries":"getContextPadEntries",i={};return k(t,function(r){if(Yt(r[n])){var o=r[n](e);Yt(o)?i=o(i):k(o,function(a,s){i[s]=a})}}),i},Ot.prototype.trigger=function(e,t,n){var i=this,r,o,a=t.delegateTarget||t.target;if(!a)return t.preventDefault();if(r=cn(a,"data-action"),o=t.originalEvent||t,e==="mouseover"){this._timeout=setTimeout(function(){i._mouseout=i.triggerEntry(r,"hover",o,n)},EM);return}else if(e==="mouseout"){clearTimeout(this._timeout),this._mouseout&&(this._mouseout(),this._mouseout=null);return}return this.triggerEntry(r,e,o,n)},Ot.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(Yt(s)){if(t==="click")return s(n,r,i)}else if(s[t])return s[t](n,r,i);n.preventDefault()}}}},Ot.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))}},Ot.prototype._getProviders=function(){var e=this._eventBus.createEvent({type:"contextPad.getProviders",providers:[]});return this._eventBus.fire(e),e.providers},Ot.prototype._updateAndOpen=function(e){var t=this.getEntries(e),n=this._createHtml(e),i;k(t,function(r,o){var a=r.group||"default",s=pt(r.html||'<div class="entry" draggable="true"></div>'),c;cn(s,"data-action",o),c=nt("[data-group="+La(a)+"]",n),c||(c=pt('<div class="group"></div>'),cn(c,"data-group",a),n.appendChild(c)),c.appendChild(s),r.className&&SM(s,r.className),r.title&&cn(s,"title",r.title),r.imageUrl&&(i=pt("<img>"),cn(i,"src",r.imageUrl),i.style.width="100%",i.style.height="100%",s.appendChild(i))}),yt(n).add("open"),this._current={entries:t,html:n,target:e},this._updatePosition(),this._updateVisibility(),this._eventBus.fire("contextPad.open",{current:this._current})},Ot.prototype._createHtml=function(e){var t=this,n=pt('<div class="djs-context-pad"></div>');return An.bind(n,jc,"click",function(i){t.trigger("click",i)}),An.bind(n,jc,"dragstart",function(i){t.trigger("dragstart",i)}),An.bind(n,jc,"mouseover",function(i){t.trigger("mouseover",i)}),An.bind(n,jc,"mouseout",function(i){t.trigger("mouseout",i)}),Ae.bind(n,"mousedown",function(i){i.stopPropagation()}),this._container.appendChild(n),this._eventBus.fire("contextPad.create",{target:e,pad:n}),n},Ot.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()&&CM(this._current.target,e)?t=this._current.html:t=this._createHtml(e),{html:t}},Ot.prototype.close=function(){this.isOpen()&&(clearTimeout(this._timeout),this._container.innerHTML="",this._eventBus.fire("contextPad.close",{current:this._current}),this._current=null)},Ot.prototype.isOpen=function(e){var t=this._current;if(!t)return!1;if(!e)return!0;var n=t.target;return we(e)!==we(n)?!1:we(e)?e.length===n.length&&Cr(e,function(i){return n.includes(i)}):n===e},Ot.prototype.isShown=function(){return this.isOpen()&&yt(this._current.html).has("open")},Ot.prototype.show=function(){this.isOpen()&&(yt(this._current.html).add("open"),this._updatePosition(),this._eventBus.fire("contextPad.show",{current:this._current}))},Ot.prototype.hide=function(){this.isOpen()&&(yt(this._current.html).remove("open"),this._eventBus.fire("contextPad.hide",{current:this._current}))},Ot.prototype._getPosition=function(e){if(!we(e)&&ot(e)){var t=this._canvas.viewbox(),n=RM(e),i=n.x*t.scale-t.x*t.scale,r=n.y*t.scale-t.y*t.scale;return{left:i+Fv*this._canvas.zoom(),top:r}}var o=this._canvas.getContainer(),a=o.getBoundingClientRect(),s=this._getTargetBounds(e);return{left:s.right-a.left+Fv*this._canvas.zoom(),top:s.top-a.top}},Ot.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")},Ot.prototype._updateVisibility=function(){const e=()=>{if(this.isOpen()){var t=this,n=this._current.target,i=we(n)?n:[n],r=i.some(function(o){return t._canvas.hasMarker(o,xM)});r?t.hide():t.show()}};this._scheduler.schedule(e,"ContextPad#_updateVisibility")},Ot.prototype._getTargetBounds=function(e){var t=this,n=we(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 SM(e,t){var n=yt(e);t=we(t)?t:t.split(/\s+/g),t.forEach(function(i){n.add(i)})}function RM(e){return e.waypoints[e.waypoints.length-1]}function CM(e,t){return e=we(e)?e:[e],t=we(t)?t:[t],e.length===t.length&&Cr(e,function(n){return t.includes(n)})}const Hv={__depends__:[lc,bM,Nc],contextPad:["type",Ot]};var Fc,wt,zv,vr,Gv,Vv,Wv,nf,Hc,Na,Uv,rf,of,af,zc={},Gc=[],PM=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,Vc=Array.isArray;function Fi(e,t){for(var n in t)e[n]=t[n];return e}function sf(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function Yv(e,t,n){var i,r,o,a={};for(o in t)o=="key"?i=t[o]:o=="ref"?r=t[o]:a[o]=t[o];if(arguments.length>2&&(a.children=arguments.length>3?Fc.call(arguments,2):n),typeof e=="function"&&e.defaultProps!=null)for(o in e.defaultProps)a[o]===void 0&&(a[o]=e.defaultProps[o]);return Wc(e,a,i,r,null)}function Wc(e,t,n,i,r){var o={type:e,props:t,key:n,ref:i,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:r??++zv,__i:-1,__u:0};return r==null&&wt.vnode!=null&&wt.vnode(o),o}function Uc(e){return e.children}function Yc(e,t){this.props=e,this.context=t}function Wr(e,t){if(t==null)return e.__?Wr(e.__,e.__i+1):null;for(var n;t<e.__k.length;t++)if((n=e.__k[t])!=null&&n.__e!=null)return n.__e;return typeof e.type=="function"?Wr(e):null}function AM(e){if(e.__P&&e.__d){var t=e.__v,n=t.__e,i=[],r=[],o=Fi({},t);o.__v=t.__v+1,wt.vnode&&wt.vnode(o),cf(e.__P,o,t,e.__n,e.__P.namespaceURI,32&t.__u?[n]:null,i,n??Wr(t),!!(32&t.__u),r),o.__v=t.__v,o.__.__k[o.__i]=o,t_(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 Kv(e){(!e.__d&&(e.__d=!0)&&vr.push(e)&&!qc.__r++||Gv!=wt.debounceRendering)&&((Gv=wt.debounceRendering)||Vv)(qc)}function qc(){try{for(var e,t=1;vr.length;)vr.length>t&&vr.sort(Wv),e=vr.shift(),t=vr.length,AM(e)}finally{vr.length=qc.__r=0}}function Xv(e,t,n,i,r,o,a,s,c,u,l){var f,p,d,h,m,g,R=i&&i.__k||Gc,E=t.length;for(c=TM(n,t,R,c,E),f=0;f<E;f++)(d=n.__k[f])!=null&&(p=d.__i!=-1&&R[d.__i]||zc,d.__i=f,g=cf(e,d,p,r,o,a,s,c,u,l),h=d.__e,d.ref&&p.ref!=d.ref&&(p.ref&&uf(p.ref,null,d),l.push(d.ref,d.__c||h,d)),m==null&&h!=null&&(m=h),4&d.__u?(c=Zv(d,c,e),p.__e&&(p.__e=null)):typeof d.type=="function"&&g!==void 0?c=g:h&&(c=h.nextSibling),d.__u&=-7);return n.__e=m,c}function TM(e,t,n,i,r){var o,a,s,c,u,l=n.length,f=l,p=0;for(e.__k=new Array(r),o=0;o<r;o++)(a=t[o])!=null&&typeof a!="boolean"&&typeof a!="function"?(typeof a=="string"||typeof a=="number"||typeof a=="bigint"||a.constructor==String?a=e.__k[o]=Wc(null,a,null,null,null):Vc(a)?a=e.__k[o]=Wc(Uc,{children:a},null,null,null):a.constructor===void 0&&a.__b>0?a=e.__k[o]=Wc(a.type,a.props,a.key,a.ref?a.ref:null,a.__v):e.__k[o]=a,c=o+p,a.__=e,a.__b=e.__b+1,s=null,(u=a.__i=MM(a,n,c,f))!=-1&&(f--,(s=n[u])&&(s.__u|=2)),s==null||s.__v==null?(u==-1&&(r>l?p--:r<l&&p++),typeof a.type!="function"&&(a.__u|=4)):u!=c&&(u==c-1?p--:u==c+1?p++:(u>c?p--:p++,a.__u|=4))):e.__k[o]=null;if(f)for(o=0;o<l;o++)(s=n[o])!=null&&(2&s.__u)==0&&(s.__e==i&&(i=Wr(s)),i_(s,s));return i}function Zv(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=Zv(i[r],t,n));return t}e.__e!=t&&(t&&e.type&&!t.parentNode&&(t=Wr(e)),t=n.insertBefore(e.__e,t||null));do t=t&&t.nextSibling;while(t!=null&&t.nodeType==8);return t}function MM(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 Qv(e,t,n){t[0]=="-"?e.setProperty(t,n??""):e[t]=n==null?"":typeof n!="number"||PM.test(t)?n:n+"px"}function Kc(e,t,n,i,r){var o,a;e:if(t=="style")if(typeof n=="string")e.style.cssText=n;else{if(typeof i=="string"&&(e.style.cssText=i=""),i)for(t in i)n&&t in n||Qv(e.style,t,"");if(n)for(t in n)i&&n[t]==i[t]||Qv(e.style,t,n[t])}else if(t[0]=="o"&&t[1]=="n")o=t!=(t=t.replace(Uv,"$1")),a=t.toLowerCase(),t=a in e||t=="onFocusOut"||t=="onFocusIn"?a.slice(2):t.slice(2),e.l||(e.l={}),e.l[t+o]=n,n?i?n[Na]=i[Na]:(n[Na]=rf,e.addEventListener(t,o?af:of,o)):e.removeEventListener(t,o?af:of,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 Jv(e){return function(t){if(this.l){var n=this.l[t.type+e];if(t[Hc]==null)t[Hc]=rf++;else if(t[Hc]<n[Na])return;return n(wt.event?wt.event(t):t)}}}function cf(e,t,n,i,r,o,a,s,c,u){var l,f,p,d,h,m,g,R,E,x,w,S,M,N,T,H,G=t.type;if(t.constructor!==void 0)return null;128&n.__u&&(c=!!(32&n.__u),o=[s=t.__e=n.__e]),(l=wt.__b)&&l(t);e:if(typeof G=="function"){f=a.length;try{if(E=t.props,x=G.prototype&&G.prototype.render,w=(l=G.contextType)&&i[l.__c],S=l?w?w.props.value:l.__:i,n.__c?R=(p=t.__c=n.__c).__=p.__E:(x?t.__c=p=new G(E,S):(t.__c=p=new Yc(E,S),p.constructor=G,p.render=OM),w&&w.sub(p),p.state||(p.state={}),p.__n=i,d=p.__d=!0,p.__h=[],p._sb=[]),x&&p.__s==null&&(p.__s=p.state),x&&G.getDerivedStateFromProps!=null&&(p.__s==p.state&&(p.__s=Fi({},p.__s)),Fi(p.__s,G.getDerivedStateFromProps(E,p.__s))),h=p.props,m=p.state,p.__v=t,d)x&&G.getDerivedStateFromProps==null&&p.componentWillMount!=null&&p.componentWillMount(),x&&p.componentDidMount!=null&&p.__h.push(p.componentDidMount);else{if(x&&G.getDerivedStateFromProps==null&&E!==h&&p.componentWillReceiveProps!=null&&p.componentWillReceiveProps(E,S),t.__v==n.__v||!p.__e&&p.shouldComponentUpdate!=null&&p.shouldComponentUpdate(E,p.__s,S)===!1){t.__v!=n.__v&&(p.props=E,p.state=p.__s,p.__d=!1),t.__e=n.__e,t.__k=n.__k,t.__k.some(function($){$&&($.__=t)}),Gc.push.apply(p.__h,p._sb),p._sb=[],p.__h.length&&a.push(p),s=Wr(n);break e}p.componentWillUpdate!=null&&p.componentWillUpdate(E,p.__s,S),x&&p.componentDidUpdate!=null&&p.__h.push(function(){p.componentDidUpdate(h,m,g)})}if(p.context=S,p.props=E,p.__P=e,p.__e=!1,M=wt.__r,N=0,x)p.state=p.__s,p.__d=!1,M&&M(t),l=p.render(p.props,p.state,p.context),Gc.push.apply(p.__h,p._sb),p._sb=[];else do p.__d=!1,M&&M(t),l=p.render(p.props,p.state,p.context),p.state=p.__s;while(p.__d&&++N<25);p.state=p.__s,p.getChildContext!=null&&(i=Fi(Fi({},i),p.getChildContext())),x&&!d&&p.getSnapshotBeforeUpdate!=null&&(g=p.getSnapshotBeforeUpdate(h,m)),T=l!=null&&l.type===Uc&&l.key==null?n_(l.props.children):l,s=Xv(e,Vc(T)?T:[T],t,n,i,r,o,a,s,c,u),p.base=t.__e,t.__u&=-161,p.__h.length&&a.push(p),R&&(p.__E=p.__=null)}catch($){if(a.length=f,t.__v=null,c||o!=null){if($.then){for(t.__u|=c?160:128;s&&s.nodeType==8&&s.nextSibling;)s=s.nextSibling;o!=null&&(o[o.indexOf(s)]=null),t.__e=s}else if(o!=null)for(H=o.length;H--;)sf(o[H])}else t.__e=n.__e;t.__k==null&&(t.__k=n.__k||[]),$.then||e_(t),wt.__e($,t,n)}}else o==null&&t.__v==n.__v?(t.__k=n.__k,t.__e=n.__e):s=t.__e=kM(n.__e,t,n,i,r,o,a,c,u);return(l=wt.diffed)&&l(t),128&t.__u?void 0:s}function e_(e){e&&(e.__c&&(e.__c.__e=!0),e.__k&&e.__k.some(e_))}function t_(e,t,n){for(var i=0;i<n.length;i++)uf(n[i],n[++i],n[++i]);wt.__c&&wt.__c(t,e),e.some(function(r){try{e=r.__h,r.__h=[],e.some(function(o){o.call(r)})}catch(o){wt.__e(o,r.__v)}})}function n_(e){return typeof e!="object"||e==null||e.__b>0?e:Vc(e)?e.map(n_):e.constructor!==void 0?null:Fi({},e)}function kM(e,t,n,i,r,o,a,s,c){var u,l,f,p,d,h,m,g=n.props||zc,R=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(R);e=document.createElementNS(r,E,R.is&&R),s&&(wt.__m&&wt.__m(t,o),s=!1),o=null}if(E==null)g===R||s&&e.data==R||(e.data=R);else{if(o=E=="textarea"&&R.defaultValue!=null?null:o&&Fc.call(e.childNodes),!s&&o!=null)for(g={},u=0;u<e.attributes.length;u++)g[(d=e.attributes[u]).name]=d.value;for(u in g)d=g[u],u=="dangerouslySetInnerHTML"?f=d:u=="children"||u in R||u=="value"&&"defaultValue"in R||u=="checked"&&"defaultChecked"in R||Kc(e,u,null,d,r);for(u in R)d=R[u],u=="children"?p=d:u=="dangerouslySetInnerHTML"?l=d:u=="value"?h=d:u=="checked"?m=d:s&&typeof d!="function"||g[u]===d||Kc(e,u,d,g[u],r);if(l)s||f&&(l.__html==f.__html||l.__html==e.innerHTML)||(e.innerHTML=l.__html),t.__k=[];else if(f&&(e.innerHTML=""),Xv(t.type=="template"?e.content:e,Vc(p)?p:[p],t,n,i,E=="foreignObject"?"http://www.w3.org/1999/xhtml":r,o,a,o?o[0]:n.__k&&Wr(n,0),s,c),o!=null)for(u=o.length;u--;)sf(o[u]);s&&E!="textarea"||(u="value",E=="progress"&&h==null?e.removeAttribute("value"):h!=null&&(h!==e[u]||E=="progress"&&!h||E=="option"&&h!=g[u])&&Kc(e,u,h,g[u],r),u="checked",m!=null&&m!=e[u]&&Kc(e,u,m,g[u],r))}return e}function uf(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){wt.__e(r,n)}}function i_(e,t,n){var i,r;if(wt.unmount&&wt.unmount(e),(i=e.ref)&&(i.current&&i.current!=e.__e||uf(i,null,t)),(i=e.__c)!=null){if(i.componentWillUnmount)try{i.componentWillUnmount()}catch(o){wt.__e(o,t)}i.base=i.__P=i.__n=null}if(i=e.__k)for(r=0;r<i.length;r++)i[r]&&i_(i[r],t,n||typeof e.type!="function");n||sf(e.__e),e.__c=e.__=e.__e=void 0}function OM(e,t,n){return this.constructor(e,n)}function r_(e,t,n){var i,r,o,a;t==document&&(t=document.documentElement),wt.__&&wt.__(e,t),r=(i=!1)?null:t.__k,o=[],a=[],cf(t,e=t.__k=Yv(Uc,null,[e]),r||zc,zc,t.namespaceURI,r?null:t.firstChild?Fc.call(t.childNodes):null,o,r?r.__e:t.firstChild,i,a),t_(o,e,a),e.props.children=null}Fc=Gc.slice,wt={__e:function(e,t,n,i){for(var r,o,a;t=t.__;)if((r=t.__c)&&!r.__)try{if((o=r.constructor)&&o.getDerivedStateFromError!=null&&(r.setState(o.getDerivedStateFromError(e)),a=r.__d),r.componentDidCatch!=null&&(r.componentDidCatch(e,i||{}),a=r.__d),a)return r.__E=r}catch(s){e=s}throw e}},zv=0,Yc.prototype.setState=function(e,t){var n;n=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=Fi({},this.state),typeof e=="function"&&(e=e(Fi({},n),this.props)),e&&Fi(n,e),e!=null&&this.__v&&(t&&this._sb.push(t),Kv(this))},Yc.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),Kv(this))},Yc.prototype.render=Uc,vr=[],Vv=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,Wv=function(e,t){return e.__v.__b-t.__v.__b},qc.__r=0,nf=Math.random().toString(8),Hc="__d"+nf,Na="__a"+nf,Uv=/(PointerCapture)$|Capture$/i,rf=0,of=Jv(!1),af=Jv(!0);var o_=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,o_(e,s,n,["",null])),i.push(r),s[0]?t[0]|=2:(t[o-2]=0,t[o]=r)):i.push(s)}return i},a_=new Map;function DM(e){var t=a_.get(this);return t||(t=new Map,a_.set(this,t)),(t=o_(this,t.get(e)||(t.set(e,t=(function(n){for(var i,r,o=1,a="",s="",c=[0],u=function(p){o===1&&(p||(a=a.replace(/^\s*\n\s*|\s*\n\s*$/g,"")))?c.push(0,p,a):o===3&&(p||a)?(c.push(3,p,a),o=2):o===2&&a==="..."&&p?c.push(4,p,0):o===2&&a&&!p?c.push(5,0,!0,a):o>=5&&((a||!p&&o===5)&&(c.push(o,0,a,r),o=6),p&&(c.push(o,p,0,r),o=6)),a=""},l=0;l<n.length;l++){l&&(o===1&&u(),u(l));for(var f=0;f<n[l].length;f++)i=n[l][f],o===1?i==="<"?(u(),c=[c],o=3):a+=i:o===4?a==="--"&&i===">"?(o=1,a=""):a=i+a[0]:s?i===s?s="":a+=i:i==='"'||i==="'"?s=i:i===">"?(u(),o=1):o&&(i==="="?(o=5,r=a,a=""):i==="/"&&(o<5||n[l][f+1]===">")?(u(),o===3&&(c=c[0]),o=c,(c=c[0]).push(2,0,o),o=0):i===" "||i===" "||i===`
11
+ `||i==="\r"?(u(),o=2):a+=i),o===3&&a==="!--"&&(o=4,c=c[0])}return u(),c})(e)),t),arguments,[])).length>1?t:t[0]}var st=DM.bind(Yv),Lo,Dt,lf,s_,Ba=0,c_=[],Vt=wt,u_=Vt.__b,l_=Vt.__r,p_=Vt.diffed,f_=Vt.__c,d_=Vt.unmount,h_=Vt.__;function Xc(e,t){Vt.__h&&Vt.__h(Dt,e,Ba||t),Ba=0;var n=Dt.__H||(Dt.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({}),n.__[e]}function pf(e){return Ba=1,LM(g_,e)}function LM(e,t,n){var i=Xc(Lo++,2);if(i.t=e,!i.__c&&(i.__=[g_(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=Dt,!Dt.__f)){var r=function(s,c,u){if(!i.__c.__H)return!0;var l=!1,f=i.__c.props!==s;if(i.__c.__H.__.some(function(d){if(d.__N){l=!0;var h=d.__[0];d.__=d.__N,d.__N=void 0,h!==d.__[0]&&(f=!0)}}),o){var p=o.call(this,s,c,u);return l?p||f:p}return!l||f};Dt.__f=!0;var o=Dt.shouldComponentUpdate,a=Dt.componentWillUpdate;Dt.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)},Dt.shouldComponentUpdate=r}return i.__N||i.__}function Zc(e,t){var n=Xc(Lo++,3);!Vt.__s&&hf(n.__H,t)&&(n.__=e,n.u=t,Dt.__H.__h.push(n))}function ff(e,t){var n=Xc(Lo++,4);!Vt.__s&&hf(n.__H,t)&&(n.__=e,n.u=t,Dt.__h.push(n))}function Qc(e){return Ba=5,Hi(function(){return{current:e}},[])}function Hi(e,t){var n=Xc(Lo++,7);return hf(n.__H,t)&&(n.__=e(),n.__H=t,n.__h=e),n.__}function $a(e,t){return Ba=8,Hi(function(){return e},t)}function IM(){for(var e;e=c_.shift();){var t=e.__H;if(e.__P&&t)try{t.__h.some(Jc),t.__h.some(df),t.__h=[]}catch(n){t.__h=[],Vt.__e(n,e.__v)}}}Vt.__b=function(e){Dt=null,u_&&u_(e)},Vt.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),h_&&h_(e,t)},Vt.__r=function(e){l_&&l_(e),Lo=0;var t=(Dt=e.__c).__H;t&&(lf===Dt?(t.__h=[],Dt.__h=[],t.__.some(function(n){n.__N&&(n.__=n.__N),n.u=n.__N=void 0})):(t.__h.some(Jc),t.__h.some(df),t.__h=[],Lo=0)),lf=Dt},Vt.diffed=function(e){p_&&p_(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(c_.push(t)!==1&&s_===Vt.requestAnimationFrame||((s_=Vt.requestAnimationFrame)||NM)(IM)),t.__H.__.some(function(n){n.u&&(n.__H=n.u,n.u=void 0)})),lf=Dt=null},Vt.__c=function(e,t){t.some(function(n){try{n.__h.some(Jc),n.__h=n.__h.filter(function(i){return!i.__||df(i)})}catch(i){t.some(function(r){r.__h&&(r.__h=[])}),t=[],Vt.__e(i,n.__v)}}),f_&&f_(e,t)},Vt.unmount=function(e){d_&&d_(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.some(function(i){try{Jc(i)}catch(r){t=r}}),n.__H=void 0,t&&Vt.__e(t,n.__v))};var m_=typeof requestAnimationFrame=="function";function NM(e){var t,n=function(){clearTimeout(i),m_&&cancelAnimationFrame(t),setTimeout(e)},i=setTimeout(n,35);m_&&(t=requestAnimationFrame(n))}function Jc(e){var t=Dt,n=e.__c;typeof n=="function"&&(e.__c=void 0,n()),Dt=t}function df(e){var t=Dt;e.__c=e.__(),Dt=t}function hf(e,t){return!e||e.length!==t.length||t.some(function(n,i){return n!==e[i]})}function g_(e,t){return typeof t=="function"?t(e):t}function BM(e){const{navigationStack:t,setNavigationStack:n}=e,i=Hi(()=>t.length<=1?[]:t.slice(0,-1).map((a,s)=>({label:a.label,onClick:()=>n(c=>c.slice(0,s+1))})),[t,n]),r=t.length>0?()=>n([]):null,o=t.length>0?t[t.length-1].label:null;return st`
12
12
  <div class="djs-popup-breadcrumbs">
13
13
  ${r&&st`
14
14
  <button
@@ -41,7 +41,7 @@
41
41
  </span>
42
42
  `}
43
43
  </div>
44
- `}function m_(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=m_(e[t]))&&(i&&(i+=" "),i+=n)}else for(n in e)e[n]&&(i&&(i+=" "),i+=n);return i}function Zc(){for(var e,t,n=0,i="",r=arguments.length;n<r;n++)(e=arguments[n])&&(t=m_(e))&&(i&&(i+=" "),i+=t);return i}function DM(e){const{headerEntries:t,onSelect:n,selectedEntry:i,setSelectedEntry:r,title:o}=e,a=Fi(()=>OM(t),[t]),s=u=>u.action&&!u.disabled,c=(u,l)=>{if(s(l))return n(u,l)};return st`
44
+ `}function y_(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=y_(e[t]))&&(i&&(i+=" "),i+=n)}else for(n in e)e[n]&&(i&&(i+=" "),i+=n);return i}function eu(){for(var e,t,n=0,i="",r=arguments.length;n<r;n++)(e=arguments[n])&&(t=y_(e))&&(i&&(i+=" "),i+=t);return i}function $M(e){const{headerEntries:t,onSelect:n,selectedEntry:i,setSelectedEntry:r,title:o}=e,a=Hi(()=>jM(t),[t]),s=u=>u.action&&!u.disabled,c=(u,l)=>{if(s(l))return n(u,l)};return st`
45
45
  <div class="djs-popup-header">
46
46
  <h3 class="djs-popup-title" title=${o}>${o}</h3>
47
47
  ${a.map(u=>st`
@@ -50,7 +50,7 @@
50
50
  ${u.entries.map(l=>st`
51
51
  <li key=${l.id}>
52
52
  <${s(l)?"button":"span"}
53
- class=${LM(l,l===i)}
53
+ class=${FM(l,l===i)}
54
54
  onClick=${f=>c(f,l)}
55
55
  title=${l.title||l.label}
56
56
  data-id=${l.id}
@@ -70,11 +70,11 @@
70
70
  </ul>
71
71
  `)}
72
72
  </div>
73
- `}function OM(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 LM(e,t){return Zc("entry",e.className,e.active?"active":"",e.disabled?"disabled":"",t?"selected":"")}function g_(e,t){return`${e}-entry-${t.id}`}function IM(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 st`
73
+ `}function jM(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 FM(e,t){return eu("entry",e.className,e.active?"active":"",e.disabled?"disabled":"",t?"selected":"")}function v_(e,t){return`${e}-entry-${t.id}`}function HM(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 st`
74
74
  <li
75
- class=${Zc("entry",{selected:i,disabled:n.disabled})}
75
+ class=${eu("entry",{selected:i,disabled:n.disabled})}
76
76
  data-id=${n.id}
77
- id=${g_(t,n)}
77
+ id=${v_(t,n)}
78
78
  role="option"
79
79
  aria-selected=${i||void 0}
80
80
  aria-haspopup=${n.entries?"true":void 0}
@@ -88,7 +88,7 @@
88
88
  >
89
89
  <div class="djs-popup-entry-content">
90
90
  <span
91
- class=${Zc("djs-popup-entry-name",n.className)}
91
+ class=${eu("djs-popup-entry-name",n.className)}
92
92
  >
93
93
  ${n.imageUrl&&st`<img class="djs-popup-entry-icon" src=${n.imageUrl} alt="" />`||n.imageHtml&&st`<div class="djs-popup-entry-icon" dangerouslySetInnerHTML=${{__html:n.imageHtml}} />`}
94
94
 
@@ -131,7 +131,7 @@
131
131
  </div>
132
132
  `}
133
133
  </li>
134
- `}function NM(e){const{selectedEntry:t,setSelectedEntry:n,groupedEntries:i,keyboardSelection:r,idPrefix:o,id:a,ariaLabel:s,tabIndex:c,ariaActivedescendant:u,...l}=e,f=Kc();ff(()=>{if(!r||!r.current)return;const m=f.current;if(!m)return;const g=m.querySelector(".selected");g&&BM(g)},[t]);const p=()=>{r.current=!1},d=m=>{r.current||n(m)},h=()=>{r.current||n(null)};return st`
134
+ `}function zM(e){const{selectedEntry:t,setSelectedEntry:n,groupedEntries:i,keyboardSelection:r,idPrefix:o,id:a,ariaLabel:s,tabIndex:c,ariaActivedescendant:u,...l}=e,f=Qc();ff(()=>{if(!r||!r.current)return;const m=f.current;if(!m)return;const g=m.querySelector(".selected");g&&GM(g)},[t]);const p=()=>{r.current=!1},d=m=>{r.current||n(m)},h=()=>{r.current||n(null)};return st`
135
135
  <div
136
136
  class="djs-popup-results"
137
137
  ref=${f}
@@ -144,7 +144,7 @@
144
144
  >
145
145
  ${i.map(m=>st`
146
146
  ${m.name&&st`
147
- <div key=${m.id} id=${y_(o,m)} class="entry-header" title=${m.name}>
147
+ <div key=${m.id} id=${__(o,m)} class="entry-header" title=${m.name}>
148
148
  ${m.name}
149
149
  </div>
150
150
  `}
@@ -152,10 +152,10 @@
152
152
  class="djs-popup-group"
153
153
  data-group=${m.id}
154
154
  role="group"
155
- aria-labelledby=${m.name?y_(o,m):void 0}
155
+ aria-labelledby=${m.name?__(o,m):void 0}
156
156
  >
157
157
  ${m.entries.map(g=>st`
158
- <${IM}
158
+ <${HM}
159
159
  key=${g.id}
160
160
  idPrefix=${o}
161
161
  entry=${g}
@@ -168,8 +168,8 @@
168
168
  </ul>
169
169
  `)}
170
170
  </div>
171
- `}function y_(e,t){return`${e}-group-${t.id}`}function BM(e){typeof e.scrollIntoViewIfNeeded=="function"?e.scrollIntoViewIfNeeded():e.scrollIntoView({scrollMode:"if-needed",block:"nearest"})}const $M=new Ro("djs-popup");function jM(e){const{onClose:t,onSelect:n,className:i,headerEntries:r,position:o,title:a,width:s,scale:c,search:u,emptyPlaceholder:l,searchFn:f,entries:p,onOpened:d,onClosed:h}=e,[m,g]=pf([]);qc(()=>{g([])},[p]);const[R,w]=pf(""),b=R.trim().length>0,x=Fi(()=>zM(p),[p]),S=Fi(()=>jt(u)?x.length>5:!1,[u,x]),M=Fi(()=>{const z=m.length?m[m.length-1].entries:p;return S?b?f(x.filter(({searchable:F})=>F!==!1),R,{keys:["label","search","description"]}).map(({item:F})=>F):z.filter(({rank:F=0})=>F>=0):z},[S,b,x,R,f,m,p]),N=Fi(()=>b?M.length?[{id:"default",entries:M}]:[]:VM(M),[M,b]),[T,H]=pf(M[0]),V=Kc(null),$=Kc(!1),G=Fi(()=>$M.next(),[]),he=`${G}-results`,Fe=T&&g_(G,T);qc(()=>{const z=V.current;z&&M.includes(z)?H(z):H(M[0]),V.current=null},[M]);const pt=Ia(z=>{const F=HM(N);let Oe=F.indexOf(T)+z;Oe<0&&(Oe=F.length-1),Oe>=F.length&&(Oe=0),$.current=!0,H(F[Oe])},[N,T]),q=Ia(z=>{z>0&&T&&T.entries&&($.current=!0,g(F=>[...F,T])),z<0&&m.length>0&&($.current=!0,V.current=m[m.length+z],g(F=>F.slice(0,z)))},[T,m]),me=Ia((z,F,U)=>{if(!(!F||F.disabled))return F.entries?(z.preventDefault(),q(1)):n(z,F,U)},[n,q]),ge=Ia(z=>{if(z.key==="Enter"&&T){const F=z.target;return!!Dr(F,"a, button",!0)||T.disabled?void 0:me(z,T)}if(z.key==="Backspace"){const F=z.target;if(!(Xu(F,"input")&&F.value!==""))return q(-1),z.preventDefault()}if(z.key==="ArrowUp")return pt(-1),z.preventDefault();if(z.key==="ArrowDown")return pt(1),z.preventDefault();if(z.key==="ArrowRight")return q(1),z.preventDefault();if(z.key==="ArrowLeft")return q(-1),z.preventDefault()},[T,pt,q,me]),pe=Ia(z=>{Xu(z.target,"input")&&w(()=>z.target.value)},[w]);qc(()=>(d(),()=>{h()}),[]);const fe=!b&&m.length>0,ie=(a||r.length>0)&&!fe;return st`
172
- <${v_}
171
+ `}function __(e,t){return`${e}-group-${t.id}`}function GM(e){typeof e.scrollIntoViewIfNeeded=="function"?e.scrollIntoViewIfNeeded():e.scrollIntoView({scrollMode:"if-needed",block:"nearest"})}const VM=new Po("djs-popup");function WM(e){const{onClose:t,onSelect:n,className:i,headerEntries:r,position:o,title:a,width:s,scale:c,search:u,emptyPlaceholder:l,searchFn:f,entries:p,onOpened:d,onClosed:h}=e,[m,g]=pf([]);Zc(()=>{g([])},[p]);const[R,E]=pf(""),x=R.trim().length>0,w=Hi(()=>qM(p),[p]),S=Hi(()=>Ft(u)?w.length>5:!1,[u,w]),M=Hi(()=>{const z=m.length?m[m.length-1].entries:p;return S?x?f(w.filter(({searchable:F})=>F!==!1),R,{keys:["label","search","description"]}).map(({item:F})=>F):z.filter(({rank:F=0})=>F>=0):z},[S,x,w,R,f,m,p]),N=Hi(()=>x?M.length?[{id:"default",entries:M}]:[]:KM(M),[M,x]),[T,H]=pf(M[0]),G=Qc(null),$=Qc(!1),V=Hi(()=>VM.next(),[]),de=`${V}-results`,Ge=T&&v_(V,T);Zc(()=>{const z=G.current;z&&M.includes(z)?H(z):H(M[0]),G.current=null},[M]);const ft=$a(z=>{const F=YM(N);let Le=F.indexOf(T)+z;Le<0&&(Le=F.length-1),Le>=F.length&&(Le=0),$.current=!0,H(F[Le])},[N,T]),q=$a(z=>{z>0&&T&&T.entries&&($.current=!0,g(F=>[...F,T])),z<0&&m.length>0&&($.current=!0,G.current=m[m.length+z],g(F=>F.slice(0,z)))},[T,m]),he=$a((z,F,Y)=>{if(!(!F||F.disabled))return F.entries?(z.preventDefault(),q(1)):n(z,F,Y)},[n,q]),ge=$a(z=>{if(z.key==="Enter"&&T){const F=z.target;return!!Or(F,"a, button",!0)||T.disabled?void 0:he(z,T)}if(z.key==="Backspace"){const F=z.target;if(!(Xu(F,"input")&&F.value!==""))return q(-1),z.preventDefault()}if(z.key==="ArrowUp")return ft(-1),z.preventDefault();if(z.key==="ArrowDown")return ft(1),z.preventDefault();if(z.key==="ArrowRight")return q(1),z.preventDefault();if(z.key==="ArrowLeft")return q(-1),z.preventDefault()},[T,ft,q,he]),pe=$a(z=>{Xu(z.target,"input")&&E(()=>z.target.value)},[E]);Zc(()=>(d(),()=>{h()}),[]);const fe=!x&&m.length>0,ne=(a||r.length>0)&&!fe;return st`
172
+ <${b_}
173
173
  onClose=${t}
174
174
  onKeyup=${pe}
175
175
  onKeydown=${ge}
@@ -179,8 +179,8 @@
179
179
  scale=${c}
180
180
  navigationStack=${m}
181
181
  >
182
- ${ie&&st`
183
- <${DM}
182
+ ${ne&&st`
183
+ <${$M}
184
184
  headerEntries=${r}
185
185
  onSelect=${n}
186
186
  selectedEntry=${T}
@@ -189,7 +189,7 @@
189
189
  />
190
190
  `}
191
191
  ${fe&&st`
192
- <${kM}
192
+ <${BM}
193
193
  navigationStack=${m}
194
194
  setNavigationStack=${g}
195
195
  />
@@ -208,30 +208,30 @@
208
208
  role="combobox"
209
209
  aria-label="${a||"Search"}"
210
210
  aria-expanded="true"
211
- aria-controls=${he}
212
- aria-activedescendant=${Fe||void 0}
211
+ aria-controls=${de}
212
+ aria-activedescendant=${Ge||void 0}
213
213
  aria-autocomplete="list"
214
214
  />
215
215
  </div>
216
216
  `}
217
217
 
218
- ${b&&st`
218
+ ${x&&st`
219
219
  <div class="djs-popup-search-count" aria-live="polite">
220
220
  ${M.length} ${M.length===1?"result":"results"} found
221
221
  </div>
222
222
  `}
223
223
 
224
- <${NM}
224
+ <${zM}
225
225
  groupedEntries=${N}
226
226
  selectedEntry=${T}
227
227
  setSelectedEntry=${H}
228
228
  keyboardSelection=${$}
229
- onAction=${me}
230
- idPrefix=${G}
231
- id=${he}
229
+ onAction=${he}
230
+ idPrefix=${V}
231
+ id=${de}
232
232
  ariaLabel=${a||"Results"}
233
233
  tabIndex=${S?-1:0}
234
- ariaActivedescendant=${S?void 0:Fe||void 0}
234
+ ariaActivedescendant=${S?void 0:Ge||void 0}
235
235
  />
236
236
 
237
237
  ${T&&T.documentationRef&&st`
@@ -257,11 +257,11 @@
257
257
  ${l&&M.length===0&&st`
258
258
  <div class="djs-popup-no-results">${Yt(l)?l(R):l}</div>
259
259
  `}
260
- </${v_}>
261
- `}function v_(e){const{onClose:t,onKeydown:n,onKeyup:i,className:r,children:o,navigationStack:a,position:s}=e,c=Kc();return ff(()=>{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]),ff(()=>{const u=c.current;if(!u)return;(u.querySelector("input")||u.querySelector('[role="listbox"]')||u).focus()},[a]),qc(()=>{const u=f=>{if(f.key==="Escape")return f.preventDefault(),t()},l=f=>{if(!Dr(f.target,".djs-popup",!0))return t()};return document.documentElement.addEventListener("keydown",u),document.body.addEventListener("click",l,!0),()=>{document.documentElement.removeEventListener("keydown",u),document.body.removeEventListener("click",l,!0)}},[]),st`
260
+ </${b_}>
261
+ `}function b_(e){const{onClose:t,onKeydown:n,onKeyup:i,className:r,children:o,navigationStack:a,position:s}=e,c=Qc();return ff(()=>{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]),ff(()=>{const u=c.current;if(!u)return;(u.querySelector("input")||u.querySelector('[role="listbox"]')||u).focus()},[a]),Zc(()=>{const u=f=>{if(f.key==="Escape")return f.preventDefault(),t()},l=f=>{if(!Or(f.target,".djs-popup",!0))return t()};return document.documentElement.addEventListener("keydown",u),document.body.addEventListener("click",l,!0),()=>{document.documentElement.removeEventListener("keydown",u),document.body.removeEventListener("click",l,!0)}},[]),st`
262
262
  <div
263
- class=${Zc("djs-popup",r)}
264
- style=${FM(e)}
263
+ class=${eu("djs-popup",r)}
264
+ style=${UM(e)}
265
265
  onKeydown=${n}
266
266
  onKeyup=${i}
267
267
  ref=${c}
@@ -269,8 +269,8 @@
269
269
  >
270
270
  ${o}
271
271
  </div>
272
- `}function FM(e){const{width:t}=e,n=typeof t=="number"?`${t}px`:t;return{transform:`scale(${e.scale})`,width:jt(t)?n:void 0,maxWidth:jt(t)?"unset":void 0,"transform-origin":"top left"}}function HM(e){const t=[];return e.forEach(n=>{n.entries.forEach(i=>{t.push(i)})}),t}function zM(e){const t=[];function n(i){i.forEach(r=>{if(r.entries){n(r.entries);return}t.push(r)})}return n(e),t}function VM(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 GM="data-id",__=["contextPad.close","canvas.viewbox.changing","commandStack.changed"],WM=1e3;function bt(e,t,n,i){this._eventBus=t,this._canvas=n,this._search=i,this._current=null;var r=jt(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()})}bt.$inject=["config.popupMenu","eventBus","canvas","search"],bt.prototype._render=function(){const{position:e,providerId:t,entries:n,headerEntries:i,emptyPlaceholder:r,options:o}=this._current,a=b_(n),s=Object.entries(i).map(([p,d])=>({id:p,...d})),c=e&&(p=>this._ensureVisible(p,e)),u=this._updateScale(this._current.container);n_(st`
273
- <${jM}
272
+ `}function UM(e){const{width:t}=e,n=typeof t=="number"?`${t}px`:t;return{transform:`scale(${e.scale})`,width:Ft(t)?n:void 0,maxWidth:Ft(t)?"unset":void 0,"transform-origin":"top left"}}function YM(e){const t=[];return e.forEach(n=>{n.entries.forEach(i=>{t.push(i)})}),t}function qM(e){const t=[];function n(i){i.forEach(r=>{if(r.entries){n(r.entries);return}t.push(r)})}return n(e),t}function KM(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 XM="data-id",x_=["contextPad.close","canvas.viewbox.changing","commandStack.changed"],ZM=1e3;function Et(e,t,n,i){this._eventBus=t,this._canvas=n,this._search=i,this._current=null;var r=Ft(e&&e.scale)?e.scale:{min:1,max:1};this._config={scale:r},t.on("diagram.destroy",()=>{this.close()}),t.on("element.changed",o=>{const a=this.isOpen()&&this._current.target;o.element===a&&this.refresh()})}Et.$inject=["config.popupMenu","eventBus","canvas","search"],Et.prototype._render=function(){const{position:e,providerId:t,entries:n,headerEntries:i,emptyPlaceholder:r,options:o}=this._current,a=w_(n),s=Object.entries(i).map(([p,d])=>({id:p,...d})),c=e&&(p=>this._ensureVisible(p,e)),u=this._updateScale(this._current.container);r_(st`
273
+ <${WM}
274
274
  onClose=${p=>this.close(p)}
275
275
  onSelect=${(p,d,h)=>this.trigger(p,d,h)}
276
276
  position=${c}
@@ -284,7 +284,7 @@
284
284
  searchFn=${this._search}
285
285
  ...${{...o}}
286
286
  />
287
- `,this._current.container)},bt.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()},bt.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()},bt.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)}},bt.prototype.close=function(){this.isOpen()&&(this._emit("close"),this.reset(),this._canvas.restoreFocus(),this._current=null)},bt.prototype.reset=function(){const e=this._current.container;n_(null,e),pi(e)},bt.prototype._emit=function(e,t){this._eventBus.fire(`popupMenu.${e}`,t)},bt.prototype._onOpened=function(){this._emit("opened")},bt.prototype._onClosed=function(){this._emit("closed")},bt.prototype._createContainer=function(e){var t=this._canvas,n=t.getContainer();const i=lt(`<div class="djs-popup-parent djs-scrollable" data-popup=${e.provider}></div>`);return n.appendChild(i),i},bt.prototype._bindAutoClose=function(){this._eventBus.once(__,this.close,this)},bt.prototype._unbindAutoClose=function(){this._eventBus.off(__,this.close,this)},bt.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),jt(n)&&e<n&&(r=n),jt(i)&&e>i&&(r=i)),r},bt.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}},bt.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},bt.prototype.registerProvider=function(e,t,n){n||(n=t,t=WM),this._eventBus.on("popupMenu.getProviders."+e,t,function(i){i.providers.push(n)})},bt.prototype._getProviders=function(e){var t=this._eventBus.createEvent({type:"popupMenu.getProviders."+e,providers:[]});return this._eventBus.fire(t),t.providers},bt.prototype._getEntries=function(e,t){var n={};return k(t,function(i){if(!i.getPopupMenuEntries){k(i.getEntries(e),function(o){var a=o.id;if(!a)throw new Error("entry ID is missing");n[a]=si(o,["id"])});return}var r=i.getPopupMenuEntries(e);Yt(r)?n=r(n):k(r,function(o,a){n[a]=o})}),n},bt.prototype._getHeaderEntries=function(e,t){var n={};return k(t,function(i){if(!i.getPopupMenuHeaderEntries){if(!i.getHeaderEntries)return;k(i.getHeaderEntries(e),function(o){var a=o.id;if(!a)throw new Error("entry ID is missing");n[a]=si(o,["id"])});return}var r=i.getPopupMenuHeaderEntries(e);Yt(r)?n=r(n):k(r,function(o,a){n[a]=o})}),n},bt.prototype._getEmptyPlaceholder=function(e){const t=e.find(n=>Yt(n.getEmptyPlaceholder));return t&&t.getEmptyPlaceholder()},bt.prototype.isOpen=function(){return!!this._current},bt.prototype.trigger=function(e,t,n="click"){if(e.preventDefault(),!t){let r=Dr(e.delegateTarget||e.target,".entry",!0),o=sn(r,GM);t={id:o,...this._getEntry(o)}}const i=t.action;if(this._emit("trigger",{entry:t,event:e})!==!1){if(Yt(i)){if(n==="click")return i(e,t)}else if(i[n])return i[n](e,t)}},bt.prototype._getEntry=function(e){var t=this._current.entries[e]||this._current.headerEntries[e];if(!t)throw new Error("entry not found");return t};function b_(e,t=[]){return Object.entries(e).map(([n,i])=>{const r={id:n,...i};return r.entries?r.entries=b_(r.entries,[...t,...x_(r.search)]):t.length&&(r.search=[...t,...x_(r.search)]),r})}function x_(e){return e?xe(e)?e:[e]:[]}function UM(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=YM(o,r,i);return a?{item:o,tokens:a}:[]}).sort(qM(i))}function YM(e,t,n){const{matchedWords:i,tokens:r}=n.reduce((o,a)=>{const s=e[a],{tokens:c,matchedWords:u}=xe(s)?s.reduce((l,f)=>{const{tokens:p,matchedWords:d}=C_(f,t);return{tokens:[...l.tokens,p],matchedWords:{...l.matchedWords,...d}}},{matchedWords:{},tokens:[]}):C_(s,t);return{tokens:{...o.tokens,[a]:c},matchedWords:{...o.matchedWords,...u}}},{matchedWords:{},tokens:{}});return Object.keys(i).length!==t.length?null:r}function qM(e){return(t,n)=>{let i=0,r=1;for(const o of e){const a=KM(t.tokens[o],n.tokens[o]);if(a!==0){i+=a*r,r*=w_;continue}const s=XM(t.item[o],n.item[o]);if(s!==0){i+=s*r,r*=w_;continue}}return i}}function KM(e,t){return E_(t)-E_(e)}const w_=.5,Oo={FULL:131.9,START_FULL_WORD:8,START_WORD_PART:7.87,WORD_START:2.19,WORD_PART:1,NO_MATCH:-.07};function E_(e){const t=e.reduce((s,c)=>s+S_(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 S_(e){if(xe(e))return Math.max(...e.map(S_));const t=Math.log(e.value.length);return e.match?(e.start?e.end?Oo.FULL:e.wordEnd?Oo.START_FULL_WORD:Oo.START_WORD_PART:e.wordStart?Oo.WORD_START:Oo.WORD_PART)*t:Oo.NO_MATCH*t}function R_(e=""){return xe(e)?e.join(", "):e}function XM(e,t){return R_(e).localeCompare(R_(t))}function C_(e,t){var u;if(!e)return{tokens:[],matchedWords:{}};const n=[],i={},r=t.map(ZM),o=[`(?<all>${r.join("\\s+")})`,...r].join("|"),a=new RegExp(o,"ig");let s,c=0;for(;s=a.exec(e);){const[l]=s,f=s.index,p=s.index+l.length,d=f===0,h=p===e.length,m=!!((u=s.groups)!=null&&u.all),g=d||/\s/.test(e.charAt(f-1)),R=h||/\s/.test(e.charAt(p));s.index>c&&n.push({value:e.slice(c,s.index),index:c}),n.push({value:l,index:s.index,match:!0,wordStart:g,wordEnd:R,start:d,end:h,all:m});const w=m?t:[l];for(const b of w)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 ZM(e){return e.replace(/[/\-\\^$*+?.()|[\]{}]/g,"\\$&")}const P_={search:["value",UM]},mf={__depends__:[P_],__init__:["popupMenu"],popupMenu:["type",bt]};var A_={align:`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 2000 2000">
287
+ `,this._current.container)},Et.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()},Et.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()},Et.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)}},Et.prototype.close=function(){this.isOpen()&&(this._emit("close"),this.reset(),this._canvas.restoreFocus(),this._current=null)},Et.prototype.reset=function(){const e=this._current.container;r_(null,e),pi(e)},Et.prototype._emit=function(e,t){this._eventBus.fire(`popupMenu.${e}`,t)},Et.prototype._onOpened=function(){this._emit("opened")},Et.prototype._onClosed=function(){this._emit("closed")},Et.prototype._createContainer=function(e){var t=this._canvas,n=t.getContainer();const i=pt(`<div class="djs-popup-parent djs-scrollable" data-popup=${e.provider}></div>`);return n.appendChild(i),i},Et.prototype._bindAutoClose=function(){this._eventBus.once(x_,this.close,this)},Et.prototype._unbindAutoClose=function(){this._eventBus.off(x_,this.close,this)},Et.prototype._updateScale=function(){var e=this._canvas.zoom(),t=this._config.scale,n,i,r=e;return t!==!0&&(t===!1?(n=1,i=1):(n=t.min,i=t.max),Ft(n)&&e<n&&(r=n),Ft(i)&&e>i&&(r=i)),r},Et.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}},Et.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},Et.prototype.registerProvider=function(e,t,n){n||(n=t,t=ZM),this._eventBus.on("popupMenu.getProviders."+e,t,function(i){i.providers.push(n)})},Et.prototype._getProviders=function(e){var t=this._eventBus.createEvent({type:"popupMenu.getProviders."+e,providers:[]});return this._eventBus.fire(t),t.providers},Et.prototype._getEntries=function(e,t){var n={};return k(t,function(i){if(!i.getPopupMenuEntries){k(i.getEntries(e),function(o){var a=o.id;if(!a)throw new Error("entry ID is missing");n[a]=ai(o,["id"])});return}var r=i.getPopupMenuEntries(e);Yt(r)?n=r(n):k(r,function(o,a){n[a]=o})}),n},Et.prototype._getHeaderEntries=function(e,t){var n={};return k(t,function(i){if(!i.getPopupMenuHeaderEntries){if(!i.getHeaderEntries)return;k(i.getHeaderEntries(e),function(o){var a=o.id;if(!a)throw new Error("entry ID is missing");n[a]=ai(o,["id"])});return}var r=i.getPopupMenuHeaderEntries(e);Yt(r)?n=r(n):k(r,function(o,a){n[a]=o})}),n},Et.prototype._getEmptyPlaceholder=function(e){const t=e.find(n=>Yt(n.getEmptyPlaceholder));return t&&t.getEmptyPlaceholder()},Et.prototype.isOpen=function(){return!!this._current},Et.prototype.trigger=function(e,t,n="click"){if(e.preventDefault(),!t){let r=Or(e.delegateTarget||e.target,".entry",!0),o=cn(r,XM);t={id:o,...this._getEntry(o)}}const i=t.action;if(this._emit("trigger",{entry:t,event:e})!==!1){if(Yt(i)){if(n==="click")return i(e,t)}else if(i[n])return i[n](e,t)}},Et.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 w_(e,t=[]){return Object.entries(e).map(([n,i])=>{const r={id:n,...i};return r.entries?r.entries=w_(r.entries,[...t,...E_(r.search)]):t.length&&(r.search=[...t,...E_(r.search)]),r})}function E_(e){return e?we(e)?e:[e]:[]}function QM(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=JM(o,r,i);return a?{item:o,tokens:a}:[]}).sort(e2(i))}function JM(e,t,n){const{matchedWords:i,tokens:r}=n.reduce((o,a)=>{const s=e[a],{tokens:c,matchedWords:u}=we(s)?s.reduce((l,f)=>{const{tokens:p,matchedWords:d}=A_(f,t);return{tokens:[...l.tokens,p],matchedWords:{...l.matchedWords,...d}}},{matchedWords:{},tokens:[]}):A_(s,t);return{tokens:{...o.tokens,[a]:c},matchedWords:{...o.matchedWords,...u}}},{matchedWords:{},tokens:{}});return Object.keys(i).length!==t.length?null:r}function e2(e){return(t,n)=>{let i=0,r=1;for(const o of e){const a=t2(t.tokens[o],n.tokens[o]);if(a!==0){i+=a*r,r*=S_;continue}const s=n2(t.item[o],n.item[o]);if(s!==0){i+=s*r,r*=S_;continue}}return i}}function t2(e,t){return R_(t)-R_(e)}const S_=.5,Io={FULL:131.9,START_FULL_WORD:8,START_WORD_PART:7.87,WORD_START:2.19,WORD_PART:1,NO_MATCH:-.07};function R_(e){const t=e.reduce((s,c)=>s+C_(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 C_(e){if(we(e))return Math.max(...e.map(C_));const t=Math.log(e.value.length);return e.match?(e.start?e.end?Io.FULL:e.wordEnd?Io.START_FULL_WORD:Io.START_WORD_PART:e.wordStart?Io.WORD_START:Io.WORD_PART)*t:Io.NO_MATCH*t}function P_(e=""){return we(e)?e.join(", "):e}function n2(e,t){return P_(e).localeCompare(P_(t))}function A_(e,t){var u;if(!e)return{tokens:[],matchedWords:{}};const n=[],i={},r=t.map(i2),o=[`(?<all>${r.join("\\s+")})`,...r].join("|"),a=new RegExp(o,"ig");let s,c=0;for(;s=a.exec(e);){const[l]=s,f=s.index,p=s.index+l.length,d=f===0,h=p===e.length,m=!!((u=s.groups)!=null&&u.all),g=d||/\s/.test(e.charAt(f-1)),R=h||/\s/.test(e.charAt(p));s.index>c&&n.push({value:e.slice(c,s.index),index:c}),n.push({value:l,index:s.index,match:!0,wordStart:g,wordEnd:R,start:d,end:h,all:m});const E=m?t:[l];for(const x of E)i[x.toLowerCase()]=!0;c=s.index+l.length}return c<e.length&&n.push({value:e.slice(c),index:c}),{tokens:n,matchedWords:i}}function i2(e){return e.replace(/[/\-\\^$*+?.()|[\]{}]/g,"\\$&")}const T_={search:["value",QM]},mf={__depends__:[T_],__init__:["popupMenu"],popupMenu:["type",Et]};var M_={align:`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 2000 2000">
288
288
  <line x1="200" y1="150" x2="200" y2="1850" style="stroke:currentColor;stroke-width:100;stroke-linecap:round;"/>
289
289
  <rect x="500" y="150" width="1300" height="700" rx="1" style="fill:none;stroke:currentColor;stroke-width:100;"></rect>
290
290
  <rect x="500" y="1150" width="700" height="700" rx="1" style="fill:currentColor;stroke:currentColor;stroke-width:100;opacity:.5;"></rect>
@@ -312,8 +312,8 @@
312
312
  <line x1="150" y1="900" x2="1650" y2="900" style="stroke:currentColor;stroke-width:100;stroke-linecap:round;"/>
313
313
  <rect x="150" y="250" width="600" height="1300" rx="1" style="fill:none;stroke:currentColor;stroke-width:100;"></rect>
314
314
  <rect x="1050" y="500" width="600" height="800" rx="1" style="fill:currentColor;stroke:currentColor;stroke-width:100;opacity:.5;"></rect>
315
- </svg>`},QM=900;function Lo(e,t,n,i){e.registerProvider(QM,this),this._contextPad=e,this._popupMenu=t,this._translate=n,this._canvas=i}Lo.$inject=["contextPad","popupMenu","translate","canvas"],Lo.prototype.getMultiElementContextPadEntries=function(e){var t={};return this._isAllowed(e)&&L(t,this._getEntries(e)),t},Lo.prototype._isAllowed=function(e){return!this._popupMenu.isEmpty(e,"align-elements")},Lo.prototype._getEntries=function(){var e=this;return{"align-elements":{group:"align-elements",title:e._translate("Align elements"),html:`<div class="entry">${A_.align}</div>`,action:{click:function(t,n){var i=e._getMenuPosition(n);L(i,{cursor:{x:t.x,y:t.y}}),e._popupMenu.open(n,"align-elements",i)}}}}},Lo.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 JM=["left","center","right","top","middle","bottom"];function Na(e,t,n,i){this._alignElements=t,this._translate=n,this._popupMenu=e,this._rules=i,e.registerProvider("align-elements",this)}Na.$inject=["popupMenu","alignElements","translate","rules"],Na.prototype.getPopupMenuEntries=function(e){var t={};return this._isAllowed(e)&&L(t,this._getEntries(e)),t},Na.prototype._isAllowed=function(e){return this._rules.allowed("elements.align",{elements:e})},Na.prototype._getEntries=function(e){var t=this._alignElements,n=this._translate,i=this._popupMenu,r={};return k(JM,function(o){r["align-elements-"+o]={group:"align",title:n("Align elements "+o),className:"bjs-align-elements-menu-entry",imageHtml:A_[o],action:function(){t.trigger(e,o),i.close()}}}),r};function Qc(e){qn.call(this,e)}Qc.$inject=["eventBus"],ae(Qc,qn),Qc.prototype.init=function(){this.addRule("elements.align",function(e){var t=e.elements,n=Ie(t,function(i){return!(i.waypoints||i.host||i.labelTarget)});return n=xs(n),n.length<2?!1:n})};const e2={__depends__:[pM,jv,mf],__init__:["alignElementsContextPadProvider","alignElementsMenuProvider","bpmnAlignElements"],alignElementsContextPadProvider:["type",Lo],alignElementsMenuProvider:["type",Na],bpmnAlignElements:["type",Qc]};function Hi(e,t,n,i){X.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=Ru(Qr(a.closure.topLevel)),c=a.hints,u=c?c.autoResize:!0;if(u!==!1){var l=Jr(s,function(f){return f.parent.id});k(l,function(f,p){xe(u)&&(f=f.filter(function(d){return ut(u,eo({id:d.id}))})),r._expand(f,p)})}}),this.postExecuted(["shape.toggleCollapse"],function(o){var a=o.context,s=a.hints,c=a.shape;s&&s.autoResize===!1||c.collapsed||r._expand(c.children||[],c)}),this.postExecuted(["shape.resize"],function(o){var a=o.context,s=a.hints,c=a.shape,u=c.parent;s&&s.autoResize===!1||u&&r._expand([c],u)})}Hi.$inject=["eventBus","elementRegistry","modeling","rules"],ae(Hi,X),Hi.prototype._getOptimalBounds=function(e,t){var n=this.getOffset(t),i=this.getPadding(t),r=ve(Tt(e)),o=ve(t),a={};return r.top-o.top<i.top&&(a.top=r.top-n.top),r.left-o.left<i.left&&(a.left=r.left-n.left),o.right-r.right<i.right&&(a.right=r.right+n.right),o.bottom-r.bottom<i.bottom&&(a.bottom=r.bottom+n.bottom),Ss(L({},o,a))},Hi.prototype._expand=function(e,t){typeof t=="string"&&(t=this._elementRegistry.get(t));var n=this._rules.allowed("element.autoResize",{elements:e,target:t});if(n){var i=this._getOptimalBounds(e,t);if(t2(i,t)){var r=n2(ii(t,["x","y","width","height"]),i);this.resize(t,i,{autoResize:r});var o=t.parent;o&&this._expand([t],o)}}},Hi.prototype.getOffset=function(e){return{top:60,bottom:60,left:100,right:100}},Hi.prototype.getPadding=function(e){return{top:2,bottom:2,left:15,right:15}},Hi.prototype.resize=function(e,t,n){this._modeling.resizeShape(e,t,null,n)};function t2(e,t){return e.x!==t.x||e.y!==t.y||e.width!==t.width||e.height!==t.height}function n2(e,t){var n="";return e=ve(e),t=ve(t),e.top>t.top&&(n=n.concat("n")),e.right<t.right&&(n=n.concat("w")),e.bottom<t.bottom&&(n=n.concat("s")),e.left>t.left&&(n=n.concat("e")),n}function Jc(e){e.invoke(Hi,this)}Jc.$inject=["injector"],ae(Jc,Hi),Jc.prototype.resize=function(e,t,n){v(e,"bpmn:Participant")?this._modeling.resizeLane(e,t,null,n):this._modeling.resizeShape(e,t,null,n)};function Ba(e){qn.call(this,e);var t=this;this.addRule("element.autoResize",function(n){return t.canResize(n.elements,n.target)})}Ba.$inject=["eventBus"],ae(Ba,qn),Ba.prototype.canResize=function(e,t){return!1};function eu(e,t){Ba.call(this,e),this._modeling=t}ae(eu,Ba),eu.$inject=["eventBus","modeling"],eu.prototype.canResize=function(e,t){if(v(t.di,"bpmndi:BPMNPlane")||!v(t,"bpmn:Participant")&&!v(t,"bpmn:Lane")&&!v(t,"bpmn:SubProcess"))return!1;var n=!0;return k(e,function(i){if(v(i,"bpmn:Lane")||De(i)){n=!1;return}}),n};const i2={__init__:["bpmnAutoResize","bpmnAutoResizeProvider"],bpmnAutoResize:["type",Jc],bpmnAutoResizeProvider:["type",eu]};function Io(e,t,n){this._canvas=n,this._opts=L({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()})}Io.$inject=["config.autoScroll","eventBus","canvas"],Io.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++)r2(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 r2(e,t,n){return t<e&&e<n}Io.prototype.stopScroll=function(){clearTimeout(this._scrolling)},Io.prototype.setOptions=function(e){this._opts=L({},this._opts,e)},Io.prototype._toBorderPoint=function(e){var t=this._canvas._container.getBoundingClientRect(),n=$r(e.originalEvent);return{x:n.x-t.left,y:n.y-t.top}};const o2={__depends__:[Ii],__init__:["autoScroll"],autoScroll:["type",Io]};var T_="djs-bendpoint",M_="djs-segment-dragger";function a2(e,t){var n=$r(t),i=e._container.getBoundingClientRect(),r;r={x:i.left,y:i.top};var o=e.viewbox();return{x:o.x+(n.x-r.x)/o.scale,y:o.y+(n.y-r.y)/o.scale}}function gf(e,t,n){var i=a2(e,n),r=Ll(t,i);return r}function yf(e,t){var n=ye("g");je(n).add(T_),Ae(e,n);var i=ye("circle");se(i,{cx:0,cy:0,r:4}),je(i).add("djs-visual"),Ae(n,i);var r=ye("circle");return se(r,{cx:0,cy:0,r:10}),je(r).add("djs-hit"),Ae(n,r),t&&je(n).add(t),n}function s2(e,t,n,i){var r=ye("g");Ae(e,r);var o=18,a=6,s=11,c=u2(t,n,i),u=a+s,l=ye("rect");se(l,{x:-o/2,y:-a/2,width:o,height:a}),je(l).add("djs-visual"),Ae(r,l);var f=ye("rect");return se(f,{x:-c/2,y:-u/2,width:c,height:u}),je(f).add("djs-hit"),Ae(r,f),im(r,i==="v"?90:0),r}function k_(e,t,n){var i=ye("g"),r=ul(t,n),o=Ti(t,n);return Ae(e,i),s2(i,t,n,o),je(i).add(M_),je(i).add(o==="h"?"horizontal":"vertical"),Jt(i,r.x,r.y),i}function vf(e){return Math.abs(Math.round(e*2/3))}function c2(e,t){var n=l2(e,t);return Fl(e,n)}function u2(e,t,n){var i=t.x-e.x,r=t.y-e.y;return vf(n==="h"?i:r)}function l2(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=Vm(e,[a,s]);c<i&&(i=c,r=o)}return[n[r],n[r+1]]}function D_(e,t,n,i,r){function o(b,x,S){var M=b.index,N=b.point,T,H,V,$,G,he;return M<=0||b.bendpoint?!1:(T=x[M-1],H=x[M],V=ul(T,H),$=Ti(T,H),G=Math.abs(N.x-V.x),he=Math.abs(N.y-V.y),$&&G<=S&&he<=S)}function a(b,x){var S=b.waypoints,M,N,T,H;return x.index<=0||x.bendpoint||(M={start:S[x.index-1],end:S[x.index]},N=Ti(M.start,M.end),!N)?null:(N==="h"?T=M.end.x-M.start.x:T=M.end.y-M.start.y,H=vf(T)/2,H)}function s(b,x){var S=x.waypoints,M=gf(t,S,b),N;if(M){N=a(x,M);var T;if(o(M,S,N)?T=r.start(b,x,M.index):T=i.start(b,x,M.index,!M.bendpoint),T!==!1)return!0}}function c(b,x,S){Pe.bind(b,x,function(M){n.triggerMouseEvent(x,M,S),M.stopPropagation()})}function u(b,x){var S=t.getLayer("overlays"),M=nt('.djs-bendpoints[data-element-id="'+ka(b.id)+'"]',S);return!M&&x&&(M=ye("g"),se(M,{"data-element-id":b.id}),je(M).add("djs-bendpoints"),Ae(S,M),c(M,"mousedown",b),c(M,"click",b),c(M,"dblclick",b)),M}function l(b,x){return nt('.djs-segment-dragger[data-segment-idx="'+b+'"]',x)}function f(b,x){x.waypoints.forEach(function(S,M){var N=yf(b);Ae(b,N),Jt(N,S.x,S.y)}),yf(b,"floating")}function p(b,x){for(var S=x.waypoints,M,N,T,H=1;H<S.length;H++)M=S[H-1],N=S[H],Ti(M,N)&&(T=k_(b,M,N),se(T,{"data-segment-idx":H}),c(T,"mousemove",x))}function d(b){k(ys("."+T_,b),function(x){zt(x)})}function h(b){k(ys("."+M_,b),function(x){zt(x)})}function m(b){var x=u(b);return x||(x=u(b,!0),f(x,b),p(x,b)),x}function g(b){var x=u(b);x&&(h(x),d(x),p(x,b),f(x,b))}function R(b,x){var S=nt(".floating",b),M=x.point;S&&(Jt(S,M.x,M.y),je(S).add("positioned"))}function w(b,x,S){var M=l(x.index,b),N=S[x.index-1],T=S[x.index],H=x.point,V=ul(N,T),$=Ti(N,T),G,he;M&&(G=p2(M),he={x:H.x-V.x,y:H.y-V.y},$==="v"&&(he={x:he.y,y:he.x}),Jt(G,he.x,he.y))}e.on("connection.changed",function(b){g(b.element)}),e.on("connection.remove",function(b){var x=u(b.element);x&&zt(x)}),e.on("element.marker.update",function(b){var x=b.element,S;x.waypoints&&(S=m(x),b.add?je(S).add(b.marker):je(S).remove(b.marker))}),e.on("element.mousemove",function(b){var x=b.element,S=x.waypoints,M,N;if(S){if(M=u(x,!0),N=gf(t,S,b.originalEvent),!N)return;R(M,N),N.bendpoint||w(M,N,S)}}),e.on("element.mousedown",function(b){if(cr(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 M=nt(".floating",S);M&&je(M).remove("positioned")}}}),e.on("element.updateId",function(b){var x=b.element,S=b.newId;if(x.waypoints){var M=u(x);M&&se(M,{"data-element-id":S})}}),this.addHandles=m,this.updateHandles=g,this.getBendpointsContainer=u,this.getSegmentDragger=l}D_.$inject=["eventBus","canvas","interactionEvents","bendpointMove","connectionSegmentMove"];function p2(e){return nt(".djs-visual",e)}var O_=Math.round,Ur="reconnectStart",Yr="reconnectEnd",$a="updateWaypoints";function _f(e,t,n,i,r,o){this._injector=e,this.start=function(a,s,c,u){var l=n.getGraphics(s),f=s.source,p=s.target,d=s.waypoints,h;!u&&c===0?h=Ur:!u&&c===d.length-1?h=Yr:h=$a;var m=h===$a?"connection.updateWaypoints":"connection.reconnect",g=r.allowed(m,{connection:s,source:f,target:p});if(g===!1&&(g=r.allowed(m,{connection:s,source:p,target:f})),g!==!1)return i.init(a,"bendpoint.move",{data:{connection:s,connectionGfx:l,context:{allowed:g,bendpointIndex:c,connection:s,source:f,target:p,insert:u,type:h}}})},t.on("bendpoint.move.hover",function(a){var s=a.context,c=s.connection,u=c.source,l=c.target,f=a.hover,p=s.type;s.hover=f;var d;if(f){var h=p===$a?"connection.updateWaypoints":"connection.reconnect";if(d=s.allowed=r.allowed(h,{connection:c,source:p===Ur?f:u,target:p===Yr?f:l}),d){s.source=p===Ur?f:u,s.target=p===Yr?f:l;return}d===!1&&(d=s.allowed=r.allowed(h,{connection:c,source:p===Yr?f:l,target:p===Ur?f:u})),d&&(s.source=p===Yr?f:l,s.target=p===Ur?f:u)}}),t.on(["bendpoint.move.out","bendpoint.move.cleanup"],function(a){var s=a.context,c=s.type;s.hover=null,s.source=null,s.target=null,c!==$a&&(s.allowed=!1)}),t.on("bendpoint.move.end",function(a){var s=a.context,c=s.allowed,u=s.bendpointIndex,l=s.connection,f=s.insert,p=l.waypoints.slice(),d=s.source,h=s.target,m=s.type,g=s.hints||{},R={x:O_(a.x),y:O_(a.y)};if(!c)return!1;m===$a?(f?p.splice(u,0,R):p[u]=R,g.bendpointMove={insert:f,bendpointIndex:u},p=this.cropWaypoints(l,p),o.updateWaypoints(l,A1(p),g)):(m===Ur?(g.docking="source",tu(s)&&(g.docking="target",g.newWaypoints=p.reverse())):m===Yr&&(g.docking="target",tu(s)&&(g.docking="source",g.newWaypoints=p.reverse())),o.reconnect(l,d,h,R,g))},this)}_f.$inject=["injector","eventBus","canvas","dragging","rules","modeling"],_f.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 tu(e){var t=e.hover,n=e.source,i=e.target,r=e.type;if(r===Ur)return t&&i&&t===i&&n!==i;if(r===Yr)return t&&n&&t===n&&n!==i}var f2="reconnectStart",d2="reconnectEnd",L_="updateWaypoints",ja="connect-ok",nu="connect-not-ok",I_="connect-hover",N_="djs-updating",B_="djs-dragging",$_=1100;function j_(e,t,n,i){this._injector=t;var r=t.get("connectionPreview",!1);n.on("bendpoint.move.start",function(o){var a=o.context,s=a.bendpointIndex,c=a.connection,u=a.insert,l=c.waypoints,f=l.slice();a.waypoints=l,u&&f.splice(s,0,{x:o.x,y:o.y}),c.waypoints=f;var p=a.draggerGfx=yf(i.getLayer("overlays"));je(p).add("djs-dragging"),i.addMarker(c,B_),i.addMarker(c,N_)}),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,I_),u===L_)return;s?(i.removeMarker(c,nu),i.addMarker(c,ja)):s===!1&&(i.removeMarker(c,ja),i.addMarker(c,nu))}}),n.on(["bendpoint.move.out","bendpoint.move.cleanup"],$_,function(o){var a=o.context,s=a.hover,c=a.target;s&&(i.removeMarker(s,I_),i.removeMarker(s,c?ja:nu))}),n.on("bendpoint.move.move",function(o){var a=o.context,s=a.allowed,c=a.bendpointIndex,u=a.draggerGfx,l=a.hover,f=a.type,p=a.connection,d=p.source,h=p.target,m=p.waypoints.slice(),g={x:o.x,y:o.y},R=a.hints||{},w={};r&&(R.connectionStart&&(w.connectionStart=R.connectionStart),R.connectionEnd&&(w.connectionEnd=R.connectionEnd),f===f2?tu(a)?(w.connectionEnd=w.connectionEnd||g,w.source=h,w.target=l||d,m=m.reverse()):(w.connectionStart=w.connectionStart||g,w.source=l||d,w.target=h):f===d2?tu(a)?(w.connectionStart=w.connectionStart||g,w.source=l||h,w.target=d,m=m.reverse()):(w.connectionEnd=w.connectionEnd||g,w.source=d,w.target=l||h):(w.noCropping=!0,w.noLayout=!0,m[c]=g),f===L_&&(m=e.cropWaypoints(p,m)),w.waypoints=m,r.drawPreview(a,s,w)),Jt(u,o.x,o.y)},this),n.on(["bendpoint.move.end","bendpoint.move.cancel"],$_,function(o){var a=o.context,s=a.connection,c=a.draggerGfx,u=a.hover,l=a.target,f=a.waypoints;s.waypoints=f,zt(c),i.removeMarker(s,N_),i.removeMarker(s,B_),u&&(i.removeMarker(u,ja),i.removeMarker(u,l?ja:nu)),r&&r.cleanUp(a)})}j_.$inject=["bendpointMove","injector","eventBus","canvas"];var F_="connect-hover",H_="djs-updating";function z_(e,t,n){return bf(e,t,e[t]+n)}function bf(e,t,n){return{x:t==="x"?n:e.x,y:t==="y"?n:e.y}}function h2(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 bf(t,i,s)}function V_(e){return e==="x"?"y":"x"}function G_(e,t,n){var i,r;return e.original?e.original:(i=we(t),r=V_(n),bf(e,r,i[r]))}function W_(e,t,n,i,r,o){var a=e.get("connectionDocking",!1);this.start=function(f,p,d){var h,m=n.getGraphics(p),g=d-1,R=d,w=p.waypoints,b=w[g],x=w[R],S=gf(n,w,f),M,N,T;if(M=Ti(b,x),!!M)return N=M==="v"?"x":"y",g===0&&(b=G_(b,p.source,N)),R===w.length-1&&(x=G_(x,p.target,N)),S?T=S.point:T={x:(b.x+x.x)/2,y:(b.y+x.y)/2},h={connection:p,segmentStartIndex:g,segmentEndIndex:R,segmentStart:b,segmentEnd:x,axis:N,dragPosition:T},i.init(f,T,"connectionSegment.move",{cursor:N==="x"?"resize-ew":"resize-ns",data:{connection:p,connectionGfx:m,context:h}})};function s(f,p){if(!a)return p;var d=f.waypoints,h;return f.waypoints=p,h=a.getCroppedWaypoints(f),f.waypoints=d,h}function c(f){r.update("connection",f.connection,f.connectionGfx)}function u(f,p,d){var h=f.newWaypoints,m=f.segmentStartIndex+p,g=h[m],R=f.segmentEndIndex+p,w=h[R],b=V_(f.axis),x=h2(d,g,w,b);Jt(f.draggerGfx,x.x,x.y)}function l(f,p){var d=0,h=f.filter(function(m,g){return cl(f[g-1],f[g+1],m)?(d=g<=p?d-1:d,!1):!0});return{waypoints:h,segmentOffset:d}}t.on("connectionSegment.move.start",function(f){var p=f.context,d=f.connection,h=n.getLayer("overlays");p.originalWaypoints=d.waypoints.slice(),p.draggerGfx=k_(h,p.segmentStart,p.segmentEnd),je(p.draggerGfx).add("djs-dragging"),n.addMarker(d,H_)}),t.on("connectionSegment.move.move",function(f){var p=f.context,d=p.connection,h=p.segmentStartIndex,m=p.segmentEndIndex,g=p.segmentStart,R=p.segmentEnd,w=p.axis,b=p.originalWaypoints.slice(),x=z_(g,w,f["d"+w]),S=z_(R,w,f["d"+w]),M=b.length,N=0;b[h]=x,b[m]=S;var T,H;h<2&&(T=Qt(d.source,x),h===1?T==="intersect"&&(b.shift(),b[0]=x,N--):T!=="intersect"&&(b.unshift(g),N++)),m>M-3&&(H=Qt(d.target,S),m===M-2?H==="intersect"&&(b.pop(),b[b.length-1]=S):H!=="intersect"&&b.push(R)),p.newWaypoints=d.waypoints=s(d,b),u(p,N,f),p.newSegmentStartIndex=h+N,c(f)}),t.on("connectionSegment.move.hover",function(f){f.context.hover=f.hover,n.addMarker(f.hover,F_)}),t.on(["connectionSegment.move.out","connectionSegment.move.cleanup"],function(f){var p=f.context.hover;p&&n.removeMarker(p,F_)}),t.on("connectionSegment.move.cleanup",function(f){var p=f.context,d=p.connection;p.draggerGfx&&zt(p.draggerGfx),n.removeMarker(d,H_)}),t.on(["connectionSegment.move.cancel","connectionSegment.move.end"],function(f){var p=f.context,d=p.connection;d.waypoints=p.originalWaypoints,c(f)}),t.on("connectionSegment.move.end",function(f){var p=f.context,d=p.connection,h=p.newWaypoints,m=p.newSegmentStartIndex;h=h.map(function(S){return{original:S.original,x:Math.round(S.x),y:Math.round(S.y)}});var g=l(h,m),R=g.waypoints,w=s(d,R),b=g.segmentOffset,x={segmentMove:{segmentStartIndex:p.segmentStartIndex,newSegmentStartIndex:m+b}};o.updateWaypoints(d,w,x)})}W_.$inject=["injector","eventBus","canvas","dragging","graphicsFactory","modeling"];var m2=Math.abs,U_=Math.round;function g2(e,t,n){n=n===void 0?10:n;var i,r;for(i=0;i<t.length;i++)if(r=t[i],m2(r-e)<=n)return r}function Y_(e){return{x:e.x,y:e.y}}function q_(e){return{x:e.x+e.width,y:e.y+e.height}}function Qn(e,t){return!e||isNaN(e.x)||isNaN(e.y)?t:{x:U_(e.x+e.width/2),y:U_(e.y+e.height/2)}}function No(e,t){var n=e.snapped;return n?typeof t=="string"?n[t]:n.x&&n.y:!1}function Ot(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 K_(e){return e.children||[]}var y2=Math.abs,X_=Math.round,xf=10;function Z_(e){function t(o,a){if(xe(o)){for(var s=o.length;s--;)if(y2(o[s]-a)<=xf)return o[s]}else{o=+o;var c=a%o;if(c<xf)return a-c;if(c>o-xf)return a-c+o}return a}function n(o,a){if(o.waypoints)return c2(a,o);if(o.width)return{x:X_(o.width/2+o.x),y:X_(o.height/2+o.y)}}function i(o){var a=o.context,s=a.snapPoints,c=a.connection,u=c.waypoints,l=a.segmentStart,f=a.segmentStartIndex,p=a.segmentEnd,d=a.segmentEndIndex,h=a.axis;if(s)return s;var m=[u[f-1],l,p,u[d+1]];return f<2&&m.unshift(n(c.source,o)),d>u.length-3&&m.unshift(n(c.target,o)),a.snapPoints=s={horizontal:[],vertical:[]},k(m,function(g){g&&(g=g.original||g,h==="y"&&s.horizontal.push(g.y),h==="x"&&s.vertical.push(g.x))}),s}e.on("connectionSegment.move.move",1500,function(o){var a=i(o),s=o.x,c=o.y,u,l;if(a){u=t(a.vertical,s),l=t(a.horizontal,c);var f=s-u,p=c-l;L(o,{dx:o.dx-f,dy:o.dy-p,x:u,y:l}),(f||a.vertical.indexOf(s)!==-1)&&Ot(o,"x",u),(p||a.horizontal.indexOf(c)!==-1)&&Ot(o,"y",l)}});function r(o){var a=o.snapPoints,s=o.connection.waypoints,c=o.bendpointIndex;if(a)return a;var u=[s[c-1],s[c+1]];return o.snapPoints=a={horizontal:[],vertical:[]},k(u,function(l){l&&(l=l.original||l,a.horizontal.push(l.y),a.vertical.push(l.x))}),a}e.on(["connect.hover","connect.move","connect.end"],1500,function(o){var a=o.context,s=a.hover,c=s&&n(s,o);!ot(s)||!c||!c.x||!c.y||(Ot(o,"x",c.x),Ot(o,"y",c.y))}),e.on(["bendpoint.move.move","bendpoint.move.end"],1500,function(o){var a=o.context,s=r(a),c=a.hover,u=c&&n(c,o),l=o.x,f=o.y,p,d;if(s){p=t(u?s.vertical.concat([u.x]):s.vertical,l),d=t(u?s.horizontal.concat([u.y]):s.horizontal,f);var h=l-p,m=f-d;L(o,{dx:o.dx-h,dy:o.dy-m,x:o.x-h,y:o.y-m}),(h||s.vertical.indexOf(l)!==-1)&&Ot(o,"x",p),(m||s.horizontal.indexOf(f)!==-1)&&Ot(o,"y",d)}})}Z_.$inject=["eventBus"];const v2={__depends__:[Ii,yi],__init__:["bendpoints","bendpointSnapping","bendpointMovePreview"],bendpoints:["type",D_],bendpointMove:["type",_f],bendpointMovePreview:["type",j_],connectionSegmentMove:["type",W_],bendpointSnapping:["type",Z_]};function Q_(e,t,n,i){function r(a,s){return i.allowed("connection.create",{source:a,target:s})}function o(a,s){return r(s,a)}e.on("connect.hover",function(a){var s=a.context,c=s.start,u=a.hover,l;if(s.hover=u,l=s.canExecute=r(c,u),!Zr(l)){if(l!==!1){s.source=c,s.target=u;return}l=s.canExecute=o(c,u),!Zr(l)&&l!==!1&&(s.source=u,s.target=c)}}),e.on(["connect.out","connect.cleanup"],function(a){var s=a.context;s.hover=null,s.source=null,s.target=null,s.canExecute=!1}),e.on("connect.end",function(a){var s=a.context,c=s.canExecute,u=s.connectionStart,l={x:a.x,y:a.y},f=s.source,p=s.target;if(!c)return!1;var d=null,h={connectionStart:wf(s)?l:u,connectionEnd:wf(s)?u:l};Ut(c)&&(d=c),s.connection=n.connect(f,p,d,h)}),this.start=function(a,s,c,u){Ut(c)||(u=c,c=we(s)),t.init(a,"connect",{autoActivate:u,data:{shape:s,context:{start:s,connectionStart:c}}})}}Q_.$inject=["eventBus","dragging","modeling","rules"];function wf(e){var t=e.hover,n=e.source,i=e.target;return t&&n&&t===n&&n!==i}var _2=1100,b2=900,J_="connect-ok",eb="connect-not-ok";function tb(e,t,n){var i=e.get("connectionPreview",!1);i&&t.on("connect.move",function(r){var o=r.context,a=o.canExecute,s=o.hover,c=o.source,u=o.start,l=o.startPosition,f=o.target,p=o.connectionStart||l,d=o.connectionEnd||{x:r.x,y:r.y},h=p,m=d;wf(o)&&(h=d,m=p),i.drawPreview(o,a,{source:c||u,target:f||s,connectionStart:h,connectionEnd:m})}),t.on("connect.hover",b2,function(r){var o=r.context,a=r.hover,s=o.canExecute;s!==null&&n.addMarker(a,s?J_:eb)}),t.on(["connect.out","connect.cleanup"],_2,function(r){var o=r.hover;o&&(n.removeMarker(o,J_),n.removeMarker(o,eb))}),i&&t.on("connect.cleanup",function(r){i.cleanUp(r.context)})}tb.$inject=["injector","eventBus","canvas"];const Ef={__depends__:[Kn,yi,Ii],__init__:["connectPreview"],connect:["type",Q_],connectPreview:["type",tb]};var x2="djs-dragger";function zi(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)}zi.$inject=["injector","canvas","graphicsFactory","elementFactory"],zi.prototype.drawPreview=function(e,t,n){n=n||{};var i=e.connectionPreviewGfx,r=e.getConnection,o=n.source,a=n.target,s=n.waypoints,c=n.connectionStart,u=n.connectionEnd,l=n.noLayout,f=n.noCropping,p=n.noNoop,d,h=this;if(i||(i=e.connectionPreviewGfx=this.createConnectionPreviewGfx()),vs(i),r||(r=e.getConnection=w2(function(m,g,R){return h.getConnection(m,g,R)})),t&&(d=r(t,o,a)),!d){!p&&this.drawNoopPreview(i,n);return}d.waypoints=s||[],this._layouter&&!l&&(d.waypoints=this._layouter.layoutConnection(d,{source:o,target:a,connectionStart:c,connectionEnd:u,waypoints:n.waypoints||d.waypoints})),(!d.waypoints||!d.waypoints.length)&&(d.waypoints=[o?we(o):c,a?we(a):u]),this._connectionDocking&&(o||a)&&!f&&(d.waypoints=this._connectionDocking.getCroppedWaypoints(d,o,a)),this._graphicsFactory.drawConnection(i,d,{stroke:"var(--element-dragger-color)"})},zi.prototype.drawNoopPreview=function(e,t){var n=t.source,i=t.target,r=t.connectionStart||we(n),o=t.connectionEnd||we(i),a=this.cropWaypoints(r,o,n,i),s=this.createNoopConnection(a[0],a[1]);Ae(e,s)},zi.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&&Jo(o,s,!0)||e,t=i&&Jo(a,s,!1)||t,[e,t]},zi.prototype.cleanUp=function(e){e&&e.connectionPreviewGfx&&zt(e.connectionPreviewGfx)},zi.prototype.getConnection=function(e){var t=E2(e);return this._elementFactory.createConnection(t)},zi.prototype.createConnectionPreviewGfx=function(){var e=ye("g");return se(e,{pointerEvents:"none"}),je(e).add(x2),Ae(this._canvas.getActiveLayer(),e),e},zi.prototype.createNoopConnection=function(e,t){return Ko([e,t],{stroke:"#333",strokeDasharray:[1],strokeWidth:2,"pointer-events":"none"})};function w2(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 E2(e){return Ut(e)?e:{}}const S2={__init__:["connectionPreview"],connectionPreview:["type",zi]},iu="complex-preview";class nb{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(iu);n.filter(s=>!R2(s)).forEach(s=>{let c;ot(s)?(c=this._graphicsFactory._createContainer("connection",ye("g")),this._graphicsFactory.drawConnection(Ir(c),s)):(c=this._graphicsFactory._createContainer("shape",ye("g")),this._graphicsFactory.drawShape(Ir(c),s),Jt(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);ot(s)?Jt(u,c.x,c.y):Jt(u,s.x+c.x,s.y+c.y)}),r.forEach(s=>{this._previewSupport.addDragger(s,a,void 0,"djs-dragging"),this._canvas.addMarker(s,"djs-element-hidden"),this._markers.push([s,"djs-element-hidden"])}),o.forEach(({shape:s,bounds:c})=>{this._canvas.addMarker(s,"djs-hidden"),this._markers.push([s,"djs-hidden"]),this._previewSupport.addDragger(s,a,void 0,"djs-dragging");const u=this._graphicsFactory._createContainer("shape",ye("g"));this._graphicsFactory.drawShape(Ir(u),s,{width:c.width,height:c.height}),Jt(u,c.x,c.y),this._previewSupport.addDragger(s,a,u)})}cleanUp(){vs(this._canvas.getLayer(iu)),this._markers.forEach(([t,n])=>this._canvas.removeMarker(t,n)),this._markers=[]}show(){this._canvas.showLayer(iu)}hide(){this._canvas.hideLayer(iu)}}nb.$inject=["canvas","graphicsFactory","previewSupport"];function R2(e){return e.hidden}const C2={__depends__:[Co],__init__:["complexPreview"],complexPreview:["type",nb]},ib=Math.round;function ru(e,t,n,i,r,o){this._complexPreview=e,this._connectionDocking=t,this._elementFactory=n,this._eventBus=i,this._layouter=r,this._rules=o}ru.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(L({type:t},n)),l=a.fire("autoPlace",{source:e,shape:u});if(!l)return;L(u,{x:l.x-ib(u.width/2),y:l.y-ib(u.height/2)});const f=c.allowed("connection.create",{source:e,target:u,hints:{targetParent:e.parent}});let p=null;f&&(p=o.createConnection(f),p.waypoints=s.layoutConnection(p,{source:e,target:u}),p.waypoints=r.getCroppedWaypoints(p,e,u)),i.create({created:[u,p].filter(d=>!Zr(d))})},ru.prototype.cleanUp=function(){this._complexPreview.cleanUp()},ru.$inject=["complexPreview","connectionDocking","elementFactory","eventBus","layouter","rules"];const P2={__depends__:[kc,C2,qp],__init__:["appendPreview"],appendPreview:["type",ru]};var rb=Math.min,ob=Math.max;function Sf(e){e.preventDefault()}function Fa(e){e.stopPropagation()}function A2(e){return e.nodeType===Node.TEXT_NODE}function T2(e){return[].slice.call(e)}function oi(e){this.container=e.container,this.parent=lt('<div class="djs-direct-editing-parent"><div class="djs-direct-editing-content" contenteditable="true"></div></div>'),this.content=nt("[contenteditable]",this.parent),this.keyHandler=e.keyHandler||function(){},this.resizeHandler=e.resizeHandler||function(){},this.focusoutHandler=e.focusoutHandler||function(){},this.autoResize=_n(this.autoResize,this),this.handlePaste=_n(this.handlePaste,this)}oi.prototype.create=function(e,t,n,i){var r=this,o=this.parent,a=this.content,s=this.container;i=this.options=i||{},t=this.style=t||{};var c=ii(t,["width","height","maxWidth","maxHeight","minWidth","minHeight","left","top","backgroundColor","position","overflow","border","wordWrap","textAlign","outline","transform"]);L(o.style,{width:e.width+"px",height:e.height+"px",maxWidth:e.maxWidth+"px",maxHeight:e.maxHeight+"px",minWidth:e.minWidth+"px",minHeight:e.minHeight+"px",left:e.x+"px",top:e.y+"px",backgroundColor:"#ffffff",position:"absolute",overflow:"visible",border:"1px solid #ccc",boxSizing:"border-box",wordWrap:"normal",textAlign:"center",outline:"none"},c);var u=ii(t,["fontFamily","fontSize","fontWeight","lineHeight","padding","paddingTop","paddingRight","paddingBottom","paddingLeft"]);return L(a.style,{boxSizing:"border-box",width:"100%",outline:"none",wordWrap:"break-word"},u),i.centerVertically&&L(a.style,{position:"absolute",top:"50%",transform:"translate(0, -50%)"},u),a.innerText=n,Pe.bind(a,"keydown",this.keyHandler),Pe.bind(a,"mousedown",Fa),Pe.bind(a,"paste",r.handlePaste),Pe.bind(a,"focusout",this.focusoutHandler),i.autoResize&&Pe.bind(a,"input",this.autoResize),i.resizable&&this.resizable(t),s.appendChild(o),this.setSelection(a.lastChild,a.lastChild&&a.lastChild.length),o},oi.prototype.handlePaste=function(e){var t=this.options,n=this.style;e.preventDefault();var i;if(e.clipboardData?i=e.clipboardData.getData("text/plain"):i=window.clipboardData.getData("Text"),this.insertText(i),t.autoResize){var r=this.autoResize(n);r&&this.resizeHandler(r)}},oi.prototype.insertText=function(e){e=M2(e);var t=document.execCommand("insertText",!1,e);t||this._insertTextIE(e)},oi.prototype._insertTextIE=function(e){var t=this.getSelection(),n=t.startContainer,i=t.endContainer,r=t.startOffset,o=t.endOffset,a=t.commonAncestorContainer,s=T2(a.childNodes),c,u;if(A2(a)){var l=n.textContent;n.textContent=l.substring(0,r)+e+l.substring(o),c=n,u=r+e.length}else if(n===this.content&&i===this.content){var f=document.createTextNode(e);this.content.insertBefore(f,s[r]),c=f,u=f.textContent.length}else{var p=s.indexOf(n),d=s.indexOf(i);s.forEach(function(h,m){m===p?h.textContent=n.textContent.substring(0,r)+e+i.textContent.substring(o):m>p&&m<=d&&pi(h)}),c=n,u=r+e.length}c&&u!==void 0&&setTimeout(function(){self.setSelection(c,u)})},oi.prototype.autoResize=function(){var e=this.parent,t=this.content,n=parseInt(this.style.fontSize)||12;if(t.scrollHeight>e.offsetHeight||t.scrollHeight<e.offsetHeight-n){var i=e.getBoundingClientRect(),r=t.scrollHeight;e.style.height=r+"px",this.resizeHandler({width:i.width,height:i.height,dx:0,dy:r-i.height})}},oi.prototype.resizable=function(){var e=this,t=this.parent,n=this.resizeHandle,i=parseInt(this.style.minWidth)||0,r=parseInt(this.style.minHeight)||0,o=parseInt(this.style.maxWidth)||1/0,a=parseInt(this.style.maxHeight)||1/0;if(!n){n=this.resizeHandle=lt('<div class="djs-direct-editing-resize-handle"></div>');var s,c,u,l,f=function(h){Sf(h),Fa(h),s=h.clientX,c=h.clientY;var m=t.getBoundingClientRect();u=m.width,l=m.height,Pe.bind(document,"mousemove",p),Pe.bind(document,"mouseup",d)},p=function(h){Sf(h),Fa(h);var m=rb(ob(u+h.clientX-s,i),o),g=rb(ob(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){Sf(h),Fa(h),Pe.unbind(document,"mousemove",p,!1),Pe.unbind(document,"mouseup",d,!1)};Pe.bind(n,"mousedown",f)}L(n.style,{position:"absolute",bottom:"0px",right:"0px",cursor:"nwse-resize",width:"0",height:"0",borderTop:(parseInt(this.style.fontSize)/4||3)+"px solid transparent",borderRight:(parseInt(this.style.fontSize)/4||3)+"px solid #ccc",borderBottom:(parseInt(this.style.fontSize)/4||3)+"px solid #ccc",borderLeft:(parseInt(this.style.fontSize)/4||3)+"px solid transparent"}),t.appendChild(n)},oi.prototype.destroy=function(){var e=this.parent,t=this.content,n=this.resizeHandle;t.innerText="",e.removeAttribute("style"),t.removeAttribute("style"),Pe.unbind(t,"keydown",this.keyHandler),Pe.unbind(t,"mousedown",Fa),Pe.unbind(t,"input",this.autoResize),Pe.unbind(t,"paste",this.handlePaste),Pe.unbind(t,"focusout",this.focusoutHandler),n&&(n.removeAttribute("style"),pi(n)),pi(e)},oi.prototype.getValue=function(){return this.content.innerText.trim()},oi.prototype.getSelection=function(){var e=window.getSelection(),t=e.getRangeAt(0);return t},oi.prototype.setSelection=function(e,t){var n=document.createRange();e===null?n.selectNodeContents(this.content):(n.setStart(e,t),n.setEnd(e,t));var i=window.getSelection();i.removeAllRanges(),i.addRange(n)};function M2(e){return e.replace(/\r\n|\r|\n/g,`
316
- `)}function On(e,t){this._eventBus=e,this._canvas=t,this._providers=[],this._textbox=new oi({container:t.getContainer(),keyHandler:_n(this._handleKey,this),resizeHandler:_n(this._handleResize,this),focusoutHandler:_n(this._handleFocusout,this)}),e.on(["diagram.clear","diagram.destroy"],()=>this._cleanup())}On.$inject=["eventBus","canvas"],On.prototype.registerProvider=function(e){this._providers.push(e)},On.prototype.isActive=function(e){return!!(this._active&&(!e||this._active.element===e))},On.prototype.cancel=function(){this._active&&(this._fire("cancel"),this.close())},On.prototype._fire=function(e,t){this._eventBus.fire("directEditing."+e,t||{active:this._active})},On.prototype.close=function(){this._fire("deactivate"),this._cleanup(),this._canvas.restoreFocus&&this._canvas.restoreFocus()},On.prototype._cleanup=function(){this._active&&(this._textbox.destroy(),this._active=null,this.resizable=void 0)},On.prototype.complete=function(){var e=this._active;if(e){var t,n=e.context.bounds,i=this.$textbox.getBoundingClientRect(),r=this.getValue(),o=e.context.text;(r!==o||i.height!==n.height||i.width!==n.width)&&(t=this._textbox.container.getBoundingClientRect(),e.provider.update(e.element,r,e.context.text,{x:i.left-t.left,y:i.top-t.top,width:i.width,height:i.height})),this._fire("complete"),this.close()}},On.prototype.getValue=function(){return this._textbox.getValue()},On.prototype._handleKey=function(e){e.stopPropagation();var t=e.keyCode||e.charCode;if(t===27)return e.preventDefault(),this.cancel();if(t===13&&!e.shiftKey)return e.preventDefault(),this.complete()},On.prototype._handleResize=function(e){this._fire("resize",e)},On.prototype._handleFocusout=function(e){e.relatedTarget&&this._textbox.parent.contains(e.relatedTarget)||this.complete()},On.prototype.activate=function(e){if(this.isActive()&&this.cancel(),this._eventBus.fire("directEditing.activate.allowed",{element:e})===!1)return!1;var t,n=ut(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 ab={__depends__:[sc],__init__:["directEditing"],directEditing:["type",On]};function k2(e){return function(t){var n=t.target,i=Z(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===$e(e);return!o||!a||!s||!c}}const D2={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 K(e,t={}){var n=D2[e];if(!n)throw new Error("unknown popup entry <"+e+">");return{...n,actionName:"replace-with-"+e,...t}}var O2=[K("none-start-event",{actionName:"replace-with-none-start"}),K("none-intermediate-throwing"),K("none-end-event",{actionName:"replace-with-none-end"}),K("message-start"),K("timer-start"),K("conditional-start"),K("signal-start")],L2=[K("none-start-event",{actionName:"replace-with-none-start"}),K("none-intermediate-throwing"),K("none-end-event",{actionName:"replace-with-none-end"})],I2=[K("none-start-event",{actionName:"replace-with-none-start"}),K("none-intermediate-throwing",{actionName:"replace-with-none-intermediate-throw"}),K("none-end-event",{actionName:"replace-with-none-end"}),K("message-intermediate-catch"),K("message-intermediate-throw"),K("timer-intermediate-catch"),K("escalation-intermediate-throw"),K("conditional-intermediate-catch"),K("link-intermediate-catch"),K("link-intermediate-throw"),K("compensation-intermediate-throw"),K("signal-intermediate-catch"),K("signal-intermediate-throw")],N2=[K("none-start-event",{actionName:"replace-with-none-start"}),K("none-intermediate-throwing",{actionName:"replace-with-none-intermediate-throw"}),K("none-end-event",{actionName:"replace-with-none-end"}),K("message-end"),K("escalation-end"),K("error-end"),K("cancel-end"),K("compensation-end"),K("signal-end"),K("terminate-end")],B2=[K("exclusive-gateway"),K("parallel-gateway"),K("inclusive-gateway"),K("complex-gateway"),K("event-based-gateway")],$2=[K("transaction"),K("event-subprocess"),K("expanded-ad-hoc-subprocess",{actionName:"replace-with-ad-hoc-subprocess",label:"Ad-hoc sub-process"}),K("collapsed-subprocess")],j2=[K("expanded-subprocess",{actionName:"replace-with-subprocess",label:"Sub-process"}),K("transaction"),K("event-subprocess"),K("collapsed-ad-hoc-subprocess")],sb=[K("transaction"),K("expanded-subprocess",{actionName:"replace-with-subprocess",label:"Sub-process"}),K("expanded-ad-hoc-subprocess",{actionName:"replace-with-ad-hoc-subprocess",label:"Ad-hoc sub-process"}),K("event-subprocess")],F2=sb,cb=[K("task"),K("user-task"),K("service-task"),K("send-task"),K("receive-task"),K("manual-task"),K("rule-task"),K("script-task"),K("call-activity"),K("collapsed-subprocess"),K("expanded-subprocess"),K("collapsed-ad-hoc-subprocess"),K("expanded-ad-hoc-subprocess",{actionName:"replace-with-ad-hoc-subprocess"})],H2=[K("data-store-reference")],z2=[K("data-object-reference")],V2=[K("message-boundary"),K("timer-boundary"),K("escalation-boundary"),K("conditional-boundary"),K("error-boundary"),K("cancel-boundary"),K("signal-boundary"),K("compensation-boundary"),K("non-interrupting-message-boundary"),K("non-interrupting-timer-boundary"),K("non-interrupting-escalation-boundary"),K("non-interrupting-conditional-boundary"),K("non-interrupting-signal-boundary")],G2=[K("message-start"),K("timer-start"),K("conditional-start"),K("signal-start"),K("error-start"),K("escalation-start"),K("compensation-start"),K("non-interrupting-message-start"),K("non-interrupting-timer-start"),K("non-interrupting-conditional-start"),K("non-interrupting-signal-start"),K("non-interrupting-escalation-start")],W2=[{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"}],U2=[K("expanded-pool"),K("collapsed-pool",{label:function(e){var t="Empty pool/participant";return e.children&&e.children.length&&(t+=" (removes content)"),t}})],Y2={"bpmn:MessageEventDefinition":[K("message-start"),K("message-intermediate-catch"),K("message-intermediate-throw"),K("message-end")],"bpmn:TimerEventDefinition":[K("timer-start"),K("timer-intermediate-catch")],"bpmn:ConditionalEventDefinition":[K("conditional-start"),K("conditional-intermediate-catch")],"bpmn:SignalEventDefinition":[K("signal-start"),K("signal-intermediate-catch"),K("signal-intermediate-throw"),K("signal-end")],"bpmn:ErrorEventDefinition":[K("error-start"),K("error-end")],"bpmn:EscalationEventDefinition":[K("escalation-start"),K("escalation-intermediate-throw"),K("escalation-end")],"bpmn:CompensateEventDefinition":[K("compensation-start"),K("compensation-intermediate-throw"),K("compensation-end")]};const ub={"start-event-non-interrupting":`
315
+ </svg>`},r2=900;function No(e,t,n,i){e.registerProvider(r2,this),this._contextPad=e,this._popupMenu=t,this._translate=n,this._canvas=i}No.$inject=["contextPad","popupMenu","translate","canvas"],No.prototype.getMultiElementContextPadEntries=function(e){var t={};return this._isAllowed(e)&&I(t,this._getEntries(e)),t},No.prototype._isAllowed=function(e){return!this._popupMenu.isEmpty(e,"align-elements")},No.prototype._getEntries=function(){var e=this;return{"align-elements":{group:"align-elements",title:e._translate("Align elements"),html:`<div class="entry">${M_.align}</div>`,action:{click:function(t,n){var i=e._getMenuPosition(n);I(i,{cursor:{x:t.x,y:t.y}}),e._popupMenu.open(n,"align-elements",i)}}}}},No.prototype._getMenuPosition=function(e){var t=5,n=this._contextPad.getPad(e).html,i=n.getBoundingClientRect(),r={x:i.left,y:i.bottom+t};return r};var o2=["left","center","right","top","middle","bottom"];function ja(e,t,n,i){this._alignElements=t,this._translate=n,this._popupMenu=e,this._rules=i,e.registerProvider("align-elements",this)}ja.$inject=["popupMenu","alignElements","translate","rules"],ja.prototype.getPopupMenuEntries=function(e){var t={};return this._isAllowed(e)&&I(t,this._getEntries(e)),t},ja.prototype._isAllowed=function(e){return this._rules.allowed("elements.align",{elements:e})},ja.prototype._getEntries=function(e){var t=this._alignElements,n=this._translate,i=this._popupMenu,r={};return k(o2,function(o){r["align-elements-"+o]={group:"align",title:n("Align elements "+o),className:"bjs-align-elements-menu-entry",imageHtml:M_[o],action:function(){t.trigger(e,o),i.close()}}}),r};function tu(e){Un.call(this,e)}tu.$inject=["eventBus"],ae(tu,Un),tu.prototype.init=function(){this.addRule("elements.align",function(e){var t=e.elements,n=Be(t,function(i){return!(i.waypoints||i.host||i.labelTarget)});return n=Ss(n),n.length<2?!1:n})};const a2={__depends__:[yM,Hv,mf],__init__:["alignElementsContextPadProvider","alignElementsMenuProvider","bpmnAlignElements"],alignElementsContextPadProvider:["type",No],alignElementsMenuProvider:["type",ja],bpmnAlignElements:["type",tu]};function zi(e,t,n,i){X.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=Ru(eo(a.closure.topLevel)),c=a.hints,u=c?c.autoResize:!0;if(u!==!1){var l=to(s,function(f){return f.parent.id});k(l,function(f,p){we(u)&&(f=f.filter(function(d){return ut(u,no({id:d.id}))})),r._expand(f,p)})}}),this.postExecuted(["shape.toggleCollapse"],function(o){var a=o.context,s=a.hints,c=a.shape;s&&s.autoResize===!1||c.collapsed||r._expand(c.children||[],c)}),this.postExecuted(["shape.resize"],function(o){var a=o.context,s=a.hints,c=a.shape,u=c.parent;s&&s.autoResize===!1||u&&r._expand([c],u)})}zi.$inject=["eventBus","elementRegistry","modeling","rules"],ae(zi,X),zi.prototype._getOptimalBounds=function(e,t){var n=this.getOffset(t),i=this.getPadding(t),r=be(Mt(e)),o=be(t),a={};return r.top-o.top<i.top&&(a.top=r.top-n.top),r.left-o.left<i.left&&(a.left=r.left-n.left),o.right-r.right<i.right&&(a.right=r.right+n.right),o.bottom-r.bottom<i.bottom&&(a.bottom=r.bottom+n.bottom),Ps(I({},o,a))},zi.prototype._expand=function(e,t){typeof t=="string"&&(t=this._elementRegistry.get(t));var n=this._rules.allowed("element.autoResize",{elements:e,target:t});if(n){var i=this._getOptimalBounds(e,t);if(s2(i,t)){var r=c2(ni(t,["x","y","width","height"]),i);this.resize(t,i,{autoResize:r});var o=t.parent;o&&this._expand([t],o)}}},zi.prototype.getOffset=function(e){return{top:60,bottom:60,left:100,right:100}},zi.prototype.getPadding=function(e){return{top:2,bottom:2,left:15,right:15}},zi.prototype.resize=function(e,t,n){this._modeling.resizeShape(e,t,null,n)};function s2(e,t){return e.x!==t.x||e.y!==t.y||e.width!==t.width||e.height!==t.height}function c2(e,t){var n="";return e=be(e),t=be(t),e.top>t.top&&(n=n.concat("n")),e.right<t.right&&(n=n.concat("w")),e.bottom<t.bottom&&(n=n.concat("s")),e.left>t.left&&(n=n.concat("e")),n}function nu(e){e.invoke(zi,this)}nu.$inject=["injector"],ae(nu,zi),nu.prototype.resize=function(e,t,n){v(e,"bpmn:Participant")?this._modeling.resizeLane(e,t,null,n):this._modeling.resizeShape(e,t,null,n)};function Fa(e){Un.call(this,e);var t=this;this.addRule("element.autoResize",function(n){return t.canResize(n.elements,n.target)})}Fa.$inject=["eventBus"],ae(Fa,Un),Fa.prototype.canResize=function(e,t){return!1};function iu(e,t){Fa.call(this,e),this._modeling=t}ae(iu,Fa),iu.$inject=["eventBus","modeling"],iu.prototype.canResize=function(e,t){if(v(t.di,"bpmndi:BPMNPlane")||!v(t,"bpmn:Participant")&&!v(t,"bpmn:Lane")&&!v(t,"bpmn:SubProcess"))return!1;var n=!0;return k(e,function(i){if(v(i,"bpmn:Lane")||De(i)){n=!1;return}}),n};const u2={__init__:["bpmnAutoResize","bpmnAutoResizeProvider"],bpmnAutoResize:["type",nu],bpmnAutoResizeProvider:["type",iu]};function Bo(e,t,n){this._canvas=n,this._opts=I({scrollThresholdIn:[20,20,20,20],scrollThresholdOut:[0,0,0,0],scrollRepeatTimeout:15,scrollStep:10},e);var i=this;t.on("drag.move",function(r){var o=i._toBorderPoint(r);i.startScroll(o)}),t.on(["drag.cleanup"],function(){i.stopScroll()})}Bo.$inject=["config.autoScroll","eventBus","canvas"],Bo.prototype.startScroll=function(e){var t=this._canvas,n=this._opts,i=this,r=t.getContainer().getBoundingClientRect(),o=[e.x,e.y,r.width-e.x,r.height-e.y];this.stopScroll();for(var a=0,s=0,c=0;c<4;c++)l2(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 l2(e,t,n){return t<e&&e<n}Bo.prototype.stopScroll=function(){clearTimeout(this._scrolling)},Bo.prototype.setOptions=function(e){this._opts=I({},this._opts,e)},Bo.prototype._toBorderPoint=function(e){var t=this._canvas._container.getBoundingClientRect(),n=$r(e.originalEvent);return{x:n.x-t.left,y:n.y-t.top}};const p2={__depends__:[Ni],__init__:["autoScroll"],autoScroll:["type",Bo]};var k_="djs-bendpoint",O_="djs-segment-dragger";function f2(e,t){var n=$r(t),i=e._container.getBoundingClientRect(),r;r={x:i.left,y:i.top};var o=e.viewbox();return{x:o.x+(n.x-r.x)/o.scale,y:o.y+(n.y-r.y)/o.scale}}function gf(e,t,n){var i=f2(e,n),r=Ll(t,i);return r}function yf(e,t){var n=ve("g");ze(n).add(k_),Te(e,n);var i=ve("circle");se(i,{cx:0,cy:0,r:4}),ze(i).add("djs-visual"),Te(n,i);var r=ve("circle");return se(r,{cx:0,cy:0,r:10}),ze(r).add("djs-hit"),Te(n,r),t&&ze(n).add(t),n}function d2(e,t,n,i){var r=ve("g");Te(e,r);var o=18,a=6,s=11,c=m2(t,n,i),u=a+s,l=ve("rect");se(l,{x:-o/2,y:-a/2,width:o,height:a}),ze(l).add("djs-visual"),Te(r,l);var f=ve("rect");return se(f,{x:-c/2,y:-u/2,width:c,height:u}),ze(f).add("djs-hit"),Te(r,f),om(r,i==="v"?90:0),r}function D_(e,t,n){var i=ve("g"),r=ul(t,n),o=Mi(t,n);return Te(e,i),d2(i,t,n,o),ze(i).add(O_),ze(i).add(o==="h"?"horizontal":"vertical"),Jt(i,r.x,r.y),i}function vf(e){return Math.abs(Math.round(e*2/3))}function h2(e,t){var n=g2(e,t);return Fl(e,n)}function m2(e,t,n){var i=t.x-e.x,r=t.y-e.y;return vf(n==="h"?i:r)}function g2(e,t){for(var n=t.waypoints,i=1/0,r,o=0;o<n.length-1;o++){var a=n[o],s=n[o+1],c=Wm(e,[a,s]);c<i&&(i=c,r=o)}return[n[r],n[r+1]]}function L_(e,t,n,i,r){function o(x,w,S){var M=x.index,N=x.point,T,H,G,$,V,de;return M<=0||x.bendpoint?!1:(T=w[M-1],H=w[M],G=ul(T,H),$=Mi(T,H),V=Math.abs(N.x-G.x),de=Math.abs(N.y-G.y),$&&V<=S&&de<=S)}function a(x,w){var S=x.waypoints,M,N,T,H;return w.index<=0||w.bendpoint||(M={start:S[w.index-1],end:S[w.index]},N=Mi(M.start,M.end),!N)?null:(N==="h"?T=M.end.x-M.start.x:T=M.end.y-M.start.y,H=vf(T)/2,H)}function s(x,w){var S=w.waypoints,M=gf(t,S,x),N;if(M){N=a(w,M);var T;if(o(M,S,N)?T=r.start(x,w,M.index):T=i.start(x,w,M.index,!M.bendpoint),T!==!1)return!0}}function c(x,w,S){Ae.bind(x,w,function(M){n.triggerMouseEvent(w,M,S),M.stopPropagation()})}function u(x,w){var S=t.getLayer("overlays"),M=nt('.djs-bendpoints[data-element-id="'+La(x.id)+'"]',S);return!M&&w&&(M=ve("g"),se(M,{"data-element-id":x.id}),ze(M).add("djs-bendpoints"),Te(S,M),c(M,"mousedown",x),c(M,"click",x),c(M,"dblclick",x)),M}function l(x,w){return nt('.djs-segment-dragger[data-segment-idx="'+x+'"]',w)}function f(x,w){w.waypoints.forEach(function(S,M){var N=yf(x);Te(x,N),Jt(N,S.x,S.y)}),yf(x,"floating")}function p(x,w){for(var S=w.waypoints,M,N,T,H=1;H<S.length;H++)M=S[H-1],N=S[H],Mi(M,N)&&(T=D_(x,M,N),se(T,{"data-segment-idx":H}),c(T,"mousemove",w))}function d(x){k(bs("."+k_,x),function(w){zt(w)})}function h(x){k(bs("."+O_,x),function(w){zt(w)})}function m(x){var w=u(x);return w||(w=u(x,!0),f(w,x),p(w,x)),w}function g(x){var w=u(x);w&&(h(w),d(w),p(w,x),f(w,x))}function R(x,w){var S=nt(".floating",x),M=w.point;S&&(Jt(S,M.x,M.y),ze(S).add("positioned"))}function E(x,w,S){var M=l(w.index,x),N=S[w.index-1],T=S[w.index],H=w.point,G=ul(N,T),$=Mi(N,T),V,de;M&&(V=y2(M),de={x:H.x-G.x,y:H.y-G.y},$==="v"&&(de={x:de.y,y:de.x}),Jt(V,de.x,de.y))}e.on("connection.changed",function(x){g(x.element)}),e.on("connection.remove",function(x){var w=u(x.element);w&&zt(w)}),e.on("element.marker.update",function(x){var w=x.element,S;w.waypoints&&(S=m(w),x.add?ze(S).add(x.marker):ze(S).remove(x.marker))}),e.on("element.mousemove",function(x){var w=x.element,S=w.waypoints,M,N;if(S){if(M=u(w,!0),N=gf(t,S,x.originalEvent),!N)return;R(M,N),N.bendpoint||E(M,N,S)}}),e.on("element.mousedown",function(x){if(cr(x)){var w=x.originalEvent,S=x.element;if(S.waypoints)return s(w,S)}}),e.on("selection.changed",function(x){var w=x.newSelection,S=w[0];S&&S.waypoints&&m(S)}),e.on("element.hover",function(x){var w=x.element;w.waypoints&&m(w)}),e.on("element.out",function(x){var w=x.element;if(w.waypoints){var S=u(w);if(S){var M=nt(".floating",S);M&&ze(M).remove("positioned")}}}),e.on("element.updateId",function(x){var w=x.element,S=x.newId;if(w.waypoints){var M=u(w);M&&se(M,{"data-element-id":S})}}),this.addHandles=m,this.updateHandles=g,this.getBendpointsContainer=u,this.getSegmentDragger=l}L_.$inject=["eventBus","canvas","interactionEvents","bendpointMove","connectionSegmentMove"];function y2(e){return nt(".djs-visual",e)}var I_=Math.round,Ur="reconnectStart",Yr="reconnectEnd",Ha="updateWaypoints";function _f(e,t,n,i,r,o){this._injector=e,this.start=function(a,s,c,u){var l=n.getGraphics(s),f=s.source,p=s.target,d=s.waypoints,h;!u&&c===0?h=Ur:!u&&c===d.length-1?h=Yr:h=Ha;var m=h===Ha?"connection.updateWaypoints":"connection.reconnect",g=r.allowed(m,{connection:s,source:f,target:p});if(g===!1&&(g=r.allowed(m,{connection:s,source:p,target:f})),g!==!1)return i.init(a,"bendpoint.move",{data:{connection:s,connectionGfx:l,context:{allowed:g,bendpointIndex:c,connection:s,source:f,target:p,insert:u,type:h}}})},t.on("bendpoint.move.hover",function(a){var s=a.context,c=s.connection,u=c.source,l=c.target,f=a.hover,p=s.type;s.hover=f;var d;if(f){var h=p===Ha?"connection.updateWaypoints":"connection.reconnect";if(d=s.allowed=r.allowed(h,{connection:c,source:p===Ur?f:u,target:p===Yr?f:l}),d){s.source=p===Ur?f:u,s.target=p===Yr?f:l;return}d===!1&&(d=s.allowed=r.allowed(h,{connection:c,source:p===Yr?f:l,target:p===Ur?f:u})),d&&(s.source=p===Yr?f:l,s.target=p===Ur?f:u)}}),t.on(["bendpoint.move.out","bendpoint.move.cleanup"],function(a){var s=a.context,c=s.type;s.hover=null,s.source=null,s.target=null,c!==Ha&&(s.allowed=!1)}),t.on("bendpoint.move.end",function(a){var s=a.context,c=s.allowed,u=s.bendpointIndex,l=s.connection,f=s.insert,p=l.waypoints.slice(),d=s.source,h=s.target,m=s.type,g=s.hints||{},R={x:I_(a.x),y:I_(a.y)};if(!c)return!1;m===Ha?(f?p.splice(u,0,R):p[u]=R,g.bendpointMove={insert:f,bendpointIndex:u},p=this.cropWaypoints(l,p),o.updateWaypoints(l,L1(p),g)):(m===Ur?(g.docking="source",ru(s)&&(g.docking="target",g.newWaypoints=p.reverse())):m===Yr&&(g.docking="target",ru(s)&&(g.docking="source",g.newWaypoints=p.reverse())),o.reconnect(l,d,h,R,g))},this)}_f.$inject=["injector","eventBus","canvas","dragging","rules","modeling"],_f.prototype.cropWaypoints=function(e,t){var n=this._injector.get("connectionDocking",!1);if(!n)return t;var i=e.waypoints;return e.waypoints=t,e.waypoints=n.getCroppedWaypoints(e),t=e.waypoints,e.waypoints=i,t};function ru(e){var t=e.hover,n=e.source,i=e.target,r=e.type;if(r===Ur)return t&&i&&t===i&&n!==i;if(r===Yr)return t&&n&&t===n&&n!==i}var v2="reconnectStart",_2="reconnectEnd",N_="updateWaypoints",za="connect-ok",ou="connect-not-ok",B_="connect-hover",$_="djs-updating",j_="djs-dragging",F_=1100;function H_(e,t,n,i){this._injector=t;var r=t.get("connectionPreview",!1);n.on("bendpoint.move.start",function(o){var a=o.context,s=a.bendpointIndex,c=a.connection,u=a.insert,l=c.waypoints,f=l.slice();a.waypoints=l,u&&f.splice(s,0,{x:o.x,y:o.y}),c.waypoints=f;var p=a.draggerGfx=yf(i.getLayer("overlays"));ze(p).add("djs-dragging"),i.addMarker(c,j_),i.addMarker(c,$_)}),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,B_),u===N_)return;s?(i.removeMarker(c,ou),i.addMarker(c,za)):s===!1&&(i.removeMarker(c,za),i.addMarker(c,ou))}}),n.on(["bendpoint.move.out","bendpoint.move.cleanup"],F_,function(o){var a=o.context,s=a.hover,c=a.target;s&&(i.removeMarker(s,B_),i.removeMarker(s,c?za:ou))}),n.on("bendpoint.move.move",function(o){var a=o.context,s=a.allowed,c=a.bendpointIndex,u=a.draggerGfx,l=a.hover,f=a.type,p=a.connection,d=p.source,h=p.target,m=p.waypoints.slice(),g={x:o.x,y:o.y},R=a.hints||{},E={};r&&(R.connectionStart&&(E.connectionStart=R.connectionStart),R.connectionEnd&&(E.connectionEnd=R.connectionEnd),f===v2?ru(a)?(E.connectionEnd=E.connectionEnd||g,E.source=h,E.target=l||d,m=m.reverse()):(E.connectionStart=E.connectionStart||g,E.source=l||d,E.target=h):f===_2?ru(a)?(E.connectionStart=E.connectionStart||g,E.source=l||h,E.target=d,m=m.reverse()):(E.connectionEnd=E.connectionEnd||g,E.source=d,E.target=l||h):(E.noCropping=!0,E.noLayout=!0,m[c]=g),f===N_&&(m=e.cropWaypoints(p,m)),E.waypoints=m,r.drawPreview(a,s,E)),Jt(u,o.x,o.y)},this),n.on(["bendpoint.move.end","bendpoint.move.cancel"],F_,function(o){var a=o.context,s=a.connection,c=a.draggerGfx,u=a.hover,l=a.target,f=a.waypoints;s.waypoints=f,zt(c),i.removeMarker(s,$_),i.removeMarker(s,j_),u&&(i.removeMarker(u,za),i.removeMarker(u,l?za:ou)),r&&r.cleanUp(a)})}H_.$inject=["bendpointMove","injector","eventBus","canvas"];var z_="connect-hover",G_="djs-updating";function V_(e,t,n){return bf(e,t,e[t]+n)}function bf(e,t,n){return{x:t==="x"?n:e.x,y:t==="y"?n:e.y}}function b2(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 bf(t,i,s)}function W_(e){return e==="x"?"y":"x"}function U_(e,t,n){var i,r;return e.original?e.original:(i=Ee(t),r=W_(n),bf(e,r,i[r]))}function Y_(e,t,n,i,r,o){var a=e.get("connectionDocking",!1);this.start=function(f,p,d){var h,m=n.getGraphics(p),g=d-1,R=d,E=p.waypoints,x=E[g],w=E[R],S=gf(n,E,f),M,N,T;if(M=Mi(x,w),!!M)return N=M==="v"?"x":"y",g===0&&(x=U_(x,p.source,N)),R===E.length-1&&(w=U_(w,p.target,N)),S?T=S.point:T={x:(x.x+w.x)/2,y:(x.y+w.y)/2},h={connection:p,segmentStartIndex:g,segmentEndIndex:R,segmentStart:x,segmentEnd:w,axis:N,dragPosition:T},i.init(f,T,"connectionSegment.move",{cursor:N==="x"?"resize-ew":"resize-ns",data:{connection:p,connectionGfx:m,context:h}})};function s(f,p){if(!a)return p;var d=f.waypoints,h;return f.waypoints=p,h=a.getCroppedWaypoints(f),f.waypoints=d,h}function c(f){r.update("connection",f.connection,f.connectionGfx)}function u(f,p,d){var h=f.newWaypoints,m=f.segmentStartIndex+p,g=h[m],R=f.segmentEndIndex+p,E=h[R],x=W_(f.axis),w=b2(d,g,E,x);Jt(f.draggerGfx,w.x,w.y)}function l(f,p){var d=0,h=f.filter(function(m,g){return cl(f[g-1],f[g+1],m)?(d=g<=p?d-1:d,!1):!0});return{waypoints:h,segmentOffset:d}}t.on("connectionSegment.move.start",function(f){var p=f.context,d=f.connection,h=n.getLayer("overlays");p.originalWaypoints=d.waypoints.slice(),p.draggerGfx=D_(h,p.segmentStart,p.segmentEnd),ze(p.draggerGfx).add("djs-dragging"),n.addMarker(d,G_)}),t.on("connectionSegment.move.move",function(f){var p=f.context,d=p.connection,h=p.segmentStartIndex,m=p.segmentEndIndex,g=p.segmentStart,R=p.segmentEnd,E=p.axis,x=p.originalWaypoints.slice(),w=V_(g,E,f["d"+E]),S=V_(R,E,f["d"+E]),M=x.length,N=0;x[h]=w,x[m]=S;var T,H;h<2&&(T=Qt(d.source,w),h===1?T==="intersect"&&(x.shift(),x[0]=w,N--):T!=="intersect"&&(x.unshift(g),N++)),m>M-3&&(H=Qt(d.target,S),m===M-2?H==="intersect"&&(x.pop(),x[x.length-1]=S):H!=="intersect"&&x.push(R)),p.newWaypoints=d.waypoints=s(d,x),u(p,N,f),p.newSegmentStartIndex=h+N,c(f)}),t.on("connectionSegment.move.hover",function(f){f.context.hover=f.hover,n.addMarker(f.hover,z_)}),t.on(["connectionSegment.move.out","connectionSegment.move.cleanup"],function(f){var p=f.context.hover;p&&n.removeMarker(p,z_)}),t.on("connectionSegment.move.cleanup",function(f){var p=f.context,d=p.connection;p.draggerGfx&&zt(p.draggerGfx),n.removeMarker(d,G_)}),t.on(["connectionSegment.move.cancel","connectionSegment.move.end"],function(f){var p=f.context,d=p.connection;d.waypoints=p.originalWaypoints,c(f)}),t.on("connectionSegment.move.end",function(f){var p=f.context,d=p.connection,h=p.newWaypoints,m=p.newSegmentStartIndex;h=h.map(function(S){return{original:S.original,x:Math.round(S.x),y:Math.round(S.y)}});var g=l(h,m),R=g.waypoints,E=s(d,R),x=g.segmentOffset,w={segmentMove:{segmentStartIndex:p.segmentStartIndex,newSegmentStartIndex:m+x}};o.updateWaypoints(d,E,w)})}Y_.$inject=["injector","eventBus","canvas","dragging","graphicsFactory","modeling"];var x2=Math.abs,q_=Math.round;function w2(e,t,n){n=n===void 0?10:n;var i,r;for(i=0;i<t.length;i++)if(r=t[i],x2(r-e)<=n)return r}function K_(e){return{x:e.x,y:e.y}}function X_(e){return{x:e.x+e.width,y:e.y+e.height}}function Xn(e,t){return!e||isNaN(e.x)||isNaN(e.y)?t:{x:q_(e.x+e.width/2),y:q_(e.y+e.height/2)}}function $o(e,t){var n=e.snapped;return n?typeof t=="string"?n[t]:n.x&&n.y:!1}function 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 Z_(e){return e.children||[]}var E2=Math.abs,Q_=Math.round,xf=10;function J_(e){function t(o,a){if(we(o)){for(var s=o.length;s--;)if(E2(o[s]-a)<=xf)return o[s]}else{o=+o;var c=a%o;if(c<xf)return a-c;if(c>o-xf)return a-c+o}return a}function n(o,a){if(o.waypoints)return h2(a,o);if(o.width)return{x:Q_(o.width/2+o.x),y:Q_(o.height/2+o.y)}}function i(o){var a=o.context,s=a.snapPoints,c=a.connection,u=c.waypoints,l=a.segmentStart,f=a.segmentStartIndex,p=a.segmentEnd,d=a.segmentEndIndex,h=a.axis;if(s)return s;var m=[u[f-1],l,p,u[d+1]];return f<2&&m.unshift(n(c.source,o)),d>u.length-3&&m.unshift(n(c.target,o)),a.snapPoints=s={horizontal:[],vertical:[]},k(m,function(g){g&&(g=g.original||g,h==="y"&&s.horizontal.push(g.y),h==="x"&&s.vertical.push(g.x))}),s}e.on("connectionSegment.move.move",1500,function(o){var a=i(o),s=o.x,c=o.y,u,l;if(a){u=t(a.vertical,s),l=t(a.horizontal,c);var f=s-u,p=c-l;I(o,{dx:o.dx-f,dy:o.dy-p,x:u,y:l}),(f||a.vertical.indexOf(s)!==-1)&&Lt(o,"x",u),(p||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:[]},k(u,function(l){l&&(l=l.original||l,a.horizontal.push(l.y),a.vertical.push(l.x))}),a}e.on(["connect.hover","connect.move","connect.end"],1500,function(o){var a=o.context,s=a.hover,c=s&&n(s,o);!ot(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,f=o.y,p,d;if(s){p=t(u?s.vertical.concat([u.x]):s.vertical,l),d=t(u?s.horizontal.concat([u.y]):s.horizontal,f);var h=l-p,m=f-d;I(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",p),(m||s.horizontal.indexOf(f)!==-1)&&Lt(o,"y",d)}})}J_.$inject=["eventBus"];const S2={__depends__:[Ni,yi],__init__:["bendpoints","bendpointSnapping","bendpointMovePreview"],bendpoints:["type",L_],bendpointMove:["type",_f],bendpointMovePreview:["type",H_],connectionSegmentMove:["type",Y_],bendpointSnapping:["type",J_]};function eb(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),!Jr(l)){if(l!==!1){s.source=c,s.target=u;return}l=s.canExecute=o(c,u),!Jr(l)&&l!==!1&&(s.source=u,s.target=c)}}),e.on(["connect.out","connect.cleanup"],function(a){var s=a.context;s.hover=null,s.source=null,s.target=null,s.canExecute=!1}),e.on("connect.end",function(a){var s=a.context,c=s.canExecute,u=s.connectionStart,l={x:a.x,y:a.y},f=s.source,p=s.target;if(!c)return!1;var d=null,h={connectionStart:wf(s)?l:u,connectionEnd:wf(s)?u:l};Ut(c)&&(d=c),s.connection=n.connect(f,p,d,h)}),this.start=function(a,s,c,u){Ut(c)||(u=c,c=Ee(s)),t.init(a,"connect",{autoActivate:u,data:{shape:s,context:{start:s,connectionStart:c}}})}}eb.$inject=["eventBus","dragging","modeling","rules"];function wf(e){var t=e.hover,n=e.source,i=e.target;return t&&n&&t===n&&n!==i}var R2=1100,C2=900,tb="connect-ok",nb="connect-not-ok";function ib(e,t,n){var i=e.get("connectionPreview",!1);i&&t.on("connect.move",function(r){var o=r.context,a=o.canExecute,s=o.hover,c=o.source,u=o.start,l=o.startPosition,f=o.target,p=o.connectionStart||l,d=o.connectionEnd||{x:r.x,y:r.y},h=p,m=d;wf(o)&&(h=d,m=p),i.drawPreview(o,a,{source:c||u,target:f||s,connectionStart:h,connectionEnd:m})}),t.on("connect.hover",C2,function(r){var o=r.context,a=r.hover,s=o.canExecute;s!==null&&n.addMarker(a,s?tb:nb)}),t.on(["connect.out","connect.cleanup"],R2,function(r){var o=r.hover;o&&(n.removeMarker(o,tb),n.removeMarker(o,nb))}),i&&t.on("connect.cleanup",function(r){i.cleanUp(r.context)})}ib.$inject=["injector","eventBus","canvas"];const Ef={__depends__:[Yn,yi,Ni],__init__:["connectPreview"],connect:["type",eb],connectPreview:["type",ib]};var P2="djs-dragger";function Gi(e,t,n,i){this._canvas=t,this._graphicsFactory=n,this._elementFactory=i,this._connectionDocking=e.get("connectionDocking",!1),this._layouter=e.get("layouter",!1)}Gi.$inject=["injector","canvas","graphicsFactory","elementFactory"],Gi.prototype.drawPreview=function(e,t,n){n=n||{};var i=e.connectionPreviewGfx,r=e.getConnection,o=n.source,a=n.target,s=n.waypoints,c=n.connectionStart,u=n.connectionEnd,l=n.noLayout,f=n.noCropping,p=n.noNoop,d,h=this;if(i||(i=e.connectionPreviewGfx=this.createConnectionPreviewGfx()),xs(i),r||(r=e.getConnection=A2(function(m,g,R){return h.getConnection(m,g,R)})),t&&(d=r(t,o,a)),!d){!p&&this.drawNoopPreview(i,n);return}d.waypoints=s||[],this._layouter&&!l&&(d.waypoints=this._layouter.layoutConnection(d,{source:o,target:a,connectionStart:c,connectionEnd:u,waypoints:n.waypoints||d.waypoints})),(!d.waypoints||!d.waypoints.length)&&(d.waypoints=[o?Ee(o):c,a?Ee(a):u]),this._connectionDocking&&(o||a)&&!f&&(d.waypoints=this._connectionDocking.getCroppedWaypoints(d,o,a)),this._graphicsFactory.drawConnection(i,d,{stroke:"var(--element-dragger-color)"})},Gi.prototype.drawNoopPreview=function(e,t){var n=t.source,i=t.target,r=t.connectionStart||Ee(n),o=t.connectionEnd||Ee(i),a=this.cropWaypoints(r,o,n,i),s=this.createNoopConnection(a[0],a[1]);Te(e,s)},Gi.prototype.cropWaypoints=function(e,t,n,i){var r=this._graphicsFactory,o=n&&r.getShapePath(n),a=i&&r.getShapePath(i),s=r.getConnectionPath({waypoints:[e,t]});return e=n&&na(o,s,!0)||e,t=i&&na(a,s,!1)||t,[e,t]},Gi.prototype.cleanUp=function(e){e&&e.connectionPreviewGfx&&zt(e.connectionPreviewGfx)},Gi.prototype.getConnection=function(e){var t=T2(e);return this._elementFactory.createConnection(t)},Gi.prototype.createConnectionPreviewGfx=function(){var e=ve("g");return se(e,{pointerEvents:"none"}),ze(e).add(P2),Te(this._canvas.getActiveLayer(),e),e},Gi.prototype.createNoopConnection=function(e,t){return Qo([e,t],{stroke:"#333",strokeDasharray:[1],strokeWidth:2,"pointer-events":"none"})};function A2(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 T2(e){return Ut(e)?e:{}}const M2={__init__:["connectionPreview"],connectionPreview:["type",Gi]},au="complex-preview";class rb{constructor(t,n,i){this._canvas=t,this._graphicsFactory=n,this._previewSupport=i,this._markers=[]}create(t){this.cleanUp();const{created:n=[],moved:i=[],removed:r=[],resized:o=[]}=t,a=this._canvas.getLayer(au);n.filter(s=>!k2(s)).forEach(s=>{let c;ot(s)?(c=this._graphicsFactory._createContainer("connection",ve("g")),this._graphicsFactory.drawConnection(Ir(c),s)):(c=this._graphicsFactory._createContainer("shape",ve("g")),this._graphicsFactory.drawShape(Ir(c),s),Jt(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);ot(s)?Jt(u,c.x,c.y):Jt(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",ve("g"));this._graphicsFactory.drawShape(Ir(u),s,{width:c.width,height:c.height}),Jt(u,c.x,c.y),this._previewSupport.addDragger(s,a,u)})}cleanUp(){xs(this._canvas.getLayer(au)),this._markers.forEach(([t,n])=>this._canvas.removeMarker(t,n)),this._markers=[]}show(){this._canvas.showLayer(au)}hide(){this._canvas.hideLayer(au)}}rb.$inject=["canvas","graphicsFactory","previewSupport"];function k2(e){return e.hidden}const O2={__depends__:[Ao],__init__:["complexPreview"],complexPreview:["type",rb]},ob=Math.round;function su(e,t,n,i,r,o){this._complexPreview=e,this._connectionDocking=t,this._elementFactory=n,this._eventBus=i,this._layouter=r,this._rules=o}su.prototype.create=function(e,t,n){const i=this._complexPreview,r=this._connectionDocking,o=this._elementFactory,a=this._eventBus,s=this._layouter,c=this._rules,u=o.createShape(I({type:t},n)),l=a.fire("autoPlace",{source:e,shape:u});if(!l)return;I(u,{x:l.x-ob(u.width/2),y:l.y-ob(u.height/2)});const f=c.allowed("connection.create",{source:e,target:u,hints:{targetParent:e.parent}});let p=null;f&&(p=o.createConnection(f),p.waypoints=s.layoutConnection(p,{source:e,target:u}),p.waypoints=r.getCroppedWaypoints(p,e,u)),i.create({created:[u,p].filter(d=>!Jr(d))})},su.prototype.cleanUp=function(){this._complexPreview.cleanUp()},su.$inject=["complexPreview","connectionDocking","elementFactory","eventBus","layouter","rules"];const D2={__depends__:[Lc,O2,qp],__init__:["appendPreview"],appendPreview:["type",su]};var ab=Math.min,sb=Math.max;function Sf(e){e.preventDefault()}function Ga(e){e.stopPropagation()}function L2(e){return e.nodeType===Node.TEXT_NODE}function I2(e){return[].slice.call(e)}function ri(e){this.container=e.container,this.parent=pt('<div class="djs-direct-editing-parent"><div class="djs-direct-editing-content" contenteditable="true"></div></div>'),this.content=nt("[contenteditable]",this.parent),this.keyHandler=e.keyHandler||function(){},this.resizeHandler=e.resizeHandler||function(){},this.focusoutHandler=e.focusoutHandler||function(){},this.autoResize=bn(this.autoResize,this),this.handlePaste=bn(this.handlePaste,this)}ri.prototype.create=function(e,t,n,i){var r=this,o=this.parent,a=this.content,s=this.container;i=this.options=i||{},t=this.style=t||{};var c=ni(t,["width","height","maxWidth","maxHeight","minWidth","minHeight","left","top","backgroundColor","position","overflow","border","wordWrap","textAlign","outline","transform"]);I(o.style,{width:e.width+"px",height:e.height+"px",maxWidth:e.maxWidth+"px",maxHeight:e.maxHeight+"px",minWidth:e.minWidth+"px",minHeight:e.minHeight+"px",left:e.x+"px",top:e.y+"px",backgroundColor:"#ffffff",position:"absolute",overflow:"visible",border:"1px solid #ccc",boxSizing:"border-box",wordWrap:"normal",textAlign:"center",outline:"none"},c);var u=ni(t,["fontFamily","fontSize","fontWeight","lineHeight","padding","paddingTop","paddingRight","paddingBottom","paddingLeft"]);return I(a.style,{boxSizing:"border-box",width:"100%",outline:"none",wordWrap:"break-word"},u),i.centerVertically&&I(a.style,{position:"absolute",top:"50%",transform:"translate(0, -50%)"},u),a.innerText=n,Ae.bind(a,"keydown",this.keyHandler),Ae.bind(a,"mousedown",Ga),Ae.bind(a,"paste",r.handlePaste),Ae.bind(a,"focusout",this.focusoutHandler),i.autoResize&&Ae.bind(a,"input",this.autoResize),i.resizable&&this.resizable(t),s.appendChild(o),this.setSelection(a.lastChild,a.lastChild&&a.lastChild.length),o},ri.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)}},ri.prototype.insertText=function(e){e=N2(e);var t=document.execCommand("insertText",!1,e);t||this._insertTextIE(e)},ri.prototype._insertTextIE=function(e){var t=this.getSelection(),n=t.startContainer,i=t.endContainer,r=t.startOffset,o=t.endOffset,a=t.commonAncestorContainer,s=I2(a.childNodes),c,u;if(L2(a)){var l=n.textContent;n.textContent=l.substring(0,r)+e+l.substring(o),c=n,u=r+e.length}else if(n===this.content&&i===this.content){var f=document.createTextNode(e);this.content.insertBefore(f,s[r]),c=f,u=f.textContent.length}else{var p=s.indexOf(n),d=s.indexOf(i);s.forEach(function(h,m){m===p?h.textContent=n.textContent.substring(0,r)+e+i.textContent.substring(o):m>p&&m<=d&&pi(h)}),c=n,u=r+e.length}c&&u!==void 0&&setTimeout(function(){self.setSelection(c,u)})},ri.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})}},ri.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=pt('<div class="djs-direct-editing-resize-handle"></div>');var s,c,u,l,f=function(h){Sf(h),Ga(h),s=h.clientX,c=h.clientY;var m=t.getBoundingClientRect();u=m.width,l=m.height,Ae.bind(document,"mousemove",p),Ae.bind(document,"mouseup",d)},p=function(h){Sf(h),Ga(h);var m=ab(sb(u+h.clientX-s,i),o),g=ab(sb(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){Sf(h),Ga(h),Ae.unbind(document,"mousemove",p,!1),Ae.unbind(document,"mouseup",d,!1)};Ae.bind(n,"mousedown",f)}I(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)},ri.prototype.destroy=function(){var e=this.parent,t=this.content,n=this.resizeHandle;t.innerText="",e.removeAttribute("style"),t.removeAttribute("style"),Ae.unbind(t,"keydown",this.keyHandler),Ae.unbind(t,"mousedown",Ga),Ae.unbind(t,"input",this.autoResize),Ae.unbind(t,"paste",this.handlePaste),Ae.unbind(t,"focusout",this.focusoutHandler),n&&(n.removeAttribute("style"),pi(n)),pi(e)},ri.prototype.getValue=function(){return this.content.innerText.trim()},ri.prototype.getSelection=function(){var e=window.getSelection(),t=e.getRangeAt(0);return t},ri.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 N2(e){return e.replace(/\r\n|\r|\n/g,`
316
+ `)}function In(e,t){this._eventBus=e,this._canvas=t,this._providers=[],this._textbox=new ri({container:t.getContainer(),keyHandler:bn(this._handleKey,this),resizeHandler:bn(this._handleResize,this),focusoutHandler:bn(this._handleFocusout,this)}),e.on(["diagram.clear","diagram.destroy"],()=>this._cleanup())}In.$inject=["eventBus","canvas"],In.prototype.registerProvider=function(e){this._providers.push(e)},In.prototype.isActive=function(e){return!!(this._active&&(!e||this._active.element===e))},In.prototype.cancel=function(){this._active&&(this._fire("cancel"),this.close())},In.prototype._fire=function(e,t){this._eventBus.fire("directEditing."+e,t||{active:this._active})},In.prototype.close=function(){this._fire("deactivate"),this._cleanup(),this._canvas.restoreFocus&&this._canvas.restoreFocus()},In.prototype._cleanup=function(){this._active&&(this._textbox.destroy(),this._active=null,this.resizable=void 0)},In.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()}},In.prototype.getValue=function(){return this._textbox.getValue()},In.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()},In.prototype._handleResize=function(e){this._fire("resize",e)},In.prototype._handleFocusout=function(e){e.relatedTarget&&this._textbox.parent.contains(e.relatedTarget)||this.complete()},In.prototype.activate=function(e){if(this.isActive()&&this.cancel(),this._eventBus.fire("directEditing.activate.allowed",{element:e})===!1)return!1;var t,n=ut(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 cb={__depends__:[lc],__init__:["directEditing"],directEditing:["type",In]};function B2(e){return function(t){var n=t.target,i=Z(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===He(e);return!o||!a||!s||!c}}const $2={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 K(e,t={}){var n=$2[e];if(!n)throw new Error("unknown popup entry <"+e+">");return{...n,actionName:"replace-with-"+e,...t}}var j2=[K("none-start-event",{actionName:"replace-with-none-start"}),K("none-intermediate-throwing"),K("none-end-event",{actionName:"replace-with-none-end"}),K("message-start"),K("timer-start"),K("conditional-start"),K("signal-start")],F2=[K("none-start-event",{actionName:"replace-with-none-start"}),K("none-intermediate-throwing"),K("none-end-event",{actionName:"replace-with-none-end"})],H2=[K("none-start-event",{actionName:"replace-with-none-start"}),K("none-intermediate-throwing",{actionName:"replace-with-none-intermediate-throw"}),K("none-end-event",{actionName:"replace-with-none-end"}),K("message-intermediate-catch"),K("message-intermediate-throw"),K("timer-intermediate-catch"),K("escalation-intermediate-throw"),K("conditional-intermediate-catch"),K("link-intermediate-catch"),K("link-intermediate-throw"),K("compensation-intermediate-throw"),K("signal-intermediate-catch"),K("signal-intermediate-throw")],z2=[K("none-start-event",{actionName:"replace-with-none-start"}),K("none-intermediate-throwing",{actionName:"replace-with-none-intermediate-throw"}),K("none-end-event",{actionName:"replace-with-none-end"}),K("message-end"),K("escalation-end"),K("error-end"),K("cancel-end"),K("compensation-end"),K("signal-end"),K("terminate-end")],G2=[K("exclusive-gateway"),K("parallel-gateway"),K("inclusive-gateway"),K("complex-gateway"),K("event-based-gateway")],V2=[K("transaction"),K("event-subprocess"),K("expanded-ad-hoc-subprocess",{actionName:"replace-with-ad-hoc-subprocess",label:"Ad-hoc sub-process"}),K("collapsed-subprocess")],W2=[K("expanded-subprocess",{actionName:"replace-with-subprocess",label:"Sub-process"}),K("transaction"),K("event-subprocess"),K("collapsed-ad-hoc-subprocess")],ub=[K("transaction"),K("expanded-subprocess",{actionName:"replace-with-subprocess",label:"Sub-process"}),K("expanded-ad-hoc-subprocess",{actionName:"replace-with-ad-hoc-subprocess",label:"Ad-hoc sub-process"}),K("event-subprocess")],U2=ub,lb=[K("task"),K("user-task"),K("service-task"),K("send-task"),K("receive-task"),K("manual-task"),K("rule-task"),K("script-task"),K("call-activity"),K("collapsed-subprocess"),K("expanded-subprocess"),K("collapsed-ad-hoc-subprocess"),K("expanded-ad-hoc-subprocess",{actionName:"replace-with-ad-hoc-subprocess"})],Y2=[K("data-store-reference")],q2=[K("data-object-reference")],K2=[K("message-boundary"),K("timer-boundary"),K("escalation-boundary"),K("conditional-boundary"),K("error-boundary"),K("cancel-boundary"),K("signal-boundary"),K("compensation-boundary"),K("non-interrupting-message-boundary"),K("non-interrupting-timer-boundary"),K("non-interrupting-escalation-boundary"),K("non-interrupting-conditional-boundary"),K("non-interrupting-signal-boundary")],X2=[K("message-start"),K("timer-start"),K("conditional-start"),K("signal-start"),K("error-start"),K("escalation-start"),K("compensation-start"),K("non-interrupting-message-start"),K("non-interrupting-timer-start"),K("non-interrupting-conditional-start"),K("non-interrupting-signal-start"),K("non-interrupting-escalation-start")],Z2=[{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"}],Q2=[K("expanded-pool"),K("collapsed-pool",{label:function(e){var t="Empty pool/participant";return e.children&&e.children.length&&(t+=" (removes content)"),t}})],J2={"bpmn:MessageEventDefinition":[K("message-start"),K("message-intermediate-catch"),K("message-intermediate-throw"),K("message-end")],"bpmn:TimerEventDefinition":[K("timer-start"),K("timer-intermediate-catch")],"bpmn:ConditionalEventDefinition":[K("conditional-start"),K("conditional-intermediate-catch")],"bpmn:SignalEventDefinition":[K("signal-start"),K("signal-intermediate-catch"),K("signal-intermediate-throw"),K("signal-end")],"bpmn:ErrorEventDefinition":[K("error-start"),K("error-end")],"bpmn:EscalationEventDefinition":[K("escalation-start"),K("escalation-intermediate-throw"),K("escalation-end")],"bpmn:CompensateEventDefinition":[K("compensation-start"),K("compensation-intermediate-throw"),K("compensation-end")]};const pb={"start-event-non-interrupting":`
317
317
  <svg viewBox="0 0 2048 2048" xmlns="http://www.w3.org/2000/svg">
318
318
  <g transform="translate(0 995.64)">
319
319
  <path d="m1899 28.357c21.545 567.43-598.38 1023.5-1133.6 835.92-548.09-147.21-801.57-873.95-463.59-1330 302.62-480.3 1071.7-507.54 1407.6-49.847 122.14 153.12 190.07 348.07 189.59 543.91z" fill="none" stroke="currentColor" stroke-dasharray="418.310422, 361.2328165" stroke-linecap="round" stroke-width="100"/>
@@ -324,7 +324,7 @@
324
324
  <circle cx="1024" cy="28.357" r="875" stroke-dasharray="418.310422, 361.2328165" stroke-width="100"/>
325
325
  <circle cx="1024" cy="28.357" r="685" stroke-dasharray="348.31044857,261.23283643" stroke-dashoffset="500" stroke-width="100"/>
326
326
  </g>
327
- </svg>`};function Jn(e,t,n,i,r,o,a,s){this._bpmnFactory=e,this._popupMenu=t,this._modeling=n,this._moddle=i,this._bpmnReplace=r,this._rules=o,this._translate=a,this._moddleCopy=s,this._register()}Jn.$inject=["bpmnFactory","popupMenu","modeling","moddle","bpmnReplace","rules","translate","moddleCopy"],Jn.prototype._register=function(){this._popupMenu.registerProvider("bpmn-replace",this)},Jn.prototype.getPopupMenuEntries=function(e){var s;var t=e.businessObject,n=this._rules,i=[],r,o=[];if(xe(e)||!n.allowed("shape.replace",{element:e}))return{};var a=k2(e);return v(t,"bpmn:DataObjectReference")?this._createEntries(e,H2):v(t,"bpmn:DataStoreReference")&&!v(e.parent,"bpmn:Collaboration")?this._createEntries(e,z2):(v(t,"bpmn:Event")&&!v(t,"bpmn:BoundaryEvent")&&(r=(s=t.get("eventDefinitions")[0])==null?void 0:s.$type,i=Y2[r]||[],!un(t.$parent)&&v(t.$parent,"bpmn:SubProcess")&&(i=Ie(i,function(c){return c.target.type!=="bpmn:StartEvent"}))),v(t,"bpmn:StartEvent")&&!v(t.$parent,"bpmn:SubProcess")?(o=Ie(O2.concat(i),a),this._createEntries(e,o)):v(t,"bpmn:Participant")?(o=Ie(U2,function(c){return $e(e)!==c.target.isExpanded}),this._createEntries(e,o)):v(t,"bpmn:StartEvent")&&un(t.$parent)?(o=Ie(G2.concat(i),function(c){var u=c.target,l=u.isInterrupting!==!1,f=t.isInterrupting===l;return a(c)||!a(c)&&!f}),this._createEntries(e,o)):v(t,"bpmn:StartEvent")&&!un(t.$parent)&&v(t.$parent,"bpmn:SubProcess")?(o=Ie(L2.concat(i),a),this._createEntries(e,o)):v(t,"bpmn:EndEvent")?(o=Ie(N2.concat(i),function(c){var u=c.target;return u.eventDefinitionType=="bpmn:CancelEventDefinition"&&!v(t.$parent,"bpmn:Transaction")?!1:a(c)}),this._createEntries(e,o)):v(t,"bpmn:BoundaryEvent")?(o=Ie(V2,function(c){var u=c.target;if(u.eventDefinitionType=="bpmn:CancelEventDefinition"&&!v(t.attachedToRef,"bpmn:Transaction"))return!1;var l=u.cancelActivity!==!1,f=t.cancelActivity==l;return a(c)||!a(c)&&!f}),this._createEntries(e,o)):v(t,"bpmn:IntermediateCatchEvent")||v(t,"bpmn:IntermediateThrowEvent")?(o=Ie(I2.concat(i),a),this._createEntries(e,o)):v(t,"bpmn:Gateway")?(o=Ie(B2,a),this._createEntries(e,o)):v(t,"bpmn:Transaction")?(o=Ie(sb,a),this._createEntries(e,o)):un(t)&&$e(e)?(o=Ie(F2,a),this._createEntries(e,o)):v(t,"bpmn:AdHocSubProcess")&&$e(e)?(o=Ie(j2,a),this._createEntries(e,o)):v(t,"bpmn:SubProcess")&&$e(e)?(o=Ie($2,a),this._createEntries(e,o)):v(t,"bpmn:SubProcess")&&!$e(e)?(o=Ie(cb,function(c){var u=c.target.type===e.type,l=c.target.isExpanded===!0;return u===l}),this._createEntries(e,o)):v(t,"bpmn:SequenceFlow")?this._createSequenceFlowEntries(e,W2):v(t,"bpmn:FlowNode")?(o=Ie(cb,a),this._createEntries(e,o)):{})},Jn.prototype.getPopupMenuHeaderEntries=function(e){var t={};return v(e,"bpmn:Activity")&&!un(e)&&(t={...t,...this._getLoopCharacteristicsHeaderEntries(e)}),v(e,"bpmn:DataObjectReference")&&(t={...t,...this._getCollectionHeaderEntries(e)}),v(e,"bpmn:Participant")&&(t={...t,...this._getParticipantMultiplicityHeaderEntries(e)}),rg(e)&&(t={...t,...this._getNonInterruptingHeaderEntries(e)}),t},Jn.prototype._createEntries=function(e,t){var n={},i=this;return k(t,function(r){n[r.actionName]=i._createEntry(r,e)}),n},Jn.prototype._createSequenceFlowEntries=function(e,t){var n=Z(e),i={},r=this._modeling,o=this._moddle,a=this;return k(t,function(s){switch(s.actionName){case"replace-with-default-flow":n.sourceRef.default!==n&&(v(n.sourceRef,"bpmn:ExclusiveGateway")||v(n.sourceRef,"bpmn:InclusiveGateway")||v(n.sourceRef,"bpmn:ComplexGateway")||v(n.sourceRef,"bpmn:Activity"))&&(i={...i,[s.actionName]:a._createEntry(s,e,function(){r.updateProperties(e.source,{default:n})})});break;case"replace-with-conditional-flow":!n.conditionExpression&&v(n.sourceRef,"bpmn:Activity")&&(i={...i,[s.actionName]:a._createEntry(s,e,function(){var c=o.create("bpmn:FormalExpression",{body:""});r.updateProperties(e,{conditionExpression:c})})});break;default:v(n.sourceRef,"bpmn:Activity")&&n.conditionExpression&&(i={...i,[s.actionName]:a._createEntry(s,e,function(){r.updateProperties(e,{conditionExpression:void 0})})}),(v(n.sourceRef,"bpmn:ExclusiveGateway")||v(n.sourceRef,"bpmn:InclusiveGateway")||v(n.sourceRef,"bpmn:ComplexGateway")||v(n.sourceRef,"bpmn:Activity"))&&n.sourceRef.default===n&&(i={...i,[s.actionName]:a._createEntry(s,e,function(){r.updateProperties(e.source,{default:void 0})})})}}),i},Jn.prototype._createEntry=function(e,t,n){var i=this._translate,r=this._bpmnReplace.replaceElement,o=function(){return r(t,e.target)},a=e.label;return a&&typeof a=="function"&&(a=a(t)),n=n||o,{label:i(a),className:e.className,action:n}},Jn.prototype._getLoopCharacteristicsHeaderEntries=function(e){var t=this,n=this._translate;function i(u,l){if(l.active){t._modeling.updateProperties(e,{loopCharacteristics:void 0});return}var f=e.businessObject.get("loopCharacteristics");f&&v(f,l.options.loopCharacteristics)?t._modeling.updateModdleProperties(e,f,{isSequential:l.options.isSequential}):(f=t._moddle.create(l.options.loopCharacteristics,{isSequential:l.options.isSequential}),t._modeling.updateProperties(e,{loopCharacteristics:f}))}var r=Z(e),o=r.loopCharacteristics,a,s,c;return o&&(a=o.isSequential,s=o.isSequential===void 0,c=o.isSequential!==void 0&&!o.isSequential),{"toggle-parallel-mi":{className:"bpmn-icon-parallel-mi-marker",title:n("Parallel multi-instance"),active:c,action:i,options:{loopCharacteristics:"bpmn:MultiInstanceLoopCharacteristics",isSequential:!1}},"toggle-sequential-mi":{className:"bpmn-icon-sequential-mi-marker",title:n("Sequential multi-instance"),active:a,action:i,options:{loopCharacteristics:"bpmn:MultiInstanceLoopCharacteristics",isSequential:!0}},"toggle-loop":{className:"bpmn-icon-loop-marker",title:n("Loop"),active:s,action:i,options:{loopCharacteristics:"bpmn:StandardLoopCharacteristics"}}}},Jn.prototype._getCollectionHeaderEntries=function(e){var t=this,n=this._translate,i=e.businessObject.dataObjectRef;if(!i)return{};function r(a,s){t._modeling.updateModdleProperties(e,i,{isCollection:!s.active})}var o=i.isCollection;return{"toggle-is-collection":{className:"bpmn-icon-parallel-mi-marker",title:n("Collection"),active:o,action:r}}},Jn.prototype._getParticipantMultiplicityHeaderEntries=function(e){var t=this,n=this._bpmnFactory,i=this._translate;function r(a,s){var c=s.active,u;c||(u=n.create("bpmn:ParticipantMultiplicity")),t._modeling.updateProperties(e,{participantMultiplicity:u})}var o=e.businessObject.participantMultiplicity;return{"toggle-participant-multiplicity":{className:"bpmn-icon-parallel-mi-marker",title:i("Participant multiplicity"),active:!!o,action:r}}},Jn.prototype._getNonInterruptingHeaderEntries=function(e){const t=this._translate,n=Z(e),i=this,r=og(e),o=v(e,"bpmn:BoundaryEvent")?ub["intermediate-event-non-interrupting"]:ub["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 q2={__depends__:[mf,Ry,kc],__init__:["replaceMenuProvider"],replaceMenuProvider:["type",Jn]};function Ha(e,t,n,i,r,o,a,s,c,u,l,f,p){e=e||{},i.registerProvider(this),this._contextPad=i,this._modeling=r,this._elementFactory=o,this._connect=a,this._create=s,this._popupMenu=c,this._canvas=u,this._rules=l,this._translate=f,this._eventBus=n,this._appendPreview=p,e.autoPlace!==!1&&(this._autoPlace=t.get("autoPlace",!1)),n.on("create.end",250,function(d){var h=d.context,m=h.shape;if(!(!fa(d)||!i.isOpen(m))){var g=i.getEntries(m);g.replace&&g.replace.action.click(d,m)}}),n.on("contextPad.close",function(){p.cleanUp()})}Ha.$inject=["config.contextPad","injector","eventBus","contextPad","modeling","elementFactory","connect","create","popupMenu","canvas","rules","translate","appendPreview"],Ha.prototype.getMultiElementContextPadEntries=function(e){var t=this._modeling,n={};return this._isDeleteAllowed(e)&&L(n,{delete:{group:"edit",className:"bpmn-icon-trash",title:this._translate("Delete"),action:{click:function(i,r){t.removeElements(r.slice())}}}}),n},Ha.prototype._isDeleteAllowed=function(e){var t=this._rules.allowed("elements.delete",{elements:e});return xe(t)?Cr(e,n=>t.includes(n)):t},Ha.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])&&L(l,h()),l;var f=e.businessObject;function p(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,M=S.getBoundingClientRect(),N={x:M.left,y:M.bottom+x};return N}function g(b,x,S,M){function N(V,$){var G=i.createShape(L({type:b},M));o.start(V,G,{source:$})}var T=s?function(V,$){var G=i.createShape(L({type:b},M));s.append($,G)}:N,H=s?function(V,$){return u.create($,b,M),()=>{u.cleanUp()}}:null;return{group:"model",className:x,title:S,action:{dragstart:N,click:T,hover:H}}}function R(b){return function(x,S){n.splitLane(S,b),t.open(S,!0)}}if(Le(f,["bpmn:Lane","bpmn:Participant"])&&$e(e)){var w=ar(e);L(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")}}}}),w.length<2&&((qt(e)?e.height>=120:e.width>=120)&&L(l,{"lane-divide-two":{group:"lane-divide",className:"bpmn-icon-lane-divide-two",title:c("Divide into two lanes"),action:{click:R(2)}}}),(qt(e)?e.height>=180:e.width>=180)&&L(l,{"lane-divide-three":{group:"lane-divide",className:"bpmn-icon-lane-divide-three",title:c("Divide into three lanes"),action:{click:R(3)}}})),L(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 v(f,"bpmn:FlowNode")&&(v(f,"bpmn:EventBasedGateway")?L(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"})}):lb(f,"bpmn:BoundaryEvent","bpmn:CompensateEventDefinition")?L(l,{"append.compensation-activity":g("bpmn:Task","bpmn-icon-task",c("Append compensation activity"),{isForCompensation:!0})}):!v(f,"bpmn:EndEvent")&&!f.isForCompensation&&!lb(f,"bpmn:IntermediateThrowEvent","bpmn:LinkEventDefinition")&&!un(f)&&L(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")||L(l,{replace:{group:"edit",className:"bpmn-icon-screw-wrench",title:c("Change element"),action:{click:function(b,x){var S=L(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})}}}}),v(f,"bpmn:SequenceFlow")&&L(l,{"append.text-annotation":g("bpmn:TextAnnotation","bpmn-icon-text-annotation",c("Add text annotation"))}),v(f,"bpmn:MessageFlow")&&L(l,{"append.text-annotation":g("bpmn:TextAnnotation","bpmn-icon-text-annotation",c("Add text annotation"))}),Le(f,["bpmn:FlowNode","bpmn:InteractionNode","bpmn:DataObjectReference","bpmn:DataStoreReference"])&&L(l,{"append.text-annotation":g("bpmn:TextAnnotation","bpmn-icon-text-annotation",c("Add text annotation")),connect:{group:"connect",className:"bpmn-icon-connection-multi",title:c("Connect to other element"),action:{click:p,dragstart:p}}}),v(f,"bpmn:TextAnnotation")&&L(l,{connect:{group:"connect",className:"bpmn-icon-connection-multi",title:c("Connect using association"),action:{click:p,dragstart:p}}}),Le(f,["bpmn:DataObjectReference","bpmn:DataStoreReference"])&&L(l,{connect:{group:"connect",className:"bpmn-icon-connection-multi",title:c("Connect using data input association"),action:{click:p,dragstart:p}}}),v(f,"bpmn:Group")&&L(l,{"append.text-annotation":g("bpmn:TextAnnotation","bpmn-icon-text-annotation",c("Add text annotation"))}),this._isDeleteAllowed([e])&&L(l,h()),l};function lb(e,t,n){var i=e.$instanceOf(t),r=!1,o=e.eventDefinitions||[];return k(o,function(a){a.$type===n&&(r=!0)}),i&&r}const K2={__depends__:[P2,ab,jv,Kn,Ef,uc,q2],__init__:["contextPadProvider"],contextPadProvider:["type",Ha]};var X2={horizontal:["x","width"],vertical:["y","height"]},pb=5;function Vi(e,t){this._modeling=e,this._filters=[],this.registerFilter(function(n){var i=t.allowed("elements.distribute",{elements:n});return xe(i)?i:i?n:[]})}Vi.$inject=["modeling","rules"],Vi.prototype.registerFilter=function(e){if(typeof e!="function")throw new Error("the filter has to be a function");this._filters.push(e)},Vi.prototype.trigger=function(e,t){var n=this._modeling,i,r;if(!(e.length<3)&&(this._setOrientation(t),r=this._filterElements(e),i=this._createGroups(r),!(i.length<=2)))return n.distributeElements(i,this._axis,this._dimension),i},Vi.prototype._filterElements=function(e){var t=this._filters,n=this._axis,i=this._dimension,r=[].concat(e);return t.length?(k(t,function(o){r=o(r,n,i)}),r):e},Vi.prototype._createGroups=function(e){var t=[],n=this,i=this._axis,r=this._dimension;if(!i)throw new Error('must have a defined "axis" and "dimension"');var o=ai(e,i);return k(o,function(a,s){var c=n._findRange(a,i,r),u,l=t[t.length-1];l&&n._hasIntersection(l.range,c)?t[t.length-1].elements.push(a):(u={range:c,elements:[a]},t.push(u))}),t},Vi.prototype._setOrientation=function(e){var t=X2[e];this._axis=t[0],this._dimension=t[1]},Vi.prototype._hasIntersection=function(e,t){return Math.max(e.min,e.max)>=Math.min(t.min,t.max)&&Math.min(e.min,e.max)<=Math.max(t.min,t.max)},Vi.prototype._findRange=function(e){var t=e[this._axis],n=e[this._dimension];return{min:t+pb,max:t+n-pb}};const Z2={__init__:["distributeElements"],distributeElements:["type",Vi]};function ou(e){qn.call(this,e)}ou.$inject=["eventBus"],ae(ou,qn),ou.prototype.init=function(){this.addRule("elements.distribute",function(e){var t=e.elements;return t=Ie(t,function(n){var i=Le(n,["bpmn:Association","bpmn:BoundaryEvent","bpmn:DataInputAssociation","bpmn:DataOutputAssociation","bpmn:Lane","bpmn:MessageFlow","bpmn:SequenceFlow","bpmn:TextAnnotation"]);return!(n.labelTarget||i)}),t=xs(t),t.length<3?!1:t})};var fb={horizontal:`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1800 1800">
327
+ </svg>`};function Zn(e,t,n,i,r,o,a,s){this._bpmnFactory=e,this._popupMenu=t,this._modeling=n,this._moddle=i,this._bpmnReplace=r,this._rules=o,this._translate=a,this._moddleCopy=s,this._register()}Zn.$inject=["bpmnFactory","popupMenu","modeling","moddle","bpmnReplace","rules","translate","moddleCopy"],Zn.prototype._register=function(){this._popupMenu.registerProvider("bpmn-replace",this)},Zn.prototype.getPopupMenuEntries=function(e){var s;var t=e.businessObject,n=this._rules,i=[],r,o=[];if(we(e)||!n.allowed("shape.replace",{element:e}))return{};var a=B2(e);return v(t,"bpmn:DataObjectReference")?this._createEntries(e,Y2):v(t,"bpmn:DataStoreReference")&&!v(e.parent,"bpmn:Collaboration")?this._createEntries(e,q2):(v(t,"bpmn:Event")&&!v(t,"bpmn:BoundaryEvent")&&(r=(s=t.get("eventDefinitions")[0])==null?void 0:s.$type,i=J2[r]||[],!ln(t.$parent)&&v(t.$parent,"bpmn:SubProcess")&&(i=Be(i,function(c){return c.target.type!=="bpmn:StartEvent"}))),v(t,"bpmn:StartEvent")&&!v(t.$parent,"bpmn:SubProcess")?(o=Be(j2.concat(i),a),this._createEntries(e,o)):v(t,"bpmn:Participant")?(o=Be(Q2,function(c){return He(e)!==c.target.isExpanded}),this._createEntries(e,o)):v(t,"bpmn:StartEvent")&&ln(t.$parent)?(o=Be(X2.concat(i),function(c){var u=c.target,l=u.isInterrupting!==!1,f=t.isInterrupting===l;return a(c)||!a(c)&&!f}),this._createEntries(e,o)):v(t,"bpmn:StartEvent")&&!ln(t.$parent)&&v(t.$parent,"bpmn:SubProcess")?(o=Be(F2.concat(i),a),this._createEntries(e,o)):v(t,"bpmn:EndEvent")?(o=Be(z2.concat(i),function(c){var u=c.target;return u.eventDefinitionType=="bpmn:CancelEventDefinition"&&!v(t.$parent,"bpmn:Transaction")?!1:a(c)}),this._createEntries(e,o)):v(t,"bpmn:BoundaryEvent")?(o=Be(K2,function(c){var u=c.target;if(u.eventDefinitionType=="bpmn:CancelEventDefinition"&&!v(t.attachedToRef,"bpmn:Transaction"))return!1;var l=u.cancelActivity!==!1,f=t.cancelActivity==l;return a(c)||!a(c)&&!f}),this._createEntries(e,o)):v(t,"bpmn:IntermediateCatchEvent")||v(t,"bpmn:IntermediateThrowEvent")?(o=Be(H2.concat(i),a),this._createEntries(e,o)):v(t,"bpmn:Gateway")?(o=Be(G2,a),this._createEntries(e,o)):v(t,"bpmn:Transaction")?(o=Be(ub,a),this._createEntries(e,o)):ln(t)&&He(e)?(o=Be(U2,a),this._createEntries(e,o)):v(t,"bpmn:AdHocSubProcess")&&He(e)?(o=Be(W2,a),this._createEntries(e,o)):v(t,"bpmn:SubProcess")&&He(e)?(o=Be(V2,a),this._createEntries(e,o)):v(t,"bpmn:SubProcess")&&!He(e)?(o=Be(lb,function(c){var u=c.target.type===e.type,l=c.target.isExpanded===!0;return u===l}),this._createEntries(e,o)):v(t,"bpmn:SequenceFlow")?this._createSequenceFlowEntries(e,Z2):v(t,"bpmn:FlowNode")?(o=Be(lb,a),this._createEntries(e,o)):{})},Zn.prototype.getPopupMenuHeaderEntries=function(e){var t={};return v(e,"bpmn:Activity")&&!ln(e)&&(t={...t,...this._getLoopCharacteristicsHeaderEntries(e)}),v(e,"bpmn:DataObjectReference")&&(t={...t,...this._getCollectionHeaderEntries(e)}),v(e,"bpmn:Participant")&&(t={...t,...this._getParticipantMultiplicityHeaderEntries(e)}),ag(e)&&(t={...t,...this._getNonInterruptingHeaderEntries(e)}),t},Zn.prototype._createEntries=function(e,t){var n={},i=this;return k(t,function(r){n[r.actionName]=i._createEntry(r,e)}),n},Zn.prototype._createSequenceFlowEntries=function(e,t){var n=Z(e),i={},r=this._modeling,o=this._moddle,a=this;return k(t,function(s){switch(s.actionName){case"replace-with-default-flow":n.sourceRef.default!==n&&(v(n.sourceRef,"bpmn:ExclusiveGateway")||v(n.sourceRef,"bpmn:InclusiveGateway")||v(n.sourceRef,"bpmn:ComplexGateway")||v(n.sourceRef,"bpmn:Activity"))&&(i={...i,[s.actionName]:a._createEntry(s,e,function(){r.updateProperties(e.source,{default:n})})});break;case"replace-with-conditional-flow":!n.conditionExpression&&v(n.sourceRef,"bpmn:Activity")&&(i={...i,[s.actionName]:a._createEntry(s,e,function(){var c=o.create("bpmn:FormalExpression",{body:""});r.updateProperties(e,{conditionExpression:c})})});break;default:v(n.sourceRef,"bpmn:Activity")&&n.conditionExpression&&(i={...i,[s.actionName]:a._createEntry(s,e,function(){r.updateProperties(e,{conditionExpression:void 0})})}),(v(n.sourceRef,"bpmn:ExclusiveGateway")||v(n.sourceRef,"bpmn:InclusiveGateway")||v(n.sourceRef,"bpmn:ComplexGateway")||v(n.sourceRef,"bpmn:Activity"))&&n.sourceRef.default===n&&(i={...i,[s.actionName]:a._createEntry(s,e,function(){r.updateProperties(e.source,{default:void 0})})})}}),i},Zn.prototype._createEntry=function(e,t,n){var i=this._translate,r=this._bpmnReplace.replaceElement,o=function(){return r(t,e.target)},a=e.label;return a&&typeof a=="function"&&(a=a(t)),n=n||o,{label:i(a),className:e.className,action:n}},Zn.prototype._getLoopCharacteristicsHeaderEntries=function(e){var t=this,n=this._translate;function i(u,l){if(l.active){t._modeling.updateProperties(e,{loopCharacteristics:void 0});return}var f=e.businessObject.get("loopCharacteristics");f&&v(f,l.options.loopCharacteristics)?t._modeling.updateModdleProperties(e,f,{isSequential:l.options.isSequential}):(f=t._moddle.create(l.options.loopCharacteristics,{isSequential:l.options.isSequential}),t._modeling.updateProperties(e,{loopCharacteristics:f}))}var r=Z(e),o=r.loopCharacteristics,a,s,c;return o&&(a=o.isSequential,s=o.isSequential===void 0,c=o.isSequential!==void 0&&!o.isSequential),{"toggle-parallel-mi":{className:"bpmn-icon-parallel-mi-marker",title:n("Parallel multi-instance"),active:c,action:i,options:{loopCharacteristics:"bpmn:MultiInstanceLoopCharacteristics",isSequential:!1}},"toggle-sequential-mi":{className:"bpmn-icon-sequential-mi-marker",title:n("Sequential multi-instance"),active:a,action:i,options:{loopCharacteristics:"bpmn:MultiInstanceLoopCharacteristics",isSequential:!0}},"toggle-loop":{className:"bpmn-icon-loop-marker",title:n("Loop"),active:s,action:i,options:{loopCharacteristics:"bpmn:StandardLoopCharacteristics"}}}},Zn.prototype._getCollectionHeaderEntries=function(e){var t=this,n=this._translate,i=e.businessObject.dataObjectRef;if(!i)return{};function r(a,s){t._modeling.updateModdleProperties(e,i,{isCollection:!s.active})}var o=i.isCollection;return{"toggle-is-collection":{className:"bpmn-icon-parallel-mi-marker",title:n("Collection"),active:o,action:r}}},Zn.prototype._getParticipantMultiplicityHeaderEntries=function(e){var t=this,n=this._bpmnFactory,i=this._translate;function r(a,s){var c=s.active,u;c||(u=n.create("bpmn:ParticipantMultiplicity")),t._modeling.updateProperties(e,{participantMultiplicity:u})}var o=e.businessObject.participantMultiplicity;return{"toggle-participant-multiplicity":{className:"bpmn-icon-parallel-mi-marker",title:i("Participant multiplicity"),active:!!o,action:r}}},Zn.prototype._getNonInterruptingHeaderEntries=function(e){const t=this._translate,n=Z(e),i=this,r=sg(e),o=v(e,"bpmn:BoundaryEvent")?pb["intermediate-event-non-interrupting"]:pb["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 ek={__depends__:[mf,Py,Lc],__init__:["replaceMenuProvider"],replaceMenuProvider:["type",Zn]};function Va(e,t,n,i,r,o,a,s,c,u,l,f,p){e=e||{},i.registerProvider(this),this._contextPad=i,this._modeling=r,this._elementFactory=o,this._connect=a,this._create=s,this._popupMenu=c,this._canvas=u,this._rules=l,this._translate=f,this._eventBus=n,this._appendPreview=p,e.autoPlace!==!1&&(this._autoPlace=t.get("autoPlace",!1)),n.on("create.end",250,function(d){var h=d.context,m=h.shape;if(!(!ma(d)||!i.isOpen(m))){var g=i.getEntries(m);g.replace&&g.replace.action.click(d,m)}}),n.on("contextPad.close",function(){p.cleanUp()})}Va.$inject=["config.contextPad","injector","eventBus","contextPad","modeling","elementFactory","connect","create","popupMenu","canvas","rules","translate","appendPreview"],Va.prototype.getMultiElementContextPadEntries=function(e){var t=this._modeling,n={};return this._isDeleteAllowed(e)&&I(n,{delete:{group:"edit",className:"bpmn-icon-trash",title:this._translate("Delete"),action:{click:function(i,r){t.removeElements(r.slice())}}}}),n},Va.prototype._isDeleteAllowed=function(e){var t=this._rules.allowed("elements.delete",{elements:e});return we(t)?Cr(e,n=>t.includes(n)):t},Va.prototype.getContextPadEntries=function(e){var t=this._contextPad,n=this._modeling,i=this._elementFactory,r=this._connect,o=this._create,a=this._popupMenu,s=this._autoPlace,c=this._translate,u=this._appendPreview,l={};if(e.type==="label")return this._isDeleteAllowed([e])&&I(l,h()),l;var f=e.businessObject;function p(x,w){r.start(x,w)}function d(x,w){n.removeElements([w])}function h(){return{delete:{group:"edit",className:"bpmn-icon-trash",title:c("Delete"),action:{click:d}}}}function m(x){var w=5,S=t.getPad(x).html,M=S.getBoundingClientRect(),N={x:M.left,y:M.bottom+w};return N}function g(x,w,S,M){function N(G,$){var V=i.createShape(I({type:x},M));o.start(G,V,{source:$})}var T=s?function(G,$){var V=i.createShape(I({type:x},M));s.append($,V)}:N,H=s?function(G,$){return u.create($,x,M),()=>{u.cleanUp()}}:null;return{group:"model",className:w,title:S,action:{dragstart:N,click:T,hover:H}}}function R(x){return function(w,S){n.splitLane(S,x),t.open(S,!0)}}if(Ie(f,["bpmn:Lane","bpmn:Participant"])&&He(e)){var E=ar(e);I(l,{"lane-insert-above":{group:"lane-insert-above",className:"bpmn-icon-lane-insert-above",title:c("Add lane above"),action:{click:function(x,w){n.addLane(w,"top")}}}}),E.length<2&&((qt(e)?e.height>=120:e.width>=120)&&I(l,{"lane-divide-two":{group:"lane-divide",className:"bpmn-icon-lane-divide-two",title:c("Divide into two lanes"),action:{click:R(2)}}}),(qt(e)?e.height>=180:e.width>=180)&&I(l,{"lane-divide-three":{group:"lane-divide",className:"bpmn-icon-lane-divide-three",title:c("Divide into three lanes"),action:{click:R(3)}}})),I(l,{"lane-insert-below":{group:"lane-insert-below",className:"bpmn-icon-lane-insert-below",title:c("Add lane below"),action:{click:function(x,w){n.addLane(w,"bottom")}}}})}return v(f,"bpmn:FlowNode")&&(v(f,"bpmn:EventBasedGateway")?I(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"})}):fb(f,"bpmn:BoundaryEvent","bpmn:CompensateEventDefinition")?I(l,{"append.compensation-activity":g("bpmn:Task","bpmn-icon-task",c("Append compensation activity"),{isForCompensation:!0})}):!v(f,"bpmn:EndEvent")&&!f.isForCompensation&&!fb(f,"bpmn:IntermediateThrowEvent","bpmn:LinkEventDefinition")&&!ln(f)&&I(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")||I(l,{replace:{group:"edit",className:"bpmn-icon-screw-wrench",title:c("Change element"),action:{click:function(x,w){var S=I(m(w),{cursor:{x:x.x,y:x.y}});a.open(w,"bpmn-replace",S,{title:c("Change element"),width:"var(--bpmn-replace-popup-width, 300px)",search:!0})}}}}),v(f,"bpmn:SequenceFlow")&&I(l,{"append.text-annotation":g("bpmn:TextAnnotation","bpmn-icon-text-annotation",c("Add text annotation"))}),v(f,"bpmn:MessageFlow")&&I(l,{"append.text-annotation":g("bpmn:TextAnnotation","bpmn-icon-text-annotation",c("Add text annotation"))}),Ie(f,["bpmn:FlowNode","bpmn:InteractionNode","bpmn:DataObjectReference","bpmn:DataStoreReference"])&&I(l,{"append.text-annotation":g("bpmn:TextAnnotation","bpmn-icon-text-annotation",c("Add text annotation")),connect:{group:"connect",className:"bpmn-icon-connection-multi",title:c("Connect to other element"),action:{click:p,dragstart:p}}}),v(f,"bpmn:TextAnnotation")&&I(l,{connect:{group:"connect",className:"bpmn-icon-connection-multi",title:c("Connect using association"),action:{click:p,dragstart:p}}}),Ie(f,["bpmn:DataObjectReference","bpmn:DataStoreReference"])&&I(l,{connect:{group:"connect",className:"bpmn-icon-connection-multi",title:c("Connect using data input association"),action:{click:p,dragstart:p}}}),v(f,"bpmn:Group")&&I(l,{"append.text-annotation":g("bpmn:TextAnnotation","bpmn-icon-text-annotation",c("Add text annotation"))}),this._isDeleteAllowed([e])&&I(l,h()),l};function fb(e,t,n){var i=e.$instanceOf(t),r=!1,o=e.eventDefinitions||[];return k(o,function(a){a.$type===n&&(r=!0)}),i&&r}const tk={__depends__:[D2,cb,Hv,Yn,Ef,fc,ek],__init__:["contextPadProvider"],contextPadProvider:["type",Va]};var nk={horizontal:["x","width"],vertical:["y","height"]},db=5;function Vi(e,t){this._modeling=e,this._filters=[],this.registerFilter(function(n){var i=t.allowed("elements.distribute",{elements:n});return we(i)?i:i?n:[]})}Vi.$inject=["modeling","rules"],Vi.prototype.registerFilter=function(e){if(typeof e!="function")throw new Error("the filter has to be a function");this._filters.push(e)},Vi.prototype.trigger=function(e,t){var n=this._modeling,i,r;if(!(e.length<3)&&(this._setOrientation(t),r=this._filterElements(e),i=this._createGroups(r),!(i.length<=2)))return n.distributeElements(i,this._axis,this._dimension),i},Vi.prototype._filterElements=function(e){var t=this._filters,n=this._axis,i=this._dimension,r=[].concat(e);return t.length?(k(t,function(o){r=o(r,n,i)}),r):e},Vi.prototype._createGroups=function(e){var t=[],n=this,i=this._axis,r=this._dimension;if(!i)throw new Error('must have a defined "axis" and "dimension"');var o=oi(e,i);return k(o,function(a,s){var c=n._findRange(a,i,r),u,l=t[t.length-1];l&&n._hasIntersection(l.range,c)?t[t.length-1].elements.push(a):(u={range:c,elements:[a]},t.push(u))}),t},Vi.prototype._setOrientation=function(e){var t=nk[e];this._axis=t[0],this._dimension=t[1]},Vi.prototype._hasIntersection=function(e,t){return Math.max(e.min,e.max)>=Math.min(t.min,t.max)&&Math.min(e.min,e.max)<=Math.max(t.min,t.max)},Vi.prototype._findRange=function(e){var t=e[this._axis],n=e[this._dimension];return{min:t+db,max:t+n-db}};const ik={__init__:["distributeElements"],distributeElements:["type",Vi]};function cu(e){Un.call(this,e)}cu.$inject=["eventBus"],ae(cu,Un),cu.prototype.init=function(){this.addRule("elements.distribute",function(e){var t=e.elements;return t=Be(t,function(n){var i=Ie(n,["bpmn:Association","bpmn:BoundaryEvent","bpmn:DataInputAssociation","bpmn:DataOutputAssociation","bpmn:Lane","bpmn:MessageFlow","bpmn:SequenceFlow","bpmn:TextAnnotation"]);return!(n.labelTarget||i)}),t=Ss(t),t.length<3?!1:t})};var hb={horizontal:`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1800 1800">
328
328
  <polyline points="450 400 450 150 1350 150 1350 400" style="fill:none;stroke:currentColor;stroke-width:100;stroke-linejoin:round;"/>
329
329
  <rect x="150" y="450" width="600" height="1200" rx="1" style="fill:none;stroke:currentColor;stroke-width:100;"></rect>
330
330
  <rect x="1050" y="450" width="600" height="800" rx="1" style="fill:currentColor;stroke:currentColor;stroke-width:100;opacity:.5;"></rect>
@@ -332,7 +332,7 @@
332
332
  <polyline points="400 1350 150 1350 150 450 400 450" style="fill:none;stroke:currentColor;stroke-width:100;stroke-linejoin:round;"/>
333
333
  <rect x="450" y="150" width="1200" height="600" rx="1" style="fill:none;stroke:currentColor;stroke-width:100;"></rect>
334
334
  <rect x="450" y="1050" width="800" height="600" rx="1" style="fill:currentColor;stroke:currentColor;stroke-width:100;opacity:.5;"></rect>
335
- </svg>`},Q2=900;function za(e,t,n,i){this._distributeElements=t,this._translate=n,this._popupMenu=e,this._rules=i,e.registerProvider("align-elements",Q2,this)}za.$inject=["popupMenu","distributeElements","translate","rules"],za.prototype.getPopupMenuEntries=function(e){var t={};return this._isAllowed(e)&&L(t,this._getEntries(e)),t},za.prototype._isAllowed=function(e){return this._rules.allowed("elements.distribute",{elements:e})},za.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:fb.horizontal,action:function(o,a){t.trigger(e,"horizontal"),i.close()}},"distribute-elements-vertical":{group:"distribute",title:n("Distribute elements vertically"),imageHtml:fb.vertical,action:function(o,a){t.trigger(e,"vertical"),i.close()}}};return r};const J2={__depends__:[mf,Z2],__init__:["bpmnDistributeElements","distributeElementsMenuProvider"],bpmnDistributeElements:["type",ou],distributeElementsMenuProvider:["type",za]};var db="is not a registered action",ek="is already registered";function ei(e,t){this._eventBus=e,this._actions={};var n=this;e.on("diagram.init",function(){n._registerDefaultActions(t),e.fire("editorActions.init",{editorActions:n})})}ei.$inject=["eventBus","injector"],ei.prototype._registerDefaultActions=function(e){var t=e.get("commandStack",!1),n=e.get("modeling",!1),i=e.get("selection",!1),r=e.get("zoomScroll",!1),o=e.get("copyPaste",!1),a=e.get("canvas",!1),s=e.get("rules",!1),c=e.get("keyboardMove",!1),u=e.get("keyboardMoveSelection",!1);t&&(this.register("undo",function(){t.undo()}),this.register("redo",function(){t.redo()})),o&&i&&this.register("copy",function(){var l=i.get();if(l.length)return o.copy(l)}),o&&i&&this.register("duplicate",function(){var l=i.get();if(l.length)return o.duplicate(l)}),o&&this.register("paste",function(){o.paste()}),o&&i&&s&&this.register("cut",function(){var l=i.get();if(l.length){var f=s.allowed("elements.delete",{elements:l});if(f!==!1){var p=xe(f)?f:l;return o.cut(p.slice())}}}),r&&this.register("stepZoom",function(l){r.stepZoom(l.value)}),a&&this.register("zoom",function(l){a.zoom(l.value)}),n&&i&&s&&this.register("removeSelection",function(){var l=i.get();if(l.length){var f=s.allowed("elements.delete",{elements:l}),p;f!==!1&&(xe(f)?p=f:p=l,p.length&&n.removeElements(p.slice()))}}),c&&this.register("moveCanvas",function(l){c.moveCanvas(l)}),u&&this.register("moveSelection",function(l){u.moveSelection(l.direction,l.accelerated)})},ei.prototype.trigger=function(e,t){if(!this._actions[e])throw Rf(e,db);var n=this._eventBus.fire("editorActions.allowed",{action:e,opts:t});if(n!==!1)return this._actions[e](t)},ei.prototype.register=function(e,t){var n=this;if(typeof e=="string")return this._registerAction(e,t);k(e,function(i,r){n._registerAction(r,i)})},ei.prototype._registerAction=function(e,t){if(this.isRegistered(e))throw Rf(e,ek);this._actions[e]=t},ei.prototype.unregister=function(e){if(!this.isRegistered(e))throw Rf(e,db);this._actions[e]=void 0},ei.prototype.getActions=function(){return Object.keys(this._actions)},ei.prototype.isRegistered=function(e){return!!this._actions[e]};function Rf(e,t){return new Error(e+" "+t)}const tk={__init__:["editorActions"],editorActions:["type",ei]};function au(e){e.invoke(ei,this)}ae(au,ei),au.$inject=["injector"],au.prototype._registerDefaultActions=function(e){ei.prototype._registerDefaultActions.call(this,e);var t=e.get("canvas",!1),n=e.get("elementRegistry",!1),i=e.get("selection",!1),r=e.get("spaceTool",!1),o=e.get("lassoTool",!1),a=e.get("handTool",!1),s=e.get("globalConnect",!1),c=e.get("distributeElements",!1),u=e.get("alignElements",!1),l=e.get("directEditing",!1),f=e.get("searchPad",!1),p=e.get("modeling",!1),d=e.get("contextPad",!1);t&&n&&i&&this._registerAction("selectElements",function(){var 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=[],R=h.type;m.length&&(g=Ie(m,function(w){return!v(w,"bpmn:Lane")}),u.trigger(g,R))}),i&&p&&this._registerAction("setColor",function(h){var m=i.get();m.length&&p.setColor(m,h)}),i&&l&&this._registerAction("directEditing",function(){var h=i.get();h.length&&l.activate(h[0])}),f&&this._registerAction("find",function(){f.toggle()}),t&&p&&this._registerAction("moveToOrigin",function(){var h=t.getRootElement(),m,g;v(h,"bpmn:Collaboration")?g=n.filter(function(R){return v(R.parent,"bpmn:Collaboration")}):g=n.filter(function(R){return R!==h&&!v(R.parent,"bpmn:SubProcess")}),m=Tt(g),p.moveElements(g,{x:-m.x,y:-m.y},h)}),i&&d&&this._registerAction("replaceElement",function(h){d.triggerEntry("replace","click",h)})};const nk={__depends__:[tk],editorActions:["type",au]};function hb(e){e.on(["create.init","shape.move.init"],function(t){var n=t.context,i=t.shape;Le(i,["bpmn:Participant","bpmn:SubProcess","bpmn:TextAnnotation"])&&(n.gridSnappingContext||(n.gridSnappingContext={}),n.gridSnappingContext.snapLocation="top-left")})}hb.$inject=["eventBus"];function qr(e,t){X.call(this,e),this._gridSnapping=t;var n=this;this.preExecute("shape.resize",function(i){var r=i.context,o=r.hints||{},a=o.autoResize;if(a){var s=r.shape,c=r.newBounds;wn(a)?r.newBounds=n.snapComplex(c,a):r.newBounds=n.snapSimple(s,c)}})}qr.$inject=["eventBus","gridSnapping","modeling"],ae(qr,X),qr.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},qr.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},qr.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),L(e,o),e},qr.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),L(e,o),e};var ik=2e3;function mb(e,t){e.on(["spaceTool.move","spaceTool.end"],ik,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)}})}mb.$inject=["eventBus","gridSnapping"];const rk={__init__:["gridSnappingResizeBehavior","gridSnappingSpaceToolBehavior"],gridSnappingResizeBehavior:["type",qr],gridSnappingSpaceToolBehavior:["type",mb]};var su=10;function Cf(e,t,n){return n||(n="round"),Math[n](e/t)*t}var ok=1200,ak=800;function _r(e,t,n){var i=!n||n.active!==!1;this._eventBus=t;var r=this;t.on("diagram.init",ak,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"],ok,function(o){var a=o.originalEvent;if(!(!r.active||a&&Tn(a))){var s=o.context,c=s.gridSnappingContext;c||(c=s.gridSnappingContext={}),["x","y"].forEach(function(u){var l={},f=ck(o,u,e);f&&(l.offset=f);var p=sk(o,u);p&&L(l,p),No(o,u)||r.snapEvent(o,u,l)})}})}_r.prototype.snapEvent=function(e,t,n){var i=this.snapValue(e[t],n);Ot(e,t,i)},_r.prototype.getGridSpacing=function(){return su},_r.prototype.snapValue=function(e,t){var n=0;t&&t.offset&&(n=t.offset),e+=n,e=Cf(e,su);var i,r;return t&&t.min&&(i=t.min,Ce(i)&&(i=Cf(i+n,su,"ceil"),e=Math.max(e,i))),t&&t.max&&(r=t.max,Ce(r)&&(r=Cf(r+n,su,"floor"),e=Math.min(e,r))),e-=n,e},_r.prototype.isActive=function(){return this.active},_r.prototype.setActive=function(e){this.active=e,this._eventBus.fire("gridSnapping.toggle",{active:e})},_r.prototype.toggleActive=function(){this.setActive(!this.active)},_r.$inject=["elementRegistry","eventBus","config.gridSnapping"];function sk(e,t){var n=e.context,i=n.createConstraints,r=n.resizeConstraints||{},o=n.gridSnappingContext,a=o.snapConstraints;if(a&&a[t])return a[t];a||(a=o.snapConstraints={}),a[t]||(a[t]={});var s=n.direction;i&&(cu(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&&(cu(t)?yb(s)?a.x.max=c.left:a.x.min=c.right:gb(s)?a.y.max=c.top:a.y.min=c.bottom),u&&(cu(t)?yb(s)?a.x.min=u.left:a.x.max=u.right:gb(s)?a.y.min=u.top:a.y.max=u.bottom),a[t]}function ck(e,t,n){var i=e.context,r=e.shape,o=i.gridSnappingContext,a=o.snapLocation,s=o.snapOffset;return s&&Ce(s[t])||(s||(s=o.snapOffset={}),Ce(s[t])||(s[t]=0),!r)||(n.get(r.id)||(cu(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 cu(e){return e==="x"}function gb(e){return e.indexOf("n")!==-1}function yb(e){return e.indexOf("w")!==-1}const uk={__depends__:[rk],__init__:["gridSnapping"],gridSnapping:["type",_r]};var lk=2e3;function vb(e,t,n){e.on("autoPlace",lk,function(i){var r=i.source,o=we(r),a=i.shape,s=yv(r,a,n);return["x","y"].forEach(function(c){var u={};s[c]!==o[c]&&(s[c]>o[c]?u.min=s[c]:u.max=s[c],v(a,"bpmn:TextAnnotation")&&(pk(c)?u.offset=-a.width/2:u.offset=-a.height/2),s[c]=t.snapValue(s[c],u))}),s})}vb.$inject=["eventBus","gridSnapping","elementRegistry"];function pk(e){return e==="x"}var fk=1750;function _b(e,t,n){t.on(["create.start","shape.move.start"],fk,function(i){var r=i.context,o=r.shape,a=e.getRootElement();if(!(!v(o,"bpmn:Participant")||!v(a,"bpmn:Process")||!a.children.length)){var s=r.createConstraints;s&&(o.width=n.snapValue(o.width,{min:o.width}),o.height=n.snapValue(o.height,{min:o.height}))}})}_b.$inject=["canvas","eventBus","gridSnapping"];var dk=3e3;function uu(e,t,n){X.call(this,e),this._gridSnapping=t;var i=this;this.postExecuted(["connection.create","connection.layout"],dk,function(r){var o=r.context,a=o.connection,s=o.hints||{},c=a.waypoints;s.connectionStart||s.connectionEnd||s.createElementsBehavior===!1||hk(c)&&n.updateWaypoints(a,i.snapMiddleSegments(c))})}uu.$inject=["eventBus","gridSnapping","modeling"],ae(uu,X),uu.prototype.snapMiddleSegments=function(e){var t=this._gridSnapping,n;e=e.slice();for(var i=1;i<e.length-2;i++)n=yk(t,e[i],e[i+1]),e[i]=n[0],e[i+1]=n[1];return e};function hk(e){return e.length>3}function mk(e){return e==="h"}function gk(e){return e==="v"}function yk(e,t,n){var i=Ti(t,n),r={};return mk(i)&&(r.y=e.snapValue(t.y)),gk(i)&&(r.x=e.snapValue(t.x)),("x"in r||"y"in r)&&(t=L({},t,r),n=L({},n,r)),[t,n]}const vk={__depends__:[uk,{__init__:["gridSnappingAutoPlaceBehavior","gridSnappingParticipantBehavior","gridSnappingLayoutConnectionBehavior"],gridSnappingAutoPlaceBehavior:["type",vb],gridSnappingParticipantBehavior:["type",_b],gridSnappingLayoutConnectionBehavior:["type",uu]}],__init__:["bpmnGridSnapping"],bpmnGridSnapping:["type",hb]};var _k=30,bb=30;function Va(e,t){this._interactionEvents=t;var n=this;e.on(["interactionEvents.createHit","interactionEvents.updateHit"],function(i){var r=i.element,o=i.gfx;if(v(r,"bpmn:Lane"))return n._createParticipantHit(r,o);if(v(r,"bpmn:Participant"))return $e(r)?n._createParticipantHit(r,o):n._createDefaultHit(r,o);if(v(r,"bpmn:SubProcess"))return $e(r)?n._createSubProcessHit(r,o):n._createDefaultHit(r,o)})}Va.$inject=["eventBus","interactionEvents"],Va.prototype._createDefaultHit=function(e,t){return this._interactionEvents.removeHits(t),this._interactionEvents.createDefaultHit(e,t),!0},Va.prototype._createParticipantHit=function(e,t){this._interactionEvents.removeHits(t),this._interactionEvents.createBoxHit(t,"no-move",{width:e.width,height:e.height}),this._interactionEvents.createBoxHit(t,"click-stroke",{width:e.width,height:e.height});var n=qt(e)?{width:_k,height:e.height}:{width:e.width,height:bb};return this._interactionEvents.createBoxHit(t,"all",n),!0},Va.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:bb}),!0};const bk={__init__:["bpmnInteractionEvents"],bpmnInteractionEvents:["type",Va]};function lu(e){e.invoke(To,this)}ae(lu,To),lu.$inject=["injector"],lu.prototype.registerBindings=function(e,t){To.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 xk={__depends__:[Jp],__init__:["keyboardBindings"],keyboardBindings:["type",lu]};var wk={moveSpeed:1,moveSpeedAccelerated:10},Ek=1500,xb="left",wb="up",Eb="right",Sb="down",Sk={ArrowLeft:xb,Left:xb,ArrowUp:wb,Up:wb,ArrowRight:Eb,Right:Eb,ArrowDown:Sb,Down:Sb},Rk={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 Rb(e,t,n,i,r){var o=this;this._config=L({},wk,e||{}),t.addListener(Ek,function(a){var s=a.keyEvent,c=Sk[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=Rk[a](u),f=i.allowed("elements.move",{shapes:c,hints:{keyboardMove:!0}});f&&n.moveElements(c,l)}}}Rb.$inject=["config.keyboardMoveSelection","keyboard","modeling","rules","selection"];const Ck={__depends__:[Jp,Kn],__init__:["keyboardMoveSelection"],keyboardMoveSelection:["type",Rb]};var Cb=10;function Ga(e,t,n,i){this._dragging=i,this._rules=t;var r=this;function o(c,u){var l=c.shape,f=c.direction,p=c.resizeConstraints,d;c.delta=u,d=wR(l,f,u),c.newBounds=SR(d,p),c.canExecute=r.canResize(c)}function a(c){var u=c.resizeConstraints,l=c.minBounds;u===void 0&&(l===void 0&&(l=r.computeMinResizeBox(c)),c.resizeConstraints={min:ve(l)})}function s(c){var u=c.shape,l=c.canExecute,f=c.newBounds;if(l){if(f=Vh(f),!Pk(u,f))return;n.resizeShape(u,f)}}e.on("resize.start",function(c){a(c.context)}),e.on("resize.move",function(c){var u={x:c.dx,y:c.dy};o(c.context,u)}),e.on("resize.end",function(c){s(c.context)})}Ga.prototype.canResize=function(e){var t=this._rules,n=ii(e,["newBounds","shape","delta","direction"]);return t.allowed("shape.resize",n)},Ga.prototype.activate=function(e,t,n){var i=this._dragging,r,o;if(typeof n=="string"&&(n={direction:n}),r=L({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,Pb(t,o),"resize",{autoActivate:!0,cursor:Ak(o),data:{shape:t,context:r}})},Ga.prototype.computeMinResizeBox=function(e){var t=e.shape,n=e.direction,i,r;return i=e.minDimensions||{width:Cb,height:Cb},r=Mm(t,e.childrenBoxPadding),RR(n,t,i,r)},Ga.$inject=["eventBus","rules","modeling","dragging"];function Pk(e,t){return e.x!==t.x||e.y!==t.y||e.width!==t.width||e.height!==t.height}function Pb(e,t){var n=we(e),i=ve(e),r={x:n.x,y:n.y};return t.indexOf("n")!==-1?r.y=i.top:t.indexOf("s")!==-1&&(r.y=i.bottom),t.indexOf("e")!==-1?r.x=i.right:t.indexOf("w")!==-1&&(r.x=i.left),r}function Ak(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 Ab="djs-resizing",Tb="resize-not-ok",Tk=500;function Mb(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,Ab)),s.width>5&&se(c,{x:s.x,width:s.width}),s.height>5&&se(c,{y:s.y,height:s.height}),o.canExecute?je(c).remove(Tb):je(c).add(Tb)}function r(o){var a=o.shape,s=o.frame;s&&zt(o.frame),t.removeMarker(a,Ab)}e.on("resize.move",Tk,function(o){i(o.context)}),e.on("resize.cleanup",function(o){r(o.context)})}Mb.$inject=["eventBus","canvas","previewSupport"];var pu=-6,fu=8,du=20,Wa="djs-resizer",Mk=["n","w","s","e","nw","ne","se","sw"];function br(e,t,n,i){this._resize=i,this._canvas=t;var r=this;e.on("selection.changed",function(o){var a=o.newSelection;r.removeResizers(),a.length===1&&k(a,_n(r.addResizer,r))}),e.on("shape.changed",function(o){var a=o.element;n.isSelected(a)&&(r.removeResizers(),r.addResizer(a))})}br.prototype.makeDraggable=function(e,t,n){var i=this._resize;function r(o){cr(o)&&i.activate(o,e,n)}Pe.bind(t,"mousedown",r),Pe.bind(t,"touchstart",r)},br.prototype._createResizer=function(e,t,n,i){var r=this._getResizersParent(),o=kk(i),a=ye("g");je(a).add(Wa),je(a).add(Wa+"-"+e.id),je(a).add(Wa+"-"+i),Ae(r,a);var s=ye("rect");se(s,{x:-fu/2+o.x,y:-fu/2+o.y,width:fu,height:fu}),je(s).add(Wa+"-visual"),Ae(a,s);var c=ye("rect");return se(c,{x:-du/2+o.x,y:-du/2+o.y,width:du,height:du}),je(c).add(Wa+"-hit"),Ae(a,c),Ps(a,t,n),a},br.prototype.createResizer=function(e,t){var n=Pb(e,t),i=this._createResizer(e,n.x,n.y,t);this.makeDraggable(e,i,t)},br.prototype.addResizer=function(e){var t=this;ot(e)||k(Mk,function(n){t._resize.canResize({shape:e,direction:n})&&t.createResizer(e,n)})},br.prototype.removeResizers=function(){var e=this._getResizersParent();vs(e)},br.prototype._getResizersParent=function(){return this._canvas.getLayer("resizers")},br.$inject=["eventBus","canvas","selection","resize"];function kk(e){var t={x:0,y:0};return e.indexOf("e")!==-1?t.x=-pu:e.indexOf("w")!==-1&&(t.x=pu),e.indexOf("s")!==-1?t.y=-pu:e.indexOf("n")!==-1&&(t.y=pu),t}const kb={__depends__:[yi,Ii,Co],__init__:["resize","resizePreview","resizeHandles"],resize:["type",Ga],resizePreview:["type",Mb],resizeHandles:["type",br]};var Dk=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"],Dk,function(c){i.isActive(c.element)&&i.cancel()}),e.on(["commandStack.changed"],function(c){i.isActive()&&i.cancel()}),e.on("directEditing.activate",function(c){o.removeResizers()}),e.on("create.end",500,function(c){var u=c.context,l=u.shape,f=c.context.canExecute,p=c.isTouch;p||f&&(u.hints&&u.hints.createElementsBehavior===!1||s(l))}),e.on("autoPlace.end",500,function(c){s(c.shape)});function s(c,u){(u||Le(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=Hn(e);if(t!==void 0){var n={text:t},i=this.getEditingBBox(e);L(n,i);var r={},o=n.style||{};return L(o,{backgroundColor:null,border:null}),(Le(e,["bpmn:Task","bpmn:Participant","bpmn:Lane","bpmn:CallActivity"])||Db(e))&&L(r,{centerVertically:!0}),rr(e)&&(L(r,{resizable:!0,autoResize:!0}),L(o,{backgroundColor:"#ffffff",border:"1px solid #ccc"})),v(e,"bpmn:TextAnnotation")&&(L(r,{resizable:!0,autoResize:!0}),L(o,{backgroundColor:"#ffffff",border:"1px solid #ccc"})),L(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,f=s.fontSize*a,p=s.lineHeight,d={fontFamily:this._textRenderer.getDefaultStyle().fontFamily,fontWeight:this._textRenderer.getDefaultStyle().fontWeight};if(v(e,"bpmn:Lane")||Ik(e)){var h=qt(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};L(o,m),L(d,{fontSize:f+"px",lineHeight:p,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px",transform:h?"rotate(-90deg)":null})}if(Lk(e)){var g=qt(e),R=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};L(o,R),L(d,{fontSize:f+"px",lineHeight:p,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px",transform:g?null:"rotate(-90deg)"})}(Le(e,["bpmn:Task","bpmn:CallActivity"])||Db(e))&&(L(o,{width:i.width,height:i.height}),L(d,{fontSize:f+"px",lineHeight:p,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px"})),Ok(e)&&(L(o,{width:i.width,x:i.x}),L(d,{fontSize:f+"px",lineHeight:p,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px"}));var w=1,b=i.width+2*w;if(n.labelTarget&&(L(o,{width:b,height:i.height+2*w,x:i.x-w,y:i.y-w}),L(d,{fontSize:u+"px",lineHeight:l})),rr(n)&&!Ms(n)&&!De(n)){var x=dl(e),S=t.getAbsoluteBBox({x:x.x,y:x.y,width:0,height:0}),M=u,N=Nr.width*a+2*w;L(o,{width:N,height:M+2*w,x:S.x-N/2,y:S.y-M/2-w}),L(d,{fontSize:u+"px",lineHeight:l})}return v(e,"bpmn:TextAnnotation")&&(L(o,{width:i.width+2*w,height:i.height+2*w,x:i.x-w,y:i.y-w,minWidth:30*a,minHeight:10*a}),L(d,{textAlign:"left",paddingTop:fo*a+"px",paddingBottom:fo*a+"px",paddingLeft:fo*a+"px",paddingRight:fo*a+"px",fontSize:f+"px",lineHeight:p})),{bounds:o,style:d}},Ua.prototype.update=function(e,t,n,i){var r,o;v(e,"bpmn:TextAnnotation")&&(o=this._canvas.getAbsoluteBBox(e),r={x:e.x,y:e.y,width:e.width/o.width*i.width,height:e.height/o.height*i.height}),Nk(t)&&(t=null),this._modeling.updateLabel(e,t,r)};function Db(e){return v(e,"bpmn:SubProcess")&&!$e(e)}function Ok(e){return v(e,"bpmn:SubProcess")&&$e(e)}function Lk(e){return v(e,"bpmn:Participant")&&!$e(e)}function Ik(e){return v(e,"bpmn:Participant")&&$e(e)}function Nk(e){return!e||!e.trim()}var Ob="djs-element-hidden",Lb="djs-label-hidden";function Ib(e,t,n){var i=this,r=t.getDefaultLayer(),o,a,s;e.on("directEditing.activate",function(c){var u=c.active;if(o=u.element.label||u.element,v(o,"bpmn:TextAnnotation")){a=t.getAbsoluteBBox(o),s=ye("g");var l=n.getScaledPath("TEXT_ANNOTATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:o.width,containerHeight:o.height,position:{mx:0,my:0}}),f=i.path=ye("path");se(f,{d:l,strokeWidth:2,stroke:Bk(o)}),Ae(s,f),Ae(r,s),Jt(s,o.x,o.y)}v(o,"bpmn:TextAnnotation")||o.labelTarget?t.addMarker(o,Ob):(v(o,"bpmn:Task")||v(o,"bpmn:CallActivity")||v(o,"bpmn:SubProcess")||v(o,"bpmn:Participant")||v(o,"bpmn:Lane"))&&t.addMarker(o,Lb)}),e.on("directEditing.resize",function(c){if(v(o,"bpmn:TextAnnotation")){var u=c.height,l=c.dy,f=Math.max(o.height/a.height*(u+l),0),p=n.getScaledPath("TEXT_ANNOTATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:o.width,containerHeight:f,position:{mx:0,my:0}});se(i.path,{d:p})}}),e.on(["directEditing.complete","directEditing.cancel"],function(c){var u=c.active;u&&(t.removeMarker(u.element.label||u.element,Ob),t.removeMarker(o,Lb)),o=void 0,a=void 0,s&&(zt(s),s=void 0)})}Ib.$inject=["eventBus","canvas","pathMap"];function Bk(e,t){var n=Ge(e);return n.get("stroke")||t||"black"}const $k={__depends__:[kp,kb,ab],__init__:["labelEditingProvider","labelEditingPreview"],labelEditingProvider:["type",Ua],labelEditingPreview:["type",Ib]};var jk=500,Fk=1e3;function bi(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){S1(o)||i.createOutline(o)}e.on("element.hover",function(o){r(o.element)}),e.on("selection.changed",function(o){k(o.newSelection,r)}),e.on(["shape.changed","connection.changed"],jk,function(o){var a=o.element,s=o.gfx,c=nt(".djs-outline",s);c&&i.updateOutline(a,c)})}bi.prototype.createOutline=function(e){var t=this._elementRegistry.getGraphics(e);if(!t)throw new Error("cannot create outline for non-rendered element");var n=nt(".djs-outline",t);return n||(n=this.getOutline(e)||this._createOutlineGfx(),Ae(t,n),this.updateOutline(e,n)),n},bi.prototype._createOutlineGfx=function(){var e=ye("rect");return se(e,L({x:0,y:0,rx:4,width:100,height:100},this._outlineStyle)),e},bi.prototype.updateOutline=function(e,t){e.waypoints?this.updateConnectionOutline(t,e):this.updateShapeOutline(t,e)},bi.prototype.updateShapeOutline=function(e,t){var n=!1,i=this._getProviders();i.length&&k(i,function(r){n=n||r.updateOutline(t,e)}),n||se(e,{x:-this._outlineOffset,y:-this._outlineOffset,width:t.width+this._outlineOffset*2,height:t.height+this._outlineOffset*2})},bi.prototype.updateConnectionOutline=function(e,t){var n=Tt(t);se(e,{x:n.x-this._outlineOffset,y:n.y-this._outlineOffset,width:n.width+this._outlineOffset*2,height:n.height+this._outlineOffset*2})},bi.prototype.registerProvider=function(e,t){t||(t=e,e=Fk),this._eventBus.on("outline.getProviders",e,function(n){n.providers.push(t)})},bi.prototype._getProviders=function(){var e=this._eventBus.createEvent({type:"outline.getProviders",providers:[]});return this._eventBus.fire(e),e.providers},bi.prototype.getOutline=function(e){var t,n=this._getProviders();return k(n,function(i){Yt(i.getOutline)&&(t=t||i.getOutline(e))}),t},bi.$inject=["eventBus","styles","elementRegistry"];var hu=6;function Pf(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)})}Pf.prototype._updateMultiSelectionOutline=function(e){var t=this._canvas.getLayer("selectionOutline");vs(t);var n=e.length>1,i=this._canvas.getContainer();if(je(i)[n?"add":"remove"]("djs-multi-select"),!!n){var r=Hk(Tt(e)),o=ye("rect");se(o,L({rx:3},r)),je(o).add("djs-selection-outline"),Ae(t,o)}},Pf.$inject=["eventBus","canvas","selection"];function Hk(e){return{x:e.x-hu,y:e.y-hu,width:e.width+hu*2,height:e.height+hu*2}}const Af={__depends__:[Kn],__init__:["outline","multiSelectionOutline"],outline:["type",bi],multiSelectionOutline:["type",Pf]},Nb=["bpmn:Event","bpmn:SequenceFlow","bpmn:Gateway"],Bb={class:"bjs-label-link",stroke:"var(--element-selected-outline-secondary-stroke-color)",strokeDasharray:"5, 5"},zk=15,mu=2;function $b(e,t,n,i,r){const o=t.getLayer("overlays");e.on(["selection.changed","shape.changed"],function(){s()}),e.on("selection.changed",function({newSelection:f}){var d;const p=f.filter(h=>Le(h,Nb));if(p.length===1){const h=p[0];De(h)?a(h,h.labelTarget):(d=h.labels)!=null&&d.length&&a(h.labels[0],h)}if(p.length===2){const h=p.find(De),m=p.find(g=>{var R;return(R=g.labels)==null?void 0:R.includes(h)});h&&m&&a(h,m)}}),e.on("shape.changed",function({element:f}){var p;!Le(f,Nb)||!l(f)||(De(f)?a(f,f.labelTarget):(p=f.labels)!=null&&p.length&&a(f.labels[0],f))});function a(f,p){const d=Ko([we(p),we(f)],Bb),h=d.getAttribute("d"),g=r.isSelected(f)?c(f):u(f),R=Jo(g,h);if(!R)return;const b=r.isSelected(p)?c(p):u(p),x=Jo(b,h)||we(p);ua(x,R)<zk||(ol(d,[x,R]),Ae(o,d))}function s(){ys(`.${Bb.class}`,o).forEach(zt)}function c(f){const p=i.getOutline(f);if(!p)return u(f);if(p.x){const d={x:f.x+xr(p,"x")-mu,y:f.y+xr(p,"y")-mu,width:xr(p,"width")+mu*2,height:xr(p,"height")+mu*2};return ml(d,xr(p,"rx"))}if(p.cx){const d=xr(p,"r"),h={x:f.x+xr(p,"cx")-d,y:f.y+xr(p,"cy")-d,width:d*2,height:d*2};return dm(h)}}function u(f){return n.getShapePath(f)}function l(f){return r.isSelected(f)}}$b.$inject=["eventBus","canvas","graphicsFactory","outline","selection"];function xr(e,t){return parseFloat(se(e,t)||0)}const Vk={__depends__:[Kn,Af],__init__:["labelLink"],labelLink:["type",$b]};var Gk=new Ro("tt");function Wk(e){var t=lt('<div class="djs-tooltip-container" />');return gn(t,{position:"absolute",width:"0",height:"0"}),e.insertBefore(t,e.firstChild),t}function Uk(e,t,n){gn(e,{left:t+"px",top:n+"px"})}function Tf(e,t){e.style.display=t===!1?"none":""}var jb="djs-tooltip",Mf="."+jb;function xn(e,t){this._eventBus=e,this._canvas=t,this._ids=Gk,this._tooltipDefaults={show:{minZoom:.7,maxZoom:5}},this._tooltips={},this._tooltipRoot=Wk(t.getContainer());var n=this;Cn.bind(this._tooltipRoot,Mf,"mousedown",function(i){i.stopPropagation()}),Cn.bind(this._tooltipRoot,Mf,"mouseover",function(i){n.trigger("mouseover",i)}),Cn.bind(this._tooltipRoot,Mf,"mouseout",function(i){n.trigger("mouseout",i)}),this._init()}xn.$inject=["eventBus","canvas"],xn.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=L({},this._tooltipDefaults,e,{id:t}),this._addTooltip(e),e.timeout&&this.setTimeout(e),t},xn.prototype.trigger=function(e,t){var n=t.delegateTarget||t.target,i=this.get(sn(n,"data-tooltip-id"));i&&(e==="mouseover"&&i.timeout&&this.clearTimeout(i),e==="mouseout"&&i.timeout&&(i.timeout=1e3,this.setTimeout(i)))},xn.prototype.get=function(e){return typeof e!="string"&&(e=e.id),this._tooltips[e]},xn.prototype.clearTimeout=function(e){if(e=this.get(e),!!e){var t=e.removeTimer;t&&(clearTimeout(t),e.removeTimer=null)}},xn.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)}},xn.prototype.remove=function(e){var t=this.get(e);t&&(pi(t.html),pi(t.htmlContainer),delete t.htmlContainer,delete this._tooltips[t.id])},xn.prototype.show=function(){Tf(this._tooltipRoot)},xn.prototype.hide=function(){Tf(this._tooltipRoot,!1)},xn.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},xn.prototype._addTooltip=function(e){var t=e.id,n=e.html,i,r=this._tooltipRoot;n.get&&n.constructor.prototype.jquery&&(n=n.get(0)),wn(n)&&(n=lt(n)),i=lt('<div data-tooltip-id="'+t+'" class="'+jb+'">'),gn(i,{position:"absolute"}),i.appendChild(n),e.type&&mt(i).add("djs-tooltip-"+e.type),e.className&&mt(i).add(e.className),e.htmlContainer=i,r.appendChild(i),this._tooltips[t]=e,this._updateTooltip(e)},xn.prototype._updateTooltip=function(e){var t=e.position,n=e.htmlContainer;Uk(n,t.x,t.y)},xn.prototype._updateTooltipVisibilty=function(e){k(this._tooltips,function(t){var n=t.show,i=t.htmlContainer,r=!0;n&&((n.minZoom>e.scale||n.maxZoom<e.scale)&&(r=!1),Tf(i,r))})},xn.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 Yk={__init__:["tooltips"],tooltips:["type",xn]};var qk="flow elements must be children of pools/participants",Kk="Data object must be placed within a pool/participant.";function Fb(e,t,n){function i(r,o,a){t.add({position:{x:r.x+5,y:r.y+5},type:"error",timeout:2e3,html:"<div>"+o+"</div>"})}e.on(["shape.move.rejected","create.rejected"],function(r){var o=r.context,a=o.shape,s=o.target;v(s,"bpmn:Collaboration")&&(v(a,"bpmn:FlowNode")?i(r,n(qk)):v(a,"bpmn:DataObjectReference")&&i(r,n(Kk)))})}Fb.$inject=["eventBus","tooltips","translate"];const Xk={__depends__:[Yk],__init__:["modelingFeedback"],modelingFeedback:["type",Fb]};var Zk=500,Qk=1250,Jk=1500,gu=Math.round;function eD(e){return{x:e.x+gu(e.width/2),y:e.y+gu(e.height/2)}}function Hb(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",Jk,function(s){var c=s.context,u=s.shape,l=i.get().slice();l.indexOf(u)===-1&&(l=[u]),l=tD(l),L(c,{shapes:l,validatedShapes:l,shape:u})}),e.on("shape.move.start",Qk,function(s){var c=s.context,u=c.validatedShapes,l;if(l=c.canExecute=o(u),!l)return!1}),e.on("shape.move.move",Zk,function(s){var c=s.context,u=c.validatedShapes,l=s.hover,f={x:s.dx,y:s.dy},p={x:s.x,y:s.y},d;if(d=o(u,f,p,l),c.delta=f,c.canExecute=d,d===null){c.target=null;return}c.target=l}),e.on("shape.move.end",function(s){var c=s.context,u=c.delta,l=c.canExecute,f=l==="attach",p=c.shapes;if(l===!1)return!1;u.x=gu(u.x),u.y=gu(u.y),!(u.x===0&&u.y===0)&&n.moveElements(p,u,c.target,{primaryShape:c.shape,attach:f})}),e.on("element.mousedown",function(s){if(cr(s)){var c=xo(s);if(!c)throw new Error("must supply DOM mousedown event");return a(c,s.element)}});function a(s,c,u,l){if(Ut(u)&&(l=u,u=!1),!(c.waypoints||!c.parent)&&!je(s.target).has("djs-hit-no-move")){var f=eD(c),p=t.init(s,f,"shape.move",{cursor:"grabbing",autoActivate:u,data:{shape:c,context:l||{}}});if(p!==!1)return!0}}this.start=a}Hb.$inject=["eventBus","dragging","modeling","selection","rules"];function tD(e){var t=Jr(e,"id");return Ie(e,function(n){for(;n=n.parent;)if(t[n.id])return!1;return!0})}var zb=499,kf="djs-dragging",Vb="drop-ok",Gb="drop-not-ok",Wb="new-parent",Ub="attach-ok";function Yb(e,t,n,i){function r(c){var u=o(c),l=nD(u);return l}function o(c){var u=Xo(c),l=u.flatMap(d=>(d.incoming||[]).concat(d.outgoing||[])),f=u.concat(l),p=[...new Set(f)];return p}function a(c,u){[Ub,Vb,Gb,Wb].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,kf),c.allDraggedElements?c.allDraggedElements.push(u):c.allDraggedElements=[u]}e.on("shape.move.start",zb,function(c){var u=c.context,l=u.shapes,f=u.allDraggedElements,p=r(l);if(!u.dragGroup){var d=ye("g");se(d,n.cls("djs-drag-group",["no-events"]));var h=t.getActiveLayer();Ae(h,d),u.dragGroup=d}p.forEach(function(m){i.addDragger(m,u.dragGroup)}),f?f=Ru([f,o(l)]):f=o(l),k(f,function(m){t.addMarker(m,kf)}),u.allDraggedElements=f,u.differentParents=iD(l)}),e.on("shape.move.move",zb,function(c){var u=c.context,l=u.dragGroup,f=u.target,p=u.shape.parent,d=u.canExecute;f&&(d==="attach"?a(f,Ub):u.canExecute&&p&&f.id!==p.id?a(f,Wb):a(f,u.canExecute?Vb:Gb)),Jt(l,c.dx,c.dy)}),e.on(["shape.move.out","shape.move.cleanup"],function(c){var u=c.context,l=u.target;l&&a(l,null)}),e.on("shape.move.cleanup",function(c){var u=c.context,l=u.allDraggedElements,f=u.dragGroup;k(l,function(p){t.removeMarker(p,kf)}),f&&zt(f)}),this.makeDraggable=s}Yb.$inject=["eventBus","canvas","styles","previewSupport"];function nD(e){var t=new Set;e.forEach(function(i){t.add(i.id)});var n=Ie(e,function(i){return ot(i)?t.has(i.source.id)&&t.has(i.target.id):!0});return n}function iD(e){return r0(Jr(e,function(t){return t.parent&&t.parent.id}))!==1}const rD={__depends__:[sc,Kn,Af,yi,Ii,Co],__init__:["move","movePreview"],move:["type",Hb],movePreview:["type",Yb]};var qb=".djs-palette-toggle",Kb=".entry",oD=qb+", "+Kb,Df="djs-palette-",aD="shown",Of="open",Xb="two-column",sD=1e3;function Lt(e,t){this._eventBus=e,this._canvas=t;var n=this;e.on("tool-manager.update",function(i){var r=i.tool;n.updateToolHighlight(r)}),e.on("i18n.changed",function(){n._update()}),e.on("diagram.init",function(){n._diagramInitialized=!0,n._rebuild()})}Lt.$inject=["eventBus","canvas"],Lt.prototype.registerProvider=function(e,t){t||(t=e,e=sD),this._eventBus.on("palette.getProviders",e,function(n){n.providers.push(t)}),this._rebuild()},Lt.prototype.getEntries=function(){var e=this._getProviders();return e.reduce(uD,{})},Lt.prototype._rebuild=function(){if(this._diagramInitialized){var e=this._getProviders();e.length&&(this._container||this._init(),this._update())}},Lt.prototype._init=function(){var e=this,t=this._eventBus,n=this._getParentContainer(),i=this._container=lt(Lt.HTML_MARKUP);n.appendChild(i),mt(n).add(Df+aD),Cn.bind(i,oD,"click",function(r){var o=r.delegateTarget;if(Xu(o,qb))return e.toggle();e.trigger("click",r)}),Pe.bind(i,"mousedown",function(r){r.stopPropagation()}),Cn.bind(i,Kb,"dragstart",function(r){e.trigger("dragstart",r)}),t.on("canvas.resized",this._layoutChanged,this),t.fire("palette.create",{container:i})},Lt.prototype._getProviders=function(e){var t=this._eventBus.createEvent({type:"palette.getProviders",providers:[]});return this._eventBus.fire(t),t.providers},Lt.prototype._toggleState=function(e){e=e||{};var t=this._getParentContainer(),n=this._container,i=this._eventBus,r,o=mt(n),a=mt(t);"twoColumn"in e?r=e.twoColumn:r=this._needsCollapse(t.clientHeight,this._entries||{}),o.toggle(Xb,r),a.toggle(Df+Xb,r),"open"in e&&(o.toggle(Of,e.open),a.toggle(Df+Of,e.open)),i.fire("palette.changed",{twoColumn:r,open:this.isOpen()})},Lt.prototype._update=function(){var e=nt(".djs-palette-entries",this._container),t=this._entries=this.getEntries();ms(e),k(t,function(n,i){var r=n.group||"default",o=nt("[data-group="+ka(r)+"]",e);o||(o=lt('<div class="group"></div>'),sn(o,"data-group",r),e.appendChild(o));var a=n.html||(n.separator?'<hr class="separator" />':'<div class="entry" draggable="true"></div>'),s=lt(a);if(o.appendChild(s),!n.separator&&(sn(s,"data-action",i),n.title&&sn(s,"title",n.title),n.className&&cD(s,n.className),n.imageUrl)){var c=lt("<img>");sn(c,"src",n.imageUrl),s.appendChild(c)}}),this.open()},Lt.prototype.trigger=function(e,t,n){var i,r,o=t.delegateTarget||t.target;return o?(i=sn(o,"data-action"),r=t.originalEvent||t,this.triggerEntry(i,e,r,n)):t.preventDefault()},Lt.prototype.triggerEntry=function(e,t,n,i){var r=this._entries,o,a;if(o=r[e],!!o&&(a=o.action,this._eventBus.fire("palette.trigger",{entry:o,event:n})!==!1)){if(Yt(a)){if(t==="click")return a(n,i)}else if(a[t])return a[t](n,i);n.preventDefault()}},Lt.prototype._layoutChanged=function(){this._toggleState({})},Lt.prototype._needsCollapse=function(e,t){var n=50,i=Object.keys(t).length*46;return e<i+n},Lt.prototype.close=function(){this._toggleState({open:!1,twoColumn:!1})},Lt.prototype.open=function(){this._toggleState({open:!0})},Lt.prototype.toggle=function(){this.isOpen()?this.close():this.open()},Lt.prototype.isActiveTool=function(e){return e&&this._activeTool===e},Lt.prototype.updateToolHighlight=function(e){var t,n;this._toolsContainer||(t=nt(".djs-palette-entries",this._container),this._toolsContainer=nt("[data-group=tools]",t)),n=this._toolsContainer,k(n.children,function(i){var r=i.getAttribute("data-action");if(r){var o=mt(i);r=r.replace("-tool",""),o.contains("entry")&&r===e?o.add("highlighted-entry"):o.remove("highlighted-entry")}})},Lt.prototype.isOpen=function(){return mt(this._container).has(Of)},Lt.prototype._getParentContainer=function(){return this._canvas.getContainer()},Lt.HTML_MARKUP='<div class="djs-palette"><div class="djs-palette-entries"></div><div class="djs-palette-toggle"></div></div>';function cD(e,t){var n=mt(e),i=xe(t)?t:t.split(/\s+/g);i.forEach(function(r){n.add(r)})}function uD(e,t){var n=t.getPaletteEntries();return Yt(n)?n(e):(k(n,function(i,r){e[r]=i}),e)}const lD={__init__:["palette"],palette:["type",Lt]};var Zb="crosshair",Qb="selected",pD="djs-dragging-active-lasso";function wr(e,t,n,i,r,o,a){this._selection=r,this._dragging=n,this._mouse=a;var s=this,c={create:function(f){var p=t.getActiveLayer(),d=f.frame=ye("rect");se(d,{class:"djs-lasso-overlay",width:1,height:1,x:0,y:0}),Ae(p,d),u(!0),this.update(f)},update:function(f){var p=f.frame,d=f.bbox;p&&d&&se(p,{x:d.x,y:d.y,width:d.width,height:d.height});var h=f.marked,m=f.lastMarked;if(h&&m){for(const g of m)h.has(g)||t.removeMarker(g,Qb);for(const g of h)m.has(g)||t.addMarker(g,Qb)}},remove:function(f){this.update(f),f.frame&&zt(f.frame),u(!1)}};function u(f){je(t.getContainer()).toggle(pD,f)}function l(f){var p=i.getAll();return new Set(Qr(so(p,f)))}o.registerTool("lasso",{tool:"lasso.selection",dragging:"lasso"}),e.on("lasso.selection.end",function(f){var p=f.originalEvent.target;!f.hover&&!(p instanceof SVGElement)||e.once("lasso.selection.ended",function(){s.activateLasso(f.originalEvent,!0)})}),e.on("lasso.end",0,function(f){var p=f.context;s._select(Array.from(p.marked))}),e.on("lasso.start",function(f){var p=f.context;p.bbox=Jb(f),p.add=ec(f),p.lastMarked=new Set(r.get()),p.add?p.marked=p.lastMarked:p.marked=new Set,p.initialMarked=p.marked,c.create(p)}),e.on("lasso.move",function(f){var p=f.context,d=p.bbox=Jb(f),h=l(d),m=p.initialMarked.union(h);p.lastMarked=p.marked,p.marked=m,c.update(p)}),e.on("lasso.cleanup",function(f){var p=f.context;p.lastMarked=p.marked,p.marked=new Set(r.get()),c.remove(f.context)}),e.on("element.mousedown",1500,function(f){if(ec(f))return s.activateLasso(f.originalEvent),!0})}wr.$inject=["eventBus","canvas","dragging","elementRegistry","selection","toolManager","mouse"],wr.prototype.activateLasso=function(e,t){this._dragging.init(e,"lasso",{autoActivate:t,cursor:Zb,data:{context:{}},keepSelection:!0})},wr.prototype.activateSelection=function(e,t){this._dragging.init(e,"lasso.selection",{trapClick:!1,autoActivate:t,cursor:Zb,data:{context:{}},keepSelection:!0})},wr.prototype._select=function(e){this._selection.select(e)},wr.prototype.select=function(e,t,n=[]){var i=Qr(so(e,t));this._select([...n,...i])},wr.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateSelection(e,!!e)},wr.prototype.isActive=function(){var e=this._dragging.context();return e&&/^lasso/.test(e.prefix)};function Jb(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 fD={__depends__:[pc,ma],__init__:["lassoTool"],lassoTool:["type",wr]};var Lf=1500,ex="grab";function Bo(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",Lf,function(c){if(fa(c))return a.activateMove(c.originalEvent,!0),!1}),s&&s.addListener(Lf,function(c){if(!(!tx(c.keyEvent)||a.isActive())){var u=a._mouse.getLastMoveEvent();a.activateMove(u,!!u)}},"keyboard.keydown"),s&&s.addListener(Lf,function(c){!tx(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!fa(c)&&l&&e.once("hand.move.ended",function(f){a.activateHand(f.originalEvent,!0,!0)}),!1})}Bo.$inject=["eventBus","canvas","dragging","injector","toolManager","mouse"],Bo.prototype.activateMove=function(e,t,n){typeof t=="object"&&(n=t,t=!1),this._dragging.init(e,"hand.move",{autoActivate:t,cursor:ex,data:{context:n||{}}})},Bo.prototype.activateHand=function(e,t,n){this._dragging.init(e,"hand",{trapClick:!1,autoActivate:t,cursor:ex,data:{context:{reactivate:n}}})},Bo.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateHand(e,!!e)},Bo.prototype.isActive=function(){var e=this._dragging.context();return e?/^(hand|hand\.move)$/.test(e.prefix):!1};function tx(e){return Vt("Space",e)}const dD={__depends__:[pc,ma],__init__:["handTool"],handTool:["type",Bo]};var nx="connect-ok",ix="connect-not-ok";function $o(e,t,n,i,r,o,a){var s=this;this._dragging=t,this._rules=o,this._mouse=a,r.registerTool("global-connect",{tool:"global-connect",dragging:"global-connect.drag"}),e.on("global-connect.hover",function(c){var u=c.context,l=c.hover,f=u.canStartConnect=s.canStartConnect(l);f!==null&&(u.startTarget=l,i.addMarker(l,f?nx:ix))}),e.on(["global-connect.out","global-connect.cleanup"],function(c){var u=c.context.startTarget,l=c.context.canStartConnect;u&&i.removeMarker(u,l?nx:ix)}),e.on(["global-connect.ended"],function(c){var u=c.context,l=u.startTarget,f={x:c.x,y:c.y},p=s.canStartConnect(l);if(p)return e.once("element.out",function(){e.once(["connect.ended","connect.canceled"],function(){e.fire("global-connect.drag.ended")}),n.start(null,l,f)}),!1})}$o.$inject=["eventBus","dragging","connect","canvas","toolManager","rules","mouse"],$o.prototype.start=function(e,t){this._dragging.init(e,"global-connect",{autoActivate:t,trapClick:!1,data:{context:{}}})},$o.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();return this.start(e,!!e)},$o.prototype.isActive=function(){var e=this._dragging.context();return e&&/^global-connect/.test(e.prefix)},$o.prototype.canStartConnect=function(e){return this._rules.allowed("connection.start",{source:e})};const hD={__depends__:[Ef,yi,Ii,pc,ma],globalConnect:["type",$o]};function If(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)}If.$inject=["palette","create","elementFactory","spaceTool","lassoTool","handTool","globalConnect","translate"],If.prototype.getPaletteEntries=function(){var e={},t=this._create,n=this._elementFactory,i=this._spaceTool,r=this._lassoTool,o=this._handTool,a=this._globalConnect,s=this._translate;function c(f,p,d,h,m){function g(R){var w=n.createShape(L({type:f},m));t.start(R,w)}return{group:p,className:d,title:h,action:{dragstart:g,click:g}}}function u(f){var p=n.createShape({type:"bpmn:SubProcess",x:0,y:0,isExpanded:!0}),d=n.createShape({type:"bpmn:StartEvent",x:40,y:82,parent:p});t.start(f,[p,d],{hints:{autoSelect:[p]}})}function l(f){t.start(f,n.createParticipantShape())}return L(e,{"hand-tool":{group:"tools",className:"bpmn-icon-hand-tool",title:s("Activate hand tool"),action:{click:function(f){o.activateHand(f)}}},"lasso-tool":{group:"tools",className:"bpmn-icon-lasso-tool",title:s("Activate lasso tool"),action:{click:function(f){r.activateSelection(f)}}},"space-tool":{group:"tools",className:"bpmn-icon-space-tool",title:s("Activate create/remove space tool"),action:{click:function(f){i.activateSelection(f)}}},"global-connect-tool":{group:"tools",className:"bpmn-icon-connection-multi",title:s("Activate global connect tool"),action:{click:function(f){a.start(f)}}},"tool-separator":{group:"tools",separator:!0},"create.start-event":c("bpmn:StartEvent","event","bpmn-icon-start-event-none",s("Create start event")),"create.intermediate-event":c("bpmn:IntermediateThrowEvent","event","bpmn-icon-intermediate-event-none",s("Create intermediate/boundary event")),"create.end-event":c("bpmn:EndEvent","event","bpmn-icon-end-event-none",s("Create end event")),"create.exclusive-gateway":c("bpmn:ExclusiveGateway","gateway","bpmn-icon-gateway-none",s("Create gateway")),"create.task":c("bpmn:Task","activity","bpmn-icon-task",s("Create task")),"create.data-object":c("bpmn:DataObjectReference","data-object","bpmn-icon-data-object",s("Create data object reference")),"create.data-store":c("bpmn:DataStoreReference","data-store","bpmn-icon-data-store",s("Create data store reference")),"create.subprocess-expanded":{group:"activity",className:"bpmn-icon-subprocess-expanded",title:s("Create expanded sub-process"),action:{dragstart:u,click:u}},"create.participant-expanded":{group:"collaboration",className:"bpmn-icon-participant",title:s("Create pool/participant"),action:{dragstart:l,click:l}},"create.group":c("bpmn:Group","artifact","bpmn-icon-group",s("Create group"))}),e};const mD={__depends__:[lD,uc,ky,fD,dD,hD,oa],__init__:["paletteProvider"],paletteProvider:["type",If]};var gD=250;function Nf(e,t,n,i,r){X.call(this,e);function o(s){var c=s.canExecute.replacements;k(c,function(u){var l=u.oldElementId,f={type:u.newElementType};if(!s.visualReplacements[l]){var p=t.get(l);L(f,{x:p.x,y:p.y});var d=n.createShape(f);i.addShape(d,p.parent);var h=nt('[data-element-id="'+ka(p.id)+'"]',s.dragGroup);h&&se(h,{display:"none"});var m=r.addDragger(d,s.dragGroup);s.visualReplacements[l]=m,i.removeShape(d)}})}function a(s){var c=s.visualReplacements;k(c,function(u,l){var f=nt('[data-element-id="'+ka(l)+'"]',s.dragGroup);f&&se(f,{display:"inline"}),u.remove(),c[l]&&delete c[l]})}e.on("shape.move.move",gD,function(s){var c=s.context,u=c.canExecute;c.visualReplacements||(c.visualReplacements={}),u&&u.replacements?o(c):a(c)})}Nf.$inject=["eventBus","elementRegistry","elementFactory","canvas","previewSupport"],ae(Nf,X);const yD={__depends__:[Co],__init__:["bpmnReplacePreview"],bpmnReplacePreview:["type",Nf]};var vD=1250,Bf=40,_D=20,bD=10,rx=20,ox=["x","y"],xD=Math.abs;function ax(e){e.on(["connect.hover","connect.move","connect.end"],vD,function(t){var n=t.context,i=n.canExecute,r=n.start,o=n.hover,a=n.source,s=n.target;t.originalEvent&&Tn(t.originalEvent)||(n.initialConnectionStart||(n.initialConnectionStart=n.connectionStart),i&&o&&wD(t,o,CD(o)),o&&RD(i,["bpmn:Association","bpmn:DataInputAssociation","bpmn:DataOutputAssociation","bpmn:SequenceFlow"])?(n.connectionStart=Qn(r),Le(o,["bpmn:Event","bpmn:Gateway"])&&sx(t,Qn(o)),Le(o,["bpmn:Task","bpmn:SubProcess"])&&ED(t,o),v(a,"bpmn:BoundaryEvent")&&s===a.host&&SD(t)):cx(i,"bpmn:MessageFlow")?(v(r,"bpmn:Event")&&(n.connectionStart=Qn(r)),v(o,"bpmn:Event")&&sx(t,Qn(o))):n.connectionStart=n.initialConnectionStart)})}ax.$inject=["eventBus"];function wD(e,t,n){ox.forEach(function(i){var r=ux(i,t);e[i]<t[i]+n?Ot(e,i,t[i]+n):e[i]>t[i]+r-n&&Ot(e,i,t[i]+r-n)})}function ED(e,t){var n=Qn(t);ox.forEach(function(i){PD(e,t,i)&&Ot(e,i,n[i])})}function SD(e){var t=e.context,n=t.source,i=t.target;if(!AD(t)){var r=Qn(n),o=Qt(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;xD(c-r[s])<Bf&&(c>r[s]?u=r[s]+Bf:u=r[s]-Bf,Ot(e,s,u))})}}function sx(e,t){Ot(e,"x",t.x),Ot(e,"y",t.y)}function cx(e,t){return e&&e.type===t}function RD(e,t){return Wi(t,function(n){return cx(e,n)})}function ux(e,t){return e==="x"?t.width:t.height}function CD(e){return v(e,"bpmn:Task")?bD:_D}function PD(e,t,n){return e[n]>t[n]+rx&&e[n]<t[n]+ux(n,t)-rx}function AD(e){var t=e.hover,n=e.source;return t&&n&&t===n}function Er(){this._targets={},this._snapOrigins={},this._snapLocations=[],this._defaultSnaps={}}Er.prototype.getSnapOrigin=function(e){return this._snapOrigins[e]},Er.prototype.setSnapOrigin=function(e,t){this._snapOrigins[e]=t,this._snapLocations.indexOf(e)===-1&&this._snapLocations.push(e)},Er.prototype.addDefaultSnap=function(e,t){var n=this._defaultSnaps[e];n||(n=this._defaultSnaps[e]=[]),n.push(t)},Er.prototype.getSnapLocations=function(){return this._snapLocations},Er.prototype.setSnapLocations=function(e){this._snapLocations=e},Er.prototype.pointsForTarget=function(e){var t=e.id||e,n=this._targets[t];return n||(n=this._targets[t]=new yu,n.initDefaults(this._defaultSnaps)),n};function yu(){this._snapValues={}}yu.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)},yu.prototype.snap=function(e,t,n,i){var r=this._snapValues[t];return r&&g2(e[n],r[n],i)},yu.prototype.initDefaults=function(e){var t=this;k(e||{},function(n,i){k(n,function(r){t.add(i,r)})})};var TD=1250;function xi(e,t,n){var i=this;this._elementRegistry=e,t.on(["create.start","shape.move.start"],function(r){i.initSnap(r)}),t.on(["create.move","create.end","shape.move.move","shape.move.end"],TD,function(r){var o=r.context,a=o.shape,s=o.snapContext,c=o.target;if(!(r.originalEvent&&Tn(r.originalEvent))&&!(No(r)||!c)){var u=s.pointsForTarget(c);u.initialized||(u=i.addSnapTargetPoints(u,a,c),u.initialized=!0),n.snap(r,u)}}),t.on(["create.cleanup","shape.move.cleanup"],function(){n.hide()})}xi.$inject=["elementRegistry","eventBus","snapping"],xi.prototype.initSnap=function(e){var t=this._elementRegistry,n=e.context,i=n.shape,r=n.snapContext;r||(r=n.snapContext=new Er);var o;t.get(i.id)?o=Qn(i,e):o={x:e.x+Qn(i).x,y:e.y+Qn(i).y};var a={x:o.x-i.width/2,y:o.y-i.height/2},s={x:o.x+i.width/2,y:o.y+i.height/2};return r.setSnapOrigin("mid",{x:o.x-e.x,y:o.y-e.y}),De(i)||(r.setSnapOrigin("top-left",{x:a.x-e.x,y:a.y-e.y}),r.setSnapOrigin("bottom-right",{x:s.x-e.x,y:s.y-e.y})),r},xi.prototype.addSnapTargetPoints=function(e,t,n){var i=this.getSnapTargets(t,n);return k(i,function(r){if(De(r)){De(t)&&e.add("mid",Qn(r));return}if(ot(r)){if(r.waypoints.length<3)return;var o=r.waypoints.slice(1,-1);k(o,function(a){e.add("mid",a)});return}e.add("mid",Qn(r))}),!Ce(t.x)||!Ce(t.y)||this._elementRegistry.get(t.id)&&e.add("mid",Qn(t)),e},xi.prototype.getSnapTargets=function(e,t){return K_(t).filter(function(n){return!MD(n)})};function MD(e){return!!e.hidden}var lx=1500;function jo(e,t){t.invoke(xi,this),e.on(["create.move","create.end"],lx,LD),e.on(["create.move","create.end","shape.move.move","shape.move.end"],lx,function(n){var i=n.context,r=i.canExecute,o=i.target,a=r&&(r==="attach"||r.attach);a&&!No(n)&&kD(n,o)})}ae(jo,xi),jo.$inject=["eventBus","injector"],jo.prototype.initSnap=function(e){var t=xi.prototype.initSnap.call(this,e),n=e.shape,i=!!this._elementRegistry.get(n.id);return k(n.outgoing,function(r){var o=r.waypoints[0];o=o.original||o,t.setSnapOrigin(r.id+"-docking",fx(o,i,e))}),k(n.incoming,function(r){var o=r.waypoints[r.waypoints.length-1];o=o.original||o,t.setSnapOrigin(r.id+"-docking",fx(o,i,e))}),v(n,"bpmn:Participant")&&t.setSnapLocations(["top-left","bottom-right","mid"]),t},jo.prototype.addSnapTargetPoints=function(e,t,n){xi.prototype.addSnapTargetPoints.call(this,e,t,n);var i=this.getSnapTargets(t,n);k(i,function(o){(OD(o)||DD([t,o],"bpmn:TextAnnotation"))&&(e.add("top-left",Y_(o)),e.add("bottom-right",q_(o)))});var r=this._elementRegistry;return k(t.incoming,function(o){if(r.get(t.id)){px(i,o.source)||e.add("mid",we(o.source));var a=o.waypoints[0];e.add(o.id+"-docking",a.original||a)}}),k(t.outgoing,function(o){if(r.get(t.id)){px(i,o.target)||e.add("mid",we(o.target));var a=o.waypoints[o.waypoints.length-1];e.add(o.id+"-docking",a.original||a)}}),v(n,"bpmn:SequenceFlow")&&(e=this.addSnapTargetPoints(e,t,n.parent)),e},jo.prototype.getSnapTargets=function(e,t){return xi.prototype.getSnapTargets.call(this,e,t).filter(function(n){return!v(n,"bpmn:Lane")})};function kD(e,t){var n=ve(t),i=Pg(e,t),r=e.context,o=r.shape,a;o.parent?a={x:0,y:0}:a=we(o),/top/.test(i)?Ot(e,"y",n.top-a.y):/bottom/.test(i)&&Ot(e,"y",n.bottom-a.y),/left/.test(i)?Ot(e,"x",n.left-a.x):/right/.test(i)&&Ot(e,"x",n.right-a.x)}function DD(e,t){return e.every(function(n){return v(n,t)})}function OD(e){return v(e,"bpmn:SubProcess")&&$e(e)?!0:v(e,"bpmn:Participant")}function LD(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)&&Ot(e,"x",e.x),(i&&i>=e.y||o&&o<=e.y)&&Ot(e,"y",e.y)}}function px(e,t){return e.indexOf(t)!==-1}function fx(e,t,n){return t?{x:e.x-n.x,y:e.y-n.y}:{x:e.x,y:e.y}}var ID=1250;function Ya(e,t){var n=this;e.on(["resize.start"],function(i){n.initSnap(i)}),e.on(["resize.move","resize.end"],ID,function(i){var r=i.context,o=r.shape,a=o.parent,s=r.direction,c=r.snapContext;if(!(i.originalEvent&&Tn(i.originalEvent))&&!No(i)){var u=c.pointsForTarget(a);u.initialized||(u=n.addSnapTargetPoints(u,o,a,s),u.initialized=!0),$D(s)&&Ot(i,"x",i.x),jD(s)&&Ot(i,"y",i.y),t.snap(i,u)}}),e.on(["resize.cleanup"],function(){t.hide()})}Ya.prototype.initSnap=function(e){var t=e.context,n=t.shape,i=t.direction,r=t.snapContext;r||(r=t.snapContext=new Er);var o=dx(n,i);return r.setSnapOrigin("corner",{x:o.x-e.x,y:o.y-e.y}),r},Ya.prototype.addSnapTargetPoints=function(e,t,n,i){var r=this.getSnapTargets(t,n);return k(r,function(o){e.add("corner",q_(o)),e.add("corner",Y_(o))}),e.add("corner",dx(t,i)),e},Ya.$inject=["eventBus","snapping"],Ya.prototype.getSnapTargets=function(e,t){return K_(t).filter(function(n){return!ND(n,e)&&!ot(n)&&!BD(n)&&!De(n)})};function dx(e,t){var n=we(e),i=ve(e),r={x:n.x,y:n.y};return t.indexOf("n")!==-1?r.y=i.top:t.indexOf("s")!==-1&&(r.y=i.bottom),t.indexOf("e")!==-1?r.x=i.right:t.indexOf("w")!==-1&&(r.x=i.left),r}function ND(e,t){return e.host===t}function BD(e){return!!e.hidden}function $D(e){return e==="n"||e==="s"}function jD(e){return e==="e"||e==="w"}var FD=7,HD=1e3;function Sr(e){this._canvas=e,this._asyncHide=Pu(_n(this.hide,this),HD)}Sr.$inject=["canvas"],Sr.prototype.snap=function(e,t){var n=e.context,i=n.snapContext,r=i.getSnapLocations(),o={x:No(e,"x"),y:No(e,"y")};k(r,function(a){var s=i.getSnapOrigin(a),c={x:e.x+s.x,y:e.y+s.y};if(k(["x","y"],function(u){var l;o[u]||(l=t.snap(c,a,u,FD),l!==void 0&&(o[u]={value:l,originValue:l-s[u]}))}),o.x&&o.y)return!1}),this.showSnapLine("vertical",o.x&&o.x.value),this.showSnapLine("horizontal",o.y&&o.y.value),k(["x","y"],function(a){var s=o[a];Ut(s)&&Ot(e,a,s.originValue)})},Sr.prototype._createLine=function(e){var t=this._canvas.getLayer("snap"),n=ye("path");return se(n,{d:"M0,0 L0,0"}),je(n).add("djs-snap-line"),Ae(t,n),{update:function(i){Ce(i)?e==="horizontal"?se(n,{d:"M-100000,"+i+" L+100000,"+i,display:""}):se(n,{d:"M "+i+",-100000 L "+i+", +100000",display:""}):se(n,{display:"none"})}}},Sr.prototype._createSnapLines=function(){this._snapLines={horizontal:this._createLine("horizontal"),vertical:this._createLine("vertical")}},Sr.prototype.showSnapLine=function(e,t){var n=this.getSnapLine(e);n&&n.update(t),this._asyncHide()},Sr.prototype.getSnapLine=function(e){return this._snapLines||this._createSnapLines(),this._snapLines[e]},Sr.prototype.hide=function(){k(this._snapLines,function(e){e.update()})};const zD={__depends__:[{__init__:["createMoveSnapping","resizeSnapping","snapping"],createMoveSnapping:["type",xi],resizeSnapping:["type",Ya],snapping:["type",Sr]}],__init__:["connectSnapping","createMoveSnapping"],connectSnapping:["type",ax],createMoveSnapping:["type",jo]};var hx=300;function Te(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=nt(Te.INPUT_SELECTOR,this._container),this._resultsContainer=nt(Te.RESULTS_CONTAINER_SELECTOR,this._container),this._canvas.getContainer().appendChild(this._container),t.on(["canvas.destroy","diagram.destroy","drag.init","elements.changed"],this.close,this)}Te.$inject=["canvas","eventBus","selection","translate"],Te.prototype._bindEvents=function(){var e=this;function t(n,i,r,o){e._eventMaps.push({el:n,type:r,listener:Cn.bind(n,i,r,o)})}t(document,"html","click",function(n){e.close(!1)}),t(this._container,Te.INPUT_SELECTOR,"click",function(n){n.stopPropagation(),n.delegateTarget.focus()}),t(this._container,Te.RESULT_SELECTOR,"mouseover",function(n){n.stopPropagation(),e._scrollToNode(n.delegateTarget),e._preselect(n.delegateTarget)}),t(this._container,Te.RESULT_SELECTOR,"click",function(n){n.stopPropagation(),e._select(n.delegateTarget)}),t(this._container,Te.INPUT_SELECTOR,"keydown",function(n){Vt("ArrowUp",n)&&n.preventDefault(),Vt("ArrowDown",n)&&n.preventDefault()}),t(this._container,Te.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)})},Te.prototype._unbindEvents=function(){this._eventMaps.forEach(function(e){Cn.unbind(e.el,e.type,e.listener)})},Te.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=nt(Te.RESULT_SELECTOR,this._resultsContainer);this._scrollToNode(i),this._preselect(i)}},Te.prototype._scrollToDirection=function(e){var t=this._getCurrentResult();if(t){var n=e?t.previousElementSibling:t.nextElementSibling;n&&(this._scrollToNode(n),this._preselect(n))}},Te.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)}},Te.prototype._clearResults=function(){ms(this._resultsContainer),this._results={},this._eventBus.fire("searchPad.cleared")},Te.prototype._getCurrentResult=function(){return nt(Te.RESULT_SELECTED_SELECTOR,this._resultsContainer)},Te.prototype._createResultNode=function(e,t){var n=lt(Te.RESULT_HTML);return e.primaryTokens.length>0&&mx(n,e.primaryTokens,Te.RESULT_PRIMARY_HTML),mx(n,e.secondaryTokens,Te.RESULT_SECONDARY_HTML),sn(n,Te.RESULT_ID_ATTRIBUTE,t),this._resultsContainer.appendChild(n),n},Te.prototype.registerProvider=function(e){this._searchProvider=e},Te.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,mt(this._canvas.getContainer()).add("djs-search-open"),mt(this._container).add("open"),this._searchInput.focus(),this._eventBus.fire("searchPad.opened"))},Te.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,mt(this._canvas.getContainer()).remove("djs-search-open"),mt(this._container).remove("open"),this._clearResults(),this._searchInput.value="",this._searchInput.blur(),this._eventBus.fire("searchPad.closed"),this._canvas.restoreFocus())},Te.prototype.toggle=function(){this.isOpen()?this.close():this.open()},Te.prototype.isOpen=function(){return this._open},Te.prototype._preselect=function(e){var t=this._getCurrentResult();if(e!==t){t&&mt(t).remove(Te.RESULT_SELECTED_CLASS);var n=sn(e,Te.RESULT_ID_ATTRIBUTE),i=this._results[n].element;mt(e).add(Te.RESULT_SELECTED_CLASS),this._canvas.scrollToElement(i,{top:hx}),this._selection.select(i),this._eventBus.fire("searchPad.preselected",i)}},Te.prototype._select=function(e){var t=sn(e,Te.RESULT_ID_ATTRIBUTE),n=this._results[t].element;this._cachedSelection=null,this._cachedViewbox=null,this.close(!1),this._canvas.scrollToElement(n,{top:hx}),this._selection.select(n),this._eventBus.fire("searchPad.selected",n)},Te.prototype._getBoxHtml=function(){const e=lt(Te.BOX_HTML),t=nt(Te.INPUT_SELECTOR,e);return t&&t.setAttribute("aria-label",this._translate("Search in diagram")),e};function mx(e,t,n){var i=VD(t),r=lt(n);r.innerHTML=i,e.appendChild(r)}function VD(e){var t="";return e.forEach(function(n){var i=Ev(n.value||n.matched||n.normal),r=n.match||n.matched;r?t+='<b class="'+Te.RESULT_HIGHLIGHT_CLASS+'">'+i+"</b>":t+=i}),t!==""?t:null}Te.CONTAINER_SELECTOR=".djs-search-container",Te.INPUT_SELECTOR=".djs-search-input input",Te.RESULTS_CONTAINER_SELECTOR=".djs-search-results",Te.RESULT_SELECTOR=".djs-search-result",Te.RESULT_SELECTED_CLASS="djs-search-result-selected",Te.RESULT_SELECTED_SELECTOR="."+Te.RESULT_SELECTED_CLASS,Te.RESULT_ID_ATTRIBUTE="data-result-id",Te.RESULT_HIGHLIGHT_CLASS="djs-search-highlight",Te.BOX_HTML=`<div class="djs-search-container djs-scrollable">
335
+ </svg>`},rk=900;function Wa(e,t,n,i){this._distributeElements=t,this._translate=n,this._popupMenu=e,this._rules=i,e.registerProvider("align-elements",rk,this)}Wa.$inject=["popupMenu","distributeElements","translate","rules"],Wa.prototype.getPopupMenuEntries=function(e){var t={};return this._isAllowed(e)&&I(t,this._getEntries(e)),t},Wa.prototype._isAllowed=function(e){return this._rules.allowed("elements.distribute",{elements:e})},Wa.prototype._getEntries=function(e){var t=this._distributeElements,n=this._translate,i=this._popupMenu,r={"distribute-elements-horizontal":{group:"distribute",title:n("Distribute elements horizontally"),className:"bjs-align-elements-menu-entry",imageHtml:hb.horizontal,action:function(o,a){t.trigger(e,"horizontal"),i.close()}},"distribute-elements-vertical":{group:"distribute",title:n("Distribute elements vertically"),imageHtml:hb.vertical,action:function(o,a){t.trigger(e,"vertical"),i.close()}}};return r};const ok={__depends__:[mf,ik],__init__:["bpmnDistributeElements","distributeElementsMenuProvider"],bpmnDistributeElements:["type",cu],distributeElementsMenuProvider:["type",Wa]};var mb="is not a registered action",ak="is already registered";function Qn(e,t){this._eventBus=e,this._actions={};var n=this;e.on("diagram.init",function(){n._registerDefaultActions(t),e.fire("editorActions.init",{editorActions:n})})}Qn.$inject=["eventBus","injector"],Qn.prototype._registerDefaultActions=function(e){var t=e.get("commandStack",!1),n=e.get("modeling",!1),i=e.get("selection",!1),r=e.get("zoomScroll",!1),o=e.get("copyPaste",!1),a=e.get("canvas",!1),s=e.get("rules",!1),c=e.get("keyboardMove",!1),u=e.get("keyboardMoveSelection",!1);t&&(this.register("undo",function(){t.undo()}),this.register("redo",function(){t.redo()})),o&&i&&this.register("copy",function(){var l=i.get();if(l.length)return o.copy(l)}),o&&i&&this.register("duplicate",function(){var l=i.get();if(l.length)return o.duplicate(l)}),o&&this.register("paste",function(){o.paste()}),o&&i&&s&&this.register("cut",function(){var l=i.get();if(l.length){var f=s.allowed("elements.delete",{elements:l});if(f!==!1){var p=we(f)?f:l;return o.cut(p.slice())}}}),r&&this.register("stepZoom",function(l){r.stepZoom(l.value)}),a&&this.register("zoom",function(l){a.zoom(l.value)}),n&&i&&s&&this.register("removeSelection",function(){var l=i.get();if(l.length){var f=s.allowed("elements.delete",{elements:l}),p;f!==!1&&(we(f)?p=f:p=l,p.length&&n.removeElements(p.slice()))}}),c&&this.register("moveCanvas",function(l){c.moveCanvas(l)}),u&&this.register("moveSelection",function(l){u.moveSelection(l.direction,l.accelerated)})},Qn.prototype.trigger=function(e,t){if(!this._actions[e])throw Rf(e,mb);var n=this._eventBus.fire("editorActions.allowed",{action:e,opts:t});if(n!==!1)return this._actions[e](t)},Qn.prototype.register=function(e,t){var n=this;if(typeof e=="string")return this._registerAction(e,t);k(e,function(i,r){n._registerAction(r,i)})},Qn.prototype._registerAction=function(e,t){if(this.isRegistered(e))throw Rf(e,ak);this._actions[e]=t},Qn.prototype.unregister=function(e){if(!this.isRegistered(e))throw Rf(e,mb);this._actions[e]=void 0},Qn.prototype.getActions=function(){return Object.keys(this._actions)},Qn.prototype.isRegistered=function(e){return!!this._actions[e]};function Rf(e,t){return new Error(e+" "+t)}const sk={__init__:["editorActions"],editorActions:["type",Qn]};function uu(e){e.invoke(Qn,this)}ae(uu,Qn),uu.$inject=["injector"],uu.prototype._registerDefaultActions=function(e){Qn.prototype._registerDefaultActions.call(this,e);var t=e.get("canvas",!1),n=e.get("elementRegistry",!1),i=e.get("selection",!1),r=e.get("spaceTool",!1),o=e.get("lassoTool",!1),a=e.get("handTool",!1),s=e.get("globalConnect",!1),c=e.get("distributeElements",!1),u=e.get("alignElements",!1),l=e.get("directEditing",!1),f=e.get("searchPad",!1),p=e.get("modeling",!1),d=e.get("contextPad",!1);t&&n&&i&&this._registerAction("selectElements",function(){var h=t.getRootElement(),m=n.filter(function(g){return g!==h});return i.select(m),m}),r&&this._registerAction("spaceTool",function(){r.toggle()}),o&&this._registerAction("lassoTool",function(){o.toggle()}),a&&this._registerAction("handTool",function(){a.toggle()}),s&&this._registerAction("globalConnectTool",function(){s.toggle()}),i&&c&&this._registerAction("distributeElements",function(h){var m=i.get(),g=h.type;m.length&&c.trigger(m,g)}),i&&u&&this._registerAction("alignElements",function(h){var m=i.get(),g=[],R=h.type;m.length&&(g=Be(m,function(E){return!v(E,"bpmn:Lane")}),u.trigger(g,R))}),i&&p&&this._registerAction("setColor",function(h){var m=i.get();m.length&&p.setColor(m,h)}),i&&l&&this._registerAction("directEditing",function(){var h=i.get();h.length&&l.activate(h[0])}),f&&this._registerAction("find",function(){f.toggle()}),t&&p&&this._registerAction("moveToOrigin",function(){var h=t.getRootElement(),m,g;v(h,"bpmn:Collaboration")?g=n.filter(function(R){return v(R.parent,"bpmn:Collaboration")}):g=n.filter(function(R){return R!==h&&!v(R.parent,"bpmn:SubProcess")}),m=Mt(g),p.moveElements(g,{x:-m.x,y:-m.y},h)}),i&&d&&this._registerAction("replaceElement",function(h){d.triggerEntry("replace","click",h)})};const ck={__depends__:[sk],editorActions:["type",uu]};function gb(e){e.on(["create.init","shape.move.init"],function(t){var n=t.context,i=t.shape;Ie(i,["bpmn:Participant","bpmn:SubProcess","bpmn:TextAnnotation"])&&(n.gridSnappingContext||(n.gridSnappingContext={}),n.gridSnappingContext.snapLocation="top-left")})}gb.$inject=["eventBus"];function qr(e,t){X.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;Sn(a)?r.newBounds=n.snapComplex(c,a):r.newBounds=n.snapSimple(s,c)}})}qr.$inject=["eventBus","gridSnapping","modeling"],ae(qr,X),qr.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},qr.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},qr.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),I(e,o),e},qr.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),I(e,o),e};var uk=2e3;function yb(e,t){e.on(["spaceTool.move","spaceTool.end"],uk,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)}})}yb.$inject=["eventBus","gridSnapping"];const lk={__init__:["gridSnappingResizeBehavior","gridSnappingSpaceToolBehavior"],gridSnappingResizeBehavior:["type",qr],gridSnappingSpaceToolBehavior:["type",yb]};var lu=10;function Cf(e,t,n){return n||(n="round"),Math[n](e/t)*t}var pk=1200,fk=800;function _r(e,t,n){var i=!n||n.active!==!1;this._eventBus=t;var r=this;t.on("diagram.init",fk,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"],pk,function(o){var a=o.originalEvent;if(!(!r.active||a&&kn(a))){var s=o.context,c=s.gridSnappingContext;c||(c=s.gridSnappingContext={}),["x","y"].forEach(function(u){var l={},f=hk(o,u,e);f&&(l.offset=f);var p=dk(o,u);p&&I(l,p),$o(o,u)||r.snapEvent(o,u,l)})}})}_r.prototype.snapEvent=function(e,t,n){var i=this.snapValue(e[t],n);Lt(e,t,i)},_r.prototype.getGridSpacing=function(){return lu},_r.prototype.snapValue=function(e,t){var n=0;t&&t.offset&&(n=t.offset),e+=n,e=Cf(e,lu);var i,r;return t&&t.min&&(i=t.min,Pe(i)&&(i=Cf(i+n,lu,"ceil"),e=Math.max(e,i))),t&&t.max&&(r=t.max,Pe(r)&&(r=Cf(r+n,lu,"floor"),e=Math.min(e,r))),e-=n,e},_r.prototype.isActive=function(){return this.active},_r.prototype.setActive=function(e){this.active=e,this._eventBus.fire("gridSnapping.toggle",{active:e})},_r.prototype.toggleActive=function(){this.setActive(!this.active)},_r.$inject=["elementRegistry","eventBus","config.gridSnapping"];function dk(e,t){var n=e.context,i=n.createConstraints,r=n.resizeConstraints||{},o=n.gridSnappingContext,a=o.snapConstraints;if(a&&a[t])return a[t];a||(a=o.snapConstraints={}),a[t]||(a[t]={});var s=n.direction;i&&(pu(t)?(a.x.min=i.left,a.x.max=i.right):(a.y.min=i.top,a.y.max=i.bottom));var c=r.min,u=r.max;return c&&(pu(t)?_b(s)?a.x.max=c.left:a.x.min=c.right:vb(s)?a.y.max=c.top:a.y.min=c.bottom),u&&(pu(t)?_b(s)?a.x.min=u.left:a.x.max=u.right:vb(s)?a.y.min=u.top:a.y.max=u.bottom),a[t]}function hk(e,t,n){var i=e.context,r=e.shape,o=i.gridSnappingContext,a=o.snapLocation,s=o.snapOffset;return s&&Pe(s[t])||(s||(s=o.snapOffset={}),Pe(s[t])||(s[t]=0),!r)||(n.get(r.id)||(pu(t)?s[t]+=r[t]+r.width/2:s[t]+=r[t]+r.height/2),!a)||(t==="x"?/left/.test(a)?s[t]-=r.width/2:/right/.test(a)&&(s[t]+=r.width/2):/top/.test(a)?s[t]-=r.height/2:/bottom/.test(a)&&(s[t]+=r.height/2)),s[t]}function pu(e){return e==="x"}function vb(e){return e.indexOf("n")!==-1}function _b(e){return e.indexOf("w")!==-1}const mk={__depends__:[lk],__init__:["gridSnapping"],gridSnapping:["type",_r]};var gk=2e3;function bb(e,t,n){e.on("autoPlace",gk,function(i){var r=i.source,o=Ee(r),a=i.shape,s=_v(r,a,n);return["x","y"].forEach(function(c){var u={};s[c]!==o[c]&&(s[c]>o[c]?u.min=s[c]:u.max=s[c],v(a,"bpmn:TextAnnotation")&&(yk(c)?u.offset=-a.width/2:u.offset=-a.height/2),s[c]=t.snapValue(s[c],u))}),s})}bb.$inject=["eventBus","gridSnapping","elementRegistry"];function yk(e){return e==="x"}var vk=1750;function xb(e,t,n){t.on(["create.start","shape.move.start"],vk,function(i){var r=i.context,o=r.shape,a=e.getRootElement();if(!(!v(o,"bpmn:Participant")||!v(a,"bpmn:Process")||!a.children.length)){var s=r.createConstraints;s&&(o.width=n.snapValue(o.width,{min:o.width}),o.height=n.snapValue(o.height,{min:o.height}))}})}xb.$inject=["canvas","eventBus","gridSnapping"];var _k=3e3;function fu(e,t,n){X.call(this,e),this._gridSnapping=t;var i=this;this.postExecuted(["connection.create","connection.layout"],_k,function(r){var o=r.context,a=o.connection,s=o.hints||{},c=a.waypoints;s.connectionStart||s.connectionEnd||s.createElementsBehavior===!1||bk(c)&&n.updateWaypoints(a,i.snapMiddleSegments(c))})}fu.$inject=["eventBus","gridSnapping","modeling"],ae(fu,X),fu.prototype.snapMiddleSegments=function(e){var t=this._gridSnapping,n;e=e.slice();for(var i=1;i<e.length-2;i++)n=Ek(t,e[i],e[i+1]),e[i]=n[0],e[i+1]=n[1];return e};function bk(e){return e.length>3}function xk(e){return e==="h"}function wk(e){return e==="v"}function Ek(e,t,n){var i=Mi(t,n),r={};return xk(i)&&(r.y=e.snapValue(t.y)),wk(i)&&(r.x=e.snapValue(t.x)),("x"in r||"y"in r)&&(t=I({},t,r),n=I({},n,r)),[t,n]}const Sk={__depends__:[mk,{__init__:["gridSnappingAutoPlaceBehavior","gridSnappingParticipantBehavior","gridSnappingLayoutConnectionBehavior"],gridSnappingAutoPlaceBehavior:["type",bb],gridSnappingParticipantBehavior:["type",xb],gridSnappingLayoutConnectionBehavior:["type",fu]}],__init__:["bpmnGridSnapping"],bpmnGridSnapping:["type",gb]};var Rk=30,wb=30;function Ua(e,t){this._interactionEvents=t;var n=this;e.on(["interactionEvents.createHit","interactionEvents.updateHit"],function(i){var r=i.element,o=i.gfx;if(v(r,"bpmn:Lane"))return n._createParticipantHit(r,o);if(v(r,"bpmn:Participant"))return He(r)?n._createParticipantHit(r,o):n._createDefaultHit(r,o);if(v(r,"bpmn:SubProcess"))return He(r)?n._createSubProcessHit(r,o):n._createDefaultHit(r,o)})}Ua.$inject=["eventBus","interactionEvents"],Ua.prototype._createDefaultHit=function(e,t){return this._interactionEvents.removeHits(t),this._interactionEvents.createDefaultHit(e,t),!0},Ua.prototype._createParticipantHit=function(e,t){this._interactionEvents.removeHits(t),this._interactionEvents.createBoxHit(t,"no-move",{width:e.width,height:e.height}),this._interactionEvents.createBoxHit(t,"click-stroke",{width:e.width,height:e.height});var n=qt(e)?{width:Rk,height:e.height}:{width:e.width,height:wb};return this._interactionEvents.createBoxHit(t,"all",n),!0},Ua.prototype._createSubProcessHit=function(e,t){return this._interactionEvents.removeHits(t),this._interactionEvents.createBoxHit(t,"no-move",{width:e.width,height:e.height}),this._interactionEvents.createBoxHit(t,"click-stroke",{width:e.width,height:e.height}),this._interactionEvents.createBoxHit(t,"all",{width:e.width,height:wb}),!0};const Ck={__init__:["bpmnInteractionEvents"],bpmnInteractionEvents:["type",Ua]};function du(e){e.invoke(ko,this)}ae(du,ko),du.$inject=["injector"],du.prototype.registerBindings=function(e,t){ko.prototype.registerBindings.call(this,e,t);function n(i,r){t.isRegistered(i)&&e.addListener(r)}n("selectElements",function(i){var r=i.keyEvent;if(e.isKey(["a","A"],r)&&e.isCmd(r))return t.trigger("selectElements"),!0}),n("find",function(i){var r=i.keyEvent;if(e.isKey(["f","F"],r)&&e.isCmd(r))return t.trigger("find"),!0}),n("spaceTool",function(i){var r=i.keyEvent;if(!e.hasModifier(r)&&e.isKey(["s","S"],r))return t.trigger("spaceTool"),!0}),n("lassoTool",function(i){var r=i.keyEvent;if(!e.hasModifier(r)&&e.isKey(["l","L"],r))return t.trigger("lassoTool"),!0}),n("handTool",function(i){var r=i.keyEvent;if(!e.hasModifier(r)&&e.isKey(["h","H"],r))return t.trigger("handTool"),!0}),n("globalConnectTool",function(i){var r=i.keyEvent;if(!e.hasModifier(r)&&e.isKey(["c","C"],r))return t.trigger("globalConnectTool"),!0}),n("directEditing",function(i){var r=i.keyEvent;if(!e.hasModifier(r)&&e.isKey(["e","E"],r))return t.trigger("directEditing"),!0}),n("replaceElement",function(i){var r=i.keyEvent;if(!e.hasModifier(r)&&e.isKey(["r","R"],r))return t.trigger("replaceElement",r),!0})};const Pk={__depends__:[Jp],__init__:["keyboardBindings"],keyboardBindings:["type",du]};var Ak={moveSpeed:1,moveSpeedAccelerated:10},Tk=1500,Eb="left",Sb="up",Rb="right",Cb="down",Mk={ArrowLeft:Eb,Left:Eb,ArrowUp:Sb,Up:Sb,ArrowRight:Rb,Right:Rb,ArrowDown:Cb,Down:Cb},kk={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 Pb(e,t,n,i,r){var o=this;this._config=I({},Ak,e||{}),t.addListener(Tk,function(a){var s=a.keyEvent,c=Mk[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=kk[a](u),f=i.allowed("elements.move",{shapes:c,hints:{keyboardMove:!0}});f&&n.moveElements(c,l)}}}Pb.$inject=["config.keyboardMoveSelection","keyboard","modeling","rules","selection"];const Ok={__depends__:[Jp,Yn],__init__:["keyboardMoveSelection"],keyboardMoveSelection:["type",Pb]};var Ab=10;function Ya(e,t,n,i){this._dragging=i,this._rules=t;var r=this;function o(c,u){var l=c.shape,f=c.direction,p=c.resizeConstraints,d;c.delta=u,d=AR(l,f,u),c.newBounds=MR(d,p),c.canExecute=r.canResize(c)}function a(c){var u=c.resizeConstraints,l=c.minBounds;u===void 0&&(l===void 0&&(l=r.computeMinResizeBox(c)),c.resizeConstraints={min:be(l)})}function s(c){var u=c.shape,l=c.canExecute,f=c.newBounds;if(l){if(f=Wh(f),!Dk(u,f))return;n.resizeShape(u,f)}}e.on("resize.start",function(c){a(c.context)}),e.on("resize.move",function(c){var u={x:c.dx,y:c.dy};o(c.context,u)}),e.on("resize.end",function(c){s(c.context)})}Ya.prototype.canResize=function(e){var t=this._rules,n=ni(e,["newBounds","shape","delta","direction"]);return t.allowed("shape.resize",n)},Ya.prototype.activate=function(e,t,n){var i=this._dragging,r,o;if(typeof n=="string"&&(n={direction:n}),r=I({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,Tb(t,o),"resize",{autoActivate:!0,cursor:Lk(o),data:{shape:t,context:r}})},Ya.prototype.computeMinResizeBox=function(e){var t=e.shape,n=e.direction,i,r;return i=e.minDimensions||{width:Ab,height:Ab},r=Om(t,e.childrenBoxPadding),kR(n,t,i,r)},Ya.$inject=["eventBus","rules","modeling","dragging"];function Dk(e,t){return e.x!==t.x||e.y!==t.y||e.width!==t.width||e.height!==t.height}function Tb(e,t){var n=Ee(e),i=be(e),r={x:n.x,y:n.y};return t.indexOf("n")!==-1?r.y=i.top:t.indexOf("s")!==-1&&(r.y=i.bottom),t.indexOf("e")!==-1?r.x=i.right:t.indexOf("w")!==-1&&(r.x=i.left),r}function Lk(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 Mb="djs-resizing",kb="resize-not-ok",Ik=500;function Ob(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,Mb)),s.width>5&&se(c,{x:s.x,width:s.width}),s.height>5&&se(c,{y:s.y,height:s.height}),o.canExecute?ze(c).remove(kb):ze(c).add(kb)}function r(o){var a=o.shape,s=o.frame;s&&zt(o.frame),t.removeMarker(a,Mb)}e.on("resize.move",Ik,function(o){i(o.context)}),e.on("resize.cleanup",function(o){r(o.context)})}Ob.$inject=["eventBus","canvas","previewSupport"];var hu=-6,mu=8,gu=20,qa="djs-resizer",Nk=["n","w","s","e","nw","ne","se","sw"];function br(e,t,n,i){this._resize=i,this._canvas=t;var r=this;e.on("selection.changed",function(o){var a=o.newSelection;r.removeResizers(),a.length===1&&k(a,bn(r.addResizer,r))}),e.on("shape.changed",function(o){var a=o.element;n.isSelected(a)&&(r.removeResizers(),r.addResizer(a))})}br.prototype.makeDraggable=function(e,t,n){var i=this._resize;function r(o){cr(o)&&i.activate(o,e,n)}Ae.bind(t,"mousedown",r),Ae.bind(t,"touchstart",r)},br.prototype._createResizer=function(e,t,n,i){var r=this._getResizersParent(),o=Bk(i),a=ve("g");ze(a).add(qa),ze(a).add(qa+"-"+e.id),ze(a).add(qa+"-"+i),Te(r,a);var s=ve("rect");se(s,{x:-mu/2+o.x,y:-mu/2+o.y,width:mu,height:mu}),ze(s).add(qa+"-visual"),Te(a,s);var c=ve("rect");return se(c,{x:-gu/2+o.x,y:-gu/2+o.y,width:gu,height:gu}),ze(c).add(qa+"-hit"),Te(a,c),Ms(a,t,n),a},br.prototype.createResizer=function(e,t){var n=Tb(e,t),i=this._createResizer(e,n.x,n.y,t);this.makeDraggable(e,i,t)},br.prototype.addResizer=function(e){var t=this;ot(e)||k(Nk,function(n){t._resize.canResize({shape:e,direction:n})&&t.createResizer(e,n)})},br.prototype.removeResizers=function(){var e=this._getResizersParent();xs(e)},br.prototype._getResizersParent=function(){return this._canvas.getLayer("resizers")},br.$inject=["eventBus","canvas","selection","resize"];function Bk(e){var t={x:0,y:0};return e.indexOf("e")!==-1?t.x=-hu:e.indexOf("w")!==-1&&(t.x=hu),e.indexOf("s")!==-1?t.y=-hu:e.indexOf("n")!==-1&&(t.y=hu),t}const Db={__depends__:[yi,Ni,Ao],__init__:["resize","resizePreview","resizeHandles"],resize:["type",Ya],resizePreview:["type",Ob],resizeHandles:["type",br]};var $k=2e3;function Ka(e,t,n,i,r,o,a){this._bpmnFactory=t,this._canvas=n,this._modeling=r,this._textRenderer=a,i.registerProvider(this),e.on("element.dblclick",function(c){s(c.element,!0)}),e.on(["autoPlace.start","canvas.viewbox.changing","drag.init","element.mousedown","popupMenu.open","root.set","selection.changed"],function(){i.isActive()&&i.complete()}),e.on(["shape.remove","connection.remove"],$k,function(c){i.isActive(c.element)&&i.cancel()}),e.on(["commandStack.changed"],function(c){i.isActive()&&i.cancel()}),e.on("directEditing.activate",function(c){o.removeResizers()}),e.on("create.end",500,function(c){var u=c.context,l=u.shape,f=c.context.canExecute,p=c.isTouch;p||f&&(u.hints&&u.hints.createElementsBehavior===!1||s(l))}),e.on("autoPlace.end",500,function(c){s(c.shape)});function s(c,u){(u||Ie(c,["bpmn:Activity","bpmn:Event","bpmn:TextAnnotation","bpmn:Participant"]))&&i.activate(c)}}Ka.$inject=["eventBus","bpmnFactory","canvas","directEditing","modeling","resizeHandles","textRenderer"],Ka.prototype.activate=function(e){var t=jn(e);if(t!==void 0){var n={text:t},i=this.getEditingBBox(e);I(n,i);var r={},o=n.style||{};return I(o,{backgroundColor:null,border:null}),(Ie(e,["bpmn:Task","bpmn:Participant","bpmn:Lane","bpmn:CallActivity"])||Lb(e))&&I(r,{centerVertically:!0}),rr(e)&&(I(r,{resizable:!0,autoResize:!0}),I(o,{backgroundColor:"#ffffff",border:"1px solid #ccc"})),v(e,"bpmn:TextAnnotation")&&(I(r,{resizable:!0,autoResize:!0}),I(o,{backgroundColor:"#ffffff",border:"1px solid #ccc"})),I(n,{options:r,style:o}),n}},Ka.prototype.getEditingBBox=function(e){var t=this._canvas,n=e.label||e,i=t.getAbsoluteBBox(n),r={x:i.x+i.width/2,y:i.y+i.height/2},o={x:i.x,y:i.y},a=t.zoom(),s=this._textRenderer.getDefaultStyle(),c=this._textRenderer.getExternalStyle(),u=c.fontSize*a,l=c.lineHeight,f=s.fontSize*a,p=s.lineHeight,d={fontFamily:this._textRenderer.getDefaultStyle().fontFamily,fontWeight:this._textRenderer.getDefaultStyle().fontWeight};if(v(e,"bpmn:Lane")||Hk(e)){var h=qt(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};I(o,m),I(d,{fontSize:f+"px",lineHeight:p,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px",transform:h?"rotate(-90deg)":null})}if(Fk(e)){var g=qt(e),R=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};I(o,R),I(d,{fontSize:f+"px",lineHeight:p,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px",transform:g?null:"rotate(-90deg)"})}(Ie(e,["bpmn:Task","bpmn:CallActivity"])||Lb(e))&&(I(o,{width:i.width,height:i.height}),I(d,{fontSize:f+"px",lineHeight:p,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px"})),jk(e)&&(I(o,{width:i.width,x:i.x}),I(d,{fontSize:f+"px",lineHeight:p,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px"}));var E=1,x=i.width+2*E;if(n.labelTarget&&(I(o,{width:x,height:i.height+2*E,x:i.x-E,y:i.y-E}),I(d,{fontSize:u+"px",lineHeight:l})),rr(n)&&!Ds(n)&&!De(n)){var w=dl(e),S=t.getAbsoluteBBox({x:w.x,y:w.y,width:0,height:0}),M=u,N=Nr.width*a+2*E;I(o,{width:N,height:M+2*E,x:S.x-N/2,y:S.y-M/2-E}),I(d,{fontSize:u+"px",lineHeight:l})}return v(e,"bpmn:TextAnnotation")&&(I(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}),I(d,{textAlign:"left",paddingTop:mo*a+"px",paddingBottom:mo*a+"px",paddingLeft:mo*a+"px",paddingRight:mo*a+"px",fontSize:f+"px",lineHeight:p})),{bounds:o,style:d}},Ka.prototype.update=function(e,t,n,i){var r,o;v(e,"bpmn:TextAnnotation")&&(o=this._canvas.getAbsoluteBBox(e),r={x:e.x,y:e.y,width:e.width/o.width*i.width,height:e.height/o.height*i.height}),zk(t)&&(t=null),this._modeling.updateLabel(e,t,r)};function Lb(e){return v(e,"bpmn:SubProcess")&&!He(e)}function jk(e){return v(e,"bpmn:SubProcess")&&He(e)}function Fk(e){return v(e,"bpmn:Participant")&&!He(e)}function Hk(e){return v(e,"bpmn:Participant")&&He(e)}function zk(e){return!e||!e.trim()}var Ib="djs-element-hidden",Nb="djs-label-hidden";function Bb(e,t,n){var i=this,r=t.getDefaultLayer(),o,a,s;e.on("directEditing.activate",function(c){var u=c.active;if(o=u.element.label||u.element,v(o,"bpmn:TextAnnotation")){a=t.getAbsoluteBBox(o),s=ve("g");var l=n.getScaledPath("TEXT_ANNOTATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:o.width,containerHeight:o.height,position:{mx:0,my:0}}),f=i.path=ve("path");se(f,{d:l,strokeWidth:2,stroke:Gk(o)}),Te(s,f),Te(r,s),Jt(s,o.x,o.y)}v(o,"bpmn:TextAnnotation")||o.labelTarget?t.addMarker(o,Ib):(v(o,"bpmn:Task")||v(o,"bpmn:CallActivity")||v(o,"bpmn:SubProcess")||v(o,"bpmn:Participant")||v(o,"bpmn:Lane"))&&t.addMarker(o,Nb)}),e.on("directEditing.resize",function(c){if(v(o,"bpmn:TextAnnotation")){var u=c.height,l=c.dy,f=Math.max(o.height/a.height*(u+l),0),p=n.getScaledPath("TEXT_ANNOTATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:o.width,containerHeight:f,position:{mx:0,my:0}});se(i.path,{d:p})}}),e.on(["directEditing.complete","directEditing.cancel"],function(c){var u=c.active;u&&(t.removeMarker(u.element.label||u.element,Ib),t.removeMarker(o,Nb)),o=void 0,a=void 0,s&&(zt(s),s=void 0)})}Bb.$inject=["eventBus","canvas","pathMap"];function Gk(e,t){var n=Ye(e);return n.get("stroke")||t||"black"}const Vk={__depends__:[kp,Db,cb],__init__:["labelEditingProvider","labelEditingPreview"],labelEditingProvider:["type",Ka],labelEditingPreview:["type",Bb]};var Wk=500,Uk=1e3;function bi(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){M1(o)||i.createOutline(o)}e.on("element.hover",function(o){r(o.element)}),e.on("selection.changed",function(o){k(o.newSelection,r)}),e.on(["shape.changed","connection.changed"],Wk,function(o){var a=o.element,s=o.gfx,c=nt(".djs-outline",s);c&&i.updateOutline(a,c)})}bi.prototype.createOutline=function(e){var t=this._elementRegistry.getGraphics(e);if(!t)throw new Error("cannot create outline for non-rendered element");var n=nt(".djs-outline",t);return n||(n=this.getOutline(e)||this._createOutlineGfx(),Te(t,n),this.updateOutline(e,n)),n},bi.prototype._createOutlineGfx=function(){var e=ve("rect");return se(e,I({x:0,y:0,rx:4,width:100,height:100},this._outlineStyle)),e},bi.prototype.updateOutline=function(e,t){e.waypoints?this.updateConnectionOutline(t,e):this.updateShapeOutline(t,e)},bi.prototype.updateShapeOutline=function(e,t){var n=!1,i=this._getProviders();i.length&&k(i,function(r){n=n||r.updateOutline(t,e)}),n||se(e,{x:-this._outlineOffset,y:-this._outlineOffset,width:t.width+this._outlineOffset*2,height:t.height+this._outlineOffset*2})},bi.prototype.updateConnectionOutline=function(e,t){var n=Mt(t);se(e,{x:n.x-this._outlineOffset,y:n.y-this._outlineOffset,width:n.width+this._outlineOffset*2,height:n.height+this._outlineOffset*2})},bi.prototype.registerProvider=function(e,t){t||(t=e,e=Uk),this._eventBus.on("outline.getProviders",e,function(n){n.providers.push(t)})},bi.prototype._getProviders=function(){var e=this._eventBus.createEvent({type:"outline.getProviders",providers:[]});return this._eventBus.fire(e),e.providers},bi.prototype.getOutline=function(e){var t,n=this._getProviders();return k(n,function(i){Yt(i.getOutline)&&(t=t||i.getOutline(e))}),t},bi.$inject=["eventBus","styles","elementRegistry"];var yu=6;function Pf(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)})}Pf.prototype._updateMultiSelectionOutline=function(e){var t=this._canvas.getLayer("selectionOutline");xs(t);var n=e.length>1,i=this._canvas.getContainer();if(ze(i)[n?"add":"remove"]("djs-multi-select"),!!n){var r=Yk(Mt(e)),o=ve("rect");se(o,I({rx:3},r)),ze(o).add("djs-selection-outline"),Te(t,o)}},Pf.$inject=["eventBus","canvas","selection"];function Yk(e){return{x:e.x-yu,y:e.y-yu,width:e.width+yu*2,height:e.height+yu*2}}const Af={__depends__:[Yn],__init__:["outline","multiSelectionOutline"],outline:["type",bi],multiSelectionOutline:["type",Pf]},$b=["bpmn:Event","bpmn:SequenceFlow","bpmn:Gateway"],jb={class:"bjs-label-link",stroke:"var(--element-selected-outline-secondary-stroke-color)",strokeDasharray:"5, 5"},qk=15,vu=2;function Fb(e,t,n,i,r){const o=t.getLayer("overlays");e.on(["selection.changed","shape.changed"],function(){s()}),e.on("selection.changed",function({newSelection:f}){var d;const p=f.filter(h=>Ie(h,$b));if(p.length===1){const h=p[0];De(h)?a(h,h.labelTarget):(d=h.labels)!=null&&d.length&&a(h.labels[0],h)}if(p.length===2){const h=p.find(De),m=p.find(g=>{var R;return(R=g.labels)==null?void 0:R.includes(h)});h&&m&&a(h,m)}}),e.on("shape.changed",function({element:f}){var p;!Ie(f,$b)||!l(f)||(De(f)?a(f,f.labelTarget):(p=f.labels)!=null&&p.length&&a(f.labels[0],f))});function a(f,p){const d=Qo([Ee(p),Ee(f)],jb),h=d.getAttribute("d"),g=r.isSelected(f)?c(f):u(f),R=na(g,h);if(!R)return;const x=r.isSelected(p)?c(p):u(p),w=na(x,h)||Ee(p);fa(w,R)<qk||(ol(d,[w,R]),Te(o,d))}function s(){bs(`.${jb.class}`,o).forEach(zt)}function c(f){const p=i.getOutline(f);if(!p)return u(f);if(p.x){const d={x:f.x+xr(p,"x")-vu,y:f.y+xr(p,"y")-vu,width:xr(p,"width")+vu*2,height:xr(p,"height")+vu*2};return ml(d,xr(p,"rx"))}if(p.cx){const d=xr(p,"r"),h={x:f.x+xr(p,"cx")-d,y:f.y+xr(p,"cy")-d,width:d*2,height:d*2};return mm(h)}}function u(f){return n.getShapePath(f)}function l(f){return r.isSelected(f)}}Fb.$inject=["eventBus","canvas","graphicsFactory","outline","selection"];function xr(e,t){return parseFloat(se(e,t)||0)}const Kk={__depends__:[Yn,Af],__init__:["labelLink"],labelLink:["type",Fb]};var Xk=new Po("tt");function Zk(e){var t=pt('<div class="djs-tooltip-container" />');return yn(t,{position:"absolute",width:"0",height:"0"}),e.insertBefore(t,e.firstChild),t}function Qk(e,t,n){yn(e,{left:t+"px",top:n+"px"})}function Tf(e,t){e.style.display=t===!1?"none":""}var Hb="djs-tooltip",Mf="."+Hb;function wn(e,t){this._eventBus=e,this._canvas=t,this._ids=Xk,this._tooltipDefaults={show:{minZoom:.7,maxZoom:5}},this._tooltips={},this._tooltipRoot=Zk(t.getContainer());var n=this;An.bind(this._tooltipRoot,Mf,"mousedown",function(i){i.stopPropagation()}),An.bind(this._tooltipRoot,Mf,"mouseover",function(i){n.trigger("mouseover",i)}),An.bind(this._tooltipRoot,Mf,"mouseout",function(i){n.trigger("mouseout",i)}),this._init()}wn.$inject=["eventBus","canvas"],wn.prototype.add=function(e){if(!e.position)throw new Error("must specifiy tooltip position");if(!e.html)throw new Error("must specifiy tooltip html");var t=this._ids.next();return e=I({},this._tooltipDefaults,e,{id:t}),this._addTooltip(e),e.timeout&&this.setTimeout(e),t},wn.prototype.trigger=function(e,t){var n=t.delegateTarget||t.target,i=this.get(cn(n,"data-tooltip-id"));i&&(e==="mouseover"&&i.timeout&&this.clearTimeout(i),e==="mouseout"&&i.timeout&&(i.timeout=1e3,this.setTimeout(i)))},wn.prototype.get=function(e){return typeof e!="string"&&(e=e.id),this._tooltips[e]},wn.prototype.clearTimeout=function(e){if(e=this.get(e),!!e){var t=e.removeTimer;t&&(clearTimeout(t),e.removeTimer=null)}},wn.prototype.setTimeout=function(e){if(e=this.get(e),!!e){this.clearTimeout(e);var t=this;e.removeTimer=setTimeout(function(){t.remove(e)},e.timeout)}},wn.prototype.remove=function(e){var t=this.get(e);t&&(pi(t.html),pi(t.htmlContainer),delete t.htmlContainer,delete this._tooltips[t.id])},wn.prototype.show=function(){Tf(this._tooltipRoot)},wn.prototype.hide=function(){Tf(this._tooltipRoot,!1)},wn.prototype._updateRoot=function(e){var t=e.scale||1,n=e.scale||1,i="matrix("+t+",0,0,"+n+","+-1*e.x*t+","+-1*e.y*n+")";this._tooltipRoot.style.transform=i,this._tooltipRoot.style["-ms-transform"]=i},wn.prototype._addTooltip=function(e){var t=e.id,n=e.html,i,r=this._tooltipRoot;n.get&&n.constructor.prototype.jquery&&(n=n.get(0)),Sn(n)&&(n=pt(n)),i=pt('<div data-tooltip-id="'+t+'" class="'+Hb+'">'),yn(i,{position:"absolute"}),i.appendChild(n),e.type&&yt(i).add("djs-tooltip-"+e.type),e.className&&yt(i).add(e.className),e.htmlContainer=i,r.appendChild(i),this._tooltips[t]=e,this._updateTooltip(e)},wn.prototype._updateTooltip=function(e){var t=e.position,n=e.htmlContainer;Qk(n,t.x,t.y)},wn.prototype._updateTooltipVisibilty=function(e){k(this._tooltips,function(t){var n=t.show,i=t.htmlContainer,r=!0;n&&((n.minZoom>e.scale||n.maxZoom<e.scale)&&(r=!1),Tf(i,r))})},wn.prototype._init=function(){var e=this;function t(n){e._updateRoot(n),e._updateTooltipVisibilty(n),e.show()}this._eventBus.on("canvas.viewbox.changing",function(n){e.hide()}),this._eventBus.on("canvas.viewbox.changed",function(n){t(n.viewbox)})};const Jk={__init__:["tooltips"],tooltips:["type",wn]};var eO="flow elements must be children of pools/participants",tO="Data object must be placed within a pool/participant.";function zb(e,t,n){function i(r,o,a){t.add({position:{x:r.x+5,y:r.y+5},type:"error",timeout:2e3,html:"<div>"+o+"</div>"})}e.on(["shape.move.rejected","create.rejected"],function(r){var o=r.context,a=o.shape,s=o.target;v(s,"bpmn:Collaboration")&&(v(a,"bpmn:FlowNode")?i(r,n(eO)):v(a,"bpmn:DataObjectReference")&&i(r,n(tO)))})}zb.$inject=["eventBus","tooltips","translate"];const nO={__depends__:[Jk],__init__:["modelingFeedback"],modelingFeedback:["type",zb]};var iO=500,rO=1250,oO=1500,_u=Math.round;function aO(e){return{x:e.x+_u(e.width/2),y:e.y+_u(e.height/2)}}function Gb(e,t,n,i,r){function o(s,c,u,l){return r.allowed("elements.move",{shapes:s,delta:c,position:u,target:l})}e.on("shape.move.start",oO,function(s){var c=s.context,u=s.shape,l=i.get().slice();l.indexOf(u)===-1&&(l=[u]),l=sO(l),I(c,{shapes:l,validatedShapes:l,shape:u})}),e.on("shape.move.start",rO,function(s){var c=s.context,u=c.validatedShapes,l;if(l=c.canExecute=o(u),!l)return!1}),e.on("shape.move.move",iO,function(s){var c=s.context,u=c.validatedShapes,l=s.hover,f={x:s.dx,y:s.dy},p={x:s.x,y:s.y},d;if(d=o(u,f,p,l),c.delta=f,c.canExecute=d,d===null){c.target=null;return}c.target=l}),e.on("shape.move.end",function(s){var c=s.context,u=c.delta,l=c.canExecute,f=l==="attach",p=c.shapes;if(l===!1)return!1;u.x=_u(u.x),u.y=_u(u.y),!(u.x===0&&u.y===0)&&n.moveElements(p,u,c.target,{primaryShape:c.shape,attach:f})}),e.on("element.mousedown",function(s){if(cr(s)){var c=Eo(s);if(!c)throw new Error("must supply DOM mousedown event");return a(c,s.element)}});function a(s,c,u,l){if(Ut(u)&&(l=u,u=!1),!(c.waypoints||!c.parent)&&!ze(s.target).has("djs-hit-no-move")){var f=aO(c),p=t.init(s,f,"shape.move",{cursor:"grabbing",autoActivate:u,data:{shape:c,context:l||{}}});if(p!==!1)return!0}}this.start=a}Gb.$inject=["eventBus","dragging","modeling","selection","rules"];function sO(e){var t=to(e,"id");return Be(e,function(n){for(;n=n.parent;)if(t[n.id])return!1;return!0})}var Vb=499,kf="djs-dragging",Wb="drop-ok",Ub="drop-not-ok",Yb="new-parent",qb="attach-ok";function Kb(e,t,n,i){function r(c){var u=o(c),l=cO(u);return l}function o(c){var u=Jo(c),l=u.flatMap(d=>(d.incoming||[]).concat(d.outgoing||[])),f=u.concat(l),p=[...new Set(f)];return p}function a(c,u){[qb,Wb,Ub,Yb].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,kf),c.allDraggedElements?c.allDraggedElements.push(u):c.allDraggedElements=[u]}e.on("shape.move.start",Vb,function(c){var u=c.context,l=u.shapes,f=u.allDraggedElements,p=r(l);if(!u.dragGroup){var d=ve("g");se(d,n.cls("djs-drag-group",["no-events"]));var h=t.getActiveLayer();Te(h,d),u.dragGroup=d}p.forEach(function(m){i.addDragger(m,u.dragGroup)}),f?f=Ru([f,o(l)]):f=o(l),k(f,function(m){t.addMarker(m,kf)}),u.allDraggedElements=f,u.differentParents=uO(l)}),e.on("shape.move.move",Vb,function(c){var u=c.context,l=u.dragGroup,f=u.target,p=u.shape.parent,d=u.canExecute;f&&(d==="attach"?a(f,qb):u.canExecute&&p&&f.id!==p.id?a(f,Yb):a(f,u.canExecute?Wb:Ub)),Jt(l,c.dx,c.dy)}),e.on(["shape.move.out","shape.move.cleanup"],function(c){var u=c.context,l=u.target;l&&a(l,null)}),e.on("shape.move.cleanup",function(c){var u=c.context,l=u.allDraggedElements,f=u.dragGroup;k(l,function(p){t.removeMarker(p,kf)}),f&&zt(f)}),this.makeDraggable=s}Kb.$inject=["eventBus","canvas","styles","previewSupport"];function cO(e){var t=new Set;e.forEach(function(i){t.add(i.id)});var n=Be(e,function(i){return ot(i)?t.has(i.source.id)&&t.has(i.target.id):!0});return n}function uO(e){return l0(to(e,function(t){return t.parent&&t.parent.id}))!==1}const lO={__depends__:[lc,Yn,Af,yi,Ni,Ao],__init__:["move","movePreview"],move:["type",Gb],movePreview:["type",Kb]};var Xb=".djs-palette-toggle",Zb=".entry",pO=Xb+", "+Zb,Of="djs-palette-",fO="shown",Df="open",Qb="two-column",dO=1e3;function It(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()})}It.$inject=["eventBus","canvas"],It.prototype.registerProvider=function(e,t){t||(t=e,e=dO),this._eventBus.on("palette.getProviders",e,function(n){n.providers.push(t)}),this._rebuild()},It.prototype.getEntries=function(){var e=this._getProviders();return e.reduce(mO,{})},It.prototype._rebuild=function(){if(this._diagramInitialized){var e=this._getProviders();e.length&&(this._container||this._init(),this._update())}},It.prototype._init=function(){var e=this,t=this._eventBus,n=this._getParentContainer(),i=this._container=pt(It.HTML_MARKUP);n.appendChild(i),yt(n).add(Of+fO),An.bind(i,pO,"click",function(r){var o=r.delegateTarget;if(Xu(o,Xb))return e.toggle();e.trigger("click",r)}),Ae.bind(i,"mousedown",function(r){r.stopPropagation()}),An.bind(i,Zb,"dragstart",function(r){e.trigger("dragstart",r)}),t.on("canvas.resized",this._layoutChanged,this),t.fire("palette.create",{container:i})},It.prototype._getProviders=function(e){var t=this._eventBus.createEvent({type:"palette.getProviders",providers:[]});return this._eventBus.fire(t),t.providers},It.prototype._toggleState=function(e){e=e||{};var t=this._getParentContainer(),n=this._container,i=this._eventBus,r,o=yt(n),a=yt(t);"twoColumn"in e?r=e.twoColumn:r=this._needsCollapse(t.clientHeight,this._entries||{}),o.toggle(Qb,r),a.toggle(Of+Qb,r),"open"in e&&(o.toggle(Df,e.open),a.toggle(Of+Df,e.open)),i.fire("palette.changed",{twoColumn:r,open:this.isOpen()})},It.prototype._update=function(){var e=nt(".djs-palette-entries",this._container),t=this._entries=this.getEntries();vs(e),k(t,function(n,i){var r=n.group||"default",o=nt("[data-group="+La(r)+"]",e);o||(o=pt('<div class="group"></div>'),cn(o,"data-group",r),e.appendChild(o));var a=n.html||(n.separator?'<hr class="separator" />':'<div class="entry" draggable="true"></div>'),s=pt(a);if(o.appendChild(s),!n.separator&&(cn(s,"data-action",i),n.title&&cn(s,"title",n.title),n.className&&hO(s,n.className),n.imageUrl)){var c=pt("<img>");cn(c,"src",n.imageUrl),s.appendChild(c)}}),this.open()},It.prototype.trigger=function(e,t,n){var i,r,o=t.delegateTarget||t.target;return o?(i=cn(o,"data-action"),r=t.originalEvent||t,this.triggerEntry(i,e,r,n)):t.preventDefault()},It.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(Yt(a)){if(t==="click")return a(n,i)}else if(a[t])return a[t](n,i);n.preventDefault()}},It.prototype._layoutChanged=function(){this._toggleState({})},It.prototype._needsCollapse=function(e,t){var n=50,i=Object.keys(t).length*46;return e<i+n},It.prototype.close=function(){this._toggleState({open:!1,twoColumn:!1})},It.prototype.open=function(){this._toggleState({open:!0})},It.prototype.toggle=function(){this.isOpen()?this.close():this.open()},It.prototype.isActiveTool=function(e){return e&&this._activeTool===e},It.prototype.updateToolHighlight=function(e){var t,n;this._toolsContainer||(t=nt(".djs-palette-entries",this._container),this._toolsContainer=nt("[data-group=tools]",t)),n=this._toolsContainer,k(n.children,function(i){var r=i.getAttribute("data-action");if(r){var o=yt(i);r=r.replace("-tool",""),o.contains("entry")&&r===e?o.add("highlighted-entry"):o.remove("highlighted-entry")}})},It.prototype.isOpen=function(){return yt(this._container).has(Df)},It.prototype._getParentContainer=function(){return this._canvas.getContainer()},It.HTML_MARKUP='<div class="djs-palette"><div class="djs-palette-entries"></div><div class="djs-palette-toggle"></div></div>';function hO(e,t){var n=yt(e),i=we(t)?t:t.split(/\s+/g);i.forEach(function(r){n.add(r)})}function mO(e,t){var n=t.getPaletteEntries();return Yt(n)?n(e):(k(n,function(i,r){e[r]=i}),e)}const gO={__init__:["palette"],palette:["type",It]};var Jb="crosshair",ex="selected",yO="djs-dragging-active-lasso";function wr(e,t,n,i,r,o,a){this._selection=r,this._dragging=n,this._mouse=a;var s=this,c={create:function(f){var p=t.getActiveLayer(),d=f.frame=ve("rect");se(d,{class:"djs-lasso-overlay",width:1,height:1,x:0,y:0}),Te(p,d),u(!0),this.update(f)},update:function(f){var p=f.frame,d=f.bbox;p&&d&&se(p,{x:d.x,y:d.y,width:d.width,height:d.height});var h=f.marked,m=f.lastMarked;if(h&&m){for(const g of m)h.has(g)||t.removeMarker(g,ex);for(const g of h)m.has(g)||t.addMarker(g,ex)}},remove:function(f){this.update(f),f.frame&&zt(f.frame),u(!1)}};function u(f){ze(t.getContainer()).toggle(yO,f)}function l(f){var p=i.getAll();return new Set(eo(uo(p,f)))}o.registerTool("lasso",{tool:"lasso.selection",dragging:"lasso"}),e.on("lasso.selection.end",function(f){var p=f.originalEvent.target;!f.hover&&!(p instanceof SVGElement)||e.once("lasso.selection.ended",function(){s.activateLasso(f.originalEvent,!0)})}),e.on("lasso.end",0,function(f){var p=f.context;s._select(Array.from(p.marked))}),e.on("lasso.start",function(f){var p=f.context;p.bbox=tx(f),p.add=ic(f),p.lastMarked=new Set(r.get()),p.add?p.marked=p.lastMarked:p.marked=new Set,p.initialMarked=p.marked,c.create(p)}),e.on("lasso.move",function(f){var p=f.context,d=p.bbox=tx(f),h=l(d),m=p.initialMarked.union(h);p.lastMarked=p.marked,p.marked=m,c.update(p)}),e.on("lasso.cleanup",function(f){var p=f.context;p.lastMarked=p.marked,p.marked=new Set(r.get()),c.remove(f.context)}),e.on("element.mousedown",1500,function(f){if(ic(f))return s.activateLasso(f.originalEvent),!0})}wr.$inject=["eventBus","canvas","dragging","elementRegistry","selection","toolManager","mouse"],wr.prototype.activateLasso=function(e,t){this._dragging.init(e,"lasso",{autoActivate:t,cursor:Jb,data:{context:{}},keepSelection:!0})},wr.prototype.activateSelection=function(e,t){this._dragging.init(e,"lasso.selection",{trapClick:!1,autoActivate:t,cursor:Jb,data:{context:{}},keepSelection:!0})},wr.prototype._select=function(e){this._selection.select(e)},wr.prototype.select=function(e,t,n=[]){var i=eo(uo(e,t));this._select([...n,...i])},wr.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateSelection(e,!!e)},wr.prototype.isActive=function(){var e=this._dragging.context();return e&&/^lasso/.test(e.prefix)};function tx(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 vO={__depends__:[hc,va],__init__:["lassoTool"],lassoTool:["type",wr]};var Lf=1500,nx="grab";function jo(e,t,n,i,r,o){this._dragging=n,this._mouse=o;var a=this,s=i.get("keyboard",!1);r.registerTool("hand",{tool:"hand",dragging:"hand.move"}),e.on("element.mousedown",Lf,function(c){if(ma(c))return a.activateMove(c.originalEvent,!0),!1}),s&&s.addListener(Lf,function(c){if(!(!ix(c.keyEvent)||a.isActive())){var u=a._mouse.getLastMoveEvent();a.activateMove(u,!!u)}},"keyboard.keydown"),s&&s.addListener(Lf,function(c){!ix(c.keyEvent)||!a.isActive()||a.toggle()},"keyboard.keyup"),e.on("hand.end",function(c){var u=c.originalEvent.target;if(!c.hover&&!(u instanceof SVGElement))return!1;e.once("hand.ended",function(){a.activateMove(c.originalEvent,{reactivate:!0})})}),e.on("hand.move.move",function(c){var u=t.viewbox().scale;t.scroll({dx:c.dx*u,dy:c.dy*u})}),e.on("hand.move.end",function(c){var u=c.context,l=u.reactivate;return!ma(c)&&l&&e.once("hand.move.ended",function(f){a.activateHand(f.originalEvent,!0,!0)}),!1})}jo.$inject=["eventBus","canvas","dragging","injector","toolManager","mouse"],jo.prototype.activateMove=function(e,t,n){typeof t=="object"&&(n=t,t=!1),this._dragging.init(e,"hand.move",{autoActivate:t,cursor:nx,data:{context:n||{}}})},jo.prototype.activateHand=function(e,t,n){this._dragging.init(e,"hand",{trapClick:!1,autoActivate:t,cursor:nx,data:{context:{reactivate:n}}})},jo.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateHand(e,!!e)},jo.prototype.isActive=function(){var e=this._dragging.context();return e?/^(hand|hand\.move)$/.test(e.prefix):!1};function ix(e){return Gt("Space",e)}const _O={__depends__:[hc,va],__init__:["handTool"],handTool:["type",jo]};var rx="connect-ok",ox="connect-not-ok";function Fo(e,t,n,i,r,o,a){var s=this;this._dragging=t,this._rules=o,this._mouse=a,r.registerTool("global-connect",{tool:"global-connect",dragging:"global-connect.drag"}),e.on("global-connect.hover",function(c){var u=c.context,l=c.hover,f=u.canStartConnect=s.canStartConnect(l);f!==null&&(u.startTarget=l,i.addMarker(l,f?rx:ox))}),e.on(["global-connect.out","global-connect.cleanup"],function(c){var u=c.context.startTarget,l=c.context.canStartConnect;u&&i.removeMarker(u,l?rx:ox)}),e.on(["global-connect.ended"],function(c){var u=c.context,l=u.startTarget,f={x:c.x,y:c.y},p=s.canStartConnect(l);if(p)return e.once("element.out",function(){e.once(["connect.ended","connect.canceled"],function(){e.fire("global-connect.drag.ended")}),n.start(null,l,f)}),!1})}Fo.$inject=["eventBus","dragging","connect","canvas","toolManager","rules","mouse"],Fo.prototype.start=function(e,t){this._dragging.init(e,"global-connect",{autoActivate:t,trapClick:!1,data:{context:{}}})},Fo.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();return this.start(e,!!e)},Fo.prototype.isActive=function(){var e=this._dragging.context();return e&&/^global-connect/.test(e.prefix)},Fo.prototype.canStartConnect=function(e){return this._rules.allowed("connection.start",{source:e})};const bO={__depends__:[Ef,yi,Ni,hc,va],globalConnect:["type",Fo]};function If(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)}If.$inject=["palette","create","elementFactory","spaceTool","lassoTool","handTool","globalConnect","translate"],If.prototype.getPaletteEntries=function(){var e={},t=this._create,n=this._elementFactory,i=this._spaceTool,r=this._lassoTool,o=this._handTool,a=this._globalConnect,s=this._translate;function c(f,p,d,h,m){function g(R){var E=n.createShape(I({type:f},m));t.start(R,E)}return{group:p,className:d,title:h,action:{dragstart:g,click:g}}}function u(f){var p=n.createShape({type:"bpmn:SubProcess",x:0,y:0,isExpanded:!0}),d=n.createShape({type:"bpmn:StartEvent",x:40,y:82,parent:p});t.start(f,[p,d],{hints:{autoSelect:[p]}})}function l(f){t.start(f,n.createParticipantShape())}return I(e,{"hand-tool":{group:"tools",className:"bpmn-icon-hand-tool",title:s("Activate hand tool"),action:{click:function(f){o.activateHand(f)}}},"lasso-tool":{group:"tools",className:"bpmn-icon-lasso-tool",title:s("Activate lasso tool"),action:{click:function(f){r.activateSelection(f)}}},"space-tool":{group:"tools",className:"bpmn-icon-space-tool",title:s("Activate create/remove space tool"),action:{click:function(f){i.activateSelection(f)}}},"global-connect-tool":{group:"tools",className:"bpmn-icon-connection-multi",title:s("Activate global connect tool"),action:{click:function(f){a.start(f)}}},"tool-separator":{group:"tools",separator:!0},"create.start-event":c("bpmn:StartEvent","event","bpmn-icon-start-event-none",s("Create start event")),"create.intermediate-event":c("bpmn:IntermediateThrowEvent","event","bpmn-icon-intermediate-event-none",s("Create intermediate/boundary event")),"create.end-event":c("bpmn:EndEvent","event","bpmn-icon-end-event-none",s("Create end event")),"create.exclusive-gateway":c("bpmn:ExclusiveGateway","gateway","bpmn-icon-gateway-none",s("Create gateway")),"create.task":c("bpmn:Task","activity","bpmn-icon-task",s("Create task")),"create.data-object":c("bpmn:DataObjectReference","data-object","bpmn-icon-data-object",s("Create data object reference")),"create.data-store":c("bpmn:DataStoreReference","data-store","bpmn-icon-data-store",s("Create data store reference")),"create.subprocess-expanded":{group:"activity",className:"bpmn-icon-subprocess-expanded",title:s("Create expanded sub-process"),action:{dragstart:u,click:u}},"create.participant-expanded":{group:"collaboration",className:"bpmn-icon-participant",title:s("Create pool/participant"),action:{dragstart:l,click:l}},"create.group":c("bpmn:Group","artifact","bpmn-icon-group",s("Create group"))}),e};const xO={__depends__:[gO,fc,Dy,vO,_O,bO,ca],__init__:["paletteProvider"],paletteProvider:["type",If]};var wO=250;function Nf(e,t,n,i,r){X.call(this,e);function o(s){var c=s.canExecute.replacements;k(c,function(u){var l=u.oldElementId,f={type:u.newElementType};if(!s.visualReplacements[l]){var p=t.get(l);I(f,{x:p.x,y:p.y});var d=n.createShape(f);i.addShape(d,p.parent);var h=nt('[data-element-id="'+La(p.id)+'"]',s.dragGroup);h&&se(h,{display:"none"});var m=r.addDragger(d,s.dragGroup);s.visualReplacements[l]=m,i.removeShape(d)}})}function a(s){var c=s.visualReplacements;k(c,function(u,l){var f=nt('[data-element-id="'+La(l)+'"]',s.dragGroup);f&&se(f,{display:"inline"}),u.remove(),c[l]&&delete c[l]})}e.on("shape.move.move",wO,function(s){var c=s.context,u=c.canExecute;c.visualReplacements||(c.visualReplacements={}),u&&u.replacements?o(c):a(c)})}Nf.$inject=["eventBus","elementRegistry","elementFactory","canvas","previewSupport"],ae(Nf,X);const EO={__depends__:[Ao],__init__:["bpmnReplacePreview"],bpmnReplacePreview:["type",Nf]};var SO=1250,Bf=40,RO=20,CO=10,ax=20,sx=["x","y"],PO=Math.abs;function cx(e){e.on(["connect.hover","connect.move","connect.end"],SO,function(t){var n=t.context,i=n.canExecute,r=n.start,o=n.hover,a=n.source,s=n.target;t.originalEvent&&kn(t.originalEvent)||(n.initialConnectionStart||(n.initialConnectionStart=n.connectionStart),i&&o&&AO(t,o,OO(o)),o&&kO(i,["bpmn:Association","bpmn:DataInputAssociation","bpmn:DataOutputAssociation","bpmn:SequenceFlow"])?(n.connectionStart=Xn(r),Ie(o,["bpmn:Event","bpmn:Gateway"])&&ux(t,Xn(o)),Ie(o,["bpmn:Task","bpmn:SubProcess"])&&TO(t,o),v(a,"bpmn:BoundaryEvent")&&s===a.host&&MO(t)):lx(i,"bpmn:MessageFlow")?(v(r,"bpmn:Event")&&(n.connectionStart=Xn(r)),v(o,"bpmn:Event")&&ux(t,Xn(o))):n.connectionStart=n.initialConnectionStart)})}cx.$inject=["eventBus"];function AO(e,t,n){sx.forEach(function(i){var r=px(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 TO(e,t){var n=Xn(t);sx.forEach(function(i){DO(e,t,i)&&Lt(e,i,n[i])})}function MO(e){var t=e.context,n=t.source,i=t.target;if(!LO(t)){var r=Xn(n),o=Qt(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;PO(c-r[s])<Bf&&(c>r[s]?u=r[s]+Bf:u=r[s]-Bf,Lt(e,s,u))})}}function ux(e,t){Lt(e,"x",t.x),Lt(e,"y",t.y)}function lx(e,t){return e&&e.type===t}function kO(e,t){return Wi(t,function(n){return lx(e,n)})}function px(e,t){return e==="x"?t.width:t.height}function OO(e){return v(e,"bpmn:Task")?CO:RO}function DO(e,t,n){return e[n]>t[n]+ax&&e[n]<t[n]+px(n,t)-ax}function LO(e){var t=e.hover,n=e.source;return t&&n&&t===n}function Er(){this._targets={},this._snapOrigins={},this._snapLocations=[],this._defaultSnaps={}}Er.prototype.getSnapOrigin=function(e){return this._snapOrigins[e]},Er.prototype.setSnapOrigin=function(e,t){this._snapOrigins[e]=t,this._snapLocations.indexOf(e)===-1&&this._snapLocations.push(e)},Er.prototype.addDefaultSnap=function(e,t){var n=this._defaultSnaps[e];n||(n=this._defaultSnaps[e]=[]),n.push(t)},Er.prototype.getSnapLocations=function(){return this._snapLocations},Er.prototype.setSnapLocations=function(e){this._snapLocations=e},Er.prototype.pointsForTarget=function(e){var t=e.id||e,n=this._targets[t];return n||(n=this._targets[t]=new bu,n.initDefaults(this._defaultSnaps)),n};function bu(){this._snapValues={}}bu.prototype.add=function(e,t){var n=this._snapValues[e];n||(n=this._snapValues[e]={x:[],y:[]}),n.x.indexOf(t.x)===-1&&n.x.push(t.x),n.y.indexOf(t.y)===-1&&n.y.push(t.y)},bu.prototype.snap=function(e,t,n,i){var r=this._snapValues[t];return r&&w2(e[n],r[n],i)},bu.prototype.initDefaults=function(e){var t=this;k(e||{},function(n,i){k(n,function(r){t.add(i,r)})})};var IO=1250;function xi(e,t,n){var i=this;this._elementRegistry=e,t.on(["create.start","shape.move.start"],function(r){i.initSnap(r)}),t.on(["create.move","create.end","shape.move.move","shape.move.end"],IO,function(r){var o=r.context,a=o.shape,s=o.snapContext,c=o.target;if(!(r.originalEvent&&kn(r.originalEvent))&&!($o(r)||!c)){var u=s.pointsForTarget(c);u.initialized||(u=i.addSnapTargetPoints(u,a,c),u.initialized=!0),n.snap(r,u)}}),t.on(["create.cleanup","shape.move.cleanup"],function(){n.hide()})}xi.$inject=["elementRegistry","eventBus","snapping"],xi.prototype.initSnap=function(e){var t=this._elementRegistry,n=e.context,i=n.shape,r=n.snapContext;r||(r=n.snapContext=new Er);var o;t.get(i.id)?o=Xn(i,e):o={x:e.x+Xn(i).x,y:e.y+Xn(i).y};var a={x:o.x-i.width/2,y:o.y-i.height/2},s={x:o.x+i.width/2,y:o.y+i.height/2};return r.setSnapOrigin("mid",{x:o.x-e.x,y:o.y-e.y}),De(i)||(r.setSnapOrigin("top-left",{x:a.x-e.x,y:a.y-e.y}),r.setSnapOrigin("bottom-right",{x:s.x-e.x,y:s.y-e.y})),r},xi.prototype.addSnapTargetPoints=function(e,t,n){var i=this.getSnapTargets(t,n);return k(i,function(r){if(De(r)){De(t)&&e.add("mid",Xn(r));return}if(ot(r)){if(r.waypoints.length<3)return;var o=r.waypoints.slice(1,-1);k(o,function(a){e.add("mid",a)});return}e.add("mid",Xn(r))}),!Pe(t.x)||!Pe(t.y)||this._elementRegistry.get(t.id)&&e.add("mid",Xn(t)),e},xi.prototype.getSnapTargets=function(e,t){return Z_(t).filter(function(n){return!NO(n)})};function NO(e){return!!e.hidden}var fx=1500;function Ho(e,t){t.invoke(xi,this),e.on(["create.move","create.end"],fx,FO),e.on(["create.move","create.end","shape.move.move","shape.move.end"],fx,function(n){var i=n.context,r=i.canExecute,o=i.target,a=r&&(r==="attach"||r.attach);a&&!$o(n)&&BO(n,o)})}ae(Ho,xi),Ho.$inject=["eventBus","injector"],Ho.prototype.initSnap=function(e){var t=xi.prototype.initSnap.call(this,e),n=e.shape,i=!!this._elementRegistry.get(n.id);return k(n.outgoing,function(r){var o=r.waypoints[0];o=o.original||o,t.setSnapOrigin(r.id+"-docking",hx(o,i,e))}),k(n.incoming,function(r){var o=r.waypoints[r.waypoints.length-1];o=o.original||o,t.setSnapOrigin(r.id+"-docking",hx(o,i,e))}),v(n,"bpmn:Participant")&&t.setSnapLocations(["top-left","bottom-right","mid"]),t},Ho.prototype.addSnapTargetPoints=function(e,t,n){xi.prototype.addSnapTargetPoints.call(this,e,t,n);var i=this.getSnapTargets(t,n);k(i,function(o){(jO(o)||$O([t,o],"bpmn:TextAnnotation"))&&(e.add("top-left",K_(o)),e.add("bottom-right",X_(o)))});var r=this._elementRegistry;return k(t.incoming,function(o){if(r.get(t.id)){dx(i,o.source)||e.add("mid",Ee(o.source));var a=o.waypoints[0];e.add(o.id+"-docking",a.original||a)}}),k(t.outgoing,function(o){if(r.get(t.id)){dx(i,o.target)||e.add("mid",Ee(o.target));var a=o.waypoints[o.waypoints.length-1];e.add(o.id+"-docking",a.original||a)}}),v(n,"bpmn:SequenceFlow")&&(e=this.addSnapTargetPoints(e,t,n.parent)),e},Ho.prototype.getSnapTargets=function(e,t){return xi.prototype.getSnapTargets.call(this,e,t).filter(function(n){return!v(n,"bpmn:Lane")})};function BO(e,t){var n=be(t),i=Tg(e,t),r=e.context,o=r.shape,a;o.parent?a={x:0,y:0}:a=Ee(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 $O(e,t){return e.every(function(n){return v(n,t)})}function jO(e){return v(e,"bpmn:SubProcess")&&He(e)?!0:v(e,"bpmn:Participant")}function FO(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 dx(e,t){return e.indexOf(t)!==-1}function hx(e,t,n){return t?{x:e.x-n.x,y:e.y-n.y}:{x:e.x,y:e.y}}var HO=1250;function Xa(e,t){var n=this;e.on(["resize.start"],function(i){n.initSnap(i)}),e.on(["resize.move","resize.end"],HO,function(i){var r=i.context,o=r.shape,a=o.parent,s=r.direction,c=r.snapContext;if(!(i.originalEvent&&kn(i.originalEvent))&&!$o(i)){var u=c.pointsForTarget(a);u.initialized||(u=n.addSnapTargetPoints(u,o,a,s),u.initialized=!0),VO(s)&&Lt(i,"x",i.x),WO(s)&&Lt(i,"y",i.y),t.snap(i,u)}}),e.on(["resize.cleanup"],function(){t.hide()})}Xa.prototype.initSnap=function(e){var t=e.context,n=t.shape,i=t.direction,r=t.snapContext;r||(r=t.snapContext=new Er);var o=mx(n,i);return r.setSnapOrigin("corner",{x:o.x-e.x,y:o.y-e.y}),r},Xa.prototype.addSnapTargetPoints=function(e,t,n,i){var r=this.getSnapTargets(t,n);return k(r,function(o){e.add("corner",X_(o)),e.add("corner",K_(o))}),e.add("corner",mx(t,i)),e},Xa.$inject=["eventBus","snapping"],Xa.prototype.getSnapTargets=function(e,t){return Z_(t).filter(function(n){return!zO(n,e)&&!ot(n)&&!GO(n)&&!De(n)})};function mx(e,t){var n=Ee(e),i=be(e),r={x:n.x,y:n.y};return t.indexOf("n")!==-1?r.y=i.top:t.indexOf("s")!==-1&&(r.y=i.bottom),t.indexOf("e")!==-1?r.x=i.right:t.indexOf("w")!==-1&&(r.x=i.left),r}function zO(e,t){return e.host===t}function GO(e){return!!e.hidden}function VO(e){return e==="n"||e==="s"}function WO(e){return e==="e"||e==="w"}var UO=7,YO=1e3;function Sr(e){this._canvas=e,this._asyncHide=Pu(bn(this.hide,this),YO)}Sr.$inject=["canvas"],Sr.prototype.snap=function(e,t){var n=e.context,i=n.snapContext,r=i.getSnapLocations(),o={x:$o(e,"x"),y:$o(e,"y")};k(r,function(a){var s=i.getSnapOrigin(a),c={x:e.x+s.x,y:e.y+s.y};if(k(["x","y"],function(u){var l;o[u]||(l=t.snap(c,a,u,UO),l!==void 0&&(o[u]={value:l,originValue:l-s[u]}))}),o.x&&o.y)return!1}),this.showSnapLine("vertical",o.x&&o.x.value),this.showSnapLine("horizontal",o.y&&o.y.value),k(["x","y"],function(a){var s=o[a];Ut(s)&&Lt(e,a,s.originValue)})},Sr.prototype._createLine=function(e){var t=this._canvas.getLayer("snap"),n=ve("path");return se(n,{d:"M0,0 L0,0"}),ze(n).add("djs-snap-line"),Te(t,n),{update:function(i){Pe(i)?e==="horizontal"?se(n,{d:"M-100000,"+i+" L+100000,"+i,display:""}):se(n,{d:"M "+i+",-100000 L "+i+", +100000",display:""}):se(n,{display:"none"})}}},Sr.prototype._createSnapLines=function(){this._snapLines={horizontal:this._createLine("horizontal"),vertical:this._createLine("vertical")}},Sr.prototype.showSnapLine=function(e,t){var n=this.getSnapLine(e);n&&n.update(t),this._asyncHide()},Sr.prototype.getSnapLine=function(e){return this._snapLines||this._createSnapLines(),this._snapLines[e]},Sr.prototype.hide=function(){k(this._snapLines,function(e){e.update()})};const qO={__depends__:[{__init__:["createMoveSnapping","resizeSnapping","snapping"],createMoveSnapping:["type",xi],resizeSnapping:["type",Xa],snapping:["type",Sr]}],__init__:["connectSnapping","createMoveSnapping"],connectSnapping:["type",cx],createMoveSnapping:["type",Ho]};var gx=300;function Me(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=nt(Me.INPUT_SELECTOR,this._container),this._resultsContainer=nt(Me.RESULTS_CONTAINER_SELECTOR,this._container),this._canvas.getContainer().appendChild(this._container),t.on(["canvas.destroy","diagram.destroy","drag.init","elements.changed"],this.close,this)}Me.$inject=["canvas","eventBus","selection","translate"],Me.prototype._bindEvents=function(){var e=this;function t(n,i,r,o){e._eventMaps.push({el:n,type:r,listener:An.bind(n,i,r,o)})}t(document,"html","click",function(n){e.close(!1)}),t(this._container,Me.INPUT_SELECTOR,"click",function(n){n.stopPropagation(),n.delegateTarget.focus()}),t(this._container,Me.RESULT_SELECTOR,"mouseover",function(n){n.stopPropagation(),e._scrollToNode(n.delegateTarget),e._preselect(n.delegateTarget)}),t(this._container,Me.RESULT_SELECTOR,"click",function(n){n.stopPropagation(),e._select(n.delegateTarget)}),t(this._container,Me.INPUT_SELECTOR,"keydown",function(n){Gt("ArrowUp",n)&&n.preventDefault(),Gt("ArrowDown",n)&&n.preventDefault()}),t(this._container,Me.INPUT_SELECTOR,"keyup",function(n){if(Gt("Escape",n))return e.close();if(Gt("Enter",n)){var i=e._getCurrentResult();return i?e._select(i):e.close(!1)}if(Gt("ArrowUp",n))return e._scrollToDirection(!0);if(Gt("ArrowDown",n))return e._scrollToDirection();Gt(["ArrowLeft","ArrowRight"],n)||e._search(n.delegateTarget.value)})},Me.prototype._unbindEvents=function(){this._eventMaps.forEach(function(e){An.unbind(e.el,e.type,e.listener)})},Me.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=nt(Me.RESULT_SELECTOR,this._resultsContainer);this._scrollToNode(i),this._preselect(i)}},Me.prototype._scrollToDirection=function(e){var t=this._getCurrentResult();if(t){var n=e?t.previousElementSibling:t.nextElementSibling;n&&(this._scrollToNode(n),this._preselect(n))}},Me.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)}},Me.prototype._clearResults=function(){vs(this._resultsContainer),this._results={},this._eventBus.fire("searchPad.cleared")},Me.prototype._getCurrentResult=function(){return nt(Me.RESULT_SELECTED_SELECTOR,this._resultsContainer)},Me.prototype._createResultNode=function(e,t){var n=pt(Me.RESULT_HTML);return e.primaryTokens.length>0&&yx(n,e.primaryTokens,Me.RESULT_PRIMARY_HTML),yx(n,e.secondaryTokens,Me.RESULT_SECONDARY_HTML),cn(n,Me.RESULT_ID_ATTRIBUTE,t),this._resultsContainer.appendChild(n),n},Me.prototype.registerProvider=function(e){this._searchProvider=e},Me.prototype.open=function(){if(!this._searchProvider)throw new Error("no search provider registered");this.isOpen()||(this._cachedRootElement=this._canvas.getRootElement(),this._cachedSelection=this._selection.get(),this._cachedViewbox=this._canvas.viewbox(),this._selection.select(null),this._bindEvents(),this._open=!0,yt(this._canvas.getContainer()).add("djs-search-open"),yt(this._container).add("open"),this._searchInput.focus(),this._eventBus.fire("searchPad.opened"))},Me.prototype.close=function(e=!0){this.isOpen()&&(e&&(this._cachedRootElement&&this._canvas.setRootElement(this._cachedRootElement),this._cachedSelection&&this._selection.select(this._cachedSelection),this._cachedViewbox&&this._canvas.viewbox(this._cachedViewbox),this._eventBus.fire("searchPad.restored")),this._cachedRootElement=null,this._cachedSelection=null,this._cachedViewbox=null,this._unbindEvents(),this._open=!1,yt(this._canvas.getContainer()).remove("djs-search-open"),yt(this._container).remove("open"),this._clearResults(),this._searchInput.value="",this._searchInput.blur(),this._eventBus.fire("searchPad.closed"),this._canvas.restoreFocus())},Me.prototype.toggle=function(){this.isOpen()?this.close():this.open()},Me.prototype.isOpen=function(){return this._open},Me.prototype._preselect=function(e){var t=this._getCurrentResult();if(e!==t){t&&yt(t).remove(Me.RESULT_SELECTED_CLASS);var n=cn(e,Me.RESULT_ID_ATTRIBUTE),i=this._results[n].element;yt(e).add(Me.RESULT_SELECTED_CLASS),this._canvas.scrollToElement(i,{top:gx}),this._selection.select(i),this._eventBus.fire("searchPad.preselected",i)}},Me.prototype._select=function(e){var t=cn(e,Me.RESULT_ID_ATTRIBUTE),n=this._results[t].element;this._cachedSelection=null,this._cachedViewbox=null,this.close(!1),this._canvas.scrollToElement(n,{top:gx}),this._selection.select(n),this._eventBus.fire("searchPad.selected",n)},Me.prototype._getBoxHtml=function(){const e=pt(Me.BOX_HTML),t=nt(Me.INPUT_SELECTOR,e);return t&&t.setAttribute("aria-label",this._translate("Search in diagram")),e};function yx(e,t,n){var i=KO(t),r=pt(n);r.innerHTML=i,e.appendChild(r)}function KO(e){var t="";return e.forEach(function(n){var i=Rv(n.value||n.matched||n.normal),r=n.match||n.matched;r?t+='<b class="'+Me.RESULT_HIGHLIGHT_CLASS+'">'+i+"</b>":t+=i}),t!==""?t:null}Me.CONTAINER_SELECTOR=".djs-search-container",Me.INPUT_SELECTOR=".djs-search-input input",Me.RESULTS_CONTAINER_SELECTOR=".djs-search-results",Me.RESULT_SELECTOR=".djs-search-result",Me.RESULT_SELECTED_CLASS="djs-search-result-selected",Me.RESULT_SELECTED_SELECTOR="."+Me.RESULT_SELECTED_CLASS,Me.RESULT_ID_ATTRIBUTE="data-result-id",Me.RESULT_HIGHLIGHT_CLASS="djs-search-highlight",Me.BOX_HTML=`<div class="djs-search-container djs-scrollable">
336
336
  <div class="djs-search-input">
337
337
  <svg class="djs-search-icon" width="14" height="14" viewBox="0 0 14 14" fill="none" xmlns="http://www.w3.org/2000/svg">
338
338
  <path fill-rule="evenodd" clip-rule="evenodd" d="M9.0325 8.5H9.625L13.3675 12.25L12.25 13.3675L8.5 9.625V9.0325L8.2975 8.8225C7.4425 9.5575 6.3325 10 5.125 10C2.4325 10 0.25 7.8175 0.25 5.125C0.25 2.4325 2.4325 0.25 5.125 0.25C7.8175 0.25 10 2.4325 10 5.125C10 6.3325 9.5575 7.4425 8.8225 8.2975L9.0325 8.5ZM1.75 5.125C1.75 6.9925 3.2575 8.5 5.125 8.5C6.9925 8.5 8.5 6.9925 8.5 5.125C8.5 3.2575 6.9925 1.75 5.125 1.75C3.2575 1.75 1.75 3.2575 1.75 5.125Z" fill="#22242A"/>
@@ -340,4 +340,4 @@
340
340
  <input type="text" spellcheck="false" />
341
341
  </div>
342
342
  <div class="djs-search-results" />
343
- </div>`,Te.RESULT_HTML='<div class="djs-search-result"></div>',Te.RESULT_PRIMARY_HTML='<div class="djs-search-result-primary"></div>',Te.RESULT_SECONDARY_HTML='<p class="djs-search-result-secondary"></p>';const GD={__depends__:[oa,Oc,Kn],searchPad:["type",Te]};function $f(e,t,n,i){this._elementRegistry=e,this._canvas=n,this._search=i,t.registerProvider(this)}$f.$inject=["elementRegistry","searchPad","canvas","search"],$f.prototype.find=function(e){var t=this._canvas.getRootElements(),n=this._elementRegistry.filter(function(i){return!De(i)&&!t.includes(i)});return this._search(n.map(i=>({element:i,label:Hn(i),id:i.id})),e,{keys:["label","id"]}).map(WD)};function WD(e){const{item:{element:t},tokens:n}=e;return{element:t,primaryTokens:n.label,secondaryTokens:n.id}}const UD={__depends__:[GD,P_],__init__:["bpmnSearch"],bpmnSearch:["type",$f]},YD="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",qD="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",KD={width:36,height:50},XD={width:50,height:50};function gx(e,t,n){return ye("path",{d:e,strokeWidth:2,transform:`translate(${t.x}, ${t.y})`,...n})}const ti=5;function vu(e,t){this._styles=t,e.registerProvider(this)}vu.$inject=["outline","styles"],vu.prototype.getOutline=function(e){const t=this._styles.cls("djs-outline",["no-fill"]);var n;if(bS(e))return n=ye("rect"),se(n,L({x:-ti,y:-ti,rx:4,width:e.width+ti*2,height:e.height+ti*2},t)),n;if(!De(e))return v(e,"bpmn:Gateway")?(n=ye("rect"),L(n.style,{"transform-box":"fill-box",transform:"rotate(45deg)","transform-origin":"center"}),se(n,L({x:2,y:2,rx:4,width:e.width-4,height:e.height-4},t))):Le(e,["bpmn:Task","bpmn:SubProcess","bpmn:Group","bpmn:CallActivity"])?(n=ye("rect"),se(n,L({x:-ti,y:-ti,rx:14,width:e.width+ti*2,height:e.height+ti*2},t))):v(e,"bpmn:EndEvent")?(n=ye("circle"),se(n,L({cx:e.width/2,cy:e.height/2,r:e.width/2+ti+1},t))):v(e,"bpmn:Event")?(n=ye("circle"),se(n,L({cx:e.width/2,cy:e.height/2,r:e.width/2+ti},t))):v(e,"bpmn:DataObjectReference")&&yx(e,"bpmn:DataObjectReference")?n=gx(YD,{x:-6,y:-6},t):v(e,"bpmn:DataStoreReference")&&yx(e,"bpmn:DataStoreReference")&&(n=gx(qD,{x:-6,y:-6},t)),n},vu.prototype.updateOutline=function(e,t){if(!De(e))return Le(e,["bpmn:SubProcess","bpmn:Group"])?(se(t,{width:e.width+ti*2,height:e.height+ti*2}),!0):!!Le(e,["bpmn:Event","bpmn:Gateway","bpmn:DataStoreReference","bpmn:DataObjectReference"])};function yx(e,t){var n;return t==="bpmn:DataObjectReference"?n=KD:t==="bpmn:DataStoreReference"&&(n=XD),e.width===n.width&&e.height===n.height}const ZD={__depends__:[Af],__init__:["outlineProvider"],outlineProvider:["type",vu]};var QD='<?xml version="1.0" encoding="UTF-8"?><bpmn:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" targetNamespace="http://bpmn.io/schema/bpmn" id="Definitions_1"><bpmn:process id="Process_1" isExecutable="false"><bpmn:startEvent id="StartEvent_1"/></bpmn:process><bpmndi:BPMNDiagram id="BPMNDiagram_1"><bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="Process_1"><bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="StartEvent_1"><dc:Bounds height="36.0" width="36.0" x="173.0" y="102.0"/></bpmndi:BPMNShape></bpmndi:BPMNPlane></bpmndi:BPMNDiagram></bpmn:definitions>';function wi(e){lo.call(this,e)}ae(wi,lo),wi.Viewer=yr,wi.NavigatedViewer=Da,wi.prototype.createDiagram=function(){return this.importXML(QD)},wi.prototype._interactionModules=[Mv,Dv,Iv],wi.prototype._modelingModules=[e2,kc,o2,i2,v2,Ef,S2,K2,by,uc,J2,nk,vk,bk,xk,Ck,$k,Vk,qp,Xk,rD,mD,yD,kb,zD,UD,ZD],wi.prototype._modules=[].concat(yr.prototype._modules,wi.prototype._interactionModules,wi.prototype._modelingModules);const JD=((e,t)=>{const n=e.__vccOpts||e;for(const[i,r]of t)n[i]=r;return n})(Pt.defineComponent({__name:"BpmnModelerView",props:{xml:{}},emits:["ready","imported","import-error"],setup(e,{expose:t,emit:n}){const i=e,r=n,o=Pt.ref();let a;async function s(u){if(!a)throw new Error("modeler not mounted");try{const{warnings:l}=await a.importXML(u),f=Hu(l);return r("imported",f),{warnings:f}}catch(l){throw r("import-error",l),l}}async function c(){if(!a)throw new Error("modeler not mounted");const{xml:u}=await a.saveXML({format:!0});return u??""}return Pt.onMounted(async()=>{a=new wi({container:o.value,moddleExtensions:is}),i.xml&&await s(i.xml),r("ready")}),Pt.watch(()=>i.xml,u=>{u&&a&&s(u)}),Pt.onBeforeUnmount(()=>{a==null||a.destroy(),a=void 0}),t({importXml:s,saveXml:c,getModeler:()=>a}),(u,l)=>(Pt.openBlock(),Pt.createElementBlock("div",{ref_key:"container",ref:o,class:"bpmn-modeler-view"},null,512))}}),[["__scopeId","data-v-a9b41c97"]]);te.APPLY_BPMN_OPS_SCHEMA=e0,te.BPMN_MODDLE_EXTENSIONS=is,te.BWL_MODDLE_SCHEMA=Gf,te.BWL_NS=Vf,te.BWL_PREFIX=wu,te.BWL_SIDES=Eu,te.BpmnModelerView=JD,te.EDITOR=_E,te.FLOW_LABEL_INDENT=Rd,te.HEADLESS_BPMN_MODULES=bv,te.HEADLESS_TEXT_METRICS=io,te.I18N_NS=Dw,te.I18N_PREFIX=md,te.LABEL_FORK_MARGIN=Vu,te.MVP_FLOW_NODE_TYPES=Ei,te.SYMBOLIC_OP_KINDS=Yf,te.SYMBOLIC_OP_SCHEMA=qf,te.UNDO_EPISODE_COMMAND=Su,te.applyBpmnOpBatch=dh,te.applyBpmnOps=uh,te.approximateTextWidth=ro,te.auditBpmnGeometry=Ld,te.auditBpmnGeometryXml=Jw,te.auditGeometry=Xi,te.auditTargetsOf=Pi,te.axisSegmentsOf=mn,te.blackBoxNameRect=zu,te.buildBpmnOpBatch=vE,te.buildRegistryIndex=Nd,te.containerBoundarySegments=Wo,te.createBpmnEditorController=bE,te.createBpmnModdle=gd,te.createHeadlessBpmnModeler=FT,te.crossedShapesOf=Vn,te.crossingCost=Ci,te.describeProcess=fh,te.describeProcessXml=yE,te.edgeCrossCount=cs,te.edgeCrossingPairsOf=Wu,te.executeAsUndoEpisode=Uf,te.forwardThreePointCandidates=Uu,te.geometryFindingKey=Ki,te.installHeadlessBpmnDom=vd,te.isMvpFlowNodeType=zf,te.labelRectsOf=Uo,te.lineCrossesLabel=Ri,te.lineThroughLabel=Pd,te.lineThroughShapeLabel=Dd,te.loadBpmnXml=Fu,te.lowerOps=ch,te.oppositeOverlapCount=Vw,te.oppositeOverlapOf=Sd,te.planBackEdgeBoundaryClearance=qd,te.planCrossPoolRoute=Gd,te.planEdgeRepair=Hd,te.planLabelLineClearance=Jd,te.planLabelPlacement=Qd,te.planMiddleSegmentShifts=jd,te.planOppositeOverlapRepair=Xd,te.planSegmentDetours=$d,te.planShapeLabelClearance=nh,te.repairIntroducedBoundaryHugging=Kd,te.repairIntroducedCrossings=zd,te.repairIntroducedLabelLines=eh,te.repairIntroducedOppositeOverlaps=Zd,te.repairIntroducedShapeLabelLines=ih,te.repairIntroducedSharedSegmentLabels=th,te.rerouteIntroducedCrossPoolEdges=Wd,te.resolverServicesOf=sh,te.saveBpmnXml=Ow,te.sceneCrossingCost=Td,te.sceneFromDefinitions=Od,te.sceneFromRegistry=Ft,te.sharedSegmentUnderLabel=ss,te.sharedSpansOf=as,te.unreadableOverlapCount=Mr,te.unreadableOverlapOf=os,te.validateOps=ah,te.warningMessages=Hu,Object.defineProperty(te,Symbol.toStringTag,{value:"Module"})}));
343
+ </div>`,Me.RESULT_HTML='<div class="djs-search-result"></div>',Me.RESULT_PRIMARY_HTML='<div class="djs-search-result-primary"></div>',Me.RESULT_SECONDARY_HTML='<p class="djs-search-result-secondary"></p>';const XO={__depends__:[ca,Nc,Yn],searchPad:["type",Me]};function $f(e,t,n,i){this._elementRegistry=e,this._canvas=n,this._search=i,t.registerProvider(this)}$f.$inject=["elementRegistry","searchPad","canvas","search"],$f.prototype.find=function(e){var t=this._canvas.getRootElements(),n=this._elementRegistry.filter(function(i){return!De(i)&&!t.includes(i)});return this._search(n.map(i=>({element:i,label:jn(i),id:i.id})),e,{keys:["label","id"]}).map(ZO)};function ZO(e){const{item:{element:t},tokens:n}=e;return{element:t,primaryTokens:n.label,secondaryTokens:n.id}}const QO={__depends__:[XO,T_],__init__:["bpmnSearch"],bpmnSearch:["type",$f]},JO="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",eD="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",tD={width:36,height:50},nD={width:50,height:50};function vx(e,t,n){return ve("path",{d:e,strokeWidth:2,transform:`translate(${t.x}, ${t.y})`,...n})}const Jn=5;function xu(e,t){this._styles=t,e.registerProvider(this)}xu.$inject=["outline","styles"],xu.prototype.getOutline=function(e){const t=this._styles.cls("djs-outline",["no-fill"]);var n;if(CS(e))return n=ve("rect"),se(n,I({x:-Jn,y:-Jn,rx:4,width:e.width+Jn*2,height:e.height+Jn*2},t)),n;if(!De(e))return v(e,"bpmn:Gateway")?(n=ve("rect"),I(n.style,{"transform-box":"fill-box",transform:"rotate(45deg)","transform-origin":"center"}),se(n,I({x:2,y:2,rx:4,width:e.width-4,height:e.height-4},t))):Ie(e,["bpmn:Task","bpmn:SubProcess","bpmn:Group","bpmn:CallActivity"])?(n=ve("rect"),se(n,I({x:-Jn,y:-Jn,rx:14,width:e.width+Jn*2,height:e.height+Jn*2},t))):v(e,"bpmn:EndEvent")?(n=ve("circle"),se(n,I({cx:e.width/2,cy:e.height/2,r:e.width/2+Jn+1},t))):v(e,"bpmn:Event")?(n=ve("circle"),se(n,I({cx:e.width/2,cy:e.height/2,r:e.width/2+Jn},t))):v(e,"bpmn:DataObjectReference")&&_x(e,"bpmn:DataObjectReference")?n=vx(JO,{x:-6,y:-6},t):v(e,"bpmn:DataStoreReference")&&_x(e,"bpmn:DataStoreReference")&&(n=vx(eD,{x:-6,y:-6},t)),n},xu.prototype.updateOutline=function(e,t){if(!De(e))return Ie(e,["bpmn:SubProcess","bpmn:Group"])?(se(t,{width:e.width+Jn*2,height:e.height+Jn*2}),!0):!!Ie(e,["bpmn:Event","bpmn:Gateway","bpmn:DataStoreReference","bpmn:DataObjectReference"])};function _x(e,t){var n;return t==="bpmn:DataObjectReference"?n=tD:t==="bpmn:DataStoreReference"&&(n=nD),e.width===n.width&&e.height===n.height}const iD={__depends__:[Af],__init__:["outlineProvider"],outlineProvider:["type",xu]};var rD='<?xml version="1.0" encoding="UTF-8"?><bpmn:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" targetNamespace="http://bpmn.io/schema/bpmn" id="Definitions_1"><bpmn:process id="Process_1" isExecutable="false"><bpmn:startEvent id="StartEvent_1"/></bpmn:process><bpmndi:BPMNDiagram id="BPMNDiagram_1"><bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="Process_1"><bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="StartEvent_1"><dc:Bounds height="36.0" width="36.0" x="173.0" y="102.0"/></bpmndi:BPMNShape></bpmndi:BPMNPlane></bpmndi:BPMNDiagram></bpmn:definitions>';function wi(e){fo.call(this,e)}ae(wi,fo),wi.Viewer=yr,wi.NavigatedViewer=Ia,wi.prototype.createDiagram=function(){return this.importXML(rD)},wi.prototype._interactionModules=[Ov,Lv,Bv],wi.prototype._modelingModules=[a2,Lc,p2,u2,S2,Ef,M2,tk,wy,fc,ok,ck,Sk,Ck,Pk,Ok,Vk,Kk,qp,nO,lO,xO,EO,Db,qO,QO,iD],wi.prototype._modules=[].concat(yr.prototype._modules,wi.prototype._interactionModules,wi.prototype._modelingModules);const oD=((e,t)=>{const n=e.__vccOpts||e;for(const[i,r]of t)n[i]=r;return n})(Pt.defineComponent({__name:"BpmnModelerView",props:{xml:{}},emits:["ready","imported","import-error"],setup(e,{expose:t,emit:n}){const i=e,r=n,o=Pt.ref();let a;async function s(u){if(!a)throw new Error("modeler not mounted");try{const{warnings:l}=await a.importXML(u),f=Hu(l);return r("imported",f),{warnings:f}}catch(l){throw r("import-error",l),l}}async function c(){if(!a)throw new Error("modeler not mounted");const{xml:u}=await a.saveXML({format:!0});return u??""}return Pt.onMounted(async()=>{a=new wi({container:o.value,moddleExtensions:as}),i.xml&&await s(i.xml),r("ready")}),Pt.watch(()=>i.xml,u=>{u&&a&&s(u)}),Pt.onBeforeUnmount(()=>{a==null||a.destroy(),a=void 0}),t({importXml:s,saveXml:c,getModeler:()=>a}),(u,l)=>(Pt.openBlock(),Pt.createElementBlock("div",{ref_key:"container",ref:o,class:"bpmn-modeler-view"},null,512))}}),[["__scopeId","data-v-a9b41c97"]]);te.APPLY_BPMN_OPS_SCHEMA=a0,te.BPMN_MODDLE_EXTENSIONS=as,te.BWL_MODDLE_SCHEMA=Uf,te.BWL_NS=Wf,te.BWL_PREFIX=wu,te.BWL_SIDES=Eu,te.BpmnModelerView=oD,te.EDITOR=RE,te.FLOW_LABEL_INDENT=Pd,te.HEADLESS_BPMN_MODULES=wv,te.HEADLESS_TEXT_METRICS=oo,te.I18N_NS=$w,te.I18N_PREFIX=yd,te.LABEL_FORK_MARGIN=Gu,te.MVP_FLOW_NODE_TYPES=Ri,te.SYMBOLIC_OP_KINDS=Kf,te.SYMBOLIC_OP_SCHEMA=Xf,te.UNDO_EPISODE_COMMAND=Su,te.applyBpmnOpBatch=mh,te.applyBpmnOps=ph,te.approximateTextWidth=ao,te.auditBpmnGeometry=Nd,te.auditBpmnGeometryXml=oE,te.auditGeometry=Xi,te.auditTargetsOf=ci,te.axisSegmentsOf=gn,te.blackBoxNameRect=zu,te.buildBpmnOpBatch=SE,te.buildRegistryIndex=$d,te.containerBoundarySegments=qo,te.createBpmnEditorController=CE,te.createBpmnModdle=vd,te.createHeadlessBpmnModeler=UT,te.crossedShapesOf=Hn,te.crossingCost=Ai,te.describeProcess=hh,te.describeProcessXml=EE,te.edgeCrossCount=ps,te.edgeCrossingPairsOf=Wu,te.executeAsUndoEpisode=qf,te.forwardThreePointCandidates=Uu,te.geometryFindingKey=Ki,te.installHeadlessBpmnDom=bd,te.isMvpFlowNodeType=Vf,te.labelRectsOf=Ko,te.lineCrossesLabel=Pi,te.lineThroughLabel=Td,te.lineThroughShapeLabel=Ld,te.loadBpmnXml=Fu,te.lowerOps=lh,te.oppositeOverlapCount=Kw,te.oppositeOverlapOf=Cd,te.planBackEdgeBoundaryClearance=Xd,te.planCrossPoolRoute=Ud,te.planEdgeRepair=Gd,te.planLabelLineClearance=th,te.planLabelPlacement=eh,te.planMiddleSegmentShifts=Hd,te.planOppositeOverlapRepair=Qd,te.planSegmentDetours=Fd,te.planShapeLabelClearance=rh,te.repairIntroducedBoundaryHugging=Zd,te.repairIntroducedCrossings=Vd,te.repairIntroducedLabelLines=nh,te.repairIntroducedOppositeOverlaps=Jd,te.repairIntroducedShapeLabelLines=oh,te.repairIntroducedSharedSegmentLabels=ih,te.rerouteIntroducedCrossPoolEdges=Yd,te.resolverServicesOf=uh,te.saveBpmnXml=jw,te.sceneCrossingCost=kd,te.sceneFromDefinitions=Id,te.sceneFromRegistry=At,te.sharedSegmentUnderLabel=ls,te.sharedSpansOf=us,te.unreadableOverlapCount=Mr,te.unreadableOverlapOf=cs,te.validateOps=ch,te.warningMessages=Hu,Object.defineProperty(te,Symbol.toStringTag,{value:"Module"})}));