@g1cloud/bpmn-modeler-next 5.0.0-alpha.40 → 5.0.0-alpha.41

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(ie,At){typeof exports=="object"&&typeof module<"u"?At(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],At):(ie=typeof globalThis<"u"?globalThis:ie||self,At(ie.BpmnModeler={},ie.Vue))})(this,(function(ie,At){"use strict";var AD=Object.defineProperty;var TD=(ie,At,wi)=>At in ie?AD(ie,At,{enumerable:!0,configurable:!0,writable:!0,value:wi}):ie[At]=wi;var Qr=(ie,At,wi)=>TD(ie,typeof At!="symbol"?At+"":At,wi);const wi=["startEvent","endEvent","userTask","serviceTask","task","sendTask","receiveTask","exclusiveGateway","parallelGateway"];function qf(e){return wi.includes(e)}const Yf="http://g1project.net/spec/bpmn/bwl/1.0",Su="bwl",Ru=["top-left","top","top-right","right","bottom-right","bottom","bottom-left","left"],Kf={name:"bwl-hints",uri:Yf,prefix:Su,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"}]}]},Cu="bwl.undoEpisode",Xf=new WeakSet;function t0(e){Xf.has(e)||(e.register(Cu,{preExecute(t){try{t.run()}catch(n){t.error=n}}}),Xf.add(e))}function Zf(e,t){t0(e);const n={run:t};if(e.execute(Cu,n),n.error!==void 0)throw e.canUndo()&&e.undo(),n.error}const Qf=["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"],n0={description:"생략 = 보존, null = 제거.",anyOf:[{type:"string"},{type:"null"}]},i0={type:"object",description:"레인. 배열 선언 순서 = 풀 내 상→하 순서.",properties:{id:{type:"string"},name:{type:"string"}},required:["id"],additionalProperties:!1},r0={type:"object",description:"풀(participant). 레인은 여기 선언하고 노드가 lane 인자로 배정된다 — 별도 레인 op 없음.",properties:{id:{type:"string",description:"문서 내 유일, XML NCName(공백 없이 문자/밑줄로 시작)."},name:{type:"string"},blackBox:{type:"boolean",description:"true = 내부 프로세스 없는 블랙박스 풀."},lanes:{type:"array",items:{$ref:"#/$defs/irLane"}}},required:["id"],additionalProperties:!1},o0={type:"object",description:"플로우 노드. 좌표는 지정하지 않는다 — 배치는 resolver 가 결정한다.",properties:{id:{type:"string"},type:{type:"string",enum:[...wi]},name:{type:"string"},participant:{type:"string",description:"소속 풀 id(협업 문서)."},lane:{type:"string",description:"소속 레인 id(풀 정의에 선언된 것)."}},required:["id","type"],additionalProperties:!1},a0={type:"object",description:"분기 조건 — 게이트웨이가 아닌 플로우에 붙인다. MVP 는 label 만.",properties:{label:{type:"string"}},required:["label"],additionalProperties:!1},s0={type:"object",description:"시퀀스 플로우(같은 풀 안 노드 간).",properties:{id:{type:"string"},source:{type:"string"},target:{type:"string"},name:{type:"string"},condition:{$ref:"#/$defs/irFlowCondition"}},required:["id","source","target"],additionalProperties:!1},c0={type:"object",description:"메시지 플로우(풀 경계를 넘는 연결 — 노드 또는 블랙박스 풀 자체가 끝점).",properties:{id:{type:"string"},source:{type:"string"},target:{type:"string"},name:{type:"string"}},required:["id","source","target"],additionalProperties:!1},u0={type:"object",properties:{id:{type:"string"},name:{type:"string"}},required:["id"],additionalProperties:!1},l0={type:"object",description:"데이터 입출력 연관. 방향 = source→target(태스크→스토어 = 쓰기, 스토어→태스크 = 읽기).",properties:{id:{type:"string"},source:{type:"string"},target:{type:"string"}},required:["source","target"],additionalProperties:!1},p0={type:"object",properties:{id:{type:"string"},text:{type:"string"}},required:["id","text"],additionalProperties:!1},f0={type:"object",description:"연관선(주석 ↔ 요소).",properties:{id:{type:"string"},source:{type:"string"},target:{type:"string"}},required:["source","target"],additionalProperties:!1},d0={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},h0={type:"object",description:"주석 방위 힌트 — 앵커 요소 기준 상대 배치. 있으면 결정적 배치, 없으면 휴리스틱.",properties:{anchor:{type:"string",description:"기준 요소 id."},side:{type:"string",enum:[...Ru]},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 m0={"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:[...wi]}},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"]})},Jf={anyOf:Qf.map(e=>m0[e])},g0={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:i0,irParticipant:r0,irNode:o0,irFlowCondition:a0,irSequenceFlow:s0,irMessageFlow:c0,irDataStore:u0,irDataAssociation:l0,irTextAnnotation:p0,irAssociation:f0,irGroup:d0,bwlPlacement:h0,nullableString:n0,symbolicOp:Jf}};function Pu(e){return Array.prototype.concat.apply([],e)}const zo=Object.prototype.toString,y0=Object.prototype.hasOwnProperty;function Cr(e){return e===void 0}function Bt(e){return e!==void 0}function Jr(e){return e==null}function Ee(e){return zo.call(e)==="[object Array]"}function Vt(e){return zo.call(e)==="[object Object]"}function Pe(e){return zo.call(e)==="[object Number]"}function Wt(e){const t=zo.call(e);return t==="[object Function]"||t==="[object AsyncFunction]"||t==="[object GeneratorFunction]"||t==="[object AsyncGeneratorFunction]"||t==="[object Proxy]"}function wn(e){return zo.call(e)==="[object String]"}function v0(e){if(!Ee(e))throw new Error("must supply array")}function En(e,t){return!Jr(e)&&y0.call(e,t)}function ut(e,t){const n=Qa(t);let i;return D(e,function(r,o){if(n(r,o))return i=r,!1}),i}function ed(e,t){const n=Qa(t);let i=Ee(e)?-1:void 0;return D(e,function(r,o){if(n(r,o))return i=o,!1}),i}function He(e,t){const n=Qa(t);let i=[];return D(e,function(r,o){n(r,o)&&i.push(r)}),i}function D(e,t){let n,i;if(Cr(e))return;const r=Ee(e)?E0:w0;for(let o in e)if(En(e,o)&&(n=e[o],i=t(n,r(o)),i===!1))return n}function _0(e,t){if(Cr(e))return[];v0(e);const n=Qa(t);return e.filter(function(i,r){return!n(i,r)})}function Sn(e,t,n){return D(e,function(i,r){n=t(n,i,r)}),n}function Pr(e,t){return!!Sn(e,function(n,i,r){return n&&t(i,r)},!0)}function Ui(e,t){return!!ut(e,t)}function on(e,t){let n=[];return D(e,function(i,r){n.push(t(i,r))}),n}function Za(e){return e&&Object.keys(e)||[]}function b0(e){return Za(e).length}function eo(e){return on(e,t=>t)}function to(e,t,n={}){return t=Au(t),D(e,function(i){let r=t(i)||"_",o=n[r];o||(o=n[r]=[]),o.push(i)}),n}function td(e,...t){e=Au(e);let n={};return D(t,r=>to(r,e,n)),on(n,function(r,o){return r[0]})}const x0=td;function ri(e,t){t=Au(t);let n=[];return D(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 no(e){return function(t){return Pr(e,function(n,i){return t[i]===n})}}function Au(e){return Wt(e)?e:t=>t[e]}function Qa(e){return Wt(e)?e:t=>t===e}function w0(e){return e}function E0(e){return Number(e)}function Tu(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 vn(e,t){return e.bind(t)}function j(e,...t){return Object.assign(e,...t)}function S0(e,t,n){let i=e;return D(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];Bt(a)&&Jr(s)&&(s=i[r]=isNaN(+a)?{}:[]),Cr(a)?Cr(n)?delete i[r]:i[r]=n:i=s}),e}function ei(e,t){let n={},i=Object(e);return D(t,function(r){r in i&&(n[r]=e[r])}),n}function oi(e,t){let n={},i=Object(e);return D(i,function(r,o){t.indexOf(o)===-1&&(n[o]=r)}),n}function Mu(){}Mu.prototype.get=function(e){return this.$model.properties.get(this,e)},Mu.prototype.set=function(e,t){this.$model.properties.set(this,e,t)};function nd(e,t){this.model=e,this.properties=t}nd.prototype.createType=function(e){var t=this.model,n=this.properties,i=Object.create(Mu.prototype);D(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}),D(a,vn(function(s,c){this.set(c,s)},this))}return o.prototype=i,o.hasType=i.$instanceOf=this.model.hasType,n.defineModel(o,t),n.defineDescriptor(o,e),o};var R0=j(Object.create(null),{String:!0,Boolean:!0,Integer:!0,Real:!0,Element:!0}),id=j(Object.create(null),{String:function(e){return e},Boolean:function(e){return e==="true"},Integer:function(e){return parseInt(e,10)},Real:function(e){return parseFloat(e)}});function ku(e,t){var n=id[e];return n?n(t):t}function Ou(e){return!!R0[e]}function rd(e){return!!id[e]}function an(e,t){var n=e.split(/:/),i,r;if(n.length===1)i=e,r=t;else if(n.length===2)i=n[1],r=n[0];else throw new Error("expected <prefix:localName> or <localName>, got "+e);return e=(r?r+":":"")+i,{name:e,prefix:r,localName:i}}function Ln(e){this.ns=e,this.name=e.name,this.allTypes=[],this.allTypesByName=Object.create(null),this.properties=[],this.propertiesByName=Object.create(null)}Ln.prototype.build=function(){return ei(this,["ns","name","allTypes","allTypesByName","properties","propertiesByName","bodyProperty","idProperty"])},Ln.prototype.addProperty=function(e,t,n){typeof t=="boolean"&&(n=t,t=void 0),this.addNamedProperty(e,n!==!1);var i=this.properties;t!==void 0?i.splice(t,0,e):i.push(e)},Ln.prototype.replaceProperty=function(e,t,n){var i=e.ns,r=this.properties,o=this.propertiesByName,a=e.name!==t.name;if(e.isId){if(!t.isId)throw new Error("property <"+t.ns.name+"> must be id property to refine <"+e.ns.name+">");this.setIdProperty(t,!1)}if(e.isBody){if(!t.isBody)throw new Error("property <"+t.ns.name+"> must be body property to refine <"+e.ns.name+">");this.setBodyProperty(t,!1)}var s=r.indexOf(e);if(s===-1)throw new Error("property <"+i.name+"> not found in property list");r.splice(s,1),this.addProperty(t,n?void 0:s,a),o[i.name]=o[i.localName]=t},Ln.prototype.redefineProperty=function(e,t,n){var i=e.ns.prefix,r=t.split("#"),o=an(r[0],i),a=an(r[1],o.prefix).name,s=this.propertiesByName[a];if(s)this.replaceProperty(s,e,n);else throw new Error("refined property <"+a+"> not found");delete e.redefines},Ln.prototype.addNamedProperty=function(e,t){var n=e.ns,i=this.propertiesByName;t&&(this.assertNotDefined(e,n.name),this.assertNotDefined(e,n.localName)),i[n.name]=i[n.localName]=e},Ln.prototype.removeNamedProperty=function(e){var t=e.ns,n=this.propertiesByName;delete n[t.name],delete n[t.localName]},Ln.prototype.setBodyProperty=function(e,t){if(t&&this.bodyProperty)throw new Error("body property defined multiple times (<"+this.bodyProperty.ns.name+">, <"+e.ns.name+">)");this.bodyProperty=e},Ln.prototype.setIdProperty=function(e,t){if(t&&this.idProperty)throw new Error("id property defined multiple times (<"+this.idProperty.ns.name+">, <"+e.ns.name+">)");this.idProperty=e},Ln.prototype.assertNotTrait=function(e){if((e.extends||[]).length)throw new Error(`cannot create <${e.name}> extending <${e.extends}>`)},Ln.prototype.assertNotDefined=function(e,t){var n=e.name,i=this.propertiesByName[n];if(i)throw new Error("property <"+n+"> already defined; override of <"+i.definedBy.ns.name+"#"+i.ns.name+"> by <"+e.definedBy.ns.name+"#"+e.ns.name+"> not allowed without redefines")},Ln.prototype.hasProperty=function(e){return this.propertiesByName[e]},Ln.prototype.addTrait=function(e,t){t&&this.assertNotTrait(e);var n=this.allTypesByName,i=this.allTypes,r=e.name;r in n||(D(e.properties,vn(function(o){o=j({},o,{name:o.ns.localName,inherited:t}),Object.defineProperty(o,"definedBy",{value:e});var a=o.replaces,s=o.redefines;a||s?this.redefineProperty(o,a||s,a):(o.isBody&&this.setBodyProperty(o),o.isId&&this.setIdProperty(o),this.addProperty(o))},this)),i.push(e),n[r]=e)};function qi(e,t){this.packageMap=Object.create(null),this.typeMap=Object.create(null),this.packages=[],this.properties=t,D(e,vn(this.registerPackage,this))}qi.prototype.getPackage=function(e){return this.packageMap[e]},qi.prototype.getPackages=function(){return this.packages},qi.prototype.registerPackage=function(e){e=j({},e);var t=this.packageMap;od(t,e,"prefix"),od(t,e,"uri"),D(e.types,vn(function(n){this.registerType(n,e)},this)),t[e.uri]=t[e.prefix]=e,this.packages.push(e)},qi.prototype.registerType=function(e,t){e=j({},e,{superClass:(e.superClass||[]).slice(),extends:(e.extends||[]).slice(),properties:(e.properties||[]).slice(),meta:j({},e.meta||{})});var n=an(e.name,t.prefix),i=n.name,r=Object.create(null);D(e.properties,vn(function(o){var a=an(o.name,n.prefix),s=a.name;Ou(o.type)||(o.type=an(o.type,a.prefix).name),j(o,{ns:a,name:s}),r[s]=o},this)),j(e,{ns:n,name:i,propertiesByName:r}),D(e.extends,vn(function(o){var a=an(o,n.prefix),s=this.typeMap[a.name];s.traits=s.traits||[],s.traits.push(i)},this)),this.definePackage(e,t),this.typeMap[i]=e},qi.prototype.mapTypes=function(e,t,n){var i=Ou(e.name)?{name:e.name}:this.typeMap[e.name],r=this;function o(c,u){var l=an(c,Ou(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+">");D(i.superClass,n?a:s),t(i,!n),D(i.traits,a)},qi.prototype.getEffectiveDescriptor=function(e){var t=an(e),n=new Ln(t);this.mapTypes(t,function(r,o){n.addTrait(r,o)});var i=n.build();return this.definePackage(i,i.allTypes[i.allTypes.length-1].$pkg),i},qi.prototype.definePackage=function(e,t){this.properties.define(e,"$pkg",{value:t})};function od(e,t,n){var i=t[n];if(i in e)throw new Error("package with "+n+" <"+i+"> already defined")}function Ar(e){this.model=e}Ar.prototype.set=function(e,t,n){if(!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;C0(n)?i?delete e[r]:delete e.$attrs[Du(t)]:i?r in e?e[r]=n:ad(e,i,n):e.$attrs[Du(t)]=n},Ar.prototype.get=function(e,t){var n=this.getProperty(e,t);if(!n)return e.$attrs[Du(t)];var i=n.name;return!e[i]&&n.isMany&&ad(e,n,[]),e[i]},Ar.prototype.define=function(e,t,n){if(!n.writable){var i=n.value;n=j({},n,{get:function(){return i}}),delete n.value}Object.defineProperty(e,t,n)},Ar.prototype.defineDescriptor=function(e,t){this.define(e,"$descriptor",{value:t})},Ar.prototype.defineModel=function(e,t){this.define(e,"$model",{value:t})},Ar.prototype.getProperty=function(e,t){var n=this.model,i=n.getPropertyDescriptor(e,t);if(i)return i;if(t.includes(":"))return null;const r=n.config.strict;if(typeof r<"u"){const o=new TypeError(`unknown property <${t}> on <${e.$type}>`);if(r)throw o;typeof console<"u"&&console.warn(o)}return null};function C0(e){return typeof e>"u"}function ad(e,t,n){Object.defineProperty(e,t.name,{enumerable:!t.isReference,writable:!0,value:n,configurable:!0})}function Du(e){return e.replace(/^:/,"")}function $n(e,t={}){this.properties=new Ar(this),this.factory=new nd(this,this.properties),this.registry=new qi(e,this.properties),this.typeCache=Object.create(null),this.config=t}$n.prototype.create=function(e,t){var n=this.getType(e);if(!n)throw new Error("unknown type <"+e+">");return new n(t)},$n.prototype.getType=function(e){var t=this.typeCache,n=wn(e)?e:e.ns.name,i=t[n];return i||(e=this.registry.getEffectiveDescriptor(n),i=t[n]=this.factory.createType(e)),i},$n.prototype.createAny=function(e,t,n){var i=an(e),r={$type:e,$instanceOf:function(a){return a===this.$type},get:function(a){return this[a]},set:function(a,s){S0(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}),D(n,function(a,s){Vt(a)&&a.value!==void 0?r[a.name]=a.value:r[s]=a}),r},$n.prototype.getPackage=function(e){return this.registry.getPackage(e)},$n.prototype.getPackages=function(){return this.registry.getPackages()},$n.prototype.getElementDescriptor=function(e){return e.$descriptor},$n.prototype.hasType=function(e,t){t===void 0&&(t=e,e=this);var n=e.$model.getElementDescriptor(e);return t in n.allTypesByName},$n.prototype.getPropertyDescriptor=function(e,t){return this.getElementDescriptor(e).propertiesByName[t]},$n.prototype.getTypeDescriptor=function(e){return this.registry.typeMap[e]};var sd=String.fromCharCode,P0=Object.prototype.hasOwnProperty,A0=/&#(\d+);|&#x([0-9a-f]+);|&(\w+);/ig,Go={amp:"&",apos:"'",gt:">",lt:"<",quot:'"'};Object.keys(Go).forEach(function(e){Go[e.toUpperCase()]=Go[e]});function T0(e,t,n,i){return i?P0.call(Go,i)?Go[i]:"&"+i+";":sd(t||parseInt(n,16))}function Tr(e){return e.length>3&&e.indexOf("&")!==-1?e.replace(A0,T0):e}var cd="non-whitespace outside of root node";function Yi(e){return new Error(e)}function M0(e){return"missing namespace for prefix <"+e+">"}function Ja(e){return{get:e,enumerable:!0}}function k0(e){var t=Object.create(null),n;for(n in e)t[n]=e[n];return t}var ud=Symbol("nameCache");function Lu(e){return e+"$uri"}function O0(e){var t=Object.create(null),n,i;for(n in e)i=e[n],t[i]=i,t[Lu(i)]=n;return t}function es(){return{line:0,column:0}}function D0(e){throw e}function ld(e){if(!this)return new ld(e);var t=e&&e.proxy,n,i,r,o,a=D0,s,c,u,l,f=es,p=!1,d=!1,h="",m=!1,g=!1,S=null,E=!1,x,w,C,P;function L(O){O instanceof Error||(O=Yi(O)),S=O,a(O,f)}function T(O){s&&(O instanceof Error||(O=Yi(O)),s(O,f))}this.on=function(O,$){if(typeof $!="function")throw Yi("required args <name, cb>");switch(O){case"openTag":i=$;break;case"text":n=$;break;case"closeTag":r=$;break;case"error":a=$;break;case"warn":s=$;break;case"cdata":o=$;break;case"attention":l=$;break;case"question":u=$;break;case"comment":c=$;break;default:throw Yi("unsupported event: "+O)}return this},this.ns=function(O){if(typeof O>"u"&&(O={}),typeof O!="object")throw Yi("required args <nsMap={}>");var $=Object.create(null),ne;for(ne in O)$[ne]=O[ne];return g=!0,P=$,this};function B(){x=g?[]:null,w=g?O0(P):null,C=[],f=es,E=!1,S=null,d=!1,h=""}this.parse=function(O){if(typeof O!="string")throw Yi("required args <xml=string>");if(p)throw Yi("parse during stream; call end() first");return B(),k(O),f=es,E=!1,S},this.write=function(O){if(typeof O!="string")throw Yi("required args <xml=string>");return p||(B(),p=!0),S||(h=k(h+O,!0)||""),this},this.end=function(){return p||B(),p=!1,S||k(h),h="",f=es,E=!1,S},this.stop=function(){E=!0};function k(O,$=!1){var ne=null,ge=null,Ve,q=0,ae=!1,de=!1,re=0,ve=0,te,V,G,X,je,Rt,A,_,y,N="",z=0,K;function he(nt,Nt){var Pt=nt.indexOf(":");if(Pt===-1)return nt;var mn=w[nt.substring(0,Pt)];return mn?Nt===mn?nt.substr(Pt+1):mn+nt.substr(Pt):(T(M0(nt.substring(0,Pt))),null)}function Le(){if(K!==null)return K;var nt,Nt,Pt=g&&w.xmlns,mn=g&&m?[]:null,lt=z,zt=N,ln=zt.length,Sr,xn,ii,Qn,Gt,Rr={},Wi=new Set,tn,Ye,et;e:for(;lt<ln;lt++)if(tn=!1,Ye=zt.charCodeAt(lt),!(Ye===32||Ye<14&&Ye>8)){for((Ye<65||Ye>122||Ye>90&&Ye<97)&&Ye!==95&&Ye!==58&&(T("illegal first char attribute name"),tn=!0),et=lt+1;et<ln;et++)if(Ye=zt.charCodeAt(et),!(Ye>96&&Ye<123||Ye>64&&Ye<91||Ye>47&&Ye<59||Ye===46||Ye===45||Ye===95)){if(Ye===32||Ye<14&&Ye>8){T("missing attribute value"),lt=et;continue e}if(Ye===61)break;T("illegal attribute name char"),tn=!0}if(Gt=zt.substring(lt,et),Gt==="xmlns:xmlns"&&(T("illegal declaration of xmlns"),tn=!0),Ye=zt.charCodeAt(et+1),Ye===34)et=zt.indexOf('"',lt=et+2),et===-1&&(et=zt.indexOf("'",lt),et!==-1&&(T("attribute value quote missmatch"),tn=!0));else if(Ye===39)et=zt.indexOf("'",lt=et+2),et===-1&&(et=zt.indexOf('"',lt),et!==-1&&(T("attribute value quote missmatch"),tn=!0));else for(T("missing attribute value quotes"),tn=!0,et=et+1;et<ln&&(Ye=zt.charCodeAt(et+1),!(Ye===32||Ye<14&&Ye>8));et++);for(et===-1&&(T("missing closing quotes"),et=ln,tn=!0),tn||(ii=zt.substring(lt,et)),lt=et;et+1<ln&&(Ye=zt.charCodeAt(et+1),!(Ye===32||Ye<14&&Ye>8));et++)lt===et&&(T("illegal character after attribute end"),tn=!0);if(lt=et+1,tn)continue e;if(Wi.has(Gt)){T("attribute <"+Gt+"> already defined");continue}if(Wi.add(Gt),!g){Rr[Gt]=ii;continue}if(m){if(xn=Gt==="xmlns"?"xmlns":Gt.charCodeAt(0)===120&&Gt.substr(0,6)==="xmlns:"?Gt.substr(6):null,xn!==null){if(nt=Tr(ii),Nt=Lu(xn),Qn=P[nt],!Qn){if(xn==="xmlns"||Nt in w&&w[Nt]!==nt)do Qn="ns"+q++;while(typeof w[Qn]<"u");else Qn=xn;P[nt]=Qn}w[xn]!==Qn&&(Sr||(w=k0(w),Sr=!0),w[xn]=Qn,xn==="xmlns"&&(w[Lu(Qn)]=nt,Pt=Qn),w[Nt]=nt),Rr[Gt]=ii;continue}mn.push(Gt,ii);continue}Gt=he(Gt,Pt),Gt!==null&&(Rr[Gt]=ii)}if(m)for(lt=0,ln=mn.length;lt<ln;lt++)Gt=he(mn[lt++],Pt),ii=mn[lt],Gt!==null&&(Rr[Gt]=ii);return K=Rr}function Qe(){for(var nt=/(\r\n|\r|\n)/g,Nt=0,Pt=0,mn=0,lt=ve,zt,ln;re>=mn&&(zt=nt.exec(O),!(!zt||(lt=zt[0].length+zt.index,lt>re)));)Nt+=1,mn=lt;return re==-1?(Pt=lt,ln=O.substring(ve)):ve===0?ln=O.substring(ve,re):(Pt=re-mn,ln=ve==-1?O.substring(re):O.substring(re,ve+1)),{data:ln,line:Nt,column:Pt}}for(f=Qe,t&&(y=Object.create({},{name:Ja(function(){return A}),originalName:Ja(function(){return _}),attrs:Ja(Le),ns:Ja(function(){return w})}));ve!==-1;){if(O.charCodeAt(ve)===60?re=ve:re=O.indexOf("<",ve),re===-1){if($)return O.substring(ve);if(C.length)return L("unexpected end of file");if(!d)return L("missing start tag");ve<O.length&&O.substring(ve).trim()&&T(cd);return}if(d||(d=!0),ve!==re){if(C.length){if(n&&(n(O.substring(ve,re),Tr,f),E))return}else if(O.substring(ve,re).trim()&&(T(cd),E))return}if(X=O.charCodeAt(re+1),X===33){if(G=O.charCodeAt(re+2),G===91&&O.substr(re+3,6)==="CDATA["){if(ve=O.indexOf("]]>",re),ve===-1)return $?O.substring(re):L("unclosed cdata");if(o&&(o(O.substring(re+9,ve),f),E))return;ve+=3;continue}if(G===45&&O.charCodeAt(re+3)===45){if(ve=O.indexOf("-->",re),ve===-1)return $?O.substring(re):L("unclosed comment");if(c&&(c(O.substring(re+4,ve),Tr,f),E))return;ve+=3;continue}}if(X===63){if(ve=O.indexOf("?>",re),ve===-1)return $?O.substring(re):L("unclosed question");if(u&&(u(O.substring(re,ve+2),f),E))return;ve+=2;continue}for(te=re+1;;te++){if(je=O.charCodeAt(te),isNaN(je))return $?O.substring(re):(ve=-1,L("unclosed tag"));if(je===34)G=O.indexOf('"',te+1),te=G!==-1?G:te;else if(je===39)G=O.indexOf("'",te+1),te=G!==-1?G:te;else if(je===62){ve=te;break}}if(X===33){if(l&&(l(O.substring(re,ve+1),Tr,f),E))return;ve+=1;continue}if(K={},X===47){if(ae=!1,de=!0,!C.length)return L("missing open tag");if(te=A=C.pop(),G=re+2+te.length,O.substring(re+2,G)!==te)return L("closing tag mismatch");for(;G<ve;G++)if(X=O.charCodeAt(G),!(X===32||X>8&&X<14))return L("close tag")}else{if(O.charCodeAt(ve-1)===47?(te=A=O.substring(re+1,ve-1),ae=!0,de=!0):(te=A=O.substring(re+1,ve),ae=!0,de=!1),!(X>96&&X<123||X>64&&X<91||X===95||X===58))return L("illegal first char nodeName");for(G=1,V=te.length;G<V;G++)if(X=te.charCodeAt(G),!(X>96&&X<123||X>64&&X<91||X>47&&X<59||X===45||X===95||X==46)){if(X===32||X<14&&X>8){A=te.substring(0,G),K=null;break}return L("invalid nodeName")}de||C.push(A)}if(g){Ve=w,ae&&(de||x.push(Ve),K===null&&(m=te.indexOf("xmlns",G)!==-1)&&(z=G,N=te,Le(),m=!1)),_=A,ge!==w&&(ne=w[ud],ne===void 0&&(ne=w[ud]=Object.create(null)),ge=w);var Ct=ne[A];if(Ct!==void 0)A=Ct;else{if(X=A.indexOf(":"),X!==-1){if(Rt=w[A.substring(0,X)],!Rt)return L("missing namespace on <"+_+">");A=A.substr(X+1)}else Rt=w.xmlns;Rt&&(A=Rt+":"+A),ne[_]=A}}if(ae&&(z=G,N=te,i&&(t?i(y,Tr,de,f):i(A,Le,Tr,de,f),E)))return;if(de){if(r&&(r(t?y:A,Tr,ae,f),E))return;g&&(ae?w=Ve:w=x.pop())}ve+=1}}}function pd(e){return e.xml&&e.xml.tagAlias==="lowerCase"}var Iu={xsi:"http://www.w3.org/2001/XMLSchema-instance",xml:"http://www.w3.org/XML/1998/namespace"},fd="property";function dd(e){return e.xml&&e.xml.serialize}function L0(e){const t=dd(e);return t!==fd&&(t||null)}function I0(e){return e.charAt(0).toUpperCase()+e.slice(1)}function hd(e,t){return pd(t)?e.prefix+":"+I0(e.localName):e.name}function N0(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 B0(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 N0(o,a)}function Ki(e){return new Error(e)}function Ei(e){return e.$descriptor}function $0(e){j(this,e),this.elementsById={},this.references=[],this.warnings=[],this.addReference=function(t){this.references.push(t)},this.addElement=function(t){if(!t)throw Ki("expected element");var n=this.elementsById,i=Ei(t),r=i.idProperty,o;if(r&&(o=t.get(r.name),o)){if(!/^([a-z][\w-.]*:)?[a-z_][\w-.]*$/i.test(o))throw new Error("illegal ID <"+o+">");if(n[o])throw Ki("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 Nu(){}Nu.prototype=Object.create(Vo.prototype),Nu.prototype.handleNode=function(){return this};function io(){}io.prototype=Object.create(Vo.prototype),io.prototype.handleText=function(e){this.body=(this.body||"")+e};function Wo(e,t){this.property=e,this.context=t}Wo.prototype=Object.create(io.prototype),Wo.prototype.handleNode=function(e){if(this.element)throw Ki("expected no sub nodes");return this.element=this.createReference(e),this},Wo.prototype.handleEnd=function(){this.element.id=this.body},Wo.prototype.createReference=function(e){return{property:this.property.ns.name,id:""}};function Bu(e,t){this.element=t,this.propertyDesc=e}Bu.prototype=Object.create(io.prototype),Bu.prototype.handleEnd=function(){var e=this.body||"",t=this.element,n=this.propertyDesc;e=ku(n.type,e),n.isMany?t.get(n.name).push(e):t.set(n.name,e)};function ts(){}ts.prototype=Object.create(io.prototype),ts.prototype.handleNode=function(e){var t=this,n=this.element;return n?t=this.handleChild(e):(n=this.element=this.createElement(e),this.context.addElement(n)),t};function pn(e,t,n){this.model=e,this.type=e.getType(t),this.context=n}pn.prototype=Object.create(ts.prototype),pn.prototype.addReference=function(e){this.context.addReference(e)},pn.prototype.handleText=function(e){var t=this.element,n=Ei(t),i=n.bodyProperty;if(!i)throw Ki("unexpected body text <"+e+">");io.prototype.handleText.call(this,e)},pn.prototype.handleEnd=function(){var e=this.body,t=this.element,n=Ei(t),i=n.bodyProperty;i&&e!==void 0&&(e=ku(i.type,e),t.set(i.name,e))},pn.prototype.createElement=function(e){var t=e.attributes,n=this.type,i=Ei(n),r=this.context,o=new n({}),a=this.model,s;return D(t,function(c,u){var l=i.propertiesByName[u],f;l&&l.isReference?l.isMany?(f=c.split(" "),D(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=ku(l.type,c):u==="xmlns"?u=":"+u:(s=an(u,i.ns.prefix),a.getPackage(s.prefix)&&r.addWarning({message:"unknown attribute <"+u+">",element:o,property:u,value:c})),o.set(u,c))}),o},pn.prototype.getPropertyForNode=function(e){var t=e.name,n=an(t),i=this.type,r=this.model,o=Ei(i),a=n.name,s=o.propertiesByName[a];if(s&&!s.isAttr){const u=L0(s);if(u){const l=e.attributes[u];if(l){const f=B0(l,e.ns,r),p=r.getType(f);return j({},s,{effectiveType:Ei(p).name})}}return s}var c=r.getPackage(n.prefix);if(c){const u=hd(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 j({},s,{effectiveType:Ei(l).name})}else if(s=ut(o.properties,function(u){return!u.isReference&&!u.isAttribute&&u.type==="Element"}),s)return s;throw Ki("unrecognized element <"+n.name+">")},pn.prototype.toString=function(){return"ElementDescriptor["+Ei(this.type).name+"]"},pn.prototype.valueHandler=function(e,t){return new Bu(e,t)},pn.prototype.referenceHandler=function(e){return new Wo(e,this.context)},pn.prototype.handler=function(e){return e==="Element"?new ro(this.model,e,this.context):new pn(this.model,e,this.context)},pn.prototype.handleChild=function(e){var t,n,i,r;if(t=this.getPropertyForNode(e),i=this.element,n=t.effectiveType||t.type,rd(n))return this.valueHandler(t,i);t.isReference?r=this.referenceHandler(t).handleNode(e):r=this.handler(n).handleNode(e);var o=r.element;return o!==void 0&&(t.isMany?i.get(t.name).push(o):i.set(t.name,o),t.isReference?(j(o,{element:i}),this.context.addReference(o)):o.$parent=i),r};function $u(e,t,n){pn.call(this,e,t,n)}$u.prototype=Object.create(pn.prototype),$u.prototype.createElement=function(e){var t=e.name,n=an(t),i=this.model,r=this.type,o=i.getPackage(n.prefix),a=o&&hd(n,o)||t;if(!r.hasType(a))throw Ki("unexpected element <"+e.originalName+">");return pn.prototype.createElement.call(this,e)};function ro(e,t,n){this.model=e,this.context=n}ro.prototype=Object.create(ts.prototype),ro.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)},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 ju(e){e instanceof $n&&(e={model:e}),j(this,{lax:!1},e)}ju.prototype.fromXML=function(e,t,n){var i=t.rootHandler;t instanceof pn?(i=t,t={}):typeof t=="string"?(i=this.handler(t),t={}):typeof i=="string"&&(i=this.handler(i));var r=this.model,o=this.lax,a=new $0(j({},t,{rootHandler:i})),s=new ld({proxy:!0}),c=j0();i.context=a,c.push(i);function u(C,P,L){var T=P(),B=T.line,k=T.column,O=T.data;O.charAt(0)==="<"&&O.indexOf(" ")!==-1&&(O=O.slice(0,O.indexOf(" "))+">");var $="unparsable content "+(O?O+" ":"")+`detected
1
+ (function(ne,At){typeof exports=="object"&&typeof module<"u"?At(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],At):(ne=typeof globalThis<"u"?globalThis:ne||self,At(ne.BpmnModeler={},ne.Vue))})(this,(function(ne,At){"use strict";var OD=Object.defineProperty;var DD=(ne,At,wi)=>At in ne?OD(ne,At,{enumerable:!0,configurable:!0,writable:!0,value:wi}):ne[At]=wi;var Qr=(ne,At,wi)=>DD(ne,typeof At!="symbol"?At+"":At,wi);const wi=["startEvent","endEvent","userTask","serviceTask","task","sendTask","receiveTask","exclusiveGateway","parallelGateway"];function qf(e){return wi.includes(e)}const Yf="http://g1project.net/spec/bpmn/bwl/1.0",Su="bwl",Ru=["top-left","top","top-right","right","bottom-right","bottom","bottom-left","left"],Kf={name:"bwl-hints",uri:Yf,prefix:Su,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"}]}]},Cu="bwl.undoEpisode",Xf=new WeakSet;function n0(e){Xf.has(e)||(e.register(Cu,{preExecute(t){try{t.run()}catch(n){t.error=n}}}),Xf.add(e))}function Zf(e,t){n0(e);const n={run:t};if(e.execute(Cu,n),n.error!==void 0)throw e.canUndo()&&e.undo(),n.error}const Qf=["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"],i0={description:"생략 = 보존, null = 제거.",anyOf:[{type:"string"},{type:"null"}]},r0={type:"object",description:"레인. 배열 선언 순서 = 풀 내 상→하 순서.",properties:{id:{type:"string"},name:{type:"string"}},required:["id"],additionalProperties:!1},o0={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},a0={type:"object",description:"플로우 노드. 좌표는 지정하지 않는다 — 배치는 resolver 가 결정한다.",properties:{id:{type:"string"},type:{type:"string",enum:[...wi]},name:{type:"string"},participant:{type:"string",description:"소속 풀 id(협업 문서)."},lane:{type:"string",description:"소속 레인 id(풀 정의에 선언된 것)."}},required:["id","type"],additionalProperties:!1},s0={type:"object",description:"분기 조건 — 게이트웨이가 아닌 플로우에 붙인다. MVP 는 label 만.",properties:{label:{type:"string"}},required:["label"],additionalProperties:!1},c0={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},u0={type:"object",description:"메시지 플로우(풀 경계를 넘는 연결 — 노드 또는 블랙박스 풀 자체가 끝점).",properties:{id:{type:"string"},source:{type:"string"},target:{type:"string"},name:{type:"string"}},required:["id","source","target"],additionalProperties:!1},l0={type:"object",properties:{id:{type:"string"},name:{type:"string"}},required:["id"],additionalProperties:!1},p0={type:"object",description:"데이터 입출력 연관. 방향 = source→target(태스크→스토어 = 쓰기, 스토어→태스크 = 읽기).",properties:{id:{type:"string"},source:{type:"string"},target:{type:"string"}},required:["source","target"],additionalProperties:!1},f0={type:"object",properties:{id:{type:"string"},text:{type:"string"}},required:["id","text"],additionalProperties:!1},d0={type:"object",description:"연관선(주석 ↔ 요소).",properties:{id:{type:"string"},source:{type:"string"},target:{type:"string"}},required:["source","target"],additionalProperties:!1},h0={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},m0={type:"object",description:"주석 방위 힌트 — 앵커 요소 기준 상대 배치. 있으면 결정적 배치, 없으면 휴리스틱.",properties:{anchor:{type:"string",description:"기준 요소 id."},side:{type:"string",enum:[...Ru]},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 g0={"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:[...wi]}},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"]})},Jf={anyOf:Qf.map(e=>g0[e])},y0={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:r0,irParticipant:o0,irNode:a0,irFlowCondition:s0,irSequenceFlow:c0,irMessageFlow:u0,irDataStore:l0,irDataAssociation:p0,irTextAnnotation:f0,irAssociation:d0,irGroup:h0,bwlPlacement:m0,nullableString:i0,symbolicOp:Jf}};function Pu(e){return Array.prototype.concat.apply([],e)}const zo=Object.prototype.toString,v0=Object.prototype.hasOwnProperty;function Cr(e){return e===void 0}function Bt(e){return e!==void 0}function Jr(e){return e==null}function Ee(e){return zo.call(e)==="[object Array]"}function Vt(e){return zo.call(e)==="[object Object]"}function Pe(e){return zo.call(e)==="[object Number]"}function Wt(e){const t=zo.call(e);return t==="[object Function]"||t==="[object AsyncFunction]"||t==="[object GeneratorFunction]"||t==="[object AsyncGeneratorFunction]"||t==="[object Proxy]"}function wn(e){return zo.call(e)==="[object String]"}function b0(e){if(!Ee(e))throw new Error("must supply array")}function En(e,t){return!Jr(e)&&v0.call(e,t)}function ut(e,t){const n=Qa(t);let i;return D(e,function(r,o){if(n(r,o))return i=r,!1}),i}function ed(e,t){const n=Qa(t);let i=Ee(e)?-1:void 0;return D(e,function(r,o){if(n(r,o))return i=o,!1}),i}function He(e,t){const n=Qa(t);let i=[];return D(e,function(r,o){n(r,o)&&i.push(r)}),i}function D(e,t){let n,i;if(Cr(e))return;const r=Ee(e)?S0:E0;for(let o in e)if(En(e,o)&&(n=e[o],i=t(n,r(o)),i===!1))return n}function _0(e,t){if(Cr(e))return[];b0(e);const n=Qa(t);return e.filter(function(i,r){return!n(i,r)})}function Sn(e,t,n){return D(e,function(i,r){n=t(n,i,r)}),n}function Pr(e,t){return!!Sn(e,function(n,i,r){return n&&t(i,r)},!0)}function Ui(e,t){return!!ut(e,t)}function on(e,t){let n=[];return D(e,function(i,r){n.push(t(i,r))}),n}function Za(e){return e&&Object.keys(e)||[]}function x0(e){return Za(e).length}function eo(e){return on(e,t=>t)}function to(e,t,n={}){return t=Au(t),D(e,function(i){let r=t(i)||"_",o=n[r];o||(o=n[r]=[]),o.push(i)}),n}function td(e,...t){e=Au(e);let n={};return D(t,r=>to(r,e,n)),on(n,function(r,o){return r[0]})}const w0=td;function ri(e,t){t=Au(t);let n=[];return D(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 no(e){return function(t){return Pr(e,function(n,i){return t[i]===n})}}function Au(e){return Wt(e)?e:t=>t[e]}function Qa(e){return Wt(e)?e:t=>t===e}function E0(e){return e}function S0(e){return Number(e)}function Tu(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 vn(e,t){return e.bind(t)}function j(e,...t){return Object.assign(e,...t)}function R0(e,t,n){let i=e;return D(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];Bt(a)&&Jr(s)&&(s=i[r]=isNaN(+a)?{}:[]),Cr(a)?Cr(n)?delete i[r]:i[r]=n:i=s}),e}function ei(e,t){let n={},i=Object(e);return D(t,function(r){r in i&&(n[r]=e[r])}),n}function oi(e,t){let n={},i=Object(e);return D(i,function(r,o){t.indexOf(o)===-1&&(n[o]=r)}),n}function Mu(){}Mu.prototype.get=function(e){return this.$model.properties.get(this,e)},Mu.prototype.set=function(e,t){this.$model.properties.set(this,e,t)};function nd(e,t){this.model=e,this.properties=t}nd.prototype.createType=function(e){var t=this.model,n=this.properties,i=Object.create(Mu.prototype);D(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}),D(a,vn(function(s,c){this.set(c,s)},this))}return o.prototype=i,o.hasType=i.$instanceOf=this.model.hasType,n.defineModel(o,t),n.defineDescriptor(o,e),o};var C0=j(Object.create(null),{String:!0,Boolean:!0,Integer:!0,Real:!0,Element:!0}),id=j(Object.create(null),{String:function(e){return e},Boolean:function(e){return e==="true"},Integer:function(e){return parseInt(e,10)},Real:function(e){return parseFloat(e)}});function ku(e,t){var n=id[e];return n?n(t):t}function Ou(e){return!!C0[e]}function rd(e){return!!id[e]}function an(e,t){var n=e.split(/:/),i,r;if(n.length===1)i=e,r=t;else if(n.length===2)i=n[1],r=n[0];else throw new Error("expected <prefix:localName> or <localName>, got "+e);return e=(r?r+":":"")+i,{name:e,prefix:r,localName:i}}function Ln(e){this.ns=e,this.name=e.name,this.allTypes=[],this.allTypesByName=Object.create(null),this.properties=[],this.propertiesByName=Object.create(null)}Ln.prototype.build=function(){return ei(this,["ns","name","allTypes","allTypesByName","properties","propertiesByName","bodyProperty","idProperty"])},Ln.prototype.addProperty=function(e,t,n){typeof t=="boolean"&&(n=t,t=void 0),this.addNamedProperty(e,n!==!1);var i=this.properties;t!==void 0?i.splice(t,0,e):i.push(e)},Ln.prototype.replaceProperty=function(e,t,n){var i=e.ns,r=this.properties,o=this.propertiesByName,a=e.name!==t.name;if(e.isId){if(!t.isId)throw new Error("property <"+t.ns.name+"> must be id property to refine <"+e.ns.name+">");this.setIdProperty(t,!1)}if(e.isBody){if(!t.isBody)throw new Error("property <"+t.ns.name+"> must be body property to refine <"+e.ns.name+">");this.setBodyProperty(t,!1)}var s=r.indexOf(e);if(s===-1)throw new Error("property <"+i.name+"> not found in property list");r.splice(s,1),this.addProperty(t,n?void 0:s,a),o[i.name]=o[i.localName]=t},Ln.prototype.redefineProperty=function(e,t,n){var i=e.ns.prefix,r=t.split("#"),o=an(r[0],i),a=an(r[1],o.prefix).name,s=this.propertiesByName[a];if(s)this.replaceProperty(s,e,n);else throw new Error("refined property <"+a+"> not found");delete e.redefines},Ln.prototype.addNamedProperty=function(e,t){var n=e.ns,i=this.propertiesByName;t&&(this.assertNotDefined(e,n.name),this.assertNotDefined(e,n.localName)),i[n.name]=i[n.localName]=e},Ln.prototype.removeNamedProperty=function(e){var t=e.ns,n=this.propertiesByName;delete n[t.name],delete n[t.localName]},Ln.prototype.setBodyProperty=function(e,t){if(t&&this.bodyProperty)throw new Error("body property defined multiple times (<"+this.bodyProperty.ns.name+">, <"+e.ns.name+">)");this.bodyProperty=e},Ln.prototype.setIdProperty=function(e,t){if(t&&this.idProperty)throw new Error("id property defined multiple times (<"+this.idProperty.ns.name+">, <"+e.ns.name+">)");this.idProperty=e},Ln.prototype.assertNotTrait=function(e){if((e.extends||[]).length)throw new Error(`cannot create <${e.name}> extending <${e.extends}>`)},Ln.prototype.assertNotDefined=function(e,t){var n=e.name,i=this.propertiesByName[n];if(i)throw new Error("property <"+n+"> already defined; override of <"+i.definedBy.ns.name+"#"+i.ns.name+"> by <"+e.definedBy.ns.name+"#"+e.ns.name+"> not allowed without redefines")},Ln.prototype.hasProperty=function(e){return this.propertiesByName[e]},Ln.prototype.addTrait=function(e,t){t&&this.assertNotTrait(e);var n=this.allTypesByName,i=this.allTypes,r=e.name;r in n||(D(e.properties,vn(function(o){o=j({},o,{name:o.ns.localName,inherited:t}),Object.defineProperty(o,"definedBy",{value:e});var a=o.replaces,s=o.redefines;a||s?this.redefineProperty(o,a||s,a):(o.isBody&&this.setBodyProperty(o),o.isId&&this.setIdProperty(o),this.addProperty(o))},this)),i.push(e),n[r]=e)};function qi(e,t){this.packageMap=Object.create(null),this.typeMap=Object.create(null),this.packages=[],this.properties=t,D(e,vn(this.registerPackage,this))}qi.prototype.getPackage=function(e){return this.packageMap[e]},qi.prototype.getPackages=function(){return this.packages},qi.prototype.registerPackage=function(e){e=j({},e);var t=this.packageMap;od(t,e,"prefix"),od(t,e,"uri"),D(e.types,vn(function(n){this.registerType(n,e)},this)),t[e.uri]=t[e.prefix]=e,this.packages.push(e)},qi.prototype.registerType=function(e,t){e=j({},e,{superClass:(e.superClass||[]).slice(),extends:(e.extends||[]).slice(),properties:(e.properties||[]).slice(),meta:j({},e.meta||{})});var n=an(e.name,t.prefix),i=n.name,r=Object.create(null);D(e.properties,vn(function(o){var a=an(o.name,n.prefix),s=a.name;Ou(o.type)||(o.type=an(o.type,a.prefix).name),j(o,{ns:a,name:s}),r[s]=o},this)),j(e,{ns:n,name:i,propertiesByName:r}),D(e.extends,vn(function(o){var a=an(o,n.prefix),s=this.typeMap[a.name];s.traits=s.traits||[],s.traits.push(i)},this)),this.definePackage(e,t),this.typeMap[i]=e},qi.prototype.mapTypes=function(e,t,n){var i=Ou(e.name)?{name:e.name}:this.typeMap[e.name],r=this;function o(c,u){var l=an(c,Ou(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+">");D(i.superClass,n?a:s),t(i,!n),D(i.traits,a)},qi.prototype.getEffectiveDescriptor=function(e){var t=an(e),n=new Ln(t);this.mapTypes(t,function(r,o){n.addTrait(r,o)});var i=n.build();return this.definePackage(i,i.allTypes[i.allTypes.length-1].$pkg),i},qi.prototype.definePackage=function(e,t){this.properties.define(e,"$pkg",{value:t})};function od(e,t,n){var i=t[n];if(i in e)throw new Error("package with "+n+" <"+i+"> already defined")}function Ar(e){this.model=e}Ar.prototype.set=function(e,t,n){if(!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;P0(n)?i?delete e[r]:delete e.$attrs[Du(t)]:i?r in e?e[r]=n:ad(e,i,n):e.$attrs[Du(t)]=n},Ar.prototype.get=function(e,t){var n=this.getProperty(e,t);if(!n)return e.$attrs[Du(t)];var i=n.name;return!e[i]&&n.isMany&&ad(e,n,[]),e[i]},Ar.prototype.define=function(e,t,n){if(!n.writable){var i=n.value;n=j({},n,{get:function(){return i}}),delete n.value}Object.defineProperty(e,t,n)},Ar.prototype.defineDescriptor=function(e,t){this.define(e,"$descriptor",{value:t})},Ar.prototype.defineModel=function(e,t){this.define(e,"$model",{value:t})},Ar.prototype.getProperty=function(e,t){var n=this.model,i=n.getPropertyDescriptor(e,t);if(i)return i;if(t.includes(":"))return null;const r=n.config.strict;if(typeof r<"u"){const o=new TypeError(`unknown property <${t}> on <${e.$type}>`);if(r)throw o;typeof console<"u"&&console.warn(o)}return null};function P0(e){return typeof e>"u"}function ad(e,t,n){Object.defineProperty(e,t.name,{enumerable:!t.isReference,writable:!0,value:n,configurable:!0})}function Du(e){return e.replace(/^:/,"")}function $n(e,t={}){this.properties=new Ar(this),this.factory=new nd(this,this.properties),this.registry=new qi(e,this.properties),this.typeCache=Object.create(null),this.config=t}$n.prototype.create=function(e,t){var n=this.getType(e);if(!n)throw new Error("unknown type <"+e+">");return new n(t)},$n.prototype.getType=function(e){var t=this.typeCache,n=wn(e)?e:e.ns.name,i=t[n];return i||(e=this.registry.getEffectiveDescriptor(n),i=t[n]=this.factory.createType(e)),i},$n.prototype.createAny=function(e,t,n){var i=an(e),r={$type:e,$instanceOf:function(a){return a===this.$type},get:function(a){return this[a]},set:function(a,s){R0(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}),D(n,function(a,s){Vt(a)&&a.value!==void 0?r[a.name]=a.value:r[s]=a}),r},$n.prototype.getPackage=function(e){return this.registry.getPackage(e)},$n.prototype.getPackages=function(){return this.registry.getPackages()},$n.prototype.getElementDescriptor=function(e){return e.$descriptor},$n.prototype.hasType=function(e,t){t===void 0&&(t=e,e=this);var n=e.$model.getElementDescriptor(e);return t in n.allTypesByName},$n.prototype.getPropertyDescriptor=function(e,t){return this.getElementDescriptor(e).propertiesByName[t]},$n.prototype.getTypeDescriptor=function(e){return this.registry.typeMap[e]};var sd=String.fromCharCode,A0=Object.prototype.hasOwnProperty,T0=/&#(\d+);|&#x([0-9a-f]+);|&(\w+);/ig,Go={amp:"&",apos:"'",gt:">",lt:"<",quot:'"'};Object.keys(Go).forEach(function(e){Go[e.toUpperCase()]=Go[e]});function M0(e,t,n,i){return i?A0.call(Go,i)?Go[i]:"&"+i+";":sd(t||parseInt(n,16))}function Tr(e){return e.length>3&&e.indexOf("&")!==-1?e.replace(T0,M0):e}var cd="non-whitespace outside of root node";function Yi(e){return new Error(e)}function k0(e){return"missing namespace for prefix <"+e+">"}function Ja(e){return{get:e,enumerable:!0}}function O0(e){var t=Object.create(null),n;for(n in e)t[n]=e[n];return t}var ud=Symbol("nameCache");function Lu(e){return e+"$uri"}function D0(e){var t=Object.create(null),n,i;for(n in e)i=e[n],t[i]=i,t[Lu(i)]=n;return t}function es(){return{line:0,column:0}}function L0(e){throw e}function ld(e){if(!this)return new ld(e);var t=e&&e.proxy,n,i,r,o,a=L0,s,c,u,l,f=es,p=!1,d=!1,h="",m=!1,g=!1,S=null,E=!1,x,w,C,P;function L(O){O instanceof Error||(O=Yi(O)),S=O,a(O,f)}function T(O){s&&(O instanceof Error||(O=Yi(O)),s(O,f))}this.on=function(O,$){if(typeof $!="function")throw Yi("required args <name, cb>");switch(O){case"openTag":i=$;break;case"text":n=$;break;case"closeTag":r=$;break;case"error":a=$;break;case"warn":s=$;break;case"cdata":o=$;break;case"attention":l=$;break;case"question":u=$;break;case"comment":c=$;break;default:throw Yi("unsupported event: "+O)}return this},this.ns=function(O){if(typeof O>"u"&&(O={}),typeof O!="object")throw Yi("required args <nsMap={}>");var $=Object.create(null),ie;for(ie in O)$[ie]=O[ie];return g=!0,P=$,this};function B(){x=g?[]:null,w=g?D0(P):null,C=[],f=es,E=!1,S=null,d=!1,h=""}this.parse=function(O){if(typeof O!="string")throw Yi("required args <xml=string>");if(p)throw Yi("parse during stream; call end() first");return B(),k(O),f=es,E=!1,S},this.write=function(O){if(typeof O!="string")throw Yi("required args <xml=string>");return p||(B(),p=!0),S||(h=k(h+O,!0)||""),this},this.end=function(){return p||B(),p=!1,S||k(h),h="",f=es,E=!1,S},this.stop=function(){E=!0};function k(O,$=!1){var ie=null,ge=null,Ve,q=0,ae=!1,de=!1,re=0,ve=0,te,V,G,X,je,Rt,A,b,y,N="",z=0,K;function he(nt,Nt){var Pt=nt.indexOf(":");if(Pt===-1)return nt;var mn=w[nt.substring(0,Pt)];return mn?Nt===mn?nt.substr(Pt+1):mn+nt.substr(Pt):(T(k0(nt.substring(0,Pt))),null)}function Le(){if(K!==null)return K;var nt,Nt,Pt=g&&w.xmlns,mn=g&&m?[]:null,lt=z,zt=N,ln=zt.length,Sr,xn,ii,Qn,Gt,Rr={},Wi=new Set,tn,Ye,et;e:for(;lt<ln;lt++)if(tn=!1,Ye=zt.charCodeAt(lt),!(Ye===32||Ye<14&&Ye>8)){for((Ye<65||Ye>122||Ye>90&&Ye<97)&&Ye!==95&&Ye!==58&&(T("illegal first char attribute name"),tn=!0),et=lt+1;et<ln;et++)if(Ye=zt.charCodeAt(et),!(Ye>96&&Ye<123||Ye>64&&Ye<91||Ye>47&&Ye<59||Ye===46||Ye===45||Ye===95)){if(Ye===32||Ye<14&&Ye>8){T("missing attribute value"),lt=et;continue e}if(Ye===61)break;T("illegal attribute name char"),tn=!0}if(Gt=zt.substring(lt,et),Gt==="xmlns:xmlns"&&(T("illegal declaration of xmlns"),tn=!0),Ye=zt.charCodeAt(et+1),Ye===34)et=zt.indexOf('"',lt=et+2),et===-1&&(et=zt.indexOf("'",lt),et!==-1&&(T("attribute value quote missmatch"),tn=!0));else if(Ye===39)et=zt.indexOf("'",lt=et+2),et===-1&&(et=zt.indexOf('"',lt),et!==-1&&(T("attribute value quote missmatch"),tn=!0));else for(T("missing attribute value quotes"),tn=!0,et=et+1;et<ln&&(Ye=zt.charCodeAt(et+1),!(Ye===32||Ye<14&&Ye>8));et++);for(et===-1&&(T("missing closing quotes"),et=ln,tn=!0),tn||(ii=zt.substring(lt,et)),lt=et;et+1<ln&&(Ye=zt.charCodeAt(et+1),!(Ye===32||Ye<14&&Ye>8));et++)lt===et&&(T("illegal character after attribute end"),tn=!0);if(lt=et+1,tn)continue e;if(Wi.has(Gt)){T("attribute <"+Gt+"> already defined");continue}if(Wi.add(Gt),!g){Rr[Gt]=ii;continue}if(m){if(xn=Gt==="xmlns"?"xmlns":Gt.charCodeAt(0)===120&&Gt.substr(0,6)==="xmlns:"?Gt.substr(6):null,xn!==null){if(nt=Tr(ii),Nt=Lu(xn),Qn=P[nt],!Qn){if(xn==="xmlns"||Nt in w&&w[Nt]!==nt)do Qn="ns"+q++;while(typeof w[Qn]<"u");else Qn=xn;P[nt]=Qn}w[xn]!==Qn&&(Sr||(w=O0(w),Sr=!0),w[xn]=Qn,xn==="xmlns"&&(w[Lu(Qn)]=nt,Pt=Qn),w[Nt]=nt),Rr[Gt]=ii;continue}mn.push(Gt,ii);continue}Gt=he(Gt,Pt),Gt!==null&&(Rr[Gt]=ii)}if(m)for(lt=0,ln=mn.length;lt<ln;lt++)Gt=he(mn[lt++],Pt),ii=mn[lt],Gt!==null&&(Rr[Gt]=ii);return K=Rr}function Qe(){for(var nt=/(\r\n|\r|\n)/g,Nt=0,Pt=0,mn=0,lt=ve,zt,ln;re>=mn&&(zt=nt.exec(O),!(!zt||(lt=zt[0].length+zt.index,lt>re)));)Nt+=1,mn=lt;return re==-1?(Pt=lt,ln=O.substring(ve)):ve===0?ln=O.substring(ve,re):(Pt=re-mn,ln=ve==-1?O.substring(re):O.substring(re,ve+1)),{data:ln,line:Nt,column:Pt}}for(f=Qe,t&&(y=Object.create({},{name:Ja(function(){return A}),originalName:Ja(function(){return b}),attrs:Ja(Le),ns:Ja(function(){return w})}));ve!==-1;){if(O.charCodeAt(ve)===60?re=ve:re=O.indexOf("<",ve),re===-1){if($)return O.substring(ve);if(C.length)return L("unexpected end of file");if(!d)return L("missing start tag");ve<O.length&&O.substring(ve).trim()&&T(cd);return}if(d||(d=!0),ve!==re){if(C.length){if(n&&(n(O.substring(ve,re),Tr,f),E))return}else if(O.substring(ve,re).trim()&&(T(cd),E))return}if(X=O.charCodeAt(re+1),X===33){if(G=O.charCodeAt(re+2),G===91&&O.substr(re+3,6)==="CDATA["){if(ve=O.indexOf("]]>",re),ve===-1)return $?O.substring(re):L("unclosed cdata");if(o&&(o(O.substring(re+9,ve),f),E))return;ve+=3;continue}if(G===45&&O.charCodeAt(re+3)===45){if(ve=O.indexOf("-->",re),ve===-1)return $?O.substring(re):L("unclosed comment");if(c&&(c(O.substring(re+4,ve),Tr,f),E))return;ve+=3;continue}}if(X===63){if(ve=O.indexOf("?>",re),ve===-1)return $?O.substring(re):L("unclosed question");if(u&&(u(O.substring(re,ve+2),f),E))return;ve+=2;continue}for(te=re+1;;te++){if(je=O.charCodeAt(te),isNaN(je))return $?O.substring(re):(ve=-1,L("unclosed tag"));if(je===34)G=O.indexOf('"',te+1),te=G!==-1?G:te;else if(je===39)G=O.indexOf("'",te+1),te=G!==-1?G:te;else if(je===62){ve=te;break}}if(X===33){if(l&&(l(O.substring(re,ve+1),Tr,f),E))return;ve+=1;continue}if(K={},X===47){if(ae=!1,de=!0,!C.length)return L("missing open tag");if(te=A=C.pop(),G=re+2+te.length,O.substring(re+2,G)!==te)return L("closing tag mismatch");for(;G<ve;G++)if(X=O.charCodeAt(G),!(X===32||X>8&&X<14))return L("close tag")}else{if(O.charCodeAt(ve-1)===47?(te=A=O.substring(re+1,ve-1),ae=!0,de=!0):(te=A=O.substring(re+1,ve),ae=!0,de=!1),!(X>96&&X<123||X>64&&X<91||X===95||X===58))return L("illegal first char nodeName");for(G=1,V=te.length;G<V;G++)if(X=te.charCodeAt(G),!(X>96&&X<123||X>64&&X<91||X>47&&X<59||X===45||X===95||X==46)){if(X===32||X<14&&X>8){A=te.substring(0,G),K=null;break}return L("invalid nodeName")}de||C.push(A)}if(g){Ve=w,ae&&(de||x.push(Ve),K===null&&(m=te.indexOf("xmlns",G)!==-1)&&(z=G,N=te,Le(),m=!1)),b=A,ge!==w&&(ie=w[ud],ie===void 0&&(ie=w[ud]=Object.create(null)),ge=w);var Ct=ie[A];if(Ct!==void 0)A=Ct;else{if(X=A.indexOf(":"),X!==-1){if(Rt=w[A.substring(0,X)],!Rt)return L("missing namespace on <"+b+">");A=A.substr(X+1)}else Rt=w.xmlns;Rt&&(A=Rt+":"+A),ie[b]=A}}if(ae&&(z=G,N=te,i&&(t?i(y,Tr,de,f):i(A,Le,Tr,de,f),E)))return;if(de){if(r&&(r(t?y:A,Tr,ae,f),E))return;g&&(ae?w=Ve:w=x.pop())}ve+=1}}}function pd(e){return e.xml&&e.xml.tagAlias==="lowerCase"}var Iu={xsi:"http://www.w3.org/2001/XMLSchema-instance",xml:"http://www.w3.org/XML/1998/namespace"},fd="property";function dd(e){return e.xml&&e.xml.serialize}function I0(e){const t=dd(e);return t!==fd&&(t||null)}function N0(e){return e.charAt(0).toUpperCase()+e.slice(1)}function hd(e,t){return pd(t)?e.prefix+":"+N0(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 $0(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 Ki(e){return new Error(e)}function Ei(e){return e.$descriptor}function j0(e){j(this,e),this.elementsById={},this.references=[],this.warnings=[],this.addReference=function(t){this.references.push(t)},this.addElement=function(t){if(!t)throw Ki("expected element");var n=this.elementsById,i=Ei(t),r=i.idProperty,o;if(r&&(o=t.get(r.name),o)){if(!/^([a-z][\w-.]*:)?[a-z_][\w-.]*$/i.test(o))throw new Error("illegal ID <"+o+">");if(n[o])throw Ki("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 Nu(){}Nu.prototype=Object.create(Vo.prototype),Nu.prototype.handleNode=function(){return this};function io(){}io.prototype=Object.create(Vo.prototype),io.prototype.handleText=function(e){this.body=(this.body||"")+e};function Wo(e,t){this.property=e,this.context=t}Wo.prototype=Object.create(io.prototype),Wo.prototype.handleNode=function(e){if(this.element)throw Ki("expected no sub nodes");return this.element=this.createReference(e),this},Wo.prototype.handleEnd=function(){this.element.id=this.body},Wo.prototype.createReference=function(e){return{property:this.property.ns.name,id:""}};function Bu(e,t){this.element=t,this.propertyDesc=e}Bu.prototype=Object.create(io.prototype),Bu.prototype.handleEnd=function(){var e=this.body||"",t=this.element,n=this.propertyDesc;e=ku(n.type,e),n.isMany?t.get(n.name).push(e):t.set(n.name,e)};function ts(){}ts.prototype=Object.create(io.prototype),ts.prototype.handleNode=function(e){var t=this,n=this.element;return n?t=this.handleChild(e):(n=this.element=this.createElement(e),this.context.addElement(n)),t};function pn(e,t,n){this.model=e,this.type=e.getType(t),this.context=n}pn.prototype=Object.create(ts.prototype),pn.prototype.addReference=function(e){this.context.addReference(e)},pn.prototype.handleText=function(e){var t=this.element,n=Ei(t),i=n.bodyProperty;if(!i)throw Ki("unexpected body text <"+e+">");io.prototype.handleText.call(this,e)},pn.prototype.handleEnd=function(){var e=this.body,t=this.element,n=Ei(t),i=n.bodyProperty;i&&e!==void 0&&(e=ku(i.type,e),t.set(i.name,e))},pn.prototype.createElement=function(e){var t=e.attributes,n=this.type,i=Ei(n),r=this.context,o=new n({}),a=this.model,s;return D(t,function(c,u){var l=i.propertiesByName[u],f;l&&l.isReference?l.isMany?(f=c.split(" "),D(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=ku(l.type,c):u==="xmlns"?u=":"+u:(s=an(u,i.ns.prefix),a.getPackage(s.prefix)&&r.addWarning({message:"unknown attribute <"+u+">",element:o,property:u,value:c})),o.set(u,c))}),o},pn.prototype.getPropertyForNode=function(e){var t=e.name,n=an(t),i=this.type,r=this.model,o=Ei(i),a=n.name,s=o.propertiesByName[a];if(s&&!s.isAttr){const u=I0(s);if(u){const l=e.attributes[u];if(l){const f=$0(l,e.ns,r),p=r.getType(f);return j({},s,{effectiveType:Ei(p).name})}}return s}var c=r.getPackage(n.prefix);if(c){const u=hd(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 j({},s,{effectiveType:Ei(l).name})}else if(s=ut(o.properties,function(u){return!u.isReference&&!u.isAttribute&&u.type==="Element"}),s)return s;throw Ki("unrecognized element <"+n.name+">")},pn.prototype.toString=function(){return"ElementDescriptor["+Ei(this.type).name+"]"},pn.prototype.valueHandler=function(e,t){return new Bu(e,t)},pn.prototype.referenceHandler=function(e){return new Wo(e,this.context)},pn.prototype.handler=function(e){return e==="Element"?new ro(this.model,e,this.context):new pn(this.model,e,this.context)},pn.prototype.handleChild=function(e){var t,n,i,r;if(t=this.getPropertyForNode(e),i=this.element,n=t.effectiveType||t.type,rd(n))return this.valueHandler(t,i);t.isReference?r=this.referenceHandler(t).handleNode(e):r=this.handler(n).handleNode(e);var o=r.element;return o!==void 0&&(t.isMany?i.get(t.name).push(o):i.set(t.name,o),t.isReference?(j(o,{element:i}),this.context.addReference(o)):o.$parent=i),r};function $u(e,t,n){pn.call(this,e,t,n)}$u.prototype=Object.create(pn.prototype),$u.prototype.createElement=function(e){var t=e.name,n=an(t),i=this.model,r=this.type,o=i.getPackage(n.prefix),a=o&&hd(n,o)||t;if(!r.hasType(a))throw Ki("unexpected element <"+e.originalName+">");return pn.prototype.createElement.call(this,e)};function ro(e,t,n){this.model=e,this.context=n}ro.prototype=Object.create(ts.prototype),ro.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)},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 ju(e){e instanceof $n&&(e={model:e}),j(this,{lax:!1},e)}ju.prototype.fromXML=function(e,t,n){var i=t.rootHandler;t instanceof pn?(i=t,t={}):typeof t=="string"?(i=this.handler(t),t={}):typeof i=="string"&&(i=this.handler(i));var r=this.model,o=this.lax,a=new j0(j({},t,{rootHandler:i})),s=new ld({proxy:!0}),c=F0();i.context=a,c.push(i);function u(C,P,L){var T=P(),B=T.line,k=T.column,O=T.data;O.charAt(0)==="<"&&O.indexOf(" ")!==-1&&(O=O.slice(0,O.indexOf(" "))+">");var $="unparsable content "+(O?O+" ":"")+`detected
2
2
  line: `+B+`
3
3
  column: `+k+`
4
- nested error: `+C.message;if(L)return a.addWarning({message:$,error:C}),!0;throw Ki($)}function l(C,P){return u(C,P,!0)}function f(){var C=a.elementsById,P=a.references,L,T;for(L=0;T=P[L];L++){var B=T.element,k=C[T.id],O=Ei(B).propertiesByName[T.property];if(k||a.addWarning({message:"unresolved reference <"+T.id+">",element:T.element,property:T.property,value:T.id}),O.isMany){var $=B.get(O.name),ne=$.indexOf(T);ne===-1&&(ne=$.length),k?$[ne]=k:$.splice(ne,1)}else B.set(O.name,k)}}function p(){c.pop().handleEnd()}var d=/^<\?xml /i,h=/ encoding="([^"]+)"/i,m=/^utf-8$/i;function g(C){if(d.test(C)){var P=h.exec(C),L=P&&P[1];!L||m.test(L)||a.addWarning({message:"unsupported document encoding <"+L+">, falling back to UTF-8"})}}function S(C,P){var L=c.peek();try{c.push(L.handleNode(C))}catch(T){u(T,P,o)&&c.push(new Nu)}}function E(C,P){try{c.peek().handleText(C)}catch(L){l(L,P)}}function x(C,P){C.trim()&&E(C,P)}var w=r.getPackages().reduce(function(C,P){return C[P.uri]=P.prefix,C},Object.entries(Iu).reduce(function(C,[P,L]){return C[L]=P,C},r.config&&r.config.nsMap||{}));return s.ns(w).on("openTag",function(C,P,L,T){var B=C.attrs||{},k=Object.keys(B).reduce(function($,ne){var ge=P(B[ne]);return $[ne]=ge,$},{}),O={name:C.name,originalName:C.originalName,attributes:k,ns:C.ns};S(O,T)}).on("question",g).on("closeTag",p).on("cdata",E).on("text",function(C,P,L){x(P(C),L)}).on("error",u).on("warn",l),new Promise(function(C,P){var L;try{s.parse(e),f()}catch($){L=$}var T=i.element;!L&&!T&&(L=Ki("failed to parse document as <"+i.type.$descriptor.name+">"));var B=a.warnings,k=a.references,O=a.elementsById;return L?(L.warnings=B,P(L)):C({rootElement:T,elementsById:O,references:k,warnings:B})})},ju.prototype.handler=function(e){return new $u(this.model,e)};function j0(){var e=[];return Object.defineProperty(e,"peek",{value:function(){return this[this.length-1]}}),e}var F0=`<?xml version="1.0" encoding="UTF-8"?>
5
- `,H0=/<|>|'|"|&|\n\r|\n/g,md=/<|>|&/g;function ai(e){this.prefixMap={},this.uriMap={},this.used={},this.wellknown=[],this.custom=[],this.parent=e,this.defaultPrefixMap=e&&e.defaultPrefixMap||{}}ai.prototype.mapDefaultPrefixes=function(e){this.defaultPrefixMap=e},ai.prototype.defaultUriByPrefix=function(e){return this.defaultPrefixMap[e]},ai.prototype.byUri=function(e){return this.uriMap[e]||this.parent&&this.parent.byUri(e)},ai.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)},ai.prototype.uriByPrefix=function(e){return this.prefixMap[e||"xmlns"]||this.parent&&this.parent.uriByPrefix(e)},ai.prototype.mapPrefix=function(e,t){this.prefixMap[e||"xmlns"]=t},ai.prototype.getNSKey=function(e){return e.prefix!==void 0?e.uri+"|"+e.prefix:e.uri},ai.prototype.logUsed=function(e){var t=e.uri,n=this.getNSKey(e);this.used[n]=this.byUri(t),this.parent&&this.parent.logUsed(e)},ai.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 z0(e){return e.charAt(0).toLowerCase()+e.slice(1)}function G0(e,t){return pd(t)?z0(e):e}function gd(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})}function yd(e){return wn(e)?e:(e.prefix?e.prefix+":":"")+e.localName}function V0(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 W0(e,t){return t.isGeneric?j({localName:t.ns.localName},e):j({localName:G0(t.ns.localName,t.$pkg)},e)}function U0(e,t){return j({localName:t.ns.localName},e)}function q0(e){var t=e.$descriptor;return He(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 Y0={"\n":"#10","\n\r":"#10",'"':"#34","'":"#39","<":"#60",">":"#62","&":"#38"},K0={"<":"lt",">":"gt","&":"amp"};function vd(e,t,n){return e=wn(e)?e:""+e,e.replace(t,function(i){return"&"+n[i]+";"})}function X0(e){return vd(e,H0,Y0)}function Z0(e){return vd(e,md,K0)}function Q0(e){return He(e,function(t){return t.isAttr})}function J0(e){return He(e,function(t){return!t.isAttr})}function Fu(e){this.tagName=e}Fu.prototype.build=function(e){return this.element=e,this},Fu.prototype.serializeTo=function(e){e.appendIndent().append("<"+this.tagName+">"+this.element.id+"</"+this.tagName+">").appendNewLine()};function Mr(){}Mr.prototype.serializeValue=Mr.prototype.serializeTo=function(e){e.append(this.escape?Z0(this.value):this.value)},Mr.prototype.build=function(e,t){return this.value=t,e.type==="String"&&t.search(md)!==-1&&(this.escape=!0),this};function Hu(e){this.tagName=e}gd(Hu,Mr),Hu.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=q0(e),this.parseAttributes(Q0(r)),this.parseContainments(J0(r))),this.parseGenericAttributes(e,i),this},dt.prototype.nsTagName=function(e){var t=this.logNamespaceUsed(e.ns);return W0(t,e)},dt.prototype.nsPropertyTagName=function(e){var t=this.logNamespaceUsed(e.ns);return U0(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}:j({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 Mr().build({type:"String"},t));var n=e.$children;n&&D(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 D(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;D(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;D(e,function(r){var o=i.get(r.name),a=r.isReference,s=r.isMany;if(s||(o=[o]),r.isBody)n.push(new Mr().build(r,o[0]));else if(rd(r.type))D(o,function(u){n.push(new Hu(t.addTagName(t.nsPropertyTagName(r))).build(r,u))});else if(a)D(o,function(u){n.push(new Fu(t.addTagName(t.nsPropertyTagName(r))).build(u))});else{var c=dd(r);D(o,function(u){var l;c?c===fd?l=new dt(t,r):l=new ns(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 ai(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;D(e,function(i){var r=n.get(i.name);if(i.isReference)if(!i.isMany)r=r.id;else{var o=[];D(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),yd(e)},dt.prototype.addAttribute=function(e,t){var n=this.attrs;wn(t)&&(t=X0(t));var i=ed(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=V0(n).concat(t)),D(t,function(i){e.append(" ").append(yd(i.name)).append('="').append(i.value).append('"')})},dt.prototype.serializeTo=function(e){var t=this.body[0],n=t&&t.constructor!==Mr;e.appendIndent().append("<"+this.tagName),this.serializeAttributes(e),e.append(t?">":" />"),t&&(n&&e.appendNewLine().indent(),D(this.body,function(i){i.serializeTo(e)}),n&&e.unindent().appendIndent(),e.append("</"+this.tagName+">")),e.appendNewLine()};function ns(e,t,n){dt.call(this,e,t),this.serialization=n}gd(ns,dt),ns.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},ns.prototype.isLocalNs=function(e){return e.uri===(this.typeNs||this.ns).uri};function ew(){this.value="",this.write=function(e){this.value+=e}}function tw(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 nw(e){e=j({format:!1,preamble:!0},e||{});function t(n,i){var r=i||new ew,o=new tw(r,e.format);e.preamble&&o.append(F0);var a=new dt,s=n.$model;if(a.getNamespaces().mapDefaultPrefixes(iw(s)),a.build(n).serializeTo(o),!i)return r.value}return{toXML:t}}function iw(e){const t=e.config&&e.config.nsMap||{},n={};for(const i in Iu)n[i]=Iu[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 is(e,t){$n.call(this,e,t)}is.prototype=Object.create($n.prototype),is.prototype.fromXML=function(e,t,n){wn(t)||(n=t,t="bpmn:Definitions");var i=new ju(j({model:this,lax:!0},n)),r=i.handler(t);return i.fromXML(e,r)},is.prototype.toXML=function(e,t){var n=new nw(t);return new Promise(function(i,r){try{var o=n.toXML(e);return i({xml:o})}catch(a){return r(a)}})};var rw="BPMN20",ow="http://www.omg.org/spec/BPMN/20100524/MODEL",aw="bpmn",sw=[],cw=[{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"}]}],uw=[{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"}]}],lw={tagAlias:"lowerCase",typePrefix:"t"},pw={name:rw,uri:ow,prefix:aw,associations:sw,types:cw,enumerations:uw,xml:lw},fw="BPMNDI",dw="http://www.omg.org/spec/BPMN/20100524/DI",hw="bpmndi",mw=[{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"]}],gw=[{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"}]}],yw=[],vw={name:fw,uri:dw,prefix:hw,types:mw,enumerations:gw,associations:yw},_w="DC",bw="http://www.omg.org/spec/DD/20100524/DC",xw="dc",ww=[{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}]}],Ew=[],Sw={name:_w,uri:bw,prefix:xw,types:ww,associations:Ew},Rw="DI",Cw="http://www.omg.org/spec/DD/20100524/DI",Pw="di",Aw=[{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"}]}],Tw=[],Mw={tagAlias:"lowerCase"},kw={name:Rw,uri:Cw,prefix:Pw,types:Aw,associations:Tw,xml:Mw},Ow="bpmn.io colors for BPMN",Dw="http://bpmn.io/schema/bpmn/biocolor/1.0",Lw="bioc",Iw=[{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"}]}],Nw=[],Bw=[],$w={name:Ow,uri:Dw,prefix:Lw,types:Iw,enumerations:Nw,associations:Bw},jw="BPMN in Color",Fw="http://www.omg.org/spec/BPMN/non-normative/color/1.0",Hw="color",zw=[{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"}]}],Gw=[],Vw=[],Ww={name:jw,uri:Fw,prefix:Hw,types:zw,enumerations:Gw,associations:Vw};const Uw={bpmn:pw,bpmndi:vw,dc:Sw,di:kw,bioc:$w,color:Ww};function _d(e,t){const n=j({},Uw,e);return new is(n,t)}const qw={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"}},Yw="http://www.omg.org/spec/BPMN/non-normative/extensions/i18n/1.0",bd="i18n",rs={[bd]:qw,[Su]:Kf};function xd(){return _d(rs)}const wd=xd();async function zu(e){const{rootElement:t,warnings:n}=await wd.fromXML(e,"bpmn:Definitions");return{definitions:t,warnings:n}}async function Kw(e){const{xml:t}=await wd.toXML(e,{format:!0});return t}function Gu(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},Xw=/[ᄀ-ᇿ -〿぀-ヿ㐀-鿿가-힯＀-⦆]/;function Zw(e){const t=oo;return Xw.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*Zw(i);return n}function Ed(e=globalThis,{textMeasurement:t="approximate"}={}){if(!(e!=null&&e.SVGElement))throw new Error("installHeadlessBpmnDom: DOM 전역이 없다 — jsdom window 를 전역에 올린 뒤 호출할 것");t==="approximate"&&Qw(e),Jw(e),eE(e),tE(e)}function Qw(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 Jw(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 eE(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 tE(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 os=new Set(["bpmn:Participant","bpmn:Lane","bpmn:Group","bpmn:SubProcess","bpmn:AdHocSubProcess","bpmn:Transaction"]),nE=1,iE=2;function Si(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 Sd=20,Rd=5,Cd=3,Pd=12,rE=Pd*1.2;function Vu(e,t){const n=t.split(/\r?\n/),i=Math.max(...n.map(o=>ao(o,Pd))),r=n.length*rE;return{x:e.x+e.width/2-i/2,y:e.y+e.height/2-r/2,width:i,height:r}}const Ad=1;function fn(e){const t=[];for(let n=0;n+1<e.waypoints.length;n++){const i=e.waypoints[n],r=e.waypoints[n+1];Math.abs(i.y-r.y)<.5&&Math.abs(i.x-r.x)>=.5?t.push({axis:"h",at:i.y,lo:Math.min(i.x,r.x),hi:Math.max(i.x,r.x),dir:r.x>i.x?1:-1}):Math.abs(i.x-r.x)<.5&&Math.abs(i.y-r.y)>=.5&&t.push({axis:"v",at:i.x,lo:Math.min(i.y,r.y),hi:Math.max(i.y,r.y),dir:r.y>i.y?1:-1})}return t}function as(e,t){let n=null;const i=e.type!==t.type;for(const r of fn(e))for(const o of fn(t)){if(r.axis!==o.axis||Math.abs(r.at-o.at)>Ad)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>=Sd&&(!n||s>n.length)&&(n={axis:r.axis,length:s,kind:a})}return n}function Td(e,t){const n=as(e,t);return n&&n.kind==="opposite"?{axis:n.axis,length:n.length}:null}function oE(e,t){let n=0;for(const i of t)i.id!==e.id&&Td(e,i)&&n++;return n}function Ri(e,t){let n=0;for(const i of t)i.id!==e.id&&as(e,i)&&n++;return n}const Md=15,kd=20;function aE(e,t){const n=t.axis==="v"?[e.x,e.x+e.width]:[e.y,e.y+e.height];if(t.at<n[0]-kd||t.at>n[1]+kd)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 Wu=20;function ss(e,t){const n=[];for(const i of t){if(i.axis!==e.axis||Math.abs(i.at-e.at)>Ad)continue;const r=Math.max(e.lo,i.lo),o=Math.min(e.hi,i.hi);o-r<Sd||n.push([r-Wu,o+Wu])}return n}function cs(e,t){const n=e.label;if(!n)return null;let i=null;for(const r of fn(e)){const o=aE(n,r);if(o){for(const a of t)if(a.id!==e.id&&!(i&&a.id>=i.other)){for(const[s,c]of ss(r,fn(a)))if(Math.min(c,o[1])>Math.max(s,o[0])){i={other:a.id,axis:r.axis};break}}}}return i}const sE=1,cE=(e,t,n)=>t.x>=e.x-n&&t.y>=e.y-n&&t.x+t.width<=e.x+e.width+n&&t.y+t.height<=e.y+e.height+n;function uE(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 Uu(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 lE=(e,t)=>e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height,so=1;function Ci(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 Uo(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 Od(e,t){const n=e.label;if(!n)return null;if(fn(e).some(i=>Ci(n,i)))return e.id;for(const i of[...t.edges].filter(r=>r.id!==e.id).sort((r,o)=>r.id.localeCompare(o.id)))if(fn(i).some(r=>Ci(n,r)))return i.id;for(const i of t.shapes.filter(r=>r.container).sort((r,o)=>r.id.localeCompare(o.id)))if(Uo(i).some(r=>Ci(n,r)))return i.id;return null}function jn(e,t){const n=new Set(e.endpoints),i=[];for(const r of t)if(!n.has(r.id)){for(let o=0;o+1<e.waypoints.length;o++)if(uE(e.waypoints[o],e.waypoints[o+1],r,iE)){i.push(r);break}}return i}function pE(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 Dd=(e,t)=>e.endpoints.some(n=>t.endpoints.includes(n));function us(e,t){let n=0;for(const i of t){if(i.id===e.id||Dd(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++)pE(e.waypoints[o],e.waypoints[o+1],i.waypoints[a],i.waypoints[a+1])&&(r=!0);r&&n++}return n}function Pi(e,t){let n=0;for(const i of t)i.id===e.id||Dd(e,i)||us(e,[i])>0&&(n+=i.type===e.type?2:1);return n}function Ld(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++)us(n[i],[n[r]])>0&&(t+=n[i].type===n[r].type?2:1);return t}function qu(e){const t=[],n=e.edges;for(let i=0;i<n.length;i++)for(let r=i+1;r<n.length;r++)if(us(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 Id(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 Nd=e=>e?{members:e}:{},si=e=>e.shapes.filter(t=>!t.container);function fE(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 Bd(e,t){const n=e.label;if(!n)return null;for(const i of[...t.edges].sort((r,o)=>r.id.localeCompare(o.id)))if(fn(i).some(r=>Ci(n,r)))return i.id;for(const i of[...t.shapes].filter(r=>r.container).sort((r,o)=>r.id.localeCompare(o.id)))if(Uo(i).some(r=>Ci(n,r)))return i.id;return null}function qo(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 Ai(e){const t=[],n=e.shapes.filter(p=>!p.container);for(const p of e.edges)for(const d of jn(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(!Uu(h,m,nE))continue;const g=h.id<m.id?[h.id,m.id]:[m.id,h.id];t.push({kind:"shape-overlap",shapes:g,identical:lE(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),S=Math.min(h.y+h.height,m.y+m.height)-Math.max(h.y,m.y);if(g<=Rd||S<=Rd)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[S,E,x,w]of g)w&&Math.abs(E-x)<=Cd&&t.push({kind:"group-on-container-boundary",group:p.id,container:d.id,side:S})}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,S=h.y<m.y+m.height&&m.y<h.y+h.height,E=[["x",h.x+h.width,m.x,S],["x",m.x+m.width,h.x,S],["y",h.y+h.height,m.y,g],["y",m.y+m.height,h.y,g]];for(const[x,w,C,P]of E)if(P&&Math.abs(w-C)<=Cd){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=as(h,m);if(!g)continue;const S=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:S,axis:g.axis,length:Math.round(g.length)})}for(const p of e.edges){if(!p.label)continue;const d=cs(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=Od(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=Bd(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 qo(e))d===p.id||u.has(d)||Uu(p.label,h,so)&&t.push({kind:"pool-name-over-label",pool:p.id,label:d});const l=qo(e);for(const p of n)if(p.type==="bpmn:TextAnnotation")for(const{owner:d,rect:h}of l)d!==p.id&&Uu(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??fE(p,e,f);if(!d)continue;const h=f.get(d);!h||!h.container||cE(h,p,sE)||t.push({kind:"shape-outside-container",shape:p.id,container:h.id})}return t.sort((p,d)=>Si(p).localeCompare(Si(d)))}const ht=e=>typeof e=="object"&&e!==null?e:void 0,xt=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 dE(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 hE(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(os.has(i)&&i!=="bpmn:Lane"&&i!=="bpmn:Group")return kr(n)}function $d(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),S=typeof(g==null?void 0:g.id)=="string"?g.id:void 0;if(!S)continue;const E=typeof(g==null?void 0:g.$type)=="string"?g.$type:"",x=ht(m.bounds);if(x){const C=m.isExpanded===!1&&E!=="bpmn:Participant",P=ht((u=ht(m.label))==null?void 0:u.bounds),L={id:S,type:E,x:xt(x.x),y:xt(x.y),width:xt(x.width),height:xt(x.height),container:os.has(E)&&!C,attached:(g==null?void 0:g.attachedToRef)!==void 0,...g?{parent:hE(g,r)}:{},...P?{label:{x:xt(P.x),y:xt(P.y),width:xt(P.width),height:xt(P.height)}}:{},...E==="bpmn:Group"?Nd(Id(g)):{}},T=m.isHorizontal!==!1,B=typeof(g==null?void 0:g.name)=="string"?g.name:"";o.has(S)&&T&&B&&(L.label=Vu(L,B)),t.push(L);continue}const w=m.waypoint;if(Array.isArray(w)){const C=ht((l=ht(m.label))==null?void 0:l.bounds);n.push({id:S,type:E,waypoints:w.map(P=>{var L,T;return{x:xt((L=ht(P))==null?void 0:L.x),y:xt((T=ht(P))==null?void 0:T.y)}}),endpoints:dE(g),...C?{label:{x:xt(C.x),y:xt(C.y),width:xt(C.width),height:xt(C.height)}}:{}})}}}return{shapes:t,edges:n}}function jd(e){return Ai($d(e))}async function mE(e){const{definitions:t,warnings:n}=await zu(e);return{findings:jd(t),warnings:n}}function Et(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:xt(g.x),y:xt(g.y)})),endpoints:[kr(o.source),kr(o.target)].filter(g=>!!g),...m&&typeof m.x=="number"?{label:{x:m.x,y:xt(m.y),width:xt(m.width),height:xt(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&&os.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:xt(o.width),height:xt(o.height),container:os.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:xt(u.y),width:xt(u.width),height:xt(u.height)}}:{},...a==="bpmn:Group"?Nd(Id(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=Vu(d,h)),t.push(d)}return{shapes:t,edges:n}}const gE={"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 yE(e,t){const n=gE[e];return n||(e==="label"||e.startsWith("bpmndi:")?"other":e.startsWith("bpmn:")&&!("waypoints"in t&&t.waypoints)?"flowNode":"other")}function Fd(e){let t=e.parent;for(;t;){if(t.type==="bpmn:Participant")return t.id;t=t.parent}}function Hd(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 yE(i.type,i)},lanesOf:n=>t().filter(i=>i.type==="bpmn:Lane"&&Fd(i)===n).sort((i,r)=>i.y-r.y).map(i=>i.id),participantOf:n=>{const i=e.get(n);return i?Fd(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 zd=20,vE=4,Tt=(e,t)=>Math.abs(e-t)<.5;function Gd(e,t,n,i=zd){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 Vd(e,t,n=zd){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 Yu(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 Wd=30,_E=[0,-25,25,-40,40];function bE(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+Wd:s-Wd,u=a?i.y+i.height:i.y,l=n.x+n.width/2,f=i.x+i.width/2;return _E.map(p=>[{x:l,y:s},{x:l,y:c},{x:f+p,y:c},{x:f+p,y:u}])}const xE=(e,t,n)=>[...e.slice(0,t+1),...n,...e.slice(t+1)],ls=(e,t,n)=>jn({...e,waypoints:t},n).length;function Ud(e,t,n,i){let r=[...e.waypoints],o=ls(e,r,t);if(o===0)return null;let a=!1;for(const f of Yu(e,t))if(ls(e,f,t)===0)return f;const s=(i??[]).filter(f=>f.id!==e.id).flatMap(fn),c=f=>fn({...e,waypoints:f}).some(p=>ss(p,s).length>0),u=bE(e,t).filter(f=>ls(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<vE&&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)||jn({...e,waypoints:[h,m]},[g]).length===0)continue;const S=Gd(h,m,g),E=S?S.map(w=>xE(r,d,w)):Vd(r,g)??[];if(!E.length)continue;const x=[...E].sort((w,C)=>Number(l(C))-Number(l(w)));for(const w of x){const C=ls(e,w,t);if(C<o){r=w,o=C,p=!0,a=!0;break}}if(p)break}}if(!p)break}return a&&o===0?r:null}function qd(e,t){const{elementRegistry:n}=e,i=e.modeling,r=Et(n),o=si(r),a=Ai(r).filter(c=>c.kind==="edge-crosses-shape"&&!t.has(Si(c)));if(!a.length)return;const s=new Map;for(const c of a){if(c.kind!=="edge-crosses-shape"||s.has(c.edge))continue;const u=r.edges.find(l=>l.id===c.edge);u&&s.set(c.edge,u)}for(const[c,u]of s){const l=n.get(c);if(!l)continue;const 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=Ud(u,o,p,r.edges);if(!d)continue;const h=r.edges.filter(S=>S.id!==c),m=Ri(u,h);Ri({...u,waypoints:d},h)>m||i.updateWaypoints(l,d)}}const wE=10;function Yd(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 Kd(e,t){if(e.waypoints.length<2||e.endpoints.length!==2)return null;const n=t.shapes.filter($=>$.type==="bpmn:Participant"&&$.container),i=t.shapes.find($=>$.id===e.endpoints[0]),r=t.shapes.find($=>$.id===e.endpoints[1]);if(!i||!r)return null;const o=Yd(i,n),a=Yd(r,n);if(!o||!a||o.id===a.id)return null;const s=a.y>o.y,c=s?o:a,u=s?a:o,l=n.filter($=>$.id!==o.id&&$.id!==a.id&&$.y>=c.y+c.height&&$.y+$.height<=u.y).sort(($,ne)=>$.y-ne.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,S=e.waypoints[0],E=e.waypoints[e.waypoints.length-1],x=si(t),w=t.edges.filter($=>$.id!==e.id),C=Pi(e,w),P=jn(e,x).length;if(C===0&&P===0||P===0&&e.waypoints.length===2)return null;const L=Math.min(...l.map($=>$.x)),T=Math.max(...l.map($=>$.x+$.width)),B=(S.x+E.x)/2,k=$=>$.filter((ne,ge)=>ge===0||!(Tt(ne.x,$[ge-1].x)&&Tt(ne.y,$[ge-1].y)));let O;for(let $=L;$<=T;$+=wE){const ne=k([S,{x:S.x,y:m},{x:$,y:m},{x:$,y:g},{x:E.x,y:g},E]),ge={...e,waypoints:ne};if(jn(ge,x).length>0)continue;const Ve=Pi(ge,w),q=Math.abs($-B);(!O||Ve<O.cross||Ve===O.cross&&q<O.detour)&&(O={pts:ne,cross:Ve,detour:q})}return O&&(P>0?O.cross<=C:O.cross<C)?O.pts:null}function Xd(e,t){const{elementRegistry:n}=e,i=e.modeling,r=Et(n);for(const o of r.edges){if(o.type!=="bpmn:MessageFlow"||t.has(o.id))continue;const a=Et(n),s=a.edges.find(l=>l.id===o.id);if(!s)continue;const c=Kd(s,a);if(!c)continue;const u=n.get(o.id);u&&i.updateWaypoints(u,c)}}const co=[25,-25,40,-40],ps=35;function Zd(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-ps:n.y+n.height+ps,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 C=a+w;f.push({pts:[{x:C,y:u},{x:C,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,S=s?i.y+i.height+ps:i.y-ps;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 C=a+w;f.push({pts:[{x:C,y:h},{x:C,y:S},{x,y:S},{x,y:g}],cost:m+Math.abs(E)+Math.abs(w)})}}return f}const fs=30;function Qd(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)<fs||Math.abs(i.y-(s.y+s.height))<fs)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)<fs||Math.abs(i.x-(s.x+s.width))<fs)return!0}}return!1}const ds=40;function EE(e,t,n){let i=0;for(const r of t){if(r.container||n.includes(r.id))continue;const o=r.x-ds,a=r.x+r.width+ds,s=r.y-ds,c=r.y+r.height+ds;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 Jd(e,t){if(e.type!=="bpmn:SequenceFlow")return null;const n=t.shapes.filter(P=>P.container),i=new Map(t.shapes.map(P=>[P.id,P])),r=si(t),o=t.edges.filter(P=>P.id!==e.id),a=Ri(e,o),s=Pi(e,o),c=P=>EE(P,t.shapes,e.endpoints)+(Qd(P,n)?1:0),u=c(e.waypoints),l=P=>{if(!P)return;const L=P.x+P.width/2,T=P.y+P.height/2;return n.find(B=>B.type==="bpmn:Lane"&&L>=B.x&&L<=B.x+B.width&&T>=B.y&&T<=B.y+B.height)},f=l(i.get(e.endpoints[0]??"")),p=l(i.get(e.endpoints[1]??"")),d=!!f&&!!p&&f.id!==p.id,h=P=>{if(!d||!p)return!1;for(let L=1;L<P.length-2;L++){const T=P[L],B=P[L+1];if(Tt(T.y,B.y)&&!Tt(T.x,B.x)&&T.y>p.y&&T.y<p.y+p.height)return!0}return!1},m=h(e.waypoints),S=(P=>{if(!P)return;const L=P.x+P.width/2,T=P.y+P.height/2;return n.filter(B=>B.type==="bpmn:Participant"&&L>=B.x&&L<=B.x+B.width&&T>=B.y&&T<=B.y+B.height).sort((B,k)=>B.width*B.height-k.width*k.height)[0]})(i.get(e.endpoints[0]??"")),E=P=>{if(!S)return 0;let L=0;for(let T=1;T<P.length-1;T++){const B=P[T];(B.x<S.x||B.x>S.x+S.width||B.y<S.y||B.y>S.y+S.height)&&L++}return L},x=E(e.waypoints);if(!Qd(e.waypoints,n)&&!(d&&!m)&&x===0)return null;const w=P=>P.reduce((L,T,B)=>B?L+Math.abs(T.x-P[B-1].x)+Math.abs(T.y-P[B-1].y):0,0);let C;for(const{pts:P,cost:L}of Zd(e,i)){const T={...e,waypoints:P};if(jn(T,r).length>0)continue;const B=Ri(T,o);if(B>a)continue;const k=E(P);if(k>x)continue;const O=k<x&&B===0;if(!O&&Pi(T,o)>s)continue;const $=c(P),ne=h(P);if(!O&&!(ne&&!m)&&$>=u)continue;const Ve=ne?0:1,q=w(P);(!C||k<C.out||k===C.out&&(Ve<C.lane||Ve===C.lane&&(B<C.opp||B===C.opp&&($<C.sc||$===C.sc&&(L<C.cost||L===C.cost&&q<C.len)))))&&(C={pts:P,out:k,sc:$,lane:Ve,opp:B,cost:L,len:q})}return(C==null?void 0:C.pts)??null}function SE(e,t){const{elementRegistry:n}=e,i=e.modeling,r=Et(n).edges.filter(o=>!t.has(o.id)&&o.waypoints.length>=4).map(o=>o.id).sort();for(const o of r){const a=Et(n),s=a.edges.find(d=>d.id===o);if(!s||s.waypoints.length<4)continue;const c=si(a),u=a.edges.filter(d=>d.id!==o),l=jn(s,c).length,f=Ri(s,u),p=Pi(s,u);for(const d of Yu(s,a.shapes)){if(d.length>=s.waypoints.length)continue;const h={...s,waypoints:d};if(jn(h,c).length>l||Ri(h,u)>f||Pi(h,u)>p)continue;const m=n.get(o);m&&i.updateWaypoints(m,d);break}}}function eh(e,t){const{elementRegistry:n}=e,i=e.modeling,r=Et(n).edges.filter(o=>o.type==="bpmn:SequenceFlow"&&!t.has(o.id)).map(o=>o.id).sort();for(const o of r){const a=Et(n),s=a.edges.find(l=>l.id===o);if(!s)continue;const c=Jd(s,a);if(!c)continue;const u=n.get(o);u&&i.updateWaypoints(u,c)}}function RE(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 th(e,t){const n=new Map(t.shapes.map(l=>[l.id,l])),i=si(t),r=t.edges.filter(l=>l.id!==e.id),o=Ri(e,r);if(o===0)return null;const a=Pi(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=[...Zd(e,n),...RE(e,n)];for(const{pts:l,cost:f}of u){const p={...e,waypoints:l};if(jn(p,i).length>0)continue;const d=Ri(p,r),h=Pi(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 nh(e,t,n){const{elementRegistry:i}=e,r=e.modeling,o=Et(i),a=Ai(o).filter(l=>(l.kind==="edge-overlap-opposite"||l.kind==="edge-overlap-mixed")&&!t.has(Si(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=Et(i),p=f.edges.find(m=>m.id===l);if(!p)continue;const d=th(p,f);if(!d)continue;const h=i.get(l);h&&r.updateWaypoints(h,d)}}const CE=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 ih(e,t){const n=e.label;if(!n)return null;const i=t.edges.filter(a=>a.id!==e.id);if(!cs(e,i))return null;const r=si(t),o=i.flatMap(fn);for(const a of fn(e)){let s=[[a.lo,a.hi]];for(const[d,h]of ss(a,o))s=s.flatMap(([m,g])=>{const S=[];return d>m&&S.push([m,Math.min(g,d)]),h<g&&S.push([Math.max(m,h),g]),S.filter(([E,x])=>x>E)});const c=a.axis==="h"?n.width:n.height,u=s.find(([d,h])=>h-d>=c+CE*2);if(!u)continue;const l=(u[0]+u[1])/2,f=a.axis==="h"?{x:l,y:a.at-Md}:{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(!cs({...e,label:p},i)&&!r.some(d=>!e.endpoints.includes(d.id)&&PE(p,d)))return p}return null}const Rn=8;function rh(e,t){const n=e.label;if(!n)return null;const i=fn(e);if(!i.length)return null;const r=n.x+n.width/2,o=n.y+n.height/2,a=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(fn),...t.shapes.filter(p=>p.container).flatMap(Uo)],u=p=>!c.some(d=>Ci(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 oh(e,t){const{elementRegistry:n}=e,i=e.modeling,r=Et(n);for(const o of r.edges){if(!o.label||t.has(o.id))continue;const a=rh(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 ah(e,t,n){const{elementRegistry:i}=e,r=e.modeling,o=Et(i),a=Ai(o).filter(s=>s.kind==="label-on-shared-segment"&&!t.has(Si(s)));for(const s of a){if(s.kind!=="label-on-shared-segment"||n.has(s.edge))continue;const c=o.edges.find(p=>p.id===s.edge);if(!c)continue;const u=ih(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 sh(e,t){const n=e.label;if(!n)return null;const i=[...t.edges.flatMap(fn),...t.shapes.filter(p=>p.container).flatMap(Uo)],r=i.filter(p=>Ci(n,p));if(!r.length)return null;const o=t.shapes.filter(p=>!p.container&&p.id!==e.id),a=qo(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=>Ci(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 ch(e,t){const{elementRegistry:n}=e,i=e.modeling,r=Et(n);for(const o of r.shapes){if(o.container||!o.label||t.has(o.id))continue;const a=sh(o,Et(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 AE=/^[\p{L}_][\p{L}\p{N}_.\-]*$/u,uh=new Set(["sequenceFlow","messageFlow","dataAssociation","association"]),lh={"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}]},hs=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),Ku=e=>typeof e=="string"&&e!=="";function TE(e){const t=[];function n(i,r,o,a){if(a===null){Ku(o)||t.push({kind:"payload-invalid",opIndex:i,field:r});return}if(!hs(o)){t.push({kind:"payload-invalid",opIndex:i,field:r});return}for(const s of a)Ku(o[s])||t.push({kind:"payload-invalid",opIndex:i,field:`${r}.${s}`})}return e.forEach((i,r)=>{if(!hs(i)||!Ku(i.kind)||!(i.kind in lh)){t.push({kind:"payload-invalid",opIndex:r,field:"kind"});return}for(const o of lh[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(!hs(u))break;u=u[f]}if(!hs(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 ph(e,t){const n=TE(e);if(n.length>0)return n;const i=[],r=new Map,o=new Map;function a(p,d,h){if(!AE.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:S,name:E,condition:x}=p.flow,w=u(d,g,"source",["flowNode"]),C=u(d,S,"target",["flowNode"]);w&&C&&c(g)!==c(S)&&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:S}=p.flow,E=u(d,g,"source",["flowNode","participant"]),x=u(d,S,"target",["flowNode","participant"]);if(E&&x){const w=c(g),C=c(S);w!==void 0&&w===C&&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 S=m.source===p.dataStore.id?m.target:m.source;u(d,S,"dataAssociation",["flowNode"])}break}case"dataAssociation.add":{const{source:m,target:g}=p.association,S=u(d,m,"source"),E=u(d,g,"target");if(S&&E){const x=new Set([S,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:S}=p.association,E=u(d,g,"source"),x=u(d,S,"target");E&&x&&E!=="annotation"&&x!=="annotation"&&i.push({kind:"association-detached",opIndex:d,annotation:m??`${g}->${S}`});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 S=m===p.annotation.id?g:m;u(d,S,"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&&uh.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 S=g.filter(E=>m.includes(E));S.length===m.length&&S.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,S=t.endpointsOf(p.id),E=p.source??(S==null?void 0:S.source),x=p.target??(S==null?void 0:S.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&&uh.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 fh(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 ms(e){return`bpmn:${e[0].toUpperCase()}${e.slice(1)}`}const gs={"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]},Xt=10,dh=40,ME=10;function Xu(e,t,n,i,r){const o=n,a=(k,O)=>{const[$,ne]=gs[k];let ge={x:t.x+t.width/2+$*(t.width/2+o.width/2+O),y:t.y+t.height/2+ne*(t.height/2+o.height/2+O)};const Ve=i.x+Xt+o.width/2,q=i.x+i.width-Xt-o.width/2,ae=i.y+Xt+o.height/2,de=i.y+i.height-Xt-o.height/2,re={x:Math.min(q,Math.max(Ve,ge.x)),y:Math.min(de,Math.max(ae,ge.y))};return(re.x!==ge.x||re.y!==ge.y)&&(ge=Math.abs(re.x-(t.x+t.width/2))<(t.width+o.width)/2+Xt&&Math.abs(re.y-(t.y+t.height/2))<(t.height+o.height)/2+Xt?{x:t.x+t.width+Xt+o.width/2,y:re.y}:re),ge},s=(i.children??[]).filter(k=>!("waypoints"in k&&k.waypoints)&&k.type!=="bpmn:Lane"&&k.type!=="label"&&typeof k.x=="number"&&k.id!==r.selfId),c=Et(e),u=k=>{var $,ne;if(!r.selfId)return!1;const O=e.get(k);return!!O&&((($=O.source)==null?void 0:$.id)===r.selfId||((ne=O.target)==null?void 0:ne.id)===r.selfId)},l=c.edges.filter(k=>!u(k.id)).flatMap(fn),f=qo(c).filter(k=>k.owner!==r.selfId).map(k=>k.rect),p=k=>({x0:k.x-o.width/2-Xt,x1:k.x+o.width/2+Xt,y0:k.y-o.height/2-Xt,y1:k.y+o.height/2+Xt}),d=k=>{const O=p(k);return s.some($=>O.x0<$.x+$.width&&O.x1>$.x&&O.y0<$.y+$.height&&O.y1>$.y)},h=k=>{const O=p(k);return l.some($=>$.axis==="h"?$.at>O.y0&&$.at<O.y1&&$.lo<O.x1&&$.hi>O.x0:$.at>O.x0&&$.at<O.x1&&$.lo<O.y1&&$.hi>O.y0)},m=k=>{const O=p(k);return f.some($=>O.x0<$.x+$.width&&O.x1>$.x&&O.y0<$.y+$.height&&O.y1>$.y)},g=c.shapes.filter(k=>k.type==="bpmn:Group").flatMap(k=>[{axis:"h",at:k.y,lo:k.x,hi:k.x+k.width},{axis:"h",at:k.y+k.height,lo:k.x,hi:k.x+k.width},{axis:"v",at:k.x,lo:k.y,hi:k.y+k.height},{axis:"v",at:k.x+k.width,lo:k.y,hi:k.y+k.height}]),S=k=>{const O=p(k);return g.some($=>$.axis==="h"?$.at>O.y0&&$.at<O.y1&&$.lo<O.x1&&$.hi>O.x0:$.at>O.x0&&$.at<O.x1&&$.lo<O.y1&&$.hi>O.y0)},E=k=>d(k)||h(k)||m(k)||S(k),x=k=>k.x-o.width/2>=i.x&&k.x+o.width/2<=i.x+i.width&&k.y-o.height/2>=i.y&&k.y+o.height/2<=i.y+i.height;if(r.placement){const k=q=>q.startsWith("top")?q.replace(/^top/,"bottom"):q.replace(/^bottom/,"top"),O=q=>q.endsWith("left")?q.replace(/left$/,"right"):q.replace(/right$/,"left"),$=r.placement.side,ne=[$,k($),O($),k(O($)),"top","bottom","left","right","top-left","top-right","bottom-left","bottom-right"],ge=r.placement.offset??50;let Ve=a($,ge);if(E(Ve)){const q=new Set;for(const ae of ne){if(q.has(ae))continue;q.add(ae);const de=a(ae,ge);if(x(de)&&!E(de)){Ve=de;break}}}return Ve}const w=r.from,C=i.x+Xt+o.width/2,P=i.x+i.width-Xt-o.width/2,L=i.y+Xt+o.height/2,T=i.y+i.height-Xt-o.height/2;let B={x:Math.min(P,Math.max(C,w.x)),y:Math.min(T,Math.max(L,w.y))};if(E(B)){const k=(t.width+o.width)/2+Xt,$=[{x:B.x+k,y:B.y},{x:B.x-k,y:B.y},{x:B.x,y:B.y-o.height-Xt},{x:B.x,y:B.y+o.height+Xt}].filter(x).find(ne=>!E(ne));$&&(B=$)}return B}function qt(e,t){return e.filter(n=>n.kind===t)}function hh(e,t){var Nx,Bx,$x,jx,Fx,Hx,zx,Gx,Vx,Wx,Ux,qx,Yx,Kx,Xx,Zx,Qx,Jx;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 R=l(b);if(!R)throw new Error(`하강 참조 해소 실패: ${b}`);return R},p=b=>{let R=b.parent;for(;R;){if(R.type==="bpmn:Participant")return R;R=R.parent}},d=new Map;for(const b of o.filter(R=>!("waypoints"in R&&R.waypoints)&&R.type!=="bpmn:Lane"&&R.type!=="label"&&typeof R.x=="number"))d.set(b.id,{x:b.x,y:b.y});const h=qt(e,"participant.add"),m=qt(e,"node.add"),g=qt(e,"sequenceFlow.add"),S=qt(e,"messageFlow.add"),E=qt(e,"dataStore.add"),x=qt(e,"dataAssociation.add"),w=qt(e,"annotation.add"),C=qt(e,"group.add"),P=new Map(m.map(b=>[b.node.id,b])),L=(b,R,M)=>{var U;const F=b.businessObject,H=(((U=F.extensionElements)==null?void 0:U.values)??[]).filter(W=>W.$type!==R),I=M?[...H,i.create(R,M)]:H;if(!I.length){F.extensionElements&&n.updateProperties(b,{extensionElements:void 0});return}const Y=i.create("bpmn:ExtensionElements",{values:I});I.forEach(W=>{W.$parent=Y}),n.updateProperties(b,{extensionElements:Y})},T=b=>({anchor:b.anchor,side:b.side,...b.offset!==void 0?{offset:b.offset}:{}});for(const b of qt(e,"element.remove")){const R=l(b.id);R&&n.removeElements([R])}const B=b=>o.filter(R=>{var M;return R.type==="bpmn:Lane"&&((M=p(R))==null?void 0:M.id)===b}).sort((R,M)=>R.y-M.y);for(const b of qt(e,"participant.update")){const R=f(b.id);if(b.name!==void 0&&n.updateProperties(R,{name:b.name??void 0}),!b.lanes)continue;const M=B(b.id);if(!M.length){n.splitLane(R,b.lanes.length),B(b.id).forEach((H,I)=>{const Y=b.lanes[I];Y&&n.updateProperties(H,{id:Y.id,name:Y.name})});continue}const F=new Set(M.map(H=>H.id));b.lanes.forEach((H,I)=>{if(F.has(H.id)){n.updateProperties(f(H.id),{name:H.name});return}const Y=I===0?n.addLane(B(b.id)[0],"top"):n.addLane(f(b.lanes[I-1].id),"bottom");n.updateProperties(Y,{id:H.id,name:H.name})})}const k=150,O=130,$=80,ne=90,ge=180,Ve=30,q=(b,R,M,F,H)=>{const I=M-R.width/2,Y=F-R.height/2;return(b.children??[]).find(U=>!("waypoints"in U&&U.waypoints)&&U.type!=="bpmn:Lane"&&U.type!=="label"&&!(H!=null&&H.has(U.id))&&typeof U.x=="number"&&I<U.x+U.width+Ve&&I+R.width+Ve>U.x&&Y<U.y+U.height&&Y+R.height>U.y)},ae=new Set;for(const b of h){ae.add(`pool:${b.participant.id}`);for(const R of b.participant.lanes??[])ae.add(R.id)}const de=new Map;for(const b of m){const R=b.node.lane??`pool:${b.node.participant??""}`;let M=de.get(R);M||de.set(R,M=new Set([0])),b.band!==void 0&&M.add(b.band)}const re=new Map;for(const[b,R]of de){if(!ae.has(b))continue;const M=[...R].sort((I,Y)=>I-Y),F=M.map((I,Y)=>Y===0?0:Y%2===1?Math.ceil(Y/2):-(Y/2)),H=Math.min(...F);re.set(b,new Map(M.map((I,Y)=>[I,F[Y]-H])))}{const b=new Map;for(const R of h)(R.participant.lanes??[]).forEach((M,F)=>b.set(M.id,F));for(const[R,M]of re){if(!b.has(R)||M.size<2)continue;const F=b.get(R),H=M.get(0)??0,I=new Set;for(const oe of m){if(oe.node.lane!==R||(oe.band??0)!==0||!oe.node.type.endsWith("Gateway"))continue;const ke={in:new Set,out:new Set,cross:new Set};for(const ue of g){const ye=ue.flow.source===oe.node.id;if(!ye&&ue.flow.target!==oe.node.id)continue;const pt=P.get(ye?ue.flow.target:ue.flow.source);if(!pt||pt.node.participant!==oe.node.participant||!pt.node.lane)continue;let Ae,ze=!1;if(pt.node.lane!==R){const se=b.get(pt.node.lane);if(se===void 0)continue;Ae=se>F?"down":"up",ze=!0}else{const se=M.get(pt.band??0)??H;Ae=se>H?"down":se<H?"up":void 0}Ae&&(ke[ye?"out":"in"].add(Ae),ze&&ke.cross.add(Ae))}for(const ue of["up","down"])ke.in.has(ue)&&ke.out.has(ue)&&ke.cross.has(ue)&&I.add(ue)}if(I.size!==1)continue;const[Y]=I,U=Math.max(...M.values()),W=Y==="down"?U:0;if(H===W)continue;const le=[...M.entries()].filter(([oe])=>oe!==0).sort((oe,ke)=>oe[1]-ke[1]),Ce=[...Array(U+1).keys()].filter(oe=>oe!==W),Ne=new Map([[0,W]]);le.forEach(([oe],ke)=>Ne.set(oe,Ce[ke])),re.set(R,Ne)}}const ve=b=>{var R;return(((R=de.get(b))==null?void 0:R.size)??0)>1},te=b=>b.band??(b.node.lane||!ve(`pool:${b.node.participant??""}`)?void 0:0),V=new Map,G=b=>V.get(b.node.id)??te(b),X=new Set,je=new Set;{const b=new Map;for(const F of g)b.set(F.flow.target,(b.get(F.flow.target)??0)+1);const R=F=>{const H=[],I=new Set([F]),Y=[F];for(;Y.length;){const U=Y.shift();H.push(U);for(const W of g)W.flow.source!==U||I.has(W.flow.target)||(b.get(W.flow.target)??0)!==1||(I.add(W.flow.target),Y.push(W.flow.target))}return H},M=(F,H)=>{var I;return((I=re.get(F))==null?void 0:I.get(H))??H};for(const F of m){if(!F.node.type.endsWith("Gateway"))continue;const H=F.node.lane??`pool:${F.node.participant??""}`,I=re.get(H);if(!I||I.size<2)continue;const Y=G(F);if(Y===void 0||M(H,Y)!==M(H,0))continue;const U=M(H,Y),W=g.filter(ue=>ue.flow.source===F.node.id).map(ue=>P.get(ue.flow.target)).filter(ue=>!!ue&&(ue.node.lane??`pool:${ue.node.participant??""}`)===H),le=W.filter(ue=>{const ye=G(ue);return ye!==void 0&&M(H,ye)===U&&(b.get(ue.node.id)??0)===1}),Ce=W.some(ue=>{const ye=G(ue);return ye!==void 0&&M(H,ye)>U});if(le.length!==1||!Ce)continue;const Ne=new Set(W.flatMap(ue=>R(ue.node.id)));if(!g.some(ue=>ue.flow.target===F.node.id&&Ne.has(ue.flow.source)))continue;const ke=new Map;for(const[ue,ye]of I)ke.set(ue,ye+1);ke.set(-1,0),re.set(H,ke);for(const ue of R(le[0].node.id))P.has(ue)&&(V.set(ue,-1),je.add(ue));X.add(F.node.id)}}const Rt=(b,R)=>{var M;return((M=re.get(b))==null?void 0:M.get(R))??R},A=new Map;for(const[b,R]of de){let M=0;for(const F of R)M=Math.max(M,Rt(b,F));A.set(b,M)}const _=b=>ge+k*b,y=h.map((b,R)=>({op:b,declared:R}));y.sort((b,R)=>{const M=b.op.order??Number.POSITIVE_INFINITY,F=R.op.order??Number.POSITIVE_INFINITY;return M!==F?M-F:b.declared-R.declared});let N=80;for(const b of o.getAll())b.parent===u()&&"height"in b&&typeof b.y=="number"&&(N=Math.max(N,b.y+b.height+60));for(const{op:b}of y){const R=b.participant,M=m.filter(oe=>oe.node.participant===R.id).length,F=((Nx=R.lanes)==null?void 0:Nx.length)??0,H=Math.max(1200,M*160+300),I=(R.lanes??[]).map(oe=>_(A.get(oe.id)??0)),Y=I.reduce((oe,ke)=>oe+ke,0);F&&Y<300&&(I[F-1]+=300-Y);const U=Math.max(300,k*((A.get(`pool:${R.id}`)??0)+1)),W=R.blackBox||M+F===0?120:F?Math.max(300,Y):U,le=r.createShape({type:"bpmn:Participant",businessObject:i.create("bpmn:Participant",{id:R.id,name:R.name,...b.order!==void 0?{"bwl:poolOrder":b.order}:{},...R.blackBox?{}:{processRef:i.create("bpmn:Process")}}),width:H,height:W,isExpanded:!0}),Ce=n.createShape(le,{x:100+H/2,y:N+W/2},u()),Ne=R.lanes??[];if(Ne.length&&n.splitLane(Ce,Ne.length),Ne.length){const oe=o.filter(ke=>{var ue;return ke.type==="bpmn:Lane"&&((ue=p(ke))==null?void 0:ue.id)===R.id}).sort((ke,ue)=>ke.y-ue.y);if(oe.forEach((ke,ue)=>{const ye=Ne[ue];ye&&n.updateProperties(ke,{id:ye.id,name:ye.name})}),I.some(ke=>ke!==Ce.height/F)){let ke=Ce.y;oe.forEach((ue,ye)=>{const pt=I[ye];n.resizeShape(ue,{x:ue.x,y:ke,width:ue.width,height:pt}),ke+=pt})}}N=Ce.y+Ce.height+60}const z=b=>{var F;const R=P.get(b);if(R)return R.node.participant??"";const M=l(b);return M?M.type==="bpmn:Participant"?M.id:((F=p(M))==null?void 0:F.id)??"":""},K=new Map,he=b=>{let R=K.get(b);return R||K.set(b,R={nodes:[],flows:[]}),R};for(const b of m)he(b.node.participant??"").nodes.push(b);for(const b of g)he(z(b.flow.source)).flows.push(b);const Le=b=>{var R;return i.create("bpmn:SequenceFlow",{id:b.id,name:b.name??((R=b.condition)==null?void 0:R.label)})},Qe=(b,R)=>r.createShape({type:ms(b.type),businessObject:i.create(ms(b.type),{id:b.id,name:b.name,...R!==void 0?{"bwl:band":R}:{}})}),Ct=[...y.map(({op:b})=>b.participant.id).filter(b=>K.has(b)),...[...K.keys()].filter(b=>!h.some(R=>R.participant.id===b))],nt=b=>b.endsWith("Gateway");for(const b of Ct){const R=K.get(b),M=b?f(b):void 0,F=M?M.x+150:250;let H=M?M.y+80:120;const I=(se,we,Be)=>{const it=u().children.filter(gt=>!("waypoints"in gt&&gt.waypoints)&&gt.id!==we&&typeof gt.y=="number"&&gt.y>=se);it.length&&n.moveElements(it,{x:0,y:Be})},Y=(se,we)=>{if(se){const tt=f(se),nn=_(we);if(tt.height>=nn)return;const gn=nn-tt.height,J=p(tt),Ie=J?J.y+J.height:tt.y+tt.height;n.resizeLane(tt,{x:tt.x,y:tt.y,width:tt.width,height:nn},!1),I(Ie,J==null?void 0:J.id,gn);return}if(!M)return;const Be=k*(we+1);if(M.height>=Be)return;const it=Be-M.height,gt=M.y+M.height;n.resizeShape(M,{x:M.x,y:M.y,width:M.width,height:Be}),I(gt,M.id,it)},U=(se,we,Be)=>{if(se){const it=f(se);return it.y+Math.min(it.height/2,ne)+Rt(se,we??0)*k}return we!==void 0&&M?M.y+$+Rt(`pool:${b}`,we)*k:Be},W=(se,we,Be)=>{if(se){const it=f(se);return it.y+Math.min(it.height/2,ne)+we*k}return M?M.y+$+we*k:Be},le=se=>se.participant?f(se.participant):u(),Ce=(se,we,Be,it,gt,tt)=>{const nn=Be!==void 0||it!==void 0,gn=Rt(Be??`pool:${b}`,it??0);if(nn)for(let me=0;me<4;me++){const _e=W(Be,gn+me,tt);if(!q(se,we,gt,_e))return Y(Be,gn+me),{x:gt,y:_e}}const J=U(Be,it,tt);nn&&Y(Be,gn);let Ie=gt;for(let me=0;me<64;me++){const _e=q(se,we,Ie,J);if(!_e)break;Ie=_e.x+_e.width+O+we.width/2}return{x:Ie,y:J}},Ne=new Set(R.flows.map(se=>se.flow.target)),oe=new Map;for(const se of R.nodes){if(Ne.has(se.node.id))continue;const we=Qe(se.node,se.band),Be=te(se),it=se.node.lane?`${se.node.lane}|${Be??""}`:Be!==void 0?`band:${Be}`:"",gt=le(se.node),tt=Ce(gt,we,se.node.lane,Be,oe.get(it)??F,H);n.createShape(we,tt,gt),oe.set(it,tt.x+we.width+O),!se.node.lane&&Be===void 0&&(H+=160)}const ke=new Set,ue=new Map,ye=new Map,pt=new Map;if(b&&ae.has(`pool:${b}`)){const se=new Map;for(const J of R.flows)se.set(J.flow.target,(se.get(J.flow.target)??0)+1);const we=J=>U(J.node.lane,G(J),Number.NaN),Be=new Set,it=J=>{var _e;const Ie=(_e=P.get(J))==null?void 0:_e.node.participant;if(Ie)return l(Ie);const me=l(J);if(me)return me.type==="bpmn:Participant"?me:p(me)},gt=J=>{const Ie=[],me=new Set([J]),_e=[J];for(;_e.length;){const Je=_e.shift(),Ue=P.get(Je);Ue&&Ie.push(Ue);for(const Te of R.flows)Te.flow.source!==Je||me.has(Te.flow.target)||(se.get(Te.flow.target)??0)!==1||(me.add(Te.flow.target),_e.push(Te.flow.target))}return Ie},tt=J=>{if(!M)return;const Ie=new Set(J.map(Je=>Je.node.id));let me=!1,_e=!1;for(const Je of S){if(!Ie.has(Je.flow.source))continue;const Ue=it(Je.flow.target);!Ue||Ue.id===M.id||(Ue.y<M.y?me=!0:_e=!0)}return me&&!_e?"up":_e&&!me?"down":void 0};for(const J of R.nodes){if(!nt(J.node.type))continue;const Ie=U(J.node.lane,te(J),Number.NaN);if(Number.isNaN(Ie))continue;const me=[];for(const Te of R.flows){if(Te.flow.source!==J.node.id)continue;const Ke=P.get(Te.flow.target);if(!Ke||Ke.node.lane!==J.node.lane||(se.get(Ke.node.id)??0)!==1)continue;const rt=te(Ke);if(rt===void 0)continue;const yn=U(Ke.node.lane,rt,Number.NaN);if(Number.isNaN(yn))continue;const Zr=gt(Ke.node.id),Kt=tt(Zr);Kt&&me.push({subtree:Zr,band:rt,row:yn,dir:Kt})}if(!me.some(Te=>Te.dir==="up")||!me.some(Te=>Te.dir==="down")||!me.some(Te=>Te.dir==="up"&&me.some(Ke=>Ke.dir==="down"&&Ke.row<Te.row)))continue;const Je=[...me].sort((Te,Ke)=>Te.row-Ke.row);[...me.filter(Te=>Te.dir==="up"),...me.filter(Te=>Te.dir==="down")].sort((Te,Ke)=>Te.dir===Ke.dir?Te.row-Ke.row:Te.dir==="up"?-1:1).forEach((Te,Ke)=>{const rt=Je[Ke].band;if(rt!==Te.band){Be.add(J.node.id);for(const yn of Te.subtree)te(yn)===Te.band&&V.set(yn.node.id,rt)}})}const nn=J=>{if(!M)return;const Ie=new Set(J.map(Je=>Je.node.id));let me=!1,_e=!1;for(const Je of S){if(!Ie.has(Je.flow.target))continue;const Ue=it(Je.flow.source);!Ue||Ue.id===M.id||(Ue.y<M.y?me=!0:_e=!0)}return me&&!_e?"up":_e&&!me?"down":void 0};for(const J of R.nodes){if(!nt(J.node.type))continue;const Ie=J.node.lane??`pool:${b}`,me=re.get(Ie);if(!me||me.size<2)continue;const _e=me.get(0);if(_e===void 0)continue;const Je=Math.max(...me.values()),Ue=_e===Je&&_e!==0?"down":void 0;if(!Ue)continue;const Te=[];for(const Kt of R.flows){if(Kt.flow.source!==J.node.id)continue;const Jn=P.get(Kt.flow.target);if(!Jn||Jn.node.lane!==J.node.lane||(se.get(Jn.node.id)??0)!==1)continue;const e0=G(Jn);e0!==void 0&&Te.push({t:Jn,subtree:gt(Jn.node.id),band:e0})}const Ke=Te.find(Kt=>(me.get(Kt.band)??Kt.band)===_e);if(!Ke||nn(Ke.subtree)===Ue||tt(Ke.subtree)===Ue)continue;const rt=Te.find(Kt=>Kt!==Ke&&nn(Kt.subtree)===Ue);if(!rt)continue;const yn=Ke.band,Zr=rt.band;for(const Kt of Ke.subtree)G(Kt)===yn&&V.set(Kt.node.id,Zr);for(const Kt of rt.subtree)G(Kt)===Zr&&V.set(Kt.node.id,yn);Be.add(J.node.id)}for(const J of R.nodes){if(!nt(J.node.type))continue;const Ie=we(J);if(Number.isNaN(Ie)||w.some(Te=>{var Ke,rt;return(((Ke=Te.placement)==null?void 0:Ke.anchor)??(Te.association?Te.association.source===Te.annotation.id?Te.association.target:Te.association.source:void 0))===J.node.id&&((rt=Te.placement)==null?void 0:rt.side.startsWith("bottom"))}))continue;let _e,Je=!1,Ue;for(const Te of R.flows){if(Te.flow.source!==J.node.id)continue;const Ke=P.get(Te.flow.target);if(!Ke||!Ke.node.lane&&te(Ke)===void 0)continue;const rt=we(Ke);Number.isNaN(rt)||(Math.abs(rt-Ie)<.5&&(Je=!0),rt>Ie?!_e||rt>_e.row?_e={id:Ke.node.id,row:rt,count:1}:rt===_e.row&&_e.count++:rt<Ie&&Ke.node.lane===J.node.lane&&(!Ue||rt>Ue.row?Ue={op:Ke,row:rt,count:1}:rt===Ue.row&&Ue.count++))}_e&&_e.count===1&&(se.get(_e.id)??0)===1&&!Be.has(J.node.id)&&ke.add(_e.id),!Je&&Ue&&Ue.count===1&&(se.get(Ue.op.node.id)??0)===1&&!X.has(J.node.id)&&ue.set(Ue.op.node.id,{lane:J.node.lane,band:G(J)})}const gn=new Map;for(const J of S)gn.set(J.flow.target,[...gn.get(J.flow.target)??[],J]);for(const J of R.nodes){const Ie=gn.get(J.node.id);if(!Ie||Ie.length!==1||!se.get(J.node.id)||!J.node.lane&&te(J)===void 0||je.has(J.node.id))continue;const me=(Bx=P.get(Ie[0].flow.source))==null?void 0:Bx.node.participant,_e=me?l(me):void 0;if(!_e||!M||_e.id===M.id)continue;const Je=J.node.lane??`pool:${b}`,Ue=re.get(Je);if(!Ue)continue;const Te=Ue.get(0)??0,Ke=(Ue.get(G(J)??0)??Te)-Te;if(Ke===0)continue;const rt=_e.y<M.y;if(rt&&Ke<0||!rt&&Ke>0)continue;let yn;for(const[Zr,Kt]of Ue){const Jn=Kt-Te;(rt&&Jn<0&&(!yn||Jn<yn.row)||!rt&&Jn>0&&(!yn||Jn>yn.row))&&(yn={band:Zr,row:Jn})}yn&&ye.set(J.node.id,{lane:J.node.lane,band:yn.band})}}const Ae=new Set;let ze=0;for(;ze++<R.nodes.length+2;){for(let Be=0;Be<R.nodes.length+R.flows.length+2;Be++){let it=!1;for(const gt of R.flows){const tt=gt.flow;if(Ae.has(tt.id))continue;const nn=l(tt.source);if(!nn)continue;const gn=l(tt.target),J=P.get(tt.target);if(!gn&&J){const Ie=Qe(J.node,J.band),me=G(J);if(J.node.lane||me!==void 0){const _e=le(J.node),Je=nn,Ue=Je.x+(pt.get(tt.source)??0)+Je.width+O,Te=ue.get(tt.target)??ye.get(tt.target),Ke=Ce(_e,Ie,Te?Te.lane:J.node.lane,Te?Te.band:me,ke.has(tt.target)?Je.x+Je.width/2:Ue,Number.NaN),rt=n.createShape(Ie,Ke,_e);ke.has(tt.target)&&pt.set(tt.target,Ue-(rt.x+rt.width/2)),n.connect(nn,rt,{type:"bpmn:SequenceFlow",businessObject:Le(tt)})}else s.append(nn,Ie,{connection:{type:"bpmn:SequenceFlow",businessObject:Le(tt)}})}else if(gn)n.connect(nn,gn,{type:"bpmn:SequenceFlow",businessObject:Le(tt)});else continue;Ae.add(tt.id),it=!0}if(!it)break}const se=R.nodes.filter(Be=>!l(Be.node.id));if(!se.length)break;const we=se[0];{const Be=Qe(we.node,we.band),it=le(we.node),gt=te(we);n.createShape(Be,Ce(it,Be,we.node.lane,gt,F,H),it),!we.node.lane&&gt===void 0&&(H+=160)}}}const Nt=40,Pt=(b,R=()=>!0)=>{const M=l(b);if(!M)return[];const F=[M],H=new Set([b]);for(let I=0;I<F.length;I++){const Y=F[I].id;for(const U of g){const W=U.flow.target;if(U.flow.source!==Y||H.has(W)||!P.has(W))continue;H.add(W);const le=l(W);le&&R(le)&&F.push(le)}}return F},mn=(b,R=()=>!0)=>{const M=l(b);if(!M)return[];const F=[M],H=new Set([b]);for(let I=0;I<F.length;I++){const Y=F[I].id;for(const U of g){const W=U.flow.source;if(U.flow.target!==Y||H.has(W)||!P.has(W))continue;H.add(W);const le=l(W);le&&R(le)&&F.push(le)}}return F};for(const b of qt(e,"sequenceFlow.update")){if(b.target===void 0)continue;const R=P.get(b.target);if(!R)continue;const M=l(b.target),F=l(b.id);if(!M||!F)continue;const H=b.source!==void 0?l(b.source):F.source,I=F.target;if(!H||!I||I.id===M.id)continue;const Y=Pt(b.target),U=new Set(Y.map(ue=>ue.id)),W=Math.min(...Y.map(ue=>ue.x)),le=Math.max(...Y.map(ue=>ue.x+ue.width)),Ce=H.x+H.width,Ne=le-W+Nt*2-(I.x-Ce);if(Ne>0){const ue=p(M),ye=(ue==null?void 0:ue.children)??[],pt=se=>se.type==="bpmn:Lane",Ae=ye.filter(se=>!("waypoints"in se&&se.waypoints)&&!pt(se)&&!U.has(se.id)&&se.x>=I.x),ze=ue?[ue,...ye.filter(se=>pt(se))]:[];Ae.length&&n.createSpace(Ae,ze,{x:Ne,y:0},"e",I.x-1)}const oe=R.node.lane||R.band!==void 0?M.y+M.height/2:H.y+H.height/2;n.moveElements(Y,{x:Ce+Nt-W,y:oe-(M.y+M.height/2)});const ke=p(M);if(R.node.lane===void 0&&R.band!==void 0&&ke){const ue=ke.y+$+Rt(`pool:${R.node.participant??""}`,R.band)*k,ye=ue-(M.y+M.height/2);ye!==0&&!q(ke,M,M.x+M.width/2,ue,U)&&n.moveElements([M],{x:0,y:ye})}}const lt=(b,R)=>{const M=R.target===b,F=f(R.source),H=f(R.target),I=M?"bpmn:DataOutputAssociation":"bpmn:DataInputAssociation";n.connect(F,H,R.id?{type:I,businessObject:i.create(I,{id:R.id})}:{type:I})},zt=100,ln=b=>{for(const R of h){if(!R.participant.blackBox)continue;const M=l(R.participant.id);if(!M)continue;const F=[];for(const I of S){const Y=I.flow.source===R.participant.id?I.flow.target:I.flow.target===R.participant.id?I.flow.source:void 0,U=Y?l(Y):void 0;U&&typeof U.x=="number"&&U.type!=="bpmn:Participant"&&F.push(U)}if(!F.length)continue;const H=Math.max(...F.map(I=>I.x+I.width/2))+zt;if(H>M.x+M.width&&n.resizeShape(M,{x:M.x,y:M.y,width:H-M.x,height:M.height}),!!b)for(const I of S){const Y=l(I.flow.id),U=I.flow.source===R.participant.id?I.flow.target:I.flow.target===R.participant.id?I.flow.source:void 0,W=U?l(U):void 0;if(!Y||!W||W.type==="bpmn:Participant")continue;const le=W.x+W.width/2;if(le<M.x+10||le>M.x+M.width-10)continue;const Ce=M.y>W.y,Ne=Ce?W.y+W.height:W.y,oe=Ce?M.y:M.y+M.height,ke=I.flow.source===R.participant.id?[{x:le,y:oe},{x:le,y:Ne}]:[{x:le,y:Ne},{x:le,y:oe}],ue=Et(o),ye={...ue.edges.find(pt=>pt.id===I.flow.id),waypoints:ke};jn(ye,si(ue)).length||n.updateWaypoints(Y,ke)}}};ln(!1);for(const b of S){const R=b.flow;n.connect(f(R.source),f(R.target),{type:"bpmn:MessageFlow",businessObject:i.create("bpmn:MessageFlow",{id:R.id,name:R.name})})}{const M=new Set([...g.map(W=>W.flow.id),...S.map(W=>W.flow.id)].filter(W=>!!W)),F=o.filter(W=>!!W.waypoints),H=(W,le)=>Math.abs(le.x-W.x)<2?"L":Math.abs(le.x-(W.x+W.width))<2?"R":Math.abs(le.y-W.y)<2?"T":Math.abs(le.y-(W.y+W.height))<2?"B":void 0,I=new Map,Y=(W,le,Ce)=>{if(!W||!le||typeof W.x!="number")return;const Ne=H(W,le);if(!Ne)return;let oe=I.get(W.id);oe||I.set(W.id,oe=new Map),oe.set(Ne,[...oe.get(Ne)??[],Ce])};for(const W of F){const le=W.waypoints;!le||le.length<2||(Y(W.source,le[0],{id:W.id,dir:"out"}),Y(W.target,le[le.length-1],{id:W.id,dir:"in"}))}const U=new Set;for(const[W,le]of I){const Ce=l(W);if(!Ce||typeof Ce.x!="number"||![...le.values()].some(ze=>{const se=ze.filter(we=>we.dir==="in");return ze.length>=3&&se.length>=1&&ze.some(we=>we.dir==="out")&&se.some(we=>M.has(we.id))}))continue;const oe=p(Ce);if(!oe||U.has(oe.id)||(oe.children??[]).some(ze=>ze.type==="bpmn:Lane"))continue;const ke=($x=le.get("T"))!=null&&$x.length?(jx=le.get("B"))!=null&&jx.length?void 0:"B":"T";if(!ke||(ke==="T"?Ce.y-oe.y:oe.y+oe.height-(Ce.y+Ce.height))>=k)continue;const ye=(oe.children??[]).filter(ze=>!("waypoints"in ze&&ze.waypoints)&&ze.type!=="label"&&typeof ze.x=="number"),pt=oe.y+oe.height;n.resizeShape(oe,{x:oe.x,y:oe.y,width:oe.width,height:oe.height+k});const Ae=u().children.filter(ze=>!("waypoints"in ze&&ze.waypoints)&&ze.id!==oe.id&&typeof ze.y=="number"&&ze.y>=pt);Ae.length&&n.moveElements(Ae,{x:0,y:k}),ke==="T"&&ye.length&&n.moveElements(ye,{x:0,y:k}),U.add(oe.id)}}const Sr=20,xn=30,ii=4,Qn=2,Gt=[10,30,80],Rr=b=>!("waypoints"in b&&b.waypoints)&&b.type!=="bpmn:Lane"&&b.type!=="label"&&typeof b.x=="number",Wi=()=>{const b=Et(o);return{bad:Ai(b).filter(R=>R.kind==="edge-crosses-shape"||R.kind==="edge-overlap-opposite"||R.kind==="edge-overlap-mixed").length,crossings:Ld(b),straight:b.edges.filter(R=>R.type==="bpmn:MessageFlow"&&R.waypoints.length===2).length}},tn=b=>{const R=Et(o),M=R.edges.find(F=>F.id===b);return M?jn(M,si(R)).length:0},Ye=b=>tn(b)>0,et=b=>Et(o).edges.filter(R=>R.type==="bpmn:MessageFlow"&&R.id!==b&&R.waypoints.length===2).length,zf=(b,R)=>{const M=new Set(b.flatMap(I=>I.subtree.map(Y=>Y.id)));for(const I of b){const Y=(I.pool.children??[]).filter(Rr).filter(W=>!M.has(W.id));if(I.subtree.some(W=>Y.some(le=>W.x+R<le.x+le.width+xn&&W.x+R+W.width+xn>le.x&&W.y<le.y+le.height&&W.y+W.height>le.y)))return null}const F=b.map(I=>I.pool.width);n.moveElements(b.flatMap(I=>I.subtree),{x:R,y:0});const H=b.map(I=>{const U=Math.max(...I.subtree.map(W=>W.x+W.width))+150-(I.pool.x+I.pool.width);return U>0&&n.resizeShape(I.pool,{x:I.pool.x,y:I.pool.y,width:I.pool.width+U,height:I.pool.height}),U});return()=>{n.moveElements(b.flatMap(I=>I.subtree),{x:-R,y:0}),b.forEach((I,Y)=>{H[Y]>0&&n.resizeShape(I.pool,{x:I.pool.x,y:I.pool.y,width:F[Y],height:I.pool.height})})}},vD=(b,R,M)=>zf([{subtree:b,pool:R}],M),Sx=(b,R)=>R.bad>b.bad||R.crossings>b.crossings&&R.straight<=b.straight&&R.bad>=b.bad,xu=(b,R)=>Sx(b,R)||R.straight<b.straight,wu=(b,R,M=()=>!0,F=Sx)=>{const H=Wi(),I=zf(b,R);if(!I)return!1;const Y=Wi();return F(H,Y)||!M()?(I(),!1):!0},Rx=(b,R,M,F=()=>!0)=>wu([{subtree:b,pool:R}],M,F),Kr=b=>{var R;return!!((R=P.get(b))!=null&&R.node.participant)},Ka=new Map;for(const b of S){if(!Kr(b.flow.target))continue;const R=Ka.get(b.flow.target)??[];R.push(b),Ka.set(b.flow.target,R)}const Gf=[...Ka.keys()],Cx=new Set(g.map(b=>b.flow.target)),Px=b=>y.findIndex(({op:R})=>R.participant.id===b);Gf.sort((b,R)=>{var H,I;const M=Cx.has(b)?1:0,F=Cx.has(R)?1:0;return M!==F?M-F:Px((H=P.get(b))==null?void 0:H.node.participant)-Px((I=P.get(R))==null?void 0:I.node.participant)});const Xr=b=>b.x+b.width/2,_D=b=>{const R=new Map;for(const H of o.getAll()){const I=H;if(!I.waypoints||!I.source||!I.target)continue;(R.get(I.source.id)??R.set(I.source.id,[]).get(I.source.id)).push(I.target.id)}const M=new Set([b]),F=[b];for(let H=0;H<F.length;H++)for(const I of R.get(F[H])??[])M.has(I)||(M.add(I),F.push(I));return M},bD=(b,R)=>{const M=_D(R);let F;for(const H of o.getAll()){const I=H;if(I.type!=="bpmn:MessageFlow"||!I.source||!I.target||I.target.id!==b||M.has(I.source.id))continue;const Y=I.source;if(typeof Y.x!="number"||Y.type==="bpmn:Participant")continue;const U=Xr(Y);(F===void 0||U>F)&&(F=U)}return F},Vf=(b,R)=>{const M=l(b.flow.source);if(M)return M.type==="bpmn:Participant"?bD(M.id,R):Xr(M)},Ax=b=>{let R;for(const M of Ka.get(b)??[]){const F=Vf(M,b);F!==void 0&&(!R||F>R.cx)&&(R={op:M,cx:F})}return R==null?void 0:R.op},xD=b=>{const R=Ax(b),M=l(b),F=R?Vf(R,b):void 0;return M&&F!==void 0?F-Xr(M):void 0},wD=b=>{const R=xD(b);return R!==void 0&&Math.abs(R)<Sr},Tx=(b,R,M,F,H)=>{var I;for(let Y=!0;Y;){Y=!1;for(const U of S){if(U.flow.id===M)continue;const W=R.has(U.flow.source),le=R.has(U.flow.target);if(W===le||F(W?U.flow.source:U.flow.target))continue;const Ce=W?U.flow.target:U.flow.source;if(H(Ce)||!Kr(Ce))continue;const Ne=l(U.flow.id);if(!(Ne!=null&&Ne.waypoints)||Ne.waypoints.length!==2)continue;const oe=l(Ce),ke=(I=P.get(Ce))==null?void 0:I.node.participant;if(!oe||!ke)continue;const ue=Pt(Ce,ye=>ye.x>=oe.x).filter(ye=>!R.has(ye.id));if(!(!ue.length||ue.some(ye=>H(ye.id)))){for(const ye of ue)R.add(ye.id);b.set(ke,[...b.get(ke)??[],...ue]),Y=!0}}}return[...b].map(([Y,U])=>({subtree:U,pool:f(Y)}))},Mx=(b,R,M,F,H)=>Tx(new Map([[R,[...b]]]),new Set(b.map(I=>I.id)),F,I=>I===M,I=>I===H),Wf=b=>{const R=Ax(b);if(!R)return null;const M=l(b),F=l(R.flow.source),H=Vf(R,b);if(!M||!F||H===void 0)return null;const I=H-Xr(M);if(I>=Sr){const Y=P.get(b).node.participant,U=Pt(b,W=>W.x>=M.x);return{groups:Mx(U,Y,b,R.flow.id,R.flow.source),dx:I}}if(-I>=Sr&&Kr(R.flow.source)){const Y=P.get(R.flow.source).node.participant,U=Pt(R.flow.source,W=>W.x>=F.x&&!wD(W.id));return{groups:Mx(U,Y,R.flow.source,R.flow.id,b),dx:-I}}return null},kx=()=>Gf.map(b=>({id:b,plan:Wf(b)})).filter(b=>!!b.plan).sort((b,R)=>Math.min(...b.plan.groups.flatMap(M=>M.subtree.map(F=>F.x)))-Math.min(...R.plan.groups.flatMap(M=>M.subtree.map(F=>F.x)))).map(b=>b.id);for(let b=0;b<3;b++){const R=Wi(),M=[];for(const H of kx()){const I=Wf(H);if(!I)continue;const Y=zf(I.groups,I.dx);Y&&M.push(Y)}if(!M.length)break;if(!xu(R,Wi()))continue;for(const H of M.reverse())H();let F=!1;for(const H of kx()){const I=Wf(H);I&&wu(I.groups,I.dx,()=>!0,xu)&&(F=!0)}if(!F)break}for(const b of Gf.flatMap(R=>Ka.get(R)??[])){if(!Ye(b.flow.id))continue;const R=l(b.flow.target);if(!R)continue;const M=f(P.get(b.flow.target).node.participant),F=Pt(b.flow.target,U=>U.x>=R.x),H=R.width+O,I=tn(b.flow.id),Y=et(b.flow.id);for(let U=1;U<=ii;U++){const W=()=>tn(b.flow.id)<I&&et(b.flow.id)>=Y;if(Rx(F,M,H*U,W))break}}for(const b of S){if(!Ye(b.flow.id))continue;const R=l(b.flow.source),M=l(b.flow.target);if(!R||!M||R.type==="bpmn:Participant"||M.type==="bpmn:Participant")continue;const F=R.x+R.width/2;if(Math.abs(F-(M.x+M.width/2))>15)continue;const[H,I]=R.y<M.y?[R.y+R.height,M.y]:[M.y+M.height,R.y],Y=[...P.values()].map(U=>l(U.node.id)).filter(U=>!!U&&U.id!==R.id&&U.id!==M.id).filter(U=>U.x<=F&&F<=U.x+U.width&&U.y+U.height>H&&U.y<I).sort((U,W)=>U.x-W.x);for(const U of Y){const W=(Fx=P.get(U.id))==null?void 0:Fx.node.participant,le=W?l(W):void 0;if(!le)continue;const Ce=[...P.values()].filter(se=>se.node.participant===W).map(se=>se.node.id),Ne=se=>se.map(we=>l(we)).filter(we=>!!we),ke=[mn(U.id,se=>{var we;return((we=P.get(se.id))==null?void 0:we.node.participant)===W}),Ne(Ce)].filter(se=>se.length),ue=U.width+O,ye=tn(b.flow.id),pt=et(b.flow.id),Ae=()=>tn(b.flow.id)<ye&&et(b.flow.id)>=pt;let ze=!1;for(const se of ke){for(let we=1;we<=ii;we++)if(Rx(se,le,ue*we,Ae)){ze=!0;break}if(ze)break}if(!Ye(b.flow.id))break}}for(const b of S){if(!Ye(b.flow.id))continue;const R=l(b.flow.id);if(((Hx=R==null?void 0:R.waypoints)==null?void 0:Hx.length)!==2)continue;const M=l(b.flow.source),F=l(b.flow.target);if(!M||!F||M.type==="bpmn:Participant"||F.type==="bpmn:Participant"||!Kr(b.flow.source)||!Kr(b.flow.target)||Math.abs(Xr(M)-Xr(F))>Qn)continue;const H=Xr(M),I=R.waypoints.map(ye=>ye.y),[Y,U]=[Math.min(...I),Math.max(...I)],W=si(Et(o)).filter(ye=>ye.id!==M.id&&ye.id!==F.id&&ye.x<H&&H<ye.x+ye.width&&Y<ye.y+ye.height&&ye.y<U);if(!W.length)continue;const le=(zx=P.get(b.flow.source))==null?void 0:zx.node.participant,Ce=(Gx=P.get(b.flow.target))==null?void 0:Gx.node.participant;if(!le||!Ce)continue;const Ne=new Map;for(const[ye,pt,Ae]of[[b.flow.source,M,le],[b.flow.target,F,Ce]]){const ze=Ne.get(Ae)??[],se=Pt(ye,we=>we.x>=pt.x).filter(we=>!ze.some(Be=>Be.id===we.id));Ne.set(Ae,[...ze,...se])}const oe=new Set([...Ne.values()].flat().map(ye=>ye.id)),ke=Tx(Ne,oe,b.flow.id,ye=>ye===b.flow.source||ye===b.flow.target,()=>!1),ue=Math.max(...W.map(ye=>ye.x+ye.width));for(const ye of Gt){const pt=ue+ye-H;if(pt<=0)continue;if(wu(ke,pt,()=>{var ze,se;return tn(b.flow.id)===0&&((se=(ze=l(b.flow.id))==null?void 0:ze.waypoints)==null?void 0:se.length)===2},xu))break}}{const b=M=>M.y+M.height/2,R=[];for(const M of P.keys()){if(!Kr(M))continue;const F=g.filter(Y=>Y.flow.target===M);if(F.length!==1)continue;const H=l(F[0].flow.source),I=l(M);!H||!I||!P.has(H.id)||Math.abs(b(H)-b(I))>1||I.x-(H.x+H.width)<=O+1||R.push({id:M,pred:H,node:I})}R.sort((M,F)=>M.node.x-F.node.x);for(const{id:M}of R){const F=P.get(M),H=l(M),I=l(g.find(oe=>oe.flow.target===M).flow.source);if(!H||!I)continue;const Y=H.x-(I.x+I.width);if(Y<=O+1)continue;const U=f(F.node.participant),W=Pt(M,oe=>oe.x>=H.x),le=Wi(),Ce=vD(W,U,-(Y-O));if(!Ce)continue;const Ne=Wi();(Ne.bad>le.bad||Ne.crossings>=le.crossings||Ne.straight<le.straight)&&Ce()}}ln(!0);for(const b of E){const R=b.associations??[],M=R.map(I=>I.source===b.dataStore.id?I.target:I.source).map(l).find(Boolean),F=M?p(M)??u():u(),H=M?{x:M.x+M.width/2,y:M.y+M.height+110}:{x:200,y:N+60};n.createShape({type:"bpmn:DataStoreReference",businessObject:i.create("bpmn:DataStoreReference",{id:b.dataStore.id,name:b.dataStore.name})},H,F);for(const I of R)lt(b.dataStore.id,I)}for(const b of x){const M=f(b.association.target).type==="bpmn:DataStoreReference"?b.association.target:b.association.source;lt(M,b.association)}let Ox=0;const Eu=10,ED=(b,R)=>{for(const M of R.map(F=>p(F)).filter(F=>!!F)){const F=Eu,H=M.y,I=M.y+M.height,Y=M.x,U=M.x+M.width;if(Math.abs(b.y-H)<F){const W=H+F-b.y;b.y+=W,b.height-=W}if(Math.abs(b.y+b.height-I)<F&&(b.height=I-F-b.y),Math.abs(b.x-Y)<F){const W=Y+F-b.x;b.x+=W,b.width-=W}Math.abs(b.x+b.width-U)<F&&(b.width=U-F-b.x)}},SD=(b,R)=>{const M=Eu,F=30,H=o.filter(I=>I.type==="bpmn:Group"&&I.id!==R);for(const I of H){const Y=I.x,U=I.x+I.width,W=I.y,le=I.y+I.height,Ce=b.y<le&&W<b.y+b.height,Ne=b.x<U&&Y<b.x+b.width;if(Ce){if(Math.abs(b.x-U)<M){const oe=Math.min(U+M-b.x,F);oe>0&&b.width-oe>0&&(b.x+=oe,b.width-=oe)}if(Math.abs(b.x+b.width-Y)<M){const oe=Math.min(b.x+b.width-(Y-M),F);oe>0&&b.width-oe>0&&(b.width-=oe)}}if(Ne){if(Math.abs(b.y-le)<M){const oe=Math.min(le+M-b.y,F);oe>0&&b.height-oe>0&&(b.y+=oe,b.height-=oe)}if(Math.abs(b.y+b.height-W)<M){const oe=Math.min(b.y+b.height-(W-M),F);oe>0&&b.height-oe>0&&(b.height-=oe)}}}},Uf=(b,R)=>{const F=Math.min(...b.map(W=>W.x))-40,H=Math.min(...b.map(W=>W.y))-40,I=Math.max(...b.map(W=>W.x+W.width))+40,Y=Math.max(...b.map(W=>W.y+W.height))+40,U={x:F,y:H,width:I-F,height:Y-H};return ED(U,b),SD(U,R),U};for(const b of C){const R=(b.group.members??[]).map(l).filter(H=>!!H);let M;R.length?M=Uf(R,b.group.id):(M={x:300+Ox*350,y:40,width:300,height:200},Ox++);const F=n.createShape({type:"bpmn:Group",businessObject:i.create("bpmn:Group",{id:b.group.id}),width:M.width,height:M.height},{x:M.x+M.width/2,y:M.y+M.height/2},u());b.group.name&&n.updateLabel(F,b.group.name),(Vx=b.group.members)!=null&&Vx.length&&L(F,"bwl:Members",{refs:b.group.members.join(" ")})}{const b=o.filter(H=>!!H.waypoints),R=new Map,M=(H,I)=>{!H||!I||(R.has(H)||R.set(H,new Set),R.get(H).add(I))};for(const H of b){const I=(Wx=H.source)==null?void 0:Wx.id,Y=(Ux=H.target)==null?void 0:Ux.id;M(I,Y),((qx=H.type)!=null&&qx.includes("DataOutputAssociation")||(Yx=H.type)!=null&&Yx.includes("DataInputAssociation")||H.type==="bpmn:Association")&&M(Y,I)}const F=o.filter(H=>H.type==="bpmn:Group");for(const H of F){const Y=(((Kx=H.businessObject.extensionElements)==null?void 0:Kx.values)??[]).find(Ae=>Ae.$type==="bwl:Members"),U=((Y==null?void 0:Y.refs)??"").split(" ").filter(Boolean);if(!U.length)continue;const W=new Set(U),le=[...U];for(;le.length;){const Ae=le.shift();for(const ze of R.get(Ae)??[])W.has(ze)||(W.add(ze),le.push(ze))}const Ce=H.x,Ne=H.x+H.width,oe=H.y,ke=H.y+H.height,ue=Ae=>g.filter(ze=>ze.flow.target===Ae).length,ye=Ae=>{var se;const ze=((se=l(Ae))==null?void 0:se.type)??"";if(ze==="bpmn:StartEvent"&&ue(Ae)===0)return!1;if(ze.endsWith("Gateway")){const we=g.filter(Be=>Be.flow.target===Ae).map(Be=>Be.flow.source);if(we.length&&we.every(Be=>{var it;return((it=l(Be))==null?void 0:it.type)==="bpmn:StartEvent"&&ue(Be)===0}))return!1}return!0},pt=o.filter(Ae=>Rr(Ae)).filter(Ae=>Ae.type!=="bpmn:Group"&&Ae.type!=="bpmn:Participant"&&Ae.type!=="bpmn:TextAnnotation"&&!W.has(Ae.id)&&Kr(Ae.id)&&ye(Ae.id)&&Ae.x<Ne&&Ae.x+Ae.width>Ce&&Ae.y<ke&&Ae.y+Ae.height>oe);if(pt.length)for(const Ae of[-1,1]){const ze=pt.filter(J=>(J.x+J.width-Ce<=Ne-J.x?-1:1)===Ae);if(!ze.length)continue;const se=[];for(const J of ze){const Ie=se.find(me=>me.some(_e=>J.y<_e.y+_e.height&&J.y+J.height>_e.y));Ie?Ie.push(J):se.push([J])}const we=new Map;for(const J of se){let Ie=Ae<0?Ce-Eu:Ne+Eu;for(const me of[...J].sort((_e,Je)=>Ae<0?Je.x-_e.x:_e.x-Je.x)){const _e=Ae<0?Math.min(me.x,Ie-me.width):Math.max(me.x,Ie);Ie=Ae<0?_e-xn:_e+me.width+xn,_e!==me.x&&Math.sign(_e-me.x)===Ae&&we.set(me.id,_e-me.x)}}const Be=new Map,it=J=>Be.get(J)===J||!Be.get(J)?J:it(Be.get(J));for(const J of ze)Be.set(J.id,J.id);for(const J of S){const Ie=we.has(J.flow.source)?J.flow.source:void 0,me=we.has(J.flow.target)?J.flow.target:void 0;if(!Ie||!me)continue;const _e=l(J.flow.id);((Xx=_e==null?void 0:_e.waypoints)==null?void 0:Xx.length)===2&&Be.set(it(Ie),it(me))}const gt=new Map;for(const J of ze){if(!we.has(J.id))continue;const Ie=it(J.id);gt.set(Ie,[...gt.get(Ie)??[],J])}const tt=[...gt.values()].sort((J,Ie)=>Ae<0?Math.min(...J.map(me=>me.x))-Math.min(...Ie.map(me=>me.x)):Math.max(...Ie.map(me=>me.x))-Math.max(...J.map(me=>me.x))),nn=[];let gn=!0;for(const J of tt){const Ie=J.map(Je=>we.get(Je.id)??0).reduce((Je,Ue)=>Math.abs(Ue)>Math.abs(Je)?Ue:Je,0),me=new Map;let _e=!0;for(const Je of J){const Ue=p(Je);if(!Ue){_e=!1;break}me.has(Ue.id)||me.set(Ue.id,{subtree:[],pool:Ue}),me.get(Ue.id).subtree.push(Je)}_e&&wu([...me.values()],Ie,()=>!0,xu)?nn.push({shapes:J,dx:Ie}):gn=!1}if(!gn)for(const J of nn.reverse())n.moveElements(J.shapes,{x:-J.dx,y:0})}}}{const b=new Set([...C.map(R=>R.group.id),...qt(e,"group.update").map(R=>R.id)]);for(const R of o.filter(M=>M.type==="bpmn:Group")){if(b.has(R.id))continue;const F=(((Zx=R.businessObject.extensionElements)==null?void 0:Zx.values)??[]).find(U=>U.$type==="bwl:Members"),H=((F==null?void 0:F.refs)??"").split(" ").filter(Boolean).map(l).filter(U=>!!U);!H.length||!H.some(U=>{const W=d.get(U.id);return!W||W.x!==U.x||W.y!==U.y})||!H.some(U=>U.x<R.x||U.y<R.y||U.x+U.width>R.x+R.width||U.y+U.height>R.y+R.height)||n.resizeShape(R,Uf(H,R.id))}}const Dx=b=>{const R=b.waypoints;if(R!=null&&R.length){const F=R[Math.floor((R.length-1)/2)];return{x:F.x,y:F.y,width:0,height:0}}const M=b;return{x:M.x,y:M.y,width:M.width,height:M.height}};let Xa=0;const Lx=12,Ix=14,RD=15,CD=300,PD=b=>{const R=b.split(`
7
- `),M=Math.max(...R.map(I=>ao(I,Lx))),F=Math.max(100,Math.min(CD,Math.ceil(M)+Ix)),H=R.reduce((I,Y)=>I+Math.max(1,Math.ceil((ao(Y,Lx)+Ix)/F)),0);return{width:F,height:Math.max(30,H*RD+10)}};for(const b of w){const R=b.association,M=((Qx=b.placement)==null?void 0:Qx.anchor)??(R?R.source===b.annotation.id?R.target:R.source:void 0),F=M?l(M):void 0,H=F?Dx(F):void 0,I=PD(b.annotation.text??"");let Y;if(H&&b.placement){const[Ce,Ne]=gs[b.placement.side],oe=b.placement.offset??50;Y={x:H.x+H.width/2+Ce*(H.width/2+I.width/2+oe),y:H.y+H.height/2+Ne*(H.height/2+I.height/2+oe)}}else H?(Y={x:H.x+H.width/2+180+Xa%3*260,y:H.y-110-Xa%2*95},Xa++):(Y={x:300+Xa*260,y:60},Xa++);const U=F?p(F)??u():u(),W=U;H&&typeof W.x=="number"&&typeof W.width=="number"&&W.type==="bpmn:Participant"&&(Y=Xu(o,H,I,W,b.placement?{placement:b.placement}:{from:Y}));const le=n.createShape({type:"bpmn:TextAnnotation",width:I.width,height:I.height,businessObject:i.create("bpmn:TextAnnotation",{id:b.annotation.id,text:b.annotation.text})},Y,U);if(R){const Ce=Ne=>Ne===b.annotation.id?le:f(Ne);n.connect(Ce(R.source),Ce(R.target),R.id?{type:"bpmn:Association",businessObject:i.create("bpmn:Association",{id:R.id})}:{type:"bpmn:Association"})}b.placement&&L(le,"bwl:Placement",T(b.placement))}for(const b of qt(e,"association.add")){const R=b.association;n.connect(f(R.source),f(R.target),R.id?{type:"bpmn:Association",businessObject:i.create("bpmn:Association",{id:R.id})}:{type:"bpmn:Association"})}for(const b of qt(e,"node.update")){let R=f(b.id);if(b.type&&ms(b.type)!==R.type&&(R=c.replaceElement(R,{type:ms(b.type)})),b.name!==void 0&&n.updateProperties(R,{name:b.name??void 0}),b.lane){const M=f(b.lane),F=M.y+M.height/2-(R.y+R.height/2);F!==0&&n.moveElements([R],{x:0,y:F})}}for(const b of qt(e,"sequenceFlow.update")){const R=f(b.id);if(b.source!==void 0||b.target!==void 0){const M=R,F=b.source!==void 0?f(b.source):M.source,H=b.target!==void 0?f(b.target):M.target,I=Y=>({x:Y.x+Y.width/2,y:Y.y+Y.height/2});n.reconnect(M,F,H,[I(F),I(H)])}b.name!==void 0&&n.updateProperties(R,{name:b.name??void 0}),b.condition!==void 0&&n.updateProperties(R,{name:((Jx=b.condition)==null?void 0:Jx.label)??void 0})}for(const b of qt(e,"messageFlow.update"))b.name!==void 0&&n.updateProperties(f(b.id),{name:b.name??void 0});for(const b of qt(e,"dataStore.update"))b.name!==void 0&&n.updateProperties(f(b.id),{name:b.name??void 0});for(const b of qt(e,"annotation.update")){const R=f(b.id);if(b.text!==void 0&&n.updateProperties(R,{text:b.text}),b.placement===null)L(R,"bwl:Placement",null);else if(b.placement){const M=f(b.placement.anchor),F=Dx(M),H=p(M)??u(),I=typeof H.x=="number"&&typeof H.width=="number"&&H.type==="bpmn:Participant",[Y,U]=gs[b.placement.side],W=b.placement.offset??50,le={x:F.x+F.width/2+Y*(F.width/2+R.width/2+W),y:F.y+F.height/2+U*(F.height/2+R.height/2+W)},Ce=I?Xu(o,F,{width:R.width,height:R.height},H,{placement:b.placement,selfId:b.id}):le;n.moveElements([R],{x:Ce.x-(R.x+R.width/2),y:Ce.y-(R.y+R.height/2)}),L(R,"bwl:Placement",T(b.placement))}}for(const b of qt(e,"group.update")){const R=f(b.id);if(b.name!==void 0&&n.updateLabel(R,b.name??""),b.members){const M=b.members.map(l).filter(F=>!!F);M.length&&n.resizeShape(R,Uf(M,b.id)),L(R,"bwl:Members",{refs:b.members.join(" ")})}}}function Zu(e){switch(e.kind){case"annotation-over-label":return[e.annotation];case"edge-crosses-shape":return[e.shape];case"shape-outside-container":return[e.shape];case"shape-overlap":return e.shapes;default:return[]}}function kE(e,t,n){var l,f;const{elementRegistry:i}=e,r=e.modeling,o=p=>Ai(p).filter(d=>!t.has(Si(d))),a=p=>{var d;return((d=i.get(p))==null?void 0:d.type)==="bpmn:TextAnnotation"},s=Et(i),c=o(s),u=[...new Set(c.flatMap(Zu))].filter(p=>n.has(p)&&a(p));if(u.length)for(const p of u){const d=i.get(p);if(!d||typeof d.x!="number"||typeof d.width!="number")continue;let h=d.parent,m;for(;h;){if(h.type==="bpmn:Participant"){m=h;break}h=h.parent}if(!m){const ge=d.x+d.width/2,Ve=d.y+d.height/2;m=i.getAll().find(q=>{if(q.type!=="bpmn:Participant")return!1;const ae=q;return typeof ae.x=="number"&&typeof ae.width=="number"&&ge>=ae.x&&ge<=ae.x+ae.width&&Ve>=ae.y&&Ve<=ae.y+ae.height})}if(!m||typeof m.x!="number"||typeof m.width!="number")continue;const S=(((l=d.businessObject.extensionElements)==null?void 0:l.values)??[]).find(ge=>ge.$type==="bwl:Placement"),E=[...d.incoming??[],...d.outgoing??[]].find(ge=>ge.type==="bpmn:Association"),x=(S!=null&&S.anchor?i.get(S.anchor):void 0)??(E?((f=E.source)==null?void 0:f.id)===p?E.target:E.source:void 0);if(!x)continue;const w=x.waypoints,C=w!=null&&w.length?{x:w[Math.floor((w.length-1)/2)].x,y:w[Math.floor((w.length-1)/2)].y,width:0,height:0}:{x:x.x,y:x.y,width:x.width,height:x.height},P={width:d.width,height:d.height},L={x:d.x+d.width/2,y:d.y+d.height/2},T=S==null?void 0:S.side,B=[];T&&T in gs&&B.push(Xu(i,C,P,m,{placement:{side:T,offset:(S==null?void 0:S.offset)??null},selfId:p}));for(const[ge,Ve]of[[-1,0],[1,0],[0,-1],[0,1]])for(let q=1;q<=ME;q++)B.push({x:L.x+ge*dh*q,y:L.y+Ve*dh*q});const k={...s,edges:s.edges.filter(ge=>ge.id!==(E==null?void 0:E.id))},O=o(k),$=O.filter(ge=>Zu(ge).includes(p)).length;if(!$)continue;let ne;for(const ge of B){const Ve=ge.x-L.x,q=ge.y-L.y;if(!Ve&&!q||ge.x-P.width/2<m.x||ge.x+P.width/2>m.x+m.width||ge.y-P.height/2<m.y||ge.y+P.height/2>m.y+m.height)continue;const ae={...k,shapes:k.shapes.map(te=>te.id===p?{...te,x:te.x+Ve,y:te.y+q}:te)},de=o(ae),re=de.filter(te=>Zu(te).includes(p)).length;if(re>=$||de.length>O.length)continue;const ve=Math.abs(Ve)+Math.abs(q);if((!ne||re<ne.mine||re===ne.mine&&(de.length<ne.all||de.length===ne.all&&ve<ne.dist))&&(ne={x:ge.x,y:ge.y,mine:re,all:de.length,dist:ve}),ne.mine===0&&ne.all<O.length)break}ne&&r.moveElements([d],{x:ne.x-L.x,y:ne.y-L.y})}}function mh(e,t,n=hh){const i=fh(e),r=ph(t,Hd(i.elementRegistry)),o={edgeCrossings:{before:0,after:0,pairs:[]}};if(r.length)return{ok:!1,issues:r,findings:[],stats:o};const a=Et(i.elementRegistry),s=new Set(Ai(a).map(Si)),c=new Set(a.edges.map(m=>m.id)),u=new Set(a.shapes.map(m=>m.id)),l=qu(a).length,f=e.get("commandStack");try{Zf(f,()=>{n(t,i),Xd(i,c),qd(i,s),nh(i,s,c),eh(i,c),SE(i,c),ah(i,s,c),oh(i,c),ch(i,u),kE(i,s,u)})}catch(m){return{ok:!1,issues:[{kind:"lower-failed",message:m instanceof Error?m.message:String(m)}],findings:[],stats:o}}const p=Et(i.elementRegistry),d=Ai(p).filter(m=>!s.has(Si(m))),h=qu(p);return{ok:!0,issues:[],findings:d,stats:{edgeCrossings:{before:l,after:h.length,pairs:h}}}}function OE(e){const t=e.slice(e.indexOf(":")+1);return t.charAt(0).toLowerCase()+t.slice(1)}function DE(e,t){return typeof e.get=="function"?e.get(t):e[t]}function gh(e,t){const n=DE(e,t);return typeof n=="number"&&Number.isFinite(n)?n:void 0}function yh(e,t){var i;return(((i=e.extensionElements)==null?void 0:i.values)??[]).find(r=>(r==null?void 0:r.$type)===t)}function LE(e){return typeof e=="string"&&Ru.includes(e)}function ci(e){if(typeof e=="string")return e;const t=e==null?void 0:e.id;return typeof t=="string"?t:void 0}function vh(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=[],S=new Set,E=new Set,x=q=>{q&&S.add(q)},w=q=>{S.add(q),E.add(q)},C=q=>{const ae=yh(q,"bwl:Placement");if(!ae)return;const de=typeof ae.anchor=="string"?ae.anchor:void 0;if(!de||!LE(ae.side))return;const re=typeof ae.offset=="number"?ae.offset:void 0;m.push({owner:q.id,anchor:de,side:ae.side,...re!==void 0?{offset:re}:{}})},P=q=>{const ae=yh(q,"bwl:Members"),de=typeof(ae==null?void 0:ae.refs)=="string"?ae.refs.split(/\s+/).filter(Boolean):[];de.length&&g.push({owner:q.id,refs:de})},L=q=>{var ae;for(const de of q)switch(x(de.id),de.$type){case"bpmn:TextAnnotation":w(de.id),s.push({id:de.id,text:typeof de.text=="string"?de.text:""}),C(de);break;case"bpmn:Association":d.push({id:de.id,type:de.$type,source:ci(de.sourceRef),target:ci(de.targetRef)});break;case"bpmn:Group":{w(de.id);const re=(ae=de.categoryValueRef)==null?void 0:ae.value;c.push({id:de.id,...typeof re=="string"&&re?{name:re}:{}}),P(de);break}default:u.push({id:de.id,type:de.$type,reason:"type-outside-mvp"})}},T=(q,ae)=>{const de=q.flowElements??[],re=(q.laneSets??[]).flatMap(te=>te.lanes??[]),ve=new Map;for(const te of re){x(te.id);for(const V of te.flowNodeRef??[]){const G=ci(V);G&&ve.set(G,te.id)}}for(const te of de){if(x(te.id),te.$type==="bpmn:SequenceFlow"){f.push({id:te.id,source:ci(te.sourceRef),target:ci(te.targetRef),...typeof te.name=="string"&&te.name?{name:te.name}:{}});continue}if(te.$type==="bpmn:DataStoreReference"){w(te.id),a.push({id:te.id,...te.name?{name:te.name}:{}});continue}const V=OE(te.$type);if(!qf(V)){u.push({id:te.id,type:te.$type,reason:"type-outside-mvp"});continue}w(te.id),o.push({id:te.id,type:V,...te.name?{name:te.name}:{},...ae?{participant:ae}:{},...ve.has(te.id)?{lane:ve.get(te.id)}:{}});const G=gh(te,"bwl:band");G!==void 0&&(l.bands[te.id]=G);for(const X of te.dataOutputAssociations??[])x(X.id),h.push({id:X.id,type:X.$type,source:te.id,target:ci(X.targetRef)});for(const X of te.dataInputAssociations??[])x(X.id),h.push({id:X.id,type:X.$type,source:ci((X.sourceRef??[])[0]),target:te.id})}L(q.artifacts??[])};if(n){const q=new Set;for(const ae of n.participants??[]){w(ae.id);const de=ci(ae.processRef);de&&q.add(de);const re=de?i.get(de):void 0,ve=((re==null?void 0:re.laneSets)??[]).flatMap(X=>X.lanes??[]),te=ve.map(X=>({id:X.id,...X.name?{name:X.name}:{}}));for(const X of te)w(X.id);const V=!re||(re.flowElements??[]).length===0&&ve.length===0&&(re.artifacts??[]).length===0;r.push({id:ae.id,...ae.name?{name:ae.name}:{},...V?{blackBox:!0}:{},...te.length?{lanes:te}:{}});const G=gh(ae,"bwl:poolOrder");G!==void 0&&(l.poolOrders[ae.id]=G),re&&T(re,ae.id)}for(const ae of n.messageFlows??[])x(ae.id),p.push({id:ae.id,source:ci(ae.sourceRef),target:ci(ae.targetRef),...typeof ae.name=="string"&&ae.name?{name:ae.name}:{}});L(n.artifacts??[]);for(const[ae,de]of i)!q.has(ae)&&(de.flowElements??[]).length>0&&u.push({id:ae,type:de.$type,reason:"unreachable-process"})}else for(const q of i.values())T(q);const B=[],k=[],O=[],$=[],ne=(q,ae)=>!!q&&!!ae&&E.has(q)&&E.has(ae);for(const q of f){if(!ne(q.source,q.target)){u.push({id:q.id,type:"bpmn:SequenceFlow",reason:"endpoint-outside-mvp"});continue}B.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(!ne(q.source,q.target)){u.push({id:q.id,type:"bpmn:MessageFlow",reason:"endpoint-outside-mvp"});continue}k.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(!ne(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}),q.id&&E.add(q.id)}for(const q of d){if(!ne(q.source,q.target)){u.push({id:q.id??"",type:q.type,reason:"endpoint-outside-mvp"});continue}O.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:ae}of g){const de=ae.filter(ve=>S.has(ve)),re=ge.get(q);re&&de.length&&(re.members=de)}for(const q of m)S.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:B,...k.length?{messageFlows:k}:{},...a.length?{dataStores:a}:{},...$.length?{dataAssociations:$}:{},...s.length?{annotations:s}:{},...O.length?{associations:O}:{},...c.length?{groups:c}:{}},hints:l,omitted:u}}async function IE(e){const{definitions:t,warnings:n}=await zu(e);return{...vh(t),warnings:n}}function NE(e,t,n,i={}){return{documentId:e,baseVersion:t,ops:[...n],origin:i.origin??"agent",clientOpId:(i.mkClientOpId??(()=>crypto.randomUUID()))()}}async function _h(e,t,{currentVersion:n}){if(t.baseVersion!==n)return{status:"conflict",baseVersion:t.baseVersion,currentVersion:n};const i=mh(e,t.ops);if(!i.ok)return{status:"rejected",issues:i.issues};const{xml:r}=await e.saveXML({format:!0});return{status:"applied",version:n+1,xml:r??"",findings:i.findings,stats:i.stats}}const BE=Symbol("bpmn-editor");function $E(){const e=At.ref(!1),t=At.ref(!0),n=At.ref(!1);let i,r;const o=()=>{e.value=!0};function a(u,l){u.get("canvas").getContainer().style.pointerEvents=l?"":"none";const f=u.get("keyboard");l?(r&&f.bind(r),r=void 0):r||(r=f.getBinding(),f.unbind())}function s(){if(!i)throw new Error("modeler not attached — 뷰 @ready 후 attach() 필요");return i}function c(){return i==null?void 0:i.get("commandStack")}return{dirty:e,editable:t,agentBusy:n,attach(u){i&&this.detach(),i=u,i.get("eventBus").on("commandStack.changed",o),t.value||a(i,!1)},detach(){i==null||i.get("eventBus").off("commandStack.changed",o),i&&!t.value&&a(i,!0),r=void 0,i=void 0},setEditable(u){t.value=u,i&&a(i,u)},async applyAgentBatch(u,l){const f=s();n.value=!0;try{const p=await _h(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:Gu(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 pe(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}function jE(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Qu={exports:{}},bh;function FE(){if(bh)return Qu.exports;bh=1;var e=Qu.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},Qu.exports}var HE=FE(),zE=jE(HE);function ui(e){if(!(this instanceof ui))return new ui(e);e=e||[128,36,1],this._seed=e.length?zE.rack(e[0],e[1],e[2]):e}ui.prototype.next=function(e){return this._seed(e||!0)},ui.prototype.nextPrefixed=function(e,t){var n;do n=e+this.next(!0);while(this.assigned(n));return this.claim(n,t),n},ui.prototype.claim=function(e,t){this._seed.set(e,t||!0)},ui.prototype.assigned=function(e){return this._seed.get(e)||!1},ui.prototype.unclaim=function(e){delete this._seed.hats[e]},ui.prototype.clear=function(){var e=this._seed.hats,t;for(t in e)this.unclaim(t)};const $t={legend:[1,"<fieldset>","</fieldset>"],tr:[2,"<table><tbody>","</tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],_default:[0,"",""]};$t.td=$t.th=[3,"<table><tbody><tr>","</tr></tbody></table>"],$t.option=$t.optgroup=[1,'<select multiple="multiple">',"</select>"],$t.thead=$t.tbody=$t.colgroup=$t.caption=$t.tfoot=[1,"<table>","</table>"],$t.polyline=$t.ellipse=$t.polygon=$t.circle=$t.text=$t.line=$t.path=$t.rect=$t.g=[1,'<svg xmlns="http://www.w3.org/2000/svg" version="1.1">',"</svg>"];function ft(e,t=globalThis.document){var u;if(typeof e!="string")throw new TypeError("String expected");const n=/^<!--(.*?)-->$/s.exec(e);if(n)return t.createComment(n[1]);const i=(u=/<([\w:]+)/.exec(e))==null?void 0:u[1];if(!i)return t.createTextNode(e);if(e=e.trim(),i==="body"){const l=t.createElement("html");l.innerHTML=e;const{lastChild:f}=l;return f.remove(),f}let[r,o,a]=Object.hasOwn($t,i)?$t[i]:$t._default,s=t.createElement("div");for(s.innerHTML=o+e+a;r--;)s=s.lastChild;if(s.firstChild===s.lastChild){const{firstChild:l}=s;return l.remove(),l}const c=t.createDocumentFragment();return c.append(...s.childNodes),c}function GE(e,t){return t.forEach(function(n){n&&typeof n!="string"&&!Array.isArray(n)&&Object.keys(n).forEach(function(i){if(i!=="default"&&!(i in e)){var r=Object.getOwnPropertyDescriptor(n,i);Object.defineProperty(e,i,r.get?r:{enumerable:!0,get:function(){return n[i]}})}})}),Object.freeze(e)}function dn(e,...t){const n=e.style;return D(t,function(i){i&&D(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 VE=Object.prototype.toString;function mt(e){return new Xi(e)}function Xi(e){if(!e||!e.nodeType)throw new Error("A DOM element reference is required");this.el=e,this.list=e.classList}Xi.prototype.add=function(e){return this.list.add(e),this},Xi.prototype.remove=function(e){return VE.call(e)=="[object RegExp]"?this.removeMatching(e):(this.list.remove(e),this)},Xi.prototype.removeMatching=function(e){const t=this.array();for(let n=0;n<t.length;n++)e.test(t[n])&&this.remove(t[n]);return this},Xi.prototype.toggle=function(e,t){return typeof t<"u"?t!==this.list.toggle(e,t)&&this.list.toggle(e):this.list.toggle(e),this},Xi.prototype.array=function(){return Array.from(this.list)},Xi.prototype.has=Xi.prototype.contains=function(e){return this.list.contains(e)};function ys(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 WE(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var vs={},xh;function UE(){if(xh)return vs;xh=1;var e,t,n;function i(){e=window.addEventListener?"addEventListener":"attachEvent",t=window.removeEventListener?"removeEventListener":"detachEvent",n=e!=="addEventListener"?"on":""}return vs.bind=function(r,o,a,s){return e||i(),r[e](n+o,a,s||!1),a},vs.unbind=function(r,o,a,s){return t||i(),r[t](n+o,a,s||!1),a},vs}var wh=UE(),qE=WE(wh),Me=GE({__proto__:null,default:qE},[wh]),Eh=["focus","blur"];function YE(e,t,n,i,r){return Eh.indexOf(n)!==-1&&(r=!0),Me.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 KE(e,t,n,i){return Eh.indexOf(t)!==-1&&(i=!0),Me.unbind(e,t,n,i)}var Cn={bind:YE,unbind:KE};function Ju(e,t){return e&&typeof e.matches=="function"&&e.matches(t)||!1}function ot(e,t){return t=t||document,t.querySelector(e)}function _s(e,t){return t=t||document,t.querySelectorAll(e)}function li(e){e.parentNode&&e.parentNode.removeChild(e)}function XE(e,t){if(e.ownerDocument!==t.ownerDocument)try{return t.ownerDocument.importNode(e,!0)}catch{}return e}function ZE(e,t){return t.appendChild(XE(e,t))}function Oe(e,t){return ZE(t,e),e}var el=2,Sh={"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":el,"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":el,"text-anchor":1,"text-decoration":1,"text-rendering":1,"unicode-bidi":1,visibility:1,"word-spacing":1,"writing-mode":1};function QE(e,t){return Sh[t]?e.style[t]:e.getAttributeNS(null,t)}function Rh(e,t,n){var i=t.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase(),r=Sh[i];r?(r===el&&typeof n=="number"&&(n=String(n)+"px"),e.style[i]=n):e.setAttributeNS(null,t,n)}function JE(e,t){var n=Object.keys(t),i,r;for(i=0,r;r=n[i];i++)Rh(e,r,t[r])}function fe(e,t,n){if(typeof t=="string")if(n!==void 0)Rh(e,t,n);else return QE(e,t);else JE(e,t);return e}const e1=Object.prototype.toString;function qe(e){return new Zi(e)}function Zi(e){if(!e||!e.nodeType)throw new Error("A DOM element reference is required");this.el=e,this.list=e.classList}Zi.prototype.add=function(e){return this.list.add(e),this},Zi.prototype.remove=function(e){return e1.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 bs(e){for(var t;t=e.firstChild;)e.removeChild(t);return e}function Ch(e){return e.cloneNode(!0)}var tl={svg:"http://www.w3.org/2000/svg"},Ph='<svg xmlns="'+tl.svg+'"';function t1(e){var t=!1;e.substring(0,4)==="<svg"?e.indexOf(tl.svg)===-1&&(e=Ph+e.substring(4)):(e=Ph+">"+e+"</svg>",t=!0);var n=n1(e);if(!t)return n;for(var i=document.createDocumentFragment(),r=n.firstChild;r.firstChild;)i.appendChild(r.firstChild);return i}function n1(e){var t;return t=new DOMParser,t.async=!1,t.parseFromString(e,"text/xml")}function be(e,t){var n;return e=e.trim(),e.charAt(0)==="<"?(n=t1(e).firstChild,n=document.importNode(n,!0)):n=document.createElementNS(tl.svg,e),t&&fe(n,t),n}var nl=null;function Ah(){return nl===null&&(nl=be("svg")),nl}function Th(e,t){var n,i,r=Object.keys(t);for(n=0;i=r[n];n++)e[i]=t[i];return e}function i1(e,t,n,i,r,o){var a=Ah().createSVGMatrix();switch(arguments.length){case 0:return a;case 1:return Th(a,e);case 6:return Th(a,{a:e,b:t,c:n,d:i,e:r,f:o})}}function Yo(e){return Ah().createSVGTransform()}var Mh=/([&<>]{1})/g,r1=/([&<>\n\r"]{1})/g,o1={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"'"};function il(e,t){function n(i,r){return o1[r]||r}return e.replace(t,n)}function kh(e,t){var n,i,r,o,a;switch(e.nodeType){case 3:t.push(il(e.textContent,Mh));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,'="',il(o.value,r1),'"');if(e.hasChildNodes()){for(t.push(">"),a=e.childNodes,n=0,i=a.length;n<i;++n)kh(a.item(n),t);t.push("</",e.tagName,">")}else t.push("/>");break;case 8:t.push("<!--",il(e.nodeValue,Mh),"-->");break;case 4:t.push("<![CDATA[",e.nodeValue,"]]>");break;default:throw new Error("unable to handle node "+e.nodeType)}return t}function a1(e){for(var t=e.firstChild,n=[];t;)kh(t,n),t=t.nextSibling;return n.join("")}function Oh(e,t){return a1(e)}function jt(e){var t=e.parentNode;return t&&t.removeChild(e),e}function s1(e,t){return t instanceof SVGMatrix?e.createSVGTransformFromMatrix(t):t}function c1(e,t){var n,i;for(e.clear(),n=0;i=t[n];n++)e.appendItem(s1(e,i))}function Ko(e,t){var n=e.transform.baseVal;return t&&(Array.isArray(t)||(t=[t]),c1(n,t)),n.consolidate()}const u1=/^class[ {]/;function l1(e){return u1.test(e.toString())}function rl(e){return Array.isArray(e)}function ol(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function xs(...e){e.length===1&&rl(e[0])&&(e=e[0]),e=[...e];const t=e.pop();return t.$inject=e,t}const p1=/constructor\s*[^(]*\(\s*([^)]*)\)/m,f1=/^(?:async\s+)?(?:function\s*[^(]*)?(?:\(\s*([^)]*)\)|(\w+))/m,d1=/\/\*([^*]*)\*\//m;function h1(e){if(typeof e!="function")throw new Error(`Cannot annotate "${e}". Expected a function!`);const t=e.toString().match(l1(e)?p1:f1);if(!t)return[];const n=t[1]||t[2];return n&&n.split(",").map(i=>{const r=i.match(d1);return(r&&r[1]||i).trim()})||[]}function Dh(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 C=x.split(".");let P=c(C.shift());for(;C.length;)P=P[C.shift()];return P}if(ol(o,x))return o[x];if(ol(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(rl(x))x=xs(x.slice());else throw s(`Cannot invoke "${x}". Expected a function!`);const P=(x.$inject||h1(x)).map(L=>ol(w,L)?w[L]:c(L));return{fn:x,dependencies:P}}function l(x){const{fn:w,dependencies:C}=u(x),P=Function.prototype.bind.call(w,null,...C);return new P}function f(x,w,C){const{fn:P,dependencies:L}=u(x,C);return P.apply(w,L)}function p(x){return xs(w=>x.get(w))}function d(x,w){if(w&&w.length){const C=Object.create(null),P=Object.create(null),L=[],T=[],B=[];let k,O,$,ne;for(let ge in r)k=r[ge],w.indexOf(ge)!==-1&&(k[2]==="private"?(O=L.indexOf(k[3]),O===-1?($=k[3].createChild([],w),ne=p($),L.push(k[3]),T.push($),B.push(ne),C[ge]=[ne,ge,"private",$]):C[ge]=[B[O],ge,"private",T[O]]):C[ge]=[k[2],k[1]],P[ge]=!0),(k[2]==="factory"||k[2]==="type")&&k[1].$scope&&w.forEach(Ve=>{k[1].$scope.indexOf(Ve)!==-1&&(C[ge]=[k[2],k[1]],P[Ve]=!0)});w.forEach(ge=>{if(!P[ge])throw new Error('No provider for "'+ge+'". Cannot use provider from the parent!')}),x.unshift(C)}return new Dh(x,a)}const h={factory:f,type:l,value:function(x){return x}};function m(x,w){const C=x.__init__||[];return function(){C.forEach(P=>{typeof P=="string"?w.get(P):w.invoke(P)})}}function g(x){const w=x.__exports__;if(w){const C=x.__modules__,P=Object.keys(x).reduce((O,$)=>($!=="__exports__"&&$!=="__modules__"&&$!=="__init__"&&$!=="__depends__"&&(O[$]=x[$]),O),Object.create(null)),L=(C||[]).concat(P),T=d(L),B=xs(function(O){return T.get(O)});w.forEach(function(O){r[O]=[B,O,"private",T]});const k=(x.__init__||[]).slice();return k.unshift(function(){T.init()}),x=Object.assign({},x,{__init__:k}),m(x,T)}return Object.keys(x).forEach(function(C){if(C==="__init__"||C==="__depends__")return;const P=x[C];if(P[2]==="private"){r[C]=P;return}const L=P[0],T=P[1];r[C]=[h[L],m1(L,T),L]}),m(x,a)}function S(x,w){return x.indexOf(w)!==-1||(x=(w.__depends__||[]).reduce(S,x),x.indexOf(w)!==-1)?x:x.concat(w)}function E(x){const w=x.reduce(S,[]).map(g);let C=!1;return function(){C||(C=!0,w.forEach(P=>P()))}}this.get=c,this.invoke=f,this.instantiate=l,this.createChild=d,this.init=E(e)}function m1(e,t){return e!=="value"&&rl(t)&&(t=xs(t.slice())),t}var g1=1e3;function Ti(e,t){var n=this;t=t||g1,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 y1(e){return["M",e.x,e.y]}function al(e){return["L",e.x,e.y]}function v1(e,t,n){return["C",e.x,e.y,t.x,t.y,n.x,n.y]}function _1(e,t){const n=e.length,i=[y1(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(al(a));continue}const c=Math.min(t,sl(a.x-o.x,a.y-o.y),sl(s.x-a.x,s.y-a.y));if(!c){i.push(al(a));continue}const u=ws(a,o,c),l=ws(a,o,c*.5),f=ws(a,s,c),p=ws(a,s,c*.5);i.push(al(u)),i.push(v1(l,p,f))}return i}function ws(e,t,n){const i=t.x-e.x,r=t.y-e.y,o=sl(i,r),a=n/o;return{x:e.x+i*a,y:e.y+r*a}}function sl(e,t){return Math.sqrt(Math.pow(e,2)+Math.pow(t,2))}function Xo(e,t,n){Pe(t)&&(n=t,t=null),t||(t={});const i=be("path",t);return Pe(n)&&(i.dataset.cornerRadius=String(n)),cl(i,e)}function cl(e,t){const n=parseInt(e.dataset.cornerRadius,10)||0;return fe(e,{d:Dr(_1(t,n))}),e}function Es(e){var t=new Set(e);return He(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,Ee(e)||(e=[e]),D(e,function(i,r){var o=t(i,r,n);Ee(o)&&o.length&&Lr(o,t,n+1)})}function ul(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 Zo(e,t){return ul(e)}function b1(e,t,n){Cr(t)&&(t=!0),Vt(t)&&(n=t,t=!0),n=n||{};var i=Qo(n.allShapes),r=Qo(n.allConnections),o=Qo(n.enclosedElements),a=Qo(n.enclosedConnections),s=Qo(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,D(l.incoming,c),D(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,Ee(e)||(e=[e]);var n,i,r,o;return D(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 D(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 Lh(e){return"waypoints"in e?"connection":"x"in e?"shape":"root"}function Ih(e){return!!(e&&e.isFrame)}function Qo(e,t){return j({},e||{},t||{})}var x1=1;function Qi(e,t){Ti.call(this,e,x1),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})}pe(Qi,Ti),Qi.prototype.canRender=function(){return!0},Qi.prototype.drawShape=function(t,n,i){var r=be("rect");return fe(r,{x:0,y:0,width:n.width||0,height:n.height||0}),Ih(n)?fe(r,j({},this.FRAME_STYLE,i||{})):fe(r,j({},this.SHAPE_STYLE,i||{})),Oe(t,r),r},Qi.prototype.drawConnection=function(t,n,i){var r=Xo(n.waypoints,j({},this.CONNECTION_STYLE,i||{}));return Oe(t,r),r},Qi.prototype.getShapePath=function(t){var n=t.x,i=t.y,r=t.width,o=t.height,a=[["M",n,i],["l",r,0],["l",0,o],["l",-r,0],["z"]];return Dr(a)},Qi.prototype.getConnectionPath=function(t){var n=t.waypoints,i,r,o=[];for(i=0;r=n[i];i++)r=r.original||r,o.push([i===0?"M":"L",r.x,r.y]);return Dr(o)},Qi.$inject=["eventBus","styles"];function w1(){var e={"no-fill":{fill:"none"},"no-border":{strokeOpacity:0},"no-events":{pointerEvents:"none"}},t=this;this.cls=function(n,i,r){var o=this.style(i,r);return j(o,{class:n})},this.style=function(n,i){!Ee(n)&&!i&&(i=n,n=[]);var r=Sn(n,function(o,a){return j(o,e[a]||{})},{});return i?j(r,i):r},this.computeStyle=function(n,i,r){return Ee(i)||(r=i,i=[]),t.style(i||[],j({},r,n||{}))}}const E1={__init__:["defaultRenderer"],defaultRenderer:["type",Qi],styles:["type",w1]};function wt(e,t){if(!e||!t)return-1;var n=e.indexOf(t);return n!==-1&&e.splice(n,1),n}function St(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 ll(e,t){return!e||!t?-1:e.indexOf(t)}function Jo(e,t){return!e||!t?-1:Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function pl(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=Jo(e,t);return Math.abs(r/o)<=i}var S1=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(R1(r,n))return o;return!1}function R1(e,t){const n=t[0];return Pr(t,function(i){return Math.abs(n[e]-i[e])<=S1})}function Nh(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 fl(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,Bh=parseFloat,kt=Math,Ji=kt.PI,pi=kt.min,fi=kt.max,$h=kt.pow,er=kt.abs,P1=/([a-z])[\s,]*((-?\d*\.?\d*(?:e[-+]?\d+)?[\s]*,?[\s]*)+)/ig,A1=/(-?\d*\.?\d*(?:e[-+]?\d+)?)[\s]*,?[\s]*/ig,jh=Array.isArray||function(e){return e instanceof Array};function T1(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function M1(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 k1(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 T1(r,i)?(M1(o,i),r[i]):(o.length>=1e3&&delete r[o.shift()],o.push(i),r[i]=e(...arguments),r[i])}return t}function O1(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(P1,function(i,r,o){var a=[],s=r.toLowerCase();for(o.replace(A1,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=hl,n}function D1(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 L1(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 dl(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 hl(){return this.join(",").replace(C1,"$1")}function I1(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=hl,t}function Fh(e,t,n,i,r,o,a,s,c){var u=1-c,l=$h(u,3),f=$h(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:Ss(h),y:Ss(m)}}function Hh(e){var t=H1(...e);return dl(t.x0,t.y0,t.x1-t.x0,t.y1-t.y0)}function tr(e,t,n){return t>=e.x&&t<=e.x+e.width&&n>=e.y&&n<=e.y+e.height}function N1(e,t){return e=dl(e),t=dl(t),tr(t,e.x,e.y)||tr(t,e.x2,e.y)||tr(t,e.x,e.y2)||tr(t,e.x2,e.y2)||tr(e,t.x,t.y)||tr(e,t.x2,t.y)||tr(e,t.x,t.y2)||tr(e,t.x2,t.y2)||(e.x<t.x2&&e.x>t.x||t.x<e.x2&&t.x>e.x)&&(e.y<t.y2&&e.y>t.y||t.y<e.y2&&t.y>e.y)}function zh(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 Gh(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=zh(m,e,n,r,a),S=zh(m,t,i,o,s),E=g*g+S*S;d+=p[h]*kt.sqrt(E)}return u*d}function B1(e,t,n,i,r,o,a,s){if(!(fi(e,n)<pi(r,a)||pi(e,n)>fi(r,a)||fi(t,i)<pi(o,s)||pi(t,i)>fi(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=Ss(c/l),p=Ss(u/l),d=+f.toFixed(2),h=+p.toFixed(2);if(!(d<+pi(e,n).toFixed(2)||d>+fi(e,n).toFixed(2)||d<+pi(r,a).toFixed(2)||d>+fi(r,a).toFixed(2)||h<+pi(t,i).toFixed(2)||h>+fi(t,i).toFixed(2)||h<+pi(o,s).toFixed(2)||h>+fi(o,s).toFixed(2)))return{x:f,y:p}}}}function Ss(e){return Math.round(e*1e11)/1e11}function $1(e,t,n){var i=Hh(e),r=Hh(t);if(!N1(i,r))return[];var o=Gh(...e),a=Gh(...t),s=Wh(e)?1:~~(o/5)||1,c=Wh(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=Fh(...e,d/s);u[d]={x:m.x,y:m.y,t:d/s}}for(d=0;d<c+1;d++)m=Fh(...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],S=u[d+1],E=l[h],x=l[h+1],w=er(S.x-g.x)<.01?"y":"x",C=er(x.x-E.x)<.01?"y":"x",P=B1(g.x,g.y,S.x,S.y,E.x,E.y,x.x,x.y),L;if(P){if(L=P.x.toFixed(9)+"#"+P.y.toFixed(9),f[L])continue;f[L]=!0;var T=g.t+er((P[w]-g[w])/(S[w]-g[w]))*(S.t-g.t),B=E.t+er((P[C]-E[C])/(x[C]-E[C]))*(x.t-E.t);T>=0&&T<=1&&B>=0&&B<=1&&p.push({x:P.x,y:P.y,t1:T,t2:B})}}return p}function Vh(e,t,n){e=Yh(e),t=Yh(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 S=0,E=t.length;S<E;S++){var x=t[S];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=$1(f,p);{for(var C=0,P=w.length;C<P;C++)w[C].segment1=h,w[C].segment2=S,w[C].bez1=f,w[C].bez2=p;d=d.concat(w)}}}}}return d}function j1(e){return jh(e)&&jh(e[0])}function F1(e){if(D1(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=hl,t}function Wh(e){return e[0]===e[2]&&e[1]===e[3]&&e[4]===e[6]&&e[5]===e[7]}function Rs(e,t,n,i){return[e,t,n,i,n,i]}function Uh(e,t,n,i,r,o){var a=.3333333333333333,s=2/3;return[a*e+s*n,a*t+s*i,a*r+s*n,a*o+s*i,r,o]}function qh(e,t,n,i,r,o,a,s,c,u){var l=Ji*120/180,f=Ji/180*(+r||0),p=[],d,h=k1(function(A,_,y){var N=A*kt.cos(y)-_*kt.sin(y),z=A*kt.sin(y)+_*kt.cos(y);return{x:N,y:z}});if(u)L=u[0],T=u[1],C=u[2],P=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,S=m*m/(n*n)+g*g/(i*i);S>1&&(S=kt.sqrt(S),n=S*n,i=S*i);var E=n*n,x=i*i,w=(o==a?-1:1)*kt.sqrt(er((E*x-E*g*g-x*m*m)/(E*g*g+x*m*m))),C=w*n*g/i+(e+s)/2,P=w*-i*m/n+(t+c)/2,L=kt.asin(((t-P)/i).toFixed(9)),T=kt.asin(((c-P)/i).toFixed(9));L=e<C?Ji-L:L,T=s<C?Ji-T:T,L<0&&(L=Ji*2+L),T<0&&(T=Ji*2+T),a&&L>T&&(L=L-Ji*2),!a&&T>L&&(T=T-Ji*2)}var B=T-L;if(er(B)>l){var k=T,O=s,$=c;T=L+l*(a&&T>L?1:-1),s=C+n*kt.cos(T),c=P+i*kt.sin(T),p=qh(s,c,n,i,r,0,a,O,$,[T,k,C,P])}B=T-L;var ne=kt.cos(L),ge=kt.sin(L),Ve=kt.cos(T),q=kt.sin(T),ae=kt.tan(B/4),de=4/3*n*ae,re=4/3*i*ae,ve=[e,t],te=[e+de*ge,t-re*ne],V=[s+de*q,c-re*Ve],G=[s,c];if(te[0]=2*ve[0]-te[0],te[1]=2*ve[1]-te[1],u)return[te,V,G].concat(p);p=[te,V,G].concat(p).join().split(",");for(var X=[],je=0,Rt=p.length;je<Rt;je++)X[je]=je%2?h(p[je-1],p[je],f).y:h(p[je],p[je+1],f).x;return X}function H1(e,t,n,i,r,o,a,s){for(var c=[],u=[[],[]],l,f,p,d,h,m,g,S,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),er(l)<1e-12){if(er(f)<1e-12)continue;d=-p/f,0<d&&d<1&&c.push(d);continue}g=f*f-4*p*l,S=kt.sqrt(g),!(g<0)&&(h=(-f+S)/(2*l),0<h&&h<1&&c.push(h),m=(-f-S)/(2*l),0<m&&m<1&&c.push(m))}for(var x=c.length,w=x,C;x--;)d=c[x],C=1-d,u[0][x]=C*C*C*e+3*C*C*d*n+3*C*d*d*r+d*d*d*a,u[1][x]=C*C*C*t+3*C*C*d*i+3*C*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:pi(...u[0]),y0:pi(...u[1]),x1:fi(...u[0]),y1:fi(...u[1])}}function Yh(e){if(j1(e)||(e=O1(e)),L1(e))return e;for(var t=I1(F1(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",...qh(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",...Uh(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",...Uh(d.x,d.y,p[1],p[2],p[3],p[4])];break;case"L":p=["C",...Rs(d.x,d.y,p[1],p[2])];break;case"H":p=["C",...Rs(d.x,d.y,p[1],d.y)];break;case"V":p=["C",...Rs(d.x,d.y,d.x,p[1])];break;case"Z":p=["C",...Rs(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=Bh(l[f-4])||n.x,n.by=Bh(l[f-3])||n.y}return t}function at(e){return Vt(e)&&En(e,"waypoints")}function $e(e){return Vt(e)&&En(e,"labelTarget")}function z1(e){return Vt(e)&&Jr(e.parent)}function Kh(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 xe(e){return{top:e.y,right:e.x+(e.width||0),bottom:e.y+(e.height||0),left:e.x}}function Cs(e){return{x:e.left,y:e.top,width:e.right-e.left,height:e.bottom-e.top}}function G1(e){return ki({x:e.x+(e.width||0)/2,y:e.y+(e.height||0)/2})}function V1(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=q1(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 Se(e){return at(e)?V1(e):G1(e)}function Zt(e,t,n){n=n||0,Vt(n)||(n={x:n,y:n});var i=xe(e),r=xe(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 ea(e,t,n){var i=W1(e,t);return i.length===1||i.length===2&&Jo(i[0],i[1])<1?ki(i[0]):i.length>1?(i=ri(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 W1(e,t){return Vh(e,t)}function U1(e){e=e.slice();for(var t=0,n,i,r;e[t];)n=e[t],i=e[t-1],r=e[t+1],Jo(n,r)===0||pl(i,r,n)?e.splice(t,1):t++;return e}function q1(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function Ps(e,t){return Math.round(e*t)/t}function Xh(e){return Pe(e)?e+"px":e}function Y1(e){for(;e.parent;)e=e.parent;return e}function K1(e){e=j({},{width:"100%",height:"100%"},e);const t=e.container||document.body,n=document.createElement("div");return n.setAttribute("class","djs-container djs-parent"),dn(n,{position:"relative",overflow:"hidden",width:Xh(e.width),height:Xh(e.height)}),t.appendChild(n),n}function Zh(e,t,n){const i=be("g");qe(i).add(t);const r=n!==void 0?n:e.childNodes.length-1;return e.insertBefore(i,e.childNodes[r]||null),i}const X1="base",Qh=0,Z1=1,Q1={shape:["x","y","width","height"],connection:["waypoints"]};function Re(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||{})}Re.$inject=["config.canvas","eventBus","graphicsFactory","elementRegistry"],Re.prototype._init=function(e){const t=this._eventBus,n=this._container=K1(e),i=this._svg=be("svg");fe(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")}),Oe(n,i);const r=this._viewport=Zh(i,"viewport");e.deferUpdate&&(this._viewboxChanged=Tu(this._viewboxChanged,300)),this._restoreFocus=Tu(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)},Re.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},Re.prototype._setFocused=function(e){e!=this._focused&&(this._focused=e,this._eventBus.fire("canvas.focus.changed",{focused:e}))},Re.prototype._clear=function(){this._elementRegistry.getAll().forEach(t=>{const n=Lh(t);n==="root"?this.removeRootElement(t):this._removeElement(t,n)}),this._planes=[],this._rootElement=null,delete this._cachedViewbox},Re.prototype.focus=function(){this._svg.focus({preventScroll:!0}),this._setFocused(!0)},Re.prototype.restoreFocus=function(){this._restoreFocus()},Re.prototype._restoreFocus=function(){document.activeElement===document.body&&this.focus()},Re.prototype.isFocused=function(){return this._focused},Re.prototype.getDefaultLayer=function(){return this.getLayer(X1,Qh)},Re.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},Re.prototype._getChildIndex=function(e){return Sn(this._layers,function(t,n){return n.visible&&e>=n.index&&t++,t},0)},Re.prototype._createLayer=function(e,t){typeof t>"u"&&(t=Z1);const n=this._getChildIndex(t);return{group:Zh(this._viewport,"layer-"+e,n),index:t,visible:!0}},Re.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},Re.prototype.hideLayer=function(e){if(!e)throw new Error("must specify a name");const t=this._layers[e];if(!t)throw new Error("layer <"+e+"> does not exist");const n=t.group;return t.visible&&(jt(n),t.visible=!1),n},Re.prototype._removeLayer=function(e){const t=this._layers[e];t&&(delete this._layers[e],jt(t.group))},Re.prototype.getActiveLayer=function(){const e=this._findPlaneForRoot(this.getRootElement());return e?e.layer:null},Re.prototype.findRoot=function(e){const t=this._resolveElements(e);let n;for(const i of t){const r=this._findPlaneForRoot(Y1(i));if(!r||n&&r.rootElement!==n)return;n=r.rootElement}return n},Re.prototype.getRootElements=function(){return this._planes.map(function(e){return e.rootElement})},Re.prototype._findPlaneForRoot=function(e){return ut(this._planes,function(t){return t.rootElement===e})},Re.prototype._resolveElement=function(e){return typeof e=="string"?this._elementRegistry.get(e):e},Re.prototype._resolveElements=function(e){return Ee(e)||(e=[e]),e.map(t=>this._resolveElement(t)).filter(Boolean)},Re.prototype.getContainer=function(){return this._container},Re.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&&(D([i.gfx,i.secondaryGfx],function(r){r&&(n?(e.markers.add(t),qe(r).add(t)):(e.markers.delete(t),qe(r).remove(t)))}),this._eventBus.fire("element.marker.update",{element:e,gfx:i.gfx,marker:t,add:!!n}))},Re.prototype.addMarker=function(e,t){this._updateMarker(e,t,!0)},Re.prototype.removeMarker=function(e,t){this._updateMarker(e,t,!1)},Re.prototype.hasMarker=function(e,t){return e=this._resolveElement(e),e.markers?e.markers.has(t):!1},Re.prototype.toggleMarker=function(e,t){this.hasMarker(e,t)?this.removeMarker(e,t):this.addMarker(e,t)},Re.prototype.getRootElement=function(){const e=this._rootElement;return e||this._planes.length?e:this.setRootElement(this.addRootElement(null))},Re.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},Re.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},Re.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},Re.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)},Re.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})},Re.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})},Re.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=Q1[e];if(!Pr(n,function(r){return typeof t[r]<"u"}))throw new Error("must supply { "+n.join(", ")+" } with "+e)},Re.prototype._setParent=function(e,t,n){St(t.children,e,n),e.parent=t},Re.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},Re.prototype.addShape=function(e,t,n){return this._addElement("shape",e,t,n)},Re.prototype.addConnection=function(e,t,n){return this._addElement("connection",e,t,n)},Re.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),wt(e.parent&&e.parent.children,e),e.parent=null,r.fire(t+".removed",{element:e}),n.remove(e),e},Re.prototype.removeShape=function(e){return this._removeElement(e,"shape")},Re.prototype.removeConnection=function(e){return this._removeElement(e,"connection")},Re.prototype.getGraphics=function(e,t){return this._elementRegistry.getGraphics(e,t)},Re.prototype._changeViewbox=function(e){this._eventBus.fire("canvas.viewbox.changing"),e.apply(this),this._cachedViewbox=null,this._viewboxChanged()},Re.prototype._viewboxChanged=function(){this._eventBus.fire("canvas.viewbox.changed",{viewbox:this.viewbox()})},Re.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);Ko(t,l)});else return o=this._rootElement?this.getActiveLayer():null,i=o&&o.getBBox()||{},a=Ko(t),r=a?a.matrix:i1(),s=Ps(r.a,1e3),c=Ps(-r.e||0,1e3),u=Ps(-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},Re.prototype.scroll=function(e){const t=this._viewport;let n=t.getCTM();return e&&this._changeViewbox(function(){e=j({dx:0,dy:0},e||{}),n=this._svg.createSVGMatrix().translate(e.dx,e.dy).multiply(n),Jh(t,n)}),{x:n.e,y:n.f}},Re.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=xe(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=xe(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),S=Math.min(0,s.top-p.top);l=h||m,f=g||S}this.scroll({dx:-l*u,dy:-f*u})},Re.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)}),Ps(i.a,1e3)};function Jh(e,t){const n="matrix("+t.a+","+t.b+","+t.c+","+t.d+","+t.e+","+t.f+")";e.setAttribute("transform",n)}Re.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},Re.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=j(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),Jh(this._viewport,l),l},Re.prototype.getSize=function(){return{width:this._container.clientWidth,height:this._container.clientHeight}},Re.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}},Re.prototype.resized=function(){delete this._cachedViewbox,this._eventBus.fire("canvas.resized")};var lo="data-element-id";function In(e){this._elements={},this._eventBus=e}In.$inject=["eventBus"],In.prototype.add=function(e,t,n){var i=e.id;this._validateId(i),fe(t,lo,i),n&&fe(n,lo,i),this._elements[i]={element:e,gfx:t,secondaryGfx:n}},In.prototype.remove=function(e){var t=this._elements,n=e.id||e,i=n&&t[n];i&&(fe(i.gfx,lo,""),i.secondaryGfx&&fe(i.secondaryGfx,lo,""),delete t[n])},In.prototype.updateId=function(e,t){this._validateId(t),typeof e=="string"&&(e=this.get(e)),this._eventBus.fire("element.updateId",{element:e,newId:t});var n=this.getGraphics(e),i=this.getGraphics(e,!0);this.remove(e),e.id=t,this.add(e,n,i)},In.prototype.updateGraphics=function(e,t,n){var i=e.id||e,r=this._elements[i];return n?r.secondaryGfx=t:r.gfx=t,t&&fe(t,lo,i),t},In.prototype.get=function(e){var t;typeof e=="string"?t=e:t=e&&fe(e,lo);var n=this._elements[t];return n&&n.element},In.prototype.filter=function(e){var t=[];return this.forEach(function(n,i){e(n,i)&&t.push(n)}),t},In.prototype.find=function(e){for(var t=this._elements,n=Object.keys(t),i=0;i<n.length;i++){var r=n[i],o=t[r],a=o.element,s=o.gfx;if(e(a,s))return a}},In.prototype.getAll=function(){return this.filter(function(e){return e})},In.prototype.forEach=function(e){var t=this._elements;Object.keys(t).forEach(function(n){var i=t[n],r=i.element,o=i.gfx;return e(r,o)})},In.prototype.getGraphics=function(e,t){var n=e.id||e,i=this._elements[n];return i&&(t?i.secondaryGfx:i.gfx)},In.prototype._validateId=function(e){if(!e)throw new Error("element must have an id");if(this._elements[e])throw new Error("element with id "+e+" already added")};function J1(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 eS(e){return e.__refs_collection===!0}function tS(e,t){return Object.prototype.hasOwnProperty.call(e,t.name||t)}function em(e,t,n){var i=J1(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 nS(e,t,n){var i=t.inverse,r=n[t.name];Object.defineProperty(n,t.name,{configurable:t.configurable,enumerable:t.enumerable,get:function(){return r},set:function(o){if(o!==r){var a=r;r=null,a&&e.unset(a,i,n),r=o,e.set(r,i,n)}}})}function Fn(e,t){if(!(this instanceof Fn))return new Fn(e,t);e.inverse=t,t.inverse=e,this.props={},this.props[e.name]=e,this.props[t.name]=t}Fn.prototype.bind=function(e,t){if(typeof t=="string"){if(!this.props[t])throw new Error("no property <"+t+"> in ref");t=this.props[t]}t.collection?em(this,t,e):nS(this,t,e)},Fn.prototype.ensureRefsCollection=function(e,t){var n=e[t.name];return eS(n)||em(this,t,e),n},Fn.prototype.ensureBound=function(e,t){tS(e,t)||this.bind(e,t)},Fn.prototype.unset=function(e,t,n){e&&(this.ensureBound(e,t),t.collection?this.ensureRefsCollection(e,t).remove(n):e[t.name]=void 0)},Fn.prototype.set=function(e,t,n){e&&(this.ensureBound(e,t),t.collection?this.ensureRefsCollection(e,t).add(n):e[t.name]=n)};var ml=new Fn({name:"children",enumerable:!0,collection:!0},{name:"parent"}),tm=new Fn({name:"labels",enumerable:!0,collection:!0},{name:"labelTarget"}),nm=new Fn({name:"attachers",collection:!0},{name:"host"}),im=new Fn({name:"outgoing",collection:!0},{name:"source"}),rm=new Fn({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)}}),ml.bind(this,"parent"),tm.bind(this,"labels"),im.bind(this,"outgoing"),rm.bind(this,"incoming")}function ta(){po.call(this),ml.bind(this,"children"),nm.bind(this,"host"),nm.bind(this,"attachers")}pe(ta,po);function om(){po.call(this),ml.bind(this,"children")}pe(om,ta);function am(){ta.call(this),tm.bind(this,"labelTarget")}pe(am,ta);function sm(){po.call(this),im.bind(this,"source"),rm.bind(this,"target")}pe(sm,po);var iS={connection:sm,shape:ta,label:am,root:om};function rS(e,t){var n=iS[e];if(!n)throw new Error("unknown type: <"+e+">");return j(new n,t)}function oS(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=j({},t||{}),t.id||(t.id=e+"_"+this._uid++),rS(e,t)};var As="__fn",cm=1e3,aS=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=Ee(e)?e:[e],Wt(t)&&(i=n,n=t,t=cm),!Pe(t))throw new Error("priority must be a number");var r=n;i&&(r=vn(n,i),r[As]=n[As]||n);var o=this;e.forEach(function(a){o._addListener(a,{priority:t,callback:r,next:null})})},Pn.prototype.once=function(e,t,n,i){var r=this;if(Wt(t)&&(i=n,n=t,t=cm),!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[As]=n,this.on(e,t,o)},Pn.prototype.off=function(e,t){e=Ee(e)?e:[e];var n=this;e.forEach(function(i){n._removeListener(i,t)})},Pn.prototype.createEvent=function(e){var t=new na;return t.init(e),t},Pn.prototype.fire=function(e,t){var n,i,r,o;if(o=aS.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 na?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=sS(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[As]===t)&&(r?r.next=i:this._setListeners(e,i)),r=n,n=i};function na(){}na.prototype.stopPropagation=function(){this.cancelBubble=!0},na.prototype.preventDefault=function(){this.defaultPrevented=!0},na.prototype.init=function(e){j(this,e||{})};function sS(e,t){return e.apply(null,t)}function Ir(e){return e.childNodes[0]}function cS(e){return e.parentNode.childNodes[1]}function Ts(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),Ko(e,[o,a,s])}function Qt(e,t,n){var i=Yo();i.setTranslate(t,n),Ko(e,i)}function um(e,t){var n=Yo();n.setRotate(t,0,0),Ko(e,n)}function Nn(e,t){this._eventBus=e,this._elementRegistry=t}Nn.$inject=["eventBus","elementRegistry"],Nn.prototype._getChildrenContainer=function(e){var t=this._elementRegistry.getGraphics(e),n;return e.parent?(n=cS(t),n||(n=be("g"),qe(n).add("djs-children"),Oe(t.parentNode,n))):n=t,n},Nn.prototype._clear=function(e){var t=Ir(e);return ys(t),t},Nn.prototype._createContainer=function(e,t,n,i){var r=be("g");qe(r).add("djs-group"),typeof n<"u"?uS(r,t,t.childNodes[n]):Oe(t,r);var o=be("g");qe(o).add("djs-element"),qe(o).add("djs-"+e),i&&qe(o).add("djs-frame"),Oe(r,o);var a=be("g");return qe(a).add("djs-visual"),Oe(o,a),o},Nn.prototype.create=function(e,t,n){var i=this._getChildrenContainer(t.parent);return this._createContainer(e,i,n,Ih(t))},Nn.prototype.updateContainments=function(e){var t=this,n=this._elementRegistry,i;i=Sn(e,function(r,o){return o.parent&&(r[o.parent.id]=o.parent),r},{}),D(i,function(r){var o=r.children;if(o){var a=t._getChildrenContainer(r),s=a.firstChild;D(o,function(c){var u=n.getGraphics(c).parentNode;u===s?s=s.nextSibling:a.insertBefore(u,s)})}})},Nn.prototype.drawShape=function(e,t,n={}){var i=this._eventBus;return i.fire("render.shape",{gfx:e,element:t,attrs:n})},Nn.prototype.getShapePath=function(e){var t=this._eventBus;return t.fire("render.getShapePath",e)},Nn.prototype.drawConnection=function(e,t,n={}){var i=this._eventBus;return i.fire("render.connection",{gfx:e,element:t,attrs:n})},Nn.prototype.getConnectionPath=function(e){var t=this._eventBus;return t.fire("render.getConnectionPath",e)},Nn.prototype.update=function(e,t,n){if(t.parent){var i=this._clear(n);if(e==="shape")this.drawShape(i,t),Qt(n,t.x,t.y);else if(e==="connection")this.drawConnection(i,t);else throw new Error("unknown type: "+e);t.hidden?fe(n,"display","none"):fe(n,"display","block")}},Nn.prototype.remove=function(e){var t=this._elementRegistry.getGraphics(e);jt(t.parentNode)};function uS(e,t,n){var i=n||t.firstChild;e!==i&&t.insertBefore(e,i)}const lS={__depends__:[E1],__init__:["canvas"],canvas:["type",Re],elementRegistry:["type",In],elementFactory:["type",Oi],eventBus:["type",Pn],graphicsFactory:["type",Nn]};function pS(e){var t=new Dh(e);return t.init(),t}function fS(e){e=e||{};var t={config:["value",e]},n=[t,lS].concat(e.modules||[]);return pS(n)}function nr(e,t){this._injector=t||fS(e),this.get("eventBus").fire("diagram.init")}nr.prototype.get=function(e,t){return this._injector.get(e,t)},nr.prototype.invoke=function(e,t,n){return this._injector.invoke(e,t,n)},nr.prototype.destroy=function(){this.get("eventBus").fire("diagram.destroy")},nr.prototype.clear=function(){this.get("eventBus").fire("diagram.clear")};function cn(e){return e?"<"+e.$type+(e.id?' id="'+e.id:"")+'" />':"<null>"}function _n(e,t){return e.$instanceOf(t)}function dS(e){return ut(e.rootElements,function(t){return _n(t,"bpmn:Process")||_n(t,"bpmn:Collaboration")})}function hS(e){var t={},n=[],i={};function r(V,G){return function(X){V(X,G)}}function o(V){t[V.id]=V}function a(V){return t[V.id]}function s(V,G){var X=V.gfx;if(X)throw new Error(`already rendered ${cn(V)}`);return e.element(V,i[V.id],G)}function c(V,G){return e.root(V,i[V.id],G)}function u(V,G){try{var X=i[V.id]&&s(V,G);return o(V),X}catch(je){l(je.message,{element:V,error:je}),console.error(`failed to import ${cn(V)}`,je)}}function l(V,G){e.error(V,G)}var f=this.registerDi=function(G){var X=G.bpmnElement;X?i[X.id]?l(`multiple DI elements defined for ${cn(X)}`,{element:X}):i[X.id]=G:l(`no bpmnElement referenced in ${cn(G)}`,{element:G})};function p(V){d(V.plane)}function d(V){f(V),D(V.planeElement,h)}function h(V){f(V)}this.handleDefinitions=function(G,X){var je=G.diagrams;if(X&&je.indexOf(X)===-1)throw new Error("diagram not part of <bpmn:Definitions />");if(!X&&je&&je.length&&(X=je[0]),!X)throw new Error("no diagram to display");i={},p(X);var Rt=X.plane;if(!Rt)throw new Error(`no plane for ${cn(X)}`);var A=Rt.bpmnElement;if(!A)if(A=dS(G),A)l(`correcting missing bpmnElement on ${cn(Rt)} to ${cn(A)}`),Rt.bpmnElement=A,f(Rt);else throw new Error("no process or collaboration to display");var _=c(A,Rt);if(_n(A,"bpmn:Process")||_n(A,"bpmn:SubProcess"))g(A,_);else if(_n(A,"bpmn:Collaboration"))ve(A,_),S(G.rootElements,_);else throw new Error(`unsupported bpmnElement for ${cn(Rt)}: ${cn(A)}`);m(n)};var m=this.handleDeferred=function(){for(var G;n.length;)G=n.shift(),G()};function g(V,G){ae(V,G),B(V.ioSpecification,G),T(V.artifacts,G),o(V)}function S(V,G){var X=He(V,function(je){return!a(je)&&_n(je,"bpmn:Process")&&je.laneSets});X.forEach(r(g,G))}function E(V,G){u(V,G)}function x(V,G){D(V,r(E,G))}function w(V,G){u(V,G)}function C(V,G){u(V,G)}function P(V,G){u(V,G)}function L(V,G){u(V,G)}function T(V,G){D(V,function(X){_n(X,"bpmn:Association")?n.push(function(){L(X,G)}):L(X,G)})}function B(V,G){V&&(D(V.dataInputs,r(C,G)),D(V.dataOutputs,r(P,G)))}var k=this.handleSubProcess=function(G,X){ae(G,X),T(G.artifacts,X)};function O(V,G){var X=u(V,G);_n(V,"bpmn:SubProcess")&&k(V,X||G),_n(V,"bpmn:Activity")&&B(V.ioSpecification,G),n.push(function(){D(V.dataInputAssociations,r(w,G)),D(V.dataOutputAssociations,r(w,G))})}function $(V,G){u(V,G)}function ne(V,G){u(V,G)}function ge(V,G){n.push(function(){var X=u(V,G);V.childLaneSet&&Ve(V.childLaneSet,X||G),te(V)})}function Ve(V,G){D(V.lanes,r(ge,G))}function q(V,G){D(V,r(Ve,G))}function ae(V,G){de(V.flowElements,G),V.laneSets&&q(V.laneSets,G)}function de(V,G){D(V,function(X){_n(X,"bpmn:SequenceFlow")?n.push(function(){$(X,G)}):_n(X,"bpmn:BoundaryEvent")?n.unshift(function(){O(X,G)}):_n(X,"bpmn:FlowNode")?O(X,G):_n(X,"bpmn:DataObject")||(_n(X,"bpmn:DataStoreReference")||_n(X,"bpmn:DataObjectReference")?ne(X,G):l(`unrecognized flowElement ${cn(X)} in context ${cn(G&&G.businessObject)}`,{element:X,context:G}))})}function re(V,G){var X=u(V,G),je=V.processRef;je&&g(je,X||G)}function ve(V,G){D(V.participants,r(re,G)),n.push(function(){x(V.messageFlows,G)}),T(V.artifacts,G)}function te(V){D(V.flowNodeRef,function(G){var X=G.get("lanes");X&&X.push(V)})}}function v(e,t){var n=ee(e);return n&&typeof n.$instanceOf=="function"&&n.$instanceOf(t)}function Fe(e,t){return Ui(t,function(n){return v(e,n)})}function ee(e){return e&&e.businessObject||e}function Xe(e){return e&&e.di}function mS(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,S){return i.add(m,g,S)},error:function(m,g){s.push({message:m,context:g})}},p=new hS(f);l=l||u.diagrams&&u.diagrams[0];var d=gS(u,l);if(!d)throw new Error("no diagram to display");D(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 gS(e,t){if(!(!t||!t.plane)){var n=t.plane.bpmnElement,i=n;!v(n,"bpmn:Process")&&!v(n,"bpmn:Collaboration")&&(i=yS(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=lm(o),s=[t],c=[n];return D(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 lm(e){var t=[];return D(e,function(n){n&&(t.push(n),t=t.concat(lm(n.flowElements)))}),t}function yS(e){for(var t=e;t;){if(v(t,"bpmn:Process"))return t;t=t.$parent}}var vS='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 14.02 5.57" width="53" height="21"><path fill="currentColor" d="M1.88.92v.14c0 .41-.13.68-.4.8.33.14.46.44.46.86v.33c0 .61-.33.95-.95.95H0V0h.95c.65 0 .93.3.93.92zM.63.57v1.06h.24c.24 0 .38-.1.38-.43V.98c0-.28-.1-.4-.32-.4zm0 1.63v1.22h.36c.2 0 .32-.1.32-.39v-.35c0-.37-.12-.48-.4-.48H.63zM4.18.99v.52c0 .64-.31.98-.94.98h-.3V4h-.62V0h.92c.63 0 .94.35.94.99zM2.94.57v1.35h.3c.2 0 .3-.09.3-.37v-.6c0-.29-.1-.38-.3-.38h-.3zm2.89 2.27L6.25 0h.88v4h-.6V1.12L6.1 3.99h-.6l-.46-2.82v2.82h-.55V0h.87zM8.14 1.1V4h-.56V0h.79L9 2.4V0h.56v4h-.64zm2.49 2.29v.6h-.6v-.6zM12.12 1c0-.63.33-1 .95-1 .61 0 .95.37.95 1v2.04c0 .64-.34 1-.95 1-.62 0-.95-.37-.95-1zm.62 2.08c0 .28.13.39.33.39s.32-.1.32-.4V.98c0-.29-.12-.4-.32-.4s-.33.11-.33.4z"/><path fill="currentColor" d="M0 4.53h14.02v1.04H0zM11.08 0h.63v.62h-.63zm.63 4V1h-.63v2.98z"/></svg>',pm=vS,fm={verticalAlign:"middle"},dm={color:"#404040"},_S={zIndex:"1001",position:"fixed",top:"0",left:"0",right:"0",bottom:"0"},bS={width:"100%",height:"100%",background:"rgba(40,40,40,0.2)"},xS={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"},wS='<div class="bjs-powered-by-lightbox"><div class="backdrop"></div><div class="notice"><a href="https://bpmn.io" target="_blank" rel="noopener" class="link">'+pm+'</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>',di;function ES(){di=ft(wS),dn(di,_S),dn(ot("svg",di),fm),dn(ot(".backdrop",di),bS),dn(ot(".notice",di),xS),dn(ot(".link",di),dm,{margin:"15px 20px 15px 10px",alignSelf:"center"})}function SS(){di||(ES(),Cn.bind(di,".backdrop","click",function(e){document.body.removeChild(di)})),document.body.appendChild(di)}const Ms=5,hm="djs-outline-hidden";function yt(e){e=j({},CS,e),this._moddle=this._createModdle(e),this._container=this._createContainer(e),this._init(this._container,this._moddle,e),AS(this._container)}pe(yt,nr),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||[]),ks(s,o),s=RS(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 ks(o,[]),o}if(typeof t=="string"&&(i=PS(n,t),!i)){const o=new Error("BPMNDiagram <"+t+"> not found");throw ks(o,[]),o}try{this.clear()}catch(o){throw ks(o,[]),o}const{warnings:r}=await mS(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=ot(":scope > defs",i._svg),a=Oh(r),s=o?"<defs>"+Oh(o)+"</defs>":"",c=i.getContainer();mt(c).add(hm);let u;try{u=r.getBBox()}finally{mt(c).remove(hm)}const l=u.x-Ms,f=u.y-Ms,p=u.width+Ms*2,d=u.height+Ms*2;t=`<?xml version="1.0" encoding="utf-8"?>
4
+ nested error: `+C.message;if(L)return a.addWarning({message:$,error:C}),!0;throw Ki($)}function l(C,P){return u(C,P,!0)}function f(){var C=a.elementsById,P=a.references,L,T;for(L=0;T=P[L];L++){var B=T.element,k=C[T.id],O=Ei(B).propertiesByName[T.property];if(k||a.addWarning({message:"unresolved reference <"+T.id+">",element:T.element,property:T.property,value:T.id}),O.isMany){var $=B.get(O.name),ie=$.indexOf(T);ie===-1&&(ie=$.length),k?$[ie]=k:$.splice(ie,1)}else B.set(O.name,k)}}function p(){c.pop().handleEnd()}var d=/^<\?xml /i,h=/ encoding="([^"]+)"/i,m=/^utf-8$/i;function g(C){if(d.test(C)){var P=h.exec(C),L=P&&P[1];!L||m.test(L)||a.addWarning({message:"unsupported document encoding <"+L+">, falling back to UTF-8"})}}function S(C,P){var L=c.peek();try{c.push(L.handleNode(C))}catch(T){u(T,P,o)&&c.push(new Nu)}}function E(C,P){try{c.peek().handleText(C)}catch(L){l(L,P)}}function x(C,P){C.trim()&&E(C,P)}var w=r.getPackages().reduce(function(C,P){return C[P.uri]=P.prefix,C},Object.entries(Iu).reduce(function(C,[P,L]){return C[L]=P,C},r.config&&r.config.nsMap||{}));return s.ns(w).on("openTag",function(C,P,L,T){var B=C.attrs||{},k=Object.keys(B).reduce(function($,ie){var ge=P(B[ie]);return $[ie]=ge,$},{}),O={name:C.name,originalName:C.originalName,attributes:k,ns:C.ns};S(O,T)}).on("question",g).on("closeTag",p).on("cdata",E).on("text",function(C,P,L){x(P(C),L)}).on("error",u).on("warn",l),new Promise(function(C,P){var L;try{s.parse(e),f()}catch($){L=$}var T=i.element;!L&&!T&&(L=Ki("failed to parse document as <"+i.type.$descriptor.name+">"));var B=a.warnings,k=a.references,O=a.elementsById;return L?(L.warnings=B,P(L)):C({rootElement:T,elementsById:O,references:k,warnings:B})})},ju.prototype.handler=function(e){return new $u(this.model,e)};function F0(){var e=[];return Object.defineProperty(e,"peek",{value:function(){return this[this.length-1]}}),e}var H0=`<?xml version="1.0" encoding="UTF-8"?>
5
+ `,z0=/<|>|'|"|&|\n\r|\n/g,md=/<|>|&/g;function ai(e){this.prefixMap={},this.uriMap={},this.used={},this.wellknown=[],this.custom=[],this.parent=e,this.defaultPrefixMap=e&&e.defaultPrefixMap||{}}ai.prototype.mapDefaultPrefixes=function(e){this.defaultPrefixMap=e},ai.prototype.defaultUriByPrefix=function(e){return this.defaultPrefixMap[e]},ai.prototype.byUri=function(e){return this.uriMap[e]||this.parent&&this.parent.byUri(e)},ai.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)},ai.prototype.uriByPrefix=function(e){return this.prefixMap[e||"xmlns"]||this.parent&&this.parent.uriByPrefix(e)},ai.prototype.mapPrefix=function(e,t){this.prefixMap[e||"xmlns"]=t},ai.prototype.getNSKey=function(e){return e.prefix!==void 0?e.uri+"|"+e.prefix:e.uri},ai.prototype.logUsed=function(e){var t=e.uri,n=this.getNSKey(e);this.used[n]=this.byUri(t),this.parent&&this.parent.logUsed(e)},ai.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 G0(e){return e.charAt(0).toLowerCase()+e.slice(1)}function V0(e,t){return pd(t)?G0(e):e}function gd(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})}function yd(e){return wn(e)?e:(e.prefix?e.prefix+":":"")+e.localName}function W0(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 U0(e,t){return t.isGeneric?j({localName:t.ns.localName},e):j({localName:V0(t.ns.localName,t.$pkg)},e)}function q0(e,t){return j({localName:t.ns.localName},e)}function Y0(e){var t=e.$descriptor;return He(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 K0={"\n":"#10","\n\r":"#10",'"':"#34","'":"#39","<":"#60",">":"#62","&":"#38"},X0={"<":"lt",">":"gt","&":"amp"};function vd(e,t,n){return e=wn(e)?e:""+e,e.replace(t,function(i){return"&"+n[i]+";"})}function Z0(e){return vd(e,z0,K0)}function Q0(e){return vd(e,md,X0)}function J0(e){return He(e,function(t){return t.isAttr})}function ew(e){return He(e,function(t){return!t.isAttr})}function Fu(e){this.tagName=e}Fu.prototype.build=function(e){return this.element=e,this},Fu.prototype.serializeTo=function(e){e.appendIndent().append("<"+this.tagName+">"+this.element.id+"</"+this.tagName+">").appendNewLine()};function Mr(){}Mr.prototype.serializeValue=Mr.prototype.serializeTo=function(e){e.append(this.escape?Q0(this.value):this.value)},Mr.prototype.build=function(e,t){return this.value=t,e.type==="String"&&t.search(md)!==-1&&(this.escape=!0),this};function Hu(e){this.tagName=e}gd(Hu,Mr),Hu.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=Y0(e),this.parseAttributes(J0(r)),this.parseContainments(ew(r))),this.parseGenericAttributes(e,i),this},dt.prototype.nsTagName=function(e){var t=this.logNamespaceUsed(e.ns);return U0(t,e)},dt.prototype.nsPropertyTagName=function(e){var t=this.logNamespaceUsed(e.ns);return q0(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}:j({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 Mr().build({type:"String"},t));var n=e.$children;n&&D(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 D(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;D(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;D(e,function(r){var o=i.get(r.name),a=r.isReference,s=r.isMany;if(s||(o=[o]),r.isBody)n.push(new Mr().build(r,o[0]));else if(rd(r.type))D(o,function(u){n.push(new Hu(t.addTagName(t.nsPropertyTagName(r))).build(r,u))});else if(a)D(o,function(u){n.push(new Fu(t.addTagName(t.nsPropertyTagName(r))).build(u))});else{var c=dd(r);D(o,function(u){var l;c?c===fd?l=new dt(t,r):l=new ns(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 ai(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;D(e,function(i){var r=n.get(i.name);if(i.isReference)if(!i.isMany)r=r.id;else{var o=[];D(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),yd(e)},dt.prototype.addAttribute=function(e,t){var n=this.attrs;wn(t)&&(t=Z0(t));var i=ed(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=W0(n).concat(t)),D(t,function(i){e.append(" ").append(yd(i.name)).append('="').append(i.value).append('"')})},dt.prototype.serializeTo=function(e){var t=this.body[0],n=t&&t.constructor!==Mr;e.appendIndent().append("<"+this.tagName),this.serializeAttributes(e),e.append(t?">":" />"),t&&(n&&e.appendNewLine().indent(),D(this.body,function(i){i.serializeTo(e)}),n&&e.unindent().appendIndent(),e.append("</"+this.tagName+">")),e.appendNewLine()};function ns(e,t,n){dt.call(this,e,t),this.serialization=n}gd(ns,dt),ns.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},ns.prototype.isLocalNs=function(e){return e.uri===(this.typeNs||this.ns).uri};function tw(){this.value="",this.write=function(e){this.value+=e}}function nw(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 iw(e){e=j({format:!1,preamble:!0},e||{});function t(n,i){var r=i||new tw,o=new nw(r,e.format);e.preamble&&o.append(H0);var a=new dt,s=n.$model;if(a.getNamespaces().mapDefaultPrefixes(rw(s)),a.build(n).serializeTo(o),!i)return r.value}return{toXML:t}}function rw(e){const t=e.config&&e.config.nsMap||{},n={};for(const i in Iu)n[i]=Iu[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 is(e,t){$n.call(this,e,t)}is.prototype=Object.create($n.prototype),is.prototype.fromXML=function(e,t,n){wn(t)||(n=t,t="bpmn:Definitions");var i=new ju(j({model:this,lax:!0},n)),r=i.handler(t);return i.fromXML(e,r)},is.prototype.toXML=function(e,t){var n=new iw(t);return new Promise(function(i,r){try{var o=n.toXML(e);return i({xml:o})}catch(a){return r(a)}})};var ow="BPMN20",aw="http://www.omg.org/spec/BPMN/20100524/MODEL",sw="bpmn",cw=[],uw=[{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"}]}],lw=[{name:"ProcessType",literalValues:[{name:"None"},{name:"Public"},{name:"Private"}]},{name:"GatewayDirection",literalValues:[{name:"Unspecified"},{name:"Converging"},{name:"Diverging"},{name:"Mixed"}]},{name:"EventBasedGatewayType",literalValues:[{name:"Parallel"},{name:"Exclusive"}]},{name:"RelationshipDirection",literalValues:[{name:"None"},{name:"Forward"},{name:"Backward"},{name:"Both"}]},{name:"ItemKind",literalValues:[{name:"Physical"},{name:"Information"}]},{name:"ChoreographyLoopType",literalValues:[{name:"None"},{name:"Standard"},{name:"MultiInstanceSequential"},{name:"MultiInstanceParallel"}]},{name:"AssociationDirection",literalValues:[{name:"None"},{name:"One"},{name:"Both"}]},{name:"MultiInstanceBehavior",literalValues:[{name:"None"},{name:"One"},{name:"All"},{name:"Complex"}]},{name:"AdHocOrdering",literalValues:[{name:"Parallel"},{name:"Sequential"}]}],pw={tagAlias:"lowerCase",typePrefix:"t"},fw={name:ow,uri:aw,prefix:sw,associations:cw,types:uw,enumerations:lw,xml:pw},dw="BPMNDI",hw="http://www.omg.org/spec/BPMN/20100524/DI",mw="bpmndi",gw=[{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"]}],yw=[{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"}]}],vw=[],bw={name:dw,uri:hw,prefix:mw,types:gw,enumerations:yw,associations:vw},_w="DC",xw="http://www.omg.org/spec/DD/20100524/DC",ww="dc",Ew=[{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=[],Rw={name:_w,uri:xw,prefix:ww,types:Ew,associations:Sw},Cw="DI",Pw="http://www.omg.org/spec/DD/20100524/DI",Aw="di",Tw=[{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"}]}],Mw=[],kw={tagAlias:"lowerCase"},Ow={name:Cw,uri:Pw,prefix:Aw,types:Tw,associations:Mw,xml:kw},Dw="bpmn.io colors for BPMN",Lw="http://bpmn.io/schema/bpmn/biocolor/1.0",Iw="bioc",Nw=[{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=[],$w=[],jw={name:Dw,uri:Lw,prefix:Iw,types:Nw,enumerations:Bw,associations:$w},Fw="BPMN in Color",Hw="http://www.omg.org/spec/BPMN/non-normative/color/1.0",zw="color",Gw=[{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"}]}],Vw=[],Ww=[],Uw={name:Fw,uri:Hw,prefix:zw,types:Gw,enumerations:Vw,associations:Ww};const qw={bpmn:fw,bpmndi:bw,dc:Rw,di:Ow,bioc:jw,color:Uw};function bd(e,t){const n=j({},qw,e);return new is(n,t)}const Yw={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"}},Kw="http://www.omg.org/spec/BPMN/non-normative/extensions/i18n/1.0",_d="i18n",rs={[_d]:Yw,[Su]:Kf};function xd(){return bd(rs)}const wd=xd();async function zu(e){const{rootElement:t,warnings:n}=await wd.fromXML(e,"bpmn:Definitions");return{definitions:t,warnings:n}}async function Xw(e){const{xml:t}=await wd.toXML(e,{format:!0});return t}function Gu(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},Zw=/[ᄀ-ᇿ -〿぀-ヿ㐀-鿿가-힯＀-⦆]/;function Qw(e){const t=oo;return Zw.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*Qw(i);return n}function Ed(e=globalThis,{textMeasurement:t="approximate"}={}){if(!(e!=null&&e.SVGElement))throw new Error("installHeadlessBpmnDom: DOM 전역이 없다 — jsdom window 를 전역에 올린 뒤 호출할 것");t==="approximate"&&Jw(e),eE(e),tE(e),nE(e)}function Jw(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 eE(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 tE(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 nE(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 os=new Set(["bpmn:Participant","bpmn:Lane","bpmn:Group","bpmn:SubProcess","bpmn:AdHocSubProcess","bpmn:Transaction"]),iE=1,rE=new Set(["bpmn:TextAnnotation","bpmn:DataStoreReference","bpmn:DataObjectReference","bpmn:DataInput","bpmn:DataOutput"]),oE=2;function Si(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-overlap-unreadable":return`gu|${e.groups[0]}|${e.groups[1]}|${e.shapes.join(",")}`;case"group-on-container-boundary":return`gb|${e.group}|${e.container}|${e.side}`;case"group-on-group-boundary":return`gg|${e.groups[0]}|${e.groups[1]}|${e.axis}`;case"pool-name-over-label":return`pn|${e.pool}|${e.label}`}}const Sd=20,Rd=5,Cd=3,Pd=12,aE=Pd*1.2;function Vu(e,t){const n=t.split(/\r?\n/),i=Math.max(...n.map(o=>ao(o,Pd))),r=n.length*aE;return{x:e.x+e.width/2-i/2,y:e.y+e.height/2-r/2,width:i,height:r}}const Ad=1;function fn(e){const t=[];for(let n=0;n+1<e.waypoints.length;n++){const i=e.waypoints[n],r=e.waypoints[n+1];Math.abs(i.y-r.y)<.5&&Math.abs(i.x-r.x)>=.5?t.push({axis:"h",at:i.y,lo:Math.min(i.x,r.x),hi:Math.max(i.x,r.x),dir:r.x>i.x?1:-1}):Math.abs(i.x-r.x)<.5&&Math.abs(i.y-r.y)>=.5&&t.push({axis:"v",at:i.x,lo:Math.min(i.y,r.y),hi:Math.max(i.y,r.y),dir:r.y>i.y?1:-1})}return t}function as(e,t){let n=null;const i=e.type!==t.type;for(const r of fn(e))for(const o of fn(t)){if(r.axis!==o.axis||Math.abs(r.at-o.at)>Ad)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>=Sd&&(!n||s>n.length)&&(n={axis:r.axis,length:s,kind:a})}return n}function Td(e,t){const n=as(e,t);return n&&n.kind==="opposite"?{axis:n.axis,length:n.length}:null}function sE(e,t){let n=0;for(const i of t)i.id!==e.id&&Td(e,i)&&n++;return n}function Ri(e,t){let n=0;for(const i of t)i.id!==e.id&&as(e,i)&&n++;return n}const Md=15,kd=20;function cE(e,t){const n=t.axis==="v"?[e.x,e.x+e.width]:[e.y,e.y+e.height];if(t.at<n[0]-kd||t.at>n[1]+kd)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 Wu=20;function ss(e,t){const n=[];for(const i of t){if(i.axis!==e.axis||Math.abs(i.at-e.at)>Ad)continue;const r=Math.max(e.lo,i.lo),o=Math.min(e.hi,i.hi);o-r<Sd||n.push([r-Wu,o+Wu])}return n}function cs(e,t){const n=e.label;if(!n)return null;let i=null;for(const r of fn(e)){const o=cE(n,r);if(o){for(const a of t)if(a.id!==e.id&&!(i&&a.id>=i.other)){for(const[s,c]of ss(r,fn(a)))if(Math.min(c,o[1])>Math.max(s,o[0])){i={other:a.id,axis:r.axis};break}}}}return i}const uE=1,lE=(e,t,n)=>t.x>=e.x-n&&t.y>=e.y-n&&t.x+t.width<=e.x+e.width+n&&t.y+t.height<=e.y+e.height+n;function pE(e,t,n,i){const r=n.x+i,o=n.y+i,a=n.x+n.width-i,s=n.y+n.height-i;if(a<=r||s<=o)return!1;const c=t.x-e.x,u=t.y-e.y;let l=0,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 Uu(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 fE=(e,t)=>e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height,so=1;function Ci(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 Uo(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 Od(e,t){const n=e.label;if(!n)return null;if(fn(e).some(i=>Ci(n,i)))return e.id;for(const i of[...t.edges].filter(r=>r.id!==e.id).sort((r,o)=>r.id.localeCompare(o.id)))if(fn(i).some(r=>Ci(n,r)))return i.id;for(const i of t.shapes.filter(r=>r.container).sort((r,o)=>r.id.localeCompare(o.id)))if(Uo(i).some(r=>Ci(n,r)))return i.id;return null}function jn(e,t){const n=new Set(e.endpoints),i=[];for(const r of t)if(!n.has(r.id)){for(let o=0;o+1<e.waypoints.length;o++)if(pE(e.waypoints[o],e.waypoints[o+1],r,oE)){i.push(r);break}}return i}function dE(e,t,n,i){const r=(u,l,f)=>(l.x-u.x)*(f.y-u.y)-(l.y-u.y)*(f.x-u.x),o=r(n,i,e),a=r(n,i,t),s=r(e,t,n),c=r(e,t,i);return o*a<0&&s*c<0}const Dd=(e,t)=>e.endpoints.some(n=>t.endpoints.includes(n));function us(e,t){let n=0;for(const i of t){if(i.id===e.id||Dd(e,i))continue;let r=!1;for(let o=0;o+1<e.waypoints.length&&!r;o++)for(let a=0;a+1<i.waypoints.length&&!r;a++)dE(e.waypoints[o],e.waypoints[o+1],i.waypoints[a],i.waypoints[a+1])&&(r=!0);r&&n++}return n}function Pi(e,t){let n=0;for(const i of t)i.id===e.id||Dd(e,i)||us(e,[i])>0&&(n+=i.type===e.type?2:1);return n}function Ld(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++)us(n[i],[n[r]])>0&&(t+=n[i].type===n[r].type?2:1);return t}function qu(e){const t=[],n=e.edges;for(let i=0;i<n.length;i++)for(let r=i+1;r<n.length;r++)if(us(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 Id(e){const t=qu(e),n=o=>o==="bpmn:MessageFlow"||o.endsWith("Association")?"dashed":"solid",i=new Map(e.edges.map(o=>[o.id,o]));let r=0;for(const[o,a]of t){const s=i.get(o),c=i.get(a);s&&c&&n(s.type)===n(c.type)&&r++}return{pairs:t,sameKind:r,mixedKind:t.length-r,crossPoolMessages:hE(e)}}function hE(e){const t=e.shapes.filter(r=>r.type==="bpmn:Participant");if(t.length<3)return 0;const n=r=>{const o=e.shapes.find(a=>a.id===r);if(o)return t.find(a=>o.x>=a.x&&o.y>=a.y&&o.x+o.width<=a.x+a.width&&o.y+o.height<=a.y+a.height)};let i=0;for(const r of e.edges){if(r.type!=="bpmn:MessageFlow"||r.endpoints.length<2)continue;const o=n(r.endpoints[0]),a=n(r.endpoints[1]);if(!o||!a||o.id===a.id)continue;const s=Math.min(o.y,a.y),c=Math.max(o.y+o.height,a.y+a.height);t.some(u=>u.id!==o.id&&u.id!==a.id&&u.y>s&&u.y+u.height<c)&&i++}return i}function mE(e,t,n){const i=new Set(t.flatMap(r=>[...r.members]));return e.shapes.filter(r=>!r.container&&!rE.has(r.type)&&!i.has(r.id)&&r.x>=n.x&&r.y>=n.y&&r.x+r.width<=n.right&&r.y+r.height<=n.bottom).map(r=>r.id).sort()}function Nd(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 Bd=e=>e?{members:e}:{},si=e=>e.shapes.filter(t=>!t.container);function gE(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 $d(e,t){const n=e.label;if(!n)return null;for(const i of[...t.edges].sort((r,o)=>r.id.localeCompare(o.id)))if(fn(i).some(r=>Ci(n,r)))return i.id;for(const i of[...t.shapes].filter(r=>r.container).sort((r,o)=>r.id.localeCompare(o.id)))if(Uo(i).some(r=>Ci(n,r)))return i.id;return null}function qo(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 Ai(e){const t=[],n=e.shapes.filter(p=>!p.container);for(const p of e.edges)for(const d of jn(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(!Uu(h,m,iE))continue;const g=h.id<m.id?[h.id,m.id]:[m.id,h.id];t.push({kind:"shape-overlap",shapes:g,identical:fE(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),S=Math.min(h.y+h.height,m.y+m.height)-Math.max(h.y,m.y);if(g<=Rd||S<=Rd)continue;const E=h.id<m.id?[h.id,m.id]:[m.id,h.id],x=new Set(m.members);if(h.members.some(w=>x.has(w))){const w=mE(e,r,{x:Math.max(h.x,m.x),y:Math.max(h.y,m.y),right:Math.min(h.x+h.width,m.x+m.width),bottom:Math.min(h.y+h.height,m.y+m.height)});w.length&&t.push({kind:"group-overlap-unreadable",groups:E,shapes:w});continue}t.push({kind:"group-overlap-unintended",groups:E})}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[S,E,x,w]of g)w&&Math.abs(E-x)<=Cd&&t.push({kind:"group-on-container-boundary",group:p.id,container:d.id,side:S})}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,S=h.y<m.y+m.height&&m.y<h.y+h.height,E=[["x",h.x+h.width,m.x,S],["x",m.x+m.width,h.x,S],["y",h.y+h.height,m.y,g],["y",m.y+m.height,h.y,g]];for(const[x,w,C,P]of E)if(P&&Math.abs(w-C)<=Cd){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=as(h,m);if(!g)continue;const S=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:S,axis:g.axis,length:Math.round(g.length)})}for(const p of e.edges){if(!p.label)continue;const d=cs(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=Od(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=$d(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 qo(e))d===p.id||u.has(d)||Uu(p.label,h,so)&&t.push({kind:"pool-name-over-label",pool:p.id,label:d});const l=qo(e);for(const p of n)if(p.type==="bpmn:TextAnnotation")for(const{owner:d,rect:h}of l)d!==p.id&&Uu(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??gE(p,e,f);if(!d)continue;const h=f.get(d);!h||!h.container||lE(h,p,uE)||t.push({kind:"shape-outside-container",shape:p.id,container:h.id})}return t.sort((p,d)=>Si(p).localeCompare(Si(d)))}const ht=e=>typeof e=="object"&&e!==null?e:void 0,xt=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 yE(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 vE(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(os.has(i)&&i!=="bpmn:Lane"&&i!=="bpmn:Group")return kr(n)}function jd(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),S=typeof(g==null?void 0:g.id)=="string"?g.id:void 0;if(!S)continue;const E=typeof(g==null?void 0:g.$type)=="string"?g.$type:"",x=ht(m.bounds);if(x){const C=m.isExpanded===!1&&E!=="bpmn:Participant",P=ht((u=ht(m.label))==null?void 0:u.bounds),L={id:S,type:E,x:xt(x.x),y:xt(x.y),width:xt(x.width),height:xt(x.height),container:os.has(E)&&!C,attached:(g==null?void 0:g.attachedToRef)!==void 0,...g?{parent:vE(g,r)}:{},...P?{label:{x:xt(P.x),y:xt(P.y),width:xt(P.width),height:xt(P.height)}}:{},...E==="bpmn:Group"?Bd(Nd(g)):{}},T=m.isHorizontal!==!1,B=typeof(g==null?void 0:g.name)=="string"?g.name:"";o.has(S)&&T&&B&&(L.label=Vu(L,B)),t.push(L);continue}const w=m.waypoint;if(Array.isArray(w)){const C=ht((l=ht(m.label))==null?void 0:l.bounds);n.push({id:S,type:E,waypoints:w.map(P=>{var L,T;return{x:xt((L=ht(P))==null?void 0:L.x),y:xt((T=ht(P))==null?void 0:T.y)}}),endpoints:yE(g),...C?{label:{x:xt(C.x),y:xt(C.y),width:xt(C.width),height:xt(C.height)}}:{}})}}}return{shapes:t,edges:n}}function Fd(e){return Ai(jd(e))}async function bE(e){const{definitions:t,warnings:n}=await zu(e);return{findings:Fd(t),warnings:n}}function Et(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:xt(g.x),y:xt(g.y)})),endpoints:[kr(o.source),kr(o.target)].filter(g=>!!g),...m&&typeof m.x=="number"?{label:{x:m.x,y:xt(m.y),width:xt(m.width),height:xt(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&&os.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:xt(o.width),height:xt(o.height),container:os.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:xt(u.y),width:xt(u.width),height:xt(u.height)}}:{},...a==="bpmn:Group"?Bd(Nd(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=Vu(d,h)),t.push(d)}return{shapes:t,edges:n}}const _E={"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 xE(e,t){const n=_E[e];return n||(e==="label"||e.startsWith("bpmndi:")?"other":e.startsWith("bpmn:")&&!("waypoints"in t&&t.waypoints)?"flowNode":"other")}function Hd(e){let t=e.parent;for(;t;){if(t.type==="bpmn:Participant")return t.id;t=t.parent}}function zd(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 xE(i.type,i)},lanesOf:n=>t().filter(i=>i.type==="bpmn:Lane"&&Hd(i)===n).sort((i,r)=>i.y-r.y).map(i=>i.id),participantOf:n=>{const i=e.get(n);return i?Hd(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 Gd=20,wE=4,Tt=(e,t)=>Math.abs(e-t)<.5;function Vd(e,t,n,i=Gd){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 Wd(e,t,n=Gd){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 Yu(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 Ud=30,EE=[0,-25,25,-40,40];function SE(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+Ud:s-Ud,u=a?i.y+i.height:i.y,l=n.x+n.width/2,f=i.x+i.width/2;return EE.map(p=>[{x:l,y:s},{x:l,y:c},{x:f+p,y:c},{x:f+p,y:u}])}const RE=(e,t,n)=>[...e.slice(0,t+1),...n,...e.slice(t+1)],ls=(e,t,n)=>jn({...e,waypoints:t},n).length;function qd(e,t,n,i){let r=[...e.waypoints],o=ls(e,r,t);if(o===0)return null;let a=!1;for(const f of Yu(e,t))if(ls(e,f,t)===0)return f;const s=(i??[]).filter(f=>f.id!==e.id).flatMap(fn),c=f=>fn({...e,waypoints:f}).some(p=>ss(p,s).length>0),u=SE(e,t).filter(f=>ls(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<wE&&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)||jn({...e,waypoints:[h,m]},[g]).length===0)continue;const S=Vd(h,m,g),E=S?S.map(w=>RE(r,d,w)):Wd(r,g)??[];if(!E.length)continue;const x=[...E].sort((w,C)=>Number(l(C))-Number(l(w)));for(const w of x){const C=ls(e,w,t);if(C<o){r=w,o=C,p=!0,a=!0;break}}if(p)break}}if(!p)break}return a&&o===0?r:null}function Yd(e,t){const{elementRegistry:n}=e,i=e.modeling,r=Et(n),o=si(r),a=Ai(r).filter(c=>c.kind==="edge-crosses-shape"&&!t.has(Si(c)));if(!a.length)return;const s=new Map;for(const c of a){if(c.kind!=="edge-crosses-shape"||s.has(c.edge))continue;const u=r.edges.find(l=>l.id===c.edge);u&&s.set(c.edge,u)}for(const[c,u]of s){const l=n.get(c);if(!l)continue;const 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=qd(u,o,p,r.edges);if(!d)continue;const h=r.edges.filter(S=>S.id!==c),m=Ri(u,h);Ri({...u,waypoints:d},h)>m||i.updateWaypoints(l,d)}}const CE=10;function Kd(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 Xd(e,t){if(e.waypoints.length<2||e.endpoints.length!==2)return null;const n=t.shapes.filter($=>$.type==="bpmn:Participant"&&$.container),i=t.shapes.find($=>$.id===e.endpoints[0]),r=t.shapes.find($=>$.id===e.endpoints[1]);if(!i||!r)return null;const o=Kd(i,n),a=Kd(r,n);if(!o||!a||o.id===a.id)return null;const s=a.y>o.y,c=s?o:a,u=s?a:o,l=n.filter($=>$.id!==o.id&&$.id!==a.id&&$.y>=c.y+c.height&&$.y+$.height<=u.y).sort(($,ie)=>$.y-ie.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,S=e.waypoints[0],E=e.waypoints[e.waypoints.length-1],x=si(t),w=t.edges.filter($=>$.id!==e.id),C=Pi(e,w),P=jn(e,x).length;if(C===0&&P===0||P===0&&e.waypoints.length===2)return null;const L=Math.min(...l.map($=>$.x)),T=Math.max(...l.map($=>$.x+$.width)),B=(S.x+E.x)/2,k=$=>$.filter((ie,ge)=>ge===0||!(Tt(ie.x,$[ge-1].x)&&Tt(ie.y,$[ge-1].y)));let O;for(let $=L;$<=T;$+=CE){const ie=k([S,{x:S.x,y:m},{x:$,y:m},{x:$,y:g},{x:E.x,y:g},E]),ge={...e,waypoints:ie};if(jn(ge,x).length>0)continue;const Ve=Pi(ge,w),q=Math.abs($-B);(!O||Ve<O.cross||Ve===O.cross&&q<O.detour)&&(O={pts:ie,cross:Ve,detour:q})}return O&&(P>0?O.cross<=C:O.cross<C)?O.pts:null}function Zd(e,t){const{elementRegistry:n}=e,i=e.modeling,r=Et(n);for(const o of r.edges){if(o.type!=="bpmn:MessageFlow"||t.has(o.id))continue;const a=Et(n),s=a.edges.find(l=>l.id===o.id);if(!s)continue;const c=Xd(s,a);if(!c)continue;const u=n.get(o.id);u&&i.updateWaypoints(u,c)}}const co=[25,-25,40,-40],ps=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-ps:n.y+n.height+ps,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 C=a+w;f.push({pts:[{x:C,y:u},{x:C,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,S=s?i.y+i.height+ps:i.y-ps;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 C=a+w;f.push({pts:[{x:C,y:h},{x:C,y:S},{x,y:S},{x,y:g}],cost:m+Math.abs(E)+Math.abs(w)})}}return f}const fs=30;function Jd(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)<fs||Math.abs(i.y-(s.y+s.height))<fs)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)<fs||Math.abs(i.x-(s.x+s.width))<fs)return!0}}return!1}const ds=40;function PE(e,t,n){let i=0;for(const r of t){if(r.container||n.includes(r.id))continue;const o=r.x-ds,a=r.x+r.width+ds,s=r.y-ds,c=r.y+r.height+ds;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 eh(e,t){if(e.type!=="bpmn:SequenceFlow")return null;const n=t.shapes.filter(P=>P.container),i=new Map(t.shapes.map(P=>[P.id,P])),r=si(t),o=t.edges.filter(P=>P.id!==e.id),a=Ri(e,o),s=Pi(e,o),c=P=>PE(P,t.shapes,e.endpoints)+(Jd(P,n)?1:0),u=c(e.waypoints),l=P=>{if(!P)return;const L=P.x+P.width/2,T=P.y+P.height/2;return n.find(B=>B.type==="bpmn:Lane"&&L>=B.x&&L<=B.x+B.width&&T>=B.y&&T<=B.y+B.height)},f=l(i.get(e.endpoints[0]??"")),p=l(i.get(e.endpoints[1]??"")),d=!!f&&!!p&&f.id!==p.id,h=P=>{if(!d||!p)return!1;for(let L=1;L<P.length-2;L++){const T=P[L],B=P[L+1];if(Tt(T.y,B.y)&&!Tt(T.x,B.x)&&T.y>p.y&&T.y<p.y+p.height)return!0}return!1},m=h(e.waypoints),S=(P=>{if(!P)return;const L=P.x+P.width/2,T=P.y+P.height/2;return n.filter(B=>B.type==="bpmn:Participant"&&L>=B.x&&L<=B.x+B.width&&T>=B.y&&T<=B.y+B.height).sort((B,k)=>B.width*B.height-k.width*k.height)[0]})(i.get(e.endpoints[0]??"")),E=P=>{if(!S)return 0;let L=0;for(let T=1;T<P.length-1;T++){const B=P[T];(B.x<S.x||B.x>S.x+S.width||B.y<S.y||B.y>S.y+S.height)&&L++}return L},x=E(e.waypoints);if(!Jd(e.waypoints,n)&&!(d&&!m)&&x===0)return null;const w=P=>P.reduce((L,T,B)=>B?L+Math.abs(T.x-P[B-1].x)+Math.abs(T.y-P[B-1].y):0,0);let C;for(const{pts:P,cost:L}of Qd(e,i)){const T={...e,waypoints:P};if(jn(T,r).length>0)continue;const B=Ri(T,o);if(B>a)continue;const k=E(P);if(k>x)continue;const O=k<x&&B===0;if(!O&&Pi(T,o)>s)continue;const $=c(P),ie=h(P);if(!O&&!(ie&&!m)&&$>=u)continue;const Ve=ie?0:1,q=w(P);(!C||k<C.out||k===C.out&&(Ve<C.lane||Ve===C.lane&&(B<C.opp||B===C.opp&&($<C.sc||$===C.sc&&(L<C.cost||L===C.cost&&q<C.len)))))&&(C={pts:P,out:k,sc:$,lane:Ve,opp:B,cost:L,len:q})}return(C==null?void 0:C.pts)??null}function AE(e,t){const{elementRegistry:n}=e,i=e.modeling,r=Et(n).edges.filter(o=>!t.has(o.id)&&o.waypoints.length>=4).map(o=>o.id).sort();for(const o of r){const a=Et(n),s=a.edges.find(d=>d.id===o);if(!s||s.waypoints.length<4)continue;const c=si(a),u=a.edges.filter(d=>d.id!==o),l=jn(s,c).length,f=Ri(s,u),p=Pi(s,u);for(const d of Yu(s,a.shapes)){if(d.length>=s.waypoints.length)continue;const h={...s,waypoints:d};if(jn(h,c).length>l||Ri(h,u)>f||Pi(h,u)>p)continue;const m=n.get(o);m&&i.updateWaypoints(m,d);break}}}function th(e,t){const{elementRegistry:n}=e,i=e.modeling,r=Et(n).edges.filter(o=>o.type==="bpmn:SequenceFlow"&&!t.has(o.id)).map(o=>o.id).sort();for(const o of r){const a=Et(n),s=a.edges.find(l=>l.id===o);if(!s)continue;const c=eh(s,a);if(!c)continue;const u=n.get(o);u&&i.updateWaypoints(u,c)}}function TE(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 nh(e,t){const n=new Map(t.shapes.map(l=>[l.id,l])),i=si(t),r=t.edges.filter(l=>l.id!==e.id),o=Ri(e,r);if(o===0)return null;const a=Pi(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),...TE(e,n)];for(const{pts:l,cost:f}of u){const p={...e,waypoints:l};if(jn(p,i).length>0)continue;const d=Ri(p,r),h=Pi(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 ih(e,t,n){const{elementRegistry:i}=e,r=e.modeling,o=Et(i),a=Ai(o).filter(l=>(l.kind==="edge-overlap-opposite"||l.kind==="edge-overlap-mixed")&&!t.has(Si(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=Et(i),p=f.edges.find(m=>m.id===l);if(!p)continue;const d=nh(p,f);if(!d)continue;const h=i.get(l);h&&r.updateWaypoints(h,d)}}const ME=10,kE=(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 rh(e,t){const n=e.label;if(!n)return null;const i=t.edges.filter(a=>a.id!==e.id);if(!cs(e,i))return null;const r=si(t),o=i.flatMap(fn);for(const a of fn(e)){let s=[[a.lo,a.hi]];for(const[d,h]of ss(a,o))s=s.flatMap(([m,g])=>{const S=[];return d>m&&S.push([m,Math.min(g,d)]),h<g&&S.push([Math.max(m,h),g]),S.filter(([E,x])=>x>E)});const c=a.axis==="h"?n.width:n.height,u=s.find(([d,h])=>h-d>=c+ME*2);if(!u)continue;const l=(u[0]+u[1])/2,f=a.axis==="h"?{x:l,y:a.at-Md}:{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(!cs({...e,label:p},i)&&!r.some(d=>!e.endpoints.includes(d.id)&&kE(p,d)))return p}return null}const Rn=8;function oh(e,t){const n=e.label;if(!n)return null;const i=fn(e);if(!i.length)return null;const r=n.x+n.width/2,o=n.y+n.height/2,a=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(fn),...t.shapes.filter(p=>p.container).flatMap(Uo)],u=p=>!c.some(d=>Ci(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 ah(e,t){const{elementRegistry:n}=e,i=e.modeling,r=Et(n);for(const o of r.edges){if(!o.label||t.has(o.id))continue;const a=oh(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 sh(e,t,n){const{elementRegistry:i}=e,r=e.modeling,o=Et(i),a=Ai(o).filter(s=>s.kind==="label-on-shared-segment"&&!t.has(Si(s)));for(const s of a){if(s.kind!=="label-on-shared-segment"||n.has(s.edge))continue;const c=o.edges.find(p=>p.id===s.edge);if(!c)continue;const u=rh(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 ch(e,t){const n=e.label;if(!n)return null;const i=[...t.edges.flatMap(fn),...t.shapes.filter(p=>p.container).flatMap(Uo)],r=i.filter(p=>Ci(n,p));if(!r.length)return null;const o=t.shapes.filter(p=>!p.container&&p.id!==e.id),a=qo(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=>Ci(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 uh(e,t){const{elementRegistry:n}=e,i=e.modeling,r=Et(n);for(const o of r.shapes){if(o.container||!o.label||t.has(o.id))continue;const a=ch(o,Et(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 OE=/^[\p{L}_][\p{L}\p{N}_.\-]*$/u,lh=new Set(["sequenceFlow","messageFlow","dataAssociation","association"]),ph={"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}]},hs=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),Ku=e=>typeof e=="string"&&e!=="";function DE(e){const t=[];function n(i,r,o,a){if(a===null){Ku(o)||t.push({kind:"payload-invalid",opIndex:i,field:r});return}if(!hs(o)){t.push({kind:"payload-invalid",opIndex:i,field:r});return}for(const s of a)Ku(o[s])||t.push({kind:"payload-invalid",opIndex:i,field:`${r}.${s}`})}return e.forEach((i,r)=>{if(!hs(i)||!Ku(i.kind)||!(i.kind in ph)){t.push({kind:"payload-invalid",opIndex:r,field:"kind"});return}for(const o of ph[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(!hs(u))break;u=u[f]}if(!hs(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 fh(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(!OE.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:S,name:E,condition:x}=p.flow,w=u(d,g,"source",["flowNode"]),C=u(d,S,"target",["flowNode"]);w&&C&&c(g)!==c(S)&&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:S}=p.flow,E=u(d,g,"source",["flowNode","participant"]),x=u(d,S,"target",["flowNode","participant"]);if(E&&x){const w=c(g),C=c(S);w!==void 0&&w===C&&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 S=m.source===p.dataStore.id?m.target:m.source;u(d,S,"dataAssociation",["flowNode"])}break}case"dataAssociation.add":{const{source:m,target:g}=p.association,S=u(d,m,"source"),E=u(d,g,"target");if(S&&E){const x=new Set([S,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:S}=p.association,E=u(d,g,"source"),x=u(d,S,"target");E&&x&&E!=="annotation"&&x!=="annotation"&&i.push({kind:"association-detached",opIndex:d,annotation:m??`${g}->${S}`});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 S=m===p.annotation.id?g:m;u(d,S,"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&&lh.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 S=g.filter(E=>m.includes(E));S.length===m.length&&S.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,S=t.endpointsOf(p.id),E=p.source??(S==null?void 0:S.source),x=p.target??(S==null?void 0:S.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&&lh.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 dh(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 ms(e){return`bpmn:${e[0].toUpperCase()}${e.slice(1)}`}const gs={"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]},Xt=10,hh=40,LE=10;function Xu(e,t,n,i,r){const o=n,a=(k,O)=>{const[$,ie]=gs[k];let ge={x:t.x+t.width/2+$*(t.width/2+o.width/2+O),y:t.y+t.height/2+ie*(t.height/2+o.height/2+O)};const Ve=i.x+Xt+o.width/2,q=i.x+i.width-Xt-o.width/2,ae=i.y+Xt+o.height/2,de=i.y+i.height-Xt-o.height/2,re={x:Math.min(q,Math.max(Ve,ge.x)),y:Math.min(de,Math.max(ae,ge.y))};return(re.x!==ge.x||re.y!==ge.y)&&(ge=Math.abs(re.x-(t.x+t.width/2))<(t.width+o.width)/2+Xt&&Math.abs(re.y-(t.y+t.height/2))<(t.height+o.height)/2+Xt?{x:t.x+t.width+Xt+o.width/2,y:re.y}:re),ge},s=(i.children??[]).filter(k=>!("waypoints"in k&&k.waypoints)&&k.type!=="bpmn:Lane"&&k.type!=="label"&&typeof k.x=="number"&&k.id!==r.selfId),c=Et(e),u=k=>{var $,ie;if(!r.selfId)return!1;const O=e.get(k);return!!O&&((($=O.source)==null?void 0:$.id)===r.selfId||((ie=O.target)==null?void 0:ie.id)===r.selfId)},l=c.edges.filter(k=>!u(k.id)).flatMap(fn),f=qo(c).filter(k=>k.owner!==r.selfId).map(k=>k.rect),p=k=>({x0:k.x-o.width/2-Xt,x1:k.x+o.width/2+Xt,y0:k.y-o.height/2-Xt,y1:k.y+o.height/2+Xt}),d=k=>{const O=p(k);return s.some($=>O.x0<$.x+$.width&&O.x1>$.x&&O.y0<$.y+$.height&&O.y1>$.y)},h=k=>{const O=p(k);return l.some($=>$.axis==="h"?$.at>O.y0&&$.at<O.y1&&$.lo<O.x1&&$.hi>O.x0:$.at>O.x0&&$.at<O.x1&&$.lo<O.y1&&$.hi>O.y0)},m=k=>{const O=p(k);return f.some($=>O.x0<$.x+$.width&&O.x1>$.x&&O.y0<$.y+$.height&&O.y1>$.y)},g=c.shapes.filter(k=>k.type==="bpmn:Group").flatMap(k=>[{axis:"h",at:k.y,lo:k.x,hi:k.x+k.width},{axis:"h",at:k.y+k.height,lo:k.x,hi:k.x+k.width},{axis:"v",at:k.x,lo:k.y,hi:k.y+k.height},{axis:"v",at:k.x+k.width,lo:k.y,hi:k.y+k.height}]),S=k=>{const O=p(k);return g.some($=>$.axis==="h"?$.at>O.y0&&$.at<O.y1&&$.lo<O.x1&&$.hi>O.x0:$.at>O.x0&&$.at<O.x1&&$.lo<O.y1&&$.hi>O.y0)},E=k=>d(k)||h(k)||m(k)||S(k),x=k=>k.x-o.width/2>=i.x&&k.x+o.width/2<=i.x+i.width&&k.y-o.height/2>=i.y&&k.y+o.height/2<=i.y+i.height;if(r.placement){const k=q=>q.startsWith("top")?q.replace(/^top/,"bottom"):q.replace(/^bottom/,"top"),O=q=>q.endsWith("left")?q.replace(/left$/,"right"):q.replace(/right$/,"left"),$=r.placement.side,ie=[$,k($),O($),k(O($)),"top","bottom","left","right","top-left","top-right","bottom-left","bottom-right"],ge=r.placement.offset??50;let Ve=a($,ge);if(E(Ve)){const q=new Set;for(const ae of ie){if(q.has(ae))continue;q.add(ae);const de=a(ae,ge);if(x(de)&&!E(de)){Ve=de;break}}}return Ve}const w=r.from,C=i.x+Xt+o.width/2,P=i.x+i.width-Xt-o.width/2,L=i.y+Xt+o.height/2,T=i.y+i.height-Xt-o.height/2;let B={x:Math.min(P,Math.max(C,w.x)),y:Math.min(T,Math.max(L,w.y))};if(E(B)){const k=(t.width+o.width)/2+Xt,$=[{x:B.x+k,y:B.y},{x:B.x-k,y:B.y},{x:B.x,y:B.y-o.height-Xt},{x:B.x,y:B.y+o.height+Xt}].filter(x).find(ie=>!E(ie));$&&(B=$)}return B}function qt(e,t){return e.filter(n=>n.kind===t)}function mh(e,t){var Bx,$x,jx,Fx,Hx,zx,Gx,Vx,Wx,Ux,qx,Yx,Kx,Xx,Zx,Qx,Jx,e0;const{modeling:n,bpmnFactory:i,elementFactory:r,elementRegistry:o,canvas:a,autoPlace:s,bpmnReplace:c}=t,u=()=>a.getRootElement(),l=_=>o.get(_),f=_=>{const R=l(_);if(!R)throw new Error(`하강 참조 해소 실패: ${_}`);return R},p=_=>{let R=_.parent;for(;R;){if(R.type==="bpmn:Participant")return R;R=R.parent}},d=new Map;for(const _ of o.filter(R=>!("waypoints"in R&&R.waypoints)&&R.type!=="bpmn:Lane"&&R.type!=="label"&&typeof R.x=="number"))d.set(_.id,{x:_.x,y:_.y});const h=qt(e,"participant.add"),m=qt(e,"node.add"),g=qt(e,"sequenceFlow.add"),S=qt(e,"messageFlow.add"),E=qt(e,"dataStore.add"),x=qt(e,"dataAssociation.add"),w=qt(e,"annotation.add"),C=qt(e,"group.add"),P=new Map(m.map(_=>[_.node.id,_])),L=(_,R,M)=>{var U;const F=_.businessObject,H=(((U=F.extensionElements)==null?void 0:U.values)??[]).filter(W=>W.$type!==R),I=M?[...H,i.create(R,M)]:H;if(!I.length){F.extensionElements&&n.updateProperties(_,{extensionElements:void 0});return}const Y=i.create("bpmn:ExtensionElements",{values:I});I.forEach(W=>{W.$parent=Y}),n.updateProperties(_,{extensionElements:Y})},T=_=>({anchor:_.anchor,side:_.side,..._.offset!==void 0?{offset:_.offset}:{}});for(const _ of qt(e,"element.remove")){const R=l(_.id);R&&n.removeElements([R])}const B=_=>o.filter(R=>{var M;return R.type==="bpmn:Lane"&&((M=p(R))==null?void 0:M.id)===_}).sort((R,M)=>R.y-M.y);for(const _ of qt(e,"participant.update")){const R=f(_.id);if(_.name!==void 0&&n.updateProperties(R,{name:_.name??void 0}),!_.lanes)continue;const M=B(_.id);if(!M.length){n.splitLane(R,_.lanes.length),B(_.id).forEach((H,I)=>{const Y=_.lanes[I];Y&&n.updateProperties(H,{id:Y.id,name:Y.name})});continue}const F=new Set(M.map(H=>H.id));_.lanes.forEach((H,I)=>{if(F.has(H.id)){n.updateProperties(f(H.id),{name:H.name});return}const Y=I===0?n.addLane(B(_.id)[0],"top"):n.addLane(f(_.lanes[I-1].id),"bottom");n.updateProperties(Y,{id:H.id,name:H.name})})}const k=150,O=130,$=80,ie=90,ge=180,Ve=30,q=(_,R,M,F,H)=>{const I=M-R.width/2,Y=F-R.height/2;return(_.children??[]).find(U=>!("waypoints"in U&&U.waypoints)&&U.type!=="bpmn:Lane"&&U.type!=="label"&&!(H!=null&&H.has(U.id))&&typeof U.x=="number"&&I<U.x+U.width+Ve&&I+R.width+Ve>U.x&&Y<U.y+U.height&&Y+R.height>U.y)},ae=new Set;for(const _ of h){ae.add(`pool:${_.participant.id}`);for(const R of _.participant.lanes??[])ae.add(R.id)}const de=new Map;for(const _ of m){const R=_.node.lane??`pool:${_.node.participant??""}`;let M=de.get(R);M||de.set(R,M=new Set([0])),_.band!==void 0&&M.add(_.band)}const re=new Map;for(const[_,R]of de){if(!ae.has(_))continue;const M=[...R].sort((I,Y)=>I-Y),F=M.map((I,Y)=>Y===0?0:Y%2===1?Math.ceil(Y/2):-(Y/2)),H=Math.min(...F);re.set(_,new Map(M.map((I,Y)=>[I,F[Y]-H])))}{const _=new Map;for(const R of h)(R.participant.lanes??[]).forEach((M,F)=>_.set(M.id,F));for(const[R,M]of re){if(!_.has(R)||M.size<2)continue;const F=_.get(R),H=M.get(0)??0,I=new Set;for(const oe of m){if(oe.node.lane!==R||(oe.band??0)!==0||!oe.node.type.endsWith("Gateway"))continue;const ke={in:new Set,out:new Set,cross:new Set};for(const ue of g){const ye=ue.flow.source===oe.node.id;if(!ye&&ue.flow.target!==oe.node.id)continue;const pt=P.get(ye?ue.flow.target:ue.flow.source);if(!pt||pt.node.participant!==oe.node.participant||!pt.node.lane)continue;let Ae,ze=!1;if(pt.node.lane!==R){const se=_.get(pt.node.lane);if(se===void 0)continue;Ae=se>F?"down":"up",ze=!0}else{const se=M.get(pt.band??0)??H;Ae=se>H?"down":se<H?"up":void 0}Ae&&(ke[ye?"out":"in"].add(Ae),ze&&ke.cross.add(Ae))}for(const ue of["up","down"])ke.in.has(ue)&&ke.out.has(ue)&&ke.cross.has(ue)&&I.add(ue)}if(I.size!==1)continue;const[Y]=I,U=Math.max(...M.values()),W=Y==="down"?U:0;if(H===W)continue;const le=[...M.entries()].filter(([oe])=>oe!==0).sort((oe,ke)=>oe[1]-ke[1]),Ce=[...Array(U+1).keys()].filter(oe=>oe!==W),Ne=new Map([[0,W]]);le.forEach(([oe],ke)=>Ne.set(oe,Ce[ke])),re.set(R,Ne)}}const ve=_=>{var R;return(((R=de.get(_))==null?void 0:R.size)??0)>1},te=_=>_.band??(_.node.lane||!ve(`pool:${_.node.participant??""}`)?void 0:0),V=new Map,G=_=>V.get(_.node.id)??te(_),X=new Set,je=new Set;{const _=new Map;for(const F of g)_.set(F.flow.target,(_.get(F.flow.target)??0)+1);const R=F=>{const H=[],I=new Set([F]),Y=[F];for(;Y.length;){const U=Y.shift();H.push(U);for(const W of g)W.flow.source!==U||I.has(W.flow.target)||(_.get(W.flow.target)??0)!==1||(I.add(W.flow.target),Y.push(W.flow.target))}return H},M=(F,H)=>{var I;return((I=re.get(F))==null?void 0:I.get(H))??H};for(const F of m){if(!F.node.type.endsWith("Gateway"))continue;const H=F.node.lane??`pool:${F.node.participant??""}`,I=re.get(H);if(!I||I.size<2)continue;const Y=G(F);if(Y===void 0||M(H,Y)!==M(H,0))continue;const U=M(H,Y),W=g.filter(ue=>ue.flow.source===F.node.id).map(ue=>P.get(ue.flow.target)).filter(ue=>!!ue&&(ue.node.lane??`pool:${ue.node.participant??""}`)===H),le=W.filter(ue=>{const ye=G(ue);return ye!==void 0&&M(H,ye)===U&&(_.get(ue.node.id)??0)===1}),Ce=W.some(ue=>{const ye=G(ue);return ye!==void 0&&M(H,ye)>U});if(le.length!==1||!Ce)continue;const Ne=new Set(W.flatMap(ue=>R(ue.node.id)));if(!g.some(ue=>ue.flow.target===F.node.id&&Ne.has(ue.flow.source)))continue;const ke=new Map;for(const[ue,ye]of I)ke.set(ue,ye+1);ke.set(-1,0),re.set(H,ke);for(const ue of R(le[0].node.id))P.has(ue)&&(V.set(ue,-1),je.add(ue));X.add(F.node.id)}}const Rt=(_,R)=>{var M;return((M=re.get(_))==null?void 0:M.get(R))??R},A=new Map;for(const[_,R]of de){let M=0;for(const F of R)M=Math.max(M,Rt(_,F));A.set(_,M)}const b=_=>ge+k*_,y=h.map((_,R)=>({op:_,declared:R}));y.sort((_,R)=>{const M=_.op.order??Number.POSITIVE_INFINITY,F=R.op.order??Number.POSITIVE_INFINITY;return M!==F?M-F:_.declared-R.declared});let N=80;for(const _ of o.getAll())_.parent===u()&&"height"in _&&typeof _.y=="number"&&(N=Math.max(N,_.y+_.height+60));for(const{op:_}of y){const R=_.participant,M=m.filter(oe=>oe.node.participant===R.id).length,F=((Bx=R.lanes)==null?void 0:Bx.length)??0,H=Math.max(1200,M*160+300),I=(R.lanes??[]).map(oe=>b(A.get(oe.id)??0)),Y=I.reduce((oe,ke)=>oe+ke,0);F&&Y<300&&(I[F-1]+=300-Y);const U=Math.max(300,k*((A.get(`pool:${R.id}`)??0)+1)),W=R.blackBox||M+F===0?120:F?Math.max(300,Y):U,le=r.createShape({type:"bpmn:Participant",businessObject:i.create("bpmn:Participant",{id:R.id,name:R.name,..._.order!==void 0?{"bwl:poolOrder":_.order}:{},...R.blackBox?{}:{processRef:i.create("bpmn:Process")}}),width:H,height:W,isExpanded:!0}),Ce=n.createShape(le,{x:100+H/2,y:N+W/2},u()),Ne=R.lanes??[];if(Ne.length&&n.splitLane(Ce,Ne.length),Ne.length){const oe=o.filter(ke=>{var ue;return ke.type==="bpmn:Lane"&&((ue=p(ke))==null?void 0:ue.id)===R.id}).sort((ke,ue)=>ke.y-ue.y);if(oe.forEach((ke,ue)=>{const ye=Ne[ue];ye&&n.updateProperties(ke,{id:ye.id,name:ye.name})}),I.some(ke=>ke!==Ce.height/F)){let ke=Ce.y;oe.forEach((ue,ye)=>{const pt=I[ye];n.resizeShape(ue,{x:ue.x,y:ke,width:ue.width,height:pt}),ke+=pt})}}N=Ce.y+Ce.height+60}const z=_=>{var F;const R=P.get(_);if(R)return R.node.participant??"";const M=l(_);return M?M.type==="bpmn:Participant"?M.id:((F=p(M))==null?void 0:F.id)??"":""},K=new Map,he=_=>{let R=K.get(_);return R||K.set(_,R={nodes:[],flows:[]}),R};for(const _ of m)he(_.node.participant??"").nodes.push(_);for(const _ of g)he(z(_.flow.source)).flows.push(_);const Le=_=>{var R;return i.create("bpmn:SequenceFlow",{id:_.id,name:_.name??((R=_.condition)==null?void 0:R.label)})},Qe=(_,R)=>r.createShape({type:ms(_.type),businessObject:i.create(ms(_.type),{id:_.id,name:_.name,...R!==void 0?{"bwl:band":R}:{}})}),Ct=[...y.map(({op:_})=>_.participant.id).filter(_=>K.has(_)),...[...K.keys()].filter(_=>!h.some(R=>R.participant.id===_))],nt=_=>_.endsWith("Gateway");for(const _ of Ct){const R=K.get(_),M=_?f(_):void 0,F=M?M.x+150:250;let H=M?M.y+80:120;const I=(se,we,Be)=>{const it=u().children.filter(gt=>!("waypoints"in gt&&gt.waypoints)&&gt.id!==we&&typeof gt.y=="number"&&gt.y>=se);it.length&&n.moveElements(it,{x:0,y:Be})},Y=(se,we)=>{if(se){const tt=f(se),nn=b(we);if(tt.height>=nn)return;const gn=nn-tt.height,J=p(tt),Ie=J?J.y+J.height:tt.y+tt.height;n.resizeLane(tt,{x:tt.x,y:tt.y,width:tt.width,height:nn},!1),I(Ie,J==null?void 0:J.id,gn);return}if(!M)return;const Be=k*(we+1);if(M.height>=Be)return;const it=Be-M.height,gt=M.y+M.height;n.resizeShape(M,{x:M.x,y:M.y,width:M.width,height:Be}),I(gt,M.id,it)},U=(se,we,Be)=>{if(se){const it=f(se);return it.y+Math.min(it.height/2,ie)+Rt(se,we??0)*k}return we!==void 0&&M?M.y+$+Rt(`pool:${_}`,we)*k:Be},W=(se,we,Be)=>{if(se){const it=f(se);return it.y+Math.min(it.height/2,ie)+we*k}return M?M.y+$+we*k:Be},le=se=>se.participant?f(se.participant):u(),Ce=(se,we,Be,it,gt,tt)=>{const nn=Be!==void 0||it!==void 0,gn=Rt(Be??`pool:${_}`,it??0);if(nn)for(let me=0;me<4;me++){const be=W(Be,gn+me,tt);if(!q(se,we,gt,be))return Y(Be,gn+me),{x:gt,y:be}}const J=U(Be,it,tt);nn&&Y(Be,gn);let Ie=gt;for(let me=0;me<64;me++){const be=q(se,we,Ie,J);if(!be)break;Ie=be.x+be.width+O+we.width/2}return{x:Ie,y:J}},Ne=new Set(R.flows.map(se=>se.flow.target)),oe=new Map;for(const se of R.nodes){if(Ne.has(se.node.id))continue;const we=Qe(se.node,se.band),Be=te(se),it=se.node.lane?`${se.node.lane}|${Be??""}`:Be!==void 0?`band:${Be}`:"",gt=le(se.node),tt=Ce(gt,we,se.node.lane,Be,oe.get(it)??F,H);n.createShape(we,tt,gt),oe.set(it,tt.x+we.width+O),!se.node.lane&&Be===void 0&&(H+=160)}const ke=new Set,ue=new Map,ye=new Map,pt=new Map;if(_&&ae.has(`pool:${_}`)){const se=new Map;for(const J of R.flows)se.set(J.flow.target,(se.get(J.flow.target)??0)+1);const we=J=>U(J.node.lane,G(J),Number.NaN),Be=new Set,it=J=>{var be;const Ie=(be=P.get(J))==null?void 0:be.node.participant;if(Ie)return l(Ie);const me=l(J);if(me)return me.type==="bpmn:Participant"?me:p(me)},gt=J=>{const Ie=[],me=new Set([J]),be=[J];for(;be.length;){const Je=be.shift(),Ue=P.get(Je);Ue&&Ie.push(Ue);for(const Te of R.flows)Te.flow.source!==Je||me.has(Te.flow.target)||(se.get(Te.flow.target)??0)!==1||(me.add(Te.flow.target),be.push(Te.flow.target))}return Ie},tt=J=>{if(!M)return;const Ie=new Set(J.map(Je=>Je.node.id));let me=!1,be=!1;for(const Je of S){if(!Ie.has(Je.flow.source))continue;const Ue=it(Je.flow.target);!Ue||Ue.id===M.id||(Ue.y<M.y?me=!0:be=!0)}return me&&!be?"up":be&&!me?"down":void 0};for(const J of R.nodes){if(!nt(J.node.type))continue;const Ie=U(J.node.lane,te(J),Number.NaN);if(Number.isNaN(Ie))continue;const me=[];for(const Te of R.flows){if(Te.flow.source!==J.node.id)continue;const Ke=P.get(Te.flow.target);if(!Ke||Ke.node.lane!==J.node.lane||(se.get(Ke.node.id)??0)!==1)continue;const rt=te(Ke);if(rt===void 0)continue;const yn=U(Ke.node.lane,rt,Number.NaN);if(Number.isNaN(yn))continue;const Zr=gt(Ke.node.id),Kt=tt(Zr);Kt&&me.push({subtree:Zr,band:rt,row:yn,dir:Kt})}if(!me.some(Te=>Te.dir==="up")||!me.some(Te=>Te.dir==="down")||!me.some(Te=>Te.dir==="up"&&me.some(Ke=>Ke.dir==="down"&&Ke.row<Te.row)))continue;const Je=[...me].sort((Te,Ke)=>Te.row-Ke.row);[...me.filter(Te=>Te.dir==="up"),...me.filter(Te=>Te.dir==="down")].sort((Te,Ke)=>Te.dir===Ke.dir?Te.row-Ke.row:Te.dir==="up"?-1:1).forEach((Te,Ke)=>{const rt=Je[Ke].band;if(rt!==Te.band){Be.add(J.node.id);for(const yn of Te.subtree)te(yn)===Te.band&&V.set(yn.node.id,rt)}})}const nn=J=>{if(!M)return;const Ie=new Set(J.map(Je=>Je.node.id));let me=!1,be=!1;for(const Je of S){if(!Ie.has(Je.flow.target))continue;const Ue=it(Je.flow.source);!Ue||Ue.id===M.id||(Ue.y<M.y?me=!0:be=!0)}return me&&!be?"up":be&&!me?"down":void 0};for(const J of R.nodes){if(!nt(J.node.type))continue;const Ie=J.node.lane??`pool:${_}`,me=re.get(Ie);if(!me||me.size<2)continue;const be=me.get(0);if(be===void 0)continue;const Je=Math.max(...me.values()),Ue=be===Je&&be!==0?"down":void 0;if(!Ue)continue;const Te=[];for(const Kt of R.flows){if(Kt.flow.source!==J.node.id)continue;const Jn=P.get(Kt.flow.target);if(!Jn||Jn.node.lane!==J.node.lane||(se.get(Jn.node.id)??0)!==1)continue;const t0=G(Jn);t0!==void 0&&Te.push({t:Jn,subtree:gt(Jn.node.id),band:t0})}const Ke=Te.find(Kt=>(me.get(Kt.band)??Kt.band)===be);if(!Ke||nn(Ke.subtree)===Ue||tt(Ke.subtree)===Ue)continue;const rt=Te.find(Kt=>Kt!==Ke&&nn(Kt.subtree)===Ue);if(!rt)continue;const yn=Ke.band,Zr=rt.band;for(const Kt of Ke.subtree)G(Kt)===yn&&V.set(Kt.node.id,Zr);for(const Kt of rt.subtree)G(Kt)===Zr&&V.set(Kt.node.id,yn);Be.add(J.node.id)}for(const J of R.nodes){if(!nt(J.node.type))continue;const Ie=we(J);if(Number.isNaN(Ie)||w.some(Te=>{var Ke,rt;return(((Ke=Te.placement)==null?void 0:Ke.anchor)??(Te.association?Te.association.source===Te.annotation.id?Te.association.target:Te.association.source:void 0))===J.node.id&&((rt=Te.placement)==null?void 0:rt.side.startsWith("bottom"))}))continue;let be,Je=!1,Ue;for(const Te of R.flows){if(Te.flow.source!==J.node.id)continue;const Ke=P.get(Te.flow.target);if(!Ke||!Ke.node.lane&&te(Ke)===void 0)continue;const rt=we(Ke);Number.isNaN(rt)||(Math.abs(rt-Ie)<.5&&(Je=!0),rt>Ie?!be||rt>be.row?be={id:Ke.node.id,row:rt,count:1}:rt===be.row&&be.count++:rt<Ie&&Ke.node.lane===J.node.lane&&(!Ue||rt>Ue.row?Ue={op:Ke,row:rt,count:1}:rt===Ue.row&&Ue.count++))}be&&be.count===1&&(se.get(be.id)??0)===1&&!Be.has(J.node.id)&&ke.add(be.id),!Je&&Ue&&Ue.count===1&&(se.get(Ue.op.node.id)??0)===1&&!X.has(J.node.id)&&ue.set(Ue.op.node.id,{lane:J.node.lane,band:G(J)})}const gn=new Map;for(const J of S)gn.set(J.flow.target,[...gn.get(J.flow.target)??[],J]);for(const J of R.nodes){const Ie=gn.get(J.node.id);if(!Ie||Ie.length!==1||!se.get(J.node.id)||!J.node.lane&&te(J)===void 0||je.has(J.node.id))continue;const me=($x=P.get(Ie[0].flow.source))==null?void 0:$x.node.participant,be=me?l(me):void 0;if(!be||!M||be.id===M.id)continue;const Je=J.node.lane??`pool:${_}`,Ue=re.get(Je);if(!Ue)continue;const Te=Ue.get(0)??0,Ke=(Ue.get(G(J)??0)??Te)-Te;if(Ke===0)continue;const rt=be.y<M.y;if(rt&&Ke<0||!rt&&Ke>0)continue;let yn;for(const[Zr,Kt]of Ue){const Jn=Kt-Te;(rt&&Jn<0&&(!yn||Jn<yn.row)||!rt&&Jn>0&&(!yn||Jn>yn.row))&&(yn={band:Zr,row:Jn})}yn&&ye.set(J.node.id,{lane:J.node.lane,band:yn.band})}}const Ae=new Set;let ze=0;for(;ze++<R.nodes.length+2;){for(let Be=0;Be<R.nodes.length+R.flows.length+2;Be++){let it=!1;for(const gt of R.flows){const tt=gt.flow;if(Ae.has(tt.id))continue;const nn=l(tt.source);if(!nn)continue;const gn=l(tt.target),J=P.get(tt.target);if(!gn&&J){const Ie=Qe(J.node,J.band),me=G(J);if(J.node.lane||me!==void 0){const be=le(J.node),Je=nn,Ue=Je.x+(pt.get(tt.source)??0)+Je.width+O,Te=ue.get(tt.target)??ye.get(tt.target),Ke=Ce(be,Ie,Te?Te.lane:J.node.lane,Te?Te.band:me,ke.has(tt.target)?Je.x+Je.width/2:Ue,Number.NaN),rt=n.createShape(Ie,Ke,be);ke.has(tt.target)&&pt.set(tt.target,Ue-(rt.x+rt.width/2)),n.connect(nn,rt,{type:"bpmn:SequenceFlow",businessObject:Le(tt)})}else s.append(nn,Ie,{connection:{type:"bpmn:SequenceFlow",businessObject:Le(tt)}})}else if(gn)n.connect(nn,gn,{type:"bpmn:SequenceFlow",businessObject:Le(tt)});else continue;Ae.add(tt.id),it=!0}if(!it)break}const se=R.nodes.filter(Be=>!l(Be.node.id));if(!se.length)break;const we=se[0];{const Be=Qe(we.node,we.band),it=le(we.node),gt=te(we);n.createShape(Be,Ce(it,Be,we.node.lane,gt,F,H),it),!we.node.lane&&gt===void 0&&(H+=160)}}}const Nt=40,Pt=(_,R=()=>!0)=>{const M=l(_);if(!M)return[];const F=[M],H=new Set([_]);for(let I=0;I<F.length;I++){const Y=F[I].id;for(const U of g){const W=U.flow.target;if(U.flow.source!==Y||H.has(W)||!P.has(W))continue;H.add(W);const le=l(W);le&&R(le)&&F.push(le)}}return F},mn=(_,R=()=>!0)=>{const M=l(_);if(!M)return[];const F=[M],H=new Set([_]);for(let I=0;I<F.length;I++){const Y=F[I].id;for(const U of g){const W=U.flow.source;if(U.flow.target!==Y||H.has(W)||!P.has(W))continue;H.add(W);const le=l(W);le&&R(le)&&F.push(le)}}return F};for(const _ of qt(e,"sequenceFlow.update")){if(_.target===void 0)continue;const R=P.get(_.target);if(!R)continue;const M=l(_.target),F=l(_.id);if(!M||!F)continue;const H=_.source!==void 0?l(_.source):F.source,I=F.target;if(!H||!I||I.id===M.id)continue;const Y=Pt(_.target),U=new Set(Y.map(ue=>ue.id)),W=Math.min(...Y.map(ue=>ue.x)),le=Math.max(...Y.map(ue=>ue.x+ue.width)),Ce=H.x+H.width,Ne=le-W+Nt*2-(I.x-Ce);if(Ne>0){const ue=p(M),ye=(ue==null?void 0:ue.children)??[],pt=se=>se.type==="bpmn:Lane",Ae=ye.filter(se=>!("waypoints"in se&&se.waypoints)&&!pt(se)&&!U.has(se.id)&&se.x>=I.x),ze=ue?[ue,...ye.filter(se=>pt(se))]:[];Ae.length&&n.createSpace(Ae,ze,{x:Ne,y:0},"e",I.x-1)}const oe=R.node.lane||R.band!==void 0?M.y+M.height/2:H.y+H.height/2;n.moveElements(Y,{x:Ce+Nt-W,y:oe-(M.y+M.height/2)});const ke=p(M);if(R.node.lane===void 0&&R.band!==void 0&&ke){const ue=ke.y+$+Rt(`pool:${R.node.participant??""}`,R.band)*k,ye=ue-(M.y+M.height/2);ye!==0&&!q(ke,M,M.x+M.width/2,ue,U)&&n.moveElements([M],{x:0,y:ye})}}const lt=(_,R)=>{const M=R.target===_,F=f(R.source),H=f(R.target),I=M?"bpmn:DataOutputAssociation":"bpmn:DataInputAssociation";n.connect(F,H,R.id?{type:I,businessObject:i.create(I,{id:R.id})}:{type:I})},zt=100,ln=_=>{for(const R of h){if(!R.participant.blackBox)continue;const M=l(R.participant.id);if(!M)continue;const F=[];for(const I of S){const Y=I.flow.source===R.participant.id?I.flow.target:I.flow.target===R.participant.id?I.flow.source:void 0,U=Y?l(Y):void 0;U&&typeof U.x=="number"&&U.type!=="bpmn:Participant"&&F.push(U)}if(!F.length)continue;const H=Math.max(...F.map(I=>I.x+I.width/2))+zt;if(H>M.x+M.width&&n.resizeShape(M,{x:M.x,y:M.y,width:H-M.x,height:M.height}),!!_)for(const I of S){const Y=l(I.flow.id),U=I.flow.source===R.participant.id?I.flow.target:I.flow.target===R.participant.id?I.flow.source:void 0,W=U?l(U):void 0;if(!Y||!W||W.type==="bpmn:Participant")continue;const le=W.x+W.width/2;if(le<M.x+10||le>M.x+M.width-10)continue;const Ce=M.y>W.y,Ne=Ce?W.y+W.height:W.y,oe=Ce?M.y:M.y+M.height,ke=I.flow.source===R.participant.id?[{x:le,y:oe},{x:le,y:Ne}]:[{x:le,y:Ne},{x:le,y:oe}],ue=Et(o),ye={...ue.edges.find(pt=>pt.id===I.flow.id),waypoints:ke};jn(ye,si(ue)).length||n.updateWaypoints(Y,ke)}}};ln(!1);for(const _ of S){const R=_.flow;n.connect(f(R.source),f(R.target),{type:"bpmn:MessageFlow",businessObject:i.create("bpmn:MessageFlow",{id:R.id,name:R.name})})}{const M=new Set([...g.map(W=>W.flow.id),...S.map(W=>W.flow.id)].filter(W=>!!W)),F=o.filter(W=>!!W.waypoints),H=(W,le)=>Math.abs(le.x-W.x)<2?"L":Math.abs(le.x-(W.x+W.width))<2?"R":Math.abs(le.y-W.y)<2?"T":Math.abs(le.y-(W.y+W.height))<2?"B":void 0,I=new Map,Y=(W,le,Ce)=>{if(!W||!le||typeof W.x!="number")return;const Ne=H(W,le);if(!Ne)return;let oe=I.get(W.id);oe||I.set(W.id,oe=new Map),oe.set(Ne,[...oe.get(Ne)??[],Ce])};for(const W of F){const le=W.waypoints;!le||le.length<2||(Y(W.source,le[0],{id:W.id,dir:"out"}),Y(W.target,le[le.length-1],{id:W.id,dir:"in"}))}const U=new Set;for(const[W,le]of I){const Ce=l(W);if(!Ce||typeof Ce.x!="number"||![...le.values()].some(ze=>{const se=ze.filter(we=>we.dir==="in");return ze.length>=3&&se.length>=1&&ze.some(we=>we.dir==="out")&&se.some(we=>M.has(we.id))}))continue;const oe=p(Ce);if(!oe||U.has(oe.id)||(oe.children??[]).some(ze=>ze.type==="bpmn:Lane"))continue;const ke=(jx=le.get("T"))!=null&&jx.length?(Fx=le.get("B"))!=null&&Fx.length?void 0:"B":"T";if(!ke||(ke==="T"?Ce.y-oe.y:oe.y+oe.height-(Ce.y+Ce.height))>=k)continue;const ye=(oe.children??[]).filter(ze=>!("waypoints"in ze&&ze.waypoints)&&ze.type!=="label"&&typeof ze.x=="number"),pt=oe.y+oe.height;n.resizeShape(oe,{x:oe.x,y:oe.y,width:oe.width,height:oe.height+k});const Ae=u().children.filter(ze=>!("waypoints"in ze&&ze.waypoints)&&ze.id!==oe.id&&typeof ze.y=="number"&&ze.y>=pt);Ae.length&&n.moveElements(Ae,{x:0,y:k}),ke==="T"&&ye.length&&n.moveElements(ye,{x:0,y:k}),U.add(oe.id)}}const Sr=20,xn=30,ii=4,Qn=2,Gt=[10,30,80],Rr=_=>!("waypoints"in _&&_.waypoints)&&_.type!=="bpmn:Lane"&&_.type!=="label"&&typeof _.x=="number",Wi=()=>{const _=Et(o);return{bad:Ai(_).filter(R=>R.kind==="edge-crosses-shape"||R.kind==="edge-overlap-opposite"||R.kind==="edge-overlap-mixed").length,crossings:Ld(_),straight:_.edges.filter(R=>R.type==="bpmn:MessageFlow"&&R.waypoints.length===2).length}},tn=_=>{const R=Et(o),M=R.edges.find(F=>F.id===_);return M?jn(M,si(R)).length:0},Ye=_=>tn(_)>0,et=_=>Et(o).edges.filter(R=>R.type==="bpmn:MessageFlow"&&R.id!==_&&R.waypoints.length===2).length,zf=(_,R)=>{const M=new Set(_.flatMap(I=>I.subtree.map(Y=>Y.id)));for(const I of _){const Y=(I.pool.children??[]).filter(Rr).filter(W=>!M.has(W.id));if(I.subtree.some(W=>Y.some(le=>W.x+R<le.x+le.width+xn&&W.x+R+W.width+xn>le.x&&W.y<le.y+le.height&&W.y+W.height>le.y)))return null}const F=_.map(I=>I.pool.width);n.moveElements(_.flatMap(I=>I.subtree),{x:R,y:0});const H=_.map(I=>{const U=Math.max(...I.subtree.map(W=>W.x+W.width))+150-(I.pool.x+I.pool.width);return U>0&&n.resizeShape(I.pool,{x:I.pool.x,y:I.pool.y,width:I.pool.width+U,height:I.pool.height}),U});return()=>{n.moveElements(_.flatMap(I=>I.subtree),{x:-R,y:0}),_.forEach((I,Y)=>{H[Y]>0&&n.resizeShape(I.pool,{x:I.pool.x,y:I.pool.y,width:F[Y],height:I.pool.height})})}},wD=(_,R,M)=>zf([{subtree:_,pool:R}],M),Rx=(_,R)=>R.bad>_.bad||R.crossings>_.crossings&&R.straight<=_.straight&&R.bad>=_.bad,xu=(_,R)=>Rx(_,R)||R.straight<_.straight,wu=(_,R,M=()=>!0,F=Rx)=>{const H=Wi(),I=zf(_,R);if(!I)return!1;const Y=Wi();return F(H,Y)||!M()?(I(),!1):!0},Cx=(_,R,M,F=()=>!0)=>wu([{subtree:_,pool:R}],M,F),Kr=_=>{var R;return!!((R=P.get(_))!=null&&R.node.participant)},Ka=new Map;for(const _ of S){if(!Kr(_.flow.target))continue;const R=Ka.get(_.flow.target)??[];R.push(_),Ka.set(_.flow.target,R)}const Gf=[...Ka.keys()],Px=new Set(g.map(_=>_.flow.target)),Ax=_=>y.findIndex(({op:R})=>R.participant.id===_);Gf.sort((_,R)=>{var H,I;const M=Px.has(_)?1:0,F=Px.has(R)?1:0;return M!==F?M-F:Ax((H=P.get(_))==null?void 0:H.node.participant)-Ax((I=P.get(R))==null?void 0:I.node.participant)});const Xr=_=>_.x+_.width/2,ED=_=>{const R=new Map;for(const H of o.getAll()){const I=H;if(!I.waypoints||!I.source||!I.target)continue;(R.get(I.source.id)??R.set(I.source.id,[]).get(I.source.id)).push(I.target.id)}const M=new Set([_]),F=[_];for(let H=0;H<F.length;H++)for(const I of R.get(F[H])??[])M.has(I)||(M.add(I),F.push(I));return M},SD=(_,R)=>{const M=ED(R);let F;for(const H of o.getAll()){const I=H;if(I.type!=="bpmn:MessageFlow"||!I.source||!I.target||I.target.id!==_||M.has(I.source.id))continue;const Y=I.source;if(typeof Y.x!="number"||Y.type==="bpmn:Participant")continue;const U=Xr(Y);(F===void 0||U>F)&&(F=U)}return F},Vf=(_,R)=>{const M=l(_.flow.source);if(M)return M.type==="bpmn:Participant"?SD(M.id,R):Xr(M)},Tx=_=>{let R;for(const M of Ka.get(_)??[]){const F=Vf(M,_);F!==void 0&&(!R||F>R.cx)&&(R={op:M,cx:F})}return R==null?void 0:R.op},RD=_=>{const R=Tx(_),M=l(_),F=R?Vf(R,_):void 0;return M&&F!==void 0?F-Xr(M):void 0},CD=_=>{const R=RD(_);return R!==void 0&&Math.abs(R)<Sr},Mx=(_,R,M,F,H)=>{var I;for(let Y=!0;Y;){Y=!1;for(const U of S){if(U.flow.id===M)continue;const W=R.has(U.flow.source),le=R.has(U.flow.target);if(W===le||F(W?U.flow.source:U.flow.target))continue;const Ce=W?U.flow.target:U.flow.source;if(H(Ce)||!Kr(Ce))continue;const Ne=l(U.flow.id);if(!(Ne!=null&&Ne.waypoints)||Ne.waypoints.length!==2)continue;const oe=l(Ce),ke=(I=P.get(Ce))==null?void 0:I.node.participant;if(!oe||!ke)continue;const ue=Pt(Ce,ye=>ye.x>=oe.x).filter(ye=>!R.has(ye.id));if(!(!ue.length||ue.some(ye=>H(ye.id)))){for(const ye of ue)R.add(ye.id);_.set(ke,[..._.get(ke)??[],...ue]),Y=!0}}}return[..._].map(([Y,U])=>({subtree:U,pool:f(Y)}))},kx=(_,R,M,F,H)=>Mx(new Map([[R,[..._]]]),new Set(_.map(I=>I.id)),F,I=>I===M,I=>I===H),Wf=_=>{const R=Tx(_);if(!R)return null;const M=l(_),F=l(R.flow.source),H=Vf(R,_);if(!M||!F||H===void 0)return null;const I=H-Xr(M);if(I>=Sr){const Y=P.get(_).node.participant,U=Pt(_,W=>W.x>=M.x);return{groups:kx(U,Y,_,R.flow.id,R.flow.source),dx:I}}if(-I>=Sr&&Kr(R.flow.source)){const Y=P.get(R.flow.source).node.participant,U=Pt(R.flow.source,W=>W.x>=F.x&&!CD(W.id));return{groups:kx(U,Y,R.flow.source,R.flow.id,_),dx:-I}}return null},Ox=()=>Gf.map(_=>({id:_,plan:Wf(_)})).filter(_=>!!_.plan).sort((_,R)=>Math.min(..._.plan.groups.flatMap(M=>M.subtree.map(F=>F.x)))-Math.min(...R.plan.groups.flatMap(M=>M.subtree.map(F=>F.x)))).map(_=>_.id);for(let _=0;_<3;_++){const R=Wi(),M=[];for(const H of Ox()){const I=Wf(H);if(!I)continue;const Y=zf(I.groups,I.dx);Y&&M.push(Y)}if(!M.length)break;if(!xu(R,Wi()))continue;for(const H of M.reverse())H();let F=!1;for(const H of Ox()){const I=Wf(H);I&&wu(I.groups,I.dx,()=>!0,xu)&&(F=!0)}if(!F)break}for(const _ of Gf.flatMap(R=>Ka.get(R)??[])){if(!Ye(_.flow.id))continue;const R=l(_.flow.target);if(!R)continue;const M=f(P.get(_.flow.target).node.participant),F=Pt(_.flow.target,U=>U.x>=R.x),H=R.width+O,I=tn(_.flow.id),Y=et(_.flow.id);for(let U=1;U<=ii;U++){const W=()=>tn(_.flow.id)<I&&et(_.flow.id)>=Y;if(Cx(F,M,H*U,W))break}}for(const _ of S){if(!Ye(_.flow.id))continue;const R=l(_.flow.source),M=l(_.flow.target);if(!R||!M||R.type==="bpmn:Participant"||M.type==="bpmn:Participant")continue;const F=R.x+R.width/2;if(Math.abs(F-(M.x+M.width/2))>15)continue;const[H,I]=R.y<M.y?[R.y+R.height,M.y]:[M.y+M.height,R.y],Y=[...P.values()].map(U=>l(U.node.id)).filter(U=>!!U&&U.id!==R.id&&U.id!==M.id).filter(U=>U.x<=F&&F<=U.x+U.width&&U.y+U.height>H&&U.y<I).sort((U,W)=>U.x-W.x);for(const U of Y){const W=(Hx=P.get(U.id))==null?void 0:Hx.node.participant,le=W?l(W):void 0;if(!le)continue;const Ce=[...P.values()].filter(se=>se.node.participant===W).map(se=>se.node.id),Ne=se=>se.map(we=>l(we)).filter(we=>!!we),ke=[mn(U.id,se=>{var we;return((we=P.get(se.id))==null?void 0:we.node.participant)===W}),Ne(Ce)].filter(se=>se.length),ue=U.width+O,ye=tn(_.flow.id),pt=et(_.flow.id),Ae=()=>tn(_.flow.id)<ye&&et(_.flow.id)>=pt;let ze=!1;for(const se of ke){for(let we=1;we<=ii;we++)if(Cx(se,le,ue*we,Ae)){ze=!0;break}if(ze)break}if(!Ye(_.flow.id))break}}for(const _ of S){if(!Ye(_.flow.id))continue;const R=l(_.flow.id);if(((zx=R==null?void 0:R.waypoints)==null?void 0:zx.length)!==2)continue;const M=l(_.flow.source),F=l(_.flow.target);if(!M||!F||M.type==="bpmn:Participant"||F.type==="bpmn:Participant"||!Kr(_.flow.source)||!Kr(_.flow.target)||Math.abs(Xr(M)-Xr(F))>Qn)continue;const H=Xr(M),I=R.waypoints.map(ye=>ye.y),[Y,U]=[Math.min(...I),Math.max(...I)],W=si(Et(o)).filter(ye=>ye.id!==M.id&&ye.id!==F.id&&ye.x<H&&H<ye.x+ye.width&&Y<ye.y+ye.height&&ye.y<U);if(!W.length)continue;const le=(Gx=P.get(_.flow.source))==null?void 0:Gx.node.participant,Ce=(Vx=P.get(_.flow.target))==null?void 0:Vx.node.participant;if(!le||!Ce)continue;const Ne=new Map;for(const[ye,pt,Ae]of[[_.flow.source,M,le],[_.flow.target,F,Ce]]){const ze=Ne.get(Ae)??[],se=Pt(ye,we=>we.x>=pt.x).filter(we=>!ze.some(Be=>Be.id===we.id));Ne.set(Ae,[...ze,...se])}const oe=new Set([...Ne.values()].flat().map(ye=>ye.id)),ke=Mx(Ne,oe,_.flow.id,ye=>ye===_.flow.source||ye===_.flow.target,()=>!1),ue=Math.max(...W.map(ye=>ye.x+ye.width));for(const ye of Gt){const pt=ue+ye-H;if(pt<=0)continue;if(wu(ke,pt,()=>{var ze,se;return tn(_.flow.id)===0&&((se=(ze=l(_.flow.id))==null?void 0:ze.waypoints)==null?void 0:se.length)===2},xu))break}}{const _=M=>M.y+M.height/2,R=[];for(const M of P.keys()){if(!Kr(M))continue;const F=g.filter(Y=>Y.flow.target===M);if(F.length!==1)continue;const H=l(F[0].flow.source),I=l(M);!H||!I||!P.has(H.id)||Math.abs(_(H)-_(I))>1||I.x-(H.x+H.width)<=O+1||R.push({id:M,pred:H,node:I})}R.sort((M,F)=>M.node.x-F.node.x);for(const{id:M}of R){const F=P.get(M),H=l(M),I=l(g.find(oe=>oe.flow.target===M).flow.source);if(!H||!I)continue;const Y=H.x-(I.x+I.width);if(Y<=O+1)continue;const U=f(F.node.participant),W=Pt(M,oe=>oe.x>=H.x),le=Wi(),Ce=wD(W,U,-(Y-O));if(!Ce)continue;const Ne=Wi();(Ne.bad>le.bad||Ne.crossings>=le.crossings||Ne.straight<le.straight)&&Ce()}}ln(!0);for(const _ of E){const R=_.associations??[],M=R.map(I=>I.source===_.dataStore.id?I.target:I.source).map(l).find(Boolean),F=M?p(M)??u():u(),H=M?{x:M.x+M.width/2,y:M.y+M.height+110}:{x:200,y:N+60};n.createShape({type:"bpmn:DataStoreReference",businessObject:i.create("bpmn:DataStoreReference",{id:_.dataStore.id,name:_.dataStore.name})},H,F);for(const I of R)lt(_.dataStore.id,I)}for(const _ of x){const M=f(_.association.target).type==="bpmn:DataStoreReference"?_.association.target:_.association.source;lt(M,_.association)}let Dx=0;const Eu=10,PD=(_,R)=>{for(const M of R.map(F=>p(F)).filter(F=>!!F)){const F=Eu,H=M.y,I=M.y+M.height,Y=M.x,U=M.x+M.width;if(Math.abs(_.y-H)<F){const W=H+F-_.y;_.y+=W,_.height-=W}if(Math.abs(_.y+_.height-I)<F&&(_.height=I-F-_.y),Math.abs(_.x-Y)<F){const W=Y+F-_.x;_.x+=W,_.width-=W}Math.abs(_.x+_.width-U)<F&&(_.width=U-F-_.x)}},AD=(_,R)=>{const M=Eu,F=30,H=o.filter(I=>I.type==="bpmn:Group"&&I.id!==R);for(const I of H){const Y=I.x,U=I.x+I.width,W=I.y,le=I.y+I.height,Ce=_.y<le&&W<_.y+_.height,Ne=_.x<U&&Y<_.x+_.width;if(Ce){if(Math.abs(_.x-U)<M){const oe=Math.min(U+M-_.x,F);oe>0&&_.width-oe>0&&(_.x+=oe,_.width-=oe)}if(Math.abs(_.x+_.width-Y)<M){const oe=Math.min(_.x+_.width-(Y-M),F);oe>0&&_.width-oe>0&&(_.width-=oe)}}if(Ne){if(Math.abs(_.y-le)<M){const oe=Math.min(le+M-_.y,F);oe>0&&_.height-oe>0&&(_.y+=oe,_.height-=oe)}if(Math.abs(_.y+_.height-W)<M){const oe=Math.min(_.y+_.height-(W-M),F);oe>0&&_.height-oe>0&&(_.height-=oe)}}}},Uf=(_,R)=>{const F=Math.min(..._.map(W=>W.x))-40,H=Math.min(..._.map(W=>W.y))-40,I=Math.max(..._.map(W=>W.x+W.width))+40,Y=Math.max(..._.map(W=>W.y+W.height))+40,U={x:F,y:H,width:I-F,height:Y-H};return PD(U,_),AD(U,R),U};for(const _ of C){const R=(_.group.members??[]).map(l).filter(H=>!!H);let M;R.length?M=Uf(R,_.group.id):(M={x:300+Dx*350,y:40,width:300,height:200},Dx++);const F=n.createShape({type:"bpmn:Group",businessObject:i.create("bpmn:Group",{id:_.group.id}),width:M.width,height:M.height},{x:M.x+M.width/2,y:M.y+M.height/2},u());_.group.name&&n.updateLabel(F,_.group.name),(Wx=_.group.members)!=null&&Wx.length&&L(F,"bwl:Members",{refs:_.group.members.join(" ")})}{const _=o.filter(H=>!!H.waypoints),R=new Map,M=(H,I)=>{!H||!I||(R.has(H)||R.set(H,new Set),R.get(H).add(I))};for(const H of _){const I=(Ux=H.source)==null?void 0:Ux.id,Y=(qx=H.target)==null?void 0:qx.id;M(I,Y),((Yx=H.type)!=null&&Yx.includes("DataOutputAssociation")||(Kx=H.type)!=null&&Kx.includes("DataInputAssociation")||H.type==="bpmn:Association")&&M(Y,I)}const F=o.filter(H=>H.type==="bpmn:Group");for(const H of F){const Y=(((Xx=H.businessObject.extensionElements)==null?void 0:Xx.values)??[]).find(Ae=>Ae.$type==="bwl:Members"),U=((Y==null?void 0:Y.refs)??"").split(" ").filter(Boolean);if(!U.length)continue;const W=new Set(U),le=[...U];for(;le.length;){const Ae=le.shift();for(const ze of R.get(Ae)??[])W.has(ze)||(W.add(ze),le.push(ze))}const Ce=H.x,Ne=H.x+H.width,oe=H.y,ke=H.y+H.height,ue=Ae=>g.filter(ze=>ze.flow.target===Ae).length,ye=Ae=>{var se;const ze=((se=l(Ae))==null?void 0:se.type)??"";if(ze==="bpmn:StartEvent"&&ue(Ae)===0)return!1;if(ze.endsWith("Gateway")){const we=g.filter(Be=>Be.flow.target===Ae).map(Be=>Be.flow.source);if(we.length&&we.every(Be=>{var it;return((it=l(Be))==null?void 0:it.type)==="bpmn:StartEvent"&&ue(Be)===0}))return!1}return!0},pt=o.filter(Ae=>Rr(Ae)).filter(Ae=>Ae.type!=="bpmn:Group"&&Ae.type!=="bpmn:Participant"&&Ae.type!=="bpmn:TextAnnotation"&&!W.has(Ae.id)&&Kr(Ae.id)&&ye(Ae.id)&&Ae.x<Ne&&Ae.x+Ae.width>Ce&&Ae.y<ke&&Ae.y+Ae.height>oe);if(pt.length)for(const Ae of[-1,1]){const ze=pt.filter(J=>(J.x+J.width-Ce<=Ne-J.x?-1:1)===Ae);if(!ze.length)continue;const se=[];for(const J of ze){const Ie=se.find(me=>me.some(be=>J.y<be.y+be.height&&J.y+J.height>be.y));Ie?Ie.push(J):se.push([J])}const we=new Map;for(const J of se){let Ie=Ae<0?Ce-Eu:Ne+Eu;for(const me of[...J].sort((be,Je)=>Ae<0?Je.x-be.x:be.x-Je.x)){const be=Ae<0?Math.min(me.x,Ie-me.width):Math.max(me.x,Ie);Ie=Ae<0?be-xn:be+me.width+xn,be!==me.x&&Math.sign(be-me.x)===Ae&&we.set(me.id,be-me.x)}}const Be=new Map,it=J=>Be.get(J)===J||!Be.get(J)?J:it(Be.get(J));for(const J of ze)Be.set(J.id,J.id);for(const J of S){const Ie=we.has(J.flow.source)?J.flow.source:void 0,me=we.has(J.flow.target)?J.flow.target:void 0;if(!Ie||!me)continue;const be=l(J.flow.id);((Zx=be==null?void 0:be.waypoints)==null?void 0:Zx.length)===2&&Be.set(it(Ie),it(me))}const gt=new Map;for(const J of ze){if(!we.has(J.id))continue;const Ie=it(J.id);gt.set(Ie,[...gt.get(Ie)??[],J])}const tt=[...gt.values()].sort((J,Ie)=>Ae<0?Math.min(...J.map(me=>me.x))-Math.min(...Ie.map(me=>me.x)):Math.max(...Ie.map(me=>me.x))-Math.max(...J.map(me=>me.x))),nn=[];let gn=!0;for(const J of tt){const Ie=J.map(Je=>we.get(Je.id)??0).reduce((Je,Ue)=>Math.abs(Ue)>Math.abs(Je)?Ue:Je,0),me=new Map;let be=!0;for(const Je of J){const Ue=p(Je);if(!Ue){be=!1;break}me.has(Ue.id)||me.set(Ue.id,{subtree:[],pool:Ue}),me.get(Ue.id).subtree.push(Je)}be&&wu([...me.values()],Ie,()=>!0,xu)?nn.push({shapes:J,dx:Ie}):gn=!1}if(!gn)for(const J of nn.reverse())n.moveElements(J.shapes,{x:-J.dx,y:0})}}}{const _=new Set([...C.map(R=>R.group.id),...qt(e,"group.update").map(R=>R.id)]);for(const R of o.filter(M=>M.type==="bpmn:Group")){if(_.has(R.id))continue;const F=(((Qx=R.businessObject.extensionElements)==null?void 0:Qx.values)??[]).find(U=>U.$type==="bwl:Members"),H=((F==null?void 0:F.refs)??"").split(" ").filter(Boolean).map(l).filter(U=>!!U);!H.length||!H.some(U=>{const W=d.get(U.id);return!W||W.x!==U.x||W.y!==U.y})||!H.some(U=>U.x<R.x||U.y<R.y||U.x+U.width>R.x+R.width||U.y+U.height>R.y+R.height)||n.resizeShape(R,Uf(H,R.id))}}const Lx=_=>{const R=_.waypoints;if(R!=null&&R.length){const F=R[Math.floor((R.length-1)/2)];return{x:F.x,y:F.y,width:0,height:0}}const M=_;return{x:M.x,y:M.y,width:M.width,height:M.height}};let Xa=0;const Ix=12,Nx=14,TD=15,MD=300,kD=_=>{const R=_.split(`
7
+ `),M=Math.max(...R.map(I=>ao(I,Ix))),F=Math.max(100,Math.min(MD,Math.ceil(M)+Nx)),H=R.reduce((I,Y)=>I+Math.max(1,Math.ceil((ao(Y,Ix)+Nx)/F)),0);return{width:F,height:Math.max(30,H*TD+10)}};for(const _ of w){const R=_.association,M=((Jx=_.placement)==null?void 0:Jx.anchor)??(R?R.source===_.annotation.id?R.target:R.source:void 0),F=M?l(M):void 0,H=F?Lx(F):void 0,I=kD(_.annotation.text??"");let Y;if(H&&_.placement){const[Ce,Ne]=gs[_.placement.side],oe=_.placement.offset??50;Y={x:H.x+H.width/2+Ce*(H.width/2+I.width/2+oe),y:H.y+H.height/2+Ne*(H.height/2+I.height/2+oe)}}else H?(Y={x:H.x+H.width/2+180+Xa%3*260,y:H.y-110-Xa%2*95},Xa++):(Y={x:300+Xa*260,y:60},Xa++);const U=F?p(F)??u():u(),W=U;H&&typeof W.x=="number"&&typeof W.width=="number"&&W.type==="bpmn:Participant"&&(Y=Xu(o,H,I,W,_.placement?{placement:_.placement}:{from:Y}));const le=n.createShape({type:"bpmn:TextAnnotation",width:I.width,height:I.height,businessObject:i.create("bpmn:TextAnnotation",{id:_.annotation.id,text:_.annotation.text})},Y,U);if(R){const Ce=Ne=>Ne===_.annotation.id?le:f(Ne);n.connect(Ce(R.source),Ce(R.target),R.id?{type:"bpmn:Association",businessObject:i.create("bpmn:Association",{id:R.id})}:{type:"bpmn:Association"})}_.placement&&L(le,"bwl:Placement",T(_.placement))}for(const _ of qt(e,"association.add")){const R=_.association;n.connect(f(R.source),f(R.target),R.id?{type:"bpmn:Association",businessObject:i.create("bpmn:Association",{id:R.id})}:{type:"bpmn:Association"})}for(const _ of qt(e,"node.update")){let R=f(_.id);if(_.type&&ms(_.type)!==R.type&&(R=c.replaceElement(R,{type:ms(_.type)})),_.name!==void 0&&n.updateProperties(R,{name:_.name??void 0}),_.lane){const M=f(_.lane),F=M.y+M.height/2-(R.y+R.height/2);F!==0&&n.moveElements([R],{x:0,y:F})}}for(const _ of qt(e,"sequenceFlow.update")){const R=f(_.id);if(_.source!==void 0||_.target!==void 0){const M=R,F=_.source!==void 0?f(_.source):M.source,H=_.target!==void 0?f(_.target):M.target,I=Y=>({x:Y.x+Y.width/2,y:Y.y+Y.height/2});n.reconnect(M,F,H,[I(F),I(H)])}_.name!==void 0&&n.updateProperties(R,{name:_.name??void 0}),_.condition!==void 0&&n.updateProperties(R,{name:((e0=_.condition)==null?void 0:e0.label)??void 0})}for(const _ of qt(e,"messageFlow.update"))_.name!==void 0&&n.updateProperties(f(_.id),{name:_.name??void 0});for(const _ of qt(e,"dataStore.update"))_.name!==void 0&&n.updateProperties(f(_.id),{name:_.name??void 0});for(const _ of qt(e,"annotation.update")){const R=f(_.id);if(_.text!==void 0&&n.updateProperties(R,{text:_.text}),_.placement===null)L(R,"bwl:Placement",null);else if(_.placement){const M=f(_.placement.anchor),F=Lx(M),H=p(M)??u(),I=typeof H.x=="number"&&typeof H.width=="number"&&H.type==="bpmn:Participant",[Y,U]=gs[_.placement.side],W=_.placement.offset??50,le={x:F.x+F.width/2+Y*(F.width/2+R.width/2+W),y:F.y+F.height/2+U*(F.height/2+R.height/2+W)},Ce=I?Xu(o,F,{width:R.width,height:R.height},H,{placement:_.placement,selfId:_.id}):le;n.moveElements([R],{x:Ce.x-(R.x+R.width/2),y:Ce.y-(R.y+R.height/2)}),L(R,"bwl:Placement",T(_.placement))}}for(const _ of qt(e,"group.update")){const R=f(_.id);if(_.name!==void 0&&n.updateLabel(R,_.name??""),_.members){const M=_.members.map(l).filter(F=>!!F);M.length&&n.resizeShape(R,Uf(M,_.id)),L(R,"bwl:Members",{refs:_.members.join(" ")})}}}function Zu(e){switch(e.kind){case"annotation-over-label":return[e.annotation];case"edge-crosses-shape":return[e.shape];case"shape-outside-container":return[e.shape];case"shape-overlap":return e.shapes;default:return[]}}function IE(e,t,n){var l,f;const{elementRegistry:i}=e,r=e.modeling,o=p=>Ai(p).filter(d=>!t.has(Si(d))),a=p=>{var d;return((d=i.get(p))==null?void 0:d.type)==="bpmn:TextAnnotation"},s=Et(i),c=o(s),u=[...new Set(c.flatMap(Zu))].filter(p=>n.has(p)&&a(p));if(u.length)for(const p of u){const d=i.get(p);if(!d||typeof d.x!="number"||typeof d.width!="number")continue;let h=d.parent,m;for(;h;){if(h.type==="bpmn:Participant"){m=h;break}h=h.parent}if(!m){const ge=d.x+d.width/2,Ve=d.y+d.height/2;m=i.getAll().find(q=>{if(q.type!=="bpmn:Participant")return!1;const ae=q;return typeof ae.x=="number"&&typeof ae.width=="number"&&ge>=ae.x&&ge<=ae.x+ae.width&&Ve>=ae.y&&Ve<=ae.y+ae.height})}if(!m||typeof m.x!="number"||typeof m.width!="number")continue;const S=(((l=d.businessObject.extensionElements)==null?void 0:l.values)??[]).find(ge=>ge.$type==="bwl:Placement"),E=[...d.incoming??[],...d.outgoing??[]].find(ge=>ge.type==="bpmn:Association"),x=(S!=null&&S.anchor?i.get(S.anchor):void 0)??(E?((f=E.source)==null?void 0:f.id)===p?E.target:E.source:void 0);if(!x)continue;const w=x.waypoints,C=w!=null&&w.length?{x:w[Math.floor((w.length-1)/2)].x,y:w[Math.floor((w.length-1)/2)].y,width:0,height:0}:{x:x.x,y:x.y,width:x.width,height:x.height},P={width:d.width,height:d.height},L={x:d.x+d.width/2,y:d.y+d.height/2},T=S==null?void 0:S.side,B=[];T&&T in gs&&B.push(Xu(i,C,P,m,{placement:{side:T,offset:(S==null?void 0:S.offset)??null},selfId:p}));for(const[ge,Ve]of[[-1,0],[1,0],[0,-1],[0,1]])for(let q=1;q<=LE;q++)B.push({x:L.x+ge*hh*q,y:L.y+Ve*hh*q});const k={...s,edges:s.edges.filter(ge=>ge.id!==(E==null?void 0:E.id))},O=o(k),$=O.filter(ge=>Zu(ge).includes(p)).length;if(!$)continue;let ie;for(const ge of B){const Ve=ge.x-L.x,q=ge.y-L.y;if(!Ve&&!q||ge.x-P.width/2<m.x||ge.x+P.width/2>m.x+m.width||ge.y-P.height/2<m.y||ge.y+P.height/2>m.y+m.height)continue;const ae={...k,shapes:k.shapes.map(te=>te.id===p?{...te,x:te.x+Ve,y:te.y+q}:te)},de=o(ae),re=de.filter(te=>Zu(te).includes(p)).length;if(re>=$||de.length>O.length)continue;const ve=Math.abs(Ve)+Math.abs(q);if((!ie||re<ie.mine||re===ie.mine&&(de.length<ie.all||de.length===ie.all&&ve<ie.dist))&&(ie={x:ge.x,y:ge.y,mine:re,all:de.length,dist:ve}),ie.mine===0&&ie.all<O.length)break}ie&&r.moveElements([d],{x:ie.x-L.x,y:ie.y-L.y})}}function gh(e,t,n=mh){const i=dh(e),r=fh(t,zd(i.elementRegistry)),o={edgeCrossings:{before:0,after:0,pairs:[],sameKind:0,mixedKind:0,crossPoolMessages:0}};if(r.length)return{ok:!1,issues:r,findings:[],stats:o};const a=Et(i.elementRegistry),s=new Set(Ai(a).map(Si)),c=new Set(a.edges.map(m=>m.id)),u=new Set(a.shapes.map(m=>m.id)),l=qu(a).length,f=e.get("commandStack");try{Zf(f,()=>{n(t,i),Zd(i,c),Yd(i,s),ih(i,s,c),th(i,c),AE(i,c),sh(i,s,c),ah(i,c),uh(i,u),IE(i,s,u)})}catch(m){return{ok:!1,issues:[{kind:"lower-failed",message:m instanceof Error?m.message:String(m)}],findings:[],stats:o}}const p=Et(i.elementRegistry),d=Ai(p).filter(m=>!s.has(Si(m))),h=Id(p);return{ok:!0,issues:[],findings:d,stats:{edgeCrossings:{before:l,after:h.pairs.length,pairs:h.pairs,sameKind:h.sameKind,mixedKind:h.mixedKind,crossPoolMessages:h.crossPoolMessages}}}}function NE(e){const t=e.slice(e.indexOf(":")+1);return t.charAt(0).toLowerCase()+t.slice(1)}function BE(e,t){return typeof e.get=="function"?e.get(t):e[t]}function yh(e,t){const n=BE(e,t);return typeof n=="number"&&Number.isFinite(n)?n:void 0}function vh(e,t){var i;return(((i=e.extensionElements)==null?void 0:i.values)??[]).find(r=>(r==null?void 0:r.$type)===t)}function $E(e){return typeof e=="string"&&Ru.includes(e)}function ci(e){if(typeof e=="string")return e;const t=e==null?void 0:e.id;return typeof t=="string"?t:void 0}function bh(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=[],S=new Set,E=new Set,x=q=>{q&&S.add(q)},w=q=>{S.add(q),E.add(q)},C=q=>{const ae=vh(q,"bwl:Placement");if(!ae)return;const de=typeof ae.anchor=="string"?ae.anchor:void 0;if(!de||!$E(ae.side))return;const re=typeof ae.offset=="number"?ae.offset:void 0;m.push({owner:q.id,anchor:de,side:ae.side,...re!==void 0?{offset:re}:{}})},P=q=>{const ae=vh(q,"bwl:Members"),de=typeof(ae==null?void 0:ae.refs)=="string"?ae.refs.split(/\s+/).filter(Boolean):[];de.length&&g.push({owner:q.id,refs:de})},L=q=>{var ae;for(const de of q)switch(x(de.id),de.$type){case"bpmn:TextAnnotation":w(de.id),s.push({id:de.id,text:typeof de.text=="string"?de.text:""}),C(de);break;case"bpmn:Association":d.push({id:de.id,type:de.$type,source:ci(de.sourceRef),target:ci(de.targetRef)});break;case"bpmn:Group":{w(de.id);const re=(ae=de.categoryValueRef)==null?void 0:ae.value;c.push({id:de.id,...typeof re=="string"&&re?{name:re}:{}}),P(de);break}default:u.push({id:de.id,type:de.$type,reason:"type-outside-mvp"})}},T=(q,ae)=>{const de=q.flowElements??[],re=(q.laneSets??[]).flatMap(te=>te.lanes??[]),ve=new Map;for(const te of re){x(te.id);for(const V of te.flowNodeRef??[]){const G=ci(V);G&&ve.set(G,te.id)}}for(const te of de){if(x(te.id),te.$type==="bpmn:SequenceFlow"){f.push({id:te.id,source:ci(te.sourceRef),target:ci(te.targetRef),...typeof te.name=="string"&&te.name?{name:te.name}:{}});continue}if(te.$type==="bpmn:DataStoreReference"){w(te.id),a.push({id:te.id,...te.name?{name:te.name}:{}});continue}const V=NE(te.$type);if(!qf(V)){u.push({id:te.id,type:te.$type,reason:"type-outside-mvp"});continue}w(te.id),o.push({id:te.id,type:V,...te.name?{name:te.name}:{},...ae?{participant:ae}:{},...ve.has(te.id)?{lane:ve.get(te.id)}:{}});const G=yh(te,"bwl:band");G!==void 0&&(l.bands[te.id]=G);for(const X of te.dataOutputAssociations??[])x(X.id),h.push({id:X.id,type:X.$type,source:te.id,target:ci(X.targetRef)});for(const X of te.dataInputAssociations??[])x(X.id),h.push({id:X.id,type:X.$type,source:ci((X.sourceRef??[])[0]),target:te.id})}L(q.artifacts??[])};if(n){const q=new Set;for(const ae of n.participants??[]){w(ae.id);const de=ci(ae.processRef);de&&q.add(de);const re=de?i.get(de):void 0,ve=((re==null?void 0:re.laneSets)??[]).flatMap(X=>X.lanes??[]),te=ve.map(X=>({id:X.id,...X.name?{name:X.name}:{}}));for(const X of te)w(X.id);const V=!re||(re.flowElements??[]).length===0&&ve.length===0&&(re.artifacts??[]).length===0;r.push({id:ae.id,...ae.name?{name:ae.name}:{},...V?{blackBox:!0}:{},...te.length?{lanes:te}:{}});const G=yh(ae,"bwl:poolOrder");G!==void 0&&(l.poolOrders[ae.id]=G),re&&T(re,ae.id)}for(const ae of n.messageFlows??[])x(ae.id),p.push({id:ae.id,source:ci(ae.sourceRef),target:ci(ae.targetRef),...typeof ae.name=="string"&&ae.name?{name:ae.name}:{}});L(n.artifacts??[]);for(const[ae,de]of i)!q.has(ae)&&(de.flowElements??[]).length>0&&u.push({id:ae,type:de.$type,reason:"unreachable-process"})}else for(const q of i.values())T(q);const B=[],k=[],O=[],$=[],ie=(q,ae)=>!!q&&!!ae&&E.has(q)&&E.has(ae);for(const q of f){if(!ie(q.source,q.target)){u.push({id:q.id,type:"bpmn:SequenceFlow",reason:"endpoint-outside-mvp"});continue}B.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(!ie(q.source,q.target)){u.push({id:q.id,type:"bpmn:MessageFlow",reason:"endpoint-outside-mvp"});continue}k.push({id:q.id,source:q.source,target:q.target,...q.name?{name:q.name}:{}}),E.add(q.id)}for(const q of h){if(!ie(q.source,q.target)){u.push({id:q.id??"",type:q.type,reason:"endpoint-outside-mvp"});continue}$.push({...q.id?{id:q.id}:{},source:q.source,target:q.target}),q.id&&E.add(q.id)}for(const q of d){if(!ie(q.source,q.target)){u.push({id:q.id??"",type:q.type,reason:"endpoint-outside-mvp"});continue}O.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:ae}of g){const de=ae.filter(ve=>S.has(ve)),re=ge.get(q);re&&de.length&&(re.members=de)}for(const q of m)S.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:B,...k.length?{messageFlows:k}:{},...a.length?{dataStores:a}:{},...$.length?{dataAssociations:$}:{},...s.length?{annotations:s}:{},...O.length?{associations:O}:{},...c.length?{groups:c}:{}},hints:l,omitted:u}}async function jE(e){const{definitions:t,warnings:n}=await zu(e);return{...bh(t),warnings:n}}function FE(e,t,n,i={}){return{documentId:e,baseVersion:t,ops:[...n],origin:i.origin??"agent",clientOpId:(i.mkClientOpId??(()=>crypto.randomUUID()))()}}async function _h(e,t,{currentVersion:n}){if(t.baseVersion!==n)return{status:"conflict",baseVersion:t.baseVersion,currentVersion:n};const i=gh(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 HE=Symbol("bpmn-editor");function zE(){const e=At.ref(!1),t=At.ref(!0),n=At.ref(!1);let i,r;const o=()=>{e.value=!0};function a(u,l){u.get("canvas").getContainer().style.pointerEvents=l?"":"none";const f=u.get("keyboard");l?(r&&f.bind(r),r=void 0):r||(r=f.getBinding(),f.unbind())}function s(){if(!i)throw new Error("modeler not attached — 뷰 @ready 후 attach() 필요");return i}function c(){return i==null?void 0:i.get("commandStack")}return{dirty:e,editable:t,agentBusy:n,attach(u){i&&this.detach(),i=u,i.get("eventBus").on("commandStack.changed",o),t.value||a(i,!1)},detach(){i==null||i.get("eventBus").off("commandStack.changed",o),i&&!t.value&&a(i,!0),r=void 0,i=void 0},setEditable(u){t.value=u,i&&a(i,u)},async applyAgentBatch(u,l){const f=s();n.value=!0;try{const p=await _h(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:Gu(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 pe(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}function GE(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Qu={exports:{}},xh;function VE(){if(xh)return Qu.exports;xh=1;var e=Qu.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},Qu.exports}var WE=VE(),UE=GE(WE);function ui(e){if(!(this instanceof ui))return new ui(e);e=e||[128,36,1],this._seed=e.length?UE.rack(e[0],e[1],e[2]):e}ui.prototype.next=function(e){return this._seed(e||!0)},ui.prototype.nextPrefixed=function(e,t){var n;do n=e+this.next(!0);while(this.assigned(n));return this.claim(n,t),n},ui.prototype.claim=function(e,t){this._seed.set(e,t||!0)},ui.prototype.assigned=function(e){return this._seed.get(e)||!1},ui.prototype.unclaim=function(e){delete this._seed.hats[e]},ui.prototype.clear=function(){var e=this._seed.hats,t;for(t in e)this.unclaim(t)};const $t={legend:[1,"<fieldset>","</fieldset>"],tr:[2,"<table><tbody>","</tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],_default:[0,"",""]};$t.td=$t.th=[3,"<table><tbody><tr>","</tr></tbody></table>"],$t.option=$t.optgroup=[1,'<select multiple="multiple">',"</select>"],$t.thead=$t.tbody=$t.colgroup=$t.caption=$t.tfoot=[1,"<table>","</table>"],$t.polyline=$t.ellipse=$t.polygon=$t.circle=$t.text=$t.line=$t.path=$t.rect=$t.g=[1,'<svg xmlns="http://www.w3.org/2000/svg" version="1.1">',"</svg>"];function ft(e,t=globalThis.document){var u;if(typeof e!="string")throw new TypeError("String expected");const n=/^<!--(.*?)-->$/s.exec(e);if(n)return t.createComment(n[1]);const i=(u=/<([\w:]+)/.exec(e))==null?void 0:u[1];if(!i)return t.createTextNode(e);if(e=e.trim(),i==="body"){const l=t.createElement("html");l.innerHTML=e;const{lastChild:f}=l;return f.remove(),f}let[r,o,a]=Object.hasOwn($t,i)?$t[i]:$t._default,s=t.createElement("div");for(s.innerHTML=o+e+a;r--;)s=s.lastChild;if(s.firstChild===s.lastChild){const{firstChild:l}=s;return l.remove(),l}const c=t.createDocumentFragment();return c.append(...s.childNodes),c}function qE(e,t){return t.forEach(function(n){n&&typeof n!="string"&&!Array.isArray(n)&&Object.keys(n).forEach(function(i){if(i!=="default"&&!(i in e)){var r=Object.getOwnPropertyDescriptor(n,i);Object.defineProperty(e,i,r.get?r:{enumerable:!0,get:function(){return n[i]}})}})}),Object.freeze(e)}function dn(e,...t){const n=e.style;return D(t,function(i){i&&D(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 YE=Object.prototype.toString;function mt(e){return new Xi(e)}function Xi(e){if(!e||!e.nodeType)throw new Error("A DOM element reference is required");this.el=e,this.list=e.classList}Xi.prototype.add=function(e){return this.list.add(e),this},Xi.prototype.remove=function(e){return YE.call(e)=="[object RegExp]"?this.removeMatching(e):(this.list.remove(e),this)},Xi.prototype.removeMatching=function(e){const t=this.array();for(let n=0;n<t.length;n++)e.test(t[n])&&this.remove(t[n]);return this},Xi.prototype.toggle=function(e,t){return typeof t<"u"?t!==this.list.toggle(e,t)&&this.list.toggle(e):this.list.toggle(e),this},Xi.prototype.array=function(){return Array.from(this.list)},Xi.prototype.has=Xi.prototype.contains=function(e){return this.list.contains(e)};function ys(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 KE(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var vs={},wh;function XE(){if(wh)return vs;wh=1;var e,t,n;function i(){e=window.addEventListener?"addEventListener":"attachEvent",t=window.removeEventListener?"removeEventListener":"detachEvent",n=e!=="addEventListener"?"on":""}return vs.bind=function(r,o,a,s){return e||i(),r[e](n+o,a,s||!1),a},vs.unbind=function(r,o,a,s){return t||i(),r[t](n+o,a,s||!1),a},vs}var Eh=XE(),ZE=KE(Eh),Me=qE({__proto__:null,default:ZE},[Eh]),Sh=["focus","blur"];function QE(e,t,n,i,r){return Sh.indexOf(n)!==-1&&(r=!0),Me.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 JE(e,t,n,i){return Sh.indexOf(t)!==-1&&(i=!0),Me.unbind(e,t,n,i)}var Cn={bind:QE,unbind:JE};function Ju(e,t){return e&&typeof e.matches=="function"&&e.matches(t)||!1}function ot(e,t){return t=t||document,t.querySelector(e)}function bs(e,t){return t=t||document,t.querySelectorAll(e)}function li(e){e.parentNode&&e.parentNode.removeChild(e)}function e1(e,t){if(e.ownerDocument!==t.ownerDocument)try{return t.ownerDocument.importNode(e,!0)}catch{}return e}function t1(e,t){return t.appendChild(e1(e,t))}function Oe(e,t){return t1(t,e),e}var el=2,Rh={"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":el,"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":el,"text-anchor":1,"text-decoration":1,"text-rendering":1,"unicode-bidi":1,visibility:1,"word-spacing":1,"writing-mode":1};function n1(e,t){return Rh[t]?e.style[t]:e.getAttributeNS(null,t)}function Ch(e,t,n){var i=t.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase(),r=Rh[i];r?(r===el&&typeof n=="number"&&(n=String(n)+"px"),e.style[i]=n):e.setAttributeNS(null,t,n)}function i1(e,t){var n=Object.keys(t),i,r;for(i=0,r;r=n[i];i++)Ch(e,r,t[r])}function fe(e,t,n){if(typeof t=="string")if(n!==void 0)Ch(e,t,n);else return n1(e,t);else i1(e,t);return e}const r1=Object.prototype.toString;function qe(e){return new Zi(e)}function Zi(e){if(!e||!e.nodeType)throw new Error("A DOM element reference is required");this.el=e,this.list=e.classList}Zi.prototype.add=function(e){return this.list.add(e),this},Zi.prototype.remove=function(e){return r1.call(e)=="[object RegExp]"?this.removeMatching(e):(this.list.remove(e),this)},Zi.prototype.removeMatching=function(e){const t=this.array();for(let n=0;n<t.length;n++)e.test(t[n])&&this.remove(t[n]);return this},Zi.prototype.toggle=function(e,t){return typeof t<"u"?t!==this.list.toggle(e,t)&&this.list.toggle(e):this.list.toggle(e),this},Zi.prototype.array=function(){return Array.from(this.list)},Zi.prototype.has=Zi.prototype.contains=function(e){return this.list.contains(e)};function _s(e){for(var t;t=e.firstChild;)e.removeChild(t);return e}function Ph(e){return e.cloneNode(!0)}var tl={svg:"http://www.w3.org/2000/svg"},Ah='<svg xmlns="'+tl.svg+'"';function o1(e){var t=!1;e.substring(0,4)==="<svg"?e.indexOf(tl.svg)===-1&&(e=Ah+e.substring(4)):(e=Ah+">"+e+"</svg>",t=!0);var n=a1(e);if(!t)return n;for(var i=document.createDocumentFragment(),r=n.firstChild;r.firstChild;)i.appendChild(r.firstChild);return i}function a1(e){var t;return t=new DOMParser,t.async=!1,t.parseFromString(e,"text/xml")}function _e(e,t){var n;return e=e.trim(),e.charAt(0)==="<"?(n=o1(e).firstChild,n=document.importNode(n,!0)):n=document.createElementNS(tl.svg,e),t&&fe(n,t),n}var nl=null;function Th(){return nl===null&&(nl=_e("svg")),nl}function Mh(e,t){var n,i,r=Object.keys(t);for(n=0;i=r[n];n++)e[i]=t[i];return e}function s1(e,t,n,i,r,o){var a=Th().createSVGMatrix();switch(arguments.length){case 0:return a;case 1:return Mh(a,e);case 6:return Mh(a,{a:e,b:t,c:n,d:i,e:r,f:o})}}function Yo(e){return Th().createSVGTransform()}var kh=/([&<>]{1})/g,c1=/([&<>\n\r"]{1})/g,u1={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"'"};function il(e,t){function n(i,r){return u1[r]||r}return e.replace(t,n)}function Oh(e,t){var n,i,r,o,a;switch(e.nodeType){case 3:t.push(il(e.textContent,kh));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,'="',il(o.value,c1),'"');if(e.hasChildNodes()){for(t.push(">"),a=e.childNodes,n=0,i=a.length;n<i;++n)Oh(a.item(n),t);t.push("</",e.tagName,">")}else t.push("/>");break;case 8:t.push("<!--",il(e.nodeValue,kh),"-->");break;case 4:t.push("<![CDATA[",e.nodeValue,"]]>");break;default:throw new Error("unable to handle node "+e.nodeType)}return t}function l1(e){for(var t=e.firstChild,n=[];t;)Oh(t,n),t=t.nextSibling;return n.join("")}function Dh(e,t){return l1(e)}function jt(e){var t=e.parentNode;return t&&t.removeChild(e),e}function p1(e,t){return t instanceof SVGMatrix?e.createSVGTransformFromMatrix(t):t}function f1(e,t){var n,i;for(e.clear(),n=0;i=t[n];n++)e.appendItem(p1(e,i))}function Ko(e,t){var n=e.transform.baseVal;return t&&(Array.isArray(t)||(t=[t]),f1(n,t)),n.consolidate()}const d1=/^class[ {]/;function h1(e){return d1.test(e.toString())}function rl(e){return Array.isArray(e)}function ol(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function xs(...e){e.length===1&&rl(e[0])&&(e=e[0]),e=[...e];const t=e.pop();return t.$inject=e,t}const m1=/constructor\s*[^(]*\(\s*([^)]*)\)/m,g1=/^(?:async\s+)?(?:function\s*[^(]*)?(?:\(\s*([^)]*)\)|(\w+))/m,y1=/\/\*([^*]*)\*\//m;function v1(e){if(typeof e!="function")throw new Error(`Cannot annotate "${e}". Expected a function!`);const t=e.toString().match(h1(e)?m1:g1);if(!t)return[];const n=t[1]||t[2];return n&&n.split(",").map(i=>{const r=i.match(y1);return(r&&r[1]||i).trim()})||[]}function Lh(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 C=x.split(".");let P=c(C.shift());for(;C.length;)P=P[C.shift()];return P}if(ol(o,x))return o[x];if(ol(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(rl(x))x=xs(x.slice());else throw s(`Cannot invoke "${x}". Expected a function!`);const P=(x.$inject||v1(x)).map(L=>ol(w,L)?w[L]:c(L));return{fn:x,dependencies:P}}function l(x){const{fn:w,dependencies:C}=u(x),P=Function.prototype.bind.call(w,null,...C);return new P}function f(x,w,C){const{fn:P,dependencies:L}=u(x,C);return P.apply(w,L)}function p(x){return xs(w=>x.get(w))}function d(x,w){if(w&&w.length){const C=Object.create(null),P=Object.create(null),L=[],T=[],B=[];let k,O,$,ie;for(let ge in r)k=r[ge],w.indexOf(ge)!==-1&&(k[2]==="private"?(O=L.indexOf(k[3]),O===-1?($=k[3].createChild([],w),ie=p($),L.push(k[3]),T.push($),B.push(ie),C[ge]=[ie,ge,"private",$]):C[ge]=[B[O],ge,"private",T[O]]):C[ge]=[k[2],k[1]],P[ge]=!0),(k[2]==="factory"||k[2]==="type")&&k[1].$scope&&w.forEach(Ve=>{k[1].$scope.indexOf(Ve)!==-1&&(C[ge]=[k[2],k[1]],P[Ve]=!0)});w.forEach(ge=>{if(!P[ge])throw new Error('No provider for "'+ge+'". Cannot use provider from the parent!')}),x.unshift(C)}return new Lh(x,a)}const h={factory:f,type:l,value:function(x){return x}};function m(x,w){const C=x.__init__||[];return function(){C.forEach(P=>{typeof P=="string"?w.get(P):w.invoke(P)})}}function g(x){const w=x.__exports__;if(w){const C=x.__modules__,P=Object.keys(x).reduce((O,$)=>($!=="__exports__"&&$!=="__modules__"&&$!=="__init__"&&$!=="__depends__"&&(O[$]=x[$]),O),Object.create(null)),L=(C||[]).concat(P),T=d(L),B=xs(function(O){return T.get(O)});w.forEach(function(O){r[O]=[B,O,"private",T]});const k=(x.__init__||[]).slice();return k.unshift(function(){T.init()}),x=Object.assign({},x,{__init__:k}),m(x,T)}return Object.keys(x).forEach(function(C){if(C==="__init__"||C==="__depends__")return;const P=x[C];if(P[2]==="private"){r[C]=P;return}const L=P[0],T=P[1];r[C]=[h[L],b1(L,T),L]}),m(x,a)}function S(x,w){return x.indexOf(w)!==-1||(x=(w.__depends__||[]).reduce(S,x),x.indexOf(w)!==-1)?x:x.concat(w)}function E(x){const w=x.reduce(S,[]).map(g);let C=!1;return function(){C||(C=!0,w.forEach(P=>P()))}}this.get=c,this.invoke=f,this.instantiate=l,this.createChild=d,this.init=E(e)}function b1(e,t){return e!=="value"&&rl(t)&&(t=xs(t.slice())),t}var _1=1e3;function Ti(e,t){var n=this;t=t||_1,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 x1(e){return["M",e.x,e.y]}function al(e){return["L",e.x,e.y]}function w1(e,t,n){return["C",e.x,e.y,t.x,t.y,n.x,n.y]}function E1(e,t){const n=e.length,i=[x1(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(al(a));continue}const c=Math.min(t,sl(a.x-o.x,a.y-o.y),sl(s.x-a.x,s.y-a.y));if(!c){i.push(al(a));continue}const u=ws(a,o,c),l=ws(a,o,c*.5),f=ws(a,s,c),p=ws(a,s,c*.5);i.push(al(u)),i.push(w1(l,p,f))}return i}function ws(e,t,n){const i=t.x-e.x,r=t.y-e.y,o=sl(i,r),a=n/o;return{x:e.x+i*a,y:e.y+r*a}}function sl(e,t){return Math.sqrt(Math.pow(e,2)+Math.pow(t,2))}function Xo(e,t,n){Pe(t)&&(n=t,t=null),t||(t={});const i=_e("path",t);return Pe(n)&&(i.dataset.cornerRadius=String(n)),cl(i,e)}function cl(e,t){const n=parseInt(e.dataset.cornerRadius,10)||0;return fe(e,{d:Dr(E1(t,n))}),e}function Es(e){var t=new Set(e);return He(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,Ee(e)||(e=[e]),D(e,function(i,r){var o=t(i,r,n);Ee(o)&&o.length&&Lr(o,t,n+1)})}function ul(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 Zo(e,t){return ul(e)}function S1(e,t,n){Cr(t)&&(t=!0),Vt(t)&&(n=t,t=!0),n=n||{};var i=Qo(n.allShapes),r=Qo(n.allConnections),o=Qo(n.enclosedElements),a=Qo(n.enclosedConnections),s=Qo(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,D(l.incoming,c),D(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,Ee(e)||(e=[e]);var n,i,r,o;return D(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 D(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 Ih(e){return"waypoints"in e?"connection":"x"in e?"shape":"root"}function Nh(e){return!!(e&&e.isFrame)}function Qo(e,t){return j({},e||{},t||{})}var R1=1;function Qi(e,t){Ti.call(this,e,R1),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})}pe(Qi,Ti),Qi.prototype.canRender=function(){return!0},Qi.prototype.drawShape=function(t,n,i){var r=_e("rect");return fe(r,{x:0,y:0,width:n.width||0,height:n.height||0}),Nh(n)?fe(r,j({},this.FRAME_STYLE,i||{})):fe(r,j({},this.SHAPE_STYLE,i||{})),Oe(t,r),r},Qi.prototype.drawConnection=function(t,n,i){var r=Xo(n.waypoints,j({},this.CONNECTION_STYLE,i||{}));return Oe(t,r),r},Qi.prototype.getShapePath=function(t){var n=t.x,i=t.y,r=t.width,o=t.height,a=[["M",n,i],["l",r,0],["l",0,o],["l",-r,0],["z"]];return Dr(a)},Qi.prototype.getConnectionPath=function(t){var n=t.waypoints,i,r,o=[];for(i=0;r=n[i];i++)r=r.original||r,o.push([i===0?"M":"L",r.x,r.y]);return Dr(o)},Qi.$inject=["eventBus","styles"];function C1(){var e={"no-fill":{fill:"none"},"no-border":{strokeOpacity:0},"no-events":{pointerEvents:"none"}},t=this;this.cls=function(n,i,r){var o=this.style(i,r);return j(o,{class:n})},this.style=function(n,i){!Ee(n)&&!i&&(i=n,n=[]);var r=Sn(n,function(o,a){return j(o,e[a]||{})},{});return i?j(r,i):r},this.computeStyle=function(n,i,r){return Ee(i)||(r=i,i=[]),t.style(i||[],j({},r,n||{}))}}const P1={__init__:["defaultRenderer"],defaultRenderer:["type",Qi],styles:["type",C1]};function wt(e,t){if(!e||!t)return-1;var n=e.indexOf(t);return n!==-1&&e.splice(n,1),n}function St(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 ll(e,t){return!e||!t?-1:e.indexOf(t)}function Jo(e,t){return!e||!t?-1:Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function pl(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=Jo(e,t);return Math.abs(r/o)<=i}var A1=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(T1(r,n))return o;return!1}function T1(e,t){const n=t[0];return Pr(t,function(i){return Math.abs(n[e]-i[e])<=A1})}function Bh(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 fl(e,t){return{x:Math.round(e.x+(t.x-e.x)/2),y:Math.round(e.y+(t.y-e.y)/2)}}var M1=/,?([a-z]),?/gi,$h=parseFloat,kt=Math,Ji=kt.PI,pi=kt.min,fi=kt.max,jh=kt.pow,er=kt.abs,k1=/([a-z])[\s,]*((-?\d*\.?\d*(?:e[-+]?\d+)?[\s]*,?[\s]*)+)/ig,O1=/(-?\d*\.?\d*(?:e[-+]?\d+)?)[\s]*,?[\s]*/ig,Fh=Array.isArray||function(e){return e instanceof Array};function D1(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function L1(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 I1(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 D1(r,i)?(L1(o,i),r[i]):(o.length>=1e3&&delete r[o.shift()],o.push(i),r[i]=e(...arguments),r[i])}return t}function N1(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(k1,function(i,r,o){var a=[],s=r.toLowerCase();for(o.replace(O1,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=hl,n}function B1(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 $1(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 dl(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 hl(){return this.join(",").replace(M1,"$1")}function j1(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=hl,t}function Hh(e,t,n,i,r,o,a,s,c){var u=1-c,l=jh(u,3),f=jh(u,2),p=c*c,d=p*c,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:Ss(h),y:Ss(m)}}function zh(e){var t=W1(...e);return dl(t.x0,t.y0,t.x1-t.x0,t.y1-t.y0)}function tr(e,t,n){return t>=e.x&&t<=e.x+e.width&&n>=e.y&&n<=e.y+e.height}function F1(e,t){return e=dl(e),t=dl(t),tr(t,e.x,e.y)||tr(t,e.x2,e.y)||tr(t,e.x,e.y2)||tr(t,e.x2,e.y2)||tr(e,t.x,t.y)||tr(e,t.x2,t.y)||tr(e,t.x,t.y2)||tr(e,t.x2,t.y2)||(e.x<t.x2&&e.x>t.x||t.x<e.x2&&t.x>e.x)&&(e.y<t.y2&&e.y>t.y||t.y<e.y2&&t.y>e.y)}function Gh(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 Vh(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=Gh(m,e,n,r,a),S=Gh(m,t,i,o,s),E=g*g+S*S;d+=p[h]*kt.sqrt(E)}return u*d}function H1(e,t,n,i,r,o,a,s){if(!(fi(e,n)<pi(r,a)||pi(e,n)>fi(r,a)||fi(t,i)<pi(o,s)||pi(t,i)>fi(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=Ss(c/l),p=Ss(u/l),d=+f.toFixed(2),h=+p.toFixed(2);if(!(d<+pi(e,n).toFixed(2)||d>+fi(e,n).toFixed(2)||d<+pi(r,a).toFixed(2)||d>+fi(r,a).toFixed(2)||h<+pi(t,i).toFixed(2)||h>+fi(t,i).toFixed(2)||h<+pi(o,s).toFixed(2)||h>+fi(o,s).toFixed(2)))return{x:f,y:p}}}}function Ss(e){return Math.round(e*1e11)/1e11}function z1(e,t,n){var i=zh(e),r=zh(t);if(!F1(i,r))return[];var o=Vh(...e),a=Vh(...t),s=Uh(e)?1:~~(o/5)||1,c=Uh(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=Hh(...e,d/s);u[d]={x:m.x,y:m.y,t:d/s}}for(d=0;d<c+1;d++)m=Hh(...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],S=u[d+1],E=l[h],x=l[h+1],w=er(S.x-g.x)<.01?"y":"x",C=er(x.x-E.x)<.01?"y":"x",P=H1(g.x,g.y,S.x,S.y,E.x,E.y,x.x,x.y),L;if(P){if(L=P.x.toFixed(9)+"#"+P.y.toFixed(9),f[L])continue;f[L]=!0;var T=g.t+er((P[w]-g[w])/(S[w]-g[w]))*(S.t-g.t),B=E.t+er((P[C]-E[C])/(x[C]-E[C]))*(x.t-E.t);T>=0&&T<=1&&B>=0&&B<=1&&p.push({x:P.x,y:P.y,t1:T,t2:B})}}return p}function Wh(e,t,n){e=Kh(e),t=Kh(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 S=0,E=t.length;S<E;S++){var x=t[S];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=z1(f,p);{for(var C=0,P=w.length;C<P;C++)w[C].segment1=h,w[C].segment2=S,w[C].bez1=f,w[C].bez2=p;d=d.concat(w)}}}}}return d}function G1(e){return Fh(e)&&Fh(e[0])}function V1(e){if(B1(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=hl,t}function Uh(e){return e[0]===e[2]&&e[1]===e[3]&&e[4]===e[6]&&e[5]===e[7]}function Rs(e,t,n,i){return[e,t,n,i,n,i]}function qh(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 Yh(e,t,n,i,r,o,a,s,c,u){var l=Ji*120/180,f=Ji/180*(+r||0),p=[],d,h=I1(function(A,b,y){var N=A*kt.cos(y)-b*kt.sin(y),z=A*kt.sin(y)+b*kt.cos(y);return{x:N,y:z}});if(u)L=u[0],T=u[1],C=u[2],P=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,S=m*m/(n*n)+g*g/(i*i);S>1&&(S=kt.sqrt(S),n=S*n,i=S*i);var E=n*n,x=i*i,w=(o==a?-1:1)*kt.sqrt(er((E*x-E*g*g-x*m*m)/(E*g*g+x*m*m))),C=w*n*g/i+(e+s)/2,P=w*-i*m/n+(t+c)/2,L=kt.asin(((t-P)/i).toFixed(9)),T=kt.asin(((c-P)/i).toFixed(9));L=e<C?Ji-L:L,T=s<C?Ji-T:T,L<0&&(L=Ji*2+L),T<0&&(T=Ji*2+T),a&&L>T&&(L=L-Ji*2),!a&&T>L&&(T=T-Ji*2)}var B=T-L;if(er(B)>l){var k=T,O=s,$=c;T=L+l*(a&&T>L?1:-1),s=C+n*kt.cos(T),c=P+i*kt.sin(T),p=Yh(s,c,n,i,r,0,a,O,$,[T,k,C,P])}B=T-L;var ie=kt.cos(L),ge=kt.sin(L),Ve=kt.cos(T),q=kt.sin(T),ae=kt.tan(B/4),de=4/3*n*ae,re=4/3*i*ae,ve=[e,t],te=[e+de*ge,t-re*ie],V=[s+de*q,c-re*Ve],G=[s,c];if(te[0]=2*ve[0]-te[0],te[1]=2*ve[1]-te[1],u)return[te,V,G].concat(p);p=[te,V,G].concat(p).join().split(",");for(var X=[],je=0,Rt=p.length;je<Rt;je++)X[je]=je%2?h(p[je-1],p[je],f).y:h(p[je],p[je+1],f).x;return X}function W1(e,t,n,i,r,o,a,s){for(var c=[],u=[[],[]],l,f,p,d,h,m,g,S,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),er(l)<1e-12){if(er(f)<1e-12)continue;d=-p/f,0<d&&d<1&&c.push(d);continue}g=f*f-4*p*l,S=kt.sqrt(g),!(g<0)&&(h=(-f+S)/(2*l),0<h&&h<1&&c.push(h),m=(-f-S)/(2*l),0<m&&m<1&&c.push(m))}for(var x=c.length,w=x,C;x--;)d=c[x],C=1-d,u[0][x]=C*C*C*e+3*C*C*d*n+3*C*d*d*r+d*d*d*a,u[1][x]=C*C*C*t+3*C*C*d*i+3*C*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:pi(...u[0]),y0:pi(...u[1]),x1:fi(...u[0]),y1:fi(...u[1])}}function Kh(e){if(G1(e)||(e=N1(e)),$1(e))return e;for(var t=j1(V1(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",...Yh(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",...qh(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",...qh(d.x,d.y,p[1],p[2],p[3],p[4])];break;case"L":p=["C",...Rs(d.x,d.y,p[1],p[2])];break;case"H":p=["C",...Rs(d.x,d.y,p[1],d.y)];break;case"V":p=["C",...Rs(d.x,d.y,d.x,p[1])];break;case"Z":p=["C",...Rs(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=$h(l[f-4])||n.x,n.by=$h(l[f-3])||n.y}return t}function at(e){return Vt(e)&&En(e,"waypoints")}function $e(e){return Vt(e)&&En(e,"labelTarget")}function U1(e){return Vt(e)&&Jr(e.parent)}function Xh(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 xe(e){return{top:e.y,right:e.x+(e.width||0),bottom:e.y+(e.height||0),left:e.x}}function Cs(e){return{x:e.left,y:e.top,width:e.right-e.left,height:e.bottom-e.top}}function q1(e){return ki({x:e.x+(e.width||0)/2,y:e.y+(e.height||0)/2})}function Y1(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=Z1(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 Se(e){return at(e)?Y1(e):q1(e)}function Zt(e,t,n){n=n||0,Vt(n)||(n={x:n,y:n});var i=xe(e),r=xe(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 ea(e,t,n){var i=K1(e,t);return i.length===1||i.length===2&&Jo(i[0],i[1])<1?ki(i[0]):i.length>1?(i=ri(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 K1(e,t){return Wh(e,t)}function X1(e){e=e.slice();for(var t=0,n,i,r;e[t];)n=e[t],i=e[t-1],r=e[t+1],Jo(n,r)===0||pl(i,r,n)?e.splice(t,1):t++;return e}function Z1(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function Ps(e,t){return Math.round(e*t)/t}function Zh(e){return Pe(e)?e+"px":e}function Q1(e){for(;e.parent;)e=e.parent;return e}function J1(e){e=j({},{width:"100%",height:"100%"},e);const t=e.container||document.body,n=document.createElement("div");return n.setAttribute("class","djs-container djs-parent"),dn(n,{position:"relative",overflow:"hidden",width:Zh(e.width),height:Zh(e.height)}),t.appendChild(n),n}function Qh(e,t,n){const i=_e("g");qe(i).add(t);const r=n!==void 0?n:e.childNodes.length-1;return e.insertBefore(i,e.childNodes[r]||null),i}const eS="base",Jh=0,tS=1,nS={shape:["x","y","width","height"],connection:["waypoints"]};function Re(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||{})}Re.$inject=["config.canvas","eventBus","graphicsFactory","elementRegistry"],Re.prototype._init=function(e){const t=this._eventBus,n=this._container=J1(e),i=this._svg=_e("svg");fe(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")}),Oe(n,i);const r=this._viewport=Qh(i,"viewport");e.deferUpdate&&(this._viewboxChanged=Tu(this._viewboxChanged,300)),this._restoreFocus=Tu(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)},Re.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},Re.prototype._setFocused=function(e){e!=this._focused&&(this._focused=e,this._eventBus.fire("canvas.focus.changed",{focused:e}))},Re.prototype._clear=function(){this._elementRegistry.getAll().forEach(t=>{const n=Ih(t);n==="root"?this.removeRootElement(t):this._removeElement(t,n)}),this._planes=[],this._rootElement=null,delete this._cachedViewbox},Re.prototype.focus=function(){this._svg.focus({preventScroll:!0}),this._setFocused(!0)},Re.prototype.restoreFocus=function(){this._restoreFocus()},Re.prototype._restoreFocus=function(){document.activeElement===document.body&&this.focus()},Re.prototype.isFocused=function(){return this._focused},Re.prototype.getDefaultLayer=function(){return this.getLayer(eS,Jh)},Re.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},Re.prototype._getChildIndex=function(e){return Sn(this._layers,function(t,n){return n.visible&&e>=n.index&&t++,t},0)},Re.prototype._createLayer=function(e,t){typeof t>"u"&&(t=tS);const n=this._getChildIndex(t);return{group:Qh(this._viewport,"layer-"+e,n),index:t,visible:!0}},Re.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},Re.prototype.hideLayer=function(e){if(!e)throw new Error("must specify a name");const t=this._layers[e];if(!t)throw new Error("layer <"+e+"> does not exist");const n=t.group;return t.visible&&(jt(n),t.visible=!1),n},Re.prototype._removeLayer=function(e){const t=this._layers[e];t&&(delete this._layers[e],jt(t.group))},Re.prototype.getActiveLayer=function(){const e=this._findPlaneForRoot(this.getRootElement());return e?e.layer:null},Re.prototype.findRoot=function(e){const t=this._resolveElements(e);let n;for(const i of t){const r=this._findPlaneForRoot(Q1(i));if(!r||n&&r.rootElement!==n)return;n=r.rootElement}return n},Re.prototype.getRootElements=function(){return this._planes.map(function(e){return e.rootElement})},Re.prototype._findPlaneForRoot=function(e){return ut(this._planes,function(t){return t.rootElement===e})},Re.prototype._resolveElement=function(e){return typeof e=="string"?this._elementRegistry.get(e):e},Re.prototype._resolveElements=function(e){return Ee(e)||(e=[e]),e.map(t=>this._resolveElement(t)).filter(Boolean)},Re.prototype.getContainer=function(){return this._container},Re.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&&(D([i.gfx,i.secondaryGfx],function(r){r&&(n?(e.markers.add(t),qe(r).add(t)):(e.markers.delete(t),qe(r).remove(t)))}),this._eventBus.fire("element.marker.update",{element:e,gfx:i.gfx,marker:t,add:!!n}))},Re.prototype.addMarker=function(e,t){this._updateMarker(e,t,!0)},Re.prototype.removeMarker=function(e,t){this._updateMarker(e,t,!1)},Re.prototype.hasMarker=function(e,t){return e=this._resolveElement(e),e.markers?e.markers.has(t):!1},Re.prototype.toggleMarker=function(e,t){this.hasMarker(e,t)?this.removeMarker(e,t):this.addMarker(e,t)},Re.prototype.getRootElement=function(){const e=this._rootElement;return e||this._planes.length?e:this.setRootElement(this.addRootElement(null))},Re.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,Jh);return this.hideLayer(n),this._addRoot(e,i),this._planes.push({rootElement:e,layer:i}),e},Re.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},Re.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},Re.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)},Re.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})},Re.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})},Re.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=nS[e];if(!Pr(n,function(r){return typeof t[r]<"u"}))throw new Error("must supply { "+n.join(", ")+" } with "+e)},Re.prototype._setParent=function(e,t,n){St(t.children,e,n),e.parent=t},Re.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},Re.prototype.addShape=function(e,t,n){return this._addElement("shape",e,t,n)},Re.prototype.addConnection=function(e,t,n){return this._addElement("connection",e,t,n)},Re.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),wt(e.parent&&e.parent.children,e),e.parent=null,r.fire(t+".removed",{element:e}),n.remove(e),e},Re.prototype.removeShape=function(e){return this._removeElement(e,"shape")},Re.prototype.removeConnection=function(e){return this._removeElement(e,"connection")},Re.prototype.getGraphics=function(e,t){return this._elementRegistry.getGraphics(e,t)},Re.prototype._changeViewbox=function(e){this._eventBus.fire("canvas.viewbox.changing"),e.apply(this),this._cachedViewbox=null,this._viewboxChanged()},Re.prototype._viewboxChanged=function(){this._eventBus.fire("canvas.viewbox.changed",{viewbox:this.viewbox()})},Re.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);Ko(t,l)});else return o=this._rootElement?this.getActiveLayer():null,i=o&&o.getBBox()||{},a=Ko(t),r=a?a.matrix:s1(),s=Ps(r.a,1e3),c=Ps(-r.e||0,1e3),u=Ps(-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},Re.prototype.scroll=function(e){const t=this._viewport;let n=t.getCTM();return e&&this._changeViewbox(function(){e=j({dx:0,dy:0},e||{}),n=this._svg.createSVGMatrix().translate(e.dx,e.dy).multiply(n),em(t,n)}),{x:n.e,y:n.f}},Re.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=xe(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=xe(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),S=Math.min(0,s.top-p.top);l=h||m,f=g||S}this.scroll({dx:-l*u,dy:-f*u})},Re.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)}),Ps(i.a,1e3)};function em(e,t){const n="matrix("+t.a+","+t.b+","+t.c+","+t.d+","+t.e+","+t.f+")";e.setAttribute("transform",n)}Re.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},Re.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=j(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),em(this._viewport,l),l},Re.prototype.getSize=function(){return{width:this._container.clientWidth,height:this._container.clientHeight}},Re.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}},Re.prototype.resized=function(){delete this._cachedViewbox,this._eventBus.fire("canvas.resized")};var lo="data-element-id";function In(e){this._elements={},this._eventBus=e}In.$inject=["eventBus"],In.prototype.add=function(e,t,n){var i=e.id;this._validateId(i),fe(t,lo,i),n&&fe(n,lo,i),this._elements[i]={element:e,gfx:t,secondaryGfx:n}},In.prototype.remove=function(e){var t=this._elements,n=e.id||e,i=n&&t[n];i&&(fe(i.gfx,lo,""),i.secondaryGfx&&fe(i.secondaryGfx,lo,""),delete t[n])},In.prototype.updateId=function(e,t){this._validateId(t),typeof e=="string"&&(e=this.get(e)),this._eventBus.fire("element.updateId",{element:e,newId:t});var n=this.getGraphics(e),i=this.getGraphics(e,!0);this.remove(e),e.id=t,this.add(e,n,i)},In.prototype.updateGraphics=function(e,t,n){var i=e.id||e,r=this._elements[i];return n?r.secondaryGfx=t:r.gfx=t,t&&fe(t,lo,i),t},In.prototype.get=function(e){var t;typeof e=="string"?t=e:t=e&&fe(e,lo);var n=this._elements[t];return n&&n.element},In.prototype.filter=function(e){var t=[];return this.forEach(function(n,i){e(n,i)&&t.push(n)}),t},In.prototype.find=function(e){for(var t=this._elements,n=Object.keys(t),i=0;i<n.length;i++){var r=n[i],o=t[r],a=o.element,s=o.gfx;if(e(a,s))return a}},In.prototype.getAll=function(){return this.filter(function(e){return e})},In.prototype.forEach=function(e){var t=this._elements;Object.keys(t).forEach(function(n){var i=t[n],r=i.element,o=i.gfx;return e(r,o)})},In.prototype.getGraphics=function(e,t){var n=e.id||e,i=this._elements[n];return i&&(t?i.secondaryGfx:i.gfx)},In.prototype._validateId=function(e){if(!e)throw new Error("element must have an id");if(this._elements[e])throw new Error("element with id "+e+" already added")};function iS(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 rS(e){return e.__refs_collection===!0}function oS(e,t){return Object.prototype.hasOwnProperty.call(e,t.name||t)}function tm(e,t,n){var i=iS(n[t.name]||[],e,t,n);Object.defineProperty(n,t.name,{enumerable:t.enumerable,value:i}),i.length&&i.forEach(function(r){e.set(r,t.inverse,n)})}function aS(e,t,n){var i=t.inverse,r=n[t.name];Object.defineProperty(n,t.name,{configurable:t.configurable,enumerable:t.enumerable,get:function(){return r},set:function(o){if(o!==r){var a=r;r=null,a&&e.unset(a,i,n),r=o,e.set(r,i,n)}}})}function Fn(e,t){if(!(this instanceof Fn))return new Fn(e,t);e.inverse=t,t.inverse=e,this.props={},this.props[e.name]=e,this.props[t.name]=t}Fn.prototype.bind=function(e,t){if(typeof t=="string"){if(!this.props[t])throw new Error("no property <"+t+"> in ref");t=this.props[t]}t.collection?tm(this,t,e):aS(this,t,e)},Fn.prototype.ensureRefsCollection=function(e,t){var n=e[t.name];return rS(n)||tm(this,t,e),n},Fn.prototype.ensureBound=function(e,t){oS(e,t)||this.bind(e,t)},Fn.prototype.unset=function(e,t,n){e&&(this.ensureBound(e,t),t.collection?this.ensureRefsCollection(e,t).remove(n):e[t.name]=void 0)},Fn.prototype.set=function(e,t,n){e&&(this.ensureBound(e,t),t.collection?this.ensureRefsCollection(e,t).add(n):e[t.name]=n)};var ml=new Fn({name:"children",enumerable:!0,collection:!0},{name:"parent"}),nm=new Fn({name:"labels",enumerable:!0,collection:!0},{name:"labelTarget"}),im=new Fn({name:"attachers",collection:!0},{name:"host"}),rm=new Fn({name:"outgoing",collection:!0},{name:"source"}),om=new Fn({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)}}),ml.bind(this,"parent"),nm.bind(this,"labels"),rm.bind(this,"outgoing"),om.bind(this,"incoming")}function ta(){po.call(this),ml.bind(this,"children"),im.bind(this,"host"),im.bind(this,"attachers")}pe(ta,po);function am(){po.call(this),ml.bind(this,"children")}pe(am,ta);function sm(){ta.call(this),nm.bind(this,"labelTarget")}pe(sm,ta);function cm(){po.call(this),rm.bind(this,"source"),om.bind(this,"target")}pe(cm,po);var sS={connection:cm,shape:ta,label:sm,root:am};function cS(e,t){var n=sS[e];if(!n)throw new Error("unknown type: <"+e+">");return j(new n,t)}function uS(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=j({},t||{}),t.id||(t.id=e+"_"+this._uid++),cS(e,t)};var As="__fn",um=1e3,lS=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=Ee(e)?e:[e],Wt(t)&&(i=n,n=t,t=um),!Pe(t))throw new Error("priority must be a number");var r=n;i&&(r=vn(n,i),r[As]=n[As]||n);var o=this;e.forEach(function(a){o._addListener(a,{priority:t,callback:r,next:null})})},Pn.prototype.once=function(e,t,n,i){var r=this;if(Wt(t)&&(i=n,n=t,t=um),!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[As]=n,this.on(e,t,o)},Pn.prototype.off=function(e,t){e=Ee(e)?e:[e];var n=this;e.forEach(function(i){n._removeListener(i,t)})},Pn.prototype.createEvent=function(e){var t=new na;return t.init(e),t},Pn.prototype.fire=function(e,t){var n,i,r,o;if(o=lS.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 na?n=t:n=this.createEvent(t),o[0]=n;var a=n.type;e!==a&&(n.type=e);try{r=this._invokeListeners(n,o,i)}finally{e!==a&&(n.type=a)}return r===void 0&&n.defaultPrevented&&(r=!1),r}},Pn.prototype.handleError=function(e){return this.fire("error",{error:e})===!1},Pn.prototype._destroy=function(){this._listeners={}},Pn.prototype._invokeListeners=function(e,t,n){for(var i;n&&!e.cancelBubble;)i=this._invokeListener(e,t,n),n=n.next;return i},Pn.prototype._invokeListener=function(e,t,n){var i;if(n.callback.__isTomb)return i;try{i=pS(n.callback,t),i!==void 0&&(e.returnValue=i,e.stopPropagation()),i===!1&&e.preventDefault()}catch(r){if(!this.handleError(r))throw console.error("unhandled error in event listener",r),r}return i},Pn.prototype._addListener=function(e,t){var n=this._getListeners(e),i;if(!n){this._setListeners(e,t);return}for(;n;){if(n.priority<t.priority){t.next=n,i?i.next=t:this._setListeners(e,t);return}i=n,n=n.next}i.next=t},Pn.prototype._getListeners=function(e){return this._listeners[e]},Pn.prototype._setListeners=function(e,t){this._listeners[e]=t},Pn.prototype._removeListener=function(e,t){var n=this._getListeners(e),i,r,o;if(!t){this._setListeners(e,null);return}for(;n;)i=n.next,o=n.callback,(o===t||o[As]===t)&&(r?r.next=i:this._setListeners(e,i)),r=n,n=i};function na(){}na.prototype.stopPropagation=function(){this.cancelBubble=!0},na.prototype.preventDefault=function(){this.defaultPrevented=!0},na.prototype.init=function(e){j(this,e||{})};function pS(e,t){return e.apply(null,t)}function Ir(e){return e.childNodes[0]}function fS(e){return e.parentNode.childNodes[1]}function Ts(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),Ko(e,[o,a,s])}function Qt(e,t,n){var i=Yo();i.setTranslate(t,n),Ko(e,i)}function lm(e,t){var n=Yo();n.setRotate(t,0,0),Ko(e,n)}function Nn(e,t){this._eventBus=e,this._elementRegistry=t}Nn.$inject=["eventBus","elementRegistry"],Nn.prototype._getChildrenContainer=function(e){var t=this._elementRegistry.getGraphics(e),n;return e.parent?(n=fS(t),n||(n=_e("g"),qe(n).add("djs-children"),Oe(t.parentNode,n))):n=t,n},Nn.prototype._clear=function(e){var t=Ir(e);return ys(t),t},Nn.prototype._createContainer=function(e,t,n,i){var r=_e("g");qe(r).add("djs-group"),typeof n<"u"?dS(r,t,t.childNodes[n]):Oe(t,r);var o=_e("g");qe(o).add("djs-element"),qe(o).add("djs-"+e),i&&qe(o).add("djs-frame"),Oe(r,o);var a=_e("g");return qe(a).add("djs-visual"),Oe(o,a),o},Nn.prototype.create=function(e,t,n){var i=this._getChildrenContainer(t.parent);return this._createContainer(e,i,n,Nh(t))},Nn.prototype.updateContainments=function(e){var t=this,n=this._elementRegistry,i;i=Sn(e,function(r,o){return o.parent&&(r[o.parent.id]=o.parent),r},{}),D(i,function(r){var o=r.children;if(o){var a=t._getChildrenContainer(r),s=a.firstChild;D(o,function(c){var u=n.getGraphics(c).parentNode;u===s?s=s.nextSibling:a.insertBefore(u,s)})}})},Nn.prototype.drawShape=function(e,t,n={}){var i=this._eventBus;return i.fire("render.shape",{gfx:e,element:t,attrs:n})},Nn.prototype.getShapePath=function(e){var t=this._eventBus;return t.fire("render.getShapePath",e)},Nn.prototype.drawConnection=function(e,t,n={}){var i=this._eventBus;return i.fire("render.connection",{gfx:e,element:t,attrs:n})},Nn.prototype.getConnectionPath=function(e){var t=this._eventBus;return t.fire("render.getConnectionPath",e)},Nn.prototype.update=function(e,t,n){if(t.parent){var i=this._clear(n);if(e==="shape")this.drawShape(i,t),Qt(n,t.x,t.y);else if(e==="connection")this.drawConnection(i,t);else throw new Error("unknown type: "+e);t.hidden?fe(n,"display","none"):fe(n,"display","block")}},Nn.prototype.remove=function(e){var t=this._elementRegistry.getGraphics(e);jt(t.parentNode)};function dS(e,t,n){var i=n||t.firstChild;e!==i&&t.insertBefore(e,i)}const hS={__depends__:[P1],__init__:["canvas"],canvas:["type",Re],elementRegistry:["type",In],elementFactory:["type",Oi],eventBus:["type",Pn],graphicsFactory:["type",Nn]};function mS(e){var t=new Lh(e);return t.init(),t}function gS(e){e=e||{};var t={config:["value",e]},n=[t,hS].concat(e.modules||[]);return mS(n)}function nr(e,t){this._injector=t||gS(e),this.get("eventBus").fire("diagram.init")}nr.prototype.get=function(e,t){return this._injector.get(e,t)},nr.prototype.invoke=function(e,t,n){return this._injector.invoke(e,t,n)},nr.prototype.destroy=function(){this.get("eventBus").fire("diagram.destroy")},nr.prototype.clear=function(){this.get("eventBus").fire("diagram.clear")};function cn(e){return e?"<"+e.$type+(e.id?' id="'+e.id:"")+'" />':"<null>"}function bn(e,t){return e.$instanceOf(t)}function yS(e){return ut(e.rootElements,function(t){return bn(t,"bpmn:Process")||bn(t,"bpmn:Collaboration")})}function vS(e){var t={},n=[],i={};function r(V,G){return function(X){V(X,G)}}function o(V){t[V.id]=V}function a(V){return t[V.id]}function s(V,G){var X=V.gfx;if(X)throw new Error(`already rendered ${cn(V)}`);return e.element(V,i[V.id],G)}function c(V,G){return e.root(V,i[V.id],G)}function u(V,G){try{var X=i[V.id]&&s(V,G);return o(V),X}catch(je){l(je.message,{element:V,error:je}),console.error(`failed to import ${cn(V)}`,je)}}function l(V,G){e.error(V,G)}var f=this.registerDi=function(G){var X=G.bpmnElement;X?i[X.id]?l(`multiple DI elements defined for ${cn(X)}`,{element:X}):i[X.id]=G:l(`no bpmnElement referenced in ${cn(G)}`,{element:G})};function p(V){d(V.plane)}function d(V){f(V),D(V.planeElement,h)}function h(V){f(V)}this.handleDefinitions=function(G,X){var je=G.diagrams;if(X&&je.indexOf(X)===-1)throw new Error("diagram not part of <bpmn:Definitions />");if(!X&&je&&je.length&&(X=je[0]),!X)throw new Error("no diagram to display");i={},p(X);var Rt=X.plane;if(!Rt)throw new Error(`no plane for ${cn(X)}`);var A=Rt.bpmnElement;if(!A)if(A=yS(G),A)l(`correcting missing bpmnElement on ${cn(Rt)} to ${cn(A)}`),Rt.bpmnElement=A,f(Rt);else throw new Error("no process or collaboration to display");var b=c(A,Rt);if(bn(A,"bpmn:Process")||bn(A,"bpmn:SubProcess"))g(A,b);else if(bn(A,"bpmn:Collaboration"))ve(A,b),S(G.rootElements,b);else throw new Error(`unsupported bpmnElement for ${cn(Rt)}: ${cn(A)}`);m(n)};var m=this.handleDeferred=function(){for(var G;n.length;)G=n.shift(),G()};function g(V,G){ae(V,G),B(V.ioSpecification,G),T(V.artifacts,G),o(V)}function S(V,G){var X=He(V,function(je){return!a(je)&&bn(je,"bpmn:Process")&&je.laneSets});X.forEach(r(g,G))}function E(V,G){u(V,G)}function x(V,G){D(V,r(E,G))}function w(V,G){u(V,G)}function C(V,G){u(V,G)}function P(V,G){u(V,G)}function L(V,G){u(V,G)}function T(V,G){D(V,function(X){bn(X,"bpmn:Association")?n.push(function(){L(X,G)}):L(X,G)})}function B(V,G){V&&(D(V.dataInputs,r(C,G)),D(V.dataOutputs,r(P,G)))}var k=this.handleSubProcess=function(G,X){ae(G,X),T(G.artifacts,X)};function O(V,G){var X=u(V,G);bn(V,"bpmn:SubProcess")&&k(V,X||G),bn(V,"bpmn:Activity")&&B(V.ioSpecification,G),n.push(function(){D(V.dataInputAssociations,r(w,G)),D(V.dataOutputAssociations,r(w,G))})}function $(V,G){u(V,G)}function ie(V,G){u(V,G)}function ge(V,G){n.push(function(){var X=u(V,G);V.childLaneSet&&Ve(V.childLaneSet,X||G),te(V)})}function Ve(V,G){D(V.lanes,r(ge,G))}function q(V,G){D(V,r(Ve,G))}function ae(V,G){de(V.flowElements,G),V.laneSets&&q(V.laneSets,G)}function de(V,G){D(V,function(X){bn(X,"bpmn:SequenceFlow")?n.push(function(){$(X,G)}):bn(X,"bpmn:BoundaryEvent")?n.unshift(function(){O(X,G)}):bn(X,"bpmn:FlowNode")?O(X,G):bn(X,"bpmn:DataObject")||(bn(X,"bpmn:DataStoreReference")||bn(X,"bpmn:DataObjectReference")?ie(X,G):l(`unrecognized flowElement ${cn(X)} in context ${cn(G&&G.businessObject)}`,{element:X,context:G}))})}function re(V,G){var X=u(V,G),je=V.processRef;je&&g(je,X||G)}function ve(V,G){D(V.participants,r(re,G)),n.push(function(){x(V.messageFlows,G)}),T(V.artifacts,G)}function te(V){D(V.flowNodeRef,function(G){var X=G.get("lanes");X&&X.push(V)})}}function v(e,t){var n=ee(e);return n&&typeof n.$instanceOf=="function"&&n.$instanceOf(t)}function Fe(e,t){return Ui(t,function(n){return v(e,n)})}function ee(e){return e&&e.businessObject||e}function Xe(e){return e&&e.di}function bS(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,S){return i.add(m,g,S)},error:function(m,g){s.push({message:m,context:g})}},p=new vS(f);l=l||u.diagrams&&u.diagrams[0];var d=_S(u,l);if(!d)throw new Error("no diagram to display");D(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 _S(e,t){if(!(!t||!t.plane)){var n=t.plane.bpmnElement,i=n;!v(n,"bpmn:Process")&&!v(n,"bpmn:Collaboration")&&(i=xS(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=pm(o),s=[t],c=[n];return D(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 pm(e){var t=[];return D(e,function(n){n&&(t.push(n),t=t.concat(pm(n.flowElements)))}),t}function xS(e){for(var t=e;t;){if(v(t,"bpmn:Process"))return t;t=t.$parent}}var wS='<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>',fm=wS,dm={verticalAlign:"middle"},hm={color:"#404040"},ES={zIndex:"1001",position:"fixed",top:"0",left:"0",right:"0",bottom:"0"},SS={width:"100%",height:"100%",background:"rgba(40,40,40,0.2)"},RS={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"},CS='<div class="bjs-powered-by-lightbox"><div class="backdrop"></div><div class="notice"><a href="https://bpmn.io" target="_blank" rel="noopener" class="link">'+fm+'</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>',di;function PS(){di=ft(CS),dn(di,ES),dn(ot("svg",di),dm),dn(ot(".backdrop",di),SS),dn(ot(".notice",di),RS),dn(ot(".link",di),hm,{margin:"15px 20px 15px 10px",alignSelf:"center"})}function AS(){di||(PS(),Cn.bind(di,".backdrop","click",function(e){document.body.removeChild(di)})),document.body.appendChild(di)}const Ms=5,mm="djs-outline-hidden";function yt(e){e=j({},MS,e),this._moddle=this._createModdle(e),this._container=this._createContainer(e),this._init(this._container,this._moddle,e),OS(this._container)}pe(yt,nr),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||[]),ks(s,o),s=TS(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 ks(o,[]),o}if(typeof t=="string"&&(i=kS(n,t),!i)){const o=new Error("BPMNDiagram <"+t+"> not found");throw ks(o,[]),o}try{this.clear()}catch(o){throw ks(o,[]),o}const{warnings:r}=await bS(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=ot(":scope > defs",i._svg),a=Dh(r),s=o?"<defs>"+Dh(o)+"</defs>":"",c=i.getContainer();mt(c).add(mm);let u;try{u=r.getBBox()}finally{mt(c).remove(mm)}const l=u.x-Ms,f=u.y-Ms,p=u.width+Ms*2,d=u.height+Ms*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()&&nr.prototype.clear.call(this)},yt.prototype.destroy=function(){nr.prototype.destroy.call(this),li(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=ot(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=j(oi(n,["additionalModules"]),{canvas:j({},n.canvas,{container:e}),modules:a});nr.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=ft('<div class="bjs-container"></div>');return dn(t,{width:mm(e.width),height:mm(e.height),position:e.position}),t},yt.prototype._createModdle=function(e){const t=j({},this._moddleExtensions,e.moddleExtensions);return new _d(t)},yt.prototype._modules=[];function ks(e,t){return e.warnings=t,e}function RS(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 mm(e){return e+(Pe(e)?"px":"")}function PS(e,t){return t&&ut(e.diagrams,function(n){return n.id===t})||null}function AS(e){const n='<a href="http://bpmn.io" target="_blank" class="bjs-powered-by" title="Powered by bpmn.io" >'+pm+"</a>",i=ft(n);dn(ot("svg",i),fm),dn(i,dm,{position:"absolute",bottom:"15px",right:"15px",zIndex:"100"}),e.appendChild(i),Me.bind(i,"click",function(r){SS(),r.preventDefault()})}function fo(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)}pe(fo,yt),fo.prototype._createModdle=function(e){var t=yt.prototype._createModdle.call(this,e);return t.ids=new ui([32,36,1]),t},fo.prototype._collectIds=function(e,t){var n=e.$model,i=n.ids,r;i.clear();for(r in t)i.claim(r,t[r])};function We(e,t){return v(e,"bpmn:CallActivity")?!1:v(e,"bpmn:SubProcess")?(t=t||Xe(e),t&&v(t,"bpmndi:BPMNPlane")?!0:t&&!!t.isExpanded):v(e,"bpmn:Participant")?!!ee(e).processRef:!0}function Ut(e){if(!(!v(e,"bpmn:Participant")&&!v(e,"bpmn:Lane"))){var t=Xe(e).isHorizontal;return t===void 0?!0:t}}function TS(e){return e&&ee(e).isInterrupting!==!1}function un(e){return e&&!!ee(e).triggeredByEvent}function ho(e,t){var n=ee(e).eventDefinitions;return Ui(n,function(i){return v(i,t)})}function MS(e){return ho(e,"bpmn:ErrorEventDefinition")}function kS(e){return ho(e,"bpmn:EscalationEventDefinition")}function OS(e){return ho(e,"bpmn:CompensateEventDefinition")}var Nr={width:90,height:20},gm=15;function ir(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 Os(e){return $e(e.label)}function DS(e){var t=e.length/2-1,n=e[Math.floor(t)],i=e[Math.ceil(t+.01)],r=LS(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-=gm:a+=gm,{x:a,y:s}}function LS(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 gl(e){return e.waypoints?DS(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 IS(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=gl(t),i=Nr),j({x:n.x-i.width/2,y:n.y-i.height/2},i)}function ym(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 NS(e){var t=e.categoryValueRef;return t&&t.value||""}function Bn(e){var t=e.businessObject,n=ym(t);if(n)return n==="categoryValueRef"?NS(t):t[n]||""}function BS(e,t){var n=e.businessObject,i=ym(n);if(i)if(i==="categoryValueRef"){if(!n[i])return e;n[i].value=t}else n[i]=t;return e}function $S(e){return $e(e)&&ir(e.labelTarget)}var mo=7;function vm(e){let t=[];return D(e.incoming,n=>{v(n,"bpmn:Association")&&v(n.source,"bpmn:TextAnnotation")&&t.push({annotation:n.source,association:n})}),D(e.outgoing,n=>{v(n,"bpmn:Association")&&v(n.target,"bpmn:TextAnnotation")&&t.push({annotation:n.target,association:n})}),t}function ia(e){const t=new Map;return D(ul(e),n=>{D(vm(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 yl="hsl(225, 10%, 15%)",jS="white";function hi(e,t){return Ui(e.eventDefinitions,function(n){return n.$type===t})}function FS(e){return e.$type==="bpmn:IntermediateThrowEvent"||e.$type==="bpmn:EndEvent"}function HS(e){var t=e.dataObjectRef;return e.isCollection||t&&t.isCollection}function Ge(e,t,n){var i=Xe(e);return n||i.get("color:background-color")||i.get("bioc:fill")||t||jS}function ce(e,t,n){var i=Xe(e);return n||i.get("color:border-color")||i.get("bioc:stroke")||t||yl}function ra(e,t,n,i){var r=Xe(e),o=r.get("label");return i||o&&o.get("color:color")||t||ce(e,n)}function _m(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 vl(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 zS(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 GS(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 oa(e,t={}){return{width:Hn(e,t),height:An(e,t)}}function Hn(e,t={}){return En(t,"width")?t.width:e.width}function An(e,t={}){return En(t,"height")?t.height:e.height}var VS=new ui,WS=10,Ds=3,US=1.5,Ls=10,qS=4,go=.95,YS=1,KS=.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(A){return n.computeStyle(A,{strokeLinecap:"round",strokeLinejoin:"round",stroke:yl,strokeWidth:2,fill:"white"})}function f(A){return n.computeStyle(A,["no-fill"],{strokeLinecap:"round",strokeLinejoin:"round",stroke:yl,strokeWidth:2})}function p(A,_){var{ref:y={x:0,y:0},scale:N=1,element:z,parentGfx:K=r._svg}=_,he=be("marker",{id:A,viewBox:"0 0 20 20",refX:y.x,refY:y.y,markerWidth:20*N,markerHeight:20*N,orient:"auto"});Oe(he,z);var Le=ot(":scope > defs",K);Le||(Le=be("defs"),Oe(K,Le)),Oe(Le,he)}function d(A,_,y,N){var z=VS.nextPrefixed("marker-");return h(A,z,_,y,N),"url(#"+z+")"}function h(A,_,y,N,z){if(y==="sequenceflow-end"){var K=be("path",{d:"M 1 5 L 11 10 L 1 15 Z",...l({fill:z,stroke:z,strokeWidth:1})});p(_,{element:K,ref:{x:11,y:10},scale:.5,parentGfx:A})}if(y==="messageflow-start"){var he=be("circle",{cx:6,cy:6,r:3.5,...l({fill:N,stroke:z,strokeWidth:1,strokeDasharray:[1e4,1]})});p(_,{element:he,ref:{x:6,y:6},parentGfx:A})}if(y==="messageflow-end"){var Le=be("path",{d:"m 1 5 l 0 -3 l 7 3 l -7 3 z",...l({fill:N,stroke:z,strokeWidth:1,strokeDasharray:[1e4,1]})});p(_,{element:Le,ref:{x:8.5,y:5},parentGfx:A})}if(y==="association-start"){var Qe=be("path",{d:"M 11 5 L 1 10 L 11 15",...f({fill:"none",stroke:z,strokeWidth:1.5,strokeDasharray:[1e4,1]})});p(_,{element:Qe,ref:{x:1,y:10},scale:.5,parentGfx:A})}if(y==="association-end"){var Ct=be("path",{d:"M 1 5 L 11 10 L 1 15",...f({fill:"none",stroke:z,strokeWidth:1.5,strokeDasharray:[1e4,1]})});p(_,{element:Ct,ref:{x:11,y:10},scale:.5,parentGfx:A})}if(y==="conditional-flow-marker"){var nt=be("path",{d:"M 0 10 L 8 6 L 16 10 L 8 14 Z",...l({fill:N,stroke:z})});p(_,{element:nt,ref:{x:-1,y:10},scale:.5,parentGfx:A})}if(y==="conditional-default-flow-marker"){var Nt=be("path",{d:"M 6 4 L 10 16",...l({stroke:z,fill:"none"})});p(_,{element:Nt,ref:{x:0,y:10},scale:.5,parentGfx:A})}}function m(A,_,y,N,z={}){Vt(N)&&(z=N,N=0),N=N||0,z=l(z);var K=_/2,he=y/2,Le=be("circle",{cx:K,cy:he,r:Math.round((_+y)/4-N),...z});return Oe(A,Le),Le}function g(A,_,y,N,z,K){Vt(z)&&(K=z,z=0),z=z||0,K=l(K);var he=be("rect",{x:z,y:z,width:_-z*2,height:y-z*2,rx:N,ry:N,...K});return Oe(A,he),he}function S(A,_,y,N){var z=_/2,K=y/2,he=[{x:z,y:0},{x:_,y:K},{x:z,y},{x:0,y:K}],Le=he.map(function(Ct){return Ct.x+","+Ct.y}).join(" ");N=l(N);var Qe=be("polygon",{...N,points:Le});return Oe(A,Qe),Qe}function E(A,_,y,N){y=f(y);var z=Xo(_,y,N);return Oe(A,z),z}function x(A,_,y){return E(A,_,y,5)}function w(A,_,y){y=f(y);var N=be("path",{...y,d:_});return Oe(A,N),N}function C(A,_,y,N){return w(_,y,j({"data-marker":A},N))}function P(A){return Rt[A]}function L(A){return function(_,y,N){return P(A)(_,y,N)}}var T={"bpmn:MessageEventDefinition":function(A,_,y={},N){var z=i.getScaledPath("EVENT_MESSAGE",{xScaleFactor:.9,yScaleFactor:.9,containerWidth:y.width||_.width,containerHeight:y.height||_.height,position:{mx:.235,my:.315}}),K=N?ce(_,c,y.stroke):Ge(_,s,y.fill),he=N?Ge(_,s,y.fill):ce(_,c,y.stroke),Le=w(A,z,{fill:K,stroke:he,strokeWidth:1});return Le},"bpmn:TimerEventDefinition":function(A,_,y={}){var N=y.width||_.width,z=y.height||_.height,K=y.width?1:2,he=m(A,N,z,.2*z,{fill:Ge(_,s,y.fill),stroke:ce(_,c,y.stroke),strokeWidth:K}),Le=i.getScaledPath("EVENT_TIMER_WH",{xScaleFactor:.75,yScaleFactor:.75,containerWidth:N,containerHeight:z,position:{mx:.5,my:.5}});w(A,Le,{stroke:ce(_,c,y.stroke),strokeWidth:K});for(var Qe=0;Qe<12;Qe++){var Ct=i.getScaledPath("EVENT_TIMER_LINE",{xScaleFactor:.75,yScaleFactor:.75,containerWidth:N,containerHeight:z,position:{mx:.5,my:.5}}),nt=N/2,Nt=z/2;w(A,Ct,{strokeWidth:1,stroke:ce(_,c,y.stroke),transform:"rotate("+Qe*30+","+Nt+","+nt+")"})}return he},"bpmn:EscalationEventDefinition":function(A,_,y={},N){var z=i.getScaledPath("EVENT_ESCALATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:y.width||_.width,containerHeight:y.height||_.height,position:{mx:.5,my:.2}}),K=N?ce(_,c,y.stroke):Ge(_,s,y.fill);return w(A,z,{fill:K,stroke:ce(_,c,y.stroke),strokeWidth:1})},"bpmn:ConditionalEventDefinition":function(A,_,y={}){var N=i.getScaledPath("EVENT_CONDITIONAL",{xScaleFactor:1,yScaleFactor:1,containerWidth:y.width||_.width,containerHeight:y.height||_.height,position:{mx:.5,my:.222}});return w(A,N,{fill:Ge(_,s,y.fill),stroke:ce(_,c,y.stroke),strokeWidth:1})},"bpmn:LinkEventDefinition":function(A,_,y={},N){var z=i.getScaledPath("EVENT_LINK",{xScaleFactor:1,yScaleFactor:1,containerWidth:_.width,containerHeight:_.height,position:{mx:.57,my:.263}}),K=N?ce(_,c,y.stroke):Ge(_,s,y.fill);return w(A,z,{fill:K,stroke:ce(_,c,y.stroke),strokeWidth:1})},"bpmn:ErrorEventDefinition":function(A,_,y={},N){var z=i.getScaledPath("EVENT_ERROR",{xScaleFactor:1.1,yScaleFactor:1.1,containerWidth:y.width||_.width,containerHeight:y.height||_.height,position:{mx:.2,my:.722}}),K=N?ce(_,c,y.stroke):Ge(_,s,y.fill);return w(A,z,{fill:K,stroke:ce(_,c,y.stroke),strokeWidth:1})},"bpmn:CancelEventDefinition":function(A,_,y={},N){var z=i.getScaledPath("EVENT_CANCEL_45",{xScaleFactor:1,yScaleFactor:1,containerWidth:_.width,containerHeight:_.height,position:{mx:.638,my:-.055}}),K=N?ce(_,c,y.stroke):"none",he=w(A,z,{fill:K,stroke:ce(_,c,y.stroke),strokeWidth:1});return um(he,45),he},"bpmn:CompensateEventDefinition":function(A,_,y={},N){var z=i.getScaledPath("EVENT_COMPENSATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:y.width||_.width,containerHeight:y.height||_.height,position:{mx:.22,my:.5}}),K=N?ce(_,c,y.stroke):Ge(_,s,y.fill);return w(A,z,{fill:K,stroke:ce(_,c,y.stroke),strokeWidth:1})},"bpmn:SignalEventDefinition":function(A,_,y={},N){var z=i.getScaledPath("EVENT_SIGNAL",{xScaleFactor:.9,yScaleFactor:.9,containerWidth:y.width||_.width,containerHeight:y.height||_.height,position:{mx:.5,my:.2}}),K=N?ce(_,c,y.stroke):Ge(_,s,y.fill);return w(A,z,{strokeWidth:1,fill:K,stroke:ce(_,c,y.stroke)})},"bpmn:MultipleEventDefinition":function(A,_,y={},N){var z=i.getScaledPath("EVENT_MULTIPLE",{xScaleFactor:1.1,yScaleFactor:1.1,containerWidth:y.width||_.width,containerHeight:y.height||_.height,position:{mx:.211,my:.36}}),K=N?ce(_,c,y.stroke):Ge(_,s,y.fill);return w(A,z,{fill:K,stroke:ce(_,c,y.stroke),strokeWidth:1})},"bpmn:ParallelMultipleEventDefinition":function(A,_,y={}){var N=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(A,N,{fill:Ge(_,s,y.fill),stroke:ce(_,c,y.stroke),strokeWidth:1})},"bpmn:TerminateEventDefinition":function(A,_,y={}){var N=m(A,_.width,_.height,8,{fill:ce(_,c,y.stroke),stroke:ce(_,c,y.stroke),strokeWidth:4});return N}};function B(A,_,y={},N){var z=ee(A),K=FS(z),he=N||A;return z.get("eventDefinitions")&&z.get("eventDefinitions").length>1?z.get("parallelMultiple")?T["bpmn:ParallelMultipleEventDefinition"](_,he,y,K):T["bpmn:MultipleEventDefinition"](_,he,y,K):hi(z,"bpmn:MessageEventDefinition")?T["bpmn:MessageEventDefinition"](_,he,y,K):hi(z,"bpmn:TimerEventDefinition")?T["bpmn:TimerEventDefinition"](_,he,y,K):hi(z,"bpmn:ConditionalEventDefinition")?T["bpmn:ConditionalEventDefinition"](_,he,y,K):hi(z,"bpmn:SignalEventDefinition")?T["bpmn:SignalEventDefinition"](_,he,y,K):hi(z,"bpmn:EscalationEventDefinition")?T["bpmn:EscalationEventDefinition"](_,he,y,K):hi(z,"bpmn:LinkEventDefinition")?T["bpmn:LinkEventDefinition"](_,he,y,K):hi(z,"bpmn:ErrorEventDefinition")?T["bpmn:ErrorEventDefinition"](_,he,y,K):hi(z,"bpmn:CancelEventDefinition")?T["bpmn:CancelEventDefinition"](_,he,y,K):hi(z,"bpmn:CompensateEventDefinition")?T["bpmn:CompensateEventDefinition"](_,he,y,K):hi(z,"bpmn:TerminateEventDefinition")?T["bpmn:TerminateEventDefinition"](_,he,y,K):null}var k={ParticipantMultiplicityMarker:function(A,_,y={}){var N=Hn(_,y),z=An(_,y),K=i.getScaledPath("MARKER_PARALLEL",{xScaleFactor:1,yScaleFactor:1,containerWidth:N,containerHeight:z,position:{mx:(N/2-6)/N,my:(z-15)/z}});C("participant-multiplicity",A,K,{strokeWidth:2,fill:Ge(_,s,y.fill),stroke:ce(_,c,y.stroke)})},SubProcessMarker:function(A,_,y={}){var N=g(A,14,14,0,{strokeWidth:1,fill:Ge(_,s,y.fill),stroke:ce(_,c,y.stroke)});Qt(N,_.width/2-7.5,_.height-20);var z=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}});C("sub-process",A,z,{fill:Ge(_,s,y.fill),stroke:ce(_,c,y.stroke)})},ParallelMarker:function(A,_,y){var N=Hn(_,y),z=An(_,y),K=i.getScaledPath("MARKER_PARALLEL",{xScaleFactor:1,yScaleFactor:1,containerWidth:N,containerHeight:z,position:{mx:(N/2+y.parallel)/N,my:(z-20)/z}});C("parallel",A,K,{fill:Ge(_,s,y.fill),stroke:ce(_,c,y.stroke)})},SequentialMarker:function(A,_,y){var N=i.getScaledPath("MARKER_SEQUENTIAL",{xScaleFactor:1,yScaleFactor:1,containerWidth:_.width,containerHeight:_.height,position:{mx:(_.width/2+y.seq)/_.width,my:(_.height-19)/_.height}});C("sequential",A,N,{fill:Ge(_,s,y.fill),stroke:ce(_,c,y.stroke)})},CompensationMarker:function(A,_,y){var N=i.getScaledPath("MARKER_COMPENSATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:_.width,containerHeight:_.height,position:{mx:(_.width/2+y.compensation)/_.width,my:(_.height-13)/_.height}});C("compensation",A,N,{strokeWidth:1,fill:Ge(_,s,y.fill),stroke:ce(_,c,y.stroke)})},LoopMarker:function(A,_,y){var N=Hn(_,y),z=An(_,y),K=i.getScaledPath("MARKER_LOOP",{xScaleFactor:1,yScaleFactor:1,containerWidth:N,containerHeight:z,position:{mx:(N/2+y.loop)/N,my:(z-7)/z}});C("loop",A,K,{strokeWidth:1.5,fill:"none",stroke:ce(_,c,y.stroke),strokeMiterlimit:.5})},AdhocMarker:function(A,_,y){var N=Hn(_,y),z=An(_,y),K=i.getScaledPath("MARKER_ADHOC",{xScaleFactor:1,yScaleFactor:1,containerWidth:N,containerHeight:z,position:{mx:(N/2+y.adhoc)/N,my:(z-15)/z}});C("adhoc",A,K,{strokeWidth:1,fill:ce(_,c,y.stroke),stroke:ce(_,c,y.stroke)})}};function O(A,_,y,N){k[A](_,y,N)}function $(A,_,y=[],N={}){N={fill:N.fill,stroke:N.stroke,width:Hn(_,N),height:An(_,N)};var z=ee(_),K=y.includes("SubProcessMarker");K?N={...N,seq:-21,parallel:-22,compensation:-25,loop:-18,adhoc:10}:N={...N,seq:-5,parallel:-6,compensation:-7,loop:0,adhoc:-8},z.get("isForCompensation")&&y.push("CompensationMarker"),v(z,"bpmn:AdHocSubProcess")&&(y.push("AdhocMarker"),K||j(N,{compensation:N.compensation-18}));var he=z.get("loopCharacteristics"),Le=he&&he.get("isSequential");he&&(j(N,{compensation:N.compensation-18}),y.includes("AdhocMarker")&&j(N,{seq:-23,loop:-18,parallel:-24}),Le===void 0&&y.push("LoopMarker"),Le===!1&&y.push("ParallelMarker"),Le===!0&&y.push("SequentialMarker")),y.includes("CompensationMarker")&&y.length===1&&j(N,{compensation:-8}),D(y,function(Qe){O(Qe,A,_,N)})}function ne(A,_,y={}){y=j({size:{width:100}},y);var N=o.createText(_||"",y);return qe(N).add("djs-label"),Oe(A,N),N}function ge(A,_,y,N={}){var z=ee(_),K=oa({x:_.x,y:_.y,width:_.width,height:_.height},N);return ne(A,z.name,{align:y,box:K,padding:7,style:{fill:ra(_,u,c,N.stroke)}})}function Ve(A,_,y={}){var N={width:_.width,height:_.height,x:_.width/2+_.x,y:_.height/2+_.y};return ne(A,Bn(_),{box:N,style:j({},o.getExternalStyle(),{fill:ra(_,u,c,y.stroke)})})}function q(A,_,y,N={}){var z=Ut(y),K=ne(A,_,{box:{height:30,width:z?An(y,N):Hn(y,N)},align:"center-middle",style:{fill:ra(y,u,c,N.stroke)}});if(z){var he=-1*An(y,N);Ts(K,0,-he,270)}}function ae(A,_,y={}){var{width:N,height:z}=oa(_,y);return g(A,N,z,Ls,{...y,fill:Ge(_,s,y.fill),fillOpacity:go,stroke:ce(_,c,y.stroke)})}function de(A,_,y={}){var N=ee(_),z=Ge(_,s,y.fill),K=ce(_,c,y.stroke);return(N.get("associationDirection")==="One"||N.get("associationDirection")==="Both")&&(y.markerEnd=d(A,"association-end",z,K)),N.get("associationDirection")==="Both"&&(y.markerStart=d(A,"association-start",z,K)),y=Ze(y,["markerStart","markerEnd"]),x(A,_.waypoints,{...y,stroke:K,strokeDasharray:"0, 5"})}function re(A,_,y={}){var N=Ge(_,s,y.fill),z=ce(_,c,y.stroke),K=i.getScaledPath("DATA_OBJECT_PATH",{xScaleFactor:1,yScaleFactor:1,containerWidth:_.width,containerHeight:_.height,position:{mx:.474,my:.296}}),he=w(A,K,{fill:N,fillOpacity:go,stroke:z}),Le=ee(_);if(HS(Le)){var Qe=i.getScaledPath("DATA_OBJECT_COLLECTION_PATH",{xScaleFactor:1,yScaleFactor:1,containerWidth:_.width,containerHeight:_.height,position:{mx:.33,my:(_.height-18)/_.height}});w(A,Qe,{strokeWidth:2,fill:N,stroke:z})}return he}function ve(A,_,y={}){return m(A,_.width,_.height,{fillOpacity:go,...y,fill:Ge(_,s,y.fill),stroke:ce(_,c,y.stroke)})}function te(A,_,y={}){return S(A,_.width,_.height,{fill:Ge(_,s,y.fill),fillOpacity:go,stroke:ce(_,c,y.stroke)})}function V(A,_,y={}){var N=g(A,Hn(_,y),An(_,y),0,{fill:Ge(_,s,y.fill),fillOpacity:y.fillOpacity||go,stroke:ce(_,c,y.stroke),strokeWidth:1.5}),z=ee(_);if(v(z,"bpmn:Lane")){var K=z.get("name");q(A,K,_,y)}return N}function G(A,_,y={}){var N=ae(A,_,y),z=We(_);if(un(_)&&(fe(N,{strokeDasharray:"0, 5.5",strokeWidth:2.5}),!z)){var K=ee(_).flowElements||[],he=K.filter(Le=>v(Le,"bpmn:StartEvent"));he.length===1&&X(he[0],A,y,_)}return ge(A,_,z?"center-top":"center-middle",y),z?$(A,_,void 0,y):$(A,_,["SubProcessMarker"],y),N}function X(A,_,y,N){var z=22,K={fill:Ge(N,s,y.fill),stroke:ce(N,c,y.stroke),width:z,height:z},he=ee(A).isInterrupting,Le=he?0:3,Qe=he?1:1.2,Ct=20,nt=(z-Ct)/2,Nt="translate("+nt+","+nt+")";m(_,Ct,Ct,{fill:K.fill,stroke:K.stroke,strokeWidth:Qe,strokeDasharray:Le,transform:Nt}),B(A,_,K,N)}function je(A,_,y={}){var N=ae(A,_,y);return ge(A,_,"center-middle",y),$(A,_,void 0,y),N}var Rt=this.handlers={"bpmn:AdHocSubProcess":function(A,_,y={}){return We(_)?y=Ze(y,["fill","stroke","width","height"]):y=Ze(y,["fill","stroke"]),G(A,_,y)},"bpmn:Association":function(A,_,y={}){return y=Ze(y,["fill","stroke"]),de(A,_,y)},"bpmn:BoundaryEvent":function(A,_,y={}){var{renderIcon:N=!0}=y;y=Ze(y,["fill","stroke"]);var z=ee(_),K=z.get("cancelActivity");y={strokeWidth:1.5,fill:Ge(_,s,y.fill),fillOpacity:YS,stroke:ce(_,c,y.stroke)},K||(y.strokeDasharray="6");var he=ve(A,_,y);return m(A,_.width,_.height,Ds,{...y,fill:"none"}),N&&B(_,A,y),he},"bpmn:BusinessRuleTask":function(A,_,y={}){y=Ze(y,["fill","stroke"]);var N=je(A,_,y),z=i.getScaledPath("TASK_TYPE_BUSINESS_RULE_MAIN",{abspos:{x:8,y:8}}),K=w(A,z);fe(K,{fill:Ge(_,s,y.fill),stroke:ce(_,c,y.stroke),strokeWidth:1});var he=i.getScaledPath("TASK_TYPE_BUSINESS_RULE_HEADER",{abspos:{x:8,y:8}}),Le=w(A,he);return fe(Le,{fill:ce(_,c,y.stroke),stroke:ce(_,c,y.stroke),strokeWidth:1}),N},"bpmn:CallActivity":function(A,_,y={}){return y=Ze(y,["fill","stroke"]),G(A,_,{strokeWidth:5,...y})},"bpmn:ComplexGateway":function(A,_,y={}){y=Ze(y,["fill","stroke"]);var N=te(A,_,y),z=i.getScaledPath("GATEWAY_COMPLEX",{xScaleFactor:.5,yScaleFactor:.5,containerWidth:_.width,containerHeight:_.height,position:{mx:.46,my:.26}});return w(A,z,{fill:ce(_,c,y.stroke),stroke:ce(_,c,y.stroke),strokeWidth:1}),N},"bpmn:DataInput":function(A,_,y={}){y=Ze(y,["fill","stroke"]);var N=i.getRawPath("DATA_ARROW"),z=re(A,_,y);return w(A,N,{fill:"none",stroke:ce(_,c,y.stroke),strokeWidth:1}),z},"bpmn:DataInputAssociation":function(A,_,y={}){return y=Ze(y,["fill","stroke"]),de(A,_,{...y,markerEnd:d(A,"association-end",Ge(_,s,y.fill),ce(_,c,y.stroke))})},"bpmn:DataObject":function(A,_,y={}){return y=Ze(y,["fill","stroke"]),re(A,_,y)},"bpmn:DataObjectReference":L("bpmn:DataObject"),"bpmn:DataOutput":function(A,_,y={}){y=Ze(y,["fill","stroke"]);var N=i.getRawPath("DATA_ARROW"),z=re(A,_,y);return w(A,N,{strokeWidth:1,fill:ce(_,c,y.stroke),stroke:ce(_,c,y.stroke)}),z},"bpmn:DataOutputAssociation":function(A,_,y={}){return y=Ze(y,["fill","stroke"]),de(A,_,{...y,markerEnd:d(A,"association-end",Ge(_,s,y.fill),ce(_,c,y.stroke))})},"bpmn:DataStoreReference":function(A,_,y={}){y=Ze(y,["fill","stroke"]);var N=i.getScaledPath("DATA_STORE",{xScaleFactor:1,yScaleFactor:1,containerWidth:_.width,containerHeight:_.height,position:{mx:0,my:.133}});return w(A,N,{fill:Ge(_,s,y.fill),fillOpacity:go,stroke:ce(_,c,y.stroke),strokeWidth:2})},"bpmn:EndEvent":function(A,_,y={}){var{renderIcon:N=!0}=y;y=Ze(y,["fill","stroke"]);var z=ve(A,_,{...y,strokeWidth:4});return N&&B(_,A,y),z},"bpmn:EventBasedGateway":function(A,_,y={}){y=Ze(y,["fill","stroke"]);var N=ee(_),z=te(A,_,y);m(A,_.width,_.height,_.height*.2,{fill:Ge(_,"none",y.fill),stroke:ce(_,c,y.stroke),strokeWidth:1});var K=N.get("eventGatewayType"),he=!!N.get("instantiate");function Le(){var Ct=i.getScaledPath("GATEWAY_EVENT_BASED",{xScaleFactor:.18,yScaleFactor:.18,containerWidth:_.width,containerHeight:_.height,position:{mx:.36,my:.44}});w(A,Ct,{fill:"none",stroke:ce(_,c,y.stroke),strokeWidth:2})}if(K==="Parallel"){var Qe=i.getScaledPath("GATEWAY_PARALLEL",{xScaleFactor:.4,yScaleFactor:.4,containerWidth:_.width,containerHeight:_.height,position:{mx:.474,my:.296}});w(A,Qe,{fill:"none",stroke:ce(_,c,y.stroke),strokeWidth:1})}else K==="Exclusive"&&(he||m(A,_.width,_.height,_.height*.26,{fill:"none",stroke:ce(_,c,y.stroke),strokeWidth:1}),Le());return z},"bpmn:ExclusiveGateway":function(A,_,y={}){y=Ze(y,["fill","stroke"]);var N=te(A,_,y),z=i.getScaledPath("GATEWAY_EXCLUSIVE",{xScaleFactor:.4,yScaleFactor:.4,containerWidth:_.width,containerHeight:_.height,position:{mx:.32,my:.3}}),K=Xe(_);return K.get("isMarkerVisible")&&w(A,z,{fill:ce(_,c,y.stroke),stroke:ce(_,c,y.stroke),strokeWidth:1}),N},"bpmn:Gateway":function(A,_,y={}){return y=Ze(y,["fill","stroke"]),te(A,_,y)},"bpmn:Group":function(A,_,y={}){return y=Ze(y,["fill","stroke","width","height"]),g(A,_.width,_.height,Ls,{stroke:ce(_,c,y.stroke),strokeWidth:1.5,strokeDasharray:"10, 6, 0, 6",fill:"none",pointerEvents:"none",width:Hn(_,y),height:An(_,y)})},"bpmn:InclusiveGateway":function(A,_,y={}){y=Ze(y,["fill","stroke"]);var N=te(A,_,y);return m(A,_.width,_.height,_.height*.24,{fill:Ge(_,s,y.fill),stroke:ce(_,c,y.stroke),strokeWidth:2.5}),N},"bpmn:IntermediateEvent":function(A,_,y={}){var{renderIcon:N=!0}=y;y=Ze(y,["fill","stroke"]);var z=ve(A,_,{...y,strokeWidth:1.5});return m(A,_.width,_.height,Ds,{fill:"none",stroke:ce(_,c,y.stroke),strokeWidth:1.5}),N&&B(_,A,y),z},"bpmn:IntermediateCatchEvent":L("bpmn:IntermediateEvent"),"bpmn:IntermediateThrowEvent":L("bpmn:IntermediateEvent"),"bpmn:Lane":function(A,_,y={}){return y=Ze(y,["fill","stroke","width","height"]),V(A,_,{...y,fillOpacity:KS})},"bpmn:ManualTask":function(A,_,y={}){y=Ze(y,["fill","stroke"]);var N=je(A,_,y),z=i.getScaledPath("TASK_TYPE_MANUAL",{abspos:{x:17,y:15}});return w(A,z,{fill:Ge(_,s,y.fill),stroke:ce(_,c,y.stroke),strokeWidth:.5}),N},"bpmn:MessageFlow":function(A,_,y={}){y=Ze(y,["fill","stroke"]);var N=ee(_),z=Xe(_),K=Ge(_,s,y.fill),he=ce(_,c,y.stroke),Le=x(A,_.waypoints,{markerEnd:d(A,"messageflow-end",K,he),markerStart:d(A,"messageflow-start",K,he),stroke:he,strokeDasharray:"10, 11",strokeWidth:1.5});if(N.get("messageRef")){var Qe=Le.getPointAtLength(Le.getTotalLength()/2),Ct=i.getScaledPath("MESSAGE_FLOW_MARKER",{abspos:{x:Qe.x,y:Qe.y}}),nt={strokeWidth:1};z.get("messageVisibleKind")==="initiating"?(nt.fill=K,nt.stroke=he):(nt.fill=he,nt.stroke=K);var Nt=w(A,Ct,nt),Pt=N.get("messageRef"),mn=Pt.get("name"),lt=ne(A,mn,{align:"center-top",fitBox:!0,style:{fill:he}}),zt=Nt.getBBox(),ln=lt.getBBox(),Sr=Qe.x-ln.width/2,xn=Qe.y+zt.height/2+WS;Ts(lt,Sr,xn,0)}return Le},"bpmn:ParallelGateway":function(A,_,y={}){y=Ze(y,["fill","stroke"]);var N=te(A,_,y),z=i.getScaledPath("GATEWAY_PARALLEL",{xScaleFactor:.6,yScaleFactor:.6,containerWidth:_.width,containerHeight:_.height,position:{mx:.46,my:.2}});return w(A,z,{fill:ce(_,c,y.stroke),stroke:ce(_,c,y.stroke),strokeWidth:1}),N},"bpmn:Participant":function(A,_,y={}){y=Ze(y,["fill","stroke","width","height"]);var N=V(A,_,y),z=We(_),K=Ut(_),he=ee(_),Le=he.get("name");if(z){var Qe=K?[{x:30,y:0},{x:30,y:An(_,y)}]:[{x:0,y:30},{x:Hn(_,y),y:30}];E(A,Qe,{stroke:ce(_,c,y.stroke),strokeWidth:US}),q(A,Le,_,y)}else{var Ct=oa(_,y);K||(Ct.height=Hn(_,y),Ct.width=An(_,y));var nt=ne(A,Le,{box:Ct,align:"center-middle",style:{fill:ra(_,u,c,y.stroke)}});if(!K){var Nt=-1*An(_,y);Ts(nt,0,-Nt,270)}}return he.get("participantMultiplicity")&&O("ParticipantMultiplicityMarker",A,_,y),N},"bpmn:ReceiveTask":function(A,_,y={}){y=Ze(y,["fill","stroke"]);var N=ee(_),z=je(A,_,y),K;return N.get("instantiate")?(m(A,28,28,20*.22,{fill:Ge(_,s,y.fill),stroke:ce(_,c,y.stroke),strokeWidth:1}),K=i.getScaledPath("TASK_TYPE_INSTANTIATING_SEND",{abspos:{x:7.77,y:9.52}})):K=i.getScaledPath("TASK_TYPE_SEND",{xScaleFactor:.9,yScaleFactor:.9,containerWidth:21,containerHeight:14,position:{mx:.3,my:.4}}),w(A,K,{fill:Ge(_,s,y.fill),stroke:ce(_,c,y.stroke),strokeWidth:1}),z},"bpmn:ScriptTask":function(A,_,y={}){y=Ze(y,["fill","stroke"]);var N=je(A,_,y),z=i.getScaledPath("TASK_TYPE_SCRIPT",{abspos:{x:15,y:20}});return w(A,z,{fill:Ge(_,s,y.fill),stroke:ce(_,c,y.stroke),strokeWidth:1}),N},"bpmn:SendTask":function(A,_,y={}){y=Ze(y,["fill","stroke"]);var N=je(A,_,y),z=i.getScaledPath("TASK_TYPE_SEND",{xScaleFactor:1,yScaleFactor:1,containerWidth:21,containerHeight:14,position:{mx:.285,my:.357}});return w(A,z,{fill:ce(_,c,y.stroke),stroke:Ge(_,s,y.fill),strokeWidth:1}),N},"bpmn:SequenceFlow":function(A,_,y={}){y=Ze(y,["fill","stroke"]);var N=Ge(_,s,y.fill),z=ce(_,c,y.stroke),K=x(A,_.waypoints,{markerEnd:d(A,"sequenceflow-end",N,z),stroke:z}),he=ee(_),{source:Le}=_;if(Le){var Qe=ee(Le);he.get("conditionExpression")&&v(Qe,"bpmn:Activity")&&fe(K,{markerStart:d(A,"conditional-flow-marker",N,z)}),Qe.get("default")&&(v(Qe,"bpmn:Gateway")||v(Qe,"bpmn:Activity"))&&Qe.get("default")===he&&fe(K,{markerStart:d(A,"conditional-default-flow-marker",N,z)})}return K},"bpmn:ServiceTask":function(A,_,y={}){y=Ze(y,["fill","stroke"]);var N=je(A,_,y);m(A,10,10,{fill:Ge(_,s,y.fill),stroke:"none",transform:"translate(6, 6)"});var z=i.getScaledPath("TASK_TYPE_SERVICE",{abspos:{x:12,y:18}});w(A,z,{fill:Ge(_,s,y.fill),stroke:ce(_,c,y.stroke),strokeWidth:1}),m(A,10,10,{fill:Ge(_,s,y.fill),stroke:"none",transform:"translate(11, 10)"});var K=i.getScaledPath("TASK_TYPE_SERVICE",{abspos:{x:17,y:22}});return w(A,K,{fill:Ge(_,s,y.fill),stroke:ce(_,c,y.stroke),strokeWidth:1}),N},"bpmn:StartEvent":function(A,_,y={}){var{renderIcon:N=!0}=y;y=Ze(y,["fill","stroke"]);var z=ee(_);z.get("isInterrupting")||(y={...y,strokeDasharray:"6"});var K=ve(A,_,y);return N&&B(_,A,y),K},"bpmn:SubProcess":function(A,_,y={}){return We(_)?y=Ze(y,["fill","stroke","width","height"]):y=Ze(y,["fill","stroke"]),G(A,_,y)},"bpmn:Task":function(A,_,y={}){return y=Ze(y,["fill","stroke"]),je(A,_,y)},"bpmn:TextAnnotation":function(A,_,y={}){y=Ze(y,["fill","stroke"]);var{width:N,height:z}=oa(_,y),K=g(A,N,z,0,0,{fill:"none",stroke:"none"}),he=i.getScaledPath("TEXT_ANNOTATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:N,containerHeight:z,position:{mx:0,my:0}});w(A,he,{stroke:ce(_,c,y.stroke)});var Le=ee(_),Qe=Le.get("text")||"";return ne(A,Qe,{align:"left-top",box:oa(_,y),padding:mo,style:{fill:ra(_,u,c,y.stroke)}}),K},"bpmn:Transaction":function(A,_,y={}){We(_)?y=Ze(y,["fill","stroke","width","height"]):y=Ze(y,["fill","stroke"]);var N=G(A,_,{strokeWidth:1.5,...y}),z=n.style(["no-fill","no-events"],{stroke:ce(_,c,y.stroke),strokeWidth:1.5}),K=We(_);return K||(y={}),g(A,Hn(_,y),An(_,y),Ls-Ds,Ds,z),N},"bpmn:UserTask":function(A,_,y={}){y=Ze(y,["fill","stroke"]);var N=je(A,_,y),z=15,K=12,he=i.getScaledPath("TASK_TYPE_USER_1",{abspos:{x:z,y:K}});w(A,he,{fill:Ge(_,s,y.fill),stroke:ce(_,c,y.stroke),strokeWidth:.5});var Le=i.getScaledPath("TASK_TYPE_USER_2",{abspos:{x:z,y:K}});w(A,Le,{fill:Ge(_,s,y.fill),stroke:ce(_,c,y.stroke),strokeWidth:.5});var Qe=i.getScaledPath("TASK_TYPE_USER_3",{abspos:{x:z,y:K}});return w(A,Qe,{fill:ce(_,c,y.stroke),stroke:ce(_,c,y.stroke),strokeWidth:.5}),N},label:function(A,_,y={}){return Ve(A,_,y)}};this._drawPath=w,this._renderer=P}pe(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 $e(e)?vl(e,qS):v(e,"bpmn:Event")?_m(e):v(e,"bpmn:Activity")?vl(e,Ls):v(e,"bpmn:Gateway")?zS(e):GS(e)};function Ze(e,t=[]){return t.reduce((n,i)=>(e[i]&&(n[i]=e[i]),n),{})}var XS=0,ZS={width:150,height:50};function QS(e){var t=e.split("-");return{horizontal:t[0]||"center",vertical:t[1]||"top"}}function JS(e){return Vt(e)?j({top:0,left:0,right:0,bottom:0},e):{top:e,left:e,right:e,bottom:e}}var _l=null;function eR(){return _l||(_l=document.createElement("canvas").getContext("2d")),_l}function tR(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(bm(e.fontSize)||"12px"),t.push(e.fontFamily||"sans-serif"),t.join(" ")}function bm(e){if(e!=null)return typeof e=="number"||/^-?\d+(\.\d+)?$/.test(e)?e+"px":e}function nR(e,t){var n=eR();if(!n)return{width:0,height:0};n.font=tR(t),"letterSpacing"in n&&(n.letterSpacing=bm(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 iR(e,t,n){for(var i=e.shift(),r=i,o;;){if(o=nR(r,n),o.width=r?o.width:0,r===" "||r===""||o.width<Math.round(t)||r.length<2)return rR(e,r,i,o);r=aR(r,o.width,t)}}function rR(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 xm="­";function oR(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===xm)&&r.pop();break}var a=r[r.length-1];return a&&a===xm&&(r[r.length-1]="-"),r.join("")}function aR(e,t,n){var i=Math.max(e.length*(n/t),1),r=oR(e,i);return r||(r=e.slice(0,Math.max(Math.round(i-1),1))),r}function Is(e){this._config=j({},{size:ZS,padding:XS,style:{},align:"center-top"},e||{})}Is.prototype.createText=function(e,t){return this.layoutText(e,t).element},Is.prototype.getDimensions=function(e,t){return this.layoutText(e,t).dimensions},Is.prototype.layoutText=function(e,t){for(var n=j({},this._config.size,t.box),i=j({},this._config.style,t.style),r=QS(t.align||this._config.align),o=JS(t.padding!==void 0?t.padding:this._config.padding),a=t.fitBox||!1,s=sR(i),c=e.split(/\u00AD?\r?\n/),u=[],l=n.width-o.left-o.right;c.length;)u.push(iR(c,l,i));r.vertical==="middle"&&(o.top=o.bottom=0);var f=Sn(u,function(g,S,E){return g+(s||S.height)},0)+o.top+o.bottom,p=Sn(u,function(g,S,E){return S.width>g?S.width:g},0),d=o.top;r.vertical==="middle"&&(d+=(n.height-f)/2),d-=(s||u[0].height)/4;var h=be("text");fe(h,i),D(u,function(g){var S;switch(d+=s||g.height,r.horizontal){case"left":S=o.left;break;case"right":S=(a?p:l)-o.right-g.width;break;default:S=Math.max(((a?p:l)-g.width)/2+o.left,0)}var E=be("tspan");fe(E,{x:S,y:d}),E.textContent=g.text,Oe(h,E)});var m={width:p,height:f};return{dimensions:m,element:h}};function sR(e){if("fontSize"in e&&"lineHeight"in e)return e.lineHeight*parseInt(e.fontSize,10)}var cR=12,uR=1.2,lR=40;function wm(e){var t=j({fontFamily:"Arial, sans-serif",fontSize:cR,fontWeight:"normal",lineHeight:uR},e&&e.defaultStyle||{}),n=parseInt(t.fontSize,10)-1,i=j({},t,{fontSize:n},e&&e.externalStyle||{}),r=new Is({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(lR,Math.round(c.height))}},this.getDimensions=function(a,s){return r.getDimensions(a,s||{})};function o(a,s,c){return r.getDimensions(a,j({box:s},c))}this.createText=function(a,s){return r.createText(a,s||{})},this.getDefaultStyle=function(){return t},this.getExternalStyle=function(){return i}}wm.$inject=["config.textRenderer"];function pR(){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=mR(i.d,{mx:r,my:o,e:a});return f}}var fR=/\{([^{}]+)\}/g,dR=/(?:(?:^|\.)(.+?)(?=\[|\.|$|\()|\[('|")(.+?)\2\])(\(\))?/g;function hR(e,t,n){var i=n;return t.replace(dR,function(r,o,a,s,c){o=o||s,i&&(o in i&&(i=i[o]),typeof i=="function"&&c&&(i=i()))}),i=(i==null||i==n?e:i)+"",i}function mR(e,t){return String(e).replace(fR,function(n,i){return hR(n,i,t)})}const gR={__init__:["bpmnRenderer"],bpmnRenderer:["type",Br],textRenderer:["type",wm],pathMap:["type",pR]};function yR(e,t){return t=t||{},e.replace(/{([^}]+)}/g,function(n,i){return t[i]||"{"+i+"}"})}const aa={translate:["value",yR]};function Ns(e,t,n){return j({id:e.id,type:e.$type,businessObject:e,di:t},n)}function vR(e,t,n){var i=e.waypoint;return!i||i.length<2?[Se(t),Se(n)]:i.map(function(r){return{x:r.x,y:r.y}})}function Em(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(Ns(e,t,a)),this._canvas.addRootElement(i)}else if(v(t,"bpmndi:BPMNShape")){var s=!We(e,t),c=bR(e);r=n&&(n.hidden||n.collapsed);var u=t.bounds;i=this._elementFactory.createShape(Ns(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")&&(_R(n,Se(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(Ns(e,t,{hidden:r,source:l,target:f,waypoints:vR(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 ir(e)&&Bn(i)&&this.addLabel(e,t,i),this._eventBus.fire("bpmnElement.added",{element:i}),i},Di.prototype._attachBoundary=function(e,t){var n=e.attachedToRef;if(!n)throw new Error(`missing ${cn(e)}#attachedToRef`);var i=this._elementRegistry.get(n.id),r=i&&i.attachers;if(!i)throw Em(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=IS(t,n),r=Bn(n),r&&(i=this._textRenderer.getExternalLabelBounds(i,r)),o=this._elementFactory.createLabel(Ns(e,t,{id:e.id+"_label",labelTarget:n,type:"label",hidden:n.hidden||!Bn(n),x:Math.round(i.x),y:Math.round(i.y),width:Math.round(i.width),height:Math.round(i.height)})),this._canvas.addShape(o,n.parent)},Di.prototype._getConnectedElement=function(e,t){var n,i,r=e.$type;if(i=e[t+"Ref"],t==="source"&&r==="bpmn:DataInputAssociation"&&(i=i&&i[0]),(t==="source"&&r==="bpmn:DataOutputAssociation"||t==="target"&&r==="bpmn:DataInputAssociation")&&(i=e.$parent),n=i&&this._getElement(i),n)return n;throw i?Em(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 _R(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 bR(e){return v(e,"bpmn:Group")}const Sm={__depends__:[gR,{__depends__:[aa],bpmnImporter:["type",Di]}]};function sa(e){return{x:e.x+e.width/2,y:e.y+e.height/2}}function ti(e,t){return{x:e.x-t.x,y:e.y-t.y}}function bl(e){return Math.log(e)/Math.log(10)}var xR=1e3;function Q(e){this._eventBus=e}Q.$inject=["eventBus"];function wR(e,t){return function(n){return e.call(t||null,n.context,n.command,n)}}Q.prototype.on=function(e,t,n,i,r,o){if((Wt(t)||Pe(t))&&(o=r,r=i,i=n,n=t,t=null),Wt(n)&&(o=r,r=i,i=n,n=xR),Vt(r)&&(o=r,r=!1),!Wt(i))throw new Error("handlerFn must be a function");Ee(e)||(e=[e]);var a=this._eventBus;D(e,function(s){var c=["commandStack",s,t].filter(function(u){return u}).join(".");a.on(c,n,r?wR(i,o):i,o)})},Q.prototype.canExecute=Li("canExecute"),Q.prototype.preExecute=Li("preExecute"),Q.prototype.preExecuted=Li("preExecuted"),Q.prototype.execute=Li("execute"),Q.prototype.executed=Li("executed"),Q.prototype.postExecute=Li("postExecute"),Q.prototype.postExecuted=Li("postExecuted"),Q.prototype.revert=Li("revert"),Q.prototype.reverted=Li("reverted");function Li(e){return function(n,i,r,o,a){(Wt(n)||Pe(n))&&(a=o,o=r,r=i,i=n,n=null),this.on(n,e,i,r,o,a)}}var xl=["top","bottom","left","right"],Bs=10;function wl(e,t){Q.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(Os(r)&&!at(r)){var o=RR(r);o&&i(r,o)}}function i(r,o){var a=Se(r),s=r.label,c=Se(s);if(s.parent){var u=xe(r),l;switch(o){case"top":l={x:a.x,y:u.top-Bs-s.height/2};break;case"left":l={x:u.left-Bs-s.width/2,y:a.y};break;case"bottom":l={x:a.x,y:u.bottom+Bs+s.height/2};break;case"right":l={x:u.right+Bs+s.width/2,y:a.y};break}var f=ti(l,c);t.moveShape(s,f)}}}pe(wl,Q),wl.$inject=["eventBus","modeling"];function ER(e){var t=e.host,n=Se(e),i=Zt(n,t),r;i.indexOf("-")>=0?r=i.split("-"):r=[i];var o=xl.filter(function(a){return r.indexOf(a)===-1});return o}function SR(e){var t=Se(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 Rm(t,i)});return n}function RR(e){var t=Se(e.label),n=Se(e),i=Rm(n,t);if(CR(i)){var r=SR(e);if(e.host){var o=ER(e);r=r.concat(o)}var a=xl.filter(function(s){return r.indexOf(s)===-1});return a.indexOf(i)!==-1?Zt(e.label,e)!=="intersect"?void 0:i:a[0]}}function Rm(e,t){return Zt(t,e,5)}function CR(e){return xl.indexOf(e)!==-1}function El(e){Q.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)}pe(El,Q),El.$inject=["eventBus"];var PR=1500;function Sl(e,t,n){e.invoke(Q,this),this.preExecute("elements.delete",PR,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=He(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 D(o,u=>{const l=new Set(eo(uo(Array.from(s),Mt(u))));c=c.union(l),s=s.difference(l)}),Array.from(c)}}pe(Sl,Q),Sl.$inject=["injector","eventBus","canvas"];function Rl(e,t){e.invoke(Q,this),this.postExecute("shape.move",function(n){var i=n.newParent,r=n.shape,o=He(r.incoming.concat(r.outgoing),function(a){return v(a,"bpmn:Association")});D(o,function(a){t.moveConnection(a,{x:0,y:0},i)})},!0)}pe(Rl,Q),Rl.$inject=["injector","modeling"];function yo(e,t){for(wn(t)&&(t=[t]);e=e.parent;)if(Fe(e,t))return e;return null}function Cm(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 Ut(n);if(Fe(e,i))return Ut(e);var r;for(r=ee(e);r&&!v(r,"bpmn:Process");r=r.$parent);if(!t)return!0;var o=t.find(function(a){var s=ee(a);return s&&s.get("processRef")===r});return o?Ut(o):!0}var Pm=500;function $s(e,t){t.invoke(Q,this),this._bpmnReplace=e;var n=this;this.postExecuted("elements.create",Pm,function(i){var r=i.elements;r=r.filter(function(o){var a=o.host;return Am(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",Pm,function(i){var r=i.shapes,o=i.newHost;if(r.length===1){var a=r[0];Am(a,o)&&(i.shapes=[n._replaceShape(a,o)])}},!0)}$s.$inject=["bpmnReplace","injector"],pe($s,Q),$s.prototype._replaceShape=function(e,t){var n=AR(e),i={type:"bpmn:BoundaryEvent",host:t};return n&&(i.eventDefinitionType=n.$type),this._bpmnReplace.replaceElement(e,i,{layoutConnection:!1})};function AR(e){var t=ee(e),n=t.eventDefinitions;return n&&n[0]}function Am(e,t){return!$e(e)&&Fe(e,["bpmn:IntermediateThrowEvent","bpmn:IntermediateCatchEvent"])&&!!t}function Cl(e,t){Q.call(this,e);function n(i){return He(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")&&D(o.outgoing,function(a){var s=a.target,c=n(s);v(s,"bpmn:ReceiveTask")&&c.length>0&&t.removeElements(c)})})}Cl.$inject=["eventBus","modeling"],pe(Cl,Q);function Tm(e){return e.create("bpmn:Category")}function TR(e){return e.create("bpmn:CategoryValue")}function Mm(e,t){var n=t.get("categoryValueRef");return n||(n=t.categoryValueRef=TR(e)),n.$parent||(n.$parent=Tm(e)),n}function MR(e,t,n){return St(t.get("categoryValue"),e),e.$parent=t,St(n.get("rootElements"),t),t.$parent=n,e}function kR(e){var t=e.$parent;return t&&(wt(t.get("categoryValue"),e),e.$parent=null),e}function OR(e){var t=e.$parent;return t&&(wt(t.get("rootElements"),e),e.$parent=null),e}var DR=500;function Pl(e,t,n){n.invoke(Q,this);function i(c){return t.filter(function(u){return v(u,"bpmn:Group")&&!u.labelTarget}).map(ee).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&&MR(c,u,e.getDefinitions())}function s(c,u,l){u&&!o(u,l)&&OR(u),c&&!r(c,l)&&kR(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,ee(u))},!0),this.executed(["shape.move","shape.resize"],DR,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,ee(u))},!0),this.executed("group.updateRefs",function(c){km(c).forEach(function(u){a(u.categoryValue,u.category)})},!0),this.reverted("group.updateRefs",function(c){km(c).forEach(function(u){s(u.categoryValue,u.category,ee(u.groupShape))})},!0),this.executed("shape.delete",function(c){var u=c.shape;!v(u,"bpmn:Group")||u.labelTarget||s(c.categoryValue,c.category,ee(u))},!0),this.reverted("shape.delete",function(c){var u=c.shape;!v(u,"bpmn:Group")||u.labelTarget||a(c.categoryValue,c.category)},!0)}Pl.$inject=["bpmnjs","elementRegistry","injector"],pe(Pl,Q);function km(e){var t;return((t=e.updates)==null?void 0:t.groups)||[]}function Al(e,t,n){Q.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 S=g.source,E=g.target;vo(S)&&ca(E)&&l(E)}function r(g){const S=g.connection,E=g.source,x=g.target;vo(E)&&js(x)&&(u(x),p(E,[S]))}function o(g){const S=g.newTarget,E=g.oldSource,x=g.oldTarget;if(x!==S){const w=E;ca(x)&&l(x),vo(w)&&js(S)&&u(S)}}function a(g){const{element:S}=g;ca(S)?(f(S),d(S)):js(S)&&h(S)}function s(g){const{newData:S,oldShape:E}=g;if(vo(g.oldShape)&&S.eventDefinitionType!=="bpmn:CompensateEventDefinition"||S.type!=="bpmn:BoundaryEvent"){const x=E.outgoing.find(({target:w})=>ca(w));x&&x.target&&(g._connectionTarget=x.target)}else if(!vo(g.oldShape)&&S.eventDefinitionType==="bpmn:CompensateEventDefinition"&&S.type==="bpmn:BoundaryEvent"){const x=E.outgoing.find(({target:w})=>js(w));x&&x.target&&(g._connectionTarget=x.target),m(E)}}function c(g){const{_connectionTarget:S,newShape:E}=g;S&&t.connect(E,S)}function u(g){t.updateProperties(g,{isForCompensation:!0})}function l(g){t.updateProperties(g,{isForCompensation:void 0})}function f(g){for(const S of g.incoming)n.canConnect(S.source,g)||t.removeConnection(S);for(const S of g.outgoing)n.canConnect(g,S.target)||t.removeConnection(S)}function p(g,S){g.outgoing.filter(w=>v(w,"bpmn:Association")).filter(w=>ca(w.target)&&!S.includes(w)).forEach(w=>t.removeConnection(w))}function d(g){const S=g.attachers.slice();S.length&&t.removeElements(S)}function h(g){const S=g.incoming.filter(E=>vo(E.source));t.removeElements(S)}function m(g){const S=g.outgoing.filter(E=>v(E,"bpmn:SequenceFlow"));t.removeElements(S)}}pe(Al,Q),Al.$inject=["eventBus","modeling","bpmnRules"];function ca(e){const t=ee(e);return t&&t.get("isForCompensation")}function vo(e){return e&&v(e,"bpmn:BoundaryEvent")&&ho(e,"bpmn:CompensateEventDefinition")}function js(e){return e&&v(e,"bpmn:Activity")&&!un(e)}function Tl(e){e.invoke(Q,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"))})}Tl.$inject=["injector"],pe(Tl,Q);function Ml(e,t){Q.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}})}Ml.$inject=["eventBus","bpmnFactory"],pe(Ml,Q);var kl=20,Ol=20,Om=30,Fs=2e3;function Dl(e,t,n){Q.call(this,t),t.on(["create.start","shape.move.start"],Fs,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")&&!$e(f)&&!at(f)});if(c.length){var u=Mt(c),l=LR(a,u);j(a,l),o.createConstraints=IR(a,u)}}}),t.on("create.start",Fs,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",Fs,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",Fs,function(r){var o=r.elements,a=r.parent,s=NR(o),c;s&&v(a,"bpmn:Process")&&(r.parent=i(),c=r.hints=r.hints||{},c.participant=s,c.process=a,c.processRef=ee(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=ee(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)&&ee(s).set("processRef",ee(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)&&ee(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)}Dl.$inject=["canvas","eventBus","modeling"],pe(Dl,Q);function LR(e,t){t={width:t.width+kl*2+Om,height:t.height+Ol*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 IR(e,t){return t=xe(t),{bottom:t.top+e.height/2-Ol,left:t.right-e.width/2+kl,top:t.bottom-e.height/2+Ol,right:t.left+e.width/2-kl-Om}}function NR(e){return ut(e,function(t){return v(t,"bpmn:Participant")})}var Dm="__targetRef_placeholder";function Ll(e,t){Q.call(this,e),this.executed(["connection.create","connection.delete","connection.move","connection.reconnect"],Lm(o)),this.reverted(["connection.create","connection.delete","connection.move","connection.reconnect"],Lm(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===Dm});return!u&&s&&(u=t.create("bpmn:Property",{name:Dm}),St(c,u)),u}function r(a,s){var c=i(a);c&&(n(a,c,s)||wt(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,S;m&&m!==f&&r(m,u),d&&d!==f&&r(d,u),f?(S=i(f,!0),g.targetRef=S):g.targetRef=null}}Ll.$inject=["eventBus","bpmnFactory"],pe(Ll,Q);function Lm(e){return function(t){var n=t.context,i=n.connection;if(v(i,"bpmn:DataInputAssociation"))return e(t)}}function Hs(e){this._bpmnUpdater=e}Hs.$inject=["bpmnUpdater"],Hs.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),[]},Hs.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 Il(e,t,n,i){Q.call(this,i),t.registerHandler("dataStore.updateContainment",Hs);function r(){return n.filter(function(s){return v(s,"bpmn:Participant")&&ee(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:Xe(s),newSemanticParent:l.processRef||l,newDiParent:Xe(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:$R(l,"bpmn:Participant");a(u,p)}}),this.postExecute("shape.delete",function(s){var c=s.context,u=c.shape,l=e.getRootElement();Fe(u,["bpmn:Participant","bpmn:SubProcess"])&&v(l,"bpmn:Collaboration")&&o(l).filter(function(f){return BR(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)})})}Il.$inject=["canvas","commandStack","elementRegistry","eventBus"],pe(Il,Q);function BR(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 $R(e,t){for(;e.parent;){if(v(e.parent,t))return e.parent;e=e.parent}}var zs=Math.max,Gs=Math.min,jR=20;function Im(e,t){return{top:e.top-t.top,right:e.right-t.right,bottom:e.bottom-t.bottom,left:e.left-t.left}}function FR(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 HR(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 Vs(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)?Gs:zs)(i,r)),Pe(o)&&(i=(/top|left/.test(e)?zs:Gs)(i,o)),i}function zR(e,t){if(!t)return e;var n=xe(e);return Cs({top:Vs("top",n,t),right:Vs("right",n,t),bottom:Vs("bottom",n,t),left:Vs("left",n,t)})}function GR(e,t,n,i){var r=xe(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?xe(i):o,s={top:Gs(o.top,a.top),left:Gs(o.left,a.left),bottom:zs(o.bottom,a.bottom),right:zs(o.right,a.right)};return Cs(s)}function ua(e,t){return typeof e<"u"?e:jR}function VR(e,t){var n,i,r,o;return typeof t=="object"?(n=ua(t.left),i=ua(t.right),r=ua(t.top),o=ua(t.bottom)):n=i=r=o=ua(t),{x:e.x-n,y:e.y-r,width:e.width+n+i,height:e.height+r+o}}function WR(e){return!(e.waypoints||e.type==="label")}function Nm(e,t){var n;if(e.length===void 0?n=He(e.children,WR):n=e,n.length)return VR(Mt(n),t)}var rr=Math.abs;function UR(e,t){return Im(xe(t),xe(e))}var qR=["bpmn:Participant","bpmn:Process","bpmn:SubProcess"],zn=30;function Ws(e,t){return t=t||[],e.children.filter(function(n){v(n,"bpmn:Lane")&&(Ws(n,t),t.push(n))}),t}function or(e){return e.children.filter(function(t){return v(t,"bpmn:Lane")})}function Gn(e){return yo(e,qR)||e}function YR(e,t){var n=Gn(e),i=v(n,"bpmn:Process")?[]:[n],r=Ws(n,i),o=xe(e),a=xe(t),s=UR(e,t),c=[],u=Ut(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=xe(l);s.top&&(rr(m.bottom-o.top)<10&&(d=a.top-m.bottom),rr(m.top-o.top)<5&&(f=a.top-m.top)),s.left&&(rr(m.right-o.left)<10&&(p=a.left-m.right),rr(m.left-o.left)<5&&(h=a.left-m.left)),s.bottom&&(rr(m.top-o.bottom)<10&&(f=a.bottom-m.top),rr(m.bottom-o.bottom)<5&&(d=a.bottom-m.bottom)),s.right&&(rr(m.left-o.right)<10&&(h=a.right-m.left),rr(m.right-o.right)<5&&(p=a.right-m.right)),(f||p||d||h)&&c.push({shape:l,newBounds:HR(l,{top:f,right:p,bottom:d,left:h})})}}),c}var KR=500;function Nl(e,t){Q.call(this,e);function n(i,r){var o=Ut(i),a=or(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))})}Nl.$inject=["eventBus","spaceTool"],pe(Nl,Q);var Bm=500;function Us(e,t){t.invoke(Q,this),this._bpmnReplace=e;var n=this;this.postExecuted("elements.create",Bm,function(i){var r=i.elements;r.filter(function(o){var a=o.host;return $m(o,a)}).map(function(o){return r.indexOf(o)}).forEach(function(o){i.elements[o]=n._replaceShape(r[o])})},!0),this.preExecute("elements.move",Bm,function(i){var r=i.shapes,o=i.newHost;r.forEach(function(a,s){var c=a.host;$m(a,ZR(r,c)?c:o)&&(r[s]=n._replaceShape(a))})},!0)}Us.$inject=["bpmnReplace","injector"],pe(Us,Q),Us.prototype._replaceShape=function(e){var t=XR(e),n;return t?n={type:"bpmn:IntermediateCatchEvent",eventDefinitionType:t.$type}:n={type:"bpmn:IntermediateThrowEvent"},this._bpmnReplace.replaceElement(e,n,{layoutConnection:!1})};function XR(e){var t=ee(e),n=t.eventDefinitions;return n&&n[0]}function $m(e,t){return!$e(e)&&v(e,"bpmn:BoundaryEvent")&&!t}function ZR(e,t){return e.indexOf(t)!==-1}var qs=Math.round,QR=Math.max;function JR(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 eC(e){var t=[];return e.forEach(function(n,i){t.push([i===0?"M":"L",n.x,n.y])}),t}var jm=10;function tC(e,t){var n,i;for(n=0;i=e[n];n++)if(Jo(i,t)<=jm)return{point:e[n],bendpoint:!0,index:n};return null}function nC(e,t){var n=Vh(JR(t,jm),eC(e)),i=n[0],r=n[n.length-1],o;return i?i!==r?i.segment2!==r.segment2?(o=QR(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 Bl(e,t){return tC(e,t)||nC(e,t)}function $l(e,t,n){Q.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(),S;Pe(a.width)?S=Se(a):S=a;var E=Bl(s,S);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]:S,(c.length===1||!Fm(r,c[c.length-1]))&&c.push(Hm(l)),(u.length===1||!Fm(r,u[0]))&&u.unshift(Hm(l))}f=o.source,p=o.target,t.canConnect(f,r,o)&&(n.reconnectEnd(o,r,c||S),d=o),t.canConnect(r,p,o)&&(d?h=n.connect(r,p,{type:o.type,waypoints:u}):(n.reconnectStart(o,r,u||S),h=o));var x=[].concat(d&&He(g,function(w){return w.source===d.source})||[],h&&He(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=Se(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&&Bl(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)}pe($l,Q),$l.$inject=["eventBus","bpmnRules","modeling"];function Fm(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 Hm(e){return j({},e)}function jl(e,t){Q.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)})})}})}jl.$inject=["eventBus","modeling"],pe(jl,Q);function _o(e){return v(e,"bpmn:SequenceFlow")}var Ys=1500,zm=2e3;function Gm(e,t,n){t.on(["create.hover","create.move","create.out","create.end","shape.move.hover","shape.move.move","shape.move.out","shape.move.end"],Ys,function(i){var r=i.context,o=r.shape||i.shape,a=i.hover;v(a,"bpmn:Lane")&&!Fe(o,["bpmn:Lane","bpmn:Participant"])&&(i.hover=Gn(a),i.hoverGfx=e.getGraphics(i.hover));var s=n.getRootElement();a&&a!==s&&(o.labelTarget||Fe(o,["bpmn:Group","bpmn:TextAnnotation"]))&&(i.hover=s,i.hoverGfx=e.getGraphics(i.hover))}),t.on(["connect.hover","connect.out","connect.end","connect.cleanup","global-connect.hover","global-connect.out","global-connect.end","global-connect.cleanup"],Ys,function(i){var r=i.hover;v(r,"bpmn:Lane")&&(i.hover=Gn(r)||r,i.hoverGfx=e.getGraphics(i.hover))}),t.on(["bendpoint.move.hover"],Ys,function(i){var r=i.context,o=i.hover,a=r.type;v(o,"bpmn:Lane")&&/reconnect/.test(a)&&(i.hover=Gn(o)||o,i.hoverGfx=e.getGraphics(i.hover))}),t.on(["connect.start"],Ys,function(i){var r=i.context,o=r.start;v(o,"bpmn:Lane")&&(r.start=Gn(o)||o)}),t.on("shape.move.start",zm,function(i){var r=i.shape;v(r,"bpmn:Lane")&&(i.shape=Gn(r)||r)}),t.on("spaceTool.move",zm,function(i){var r=i.hover;r&&v(r,"bpmn:Lane")&&(i.hover=Gn(r))})}Gm.$inject=["elementRegistry","eventBus","canvas"];var Vm=770;function Fl(e,t,n,i){n.invoke(Q,this);function r(s,c){var u=ee(s),l=c.categoryValue||u.categoryValueRef;l||(l=Mm(e,u));var f=c.category||l.$parent||Tm(e);u.categoryValueRef=l,l.$parent=f,c.categoryValue=l,c.category=f}function o(s,c){var u=ee(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=ee(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=ee(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&&!ee(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&&!ee(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||ee(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",Vm,function(s){var c=s.descriptor,u=s.element;if(!(!v(u,"bpmn:Group")||u.labelTarget)){var l=ee(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",Vm,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})}Fl.$inject=["bpmnFactory","eventBus","injector","moddleCopy"],pe(Fl,Q);function Hl(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 Wm(e){function t(i,r,o){var a={x:o.x,y:o.y-50},s={x:o.x-50,y:o.y},c=Hl(i,r,o,a),u=Hl(i,r,o,s),l;c&&u?Um(c,o)>Um(u,o)?l=u:l=c:l=c||u,i.original=l}function n(i){var r=i.waypoints;t(r[0],r[1],Se(i.source)),t(r[r.length-1],r[r.length-2],Se(i.target))}e.on("bpmnElement.added",function(i){var r=i.element;r.waypoints&&n(r)})}Wm.$inject=["eventBus"];function Um(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function zl(e){Q.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=ee(i),o=Xe(i);if(Fe(r,t)){var a=o.get("isHorizontal");a===void 0&&(a=!0),o.set("isHorizontal",a)}})}zl.$inject=["eventBus"],pe(zl,Q);function qm(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}function Ym(e){return Math.atan((e[1].y-e[0].y)/(e[1].x-e[0].x))}function iC(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 rC(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 Gl(e,t){var n=t[0],i=t[1],r={x:i.x-n.x,y:i.y-n.y},o=rC([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 Km(e,t){var n=Gl(e,t),i={x:n.x-e.x,y:n.y-e.y};return qm(i)}function la(e,t){return qm({x:e.x-t.x,y:e.y-t.y})}var Xm=Math.sqrt,Zm=Math.min,oC=Math.max,Qm=Math.abs;function Jm(e){return Math.pow(e,2)}function pa(e,t){return Xm(Jm(e.x-t.x)+Jm(e.y-t.y))}function aC(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],tg(i,r)?u=[i]:(o=pa(e,i),a=pa(e,r),c=Zm(o,a),u=sC(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:tg(i,u[0])?n:n+1}),u.length===2&&(s=uC(u[0],u[1]),l={type:"segment",position:s,segmentIndex:n,relativeLocation:pa(i,s)/pa(i,r)}),f=pa(l.position,e),(!d||p>f)&&(d=l,p=f)}return d}function sC(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=Xm(d),m=-f+h,g=-f-h,S={x:e.x-r*m,y:e.y-o*m};if(d===0)return[S];var E={x:e.x-r*g,y:e.y-o*g};return[S,E].filter(function(x){return cC(x,e,t)})}function cC(e,t,n){return eg(e.x,t.x,n.x)&&eg(e.y,t.y,n.y)}function eg(e,t,n){return e>=Zm(t,n)-Ks&&e<=oC(t,n)+Ks}function uC(e,t){return{x:(e.x+t.x)/2,y:(e.y+t.y)/2}}var Ks=.1;function tg(e,t){return Qm(e.x-t.x)<=Ks&&Qm(e.y-t.y)<=Ks}function lC(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=ig(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 ng(e,t,n,i){var r=0,o=0,a={point:e,delta:{x:0,y:0}},s=aC(e,n),c=s.segmentIndex,u=lC(n,t,s,i);if(u<0||u>t.length-2||u===null)return a;var l=rg(n,c),f=rg(t,u),p=s.position,d=fC(l,p),h=pC(l,f);if(s.type==="bendpoint"){var m=t.length-n.length,g=s.bendpointIndex,S=n[g];if(t.indexOf(S)!==-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=ig(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=iC({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 ig(e,t){var n=la(e[t-1],e[t]),i=la(e[t],e[t+1]),r=n/(n+i);return r}function pC(e,t){var n=Ym(e),i=Ym(t);return i-n}function rg(e,t){return[e[t],e[t+1]]}function fC(e,t){var n=la(e[0],e[1]),i=la(e[0],t);return n===0?0:i/n}function dC(e,t,n,i){var r=Se(e);return ng(r,t,n,i).delta}function fa(e,t,n){var i=sa(t),r=sa(n),o=ti(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 og(e,t,n){var i=sa(e),r=sa(t),o=sa(n),a=ti(e,i),s=ti(i,r),c=hC(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 hC(e,t,n){var i=xe(t),r=xe(n);if(mC(i,r))return null;var o=Zt(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=Zt(n,s),c!==o?null:a}function mC(e,t){return gC(e,t)||yC(e,t)}function gC(e,t){return e.right!==t.right&&e.left!==t.left}function yC(e,t){return e.top!==t.top&&e.bottom!==t.bottom}var ag="name",sg="text";function Vl(e,t,n,i){Q.call(this,e),this.postExecute("element.updateProperties",r),this.postExecute("element.updateModdleProperties",a=>{ee(a.context.element)===a.context.moddleElement&&r(a)});function r(a){var s=a.context,c=s.element,u=s.properties;if(ag in u&&t.updateLabel(c,u[ag]),sg in u&&v(c,"bpmn:TextAnnotation")){var l=i.getTextAnnotationBounds({x:c.x,y:c.y,width:c.width,height:c.height},u[sg]||"");t.updateLabel(c,u.text,l)}}this.postExecute(["shape.create","connection.create"],function(a){var s=a.context,c=s.hints||{};if(c.createElementsBehavior!==!1){var u=s.shape||s.connection;$e(u)||!ir(u)||Bn(u)&&t.updateLabel(u,Bn(u))}}),this.postExecute("shape.delete",function(a){var s=a.context,c=s.labelTarget,u=s.hints||{};c&&u.unsetLabel!==!1&&t.updateLabel(c,null,null,{removeShape:!1})});function o(a){var s=a.context,c=s.connection,u=c.label,l=j({},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),dC(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=ee(c);l&&ir(l)&&u.label&&c.label&&(c.label.x=u.label.x,c.label.y=u.label.y)}),this.preExecute("shape.resize",function(a){var s=a.context,c=s.shape,u=s.hints||{};if(!(!$e(c)||u.autoResize)){var l=s.newBounds,f=i.getDimensions(Bn(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(Os(c)){var f=c.label,p=Se(f),d=bC(l),h=_C(p,d),m=vC(h,l,u);t.moveShape(f,m)}})}pe(Vl,Q),Vl.$inject=["eventBus","modeling","bpmnFactory","textRenderer"];function vC(e,t,n){var i=fa(e,t,n);return ki(ti(i,e))}function _C(e,t){if(t.length){var n=xC(e,t);return Gl(e,n)}}function bC(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 xC(e,t){var n=t.map(function(r){return{line:r,distance:Km(e,r)}}),i=ri(n,"distance");return i[0].line}function wC(e,t,n,i){return ng(e,t,n,i).point}function Wl(e,t){Q.call(this,e);function n(i,r){var o=i.context,a=o.connection,s=j({},o.hints),c=o.newWaypoints||a.waypoints,u=o.oldWaypoints;return typeof s.startChanged>"u"&&(s.startChanged=!!s.connectionStart),typeof s.endChanged>"u"&&(s.endChanged=!!s.connectionEnd),wC(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)})})}pe(Wl,Q),Wl.$inject=["eventBus","modeling"];function Xs(e,t,n){var i=Qs(e),r=ug(i,t),o=i[0];return r.length?r[r.length-1]:fa(o.original||o,n,t)}function Zs(e,t,n){var i=Qs(e),r=ug(i,t),o=i[i.length-1];return r.length?r[0]:fa(o.original||o,n,t)}function Ul(e,t,n){var i=Qs(e),r=cg(t,n),o=i[0];return fa(o.original||o,r,t)}function ql(e,t,n){var i=Qs(e),r=cg(t,n),o=i[i.length-1];return fa(o.original||o,r,t)}function cg(e,t){return{x:e.x-t.x,y:e.y-t.y,width:e.width,height:e.height}}function Qs(e){var t=e.waypoints;if(!t.length)throw new Error("connection#"+e.id+": no waypoints");return t}function ug(e,t){var n=on(e,SC);return He(n,function(i){return EC(i,t)})}function EC(e,t){return Zt(t,e,1)==="intersect"}function SC(e){return e.original||e}function Yl(e,t){Q.call(this,e),this.postExecute("shape.replace",function(n){var i=n.oldShape,r=n.newShape;if(RC(i,r)){var o=CC(i);o.incoming.forEach(function(a){var s=Zs(a,r,i);t.reconnectEnd(a,r,s)}),o.outgoing.forEach(function(a){var s=Xs(a,r,i);t.reconnectStart(a,r,s)})}},!0)}Yl.$inject=["eventBus","modeling"],pe(Yl,Q);function RC(e,t){return v(e,"bpmn:Participant")&&We(e)&&v(t,"bpmn:Participant")&&!We(t)}function CC(e){var t=Zo([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 PC=["bpmn:MessageEventDefinition","bpmn:TimerEventDefinition","bpmn:EscalationEventDefinition","bpmn:ConditionalEventDefinition","bpmn:SignalEventDefinition"];function lg(e){const t=ee(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:PC.some(i=>v(n[0],i))}function pg(e){return v(e,"bpmn:BoundaryEvent")?"cancelActivity":"isInterrupting"}function Kl(e,t){e.invoke(Q,this),this.postExecuted("shape.replace",function(n){const i=n.context.oldShape,r=n.context.newShape,o=n.context.hints;if(!lg(r))return;const a=pg(r);if(o.targetElement&&o.targetElement[a]!==void 0)return;const c=ee(i).get(a),u=ee(r).get(a);c!==u&&t.updateProperties(r,{[a]:c})})}Kl.$inject=["injector","modeling"],pe(Kl,Q);function Xl(e,t){Q.call(this,e),this.preExecute("shape.resize",function(n){var i=n.shape,r=Xe(i),o=r&&r.get("label"),a=o&&o.get("bounds");a&&t.updateModdleProperties(i,o,{bounds:void 0})},!0)}pe(Xl,Q),Xl.$inject=["eventBus","modeling"];function Zl(e,t,n){Q.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=AC(o.waypoints,a.waypoints);n.reconnectEnd(o,a.target,s)}}})}pe(Zl,Q),Zl.$inject=["eventBus","bpmnRules","modeling"];function bo(e){return e.original||e}function AC(e,t){var n=Hl(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 Ql(e,t){Q.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)}Ql.$inject=["eventBus","modeling"],pe(Ql,Q);function Jl(e,t,n,i){Q.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;D(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})})}pe(Jl,Q),Jl.$inject=["eventBus","modeling","bpmnRules","injector"];function Js(e,t,n,i,r,o){i.invoke(Q,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=[];D(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})})}pe(Js,Q),Js.prototype._replaceElements=function(e,t){var n=this._elementRegistry,i=this._bpmnReplace,r=this._selection;D(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)},Js.$inject=["bpmnReplace","bpmnRules","elementRegistry","injector","modeling","selection"];var TC=1500,MC={width:140,height:120},ep={width:300,height:60},tp={width:60,height:300},ec={width:300,height:150},tc={width:150,height:300},fg={width:140,height:120},dg={width:100,height:40};function hg(e){e.on("resize.start",TC,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=IC(i,r,o)),v(i,"bpmn:SubProcess")&&We(i)&&(n.minDimensions=fg),v(i,"bpmn:TextAnnotation")&&(n.minDimensions=dg)})}hg.$inject=["eventBus"];var ar=Math.abs,kC=Math.min,OC=Math.max;function mg(e,t,n,i){var r=e[t];e[t]=r===void 0?n:i(n,r)}function xo(e,t,n){return mg(e,t,n,kC)}function wo(e,t,n){return mg(e,t,n,OC)}var DC={top:20,left:50,right:20,bottom:20},LC={top:50,left:20,right:20,bottom:20};function IC(e,t,n){var i=Gn(e),r=!0,o=!0,a=Ws(i,[i]),s=xe(e),c={},u={},l=Ut(e),f=l?ep:tp;/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=xe(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&&ar(s.top-m.bottom)<10&&wo(c,"top",m.top+f.height),ar(s.top-m.top)<5&&xo(u,"top",m.bottom-f.height)),/e/.test(t)&&(n&&ar(s.right-m.left)<10&&xo(c,"right",m.right-f.width),ar(s.right-m.right)<5&&wo(u,"right",m.left+f.width)),/s/.test(t)&&(n&&ar(s.bottom-m.top)<10&&xo(c,"bottom",m.bottom-f.height),ar(s.bottom-m.bottom)<5&&wo(u,"bottom",m.top+f.height)),/w/.test(t)&&(n&&ar(s.left-m.right)<10&&wo(c,"left",m.left+f.width),ar(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?DC:LC;return p.forEach(function(h){var m=xe(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 gg(e){!e||typeof e.stopPropagation!="function"||e.stopPropagation()}function Eo(e){return e.originalEvent||e.srcEvent}function np(e){gg(e),gg(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 yg(){return/mac/i.test(navigator.platform)}function vg(e,t){return(Eo(e)||e).button===t}function sr(e){return vg(e,0)}function NC(e){return vg(e,1)}function da(e){var t=Eo(e)||e;return sr(e)?yg()?t.metaKey:t.ctrlKey:!1}function nc(e){var t=Eo(e)||e;return sr(e)&&t.shiftKey}var _g=1001;function bg(e,t){e.on("resize.start",_g+500,function(n){var i=n.context,r=i.shape;(v(r,"bpmn:Lane")||v(r,"bpmn:Participant"))&&(i.balanced=!da(n))}),e.on("resize.end",_g,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=Kh(a),t.resizeLane(r,a,i.balanced)),!1})}bg.$inject=["eventBus","modeling"];var BC=500;function ip(e,t,n,i,r){n.invoke(Q,this);function o(l){return Fe(l,["bpmn:ReceiveTask","bpmn:SendTask"])||$C(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(Fe(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(Fe(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=ee(f),d=c(p),h;d&&!a(d)&&(h=e.getDefinitions().get("rootElements"),St(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");wt(p,f)}},!0),t.on("copyPaste.copyElement",function(l){var f=l.descriptor,p=l.element;if(!(p.labelTarget||!o(p))){var d=ee(p),h=c(d);h&&(f.referencedRootElement=h)}}),t.on("copyPaste.pasteElement",BC,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)})}ip.$inject=["bpmnjs","eventBus","injector","moddleCopy","bpmnFactory"],pe(ip,Q);function $C(e,t){return Ee(t)||(t=[t]),Ui(t,function(n){return ho(e,n)})}var xg=Math.max;function wg(e){e.on("spaceTool.getMinDimensions",function(t){var n=t.shapes,i=t.axis,r=t.start,o={};return D(n,function(a){var s=a.id;v(a,"bpmn:Participant")&&(o[s]=FC(a,i,r)),v(a,"bpmn:Lane")&&(o[s]=Ut(a)?ep:tp),v(a,"bpmn:SubProcess")&&We(a)&&(o[s]=fg),v(a,"bpmn:TextAnnotation")&&(o[s]=dg),v(a,"bpmn:Group")&&(o[s]=MC)}),o})}wg.$inject=["eventBus"];function jC(e){return e==="x"}function FC(e,t,n){var i=Ut(e);if(!GC(e))return i?ec:tc;var r=jC(t),o={};return r?i?o=ec:o={width:zC(e,n,r),height:tc.height}:i?o={width:ec.width,height:HC(e,n,r)}:o=tc,o}function HC(e,t,n){var i;return i=VC(e,t,n),xg(ec.height,i)}function zC(e,t,n){var i;return i=WC(e,t,n),xg(tc.width,i)}function GC(e){return!!or(e).length}function VC(e,t,n){var i=or(e),r;return r=rp(i,t,n),e.height-r.height+ep.height}function WC(e,t,n){var i=or(e),r;return r=rp(i,t,n),e.width-r.width+tp.width}function rp(e,t,n){var i,r,o;for(i=0;i<e.length;i++)if(r=e[i],!n&&t>=r.y&&t<=r.y+r.height||n&&t>=r.x&&t<=r.x+r.width)return o=or(r),o.length?rp(o,t,n):r}var Eg="_plane";function Sg(e){var t=e.id;return UC(t)}function mi(e){var t=e.id;return v(e,"bpmn:SubProcess")?Rg(t):t}function jr(e){return Rg(e)}function ic(e){var t=Xe(e);return v(t,"bpmndi:BPMNPlane")}function Rg(e){return e+Eg}function UC(e){return e.replace(new RegExp(Eg+"$"),"")}var Cg=400,qC=600,Pg={x:180,y:160};function Ii(e,t,n,i,r,o,a){Q.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")&&!We(f)}function u(f){var p=f.shape,d=f.newRootElement,h=ee(p);d=s._addDiagram(d||h),f.newRootElement=e.addRootElement(d)}function l(f){var p=f.shape,d=ee(p);s._removeDiagram(d);var h=f.newRootElement=a.get(mi(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;D(p,function(d){if(c(d)){var h=a.get(mi(d));if(!(!h||!d.children||!d.children.length)){var m=Ag(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")||!We(p)||D(ia([p]),d=>{n.removeShape(d.annotation)})},!0),this.preExecuted("shape.delete",function(f){var p=f.shape;if(c(p)){var d=a.get(mi(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(mi(p)))},!0),this.postExecuted("shape.replace",function(f){var p=f.newShape,d=f.oldRoot,h=e.findRoot(mi(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(ic(p)){a.updateId(p,jr(g)),a.updateId(m,g);return}var S=a.get(jr(m));S&&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(ic(p)){a.updateId(p,jr(m)),a.updateId(g,m);return}var S=a.get(jr(g));S&&a.updateId(S,jr(m))}}},!0),t.on("element.changed",function(f){var p=f.element;if(ic(p)){var d=p,h=a.get(Sg(d));!h||h===d||t.fire("element.changed",{element:h})}}),this.executed("shape.toggleCollapse",Cg,function(f){var p=f.shape;v(p,"bpmn:SubProcess")&&(We(p)?l(f):(u(f),s._showRecursively(p.children)))},!0),this.reverted("shape.toggleCollapse",Cg,function(f){var p=f.shape;v(p,"bpmn:SubProcess")&&(We(p)?l(f):(u(f),s._showRecursively(p.children)))},!0),this.postExecuted("shape.toggleCollapse",qC,function(f){var p=f.shape;if(v(p,"bpmn:SubProcess")){var d=f.newRootElement;if(d)if(We(p))s._moveChildrenToShape(d.children.slice(),p),D(ia(p.children),m=>{n.moveShape(m.annotation,{x:0,y:0},p.parent),D(m.associations,g=>{n.moveConnection(g,{x:0,y:0},p.parent)})});else{s._disconnectSharedAnnotations(p);var h=Ag(p);s._moveChildrenToShape(h,d)}}},!0),t.on("copyPaste.createTree",function(f){var p=f.element,d=f.children;if(c(p)){var h=mi(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(Xe(m),"bpmndi:BPMNPlane");if(g){var S=Sg(m),E=ut(h,function(x){return x.id===S});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)})}pe(Ii,Q),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:Pg.x-r.x,y:Pg.y-r.y};else{var a=Se(t),s=Se(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(vm(e).map(i=>i.annotation));n.size&&D(ia(e.children),i=>{n.has(i.annotation)&&D(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:mi(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 YC(e){var t=[];return D(ia(e),n=>{t.push(n.annotation),t.push.apply(t,n.associations)}),t}function Ag(e){return e.children.slice().concat(YC(e.children)).concat(KC(e))}function KC(e){return ul(e.children||[]).reduce(function(t,n){return n.label&&n.label.parent!==e&&t.push(n.label),t},[])}function op(e,t){e.invoke(Q,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"))||!We(r))){var o=XC(r);t.createShape({type:"bpmn:StartEvent"},o,r)}})}op.$inject=["injector","modeling"],pe(op,Q);function XC(e){return{x:e.x+e.width/6,y:e.y+e.height/2}}function ap(e,t){Q.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,Bn(r)||""),c=a.y!==r.y&&Math.abs(a.y+a.height-(r.y+r.height))<=1,u=r.y+r.height;i.newBounds={width:a.width,height:s.height,x:a.x,y:c?u-s.height:a.y}}})}pe(ap,Q),ap.$inject=["eventBus","textRenderer"];function sp(e,t){Q.call(this,e),this.postExecuted("shape.toggleCollapse",1500,function(n){var i=n.shape;if(We(i))return;var r=Zo(i);r.forEach(function(a){var s=a.incoming.slice(),c=a.outgoing.slice();D(s,function(u){o(u,!0)}),D(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,Se(i)):t.reconnectStart(a,i,Se(i)))}},!0)}pe(sp,Q),sp.$inject=["eventBus","modeling"];var cp=500;function up(e,t,n){Q.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=ZC(c).concat([a]),f=Nm(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"],cp,function(a){var s=a.context,c=s.shape;v(c,"bpmn:SubProcess")&&(c.collapsed?Xe(c).isExpanded=!1:(i(c.children),Xe(c).isExpanded=!0))}),this.reverted(["shape.toggleCollapse"],cp,function(a){var s=a.context,c=s.shape;c.collapsed?Xe(c).isExpanded=!1:Xe(c).isExpanded=!0}),this.postExecuted(["shape.toggleCollapse"],cp,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"})})}pe(up,Q),up.$inject=["eventBus","elementFactory","modeling"];function ZC(e){return e.filter(function(t){return!t.hidden})}function lp(e,t,n,i){t.invoke(Q,this),this.preExecute("shape.delete",function(r){var o=r.context,a=o.shape,s=a.businessObject;$e(a)||(v(a,"bpmn:Participant")&&We(a)&&n.ids.unclaim(s.processRef.id),i.unclaimId(s.id,s))}),this.preExecute("connection.delete",function(r){var o=r.context,a=o.connection,s=a.businessObject;i.unclaimId(s.id,s)}),this.preExecute("canvas.updateRoot",function(){var r=e.getRootElement(),o=r.businessObject;v(r,"bpmn:Collaboration")&&n.ids.unclaim(o.id)})}pe(lp,Q),lp.$inject=["canvas","injector","moddle","modeling"];function pp(e,t){Q.call(this,e),this.preExecute("connection.delete",function(n){var i=n.context,r=i.connection,o=r.source;QC(r,o)&&t.updateProperties(o,{default:null})})}pe(pp,Q),pp.$inject=["eventBus","modeling"];function QC(e,t){if(!v(e,"bpmn:SequenceFlow"))return!1;var n=ee(t),i=ee(e);return n.get("default")===i}var JC=500,eP=5e3,Tg=["shape.create","shape.delete","shape.move","shape.resize"],Mg=[...Tg,"spaceTool","lane.add","lane.resize","lane.split","elements.create","elements.delete","elements.move"];function fp(e,t){Q.call(this,e);var n;function i(){return n=n||new tP,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(Mg,eP,function(){i()}),this.postExecuted(Mg,JC,function(){o()}),this.preExecute(Tg,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))})}fp.$inject=["eventBus","modeling"],pe(fp,Q);function tP(){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 nP=500,iP=5e3,kg=["connection.create","connection.delete","connection.layout","connection.move","connection.reconnect","connection.updateWaypoints","shape.create","shape.delete","shape.move","shape.resize"],Og=[...kg,"elements.create","elements.delete","elements.move","label.create","spaceTool"];function dp(e,t){Q.call(this,e);var n;function i(){return n=n||new rP,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(Og,iP,function(){i()}),this.postExecuted(Og,nP,function(){o()}),this.preExecute(kg,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)})}dp.$inject=["eventBus","modeling"],pe(dp,Q);function rP(){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 hp(e,t){Q.call(this,e),this.postExecuted("elements.create",function(n){const i=n.context,r=i.elements;for(const o of r)oP(o)&&!sP(o)&&t.updateProperties(o,{isForCompensation:void 0})})}pe(hp,Q),hp.$inject=["eventBus","modeling"];function oP(e){const t=ee(e);return t&&t.isForCompensation}function aP(e){return e&&v(e,"bpmn:BoundaryEvent")&&ho(e,"bpmn:CompensateEventDefinition")}function sP(e){return e.incoming.filter(n=>aP(n.source)).length>0}const cP={__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",wl],appendBehavior:["type",El],associationBehavior:["type",Rl],attachEventBehavior:["type",$s],artifactBehavior:["type",Sl],boundaryEventBehavior:["type",Cl],categoryRootElementReferenceBehavior:["type",Pl],compensateBoundaryEventBehaviour:["type",Al],createBehavior:["type",Tl],createDataObjectBehavior:["type",Ml],createParticipantBehavior:["type",Dl],dataInputAssociationBehavior:["type",Ll],dataStoreBehavior:["type",Il],deleteLaneBehavior:["type",Nl],detachEventBehavior:["type",Us],dropOnFlowBehavior:["type",$l],eventBasedGatewayBehavior:["type",jl],fixHoverBehavior:["type",Gm],groupBehavior:["type",Fl],importDockingFix:["type",Wm],isHorizontalFix:["type",zl],labelBehavior:["type",Vl],layoutConnectionBehavior:["type",Wl],messageFlowBehavior:["type",Yl],nonInterruptingBehavior:["type",Kl],removeElementBehavior:["type",Zl],removeEmbeddedLabelBoundsBehavior:["type",Xl],removeParticipantBehavior:["type",Ql],replaceConnectionBehavior:["type",Jl],replaceElementBehaviour:["type",Js],resizeBehavior:["type",hg],resizeLaneBehavior:["type",bg],rootElementReferenceBehavior:["type",ip],spaceToolBehavior:["type",wg],subProcessPlaneBehavior:["type",Ii],subProcessStartEventBehavior:["type",op],textAnnotationBehavior:["type",ap],toggleCollapseConnectionBehaviour:["type",sp],toggleElementCollapseBehaviour:["type",up],unclaimIdBehavior:["type",lp],unsetDefaultFlowBehavior:["type",pp],updateFlowNodeRefsBehavior:["type",fp],updateCategoryValueRefsBehavior:["type",dp],setCompensationActivityAfterPasteBehavior:["type",hp]};function mp(e){this._commandStack=e.get("commandStack",!1)}mp.$inject=["injector"],mp.prototype.allowed=function(e,t){var n=!0,i=this._commandStack;return i&&(n=i.canExecute(e,t)),n===void 0?!0:n};const gi={__init__:["rules"],rules:["type",mp]};function Vn(e){Q.call(this,e),this.init()}Vn.$inject=["eventBus"],pe(Vn,Q),Vn.prototype.addRule=function(e,t,n){var i=this;typeof e=="string"&&(e=[e]),e.forEach(function(r){i.canExecute(r,t,function(o,a,s){return n(o)},!0)})},Vn.prototype.init=function(){};function Dg(e,t){var n=Zt(e,t,-15);return n!=="intersect"?n:null}function Jt(e){Vn.call(this,e)}pe(Jt,Vn),Jt.$inject=["eventBus"],Jt.prototype.init=function(){this.addRule("connection.start",function(e){var t=e.source;return uP(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 oc(t,n)}finally{r&&(n.parent=null)}}),this.addRule("connection.reconnect",function(e){var t=e.connection,n=e.source,i=e.target;return oc(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 Ug(t,n,i)}),this.addRule("elements.create",function(e){var t=e.elements,n=e.position,i=e.target;return at(i)&&!ac(t,i)?!1:Pr(t,function(r){return at(r)?oc(r.source,r.target,r):r.host?ha(r,r.host,null,n):_p(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 Fg(a)&&!n.includes(a.host)})?!1:ha(n,t,null,i)||Vg(n,t,i)||Wg(n,t)||ac(n,t)}),this.addRule("shape.create",function(e){return _p(e.shape,e.target,e.source,e.position)}),this.addRule("shape.attach",function(e){return ha(e.shape,e.target,null,e.position)}),this.addRule("element.copy",function(e){var t=e.element,n=e.elements;return Zg(n,t)})},Jt.prototype.canConnectMessageFlow=Kg,Jt.prototype.canConnectSequenceFlow=Xg,Jt.prototype.canConnectDataAssociation=bp,Jt.prototype.canConnectAssociation=qg,Jt.prototype.canConnectCompensationAssociation=Yg,Jt.prototype.canMove=Wg,Jt.prototype.canAttach=ha,Jt.prototype.canReplace=Vg,Jt.prototype.canDrop=So,Jt.prototype.canInsert=ac,Jt.prototype.canCreate=_p,Jt.prototype.canConnect=oc,Jt.prototype.canResize=Ug,Jt.prototype.canCopy=Zg;function uP(e){return gp(e)?null:Fe(e,["bpmn:FlowNode","bpmn:InteractionNode","bpmn:DataObjectReference","bpmn:DataStoreReference","bpmn:Group","bpmn:TextAnnotation"])}function gp(e){return!e||$e(e)}function Lg(e){do{if(v(e,"bpmn:Process"))return ee(e);if(v(e,"bpmn:Participant"))return ee(e).processRef||ee(e)}while(e=e.parent)}function yp(e){return v(e,"bpmn:TextAnnotation")}function vp(e){return v(e,"bpmn:Group")&&!e.labelTarget}function Ig(e){return v(e,"bpmn:BoundaryEvent")&&yi(e,"bpmn:CompensateEventDefinition")}function rc(e){return ee(e).isForCompensation}function lP(e,t){var n=Lg(e),i=Lg(t);return n===i}function pP(e){return v(e,"bpmn:InteractionNode")&&!v(e,"bpmn:BoundaryEvent")&&(!v(e,"bpmn:Event")||v(e,"bpmn:ThrowEvent")&&$g(e,"bpmn:MessageEventDefinition"))}function fP(e){return v(e,"bpmn:InteractionNode")&&!rc(e)&&(!v(e,"bpmn:Event")||v(e,"bpmn:CatchEvent")&&$g(e,"bpmn:MessageEventDefinition"))&&!(v(e,"bpmn:BoundaryEvent")&&!yi(e,"bpmn:MessageEventDefinition"))}function Ng(e){for(var t=e;t=t.parent;){if(v(t,"bpmn:FlowElementsContainer"))return ee(t);if(v(t,"bpmn:Participant"))return ee(t).processRef}return null}function Bg(e,t){var n=Ng(e),i=Ng(t);return n===i}function yi(e,t){var n=ee(e);return!!ut(n.eventDefinitions||[],function(i){return v(i,t)})}function $g(e,t){var n=ee(e);return(n.eventDefinitions||[]).every(function(i){return v(i,t)})}function dP(e){return v(e,"bpmn:FlowNode")&&!v(e,"bpmn:EndEvent")&&!un(e)&&!(v(e,"bpmn:IntermediateThrowEvent")&&yi(e,"bpmn:LinkEventDefinition"))&&!Ig(e)&&!rc(e)}function hP(e){return v(e,"bpmn:FlowNode")&&!v(e,"bpmn:StartEvent")&&!v(e,"bpmn:BoundaryEvent")&&!un(e)&&!(v(e,"bpmn:IntermediateCatchEvent")&&yi(e,"bpmn:LinkEventDefinition"))&&!rc(e)}function mP(e){return v(e,"bpmn:ReceiveTask")||v(e,"bpmn:IntermediateCatchEvent")&&(yi(e,"bpmn:MessageEventDefinition")||yi(e,"bpmn:TimerEventDefinition")||yi(e,"bpmn:ConditionalEventDefinition")||yi(e,"bpmn:SignalEventDefinition"))}function gP(e){for(var t=[];e;)e=e.parent,e&&t.push(e);return t}function jg(e,t){var n=gP(t);return n.indexOf(e)!==-1}function oc(e,t,n){if(gp(e)||gp(t))return null;if(!v(n,"bpmn:DataAssociation")){if(Kg(e,t))return{type:"bpmn:MessageFlow"};if(Xg(e,t))return{type:"bpmn:SequenceFlow"}}var i=bp(e,t);return i||(Yg(e,t)?{type:"bpmn:Association",associationDirection:"One"}:qg(e,t)?{type:"bpmn:Association",associationDirection:"None"}:!1)}function So(e,t){return $e(e)||vp(e)?!0:v(t,"bpmn:Participant")&&!We(t)?!1:v(e,"bpmn:Participant")?v(t,"bpmn:Process")||v(t,"bpmn:Collaboration"):Fe(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")&&!yP(e)?!1:v(e,"bpmn:FlowElement")&&!v(e,"bpmn:DataStoreReference")?v(t,"bpmn:FlowElementsContainer")?We(t):Fe(t,["bpmn:Participant","bpmn:Lane"]):v(e,"bpmn:DataStoreReference")&&v(t,"bpmn:Collaboration")?Ui(ee(t).get("participants"),function(n){return!!n.get("processRef")}):Fe(e,["bpmn:Artifact","bpmn:DataAssociation","bpmn:DataStoreReference"])?Fe(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 yP(e){return ee(e).cancelActivity&&(Hg(e)||zg(e))}function Fg(e){return!$e(e)&&v(e,"bpmn:BoundaryEvent")}function vP(e){return v(e,"bpmn:Lane")}function _P(e){return Fg(e)||v(e,"bpmn:IntermediateThrowEvent")&&Hg(e)?!0:v(e,"bpmn:IntermediateCatchEvent")&&zg(e)}function Hg(e){var t=ee(e);return t&&!(t.eventDefinitions&&t.eventDefinitions.length)}function zg(e){return Gg(e,["bpmn:MessageEventDefinition","bpmn:TimerEventDefinition","bpmn:SignalEventDefinition","bpmn:ConditionalEventDefinition"])}function Gg(e,t){return t.some(function(n){return yi(e,n)})}function bP(e){return v(e,"bpmn:ReceiveTask")&&ut(e.incoming,function(t){return v(t.source,"bpmn:EventBasedGateway")})}function ha(e,t,n,i){if(Array.isArray(e)||(e=[e]),e.length!==1)return!1;var r=e[0];return $e(r)||!_P(r)||un(t)||!v(t,"bpmn:Activity")||rc(t)||i&&!Dg(i,t)||bP(t)?!1:"attach"}function Vg(e,t,n){if(!t)return!1;var i={replacements:[]};return D(e,function(r){un(t)||v(r,"bpmn:StartEvent")&&r.type!=="label"&&So(r,t)&&(TS(r)||i.replacements.push({oldElementId:r.id,newElementType:"bpmn:StartEvent"}),(MS(r)||kS(r)||OS(r))&&i.replacements.push({oldElementId:r.id,newElementType:"bpmn:StartEvent"}),Gg(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")||yi(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")&&ha(r,t,null,n)&&i.replacements.push({oldElementId:r.id,newElementType:"bpmn:BoundaryEvent"}))}),i.replacements.length?i:!1}function Wg(e,t){return Ui(e,vP)?!1:t===void 0?!0:t===null?!1:e.every(function(n){return So(n,t)})}function _p(e,t,n,i){return t?$e(e)||vp(e)?!0:So(e,t)||ac(e,t):!1}function Ug(e,t,n){return v(e,"bpmn:SubProcess")?We(e)&&(!t||t.width>=100&&t.height>=80):v(e,"bpmn:Lane")||v(e,"bpmn:Participant")?!0:yp(e)?n?n==="e"||n==="w":!0:vp(e)?!0:$e(e)?n?n==="e"||n==="w":!0:!1}function xP(e,t){var n=yp(e),i=yp(t);return(n||i)&&n!==i}function qg(e,t){return jg(t,e)||jg(e,t)?!1:xP(e,t)?!0:!!bp(e,t)}function Yg(e,t){return Bg(e,t)&&Ig(e)&&v(t,"bpmn:Activity")&&!EP(t,e)&&!un(t)}function Kg(e,t){return Jg(e)&&!Jg(t)?!1:pP(e)&&fP(t)&&!lP(e,t)}function Xg(e,t){return dP(e)&&hP(t)&&Bg(e,t)&&!(v(e,"bpmn:EventBasedGateway")&&!mP(t))}function bp(e,t){return Fe(e,["bpmn:DataObjectReference","bpmn:DataStoreReference"])&&Fe(t,["bpmn:Activity","bpmn:ThrowEvent"])?{type:"bpmn:DataInputAssociation"}:Fe(t,["bpmn:DataObjectReference","bpmn:DataStoreReference"])&&Fe(e,["bpmn:Activity","bpmn:CatchEvent"])?{type:"bpmn:DataOutputAssociation"}:!1}function ac(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:Fe(t,["bpmn:SequenceFlow","bpmn:MessageFlow"])&&!$e(t)&&v(e,"bpmn:FlowNode")&&!v(e,"bpmn:BoundaryEvent")&&So(e,t.parent)}function xp(e,t){return e&&t&&e.indexOf(t)!==-1}function Zg(e,t){return $e(t)?!0:!(v(t,"bpmn:Lane")&&!xp(e,t.parent)||v(t,"bpmn:MessageFlow")&&!wP(e,t))}function wP(e,t){var n=Qg(t.source),i=Qg(t.target);return xp(e,n)&&xp(e,i)}function Qg(e){for(;e;e=e.parent)if(v(e,"bpmn:Participant"))return e;return null}function Jg(e){return yo(e,"bpmn:Process")||yo(e,"bpmn:Collaboration")}function EP(e,t){return e.attachers.includes(t)}const SP={__depends__:[gi],__init__:["bpmnRules"],bpmnRules:["type",Jt]};var RP=2e3;function ey(e,t){e.on("saveXML.start",RP,n);function n(){var i=t.getRootElements();D(i,function(r){var o=Xe(r),a,s;a=Zo([r]),a=He(a,function(c){return c!==r&&!c.labelTarget}),s=on(a,Xe),o.set("planeElement",s)})}}ey.$inject=["eventBus","canvas"];const CP={__init__:["bpmnDiOrdering"],bpmnDiOrdering:["type",ey]};function sc(e){Q.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)})}sc.prototype.getOrdering=function(e,t){return null},pe(sc,Q);function wp(e,t){sc.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 Fe(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&&!Fe(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=ed(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}}}wp.$inject=["eventBus","canvas"],pe(wp,sc);const PP={__init__:["bpmnOrderingProvider"],bpmnOrderingProvider:["type",wp]};function ma(){}ma.prototype.get=function(){return this._data},ma.prototype.set=function(e){this._data=e},ma.prototype.clear=function(){var e=this._data;return delete this._data,e},ma.prototype.isEmpty=function(){return!this._data};const AP={clipboard:["type",ma]};var ty=1500;function ny(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",ty,function(s){o(s)})}),(function(){var a,s;t.on("element.hover",function(c){a=c.gfx,s=c.element}),t.on("element.hover",ty,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),TP(c)}}ny.$inject=["elementRegistry","eventBus","injector"];function TP(e){return Or(e,"svg, .djs-element",!0)}const MP={__init__:["hoverFix"],hoverFix:["type",ny]};function kP(e){return!0}function cc(e){return sr(e)||NC(e)}var iy=500;function ry(e,t,n){var i=this;function r(T,B,k){if(!s(T,B)){var O,$,ne;k?$=t.getGraphics(k):(O=B.delegateTarget||B.target,O&&($=O,k=t.get($))),!(!$||!k)&&(ne=e.fire(T,{element:k,gfx:$,originalEvent:B}),ne===!1&&(B.stopPropagation(),B.preventDefault()))}}var o={};function a(T){return o[T]}function s(T,B){var k=u[T]||sr;return!k(B)}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":kP,"element.mousedown":cc,"element.mouseup":cc,"element.click":cc,"element.dblclick":cc};function l(T,B,k){var O=c[T];if(!O)throw new Error("unmapped DOM event name <"+T+">");return r(O,B,k)}var f="svg, .djs-element";function p(T,B,k,O){var $=o[k]=function(ne){r(k,ne)};O&&(u[k]=O),$.$delegate=Cn.bind(T,f,B,$)}function d(T,B,k){var O=a(k);O&&Cn.unbind(T,B,O.$delegate)}function h(T){D(c,function(B,k){p(T,k,B)})}function m(T){D(c,function(B,k){d(T,k,B)})}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 B=T.element,k=T.gfx;e.fire("interactionEvents.createHit",{element:B,gfx:k})}),e.on(["shape.changed","connection.changed"],iy,function(T){var B=T.element,k=T.gfx;e.fire("interactionEvents.updateHit",{element:B,gfx:k})}),e.on("interactionEvents.createHit",iy,function(T){var B=T.element,k=T.gfx;i.createDefaultHit(B,k)}),e.on("interactionEvents.updateHit",function(T){var B=T.element,k=T.gfx;i.updateDefaultHit(B,k)});var g=C("djs-hit djs-hit-stroke"),S=C("djs-hit djs-hit-click-stroke"),E=C("djs-hit djs-hit-all"),x=C("djs-hit djs-hit-no-move"),w={all:E,"click-stroke":S,stroke:g,"no-move":x};function C(T,B){return B=j({stroke:"white",strokeWidth:15},B||{}),n.cls(T,["no-fill","no-border"],B)}function P(T,B){var k=w[B];if(!k)throw new Error("invalid hit type <"+B+">");return fe(T,k),T}function L(T,B){Oe(T,B)}this.removeHits=function(T){var B=_s(".djs-hit",T);D(B,jt)},this.createDefaultHit=function(T,B){var k=T.waypoints,O=T.isFrame,$;return k?this.createWaypointsHit(B,k):($=O?"stroke":"all",this.createBoxHit(B,$,{width:T.width,height:T.height}))},this.createWaypointsHit=function(T,B){var k=Xo(B);return P(k,"stroke"),L(T,k),k},this.createBoxHit=function(T,B,k){k=j({x:0,y:0},k);var O=be("rect");return P(O,B),fe(O,k),L(T,O),O},this.updateDefaultHit=function(T,B){var k=ot(".djs-hit",B);if(k)return T.waypoints?cl(k,T.waypoints):fe(k,{width:T.width,height:T.height}),k},this.fire=r,this.triggerMouseEvent=l,this.mouseHandler=a,this.registerEvent=p,this.unregisterEvent=d}ry.$inject=["eventBus","elementRegistry","styles"];const uc={__init__:["interactionEvents"],interactionEvents:["type",ry]};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();Ee(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?D(e,o=>{this._selectedElements.add(o)}):this._selectedElements=new Set(e),this._eventBus.fire("selection.changed",{oldSelection:n,newSelection:this.get()})};var oy="hover",ay="selected";function sy(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,oy)}),t.on("element.out",function(r){i(r.element,oy)}),t.on("selection.changed",function(r){function o(u){i(u,ay)}function a(u){n(u,ay)}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)})}sy.$inject=["canvas","eventBus"];function cy(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;Ee(u)?t.select(u):t.select(s.filter(OP))}}),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(sr(r)){var o=r.element;o===n.getRootElement()&&(o=null);var a=t.isSelected(o),s=t.get().length>1,c=nc(r);if(a&&s)return c?t.deselect(o):t.select(o);a?t.deselect(o):t.select(o,c)}})}cy.$inject=["eventBus","selection","canvas","elementRegistry"];function OP(e){return!e.hidden}const Wn={__init__:["selectionVisuals","selectionBehavior"],__depends__:[uc],selection:["type",Ro],selectionVisuals:["type",sy],selectionBehavior:["type",cy]};var DP=/^djs-cursor-.*$/;function lc(e){var t=mt(document.body);t.removeMatching(DP),e&&t.add("djs-cursor-"+e)}function uy(){lc(null)}var LP=5e3;function ly(e,t){t=t||"element.click";function n(){return!1}return e.once(t,LP,n),function(){e.off(t,n)}}var IP=["c","C"],NP=["v","V"],BP=["d","D"],$P=["x","X"],jP=["y","Y"],py=["z","Z"];function FP(e){return e.ctrlKey||e.metaKey||e.shiftKey||e.altKey}function Tn(e){return e.altKey?!1:e.ctrlKey||e.metaKey}function Ft(e,t){return e=Ee(e)?e:[e],e.indexOf(t.key)!==-1||e.indexOf(t.code)!==-1}function Ep(e){return e.shiftKey}function HP(e){return Tn(e)&&Ft(IP,e)}function zP(e){return Tn(e)&&Ft(NP,e)}function GP(e){return Tn(e)&&Ft(BP,e)}function VP(e){return Tn(e)&&Ft($P,e)}function WP(e){return Tn(e)&&!Ep(e)&&Ft(py,e)}function UP(e){return Tn(e)&&(Ft(jP,e)||Ft(py,e)&&Ep(e))}var Co=Math.round,fy="djs-drag-active";function Fr(e){e.preventDefault()}function qP(e){return typeof TouchEvent<"u"&&e instanceof TouchEvent}function YP(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}function dy(e,t,n,i){var r={threshold:5,trapClick:!0},o;function a(x){var w=t.viewbox(),C=t._container.getBoundingClientRect();return{x:w.x+(x.x-C.left)/w.scale,y:w.y+(x.y-C.top)/w.scale}}function s(x,w){w=w||o;var C=e.createEvent(j({},w.payload,w.data,{isTouch:w.isTouch}));return e.fire("drag."+x,C)===!1?!1:e.fire(w.prefix+"."+x,C)}function c(x){var w=x.filter(function(C){return i.get(C.id)});w.length&&n.select(w)}function u(x,w){var C=o.payload,P=o.displacement,L=o.globalStart,T=$r(x),B=ti(T,L),k=o.localStart,O=a(T),$=ti(O,k);if(!o.active&&(w||YP(B)>o.threshold)){if(j(C,{x:Co(k.x+P.x),y:Co(k.y+P.y),dx:0,dy:0},{originalEvent:x}),s("start")===!1)return g();o.active=!0,o.keepSelection||(C.previousSelection=n.get(),n.select(null)),o.cursor&&lc(o.cursor),t.addMarker(t.getRootElement(),fy)}np(x),o.active&&(j(C,{x:Co(O.x+P.x),y:Co(O.y+P.y),dx:Co($.x),dy:Co($.y)},{originalEvent:x}),s("move"))}function l(x){var w,C=!0;o.active&&(x&&(o.payload.originalEvent=x,np(x)),C=s("end")),C===!1&&s("rejected"),w=S(C!==!0),s("ended",w)}function f(x){Ft("Escape",x)&&(Fr(x),g())}function p(x){var w;o.active&&(w=ly(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 C=o.active;C&&s("cancel"),w=S(x),C&&s("canceled",w)}}function S(x){var w,C;s("cleanup"),uy(),o.trapClick?C=p:C=l,Me.unbind(document,"mousemove",u),Me.unbind(document,"dragstart",Fr),Me.unbind(document,"selectstart",Fr),Me.unbind(document,"mousedown",C,!0),Me.unbind(document,"mouseup",C,!0),Me.unbind(document,"keyup",f),Me.unbind(document,"touchstart",d,!0),Me.unbind(document,"touchcancel",g,!0),Me.unbind(document,"touchmove",u,!0),Me.unbind(document,"touchend",l,!0),e.off("element.hover",h),e.off("element.out",m),t.removeMarker(t.getRootElement(),fy);var P=o.payload.previousSelection;return x!==!1&&P&&!n.get().length&&c(P),w=o,o=null,w}function E(x,w,C,P){o&&g(!1),typeof w=="string"&&(P=C,C=w,w=null),P=j({},r,P||{});var L=P.data||{},T,B,k,O,$;if(P.trapClick?O=p:O=l,x?(T=Eo(x)||x,B=$r(x),np(x),T.type==="dragstart"&&Fr(T)):(T=null,B={x:0,y:0}),k=a(B),w||(w=k),$=qP(T),o=j({prefix:C,data:L,payload:{},globalStart:B,displacement:ti(w,k),localStart:k,isTouch:$},P),P.manual||($?(Me.bind(document,"touchstart",d,!0),Me.bind(document,"touchcancel",g,!0),Me.bind(document,"touchmove",u,!0),Me.bind(document,"touchend",l,!0)):(Me.bind(document,"mousemove",u),Me.bind(document,"dragstart",Fr),Me.bind(document,"selectstart",Fr),Me.bind(document,"mousedown",O,!0),Me.bind(document,"mouseup",O,!0)),Me.bind(document,"keyup",f),e.on("element.hover",h),e.on("element.out",m)),s("init")===!1)return g(),!1;P.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){j(r,x)}}dy.$inject=["eventBus","canvas","selection","elementRegistry"];const Ni={__depends__:[MP,Wn],dragging:["type",dy]};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 KP=new Po("ps");var XP=["marker-start","marker-mid","marker-end"],ZP=["circle","ellipse","line","path","polygon","polyline","path","rect"];function cr(e,t,n,i){this._elementRegistry=e,this._canvas=n,this._styles=i}cr.$inject=["elementRegistry","eventBus","canvas","styles"],cr.prototype.cleanUp=function(){console.warn("PreviewSupport#cleanUp is deprecated and will be removed in future versions. You do not need to manually clean up previews anymore. cf. https://github.com/bpmn-io/diagram-js/pull/906")},cr.prototype.getGfx=function(e){return this._elementRegistry.getGraphics(e)},cr.prototype.addDragger=function(e,t,n,i="djs-dragger"){n=n||this.getGfx(e);var r=Ch(n);return this._cloneMarkers(Ir(r),i),fe(r,this._styles.cls(i,[])),Oe(t,r),fe(r,"data-preview-support-element-id",e.id),r},cr.prototype.addFrame=function(e,t){var n=be("rect",{class:"djs-resize-overlay",width:e.width,height:e.height,x:e.x,y:e.y});return Oe(t,n),fe(n,"data-preview-support-element-id",e.id),n},cr.prototype._cloneMarkers=function(e,t="djs-dragger",n=e){var i=this;e.childNodes&&e.childNodes.forEach(r=>{i._cloneMarkers(r,t,n)}),tA(e)&&XP.forEach(function(r){if(fe(e,r)){var o=QP(e,r,i._canvas.getContainer());o&&i._cloneMarker(n,e,o,r,t)}})},cr.prototype._cloneMarker=function(e,t,n,i,r="djs-dragger"){var o=[n.id,r,KP.next()].join("-"),a=ot("marker#"+n.id,e);e=e||this._canvas._svg;var s=a||Ch(n);s.id=o,qe(s).add(r);var c=ot(":scope > defs",e);c||(c=be("defs"),Oe(e,c)),Oe(c,s);var u=eA(s.id);fe(t,i,u)};function QP(e,t,n){var i=JP(fe(e,t));return ot("marker#"+i,n||document)}function JP(e){return e.match(/url\(['"]?#([^'"]*)['"]?\)/)[1]}function eA(e){return"url(#"+e+")"}function tA(e){return ZP.indexOf(e.nodeName)!==-1}const Ao={__init__:["previewSupport"],previewSupport:["type",cr]};var nA="drop-ok",hy="drop-not-ok",my="attach-ok",gy="new-parent",yy="create",iA=2e3;function vy(e,t,n,i,r){function o(c,u,l,f,p){if(!u)return!1;c=He(c,function(E){var x=E.labelTarget;return!E.parent&&!($e(E)&&c.indexOf(x)!==-1)});var d=ut(c,function(E){return!at(E)}),h=!1,m=!1,g=!1;by(c)&&(h=r.allowed("shape.attach",{position:l,shape:d,target:u})),h||(by(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 S=p.connectionTarget;return g||h?(d&&f&&(m=r.allowed("connection.create",{source:S===f?d:f,target:S===f?f:d,hints:{targetParent:u,targetAttach:h}})),{attach:h,connect:m}):g===null||h===null?null:!1}function a(c,u){[my,nA,hy,gy].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}_y(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,my):a(f,m?gy:hy))}),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,S=u.hints||{};if(h===!1||!d)return!1;_y(c);var E={x:c.x,y:c.y};g?f=i.appendShape(l,f,E,d,{attach:m,connection:g===!0?{}:g,connectionTarget:S.connectionTarget}):(p=i.createElements(p,E,d,j({},S,{attach:m})),f=ut(p,function(x){return!at(x)})),j(u,{elements:p,shape:f}),j(c,{elements:p,shape:f})});function s(){var c=t.context();c&&c.prefix===yy&&t.cancel()}n.on("create.init",function(){n.on("elements.changed",s),n.once(["create.cancel","create.end"],iA,function(){n.off("elements.changed",s)})}),this.start=function(c,u,l){Ee(u)||(u=[u]);var f=ut(u,function(h){return!at(h)});if(f){l=j({elements:u,hints:{},shape:f},l||{}),D(u,function(h){Pe(h.x)||(h.x=0),Pe(h.y)||(h.y=0)});var p=He(u,function(h){return!h.hidden}),d=Mt(p);D(u,function(h){at(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}})),j(h,{x:h.x-d.x-d.width/2,y:h.y-d.y-d.height/2})}),t.init(c,yy,{cursor:"grabbing",autoActivate:!0,data:{shape:f,elements:u,context:l}})}}}vy.$inject=["canvas","dragging","eventBus","modeling","rules"];function _y(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 by(e){return e&&e.length===1&&!at(e[0])}var rA=750;function xy(e,t,n,i,r){function o(a){var s=be("g");fe(s,r.cls("djs-drag-group",["no-events"]));var c=be("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),Qt(l,u.x,u.y)),i.addDragger(u,s,l))}),s}t.on("create.move",rA,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(),Oe(f,l)),Qt(l,a.x,a.y)):jt(l)}),t.on("create.cleanup",function(a){var s=a.context,c=s.dragGroup;c&&jt(c)})}xy.$inject=["canvas","eventBus","graphicsFactory","previewSupport","styles"];const pc={__depends__:[Ni,Ao,gi,Wn],__init__:["create","createPreview"],create:["type",vy],createPreview:["type",xy]};function Sp(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)})}Sp.$inject=["eventBus"],Sp.prototype.getLastMoveEvent=function(){return this._lastMoveEvent||oA(0,0)};function oA(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 ga={__init__:["mouse"],mouse:["type",Sp]};var wy=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),aA(l)&&(u.priority=2,u.host=l.host.id),at(l)&&(u.priority=3,u.source=l.source.id,u.target=l.target.id,u.waypoints=sA(l)),$e(l)&&(u.priority=4,u.labelTarget=l.labelTarget.id),D(["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",wy,function(c){var u;((u=c.hints)==null?void 0:u.clip)!==!1&&n.set(c.tree)}),r.on("copyPaste.pasteElements",wy,function(c){c.tree||(c.tree=n.get())}),r.on("copyPaste.pasteElements",function(c){var u=c.hints;j(u,{createElementsBehavior:!1})})}Mn.$inject=["canvas","create","clipboard","elementFactory","eventBus","modeling","mouse","rules"],Mn.prototype.copy=function(e,t={}){var n,i;return Ee(e)||(e=e?[e]:[]),n=this._eventBus.fire("copyPaste.canCopyElements",{elements:e}),n===!1?i={}:i=this.createTree(Ee(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 D(e,function(n){D(n,function(i){i.id&&(t[i.id]=!0)})}),t},Mn.prototype._paste=function(e,t,n,i){D(e,function(o){Pe(o.x)||(o.x=0),Pe(o.y)||(o.y=0)});var r=Mt(e);return D(e,function(o){at(o)&&(o.waypoints=on(o.waypoints,function(a){return{x:a.x-r.x-r.width/2,y:a.y-r.y-r.height/2}})),j(o,{x:o.x-r.x-r.width/2,y:o.y-r.y-r.height/2})}),this._modeling.createElements(e,n,t,j({},i))},Mn.prototype._createElements=function(e){var t=this,n=this._eventBus,i={},r=[];return D(e,function(o,a){o=ri(o,"priority"),D(o,function(s){var c=j({},oi(s,["priority"]));i[s.parent]?c.parent=i[s.parent]:delete c.parent,n.fire("copyPaste.pasteElement",{cache:i,descriptor:c});var u;if(at(c)){c.source=i[s.source],c.target=i[s.target],u=i[s.id]=t.createConnection(c),r.push(u);return}if($e(c)){c.labelTarget=i[c.labelTarget],u=i[s.id]=t.createLabel(c),r.push(u);return}c.host&&(c.host=i[c.host]),u=i[s.id]=t.createShape(c),r.push(u)})}),r},Mn.prototype.createConnection=function(e){var t=this._elementFactory.createConnection(oi(e,["id"]));return t},Mn.prototype.createLabel=function(e){var t=this._elementFactory.createLabel(oi(e,["id"]));return t},Mn.prototype.createShape=function(e){var t=this._elementFactory.createShape(oi(e,["id"]));return t},Mn.prototype.hasRelations=function(e,t,n){return n||(n=new Set(t)),!(at(e)&&(!n.has(e.source)||!n.has(e.target))||$e(e)&&!n.has(e.labelTarget))},Mn.prototype.createTree=function(e){var t=this._rules,n=this,i={},r=[],o=new Map,a=Es(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($e(f))return;D(f.labels,function(g){c(g,d)});function h(g){g&&g.length&&D(g,function(S){D(S.labels,function(E){c(E,d)}),c(S,d)})}D([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=ri(r,function(f){return f.descriptor.priority}),e=on(r,function(f){return f.element}),D(r,function(f){var p=f.depth;if(!n.hasRelations(f.element,e,l)){Sy(f.element,e),l.delete(f.element);return}if(!s(f.element,e)){Sy(f.element,e),l.delete(f.element);return}i[p]||(i[p]=[]),i[p].push(f.descriptor)}),i};function aA(e){return!!e.host}function sA(e){return on(e.waypoints,function(t){return t=Ey(t),t.original&&(t.original=Ey(t.original)),t})}function Ey(e){return j({},e)}function Sy(e,t){var n=t.indexOf(e);return n===-1?t:t.splice(n,1)}const cA={__depends__:[AP,pc,ga,gi],__init__:["copyPaste"],copyPaste:["type",Mn]};function Rp(e,t,n){Ee(n)||(n=[n]),D(n,function(i){Cr(e[i])||(t[i]=e[i])})}var Cp=750;function Ry(e,t,n){function i(c,u){var l=e.create(c.$type);return n.copyElement(c,l,null,u)}t.on("copyPaste.copyElement",Cp,function(c){var u=c.descriptor,l=c.element,f=ee(l);if($e(l))return u;var p=u.businessObject=i(f,!0),d=u.di=i(Xe(l),!0);d.bpmnElement=p,Rp(p,u,"name"),Rp(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=ee(c);return c.default&&(l[c.default]={element:f,property:"default"}),c.host&&(ee(c).attachedToRef=ee(u[c.host])),oi(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($e(l)){l.businessObject=ee(u[l.labelTarget]),l.di=Xe(u[l.labelTarget]);return}f=l.businessObject=i(f),p=l.di=i(p),p.bpmnElement=f,Rp(l,f,["isExpanded","name"]),l.type=f.$type}),t.on("copyPaste.copyElement",Cp,function(c){var u=c.descriptor,l=c.element;if(v(l,"bpmn:Participant")){var f=ee(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")&&D(ia(l),f=>{l.push(f.annotation)})}),t.on("copyPaste.pasteElement",Cp,function(c){var u=c.cache,l=c.descriptor;a(u,s(l,u,o(u)))})}Ry.$inject=["bpmnFactory","eventBus","moddleCopy"];const uA=["artifacts","dataInputAssociations","dataOutputAssociations","default","flowElements","lanes","incoming","outgoing","categoryValue"],lA=["errorRef","escalationRef","messageRef","signalRef","dataObjectRef"];function ya(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 ri(r,o=>o==="extensionElements")}),e.on("moddleCopy.canCopyProperty",i=>{const{parent:r,property:o,propertyName:a}=i,s=Vt(r)&&r.$descriptor;if(a&&lA.includes(a))return o;if(a&&uA.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})}ya.$inject=["eventBus","bpmnFactory","moddle"],ya.prototype.copyElement=function(e,t,n,i=!1){n&&!Ee(n)&&(n=[n]),n=n||Pp(e.$descriptor);const r=this._eventBus.fire("moddleCopy.canCopyProperties",{propertyNames:n,sourceElement:e,targetElement:t,clone:i});return r===!1||(Ee(r)&&(n=r),D(n,o=>{let a;En(e,o)&&(a=e.get(o));const s=this.copyProperty(a,t,o,i);!Bt(s)||this._eventBus.fire("moddleCopy.canSetCopiedProperty",{parent:t,property:s,propertyName:o})===!1||t.set(o,s)})),t},ya.prototype.copyProperty=function(e,t,n,i=!1){let r=this._eventBus.fire("moddleCopy.canCopyProperty",{parent:t,property:e,propertyName:n,clone:i});if(r===!1)return;if(r)return Vt(r)&&r.$type&&!r.$parent&&(r.$parent=t),r;const o=this._moddle.getPropertyDescriptor(t,n);if(!o.isReference)return o.isId?e&&this._copyId(e,t,i):Ee(e)?Sn(e,(a,s)=>{const c=this.copyProperty(s,t,n,i);return c?a.concat(c):a},[]):Vt(e)&&e.$type?this._moddle.getElementDescriptor(e).isGeneric?void 0:(r=this._bpmnFactory.create(e.$type),r.$parent=t,r=this.copyElement(e,r,null,i),r):e},ya.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 Pp(e,t){return Sn(e.properties,(n,i)=>t&&i.default?n:n.concat(i.name),[])}const Cy={__depends__:[cA],__init__:["bpmnCopyPaste","moddleCopy"],bpmnCopyPaste:["type",Ry],moddleCopy:["type",ya]};var Py=Math.round;function Ap(e,t){this._modeling=e,this._eventBus=t}Ap.$inject=["modeling","eventBus"],Ap.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=Py(s+o/2),l=Py(c+a/2),f=i.replaceShape(e,j({},t,{x:u,y:l,width:o,height:a}),n);return r.fire("replace.end",{element:e,newElement:f,hints:n}),f};function Ay(e,t){t.on("replace.end",500,function(n){const{newElement:i,hints:r={}}=n;r.select!==!1&&e.select(i)})}Ay.$inject=["selection","eventBus"];const pA={__init__:["replace","replaceSelectionBehavior"],replaceSelectionBehavior:["type",Ay],replace:["type",Ap]};function fA(e,t,n){Ee(n)||(n=[n]),D(n,function(i){Cr(e[i])||(t[i]=e[i])})}var dA=["cancelActivity","instantiate","eventGatewayType","triggeredByEvent","isInterrupting"];function hA(e,t){var n=e&&En(e,"collapsed")?e.collapsed:!We(e),i;return t&&(En(t,"collapsed")||En(t,"isExpanded"))?i=En(t,"collapsed")?t.collapsed:!t.isExpanded:i=n,n!==i}function Ty(e,t,n,i,r,o){function a(s,c,u){u=u||{};var l=c.type,f=s.businessObject;if(fc(f)&&(l==="bpmn:SubProcess"||l==="bpmn:AdHocSubProcess")&&hA(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),fA(s.di,d.di,["fill","stroke","background-color","border-color","color"]);var h=Pp(f.$descriptor),m=Pp(p.$descriptor,!0),g=mA(h,m);j(p,ei(c,dA));var S=He(g,function(w){return w==="eventDefinitions"?My(s,c.eventDefinitionType):w==="loopCharacteristics"?!un(p):En(p,w)||w==="processRef"&&c.isExpanded===!1||w==="triggeredByEvent"?!1:w==="isForCompensation"?!un(p):!0});if(p=n.copyElement(f,p,S),c.eventDefinitionType&&(My(p,c.eventDefinitionType)||(d.eventDefinitionType=c.eventDefinitionType,d.eventDefinitionAttrs=c.eventDefinitionAttrs)),v(f,"bpmn:Activity")){if(fc(f))d.isExpanded=We(s);else if(c&&En(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}We(s)&&!v(f,"bpmn:Task")&&d.isExpanded&&(d.width=s.width,d.height=s.height)}if(fc(f)&&!fc(p)&&(u.moveChildren=!1),v(f,"bpmn:Participant")){c.isExpanded===!0?p.processRef=e.create("bpmn:Process"):u.moveChildren=!1;var x=Ut(s);Xe(s).isHorizontal||(Xe(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,Fe(f,["bpmn:ExclusiveGateway","bpmn:InclusiveGateway","bpmn:Activity"])&&Fe(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}Ty.$inject=["bpmnFactory","elementFactory","moddleCopy","modeling","replace","rules"];function fc(e){return v(e,"bpmn:SubProcess")}function My(e,t){var n=ee(e);return t&&n.get("eventDefinitions").some(function(i){return v(i,t)})}function mA(e,t){return e.filter(function(n){return t.includes(n)})}const ky={__depends__:[Cy,pA,Wn],bpmnReplace:["type",Ty]};var gA=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),D(t,function(r){i.push(r+".ended"),i.push(r+".canceled")}),n.on(i,gA,function(r){this._active&&(yA(r)||this.setActive(null))},this)};function yA(e){var t=e.originalEvent&&e.originalEvent.target;return t&&Or(t,'.group[data-group="tools"]')}const dc={__depends__:[Ni],__init__:["toolManager"],toolManager:["type",Hr]};function vA(e,t){if(e==="x"){if(t>0)return"e";if(t<0)return"w"}if(e==="y"){if(t>0)return"s";if(t<0)return"n"}return null}function _A(e,t){var n=[],i=new Set(e);D(t,function(o){i.add(o)});var r=new Set;return i.forEach(function(o){var a=o.incoming,s=o.outgoing;D(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 bA(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 Tp=Math.abs,xA=Math.round,Bi={x:"width",y:"height"},Oy="crosshair",ur={n:"top",w:"left",s:"bottom",e:"right"},wA=1500,hc={n:"s",w:"e",s:"n",e:"w"},mc=20;function Un(e,t,n,i,r,o,a){this._canvas=e,this._dragging=t,this._eventBus=n,this._modeling=i,this._rules=r,this._toolManager=o,this._mouse=a;var s=this;o.registerTool("space",{tool:"spaceTool.selection",dragging:"spaceTool"}),n.on("spaceTool.selection.end",function(c){n.once("spaceTool.selection.ended",function(){s.activateMakeSpace(c.originalEvent)})}),n.on("spaceTool.move",wA,function(c){var u=c.context,l=u.initialized;l||(l=u.initialized=s.init(c,u)),l&&Ly(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){Ly(c);var m={x:0,y:0};m[l]=xA(c["d"+l]),s.makeSpace(p,d,m,f,h),n.once("spaceTool.ended",function(g){s.activateSelection(g.originalEvent,!0,!0)})}})}Un.$inject=["canvas","dragging","eventBus","modeling","rules","toolManager","mouse"],Un.prototype.activateSelection=function(e,t,n){this._dragging.init(e,"spaceTool.selection",{autoActivate:t,cursor:Oy,data:{context:{reactivate:n}},trapClick:!1})},Un.prototype.activateMakeSpace=function(e){this._dragging.init(e,"spaceTool",{autoActivate:!0,cursor:Oy,data:{context:{}}})},Un.prototype.makeSpace=function(e,t,n,i,r){return this._modeling.createSpace(e,t,n,i,r)},Un.prototype.init=function(e,t){var n=Tp(e.dx)>Tp(e.dy)?"x":"y",i=e["d"+n],r=e[n]-i;if(Tp(i)<5)return!1;i<0&&(i*=-1),da(e)&&(i*=-1);var o=vA(n,i),a=this._canvas.getRootElement();!nc(e)&&e.hover&&(a=e.hover);var s=[...Zo(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=EA(c,n,o,r,u);return j(t,c,{axis:n,direction:o,spaceToolConstraints:l,start:r}),lc("resize-"+(n==="x"?"ew":"ns")),!0},Un.prototype.calculateAdjustments=function(e,t,n,i){var r=this._rules,o=[],a=[],s=new Set,c=new Set,u=[],l=[];function 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 D(e,function(d){if(!(!d.parent||$e(d))){if(at(d)){l.push(d);return}var h=d[t],m=h+d[Bi[t]];if(SA(d)&&(n>0&&Se(d)[t]>i||n<0&&Se(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}}}),D(o,function(d){var h=d.attachers;h&&D(h,function(m){f(m)})}),D(u,function(d){var h=d.host;(s.has(h)||c.has(h))&&f(d)}),D(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}},Un.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateSelection(e,!!e)},Un.prototype.isActive=function(){var e=this._dragging.context();return e?/^spaceTool/.test(e.prefix):!1};function Dy(e){return{top:e.top-mc,right:e.right+mc,bottom:e.bottom+mc,left:e.left-mc}}function Ly(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 EA(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 D(a,function(p){var d=p.attachers,h=p.children,m=xe(p),g=He(h,function($){return!at($)&&!$e($)&&!l.has($)&&!f.has($)}),S=He(h,function($){return!at($)&&!$e($)&&l.has($)}),E,x,w,C=[],P=[],L,T,B,k;g.length&&(x=Dy(xe(Mt(g))),E=i-m[ur[n]]+x[ur[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)),S.length&&(w=Dy(xe(Mt(S))),E=i-w[ur[hc[n]]]+m[ur[hc[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($){l.has($)?C.push($):P.push($)}),C.length&&(L=xe(Mt(C.map(Se))),T=m[ur[hc[n]]]-(L[ur[hc[n]]]-i)),P.length&&(B=xe(Mt(P.map(Se))),k=B[ur[n]]-(m[ur[n]]-i)),n==="n"?(E=Math.min(T||1/0,k||1/0),s.bottom=u=Pe(u)?Math.min(u,E):E):n==="w"?(E=Math.min(T||1/0,k||1/0),s.right=u=Pe(u)?Math.min(u,E):E):n==="s"?(E=Math.max(T||-1/0,k||-1/0),s.top=c=Pe(c)?Math.max(c,E):E):n==="e"&&(E=Math.max(T||-1/0,k||-1/0),s.left=c=Pe(c)?Math.max(c,E):E));var O=r&&r[p.id];O&&(n==="n"?(E=i+p[Bi[t]]-O[Bi[t]],s.bottom=u=Pe(u)?Math.min(u,E):E):n==="w"?(E=i+p[Bi[t]]-O[Bi[t]],s.right=u=Pe(u)?Math.min(u,E):E):n==="s"?(E=i-p[Bi[t]]+O[Bi[t]],s.top=c=Pe(c)?Math.max(c,E):E):n==="e"&&(E=i-p[Bi[t]]+O[Bi[t]],s.left=c=Pe(c)?Math.max(c,E):E))}),s}}function SA(e){return!!e.host}var Mp="djs-dragging",Iy="djs-resizing",RA=250,gc=Math.max;function Ny(e,t,n,i,r){function o(a,s){D(a,function(c){r.addDragger(c,s),n.addMarker(c,Mp)})}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=be("g");fe(l,i.cls("djs-crosshair-group",["no-events"])),Oe(s,l);var f=be("path");fe(f,"d",u.x),qe(f).add("djs-crosshair"),Oe(l,f);var p=be("path");fe(p,"d",u.y),qe(p).add("djs-crosshair"),Oe(l,p),c.crosshairGroup=l}),e.on("spaceTool.selection.move",function(a){var s=a.context.crosshairGroup;Qt(s,a.x,a.y)}),e.on("spaceTool.selection.cleanup",function(a){var s=a.context,c=s.crosshairGroup;c&&jt(c)}),e.on("spaceTool.move",RA,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=be("path"),fe(c,"d","M0,0 L0,0"),qe(c).add("djs-crosshair"),Oe(p,c),s.line=c;var d=be("g");fe(d,i.cls("djs-drag-group",["no-events"])),Oe(n.getActiveLayer(),d),o(l,d);var h=new Set(l);D(f,function(P){h.add(P)});var m=new Set,g=s.movingConnections=[];h.forEach(function(P){D(P.outgoing,function(L){m.has(L)||!at(L)||!h.has(L.target)||(m.add(L),g.push(L))})}),o(g,d),s.dragGroup=d}if(!s.frameGroup){var S=be("g");fe(S,i.cls("djs-frame-group",["no-events"])),Oe(n.getActiveLayer(),S);var E=[];D(f,function(P){var L=r.addFrame(P,S),T=L.getBBox();E.push({element:L,initialBounds:T}),n.addMarker(P,Iy)}),s.frameGroup=S,s.frames=E}var x={x:"M"+a.x+", -10000 L"+a.x+", 10000",y:"M -10000, "+a.y+" L 10000, "+a.y};fe(c,{d:x[u]});var w={x:"y",y:"x"},C={x:a.dx,y:a.dy};C[w[s.axis]]=0,Qt(s.dragGroup,C.x,C.y),D(s.frames,function(P){var L=P.element,T=P.initialBounds,B,k;s.direction==="e"?fe(L,{width:gc(T.width+C.x,5)}):(B=gc(T.width-C.x,5),fe(L,{width:B,x:T.x+T.width-B})),s.direction==="s"?fe(L,{height:gc(T.height+C.y,5)}):(k=gc(T.height-C.y,5),fe(L,{height:k,y:T.y+T.height-k}))})}}),e.on("spaceTool.cleanup",function(a){var s=a.context,c=s.movingShapes,u=s.movingConnections,l=s.resizingShapes,f=s.line,p=s.dragGroup,d=s.frameGroup;D(c,function(h){n.removeMarker(h,Mp)}),D(u,function(h){n.removeMarker(h,Mp)}),p&&(jt(f),jt(p)),D(l,function(h){n.removeMarker(h,Iy)}),d&&jt(d)})}Ny.$inject=["eventBus","elementRegistry","canvas","styles","previewSupport"];const CA={__init__:["spaceToolPreview"],__depends__:[Ni,gi,dc,Ao,ga],spaceTool:["type",Un],spaceToolPreview:["type",Ny]};function yc(e,t){e.invoke(Un,this),this._canvas=t}yc.$inject=["injector","canvas"],pe(yc,Un),yc.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=Un.prototype.calculateAdjustments.call(this,s,t,n,i);return c.resizingShapes=c.resizingShapes.filter(function(u){return!(v(u,"bpmn:TextAnnotation")||PA(u)&&(t==="y"&&Ut(u)||t==="x"&&!Ut(u)))}),c};function PA(e){return v(e,"bpmn:Participant")&&!ee(e).processRef}const By={__depends__:[CA],spaceTool:["type",yc]};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:td("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=Ee(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 AA={commandStack:["type",vt]};function lr(e,t){if(typeof t!="function")throw new Error("removeFn iterator must be a function");if(!e)return[];for(var n;n=e[0];)t(n);return e}var TA=250,$y=1400;function kp(e,t,n){Q.call(this,t);var i=e.get("movePreview",!1);t.on("shape.move.start",$y,function(r){var o=r.context,a=o.shapes,s=o.validatedShapes;o.shapes=jy(a),o.validatedShapes=jy(s)}),i&&t.on("shape.move.start",TA,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",$y,function(r){var o=r.context,a=o.closure,s=a.enclosedElements,c=[];D(s,function(u){D(u.labels,function(l){s[l.id]||c.push(l)})}),a.addAll(c)}),this.preExecute(["connection.delete","shape.delete"],function(r){var o=r.context,a=o.connection||o.shape;lr(a.labels,function(s){n.removeShape(s,{nested:!0})})}),this.execute("shape.delete",function(r){var o=r.context,a=o.shape,s=a.labelTarget;s&&(o.labelTargetIndex=ll(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&&(St(s.labels,a,c),a.labelTarget=s)})}pe(kp,Q),kp.$inject=["injector","eventBus","modeling"];function jy(e){var t=new Set(e);return He(e,function(n){return!t.has(n.labelTarget)})}const MA={__init__:["labelSupport"],labelSupport:["type",kp]};var kA=251,Fy=1401,Hy="attach-ok";function Op(e,t,n,i,r){Q.call(this,t);var o=e.get("movePreview",!1);t.on("shape.move.start",Fy,function(a){var s=a.context,c=s.shapes,u=s.validatedShapes;s.shapes=OA(c),s.validatedShapes=DA(u)}),o&&t.on("shape.move.start",kA,function(a){var s=a.context,c=s.shapes,u=Dp(c);D(u,function(l){o.makeDraggable(s,l,!0),D(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,Hy),t.once(["shape.move.out","shape.move.cleanup"],function(){n.removeMarker(l,Hy)}))}}),this.preExecuted("elements.move",Fy,function(a){var s=a.context,c=s.closure,u=s.shapes,l=Dp(u);D(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=He(c,function(f){var p=f.host;return LA(f)&&!IA(c,p)}),D(l,function(f){r.updateAttachment(f,u)}))}),this.postExecuted("elements.move",function(a){var s=a.context.shapes;D(s,function(c){D(c.attachers,function(u){D(u.outgoing.slice(),function(l){var f=i.allowed("connection.reconnect",{connection:l,source:l.source,target:l.target});f||r.removeConnection(l)}),D(u.incoming.slice(),function(l){var f=i.allowed("connection.reconnect",{connection:l,source:l.source,target:l.target});f||r.removeConnection(l)})})})}),this.postExecute("shape.create",function(a){var s=a.context,c=s.shape,u=s.host;u&&r.updateAttachment(c,u)}),this.postExecute("shape.replace",function(a){var s=a.context,c=s.oldShape,u=s.newShape;lr(c.attachers,function(l){var f=i.allowed("elements.move",{target:u,shapes:[l]});f==="attach"?r.updateAttachment(l,u):r.removeShape(l)}),u.attachers.length&&D(u.attachers,function(l){var f=og(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&&D(f,function(d){var h=og(d,u,l);r.moveShape(d,h,d.parent),D(d.labels,function(m){r.moveShape(m,h,m.parent)})})}),this.preExecute("shape.delete",function(a){var s=a.context.shape;lr(s.attachers,function(c){r.removeShape(c)}),s.host&&r.updateAttachment(s,null)})}pe(Op,Q),Op.$inject=["injector","eventBus","canvas","rules","modeling"];function Dp(e){return Pu(on(e,function(t){return t.attachers||[]}))}function OA(e){var t=Dp(e);return x0("id",e,t)}function DA(e){var t=to(e,"id");return He(e,function(n){for(;n;){if(n.host&&t[n.host.id])return!1;n=n.parent}return!0})}function LA(e){return!!e.host}function IA(e,t){return e.indexOf(t)!==-1}const NA={__depends__:[gi],__init__:["attachSupport"],attachSupport:["type",Op]};function zy(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(Lh(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)})}zy.$inject=["eventBus","canvas","elementRegistry","graphicsFactory"];const Lp={__init__:["changeSupport"],changeSupport:["type",zy]};function qn(e){this._model=e}qn.$inject=["moddle"],qn.prototype._needsId=function(e){return Fe(e,["bpmn:RootElement","bpmn:FlowElement","bpmn:MessageFlow","bpmn:DataAssociation","bpmn:Artifact","bpmn:Participant","bpmn:Lane","bpmn:LaneSet","bpmn:Process","bpmn:Collaboration","bpmndi:BPMNShape","bpmndi:BPMNEdge","bpmndi:BPMNDiagram","bpmndi:BPMNPlane","bpmn:Property","bpmn:CategoryValue"])},qn.prototype._ensureId=function(e){if(e.id){this._model.ids.claim(e.id,e);return}var t;v(e,"bpmn:Activity")?t="Activity":v(e,"bpmn:Event")?t="Event":v(e,"bpmn:Gateway")?t="Gateway":Fe(e,["bpmn:SequenceFlow","bpmn:MessageFlow"])?t="Flow":t=(e.$type||"").replace(/^[^:]*:/g,""),t+="_",!e.id&&this._needsId(e)&&(e.id=this._model.ids.nextPrefixed(t,e))},qn.prototype.create=function(e,t){var n=this._model.create(e,t||{});return this._ensureId(n),n},qn.prototype.createDiLabel=function(){return this.create("bpmndi:BPMNLabel",{bounds:this.createDiBounds()})},qn.prototype.createDiShape=function(e,t){return this.create("bpmndi:BPMNShape",j({bpmnElement:e,bounds:this.createDiBounds()},t))},qn.prototype.createDiBounds=function(e){return this.create("dc:Bounds",e)},qn.prototype.createDiWaypoints=function(e){var t=this;return on(e,function(n){return t.createDiWaypoint(n)})},qn.prototype.createDiWaypoint=function(e){return this.create("dc:Point",ei(e,["x","y"]))},qn.prototype.createDiEdge=function(e,t){return this.create("bpmndi:BPMNEdge",j({bpmnElement:e,waypoint:this.createDiWaypoints([])},t))},qn.prototype.createDiPlane=function(e,t){return this.create("bpmndi:BPMNPlane",j({bpmnElement:e},t))};function kn(e,t,n){Q.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"],On(o)),this.reverted(["shape.move","shape.create","shape.delete","connection.create","connection.move","connection.delete"],On(a));function s(d){var h=d.context,m=h.oldRoot,g=m.children;D(g,function(S){v(S,"bpmn:BaseElement")&&i.updateParent(S)})}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"],On(function(d){d.context.shape.type!=="label"&&c(d)})),this.reverted(["shape.move","shape.create","shape.resize"],On(function(d){d.context.shape.type!=="label"&&c(d)})),e.on("shape.changed",function(d){d.element.type==="label"&&c({context:{shape:d.element}})});function u(d){i.updateConnection(d.context)}this.executed(["connection.create","connection.move","connection.delete","connection.reconnect"],On(u)),this.reverted(["connection.create","connection.move","connection.delete","connection.reconnect"],On(u));function l(d){i.updateConnectionWaypoints(d.context.connection)}this.executed(["connection.layout","connection.move","connection.updateWaypoints"],On(l)),this.reverted(["connection.layout","connection.move","connection.updateWaypoints"],On(l)),this.executed("connection.reconnect",On(function(d){var h=d.context,m=h.connection,g=h.oldSource,S=h.newSource,E=ee(m),x=ee(g),w=ee(S);E.conditionExpression&&!Fe(w,["bpmn:Activity","bpmn:ExclusiveGateway","bpmn:InclusiveGateway"])&&(h.oldConditionExpression=E.conditionExpression,delete E.conditionExpression),g!==S&&x.default===E&&(h.oldDefault=x.default,delete x.default)})),this.reverted("connection.reconnect",On(function(d){var h=d.context,m=h.connection,g=h.oldSource,S=h.newSource,E=ee(m),x=ee(g),w=ee(S);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"],On(f)),this.reverted(["element.updateAttachment"],On(f)),this.executed("element.updateLabel",On(p)),this.reverted("element.updateLabel",On(p));function p(d){const{element:h}=d.context,m=Bn(h),g=Xe(h),S=g&&g.get("label");ir(h)||ic(h)||(m&&!S?g.set("label",t.create("bpmndi:BPMNLabel")):!m&&S&&g.set("label",void 0))}}pe(kn,Q),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(!$e(e)&&!(v(e,"bpmn:DataStoreReference")&&e.parent&&v(e.parent,"bpmn:Collaboration"))){var n=e.parent,i=e.businessObject,r=Xe(e),o=n&&n.businessObject,a=Xe(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=Xe(e),n=$A(e);if(n){var i=ti(n,t.get("bounds"));j(n,{x:e.x+i.x,y:e.y+i.y})}var r=$e(e)?this._getLabel(t):t,o=r.bounds;o||(o=this._bpmnFactory.createDiBounds(),r.set("bounds",o)),j(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"),wt(i,e)),v(t,"bpmn:Lane")&&(r=t.get("flowNodeRef"),St(r,e))}},kn.prototype.updateDiConnection=function(e,t,n){var i=Xe(e),r=Xe(t),o=Xe(n);i.sourceElement&&i.sourceElement.bpmnElement!==ee(t)&&(i.sourceElement=t&&r),i.targetElement&&i.targetElement.bpmnElement!==ee(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):(wt(n,e),e.$parent=null)}};function BA(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=BA(e.$parent||t),e.$parent&&(wt(o.get("rootElements"),r),r.$parent=null),t&&(St(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),wt(a,e)),t?(a=t.get(i),a.push(e),e.$parent=t):e.$parent=null,n){var s=n.get(i);wt(a,e),t&&(s||(s=[],t.set(i,s)),s.push(e))}}},kn.prototype.updateConnectionWaypoints=function(e){var t=Xe(e);t.set("waypoint",this._bpmnFactory.createDiWaypoints(e.waypoints))},kn.prototype.updateConnection=function(e){var t=e.connection,n=ee(t),i=t.source,r=ee(i),o=t.target,a=ee(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&&(wt(n.sourceRef&&n.sourceRef.get("outgoing"),n),r&&r.get("outgoing")&&r.get("outgoing").push(n)),n.sourceRef=r),n.targetRef!==a&&(c&&(wt(n.targetRef&&n.targetRef.get("incoming"),n),a&&a.get("incoming")&&a.get("incoming").push(n)),n.targetRef=a)}this.updateConnectionWaypoints(t),this.updateDiConnection(t,i,o)},kn.prototype._getLabel=function(e){return e.label||(e.label=this._bpmnFactory.createDiLabel()),e.label};function On(e){return function(t){var n=t.context,i=n.shape||n.connection||n.element;v(i,"bpmn:BaseElement")&&e(t)}}function $A(e){if(v(e,"bpmn:Activity")){var t=Xe(e);if(t){var n=t.get("label");if(n)return n.get("bounds")}}}function pr(e,t){Oi.call(this),this._bpmnFactory=e,this._moddle=t}pe(pr,Oi),pr.$inject=["bpmnFactory","moddle"],pr.prototype._baseCreate=Oi.prototype.create,pr.prototype.create=function(e,t){if(e==="label"){var n=t.di||this._bpmnFactory.createDiLabel();return this._baseCreate(e,j({type:"label",di:n},Nr,t))}return this.createElement(e,t)},pr.prototype.createElement=function(e,t){t=j({},t||{});var n,i=t.businessObject,r=t.di;if(!i){if(!t.type)throw new Error("no shape type specified");i=this._bpmnFactory.create(t.type)}if(!FA(r)){var o=j({},r||{},{id:i.id+"_di"});e==="root"?r=this._bpmnFactory.createDiPlane(i,o):e==="connection"?r=this._bpmnFactory.createDiEdge(i,o):r=this._bpmnFactory.createDiShape(i,o)}v(i,"bpmn:Group")&&(t=j({isFrame:!0},t)),t=jA(i,t,["processRef","isInterrupting","associationDirection","isForCompensation"]),t.isExpanded&&(t=Ip(r,t,"isExpanded")),Fe(i,["bpmn:Lane","bpmn:Participant"])&&(t=Ip(r,t,"isHorizontal")),v(i,"bpmn:SubProcess")&&(t.collapsed=!We(i,r)),v(i,"bpmn:ExclusiveGateway")&&(En(r,"isMarkerVisible")?r.isMarkerVisible===void 0&&(r.isMarkerVisible=!1):r.isMarkerVisible=!0),Bt(t.triggeredByEvent)&&(i.triggeredByEvent=t.triggeredByEvent,delete t.triggeredByEvent),Bt(t.cancelActivity)&&(i.cancelActivity=t.cancelActivity,delete t.cancelActivity);var a,s;return t.eventDefinitionType&&(a=i.get("eventDefinitions")||[],s=this._bpmnFactory.create(t.eventDefinitionType,t.eventDefinitionAttrs),t.eventDefinitionType==="bpmn:ConditionalEventDefinition"&&(s.condition=this._bpmnFactory.create("bpmn:FormalExpression")),a.push(s),s.$parent=i,i.eventDefinitions=a,delete t.eventDefinitionType),n=this.getDefaultSize(i,r),t=j({id:i.id},n,t,{businessObject:i,di:r}),this._baseCreate(e,t)},pr.prototype.getDefaultSize=function(e,t){var n=ee(e);if(t=t||Xe(e),v(n,"bpmn:SubProcess"))return We(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 We(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}},pr.prototype.createParticipantShape=function(e){return Vt(e)||(e={isExpanded:e}),e=j({type:"bpmn:Participant"},e||{}),e.isExpanded!==!1&&(e.processRef=this._bpmnFactory.create("bpmn:Process")),this.createShape(e)};function jA(e,t,n){return D(n,function(i){t=Ip(e,t,i)}),t}function Ip(e,t,n){return t[n]===void 0?t:(e[n]=t[n],oi(t,[n]))}function FA(e){return Fe(e,["bpmndi:BPMNShape","bpmndi:BPMNEdge","bpmndi:BPMNDiagram","bpmndi:BPMNPlane"])}function vc(e,t){this._modeling=e,this._canvas=t}vc.$inject=["modeling","canvas"],vc.prototype.preExecute=function(e){var t=this._modeling,n=e.elements,i=e.alignment;D(n,function(r){var o={x:0,y:0};Bt(i.left)?o.x=i.left-r.x:Bt(i.right)?o.x=i.right-r.width-r.x:Bt(i.center)?o.x=i.center-Math.round(r.width/2)-r.x:Bt(i.top)?o.y=i.top-r.y:Bt(i.bottom)?o.y=i.bottom-r.height-r.y:Bt(i.middle)&&(o.y=i.middle-Math.round(r.height/2)-r.y),t.moveElements([r],o,r.parent)})},vc.prototype.postExecute=function(e){};function _c(e){this._modeling=e}_c.$inject=["modeling"],_c.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},_c.prototype.postExecute=function(e){var t=e.hints||{};HA(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 HA(e,t){return Ui(e.outgoing,function(n){return n.target===t})}function bc(e,t){this._canvas=e,this._layouter=t}bc.$inject=["canvas","layouter"],bc.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},bc.prototype.revert=function(e){var t=e.connection;return this._canvas.removeConnection(t),t.source=null,t.target=null,t};var xc=Math.round;function Np(e){this._modeling=e}Np.$inject=["modeling"],Np.prototype.preExecute=function(e){var t=e.elements,n=e.parent,i=e.parentIndex,r=e.position,o=e.hints,a=this._modeling;D(t,function(f){Pe(f.x)||(f.x=0),Pe(f.y)||(f.y=0)});var s=He(t,function(f){return!f.hidden}),c=Mt(s);D(t,function(f){at(f)&&(f.waypoints=on(f.waypoints,function(p){return{x:xc(p.x-c.x-c.width/2+r.x),y:xc(p.y-c.y-c.height/2+r.y)}})),j(f,{x:xc(f.x-c.x-c.width/2+r.x),y:xc(f.y-c.y-c.height/2+r.y)})});var u=new Set(Es(t)),l={};D(t,function(f){if(at(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=j({},o);u.has(f)||(p.autoResize=!1),$e(f)&&(p=oi(p,["attach"])),l[f.id]=Pe(i)?a.createShape(f,ei(f,["x","y","width","height"]),f.parent||n,i,p):a.createShape(f,ei(f,["x","y","width","height"]),f.parent||n,p)}),e.elements=eo(l)};var Gy=Math.round;function fr(e){this._canvas=e}fr.$inject=["canvas"],fr.prototype.execute=function(e){var t=e.shape,n=e.position,i=e.parent,r=e.parentIndex;if(!i)throw new Error("parent required");if(!n)throw new Error("position required");return n.width!==void 0?j(t,n):j(t,{x:n.x-Gy(t.width/2),y:n.y-Gy(t.height/2)}),this._canvas.addShape(t,i,r),t},fr.prototype.revert=function(e){var t=e.shape;return this._canvas.removeShape(t),t};function va(e){fr.call(this,e)}pe(va,fr),va.$inject=["canvas"];var zA=fr.prototype.execute;va.prototype.execute=function(e){var t=e.shape;return VA(t),t.labelTarget=e.labelTarget,zA.call(this,e)};var GA=fr.prototype.revert;va.prototype.revert=function(e){return e.shape.labelTarget=null,GA.call(this,e)};function VA(e){["width","height"].forEach(function(t){typeof e[t]>"u"&&(e[t]=0)})}function _a(e,t){this._canvas=e,this._modeling=t}_a.$inject=["canvas","modeling"],_a.prototype.preExecute=function(e){var t=this._modeling,n=e.connection;lr(n.incoming,function(i){t.removeConnection(i,{nested:!0})}),lr(n.outgoing,function(i){t.removeConnection(i,{nested:!0})})},_a.prototype.execute=function(e){var t=e.connection,n=t.parent;return e.parent=n,e.parentIndex=ll(n.children,t),e.source=t.source,e.target=t.target,this._canvas.removeConnection(t),t.source=null,t.target=null,t},_a.prototype.revert=function(e){var t=e.connection,n=e.parent,i=e.parentIndex;return t.source=e.source,t.target=e.target,St(n.children,t,i),this._canvas.addConnection(t,n),t};function Bp(e,t){this._modeling=e,this._elementRegistry=t}Bp.$inject=["modeling","elementRegistry"],Bp.prototype.postExecute=function(e){var t=this._modeling,n=this._elementRegistry,i=e.elements;D(i,function(r){n.get(r.id)&&(r.waypoints?t.removeConnection(r):t.removeShape(r))})};function ba(e,t){this._canvas=e,this._modeling=t}ba.$inject=["canvas","modeling"],ba.prototype.preExecute=function(e){var t=this._modeling,n=e.shape;lr(n.incoming,function(i){t.removeConnection(i,{nested:!0})}),lr(n.outgoing,function(i){t.removeConnection(i,{nested:!0})}),lr(n.children,function(i){at(i)?t.removeConnection(i,{nested:!0}):t.removeShape(i,{nested:!0})})},ba.prototype.execute=function(e){var t=this._canvas,n=e.shape,i=n.parent;return e.oldParent=i,e.oldParentIndex=ll(i.children,n),t.removeShape(n),n},ba.prototype.revert=function(e){var t=this._canvas,n=e.shape,i=e.oldParent,r=e.oldParentIndex;return St(i.children,n,r),t.addShape(n,i),n};function wc(e){this._modeling=e}wc.$inject=["modeling"];var Vy={x:"y",y:"x"};wc.prototype.preExecute=function(e){var t=this._modeling,n=e.groups,i=e.axis,r=e.dimension;function o(g,S){g.range.min=Math.min(S[i],g.range.min),g.range.max=Math.max(S[i]+S[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,S){var E={y:0};E[i]=g-a(S),E[i]&&(E[Vy[i]]=0,t.moveElements([S],E,S.parent))}var l=n[0],f=s(n),p=n[f],d,h,m=0;D(n,function(g,S){var E,x,w;if(g.elements.length<2){S&&S!==n.length-1&&(o(g,g.elements[0]),m+=c(g.range));return}E=ri(g.elements,i),x=E[0],S===f&&(x=E[s(E)]),w=a(x),g.range=null,D(E,function(C){if(u(w,C),g.range===null){g.range={min:C[i],max:C[i]+C[r]};return}o(g,C)}),S&&S!==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)&&D(n,function(g,S){var E={},x;g===l||g===p||(x=n[S-1],g.range.max=0,D(g.elements,function(w,C){E[Vy[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],C?g.range.max:0)}))})},wc.prototype.postExecute=function(e){};function Ec(e,t){this._layouter=e,this._canvas=t}Ec.$inject=["layouter","canvas"],Ec.prototype.execute=function(e){var t=e.connection,n=t.waypoints;return j(e,{oldWaypoints:n}),t.waypoints=this._layouter.layoutConnection(t,e.hints),t},Ec.prototype.revert=function(e){var t=e.connection;return t.waypoints=e.oldWaypoints,t};function $p(){}$p.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=wt(o.children,t),St(i.children,t,r),t.parent=i,D(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},$p.prototype.revert=function(e){var t=e.connection,n=t.parent,i=e.oldParent,r=e.oldParentIndex,o=e.delta;return wt(n.children,t),St(i.children,t,r),t.parent=i,D(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 jp(){this.allShapes={},this.allConnections={},this.enclosedElements={},this.enclosedConnections={},this.topLevel={}}jp.prototype.add=function(e,t){return this.addAll([e],t)},jp.prototype.addAll=function(e,t){var n=b1(e,!!t,this);return j(this,n),this};function xa(e){this._modeling=e}xa.prototype.moveRecursive=function(e,t,n){return e?this.moveClosure(this.getClosure(e),t,n):[]},xa.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),D(a,function(f){o.moveShape(f,t,u[f.id]&&!l&&n,{recurse:!1,layout:!1})}),D(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&&Ul(f,f.source,t),connectionEnd:d&&ql(f,f.target,t)})})},xa.prototype.getClosure=function(e){return new jp().addAll(e,!0)};function Sc(e){this._helper=new xa(e)}Sc.$inject=["modeling"],Sc.prototype.preExecute=function(e){e.closure=this._helper.getClosure(e.shapes)},Sc.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 xa(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=ei(t,["x","y","width","height"]),e.oldParent=o,e.oldParentIndex=wt(o.children,t),St(i.children,t,r),j(t,{parent:i,x:t.x+n.x,y:t.y+n.y}),t},zr.prototype.postExecute=function(e){var t=e.shape,n=e.delta,i=e.hints,r=this._modeling;i.layout!==!1&&(D(t.incoming,function(o){r.layoutConnection(o,{connectionEnd:ql(o,t,n)})}),D(t.outgoing,function(o){r.layoutConnection(o,{connectionStart:Ul(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 St(n.children,t,i),j(t,{parent:n,x:t.x-r.x,y:t.y-r.y}),t},zr.prototype.moveChildren=function(e){var t=e.delta,n=e.shape;this._helper.moveRecursive(n.children,t,null)},zr.prototype.getNewParent=function(e){return e.newParent||e.shape.parent};function wa(e){this._modeling=e}wa.$inject=["modeling"],wa.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 Ee(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},wa.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||Wy(Ee(r)?r[0]:r)),i&&(!n||o.docking==="target")&&(a.connectionEnd=a.connectionEnd||Wy(Ee(r)?r[r.length-1]:r)),o.newWaypoints&&(a.waypoints=o.newWaypoints),this._modeling.layoutConnection(t,a))},wa.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 Wy(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();D(p,function(h){var m=h.source,g=c(m,s,h);g&&t.reconnectEnd(h,s,Zs(h,s,l),a)}),D(d,function(h){var m=h.target,g=c(s,m,h);g&&t.reconnectStart(h,s,Xs(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 Ea(e){this._modeling=e}Ea.$inject=["modeling"],Ea.prototype.execute=function(e){var t=e.shape,n=e.newBounds,i=e.minBounds;if(n.x===void 0||n.y===void 0||n.width===void 0||n.height===void 0)throw new Error("newBounds must have {x, y, width, height} properties");if(i&&(n.width<i.width||n.height<i.height))throw new Error("width and height cannot be less than minimum height and width");if(!i&&n.width<10||n.height<10)throw new Error("width and height cannot be less than 10px");return e.oldBounds={width:t.width,height:t.height,x:t.x,y:t.y},j(t,{width:n.width,height:n.height,x:n.x,y:n.y}),t},Ea.prototype.postExecute=function(e){var t=this._modeling,n=e.shape,i=e.oldBounds,r=e.hints||{};r.layout!==!1&&(D(n.incoming,function(o){t.layoutConnection(o,{connectionEnd:Zs(o,n,i)})}),D(n.outgoing,function(o){t.layoutConnection(o,{connectionStart:Xs(o,n,i)})}))},Ea.prototype.revert=function(e){var t=e.shape,n=e.oldBounds;return j(t,{width:n.width,height:n.height,x:n.x,y:n.y}),t};function dr(e){this._modeling=e}dr.$inject=["modeling"],dr.prototype.preExecute=function(e){var t=e.delta,n=e.direction,i=e.movingShapes,r=e.resizingShapes,o=e.start,a={};this.moveShapes(i,t),D(r,function(s){a[s.id]=UA(s)}),this.resizeShapes(r,t,n),this.updateConnectionWaypoints(_A(i,r),t,n,o,i,r,a)},dr.prototype.execute=function(){},dr.prototype.revert=function(){},dr.prototype.moveShapes=function(e,t){var n=this;D(e,function(i){n._modeling.moveShape(i,t,null,{autoResize:!1,layout:!1,recurse:!1})})},dr.prototype.resizeShapes=function(e,t,n){var i=this;D(e,function(r){var o=bA(r,n,t);i._modeling.resizeShape(r,o,null,{attachSupport:!1,autoResize:!1,layout:!1})})},dr.prototype.updateConnectionWaypoints=function(e,t,n,i,r,o,a){var s=this,c=new Set(r),u=new Set(o);D(e,function(l){var f=l.source,p=l.target,d=WA(l),h=qy(n),m={},g=c.has(f)||u.has(f),S=c.has(p)||u.has(p);g&&S?(d=on(d,function(E){return Yy(E,i,n)&&(E[h]=E[h]+t[h]),E.original&&Yy(E.original,i,n)&&(E.original[h]=E.original[h]+t[h]),E}),s._modeling.updateWaypoints(l,d,{labelBehavior:!1})):(g||S)&&(c.has(f)?m.connectionStart=Ul(l,f,t):c.has(p)?m.connectionEnd=ql(l,p,t):u.has(f)?m.connectionStart=Xs(l,f,a[f.id]):u.has(p)&&(m.connectionEnd=Zs(l,p,a[p.id])),s._modeling.layoutConnection(l,m))})};function Uy(e){return j({},e)}function WA(e){return on(e.waypoints,function(t){return t=Uy(t),t.original&&(t.original=Uy(t.original)),t})}function qy(e){switch(e){case"n":return"y";case"w":return"x";case"s":return"y";case"e":return"x"}}function Yy(e,t,n){var i=qy(n);if(/e|s/.test(n))return e[i]>t;if(/n|w/.test(n))return e[i]<t}function UA(e){return{x:e.x,y:e.y,height:e.height,width:e.width}}function Rc(e){this._modeling=e}Rc.$inject=["modeling"],Rc.prototype.execute=function(e){var t=e.shape,n=t.children;e.oldChildrenVisibility=Ky(n),t.collapsed=!t.collapsed;var i=Xy(n,t.collapsed);return[t].concat(i)},Rc.prototype.revert=function(e){var t=e.shape,n=e.oldChildrenVisibility,i=t.children,r=Zy(i,n);return t.collapsed=!t.collapsed,[t].concat(r)};function Ky(e){var t={};return D(e,function(n){t[n.id]=n.hidden,n.children&&(t=j({},t,Ky(n.children)))}),t}function Xy(e,t){var n=[];return D(e,function(i){i.hidden=t,n=n.concat(i),i.children&&(n=n.concat(Xy(i.children,i.collapsed||t)))}),n}function Zy(e,t){var n=[];return D(e,function(i){i.hidden=t[i.id],n=n.concat(i),i.children&&(n=n.concat(Zy(i.children,t)))}),n}function Cc(e){this._modeling=e}Cc.$inject=["modeling"],Cc.prototype.execute=function(e){var t=e.shape,n=e.newHost,i=t.host;return e.oldHost=i,e.attacherIdx=Qy(i,t),Jy(n,t),t.host=n,t},Cc.prototype.revert=function(e){var t=e.shape,n=e.newHost,i=e.oldHost,r=e.attacherIdx;return t.host=i,Qy(n,t),Jy(i,t,r),t};function Qy(e,t){return wt(e&&e.attachers,t)}function Jy(e,t,n){if(e){var i=e.attachers;i||(e.attachers=i=[]),St(i,t,n)}}function Fp(){}Fp.prototype.execute=function(e){var t=e.connection,n=e.newWaypoints;return e.oldWaypoints=t.waypoints,t.waypoints=n,t},Fp.prototype.revert=function(e){var t=e.connection,n=e.oldWaypoints;return t.waypoints=n,t};function st(e,t,n){this._eventBus=e,this._elementFactory=t,this._commandStack=n;var i=this;e.on("diagram.init",function(){i.registerHandlers(n)})}st.$inject=["eventBus","elementFactory","commandStack"],st.prototype.getHandlers=function(){return{"shape.append":_c,"shape.create":fr,"shape.delete":ba,"shape.move":zr,"shape.resize":Ea,"shape.replace":$i,"shape.toggleCollapse":Rc,spaceTool:dr,"label.create":va,"connection.create":bc,"connection.delete":_a,"connection.move":$p,"connection.layout":Ec,"connection.updateWaypoints":Fp,"connection.reconnect":wa,"elements.create":Np,"elements.move":Sc,"elements.delete":Bp,"elements.distribute":wc,"elements.align":vc,"element.updateAttachment":Cc}},st.prototype.registerHandlers=function(e){D(this.getHandlers(),function(t,n){e.registerHandler(n,t)})},st.prototype.moveShape=function(e,t,n,i,r){typeof i=="object"&&(r=i,i=null);var o={shape:e,delta:t,newParent:n,newParentIndex:i,hints:r||{}};this._commandStack.execute("shape.move",o)},st.prototype.updateAttachment=function(e,t){var n={shape:e,newHost:t};this._commandStack.execute("element.updateAttachment",n)},st.prototype.moveElements=function(e,t,n,i){i=i||{};var r=i.attach,o=n,a;r===!0?(a=n,o=n.parent):r===!1&&(a=null);var s={shapes:e,delta:t,newParent:o,newHost:a,hints:i};this._commandStack.execute("elements.move",s)},st.prototype.moveConnection=function(e,t,n,i,r){typeof i=="object"&&(r=i,i=void 0);var o={connection:e,delta:t,newParent:n,newParentIndex:i,hints:r||{}};this._commandStack.execute("connection.move",o)},st.prototype.layoutConnection=function(e,t){var n={connection:e,hints:t||{}};this._commandStack.execute("connection.layout",n)},st.prototype.createConnection=function(e,t,n,i,r,o){typeof n=="object"&&(o=r,r=i,i=n,n=void 0),i=this._create("connection",i);var a={source:e,target:t,parent:r,parentIndex:n,connection:i,hints:o};return this._commandStack.execute("connection.create",a),a.connection},st.prototype.createShape=function(e,t,n,i,r){typeof i!="number"&&(r=i,i=void 0),r=r||{};var o=r.attach,a,s;e=this._create("shape",e),o?(a=n.parent,s=n):a=n;var c={position:t,shape:e,parent:a,parentIndex:i,host:s,hints:r};return this._commandStack.execute("shape.create",c),c.shape},st.prototype.createElements=function(e,t,n,i,r){Ee(e)||(e=[e]),typeof i!="number"&&(r=i,i=void 0),r=r||{};var o={position:t,elements:e,parent:n,parentIndex:i,hints:r};return this._commandStack.execute("elements.create",o),o.elements},st.prototype.createLabel=function(e,t,n,i){n=this._create("label",n);var r={labelTarget:e,position:t,parent:i||e.parent,shape:n};return this._commandStack.execute("label.create",r),r.shape},st.prototype.appendShape=function(e,t,n,i,r){r=r||{},t=this._create("shape",t);var o={source:e,position:n,target:i,shape:t,connection:r.connection,connectionParent:r.connectionParent,hints:r};return this._commandStack.execute("shape.append",o),o.shape},st.prototype.removeElements=function(e){var t={elements:e};this._commandStack.execute("elements.delete",t)},st.prototype.distributeElements=function(e,t,n){var i={groups:e,axis:t,dimension:n};this._commandStack.execute("elements.distribute",i)},st.prototype.removeShape=function(e,t){var n={shape:e,hints:t||{}};this._commandStack.execute("shape.delete",n)},st.prototype.removeConnection=function(e,t){var n={connection:e,hints:t||{}};this._commandStack.execute("connection.delete",n)},st.prototype.replaceShape=function(e,t,n){var i={oldShape:e,newData:t,hints:n||{}};return this._commandStack.execute("shape.replace",i),i.newShape},st.prototype.alignElements=function(e,t){var n={elements:e,alignment:t};this._commandStack.execute("elements.align",n)},st.prototype.resizeShape=function(e,t,n,i){var r={shape:e,newBounds:t,minBounds:n,hints:i};this._commandStack.execute("shape.resize",r)},st.prototype.createSpace=function(e,t,n,i,r){var o={delta:n,direction:i,movingShapes:e,resizingShapes:t,start:r};this._commandStack.execute("spaceTool",o)},st.prototype.updateWaypoints=function(e,t,n){var i={connection:e,newWaypoints:t,hints:n||{}};this._commandStack.execute("connection.updateWaypoints",i)},st.prototype.reconnect=function(e,t,n,i,r){var o={connection:e,newSource:t,newTarget:n,dockingOrPoints:i,hints:r||{}};this._commandStack.execute("connection.reconnect",o)},st.prototype.reconnectStart=function(e,t,n,i){i||(i={}),this.reconnect(e,t,e.target,n,j(i,{docking:"source"}))},st.prototype.reconnectEnd=function(e,t,n,i){i||(i={}),this.reconnect(e,e.source,t,n,j(i,{docking:"target"}))},st.prototype.connect=function(e,t,n,i){return this.createConnection(e,t,n||{},e.parent,i)},st.prototype._create=function(e,t){return oS(t)?t:this._elementFactory.create(e,t)},st.prototype.toggleCollapse=function(e,t){var n={shape:e,hints:t||{}};this._commandStack.execute("shape.toggleCollapse",n)};function Sa(e){this._elementRegistry=e}Sa.$inject=["elementRegistry"],Sa.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||qA(n,Za(i));return ev(n,i),e.oldProperties=o,e.changed=r,r},Sa.prototype.revert=function(e){var t=e.oldProperties,n=e.moddleElement,i=e.changed;return ev(n,t),i},Sa.prototype._getVisualReferences=function(e){var t=this._elementRegistry;return v(e,"bpmn:DataObject")?YA(e,t):[]};function qA(e,t){return Sn(t,function(n,i){return n[i]=e.get(i),n},{})}function ev(e,t){D(t,function(n,i){e.set(i,n)})}function YA(e,t){return t.filter(function(n){return v(n,"bpmn:DataObjectReference")&&ee(n).dataObjectRef===e})}var Ra="default",ji="id",tv="di",KA={width:0,height:0};function Ca(e,t,n,i){this._elementRegistry=e,this._moddle=t,this._modeling=n,this._textRenderer=i}Ca.$inject=["elementRegistry","moddle","modeling","textRenderer"],Ca.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=eT(e.properties),s=e.oldProperties||XA(t,a);return nv(a,o)&&(r.unclaim(o[ji]),i.updateId(t,a[ji]),r.claim(a[ji],o)),Ra in a&&(a[Ra]&&n.push(i.get(a[Ra].id)),o[Ra]&&n.push(i.get(o[Ra].id))),iv(t,a),e.oldProperties=s,e.changed=n,n},Ca.prototype.postExecute=function(e){var t=e.element,n=t.label,i=n&&ee(n).name;if(i){var r=this._textRenderer.getExternalLabelBounds(n,i);this._modeling.resizeShape(n,r,KA)}},Ca.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 iv(t,i),nv(n,r)&&(a.unclaim(n[ji]),o.updateId(t,i[ji]),a.claim(i[ji],r)),e.changed};function nv(e,t){return ji in e&&e[ji]!==t[ji]}function XA(e,t){var n=Za(t),i=e.businessObject,r=Xe(e);return Sn(n,function(o,a){return a!==tv?o[a]=i.get(a):o[a]=ZA(r,Za(t.di)),o},{})}function ZA(e,t){return Sn(t,function(n,i){return n[i]=e&&e.get(i),n},{})}function iv(e,t){var n=e.businessObject,i=Xe(e);D(t,function(r,o){o!==tv?n.set(o,r):i&&QA(i,r)})}function QA(e,t){D(t,function(n,i){e.set(i,n)})}var JA=["default"];function eT(e){var t=j({},e);return JA.forEach(function(n){n in e&&(t[n]=ee(t[n]))}),t}function Pc(e,t){this._canvas=e,this._modeling=t}Pc.$inject=["canvas","modeling"],Pc.prototype.execute=function(e){var t=this._canvas,n=e.newRoot,i=n.businessObject,r=t.getRootElement(),o=r.businessObject,a=o.$parent,s=Xe(r);return t.setRootElement(n),t.removeRootElement(r),St(a.rootElements,i),i.$parent=a,wt(a.rootElements,o),o.$parent=null,r.di=null,s.bpmnElement=i,n.di=s,e.oldRoot=r,[]},Pc.prototype.revert=function(e){var t=this._canvas,n=e.newRoot,i=n.businessObject,r=e.oldRoot,o=r.businessObject,a=i.$parent,s=Xe(n);return t.setRootElement(r),t.removeRootElement(n),wt(a.rootElements,i),i.$parent=null,St(a.rootElements,o),o.$parent=a,n.di=null,s.bpmnElement=o,r.di=s,[]};function Hp(e,t){this._modeling=e,this._spaceTool=t}Hp.$inject=["modeling","spaceTool"],Hp.prototype.preExecute=function(e){var t=this._spaceTool,n=this._modeling,i=e.shape,r=e.location,o=Gn(i),a=o===i,s=a?i:i.parent,c=or(s),u=Ut(i);if(u?r==="left"?r="top":r==="right"&&(r="bottom"):r==="top"?r="left":r==="bottom"&&(r="right"),!c.length){var l=u?{x:i.x+zn,y:i.y,width:i.width-zn,height:i.height}:{x:i.x,y:i.y+zn,width:i.width,height:i.height-zn};n.createShape({type:"bpmn:Lane",isHorizontal:u},l,s)}var f=[];Lr(o,function(w){return f.push(w),w.label&&f.push(w.label),w===i?[]:He(w.children,function(C){return C!==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 S=t.calculateAdjustments(f,g,p,h),E=u?{x:0,y:p}:{x:p,y:0};t.makeSpace(S.movingShapes,S.resizingShapes,E,m,h);var x=u?{x:i.x+(a?zn:0),y:d-(r==="top"?120:0),width:i.width-(a?zn:0),height:120}:{x:d-(r==="left"?120:0),y:i.y+(a?zn:0),width:120,height:i.height-(a?zn:0)};e.newLane=n.createShape({type:"bpmn:Lane",isHorizontal:u},x,s)};function zp(e){this._modeling=e}zp.$inject=["modeling"],zp.prototype.preExecute=function(e){var t=this._modeling,n=e.shape,i=e.count,r=or(n),o=r.length;if(o>i)throw new Error(`more than <${i}> child lanes`);var a=Ut(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+zn,y:n.y+p*c,width:n.width-zn,height:u}:{x:n.x+p*c,y:n.y+zn,width:u,height:n.height-zn},p<o?t.resizeShape(r[p],l):(f={type:"bpmn:Lane",isHorizontal:a},t.createShape(f,l,n))};function Pa(e,t){this._modeling=e,this._spaceTool=t}Pa.$inject=["modeling","spaceTool"],Pa.prototype.preExecute=function(e){var t=e.shape,n=e.newBounds,i=e.balanced;i!==!1?this.resizeBalanced(t,n):this.resizeSpace(t,n)},Pa.prototype.resizeBalanced=function(e,t){var n=this._modeling,i=YR(e,t);n.resizeShape(e,t),i.forEach(function(r){n.resizeShape(r.shape,r.newBounds)})},Pa.prototype.resizeSpace=function(e,t){var n=this._spaceTool,i=xe(e),r=xe(t),o=Im(r,i),a=Gn(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 Aa="flowNodeRef",Gp="lanes";function Ac(){}Ac.prototype._computeUpdates=function(e,t){var n=[],i=[],r={},o=[];function a(l,f){var p=xe(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=Gn(l);return r[f.id]||(r[f.id]=Ws(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=Gn(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(Gp),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(Aa).forEach(function(p){i.push({flowNode:p,remove:[f],add:[]})})}),i},Ac.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(Gp);n.remove.forEach(function(o){wt(r,o),wt(o.get(Aa),i)}),n.add.forEach(function(o){St(r,o),St(o.get(Aa),i)})}),[]},Ac.prototype.revert=function(e){var t=e.updates;return t.forEach(function(n){var i=n.flowNode,r=i.get(Gp);n.add.forEach(function(o){wt(r,o),wt(o.get(Aa),i)}),n.remove.forEach(function(o){St(r,o),St(o.get(Aa),i)})}),[]};var Vp="categoryValueRef";function Ta(e,t){this._bpmnFactory=e,this._elementRegistry=t}Ta.$inject=["bpmnFactory","elementRegistry"],Ta.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 C=a.get(E);C||(C={},a.set(E,C)),!(w&&C.present)&&(!w&&C.past||(w?C.present={categoryValue:x,root:Wp(E)}:C.past={categoryValue:x}))}}function c(E){r.set(E,ee(E))}function u(){n.filter(function(E){return v(E,"bpmn:FlowElement")&&!$e(E)&&E.parent}).forEach(c)}function l(E){var x=ee(E),w=x.get("categoryValueRef");return w||(w=Mm(i,x),o.push(tT(E,w))),w}function f(E){return E.reduce(function(x,w){var C=Wp(w),P=x.get(C);return P||(P=[],x.set(C,P)),P.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")&&!$e(E)&&E.parent}).forEach(function(E){var x=ee(E).get("categoryValueRef");if(!x){var w=Wp(E),C=p.get(w)||[],P=uo(C,E),L=Object.keys(P).length>0;L&&(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 C=g.get(w.root)||[],P=uo(C,x);C.forEach(function(L){if(P[L.id]){var T=m.get(L);T||(T=new Set,m.set(L,T)),T.add(w.categoryValue)}})}});var S=d.reduce(function(E,x){var w=r.get(x),C=w.get(Vp),P=new Set(C),L=m.get(x)||new Set,T=Array.from(L).filter(function(k){return!P.has(k)}),B=C.filter(function(k){return h.has(k)&&!L.has(k)});return(T.length||B.length)&&E.push({businessObject:w,categoryValuesToAdd:T,categoryValuesToRemove:B}),E},[]);return{flowElements:S,groups:o}},Ta.prototype.execute=function(e){var t=e.updates;return t||(t=e.updates=this._computeUpdates(e.affectedFlowElements,e.affectedGroupEntries)),nT(t.groups),rT(t.flowElements),[]},Ta.prototype.revert=function(e){var t=e.updates;return oT(t.flowElements),iT(t.groups),[]};function tT(e,t){return{groupShape:e,categoryValue:t,category:t.$parent}}function nT(e){e.forEach(function(t){ee(t.groupShape).categoryValueRef=t.categoryValue,t.categoryValue.$parent=t.category})}function iT(e){e.forEach(function(t){ee(t.groupShape).categoryValueRef=null})}function rT(e){e.forEach(function(t){var n=t.businessObject,i=n.get(Vp);t.categoryValuesToRemove.forEach(function(r){wt(i,r)}),t.categoryValuesToAdd.forEach(function(r){St(i,r,!0)})})}function oT(e){e.forEach(function(t){var n=t.businessObject,i=n.get(Vp);t.categoryValuesToAdd.forEach(function(r){wt(i,r)}),t.categoryValuesToRemove.forEach(function(r){St(i,r,!0)})})}function Wp(e){for(;e.parent;)e=e.parent;return e}function Tc(e){this._moddle=e}Tc.$inject=["moddle"],Tc.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),[]},Tc.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 aT={fill:void 0,stroke:void 0};function Up(e){this._commandStack=e,this._normalizeColor=function(t){if(t){if(wn(t)){var n=sT(t);if(n)return n}throw new Error(`invalid color value: ${t}`)}}}Up.$inject=["commandStack"],Up.prototype.postExecute=function(e){var t=e.elements,n=e.colors||aT,i=this,r={};"fill"in n&&j(r,{"background-color":this._normalizeColor(n.fill)}),"stroke"in n&&j(r,{"border-color":this._normalizeColor(n.stroke)}),D(t,function(o){var a=at(o)?ei(r,["border-color"]):r,s=Xe(o);if(cT(a),$e(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(!Fe(s,["bpmndi:BPMNEdge","bpmndi:BPMNShape"]))return;i._commandStack.execute("element.updateProperties",{element:o,properties:{di:a}})}})};function sT(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 cT(e){"border-color"in e&&(e.stroke=e["border-color"]),"background-color"in e&&(e.fill=e["background-color"])}var uT={width:0,height:0};function rv(e,t,n){function i(c,u){var l=c.label||c,f=c.labelTarget||c;return BS(l,u),[l,f]}function r(c){var u=c.element,l=u.businessObject,f=c.newLabel;if(!$e(u)&&ir(u)&&!Os(u)&&!ov(f)){var p=7,d=gl(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=Bn(c.element),i(c.element,c.newLabel)}function a(c){return i(c.element,c.oldLabel)}function s(c){var u=c.element,l=u.label||u,f=c.newLabel,p=c.newBounds,d=c.hints||{};if(!(!$e(l)&&!v(l,"bpmn:TextAnnotation"))){if($e(l)&&ov(f)){d.removeShape!==!1&&e.removeShape(l,{unsetLabel:!1});return}var h=Bn(u);typeof p>"u"&&(p=t.getExternalLabelBounds(l,h)),p&&e.resizeShape(l,p,uT)}}this.preExecute=r,this.execute=o,this.revert=a,this.postExecute=s}rv.$inject=["modeling","textRenderer","bpmnFactory"];function ov(e){return!e||!e.trim()}function en(e,t,n,i){st.call(this,e,t,n),this._bpmnRules=i}pe(en,st),en.$inject=["eventBus","elementFactory","commandStack","bpmnRules"],en.prototype.getHandlers=function(){var e=st.prototype.getHandlers.call(this);return e["element.updateModdleProperties"]=Sa,e["element.updateProperties"]=Ca,e["canvas.updateRoot"]=Pc,e["lane.add"]=Hp,e["lane.resize"]=Pa,e["lane.split"]=zp,e["lane.updateRefs"]=Ac,e["group.updateRefs"]=Ta,e["id.updateClaim"]=Tc,e["element.setColor"]=Up,e["element.updateLabel"]=rv,e},en.prototype.updateLabel=function(e,t,n,i){this._commandStack.execute("element.updateLabel",{element:e,newLabel:t,newBounds:n,hints:i||{}})},en.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)},en.prototype.updateModdleProperties=function(e,t,n){this._commandStack.execute("element.updateModdleProperties",{element:e,moddleElement:t,properties:n})},en.prototype.updateProperties=function(e,t){this._commandStack.execute("element.updateProperties",{element:e,properties:t})},en.prototype.resizeLane=function(e,t,n){this._commandStack.execute("lane.resize",{shape:e,newBounds:t,balanced:n})},en.prototype.addLane=function(e,t){var n={shape:e,location:t};return this._commandStack.execute("lane.add",n),n.newLane},en.prototype.splitLane=function(e,t){this._commandStack.execute("lane.split",{shape:e,count:t})},en.prototype.makeCollaboration=function(){var e=this._create("root",{type:"bpmn:Collaboration"}),t={newRoot:e};return this._commandStack.execute("canvas.updateRoot",t),e},en.prototype.makeProcess=function(){var e=this._create("root",{type:"bpmn:Process"}),t={newRoot:e};return this._commandStack.execute("canvas.updateRoot",t),e},en.prototype.updateLaneRefs=function(e,t){this._commandStack.execute("lane.updateRefs",{flowNodeShapes:e,laneShapes:t})},en.prototype.updateCategoryValueRefs=function(e,t){this._commandStack.execute("group.updateRefs",{affectedFlowElements:e,affectedGroupEntries:t})},en.prototype.claimId=function(e,t){this._commandStack.execute("id.updateClaim",{id:e,element:t,claiming:!0})},en.prototype.unclaimId=function(e,t){this._commandStack.execute("id.updateClaim",{id:e,element:t})},en.prototype.setColor=function(e,t){e.length||(e=[e]),this._commandStack.execute("element.setColor",{elements:e,colors:t})};function av(){}av.prototype.layoutConnection=function(e,t){return t=t||{},[t.connectionStart||Se(t.source||e.source),t.connectionEnd||Se(t.target||e.target)]};var Mc=20,lT=5,kc=Math.round,sv=20,pT={"h:h":20,"v:v":20,"h:v":-10,"v:h":-10};function fT(e,t){return!{t:/top/,r:/right/,b:/bottom/,l:/left/,h:/./,v:/./}[t].test(e)}function dT(e,t){return{t:/top/,r:/right/,b:/bottom/,l:/left/,h:/left|right/,v:/top|bottom/}[e].test(t)}function cv(e,t,n){var i=Zt(t,e,lT),r=n.split(":")[0],o=kc((t.x-e.x)/2+e.x),a=kc((t.y-e.y)/2+e.y),s,c,u=dT(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=fT(i,r),c=l?"h:v":"v:h",f?l?(p=a===e.y,s={x:e.x+Mc*(/l/.test(r)?-1:1),y:p?a+Mc:a}):(p=o===e.x,s={x:p?o+Mc:o,y:e.y+Mc*(/t/.test(r)?-1:1)}):s={x:o,y:a}),{waypoints:qp(e,s,c).concat(s),directions:c,turnNextDirections:p}}function hT(e,t,n){return cv(e,t,n)}function mT(e,t,n){var i=cv(t,e,uv(n));return{waypoints:i.waypoints.slice().reverse(),directions:uv(i.directions),turnNextDirections:i.turnNextDirections}}function gT(e,t){var n=e.directions.split(":")[1],i=t.directions.split(":")[0];e.turnNextDirections&&(n=n=="h"?"v":"h"),t.turnNextDirections&&(i=i=="h"?"v":"h");var r=n+":"+i,o=qp(e.waypoints[e.waypoints.length-1],t.waypoints[0],r);return{waypoints:o,directions:r}}function uv(e){return e.split(":").reverse().join(":")}function yT(e,t,n){var i=kc((t.x-e.x)/2+e.x),r=kc((t.y-e.y)/2+e.y);if(n==="h:v")return[{x:t.x,y:e.y}];if(n==="v:h")return[{x:e.x,y:t.y}];if(n==="h:h")return[{x:i,y:e.y},{x:i,y:t.y}];if(n==="v:v")return[{x:e.x,y:r},{x:t.x,y:r}];throw new Error("invalid directions: can only handle varians of [hv]:[hv]")}function qp(e,t,n){if(n=n||"h:h",!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(pv(n)){var i=hT(e,t,n),r=mT(e,t,n),o=gT(i,r);return[].concat(i.waypoints,o.waypoints,r.waypoints)}return yT(e,t,n)}function vT(e,t,n){var i=qp(e,t,n);return i.unshift(e),i.push(t),dv(i)}function _T(e,t,n,i,r){var o=r&&r.preferredLayouts||[],a=_0(o,"straight")[0]||"h:h",s=pT[a]||0,c=Zt(e,t,s),u=RT(c,a);n=n||Se(e),i=i||Se(t);var l=u.split(":"),f=fv(n,e,l[0],PT(c)),p=fv(i,t,l[1],c);return vT(f,p,u)}function bT(e,t,n,i,r,o){Ee(n)&&(r=n,o=i,n=Se(e),i=Se(t)),o=j({preferredLayouts:[]},o),r=r||[];var a=o.preferredLayouts,s=a.indexOf("straight")!==-1,c;return c=s&&wT(e,t,n,i,o),c||(c=o.connectionEnd&&ST(t,e,i,r),c)||(c=o.connectionStart&&ET(e,t,n,r),c)?c:!o.connectionStart&&!o.connectionEnd&&r&&r.length?r:_T(e,t,n,i,o)}function xT(e,t,n){return e>=t&&e<=n}function lv(e,t,n){var i={x:"width",y:"height"};return xT(t[e],n[e],n[e]+n[i[e]])}function wT(e,t,n,i,r){var o={},a,s;return s=Zt(e,t),/^(top|bottom|left|right)$/.test(s)?(/top|bottom/.test(s)&&(a="x"),/left|right/.test(s)&&(a="y"),r.preserveDocking==="target"?lv(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:lv(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 ET(e,t,n,i){return Yp(e,t,n,i)}function ST(e,t,n,i){var r=i.slice().reverse();return r=Yp(e,t,n,r),r?r.reverse():null}function Yp(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&&Jo(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(Nh(l[d],f,sv)||Nh(l[d],p,sv))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=Yp(e,t,n,u)),c&&Mi(c)?null:c}function RT(e,t){if(pv(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 pv(e){return e&&/t|r|b|l/.test(e)}function PT(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 fv(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 dv(e){return e.reduce(function(t,n,i){var r=t[t.length-1],o=e[i+1];return pl(r,o,n,0)||t.push(n),t},[])}var AT=-10,TT=40,MT={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},kT={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},Kp={top:"bottom","top-right":"bottom-left","top-left":"bottom-right",right:"left",bottom:"top","bottom-right":"top-left","bottom-left":"top-right",left:"right"},Ma={top:"t",right:"r",bottom:"b",left:"l"};function Oc(e){this._elementRegistry=e}pe(Oc,av),Oc.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=hv(r&&r[0],n)),a||(a=hv(r&&r[r.length-1],i)),(v(e,"bpmn:Association")||v(e,"bpmn:DataAssociation"))&&r&&!mv(n,i))return[].concat([o],r.slice(1,-1),[a]);var l=Cm(n,s)?MT:kT;return v(e,"bpmn:MessageFlow")?c=DT(n,i,l):(v(e,"bpmn:SequenceFlow")||mv(n,i))&&(n===i?c={preferredLayouts:jT(n,e,l)}:v(n,"bpmn:BoundaryEvent")?c={preferredLayouts:FT(n,i,a,l)}:ka(n)||ka(i)?c={preferredLayouts:l.subProcess,preserveDocking:IT(n)}:v(n,"bpmn:Gateway")?c={preferredLayouts:l.fromGateway}:v(i,"bpmn:Gateway")?c={preferredLayouts:l.toGateway}:c={preferredLayouts:l.default}),c&&(c=j(c,t),u=dv(bT(n,i,o,a,r,c))),u||[o,a]};function OT(e){var t=e.host;return Zt(Se(e),t,AT)}function DT(e,t,n){return{preferredLayouts:n.messageFlow,preserveDocking:LT(e,t)}}function LT(e,t){return v(t,"bpmn:Participant")?"source":v(e,"bpmn:Participant")?"target":ka(t)?"source":ka(e)||v(t,"bpmn:Event")?"target":v(e,"bpmn:Event")?"source":null}function IT(e){return ka(e)?"target":"source"}function hv(e,t){return e?e.original||e:Se(t)}function mv(e,t){return v(t,"bpmn:Activity")&&v(e,"bpmn:BoundaryEvent")&&t.businessObject.isForCompensation}function ka(e){return v(e,"bpmn:SubProcess")&&We(e)}function Gr(e,t){return e===t}function NT(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 gv(e,t){return Kp[e]===t}function BT(e,t){var n=To(e),i=Kp[n];return t.indexOf(i)!==-1}function $T(e,t){var n=Mo(e),i=Kp[n];return t.indexOf(i)!==-1}function yv(e){return e==="right"||e==="left"}function jT(e,t,n){var i=t.waypoints,r=i&&i.length&&Zt(i[0],e);return r==="top"?n.loop.fromTop:r==="right"?n.loop.fromRight:r==="left"?n.loop.fromLeft:n.loop.fromBottom}function FT(e,t,n,i){var r=Se(e),o=Se(t),a=OT(e),s,c,u=Gr(e.host,t),l=NT(a,["top","right","bottom","left"]),f=Zt(o,r,{x:e.width/2+t.width/2,y:e.height/2+t.height/2});return u?HT(a,l,e,t,n,i):(s=zT(a,f,l,i.isHorizontal),c=GT(a,f,l,i.isHorizontal),[s+":"+c])}function HT(e,t,n,i,r,o){var a=t?e:o.isHorizontal?Mo(e):To(e),s=Ma[a],c;return t?yv(e)?c=vv("y",n,i,r)?"h":o.boundaryLoop.alternateHorizontalSide:c=vv("x",n,i,r)?"v":o.boundaryLoop.alternateVerticalSide:c=o.boundaryLoop.default,[s+":"+c]}function vv(e,t,n,i){var r=TT;return!(Xp(e,i,n,r)||Xp(e,i,{x:n.x+n.width,y:n.y+n.height},r)||Xp(e,i,Se(t),r))}function Xp(e,t,n,i){return Math.abs(t[e]-n[e])<i}function zT(e,t,n,i){if(n)return Ma[e];var r=Mo(e),o=To(e),a=Mo(t),s=To(t);if(i){if(Gr(r,a)||gv(o,s))return Ma[r]}else if(Gr(o,s)||gv(r,a))return Ma[o];return Ma[i?o:r]}function GT(e,t,n,i){if(n)return yv(e)?BT(e,t)||Gr(e,t)?"h":"v":$T(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"}Oc.$inject=["elementRegistry"];function _v(e){return j({original:e.point.original||e.point},e.actual)}function hr(e,t){this._elementRegistry=e,this._graphicsFactory=t}hr.$inject=["elementRegistry","graphicsFactory"],hr.prototype.getCroppedWaypoints=function(e,t,n){t=t||e.source,n=n||e.target;var i=this.getDockingPoint(e,t,!0),r=this.getDockingPoint(e,n),o=e.waypoints.slice(i.idx+1,r.idx);return o.unshift(_v(i)),o.push(_v(r)),o},hr.prototype.getDockingPoint=function(e,t,n){var i=e.waypoints,r,o,a;return r=n?0:i.length-1,o=i[r],a=this._getIntersection(t,e,n),{point:o,actual:a||o,idx:r}},hr.prototype._getIntersection=function(e,t,n){var i=this._getShapePath(e),r=this._getConnectionPath(t);return ea(i,r,n)},hr.prototype._getConnectionPath=function(e){return this._graphicsFactory.getConnectionPath(e)},hr.prototype._getShapePath=function(e){return this._graphicsFactory.getShapePath(e)},hr.prototype._getGfx=function(e){return this._elementRegistry.getGraphics(e)};const Zp={__init__:["modeling","bpmnUpdater"],__depends__:[cP,SP,CP,PP,ky,AA,MA,NA,Wn,Lp,By],bpmnFactory:["type",qn],bpmnUpdater:["type",kn],elementFactory:["type",pr],modeling:["type",en],layouter:["type",Oc],connectionDocking:["type",hr]};var VT=10,bv=50,WT=250;function Qp(e,t,n,i){for(var r;r=UT(e,n,t);)n=i(t,n,r);return n}function Jp(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 UT(e,t,n){var i={x:t.x-n.width/2,y:t.y-n.height/2,width:n.width,height:n.height},r=YT(e);return ut(r,function(o){if(o===n)return!1;var a=Zt(o,i,VT);return a==="intersect"})}function qT(e,t){t||(t={});function n(h){return h.source===e?1:-1}var i=t.defaultDistance||bv,r=t.direction||"e",o=t.filter,a=t.getWeight||n,s=t.maxDistance||WT,c=t.reference||"start";o||(o=ZT);function u(h,m){return r==="n"?c==="start"?xe(h).top-xe(m).bottom:c==="center"?xe(h).top-Se(m).y:xe(h).top-xe(m).top:r==="w"?c==="start"?xe(h).left-xe(m).right:c==="center"?xe(h).left-Se(m).x:xe(h).left-xe(m).left:r==="s"?c==="start"?xe(m).top-xe(h).bottom:c==="center"?Se(m).y-xe(h).bottom:xe(m).bottom-xe(h).bottom:c==="start"?xe(m).left-xe(h).right:c==="center"?Se(m).x-xe(h).right:xe(m).right-xe(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,S=m.weight;return g<0||g>s||(h[String(g)]||(h[String(g)]=0),h[String(g)]+=1*S,(!h.distance||h[h.distance]<h[String(g)])&&(h.distance=g)),h},{});return d.distance||i}function YT(e){var t=ef(e);return e.host&&(t=t.concat(ef(e.host))),e.attachers&&(t=t.concat(e.attachers.reduce(function(n,i){return n.concat(ef(i))},[]))),t}function ef(e){return XT(e).concat(KT(e))}function KT(e){return e.incoming.map(function(t){return t.source})}function XT(e){return e.outgoing.map(function(t){return t.target})}function ZT(){return!0}var QT=100;function xv(e,t,n){e.on("autoPlace",QT,function(i){var r=i.shape,o=i.source;return JT(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}}xv.$inject=["eventBus","modeling","canvas"];function JT(e,t,n){n||(n={});var i=n.defaultDistance||bv,r=Se(e),o=xe(e);return{x:o.right+i+t.width/2,y:r.y}}function wv(e,t){e.on("autoPlace.end",500,function(n){t.select(n.shape)})}wv.$inject=["eventBus","selection"];const eM={__init__:["autoPlaceSelectionBehavior"],autoPlace:["type",xv],autoPlaceSelectionBehavior:["type",wv]};function Ev(e,t,n){var i=Cm(e,n);if(v(t,"bpmn:TextAnnotation"))return nM(e,t,i);if(Fe(t,["bpmn:DataObjectReference","bpmn:DataStoreReference"]))return iM(e,t,i);if(v(t,"bpmn:FlowNode"))return tM(e,t,i)}function tM(e,t,n){var i=xe(e),r=Se(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=qT(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=Zt(e,e.host,-25),u.indexOf(o.boundaryOrientation)!==-1&&(s*=-1));var l=n?{x:i.right+a+t.width/2,y:r.y+Sv(u,c,o)}:{x:r.x+Sv(u,c,o),y:i.bottom+a+t.height/2},f={margin:s,minDistance:c},p=n?{y:f}:{x:f};return Qp(e,t,l,Jp(p))}function Sv(e,t,n){return e.includes(n.start)?-1*t:e.includes(n.end)?t:0}function nM(e,t,n){var i=xe(e),r=n?{x:i.right+t.width/2,y:i.top-50-t.height/2}:{x:i.right+50+t.width/2,y:i.bottom+t.height/2};at(e)&&(r=Se(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 Qp(e,t,r,Jp(a))}function iM(e,t,n){var i=xe(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 Qp(e,t,r,Jp(a))}function Rv(e,t){e.on("autoPlace",function(n){var i=n.shape,r=n.source;return Ev(r,i,t)})}Rv.$inject=["eventBus","elementRegistry"];const Dc={__depends__:[eM],__init__:["bpmnAutoPlace"],bpmnAutoPlace:["type",Rv]},Cv=[Sm,aa,Zp,Dc];function rM(e={}){Ed(globalThis,e.dom);const t=document.createElement("div");return document.body.appendChild(t),new fo({container:t,moddleExtensions:e.moddleExtensions??rs,additionalModules:[...Cv,...e.additionalModules??[]]})}var oM=new Po("ov"),aM=500;function Yt(e,t,n,i){this._eventBus=t,this._canvas=n,this._elementRegistry=i,this._ids=oM,this._overlayDefaults=j({show:null,scale:!0},e&&e.defaults),this._overlays={},this._overlayContainers=[],this._overlayRoot=sM(n.getContainer()),this._init()}Yt.$inject=["config.overlays","eventBus","canvas","elementRegistry"],Yt.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?He(t.overlays,no({type:e.type})):t.overlays.slice():[]}else return e.type?He(this._overlays,no({type:e.type})):e.id?this._overlays[e.id]:null},Yt.prototype.add=function(e,t,n){if(Vt(t)&&(n=t,t=null),e.id||(e=this._elementRegistry.get(e)),!n.position)throw new Error("must specifiy overlay position");if(!n.html)throw new Error("must specifiy overlay html");if(!e)throw new Error("invalid element specified");var i=this._ids.next();return n=j({},this._overlayDefaults,n,{id:i,type:t,element:e,html:n.html}),this._addOverlay(n),i},Yt.prototype.remove=function(e){var t=this.get(e)||[];Ee(t)||(t=[t]);var n=this;D(t,function(i){var r=n._getOverlayContainer(i.element,!0);if(i&&(li(i.html),li(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)}})},Yt.prototype.isShown=function(){return this._overlayRoot.style.display!=="none"},Yt.prototype.show=function(){Lc(this._overlayRoot)},Yt.prototype.hide=function(){Lc(this._overlayRoot,!1)},Yt.prototype.clear=function(){this._overlays={},this._overlayContainers=[],ys(this._overlayRoot)},Yt.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}Pv(n,i,r),sn(e.html,"data-container-id",t.id)},Yt.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}Pv(n,r||0,o||0),this._updateOverlayVisibilty(e,this._canvas.viewbox())},Yt.prototype._createOverlayContainer=function(e){var t=ft('<div class="djs-overlays" />');dn(t,{position:"absolute"}),this._overlayRoot.appendChild(t);var n={html:t,element:e,overlays:[]};return this._updateOverlayContainer(n),this._overlayContainers.push(n),n},Yt.prototype._updateRoot=function(e){var t=e.scale||1,n="matrix("+[t,0,0,t,-1*e.x*t,-1*e.y*t].join(",")+")";Av(this._overlayRoot,n)},Yt.prototype._getOverlayContainer=function(e,t){var n=ut(this._overlayContainers,function(i){return i.element===e});return!n&&!t?this._createOverlayContainer(e):n},Yt.prototype._addOverlay=function(e){var t=e.id,n=e.element,i=e.html,r,o;i.get&&i.constructor.prototype.jquery&&(i=i.get(0)),wn(i)&&(i=ft(i)),o=this._getOverlayContainer(n),r=ft('<div class="djs-overlay" data-overlay-id="'+t+'">'),dn(r,{position:"absolute"}),r.appendChild(i),e.type&&mt(r).add("djs-overlay-"+e.type);var a=this._canvas.findRoot(n),s=this._canvas.getRootElement();Lc(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())},Yt.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&&(Bt(r)&&r>t.scale||Bt(o)&&o<t.scale))&&(c=!1),Lc(a,c),this._updateOverlayScale(e,t)},Yt.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),Bt(i)&&t.scale<i&&(a=(1/t.scale||1)*i),Bt(r)&&t.scale>r&&(a=(1/t.scale||1)*r)),Bt(a)&&(s="scale("+a+","+a+")"),Av(o,s)},Yt.prototype._updateOverlaysVisibilty=function(e){var t=this;D(this._overlays,function(n){t._updateOverlayVisibilty(n,e)})},Yt.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});D(o,function(c){t.remove(c.id)});var a=t._getOverlayContainer(r);if(a){li(a.html);var s=t._overlayContainers.indexOf(a);s!==-1&&t._overlayContainers.splice(s,1)}}),e.on("element.changed",aM,function(i){var r=i.element,o=t._getOverlayContainer(r,!0);o&&(D(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 sM(e){var t=ft('<div class="djs-overlay-container" />');return dn(t,{position:"absolute",width:0,height:0}),e.insertBefore(t,e.firstChild),t}function Pv(e,t,n){dn(e,{left:t+"px",top:n+"px"})}function Lc(e,t){e.style.display=t===!1?"none":""}function Av(e,t){e.style["transform-origin"]="top left",["","-ms-","-webkit-"].forEach(function(n){e.style[n+"transform"]=t})}const Ic={__init__:["overlays"],overlays:["type",Yt]};function tf(e,t){t.invoke(Q,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)})}pe(tf,Q),tf.$inject=["canvas","injector"];const cM={__init__:["rootElementsBehavior"],rootElementsBehavior:["type",tf]};function Oa(e){return CSS.escape(e)}var uM={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"};function Tv(e){return e=""+e,e&&e.replace(/[&<>"']/g,function(t){return uM[t]})}var lM="bjs-breadcrumbs-shown";function Mv(e,t,n){var i=ft('<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=ee(u),f=ut(a,function(p){return p===l});f&&s()});function s(c){c&&(a=pM(c));var u=a.flatMap(function(f){var p=n.findRoot(mi(f))||n.findRoot(f.id);if(!p&&v(f,"bpmn:Process")){var d=t.find(function(g){var S=ee(g);return S&&S.get("processRef")===f});p=d&&n.findRoot(d.id)}if(!p)return[];var h=Tv(f.name||f.id),m=ft('<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(lM,l),u.forEach(function(f){i.appendChild(f)})}e.on("root.set",function(c){s(c.element)})}Mv.$inject=["eventBus","elementRegistry","canvas"];function pM(e){for(var t=ee(e),n=[],i=t;i;i=i.$parent)(v(i,"bpmn:SubProcess")||v(i,"bpmn:Process"))&&n.push(i);return n.reverse()}function kv(e,t){var n=null,i=new fM;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})}kv.$inject=["eventBus","canvas"];function fM(){this._entries=[],this.set=function(e,t){var n=!1;for(var i in this._entries)if(this._entries[i][0]===e){this._entries[i][1]=t,n=!0;break}n||this._entries.push([e,t])},this.get=function(e){for(var t in this._entries)if(this._entries[t][0]===e)return this._entries[t][1];return null},this.clear=function(){this._entries.length=0},this.remove=function(e){var t=-1;for(var n in this._entries)if(this._entries[n][0]===e){t=n;break}t!==-1&&this._entries.splice(t,1)}}var Ov={x:180,y:160};function 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),hM(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=dM(e),i={x:n.x-Ov.x,y:n.y-Ov.y};t.forEach(function(r){r.waypoint?r.waypoint.forEach(function(o){o.x=o.x-i.x,o.y=o.y-i.y}):r.bounds&&(r.bounds.x=r.bounds.x-i.x,r.bounds.y=r.bounds.y-i.y)})},Vr.prototype._moveToDiPlane=function(e,t){var n=Dv(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 Dv(e){return v(e,"bpmndi:BPMNDiagram")?e:Dv(e.$parent)}function dM(e){var t={top:1/0,right:-1/0,bottom:-1/0,left:1/0};return e.planeElement.forEach(function(n){if(n.bounds){var i=xe(n.bounds);t.top=Math.min(i.top,t.top),t.left=Math.min(i.left,t.left)}}),Cs(t)}function hM(e,t){var n=e.$parent;return!(!v(n,"bpmn:SubProcess")||n===t.bpmnElement||Fe(e,["bpmn:DataInputAssociation","bpmn:DataOutputAssociation"]))}var Nc=250,mM='<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 16 16"><path fill-rule="evenodd" d="M4.81801948,3.50735931 L10.4996894,9.1896894 L10.5,4 L12,4 L12,12 L4,12 L4,10.5 L9.6896894,10.4996894 L3.75735931,4.56801948 C3.46446609,4.27512627 3.46446609,3.80025253 3.75735931,3.50735931 C4.05025253,3.21446609 4.52512627,3.21446609 4.81801948,3.50735931 Z"/></svg>',gM="bjs-drilldown-empty";function mr(e,t,n,i,r){Q.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",Nc,function(a){var s=a.shape;o._canDrillDown(s)?o._addOverlay(s):o._removeOverlay(s)},!0),this.reverted("shape.toggleCollapse",Nc,function(a){var s=a.shape;o._canDrillDown(s)?o._addOverlay(s):o._removeOverlay(s)},!0),this.executed(["shape.create","shape.move","shape.delete"],Nc,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"],Nc,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)})})}pe(mr,Q),mr.prototype._updateDrilldownOverlay=function(e){var t=this._canvas;if(e){var n=t.findRoot(e);n&&this._updateOverlayVisibility(n)}},mr.prototype._canDrillDown=function(e){var t=this._canvas;return v(e,"bpmn:SubProcess")&&t.findRoot(mi(e))},mr.prototype._updateOverlayVisibility=function(e){var t=this._overlays,n=ee(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(gM,!r)}},mr.prototype._addOverlay=function(e){var t=this._canvas,n=this._overlays,i=ee(e),r=n.get({element:e,type:"drilldown"});r.length&&this._removeOverlay(e);var o=ft('<button type="button" class="bjs-drilldown">'+mM+"</button>"),a=i.get("name")||i.get("id"),s=this._translate("Open {element}",{element:a});o.setAttribute("title",s),o.addEventListener("click",function(){t.setRootElement(t.findRoot(mi(e)))}),n.add(e,"drilldown",{position:{bottom:-7,right:-8},html:o}),this._updateOverlayVisibility(e)},mr.prototype._removeOverlay=function(e){var t=this._overlays;t.remove({element:e,type:"drilldown"})},mr.$inject=["canvas","eventBus","elementRegistry","overlays","translate"];const yM={__depends__:[Ic,Lp,cM],__init__:["drilldownBreadcrumbs","drilldownOverlayBehavior","drilldownCentering","subprocessCompatibility"],drilldownBreadcrumbs:["type",Mv],drilldownCentering:["type",kv],drilldownOverlayBehavior:["type",mr],subprocessCompatibility:["type",Vr]};function gr(e){yt.call(this,e)}pe(gr,yt),gr.prototype._modules=[Sm,yM,Ic,Wn,aa],gr.prototype._moddleExtensions={};var Bc="keyboard.keydown",vM="keyboard.keyup",_M=1e3,Lv="Keyboard binding is now implicit; explicit binding to an element got removed. For more information, see https://github.com/bpmn-io/diagram-js/issues/661";function hn(e,t){var n=this;this._config=e=e||{},this._eventBus=t,this._keydownHandler=this._keydownHandler.bind(this),this._keyupHandler=this._keyupHandler.bind(this),t.on("diagram.destroy",function(){n._fire("destroy"),n.unbind()}),e.bindTo&&console.error("unsupported configuration <keyboard.bindTo>",new Error(Lv));var i=e&&e.bind!==!1;t.on("canvas.init",function(r){n._target=r.svg,i&&n.bind(),n._fire("init")})}hn.$inject=["config.keyboard","eventBus"],hn.prototype._keydownHandler=function(e){this._keyHandler(e,Bc)},hn.prototype._keyupHandler=function(e){this._keyHandler(e,vM)},hn.prototype._keyHandler=function(e,t){var n;if(!this._isEventIgnored(e)){var i={keyEvent:e};n=this._eventBus.fire(t||Bc,i),n&&e.preventDefault()}},hn.prototype._isEventIgnored=function(e){return!1},hn.prototype.bind=function(e){e&&console.error("unsupported argument <node>",new Error(Lv)),this.unbind(),e=this._node=this._target,Me.bind(e,"keydown",this._keydownHandler),Me.bind(e,"keyup",this._keyupHandler),this._fire("bind")},hn.prototype.getBinding=function(){return this._node},hn.prototype.unbind=function(){var e=this._node;e&&(this._fire("unbind"),Me.unbind(e,"keydown",this._keydownHandler),Me.unbind(e,"keyup",this._keyupHandler)),this._node=null},hn.prototype._fire=function(e){this._eventBus.fire("keyboard."+e,{node:this._node})},hn.prototype.addListener=function(e,t,n){Wt(e)&&(n=t,t=e,e=_M),this._eventBus.on(n||Bc,e,t)},hn.prototype.removeListener=function(e,t){this._eventBus.off(t||Bc,e)},hn.prototype.hasModifier=FP,hn.prototype.isCmd=Tn,hn.prototype.isShift=Ep,hn.prototype.isKey=Ft;var bM=500;function ko(e,t){var n=this;e.on("editorActions.init",bM,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(WP(r))return t.trigger("undo"),!0}),n("redo",function(i){var r=i.keyEvent;if(UP(r))return t.trigger("redo"),!0}),n("copy",function(i){var r=i.keyEvent;if(HP(r))return t.trigger("copy"),!0}),n("paste",function(i){var r=i.keyEvent;if(zP(r))return t.trigger("paste"),!0}),n("duplicate",function(i){var r=i.keyEvent;if(GP(r))return t.trigger("duplicate"),!0}),n("cut",function(i){var r=i.keyEvent;if(VP(r))return t.trigger("cut"),!0}),n("stepZoom",function(i){var r=i.keyEvent;if(Ft(["+","Add","="],r)&&Tn(r))return t.trigger("stepZoom",{value:1}),!0}),n("stepZoom",function(i){var r=i.keyEvent;if(Ft(["-","Subtract"],r)&&Tn(r))return t.trigger("stepZoom",{value:-1}),!0}),n("zoom",function(i){var r=i.keyEvent;if(Ft("0",r)&&Tn(r))return t.trigger("zoom",{value:1}),!0}),n("removeSelection",function(i){var r=i.keyEvent;if(Ft(["Backspace","Delete","Del"],r))return t.trigger("removeSelection"),!0})};const nf={__init__:["keyboard","keyboardBindings"],keyboard:["type",hn],keyboardBindings:["type",ko]};var xM={moveSpeed:50,moveSpeedAccelerated:200};function Iv(e,t,n){var i=this;this._config=j({},xM,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})}}Iv.$inject=["config.keyboardMove","keyboard","canvas"];const Nv={__depends__:[nf],__init__:["keyboardMove"],keyboardMove:["type",Iv]};var wM=15;function Bv(e,t){var n;function i(s){return a(s.originalEvent)}e.on("canvas.focus.changed",function(s){s.focused?e.on("element.mousedown",500,i):e.off("element.mousedown",i)});function r(s){var c=n.start,u=n.button,l=$r(s),f=ti(l,c);if(!n.dragging&&EM(f)>wM&&(n.dragging=!0,u===0&&ly(e),lc("grab")),n.dragging){var p=n.last||n.start;f=ti(l,p),t.scroll({dx:f.x,dy:f.y}),n.last=l}s.preventDefault()}function o(s){Me.unbind(document,"mousemove",r),Me.unbind(document,"mouseup",o),n=null,uy()}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)},Me.bind(document,"mousemove",r),Me.bind(document,"mouseup",o),!0}}this.isActive=function(){return!!n}}Bv.$inject=["eventBus","canvas"];function EM(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}const $v={__init__:["moveCanvas"],moveCanvas:["type",Bv]};function jv(e,t){var n=bl(e.min),i=bl(e.max),r=Math.abs(n)+Math.abs(i);return r/t}function SM(e,t){return Math.max(e.min,Math.min(e.max,t))}var RM=Math.sign||function(e){return e>=0?1:-1},rf={min:.2,max:4},Fv=10,CM=.1,PM=.75;function vi(e,t,n){e=e||{},this._enabled=!1,this._canvas=n,this._container=n._container,this._handleWheel=vn(this._handleWheel,this),this._totalDelta=0,this._scale=e.scale||PM;var i=this;t.on("canvas.mouseover",function(){i._init(e.enabled!==!1)}),t.on("canvas.mouseout",function(){i._init(!1)})}vi.$inject=["config.zoomScroll","eventBus","canvas"],vi.prototype.scroll=function(t){this._canvas.scroll(t)},vi.prototype.reset=function(){this._canvas.zoom("fit-viewport")},vi.prototype.zoom=function(t,n){var i=jv(rf,Fv*2);this._totalDelta+=t,Math.abs(this._totalDelta)>CM&&(this._zoom(t,n,i),this._totalDelta=0)},vi.prototype._handleWheel=function(t){if(this._enabled){var n=this._container;t.preventDefault();var i=t.ctrlKey||yg()&&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))*RM(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)}},vi.prototype.stepZoom=function(t,n){var i=jv(rf,Fv);this._zoom(t,n,i)},vi.prototype._zoom=function(e,t,n){var i=this._canvas,r=e>0?1:-1,o=bl(i.zoom()),a=Math.round(o/n)*n;a+=n*r;var s=Math.pow(10,a);i.zoom(SM(rf,s),t)},vi.prototype.toggle=function(t){var n=this._container,i=this._handleWheel,r=this._enabled;return typeof t>"u"&&(t=!r),r!==t&&Me[t?"bind":"unbind"](n,"wheel",i,!1),this._enabled=t,t},vi.prototype._init=function(e){this.toggle(e)};const Hv={__init__:["zoomScroll"],zoomScroll:["type",vi]};function Da(e){gr.call(this,e)}pe(Da,gr),Da.prototype._navigationModules=[Nv,$v,Hv],Da.prototype._modules=[].concat(gr.prototype._modules,Da.prototype._navigationModules);function of(e){return e&&e[e.length-1]}function zv(e){return e.y}function Gv(e){return e.x}var AM={left:Gv,center:Gv,right:function(e){return e.x+e.width},top:zv,middle:zv,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=of(t),o[e]=l[i]+l[r];else if(this._isType(e,["center","middle"])){if(D(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=ri(a,function(p){return p.elements.length>1&&(s=!0),p.elements.length}),s)return o[e]=of(c).center,o;u=t[0],t=ri(t,function(p){return p[i]+p[r]}),l=of(t),o[e]=f(u,l)}return o},Oo.prototype.trigger=function(e,t){var n=this._modeling,i,r=He(e,function(c){return!(c.waypoints||c.host||c.labelTarget)});if(i=this._rules.allowed("elements.align",{elements:r}),Ee(i)&&(r=i),!(r.length<2||!i)){var o=AM[t],a=ri(r,o),s=this._alignmentPosition(t,a);n.alignElements(a,s)}};const TM={__init__:["alignElements"],alignElements:["type",Oo]},MM=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=MM.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=kM();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 kM(){const e={};return e.promise=new Promise((t,n)=>{e.resolve=t,e.reject=n}),e}const OM={scheduler:["type",Do]};var DM="djs-element-hidden",$c=".entry",LM=1e3,Vv=8,IM=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=Ee(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=Ee(i.target)?i.target:[i.target];r.includes(n)&&e._updateVisibility()}}),this._container=this._createContainer()},Ot.prototype._createContainer=function(){var e=ft('<div class="djs-context-pad-parent"></div>');return this._canvas.getContainer().appendChild(e),e},Ot.prototype.registerProvider=function(e,t){t||(t=e,e=LM),this._eventBus.on("contextPad.getProviders",e,function(n){n.providers.push(t)})},Ot.prototype.getEntries=function(e){var t=this._getProviders(),n=Ee(e)?"getMultiElementContextPadEntries":"getContextPadEntries",i={};return D(t,function(r){if(Wt(r[n])){var o=r[n](e);Wt(o)?i=o(i):D(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=sn(a,"data-action"),o=t.originalEvent||t,e==="mouseover"){this._timeout=setTimeout(function(){i._mouseout=i.triggerEntry(r,"hover",o,n)},IM);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(Wt(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;D(t,function(r,o){var a=r.group||"default",s=ft(r.html||'<div class="entry" draggable="true"></div>'),c;sn(s,"data-action",o),c=ot("[data-group="+Oa(a)+"]",n),c||(c=ft('<div class="group"></div>'),sn(c,"data-group",a),n.appendChild(c)),c.appendChild(s),r.className&&NM(s,r.className),r.title&&sn(s,"title",r.title),r.imageUrl&&(i=ft("<img>"),sn(i,"src",r.imageUrl),i.style.width="100%",i.style.height="100%",s.appendChild(i))}),mt(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=ft('<div class="djs-context-pad"></div>');return Cn.bind(n,$c,"click",function(i){t.trigger("click",i)}),Cn.bind(n,$c,"dragstart",function(i){t.trigger("dragstart",i)}),Cn.bind(n,$c,"mouseover",function(i){t.trigger("mouseover",i)}),Cn.bind(n,$c,"mouseout",function(i){t.trigger("mouseout",i)}),Me.bind(n,"mousedown",function(i){i.stopPropagation()}),this._container.appendChild(n),this._eventBus.fire("contextPad.create",{target:e,pad:n}),n},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()&&$M(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 Ee(e)!==Ee(n)?!1:Ee(e)?e.length===n.length&&Pr(e,function(i){return n.includes(i)}):n===e},Ot.prototype.isShown=function(){return this.isOpen()&&mt(this._current.html).has("open")},Ot.prototype.show=function(){this.isOpen()&&(mt(this._current.html).add("open"),this._updatePosition(),this._eventBus.fire("contextPad.show",{current:this._current}))},Ot.prototype.hide=function(){this.isOpen()&&(mt(this._current.html).remove("open"),this._eventBus.fire("contextPad.hide",{current:this._current}))},Ot.prototype._getPosition=function(e){if(!Ee(e)&&at(e)){var t=this._canvas.viewbox(),n=BM(e),i=n.x*t.scale-t.x*t.scale,r=n.y*t.scale-t.y*t.scale;return{left:i+Vv*this._canvas.zoom(),top:r}}var o=this._canvas.getContainer(),a=o.getBoundingClientRect(),s=this._getTargetBounds(e);return{left:s.right-a.left+Vv*this._canvas.zoom(),top:s.top-a.top}},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=Ee(n)?n:[n],r=i.some(function(o){return t._canvas.hasMarker(o,DM)});r?t.hide():t.show()}};this._scheduler.schedule(e,"ContextPad#_updateVisibility")},Ot.prototype._getTargetBounds=function(e){var t=this,n=Ee(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 NM(e,t){var n=mt(e);t=Ee(t)?t:t.split(/\s+/g),t.forEach(function(i){n.add(i)})}function BM(e){return e.waypoints[e.waypoints.length-1]}function $M(e,t){return e=Ee(e)?e:[e],t=Ee(t)?t:[t],e.length===t.length&&Pr(e,function(n){return t.includes(n)})}const Wv={__depends__:[uc,OM,Ic],contextPad:["type",Ot]};var jc,_t,Uv,yr,qv,Yv,Kv,af,Fc,La,Xv,sf,cf,uf,Hc={},zc=[],jM=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,Gc=Array.isArray;function Fi(e,t){for(var n in t)e[n]=t[n];return e}function lf(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function Zv(e,t,n){var i,r,o,a={};for(o in t)o=="key"?i=t[o]:o=="ref"?r=t[o]:a[o]=t[o];if(arguments.length>2&&(a.children=arguments.length>3?jc.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 Vc(e,a,i,r,null)}function Vc(e,t,n,i,r){var o={type:e,props:t,key:n,ref:i,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:r??++Uv,__i:-1,__u:0};return r==null&&_t.vnode!=null&&_t.vnode(o),o}function Wc(e){return e.children}function Uc(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 FM(e){if(e.__P&&e.__d){var t=e.__v,n=t.__e,i=[],r=[],o=Fi({},t);o.__v=t.__v+1,_t.vnode&&_t.vnode(o),pf(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,o_(i,o,r),t.__e=t.__=null,o.__e!=n&&Qv(o)}}function Qv(e){if((e=e.__)!=null&&e.__c!=null)return e.__e=e.__c.base=null,e.__k.some(function(t){if(t!=null&&t.__e!=null)return e.__e=e.__c.base=t.__e}),Qv(e)}function Jv(e){(!e.__d&&(e.__d=!0)&&yr.push(e)&&!qc.__r++||qv!=_t.debounceRendering)&&((qv=_t.debounceRendering)||Yv)(qc)}function qc(){try{for(var e,t=1;yr.length;)yr.length>t&&yr.sort(Kv),e=yr.shift(),t=yr.length,FM(e)}finally{yr.length=qc.__r=0}}function e_(e,t,n,i,r,o,a,s,c,u,l){var f,p,d,h,m,g,S=i&&i.__k||zc,E=t.length;for(c=HM(n,t,S,c,E),f=0;f<E;f++)(d=n.__k[f])!=null&&(p=d.__i!=-1&&S[d.__i]||Hc,d.__i=f,g=pf(e,d,p,r,o,a,s,c,u,l),h=d.__e,d.ref&&p.ref!=d.ref&&(p.ref&&ff(p.ref,null,d),l.push(d.ref,d.__c||h,d)),m==null&&h!=null&&(m=h),4&d.__u?(c=t_(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 HM(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]=Vc(null,a,null,null,null):Gc(a)?a=e.__k[o]=Vc(Wc,{children:a},null,null,null):a.constructor===void 0&&a.__b>0?a=e.__k[o]=Vc(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=zM(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)),s_(s,s));return i}function t_(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=t_(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 zM(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 n_(e,t,n){t[0]=="-"?e.setProperty(t,n??""):e[t]=n==null?"":typeof n!="number"||jM.test(t)?n:n+"px"}function Yc(e,t,n,i,r){var o,a;e:if(t=="style")if(typeof n=="string")e.style.cssText=n;else{if(typeof i=="string"&&(e.style.cssText=i=""),i)for(t in i)n&&t in n||n_(e.style,t,"");if(n)for(t in n)i&&n[t]==i[t]||n_(e.style,t,n[t])}else if(t[0]=="o"&&t[1]=="n")o=t!=(t=t.replace(Xv,"$1")),a=t.toLowerCase(),t=a in e||t=="onFocusOut"||t=="onFocusIn"?a.slice(2):t.slice(2),e.l||(e.l={}),e.l[t+o]=n,n?i?n[La]=i[La]:(n[La]=sf,e.addEventListener(t,o?uf:cf,o)):e.removeEventListener(t,o?uf:cf,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 i_(e){return function(t){if(this.l){var n=this.l[t.type+e];if(t[Fc]==null)t[Fc]=sf++;else if(t[Fc]<n[La])return;return n(_t.event?_t.event(t):t)}}}function pf(e,t,n,i,r,o,a,s,c,u){var l,f,p,d,h,m,g,S,E,x,w,C,P,L,T,B,k=t.type;if(t.constructor!==void 0)return null;128&n.__u&&(c=!!(32&n.__u),o=[s=t.__e=n.__e]),(l=_t.__b)&&l(t);e:if(typeof k=="function"){f=a.length;try{if(E=t.props,x=k.prototype&&k.prototype.render,w=(l=k.contextType)&&i[l.__c],C=l?w?w.props.value:l.__:i,n.__c?S=(p=t.__c=n.__c).__=p.__E:(x?t.__c=p=new k(E,C):(t.__c=p=new Uc(E,C),p.constructor=k,p.render=VM),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&&k.getDerivedStateFromProps!=null&&(p.__s==p.state&&(p.__s=Fi({},p.__s)),Fi(p.__s,k.getDerivedStateFromProps(E,p.__s))),h=p.props,m=p.state,p.__v=t,d)x&&k.getDerivedStateFromProps==null&&p.componentWillMount!=null&&p.componentWillMount(),x&&p.componentDidMount!=null&&p.__h.push(p.componentDidMount);else{if(x&&k.getDerivedStateFromProps==null&&E!==h&&p.componentWillReceiveProps!=null&&p.componentWillReceiveProps(E,C),t.__v==n.__v||!p.__e&&p.shouldComponentUpdate!=null&&p.shouldComponentUpdate(E,p.__s,C)===!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(O){O&&(O.__=t)}),zc.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,C),x&&p.componentDidUpdate!=null&&p.__h.push(function(){p.componentDidUpdate(h,m,g)})}if(p.context=C,p.props=E,p.__P=e,p.__e=!1,P=_t.__r,L=0,x)p.state=p.__s,p.__d=!1,P&&P(t),l=p.render(p.props,p.state,p.context),zc.push.apply(p.__h,p._sb),p._sb=[];else do p.__d=!1,P&&P(t),l=p.render(p.props,p.state,p.context),p.state=p.__s;while(p.__d&&++L<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===Wc&&l.key==null?a_(l.props.children):l,s=e_(e,Gc(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),S&&(p.__E=p.__=null)}catch(O){if(a.length=f,t.__v=null,c||o!=null){if(O.then){for(t.__u|=c?160:128;s&&s.nodeType==8&&s.nextSibling;)s=s.nextSibling;o!=null&&(o[o.indexOf(s)]=null),t.__e=s}else if(o!=null)for(B=o.length;B--;)lf(o[B])}else t.__e=n.__e;t.__k==null&&(t.__k=n.__k||[]),O.then||r_(t),_t.__e(O,t,n)}}else o==null&&t.__v==n.__v?(t.__k=n.__k,t.__e=n.__e):s=t.__e=GM(n.__e,t,n,i,r,o,a,c,u);return(l=_t.diffed)&&l(t),128&t.__u?void 0:s}function r_(e){e&&(e.__c&&(e.__c.__e=!0),e.__k&&e.__k.some(r_))}function o_(e,t,n){for(var i=0;i<n.length;i++)ff(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 a_(e){return typeof e!="object"||e==null||e.__b>0?e:Gc(e)?e.map(a_):e.constructor!==void 0?null:Fi({},e)}function GM(e,t,n,i,r,o,a,s,c){var u,l,f,p,d,h,m,g=n.props||Hc,S=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(S);e=document.createElementNS(r,E,S.is&&S),s&&(_t.__m&&_t.__m(t,o),s=!1),o=null}if(E==null)g===S||s&&e.data==S||(e.data=S);else{if(o=E=="textarea"&&S.defaultValue!=null?null:o&&jc.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 S||u=="value"&&"defaultValue"in S||u=="checked"&&"defaultChecked"in S||Yc(e,u,null,d,r);for(u in S)d=S[u],u=="children"?p=d:u=="dangerouslySetInnerHTML"?l=d:u=="value"?h=d:u=="checked"?m=d:s&&typeof d!="function"||g[u]===d||Yc(e,u,d,g[u],r);if(l)s||f&&(l.__html==f.__html||l.__html==e.innerHTML)||(e.innerHTML=l.__html),t.__k=[];else if(f&&(e.innerHTML=""),e_(t.type=="template"?e.content:e,Gc(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--;)lf(o[u]);s&&E!="textarea"||(u="value",E=="progress"&&h==null?e.removeAttribute("value"):h!=null&&(h!==e[u]||E=="progress"&&!h||E=="option"&&h!=g[u])&&Yc(e,u,h,g[u],r),u="checked",m!=null&&m!=e[u]&&Yc(e,u,m,g[u],r))}return e}function ff(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 s_(e,t,n){var i,r;if(_t.unmount&&_t.unmount(e),(i=e.ref)&&(i.current&&i.current!=e.__e||ff(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]&&s_(i[r],t,n||typeof e.type!="function");n||lf(e.__e),e.__c=e.__=e.__e=void 0}function VM(e,t,n){return this.constructor(e,n)}function c_(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=[],pf(t,e=t.__k=Zv(Wc,null,[e]),r||Hc,Hc,t.namespaceURI,r?null:t.firstChild?jc.call(t.childNodes):null,o,r?r.__e:t.firstChild,i,a),o_(o,e,a),e.props.children=null}jc=zc.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}},Uv=0,Uc.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),Jv(this))},Uc.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),Jv(this))},Uc.prototype.render=Wc,yr=[],Yv=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,Kv=function(e,t){return e.__v.__b-t.__v.__b},qc.__r=0,af=Math.random().toString(8),Fc="__d"+af,La="__a"+af,Xv=/(PointerCapture)$|Capture$/i,sf=0,cf=i_(!1),uf=i_(!0);var u_=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,u_(e,s,n,["",null])),i.push(r),s[0]?t[0]|=2:(t[o-2]=0,t[o]=r)):i.push(s)}return i},l_=new Map;function WM(e){var t=l_.get(this);return t||(t=new Map,l_.set(this,t)),(t=u_(this,t.get(e)||(t.set(e,t=(function(n){for(var i,r,o=1,a="",s="",c=[0],u=function(p){o===1&&(p||(a=a.replace(/^\s*\n\s*|\s*\n\s*$/g,"")))?c.push(0,p,a):o===3&&(p||a)?(c.push(3,p,a),o=2):o===2&&a==="..."&&p?c.push(4,p,0):o===2&&a&&!p?c.push(5,0,!0,a):o>=5&&((a||!p&&o===5)&&(c.push(o,0,a,r),o=6),p&&(c.push(o,p,0,r),o=6)),a=""},l=0;l<n.length;l++){l&&(o===1&&u(),u(l));for(var f=0;f<n[l].length;f++)i=n[l][f],o===1?i==="<"?(u(),c=[c],o=3):a+=i:o===4?a==="--"&&i===">"?(o=1,a=""):a=i+a[0]:s?i===s?s="":a+=i:i==='"'||i==="'"?s=i:i===">"?(u(),o=1):o&&(i==="="?(o=5,r=a,a=""):i==="/"&&(o<5||n[l][f+1]===">")?(u(),o===3&&(c=c[0]),o=c,(c=c[0]).push(2,0,o),o=0):i===" "||i===" "||i===`
11
- `||i==="\r"?(u(),o=2):a+=i),o===3&&a==="!--"&&(o=4,c=c[0])}return u(),c})(e)),t),arguments,[])).length>1?t:t[0]}var ct=WM.bind(Zv),Lo,Dt,df,p_,Ia=0,f_=[],Ht=_t,d_=Ht.__b,h_=Ht.__r,m_=Ht.diffed,g_=Ht.__c,y_=Ht.unmount,v_=Ht.__;function Kc(e,t){Ht.__h&&Ht.__h(Dt,e,Ia||t),Ia=0;var n=Dt.__H||(Dt.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({}),n.__[e]}function hf(e){return Ia=1,UM(b_,e)}function UM(e,t,n){var i=Kc(Lo++,2);if(i.t=e,!i.__c&&(i.__=[b_(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 Xc(e,t){var n=Kc(Lo++,3);!Ht.__s&&yf(n.__H,t)&&(n.__=e,n.u=t,Dt.__H.__h.push(n))}function mf(e,t){var n=Kc(Lo++,4);!Ht.__s&&yf(n.__H,t)&&(n.__=e,n.u=t,Dt.__h.push(n))}function Zc(e){return Ia=5,Hi(function(){return{current:e}},[])}function Hi(e,t){var n=Kc(Lo++,7);return yf(n.__H,t)&&(n.__=e(),n.__H=t,n.__h=e),n.__}function Na(e,t){return Ia=8,Hi(function(){return e},t)}function qM(){for(var e;e=f_.shift();){var t=e.__H;if(e.__P&&t)try{t.__h.some(Qc),t.__h.some(gf),t.__h=[]}catch(n){t.__h=[],Ht.__e(n,e.__v)}}}Ht.__b=function(e){Dt=null,d_&&d_(e)},Ht.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),v_&&v_(e,t)},Ht.__r=function(e){h_&&h_(e),Lo=0;var t=(Dt=e.__c).__H;t&&(df===Dt?(t.__h=[],Dt.__h=[],t.__.some(function(n){n.__N&&(n.__=n.__N),n.u=n.__N=void 0})):(t.__h.some(Qc),t.__h.some(gf),t.__h=[],Lo=0)),df=Dt},Ht.diffed=function(e){m_&&m_(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(f_.push(t)!==1&&p_===Ht.requestAnimationFrame||((p_=Ht.requestAnimationFrame)||YM)(qM)),t.__H.__.some(function(n){n.u&&(n.__H=n.u,n.u=void 0)})),df=Dt=null},Ht.__c=function(e,t){t.some(function(n){try{n.__h.some(Qc),n.__h=n.__h.filter(function(i){return!i.__||gf(i)})}catch(i){t.some(function(r){r.__h&&(r.__h=[])}),t=[],Ht.__e(i,n.__v)}}),g_&&g_(e,t)},Ht.unmount=function(e){y_&&y_(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.some(function(i){try{Qc(i)}catch(r){t=r}}),n.__H=void 0,t&&Ht.__e(t,n.__v))};var __=typeof requestAnimationFrame=="function";function YM(e){var t,n=function(){clearTimeout(i),__&&cancelAnimationFrame(t),setTimeout(e)},i=setTimeout(n,35);__&&(t=requestAnimationFrame(n))}function Qc(e){var t=Dt,n=e.__c;typeof n=="function"&&(e.__c=void 0,n()),Dt=t}function gf(e){var t=Dt;e.__c=e.__(),Dt=t}function yf(e,t){return!e||e.length!==t.length||t.some(function(n,i){return n!==e[i]})}function b_(e,t){return typeof t=="function"?t(e):t}function KM(e){const{navigationStack:t,setNavigationStack:n}=e,i=Hi(()=>t.length<=1?[]:t.slice(0,-1).map((a,s)=>({label:a.label,onClick:()=>n(c=>c.slice(0,s+1))})),[t,n]),r=t.length>0?()=>n([]):null,o=t.length>0?t[t.length-1].label:null;return ct`
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()&&nr.prototype.clear.call(this)},yt.prototype.destroy=function(){nr.prototype.destroy.call(this),li(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=ot(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=j(oi(n,["additionalModules"]),{canvas:j({},n.canvas,{container:e}),modules:a});nr.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=ft('<div class="bjs-container"></div>');return dn(t,{width:gm(e.width),height:gm(e.height),position:e.position}),t},yt.prototype._createModdle=function(e){const t=j({},this._moddleExtensions,e.moddleExtensions);return new bd(t)},yt.prototype._modules=[];function ks(e,t){return e.warnings=t,e}function TS(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 MS={width:"100%",height:"100%",position:"relative"};function gm(e){return e+(Pe(e)?"px":"")}function kS(e,t){return t&&ut(e.diagrams,function(n){return n.id===t})||null}function OS(e){const n='<a href="http://bpmn.io" target="_blank" class="bjs-powered-by" title="Powered by bpmn.io" >'+fm+"</a>",i=ft(n);dn(ot("svg",i),dm),dn(i,hm,{position:"absolute",bottom:"15px",right:"15px",zIndex:"100"}),e.appendChild(i),Me.bind(i,"click",function(r){AS(),r.preventDefault()})}function fo(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)}pe(fo,yt),fo.prototype._createModdle=function(e){var t=yt.prototype._createModdle.call(this,e);return t.ids=new ui([32,36,1]),t},fo.prototype._collectIds=function(e,t){var n=e.$model,i=n.ids,r;i.clear();for(r in t)i.claim(r,t[r])};function We(e,t){return v(e,"bpmn:CallActivity")?!1:v(e,"bpmn:SubProcess")?(t=t||Xe(e),t&&v(t,"bpmndi:BPMNPlane")?!0:t&&!!t.isExpanded):v(e,"bpmn:Participant")?!!ee(e).processRef:!0}function Ut(e){if(!(!v(e,"bpmn:Participant")&&!v(e,"bpmn:Lane"))){var t=Xe(e).isHorizontal;return t===void 0?!0:t}}function DS(e){return e&&ee(e).isInterrupting!==!1}function un(e){return e&&!!ee(e).triggeredByEvent}function ho(e,t){var n=ee(e).eventDefinitions;return Ui(n,function(i){return v(i,t)})}function LS(e){return ho(e,"bpmn:ErrorEventDefinition")}function IS(e){return ho(e,"bpmn:EscalationEventDefinition")}function NS(e){return ho(e,"bpmn:CompensateEventDefinition")}var Nr={width:90,height:20},ym=15;function ir(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 Os(e){return $e(e.label)}function BS(e){var t=e.length/2-1,n=e[Math.floor(t)],i=e[Math.ceil(t+.01)],r=$S(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-=ym:a+=ym,{x:a,y:s}}function $S(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 gl(e){return e.waypoints?BS(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 jS(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=gl(t),i=Nr),j({x:n.x-i.width/2,y:n.y-i.height/2},i)}function vm(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 FS(e){var t=e.categoryValueRef;return t&&t.value||""}function Bn(e){var t=e.businessObject,n=vm(t);if(n)return n==="categoryValueRef"?FS(t):t[n]||""}function HS(e,t){var n=e.businessObject,i=vm(n);if(i)if(i==="categoryValueRef"){if(!n[i])return e;n[i].value=t}else n[i]=t;return e}function zS(e){return $e(e)&&ir(e.labelTarget)}var mo=7;function bm(e){let t=[];return D(e.incoming,n=>{v(n,"bpmn:Association")&&v(n.source,"bpmn:TextAnnotation")&&t.push({annotation:n.source,association:n})}),D(e.outgoing,n=>{v(n,"bpmn:Association")&&v(n.target,"bpmn:TextAnnotation")&&t.push({annotation:n.target,association:n})}),t}function ia(e){const t=new Map;return D(ul(e),n=>{D(bm(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 yl="hsl(225, 10%, 15%)",GS="white";function hi(e,t){return Ui(e.eventDefinitions,function(n){return n.$type===t})}function VS(e){return e.$type==="bpmn:IntermediateThrowEvent"||e.$type==="bpmn:EndEvent"}function WS(e){var t=e.dataObjectRef;return e.isCollection||t&&t.isCollection}function Ge(e,t,n){var i=Xe(e);return n||i.get("color:background-color")||i.get("bioc:fill")||t||GS}function ce(e,t,n){var i=Xe(e);return n||i.get("color:border-color")||i.get("bioc:stroke")||t||yl}function ra(e,t,n,i){var r=Xe(e),o=r.get("label");return i||o&&o.get("color:color")||t||ce(e,n)}function _m(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 vl(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 US(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 qS(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 oa(e,t={}){return{width:Hn(e,t),height:An(e,t)}}function Hn(e,t={}){return En(t,"width")?t.width:e.width}function An(e,t={}){return En(t,"height")?t.height:e.height}var YS=new ui,KS=10,Ds=3,XS=1.5,Ls=10,ZS=4,go=.95,QS=1,JS=.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(A){return n.computeStyle(A,{strokeLinecap:"round",strokeLinejoin:"round",stroke:yl,strokeWidth:2,fill:"white"})}function f(A){return n.computeStyle(A,["no-fill"],{strokeLinecap:"round",strokeLinejoin:"round",stroke:yl,strokeWidth:2})}function p(A,b){var{ref:y={x:0,y:0},scale:N=1,element:z,parentGfx:K=r._svg}=b,he=_e("marker",{id:A,viewBox:"0 0 20 20",refX:y.x,refY:y.y,markerWidth:20*N,markerHeight:20*N,orient:"auto"});Oe(he,z);var Le=ot(":scope > defs",K);Le||(Le=_e("defs"),Oe(K,Le)),Oe(Le,he)}function d(A,b,y,N){var z=YS.nextPrefixed("marker-");return h(A,z,b,y,N),"url(#"+z+")"}function h(A,b,y,N,z){if(y==="sequenceflow-end"){var K=_e("path",{d:"M 1 5 L 11 10 L 1 15 Z",...l({fill:z,stroke:z,strokeWidth:1})});p(b,{element:K,ref:{x:11,y:10},scale:.5,parentGfx:A})}if(y==="messageflow-start"){var he=_e("circle",{cx:6,cy:6,r:3.5,...l({fill:N,stroke:z,strokeWidth:1,strokeDasharray:[1e4,1]})});p(b,{element:he,ref:{x:6,y:6},parentGfx:A})}if(y==="messageflow-end"){var Le=_e("path",{d:"m 1 5 l 0 -3 l 7 3 l -7 3 z",...l({fill:N,stroke:z,strokeWidth:1,strokeDasharray:[1e4,1]})});p(b,{element:Le,ref:{x:8.5,y:5},parentGfx:A})}if(y==="association-start"){var Qe=_e("path",{d:"M 11 5 L 1 10 L 11 15",...f({fill:"none",stroke:z,strokeWidth:1.5,strokeDasharray:[1e4,1]})});p(b,{element:Qe,ref:{x:1,y:10},scale:.5,parentGfx:A})}if(y==="association-end"){var Ct=_e("path",{d:"M 1 5 L 11 10 L 1 15",...f({fill:"none",stroke:z,strokeWidth:1.5,strokeDasharray:[1e4,1]})});p(b,{element:Ct,ref:{x:11,y:10},scale:.5,parentGfx:A})}if(y==="conditional-flow-marker"){var nt=_e("path",{d:"M 0 10 L 8 6 L 16 10 L 8 14 Z",...l({fill:N,stroke:z})});p(b,{element:nt,ref:{x:-1,y:10},scale:.5,parentGfx:A})}if(y==="conditional-default-flow-marker"){var Nt=_e("path",{d:"M 6 4 L 10 16",...l({stroke:z,fill:"none"})});p(b,{element:Nt,ref:{x:0,y:10},scale:.5,parentGfx:A})}}function m(A,b,y,N,z={}){Vt(N)&&(z=N,N=0),N=N||0,z=l(z);var K=b/2,he=y/2,Le=_e("circle",{cx:K,cy:he,r:Math.round((b+y)/4-N),...z});return Oe(A,Le),Le}function g(A,b,y,N,z,K){Vt(z)&&(K=z,z=0),z=z||0,K=l(K);var he=_e("rect",{x:z,y:z,width:b-z*2,height:y-z*2,rx:N,ry:N,...K});return Oe(A,he),he}function S(A,b,y,N){var z=b/2,K=y/2,he=[{x:z,y:0},{x:b,y:K},{x:z,y},{x:0,y:K}],Le=he.map(function(Ct){return Ct.x+","+Ct.y}).join(" ");N=l(N);var Qe=_e("polygon",{...N,points:Le});return Oe(A,Qe),Qe}function E(A,b,y,N){y=f(y);var z=Xo(b,y,N);return Oe(A,z),z}function x(A,b,y){return E(A,b,y,5)}function w(A,b,y){y=f(y);var N=_e("path",{...y,d:b});return Oe(A,N),N}function C(A,b,y,N){return w(b,y,j({"data-marker":A},N))}function P(A){return Rt[A]}function L(A){return function(b,y,N){return P(A)(b,y,N)}}var T={"bpmn:MessageEventDefinition":function(A,b,y={},N){var z=i.getScaledPath("EVENT_MESSAGE",{xScaleFactor:.9,yScaleFactor:.9,containerWidth:y.width||b.width,containerHeight:y.height||b.height,position:{mx:.235,my:.315}}),K=N?ce(b,c,y.stroke):Ge(b,s,y.fill),he=N?Ge(b,s,y.fill):ce(b,c,y.stroke),Le=w(A,z,{fill:K,stroke:he,strokeWidth:1});return Le},"bpmn:TimerEventDefinition":function(A,b,y={}){var N=y.width||b.width,z=y.height||b.height,K=y.width?1:2,he=m(A,N,z,.2*z,{fill:Ge(b,s,y.fill),stroke:ce(b,c,y.stroke),strokeWidth:K}),Le=i.getScaledPath("EVENT_TIMER_WH",{xScaleFactor:.75,yScaleFactor:.75,containerWidth:N,containerHeight:z,position:{mx:.5,my:.5}});w(A,Le,{stroke:ce(b,c,y.stroke),strokeWidth:K});for(var Qe=0;Qe<12;Qe++){var Ct=i.getScaledPath("EVENT_TIMER_LINE",{xScaleFactor:.75,yScaleFactor:.75,containerWidth:N,containerHeight:z,position:{mx:.5,my:.5}}),nt=N/2,Nt=z/2;w(A,Ct,{strokeWidth:1,stroke:ce(b,c,y.stroke),transform:"rotate("+Qe*30+","+Nt+","+nt+")"})}return he},"bpmn:EscalationEventDefinition":function(A,b,y={},N){var z=i.getScaledPath("EVENT_ESCALATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:y.width||b.width,containerHeight:y.height||b.height,position:{mx:.5,my:.2}}),K=N?ce(b,c,y.stroke):Ge(b,s,y.fill);return w(A,z,{fill:K,stroke:ce(b,c,y.stroke),strokeWidth:1})},"bpmn:ConditionalEventDefinition":function(A,b,y={}){var N=i.getScaledPath("EVENT_CONDITIONAL",{xScaleFactor:1,yScaleFactor:1,containerWidth:y.width||b.width,containerHeight:y.height||b.height,position:{mx:.5,my:.222}});return w(A,N,{fill:Ge(b,s,y.fill),stroke:ce(b,c,y.stroke),strokeWidth:1})},"bpmn:LinkEventDefinition":function(A,b,y={},N){var z=i.getScaledPath("EVENT_LINK",{xScaleFactor:1,yScaleFactor:1,containerWidth:b.width,containerHeight:b.height,position:{mx:.57,my:.263}}),K=N?ce(b,c,y.stroke):Ge(b,s,y.fill);return w(A,z,{fill:K,stroke:ce(b,c,y.stroke),strokeWidth:1})},"bpmn:ErrorEventDefinition":function(A,b,y={},N){var z=i.getScaledPath("EVENT_ERROR",{xScaleFactor:1.1,yScaleFactor:1.1,containerWidth:y.width||b.width,containerHeight:y.height||b.height,position:{mx:.2,my:.722}}),K=N?ce(b,c,y.stroke):Ge(b,s,y.fill);return w(A,z,{fill:K,stroke:ce(b,c,y.stroke),strokeWidth:1})},"bpmn:CancelEventDefinition":function(A,b,y={},N){var z=i.getScaledPath("EVENT_CANCEL_45",{xScaleFactor:1,yScaleFactor:1,containerWidth:b.width,containerHeight:b.height,position:{mx:.638,my:-.055}}),K=N?ce(b,c,y.stroke):"none",he=w(A,z,{fill:K,stroke:ce(b,c,y.stroke),strokeWidth:1});return lm(he,45),he},"bpmn:CompensateEventDefinition":function(A,b,y={},N){var z=i.getScaledPath("EVENT_COMPENSATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:y.width||b.width,containerHeight:y.height||b.height,position:{mx:.22,my:.5}}),K=N?ce(b,c,y.stroke):Ge(b,s,y.fill);return w(A,z,{fill:K,stroke:ce(b,c,y.stroke),strokeWidth:1})},"bpmn:SignalEventDefinition":function(A,b,y={},N){var z=i.getScaledPath("EVENT_SIGNAL",{xScaleFactor:.9,yScaleFactor:.9,containerWidth:y.width||b.width,containerHeight:y.height||b.height,position:{mx:.5,my:.2}}),K=N?ce(b,c,y.stroke):Ge(b,s,y.fill);return w(A,z,{strokeWidth:1,fill:K,stroke:ce(b,c,y.stroke)})},"bpmn:MultipleEventDefinition":function(A,b,y={},N){var z=i.getScaledPath("EVENT_MULTIPLE",{xScaleFactor:1.1,yScaleFactor:1.1,containerWidth:y.width||b.width,containerHeight:y.height||b.height,position:{mx:.211,my:.36}}),K=N?ce(b,c,y.stroke):Ge(b,s,y.fill);return w(A,z,{fill:K,stroke:ce(b,c,y.stroke),strokeWidth:1})},"bpmn:ParallelMultipleEventDefinition":function(A,b,y={}){var N=i.getScaledPath("EVENT_PARALLEL_MULTIPLE",{xScaleFactor:1.2,yScaleFactor:1.2,containerWidth:y.width||b.width,containerHeight:y.height||b.height,position:{mx:.458,my:.194}});return w(A,N,{fill:Ge(b,s,y.fill),stroke:ce(b,c,y.stroke),strokeWidth:1})},"bpmn:TerminateEventDefinition":function(A,b,y={}){var N=m(A,b.width,b.height,8,{fill:ce(b,c,y.stroke),stroke:ce(b,c,y.stroke),strokeWidth:4});return N}};function B(A,b,y={},N){var z=ee(A),K=VS(z),he=N||A;return z.get("eventDefinitions")&&z.get("eventDefinitions").length>1?z.get("parallelMultiple")?T["bpmn:ParallelMultipleEventDefinition"](b,he,y,K):T["bpmn:MultipleEventDefinition"](b,he,y,K):hi(z,"bpmn:MessageEventDefinition")?T["bpmn:MessageEventDefinition"](b,he,y,K):hi(z,"bpmn:TimerEventDefinition")?T["bpmn:TimerEventDefinition"](b,he,y,K):hi(z,"bpmn:ConditionalEventDefinition")?T["bpmn:ConditionalEventDefinition"](b,he,y,K):hi(z,"bpmn:SignalEventDefinition")?T["bpmn:SignalEventDefinition"](b,he,y,K):hi(z,"bpmn:EscalationEventDefinition")?T["bpmn:EscalationEventDefinition"](b,he,y,K):hi(z,"bpmn:LinkEventDefinition")?T["bpmn:LinkEventDefinition"](b,he,y,K):hi(z,"bpmn:ErrorEventDefinition")?T["bpmn:ErrorEventDefinition"](b,he,y,K):hi(z,"bpmn:CancelEventDefinition")?T["bpmn:CancelEventDefinition"](b,he,y,K):hi(z,"bpmn:CompensateEventDefinition")?T["bpmn:CompensateEventDefinition"](b,he,y,K):hi(z,"bpmn:TerminateEventDefinition")?T["bpmn:TerminateEventDefinition"](b,he,y,K):null}var k={ParticipantMultiplicityMarker:function(A,b,y={}){var N=Hn(b,y),z=An(b,y),K=i.getScaledPath("MARKER_PARALLEL",{xScaleFactor:1,yScaleFactor:1,containerWidth:N,containerHeight:z,position:{mx:(N/2-6)/N,my:(z-15)/z}});C("participant-multiplicity",A,K,{strokeWidth:2,fill:Ge(b,s,y.fill),stroke:ce(b,c,y.stroke)})},SubProcessMarker:function(A,b,y={}){var N=g(A,14,14,0,{strokeWidth:1,fill:Ge(b,s,y.fill),stroke:ce(b,c,y.stroke)});Qt(N,b.width/2-7.5,b.height-20);var z=i.getScaledPath("MARKER_SUB_PROCESS",{xScaleFactor:1.5,yScaleFactor:1.5,containerWidth:b.width,containerHeight:b.height,position:{mx:(b.width/2-7.5)/b.width,my:(b.height-20)/b.height}});C("sub-process",A,z,{fill:Ge(b,s,y.fill),stroke:ce(b,c,y.stroke)})},ParallelMarker:function(A,b,y){var N=Hn(b,y),z=An(b,y),K=i.getScaledPath("MARKER_PARALLEL",{xScaleFactor:1,yScaleFactor:1,containerWidth:N,containerHeight:z,position:{mx:(N/2+y.parallel)/N,my:(z-20)/z}});C("parallel",A,K,{fill:Ge(b,s,y.fill),stroke:ce(b,c,y.stroke)})},SequentialMarker:function(A,b,y){var N=i.getScaledPath("MARKER_SEQUENTIAL",{xScaleFactor:1,yScaleFactor:1,containerWidth:b.width,containerHeight:b.height,position:{mx:(b.width/2+y.seq)/b.width,my:(b.height-19)/b.height}});C("sequential",A,N,{fill:Ge(b,s,y.fill),stroke:ce(b,c,y.stroke)})},CompensationMarker:function(A,b,y){var N=i.getScaledPath("MARKER_COMPENSATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:b.width,containerHeight:b.height,position:{mx:(b.width/2+y.compensation)/b.width,my:(b.height-13)/b.height}});C("compensation",A,N,{strokeWidth:1,fill:Ge(b,s,y.fill),stroke:ce(b,c,y.stroke)})},LoopMarker:function(A,b,y){var N=Hn(b,y),z=An(b,y),K=i.getScaledPath("MARKER_LOOP",{xScaleFactor:1,yScaleFactor:1,containerWidth:N,containerHeight:z,position:{mx:(N/2+y.loop)/N,my:(z-7)/z}});C("loop",A,K,{strokeWidth:1.5,fill:"none",stroke:ce(b,c,y.stroke),strokeMiterlimit:.5})},AdhocMarker:function(A,b,y){var N=Hn(b,y),z=An(b,y),K=i.getScaledPath("MARKER_ADHOC",{xScaleFactor:1,yScaleFactor:1,containerWidth:N,containerHeight:z,position:{mx:(N/2+y.adhoc)/N,my:(z-15)/z}});C("adhoc",A,K,{strokeWidth:1,fill:ce(b,c,y.stroke),stroke:ce(b,c,y.stroke)})}};function O(A,b,y,N){k[A](b,y,N)}function $(A,b,y=[],N={}){N={fill:N.fill,stroke:N.stroke,width:Hn(b,N),height:An(b,N)};var z=ee(b),K=y.includes("SubProcessMarker");K?N={...N,seq:-21,parallel:-22,compensation:-25,loop:-18,adhoc:10}:N={...N,seq:-5,parallel:-6,compensation:-7,loop:0,adhoc:-8},z.get("isForCompensation")&&y.push("CompensationMarker"),v(z,"bpmn:AdHocSubProcess")&&(y.push("AdhocMarker"),K||j(N,{compensation:N.compensation-18}));var he=z.get("loopCharacteristics"),Le=he&&he.get("isSequential");he&&(j(N,{compensation:N.compensation-18}),y.includes("AdhocMarker")&&j(N,{seq:-23,loop:-18,parallel:-24}),Le===void 0&&y.push("LoopMarker"),Le===!1&&y.push("ParallelMarker"),Le===!0&&y.push("SequentialMarker")),y.includes("CompensationMarker")&&y.length===1&&j(N,{compensation:-8}),D(y,function(Qe){O(Qe,A,b,N)})}function ie(A,b,y={}){y=j({size:{width:100}},y);var N=o.createText(b||"",y);return qe(N).add("djs-label"),Oe(A,N),N}function ge(A,b,y,N={}){var z=ee(b),K=oa({x:b.x,y:b.y,width:b.width,height:b.height},N);return ie(A,z.name,{align:y,box:K,padding:7,style:{fill:ra(b,u,c,N.stroke)}})}function Ve(A,b,y={}){var N={width:b.width,height:b.height,x:b.width/2+b.x,y:b.height/2+b.y};return ie(A,Bn(b),{box:N,style:j({},o.getExternalStyle(),{fill:ra(b,u,c,y.stroke)})})}function q(A,b,y,N={}){var z=Ut(y),K=ie(A,b,{box:{height:30,width:z?An(y,N):Hn(y,N)},align:"center-middle",style:{fill:ra(y,u,c,N.stroke)}});if(z){var he=-1*An(y,N);Ts(K,0,-he,270)}}function ae(A,b,y={}){var{width:N,height:z}=oa(b,y);return g(A,N,z,Ls,{...y,fill:Ge(b,s,y.fill),fillOpacity:go,stroke:ce(b,c,y.stroke)})}function de(A,b,y={}){var N=ee(b),z=Ge(b,s,y.fill),K=ce(b,c,y.stroke);return(N.get("associationDirection")==="One"||N.get("associationDirection")==="Both")&&(y.markerEnd=d(A,"association-end",z,K)),N.get("associationDirection")==="Both"&&(y.markerStart=d(A,"association-start",z,K)),y=Ze(y,["markerStart","markerEnd"]),x(A,b.waypoints,{...y,stroke:K,strokeDasharray:"0, 5"})}function re(A,b,y={}){var N=Ge(b,s,y.fill),z=ce(b,c,y.stroke),K=i.getScaledPath("DATA_OBJECT_PATH",{xScaleFactor:1,yScaleFactor:1,containerWidth:b.width,containerHeight:b.height,position:{mx:.474,my:.296}}),he=w(A,K,{fill:N,fillOpacity:go,stroke:z}),Le=ee(b);if(WS(Le)){var Qe=i.getScaledPath("DATA_OBJECT_COLLECTION_PATH",{xScaleFactor:1,yScaleFactor:1,containerWidth:b.width,containerHeight:b.height,position:{mx:.33,my:(b.height-18)/b.height}});w(A,Qe,{strokeWidth:2,fill:N,stroke:z})}return he}function ve(A,b,y={}){return m(A,b.width,b.height,{fillOpacity:go,...y,fill:Ge(b,s,y.fill),stroke:ce(b,c,y.stroke)})}function te(A,b,y={}){return S(A,b.width,b.height,{fill:Ge(b,s,y.fill),fillOpacity:go,stroke:ce(b,c,y.stroke)})}function V(A,b,y={}){var N=g(A,Hn(b,y),An(b,y),0,{fill:Ge(b,s,y.fill),fillOpacity:y.fillOpacity||go,stroke:ce(b,c,y.stroke),strokeWidth:1.5}),z=ee(b);if(v(z,"bpmn:Lane")){var K=z.get("name");q(A,K,b,y)}return N}function G(A,b,y={}){var N=ae(A,b,y),z=We(b);if(un(b)&&(fe(N,{strokeDasharray:"0, 5.5",strokeWidth:2.5}),!z)){var K=ee(b).flowElements||[],he=K.filter(Le=>v(Le,"bpmn:StartEvent"));he.length===1&&X(he[0],A,y,b)}return ge(A,b,z?"center-top":"center-middle",y),z?$(A,b,void 0,y):$(A,b,["SubProcessMarker"],y),N}function X(A,b,y,N){var z=22,K={fill:Ge(N,s,y.fill),stroke:ce(N,c,y.stroke),width:z,height:z},he=ee(A).isInterrupting,Le=he?0:3,Qe=he?1:1.2,Ct=20,nt=(z-Ct)/2,Nt="translate("+nt+","+nt+")";m(b,Ct,Ct,{fill:K.fill,stroke:K.stroke,strokeWidth:Qe,strokeDasharray:Le,transform:Nt}),B(A,b,K,N)}function je(A,b,y={}){var N=ae(A,b,y);return ge(A,b,"center-middle",y),$(A,b,void 0,y),N}var Rt=this.handlers={"bpmn:AdHocSubProcess":function(A,b,y={}){return We(b)?y=Ze(y,["fill","stroke","width","height"]):y=Ze(y,["fill","stroke"]),G(A,b,y)},"bpmn:Association":function(A,b,y={}){return y=Ze(y,["fill","stroke"]),de(A,b,y)},"bpmn:BoundaryEvent":function(A,b,y={}){var{renderIcon:N=!0}=y;y=Ze(y,["fill","stroke"]);var z=ee(b),K=z.get("cancelActivity");y={strokeWidth:1.5,fill:Ge(b,s,y.fill),fillOpacity:QS,stroke:ce(b,c,y.stroke)},K||(y.strokeDasharray="6");var he=ve(A,b,y);return m(A,b.width,b.height,Ds,{...y,fill:"none"}),N&&B(b,A,y),he},"bpmn:BusinessRuleTask":function(A,b,y={}){y=Ze(y,["fill","stroke"]);var N=je(A,b,y),z=i.getScaledPath("TASK_TYPE_BUSINESS_RULE_MAIN",{abspos:{x:8,y:8}}),K=w(A,z);fe(K,{fill:Ge(b,s,y.fill),stroke:ce(b,c,y.stroke),strokeWidth:1});var he=i.getScaledPath("TASK_TYPE_BUSINESS_RULE_HEADER",{abspos:{x:8,y:8}}),Le=w(A,he);return fe(Le,{fill:ce(b,c,y.stroke),stroke:ce(b,c,y.stroke),strokeWidth:1}),N},"bpmn:CallActivity":function(A,b,y={}){return y=Ze(y,["fill","stroke"]),G(A,b,{strokeWidth:5,...y})},"bpmn:ComplexGateway":function(A,b,y={}){y=Ze(y,["fill","stroke"]);var N=te(A,b,y),z=i.getScaledPath("GATEWAY_COMPLEX",{xScaleFactor:.5,yScaleFactor:.5,containerWidth:b.width,containerHeight:b.height,position:{mx:.46,my:.26}});return w(A,z,{fill:ce(b,c,y.stroke),stroke:ce(b,c,y.stroke),strokeWidth:1}),N},"bpmn:DataInput":function(A,b,y={}){y=Ze(y,["fill","stroke"]);var N=i.getRawPath("DATA_ARROW"),z=re(A,b,y);return w(A,N,{fill:"none",stroke:ce(b,c,y.stroke),strokeWidth:1}),z},"bpmn:DataInputAssociation":function(A,b,y={}){return y=Ze(y,["fill","stroke"]),de(A,b,{...y,markerEnd:d(A,"association-end",Ge(b,s,y.fill),ce(b,c,y.stroke))})},"bpmn:DataObject":function(A,b,y={}){return y=Ze(y,["fill","stroke"]),re(A,b,y)},"bpmn:DataObjectReference":L("bpmn:DataObject"),"bpmn:DataOutput":function(A,b,y={}){y=Ze(y,["fill","stroke"]);var N=i.getRawPath("DATA_ARROW"),z=re(A,b,y);return w(A,N,{strokeWidth:1,fill:ce(b,c,y.stroke),stroke:ce(b,c,y.stroke)}),z},"bpmn:DataOutputAssociation":function(A,b,y={}){return y=Ze(y,["fill","stroke"]),de(A,b,{...y,markerEnd:d(A,"association-end",Ge(b,s,y.fill),ce(b,c,y.stroke))})},"bpmn:DataStoreReference":function(A,b,y={}){y=Ze(y,["fill","stroke"]);var N=i.getScaledPath("DATA_STORE",{xScaleFactor:1,yScaleFactor:1,containerWidth:b.width,containerHeight:b.height,position:{mx:0,my:.133}});return w(A,N,{fill:Ge(b,s,y.fill),fillOpacity:go,stroke:ce(b,c,y.stroke),strokeWidth:2})},"bpmn:EndEvent":function(A,b,y={}){var{renderIcon:N=!0}=y;y=Ze(y,["fill","stroke"]);var z=ve(A,b,{...y,strokeWidth:4});return N&&B(b,A,y),z},"bpmn:EventBasedGateway":function(A,b,y={}){y=Ze(y,["fill","stroke"]);var N=ee(b),z=te(A,b,y);m(A,b.width,b.height,b.height*.2,{fill:Ge(b,"none",y.fill),stroke:ce(b,c,y.stroke),strokeWidth:1});var K=N.get("eventGatewayType"),he=!!N.get("instantiate");function Le(){var Ct=i.getScaledPath("GATEWAY_EVENT_BASED",{xScaleFactor:.18,yScaleFactor:.18,containerWidth:b.width,containerHeight:b.height,position:{mx:.36,my:.44}});w(A,Ct,{fill:"none",stroke:ce(b,c,y.stroke),strokeWidth:2})}if(K==="Parallel"){var Qe=i.getScaledPath("GATEWAY_PARALLEL",{xScaleFactor:.4,yScaleFactor:.4,containerWidth:b.width,containerHeight:b.height,position:{mx:.474,my:.296}});w(A,Qe,{fill:"none",stroke:ce(b,c,y.stroke),strokeWidth:1})}else K==="Exclusive"&&(he||m(A,b.width,b.height,b.height*.26,{fill:"none",stroke:ce(b,c,y.stroke),strokeWidth:1}),Le());return z},"bpmn:ExclusiveGateway":function(A,b,y={}){y=Ze(y,["fill","stroke"]);var N=te(A,b,y),z=i.getScaledPath("GATEWAY_EXCLUSIVE",{xScaleFactor:.4,yScaleFactor:.4,containerWidth:b.width,containerHeight:b.height,position:{mx:.32,my:.3}}),K=Xe(b);return K.get("isMarkerVisible")&&w(A,z,{fill:ce(b,c,y.stroke),stroke:ce(b,c,y.stroke),strokeWidth:1}),N},"bpmn:Gateway":function(A,b,y={}){return y=Ze(y,["fill","stroke"]),te(A,b,y)},"bpmn:Group":function(A,b,y={}){return y=Ze(y,["fill","stroke","width","height"]),g(A,b.width,b.height,Ls,{stroke:ce(b,c,y.stroke),strokeWidth:1.5,strokeDasharray:"10, 6, 0, 6",fill:"none",pointerEvents:"none",width:Hn(b,y),height:An(b,y)})},"bpmn:InclusiveGateway":function(A,b,y={}){y=Ze(y,["fill","stroke"]);var N=te(A,b,y);return m(A,b.width,b.height,b.height*.24,{fill:Ge(b,s,y.fill),stroke:ce(b,c,y.stroke),strokeWidth:2.5}),N},"bpmn:IntermediateEvent":function(A,b,y={}){var{renderIcon:N=!0}=y;y=Ze(y,["fill","stroke"]);var z=ve(A,b,{...y,strokeWidth:1.5});return m(A,b.width,b.height,Ds,{fill:"none",stroke:ce(b,c,y.stroke),strokeWidth:1.5}),N&&B(b,A,y),z},"bpmn:IntermediateCatchEvent":L("bpmn:IntermediateEvent"),"bpmn:IntermediateThrowEvent":L("bpmn:IntermediateEvent"),"bpmn:Lane":function(A,b,y={}){return y=Ze(y,["fill","stroke","width","height"]),V(A,b,{...y,fillOpacity:JS})},"bpmn:ManualTask":function(A,b,y={}){y=Ze(y,["fill","stroke"]);var N=je(A,b,y),z=i.getScaledPath("TASK_TYPE_MANUAL",{abspos:{x:17,y:15}});return w(A,z,{fill:Ge(b,s,y.fill),stroke:ce(b,c,y.stroke),strokeWidth:.5}),N},"bpmn:MessageFlow":function(A,b,y={}){y=Ze(y,["fill","stroke"]);var N=ee(b),z=Xe(b),K=Ge(b,s,y.fill),he=ce(b,c,y.stroke),Le=x(A,b.waypoints,{markerEnd:d(A,"messageflow-end",K,he),markerStart:d(A,"messageflow-start",K,he),stroke:he,strokeDasharray:"10, 11",strokeWidth:1.5});if(N.get("messageRef")){var Qe=Le.getPointAtLength(Le.getTotalLength()/2),Ct=i.getScaledPath("MESSAGE_FLOW_MARKER",{abspos:{x:Qe.x,y:Qe.y}}),nt={strokeWidth:1};z.get("messageVisibleKind")==="initiating"?(nt.fill=K,nt.stroke=he):(nt.fill=he,nt.stroke=K);var Nt=w(A,Ct,nt),Pt=N.get("messageRef"),mn=Pt.get("name"),lt=ie(A,mn,{align:"center-top",fitBox:!0,style:{fill:he}}),zt=Nt.getBBox(),ln=lt.getBBox(),Sr=Qe.x-ln.width/2,xn=Qe.y+zt.height/2+KS;Ts(lt,Sr,xn,0)}return Le},"bpmn:ParallelGateway":function(A,b,y={}){y=Ze(y,["fill","stroke"]);var N=te(A,b,y),z=i.getScaledPath("GATEWAY_PARALLEL",{xScaleFactor:.6,yScaleFactor:.6,containerWidth:b.width,containerHeight:b.height,position:{mx:.46,my:.2}});return w(A,z,{fill:ce(b,c,y.stroke),stroke:ce(b,c,y.stroke),strokeWidth:1}),N},"bpmn:Participant":function(A,b,y={}){y=Ze(y,["fill","stroke","width","height"]);var N=V(A,b,y),z=We(b),K=Ut(b),he=ee(b),Le=he.get("name");if(z){var Qe=K?[{x:30,y:0},{x:30,y:An(b,y)}]:[{x:0,y:30},{x:Hn(b,y),y:30}];E(A,Qe,{stroke:ce(b,c,y.stroke),strokeWidth:XS}),q(A,Le,b,y)}else{var Ct=oa(b,y);K||(Ct.height=Hn(b,y),Ct.width=An(b,y));var nt=ie(A,Le,{box:Ct,align:"center-middle",style:{fill:ra(b,u,c,y.stroke)}});if(!K){var Nt=-1*An(b,y);Ts(nt,0,-Nt,270)}}return he.get("participantMultiplicity")&&O("ParticipantMultiplicityMarker",A,b,y),N},"bpmn:ReceiveTask":function(A,b,y={}){y=Ze(y,["fill","stroke"]);var N=ee(b),z=je(A,b,y),K;return N.get("instantiate")?(m(A,28,28,20*.22,{fill:Ge(b,s,y.fill),stroke:ce(b,c,y.stroke),strokeWidth:1}),K=i.getScaledPath("TASK_TYPE_INSTANTIATING_SEND",{abspos:{x:7.77,y:9.52}})):K=i.getScaledPath("TASK_TYPE_SEND",{xScaleFactor:.9,yScaleFactor:.9,containerWidth:21,containerHeight:14,position:{mx:.3,my:.4}}),w(A,K,{fill:Ge(b,s,y.fill),stroke:ce(b,c,y.stroke),strokeWidth:1}),z},"bpmn:ScriptTask":function(A,b,y={}){y=Ze(y,["fill","stroke"]);var N=je(A,b,y),z=i.getScaledPath("TASK_TYPE_SCRIPT",{abspos:{x:15,y:20}});return w(A,z,{fill:Ge(b,s,y.fill),stroke:ce(b,c,y.stroke),strokeWidth:1}),N},"bpmn:SendTask":function(A,b,y={}){y=Ze(y,["fill","stroke"]);var N=je(A,b,y),z=i.getScaledPath("TASK_TYPE_SEND",{xScaleFactor:1,yScaleFactor:1,containerWidth:21,containerHeight:14,position:{mx:.285,my:.357}});return w(A,z,{fill:ce(b,c,y.stroke),stroke:Ge(b,s,y.fill),strokeWidth:1}),N},"bpmn:SequenceFlow":function(A,b,y={}){y=Ze(y,["fill","stroke"]);var N=Ge(b,s,y.fill),z=ce(b,c,y.stroke),K=x(A,b.waypoints,{markerEnd:d(A,"sequenceflow-end",N,z),stroke:z}),he=ee(b),{source:Le}=b;if(Le){var Qe=ee(Le);he.get("conditionExpression")&&v(Qe,"bpmn:Activity")&&fe(K,{markerStart:d(A,"conditional-flow-marker",N,z)}),Qe.get("default")&&(v(Qe,"bpmn:Gateway")||v(Qe,"bpmn:Activity"))&&Qe.get("default")===he&&fe(K,{markerStart:d(A,"conditional-default-flow-marker",N,z)})}return K},"bpmn:ServiceTask":function(A,b,y={}){y=Ze(y,["fill","stroke"]);var N=je(A,b,y);m(A,10,10,{fill:Ge(b,s,y.fill),stroke:"none",transform:"translate(6, 6)"});var z=i.getScaledPath("TASK_TYPE_SERVICE",{abspos:{x:12,y:18}});w(A,z,{fill:Ge(b,s,y.fill),stroke:ce(b,c,y.stroke),strokeWidth:1}),m(A,10,10,{fill:Ge(b,s,y.fill),stroke:"none",transform:"translate(11, 10)"});var K=i.getScaledPath("TASK_TYPE_SERVICE",{abspos:{x:17,y:22}});return w(A,K,{fill:Ge(b,s,y.fill),stroke:ce(b,c,y.stroke),strokeWidth:1}),N},"bpmn:StartEvent":function(A,b,y={}){var{renderIcon:N=!0}=y;y=Ze(y,["fill","stroke"]);var z=ee(b);z.get("isInterrupting")||(y={...y,strokeDasharray:"6"});var K=ve(A,b,y);return N&&B(b,A,y),K},"bpmn:SubProcess":function(A,b,y={}){return We(b)?y=Ze(y,["fill","stroke","width","height"]):y=Ze(y,["fill","stroke"]),G(A,b,y)},"bpmn:Task":function(A,b,y={}){return y=Ze(y,["fill","stroke"]),je(A,b,y)},"bpmn:TextAnnotation":function(A,b,y={}){y=Ze(y,["fill","stroke"]);var{width:N,height:z}=oa(b,y),K=g(A,N,z,0,0,{fill:"none",stroke:"none"}),he=i.getScaledPath("TEXT_ANNOTATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:N,containerHeight:z,position:{mx:0,my:0}});w(A,he,{stroke:ce(b,c,y.stroke)});var Le=ee(b),Qe=Le.get("text")||"";return ie(A,Qe,{align:"left-top",box:oa(b,y),padding:mo,style:{fill:ra(b,u,c,y.stroke)}}),K},"bpmn:Transaction":function(A,b,y={}){We(b)?y=Ze(y,["fill","stroke","width","height"]):y=Ze(y,["fill","stroke"]);var N=G(A,b,{strokeWidth:1.5,...y}),z=n.style(["no-fill","no-events"],{stroke:ce(b,c,y.stroke),strokeWidth:1.5}),K=We(b);return K||(y={}),g(A,Hn(b,y),An(b,y),Ls-Ds,Ds,z),N},"bpmn:UserTask":function(A,b,y={}){y=Ze(y,["fill","stroke"]);var N=je(A,b,y),z=15,K=12,he=i.getScaledPath("TASK_TYPE_USER_1",{abspos:{x:z,y:K}});w(A,he,{fill:Ge(b,s,y.fill),stroke:ce(b,c,y.stroke),strokeWidth:.5});var Le=i.getScaledPath("TASK_TYPE_USER_2",{abspos:{x:z,y:K}});w(A,Le,{fill:Ge(b,s,y.fill),stroke:ce(b,c,y.stroke),strokeWidth:.5});var Qe=i.getScaledPath("TASK_TYPE_USER_3",{abspos:{x:z,y:K}});return w(A,Qe,{fill:ce(b,c,y.stroke),stroke:ce(b,c,y.stroke),strokeWidth:.5}),N},label:function(A,b,y={}){return Ve(A,b,y)}};this._drawPath=w,this._renderer=P}pe(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 $e(e)?vl(e,ZS):v(e,"bpmn:Event")?_m(e):v(e,"bpmn:Activity")?vl(e,Ls):v(e,"bpmn:Gateway")?US(e):qS(e)};function Ze(e,t=[]){return t.reduce((n,i)=>(e[i]&&(n[i]=e[i]),n),{})}var eR=0,tR={width:150,height:50};function nR(e){var t=e.split("-");return{horizontal:t[0]||"center",vertical:t[1]||"top"}}function iR(e){return Vt(e)?j({top:0,left:0,right:0,bottom:0},e):{top:e,left:e,right:e,bottom:e}}var bl=null;function rR(){return bl||(bl=document.createElement("canvas").getContext("2d")),bl}function oR(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(xm(e.fontSize)||"12px"),t.push(e.fontFamily||"sans-serif"),t.join(" ")}function xm(e){if(e!=null)return typeof e=="number"||/^-?\d+(\.\d+)?$/.test(e)?e+"px":e}function aR(e,t){var n=rR();if(!n)return{width:0,height:0};n.font=oR(t),"letterSpacing"in n&&(n.letterSpacing=xm(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 sR(e,t,n){for(var i=e.shift(),r=i,o;;){if(o=aR(r,n),o.width=r?o.width:0,r===" "||r===""||o.width<Math.round(t)||r.length<2)return cR(e,r,i,o);r=lR(r,o.width,t)}}function cR(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 wm="­";function uR(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===wm)&&r.pop();break}var a=r[r.length-1];return a&&a===wm&&(r[r.length-1]="-"),r.join("")}function lR(e,t,n){var i=Math.max(e.length*(n/t),1),r=uR(e,i);return r||(r=e.slice(0,Math.max(Math.round(i-1),1))),r}function Is(e){this._config=j({},{size:tR,padding:eR,style:{},align:"center-top"},e||{})}Is.prototype.createText=function(e,t){return this.layoutText(e,t).element},Is.prototype.getDimensions=function(e,t){return this.layoutText(e,t).dimensions},Is.prototype.layoutText=function(e,t){for(var n=j({},this._config.size,t.box),i=j({},this._config.style,t.style),r=nR(t.align||this._config.align),o=iR(t.padding!==void 0?t.padding:this._config.padding),a=t.fitBox||!1,s=pR(i),c=e.split(/\u00AD?\r?\n/),u=[],l=n.width-o.left-o.right;c.length;)u.push(sR(c,l,i));r.vertical==="middle"&&(o.top=o.bottom=0);var f=Sn(u,function(g,S,E){return g+(s||S.height)},0)+o.top+o.bottom,p=Sn(u,function(g,S,E){return S.width>g?S.width:g},0),d=o.top;r.vertical==="middle"&&(d+=(n.height-f)/2),d-=(s||u[0].height)/4;var h=_e("text");fe(h,i),D(u,function(g){var S;switch(d+=s||g.height,r.horizontal){case"left":S=o.left;break;case"right":S=(a?p:l)-o.right-g.width;break;default:S=Math.max(((a?p:l)-g.width)/2+o.left,0)}var E=_e("tspan");fe(E,{x:S,y:d}),E.textContent=g.text,Oe(h,E)});var m={width:p,height:f};return{dimensions:m,element:h}};function pR(e){if("fontSize"in e&&"lineHeight"in e)return e.lineHeight*parseInt(e.fontSize,10)}var fR=12,dR=1.2,hR=40;function Em(e){var t=j({fontFamily:"Arial, sans-serif",fontSize:fR,fontWeight:"normal",lineHeight:dR},e&&e.defaultStyle||{}),n=parseInt(t.fontSize,10)-1,i=j({},t,{fontSize:n},e&&e.externalStyle||{}),r=new Is({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(hR,Math.round(c.height))}},this.getDimensions=function(a,s){return r.getDimensions(a,s||{})};function o(a,s,c){return r.getDimensions(a,j({box:s},c))}this.createText=function(a,s){return r.createText(a,s||{})},this.getDefaultStyle=function(){return t},this.getExternalStyle=function(){return i}}Em.$inject=["config.textRenderer"];function mR(){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=bR(i.d,{mx:r,my:o,e:a});return f}}var gR=/\{([^{}]+)\}/g,yR=/(?:(?:^|\.)(.+?)(?=\[|\.|$|\()|\[('|")(.+?)\2\])(\(\))?/g;function vR(e,t,n){var i=n;return t.replace(yR,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 bR(e,t){return String(e).replace(gR,function(n,i){return vR(n,i,t)})}const _R={__init__:["bpmnRenderer"],bpmnRenderer:["type",Br],textRenderer:["type",Em],pathMap:["type",mR]};function xR(e,t){return t=t||{},e.replace(/{([^}]+)}/g,function(n,i){return t[i]||"{"+i+"}"})}const aa={translate:["value",xR]};function Ns(e,t,n){return j({id:e.id,type:e.$type,businessObject:e,di:t},n)}function wR(e,t,n){var i=e.waypoint;return!i||i.length<2?[Se(t),Se(n)]:i.map(function(r){return{x:r.x,y:r.y}})}function Sm(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(Ns(e,t,a)),this._canvas.addRootElement(i)}else if(v(t,"bpmndi:BPMNShape")){var s=!We(e,t),c=SR(e);r=n&&(n.hidden||n.collapsed);var u=t.bounds;i=this._elementFactory.createShape(Ns(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")&&(ER(n,Se(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(Ns(e,t,{hidden:r,source:l,target:f,waypoints:wR(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 ir(e)&&Bn(i)&&this.addLabel(e,t,i),this._eventBus.fire("bpmnElement.added",{element:i}),i},Di.prototype._attachBoundary=function(e,t){var n=e.attachedToRef;if(!n)throw new Error(`missing ${cn(e)}#attachedToRef`);var i=this._elementRegistry.get(n.id),r=i&&i.attachers;if(!i)throw Sm(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=jS(t,n),r=Bn(n),r&&(i=this._textRenderer.getExternalLabelBounds(i,r)),o=this._elementFactory.createLabel(Ns(e,t,{id:e.id+"_label",labelTarget:n,type:"label",hidden:n.hidden||!Bn(n),x:Math.round(i.x),y:Math.round(i.y),width:Math.round(i.width),height:Math.round(i.height)})),this._canvas.addShape(o,n.parent)},Di.prototype._getConnectedElement=function(e,t){var n,i,r=e.$type;if(i=e[t+"Ref"],t==="source"&&r==="bpmn:DataInputAssociation"&&(i=i&&i[0]),(t==="source"&&r==="bpmn:DataOutputAssociation"||t==="target"&&r==="bpmn:DataInputAssociation")&&(i=e.$parent),n=i&&this._getElement(i),n)return n;throw i?Sm(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 ER(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 SR(e){return v(e,"bpmn:Group")}const Rm={__depends__:[_R,{__depends__:[aa],bpmnImporter:["type",Di]}]};function sa(e){return{x:e.x+e.width/2,y:e.y+e.height/2}}function ti(e,t){return{x:e.x-t.x,y:e.y-t.y}}function _l(e){return Math.log(e)/Math.log(10)}var RR=1e3;function Q(e){this._eventBus=e}Q.$inject=["eventBus"];function CR(e,t){return function(n){return e.call(t||null,n.context,n.command,n)}}Q.prototype.on=function(e,t,n,i,r,o){if((Wt(t)||Pe(t))&&(o=r,r=i,i=n,n=t,t=null),Wt(n)&&(o=r,r=i,i=n,n=RR),Vt(r)&&(o=r,r=!1),!Wt(i))throw new Error("handlerFn must be a function");Ee(e)||(e=[e]);var a=this._eventBus;D(e,function(s){var c=["commandStack",s,t].filter(function(u){return u}).join(".");a.on(c,n,r?CR(i,o):i,o)})},Q.prototype.canExecute=Li("canExecute"),Q.prototype.preExecute=Li("preExecute"),Q.prototype.preExecuted=Li("preExecuted"),Q.prototype.execute=Li("execute"),Q.prototype.executed=Li("executed"),Q.prototype.postExecute=Li("postExecute"),Q.prototype.postExecuted=Li("postExecuted"),Q.prototype.revert=Li("revert"),Q.prototype.reverted=Li("reverted");function Li(e){return function(n,i,r,o,a){(Wt(n)||Pe(n))&&(a=o,o=r,r=i,i=n,n=null),this.on(n,e,i,r,o,a)}}var xl=["top","bottom","left","right"],Bs=10;function wl(e,t){Q.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(Os(r)&&!at(r)){var o=TR(r);o&&i(r,o)}}function i(r,o){var a=Se(r),s=r.label,c=Se(s);if(s.parent){var u=xe(r),l;switch(o){case"top":l={x:a.x,y:u.top-Bs-s.height/2};break;case"left":l={x:u.left-Bs-s.width/2,y:a.y};break;case"bottom":l={x:a.x,y:u.bottom+Bs+s.height/2};break;case"right":l={x:u.right+Bs+s.width/2,y:a.y};break}var f=ti(l,c);t.moveShape(s,f)}}}pe(wl,Q),wl.$inject=["eventBus","modeling"];function PR(e){var t=e.host,n=Se(e),i=Zt(n,t),r;i.indexOf("-")>=0?r=i.split("-"):r=[i];var o=xl.filter(function(a){return r.indexOf(a)===-1});return o}function AR(e){var t=Se(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 Cm(t,i)});return n}function TR(e){var t=Se(e.label),n=Se(e),i=Cm(n,t);if(MR(i)){var r=AR(e);if(e.host){var o=PR(e);r=r.concat(o)}var a=xl.filter(function(s){return r.indexOf(s)===-1});return a.indexOf(i)!==-1?Zt(e.label,e)!=="intersect"?void 0:i:a[0]}}function Cm(e,t){return Zt(t,e,5)}function MR(e){return xl.indexOf(e)!==-1}function El(e){Q.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)}pe(El,Q),El.$inject=["eventBus"];var kR=1500;function Sl(e,t,n){e.invoke(Q,this),this.preExecute("elements.delete",kR,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=He(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 D(o,u=>{const l=new Set(eo(uo(Array.from(s),Mt(u))));c=c.union(l),s=s.difference(l)}),Array.from(c)}}pe(Sl,Q),Sl.$inject=["injector","eventBus","canvas"];function Rl(e,t){e.invoke(Q,this),this.postExecute("shape.move",function(n){var i=n.newParent,r=n.shape,o=He(r.incoming.concat(r.outgoing),function(a){return v(a,"bpmn:Association")});D(o,function(a){t.moveConnection(a,{x:0,y:0},i)})},!0)}pe(Rl,Q),Rl.$inject=["injector","modeling"];function yo(e,t){for(wn(t)&&(t=[t]);e=e.parent;)if(Fe(e,t))return e;return null}function Pm(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 Ut(n);if(Fe(e,i))return Ut(e);var r;for(r=ee(e);r&&!v(r,"bpmn:Process");r=r.$parent);if(!t)return!0;var o=t.find(function(a){var s=ee(a);return s&&s.get("processRef")===r});return o?Ut(o):!0}var Am=500;function $s(e,t){t.invoke(Q,this),this._bpmnReplace=e;var n=this;this.postExecuted("elements.create",Am,function(i){var r=i.elements;r=r.filter(function(o){var a=o.host;return Tm(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",Am,function(i){var r=i.shapes,o=i.newHost;if(r.length===1){var a=r[0];Tm(a,o)&&(i.shapes=[n._replaceShape(a,o)])}},!0)}$s.$inject=["bpmnReplace","injector"],pe($s,Q),$s.prototype._replaceShape=function(e,t){var n=OR(e),i={type:"bpmn:BoundaryEvent",host:t};return n&&(i.eventDefinitionType=n.$type),this._bpmnReplace.replaceElement(e,i,{layoutConnection:!1})};function OR(e){var t=ee(e),n=t.eventDefinitions;return n&&n[0]}function Tm(e,t){return!$e(e)&&Fe(e,["bpmn:IntermediateThrowEvent","bpmn:IntermediateCatchEvent"])&&!!t}function Cl(e,t){Q.call(this,e);function n(i){return He(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")&&D(o.outgoing,function(a){var s=a.target,c=n(s);v(s,"bpmn:ReceiveTask")&&c.length>0&&t.removeElements(c)})})}Cl.$inject=["eventBus","modeling"],pe(Cl,Q);function Mm(e){return e.create("bpmn:Category")}function DR(e){return e.create("bpmn:CategoryValue")}function km(e,t){var n=t.get("categoryValueRef");return n||(n=t.categoryValueRef=DR(e)),n.$parent||(n.$parent=Mm(e)),n}function LR(e,t,n){return St(t.get("categoryValue"),e),e.$parent=t,St(n.get("rootElements"),t),t.$parent=n,e}function IR(e){var t=e.$parent;return t&&(wt(t.get("categoryValue"),e),e.$parent=null),e}function NR(e){var t=e.$parent;return t&&(wt(t.get("rootElements"),e),e.$parent=null),e}var BR=500;function Pl(e,t,n){n.invoke(Q,this);function i(c){return t.filter(function(u){return v(u,"bpmn:Group")&&!u.labelTarget}).map(ee).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&&LR(c,u,e.getDefinitions())}function s(c,u,l){u&&!o(u,l)&&NR(u),c&&!r(c,l)&&IR(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,ee(u))},!0),this.executed(["shape.move","shape.resize"],BR,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,ee(u))},!0),this.executed("group.updateRefs",function(c){Om(c).forEach(function(u){a(u.categoryValue,u.category)})},!0),this.reverted("group.updateRefs",function(c){Om(c).forEach(function(u){s(u.categoryValue,u.category,ee(u.groupShape))})},!0),this.executed("shape.delete",function(c){var u=c.shape;!v(u,"bpmn:Group")||u.labelTarget||s(c.categoryValue,c.category,ee(u))},!0),this.reverted("shape.delete",function(c){var u=c.shape;!v(u,"bpmn:Group")||u.labelTarget||a(c.categoryValue,c.category)},!0)}Pl.$inject=["bpmnjs","elementRegistry","injector"],pe(Pl,Q);function Om(e){var t;return((t=e.updates)==null?void 0:t.groups)||[]}function Al(e,t,n){Q.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 S=g.source,E=g.target;vo(S)&&ca(E)&&l(E)}function r(g){const S=g.connection,E=g.source,x=g.target;vo(E)&&js(x)&&(u(x),p(E,[S]))}function o(g){const S=g.newTarget,E=g.oldSource,x=g.oldTarget;if(x!==S){const w=E;ca(x)&&l(x),vo(w)&&js(S)&&u(S)}}function a(g){const{element:S}=g;ca(S)?(f(S),d(S)):js(S)&&h(S)}function s(g){const{newData:S,oldShape:E}=g;if(vo(g.oldShape)&&S.eventDefinitionType!=="bpmn:CompensateEventDefinition"||S.type!=="bpmn:BoundaryEvent"){const x=E.outgoing.find(({target:w})=>ca(w));x&&x.target&&(g._connectionTarget=x.target)}else if(!vo(g.oldShape)&&S.eventDefinitionType==="bpmn:CompensateEventDefinition"&&S.type==="bpmn:BoundaryEvent"){const x=E.outgoing.find(({target:w})=>js(w));x&&x.target&&(g._connectionTarget=x.target),m(E)}}function c(g){const{_connectionTarget:S,newShape:E}=g;S&&t.connect(E,S)}function u(g){t.updateProperties(g,{isForCompensation:!0})}function l(g){t.updateProperties(g,{isForCompensation:void 0})}function f(g){for(const S of g.incoming)n.canConnect(S.source,g)||t.removeConnection(S);for(const S of g.outgoing)n.canConnect(g,S.target)||t.removeConnection(S)}function p(g,S){g.outgoing.filter(w=>v(w,"bpmn:Association")).filter(w=>ca(w.target)&&!S.includes(w)).forEach(w=>t.removeConnection(w))}function d(g){const S=g.attachers.slice();S.length&&t.removeElements(S)}function h(g){const S=g.incoming.filter(E=>vo(E.source));t.removeElements(S)}function m(g){const S=g.outgoing.filter(E=>v(E,"bpmn:SequenceFlow"));t.removeElements(S)}}pe(Al,Q),Al.$inject=["eventBus","modeling","bpmnRules"];function ca(e){const t=ee(e);return t&&t.get("isForCompensation")}function vo(e){return e&&v(e,"bpmn:BoundaryEvent")&&ho(e,"bpmn:CompensateEventDefinition")}function js(e){return e&&v(e,"bpmn:Activity")&&!un(e)}function Tl(e){e.invoke(Q,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"))})}Tl.$inject=["injector"],pe(Tl,Q);function Ml(e,t){Q.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}})}Ml.$inject=["eventBus","bpmnFactory"],pe(Ml,Q);var kl=20,Ol=20,Dm=30,Fs=2e3;function Dl(e,t,n){Q.call(this,t),t.on(["create.start","shape.move.start"],Fs,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")&&!$e(f)&&!at(f)});if(c.length){var u=Mt(c),l=$R(a,u);j(a,l),o.createConstraints=jR(a,u)}}}),t.on("create.start",Fs,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",Fs,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",Fs,function(r){var o=r.elements,a=r.parent,s=FR(o),c;s&&v(a,"bpmn:Process")&&(r.parent=i(),c=r.hints=r.hints||{},c.participant=s,c.process=a,c.processRef=ee(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=ee(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)&&ee(s).set("processRef",ee(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)&&ee(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)}Dl.$inject=["canvas","eventBus","modeling"],pe(Dl,Q);function $R(e,t){t={width:t.width+kl*2+Dm,height:t.height+Ol*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 jR(e,t){return t=xe(t),{bottom:t.top+e.height/2-Ol,left:t.right-e.width/2+kl,top:t.bottom-e.height/2+Ol,right:t.left+e.width/2-kl-Dm}}function FR(e){return ut(e,function(t){return v(t,"bpmn:Participant")})}var Lm="__targetRef_placeholder";function Ll(e,t){Q.call(this,e),this.executed(["connection.create","connection.delete","connection.move","connection.reconnect"],Im(o)),this.reverted(["connection.create","connection.delete","connection.move","connection.reconnect"],Im(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===Lm});return!u&&s&&(u=t.create("bpmn:Property",{name:Lm}),St(c,u)),u}function r(a,s){var c=i(a);c&&(n(a,c,s)||wt(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,S;m&&m!==f&&r(m,u),d&&d!==f&&r(d,u),f?(S=i(f,!0),g.targetRef=S):g.targetRef=null}}Ll.$inject=["eventBus","bpmnFactory"],pe(Ll,Q);function Im(e){return function(t){var n=t.context,i=n.connection;if(v(i,"bpmn:DataInputAssociation"))return e(t)}}function Hs(e){this._bpmnUpdater=e}Hs.$inject=["bpmnUpdater"],Hs.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),[]},Hs.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 Il(e,t,n,i){Q.call(this,i),t.registerHandler("dataStore.updateContainment",Hs);function r(){return n.filter(function(s){return v(s,"bpmn:Participant")&&ee(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:Xe(s),newSemanticParent:l.processRef||l,newDiParent:Xe(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:zR(l,"bpmn:Participant");a(u,p)}}),this.postExecute("shape.delete",function(s){var c=s.context,u=c.shape,l=e.getRootElement();Fe(u,["bpmn:Participant","bpmn:SubProcess"])&&v(l,"bpmn:Collaboration")&&o(l).filter(function(f){return HR(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)})})}Il.$inject=["canvas","commandStack","elementRegistry","eventBus"],pe(Il,Q);function HR(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 zR(e,t){for(;e.parent;){if(v(e.parent,t))return e.parent;e=e.parent}}var zs=Math.max,Gs=Math.min,GR=20;function Nm(e,t){return{top:e.top-t.top,right:e.right-t.right,bottom:e.bottom-t.bottom,left:e.left-t.left}}function VR(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 WR(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 Vs(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)?Gs:zs)(i,r)),Pe(o)&&(i=(/top|left/.test(e)?zs:Gs)(i,o)),i}function UR(e,t){if(!t)return e;var n=xe(e);return Cs({top:Vs("top",n,t),right:Vs("right",n,t),bottom:Vs("bottom",n,t),left:Vs("left",n,t)})}function qR(e,t,n,i){var r=xe(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?xe(i):o,s={top:Gs(o.top,a.top),left:Gs(o.left,a.left),bottom:zs(o.bottom,a.bottom),right:zs(o.right,a.right)};return Cs(s)}function ua(e,t){return typeof e<"u"?e:GR}function YR(e,t){var n,i,r,o;return typeof t=="object"?(n=ua(t.left),i=ua(t.right),r=ua(t.top),o=ua(t.bottom)):n=i=r=o=ua(t),{x:e.x-n,y:e.y-r,width:e.width+n+i,height:e.height+r+o}}function KR(e){return!(e.waypoints||e.type==="label")}function Bm(e,t){var n;if(e.length===void 0?n=He(e.children,KR):n=e,n.length)return YR(Mt(n),t)}var rr=Math.abs;function XR(e,t){return Nm(xe(t),xe(e))}var ZR=["bpmn:Participant","bpmn:Process","bpmn:SubProcess"],zn=30;function Ws(e,t){return t=t||[],e.children.filter(function(n){v(n,"bpmn:Lane")&&(Ws(n,t),t.push(n))}),t}function or(e){return e.children.filter(function(t){return v(t,"bpmn:Lane")})}function Gn(e){return yo(e,ZR)||e}function QR(e,t){var n=Gn(e),i=v(n,"bpmn:Process")?[]:[n],r=Ws(n,i),o=xe(e),a=xe(t),s=XR(e,t),c=[],u=Ut(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=xe(l);s.top&&(rr(m.bottom-o.top)<10&&(d=a.top-m.bottom),rr(m.top-o.top)<5&&(f=a.top-m.top)),s.left&&(rr(m.right-o.left)<10&&(p=a.left-m.right),rr(m.left-o.left)<5&&(h=a.left-m.left)),s.bottom&&(rr(m.top-o.bottom)<10&&(f=a.bottom-m.top),rr(m.bottom-o.bottom)<5&&(d=a.bottom-m.bottom)),s.right&&(rr(m.left-o.right)<10&&(h=a.right-m.left),rr(m.right-o.right)<5&&(p=a.right-m.right)),(f||p||d||h)&&c.push({shape:l,newBounds:WR(l,{top:f,right:p,bottom:d,left:h})})}}),c}var JR=500;function Nl(e,t){Q.call(this,e);function n(i,r){var o=Ut(i),a=or(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",JR,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))})}Nl.$inject=["eventBus","spaceTool"],pe(Nl,Q);var $m=500;function Us(e,t){t.invoke(Q,this),this._bpmnReplace=e;var n=this;this.postExecuted("elements.create",$m,function(i){var r=i.elements;r.filter(function(o){var a=o.host;return jm(o,a)}).map(function(o){return r.indexOf(o)}).forEach(function(o){i.elements[o]=n._replaceShape(r[o])})},!0),this.preExecute("elements.move",$m,function(i){var r=i.shapes,o=i.newHost;r.forEach(function(a,s){var c=a.host;jm(a,tC(r,c)?c:o)&&(r[s]=n._replaceShape(a))})},!0)}Us.$inject=["bpmnReplace","injector"],pe(Us,Q),Us.prototype._replaceShape=function(e){var t=eC(e),n;return t?n={type:"bpmn:IntermediateCatchEvent",eventDefinitionType:t.$type}:n={type:"bpmn:IntermediateThrowEvent"},this._bpmnReplace.replaceElement(e,n,{layoutConnection:!1})};function eC(e){var t=ee(e),n=t.eventDefinitions;return n&&n[0]}function jm(e,t){return!$e(e)&&v(e,"bpmn:BoundaryEvent")&&!t}function tC(e,t){return e.indexOf(t)!==-1}var qs=Math.round,nC=Math.max;function iC(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 rC(e){var t=[];return e.forEach(function(n,i){t.push([i===0?"M":"L",n.x,n.y])}),t}var Fm=10;function oC(e,t){var n,i;for(n=0;i=e[n];n++)if(Jo(i,t)<=Fm)return{point:e[n],bendpoint:!0,index:n};return null}function aC(e,t){var n=Wh(iC(t,Fm),rC(e)),i=n[0],r=n[n.length-1],o;return i?i!==r?i.segment2!==r.segment2?(o=nC(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 Bl(e,t){return oC(e,t)||aC(e,t)}function $l(e,t,n){Q.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(),S;Pe(a.width)?S=Se(a):S=a;var E=Bl(s,S);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]:S,(c.length===1||!Hm(r,c[c.length-1]))&&c.push(zm(l)),(u.length===1||!Hm(r,u[0]))&&u.unshift(zm(l))}f=o.source,p=o.target,t.canConnect(f,r,o)&&(n.reconnectEnd(o,r,c||S),d=o),t.canConnect(r,p,o)&&(d?h=n.connect(r,p,{type:o.type,waypoints:u}):(n.reconnectStart(o,r,u||S),h=o));var x=[].concat(d&&He(g,function(w){return w.source===d.source})||[],h&&He(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=Se(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&&Bl(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)}pe($l,Q),$l.$inject=["eventBus","bpmnRules","modeling"];function Hm(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 zm(e){return j({},e)}function jl(e,t){Q.call(this,e),this.preExecuted("connection.create",function(n){var i=n.context,r=i.connection,o=i.source,a=i.target,s=i.hints;if(!(s&&s.createElementsBehavior===!1)&&bo(r)){var c=[];v(o,"bpmn:EventBasedGateway")?c=a.incoming.filter(u=>u!==r&&bo(u)):c=a.incoming.filter(u=>u!==r&&bo(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(bo).reduce(function(a,s){return a.includes(s.target)?a:a.concat(s.target)},[]);o.forEach(function(a){a.incoming.filter(bo).forEach(function(s){const c=a.incoming.filter(bo).filter(function(u){return u.source===r});(s.source!==r||c.length>1)&&t.removeConnection(s)})})}})}jl.$inject=["eventBus","modeling"],pe(jl,Q);function bo(e){return v(e,"bpmn:SequenceFlow")}var Ys=1500,Gm=2e3;function Vm(e,t,n){t.on(["create.hover","create.move","create.out","create.end","shape.move.hover","shape.move.move","shape.move.out","shape.move.end"],Ys,function(i){var r=i.context,o=r.shape||i.shape,a=i.hover;v(a,"bpmn:Lane")&&!Fe(o,["bpmn:Lane","bpmn:Participant"])&&(i.hover=Gn(a),i.hoverGfx=e.getGraphics(i.hover));var s=n.getRootElement();a&&a!==s&&(o.labelTarget||Fe(o,["bpmn:Group","bpmn:TextAnnotation"]))&&(i.hover=s,i.hoverGfx=e.getGraphics(i.hover))}),t.on(["connect.hover","connect.out","connect.end","connect.cleanup","global-connect.hover","global-connect.out","global-connect.end","global-connect.cleanup"],Ys,function(i){var r=i.hover;v(r,"bpmn:Lane")&&(i.hover=Gn(r)||r,i.hoverGfx=e.getGraphics(i.hover))}),t.on(["bendpoint.move.hover"],Ys,function(i){var r=i.context,o=i.hover,a=r.type;v(o,"bpmn:Lane")&&/reconnect/.test(a)&&(i.hover=Gn(o)||o,i.hoverGfx=e.getGraphics(i.hover))}),t.on(["connect.start"],Ys,function(i){var r=i.context,o=r.start;v(o,"bpmn:Lane")&&(r.start=Gn(o)||o)}),t.on("shape.move.start",Gm,function(i){var r=i.shape;v(r,"bpmn:Lane")&&(i.shape=Gn(r)||r)}),t.on("spaceTool.move",Gm,function(i){var r=i.hover;r&&v(r,"bpmn:Lane")&&(i.hover=Gn(r))})}Vm.$inject=["elementRegistry","eventBus","canvas"];var Wm=770;function Fl(e,t,n,i){n.invoke(Q,this);function r(s,c){var u=ee(s),l=c.categoryValue||u.categoryValueRef;l||(l=km(e,u));var f=c.category||l.$parent||Mm(e);u.categoryValueRef=l,l.$parent=f,c.categoryValue=l,c.category=f}function o(s,c){var u=ee(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=ee(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=ee(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&&!ee(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&&!ee(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||ee(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",Wm,function(s){var c=s.descriptor,u=s.element;if(!(!v(u,"bpmn:Group")||u.labelTarget)){var l=ee(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",Wm,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})}Fl.$inject=["bpmnFactory","eventBus","injector","moddleCopy"],pe(Fl,Q);function Hl(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 Um(e){function t(i,r,o){var a={x:o.x,y:o.y-50},s={x:o.x-50,y:o.y},c=Hl(i,r,o,a),u=Hl(i,r,o,s),l;c&&u?qm(c,o)>qm(u,o)?l=u:l=c:l=c||u,i.original=l}function n(i){var r=i.waypoints;t(r[0],r[1],Se(i.source)),t(r[r.length-1],r[r.length-2],Se(i.target))}e.on("bpmnElement.added",function(i){var r=i.element;r.waypoints&&n(r)})}Um.$inject=["eventBus"];function qm(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function zl(e){Q.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=ee(i),o=Xe(i);if(Fe(r,t)){var a=o.get("isHorizontal");a===void 0&&(a=!0),o.set("isHorizontal",a)}})}zl.$inject=["eventBus"],pe(zl,Q);function Ym(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}function Km(e){return Math.atan((e[1].y-e[0].y)/(e[1].x-e[0].x))}function sC(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 cC(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 Gl(e,t){var n=t[0],i=t[1],r={x:i.x-n.x,y:i.y-n.y},o=cC([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 Xm(e,t){var n=Gl(e,t),i={x:n.x-e.x,y:n.y-e.y};return Ym(i)}function la(e,t){return Ym({x:e.x-t.x,y:e.y-t.y})}var Zm=Math.sqrt,Qm=Math.min,uC=Math.max,Jm=Math.abs;function eg(e){return Math.pow(e,2)}function pa(e,t){return Zm(eg(e.x-t.x)+eg(e.y-t.y))}function lC(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],ng(i,r)?u=[i]:(o=pa(e,i),a=pa(e,r),c=Qm(o,a),u=pC(i,r,e,c)),u.length<1)throw new Error("expected between [1, 2] circle -> line intersections");u.length===1&&(l={type:"bendpoint",position:u[0],segmentIndex:n,bendpointIndex:ng(i,u[0])?n:n+1}),u.length===2&&(s=dC(u[0],u[1]),l={type:"segment",position:s,segmentIndex:n,relativeLocation:pa(i,s)/pa(i,r)}),f=pa(l.position,e),(!d||p>f)&&(d=l,p=f)}return d}function pC(e,t,n,i){var r=t.x-e.x,o=t.y-e.y,a=n.x-e.x,s=n.y-e.y,c=r*r+o*o,u=r*a+o*s,l=a*a+s*s-i*i,f=u/c,p=l/c,d=f*f-p;if(d<0&&d>-1e-6&&(d=0),d<0)return[];var h=Zm(d),m=-f+h,g=-f-h,S={x:e.x-r*m,y:e.y-o*m};if(d===0)return[S];var E={x:e.x-r*g,y:e.y-o*g};return[S,E].filter(function(x){return fC(x,e,t)})}function fC(e,t,n){return tg(e.x,t.x,n.x)&&tg(e.y,t.y,n.y)}function tg(e,t,n){return e>=Qm(t,n)-Ks&&e<=uC(t,n)+Ks}function dC(e,t){return{x:(e.x+t.x)/2,y:(e.y+t.y)/2}}var Ks=.1;function ng(e,t){return Jm(e.x-t.x)<=Ks&&Jm(e.y-t.y)<=Ks}function hC(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=rg(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 ig(e,t,n,i){var r=0,o=0,a={point:e,delta:{x:0,y:0}},s=lC(e,n),c=s.segmentIndex,u=hC(n,t,s,i);if(u<0||u>t.length-2||u===null)return a;var l=og(n,c),f=og(t,u),p=s.position,d=gC(l,p),h=mC(l,f);if(s.type==="bendpoint"){var m=t.length-n.length,g=s.bendpointIndex,S=n[g];if(t.indexOf(S)!==-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=rg(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=sC({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 rg(e,t){var n=la(e[t-1],e[t]),i=la(e[t],e[t+1]),r=n/(n+i);return r}function mC(e,t){var n=Km(e),i=Km(t);return i-n}function og(e,t){return[e[t],e[t+1]]}function gC(e,t){var n=la(e[0],e[1]),i=la(e[0],t);return n===0?0:i/n}function yC(e,t,n,i){var r=Se(e);return ig(r,t,n,i).delta}function fa(e,t,n){var i=sa(t),r=sa(n),o=ti(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 ag(e,t,n){var i=sa(e),r=sa(t),o=sa(n),a=ti(e,i),s=ti(i,r),c=vC(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 vC(e,t,n){var i=xe(t),r=xe(n);if(bC(i,r))return null;var o=Zt(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=Zt(n,s),c!==o?null:a}function bC(e,t){return _C(e,t)||xC(e,t)}function _C(e,t){return e.right!==t.right&&e.left!==t.left}function xC(e,t){return e.top!==t.top&&e.bottom!==t.bottom}var sg="name",cg="text";function Vl(e,t,n,i){Q.call(this,e),this.postExecute("element.updateProperties",r),this.postExecute("element.updateModdleProperties",a=>{ee(a.context.element)===a.context.moddleElement&&r(a)});function r(a){var s=a.context,c=s.element,u=s.properties;if(sg in u&&t.updateLabel(c,u[sg]),cg in u&&v(c,"bpmn:TextAnnotation")){var l=i.getTextAnnotationBounds({x:c.x,y:c.y,width:c.width,height:c.height},u[cg]||"");t.updateLabel(c,u.text,l)}}this.postExecute(["shape.create","connection.create"],function(a){var s=a.context,c=s.hints||{};if(c.createElementsBehavior!==!1){var u=s.shape||s.connection;$e(u)||!ir(u)||Bn(u)&&t.updateLabel(u,Bn(u))}}),this.postExecute("shape.delete",function(a){var s=a.context,c=s.labelTarget,u=s.hints||{};c&&u.unsetLabel!==!1&&t.updateLabel(c,null,null,{removeShape:!1})});function o(a){var s=a.context,c=s.connection,u=c.label,l=j({},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),yC(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=ee(c);l&&ir(l)&&u.label&&c.label&&(c.label.x=u.label.x,c.label.y=u.label.y)}),this.preExecute("shape.resize",function(a){var s=a.context,c=s.shape,u=s.hints||{};if(!(!$e(c)||u.autoResize)){var l=s.newBounds,f=i.getDimensions(Bn(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(Os(c)){var f=c.label,p=Se(f),d=SC(l),h=EC(p,d),m=wC(h,l,u);t.moveShape(f,m)}})}pe(Vl,Q),Vl.$inject=["eventBus","modeling","bpmnFactory","textRenderer"];function wC(e,t,n){var i=fa(e,t,n);return ki(ti(i,e))}function EC(e,t){if(t.length){var n=RC(e,t);return Gl(e,n)}}function SC(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 RC(e,t){var n=t.map(function(r){return{line:r,distance:Xm(e,r)}}),i=ri(n,"distance");return i[0].line}function CC(e,t,n,i){return ig(e,t,n,i).point}function Wl(e,t){Q.call(this,e);function n(i,r){var o=i.context,a=o.connection,s=j({},o.hints),c=o.newWaypoints||a.waypoints,u=o.oldWaypoints;return typeof s.startChanged>"u"&&(s.startChanged=!!s.connectionStart),typeof s.endChanged>"u"&&(s.endChanged=!!s.connectionEnd),CC(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)})})}pe(Wl,Q),Wl.$inject=["eventBus","modeling"];function Xs(e,t,n){var i=Qs(e),r=lg(i,t),o=i[0];return r.length?r[r.length-1]:fa(o.original||o,n,t)}function Zs(e,t,n){var i=Qs(e),r=lg(i,t),o=i[i.length-1];return r.length?r[0]:fa(o.original||o,n,t)}function Ul(e,t,n){var i=Qs(e),r=ug(t,n),o=i[0];return fa(o.original||o,r,t)}function ql(e,t,n){var i=Qs(e),r=ug(t,n),o=i[i.length-1];return fa(o.original||o,r,t)}function ug(e,t){return{x:e.x-t.x,y:e.y-t.y,width:e.width,height:e.height}}function Qs(e){var t=e.waypoints;if(!t.length)throw new Error("connection#"+e.id+": no waypoints");return t}function lg(e,t){var n=on(e,AC);return He(n,function(i){return PC(i,t)})}function PC(e,t){return Zt(t,e,1)==="intersect"}function AC(e){return e.original||e}function Yl(e,t){Q.call(this,e),this.postExecute("shape.replace",function(n){var i=n.oldShape,r=n.newShape;if(TC(i,r)){var o=MC(i);o.incoming.forEach(function(a){var s=Zs(a,r,i);t.reconnectEnd(a,r,s)}),o.outgoing.forEach(function(a){var s=Xs(a,r,i);t.reconnectStart(a,r,s)})}},!0)}Yl.$inject=["eventBus","modeling"],pe(Yl,Q);function TC(e,t){return v(e,"bpmn:Participant")&&We(e)&&v(t,"bpmn:Participant")&&!We(t)}function MC(e){var t=Zo([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 kC=["bpmn:MessageEventDefinition","bpmn:TimerEventDefinition","bpmn:EscalationEventDefinition","bpmn:ConditionalEventDefinition","bpmn:SignalEventDefinition"];function pg(e){const t=ee(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:kC.some(i=>v(n[0],i))}function fg(e){return v(e,"bpmn:BoundaryEvent")?"cancelActivity":"isInterrupting"}function Kl(e,t){e.invoke(Q,this),this.postExecuted("shape.replace",function(n){const i=n.context.oldShape,r=n.context.newShape,o=n.context.hints;if(!pg(r))return;const a=fg(r);if(o.targetElement&&o.targetElement[a]!==void 0)return;const c=ee(i).get(a),u=ee(r).get(a);c!==u&&t.updateProperties(r,{[a]:c})})}Kl.$inject=["injector","modeling"],pe(Kl,Q);function Xl(e,t){Q.call(this,e),this.preExecute("shape.resize",function(n){var i=n.shape,r=Xe(i),o=r&&r.get("label"),a=o&&o.get("bounds");a&&t.updateModdleProperties(i,o,{bounds:void 0})},!0)}pe(Xl,Q),Xl.$inject=["eventBus","modeling"];function Zl(e,t,n){Q.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=OC(o.waypoints,a.waypoints);n.reconnectEnd(o,a.target,s)}}})}pe(Zl,Q),Zl.$inject=["eventBus","bpmnRules","modeling"];function _o(e){return e.original||e}function OC(e,t){var n=Hl(_o(e[e.length-2]),_o(e[e.length-1]),_o(t[1]),_o(t[0]));return n?[].concat(e.slice(0,e.length-1),[n],t.slice(1)):[_o(e[0]),_o(t[t.length-1])]}function Ql(e,t){Q.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)}Ql.$inject=["eventBus","modeling"],pe(Ql,Q);function Jl(e,t,n,i){Q.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;D(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})})}pe(Jl,Q),Jl.$inject=["eventBus","modeling","bpmnRules","injector"];function Js(e,t,n,i,r,o){i.invoke(Q,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=[];D(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})})}pe(Js,Q),Js.prototype._replaceElements=function(e,t){var n=this._elementRegistry,i=this._bpmnReplace,r=this._selection;D(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)},Js.$inject=["bpmnReplace","bpmnRules","elementRegistry","injector","modeling","selection"];var DC=1500,LC={width:140,height:120},ep={width:300,height:60},tp={width:60,height:300},ec={width:300,height:150},tc={width:150,height:300},dg={width:140,height:120},hg={width:100,height:40};function mg(e){e.on("resize.start",DC,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=jC(i,r,o)),v(i,"bpmn:SubProcess")&&We(i)&&(n.minDimensions=dg),v(i,"bpmn:TextAnnotation")&&(n.minDimensions=hg)})}mg.$inject=["eventBus"];var ar=Math.abs,IC=Math.min,NC=Math.max;function gg(e,t,n,i){var r=e[t];e[t]=r===void 0?n:i(n,r)}function xo(e,t,n){return gg(e,t,n,IC)}function wo(e,t,n){return gg(e,t,n,NC)}var BC={top:20,left:50,right:20,bottom:20},$C={top:50,left:20,right:20,bottom:20};function jC(e,t,n){var i=Gn(e),r=!0,o=!0,a=Ws(i,[i]),s=xe(e),c={},u={},l=Ut(e),f=l?ep:tp;/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=xe(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&&ar(s.top-m.bottom)<10&&wo(c,"top",m.top+f.height),ar(s.top-m.top)<5&&xo(u,"top",m.bottom-f.height)),/e/.test(t)&&(n&&ar(s.right-m.left)<10&&xo(c,"right",m.right-f.width),ar(s.right-m.right)<5&&wo(u,"right",m.left+f.width)),/s/.test(t)&&(n&&ar(s.bottom-m.top)<10&&xo(c,"bottom",m.bottom-f.height),ar(s.bottom-m.bottom)<5&&wo(u,"bottom",m.top+f.height)),/w/.test(t)&&(n&&ar(s.left-m.right)<10&&wo(c,"left",m.left+f.width),ar(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?BC:$C;return p.forEach(function(h){var m=xe(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 yg(e){!e||typeof e.stopPropagation!="function"||e.stopPropagation()}function Eo(e){return e.originalEvent||e.srcEvent}function np(e){yg(e),yg(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 vg(){return/mac/i.test(navigator.platform)}function bg(e,t){return(Eo(e)||e).button===t}function sr(e){return bg(e,0)}function FC(e){return bg(e,1)}function da(e){var t=Eo(e)||e;return sr(e)?vg()?t.metaKey:t.ctrlKey:!1}function nc(e){var t=Eo(e)||e;return sr(e)&&t.shiftKey}var _g=1001;function xg(e,t){e.on("resize.start",_g+500,function(n){var i=n.context,r=i.shape;(v(r,"bpmn:Lane")||v(r,"bpmn:Participant"))&&(i.balanced=!da(n))}),e.on("resize.end",_g,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=Xh(a),t.resizeLane(r,a,i.balanced)),!1})}xg.$inject=["eventBus","modeling"];var HC=500;function ip(e,t,n,i,r){n.invoke(Q,this);function o(l){return Fe(l,["bpmn:ReceiveTask","bpmn:SendTask"])||zC(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(Fe(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(Fe(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=ee(f),d=c(p),h;d&&!a(d)&&(h=e.getDefinitions().get("rootElements"),St(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");wt(p,f)}},!0),t.on("copyPaste.copyElement",function(l){var f=l.descriptor,p=l.element;if(!(p.labelTarget||!o(p))){var d=ee(p),h=c(d);h&&(f.referencedRootElement=h)}}),t.on("copyPaste.pasteElement",HC,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)})}ip.$inject=["bpmnjs","eventBus","injector","moddleCopy","bpmnFactory"],pe(ip,Q);function zC(e,t){return Ee(t)||(t=[t]),Ui(t,function(n){return ho(e,n)})}var wg=Math.max;function Eg(e){e.on("spaceTool.getMinDimensions",function(t){var n=t.shapes,i=t.axis,r=t.start,o={};return D(n,function(a){var s=a.id;v(a,"bpmn:Participant")&&(o[s]=VC(a,i,r)),v(a,"bpmn:Lane")&&(o[s]=Ut(a)?ep:tp),v(a,"bpmn:SubProcess")&&We(a)&&(o[s]=dg),v(a,"bpmn:TextAnnotation")&&(o[s]=hg),v(a,"bpmn:Group")&&(o[s]=LC)}),o})}Eg.$inject=["eventBus"];function GC(e){return e==="x"}function VC(e,t,n){var i=Ut(e);if(!qC(e))return i?ec:tc;var r=GC(t),o={};return r?i?o=ec:o={width:UC(e,n,r),height:tc.height}:i?o={width:ec.width,height:WC(e,n,r)}:o=tc,o}function WC(e,t,n){var i;return i=YC(e,t,n),wg(ec.height,i)}function UC(e,t,n){var i;return i=KC(e,t,n),wg(tc.width,i)}function qC(e){return!!or(e).length}function YC(e,t,n){var i=or(e),r;return r=rp(i,t,n),e.height-r.height+ep.height}function KC(e,t,n){var i=or(e),r;return r=rp(i,t,n),e.width-r.width+tp.width}function rp(e,t,n){var i,r,o;for(i=0;i<e.length;i++)if(r=e[i],!n&&t>=r.y&&t<=r.y+r.height||n&&t>=r.x&&t<=r.x+r.width)return o=or(r),o.length?rp(o,t,n):r}var Sg="_plane";function Rg(e){var t=e.id;return XC(t)}function mi(e){var t=e.id;return v(e,"bpmn:SubProcess")?Cg(t):t}function jr(e){return Cg(e)}function ic(e){var t=Xe(e);return v(t,"bpmndi:BPMNPlane")}function Cg(e){return e+Sg}function XC(e){return e.replace(new RegExp(Sg+"$"),"")}var Pg=400,ZC=600,Ag={x:180,y:160};function Ii(e,t,n,i,r,o,a){Q.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")&&!We(f)}function u(f){var p=f.shape,d=f.newRootElement,h=ee(p);d=s._addDiagram(d||h),f.newRootElement=e.addRootElement(d)}function l(f){var p=f.shape,d=ee(p);s._removeDiagram(d);var h=f.newRootElement=a.get(mi(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;D(p,function(d){if(c(d)){var h=a.get(mi(d));if(!(!h||!d.children||!d.children.length)){var m=Tg(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")||!We(p)||D(ia([p]),d=>{n.removeShape(d.annotation)})},!0),this.preExecuted("shape.delete",function(f){var p=f.shape;if(c(p)){var d=a.get(mi(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(mi(p)))},!0),this.postExecuted("shape.replace",function(f){var p=f.newShape,d=f.oldRoot,h=e.findRoot(mi(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(ic(p)){a.updateId(p,jr(g)),a.updateId(m,g);return}var S=a.get(jr(m));S&&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(ic(p)){a.updateId(p,jr(m)),a.updateId(g,m);return}var S=a.get(jr(g));S&&a.updateId(S,jr(m))}}},!0),t.on("element.changed",function(f){var p=f.element;if(ic(p)){var d=p,h=a.get(Rg(d));!h||h===d||t.fire("element.changed",{element:h})}}),this.executed("shape.toggleCollapse",Pg,function(f){var p=f.shape;v(p,"bpmn:SubProcess")&&(We(p)?l(f):(u(f),s._showRecursively(p.children)))},!0),this.reverted("shape.toggleCollapse",Pg,function(f){var p=f.shape;v(p,"bpmn:SubProcess")&&(We(p)?l(f):(u(f),s._showRecursively(p.children)))},!0),this.postExecuted("shape.toggleCollapse",ZC,function(f){var p=f.shape;if(v(p,"bpmn:SubProcess")){var d=f.newRootElement;if(d)if(We(p))s._moveChildrenToShape(d.children.slice(),p),D(ia(p.children),m=>{n.moveShape(m.annotation,{x:0,y:0},p.parent),D(m.associations,g=>{n.moveConnection(g,{x:0,y:0},p.parent)})});else{s._disconnectSharedAnnotations(p);var h=Tg(p);s._moveChildrenToShape(h,d)}}},!0),t.on("copyPaste.createTree",function(f){var p=f.element,d=f.children;if(c(p)){var h=mi(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(Xe(m),"bpmndi:BPMNPlane");if(g){var S=Rg(m),E=ut(h,function(x){return x.id===S});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)})}pe(Ii,Q),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:Ag.x-r.x,y:Ag.y-r.y};else{var a=Se(t),s=Se(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(bm(e).map(i=>i.annotation));n.size&&D(ia(e.children),i=>{n.has(i.annotation)&&D(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:mi(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 QC(e){var t=[];return D(ia(e),n=>{t.push(n.annotation),t.push.apply(t,n.associations)}),t}function Tg(e){return e.children.slice().concat(QC(e.children)).concat(JC(e))}function JC(e){return ul(e.children||[]).reduce(function(t,n){return n.label&&n.label.parent!==e&&t.push(n.label),t},[])}function op(e,t){e.invoke(Q,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"))||!We(r))){var o=eP(r);t.createShape({type:"bpmn:StartEvent"},o,r)}})}op.$inject=["injector","modeling"],pe(op,Q);function eP(e){return{x:e.x+e.width/6,y:e.y+e.height/2}}function ap(e,t){Q.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,Bn(r)||""),c=a.y!==r.y&&Math.abs(a.y+a.height-(r.y+r.height))<=1,u=r.y+r.height;i.newBounds={width:a.width,height:s.height,x:a.x,y:c?u-s.height:a.y}}})}pe(ap,Q),ap.$inject=["eventBus","textRenderer"];function sp(e,t){Q.call(this,e),this.postExecuted("shape.toggleCollapse",1500,function(n){var i=n.shape;if(We(i))return;var r=Zo(i);r.forEach(function(a){var s=a.incoming.slice(),c=a.outgoing.slice();D(s,function(u){o(u,!0)}),D(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,Se(i)):t.reconnectStart(a,i,Se(i)))}},!0)}pe(sp,Q),sp.$inject=["eventBus","modeling"];var cp=500;function up(e,t,n){Q.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=tP(c).concat([a]),f=Bm(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"],cp,function(a){var s=a.context,c=s.shape;v(c,"bpmn:SubProcess")&&(c.collapsed?Xe(c).isExpanded=!1:(i(c.children),Xe(c).isExpanded=!0))}),this.reverted(["shape.toggleCollapse"],cp,function(a){var s=a.context,c=s.shape;c.collapsed?Xe(c).isExpanded=!1:Xe(c).isExpanded=!0}),this.postExecuted(["shape.toggleCollapse"],cp,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"})})}pe(up,Q),up.$inject=["eventBus","elementFactory","modeling"];function tP(e){return e.filter(function(t){return!t.hidden})}function lp(e,t,n,i){t.invoke(Q,this),this.preExecute("shape.delete",function(r){var o=r.context,a=o.shape,s=a.businessObject;$e(a)||(v(a,"bpmn:Participant")&&We(a)&&n.ids.unclaim(s.processRef.id),i.unclaimId(s.id,s))}),this.preExecute("connection.delete",function(r){var o=r.context,a=o.connection,s=a.businessObject;i.unclaimId(s.id,s)}),this.preExecute("canvas.updateRoot",function(){var r=e.getRootElement(),o=r.businessObject;v(r,"bpmn:Collaboration")&&n.ids.unclaim(o.id)})}pe(lp,Q),lp.$inject=["canvas","injector","moddle","modeling"];function pp(e,t){Q.call(this,e),this.preExecute("connection.delete",function(n){var i=n.context,r=i.connection,o=r.source;nP(r,o)&&t.updateProperties(o,{default:null})})}pe(pp,Q),pp.$inject=["eventBus","modeling"];function nP(e,t){if(!v(e,"bpmn:SequenceFlow"))return!1;var n=ee(t),i=ee(e);return n.get("default")===i}var iP=500,rP=5e3,Mg=["shape.create","shape.delete","shape.move","shape.resize"],kg=[...Mg,"spaceTool","lane.add","lane.resize","lane.split","elements.create","elements.delete","elements.move"];function fp(e,t){Q.call(this,e);var n;function i(){return n=n||new oP,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(kg,rP,function(){i()}),this.postExecuted(kg,iP,function(){o()}),this.preExecute(Mg,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))})}fp.$inject=["eventBus","modeling"],pe(fp,Q);function oP(){this.flowNodes=[],this.lanes=[],this.counter=0,this.addLane=function(e){this.lanes.push(e)},this.addFlowNode=function(e){this.flowNodes.push(e)},this.enter=function(){this.counter++},this.leave=function(){return this.counter--,!this.counter}}var aP=500,sP=5e3,Og=["connection.create","connection.delete","connection.layout","connection.move","connection.reconnect","connection.updateWaypoints","shape.create","shape.delete","shape.move","shape.resize"],Dg=[...Og,"elements.create","elements.delete","elements.move","label.create","spaceTool"];function dp(e,t){Q.call(this,e);var n;function i(){return n=n||new cP,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(Dg,sP,function(){i()}),this.postExecuted(Dg,aP,function(){o()}),this.preExecute(Og,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)})}dp.$inject=["eventBus","modeling"],pe(dp,Q);function cP(){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 hp(e,t){Q.call(this,e),this.postExecuted("elements.create",function(n){const i=n.context,r=i.elements;for(const o of r)uP(o)&&!pP(o)&&t.updateProperties(o,{isForCompensation:void 0})})}pe(hp,Q),hp.$inject=["eventBus","modeling"];function uP(e){const t=ee(e);return t&&t.isForCompensation}function lP(e){return e&&v(e,"bpmn:BoundaryEvent")&&ho(e,"bpmn:CompensateEventDefinition")}function pP(e){return e.incoming.filter(n=>lP(n.source)).length>0}const fP={__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",wl],appendBehavior:["type",El],associationBehavior:["type",Rl],attachEventBehavior:["type",$s],artifactBehavior:["type",Sl],boundaryEventBehavior:["type",Cl],categoryRootElementReferenceBehavior:["type",Pl],compensateBoundaryEventBehaviour:["type",Al],createBehavior:["type",Tl],createDataObjectBehavior:["type",Ml],createParticipantBehavior:["type",Dl],dataInputAssociationBehavior:["type",Ll],dataStoreBehavior:["type",Il],deleteLaneBehavior:["type",Nl],detachEventBehavior:["type",Us],dropOnFlowBehavior:["type",$l],eventBasedGatewayBehavior:["type",jl],fixHoverBehavior:["type",Vm],groupBehavior:["type",Fl],importDockingFix:["type",Um],isHorizontalFix:["type",zl],labelBehavior:["type",Vl],layoutConnectionBehavior:["type",Wl],messageFlowBehavior:["type",Yl],nonInterruptingBehavior:["type",Kl],removeElementBehavior:["type",Zl],removeEmbeddedLabelBoundsBehavior:["type",Xl],removeParticipantBehavior:["type",Ql],replaceConnectionBehavior:["type",Jl],replaceElementBehaviour:["type",Js],resizeBehavior:["type",mg],resizeLaneBehavior:["type",xg],rootElementReferenceBehavior:["type",ip],spaceToolBehavior:["type",Eg],subProcessPlaneBehavior:["type",Ii],subProcessStartEventBehavior:["type",op],textAnnotationBehavior:["type",ap],toggleCollapseConnectionBehaviour:["type",sp],toggleElementCollapseBehaviour:["type",up],unclaimIdBehavior:["type",lp],unsetDefaultFlowBehavior:["type",pp],updateFlowNodeRefsBehavior:["type",fp],updateCategoryValueRefsBehavior:["type",dp],setCompensationActivityAfterPasteBehavior:["type",hp]};function mp(e){this._commandStack=e.get("commandStack",!1)}mp.$inject=["injector"],mp.prototype.allowed=function(e,t){var n=!0,i=this._commandStack;return i&&(n=i.canExecute(e,t)),n===void 0?!0:n};const gi={__init__:["rules"],rules:["type",mp]};function Vn(e){Q.call(this,e),this.init()}Vn.$inject=["eventBus"],pe(Vn,Q),Vn.prototype.addRule=function(e,t,n){var i=this;typeof e=="string"&&(e=[e]),e.forEach(function(r){i.canExecute(r,t,function(o,a,s){return n(o)},!0)})},Vn.prototype.init=function(){};function Lg(e,t){var n=Zt(e,t,-15);return n!=="intersect"?n:null}function Jt(e){Vn.call(this,e)}pe(Jt,Vn),Jt.$inject=["eventBus"],Jt.prototype.init=function(){this.addRule("connection.start",function(e){var t=e.source;return dP(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 oc(t,n)}finally{r&&(n.parent=null)}}),this.addRule("connection.reconnect",function(e){var t=e.connection,n=e.source,i=e.target;return oc(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 qg(t,n,i)}),this.addRule("elements.create",function(e){var t=e.elements,n=e.position,i=e.target;return at(i)&&!ac(t,i)?!1:Pr(t,function(r){return at(r)?oc(r.source,r.target,r):r.host?ha(r,r.host,null,n):bp(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 Hg(a)&&!n.includes(a.host)})?!1:ha(n,t,null,i)||Wg(n,t,i)||Ug(n,t)||ac(n,t)}),this.addRule("shape.create",function(e){return bp(e.shape,e.target,e.source,e.position)}),this.addRule("shape.attach",function(e){return ha(e.shape,e.target,null,e.position)}),this.addRule("element.copy",function(e){var t=e.element,n=e.elements;return Qg(n,t)})},Jt.prototype.canConnectMessageFlow=Xg,Jt.prototype.canConnectSequenceFlow=Zg,Jt.prototype.canConnectDataAssociation=_p,Jt.prototype.canConnectAssociation=Yg,Jt.prototype.canConnectCompensationAssociation=Kg,Jt.prototype.canMove=Ug,Jt.prototype.canAttach=ha,Jt.prototype.canReplace=Wg,Jt.prototype.canDrop=So,Jt.prototype.canInsert=ac,Jt.prototype.canCreate=bp,Jt.prototype.canConnect=oc,Jt.prototype.canResize=qg,Jt.prototype.canCopy=Qg;function dP(e){return gp(e)?null:Fe(e,["bpmn:FlowNode","bpmn:InteractionNode","bpmn:DataObjectReference","bpmn:DataStoreReference","bpmn:Group","bpmn:TextAnnotation"])}function gp(e){return!e||$e(e)}function Ig(e){do{if(v(e,"bpmn:Process"))return ee(e);if(v(e,"bpmn:Participant"))return ee(e).processRef||ee(e)}while(e=e.parent)}function yp(e){return v(e,"bpmn:TextAnnotation")}function vp(e){return v(e,"bpmn:Group")&&!e.labelTarget}function Ng(e){return v(e,"bpmn:BoundaryEvent")&&yi(e,"bpmn:CompensateEventDefinition")}function rc(e){return ee(e).isForCompensation}function hP(e,t){var n=Ig(e),i=Ig(t);return n===i}function mP(e){return v(e,"bpmn:InteractionNode")&&!v(e,"bpmn:BoundaryEvent")&&(!v(e,"bpmn:Event")||v(e,"bpmn:ThrowEvent")&&jg(e,"bpmn:MessageEventDefinition"))}function gP(e){return v(e,"bpmn:InteractionNode")&&!rc(e)&&(!v(e,"bpmn:Event")||v(e,"bpmn:CatchEvent")&&jg(e,"bpmn:MessageEventDefinition"))&&!(v(e,"bpmn:BoundaryEvent")&&!yi(e,"bpmn:MessageEventDefinition"))}function Bg(e){for(var t=e;t=t.parent;){if(v(t,"bpmn:FlowElementsContainer"))return ee(t);if(v(t,"bpmn:Participant"))return ee(t).processRef}return null}function $g(e,t){var n=Bg(e),i=Bg(t);return n===i}function yi(e,t){var n=ee(e);return!!ut(n.eventDefinitions||[],function(i){return v(i,t)})}function jg(e,t){var n=ee(e);return(n.eventDefinitions||[]).every(function(i){return v(i,t)})}function yP(e){return v(e,"bpmn:FlowNode")&&!v(e,"bpmn:EndEvent")&&!un(e)&&!(v(e,"bpmn:IntermediateThrowEvent")&&yi(e,"bpmn:LinkEventDefinition"))&&!Ng(e)&&!rc(e)}function vP(e){return v(e,"bpmn:FlowNode")&&!v(e,"bpmn:StartEvent")&&!v(e,"bpmn:BoundaryEvent")&&!un(e)&&!(v(e,"bpmn:IntermediateCatchEvent")&&yi(e,"bpmn:LinkEventDefinition"))&&!rc(e)}function bP(e){return v(e,"bpmn:ReceiveTask")||v(e,"bpmn:IntermediateCatchEvent")&&(yi(e,"bpmn:MessageEventDefinition")||yi(e,"bpmn:TimerEventDefinition")||yi(e,"bpmn:ConditionalEventDefinition")||yi(e,"bpmn:SignalEventDefinition"))}function _P(e){for(var t=[];e;)e=e.parent,e&&t.push(e);return t}function Fg(e,t){var n=_P(t);return n.indexOf(e)!==-1}function oc(e,t,n){if(gp(e)||gp(t))return null;if(!v(n,"bpmn:DataAssociation")){if(Xg(e,t))return{type:"bpmn:MessageFlow"};if(Zg(e,t))return{type:"bpmn:SequenceFlow"}}var i=_p(e,t);return i||(Kg(e,t)?{type:"bpmn:Association",associationDirection:"One"}:Yg(e,t)?{type:"bpmn:Association",associationDirection:"None"}:!1)}function So(e,t){return $e(e)||vp(e)?!0:v(t,"bpmn:Participant")&&!We(t)?!1:v(e,"bpmn:Participant")?v(t,"bpmn:Process")||v(t,"bpmn:Collaboration"):Fe(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")&&!xP(e)?!1:v(e,"bpmn:FlowElement")&&!v(e,"bpmn:DataStoreReference")?v(t,"bpmn:FlowElementsContainer")?We(t):Fe(t,["bpmn:Participant","bpmn:Lane"]):v(e,"bpmn:DataStoreReference")&&v(t,"bpmn:Collaboration")?Ui(ee(t).get("participants"),function(n){return!!n.get("processRef")}):Fe(e,["bpmn:Artifact","bpmn:DataAssociation","bpmn:DataStoreReference"])?Fe(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 xP(e){return ee(e).cancelActivity&&(zg(e)||Gg(e))}function Hg(e){return!$e(e)&&v(e,"bpmn:BoundaryEvent")}function wP(e){return v(e,"bpmn:Lane")}function EP(e){return Hg(e)||v(e,"bpmn:IntermediateThrowEvent")&&zg(e)?!0:v(e,"bpmn:IntermediateCatchEvent")&&Gg(e)}function zg(e){var t=ee(e);return t&&!(t.eventDefinitions&&t.eventDefinitions.length)}function Gg(e){return Vg(e,["bpmn:MessageEventDefinition","bpmn:TimerEventDefinition","bpmn:SignalEventDefinition","bpmn:ConditionalEventDefinition"])}function Vg(e,t){return t.some(function(n){return yi(e,n)})}function SP(e){return v(e,"bpmn:ReceiveTask")&&ut(e.incoming,function(t){return v(t.source,"bpmn:EventBasedGateway")})}function ha(e,t,n,i){if(Array.isArray(e)||(e=[e]),e.length!==1)return!1;var r=e[0];return $e(r)||!EP(r)||un(t)||!v(t,"bpmn:Activity")||rc(t)||i&&!Lg(i,t)||SP(t)?!1:"attach"}function Wg(e,t,n){if(!t)return!1;var i={replacements:[]};return D(e,function(r){un(t)||v(r,"bpmn:StartEvent")&&r.type!=="label"&&So(r,t)&&(DS(r)||i.replacements.push({oldElementId:r.id,newElementType:"bpmn:StartEvent"}),(LS(r)||IS(r)||NS(r))&&i.replacements.push({oldElementId:r.id,newElementType:"bpmn:StartEvent"}),Vg(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")||yi(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")&&ha(r,t,null,n)&&i.replacements.push({oldElementId:r.id,newElementType:"bpmn:BoundaryEvent"}))}),i.replacements.length?i:!1}function Ug(e,t){return Ui(e,wP)?!1:t===void 0?!0:t===null?!1:e.every(function(n){return So(n,t)})}function bp(e,t,n,i){return t?$e(e)||vp(e)?!0:So(e,t)||ac(e,t):!1}function qg(e,t,n){return v(e,"bpmn:SubProcess")?We(e)&&(!t||t.width>=100&&t.height>=80):v(e,"bpmn:Lane")||v(e,"bpmn:Participant")?!0:yp(e)?n?n==="e"||n==="w":!0:vp(e)?!0:$e(e)?n?n==="e"||n==="w":!0:!1}function RP(e,t){var n=yp(e),i=yp(t);return(n||i)&&n!==i}function Yg(e,t){return Fg(t,e)||Fg(e,t)?!1:RP(e,t)?!0:!!_p(e,t)}function Kg(e,t){return $g(e,t)&&Ng(e)&&v(t,"bpmn:Activity")&&!PP(t,e)&&!un(t)}function Xg(e,t){return ey(e)&&!ey(t)?!1:mP(e)&&gP(t)&&!hP(e,t)}function Zg(e,t){return yP(e)&&vP(t)&&$g(e,t)&&!(v(e,"bpmn:EventBasedGateway")&&!bP(t))}function _p(e,t){return Fe(e,["bpmn:DataObjectReference","bpmn:DataStoreReference"])&&Fe(t,["bpmn:Activity","bpmn:ThrowEvent"])?{type:"bpmn:DataInputAssociation"}:Fe(t,["bpmn:DataObjectReference","bpmn:DataStoreReference"])&&Fe(e,["bpmn:Activity","bpmn:CatchEvent"])?{type:"bpmn:DataOutputAssociation"}:!1}function ac(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:Fe(t,["bpmn:SequenceFlow","bpmn:MessageFlow"])&&!$e(t)&&v(e,"bpmn:FlowNode")&&!v(e,"bpmn:BoundaryEvent")&&So(e,t.parent)}function xp(e,t){return e&&t&&e.indexOf(t)!==-1}function Qg(e,t){return $e(t)?!0:!(v(t,"bpmn:Lane")&&!xp(e,t.parent)||v(t,"bpmn:MessageFlow")&&!CP(e,t))}function CP(e,t){var n=Jg(t.source),i=Jg(t.target);return xp(e,n)&&xp(e,i)}function Jg(e){for(;e;e=e.parent)if(v(e,"bpmn:Participant"))return e;return null}function ey(e){return yo(e,"bpmn:Process")||yo(e,"bpmn:Collaboration")}function PP(e,t){return e.attachers.includes(t)}const AP={__depends__:[gi],__init__:["bpmnRules"],bpmnRules:["type",Jt]};var TP=2e3;function ty(e,t){e.on("saveXML.start",TP,n);function n(){var i=t.getRootElements();D(i,function(r){var o=Xe(r),a,s;a=Zo([r]),a=He(a,function(c){return c!==r&&!c.labelTarget}),s=on(a,Xe),o.set("planeElement",s)})}}ty.$inject=["eventBus","canvas"];const MP={__init__:["bpmnDiOrdering"],bpmnDiOrdering:["type",ty]};function sc(e){Q.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)})}sc.prototype.getOrdering=function(e,t){return null},pe(sc,Q);function wp(e,t){sc.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 Fe(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&&!Fe(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=ed(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}}}wp.$inject=["eventBus","canvas"],pe(wp,sc);const kP={__init__:["bpmnOrderingProvider"],bpmnOrderingProvider:["type",wp]};function ma(){}ma.prototype.get=function(){return this._data},ma.prototype.set=function(e){this._data=e},ma.prototype.clear=function(){var e=this._data;return delete this._data,e},ma.prototype.isEmpty=function(){return!this._data};const OP={clipboard:["type",ma]};var ny=1500;function iy(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",ny,function(s){o(s)})}),(function(){var a,s;t.on("element.hover",function(c){a=c.gfx,s=c.element}),t.on("element.hover",ny,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),DP(c)}}iy.$inject=["elementRegistry","eventBus","injector"];function DP(e){return Or(e,"svg, .djs-element",!0)}const LP={__init__:["hoverFix"],hoverFix:["type",iy]};function IP(e){return!0}function cc(e){return sr(e)||FC(e)}var ry=500;function oy(e,t,n){var i=this;function r(T,B,k){if(!s(T,B)){var O,$,ie;k?$=t.getGraphics(k):(O=B.delegateTarget||B.target,O&&($=O,k=t.get($))),!(!$||!k)&&(ie=e.fire(T,{element:k,gfx:$,originalEvent:B}),ie===!1&&(B.stopPropagation(),B.preventDefault()))}}var o={};function a(T){return o[T]}function s(T,B){var k=u[T]||sr;return!k(B)}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":IP,"element.mousedown":cc,"element.mouseup":cc,"element.click":cc,"element.dblclick":cc};function l(T,B,k){var O=c[T];if(!O)throw new Error("unmapped DOM event name <"+T+">");return r(O,B,k)}var f="svg, .djs-element";function p(T,B,k,O){var $=o[k]=function(ie){r(k,ie)};O&&(u[k]=O),$.$delegate=Cn.bind(T,f,B,$)}function d(T,B,k){var O=a(k);O&&Cn.unbind(T,B,O.$delegate)}function h(T){D(c,function(B,k){p(T,k,B)})}function m(T){D(c,function(B,k){d(T,k,B)})}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 B=T.element,k=T.gfx;e.fire("interactionEvents.createHit",{element:B,gfx:k})}),e.on(["shape.changed","connection.changed"],ry,function(T){var B=T.element,k=T.gfx;e.fire("interactionEvents.updateHit",{element:B,gfx:k})}),e.on("interactionEvents.createHit",ry,function(T){var B=T.element,k=T.gfx;i.createDefaultHit(B,k)}),e.on("interactionEvents.updateHit",function(T){var B=T.element,k=T.gfx;i.updateDefaultHit(B,k)});var g=C("djs-hit djs-hit-stroke"),S=C("djs-hit djs-hit-click-stroke"),E=C("djs-hit djs-hit-all"),x=C("djs-hit djs-hit-no-move"),w={all:E,"click-stroke":S,stroke:g,"no-move":x};function C(T,B){return B=j({stroke:"white",strokeWidth:15},B||{}),n.cls(T,["no-fill","no-border"],B)}function P(T,B){var k=w[B];if(!k)throw new Error("invalid hit type <"+B+">");return fe(T,k),T}function L(T,B){Oe(T,B)}this.removeHits=function(T){var B=bs(".djs-hit",T);D(B,jt)},this.createDefaultHit=function(T,B){var k=T.waypoints,O=T.isFrame,$;return k?this.createWaypointsHit(B,k):($=O?"stroke":"all",this.createBoxHit(B,$,{width:T.width,height:T.height}))},this.createWaypointsHit=function(T,B){var k=Xo(B);return P(k,"stroke"),L(T,k),k},this.createBoxHit=function(T,B,k){k=j({x:0,y:0},k);var O=_e("rect");return P(O,B),fe(O,k),L(T,O),O},this.updateDefaultHit=function(T,B){var k=ot(".djs-hit",B);if(k)return T.waypoints?cl(k,T.waypoints):fe(k,{width:T.width,height:T.height}),k},this.fire=r,this.triggerMouseEvent=l,this.mouseHandler=a,this.registerEvent=p,this.unregisterEvent=d}oy.$inject=["eventBus","elementRegistry","styles"];const uc={__init__:["interactionEvents"],interactionEvents:["type",oy]};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();Ee(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?D(e,o=>{this._selectedElements.add(o)}):this._selectedElements=new Set(e),this._eventBus.fire("selection.changed",{oldSelection:n,newSelection:this.get()})};var ay="hover",sy="selected";function cy(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,ay)}),t.on("element.out",function(r){i(r.element,ay)}),t.on("selection.changed",function(r){function o(u){i(u,sy)}function a(u){n(u,sy)}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)})}cy.$inject=["canvas","eventBus"];function uy(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;Ee(u)?t.select(u):t.select(s.filter(NP))}}),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(sr(r)){var o=r.element;o===n.getRootElement()&&(o=null);var a=t.isSelected(o),s=t.get().length>1,c=nc(r);if(a&&s)return c?t.deselect(o):t.select(o);a?t.deselect(o):t.select(o,c)}})}uy.$inject=["eventBus","selection","canvas","elementRegistry"];function NP(e){return!e.hidden}const Wn={__init__:["selectionVisuals","selectionBehavior"],__depends__:[uc],selection:["type",Ro],selectionVisuals:["type",cy],selectionBehavior:["type",uy]};var BP=/^djs-cursor-.*$/;function lc(e){var t=mt(document.body);t.removeMatching(BP),e&&t.add("djs-cursor-"+e)}function ly(){lc(null)}var $P=5e3;function py(e,t){t=t||"element.click";function n(){return!1}return e.once(t,$P,n),function(){e.off(t,n)}}var jP=["c","C"],FP=["v","V"],HP=["d","D"],zP=["x","X"],GP=["y","Y"],fy=["z","Z"];function VP(e){return e.ctrlKey||e.metaKey||e.shiftKey||e.altKey}function Tn(e){return e.altKey?!1:e.ctrlKey||e.metaKey}function Ft(e,t){return e=Ee(e)?e:[e],e.indexOf(t.key)!==-1||e.indexOf(t.code)!==-1}function Ep(e){return e.shiftKey}function WP(e){return Tn(e)&&Ft(jP,e)}function UP(e){return Tn(e)&&Ft(FP,e)}function qP(e){return Tn(e)&&Ft(HP,e)}function YP(e){return Tn(e)&&Ft(zP,e)}function KP(e){return Tn(e)&&!Ep(e)&&Ft(fy,e)}function XP(e){return Tn(e)&&(Ft(GP,e)||Ft(fy,e)&&Ep(e))}var Co=Math.round,dy="djs-drag-active";function Fr(e){e.preventDefault()}function ZP(e){return typeof TouchEvent<"u"&&e instanceof TouchEvent}function QP(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}function hy(e,t,n,i){var r={threshold:5,trapClick:!0},o;function a(x){var w=t.viewbox(),C=t._container.getBoundingClientRect();return{x:w.x+(x.x-C.left)/w.scale,y:w.y+(x.y-C.top)/w.scale}}function s(x,w){w=w||o;var C=e.createEvent(j({},w.payload,w.data,{isTouch:w.isTouch}));return e.fire("drag."+x,C)===!1?!1:e.fire(w.prefix+"."+x,C)}function c(x){var w=x.filter(function(C){return i.get(C.id)});w.length&&n.select(w)}function u(x,w){var C=o.payload,P=o.displacement,L=o.globalStart,T=$r(x),B=ti(T,L),k=o.localStart,O=a(T),$=ti(O,k);if(!o.active&&(w||QP(B)>o.threshold)){if(j(C,{x:Co(k.x+P.x),y:Co(k.y+P.y),dx:0,dy:0},{originalEvent:x}),s("start")===!1)return g();o.active=!0,o.keepSelection||(C.previousSelection=n.get(),n.select(null)),o.cursor&&lc(o.cursor),t.addMarker(t.getRootElement(),dy)}np(x),o.active&&(j(C,{x:Co(O.x+P.x),y:Co(O.y+P.y),dx:Co($.x),dy:Co($.y)},{originalEvent:x}),s("move"))}function l(x){var w,C=!0;o.active&&(x&&(o.payload.originalEvent=x,np(x)),C=s("end")),C===!1&&s("rejected"),w=S(C!==!0),s("ended",w)}function f(x){Ft("Escape",x)&&(Fr(x),g())}function p(x){var w;o.active&&(w=py(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 C=o.active;C&&s("cancel"),w=S(x),C&&s("canceled",w)}}function S(x){var w,C;s("cleanup"),ly(),o.trapClick?C=p:C=l,Me.unbind(document,"mousemove",u),Me.unbind(document,"dragstart",Fr),Me.unbind(document,"selectstart",Fr),Me.unbind(document,"mousedown",C,!0),Me.unbind(document,"mouseup",C,!0),Me.unbind(document,"keyup",f),Me.unbind(document,"touchstart",d,!0),Me.unbind(document,"touchcancel",g,!0),Me.unbind(document,"touchmove",u,!0),Me.unbind(document,"touchend",l,!0),e.off("element.hover",h),e.off("element.out",m),t.removeMarker(t.getRootElement(),dy);var P=o.payload.previousSelection;return x!==!1&&P&&!n.get().length&&c(P),w=o,o=null,w}function E(x,w,C,P){o&&g(!1),typeof w=="string"&&(P=C,C=w,w=null),P=j({},r,P||{});var L=P.data||{},T,B,k,O,$;if(P.trapClick?O=p:O=l,x?(T=Eo(x)||x,B=$r(x),np(x),T.type==="dragstart"&&Fr(T)):(T=null,B={x:0,y:0}),k=a(B),w||(w=k),$=ZP(T),o=j({prefix:C,data:L,payload:{},globalStart:B,displacement:ti(w,k),localStart:k,isTouch:$},P),P.manual||($?(Me.bind(document,"touchstart",d,!0),Me.bind(document,"touchcancel",g,!0),Me.bind(document,"touchmove",u,!0),Me.bind(document,"touchend",l,!0)):(Me.bind(document,"mousemove",u),Me.bind(document,"dragstart",Fr),Me.bind(document,"selectstart",Fr),Me.bind(document,"mousedown",O,!0),Me.bind(document,"mouseup",O,!0)),Me.bind(document,"keyup",f),e.on("element.hover",h),e.on("element.out",m)),s("init")===!1)return g(),!1;P.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){j(r,x)}}hy.$inject=["eventBus","canvas","selection","elementRegistry"];const Ni={__depends__:[LP,Wn],dragging:["type",hy]};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 JP=new Po("ps");var eA=["marker-start","marker-mid","marker-end"],tA=["circle","ellipse","line","path","polygon","polyline","path","rect"];function cr(e,t,n,i){this._elementRegistry=e,this._canvas=n,this._styles=i}cr.$inject=["elementRegistry","eventBus","canvas","styles"],cr.prototype.cleanUp=function(){console.warn("PreviewSupport#cleanUp is deprecated and will be removed in future versions. You do not need to manually clean up previews anymore. cf. https://github.com/bpmn-io/diagram-js/pull/906")},cr.prototype.getGfx=function(e){return this._elementRegistry.getGraphics(e)},cr.prototype.addDragger=function(e,t,n,i="djs-dragger"){n=n||this.getGfx(e);var r=Ph(n);return this._cloneMarkers(Ir(r),i),fe(r,this._styles.cls(i,[])),Oe(t,r),fe(r,"data-preview-support-element-id",e.id),r},cr.prototype.addFrame=function(e,t){var n=_e("rect",{class:"djs-resize-overlay",width:e.width,height:e.height,x:e.x,y:e.y});return Oe(t,n),fe(n,"data-preview-support-element-id",e.id),n},cr.prototype._cloneMarkers=function(e,t="djs-dragger",n=e){var i=this;e.childNodes&&e.childNodes.forEach(r=>{i._cloneMarkers(r,t,n)}),oA(e)&&eA.forEach(function(r){if(fe(e,r)){var o=nA(e,r,i._canvas.getContainer());o&&i._cloneMarker(n,e,o,r,t)}})},cr.prototype._cloneMarker=function(e,t,n,i,r="djs-dragger"){var o=[n.id,r,JP.next()].join("-"),a=ot("marker#"+n.id,e);e=e||this._canvas._svg;var s=a||Ph(n);s.id=o,qe(s).add(r);var c=ot(":scope > defs",e);c||(c=_e("defs"),Oe(e,c)),Oe(c,s);var u=rA(s.id);fe(t,i,u)};function nA(e,t,n){var i=iA(fe(e,t));return ot("marker#"+i,n||document)}function iA(e){return e.match(/url\(['"]?#([^'"]*)['"]?\)/)[1]}function rA(e){return"url(#"+e+")"}function oA(e){return tA.indexOf(e.nodeName)!==-1}const Ao={__init__:["previewSupport"],previewSupport:["type",cr]};var aA="drop-ok",my="drop-not-ok",gy="attach-ok",yy="new-parent",vy="create",sA=2e3;function by(e,t,n,i,r){function o(c,u,l,f,p){if(!u)return!1;c=He(c,function(E){var x=E.labelTarget;return!E.parent&&!($e(E)&&c.indexOf(x)!==-1)});var d=ut(c,function(E){return!at(E)}),h=!1,m=!1,g=!1;xy(c)&&(h=r.allowed("shape.attach",{position:l,shape:d,target:u})),h||(xy(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 S=p.connectionTarget;return g||h?(d&&f&&(m=r.allowed("connection.create",{source:S===f?d:f,target:S===f?f:d,hints:{targetParent:u,targetAttach:h}})),{attach:h,connect:m}):g===null||h===null?null:!1}function a(c,u){[gy,aA,my,yy].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}_y(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,gy):a(f,m?yy:my))}),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,S=u.hints||{};if(h===!1||!d)return!1;_y(c);var E={x:c.x,y:c.y};g?f=i.appendShape(l,f,E,d,{attach:m,connection:g===!0?{}:g,connectionTarget:S.connectionTarget}):(p=i.createElements(p,E,d,j({},S,{attach:m})),f=ut(p,function(x){return!at(x)})),j(u,{elements:p,shape:f}),j(c,{elements:p,shape:f})});function s(){var c=t.context();c&&c.prefix===vy&&t.cancel()}n.on("create.init",function(){n.on("elements.changed",s),n.once(["create.cancel","create.end"],sA,function(){n.off("elements.changed",s)})}),this.start=function(c,u,l){Ee(u)||(u=[u]);var f=ut(u,function(h){return!at(h)});if(f){l=j({elements:u,hints:{},shape:f},l||{}),D(u,function(h){Pe(h.x)||(h.x=0),Pe(h.y)||(h.y=0)});var p=He(u,function(h){return!h.hidden}),d=Mt(p);D(u,function(h){at(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}})),j(h,{x:h.x-d.x-d.width/2,y:h.y-d.y-d.height/2})}),t.init(c,vy,{cursor:"grabbing",autoActivate:!0,data:{shape:f,elements:u,context:l}})}}}by.$inject=["canvas","dragging","eventBus","modeling","rules"];function _y(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 xy(e){return e&&e.length===1&&!at(e[0])}var cA=750;function wy(e,t,n,i,r){function o(a){var s=_e("g");fe(s,r.cls("djs-drag-group",["no-events"]));var c=_e("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),Qt(l,u.x,u.y)),i.addDragger(u,s,l))}),s}t.on("create.move",cA,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(),Oe(f,l)),Qt(l,a.x,a.y)):jt(l)}),t.on("create.cleanup",function(a){var s=a.context,c=s.dragGroup;c&&jt(c)})}wy.$inject=["canvas","eventBus","graphicsFactory","previewSupport","styles"];const pc={__depends__:[Ni,Ao,gi,Wn],__init__:["create","createPreview"],create:["type",by],createPreview:["type",wy]};function Sp(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)})}Sp.$inject=["eventBus"],Sp.prototype.getLastMoveEvent=function(){return this._lastMoveEvent||uA(0,0)};function uA(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 ga={__init__:["mouse"],mouse:["type",Sp]};var Ey=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),lA(l)&&(u.priority=2,u.host=l.host.id),at(l)&&(u.priority=3,u.source=l.source.id,u.target=l.target.id,u.waypoints=pA(l)),$e(l)&&(u.priority=4,u.labelTarget=l.labelTarget.id),D(["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",Ey,function(c){var u;((u=c.hints)==null?void 0:u.clip)!==!1&&n.set(c.tree)}),r.on("copyPaste.pasteElements",Ey,function(c){c.tree||(c.tree=n.get())}),r.on("copyPaste.pasteElements",function(c){var u=c.hints;j(u,{createElementsBehavior:!1})})}Mn.$inject=["canvas","create","clipboard","elementFactory","eventBus","modeling","mouse","rules"],Mn.prototype.copy=function(e,t={}){var n,i;return Ee(e)||(e=e?[e]:[]),n=this._eventBus.fire("copyPaste.canCopyElements",{elements:e}),n===!1?i={}:i=this.createTree(Ee(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 D(e,function(n){D(n,function(i){i.id&&(t[i.id]=!0)})}),t},Mn.prototype._paste=function(e,t,n,i){D(e,function(o){Pe(o.x)||(o.x=0),Pe(o.y)||(o.y=0)});var r=Mt(e);return D(e,function(o){at(o)&&(o.waypoints=on(o.waypoints,function(a){return{x:a.x-r.x-r.width/2,y:a.y-r.y-r.height/2}})),j(o,{x:o.x-r.x-r.width/2,y:o.y-r.y-r.height/2})}),this._modeling.createElements(e,n,t,j({},i))},Mn.prototype._createElements=function(e){var t=this,n=this._eventBus,i={},r=[];return D(e,function(o,a){o=ri(o,"priority"),D(o,function(s){var c=j({},oi(s,["priority"]));i[s.parent]?c.parent=i[s.parent]:delete c.parent,n.fire("copyPaste.pasteElement",{cache:i,descriptor:c});var u;if(at(c)){c.source=i[s.source],c.target=i[s.target],u=i[s.id]=t.createConnection(c),r.push(u);return}if($e(c)){c.labelTarget=i[c.labelTarget],u=i[s.id]=t.createLabel(c),r.push(u);return}c.host&&(c.host=i[c.host]),u=i[s.id]=t.createShape(c),r.push(u)})}),r},Mn.prototype.createConnection=function(e){var t=this._elementFactory.createConnection(oi(e,["id"]));return t},Mn.prototype.createLabel=function(e){var t=this._elementFactory.createLabel(oi(e,["id"]));return t},Mn.prototype.createShape=function(e){var t=this._elementFactory.createShape(oi(e,["id"]));return t},Mn.prototype.hasRelations=function(e,t,n){return n||(n=new Set(t)),!(at(e)&&(!n.has(e.source)||!n.has(e.target))||$e(e)&&!n.has(e.labelTarget))},Mn.prototype.createTree=function(e){var t=this._rules,n=this,i={},r=[],o=new Map,a=Es(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($e(f))return;D(f.labels,function(g){c(g,d)});function h(g){g&&g.length&&D(g,function(S){D(S.labels,function(E){c(E,d)}),c(S,d)})}D([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=ri(r,function(f){return f.descriptor.priority}),e=on(r,function(f){return f.element}),D(r,function(f){var p=f.depth;if(!n.hasRelations(f.element,e,l)){Ry(f.element,e),l.delete(f.element);return}if(!s(f.element,e)){Ry(f.element,e),l.delete(f.element);return}i[p]||(i[p]=[]),i[p].push(f.descriptor)}),i};function lA(e){return!!e.host}function pA(e){return on(e.waypoints,function(t){return t=Sy(t),t.original&&(t.original=Sy(t.original)),t})}function Sy(e){return j({},e)}function Ry(e,t){var n=t.indexOf(e);return n===-1?t:t.splice(n,1)}const fA={__depends__:[OP,pc,ga,gi],__init__:["copyPaste"],copyPaste:["type",Mn]};function Rp(e,t,n){Ee(n)||(n=[n]),D(n,function(i){Cr(e[i])||(t[i]=e[i])})}var Cp=750;function Cy(e,t,n){function i(c,u){var l=e.create(c.$type);return n.copyElement(c,l,null,u)}t.on("copyPaste.copyElement",Cp,function(c){var u=c.descriptor,l=c.element,f=ee(l);if($e(l))return u;var p=u.businessObject=i(f,!0),d=u.di=i(Xe(l),!0);d.bpmnElement=p,Rp(p,u,"name"),Rp(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=ee(c);return c.default&&(l[c.default]={element:f,property:"default"}),c.host&&(ee(c).attachedToRef=ee(u[c.host])),oi(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($e(l)){l.businessObject=ee(u[l.labelTarget]),l.di=Xe(u[l.labelTarget]);return}f=l.businessObject=i(f),p=l.di=i(p),p.bpmnElement=f,Rp(l,f,["isExpanded","name"]),l.type=f.$type}),t.on("copyPaste.copyElement",Cp,function(c){var u=c.descriptor,l=c.element;if(v(l,"bpmn:Participant")){var f=ee(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")&&D(ia(l),f=>{l.push(f.annotation)})}),t.on("copyPaste.pasteElement",Cp,function(c){var u=c.cache,l=c.descriptor;a(u,s(l,u,o(u)))})}Cy.$inject=["bpmnFactory","eventBus","moddleCopy"];const dA=["artifacts","dataInputAssociations","dataOutputAssociations","default","flowElements","lanes","incoming","outgoing","categoryValue"],hA=["errorRef","escalationRef","messageRef","signalRef","dataObjectRef"];function ya(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 ri(r,o=>o==="extensionElements")}),e.on("moddleCopy.canCopyProperty",i=>{const{parent:r,property:o,propertyName:a}=i,s=Vt(r)&&r.$descriptor;if(a&&hA.includes(a))return o;if(a&&dA.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})}ya.$inject=["eventBus","bpmnFactory","moddle"],ya.prototype.copyElement=function(e,t,n,i=!1){n&&!Ee(n)&&(n=[n]),n=n||Pp(e.$descriptor);const r=this._eventBus.fire("moddleCopy.canCopyProperties",{propertyNames:n,sourceElement:e,targetElement:t,clone:i});return r===!1||(Ee(r)&&(n=r),D(n,o=>{let a;En(e,o)&&(a=e.get(o));const s=this.copyProperty(a,t,o,i);!Bt(s)||this._eventBus.fire("moddleCopy.canSetCopiedProperty",{parent:t,property:s,propertyName:o})===!1||t.set(o,s)})),t},ya.prototype.copyProperty=function(e,t,n,i=!1){let r=this._eventBus.fire("moddleCopy.canCopyProperty",{parent:t,property:e,propertyName:n,clone:i});if(r===!1)return;if(r)return Vt(r)&&r.$type&&!r.$parent&&(r.$parent=t),r;const o=this._moddle.getPropertyDescriptor(t,n);if(!o.isReference)return o.isId?e&&this._copyId(e,t,i):Ee(e)?Sn(e,(a,s)=>{const c=this.copyProperty(s,t,n,i);return c?a.concat(c):a},[]):Vt(e)&&e.$type?this._moddle.getElementDescriptor(e).isGeneric?void 0:(r=this._bpmnFactory.create(e.$type),r.$parent=t,r=this.copyElement(e,r,null,i),r):e},ya.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 Pp(e,t){return Sn(e.properties,(n,i)=>t&&i.default?n:n.concat(i.name),[])}const Py={__depends__:[fA],__init__:["bpmnCopyPaste","moddleCopy"],bpmnCopyPaste:["type",Cy],moddleCopy:["type",ya]};var Ay=Math.round;function Ap(e,t){this._modeling=e,this._eventBus=t}Ap.$inject=["modeling","eventBus"],Ap.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=Ay(s+o/2),l=Ay(c+a/2),f=i.replaceShape(e,j({},t,{x:u,y:l,width:o,height:a}),n);return r.fire("replace.end",{element:e,newElement:f,hints:n}),f};function Ty(e,t){t.on("replace.end",500,function(n){const{newElement:i,hints:r={}}=n;r.select!==!1&&e.select(i)})}Ty.$inject=["selection","eventBus"];const mA={__init__:["replace","replaceSelectionBehavior"],replaceSelectionBehavior:["type",Ty],replace:["type",Ap]};function gA(e,t,n){Ee(n)||(n=[n]),D(n,function(i){Cr(e[i])||(t[i]=e[i])})}var yA=["cancelActivity","instantiate","eventGatewayType","triggeredByEvent","isInterrupting"];function vA(e,t){var n=e&&En(e,"collapsed")?e.collapsed:!We(e),i;return t&&(En(t,"collapsed")||En(t,"isExpanded"))?i=En(t,"collapsed")?t.collapsed:!t.isExpanded:i=n,n!==i}function My(e,t,n,i,r,o){function a(s,c,u){u=u||{};var l=c.type,f=s.businessObject;if(fc(f)&&(l==="bpmn:SubProcess"||l==="bpmn:AdHocSubProcess")&&vA(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),gA(s.di,d.di,["fill","stroke","background-color","border-color","color"]);var h=Pp(f.$descriptor),m=Pp(p.$descriptor,!0),g=bA(h,m);j(p,ei(c,yA));var S=He(g,function(w){return w==="eventDefinitions"?ky(s,c.eventDefinitionType):w==="loopCharacteristics"?!un(p):En(p,w)||w==="processRef"&&c.isExpanded===!1||w==="triggeredByEvent"?!1:w==="isForCompensation"?!un(p):!0});if(p=n.copyElement(f,p,S),c.eventDefinitionType&&(ky(p,c.eventDefinitionType)||(d.eventDefinitionType=c.eventDefinitionType,d.eventDefinitionAttrs=c.eventDefinitionAttrs)),v(f,"bpmn:Activity")){if(fc(f))d.isExpanded=We(s);else if(c&&En(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}We(s)&&!v(f,"bpmn:Task")&&d.isExpanded&&(d.width=s.width,d.height=s.height)}if(fc(f)&&!fc(p)&&(u.moveChildren=!1),v(f,"bpmn:Participant")){c.isExpanded===!0?p.processRef=e.create("bpmn:Process"):u.moveChildren=!1;var x=Ut(s);Xe(s).isHorizontal||(Xe(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,Fe(f,["bpmn:ExclusiveGateway","bpmn:InclusiveGateway","bpmn:Activity"])&&Fe(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}My.$inject=["bpmnFactory","elementFactory","moddleCopy","modeling","replace","rules"];function fc(e){return v(e,"bpmn:SubProcess")}function ky(e,t){var n=ee(e);return t&&n.get("eventDefinitions").some(function(i){return v(i,t)})}function bA(e,t){return e.filter(function(n){return t.includes(n)})}const Oy={__depends__:[Py,mA,Wn],bpmnReplace:["type",My]};var _A=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),D(t,function(r){i.push(r+".ended"),i.push(r+".canceled")}),n.on(i,_A,function(r){this._active&&(xA(r)||this.setActive(null))},this)};function xA(e){var t=e.originalEvent&&e.originalEvent.target;return t&&Or(t,'.group[data-group="tools"]')}const dc={__depends__:[Ni],__init__:["toolManager"],toolManager:["type",Hr]};function wA(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 EA(e,t){var n=[],i=new Set(e);D(t,function(o){i.add(o)});var r=new Set;return i.forEach(function(o){var a=o.incoming,s=o.outgoing;D(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 SA(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 Tp=Math.abs,RA=Math.round,Bi={x:"width",y:"height"},Dy="crosshair",ur={n:"top",w:"left",s:"bottom",e:"right"},CA=1500,hc={n:"s",w:"e",s:"n",e:"w"},mc=20;function Un(e,t,n,i,r,o,a){this._canvas=e,this._dragging=t,this._eventBus=n,this._modeling=i,this._rules=r,this._toolManager=o,this._mouse=a;var s=this;o.registerTool("space",{tool:"spaceTool.selection",dragging:"spaceTool"}),n.on("spaceTool.selection.end",function(c){n.once("spaceTool.selection.ended",function(){s.activateMakeSpace(c.originalEvent)})}),n.on("spaceTool.move",CA,function(c){var u=c.context,l=u.initialized;l||(l=u.initialized=s.init(c,u)),l&&Iy(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){Iy(c);var m={x:0,y:0};m[l]=RA(c["d"+l]),s.makeSpace(p,d,m,f,h),n.once("spaceTool.ended",function(g){s.activateSelection(g.originalEvent,!0,!0)})}})}Un.$inject=["canvas","dragging","eventBus","modeling","rules","toolManager","mouse"],Un.prototype.activateSelection=function(e,t,n){this._dragging.init(e,"spaceTool.selection",{autoActivate:t,cursor:Dy,data:{context:{reactivate:n}},trapClick:!1})},Un.prototype.activateMakeSpace=function(e){this._dragging.init(e,"spaceTool",{autoActivate:!0,cursor:Dy,data:{context:{}}})},Un.prototype.makeSpace=function(e,t,n,i,r){return this._modeling.createSpace(e,t,n,i,r)},Un.prototype.init=function(e,t){var n=Tp(e.dx)>Tp(e.dy)?"x":"y",i=e["d"+n],r=e[n]-i;if(Tp(i)<5)return!1;i<0&&(i*=-1),da(e)&&(i*=-1);var o=wA(n,i),a=this._canvas.getRootElement();!nc(e)&&e.hover&&(a=e.hover);var s=[...Zo(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 j(t,c,{axis:n,direction:o,spaceToolConstraints:l,start:r}),lc("resize-"+(n==="x"?"ew":"ns")),!0},Un.prototype.calculateAdjustments=function(e,t,n,i){var r=this._rules,o=[],a=[],s=new Set,c=new Set,u=[],l=[];function 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 D(e,function(d){if(!(!d.parent||$e(d))){if(at(d)){l.push(d);return}var h=d[t],m=h+d[Bi[t]];if(AA(d)&&(n>0&&Se(d)[t]>i||n<0&&Se(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}}}),D(o,function(d){var h=d.attachers;h&&D(h,function(m){f(m)})}),D(u,function(d){var h=d.host;(s.has(h)||c.has(h))&&f(d)}),D(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}},Un.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateSelection(e,!!e)},Un.prototype.isActive=function(){var e=this._dragging.context();return e?/^spaceTool/.test(e.prefix):!1};function Ly(e){return{top:e.top-mc,right:e.right+mc,bottom:e.bottom+mc,left:e.left-mc}}function Iy(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 D(a,function(p){var d=p.attachers,h=p.children,m=xe(p),g=He(h,function($){return!at($)&&!$e($)&&!l.has($)&&!f.has($)}),S=He(h,function($){return!at($)&&!$e($)&&l.has($)}),E,x,w,C=[],P=[],L,T,B,k;g.length&&(x=Ly(xe(Mt(g))),E=i-m[ur[n]]+x[ur[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)),S.length&&(w=Ly(xe(Mt(S))),E=i-w[ur[hc[n]]]+m[ur[hc[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($){l.has($)?C.push($):P.push($)}),C.length&&(L=xe(Mt(C.map(Se))),T=m[ur[hc[n]]]-(L[ur[hc[n]]]-i)),P.length&&(B=xe(Mt(P.map(Se))),k=B[ur[n]]-(m[ur[n]]-i)),n==="n"?(E=Math.min(T||1/0,k||1/0),s.bottom=u=Pe(u)?Math.min(u,E):E):n==="w"?(E=Math.min(T||1/0,k||1/0),s.right=u=Pe(u)?Math.min(u,E):E):n==="s"?(E=Math.max(T||-1/0,k||-1/0),s.top=c=Pe(c)?Math.max(c,E):E):n==="e"&&(E=Math.max(T||-1/0,k||-1/0),s.left=c=Pe(c)?Math.max(c,E):E));var O=r&&r[p.id];O&&(n==="n"?(E=i+p[Bi[t]]-O[Bi[t]],s.bottom=u=Pe(u)?Math.min(u,E):E):n==="w"?(E=i+p[Bi[t]]-O[Bi[t]],s.right=u=Pe(u)?Math.min(u,E):E):n==="s"?(E=i-p[Bi[t]]+O[Bi[t]],s.top=c=Pe(c)?Math.max(c,E):E):n==="e"&&(E=i-p[Bi[t]]+O[Bi[t]],s.left=c=Pe(c)?Math.max(c,E):E))}),s}}function AA(e){return!!e.host}var Mp="djs-dragging",Ny="djs-resizing",TA=250,gc=Math.max;function By(e,t,n,i,r){function o(a,s){D(a,function(c){r.addDragger(c,s),n.addMarker(c,Mp)})}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=_e("g");fe(l,i.cls("djs-crosshair-group",["no-events"])),Oe(s,l);var f=_e("path");fe(f,"d",u.x),qe(f).add("djs-crosshair"),Oe(l,f);var p=_e("path");fe(p,"d",u.y),qe(p).add("djs-crosshair"),Oe(l,p),c.crosshairGroup=l}),e.on("spaceTool.selection.move",function(a){var s=a.context.crosshairGroup;Qt(s,a.x,a.y)}),e.on("spaceTool.selection.cleanup",function(a){var s=a.context,c=s.crosshairGroup;c&&jt(c)}),e.on("spaceTool.move",TA,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=_e("path"),fe(c,"d","M0,0 L0,0"),qe(c).add("djs-crosshair"),Oe(p,c),s.line=c;var d=_e("g");fe(d,i.cls("djs-drag-group",["no-events"])),Oe(n.getActiveLayer(),d),o(l,d);var h=new Set(l);D(f,function(P){h.add(P)});var m=new Set,g=s.movingConnections=[];h.forEach(function(P){D(P.outgoing,function(L){m.has(L)||!at(L)||!h.has(L.target)||(m.add(L),g.push(L))})}),o(g,d),s.dragGroup=d}if(!s.frameGroup){var S=_e("g");fe(S,i.cls("djs-frame-group",["no-events"])),Oe(n.getActiveLayer(),S);var E=[];D(f,function(P){var L=r.addFrame(P,S),T=L.getBBox();E.push({element:L,initialBounds:T}),n.addMarker(P,Ny)}),s.frameGroup=S,s.frames=E}var x={x:"M"+a.x+", -10000 L"+a.x+", 10000",y:"M -10000, "+a.y+" L 10000, "+a.y};fe(c,{d:x[u]});var w={x:"y",y:"x"},C={x:a.dx,y:a.dy};C[w[s.axis]]=0,Qt(s.dragGroup,C.x,C.y),D(s.frames,function(P){var L=P.element,T=P.initialBounds,B,k;s.direction==="e"?fe(L,{width:gc(T.width+C.x,5)}):(B=gc(T.width-C.x,5),fe(L,{width:B,x:T.x+T.width-B})),s.direction==="s"?fe(L,{height:gc(T.height+C.y,5)}):(k=gc(T.height-C.y,5),fe(L,{height:k,y:T.y+T.height-k}))})}}),e.on("spaceTool.cleanup",function(a){var s=a.context,c=s.movingShapes,u=s.movingConnections,l=s.resizingShapes,f=s.line,p=s.dragGroup,d=s.frameGroup;D(c,function(h){n.removeMarker(h,Mp)}),D(u,function(h){n.removeMarker(h,Mp)}),p&&(jt(f),jt(p)),D(l,function(h){n.removeMarker(h,Ny)}),d&&jt(d)})}By.$inject=["eventBus","elementRegistry","canvas","styles","previewSupport"];const MA={__init__:["spaceToolPreview"],__depends__:[Ni,gi,dc,Ao,ga],spaceTool:["type",Un],spaceToolPreview:["type",By]};function yc(e,t){e.invoke(Un,this),this._canvas=t}yc.$inject=["injector","canvas"],pe(yc,Un),yc.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=Un.prototype.calculateAdjustments.call(this,s,t,n,i);return c.resizingShapes=c.resizingShapes.filter(function(u){return!(v(u,"bpmn:TextAnnotation")||kA(u)&&(t==="y"&&Ut(u)||t==="x"&&!Ut(u)))}),c};function kA(e){return v(e,"bpmn:Participant")&&!ee(e).processRef}const $y={__depends__:[MA],spaceTool:["type",yc]};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:td("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=Ee(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 OA={commandStack:["type",vt]};function lr(e,t){if(typeof t!="function")throw new Error("removeFn iterator must be a function");if(!e)return[];for(var n;n=e[0];)t(n);return e}var DA=250,jy=1400;function kp(e,t,n){Q.call(this,t);var i=e.get("movePreview",!1);t.on("shape.move.start",jy,function(r){var o=r.context,a=o.shapes,s=o.validatedShapes;o.shapes=Fy(a),o.validatedShapes=Fy(s)}),i&&t.on("shape.move.start",DA,function(r){var o=r.context,a=new Set(o.shapes),s=new Set;for(const c of a)for(const u of c.labels)!u.hidden&&!a.has(u)&&s.add(u),c.labelTarget&&s.add(c);for(const c of s)i.makeDraggable(o,c,!0)}),this.preExecuted("elements.move",jy,function(r){var o=r.context,a=o.closure,s=a.enclosedElements,c=[];D(s,function(u){D(u.labels,function(l){s[l.id]||c.push(l)})}),a.addAll(c)}),this.preExecute(["connection.delete","shape.delete"],function(r){var o=r.context,a=o.connection||o.shape;lr(a.labels,function(s){n.removeShape(s,{nested:!0})})}),this.execute("shape.delete",function(r){var o=r.context,a=o.shape,s=a.labelTarget;s&&(o.labelTargetIndex=ll(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&&(St(s.labels,a,c),a.labelTarget=s)})}pe(kp,Q),kp.$inject=["injector","eventBus","modeling"];function Fy(e){var t=new Set(e);return He(e,function(n){return!t.has(n.labelTarget)})}const LA={__init__:["labelSupport"],labelSupport:["type",kp]};var IA=251,Hy=1401,zy="attach-ok";function Op(e,t,n,i,r){Q.call(this,t);var o=e.get("movePreview",!1);t.on("shape.move.start",Hy,function(a){var s=a.context,c=s.shapes,u=s.validatedShapes;s.shapes=NA(c),s.validatedShapes=BA(u)}),o&&t.on("shape.move.start",IA,function(a){var s=a.context,c=s.shapes,u=Dp(c);D(u,function(l){o.makeDraggable(s,l,!0),D(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,zy),t.once(["shape.move.out","shape.move.cleanup"],function(){n.removeMarker(l,zy)}))}}),this.preExecuted("elements.move",Hy,function(a){var s=a.context,c=s.closure,u=s.shapes,l=Dp(u);D(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=He(c,function(f){var p=f.host;return $A(f)&&!jA(c,p)}),D(l,function(f){r.updateAttachment(f,u)}))}),this.postExecuted("elements.move",function(a){var s=a.context.shapes;D(s,function(c){D(c.attachers,function(u){D(u.outgoing.slice(),function(l){var f=i.allowed("connection.reconnect",{connection:l,source:l.source,target:l.target});f||r.removeConnection(l)}),D(u.incoming.slice(),function(l){var f=i.allowed("connection.reconnect",{connection:l,source:l.source,target:l.target});f||r.removeConnection(l)})})})}),this.postExecute("shape.create",function(a){var s=a.context,c=s.shape,u=s.host;u&&r.updateAttachment(c,u)}),this.postExecute("shape.replace",function(a){var s=a.context,c=s.oldShape,u=s.newShape;lr(c.attachers,function(l){var f=i.allowed("elements.move",{target:u,shapes:[l]});f==="attach"?r.updateAttachment(l,u):r.removeShape(l)}),u.attachers.length&&D(u.attachers,function(l){var f=ag(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&&D(f,function(d){var h=ag(d,u,l);r.moveShape(d,h,d.parent),D(d.labels,function(m){r.moveShape(m,h,m.parent)})})}),this.preExecute("shape.delete",function(a){var s=a.context.shape;lr(s.attachers,function(c){r.removeShape(c)}),s.host&&r.updateAttachment(s,null)})}pe(Op,Q),Op.$inject=["injector","eventBus","canvas","rules","modeling"];function Dp(e){return Pu(on(e,function(t){return t.attachers||[]}))}function NA(e){var t=Dp(e);return w0("id",e,t)}function BA(e){var t=to(e,"id");return He(e,function(n){for(;n;){if(n.host&&t[n.host.id])return!1;n=n.parent}return!0})}function $A(e){return!!e.host}function jA(e,t){return e.indexOf(t)!==-1}const FA={__depends__:[gi],__init__:["attachSupport"],attachSupport:["type",Op]};function Gy(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(Ih(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)})}Gy.$inject=["eventBus","canvas","elementRegistry","graphicsFactory"];const Lp={__init__:["changeSupport"],changeSupport:["type",Gy]};function qn(e){this._model=e}qn.$inject=["moddle"],qn.prototype._needsId=function(e){return Fe(e,["bpmn:RootElement","bpmn:FlowElement","bpmn:MessageFlow","bpmn:DataAssociation","bpmn:Artifact","bpmn:Participant","bpmn:Lane","bpmn:LaneSet","bpmn:Process","bpmn:Collaboration","bpmndi:BPMNShape","bpmndi:BPMNEdge","bpmndi:BPMNDiagram","bpmndi:BPMNPlane","bpmn:Property","bpmn:CategoryValue"])},qn.prototype._ensureId=function(e){if(e.id){this._model.ids.claim(e.id,e);return}var t;v(e,"bpmn:Activity")?t="Activity":v(e,"bpmn:Event")?t="Event":v(e,"bpmn:Gateway")?t="Gateway":Fe(e,["bpmn:SequenceFlow","bpmn:MessageFlow"])?t="Flow":t=(e.$type||"").replace(/^[^:]*:/g,""),t+="_",!e.id&&this._needsId(e)&&(e.id=this._model.ids.nextPrefixed(t,e))},qn.prototype.create=function(e,t){var n=this._model.create(e,t||{});return this._ensureId(n),n},qn.prototype.createDiLabel=function(){return this.create("bpmndi:BPMNLabel",{bounds:this.createDiBounds()})},qn.prototype.createDiShape=function(e,t){return this.create("bpmndi:BPMNShape",j({bpmnElement:e,bounds:this.createDiBounds()},t))},qn.prototype.createDiBounds=function(e){return this.create("dc:Bounds",e)},qn.prototype.createDiWaypoints=function(e){var t=this;return on(e,function(n){return t.createDiWaypoint(n)})},qn.prototype.createDiWaypoint=function(e){return this.create("dc:Point",ei(e,["x","y"]))},qn.prototype.createDiEdge=function(e,t){return this.create("bpmndi:BPMNEdge",j({bpmnElement:e,waypoint:this.createDiWaypoints([])},t))},qn.prototype.createDiPlane=function(e,t){return this.create("bpmndi:BPMNPlane",j({bpmnElement:e},t))};function kn(e,t,n){Q.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"],On(o)),this.reverted(["shape.move","shape.create","shape.delete","connection.create","connection.move","connection.delete"],On(a));function s(d){var h=d.context,m=h.oldRoot,g=m.children;D(g,function(S){v(S,"bpmn:BaseElement")&&i.updateParent(S)})}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"],On(function(d){d.context.shape.type!=="label"&&c(d)})),this.reverted(["shape.move","shape.create","shape.resize"],On(function(d){d.context.shape.type!=="label"&&c(d)})),e.on("shape.changed",function(d){d.element.type==="label"&&c({context:{shape:d.element}})});function u(d){i.updateConnection(d.context)}this.executed(["connection.create","connection.move","connection.delete","connection.reconnect"],On(u)),this.reverted(["connection.create","connection.move","connection.delete","connection.reconnect"],On(u));function l(d){i.updateConnectionWaypoints(d.context.connection)}this.executed(["connection.layout","connection.move","connection.updateWaypoints"],On(l)),this.reverted(["connection.layout","connection.move","connection.updateWaypoints"],On(l)),this.executed("connection.reconnect",On(function(d){var h=d.context,m=h.connection,g=h.oldSource,S=h.newSource,E=ee(m),x=ee(g),w=ee(S);E.conditionExpression&&!Fe(w,["bpmn:Activity","bpmn:ExclusiveGateway","bpmn:InclusiveGateway"])&&(h.oldConditionExpression=E.conditionExpression,delete E.conditionExpression),g!==S&&x.default===E&&(h.oldDefault=x.default,delete x.default)})),this.reverted("connection.reconnect",On(function(d){var h=d.context,m=h.connection,g=h.oldSource,S=h.newSource,E=ee(m),x=ee(g),w=ee(S);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"],On(f)),this.reverted(["element.updateAttachment"],On(f)),this.executed("element.updateLabel",On(p)),this.reverted("element.updateLabel",On(p));function p(d){const{element:h}=d.context,m=Bn(h),g=Xe(h),S=g&&g.get("label");ir(h)||ic(h)||(m&&!S?g.set("label",t.create("bpmndi:BPMNLabel")):!m&&S&&g.set("label",void 0))}}pe(kn,Q),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(!$e(e)&&!(v(e,"bpmn:DataStoreReference")&&e.parent&&v(e.parent,"bpmn:Collaboration"))){var n=e.parent,i=e.businessObject,r=Xe(e),o=n&&n.businessObject,a=Xe(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=Xe(e),n=zA(e);if(n){var i=ti(n,t.get("bounds"));j(n,{x:e.x+i.x,y:e.y+i.y})}var r=$e(e)?this._getLabel(t):t,o=r.bounds;o||(o=this._bpmnFactory.createDiBounds(),r.set("bounds",o)),j(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"),wt(i,e)),v(t,"bpmn:Lane")&&(r=t.get("flowNodeRef"),St(r,e))}},kn.prototype.updateDiConnection=function(e,t,n){var i=Xe(e),r=Xe(t),o=Xe(n);i.sourceElement&&i.sourceElement.bpmnElement!==ee(t)&&(i.sourceElement=t&&r),i.targetElement&&i.targetElement.bpmnElement!==ee(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):(wt(n,e),e.$parent=null)}};function HA(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=HA(e.$parent||t),e.$parent&&(wt(o.get("rootElements"),r),r.$parent=null),t&&(St(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),wt(a,e)),t?(a=t.get(i),a.push(e),e.$parent=t):e.$parent=null,n){var s=n.get(i);wt(a,e),t&&(s||(s=[],t.set(i,s)),s.push(e))}}},kn.prototype.updateConnectionWaypoints=function(e){var t=Xe(e);t.set("waypoint",this._bpmnFactory.createDiWaypoints(e.waypoints))},kn.prototype.updateConnection=function(e){var t=e.connection,n=ee(t),i=t.source,r=ee(i),o=t.target,a=ee(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&&(wt(n.sourceRef&&n.sourceRef.get("outgoing"),n),r&&r.get("outgoing")&&r.get("outgoing").push(n)),n.sourceRef=r),n.targetRef!==a&&(c&&(wt(n.targetRef&&n.targetRef.get("incoming"),n),a&&a.get("incoming")&&a.get("incoming").push(n)),n.targetRef=a)}this.updateConnectionWaypoints(t),this.updateDiConnection(t,i,o)},kn.prototype._getLabel=function(e){return e.label||(e.label=this._bpmnFactory.createDiLabel()),e.label};function On(e){return function(t){var n=t.context,i=n.shape||n.connection||n.element;v(i,"bpmn:BaseElement")&&e(t)}}function zA(e){if(v(e,"bpmn:Activity")){var t=Xe(e);if(t){var n=t.get("label");if(n)return n.get("bounds")}}}function pr(e,t){Oi.call(this),this._bpmnFactory=e,this._moddle=t}pe(pr,Oi),pr.$inject=["bpmnFactory","moddle"],pr.prototype._baseCreate=Oi.prototype.create,pr.prototype.create=function(e,t){if(e==="label"){var n=t.di||this._bpmnFactory.createDiLabel();return this._baseCreate(e,j({type:"label",di:n},Nr,t))}return this.createElement(e,t)},pr.prototype.createElement=function(e,t){t=j({},t||{});var n,i=t.businessObject,r=t.di;if(!i){if(!t.type)throw new Error("no shape type specified");i=this._bpmnFactory.create(t.type)}if(!VA(r)){var o=j({},r||{},{id:i.id+"_di"});e==="root"?r=this._bpmnFactory.createDiPlane(i,o):e==="connection"?r=this._bpmnFactory.createDiEdge(i,o):r=this._bpmnFactory.createDiShape(i,o)}v(i,"bpmn:Group")&&(t=j({isFrame:!0},t)),t=GA(i,t,["processRef","isInterrupting","associationDirection","isForCompensation"]),t.isExpanded&&(t=Ip(r,t,"isExpanded")),Fe(i,["bpmn:Lane","bpmn:Participant"])&&(t=Ip(r,t,"isHorizontal")),v(i,"bpmn:SubProcess")&&(t.collapsed=!We(i,r)),v(i,"bpmn:ExclusiveGateway")&&(En(r,"isMarkerVisible")?r.isMarkerVisible===void 0&&(r.isMarkerVisible=!1):r.isMarkerVisible=!0),Bt(t.triggeredByEvent)&&(i.triggeredByEvent=t.triggeredByEvent,delete t.triggeredByEvent),Bt(t.cancelActivity)&&(i.cancelActivity=t.cancelActivity,delete t.cancelActivity);var a,s;return t.eventDefinitionType&&(a=i.get("eventDefinitions")||[],s=this._bpmnFactory.create(t.eventDefinitionType,t.eventDefinitionAttrs),t.eventDefinitionType==="bpmn:ConditionalEventDefinition"&&(s.condition=this._bpmnFactory.create("bpmn:FormalExpression")),a.push(s),s.$parent=i,i.eventDefinitions=a,delete t.eventDefinitionType),n=this.getDefaultSize(i,r),t=j({id:i.id},n,t,{businessObject:i,di:r}),this._baseCreate(e,t)},pr.prototype.getDefaultSize=function(e,t){var n=ee(e);if(t=t||Xe(e),v(n,"bpmn:SubProcess"))return We(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 We(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}},pr.prototype.createParticipantShape=function(e){return Vt(e)||(e={isExpanded:e}),e=j({type:"bpmn:Participant"},e||{}),e.isExpanded!==!1&&(e.processRef=this._bpmnFactory.create("bpmn:Process")),this.createShape(e)};function GA(e,t,n){return D(n,function(i){t=Ip(e,t,i)}),t}function Ip(e,t,n){return t[n]===void 0?t:(e[n]=t[n],oi(t,[n]))}function VA(e){return Fe(e,["bpmndi:BPMNShape","bpmndi:BPMNEdge","bpmndi:BPMNDiagram","bpmndi:BPMNPlane"])}function vc(e,t){this._modeling=e,this._canvas=t}vc.$inject=["modeling","canvas"],vc.prototype.preExecute=function(e){var t=this._modeling,n=e.elements,i=e.alignment;D(n,function(r){var o={x:0,y:0};Bt(i.left)?o.x=i.left-r.x:Bt(i.right)?o.x=i.right-r.width-r.x:Bt(i.center)?o.x=i.center-Math.round(r.width/2)-r.x:Bt(i.top)?o.y=i.top-r.y:Bt(i.bottom)?o.y=i.bottom-r.height-r.y:Bt(i.middle)&&(o.y=i.middle-Math.round(r.height/2)-r.y),t.moveElements([r],o,r.parent)})},vc.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||{};WA(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 WA(e,t){return Ui(e.outgoing,function(n){return n.target===t})}function _c(e,t){this._canvas=e,this._layouter=t}_c.$inject=["canvas","layouter"],_c.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},_c.prototype.revert=function(e){var t=e.connection;return this._canvas.removeConnection(t),t.source=null,t.target=null,t};var xc=Math.round;function Np(e){this._modeling=e}Np.$inject=["modeling"],Np.prototype.preExecute=function(e){var t=e.elements,n=e.parent,i=e.parentIndex,r=e.position,o=e.hints,a=this._modeling;D(t,function(f){Pe(f.x)||(f.x=0),Pe(f.y)||(f.y=0)});var s=He(t,function(f){return!f.hidden}),c=Mt(s);D(t,function(f){at(f)&&(f.waypoints=on(f.waypoints,function(p){return{x:xc(p.x-c.x-c.width/2+r.x),y:xc(p.y-c.y-c.height/2+r.y)}})),j(f,{x:xc(f.x-c.x-c.width/2+r.x),y:xc(f.y-c.y-c.height/2+r.y)})});var u=new Set(Es(t)),l={};D(t,function(f){if(at(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=j({},o);u.has(f)||(p.autoResize=!1),$e(f)&&(p=oi(p,["attach"])),l[f.id]=Pe(i)?a.createShape(f,ei(f,["x","y","width","height"]),f.parent||n,i,p):a.createShape(f,ei(f,["x","y","width","height"]),f.parent||n,p)}),e.elements=eo(l)};var Vy=Math.round;function fr(e){this._canvas=e}fr.$inject=["canvas"],fr.prototype.execute=function(e){var t=e.shape,n=e.position,i=e.parent,r=e.parentIndex;if(!i)throw new Error("parent required");if(!n)throw new Error("position required");return n.width!==void 0?j(t,n):j(t,{x:n.x-Vy(t.width/2),y:n.y-Vy(t.height/2)}),this._canvas.addShape(t,i,r),t},fr.prototype.revert=function(e){var t=e.shape;return this._canvas.removeShape(t),t};function va(e){fr.call(this,e)}pe(va,fr),va.$inject=["canvas"];var UA=fr.prototype.execute;va.prototype.execute=function(e){var t=e.shape;return YA(t),t.labelTarget=e.labelTarget,UA.call(this,e)};var qA=fr.prototype.revert;va.prototype.revert=function(e){return e.shape.labelTarget=null,qA.call(this,e)};function YA(e){["width","height"].forEach(function(t){typeof e[t]>"u"&&(e[t]=0)})}function ba(e,t){this._canvas=e,this._modeling=t}ba.$inject=["canvas","modeling"],ba.prototype.preExecute=function(e){var t=this._modeling,n=e.connection;lr(n.incoming,function(i){t.removeConnection(i,{nested:!0})}),lr(n.outgoing,function(i){t.removeConnection(i,{nested:!0})})},ba.prototype.execute=function(e){var t=e.connection,n=t.parent;return e.parent=n,e.parentIndex=ll(n.children,t),e.source=t.source,e.target=t.target,this._canvas.removeConnection(t),t.source=null,t.target=null,t},ba.prototype.revert=function(e){var t=e.connection,n=e.parent,i=e.parentIndex;return t.source=e.source,t.target=e.target,St(n.children,t,i),this._canvas.addConnection(t,n),t};function Bp(e,t){this._modeling=e,this._elementRegistry=t}Bp.$inject=["modeling","elementRegistry"],Bp.prototype.postExecute=function(e){var t=this._modeling,n=this._elementRegistry,i=e.elements;D(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;lr(n.incoming,function(i){t.removeConnection(i,{nested:!0})}),lr(n.outgoing,function(i){t.removeConnection(i,{nested:!0})}),lr(n.children,function(i){at(i)?t.removeConnection(i,{nested:!0}):t.removeShape(i,{nested:!0})})},_a.prototype.execute=function(e){var t=this._canvas,n=e.shape,i=n.parent;return e.oldParent=i,e.oldParentIndex=ll(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 St(i.children,n,r),t.addShape(n,i),n};function wc(e){this._modeling=e}wc.$inject=["modeling"];var Wy={x:"y",y:"x"};wc.prototype.preExecute=function(e){var t=this._modeling,n=e.groups,i=e.axis,r=e.dimension;function o(g,S){g.range.min=Math.min(S[i],g.range.min),g.range.max=Math.max(S[i]+S[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,S){var E={y:0};E[i]=g-a(S),E[i]&&(E[Wy[i]]=0,t.moveElements([S],E,S.parent))}var l=n[0],f=s(n),p=n[f],d,h,m=0;D(n,function(g,S){var E,x,w;if(g.elements.length<2){S&&S!==n.length-1&&(o(g,g.elements[0]),m+=c(g.range));return}E=ri(g.elements,i),x=E[0],S===f&&(x=E[s(E)]),w=a(x),g.range=null,D(E,function(C){if(u(w,C),g.range===null){g.range={min:C[i],max:C[i]+C[r]};return}o(g,C)}),S&&S!==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)&&D(n,function(g,S){var E={},x;g===l||g===p||(x=n[S-1],g.range.max=0,D(g.elements,function(w,C){E[Wy[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],C?g.range.max:0)}))})},wc.prototype.postExecute=function(e){};function Ec(e,t){this._layouter=e,this._canvas=t}Ec.$inject=["layouter","canvas"],Ec.prototype.execute=function(e){var t=e.connection,n=t.waypoints;return j(e,{oldWaypoints:n}),t.waypoints=this._layouter.layoutConnection(t,e.hints),t},Ec.prototype.revert=function(e){var t=e.connection;return t.waypoints=e.oldWaypoints,t};function $p(){}$p.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=wt(o.children,t),St(i.children,t,r),t.parent=i,D(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},$p.prototype.revert=function(e){var t=e.connection,n=t.parent,i=e.oldParent,r=e.oldParentIndex,o=e.delta;return wt(n.children,t),St(i.children,t,r),t.parent=i,D(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 jp(){this.allShapes={},this.allConnections={},this.enclosedElements={},this.enclosedConnections={},this.topLevel={}}jp.prototype.add=function(e,t){return this.addAll([e],t)},jp.prototype.addAll=function(e,t){var n=S1(e,!!t,this);return j(this,n),this};function xa(e){this._modeling=e}xa.prototype.moveRecursive=function(e,t,n){return e?this.moveClosure(this.getClosure(e),t,n):[]},xa.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),D(a,function(f){o.moveShape(f,t,u[f.id]&&!l&&n,{recurse:!1,layout:!1})}),D(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&&Ul(f,f.source,t),connectionEnd:d&&ql(f,f.target,t)})})},xa.prototype.getClosure=function(e){return new jp().addAll(e,!0)};function Sc(e){this._helper=new xa(e)}Sc.$inject=["modeling"],Sc.prototype.preExecute=function(e){e.closure=this._helper.getClosure(e.shapes)},Sc.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 xa(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=ei(t,["x","y","width","height"]),e.oldParent=o,e.oldParentIndex=wt(o.children,t),St(i.children,t,r),j(t,{parent:i,x:t.x+n.x,y:t.y+n.y}),t},zr.prototype.postExecute=function(e){var t=e.shape,n=e.delta,i=e.hints,r=this._modeling;i.layout!==!1&&(D(t.incoming,function(o){r.layoutConnection(o,{connectionEnd:ql(o,t,n)})}),D(t.outgoing,function(o){r.layoutConnection(o,{connectionStart:Ul(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 St(n.children,t,i),j(t,{parent:n,x:t.x-r.x,y:t.y-r.y}),t},zr.prototype.moveChildren=function(e){var t=e.delta,n=e.shape;this._helper.moveRecursive(n.children,t,null)},zr.prototype.getNewParent=function(e){return e.newParent||e.shape.parent};function wa(e){this._modeling=e}wa.$inject=["modeling"],wa.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 Ee(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},wa.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||Uy(Ee(r)?r[0]:r)),i&&(!n||o.docking==="target")&&(a.connectionEnd=a.connectionEnd||Uy(Ee(r)?r[r.length-1]:r)),o.newWaypoints&&(a.waypoints=o.newWaypoints),this._modeling.layoutConnection(t,a))},wa.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 Uy(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();D(p,function(h){var m=h.source,g=c(m,s,h);g&&t.reconnectEnd(h,s,Zs(h,s,l),a)}),D(d,function(h){var m=h.target,g=c(s,m,h);g&&t.reconnectStart(h,s,Xs(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 Ea(e){this._modeling=e}Ea.$inject=["modeling"],Ea.prototype.execute=function(e){var t=e.shape,n=e.newBounds,i=e.minBounds;if(n.x===void 0||n.y===void 0||n.width===void 0||n.height===void 0)throw new Error("newBounds must have {x, y, width, height} properties");if(i&&(n.width<i.width||n.height<i.height))throw new Error("width and height cannot be less than minimum height and width");if(!i&&n.width<10||n.height<10)throw new Error("width and height cannot be less than 10px");return e.oldBounds={width:t.width,height:t.height,x:t.x,y:t.y},j(t,{width:n.width,height:n.height,x:n.x,y:n.y}),t},Ea.prototype.postExecute=function(e){var t=this._modeling,n=e.shape,i=e.oldBounds,r=e.hints||{};r.layout!==!1&&(D(n.incoming,function(o){t.layoutConnection(o,{connectionEnd:Zs(o,n,i)})}),D(n.outgoing,function(o){t.layoutConnection(o,{connectionStart:Xs(o,n,i)})}))},Ea.prototype.revert=function(e){var t=e.shape,n=e.oldBounds;return j(t,{width:n.width,height:n.height,x:n.x,y:n.y}),t};function dr(e){this._modeling=e}dr.$inject=["modeling"],dr.prototype.preExecute=function(e){var t=e.delta,n=e.direction,i=e.movingShapes,r=e.resizingShapes,o=e.start,a={};this.moveShapes(i,t),D(r,function(s){a[s.id]=XA(s)}),this.resizeShapes(r,t,n),this.updateConnectionWaypoints(EA(i,r),t,n,o,i,r,a)},dr.prototype.execute=function(){},dr.prototype.revert=function(){},dr.prototype.moveShapes=function(e,t){var n=this;D(e,function(i){n._modeling.moveShape(i,t,null,{autoResize:!1,layout:!1,recurse:!1})})},dr.prototype.resizeShapes=function(e,t,n){var i=this;D(e,function(r){var o=SA(r,n,t);i._modeling.resizeShape(r,o,null,{attachSupport:!1,autoResize:!1,layout:!1})})},dr.prototype.updateConnectionWaypoints=function(e,t,n,i,r,o,a){var s=this,c=new Set(r),u=new Set(o);D(e,function(l){var f=l.source,p=l.target,d=KA(l),h=Yy(n),m={},g=c.has(f)||u.has(f),S=c.has(p)||u.has(p);g&&S?(d=on(d,function(E){return Ky(E,i,n)&&(E[h]=E[h]+t[h]),E.original&&Ky(E.original,i,n)&&(E.original[h]=E.original[h]+t[h]),E}),s._modeling.updateWaypoints(l,d,{labelBehavior:!1})):(g||S)&&(c.has(f)?m.connectionStart=Ul(l,f,t):c.has(p)?m.connectionEnd=ql(l,p,t):u.has(f)?m.connectionStart=Xs(l,f,a[f.id]):u.has(p)&&(m.connectionEnd=Zs(l,p,a[p.id])),s._modeling.layoutConnection(l,m))})};function qy(e){return j({},e)}function KA(e){return on(e.waypoints,function(t){return t=qy(t),t.original&&(t.original=qy(t.original)),t})}function Yy(e){switch(e){case"n":return"y";case"w":return"x";case"s":return"y";case"e":return"x"}}function Ky(e,t,n){var i=Yy(n);if(/e|s/.test(n))return e[i]>t;if(/n|w/.test(n))return e[i]<t}function XA(e){return{x:e.x,y:e.y,height:e.height,width:e.width}}function Rc(e){this._modeling=e}Rc.$inject=["modeling"],Rc.prototype.execute=function(e){var t=e.shape,n=t.children;e.oldChildrenVisibility=Xy(n),t.collapsed=!t.collapsed;var i=Zy(n,t.collapsed);return[t].concat(i)},Rc.prototype.revert=function(e){var t=e.shape,n=e.oldChildrenVisibility,i=t.children,r=Qy(i,n);return t.collapsed=!t.collapsed,[t].concat(r)};function Xy(e){var t={};return D(e,function(n){t[n.id]=n.hidden,n.children&&(t=j({},t,Xy(n.children)))}),t}function Zy(e,t){var n=[];return D(e,function(i){i.hidden=t,n=n.concat(i),i.children&&(n=n.concat(Zy(i.children,i.collapsed||t)))}),n}function Qy(e,t){var n=[];return D(e,function(i){i.hidden=t[i.id],n=n.concat(i),i.children&&(n=n.concat(Qy(i.children,t)))}),n}function Cc(e){this._modeling=e}Cc.$inject=["modeling"],Cc.prototype.execute=function(e){var t=e.shape,n=e.newHost,i=t.host;return e.oldHost=i,e.attacherIdx=Jy(i,t),ev(n,t),t.host=n,t},Cc.prototype.revert=function(e){var t=e.shape,n=e.newHost,i=e.oldHost,r=e.attacherIdx;return t.host=i,Jy(n,t),ev(i,t,r),t};function Jy(e,t){return wt(e&&e.attachers,t)}function ev(e,t,n){if(e){var i=e.attachers;i||(e.attachers=i=[]),St(i,t,n)}}function Fp(){}Fp.prototype.execute=function(e){var t=e.connection,n=e.newWaypoints;return e.oldWaypoints=t.waypoints,t.waypoints=n,t},Fp.prototype.revert=function(e){var t=e.connection,n=e.oldWaypoints;return t.waypoints=n,t};function st(e,t,n){this._eventBus=e,this._elementFactory=t,this._commandStack=n;var i=this;e.on("diagram.init",function(){i.registerHandlers(n)})}st.$inject=["eventBus","elementFactory","commandStack"],st.prototype.getHandlers=function(){return{"shape.append":bc,"shape.create":fr,"shape.delete":_a,"shape.move":zr,"shape.resize":Ea,"shape.replace":$i,"shape.toggleCollapse":Rc,spaceTool:dr,"label.create":va,"connection.create":_c,"connection.delete":ba,"connection.move":$p,"connection.layout":Ec,"connection.updateWaypoints":Fp,"connection.reconnect":wa,"elements.create":Np,"elements.move":Sc,"elements.delete":Bp,"elements.distribute":wc,"elements.align":vc,"element.updateAttachment":Cc}},st.prototype.registerHandlers=function(e){D(this.getHandlers(),function(t,n){e.registerHandler(n,t)})},st.prototype.moveShape=function(e,t,n,i,r){typeof i=="object"&&(r=i,i=null);var o={shape:e,delta:t,newParent:n,newParentIndex:i,hints:r||{}};this._commandStack.execute("shape.move",o)},st.prototype.updateAttachment=function(e,t){var n={shape:e,newHost:t};this._commandStack.execute("element.updateAttachment",n)},st.prototype.moveElements=function(e,t,n,i){i=i||{};var r=i.attach,o=n,a;r===!0?(a=n,o=n.parent):r===!1&&(a=null);var s={shapes:e,delta:t,newParent:o,newHost:a,hints:i};this._commandStack.execute("elements.move",s)},st.prototype.moveConnection=function(e,t,n,i,r){typeof i=="object"&&(r=i,i=void 0);var o={connection:e,delta:t,newParent:n,newParentIndex:i,hints:r||{}};this._commandStack.execute("connection.move",o)},st.prototype.layoutConnection=function(e,t){var n={connection:e,hints:t||{}};this._commandStack.execute("connection.layout",n)},st.prototype.createConnection=function(e,t,n,i,r,o){typeof n=="object"&&(o=r,r=i,i=n,n=void 0),i=this._create("connection",i);var a={source:e,target:t,parent:r,parentIndex:n,connection:i,hints:o};return this._commandStack.execute("connection.create",a),a.connection},st.prototype.createShape=function(e,t,n,i,r){typeof i!="number"&&(r=i,i=void 0),r=r||{};var o=r.attach,a,s;e=this._create("shape",e),o?(a=n.parent,s=n):a=n;var c={position:t,shape:e,parent:a,parentIndex:i,host:s,hints:r};return this._commandStack.execute("shape.create",c),c.shape},st.prototype.createElements=function(e,t,n,i,r){Ee(e)||(e=[e]),typeof i!="number"&&(r=i,i=void 0),r=r||{};var o={position:t,elements:e,parent:n,parentIndex:i,hints:r};return this._commandStack.execute("elements.create",o),o.elements},st.prototype.createLabel=function(e,t,n,i){n=this._create("label",n);var r={labelTarget:e,position:t,parent:i||e.parent,shape:n};return this._commandStack.execute("label.create",r),r.shape},st.prototype.appendShape=function(e,t,n,i,r){r=r||{},t=this._create("shape",t);var o={source:e,position:n,target:i,shape:t,connection:r.connection,connectionParent:r.connectionParent,hints:r};return this._commandStack.execute("shape.append",o),o.shape},st.prototype.removeElements=function(e){var t={elements:e};this._commandStack.execute("elements.delete",t)},st.prototype.distributeElements=function(e,t,n){var i={groups:e,axis:t,dimension:n};this._commandStack.execute("elements.distribute",i)},st.prototype.removeShape=function(e,t){var n={shape:e,hints:t||{}};this._commandStack.execute("shape.delete",n)},st.prototype.removeConnection=function(e,t){var n={connection:e,hints:t||{}};this._commandStack.execute("connection.delete",n)},st.prototype.replaceShape=function(e,t,n){var i={oldShape:e,newData:t,hints:n||{}};return this._commandStack.execute("shape.replace",i),i.newShape},st.prototype.alignElements=function(e,t){var n={elements:e,alignment:t};this._commandStack.execute("elements.align",n)},st.prototype.resizeShape=function(e,t,n,i){var r={shape:e,newBounds:t,minBounds:n,hints:i};this._commandStack.execute("shape.resize",r)},st.prototype.createSpace=function(e,t,n,i,r){var o={delta:n,direction:i,movingShapes:e,resizingShapes:t,start:r};this._commandStack.execute("spaceTool",o)},st.prototype.updateWaypoints=function(e,t,n){var i={connection:e,newWaypoints:t,hints:n||{}};this._commandStack.execute("connection.updateWaypoints",i)},st.prototype.reconnect=function(e,t,n,i,r){var o={connection:e,newSource:t,newTarget:n,dockingOrPoints:i,hints:r||{}};this._commandStack.execute("connection.reconnect",o)},st.prototype.reconnectStart=function(e,t,n,i){i||(i={}),this.reconnect(e,t,e.target,n,j(i,{docking:"source"}))},st.prototype.reconnectEnd=function(e,t,n,i){i||(i={}),this.reconnect(e,e.source,t,n,j(i,{docking:"target"}))},st.prototype.connect=function(e,t,n,i){return this.createConnection(e,t,n||{},e.parent,i)},st.prototype._create=function(e,t){return uS(t)?t:this._elementFactory.create(e,t)},st.prototype.toggleCollapse=function(e,t){var n={shape:e,hints:t||{}};this._commandStack.execute("shape.toggleCollapse",n)};function Sa(e){this._elementRegistry=e}Sa.$inject=["elementRegistry"],Sa.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||ZA(n,Za(i));return tv(n,i),e.oldProperties=o,e.changed=r,r},Sa.prototype.revert=function(e){var t=e.oldProperties,n=e.moddleElement,i=e.changed;return tv(n,t),i},Sa.prototype._getVisualReferences=function(e){var t=this._elementRegistry;return v(e,"bpmn:DataObject")?QA(e,t):[]};function ZA(e,t){return Sn(t,function(n,i){return n[i]=e.get(i),n},{})}function tv(e,t){D(t,function(n,i){e.set(i,n)})}function QA(e,t){return t.filter(function(n){return v(n,"bpmn:DataObjectReference")&&ee(n).dataObjectRef===e})}var Ra="default",ji="id",nv="di",JA={width:0,height:0};function Ca(e,t,n,i){this._elementRegistry=e,this._moddle=t,this._modeling=n,this._textRenderer=i}Ca.$inject=["elementRegistry","moddle","modeling","textRenderer"],Ca.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=rT(e.properties),s=e.oldProperties||eT(t,a);return iv(a,o)&&(r.unclaim(o[ji]),i.updateId(t,a[ji]),r.claim(a[ji],o)),Ra in a&&(a[Ra]&&n.push(i.get(a[Ra].id)),o[Ra]&&n.push(i.get(o[Ra].id))),rv(t,a),e.oldProperties=s,e.changed=n,n},Ca.prototype.postExecute=function(e){var t=e.element,n=t.label,i=n&&ee(n).name;if(i){var r=this._textRenderer.getExternalLabelBounds(n,i);this._modeling.resizeShape(n,r,JA)}},Ca.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 rv(t,i),iv(n,r)&&(a.unclaim(n[ji]),o.updateId(t,i[ji]),a.claim(i[ji],r)),e.changed};function iv(e,t){return ji in e&&e[ji]!==t[ji]}function eT(e,t){var n=Za(t),i=e.businessObject,r=Xe(e);return Sn(n,function(o,a){return a!==nv?o[a]=i.get(a):o[a]=tT(r,Za(t.di)),o},{})}function tT(e,t){return Sn(t,function(n,i){return n[i]=e&&e.get(i),n},{})}function rv(e,t){var n=e.businessObject,i=Xe(e);D(t,function(r,o){o!==nv?n.set(o,r):i&&nT(i,r)})}function nT(e,t){D(t,function(n,i){e.set(i,n)})}var iT=["default"];function rT(e){var t=j({},e);return iT.forEach(function(n){n in e&&(t[n]=ee(t[n]))}),t}function Pc(e,t){this._canvas=e,this._modeling=t}Pc.$inject=["canvas","modeling"],Pc.prototype.execute=function(e){var t=this._canvas,n=e.newRoot,i=n.businessObject,r=t.getRootElement(),o=r.businessObject,a=o.$parent,s=Xe(r);return t.setRootElement(n),t.removeRootElement(r),St(a.rootElements,i),i.$parent=a,wt(a.rootElements,o),o.$parent=null,r.di=null,s.bpmnElement=i,n.di=s,e.oldRoot=r,[]},Pc.prototype.revert=function(e){var t=this._canvas,n=e.newRoot,i=n.businessObject,r=e.oldRoot,o=r.businessObject,a=i.$parent,s=Xe(n);return t.setRootElement(r),t.removeRootElement(n),wt(a.rootElements,i),i.$parent=null,St(a.rootElements,o),o.$parent=a,n.di=null,s.bpmnElement=o,r.di=s,[]};function Hp(e,t){this._modeling=e,this._spaceTool=t}Hp.$inject=["modeling","spaceTool"],Hp.prototype.preExecute=function(e){var t=this._spaceTool,n=this._modeling,i=e.shape,r=e.location,o=Gn(i),a=o===i,s=a?i:i.parent,c=or(s),u=Ut(i);if(u?r==="left"?r="top":r==="right"&&(r="bottom"):r==="top"?r="left":r==="bottom"&&(r="right"),!c.length){var l=u?{x:i.x+zn,y:i.y,width:i.width-zn,height:i.height}:{x:i.x,y:i.y+zn,width:i.width,height:i.height-zn};n.createShape({type:"bpmn:Lane",isHorizontal:u},l,s)}var f=[];Lr(o,function(w){return f.push(w),w.label&&f.push(w.label),w===i?[]:He(w.children,function(C){return C!==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 S=t.calculateAdjustments(f,g,p,h),E=u?{x:0,y:p}:{x:p,y:0};t.makeSpace(S.movingShapes,S.resizingShapes,E,m,h);var x=u?{x:i.x+(a?zn:0),y:d-(r==="top"?120:0),width:i.width-(a?zn:0),height:120}:{x:d-(r==="left"?120:0),y:i.y+(a?zn:0),width:120,height:i.height-(a?zn:0)};e.newLane=n.createShape({type:"bpmn:Lane",isHorizontal:u},x,s)};function zp(e){this._modeling=e}zp.$inject=["modeling"],zp.prototype.preExecute=function(e){var t=this._modeling,n=e.shape,i=e.count,r=or(n),o=r.length;if(o>i)throw new Error(`more than <${i}> child lanes`);var a=Ut(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+zn,y:n.y+p*c,width:n.width-zn,height:u}:{x:n.x+p*c,y:n.y+zn,width:u,height:n.height-zn},p<o?t.resizeShape(r[p],l):(f={type:"bpmn:Lane",isHorizontal:a},t.createShape(f,l,n))};function Pa(e,t){this._modeling=e,this._spaceTool=t}Pa.$inject=["modeling","spaceTool"],Pa.prototype.preExecute=function(e){var t=e.shape,n=e.newBounds,i=e.balanced;i!==!1?this.resizeBalanced(t,n):this.resizeSpace(t,n)},Pa.prototype.resizeBalanced=function(e,t){var n=this._modeling,i=QR(e,t);n.resizeShape(e,t),i.forEach(function(r){n.resizeShape(r.shape,r.newBounds)})},Pa.prototype.resizeSpace=function(e,t){var n=this._spaceTool,i=xe(e),r=xe(t),o=Nm(r,i),a=Gn(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 Aa="flowNodeRef",Gp="lanes";function Ac(){}Ac.prototype._computeUpdates=function(e,t){var n=[],i=[],r={},o=[];function a(l,f){var p=xe(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=Gn(l);return r[f.id]||(r[f.id]=Ws(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=Gn(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(Gp),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(Aa).forEach(function(p){i.push({flowNode:p,remove:[f],add:[]})})}),i},Ac.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(Gp);n.remove.forEach(function(o){wt(r,o),wt(o.get(Aa),i)}),n.add.forEach(function(o){St(r,o),St(o.get(Aa),i)})}),[]},Ac.prototype.revert=function(e){var t=e.updates;return t.forEach(function(n){var i=n.flowNode,r=i.get(Gp);n.add.forEach(function(o){wt(r,o),wt(o.get(Aa),i)}),n.remove.forEach(function(o){St(r,o),St(o.get(Aa),i)})}),[]};var Vp="categoryValueRef";function Ta(e,t){this._bpmnFactory=e,this._elementRegistry=t}Ta.$inject=["bpmnFactory","elementRegistry"],Ta.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 C=a.get(E);C||(C={},a.set(E,C)),!(w&&C.present)&&(!w&&C.past||(w?C.present={categoryValue:x,root:Wp(E)}:C.past={categoryValue:x}))}}function c(E){r.set(E,ee(E))}function u(){n.filter(function(E){return v(E,"bpmn:FlowElement")&&!$e(E)&&E.parent}).forEach(c)}function l(E){var x=ee(E),w=x.get("categoryValueRef");return w||(w=km(i,x),o.push(oT(E,w))),w}function f(E){return E.reduce(function(x,w){var C=Wp(w),P=x.get(C);return P||(P=[],x.set(C,P)),P.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")&&!$e(E)&&E.parent}).forEach(function(E){var x=ee(E).get("categoryValueRef");if(!x){var w=Wp(E),C=p.get(w)||[],P=uo(C,E),L=Object.keys(P).length>0;L&&(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 C=g.get(w.root)||[],P=uo(C,x);C.forEach(function(L){if(P[L.id]){var T=m.get(L);T||(T=new Set,m.set(L,T)),T.add(w.categoryValue)}})}});var S=d.reduce(function(E,x){var w=r.get(x),C=w.get(Vp),P=new Set(C),L=m.get(x)||new Set,T=Array.from(L).filter(function(k){return!P.has(k)}),B=C.filter(function(k){return h.has(k)&&!L.has(k)});return(T.length||B.length)&&E.push({businessObject:w,categoryValuesToAdd:T,categoryValuesToRemove:B}),E},[]);return{flowElements:S,groups:o}},Ta.prototype.execute=function(e){var t=e.updates;return t||(t=e.updates=this._computeUpdates(e.affectedFlowElements,e.affectedGroupEntries)),aT(t.groups),cT(t.flowElements),[]},Ta.prototype.revert=function(e){var t=e.updates;return uT(t.flowElements),sT(t.groups),[]};function oT(e,t){return{groupShape:e,categoryValue:t,category:t.$parent}}function aT(e){e.forEach(function(t){ee(t.groupShape).categoryValueRef=t.categoryValue,t.categoryValue.$parent=t.category})}function sT(e){e.forEach(function(t){ee(t.groupShape).categoryValueRef=null})}function cT(e){e.forEach(function(t){var n=t.businessObject,i=n.get(Vp);t.categoryValuesToRemove.forEach(function(r){wt(i,r)}),t.categoryValuesToAdd.forEach(function(r){St(i,r,!0)})})}function uT(e){e.forEach(function(t){var n=t.businessObject,i=n.get(Vp);t.categoryValuesToAdd.forEach(function(r){wt(i,r)}),t.categoryValuesToRemove.forEach(function(r){St(i,r,!0)})})}function Wp(e){for(;e.parent;)e=e.parent;return e}function Tc(e){this._moddle=e}Tc.$inject=["moddle"],Tc.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),[]},Tc.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 lT={fill:void 0,stroke:void 0};function Up(e){this._commandStack=e,this._normalizeColor=function(t){if(t){if(wn(t)){var n=pT(t);if(n)return n}throw new Error(`invalid color value: ${t}`)}}}Up.$inject=["commandStack"],Up.prototype.postExecute=function(e){var t=e.elements,n=e.colors||lT,i=this,r={};"fill"in n&&j(r,{"background-color":this._normalizeColor(n.fill)}),"stroke"in n&&j(r,{"border-color":this._normalizeColor(n.stroke)}),D(t,function(o){var a=at(o)?ei(r,["border-color"]):r,s=Xe(o);if(fT(a),$e(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(!Fe(s,["bpmndi:BPMNEdge","bpmndi:BPMNShape"]))return;i._commandStack.execute("element.updateProperties",{element:o,properties:{di:a}})}})};function pT(e){var t=document.createElement("canvas").getContext("2d");return t.fillStyle="transparent",t.fillStyle=e,/^#[0-9a-fA-F]{6}$/.test(t.fillStyle)?t.fillStyle:null}function fT(e){"border-color"in e&&(e.stroke=e["border-color"]),"background-color"in e&&(e.fill=e["background-color"])}var dT={width:0,height:0};function ov(e,t,n){function i(c,u){var l=c.label||c,f=c.labelTarget||c;return HS(l,u),[l,f]}function r(c){var u=c.element,l=u.businessObject,f=c.newLabel;if(!$e(u)&&ir(u)&&!Os(u)&&!av(f)){var p=7,d=gl(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=Bn(c.element),i(c.element,c.newLabel)}function a(c){return i(c.element,c.oldLabel)}function s(c){var u=c.element,l=u.label||u,f=c.newLabel,p=c.newBounds,d=c.hints||{};if(!(!$e(l)&&!v(l,"bpmn:TextAnnotation"))){if($e(l)&&av(f)){d.removeShape!==!1&&e.removeShape(l,{unsetLabel:!1});return}var h=Bn(u);typeof p>"u"&&(p=t.getExternalLabelBounds(l,h)),p&&e.resizeShape(l,p,dT)}}this.preExecute=r,this.execute=o,this.revert=a,this.postExecute=s}ov.$inject=["modeling","textRenderer","bpmnFactory"];function av(e){return!e||!e.trim()}function en(e,t,n,i){st.call(this,e,t,n),this._bpmnRules=i}pe(en,st),en.$inject=["eventBus","elementFactory","commandStack","bpmnRules"],en.prototype.getHandlers=function(){var e=st.prototype.getHandlers.call(this);return e["element.updateModdleProperties"]=Sa,e["element.updateProperties"]=Ca,e["canvas.updateRoot"]=Pc,e["lane.add"]=Hp,e["lane.resize"]=Pa,e["lane.split"]=zp,e["lane.updateRefs"]=Ac,e["group.updateRefs"]=Ta,e["id.updateClaim"]=Tc,e["element.setColor"]=Up,e["element.updateLabel"]=ov,e},en.prototype.updateLabel=function(e,t,n,i){this._commandStack.execute("element.updateLabel",{element:e,newLabel:t,newBounds:n,hints:i||{}})},en.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)},en.prototype.updateModdleProperties=function(e,t,n){this._commandStack.execute("element.updateModdleProperties",{element:e,moddleElement:t,properties:n})},en.prototype.updateProperties=function(e,t){this._commandStack.execute("element.updateProperties",{element:e,properties:t})},en.prototype.resizeLane=function(e,t,n){this._commandStack.execute("lane.resize",{shape:e,newBounds:t,balanced:n})},en.prototype.addLane=function(e,t){var n={shape:e,location:t};return this._commandStack.execute("lane.add",n),n.newLane},en.prototype.splitLane=function(e,t){this._commandStack.execute("lane.split",{shape:e,count:t})},en.prototype.makeCollaboration=function(){var e=this._create("root",{type:"bpmn:Collaboration"}),t={newRoot:e};return this._commandStack.execute("canvas.updateRoot",t),e},en.prototype.makeProcess=function(){var e=this._create("root",{type:"bpmn:Process"}),t={newRoot:e};return this._commandStack.execute("canvas.updateRoot",t),e},en.prototype.updateLaneRefs=function(e,t){this._commandStack.execute("lane.updateRefs",{flowNodeShapes:e,laneShapes:t})},en.prototype.updateCategoryValueRefs=function(e,t){this._commandStack.execute("group.updateRefs",{affectedFlowElements:e,affectedGroupEntries:t})},en.prototype.claimId=function(e,t){this._commandStack.execute("id.updateClaim",{id:e,element:t,claiming:!0})},en.prototype.unclaimId=function(e,t){this._commandStack.execute("id.updateClaim",{id:e,element:t})},en.prototype.setColor=function(e,t){e.length||(e=[e]),this._commandStack.execute("element.setColor",{elements:e,colors:t})};function sv(){}sv.prototype.layoutConnection=function(e,t){return t=t||{},[t.connectionStart||Se(t.source||e.source),t.connectionEnd||Se(t.target||e.target)]};var Mc=20,hT=5,kc=Math.round,cv=20,mT={"h:h":20,"v:v":20,"h:v":-10,"v:h":-10};function gT(e,t){return!{t:/top/,r:/right/,b:/bottom/,l:/left/,h:/./,v:/./}[t].test(e)}function yT(e,t){return{t:/top/,r:/right/,b:/bottom/,l:/left/,h:/left|right/,v:/top|bottom/}[e].test(t)}function uv(e,t,n){var i=Zt(t,e,hT),r=n.split(":")[0],o=kc((t.x-e.x)/2+e.x),a=kc((t.y-e.y)/2+e.y),s,c,u=yT(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=gT(i,r),c=l?"h:v":"v:h",f?l?(p=a===e.y,s={x:e.x+Mc*(/l/.test(r)?-1:1),y:p?a+Mc:a}):(p=o===e.x,s={x:p?o+Mc:o,y:e.y+Mc*(/t/.test(r)?-1:1)}):s={x:o,y:a}),{waypoints:qp(e,s,c).concat(s),directions:c,turnNextDirections:p}}function vT(e,t,n){return uv(e,t,n)}function bT(e,t,n){var i=uv(t,e,lv(n));return{waypoints:i.waypoints.slice().reverse(),directions:lv(i.directions),turnNextDirections:i.turnNextDirections}}function _T(e,t){var n=e.directions.split(":")[1],i=t.directions.split(":")[0];e.turnNextDirections&&(n=n=="h"?"v":"h"),t.turnNextDirections&&(i=i=="h"?"v":"h");var r=n+":"+i,o=qp(e.waypoints[e.waypoints.length-1],t.waypoints[0],r);return{waypoints:o,directions:r}}function lv(e){return e.split(":").reverse().join(":")}function xT(e,t,n){var i=kc((t.x-e.x)/2+e.x),r=kc((t.y-e.y)/2+e.y);if(n==="h:v")return[{x:t.x,y:e.y}];if(n==="v:h")return[{x:e.x,y:t.y}];if(n==="h:h")return[{x:i,y:e.y},{x:i,y:t.y}];if(n==="v:v")return[{x:e.x,y:r},{x:t.x,y:r}];throw new Error("invalid directions: can only handle varians of [hv]:[hv]")}function qp(e,t,n){if(n=n||"h:h",!MT(n))throw new Error("unknown directions: <"+n+">: must be specified as <start>:<end> with start/end in { h,v,t,r,b,l }");if(fv(n)){var i=vT(e,t,n),r=bT(e,t,n),o=_T(i,r);return[].concat(i.waypoints,o.waypoints,r.waypoints)}return xT(e,t,n)}function wT(e,t,n){var i=qp(e,t,n);return i.unshift(e),i.push(t),hv(i)}function ET(e,t,n,i,r){var o=r&&r.preferredLayouts||[],a=_0(o,"straight")[0]||"h:h",s=mT[a]||0,c=Zt(e,t,s),u=TT(c,a);n=n||Se(e),i=i||Se(t);var l=u.split(":"),f=dv(n,e,l[0],kT(c)),p=dv(i,t,l[1],c);return wT(f,p,u)}function ST(e,t,n,i,r,o){Ee(n)&&(r=n,o=i,n=Se(e),i=Se(t)),o=j({preferredLayouts:[]},o),r=r||[];var a=o.preferredLayouts,s=a.indexOf("straight")!==-1,c;return c=s&&CT(e,t,n,i,o),c||(c=o.connectionEnd&&AT(t,e,i,r),c)||(c=o.connectionStart&&PT(e,t,n,r),c)?c:!o.connectionStart&&!o.connectionEnd&&r&&r.length?r:ET(e,t,n,i,o)}function RT(e,t,n){return e>=t&&e<=n}function pv(e,t,n){var i={x:"width",y:"height"};return RT(t[e],n[e],n[e]+n[i[e]])}function CT(e,t,n,i,r){var o={},a,s;return s=Zt(e,t),/^(top|bottom|left|right)$/.test(s)?(/top|bottom/.test(s)&&(a="x"),/left|right/.test(s)&&(a="y"),r.preserveDocking==="target"?pv(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:pv(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 Yp(e,t,n,i)}function AT(e,t,n,i){var r=i.slice().reverse();return r=Yp(e,t,n,r),r?r.reverse():null}function Yp(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&&Jo(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(Bh(l[d],f,cv)||Bh(l[d],p,cv))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=Yp(e,t,n,u)),c&&Mi(c)?null:c}function TT(e,t){if(fv(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 MT(e){return e&&/^h|v|t|r|b|l:h|v|t|r|b|l$/.test(e)}function fv(e){return e&&/t|r|b|l/.test(e)}function kT(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 dv(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 hv(e){return e.reduce(function(t,n,i){var r=t[t.length-1],o=e[i+1];return pl(r,o,n,0)||t.push(n),t},[])}var OT=-10,DT=40,LT={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},IT={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},Kp={top:"bottom","top-right":"bottom-left","top-left":"bottom-right",right:"left",bottom:"top","bottom-right":"top-left","bottom-left":"top-right",left:"right"},Ma={top:"t",right:"r",bottom:"b",left:"l"};function Oc(e){this._elementRegistry=e}pe(Oc,sv),Oc.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=mv(r&&r[0],n)),a||(a=mv(r&&r[r.length-1],i)),(v(e,"bpmn:Association")||v(e,"bpmn:DataAssociation"))&&r&&!gv(n,i))return[].concat([o],r.slice(1,-1),[a]);var l=Pm(n,s)?LT:IT;return v(e,"bpmn:MessageFlow")?c=BT(n,i,l):(v(e,"bpmn:SequenceFlow")||gv(n,i))&&(n===i?c={preferredLayouts:GT(n,e,l)}:v(n,"bpmn:BoundaryEvent")?c={preferredLayouts:VT(n,i,a,l)}:ka(n)||ka(i)?c={preferredLayouts:l.subProcess,preserveDocking:jT(n)}:v(n,"bpmn:Gateway")?c={preferredLayouts:l.fromGateway}:v(i,"bpmn:Gateway")?c={preferredLayouts:l.toGateway}:c={preferredLayouts:l.default}),c&&(c=j(c,t),u=hv(ST(n,i,o,a,r,c))),u||[o,a]};function NT(e){var t=e.host;return Zt(Se(e),t,OT)}function BT(e,t,n){return{preferredLayouts:n.messageFlow,preserveDocking:$T(e,t)}}function $T(e,t){return v(t,"bpmn:Participant")?"source":v(e,"bpmn:Participant")?"target":ka(t)?"source":ka(e)||v(t,"bpmn:Event")?"target":v(e,"bpmn:Event")?"source":null}function jT(e){return ka(e)?"target":"source"}function mv(e,t){return e?e.original||e:Se(t)}function gv(e,t){return v(t,"bpmn:Activity")&&v(e,"bpmn:BoundaryEvent")&&t.businessObject.isForCompensation}function ka(e){return v(e,"bpmn:SubProcess")&&We(e)}function Gr(e,t){return e===t}function FT(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 yv(e,t){return Kp[e]===t}function HT(e,t){var n=To(e),i=Kp[n];return t.indexOf(i)!==-1}function zT(e,t){var n=Mo(e),i=Kp[n];return t.indexOf(i)!==-1}function vv(e){return e==="right"||e==="left"}function GT(e,t,n){var i=t.waypoints,r=i&&i.length&&Zt(i[0],e);return r==="top"?n.loop.fromTop:r==="right"?n.loop.fromRight:r==="left"?n.loop.fromLeft:n.loop.fromBottom}function VT(e,t,n,i){var r=Se(e),o=Se(t),a=NT(e),s,c,u=Gr(e.host,t),l=FT(a,["top","right","bottom","left"]),f=Zt(o,r,{x:e.width/2+t.width/2,y:e.height/2+t.height/2});return u?WT(a,l,e,t,n,i):(s=UT(a,f,l,i.isHorizontal),c=qT(a,f,l,i.isHorizontal),[s+":"+c])}function WT(e,t,n,i,r,o){var a=t?e:o.isHorizontal?Mo(e):To(e),s=Ma[a],c;return t?vv(e)?c=bv("y",n,i,r)?"h":o.boundaryLoop.alternateHorizontalSide:c=bv("x",n,i,r)?"v":o.boundaryLoop.alternateVerticalSide:c=o.boundaryLoop.default,[s+":"+c]}function bv(e,t,n,i){var r=DT;return!(Xp(e,i,n,r)||Xp(e,i,{x:n.x+n.width,y:n.y+n.height},r)||Xp(e,i,Se(t),r))}function Xp(e,t,n,i){return Math.abs(t[e]-n[e])<i}function UT(e,t,n,i){if(n)return Ma[e];var r=Mo(e),o=To(e),a=Mo(t),s=To(t);if(i){if(Gr(r,a)||yv(o,s))return Ma[r]}else if(Gr(o,s)||yv(r,a))return Ma[o];return Ma[i?o:r]}function qT(e,t,n,i){if(n)return vv(e)?HT(e,t)||Gr(e,t)?"h":"v":zT(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"}Oc.$inject=["elementRegistry"];function _v(e){return j({original:e.point.original||e.point},e.actual)}function hr(e,t){this._elementRegistry=e,this._graphicsFactory=t}hr.$inject=["elementRegistry","graphicsFactory"],hr.prototype.getCroppedWaypoints=function(e,t,n){t=t||e.source,n=n||e.target;var i=this.getDockingPoint(e,t,!0),r=this.getDockingPoint(e,n),o=e.waypoints.slice(i.idx+1,r.idx);return o.unshift(_v(i)),o.push(_v(r)),o},hr.prototype.getDockingPoint=function(e,t,n){var i=e.waypoints,r,o,a;return r=n?0:i.length-1,o=i[r],a=this._getIntersection(t,e,n),{point:o,actual:a||o,idx:r}},hr.prototype._getIntersection=function(e,t,n){var i=this._getShapePath(e),r=this._getConnectionPath(t);return ea(i,r,n)},hr.prototype._getConnectionPath=function(e){return this._graphicsFactory.getConnectionPath(e)},hr.prototype._getShapePath=function(e){return this._graphicsFactory.getShapePath(e)},hr.prototype._getGfx=function(e){return this._elementRegistry.getGraphics(e)};const Zp={__init__:["modeling","bpmnUpdater"],__depends__:[fP,AP,MP,kP,Oy,OA,LA,FA,Wn,Lp,$y],bpmnFactory:["type",qn],bpmnUpdater:["type",kn],elementFactory:["type",pr],modeling:["type",en],layouter:["type",Oc],connectionDocking:["type",hr]};var YT=10,xv=50,KT=250;function Qp(e,t,n,i){for(var r;r=XT(e,n,t);)n=i(t,n,r);return n}function Jp(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 XT(e,t,n){var i={x:t.x-n.width/2,y:t.y-n.height/2,width:n.width,height:n.height},r=QT(e);return ut(r,function(o){if(o===n)return!1;var a=Zt(o,i,YT);return a==="intersect"})}function ZT(e,t){t||(t={});function n(h){return h.source===e?1:-1}var i=t.defaultDistance||xv,r=t.direction||"e",o=t.filter,a=t.getWeight||n,s=t.maxDistance||KT,c=t.reference||"start";o||(o=tM);function u(h,m){return r==="n"?c==="start"?xe(h).top-xe(m).bottom:c==="center"?xe(h).top-Se(m).y:xe(h).top-xe(m).top:r==="w"?c==="start"?xe(h).left-xe(m).right:c==="center"?xe(h).left-Se(m).x:xe(h).left-xe(m).left:r==="s"?c==="start"?xe(m).top-xe(h).bottom:c==="center"?Se(m).y-xe(h).bottom:xe(m).bottom-xe(h).bottom:c==="start"?xe(m).left-xe(h).right:c==="center"?Se(m).x-xe(h).right:xe(m).right-xe(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,S=m.weight;return g<0||g>s||(h[String(g)]||(h[String(g)]=0),h[String(g)]+=1*S,(!h.distance||h[h.distance]<h[String(g)])&&(h.distance=g)),h},{});return d.distance||i}function QT(e){var t=ef(e);return e.host&&(t=t.concat(ef(e.host))),e.attachers&&(t=t.concat(e.attachers.reduce(function(n,i){return n.concat(ef(i))},[]))),t}function ef(e){return eM(e).concat(JT(e))}function JT(e){return e.incoming.map(function(t){return t.source})}function eM(e){return e.outgoing.map(function(t){return t.target})}function tM(){return!0}var nM=100;function wv(e,t,n){e.on("autoPlace",nM,function(i){var r=i.shape,o=i.source;return iM(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}}wv.$inject=["eventBus","modeling","canvas"];function iM(e,t,n){n||(n={});var i=n.defaultDistance||xv,r=Se(e),o=xe(e);return{x:o.right+i+t.width/2,y:r.y}}function Ev(e,t){e.on("autoPlace.end",500,function(n){t.select(n.shape)})}Ev.$inject=["eventBus","selection"];const rM={__init__:["autoPlaceSelectionBehavior"],autoPlace:["type",wv],autoPlaceSelectionBehavior:["type",Ev]};function Sv(e,t,n){var i=Pm(e,n);if(v(t,"bpmn:TextAnnotation"))return aM(e,t,i);if(Fe(t,["bpmn:DataObjectReference","bpmn:DataStoreReference"]))return sM(e,t,i);if(v(t,"bpmn:FlowNode"))return oM(e,t,i)}function oM(e,t,n){var i=xe(e),r=Se(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=ZT(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=Zt(e,e.host,-25),u.indexOf(o.boundaryOrientation)!==-1&&(s*=-1));var l=n?{x:i.right+a+t.width/2,y:r.y+Rv(u,c,o)}:{x:r.x+Rv(u,c,o),y:i.bottom+a+t.height/2},f={margin:s,minDistance:c},p=n?{y:f}:{x:f};return Qp(e,t,l,Jp(p))}function Rv(e,t,n){return e.includes(n.start)?-1*t:e.includes(n.end)?t:0}function aM(e,t,n){var i=xe(e),r=n?{x:i.right+t.width/2,y:i.top-50-t.height/2}:{x:i.right+50+t.width/2,y:i.bottom+t.height/2};at(e)&&(r=Se(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 Qp(e,t,r,Jp(a))}function sM(e,t,n){var i=xe(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 Qp(e,t,r,Jp(a))}function Cv(e,t){e.on("autoPlace",function(n){var i=n.shape,r=n.source;return Sv(r,i,t)})}Cv.$inject=["eventBus","elementRegistry"];const Dc={__depends__:[rM],__init__:["bpmnAutoPlace"],bpmnAutoPlace:["type",Cv]},Pv=[Rm,aa,Zp,Dc];function cM(e={}){Ed(globalThis,e.dom);const t=document.createElement("div");return document.body.appendChild(t),new fo({container:t,moddleExtensions:e.moddleExtensions??rs,additionalModules:[...Pv,...e.additionalModules??[]]})}var uM=new Po("ov"),lM=500;function Yt(e,t,n,i){this._eventBus=t,this._canvas=n,this._elementRegistry=i,this._ids=uM,this._overlayDefaults=j({show:null,scale:!0},e&&e.defaults),this._overlays={},this._overlayContainers=[],this._overlayRoot=pM(n.getContainer()),this._init()}Yt.$inject=["config.overlays","eventBus","canvas","elementRegistry"],Yt.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?He(t.overlays,no({type:e.type})):t.overlays.slice():[]}else return e.type?He(this._overlays,no({type:e.type})):e.id?this._overlays[e.id]:null},Yt.prototype.add=function(e,t,n){if(Vt(t)&&(n=t,t=null),e.id||(e=this._elementRegistry.get(e)),!n.position)throw new Error("must specifiy overlay position");if(!n.html)throw new Error("must specifiy overlay html");if(!e)throw new Error("invalid element specified");var i=this._ids.next();return n=j({},this._overlayDefaults,n,{id:i,type:t,element:e,html:n.html}),this._addOverlay(n),i},Yt.prototype.remove=function(e){var t=this.get(e)||[];Ee(t)||(t=[t]);var n=this;D(t,function(i){var r=n._getOverlayContainer(i.element,!0);if(i&&(li(i.html),li(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)}})},Yt.prototype.isShown=function(){return this._overlayRoot.style.display!=="none"},Yt.prototype.show=function(){Lc(this._overlayRoot)},Yt.prototype.hide=function(){Lc(this._overlayRoot,!1)},Yt.prototype.clear=function(){this._overlays={},this._overlayContainers=[],ys(this._overlayRoot)},Yt.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}Av(n,i,r),sn(e.html,"data-container-id",t.id)},Yt.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}Av(n,r||0,o||0),this._updateOverlayVisibilty(e,this._canvas.viewbox())},Yt.prototype._createOverlayContainer=function(e){var t=ft('<div class="djs-overlays" />');dn(t,{position:"absolute"}),this._overlayRoot.appendChild(t);var n={html:t,element:e,overlays:[]};return this._updateOverlayContainer(n),this._overlayContainers.push(n),n},Yt.prototype._updateRoot=function(e){var t=e.scale||1,n="matrix("+[t,0,0,t,-1*e.x*t,-1*e.y*t].join(",")+")";Tv(this._overlayRoot,n)},Yt.prototype._getOverlayContainer=function(e,t){var n=ut(this._overlayContainers,function(i){return i.element===e});return!n&&!t?this._createOverlayContainer(e):n},Yt.prototype._addOverlay=function(e){var t=e.id,n=e.element,i=e.html,r,o;i.get&&i.constructor.prototype.jquery&&(i=i.get(0)),wn(i)&&(i=ft(i)),o=this._getOverlayContainer(n),r=ft('<div class="djs-overlay" data-overlay-id="'+t+'">'),dn(r,{position:"absolute"}),r.appendChild(i),e.type&&mt(r).add("djs-overlay-"+e.type);var a=this._canvas.findRoot(n),s=this._canvas.getRootElement();Lc(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())},Yt.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&&(Bt(r)&&r>t.scale||Bt(o)&&o<t.scale))&&(c=!1),Lc(a,c),this._updateOverlayScale(e,t)},Yt.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),Bt(i)&&t.scale<i&&(a=(1/t.scale||1)*i),Bt(r)&&t.scale>r&&(a=(1/t.scale||1)*r)),Bt(a)&&(s="scale("+a+","+a+")"),Tv(o,s)},Yt.prototype._updateOverlaysVisibilty=function(e){var t=this;D(this._overlays,function(n){t._updateOverlayVisibilty(n,e)})},Yt.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});D(o,function(c){t.remove(c.id)});var a=t._getOverlayContainer(r);if(a){li(a.html);var s=t._overlayContainers.indexOf(a);s!==-1&&t._overlayContainers.splice(s,1)}}),e.on("element.changed",lM,function(i){var r=i.element,o=t._getOverlayContainer(r,!0);o&&(D(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 pM(e){var t=ft('<div class="djs-overlay-container" />');return dn(t,{position:"absolute",width:0,height:0}),e.insertBefore(t,e.firstChild),t}function Av(e,t,n){dn(e,{left:t+"px",top:n+"px"})}function Lc(e,t){e.style.display=t===!1?"none":""}function Tv(e,t){e.style["transform-origin"]="top left",["","-ms-","-webkit-"].forEach(function(n){e.style[n+"transform"]=t})}const Ic={__init__:["overlays"],overlays:["type",Yt]};function tf(e,t){t.invoke(Q,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)})}pe(tf,Q),tf.$inject=["canvas","injector"];const fM={__init__:["rootElementsBehavior"],rootElementsBehavior:["type",tf]};function Oa(e){return CSS.escape(e)}var dM={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"};function Mv(e){return e=""+e,e&&e.replace(/[&<>"']/g,function(t){return dM[t]})}var hM="bjs-breadcrumbs-shown";function kv(e,t,n){var i=ft('<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=ee(u),f=ut(a,function(p){return p===l});f&&s()});function s(c){c&&(a=mM(c));var u=a.flatMap(function(f){var p=n.findRoot(mi(f))||n.findRoot(f.id);if(!p&&v(f,"bpmn:Process")){var d=t.find(function(g){var S=ee(g);return S&&S.get("processRef")===f});p=d&&n.findRoot(d.id)}if(!p)return[];var h=Mv(f.name||f.id),m=ft('<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(hM,l),u.forEach(function(f){i.appendChild(f)})}e.on("root.set",function(c){s(c.element)})}kv.$inject=["eventBus","elementRegistry","canvas"];function mM(e){for(var t=ee(e),n=[],i=t;i;i=i.$parent)(v(i,"bpmn:SubProcess")||v(i,"bpmn:Process"))&&n.push(i);return n.reverse()}function Ov(e,t){var n=null,i=new gM;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})}Ov.$inject=["eventBus","canvas"];function gM(){this._entries=[],this.set=function(e,t){var n=!1;for(var i in this._entries)if(this._entries[i][0]===e){this._entries[i][1]=t,n=!0;break}n||this._entries.push([e,t])},this.get=function(e){for(var t in this._entries)if(this._entries[t][0]===e)return this._entries[t][1];return null},this.clear=function(){this._entries.length=0},this.remove=function(e){var t=-1;for(var n in this._entries)if(this._entries[n][0]===e){t=n;break}t!==-1&&this._entries.splice(t,1)}}var Dv={x:180,y:160};function 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),vM(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=yM(e),i={x:n.x-Dv.x,y:n.y-Dv.y};t.forEach(function(r){r.waypoint?r.waypoint.forEach(function(o){o.x=o.x-i.x,o.y=o.y-i.y}):r.bounds&&(r.bounds.x=r.bounds.x-i.x,r.bounds.y=r.bounds.y-i.y)})},Vr.prototype._moveToDiPlane=function(e,t){var n=Lv(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 Lv(e){return v(e,"bpmndi:BPMNDiagram")?e:Lv(e.$parent)}function yM(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=xe(n.bounds);t.top=Math.min(i.top,t.top),t.left=Math.min(i.left,t.left)}}),Cs(t)}function vM(e,t){var n=e.$parent;return!(!v(n,"bpmn:SubProcess")||n===t.bpmnElement||Fe(e,["bpmn:DataInputAssociation","bpmn:DataOutputAssociation"]))}var Nc=250,bM='<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>',_M="bjs-drilldown-empty";function mr(e,t,n,i,r){Q.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",Nc,function(a){var s=a.shape;o._canDrillDown(s)?o._addOverlay(s):o._removeOverlay(s)},!0),this.reverted("shape.toggleCollapse",Nc,function(a){var s=a.shape;o._canDrillDown(s)?o._addOverlay(s):o._removeOverlay(s)},!0),this.executed(["shape.create","shape.move","shape.delete"],Nc,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"],Nc,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)})})}pe(mr,Q),mr.prototype._updateDrilldownOverlay=function(e){var t=this._canvas;if(e){var n=t.findRoot(e);n&&this._updateOverlayVisibility(n)}},mr.prototype._canDrillDown=function(e){var t=this._canvas;return v(e,"bpmn:SubProcess")&&t.findRoot(mi(e))},mr.prototype._updateOverlayVisibility=function(e){var t=this._overlays,n=ee(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(_M,!r)}},mr.prototype._addOverlay=function(e){var t=this._canvas,n=this._overlays,i=ee(e),r=n.get({element:e,type:"drilldown"});r.length&&this._removeOverlay(e);var o=ft('<button type="button" class="bjs-drilldown">'+bM+"</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(mi(e)))}),n.add(e,"drilldown",{position:{bottom:-7,right:-8},html:o}),this._updateOverlayVisibility(e)},mr.prototype._removeOverlay=function(e){var t=this._overlays;t.remove({element:e,type:"drilldown"})},mr.$inject=["canvas","eventBus","elementRegistry","overlays","translate"];const xM={__depends__:[Ic,Lp,fM],__init__:["drilldownBreadcrumbs","drilldownOverlayBehavior","drilldownCentering","subprocessCompatibility"],drilldownBreadcrumbs:["type",kv],drilldownCentering:["type",Ov],drilldownOverlayBehavior:["type",mr],subprocessCompatibility:["type",Vr]};function gr(e){yt.call(this,e)}pe(gr,yt),gr.prototype._modules=[Rm,xM,Ic,Wn,aa],gr.prototype._moddleExtensions={};var Bc="keyboard.keydown",wM="keyboard.keyup",EM=1e3,Iv="Keyboard binding is now implicit; explicit binding to an element got removed. For more information, see https://github.com/bpmn-io/diagram-js/issues/661";function hn(e,t){var n=this;this._config=e=e||{},this._eventBus=t,this._keydownHandler=this._keydownHandler.bind(this),this._keyupHandler=this._keyupHandler.bind(this),t.on("diagram.destroy",function(){n._fire("destroy"),n.unbind()}),e.bindTo&&console.error("unsupported configuration <keyboard.bindTo>",new Error(Iv));var i=e&&e.bind!==!1;t.on("canvas.init",function(r){n._target=r.svg,i&&n.bind(),n._fire("init")})}hn.$inject=["config.keyboard","eventBus"],hn.prototype._keydownHandler=function(e){this._keyHandler(e,Bc)},hn.prototype._keyupHandler=function(e){this._keyHandler(e,wM)},hn.prototype._keyHandler=function(e,t){var n;if(!this._isEventIgnored(e)){var i={keyEvent:e};n=this._eventBus.fire(t||Bc,i),n&&e.preventDefault()}},hn.prototype._isEventIgnored=function(e){return!1},hn.prototype.bind=function(e){e&&console.error("unsupported argument <node>",new Error(Iv)),this.unbind(),e=this._node=this._target,Me.bind(e,"keydown",this._keydownHandler),Me.bind(e,"keyup",this._keyupHandler),this._fire("bind")},hn.prototype.getBinding=function(){return this._node},hn.prototype.unbind=function(){var e=this._node;e&&(this._fire("unbind"),Me.unbind(e,"keydown",this._keydownHandler),Me.unbind(e,"keyup",this._keyupHandler)),this._node=null},hn.prototype._fire=function(e){this._eventBus.fire("keyboard."+e,{node:this._node})},hn.prototype.addListener=function(e,t,n){Wt(e)&&(n=t,t=e,e=EM),this._eventBus.on(n||Bc,e,t)},hn.prototype.removeListener=function(e,t){this._eventBus.off(t||Bc,e)},hn.prototype.hasModifier=VP,hn.prototype.isCmd=Tn,hn.prototype.isShift=Ep,hn.prototype.isKey=Ft;var SM=500;function ko(e,t){var n=this;e.on("editorActions.init",SM,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(KP(r))return t.trigger("undo"),!0}),n("redo",function(i){var r=i.keyEvent;if(XP(r))return t.trigger("redo"),!0}),n("copy",function(i){var r=i.keyEvent;if(WP(r))return t.trigger("copy"),!0}),n("paste",function(i){var r=i.keyEvent;if(UP(r))return t.trigger("paste"),!0}),n("duplicate",function(i){var r=i.keyEvent;if(qP(r))return t.trigger("duplicate"),!0}),n("cut",function(i){var r=i.keyEvent;if(YP(r))return t.trigger("cut"),!0}),n("stepZoom",function(i){var r=i.keyEvent;if(Ft(["+","Add","="],r)&&Tn(r))return t.trigger("stepZoom",{value:1}),!0}),n("stepZoom",function(i){var r=i.keyEvent;if(Ft(["-","Subtract"],r)&&Tn(r))return t.trigger("stepZoom",{value:-1}),!0}),n("zoom",function(i){var r=i.keyEvent;if(Ft("0",r)&&Tn(r))return t.trigger("zoom",{value:1}),!0}),n("removeSelection",function(i){var r=i.keyEvent;if(Ft(["Backspace","Delete","Del"],r))return t.trigger("removeSelection"),!0})};const nf={__init__:["keyboard","keyboardBindings"],keyboard:["type",hn],keyboardBindings:["type",ko]};var RM={moveSpeed:50,moveSpeedAccelerated:200};function Nv(e,t,n){var i=this;this._config=j({},RM,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})}}Nv.$inject=["config.keyboardMove","keyboard","canvas"];const Bv={__depends__:[nf],__init__:["keyboardMove"],keyboardMove:["type",Nv]};var CM=15;function $v(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=ti(l,c);if(!n.dragging&&PM(f)>CM&&(n.dragging=!0,u===0&&py(e),lc("grab")),n.dragging){var p=n.last||n.start;f=ti(l,p),t.scroll({dx:f.x,dy:f.y}),n.last=l}s.preventDefault()}function o(s){Me.unbind(document,"mousemove",r),Me.unbind(document,"mouseup",o),n=null,ly()}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)},Me.bind(document,"mousemove",r),Me.bind(document,"mouseup",o),!0}}this.isActive=function(){return!!n}}$v.$inject=["eventBus","canvas"];function PM(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}const jv={__init__:["moveCanvas"],moveCanvas:["type",$v]};function Fv(e,t){var n=_l(e.min),i=_l(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 TM=Math.sign||function(e){return e>=0?1:-1},rf={min:.2,max:4},Hv=10,MM=.1,kM=.75;function vi(e,t,n){e=e||{},this._enabled=!1,this._canvas=n,this._container=n._container,this._handleWheel=vn(this._handleWheel,this),this._totalDelta=0,this._scale=e.scale||kM;var i=this;t.on("canvas.mouseover",function(){i._init(e.enabled!==!1)}),t.on("canvas.mouseout",function(){i._init(!1)})}vi.$inject=["config.zoomScroll","eventBus","canvas"],vi.prototype.scroll=function(t){this._canvas.scroll(t)},vi.prototype.reset=function(){this._canvas.zoom("fit-viewport")},vi.prototype.zoom=function(t,n){var i=Fv(rf,Hv*2);this._totalDelta+=t,Math.abs(this._totalDelta)>MM&&(this._zoom(t,n,i),this._totalDelta=0)},vi.prototype._handleWheel=function(t){if(this._enabled){var n=this._container;t.preventDefault();var i=t.ctrlKey||vg()&&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))*TM(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)}},vi.prototype.stepZoom=function(t,n){var i=Fv(rf,Hv);this._zoom(t,n,i)},vi.prototype._zoom=function(e,t,n){var i=this._canvas,r=e>0?1:-1,o=_l(i.zoom()),a=Math.round(o/n)*n;a+=n*r;var s=Math.pow(10,a);i.zoom(AM(rf,s),t)},vi.prototype.toggle=function(t){var n=this._container,i=this._handleWheel,r=this._enabled;return typeof t>"u"&&(t=!r),r!==t&&Me[t?"bind":"unbind"](n,"wheel",i,!1),this._enabled=t,t},vi.prototype._init=function(e){this.toggle(e)};const zv={__init__:["zoomScroll"],zoomScroll:["type",vi]};function Da(e){gr.call(this,e)}pe(Da,gr),Da.prototype._navigationModules=[Bv,jv,zv],Da.prototype._modules=[].concat(gr.prototype._modules,Da.prototype._navigationModules);function of(e){return e&&e[e.length-1]}function Gv(e){return e.y}function Vv(e){return e.x}var OM={left:Vv,center:Vv,right:function(e){return e.x+e.width},top:Gv,middle:Gv,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=of(t),o[e]=l[i]+l[r];else if(this._isType(e,["center","middle"])){if(D(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=ri(a,function(p){return p.elements.length>1&&(s=!0),p.elements.length}),s)return o[e]=of(c).center,o;u=t[0],t=ri(t,function(p){return p[i]+p[r]}),l=of(t),o[e]=f(u,l)}return o},Oo.prototype.trigger=function(e,t){var n=this._modeling,i,r=He(e,function(c){return!(c.waypoints||c.host||c.labelTarget)});if(i=this._rules.allowed("elements.align",{elements:r}),Ee(i)&&(r=i),!(r.length<2||!i)){var o=OM[t],a=ri(r,o),s=this._alignmentPosition(t,a);n.alignElements(a,s)}};const DM={__init__:["alignElements"],alignElements:["type",Oo]},LM=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=LM.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=IM();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 IM(){const e={};return e.promise=new Promise((t,n)=>{e.resolve=t,e.reject=n}),e}const NM={scheduler:["type",Do]};var BM="djs-element-hidden",$c=".entry",$M=1e3,Wv=8,jM=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=Ee(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=Ee(i.target)?i.target:[i.target];r.includes(n)&&e._updateVisibility()}}),this._container=this._createContainer()},Ot.prototype._createContainer=function(){var e=ft('<div class="djs-context-pad-parent"></div>');return this._canvas.getContainer().appendChild(e),e},Ot.prototype.registerProvider=function(e,t){t||(t=e,e=$M),this._eventBus.on("contextPad.getProviders",e,function(n){n.providers.push(t)})},Ot.prototype.getEntries=function(e){var t=this._getProviders(),n=Ee(e)?"getMultiElementContextPadEntries":"getContextPadEntries",i={};return D(t,function(r){if(Wt(r[n])){var o=r[n](e);Wt(o)?i=o(i):D(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=sn(a,"data-action"),o=t.originalEvent||t,e==="mouseover"){this._timeout=setTimeout(function(){i._mouseout=i.triggerEntry(r,"hover",o,n)},jM);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(Wt(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;D(t,function(r,o){var a=r.group||"default",s=ft(r.html||'<div class="entry" draggable="true"></div>'),c;sn(s,"data-action",o),c=ot("[data-group="+Oa(a)+"]",n),c||(c=ft('<div class="group"></div>'),sn(c,"data-group",a),n.appendChild(c)),c.appendChild(s),r.className&&FM(s,r.className),r.title&&sn(s,"title",r.title),r.imageUrl&&(i=ft("<img>"),sn(i,"src",r.imageUrl),i.style.width="100%",i.style.height="100%",s.appendChild(i))}),mt(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=ft('<div class="djs-context-pad"></div>');return Cn.bind(n,$c,"click",function(i){t.trigger("click",i)}),Cn.bind(n,$c,"dragstart",function(i){t.trigger("dragstart",i)}),Cn.bind(n,$c,"mouseover",function(i){t.trigger("mouseover",i)}),Cn.bind(n,$c,"mouseout",function(i){t.trigger("mouseout",i)}),Me.bind(n,"mousedown",function(i){i.stopPropagation()}),this._container.appendChild(n),this._eventBus.fire("contextPad.create",{target:e,pad:n}),n},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()&&zM(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 Ee(e)!==Ee(n)?!1:Ee(e)?e.length===n.length&&Pr(e,function(i){return n.includes(i)}):n===e},Ot.prototype.isShown=function(){return this.isOpen()&&mt(this._current.html).has("open")},Ot.prototype.show=function(){this.isOpen()&&(mt(this._current.html).add("open"),this._updatePosition(),this._eventBus.fire("contextPad.show",{current:this._current}))},Ot.prototype.hide=function(){this.isOpen()&&(mt(this._current.html).remove("open"),this._eventBus.fire("contextPad.hide",{current:this._current}))},Ot.prototype._getPosition=function(e){if(!Ee(e)&&at(e)){var t=this._canvas.viewbox(),n=HM(e),i=n.x*t.scale-t.x*t.scale,r=n.y*t.scale-t.y*t.scale;return{left:i+Wv*this._canvas.zoom(),top:r}}var o=this._canvas.getContainer(),a=o.getBoundingClientRect(),s=this._getTargetBounds(e);return{left:s.right-a.left+Wv*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=Ee(n)?n:[n],r=i.some(function(o){return t._canvas.hasMarker(o,BM)});r?t.hide():t.show()}};this._scheduler.schedule(e,"ContextPad#_updateVisibility")},Ot.prototype._getTargetBounds=function(e){var t=this,n=Ee(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 FM(e,t){var n=mt(e);t=Ee(t)?t:t.split(/\s+/g),t.forEach(function(i){n.add(i)})}function HM(e){return e.waypoints[e.waypoints.length-1]}function zM(e,t){return e=Ee(e)?e:[e],t=Ee(t)?t:[t],e.length===t.length&&Pr(e,function(n){return t.includes(n)})}const Uv={__depends__:[uc,NM,Ic],contextPad:["type",Ot]};var jc,bt,qv,yr,Yv,Kv,Xv,af,Fc,La,Zv,sf,cf,uf,Hc={},zc=[],GM=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,Gc=Array.isArray;function Fi(e,t){for(var n in t)e[n]=t[n];return e}function lf(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function Qv(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?jc.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 Vc(e,a,i,r,null)}function Vc(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??++qv,__i:-1,__u:0};return r==null&&bt.vnode!=null&&bt.vnode(o),o}function Wc(e){return e.children}function Uc(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 VM(e){if(e.__P&&e.__d){var t=e.__v,n=t.__e,i=[],r=[],o=Fi({},t);o.__v=t.__v+1,bt.vnode&&bt.vnode(o),pf(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,ab(i,o,r),t.__e=t.__=null,o.__e!=n&&Jv(o)}}function Jv(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}),Jv(e)}function eb(e){(!e.__d&&(e.__d=!0)&&yr.push(e)&&!qc.__r++||Yv!=bt.debounceRendering)&&((Yv=bt.debounceRendering)||Kv)(qc)}function qc(){try{for(var e,t=1;yr.length;)yr.length>t&&yr.sort(Xv),e=yr.shift(),t=yr.length,VM(e)}finally{yr.length=qc.__r=0}}function tb(e,t,n,i,r,o,a,s,c,u,l){var f,p,d,h,m,g,S=i&&i.__k||zc,E=t.length;for(c=WM(n,t,S,c,E),f=0;f<E;f++)(d=n.__k[f])!=null&&(p=d.__i!=-1&&S[d.__i]||Hc,d.__i=f,g=pf(e,d,p,r,o,a,s,c,u,l),h=d.__e,d.ref&&p.ref!=d.ref&&(p.ref&&ff(p.ref,null,d),l.push(d.ref,d.__c||h,d)),m==null&&h!=null&&(m=h),4&d.__u?(c=nb(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 WM(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]=Vc(null,a,null,null,null):Gc(a)?a=e.__k[o]=Vc(Wc,{children:a},null,null,null):a.constructor===void 0&&a.__b>0?a=e.__k[o]=Vc(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=UM(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)),cb(s,s));return i}function nb(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=nb(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 UM(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 ib(e,t,n){t[0]=="-"?e.setProperty(t,n??""):e[t]=n==null?"":typeof n!="number"||GM.test(t)?n:n+"px"}function Yc(e,t,n,i,r){var o,a;e:if(t=="style")if(typeof n=="string")e.style.cssText=n;else{if(typeof i=="string"&&(e.style.cssText=i=""),i)for(t in i)n&&t in n||ib(e.style,t,"");if(n)for(t in n)i&&n[t]==i[t]||ib(e.style,t,n[t])}else if(t[0]=="o"&&t[1]=="n")o=t!=(t=t.replace(Zv,"$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[La]=i[La]:(n[La]=sf,e.addEventListener(t,o?uf:cf,o)):e.removeEventListener(t,o?uf:cf,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 rb(e){return function(t){if(this.l){var n=this.l[t.type+e];if(t[Fc]==null)t[Fc]=sf++;else if(t[Fc]<n[La])return;return n(bt.event?bt.event(t):t)}}}function pf(e,t,n,i,r,o,a,s,c,u){var l,f,p,d,h,m,g,S,E,x,w,C,P,L,T,B,k=t.type;if(t.constructor!==void 0)return null;128&n.__u&&(c=!!(32&n.__u),o=[s=t.__e=n.__e]),(l=bt.__b)&&l(t);e:if(typeof k=="function"){f=a.length;try{if(E=t.props,x=k.prototype&&k.prototype.render,w=(l=k.contextType)&&i[l.__c],C=l?w?w.props.value:l.__:i,n.__c?S=(p=t.__c=n.__c).__=p.__E:(x?t.__c=p=new k(E,C):(t.__c=p=new Uc(E,C),p.constructor=k,p.render=YM),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&&k.getDerivedStateFromProps!=null&&(p.__s==p.state&&(p.__s=Fi({},p.__s)),Fi(p.__s,k.getDerivedStateFromProps(E,p.__s))),h=p.props,m=p.state,p.__v=t,d)x&&k.getDerivedStateFromProps==null&&p.componentWillMount!=null&&p.componentWillMount(),x&&p.componentDidMount!=null&&p.__h.push(p.componentDidMount);else{if(x&&k.getDerivedStateFromProps==null&&E!==h&&p.componentWillReceiveProps!=null&&p.componentWillReceiveProps(E,C),t.__v==n.__v||!p.__e&&p.shouldComponentUpdate!=null&&p.shouldComponentUpdate(E,p.__s,C)===!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(O){O&&(O.__=t)}),zc.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,C),x&&p.componentDidUpdate!=null&&p.__h.push(function(){p.componentDidUpdate(h,m,g)})}if(p.context=C,p.props=E,p.__P=e,p.__e=!1,P=bt.__r,L=0,x)p.state=p.__s,p.__d=!1,P&&P(t),l=p.render(p.props,p.state,p.context),zc.push.apply(p.__h,p._sb),p._sb=[];else do p.__d=!1,P&&P(t),l=p.render(p.props,p.state,p.context),p.state=p.__s;while(p.__d&&++L<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===Wc&&l.key==null?sb(l.props.children):l,s=tb(e,Gc(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),S&&(p.__E=p.__=null)}catch(O){if(a.length=f,t.__v=null,c||o!=null){if(O.then){for(t.__u|=c?160:128;s&&s.nodeType==8&&s.nextSibling;)s=s.nextSibling;o!=null&&(o[o.indexOf(s)]=null),t.__e=s}else if(o!=null)for(B=o.length;B--;)lf(o[B])}else t.__e=n.__e;t.__k==null&&(t.__k=n.__k||[]),O.then||ob(t),bt.__e(O,t,n)}}else o==null&&t.__v==n.__v?(t.__k=n.__k,t.__e=n.__e):s=t.__e=qM(n.__e,t,n,i,r,o,a,c,u);return(l=bt.diffed)&&l(t),128&t.__u?void 0:s}function ob(e){e&&(e.__c&&(e.__c.__e=!0),e.__k&&e.__k.some(ob))}function ab(e,t,n){for(var i=0;i<n.length;i++)ff(n[i],n[++i],n[++i]);bt.__c&&bt.__c(t,e),e.some(function(r){try{e=r.__h,r.__h=[],e.some(function(o){o.call(r)})}catch(o){bt.__e(o,r.__v)}})}function sb(e){return typeof e!="object"||e==null||e.__b>0?e:Gc(e)?e.map(sb):e.constructor!==void 0?null:Fi({},e)}function qM(e,t,n,i,r,o,a,s,c){var u,l,f,p,d,h,m,g=n.props||Hc,S=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(S);e=document.createElementNS(r,E,S.is&&S),s&&(bt.__m&&bt.__m(t,o),s=!1),o=null}if(E==null)g===S||s&&e.data==S||(e.data=S);else{if(o=E=="textarea"&&S.defaultValue!=null?null:o&&jc.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 S||u=="value"&&"defaultValue"in S||u=="checked"&&"defaultChecked"in S||Yc(e,u,null,d,r);for(u in S)d=S[u],u=="children"?p=d:u=="dangerouslySetInnerHTML"?l=d:u=="value"?h=d:u=="checked"?m=d:s&&typeof d!="function"||g[u]===d||Yc(e,u,d,g[u],r);if(l)s||f&&(l.__html==f.__html||l.__html==e.innerHTML)||(e.innerHTML=l.__html),t.__k=[];else if(f&&(e.innerHTML=""),tb(t.type=="template"?e.content:e,Gc(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--;)lf(o[u]);s&&E!="textarea"||(u="value",E=="progress"&&h==null?e.removeAttribute("value"):h!=null&&(h!==e[u]||E=="progress"&&!h||E=="option"&&h!=g[u])&&Yc(e,u,h,g[u],r),u="checked",m!=null&&m!=e[u]&&Yc(e,u,m,g[u],r))}return e}function ff(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){bt.__e(r,n)}}function cb(e,t,n){var i,r;if(bt.unmount&&bt.unmount(e),(i=e.ref)&&(i.current&&i.current!=e.__e||ff(i,null,t)),(i=e.__c)!=null){if(i.componentWillUnmount)try{i.componentWillUnmount()}catch(o){bt.__e(o,t)}i.base=i.__P=i.__n=null}if(i=e.__k)for(r=0;r<i.length;r++)i[r]&&cb(i[r],t,n||typeof e.type!="function");n||lf(e.__e),e.__c=e.__=e.__e=void 0}function YM(e,t,n){return this.constructor(e,n)}function ub(e,t,n){var i,r,o,a;t==document&&(t=document.documentElement),bt.__&&bt.__(e,t),r=(i=!1)?null:t.__k,o=[],a=[],pf(t,e=t.__k=Qv(Wc,null,[e]),r||Hc,Hc,t.namespaceURI,r?null:t.firstChild?jc.call(t.childNodes):null,o,r?r.__e:t.firstChild,i,a),ab(o,e,a),e.props.children=null}jc=zc.slice,bt={__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}},qv=0,Uc.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),eb(this))},Uc.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),eb(this))},Uc.prototype.render=Wc,yr=[],Kv=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,Xv=function(e,t){return e.__v.__b-t.__v.__b},qc.__r=0,af=Math.random().toString(8),Fc="__d"+af,La="__a"+af,Zv=/(PointerCapture)$|Capture$/i,sf=0,cf=rb(!1),uf=rb(!0);var lb=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,lb(e,s,n,["",null])),i.push(r),s[0]?t[0]|=2:(t[o-2]=0,t[o]=r)):i.push(s)}return i},pb=new Map;function KM(e){var t=pb.get(this);return t||(t=new Map,pb.set(this,t)),(t=lb(this,t.get(e)||(t.set(e,t=(function(n){for(var i,r,o=1,a="",s="",c=[0],u=function(p){o===1&&(p||(a=a.replace(/^\s*\n\s*|\s*\n\s*$/g,"")))?c.push(0,p,a):o===3&&(p||a)?(c.push(3,p,a),o=2):o===2&&a==="..."&&p?c.push(4,p,0):o===2&&a&&!p?c.push(5,0,!0,a):o>=5&&((a||!p&&o===5)&&(c.push(o,0,a,r),o=6),p&&(c.push(o,p,0,r),o=6)),a=""},l=0;l<n.length;l++){l&&(o===1&&u(),u(l));for(var f=0;f<n[l].length;f++)i=n[l][f],o===1?i==="<"?(u(),c=[c],o=3):a+=i:o===4?a==="--"&&i===">"?(o=1,a=""):a=i+a[0]:s?i===s?s="":a+=i:i==='"'||i==="'"?s=i:i===">"?(u(),o=1):o&&(i==="="?(o=5,r=a,a=""):i==="/"&&(o<5||n[l][f+1]===">")?(u(),o===3&&(c=c[0]),o=c,(c=c[0]).push(2,0,o),o=0):i===" "||i===" "||i===`
11
+ `||i==="\r"?(u(),o=2):a+=i),o===3&&a==="!--"&&(o=4,c=c[0])}return u(),c})(e)),t),arguments,[])).length>1?t:t[0]}var ct=KM.bind(Qv),Lo,Dt,df,fb,Ia=0,db=[],Ht=bt,hb=Ht.__b,mb=Ht.__r,gb=Ht.diffed,yb=Ht.__c,vb=Ht.unmount,bb=Ht.__;function Kc(e,t){Ht.__h&&Ht.__h(Dt,e,Ia||t),Ia=0;var n=Dt.__H||(Dt.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({}),n.__[e]}function hf(e){return Ia=1,XM(xb,e)}function XM(e,t,n){var i=Kc(Lo++,2);if(i.t=e,!i.__c&&(i.__=[xb(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 Xc(e,t){var n=Kc(Lo++,3);!Ht.__s&&yf(n.__H,t)&&(n.__=e,n.u=t,Dt.__H.__h.push(n))}function mf(e,t){var n=Kc(Lo++,4);!Ht.__s&&yf(n.__H,t)&&(n.__=e,n.u=t,Dt.__h.push(n))}function Zc(e){return Ia=5,Hi(function(){return{current:e}},[])}function Hi(e,t){var n=Kc(Lo++,7);return yf(n.__H,t)&&(n.__=e(),n.__H=t,n.__h=e),n.__}function Na(e,t){return Ia=8,Hi(function(){return e},t)}function ZM(){for(var e;e=db.shift();){var t=e.__H;if(e.__P&&t)try{t.__h.some(Qc),t.__h.some(gf),t.__h=[]}catch(n){t.__h=[],Ht.__e(n,e.__v)}}}Ht.__b=function(e){Dt=null,hb&&hb(e)},Ht.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),bb&&bb(e,t)},Ht.__r=function(e){mb&&mb(e),Lo=0;var t=(Dt=e.__c).__H;t&&(df===Dt?(t.__h=[],Dt.__h=[],t.__.some(function(n){n.__N&&(n.__=n.__N),n.u=n.__N=void 0})):(t.__h.some(Qc),t.__h.some(gf),t.__h=[],Lo=0)),df=Dt},Ht.diffed=function(e){gb&&gb(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(db.push(t)!==1&&fb===Ht.requestAnimationFrame||((fb=Ht.requestAnimationFrame)||QM)(ZM)),t.__H.__.some(function(n){n.u&&(n.__H=n.u,n.u=void 0)})),df=Dt=null},Ht.__c=function(e,t){t.some(function(n){try{n.__h.some(Qc),n.__h=n.__h.filter(function(i){return!i.__||gf(i)})}catch(i){t.some(function(r){r.__h&&(r.__h=[])}),t=[],Ht.__e(i,n.__v)}}),yb&&yb(e,t)},Ht.unmount=function(e){vb&&vb(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.some(function(i){try{Qc(i)}catch(r){t=r}}),n.__H=void 0,t&&Ht.__e(t,n.__v))};var _b=typeof requestAnimationFrame=="function";function QM(e){var t,n=function(){clearTimeout(i),_b&&cancelAnimationFrame(t),setTimeout(e)},i=setTimeout(n,35);_b&&(t=requestAnimationFrame(n))}function Qc(e){var t=Dt,n=e.__c;typeof n=="function"&&(e.__c=void 0,n()),Dt=t}function gf(e){var t=Dt;e.__c=e.__(),Dt=t}function yf(e,t){return!e||e.length!==t.length||t.some(function(n,i){return n!==e[i]})}function xb(e,t){return typeof t=="function"?t(e):t}function JM(e){const{navigationStack:t,setNavigationStack:n}=e,i=Hi(()=>t.length<=1?[]:t.slice(0,-1).map((a,s)=>({label:a.label,onClick:()=>n(c=>c.slice(0,s+1))})),[t,n]),r=t.length>0?()=>n([]):null,o=t.length>0?t[t.length-1].label:null;return ct`
12
12
  <div class="djs-popup-breadcrumbs">
13
13
  ${r&&ct`
14
14
  <button
@@ -41,7 +41,7 @@
41
41
  </span>
42
42
  `}
43
43
  </div>
44
- `}function x_(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=x_(e[t]))&&(i&&(i+=" "),i+=n)}else for(n in e)e[n]&&(i&&(i+=" "),i+=n);return i}function Jc(){for(var e,t,n=0,i="",r=arguments.length;n<r;n++)(e=arguments[n])&&(t=x_(e))&&(i&&(i+=" "),i+=t);return i}function XM(e){const{headerEntries:t,onSelect:n,selectedEntry:i,setSelectedEntry:r,title:o}=e,a=Hi(()=>ZM(t),[t]),s=u=>u.action&&!u.disabled,c=(u,l)=>{if(s(l))return n(u,l)};return ct`
44
+ `}function wb(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=wb(e[t]))&&(i&&(i+=" "),i+=n)}else for(n in e)e[n]&&(i&&(i+=" "),i+=n);return i}function Jc(){for(var e,t,n=0,i="",r=arguments.length;n<r;n++)(e=arguments[n])&&(t=wb(e))&&(i&&(i+=" "),i+=t);return i}function e2(e){const{headerEntries:t,onSelect:n,selectedEntry:i,setSelectedEntry:r,title:o}=e,a=Hi(()=>t2(t),[t]),s=u=>u.action&&!u.disabled,c=(u,l)=>{if(s(l))return n(u,l)};return ct`
45
45
  <div class="djs-popup-header">
46
46
  <h3 class="djs-popup-title" title=${o}>${o}</h3>
47
47
  ${a.map(u=>ct`
@@ -50,7 +50,7 @@
50
50
  ${u.entries.map(l=>ct`
51
51
  <li key=${l.id}>
52
52
  <${s(l)?"button":"span"}
53
- class=${QM(l,l===i)}
53
+ class=${n2(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 ZM(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 QM(e,t){return Jc("entry",e.className,e.active?"active":"",e.disabled?"disabled":"",t?"selected":"")}function w_(e,t){return`${e}-entry-${t.id}`}function JM(e){const{idPrefix:t,entry:n,selected:i,onMouseEnter:r,onMouseLeave:o,onAction:a}=e,s=(u,l)=>{if(!n.disabled)return a(u,n,l)},c=!n.entries;return ct`
73
+ `}function t2(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 n2(e,t){return Jc("entry",e.className,e.active?"active":"",e.disabled?"disabled":"",t?"selected":"")}function Eb(e,t){return`${e}-entry-${t.id}`}function i2(e){const{idPrefix:t,entry:n,selected:i,onMouseEnter:r,onMouseLeave:o,onAction:a}=e,s=(u,l)=>{if(!n.disabled)return a(u,n,l)},c=!n.entries;return ct`
74
74
  <li
75
75
  class=${Jc("entry",{selected:i,disabled:n.disabled})}
76
76
  data-id=${n.id}
77
- id=${w_(t,n)}
77
+ id=${Eb(t,n)}
78
78
  role="option"
79
79
  aria-selected=${i||void 0}
80
80
  aria-haspopup=${n.entries?"true":void 0}
@@ -131,7 +131,7 @@
131
131
  </div>
132
132
  `}
133
133
  </li>
134
- `}function e2(e){const{selectedEntry:t,setSelectedEntry:n,groupedEntries:i,keyboardSelection:r,idPrefix:o,id:a,ariaLabel:s,tabIndex:c,ariaActivedescendant:u,...l}=e,f=Zc();mf(()=>{if(!r||!r.current)return;const m=f.current;if(!m)return;const g=m.querySelector(".selected");g&&t2(g)},[t]);const p=()=>{r.current=!1},d=m=>{r.current||n(m)},h=()=>{r.current||n(null)};return ct`
134
+ `}function r2(e){const{selectedEntry:t,setSelectedEntry:n,groupedEntries:i,keyboardSelection:r,idPrefix:o,id:a,ariaLabel:s,tabIndex:c,ariaActivedescendant:u,...l}=e,f=Zc();mf(()=>{if(!r||!r.current)return;const m=f.current;if(!m)return;const g=m.querySelector(".selected");g&&o2(g)},[t]);const p=()=>{r.current=!1},d=m=>{r.current||n(m)},h=()=>{r.current||n(null)};return ct`
135
135
  <div
136
136
  class="djs-popup-results"
137
137
  ref=${f}
@@ -144,7 +144,7 @@
144
144
  >
145
145
  ${i.map(m=>ct`
146
146
  ${m.name&&ct`
147
- <div key=${m.id} id=${E_(o,m)} class="entry-header" title=${m.name}>
147
+ <div key=${m.id} id=${Sb(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?E_(o,m):void 0}
155
+ aria-labelledby=${m.name?Sb(o,m):void 0}
156
156
  >
157
157
  ${m.entries.map(g=>ct`
158
- <${JM}
158
+ <${i2}
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 E_(e,t){return`${e}-group-${t.id}`}function t2(e){typeof e.scrollIntoViewIfNeeded=="function"?e.scrollIntoViewIfNeeded():e.scrollIntoView({scrollMode:"if-needed",block:"nearest"})}const n2=new Po("djs-popup");function i2(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]=hf([]);Xc(()=>{g([])},[p]);const[S,E]=hf(""),x=S.trim().length>0,w=Hi(()=>a2(p),[p]),C=Hi(()=>Bt(u)?w.length>5:!1,[u,w]),P=Hi(()=>{const V=m.length?m[m.length-1].entries:p;return C?x?f(w.filter(({searchable:G})=>G!==!1),S,{keys:["label","search","description"]}).map(({item:G})=>G):V.filter(({rank:G=0})=>G>=0):V},[C,x,w,S,f,m,p]),L=Hi(()=>x?P.length?[{id:"default",entries:P}]:[]:s2(P),[P,x]),[T,B]=hf(P[0]),k=Zc(null),O=Zc(!1),$=Hi(()=>n2.next(),[]),ne=`${$}-results`,ge=T&&w_($,T);Xc(()=>{const V=k.current;V&&P.includes(V)?B(V):B(P[0]),k.current=null},[P]);const Ve=Na(V=>{const G=o2(L);let je=G.indexOf(T)+V;je<0&&(je=G.length-1),je>=G.length&&(je=0),O.current=!0,B(G[je])},[L,T]),q=Na(V=>{V>0&&T&&T.entries&&(O.current=!0,g(G=>[...G,T])),V<0&&m.length>0&&(O.current=!0,k.current=m[m.length+V],g(G=>G.slice(0,V)))},[T,m]),ae=Na((V,G,X)=>{if(!(!G||G.disabled))return G.entries?(V.preventDefault(),q(1)):n(V,G,X)},[n,q]),de=Na(V=>{if(V.key==="Enter"&&T){const G=V.target;return!!Or(G,"a, button",!0)||T.disabled?void 0:ae(V,T)}if(V.key==="Backspace"){const G=V.target;if(!(Ju(G,"input")&&G.value!==""))return q(-1),V.preventDefault()}if(V.key==="ArrowUp")return Ve(-1),V.preventDefault();if(V.key==="ArrowDown")return Ve(1),V.preventDefault();if(V.key==="ArrowRight")return q(1),V.preventDefault();if(V.key==="ArrowLeft")return q(-1),V.preventDefault()},[T,Ve,q,ae]),re=Na(V=>{Ju(V.target,"input")&&E(()=>V.target.value)},[E]);Xc(()=>(d(),()=>{h()}),[]);const ve=!x&&m.length>0,te=(a||r.length>0)&&!ve;return ct`
172
- <${S_}
171
+ `}function Sb(e,t){return`${e}-group-${t.id}`}function o2(e){typeof e.scrollIntoViewIfNeeded=="function"?e.scrollIntoViewIfNeeded():e.scrollIntoView({scrollMode:"if-needed",block:"nearest"})}const a2=new Po("djs-popup");function s2(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]=hf([]);Xc(()=>{g([])},[p]);const[S,E]=hf(""),x=S.trim().length>0,w=Hi(()=>l2(p),[p]),C=Hi(()=>Bt(u)?w.length>5:!1,[u,w]),P=Hi(()=>{const V=m.length?m[m.length-1].entries:p;return C?x?f(w.filter(({searchable:G})=>G!==!1),S,{keys:["label","search","description"]}).map(({item:G})=>G):V.filter(({rank:G=0})=>G>=0):V},[C,x,w,S,f,m,p]),L=Hi(()=>x?P.length?[{id:"default",entries:P}]:[]:p2(P),[P,x]),[T,B]=hf(P[0]),k=Zc(null),O=Zc(!1),$=Hi(()=>a2.next(),[]),ie=`${$}-results`,ge=T&&Eb($,T);Xc(()=>{const V=k.current;V&&P.includes(V)?B(V):B(P[0]),k.current=null},[P]);const Ve=Na(V=>{const G=u2(L);let je=G.indexOf(T)+V;je<0&&(je=G.length-1),je>=G.length&&(je=0),O.current=!0,B(G[je])},[L,T]),q=Na(V=>{V>0&&T&&T.entries&&(O.current=!0,g(G=>[...G,T])),V<0&&m.length>0&&(O.current=!0,k.current=m[m.length+V],g(G=>G.slice(0,V)))},[T,m]),ae=Na((V,G,X)=>{if(!(!G||G.disabled))return G.entries?(V.preventDefault(),q(1)):n(V,G,X)},[n,q]),de=Na(V=>{if(V.key==="Enter"&&T){const G=V.target;return!!Or(G,"a, button",!0)||T.disabled?void 0:ae(V,T)}if(V.key==="Backspace"){const G=V.target;if(!(Ju(G,"input")&&G.value!==""))return q(-1),V.preventDefault()}if(V.key==="ArrowUp")return Ve(-1),V.preventDefault();if(V.key==="ArrowDown")return Ve(1),V.preventDefault();if(V.key==="ArrowRight")return q(1),V.preventDefault();if(V.key==="ArrowLeft")return q(-1),V.preventDefault()},[T,Ve,q,ae]),re=Na(V=>{Ju(V.target,"input")&&E(()=>V.target.value)},[E]);Xc(()=>(d(),()=>{h()}),[]);const ve=!x&&m.length>0,te=(a||r.length>0)&&!ve;return ct`
172
+ <${Rb}
173
173
  onClose=${t}
174
174
  onKeyup=${re}
175
175
  onKeydown=${de}
@@ -180,7 +180,7 @@
180
180
  navigationStack=${m}
181
181
  >
182
182
  ${te&&ct`
183
- <${XM}
183
+ <${e2}
184
184
  headerEntries=${r}
185
185
  onSelect=${n}
186
186
  selectedEntry=${T}
@@ -189,7 +189,7 @@
189
189
  />
190
190
  `}
191
191
  ${ve&&ct`
192
- <${KM}
192
+ <${JM}
193
193
  navigationStack=${m}
194
194
  setNavigationStack=${g}
195
195
  />
@@ -208,7 +208,7 @@
208
208
  role="combobox"
209
209
  aria-label="${a||"Search"}"
210
210
  aria-expanded="true"
211
- aria-controls=${ne}
211
+ aria-controls=${ie}
212
212
  aria-activedescendant=${ge||void 0}
213
213
  aria-autocomplete="list"
214
214
  />
@@ -221,14 +221,14 @@
221
221
  </div>
222
222
  `}
223
223
 
224
- <${e2}
224
+ <${r2}
225
225
  groupedEntries=${L}
226
226
  selectedEntry=${T}
227
227
  setSelectedEntry=${B}
228
228
  keyboardSelection=${O}
229
229
  onAction=${ae}
230
230
  idPrefix=${$}
231
- id=${ne}
231
+ id=${ie}
232
232
  ariaLabel=${a||"Results"}
233
233
  tabIndex=${C?-1:0}
234
234
  ariaActivedescendant=${C?void 0:ge||void 0}
@@ -257,11 +257,11 @@
257
257
  ${l&&P.length===0&&ct`
258
258
  <div class="djs-popup-no-results">${Wt(l)?l(S):l}</div>
259
259
  `}
260
- </${S_}>
261
- `}function S_(e){const{onClose:t,onKeydown:n,onKeyup:i,className:r,children:o,navigationStack:a,position:s}=e,c=Zc();return mf(()=>{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]),mf(()=>{const u=c.current;if(!u)return;(u.querySelector("input")||u.querySelector('[role="listbox"]')||u).focus()},[a]),Xc(()=>{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)}},[]),ct`
260
+ </${Rb}>
261
+ `}function Rb(e){const{onClose:t,onKeydown:n,onKeyup:i,className:r,children:o,navigationStack:a,position:s}=e,c=Zc();return mf(()=>{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]),mf(()=>{const u=c.current;if(!u)return;(u.querySelector("input")||u.querySelector('[role="listbox"]')||u).focus()},[a]),Xc(()=>{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)}},[]),ct`
262
262
  <div
263
263
  class=${Jc("djs-popup",r)}
264
- style=${r2(e)}
264
+ style=${c2(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 r2(e){const{width:t}=e,n=typeof t=="number"?`${t}px`:t;return{transform:`scale(${e.scale})`,width:Bt(t)?n:void 0,maxWidth:Bt(t)?"unset":void 0,"transform-origin":"top left"}}function o2(e){const t=[];return e.forEach(n=>{n.entries.forEach(i=>{t.push(i)})}),t}function a2(e){const t=[];function n(i){i.forEach(r=>{if(r.entries){n(r.entries);return}t.push(r)})}return n(e),t}function s2(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 c2="data-id",R_=["contextPad.close","canvas.viewbox.changing","commandStack.changed"],u2=1e3;function bt(e,t,n,i){this._eventBus=t,this._canvas=n,this._search=i,this._current=null;var r=Bt(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=C_(n),s=Object.entries(i).map(([p,d])=>({id:p,...d})),c=e&&(p=>this._ensureVisible(p,e)),u=this._updateScale(this._current.container);c_(ct`
273
- <${i2}
272
+ `}function c2(e){const{width:t}=e,n=typeof t=="number"?`${t}px`:t;return{transform:`scale(${e.scale})`,width:Bt(t)?n:void 0,maxWidth:Bt(t)?"unset":void 0,"transform-origin":"top left"}}function u2(e){const t=[];return e.forEach(n=>{n.entries.forEach(i=>{t.push(i)})}),t}function l2(e){const t=[];function n(i){i.forEach(r=>{if(r.entries){n(r.entries);return}t.push(r)})}return n(e),t}function p2(e){const t=[],n=o=>t.find(a=>o.id===a.id),i=o=>!!n(o),r=o=>typeof o=="string"?{id:o}:o;return e.forEach(o=>{const a=o.group?r(o.group):{id:"default"};i(a)?n(a).entries.push(o):t.push({...a,entries:[o]})}),t}var f2="data-id",Cb=["contextPad.close","canvas.viewbox.changing","commandStack.changed"],d2=1e3;function _t(e,t,n,i){this._eventBus=t,this._canvas=n,this._search=i,this._current=null;var r=Bt(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()})}_t.$inject=["config.popupMenu","eventBus","canvas","search"],_t.prototype._render=function(){const{position:e,providerId:t,entries:n,headerEntries:i,emptyPlaceholder:r,options:o}=this._current,a=Pb(n),s=Object.entries(i).map(([p,d])=>({id:p,...d})),c=e&&(p=>this._ensureVisible(p,e)),u=this._updateScale(this._current.container);ub(ct`
273
+ <${s2}
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;c_(null,e),li(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=ft(`<div class="djs-popup-parent djs-scrollable" data-popup=${e.provider}></div>`);return n.appendChild(i),i},bt.prototype._bindAutoClose=function(){this._eventBus.once(R_,this.close,this)},bt.prototype._unbindAutoClose=function(){this._eventBus.off(R_,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),Bt(n)&&e<n&&(r=n),Bt(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=u2),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 D(t,function(i){if(!i.getPopupMenuEntries){D(i.getEntries(e),function(o){var a=o.id;if(!a)throw new Error("entry ID is missing");n[a]=oi(o,["id"])});return}var r=i.getPopupMenuEntries(e);Wt(r)?n=r(n):D(r,function(o,a){n[a]=o})}),n},bt.prototype._getHeaderEntries=function(e,t){var n={};return D(t,function(i){if(!i.getPopupMenuHeaderEntries){if(!i.getHeaderEntries)return;D(i.getHeaderEntries(e),function(o){var a=o.id;if(!a)throw new Error("entry ID is missing");n[a]=oi(o,["id"])});return}var r=i.getPopupMenuHeaderEntries(e);Wt(r)?n=r(n):D(r,function(o,a){n[a]=o})}),n},bt.prototype._getEmptyPlaceholder=function(e){const t=e.find(n=>Wt(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=Or(e.delegateTarget||e.target,".entry",!0),o=sn(r,c2);t={id:o,...this._getEntry(o)}}const i=t.action;if(this._emit("trigger",{entry:t,event:e})!==!1){if(Wt(i)){if(n==="click")return i(e,t)}else if(i[n])return i[n](e,t)}},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 C_(e,t=[]){return Object.entries(e).map(([n,i])=>{const r={id:n,...i};return r.entries?r.entries=C_(r.entries,[...t,...P_(r.search)]):t.length&&(r.search=[...t,...P_(r.search)]),r})}function P_(e){return e?Ee(e)?e:[e]:[]}function l2(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=p2(o,r,i);return a?{item:o,tokens:a}:[]}).sort(f2(i))}function p2(e,t,n){const{matchedWords:i,tokens:r}=n.reduce((o,a)=>{const s=e[a],{tokens:c,matchedWords:u}=Ee(s)?s.reduce((l,f)=>{const{tokens:p,matchedWords:d}=O_(f,t);return{tokens:[...l.tokens,p],matchedWords:{...l.matchedWords,...d}}},{matchedWords:{},tokens:[]}):O_(s,t);return{tokens:{...o.tokens,[a]:c},matchedWords:{...o.matchedWords,...u}}},{matchedWords:{},tokens:{}});return Object.keys(i).length!==t.length?null:r}function f2(e){return(t,n)=>{let i=0,r=1;for(const o of e){const a=d2(t.tokens[o],n.tokens[o]);if(a!==0){i+=a*r,r*=A_;continue}const s=h2(t.item[o],n.item[o]);if(s!==0){i+=s*r,r*=A_;continue}}return i}}function d2(e,t){return T_(t)-T_(e)}const A_=.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 T_(e){const t=e.reduce((s,c)=>s+M_(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 M_(e){if(Ee(e))return Math.max(...e.map(M_));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 k_(e=""){return Ee(e)?e.join(", "):e}function h2(e,t){return k_(e).localeCompare(k_(t))}function O_(e,t){var u;if(!e)return{tokens:[],matchedWords:{}};const n=[],i={},r=t.map(m2),o=[`(?<all>${r.join("\\s+")})`,...r].join("|"),a=new RegExp(o,"ig");let s,c=0;for(;s=a.exec(e);){const[l]=s,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)),S=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:S,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 m2(e){return e.replace(/[/\-\\^$*+?.()|[\]{}]/g,"\\$&")}const D_={search:["value",l2]},vf={__depends__:[D_],__init__:["popupMenu"],popupMenu:["type",bt]};var L_={align:`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 2000 2000">
287
+ `,this._current.container)},_t.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()},_t.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()},_t.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)}},_t.prototype.close=function(){this.isOpen()&&(this._emit("close"),this.reset(),this._canvas.restoreFocus(),this._current=null)},_t.prototype.reset=function(){const e=this._current.container;ub(null,e),li(e)},_t.prototype._emit=function(e,t){this._eventBus.fire(`popupMenu.${e}`,t)},_t.prototype._onOpened=function(){this._emit("opened")},_t.prototype._onClosed=function(){this._emit("closed")},_t.prototype._createContainer=function(e){var t=this._canvas,n=t.getContainer();const i=ft(`<div class="djs-popup-parent djs-scrollable" data-popup=${e.provider}></div>`);return n.appendChild(i),i},_t.prototype._bindAutoClose=function(){this._eventBus.once(Cb,this.close,this)},_t.prototype._unbindAutoClose=function(){this._eventBus.off(Cb,this.close,this)},_t.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),Bt(n)&&e<n&&(r=n),Bt(i)&&e>i&&(r=i)),r},_t.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}},_t.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},_t.prototype.registerProvider=function(e,t,n){n||(n=t,t=d2),this._eventBus.on("popupMenu.getProviders."+e,t,function(i){i.providers.push(n)})},_t.prototype._getProviders=function(e){var t=this._eventBus.createEvent({type:"popupMenu.getProviders."+e,providers:[]});return this._eventBus.fire(t),t.providers},_t.prototype._getEntries=function(e,t){var n={};return D(t,function(i){if(!i.getPopupMenuEntries){D(i.getEntries(e),function(o){var a=o.id;if(!a)throw new Error("entry ID is missing");n[a]=oi(o,["id"])});return}var r=i.getPopupMenuEntries(e);Wt(r)?n=r(n):D(r,function(o,a){n[a]=o})}),n},_t.prototype._getHeaderEntries=function(e,t){var n={};return D(t,function(i){if(!i.getPopupMenuHeaderEntries){if(!i.getHeaderEntries)return;D(i.getHeaderEntries(e),function(o){var a=o.id;if(!a)throw new Error("entry ID is missing");n[a]=oi(o,["id"])});return}var r=i.getPopupMenuHeaderEntries(e);Wt(r)?n=r(n):D(r,function(o,a){n[a]=o})}),n},_t.prototype._getEmptyPlaceholder=function(e){const t=e.find(n=>Wt(n.getEmptyPlaceholder));return t&&t.getEmptyPlaceholder()},_t.prototype.isOpen=function(){return!!this._current},_t.prototype.trigger=function(e,t,n="click"){if(e.preventDefault(),!t){let r=Or(e.delegateTarget||e.target,".entry",!0),o=sn(r,f2);t={id:o,...this._getEntry(o)}}const i=t.action;if(this._emit("trigger",{entry:t,event:e})!==!1){if(Wt(i)){if(n==="click")return i(e,t)}else if(i[n])return i[n](e,t)}},_t.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 Pb(e,t=[]){return Object.entries(e).map(([n,i])=>{const r={id:n,...i};return r.entries?r.entries=Pb(r.entries,[...t,...Ab(r.search)]):t.length&&(r.search=[...t,...Ab(r.search)]),r})}function Ab(e){return e?Ee(e)?e:[e]:[]}function h2(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=m2(o,r,i);return a?{item:o,tokens:a}:[]}).sort(g2(i))}function m2(e,t,n){const{matchedWords:i,tokens:r}=n.reduce((o,a)=>{const s=e[a],{tokens:c,matchedWords:u}=Ee(s)?s.reduce((l,f)=>{const{tokens:p,matchedWords:d}=Db(f,t);return{tokens:[...l.tokens,p],matchedWords:{...l.matchedWords,...d}}},{matchedWords:{},tokens:[]}):Db(s,t);return{tokens:{...o.tokens,[a]:c},matchedWords:{...o.matchedWords,...u}}},{matchedWords:{},tokens:{}});return Object.keys(i).length!==t.length?null:r}function g2(e){return(t,n)=>{let i=0,r=1;for(const o of e){const a=y2(t.tokens[o],n.tokens[o]);if(a!==0){i+=a*r,r*=Tb;continue}const s=v2(t.item[o],n.item[o]);if(s!==0){i+=s*r,r*=Tb;continue}}return i}}function y2(e,t){return Mb(t)-Mb(e)}const Tb=.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 Mb(e){const t=e.reduce((s,c)=>s+kb(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 kb(e){if(Ee(e))return Math.max(...e.map(kb));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 Ob(e=""){return Ee(e)?e.join(", "):e}function v2(e,t){return Ob(e).localeCompare(Ob(t))}function Db(e,t){var u;if(!e)return{tokens:[],matchedWords:{}};const n=[],i={},r=t.map(b2),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)),S=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:S,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 b2(e){return e.replace(/[/\-\\^$*+?.()|[\]{}]/g,"\\$&")}const Lb={search:["value",h2]},vf={__depends__:[Lb],__init__:["popupMenu"],popupMenu:["type",_t]};var Ib={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>`},g2=900;function No(e,t,n,i){e.registerProvider(g2,this),this._contextPad=e,this._popupMenu=t,this._translate=n,this._canvas=i}No.$inject=["contextPad","popupMenu","translate","canvas"],No.prototype.getMultiElementContextPadEntries=function(e){var t={};return this._isAllowed(e)&&j(t,this._getEntries(e)),t},No.prototype._isAllowed=function(e){return!this._popupMenu.isEmpty(e,"align-elements")},No.prototype._getEntries=function(){var e=this;return{"align-elements":{group:"align-elements",title:e._translate("Align elements"),html:`<div class="entry">${L_.align}</div>`,action:{click:function(t,n){var i=e._getMenuPosition(n);j(i,{cursor:{x:t.x,y:t.y}}),e._popupMenu.open(n,"align-elements",i)}}}}},No.prototype._getMenuPosition=function(e){var t=5,n=this._contextPad.getPad(e).html,i=n.getBoundingClientRect(),r={x:i.left,y:i.bottom+t};return r};var y2=["left","center","right","top","middle","bottom"];function Ba(e,t,n,i){this._alignElements=t,this._translate=n,this._popupMenu=e,this._rules=i,e.registerProvider("align-elements",this)}Ba.$inject=["popupMenu","alignElements","translate","rules"],Ba.prototype.getPopupMenuEntries=function(e){var t={};return this._isAllowed(e)&&j(t,this._getEntries(e)),t},Ba.prototype._isAllowed=function(e){return this._rules.allowed("elements.align",{elements:e})},Ba.prototype._getEntries=function(e){var t=this._alignElements,n=this._translate,i=this._popupMenu,r={};return D(y2,function(o){r["align-elements-"+o]={group:"align",title:n("Align elements "+o),className:"bjs-align-elements-menu-entry",imageHtml:L_[o],action:function(){t.trigger(e,o),i.close()}}}),r};function eu(e){Vn.call(this,e)}eu.$inject=["eventBus"],pe(eu,Vn),eu.prototype.init=function(){this.addRule("elements.align",function(e){var t=e.elements,n=He(t,function(i){return!(i.waypoints||i.host||i.labelTarget)});return n=Es(n),n.length<2?!1:n})};const v2={__depends__:[TM,Wv,vf],__init__:["alignElementsContextPadProvider","alignElementsMenuProvider","bpmnAlignElements"],alignElementsContextPadProvider:["type",No],alignElementsMenuProvider:["type",Ba],bpmnAlignElements:["type",eu]};function zi(e,t,n,i){Q.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=Pu(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});D(l,function(f,p){Ee(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"],pe(zi,Q),zi.prototype._getOptimalBounds=function(e,t){var n=this.getOffset(t),i=this.getPadding(t),r=xe(Mt(e)),o=xe(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),Cs(j({},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(_2(i,t)){var r=b2(ei(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 _2(e,t){return e.x!==t.x||e.y!==t.y||e.width!==t.width||e.height!==t.height}function b2(e,t){var n="";return e=xe(e),t=xe(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 tu(e){e.invoke(zi,this)}tu.$inject=["injector"],pe(tu,zi),tu.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 $a(e){Vn.call(this,e);var t=this;this.addRule("element.autoResize",function(n){return t.canResize(n.elements,n.target)})}$a.$inject=["eventBus"],pe($a,Vn),$a.prototype.canResize=function(e,t){return!1};function nu(e,t){$a.call(this,e),this._modeling=t}pe(nu,$a),nu.$inject=["eventBus","modeling"],nu.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 D(e,function(i){if(v(i,"bpmn:Lane")||$e(i)){n=!1;return}}),n};const x2={__init__:["bpmnAutoResize","bpmnAutoResizeProvider"],bpmnAutoResize:["type",tu],bpmnAutoResizeProvider:["type",nu]};function Bo(e,t,n){this._canvas=n,this._opts=j({scrollThresholdIn:[20,20,20,20],scrollThresholdOut:[0,0,0,0],scrollRepeatTimeout:15,scrollStep:10},e);var i=this;t.on("drag.move",function(r){var o=i._toBorderPoint(r);i.startScroll(o)}),t.on(["drag.cleanup"],function(){i.stopScroll()})}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++)w2(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 w2(e,t,n){return t<e&&e<n}Bo.prototype.stopScroll=function(){clearTimeout(this._scrolling)},Bo.prototype.setOptions=function(e){this._opts=j({},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 E2={__depends__:[Ni],__init__:["autoScroll"],autoScroll:["type",Bo]};var I_="djs-bendpoint",N_="djs-segment-dragger";function S2(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 _f(e,t,n){var i=S2(e,n),r=Bl(t,i);return r}function bf(e,t){var n=be("g");qe(n).add(I_),Oe(e,n);var i=be("circle");fe(i,{cx:0,cy:0,r:4}),qe(i).add("djs-visual"),Oe(n,i);var r=be("circle");return fe(r,{cx:0,cy:0,r:10}),qe(r).add("djs-hit"),Oe(n,r),t&&qe(n).add(t),n}function R2(e,t,n,i){var r=be("g");Oe(e,r);var o=18,a=6,s=11,c=P2(t,n,i),u=a+s,l=be("rect");fe(l,{x:-o/2,y:-a/2,width:o,height:a}),qe(l).add("djs-visual"),Oe(r,l);var f=be("rect");return fe(f,{x:-c/2,y:-u/2,width:c,height:u}),qe(f).add("djs-hit"),Oe(r,f),um(r,i==="v"?90:0),r}function B_(e,t,n){var i=be("g"),r=fl(t,n),o=Mi(t,n);return Oe(e,i),R2(i,t,n,o),qe(i).add(N_),qe(i).add(o==="h"?"horizontal":"vertical"),Qt(i,r.x,r.y),i}function xf(e){return Math.abs(Math.round(e*2/3))}function C2(e,t){var n=A2(e,t);return Gl(e,n)}function P2(e,t,n){var i=t.x-e.x,r=t.y-e.y;return xf(n==="h"?i:r)}function A2(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=Km(e,[a,s]);c<i&&(i=c,r=o)}return[n[r],n[r+1]]}function $_(e,t,n,i,r){function o(x,w,C){var P=x.index,L=x.point,T,B,k,O,$,ne;return P<=0||x.bendpoint?!1:(T=w[P-1],B=w[P],k=fl(T,B),O=Mi(T,B),$=Math.abs(L.x-k.x),ne=Math.abs(L.y-k.y),O&&$<=C&&ne<=C)}function a(x,w){var C=x.waypoints,P,L,T,B;return w.index<=0||w.bendpoint||(P={start:C[w.index-1],end:C[w.index]},L=Mi(P.start,P.end),!L)?null:(L==="h"?T=P.end.x-P.start.x:T=P.end.y-P.start.y,B=xf(T)/2,B)}function s(x,w){var C=w.waypoints,P=_f(t,C,x),L;if(P){L=a(w,P);var T;if(o(P,C,L)?T=r.start(x,w,P.index):T=i.start(x,w,P.index,!P.bendpoint),T!==!1)return!0}}function c(x,w,C){Me.bind(x,w,function(P){n.triggerMouseEvent(w,P,C),P.stopPropagation()})}function u(x,w){var C=t.getLayer("overlays"),P=ot('.djs-bendpoints[data-element-id="'+Oa(x.id)+'"]',C);return!P&&w&&(P=be("g"),fe(P,{"data-element-id":x.id}),qe(P).add("djs-bendpoints"),Oe(C,P),c(P,"mousedown",x),c(P,"click",x),c(P,"dblclick",x)),P}function l(x,w){return ot('.djs-segment-dragger[data-segment-idx="'+x+'"]',w)}function f(x,w){w.waypoints.forEach(function(C,P){var L=bf(x);Oe(x,L),Qt(L,C.x,C.y)}),bf(x,"floating")}function p(x,w){for(var C=w.waypoints,P,L,T,B=1;B<C.length;B++)P=C[B-1],L=C[B],Mi(P,L)&&(T=B_(x,P,L),fe(T,{"data-segment-idx":B}),c(T,"mousemove",w))}function d(x){D(_s("."+I_,x),function(w){jt(w)})}function h(x){D(_s("."+N_,x),function(w){jt(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 S(x,w){var C=ot(".floating",x),P=w.point;C&&(Qt(C,P.x,P.y),qe(C).add("positioned"))}function E(x,w,C){var P=l(w.index,x),L=C[w.index-1],T=C[w.index],B=w.point,k=fl(L,T),O=Mi(L,T),$,ne;P&&($=T2(P),ne={x:B.x-k.x,y:B.y-k.y},O==="v"&&(ne={x:ne.y,y:ne.x}),Qt($,ne.x,ne.y))}e.on("connection.changed",function(x){g(x.element)}),e.on("connection.remove",function(x){var w=u(x.element);w&&jt(w)}),e.on("element.marker.update",function(x){var w=x.element,C;w.waypoints&&(C=m(w),x.add?qe(C).add(x.marker):qe(C).remove(x.marker))}),e.on("element.mousemove",function(x){var w=x.element,C=w.waypoints,P,L;if(C){if(P=u(w,!0),L=_f(t,C,x.originalEvent),!L)return;S(P,L),L.bendpoint||E(P,L,C)}}),e.on("element.mousedown",function(x){if(sr(x)){var w=x.originalEvent,C=x.element;if(C.waypoints)return s(w,C)}}),e.on("selection.changed",function(x){var w=x.newSelection,C=w[0];C&&C.waypoints&&m(C)}),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 C=u(w);if(C){var P=ot(".floating",C);P&&qe(P).remove("positioned")}}}),e.on("element.updateId",function(x){var w=x.element,C=x.newId;if(w.waypoints){var P=u(w);P&&fe(P,{"data-element-id":C})}}),this.addHandles=m,this.updateHandles=g,this.getBendpointsContainer=u,this.getSegmentDragger=l}$_.$inject=["eventBus","canvas","interactionEvents","bendpointMove","connectionSegmentMove"];function T2(e){return ot(".djs-visual",e)}var j_=Math.round,Ur="reconnectStart",qr="reconnectEnd",ja="updateWaypoints";function wf(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=qr:h=ja;var m=h===ja?"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===ja?"connection.updateWaypoints":"connection.reconnect";if(d=s.allowed=r.allowed(h,{connection:c,source:p===Ur?f:u,target:p===qr?f:l}),d){s.source=p===Ur?f:u,s.target=p===qr?f:l;return}d===!1&&(d=s.allowed=r.allowed(h,{connection:c,source:p===qr?f:l,target:p===Ur?f:u})),d&&(s.source=p===qr?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!==ja&&(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||{},S={x:j_(a.x),y:j_(a.y)};if(!c)return!1;m===ja?(f?p.splice(u,0,S):p[u]=S,g.bendpointMove={insert:f,bendpointIndex:u},p=this.cropWaypoints(l,p),o.updateWaypoints(l,U1(p),g)):(m===Ur?(g.docking="source",iu(s)&&(g.docking="target",g.newWaypoints=p.reverse())):m===qr&&(g.docking="target",iu(s)&&(g.docking="source",g.newWaypoints=p.reverse())),o.reconnect(l,d,h,S,g))},this)}wf.$inject=["injector","eventBus","canvas","dragging","rules","modeling"],wf.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 iu(e){var t=e.hover,n=e.source,i=e.target,r=e.type;if(r===Ur)return t&&i&&t===i&&n!==i;if(r===qr)return t&&n&&t===n&&n!==i}var M2="reconnectStart",k2="reconnectEnd",F_="updateWaypoints",Fa="connect-ok",ru="connect-not-ok",H_="connect-hover",z_="djs-updating",G_="djs-dragging",V_=1100;function W_(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=bf(i.getLayer("overlays"));qe(p).add("djs-dragging"),i.addMarker(c,G_),i.addMarker(c,z_)}),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,H_),u===F_)return;s?(i.removeMarker(c,ru),i.addMarker(c,Fa)):s===!1&&(i.removeMarker(c,Fa),i.addMarker(c,ru))}}),n.on(["bendpoint.move.out","bendpoint.move.cleanup"],V_,function(o){var a=o.context,s=a.hover,c=a.target;s&&(i.removeMarker(s,H_),i.removeMarker(s,c?Fa:ru))}),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},S=a.hints||{},E={};r&&(S.connectionStart&&(E.connectionStart=S.connectionStart),S.connectionEnd&&(E.connectionEnd=S.connectionEnd),f===M2?iu(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===k2?iu(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===F_&&(m=e.cropWaypoints(p,m)),E.waypoints=m,r.drawPreview(a,s,E)),Qt(u,o.x,o.y)},this),n.on(["bendpoint.move.end","bendpoint.move.cancel"],V_,function(o){var a=o.context,s=a.connection,c=a.draggerGfx,u=a.hover,l=a.target,f=a.waypoints;s.waypoints=f,jt(c),i.removeMarker(s,z_),i.removeMarker(s,G_),u&&(i.removeMarker(u,Fa),i.removeMarker(u,l?Fa:ru)),r&&r.cleanUp(a)})}W_.$inject=["bendpointMove","injector","eventBus","canvas"];var U_="connect-hover",q_="djs-updating";function Y_(e,t,n){return Ef(e,t,e[t]+n)}function Ef(e,t,n){return{x:t==="x"?n:e.x,y:t==="y"?n:e.y}}function O2(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 Ef(t,i,s)}function K_(e){return e==="x"?"y":"x"}function X_(e,t,n){var i,r;return e.original?e.original:(i=Se(t),r=K_(n),Ef(e,r,i[r]))}function Z_(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,S=d,E=p.waypoints,x=E[g],w=E[S],C=_f(n,E,f),P,L,T;if(P=Mi(x,w),!!P)return L=P==="v"?"x":"y",g===0&&(x=X_(x,p.source,L)),S===E.length-1&&(w=X_(w,p.target,L)),C?T=C.point:T={x:(x.x+w.x)/2,y:(x.y+w.y)/2},h={connection:p,segmentStartIndex:g,segmentEndIndex:S,segmentStart:x,segmentEnd:w,axis:L,dragPosition:T},i.init(f,T,"connectionSegment.move",{cursor:L==="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],S=f.segmentEndIndex+p,E=h[S],x=K_(f.axis),w=O2(d,g,E,x);Qt(f.draggerGfx,w.x,w.y)}function l(f,p){var d=0,h=f.filter(function(m,g){return pl(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=B_(h,p.segmentStart,p.segmentEnd),qe(p.draggerGfx).add("djs-dragging"),n.addMarker(d,q_)}),t.on("connectionSegment.move.move",function(f){var p=f.context,d=p.connection,h=p.segmentStartIndex,m=p.segmentEndIndex,g=p.segmentStart,S=p.segmentEnd,E=p.axis,x=p.originalWaypoints.slice(),w=Y_(g,E,f["d"+E]),C=Y_(S,E,f["d"+E]),P=x.length,L=0;x[h]=w,x[m]=C;var T,B;h<2&&(T=Zt(d.source,w),h===1?T==="intersect"&&(x.shift(),x[0]=w,L--):T!=="intersect"&&(x.unshift(g),L++)),m>P-3&&(B=Zt(d.target,C),m===P-2?B==="intersect"&&(x.pop(),x[x.length-1]=C):B!=="intersect"&&x.push(S)),p.newWaypoints=d.waypoints=s(d,x),u(p,L,f),p.newSegmentStartIndex=h+L,c(f)}),t.on("connectionSegment.move.hover",function(f){f.context.hover=f.hover,n.addMarker(f.hover,U_)}),t.on(["connectionSegment.move.out","connectionSegment.move.cleanup"],function(f){var p=f.context.hover;p&&n.removeMarker(p,U_)}),t.on("connectionSegment.move.cleanup",function(f){var p=f.context,d=p.connection;p.draggerGfx&&jt(p.draggerGfx),n.removeMarker(d,q_)}),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(C){return{original:C.original,x:Math.round(C.x),y:Math.round(C.y)}});var g=l(h,m),S=g.waypoints,E=s(d,S),x=g.segmentOffset,w={segmentMove:{segmentStartIndex:p.segmentStartIndex,newSegmentStartIndex:m+x}};o.updateWaypoints(d,E,w)})}Z_.$inject=["injector","eventBus","canvas","dragging","graphicsFactory","modeling"];var D2=Math.abs,Q_=Math.round;function L2(e,t,n){n=n===void 0?10:n;var i,r;for(i=0;i<t.length;i++)if(r=t[i],D2(r-e)<=n)return r}function J_(e){return{x:e.x,y:e.y}}function eb(e){return{x:e.x+e.width,y:e.y+e.height}}function Yn(e,t){return!e||isNaN(e.x)||isNaN(e.y)?t:{x: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 tb(e){return e.children||[]}var I2=Math.abs,nb=Math.round,Sf=10;function ib(e){function t(o,a){if(Ee(o)){for(var s=o.length;s--;)if(I2(o[s]-a)<=Sf)return o[s]}else{o=+o;var c=a%o;if(c<Sf)return a-c;if(c>o-Sf)return a-c+o}return a}function n(o,a){if(o.waypoints)return C2(a,o);if(o.width)return{x:nb(o.width/2+o.x),y:nb(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:[]},D(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;j(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:[]},D(u,function(l){l&&(l=l.original||l,a.horizontal.push(l.y),a.vertical.push(l.x))}),a}e.on(["connect.hover","connect.move","connect.end"],1500,function(o){var a=o.context,s=a.hover,c=s&&n(s,o);!at(s)||!c||!c.x||!c.y||(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;j(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)}})}ib.$inject=["eventBus"];const N2={__depends__:[Ni,gi],__init__:["bendpoints","bendpointSnapping","bendpointMovePreview"],bendpoints:["type",$_],bendpointMove:["type",wf],bendpointMovePreview:["type",W_],connectionSegmentMove:["type",Z_],bendpointSnapping:["type",ib]};function rb(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:Rf(s)?l:u,connectionEnd:Rf(s)?u:l};Vt(c)&&(d=c),s.connection=n.connect(f,p,d,h)}),this.start=function(a,s,c,u){Vt(c)||(u=c,c=Se(s)),t.init(a,"connect",{autoActivate:u,data:{shape:s,context:{start:s,connectionStart:c}}})}}rb.$inject=["eventBus","dragging","modeling","rules"];function Rf(e){var t=e.hover,n=e.source,i=e.target;return t&&n&&t===n&&n!==i}var B2=1100,$2=900,ob="connect-ok",ab="connect-not-ok";function sb(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;Rf(o)&&(h=d,m=p),i.drawPreview(o,a,{source:c||u,target:f||s,connectionStart:h,connectionEnd:m})}),t.on("connect.hover",$2,function(r){var o=r.context,a=r.hover,s=o.canExecute;s!==null&&n.addMarker(a,s?ob:ab)}),t.on(["connect.out","connect.cleanup"],B2,function(r){var o=r.hover;o&&(n.removeMarker(o,ob),n.removeMarker(o,ab))}),i&&t.on("connect.cleanup",function(r){i.cleanUp(r.context)})}sb.$inject=["injector","eventBus","canvas"];const Cf={__depends__:[Wn,gi,Ni],__init__:["connectPreview"],connect:["type",rb],connectPreview:["type",sb]};var j2="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()),bs(i),r||(r=e.getConnection=F2(function(m,g,S){return h.getConnection(m,g,S)})),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?Se(o):c,a?Se(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||Se(n),o=t.connectionEnd||Se(i),a=this.cropWaypoints(r,o,n,i),s=this.createNoopConnection(a[0],a[1]);Oe(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&&ea(o,s,!0)||e,t=i&&ea(a,s,!1)||t,[e,t]},Gi.prototype.cleanUp=function(e){e&&e.connectionPreviewGfx&&jt(e.connectionPreviewGfx)},Gi.prototype.getConnection=function(e){var t=H2(e);return this._elementFactory.createConnection(t)},Gi.prototype.createConnectionPreviewGfx=function(){var e=be("g");return fe(e,{pointerEvents:"none"}),qe(e).add(j2),Oe(this._canvas.getActiveLayer(),e),e},Gi.prototype.createNoopConnection=function(e,t){return Xo([e,t],{stroke:"#333",strokeDasharray:[1],strokeWidth:2,"pointer-events":"none"})};function F2(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 H2(e){return Vt(e)?e:{}}const z2={__init__:["connectionPreview"],connectionPreview:["type",Gi]},ou="complex-preview";class cb{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(ou);n.filter(s=>!G2(s)).forEach(s=>{let c;at(s)?(c=this._graphicsFactory._createContainer("connection",be("g")),this._graphicsFactory.drawConnection(Ir(c),s)):(c=this._graphicsFactory._createContainer("shape",be("g")),this._graphicsFactory.drawShape(Ir(c),s),Qt(c,s.x,s.y)),this._previewSupport.addDragger(s,a,c)}),i.forEach(({element:s,delta:c})=>{this._previewSupport.addDragger(s,a,void 0,"djs-dragging"),this._canvas.addMarker(s,"djs-element-hidden"),this._markers.push([s,"djs-element-hidden"]);const u=this._previewSupport.addDragger(s,a);at(s)?Qt(u,c.x,c.y):Qt(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",be("g"));this._graphicsFactory.drawShape(Ir(u),s,{width:c.width,height:c.height}),Qt(u,c.x,c.y),this._previewSupport.addDragger(s,a,u)})}cleanUp(){bs(this._canvas.getLayer(ou)),this._markers.forEach(([t,n])=>this._canvas.removeMarker(t,n)),this._markers=[]}show(){this._canvas.showLayer(ou)}hide(){this._canvas.hideLayer(ou)}}cb.$inject=["canvas","graphicsFactory","previewSupport"];function G2(e){return e.hidden}const V2={__depends__:[Ao],__init__:["complexPreview"],complexPreview:["type",cb]},ub=Math.round;function au(e,t,n,i,r,o){this._complexPreview=e,this._connectionDocking=t,this._elementFactory=n,this._eventBus=i,this._layouter=r,this._rules=o}au.prototype.create=function(e,t,n){const i=this._complexPreview,r=this._connectionDocking,o=this._elementFactory,a=this._eventBus,s=this._layouter,c=this._rules,u=o.createShape(j({type:t},n)),l=a.fire("autoPlace",{source:e,shape:u});if(!l)return;j(u,{x:l.x-ub(u.width/2),y:l.y-ub(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))})},au.prototype.cleanUp=function(){this._complexPreview.cleanUp()},au.$inject=["complexPreview","connectionDocking","elementFactory","eventBus","layouter","rules"];const W2={__depends__:[Dc,V2,Zp],__init__:["appendPreview"],appendPreview:["type",au]};var lb=Math.min,pb=Math.max;function Pf(e){e.preventDefault()}function Ha(e){e.stopPropagation()}function U2(e){return e.nodeType===Node.TEXT_NODE}function q2(e){return[].slice.call(e)}function ni(e){this.container=e.container,this.parent=ft('<div class="djs-direct-editing-parent"><div class="djs-direct-editing-content" contenteditable="true"></div></div>'),this.content=ot("[contenteditable]",this.parent),this.keyHandler=e.keyHandler||function(){},this.resizeHandler=e.resizeHandler||function(){},this.focusoutHandler=e.focusoutHandler||function(){},this.autoResize=vn(this.autoResize,this),this.handlePaste=vn(this.handlePaste,this)}ni.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=ei(t,["width","height","maxWidth","maxHeight","minWidth","minHeight","left","top","backgroundColor","position","overflow","border","wordWrap","textAlign","outline","transform"]);j(o.style,{width:e.width+"px",height:e.height+"px",maxWidth:e.maxWidth+"px",maxHeight:e.maxHeight+"px",minWidth:e.minWidth+"px",minHeight:e.minHeight+"px",left:e.x+"px",top:e.y+"px",backgroundColor:"#ffffff",position:"absolute",overflow:"visible",border:"1px solid #ccc",boxSizing:"border-box",wordWrap:"normal",textAlign:"center",outline:"none"},c);var u=ei(t,["fontFamily","fontSize","fontWeight","lineHeight","padding","paddingTop","paddingRight","paddingBottom","paddingLeft"]);return j(a.style,{boxSizing:"border-box",width:"100%",outline:"none",wordWrap:"break-word"},u),i.centerVertically&&j(a.style,{position:"absolute",top:"50%",transform:"translate(0, -50%)"},u),a.innerText=n,Me.bind(a,"keydown",this.keyHandler),Me.bind(a,"mousedown",Ha),Me.bind(a,"paste",r.handlePaste),Me.bind(a,"focusout",this.focusoutHandler),i.autoResize&&Me.bind(a,"input",this.autoResize),i.resizable&&this.resizable(t),s.appendChild(o),this.setSelection(a.lastChild,a.lastChild&&a.lastChild.length),o},ni.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)}},ni.prototype.insertText=function(e){e=Y2(e);var t=document.execCommand("insertText",!1,e);t||this._insertTextIE(e)},ni.prototype._insertTextIE=function(e){var t=this.getSelection(),n=t.startContainer,i=t.endContainer,r=t.startOffset,o=t.endOffset,a=t.commonAncestorContainer,s=q2(a.childNodes),c,u;if(U2(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&&li(h)}),c=n,u=r+e.length}c&&u!==void 0&&setTimeout(function(){self.setSelection(c,u)})},ni.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})}},ni.prototype.resizable=function(){var e=this,t=this.parent,n=this.resizeHandle,i=parseInt(this.style.minWidth)||0,r=parseInt(this.style.minHeight)||0,o=parseInt(this.style.maxWidth)||1/0,a=parseInt(this.style.maxHeight)||1/0;if(!n){n=this.resizeHandle=ft('<div class="djs-direct-editing-resize-handle"></div>');var s,c,u,l,f=function(h){Pf(h),Ha(h),s=h.clientX,c=h.clientY;var m=t.getBoundingClientRect();u=m.width,l=m.height,Me.bind(document,"mousemove",p),Me.bind(document,"mouseup",d)},p=function(h){Pf(h),Ha(h);var m=lb(pb(u+h.clientX-s,i),o),g=lb(pb(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){Pf(h),Ha(h),Me.unbind(document,"mousemove",p,!1),Me.unbind(document,"mouseup",d,!1)};Me.bind(n,"mousedown",f)}j(n.style,{position:"absolute",bottom:"0px",right:"0px",cursor:"nwse-resize",width:"0",height:"0",borderTop:(parseInt(this.style.fontSize)/4||3)+"px solid transparent",borderRight:(parseInt(this.style.fontSize)/4||3)+"px solid #ccc",borderBottom:(parseInt(this.style.fontSize)/4||3)+"px solid #ccc",borderLeft:(parseInt(this.style.fontSize)/4||3)+"px solid transparent"}),t.appendChild(n)},ni.prototype.destroy=function(){var e=this.parent,t=this.content,n=this.resizeHandle;t.innerText="",e.removeAttribute("style"),t.removeAttribute("style"),Me.unbind(t,"keydown",this.keyHandler),Me.unbind(t,"mousedown",Ha),Me.unbind(t,"input",this.autoResize),Me.unbind(t,"paste",this.handlePaste),Me.unbind(t,"focusout",this.focusoutHandler),n&&(n.removeAttribute("style"),li(n)),li(e)},ni.prototype.getValue=function(){return this.content.innerText.trim()},ni.prototype.getSelection=function(){var e=window.getSelection(),t=e.getRangeAt(0);return t},ni.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 Y2(e){return e.replace(/\r\n|\r|\n/g,`
316
- `)}function Dn(e,t){this._eventBus=e,this._canvas=t,this._providers=[],this._textbox=new ni({container:t.getContainer(),keyHandler:vn(this._handleKey,this),resizeHandler:vn(this._handleResize,this),focusoutHandler:vn(this._handleFocusout,this)}),e.on(["diagram.clear","diagram.destroy"],()=>this._cleanup())}Dn.$inject=["eventBus","canvas"],Dn.prototype.registerProvider=function(e){this._providers.push(e)},Dn.prototype.isActive=function(e){return!!(this._active&&(!e||this._active.element===e))},Dn.prototype.cancel=function(){this._active&&(this._fire("cancel"),this.close())},Dn.prototype._fire=function(e,t){this._eventBus.fire("directEditing."+e,t||{active:this._active})},Dn.prototype.close=function(){this._fire("deactivate"),this._cleanup(),this._canvas.restoreFocus&&this._canvas.restoreFocus()},Dn.prototype._cleanup=function(){this._active&&(this._textbox.destroy(),this._active=null,this.resizable=void 0)},Dn.prototype.complete=function(){var e=this._active;if(e){var t,n=e.context.bounds,i=this.$textbox.getBoundingClientRect(),r=this.getValue(),o=e.context.text;(r!==o||i.height!==n.height||i.width!==n.width)&&(t=this._textbox.container.getBoundingClientRect(),e.provider.update(e.element,r,e.context.text,{x:i.left-t.left,y:i.top-t.top,width:i.width,height:i.height})),this._fire("complete"),this.close()}},Dn.prototype.getValue=function(){return this._textbox.getValue()},Dn.prototype._handleKey=function(e){e.stopPropagation();var t=e.keyCode||e.charCode;if(t===27)return e.preventDefault(),this.cancel();if(t===13&&!e.shiftKey)return e.preventDefault(),this.complete()},Dn.prototype._handleResize=function(e){this._fire("resize",e)},Dn.prototype._handleFocusout=function(e){e.relatedTarget&&this._textbox.parent.contains(e.relatedTarget)||this.complete()},Dn.prototype.activate=function(e){if(this.isActive()&&this.cancel(),this._eventBus.fire("directEditing.activate.allowed",{element:e})===!1)return!1;var t,n=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 fb={__depends__:[uc],__init__:["directEditing"],directEditing:["type",Dn]};function K2(e){return function(t){var n=t.target,i=ee(e),r=i.eventDefinitions&&i.eventDefinitions[0],o=i.$type===n.type,a=(r&&r.$type)===n.eventDefinitionType,s=!!n.triggeredByEvent==!!i.triggeredByEvent,c=n.isExpanded===void 0||n.isExpanded===We(e);return!o||!a||!s||!c}}const X2={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 Z(e,t={}){var n=X2[e];if(!n)throw new Error("unknown popup entry <"+e+">");return{...n,actionName:"replace-with-"+e,...t}}var Z2=[Z("none-start-event",{actionName:"replace-with-none-start"}),Z("none-intermediate-throwing"),Z("none-end-event",{actionName:"replace-with-none-end"}),Z("message-start"),Z("timer-start"),Z("conditional-start"),Z("signal-start")],Q2=[Z("none-start-event",{actionName:"replace-with-none-start"}),Z("none-intermediate-throwing"),Z("none-end-event",{actionName:"replace-with-none-end"})],J2=[Z("none-start-event",{actionName:"replace-with-none-start"}),Z("none-intermediate-throwing",{actionName:"replace-with-none-intermediate-throw"}),Z("none-end-event",{actionName:"replace-with-none-end"}),Z("message-intermediate-catch"),Z("message-intermediate-throw"),Z("timer-intermediate-catch"),Z("escalation-intermediate-throw"),Z("conditional-intermediate-catch"),Z("link-intermediate-catch"),Z("link-intermediate-throw"),Z("compensation-intermediate-throw"),Z("signal-intermediate-catch"),Z("signal-intermediate-throw")],ek=[Z("none-start-event",{actionName:"replace-with-none-start"}),Z("none-intermediate-throwing",{actionName:"replace-with-none-intermediate-throw"}),Z("none-end-event",{actionName:"replace-with-none-end"}),Z("message-end"),Z("escalation-end"),Z("error-end"),Z("cancel-end"),Z("compensation-end"),Z("signal-end"),Z("terminate-end")],tk=[Z("exclusive-gateway"),Z("parallel-gateway"),Z("inclusive-gateway"),Z("complex-gateway"),Z("event-based-gateway")],nk=[Z("transaction"),Z("event-subprocess"),Z("expanded-ad-hoc-subprocess",{actionName:"replace-with-ad-hoc-subprocess",label:"Ad-hoc sub-process"}),Z("collapsed-subprocess")],ik=[Z("expanded-subprocess",{actionName:"replace-with-subprocess",label:"Sub-process"}),Z("transaction"),Z("event-subprocess"),Z("collapsed-ad-hoc-subprocess")],db=[Z("transaction"),Z("expanded-subprocess",{actionName:"replace-with-subprocess",label:"Sub-process"}),Z("expanded-ad-hoc-subprocess",{actionName:"replace-with-ad-hoc-subprocess",label:"Ad-hoc sub-process"}),Z("event-subprocess")],rk=db,hb=[Z("task"),Z("user-task"),Z("service-task"),Z("send-task"),Z("receive-task"),Z("manual-task"),Z("rule-task"),Z("script-task"),Z("call-activity"),Z("collapsed-subprocess"),Z("expanded-subprocess"),Z("collapsed-ad-hoc-subprocess"),Z("expanded-ad-hoc-subprocess",{actionName:"replace-with-ad-hoc-subprocess"})],ok=[Z("data-store-reference")],ak=[Z("data-object-reference")],sk=[Z("message-boundary"),Z("timer-boundary"),Z("escalation-boundary"),Z("conditional-boundary"),Z("error-boundary"),Z("cancel-boundary"),Z("signal-boundary"),Z("compensation-boundary"),Z("non-interrupting-message-boundary"),Z("non-interrupting-timer-boundary"),Z("non-interrupting-escalation-boundary"),Z("non-interrupting-conditional-boundary"),Z("non-interrupting-signal-boundary")],ck=[Z("message-start"),Z("timer-start"),Z("conditional-start"),Z("signal-start"),Z("error-start"),Z("escalation-start"),Z("compensation-start"),Z("non-interrupting-message-start"),Z("non-interrupting-timer-start"),Z("non-interrupting-conditional-start"),Z("non-interrupting-signal-start"),Z("non-interrupting-escalation-start")],uk=[{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"}],lk=[Z("expanded-pool"),Z("collapsed-pool",{label:function(e){var t="Empty pool/participant";return e.children&&e.children.length&&(t+=" (removes content)"),t}})],pk={"bpmn:MessageEventDefinition":[Z("message-start"),Z("message-intermediate-catch"),Z("message-intermediate-throw"),Z("message-end")],"bpmn:TimerEventDefinition":[Z("timer-start"),Z("timer-intermediate-catch")],"bpmn:ConditionalEventDefinition":[Z("conditional-start"),Z("conditional-intermediate-catch")],"bpmn:SignalEventDefinition":[Z("signal-start"),Z("signal-intermediate-catch"),Z("signal-intermediate-throw"),Z("signal-end")],"bpmn:ErrorEventDefinition":[Z("error-start"),Z("error-end")],"bpmn:EscalationEventDefinition":[Z("escalation-start"),Z("escalation-intermediate-throw"),Z("escalation-end")],"bpmn:CompensateEventDefinition":[Z("compensation-start"),Z("compensation-intermediate-throw"),Z("compensation-end")]};const mb={"start-event-non-interrupting":`
315
+ </svg>`},_2=900;function No(e,t,n,i){e.registerProvider(_2,this),this._contextPad=e,this._popupMenu=t,this._translate=n,this._canvas=i}No.$inject=["contextPad","popupMenu","translate","canvas"],No.prototype.getMultiElementContextPadEntries=function(e){var t={};return this._isAllowed(e)&&j(t,this._getEntries(e)),t},No.prototype._isAllowed=function(e){return!this._popupMenu.isEmpty(e,"align-elements")},No.prototype._getEntries=function(){var e=this;return{"align-elements":{group:"align-elements",title:e._translate("Align elements"),html:`<div class="entry">${Ib.align}</div>`,action:{click:function(t,n){var i=e._getMenuPosition(n);j(i,{cursor:{x:t.x,y:t.y}}),e._popupMenu.open(n,"align-elements",i)}}}}},No.prototype._getMenuPosition=function(e){var t=5,n=this._contextPad.getPad(e).html,i=n.getBoundingClientRect(),r={x:i.left,y:i.bottom+t};return r};var x2=["left","center","right","top","middle","bottom"];function Ba(e,t,n,i){this._alignElements=t,this._translate=n,this._popupMenu=e,this._rules=i,e.registerProvider("align-elements",this)}Ba.$inject=["popupMenu","alignElements","translate","rules"],Ba.prototype.getPopupMenuEntries=function(e){var t={};return this._isAllowed(e)&&j(t,this._getEntries(e)),t},Ba.prototype._isAllowed=function(e){return this._rules.allowed("elements.align",{elements:e})},Ba.prototype._getEntries=function(e){var t=this._alignElements,n=this._translate,i=this._popupMenu,r={};return D(x2,function(o){r["align-elements-"+o]={group:"align",title:n("Align elements "+o),className:"bjs-align-elements-menu-entry",imageHtml:Ib[o],action:function(){t.trigger(e,o),i.close()}}}),r};function eu(e){Vn.call(this,e)}eu.$inject=["eventBus"],pe(eu,Vn),eu.prototype.init=function(){this.addRule("elements.align",function(e){var t=e.elements,n=He(t,function(i){return!(i.waypoints||i.host||i.labelTarget)});return n=Es(n),n.length<2?!1:n})};const w2={__depends__:[DM,Uv,vf],__init__:["alignElementsContextPadProvider","alignElementsMenuProvider","bpmnAlignElements"],alignElementsContextPadProvider:["type",No],alignElementsMenuProvider:["type",Ba],bpmnAlignElements:["type",eu]};function zi(e,t,n,i){Q.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=Pu(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});D(l,function(f,p){Ee(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"],pe(zi,Q),zi.prototype._getOptimalBounds=function(e,t){var n=this.getOffset(t),i=this.getPadding(t),r=xe(Mt(e)),o=xe(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),Cs(j({},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(E2(i,t)){var r=S2(ei(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 E2(e,t){return e.x!==t.x||e.y!==t.y||e.width!==t.width||e.height!==t.height}function S2(e,t){var n="";return e=xe(e),t=xe(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 tu(e){e.invoke(zi,this)}tu.$inject=["injector"],pe(tu,zi),tu.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 $a(e){Vn.call(this,e);var t=this;this.addRule("element.autoResize",function(n){return t.canResize(n.elements,n.target)})}$a.$inject=["eventBus"],pe($a,Vn),$a.prototype.canResize=function(e,t){return!1};function nu(e,t){$a.call(this,e),this._modeling=t}pe(nu,$a),nu.$inject=["eventBus","modeling"],nu.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 D(e,function(i){if(v(i,"bpmn:Lane")||$e(i)){n=!1;return}}),n};const R2={__init__:["bpmnAutoResize","bpmnAutoResizeProvider"],bpmnAutoResize:["type",tu],bpmnAutoResizeProvider:["type",nu]};function Bo(e,t,n){this._canvas=n,this._opts=j({scrollThresholdIn:[20,20,20,20],scrollThresholdOut:[0,0,0,0],scrollRepeatTimeout:15,scrollStep:10},e);var i=this;t.on("drag.move",function(r){var o=i._toBorderPoint(r);i.startScroll(o)}),t.on(["drag.cleanup"],function(){i.stopScroll()})}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++)C2(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 C2(e,t,n){return t<e&&e<n}Bo.prototype.stopScroll=function(){clearTimeout(this._scrolling)},Bo.prototype.setOptions=function(e){this._opts=j({},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 Nb="djs-bendpoint",Bb="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 bf(e,t,n){var i=A2(e,n),r=Bl(t,i);return r}function _f(e,t){var n=_e("g");qe(n).add(Nb),Oe(e,n);var i=_e("circle");fe(i,{cx:0,cy:0,r:4}),qe(i).add("djs-visual"),Oe(n,i);var r=_e("circle");return fe(r,{cx:0,cy:0,r:10}),qe(r).add("djs-hit"),Oe(n,r),t&&qe(n).add(t),n}function T2(e,t,n,i){var r=_e("g");Oe(e,r);var o=18,a=6,s=11,c=k2(t,n,i),u=a+s,l=_e("rect");fe(l,{x:-o/2,y:-a/2,width:o,height:a}),qe(l).add("djs-visual"),Oe(r,l);var f=_e("rect");return fe(f,{x:-c/2,y:-u/2,width:c,height:u}),qe(f).add("djs-hit"),Oe(r,f),lm(r,i==="v"?90:0),r}function $b(e,t,n){var i=_e("g"),r=fl(t,n),o=Mi(t,n);return Oe(e,i),T2(i,t,n,o),qe(i).add(Bb),qe(i).add(o==="h"?"horizontal":"vertical"),Qt(i,r.x,r.y),i}function xf(e){return Math.abs(Math.round(e*2/3))}function M2(e,t){var n=O2(e,t);return Gl(e,n)}function k2(e,t,n){var i=t.x-e.x,r=t.y-e.y;return xf(n==="h"?i:r)}function O2(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=Xm(e,[a,s]);c<i&&(i=c,r=o)}return[n[r],n[r+1]]}function jb(e,t,n,i,r){function o(x,w,C){var P=x.index,L=x.point,T,B,k,O,$,ie;return P<=0||x.bendpoint?!1:(T=w[P-1],B=w[P],k=fl(T,B),O=Mi(T,B),$=Math.abs(L.x-k.x),ie=Math.abs(L.y-k.y),O&&$<=C&&ie<=C)}function a(x,w){var C=x.waypoints,P,L,T,B;return w.index<=0||w.bendpoint||(P={start:C[w.index-1],end:C[w.index]},L=Mi(P.start,P.end),!L)?null:(L==="h"?T=P.end.x-P.start.x:T=P.end.y-P.start.y,B=xf(T)/2,B)}function s(x,w){var C=w.waypoints,P=bf(t,C,x),L;if(P){L=a(w,P);var T;if(o(P,C,L)?T=r.start(x,w,P.index):T=i.start(x,w,P.index,!P.bendpoint),T!==!1)return!0}}function c(x,w,C){Me.bind(x,w,function(P){n.triggerMouseEvent(w,P,C),P.stopPropagation()})}function u(x,w){var C=t.getLayer("overlays"),P=ot('.djs-bendpoints[data-element-id="'+Oa(x.id)+'"]',C);return!P&&w&&(P=_e("g"),fe(P,{"data-element-id":x.id}),qe(P).add("djs-bendpoints"),Oe(C,P),c(P,"mousedown",x),c(P,"click",x),c(P,"dblclick",x)),P}function l(x,w){return ot('.djs-segment-dragger[data-segment-idx="'+x+'"]',w)}function f(x,w){w.waypoints.forEach(function(C,P){var L=_f(x);Oe(x,L),Qt(L,C.x,C.y)}),_f(x,"floating")}function p(x,w){for(var C=w.waypoints,P,L,T,B=1;B<C.length;B++)P=C[B-1],L=C[B],Mi(P,L)&&(T=$b(x,P,L),fe(T,{"data-segment-idx":B}),c(T,"mousemove",w))}function d(x){D(bs("."+Nb,x),function(w){jt(w)})}function h(x){D(bs("."+Bb,x),function(w){jt(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 S(x,w){var C=ot(".floating",x),P=w.point;C&&(Qt(C,P.x,P.y),qe(C).add("positioned"))}function E(x,w,C){var P=l(w.index,x),L=C[w.index-1],T=C[w.index],B=w.point,k=fl(L,T),O=Mi(L,T),$,ie;P&&($=D2(P),ie={x:B.x-k.x,y:B.y-k.y},O==="v"&&(ie={x:ie.y,y:ie.x}),Qt($,ie.x,ie.y))}e.on("connection.changed",function(x){g(x.element)}),e.on("connection.remove",function(x){var w=u(x.element);w&&jt(w)}),e.on("element.marker.update",function(x){var w=x.element,C;w.waypoints&&(C=m(w),x.add?qe(C).add(x.marker):qe(C).remove(x.marker))}),e.on("element.mousemove",function(x){var w=x.element,C=w.waypoints,P,L;if(C){if(P=u(w,!0),L=bf(t,C,x.originalEvent),!L)return;S(P,L),L.bendpoint||E(P,L,C)}}),e.on("element.mousedown",function(x){if(sr(x)){var w=x.originalEvent,C=x.element;if(C.waypoints)return s(w,C)}}),e.on("selection.changed",function(x){var w=x.newSelection,C=w[0];C&&C.waypoints&&m(C)}),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 C=u(w);if(C){var P=ot(".floating",C);P&&qe(P).remove("positioned")}}}),e.on("element.updateId",function(x){var w=x.element,C=x.newId;if(w.waypoints){var P=u(w);P&&fe(P,{"data-element-id":C})}}),this.addHandles=m,this.updateHandles=g,this.getBendpointsContainer=u,this.getSegmentDragger=l}jb.$inject=["eventBus","canvas","interactionEvents","bendpointMove","connectionSegmentMove"];function D2(e){return ot(".djs-visual",e)}var Fb=Math.round,Ur="reconnectStart",qr="reconnectEnd",ja="updateWaypoints";function wf(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=qr:h=ja;var m=h===ja?"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===ja?"connection.updateWaypoints":"connection.reconnect";if(d=s.allowed=r.allowed(h,{connection:c,source:p===Ur?f:u,target:p===qr?f:l}),d){s.source=p===Ur?f:u,s.target=p===qr?f:l;return}d===!1&&(d=s.allowed=r.allowed(h,{connection:c,source:p===qr?f:l,target:p===Ur?f:u})),d&&(s.source=p===qr?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!==ja&&(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||{},S={x:Fb(a.x),y:Fb(a.y)};if(!c)return!1;m===ja?(f?p.splice(u,0,S):p[u]=S,g.bendpointMove={insert:f,bendpointIndex:u},p=this.cropWaypoints(l,p),o.updateWaypoints(l,X1(p),g)):(m===Ur?(g.docking="source",iu(s)&&(g.docking="target",g.newWaypoints=p.reverse())):m===qr&&(g.docking="target",iu(s)&&(g.docking="source",g.newWaypoints=p.reverse())),o.reconnect(l,d,h,S,g))},this)}wf.$inject=["injector","eventBus","canvas","dragging","rules","modeling"],wf.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 iu(e){var t=e.hover,n=e.source,i=e.target,r=e.type;if(r===Ur)return t&&i&&t===i&&n!==i;if(r===qr)return t&&n&&t===n&&n!==i}var L2="reconnectStart",I2="reconnectEnd",Hb="updateWaypoints",Fa="connect-ok",ru="connect-not-ok",zb="connect-hover",Gb="djs-updating",Vb="djs-dragging",Wb=1100;function Ub(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=_f(i.getLayer("overlays"));qe(p).add("djs-dragging"),i.addMarker(c,Vb),i.addMarker(c,Gb)}),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,zb),u===Hb)return;s?(i.removeMarker(c,ru),i.addMarker(c,Fa)):s===!1&&(i.removeMarker(c,Fa),i.addMarker(c,ru))}}),n.on(["bendpoint.move.out","bendpoint.move.cleanup"],Wb,function(o){var a=o.context,s=a.hover,c=a.target;s&&(i.removeMarker(s,zb),i.removeMarker(s,c?Fa:ru))}),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},S=a.hints||{},E={};r&&(S.connectionStart&&(E.connectionStart=S.connectionStart),S.connectionEnd&&(E.connectionEnd=S.connectionEnd),f===L2?iu(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===I2?iu(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===Hb&&(m=e.cropWaypoints(p,m)),E.waypoints=m,r.drawPreview(a,s,E)),Qt(u,o.x,o.y)},this),n.on(["bendpoint.move.end","bendpoint.move.cancel"],Wb,function(o){var a=o.context,s=a.connection,c=a.draggerGfx,u=a.hover,l=a.target,f=a.waypoints;s.waypoints=f,jt(c),i.removeMarker(s,Gb),i.removeMarker(s,Vb),u&&(i.removeMarker(u,Fa),i.removeMarker(u,l?Fa:ru)),r&&r.cleanUp(a)})}Ub.$inject=["bendpointMove","injector","eventBus","canvas"];var qb="connect-hover",Yb="djs-updating";function Kb(e,t,n){return Ef(e,t,e[t]+n)}function Ef(e,t,n){return{x:t==="x"?n:e.x,y:t==="y"?n:e.y}}function N2(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 Ef(t,i,s)}function Xb(e){return e==="x"?"y":"x"}function Zb(e,t,n){var i,r;return e.original?e.original:(i=Se(t),r=Xb(n),Ef(e,r,i[r]))}function Qb(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,S=d,E=p.waypoints,x=E[g],w=E[S],C=bf(n,E,f),P,L,T;if(P=Mi(x,w),!!P)return L=P==="v"?"x":"y",g===0&&(x=Zb(x,p.source,L)),S===E.length-1&&(w=Zb(w,p.target,L)),C?T=C.point:T={x:(x.x+w.x)/2,y:(x.y+w.y)/2},h={connection:p,segmentStartIndex:g,segmentEndIndex:S,segmentStart:x,segmentEnd:w,axis:L,dragPosition:T},i.init(f,T,"connectionSegment.move",{cursor:L==="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],S=f.segmentEndIndex+p,E=h[S],x=Xb(f.axis),w=N2(d,g,E,x);Qt(f.draggerGfx,w.x,w.y)}function l(f,p){var d=0,h=f.filter(function(m,g){return pl(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=$b(h,p.segmentStart,p.segmentEnd),qe(p.draggerGfx).add("djs-dragging"),n.addMarker(d,Yb)}),t.on("connectionSegment.move.move",function(f){var p=f.context,d=p.connection,h=p.segmentStartIndex,m=p.segmentEndIndex,g=p.segmentStart,S=p.segmentEnd,E=p.axis,x=p.originalWaypoints.slice(),w=Kb(g,E,f["d"+E]),C=Kb(S,E,f["d"+E]),P=x.length,L=0;x[h]=w,x[m]=C;var T,B;h<2&&(T=Zt(d.source,w),h===1?T==="intersect"&&(x.shift(),x[0]=w,L--):T!=="intersect"&&(x.unshift(g),L++)),m>P-3&&(B=Zt(d.target,C),m===P-2?B==="intersect"&&(x.pop(),x[x.length-1]=C):B!=="intersect"&&x.push(S)),p.newWaypoints=d.waypoints=s(d,x),u(p,L,f),p.newSegmentStartIndex=h+L,c(f)}),t.on("connectionSegment.move.hover",function(f){f.context.hover=f.hover,n.addMarker(f.hover,qb)}),t.on(["connectionSegment.move.out","connectionSegment.move.cleanup"],function(f){var p=f.context.hover;p&&n.removeMarker(p,qb)}),t.on("connectionSegment.move.cleanup",function(f){var p=f.context,d=p.connection;p.draggerGfx&&jt(p.draggerGfx),n.removeMarker(d,Yb)}),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(C){return{original:C.original,x:Math.round(C.x),y:Math.round(C.y)}});var g=l(h,m),S=g.waypoints,E=s(d,S),x=g.segmentOffset,w={segmentMove:{segmentStartIndex:p.segmentStartIndex,newSegmentStartIndex:m+x}};o.updateWaypoints(d,E,w)})}Qb.$inject=["injector","eventBus","canvas","dragging","graphicsFactory","modeling"];var B2=Math.abs,Jb=Math.round;function $2(e,t,n){n=n===void 0?10:n;var i,r;for(i=0;i<t.length;i++)if(r=t[i],B2(r-e)<=n)return r}function e_(e){return{x:e.x,y:e.y}}function t_(e){return{x:e.x+e.width,y:e.y+e.height}}function Yn(e,t){return!e||isNaN(e.x)||isNaN(e.y)?t:{x:Jb(e.x+e.width/2),y:Jb(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 n_(e){return e.children||[]}var j2=Math.abs,i_=Math.round,Sf=10;function r_(e){function t(o,a){if(Ee(o)){for(var s=o.length;s--;)if(j2(o[s]-a)<=Sf)return o[s]}else{o=+o;var c=a%o;if(c<Sf)return a-c;if(c>o-Sf)return a-c+o}return a}function n(o,a){if(o.waypoints)return M2(a,o);if(o.width)return{x:i_(o.width/2+o.x),y:i_(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:[]},D(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;j(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:[]},D(u,function(l){l&&(l=l.original||l,a.horizontal.push(l.y),a.vertical.push(l.x))}),a}e.on(["connect.hover","connect.move","connect.end"],1500,function(o){var a=o.context,s=a.hover,c=s&&n(s,o);!at(s)||!c||!c.x||!c.y||(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;j(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)}})}r_.$inject=["eventBus"];const F2={__depends__:[Ni,gi],__init__:["bendpoints","bendpointSnapping","bendpointMovePreview"],bendpoints:["type",jb],bendpointMove:["type",wf],bendpointMovePreview:["type",Ub],connectionSegmentMove:["type",Qb],bendpointSnapping:["type",r_]};function o_(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:Rf(s)?l:u,connectionEnd:Rf(s)?u:l};Vt(c)&&(d=c),s.connection=n.connect(f,p,d,h)}),this.start=function(a,s,c,u){Vt(c)||(u=c,c=Se(s)),t.init(a,"connect",{autoActivate:u,data:{shape:s,context:{start:s,connectionStart:c}}})}}o_.$inject=["eventBus","dragging","modeling","rules"];function Rf(e){var t=e.hover,n=e.source,i=e.target;return t&&n&&t===n&&n!==i}var H2=1100,z2=900,a_="connect-ok",s_="connect-not-ok";function c_(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;Rf(o)&&(h=d,m=p),i.drawPreview(o,a,{source:c||u,target:f||s,connectionStart:h,connectionEnd:m})}),t.on("connect.hover",z2,function(r){var o=r.context,a=r.hover,s=o.canExecute;s!==null&&n.addMarker(a,s?a_:s_)}),t.on(["connect.out","connect.cleanup"],H2,function(r){var o=r.hover;o&&(n.removeMarker(o,a_),n.removeMarker(o,s_))}),i&&t.on("connect.cleanup",function(r){i.cleanUp(r.context)})}c_.$inject=["injector","eventBus","canvas"];const Cf={__depends__:[Wn,gi,Ni],__init__:["connectPreview"],connect:["type",o_],connectPreview:["type",c_]};var G2="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()),_s(i),r||(r=e.getConnection=V2(function(m,g,S){return h.getConnection(m,g,S)})),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?Se(o):c,a?Se(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||Se(n),o=t.connectionEnd||Se(i),a=this.cropWaypoints(r,o,n,i),s=this.createNoopConnection(a[0],a[1]);Oe(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&&ea(o,s,!0)||e,t=i&&ea(a,s,!1)||t,[e,t]},Gi.prototype.cleanUp=function(e){e&&e.connectionPreviewGfx&&jt(e.connectionPreviewGfx)},Gi.prototype.getConnection=function(e){var t=W2(e);return this._elementFactory.createConnection(t)},Gi.prototype.createConnectionPreviewGfx=function(){var e=_e("g");return fe(e,{pointerEvents:"none"}),qe(e).add(G2),Oe(this._canvas.getActiveLayer(),e),e},Gi.prototype.createNoopConnection=function(e,t){return Xo([e,t],{stroke:"#333",strokeDasharray:[1],strokeWidth:2,"pointer-events":"none"})};function V2(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 W2(e){return Vt(e)?e:{}}const U2={__init__:["connectionPreview"],connectionPreview:["type",Gi]},ou="complex-preview";class u_{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(ou);n.filter(s=>!q2(s)).forEach(s=>{let c;at(s)?(c=this._graphicsFactory._createContainer("connection",_e("g")),this._graphicsFactory.drawConnection(Ir(c),s)):(c=this._graphicsFactory._createContainer("shape",_e("g")),this._graphicsFactory.drawShape(Ir(c),s),Qt(c,s.x,s.y)),this._previewSupport.addDragger(s,a,c)}),i.forEach(({element:s,delta:c})=>{this._previewSupport.addDragger(s,a,void 0,"djs-dragging"),this._canvas.addMarker(s,"djs-element-hidden"),this._markers.push([s,"djs-element-hidden"]);const u=this._previewSupport.addDragger(s,a);at(s)?Qt(u,c.x,c.y):Qt(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",_e("g"));this._graphicsFactory.drawShape(Ir(u),s,{width:c.width,height:c.height}),Qt(u,c.x,c.y),this._previewSupport.addDragger(s,a,u)})}cleanUp(){_s(this._canvas.getLayer(ou)),this._markers.forEach(([t,n])=>this._canvas.removeMarker(t,n)),this._markers=[]}show(){this._canvas.showLayer(ou)}hide(){this._canvas.hideLayer(ou)}}u_.$inject=["canvas","graphicsFactory","previewSupport"];function q2(e){return e.hidden}const Y2={__depends__:[Ao],__init__:["complexPreview"],complexPreview:["type",u_]},l_=Math.round;function au(e,t,n,i,r,o){this._complexPreview=e,this._connectionDocking=t,this._elementFactory=n,this._eventBus=i,this._layouter=r,this._rules=o}au.prototype.create=function(e,t,n){const i=this._complexPreview,r=this._connectionDocking,o=this._elementFactory,a=this._eventBus,s=this._layouter,c=this._rules,u=o.createShape(j({type:t},n)),l=a.fire("autoPlace",{source:e,shape:u});if(!l)return;j(u,{x:l.x-l_(u.width/2),y:l.y-l_(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))})},au.prototype.cleanUp=function(){this._complexPreview.cleanUp()},au.$inject=["complexPreview","connectionDocking","elementFactory","eventBus","layouter","rules"];const K2={__depends__:[Dc,Y2,Zp],__init__:["appendPreview"],appendPreview:["type",au]};var p_=Math.min,f_=Math.max;function Pf(e){e.preventDefault()}function Ha(e){e.stopPropagation()}function X2(e){return e.nodeType===Node.TEXT_NODE}function Z2(e){return[].slice.call(e)}function ni(e){this.container=e.container,this.parent=ft('<div class="djs-direct-editing-parent"><div class="djs-direct-editing-content" contenteditable="true"></div></div>'),this.content=ot("[contenteditable]",this.parent),this.keyHandler=e.keyHandler||function(){},this.resizeHandler=e.resizeHandler||function(){},this.focusoutHandler=e.focusoutHandler||function(){},this.autoResize=vn(this.autoResize,this),this.handlePaste=vn(this.handlePaste,this)}ni.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=ei(t,["width","height","maxWidth","maxHeight","minWidth","minHeight","left","top","backgroundColor","position","overflow","border","wordWrap","textAlign","outline","transform"]);j(o.style,{width:e.width+"px",height:e.height+"px",maxWidth:e.maxWidth+"px",maxHeight:e.maxHeight+"px",minWidth:e.minWidth+"px",minHeight:e.minHeight+"px",left:e.x+"px",top:e.y+"px",backgroundColor:"#ffffff",position:"absolute",overflow:"visible",border:"1px solid #ccc",boxSizing:"border-box",wordWrap:"normal",textAlign:"center",outline:"none"},c);var u=ei(t,["fontFamily","fontSize","fontWeight","lineHeight","padding","paddingTop","paddingRight","paddingBottom","paddingLeft"]);return j(a.style,{boxSizing:"border-box",width:"100%",outline:"none",wordWrap:"break-word"},u),i.centerVertically&&j(a.style,{position:"absolute",top:"50%",transform:"translate(0, -50%)"},u),a.innerText=n,Me.bind(a,"keydown",this.keyHandler),Me.bind(a,"mousedown",Ha),Me.bind(a,"paste",r.handlePaste),Me.bind(a,"focusout",this.focusoutHandler),i.autoResize&&Me.bind(a,"input",this.autoResize),i.resizable&&this.resizable(t),s.appendChild(o),this.setSelection(a.lastChild,a.lastChild&&a.lastChild.length),o},ni.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)}},ni.prototype.insertText=function(e){e=Q2(e);var t=document.execCommand("insertText",!1,e);t||this._insertTextIE(e)},ni.prototype._insertTextIE=function(e){var t=this.getSelection(),n=t.startContainer,i=t.endContainer,r=t.startOffset,o=t.endOffset,a=t.commonAncestorContainer,s=Z2(a.childNodes),c,u;if(X2(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&&li(h)}),c=n,u=r+e.length}c&&u!==void 0&&setTimeout(function(){self.setSelection(c,u)})},ni.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})}},ni.prototype.resizable=function(){var e=this,t=this.parent,n=this.resizeHandle,i=parseInt(this.style.minWidth)||0,r=parseInt(this.style.minHeight)||0,o=parseInt(this.style.maxWidth)||1/0,a=parseInt(this.style.maxHeight)||1/0;if(!n){n=this.resizeHandle=ft('<div class="djs-direct-editing-resize-handle"></div>');var s,c,u,l,f=function(h){Pf(h),Ha(h),s=h.clientX,c=h.clientY;var m=t.getBoundingClientRect();u=m.width,l=m.height,Me.bind(document,"mousemove",p),Me.bind(document,"mouseup",d)},p=function(h){Pf(h),Ha(h);var m=p_(f_(u+h.clientX-s,i),o),g=p_(f_(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){Pf(h),Ha(h),Me.unbind(document,"mousemove",p,!1),Me.unbind(document,"mouseup",d,!1)};Me.bind(n,"mousedown",f)}j(n.style,{position:"absolute",bottom:"0px",right:"0px",cursor:"nwse-resize",width:"0",height:"0",borderTop:(parseInt(this.style.fontSize)/4||3)+"px solid transparent",borderRight:(parseInt(this.style.fontSize)/4||3)+"px solid #ccc",borderBottom:(parseInt(this.style.fontSize)/4||3)+"px solid #ccc",borderLeft:(parseInt(this.style.fontSize)/4||3)+"px solid transparent"}),t.appendChild(n)},ni.prototype.destroy=function(){var e=this.parent,t=this.content,n=this.resizeHandle;t.innerText="",e.removeAttribute("style"),t.removeAttribute("style"),Me.unbind(t,"keydown",this.keyHandler),Me.unbind(t,"mousedown",Ha),Me.unbind(t,"input",this.autoResize),Me.unbind(t,"paste",this.handlePaste),Me.unbind(t,"focusout",this.focusoutHandler),n&&(n.removeAttribute("style"),li(n)),li(e)},ni.prototype.getValue=function(){return this.content.innerText.trim()},ni.prototype.getSelection=function(){var e=window.getSelection(),t=e.getRangeAt(0);return t},ni.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 Q2(e){return e.replace(/\r\n|\r|\n/g,`
316
+ `)}function Dn(e,t){this._eventBus=e,this._canvas=t,this._providers=[],this._textbox=new ni({container:t.getContainer(),keyHandler:vn(this._handleKey,this),resizeHandler:vn(this._handleResize,this),focusoutHandler:vn(this._handleFocusout,this)}),e.on(["diagram.clear","diagram.destroy"],()=>this._cleanup())}Dn.$inject=["eventBus","canvas"],Dn.prototype.registerProvider=function(e){this._providers.push(e)},Dn.prototype.isActive=function(e){return!!(this._active&&(!e||this._active.element===e))},Dn.prototype.cancel=function(){this._active&&(this._fire("cancel"),this.close())},Dn.prototype._fire=function(e,t){this._eventBus.fire("directEditing."+e,t||{active:this._active})},Dn.prototype.close=function(){this._fire("deactivate"),this._cleanup(),this._canvas.restoreFocus&&this._canvas.restoreFocus()},Dn.prototype._cleanup=function(){this._active&&(this._textbox.destroy(),this._active=null,this.resizable=void 0)},Dn.prototype.complete=function(){var e=this._active;if(e){var t,n=e.context.bounds,i=this.$textbox.getBoundingClientRect(),r=this.getValue(),o=e.context.text;(r!==o||i.height!==n.height||i.width!==n.width)&&(t=this._textbox.container.getBoundingClientRect(),e.provider.update(e.element,r,e.context.text,{x:i.left-t.left,y:i.top-t.top,width:i.width,height:i.height})),this._fire("complete"),this.close()}},Dn.prototype.getValue=function(){return this._textbox.getValue()},Dn.prototype._handleKey=function(e){e.stopPropagation();var t=e.keyCode||e.charCode;if(t===27)return e.preventDefault(),this.cancel();if(t===13&&!e.shiftKey)return e.preventDefault(),this.complete()},Dn.prototype._handleResize=function(e){this._fire("resize",e)},Dn.prototype._handleFocusout=function(e){e.relatedTarget&&this._textbox.parent.contains(e.relatedTarget)||this.complete()},Dn.prototype.activate=function(e){if(this.isActive()&&this.cancel(),this._eventBus.fire("directEditing.activate.allowed",{element:e})===!1)return!1;var t,n=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 d_={__depends__:[uc],__init__:["directEditing"],directEditing:["type",Dn]};function J2(e){return function(t){var n=t.target,i=ee(e),r=i.eventDefinitions&&i.eventDefinitions[0],o=i.$type===n.type,a=(r&&r.$type)===n.eventDefinitionType,s=!!n.triggeredByEvent==!!i.triggeredByEvent,c=n.isExpanded===void 0||n.isExpanded===We(e);return!o||!a||!s||!c}}const ek={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 Z(e,t={}){var n=ek[e];if(!n)throw new Error("unknown popup entry <"+e+">");return{...n,actionName:"replace-with-"+e,...t}}var tk=[Z("none-start-event",{actionName:"replace-with-none-start"}),Z("none-intermediate-throwing"),Z("none-end-event",{actionName:"replace-with-none-end"}),Z("message-start"),Z("timer-start"),Z("conditional-start"),Z("signal-start")],nk=[Z("none-start-event",{actionName:"replace-with-none-start"}),Z("none-intermediate-throwing"),Z("none-end-event",{actionName:"replace-with-none-end"})],ik=[Z("none-start-event",{actionName:"replace-with-none-start"}),Z("none-intermediate-throwing",{actionName:"replace-with-none-intermediate-throw"}),Z("none-end-event",{actionName:"replace-with-none-end"}),Z("message-intermediate-catch"),Z("message-intermediate-throw"),Z("timer-intermediate-catch"),Z("escalation-intermediate-throw"),Z("conditional-intermediate-catch"),Z("link-intermediate-catch"),Z("link-intermediate-throw"),Z("compensation-intermediate-throw"),Z("signal-intermediate-catch"),Z("signal-intermediate-throw")],rk=[Z("none-start-event",{actionName:"replace-with-none-start"}),Z("none-intermediate-throwing",{actionName:"replace-with-none-intermediate-throw"}),Z("none-end-event",{actionName:"replace-with-none-end"}),Z("message-end"),Z("escalation-end"),Z("error-end"),Z("cancel-end"),Z("compensation-end"),Z("signal-end"),Z("terminate-end")],ok=[Z("exclusive-gateway"),Z("parallel-gateway"),Z("inclusive-gateway"),Z("complex-gateway"),Z("event-based-gateway")],ak=[Z("transaction"),Z("event-subprocess"),Z("expanded-ad-hoc-subprocess",{actionName:"replace-with-ad-hoc-subprocess",label:"Ad-hoc sub-process"}),Z("collapsed-subprocess")],sk=[Z("expanded-subprocess",{actionName:"replace-with-subprocess",label:"Sub-process"}),Z("transaction"),Z("event-subprocess"),Z("collapsed-ad-hoc-subprocess")],h_=[Z("transaction"),Z("expanded-subprocess",{actionName:"replace-with-subprocess",label:"Sub-process"}),Z("expanded-ad-hoc-subprocess",{actionName:"replace-with-ad-hoc-subprocess",label:"Ad-hoc sub-process"}),Z("event-subprocess")],ck=h_,m_=[Z("task"),Z("user-task"),Z("service-task"),Z("send-task"),Z("receive-task"),Z("manual-task"),Z("rule-task"),Z("script-task"),Z("call-activity"),Z("collapsed-subprocess"),Z("expanded-subprocess"),Z("collapsed-ad-hoc-subprocess"),Z("expanded-ad-hoc-subprocess",{actionName:"replace-with-ad-hoc-subprocess"})],uk=[Z("data-store-reference")],lk=[Z("data-object-reference")],pk=[Z("message-boundary"),Z("timer-boundary"),Z("escalation-boundary"),Z("conditional-boundary"),Z("error-boundary"),Z("cancel-boundary"),Z("signal-boundary"),Z("compensation-boundary"),Z("non-interrupting-message-boundary"),Z("non-interrupting-timer-boundary"),Z("non-interrupting-escalation-boundary"),Z("non-interrupting-conditional-boundary"),Z("non-interrupting-signal-boundary")],fk=[Z("message-start"),Z("timer-start"),Z("conditional-start"),Z("signal-start"),Z("error-start"),Z("escalation-start"),Z("compensation-start"),Z("non-interrupting-message-start"),Z("non-interrupting-timer-start"),Z("non-interrupting-conditional-start"),Z("non-interrupting-signal-start"),Z("non-interrupting-escalation-start")],dk=[{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"}],hk=[Z("expanded-pool"),Z("collapsed-pool",{label:function(e){var t="Empty pool/participant";return e.children&&e.children.length&&(t+=" (removes content)"),t}})],mk={"bpmn:MessageEventDefinition":[Z("message-start"),Z("message-intermediate-catch"),Z("message-intermediate-throw"),Z("message-end")],"bpmn:TimerEventDefinition":[Z("timer-start"),Z("timer-intermediate-catch")],"bpmn:ConditionalEventDefinition":[Z("conditional-start"),Z("conditional-intermediate-catch")],"bpmn:SignalEventDefinition":[Z("signal-start"),Z("signal-intermediate-catch"),Z("signal-intermediate-throw"),Z("signal-end")],"bpmn:ErrorEventDefinition":[Z("error-start"),Z("error-end")],"bpmn:EscalationEventDefinition":[Z("escalation-start"),Z("escalation-intermediate-throw"),Z("escalation-end")],"bpmn:CompensateEventDefinition":[Z("compensation-start"),Z("compensation-intermediate-throw"),Z("compensation-end")]};const g_={"start-event-non-interrupting":`
317
317
  <svg viewBox="0 0 2048 2048" xmlns="http://www.w3.org/2000/svg">
318
318
  <g transform="translate(0 995.64)">
319
319
  <path d="m1899 28.357c21.545 567.43-598.38 1023.5-1133.6 835.92-548.09-147.21-801.57-873.95-463.59-1330 302.62-480.3 1071.7-507.54 1407.6-49.847 122.14 153.12 190.07 348.07 189.59 543.91z" fill="none" stroke="currentColor" stroke-dasharray="418.310422, 361.2328165" stroke-linecap="round" stroke-width="100"/>
@@ -324,7 +324,7 @@
324
324
  <circle cx="1024" cy="28.357" r="875" stroke-dasharray="418.310422, 361.2328165" stroke-width="100"/>
325
325
  <circle cx="1024" cy="28.357" r="685" stroke-dasharray="348.31044857,261.23283643" stroke-dashoffset="500" stroke-width="100"/>
326
326
  </g>
327
- </svg>`};function Kn(e,t,n,i,r,o,a,s){this._bpmnFactory=e,this._popupMenu=t,this._modeling=n,this._moddle=i,this._bpmnReplace=r,this._rules=o,this._translate=a,this._moddleCopy=s,this._register()}Kn.$inject=["bpmnFactory","popupMenu","modeling","moddle","bpmnReplace","rules","translate","moddleCopy"],Kn.prototype._register=function(){this._popupMenu.registerProvider("bpmn-replace",this)},Kn.prototype.getPopupMenuEntries=function(e){var s;var t=e.businessObject,n=this._rules,i=[],r,o=[];if(Ee(e)||!n.allowed("shape.replace",{element:e}))return{};var a=K2(e);return v(t,"bpmn:DataObjectReference")?this._createEntries(e,ok):v(t,"bpmn:DataStoreReference")&&!v(e.parent,"bpmn:Collaboration")?this._createEntries(e,ak):(v(t,"bpmn:Event")&&!v(t,"bpmn:BoundaryEvent")&&(r=(s=t.get("eventDefinitions")[0])==null?void 0:s.$type,i=pk[r]||[],!un(t.$parent)&&v(t.$parent,"bpmn:SubProcess")&&(i=He(i,function(c){return c.target.type!=="bpmn:StartEvent"}))),v(t,"bpmn:StartEvent")&&!v(t.$parent,"bpmn:SubProcess")?(o=He(Z2.concat(i),a),this._createEntries(e,o)):v(t,"bpmn:Participant")?(o=He(lk,function(c){return We(e)!==c.target.isExpanded}),this._createEntries(e,o)):v(t,"bpmn:StartEvent")&&un(t.$parent)?(o=He(ck.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=He(Q2.concat(i),a),this._createEntries(e,o)):v(t,"bpmn:EndEvent")?(o=He(ek.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=He(sk,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=He(J2.concat(i),a),this._createEntries(e,o)):v(t,"bpmn:Gateway")?(o=He(tk,a),this._createEntries(e,o)):v(t,"bpmn:Transaction")?(o=He(db,a),this._createEntries(e,o)):un(t)&&We(e)?(o=He(rk,a),this._createEntries(e,o)):v(t,"bpmn:AdHocSubProcess")&&We(e)?(o=He(ik,a),this._createEntries(e,o)):v(t,"bpmn:SubProcess")&&We(e)?(o=He(nk,a),this._createEntries(e,o)):v(t,"bpmn:SubProcess")&&!We(e)?(o=He(hb,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,uk):v(t,"bpmn:FlowNode")?(o=He(hb,a),this._createEntries(e,o)):{})},Kn.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)}),lg(e)&&(t={...t,...this._getNonInterruptingHeaderEntries(e)}),t},Kn.prototype._createEntries=function(e,t){var n={},i=this;return D(t,function(r){n[r.actionName]=i._createEntry(r,e)}),n},Kn.prototype._createSequenceFlowEntries=function(e,t){var n=ee(e),i={},r=this._modeling,o=this._moddle,a=this;return D(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},Kn.prototype._createEntry=function(e,t,n){var i=this._translate,r=this._bpmnReplace.replaceElement,o=function(){return r(t,e.target)},a=e.label;return a&&typeof a=="function"&&(a=a(t)),n=n||o,{label:i(a),className:e.className,action:n}},Kn.prototype._getLoopCharacteristicsHeaderEntries=function(e){var t=this,n=this._translate;function i(u,l){if(l.active){t._modeling.updateProperties(e,{loopCharacteristics:void 0});return}var 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=ee(e),o=r.loopCharacteristics,a,s,c;return o&&(a=o.isSequential,s=o.isSequential===void 0,c=o.isSequential!==void 0&&!o.isSequential),{"toggle-parallel-mi":{className:"bpmn-icon-parallel-mi-marker",title:n("Parallel multi-instance"),active:c,action:i,options:{loopCharacteristics:"bpmn:MultiInstanceLoopCharacteristics",isSequential:!1}},"toggle-sequential-mi":{className:"bpmn-icon-sequential-mi-marker",title:n("Sequential multi-instance"),active:a,action:i,options:{loopCharacteristics:"bpmn:MultiInstanceLoopCharacteristics",isSequential:!0}},"toggle-loop":{className:"bpmn-icon-loop-marker",title:n("Loop"),active:s,action:i,options:{loopCharacteristics:"bpmn:StandardLoopCharacteristics"}}}},Kn.prototype._getCollectionHeaderEntries=function(e){var t=this,n=this._translate,i=e.businessObject.dataObjectRef;if(!i)return{};function r(a,s){t._modeling.updateModdleProperties(e,i,{isCollection:!s.active})}var o=i.isCollection;return{"toggle-is-collection":{className:"bpmn-icon-parallel-mi-marker",title:n("Collection"),active:o,action:r}}},Kn.prototype._getParticipantMultiplicityHeaderEntries=function(e){var t=this,n=this._bpmnFactory,i=this._translate;function r(a,s){var c=s.active,u;c||(u=n.create("bpmn:ParticipantMultiplicity")),t._modeling.updateProperties(e,{participantMultiplicity:u})}var o=e.businessObject.participantMultiplicity;return{"toggle-participant-multiplicity":{className:"bpmn-icon-parallel-mi-marker",title:i("Participant multiplicity"),active:!!o,action:r}}},Kn.prototype._getNonInterruptingHeaderEntries=function(e){const t=this._translate,n=ee(e),i=this,r=pg(e),o=v(e,"bpmn:BoundaryEvent")?mb["intermediate-event-non-interrupting"]:mb["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 fk={__depends__:[vf,ky,Dc],__init__:["replaceMenuProvider"],replaceMenuProvider:["type",Kn]};function za(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(!(!da(d)||!i.isOpen(m))){var g=i.getEntries(m);g.replace&&g.replace.action.click(d,m)}}),n.on("contextPad.close",function(){p.cleanUp()})}za.$inject=["config.contextPad","injector","eventBus","contextPad","modeling","elementFactory","connect","create","popupMenu","canvas","rules","translate","appendPreview"],za.prototype.getMultiElementContextPadEntries=function(e){var t=this._modeling,n={};return this._isDeleteAllowed(e)&&j(n,{delete:{group:"edit",className:"bpmn-icon-trash",title:this._translate("Delete"),action:{click:function(i,r){t.removeElements(r.slice())}}}}),n},za.prototype._isDeleteAllowed=function(e){var t=this._rules.allowed("elements.delete",{elements:e});return Ee(t)?Pr(e,n=>t.includes(n)):t},za.prototype.getContextPadEntries=function(e){var t=this._contextPad,n=this._modeling,i=this._elementFactory,r=this._connect,o=this._create,a=this._popupMenu,s=this._autoPlace,c=this._translate,u=this._appendPreview,l={};if(e.type==="label")return this._isDeleteAllowed([e])&&j(l,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,C=t.getPad(x).html,P=C.getBoundingClientRect(),L={x:P.left,y:P.bottom+w};return L}function g(x,w,C,P){function L(k,O){var $=i.createShape(j({type:x},P));o.start(k,$,{source:O})}var T=s?function(k,O){var $=i.createShape(j({type:x},P));s.append(O,$)}:L,B=s?function(k,O){return u.create(O,x,P),()=>{u.cleanUp()}}:null;return{group:"model",className:w,title:C,action:{dragstart:L,click:T,hover:B}}}function S(x){return function(w,C){n.splitLane(C,x),t.open(C,!0)}}if(Fe(f,["bpmn:Lane","bpmn:Participant"])&&We(e)){var E=or(e);j(l,{"lane-insert-above":{group:"lane-insert-above",className:"bpmn-icon-lane-insert-above",title:c("Add lane above"),action:{click:function(x,w){n.addLane(w,"top")}}}}),E.length<2&&((Ut(e)?e.height>=120:e.width>=120)&&j(l,{"lane-divide-two":{group:"lane-divide",className:"bpmn-icon-lane-divide-two",title:c("Divide into two lanes"),action:{click:S(2)}}}),(Ut(e)?e.height>=180:e.width>=180)&&j(l,{"lane-divide-three":{group:"lane-divide",className:"bpmn-icon-lane-divide-three",title:c("Divide into three lanes"),action:{click:S(3)}}})),j(l,{"lane-insert-below":{group:"lane-insert-below",className:"bpmn-icon-lane-insert-below",title:c("Add lane below"),action:{click:function(x,w){n.addLane(w,"bottom")}}}})}return v(f,"bpmn:FlowNode")&&(v(f,"bpmn:EventBasedGateway")?j(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"})}):gb(f,"bpmn:BoundaryEvent","bpmn:CompensateEventDefinition")?j(l,{"append.compensation-activity":g("bpmn:Task","bpmn-icon-task",c("Append compensation activity"),{isForCompensation:!0})}):!v(f,"bpmn:EndEvent")&&!f.isForCompensation&&!gb(f,"bpmn:IntermediateThrowEvent","bpmn:LinkEventDefinition")&&!un(f)&&j(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")||j(l,{replace:{group:"edit",className:"bpmn-icon-screw-wrench",title:c("Change element"),action:{click:function(x,w){var C=j(m(w),{cursor:{x:x.x,y:x.y}});a.open(w,"bpmn-replace",C,{title:c("Change element"),width:"var(--bpmn-replace-popup-width, 300px)",search:!0})}}}}),v(f,"bpmn:SequenceFlow")&&j(l,{"append.text-annotation":g("bpmn:TextAnnotation","bpmn-icon-text-annotation",c("Add text annotation"))}),v(f,"bpmn:MessageFlow")&&j(l,{"append.text-annotation":g("bpmn:TextAnnotation","bpmn-icon-text-annotation",c("Add text annotation"))}),Fe(f,["bpmn:FlowNode","bpmn:InteractionNode","bpmn:DataObjectReference","bpmn:DataStoreReference"])&&j(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")&&j(l,{connect:{group:"connect",className:"bpmn-icon-connection-multi",title:c("Connect using association"),action:{click:p,dragstart:p}}}),Fe(f,["bpmn:DataObjectReference","bpmn:DataStoreReference"])&&j(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")&&j(l,{"append.text-annotation":g("bpmn:TextAnnotation","bpmn-icon-text-annotation",c("Add text annotation"))}),this._isDeleteAllowed([e])&&j(l,h()),l};function gb(e,t,n){var i=e.$instanceOf(t),r=!1,o=e.eventDefinitions||[];return D(o,function(a){a.$type===n&&(r=!0)}),i&&r}const dk={__depends__:[W2,fb,Wv,Wn,Cf,pc,fk],__init__:["contextPadProvider"],contextPadProvider:["type",za]};var hk={horizontal:["x","width"],vertical:["y","height"]},yb=5;function Vi(e,t){this._modeling=e,this._filters=[],this.registerFilter(function(n){var i=t.allowed("elements.distribute",{elements:n});return Ee(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?(D(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=ri(e,i);return D(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=hk[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+yb,max:t+n-yb}};const mk={__init__:["distributeElements"],distributeElements:["type",Vi]};function su(e){Vn.call(this,e)}su.$inject=["eventBus"],pe(su,Vn),su.prototype.init=function(){this.addRule("elements.distribute",function(e){var t=e.elements;return t=He(t,function(n){var i=Fe(n,["bpmn:Association","bpmn:BoundaryEvent","bpmn:DataInputAssociation","bpmn:DataOutputAssociation","bpmn:Lane","bpmn:MessageFlow","bpmn:SequenceFlow","bpmn:TextAnnotation"]);return!(n.labelTarget||i)}),t=Es(t),t.length<3?!1:t})};var vb={horizontal:`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1800 1800">
327
+ </svg>`};function Kn(e,t,n,i,r,o,a,s){this._bpmnFactory=e,this._popupMenu=t,this._modeling=n,this._moddle=i,this._bpmnReplace=r,this._rules=o,this._translate=a,this._moddleCopy=s,this._register()}Kn.$inject=["bpmnFactory","popupMenu","modeling","moddle","bpmnReplace","rules","translate","moddleCopy"],Kn.prototype._register=function(){this._popupMenu.registerProvider("bpmn-replace",this)},Kn.prototype.getPopupMenuEntries=function(e){var s;var t=e.businessObject,n=this._rules,i=[],r,o=[];if(Ee(e)||!n.allowed("shape.replace",{element:e}))return{};var a=J2(e);return v(t,"bpmn:DataObjectReference")?this._createEntries(e,uk):v(t,"bpmn:DataStoreReference")&&!v(e.parent,"bpmn:Collaboration")?this._createEntries(e,lk):(v(t,"bpmn:Event")&&!v(t,"bpmn:BoundaryEvent")&&(r=(s=t.get("eventDefinitions")[0])==null?void 0:s.$type,i=mk[r]||[],!un(t.$parent)&&v(t.$parent,"bpmn:SubProcess")&&(i=He(i,function(c){return c.target.type!=="bpmn:StartEvent"}))),v(t,"bpmn:StartEvent")&&!v(t.$parent,"bpmn:SubProcess")?(o=He(tk.concat(i),a),this._createEntries(e,o)):v(t,"bpmn:Participant")?(o=He(hk,function(c){return We(e)!==c.target.isExpanded}),this._createEntries(e,o)):v(t,"bpmn:StartEvent")&&un(t.$parent)?(o=He(fk.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=He(nk.concat(i),a),this._createEntries(e,o)):v(t,"bpmn:EndEvent")?(o=He(rk.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=He(pk,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=He(ik.concat(i),a),this._createEntries(e,o)):v(t,"bpmn:Gateway")?(o=He(ok,a),this._createEntries(e,o)):v(t,"bpmn:Transaction")?(o=He(h_,a),this._createEntries(e,o)):un(t)&&We(e)?(o=He(ck,a),this._createEntries(e,o)):v(t,"bpmn:AdHocSubProcess")&&We(e)?(o=He(sk,a),this._createEntries(e,o)):v(t,"bpmn:SubProcess")&&We(e)?(o=He(ak,a),this._createEntries(e,o)):v(t,"bpmn:SubProcess")&&!We(e)?(o=He(m_,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,dk):v(t,"bpmn:FlowNode")?(o=He(m_,a),this._createEntries(e,o)):{})},Kn.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)}),pg(e)&&(t={...t,...this._getNonInterruptingHeaderEntries(e)}),t},Kn.prototype._createEntries=function(e,t){var n={},i=this;return D(t,function(r){n[r.actionName]=i._createEntry(r,e)}),n},Kn.prototype._createSequenceFlowEntries=function(e,t){var n=ee(e),i={},r=this._modeling,o=this._moddle,a=this;return D(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},Kn.prototype._createEntry=function(e,t,n){var i=this._translate,r=this._bpmnReplace.replaceElement,o=function(){return r(t,e.target)},a=e.label;return a&&typeof a=="function"&&(a=a(t)),n=n||o,{label:i(a),className:e.className,action:n}},Kn.prototype._getLoopCharacteristicsHeaderEntries=function(e){var t=this,n=this._translate;function i(u,l){if(l.active){t._modeling.updateProperties(e,{loopCharacteristics:void 0});return}var 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=ee(e),o=r.loopCharacteristics,a,s,c;return o&&(a=o.isSequential,s=o.isSequential===void 0,c=o.isSequential!==void 0&&!o.isSequential),{"toggle-parallel-mi":{className:"bpmn-icon-parallel-mi-marker",title:n("Parallel multi-instance"),active:c,action:i,options:{loopCharacteristics:"bpmn:MultiInstanceLoopCharacteristics",isSequential:!1}},"toggle-sequential-mi":{className:"bpmn-icon-sequential-mi-marker",title:n("Sequential multi-instance"),active:a,action:i,options:{loopCharacteristics:"bpmn:MultiInstanceLoopCharacteristics",isSequential:!0}},"toggle-loop":{className:"bpmn-icon-loop-marker",title:n("Loop"),active:s,action:i,options:{loopCharacteristics:"bpmn:StandardLoopCharacteristics"}}}},Kn.prototype._getCollectionHeaderEntries=function(e){var t=this,n=this._translate,i=e.businessObject.dataObjectRef;if(!i)return{};function r(a,s){t._modeling.updateModdleProperties(e,i,{isCollection:!s.active})}var o=i.isCollection;return{"toggle-is-collection":{className:"bpmn-icon-parallel-mi-marker",title:n("Collection"),active:o,action:r}}},Kn.prototype._getParticipantMultiplicityHeaderEntries=function(e){var t=this,n=this._bpmnFactory,i=this._translate;function r(a,s){var c=s.active,u;c||(u=n.create("bpmn:ParticipantMultiplicity")),t._modeling.updateProperties(e,{participantMultiplicity:u})}var o=e.businessObject.participantMultiplicity;return{"toggle-participant-multiplicity":{className:"bpmn-icon-parallel-mi-marker",title:i("Participant multiplicity"),active:!!o,action:r}}},Kn.prototype._getNonInterruptingHeaderEntries=function(e){const t=this._translate,n=ee(e),i=this,r=fg(e),o=v(e,"bpmn:BoundaryEvent")?g_["intermediate-event-non-interrupting"]:g_["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 gk={__depends__:[vf,Oy,Dc],__init__:["replaceMenuProvider"],replaceMenuProvider:["type",Kn]};function za(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(!(!da(d)||!i.isOpen(m))){var g=i.getEntries(m);g.replace&&g.replace.action.click(d,m)}}),n.on("contextPad.close",function(){p.cleanUp()})}za.$inject=["config.contextPad","injector","eventBus","contextPad","modeling","elementFactory","connect","create","popupMenu","canvas","rules","translate","appendPreview"],za.prototype.getMultiElementContextPadEntries=function(e){var t=this._modeling,n={};return this._isDeleteAllowed(e)&&j(n,{delete:{group:"edit",className:"bpmn-icon-trash",title:this._translate("Delete"),action:{click:function(i,r){t.removeElements(r.slice())}}}}),n},za.prototype._isDeleteAllowed=function(e){var t=this._rules.allowed("elements.delete",{elements:e});return Ee(t)?Pr(e,n=>t.includes(n)):t},za.prototype.getContextPadEntries=function(e){var t=this._contextPad,n=this._modeling,i=this._elementFactory,r=this._connect,o=this._create,a=this._popupMenu,s=this._autoPlace,c=this._translate,u=this._appendPreview,l={};if(e.type==="label")return this._isDeleteAllowed([e])&&j(l,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,C=t.getPad(x).html,P=C.getBoundingClientRect(),L={x:P.left,y:P.bottom+w};return L}function g(x,w,C,P){function L(k,O){var $=i.createShape(j({type:x},P));o.start(k,$,{source:O})}var T=s?function(k,O){var $=i.createShape(j({type:x},P));s.append(O,$)}:L,B=s?function(k,O){return u.create(O,x,P),()=>{u.cleanUp()}}:null;return{group:"model",className:w,title:C,action:{dragstart:L,click:T,hover:B}}}function S(x){return function(w,C){n.splitLane(C,x),t.open(C,!0)}}if(Fe(f,["bpmn:Lane","bpmn:Participant"])&&We(e)){var E=or(e);j(l,{"lane-insert-above":{group:"lane-insert-above",className:"bpmn-icon-lane-insert-above",title:c("Add lane above"),action:{click:function(x,w){n.addLane(w,"top")}}}}),E.length<2&&((Ut(e)?e.height>=120:e.width>=120)&&j(l,{"lane-divide-two":{group:"lane-divide",className:"bpmn-icon-lane-divide-two",title:c("Divide into two lanes"),action:{click:S(2)}}}),(Ut(e)?e.height>=180:e.width>=180)&&j(l,{"lane-divide-three":{group:"lane-divide",className:"bpmn-icon-lane-divide-three",title:c("Divide into three lanes"),action:{click:S(3)}}})),j(l,{"lane-insert-below":{group:"lane-insert-below",className:"bpmn-icon-lane-insert-below",title:c("Add lane below"),action:{click:function(x,w){n.addLane(w,"bottom")}}}})}return v(f,"bpmn:FlowNode")&&(v(f,"bpmn:EventBasedGateway")?j(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"})}):y_(f,"bpmn:BoundaryEvent","bpmn:CompensateEventDefinition")?j(l,{"append.compensation-activity":g("bpmn:Task","bpmn-icon-task",c("Append compensation activity"),{isForCompensation:!0})}):!v(f,"bpmn:EndEvent")&&!f.isForCompensation&&!y_(f,"bpmn:IntermediateThrowEvent","bpmn:LinkEventDefinition")&&!un(f)&&j(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")||j(l,{replace:{group:"edit",className:"bpmn-icon-screw-wrench",title:c("Change element"),action:{click:function(x,w){var C=j(m(w),{cursor:{x:x.x,y:x.y}});a.open(w,"bpmn-replace",C,{title:c("Change element"),width:"var(--bpmn-replace-popup-width, 300px)",search:!0})}}}}),v(f,"bpmn:SequenceFlow")&&j(l,{"append.text-annotation":g("bpmn:TextAnnotation","bpmn-icon-text-annotation",c("Add text annotation"))}),v(f,"bpmn:MessageFlow")&&j(l,{"append.text-annotation":g("bpmn:TextAnnotation","bpmn-icon-text-annotation",c("Add text annotation"))}),Fe(f,["bpmn:FlowNode","bpmn:InteractionNode","bpmn:DataObjectReference","bpmn:DataStoreReference"])&&j(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")&&j(l,{connect:{group:"connect",className:"bpmn-icon-connection-multi",title:c("Connect using association"),action:{click:p,dragstart:p}}}),Fe(f,["bpmn:DataObjectReference","bpmn:DataStoreReference"])&&j(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")&&j(l,{"append.text-annotation":g("bpmn:TextAnnotation","bpmn-icon-text-annotation",c("Add text annotation"))}),this._isDeleteAllowed([e])&&j(l,h()),l};function y_(e,t,n){var i=e.$instanceOf(t),r=!1,o=e.eventDefinitions||[];return D(o,function(a){a.$type===n&&(r=!0)}),i&&r}const yk={__depends__:[K2,d_,Uv,Wn,Cf,pc,gk],__init__:["contextPadProvider"],contextPadProvider:["type",za]};var vk={horizontal:["x","width"],vertical:["y","height"]},v_=5;function Vi(e,t){this._modeling=e,this._filters=[],this.registerFilter(function(n){var i=t.allowed("elements.distribute",{elements:n});return Ee(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?(D(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=ri(e,i);return D(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=vk[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+v_,max:t+n-v_}};const bk={__init__:["distributeElements"],distributeElements:["type",Vi]};function su(e){Vn.call(this,e)}su.$inject=["eventBus"],pe(su,Vn),su.prototype.init=function(){this.addRule("elements.distribute",function(e){var t=e.elements;return t=He(t,function(n){var i=Fe(n,["bpmn:Association","bpmn:BoundaryEvent","bpmn:DataInputAssociation","bpmn:DataOutputAssociation","bpmn:Lane","bpmn:MessageFlow","bpmn:SequenceFlow","bpmn:TextAnnotation"]);return!(n.labelTarget||i)}),t=Es(t),t.length<3?!1:t})};var b_={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>`},gk=900;function Ga(e,t,n,i){this._distributeElements=t,this._translate=n,this._popupMenu=e,this._rules=i,e.registerProvider("align-elements",gk,this)}Ga.$inject=["popupMenu","distributeElements","translate","rules"],Ga.prototype.getPopupMenuEntries=function(e){var t={};return this._isAllowed(e)&&j(t,this._getEntries(e)),t},Ga.prototype._isAllowed=function(e){return this._rules.allowed("elements.distribute",{elements:e})},Ga.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:vb.horizontal,action:function(o,a){t.trigger(e,"horizontal"),i.close()}},"distribute-elements-vertical":{group:"distribute",title:n("Distribute elements vertically"),imageHtml:vb.vertical,action:function(o,a){t.trigger(e,"vertical"),i.close()}}};return r};const yk={__depends__:[vf,mk],__init__:["bpmnDistributeElements","distributeElementsMenuProvider"],bpmnDistributeElements:["type",su],distributeElementsMenuProvider:["type",Ga]};var _b="is not a registered action",vk="is already registered";function Xn(e,t){this._eventBus=e,this._actions={};var n=this;e.on("diagram.init",function(){n._registerDefaultActions(t),e.fire("editorActions.init",{editorActions:n})})}Xn.$inject=["eventBus","injector"],Xn.prototype._registerDefaultActions=function(e){var t=e.get("commandStack",!1),n=e.get("modeling",!1),i=e.get("selection",!1),r=e.get("zoomScroll",!1),o=e.get("copyPaste",!1),a=e.get("canvas",!1),s=e.get("rules",!1),c=e.get("keyboardMove",!1),u=e.get("keyboardMoveSelection",!1);t&&(this.register("undo",function(){t.undo()}),this.register("redo",function(){t.redo()})),o&&i&&this.register("copy",function(){var l=i.get();if(l.length)return o.copy(l)}),o&&i&&this.register("duplicate",function(){var l=i.get();if(l.length)return o.duplicate(l)}),o&&this.register("paste",function(){o.paste()}),o&&i&&s&&this.register("cut",function(){var l=i.get();if(l.length){var f=s.allowed("elements.delete",{elements:l});if(f!==!1){var p=Ee(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&&(Ee(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)})},Xn.prototype.trigger=function(e,t){if(!this._actions[e])throw Af(e,_b);var n=this._eventBus.fire("editorActions.allowed",{action:e,opts:t});if(n!==!1)return this._actions[e](t)},Xn.prototype.register=function(e,t){var n=this;if(typeof e=="string")return this._registerAction(e,t);D(e,function(i,r){n._registerAction(r,i)})},Xn.prototype._registerAction=function(e,t){if(this.isRegistered(e))throw Af(e,vk);this._actions[e]=t},Xn.prototype.unregister=function(e){if(!this.isRegistered(e))throw Af(e,_b);this._actions[e]=void 0},Xn.prototype.getActions=function(){return Object.keys(this._actions)},Xn.prototype.isRegistered=function(e){return!!this._actions[e]};function Af(e,t){return new Error(e+" "+t)}const _k={__init__:["editorActions"],editorActions:["type",Xn]};function cu(e){e.invoke(Xn,this)}pe(cu,Xn),cu.$inject=["injector"],cu.prototype._registerDefaultActions=function(e){Xn.prototype._registerDefaultActions.call(this,e);var t=e.get("canvas",!1),n=e.get("elementRegistry",!1),i=e.get("selection",!1),r=e.get("spaceTool",!1),o=e.get("lassoTool",!1),a=e.get("handTool",!1),s=e.get("globalConnect",!1),c=e.get("distributeElements",!1),u=e.get("alignElements",!1),l=e.get("directEditing",!1),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=[],S=h.type;m.length&&(g=He(m,function(E){return!v(E,"bpmn:Lane")}),u.trigger(g,S))}),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(S){return v(S.parent,"bpmn:Collaboration")}):g=n.filter(function(S){return S!==h&&!v(S.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 bk={__depends__:[_k],editorActions:["type",cu]};function bb(e){e.on(["create.init","shape.move.init"],function(t){var n=t.context,i=t.shape;Fe(i,["bpmn:Participant","bpmn:SubProcess","bpmn:TextAnnotation"])&&(n.gridSnappingContext||(n.gridSnappingContext={}),n.gridSnappingContext.snapLocation="top-left")})}bb.$inject=["eventBus"];function Yr(e,t){Q.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)}})}Yr.$inject=["eventBus","gridSnapping","modeling"],pe(Yr,Q),Yr.prototype.snapSimple=function(e,t){var n=this._gridSnapping;return t.width=n.snapValue(t.width,{min:t.width}),t.height=n.snapValue(t.height,{min:t.height}),t.x=e.x+e.width/2-t.width/2,t.y=e.y+e.height/2-t.height/2,t},Yr.prototype.snapComplex=function(e,t){return/w|e/.test(t)&&(e=this.snapHorizontally(e,t)),/n|s/.test(t)&&(e=this.snapVertically(e,t)),e},Yr.prototype.snapHorizontally=function(e,t){var n=this._gridSnapping,i=/w/.test(t),r=/e/.test(t),o={};return o.width=n.snapValue(e.width,{min:e.width}),r&&(i?(o.x=n.snapValue(e.x,{max:e.x}),o.width+=n.snapValue(e.x-o.x,{min:e.x-o.x})):e.x=e.x+e.width-o.width),j(e,o),e},Yr.prototype.snapVertically=function(e,t){var n=this._gridSnapping,i=/n/.test(t),r=/s/.test(t),o={};return o.height=n.snapValue(e.height,{min:e.height}),i&&(r?(o.y=n.snapValue(e.y,{max:e.y}),o.height+=n.snapValue(e.y-o.y,{min:e.y-o.y})):e.y=e.y+e.height-o.height),j(e,o),e};var xk=2e3;function xb(e,t){e.on(["spaceTool.move","spaceTool.end"],xk,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)}})}xb.$inject=["eventBus","gridSnapping"];const wk={__init__:["gridSnappingResizeBehavior","gridSnappingSpaceToolBehavior"],gridSnappingResizeBehavior:["type",Yr],gridSnappingSpaceToolBehavior:["type",xb]};var uu=10;function Tf(e,t,n){return n||(n="round"),Math[n](e/t)*t}var Ek=1200,Sk=800;function vr(e,t,n){var i=!n||n.active!==!1;this._eventBus=t;var r=this;t.on("diagram.init",Sk,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"],Ek,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=Rk(o,u);p&&j(l,p),$o(o,u)||r.snapEvent(o,u,l)})}})}vr.prototype.snapEvent=function(e,t,n){var i=this.snapValue(e[t],n);Lt(e,t,i)},vr.prototype.getGridSpacing=function(){return uu},vr.prototype.snapValue=function(e,t){var n=0;t&&t.offset&&(n=t.offset),e+=n,e=Tf(e,uu);var i,r;return t&&t.min&&(i=t.min,Pe(i)&&(i=Tf(i+n,uu,"ceil"),e=Math.max(e,i))),t&&t.max&&(r=t.max,Pe(r)&&(r=Tf(r+n,uu,"floor"),e=Math.min(e,r))),e-=n,e},vr.prototype.isActive=function(){return this.active},vr.prototype.setActive=function(e){this.active=e,this._eventBus.fire("gridSnapping.toggle",{active:e})},vr.prototype.toggleActive=function(){this.setActive(!this.active)},vr.$inject=["elementRegistry","eventBus","config.gridSnapping"];function Rk(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&&(lu(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&&(lu(t)?Eb(s)?a.x.max=c.left:a.x.min=c.right:wb(s)?a.y.max=c.top:a.y.min=c.bottom),u&&(lu(t)?Eb(s)?a.x.min=u.left:a.x.max=u.right:wb(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&&Pe(s[t])||(s||(s=o.snapOffset={}),Pe(s[t])||(s[t]=0),!r)||(n.get(r.id)||(lu(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 lu(e){return e==="x"}function wb(e){return e.indexOf("n")!==-1}function Eb(e){return e.indexOf("w")!==-1}const Pk={__depends__:[wk],__init__:["gridSnapping"],gridSnapping:["type",vr]};var Ak=2e3;function Sb(e,t,n){e.on("autoPlace",Ak,function(i){var r=i.source,o=Se(r),a=i.shape,s=Ev(r,a,n);return["x","y"].forEach(function(c){var u={};s[c]!==o[c]&&(s[c]>o[c]?u.min=s[c]:u.max=s[c],v(a,"bpmn:TextAnnotation")&&(Tk(c)?u.offset=-a.width/2:u.offset=-a.height/2),s[c]=t.snapValue(s[c],u))}),s})}Sb.$inject=["eventBus","gridSnapping","elementRegistry"];function Tk(e){return e==="x"}var Mk=1750;function Rb(e,t,n){t.on(["create.start","shape.move.start"],Mk,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}))}})}Rb.$inject=["canvas","eventBus","gridSnapping"];var kk=3e3;function pu(e,t,n){Q.call(this,e),this._gridSnapping=t;var i=this;this.postExecuted(["connection.create","connection.layout"],kk,function(r){var o=r.context,a=o.connection,s=o.hints||{},c=a.waypoints;s.connectionStart||s.connectionEnd||s.createElementsBehavior===!1||Ok(c)&&n.updateWaypoints(a,i.snapMiddleSegments(c))})}pu.$inject=["eventBus","gridSnapping","modeling"],pe(pu,Q),pu.prototype.snapMiddleSegments=function(e){var t=this._gridSnapping,n;e=e.slice();for(var i=1;i<e.length-2;i++)n=Ik(t,e[i],e[i+1]),e[i]=n[0],e[i+1]=n[1];return e};function Ok(e){return e.length>3}function Dk(e){return e==="h"}function Lk(e){return e==="v"}function Ik(e,t,n){var i=Mi(t,n),r={};return Dk(i)&&(r.y=e.snapValue(t.y)),Lk(i)&&(r.x=e.snapValue(t.x)),("x"in r||"y"in r)&&(t=j({},t,r),n=j({},n,r)),[t,n]}const Nk={__depends__:[Pk,{__init__:["gridSnappingAutoPlaceBehavior","gridSnappingParticipantBehavior","gridSnappingLayoutConnectionBehavior"],gridSnappingAutoPlaceBehavior:["type",Sb],gridSnappingParticipantBehavior:["type",Rb],gridSnappingLayoutConnectionBehavior:["type",pu]}],__init__:["bpmnGridSnapping"],bpmnGridSnapping:["type",bb]};var Bk=30,Cb=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 We(r)?n._createParticipantHit(r,o):n._createDefaultHit(r,o);if(v(r,"bpmn:SubProcess"))return We(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=Ut(e)?{width:Bk,height:e.height}:{width:e.width,height:Cb};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:Cb}),!0};const $k={__init__:["bpmnInteractionEvents"],bpmnInteractionEvents:["type",Va]};function fu(e){e.invoke(ko,this)}pe(fu,ko),fu.$inject=["injector"],fu.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 jk={__depends__:[nf],__init__:["keyboardBindings"],keyboardBindings:["type",fu]};var Fk={moveSpeed:1,moveSpeedAccelerated:10},Hk=1500,Pb="left",Ab="up",Tb="right",Mb="down",zk={ArrowLeft:Pb,Left:Pb,ArrowUp:Ab,Up:Ab,ArrowRight:Tb,Right:Tb,ArrowDown:Mb,Down:Mb},Gk={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 kb(e,t,n,i,r){var o=this;this._config=j({},Fk,e||{}),t.addListener(Hk,function(a){var s=a.keyEvent,c=zk[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=Gk[a](u),f=i.allowed("elements.move",{shapes:c,hints:{keyboardMove:!0}});f&&n.moveElements(c,l)}}}kb.$inject=["config.keyboardMoveSelection","keyboard","modeling","rules","selection"];const Vk={__depends__:[nf,Wn],__init__:["keyboardMoveSelection"],keyboardMoveSelection:["type",kb]};var Ob=10;function Wa(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=FR(l,f,u),c.newBounds=zR(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:xe(l)})}function s(c){var u=c.shape,l=c.canExecute,f=c.newBounds;if(l){if(f=Kh(f),!Wk(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)})}Wa.prototype.canResize=function(e){var t=this._rules,n=ei(e,["newBounds","shape","delta","direction"]);return t.allowed("shape.resize",n)},Wa.prototype.activate=function(e,t,n){var i=this._dragging,r,o;if(typeof n=="string"&&(n={direction:n}),r=j({shape:t},n),o=r.direction,!o)throw new Error("must provide a direction (n|w|s|e|nw|se|ne|sw)");i.init(e,Db(t,o),"resize",{autoActivate:!0,cursor:Uk(o),data:{shape:t,context:r}})},Wa.prototype.computeMinResizeBox=function(e){var t=e.shape,n=e.direction,i,r;return i=e.minDimensions||{width:Ob,height:Ob},r=Nm(t,e.childrenBoxPadding),GR(n,t,i,r)},Wa.$inject=["eventBus","rules","modeling","dragging"];function Wk(e,t){return e.x!==t.x||e.y!==t.y||e.width!==t.width||e.height!==t.height}function Db(e,t){var n=Se(e),i=xe(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 Uk(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 Lb="djs-resizing",Ib="resize-not-ok",qk=500;function Nb(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,Lb)),s.width>5&&fe(c,{x:s.x,width:s.width}),s.height>5&&fe(c,{y:s.y,height:s.height}),o.canExecute?qe(c).remove(Ib):qe(c).add(Ib)}function r(o){var a=o.shape,s=o.frame;s&&jt(o.frame),t.removeMarker(a,Lb)}e.on("resize.move",qk,function(o){i(o.context)}),e.on("resize.cleanup",function(o){r(o.context)})}Nb.$inject=["eventBus","canvas","previewSupport"];var du=-6,hu=8,mu=20,Ua="djs-resizer",Yk=["n","w","s","e","nw","ne","se","sw"];function _r(e,t,n,i){this._resize=i,this._canvas=t;var r=this;e.on("selection.changed",function(o){var a=o.newSelection;r.removeResizers(),a.length===1&&D(a,vn(r.addResizer,r))}),e.on("shape.changed",function(o){var a=o.element;n.isSelected(a)&&(r.removeResizers(),r.addResizer(a))})}_r.prototype.makeDraggable=function(e,t,n){var i=this._resize;function r(o){sr(o)&&i.activate(o,e,n)}Me.bind(t,"mousedown",r),Me.bind(t,"touchstart",r)},_r.prototype._createResizer=function(e,t,n,i){var r=this._getResizersParent(),o=Kk(i),a=be("g");qe(a).add(Ua),qe(a).add(Ua+"-"+e.id),qe(a).add(Ua+"-"+i),Oe(r,a);var s=be("rect");fe(s,{x:-hu/2+o.x,y:-hu/2+o.y,width:hu,height:hu}),qe(s).add(Ua+"-visual"),Oe(a,s);var c=be("rect");return fe(c,{x:-mu/2+o.x,y:-mu/2+o.y,width:mu,height:mu}),qe(c).add(Ua+"-hit"),Oe(a,c),Ts(a,t,n),a},_r.prototype.createResizer=function(e,t){var n=Db(e,t),i=this._createResizer(e,n.x,n.y,t);this.makeDraggable(e,i,t)},_r.prototype.addResizer=function(e){var t=this;at(e)||D(Yk,function(n){t._resize.canResize({shape:e,direction:n})&&t.createResizer(e,n)})},_r.prototype.removeResizers=function(){var e=this._getResizersParent();bs(e)},_r.prototype._getResizersParent=function(){return this._canvas.getLayer("resizers")},_r.$inject=["eventBus","canvas","selection","resize"];function Kk(e){var t={x:0,y:0};return e.indexOf("e")!==-1?t.x=-du:e.indexOf("w")!==-1&&(t.x=du),e.indexOf("s")!==-1?t.y=-du:e.indexOf("n")!==-1&&(t.y=du),t}const Bb={__depends__:[gi,Ni,Ao],__init__:["resize","resizePreview","resizeHandles"],resize:["type",Wa],resizePreview:["type",Nb],resizeHandles:["type",_r]};var Xk=2e3;function qa(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"],Xk,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||Fe(c,["bpmn:Activity","bpmn:Event","bpmn:TextAnnotation","bpmn:Participant"]))&&i.activate(c)}}qa.$inject=["eventBus","bpmnFactory","canvas","directEditing","modeling","resizeHandles","textRenderer"],qa.prototype.activate=function(e){var t=Bn(e);if(t!==void 0){var n={text:t},i=this.getEditingBBox(e);j(n,i);var r={},o=n.style||{};return j(o,{backgroundColor:null,border:null}),(Fe(e,["bpmn:Task","bpmn:Participant","bpmn:Lane","bpmn:CallActivity"])||$b(e))&&j(r,{centerVertically:!0}),ir(e)&&(j(r,{resizable:!0,autoResize:!0}),j(o,{backgroundColor:"#ffffff",border:"1px solid #ccc"})),v(e,"bpmn:TextAnnotation")&&(j(r,{resizable:!0,autoResize:!0}),j(o,{backgroundColor:"#ffffff",border:"1px solid #ccc"})),j(n,{options:r,style:o}),n}},qa.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")||Jk(e)){var h=Ut(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};j(o,m),j(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(Qk(e)){var g=Ut(e),S=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};j(o,S),j(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)"})}(Fe(e,["bpmn:Task","bpmn:CallActivity"])||$b(e))&&(j(o,{width:i.width,height:i.height}),j(d,{fontSize:f+"px",lineHeight:p,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px"})),Zk(e)&&(j(o,{width:i.width,x:i.x}),j(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&&(j(o,{width:x,height:i.height+2*E,x:i.x-E,y:i.y-E}),j(d,{fontSize:u+"px",lineHeight:l})),ir(n)&&!Os(n)&&!$e(n)){var w=gl(e),C=t.getAbsoluteBBox({x:w.x,y:w.y,width:0,height:0}),P=u,L=Nr.width*a+2*E;j(o,{width:L,height:P+2*E,x:C.x-L/2,y:C.y-P/2-E}),j(d,{fontSize:u+"px",lineHeight:l})}return v(e,"bpmn:TextAnnotation")&&(j(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}),j(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}},qa.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}),eO(t)&&(t=null),this._modeling.updateLabel(e,t,r)};function $b(e){return v(e,"bpmn:SubProcess")&&!We(e)}function Zk(e){return v(e,"bpmn:SubProcess")&&We(e)}function Qk(e){return v(e,"bpmn:Participant")&&!We(e)}function Jk(e){return v(e,"bpmn:Participant")&&We(e)}function eO(e){return!e||!e.trim()}var jb="djs-element-hidden",Fb="djs-label-hidden";function Hb(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=be("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=be("path");fe(f,{d:l,strokeWidth:2,stroke:tO(o)}),Oe(s,f),Oe(r,s),Qt(s,o.x,o.y)}v(o,"bpmn:TextAnnotation")||o.labelTarget?t.addMarker(o,jb):(v(o,"bpmn:Task")||v(o,"bpmn:CallActivity")||v(o,"bpmn:SubProcess")||v(o,"bpmn:Participant")||v(o,"bpmn:Lane"))&&t.addMarker(o,Fb)}),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}});fe(i.path,{d:p})}}),e.on(["directEditing.complete","directEditing.cancel"],function(c){var u=c.active;u&&(t.removeMarker(u.element.label||u.element,jb),t.removeMarker(o,Fb)),o=void 0,a=void 0,s&&(jt(s),s=void 0)})}Hb.$inject=["eventBus","canvas","pathMap"];function tO(e,t){var n=Xe(e);return n.get("stroke")||t||"black"}const nO={__depends__:[Lp,Bb,fb],__init__:["labelEditingProvider","labelEditingPreview"],labelEditingProvider:["type",qa],labelEditingPreview:["type",Hb]};var iO=500,rO=1e3;function _i(e,t,n){this._eventBus=e,this._elementRegistry=n,this._outlineOffset=5,this._outlineStyle=t.cls("djs-outline",["no-fill"]);var i=this;function r(o){z1(o)||i.createOutline(o)}e.on("element.hover",function(o){r(o.element)}),e.on("selection.changed",function(o){D(o.newSelection,r)}),e.on(["shape.changed","connection.changed"],iO,function(o){var a=o.element,s=o.gfx,c=ot(".djs-outline",s);c&&i.updateOutline(a,c)})}_i.prototype.createOutline=function(e){var t=this._elementRegistry.getGraphics(e);if(!t)throw new Error("cannot create outline for non-rendered element");var n=ot(".djs-outline",t);return n||(n=this.getOutline(e)||this._createOutlineGfx(),Oe(t,n),this.updateOutline(e,n)),n},_i.prototype._createOutlineGfx=function(){var e=be("rect");return fe(e,j({x:0,y:0,rx:4,width:100,height:100},this._outlineStyle)),e},_i.prototype.updateOutline=function(e,t){e.waypoints?this.updateConnectionOutline(t,e):this.updateShapeOutline(t,e)},_i.prototype.updateShapeOutline=function(e,t){var n=!1,i=this._getProviders();i.length&&D(i,function(r){n=n||r.updateOutline(t,e)}),n||fe(e,{x:-this._outlineOffset,y:-this._outlineOffset,width:t.width+this._outlineOffset*2,height:t.height+this._outlineOffset*2})},_i.prototype.updateConnectionOutline=function(e,t){var n=Mt(t);fe(e,{x:n.x-this._outlineOffset,y:n.y-this._outlineOffset,width:n.width+this._outlineOffset*2,height:n.height+this._outlineOffset*2})},_i.prototype.registerProvider=function(e,t){t||(t=e,e=rO),this._eventBus.on("outline.getProviders",e,function(n){n.providers.push(t)})},_i.prototype._getProviders=function(){var e=this._eventBus.createEvent({type:"outline.getProviders",providers:[]});return this._eventBus.fire(e),e.providers},_i.prototype.getOutline=function(e){var t,n=this._getProviders();return D(n,function(i){Wt(i.getOutline)&&(t=t||i.getOutline(e))}),t},_i.$inject=["eventBus","styles","elementRegistry"];var gu=6;function Mf(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)})}Mf.prototype._updateMultiSelectionOutline=function(e){var t=this._canvas.getLayer("selectionOutline");bs(t);var n=e.length>1,i=this._canvas.getContainer();if(qe(i)[n?"add":"remove"]("djs-multi-select"),!!n){var r=oO(Mt(e)),o=be("rect");fe(o,j({rx:3},r)),qe(o).add("djs-selection-outline"),Oe(t,o)}},Mf.$inject=["eventBus","canvas","selection"];function oO(e){return{x:e.x-gu,y:e.y-gu,width:e.width+gu*2,height:e.height+gu*2}}const kf={__depends__:[Wn],__init__:["outline","multiSelectionOutline"],outline:["type",_i],multiSelectionOutline:["type",Mf]},zb=["bpmn:Event","bpmn:SequenceFlow","bpmn:Gateway"],Gb={class:"bjs-label-link",stroke:"var(--element-selected-outline-secondary-stroke-color)",strokeDasharray:"5, 5"},aO=15,yu=2;function Vb(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=>Fe(h,zb));if(p.length===1){const h=p[0];$e(h)?a(h,h.labelTarget):(d=h.labels)!=null&&d.length&&a(h.labels[0],h)}if(p.length===2){const h=p.find($e),m=p.find(g=>{var S;return(S=g.labels)==null?void 0:S.includes(h)});h&&m&&a(h,m)}}),e.on("shape.changed",function({element:f}){var p;!Fe(f,zb)||!l(f)||($e(f)?a(f,f.labelTarget):(p=f.labels)!=null&&p.length&&a(f.labels[0],f))});function a(f,p){const d=Xo([Se(p),Se(f)],Gb),h=d.getAttribute("d"),g=r.isSelected(f)?c(f):u(f),S=ea(g,h);if(!S)return;const x=r.isSelected(p)?c(p):u(p),w=ea(x,h)||Se(p);la(w,S)<aO||(cl(d,[w,S]),Oe(o,d))}function s(){_s(`.${Gb.class}`,o).forEach(jt)}function c(f){const p=i.getOutline(f);if(!p)return u(f);if(p.x){const d={x:f.x+br(p,"x")-yu,y:f.y+br(p,"y")-yu,width:br(p,"width")+yu*2,height:br(p,"height")+yu*2};return vl(d,br(p,"rx"))}if(p.cx){const d=br(p,"r"),h={x:f.x+br(p,"cx")-d,y:f.y+br(p,"cy")-d,width:d*2,height:d*2};return _m(h)}}function u(f){return n.getShapePath(f)}function l(f){return r.isSelected(f)}}Vb.$inject=["eventBus","canvas","graphicsFactory","outline","selection"];function br(e,t){return parseFloat(fe(e,t)||0)}const sO={__depends__:[Wn,kf],__init__:["labelLink"],labelLink:["type",Vb]};var cO=new Po("tt");function uO(e){var t=ft('<div class="djs-tooltip-container" />');return dn(t,{position:"absolute",width:"0",height:"0"}),e.insertBefore(t,e.firstChild),t}function lO(e,t,n){dn(e,{left:t+"px",top:n+"px"})}function Of(e,t){e.style.display=t===!1?"none":""}var Wb="djs-tooltip",Df="."+Wb;function bn(e,t){this._eventBus=e,this._canvas=t,this._ids=cO,this._tooltipDefaults={show:{minZoom:.7,maxZoom:5}},this._tooltips={},this._tooltipRoot=uO(t.getContainer());var n=this;Cn.bind(this._tooltipRoot,Df,"mousedown",function(i){i.stopPropagation()}),Cn.bind(this._tooltipRoot,Df,"mouseover",function(i){n.trigger("mouseover",i)}),Cn.bind(this._tooltipRoot,Df,"mouseout",function(i){n.trigger("mouseout",i)}),this._init()}bn.$inject=["eventBus","canvas"],bn.prototype.add=function(e){if(!e.position)throw new Error("must specifiy tooltip position");if(!e.html)throw new Error("must specifiy tooltip html");var t=this._ids.next();return e=j({},this._tooltipDefaults,e,{id:t}),this._addTooltip(e),e.timeout&&this.setTimeout(e),t},bn.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)))},bn.prototype.get=function(e){return typeof e!="string"&&(e=e.id),this._tooltips[e]},bn.prototype.clearTimeout=function(e){if(e=this.get(e),!!e){var t=e.removeTimer;t&&(clearTimeout(t),e.removeTimer=null)}},bn.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)}},bn.prototype.remove=function(e){var t=this.get(e);t&&(li(t.html),li(t.htmlContainer),delete t.htmlContainer,delete this._tooltips[t.id])},bn.prototype.show=function(){Of(this._tooltipRoot)},bn.prototype.hide=function(){Of(this._tooltipRoot,!1)},bn.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},bn.prototype._addTooltip=function(e){var t=e.id,n=e.html,i,r=this._tooltipRoot;n.get&&n.constructor.prototype.jquery&&(n=n.get(0)),wn(n)&&(n=ft(n)),i=ft('<div data-tooltip-id="'+t+'" class="'+Wb+'">'),dn(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)},bn.prototype._updateTooltip=function(e){var t=e.position,n=e.htmlContainer;lO(n,t.x,t.y)},bn.prototype._updateTooltipVisibilty=function(e){D(this._tooltips,function(t){var n=t.show,i=t.htmlContainer,r=!0;n&&((n.minZoom>e.scale||n.maxZoom<e.scale)&&(r=!1),Of(i,r))})},bn.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 pO={__init__:["tooltips"],tooltips:["type",bn]};var fO="flow elements must be children of pools/participants",dO="Data object must be placed within a pool/participant.";function Ub(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(fO)):v(a,"bpmn:DataObjectReference")&&i(r,n(dO)))})}Ub.$inject=["eventBus","tooltips","translate"];const hO={__depends__:[pO],__init__:["modelingFeedback"],modelingFeedback:["type",Ub]};var mO=500,gO=1250,yO=1500,vu=Math.round;function vO(e){return{x:e.x+vu(e.width/2),y:e.y+vu(e.height/2)}}function qb(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",yO,function(s){var c=s.context,u=s.shape,l=i.get().slice();l.indexOf(u)===-1&&(l=[u]),l=_O(l),j(c,{shapes:l,validatedShapes:l,shape:u})}),e.on("shape.move.start",gO,function(s){var c=s.context,u=c.validatedShapes,l;if(l=c.canExecute=o(u),!l)return!1}),e.on("shape.move.move",mO,function(s){var c=s.context,u=c.validatedShapes,l=s.hover,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=vu(u.x),u.y=vu(u.y),!(u.x===0&&u.y===0)&&n.moveElements(p,u,c.target,{primaryShape:c.shape,attach:f})}),e.on("element.mousedown",function(s){if(sr(s)){var c=Eo(s);if(!c)throw new Error("must supply DOM mousedown event");return a(c,s.element)}});function a(s,c,u,l){if(Vt(u)&&(l=u,u=!1),!(c.waypoints||!c.parent)&&!qe(s.target).has("djs-hit-no-move")){var f=vO(c),p=t.init(s,f,"shape.move",{cursor:"grabbing",autoActivate:u,data:{shape:c,context:l||{}}});if(p!==!1)return!0}}this.start=a}qb.$inject=["eventBus","dragging","modeling","selection","rules"];function _O(e){var t=to(e,"id");return He(e,function(n){for(;n=n.parent;)if(t[n.id])return!1;return!0})}var Yb=499,Lf="djs-dragging",Kb="drop-ok",Xb="drop-not-ok",Zb="new-parent",Qb="attach-ok";function Jb(e,t,n,i){function r(c){var u=o(c),l=bO(u);return l}function o(c){var u=Zo(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,Kb,Xb,Zb].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,Lf),c.allDraggedElements?c.allDraggedElements.push(u):c.allDraggedElements=[u]}e.on("shape.move.start",Yb,function(c){var u=c.context,l=u.shapes,f=u.allDraggedElements,p=r(l);if(!u.dragGroup){var d=be("g");fe(d,n.cls("djs-drag-group",["no-events"]));var h=t.getActiveLayer();Oe(h,d),u.dragGroup=d}p.forEach(function(m){i.addDragger(m,u.dragGroup)}),f?f=Pu([f,o(l)]):f=o(l),D(f,function(m){t.addMarker(m,Lf)}),u.allDraggedElements=f,u.differentParents=xO(l)}),e.on("shape.move.move",Yb,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,Zb):a(f,u.canExecute?Kb:Xb)),Qt(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;D(l,function(p){t.removeMarker(p,Lf)}),f&&jt(f)}),this.makeDraggable=s}Jb.$inject=["eventBus","canvas","styles","previewSupport"];function bO(e){var t=new Set;e.forEach(function(i){t.add(i.id)});var n=He(e,function(i){return at(i)?t.has(i.source.id)&&t.has(i.target.id):!0});return n}function xO(e){return b0(to(e,function(t){return t.parent&&t.parent.id}))!==1}const wO={__depends__:[uc,Wn,kf,gi,Ni,Ao],__init__:["move","movePreview"],move:["type",qb],movePreview:["type",Jb]};var ex=".djs-palette-toggle",tx=".entry",EO=ex+", "+tx,If="djs-palette-",SO="shown",Nf="open",nx="two-column",RO=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=RO),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(PO,{})},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=ft(It.HTML_MARKUP);n.appendChild(i),mt(n).add(If+SO),Cn.bind(i,EO,"click",function(r){var o=r.delegateTarget;if(Ju(o,ex))return e.toggle();e.trigger("click",r)}),Me.bind(i,"mousedown",function(r){r.stopPropagation()}),Cn.bind(i,tx,"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=mt(n),a=mt(t);"twoColumn"in e?r=e.twoColumn:r=this._needsCollapse(t.clientHeight,this._entries||{}),o.toggle(nx,r),a.toggle(If+nx,r),"open"in e&&(o.toggle(Nf,e.open),a.toggle(If+Nf,e.open)),i.fire("palette.changed",{twoColumn:r,open:this.isOpen()})},It.prototype._update=function(){var e=ot(".djs-palette-entries",this._container),t=this._entries=this.getEntries();ys(e),D(t,function(n,i){var r=n.group||"default",o=ot("[data-group="+Oa(r)+"]",e);o||(o=ft('<div class="group"></div>'),sn(o,"data-group",r),e.appendChild(o));var a=n.html||(n.separator?'<hr class="separator" />':'<div class="entry" draggable="true"></div>'),s=ft(a);if(o.appendChild(s),!n.separator&&(sn(s,"data-action",i),n.title&&sn(s,"title",n.title),n.className&&CO(s,n.className),n.imageUrl)){var c=ft("<img>");sn(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=sn(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(Wt(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=ot(".djs-palette-entries",this._container),this._toolsContainer=ot("[data-group=tools]",t)),n=this._toolsContainer,D(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")}})},It.prototype.isOpen=function(){return mt(this._container).has(Nf)},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 CO(e,t){var n=mt(e),i=Ee(t)?t:t.split(/\s+/g);i.forEach(function(r){n.add(r)})}function PO(e,t){var n=t.getPaletteEntries();return Wt(n)?n(e):(D(n,function(i,r){e[r]=i}),e)}const AO={__init__:["palette"],palette:["type",It]};var ix="crosshair",rx="selected",TO="djs-dragging-active-lasso";function xr(e,t,n,i,r,o,a){this._selection=r,this._dragging=n,this._mouse=a;var s=this,c={create:function(f){var p=t.getActiveLayer(),d=f.frame=be("rect");fe(d,{class:"djs-lasso-overlay",width:1,height:1,x:0,y:0}),Oe(p,d),u(!0),this.update(f)},update:function(f){var p=f.frame,d=f.bbox;p&&d&&fe(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,rx);for(const g of h)m.has(g)||t.addMarker(g,rx)}},remove:function(f){this.update(f),f.frame&&jt(f.frame),u(!1)}};function u(f){qe(t.getContainer()).toggle(TO,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=ox(f),p.add=nc(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=ox(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(nc(f))return s.activateLasso(f.originalEvent),!0})}xr.$inject=["eventBus","canvas","dragging","elementRegistry","selection","toolManager","mouse"],xr.prototype.activateLasso=function(e,t){this._dragging.init(e,"lasso",{autoActivate:t,cursor:ix,data:{context:{}},keepSelection:!0})},xr.prototype.activateSelection=function(e,t){this._dragging.init(e,"lasso.selection",{trapClick:!1,autoActivate:t,cursor:ix,data:{context:{}},keepSelection:!0})},xr.prototype._select=function(e){this._selection.select(e)},xr.prototype.select=function(e,t,n=[]){var i=eo(uo(e,t));this._select([...n,...i])},xr.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateSelection(e,!!e)},xr.prototype.isActive=function(){var e=this._dragging.context();return e&&/^lasso/.test(e.prefix)};function ox(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 MO={__depends__:[dc,ga],__init__:["lassoTool"],lassoTool:["type",xr]};var Bf=1500,ax="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",Bf,function(c){if(da(c))return a.activateMove(c.originalEvent,!0),!1}),s&&s.addListener(Bf,function(c){if(!(!sx(c.keyEvent)||a.isActive())){var u=a._mouse.getLastMoveEvent();a.activateMove(u,!!u)}},"keyboard.keydown"),s&&s.addListener(Bf,function(c){!sx(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!da(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:ax,data:{context:n||{}}})},jo.prototype.activateHand=function(e,t,n){this._dragging.init(e,"hand",{trapClick:!1,autoActivate:t,cursor:ax,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 sx(e){return Ft("Space",e)}const kO={__depends__:[dc,ga],__init__:["handTool"],handTool:["type",jo]};var cx="connect-ok",ux="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?cx:ux))}),e.on(["global-connect.out","global-connect.cleanup"],function(c){var u=c.context.startTarget,l=c.context.canStartConnect;u&&i.removeMarker(u,l?cx:ux)}),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 OO={__depends__:[Cf,gi,Ni,dc,ga],globalConnect:["type",Fo]};function $f(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)}$f.$inject=["palette","create","elementFactory","spaceTool","lassoTool","handTool","globalConnect","translate"],$f.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(S){var E=n.createShape(j({type:f},m));t.start(S,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 j(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 DO={__depends__:[AO,pc,By,MO,kO,OO,aa],__init__:["paletteProvider"],paletteProvider:["type",$f]};var LO=250;function jf(e,t,n,i,r){Q.call(this,e);function o(s){var c=s.canExecute.replacements;D(c,function(u){var l=u.oldElementId,f={type:u.newElementType};if(!s.visualReplacements[l]){var p=t.get(l);j(f,{x:p.x,y:p.y});var d=n.createShape(f);i.addShape(d,p.parent);var h=ot('[data-element-id="'+Oa(p.id)+'"]',s.dragGroup);h&&fe(h,{display:"none"});var m=r.addDragger(d,s.dragGroup);s.visualReplacements[l]=m,i.removeShape(d)}})}function a(s){var c=s.visualReplacements;D(c,function(u,l){var f=ot('[data-element-id="'+Oa(l)+'"]',s.dragGroup);f&&fe(f,{display:"inline"}),u.remove(),c[l]&&delete c[l]})}e.on("shape.move.move",LO,function(s){var c=s.context,u=c.canExecute;c.visualReplacements||(c.visualReplacements={}),u&&u.replacements?o(c):a(c)})}jf.$inject=["eventBus","elementRegistry","elementFactory","canvas","previewSupport"],pe(jf,Q);const IO={__depends__:[Ao],__init__:["bpmnReplacePreview"],bpmnReplacePreview:["type",jf]};var NO=1250,Ff=40,BO=20,$O=10,lx=20,px=["x","y"],jO=Math.abs;function fx(e){e.on(["connect.hover","connect.move","connect.end"],NO,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&&FO(t,o,VO(o)),o&&GO(i,["bpmn:Association","bpmn:DataInputAssociation","bpmn:DataOutputAssociation","bpmn:SequenceFlow"])?(n.connectionStart=Yn(r),Fe(o,["bpmn:Event","bpmn:Gateway"])&&dx(t,Yn(o)),Fe(o,["bpmn:Task","bpmn:SubProcess"])&&HO(t,o),v(a,"bpmn:BoundaryEvent")&&s===a.host&&zO(t)):hx(i,"bpmn:MessageFlow")?(v(r,"bpmn:Event")&&(n.connectionStart=Yn(r)),v(o,"bpmn:Event")&&dx(t,Yn(o))):n.connectionStart=n.initialConnectionStart)})}fx.$inject=["eventBus"];function FO(e,t,n){px.forEach(function(i){var r=mx(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 HO(e,t){var n=Yn(t);px.forEach(function(i){WO(e,t,i)&&Lt(e,i,n[i])})}function zO(e){var t=e.context,n=t.source,i=t.target;if(!UO(t)){var r=Yn(n),o=Zt(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;jO(c-r[s])<Ff&&(c>r[s]?u=r[s]+Ff:u=r[s]-Ff,Lt(e,s,u))})}}function dx(e,t){Lt(e,"x",t.x),Lt(e,"y",t.y)}function hx(e,t){return e&&e.type===t}function GO(e,t){return Ui(t,function(n){return hx(e,n)})}function mx(e,t){return e==="x"?t.width:t.height}function VO(e){return v(e,"bpmn:Task")?$O:BO}function WO(e,t,n){return e[n]>t[n]+lx&&e[n]<t[n]+mx(n,t)-lx}function UO(e){var t=e.hover,n=e.source;return t&&n&&t===n}function wr(){this._targets={},this._snapOrigins={},this._snapLocations=[],this._defaultSnaps={}}wr.prototype.getSnapOrigin=function(e){return this._snapOrigins[e]},wr.prototype.setSnapOrigin=function(e,t){this._snapOrigins[e]=t,this._snapLocations.indexOf(e)===-1&&this._snapLocations.push(e)},wr.prototype.addDefaultSnap=function(e,t){var n=this._defaultSnaps[e];n||(n=this._defaultSnaps[e]=[]),n.push(t)},wr.prototype.getSnapLocations=function(){return this._snapLocations},wr.prototype.setSnapLocations=function(e){this._snapLocations=e},wr.prototype.pointsForTarget=function(e){var t=e.id||e,n=this._targets[t];return n||(n=this._targets[t]=new _u,n.initDefaults(this._defaultSnaps)),n};function _u(){this._snapValues={}}_u.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)},_u.prototype.snap=function(e,t,n,i){var r=this._snapValues[t];return r&&L2(e[n],r[n],i)},_u.prototype.initDefaults=function(e){var t=this;D(e||{},function(n,i){D(n,function(r){t.add(i,r)})})};var qO=1250;function bi(e,t,n){var i=this;this._elementRegistry=e,t.on(["create.start","shape.move.start"],function(r){i.initSnap(r)}),t.on(["create.move","create.end","shape.move.move","shape.move.end"],qO,function(r){var o=r.context,a=o.shape,s=o.snapContext,c=o.target;if(!(r.originalEvent&&Tn(r.originalEvent))&&!($o(r)||!c)){var u=s.pointsForTarget(c);u.initialized||(u=i.addSnapTargetPoints(u,a,c),u.initialized=!0),n.snap(r,u)}}),t.on(["create.cleanup","shape.move.cleanup"],function(){n.hide()})}bi.$inject=["elementRegistry","eventBus","snapping"],bi.prototype.initSnap=function(e){var t=this._elementRegistry,n=e.context,i=n.shape,r=n.snapContext;r||(r=n.snapContext=new wr);var o;t.get(i.id)?o=Yn(i,e):o={x:e.x+Yn(i).x,y:e.y+Yn(i).y};var a={x:o.x-i.width/2,y:o.y-i.height/2},s={x:o.x+i.width/2,y:o.y+i.height/2};return r.setSnapOrigin("mid",{x:o.x-e.x,y:o.y-e.y}),$e(i)||(r.setSnapOrigin("top-left",{x:a.x-e.x,y:a.y-e.y}),r.setSnapOrigin("bottom-right",{x:s.x-e.x,y:s.y-e.y})),r},bi.prototype.addSnapTargetPoints=function(e,t,n){var i=this.getSnapTargets(t,n);return D(i,function(r){if($e(r)){$e(t)&&e.add("mid",Yn(r));return}if(at(r)){if(r.waypoints.length<3)return;var o=r.waypoints.slice(1,-1);D(o,function(a){e.add("mid",a)});return}e.add("mid",Yn(r))}),!Pe(t.x)||!Pe(t.y)||this._elementRegistry.get(t.id)&&e.add("mid",Yn(t)),e},bi.prototype.getSnapTargets=function(e,t){return tb(t).filter(function(n){return!YO(n)})};function YO(e){return!!e.hidden}var gx=1500;function Ho(e,t){t.invoke(bi,this),e.on(["create.move","create.end"],gx,QO),e.on(["create.move","create.end","shape.move.move","shape.move.end"],gx,function(n){var i=n.context,r=i.canExecute,o=i.target,a=r&&(r==="attach"||r.attach);a&&!$o(n)&&KO(n,o)})}pe(Ho,bi),Ho.$inject=["eventBus","injector"],Ho.prototype.initSnap=function(e){var t=bi.prototype.initSnap.call(this,e),n=e.shape,i=!!this._elementRegistry.get(n.id);return D(n.outgoing,function(r){var o=r.waypoints[0];o=o.original||o,t.setSnapOrigin(r.id+"-docking",vx(o,i,e))}),D(n.incoming,function(r){var o=r.waypoints[r.waypoints.length-1];o=o.original||o,t.setSnapOrigin(r.id+"-docking",vx(o,i,e))}),v(n,"bpmn:Participant")&&t.setSnapLocations(["top-left","bottom-right","mid"]),t},Ho.prototype.addSnapTargetPoints=function(e,t,n){bi.prototype.addSnapTargetPoints.call(this,e,t,n);var i=this.getSnapTargets(t,n);D(i,function(o){(ZO(o)||XO([t,o],"bpmn:TextAnnotation"))&&(e.add("top-left",J_(o)),e.add("bottom-right",eb(o)))});var r=this._elementRegistry;return D(t.incoming,function(o){if(r.get(t.id)){yx(i,o.source)||e.add("mid",Se(o.source));var a=o.waypoints[0];e.add(o.id+"-docking",a.original||a)}}),D(t.outgoing,function(o){if(r.get(t.id)){yx(i,o.target)||e.add("mid",Se(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 bi.prototype.getSnapTargets.call(this,e,t).filter(function(n){return!v(n,"bpmn:Lane")})};function KO(e,t){var n=xe(t),i=Dg(e,t),r=e.context,o=r.shape,a;o.parent?a={x:0,y:0}:a=Se(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 XO(e,t){return e.every(function(n){return v(n,t)})}function ZO(e){return v(e,"bpmn:SubProcess")&&We(e)?!0:v(e,"bpmn:Participant")}function QO(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 yx(e,t){return e.indexOf(t)!==-1}function vx(e,t,n){return t?{x:e.x-n.x,y:e.y-n.y}:{x:e.x,y:e.y}}var JO=1250;function Ya(e,t){var n=this;e.on(["resize.start"],function(i){n.initSnap(i)}),e.on(["resize.move","resize.end"],JO,function(i){var r=i.context,o=r.shape,a=o.parent,s=r.direction,c=r.snapContext;if(!(i.originalEvent&&Tn(i.originalEvent))&&!$o(i)){var u=c.pointsForTarget(a);u.initialized||(u=n.addSnapTargetPoints(u,o,a,s),u.initialized=!0),nD(s)&&Lt(i,"x",i.x),iD(s)&&Lt(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 wr);var o=_x(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 D(r,function(o){e.add("corner",eb(o)),e.add("corner",J_(o))}),e.add("corner",_x(t,i)),e},Ya.$inject=["eventBus","snapping"],Ya.prototype.getSnapTargets=function(e,t){return tb(t).filter(function(n){return!eD(n,e)&&!at(n)&&!tD(n)&&!$e(n)})};function _x(e,t){var n=Se(e),i=xe(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 eD(e,t){return e.host===t}function tD(e){return!!e.hidden}function nD(e){return e==="n"||e==="s"}function iD(e){return e==="e"||e==="w"}var rD=7,oD=1e3;function Er(e){this._canvas=e,this._asyncHide=Tu(vn(this.hide,this),oD)}Er.$inject=["canvas"],Er.prototype.snap=function(e,t){var n=e.context,i=n.snapContext,r=i.getSnapLocations(),o={x:$o(e,"x"),y:$o(e,"y")};D(r,function(a){var s=i.getSnapOrigin(a),c={x:e.x+s.x,y:e.y+s.y};if(D(["x","y"],function(u){var l;o[u]||(l=t.snap(c,a,u,rD),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),D(["x","y"],function(a){var s=o[a];Vt(s)&&Lt(e,a,s.originValue)})},Er.prototype._createLine=function(e){var t=this._canvas.getLayer("snap"),n=be("path");return fe(n,{d:"M0,0 L0,0"}),qe(n).add("djs-snap-line"),Oe(t,n),{update:function(i){Pe(i)?e==="horizontal"?fe(n,{d:"M-100000,"+i+" L+100000,"+i,display:""}):fe(n,{d:"M "+i+",-100000 L "+i+", +100000",display:""}):fe(n,{display:"none"})}}},Er.prototype._createSnapLines=function(){this._snapLines={horizontal:this._createLine("horizontal"),vertical:this._createLine("vertical")}},Er.prototype.showSnapLine=function(e,t){var n=this.getSnapLine(e);n&&n.update(t),this._asyncHide()},Er.prototype.getSnapLine=function(e){return this._snapLines||this._createSnapLines(),this._snapLines[e]},Er.prototype.hide=function(){D(this._snapLines,function(e){e.update()})};const aD={__depends__:[{__init__:["createMoveSnapping","resizeSnapping","snapping"],createMoveSnapping:["type",bi],resizeSnapping:["type",Ya],snapping:["type",Er]}],__init__:["connectSnapping","createMoveSnapping"],connectSnapping:["type",fx],createMoveSnapping:["type",Ho]};var bx=300;function De(e,t,n,i){this._open=!1,this._results={},this._eventMaps=[],this._cachedRootElement=null,this._cachedSelection=null,this._cachedViewbox=null,this._canvas=e,this._eventBus=t,this._selection=n,this._translate=i,this._container=this._getBoxHtml(),this._searchInput=ot(De.INPUT_SELECTOR,this._container),this._resultsContainer=ot(De.RESULTS_CONTAINER_SELECTOR,this._container),this._canvas.getContainer().appendChild(this._container),t.on(["canvas.destroy","diagram.destroy","drag.init","elements.changed"],this.close,this)}De.$inject=["canvas","eventBus","selection","translate"],De.prototype._bindEvents=function(){var e=this;function t(n,i,r,o){e._eventMaps.push({el:n,type:r,listener:Cn.bind(n,i,r,o)})}t(document,"html","click",function(n){e.close(!1)}),t(this._container,De.INPUT_SELECTOR,"click",function(n){n.stopPropagation(),n.delegateTarget.focus()}),t(this._container,De.RESULT_SELECTOR,"mouseover",function(n){n.stopPropagation(),e._scrollToNode(n.delegateTarget),e._preselect(n.delegateTarget)}),t(this._container,De.RESULT_SELECTOR,"click",function(n){n.stopPropagation(),e._select(n.delegateTarget)}),t(this._container,De.INPUT_SELECTOR,"keydown",function(n){Ft("ArrowUp",n)&&n.preventDefault(),Ft("ArrowDown",n)&&n.preventDefault()}),t(this._container,De.INPUT_SELECTOR,"keyup",function(n){if(Ft("Escape",n))return e.close();if(Ft("Enter",n)){var i=e._getCurrentResult();return i?e._select(i):e.close(!1)}if(Ft("ArrowUp",n))return e._scrollToDirection(!0);if(Ft("ArrowDown",n))return e._scrollToDirection();Ft(["ArrowLeft","ArrowRight"],n)||e._search(n.delegateTarget.value)})},De.prototype._unbindEvents=function(){this._eventMaps.forEach(function(e){Cn.unbind(e.el,e.type,e.listener)})},De.prototype._search=function(e){var t=this;if(this._clearResults(),!!e.trim()){var n=this._searchProvider.find(e);if(n=n.filter(function(r){return!t._canvas.getRootElements().includes(r.element)}),!n.length){this._selection.select(null);return}n.forEach(function(r){var o=r.element.id,a=t._createResultNode(r,o);t._results[o]={element:r.element,node:a}});var i=ot(De.RESULT_SELECTOR,this._resultsContainer);this._scrollToNode(i),this._preselect(i)}},De.prototype._scrollToDirection=function(e){var t=this._getCurrentResult();if(t){var n=e?t.previousElementSibling:t.nextElementSibling;n&&(this._scrollToNode(n),this._preselect(n))}},De.prototype._scrollToNode=function(e){if(!(!e||e===this._getCurrentResult())){var t=e.offsetTop,n=this._resultsContainer.scrollTop,i=t-this._resultsContainer.clientHeight+e.clientHeight;t<n?this._resultsContainer.scrollTop=t:n<i&&(this._resultsContainer.scrollTop=i)}},De.prototype._clearResults=function(){ys(this._resultsContainer),this._results={},this._eventBus.fire("searchPad.cleared")},De.prototype._getCurrentResult=function(){return ot(De.RESULT_SELECTED_SELECTOR,this._resultsContainer)},De.prototype._createResultNode=function(e,t){var n=ft(De.RESULT_HTML);return e.primaryTokens.length>0&&xx(n,e.primaryTokens,De.RESULT_PRIMARY_HTML),xx(n,e.secondaryTokens,De.RESULT_SECONDARY_HTML),sn(n,De.RESULT_ID_ATTRIBUTE,t),this._resultsContainer.appendChild(n),n},De.prototype.registerProvider=function(e){this._searchProvider=e},De.prototype.open=function(){if(!this._searchProvider)throw new Error("no search provider registered");this.isOpen()||(this._cachedRootElement=this._canvas.getRootElement(),this._cachedSelection=this._selection.get(),this._cachedViewbox=this._canvas.viewbox(),this._selection.select(null),this._bindEvents(),this._open=!0,mt(this._canvas.getContainer()).add("djs-search-open"),mt(this._container).add("open"),this._searchInput.focus(),this._eventBus.fire("searchPad.opened"))},De.prototype.close=function(e=!0){this.isOpen()&&(e&&(this._cachedRootElement&&this._canvas.setRootElement(this._cachedRootElement),this._cachedSelection&&this._selection.select(this._cachedSelection),this._cachedViewbox&&this._canvas.viewbox(this._cachedViewbox),this._eventBus.fire("searchPad.restored")),this._cachedRootElement=null,this._cachedSelection=null,this._cachedViewbox=null,this._unbindEvents(),this._open=!1,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())},De.prototype.toggle=function(){this.isOpen()?this.close():this.open()},De.prototype.isOpen=function(){return this._open},De.prototype._preselect=function(e){var t=this._getCurrentResult();if(e!==t){t&&mt(t).remove(De.RESULT_SELECTED_CLASS);var n=sn(e,De.RESULT_ID_ATTRIBUTE),i=this._results[n].element;mt(e).add(De.RESULT_SELECTED_CLASS),this._canvas.scrollToElement(i,{top:bx}),this._selection.select(i),this._eventBus.fire("searchPad.preselected",i)}},De.prototype._select=function(e){var t=sn(e,De.RESULT_ID_ATTRIBUTE),n=this._results[t].element;this._cachedSelection=null,this._cachedViewbox=null,this.close(!1),this._canvas.scrollToElement(n,{top:bx}),this._selection.select(n),this._eventBus.fire("searchPad.selected",n)},De.prototype._getBoxHtml=function(){const e=ft(De.BOX_HTML),t=ot(De.INPUT_SELECTOR,e);return t&&t.setAttribute("aria-label",this._translate("Search in diagram")),e};function xx(e,t,n){var i=sD(t),r=ft(n);r.innerHTML=i,e.appendChild(r)}function sD(e){var t="";return e.forEach(function(n){var i=Tv(n.value||n.matched||n.normal),r=n.match||n.matched;r?t+='<b class="'+De.RESULT_HIGHLIGHT_CLASS+'">'+i+"</b>":t+=i}),t!==""?t:null}De.CONTAINER_SELECTOR=".djs-search-container",De.INPUT_SELECTOR=".djs-search-input input",De.RESULTS_CONTAINER_SELECTOR=".djs-search-results",De.RESULT_SELECTOR=".djs-search-result",De.RESULT_SELECTED_CLASS="djs-search-result-selected",De.RESULT_SELECTED_SELECTOR="."+De.RESULT_SELECTED_CLASS,De.RESULT_ID_ATTRIBUTE="data-result-id",De.RESULT_HIGHLIGHT_CLASS="djs-search-highlight",De.BOX_HTML=`<div class="djs-search-container djs-scrollable">
335
+ </svg>`},_k=900;function Ga(e,t,n,i){this._distributeElements=t,this._translate=n,this._popupMenu=e,this._rules=i,e.registerProvider("align-elements",_k,this)}Ga.$inject=["popupMenu","distributeElements","translate","rules"],Ga.prototype.getPopupMenuEntries=function(e){var t={};return this._isAllowed(e)&&j(t,this._getEntries(e)),t},Ga.prototype._isAllowed=function(e){return this._rules.allowed("elements.distribute",{elements:e})},Ga.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:b_.horizontal,action:function(o,a){t.trigger(e,"horizontal"),i.close()}},"distribute-elements-vertical":{group:"distribute",title:n("Distribute elements vertically"),imageHtml:b_.vertical,action:function(o,a){t.trigger(e,"vertical"),i.close()}}};return r};const xk={__depends__:[vf,bk],__init__:["bpmnDistributeElements","distributeElementsMenuProvider"],bpmnDistributeElements:["type",su],distributeElementsMenuProvider:["type",Ga]};var __="is not a registered action",wk="is already registered";function Xn(e,t){this._eventBus=e,this._actions={};var n=this;e.on("diagram.init",function(){n._registerDefaultActions(t),e.fire("editorActions.init",{editorActions:n})})}Xn.$inject=["eventBus","injector"],Xn.prototype._registerDefaultActions=function(e){var t=e.get("commandStack",!1),n=e.get("modeling",!1),i=e.get("selection",!1),r=e.get("zoomScroll",!1),o=e.get("copyPaste",!1),a=e.get("canvas",!1),s=e.get("rules",!1),c=e.get("keyboardMove",!1),u=e.get("keyboardMoveSelection",!1);t&&(this.register("undo",function(){t.undo()}),this.register("redo",function(){t.redo()})),o&&i&&this.register("copy",function(){var l=i.get();if(l.length)return o.copy(l)}),o&&i&&this.register("duplicate",function(){var l=i.get();if(l.length)return o.duplicate(l)}),o&&this.register("paste",function(){o.paste()}),o&&i&&s&&this.register("cut",function(){var l=i.get();if(l.length){var f=s.allowed("elements.delete",{elements:l});if(f!==!1){var p=Ee(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&&(Ee(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)})},Xn.prototype.trigger=function(e,t){if(!this._actions[e])throw Af(e,__);var n=this._eventBus.fire("editorActions.allowed",{action:e,opts:t});if(n!==!1)return this._actions[e](t)},Xn.prototype.register=function(e,t){var n=this;if(typeof e=="string")return this._registerAction(e,t);D(e,function(i,r){n._registerAction(r,i)})},Xn.prototype._registerAction=function(e,t){if(this.isRegistered(e))throw Af(e,wk);this._actions[e]=t},Xn.prototype.unregister=function(e){if(!this.isRegistered(e))throw Af(e,__);this._actions[e]=void 0},Xn.prototype.getActions=function(){return Object.keys(this._actions)},Xn.prototype.isRegistered=function(e){return!!this._actions[e]};function Af(e,t){return new Error(e+" "+t)}const Ek={__init__:["editorActions"],editorActions:["type",Xn]};function cu(e){e.invoke(Xn,this)}pe(cu,Xn),cu.$inject=["injector"],cu.prototype._registerDefaultActions=function(e){Xn.prototype._registerDefaultActions.call(this,e);var t=e.get("canvas",!1),n=e.get("elementRegistry",!1),i=e.get("selection",!1),r=e.get("spaceTool",!1),o=e.get("lassoTool",!1),a=e.get("handTool",!1),s=e.get("globalConnect",!1),c=e.get("distributeElements",!1),u=e.get("alignElements",!1),l=e.get("directEditing",!1),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=[],S=h.type;m.length&&(g=He(m,function(E){return!v(E,"bpmn:Lane")}),u.trigger(g,S))}),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(S){return v(S.parent,"bpmn:Collaboration")}):g=n.filter(function(S){return S!==h&&!v(S.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 Sk={__depends__:[Ek],editorActions:["type",cu]};function x_(e){e.on(["create.init","shape.move.init"],function(t){var n=t.context,i=t.shape;Fe(i,["bpmn:Participant","bpmn:SubProcess","bpmn:TextAnnotation"])&&(n.gridSnappingContext||(n.gridSnappingContext={}),n.gridSnappingContext.snapLocation="top-left")})}x_.$inject=["eventBus"];function Yr(e,t){Q.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)}})}Yr.$inject=["eventBus","gridSnapping","modeling"],pe(Yr,Q),Yr.prototype.snapSimple=function(e,t){var n=this._gridSnapping;return t.width=n.snapValue(t.width,{min:t.width}),t.height=n.snapValue(t.height,{min:t.height}),t.x=e.x+e.width/2-t.width/2,t.y=e.y+e.height/2-t.height/2,t},Yr.prototype.snapComplex=function(e,t){return/w|e/.test(t)&&(e=this.snapHorizontally(e,t)),/n|s/.test(t)&&(e=this.snapVertically(e,t)),e},Yr.prototype.snapHorizontally=function(e,t){var n=this._gridSnapping,i=/w/.test(t),r=/e/.test(t),o={};return o.width=n.snapValue(e.width,{min:e.width}),r&&(i?(o.x=n.snapValue(e.x,{max:e.x}),o.width+=n.snapValue(e.x-o.x,{min:e.x-o.x})):e.x=e.x+e.width-o.width),j(e,o),e},Yr.prototype.snapVertically=function(e,t){var n=this._gridSnapping,i=/n/.test(t),r=/s/.test(t),o={};return o.height=n.snapValue(e.height,{min:e.height}),i&&(r?(o.y=n.snapValue(e.y,{max:e.y}),o.height+=n.snapValue(e.y-o.y,{min:e.y-o.y})):e.y=e.y+e.height-o.height),j(e,o),e};var Rk=2e3;function w_(e,t){e.on(["spaceTool.move","spaceTool.end"],Rk,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)}})}w_.$inject=["eventBus","gridSnapping"];const Ck={__init__:["gridSnappingResizeBehavior","gridSnappingSpaceToolBehavior"],gridSnappingResizeBehavior:["type",Yr],gridSnappingSpaceToolBehavior:["type",w_]};var uu=10;function Tf(e,t,n){return n||(n="round"),Math[n](e/t)*t}var Pk=1200,Ak=800;function vr(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"],Pk,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=Mk(o,u,e);f&&(l.offset=f);var p=Tk(o,u);p&&j(l,p),$o(o,u)||r.snapEvent(o,u,l)})}})}vr.prototype.snapEvent=function(e,t,n){var i=this.snapValue(e[t],n);Lt(e,t,i)},vr.prototype.getGridSpacing=function(){return uu},vr.prototype.snapValue=function(e,t){var n=0;t&&t.offset&&(n=t.offset),e+=n,e=Tf(e,uu);var i,r;return t&&t.min&&(i=t.min,Pe(i)&&(i=Tf(i+n,uu,"ceil"),e=Math.max(e,i))),t&&t.max&&(r=t.max,Pe(r)&&(r=Tf(r+n,uu,"floor"),e=Math.min(e,r))),e-=n,e},vr.prototype.isActive=function(){return this.active},vr.prototype.setActive=function(e){this.active=e,this._eventBus.fire("gridSnapping.toggle",{active:e})},vr.prototype.toggleActive=function(){this.setActive(!this.active)},vr.$inject=["elementRegistry","eventBus","config.gridSnapping"];function Tk(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&&(lu(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&&(lu(t)?S_(s)?a.x.max=c.left:a.x.min=c.right:E_(s)?a.y.max=c.top:a.y.min=c.bottom),u&&(lu(t)?S_(s)?a.x.min=u.left:a.x.max=u.right:E_(s)?a.y.min=u.top:a.y.max=u.bottom),a[t]}function Mk(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)||(lu(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 lu(e){return e==="x"}function E_(e){return e.indexOf("n")!==-1}function S_(e){return e.indexOf("w")!==-1}const kk={__depends__:[Ck],__init__:["gridSnapping"],gridSnapping:["type",vr]};var Ok=2e3;function R_(e,t,n){e.on("autoPlace",Ok,function(i){var r=i.source,o=Se(r),a=i.shape,s=Sv(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")&&(Dk(c)?u.offset=-a.width/2:u.offset=-a.height/2),s[c]=t.snapValue(s[c],u))}),s})}R_.$inject=["eventBus","gridSnapping","elementRegistry"];function Dk(e){return e==="x"}var Lk=1750;function C_(e,t,n){t.on(["create.start","shape.move.start"],Lk,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}))}})}C_.$inject=["canvas","eventBus","gridSnapping"];var Ik=3e3;function pu(e,t,n){Q.call(this,e),this._gridSnapping=t;var i=this;this.postExecuted(["connection.create","connection.layout"],Ik,function(r){var o=r.context,a=o.connection,s=o.hints||{},c=a.waypoints;s.connectionStart||s.connectionEnd||s.createElementsBehavior===!1||Nk(c)&&n.updateWaypoints(a,i.snapMiddleSegments(c))})}pu.$inject=["eventBus","gridSnapping","modeling"],pe(pu,Q),pu.prototype.snapMiddleSegments=function(e){var t=this._gridSnapping,n;e=e.slice();for(var i=1;i<e.length-2;i++)n=jk(t,e[i],e[i+1]),e[i]=n[0],e[i+1]=n[1];return e};function Nk(e){return e.length>3}function Bk(e){return e==="h"}function $k(e){return e==="v"}function jk(e,t,n){var i=Mi(t,n),r={};return Bk(i)&&(r.y=e.snapValue(t.y)),$k(i)&&(r.x=e.snapValue(t.x)),("x"in r||"y"in r)&&(t=j({},t,r),n=j({},n,r)),[t,n]}const Fk={__depends__:[kk,{__init__:["gridSnappingAutoPlaceBehavior","gridSnappingParticipantBehavior","gridSnappingLayoutConnectionBehavior"],gridSnappingAutoPlaceBehavior:["type",R_],gridSnappingParticipantBehavior:["type",C_],gridSnappingLayoutConnectionBehavior:["type",pu]}],__init__:["bpmnGridSnapping"],bpmnGridSnapping:["type",x_]};var Hk=30,P_=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 We(r)?n._createParticipantHit(r,o):n._createDefaultHit(r,o);if(v(r,"bpmn:SubProcess"))return We(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=Ut(e)?{width:Hk,height:e.height}:{width:e.width,height:P_};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:P_}),!0};const zk={__init__:["bpmnInteractionEvents"],bpmnInteractionEvents:["type",Va]};function fu(e){e.invoke(ko,this)}pe(fu,ko),fu.$inject=["injector"],fu.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 Gk={__depends__:[nf],__init__:["keyboardBindings"],keyboardBindings:["type",fu]};var Vk={moveSpeed:1,moveSpeedAccelerated:10},Wk=1500,A_="left",T_="up",M_="right",k_="down",Uk={ArrowLeft:A_,Left:A_,ArrowUp:T_,Up:T_,ArrowRight:M_,Right:M_,ArrowDown:k_,Down:k_},qk={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 O_(e,t,n,i,r){var o=this;this._config=j({},Vk,e||{}),t.addListener(Wk,function(a){var s=a.keyEvent,c=Uk[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=qk[a](u),f=i.allowed("elements.move",{shapes:c,hints:{keyboardMove:!0}});f&&n.moveElements(c,l)}}}O_.$inject=["config.keyboardMoveSelection","keyboard","modeling","rules","selection"];const Yk={__depends__:[nf,Wn],__init__:["keyboardMoveSelection"],keyboardMoveSelection:["type",O_]};var D_=10;function Wa(e,t,n,i){this._dragging=i,this._rules=t;var r=this;function o(c,u){var l=c.shape,f=c.direction,p=c.resizeConstraints,d;c.delta=u,d=VR(l,f,u),c.newBounds=UR(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:xe(l)})}function s(c){var u=c.shape,l=c.canExecute,f=c.newBounds;if(l){if(f=Xh(f),!Kk(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)})}Wa.prototype.canResize=function(e){var t=this._rules,n=ei(e,["newBounds","shape","delta","direction"]);return t.allowed("shape.resize",n)},Wa.prototype.activate=function(e,t,n){var i=this._dragging,r,o;if(typeof n=="string"&&(n={direction:n}),r=j({shape:t},n),o=r.direction,!o)throw new Error("must provide a direction (n|w|s|e|nw|se|ne|sw)");i.init(e,L_(t,o),"resize",{autoActivate:!0,cursor:Xk(o),data:{shape:t,context:r}})},Wa.prototype.computeMinResizeBox=function(e){var t=e.shape,n=e.direction,i,r;return i=e.minDimensions||{width:D_,height:D_},r=Bm(t,e.childrenBoxPadding),qR(n,t,i,r)},Wa.$inject=["eventBus","rules","modeling","dragging"];function Kk(e,t){return e.x!==t.x||e.y!==t.y||e.width!==t.width||e.height!==t.height}function L_(e,t){var n=Se(e),i=xe(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 Xk(e){var t="resize-";return e==="n"||e==="s"?t+"ns":e==="e"||e==="w"?t+"ew":e==="nw"||e==="se"?t+"nwse":t+"nesw"}var I_="djs-resizing",N_="resize-not-ok",Zk=500;function B_(e,t,n){function i(o){var a=o.shape,s=o.newBounds,c=o.frame;c||(c=o.frame=n.addFrame(a,t.getActiveLayer()),t.addMarker(a,I_)),s.width>5&&fe(c,{x:s.x,width:s.width}),s.height>5&&fe(c,{y:s.y,height:s.height}),o.canExecute?qe(c).remove(N_):qe(c).add(N_)}function r(o){var a=o.shape,s=o.frame;s&&jt(o.frame),t.removeMarker(a,I_)}e.on("resize.move",Zk,function(o){i(o.context)}),e.on("resize.cleanup",function(o){r(o.context)})}B_.$inject=["eventBus","canvas","previewSupport"];var du=-6,hu=8,mu=20,Ua="djs-resizer",Qk=["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&&D(a,vn(r.addResizer,r))}),e.on("shape.changed",function(o){var a=o.element;n.isSelected(a)&&(r.removeResizers(),r.addResizer(a))})}br.prototype.makeDraggable=function(e,t,n){var i=this._resize;function r(o){sr(o)&&i.activate(o,e,n)}Me.bind(t,"mousedown",r),Me.bind(t,"touchstart",r)},br.prototype._createResizer=function(e,t,n,i){var r=this._getResizersParent(),o=Jk(i),a=_e("g");qe(a).add(Ua),qe(a).add(Ua+"-"+e.id),qe(a).add(Ua+"-"+i),Oe(r,a);var s=_e("rect");fe(s,{x:-hu/2+o.x,y:-hu/2+o.y,width:hu,height:hu}),qe(s).add(Ua+"-visual"),Oe(a,s);var c=_e("rect");return fe(c,{x:-mu/2+o.x,y:-mu/2+o.y,width:mu,height:mu}),qe(c).add(Ua+"-hit"),Oe(a,c),Ts(a,t,n),a},br.prototype.createResizer=function(e,t){var n=L_(e,t),i=this._createResizer(e,n.x,n.y,t);this.makeDraggable(e,i,t)},br.prototype.addResizer=function(e){var t=this;at(e)||D(Qk,function(n){t._resize.canResize({shape:e,direction:n})&&t.createResizer(e,n)})},br.prototype.removeResizers=function(){var e=this._getResizersParent();_s(e)},br.prototype._getResizersParent=function(){return this._canvas.getLayer("resizers")},br.$inject=["eventBus","canvas","selection","resize"];function Jk(e){var t={x:0,y:0};return e.indexOf("e")!==-1?t.x=-du:e.indexOf("w")!==-1&&(t.x=du),e.indexOf("s")!==-1?t.y=-du:e.indexOf("n")!==-1&&(t.y=du),t}const $_={__depends__:[gi,Ni,Ao],__init__:["resize","resizePreview","resizeHandles"],resize:["type",Wa],resizePreview:["type",B_],resizeHandles:["type",br]};var eO=2e3;function qa(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"],eO,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||Fe(c,["bpmn:Activity","bpmn:Event","bpmn:TextAnnotation","bpmn:Participant"]))&&i.activate(c)}}qa.$inject=["eventBus","bpmnFactory","canvas","directEditing","modeling","resizeHandles","textRenderer"],qa.prototype.activate=function(e){var t=Bn(e);if(t!==void 0){var n={text:t},i=this.getEditingBBox(e);j(n,i);var r={},o=n.style||{};return j(o,{backgroundColor:null,border:null}),(Fe(e,["bpmn:Task","bpmn:Participant","bpmn:Lane","bpmn:CallActivity"])||j_(e))&&j(r,{centerVertically:!0}),ir(e)&&(j(r,{resizable:!0,autoResize:!0}),j(o,{backgroundColor:"#ffffff",border:"1px solid #ccc"})),v(e,"bpmn:TextAnnotation")&&(j(r,{resizable:!0,autoResize:!0}),j(o,{backgroundColor:"#ffffff",border:"1px solid #ccc"})),j(n,{options:r,style:o}),n}},qa.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")||iO(e)){var h=Ut(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};j(o,m),j(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(nO(e)){var g=Ut(e),S=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};j(o,S),j(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)"})}(Fe(e,["bpmn:Task","bpmn:CallActivity"])||j_(e))&&(j(o,{width:i.width,height:i.height}),j(d,{fontSize:f+"px",lineHeight:p,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px"})),tO(e)&&(j(o,{width:i.width,x:i.x}),j(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&&(j(o,{width:x,height:i.height+2*E,x:i.x-E,y:i.y-E}),j(d,{fontSize:u+"px",lineHeight:l})),ir(n)&&!Os(n)&&!$e(n)){var w=gl(e),C=t.getAbsoluteBBox({x:w.x,y:w.y,width:0,height:0}),P=u,L=Nr.width*a+2*E;j(o,{width:L,height:P+2*E,x:C.x-L/2,y:C.y-P/2-E}),j(d,{fontSize:u+"px",lineHeight:l})}return v(e,"bpmn:TextAnnotation")&&(j(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}),j(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}},qa.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}),rO(t)&&(t=null),this._modeling.updateLabel(e,t,r)};function j_(e){return v(e,"bpmn:SubProcess")&&!We(e)}function tO(e){return v(e,"bpmn:SubProcess")&&We(e)}function nO(e){return v(e,"bpmn:Participant")&&!We(e)}function iO(e){return v(e,"bpmn:Participant")&&We(e)}function rO(e){return!e||!e.trim()}var F_="djs-element-hidden",H_="djs-label-hidden";function z_(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=_e("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=_e("path");fe(f,{d:l,strokeWidth:2,stroke:oO(o)}),Oe(s,f),Oe(r,s),Qt(s,o.x,o.y)}v(o,"bpmn:TextAnnotation")||o.labelTarget?t.addMarker(o,F_):(v(o,"bpmn:Task")||v(o,"bpmn:CallActivity")||v(o,"bpmn:SubProcess")||v(o,"bpmn:Participant")||v(o,"bpmn:Lane"))&&t.addMarker(o,H_)}),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}});fe(i.path,{d:p})}}),e.on(["directEditing.complete","directEditing.cancel"],function(c){var u=c.active;u&&(t.removeMarker(u.element.label||u.element,F_),t.removeMarker(o,H_)),o=void 0,a=void 0,s&&(jt(s),s=void 0)})}z_.$inject=["eventBus","canvas","pathMap"];function oO(e,t){var n=Xe(e);return n.get("stroke")||t||"black"}const aO={__depends__:[Lp,$_,d_],__init__:["labelEditingProvider","labelEditingPreview"],labelEditingProvider:["type",qa],labelEditingPreview:["type",z_]};var sO=500,cO=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){U1(o)||i.createOutline(o)}e.on("element.hover",function(o){r(o.element)}),e.on("selection.changed",function(o){D(o.newSelection,r)}),e.on(["shape.changed","connection.changed"],sO,function(o){var a=o.element,s=o.gfx,c=ot(".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=ot(".djs-outline",t);return n||(n=this.getOutline(e)||this._createOutlineGfx(),Oe(t,n),this.updateOutline(e,n)),n},bi.prototype._createOutlineGfx=function(){var e=_e("rect");return fe(e,j({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&&D(i,function(r){n=n||r.updateOutline(t,e)}),n||fe(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);fe(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=cO),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 D(n,function(i){Wt(i.getOutline)&&(t=t||i.getOutline(e))}),t},bi.$inject=["eventBus","styles","elementRegistry"];var gu=6;function Mf(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)})}Mf.prototype._updateMultiSelectionOutline=function(e){var t=this._canvas.getLayer("selectionOutline");_s(t);var n=e.length>1,i=this._canvas.getContainer();if(qe(i)[n?"add":"remove"]("djs-multi-select"),!!n){var r=uO(Mt(e)),o=_e("rect");fe(o,j({rx:3},r)),qe(o).add("djs-selection-outline"),Oe(t,o)}},Mf.$inject=["eventBus","canvas","selection"];function uO(e){return{x:e.x-gu,y:e.y-gu,width:e.width+gu*2,height:e.height+gu*2}}const kf={__depends__:[Wn],__init__:["outline","multiSelectionOutline"],outline:["type",bi],multiSelectionOutline:["type",Mf]},G_=["bpmn:Event","bpmn:SequenceFlow","bpmn:Gateway"],V_={class:"bjs-label-link",stroke:"var(--element-selected-outline-secondary-stroke-color)",strokeDasharray:"5, 5"},lO=15,yu=2;function W_(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=>Fe(h,G_));if(p.length===1){const h=p[0];$e(h)?a(h,h.labelTarget):(d=h.labels)!=null&&d.length&&a(h.labels[0],h)}if(p.length===2){const h=p.find($e),m=p.find(g=>{var S;return(S=g.labels)==null?void 0:S.includes(h)});h&&m&&a(h,m)}}),e.on("shape.changed",function({element:f}){var p;!Fe(f,G_)||!l(f)||($e(f)?a(f,f.labelTarget):(p=f.labels)!=null&&p.length&&a(f.labels[0],f))});function a(f,p){const d=Xo([Se(p),Se(f)],V_),h=d.getAttribute("d"),g=r.isSelected(f)?c(f):u(f),S=ea(g,h);if(!S)return;const x=r.isSelected(p)?c(p):u(p),w=ea(x,h)||Se(p);la(w,S)<lO||(cl(d,[w,S]),Oe(o,d))}function s(){bs(`.${V_.class}`,o).forEach(jt)}function c(f){const p=i.getOutline(f);if(!p)return u(f);if(p.x){const d={x:f.x+_r(p,"x")-yu,y:f.y+_r(p,"y")-yu,width:_r(p,"width")+yu*2,height:_r(p,"height")+yu*2};return vl(d,_r(p,"rx"))}if(p.cx){const d=_r(p,"r"),h={x:f.x+_r(p,"cx")-d,y:f.y+_r(p,"cy")-d,width:d*2,height:d*2};return _m(h)}}function u(f){return n.getShapePath(f)}function l(f){return r.isSelected(f)}}W_.$inject=["eventBus","canvas","graphicsFactory","outline","selection"];function _r(e,t){return parseFloat(fe(e,t)||0)}const pO={__depends__:[Wn,kf],__init__:["labelLink"],labelLink:["type",W_]};var fO=new Po("tt");function dO(e){var t=ft('<div class="djs-tooltip-container" />');return dn(t,{position:"absolute",width:"0",height:"0"}),e.insertBefore(t,e.firstChild),t}function hO(e,t,n){dn(e,{left:t+"px",top:n+"px"})}function Of(e,t){e.style.display=t===!1?"none":""}var U_="djs-tooltip",Df="."+U_;function _n(e,t){this._eventBus=e,this._canvas=t,this._ids=fO,this._tooltipDefaults={show:{minZoom:.7,maxZoom:5}},this._tooltips={},this._tooltipRoot=dO(t.getContainer());var n=this;Cn.bind(this._tooltipRoot,Df,"mousedown",function(i){i.stopPropagation()}),Cn.bind(this._tooltipRoot,Df,"mouseover",function(i){n.trigger("mouseover",i)}),Cn.bind(this._tooltipRoot,Df,"mouseout",function(i){n.trigger("mouseout",i)}),this._init()}_n.$inject=["eventBus","canvas"],_n.prototype.add=function(e){if(!e.position)throw new Error("must specifiy tooltip position");if(!e.html)throw new Error("must specifiy tooltip html");var t=this._ids.next();return e=j({},this._tooltipDefaults,e,{id:t}),this._addTooltip(e),e.timeout&&this.setTimeout(e),t},_n.prototype.trigger=function(e,t){var n=t.delegateTarget||t.target,i=this.get(sn(n,"data-tooltip-id"));i&&(e==="mouseover"&&i.timeout&&this.clearTimeout(i),e==="mouseout"&&i.timeout&&(i.timeout=1e3,this.setTimeout(i)))},_n.prototype.get=function(e){return typeof e!="string"&&(e=e.id),this._tooltips[e]},_n.prototype.clearTimeout=function(e){if(e=this.get(e),!!e){var t=e.removeTimer;t&&(clearTimeout(t),e.removeTimer=null)}},_n.prototype.setTimeout=function(e){if(e=this.get(e),!!e){this.clearTimeout(e);var t=this;e.removeTimer=setTimeout(function(){t.remove(e)},e.timeout)}},_n.prototype.remove=function(e){var t=this.get(e);t&&(li(t.html),li(t.htmlContainer),delete t.htmlContainer,delete this._tooltips[t.id])},_n.prototype.show=function(){Of(this._tooltipRoot)},_n.prototype.hide=function(){Of(this._tooltipRoot,!1)},_n.prototype._updateRoot=function(e){var t=e.scale||1,n=e.scale||1,i="matrix("+t+",0,0,"+n+","+-1*e.x*t+","+-1*e.y*n+")";this._tooltipRoot.style.transform=i,this._tooltipRoot.style["-ms-transform"]=i},_n.prototype._addTooltip=function(e){var t=e.id,n=e.html,i,r=this._tooltipRoot;n.get&&n.constructor.prototype.jquery&&(n=n.get(0)),wn(n)&&(n=ft(n)),i=ft('<div data-tooltip-id="'+t+'" class="'+U_+'">'),dn(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)},_n.prototype._updateTooltip=function(e){var t=e.position,n=e.htmlContainer;hO(n,t.x,t.y)},_n.prototype._updateTooltipVisibilty=function(e){D(this._tooltips,function(t){var n=t.show,i=t.htmlContainer,r=!0;n&&((n.minZoom>e.scale||n.maxZoom<e.scale)&&(r=!1),Of(i,r))})},_n.prototype._init=function(){var e=this;function t(n){e._updateRoot(n),e._updateTooltipVisibilty(n),e.show()}this._eventBus.on("canvas.viewbox.changing",function(n){e.hide()}),this._eventBus.on("canvas.viewbox.changed",function(n){t(n.viewbox)})};const mO={__init__:["tooltips"],tooltips:["type",_n]};var gO="flow elements must be children of pools/participants",yO="Data object must be placed within a pool/participant.";function q_(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(gO)):v(a,"bpmn:DataObjectReference")&&i(r,n(yO)))})}q_.$inject=["eventBus","tooltips","translate"];const vO={__depends__:[mO],__init__:["modelingFeedback"],modelingFeedback:["type",q_]};var bO=500,_O=1250,xO=1500,vu=Math.round;function wO(e){return{x:e.x+vu(e.width/2),y:e.y+vu(e.height/2)}}function Y_(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",xO,function(s){var c=s.context,u=s.shape,l=i.get().slice();l.indexOf(u)===-1&&(l=[u]),l=EO(l),j(c,{shapes:l,validatedShapes:l,shape:u})}),e.on("shape.move.start",_O,function(s){var c=s.context,u=c.validatedShapes,l;if(l=c.canExecute=o(u),!l)return!1}),e.on("shape.move.move",bO,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=vu(u.x),u.y=vu(u.y),!(u.x===0&&u.y===0)&&n.moveElements(p,u,c.target,{primaryShape:c.shape,attach:f})}),e.on("element.mousedown",function(s){if(sr(s)){var c=Eo(s);if(!c)throw new Error("must supply DOM mousedown event");return a(c,s.element)}});function a(s,c,u,l){if(Vt(u)&&(l=u,u=!1),!(c.waypoints||!c.parent)&&!qe(s.target).has("djs-hit-no-move")){var f=wO(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}Y_.$inject=["eventBus","dragging","modeling","selection","rules"];function EO(e){var t=to(e,"id");return He(e,function(n){for(;n=n.parent;)if(t[n.id])return!1;return!0})}var K_=499,Lf="djs-dragging",X_="drop-ok",Z_="drop-not-ok",Q_="new-parent",J_="attach-ok";function ex(e,t,n,i){function r(c){var u=o(c),l=SO(u);return l}function o(c){var u=Zo(c),l=u.flatMap(d=>(d.incoming||[]).concat(d.outgoing||[])),f=u.concat(l),p=[...new Set(f)];return p}function a(c,u){[J_,X_,Z_,Q_].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,Lf),c.allDraggedElements?c.allDraggedElements.push(u):c.allDraggedElements=[u]}e.on("shape.move.start",K_,function(c){var u=c.context,l=u.shapes,f=u.allDraggedElements,p=r(l);if(!u.dragGroup){var d=_e("g");fe(d,n.cls("djs-drag-group",["no-events"]));var h=t.getActiveLayer();Oe(h,d),u.dragGroup=d}p.forEach(function(m){i.addDragger(m,u.dragGroup)}),f?f=Pu([f,o(l)]):f=o(l),D(f,function(m){t.addMarker(m,Lf)}),u.allDraggedElements=f,u.differentParents=RO(l)}),e.on("shape.move.move",K_,function(c){var u=c.context,l=u.dragGroup,f=u.target,p=u.shape.parent,d=u.canExecute;f&&(d==="attach"?a(f,J_):u.canExecute&&p&&f.id!==p.id?a(f,Q_):a(f,u.canExecute?X_:Z_)),Qt(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;D(l,function(p){t.removeMarker(p,Lf)}),f&&jt(f)}),this.makeDraggable=s}ex.$inject=["eventBus","canvas","styles","previewSupport"];function SO(e){var t=new Set;e.forEach(function(i){t.add(i.id)});var n=He(e,function(i){return at(i)?t.has(i.source.id)&&t.has(i.target.id):!0});return n}function RO(e){return x0(to(e,function(t){return t.parent&&t.parent.id}))!==1}const CO={__depends__:[uc,Wn,kf,gi,Ni,Ao],__init__:["move","movePreview"],move:["type",Y_],movePreview:["type",ex]};var tx=".djs-palette-toggle",nx=".entry",PO=tx+", "+nx,If="djs-palette-",AO="shown",Nf="open",ix="two-column",TO=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=TO),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(kO,{})},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=ft(It.HTML_MARKUP);n.appendChild(i),mt(n).add(If+AO),Cn.bind(i,PO,"click",function(r){var o=r.delegateTarget;if(Ju(o,tx))return e.toggle();e.trigger("click",r)}),Me.bind(i,"mousedown",function(r){r.stopPropagation()}),Cn.bind(i,nx,"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=mt(n),a=mt(t);"twoColumn"in e?r=e.twoColumn:r=this._needsCollapse(t.clientHeight,this._entries||{}),o.toggle(ix,r),a.toggle(If+ix,r),"open"in e&&(o.toggle(Nf,e.open),a.toggle(If+Nf,e.open)),i.fire("palette.changed",{twoColumn:r,open:this.isOpen()})},It.prototype._update=function(){var e=ot(".djs-palette-entries",this._container),t=this._entries=this.getEntries();ys(e),D(t,function(n,i){var r=n.group||"default",o=ot("[data-group="+Oa(r)+"]",e);o||(o=ft('<div class="group"></div>'),sn(o,"data-group",r),e.appendChild(o));var a=n.html||(n.separator?'<hr class="separator" />':'<div class="entry" draggable="true"></div>'),s=ft(a);if(o.appendChild(s),!n.separator&&(sn(s,"data-action",i),n.title&&sn(s,"title",n.title),n.className&&MO(s,n.className),n.imageUrl)){var c=ft("<img>");sn(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=sn(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(Wt(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=ot(".djs-palette-entries",this._container),this._toolsContainer=ot("[data-group=tools]",t)),n=this._toolsContainer,D(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")}})},It.prototype.isOpen=function(){return mt(this._container).has(Nf)},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 MO(e,t){var n=mt(e),i=Ee(t)?t:t.split(/\s+/g);i.forEach(function(r){n.add(r)})}function kO(e,t){var n=t.getPaletteEntries();return Wt(n)?n(e):(D(n,function(i,r){e[r]=i}),e)}const OO={__init__:["palette"],palette:["type",It]};var rx="crosshair",ox="selected",DO="djs-dragging-active-lasso";function xr(e,t,n,i,r,o,a){this._selection=r,this._dragging=n,this._mouse=a;var s=this,c={create:function(f){var p=t.getActiveLayer(),d=f.frame=_e("rect");fe(d,{class:"djs-lasso-overlay",width:1,height:1,x:0,y:0}),Oe(p,d),u(!0),this.update(f)},update:function(f){var p=f.frame,d=f.bbox;p&&d&&fe(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,ox);for(const g of h)m.has(g)||t.addMarker(g,ox)}},remove:function(f){this.update(f),f.frame&&jt(f.frame),u(!1)}};function u(f){qe(t.getContainer()).toggle(DO,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=ax(f),p.add=nc(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=ax(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(nc(f))return s.activateLasso(f.originalEvent),!0})}xr.$inject=["eventBus","canvas","dragging","elementRegistry","selection","toolManager","mouse"],xr.prototype.activateLasso=function(e,t){this._dragging.init(e,"lasso",{autoActivate:t,cursor:rx,data:{context:{}},keepSelection:!0})},xr.prototype.activateSelection=function(e,t){this._dragging.init(e,"lasso.selection",{trapClick:!1,autoActivate:t,cursor:rx,data:{context:{}},keepSelection:!0})},xr.prototype._select=function(e){this._selection.select(e)},xr.prototype.select=function(e,t,n=[]){var i=eo(uo(e,t));this._select([...n,...i])},xr.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateSelection(e,!!e)},xr.prototype.isActive=function(){var e=this._dragging.context();return e&&/^lasso/.test(e.prefix)};function ax(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 LO={__depends__:[dc,ga],__init__:["lassoTool"],lassoTool:["type",xr]};var Bf=1500,sx="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",Bf,function(c){if(da(c))return a.activateMove(c.originalEvent,!0),!1}),s&&s.addListener(Bf,function(c){if(!(!cx(c.keyEvent)||a.isActive())){var u=a._mouse.getLastMoveEvent();a.activateMove(u,!!u)}},"keyboard.keydown"),s&&s.addListener(Bf,function(c){!cx(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!da(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:sx,data:{context:n||{}}})},jo.prototype.activateHand=function(e,t,n){this._dragging.init(e,"hand",{trapClick:!1,autoActivate:t,cursor:sx,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 cx(e){return Ft("Space",e)}const IO={__depends__:[dc,ga],__init__:["handTool"],handTool:["type",jo]};var ux="connect-ok",lx="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?ux:lx))}),e.on(["global-connect.out","global-connect.cleanup"],function(c){var u=c.context.startTarget,l=c.context.canStartConnect;u&&i.removeMarker(u,l?ux:lx)}),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 NO={__depends__:[Cf,gi,Ni,dc,ga],globalConnect:["type",Fo]};function $f(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)}$f.$inject=["palette","create","elementFactory","spaceTool","lassoTool","handTool","globalConnect","translate"],$f.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(S){var E=n.createShape(j({type:f},m));t.start(S,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 j(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 BO={__depends__:[OO,pc,$y,LO,IO,NO,aa],__init__:["paletteProvider"],paletteProvider:["type",$f]};var $O=250;function jf(e,t,n,i,r){Q.call(this,e);function o(s){var c=s.canExecute.replacements;D(c,function(u){var l=u.oldElementId,f={type:u.newElementType};if(!s.visualReplacements[l]){var p=t.get(l);j(f,{x:p.x,y:p.y});var d=n.createShape(f);i.addShape(d,p.parent);var h=ot('[data-element-id="'+Oa(p.id)+'"]',s.dragGroup);h&&fe(h,{display:"none"});var m=r.addDragger(d,s.dragGroup);s.visualReplacements[l]=m,i.removeShape(d)}})}function a(s){var c=s.visualReplacements;D(c,function(u,l){var f=ot('[data-element-id="'+Oa(l)+'"]',s.dragGroup);f&&fe(f,{display:"inline"}),u.remove(),c[l]&&delete c[l]})}e.on("shape.move.move",$O,function(s){var c=s.context,u=c.canExecute;c.visualReplacements||(c.visualReplacements={}),u&&u.replacements?o(c):a(c)})}jf.$inject=["eventBus","elementRegistry","elementFactory","canvas","previewSupport"],pe(jf,Q);const jO={__depends__:[Ao],__init__:["bpmnReplacePreview"],bpmnReplacePreview:["type",jf]};var FO=1250,Ff=40,HO=20,zO=10,px=20,fx=["x","y"],GO=Math.abs;function dx(e){e.on(["connect.hover","connect.move","connect.end"],FO,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&&VO(t,o,YO(o)),o&&qO(i,["bpmn:Association","bpmn:DataInputAssociation","bpmn:DataOutputAssociation","bpmn:SequenceFlow"])?(n.connectionStart=Yn(r),Fe(o,["bpmn:Event","bpmn:Gateway"])&&hx(t,Yn(o)),Fe(o,["bpmn:Task","bpmn:SubProcess"])&&WO(t,o),v(a,"bpmn:BoundaryEvent")&&s===a.host&&UO(t)):mx(i,"bpmn:MessageFlow")?(v(r,"bpmn:Event")&&(n.connectionStart=Yn(r)),v(o,"bpmn:Event")&&hx(t,Yn(o))):n.connectionStart=n.initialConnectionStart)})}dx.$inject=["eventBus"];function VO(e,t,n){fx.forEach(function(i){var r=gx(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 WO(e,t){var n=Yn(t);fx.forEach(function(i){KO(e,t,i)&&Lt(e,i,n[i])})}function UO(e){var t=e.context,n=t.source,i=t.target;if(!XO(t)){var r=Yn(n),o=Zt(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;GO(c-r[s])<Ff&&(c>r[s]?u=r[s]+Ff:u=r[s]-Ff,Lt(e,s,u))})}}function hx(e,t){Lt(e,"x",t.x),Lt(e,"y",t.y)}function mx(e,t){return e&&e.type===t}function qO(e,t){return Ui(t,function(n){return mx(e,n)})}function gx(e,t){return e==="x"?t.width:t.height}function YO(e){return v(e,"bpmn:Task")?zO:HO}function KO(e,t,n){return e[n]>t[n]+px&&e[n]<t[n]+gx(n,t)-px}function XO(e){var t=e.hover,n=e.source;return t&&n&&t===n}function wr(){this._targets={},this._snapOrigins={},this._snapLocations=[],this._defaultSnaps={}}wr.prototype.getSnapOrigin=function(e){return this._snapOrigins[e]},wr.prototype.setSnapOrigin=function(e,t){this._snapOrigins[e]=t,this._snapLocations.indexOf(e)===-1&&this._snapLocations.push(e)},wr.prototype.addDefaultSnap=function(e,t){var n=this._defaultSnaps[e];n||(n=this._defaultSnaps[e]=[]),n.push(t)},wr.prototype.getSnapLocations=function(){return this._snapLocations},wr.prototype.setSnapLocations=function(e){this._snapLocations=e},wr.prototype.pointsForTarget=function(e){var t=e.id||e,n=this._targets[t];return n||(n=this._targets[t]=new 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&&$2(e[n],r[n],i)},bu.prototype.initDefaults=function(e){var t=this;D(e||{},function(n,i){D(n,function(r){t.add(i,r)})})};var ZO=1250;function _i(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"],ZO,function(r){var o=r.context,a=o.shape,s=o.snapContext,c=o.target;if(!(r.originalEvent&&Tn(r.originalEvent))&&!($o(r)||!c)){var u=s.pointsForTarget(c);u.initialized||(u=i.addSnapTargetPoints(u,a,c),u.initialized=!0),n.snap(r,u)}}),t.on(["create.cleanup","shape.move.cleanup"],function(){n.hide()})}_i.$inject=["elementRegistry","eventBus","snapping"],_i.prototype.initSnap=function(e){var t=this._elementRegistry,n=e.context,i=n.shape,r=n.snapContext;r||(r=n.snapContext=new wr);var o;t.get(i.id)?o=Yn(i,e):o={x:e.x+Yn(i).x,y:e.y+Yn(i).y};var a={x:o.x-i.width/2,y:o.y-i.height/2},s={x:o.x+i.width/2,y:o.y+i.height/2};return r.setSnapOrigin("mid",{x:o.x-e.x,y:o.y-e.y}),$e(i)||(r.setSnapOrigin("top-left",{x:a.x-e.x,y:a.y-e.y}),r.setSnapOrigin("bottom-right",{x:s.x-e.x,y:s.y-e.y})),r},_i.prototype.addSnapTargetPoints=function(e,t,n){var i=this.getSnapTargets(t,n);return D(i,function(r){if($e(r)){$e(t)&&e.add("mid",Yn(r));return}if(at(r)){if(r.waypoints.length<3)return;var o=r.waypoints.slice(1,-1);D(o,function(a){e.add("mid",a)});return}e.add("mid",Yn(r))}),!Pe(t.x)||!Pe(t.y)||this._elementRegistry.get(t.id)&&e.add("mid",Yn(t)),e},_i.prototype.getSnapTargets=function(e,t){return n_(t).filter(function(n){return!QO(n)})};function QO(e){return!!e.hidden}var yx=1500;function Ho(e,t){t.invoke(_i,this),e.on(["create.move","create.end"],yx,nD),e.on(["create.move","create.end","shape.move.move","shape.move.end"],yx,function(n){var i=n.context,r=i.canExecute,o=i.target,a=r&&(r==="attach"||r.attach);a&&!$o(n)&&JO(n,o)})}pe(Ho,_i),Ho.$inject=["eventBus","injector"],Ho.prototype.initSnap=function(e){var t=_i.prototype.initSnap.call(this,e),n=e.shape,i=!!this._elementRegistry.get(n.id);return D(n.outgoing,function(r){var o=r.waypoints[0];o=o.original||o,t.setSnapOrigin(r.id+"-docking",bx(o,i,e))}),D(n.incoming,function(r){var o=r.waypoints[r.waypoints.length-1];o=o.original||o,t.setSnapOrigin(r.id+"-docking",bx(o,i,e))}),v(n,"bpmn:Participant")&&t.setSnapLocations(["top-left","bottom-right","mid"]),t},Ho.prototype.addSnapTargetPoints=function(e,t,n){_i.prototype.addSnapTargetPoints.call(this,e,t,n);var i=this.getSnapTargets(t,n);D(i,function(o){(tD(o)||eD([t,o],"bpmn:TextAnnotation"))&&(e.add("top-left",e_(o)),e.add("bottom-right",t_(o)))});var r=this._elementRegistry;return D(t.incoming,function(o){if(r.get(t.id)){vx(i,o.source)||e.add("mid",Se(o.source));var a=o.waypoints[0];e.add(o.id+"-docking",a.original||a)}}),D(t.outgoing,function(o){if(r.get(t.id)){vx(i,o.target)||e.add("mid",Se(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 _i.prototype.getSnapTargets.call(this,e,t).filter(function(n){return!v(n,"bpmn:Lane")})};function JO(e,t){var n=xe(t),i=Lg(e,t),r=e.context,o=r.shape,a;o.parent?a={x:0,y:0}:a=Se(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 eD(e,t){return e.every(function(n){return v(n,t)})}function tD(e){return v(e,"bpmn:SubProcess")&&We(e)?!0:v(e,"bpmn:Participant")}function nD(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 vx(e,t){return e.indexOf(t)!==-1}function bx(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))&&!$o(i)){var u=c.pointsForTarget(a);u.initialized||(u=n.addSnapTargetPoints(u,o,a,s),u.initialized=!0),aD(s)&&Lt(i,"x",i.x),sD(s)&&Lt(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 wr);var o=_x(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 D(r,function(o){e.add("corner",t_(o)),e.add("corner",e_(o))}),e.add("corner",_x(t,i)),e},Ya.$inject=["eventBus","snapping"],Ya.prototype.getSnapTargets=function(e,t){return n_(t).filter(function(n){return!rD(n,e)&&!at(n)&&!oD(n)&&!$e(n)})};function _x(e,t){var n=Se(e),i=xe(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 rD(e,t){return e.host===t}function oD(e){return!!e.hidden}function aD(e){return e==="n"||e==="s"}function sD(e){return e==="e"||e==="w"}var cD=7,uD=1e3;function Er(e){this._canvas=e,this._asyncHide=Tu(vn(this.hide,this),uD)}Er.$inject=["canvas"],Er.prototype.snap=function(e,t){var n=e.context,i=n.snapContext,r=i.getSnapLocations(),o={x:$o(e,"x"),y:$o(e,"y")};D(r,function(a){var s=i.getSnapOrigin(a),c={x:e.x+s.x,y:e.y+s.y};if(D(["x","y"],function(u){var l;o[u]||(l=t.snap(c,a,u,cD),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),D(["x","y"],function(a){var s=o[a];Vt(s)&&Lt(e,a,s.originValue)})},Er.prototype._createLine=function(e){var t=this._canvas.getLayer("snap"),n=_e("path");return fe(n,{d:"M0,0 L0,0"}),qe(n).add("djs-snap-line"),Oe(t,n),{update:function(i){Pe(i)?e==="horizontal"?fe(n,{d:"M-100000,"+i+" L+100000,"+i,display:""}):fe(n,{d:"M "+i+",-100000 L "+i+", +100000",display:""}):fe(n,{display:"none"})}}},Er.prototype._createSnapLines=function(){this._snapLines={horizontal:this._createLine("horizontal"),vertical:this._createLine("vertical")}},Er.prototype.showSnapLine=function(e,t){var n=this.getSnapLine(e);n&&n.update(t),this._asyncHide()},Er.prototype.getSnapLine=function(e){return this._snapLines||this._createSnapLines(),this._snapLines[e]},Er.prototype.hide=function(){D(this._snapLines,function(e){e.update()})};const lD={__depends__:[{__init__:["createMoveSnapping","resizeSnapping","snapping"],createMoveSnapping:["type",_i],resizeSnapping:["type",Ya],snapping:["type",Er]}],__init__:["connectSnapping","createMoveSnapping"],connectSnapping:["type",dx],createMoveSnapping:["type",Ho]};var xx=300;function De(e,t,n,i){this._open=!1,this._results={},this._eventMaps=[],this._cachedRootElement=null,this._cachedSelection=null,this._cachedViewbox=null,this._canvas=e,this._eventBus=t,this._selection=n,this._translate=i,this._container=this._getBoxHtml(),this._searchInput=ot(De.INPUT_SELECTOR,this._container),this._resultsContainer=ot(De.RESULTS_CONTAINER_SELECTOR,this._container),this._canvas.getContainer().appendChild(this._container),t.on(["canvas.destroy","diagram.destroy","drag.init","elements.changed"],this.close,this)}De.$inject=["canvas","eventBus","selection","translate"],De.prototype._bindEvents=function(){var e=this;function t(n,i,r,o){e._eventMaps.push({el:n,type:r,listener:Cn.bind(n,i,r,o)})}t(document,"html","click",function(n){e.close(!1)}),t(this._container,De.INPUT_SELECTOR,"click",function(n){n.stopPropagation(),n.delegateTarget.focus()}),t(this._container,De.RESULT_SELECTOR,"mouseover",function(n){n.stopPropagation(),e._scrollToNode(n.delegateTarget),e._preselect(n.delegateTarget)}),t(this._container,De.RESULT_SELECTOR,"click",function(n){n.stopPropagation(),e._select(n.delegateTarget)}),t(this._container,De.INPUT_SELECTOR,"keydown",function(n){Ft("ArrowUp",n)&&n.preventDefault(),Ft("ArrowDown",n)&&n.preventDefault()}),t(this._container,De.INPUT_SELECTOR,"keyup",function(n){if(Ft("Escape",n))return e.close();if(Ft("Enter",n)){var i=e._getCurrentResult();return i?e._select(i):e.close(!1)}if(Ft("ArrowUp",n))return e._scrollToDirection(!0);if(Ft("ArrowDown",n))return e._scrollToDirection();Ft(["ArrowLeft","ArrowRight"],n)||e._search(n.delegateTarget.value)})},De.prototype._unbindEvents=function(){this._eventMaps.forEach(function(e){Cn.unbind(e.el,e.type,e.listener)})},De.prototype._search=function(e){var t=this;if(this._clearResults(),!!e.trim()){var n=this._searchProvider.find(e);if(n=n.filter(function(r){return!t._canvas.getRootElements().includes(r.element)}),!n.length){this._selection.select(null);return}n.forEach(function(r){var o=r.element.id,a=t._createResultNode(r,o);t._results[o]={element:r.element,node:a}});var i=ot(De.RESULT_SELECTOR,this._resultsContainer);this._scrollToNode(i),this._preselect(i)}},De.prototype._scrollToDirection=function(e){var t=this._getCurrentResult();if(t){var n=e?t.previousElementSibling:t.nextElementSibling;n&&(this._scrollToNode(n),this._preselect(n))}},De.prototype._scrollToNode=function(e){if(!(!e||e===this._getCurrentResult())){var t=e.offsetTop,n=this._resultsContainer.scrollTop,i=t-this._resultsContainer.clientHeight+e.clientHeight;t<n?this._resultsContainer.scrollTop=t:n<i&&(this._resultsContainer.scrollTop=i)}},De.prototype._clearResults=function(){ys(this._resultsContainer),this._results={},this._eventBus.fire("searchPad.cleared")},De.prototype._getCurrentResult=function(){return ot(De.RESULT_SELECTED_SELECTOR,this._resultsContainer)},De.prototype._createResultNode=function(e,t){var n=ft(De.RESULT_HTML);return e.primaryTokens.length>0&&wx(n,e.primaryTokens,De.RESULT_PRIMARY_HTML),wx(n,e.secondaryTokens,De.RESULT_SECONDARY_HTML),sn(n,De.RESULT_ID_ATTRIBUTE,t),this._resultsContainer.appendChild(n),n},De.prototype.registerProvider=function(e){this._searchProvider=e},De.prototype.open=function(){if(!this._searchProvider)throw new Error("no search provider registered");this.isOpen()||(this._cachedRootElement=this._canvas.getRootElement(),this._cachedSelection=this._selection.get(),this._cachedViewbox=this._canvas.viewbox(),this._selection.select(null),this._bindEvents(),this._open=!0,mt(this._canvas.getContainer()).add("djs-search-open"),mt(this._container).add("open"),this._searchInput.focus(),this._eventBus.fire("searchPad.opened"))},De.prototype.close=function(e=!0){this.isOpen()&&(e&&(this._cachedRootElement&&this._canvas.setRootElement(this._cachedRootElement),this._cachedSelection&&this._selection.select(this._cachedSelection),this._cachedViewbox&&this._canvas.viewbox(this._cachedViewbox),this._eventBus.fire("searchPad.restored")),this._cachedRootElement=null,this._cachedSelection=null,this._cachedViewbox=null,this._unbindEvents(),this._open=!1,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())},De.prototype.toggle=function(){this.isOpen()?this.close():this.open()},De.prototype.isOpen=function(){return this._open},De.prototype._preselect=function(e){var t=this._getCurrentResult();if(e!==t){t&&mt(t).remove(De.RESULT_SELECTED_CLASS);var n=sn(e,De.RESULT_ID_ATTRIBUTE),i=this._results[n].element;mt(e).add(De.RESULT_SELECTED_CLASS),this._canvas.scrollToElement(i,{top:xx}),this._selection.select(i),this._eventBus.fire("searchPad.preselected",i)}},De.prototype._select=function(e){var t=sn(e,De.RESULT_ID_ATTRIBUTE),n=this._results[t].element;this._cachedSelection=null,this._cachedViewbox=null,this.close(!1),this._canvas.scrollToElement(n,{top:xx}),this._selection.select(n),this._eventBus.fire("searchPad.selected",n)},De.prototype._getBoxHtml=function(){const e=ft(De.BOX_HTML),t=ot(De.INPUT_SELECTOR,e);return t&&t.setAttribute("aria-label",this._translate("Search in diagram")),e};function wx(e,t,n){var i=pD(t),r=ft(n);r.innerHTML=i,e.appendChild(r)}function pD(e){var t="";return e.forEach(function(n){var i=Mv(n.value||n.matched||n.normal),r=n.match||n.matched;r?t+='<b class="'+De.RESULT_HIGHLIGHT_CLASS+'">'+i+"</b>":t+=i}),t!==""?t:null}De.CONTAINER_SELECTOR=".djs-search-container",De.INPUT_SELECTOR=".djs-search-input input",De.RESULTS_CONTAINER_SELECTOR=".djs-search-results",De.RESULT_SELECTOR=".djs-search-result",De.RESULT_SELECTED_CLASS="djs-search-result-selected",De.RESULT_SELECTED_SELECTOR="."+De.RESULT_SELECTED_CLASS,De.RESULT_ID_ATTRIBUTE="data-result-id",De.RESULT_HIGHLIGHT_CLASS="djs-search-highlight",De.BOX_HTML=`<div class="djs-search-container djs-scrollable">
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>`,De.RESULT_HTML='<div class="djs-search-result"></div>',De.RESULT_PRIMARY_HTML='<div class="djs-search-result-primary"></div>',De.RESULT_SECONDARY_HTML='<p class="djs-search-result-secondary"></p>';const cD={__depends__:[aa,Ic,Wn],searchPad:["type",De]};function Hf(e,t,n,i){this._elementRegistry=e,this._canvas=n,this._search=i,t.registerProvider(this)}Hf.$inject=["elementRegistry","searchPad","canvas","search"],Hf.prototype.find=function(e){var t=this._canvas.getRootElements(),n=this._elementRegistry.filter(function(i){return!$e(i)&&!t.includes(i)});return this._search(n.map(i=>({element:i,label:Bn(i),id:i.id})),e,{keys:["label","id"]}).map(uD)};function uD(e){const{item:{element:t},tokens:n}=e;return{element:t,primaryTokens:n.label,secondaryTokens:n.id}}const lD={__depends__:[cD,D_],__init__:["bpmnSearch"],bpmnSearch:["type",Hf]},pD="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",fD="M1.03845 48.1347C1.03845 49.3511 1.07295 50.758 1.38342 52.064C1.69949 53.3938 2.32428 54.7154 3.56383 55.6428C6.02533 57.4841 10.1161 58.7685 14.8212 59.6067C19.5772 60.4538 25.1388 60.8738 30.6831 60.8738C36.2276 60.8738 41.7891 60.4538 46.545 59.6067C51.2504 58.7687 55.3412 57.4842 57.8028 55.6429C59.0424 54.7156 59.6673 53.3938 59.9834 52.064C60.2938 50.7579 60.3285 49.351 60.3285 48.1344V13.8415C60.3285 12.6249 60.2938 11.218 59.9834 9.91171C59.6673 8.58194 59.0423 7.2602 57.8027 6.33294C55.341 4.49168 51.2503 3.20723 46.545 2.36914C41.7891 1.522 36.2276 1.10204 30.6831 1.10205C25.1388 1.10206 19.5772 1.52206 14.8213 2.36923C10.1162 3.20734 6.02543 4.49183 3.5639 6.33314C2.32433 7.26038 1.69951 8.58206 1.38343 9.91181C1.07295 11.2179 1.03845 12.6247 1.03845 13.8411V48.1347Z",dD={width:36,height:50},hD={width:50,height:50};function wx(e,t,n){return be("path",{d:e,strokeWidth:2,transform:`translate(${t.x}, ${t.y})`,...n})}const Zn=5;function bu(e,t){this._styles=t,e.registerProvider(this)}bu.$inject=["outline","styles"],bu.prototype.getOutline=function(e){const t=this._styles.cls("djs-outline",["no-fill"]);var n;if($S(e))return n=be("rect"),fe(n,j({x:-Zn,y:-Zn,rx:4,width:e.width+Zn*2,height:e.height+Zn*2},t)),n;if(!$e(e))return v(e,"bpmn:Gateway")?(n=be("rect"),j(n.style,{"transform-box":"fill-box",transform:"rotate(45deg)","transform-origin":"center"}),fe(n,j({x:2,y:2,rx:4,width:e.width-4,height:e.height-4},t))):Fe(e,["bpmn:Task","bpmn:SubProcess","bpmn:Group","bpmn:CallActivity"])?(n=be("rect"),fe(n,j({x:-Zn,y:-Zn,rx:14,width:e.width+Zn*2,height:e.height+Zn*2},t))):v(e,"bpmn:EndEvent")?(n=be("circle"),fe(n,j({cx:e.width/2,cy:e.height/2,r:e.width/2+Zn+1},t))):v(e,"bpmn:Event")?(n=be("circle"),fe(n,j({cx:e.width/2,cy:e.height/2,r:e.width/2+Zn},t))):v(e,"bpmn:DataObjectReference")&&Ex(e,"bpmn:DataObjectReference")?n=wx(pD,{x:-6,y:-6},t):v(e,"bpmn:DataStoreReference")&&Ex(e,"bpmn:DataStoreReference")&&(n=wx(fD,{x:-6,y:-6},t)),n},bu.prototype.updateOutline=function(e,t){if(!$e(e))return Fe(e,["bpmn:SubProcess","bpmn:Group"])?(fe(t,{width:e.width+Zn*2,height:e.height+Zn*2}),!0):!!Fe(e,["bpmn:Event","bpmn:Gateway","bpmn:DataStoreReference","bpmn:DataObjectReference"])};function Ex(e,t){var n;return t==="bpmn:DataObjectReference"?n=dD:t==="bpmn:DataStoreReference"&&(n=hD),e.width===n.width&&e.height===n.height}const mD={__depends__:[kf],__init__:["outlineProvider"],outlineProvider:["type",bu]};var gD='<?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 xi(e){fo.call(this,e)}pe(xi,fo),xi.Viewer=gr,xi.NavigatedViewer=Da,xi.prototype.createDiagram=function(){return this.importXML(gD)},xi.prototype._interactionModules=[Nv,$v,Hv],xi.prototype._modelingModules=[v2,Dc,E2,x2,N2,Cf,z2,dk,Cy,pc,yk,bk,Nk,$k,jk,Vk,nO,sO,Zp,hO,wO,DO,IO,Bb,aD,lD,mD],xi.prototype._modules=[].concat(gr.prototype._modules,xi.prototype._interactionModules,xi.prototype._modelingModules);const yD=((e,t)=>{const n=e.__vccOpts||e;for(const[i,r]of t)n[i]=r;return n})(At.defineComponent({__name:"BpmnModelerView",props:{xml:{}},emits:["ready","imported","import-error"],setup(e,{expose:t,emit:n}){const i=e,r=n,o=At.ref();let a;async function s(u){if(!a)throw new Error("modeler not mounted");try{const{warnings:l}=await a.importXML(u),f=Gu(l);return r("imported",f),{warnings:f}}catch(l){throw r("import-error",l),l}}async function c(){if(!a)throw new Error("modeler not mounted");const{xml:u}=await a.saveXML({format:!0});return u??""}return At.onMounted(async()=>{a=new xi({container:o.value,moddleExtensions:rs}),i.xml&&await s(i.xml),r("ready")}),At.watch(()=>i.xml,u=>{u&&a&&s(u)}),At.onBeforeUnmount(()=>{a==null||a.destroy(),a=void 0}),t({importXml:s,saveXml:c,getModeler:()=>a}),(u,l)=>(At.openBlock(),At.createElementBlock("div",{ref_key:"container",ref:o,class:"bpmn-modeler-view"},null,512))}}),[["__scopeId","data-v-a9b41c97"]]);ie.APPLY_BPMN_OPS_SCHEMA=g0,ie.BPMN_MODDLE_EXTENSIONS=rs,ie.BWL_MODDLE_SCHEMA=Kf,ie.BWL_NS=Yf,ie.BWL_PREFIX=Su,ie.BWL_SIDES=Ru,ie.BpmnModelerView=yD,ie.EDITOR=BE,ie.FLOW_LABEL_INDENT=Md,ie.HEADLESS_BPMN_MODULES=Cv,ie.HEADLESS_TEXT_METRICS=oo,ie.I18N_NS=Yw,ie.I18N_PREFIX=bd,ie.LABEL_FORK_MARGIN=Wu,ie.MVP_FLOW_NODE_TYPES=wi,ie.SYMBOLIC_OP_KINDS=Qf,ie.SYMBOLIC_OP_SCHEMA=Jf,ie.UNDO_EPISODE_COMMAND=Cu,ie.applyBpmnOpBatch=_h,ie.applyBpmnOps=mh,ie.approximateTextWidth=ao,ie.auditBpmnGeometry=jd,ie.auditBpmnGeometryXml=mE,ie.auditGeometry=Ai,ie.auditTargetsOf=si,ie.axisSegmentsOf=fn,ie.blackBoxNameRect=Vu,ie.buildBpmnOpBatch=NE,ie.buildRegistryIndex=Hd,ie.containerBoundarySegments=Uo,ie.createBpmnEditorController=$E,ie.createBpmnModdle=xd,ie.createHeadlessBpmnModeler=rM,ie.crossedShapesOf=jn,ie.crossingCost=Pi,ie.describeProcess=vh,ie.describeProcessXml=IE,ie.edgeCrossCount=us,ie.edgeCrossingPairsOf=qu,ie.executeAsUndoEpisode=Zf,ie.forwardThreePointCandidates=Yu,ie.geometryFindingKey=Si,ie.installHeadlessBpmnDom=Ed,ie.isMvpFlowNodeType=qf,ie.labelRectsOf=qo,ie.lineCrossesLabel=Ci,ie.lineThroughLabel=Od,ie.lineThroughShapeLabel=Bd,ie.loadBpmnXml=zu,ie.lowerOps=hh,ie.oppositeOverlapCount=oE,ie.oppositeOverlapOf=Td,ie.planBackEdgeBoundaryClearance=Jd,ie.planCrossPoolRoute=Kd,ie.planEdgeRepair=Ud,ie.planLabelLineClearance=rh,ie.planLabelPlacement=ih,ie.planMiddleSegmentShifts=Vd,ie.planOppositeOverlapRepair=th,ie.planSegmentDetours=Gd,ie.planShapeLabelClearance=sh,ie.repairIntroducedBoundaryHugging=eh,ie.repairIntroducedCrossings=qd,ie.repairIntroducedLabelLines=oh,ie.repairIntroducedOppositeOverlaps=nh,ie.repairIntroducedShapeLabelLines=ch,ie.repairIntroducedSharedSegmentLabels=ah,ie.rerouteIntroducedCrossPoolEdges=Xd,ie.resolverServicesOf=fh,ie.saveBpmnXml=Kw,ie.sceneCrossingCost=Ld,ie.sceneFromDefinitions=$d,ie.sceneFromRegistry=Et,ie.sharedSegmentUnderLabel=cs,ie.sharedSpansOf=ss,ie.unreadableOverlapCount=Ri,ie.unreadableOverlapOf=as,ie.validateOps=ph,ie.warningMessages=Gu,Object.defineProperty(ie,Symbol.toStringTag,{value:"Module"})}));
343
+ </div>`,De.RESULT_HTML='<div class="djs-search-result"></div>',De.RESULT_PRIMARY_HTML='<div class="djs-search-result-primary"></div>',De.RESULT_SECONDARY_HTML='<p class="djs-search-result-secondary"></p>';const fD={__depends__:[aa,Ic,Wn],searchPad:["type",De]};function Hf(e,t,n,i){this._elementRegistry=e,this._canvas=n,this._search=i,t.registerProvider(this)}Hf.$inject=["elementRegistry","searchPad","canvas","search"],Hf.prototype.find=function(e){var t=this._canvas.getRootElements(),n=this._elementRegistry.filter(function(i){return!$e(i)&&!t.includes(i)});return this._search(n.map(i=>({element:i,label:Bn(i),id:i.id})),e,{keys:["label","id"]}).map(dD)};function dD(e){const{item:{element:t},tokens:n}=e;return{element:t,primaryTokens:n.label,secondaryTokens:n.id}}const hD={__depends__:[fD,Lb],__init__:["bpmnSearch"],bpmnSearch:["type",Hf]},mD="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",gD="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",yD={width:36,height:50},vD={width:50,height:50};function Ex(e,t,n){return _e("path",{d:e,strokeWidth:2,transform:`translate(${t.x}, ${t.y})`,...n})}const Zn=5;function _u(e,t){this._styles=t,e.registerProvider(this)}_u.$inject=["outline","styles"],_u.prototype.getOutline=function(e){const t=this._styles.cls("djs-outline",["no-fill"]);var n;if(zS(e))return n=_e("rect"),fe(n,j({x:-Zn,y:-Zn,rx:4,width:e.width+Zn*2,height:e.height+Zn*2},t)),n;if(!$e(e))return v(e,"bpmn:Gateway")?(n=_e("rect"),j(n.style,{"transform-box":"fill-box",transform:"rotate(45deg)","transform-origin":"center"}),fe(n,j({x:2,y:2,rx:4,width:e.width-4,height:e.height-4},t))):Fe(e,["bpmn:Task","bpmn:SubProcess","bpmn:Group","bpmn:CallActivity"])?(n=_e("rect"),fe(n,j({x:-Zn,y:-Zn,rx:14,width:e.width+Zn*2,height:e.height+Zn*2},t))):v(e,"bpmn:EndEvent")?(n=_e("circle"),fe(n,j({cx:e.width/2,cy:e.height/2,r:e.width/2+Zn+1},t))):v(e,"bpmn:Event")?(n=_e("circle"),fe(n,j({cx:e.width/2,cy:e.height/2,r:e.width/2+Zn},t))):v(e,"bpmn:DataObjectReference")&&Sx(e,"bpmn:DataObjectReference")?n=Ex(mD,{x:-6,y:-6},t):v(e,"bpmn:DataStoreReference")&&Sx(e,"bpmn:DataStoreReference")&&(n=Ex(gD,{x:-6,y:-6},t)),n},_u.prototype.updateOutline=function(e,t){if(!$e(e))return Fe(e,["bpmn:SubProcess","bpmn:Group"])?(fe(t,{width:e.width+Zn*2,height:e.height+Zn*2}),!0):!!Fe(e,["bpmn:Event","bpmn:Gateway","bpmn:DataStoreReference","bpmn:DataObjectReference"])};function Sx(e,t){var n;return t==="bpmn:DataObjectReference"?n=yD:t==="bpmn:DataStoreReference"&&(n=vD),e.width===n.width&&e.height===n.height}const bD={__depends__:[kf],__init__:["outlineProvider"],outlineProvider:["type",_u]};var _D='<?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 xi(e){fo.call(this,e)}pe(xi,fo),xi.Viewer=gr,xi.NavigatedViewer=Da,xi.prototype.createDiagram=function(){return this.importXML(_D)},xi.prototype._interactionModules=[Bv,jv,zv],xi.prototype._modelingModules=[w2,Dc,P2,R2,F2,Cf,U2,yk,Py,pc,xk,Sk,Fk,zk,Gk,Yk,aO,pO,Zp,vO,CO,BO,jO,$_,lD,hD,bD],xi.prototype._modules=[].concat(gr.prototype._modules,xi.prototype._interactionModules,xi.prototype._modelingModules);const xD=((e,t)=>{const n=e.__vccOpts||e;for(const[i,r]of t)n[i]=r;return n})(At.defineComponent({__name:"BpmnModelerView",props:{xml:{}},emits:["ready","imported","import-error"],setup(e,{expose:t,emit:n}){const i=e,r=n,o=At.ref();let a;async function s(u){if(!a)throw new Error("modeler not mounted");try{const{warnings:l}=await a.importXML(u),f=Gu(l);return r("imported",f),{warnings:f}}catch(l){throw r("import-error",l),l}}async function c(){if(!a)throw new Error("modeler not mounted");const{xml:u}=await a.saveXML({format:!0});return u??""}return At.onMounted(async()=>{a=new xi({container:o.value,moddleExtensions:rs}),i.xml&&await s(i.xml),r("ready")}),At.watch(()=>i.xml,u=>{u&&a&&s(u)}),At.onBeforeUnmount(()=>{a==null||a.destroy(),a=void 0}),t({importXml:s,saveXml:c,getModeler:()=>a}),(u,l)=>(At.openBlock(),At.createElementBlock("div",{ref_key:"container",ref:o,class:"bpmn-modeler-view"},null,512))}}),[["__scopeId","data-v-a9b41c97"]]);ne.APPLY_BPMN_OPS_SCHEMA=y0,ne.BPMN_MODDLE_EXTENSIONS=rs,ne.BWL_MODDLE_SCHEMA=Kf,ne.BWL_NS=Yf,ne.BWL_PREFIX=Su,ne.BWL_SIDES=Ru,ne.BpmnModelerView=xD,ne.EDITOR=HE,ne.FLOW_LABEL_INDENT=Md,ne.HEADLESS_BPMN_MODULES=Pv,ne.HEADLESS_TEXT_METRICS=oo,ne.I18N_NS=Kw,ne.I18N_PREFIX=_d,ne.LABEL_FORK_MARGIN=Wu,ne.MVP_FLOW_NODE_TYPES=wi,ne.SYMBOLIC_OP_KINDS=Qf,ne.SYMBOLIC_OP_SCHEMA=Jf,ne.UNDO_EPISODE_COMMAND=Cu,ne.applyBpmnOpBatch=_h,ne.applyBpmnOps=gh,ne.approximateTextWidth=ao,ne.auditBpmnGeometry=Fd,ne.auditBpmnGeometryXml=bE,ne.auditGeometry=Ai,ne.auditTargetsOf=si,ne.axisSegmentsOf=fn,ne.blackBoxNameRect=Vu,ne.buildBpmnOpBatch=FE,ne.buildRegistryIndex=zd,ne.containerBoundarySegments=Uo,ne.createBpmnEditorController=zE,ne.createBpmnModdle=xd,ne.createHeadlessBpmnModeler=cM,ne.crossedShapesOf=jn,ne.crossingCost=Pi,ne.describeProcess=bh,ne.describeProcessXml=jE,ne.edgeCrossCount=us,ne.edgeCrossingPairsOf=qu,ne.edgeCrossingStatsOf=Id,ne.executeAsUndoEpisode=Zf,ne.forwardThreePointCandidates=Yu,ne.geometryFindingKey=Si,ne.installHeadlessBpmnDom=Ed,ne.isMvpFlowNodeType=qf,ne.labelRectsOf=qo,ne.lineCrossesLabel=Ci,ne.lineThroughLabel=Od,ne.lineThroughShapeLabel=$d,ne.loadBpmnXml=zu,ne.lowerOps=mh,ne.oppositeOverlapCount=sE,ne.oppositeOverlapOf=Td,ne.planBackEdgeBoundaryClearance=eh,ne.planCrossPoolRoute=Xd,ne.planEdgeRepair=qd,ne.planLabelLineClearance=oh,ne.planLabelPlacement=rh,ne.planMiddleSegmentShifts=Wd,ne.planOppositeOverlapRepair=nh,ne.planSegmentDetours=Vd,ne.planShapeLabelClearance=ch,ne.repairIntroducedBoundaryHugging=th,ne.repairIntroducedCrossings=Yd,ne.repairIntroducedLabelLines=ah,ne.repairIntroducedOppositeOverlaps=ih,ne.repairIntroducedShapeLabelLines=uh,ne.repairIntroducedSharedSegmentLabels=sh,ne.rerouteIntroducedCrossPoolEdges=Zd,ne.resolverServicesOf=dh,ne.saveBpmnXml=Xw,ne.sceneCrossingCost=Ld,ne.sceneFromDefinitions=jd,ne.sceneFromRegistry=Et,ne.sharedSegmentUnderLabel=cs,ne.sharedSpansOf=ss,ne.unreadableOverlapCount=Ri,ne.unreadableOverlapOf=as,ne.validateOps=fh,ne.warningMessages=Gu,Object.defineProperty(ne,Symbol.toStringTag,{value:"Module"})}));